From: support Date: Wed, 27 Apr 2022 16:14:20 +0000 (+0000) Subject: Built motion from commit 53d7b133.|2.6.9 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=99919fd0cfe5e12dc5dbe425bbb5cf44540efdd2;p=motion2.git Built motion from commit 53d7b133.|2.6.9 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2121fc3..cfa2c8b 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-04-27T15:12:09.800Z", + "time": "2022-04-27T16:06:29.519Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 439a9fa..c2625f7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-27T15:12:09.800Z", + "time": "2022-04-27T16:06:29.519Z", "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 d1766e6..ce7211b 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 _0xefe2=['STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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','getDataValue','action'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xefe2,0x178));var _0x2efe=function(_0xe17f73,_0x270de8){_0xe17f73=_0xe17f73-0x0;var _0x585156=_0xefe2[_0xe17f73];return _0x585156;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3de1ac){return this[_0x2efe('0x2')](_0x2efe('0x3'));}},'action':{'type':Sequelize[_0x2efe('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x2efe('0x5'),_0x2efe('0x6'),_0x2efe('0x7'),_0x2efe('0x8'),_0x2efe('0x9'),_0x2efe('0xa'),_0x2efe('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2efe('0xc')},'data1':{'type':Sequelize[_0x2efe('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x2efe('0x4')](0x1000),'comment':_0x2efe('0xd')},'data3':{'type':Sequelize[_0x2efe('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['STRING'](0x1000),'comments':_0x2efe('0xe')},'data5':{'type':Sequelize[_0x2efe('0x4')](0x1000),'comments':_0x2efe('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0x2efe('0x10')},'data7':{'type':Sequelize[_0x2efe('0x11')],'comments':_0x2efe('0x12')}}; \ No newline at end of file +var _0x1b19=['jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','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]','TEXT','exports','VIRTUAL','getDataValue','STRING','contactManager','motionbar'];(function(_0x33b93e,_0x1d19e3){var _0x1bc54e=function(_0x7e0970){while(--_0x7e0970){_0x33b93e['push'](_0x33b93e['shift']());}};_0x1bc54e(++_0x1d19e3);}(_0x1b19,0x1ca));var _0x91b1=function(_0x28ff84,_0x2db9c3){_0x28ff84=_0x28ff84-0x0;var _0x27d56b=_0x1b19[_0x28ff84];return _0x27d56b;};'use strict';var Sequelize=require('sequelize');module[_0x91b1('0x0')]={'name':{'type':Sequelize[_0x91b1('0x1')],'get':function(_0x40efbb){return this[_0x91b1('0x2')]('action');}},'action':{'type':Sequelize[_0x91b1('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x91b1('0x4'),'integration',_0x91b1('0x5'),_0x91b1('0x6'),_0x91b1('0x7'),'browser',_0x91b1('0x8'),_0x91b1('0x9')]],'msg':_0x91b1('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x91b1('0x3')](0x1000),'comment':_0x91b1('0xb')},'data2':{'type':Sequelize[_0x91b1('0x3')](0x1000),'comment':_0x91b1('0xc')},'data3':{'type':Sequelize[_0x91b1('0x3')](0x1000),'comment':_0x91b1('0xd')},'data4':{'type':Sequelize[_0x91b1('0x3')](0x1000),'comments':_0x91b1('0xe')},'data5':{'type':Sequelize[_0x91b1('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x91b1('0x3')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x91b1('0xf')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 9c746fc..10f1e82 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 _0x80b8=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','update','Action','find','params','body','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x40d69c,_0x17a711){var _0xb7f3c=function(_0x3fd9d4){while(--_0x3fd9d4){_0x40d69c['push'](_0x40d69c['shift']());}};_0xb7f3c(++_0x17a711);}(_0x80b8,0x1ec));var _0x880b=function(_0x149fdd,_0x1f095b){_0x149fdd=_0x149fdd-0x0;var _0x11db5e=_0x80b8[_0x149fdd];return _0x11db5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x880b('0x0'));var zipdir=require(_0x880b('0x1'));var jsonpatch=require(_0x880b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x880b('0x3'));var Mustache=require(_0x880b('0x4'));var util=require(_0x880b('0x5'));var path=require('path');var sox=require(_0x880b('0x6'));var csv=require(_0x880b('0x7'));var ejs=require(_0x880b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x880b('0x9'));var squel=require('squel');var crypto=require(_0x880b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x880b('0x7'));var querystring=require(_0x880b('0xb'));var Papa=require(_0x880b('0xc'));var Redis=require('ioredis');var authService=require(_0x880b('0xd'));var qs=require(_0x880b('0xe'));var as=require(_0x880b('0xf'));var hardwareService=require(_0x880b('0x10'));var logger=require(_0x880b('0x11'))('api');var utils=require(_0x880b('0x12'));var config=require(_0x880b('0x13'));var licenseUtil=require(_0x880b('0x14'));var db=require(_0x880b('0x15'))['db'];function respondWithStatusCode(_0x4d9797,_0x555ec3){_0x555ec3=_0x555ec3||0xcc;return function(_0x3cc8d6){if(_0x3cc8d6){return _0x4d9797[_0x880b('0x16')](_0x555ec3);}return _0x4d9797['status'](_0x555ec3)[_0x880b('0x17')]();};}function respondWithResult(_0x211673,_0x5a4646){_0x5a4646=_0x5a4646||0xc8;return function(_0x4d1d7e){if(_0x4d1d7e){return _0x211673[_0x880b('0x18')](_0x5a4646)['json'](_0x4d1d7e);}};}function respondWithFilteredResult(_0x1f435a,_0x4328d6){return function(_0x283a1f){if(_0x283a1f){var _0x162a12=typeof _0x4328d6[_0x880b('0x19')]===_0x880b('0x1a')&&typeof _0x4328d6[_0x880b('0x1b')]===_0x880b('0x1a');var _0x2cea05=_0x283a1f['count'];var _0x31f095=_0x162a12?0x0:_0x4328d6[_0x880b('0x19')];var _0xb6e64f=_0x162a12?_0x283a1f[_0x880b('0x1c')]:_0x4328d6[_0x880b('0x19')]+_0x4328d6['limit'];var _0xe7aa3f;if(_0xb6e64f>=_0x2cea05){_0xb6e64f=_0x2cea05;_0xe7aa3f=0xc8;}else{_0xe7aa3f=0xce;}_0x1f435a[_0x880b('0x18')](_0xe7aa3f);return _0x1f435a[_0x880b('0x1d')](_0x880b('0x1e'),_0x31f095+'-'+_0xb6e64f+'/'+_0x2cea05)[_0x880b('0x1f')](_0x283a1f);}return null;};}function patchUpdates(_0x309b8b){return function(_0x233643){try{jsonpatch[_0x880b('0x20')](_0x233643,_0x309b8b,!![]);}catch(_0xa13455){return BPromise[_0x880b('0x21')](_0xa13455);}return _0x233643[_0x880b('0x22')]();};}function saveUpdates(_0x2f0ecd,_0x34e1d7){return function(_0x2a8876){if(_0x2a8876){return _0x2a8876['update'](_0x2f0ecd)[_0x880b('0x23')](function(_0x2fed28){return _0x2fed28;});}return null;};}function removeEntity(_0x1fe258,_0x57acf6){return function(_0x52beeb){if(_0x52beeb){return _0x52beeb[_0x880b('0x24')]()['then'](function(){_0x1fe258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bde84,_0xb8b325){return function(_0x1079e7){if(!_0x1079e7){_0x5bde84['sendStatus'](0x194);}return _0x1079e7;};}function handleError(_0xc428d5,_0x2c580d){_0x2c580d=_0x2c580d||0x1f4;return function(_0x44f6cf){logger[_0x880b('0x25')](_0x44f6cf[_0x880b('0x26')]);if(_0x44f6cf[_0x880b('0x27')]){delete _0x44f6cf[_0x880b('0x27')];}_0xc428d5[_0x880b('0x18')](_0x2c580d)[_0x880b('0x28')](_0x44f6cf);};}exports[_0x880b('0x29')]=function(_0x1cb447,_0x1e03f7){if(_0x1cb447['body']['id']){delete _0x1cb447['body']['id'];}return db[_0x880b('0x2a')][_0x880b('0x2b')]({'where':{'id':_0x1cb447[_0x880b('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1e03f7,null))[_0x880b('0x23')](saveUpdates(_0x1cb447[_0x880b('0x2d')],null))[_0x880b('0x23')](respondWithResult(_0x1e03f7,null))['catch'](handleError(_0x1e03f7,null));};exports[_0x880b('0x24')]=function(_0x34c17d,_0x3a0711){return db[_0x880b('0x2a')][_0x880b('0x2b')]({'where':{'id':_0x34c17d[_0x880b('0x2c')]['id']}})[_0x880b('0x23')](handleEntityNotFound(_0x3a0711,null))[_0x880b('0x23')](removeEntity(_0x3a0711,null))[_0x880b('0x2e')](handleError(_0x3a0711,null));}; \ No newline at end of file +var _0x9ca5=['error','stack','name','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy'];(function(_0x28ae71,_0x956d7d){var _0x43a1e3=function(_0x7bea5){while(--_0x7bea5){_0x28ae71['push'](_0x28ae71['shift']());}};_0x43a1e3(++_0x956d7d);}(_0x9ca5,0xdf));var _0x59ca=function(_0x3b154f,_0x14fd22){_0x3b154f=_0x3b154f-0x0;var _0xe53d42=_0x9ca5[_0x3b154f];return _0xe53d42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59ca('0x0'));var zipdir=require(_0x59ca('0x1'));var jsonpatch=require(_0x59ca('0x2'));var rp=require(_0x59ca('0x3'));var moment=require(_0x59ca('0x4'));var BPromise=require(_0x59ca('0x5'));var Mustache=require('mustache');var util=require(_0x59ca('0x6'));var path=require(_0x59ca('0x7'));var sox=require('sox');var csv=require(_0x59ca('0x8'));var ejs=require(_0x59ca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59ca('0xa'));var squel=require('squel');var crypto=require(_0x59ca('0xb'));var jsforce=require(_0x59ca('0xc'));var deskjs=require(_0x59ca('0xd'));var toCsv=require(_0x59ca('0x8'));var querystring=require('querystring');var Papa=require(_0x59ca('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x59ca('0xf'));var hardwareService=require(_0x59ca('0x10'));var logger=require(_0x59ca('0x11'))(_0x59ca('0x12'));var utils=require(_0x59ca('0x13'));var config=require(_0x59ca('0x14'));var licenseUtil=require(_0x59ca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x203909,_0x24ac5c){_0x24ac5c=_0x24ac5c||0xcc;return function(_0x1acf98){if(_0x1acf98){return _0x203909['sendStatus'](_0x24ac5c);}return _0x203909[_0x59ca('0x16')](_0x24ac5c)[_0x59ca('0x17')]();};}function respondWithResult(_0x289c35,_0x4279cc){_0x4279cc=_0x4279cc||0xc8;return function(_0x1f8fae){if(_0x1f8fae){return _0x289c35['status'](_0x4279cc)['json'](_0x1f8fae);}};}function respondWithFilteredResult(_0x4f85e9,_0x73d6a1){return function(_0x47d22b){if(_0x47d22b){var _0x25ef25=typeof _0x73d6a1[_0x59ca('0x18')]==='undefined'&&typeof _0x73d6a1['limit']===_0x59ca('0x19');var _0x1c51da=_0x47d22b[_0x59ca('0x1a')];var _0x2acb08=_0x25ef25?0x0:_0x73d6a1[_0x59ca('0x18')];var _0x335df2=_0x25ef25?_0x47d22b[_0x59ca('0x1a')]:_0x73d6a1[_0x59ca('0x18')]+_0x73d6a1[_0x59ca('0x1b')];var _0x5ef81d;if(_0x335df2>=_0x1c51da){_0x335df2=_0x1c51da;_0x5ef81d=0xc8;}else{_0x5ef81d=0xce;}_0x4f85e9[_0x59ca('0x16')](_0x5ef81d);return _0x4f85e9[_0x59ca('0x1c')]('Content-Range',_0x2acb08+'-'+_0x335df2+'/'+_0x1c51da)[_0x59ca('0x1d')](_0x47d22b);}return null;};}function patchUpdates(_0x469142){return function(_0x18473f){try{jsonpatch[_0x59ca('0x1e')](_0x18473f,_0x469142,!![]);}catch(_0x2c695b){return BPromise[_0x59ca('0x1f')](_0x2c695b);}return _0x18473f[_0x59ca('0x20')]();};}function saveUpdates(_0x448a98,_0x592270){return function(_0x1dd560){if(_0x1dd560){return _0x1dd560['update'](_0x448a98)[_0x59ca('0x21')](function(_0x4adc6d){return _0x4adc6d;});}return null;};}function removeEntity(_0x2b1f15,_0x503409){return function(_0x2ed513){if(_0x2ed513){return _0x2ed513[_0x59ca('0x22')]()['then'](function(){_0x2b1f15[_0x59ca('0x16')](0xcc)[_0x59ca('0x17')]();});}};}function handleEntityNotFound(_0x57a649,_0x3fa428){return function(_0x584032){if(!_0x584032){_0x57a649['sendStatus'](0x194);}return _0x584032;};}function handleError(_0x3d33ed,_0x16f9dc){_0x16f9dc=_0x16f9dc||0x1f4;return function(_0x1469d1){logger[_0x59ca('0x23')](_0x1469d1[_0x59ca('0x24')]);if(_0x1469d1[_0x59ca('0x25')]){delete _0x1469d1[_0x59ca('0x25')];}_0x3d33ed['status'](_0x16f9dc)['send'](_0x1469d1);};}exports['update']=function(_0x4d5296,_0x279a7c){if(_0x4d5296[_0x59ca('0x26')]['id']){delete _0x4d5296['body']['id'];}return db[_0x59ca('0x27')][_0x59ca('0x28')]({'where':{'id':_0x4d5296[_0x59ca('0x29')]['id']}})[_0x59ca('0x21')](handleEntityNotFound(_0x279a7c,null))[_0x59ca('0x21')](saveUpdates(_0x4d5296[_0x59ca('0x26')],null))[_0x59ca('0x21')](respondWithResult(_0x279a7c,null))[_0x59ca('0x2a')](handleError(_0x279a7c,null));};exports[_0x59ca('0x22')]=function(_0x1ddf40,_0xb1e5ac){return db['Action'][_0x59ca('0x28')]({'where':{'id':_0x1ddf40['params']['id']}})[_0x59ca('0x21')](handleEntityNotFound(_0xb1e5ac,null))['then'](removeEntity(_0xb1e5ac,null))['catch'](handleError(_0xb1e5ac,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 741d0b4..95aec9c 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 _0xdaab=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./action.attributes','exports','Action','util'];(function(_0x376f50,_0x194398){var _0x218263=function(_0x568a01){while(--_0x568a01){_0x376f50['push'](_0x376f50['shift']());}};_0x218263(++_0x194398);}(_0xdaab,0x1c1));var _0xbdaa=function(_0x6f5229,_0x1e9031){_0x6f5229=_0x6f5229-0x0;var _0x5d2f3d=_0xdaab[_0x6f5229];return _0x5d2f3d;};'use strict';var _=require('lodash');var util=require(_0xbdaa('0x0'));var logger=require(_0xbdaa('0x1'))(_0xbdaa('0x2'));var moment=require(_0xbdaa('0x3'));var BPromise=require(_0xbdaa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdaa('0x5'));var config=require(_0xbdaa('0x6'));var attributes=require(_0xbdaa('0x7'));module[_0xbdaa('0x8')]=function(_0x2c867a,_0x2282b1){return _0x2c867a['define'](_0xbdaa('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f5=['bluebird','path','rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','api'];(function(_0x44015d,_0x3f5c3a){var _0x2cb51a=function(_0x2f369c){while(--_0x2f369c){_0x44015d['push'](_0x44015d['shift']());}};_0x2cb51a(++_0x3f5c3a);}(_0xf4f5,0x89));var _0x5f4f=function(_0x5b5377,_0x504a69){_0x5b5377=_0x5b5377-0x0;var _0x53445f=_0xf4f5[_0x5b5377];return _0x53445f;};'use strict';var _=require(_0x5f4f('0x0'));var util=require(_0x5f4f('0x1'));var logger=require('../../config/logger')(_0x5f4f('0x2'));var moment=require('moment');var BPromise=require(_0x5f4f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f4f('0x4'));var rimraf=require(_0x5f4f('0x5'));var config=require(_0x5f4f('0x6'));var attributes=require(_0x5f4f('0x7'));module['exports']=function(_0x18efa9,_0x5934cd){return _0x18efa9['define'](_0x5f4f('0x8'),attributes,{'tableName':_0x5f4f('0x9'),'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 2ab4bc1..3769070 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 _0x7a54=['info','Action,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x29c8a8,_0x4d316c){_0x29c8a8=_0x29c8a8-0x0;var _0x12a847=_0x7a54[_0x29c8a8];return _0x12a847;};'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')]('Action,\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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3c34a1,_0xc35f37){var _0x5a92bc=function(_0xec8c5f){while(--_0xec8c5f){_0x3c34a1['push'](_0x3c34a1['shift']());}};_0x5a92bc(++_0xc35f37);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5a19fc,_0x58f9f4){_0x5a19fc=_0x5a19fc-0x0;var _0x34b413=_0x5fc3[_0x5a19fc];return _0x34b413;};'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')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\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']('Action,\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);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 0fe1f48..e63024e 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 _0x997e=['isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x4be317,_0x91c396){var _0x16282e=function(_0x28978e){while(--_0x28978e){_0x4be317['push'](_0x4be317['shift']());}};_0x16282e(++_0x91c396);}(_0x997e,0x1a5));var _0xe997=function(_0x471ec4,_0x42c871){_0x471ec4=_0x471ec4-0x0;var _0x43ab60=_0x997e[_0x471ec4];return _0x43ab60;};'use strict';var multer=require(_0xe997('0x0'));var util=require('util');var path=require(_0xe997('0x1'));var timeout=require(_0xe997('0x2'));var express=require(_0xe997('0x3'));var router=express['Router']();var fs_extra=require(_0xe997('0x4'));var auth=require(_0xe997('0x5'));var interaction=require(_0xe997('0x6'));var config=require(_0xe997('0x7'));var controller=require(_0xe997('0x8'));router[_0xe997('0x9')](_0xe997('0xa'),auth[_0xe997('0xb')](),controller[_0xe997('0xc')]);router[_0xe997('0xd')](_0xe997('0xa'),auth[_0xe997('0xb')](),controller[_0xe997('0xe')]);module[_0xe997('0xf')]=router; \ No newline at end of file +var _0x59ee=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','put','/:id','update','delete','isAuthenticated'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x59ee,0x154));var _0xe59e=function(_0x2eb47c,_0x43bdf3){_0x2eb47c=_0x2eb47c-0x0;var _0x13097b=_0x59ee[_0x2eb47c];return _0x13097b;};'use strict';var multer=require(_0xe59e('0x0'));var util=require(_0xe59e('0x1'));var path=require(_0xe59e('0x2'));var timeout=require('connect-timeout');var express=require(_0xe59e('0x3'));var router=express[_0xe59e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe59e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./action.controller');router[_0xe59e('0x6')](_0xe59e('0x7'),auth['isAuthenticated'](),controller[_0xe59e('0x8')]);router[_0xe59e('0x9')](_0xe59e('0x7'),auth[_0xe59e('0xa')](),controller[_0xe59e('0xb')]);module[_0xe59e('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c905ce4..484f337 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0xb4c7=['STRING','TEXT','sequelize','exports'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xecb298,_0x214007){_0xecb298=_0xecb298-0x0;var _0x5759d5=_0xb4c7[_0xecb298];return _0x5759d5;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'name':{'type':Sequelize[_0x7b4c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7b4c('0x2')]},'parent':{'type':Sequelize[_0x7b4c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7b4c('0x3')]},'joins':{'type':Sequelize[_0x7b4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d5c743a..f7ad793 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 _0xaf23=['type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','MetricId','function','replace','format','groupBy','group','orderBy','order','DESC','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','toString','sequelize','QueryTypes','SELECT','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','field','Sequelize','keyBy','metric','alias','clone','output','fullPath','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','COUNT(DISTINCT\x20%s)','ValidationErrorItem','debug','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','get','CustomReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf23,0x11a));var _0x3af2=function(_0x1c883a,_0x36ff38){_0x1c883a=_0x1c883a-0x0;var _0xbb8ec0=_0xaf23[_0x1c883a];return _0xbb8ec0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3af2('0x0'));var jsonpatch=require(_0x3af2('0x1'));var rp=require(_0x3af2('0x2'));var moment=require('moment');var BPromise=require(_0x3af2('0x3'));var Mustache=require(_0x3af2('0x4'));var util=require('util');var path=require(_0x3af2('0x5'));var sox=require('sox');var csv=require(_0x3af2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af2('0x7'));var squel=require(_0x3af2('0x8'));var crypto=require(_0x3af2('0x9'));var jsforce=require(_0x3af2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3af2('0x6'));var querystring=require('querystring');var Papa=require(_0x3af2('0xb'));var Redis=require('ioredis');var authService=require(_0x3af2('0xc'));var qs=require(_0x3af2('0xd'));var as=require(_0x3af2('0xe'));var hardwareService=require(_0x3af2('0xf'));var logger=require(_0x3af2('0x10'))(_0x3af2('0x11'));var utils=require(_0x3af2('0x12'));var config=require(_0x3af2('0x13'));var licenseUtil=require(_0x3af2('0x14'));var db=require(_0x3af2('0x15'))['db'];var dbH=require('../../mysqldb')[_0x3af2('0x16')];function respondWithStatusCode(_0x308943,_0x4246c2){_0x4246c2=_0x4246c2||0xcc;return function(_0x597c56){if(_0x597c56){return _0x308943['sendStatus'](_0x4246c2);}return _0x308943[_0x3af2('0x17')](_0x4246c2)[_0x3af2('0x18')]();};}function respondWithResult(_0x3f5667,_0xe0c6c8){_0xe0c6c8=_0xe0c6c8||0xc8;return function(_0x5dbb0d){if(_0x5dbb0d){return _0x3f5667[_0x3af2('0x17')](_0xe0c6c8)[_0x3af2('0x19')](_0x5dbb0d);}};}function respondWithFilteredResult(_0x821374,_0x5a8f5f){return function(_0x191d2d){if(_0x191d2d){var _0x2d1817=typeof _0x5a8f5f[_0x3af2('0x1a')]===_0x3af2('0x1b')&&typeof _0x5a8f5f['limit']==='undefined';var _0x3303b3=_0x191d2d[_0x3af2('0x1c')];var _0x4c2c56=_0x2d1817?0x0:_0x5a8f5f[_0x3af2('0x1a')];var _0x2552f5=_0x2d1817?_0x191d2d[_0x3af2('0x1c')]:_0x5a8f5f[_0x3af2('0x1a')]+_0x5a8f5f['limit'];var _0x54a55e;if(_0x2552f5>=_0x3303b3){_0x2552f5=_0x3303b3;_0x54a55e=0xc8;}else{_0x54a55e=0xce;}_0x821374[_0x3af2('0x17')](_0x54a55e);return _0x821374[_0x3af2('0x1d')](_0x3af2('0x1e'),_0x4c2c56+'-'+_0x2552f5+'/'+_0x3303b3)[_0x3af2('0x19')](_0x191d2d);}return null;};}function patchUpdates(_0x128bea){return function(_0x54c6ce){try{jsonpatch['apply'](_0x54c6ce,_0x128bea,!![]);}catch(_0xe59a68){return BPromise[_0x3af2('0x1f')](_0xe59a68);}return _0x54c6ce[_0x3af2('0x20')]();};}function saveUpdates(_0x1f10d9,_0x570471){return function(_0x472d10){if(_0x472d10){return _0x472d10[_0x3af2('0x21')](_0x1f10d9)[_0x3af2('0x22')](function(_0x1487ec){return _0x1487ec;});}return null;};}function removeEntity(_0x5248cc,_0xe3d844){return function(_0xf684aa){if(_0xf684aa){return _0xf684aa['destroy']()[_0x3af2('0x22')](function(){var _0x394218=_0xf684aa[_0x3af2('0x23')]({'plain':!![]});var _0x1ebc54=_0x3af2('0x24');return db[_0x3af2('0x25')][_0x3af2('0x26')]({'where':{'type':_0x1ebc54,'resourceId':_0x394218['id']}})[_0x3af2('0x22')](function(){return _0xf684aa;});})['then'](function(){_0x5248cc[_0x3af2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24aa22,_0x1f9cc4){return function(_0x4923fa){if(!_0x4923fa){_0x24aa22[_0x3af2('0x27')](0x194);}return _0x4923fa;};}function handleError(_0x54318b,_0x283603){_0x283603=_0x283603||0x1f4;return function(_0x550f44){logger[_0x3af2('0x28')](_0x550f44[_0x3af2('0x29')]);if(_0x550f44[_0x3af2('0x2a')]){delete _0x550f44[_0x3af2('0x2a')];}_0x54318b[_0x3af2('0x17')](_0x283603)[_0x3af2('0x2b')](_0x550f44);};}exports[_0x3af2('0x2c')]=function(_0x1a981c,_0xfcd2a8){var _0x2fcc14={},_0x575b6f={},_0x2840f5={'count':0x0,'rows':[]};var _0x387624=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x13c7f0){return{'name':_0x13c7f0[_0x3af2('0x2d')],'type':_0x13c7f0[_0x3af2('0x2e')][_0x3af2('0x2f')]};});_0x575b6f['model']=_['map'](_0x387624,_0x3af2('0x2a'));_0x575b6f['query']=_[_0x3af2('0x30')](_0x1a981c[_0x3af2('0x31')]);_0x575b6f[_0x3af2('0x32')]=_[_0x3af2('0x33')](_0x575b6f[_0x3af2('0x34')],_0x575b6f['query']);_0x2fcc14[_0x3af2('0x35')]=_['intersection'](_0x575b6f[_0x3af2('0x34')],qs[_0x3af2('0x36')](_0x1a981c[_0x3af2('0x31')][_0x3af2('0x36')]));_0x2fcc14[_0x3af2('0x35')]=_0x2fcc14['attributes'][_0x3af2('0x37')]?_0x2fcc14[_0x3af2('0x35')]:_0x575b6f[_0x3af2('0x34')];if(!_0x1a981c[_0x3af2('0x31')][_0x3af2('0x38')](_0x3af2('0x39'))){_0x2fcc14[_0x3af2('0x3a')]=qs['limit'](_0x1a981c[_0x3af2('0x31')]['limit']);_0x2fcc14[_0x3af2('0x1a')]=qs[_0x3af2('0x1a')](_0x1a981c[_0x3af2('0x31')]['offset']);}_0x2fcc14['order']=qs[_0x3af2('0x3b')](_0x1a981c[_0x3af2('0x31')]['sort']);_0x2fcc14[_0x3af2('0x3c')]=qs['filters'](_[_0x3af2('0x3d')](_0x1a981c['query'],_0x575b6f[_0x3af2('0x32')]),_0x387624);if(_0x1a981c['query'][_0x3af2('0x3e')]){_0x2fcc14[_0x3af2('0x3c')]=_[_0x3af2('0x3f')](_0x2fcc14[_0x3af2('0x3c')],{'$or':_[_0x3af2('0x40')](_0x387624,function(_0x20ef21){if(_0x20ef21['type']!==_0x3af2('0x41')){var _0x4eba5a={};_0x4eba5a[_0x20ef21[_0x3af2('0x2a')]]={'$like':'%'+_0x1a981c['query'][_0x3af2('0x3e')]+'%'};return _0x4eba5a;}})});}_0x2fcc14=_[_0x3af2('0x3f')]({},_0x2fcc14,_0x1a981c[_0x3af2('0x42')]);var _0x89b9d1={'where':_0x2fcc14['where']};return db[_0x3af2('0x43')]['count'](_0x89b9d1)[_0x3af2('0x22')](function(_0x170e59){_0x2840f5['count']=_0x170e59;if(_0x1a981c[_0x3af2('0x31')][_0x3af2('0x44')]){_0x2fcc14[_0x3af2('0x45')]=[{'all':!![]}];}return db[_0x3af2('0x43')][_0x3af2('0x46')](_0x2fcc14);})[_0x3af2('0x22')](function(_0x25b03f){_0x2840f5['rows']=_0x25b03f;return _0x2840f5;})[_0x3af2('0x22')](respondWithFilteredResult(_0xfcd2a8,_0x2fcc14))[_0x3af2('0x47')](handleError(_0xfcd2a8,null));};exports['show']=function(_0xd38c78,_0x192108){var _0x5b0c14={'raw':![],'where':{'id':_0xd38c78[_0x3af2('0x48')]['id']}},_0x3ac01b={};_0x3ac01b[_0x3af2('0x34')]=_['keys'](db[_0x3af2('0x43')][_0x3af2('0x49')]);_0x3ac01b[_0x3af2('0x31')]=_['keys'](_0xd38c78[_0x3af2('0x31')]);_0x3ac01b[_0x3af2('0x32')]=_['intersection'](_0x3ac01b[_0x3af2('0x34')],_0x3ac01b[_0x3af2('0x31')]);_0x5b0c14[_0x3af2('0x35')]=_[_0x3af2('0x33')](_0x3ac01b[_0x3af2('0x34')],qs[_0x3af2('0x36')](_0xd38c78[_0x3af2('0x31')][_0x3af2('0x36')]));_0x5b0c14[_0x3af2('0x35')]=_0x5b0c14[_0x3af2('0x35')][_0x3af2('0x37')]?_0x5b0c14[_0x3af2('0x35')]:_0x3ac01b[_0x3af2('0x34')];if(_0xd38c78[_0x3af2('0x31')]['includeAll']){_0x5b0c14['include']=[{'all':!![]}];}_0x5b0c14=_[_0x3af2('0x3f')]({},_0x5b0c14,_0xd38c78[_0x3af2('0x42')]);return db[_0x3af2('0x43')]['find'](_0x5b0c14)[_0x3af2('0x22')](handleEntityNotFound(_0x192108,null))[_0x3af2('0x22')](respondWithResult(_0x192108,null))[_0x3af2('0x47')](handleError(_0x192108,null));};exports['create']=function(_0x371803,_0x5490e1){return db[_0x3af2('0x43')][_0x3af2('0x4a')](_0x371803[_0x3af2('0x4b')],{})[_0x3af2('0x22')](function(_0x12dcf7){var _0x4e8894=_0x371803['user'][_0x3af2('0x23')]({'plain':!![]});if(!_0x4e8894)throw new Error(_0x3af2('0x4c'));if(_0x4e8894[_0x3af2('0x4d')]===_0x3af2('0x4e')){var _0x5a66a8=_0x12dcf7[_0x3af2('0x23')]({'plain':!![]});var _0x5185a1='Reports';return db['UserProfileSection'][_0x3af2('0x4f')]({'where':{'name':_0x5185a1,'userProfileId':_0x4e8894[_0x3af2('0x50')]},'raw':!![]})[_0x3af2('0x22')](function(_0x3b6a69){if(_0x3b6a69&&_0x3b6a69[_0x3af2('0x51')]===0x0){return db['UserProfileResource'][_0x3af2('0x4a')]({'name':_0x5a66a8[_0x3af2('0x2a')],'resourceId':_0x5a66a8['id'],'type':_0x3af2('0x24'),'sectionId':_0x3b6a69['id']},{})[_0x3af2('0x22')](function(){return _0x12dcf7;});}else{return _0x12dcf7;}})[_0x3af2('0x47')](function(_0xb5a4d6){logger[_0x3af2('0x28')](_0x3af2('0x52'),_0xb5a4d6);throw _0xb5a4d6;});}return _0x12dcf7;})[_0x3af2('0x22')](respondWithResult(_0x5490e1,0xc9))[_0x3af2('0x47')](handleError(_0x5490e1,null));};exports[_0x3af2('0x21')]=function(_0x9e6bfa,_0x521007){if(_0x9e6bfa[_0x3af2('0x4b')]['id']){delete _0x9e6bfa['body']['id'];}return db[_0x3af2('0x43')][_0x3af2('0x4f')]({'where':{'id':_0x9e6bfa[_0x3af2('0x48')]['id']}})[_0x3af2('0x22')](handleEntityNotFound(_0x521007,null))['then'](saveUpdates(_0x9e6bfa[_0x3af2('0x4b')],null))['then'](respondWithResult(_0x521007,null))[_0x3af2('0x47')](handleError(_0x521007,null));};exports[_0x3af2('0x26')]=function(_0x20b1b0,_0x53c5b5){return db[_0x3af2('0x43')][_0x3af2('0x4f')]({'where':{'id':_0x20b1b0['params']['id']}})['then'](handleEntityNotFound(_0x53c5b5,null))[_0x3af2('0x22')](removeEntity(_0x53c5b5,null))[_0x3af2('0x47')](handleError(_0x53c5b5,null));};exports[_0x3af2('0x53')]=function(_0x45eb09,_0x52b4aa){var _0x48259d=0xa;var _0x228c46=[_0x3af2('0x54'),_0x3af2('0x55'),'right_join',_0x3af2('0x56')];var _0xa04015={'SUM':_0x3af2('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3af2('0x58'),'MIN':_0x3af2('0x59'),'AVG':_0x3af2('0x5a'),'GROUP_CONCAT':_0x3af2('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x50556f={'SEC_TO_TIME':_0x3af2('0x5d'),'DATE':_0x3af2('0x5e'),'HOUR':_0x3af2('0x5f'),'ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':_0x3af2('0x61')};var _0x47b563=function(_0x1f4596){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),'IS\x20NOT\x20NULL',_0x3af2('0x64'),_0x3af2('0x65')],_0x1f4596);};var _0x467ccd=function(_0x16c9c9){if(!_0x16c9c9||!_0x16c9c9[_0x3af2('0x66')][_0x3af2('0x37')]){return'';}for(var _0x4859bc='(',_0x232ea9=0x0;_0x232ea9<_0x16c9c9['rules']['length'];_0x232ea9+=0x1){_0x232ea9>0x0&&(_0x4859bc+='\x20'+_0x16c9c9[_0x3af2('0x67')]+'\x20');_0x4859bc+=_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['group']?_0x467ccd(_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['group']):_0x16c9c9[_0x3af2('0x66')][_0x232ea9]['field']+'\x20'+_0x16c9c9['rules'][_0x232ea9]['condition']+(_0x47b563(_0x16c9c9[_0x3af2('0x66')][_0x232ea9][_0x3af2('0x68')])?'\x20'+_0x16c9c9[_0x3af2('0x66')][_0x232ea9][_0x3af2('0x69')]:'');}return _0x4859bc+')';};var _0xd62e18={'where':{'id':_0x45eb09[_0x3af2('0x48')]['id']}},_0x5a342c,_0x536463,_0x570441,_0xc680e9,_0x1bebe3;_0xd62e18=_[_0x3af2('0x3f')]({},_0xd62e18,_0x45eb09[_0x3af2('0x42')]);return db['AnalyticCustomReport'][_0x3af2('0x4f')](_0xd62e18)[_0x3af2('0x22')](function(_0x1a24e8){if(_0x1a24e8){_0x5a342c=_0x1a24e8;return _0x1a24e8[_0x3af2('0x6a')]();}return null;})['then'](function(_0x3dae0e){if(_0x3dae0e){if(!_0x3dae0e[_0x3af2('0x37')]){throw new db['Sequelize']['ValidationErrorItem'](_0x3af2('0x6b'),0x193);}_0x536463=_0x3dae0e;return db[_0x3af2('0x6c')][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x438cbd){if(_0x438cbd){_0x570441=_['keyBy'](_0x438cbd,'id');var _0x3a47c1;var _0x2f5942=squel[_0x3af2('0x6d')]();_0x2f5942[_0x3af2('0x6e')](_0x5a342c['table']);for(var _0x4f0aed=0x0;_0x4f0aed<_0x536463[_0x3af2('0x37')];_0x4f0aed+=0x1){_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x6f')]?_0x570441[_0x536463[_0x4f0aed]['MetricId']]['metric']:_0x536463[_0x4f0aed]['field'];_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0xa04015[_0x536463[_0x4f0aed]['function']],'%s',_0x3a47c1):_0x3a47c1;_0x3a47c1=_0x536463[_0x4f0aed][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x50556f[_0x536463[_0x4f0aed][_0x3af2('0x72')]],'%s',_0x3a47c1):_0x3a47c1;if(_0x536463[_0x4f0aed][_0x3af2('0x73')]){_0x2f5942[_0x3af2('0x74')](_0x3a47c1);}_0x536463[_0x4f0aed][_0x3af2('0x75')]&&_0x2f5942[_0x3af2('0x76')](_0x3a47c1,_0x536463[_0x4f0aed][_0x3af2('0x75')]===_0x3af2('0x77')?![]:!![]);_0x2f5942['field'](_0x3a47c1,_0x536463[_0x4f0aed]['alias']||_0x3a47c1);}if(_0x5a342c[_0x3af2('0x78')]){_0x5a342c[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x5a342c[_0x3af2('0x78')]);for(var _0x25a25d=0x0;_0x25a25d<_0x5a342c[_0x3af2('0x78')][_0x3af2('0x37')];_0x25a25d+=0x1){if(_0x5a342c['joins'][_0x25a25d][_0x3af2('0x2e')]&&_['includes'](_0x228c46,_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x2e')])&&_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7a')]&&_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7b')]&&_0x5a342c[_0x3af2('0x78')][_0x25a25d]['foreignKey']){_0x2f5942[_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x2e')]](_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x7b')],null,util['format'](_0x3af2('0x7c'),_0x5a342c[_0x3af2('0x7d')],_0x5a342c[_0x3af2('0x78')][_0x25a25d][_0x3af2('0x7a')],_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7b')],_0x5a342c['joins'][_0x25a25d][_0x3af2('0x7e')]));}}}if(_0x5a342c['conditions']){_0x5a342c[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x5a342c[_0x3af2('0x7f')]);_0x2f5942[_0x3af2('0x3c')](_0x467ccd(_0x5a342c[_0x3af2('0x7f')]['group']));}_0x1bebe3=_0x2f5942['clone']();_0x2f5942[_0x3af2('0x3a')](_0x48259d);_0x2f5942[_0x3af2('0x1a')](0x0);logger['debug']('Limited\x20Query:',_0x2f5942[_0x3af2('0x80')]());return dbH[_0x3af2('0x81')]['query'](_0x2f5942[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')][_0x3af2('0x83')]});}})[_0x3af2('0x22')](respondWithResult(_0x52b4aa,null))[_0x3af2('0x47')](handleError(_0x52b4aa,null));};function runReport(_0x2c0ff6,_0xd1fc9d,_0x425a82){var _0x1a26f6=_0xd1fc9d[_0x3af2('0x2a')];var _0x186853=0xa;var _0xd0ae5d=['join','left_join',_0x3af2('0x84'),_0x3af2('0x56')];var _0x12ba5a={'SUM':_0x3af2('0x57'),'COUNT':_0x3af2('0x85'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3af2('0x58'),'MIN':_0x3af2('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3af2('0x86'),'GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x237bb3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3af2('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':_0x3af2('0x61')};var _0x204234=function(_0x22c04d){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),_0x3af2('0x87'),_0x3af2('0x64'),_0x3af2('0x65')],_0x22c04d);};var _0x2a43f8=function(_0x364563){if(!_0x364563||!_0x364563['rules'][_0x3af2('0x37')]){return'';}for(var _0x11374c='(',_0x3a77c5=0x0;_0x3a77c5<_0x364563[_0x3af2('0x66')][_0x3af2('0x37')];_0x3a77c5+=0x1){_0x3a77c5>0x0&&(_0x11374c+='\x20'+_0x364563[_0x3af2('0x67')]+'\x20');_0x11374c+=_0x364563[_0x3af2('0x66')][_0x3a77c5]['group']?_0x2a43f8(_0x364563['rules'][_0x3a77c5][_0x3af2('0x74')]):_0x364563['rules'][_0x3a77c5][_0x3af2('0x88')]+'\x20'+_0x364563['rules'][_0x3a77c5]['condition']+(_0x204234(_0x364563[_0x3af2('0x66')][_0x3a77c5]['condition'])?'\x20'+_0x364563[_0x3af2('0x66')][_0x3a77c5][_0x3af2('0x69')]:'');}return _0x11374c+')';};var _0x4c5293={'where':{'id':_0x2c0ff6['id']}},_0x76098,_0xa83425,_0x40b3c6,_0x2f38da,_0x53da97;_0x4c5293=_[_0x3af2('0x3f')]({},_0x4c5293,_0x425a82);return db[_0x3af2('0x43')]['find'](_0x4c5293)['then'](function(_0x3d2e74){if(_0x3d2e74){_0x76098=_0x3d2e74;return _0x3d2e74[_0x3af2('0x6a')]();}return null;})[_0x3af2('0x22')](function(_0x35a848){if(_0x35a848){if(!_0x35a848[_0x3af2('0x37')]){throw new db[(_0x3af2('0x89'))]['ValidationErrorItem'](_0x3af2('0x6b'),0x193);}_0xa83425=_0x35a848;return db[_0x3af2('0x6c')][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x172cce){if(_0x172cce){_0x40b3c6=_[_0x3af2('0x8a')](_0x172cce,'id');var _0x34cc92;var _0x5b5873=squel[_0x3af2('0x6d')]();_0x5b5873[_0x3af2('0x6e')](_0x76098[_0x3af2('0x7d')]);for(var _0x296e3b=0x0;_0x296e3b<_0xa83425['length'];_0x296e3b+=0x1){_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x6f')]?_0x40b3c6[_0xa83425[_0x296e3b][_0x3af2('0x6f')]][_0x3af2('0x8b')]:_0xa83425[_0x296e3b][_0x3af2('0x88')];_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0x12ba5a[_0xa83425[_0x296e3b][_0x3af2('0x70')]],'%s',_0x34cc92):_0x34cc92;_0x34cc92=_0xa83425[_0x296e3b][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x237bb3[_0xa83425[_0x296e3b]['format']],'%s',_0x34cc92):_0x34cc92;if(_0xa83425[_0x296e3b][_0x3af2('0x73')]){_0x5b5873[_0x3af2('0x74')](_0x34cc92);}_0xa83425[_0x296e3b][_0x3af2('0x75')]&&_0x5b5873[_0x3af2('0x76')](_0x34cc92,_0xa83425[_0x296e3b][_0x3af2('0x75')]==='DESC'?![]:!![]);_0x5b5873[_0x3af2('0x88')](_0x34cc92,_0xa83425[_0x296e3b][_0x3af2('0x8c')]||_0x34cc92);}if(_0x76098['joins']){_0x76098[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x76098[_0x3af2('0x78')]);for(var _0x4fcf09=0x0;_0x4fcf09<_0x76098[_0x3af2('0x78')]['length'];_0x4fcf09+=0x1){if(_0x76098['joins'][_0x4fcf09]['type']&&_[_0x3af2('0x62')](_0xd0ae5d,_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x2e')])&&_0x76098[_0x3af2('0x78')][_0x4fcf09]['parentKey']&&_0x76098['joins'][_0x4fcf09][_0x3af2('0x7b')]&&_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7e')]){_0x5b5873[_0x76098[_0x3af2('0x78')][_0x4fcf09]['type']](_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x76098[_0x3af2('0x7d')],_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7a')],_0x76098[_0x3af2('0x78')][_0x4fcf09][_0x3af2('0x7b')],_0x76098['joins'][_0x4fcf09][_0x3af2('0x7e')]));}}}if(_0x76098[_0x3af2('0x7f')]){_0x76098[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x76098[_0x3af2('0x7f')]);_0x5b5873[_0x3af2('0x3c')](_0x2a43f8(_0x76098[_0x3af2('0x7f')]['group']));}_0x53da97=_0x5b5873[_0x3af2('0x8d')]();_0x5b5873[_0x3af2('0x3a')](_0x186853);_0x5b5873[_0x3af2('0x1a')](0x0);return;}})[_0x3af2('0x22')](function(){if(_0xd1fc9d[_0x3af2('0x8e')]==='web'){return null;}var _0x450f11=_[_0x3af2('0x3f')](_0xd1fc9d,{'name':_0xd1fc9d[_0x3af2('0x8f')]||_0xd1fc9d[_0x3af2('0x2a')]||_0x76098[_0x3af2('0x2a')],'basename':_0x1a26f6,'savename':util[_0x3af2('0x72')]('%s-%s.%s',_0xd1fc9d['name']||_0x76098[_0x3af2('0x2a')],require('randomstring')[_0x3af2('0x90')](0x4),_0xd1fc9d[_0x3af2('0x8e')]||_0x3af2('0x91')),'reportId':_0x76098['id'],'reportType':_0x3af2('0x92')});return db[_0x3af2('0x93')]['create'](_0x450f11,{'raw':!![]});})[_0x3af2('0x22')](function(_0x22c334){if(_0x76098[_0x3af2('0x7d')]===_0x3af2('0x94')){_0x53da97[_0x3af2('0x3c')](_0x76098[_0x3af2('0x7d')]+_0x3af2('0x95'),_0xd1fc9d[_0x3af2('0x96')],_0xd1fc9d['endDate']);}else{_0x53da97[_0x3af2('0x3c')](_0x76098[_0x3af2('0x7d')]+_0x3af2('0x97'),_0xd1fc9d[_0x3af2('0x96')],_0xd1fc9d['endDate']);}if(_0x22c334){logger['info']('Run\x20Query:',_0x53da97[_0x3af2('0x80')]());require(_0x3af2('0x98'))[_0x3af2('0x99')](path[_0x3af2('0x54')](__dirname,_0x3af2('0x9a'),_0x22c334[_0x3af2('0x8e')]),[_0x22c334['id'],_0x53da97['toString'](),path[_0x3af2('0x54')](__dirname,_0x3af2('0x9b'),_0x22c334[_0x3af2('0x9c')]),_0x1a26f6]);return _0x22c334;}else{var _0x40bb47=squel[_0x3af2('0x6d')]();_0x40bb47[_0x3af2('0x6e')]('('+_0x53da97[_0x3af2('0x80')]()+')',_0x3af2('0x9d'));_0x40bb47[_0x3af2('0x88')](_0x3af2('0x9e'),'count');_0x53da97[_0x3af2('0x3a')](_0xd1fc9d[_0x3af2('0x3a')]||_0x186853);_0x53da97['offset'](_0xd1fc9d[_0x3af2('0x1a')]||0x0);return dbH[_0x3af2('0x81')]['query'](_0x40bb47[_0x3af2('0x80')](),{'type':dbH['sequelize'][_0x3af2('0x82')]['SELECT']})[_0x3af2('0x22')](function(_0x2636e3){if(!_0x2636e3[_0x3af2('0x37')]){_0x2f38da=0x0;}else{_0x2f38da=_0x2636e3[0x0][_0x3af2('0x1c')]||0x0;}return dbH[_0x3af2('0x81')]['query'](_0x53da97[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')]['SELECT']});})[_0x3af2('0x22')](function(_0x59d855){return{'rows':_0x59d855||[],'count':_0x2f38da};});}});}exports[_0x3af2('0x9f')]=function(_0x321d84,_0xd14745){return runReport(_0x321d84[_0x3af2('0x48')],_0x321d84[_0x3af2('0x31')],_0x321d84[_0x3af2('0x42')])[_0x3af2('0x22')](respondWithResult(_0xd14745,null))[_0x3af2('0x47')](handleError(_0xd14745,null));};exports['runReport']=runReport;exports['query']=function(_0x582529,_0x4830c8){var _0x2e6575=0xa;var _0xee75eb=['join',_0x3af2('0x55'),'right_join',_0x3af2('0x56')];var _0x1ab75e={'SUM':_0x3af2('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3af2('0xa0'),'MAX':_0x3af2('0x58'),'MIN':'MIN(%s)','AVG':_0x3af2('0x5a'),'GROUP_CONCAT':_0x3af2('0x5b'),'GROUP_CONCAT ASC':_0x3af2('0x86'),'GROUP_CONCAT DESC':_0x3af2('0x5c')};var _0x339d6f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x3af2('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x3af2('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x52a7a5=function(_0x17fefa){return!_[_0x3af2('0x62')]([_0x3af2('0x63'),'IS\x20NOT\x20NULL',_0x3af2('0x64'),_0x3af2('0x65')],_0x17fefa);};var _0x348675=function(_0x925bac){if(!_0x925bac||!_0x925bac['rules'][_0x3af2('0x37')]){return'';}for(var _0x570044='(',_0x12bcf0=0x0;_0x12bcf0<_0x925bac['rules']['length'];_0x12bcf0+=0x1){_0x12bcf0>0x0&&(_0x570044+='\x20'+_0x925bac[_0x3af2('0x67')]+'\x20');_0x570044+=_0x925bac['rules'][_0x12bcf0][_0x3af2('0x74')]?_0x348675(_0x925bac[_0x3af2('0x66')][_0x12bcf0]['group']):_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x88')]+'\x20'+_0x925bac['rules'][_0x12bcf0][_0x3af2('0x68')]+(_0x52a7a5(_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x68')])?'\x20'+_0x925bac[_0x3af2('0x66')][_0x12bcf0][_0x3af2('0x69')]:'');}return _0x570044+')';};var _0x388cea={'where':{'id':_0x582529[_0x3af2('0x48')]['id']}},_0x52f2fe,_0x545525,_0x359c09,_0x322f8d,_0xfcc67c;_0x388cea=_[_0x3af2('0x3f')]({},_0x388cea,_0x582529['options']);return db[_0x3af2('0x43')][_0x3af2('0x4f')](_0x388cea)[_0x3af2('0x22')](function(_0x48c09a){if(_0x48c09a){_0x52f2fe=_0x48c09a;return _0x48c09a[_0x3af2('0x6a')]();}return null;})['then'](function(_0x275bfc){if(_0x275bfc){if(!_0x275bfc[_0x3af2('0x37')]){throw new db[(_0x3af2('0x89'))][(_0x3af2('0xa1'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x545525=_0x275bfc;return db['AnalyticMetric'][_0x3af2('0x46')]({'raw':!![]});}return null;})[_0x3af2('0x22')](function(_0x3fe8b3){if(_0x3fe8b3){_0x359c09=_[_0x3af2('0x8a')](_0x3fe8b3,'id');var _0xf6cd8d;var _0xf20f9d=squel[_0x3af2('0x6d')]();_0xf20f9d[_0x3af2('0x6e')](_0x52f2fe[_0x3af2('0x7d')]);for(var _0x92392c=0x0;_0x92392c<_0x545525[_0x3af2('0x37')];_0x92392c+=0x1){_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x6f')]?_0x359c09[_0x545525[_0x92392c][_0x3af2('0x6f')]][_0x3af2('0x8b')]:_0x545525[_0x92392c][_0x3af2('0x88')];_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x70')]?_[_0x3af2('0x71')](_0x1ab75e[_0x545525[_0x92392c][_0x3af2('0x70')]],'%s',_0xf6cd8d):_0xf6cd8d;_0xf6cd8d=_0x545525[_0x92392c][_0x3af2('0x72')]?_[_0x3af2('0x71')](_0x339d6f[_0x545525[_0x92392c][_0x3af2('0x72')]],'%s',_0xf6cd8d):_0xf6cd8d;if(_0x545525[_0x92392c][_0x3af2('0x73')]){_0xf20f9d['group'](_0xf6cd8d);}_0x545525[_0x92392c]['orderBy']&&_0xf20f9d[_0x3af2('0x76')](_0xf6cd8d,_0x545525[_0x92392c][_0x3af2('0x75')]===_0x3af2('0x77')?![]:!![]);_0xf20f9d[_0x3af2('0x88')](_0xf6cd8d,_0x545525[_0x92392c][_0x3af2('0x8c')]||_0xf6cd8d);}if(_0x52f2fe[_0x3af2('0x78')]){_0x52f2fe[_0x3af2('0x78')]=JSON[_0x3af2('0x79')](_0x52f2fe[_0x3af2('0x78')]);for(var _0x5ed600=0x0;_0x5ed600<_0x52f2fe[_0x3af2('0x78')]['length'];_0x5ed600+=0x1){if(_0x52f2fe[_0x3af2('0x78')][_0x5ed600]['type']&&_[_0x3af2('0x62')](_0xee75eb,_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x2e')])&&_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7a')]&&_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7b')]&&_0x52f2fe['joins'][_0x5ed600][_0x3af2('0x7e')]){_0xf20f9d[_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x2e')]](_0x52f2fe[_0x3af2('0x78')][_0x5ed600]['foreignTable'],null,util[_0x3af2('0x72')]('%s.%s\x20=\x20%s.%s',_0x52f2fe[_0x3af2('0x7d')],_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7a')],_0x52f2fe['joins'][_0x5ed600][_0x3af2('0x7b')],_0x52f2fe[_0x3af2('0x78')][_0x5ed600][_0x3af2('0x7e')]));}}}if(_0x52f2fe[_0x3af2('0x7f')]){_0x52f2fe[_0x3af2('0x7f')]=JSON[_0x3af2('0x79')](_0x52f2fe[_0x3af2('0x7f')]);_0xf20f9d[_0x3af2('0x3c')](_0x348675(_0x52f2fe['conditions']['group']));}_0xfcc67c=_0xf20f9d['clone']();_0xf20f9d[_0x3af2('0x3a')](_0x2e6575);_0xf20f9d[_0x3af2('0x1a')](0x0);logger[_0x3af2('0xa2')](_0x3af2('0xa3'),_0xf20f9d[_0x3af2('0x80')]());return dbH[_0x3af2('0x81')][_0x3af2('0x31')](_0xf20f9d[_0x3af2('0x80')](),{'type':dbH[_0x3af2('0x81')][_0x3af2('0x82')][_0x3af2('0x83')]});}})[_0x3af2('0x22')](function(){return{'sql':_0xfcc67c[_0x3af2('0x80')]()};})[_0x3af2('0x22')](respondWithResult(_0x4830c8,null))[_0x3af2('0x47')](handleError(_0x4830c8,null));}; \ No newline at end of file +var _0x7bb9=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','index','AnalyticCustomReport','rawAttributes','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','rows','catch','show','params','keys','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','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','includes','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','operator','Sequelize','DESC','parentKey','output','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','MIN(%s)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra'];(function(_0x1eb374,_0x38c789){var _0x7ac296=function(_0x546649){while(--_0x546649){_0x1eb374['push'](_0x1eb374['shift']());}};_0x7ac296(++_0x38c789);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7bb9[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require('moment');var BPromise=require(_0x97bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97bb('0x6'));var csv=require(_0x97bb('0x7'));var ejs=require(_0x97bb('0x8'));var fs=require('fs');var fs_extra=require(_0x97bb('0x9'));var _=require(_0x97bb('0xa'));var squel=require(_0x97bb('0xb'));var crypto=require(_0x97bb('0xc'));var jsforce=require(_0x97bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97bb('0x7'));var querystring=require(_0x97bb('0xe'));var Papa=require(_0x97bb('0xf'));var Redis=require(_0x97bb('0x10'));var authService=require(_0x97bb('0x11'));var qs=require(_0x97bb('0x12'));var as=require(_0x97bb('0x13'));var hardwareService=require(_0x97bb('0x14'));var logger=require(_0x97bb('0x15'))(_0x97bb('0x16'));var utils=require(_0x97bb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97bb('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x97bb('0x19'))[_0x97bb('0x1a')];function respondWithStatusCode(_0x3ea5f1,_0x13365c){_0x13365c=_0x13365c||0xcc;return function(_0x2a2631){if(_0x2a2631){return _0x3ea5f1[_0x97bb('0x1b')](_0x13365c);}return _0x3ea5f1[_0x97bb('0x1c')](_0x13365c)[_0x97bb('0x1d')]();};}function respondWithResult(_0x16d843,_0x174093){_0x174093=_0x174093||0xc8;return function(_0x227562){if(_0x227562){return _0x16d843[_0x97bb('0x1c')](_0x174093)[_0x97bb('0x1e')](_0x227562);}};}function respondWithFilteredResult(_0x5dbbd9,_0x149bfe){return function(_0x308a77){if(_0x308a77){var _0x4f8506=typeof _0x149bfe[_0x97bb('0x1f')]===_0x97bb('0x20')&&typeof _0x149bfe[_0x97bb('0x21')]===_0x97bb('0x20');var _0xecc171=_0x308a77[_0x97bb('0x22')];var _0x235d12=_0x4f8506?0x0:_0x149bfe[_0x97bb('0x1f')];var _0x1b7515=_0x4f8506?_0x308a77[_0x97bb('0x22')]:_0x149bfe[_0x97bb('0x1f')]+_0x149bfe[_0x97bb('0x21')];var _0x293c69;if(_0x1b7515>=_0xecc171){_0x1b7515=_0xecc171;_0x293c69=0xc8;}else{_0x293c69=0xce;}_0x5dbbd9['status'](_0x293c69);return _0x5dbbd9[_0x97bb('0x23')](_0x97bb('0x24'),_0x235d12+'-'+_0x1b7515+'/'+_0xecc171)[_0x97bb('0x1e')](_0x308a77);}return null;};}function patchUpdates(_0x2b89b2){return function(_0x34c278){try{jsonpatch[_0x97bb('0x25')](_0x34c278,_0x2b89b2,!![]);}catch(_0x5537b0){return BPromise[_0x97bb('0x26')](_0x5537b0);}return _0x34c278[_0x97bb('0x27')]();};}function saveUpdates(_0x5dc8e3,_0x274be2){return function(_0xc6707){if(_0xc6707){return _0xc6707[_0x97bb('0x28')](_0x5dc8e3)[_0x97bb('0x29')](function(_0x2ab133){return _0x2ab133;});}return null;};}function removeEntity(_0xbecd0f,_0x5a969a){return function(_0x1dea61){if(_0x1dea61){return _0x1dea61[_0x97bb('0x2a')]()[_0x97bb('0x29')](function(){var _0x5eeb10=_0x1dea61[_0x97bb('0x2b')]({'plain':!![]});var _0x4e4701=_0x97bb('0x2c');return db[_0x97bb('0x2d')]['destroy']({'where':{'type':_0x4e4701,'resourceId':_0x5eeb10['id']}})[_0x97bb('0x29')](function(){return _0x1dea61;});})['then'](function(){_0xbecd0f['status'](0xcc)[_0x97bb('0x1d')]();});}};}function handleEntityNotFound(_0x3145bd,_0x4494a8){return function(_0x2ed467){if(!_0x2ed467){_0x3145bd['sendStatus'](0x194);}return _0x2ed467;};}function handleError(_0x2c1d70,_0xe3aa4e){_0xe3aa4e=_0xe3aa4e||0x1f4;return function(_0x568c3d){logger['error'](_0x568c3d[_0x97bb('0x2e')]);if(_0x568c3d[_0x97bb('0x2f')]){delete _0x568c3d[_0x97bb('0x2f')];}_0x2c1d70[_0x97bb('0x1c')](_0xe3aa4e)[_0x97bb('0x30')](_0x568c3d);};}exports[_0x97bb('0x31')]=function(_0x294504,_0xc803e5){var _0x58fc13={},_0x462c6a={},_0x5cd733={'count':0x0,'rows':[]};var _0x5ed08d=_['map'](db[_0x97bb('0x32')][_0x97bb('0x33')],function(_0x53cc9f){return{'name':_0x53cc9f['fieldName'],'type':_0x53cc9f[_0x97bb('0x34')]['key']};});_0x462c6a['model']=_[_0x97bb('0x35')](_0x5ed08d,'name');_0x462c6a[_0x97bb('0x36')]=_['keys'](_0x294504[_0x97bb('0x36')]);_0x462c6a[_0x97bb('0x37')]=_[_0x97bb('0x38')](_0x462c6a[_0x97bb('0x39')],_0x462c6a[_0x97bb('0x36')]);_0x58fc13[_0x97bb('0x3a')]=_[_0x97bb('0x38')](_0x462c6a[_0x97bb('0x39')],qs['fields'](_0x294504[_0x97bb('0x36')][_0x97bb('0x3b')]));_0x58fc13[_0x97bb('0x3a')]=_0x58fc13[_0x97bb('0x3a')][_0x97bb('0x3c')]?_0x58fc13[_0x97bb('0x3a')]:_0x462c6a['model'];if(!_0x294504['query'][_0x97bb('0x3d')]('nolimit')){_0x58fc13['limit']=qs[_0x97bb('0x21')](_0x294504[_0x97bb('0x36')][_0x97bb('0x21')]);_0x58fc13[_0x97bb('0x1f')]=qs[_0x97bb('0x1f')](_0x294504[_0x97bb('0x36')][_0x97bb('0x1f')]);}_0x58fc13[_0x97bb('0x3e')]=qs[_0x97bb('0x3f')](_0x294504[_0x97bb('0x36')][_0x97bb('0x3f')]);_0x58fc13[_0x97bb('0x40')]=qs[_0x97bb('0x37')](_[_0x97bb('0x41')](_0x294504['query'],_0x462c6a['filters']),_0x5ed08d);if(_0x294504[_0x97bb('0x36')][_0x97bb('0x42')]){_0x58fc13[_0x97bb('0x40')]=_[_0x97bb('0x43')](_0x58fc13[_0x97bb('0x40')],{'$or':_[_0x97bb('0x35')](_0x5ed08d,function(_0x91df73){if(_0x91df73[_0x97bb('0x34')]!=='VIRTUAL'){var _0x3fab5f={};_0x3fab5f[_0x91df73['name']]={'$like':'%'+_0x294504[_0x97bb('0x36')][_0x97bb('0x42')]+'%'};return _0x3fab5f;}})});}_0x58fc13=_[_0x97bb('0x43')]({},_0x58fc13,_0x294504[_0x97bb('0x44')]);var _0x123d11={'where':_0x58fc13[_0x97bb('0x40')]};return db[_0x97bb('0x32')][_0x97bb('0x22')](_0x123d11)[_0x97bb('0x29')](function(_0x54e4e9){_0x5cd733[_0x97bb('0x22')]=_0x54e4e9;if(_0x294504['query']['includeAll']){_0x58fc13[_0x97bb('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x58fc13);})['then'](function(_0x247144){_0x5cd733[_0x97bb('0x46')]=_0x247144;return _0x5cd733;})['then'](respondWithFilteredResult(_0xc803e5,_0x58fc13))[_0x97bb('0x47')](handleError(_0xc803e5,null));};exports[_0x97bb('0x48')]=function(_0x328815,_0x19bf65){var _0x1171dd={'raw':![],'where':{'id':_0x328815[_0x97bb('0x49')]['id']}},_0x34155f={};_0x34155f[_0x97bb('0x39')]=_[_0x97bb('0x4a')](db[_0x97bb('0x32')][_0x97bb('0x33')]);_0x34155f[_0x97bb('0x36')]=_[_0x97bb('0x4a')](_0x328815['query']);_0x34155f[_0x97bb('0x37')]=_[_0x97bb('0x38')](_0x34155f[_0x97bb('0x39')],_0x34155f[_0x97bb('0x36')]);_0x1171dd['attributes']=_[_0x97bb('0x38')](_0x34155f[_0x97bb('0x39')],qs[_0x97bb('0x3b')](_0x328815[_0x97bb('0x36')][_0x97bb('0x3b')]));_0x1171dd['attributes']=_0x1171dd[_0x97bb('0x3a')][_0x97bb('0x3c')]?_0x1171dd[_0x97bb('0x3a')]:_0x34155f['model'];if(_0x328815[_0x97bb('0x36')][_0x97bb('0x4b')]){_0x1171dd[_0x97bb('0x45')]=[{'all':!![]}];}_0x1171dd=_['merge']({},_0x1171dd,_0x328815['options']);return db[_0x97bb('0x32')][_0x97bb('0x4c')](_0x1171dd)[_0x97bb('0x29')](handleEntityNotFound(_0x19bf65,null))['then'](respondWithResult(_0x19bf65,null))[_0x97bb('0x47')](handleError(_0x19bf65,null));};exports[_0x97bb('0x4d')]=function(_0x5f3a73,_0x271053){return db['AnalyticCustomReport'][_0x97bb('0x4d')](_0x5f3a73[_0x97bb('0x4e')],{})['then'](function(_0x37c351){var _0x757b7c=_0x5f3a73[_0x97bb('0x4f')][_0x97bb('0x2b')]({'plain':!![]});if(!_0x757b7c)throw new Error(_0x97bb('0x50'));if(_0x757b7c[_0x97bb('0x51')]===_0x97bb('0x4f')){var _0x5c658c=_0x37c351['get']({'plain':!![]});var _0x353866='Reports';return db[_0x97bb('0x52')][_0x97bb('0x4c')]({'where':{'name':_0x353866,'userProfileId':_0x757b7c[_0x97bb('0x53')]},'raw':!![]})['then'](function(_0x7aad3){if(_0x7aad3&&_0x7aad3['autoAssociation']===0x0){return db[_0x97bb('0x2d')][_0x97bb('0x4d')]({'name':_0x5c658c[_0x97bb('0x2f')],'resourceId':_0x5c658c['id'],'type':_0x97bb('0x2c'),'sectionId':_0x7aad3['id']},{})[_0x97bb('0x29')](function(){return _0x37c351;});}else{return _0x37c351;}})[_0x97bb('0x47')](function(_0x468d60){logger['error'](_0x97bb('0x54'),_0x468d60);throw _0x468d60;});}return _0x37c351;})[_0x97bb('0x29')](respondWithResult(_0x271053,0xc9))[_0x97bb('0x47')](handleError(_0x271053,null));};exports[_0x97bb('0x28')]=function(_0x22653d,_0x3f4c4d){if(_0x22653d[_0x97bb('0x4e')]['id']){delete _0x22653d[_0x97bb('0x4e')]['id'];}return db[_0x97bb('0x32')][_0x97bb('0x4c')]({'where':{'id':_0x22653d[_0x97bb('0x49')]['id']}})[_0x97bb('0x29')](handleEntityNotFound(_0x3f4c4d,null))[_0x97bb('0x29')](saveUpdates(_0x22653d['body'],null))['then'](respondWithResult(_0x3f4c4d,null))['catch'](handleError(_0x3f4c4d,null));};exports[_0x97bb('0x2a')]=function(_0x35b63b,_0xd7ef5d){return db[_0x97bb('0x32')][_0x97bb('0x4c')]({'where':{'id':_0x35b63b['params']['id']}})[_0x97bb('0x29')](handleEntityNotFound(_0xd7ef5d,null))[_0x97bb('0x29')](removeEntity(_0xd7ef5d,null))[_0x97bb('0x47')](handleError(_0xd7ef5d,null));};exports[_0x97bb('0x55')]=function(_0x2b0c1e,_0x413c29){var _0x4f8a1d=0xa;var _0x12c307=['join',_0x97bb('0x56'),_0x97bb('0x57'),_0x97bb('0x58')];var _0x75a2d7={'SUM':_0x97bb('0x59'),'COUNT':_0x97bb('0x5a'),'COUNT DISTINCT':_0x97bb('0x5b'),'MAX':_0x97bb('0x5c'),'MIN':'MIN(%s)','AVG':_0x97bb('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x97bb('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x381417={'SEC_TO_TIME':_0x97bb('0x5f'),'DATE':_0x97bb('0x60'),'HOUR':_0x97bb('0x61'),'ROUND':_0x97bb('0x62'),'UNIX_TIMESTAMP':_0x97bb('0x63')};var _0xd20ebb=function(_0x18b807){return!_['includes']([_0x97bb('0x64'),'IS\x20NOT\x20NULL',_0x97bb('0x65'),_0x97bb('0x66')],_0x18b807);};var _0x593172=function(_0x251c5a){if(!_0x251c5a||!_0x251c5a[_0x97bb('0x67')][_0x97bb('0x3c')]){return'';}for(var _0x4228f0='(',_0x1ba83f=0x0;_0x1ba83f<_0x251c5a[_0x97bb('0x67')][_0x97bb('0x3c')];_0x1ba83f+=0x1){_0x1ba83f>0x0&&(_0x4228f0+='\x20'+_0x251c5a['operator']+'\x20');_0x4228f0+=_0x251c5a[_0x97bb('0x67')][_0x1ba83f][_0x97bb('0x68')]?_0x593172(_0x251c5a['rules'][_0x1ba83f][_0x97bb('0x68')]):_0x251c5a[_0x97bb('0x67')][_0x1ba83f][_0x97bb('0x69')]+'\x20'+_0x251c5a[_0x97bb('0x67')][_0x1ba83f][_0x97bb('0x6a')]+(_0xd20ebb(_0x251c5a[_0x97bb('0x67')][_0x1ba83f][_0x97bb('0x6a')])?'\x20'+_0x251c5a[_0x97bb('0x67')][_0x1ba83f][_0x97bb('0x6b')]:'');}return _0x4228f0+')';};var _0x104315={'where':{'id':_0x2b0c1e[_0x97bb('0x49')]['id']}},_0x359175,_0x7ca099,_0xa6bf7a,_0x441c1f,_0x310d5a;_0x104315=_['merge']({},_0x104315,_0x2b0c1e['options']);return db[_0x97bb('0x32')][_0x97bb('0x4c')](_0x104315)['then'](function(_0x946eb2){if(_0x946eb2){_0x359175=_0x946eb2;return _0x946eb2[_0x97bb('0x6c')]();}return null;})['then'](function(_0x4de7d5){if(_0x4de7d5){if(!_0x4de7d5[_0x97bb('0x3c')]){throw new db['Sequelize'][(_0x97bb('0x6d'))](_0x97bb('0x6e'),0x193);}_0x7ca099=_0x4de7d5;return db[_0x97bb('0x6f')][_0x97bb('0x70')]({'raw':!![]});}return null;})[_0x97bb('0x29')](function(_0x42397e){if(_0x42397e){_0xa6bf7a=_[_0x97bb('0x71')](_0x42397e,'id');var _0x40553e;var _0x2ed187=squel[_0x97bb('0x72')]();_0x2ed187[_0x97bb('0x73')](_0x359175['table']);for(var _0x54aea7=0x0;_0x54aea7<_0x7ca099[_0x97bb('0x3c')];_0x54aea7+=0x1){_0x40553e=_0x7ca099[_0x54aea7][_0x97bb('0x74')]?_0xa6bf7a[_0x7ca099[_0x54aea7][_0x97bb('0x74')]][_0x97bb('0x75')]:_0x7ca099[_0x54aea7][_0x97bb('0x69')];_0x40553e=_0x7ca099[_0x54aea7][_0x97bb('0x76')]?_[_0x97bb('0x77')](_0x75a2d7[_0x7ca099[_0x54aea7]['function']],'%s',_0x40553e):_0x40553e;_0x40553e=_0x7ca099[_0x54aea7]['format']?_[_0x97bb('0x77')](_0x381417[_0x7ca099[_0x54aea7][_0x97bb('0x78')]],'%s',_0x40553e):_0x40553e;if(_0x7ca099[_0x54aea7][_0x97bb('0x79')]){_0x2ed187['group'](_0x40553e);}_0x7ca099[_0x54aea7][_0x97bb('0x7a')]&&_0x2ed187[_0x97bb('0x3e')](_0x40553e,_0x7ca099[_0x54aea7]['orderBy']==='DESC'?![]:!![]);_0x2ed187[_0x97bb('0x69')](_0x40553e,_0x7ca099[_0x54aea7][_0x97bb('0x7b')]||_0x40553e);}if(_0x359175[_0x97bb('0x7c')]){_0x359175['joins']=JSON['parse'](_0x359175[_0x97bb('0x7c')]);for(var _0x210773=0x0;_0x210773<_0x359175[_0x97bb('0x7c')]['length'];_0x210773+=0x1){if(_0x359175[_0x97bb('0x7c')][_0x210773][_0x97bb('0x34')]&&_[_0x97bb('0x7d')](_0x12c307,_0x359175['joins'][_0x210773][_0x97bb('0x34')])&&_0x359175[_0x97bb('0x7c')][_0x210773]['parentKey']&&_0x359175[_0x97bb('0x7c')][_0x210773]['foreignTable']&&_0x359175['joins'][_0x210773][_0x97bb('0x7e')]){_0x2ed187[_0x359175[_0x97bb('0x7c')][_0x210773][_0x97bb('0x34')]](_0x359175[_0x97bb('0x7c')][_0x210773][_0x97bb('0x7f')],null,util[_0x97bb('0x78')](_0x97bb('0x80'),_0x359175[_0x97bb('0x81')],_0x359175['joins'][_0x210773]['parentKey'],_0x359175[_0x97bb('0x7c')][_0x210773]['foreignTable'],_0x359175['joins'][_0x210773][_0x97bb('0x7e')]));}}}if(_0x359175[_0x97bb('0x82')]){_0x359175[_0x97bb('0x82')]=JSON[_0x97bb('0x83')](_0x359175['conditions']);_0x2ed187[_0x97bb('0x40')](_0x593172(_0x359175[_0x97bb('0x82')]['group']));}_0x310d5a=_0x2ed187[_0x97bb('0x84')]();_0x2ed187[_0x97bb('0x21')](_0x4f8a1d);_0x2ed187[_0x97bb('0x1f')](0x0);logger['debug'](_0x97bb('0x85'),_0x2ed187['toString']());return dbH[_0x97bb('0x86')]['query'](_0x2ed187[_0x97bb('0x87')](),{'type':dbH[_0x97bb('0x86')][_0x97bb('0x88')][_0x97bb('0x89')]});}})[_0x97bb('0x29')](respondWithResult(_0x413c29,null))[_0x97bb('0x47')](handleError(_0x413c29,null));};function runReport(_0x397c02,_0x39d58e,_0x1bb6d9){var _0x2cc26e=_0x39d58e[_0x97bb('0x2f')];var _0x217943=0xa;var _0x503e94=[_0x97bb('0x8a'),_0x97bb('0x56'),_0x97bb('0x57'),_0x97bb('0x58')];var _0xe74439={'SUM':_0x97bb('0x59'),'COUNT':_0x97bb('0x5a'),'COUNT DISTINCT':_0x97bb('0x5b'),'MAX':_0x97bb('0x5c'),'MIN':'MIN(%s)','AVG':_0x97bb('0x5d'),'GROUP_CONCAT':_0x97bb('0x8b'),'GROUP_CONCAT ASC':_0x97bb('0x5e'),'GROUP_CONCAT DESC':_0x97bb('0x8c')};var _0xf65bac={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x97bb('0x60'),'HOUR':_0x97bb('0x61'),'ROUND':_0x97bb('0x62'),'UNIX_TIMESTAMP':_0x97bb('0x63')};var _0x38c036=function(_0x19eb00){return!_[_0x97bb('0x7d')]([_0x97bb('0x64'),'IS\x20NOT\x20NULL',_0x97bb('0x65'),'IS\x20NOT\x20EMPTY'],_0x19eb00);};var _0xb486fa=function(_0x2dcf85){if(!_0x2dcf85||!_0x2dcf85[_0x97bb('0x67')]['length']){return'';}for(var _0x18981c='(',_0x24683f=0x0;_0x24683f<_0x2dcf85['rules'][_0x97bb('0x3c')];_0x24683f+=0x1){_0x24683f>0x0&&(_0x18981c+='\x20'+_0x2dcf85[_0x97bb('0x8d')]+'\x20');_0x18981c+=_0x2dcf85[_0x97bb('0x67')][_0x24683f][_0x97bb('0x68')]?_0xb486fa(_0x2dcf85[_0x97bb('0x67')][_0x24683f]['group']):_0x2dcf85[_0x97bb('0x67')][_0x24683f][_0x97bb('0x69')]+'\x20'+_0x2dcf85['rules'][_0x24683f][_0x97bb('0x6a')]+(_0x38c036(_0x2dcf85[_0x97bb('0x67')][_0x24683f][_0x97bb('0x6a')])?'\x20'+_0x2dcf85[_0x97bb('0x67')][_0x24683f]['value']:'');}return _0x18981c+')';};var _0x23ff11={'where':{'id':_0x397c02['id']}},_0x216df3,_0x2a8475,_0x25dba9,_0xe9d971,_0x4d672b;_0x23ff11=_['merge']({},_0x23ff11,_0x1bb6d9);return db[_0x97bb('0x32')][_0x97bb('0x4c')](_0x23ff11)[_0x97bb('0x29')](function(_0x344d90){if(_0x344d90){_0x216df3=_0x344d90;return _0x344d90[_0x97bb('0x6c')]();}return null;})['then'](function(_0x1bc257){if(_0x1bc257){if(!_0x1bc257[_0x97bb('0x3c')]){throw new db[(_0x97bb('0x8e'))]['ValidationErrorItem'](_0x97bb('0x6e'),0x193);}_0x2a8475=_0x1bc257;return db[_0x97bb('0x6f')][_0x97bb('0x70')]({'raw':!![]});}return null;})[_0x97bb('0x29')](function(_0x1626db){if(_0x1626db){_0x25dba9=_['keyBy'](_0x1626db,'id');var _0x4229e8;var _0x180b23=squel[_0x97bb('0x72')]();_0x180b23[_0x97bb('0x73')](_0x216df3[_0x97bb('0x81')]);for(var _0x3dc9f8=0x0;_0x3dc9f8<_0x2a8475[_0x97bb('0x3c')];_0x3dc9f8+=0x1){_0x4229e8=_0x2a8475[_0x3dc9f8][_0x97bb('0x74')]?_0x25dba9[_0x2a8475[_0x3dc9f8]['MetricId']][_0x97bb('0x75')]:_0x2a8475[_0x3dc9f8][_0x97bb('0x69')];_0x4229e8=_0x2a8475[_0x3dc9f8][_0x97bb('0x76')]?_[_0x97bb('0x77')](_0xe74439[_0x2a8475[_0x3dc9f8]['function']],'%s',_0x4229e8):_0x4229e8;_0x4229e8=_0x2a8475[_0x3dc9f8]['format']?_[_0x97bb('0x77')](_0xf65bac[_0x2a8475[_0x3dc9f8]['format']],'%s',_0x4229e8):_0x4229e8;if(_0x2a8475[_0x3dc9f8]['groupBy']){_0x180b23['group'](_0x4229e8);}_0x2a8475[_0x3dc9f8][_0x97bb('0x7a')]&&_0x180b23[_0x97bb('0x3e')](_0x4229e8,_0x2a8475[_0x3dc9f8][_0x97bb('0x7a')]===_0x97bb('0x8f')?![]:!![]);_0x180b23[_0x97bb('0x69')](_0x4229e8,_0x2a8475[_0x3dc9f8][_0x97bb('0x7b')]||_0x4229e8);}if(_0x216df3['joins']){_0x216df3['joins']=JSON[_0x97bb('0x83')](_0x216df3[_0x97bb('0x7c')]);for(var _0x15e31a=0x0;_0x15e31a<_0x216df3['joins'][_0x97bb('0x3c')];_0x15e31a+=0x1){if(_0x216df3[_0x97bb('0x7c')][_0x15e31a]['type']&&_[_0x97bb('0x7d')](_0x503e94,_0x216df3[_0x97bb('0x7c')][_0x15e31a][_0x97bb('0x34')])&&_0x216df3[_0x97bb('0x7c')][_0x15e31a][_0x97bb('0x90')]&&_0x216df3[_0x97bb('0x7c')][_0x15e31a]['foreignTable']&&_0x216df3[_0x97bb('0x7c')][_0x15e31a][_0x97bb('0x7e')]){_0x180b23[_0x216df3[_0x97bb('0x7c')][_0x15e31a][_0x97bb('0x34')]](_0x216df3[_0x97bb('0x7c')][_0x15e31a][_0x97bb('0x7f')],null,util[_0x97bb('0x78')]('%s.%s\x20=\x20%s.%s',_0x216df3['table'],_0x216df3['joins'][_0x15e31a][_0x97bb('0x90')],_0x216df3['joins'][_0x15e31a][_0x97bb('0x7f')],_0x216df3[_0x97bb('0x7c')][_0x15e31a]['foreignKey']));}}}if(_0x216df3['conditions']){_0x216df3[_0x97bb('0x82')]=JSON[_0x97bb('0x83')](_0x216df3[_0x97bb('0x82')]);_0x180b23[_0x97bb('0x40')](_0xb486fa(_0x216df3['conditions'][_0x97bb('0x68')]));}_0x4d672b=_0x180b23[_0x97bb('0x84')]();_0x180b23['limit'](_0x217943);_0x180b23[_0x97bb('0x1f')](0x0);return;}})[_0x97bb('0x29')](function(){if(_0x39d58e[_0x97bb('0x91')]===_0x97bb('0x92')){return null;}var _0x3870e8=_[_0x97bb('0x43')](_0x39d58e,{'name':_0x39d58e['fullPath']||_0x39d58e[_0x97bb('0x2f')]||_0x216df3[_0x97bb('0x2f')],'basename':_0x2cc26e,'savename':util[_0x97bb('0x78')](_0x97bb('0x93'),_0x39d58e[_0x97bb('0x2f')]||_0x216df3[_0x97bb('0x2f')],require(_0x97bb('0x94'))[_0x97bb('0x95')](0x4),_0x39d58e[_0x97bb('0x91')]||_0x97bb('0x96')),'reportId':_0x216df3['id'],'reportType':'custom'});return db[_0x97bb('0x97')][_0x97bb('0x4d')](_0x3870e8,{'raw':!![]});})['then'](function(_0x2280cc){if(_0x216df3['table']===_0x97bb('0x98')){_0x4d672b[_0x97bb('0x40')](_0x216df3[_0x97bb('0x81')]+_0x97bb('0x99'),_0x39d58e[_0x97bb('0x9a')],_0x39d58e[_0x97bb('0x9b')]);}else{_0x4d672b[_0x97bb('0x40')](_0x216df3['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x39d58e['startDate'],_0x39d58e[_0x97bb('0x9b')]);}if(_0x2280cc){logger[_0x97bb('0x9c')](_0x97bb('0x9d'),_0x4d672b['toString']());require(_0x97bb('0x9e'))['fork'](path[_0x97bb('0x8a')](__dirname,_0x97bb('0x9f'),_0x2280cc[_0x97bb('0x91')]),[_0x2280cc['id'],_0x4d672b[_0x97bb('0x87')](),path[_0x97bb('0x8a')](__dirname,'../../files/reports',_0x2280cc[_0x97bb('0xa0')]),_0x2cc26e]);return _0x2280cc;}else{var _0x343117=squel[_0x97bb('0x72')]();_0x343117[_0x97bb('0x73')]('('+_0x4d672b[_0x97bb('0x87')]()+')',_0x97bb('0xa1'));_0x343117[_0x97bb('0x69')](_0x97bb('0xa2'),_0x97bb('0x22'));_0x4d672b[_0x97bb('0x21')](_0x39d58e['limit']||_0x217943);_0x4d672b[_0x97bb('0x1f')](_0x39d58e[_0x97bb('0x1f')]||0x0);return dbH[_0x97bb('0x86')][_0x97bb('0x36')](_0x343117[_0x97bb('0x87')](),{'type':dbH[_0x97bb('0x86')]['QueryTypes'][_0x97bb('0x89')]})['then'](function(_0x3349b9){if(!_0x3349b9[_0x97bb('0x3c')]){_0xe9d971=0x0;}else{_0xe9d971=_0x3349b9[0x0][_0x97bb('0x22')]||0x0;}return dbH[_0x97bb('0x86')][_0x97bb('0x36')](_0x4d672b[_0x97bb('0x87')](),{'type':dbH['sequelize'][_0x97bb('0x88')]['SELECT']});})[_0x97bb('0x29')](function(_0x91ed5b){return{'rows':_0x91ed5b||[],'count':_0xe9d971};});}});}exports[_0x97bb('0xa3')]=function(_0x3284b7,_0x2714fa){return runReport(_0x3284b7[_0x97bb('0x49')],_0x3284b7[_0x97bb('0x36')],_0x3284b7[_0x97bb('0x44')])['then'](respondWithResult(_0x2714fa,null))[_0x97bb('0x47')](handleError(_0x2714fa,null));};exports[_0x97bb('0xa4')]=runReport;exports[_0x97bb('0x36')]=function(_0x424dee,_0x3a4557){var _0x1ba653=0xa;var _0x4c8ac7=[_0x97bb('0x8a'),_0x97bb('0x56'),_0x97bb('0x57'),_0x97bb('0x58')];var _0x41a4a0={'SUM':_0x97bb('0x59'),'COUNT':_0x97bb('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x97bb('0x5c'),'MIN':_0x97bb('0xa5'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x97bb('0x8b'),'GROUP_CONCAT ASC':_0x97bb('0x5e'),'GROUP_CONCAT DESC':_0x97bb('0x8c')};var _0x5aca94={'SEC_TO_TIME':_0x97bb('0x5f'),'DATE':_0x97bb('0x60'),'HOUR':_0x97bb('0x61'),'ROUND':_0x97bb('0x62'),'UNIX_TIMESTAMP':_0x97bb('0x63')};var _0x26a318=function(_0x3fb0f0){return!_[_0x97bb('0x7d')](['IS\x20NULL',_0x97bb('0xa6'),_0x97bb('0x65'),_0x97bb('0x66')],_0x3fb0f0);};var _0x2813d4=function(_0x414620){if(!_0x414620||!_0x414620[_0x97bb('0x67')][_0x97bb('0x3c')]){return'';}for(var _0x19c77e='(',_0x170940=0x0;_0x170940<_0x414620[_0x97bb('0x67')]['length'];_0x170940+=0x1){_0x170940>0x0&&(_0x19c77e+='\x20'+_0x414620[_0x97bb('0x8d')]+'\x20');_0x19c77e+=_0x414620[_0x97bb('0x67')][_0x170940][_0x97bb('0x68')]?_0x2813d4(_0x414620[_0x97bb('0x67')][_0x170940][_0x97bb('0x68')]):_0x414620[_0x97bb('0x67')][_0x170940][_0x97bb('0x69')]+'\x20'+_0x414620[_0x97bb('0x67')][_0x170940][_0x97bb('0x6a')]+(_0x26a318(_0x414620['rules'][_0x170940][_0x97bb('0x6a')])?'\x20'+_0x414620[_0x97bb('0x67')][_0x170940]['value']:'');}return _0x19c77e+')';};var _0x5081ce={'where':{'id':_0x424dee[_0x97bb('0x49')]['id']}},_0x3870a7,_0x3ab834,_0x2fcd32,_0x585075,_0x50b498;_0x5081ce=_['merge']({},_0x5081ce,_0x424dee[_0x97bb('0x44')]);return db[_0x97bb('0x32')]['find'](_0x5081ce)[_0x97bb('0x29')](function(_0x10567b){if(_0x10567b){_0x3870a7=_0x10567b;return _0x10567b[_0x97bb('0x6c')]();}return null;})[_0x97bb('0x29')](function(_0x3a7621){if(_0x3a7621){if(!_0x3a7621['length']){throw new db[(_0x97bb('0x8e'))][(_0x97bb('0x6d'))](_0x97bb('0x6e'),0x193);}_0x3ab834=_0x3a7621;return db[_0x97bb('0x6f')][_0x97bb('0x70')]({'raw':!![]});}return null;})[_0x97bb('0x29')](function(_0x3373f8){if(_0x3373f8){_0x2fcd32=_['keyBy'](_0x3373f8,'id');var _0x539110;var _0x14f187=squel[_0x97bb('0x72')]();_0x14f187[_0x97bb('0x73')](_0x3870a7[_0x97bb('0x81')]);for(var _0x226515=0x0;_0x226515<_0x3ab834['length'];_0x226515+=0x1){_0x539110=_0x3ab834[_0x226515]['MetricId']?_0x2fcd32[_0x3ab834[_0x226515][_0x97bb('0x74')]]['metric']:_0x3ab834[_0x226515][_0x97bb('0x69')];_0x539110=_0x3ab834[_0x226515][_0x97bb('0x76')]?_[_0x97bb('0x77')](_0x41a4a0[_0x3ab834[_0x226515][_0x97bb('0x76')]],'%s',_0x539110):_0x539110;_0x539110=_0x3ab834[_0x226515][_0x97bb('0x78')]?_[_0x97bb('0x77')](_0x5aca94[_0x3ab834[_0x226515][_0x97bb('0x78')]],'%s',_0x539110):_0x539110;if(_0x3ab834[_0x226515][_0x97bb('0x79')]){_0x14f187['group'](_0x539110);}_0x3ab834[_0x226515][_0x97bb('0x7a')]&&_0x14f187[_0x97bb('0x3e')](_0x539110,_0x3ab834[_0x226515][_0x97bb('0x7a')]===_0x97bb('0x8f')?![]:!![]);_0x14f187[_0x97bb('0x69')](_0x539110,_0x3ab834[_0x226515][_0x97bb('0x7b')]||_0x539110);}if(_0x3870a7[_0x97bb('0x7c')]){_0x3870a7[_0x97bb('0x7c')]=JSON['parse'](_0x3870a7[_0x97bb('0x7c')]);for(var _0x244a4f=0x0;_0x244a4f<_0x3870a7[_0x97bb('0x7c')][_0x97bb('0x3c')];_0x244a4f+=0x1){if(_0x3870a7['joins'][_0x244a4f][_0x97bb('0x34')]&&_[_0x97bb('0x7d')](_0x4c8ac7,_0x3870a7['joins'][_0x244a4f][_0x97bb('0x34')])&&_0x3870a7[_0x97bb('0x7c')][_0x244a4f][_0x97bb('0x90')]&&_0x3870a7['joins'][_0x244a4f]['foreignTable']&&_0x3870a7[_0x97bb('0x7c')][_0x244a4f][_0x97bb('0x7e')]){_0x14f187[_0x3870a7[_0x97bb('0x7c')][_0x244a4f]['type']](_0x3870a7[_0x97bb('0x7c')][_0x244a4f][_0x97bb('0x7f')],null,util[_0x97bb('0x78')](_0x97bb('0x80'),_0x3870a7['table'],_0x3870a7[_0x97bb('0x7c')][_0x244a4f]['parentKey'],_0x3870a7[_0x97bb('0x7c')][_0x244a4f][_0x97bb('0x7f')],_0x3870a7[_0x97bb('0x7c')][_0x244a4f][_0x97bb('0x7e')]));}}}if(_0x3870a7[_0x97bb('0x82')]){_0x3870a7[_0x97bb('0x82')]=JSON['parse'](_0x3870a7[_0x97bb('0x82')]);_0x14f187[_0x97bb('0x40')](_0x2813d4(_0x3870a7[_0x97bb('0x82')][_0x97bb('0x68')]));}_0x50b498=_0x14f187[_0x97bb('0x84')]();_0x14f187[_0x97bb('0x21')](_0x1ba653);_0x14f187[_0x97bb('0x1f')](0x0);logger['debug']('Limited\x20Query:',_0x14f187[_0x97bb('0x87')]());return dbH[_0x97bb('0x86')][_0x97bb('0x36')](_0x14f187[_0x97bb('0x87')](),{'type':dbH[_0x97bb('0x86')]['QueryTypes'][_0x97bb('0x89')]});}})['then'](function(){return{'sql':_0x50b498['toString']()};})[_0x97bb('0x29')](respondWithResult(_0x3a4557,null))[_0x97bb('0x47')](handleError(_0x3a4557,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9c75766..5c00118 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 _0xdc74=['define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x924c29,_0x309120){var _0x24ddd6=function(_0x1c8a9e){while(--_0x1c8a9e){_0x924c29['push'](_0x924c29['shift']());}};_0x24ddd6(++_0x309120);}(_0xdc74,0xfe));var _0x4dc7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdc74[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x4dc7('0x0'));var util=require(_0x4dc7('0x1'));var logger=require(_0x4dc7('0x2'))(_0x4dc7('0x3'));var moment=require(_0x4dc7('0x4'));var BPromise=require(_0x4dc7('0x5'));var rp=require(_0x4dc7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4dc7('0x7'));var attributes=require(_0x4dc7('0x8'));module[_0x4dc7('0x9')]=function(_0x5a65f1,_0x12a15c){return _0x5a65f1[_0x4dc7('0xa')](_0x4dc7('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb00=['path','rimraf','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27c5f4,_0x3bf1f5){var _0x157e82=function(_0x53a1f5){while(--_0x53a1f5){_0x27c5f4['push'](_0x27c5f4['shift']());}};_0x157e82(++_0x3bf1f5);}(_0xfb00,0x8a));var _0x0fb0=function(_0x3c8838,_0x48bb83){_0x3c8838=_0x3c8838-0x0;var _0x35ba4d=_0xfb00[_0x3c8838];return _0x35ba4d;};'use strict';var _=require('lodash');var util=require(_0x0fb0('0x0'));var logger=require(_0x0fb0('0x1'))(_0x0fb0('0x2'));var moment=require(_0x0fb0('0x3'));var BPromise=require(_0x0fb0('0x4'));var rp=require(_0x0fb0('0x5'));var fs=require('fs');var path=require(_0x0fb0('0x6'));var rimraf=require(_0x0fb0('0x7'));var config=require('../../config/environment');var attributes=require(_0x0fb0('0x8'));module[_0x0fb0('0x9')]=function(_0xd96799,_0x3ad993){return _0xd96799[_0x0fb0('0xa')](_0x0fb0('0xb'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index cd907cb..bc7ef34 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 _0x3e3b=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e3b,0x1f1));var _0xb3e3=function(_0x5d8122,_0x1bc2d4){_0x5d8122=_0x5d8122-0x0;var _0x1a8208=_0x3e3b[_0x5d8122];return _0x1a8208;};'use strict';var _=require(_0xb3e3('0x0'));var util=require(_0xb3e3('0x1'));var moment=require(_0xb3e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3e3('0x3'));var fs=require('fs');var Redis=require(_0xb3e3('0x4'));var db=require(_0xb3e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3e3('0x6'))('rpc');var config=require(_0xb3e3('0x7'));var jayson=require(_0xb3e3('0x8'));var client=jayson[_0xb3e3('0x9')][_0xb3e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f3705,_0x19b452,_0x45747c){return new BPromise(function(_0xed5ac0,_0x25e23e){return client[_0xb3e3('0xb')](_0x4f3705,_0x45747c)[_0xb3e3('0xc')](function(_0x247a58){logger[_0xb3e3('0xd')](_0xb3e3('0xe'),_0x19b452,_0xb3e3('0xf'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x19b452,_0xb3e3('0xf'),JSON[_0xb3e3('0x10')](_0x247a58));if(_0x247a58[_0xb3e3('0x11')]){if(_0x247a58['error'][_0xb3e3('0x12')]===0x1f4){logger[_0xb3e3('0x11')](_0xb3e3('0xe'),_0x19b452,_0x247a58[_0xb3e3('0x11')][_0xb3e3('0x13')]);return _0x25e23e(_0x247a58[_0xb3e3('0x11')]['message']);}logger[_0xb3e3('0x11')](_0xb3e3('0xe'),_0x19b452,_0x247a58[_0xb3e3('0x11')][_0xb3e3('0x13')]);return _0xed5ac0(_0x247a58['error'][_0xb3e3('0x13')]);}else{logger[_0xb3e3('0xd')](_0xb3e3('0xe'),_0x19b452,_0xb3e3('0xf'));_0xed5ac0(_0x247a58['result'][_0xb3e3('0x13')]);}})[_0xb3e3('0x14')](function(_0x531c62){logger['error'](_0xb3e3('0xe'),_0x19b452,_0x531c62);_0x25e23e(_0x531c62);});});} \ No newline at end of file +var _0xb1ca=['../../config/utils','rpc','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e0300,_0x3f1ea5){var _0x6a4ba8=function(_0x3a818c){while(--_0x3a818c){_0x4e0300['push'](_0x4e0300['shift']());}};_0x6a4ba8(++_0x3f1ea5);}(_0xb1ca,0x94));var _0xab1c=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb1ca[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xab1c('0x0'));var util=require('util');var moment=require(_0xab1c('0x1'));var BPromise=require(_0xab1c('0x2'));var rs=require(_0xab1c('0x3'));var fs=require('fs');var Redis=require(_0xab1c('0x4'));var db=require(_0xab1c('0x5'))['db'];var utils=require(_0xab1c('0x6'));var logger=require('../../config/logger')(_0xab1c('0x7'));var config=require('../../config/environment');var jayson=require(_0xab1c('0x8'));var client=jayson[_0xab1c('0x9')][_0xab1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f4d98,_0x5d94e2,_0x1c9001){return new BPromise(function(_0x4f0cdb,_0x2597d2){return client['request'](_0x3f4d98,_0x1c9001)[_0xab1c('0xb')](function(_0x58aa71){logger[_0xab1c('0xc')](_0xab1c('0xd'),_0x5d94e2,_0xab1c('0xe'));logger[_0xab1c('0xf')](_0xab1c('0x10'),_0x5d94e2,_0xab1c('0xe'),JSON[_0xab1c('0x11')](_0x58aa71));if(_0x58aa71[_0xab1c('0x12')]){if(_0x58aa71[_0xab1c('0x12')]['code']===0x1f4){logger['error'](_0xab1c('0xd'),_0x5d94e2,_0x58aa71[_0xab1c('0x12')][_0xab1c('0x13')]);return _0x2597d2(_0x58aa71[_0xab1c('0x12')][_0xab1c('0x13')]);}logger[_0xab1c('0x12')](_0xab1c('0xd'),_0x5d94e2,_0x58aa71[_0xab1c('0x12')][_0xab1c('0x13')]);return _0x4f0cdb(_0x58aa71[_0xab1c('0x12')][_0xab1c('0x13')]);}else{logger[_0xab1c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5d94e2,'request\x20sent');_0x4f0cdb(_0x58aa71[_0xab1c('0x14')]['message']);}})[_0xab1c('0x15')](function(_0x48723f){logger[_0xab1c('0x12')](_0xab1c('0xd'),_0x5d94e2,_0x48723f);_0x2597d2(_0x48723f);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 97804cf..d531c3c 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 _0x4663=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id/preview','preview','/:id/run','/:id/query','query','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3b9f02,_0x35077a){var _0x1df9ad=function(_0x51cc3){while(--_0x51cc3){_0x3b9f02['push'](_0x3b9f02['shift']());}};_0x1df9ad(++_0x35077a);}(_0x4663,0x135));var _0x3466=function(_0x4143e8,_0x4ddf23){_0x4143e8=_0x4143e8-0x0;var _0x5706c8=_0x4663[_0x4143e8];return _0x5706c8;};'use strict';var multer=require(_0x3466('0x0'));var util=require('util');var path=require(_0x3466('0x1'));var timeout=require(_0x3466('0x2'));var express=require('express');var router=express[_0x3466('0x3')]();var fs_extra=require(_0x3466('0x4'));var auth=require(_0x3466('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3466('0x6'));var controller=require(_0x3466('0x7'));router['get']('/',auth[_0x3466('0x8')](),controller['index']);router[_0x3466('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3466('0x9')](_0x3466('0xa'),auth['isAuthenticated'](),controller[_0x3466('0xb')]);router[_0x3466('0x9')](_0x3466('0xc'),auth[_0x3466('0x8')](),controller['run']);router['get'](_0x3466('0xd'),auth[_0x3466('0x8')](),controller[_0x3466('0xe')]);router[_0x3466('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3466('0x10')](_0x3466('0x11'),auth[_0x3466('0x8')](),controller[_0x3466('0x12')]);router['delete'](_0x3466('0x11'),auth['isAuthenticated'](),controller[_0x3466('0x13')]);module[_0x3466('0x14')]=router; \ No newline at end of file +var _0x3ce3=['express','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','run','/:id/query','query','post','create','put','update','destroy','util','path','connect-timeout'];(function(_0x59d949,_0x13512c){var _0x244381=function(_0x30f50e){while(--_0x30f50e){_0x59d949['push'](_0x59d949['shift']());}};_0x244381(++_0x13512c);}(_0x3ce3,0xcf));var _0x33ce=function(_0x3441bb,_0x11052c){_0x3441bb=_0x3441bb-0x0;var _0xd94568=_0x3ce3[_0x3441bb];return _0xd94568;};'use strict';var multer=require('multer');var util=require(_0x33ce('0x0'));var path=require(_0x33ce('0x1'));var timeout=require(_0x33ce('0x2'));var express=require(_0x33ce('0x3'));var router=express[_0x33ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x33ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x33ce('0x6'));var controller=require(_0x33ce('0x7'));router[_0x33ce('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x33ce('0x9'),auth[_0x33ce('0xa')](),controller[_0x33ce('0xb')]);router['get'](_0x33ce('0xc'),auth['isAuthenticated'](),controller['preview']);router[_0x33ce('0x8')]('/:id/run',auth[_0x33ce('0xa')](),controller[_0x33ce('0xd')]);router[_0x33ce('0x8')](_0x33ce('0xe'),auth[_0x33ce('0xa')](),controller[_0x33ce('0xf')]);router[_0x33ce('0x10')]('/',auth[_0x33ce('0xa')](),controller[_0x33ce('0x11')]);router[_0x33ce('0x12')]('/:id',auth[_0x33ce('0xa')](),controller[_0x33ce('0x13')]);router['delete'](_0x33ce('0x9'),auth[_0x33ce('0xa')](),controller[_0x33ce('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 10e3d0a..a1c4931 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 _0xae24=['sequelize','STRING'];(function(_0x38b6c4,_0x4c18fe){var _0x136c57=function(_0x313087){while(--_0x313087){_0x38b6c4['push'](_0x38b6c4['shift']());}};_0x136c57(++_0x4c18fe);}(_0xae24,0x182));var _0x4ae2=function(_0xfaff70,_0x5105a7){_0xfaff70=_0xfaff70-0x0;var _0xea98c2=_0xae24[_0xfaff70];return _0xea98c2;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0xc21e7c,_0x4a34ad){var _0x25da9b=function(_0x5a4d61){while(--_0x5a4d61){_0xc21e7c['push'](_0xc21e7c['shift']());}};_0x25da9b(++_0x4a34ad);}(_0x326f,0xd1));var _0xf326=function(_0x420673,_0x1fe8b6){_0x420673=_0x420673-0x0;var _0x2e45e9=_0x326f[_0x420673];return _0x2e45e9;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 12dd724..4823042 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x2ae956,_0x3240b1){var _0x457b71=function(_0x33fe66){while(--_0x33fe66){_0x2ae956['push'](_0x2ae956['shift']());}};_0x457b71(++_0x3240b1);}(_0x2675,0x75));var _0x5267=function(_0x10c13d,_0x104641){_0x10c13d=_0x10c13d-0x0;var _0x25002b=_0x2675[_0x10c13d];return _0x25002b;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0x7a54=['options','AnalyticDefaultReport','includeAll','include','show','keys','attributes','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','field','function','replace','format','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','toString','sequelize','QueryTypes','SELECT','join','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','groupBy','alias','output','web','fullPath','%s-%s.%s','generate','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','getFields','clone','Limited\x20Query:','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','dbH','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','then','destroy','DefaultReports','error','stack','name','index','map','fieldName','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge'];(function(_0x4edd73,_0x31c9f4){var _0x60a855=function(_0x183bce){while(--_0x183bce){_0x4edd73['push'](_0x4edd73['shift']());}};_0x60a855(++_0x31c9f4);}(_0x7a54,0x106));var _0x47a5=function(_0x512196,_0xd84c4b){_0x512196=_0x512196-0x0;var _0x503e2e=_0x7a54[_0x512196];return _0x503e2e;};'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'];var dbH=require(_0x47a5('0x15'))[_0x47a5('0x16')];function respondWithStatusCode(_0x5beb89,_0x44bd3e){_0x44bd3e=_0x44bd3e||0xcc;return function(_0x221b54){if(_0x221b54){return _0x5beb89[_0x47a5('0x17')](_0x44bd3e);}return _0x5beb89[_0x47a5('0x18')](_0x44bd3e)[_0x47a5('0x19')]();};}function respondWithResult(_0x620ee9,_0x3c6c46){_0x3c6c46=_0x3c6c46||0xc8;return function(_0x190faa){if(_0x190faa){return _0x620ee9['status'](_0x3c6c46)[_0x47a5('0x1a')](_0x190faa);}};}function respondWithFilteredResult(_0x11faf5,_0x3b001e){return function(_0x2a2cbb){if(_0x2a2cbb){var _0x1ef44c=typeof _0x3b001e['offset']==='undefined'&&typeof _0x3b001e[_0x47a5('0x1b')]==='undefined';var _0x5247fd=_0x2a2cbb[_0x47a5('0x1c')];var _0xaf70a6=_0x1ef44c?0x0:_0x3b001e[_0x47a5('0x1d')];var _0x1ef371=_0x1ef44c?_0x2a2cbb[_0x47a5('0x1c')]:_0x3b001e[_0x47a5('0x1d')]+_0x3b001e[_0x47a5('0x1b')];var _0xe3c618;if(_0x1ef371>=_0x5247fd){_0x1ef371=_0x5247fd;_0xe3c618=0xc8;}else{_0xe3c618=0xce;}_0x11faf5[_0x47a5('0x18')](_0xe3c618);return _0x11faf5['set'](_0x47a5('0x1e'),_0xaf70a6+'-'+_0x1ef371+'/'+_0x5247fd)[_0x47a5('0x1a')](_0x2a2cbb);}return null;};}function patchUpdates(_0x47cf3c){return function(_0x2b0360){try{jsonpatch[_0x47a5('0x1f')](_0x2b0360,_0x47cf3c,!![]);}catch(_0x36874d){return BPromise['reject'](_0x36874d);}return _0x2b0360[_0x47a5('0x20')]();};}function saveUpdates(_0x2f142b,_0x23db32){return function(_0x7a9f9e){if(_0x7a9f9e){return _0x7a9f9e['update'](_0x2f142b)[_0x47a5('0x21')](function(_0x385687){return _0x385687;});}return null;};}function removeEntity(_0x513981,_0x28747d){return function(_0xc4cd63){if(_0xc4cd63){return _0xc4cd63[_0x47a5('0x22')]()[_0x47a5('0x21')](function(){var _0x3abd6a=_0xc4cd63['get']({'plain':!![]});var _0x53078a=_0x47a5('0x23');return db['UserProfileResource'][_0x47a5('0x22')]({'where':{'type':_0x53078a,'resourceId':_0x3abd6a['id']}})['then'](function(){return _0xc4cd63;});})[_0x47a5('0x21')](function(){_0x513981[_0x47a5('0x18')](0xcc)[_0x47a5('0x19')]();});}};}function handleEntityNotFound(_0x1dac65,_0x21f296){return function(_0x3ba0b7){if(!_0x3ba0b7){_0x1dac65[_0x47a5('0x17')](0x194);}return _0x3ba0b7;};}function handleError(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0x1f4;return function(_0x361bfa){logger[_0x47a5('0x24')](_0x361bfa[_0x47a5('0x25')]);if(_0x361bfa[_0x47a5('0x26')]){delete _0x361bfa['name'];}_0x136b14[_0x47a5('0x18')](_0x16631f)['send'](_0x361bfa);};}exports[_0x47a5('0x27')]=function(_0x9ac908,_0x16901f){var _0x4d6b57={},_0x256650={},_0x625952={'count':0x0,'rows':[]};var _0x39b50b=_[_0x47a5('0x28')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x6f9a12){return{'name':_0x6f9a12[_0x47a5('0x29')],'type':_0x6f9a12['type']['key']};});_0x256650[_0x47a5('0x2a')]=_[_0x47a5('0x28')](_0x39b50b,'name');_0x256650[_0x47a5('0x2b')]=_['keys'](_0x9ac908[_0x47a5('0x2b')]);_0x256650[_0x47a5('0x2c')]=_['intersection'](_0x256650['model'],_0x256650[_0x47a5('0x2b')]);_0x4d6b57['attributes']=_[_0x47a5('0x2d')](_0x256650[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x9ac908['query'][_0x47a5('0x2e')]));_0x4d6b57['attributes']=_0x4d6b57['attributes'][_0x47a5('0x2f')]?_0x4d6b57['attributes']:_0x256650[_0x47a5('0x2a')];if(!_0x9ac908['query'][_0x47a5('0x30')](_0x47a5('0x31'))){_0x4d6b57[_0x47a5('0x1b')]=qs[_0x47a5('0x1b')](_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x1b')]);_0x4d6b57[_0x47a5('0x1d')]=qs[_0x47a5('0x1d')](_0x9ac908[_0x47a5('0x2b')]['offset']);}_0x4d6b57[_0x47a5('0x32')]=qs[_0x47a5('0x33')](_0x9ac908['query'][_0x47a5('0x33')]);_0x4d6b57[_0x47a5('0x34')]=qs[_0x47a5('0x2c')](_['pick'](_0x9ac908[_0x47a5('0x2b')],_0x256650[_0x47a5('0x2c')]),_0x39b50b);if(_0x9ac908['query'][_0x47a5('0x35')]){_0x4d6b57[_0x47a5('0x34')]=_['merge'](_0x4d6b57['where'],{'$or':_['map'](_0x39b50b,function(_0x12d9f2){if(_0x12d9f2['type']!==_0x47a5('0x36')){var _0x1f9631={};_0x1f9631[_0x12d9f2[_0x47a5('0x26')]]={'$like':'%'+_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x35')]+'%'};return _0x1f9631;}})});}_0x4d6b57=_[_0x47a5('0x37')]({},_0x4d6b57,_0x9ac908[_0x47a5('0x38')]);var _0x1f3d01={'where':_0x4d6b57[_0x47a5('0x34')]};return db[_0x47a5('0x39')][_0x47a5('0x1c')](_0x1f3d01)[_0x47a5('0x21')](function(_0x23d6d8){_0x625952['count']=_0x23d6d8;if(_0x9ac908[_0x47a5('0x2b')][_0x47a5('0x3a')]){_0x4d6b57[_0x47a5('0x3b')]=[{'all':!![]}];}return db[_0x47a5('0x39')]['findAll'](_0x4d6b57);})[_0x47a5('0x21')](function(_0x528ef3){_0x625952['rows']=_0x528ef3;return _0x625952;})['then'](respondWithFilteredResult(_0x16901f,_0x4d6b57))['catch'](handleError(_0x16901f,null));};exports[_0x47a5('0x3c')]=function(_0x5ec4e5,_0x2bb502){var _0x3a740b={'raw':!![],'where':{'id':_0x5ec4e5['params']['id']}},_0x448610={};_0x448610[_0x47a5('0x2a')]=_[_0x47a5('0x3d')](db['AnalyticDefaultReport']['rawAttributes']);_0x448610[_0x47a5('0x2b')]=_['keys'](_0x5ec4e5[_0x47a5('0x2b')]);_0x448610[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],_0x448610[_0x47a5('0x2b')]);_0x3a740b[_0x47a5('0x3e')]=_[_0x47a5('0x2d')](_0x448610[_0x47a5('0x2a')],qs[_0x47a5('0x2e')](_0x5ec4e5[_0x47a5('0x2b')][_0x47a5('0x2e')]));_0x3a740b[_0x47a5('0x3e')]=_0x3a740b[_0x47a5('0x3e')][_0x47a5('0x2f')]?_0x3a740b[_0x47a5('0x3e')]:_0x448610[_0x47a5('0x2a')];if(_0x5ec4e5['query'][_0x47a5('0x3a')]){_0x3a740b[_0x47a5('0x3b')]=[{'all':!![]}];}_0x3a740b=_['merge']({},_0x3a740b,_0x5ec4e5['options']);return db[_0x47a5('0x39')]['find'](_0x3a740b)[_0x47a5('0x21')](handleEntityNotFound(_0x2bb502,null))[_0x47a5('0x21')](respondWithResult(_0x2bb502,null))['catch'](handleError(_0x2bb502,null));};exports['create']=function(_0x3d85cc,_0x52d409){return db[_0x47a5('0x39')][_0x47a5('0x3f')](_0x3d85cc[_0x47a5('0x40')],{})[_0x47a5('0x21')](function(_0x44fe8a){var _0x26acd2=_0x3d85cc[_0x47a5('0x41')]['get']({'plain':!![]});if(!_0x26acd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26acd2[_0x47a5('0x42')]===_0x47a5('0x41')){var _0x1163e3=_0x44fe8a[_0x47a5('0x43')]({'plain':!![]});var _0x2c7020=_0x47a5('0x44');return db[_0x47a5('0x45')]['find']({'where':{'name':_0x2c7020,'userProfileId':_0x26acd2[_0x47a5('0x46')]},'raw':!![]})[_0x47a5('0x21')](function(_0x5f6a){if(_0x5f6a&&_0x5f6a['autoAssociation']===0x0){return db[_0x47a5('0x47')]['create']({'name':_0x1163e3[_0x47a5('0x26')],'resourceId':_0x1163e3['id'],'type':_0x47a5('0x23'),'sectionId':_0x5f6a['id']},{})[_0x47a5('0x21')](function(){return _0x44fe8a;});}else{return _0x44fe8a;}})[_0x47a5('0x48')](function(_0x588551){logger[_0x47a5('0x24')](_0x47a5('0x49'),_0x588551);throw _0x588551;});}return _0x44fe8a;})[_0x47a5('0x21')](respondWithResult(_0x52d409,0xc9))[_0x47a5('0x48')](handleError(_0x52d409,null));};exports[_0x47a5('0x4a')]=function(_0x6a53b3,_0x24e9f4){if(_0x6a53b3['body']['id']){delete _0x6a53b3[_0x47a5('0x40')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x6a53b3[_0x47a5('0x4c')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x24e9f4,null))[_0x47a5('0x21')](saveUpdates(_0x6a53b3['body'],null))[_0x47a5('0x21')](respondWithResult(_0x24e9f4,null))[_0x47a5('0x48')](handleError(_0x24e9f4,null));};exports[_0x47a5('0x22')]=function(_0x53871e,_0x4c5ed){return db[_0x47a5('0x39')][_0x47a5('0x4b')]({'where':{'id':_0x53871e['params']['id']}})['then'](handleEntityNotFound(_0x4c5ed,null))[_0x47a5('0x21')](removeEntity(_0x4c5ed,null))[_0x47a5('0x48')](handleError(_0x4c5ed,null));};exports['preview']=function(_0x4cf792,_0x6d6b2b){var _0x4d6a82=0xa;var _0x16bb8a=['join','left_join',_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x53eedf={'SUM':_0x47a5('0x4f'),'COUNT':_0x47a5('0x50'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x199621={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':'HOUR(%s)','ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x485e3c=function(_0x470da6){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),_0x47a5('0x5a'),'IS\x20EMPTY',_0x47a5('0x5b')],_0x470da6);};var _0x5d1550=function(_0x5cbe97){if(!_0x5cbe97||!_0x5cbe97['rules']['length']){return'';}for(var _0x212d92='(',_0x6cd4ea=0x0;_0x6cd4ea<_0x5cbe97[_0x47a5('0x5c')]['length'];_0x6cd4ea+=0x1){_0x6cd4ea>0x0&&(_0x212d92+='\x20'+_0x5cbe97['operator']+'\x20');_0x212d92+=_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]?_0x5d1550(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5d')]):_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['field']+'\x20'+_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea]['condition']+(_0x485e3c(_0x5cbe97[_0x47a5('0x5c')][_0x6cd4ea][_0x47a5('0x5e')])?'\x20'+_0x5cbe97['rules'][_0x6cd4ea][_0x47a5('0x5f')]:'');}return _0x212d92+')';};var _0x345104={'where':{'id':_0x4cf792[_0x47a5('0x4c')]['id']}},_0x132854,_0x3e8274,_0x2d6494,_0x215634,_0x35cca8;_0x345104=_['merge']({},_0x345104,_0x4cf792[_0x47a5('0x38')]);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x345104)[_0x47a5('0x21')](function(_0x396cb0){if(_0x396cb0){_0x132854=_0x396cb0;return _0x396cb0['getFields']();}return null;})[_0x47a5('0x21')](function(_0xdfcecc){if(_0xdfcecc){if(!_0xdfcecc[_0x47a5('0x2f')]){throw new db[(_0x47a5('0x60'))][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x3e8274=_0xdfcecc;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x44cb90){if(_0x44cb90){_0x2d6494=_[_0x47a5('0x65')](_0x44cb90,'id');var _0x44fda9;var _0x3c0006=squel[_0x47a5('0x66')]();_0x3c0006[_0x47a5('0x67')](_0x132854['table']);for(var _0x42dd7d=0x0;_0x42dd7d<_0x3e8274[_0x47a5('0x2f')];_0x42dd7d+=0x1){_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x68')]?_0x2d6494[_0x3e8274[_0x42dd7d]['MetricId']][_0x47a5('0x69')]:_0x3e8274[_0x42dd7d][_0x47a5('0x6a')];_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6b')]?_[_0x47a5('0x6c')](_0x53eedf[_0x3e8274[_0x42dd7d]['function']],'%s',_0x44fda9):_0x44fda9;_0x44fda9=_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]?_['replace'](_0x199621[_0x3e8274[_0x42dd7d][_0x47a5('0x6d')]],'%s',_0x44fda9):_0x44fda9;if(_0x3e8274[_0x42dd7d]['groupBy']){_0x3c0006[_0x47a5('0x5d')](_0x44fda9);}_0x3e8274[_0x42dd7d]['orderBy']&&_0x3c0006[_0x47a5('0x32')](_0x44fda9,_0x3e8274[_0x42dd7d][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x3c0006['field'](_0x44fda9,_0x3e8274[_0x42dd7d]['alias']||_0x44fda9);}if(_0x132854['joins']){_0x132854[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x70')]);for(var _0x117510=0x0;_0x117510<_0x132854['joins'][_0x47a5('0x2f')];_0x117510+=0x1){if(_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')]&&_[_0x47a5('0x58')](_0x16bb8a,_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x72')])&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')]&&_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]){_0x3c0006[_0x132854['joins'][_0x117510][_0x47a5('0x72')]](_0x132854['joins'][_0x117510][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x132854[_0x47a5('0x77')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x73')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x74')],_0x132854[_0x47a5('0x70')][_0x117510][_0x47a5('0x75')]));}}}if(_0x132854[_0x47a5('0x78')]){_0x132854[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x132854[_0x47a5('0x78')]);_0x3c0006[_0x47a5('0x34')](_0x5d1550(_0x132854['conditions']['group']));}_0x35cca8=_0x3c0006['clone']();_0x3c0006['limit'](_0x4d6a82);_0x3c0006[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')]('Limited\x20Query:',_0x3c0006[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')][_0x47a5('0x2b')](_0x3c0006[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](respondWithResult(_0x6d6b2b,null))[_0x47a5('0x48')](handleError(_0x6d6b2b,null));};function runReport(_0x1ffe3c,_0x24a6c1,_0x5e5f16){var _0x18fa31=_0x24a6c1[_0x47a5('0x26')];var _0x420671=0xa;var _0x4f35ff=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),'cross_join'];var _0x19dc8c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':_0x47a5('0x53'),'GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x592322={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':'DATE(%s)','HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0xb16bdd=function(_0x53ea2b){return!_[_0x47a5('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0x53ea2b);};var _0x5b91f7=function(_0x1926bd){if(!_0x1926bd||!_0x1926bd[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x4c25ec='(',_0x280372=0x0;_0x280372<_0x1926bd['rules'][_0x47a5('0x2f')];_0x280372+=0x1){_0x280372>0x0&&(_0x4c25ec+='\x20'+_0x1926bd[_0x47a5('0x85')]+'\x20');_0x4c25ec+=_0x1926bd[_0x47a5('0x5c')][_0x280372]['group']?_0x5b91f7(_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5d')]):_0x1926bd[_0x47a5('0x5c')][_0x280372]['field']+'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition']+(_0xb16bdd(_0x1926bd[_0x47a5('0x5c')][_0x280372]['condition'])?'\x20'+_0x1926bd[_0x47a5('0x5c')][_0x280372][_0x47a5('0x5f')]:'');}return _0x4c25ec+')';};var _0x20a742={'where':{'id':_0x1ffe3c['id']}},_0x211fbf,_0x51738b,_0x42fcce,_0x2ae130,_0x23c393;_0x20a742=_[_0x47a5('0x37')]({},_0x20a742,_0x5e5f16);return db[_0x47a5('0x39')]['find'](_0x20a742)['then'](function(_0x569550){if(_0x569550){_0x211fbf=_0x569550;return _0x569550['getFields']();}return null;})[_0x47a5('0x21')](function(_0xa8809a){if(_0xa8809a){if(!_0xa8809a[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))](_0x47a5('0x62'),0x193);}_0x51738b=_0xa8809a;return db['AnalyticMetric'][_0x47a5('0x64')]({'raw':!![]});}return null;})[_0x47a5('0x21')](function(_0x19acfa){if(_0x19acfa){_0x42fcce=_[_0x47a5('0x65')](_0x19acfa,'id');var _0x58dacd;var _0x4b5353=squel[_0x47a5('0x66')]();_0x4b5353[_0x47a5('0x67')](_0x211fbf['table']);for(var _0x27d422=0x0;_0x27d422<_0x51738b[_0x47a5('0x2f')];_0x27d422+=0x1){_0x58dacd=_0x51738b[_0x27d422]['MetricId']?_0x42fcce[_0x51738b[_0x27d422][_0x47a5('0x68')]][_0x47a5('0x69')]:_0x51738b[_0x27d422][_0x47a5('0x6a')];_0x58dacd=_0x51738b[_0x27d422]['function']?_[_0x47a5('0x6c')](_0x19dc8c[_0x51738b[_0x27d422]['function']],'%s',_0x58dacd):_0x58dacd;_0x58dacd=_0x51738b[_0x27d422][_0x47a5('0x6d')]?_['replace'](_0x592322[_0x51738b[_0x27d422][_0x47a5('0x6d')]],'%s',_0x58dacd):_0x58dacd;if(_0x51738b[_0x27d422][_0x47a5('0x86')]){_0x4b5353['group'](_0x58dacd);}_0x51738b[_0x27d422][_0x47a5('0x6e')]&&_0x4b5353['order'](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x4b5353[_0x47a5('0x6a')](_0x58dacd,_0x51738b[_0x27d422][_0x47a5('0x87')]||_0x58dacd);}if(_0x211fbf['joins']){_0x211fbf[_0x47a5('0x70')]=JSON['parse'](_0x211fbf['joins']);for(var _0x2bb2df=0x0;_0x2bb2df<_0x211fbf[_0x47a5('0x70')][_0x47a5('0x2f')];_0x2bb2df+=0x1){if(_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]&&_['includes'](_0x4f35ff,_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')])&&_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x73')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x74')]&&_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]){_0x4b5353[_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x72')]](_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x211fbf[_0x47a5('0x77')],_0x211fbf[_0x47a5('0x70')][_0x2bb2df]['parentKey'],_0x211fbf[_0x47a5('0x70')][_0x2bb2df][_0x47a5('0x74')],_0x211fbf['joins'][_0x2bb2df][_0x47a5('0x75')]));}}}if(_0x211fbf[_0x47a5('0x78')]){_0x211fbf[_0x47a5('0x78')]=JSON['parse'](_0x211fbf['conditions']);_0x4b5353[_0x47a5('0x34')](_0x5b91f7(_0x211fbf[_0x47a5('0x78')]['group']));}_0x23c393=_0x4b5353['clone']();_0x4b5353[_0x47a5('0x1b')](_0x420671);_0x4b5353[_0x47a5('0x1d')](0x0);return;}})['then'](function(){if(_0x24a6c1[_0x47a5('0x88')]===_0x47a5('0x89')){return null;}var _0x4c9e6a=_[_0x47a5('0x37')](_0x24a6c1,{'name':_0x24a6c1[_0x47a5('0x8a')]||_0x24a6c1[_0x47a5('0x26')]||_0x211fbf[_0x47a5('0x26')],'basename':_0x18fa31,'savename':util[_0x47a5('0x6d')](_0x47a5('0x8b'),_0x24a6c1['name']||_0x211fbf['name'],require('randomstring')[_0x47a5('0x8c')](0x4),_0x24a6c1[_0x47a5('0x88')]||'csv'),'reportId':_0x211fbf['id'],'reportType':_0x47a5('0x8d')});return db[_0x47a5('0x8e')][_0x47a5('0x3f')](_0x4c9e6a,{'raw':!![]});})[_0x47a5('0x21')](function(_0xcdbfd7){if(_0x211fbf['table']===_0x47a5('0x8f')){_0x23c393['where'](_0x211fbf['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x24a6c1[_0x47a5('0x90')],_0x24a6c1['endDate']);}else{_0x23c393[_0x47a5('0x34')](_0x211fbf[_0x47a5('0x77')]+_0x47a5('0x91'),_0x24a6c1['startDate'],_0x24a6c1[_0x47a5('0x92')]);}if(_0xcdbfd7){logger[_0x47a5('0x93')](_0x47a5('0x94'),_0x23c393[_0x47a5('0x7a')]());require(_0x47a5('0x95'))['fork'](path[_0x47a5('0x7e')](__dirname,_0x47a5('0x96'),_0xcdbfd7['output']),[_0xcdbfd7['id'],_0x23c393[_0x47a5('0x7a')](),path[_0x47a5('0x7e')](__dirname,_0x47a5('0x97'),_0xcdbfd7[_0x47a5('0x98')]),_0x18fa31]);return _0xcdbfd7;}else{var _0x3c117a=squel[_0x47a5('0x66')]();_0x3c117a['from']('('+_0x23c393[_0x47a5('0x7a')]()+')',_0x47a5('0x99'));_0x3c117a['field'](_0x47a5('0x9a'),_0x47a5('0x1c'));_0x23c393[_0x47a5('0x1b')](_0x24a6c1[_0x47a5('0x1b')]||_0x420671);_0x23c393['offset'](_0x24a6c1['offset']||0x0);return dbH['sequelize']['query'](_0x3c117a[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')][_0x47a5('0x7d')]})[_0x47a5('0x21')](function(_0x6bc37b){if(!_0x6bc37b[_0x47a5('0x2f')]){_0x2ae130=0x0;}else{_0x2ae130=_0x6bc37b[0x0][_0x47a5('0x1c')]||0x0;}return dbH['sequelize'][_0x47a5('0x2b')](_0x23c393[_0x47a5('0x7a')](),{'type':dbH[_0x47a5('0x7b')][_0x47a5('0x7c')]['SELECT']});})['then'](function(_0x3770ae){return{'rows':_0x3770ae||[],'count':_0x2ae130};});}});}exports['run']=function(_0x4cb8e4,_0x1b6a5c){return runReport(_0x4cb8e4[_0x47a5('0x4c')],_0x4cb8e4['query'],_0x4cb8e4[_0x47a5('0x38')])[_0x47a5('0x21')](respondWithResult(_0x1b6a5c,null))[_0x47a5('0x48')](handleError(_0x1b6a5c,null));};exports['runReport']=runReport;exports[_0x47a5('0x2b')]=function(_0xee23c7,_0x48a491){var _0x1172fd=0xa;var _0x280b7b=[_0x47a5('0x7e'),_0x47a5('0x7f'),_0x47a5('0x4d'),_0x47a5('0x4e')];var _0x482c87={'SUM':_0x47a5('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x47a5('0x80'),'MAX':_0x47a5('0x81'),'MIN':_0x47a5('0x51'),'AVG':_0x47a5('0x52'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x47a5('0x54'),'GROUP_CONCAT DESC':_0x47a5('0x9b')};var _0x151540={'SEC_TO_TIME':_0x47a5('0x55'),'DATE':_0x47a5('0x56'),'HOUR':_0x47a5('0x82'),'ROUND':_0x47a5('0x57'),'UNIX_TIMESTAMP':_0x47a5('0x83')};var _0x1b3e82=function(_0xa2045c){return!_[_0x47a5('0x58')]([_0x47a5('0x59'),'IS\x20NOT\x20NULL',_0x47a5('0x84'),_0x47a5('0x5b')],_0xa2045c);};var _0x591bde=function(_0x55d955){if(!_0x55d955||!_0x55d955[_0x47a5('0x5c')][_0x47a5('0x2f')]){return'';}for(var _0x2ccf21='(',_0x2ff467=0x0;_0x2ff467<_0x55d955['rules'][_0x47a5('0x2f')];_0x2ff467+=0x1){_0x2ff467>0x0&&(_0x2ccf21+='\x20'+_0x55d955[_0x47a5('0x85')]+'\x20');_0x2ccf21+=_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]?_0x591bde(_0x55d955[_0x47a5('0x5c')][_0x2ff467][_0x47a5('0x5d')]):_0x55d955[_0x47a5('0x5c')][_0x2ff467]['field']+'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')]+(_0x1b3e82(_0x55d955['rules'][_0x2ff467][_0x47a5('0x5e')])?'\x20'+_0x55d955['rules'][_0x2ff467][_0x47a5('0x5f')]:'');}return _0x2ccf21+')';};var _0x8b4354={'where':{'id':_0xee23c7[_0x47a5('0x4c')]['id']}},_0x134c1a,_0x2bc7ae,_0x49cb8c,_0x220557,_0x11f07b;_0x8b4354=_['merge']({},_0x8b4354,_0xee23c7['options']);return db[_0x47a5('0x39')][_0x47a5('0x4b')](_0x8b4354)[_0x47a5('0x21')](function(_0xfccf9c){if(_0xfccf9c){_0x134c1a=_0xfccf9c;return _0xfccf9c[_0x47a5('0x9c')]();}return null;})[_0x47a5('0x21')](function(_0x1c0323){if(_0x1c0323){if(!_0x1c0323[_0x47a5('0x2f')]){throw new db['Sequelize'][(_0x47a5('0x61'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2bc7ae=_0x1c0323;return db[_0x47a5('0x63')][_0x47a5('0x64')]({'raw':!![]});}return null;})['then'](function(_0x48d4cf){if(_0x48d4cf){_0x49cb8c=_[_0x47a5('0x65')](_0x48d4cf,'id');var _0x41d2da;var _0x530387=squel[_0x47a5('0x66')]();_0x530387[_0x47a5('0x67')](_0x134c1a[_0x47a5('0x77')]);for(var _0x44567e=0x0;_0x44567e<_0x2bc7ae['length'];_0x44567e+=0x1){_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x68')]?_0x49cb8c[_0x2bc7ae[_0x44567e]['MetricId']]['metric']:_0x2bc7ae[_0x44567e]['field'];_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]?_['replace'](_0x482c87[_0x2bc7ae[_0x44567e][_0x47a5('0x6b')]],'%s',_0x41d2da):_0x41d2da;_0x41d2da=_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]?_[_0x47a5('0x6c')](_0x151540[_0x2bc7ae[_0x44567e][_0x47a5('0x6d')]],'%s',_0x41d2da):_0x41d2da;if(_0x2bc7ae[_0x44567e][_0x47a5('0x86')]){_0x530387[_0x47a5('0x5d')](_0x41d2da);}_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]&&_0x530387[_0x47a5('0x32')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x6e')]===_0x47a5('0x6f')?![]:!![]);_0x530387[_0x47a5('0x6a')](_0x41d2da,_0x2bc7ae[_0x44567e][_0x47a5('0x87')]||_0x41d2da);}if(_0x134c1a[_0x47a5('0x70')]){_0x134c1a[_0x47a5('0x70')]=JSON[_0x47a5('0x71')](_0x134c1a['joins']);for(var _0xdd95c8=0x0;_0xdd95c8<_0x134c1a[_0x47a5('0x70')][_0x47a5('0x2f')];_0xdd95c8+=0x1){if(_0x134c1a[_0x47a5('0x70')][_0xdd95c8]['type']&&_[_0x47a5('0x58')](_0x280b7b,_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x72')])&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x73')]&&_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x74')]&&_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]){_0x530387[_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x72')]](_0x134c1a['joins'][_0xdd95c8]['foreignTable'],null,util[_0x47a5('0x6d')](_0x47a5('0x76'),_0x134c1a[_0x47a5('0x77')],_0x134c1a[_0x47a5('0x70')][_0xdd95c8][_0x47a5('0x73')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x74')],_0x134c1a['joins'][_0xdd95c8][_0x47a5('0x75')]));}}}if(_0x134c1a[_0x47a5('0x78')]){_0x134c1a[_0x47a5('0x78')]=JSON[_0x47a5('0x71')](_0x134c1a['conditions']);_0x530387['where'](_0x591bde(_0x134c1a[_0x47a5('0x78')][_0x47a5('0x5d')]));}_0x11f07b=_0x530387[_0x47a5('0x9d')]();_0x530387[_0x47a5('0x1b')](_0x1172fd);_0x530387[_0x47a5('0x1d')](0x0);logger[_0x47a5('0x79')](_0x47a5('0x9e'),_0x530387[_0x47a5('0x7a')]());return dbH[_0x47a5('0x7b')]['query'](_0x530387['toString'](),{'type':dbH[_0x47a5('0x7b')]['QueryTypes'][_0x47a5('0x7d')]});}})[_0x47a5('0x21')](function(){return{'sql':_0x11f07b[_0x47a5('0x7a')]()};})['then'](respondWithResult(_0x48a491,null))[_0x47a5('0x48')](handleError(_0x48a491,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2d8d165..ab9c5e3 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 _0x262b=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0x262b,0x81));var _0xb262=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x262b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb262('0x0'));var util=require(_0xb262('0x1'));var logger=require(_0xb262('0x2'))(_0xb262('0x3'));var moment=require(_0xb262('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb262('0x5'));var rimraf=require(_0xb262('0x6'));var config=require(_0xb262('0x7'));var attributes=require(_0xb262('0x8'));module[_0xb262('0x9')]=function(_0x31f4a3,_0x7c7325){return _0x31f4a3[_0xb262('0xa')](_0xb262('0xb'),attributes,{'tableName':_0xb262('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db7=['./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x1b91ea,_0x2be1bb){var _0x13625f=function(_0x5d1f75){while(--_0x5d1f75){_0x1b91ea['push'](_0x1b91ea['shift']());}};_0x13625f(++_0x2be1bb);}(_0x4db7,0x12d));var _0x74db=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x4db7[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x74db('0x0'));var util=require(_0x74db('0x1'));var logger=require(_0x74db('0x2'))(_0x74db('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x74db('0x4'));var rimraf=require(_0x74db('0x5'));var config=require(_0x74db('0x6'));var attributes=require(_0x74db('0x7'));module['exports']=function(_0x48d912,_0x56563e){return _0x48d912[_0x74db('0x8')](_0x74db('0x9'),attributes,{'tableName':_0x74db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 9173f26..fbf484d 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 _0x12b0=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','stringify','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x3a4473,_0x1d03fe){var _0xb617ba=function(_0x2d7ec6){while(--_0x2d7ec6){_0x3a4473['push'](_0x3a4473['shift']());}};_0xb617ba(++_0x1d03fe);}(_0x12b0,0xc6));var _0x012b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x12b0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x012b('0x0'));var util=require('util');var moment=require(_0x012b('0x1'));var BPromise=require(_0x012b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x012b('0x3'));var db=require(_0x012b('0x4'))['db'];var utils=require(_0x012b('0x5'));var logger=require(_0x012b('0x6'))(_0x012b('0x7'));var config=require(_0x012b('0x8'));var jayson=require(_0x012b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x8e8e1a,_0x16ad2b,_0x199b3d){return new BPromise(function(_0x1df548,_0xab7a4a){return client[_0x012b('0xa')](_0x8e8e1a,_0x199b3d)[_0x012b('0xb')](function(_0x36b6d5){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'));logger[_0x012b('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'),JSON[_0x012b('0xe')](_0x36b6d5));if(_0x36b6d5[_0x012b('0xf')]){if(_0x36b6d5[_0x012b('0xf')]['code']===0x1f4){logger[_0x012b('0xf')](_0x012b('0x10'),_0x16ad2b,_0x36b6d5[_0x012b('0xf')][_0x012b('0x11')]);return _0xab7a4a(_0x36b6d5['error'][_0x012b('0x11')]);}logger[_0x012b('0xf')](_0x012b('0x10'),_0x16ad2b,_0x36b6d5[_0x012b('0xf')][_0x012b('0x11')]);return _0x1df548(_0x36b6d5['error'][_0x012b('0x11')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x16ad2b,_0x012b('0xc'));_0x1df548(_0x36b6d5[_0x012b('0x12')][_0x012b('0x11')]);}})[_0x012b('0x13')](function(_0x3c0df7){logger['error'](_0x012b('0x10'),_0x16ad2b,_0x3c0df7);_0xab7a4a(_0x3c0df7);});});} \ No newline at end of file +var _0x8ce2=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x30c901,_0x119390){var _0x4d50fc=function(_0x3b0b58){while(--_0x3b0b58){_0x30c901['push'](_0x30c901['shift']());}};_0x4d50fc(++_0x119390);}(_0x8ce2,0x1a7));var _0x28ce=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x8ce2[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x28ce('0x0'));var util=require(_0x28ce('0x1'));var moment=require(_0x28ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x28ce('0x3'));var fs=require('fs');var Redis=require(_0x28ce('0x4'));var db=require(_0x28ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x28ce('0x6'))(_0x28ce('0x7'));var config=require('../../config/environment');var jayson=require(_0x28ce('0x8'));var client=jayson['client'][_0x28ce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf10467,_0x32355e,_0x2904ce){return new BPromise(function(_0x155b02,_0xce727c){return client['request'](_0xf10467,_0x2904ce)[_0x28ce('0xa')](function(_0x431e0f){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x32355e,_0x28ce('0xb'));logger[_0x28ce('0xc')](_0x28ce('0xd'),_0x32355e,_0x28ce('0xb'),JSON[_0x28ce('0xe')](_0x431e0f));if(_0x431e0f[_0x28ce('0xf')]){if(_0x431e0f['error'][_0x28ce('0x10')]===0x1f4){logger[_0x28ce('0xf')](_0x28ce('0x11'),_0x32355e,_0x431e0f[_0x28ce('0xf')][_0x28ce('0x12')]);return _0xce727c(_0x431e0f['error']['message']);}logger[_0x28ce('0xf')](_0x28ce('0x11'),_0x32355e,_0x431e0f[_0x28ce('0xf')][_0x28ce('0x12')]);return _0x155b02(_0x431e0f[_0x28ce('0xf')]['message']);}else{logger['info'](_0x28ce('0x11'),_0x32355e,_0x28ce('0xb'));_0x155b02(_0x431e0f[_0x28ce('0x13')]['message']);}})[_0x28ce('0x14')](function(_0x4acb0a){logger[_0x28ce('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x32355e,_0x4acb0a);_0xce727c(_0x4acb0a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index bba0faf..e782483 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 _0xcd8d=['path','connect-timeout','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/query','post','create','put','delete','destroy','multer','util'];(function(_0x5d0bea,_0x5acdc8){var _0x187a4c=function(_0x4cb48d){while(--_0x4cb48d){_0x5d0bea['push'](_0x5d0bea['shift']());}};_0x187a4c(++_0x5acdc8);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xcd8d[_0x5db313];return _0x36d503;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var path=require(_0xdcd8('0x2'));var timeout=require(_0xdcd8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdcd8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcd8('0x5'));var controller=require(_0xdcd8('0x6'));router[_0xdcd8('0x7')]('/',auth[_0xdcd8('0x8')](),controller[_0xdcd8('0x9')]);router[_0xdcd8('0x7')](_0xdcd8('0xa'),auth[_0xdcd8('0x8')](),controller[_0xdcd8('0xb')]);router[_0xdcd8('0x7')](_0xdcd8('0xc'),auth[_0xdcd8('0x8')](),controller[_0xdcd8('0xd')]);router['get']('/:id/run',auth[_0xdcd8('0x8')](),controller['run']);router[_0xdcd8('0x7')](_0xdcd8('0xe'),auth[_0xdcd8('0x8')](),controller['query']);router[_0xdcd8('0xf')]('/',auth[_0xdcd8('0x8')](),controller[_0xdcd8('0x10')]);router[_0xdcd8('0x11')](_0xdcd8('0xa'),auth[_0xdcd8('0x8')](),controller['update']);router[_0xdcd8('0x12')](_0xdcd8('0xa'),auth['isAuthenticated'](),controller[_0xdcd8('0x13')]);module['exports']=router; \ No newline at end of file +var _0x857d=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','preview','/:id/run','isAuthenticated','run','/:id/query','query','create','/:id','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x857d,0x15d));var _0xd857=function(_0x5b09b1,_0x3887e9){_0x5b09b1=_0x5b09b1-0x0;var _0xe9e254=_0x857d[_0x5b09b1];return _0xe9e254;};'use strict';var multer=require(_0xd857('0x0'));var util=require(_0xd857('0x1'));var path=require('path');var timeout=require(_0xd857('0x2'));var express=require(_0xd857('0x3'));var router=express[_0xd857('0x4')]();var fs_extra=require(_0xd857('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd857('0x6'));var config=require(_0xd857('0x7'));var controller=require('./analyticDefaultReport.controller');router[_0xd857('0x8')]('/',auth['isAuthenticated'](),controller[_0xd857('0x9')]);router[_0xd857('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd857('0xa')]);router[_0xd857('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0xd857('0xb')]);router[_0xd857('0x8')](_0xd857('0xc'),auth[_0xd857('0xd')](),controller[_0xd857('0xe')]);router[_0xd857('0x8')](_0xd857('0xf'),auth[_0xd857('0xd')](),controller[_0xd857('0x10')]);router['post']('/',auth[_0xd857('0xd')](),controller[_0xd857('0x11')]);router['put'](_0xd857('0x12'),auth[_0xd857('0xd')](),controller['update']);router[_0xd857('0x13')](_0xd857('0x12'),auth['isAuthenticated'](),controller[_0xd857('0x14')]);module[_0xd857('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 59307d6..a5ce30f 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 _0x48ba=['xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','csv','pdf'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x48ba,0x159));var _0xa48b=function(_0x45681e,_0x2c2ddb){_0x45681e=_0x45681e-0x0;var _0x369a92=_0x48ba[_0x45681e];return _0x369a92;};'use strict';var Sequelize=require(_0xa48b('0x0'));var moment=require(_0xa48b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xa48b('0x3')](_0xa48b('0x4'),_0xa48b('0x5'),_0xa48b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xa48b('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xa48b('0x7')]},'endDate':{'type':Sequelize[_0xa48b('0x7')]},'status':{'type':Sequelize[_0xa48b('0x2')],'defaultValue':_0xa48b('0x8')},'type':{'type':Sequelize[_0xa48b('0x3')](_0xa48b('0x9'),_0xa48b('0xa')),'allowNull':![],'defaultValue':_0xa48b('0x9')},'reportId':{'type':Sequelize[_0xa48b('0xb')](0xb)[_0xa48b('0xc')]},'reportType':{'type':Sequelize[_0xa48b('0x2')]}}; \ No newline at end of file +var _0x3527=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x3527,0x12c));var _0x7352=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x3527[_0x79b649];return _0x1af9b1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7352('0x0'));module[_0x7352('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x7352('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x7352('0x3')](_0x7352('0x4'),_0x7352('0x5'),_0x7352('0x6')),'allowNull':![],'defaultValue':_0x7352('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x7352('0x7')]},'endDate':{'type':Sequelize[_0x7352('0x7')]},'status':{'type':Sequelize[_0x7352('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x7352('0x3')](_0x7352('0x8'),_0x7352('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7352('0xa')](0xb)[_0x7352('0xb')]},'reportType':{'type':Sequelize[_0x7352('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 76b3717..f091783 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 _0x39c1=['util','path','sox','to-csv','ejs','lodash','squel','jsforce','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','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','create','user','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','download','basename','savename','output','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','root','format','toLowerCase','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x39c1,0x112));var _0x139c=function(_0x3e1249,_0x329d83){_0x3e1249=_0x3e1249-0x0;var _0xc3b9d0=_0x39c1[_0x3e1249];return _0xc3b9d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x139c('0x0'));var zipdir=require(_0x139c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x139c('0x2'));var moment=require('moment');var BPromise=require(_0x139c('0x3'));var Mustache=require(_0x139c('0x4'));var util=require(_0x139c('0x5'));var path=require(_0x139c('0x6'));var sox=require(_0x139c('0x7'));var csv=require(_0x139c('0x8'));var ejs=require(_0x139c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x139c('0xa'));var squel=require(_0x139c('0xb'));var crypto=require('crypto');var jsforce=require(_0x139c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x139c('0x8'));var querystring=require(_0x139c('0xd'));var Papa=require('papaparse');var Redis=require(_0x139c('0xe'));var authService=require(_0x139c('0xf'));var qs=require(_0x139c('0x10'));var as=require(_0x139c('0x11'));var hardwareService=require(_0x139c('0x12'));var logger=require('../../config/logger')(_0x139c('0x13'));var utils=require(_0x139c('0x14'));var config=require(_0x139c('0x15'));var licenseUtil=require(_0x139c('0x16'));var db=require(_0x139c('0x17'))['db'];function respondWithStatusCode(_0x1bdd0b,_0x5b53eb){_0x5b53eb=_0x5b53eb||0xcc;return function(_0x4345b8){if(_0x4345b8){return _0x1bdd0b['sendStatus'](_0x5b53eb);}return _0x1bdd0b[_0x139c('0x18')](_0x5b53eb)[_0x139c('0x19')]();};}function respondWithResult(_0x5e8a9c,_0x44595f){_0x44595f=_0x44595f||0xc8;return function(_0x50a29f){if(_0x50a29f){return _0x5e8a9c[_0x139c('0x18')](_0x44595f)[_0x139c('0x1a')](_0x50a29f);}};}function respondWithFilteredResult(_0x312ac1,_0x1e9c35){return function(_0x45a0a9){if(_0x45a0a9){var _0x3b4a6e=typeof _0x1e9c35['offset']==='undefined'&&typeof _0x1e9c35[_0x139c('0x1b')]===_0x139c('0x1c');var _0x4f351f=_0x45a0a9[_0x139c('0x1d')];var _0x594fef=_0x3b4a6e?0x0:_0x1e9c35[_0x139c('0x1e')];var _0x1fc1b1=_0x3b4a6e?_0x45a0a9[_0x139c('0x1d')]:_0x1e9c35['offset']+_0x1e9c35[_0x139c('0x1b')];var _0x1bb6c7;if(_0x1fc1b1>=_0x4f351f){_0x1fc1b1=_0x4f351f;_0x1bb6c7=0xc8;}else{_0x1bb6c7=0xce;}_0x312ac1[_0x139c('0x18')](_0x1bb6c7);return _0x312ac1[_0x139c('0x1f')](_0x139c('0x20'),_0x594fef+'-'+_0x1fc1b1+'/'+_0x4f351f)[_0x139c('0x1a')](_0x45a0a9);}return null;};}function patchUpdates(_0x3381ec){return function(_0x471fbe){try{jsonpatch[_0x139c('0x21')](_0x471fbe,_0x3381ec,!![]);}catch(_0x4a6a72){return BPromise[_0x139c('0x22')](_0x4a6a72);}return _0x471fbe[_0x139c('0x23')]();};}function saveUpdates(_0xd31087,_0x1b6511){return function(_0x1412e1){if(_0x1412e1){return _0x1412e1['update'](_0xd31087)[_0x139c('0x24')](function(_0x2f337d){return _0x2f337d;});}return null;};}function removeEntity(_0x4ca3a1,_0x16229d){return function(_0x33515d){if(_0x33515d){return _0x33515d['destroy']()[_0x139c('0x24')](function(){var _0x5f48af=_0x33515d['get']({'plain':!![]});var _0x4cfa8c=_0x139c('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cfa8c,'resourceId':_0x5f48af['id']}})[_0x139c('0x24')](function(){return _0x33515d;});})[_0x139c('0x24')](function(){_0x4ca3a1['status'](0xcc)[_0x139c('0x19')]();});}};}function handleEntityNotFound(_0x202e27,_0x3db0ac){return function(_0x3d885e){if(!_0x3d885e){_0x202e27['sendStatus'](0x194);}return _0x3d885e;};}function handleError(_0x1bad27,_0x990d57){_0x990d57=_0x990d57||0x1f4;return function(_0x5325ea){logger[_0x139c('0x26')](_0x5325ea[_0x139c('0x27')]);if(_0x5325ea[_0x139c('0x28')]){delete _0x5325ea[_0x139c('0x28')];}_0x1bad27[_0x139c('0x18')](_0x990d57)[_0x139c('0x29')](_0x5325ea);};}exports[_0x139c('0x2a')]=function(_0x51e74f,_0x5332c4){var _0x26b5cb={},_0x202909={},_0xf32714={'count':0x0,'rows':[]};var _0x721c13=_[_0x139c('0x2b')](db[_0x139c('0x2c')][_0x139c('0x2d')],function(_0x4ba8c7){return{'name':_0x4ba8c7['fieldName'],'type':_0x4ba8c7[_0x139c('0x2e')][_0x139c('0x2f')]};});_0x202909[_0x139c('0x30')]=_[_0x139c('0x2b')](_0x721c13,_0x139c('0x28'));_0x202909[_0x139c('0x31')]=_['keys'](_0x51e74f[_0x139c('0x31')]);_0x202909['filters']=_[_0x139c('0x32')](_0x202909[_0x139c('0x30')],_0x202909[_0x139c('0x31')]);_0x26b5cb[_0x139c('0x33')]=_['intersection'](_0x202909['model'],qs[_0x139c('0x34')](_0x51e74f[_0x139c('0x31')][_0x139c('0x34')]));_0x26b5cb[_0x139c('0x33')]=_0x26b5cb[_0x139c('0x33')][_0x139c('0x35')]?_0x26b5cb['attributes']:_0x202909[_0x139c('0x30')];if(!_0x51e74f[_0x139c('0x31')][_0x139c('0x36')](_0x139c('0x37'))){_0x26b5cb[_0x139c('0x1b')]=qs[_0x139c('0x1b')](_0x51e74f[_0x139c('0x31')][_0x139c('0x1b')]);_0x26b5cb[_0x139c('0x1e')]=qs[_0x139c('0x1e')](_0x51e74f[_0x139c('0x31')][_0x139c('0x1e')]);}_0x26b5cb['order']=qs[_0x139c('0x38')](_0x51e74f[_0x139c('0x31')][_0x139c('0x38')]);_0x26b5cb[_0x139c('0x39')]=qs[_0x139c('0x3a')](_[_0x139c('0x3b')](_0x51e74f['query'],_0x202909['filters']),_0x721c13);if(_0x51e74f[_0x139c('0x31')][_0x139c('0x3c')]){_0x26b5cb[_0x139c('0x39')]=_[_0x139c('0x3d')](_0x26b5cb[_0x139c('0x39')],{'$or':_['map'](_0x721c13,function(_0x48cfca){if(_0x48cfca[_0x139c('0x2e')]!==_0x139c('0x3e')){var _0x26411e={};_0x26411e[_0x48cfca[_0x139c('0x28')]]={'$like':'%'+_0x51e74f[_0x139c('0x31')][_0x139c('0x3c')]+'%'};return _0x26411e;}})});}_0x26b5cb=_['merge']({},_0x26b5cb,_0x51e74f['options']);var _0x8ff527={'where':_0x26b5cb[_0x139c('0x39')]};return db[_0x139c('0x2c')][_0x139c('0x1d')](_0x8ff527)[_0x139c('0x24')](function(_0x37efde){_0xf32714['count']=_0x37efde;if(_0x51e74f[_0x139c('0x31')][_0x139c('0x3f')]){_0x26b5cb[_0x139c('0x40')]=[{'all':!![]}];}return db[_0x139c('0x2c')][_0x139c('0x41')](_0x26b5cb);})['then'](function(_0x1206dd){_0xf32714[_0x139c('0x42')]=_0x1206dd;return _0xf32714;})[_0x139c('0x24')](respondWithFilteredResult(_0x5332c4,_0x26b5cb))[_0x139c('0x43')](handleError(_0x5332c4,null));};exports['show']=function(_0x2edfb8,_0x31ca7e){var _0x42f8a1={'raw':!![],'where':{'id':_0x2edfb8[_0x139c('0x44')]['id']}},_0x3da03a={};_0x3da03a[_0x139c('0x30')]=_[_0x139c('0x45')](db[_0x139c('0x2c')][_0x139c('0x2d')]);_0x3da03a[_0x139c('0x31')]=_[_0x139c('0x45')](_0x2edfb8[_0x139c('0x31')]);_0x3da03a[_0x139c('0x3a')]=_[_0x139c('0x32')](_0x3da03a[_0x139c('0x30')],_0x3da03a[_0x139c('0x31')]);_0x42f8a1[_0x139c('0x33')]=_[_0x139c('0x32')](_0x3da03a[_0x139c('0x30')],qs[_0x139c('0x34')](_0x2edfb8[_0x139c('0x31')][_0x139c('0x34')]));_0x42f8a1[_0x139c('0x33')]=_0x42f8a1['attributes'][_0x139c('0x35')]?_0x42f8a1['attributes']:_0x3da03a[_0x139c('0x30')];if(_0x2edfb8[_0x139c('0x31')][_0x139c('0x3f')]){_0x42f8a1[_0x139c('0x40')]=[{'all':!![]}];}_0x42f8a1=_[_0x139c('0x3d')]({},_0x42f8a1,_0x2edfb8[_0x139c('0x46')]);return db[_0x139c('0x2c')][_0x139c('0x47')](_0x42f8a1)[_0x139c('0x24')](handleEntityNotFound(_0x31ca7e,null))['then'](respondWithResult(_0x31ca7e,null))[_0x139c('0x43')](handleError(_0x31ca7e,null));};exports[_0x139c('0x48')]=function(_0xcc1051,_0x636de5){return db['AnalyticExtractedReport'][_0x139c('0x48')](_0xcc1051['body'],{})['then'](function(_0x3788da){var _0x5c6408=_0xcc1051[_0x139c('0x49')]['get']({'plain':!![]});if(!_0x5c6408)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c6408['role']==='user'){var _0x1c04d6=_0x3788da[_0x139c('0x4a')]({'plain':!![]});var _0x1d8d13='ExtractedReports';return db['UserProfileSection'][_0x139c('0x47')]({'where':{'name':_0x1d8d13,'userProfileId':_0x5c6408[_0x139c('0x4b')]},'raw':!![]})[_0x139c('0x24')](function(_0x26b200){if(_0x26b200&&_0x26b200['autoAssociation']===0x0){return db[_0x139c('0x4c')][_0x139c('0x48')]({'name':_0x1c04d6[_0x139c('0x28')],'resourceId':_0x1c04d6['id'],'type':_0x26b200['name'],'sectionId':_0x26b200['id']},{})[_0x139c('0x24')](function(){return _0x3788da;});}else{return _0x3788da;}})[_0x139c('0x43')](function(_0x497399){logger['error'](_0x139c('0x4d'),_0x497399);throw _0x497399;});}return _0x3788da;})[_0x139c('0x24')](respondWithResult(_0x636de5,0xc9))[_0x139c('0x43')](handleError(_0x636de5,null));};exports[_0x139c('0x4e')]=function(_0x3c63cd,_0x5b0e26){if(_0x3c63cd[_0x139c('0x4f')]['id']){delete _0x3c63cd[_0x139c('0x4f')]['id'];}return db[_0x139c('0x2c')]['find']({'where':{'id':_0x3c63cd[_0x139c('0x44')]['id']}})[_0x139c('0x24')](handleEntityNotFound(_0x5b0e26,null))['then'](saveUpdates(_0x3c63cd[_0x139c('0x4f')],null))['then'](respondWithResult(_0x5b0e26,null))[_0x139c('0x43')](handleError(_0x5b0e26,null));};exports[_0x139c('0x50')]=function(_0x373747,_0x1071dd){return db[_0x139c('0x2c')][_0x139c('0x47')]({'where':{'id':_0x373747[_0x139c('0x44')]['id']}})[_0x139c('0x24')](handleEntityNotFound(_0x1071dd,null))['then'](removeEntity(_0x1071dd,null))[_0x139c('0x43')](handleError(_0x1071dd,null));};exports[_0x139c('0x51')]=function(_0x1a991a,_0x4d967b,_0xa32a2e){return db[_0x139c('0x2c')]['find']({'where':{'id':_0x1a991a[_0x139c('0x44')]['id']},'attributes':[_0x139c('0x28'),_0x139c('0x52'),_0x139c('0x53'),_0x139c('0x54')],'raw':!![]})[_0x139c('0x24')](handleEntityNotFound(_0x4d967b,null))['then'](function(_0x1a8238){if(_0x1a8238){if(!fs['existsSync'](path[_0x139c('0x55')](config['root'],_0x139c('0x56'),_0x1a8238[_0x139c('0x53')]))){throw new db[(_0x139c('0x57'))][(_0x139c('0x58'))](_0x139c('0x59'));}if(_0x1a991a[_0x139c('0x31')]['exists']){return _0x4d967b['sendStatus'](0xc8);}return _0x4d967b['download'](path[_0x139c('0x55')](config[_0x139c('0x5a')],_0x139c('0x56'),_0x1a8238[_0x139c('0x53')]),util[_0x139c('0x5b')]('%s.%s',_0x1a8238['basename']||_0x1a8238[_0x139c('0x28')],_0x1a8238['output'][_0x139c('0x5c')]()));}})['catch'](handleError(_0x4d967b,null));}; \ No newline at end of file +var _0xcd59=['findAll','show','params','options','find','create','body','role','user','get','ExtractedReports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','download','output','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','savename','format','%s.%s','toLowerCase','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xcd59,0x7b));var _0x9cd5=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0xcd59[_0x12b830];return _0x261dc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cd5('0x0'));var zipdir=require(_0x9cd5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9cd5('0x2'));var BPromise=require(_0x9cd5('0x3'));var Mustache=require(_0x9cd5('0x4'));var util=require('util');var path=require(_0x9cd5('0x5'));var sox=require(_0x9cd5('0x6'));var csv=require(_0x9cd5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cd5('0x8'));var _=require(_0x9cd5('0x9'));var squel=require(_0x9cd5('0xa'));var crypto=require(_0x9cd5('0xb'));var jsforce=require(_0x9cd5('0xc'));var deskjs=require(_0x9cd5('0xd'));var toCsv=require(_0x9cd5('0x7'));var querystring=require(_0x9cd5('0xe'));var Papa=require(_0x9cd5('0xf'));var Redis=require(_0x9cd5('0x10'));var authService=require(_0x9cd5('0x11'));var qs=require(_0x9cd5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cd5('0x13'));var logger=require(_0x9cd5('0x14'))(_0x9cd5('0x15'));var utils=require(_0x9cd5('0x16'));var config=require(_0x9cd5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9cd5('0x18'))['db'];function respondWithStatusCode(_0x3e0f30,_0x5378ef){_0x5378ef=_0x5378ef||0xcc;return function(_0x259472){if(_0x259472){return _0x3e0f30[_0x9cd5('0x19')](_0x5378ef);}return _0x3e0f30['status'](_0x5378ef)[_0x9cd5('0x1a')]();};}function respondWithResult(_0x286f57,_0x35a102){_0x35a102=_0x35a102||0xc8;return function(_0x4a25d2){if(_0x4a25d2){return _0x286f57[_0x9cd5('0x1b')](_0x35a102)[_0x9cd5('0x1c')](_0x4a25d2);}};}function respondWithFilteredResult(_0x4b7976,_0x5c0da3){return function(_0x182bb5){if(_0x182bb5){var _0x372ecc=typeof _0x5c0da3[_0x9cd5('0x1d')]===_0x9cd5('0x1e')&&typeof _0x5c0da3[_0x9cd5('0x1f')]===_0x9cd5('0x1e');var _0x4efc10=_0x182bb5['count'];var _0x3f458f=_0x372ecc?0x0:_0x5c0da3[_0x9cd5('0x1d')];var _0x5dae19=_0x372ecc?_0x182bb5[_0x9cd5('0x20')]:_0x5c0da3[_0x9cd5('0x1d')]+_0x5c0da3[_0x9cd5('0x1f')];var _0x24bc7a;if(_0x5dae19>=_0x4efc10){_0x5dae19=_0x4efc10;_0x24bc7a=0xc8;}else{_0x24bc7a=0xce;}_0x4b7976[_0x9cd5('0x1b')](_0x24bc7a);return _0x4b7976[_0x9cd5('0x21')](_0x9cd5('0x22'),_0x3f458f+'-'+_0x5dae19+'/'+_0x4efc10)[_0x9cd5('0x1c')](_0x182bb5);}return null;};}function patchUpdates(_0x4937dc){return function(_0x2681f8){try{jsonpatch[_0x9cd5('0x23')](_0x2681f8,_0x4937dc,!![]);}catch(_0x47e229){return BPromise['reject'](_0x47e229);}return _0x2681f8[_0x9cd5('0x24')]();};}function saveUpdates(_0x2511f7,_0xfbaa19){return function(_0x3d0be0){if(_0x3d0be0){return _0x3d0be0[_0x9cd5('0x25')](_0x2511f7)[_0x9cd5('0x26')](function(_0x28ed21){return _0x28ed21;});}return null;};}function removeEntity(_0x5c125f,_0x2ca470){return function(_0x4e1d0f){if(_0x4e1d0f){return _0x4e1d0f[_0x9cd5('0x27')]()[_0x9cd5('0x26')](function(){var _0x3e1bf7=_0x4e1d0f['get']({'plain':!![]});var _0x468a64='ExtractedReports';return db[_0x9cd5('0x28')][_0x9cd5('0x27')]({'where':{'type':_0x468a64,'resourceId':_0x3e1bf7['id']}})[_0x9cd5('0x26')](function(){return _0x4e1d0f;});})[_0x9cd5('0x26')](function(){_0x5c125f[_0x9cd5('0x1b')](0xcc)[_0x9cd5('0x1a')]();});}};}function handleEntityNotFound(_0x2ad283,_0xfcdce4){return function(_0x4ff0f1){if(!_0x4ff0f1){_0x2ad283[_0x9cd5('0x19')](0x194);}return _0x4ff0f1;};}function handleError(_0x4b3bbc,_0xb1a923){_0xb1a923=_0xb1a923||0x1f4;return function(_0x44bb13){logger[_0x9cd5('0x29')](_0x44bb13[_0x9cd5('0x2a')]);if(_0x44bb13[_0x9cd5('0x2b')]){delete _0x44bb13['name'];}_0x4b3bbc[_0x9cd5('0x1b')](_0xb1a923)[_0x9cd5('0x2c')](_0x44bb13);};}exports[_0x9cd5('0x2d')]=function(_0x4b043e,_0x12c76b){var _0x5d4402={},_0x305ffe={},_0x2ed04f={'count':0x0,'rows':[]};var _0x520275=_[_0x9cd5('0x2e')](db[_0x9cd5('0x2f')][_0x9cd5('0x30')],function(_0x4d9387){return{'name':_0x4d9387[_0x9cd5('0x31')],'type':_0x4d9387[_0x9cd5('0x32')]['key']};});_0x305ffe[_0x9cd5('0x33')]=_['map'](_0x520275,_0x9cd5('0x2b'));_0x305ffe[_0x9cd5('0x34')]=_[_0x9cd5('0x35')](_0x4b043e['query']);_0x305ffe[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x305ffe['model'],_0x305ffe[_0x9cd5('0x34')]);_0x5d4402[_0x9cd5('0x38')]=_[_0x9cd5('0x37')](_0x305ffe[_0x9cd5('0x33')],qs[_0x9cd5('0x39')](_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x39')]));_0x5d4402['attributes']=_0x5d4402['attributes'][_0x9cd5('0x3a')]?_0x5d4402[_0x9cd5('0x38')]:_0x305ffe[_0x9cd5('0x33')];if(!_0x4b043e[_0x9cd5('0x34')]['hasOwnProperty'](_0x9cd5('0x3b'))){_0x5d4402[_0x9cd5('0x1f')]=qs[_0x9cd5('0x1f')](_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x1f')]);_0x5d4402[_0x9cd5('0x1d')]=qs[_0x9cd5('0x1d')](_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x1d')]);}_0x5d4402[_0x9cd5('0x3c')]=qs[_0x9cd5('0x3d')](_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x3d')]);_0x5d4402['where']=qs['filters'](_[_0x9cd5('0x3e')](_0x4b043e[_0x9cd5('0x34')],_0x305ffe[_0x9cd5('0x36')]),_0x520275);if(_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x3f')]){_0x5d4402[_0x9cd5('0x40')]=_[_0x9cd5('0x41')](_0x5d4402['where'],{'$or':_[_0x9cd5('0x2e')](_0x520275,function(_0x362c73){if(_0x362c73[_0x9cd5('0x32')]!==_0x9cd5('0x42')){var _0x2df700={};_0x2df700[_0x362c73[_0x9cd5('0x2b')]]={'$like':'%'+_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x3f')]+'%'};return _0x2df700;}})});}_0x5d4402=_[_0x9cd5('0x41')]({},_0x5d4402,_0x4b043e['options']);var _0x179e27={'where':_0x5d4402['where']};return db['AnalyticExtractedReport'][_0x9cd5('0x20')](_0x179e27)['then'](function(_0x1f3e91){_0x2ed04f[_0x9cd5('0x20')]=_0x1f3e91;if(_0x4b043e[_0x9cd5('0x34')][_0x9cd5('0x43')]){_0x5d4402[_0x9cd5('0x44')]=[{'all':!![]}];}return db[_0x9cd5('0x2f')][_0x9cd5('0x45')](_0x5d4402);})['then'](function(_0x280093){_0x2ed04f['rows']=_0x280093;return _0x2ed04f;})[_0x9cd5('0x26')](respondWithFilteredResult(_0x12c76b,_0x5d4402))['catch'](handleError(_0x12c76b,null));};exports[_0x9cd5('0x46')]=function(_0x29a960,_0x1c00bb){var _0x589aaf={'raw':!![],'where':{'id':_0x29a960[_0x9cd5('0x47')]['id']}},_0x1d2480={};_0x1d2480['model']=_[_0x9cd5('0x35')](db['AnalyticExtractedReport'][_0x9cd5('0x30')]);_0x1d2480[_0x9cd5('0x34')]=_[_0x9cd5('0x35')](_0x29a960[_0x9cd5('0x34')]);_0x1d2480[_0x9cd5('0x36')]=_[_0x9cd5('0x37')](_0x1d2480[_0x9cd5('0x33')],_0x1d2480['query']);_0x589aaf[_0x9cd5('0x38')]=_[_0x9cd5('0x37')](_0x1d2480[_0x9cd5('0x33')],qs[_0x9cd5('0x39')](_0x29a960[_0x9cd5('0x34')][_0x9cd5('0x39')]));_0x589aaf[_0x9cd5('0x38')]=_0x589aaf[_0x9cd5('0x38')][_0x9cd5('0x3a')]?_0x589aaf[_0x9cd5('0x38')]:_0x1d2480[_0x9cd5('0x33')];if(_0x29a960['query'][_0x9cd5('0x43')]){_0x589aaf['include']=[{'all':!![]}];}_0x589aaf=_[_0x9cd5('0x41')]({},_0x589aaf,_0x29a960[_0x9cd5('0x48')]);return db[_0x9cd5('0x2f')][_0x9cd5('0x49')](_0x589aaf)[_0x9cd5('0x26')](handleEntityNotFound(_0x1c00bb,null))['then'](respondWithResult(_0x1c00bb,null))['catch'](handleError(_0x1c00bb,null));};exports[_0x9cd5('0x4a')]=function(_0x10a292,_0x25502d){return db[_0x9cd5('0x2f')][_0x9cd5('0x4a')](_0x10a292[_0x9cd5('0x4b')],{})['then'](function(_0x89abbd){var _0x6d36bb=_0x10a292['user']['get']({'plain':!![]});if(!_0x6d36bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6d36bb[_0x9cd5('0x4c')]===_0x9cd5('0x4d')){var _0xea6b4=_0x89abbd[_0x9cd5('0x4e')]({'plain':!![]});var _0x448b7a=_0x9cd5('0x4f');return db['UserProfileSection'][_0x9cd5('0x49')]({'where':{'name':_0x448b7a,'userProfileId':_0x6d36bb[_0x9cd5('0x50')]},'raw':!![]})[_0x9cd5('0x26')](function(_0xf81099){if(_0xf81099&&_0xf81099['autoAssociation']===0x0){return db[_0x9cd5('0x28')][_0x9cd5('0x4a')]({'name':_0xea6b4[_0x9cd5('0x2b')],'resourceId':_0xea6b4['id'],'type':_0xf81099[_0x9cd5('0x2b')],'sectionId':_0xf81099['id']},{})[_0x9cd5('0x26')](function(){return _0x89abbd;});}else{return _0x89abbd;}})['catch'](function(_0x502ace){logger[_0x9cd5('0x29')](_0x9cd5('0x51'),_0x502ace);throw _0x502ace;});}return _0x89abbd;})[_0x9cd5('0x26')](respondWithResult(_0x25502d,0xc9))[_0x9cd5('0x52')](handleError(_0x25502d,null));};exports[_0x9cd5('0x25')]=function(_0x501ee3,_0x270375){if(_0x501ee3[_0x9cd5('0x4b')]['id']){delete _0x501ee3['body']['id'];}return db['AnalyticExtractedReport'][_0x9cd5('0x49')]({'where':{'id':_0x501ee3[_0x9cd5('0x47')]['id']}})[_0x9cd5('0x26')](handleEntityNotFound(_0x270375,null))[_0x9cd5('0x26')](saveUpdates(_0x501ee3['body'],null))['then'](respondWithResult(_0x270375,null))[_0x9cd5('0x52')](handleError(_0x270375,null));};exports[_0x9cd5('0x27')]=function(_0x5c9bcd,_0x3406de){return db[_0x9cd5('0x2f')][_0x9cd5('0x49')]({'where':{'id':_0x5c9bcd['params']['id']}})[_0x9cd5('0x26')](handleEntityNotFound(_0x3406de,null))[_0x9cd5('0x26')](removeEntity(_0x3406de,null))[_0x9cd5('0x52')](handleError(_0x3406de,null));};exports[_0x9cd5('0x53')]=function(_0x13a77b,_0x481536,_0x443597){return db[_0x9cd5('0x2f')][_0x9cd5('0x49')]({'where':{'id':_0x13a77b[_0x9cd5('0x47')]['id']},'attributes':[_0x9cd5('0x2b'),'basename','savename',_0x9cd5('0x54')],'raw':!![]})[_0x9cd5('0x26')](handleEntityNotFound(_0x481536,null))[_0x9cd5('0x26')](function(_0x4aa88e){if(_0x4aa88e){if(!fs['existsSync'](path[_0x9cd5('0x55')](config['root'],_0x9cd5('0x56'),_0x4aa88e['savename']))){throw new db[(_0x9cd5('0x57'))][(_0x9cd5('0x58'))](_0x9cd5('0x59'));}if(_0x13a77b[_0x9cd5('0x34')][_0x9cd5('0x5a')]){return _0x481536[_0x9cd5('0x19')](0xc8);}return _0x481536[_0x9cd5('0x53')](path[_0x9cd5('0x55')](config[_0x9cd5('0x5b')],_0x9cd5('0x56'),_0x4aa88e[_0x9cd5('0x5c')]),util[_0x9cd5('0x5d')](_0x9cd5('0x5e'),_0x4aa88e['basename']||_0x4aa88e[_0x9cd5('0x2b')],_0x4aa88e[_0x9cd5('0x54')][_0x9cd5('0x5f')]()));}})[_0x9cd5('0x52')](handleError(_0x481536,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1cef542..9e479c2 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 _0x6921=['define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x2852cf,_0xcd3407){var _0xa77966=function(_0x394936){while(--_0x394936){_0x2852cf['push'](_0x2852cf['shift']());}};_0xa77966(++_0xcd3407);}(_0x6921,0x121));var _0x1692=function(_0x16a998,_0x579f1f){_0x16a998=_0x16a998-0x0;var _0x56f7f2=_0x6921[_0x16a998];return _0x56f7f2;};'use strict';var _=require(_0x1692('0x0'));var util=require(_0x1692('0x1'));var logger=require('../../config/logger')(_0x1692('0x2'));var moment=require(_0x1692('0x3'));var BPromise=require(_0x1692('0x4'));var rp=require(_0x1692('0x5'));var fs=require('fs');var path=require(_0x1692('0x6'));var rimraf=require(_0x1692('0x7'));var config=require(_0x1692('0x8'));var attributes=require(_0x1692('0x9'));module[_0x1692('0xa')]=function(_0x1244a4,_0x14a783){return _0x1244a4[_0x1692('0xb')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5f2=['util','api','moment','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xd5f2,0x1f3));var _0x2d5f=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xd5f2[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x2d5f('0x0'));var util=require(_0x2d5f('0x1'));var logger=require('../../config/logger')(_0x2d5f('0x2'));var moment=require(_0x2d5f('0x3'));var BPromise=require(_0x2d5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d5f('0x5'));var rimraf=require('rimraf');var config=require(_0x2d5f('0x6'));var attributes=require(_0x2d5f('0x7'));module['exports']=function(_0x5c43d3,_0x3d25c1){return _0x5c43d3['define'](_0x2d5f('0x8'),attributes,{'tableName':_0x2d5f('0x9'),'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 0ef3d07..72132c6 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 _0xb6b2=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment'];(function(_0x4db55e,_0x382904){var _0x1510db=function(_0x29db68){while(--_0x29db68){_0x4db55e['push'](_0x4db55e['shift']());}};_0x1510db(++_0x382904);}(_0xb6b2,0x1e0));var _0x2b6b=function(_0x1c9671,_0x3cf964){_0x1c9671=_0x1c9671-0x0;var _0x1dd552=_0xb6b2[_0x1c9671];return _0x1dd552;};'use strict';var _=require(_0x2b6b('0x0'));var util=require(_0x2b6b('0x1'));var moment=require(_0x2b6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b6b('0x4'))(_0x2b6b('0x5'));var config=require(_0x2b6b('0x6'));var jayson=require(_0x2b6b('0x7'));var client=jayson[_0x2b6b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x796fe4,_0x9b95c1,_0x3228e2){return new BPromise(function(_0x56029c,_0xe2c8d){return client[_0x2b6b('0x9')](_0x796fe4,_0x3228e2)[_0x2b6b('0xa')](function(_0x1e7f99){logger[_0x2b6b('0xb')](_0x2b6b('0xc'),_0x9b95c1,_0x2b6b('0xd'));logger[_0x2b6b('0xe')](_0x2b6b('0xf'),_0x9b95c1,_0x2b6b('0xd'),JSON[_0x2b6b('0x10')](_0x1e7f99));if(_0x1e7f99['error']){if(_0x1e7f99['error'][_0x2b6b('0x11')]===0x1f4){logger[_0x2b6b('0x12')](_0x2b6b('0xc'),_0x9b95c1,_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);return _0xe2c8d(_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);}logger[_0x2b6b('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x1e7f99[_0x2b6b('0x12')]['message']);return _0x56029c(_0x1e7f99[_0x2b6b('0x12')][_0x2b6b('0x13')]);}else{logger[_0x2b6b('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x2b6b('0xd'));_0x56029c(_0x1e7f99['result']['message']);}})[_0x2b6b('0x14')](function(_0x92f5bb){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9b95c1,_0x92f5bb);_0xe2c8d(_0x92f5bb);});});} \ No newline at end of file +var _0xa28a=['util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xabec85,_0x87a702){var _0x26a624=function(_0x4be093){while(--_0x4be093){_0xabec85['push'](_0xabec85['shift']());}};_0x26a624(++_0x87a702);}(_0xa28a,0x130));var _0xaa28=function(_0xd8e9f5,_0x29df60){_0xd8e9f5=_0xd8e9f5-0x0;var _0x4b915e=_0xa28a[_0xd8e9f5];return _0x4b915e;};'use strict';var _=require('lodash');var util=require(_0xaa28('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa28('0x1'));var fs=require('fs');var Redis=require(_0xaa28('0x2'));var db=require(_0xaa28('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa28('0x4'));var config=require(_0xaa28('0x5'));var jayson=require(_0xaa28('0x6'));var client=jayson['client'][_0xaa28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c6fdd,_0x406265,_0x333fba){return new BPromise(function(_0x49a443,_0x483dfa){return client[_0xaa28('0x8')](_0x2c6fdd,_0x333fba)[_0xaa28('0x9')](function(_0x4eaf96){logger[_0xaa28('0xa')](_0xaa28('0xb'),_0x406265,_0xaa28('0xc'));logger['debug'](_0xaa28('0xd'),_0x406265,_0xaa28('0xc'),JSON['stringify'](_0x4eaf96));if(_0x4eaf96['error']){if(_0x4eaf96[_0xaa28('0xe')][_0xaa28('0xf')]===0x1f4){logger[_0xaa28('0xe')](_0xaa28('0xb'),_0x406265,_0x4eaf96[_0xaa28('0xe')][_0xaa28('0x10')]);return _0x483dfa(_0x4eaf96[_0xaa28('0xe')][_0xaa28('0x10')]);}logger[_0xaa28('0xe')](_0xaa28('0xb'),_0x406265,_0x4eaf96['error'][_0xaa28('0x10')]);return _0x49a443(_0x4eaf96['error'][_0xaa28('0x10')]);}else{logger[_0xaa28('0xa')](_0xaa28('0xb'),_0x406265,_0xaa28('0xc'));_0x49a443(_0x4eaf96[_0xaa28('0x11')][_0xaa28('0x10')]);}})[_0xaa28('0x12')](function(_0x328c6c){logger[_0xaa28('0xe')](_0xaa28('0xb'),_0x406265,_0x328c6c);_0x483dfa(_0x328c6c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4c0f1dc..b4c02d2 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 _0xbc31=['get','/:id','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index'];(function(_0x4069f5,_0x58dfe4){var _0x3f2d81=function(_0x4b6aba){while(--_0x4b6aba){_0x4069f5['push'](_0x4069f5['shift']());}};_0x3f2d81(++_0x58dfe4);}(_0xbc31,0xed));var _0x1bc3=function(_0x1cdc3c,_0x5bea4a){_0x1cdc3c=_0x1cdc3c-0x0;var _0x2fcda8=_0xbc31[_0x1cdc3c];return _0x2fcda8;};'use strict';var multer=require(_0x1bc3('0x0'));var util=require(_0x1bc3('0x1'));var path=require(_0x1bc3('0x2'));var timeout=require('connect-timeout');var express=require(_0x1bc3('0x3'));var router=express[_0x1bc3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc3('0x5'));var interaction=require(_0x1bc3('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc3('0x7'));router['get']('/',auth[_0x1bc3('0x8')](),controller[_0x1bc3('0x9')]);router[_0x1bc3('0xa')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller['show']);router[_0x1bc3('0xa')]('/:id/download',auth[_0x1bc3('0x8')](),controller[_0x1bc3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1bc3('0xd')]);router[_0x1bc3('0xe')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller[_0x1bc3('0xf')]);router[_0x1bc3('0x10')](_0x1bc3('0xb'),auth[_0x1bc3('0x8')](),controller[_0x1bc3('0x11')]);module[_0x1bc3('0x12')]=router; \ No newline at end of file +var _0x5e3b=['download','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','index','/:id','isAuthenticated','show','get','/:id/download'];(function(_0x90aedd,_0x58d687){var _0x3a574f=function(_0x4cdd0e){while(--_0x4cdd0e){_0x90aedd['push'](_0x90aedd['shift']());}};_0x3a574f(++_0x58d687);}(_0x5e3b,0xae));var _0xb5e3=function(_0x48bc12,_0x556fdd){_0x48bc12=_0x48bc12-0x0;var _0x453254=_0x5e3b[_0x48bc12];return _0x453254;};'use strict';var multer=require(_0xb5e3('0x0'));var util=require(_0xb5e3('0x1'));var path=require(_0xb5e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xb5e3('0x3'));var router=express[_0xb5e3('0x4')]();var fs_extra=require(_0xb5e3('0x5'));var auth=require(_0xb5e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb5e3('0x7'));var controller=require(_0xb5e3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb5e3('0x9')]);router['get'](_0xb5e3('0xa'),auth[_0xb5e3('0xb')](),controller[_0xb5e3('0xc')]);router[_0xb5e3('0xd')](_0xb5e3('0xe'),auth[_0xb5e3('0xb')](),controller[_0xb5e3('0xf')]);router['post']('/',auth[_0xb5e3('0xb')](),controller[_0xb5e3('0x10')]);router[_0xb5e3('0x11')](_0xb5e3('0xa'),auth[_0xb5e3('0xb')](),controller[_0xb5e3('0x12')]);router[_0xb5e3('0x13')](_0xb5e3('0xa'),auth['isAuthenticated'](),controller[_0xb5e3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 358fd73..f4edbe6 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 _0xcb5d=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0xa2e45a,_0x4df624){var _0x181eb2=function(_0x40c466){while(--_0x40c466){_0xa2e45a['push'](_0xa2e45a['shift']());}};_0x181eb2(++_0x4df624);}(_0xcb5d,0x79));var _0xdcb5=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xcb5d[_0x3b150c];return _0x5cd414;};'use strict';var Sequelize=require(_0xdcb5('0x0'));module[_0xdcb5('0x1')]={'field':{'type':Sequelize[_0xdcb5('0x2')]},'alias':{'type':Sequelize[_0xdcb5('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdcb5('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xdcb5('0x3')]},'custom':{'type':Sequelize[_0xdcb5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8ca2=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x3de873,_0x174b5f){var _0x380b8c=function(_0x313dea){while(--_0x313dea){_0x3de873['push'](_0x3de873['shift']());}};_0x380b8c(++_0x174b5f);}(_0x8ca2,0x10c));var _0x28ca=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x8ca2[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x28ca('0x0'));module[_0x28ca('0x1')]={'field':{'type':Sequelize[_0x28ca('0x2')]},'alias':{'type':Sequelize[_0x28ca('0x3')]},'function':{'type':Sequelize[_0x28ca('0x3')]},'format':{'type':Sequelize[_0x28ca('0x3')]},'groupBy':{'type':Sequelize[_0x28ca('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x28ca('0x3')]},'custom':{'type':Sequelize[_0x28ca('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index f29791e..e7f3902 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 _0xc880=['merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where'];(function(_0x32229f,_0x1edd37){var _0x149363=function(_0x59b347){while(--_0x59b347){_0x32229f['push'](_0x32229f['shift']());}};_0x149363(++_0x1edd37);}(_0xc880,0x66));var _0x0c88=function(_0x140f42,_0x4c71f6){_0x140f42=_0x140f42-0x0;var _0x1f92f6=_0xc880[_0x140f42];return _0x1f92f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c88('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c88('0x1'));var rp=require('request-promise');var moment=require(_0x0c88('0x2'));var BPromise=require(_0x0c88('0x3'));var Mustache=require('mustache');var util=require(_0x0c88('0x4'));var path=require(_0x0c88('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c88('0x6'));var fs=require('fs');var fs_extra=require(_0x0c88('0x7'));var _=require(_0x0c88('0x8'));var squel=require(_0x0c88('0x9'));var crypto=require(_0x0c88('0xa'));var jsforce=require(_0x0c88('0xb'));var deskjs=require(_0x0c88('0xc'));var toCsv=require(_0x0c88('0xd'));var querystring=require(_0x0c88('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c88('0xf'));var authService=require(_0x0c88('0x10'));var qs=require(_0x0c88('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c88('0x12'));var logger=require('../../config/logger')(_0x0c88('0x13'));var utils=require(_0x0c88('0x14'));var config=require(_0x0c88('0x15'));var licenseUtil=require(_0x0c88('0x16'));var db=require(_0x0c88('0x17'))['db'];function respondWithStatusCode(_0x6ffb77,_0x2cfa5c){_0x2cfa5c=_0x2cfa5c||0xcc;return function(_0x269a87){if(_0x269a87){return _0x6ffb77['sendStatus'](_0x2cfa5c);}return _0x6ffb77[_0x0c88('0x18')](_0x2cfa5c)[_0x0c88('0x19')]();};}function respondWithResult(_0x35f022,_0x1645ff){_0x1645ff=_0x1645ff||0xc8;return function(_0x3635d7){if(_0x3635d7){return _0x35f022[_0x0c88('0x18')](_0x1645ff)['json'](_0x3635d7);}};}function respondWithFilteredResult(_0x15e9f0,_0x5d3139){return function(_0x2610d8){if(_0x2610d8){var _0x43253c=typeof _0x5d3139['offset']===_0x0c88('0x1a')&&typeof _0x5d3139[_0x0c88('0x1b')]===_0x0c88('0x1a');var _0x1171ed=_0x2610d8['count'];var _0x1b1342=_0x43253c?0x0:_0x5d3139[_0x0c88('0x1c')];var _0x54e095=_0x43253c?_0x2610d8[_0x0c88('0x1d')]:_0x5d3139[_0x0c88('0x1c')]+_0x5d3139['limit'];var _0x4a1366;if(_0x54e095>=_0x1171ed){_0x54e095=_0x1171ed;_0x4a1366=0xc8;}else{_0x4a1366=0xce;}_0x15e9f0[_0x0c88('0x18')](_0x4a1366);return _0x15e9f0['set'](_0x0c88('0x1e'),_0x1b1342+'-'+_0x54e095+'/'+_0x1171ed)[_0x0c88('0x1f')](_0x2610d8);}return null;};}function patchUpdates(_0x42eaa3){return function(_0x507b62){try{jsonpatch[_0x0c88('0x20')](_0x507b62,_0x42eaa3,!![]);}catch(_0x2eea2d){return BPromise[_0x0c88('0x21')](_0x2eea2d);}return _0x507b62[_0x0c88('0x22')]();};}function saveUpdates(_0x19d1a9,_0x5e5e1f){return function(_0x23e648){if(_0x23e648){return _0x23e648[_0x0c88('0x23')](_0x19d1a9)[_0x0c88('0x24')](function(_0x4ffbaf){return _0x4ffbaf;});}return null;};}function removeEntity(_0x5bdc58,_0x274a33){return function(_0x275082){if(_0x275082){return _0x275082['destroy']()[_0x0c88('0x24')](function(){_0x5bdc58[_0x0c88('0x18')](0xcc)[_0x0c88('0x19')]();});}};}function handleEntityNotFound(_0x100f7e,_0xabf113){return function(_0x5b52a4){if(!_0x5b52a4){_0x100f7e[_0x0c88('0x25')](0x194);}return _0x5b52a4;};}function handleError(_0x5e2094,_0x181717){_0x181717=_0x181717||0x1f4;return function(_0x2f3d7d){logger[_0x0c88('0x26')](_0x2f3d7d[_0x0c88('0x27')]);if(_0x2f3d7d[_0x0c88('0x28')]){delete _0x2f3d7d['name'];}_0x5e2094[_0x0c88('0x18')](_0x181717)[_0x0c88('0x29')](_0x2f3d7d);};}exports[_0x0c88('0x2a')]=function(_0x2fab31,_0x103f60){var _0x3e5415={},_0x4634c3={},_0x107dca={'count':0x0,'rows':[]};var _0x520dc=_[_0x0c88('0x2b')](db[_0x0c88('0x2c')][_0x0c88('0x2d')],function(_0x4022af){return{'name':_0x4022af[_0x0c88('0x2e')],'type':_0x4022af[_0x0c88('0x2f')][_0x0c88('0x30')]};});_0x4634c3[_0x0c88('0x31')]=_[_0x0c88('0x2b')](_0x520dc,_0x0c88('0x28'));_0x4634c3[_0x0c88('0x32')]=_[_0x0c88('0x33')](_0x2fab31[_0x0c88('0x32')]);_0x4634c3[_0x0c88('0x34')]=_[_0x0c88('0x35')](_0x4634c3[_0x0c88('0x31')],_0x4634c3['query']);_0x3e5415[_0x0c88('0x36')]=_[_0x0c88('0x35')](_0x4634c3['model'],qs[_0x0c88('0x37')](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x37')]));_0x3e5415['attributes']=_0x3e5415[_0x0c88('0x36')][_0x0c88('0x38')]?_0x3e5415[_0x0c88('0x36')]:_0x4634c3[_0x0c88('0x31')];if(!_0x2fab31[_0x0c88('0x32')]['hasOwnProperty']('nolimit')){_0x3e5415[_0x0c88('0x1b')]=qs['limit'](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x1b')]);_0x3e5415[_0x0c88('0x1c')]=qs['offset'](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x1c')]);}_0x3e5415[_0x0c88('0x39')]=qs[_0x0c88('0x3a')](_0x2fab31[_0x0c88('0x32')][_0x0c88('0x3a')]);_0x3e5415['where']=qs[_0x0c88('0x34')](_[_0x0c88('0x3b')](_0x2fab31[_0x0c88('0x32')],_0x4634c3['filters']),_0x520dc);if(_0x2fab31[_0x0c88('0x32')][_0x0c88('0x3c')]){_0x3e5415[_0x0c88('0x3d')]=_[_0x0c88('0x3e')](_0x3e5415['where'],{'$or':_['map'](_0x520dc,function(_0x19dacb){if(_0x19dacb[_0x0c88('0x2f')]!=='VIRTUAL'){var _0x151a48={};_0x151a48[_0x19dacb[_0x0c88('0x28')]]={'$like':'%'+_0x2fab31[_0x0c88('0x32')]['filter']+'%'};return _0x151a48;}})});}_0x3e5415=_['merge']({},_0x3e5415,_0x2fab31[_0x0c88('0x3f')]);var _0x4cfb22={'where':_0x3e5415[_0x0c88('0x3d')]};return db[_0x0c88('0x2c')][_0x0c88('0x1d')](_0x4cfb22)[_0x0c88('0x24')](function(_0x15f195){_0x107dca['count']=_0x15f195;if(_0x2fab31[_0x0c88('0x32')][_0x0c88('0x40')]){_0x3e5415['include']=[{'all':!![]}];}return db[_0x0c88('0x2c')][_0x0c88('0x41')](_0x3e5415);})['then'](function(_0x171275){_0x107dca[_0x0c88('0x42')]=_0x171275;return _0x107dca;})[_0x0c88('0x24')](respondWithFilteredResult(_0x103f60,_0x3e5415))[_0x0c88('0x43')](handleError(_0x103f60,null));};exports['show']=function(_0xda4cab,_0x2cb394){var _0x9e5b83={'raw':![],'where':{'id':_0xda4cab[_0x0c88('0x44')]['id']}},_0x2a0c0f={};_0x2a0c0f[_0x0c88('0x31')]=_[_0x0c88('0x33')](db[_0x0c88('0x2c')][_0x0c88('0x2d')]);_0x2a0c0f['query']=_[_0x0c88('0x33')](_0xda4cab[_0x0c88('0x32')]);_0x2a0c0f[_0x0c88('0x34')]=_[_0x0c88('0x35')](_0x2a0c0f[_0x0c88('0x31')],_0x2a0c0f[_0x0c88('0x32')]);_0x9e5b83[_0x0c88('0x36')]=_[_0x0c88('0x35')](_0x2a0c0f[_0x0c88('0x31')],qs[_0x0c88('0x37')](_0xda4cab[_0x0c88('0x32')][_0x0c88('0x37')]));_0x9e5b83['attributes']=_0x9e5b83[_0x0c88('0x36')][_0x0c88('0x38')]?_0x9e5b83[_0x0c88('0x36')]:_0x2a0c0f['model'];if(_0xda4cab[_0x0c88('0x32')][_0x0c88('0x40')]){_0x9e5b83[_0x0c88('0x45')]=[{'all':!![]}];}_0x9e5b83=_[_0x0c88('0x3e')]({},_0x9e5b83,_0xda4cab[_0x0c88('0x3f')]);return db[_0x0c88('0x2c')][_0x0c88('0x46')](_0x9e5b83)[_0x0c88('0x24')](handleEntityNotFound(_0x2cb394,null))['then'](respondWithResult(_0x2cb394,null))[_0x0c88('0x43')](handleError(_0x2cb394,null));};exports[_0x0c88('0x47')]=function(_0x55ce51,_0x415f7b){return db[_0x0c88('0x2c')][_0x0c88('0x47')](_0x55ce51[_0x0c88('0x48')],{})[_0x0c88('0x24')](respondWithResult(_0x415f7b,0xc9))['catch'](handleError(_0x415f7b,null));};exports[_0x0c88('0x49')]=function(_0x56c85b,_0x49704e){return db[_0x0c88('0x2c')][_0x0c88('0x49')](_0x56c85b['body'],{'raw':![],'individualHooks':!![]})[_0x0c88('0x24')](respondWithResult(_0x49704e,0xc9))['catch'](handleError(_0x49704e,null));};exports['update']=function(_0x2c3364,_0x48a8ff){if(_0x2c3364[_0x0c88('0x48')]['id']){delete _0x2c3364[_0x0c88('0x48')]['id'];}return db['AnalyticFieldReport'][_0x0c88('0x46')]({'where':{'id':_0x2c3364['params']['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x48a8ff,null))['then'](saveUpdates(_0x2c3364[_0x0c88('0x48')],null))['then'](respondWithResult(_0x48a8ff,null))['catch'](handleError(_0x48a8ff,null));};exports[_0x0c88('0x4a')]=function(_0x498e8e,_0x1f3602){return db[_0x0c88('0x2c')]['find']({'where':{'id':_0x498e8e['params']['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x1f3602,null))[_0x0c88('0x24')](removeEntity(_0x1f3602,null))[_0x0c88('0x43')](handleError(_0x1f3602,null));};exports[_0x0c88('0x4b')]=function(_0x594048,_0x2fcd31){return db[_0x0c88('0x2c')]['destroy']({'where':{'id':_0x594048['query'][_0x0c88('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2fcd31,0xcc))[_0x0c88('0x43')](handleError(_0x2fcd31,null));};exports[_0x0c88('0x4d')]=function(_0x503000,_0x3da207,_0x37b478){return db[_0x0c88('0x4e')][_0x0c88('0x4f')]({'where':{'id':_0x503000[_0x0c88('0x44')]['id']}})[_0x0c88('0x24')](handleEntityNotFound(_0x3da207,null))['then'](function(_0x3ac760){if(_0x3ac760){return db[_0x0c88('0x50')]['transaction'](function(_0x5c8605){return db[_0x0c88('0x2c')]['destroy']({'where':{'CustomReportId':_0x503000['params']['id']},'transaction':_0x5c8605})[_0x0c88('0x24')](function(_0x32258d){var _0x35c97f=_[_0x0c88('0x2b')](_0x503000[_0x0c88('0x48')],function(_0x3fbd3b){delete _0x3fbd3b['id'];_0x3fbd3b[_0x0c88('0x51')]=_0x503000[_0x0c88('0x44')]['id'];return _0x3fbd3b;});return db[_0x0c88('0x2c')][_0x0c88('0x49')](_0x35c97f,{'transaction':_0x5c8605});});})['then'](function(){return db['AnalyticFieldReport'][_0x0c88('0x41')]({'where':{'CustomReportId':_0x503000[_0x0c88('0x44')]['id']}});});}})['then'](respondWithResult(_0x3da207,null))[_0x0c88('0x43')](handleError(_0x3da207,null));}; \ No newline at end of file +var _0xf489=['addFields','AnalyticCustomReport','findOne','params','sequelize','CustomReportId','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','length','options','find','body','ids'];(function(_0x15b962,_0x4bd809){var _0xe4676b=function(_0x3b7e44){while(--_0x3b7e44){_0x15b962['push'](_0x15b962['shift']());}};_0xe4676b(++_0x4bd809);}(_0xf489,0x17e));var _0x9f48=function(_0xadf978,_0x1835dc){_0xadf978=_0xadf978-0x0;var _0x56bb0d=_0xf489[_0xadf978];return _0x56bb0d;};'use strict';var emlformat=require(_0x9f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f48('0x1'));var jsonpatch=require(_0x9f48('0x2'));var rp=require(_0x9f48('0x3'));var moment=require('moment');var BPromise=require(_0x9f48('0x4'));var Mustache=require(_0x9f48('0x5'));var util=require(_0x9f48('0x6'));var path=require(_0x9f48('0x7'));var sox=require(_0x9f48('0x8'));var csv=require(_0x9f48('0x9'));var ejs=require(_0x9f48('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f48('0xb'));var squel=require(_0x9f48('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f48('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9f48('0xe'));var Redis=require(_0x9f48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9f48('0x10'));var config=require(_0x9f48('0x11'));var licenseUtil=require(_0x9f48('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a6b41,_0x2c2f21){_0x2c2f21=_0x2c2f21||0xcc;return function(_0x21739a){if(_0x21739a){return _0x2a6b41[_0x9f48('0x13')](_0x2c2f21);}return _0x2a6b41[_0x9f48('0x14')](_0x2c2f21)[_0x9f48('0x15')]();};}function respondWithResult(_0x502308,_0x1ac4a0){_0x1ac4a0=_0x1ac4a0||0xc8;return function(_0x2492a2){if(_0x2492a2){return _0x502308[_0x9f48('0x14')](_0x1ac4a0)[_0x9f48('0x16')](_0x2492a2);}};}function respondWithFilteredResult(_0x17c1f2,_0x2947a0){return function(_0x36c483){if(_0x36c483){var _0x118777=typeof _0x2947a0[_0x9f48('0x17')]==='undefined'&&typeof _0x2947a0['limit']===_0x9f48('0x18');var _0x4a0c43=_0x36c483[_0x9f48('0x19')];var _0x49a00e=_0x118777?0x0:_0x2947a0[_0x9f48('0x17')];var _0x3d350c=_0x118777?_0x36c483[_0x9f48('0x19')]:_0x2947a0[_0x9f48('0x17')]+_0x2947a0[_0x9f48('0x1a')];var _0x5e34eb;if(_0x3d350c>=_0x4a0c43){_0x3d350c=_0x4a0c43;_0x5e34eb=0xc8;}else{_0x5e34eb=0xce;}_0x17c1f2[_0x9f48('0x14')](_0x5e34eb);return _0x17c1f2['set']('Content-Range',_0x49a00e+'-'+_0x3d350c+'/'+_0x4a0c43)[_0x9f48('0x16')](_0x36c483);}return null;};}function patchUpdates(_0x83d211){return function(_0xae480e){try{jsonpatch['apply'](_0xae480e,_0x83d211,!![]);}catch(_0x1bf920){return BPromise[_0x9f48('0x1b')](_0x1bf920);}return _0xae480e[_0x9f48('0x1c')]();};}function saveUpdates(_0x522b18,_0x454ae6){return function(_0x32af5b){if(_0x32af5b){return _0x32af5b[_0x9f48('0x1d')](_0x522b18)[_0x9f48('0x1e')](function(_0x5bf0c5){return _0x5bf0c5;});}return null;};}function removeEntity(_0x57116d,_0x2be76c){return function(_0x3c64de){if(_0x3c64de){return _0x3c64de[_0x9f48('0x1f')]()[_0x9f48('0x1e')](function(){_0x57116d['status'](0xcc)[_0x9f48('0x15')]();});}};}function handleEntityNotFound(_0x25862c,_0x453aa0){return function(_0xcd46d){if(!_0xcd46d){_0x25862c[_0x9f48('0x13')](0x194);}return _0xcd46d;};}function handleError(_0x5ca6b3,_0x5a803d){_0x5a803d=_0x5a803d||0x1f4;return function(_0x93f55f){logger[_0x9f48('0x20')](_0x93f55f[_0x9f48('0x21')]);if(_0x93f55f['name']){delete _0x93f55f[_0x9f48('0x22')];}_0x5ca6b3['status'](_0x5a803d)[_0x9f48('0x23')](_0x93f55f);};}exports['index']=function(_0x3b8fc9,_0x3977f5){var _0x1e41c9={},_0x811843={},_0xc707d8={'count':0x0,'rows':[]};var _0x5d211c=_[_0x9f48('0x24')](db[_0x9f48('0x25')][_0x9f48('0x26')],function(_0x466da2){return{'name':_0x466da2[_0x9f48('0x27')],'type':_0x466da2['type'][_0x9f48('0x28')]};});_0x811843[_0x9f48('0x29')]=_[_0x9f48('0x24')](_0x5d211c,_0x9f48('0x22'));_0x811843[_0x9f48('0x2a')]=_[_0x9f48('0x2b')](_0x3b8fc9[_0x9f48('0x2a')]);_0x811843['filters']=_[_0x9f48('0x2c')](_0x811843[_0x9f48('0x29')],_0x811843['query']);_0x1e41c9['attributes']=_[_0x9f48('0x2c')](_0x811843['model'],qs[_0x9f48('0x2d')](_0x3b8fc9[_0x9f48('0x2a')][_0x9f48('0x2d')]));_0x1e41c9['attributes']=_0x1e41c9['attributes']['length']?_0x1e41c9[_0x9f48('0x2e')]:_0x811843[_0x9f48('0x29')];if(!_0x3b8fc9[_0x9f48('0x2a')][_0x9f48('0x2f')]('nolimit')){_0x1e41c9[_0x9f48('0x1a')]=qs[_0x9f48('0x1a')](_0x3b8fc9['query']['limit']);_0x1e41c9['offset']=qs[_0x9f48('0x17')](_0x3b8fc9['query'][_0x9f48('0x17')]);}_0x1e41c9[_0x9f48('0x30')]=qs['sort'](_0x3b8fc9[_0x9f48('0x2a')][_0x9f48('0x31')]);_0x1e41c9[_0x9f48('0x32')]=qs[_0x9f48('0x33')](_[_0x9f48('0x34')](_0x3b8fc9['query'],_0x811843[_0x9f48('0x33')]),_0x5d211c);if(_0x3b8fc9[_0x9f48('0x2a')]['filter']){_0x1e41c9[_0x9f48('0x32')]=_[_0x9f48('0x35')](_0x1e41c9[_0x9f48('0x32')],{'$or':_[_0x9f48('0x24')](_0x5d211c,function(_0x58686d){if(_0x58686d[_0x9f48('0x36')]!==_0x9f48('0x37')){var _0x4b2b37={};_0x4b2b37[_0x58686d[_0x9f48('0x22')]]={'$like':'%'+_0x3b8fc9['query'][_0x9f48('0x38')]+'%'};return _0x4b2b37;}})});}_0x1e41c9=_['merge']({},_0x1e41c9,_0x3b8fc9['options']);var _0xfa5f5f={'where':_0x1e41c9[_0x9f48('0x32')]};return db[_0x9f48('0x25')][_0x9f48('0x19')](_0xfa5f5f)[_0x9f48('0x1e')](function(_0x54cd12){_0xc707d8[_0x9f48('0x19')]=_0x54cd12;if(_0x3b8fc9[_0x9f48('0x2a')][_0x9f48('0x39')]){_0x1e41c9[_0x9f48('0x3a')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9f48('0x3b')](_0x1e41c9);})[_0x9f48('0x1e')](function(_0x1fa5e2){_0xc707d8[_0x9f48('0x3c')]=_0x1fa5e2;return _0xc707d8;})[_0x9f48('0x1e')](respondWithFilteredResult(_0x3977f5,_0x1e41c9))[_0x9f48('0x3d')](handleError(_0x3977f5,null));};exports[_0x9f48('0x3e')]=function(_0x3737b0,_0x4a6026){var _0x149fb3={'raw':![],'where':{'id':_0x3737b0['params']['id']}},_0x11a575={};_0x11a575[_0x9f48('0x29')]=_['keys'](db['AnalyticFieldReport'][_0x9f48('0x26')]);_0x11a575[_0x9f48('0x2a')]=_[_0x9f48('0x2b')](_0x3737b0[_0x9f48('0x2a')]);_0x11a575['filters']=_[_0x9f48('0x2c')](_0x11a575['model'],_0x11a575[_0x9f48('0x2a')]);_0x149fb3[_0x9f48('0x2e')]=_[_0x9f48('0x2c')](_0x11a575[_0x9f48('0x29')],qs[_0x9f48('0x2d')](_0x3737b0[_0x9f48('0x2a')][_0x9f48('0x2d')]));_0x149fb3[_0x9f48('0x2e')]=_0x149fb3[_0x9f48('0x2e')][_0x9f48('0x3f')]?_0x149fb3[_0x9f48('0x2e')]:_0x11a575[_0x9f48('0x29')];if(_0x3737b0[_0x9f48('0x2a')]['includeAll']){_0x149fb3['include']=[{'all':!![]}];}_0x149fb3=_[_0x9f48('0x35')]({},_0x149fb3,_0x3737b0[_0x9f48('0x40')]);return db[_0x9f48('0x25')][_0x9f48('0x41')](_0x149fb3)[_0x9f48('0x1e')](handleEntityNotFound(_0x4a6026,null))['then'](respondWithResult(_0x4a6026,null))[_0x9f48('0x3d')](handleError(_0x4a6026,null));};exports['create']=function(_0x16d757,_0xb3cbb3){return db[_0x9f48('0x25')]['create'](_0x16d757[_0x9f48('0x42')],{})[_0x9f48('0x1e')](respondWithResult(_0xb3cbb3,0xc9))['catch'](handleError(_0xb3cbb3,null));};exports['bulkCreate']=function(_0x550d5e,_0x791d7c){return db[_0x9f48('0x25')]['bulkCreate'](_0x550d5e[_0x9f48('0x42')],{'raw':![],'individualHooks':!![]})[_0x9f48('0x1e')](respondWithResult(_0x791d7c,0xc9))[_0x9f48('0x3d')](handleError(_0x791d7c,null));};exports[_0x9f48('0x1d')]=function(_0x187d9c,_0x2d4018){if(_0x187d9c[_0x9f48('0x42')]['id']){delete _0x187d9c[_0x9f48('0x42')]['id'];}return db[_0x9f48('0x25')][_0x9f48('0x41')]({'where':{'id':_0x187d9c['params']['id']}})[_0x9f48('0x1e')](handleEntityNotFound(_0x2d4018,null))[_0x9f48('0x1e')](saveUpdates(_0x187d9c['body'],null))[_0x9f48('0x1e')](respondWithResult(_0x2d4018,null))[_0x9f48('0x3d')](handleError(_0x2d4018,null));};exports[_0x9f48('0x1f')]=function(_0x10d31d,_0x571c87){return db[_0x9f48('0x25')][_0x9f48('0x41')]({'where':{'id':_0x10d31d['params']['id']}})[_0x9f48('0x1e')](handleEntityNotFound(_0x571c87,null))[_0x9f48('0x1e')](removeEntity(_0x571c87,null))[_0x9f48('0x3d')](handleError(_0x571c87,null));};exports['bulkDestroy']=function(_0x566777,_0x31a802){return db[_0x9f48('0x25')][_0x9f48('0x1f')]({'where':{'id':_0x566777[_0x9f48('0x2a')][_0x9f48('0x43')]||[]},'raw':![],'individualHooks':!![]})[_0x9f48('0x1e')](respondWithResult(_0x31a802,0xcc))[_0x9f48('0x3d')](handleError(_0x31a802,null));};exports[_0x9f48('0x44')]=function(_0x2c79b7,_0x39c17a,_0x27f4a5){return db[_0x9f48('0x45')][_0x9f48('0x46')]({'where':{'id':_0x2c79b7[_0x9f48('0x47')]['id']}})[_0x9f48('0x1e')](handleEntityNotFound(_0x39c17a,null))[_0x9f48('0x1e')](function(_0x5253cd){if(_0x5253cd){return db[_0x9f48('0x48')]['transaction'](function(_0x77fab8){return db[_0x9f48('0x25')][_0x9f48('0x1f')]({'where':{'CustomReportId':_0x2c79b7[_0x9f48('0x47')]['id']},'transaction':_0x77fab8})[_0x9f48('0x1e')](function(_0x267197){var _0x5a8c99=_['map'](_0x2c79b7['body'],function(_0x2b3cfb){delete _0x2b3cfb['id'];_0x2b3cfb[_0x9f48('0x49')]=_0x2c79b7[_0x9f48('0x47')]['id'];return _0x2b3cfb;});return db[_0x9f48('0x25')][_0x9f48('0x4a')](_0x5a8c99,{'transaction':_0x77fab8});});})['then'](function(){return db[_0x9f48('0x25')][_0x9f48('0x3b')]({'where':{'CustomReportId':_0x2c79b7[_0x9f48('0x47')]['id']}});});}})[_0x9f48('0x1e')](respondWithResult(_0x39c17a,null))[_0x9f48('0x3d')](handleError(_0x39c17a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index fa608a0..ac6b132 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 _0xd68e=['define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports'];(function(_0x46c1e1,_0x4067bd){var _0x21ea17=function(_0x36ca0b){while(--_0x36ca0b){_0x46c1e1['push'](_0x46c1e1['shift']());}};_0x21ea17(++_0x4067bd);}(_0xd68e,0x9d));var _0xed68=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xd68e[_0x5d8631];return _0x34c15e;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var logger=require(_0xed68('0x2'))(_0xed68('0x3'));var moment=require(_0xed68('0x4'));var BPromise=require(_0xed68('0x5'));var rp=require(_0xed68('0x6'));var fs=require('fs');var path=require(_0xed68('0x7'));var rimraf=require('rimraf');var config=require(_0xed68('0x8'));var attributes=require(_0xed68('0x9'));module[_0xed68('0xa')]=function(_0x3a1708,_0x3b979d){return _0x3a1708[_0xed68('0xb')](_0xed68('0xc'),attributes,{'tableName':_0xed68('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc81=['define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./analyticFieldReport.attributes','exports'];(function(_0x1f4e23,_0x3115f8){var _0x402870=function(_0xfee0d8){while(--_0xfee0d8){_0x1f4e23['push'](_0x1f4e23['shift']());}};_0x402870(++_0x3115f8);}(_0xcc81,0x16b));var _0x1cc8=function(_0x17df16,_0x84c577){_0x17df16=_0x17df16-0x0;var _0x1ba549=_0xcc81[_0x17df16];return _0x1ba549;};'use strict';var _=require('lodash');var util=require(_0x1cc8('0x0'));var logger=require(_0x1cc8('0x1'))(_0x1cc8('0x2'));var moment=require(_0x1cc8('0x3'));var BPromise=require(_0x1cc8('0x4'));var rp=require(_0x1cc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cc8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cc8('0x7'));module[_0x1cc8('0x8')]=function(_0x4b20c1,_0x21e5fa){return _0x4b20c1[_0x1cc8('0x9')](_0x1cc8('0xa'),attributes,{'tableName':_0x1cc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 876d946..9659f11 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 _0xa9dd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x28a52e,_0x30f3eb){var _0x13c1f7=function(_0x36f588){while(--_0x36f588){_0x28a52e['push'](_0x28a52e['shift']());}};_0x13c1f7(++_0x30f3eb);}(_0xa9dd,0x14c));var _0xda9d=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xa9dd[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require(_0xda9d('0x0'));var util=require(_0xda9d('0x1'));var moment=require(_0xda9d('0x2'));var BPromise=require('bluebird');var rs=require(_0xda9d('0x3'));var fs=require('fs');var Redis=require(_0xda9d('0x4'));var db=require(_0xda9d('0x5'))['db'];var utils=require(_0xda9d('0x6'));var logger=require(_0xda9d('0x7'))(_0xda9d('0x8'));var config=require('../../config/environment');var jayson=require(_0xda9d('0x9'));var client=jayson['client'][_0xda9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b546a,_0x5e8b2a,_0x3cee91){return new BPromise(function(_0x2a2502,_0x341714){return client[_0xda9d('0xb')](_0x2b546a,_0x3cee91)[_0xda9d('0xc')](function(_0x3036f2){logger[_0xda9d('0xd')](_0xda9d('0xe'),_0x5e8b2a,_0xda9d('0xf'));logger[_0xda9d('0x10')](_0xda9d('0x11'),_0x5e8b2a,_0xda9d('0xf'),JSON[_0xda9d('0x12')](_0x3036f2));if(_0x3036f2[_0xda9d('0x13')]){if(_0x3036f2['error'][_0xda9d('0x14')]===0x1f4){logger[_0xda9d('0x13')](_0xda9d('0xe'),_0x5e8b2a,_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);return _0x341714(_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);}logger['error'](_0xda9d('0xe'),_0x5e8b2a,_0x3036f2[_0xda9d('0x13')]['message']);return _0x2a2502(_0x3036f2[_0xda9d('0x13')][_0xda9d('0x15')]);}else{logger[_0xda9d('0xd')](_0xda9d('0xe'),_0x5e8b2a,_0xda9d('0xf'));_0x2a2502(_0x3036f2[_0xda9d('0x16')]['message']);}})[_0xda9d('0x17')](function(_0xd1b0ea){logger[_0xda9d('0x13')](_0xda9d('0xe'),_0x5e8b2a,_0xd1b0ea);_0x341714(_0xd1b0ea);});});} \ No newline at end of file +var _0x42e5=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x42e5,0xa9));var _0x542e=function(_0x70a4e2,_0x1b833a){_0x70a4e2=_0x70a4e2-0x0;var _0x4d1d1e=_0x42e5[_0x70a4e2];return _0x4d1d1e;};'use strict';var _=require(_0x542e('0x0'));var util=require(_0x542e('0x1'));var moment=require(_0x542e('0x2'));var BPromise=require(_0x542e('0x3'));var rs=require(_0x542e('0x4'));var fs=require('fs');var Redis=require(_0x542e('0x5'));var db=require(_0x542e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x542e('0x7'))(_0x542e('0x8'));var config=require(_0x542e('0x9'));var jayson=require(_0x542e('0xa'));var client=jayson[_0x542e('0xb')][_0x542e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x517227,_0x4f334d,_0x43d194){return new BPromise(function(_0x360481,_0x71c894){return client[_0x542e('0xd')](_0x517227,_0x43d194)[_0x542e('0xe')](function(_0x29d13e){logger[_0x542e('0xf')](_0x542e('0x10'),_0x4f334d,'request\x20sent');logger[_0x542e('0x11')](_0x542e('0x12'),_0x4f334d,_0x542e('0x13'),JSON[_0x542e('0x14')](_0x29d13e));if(_0x29d13e['error']){if(_0x29d13e[_0x542e('0x15')]['code']===0x1f4){logger[_0x542e('0x15')](_0x542e('0x10'),_0x4f334d,_0x29d13e[_0x542e('0x15')][_0x542e('0x16')]);return _0x71c894(_0x29d13e['error'][_0x542e('0x16')]);}logger['error'](_0x542e('0x10'),_0x4f334d,_0x29d13e[_0x542e('0x15')][_0x542e('0x16')]);return _0x360481(_0x29d13e[_0x542e('0x15')][_0x542e('0x16')]);}else{logger[_0x542e('0xf')](_0x542e('0x10'),_0x4f334d,_0x542e('0x13'));_0x360481(_0x29d13e[_0x542e('0x17')][_0x542e('0x16')]);}})[_0x542e('0x18')](function(_0x229242){logger[_0x542e('0x15')](_0x542e('0x10'),_0x4f334d,_0x229242);_0x71c894(_0x229242);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9d333e2..69a8ac5 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(_0x6ac181,_0x4249b9){var _0xdde47=function(_0xf48d8b){while(--_0xf48d8b){_0x6ac181['push'](_0x6ac181['shift']());}};_0xdde47(++_0x4249b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x2aa05a,_0x3ed849){var _0x56e0a2=function(_0x556233){while(--_0x556233){_0x2aa05a['push'](_0x2aa05a['shift']());}};_0x56e0a2(++_0x3ed849);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 bc78d8c..1d5a911 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 _0x3c1a=['STRING','name','TEXT','sequelize','exports'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x3c1a,0xda));var _0xa3c1=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x3c1a[_0x23e6bb];return _0x1e3b4c;};'use strict';var Sequelize=require(_0xa3c1('0x0'));module[_0xa3c1('0x1')]={'name':{'type':Sequelize[_0xa3c1('0x2')],'allowNull':![],'unique':_0xa3c1('0x3')},'table':{'type':Sequelize[_0xa3c1('0x2')]},'metric':{'type':Sequelize[_0xa3c1('0x4')]},'description':{'type':Sequelize[_0xa3c1('0x2')]}}; \ No newline at end of file +var _0x0427=['name','TEXT','STRING'];(function(_0x14faf6,_0x4ad659){var _0x5e34c0=function(_0x55f1e6){while(--_0x55f1e6){_0x14faf6['push'](_0x14faf6['shift']());}};_0x5e34c0(++_0x4ad659);}(_0x0427,0x137));var _0x7042=function(_0x1064b8,_0x32e8ac){_0x1064b8=_0x1064b8-0x0;var _0x4a53bd=_0x0427[_0x1064b8];return _0x4a53bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7042('0x0')],'allowNull':![],'unique':_0x7042('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7042('0x2')]},'description':{'type':Sequelize[_0x7042('0x0')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index bac8b2a..ca82f39 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 _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x27edb9,_0x48fe4b){var _0xc82084=function(_0x154b36){while(--_0x154b36){_0x27edb9['push'](_0x27edb9['shift']());}};_0xc82084(++_0x48fe4b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x5fc3[_0x7c0074];return _0x13e95b;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x183d81,_0x571915){_0x183d81=_0x183d81-0x0;var _0x14963b=_0x1cb9[_0x183d81];return _0x14963b;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index abd9a4e..436d3a3 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 _0x4cb5=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4cb5,0x8f));var _0x54cb=function(_0xd9098c,_0x154b1c){_0xd9098c=_0xd9098c-0x0;var _0x1ff6f1=_0x4cb5[_0xd9098c];return _0x1ff6f1;};'use strict';var _=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var logger=require(_0x54cb('0x2'))(_0x54cb('0x3'));var moment=require('moment');var BPromise=require(_0x54cb('0x4'));var rp=require(_0x54cb('0x5'));var fs=require('fs');var path=require(_0x54cb('0x6'));var rimraf=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var attributes=require(_0x54cb('0x9'));module[_0x54cb('0xa')]=function(_0x48aed1,_0x44f36d){return _0x48aed1[_0x54cb('0xb')]('AnalyticMetric',attributes,{'tableName':_0x54cb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd0a=['analytics_metrics','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xcc314d,_0x14c072){_0xcc314d=_0xcc314d-0x0;var _0x1e4ede=_0xbd0a[_0xcc314d];return _0x1e4ede;};'use strict';var _=require(_0xabd0('0x0'));var util=require('util');var logger=require(_0xabd0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xabd0('0x2'));var fs=require('fs');var path=require(_0xabd0('0x3'));var rimraf=require(_0xabd0('0x4'));var config=require(_0xabd0('0x5'));var attributes=require(_0xabd0('0x6'));module[_0xabd0('0x7')]=function(_0x221368,_0xb41697){return _0x221368[_0xabd0('0x8')]('AnalyticMetric',attributes,{'tableName':_0xabd0('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 f5c1296..e52c53a 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 _0xb906=['request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s'];(function(_0x1d9a25,_0x50665d){var _0x1cc281=function(_0x129ec8){while(--_0x129ec8){_0x1d9a25['push'](_0x1d9a25['shift']());}};_0x1cc281(++_0x50665d);}(_0xb906,0x182));var _0x6b90=function(_0x317e5c,_0x5213a8){_0x317e5c=_0x317e5c-0x0;var _0x3693bb=_0xb906[_0x317e5c];return _0x3693bb;};'use strict';var _=require(_0x6b90('0x0'));var util=require(_0x6b90('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b90('0x3'))['db'];var utils=require(_0x6b90('0x4'));var logger=require('../../config/logger')(_0x6b90('0x5'));var config=require('../../config/environment');var jayson=require(_0x6b90('0x6'));var client=jayson[_0x6b90('0x7')][_0x6b90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b76c,_0x1ebba4,_0x213d05){return new BPromise(function(_0x176287,_0x55467d){return client[_0x6b90('0x9')](_0x27b76c,_0x213d05)[_0x6b90('0xa')](function(_0xe37a0c){logger[_0x6b90('0xb')](_0x6b90('0xc'),_0x1ebba4,_0x6b90('0xd'));logger['debug'](_0x6b90('0xe'),_0x1ebba4,_0x6b90('0xd'),JSON[_0x6b90('0xf')](_0xe37a0c));if(_0xe37a0c['error']){if(_0xe37a0c[_0x6b90('0x10')]['code']===0x1f4){logger[_0x6b90('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1ebba4,_0xe37a0c['error'][_0x6b90('0x11')]);return _0x55467d(_0xe37a0c['error'][_0x6b90('0x11')]);}logger[_0x6b90('0x10')](_0x6b90('0xc'),_0x1ebba4,_0xe37a0c[_0x6b90('0x10')][_0x6b90('0x11')]);return _0x176287(_0xe37a0c['error'][_0x6b90('0x11')]);}else{logger[_0x6b90('0xb')](_0x6b90('0xc'),_0x1ebba4,'request\x20sent');_0x176287(_0xe37a0c['result'][_0x6b90('0x11')]);}})[_0x6b90('0x12')](function(_0x2f8e72){logger[_0x6b90('0x10')](_0x6b90('0xc'),_0x1ebba4,_0x2f8e72);_0x55467d(_0x2f8e72);});});} \ No newline at end of file +var _0x1242=['../../config/environment','request','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5503a0,_0xf122bf){var _0x4b29ca=function(_0x2a35dd){while(--_0x2a35dd){_0x5503a0['push'](_0x5503a0['shift']());}};_0x4b29ca(++_0xf122bf);}(_0x1242,0x1c6));var _0x2124=function(_0x4f3dcf,_0x5326f4){_0x4f3dcf=_0x4f3dcf-0x0;var _0x13ed0c=_0x1242[_0x4f3dcf];return _0x13ed0c;};'use strict';var _=require(_0x2124('0x0'));var util=require('util');var moment=require(_0x2124('0x1'));var BPromise=require(_0x2124('0x2'));var rs=require(_0x2124('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2124('0x4'))['db'];var utils=require(_0x2124('0x5'));var logger=require(_0x2124('0x6'))(_0x2124('0x7'));var config=require(_0x2124('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38e23f,_0x319cbf,_0x50f442){return new BPromise(function(_0x48e3a7,_0x4c16ae){return client[_0x2124('0x9')](_0x38e23f,_0x50f442)[_0x2124('0xa')](function(_0x3b3e2e){logger[_0x2124('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x319cbf,_0x2124('0xc'));logger[_0x2124('0xd')](_0x2124('0xe'),_0x319cbf,_0x2124('0xc'),JSON[_0x2124('0xf')](_0x3b3e2e));if(_0x3b3e2e[_0x2124('0x10')]){if(_0x3b3e2e['error'][_0x2124('0x11')]===0x1f4){logger[_0x2124('0x10')](_0x2124('0x12'),_0x319cbf,_0x3b3e2e['error']['message']);return _0x4c16ae(_0x3b3e2e[_0x2124('0x10')][_0x2124('0x13')]);}logger[_0x2124('0x10')](_0x2124('0x12'),_0x319cbf,_0x3b3e2e['error']['message']);return _0x48e3a7(_0x3b3e2e[_0x2124('0x10')][_0x2124('0x13')]);}else{logger[_0x2124('0xb')](_0x2124('0x12'),_0x319cbf,_0x2124('0xc'));_0x48e3a7(_0x3b3e2e['result']['message']);}})[_0x2124('0x14')](function(_0x2df3e3){logger[_0x2124('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x319cbf,_0x2df3e3);_0x4c16ae(_0x2df3e3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b1c06d4..8f4da31 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 _0x04f1=['get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','index'];(function(_0x3f6af9,_0x553094){var _0x6cc311=function(_0x11a9a4){while(--_0x11a9a4){_0x3f6af9['push'](_0x3f6af9['shift']());}};_0x6cc311(++_0x553094);}(_0x04f1,0x92));var _0x104f=function(_0x1e221a,_0x1de447){_0x1e221a=_0x1e221a-0x0;var _0x6ba1fe=_0x04f1[_0x1e221a];return _0x6ba1fe;};'use strict';var multer=require(_0x104f('0x0'));var util=require(_0x104f('0x1'));var path=require(_0x104f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x104f('0x3')]();var fs_extra=require(_0x104f('0x4'));var auth=require(_0x104f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x104f('0x6')]);router[_0x104f('0x7')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller['show']);router[_0x104f('0xa')]('/',auth[_0x104f('0x9')](),controller[_0x104f('0xb')]);router[_0x104f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x104f('0xd')]);router[_0x104f('0xe')](_0x104f('0x8'),auth[_0x104f('0x9')](),controller[_0x104f('0xf')]);module[_0x104f('0x10')]=router; \ No newline at end of file +var _0x737d=['index','/:id','show','post','put','update','delete','destroy','multer','util','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated'];(function(_0x388a71,_0x425a15){var _0x28c528=function(_0x5f3d54){while(--_0x5f3d54){_0x388a71['push'](_0x388a71['shift']());}};_0x28c528(++_0x425a15);}(_0x737d,0xbc));var _0xd737=function(_0x207f01,_0x4b3b74){_0x207f01=_0x207f01-0x0;var _0x37ff88=_0x737d[_0x207f01];return _0x37ff88;};'use strict';var multer=require(_0xd737('0x0'));var util=require(_0xd737('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd737('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xd737('0x3'));var config=require('../../config/environment');var controller=require(_0xd737('0x4'));router[_0xd737('0x5')]('/',auth[_0xd737('0x6')](),controller[_0xd737('0x7')]);router[_0xd737('0x5')](_0xd737('0x8'),auth[_0xd737('0x6')](),controller[_0xd737('0x9')]);router[_0xd737('0xa')]('/',auth[_0xd737('0x6')](),controller['create']);router[_0xd737('0xb')](_0xd737('0x8'),auth['isAuthenticated'](),controller[_0xd737('0xc')]);router[_0xd737('0xd')]('/:id',auth[_0xd737('0x6')](),controller[_0xd737('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index bd80aae..a031820 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 _0xdf01=['TEXT','sequelize'];(function(_0xe6c88a,_0x2c8464){var _0x1c09e8=function(_0x453c4a){while(--_0x453c4a){_0xe6c88a['push'](_0xe6c88a['shift']());}};_0x1c09e8(++_0x2c8464);}(_0xdf01,0xdb));var _0x1df0=function(_0xcd9d04,_0x3d87eb){_0xcd9d04=_0xcd9d04-0x0;var _0x48eeb1=_0xdf01[_0xcd9d04];return _0x48eeb1;};'use strict';var Sequelize=require(_0x1df0('0x0'));module['exports']={'tree':{'type':Sequelize[_0x1df0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xae16=['exports','sequelize'];(function(_0x51bc14,_0x3ee2c6){var _0x469aa3=function(_0x43b32d){while(--_0x43b32d){_0x51bc14['push'](_0x51bc14['shift']());}};_0x469aa3(++_0x3ee2c6);}(_0xae16,0x1c5));var _0x6ae1=function(_0x416c00,_0x24d9f2){_0x416c00=_0x416c00-0x0;var _0x221442=_0xae16[_0x416c00];return _0x221442;};'use strict';var Sequelize=require(_0x6ae1('0x0'));module[_0x6ae1('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 05ece73..8e9c1f0 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 _0x8b32=['VIRTUAL','merge','options','includeAll','include','rows','catch','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','send','index','map','AnalyticTreeReport','rawAttributes','type','key','name','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x26628d,_0x370d44){var _0x4f07e6=function(_0x5864a0){while(--_0x5864a0){_0x26628d['push'](_0x26628d['shift']());}};_0x4f07e6(++_0x370d44);}(_0x8b32,0x19c));var _0x28b3=function(_0x3d4379,_0x1d514c){_0x3d4379=_0x3d4379-0x0;var _0x31dec6=_0x8b32[_0x3d4379];return _0x31dec6;};'use strict';var emlformat=require(_0x28b3('0x0'));var rimraf=require(_0x28b3('0x1'));var zipdir=require(_0x28b3('0x2'));var jsonpatch=require(_0x28b3('0x3'));var rp=require(_0x28b3('0x4'));var moment=require(_0x28b3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x28b3('0x6'));var util=require(_0x28b3('0x7'));var path=require(_0x28b3('0x8'));var sox=require(_0x28b3('0x9'));var csv=require('to-csv');var ejs=require(_0x28b3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28b3('0xb'));var squel=require('squel');var crypto=require(_0x28b3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x28b3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x28b3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28b3('0xf'));var logger=require(_0x28b3('0x10'))(_0x28b3('0x11'));var utils=require('../../config/utils');var config=require(_0x28b3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x28b3('0x13'))['db'];function respondWithStatusCode(_0x1b8ef3,_0x492f53){_0x492f53=_0x492f53||0xcc;return function(_0x58ba9f){if(_0x58ba9f){return _0x1b8ef3[_0x28b3('0x14')](_0x492f53);}return _0x1b8ef3[_0x28b3('0x15')](_0x492f53)[_0x28b3('0x16')]();};}function respondWithResult(_0x30dd75,_0x521126){_0x521126=_0x521126||0xc8;return function(_0x2a6e37){if(_0x2a6e37){return _0x30dd75['status'](_0x521126)[_0x28b3('0x17')](_0x2a6e37);}};}function respondWithFilteredResult(_0x26c72d,_0x3fcebd){return function(_0x3cabba){if(_0x3cabba){var _0x107d81=typeof _0x3fcebd['offset']===_0x28b3('0x18')&&typeof _0x3fcebd['limit']===_0x28b3('0x18');var _0x2b1070=_0x3cabba[_0x28b3('0x19')];var _0x68c13=_0x107d81?0x0:_0x3fcebd['offset'];var _0x3fc555=_0x107d81?_0x3cabba[_0x28b3('0x19')]:_0x3fcebd[_0x28b3('0x1a')]+_0x3fcebd[_0x28b3('0x1b')];var _0x85a011;if(_0x3fc555>=_0x2b1070){_0x3fc555=_0x2b1070;_0x85a011=0xc8;}else{_0x85a011=0xce;}_0x26c72d[_0x28b3('0x15')](_0x85a011);return _0x26c72d[_0x28b3('0x1c')](_0x28b3('0x1d'),_0x68c13+'-'+_0x3fc555+'/'+_0x2b1070)[_0x28b3('0x17')](_0x3cabba);}return null;};}function patchUpdates(_0x41c051){return function(_0x46f093){try{jsonpatch[_0x28b3('0x1e')](_0x46f093,_0x41c051,!![]);}catch(_0x34fb66){return BPromise[_0x28b3('0x1f')](_0x34fb66);}return _0x46f093[_0x28b3('0x20')]();};}function saveUpdates(_0x4eff95,_0x471a1e){return function(_0x1d8ddd){if(_0x1d8ddd){return _0x1d8ddd['update'](_0x4eff95)[_0x28b3('0x21')](function(_0x5599e6){return _0x5599e6;});}return null;};}function removeEntity(_0x5819ad,_0xae0288){return function(_0xce5438){if(_0xce5438){return _0xce5438[_0x28b3('0x22')]()[_0x28b3('0x21')](function(){_0x5819ad[_0x28b3('0x15')](0xcc)[_0x28b3('0x16')]();});}};}function handleEntityNotFound(_0x21fd95,_0x41d6ad){return function(_0x397296){if(!_0x397296){_0x21fd95['sendStatus'](0x194);}return _0x397296;};}function handleError(_0xf81380,_0x2cdbf9){_0x2cdbf9=_0x2cdbf9||0x1f4;return function(_0x3f56dc){logger['error'](_0x3f56dc['stack']);if(_0x3f56dc['name']){delete _0x3f56dc['name'];}_0xf81380[_0x28b3('0x15')](_0x2cdbf9)[_0x28b3('0x23')](_0x3f56dc);};}exports[_0x28b3('0x24')]=function(_0x3cbdfc,_0x4d750e){var _0x303f73={},_0x24a986={},_0x52821f={'count':0x0,'rows':[]};var _0x2522b4=_[_0x28b3('0x25')](db[_0x28b3('0x26')][_0x28b3('0x27')],function(_0x59ec57){return{'name':_0x59ec57['fieldName'],'type':_0x59ec57[_0x28b3('0x28')][_0x28b3('0x29')]};});_0x24a986['model']=_['map'](_0x2522b4,_0x28b3('0x2a'));_0x24a986['query']=_[_0x28b3('0x2b')](_0x3cbdfc[_0x28b3('0x2c')]);_0x24a986[_0x28b3('0x2d')]=_[_0x28b3('0x2e')](_0x24a986[_0x28b3('0x2f')],_0x24a986[_0x28b3('0x2c')]);_0x303f73['attributes']=_['intersection'](_0x24a986[_0x28b3('0x2f')],qs['fields'](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x30')]));_0x303f73[_0x28b3('0x31')]=_0x303f73[_0x28b3('0x31')][_0x28b3('0x32')]?_0x303f73[_0x28b3('0x31')]:_0x24a986[_0x28b3('0x2f')];if(!_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x33')]('nolimit')){_0x303f73[_0x28b3('0x1b')]=qs[_0x28b3('0x1b')](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x1b')]);_0x303f73[_0x28b3('0x1a')]=qs[_0x28b3('0x1a')](_0x3cbdfc['query'][_0x28b3('0x1a')]);}_0x303f73[_0x28b3('0x34')]=qs[_0x28b3('0x35')](_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x35')]);_0x303f73[_0x28b3('0x36')]=qs[_0x28b3('0x2d')](_[_0x28b3('0x37')](_0x3cbdfc[_0x28b3('0x2c')],_0x24a986[_0x28b3('0x2d')]),_0x2522b4);if(_0x3cbdfc[_0x28b3('0x2c')][_0x28b3('0x38')]){_0x303f73[_0x28b3('0x36')]=_['merge'](_0x303f73[_0x28b3('0x36')],{'$or':_[_0x28b3('0x25')](_0x2522b4,function(_0x1dd468){if(_0x1dd468['type']!==_0x28b3('0x39')){var _0x22bf22={};_0x22bf22[_0x1dd468[_0x28b3('0x2a')]]={'$like':'%'+_0x3cbdfc['query'][_0x28b3('0x38')]+'%'};return _0x22bf22;}})});}_0x303f73=_[_0x28b3('0x3a')]({},_0x303f73,_0x3cbdfc[_0x28b3('0x3b')]);var _0x4fc922={'where':_0x303f73[_0x28b3('0x36')]};return db[_0x28b3('0x26')]['count'](_0x4fc922)[_0x28b3('0x21')](function(_0x38df69){_0x52821f['count']=_0x38df69;if(_0x3cbdfc['query'][_0x28b3('0x3c')]){_0x303f73[_0x28b3('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x303f73);})[_0x28b3('0x21')](function(_0x3fcf62){_0x52821f[_0x28b3('0x3e')]=_0x3fcf62;return _0x52821f;})[_0x28b3('0x21')](respondWithFilteredResult(_0x4d750e,_0x303f73))[_0x28b3('0x3f')](handleError(_0x4d750e,null));};exports['show']=function(_0x19a7b9,_0x430257){var _0x536424={'raw':!![],'where':{'id':_0x19a7b9['params']['id']}},_0x3616f0={};_0x3616f0['model']=_[_0x28b3('0x2b')](db[_0x28b3('0x26')]['rawAttributes']);_0x3616f0[_0x28b3('0x2c')]=_[_0x28b3('0x2b')](_0x19a7b9[_0x28b3('0x2c')]);_0x3616f0['filters']=_[_0x28b3('0x2e')](_0x3616f0[_0x28b3('0x2f')],_0x3616f0[_0x28b3('0x2c')]);_0x536424[_0x28b3('0x31')]=_[_0x28b3('0x2e')](_0x3616f0['model'],qs['fields'](_0x19a7b9[_0x28b3('0x2c')][_0x28b3('0x30')]));_0x536424[_0x28b3('0x31')]=_0x536424[_0x28b3('0x31')]['length']?_0x536424[_0x28b3('0x31')]:_0x3616f0[_0x28b3('0x2f')];if(_0x19a7b9['query']['includeAll']){_0x536424['include']=[{'all':!![]}];}_0x536424=_[_0x28b3('0x3a')]({},_0x536424,_0x19a7b9[_0x28b3('0x3b')]);return db['AnalyticTreeReport'][_0x28b3('0x40')](_0x536424)[_0x28b3('0x21')](handleEntityNotFound(_0x430257,null))['then'](respondWithResult(_0x430257,null))[_0x28b3('0x3f')](handleError(_0x430257,null));};exports['create']=function(_0x446d92,_0x317d0c){return db['AnalyticTreeReport']['create'](_0x446d92[_0x28b3('0x41')],{})[_0x28b3('0x21')](respondWithResult(_0x317d0c,0xc9))[_0x28b3('0x3f')](handleError(_0x317d0c,null));};exports['update']=function(_0x27d8d4,_0x5814ab){if(_0x27d8d4[_0x28b3('0x41')]['id']){delete _0x27d8d4['body']['id'];}return db[_0x28b3('0x26')][_0x28b3('0x40')]({'where':{'id':_0x27d8d4['params']['id']}})[_0x28b3('0x21')](handleEntityNotFound(_0x5814ab,null))[_0x28b3('0x21')](saveUpdates(_0x27d8d4['body'],null))[_0x28b3('0x21')](respondWithResult(_0x5814ab,null))[_0x28b3('0x3f')](handleError(_0x5814ab,null));};exports[_0x28b3('0x22')]=function(_0x356783,_0x59ed05){return db[_0x28b3('0x26')]['find']({'where':{'id':_0x356783[_0x28b3('0x42')]['id']}})[_0x28b3('0x21')](handleEntityNotFound(_0x59ed05,null))[_0x28b3('0x21')](removeEntity(_0x59ed05,null))[_0x28b3('0x3f')](handleError(_0x59ed05,null));}; \ No newline at end of file +var _0xd7c4=['path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0xca1acb,_0x3963e8){var _0x1dded7=function(_0x17f78e){while(--_0x17f78e){_0xca1acb['push'](_0xca1acb['shift']());}};_0x1dded7(++_0x3963e8);}(_0xd7c4,0x91));var _0x4d7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4d7c('0x0'));var rimraf=require(_0x4d7c('0x1'));var zipdir=require(_0x4d7c('0x2'));var jsonpatch=require(_0x4d7c('0x3'));var rp=require(_0x4d7c('0x4'));var moment=require('moment');var BPromise=require(_0x4d7c('0x5'));var Mustache=require('mustache');var util=require(_0x4d7c('0x6'));var path=require(_0x4d7c('0x7'));var sox=require(_0x4d7c('0x8'));var csv=require(_0x4d7c('0x9'));var ejs=require(_0x4d7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d7c('0xb'));var squel=require('squel');var crypto=require(_0x4d7c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d7c('0x9'));var querystring=require(_0x4d7c('0xd'));var Papa=require(_0x4d7c('0xe'));var Redis=require(_0x4d7c('0xf'));var authService=require(_0x4d7c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4d7c('0x11'));var hardwareService=require(_0x4d7c('0x12'));var logger=require(_0x4d7c('0x13'))(_0x4d7c('0x14'));var utils=require(_0x4d7c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4d7c('0x16'));var db=require(_0x4d7c('0x17'))['db'];function respondWithStatusCode(_0x4a3da0,_0x262cbc){_0x262cbc=_0x262cbc||0xcc;return function(_0x20e08c){if(_0x20e08c){return _0x4a3da0[_0x4d7c('0x18')](_0x262cbc);}return _0x4a3da0[_0x4d7c('0x19')](_0x262cbc)[_0x4d7c('0x1a')]();};}function respondWithResult(_0xeb4116,_0x44d27e){_0x44d27e=_0x44d27e||0xc8;return function(_0x40cf40){if(_0x40cf40){return _0xeb4116[_0x4d7c('0x19')](_0x44d27e)[_0x4d7c('0x1b')](_0x40cf40);}};}function respondWithFilteredResult(_0x1962f4,_0x18cc06){return function(_0x51af15){if(_0x51af15){var _0x29c1e0=typeof _0x18cc06['offset']==='undefined'&&typeof _0x18cc06['limit']===_0x4d7c('0x1c');var _0x7a5fc8=_0x51af15[_0x4d7c('0x1d')];var _0x3cbed7=_0x29c1e0?0x0:_0x18cc06[_0x4d7c('0x1e')];var _0x5a418f=_0x29c1e0?_0x51af15[_0x4d7c('0x1d')]:_0x18cc06[_0x4d7c('0x1e')]+_0x18cc06[_0x4d7c('0x1f')];var _0x16d174;if(_0x5a418f>=_0x7a5fc8){_0x5a418f=_0x7a5fc8;_0x16d174=0xc8;}else{_0x16d174=0xce;}_0x1962f4[_0x4d7c('0x19')](_0x16d174);return _0x1962f4[_0x4d7c('0x20')](_0x4d7c('0x21'),_0x3cbed7+'-'+_0x5a418f+'/'+_0x7a5fc8)[_0x4d7c('0x1b')](_0x51af15);}return null;};}function patchUpdates(_0x151daf){return function(_0x354e25){try{jsonpatch[_0x4d7c('0x22')](_0x354e25,_0x151daf,!![]);}catch(_0x3d6fdc){return BPromise[_0x4d7c('0x23')](_0x3d6fdc);}return _0x354e25[_0x4d7c('0x24')]();};}function saveUpdates(_0x555bb2,_0x361e84){return function(_0x2be66e){if(_0x2be66e){return _0x2be66e[_0x4d7c('0x25')](_0x555bb2)[_0x4d7c('0x26')](function(_0x955c61){return _0x955c61;});}return null;};}function removeEntity(_0x40a55f,_0x522579){return function(_0x3ef888){if(_0x3ef888){return _0x3ef888[_0x4d7c('0x27')]()[_0x4d7c('0x26')](function(){_0x40a55f[_0x4d7c('0x19')](0xcc)[_0x4d7c('0x1a')]();});}};}function handleEntityNotFound(_0x13d47a,_0x4c05d7){return function(_0x4a7752){if(!_0x4a7752){_0x13d47a['sendStatus'](0x194);}return _0x4a7752;};}function handleError(_0x96a51c,_0x41dbaa){_0x41dbaa=_0x41dbaa||0x1f4;return function(_0x648163){logger['error'](_0x648163[_0x4d7c('0x28')]);if(_0x648163[_0x4d7c('0x29')]){delete _0x648163[_0x4d7c('0x29')];}_0x96a51c[_0x4d7c('0x19')](_0x41dbaa)[_0x4d7c('0x2a')](_0x648163);};}exports[_0x4d7c('0x2b')]=function(_0x252009,_0x4f4b07){var _0x15bb38={},_0x250c26={},_0x5ad024={'count':0x0,'rows':[]};var _0x328bdb=_[_0x4d7c('0x2c')](db[_0x4d7c('0x2d')][_0x4d7c('0x2e')],function(_0xbf727a){return{'name':_0xbf727a['fieldName'],'type':_0xbf727a[_0x4d7c('0x2f')][_0x4d7c('0x30')]};});_0x250c26[_0x4d7c('0x31')]=_[_0x4d7c('0x2c')](_0x328bdb,_0x4d7c('0x29'));_0x250c26['query']=_[_0x4d7c('0x32')](_0x252009[_0x4d7c('0x33')]);_0x250c26[_0x4d7c('0x34')]=_[_0x4d7c('0x35')](_0x250c26['model'],_0x250c26[_0x4d7c('0x33')]);_0x15bb38[_0x4d7c('0x36')]=_[_0x4d7c('0x35')](_0x250c26[_0x4d7c('0x31')],qs[_0x4d7c('0x37')](_0x252009['query'][_0x4d7c('0x37')]));_0x15bb38[_0x4d7c('0x36')]=_0x15bb38[_0x4d7c('0x36')][_0x4d7c('0x38')]?_0x15bb38['attributes']:_0x250c26['model'];if(!_0x252009[_0x4d7c('0x33')][_0x4d7c('0x39')](_0x4d7c('0x3a'))){_0x15bb38['limit']=qs[_0x4d7c('0x1f')](_0x252009[_0x4d7c('0x33')][_0x4d7c('0x1f')]);_0x15bb38[_0x4d7c('0x1e')]=qs[_0x4d7c('0x1e')](_0x252009['query']['offset']);}_0x15bb38[_0x4d7c('0x3b')]=qs['sort'](_0x252009[_0x4d7c('0x33')][_0x4d7c('0x3c')]);_0x15bb38[_0x4d7c('0x3d')]=qs['filters'](_[_0x4d7c('0x3e')](_0x252009[_0x4d7c('0x33')],_0x250c26[_0x4d7c('0x34')]),_0x328bdb);if(_0x252009[_0x4d7c('0x33')][_0x4d7c('0x3f')]){_0x15bb38['where']=_['merge'](_0x15bb38[_0x4d7c('0x3d')],{'$or':_[_0x4d7c('0x2c')](_0x328bdb,function(_0x2d2ada){if(_0x2d2ada[_0x4d7c('0x2f')]!==_0x4d7c('0x40')){var _0x4090d6={};_0x4090d6[_0x2d2ada[_0x4d7c('0x29')]]={'$like':'%'+_0x252009[_0x4d7c('0x33')][_0x4d7c('0x3f')]+'%'};return _0x4090d6;}})});}_0x15bb38=_[_0x4d7c('0x41')]({},_0x15bb38,_0x252009['options']);var _0x436f6a={'where':_0x15bb38[_0x4d7c('0x3d')]};return db[_0x4d7c('0x2d')][_0x4d7c('0x1d')](_0x436f6a)[_0x4d7c('0x26')](function(_0x217665){_0x5ad024[_0x4d7c('0x1d')]=_0x217665;if(_0x252009[_0x4d7c('0x33')][_0x4d7c('0x42')]){_0x15bb38[_0x4d7c('0x43')]=[{'all':!![]}];}return db[_0x4d7c('0x2d')][_0x4d7c('0x44')](_0x15bb38);})['then'](function(_0x4fa31a){_0x5ad024[_0x4d7c('0x45')]=_0x4fa31a;return _0x5ad024;})[_0x4d7c('0x26')](respondWithFilteredResult(_0x4f4b07,_0x15bb38))[_0x4d7c('0x46')](handleError(_0x4f4b07,null));};exports['show']=function(_0x5d6026,_0x54066e){var _0xe327ac={'raw':!![],'where':{'id':_0x5d6026[_0x4d7c('0x47')]['id']}},_0x3f494e={};_0x3f494e[_0x4d7c('0x31')]=_[_0x4d7c('0x32')](db[_0x4d7c('0x2d')][_0x4d7c('0x2e')]);_0x3f494e[_0x4d7c('0x33')]=_[_0x4d7c('0x32')](_0x5d6026[_0x4d7c('0x33')]);_0x3f494e['filters']=_['intersection'](_0x3f494e[_0x4d7c('0x31')],_0x3f494e[_0x4d7c('0x33')]);_0xe327ac[_0x4d7c('0x36')]=_['intersection'](_0x3f494e[_0x4d7c('0x31')],qs[_0x4d7c('0x37')](_0x5d6026['query'][_0x4d7c('0x37')]));_0xe327ac[_0x4d7c('0x36')]=_0xe327ac[_0x4d7c('0x36')][_0x4d7c('0x38')]?_0xe327ac[_0x4d7c('0x36')]:_0x3f494e[_0x4d7c('0x31')];if(_0x5d6026[_0x4d7c('0x33')]['includeAll']){_0xe327ac[_0x4d7c('0x43')]=[{'all':!![]}];}_0xe327ac=_[_0x4d7c('0x41')]({},_0xe327ac,_0x5d6026[_0x4d7c('0x48')]);return db[_0x4d7c('0x2d')][_0x4d7c('0x49')](_0xe327ac)[_0x4d7c('0x26')](handleEntityNotFound(_0x54066e,null))[_0x4d7c('0x26')](respondWithResult(_0x54066e,null))['catch'](handleError(_0x54066e,null));};exports[_0x4d7c('0x4a')]=function(_0xeff4b7,_0x402124){return db[_0x4d7c('0x2d')][_0x4d7c('0x4a')](_0xeff4b7[_0x4d7c('0x4b')],{})['then'](respondWithResult(_0x402124,0xc9))[_0x4d7c('0x46')](handleError(_0x402124,null));};exports[_0x4d7c('0x25')]=function(_0x5f4be7,_0xfd2560){if(_0x5f4be7['body']['id']){delete _0x5f4be7['body']['id'];}return db[_0x4d7c('0x2d')][_0x4d7c('0x49')]({'where':{'id':_0x5f4be7[_0x4d7c('0x47')]['id']}})['then'](handleEntityNotFound(_0xfd2560,null))[_0x4d7c('0x26')](saveUpdates(_0x5f4be7['body'],null))['then'](respondWithResult(_0xfd2560,null))['catch'](handleError(_0xfd2560,null));};exports['destroy']=function(_0x58175a,_0x37af7b){return db[_0x4d7c('0x2d')][_0x4d7c('0x49')]({'where':{'id':_0x58175a[_0x4d7c('0x47')]['id']}})[_0x4d7c('0x26')](handleEntityNotFound(_0x37af7b,null))[_0x4d7c('0x26')](removeEntity(_0x37af7b,null))[_0x4d7c('0x46')](handleError(_0x37af7b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 36fe015..687f75e 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 _0x981e=['request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','moment'];(function(_0x5535b6,_0x5193e1){var _0x79cb7d=function(_0x485ac1){while(--_0x485ac1){_0x5535b6['push'](_0x5535b6['shift']());}};_0x79cb7d(++_0x5193e1);}(_0x981e,0xe3));var _0xe981=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x981e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe981('0x0'));var util=require(_0xe981('0x1'));var logger=require(_0xe981('0x2'))('api');var moment=require(_0xe981('0x3'));var BPromise=require('bluebird');var rp=require(_0xe981('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe981('0x5'));var config=require(_0xe981('0x6'));var attributes=require(_0xe981('0x7'));module['exports']=function(_0x3790d0,_0x36942e){return _0x3790d0[_0xe981('0x8')](_0xe981('0x9'),attributes,{'tableName':_0xe981('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1218=['define','AnalyticTreeReport','analytics_report_trees','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x1dec2b,_0x37c45e){var _0x3d6d2d=function(_0x16c2e0){while(--_0x16c2e0){_0x1dec2b['push'](_0x1dec2b['shift']());}};_0x3d6d2d(++_0x37c45e);}(_0x1218,0xea));var _0x8121=function(_0xb0f11f,_0x22ec3a){_0xb0f11f=_0xb0f11f-0x0;var _0x339748=_0x1218[_0xb0f11f];return _0x339748;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8121('0x0'));var moment=require(_0x8121('0x1'));var BPromise=require(_0x8121('0x2'));var rp=require(_0x8121('0x3'));var fs=require('fs');var path=require(_0x8121('0x4'));var rimraf=require(_0x8121('0x5'));var config=require(_0x8121('0x6'));var attributes=require(_0x8121('0x7'));module['exports']=function(_0x29e495,_0x5f291b){return _0x29e495[_0x8121('0x8')](_0x8121('0x9'),attributes,{'tableName':_0x8121('0xa'),'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 b3cc5bf..3daa5f5 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x215c16,_0xa1c92a){var _0x109038=function(_0x325138){while(--_0x325138){_0x215c16['push'](_0x215c16['shift']());}};_0x109038(++_0xa1c92a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc4aa[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x4dcb59,_0x4de1f0){var _0x241074=function(_0x43e939){while(--_0x43e939){_0x4dcb59['push'](_0x4dcb59['shift']());}};_0x241074(++_0x4de1f0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 70b6d35..45818f6 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 _0x7d45=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7d45,0xeb));var _0x57d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d45[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x57d4('0x0'));var timeout=require(_0x57d4('0x1'));var express=require(_0x57d4('0x2'));var router=express[_0x57d4('0x3')]();var fs_extra=require(_0x57d4('0x4'));var auth=require(_0x57d4('0x5'));var interaction=require(_0x57d4('0x6'));var config=require(_0x57d4('0x7'));var controller=require(_0x57d4('0x8'));router[_0x57d4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x57d4('0x9')](_0x57d4('0xa'),auth[_0x57d4('0xb')](),controller[_0x57d4('0xc')]);router[_0x57d4('0xd')]('/',auth[_0x57d4('0xb')](),controller[_0x57d4('0xe')]);router[_0x57d4('0xf')](_0x57d4('0xa'),auth[_0x57d4('0xb')](),controller[_0x57d4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x57d4('0x11')]);module['exports']=router; \ No newline at end of file +var _0x32ad=['get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x4d0b5b,_0xf881c4){var _0x521856=function(_0x2e5d01){while(--_0x2e5d01){_0x4d0b5b['push'](_0x4d0b5b['shift']());}};_0x521856(++_0xf881c4);}(_0x32ad,0x1cd));var _0xd32a=function(_0x42fa1f,_0x1abc4b){_0x42fa1f=_0x42fa1f-0x0;var _0x1d70e6=_0x32ad[_0x42fa1f];return _0x1d70e6;};'use strict';var multer=require(_0xd32a('0x0'));var util=require('util');var path=require(_0xd32a('0x1'));var timeout=require(_0xd32a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd32a('0x3'));var interaction=require(_0xd32a('0x4'));var config=require(_0xd32a('0x5'));var controller=require(_0xd32a('0x6'));router[_0xd32a('0x7')]('/',auth[_0xd32a('0x8')](),controller[_0xd32a('0x9')]);router[_0xd32a('0x7')]('/:id',auth[_0xd32a('0x8')](),controller[_0xd32a('0xa')]);router[_0xd32a('0xb')]('/',auth[_0xd32a('0x8')](),controller[_0xd32a('0xc')]);router[_0xd32a('0xd')](_0xd32a('0xe'),auth[_0xd32a('0x8')](),controller[_0xd32a('0xf')]);router['delete'](_0xd32a('0xe'),auth[_0xd32a('0x8')](),controller[_0xd32a('0x10')]);module[_0xd32a('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 257a166..b33fb60 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8743=['exports','STRING','sequelize'];(function(_0x3a36e4,_0x420a62){var _0x3e3628=function(_0x528795){while(--_0x528795){_0x3a36e4['push'](_0x3a36e4['shift']());}};_0x3e3628(++_0x420a62);}(_0x8743,0x7a));var _0x3874=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8743[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x3874('0x0'));module[_0x3874('0x1')]={'name':{'type':Sequelize[_0x3874('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3874('0x2')]}}; \ No newline at end of file +var _0x86dd=['exports','STRING'];(function(_0x36f419,_0x3119dc){var _0x586722=function(_0xc58a17){while(--_0xc58a17){_0x36f419['push'](_0x36f419['shift']());}};_0x586722(++_0x3119dc);}(_0x86dd,0x1ee));var _0xd86d=function(_0x512adf,_0x2b206d){_0x512adf=_0x512adf-0x0;var _0x2f7646=_0x86dd[_0x512adf];return _0x2f7646;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xd86d('0x1')]},'type':{'type':Sequelize[_0xd86d('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0f33c51..9a9e26e 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 _0x052e=['findAll','catch','show','params','find','clone','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','ChatOfflineMessageId','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','Attachment','includeAll','include'];(function(_0x5d00ee,_0x17acee){var _0x2c4d97=function(_0x195592){while(--_0x195592){_0x5d00ee['push'](_0x5d00ee['shift']());}};_0x2c4d97(++_0x17acee);}(_0x052e,0x157));var _0xe052=function(_0x50e2d4,_0x5df027){_0x50e2d4=_0x50e2d4-0x0;var _0x27033c=_0x052e[_0x50e2d4];return _0x27033c;};'use strict';var emlformat=require(_0xe052('0x0'));var rimraf=require(_0xe052('0x1'));var zipdir=require(_0xe052('0x2'));var jsonpatch=require(_0xe052('0x3'));var rp=require(_0xe052('0x4'));var moment=require(_0xe052('0x5'));var BPromise=require(_0xe052('0x6'));var Mustache=require(_0xe052('0x7'));var util=require('util');var path=require(_0xe052('0x8'));var sox=require(_0xe052('0x9'));var csv=require(_0xe052('0xa'));var ejs=require(_0xe052('0xb'));var fs=require('fs');var fs_extra=require(_0xe052('0xc'));var _=require(_0xe052('0xd'));var squel=require(_0xe052('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe052('0xa'));var querystring=require(_0xe052('0xf'));var Papa=require(_0xe052('0x10'));var Redis=require(_0xe052('0x11'));var authService=require(_0xe052('0x12'));var qs=require(_0xe052('0x13'));var as=require(_0xe052('0x14'));var hardwareService=require(_0xe052('0x15'));var logger=require('../../config/logger')(_0xe052('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe052('0x17'))['db'];function respondWithStatusCode(_0x29c75c,_0xe24774){_0xe24774=_0xe24774||0xcc;return function(_0x2ec527){if(_0x2ec527){return _0x29c75c[_0xe052('0x18')](_0xe24774);}return _0x29c75c[_0xe052('0x19')](_0xe24774)[_0xe052('0x1a')]();};}function respondWithResult(_0xcbbed4,_0xa981e3){_0xa981e3=_0xa981e3||0xc8;return function(_0x5ea1e5){if(_0x5ea1e5){return _0xcbbed4['status'](_0xa981e3)[_0xe052('0x1b')](_0x5ea1e5);}};}function respondWithFilteredResult(_0x37f1e3,_0x1bcc49){return function(_0x1796c9){if(_0x1796c9){var _0x123845=typeof _0x1bcc49['offset']===_0xe052('0x1c')&&typeof _0x1bcc49[_0xe052('0x1d')]==='undefined';var _0xba1752=_0x1796c9[_0xe052('0x1e')];var _0x491063=_0x123845?0x0:_0x1bcc49[_0xe052('0x1f')];var _0x318e38=_0x123845?_0x1796c9['count']:_0x1bcc49[_0xe052('0x1f')]+_0x1bcc49[_0xe052('0x1d')];var _0x821c69;if(_0x318e38>=_0xba1752){_0x318e38=_0xba1752;_0x821c69=0xc8;}else{_0x821c69=0xce;}_0x37f1e3['status'](_0x821c69);return _0x37f1e3['set'](_0xe052('0x20'),_0x491063+'-'+_0x318e38+'/'+_0xba1752)[_0xe052('0x1b')](_0x1796c9);}return null;};}function patchUpdates(_0x4161e4){return function(_0xf9cc75){try{jsonpatch[_0xe052('0x21')](_0xf9cc75,_0x4161e4,!![]);}catch(_0x4a4e30){return BPromise['reject'](_0x4a4e30);}return _0xf9cc75['save']();};}function saveUpdates(_0x43b7af,_0x27d152){return function(_0x1e8b5f){if(_0x1e8b5f){return _0x1e8b5f[_0xe052('0x22')](_0x43b7af)[_0xe052('0x23')](function(_0x1358cd){return _0x1358cd;});}return null;};}function removeEntity(_0x50e2fc,_0x31a200){return function(_0x484ec2){if(_0x484ec2){return _0x484ec2[_0xe052('0x24')]()[_0xe052('0x23')](function(){_0x50e2fc[_0xe052('0x19')](0xcc)[_0xe052('0x1a')]();});}};}function handleEntityNotFound(_0x35217c,_0x49ff64){return function(_0x347ed7){if(!_0x347ed7){_0x35217c[_0xe052('0x18')](0x194);}return _0x347ed7;};}function handleError(_0x3d765e,_0x238325){_0x238325=_0x238325||0x1f4;return function(_0x2c53e6){logger[_0xe052('0x25')](_0x2c53e6[_0xe052('0x26')]);if(_0x2c53e6[_0xe052('0x27')]){delete _0x2c53e6[_0xe052('0x27')];}_0x3d765e['status'](_0x238325)[_0xe052('0x28')](_0x2c53e6);};}exports['index']=function(_0x21519a,_0x491ef7){var _0x544b5a={},_0x16fbb5={},_0x34fe77={'count':0x0,'rows':[]};var _0x520e56=_[_0xe052('0x29')](db['Attachment'][_0xe052('0x2a')],function(_0x41e69f){return{'name':_0x41e69f[_0xe052('0x2b')],'type':_0x41e69f[_0xe052('0x2c')]['key']};});_0x16fbb5[_0xe052('0x2d')]=_[_0xe052('0x29')](_0x520e56,_0xe052('0x27'));_0x16fbb5[_0xe052('0x2e')]=_[_0xe052('0x2f')](_0x21519a['query']);_0x16fbb5[_0xe052('0x30')]=_[_0xe052('0x31')](_0x16fbb5['model'],_0x16fbb5[_0xe052('0x2e')]);_0x544b5a[_0xe052('0x32')]=_[_0xe052('0x31')](_0x16fbb5[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x21519a[_0xe052('0x2e')][_0xe052('0x33')]));_0x544b5a[_0xe052('0x32')]=_0x544b5a['attributes'][_0xe052('0x34')]?_0x544b5a[_0xe052('0x32')]:_0x16fbb5[_0xe052('0x2d')];if(!_0x21519a[_0xe052('0x2e')]['hasOwnProperty']('nolimit')){_0x544b5a[_0xe052('0x1d')]=qs['limit'](_0x21519a['query'][_0xe052('0x1d')]);_0x544b5a[_0xe052('0x1f')]=qs['offset'](_0x21519a['query'][_0xe052('0x1f')]);}_0x544b5a[_0xe052('0x35')]=qs[_0xe052('0x36')](_0x21519a[_0xe052('0x2e')][_0xe052('0x36')]);_0x544b5a[_0xe052('0x37')]=qs[_0xe052('0x30')](_['pick'](_0x21519a[_0xe052('0x2e')],_0x16fbb5[_0xe052('0x30')]),_0x520e56);if(_0x21519a[_0xe052('0x2e')][_0xe052('0x38')]){_0x544b5a['where']=_[_0xe052('0x39')](_0x544b5a[_0xe052('0x37')],{'$or':_[_0xe052('0x29')](_0x520e56,function(_0x1220ad){if(_0x1220ad['type']!=='VIRTUAL'){var _0x383c21={};_0x383c21[_0x1220ad[_0xe052('0x27')]]={'$like':'%'+_0x21519a[_0xe052('0x2e')][_0xe052('0x38')]+'%'};return _0x383c21;}})});}_0x544b5a=_[_0xe052('0x39')]({},_0x544b5a,_0x21519a[_0xe052('0x3a')]);var _0x143345={'where':_0x544b5a['where']};return db[_0xe052('0x3b')][_0xe052('0x1e')](_0x143345)['then'](function(_0x4ff158){_0x34fe77[_0xe052('0x1e')]=_0x4ff158;if(_0x21519a[_0xe052('0x2e')][_0xe052('0x3c')]){_0x544b5a[_0xe052('0x3d')]=[{'all':!![]}];}return db[_0xe052('0x3b')][_0xe052('0x3e')](_0x544b5a);})['then'](function(_0xdce2c7){_0x34fe77['rows']=_0xdce2c7;return _0x34fe77;})[_0xe052('0x23')](respondWithFilteredResult(_0x491ef7,_0x544b5a))[_0xe052('0x3f')](handleError(_0x491ef7,null));};exports[_0xe052('0x40')]=function(_0x447cd1,_0x116b58){var _0x56607a={'raw':!![],'where':{'id':_0x447cd1[_0xe052('0x41')]['id']}},_0x4dcbc7={};_0x4dcbc7['model']=_[_0xe052('0x2f')](db[_0xe052('0x3b')][_0xe052('0x2a')]);_0x4dcbc7['query']=_['keys'](_0x447cd1[_0xe052('0x2e')]);_0x4dcbc7[_0xe052('0x30')]=_['intersection'](_0x4dcbc7[_0xe052('0x2d')],_0x4dcbc7[_0xe052('0x2e')]);_0x56607a[_0xe052('0x32')]=_[_0xe052('0x31')](_0x4dcbc7[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x447cd1['query'][_0xe052('0x33')]));_0x56607a[_0xe052('0x32')]=_0x56607a[_0xe052('0x32')][_0xe052('0x34')]?_0x56607a['attributes']:_0x4dcbc7[_0xe052('0x2d')];if(_0x447cd1[_0xe052('0x2e')]['includeAll']){_0x56607a[_0xe052('0x3d')]=[{'all':!![]}];}_0x56607a=_[_0xe052('0x39')]({},_0x56607a,_0x447cd1['options']);return db['Attachment'][_0xe052('0x42')](_0x56607a)[_0xe052('0x23')](handleEntityNotFound(_0x116b58,null))['then'](respondWithResult(_0x116b58,null))[_0xe052('0x3f')](handleError(_0x116b58,null));};exports[_0xe052('0x43')]=function(_0x2dfc37,_0x1ee9b2){var _0x320c2f={'where':{'id':_0x2dfc37[_0xe052('0x41')]['id']}},_0x2564f7={};_0x2564f7[_0xe052('0x2d')]=_[_0xe052('0x2f')](db[_0xe052('0x3b')][_0xe052('0x2a')]);_0x320c2f[_0xe052('0x32')]=_[_0xe052('0x31')](_0x2564f7[_0xe052('0x2d')],qs[_0xe052('0x33')](_0x2dfc37[_0xe052('0x2e')][_0xe052('0x33')]));_0x320c2f[_0xe052('0x32')]=_0x320c2f[_0xe052('0x32')][_0xe052('0x34')]?_0x320c2f[_0xe052('0x32')]:_0x2564f7[_0xe052('0x2d')];if(_0x2dfc37[_0xe052('0x2e')][_0xe052('0x3c')]){_0x320c2f[_0xe052('0x3d')]=[{'all':!![]}];}_0x320c2f=_['merge']({},_0x320c2f,_0x2dfc37[_0xe052('0x3a')]);return db[_0xe052('0x3b')][_0xe052('0x42')](_0x320c2f)[_0xe052('0x23')](handleEntityNotFound(_0x1ee9b2,null))[_0xe052('0x23')](function(_0x44c4d9){if(_0x44c4d9){var _0x4fdffd=_0x44c4d9['get']({'plain':!![]});_0x4fdffd=qs[_0xe052('0x44')](_0x4fdffd,['id',_0xe052('0x45'),_0xe052('0x46')]);_0x2dfc37['body']=_['omit'](_0x2dfc37[_0xe052('0x47')],['id',_0xe052('0x45'),_0xe052('0x46')]);return db[_0xe052('0x3b')][_0xe052('0x48')](_[_0xe052('0x39')](_0x4fdffd,_0x2dfc37[_0xe052('0x47')]),{'include':_0x2dfc37[_0xe052('0x2e')][_0xe052('0x3c')]?[{'all':!![]}]:undefined});}})[_0xe052('0x23')](respondWithResult(_0x1ee9b2,0xc9))[_0xe052('0x3f')](handleError(_0x1ee9b2,null));};exports['update']=function(_0x2f12eb,_0x1a9f38){if(_0x2f12eb[_0xe052('0x47')]['id']){delete _0x2f12eb[_0xe052('0x47')]['id'];}return db[_0xe052('0x3b')][_0xe052('0x42')]({'where':{'id':_0x2f12eb['params']['id']}})[_0xe052('0x23')](handleEntityNotFound(_0x1a9f38,null))[_0xe052('0x23')](saveUpdates(_0x2f12eb['body'],null))['then'](respondWithResult(_0x1a9f38,null))[_0xe052('0x3f')](handleError(_0x1a9f38,null));};exports[_0xe052('0x24')]=function(_0x2531ef,_0x3cdb9b){return db[_0xe052('0x3b')][_0xe052('0x42')]({'where':{'id':_0x2531ef[_0xe052('0x41')]['id']}})[_0xe052('0x23')](handleEntityNotFound(_0x3cdb9b,null))[_0xe052('0x23')](removeEntity(_0x3cdb9b,null))[_0xe052('0x3f')](handleError(_0x3cdb9b,null));};exports[_0xe052('0x48')]=function(_0x27f6aa,_0x4872d6,_0xa44273){_0x27f6aa[_0xe052('0x47')]['name']=_0x27f6aa[_0xe052('0x49')][_0xe052('0x4a')];_0x27f6aa[_0xe052('0x47')][_0xe052('0x4b')]=_0x27f6aa[_0xe052('0x49')]['filename'];_0x27f6aa[_0xe052('0x47')][_0xe052('0x2c')]=_0x27f6aa[_0xe052('0x49')][_0xe052('0x4c')];return db[_0xe052('0x3b')][_0xe052('0x48')](_0x27f6aa[_0xe052('0x47')])[_0xe052('0x23')](respondWithResult(_0x4872d6,0xc9))[_0xe052('0x3f')](handleError(_0x4872d6,null));};exports[_0xe052('0x4d')]=function(_0x519cd7,_0x105a0f,_0x482287){return db[_0xe052('0x3b')]['findOne']({'where':{'id':_0x519cd7['params']['id']},'raw':!![]})[_0xe052('0x23')](handleEntityNotFound(_0x105a0f,null))[_0xe052('0x23')](function(_0x230016){if(_0x230016){var _0x186543=_0x230016[_0xe052('0x4e')]!==null;var _0x30d7c4=path[_0xe052('0x4f')](config['root'],_0xe052('0x50'));if(_0x186543){_0x30d7c4=path[_0xe052('0x4f')](_0x30d7c4,'offline-chat/');}var _0xd503c7=path[_0xe052('0x4f')](_0x30d7c4,_0x230016[_0xe052('0x4b')]);return _0x105a0f[_0xe052('0x4d')](_0xd503c7);}})[_0xe052('0x3f')](handleError(_0x105a0f,null));}; \ No newline at end of file +var _0x03dc=['server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','set','json','save','update','then','destroy','sendStatus','error','name','send','map','Attachment','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','filter','where','merge','count','findAll','catch','params','rawAttributes','length','options','includeAll','include','find','get','omit','createdAt','updatedAt','body','create','originalname','basename','filename','mimetype','ChatOfflineMessageId','join','root'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03dc,0x1ee));var _0xc03d=function(_0x52dbd6,_0x4034f1){_0x52dbd6=_0x52dbd6-0x0;var _0x4d046d=_0x03dc[_0x52dbd6];return _0x4d046d;};'use strict';var emlformat=require(_0xc03d('0x0'));var rimraf=require(_0xc03d('0x1'));var zipdir=require(_0xc03d('0x2'));var jsonpatch=require(_0xc03d('0x3'));var rp=require('request-promise');var moment=require(_0xc03d('0x4'));var BPromise=require(_0xc03d('0x5'));var Mustache=require(_0xc03d('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc03d('0x7'));var csv=require(_0xc03d('0x8'));var ejs=require(_0xc03d('0x9'));var fs=require('fs');var fs_extra=require(_0xc03d('0xa'));var _=require(_0xc03d('0xb'));var squel=require(_0xc03d('0xc'));var crypto=require(_0xc03d('0xd'));var jsforce=require(_0xc03d('0xe'));var deskjs=require(_0xc03d('0xf'));var toCsv=require(_0xc03d('0x8'));var querystring=require(_0xc03d('0x10'));var Papa=require(_0xc03d('0x11'));var Redis=require(_0xc03d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc03d('0x13'));var as=require(_0xc03d('0x14'));var hardwareService=require(_0xc03d('0x15'));var logger=require(_0xc03d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc03d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc03d('0x18'))['db'];function respondWithStatusCode(_0x138bb2,_0x332ddc){_0x332ddc=_0x332ddc||0xcc;return function(_0x441bb1){if(_0x441bb1){return _0x138bb2['sendStatus'](_0x332ddc);}return _0x138bb2[_0xc03d('0x19')](_0x332ddc)[_0xc03d('0x1a')]();};}function respondWithResult(_0x4ec1f6,_0x50b69a){_0x50b69a=_0x50b69a||0xc8;return function(_0xf384f1){if(_0xf384f1){return _0x4ec1f6['status'](_0x50b69a)['json'](_0xf384f1);}};}function respondWithFilteredResult(_0x31db0a,_0x3f0da5){return function(_0x273dd5){if(_0x273dd5){var _0x344f90=typeof _0x3f0da5[_0xc03d('0x1b')]===_0xc03d('0x1c')&&typeof _0x3f0da5[_0xc03d('0x1d')]===_0xc03d('0x1c');var _0x23ad59=_0x273dd5['count'];var _0xe57ece=_0x344f90?0x0:_0x3f0da5[_0xc03d('0x1b')];var _0x4a4a9c=_0x344f90?_0x273dd5['count']:_0x3f0da5[_0xc03d('0x1b')]+_0x3f0da5[_0xc03d('0x1d')];var _0x4aa250;if(_0x4a4a9c>=_0x23ad59){_0x4a4a9c=_0x23ad59;_0x4aa250=0xc8;}else{_0x4aa250=0xce;}_0x31db0a[_0xc03d('0x19')](_0x4aa250);return _0x31db0a[_0xc03d('0x1e')]('Content-Range',_0xe57ece+'-'+_0x4a4a9c+'/'+_0x23ad59)[_0xc03d('0x1f')](_0x273dd5);}return null;};}function patchUpdates(_0x1b67d9){return function(_0x392eac){try{jsonpatch['apply'](_0x392eac,_0x1b67d9,!![]);}catch(_0x8c265){return BPromise['reject'](_0x8c265);}return _0x392eac[_0xc03d('0x20')]();};}function saveUpdates(_0x38ea15,_0x5d85ee){return function(_0x243321){if(_0x243321){return _0x243321[_0xc03d('0x21')](_0x38ea15)[_0xc03d('0x22')](function(_0x2a9629){return _0x2a9629;});}return null;};}function removeEntity(_0x5c2adf,_0xb6fb62){return function(_0x1b457c){if(_0x1b457c){return _0x1b457c[_0xc03d('0x23')]()[_0xc03d('0x22')](function(){_0x5c2adf['status'](0xcc)[_0xc03d('0x1a')]();});}};}function handleEntityNotFound(_0xc5e7ac,_0x355ec8){return function(_0x362d7c){if(!_0x362d7c){_0xc5e7ac[_0xc03d('0x24')](0x194);}return _0x362d7c;};}function handleError(_0x14c7ef,_0x43a899){_0x43a899=_0x43a899||0x1f4;return function(_0x3b4bbb){logger[_0xc03d('0x25')](_0x3b4bbb['stack']);if(_0x3b4bbb[_0xc03d('0x26')]){delete _0x3b4bbb['name'];}_0x14c7ef['status'](_0x43a899)[_0xc03d('0x27')](_0x3b4bbb);};}exports['index']=function(_0x18b558,_0x1371dd){var _0x3ca393={},_0x27a8f7={},_0x3cb37c={'count':0x0,'rows':[]};var _0x431a9d=_[_0xc03d('0x28')](db[_0xc03d('0x29')]['rawAttributes'],function(_0x3a78ef){return{'name':_0x3a78ef[_0xc03d('0x2a')],'type':_0x3a78ef[_0xc03d('0x2b')]['key']};});_0x27a8f7[_0xc03d('0x2c')]=_[_0xc03d('0x28')](_0x431a9d,_0xc03d('0x26'));_0x27a8f7['query']=_[_0xc03d('0x2d')](_0x18b558[_0xc03d('0x2e')]);_0x27a8f7[_0xc03d('0x2f')]=_['intersection'](_0x27a8f7['model'],_0x27a8f7[_0xc03d('0x2e')]);_0x3ca393[_0xc03d('0x30')]=_[_0xc03d('0x31')](_0x27a8f7['model'],qs[_0xc03d('0x32')](_0x18b558[_0xc03d('0x2e')]['fields']));_0x3ca393[_0xc03d('0x30')]=_0x3ca393[_0xc03d('0x30')]['length']?_0x3ca393[_0xc03d('0x30')]:_0x27a8f7[_0xc03d('0x2c')];if(!_0x18b558['query']['hasOwnProperty'](_0xc03d('0x33'))){_0x3ca393['limit']=qs['limit'](_0x18b558['query'][_0xc03d('0x1d')]);_0x3ca393['offset']=qs[_0xc03d('0x1b')](_0x18b558[_0xc03d('0x2e')][_0xc03d('0x1b')]);}_0x3ca393[_0xc03d('0x34')]=qs[_0xc03d('0x35')](_0x18b558[_0xc03d('0x2e')][_0xc03d('0x35')]);_0x3ca393['where']=qs[_0xc03d('0x2f')](_['pick'](_0x18b558[_0xc03d('0x2e')],_0x27a8f7['filters']),_0x431a9d);if(_0x18b558[_0xc03d('0x2e')][_0xc03d('0x36')]){_0x3ca393[_0xc03d('0x37')]=_[_0xc03d('0x38')](_0x3ca393[_0xc03d('0x37')],{'$or':_['map'](_0x431a9d,function(_0xd6d553){if(_0xd6d553['type']!=='VIRTUAL'){var _0x32e283={};_0x32e283[_0xd6d553[_0xc03d('0x26')]]={'$like':'%'+_0x18b558[_0xc03d('0x2e')][_0xc03d('0x36')]+'%'};return _0x32e283;}})});}_0x3ca393=_[_0xc03d('0x38')]({},_0x3ca393,_0x18b558['options']);var _0x437724={'where':_0x3ca393[_0xc03d('0x37')]};return db['Attachment'][_0xc03d('0x39')](_0x437724)[_0xc03d('0x22')](function(_0x37322a){_0x3cb37c['count']=_0x37322a;if(_0x18b558[_0xc03d('0x2e')]['includeAll']){_0x3ca393['include']=[{'all':!![]}];}return db[_0xc03d('0x29')][_0xc03d('0x3a')](_0x3ca393);})[_0xc03d('0x22')](function(_0x20e066){_0x3cb37c['rows']=_0x20e066;return _0x3cb37c;})[_0xc03d('0x22')](respondWithFilteredResult(_0x1371dd,_0x3ca393))[_0xc03d('0x3b')](handleError(_0x1371dd,null));};exports['show']=function(_0x3070a9,_0x2e7295){var _0x1ced1f={'raw':!![],'where':{'id':_0x3070a9[_0xc03d('0x3c')]['id']}},_0x3f8c4f={};_0x3f8c4f['model']=_[_0xc03d('0x2d')](db[_0xc03d('0x29')][_0xc03d('0x3d')]);_0x3f8c4f[_0xc03d('0x2e')]=_[_0xc03d('0x2d')](_0x3070a9[_0xc03d('0x2e')]);_0x3f8c4f[_0xc03d('0x2f')]=_[_0xc03d('0x31')](_0x3f8c4f['model'],_0x3f8c4f['query']);_0x1ced1f[_0xc03d('0x30')]=_[_0xc03d('0x31')](_0x3f8c4f[_0xc03d('0x2c')],qs[_0xc03d('0x32')](_0x3070a9[_0xc03d('0x2e')][_0xc03d('0x32')]));_0x1ced1f[_0xc03d('0x30')]=_0x1ced1f['attributes'][_0xc03d('0x3e')]?_0x1ced1f[_0xc03d('0x30')]:_0x3f8c4f[_0xc03d('0x2c')];if(_0x3070a9[_0xc03d('0x2e')]['includeAll']){_0x1ced1f['include']=[{'all':!![]}];}_0x1ced1f=_[_0xc03d('0x38')]({},_0x1ced1f,_0x3070a9[_0xc03d('0x3f')]);return db[_0xc03d('0x29')]['find'](_0x1ced1f)[_0xc03d('0x22')](handleEntityNotFound(_0x2e7295,null))['then'](respondWithResult(_0x2e7295,null))[_0xc03d('0x3b')](handleError(_0x2e7295,null));};exports['clone']=function(_0x2dfee3,_0x8c0e1c){var _0x1c237e={'where':{'id':_0x2dfee3[_0xc03d('0x3c')]['id']}},_0x4736c6={};_0x4736c6[_0xc03d('0x2c')]=_['keys'](db[_0xc03d('0x29')][_0xc03d('0x3d')]);_0x1c237e['attributes']=_[_0xc03d('0x31')](_0x4736c6['model'],qs[_0xc03d('0x32')](_0x2dfee3['query'][_0xc03d('0x32')]));_0x1c237e[_0xc03d('0x30')]=_0x1c237e['attributes'][_0xc03d('0x3e')]?_0x1c237e['attributes']:_0x4736c6['model'];if(_0x2dfee3[_0xc03d('0x2e')][_0xc03d('0x40')]){_0x1c237e[_0xc03d('0x41')]=[{'all':!![]}];}_0x1c237e=_[_0xc03d('0x38')]({},_0x1c237e,_0x2dfee3[_0xc03d('0x3f')]);return db[_0xc03d('0x29')][_0xc03d('0x42')](_0x1c237e)[_0xc03d('0x22')](handleEntityNotFound(_0x8c0e1c,null))['then'](function(_0x8e338){if(_0x8e338){var _0x1d8c49=_0x8e338[_0xc03d('0x43')]({'plain':!![]});_0x1d8c49=qs[_0xc03d('0x44')](_0x1d8c49,['id',_0xc03d('0x45'),_0xc03d('0x46')]);_0x2dfee3['body']=_[_0xc03d('0x44')](_0x2dfee3[_0xc03d('0x47')],['id',_0xc03d('0x45'),_0xc03d('0x46')]);return db[_0xc03d('0x29')][_0xc03d('0x48')](_[_0xc03d('0x38')](_0x1d8c49,_0x2dfee3['body']),{'include':_0x2dfee3[_0xc03d('0x2e')][_0xc03d('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x8c0e1c,0xc9))[_0xc03d('0x3b')](handleError(_0x8c0e1c,null));};exports[_0xc03d('0x21')]=function(_0x326270,_0x4101f6){if(_0x326270[_0xc03d('0x47')]['id']){delete _0x326270[_0xc03d('0x47')]['id'];}return db['Attachment']['find']({'where':{'id':_0x326270['params']['id']}})[_0xc03d('0x22')](handleEntityNotFound(_0x4101f6,null))[_0xc03d('0x22')](saveUpdates(_0x326270[_0xc03d('0x47')],null))['then'](respondWithResult(_0x4101f6,null))[_0xc03d('0x3b')](handleError(_0x4101f6,null));};exports['destroy']=function(_0x36bea9,_0x1cfa0d){return db[_0xc03d('0x29')][_0xc03d('0x42')]({'where':{'id':_0x36bea9[_0xc03d('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1cfa0d,null))[_0xc03d('0x22')](removeEntity(_0x1cfa0d,null))['catch'](handleError(_0x1cfa0d,null));};exports[_0xc03d('0x48')]=function(_0x1f6eac,_0x1a1648,_0x3caf16){_0x1f6eac[_0xc03d('0x47')]['name']=_0x1f6eac['file'][_0xc03d('0x49')];_0x1f6eac[_0xc03d('0x47')][_0xc03d('0x4a')]=_0x1f6eac['file'][_0xc03d('0x4b')];_0x1f6eac[_0xc03d('0x47')][_0xc03d('0x2b')]=_0x1f6eac['file'][_0xc03d('0x4c')];return db[_0xc03d('0x29')][_0xc03d('0x48')](_0x1f6eac[_0xc03d('0x47')])[_0xc03d('0x22')](respondWithResult(_0x1a1648,0xc9))['catch'](handleError(_0x1a1648,null));};exports['download']=function(_0x425cd7,_0x3d4a6e,_0x2bdf97){return db[_0xc03d('0x29')]['findOne']({'where':{'id':_0x425cd7[_0xc03d('0x3c')]['id']},'raw':!![]})[_0xc03d('0x22')](handleEntityNotFound(_0x3d4a6e,null))['then'](function(_0x5966ff){if(_0x5966ff){var _0x438e2f=_0x5966ff[_0xc03d('0x4d')]!==null;var _0x82934d=path[_0xc03d('0x4e')](config[_0xc03d('0x4f')],_0xc03d('0x50'));if(_0x438e2f){_0x82934d=path[_0xc03d('0x4e')](_0x82934d,_0xc03d('0x51'));}var _0x24aa83=path[_0xc03d('0x4e')](_0x82934d,_0x5966ff[_0xc03d('0x4a')]);return _0x3d4a6e['download'](_0x24aa83);}})[_0xc03d('0x3b')](handleError(_0x3d4a6e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 072f99c..8a924b8 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 _0x2f62=['define','attachments','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x4f383a,_0x23e2db){var _0x2c30b1=function(_0x219098){while(--_0x219098){_0x4f383a['push'](_0x4f383a['shift']());}};_0x2c30b1(++_0x23e2db);}(_0x2f62,0x66));var _0x22f6=function(_0x32a981,_0x19b64e){_0x32a981=_0x32a981-0x0;var _0x1a48ff=_0x2f62[_0x32a981];return _0x1a48ff;};'use strict';var _=require(_0x22f6('0x0'));var util=require('util');var logger=require(_0x22f6('0x1'))(_0x22f6('0x2'));var moment=require('moment');var BPromise=require(_0x22f6('0x3'));var rp=require(_0x22f6('0x4'));var fs=require('fs');var path=require(_0x22f6('0x5'));var rimraf=require('rimraf');var config=require(_0x22f6('0x6'));var attributes=require('./attachment.attributes');module[_0x22f6('0x7')]=function(_0x421544,_0x2dcdb4){return _0x421544[_0x22f6('0x8')]('Attachment',attributes,{'tableName':_0x22f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f3b=['exports','Attachment','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./attachment.attributes'];(function(_0x30fea4,_0x166fde){var _0x428d17=function(_0x37bc52){while(--_0x37bc52){_0x30fea4['push'](_0x30fea4['shift']());}};_0x428d17(++_0x166fde);}(_0x3f3b,0x16a));var _0xb3f3=function(_0x1c351a,_0x5f4b94){_0x1c351a=_0x1c351a-0x0;var _0x88f4c5=_0x3f3b[_0x1c351a];return _0x88f4c5;};'use strict';var _=require(_0xb3f3('0x0'));var util=require('util');var logger=require(_0xb3f3('0x1'))('api');var moment=require(_0xb3f3('0x2'));var BPromise=require(_0xb3f3('0x3'));var rp=require(_0xb3f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3f3('0x5'));var attributes=require(_0xb3f3('0x6'));module[_0xb3f3('0x7')]=function(_0x9fd66,_0x5bbd4c){return _0x9fd66['define'](_0xb3f3('0x8'),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 efafcff..25237ca 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 _0xf257=['http','request','then','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','debug','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xf257,0x82));var _0x7f25=function(_0x18a7c6,_0xf5e617){_0x18a7c6=_0x18a7c6-0x0;var _0x2eb5d4=_0xf257[_0x18a7c6];return _0x2eb5d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f25('0x0'));var BPromise=require(_0x7f25('0x1'));var rs=require(_0x7f25('0x2'));var fs=require('fs');var Redis=require(_0x7f25('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f25('0x4'));var logger=require(_0x7f25('0x5'))(_0x7f25('0x6'));var config=require(_0x7f25('0x7'));var jayson=require(_0x7f25('0x8'));var client=jayson[_0x7f25('0x9')][_0x7f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242a3e,_0x369a09,_0x16e278){return new BPromise(function(_0x31a5d8,_0x1ae607){return client[_0x7f25('0xb')](_0x242a3e,_0x16e278)[_0x7f25('0xc')](function(_0x57ba17){logger[_0x7f25('0xd')](_0x7f25('0xe'),_0x369a09,'request\x20sent');logger['debug'](_0x7f25('0xf'),_0x369a09,'request\x20sent',JSON[_0x7f25('0x10')](_0x57ba17));if(_0x57ba17[_0x7f25('0x11')]){if(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x12')]===0x1f4){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')]['message']);return _0x1ae607(_0x57ba17['error'][_0x7f25('0x13')]);}logger['error'](_0x7f25('0xe'),_0x369a09,_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);return _0x31a5d8(_0x57ba17[_0x7f25('0x11')][_0x7f25('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x369a09,'request\x20sent');_0x31a5d8(_0x57ba17[_0x7f25('0x14')][_0x7f25('0x13')]);}})[_0x7f25('0x15')](function(_0x167363){logger[_0x7f25('0x11')](_0x7f25('0xe'),_0x369a09,_0x167363);_0x1ae607(_0x167363);});});}exports[_0x7f25('0x16')]=function(_0x26d4aa){var _0x5e0067=this;return new Promise(function(_0x23f30c,_0x1cd6c1){return db[_0x7f25('0x17')][_0x7f25('0x18')](_0x26d4aa[_0x7f25('0x19')],{'raw':_0x26d4aa[_0x7f25('0x1a')]?_0x26d4aa['options']['raw']===undefined?!![]:![]:!![]})[_0x7f25('0xc')](function(_0x57275e){logger[_0x7f25('0xd')](_0x7f25('0x16'),_0x26d4aa);logger[_0x7f25('0x1b')](_0x7f25('0x16'),_0x26d4aa,JSON[_0x7f25('0x10')](_0x57275e));_0x23f30c(_0x57275e);})[_0x7f25('0x15')](function(_0x31bf5f){logger['error'](_0x7f25('0x16'),_0x31bf5f[_0x7f25('0x13')],_0x26d4aa);_0x1cd6c1(_0x5e0067[_0x7f25('0x11')](0x1f4,_0x31bf5f[_0x7f25('0x13')]));});});}; \ No newline at end of file +var _0x2c54=['options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','body'];(function(_0x5f20e0,_0x179500){var _0x3ac112=function(_0x1ea44d){while(--_0x1ea44d){_0x5f20e0['push'](_0x5f20e0['shift']());}};_0x3ac112(++_0x179500);}(_0x2c54,0x136));var _0x42c5=function(_0x2ef57c,_0x32cfd6){_0x2ef57c=_0x2ef57c-0x0;var _0x3ce380=_0x2c54[_0x2ef57c];return _0x3ce380;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c5('0x3'));var fs=require('fs');var Redis=require(_0x42c5('0x4'));var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x42c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1959c1,_0x44516e,_0x38d528){return new BPromise(function(_0x134cb6,_0x14538f){return client[_0x42c5('0xa')](_0x1959c1,_0x38d528)[_0x42c5('0xb')](function(_0x3ca4de){logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,_0x42c5('0xe'));logger[_0x42c5('0xf')](_0x42c5('0x10'),_0x44516e,_0x42c5('0xe'),JSON[_0x42c5('0x11')](_0x3ca4de));if(_0x3ca4de[_0x42c5('0x12')]){if(_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x13')]===0x1f4){logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x14538f(_0x3ca4de['error']['message']);}logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x134cb6(_0x3ca4de['error'][_0x42c5('0x14')]);}else{logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,'request\x20sent');_0x134cb6(_0x3ca4de[_0x42c5('0x15')]['message']);}})['catch'](function(_0x466b47){logger['error']('Attachment,\x20%s,\x20%s',_0x44516e,_0x466b47);_0x14538f(_0x466b47);});});}exports[_0x42c5('0x16')]=function(_0x3a2115){var _0x10e31e=this;return new Promise(function(_0x3f4172,_0x431f4e){return db[_0x42c5('0x17')][_0x42c5('0x18')](_0x3a2115[_0x42c5('0x19')],{'raw':_0x3a2115[_0x42c5('0x1a')]?_0x3a2115[_0x42c5('0x1a')][_0x42c5('0x1b')]===undefined?!![]:![]:!![]})[_0x42c5('0xb')](function(_0x11c6e8){logger[_0x42c5('0xc')]('CreateAttachment',_0x3a2115);logger[_0x42c5('0xf')](_0x42c5('0x16'),_0x3a2115,JSON[_0x42c5('0x11')](_0x11c6e8));_0x3f4172(_0x11c6e8);})['catch'](function(_0x245e72){logger[_0x42c5('0x12')]('CreateAttachment',_0x245e72[_0x42c5('0x14')],_0x3a2115);_0x431f4e(_0x10e31e[_0x42c5('0x12')](0x1f4,_0x245e72[_0x42c5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 995b0e6..2dd1215 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1af655,_0x28b928){_0x1af655=_0x1af655-0x0;var _0x29da01=_0x0b0e[_0x1af655];return _0x29da01;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x225aa6,_0x20aee5){_0x225aa6=_0x225aa6-0x0;var _0x2ec135=_0xdb28[_0x225aa6];return _0x2ec135;};'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('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index f35f4e9..2b46f27 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 _0xe0a4=['bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blockedAt','online','admin','user','agent','disabled','blocked','add','minutes','clearBlockUser','getLicense','catch','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','Strategy','activedirectory2'];(function(_0x5d7abc,_0x4bbc98){var _0x536e72=function(_0x47d01e){while(--_0x47d01e){_0x5d7abc['push'](_0x5d7abc['shift']());}};_0x536e72(++_0x4bbc98);}(_0xe0a4,0x18d));var _0x4e0a=function(_0x4eaf8a,_0x134b6c){_0x4eaf8a=_0x4eaf8a-0x0;var _0x217d22=_0xe0a4[_0x4eaf8a];return _0x217d22;};'use strict';var passport=require(_0x4e0a('0x0'));var LocalStrategy=require('passport-local')[_0x4e0a('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x4e0a('0x2'));var BPromise=require(_0x4e0a('0x3'));var util=require(_0x4e0a('0x4'));var db=require(_0x4e0a('0x5'))['db'];var authService=require(_0x4e0a('0x6'));var utils=require(_0x4e0a('0x7'));var config=require(_0x4e0a('0x8'));var logger=require(_0x4e0a('0x9'))(_0x4e0a('0xa'));function isActiveDirectoryConfigured(_0x14b516){var _0x893320=![];if(typeof _0x14b516[_0x4e0a('0xb')]!==_0x4e0a('0xc')){_0x893320=_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xd')]&&_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xe')]&&_0x14b516[_0x4e0a('0xb')][_0x4e0a('0xf')];}return _0x893320;}function adAuthenticate(_0x25a87a,_0x3b18f7,_0x4559bf){return new BPromise(function(_0x4e8d1b,_0x23d040){try{var _0x1d4ff1=new ActiveDirectory(_0x25a87a);_0x1d4ff1[_0x4e0a('0x10')](_0x3b18f7,_0x4559bf,function(_0x4789f0,_0x24ade1){if(_0x4789f0){logger[_0x4e0a('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x3b18f7,util[_0x4e0a('0x12')](_0x4789f0,{'showHidden':![],'depth':null}));_0x23d040(_0x4e0a('0x13'));}else if(!_0x24ade1){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3b18f7);_0x23d040(_0x4e0a('0x13'));}else{_0x4e8d1b(_0x24ade1);}});}catch(_0x3a7edd){_0x23d040(_0x3a7edd);}});}function ActiveDirectoryAuthenticate(_0x323200,_0x5faa38,_0x51a3a8,_0x552f30){var _0x209bd8,_0x573cde;if(!isActiveDirectoryConfigured(config)){logger[_0x4e0a('0x11')](_0x4e0a('0x14'),_0x5faa38);return _0x552f30(null,![],{'message':_0x4e0a('0x13')});}return db[_0x4e0a('0x15')]['findOne']({'where':{'id':0x1},'attributes':[_0x4e0a('0x16'),_0x4e0a('0x17')],'raw':!![]})[_0x4e0a('0x18')](function(_0x20e7ef){_0x209bd8=_0x20e7ef;if(!_0x209bd8[_0x4e0a('0x16')]){logger[_0x4e0a('0x11')](_0x4e0a('0x19'),_0x5faa38);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x323200['findOne']({'attributes':['id',_0x4e0a('0x1a'),_0x4e0a('0x1b'),_0x4e0a('0x1c'),_0x4e0a('0x1d'),'disabled','blocked',_0x4e0a('0x1e'),_0x4e0a('0x1f')],'where':{'name':_0x5faa38,'role':{'$or':[_0x4e0a('0x20'),_0x4e0a('0x21'),_0x4e0a('0x22')]},'adSsoEnabled':!![]}});})[_0x4e0a('0x18')](function(_0xcd1b5d){if(!_0xcd1b5d||_0xcd1b5d&&_0xcd1b5d[_0x4e0a('0x1a')]!==_0x5faa38){throw new Error(_0x4e0a('0x13'));}_0x573cde=_0xcd1b5d;var _0xd8e61f=_0x573cde[_0x4e0a('0x1a')]+'@'+config[_0x4e0a('0xb')]['domain'];return adAuthenticate(config[_0x4e0a('0xb')],_0xd8e61f,_0x51a3a8);})['then'](function(_0x2c7b17){if(_0x573cde[_0x4e0a('0x23')]){throw new Error(_0x4e0a('0x13'));}if(_0x209bd8[_0x4e0a('0x17')]>0x0){if(_0x573cde[_0x4e0a('0x24')]){if(moment(_0x573cde[_0x4e0a('0x1e')])[_0x4e0a('0x25')](_0x209bd8[_0x4e0a('0x17')],_0x4e0a('0x26'))>moment()){throw new Error(_0x4e0a('0x13'));}return utils[_0x4e0a('0x27')](_0x573cde,0x0,![],null)[_0x4e0a('0x18')](function(){return utils[_0x4e0a('0x28')](_0x573cde);})[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}else{return utils['getLicense'](_0x573cde)[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}}else{return utils['getLicense'](_0x573cde)[_0x4e0a('0x18')](function(){return _0x552f30(null,_0x573cde);});}})[_0x4e0a('0x29')](function(_0x5646e3){return _0x552f30(null,![],_0x5646e3);});}function handleError(_0x57634f,_0x22df2f,_0x5f02d7){return _0x57634f['status'](_0x22df2f||0x1f4)['send']({'message':_0x5f02d7?_0x5f02d7[_0x4e0a('0x2a')]||_0x5f02d7:''});}exports[_0x4e0a('0x2b')]=function(_0x4a3791,_0x4f20f4,_0x320f9c){passport[_0x4e0a('0x10')](_0x4e0a('0x2c'),function(_0x5f0b53,_0x19c551,_0x50f14f){var _0x1c6909=_0x5f0b53||_0x50f14f;if(_0x1c6909){return handleError(_0x4f20f4,0x191,_0x1c6909);}if(!_0x19c551){return handleError(_0x4f20f4,0x194,{'message':_0x4e0a('0x2d')});}else{var _0x41a5b2={'payload':{'id':_0x19c551['id'],'role':_0x19c551[_0x4e0a('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x4e0a('0x2e')](_0x41a5b2)[_0x4e0a('0x18')](function(_0x263d2e){_0x4f20f4[_0x4e0a('0x2f')]({'id':_0x19c551['id'],'token':_0x263d2e,'statusCall':'','isAlreadyLogged':_0x19c551[_0x4e0a('0x1f')]});});}})(_0x4a3791,_0x4f20f4,_0x320f9c);};passport[_0x4e0a('0x30')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x4e0a('0x1b')},function(_0x2e8840,_0x21d708,_0x3d35f2){return ActiveDirectoryAuthenticate(db[_0x4e0a('0x31')],_0x2e8840,_0x21d708,_0x3d35f2);})); \ No newline at end of file +var _0xf513=['send','message','login','role','signToken','json','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','blockedAt','admin','agent','disabled','add','minutes','getLicense','catch','status'];(function(_0x588102,_0x238290){var _0x506043=function(_0x4117bd){while(--_0x4117bd){_0x588102['push'](_0x588102['shift']());}};_0x506043(++_0x238290);}(_0xf513,0x181));var _0x3f51=function(_0x4c9a33,_0xbb4131){_0x4c9a33=_0x4c9a33-0x0;var _0x410e91=_0xf513[_0x4c9a33];return _0x410e91;};'use strict';var passport=require(_0x3f51('0x0'));var LocalStrategy=require(_0x3f51('0x1'))[_0x3f51('0x2')];var moment=require(_0x3f51('0x3'));var ActiveDirectory=require(_0x3f51('0x4'));var BPromise=require(_0x3f51('0x5'));var util=require('util');var db=require(_0x3f51('0x6'))['db'];var authService=require(_0x3f51('0x7'));var utils=require(_0x3f51('0x8'));var config=require(_0x3f51('0x9'));var logger=require(_0x3f51('0xa'))('api');function isActiveDirectoryConfigured(_0xdc7974){var _0x39fcac=![];if(typeof _0xdc7974[_0x3f51('0xb')]!=='undefined'){_0x39fcac=_0xdc7974[_0x3f51('0xb')][_0x3f51('0xc')]&&_0xdc7974['activedirectory'][_0x3f51('0xd')]&&_0xdc7974[_0x3f51('0xb')][_0x3f51('0xe')];}return _0x39fcac;}function adAuthenticate(_0x47e8ff,_0x37ff17,_0x27e32b){return new BPromise(function(_0x56ffbd,_0x4087e1){try{var _0x3ea6d5=new ActiveDirectory(_0x47e8ff);_0x3ea6d5['authenticate'](_0x37ff17,_0x27e32b,function(_0x595072,_0x4d18b5){if(_0x595072){logger['error'](_0x3f51('0xf'),_0x37ff17,util[_0x3f51('0x10')](_0x595072,{'showHidden':![],'depth':null}));_0x4087e1(_0x3f51('0x11'));}else if(!_0x4d18b5){logger['error'](_0x3f51('0x12'),_0x37ff17);_0x4087e1(_0x3f51('0x11'));}else{_0x56ffbd(_0x4d18b5);}});}catch(_0x58551f){_0x4087e1(_0x58551f);}});}function ActiveDirectoryAuthenticate(_0x19f66f,_0x3a3f99,_0x390659,_0x433d16){var _0x465fc8,_0x402833;if(!isActiveDirectoryConfigured(config)){logger[_0x3f51('0x13')](_0x3f51('0x14'),_0x3a3f99);return _0x433d16(null,![],{'message':_0x3f51('0x11')});}return db['Setting'][_0x3f51('0x15')]({'where':{'id':0x1},'attributes':[_0x3f51('0x16'),_0x3f51('0x17')],'raw':!![]})[_0x3f51('0x18')](function(_0x5d7298){_0x465fc8=_0x5d7298;if(!_0x465fc8['adSsoEnabled']){logger['error'](_0x3f51('0x19'),_0x3a3f99);throw new Error(_0x3f51('0x11'));}return _0x19f66f[_0x3f51('0x15')]({'attributes':['id',_0x3f51('0x1a'),_0x3f51('0x1b'),_0x3f51('0x1c'),'role','disabled','blocked',_0x3f51('0x1d'),'online'],'where':{'name':_0x3a3f99,'role':{'$or':[_0x3f51('0x1e'),'user',_0x3f51('0x1f')]},'adSsoEnabled':!![]}});})[_0x3f51('0x18')](function(_0x36aefa){if(!_0x36aefa||_0x36aefa&&_0x36aefa[_0x3f51('0x1a')]!==_0x3a3f99){throw new Error(_0x3f51('0x11'));}_0x402833=_0x36aefa;var _0xcedb0d=_0x402833['name']+'@'+config[_0x3f51('0xb')]['domain'];return adAuthenticate(config[_0x3f51('0xb')],_0xcedb0d,_0x390659);})[_0x3f51('0x18')](function(_0x563232){if(_0x402833[_0x3f51('0x20')]){throw new Error(_0x3f51('0x11'));}if(_0x465fc8[_0x3f51('0x17')]>0x0){if(_0x402833['blocked']){if(moment(_0x402833[_0x3f51('0x1d')])[_0x3f51('0x21')](_0x465fc8['blockDuration'],_0x3f51('0x22'))>moment()){throw new Error(_0x3f51('0x11'));}return utils['clearBlockUser'](_0x402833,0x0,![],null)[_0x3f51('0x18')](function(){return utils[_0x3f51('0x23')](_0x402833);})['then'](function(){return _0x433d16(null,_0x402833);});}else{return utils[_0x3f51('0x23')](_0x402833)[_0x3f51('0x18')](function(){return _0x433d16(null,_0x402833);});}}else{return utils[_0x3f51('0x23')](_0x402833)[_0x3f51('0x18')](function(){return _0x433d16(null,_0x402833);});}})[_0x3f51('0x24')](function(_0x1b954f){return _0x433d16(null,![],_0x1b954f);});}function handleError(_0x2942c0,_0x4096b4,_0x3d0fee){return _0x2942c0[_0x3f51('0x25')](_0x4096b4||0x1f4)[_0x3f51('0x26')]({'message':_0x3d0fee?_0x3d0fee[_0x3f51('0x27')]||_0x3d0fee:''});}exports[_0x3f51('0x28')]=function(_0x51fd9f,_0x1c858d,_0x4b7ec4){passport['authenticate']('ad-login',function(_0x2ec8a8,_0x525ec1,_0x5ccf89){var _0x4a8654=_0x2ec8a8||_0x5ccf89;if(_0x4a8654){return handleError(_0x1c858d,0x191,_0x4a8654);}if(!_0x525ec1){return handleError(_0x1c858d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x298964={'payload':{'id':_0x525ec1['id'],'role':_0x525ec1[_0x3f51('0x29')]},'options':{'expiresIn':0x15180}};return authService[_0x3f51('0x2a')](_0x298964)[_0x3f51('0x18')](function(_0xe997d0){_0x1c858d[_0x3f51('0x2b')]({'id':_0x525ec1['id'],'token':_0xe997d0,'statusCall':'','isAlreadyLogged':_0x525ec1[_0x3f51('0x2c')]});});}})(_0x51fd9f,_0x1c858d,_0x4b7ec4);};passport[_0x3f51('0x2d')]('ad-login',new LocalStrategy({'usernameField':_0x3f51('0x1a'),'passwordField':_0x3f51('0x1b')},function(_0x374aa2,_0x2cbfc5,_0x236e2a){return ActiveDirectoryAuthenticate(db[_0x3f51('0x2e')],_0x374aa2,_0x2cbfc5,_0x236e2a);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 08fb0aa..ff53cac 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 _0xd89d=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0x5acac3,_0x3d7346){var _0x243e59=function(_0x39e045){while(--_0x39e045){_0x5acac3['push'](_0x5acac3['shift']());}};_0x243e59(++_0x3d7346);}(_0xd89d,0x14f));var _0xdd89=function(_0x3c2ec1,_0x271c28){_0x3c2ec1=_0x3c2ec1-0x0;var _0x5467e5=_0xd89d[_0x3c2ec1];return _0x5467e5;};'use strict';var express=require(_0xdd89('0x0'));var router=express[_0xdd89('0x1')]();var controller=require(_0xdd89('0x2'));router[_0xdd89('0x3')]('/',controller[_0xdd89('0x4')]);module[_0xdd89('0x5')]=router; \ No newline at end of file +var _0x899a=['./authActiveDirectory.controller','login','exports','express','Router'];(function(_0x26b817,_0x4b84b8){var _0x1f1ad5=function(_0x5192dc){while(--_0x5192dc){_0x26b817['push'](_0x26b817['shift']());}};_0x1f1ad5(++_0x4b84b8);}(_0x899a,0x184));var _0xa899=function(_0x3a2255,_0x230b4d){_0x3a2255=_0x3a2255-0x0;var _0x291af5=_0x899a[_0x3a2255];return _0x291af5;};'use strict';var express=require(_0xa899('0x0'));var router=express[_0xa899('0x1')]();var controller=require(_0xa899('0x2'));router['post']('/',controller[_0xa899('0x3')]);module[_0xa899('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 2f8365b..9a0a816 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(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x7a54,0x106));var _0x47a5=function(_0x28baf3,_0x565c8f){_0x28baf3=_0x28baf3-0x0;var _0x2857e9=_0x7a54[_0x28baf3];return _0x2857e9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x4bbf24,_0x27bfec){var _0x3de35d=function(_0x115a42){while(--_0x115a42){_0x4bbf24['push'](_0x4bbf24['shift']());}};_0x3de35d(++_0x27bfec);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 5caa55e..1593e19 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 _0x4a99=['login','setTokenCookie','express','./authGoogle.controller','../user/user.controller.js','get','/callback','callback'];(function(_0x5f05af,_0x4d1040){var _0x4fc2d8=function(_0x48fef5){while(--_0x48fef5){_0x5f05af['push'](_0x5f05af['shift']());}};_0x4fc2d8(++_0x4d1040);}(_0x4a99,0x1aa));var _0x94a9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x4a99[_0x376b45];return _0x2341b3;};'use strict';var express=require(_0x94a9('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x94a9('0x1'));var userController=require(_0x94a9('0x2'));var authService=require('../../components/auth/service');router[_0x94a9('0x3')]('/',controller['login']);router[_0x94a9('0x3')](_0x94a9('0x4'),controller[_0x94a9('0x5')],authService['isMiddleware'],userController[_0x94a9('0x6')],authService[_0x94a9('0x7')]);module['exports']=router; \ No newline at end of file +var _0xc4dd=['exports','passport','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','setTokenCookie'];(function(_0x16151b,_0x1b89ff){var _0x285555=function(_0x432f56){while(--_0x432f56){_0x16151b['push'](_0x16151b['shift']());}};_0x285555(++_0x1b89ff);}(_0xc4dd,0x1cd));var _0xdc4d=function(_0x57d72f,_0xf27a3c){_0x57d72f=_0x57d72f-0x0;var _0x3c439e=_0xc4dd[_0x57d72f];return _0x3c439e;};'use strict';var express=require('express');var passport=require(_0xdc4d('0x0'));var router=express[_0xdc4d('0x1')]();var controller=require(_0xdc4d('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0xdc4d('0x3'));router[_0xdc4d('0x4')]('/',controller[_0xdc4d('0x5')]);router[_0xdc4d('0x4')](_0xdc4d('0x6'),controller[_0xdc4d('0x7')],authService['isMiddleware'],userController['login'],authService[_0xdc4d('0x8')]);module[_0xdc4d('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 66403ed..04393e6 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 _0x988c=['json','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x988c,0x15d));var _0xc988=function(_0xaca4df,_0x536f61){_0xaca4df=_0xaca4df-0x0;var _0x3c7916=_0x988c[_0xaca4df];return _0x3c7916;};'use strict';var util=require('util');var passport=require(_0xc988('0x0'));var LocalStrategy=require(_0xc988('0x1'))[_0xc988('0x2')];var jayson=require(_0xc988('0x3'));var _=require('lodash');var rs=require(_0xc988('0x4'));var moment=require(_0xc988('0x5'));var db=require(_0xc988('0x6'))['db'];var authService=require(_0xc988('0x7'));var utils=require(_0xc988('0x8'));var client=jayson[_0xc988('0x9')][_0xc988('0xa')]({'port':0x232b});function localAuthenticate(_0x30dec3,_0x2743b3,_0x10ff6c,_0x5423aa){var _0x54308a,_0x55e64f;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc988('0xb')],'raw':!![]})[_0xc988('0xc')](function(_0x2fcd35){_0x54308a=_0x2fcd35;return _0x30dec3[_0xc988('0xd')]({'attributes':['id',_0xc988('0xe'),_0xc988('0xf'),_0xc988('0x10'),_0xc988('0x11'),_0xc988('0x12'),_0xc988('0x13'),_0xc988('0x14'),_0xc988('0x15')],'where':{'name':_0x2743b3,'role':{'$or':[_0xc988('0x16'),_0xc988('0x17'),_0xc988('0x18')]}}});})['then'](function(_0x489a32){if(!_0x489a32||_0x489a32&&_0x489a32[_0xc988('0xe')]!==_0x2743b3){throw new Error(_0xc988('0x19'));}else{_0x55e64f=_0x489a32;return _0x55e64f;}})[_0xc988('0xc')](function(){_0x55e64f['authenticate'](_0x10ff6c,function(_0x5456cd,_0x1bc3c0){var _0x4b2698=_0x55e64f[_0xc988('0x15')]+0x1;if(_0x5456cd){return _0x5423aa(_0x5456cd);}else if(!_0x1bc3c0){if(_0x55e64f[_0xc988('0x12')]){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else if(_0x54308a[_0xc988('0x1a')]>0x0){if(_0x55e64f[_0xc988('0x13')]){if(_0x54308a[_0xc988('0xb')]>0x0){if(moment(_0x55e64f[_0xc988('0x14')])[_0xc988('0x1b')](_0x54308a[_0xc988('0xb')],_0xc988('0x1c'))>moment()){return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc988('0x1d')](_0x55e64f,_0x4b2698,![],null)[_0xc988('0xc')](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}}else{return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4b2698>=_0x54308a[_0xc988('0x1a')]){return utils[_0xc988('0x1d')](_0x55e64f,0x0,!![],moment())['then'](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}else{return utils[_0xc988('0x1d')](_0x55e64f,_0x4b2698,![],null)[_0xc988('0xc')](function(){return _0x5423aa(null,![],{'message':_0xc988('0x19')});});}}}else{return _0x5423aa(null,![],{'message':_0xc988('0x19')});}}else{if(_0x55e64f[_0xc988('0x12')]){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else if(_0x54308a[_0xc988('0x1a')]>0x0){if(_0x55e64f[_0xc988('0x13')]){if(_0x54308a[_0xc988('0xb')]>0x0){if(moment(_0x55e64f['blockedAt'])[_0xc988('0x1b')](_0x54308a['blockDuration'],_0xc988('0x1c'))>moment()){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else{return utils['clearBlockUser'](_0x55e64f,0x0,![],null)[_0xc988('0xc')](function(){return utils['getLicense'](_0x55e64f);})[_0xc988('0xc')](function(){return _0x5423aa(null,_0x55e64f);});}}else{return _0x5423aa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xc988('0x1d')](_0x55e64f,0x0,![],null)[_0xc988('0xc')](function(){return utils[_0xc988('0x1e')](_0x55e64f);})['then'](function(){return _0x5423aa(null,_0x55e64f);})['catch'](function(_0x1485cd){return _0x5423aa(null,![],_0x1485cd);});}}else{if(_0x55e64f['blocked']){return _0x5423aa(null,![],{'message':_0xc988('0x19')});}else{return utils[_0xc988('0x1e')](_0x55e64f)[_0xc988('0xc')](function(){return _0x5423aa(null,_0x55e64f);});}}}});})[_0xc988('0x1f')](function(_0x4f710f){return _0x5423aa(null,![],_0x4f710f);});}function sendServiceMail(_0x574828){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0xc988('0xe'),_0xc988('0x20')],'include':[{'model':db[_0xc988('0x21')],'as':_0xc988('0x22'),'include':[{'model':db[_0xc988('0x23')],'as':_0xc988('0x23')}]}]})['then'](function(_0x34f661){if(!_0x34f661){throw new Error(_0xc988('0x24'));}var _0x504bd0=_0x34f661['getSmtpOptions']();var _0x1a936a={'account':_0x504bd0,'message':_[_0xc988('0x25')]({'from':util[_0xc988('0x26')](_0xc988('0x27'),_0x34f661[_0xc988('0xe')],_0x34f661['email']||_0x34f661[_0xc988('0x22')][_0xc988('0x17')])},_0x574828)};return client[_0xc988('0x28')](_0xc988('0x29'),_0x1a936a);})[_0xc988('0xc')](function(_0x494e7f){if(_0x494e7f[_0xc988('0x2a')]){throw new Error(util[_0xc988('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x494e7f[_0xc988('0x2a')][_0xc988('0x2b')]||JSON[_0xc988('0x2c')](_0x494e7f[_0xc988('0x2a')])));}return!![];});}function handleError(_0x1724da,_0x50439c,_0x556ae9){return _0x1724da[_0xc988('0x2d')](_0x50439c||0x1f4)[_0xc988('0x2e')]({'message':_0x556ae9?_0x556ae9[_0xc988('0x2b')]||_0x556ae9:''});}exports[_0xc988('0x2f')]=function(_0x4cc441,_0x454b00,_0x222ba4){passport['authenticate'](_0xc988('0x30'),function(_0x48e550,_0x6dceb9,_0x3877de){var _0x3ad936=_0x48e550||_0x3877de;if(_0x3ad936){return handleError(_0x454b00,0x191,_0x3ad936);}if(!_0x6dceb9){return handleError(_0x454b00,0x194,{'message':_0xc988('0x31')});}else{var _0x71199={'payload':{'id':_0x6dceb9['id'],'role':_0x6dceb9[_0xc988('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xc988('0x32')](_0x71199)[_0xc988('0xc')](function(_0xb71049){_0x454b00[_0xc988('0x33')]({'id':_0x6dceb9['id'],'token':_0xb71049,'statusCall':'','isAlreadyLogged':_0x6dceb9[_0xc988('0x34')]});});}})(_0x4cc441,_0x454b00,_0x222ba4);};exports['forgot']=function(_0x30f3b4,_0x3aea01){if(!_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]){return handleError(_0x3aea01,0x1f4,{'message':_0xc988('0x36')});}var _0x589789=rs['generate']();_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]=_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')][_0xc988('0x37')]()[_0xc988('0x38')]();var _0x2a6b49;return db[_0xc988('0x39')][_0xc988('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc988('0xb')],'raw':!![]})['then'](function(_0x48415a){_0x2a6b49=_0x48415a;return db[_0xc988('0x3a')]['find']({'where':{'email':_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')]}});})['then'](function(_0xfb97e){if(!_0xfb97e){throw new Error(_0xc988('0x3b'));}if(_0xfb97e[_0xc988('0x12')]){throw new Error(_0xc988('0x3c'));}if(_0xfb97e[_0xc988('0x13')]){if(moment(_0xfb97e[_0xc988('0x14')])[_0xc988('0x1b')](_0x2a6b49[_0xc988('0xb')],_0xc988('0x1c'))>moment()){throw new Error(_0xc988('0x3d'));}else{_0xfb97e[_0xc988('0x13')]=![];_0xfb97e[_0xc988('0x14')]=null;}}_0xfb97e['resetPasswordToken']=_0x589789;_0xfb97e[_0xc988('0x3e')]=Date[_0xc988('0x3f')]()+0x36ee80;return _0xfb97e['save']();})[_0xc988('0xc')](function(){return sendServiceMail({'to':_0x30f3b4[_0xc988('0x35')][_0xc988('0x20')],'subject':_0xc988('0x40'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xc988('0x41')+_0xc988('0x42')+_0x30f3b4[_0xc988('0x43')][_0xc988('0x44')]+_0xc988('0x45')+_0x589789+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xc988('0xc')](function(){_0x3aea01[_0xc988('0x2d')](0xc8)[_0xc988('0x2e')]({'message':_0xc988('0x46')});})[_0xc988('0x1f')](function(_0x54d8fc){return handleError(_0x3aea01,0x1f4,_0x54d8fc);});};exports['reset']=function(_0x5c2a58,_0x4eb7e4){return db[_0xc988('0x3a')]['find']({'where':{'resetPasswordToken':_0x5c2a58[_0xc988('0x47')][_0xc988('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x25cda0){if(!_0x25cda0){throw new Error(_0xc988('0x49'));}return db[_0xc988('0x39')][_0xc988('0xd')]({'attributes':['id',_0xc988('0x4a'),'enforcePasswordHistory',_0xc988('0x4b')]})[_0xc988('0xc')](function(_0x265474){if(_0x265474['securePassword'])authService[_0xc988('0x4c')](_0x5c2a58['body'][_0xc988('0xf')]);if(!_0x265474['enforcePasswordHistory']||!_0x25cda0[_0xc988('0x4d')])return _0x25cda0;authService[_0xc988('0x4e')](_0x5c2a58[_0xc988('0x35')][_0xc988('0xf')],_0x25cda0[_0xc988('0x4d')],_0x265474['passwordHistoryLimit']);return _0x25cda0;})[_0xc988('0xc')](function(){_0x25cda0[_0xc988('0xf')]=_0x5c2a58[_0xc988('0x35')][_0xc988('0xf')];_0x25cda0['resetPasswordToken']=null;_0x25cda0[_0xc988('0x3e')]=null;return _0x25cda0['save']();});})[_0xc988('0xc')](function(){_0x4eb7e4[_0xc988('0x2d')](0xc8)[_0xc988('0x2e')]({'message':_0xc988('0x4f')});})[_0xc988('0x1f')](function(_0x2e92be){return handleError(_0x4eb7e4,0x1f4,_0x2e92be);});};passport['use'](_0xc988('0x30'),new LocalStrategy({'usernameField':_0xc988('0xe'),'passwordField':'password'},function(_0x5879c5,_0x79d09f,_0x41130f){return localAuthenticate(db['User'],_0x5879c5,_0x79d09f,_0x41130f);})); \ No newline at end of file +var _0xd150=['request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','catch','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','send','use','util','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','clearBlockUser','minutes','getLicense','MailAccount','find','name','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0xd150,0xd6));var _0x0d15=function(_0x53f264,_0x1f69e8){_0x53f264=_0x53f264-0x0;var _0x18c742=_0xd150[_0x53f264];return _0x18c742;};'use strict';var util=require(_0x0d15('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x0d15('0x1')];var jayson=require(_0x0d15('0x2'));var _=require(_0x0d15('0x3'));var rs=require('randomstring');var moment=require(_0x0d15('0x4'));var db=require(_0x0d15('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x0d15('0x6'));var client=jayson[_0x0d15('0x7')][_0x0d15('0x8')]({'port':0x232b});function localAuthenticate(_0x472ff9,_0x34c8fb,_0x264a75,_0xd9ab3a){var _0x1a2452,_0x2dc6a0;return db[_0x0d15('0x9')][_0x0d15('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0d15('0xb')],'raw':!![]})[_0x0d15('0xc')](function(_0x123767){_0x1a2452=_0x123767;return _0x472ff9[_0x0d15('0xa')]({'attributes':['id','name',_0x0d15('0xd'),'salt',_0x0d15('0xe'),_0x0d15('0xf'),_0x0d15('0x10'),_0x0d15('0x11'),_0x0d15('0x12')],'where':{'name':_0x34c8fb,'role':{'$or':[_0x0d15('0x13'),_0x0d15('0x14'),_0x0d15('0x15')]}}});})[_0x0d15('0xc')](function(_0x4cc1b5){if(!_0x4cc1b5||_0x4cc1b5&&_0x4cc1b5['name']!==_0x34c8fb){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2dc6a0=_0x4cc1b5;return _0x2dc6a0;}})[_0x0d15('0xc')](function(){_0x2dc6a0[_0x0d15('0x16')](_0x264a75,function(_0x1011c0,_0x405223){var _0x80ff08=_0x2dc6a0['loginAttempts']+0x1;if(_0x1011c0){return _0xd9ab3a(_0x1011c0);}else if(!_0x405223){if(_0x2dc6a0['disabled']){return _0xd9ab3a(null,![],{'message':_0x0d15('0x17')});}else if(_0x1a2452[_0x0d15('0x18')]>0x0){if(_0x2dc6a0[_0x0d15('0x10')]){if(_0x1a2452['blockDuration']>0x0){if(moment(_0x2dc6a0[_0x0d15('0x11')])[_0x0d15('0x19')](_0x1a2452[_0x0d15('0xb')],'minutes')>moment()){return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0d15('0x1a')](_0x2dc6a0,_0x80ff08,![],null)[_0x0d15('0xc')](function(){return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x80ff08>=_0x1a2452[_0x0d15('0x18')]){return utils[_0x0d15('0x1a')](_0x2dc6a0,0x0,!![],moment())[_0x0d15('0xc')](function(){return _0xd9ab3a(null,![],{'message':_0x0d15('0x17')});});}else{return utils['clearBlockUser'](_0x2dc6a0,_0x80ff08,![],null)[_0x0d15('0xc')](function(){return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2dc6a0['disabled']){return _0xd9ab3a(null,![],{'message':_0x0d15('0x17')});}else if(_0x1a2452[_0x0d15('0x18')]>0x0){if(_0x2dc6a0[_0x0d15('0x10')]){if(_0x1a2452[_0x0d15('0xb')]>0x0){if(moment(_0x2dc6a0[_0x0d15('0x11')])[_0x0d15('0x19')](_0x1a2452[_0x0d15('0xb')],_0x0d15('0x1b'))>moment()){return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2dc6a0,0x0,![],null)[_0x0d15('0xc')](function(){return utils[_0x0d15('0x1c')](_0x2dc6a0);})[_0x0d15('0xc')](function(){return _0xd9ab3a(null,_0x2dc6a0);});}}else{return _0xd9ab3a(null,![],{'message':_0x0d15('0x17')});}}else{return utils['clearBlockUser'](_0x2dc6a0,0x0,![],null)['then'](function(){return utils[_0x0d15('0x1c')](_0x2dc6a0);})[_0x0d15('0xc')](function(){return _0xd9ab3a(null,_0x2dc6a0);})['catch'](function(_0x258b8e){return _0xd9ab3a(null,![],_0x258b8e);});}}else{if(_0x2dc6a0[_0x0d15('0x10')]){return _0xd9ab3a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0d15('0x1c')](_0x2dc6a0)[_0x0d15('0xc')](function(){return _0xd9ab3a(null,_0x2dc6a0);});}}}});})['catch'](function(_0x3a3696){return _0xd9ab3a(null,![],_0x3a3696);});}function sendServiceMail(_0x280080){return db[_0x0d15('0x1d')][_0x0d15('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x0d15('0x1f'),_0x0d15('0x20')],'include':[{'model':db[_0x0d15('0x21')],'as':_0x0d15('0x22'),'include':[{'model':db[_0x0d15('0x23')],'as':_0x0d15('0x23')}]}]})[_0x0d15('0xc')](function(_0x20a856){if(!_0x20a856){throw new Error(_0x0d15('0x24'));}var _0x4d9c79=_0x20a856[_0x0d15('0x25')]();var _0x362401={'account':_0x4d9c79,'message':_[_0x0d15('0x26')]({'from':util[_0x0d15('0x27')](_0x0d15('0x28'),_0x20a856[_0x0d15('0x1f')],_0x20a856[_0x0d15('0x20')]||_0x20a856[_0x0d15('0x22')][_0x0d15('0x14')])},_0x280080)};return client[_0x0d15('0x29')]('SendMail',_0x362401);})[_0x0d15('0xc')](function(_0x5a3d07){if(_0x5a3d07[_0x0d15('0x2a')]){throw new Error(util[_0x0d15('0x27')](_0x0d15('0x2b'),_0x5a3d07[_0x0d15('0x2a')][_0x0d15('0x2c')]||JSON[_0x0d15('0x2d')](_0x5a3d07[_0x0d15('0x2a')])));}return!![];});}function handleError(_0x28c70f,_0x240040,_0x2deea4){return _0x28c70f['status'](_0x240040||0x1f4)['send']({'message':_0x2deea4?_0x2deea4[_0x0d15('0x2c')]||_0x2deea4:''});}exports[_0x0d15('0x2e')]=function(_0x49d55f,_0x5661d9,_0x3e1c42){passport['authenticate'](_0x0d15('0x2f'),function(_0x1d9a4d,_0x45218d,_0x3b4644){var _0x5dbe7b=_0x1d9a4d||_0x3b4644;if(_0x5dbe7b){return handleError(_0x5661d9,0x191,_0x5dbe7b);}if(!_0x45218d){return handleError(_0x5661d9,0x194,{'message':_0x0d15('0x30')});}else{var _0x30c388={'payload':{'id':_0x45218d['id'],'role':_0x45218d['role']},'options':{'expiresIn':0x15180}};return authService[_0x0d15('0x31')](_0x30c388)[_0x0d15('0xc')](function(_0x1c68f1){_0x5661d9[_0x0d15('0x32')]({'id':_0x45218d['id'],'token':_0x1c68f1,'statusCall':'','isAlreadyLogged':_0x45218d['online']});});}})(_0x49d55f,_0x5661d9,_0x3e1c42);};exports[_0x0d15('0x33')]=function(_0x355f21,_0x36fcec){if(!_0x355f21[_0x0d15('0x34')][_0x0d15('0x20')]){return handleError(_0x36fcec,0x1f4,{'message':_0x0d15('0x35')});}var _0x3578b4=rs['generate']();_0x355f21[_0x0d15('0x34')][_0x0d15('0x20')]=_0x355f21[_0x0d15('0x34')]['email'][_0x0d15('0x36')]()['toLowerCase']();var _0x1c4150;return db['Setting'][_0x0d15('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x0d15('0xc')](function(_0x2fc4c4){_0x1c4150=_0x2fc4c4;return db[_0x0d15('0x37')][_0x0d15('0x1e')]({'where':{'email':_0x355f21[_0x0d15('0x34')][_0x0d15('0x20')]}});})[_0x0d15('0xc')](function(_0x4a0b5c){if(!_0x4a0b5c){throw new Error(_0x0d15('0x38'));}if(_0x4a0b5c[_0x0d15('0xf')]){throw new Error(_0x0d15('0x39'));}if(_0x4a0b5c[_0x0d15('0x10')]){if(moment(_0x4a0b5c[_0x0d15('0x11')])[_0x0d15('0x19')](_0x1c4150[_0x0d15('0xb')],_0x0d15('0x1b'))>moment()){throw new Error(_0x0d15('0x3a'));}else{_0x4a0b5c[_0x0d15('0x10')]=![];_0x4a0b5c[_0x0d15('0x11')]=null;}}_0x4a0b5c['resetPasswordToken']=_0x3578b4;_0x4a0b5c[_0x0d15('0x3b')]=Date[_0x0d15('0x3c')]()+0x36ee80;return _0x4a0b5c[_0x0d15('0x3d')]();})[_0x0d15('0xc')](function(){return sendServiceMail({'to':_0x355f21[_0x0d15('0x34')][_0x0d15('0x20')],'subject':_0x0d15('0x3e'),'text':_0x0d15('0x3f')+_0x0d15('0x40')+_0x0d15('0x41')+_0x355f21['headers'][_0x0d15('0x42')]+_0x0d15('0x43')+_0x3578b4+'\x0a\x0a'+_0x0d15('0x44')});})[_0x0d15('0xc')](function(){_0x36fcec[_0x0d15('0x45')](0xc8)['send']({'message':_0x0d15('0x46')});})[_0x0d15('0x47')](function(_0x4cf1fc){return handleError(_0x36fcec,0x1f4,_0x4cf1fc);});};exports[_0x0d15('0x48')]=function(_0xbb6e1b,_0x4605b3){return db['User']['find']({'where':{'resetPasswordToken':_0xbb6e1b[_0x0d15('0x49')][_0x0d15('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x0d15('0x3c')]()}}})['then'](function(_0x387764){if(!_0x387764){throw new Error(_0x0d15('0x4b'));}return db[_0x0d15('0x9')][_0x0d15('0xa')]({'attributes':['id',_0x0d15('0x4c'),_0x0d15('0x4d'),'passwordHistoryLimit']})[_0x0d15('0xc')](function(_0x111e5f){if(_0x111e5f['securePassword'])authService[_0x0d15('0x4e')](_0xbb6e1b['body'][_0x0d15('0xd')]);if(!_0x111e5f[_0x0d15('0x4d')]||!_0x387764[_0x0d15('0x4f')])return _0x387764;authService[_0x0d15('0x50')](_0xbb6e1b['body'][_0x0d15('0xd')],_0x387764[_0x0d15('0x4f')],_0x111e5f[_0x0d15('0x51')]);return _0x387764;})['then'](function(){_0x387764['password']=_0xbb6e1b['body'][_0x0d15('0xd')];_0x387764[_0x0d15('0x52')]=null;_0x387764[_0x0d15('0x3b')]=null;return _0x387764[_0x0d15('0x3d')]();});})[_0x0d15('0xc')](function(){_0x4605b3[_0x0d15('0x45')](0xc8)[_0x0d15('0x53')]({'message':'Password\x20reset!'});})[_0x0d15('0x47')](function(_0x305b6c){return handleError(_0x4605b3,0x1f4,_0x305b6c);});};passport[_0x0d15('0x54')]('local-login',new LocalStrategy({'usernameField':_0x0d15('0x1f'),'passwordField':_0x0d15('0xd')},function(_0x2ddfbf,_0x3a0772,_0x402090){return localAuthenticate(db['User'],_0x2ddfbf,_0x3a0772,_0x402090);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b7fc52b..6282f89 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 _0x4144=['./authLocal.controller','post','/reset/:token','reset','exports','Router'];(function(_0x4b1347,_0x50e4df){var _0x29674c=function(_0x5eab1a){while(--_0x5eab1a){_0x4b1347['push'](_0x4b1347['shift']());}};_0x29674c(++_0x50e4df);}(_0x4144,0x17f));var _0x4414=function(_0xcb2e4f,_0x3bbb12){_0xcb2e4f=_0xcb2e4f-0x0;var _0x575cb5=_0x4144[_0xcb2e4f];return _0x575cb5;};'use strict';var express=require('express');var router=express[_0x4414('0x0')]();var controller=require(_0x4414('0x1'));router[_0x4414('0x2')]('/',controller['login']);router[_0x4414('0x2')]('/forgot',controller['forgot']);router[_0x4414('0x2')](_0x4414('0x3'),controller[_0x4414('0x4')]);module[_0x4414('0x5')]=router; \ No newline at end of file +var _0x67db=['exports','express','Router','post','login','/forgot','forgot'];(function(_0xbacfad,_0x52a356){var _0x32c2f9=function(_0x4fabec){while(--_0x4fabec){_0xbacfad['push'](_0xbacfad['shift']());}};_0x32c2f9(++_0x52a356);}(_0x67db,0x8d));var _0xb67d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x67db[_0x47aa64];return _0x549c7a;};'use strict';var express=require(_0xb67d('0x0'));var router=express[_0xb67d('0x1')]();var controller=require('./authLocal.controller');router[_0xb67d('0x2')]('/',controller[_0xb67d('0x3')]);router[_0xb67d('0x2')](_0xb67d('0x4'),controller[_0xb67d('0x5')]);router[_0xb67d('0x2')]('/reset/:token',controller['reset']);module[_0xb67d('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 572cafc..579983e 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 _0xdba8=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdba8,0x146));var _0x8dba=function(_0xfed2cc,_0x3d092b){_0xfed2cc=_0xfed2cc-0x0;var _0x1880ef=_0xdba8[_0xfed2cc];return _0x1880ef;};'use strict';var Sequelize=require(_0x8dba('0x0'));module[_0x8dba('0x1')]={'name':{'type':Sequelize[_0x8dba('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8dba('0x2')]},'description':{'type':Sequelize[_0x8dba('0x2')]},'status':{'type':Sequelize[_0x8dba('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8dba('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xcb7f=['sequelize','exports','STRING'];(function(_0x1da7f8,_0x3f70aa){var _0x1b11e3=function(_0x1f21e9){while(--_0x1f21e9){_0x1da7f8['push'](_0x1da7f8['shift']());}};_0x1b11e3(++_0x3f70aa);}(_0xcb7f,0x7b));var _0xfcb7=function(_0x5737df,_0x49e164){_0x5737df=_0x5737df-0x0;var _0x2456c6=_0xcb7f[_0x5737df];return _0x2456c6;};'use strict';var Sequelize=require(_0xfcb7('0x0'));module[_0xfcb7('0x1')]={'name':{'type':Sequelize[_0xfcb7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xfcb7('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index d7fc791..d12e282 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 _0x3e03=['type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','destroy','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','undefined','offset','count','set','Content-Range','reject','save','then','sendStatus','error','name','send','map','Automation','rawAttributes'];(function(_0x437e16,_0x155dd6){var _0x5f0594=function(_0x210613){while(--_0x210613){_0x437e16['push'](_0x437e16['shift']());}};_0x5f0594(++_0x155dd6);}(_0x3e03,0xd2));var _0x33e0=function(_0x5bff9e,_0x39ea3a){_0x5bff9e=_0x5bff9e-0x0;var _0x7f42ef=_0x3e03[_0x5bff9e];return _0x7f42ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x33e0('0x0'));var jsonpatch=require(_0x33e0('0x1'));var rp=require(_0x33e0('0x2'));var moment=require(_0x33e0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33e0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x33e0('0x5'));var csv=require(_0x33e0('0x6'));var ejs=require(_0x33e0('0x7'));var fs=require('fs');var fs_extra=require(_0x33e0('0x8'));var _=require('lodash');var squel=require(_0x33e0('0x9'));var crypto=require(_0x33e0('0xa'));var jsforce=require(_0x33e0('0xb'));var deskjs=require(_0x33e0('0xc'));var toCsv=require(_0x33e0('0x6'));var querystring=require(_0x33e0('0xd'));var Papa=require(_0x33e0('0xe'));var Redis=require(_0x33e0('0xf'));var authService=require(_0x33e0('0x10'));var qs=require(_0x33e0('0x11'));var as=require(_0x33e0('0x12'));var hardwareService=require(_0x33e0('0x13'));var logger=require(_0x33e0('0x14'))(_0x33e0('0x15'));var utils=require('../../config/utils');var config=require(_0x33e0('0x16'));var licenseUtil=require(_0x33e0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5214e0,_0x2fb430){_0x2fb430=_0x2fb430||0xcc;return function(_0x2b8a85){if(_0x2b8a85){return _0x5214e0['sendStatus'](_0x2fb430);}return _0x5214e0['status'](_0x2fb430)[_0x33e0('0x18')]();};}function respondWithResult(_0x448755,_0x3eacc0){_0x3eacc0=_0x3eacc0||0xc8;return function(_0x3dc8cb){if(_0x3dc8cb){return _0x448755[_0x33e0('0x19')](_0x3eacc0)[_0x33e0('0x1a')](_0x3dc8cb);}};}function respondWithFilteredResult(_0x3d120f,_0x486f34){return function(_0x3e33a4){if(_0x3e33a4){var _0x4bd25e=typeof _0x486f34['offset']===_0x33e0('0x1b')&&typeof _0x486f34['limit']===_0x33e0('0x1b');var _0x1aafb7=_0x3e33a4['count'];var _0x6ec072=_0x4bd25e?0x0:_0x486f34[_0x33e0('0x1c')];var _0x43017f=_0x4bd25e?_0x3e33a4[_0x33e0('0x1d')]:_0x486f34[_0x33e0('0x1c')]+_0x486f34['limit'];var _0x250001;if(_0x43017f>=_0x1aafb7){_0x43017f=_0x1aafb7;_0x250001=0xc8;}else{_0x250001=0xce;}_0x3d120f[_0x33e0('0x19')](_0x250001);return _0x3d120f[_0x33e0('0x1e')](_0x33e0('0x1f'),_0x6ec072+'-'+_0x43017f+'/'+_0x1aafb7)[_0x33e0('0x1a')](_0x3e33a4);}return null;};}function patchUpdates(_0xb0640c){return function(_0x4d7f4e){try{jsonpatch['apply'](_0x4d7f4e,_0xb0640c,!![]);}catch(_0x220a8b){return BPromise[_0x33e0('0x20')](_0x220a8b);}return _0x4d7f4e[_0x33e0('0x21')]();};}function saveUpdates(_0x5eb099,_0x5c6e07){return function(_0x5021c3){if(_0x5021c3){return _0x5021c3['update'](_0x5eb099)[_0x33e0('0x22')](function(_0x47bb2f){return _0x47bb2f;});}return null;};}function removeEntity(_0x5e618c,_0x4e9f97){return function(_0x35c9e1){if(_0x35c9e1){return _0x35c9e1['destroy']()[_0x33e0('0x22')](function(){_0x5e618c[_0x33e0('0x19')](0xcc)[_0x33e0('0x18')]();});}};}function handleEntityNotFound(_0x3bcc6a,_0x1a9106){return function(_0x42458c){if(!_0x42458c){_0x3bcc6a[_0x33e0('0x23')](0x194);}return _0x42458c;};}function handleError(_0x35d824,_0x591d77){_0x591d77=_0x591d77||0x1f4;return function(_0xe5234){logger[_0x33e0('0x24')](_0xe5234['stack']);if(_0xe5234[_0x33e0('0x25')]){delete _0xe5234[_0x33e0('0x25')];}_0x35d824[_0x33e0('0x19')](_0x591d77)[_0x33e0('0x26')](_0xe5234);};}exports['index']=function(_0x13c5cf,_0x45b429){var _0x344317={},_0xcc0e9a={},_0x56aef1={'count':0x0,'rows':[]};var _0x2ea991=_[_0x33e0('0x27')](db[_0x33e0('0x28')][_0x33e0('0x29')],function(_0x43458a){return{'name':_0x43458a['fieldName'],'type':_0x43458a[_0x33e0('0x2a')][_0x33e0('0x2b')]};});_0xcc0e9a[_0x33e0('0x2c')]=_[_0x33e0('0x27')](_0x2ea991,_0x33e0('0x25'));_0xcc0e9a['query']=_[_0x33e0('0x2d')](_0x13c5cf[_0x33e0('0x2e')]);_0xcc0e9a[_0x33e0('0x2f')]=_['intersection'](_0xcc0e9a[_0x33e0('0x2c')],_0xcc0e9a[_0x33e0('0x2e')]);_0x344317['attributes']=_[_0x33e0('0x30')](_0xcc0e9a['model'],qs['fields'](_0x13c5cf['query'][_0x33e0('0x31')]));_0x344317[_0x33e0('0x32')]=_0x344317['attributes'][_0x33e0('0x33')]?_0x344317[_0x33e0('0x32')]:_0xcc0e9a['model'];if(!_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x34')]('nolimit')){_0x344317[_0x33e0('0x35')]=qs['limit'](_0x13c5cf['query'][_0x33e0('0x35')]);_0x344317['offset']=qs['offset'](_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x1c')]);}_0x344317[_0x33e0('0x36')]=qs['sort'](_0x13c5cf[_0x33e0('0x2e')][_0x33e0('0x37')]);_0x344317[_0x33e0('0x38')]=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x13c5cf[_0x33e0('0x2e')],_0xcc0e9a['filters']),_0x2ea991);if(_0x13c5cf['query'][_0x33e0('0x3a')]){_0x344317['where']=_[_0x33e0('0x3b')](_0x344317[_0x33e0('0x38')],{'$or':_[_0x33e0('0x27')](_0x2ea991,function(_0x387029){if(_0x387029[_0x33e0('0x2a')]!==_0x33e0('0x3c')){var _0x100760={};_0x100760[_0x387029['name']]={'$like':'%'+_0x13c5cf['query']['filter']+'%'};return _0x100760;}})});}_0x344317=_[_0x33e0('0x3b')]({},_0x344317,_0x13c5cf[_0x33e0('0x3d')]);var _0x55e206={'where':_0x344317['where']};return db[_0x33e0('0x28')]['count'](_0x55e206)[_0x33e0('0x22')](function(_0x3e0c60){_0x56aef1[_0x33e0('0x1d')]=_0x3e0c60;if(_0x13c5cf['query']['includeAll']){_0x344317[_0x33e0('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x33e0('0x3f')](_0x344317);})['then'](function(_0x9b0952){_0x56aef1[_0x33e0('0x40')]=_0x9b0952;return _0x56aef1;})['then'](respondWithFilteredResult(_0x45b429,_0x344317))[_0x33e0('0x41')](handleError(_0x45b429,null));};exports[_0x33e0('0x42')]=function(_0x13ec54,_0x29d6cc){var _0x45533c={'raw':![],'where':{'id':_0x13ec54['params']['id']}},_0x3ef275={};_0x3ef275[_0x33e0('0x2c')]=_[_0x33e0('0x2d')](db[_0x33e0('0x28')][_0x33e0('0x29')]);_0x3ef275[_0x33e0('0x2e')]=_[_0x33e0('0x2d')](_0x13ec54[_0x33e0('0x2e')]);_0x3ef275[_0x33e0('0x2f')]=_['intersection'](_0x3ef275[_0x33e0('0x2c')],_0x3ef275['query']);_0x45533c[_0x33e0('0x32')]=_[_0x33e0('0x30')](_0x3ef275['model'],qs[_0x33e0('0x31')](_0x13ec54[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x45533c[_0x33e0('0x32')]=_0x45533c[_0x33e0('0x32')][_0x33e0('0x33')]?_0x45533c[_0x33e0('0x32')]:_0x3ef275[_0x33e0('0x2c')];if(_0x13ec54[_0x33e0('0x2e')][_0x33e0('0x43')]){_0x45533c[_0x33e0('0x3e')]=[{'all':!![]}];}_0x45533c=_[_0x33e0('0x3b')]({},_0x45533c,_0x13ec54['options']);return db[_0x33e0('0x28')][_0x33e0('0x44')](_0x45533c)[_0x33e0('0x22')](handleEntityNotFound(_0x29d6cc,null))['then'](respondWithResult(_0x29d6cc,null))[_0x33e0('0x41')](handleError(_0x29d6cc,null));};exports['create']=function(_0x42ed4d,_0x33af8b){return db[_0x33e0('0x28')][_0x33e0('0x45')](_0x42ed4d[_0x33e0('0x46')],{})[_0x33e0('0x22')](respondWithResult(_0x33af8b,0xc9))[_0x33e0('0x41')](handleError(_0x33af8b,null));};exports[_0x33e0('0x47')]=function(_0x57b569,_0x3f9abd){if(_0x57b569[_0x33e0('0x46')]['id']){delete _0x57b569['body']['id'];}return db[_0x33e0('0x28')][_0x33e0('0x44')]({'where':{'id':_0x57b569[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x3f9abd,null))[_0x33e0('0x22')](saveUpdates(_0x57b569[_0x33e0('0x46')],null))[_0x33e0('0x22')](respondWithResult(_0x3f9abd,null))[_0x33e0('0x41')](handleError(_0x3f9abd,null));};exports[_0x33e0('0x49')]=function(_0x17526c,_0x1ed1b4){return db[_0x33e0('0x28')][_0x33e0('0x44')]({'where':{'id':_0x17526c[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x1ed1b4,null))[_0x33e0('0x22')](removeEntity(_0x1ed1b4,null))[_0x33e0('0x41')](handleError(_0x1ed1b4,null));};exports[_0x33e0('0x4a')]=function(_0x29adf9,_0x54f3ed,_0xca7656){return db[_0x33e0('0x4b')][_0x33e0('0x44')]({'where':{'id':_0x29adf9[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x54f3ed,null))['then'](function(_0x1f6af1){if(_0x1f6af1){return _0x1f6af1[_0x33e0('0x4a')](_0x29adf9['body'][_0x33e0('0x4c')],_[_0x33e0('0x4d')](_0x29adf9[_0x33e0('0x46')],['ids','id'])||{});}})[_0x33e0('0x22')](respondWithResult(_0x54f3ed,null))[_0x33e0('0x41')](handleError(_0x54f3ed,null));};exports[_0x33e0('0x4e')]=function(_0x3d6741,_0x3bc1c5,_0xc79c61){var _0x49c1c0={};var _0x5e0242={};var _0x161480;var _0x1187f3;return db[_0x33e0('0x28')][_0x33e0('0x4f')]({'where':{'id':_0x3d6741[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x3bc1c5,null))[_0x33e0('0x22')](function(_0x54a829){if(_0x54a829){_0x161480=_0x54a829;_0x5e0242['model']=_[_0x33e0('0x2d')](db[_0x33e0('0x4b')]['rawAttributes']);_0x5e0242['query']=_[_0x33e0('0x2d')](_0x3d6741['query']);_0x5e0242[_0x33e0('0x2f')]=_[_0x33e0('0x30')](_0x5e0242[_0x33e0('0x2c')],_0x5e0242[_0x33e0('0x2e')]);_0x49c1c0[_0x33e0('0x32')]=_[_0x33e0('0x30')](_0x5e0242[_0x33e0('0x2c')],qs['fields'](_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x49c1c0[_0x33e0('0x32')]=_0x49c1c0['attributes']['length']?_0x49c1c0[_0x33e0('0x32')]:_0x5e0242[_0x33e0('0x2c')];_0x49c1c0[_0x33e0('0x36')]=qs['sort'](_0x3d6741['query'][_0x33e0('0x37')]);_0x49c1c0[_0x33e0('0x38')]=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x3d6741[_0x33e0('0x2e')],_0x5e0242[_0x33e0('0x2f')]));if(_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x3a')]){_0x49c1c0[_0x33e0('0x38')]=_[_0x33e0('0x3b')](_0x49c1c0[_0x33e0('0x38')],{'$or':_['map'](_0x49c1c0[_0x33e0('0x32')],function(_0x5a2b41){var _0x2ccb11={};_0x2ccb11[_0x5a2b41]={'$like':'%'+_0x3d6741[_0x33e0('0x2e')]['filter']+'%'};return _0x2ccb11;})});}_0x49c1c0=_[_0x33e0('0x3b')]({},_0x49c1c0,_0x3d6741[_0x33e0('0x3d')]);return _0x161480[_0x33e0('0x4e')](_0x49c1c0);}})[_0x33e0('0x22')](function(_0x2ab6ae){if(_0x2ab6ae){_0x1187f3=_0x2ab6ae[_0x33e0('0x33')];if(!_0x3d6741['query'][_0x33e0('0x34')](_0x33e0('0x50'))){_0x49c1c0[_0x33e0('0x35')]=qs['limit'](_0x3d6741[_0x33e0('0x2e')][_0x33e0('0x35')]);_0x49c1c0[_0x33e0('0x1c')]=qs[_0x33e0('0x1c')](_0x3d6741['query'][_0x33e0('0x1c')]);}return _0x161480['getConditions'](_0x49c1c0);}})[_0x33e0('0x22')](function(_0x41b9ed){if(_0x41b9ed){return _0x41b9ed?{'count':_0x1187f3,'rows':_0x41b9ed}:null;}})[_0x33e0('0x22')](respondWithResult(_0x3bc1c5,null))[_0x33e0('0x41')](handleError(_0x3bc1c5,null));};exports[_0x33e0('0x51')]=function(_0x469874,_0x4c05ad,_0x638c00){return db[_0x33e0('0x52')][_0x33e0('0x44')]({'where':{'id':_0x469874['params']['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x4c05ad,null))['then'](function(_0x266311){if(_0x266311){return _0x266311['addActions'](_0x469874['body'][_0x33e0('0x4c')],_[_0x33e0('0x4d')](_0x469874[_0x33e0('0x46')],[_0x33e0('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x4c05ad,null))['catch'](handleError(_0x4c05ad,null));};exports[_0x33e0('0x53')]=function(_0x78c5b5,_0x44796f,_0x378542){var _0x551c1a={};var _0x49e283={};var _0xbd8670;var _0x2f61fd;return db[_0x33e0('0x28')]['findOne']({'where':{'id':_0x78c5b5[_0x33e0('0x48')]['id']}})[_0x33e0('0x22')](handleEntityNotFound(_0x44796f,null))[_0x33e0('0x22')](function(_0x51bd58){if(_0x51bd58){_0xbd8670=_0x51bd58;_0x49e283['model']=_['keys'](db[_0x33e0('0x52')][_0x33e0('0x29')]);_0x49e283[_0x33e0('0x2e')]=_['keys'](_0x78c5b5['query']);_0x49e283[_0x33e0('0x2f')]=_['intersection'](_0x49e283[_0x33e0('0x2c')],_0x49e283['query']);_0x551c1a[_0x33e0('0x32')]=_['intersection'](_0x49e283[_0x33e0('0x2c')],qs[_0x33e0('0x31')](_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x31')]));_0x551c1a['attributes']=_0x551c1a['attributes']['length']?_0x551c1a[_0x33e0('0x32')]:_0x49e283['model'];_0x551c1a['order']=qs[_0x33e0('0x37')](_0x78c5b5['query'][_0x33e0('0x37')]);_0x551c1a['where']=qs[_0x33e0('0x2f')](_[_0x33e0('0x39')](_0x78c5b5['query'],_0x49e283[_0x33e0('0x2f')]));if(_0x78c5b5[_0x33e0('0x2e')]['filter']){_0x551c1a[_0x33e0('0x38')]=_[_0x33e0('0x3b')](_0x551c1a['where'],{'$or':_[_0x33e0('0x27')](_0x551c1a['attributes'],function(_0xe55ae5){var _0x1700ad={};_0x1700ad[_0xe55ae5]={'$like':'%'+_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x3a')]+'%'};return _0x1700ad;})});}_0x551c1a=_[_0x33e0('0x3b')]({},_0x551c1a,_0x78c5b5[_0x33e0('0x3d')]);return _0xbd8670[_0x33e0('0x53')](_0x551c1a);}})['then'](function(_0x1452cb){if(_0x1452cb){_0x2f61fd=_0x1452cb[_0x33e0('0x33')];if(!_0x78c5b5[_0x33e0('0x2e')]['hasOwnProperty']('nolimit')){_0x551c1a['limit']=qs['limit'](_0x78c5b5[_0x33e0('0x2e')][_0x33e0('0x35')]);_0x551c1a[_0x33e0('0x1c')]=qs[_0x33e0('0x1c')](_0x78c5b5['query'][_0x33e0('0x1c')]);}return _0xbd8670[_0x33e0('0x53')](_0x551c1a);}})[_0x33e0('0x22')](function(_0x13ca5c){if(_0x13ca5c){return _0x13ca5c?{'count':_0x2f61fd,'rows':_0x13ca5c}:null;}})['then'](respondWithResult(_0x44796f,null))[_0x33e0('0x41')](handleError(_0x44796f,null));}; \ No newline at end of file +var _0xba17=['count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','Automation','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','create','body','find','addConditions','ids','omit','getConditions','Condition','nolimit','addActions','getActions','findOne','Action','options','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset'];(function(_0xa5013c,_0x120b02){var _0x22555a=function(_0x23a518){while(--_0x23a518){_0xa5013c['push'](_0xa5013c['shift']());}};_0x22555a(++_0x120b02);}(_0xba17,0x18b));var _0x7ba1=function(_0x3737ee,_0x28571e){_0x3737ee=_0x3737ee-0x0;var _0x19edba=_0xba17[_0x3737ee];return _0x19edba;};'use strict';var emlformat=require(_0x7ba1('0x0'));var rimraf=require(_0x7ba1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ba1('0x2'));var rp=require(_0x7ba1('0x3'));var moment=require(_0x7ba1('0x4'));var BPromise=require(_0x7ba1('0x5'));var Mustache=require(_0x7ba1('0x6'));var util=require(_0x7ba1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7ba1('0x8'));var fs=require('fs');var fs_extra=require(_0x7ba1('0x9'));var _=require('lodash');var squel=require(_0x7ba1('0xa'));var crypto=require(_0x7ba1('0xb'));var jsforce=require(_0x7ba1('0xc'));var deskjs=require(_0x7ba1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ba1('0xe'));var Redis=require(_0x7ba1('0xf'));var authService=require(_0x7ba1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7ba1('0x11'));var hardwareService=require(_0x7ba1('0x12'));var logger=require(_0x7ba1('0x13'))('api');var utils=require(_0x7ba1('0x14'));var config=require(_0x7ba1('0x15'));var licenseUtil=require(_0x7ba1('0x16'));var db=require(_0x7ba1('0x17'))['db'];function respondWithStatusCode(_0xbca935,_0x2ce06c){_0x2ce06c=_0x2ce06c||0xcc;return function(_0x364e66){if(_0x364e66){return _0xbca935[_0x7ba1('0x18')](_0x2ce06c);}return _0xbca935[_0x7ba1('0x19')](_0x2ce06c)['end']();};}function respondWithResult(_0x315ab1,_0x5aa13e){_0x5aa13e=_0x5aa13e||0xc8;return function(_0x2dfa8b){if(_0x2dfa8b){return _0x315ab1[_0x7ba1('0x19')](_0x5aa13e)[_0x7ba1('0x1a')](_0x2dfa8b);}};}function respondWithFilteredResult(_0x2a4ac5,_0x2eafd9){return function(_0x497869){if(_0x497869){var _0x2c6bbc=typeof _0x2eafd9['offset']===_0x7ba1('0x1b')&&typeof _0x2eafd9[_0x7ba1('0x1c')]===_0x7ba1('0x1b');var _0x296b7e=_0x497869['count'];var _0x1cdf86=_0x2c6bbc?0x0:_0x2eafd9[_0x7ba1('0x1d')];var _0x4afc36=_0x2c6bbc?_0x497869[_0x7ba1('0x1e')]:_0x2eafd9['offset']+_0x2eafd9[_0x7ba1('0x1c')];var _0x3974df;if(_0x4afc36>=_0x296b7e){_0x4afc36=_0x296b7e;_0x3974df=0xc8;}else{_0x3974df=0xce;}_0x2a4ac5[_0x7ba1('0x19')](_0x3974df);return _0x2a4ac5['set'](_0x7ba1('0x1f'),_0x1cdf86+'-'+_0x4afc36+'/'+_0x296b7e)[_0x7ba1('0x1a')](_0x497869);}return null;};}function patchUpdates(_0x295d31){return function(_0x305b0b){try{jsonpatch[_0x7ba1('0x20')](_0x305b0b,_0x295d31,!![]);}catch(_0x3569b9){return BPromise[_0x7ba1('0x21')](_0x3569b9);}return _0x305b0b[_0x7ba1('0x22')]();};}function saveUpdates(_0x4918b7,_0x34d328){return function(_0x4a88f4){if(_0x4a88f4){return _0x4a88f4[_0x7ba1('0x23')](_0x4918b7)[_0x7ba1('0x24')](function(_0x29df6c){return _0x29df6c;});}return null;};}function removeEntity(_0x21b0a0,_0x4be7a3){return function(_0x44ce0c){if(_0x44ce0c){return _0x44ce0c[_0x7ba1('0x25')]()[_0x7ba1('0x24')](function(){_0x21b0a0[_0x7ba1('0x19')](0xcc)[_0x7ba1('0x26')]();});}};}function handleEntityNotFound(_0x521f2a,_0x27b26a){return function(_0x374be3){if(!_0x374be3){_0x521f2a[_0x7ba1('0x18')](0x194);}return _0x374be3;};}function handleError(_0x4485f4,_0x45d480){_0x45d480=_0x45d480||0x1f4;return function(_0x3a9ebe){logger[_0x7ba1('0x27')](_0x3a9ebe[_0x7ba1('0x28')]);if(_0x3a9ebe[_0x7ba1('0x29')]){delete _0x3a9ebe[_0x7ba1('0x29')];}_0x4485f4[_0x7ba1('0x19')](_0x45d480)['send'](_0x3a9ebe);};}exports[_0x7ba1('0x2a')]=function(_0x295aa7,_0x1ce15b){var _0x3dcae4={},_0x3045d5={},_0x217ff5={'count':0x0,'rows':[]};var _0xb8e424=_[_0x7ba1('0x2b')](db[_0x7ba1('0x2c')]['rawAttributes'],function(_0x4fdead){return{'name':_0x4fdead[_0x7ba1('0x2d')],'type':_0x4fdead['type'][_0x7ba1('0x2e')]};});_0x3045d5[_0x7ba1('0x2f')]=_[_0x7ba1('0x2b')](_0xb8e424,_0x7ba1('0x29'));_0x3045d5[_0x7ba1('0x30')]=_['keys'](_0x295aa7[_0x7ba1('0x30')]);_0x3045d5[_0x7ba1('0x31')]=_[_0x7ba1('0x32')](_0x3045d5['model'],_0x3045d5[_0x7ba1('0x30')]);_0x3dcae4['attributes']=_[_0x7ba1('0x32')](_0x3045d5['model'],qs[_0x7ba1('0x33')](_0x295aa7[_0x7ba1('0x30')]['fields']));_0x3dcae4[_0x7ba1('0x34')]=_0x3dcae4[_0x7ba1('0x34')]['length']?_0x3dcae4[_0x7ba1('0x34')]:_0x3045d5[_0x7ba1('0x2f')];if(!_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x35')]('nolimit')){_0x3dcae4['limit']=qs[_0x7ba1('0x1c')](_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x1c')]);_0x3dcae4['offset']=qs[_0x7ba1('0x1d')](_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x1d')]);}_0x3dcae4[_0x7ba1('0x36')]=qs[_0x7ba1('0x37')](_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x37')]);_0x3dcae4[_0x7ba1('0x38')]=qs['filters'](_[_0x7ba1('0x39')](_0x295aa7['query'],_0x3045d5[_0x7ba1('0x31')]),_0xb8e424);if(_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x3a')]){_0x3dcae4[_0x7ba1('0x38')]=_[_0x7ba1('0x3b')](_0x3dcae4[_0x7ba1('0x38')],{'$or':_[_0x7ba1('0x2b')](_0xb8e424,function(_0x55e3a1){if(_0x55e3a1[_0x7ba1('0x3c')]!=='VIRTUAL'){var _0x276c08={};_0x276c08[_0x55e3a1['name']]={'$like':'%'+_0x295aa7['query'][_0x7ba1('0x3a')]+'%'};return _0x276c08;}})});}_0x3dcae4=_['merge']({},_0x3dcae4,_0x295aa7['options']);var _0x267b52={'where':_0x3dcae4[_0x7ba1('0x38')]};return db[_0x7ba1('0x2c')][_0x7ba1('0x1e')](_0x267b52)[_0x7ba1('0x24')](function(_0x195a31){_0x217ff5[_0x7ba1('0x1e')]=_0x195a31;if(_0x295aa7[_0x7ba1('0x30')][_0x7ba1('0x3d')]){_0x3dcae4[_0x7ba1('0x3e')]=[{'all':!![]}];}return db[_0x7ba1('0x2c')][_0x7ba1('0x3f')](_0x3dcae4);})[_0x7ba1('0x24')](function(_0xd701b7){_0x217ff5[_0x7ba1('0x40')]=_0xd701b7;return _0x217ff5;})[_0x7ba1('0x24')](respondWithFilteredResult(_0x1ce15b,_0x3dcae4))[_0x7ba1('0x41')](handleError(_0x1ce15b,null));};exports[_0x7ba1('0x42')]=function(_0x1abfce,_0x5c352c){var _0x29f16b={'raw':![],'where':{'id':_0x1abfce[_0x7ba1('0x43')]['id']}},_0x52e4be={};_0x52e4be[_0x7ba1('0x2f')]=_[_0x7ba1('0x44')](db[_0x7ba1('0x2c')][_0x7ba1('0x45')]);_0x52e4be[_0x7ba1('0x30')]=_[_0x7ba1('0x44')](_0x1abfce[_0x7ba1('0x30')]);_0x52e4be[_0x7ba1('0x31')]=_[_0x7ba1('0x32')](_0x52e4be['model'],_0x52e4be[_0x7ba1('0x30')]);_0x29f16b[_0x7ba1('0x34')]=_[_0x7ba1('0x32')](_0x52e4be[_0x7ba1('0x2f')],qs[_0x7ba1('0x33')](_0x1abfce[_0x7ba1('0x30')][_0x7ba1('0x33')]));_0x29f16b[_0x7ba1('0x34')]=_0x29f16b[_0x7ba1('0x34')][_0x7ba1('0x46')]?_0x29f16b['attributes']:_0x52e4be[_0x7ba1('0x2f')];if(_0x1abfce[_0x7ba1('0x30')]['includeAll']){_0x29f16b[_0x7ba1('0x3e')]=[{'all':!![]}];}_0x29f16b=_[_0x7ba1('0x3b')]({},_0x29f16b,_0x1abfce['options']);return db['Automation']['find'](_0x29f16b)['then'](handleEntityNotFound(_0x5c352c,null))[_0x7ba1('0x24')](respondWithResult(_0x5c352c,null))[_0x7ba1('0x41')](handleError(_0x5c352c,null));};exports['create']=function(_0x3851eb,_0x5143bb){return db['Automation'][_0x7ba1('0x47')](_0x3851eb[_0x7ba1('0x48')],{})[_0x7ba1('0x24')](respondWithResult(_0x5143bb,0xc9))[_0x7ba1('0x41')](handleError(_0x5143bb,null));};exports['update']=function(_0x415ed6,_0x3c80c5){if(_0x415ed6[_0x7ba1('0x48')]['id']){delete _0x415ed6[_0x7ba1('0x48')]['id'];}return db['Automation'][_0x7ba1('0x49')]({'where':{'id':_0x415ed6[_0x7ba1('0x43')]['id']}})['then'](handleEntityNotFound(_0x3c80c5,null))[_0x7ba1('0x24')](saveUpdates(_0x415ed6['body'],null))[_0x7ba1('0x24')](respondWithResult(_0x3c80c5,null))['catch'](handleError(_0x3c80c5,null));};exports[_0x7ba1('0x25')]=function(_0x286db4,_0x1f426a){return db[_0x7ba1('0x2c')][_0x7ba1('0x49')]({'where':{'id':_0x286db4[_0x7ba1('0x43')]['id']}})[_0x7ba1('0x24')](handleEntityNotFound(_0x1f426a,null))['then'](removeEntity(_0x1f426a,null))['catch'](handleError(_0x1f426a,null));};exports[_0x7ba1('0x4a')]=function(_0x2d2a87,_0x1d44aa,_0x48c6c4){return db['Condition'][_0x7ba1('0x49')]({'where':{'id':_0x2d2a87[_0x7ba1('0x43')]['id']}})[_0x7ba1('0x24')](handleEntityNotFound(_0x1d44aa,null))[_0x7ba1('0x24')](function(_0xdd7a91){if(_0xdd7a91){return _0xdd7a91[_0x7ba1('0x4a')](_0x2d2a87[_0x7ba1('0x48')][_0x7ba1('0x4b')],_[_0x7ba1('0x4c')](_0x2d2a87['body'],[_0x7ba1('0x4b'),'id'])||{});}})[_0x7ba1('0x24')](respondWithResult(_0x1d44aa,null))[_0x7ba1('0x41')](handleError(_0x1d44aa,null));};exports[_0x7ba1('0x4d')]=function(_0x12c961,_0x3ef5d8,_0x59f585){var _0x384e89={};var _0x178ebc={};var _0x1dda8c;var _0xf1585f;return db['Automation']['findOne']({'where':{'id':_0x12c961[_0x7ba1('0x43')]['id']}})[_0x7ba1('0x24')](handleEntityNotFound(_0x3ef5d8,null))[_0x7ba1('0x24')](function(_0x59ca97){if(_0x59ca97){_0x1dda8c=_0x59ca97;_0x178ebc[_0x7ba1('0x2f')]=_[_0x7ba1('0x44')](db[_0x7ba1('0x4e')][_0x7ba1('0x45')]);_0x178ebc[_0x7ba1('0x30')]=_['keys'](_0x12c961['query']);_0x178ebc['filters']=_[_0x7ba1('0x32')](_0x178ebc[_0x7ba1('0x2f')],_0x178ebc['query']);_0x384e89[_0x7ba1('0x34')]=_[_0x7ba1('0x32')](_0x178ebc[_0x7ba1('0x2f')],qs[_0x7ba1('0x33')](_0x12c961[_0x7ba1('0x30')][_0x7ba1('0x33')]));_0x384e89[_0x7ba1('0x34')]=_0x384e89[_0x7ba1('0x34')][_0x7ba1('0x46')]?_0x384e89[_0x7ba1('0x34')]:_0x178ebc[_0x7ba1('0x2f')];_0x384e89[_0x7ba1('0x36')]=qs[_0x7ba1('0x37')](_0x12c961['query'][_0x7ba1('0x37')]);_0x384e89['where']=qs[_0x7ba1('0x31')](_[_0x7ba1('0x39')](_0x12c961[_0x7ba1('0x30')],_0x178ebc['filters']));if(_0x12c961[_0x7ba1('0x30')][_0x7ba1('0x3a')]){_0x384e89[_0x7ba1('0x38')]=_[_0x7ba1('0x3b')](_0x384e89[_0x7ba1('0x38')],{'$or':_['map'](_0x384e89[_0x7ba1('0x34')],function(_0x834f7a){var _0x40e0cf={};_0x40e0cf[_0x834f7a]={'$like':'%'+_0x12c961[_0x7ba1('0x30')][_0x7ba1('0x3a')]+'%'};return _0x40e0cf;})});}_0x384e89=_[_0x7ba1('0x3b')]({},_0x384e89,_0x12c961['options']);return _0x1dda8c['getConditions'](_0x384e89);}})['then'](function(_0x1a3a12){if(_0x1a3a12){_0xf1585f=_0x1a3a12[_0x7ba1('0x46')];if(!_0x12c961[_0x7ba1('0x30')]['hasOwnProperty'](_0x7ba1('0x4f'))){_0x384e89[_0x7ba1('0x1c')]=qs[_0x7ba1('0x1c')](_0x12c961[_0x7ba1('0x30')]['limit']);_0x384e89[_0x7ba1('0x1d')]=qs['offset'](_0x12c961[_0x7ba1('0x30')][_0x7ba1('0x1d')]);}return _0x1dda8c[_0x7ba1('0x4d')](_0x384e89);}})['then'](function(_0x41df6d){if(_0x41df6d){return _0x41df6d?{'count':_0xf1585f,'rows':_0x41df6d}:null;}})[_0x7ba1('0x24')](respondWithResult(_0x3ef5d8,null))['catch'](handleError(_0x3ef5d8,null));};exports[_0x7ba1('0x50')]=function(_0x2e9c07,_0x1f218b,_0x3dc6f8){return db['Action']['find']({'where':{'id':_0x2e9c07['params']['id']}})['then'](handleEntityNotFound(_0x1f218b,null))[_0x7ba1('0x24')](function(_0x21b049){if(_0x21b049){return _0x21b049[_0x7ba1('0x50')](_0x2e9c07['body'][_0x7ba1('0x4b')],_[_0x7ba1('0x4c')](_0x2e9c07[_0x7ba1('0x48')],['ids','id'])||{});}})[_0x7ba1('0x24')](respondWithResult(_0x1f218b,null))[_0x7ba1('0x41')](handleError(_0x1f218b,null));};exports[_0x7ba1('0x51')]=function(_0x545e32,_0x9fab0b,_0x387daa){var _0x25e9ff={};var _0x42e2f6={};var _0x112215;var _0x202d3b;return db['Automation'][_0x7ba1('0x52')]({'where':{'id':_0x545e32['params']['id']}})[_0x7ba1('0x24')](handleEntityNotFound(_0x9fab0b,null))[_0x7ba1('0x24')](function(_0x4083c1){if(_0x4083c1){_0x112215=_0x4083c1;_0x42e2f6[_0x7ba1('0x2f')]=_['keys'](db[_0x7ba1('0x53')][_0x7ba1('0x45')]);_0x42e2f6[_0x7ba1('0x30')]=_['keys'](_0x545e32[_0x7ba1('0x30')]);_0x42e2f6[_0x7ba1('0x31')]=_[_0x7ba1('0x32')](_0x42e2f6['model'],_0x42e2f6['query']);_0x25e9ff['attributes']=_[_0x7ba1('0x32')](_0x42e2f6[_0x7ba1('0x2f')],qs[_0x7ba1('0x33')](_0x545e32[_0x7ba1('0x30')][_0x7ba1('0x33')]));_0x25e9ff[_0x7ba1('0x34')]=_0x25e9ff[_0x7ba1('0x34')][_0x7ba1('0x46')]?_0x25e9ff[_0x7ba1('0x34')]:_0x42e2f6[_0x7ba1('0x2f')];_0x25e9ff['order']=qs[_0x7ba1('0x37')](_0x545e32[_0x7ba1('0x30')][_0x7ba1('0x37')]);_0x25e9ff[_0x7ba1('0x38')]=qs[_0x7ba1('0x31')](_[_0x7ba1('0x39')](_0x545e32[_0x7ba1('0x30')],_0x42e2f6['filters']));if(_0x545e32[_0x7ba1('0x30')][_0x7ba1('0x3a')]){_0x25e9ff['where']=_[_0x7ba1('0x3b')](_0x25e9ff[_0x7ba1('0x38')],{'$or':_['map'](_0x25e9ff[_0x7ba1('0x34')],function(_0x9700b2){var _0xc67df9={};_0xc67df9[_0x9700b2]={'$like':'%'+_0x545e32[_0x7ba1('0x30')]['filter']+'%'};return _0xc67df9;})});}_0x25e9ff=_['merge']({},_0x25e9ff,_0x545e32[_0x7ba1('0x54')]);return _0x112215[_0x7ba1('0x51')](_0x25e9ff);}})[_0x7ba1('0x24')](function(_0x293bf1){if(_0x293bf1){_0x202d3b=_0x293bf1[_0x7ba1('0x46')];if(!_0x545e32['query'][_0x7ba1('0x35')](_0x7ba1('0x4f'))){_0x25e9ff[_0x7ba1('0x1c')]=qs[_0x7ba1('0x1c')](_0x545e32['query'][_0x7ba1('0x1c')]);_0x25e9ff[_0x7ba1('0x1d')]=qs['offset'](_0x545e32[_0x7ba1('0x30')][_0x7ba1('0x1d')]);}return _0x112215[_0x7ba1('0x51')](_0x25e9ff);}})[_0x7ba1('0x24')](function(_0x42d74d){if(_0x42d74d){return _0x42d74d?{'count':_0x202d3b,'rows':_0x42d74d}:null;}})[_0x7ba1('0x24')](respondWithResult(_0x9fab0b,null))[_0x7ba1('0x41')](handleError(_0x9fab0b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a1a88f3..c4a7c6e 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 _0xfa63=['./automation.attributes','exports','tools_automations','util','moment','rimraf','../../config/environment'];(function(_0x25fdf0,_0x480a7e){var _0x5f459d=function(_0x28dadd){while(--_0x28dadd){_0x25fdf0['push'](_0x25fdf0['shift']());}};_0x5f459d(++_0x480a7e);}(_0xfa63,0x137));var _0x3fa6=function(_0x3e547a,_0x1b840d){_0x3e547a=_0x3e547a-0x0;var _0x280827=_0xfa63[_0x3e547a];return _0x280827;};'use strict';var _=require('lodash');var util=require(_0x3fa6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3fa6('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa6('0x2'));var config=require(_0x3fa6('0x3'));var attributes=require(_0x3fa6('0x4'));module[_0x3fa6('0x5')]=function(_0x13f1c3,_0x5979c1){return _0x13f1c3['define']('Automation',attributes,{'tableName':_0x3fa6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76da=['request-promise','path','rimraf','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1b39bb,_0xc99414){var _0x1bf082=function(_0x9db8b3){while(--_0x9db8b3){_0x1b39bb['push'](_0x1b39bb['shift']());}};_0x1bf082(++_0xc99414);}(_0x76da,0x1b6));var _0xa76d=function(_0x38221a,_0x565fce){_0x38221a=_0x38221a-0x0;var _0x2a8a7a=_0x76da[_0x38221a];return _0x2a8a7a;};'use strict';var _=require(_0xa76d('0x0'));var util=require(_0xa76d('0x1'));var logger=require(_0xa76d('0x2'))(_0xa76d('0x3'));var moment=require(_0xa76d('0x4'));var BPromise=require(_0xa76d('0x5'));var rp=require(_0xa76d('0x6'));var fs=require('fs');var path=require(_0xa76d('0x7'));var rimraf=require(_0xa76d('0x8'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x2bf840,_0xbb83c1){return _0x2bf840[_0xa76d('0x9')](_0xa76d('0xa'),attributes,{'tableName':_0xa76d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 1f89251..6cdc69d 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 _0x15b8=['request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2faac6,_0x27651f){var _0x502958=function(_0x211d9a){while(--_0x211d9a){_0x2faac6['push'](_0x2faac6['shift']());}};_0x502958(++_0x27651f);}(_0x15b8,0xcd));var _0x815b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x15b8[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var moment=require(_0x815b('0x1'));var BPromise=require(_0x815b('0x2'));var rs=require(_0x815b('0x3'));var fs=require('fs');var Redis=require(_0x815b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x815b('0x5'));var logger=require(_0x815b('0x6'))(_0x815b('0x7'));var config=require(_0x815b('0x8'));var jayson=require(_0x815b('0x9'));var client=jayson[_0x815b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9fc0,_0xdfdf6,_0x26119a){return new BPromise(function(_0x175053,_0x2170c5){return client[_0x815b('0xb')](_0x1e9fc0,_0x26119a)[_0x815b('0xc')](function(_0x221ce4){logger[_0x815b('0xd')](_0x815b('0xe'),_0xdfdf6,_0x815b('0xf'));logger[_0x815b('0x10')](_0x815b('0x11'),_0xdfdf6,_0x815b('0xf'),JSON[_0x815b('0x12')](_0x221ce4));if(_0x221ce4[_0x815b('0x13')]){if(_0x221ce4[_0x815b('0x13')][_0x815b('0x14')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xdfdf6,_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);return _0x2170c5(_0x221ce4['error']['message']);}logger['error'](_0x815b('0xe'),_0xdfdf6,_0x221ce4['error']['message']);return _0x175053(_0x221ce4[_0x815b('0x13')][_0x815b('0x15')]);}else{logger[_0x815b('0xd')]('Automation,\x20%s,\x20%s',_0xdfdf6,'request\x20sent');_0x175053(_0x221ce4[_0x815b('0x16')][_0x815b('0x15')]);}})[_0x815b('0x17')](function(_0x4078db){logger[_0x815b('0x13')](_0x815b('0xe'),_0xdfdf6,_0x4078db);_0x2170c5(_0x4078db);});});} \ No newline at end of file +var _0xaa5e=['stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x351082,_0x5a4f8f){var _0x2b83bf=function(_0x3ffcf3){while(--_0x3ffcf3){_0x351082['push'](_0x351082['shift']());}};_0x2b83bf(++_0x5a4f8f);}(_0xaa5e,0xa5));var _0xeaa5=function(_0xa8131,_0x713286){_0xa8131=_0xa8131-0x0;var _0x566f86=_0xaa5e[_0xa8131];return _0x566f86;};'use strict';var _=require(_0xeaa5('0x0'));var util=require(_0xeaa5('0x1'));var moment=require('moment');var BPromise=require(_0xeaa5('0x2'));var rs=require(_0xeaa5('0x3'));var fs=require('fs');var Redis=require(_0xeaa5('0x4'));var db=require(_0xeaa5('0x5'))['db'];var utils=require(_0xeaa5('0x6'));var logger=require('../../config/logger')(_0xeaa5('0x7'));var config=require(_0xeaa5('0x8'));var jayson=require(_0xeaa5('0x9'));var client=jayson[_0xeaa5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d405e,_0x2f9041,_0x2c9696){return new BPromise(function(_0x50cb62,_0x2e35c3){return client[_0xeaa5('0xb')](_0x4d405e,_0x2c9696)['then'](function(_0x2e9ca6){logger['info'](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));logger['debug'](_0xeaa5('0xe'),_0x2f9041,_0xeaa5('0xd'),JSON[_0xeaa5('0xf')](_0x2e9ca6));if(_0x2e9ca6[_0xeaa5('0x10')]){if(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x11')]===0x1f4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x2e35c3(_0x2e9ca6[_0xeaa5('0x10')][_0xeaa5('0x12')]);}logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x2e9ca6[_0xeaa5('0x10')]['message']);return _0x50cb62(_0x2e9ca6[_0xeaa5('0x10')]['message']);}else{logger[_0xeaa5('0x13')](_0xeaa5('0xc'),_0x2f9041,_0xeaa5('0xd'));_0x50cb62(_0x2e9ca6['result'][_0xeaa5('0x12')]);}})['catch'](function(_0x44e4b4){logger[_0xeaa5('0x10')](_0xeaa5('0xc'),_0x2f9041,_0x44e4b4);_0x2e35c3(_0x44e4b4);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 48ff5a9..f683e03 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 _0xf675=['/:id','/:id/conditions','/:id/actions','getActions','post','addConditions','addActions','put','update','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xf675,0x199));var _0x5f67=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xf675[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var path=require(_0x5f67('0x2'));var timeout=require('connect-timeout');var express=require(_0x5f67('0x3'));var router=express['Router']();var fs_extra=require(_0x5f67('0x4'));var auth=require(_0x5f67('0x5'));var interaction=require(_0x5f67('0x6'));var config=require('../../config/environment');var controller=require(_0x5f67('0x7'));router[_0x5f67('0x8')]('/',auth[_0x5f67('0x9')](),controller[_0x5f67('0xa')]);router['get'](_0x5f67('0xb'),auth[_0x5f67('0x9')](),controller['show']);router['get'](_0x5f67('0xc'),auth[_0x5f67('0x9')](),controller['getConditions']);router['get'](_0x5f67('0xd'),auth[_0x5f67('0x9')](),controller[_0x5f67('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5f67('0xf')](_0x5f67('0xc'),auth['isAuthenticated'](),controller[_0x5f67('0x10')]);router['post'](_0x5f67('0xd'),auth['isAuthenticated'](),controller[_0x5f67('0x11')]);router[_0x5f67('0x12')](_0x5f67('0xb'),auth['isAuthenticated'](),controller[_0x5f67('0x13')]);router['delete'](_0x5f67('0xb'),auth['isAuthenticated'](),controller[_0x5f67('0x14')]);module['exports']=router; \ No newline at end of file +var _0x70e9=['/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e9,0x193));var _0x970e=function(_0x4246fd,_0x30d0c4){_0x4246fd=_0x4246fd-0x0;var _0x4e8971=_0x70e9[_0x4246fd];return _0x4e8971;};'use strict';var multer=require('multer');var util=require(_0x970e('0x0'));var path=require(_0x970e('0x1'));var timeout=require('connect-timeout');var express=require(_0x970e('0x2'));var router=express[_0x970e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x970e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x970e('0x5'));var controller=require(_0x970e('0x6'));router[_0x970e('0x7')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x9')]);router[_0x970e('0x7')](_0x970e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x970e('0x7')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0x7')](_0x970e('0xd'),auth['isAuthenticated'](),controller[_0x970e('0xe')]);router[_0x970e('0xf')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x10')]);router[_0x970e('0xf')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0x11')]);router[_0x970e('0xf')](_0x970e('0xd'),auth[_0x970e('0x8')](),controller[_0x970e('0x12')]);router[_0x970e('0x13')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller['update']);router[_0x970e('0x14')](_0x970e('0xa'),auth['isAuthenticated'](),controller[_0x970e('0x15')]);module[_0x970e('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 82989ea..ef066bc 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 _0x9c9c=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ENUM','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x2f55e0,_0x187824){var _0x140f59=function(_0x562b68){while(--_0x562b68){_0x2f55e0['push'](_0x2f55e0['shift']());}};_0x140f59(++_0x187824);}(_0x9c9c,0x1e4));var _0xc9c9=function(_0x5d2699,_0xbb63f2){_0x5d2699=_0x5d2699-0x0;var _0x2a2ee6=_0x9c9c[_0x5d2699];return _0x2a2ee6;};'use strict';var Sequelize=require(_0xc9c9('0x0'));module[_0xc9c9('0x1')]={'name':{'type':Sequelize[_0xc9c9('0x2')],'unique':_0xc9c9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc9c9('0x4')),'allowNull':![],'defaultValue':_0xc9c9('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc9c9('0x5')],'defaultValue':0x0,'comment':_0xc9c9('0x6')},'limitCalls':{'type':Sequelize[_0xc9c9('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc9c9('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc9c9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc9c9('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc9c9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'comment':_0xc9c9('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc9c9('0x10')},'dialTimezone':{'type':Sequelize[_0xc9c9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc9c9('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc9c9('0x11'),_0xc9c9('0x12'),_0xc9c9('0x13')),'defaultValue':_0xc9c9('0x11')},'dialAMDActive':{'type':Sequelize[_0xc9c9('0x5')],'defaultValue':0x0,'comment':_0xc9c9('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc9c9('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc9c9('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9c9('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc9c9('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc9c9('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc9c9('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc9c9('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc9c9('0x7')](0x9)[_0xc9c9('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc9c9('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc9c9('0x1b')](_0xc9c9('0x1c'),_0xc9c9('0x1d')),'defaultValue':_0xc9c9('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc9c9('0x1e')},'dialCutDigit':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc9c9('0x7')](0x3)[_0xc9c9('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc9c9('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc9c9('0x7')](0x5)[_0xc9c9('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc9c9('0x24')}}; \ No newline at end of file +var _0x3442=['#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3442,0x15a));var _0x2344=function(_0x2018c6,_0x2c7b8d){_0x2018c6=_0x2018c6-0x0;var _0x43c516=_0x3442[_0x2018c6];return _0x43c516;};'use strict';var Sequelize=require('sequelize');module[_0x2344('0x0')]={'name':{'type':Sequelize[_0x2344('0x1')],'unique':_0x2344('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2344('0x3')](_0x2344('0x4')),'allowNull':![],'defaultValue':_0x2344('0x4')},'description':{'type':Sequelize[_0x2344('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2344('0x5')},'limitCalls':{'type':Sequelize[_0x2344('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2344('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2344('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2344('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2344('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x3,'comment':_0x2344('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2344('0x6')](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2344('0xf')},'dialTimezone':{'type':Sequelize[_0x2344('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2344('0x1')],'defaultValue':_0x2344('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x2344('0x3')](_0x2344('0x11'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2344('0x6')](0x9)[_0x2344('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2344('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x2344('0x6')](0x9)[_0x2344('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2344('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2344('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2344('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x2344('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2344('0x6')](0x9)[_0x2344('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2344('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2344('0x6')](0x9)[_0x2344('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2344('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2344('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2344('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2344('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2344('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x2344('0x1a'),_0x2344('0x1b')),'defaultValue':_0x2344('0x1a')},'dialPrefix':{'type':Sequelize[_0x2344('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x2344('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2344('0x1c')},'dialCutDigit':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2344('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x2344('0x6')](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2344('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2344('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2344('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2344('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e9b1cbe..136a70b 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 _0x6085=['hasOwnProperty','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','format','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','toString','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','get','IvrCampaigns','UserProfileResource','then','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','rows','catch','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','UserProfileSection','autoAssociation','getHoppers','CmHopper'];(function(_0x292b1f,_0x18bb11){var _0x3cb50a=function(_0x3e3e3c){while(--_0x3e3e3c){_0x292b1f['push'](_0x292b1f['shift']());}};_0x3cb50a(++_0x18bb11);}(_0x6085,0x15d));var _0x5608=function(_0x11e9ef,_0xcdff5b){_0x11e9ef=_0x11e9ef-0x0;var _0x3b46f3=_0x6085[_0x11e9ef];return _0x3b46f3;};'use strict';var emlformat=require(_0x5608('0x0'));var rimraf=require(_0x5608('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5608('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5608('0x3'));var util=require(_0x5608('0x4'));var path=require('path');var sox=require(_0x5608('0x5'));var csv=require(_0x5608('0x6'));var ejs=require(_0x5608('0x7'));var fs=require('fs');var fs_extra=require(_0x5608('0x8'));var _=require(_0x5608('0x9'));var squel=require('squel');var crypto=require(_0x5608('0xa'));var jsforce=require(_0x5608('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5608('0x6'));var querystring=require(_0x5608('0xc'));var Papa=require('papaparse');var Redis=require(_0x5608('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5608('0xe'));var hardwareService=require(_0x5608('0xf'));var logger=require(_0x5608('0x10'))(_0x5608('0x11'));var utils=require(_0x5608('0x12'));var config=require(_0x5608('0x13'));var licenseUtil=require(_0x5608('0x14'));var db=require(_0x5608('0x15'))['db'];function respondWithStatusCode(_0x1f9e24,_0x53acef){_0x53acef=_0x53acef||0xcc;return function(_0x3100c0){if(_0x3100c0){return _0x1f9e24[_0x5608('0x16')](_0x53acef);}return _0x1f9e24['status'](_0x53acef)[_0x5608('0x17')]();};}function respondWithResult(_0xfb28fc,_0x29c995){_0x29c995=_0x29c995||0xc8;return function(_0x5bc006){if(_0x5bc006){return _0xfb28fc[_0x5608('0x18')](_0x29c995)[_0x5608('0x19')](_0x5bc006);}};}function respondWithFilteredResult(_0x316620,_0x2b1dbf){return function(_0x554d01){if(_0x554d01){var _0x2c128d=typeof _0x2b1dbf['offset']===_0x5608('0x1a')&&typeof _0x2b1dbf[_0x5608('0x1b')]===_0x5608('0x1a');var _0x5109b2=_0x554d01[_0x5608('0x1c')];var _0x80f1dc=_0x2c128d?0x0:_0x2b1dbf[_0x5608('0x1d')];var _0x228ae2=_0x2c128d?_0x554d01['count']:_0x2b1dbf[_0x5608('0x1d')]+_0x2b1dbf['limit'];var _0xd921c5;if(_0x228ae2>=_0x5109b2){_0x228ae2=_0x5109b2;_0xd921c5=0xc8;}else{_0xd921c5=0xce;}_0x316620[_0x5608('0x18')](_0xd921c5);return _0x316620[_0x5608('0x1e')](_0x5608('0x1f'),_0x80f1dc+'-'+_0x228ae2+'/'+_0x5109b2)[_0x5608('0x19')](_0x554d01);}return null;};}function patchUpdates(_0x273170){return function(_0x112bc4){try{jsonpatch['apply'](_0x112bc4,_0x273170,!![]);}catch(_0x18e50f){return BPromise[_0x5608('0x20')](_0x18e50f);}return _0x112bc4[_0x5608('0x21')]();};}function saveUpdates(_0x10404e,_0x356a6c){return function(_0x3764ca){if(_0x3764ca){return _0x3764ca[_0x5608('0x22')](_0x10404e)['then'](function(_0x505d26){return _0x505d26;});}return null;};}function removeEntity(_0x5864b7,_0x15146b){return function(_0x3bcbaf){if(_0x3bcbaf){return _0x3bcbaf[_0x5608('0x23')]()['then'](function(){var _0x312b7b=_0x3bcbaf[_0x5608('0x24')]({'plain':!![]});var _0x3779ca=_0x5608('0x25');return db[_0x5608('0x26')]['destroy']({'where':{'type':_0x3779ca,'resourceId':_0x312b7b['id']}})['then'](function(){return _0x3bcbaf;});})[_0x5608('0x27')](function(){_0x5864b7[_0x5608('0x18')](0xcc)[_0x5608('0x17')]();});}};}function handleEntityNotFound(_0x1be8d1,_0x5b359c){return function(_0x1953ef){if(!_0x1953ef){_0x1be8d1['sendStatus'](0x194);}return _0x1953ef;};}function handleError(_0x171b39,_0x516683){_0x516683=_0x516683||0x1f4;return function(_0x5961c4){logger['error'](_0x5961c4[_0x5608('0x28')]);if(_0x5961c4[_0x5608('0x29')]){delete _0x5961c4[_0x5608('0x29')];}_0x171b39['status'](_0x516683)['send'](_0x5961c4);};}exports[_0x5608('0x2a')]=function(_0x4198fa,_0x28f9af){var _0x16413e={},_0x44438b={},_0x23156b={'count':0x0,'rows':[]};var _0x1c1733=_['map'](db['Campaign'][_0x5608('0x2b')],function(_0x18b465){return{'name':_0x18b465[_0x5608('0x2c')],'type':_0x18b465['type'][_0x5608('0x2d')]};});_0x44438b['model']=_[_0x5608('0x2e')](_0x1c1733,_0x5608('0x29'));_0x44438b[_0x5608('0x2f')]=_['keys'](_0x4198fa['query']);_0x44438b[_0x5608('0x30')]=_[_0x5608('0x31')](_0x44438b['model'],_0x44438b[_0x5608('0x2f')]);_0x16413e[_0x5608('0x32')]=_[_0x5608('0x31')](_0x44438b[_0x5608('0x33')],qs[_0x5608('0x34')](_0x4198fa['query'][_0x5608('0x34')]));_0x16413e[_0x5608('0x32')]=_0x16413e[_0x5608('0x32')][_0x5608('0x35')]?_0x16413e[_0x5608('0x32')]:_0x44438b[_0x5608('0x33')];if(!_0x4198fa[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x16413e[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x4198fa[_0x5608('0x2f')][_0x5608('0x1b')]);_0x16413e[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x4198fa['query'][_0x5608('0x1d')]);}_0x16413e[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x4198fa['query'][_0x5608('0x38')]);_0x16413e[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x4198fa[_0x5608('0x2f')],_0x44438b[_0x5608('0x30')]),_0x1c1733);if(_0x4198fa[_0x5608('0x2f')]['filter']){_0x16413e['where']=_[_0x5608('0x3b')](_0x16413e[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x1c1733,function(_0x4243d7){if(_0x4243d7[_0x5608('0x3c')]!==_0x5608('0x3d')){var _0x208f90={};_0x208f90[_0x4243d7[_0x5608('0x29')]]={'$like':'%'+_0x4198fa[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x208f90;}})});}_0x16413e=_[_0x5608('0x3b')]({},_0x16413e,_0x4198fa[_0x5608('0x3f')]);var _0x2ccd32={'where':_0x16413e[_0x5608('0x39')]};return db[_0x5608('0x40')][_0x5608('0x1c')](_0x2ccd32)[_0x5608('0x27')](function(_0x2ff1b0){_0x23156b[_0x5608('0x1c')]=_0x2ff1b0;if(_0x4198fa[_0x5608('0x2f')][_0x5608('0x41')]){_0x16413e[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x40')][_0x5608('0x43')](_0x16413e);})[_0x5608('0x27')](function(_0x2f721b){_0x23156b[_0x5608('0x44')]=_0x2f721b;return _0x23156b;})[_0x5608('0x27')](respondWithFilteredResult(_0x28f9af,_0x16413e))[_0x5608('0x45')](handleError(_0x28f9af,null));};exports['show']=function(_0x4ba682,_0x3d7f99){var _0xff08ee={'raw':![],'where':{'id':_0x4ba682[_0x5608('0x46')]['id']}},_0x18d2db={};_0x18d2db['model']=_[_0x5608('0x47')](db[_0x5608('0x40')][_0x5608('0x2b')]);_0x18d2db['query']=_[_0x5608('0x47')](_0x4ba682['query']);_0x18d2db[_0x5608('0x30')]=_[_0x5608('0x31')](_0x18d2db[_0x5608('0x33')],_0x18d2db['query']);_0xff08ee[_0x5608('0x32')]=_[_0x5608('0x31')](_0x18d2db[_0x5608('0x33')],qs[_0x5608('0x34')](_0x4ba682['query'][_0x5608('0x34')]));_0xff08ee[_0x5608('0x32')]=_0xff08ee[_0x5608('0x32')][_0x5608('0x35')]?_0xff08ee['attributes']:_0x18d2db['model'];if(_0x4ba682['query']['includeAll']){_0xff08ee['include']=[{'all':!![]}];}_0xff08ee=_[_0x5608('0x3b')]({},_0xff08ee,_0x4ba682[_0x5608('0x3f')]);return db[_0x5608('0x40')][_0x5608('0x48')](_0xff08ee)[_0x5608('0x27')](handleEntityNotFound(_0x3d7f99,null))[_0x5608('0x27')](respondWithResult(_0x3d7f99,null))[_0x5608('0x45')](handleError(_0x3d7f99,null));};exports[_0x5608('0x49')]=function(_0x37ca95,_0x397785){return db[_0x5608('0x40')][_0x5608('0x49')](_0x37ca95[_0x5608('0x4a')],{})['then'](function(_0x236319){var _0x46edef=_0x37ca95['user'][_0x5608('0x24')]({'plain':!![]});if(!_0x46edef)throw new Error(_0x5608('0x4b'));if(_0x46edef[_0x5608('0x4c')]===_0x5608('0x4d')){var _0xb876af=_0x236319['get']({'plain':!![]});var _0x5baa25=_0x5608('0x25');return db['UserProfileSection'][_0x5608('0x48')]({'where':{'name':_0x5baa25,'userProfileId':_0x46edef[_0x5608('0x4e')]},'raw':!![]})[_0x5608('0x27')](function(_0x4c945a){if(_0x4c945a&&_0x4c945a['autoAssociation']===0x0){return db[_0x5608('0x26')]['create']({'name':_0xb876af['name'],'resourceId':_0xb876af['id'],'type':_0x4c945a[_0x5608('0x29')],'sectionId':_0x4c945a['id']},{})[_0x5608('0x27')](function(){return _0x236319;});}else{return _0x236319;}})[_0x5608('0x45')](function(_0x333ed3){logger[_0x5608('0x4f')](_0x5608('0x50'),_0x333ed3);throw _0x333ed3;});}return _0x236319;})[_0x5608('0x27')](respondWithResult(_0x397785,0xc9))[_0x5608('0x45')](handleError(_0x397785,null));};exports[_0x5608('0x51')]=function(_0x264158,_0x5c0b6e){var _0x3123c9={'where':{'id':_0x264158['params']['id']}},_0x1257d4={};_0x1257d4['model']=_[_0x5608('0x47')](db[_0x5608('0x40')]['rawAttributes']);_0x3123c9[_0x5608('0x32')]=_[_0x5608('0x31')](_0x1257d4[_0x5608('0x33')],qs[_0x5608('0x34')](_0x264158[_0x5608('0x2f')][_0x5608('0x34')]));_0x3123c9['attributes']=_0x3123c9[_0x5608('0x32')]['length']?_0x3123c9[_0x5608('0x32')]:_0x1257d4[_0x5608('0x33')];if(_0x264158[_0x5608('0x2f')][_0x5608('0x41')]){_0x3123c9[_0x5608('0x42')]=[{'all':!![]}];}_0x3123c9=_[_0x5608('0x3b')]({},_0x3123c9,_0x264158[_0x5608('0x3f')]);return db[_0x5608('0x40')][_0x5608('0x48')](_0x3123c9)[_0x5608('0x27')](handleEntityNotFound(_0x5c0b6e,null))[_0x5608('0x27')](function(_0x66c551){if(_0x66c551){var _0x498d02=_0x66c551[_0x5608('0x24')]({'plain':!![]});_0x498d02=qs[_0x5608('0x52')](_0x498d02,['id','createdAt',_0x5608('0x53')]);_0x264158[_0x5608('0x4a')]=_[_0x5608('0x52')](_0x264158[_0x5608('0x4a')],['id',_0x5608('0x54'),_0x5608('0x53')]);return db[_0x5608('0x40')]['create'](_[_0x5608('0x3b')](_0x498d02,_0x264158['body']),{'include':_0x264158[_0x5608('0x2f')][_0x5608('0x41')]?[{'all':!![]}]:undefined})[_0x5608('0x27')](function(_0x4a5de0){var _0x7c35e=_0x264158[_0x5608('0x4d')][_0x5608('0x24')]({'plain':!![]});if(!_0x7c35e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7c35e[_0x5608('0x4c')]==='user'){var _0x2ff6ad=_0x4a5de0[_0x5608('0x24')]({'plain':!![]});var _0x4d2ef0=_0x5608('0x25');return db[_0x5608('0x55')][_0x5608('0x48')]({'where':{'name':_0x4d2ef0,'userProfileId':_0x7c35e[_0x5608('0x4e')]},'raw':!![]})[_0x5608('0x27')](function(_0x587185){if(_0x587185&&_0x587185[_0x5608('0x56')]===0x0){return db[_0x5608('0x26')]['create']({'name':_0x2ff6ad[_0x5608('0x29')],'resourceId':_0x2ff6ad['id'],'type':_0x587185[_0x5608('0x29')],'sectionId':_0x587185['id']},{})[_0x5608('0x27')](function(){return _0x4a5de0;});}else{return _0x4a5de0;}})[_0x5608('0x45')](function(_0x206ad8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206ad8);throw _0x206ad8;});}return _0x4a5de0;});}})['then'](respondWithResult(_0x5c0b6e,0xc9))['catch'](handleError(_0x5c0b6e,null));};exports[_0x5608('0x22')]=function(_0x43170f,_0x3d394d){if(_0x43170f[_0x5608('0x4a')]['id']){delete _0x43170f['body']['id'];}return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0x43170f[_0x5608('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d394d,null))[_0x5608('0x27')](saveUpdates(_0x43170f['body'],null))[_0x5608('0x27')](respondWithResult(_0x3d394d,null))[_0x5608('0x45')](handleError(_0x3d394d,null));};exports[_0x5608('0x23')]=function(_0xa0c4a5,_0x2dbdd2){return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0xa0c4a5[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x2dbdd2,null))[_0x5608('0x27')](removeEntity(_0x2dbdd2,null))[_0x5608('0x45')](handleError(_0x2dbdd2,null));};exports[_0x5608('0x57')]=function(_0x3b5359,_0x468754,_0x5b7ecc){var _0x32bd83={'raw':!![],'where':{}};var _0x864ef8={};var _0x250ef2={'count':0x0,'rows':[]};return db[_0x5608('0x40')]['findOne']({'where':{'id':_0x3b5359[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x468754,null))[_0x5608('0x27')](function(_0x2e20ae){if(_0x2e20ae){_0x864ef8[_0x5608('0x33')]=_[_0x5608('0x47')](db[_0x5608('0x58')][_0x5608('0x2b')]);_0x864ef8[_0x5608('0x2f')]=_['keys'](_0x3b5359[_0x5608('0x2f')]);_0x864ef8['filters']=_['intersection'](_0x864ef8[_0x5608('0x33')],_0x864ef8[_0x5608('0x2f')]);_0x32bd83['attributes']=_[_0x5608('0x31')](_0x864ef8[_0x5608('0x33')],qs['fields'](_0x3b5359['query'][_0x5608('0x34')]));_0x32bd83[_0x5608('0x32')]=_0x32bd83[_0x5608('0x32')][_0x5608('0x35')]?_0x32bd83[_0x5608('0x32')]:_0x864ef8[_0x5608('0x33')];if(!_0x3b5359[_0x5608('0x2f')][_0x5608('0x59')](_0x5608('0x36'))){_0x32bd83[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x3b5359[_0x5608('0x2f')][_0x5608('0x1b')]);_0x32bd83[_0x5608('0x1d')]=qs['offset'](_0x3b5359['query']['offset']);}_0x32bd83[_0x5608('0x37')]=qs['sort'](_0x3b5359[_0x5608('0x2f')][_0x5608('0x38')]);_0x32bd83[_0x5608('0x39')]=qs[_0x5608('0x30')](_['pick'](_0x3b5359['query'],_0x864ef8[_0x5608('0x30')]));_0x32bd83[_0x5608('0x39')]['CampaignId']=_0x2e20ae['id'];if(_0x3b5359['query'][_0x5608('0x3e')]){_0x32bd83[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x32bd83[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x32bd83[_0x5608('0x32')],function(_0x326a15){var _0x1e23c6={};_0x1e23c6[_0x326a15]={'$like':'%'+_0x3b5359['query']['filter']+'%'};return _0x1e23c6;})});}_0x32bd83=_[_0x5608('0x3b')]({},_0x32bd83,_0x3b5359[_0x5608('0x3f')]);return db['CmHopper'][_0x5608('0x1c')]({'where':_0x32bd83[_0x5608('0x39')]})['then'](function(_0x4dbdfe){_0x250ef2[_0x5608('0x1c')]=_0x4dbdfe;if(_0x3b5359[_0x5608('0x2f')][_0x5608('0x41')]){_0x32bd83[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x58')][_0x5608('0x43')](_0x32bd83);})['then'](function(_0x26579d){_0x250ef2['rows']=_0x26579d;return _0x250ef2;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x468754,_0x32bd83))['catch'](handleError(_0x468754,null));};exports[_0x5608('0x5a')]=function(_0x573fe8,_0x308ce8,_0x14ca1a){var _0x44b83e={'raw':!![],'where':{}};var _0xc1b813={};var _0x9a2163={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x573fe8[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x308ce8,null))[_0x5608('0x27')](function(_0x65ce06){if(_0x65ce06){_0xc1b813['model']=_[_0x5608('0x47')](db['CmHopperHistory']['rawAttributes']);_0xc1b813[_0x5608('0x2f')]=_['keys'](_0x573fe8['query']);_0xc1b813[_0x5608('0x30')]=_[_0x5608('0x31')](_0xc1b813[_0x5608('0x33')],_0xc1b813[_0x5608('0x2f')]);_0x44b83e[_0x5608('0x32')]=_[_0x5608('0x31')](_0xc1b813[_0x5608('0x33')],qs[_0x5608('0x34')](_0x573fe8[_0x5608('0x2f')]['fields']));_0x44b83e[_0x5608('0x32')]=_0x44b83e['attributes']['length']?_0x44b83e[_0x5608('0x32')]:_0xc1b813[_0x5608('0x33')];if(!_0x573fe8[_0x5608('0x2f')][_0x5608('0x59')]('nolimit')){_0x44b83e[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x573fe8[_0x5608('0x2f')][_0x5608('0x1b')]);_0x44b83e[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x573fe8[_0x5608('0x2f')][_0x5608('0x1d')]);}_0x44b83e[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x573fe8[_0x5608('0x2f')]['sort']);_0x44b83e[_0x5608('0x39')]=qs['filters'](_['pick'](_0x573fe8[_0x5608('0x2f')],_0xc1b813['filters']));_0x44b83e[_0x5608('0x39')]['CampaignId']=_0x65ce06['id'];if(_0x573fe8['query'][_0x5608('0x3e')]){_0x44b83e['where']=_[_0x5608('0x3b')](_0x44b83e['where'],{'$or':_['map'](_0x44b83e[_0x5608('0x32')],function(_0x22f316){var _0x4c4f9f={};_0x4c4f9f[_0x22f316]={'$like':'%'+_0x573fe8[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x4c4f9f;})});}_0x44b83e=_[_0x5608('0x3b')]({},_0x44b83e,_0x573fe8[_0x5608('0x3f')]);return db[_0x5608('0x5c')][_0x5608('0x1c')]({'where':_0x44b83e[_0x5608('0x39')]})['then'](function(_0x2eb7fc){_0x9a2163[_0x5608('0x1c')]=_0x2eb7fc;if(_0x573fe8['query']['includeAll']){_0x44b83e[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x5c')][_0x5608('0x43')](_0x44b83e);})[_0x5608('0x27')](function(_0x4d2de1){_0x9a2163['rows']=_0x4d2de1;return _0x9a2163;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x308ce8,_0x44b83e))[_0x5608('0x45')](handleError(_0x308ce8,null));};exports['getHopperFinals']=function(_0x95ec8d,_0x57e019,_0x414953){var _0x212172={'raw':!![],'where':{}};var _0x3ad2ee={};var _0x46e2f7={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x95ec8d['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x57e019,null))['then'](function(_0x11bdfb){if(_0x11bdfb){_0x3ad2ee['model']=_[_0x5608('0x47')](db[_0x5608('0x5d')][_0x5608('0x2b')]);_0x3ad2ee['query']=_[_0x5608('0x47')](_0x95ec8d['query']);_0x3ad2ee[_0x5608('0x30')]=_['intersection'](_0x3ad2ee[_0x5608('0x33')],_0x3ad2ee[_0x5608('0x2f')]);_0x212172[_0x5608('0x32')]=_[_0x5608('0x31')](_0x3ad2ee['model'],qs['fields'](_0x95ec8d[_0x5608('0x2f')]['fields']));_0x212172[_0x5608('0x32')]=_0x212172['attributes'][_0x5608('0x35')]?_0x212172['attributes']:_0x3ad2ee[_0x5608('0x33')];if(!_0x95ec8d[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x212172[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x95ec8d[_0x5608('0x2f')][_0x5608('0x1b')]);_0x212172[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x95ec8d['query'][_0x5608('0x1d')]);}_0x212172['order']=qs[_0x5608('0x38')](_0x95ec8d['query'][_0x5608('0x38')]);_0x212172['where']=qs[_0x5608('0x30')](_['pick'](_0x95ec8d[_0x5608('0x2f')],_0x3ad2ee[_0x5608('0x30')]));_0x212172['where'][_0x5608('0x5e')]=_0x11bdfb['id'];if(_0x95ec8d[_0x5608('0x2f')][_0x5608('0x3e')]){_0x212172[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x212172[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x212172[_0x5608('0x32')],function(_0x3fe130){var _0x4c311b={};_0x4c311b[_0x3fe130]={'$like':'%'+_0x95ec8d[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x4c311b;})});}_0x212172=_[_0x5608('0x3b')]({},_0x212172,_0x95ec8d[_0x5608('0x3f')]);return db[_0x5608('0x5d')][_0x5608('0x1c')]({'where':_0x212172['where']})[_0x5608('0x27')](function(_0x3a5125){_0x46e2f7[_0x5608('0x1c')]=_0x3a5125;if(_0x95ec8d[_0x5608('0x2f')]['includeAll']){_0x212172['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x212172);})[_0x5608('0x27')](function(_0x3bea2d){_0x46e2f7[_0x5608('0x44')]=_0x3bea2d;return _0x46e2f7;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x57e019,_0x212172))[_0x5608('0x45')](handleError(_0x57e019,null));};exports['getHopperBlacks']=function(_0x3833dd,_0x166008,_0x3fc92b){var _0x33c4aa={'raw':!![],'where':{}};var _0x653d44={};var _0x2ef730={'count':0x0,'rows':[]};return db[_0x5608('0x40')][_0x5608('0x5b')]({'where':{'id':_0x3833dd['params']['id']}})['then'](handleEntityNotFound(_0x166008,null))[_0x5608('0x27')](function(_0x617d9c){if(_0x617d9c){_0x653d44[_0x5608('0x33')]=_[_0x5608('0x47')](db['CmHopperBlack'][_0x5608('0x2b')]);_0x653d44[_0x5608('0x2f')]=_[_0x5608('0x47')](_0x3833dd[_0x5608('0x2f')]);_0x653d44['filters']=_[_0x5608('0x31')](_0x653d44[_0x5608('0x33')],_0x653d44[_0x5608('0x2f')]);_0x33c4aa[_0x5608('0x32')]=_[_0x5608('0x31')](_0x653d44[_0x5608('0x33')],qs[_0x5608('0x34')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x34')]));_0x33c4aa[_0x5608('0x32')]=_0x33c4aa[_0x5608('0x32')]['length']?_0x33c4aa[_0x5608('0x32')]:_0x653d44[_0x5608('0x33')];if(!_0x3833dd[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x33c4aa['limit']=qs[_0x5608('0x1b')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x1b')]);_0x33c4aa[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x3833dd[_0x5608('0x2f')][_0x5608('0x1d')]);}_0x33c4aa['order']=qs[_0x5608('0x38')](_0x3833dd[_0x5608('0x2f')]['sort']);_0x33c4aa[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x3833dd[_0x5608('0x2f')],_0x653d44[_0x5608('0x30')]));_0x33c4aa['where'][_0x5608('0x5e')]=_0x617d9c['id'];if(_0x3833dd[_0x5608('0x2f')][_0x5608('0x3e')]){_0x33c4aa[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x33c4aa[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x33c4aa[_0x5608('0x32')],function(_0x29bcfb){var _0x2b2a65={};_0x2b2a65[_0x29bcfb]={'$like':'%'+_0x3833dd[_0x5608('0x2f')]['filter']+'%'};return _0x2b2a65;})});}_0x33c4aa=_[_0x5608('0x3b')]({},_0x33c4aa,_0x3833dd[_0x5608('0x3f')]);return db['CmHopperBlack'][_0x5608('0x1c')]({'where':_0x33c4aa[_0x5608('0x39')]})['then'](function(_0x2130b0){_0x2ef730[_0x5608('0x1c')]=_0x2130b0;if(_0x3833dd[_0x5608('0x2f')][_0x5608('0x41')]){_0x33c4aa[_0x5608('0x42')]=[{'all':!![]}];}return db[_0x5608('0x5f')][_0x5608('0x43')](_0x33c4aa);})[_0x5608('0x27')](function(_0x3a6767){_0x2ef730[_0x5608('0x44')]=_0x3a6767;return _0x2ef730;});}})[_0x5608('0x27')](respondWithFilteredResult(_0x166008,_0x33c4aa))[_0x5608('0x45')](handleError(_0x166008,null));};exports[_0x5608('0x60')]=function(_0x29c8a2,_0x20a119,_0x5067d0){var _0x3502a5={};var _0x4c07b8={};var _0x27761e;var _0x58883d;return db[_0x5608('0x40')]['findOne']({'where':{'id':_0x29c8a2['params']['id']}})['then'](handleEntityNotFound(_0x20a119,null))[_0x5608('0x27')](function(_0x24c275){if(_0x24c275){_0x27761e=_0x24c275;_0x4c07b8[_0x5608('0x33')]=_['keys'](db[_0x5608('0x61')]['rawAttributes']);_0x4c07b8[_0x5608('0x2f')]=_[_0x5608('0x47')](_0x29c8a2[_0x5608('0x2f')]);_0x4c07b8[_0x5608('0x30')]=_[_0x5608('0x31')](_0x4c07b8[_0x5608('0x33')],_0x4c07b8[_0x5608('0x2f')]);_0x3502a5[_0x5608('0x32')]=_[_0x5608('0x31')](_0x4c07b8[_0x5608('0x33')],qs[_0x5608('0x34')](_0x29c8a2[_0x5608('0x2f')][_0x5608('0x34')]));_0x3502a5[_0x5608('0x32')]=_0x3502a5[_0x5608('0x32')][_0x5608('0x35')]?_0x3502a5['attributes']:_0x4c07b8[_0x5608('0x33')];_0x3502a5['order']=qs[_0x5608('0x38')](_0x29c8a2[_0x5608('0x2f')][_0x5608('0x38')]);_0x3502a5[_0x5608('0x39')]=qs[_0x5608('0x30')](_[_0x5608('0x3a')](_0x29c8a2[_0x5608('0x2f')],_0x4c07b8['filters']));if(_0x29c8a2[_0x5608('0x2f')]['filter']){_0x3502a5['where']=_[_0x5608('0x3b')](_0x3502a5['where'],{'$or':_[_0x5608('0x2e')](_0x3502a5[_0x5608('0x32')],function(_0x4087a4){var _0x21e7a3={};_0x21e7a3[_0x4087a4]={'$like':'%'+_0x29c8a2[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x21e7a3;})});}_0x3502a5=_[_0x5608('0x3b')]({},_0x3502a5,_0x29c8a2['options']);return _0x27761e[_0x5608('0x60')](_0x3502a5);}})[_0x5608('0x27')](function(_0xc10258){if(_0xc10258){_0x58883d=_0xc10258[_0x5608('0x35')];if(!_0x29c8a2[_0x5608('0x2f')]['hasOwnProperty'](_0x5608('0x36'))){_0x3502a5[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x29c8a2[_0x5608('0x2f')]['limit']);_0x3502a5[_0x5608('0x1d')]=qs[_0x5608('0x1d')](_0x29c8a2[_0x5608('0x2f')]['offset']);}return _0x27761e[_0x5608('0x60')](_0x3502a5);}})[_0x5608('0x27')](function(_0x5ecd6c){if(_0x5ecd6c){return _0x5ecd6c?{'count':_0x58883d,'rows':_0x5ecd6c}:null;}})['then'](respondWithResult(_0x20a119,null))[_0x5608('0x45')](handleError(_0x20a119,null));};exports[_0x5608('0x62')]=function(_0x372f71,_0x1df229,_0x563924){var _0x2895a7,_0x3ea04c;var _0x28f8b3=[];var _0x4b3846=moment()[_0x5608('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x372f71[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x1df229,null))[_0x5608('0x27')](function(_0x28660c){if(_0x28660c){_0x3ea04c=_0x28660c;return _0x28660c['addLists'](_0x372f71[_0x5608('0x4a')][_0x5608('0x64')],_[_0x5608('0x52')](_0x372f71['body'],['ids','id'])||{});}return null;})['spread'](function(_0x64af13){var _0xff1183;var _0x37a69a;_0x2895a7=_0x64af13||[];var _0x3fd1c3=[];if(_0x64af13){for(var _0x49c0fc=0x0;_0x49c0fc<_0x64af13[_0x5608('0x35')];_0x49c0fc+=0x1){var _0x233126=_0x64af13[_0x49c0fc][_0x5608('0x24')]({'plain':!![]});_0x3ea04c[_0x5608('0x65')]=_0x372f71['body'][_0x5608('0x65')]?_0x372f71['body'][_0x5608('0x65')]:_0x3ea04c[_0x5608('0x65')];switch(_0x3ea04c[_0x5608('0x65')]){case _0x5608('0x66'):_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),_0x5608('0x6d'),'ListId',_0x5608('0x5e'),_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))[_0x5608('0x6f')]('NOW()','scheduledAt')['field']('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126[_0x5608('0x70')][_0x5608('0x71')](),'ListId')[_0x5608('0x6f')](_0x372f71[_0x5608('0x46')]['id']['toString'](),_0x5608('0x5e'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))[_0x5608('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x5608('0x39')](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x74'))[_0x5608('0x39')](_0x5608('0x75'),squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x76'))[_0x5608('0x72')](_0x5608('0x77'))['where'](_0x5608('0x78'),_0x372f71[_0x5608('0x46')]['id']['toString']()))[_0x5608('0x39')](_0x5608('0x75'),squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x79'))[_0x5608('0x72')](_0x5608('0x69'))[_0x5608('0x39')]('CampaignId\x20=\x20?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())))[_0x5608('0x71')]();break;case _0x5608('0x7a'):_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),'ContactId','ListId','CampaignId',_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))['field'](_0x5608('0x7b'),'scheduledAt')['field']('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126['CmListId']['toString'](),'ListId')['field'](_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')](),_0x5608('0x5e'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))['field']('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))['from'](_0x5608('0x7c'))[_0x5608('0x39')](_0x5608('0x7d'))['where'](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x74'))[_0x5608('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x79'))[_0x5608('0x72')](_0x5608('0x69'))[_0x5608('0x39')]('CampaignId\x20=\x20?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())))[_0x5608('0x71')]();break;default:_0xff1183=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x69'))[_0x5608('0x6a')]([_0x5608('0x6b'),_0x5608('0x6c'),_0x5608('0x6d'),_0x5608('0x7e'),_0x5608('0x5e'),'createdAt','updatedAt'],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x6b'),_0x5608('0x6b'))[_0x5608('0x6f')]('NOW()',_0x5608('0x6c'))[_0x5608('0x6f')]('id',_0x5608('0x6d'))[_0x5608('0x6f')](_0x233126[_0x5608('0x70')][_0x5608('0x71')](),_0x5608('0x7e'))['field'](_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')](),_0x5608('0x5e'))['field']('\x27'+_0x4b3846+'\x27','createdAt')[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x53'))['from'](_0x5608('0x7c'))[_0x5608('0x39')](_0x5608('0x7d'))[_0x5608('0x39')](_0x5608('0x73'),_0x233126['CmListId'][_0x5608('0x71')]())[_0x5608('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x5608('0x71')]();}_0x37a69a=squel['insert']()[_0x5608('0x68')](_0x5608('0x7f'))[_0x5608('0x6a')]([_0x5608('0x80'),'scheduledAt',_0x5608('0x6b'),_0x5608('0x81'),_0x5608('0x54'),_0x5608('0x53')],squel[_0x5608('0x6e')]()[_0x5608('0x6f')](_0x5608('0x82'),'id')[_0x5608('0x6f')](_0x5608('0x7b'),_0x5608('0x6c'))[_0x5608('0x6f')](_0x5608('0x83'),_0x5608('0x6b'))['field']('ci.OrderBY','OrderBy')[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27',_0x5608('0x54'))[_0x5608('0x6f')]('\x27'+_0x4b3846+'\x27','updatedAt')[_0x5608('0x72')](_0x5608('0x84'),'ci')[_0x5608('0x85')]('cm_hopper','h',_0x5608('0x86'))[_0x5608('0x39')]('h.ListId\x20=\x20?',_0x233126[_0x5608('0x70')][_0x5608('0x71')]())[_0x5608('0x39')]('h.CampaignId=?',_0x372f71[_0x5608('0x46')]['id'][_0x5608('0x71')]())[_0x5608('0x39')](_0x5608('0x87'),_0x4b3846))['toString']();_0x3fd1c3[_0x5608('0x88')](db[_0x5608('0x89')][_0x5608('0x2f')](_0xff1183));_0x28f8b3[_0x5608('0x88')](db[_0x5608('0x89')]['query'](_0x37a69a));}return BPromise[_0x5608('0x8a')](_0x3fd1c3);}})['then'](function(){return BPromise[_0x5608('0x8a')](_0x28f8b3);})[_0x5608('0x27')](function(){return _0x2895a7;})[_0x5608('0x27')](respondWithResult(_0x1df229,null))['catch'](handleError(_0x1df229,null));};exports[_0x5608('0x8b')]=function(_0x1013b2,_0x1bec67,_0xd054c0){return db[_0x5608('0x40')]['find']({'where':{'id':_0x1013b2['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x1bec67,null))['then'](function(_0x359ad6){if(_0x359ad6){return _0x359ad6['removeLists'](_0x1013b2['query']['ids']);}})[_0x5608('0x27')](function(_0x3a3fc5){if(_0x3a3fc5){return db[_0x5608('0x58')][_0x5608('0x23')]({'where':{'ListId':_0x1013b2[_0x5608('0x2f')][_0x5608('0x64')],'CampaignId':_0x1013b2[_0x5608('0x46')]['id']}})['then'](function(){return _0x3a3fc5;});}})[_0x5608('0x27')](respondWithStatusCode(_0x1bec67,null))[_0x5608('0x45')](handleError(_0x1bec67,null));};exports[_0x5608('0x8c')]=function(_0x820c5,_0x161adb,_0x411f93){var _0x1a2561={};var _0x13723a={};var _0x1601be;var _0x4ffa2e;return db['Campaign'][_0x5608('0x5b')]({'where':{'id':_0x820c5[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x161adb,null))[_0x5608('0x27')](function(_0x24e7a4){if(_0x24e7a4){_0x1601be=_0x24e7a4;_0x13723a['model']=_[_0x5608('0x47')](db[_0x5608('0x61')][_0x5608('0x2b')]);_0x13723a['query']=_['keys'](_0x820c5[_0x5608('0x2f')]);_0x13723a[_0x5608('0x30')]=_['intersection'](_0x13723a[_0x5608('0x33')],_0x13723a[_0x5608('0x2f')]);_0x1a2561[_0x5608('0x32')]=_[_0x5608('0x31')](_0x13723a['model'],qs['fields'](_0x820c5[_0x5608('0x2f')][_0x5608('0x34')]));_0x1a2561['attributes']=_0x1a2561[_0x5608('0x32')][_0x5608('0x35')]?_0x1a2561[_0x5608('0x32')]:_0x13723a[_0x5608('0x33')];_0x1a2561[_0x5608('0x37')]=qs[_0x5608('0x38')](_0x820c5[_0x5608('0x2f')]['sort']);_0x1a2561[_0x5608('0x39')]=qs['filters'](_[_0x5608('0x3a')](_0x820c5[_0x5608('0x2f')],_0x13723a[_0x5608('0x30')]));if(_0x820c5[_0x5608('0x2f')]['filter']){_0x1a2561[_0x5608('0x39')]=_[_0x5608('0x3b')](_0x1a2561[_0x5608('0x39')],{'$or':_[_0x5608('0x2e')](_0x1a2561[_0x5608('0x32')],function(_0x5c320a){var _0x2a82ad={};_0x2a82ad[_0x5c320a]={'$like':'%'+_0x820c5[_0x5608('0x2f')][_0x5608('0x3e')]+'%'};return _0x2a82ad;})});}_0x1a2561=_[_0x5608('0x3b')]({},_0x1a2561,_0x820c5[_0x5608('0x3f')]);return _0x1601be['getBlackLists'](_0x1a2561);}})[_0x5608('0x27')](function(_0x372cf3){if(_0x372cf3){_0x4ffa2e=_0x372cf3[_0x5608('0x35')];if(!_0x820c5[_0x5608('0x2f')][_0x5608('0x59')](_0x5608('0x36'))){_0x1a2561[_0x5608('0x1b')]=qs[_0x5608('0x1b')](_0x820c5[_0x5608('0x2f')][_0x5608('0x1b')]);_0x1a2561[_0x5608('0x1d')]=qs['offset'](_0x820c5['query'][_0x5608('0x1d')]);}return _0x1601be[_0x5608('0x8c')](_0x1a2561);}})['then'](function(_0x3c27e5){if(_0x3c27e5){return _0x3c27e5?{'count':_0x4ffa2e,'rows':_0x3c27e5}:null;}})[_0x5608('0x27')](respondWithResult(_0x161adb,null))['catch'](handleError(_0x161adb,null));};exports['addBlackLists']=function(_0x4d0e22,_0x5dc08d,_0x4a33e0){var _0x4365f6,_0x12e676;var _0xa99465=[];var _0x51ebfc=moment()[_0x5608('0x63')](_0x5608('0x8d'));return db[_0x5608('0x40')][_0x5608('0x48')]({'where':{'id':_0x4d0e22[_0x5608('0x46')]['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x5dc08d,null))['then'](function(_0x1be058){if(_0x1be058){_0x12e676=_0x1be058;return _0x1be058[_0x5608('0x8e')](_0x4d0e22['body'][_0x5608('0x64')],_['omit'](_0x4d0e22[_0x5608('0x4a')],[_0x5608('0x64'),'id'])||{});}return null;})[_0x5608('0x8f')](function(_0x2e0d46){var _0x4e58ca;var _0x73916e;_0x4365f6=_0x2e0d46||[];var _0x13f3fc=[];if(_0x2e0d46){for(var _0x606ace=0x0;_0x606ace<_0x2e0d46[_0x5608('0x35')];_0x606ace+=0x1){var _0x560805=_0x2e0d46[_0x606ace][_0x5608('0x24')]({'plain':!![]});_0x4e58ca=squel[_0x5608('0x67')]()[_0x5608('0x68')](_0x5608('0x90'))['fromQuery'](['phone',_0x5608('0x6d'),_0x5608('0x7e'),_0x5608('0x5e'),_0x5608('0x54'),_0x5608('0x53')],squel['select']()['field'](_0x5608('0x6b'),'phone')[_0x5608('0x6f')]('id',_0x5608('0x6d'))['field'](_0x560805['CmListId']['toString'](),'ListId')['field'](_0x4d0e22[_0x5608('0x46')]['id']['toString'](),_0x5608('0x5e'))[_0x5608('0x6f')](_0x5608('0x7b'),'createdAt')[_0x5608('0x6f')](_0x5608('0x7b'),'updatedAt')[_0x5608('0x72')](_0x5608('0x7c'))['where'](_0x5608('0x7d'))[_0x5608('0x39')](_0x5608('0x73'),_0x560805[_0x5608('0x70')][_0x5608('0x71')]())['where'](_0x5608('0x74')))['toString']();_0x13f3fc[_0x5608('0x88')](db['sequelize'][_0x5608('0x2f')](_0x4e58ca));}return BPromise[_0x5608('0x8a')](_0x13f3fc);}})[_0x5608('0x27')](function(){return _0x4365f6;})[_0x5608('0x27')](respondWithResult(_0x5dc08d,null))['catch'](handleError(_0x5dc08d,null));};exports[_0x5608('0x91')]=function(_0x25dea3,_0x47ac94,_0x48b75e){return db['Campaign'][_0x5608('0x48')]({'where':{'id':_0x25dea3['params']['id']}})[_0x5608('0x27')](handleEntityNotFound(_0x47ac94,null))[_0x5608('0x27')](function(_0x516565){if(_0x516565){return _0x516565['removeBlackLists'](_0x25dea3[_0x5608('0x2f')][_0x5608('0x64')]);}})[_0x5608('0x27')](function(_0x281ecc){if(_0x281ecc){return db[_0x5608('0x5f')][_0x5608('0x23')]({'where':{'ListId':_0x25dea3[_0x5608('0x2f')][_0x5608('0x64')],'CampaignId':_0x25dea3[_0x5608('0x46')]['id']}})[_0x5608('0x27')](function(){return _0x281ecc;});}})['then'](respondWithStatusCode(_0x47ac94,null))[_0x5608('0x45')](handleError(_0x47ac94,null));}; \ No newline at end of file +var _0x4024=['rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','name','index','map','Campaign','rawAttributes','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','order','CampaignId','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','CmListId','CampaignId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format'];(function(_0x10207b,_0x4b71fc){var _0x1f944d=function(_0x905f5c){while(--_0x905f5c){_0x10207b['push'](_0x10207b['shift']());}};_0x1f944d(++_0x4b71fc);}(_0x4024,0x89));var _0x4402=function(_0x5e33c6,_0x4611e0){_0x5e33c6=_0x5e33c6-0x0;var _0x23d965=_0x4024[_0x5e33c6];return _0x23d965;};'use strict';var emlformat=require(_0x4402('0x0'));var rimraf=require(_0x4402('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4402('0x2'));var rp=require(_0x4402('0x3'));var moment=require('moment');var BPromise=require(_0x4402('0x4'));var Mustache=require('mustache');var util=require(_0x4402('0x5'));var path=require(_0x4402('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4402('0x7'));var fs=require('fs');var fs_extra=require(_0x4402('0x8'));var _=require(_0x4402('0x9'));var squel=require('squel');var crypto=require(_0x4402('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4402('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4402('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4402('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4402('0xe'));var logger=require('../../config/logger')(_0x4402('0xf'));var utils=require(_0x4402('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4402('0x11'));var db=require(_0x4402('0x12'))['db'];function respondWithStatusCode(_0xa819e9,_0x4c9032){_0x4c9032=_0x4c9032||0xcc;return function(_0x7e4475){if(_0x7e4475){return _0xa819e9[_0x4402('0x13')](_0x4c9032);}return _0xa819e9[_0x4402('0x14')](_0x4c9032)[_0x4402('0x15')]();};}function respondWithResult(_0x248ad9,_0x31710c){_0x31710c=_0x31710c||0xc8;return function(_0x18c7a8){if(_0x18c7a8){return _0x248ad9[_0x4402('0x14')](_0x31710c)[_0x4402('0x16')](_0x18c7a8);}};}function respondWithFilteredResult(_0x263a57,_0x375166){return function(_0xc03f65){if(_0xc03f65){var _0x2a2ce8=typeof _0x375166[_0x4402('0x17')]===_0x4402('0x18')&&typeof _0x375166[_0x4402('0x19')]===_0x4402('0x18');var _0x25e88b=_0xc03f65[_0x4402('0x1a')];var _0x231382=_0x2a2ce8?0x0:_0x375166['offset'];var _0x494389=_0x2a2ce8?_0xc03f65[_0x4402('0x1a')]:_0x375166[_0x4402('0x17')]+_0x375166['limit'];var _0x756962;if(_0x494389>=_0x25e88b){_0x494389=_0x25e88b;_0x756962=0xc8;}else{_0x756962=0xce;}_0x263a57[_0x4402('0x14')](_0x756962);return _0x263a57['set'](_0x4402('0x1b'),_0x231382+'-'+_0x494389+'/'+_0x25e88b)['json'](_0xc03f65);}return null;};}function patchUpdates(_0x55cc8c){return function(_0x1b9599){try{jsonpatch[_0x4402('0x1c')](_0x1b9599,_0x55cc8c,!![]);}catch(_0x28f44b){return BPromise['reject'](_0x28f44b);}return _0x1b9599[_0x4402('0x1d')]();};}function saveUpdates(_0x57a25e,_0x47ab54){return function(_0x6f1f72){if(_0x6f1f72){return _0x6f1f72[_0x4402('0x1e')](_0x57a25e)[_0x4402('0x1f')](function(_0xc583b){return _0xc583b;});}return null;};}function removeEntity(_0x258d10,_0x2e6fee){return function(_0x289a3e){if(_0x289a3e){return _0x289a3e[_0x4402('0x20')]()[_0x4402('0x1f')](function(){var _0x4d6846=_0x289a3e[_0x4402('0x21')]({'plain':!![]});var _0x4e1c04=_0x4402('0x22');return db[_0x4402('0x23')][_0x4402('0x20')]({'where':{'type':_0x4e1c04,'resourceId':_0x4d6846['id']}})[_0x4402('0x1f')](function(){return _0x289a3e;});})['then'](function(){_0x258d10[_0x4402('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59d52f,_0x1be54d){return function(_0x395e49){if(!_0x395e49){_0x59d52f[_0x4402('0x13')](0x194);}return _0x395e49;};}function handleError(_0xabf61b,_0x3eb796){_0x3eb796=_0x3eb796||0x1f4;return function(_0x514e41){logger[_0x4402('0x24')](_0x514e41['stack']);if(_0x514e41[_0x4402('0x25')]){delete _0x514e41[_0x4402('0x25')];}_0xabf61b[_0x4402('0x14')](_0x3eb796)['send'](_0x514e41);};}exports[_0x4402('0x26')]=function(_0x6c87f6,_0x316239){var _0x3f4bcb={},_0x2526d1={},_0x605702={'count':0x0,'rows':[]};var _0x1189b8=_[_0x4402('0x27')](db[_0x4402('0x28')][_0x4402('0x29')],function(_0xcea26b){return{'name':_0xcea26b['fieldName'],'type':_0xcea26b[_0x4402('0x2a')]['key']};});_0x2526d1[_0x4402('0x2b')]=_['map'](_0x1189b8,_0x4402('0x25'));_0x2526d1[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x6c87f6[_0x4402('0x2c')]);_0x2526d1[_0x4402('0x2e')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],_0x2526d1[_0x4402('0x2c')]);_0x3f4bcb[_0x4402('0x2f')]=_['intersection'](_0x2526d1[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x6c87f6['query'][_0x4402('0x30')]));_0x3f4bcb[_0x4402('0x2f')]=_0x3f4bcb[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f4bcb[_0x4402('0x2f')]:_0x2526d1[_0x4402('0x2b')];if(!_0x6c87f6[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3f4bcb['limit']=qs[_0x4402('0x19')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x19')]);_0x3f4bcb['offset']=qs[_0x4402('0x17')](_0x6c87f6[_0x4402('0x2c')]['offset']);}_0x3f4bcb['order']=qs[_0x4402('0x34')](_0x6c87f6[_0x4402('0x2c')][_0x4402('0x34')]);_0x3f4bcb[_0x4402('0x35')]=qs['filters'](_['pick'](_0x6c87f6['query'],_0x2526d1[_0x4402('0x2e')]),_0x1189b8);if(_0x6c87f6[_0x4402('0x2c')][_0x4402('0x36')]){_0x3f4bcb[_0x4402('0x35')]=_['merge'](_0x3f4bcb[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x1189b8,function(_0x35f877){if(_0x35f877['type']!==_0x4402('0x37')){var _0x5aca7b={};_0x5aca7b[_0x35f877[_0x4402('0x25')]]={'$like':'%'+_0x6c87f6[_0x4402('0x2c')]['filter']+'%'};return _0x5aca7b;}})});}_0x3f4bcb=_[_0x4402('0x38')]({},_0x3f4bcb,_0x6c87f6['options']);var _0x423628={'where':_0x3f4bcb[_0x4402('0x35')]};return db['Campaign'][_0x4402('0x1a')](_0x423628)[_0x4402('0x1f')](function(_0x250f09){_0x605702[_0x4402('0x1a')]=_0x250f09;if(_0x6c87f6['query']['includeAll']){_0x3f4bcb[_0x4402('0x39')]=[{'all':!![]}];}return db['Campaign'][_0x4402('0x3a')](_0x3f4bcb);})[_0x4402('0x1f')](function(_0xb9cf85){_0x605702[_0x4402('0x3b')]=_0xb9cf85;return _0x605702;})[_0x4402('0x1f')](respondWithFilteredResult(_0x316239,_0x3f4bcb))[_0x4402('0x3c')](handleError(_0x316239,null));};exports[_0x4402('0x3d')]=function(_0x390169,_0x1f9b3e){var _0x42812b={'raw':![],'where':{'id':_0x390169[_0x4402('0x3e')]['id']}},_0x486e43={};_0x486e43[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x28')][_0x4402('0x29')]);_0x486e43['query']=_[_0x4402('0x2d')](_0x390169[_0x4402('0x2c')]);_0x486e43[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],_0x486e43['query']);_0x42812b[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x486e43[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x390169[_0x4402('0x2c')][_0x4402('0x30')]));_0x42812b[_0x4402('0x2f')]=_0x42812b[_0x4402('0x2f')][_0x4402('0x31')]?_0x42812b[_0x4402('0x2f')]:_0x486e43[_0x4402('0x2b')];if(_0x390169['query'][_0x4402('0x40')]){_0x42812b['include']=[{'all':!![]}];}_0x42812b=_[_0x4402('0x38')]({},_0x42812b,_0x390169[_0x4402('0x41')]);return db['Campaign'][_0x4402('0x42')](_0x42812b)[_0x4402('0x1f')](handleEntityNotFound(_0x1f9b3e,null))[_0x4402('0x1f')](respondWithResult(_0x1f9b3e,null))[_0x4402('0x3c')](handleError(_0x1f9b3e,null));};exports[_0x4402('0x43')]=function(_0x2503eb,_0x5b094b){return db[_0x4402('0x28')][_0x4402('0x43')](_0x2503eb[_0x4402('0x44')],{})[_0x4402('0x1f')](function(_0x2b2ed3){var _0x24d51c=_0x2503eb[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0x24d51c)throw new Error(_0x4402('0x46'));if(_0x24d51c['role']==='user'){var _0x5ab12b=_0x2b2ed3['get']({'plain':!![]});var _0x257010=_0x4402('0x22');return db[_0x4402('0x47')][_0x4402('0x42')]({'where':{'name':_0x257010,'userProfileId':_0x24d51c['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x12d6de){if(_0x12d6de&&_0x12d6de[_0x4402('0x48')]===0x0){return db[_0x4402('0x23')][_0x4402('0x43')]({'name':_0x5ab12b[_0x4402('0x25')],'resourceId':_0x5ab12b['id'],'type':_0x12d6de[_0x4402('0x25')],'sectionId':_0x12d6de['id']},{})['then'](function(){return _0x2b2ed3;});}else{return _0x2b2ed3;}})[_0x4402('0x3c')](function(_0x2a8085){logger[_0x4402('0x24')](_0x4402('0x49'),_0x2a8085);throw _0x2a8085;});}return _0x2b2ed3;})[_0x4402('0x1f')](respondWithResult(_0x5b094b,0xc9))[_0x4402('0x3c')](handleError(_0x5b094b,null));};exports['clone']=function(_0xe8a8e9,_0x642ab4){var _0x3f45c3={'where':{'id':_0xe8a8e9[_0x4402('0x3e')]['id']}},_0x295c9b={};_0x295c9b[_0x4402('0x2b')]=_[_0x4402('0x2d')](db['Campaign']['rawAttributes']);_0x3f45c3[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x295c9b[_0x4402('0x2b')],qs['fields'](_0xe8a8e9['query'][_0x4402('0x30')]));_0x3f45c3[_0x4402('0x2f')]=_0x3f45c3[_0x4402('0x2f')][_0x4402('0x31')]?_0x3f45c3[_0x4402('0x2f')]:_0x295c9b[_0x4402('0x2b')];if(_0xe8a8e9[_0x4402('0x2c')][_0x4402('0x40')]){_0x3f45c3[_0x4402('0x39')]=[{'all':!![]}];}_0x3f45c3=_[_0x4402('0x38')]({},_0x3f45c3,_0xe8a8e9[_0x4402('0x41')]);return db[_0x4402('0x28')][_0x4402('0x42')](_0x3f45c3)['then'](handleEntityNotFound(_0x642ab4,null))[_0x4402('0x1f')](function(_0x4b7057){if(_0x4b7057){var _0xe4530a=_0x4b7057['get']({'plain':!![]});_0xe4530a=qs[_0x4402('0x4a')](_0xe4530a,['id',_0x4402('0x4b'),_0x4402('0x4c')]);_0xe8a8e9[_0x4402('0x44')]=_[_0x4402('0x4a')](_0xe8a8e9[_0x4402('0x44')],['id','createdAt',_0x4402('0x4c')]);return db[_0x4402('0x28')][_0x4402('0x43')](_[_0x4402('0x38')](_0xe4530a,_0xe8a8e9[_0x4402('0x44')]),{'include':_0xe8a8e9['query'][_0x4402('0x40')]?[{'all':!![]}]:undefined})[_0x4402('0x1f')](function(_0x474b04){var _0xc15c0b=_0xe8a8e9[_0x4402('0x45')][_0x4402('0x21')]({'plain':!![]});if(!_0xc15c0b)throw new Error(_0x4402('0x46'));if(_0xc15c0b[_0x4402('0x4d')]==='user'){var _0x11c1b8=_0x474b04[_0x4402('0x21')]({'plain':!![]});var _0x53a9f3=_0x4402('0x22');return db[_0x4402('0x47')]['find']({'where':{'name':_0x53a9f3,'userProfileId':_0xc15c0b['userProfileId']},'raw':!![]})[_0x4402('0x1f')](function(_0x1746c6){if(_0x1746c6&&_0x1746c6[_0x4402('0x48')]===0x0){return db['UserProfileResource'][_0x4402('0x43')]({'name':_0x11c1b8[_0x4402('0x25')],'resourceId':_0x11c1b8['id'],'type':_0x1746c6[_0x4402('0x25')],'sectionId':_0x1746c6['id']},{})['then'](function(){return _0x474b04;});}else{return _0x474b04;}})[_0x4402('0x3c')](function(_0x41a2c6){logger[_0x4402('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41a2c6);throw _0x41a2c6;});}return _0x474b04;});}})[_0x4402('0x1f')](respondWithResult(_0x642ab4,0xc9))[_0x4402('0x3c')](handleError(_0x642ab4,null));};exports['update']=function(_0x5cef56,_0x40869c){if(_0x5cef56['body']['id']){delete _0x5cef56[_0x4402('0x44')]['id'];}return db[_0x4402('0x28')]['find']({'where':{'id':_0x5cef56['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x40869c,null))[_0x4402('0x1f')](saveUpdates(_0x5cef56[_0x4402('0x44')],null))[_0x4402('0x1f')](respondWithResult(_0x40869c,null))['catch'](handleError(_0x40869c,null));};exports[_0x4402('0x20')]=function(_0x30e5d5,_0x22ed41){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x30e5d5[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x22ed41,null))['then'](removeEntity(_0x22ed41,null))[_0x4402('0x3c')](handleError(_0x22ed41,null));};exports[_0x4402('0x4e')]=function(_0x559d1c,_0x508111,_0x2bee9d){var _0x4aaa60={'raw':!![],'where':{}};var _0x30569e={};var _0x586689={'count':0x0,'rows':[]};return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x559d1c[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x508111,null))[_0x4402('0x1f')](function(_0x1c1857){if(_0x1c1857){_0x30569e[_0x4402('0x2b')]=_[_0x4402('0x2d')](db[_0x4402('0x50')][_0x4402('0x29')]);_0x30569e[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x559d1c[_0x4402('0x2c')]);_0x30569e[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x30569e[_0x4402('0x2b')],_0x30569e['query']);_0x4aaa60[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x30569e[_0x4402('0x2b')],qs['fields'](_0x559d1c[_0x4402('0x2c')]['fields']));_0x4aaa60[_0x4402('0x2f')]=_0x4aaa60[_0x4402('0x2f')][_0x4402('0x31')]?_0x4aaa60[_0x4402('0x2f')]:_0x30569e['model'];if(!_0x559d1c[_0x4402('0x2c')]['hasOwnProperty'](_0x4402('0x33'))){_0x4aaa60[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x559d1c['query'][_0x4402('0x19')]);_0x4aaa60['offset']=qs[_0x4402('0x17')](_0x559d1c[_0x4402('0x2c')][_0x4402('0x17')]);}_0x4aaa60[_0x4402('0x51')]=qs[_0x4402('0x34')](_0x559d1c[_0x4402('0x2c')][_0x4402('0x34')]);_0x4aaa60[_0x4402('0x35')]=qs[_0x4402('0x2e')](_['pick'](_0x559d1c[_0x4402('0x2c')],_0x30569e[_0x4402('0x2e')]));_0x4aaa60[_0x4402('0x35')][_0x4402('0x52')]=_0x1c1857['id'];if(_0x559d1c[_0x4402('0x2c')][_0x4402('0x36')]){_0x4aaa60[_0x4402('0x35')]=_[_0x4402('0x38')](_0x4aaa60[_0x4402('0x35')],{'$or':_['map'](_0x4aaa60[_0x4402('0x2f')],function(_0x2a6dc1){var _0x2eae1c={};_0x2eae1c[_0x2a6dc1]={'$like':'%'+_0x559d1c['query'][_0x4402('0x36')]+'%'};return _0x2eae1c;})});}_0x4aaa60=_['merge']({},_0x4aaa60,_0x559d1c[_0x4402('0x41')]);return db['CmHopper'][_0x4402('0x1a')]({'where':_0x4aaa60[_0x4402('0x35')]})['then'](function(_0x43b4aa){_0x586689['count']=_0x43b4aa;if(_0x559d1c[_0x4402('0x2c')][_0x4402('0x40')]){_0x4aaa60['include']=[{'all':!![]}];}return db[_0x4402('0x50')][_0x4402('0x3a')](_0x4aaa60);})['then'](function(_0x189259){_0x586689[_0x4402('0x3b')]=_0x189259;return _0x586689;});}})['then'](respondWithFilteredResult(_0x508111,_0x4aaa60))[_0x4402('0x3c')](handleError(_0x508111,null));};exports[_0x4402('0x53')]=function(_0x1a9163,_0x12b834,_0x439e95){var _0x17b133={'raw':!![],'where':{}};var _0x7f28d3={};var _0x370493={'count':0x0,'rows':[]};return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x1a9163[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x12b834,null))[_0x4402('0x1f')](function(_0x2dd4b7){if(_0x2dd4b7){_0x7f28d3['model']=_[_0x4402('0x2d')](db[_0x4402('0x54')]['rawAttributes']);_0x7f28d3[_0x4402('0x2c')]=_['keys'](_0x1a9163[_0x4402('0x2c')]);_0x7f28d3[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x7f28d3['model'],_0x7f28d3[_0x4402('0x2c')]);_0x17b133[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x7f28d3['model'],qs[_0x4402('0x30')](_0x1a9163[_0x4402('0x2c')][_0x4402('0x30')]));_0x17b133[_0x4402('0x2f')]=_0x17b133['attributes'][_0x4402('0x31')]?_0x17b133[_0x4402('0x2f')]:_0x7f28d3[_0x4402('0x2b')];if(!_0x1a9163[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x17b133[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x1a9163[_0x4402('0x2c')][_0x4402('0x19')]);_0x17b133[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x1a9163[_0x4402('0x2c')]['offset']);}_0x17b133[_0x4402('0x51')]=qs[_0x4402('0x34')](_0x1a9163[_0x4402('0x2c')][_0x4402('0x34')]);_0x17b133['where']=qs['filters'](_[_0x4402('0x55')](_0x1a9163[_0x4402('0x2c')],_0x7f28d3[_0x4402('0x2e')]));_0x17b133[_0x4402('0x35')]['CampaignId']=_0x2dd4b7['id'];if(_0x1a9163[_0x4402('0x2c')][_0x4402('0x36')]){_0x17b133['where']=_[_0x4402('0x38')](_0x17b133[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x17b133[_0x4402('0x2f')],function(_0x297884){var _0x5f5945={};_0x5f5945[_0x297884]={'$like':'%'+_0x1a9163[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x5f5945;})});}_0x17b133=_[_0x4402('0x38')]({},_0x17b133,_0x1a9163[_0x4402('0x41')]);return db[_0x4402('0x54')][_0x4402('0x1a')]({'where':_0x17b133[_0x4402('0x35')]})['then'](function(_0x218640){_0x370493[_0x4402('0x1a')]=_0x218640;if(_0x1a9163[_0x4402('0x2c')][_0x4402('0x40')]){_0x17b133[_0x4402('0x39')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4402('0x3a')](_0x17b133);})[_0x4402('0x1f')](function(_0x572e21){_0x370493[_0x4402('0x3b')]=_0x572e21;return _0x370493;});}})['then'](respondWithFilteredResult(_0x12b834,_0x17b133))['catch'](handleError(_0x12b834,null));};exports[_0x4402('0x56')]=function(_0x505a13,_0x32be98,_0x520907){var _0x51e85d={'raw':!![],'where':{}};var _0x16af14={};var _0x7adf6d={'count':0x0,'rows':[]};return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x505a13[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x32be98,null))['then'](function(_0x596499){if(_0x596499){_0x16af14[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x57')]['rawAttributes']);_0x16af14['query']=_[_0x4402('0x2d')](_0x505a13['query']);_0x16af14[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x16af14[_0x4402('0x2b')],_0x16af14[_0x4402('0x2c')]);_0x51e85d[_0x4402('0x2f')]=_['intersection'](_0x16af14['model'],qs[_0x4402('0x30')](_0x505a13[_0x4402('0x2c')]['fields']));_0x51e85d[_0x4402('0x2f')]=_0x51e85d[_0x4402('0x2f')][_0x4402('0x31')]?_0x51e85d[_0x4402('0x2f')]:_0x16af14[_0x4402('0x2b')];if(!_0x505a13[_0x4402('0x2c')]['hasOwnProperty']('nolimit')){_0x51e85d[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x505a13[_0x4402('0x2c')][_0x4402('0x19')]);_0x51e85d[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x505a13['query'][_0x4402('0x17')]);}_0x51e85d[_0x4402('0x51')]=qs[_0x4402('0x34')](_0x505a13[_0x4402('0x2c')][_0x4402('0x34')]);_0x51e85d['where']=qs[_0x4402('0x2e')](_[_0x4402('0x55')](_0x505a13[_0x4402('0x2c')],_0x16af14[_0x4402('0x2e')]));_0x51e85d[_0x4402('0x35')][_0x4402('0x52')]=_0x596499['id'];if(_0x505a13['query']['filter']){_0x51e85d[_0x4402('0x35')]=_['merge'](_0x51e85d[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x51e85d[_0x4402('0x2f')],function(_0x3eb7f0){var _0x3636e9={};_0x3636e9[_0x3eb7f0]={'$like':'%'+_0x505a13[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x3636e9;})});}_0x51e85d=_[_0x4402('0x38')]({},_0x51e85d,_0x505a13[_0x4402('0x41')]);return db[_0x4402('0x57')][_0x4402('0x1a')]({'where':_0x51e85d[_0x4402('0x35')]})[_0x4402('0x1f')](function(_0x372c6e){_0x7adf6d[_0x4402('0x1a')]=_0x372c6e;if(_0x505a13[_0x4402('0x2c')][_0x4402('0x40')]){_0x51e85d[_0x4402('0x39')]=[{'all':!![]}];}return db[_0x4402('0x57')][_0x4402('0x3a')](_0x51e85d);})[_0x4402('0x1f')](function(_0x385b8e){_0x7adf6d[_0x4402('0x3b')]=_0x385b8e;return _0x7adf6d;});}})['then'](respondWithFilteredResult(_0x32be98,_0x51e85d))[_0x4402('0x3c')](handleError(_0x32be98,null));};exports[_0x4402('0x58')]=function(_0x3a3734,_0x2631bc,_0x98b130){var _0x3511f6={'raw':!![],'where':{}};var _0x5dfe53={};var _0x4ed2fa={'count':0x0,'rows':[]};return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x3a3734[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2631bc,null))['then'](function(_0x54fee3){if(_0x54fee3){_0x5dfe53['model']=_[_0x4402('0x2d')](db[_0x4402('0x59')][_0x4402('0x29')]);_0x5dfe53['query']=_[_0x4402('0x2d')](_0x3a3734[_0x4402('0x2c')]);_0x5dfe53[_0x4402('0x2e')]=_['intersection'](_0x5dfe53[_0x4402('0x2b')],_0x5dfe53['query']);_0x3511f6[_0x4402('0x2f')]=_[_0x4402('0x3f')](_0x5dfe53[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x3a3734[_0x4402('0x2c')][_0x4402('0x30')]));_0x3511f6['attributes']=_0x3511f6[_0x4402('0x2f')][_0x4402('0x31')]?_0x3511f6[_0x4402('0x2f')]:_0x5dfe53['model'];if(!_0x3a3734[_0x4402('0x2c')]['hasOwnProperty'](_0x4402('0x33'))){_0x3511f6[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x3a3734[_0x4402('0x2c')]['limit']);_0x3511f6[_0x4402('0x17')]=qs[_0x4402('0x17')](_0x3a3734[_0x4402('0x2c')][_0x4402('0x17')]);}_0x3511f6[_0x4402('0x51')]=qs['sort'](_0x3a3734[_0x4402('0x2c')][_0x4402('0x34')]);_0x3511f6['where']=qs['filters'](_['pick'](_0x3a3734[_0x4402('0x2c')],_0x5dfe53[_0x4402('0x2e')]));_0x3511f6[_0x4402('0x35')][_0x4402('0x52')]=_0x54fee3['id'];if(_0x3a3734['query'][_0x4402('0x36')]){_0x3511f6[_0x4402('0x35')]=_[_0x4402('0x38')](_0x3511f6[_0x4402('0x35')],{'$or':_['map'](_0x3511f6[_0x4402('0x2f')],function(_0x2949ce){var _0x30f26a={};_0x30f26a[_0x2949ce]={'$like':'%'+_0x3a3734['query']['filter']+'%'};return _0x30f26a;})});}_0x3511f6=_['merge']({},_0x3511f6,_0x3a3734[_0x4402('0x41')]);return db['CmHopperBlack'][_0x4402('0x1a')]({'where':_0x3511f6[_0x4402('0x35')]})[_0x4402('0x1f')](function(_0x117911){_0x4ed2fa[_0x4402('0x1a')]=_0x117911;if(_0x3a3734[_0x4402('0x2c')][_0x4402('0x40')]){_0x3511f6[_0x4402('0x39')]=[{'all':!![]}];}return db[_0x4402('0x59')][_0x4402('0x3a')](_0x3511f6);})[_0x4402('0x1f')](function(_0x329b60){_0x4ed2fa[_0x4402('0x3b')]=_0x329b60;return _0x4ed2fa;});}})[_0x4402('0x1f')](respondWithFilteredResult(_0x2631bc,_0x3511f6))['catch'](handleError(_0x2631bc,null));};exports[_0x4402('0x5a')]=function(_0x26f5a9,_0x4cc170,_0x5563e6){var _0x57fd83={};var _0x1aacd7={};var _0x5a3ec8;var _0x47aa8b;return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x26f5a9['params']['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4cc170,null))[_0x4402('0x1f')](function(_0x541cd0){if(_0x541cd0){_0x5a3ec8=_0x541cd0;_0x1aacd7[_0x4402('0x2b')]=_['keys'](db[_0x4402('0x5b')][_0x4402('0x29')]);_0x1aacd7[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x26f5a9[_0x4402('0x2c')]);_0x1aacd7[_0x4402('0x2e')]=_[_0x4402('0x3f')](_0x1aacd7[_0x4402('0x2b')],_0x1aacd7[_0x4402('0x2c')]);_0x57fd83['attributes']=_[_0x4402('0x3f')](_0x1aacd7[_0x4402('0x2b')],qs[_0x4402('0x30')](_0x26f5a9[_0x4402('0x2c')]['fields']));_0x57fd83[_0x4402('0x2f')]=_0x57fd83['attributes'][_0x4402('0x31')]?_0x57fd83[_0x4402('0x2f')]:_0x1aacd7['model'];_0x57fd83['order']=qs[_0x4402('0x34')](_0x26f5a9[_0x4402('0x2c')][_0x4402('0x34')]);_0x57fd83[_0x4402('0x35')]=qs[_0x4402('0x2e')](_[_0x4402('0x55')](_0x26f5a9['query'],_0x1aacd7['filters']));if(_0x26f5a9[_0x4402('0x2c')][_0x4402('0x36')]){_0x57fd83[_0x4402('0x35')]=_[_0x4402('0x38')](_0x57fd83[_0x4402('0x35')],{'$or':_[_0x4402('0x27')](_0x57fd83['attributes'],function(_0x28720c){var _0x3e00bf={};_0x3e00bf[_0x28720c]={'$like':'%'+_0x26f5a9[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x3e00bf;})});}_0x57fd83=_[_0x4402('0x38')]({},_0x57fd83,_0x26f5a9[_0x4402('0x41')]);return _0x5a3ec8['getLists'](_0x57fd83);}})['then'](function(_0x1a3393){if(_0x1a3393){_0x47aa8b=_0x1a3393['length'];if(!_0x26f5a9[_0x4402('0x2c')][_0x4402('0x32')]('nolimit')){_0x57fd83[_0x4402('0x19')]=qs['limit'](_0x26f5a9[_0x4402('0x2c')][_0x4402('0x19')]);_0x57fd83[_0x4402('0x17')]=qs['offset'](_0x26f5a9[_0x4402('0x2c')]['offset']);}return _0x5a3ec8[_0x4402('0x5a')](_0x57fd83);}})[_0x4402('0x1f')](function(_0x206058){if(_0x206058){return _0x206058?{'count':_0x47aa8b,'rows':_0x206058}:null;}})[_0x4402('0x1f')](respondWithResult(_0x4cc170,null))[_0x4402('0x3c')](handleError(_0x4cc170,null));};exports['addLists']=function(_0x4b999c,_0x135fac,_0x5c1e8e){var _0x2bc5a3,_0x38009f;var _0x559802=[];var _0x50d453=moment()[_0x4402('0x5c')](_0x4402('0x5d'));return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x4b999c[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x135fac,null))[_0x4402('0x1f')](function(_0x93b7b4){if(_0x93b7b4){_0x38009f=_0x93b7b4;return _0x93b7b4['addLists'](_0x4b999c['body'][_0x4402('0x5e')],_[_0x4402('0x4a')](_0x4b999c[_0x4402('0x44')],['ids','id'])||{});}return null;})[_0x4402('0x5f')](function(_0x5ef261){var _0x224182;var _0x1237a3;_0x2bc5a3=_0x5ef261||[];var _0x364423=[];if(_0x5ef261){for(var _0x4a0fd9=0x0;_0x4a0fd9<_0x5ef261[_0x4402('0x31')];_0x4a0fd9+=0x1){var _0x12569b=_0x5ef261[_0x4a0fd9]['get']({'plain':!![]});_0x38009f[_0x4402('0x60')]=_0x4b999c[_0x4402('0x44')][_0x4402('0x60')]?_0x4b999c[_0x4402('0x44')][_0x4402('0x60')]:_0x38009f[_0x4402('0x60')];switch(_0x38009f[_0x4402('0x60')]){case _0x4402('0x61'):_0x224182=squel[_0x4402('0x62')]()[_0x4402('0x63')](_0x4402('0x64'))[_0x4402('0x65')](['phone',_0x4402('0x66'),_0x4402('0x67'),_0x4402('0x68'),_0x4402('0x52'),_0x4402('0x4b'),_0x4402('0x4c')],squel[_0x4402('0x69')]()[_0x4402('0x6a')](_0x4402('0x6b'),'phone')[_0x4402('0x6a')](_0x4402('0x6c'),_0x4402('0x66'))['field']('id',_0x4402('0x67'))[_0x4402('0x6a')](_0x12569b['CmListId'][_0x4402('0x6d')](),_0x4402('0x68'))['field'](_0x4b999c['params']['id'][_0x4402('0x6d')](),_0x4402('0x52'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4b'))['field']('\x27'+_0x50d453+'\x27',_0x4402('0x4c'))['from'](_0x4402('0x6e'))[_0x4402('0x35')](_0x4402('0x6f'))[_0x4402('0x35')](_0x4402('0x70'),_0x12569b['CmListId'][_0x4402('0x6d')]())[_0x4402('0x35')](_0x4402('0x71'))[_0x4402('0x35')](_0x4402('0x72'),squel[_0x4402('0x69')]()[_0x4402('0x6a')](_0x4402('0x73'))[_0x4402('0x74')](_0x4402('0x75'))[_0x4402('0x35')]('CampaignId\x20=\x20?',_0x4b999c[_0x4402('0x3e')]['id'][_0x4402('0x6d')]()))[_0x4402('0x35')](_0x4402('0x72'),squel[_0x4402('0x69')]()[_0x4402('0x6a')](_0x4402('0x76'))[_0x4402('0x74')](_0x4402('0x64'))[_0x4402('0x35')]('CampaignId\x20=\x20?',_0x4b999c[_0x4402('0x3e')]['id'][_0x4402('0x6d')]())))[_0x4402('0x6d')]();break;case'onlyIfOpen':_0x224182=squel[_0x4402('0x62')]()[_0x4402('0x63')]('cm_hopper')[_0x4402('0x65')]([_0x4402('0x6b'),_0x4402('0x66'),_0x4402('0x67'),_0x4402('0x68'),_0x4402('0x52'),_0x4402('0x4b'),_0x4402('0x4c')],squel[_0x4402('0x69')]()[_0x4402('0x6a')](_0x4402('0x6b'),'phone')[_0x4402('0x6a')](_0x4402('0x6c'),_0x4402('0x66'))[_0x4402('0x6a')]('id',_0x4402('0x67'))[_0x4402('0x6a')](_0x12569b[_0x4402('0x77')][_0x4402('0x6d')](),_0x4402('0x68'))['field'](_0x4b999c[_0x4402('0x3e')]['id']['toString'](),_0x4402('0x52'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4b'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4c'))[_0x4402('0x74')](_0x4402('0x6e'))[_0x4402('0x35')](_0x4402('0x6f'))['where'](_0x4402('0x70'),_0x12569b['CmListId'][_0x4402('0x6d')]())[_0x4402('0x35')](_0x4402('0x71'))[_0x4402('0x35')](_0x4402('0x72'),squel[_0x4402('0x69')]()['field'](_0x4402('0x76'))['from'](_0x4402('0x64'))['where'](_0x4402('0x78'),_0x4b999c[_0x4402('0x3e')]['id'][_0x4402('0x6d')]())))[_0x4402('0x6d')]();break;default:_0x224182=squel[_0x4402('0x62')]()[_0x4402('0x63')](_0x4402('0x64'))[_0x4402('0x65')]([_0x4402('0x6b'),'scheduledAt',_0x4402('0x67'),'ListId','CampaignId','createdAt',_0x4402('0x4c')],squel[_0x4402('0x69')]()[_0x4402('0x6a')]('phone',_0x4402('0x6b'))[_0x4402('0x6a')](_0x4402('0x6c'),_0x4402('0x66'))[_0x4402('0x6a')]('id',_0x4402('0x67'))[_0x4402('0x6a')](_0x12569b[_0x4402('0x77')][_0x4402('0x6d')](),_0x4402('0x68'))[_0x4402('0x6a')](_0x4b999c['params']['id']['toString'](),_0x4402('0x52'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4b'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4c'))['from']('cm_contacts')[_0x4402('0x35')](_0x4402('0x6f'))[_0x4402('0x35')](_0x4402('0x70'),_0x12569b[_0x4402('0x77')][_0x4402('0x6d')]())[_0x4402('0x35')](_0x4402('0x71')))[_0x4402('0x6d')]();}_0x1237a3=squel[_0x4402('0x62')]()[_0x4402('0x63')](_0x4402('0x79'))[_0x4402('0x65')]([_0x4402('0x7a'),_0x4402('0x66'),_0x4402('0x6b'),_0x4402('0x7b'),_0x4402('0x4b'),_0x4402('0x4c')],squel[_0x4402('0x69')]()[_0x4402('0x6a')](_0x4402('0x7c'),'id')[_0x4402('0x6a')](_0x4402('0x6c'),_0x4402('0x66'))[_0x4402('0x6a')]('ci.item',_0x4402('0x6b'))[_0x4402('0x6a')](_0x4402('0x7d'),_0x4402('0x7b'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4b'))[_0x4402('0x6a')]('\x27'+_0x50d453+'\x27',_0x4402('0x4c'))[_0x4402('0x74')]('cm_contact_has_items','ci')[_0x4402('0x7e')](_0x4402('0x64'),'h',_0x4402('0x7f'))[_0x4402('0x35')](_0x4402('0x80'),_0x12569b[_0x4402('0x77')][_0x4402('0x6d')]())[_0x4402('0x35')](_0x4402('0x81'),_0x4b999c['params']['id'][_0x4402('0x6d')]())[_0x4402('0x35')](_0x4402('0x82'),_0x50d453))[_0x4402('0x6d')]();_0x364423[_0x4402('0x83')](db[_0x4402('0x84')][_0x4402('0x2c')](_0x224182));_0x559802['push'](db[_0x4402('0x84')][_0x4402('0x2c')](_0x1237a3));}return BPromise['all'](_0x364423);}})[_0x4402('0x1f')](function(){return BPromise[_0x4402('0x85')](_0x559802);})[_0x4402('0x1f')](function(){return _0x2bc5a3;})[_0x4402('0x1f')](respondWithResult(_0x135fac,null))[_0x4402('0x3c')](handleError(_0x135fac,null));};exports[_0x4402('0x86')]=function(_0x2433a1,_0x4069cf,_0x7be513){return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x2433a1[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x4069cf,null))[_0x4402('0x1f')](function(_0x1f2219){if(_0x1f2219){return _0x1f2219[_0x4402('0x86')](_0x2433a1[_0x4402('0x2c')][_0x4402('0x5e')]);}})[_0x4402('0x1f')](function(_0x2ecd1f){if(_0x2ecd1f){return db[_0x4402('0x50')][_0x4402('0x20')]({'where':{'ListId':_0x2433a1[_0x4402('0x2c')][_0x4402('0x5e')],'CampaignId':_0x2433a1[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](function(){return _0x2ecd1f;});}})[_0x4402('0x1f')](respondWithStatusCode(_0x4069cf,null))[_0x4402('0x3c')](handleError(_0x4069cf,null));};exports[_0x4402('0x87')]=function(_0x3f7f24,_0x24797a,_0x544a09){var _0x3ae530={};var _0x55efac={};var _0x53c06a;var _0x404464;return db[_0x4402('0x28')][_0x4402('0x4f')]({'where':{'id':_0x3f7f24[_0x4402('0x3e')]['id']}})[_0x4402('0x1f')](handleEntityNotFound(_0x24797a,null))['then'](function(_0x2b5efe){if(_0x2b5efe){_0x53c06a=_0x2b5efe;_0x55efac[_0x4402('0x2b')]=_[_0x4402('0x2d')](db['CmList'][_0x4402('0x29')]);_0x55efac[_0x4402('0x2c')]=_[_0x4402('0x2d')](_0x3f7f24[_0x4402('0x2c')]);_0x55efac['filters']=_[_0x4402('0x3f')](_0x55efac[_0x4402('0x2b')],_0x55efac['query']);_0x3ae530['attributes']=_['intersection'](_0x55efac['model'],qs[_0x4402('0x30')](_0x3f7f24[_0x4402('0x2c')][_0x4402('0x30')]));_0x3ae530['attributes']=_0x3ae530[_0x4402('0x2f')][_0x4402('0x31')]?_0x3ae530[_0x4402('0x2f')]:_0x55efac['model'];_0x3ae530[_0x4402('0x51')]=qs[_0x4402('0x34')](_0x3f7f24[_0x4402('0x2c')][_0x4402('0x34')]);_0x3ae530[_0x4402('0x35')]=qs[_0x4402('0x2e')](_['pick'](_0x3f7f24[_0x4402('0x2c')],_0x55efac[_0x4402('0x2e')]));if(_0x3f7f24[_0x4402('0x2c')][_0x4402('0x36')]){_0x3ae530['where']=_[_0x4402('0x38')](_0x3ae530['where'],{'$or':_[_0x4402('0x27')](_0x3ae530['attributes'],function(_0x57bce0){var _0x4331a9={};_0x4331a9[_0x57bce0]={'$like':'%'+_0x3f7f24[_0x4402('0x2c')][_0x4402('0x36')]+'%'};return _0x4331a9;})});}_0x3ae530=_[_0x4402('0x38')]({},_0x3ae530,_0x3f7f24[_0x4402('0x41')]);return _0x53c06a[_0x4402('0x87')](_0x3ae530);}})[_0x4402('0x1f')](function(_0x87e1c){if(_0x87e1c){_0x404464=_0x87e1c['length'];if(!_0x3f7f24[_0x4402('0x2c')][_0x4402('0x32')](_0x4402('0x33'))){_0x3ae530[_0x4402('0x19')]=qs[_0x4402('0x19')](_0x3f7f24['query'][_0x4402('0x19')]);_0x3ae530['offset']=qs[_0x4402('0x17')](_0x3f7f24[_0x4402('0x2c')][_0x4402('0x17')]);}return _0x53c06a['getBlackLists'](_0x3ae530);}})[_0x4402('0x1f')](function(_0x284292){if(_0x284292){return _0x284292?{'count':_0x404464,'rows':_0x284292}:null;}})['then'](respondWithResult(_0x24797a,null))[_0x4402('0x3c')](handleError(_0x24797a,null));};exports[_0x4402('0x88')]=function(_0x1ad7ff,_0x19993b,_0x241a20){var _0x460e17,_0x44b691;var _0xe8f398=[];var _0x1e625b=moment()[_0x4402('0x5c')](_0x4402('0x5d'));return db[_0x4402('0x28')][_0x4402('0x42')]({'where':{'id':_0x1ad7ff[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x19993b,null))[_0x4402('0x1f')](function(_0x1223ad){if(_0x1223ad){_0x44b691=_0x1223ad;return _0x1223ad[_0x4402('0x88')](_0x1ad7ff[_0x4402('0x44')][_0x4402('0x5e')],_[_0x4402('0x4a')](_0x1ad7ff[_0x4402('0x44')],[_0x4402('0x5e'),'id'])||{});}return null;})['spread'](function(_0x319331){var _0x268d01;var _0x45080b;_0x460e17=_0x319331||[];var _0x4ff63e=[];if(_0x319331){for(var _0x48121f=0x0;_0x48121f<_0x319331[_0x4402('0x31')];_0x48121f+=0x1){var _0x114ee0=_0x319331[_0x48121f][_0x4402('0x21')]({'plain':!![]});_0x268d01=squel[_0x4402('0x62')]()[_0x4402('0x63')](_0x4402('0x89'))['fromQuery'](['phone',_0x4402('0x67'),_0x4402('0x68'),_0x4402('0x52'),_0x4402('0x4b'),_0x4402('0x4c')],squel['select']()[_0x4402('0x6a')](_0x4402('0x6b'),_0x4402('0x6b'))['field']('id',_0x4402('0x67'))['field'](_0x114ee0[_0x4402('0x77')][_0x4402('0x6d')](),_0x4402('0x68'))[_0x4402('0x6a')](_0x1ad7ff['params']['id'][_0x4402('0x6d')](),_0x4402('0x52'))[_0x4402('0x6a')](_0x4402('0x6c'),_0x4402('0x4b'))[_0x4402('0x6a')](_0x4402('0x6c'),'updatedAt')['from'](_0x4402('0x6e'))[_0x4402('0x35')](_0x4402('0x6f'))['where'](_0x4402('0x70'),_0x114ee0[_0x4402('0x77')][_0x4402('0x6d')]())['where'](_0x4402('0x71')))['toString']();_0x4ff63e[_0x4402('0x83')](db[_0x4402('0x84')][_0x4402('0x2c')](_0x268d01));}return BPromise['all'](_0x4ff63e);}})[_0x4402('0x1f')](function(){return _0x460e17;})[_0x4402('0x1f')](respondWithResult(_0x19993b,null))['catch'](handleError(_0x19993b,null));};exports['removeBlackLists']=function(_0x4bd840,_0x4b64a3,_0x1815d7){return db['Campaign']['find']({'where':{'id':_0x4bd840[_0x4402('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b64a3,null))[_0x4402('0x1f')](function(_0x27c329){if(_0x27c329){return _0x27c329['removeBlackLists'](_0x4bd840[_0x4402('0x2c')][_0x4402('0x5e')]);}})[_0x4402('0x1f')](function(_0x5ebf6d){if(_0x5ebf6d){return db[_0x4402('0x59')]['destroy']({'where':{'ListId':_0x4bd840['query'][_0x4402('0x5e')],'CampaignId':_0x4bd840['params']['id']}})[_0x4402('0x1f')](function(){return _0x5ebf6d;});}})['then'](respondWithStatusCode(_0x4b64a3,null))[_0x4402('0x3c')](handleError(_0x4b64a3,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 486f0dc..fc3bd09 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x493030,_0x29ec7e){var _0x56f5e4=function(_0xb929a1){while(--_0xb929a1){_0x493030['push'](_0x493030['shift']());}};_0x56f5e4(++_0x29ec7e);}(_0x7a54,0x106));var _0x47a5=function(_0x885728,_0x55483b){_0x885728=_0x885728-0x0;var _0x26a1c6=_0x7a54[_0x885728];return _0x26a1c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 99f2aff..9591368 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44f8=['raw','where','attributes','limit','include','map','model','then','GetCampaign','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','client','http','request\x20sent','error','Campaign,\x20%s,\x20%s','message','result','catch','options'];(function(_0x1942c9,_0x5dbf2d){var _0x2e0a33=function(_0x90740e){while(--_0x90740e){_0x1942c9['push'](_0x1942c9['shift']());}};_0x2e0a33(++_0x5dbf2d);}(_0x44f8,0x1de));var _0x844f=function(_0x32b557,_0x4f0f7c){_0x32b557=_0x32b557-0x0;var _0x215581=_0x44f8[_0x32b557];return _0x215581;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require(_0x844f('0x3'));var rs=require(_0x844f('0x4'));var fs=require('fs');var Redis=require(_0x844f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x844f('0x7')][_0x844f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46eb2c,_0x38a334,_0x37b697){return new BPromise(function(_0x1987a9,_0x188f88){return client['request'](_0x46eb2c,_0x37b697)['then'](function(_0x39416d){logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x38a334,'request\x20sent',JSON['stringify'](_0x39416d));if(_0x39416d[_0x844f('0xa')]){if(_0x39416d[_0x844f('0xa')]['code']===0x1f4){logger[_0x844f('0xa')](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')]['message']);return _0x188f88(_0x39416d['error'][_0x844f('0xc')]);}logger['error'](_0x844f('0xb'),_0x38a334,_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);return _0x1987a9(_0x39416d[_0x844f('0xa')][_0x844f('0xc')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x38a334,_0x844f('0x9'));_0x1987a9(_0x39416d[_0x844f('0xd')][_0x844f('0xc')]);}})[_0x844f('0xe')](function(_0x4f7ce4){logger[_0x844f('0xa')]('Campaign,\x20%s,\x20%s',_0x38a334,_0x4f7ce4);_0x188f88(_0x4f7ce4);});});}exports['GetCampaign']=function(_0x1f96d0){var _0x2cca8e=this;return new Promise(function(_0x5cc55c,_0x24e386){return db['Campaign']['findAll']({'raw':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x10')]===undefined?!![]:![]:!![],'where':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x11')]||null:null,'attributes':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0['options'][_0x844f('0x12')]||null:null,'limit':_0x1f96d0['options']?_0x1f96d0['options'][_0x844f('0x13')]||null:null,'include':_0x1f96d0[_0x844f('0xf')]?_0x1f96d0[_0x844f('0xf')][_0x844f('0x14')]?_[_0x844f('0x15')](_0x1f96d0['options'][_0x844f('0x14')],function(_0x4bd66d){return{'model':db[_0x4bd66d[_0x844f('0x16')]],'as':_0x4bd66d['as'],'attributes':_0x4bd66d['attributes'],'include':_0x4bd66d[_0x844f('0x14')]?_[_0x844f('0x15')](_0x4bd66d[_0x844f('0x14')],function(_0x7dc0c9){return{'model':db[_0x7dc0c9[_0x844f('0x16')]],'as':_0x7dc0c9['as'],'attributes':_0x7dc0c9[_0x844f('0x12')],'include':_0x7dc0c9[_0x844f('0x14')]?_['map'](_0x7dc0c9[_0x844f('0x14')],function(_0x16d7ad){return{'model':db[_0x16d7ad[_0x844f('0x16')]],'as':_0x16d7ad['as'],'attributes':_0x16d7ad[_0x844f('0x12')]};}):[]};}):[]};}):[]:[]})[_0x844f('0x17')](function(_0x29d224){logger['info'](_0x844f('0x18'),_0x1f96d0);logger[_0x844f('0x19')](_0x844f('0x18'),_0x1f96d0,JSON['stringify'](_0x29d224));_0x5cc55c(_0x29d224);})['catch'](function(_0x1e243c){logger[_0x844f('0xa')](_0x844f('0x18'),_0x1e243c['message'],_0x1f96d0);_0x24e386(_0x2cca8e[_0x844f('0xa')](0x1f4,_0x1e243c['message']));});});}; \ No newline at end of file +var _0x49e9=['raw','where','attributes','limit','map','model','include','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options'];(function(_0x3d9156,_0x51a71f){var _0x3e3b2e=function(_0xc2e17b){while(--_0xc2e17b){_0x3d9156['push'](_0x3d9156['shift']());}};_0x3e3b2e(++_0x51a71f);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('Campaign,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});}exports[_0x949e('0x16')]=function(_0x43498d){var _0x868913=this;return new Promise(function(_0x20333c,_0x5caac9){return db[_0x949e('0x17')][_0x949e('0x18')]({'raw':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1a')]===undefined?!![]:![]:!![],'where':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1b')]||null:null,'attributes':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1c')]||null:null,'limit':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')][_0x949e('0x1d')]||null:null,'include':_0x43498d[_0x949e('0x19')]?_0x43498d[_0x949e('0x19')]['include']?_[_0x949e('0x1e')](_0x43498d[_0x949e('0x19')]['include'],function(_0x48a1d1){return{'model':db[_0x48a1d1[_0x949e('0x1f')]],'as':_0x48a1d1['as'],'attributes':_0x48a1d1[_0x949e('0x1c')],'include':_0x48a1d1[_0x949e('0x20')]?_[_0x949e('0x1e')](_0x48a1d1[_0x949e('0x20')],function(_0x1185b3){return{'model':db[_0x1185b3[_0x949e('0x1f')]],'as':_0x1185b3['as'],'attributes':_0x1185b3[_0x949e('0x1c')],'include':_0x1185b3[_0x949e('0x20')]?_[_0x949e('0x1e')](_0x1185b3['include'],function(_0x212224){return{'model':db[_0x212224[_0x949e('0x1f')]],'as':_0x212224['as'],'attributes':_0x212224['attributes']};}):[]};}):[]};}):[]:[]})[_0x949e('0xa')](function(_0x20061d){logger['info'](_0x949e('0x16'),_0x43498d);logger[_0x949e('0xd')]('GetCampaign',_0x43498d,JSON[_0x949e('0xf')](_0x20061d));_0x20333c(_0x20061d);})['catch'](function(_0x5e6e34){logger[_0x949e('0x10')]('GetCampaign',_0x5e6e34['message'],_0x43498d);_0x5caac9(_0x868913[_0x949e('0x10')](0x1f4,_0x5e6e34[_0x949e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 6e4dd3a..cb0272e 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 _0x38fb=['post','create','/:id/clone','clone','/:id/blacklists','put','update','delete','removeBlackLists','multer','util','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','/:id','show','get','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x38fb,0xd1));var _0xb38f=function(_0x337537,_0x4ea7b8){_0x337537=_0x337537-0x0;var _0x4fdd67=_0x38fb[_0x337537];return _0x4fdd67;};'use strict';var multer=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb38f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb38f('0x3'));var interaction=require(_0xb38f('0x4'));var config=require('../../config/environment');var controller=require(_0xb38f('0x5'));router['get']('/',auth[_0xb38f('0x6')](),controller['index']);router['get'](_0xb38f('0x7'),auth['isAuthenticated'](),controller[_0xb38f('0x8')]);router[_0xb38f('0x9')](_0xb38f('0xa'),auth[_0xb38f('0x6')](),controller['getHoppers']);router[_0xb38f('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb38f('0xb')]);router[_0xb38f('0x9')](_0xb38f('0xc'),auth[_0xb38f('0x6')](),controller[_0xb38f('0xd')]);router[_0xb38f('0x9')](_0xb38f('0xe'),auth[_0xb38f('0x6')](),controller['getHopperBlacks']);router[_0xb38f('0x9')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xb38f('0x6')](),controller['getBlackLists']);router[_0xb38f('0x10')]('/',auth[_0xb38f('0x6')](),controller[_0xb38f('0x11')]);router[_0xb38f('0x10')](_0xb38f('0x12'),auth['isAuthenticated'](),controller[_0xb38f('0x13')]);router[_0xb38f('0x10')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['addLists']);router[_0xb38f('0x10')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller['addBlackLists']);router[_0xb38f('0x15')]('/:id',auth[_0xb38f('0x6')](),controller[_0xb38f('0x16')]);router['delete'](_0xb38f('0x7'),auth[_0xb38f('0x6')](),controller['destroy']);router[_0xb38f('0x17')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['removeLists']);router[_0xb38f('0x17')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller[_0xb38f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1d50=['addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','addLists'];(function(_0x1c88f9,_0x211646){var _0x1779f7=function(_0x1dc48e){while(--_0x1dc48e){_0x1c88f9['push'](_0x1c88f9['shift']());}};_0x1779f7(++_0x211646);}(_0x1d50,0x1c7));var _0x01d5=function(_0x1a4d23,_0x3e9f58){_0x1a4d23=_0x1a4d23-0x0;var _0x53e632=_0x1d50[_0x1a4d23];return _0x53e632;};'use strict';var multer=require(_0x01d5('0x0'));var util=require(_0x01d5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x01d5('0x2'));var auth=require(_0x01d5('0x3'));var interaction=require(_0x01d5('0x4'));var config=require('../../config/environment');var controller=require(_0x01d5('0x5'));router[_0x01d5('0x6')]('/',auth[_0x01d5('0x7')](),controller[_0x01d5('0x8')]);router[_0x01d5('0x6')](_0x01d5('0x9'),auth['isAuthenticated'](),controller[_0x01d5('0xa')]);router[_0x01d5('0x6')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x01d5('0xb')]);router['get'](_0x01d5('0xc'),auth[_0x01d5('0x7')](),controller[_0x01d5('0xd')]);router['get'](_0x01d5('0xe'),auth[_0x01d5('0x7')](),controller[_0x01d5('0xf')]);router['get']('/:id/hopper_black',auth[_0x01d5('0x7')](),controller[_0x01d5('0x10')]);router[_0x01d5('0x6')](_0x01d5('0x11'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x12')]);router[_0x01d5('0x6')](_0x01d5('0x13'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x14')]);router['post']('/',auth[_0x01d5('0x7')](),controller[_0x01d5('0x15')]);router[_0x01d5('0x16')](_0x01d5('0x17'),auth['isAuthenticated'](),controller['clone']);router[_0x01d5('0x16')]('/:id/lists',auth[_0x01d5('0x7')](),controller[_0x01d5('0x18')]);router['post'](_0x01d5('0x13'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x19')]);router[_0x01d5('0x1a')](_0x01d5('0x9'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x1b')]);router[_0x01d5('0x1c')](_0x01d5('0x9'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x1d')]);router['delete'](_0x01d5('0x11'),auth[_0x01d5('0x7')](),controller[_0x01d5('0x1e')]);router[_0x01d5('0x1c')]('/:id/blacklists',auth[_0x01d5('0x7')](),controller['removeBlackLists']);module[_0x01d5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index be669c4..5e39a84 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 _0xa0b8=['key','STRING','getDataValue'];(function(_0x21d9ad,_0x1b9905){var _0x4f9ca1=function(_0x31ea3b){while(--_0x31ea3b){_0x21d9ad['push'](_0x21d9ad['shift']());}};_0x4f9ca1(++_0x1b9905);}(_0xa0b8,0x178));var _0x8a0b=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0xa0b8[_0x217a6f];return _0x5553f3;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x8a0b('0x0')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8a0b('0x1')](_0x8a0b('0x2'));}}}; \ No newline at end of file +var _0x7ae0=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x577077,_0x52f056){var _0x370769=function(_0x34d109){while(--_0x34d109){_0x577077['push'](_0x577077['shift']());}};_0x370769(++_0x52f056);}(_0x7ae0,0x1e3));var _0x07ae=function(_0x320d83,_0x1cdad3){_0x320d83=_0x320d83-0x0;var _0x5e8c27=_0x7ae0[_0x320d83];return _0x5e8c27;};'use strict';var Sequelize=require(_0x07ae('0x0'));module[_0x07ae('0x1')]={'key':{'type':Sequelize[_0x07ae('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x07ae('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x07ae('0x2')]},'name':{'type':Sequelize[_0x07ae('0x4')],'get':function(){return this[_0x07ae('0x5')](_0x07ae('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 833f7b1..b18cc20 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 _0x3525=['set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','options','includeAll','include','findAll','rows','catch','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x3525,0x84));var _0x5352=function(_0x30c8a6,_0x3ae227){_0x30c8a6=_0x30c8a6-0x0;var _0x4faeef=_0x3525[_0x30c8a6];return _0x4faeef;};'use strict';var emlformat=require(_0x5352('0x0'));var rimraf=require(_0x5352('0x1'));var zipdir=require(_0x5352('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5352('0x3'));var moment=require('moment');var BPromise=require(_0x5352('0x4'));var Mustache=require(_0x5352('0x5'));var util=require(_0x5352('0x6'));var path=require(_0x5352('0x7'));var sox=require(_0x5352('0x8'));var csv=require(_0x5352('0x9'));var ejs=require(_0x5352('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5352('0xb'));var crypto=require('crypto');var jsforce=require(_0x5352('0xc'));var deskjs=require(_0x5352('0xd'));var toCsv=require(_0x5352('0x9'));var querystring=require(_0x5352('0xe'));var Papa=require('papaparse');var Redis=require(_0x5352('0xf'));var authService=require(_0x5352('0x10'));var qs=require(_0x5352('0x11'));var as=require(_0x5352('0x12'));var hardwareService=require(_0x5352('0x13'));var logger=require(_0x5352('0x14'))(_0x5352('0x15'));var utils=require(_0x5352('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5352('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57b5db,_0x20aa0b){_0x20aa0b=_0x20aa0b||0xcc;return function(_0x32c1c4){if(_0x32c1c4){return _0x57b5db[_0x5352('0x18')](_0x20aa0b);}return _0x57b5db[_0x5352('0x19')](_0x20aa0b)[_0x5352('0x1a')]();};}function respondWithResult(_0x4ea6fe,_0x3c1907){_0x3c1907=_0x3c1907||0xc8;return function(_0x799955){if(_0x799955){return _0x4ea6fe[_0x5352('0x19')](_0x3c1907)[_0x5352('0x1b')](_0x799955);}};}function respondWithFilteredResult(_0x1e2320,_0x5305cb){return function(_0x2f6b72){if(_0x2f6b72){var _0x2ea60d=typeof _0x5305cb[_0x5352('0x1c')]===_0x5352('0x1d')&&typeof _0x5305cb[_0x5352('0x1e')]===_0x5352('0x1d');var _0x48f1cf=_0x2f6b72[_0x5352('0x1f')];var _0x414fe0=_0x2ea60d?0x0:_0x5305cb[_0x5352('0x1c')];var _0x1100cc=_0x2ea60d?_0x2f6b72[_0x5352('0x1f')]:_0x5305cb[_0x5352('0x1c')]+_0x5305cb[_0x5352('0x1e')];var _0x1285cc;if(_0x1100cc>=_0x48f1cf){_0x1100cc=_0x48f1cf;_0x1285cc=0xc8;}else{_0x1285cc=0xce;}_0x1e2320[_0x5352('0x19')](_0x1285cc);return _0x1e2320[_0x5352('0x20')](_0x5352('0x21'),_0x414fe0+'-'+_0x1100cc+'/'+_0x48f1cf)['json'](_0x2f6b72);}return null;};}function patchUpdates(_0x276ea8){return function(_0x4a2802){try{jsonpatch[_0x5352('0x22')](_0x4a2802,_0x276ea8,!![]);}catch(_0x5d06bf){return BPromise[_0x5352('0x23')](_0x5d06bf);}return _0x4a2802['save']();};}function saveUpdates(_0x275f61,_0x306f8b){return function(_0x4aa930){if(_0x4aa930){return _0x4aa930[_0x5352('0x24')](_0x275f61)[_0x5352('0x25')](function(_0x39eb04){return _0x39eb04;});}return null;};}function removeEntity(_0x1780b8,_0x2eaf35){return function(_0x191b63){if(_0x191b63){return _0x191b63[_0x5352('0x26')]()[_0x5352('0x25')](function(){var _0x114029=_0x191b63[_0x5352('0x27')]({'plain':!![]});var _0x513810='CannedAnswers';return db[_0x5352('0x28')][_0x5352('0x26')]({'where':{'type':_0x513810,'resourceId':_0x114029['id']}})[_0x5352('0x25')](function(){return _0x191b63;});})['then'](function(){_0x1780b8[_0x5352('0x19')](0xcc)[_0x5352('0x1a')]();});}};}function handleEntityNotFound(_0x25d6ef,_0x2ddc0b){return function(_0x430424){if(!_0x430424){_0x25d6ef[_0x5352('0x18')](0x194);}return _0x430424;};}function handleError(_0x4c5c40,_0x30efb3){_0x30efb3=_0x30efb3||0x1f4;return function(_0x357b38){logger['error'](_0x357b38[_0x5352('0x29')]);if(_0x357b38[_0x5352('0x2a')]){delete _0x357b38[_0x5352('0x2a')];}_0x4c5c40[_0x5352('0x19')](_0x30efb3)['send'](_0x357b38);};}exports[_0x5352('0x2b')]=function(_0x1d13fa,_0x2dca72){var _0x35bdc1={},_0x205830={},_0x28416c={'count':0x0,'rows':[]};var _0x3dde4d=_[_0x5352('0x2c')](db[_0x5352('0x2d')][_0x5352('0x2e')],function(_0x5a8e0e){return{'name':_0x5a8e0e['fieldName'],'type':_0x5a8e0e[_0x5352('0x2f')][_0x5352('0x30')]};});_0x205830[_0x5352('0x31')]=_['map'](_0x3dde4d,_0x5352('0x2a'));_0x205830[_0x5352('0x32')]=_['keys'](_0x1d13fa[_0x5352('0x32')]);_0x205830[_0x5352('0x33')]=_[_0x5352('0x34')](_0x205830[_0x5352('0x31')],_0x205830[_0x5352('0x32')]);_0x35bdc1[_0x5352('0x35')]=_[_0x5352('0x34')](_0x205830[_0x5352('0x31')],qs[_0x5352('0x36')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x36')]));_0x35bdc1[_0x5352('0x35')]=_0x35bdc1[_0x5352('0x35')][_0x5352('0x37')]?_0x35bdc1[_0x5352('0x35')]:_0x205830[_0x5352('0x31')];if(!_0x1d13fa[_0x5352('0x32')]['hasOwnProperty'](_0x5352('0x38'))){_0x35bdc1[_0x5352('0x1e')]=qs[_0x5352('0x1e')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x1e')]);_0x35bdc1[_0x5352('0x1c')]=qs['offset'](_0x1d13fa[_0x5352('0x32')][_0x5352('0x1c')]);}_0x35bdc1[_0x5352('0x39')]=qs[_0x5352('0x3a')](_0x1d13fa[_0x5352('0x32')][_0x5352('0x3a')]);_0x35bdc1['where']=qs[_0x5352('0x33')](_['pick'](_0x1d13fa[_0x5352('0x32')],_0x205830[_0x5352('0x33')]),_0x3dde4d);if(_0x1d13fa[_0x5352('0x32')][_0x5352('0x3b')]){_0x35bdc1[_0x5352('0x3c')]=_['merge'](_0x35bdc1[_0x5352('0x3c')],{'$or':[{'key':{'$like':'%'+_0x1d13fa[_0x5352('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x1d13fa[_0x5352('0x32')][_0x5352('0x3b')]+'%'}}]});}_0x35bdc1=_['merge']({},_0x35bdc1,_0x1d13fa[_0x5352('0x3d')]);var _0x127015={'where':_0x35bdc1['where']};return db[_0x5352('0x2d')]['count'](_0x127015)['then'](function(_0x42f6af){_0x28416c[_0x5352('0x1f')]=_0x42f6af;if(_0x1d13fa['query'][_0x5352('0x3e')]){_0x35bdc1[_0x5352('0x3f')]=[{'all':!![]}];}return db[_0x5352('0x2d')][_0x5352('0x40')](_0x35bdc1);})['then'](function(_0xb80e35){_0x28416c[_0x5352('0x41')]=_0xb80e35;return _0x28416c;})['then'](respondWithFilteredResult(_0x2dca72,_0x35bdc1))[_0x5352('0x42')](handleError(_0x2dca72,null));};exports['show']=function(_0x1fc873,_0x235305){var _0xf72e55={'raw':!![],'where':{'id':_0x1fc873[_0x5352('0x43')]['id']}},_0x147b1f={};_0x147b1f['model']=_[_0x5352('0x44')](db[_0x5352('0x2d')][_0x5352('0x2e')]);_0x147b1f['query']=_[_0x5352('0x44')](_0x1fc873['query']);_0x147b1f['filters']=_[_0x5352('0x34')](_0x147b1f['model'],_0x147b1f[_0x5352('0x32')]);_0xf72e55[_0x5352('0x35')]=_['intersection'](_0x147b1f[_0x5352('0x31')],qs[_0x5352('0x36')](_0x1fc873['query'][_0x5352('0x36')]));_0xf72e55['attributes']=_0xf72e55[_0x5352('0x35')][_0x5352('0x37')]?_0xf72e55['attributes']:_0x147b1f[_0x5352('0x31')];if(_0x1fc873[_0x5352('0x32')]['includeAll']){_0xf72e55[_0x5352('0x3f')]=[{'all':!![]}];}_0xf72e55=_['merge']({},_0xf72e55,_0x1fc873[_0x5352('0x3d')]);return db['CannedAnswer'][_0x5352('0x45')](_0xf72e55)['then'](handleEntityNotFound(_0x235305,null))['then'](respondWithResult(_0x235305,null))[_0x5352('0x42')](handleError(_0x235305,null));};exports[_0x5352('0x24')]=function(_0x55d6dd,_0x1966ce){if(_0x55d6dd['body']['id']){delete _0x55d6dd[_0x5352('0x46')]['id'];}return db[_0x5352('0x2d')][_0x5352('0x45')]({'where':{'id':_0x55d6dd[_0x5352('0x43')]['id']}})['then'](handleEntityNotFound(_0x1966ce,null))[_0x5352('0x25')](saveUpdates(_0x55d6dd[_0x5352('0x46')],null))[_0x5352('0x25')](respondWithResult(_0x1966ce,null))[_0x5352('0x42')](handleError(_0x1966ce,null));};exports[_0x5352('0x26')]=function(_0x4b4ad9,_0x2251ea){return db['CannedAnswer'][_0x5352('0x45')]({'where':{'id':_0x4b4ad9[_0x5352('0x43')]['id']}})[_0x5352('0x25')](handleEntityNotFound(_0x2251ea,null))[_0x5352('0x25')](removeEntity(_0x2251ea,null))[_0x5352('0x42')](handleError(_0x2251ea,null));};exports[_0x5352('0x47')]=function(_0x86ce7a,_0x42c6bc){var _0x6c40d={'key':_0x86ce7a[_0x5352('0x46')][_0x5352('0x30')]};if(_0x86ce7a[_0x5352('0x46')]['MailAccountId']){_0x6c40d['MailAccountId']=_0x86ce7a[_0x5352('0x46')][_0x5352('0x48')];}else if(_0x86ce7a['body'][_0x5352('0x49')]){_0x6c40d['SmsAccountId']=_0x86ce7a[_0x5352('0x46')][_0x5352('0x49')];}else if(_0x86ce7a[_0x5352('0x46')][_0x5352('0x4a')]){_0x6c40d[_0x5352('0x4a')]=_0x86ce7a[_0x5352('0x46')][_0x5352('0x4a')];}else if(_0x86ce7a[_0x5352('0x46')][_0x5352('0x4b')]){_0x6c40d[_0x5352('0x4b')]=_0x86ce7a[_0x5352('0x46')][_0x5352('0x4b')];}return db[_0x5352('0x2d')][_0x5352('0x45')]({'where':_0x6c40d})['then'](function(_0x5d0dca){if(_0x5d0dca){throw new db['Sequelize']['ValidationError'](_0x5352('0x4c'));}return db[_0x5352('0x2d')]['create'](_0x86ce7a['body']);})[_0x5352('0x25')](function(_0x4f5e26){var _0x24f9d6=_0x86ce7a[_0x5352('0x4d')][_0x5352('0x27')]({'plain':!![]});if(!_0x24f9d6)throw new Error(_0x5352('0x4e'));if(_0x24f9d6['role']==='user'){var _0x28b200=_0x4f5e26[_0x5352('0x27')]({'plain':!![]});return db[_0x5352('0x4f')]['find']({'where':{'name':_0x5352('0x50'),'userProfileId':_0x24f9d6[_0x5352('0x51')]},'raw':!![]})[_0x5352('0x25')](function(_0xbb3339){if(_0xbb3339&&_0xbb3339['autoAssociation']===0x0){return db[_0x5352('0x28')][_0x5352('0x47')]({'name':_0x28b200[_0x5352('0x2a')],'resourceId':_0x28b200['id'],'type':_0xbb3339[_0x5352('0x2a')],'sectionId':_0xbb3339['id']},{})[_0x5352('0x25')](function(){return _0x4f5e26;});}else{return _0x4f5e26;}})[_0x5352('0x42')](function(_0x46262d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46262d);throw _0x46262d;});}return _0x4f5e26;})[_0x5352('0x25')](respondWithResult(_0x42c6bc,0xc9))[_0x5352('0x42')](handleError(_0x42c6bc,null));}; \ No newline at end of file +var _0x0245=['../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','CannedAnswer','findAll','rows','catch','show','params','include','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x15b5a4,_0x12b5fc){var _0x487f43=function(_0x2e953e){while(--_0x2e953e){_0x15b5a4['push'](_0x15b5a4['shift']());}};_0x487f43(++_0x12b5fc);}(_0x0245,0xf6));var _0x5024=function(_0x4a1e65,_0x8deb5e){_0x4a1e65=_0x4a1e65-0x0;var _0x20c1f1=_0x0245[_0x4a1e65];return _0x20c1f1;};'use strict';var emlformat=require(_0x5024('0x0'));var rimraf=require(_0x5024('0x1'));var zipdir=require(_0x5024('0x2'));var jsonpatch=require(_0x5024('0x3'));var rp=require('request-promise');var moment=require(_0x5024('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5024('0x5'));var util=require('util');var path=require(_0x5024('0x6'));var sox=require(_0x5024('0x7'));var csv=require('to-csv');var ejs=require(_0x5024('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5024('0x9'));var squel=require(_0x5024('0xa'));var crypto=require(_0x5024('0xb'));var jsforce=require(_0x5024('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5024('0xd'));var querystring=require('querystring');var Papa=require(_0x5024('0xe'));var Redis=require(_0x5024('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5024('0x10'));var hardwareService=require(_0x5024('0x11'));var logger=require(_0x5024('0x12'))(_0x5024('0x13'));var utils=require(_0x5024('0x14'));var config=require(_0x5024('0x15'));var licenseUtil=require(_0x5024('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a92f,_0x5782dd){_0x5782dd=_0x5782dd||0xcc;return function(_0x6762cf){if(_0x6762cf){return _0x44a92f[_0x5024('0x17')](_0x5782dd);}return _0x44a92f[_0x5024('0x18')](_0x5782dd)['end']();};}function respondWithResult(_0x35b802,_0x416c7d){_0x416c7d=_0x416c7d||0xc8;return function(_0x33144a){if(_0x33144a){return _0x35b802[_0x5024('0x18')](_0x416c7d)[_0x5024('0x19')](_0x33144a);}};}function respondWithFilteredResult(_0x24b39b,_0x2d1ddf){return function(_0x2c3faa){if(_0x2c3faa){var _0x34cfa9=typeof _0x2d1ddf[_0x5024('0x1a')]===_0x5024('0x1b')&&typeof _0x2d1ddf[_0x5024('0x1c')]==='undefined';var _0x543439=_0x2c3faa[_0x5024('0x1d')];var _0x28db94=_0x34cfa9?0x0:_0x2d1ddf[_0x5024('0x1a')];var _0x5bc0ed=_0x34cfa9?_0x2c3faa[_0x5024('0x1d')]:_0x2d1ddf[_0x5024('0x1a')]+_0x2d1ddf[_0x5024('0x1c')];var _0x41deff;if(_0x5bc0ed>=_0x543439){_0x5bc0ed=_0x543439;_0x41deff=0xc8;}else{_0x41deff=0xce;}_0x24b39b['status'](_0x41deff);return _0x24b39b[_0x5024('0x1e')](_0x5024('0x1f'),_0x28db94+'-'+_0x5bc0ed+'/'+_0x543439)['json'](_0x2c3faa);}return null;};}function patchUpdates(_0x40aac1){return function(_0x20a407){try{jsonpatch[_0x5024('0x20')](_0x20a407,_0x40aac1,!![]);}catch(_0x31d2c2){return BPromise['reject'](_0x31d2c2);}return _0x20a407[_0x5024('0x21')]();};}function saveUpdates(_0x140da3,_0x3445a7){return function(_0x2a1e63){if(_0x2a1e63){return _0x2a1e63[_0x5024('0x22')](_0x140da3)[_0x5024('0x23')](function(_0x2d90a1){return _0x2d90a1;});}return null;};}function removeEntity(_0xe92376,_0x345c9){return function(_0x4da102){if(_0x4da102){return _0x4da102[_0x5024('0x24')]()[_0x5024('0x23')](function(){var _0x17ff6b=_0x4da102[_0x5024('0x25')]({'plain':!![]});var _0x509de5=_0x5024('0x26');return db['UserProfileResource'][_0x5024('0x24')]({'where':{'type':_0x509de5,'resourceId':_0x17ff6b['id']}})[_0x5024('0x23')](function(){return _0x4da102;});})[_0x5024('0x23')](function(){_0xe92376['status'](0xcc)[_0x5024('0x27')]();});}};}function handleEntityNotFound(_0xfbd017,_0xe2c473){return function(_0x217fd9){if(!_0x217fd9){_0xfbd017[_0x5024('0x17')](0x194);}return _0x217fd9;};}function handleError(_0x5ea2d2,_0x10530c){_0x10530c=_0x10530c||0x1f4;return function(_0x50425c){logger[_0x5024('0x28')](_0x50425c[_0x5024('0x29')]);if(_0x50425c['name']){delete _0x50425c[_0x5024('0x2a')];}_0x5ea2d2[_0x5024('0x18')](_0x10530c)[_0x5024('0x2b')](_0x50425c);};}exports[_0x5024('0x2c')]=function(_0x3a3f57,_0xefd743){var _0x25c860={},_0x3ab1ce={},_0x1e66f4={'count':0x0,'rows':[]};var _0x34627b=_[_0x5024('0x2d')](db['CannedAnswer'][_0x5024('0x2e')],function(_0x2f33bb){return{'name':_0x2f33bb[_0x5024('0x2f')],'type':_0x2f33bb[_0x5024('0x30')]['key']};});_0x3ab1ce[_0x5024('0x31')]=_['map'](_0x34627b,_0x5024('0x2a'));_0x3ab1ce[_0x5024('0x32')]=_[_0x5024('0x33')](_0x3a3f57[_0x5024('0x32')]);_0x3ab1ce[_0x5024('0x34')]=_[_0x5024('0x35')](_0x3ab1ce[_0x5024('0x31')],_0x3ab1ce[_0x5024('0x32')]);_0x25c860[_0x5024('0x36')]=_[_0x5024('0x35')](_0x3ab1ce[_0x5024('0x31')],qs[_0x5024('0x37')](_0x3a3f57['query']['fields']));_0x25c860[_0x5024('0x36')]=_0x25c860[_0x5024('0x36')][_0x5024('0x38')]?_0x25c860['attributes']:_0x3ab1ce['model'];if(!_0x3a3f57[_0x5024('0x32')][_0x5024('0x39')](_0x5024('0x3a'))){_0x25c860[_0x5024('0x1c')]=qs['limit'](_0x3a3f57[_0x5024('0x32')][_0x5024('0x1c')]);_0x25c860[_0x5024('0x1a')]=qs['offset'](_0x3a3f57[_0x5024('0x32')][_0x5024('0x1a')]);}_0x25c860[_0x5024('0x3b')]=qs['sort'](_0x3a3f57[_0x5024('0x32')][_0x5024('0x3c')]);_0x25c860[_0x5024('0x3d')]=qs[_0x5024('0x34')](_['pick'](_0x3a3f57[_0x5024('0x32')],_0x3ab1ce['filters']),_0x34627b);if(_0x3a3f57[_0x5024('0x32')][_0x5024('0x3e')]){_0x25c860['where']=_['merge'](_0x25c860[_0x5024('0x3d')],{'$or':[{'key':{'$like':'%'+_0x3a3f57[_0x5024('0x32')][_0x5024('0x3e')]+'%'}},{'value':{'$like':'%'+_0x3a3f57[_0x5024('0x32')][_0x5024('0x3e')]+'%'}}]});}_0x25c860=_[_0x5024('0x3f')]({},_0x25c860,_0x3a3f57[_0x5024('0x40')]);var _0x29beb1={'where':_0x25c860[_0x5024('0x3d')]};return db['CannedAnswer'][_0x5024('0x1d')](_0x29beb1)[_0x5024('0x23')](function(_0x57c3c5){_0x1e66f4['count']=_0x57c3c5;if(_0x3a3f57['query'][_0x5024('0x41')]){_0x25c860['include']=[{'all':!![]}];}return db[_0x5024('0x42')][_0x5024('0x43')](_0x25c860);})['then'](function(_0x1ca648){_0x1e66f4[_0x5024('0x44')]=_0x1ca648;return _0x1e66f4;})[_0x5024('0x23')](respondWithFilteredResult(_0xefd743,_0x25c860))[_0x5024('0x45')](handleError(_0xefd743,null));};exports[_0x5024('0x46')]=function(_0x42bc04,_0x2659f4){var _0xcef566={'raw':!![],'where':{'id':_0x42bc04[_0x5024('0x47')]['id']}},_0x4247ce={};_0x4247ce['model']=_['keys'](db[_0x5024('0x42')][_0x5024('0x2e')]);_0x4247ce[_0x5024('0x32')]=_[_0x5024('0x33')](_0x42bc04[_0x5024('0x32')]);_0x4247ce[_0x5024('0x34')]=_[_0x5024('0x35')](_0x4247ce[_0x5024('0x31')],_0x4247ce['query']);_0xcef566['attributes']=_[_0x5024('0x35')](_0x4247ce['model'],qs[_0x5024('0x37')](_0x42bc04[_0x5024('0x32')][_0x5024('0x37')]));_0xcef566[_0x5024('0x36')]=_0xcef566[_0x5024('0x36')]['length']?_0xcef566[_0x5024('0x36')]:_0x4247ce['model'];if(_0x42bc04['query'][_0x5024('0x41')]){_0xcef566[_0x5024('0x48')]=[{'all':!![]}];}_0xcef566=_[_0x5024('0x3f')]({},_0xcef566,_0x42bc04[_0x5024('0x40')]);return db[_0x5024('0x42')][_0x5024('0x49')](_0xcef566)[_0x5024('0x23')](handleEntityNotFound(_0x2659f4,null))[_0x5024('0x23')](respondWithResult(_0x2659f4,null))[_0x5024('0x45')](handleError(_0x2659f4,null));};exports['update']=function(_0x507a4c,_0x5626df){if(_0x507a4c[_0x5024('0x4a')]['id']){delete _0x507a4c[_0x5024('0x4a')]['id'];}return db['CannedAnswer'][_0x5024('0x49')]({'where':{'id':_0x507a4c[_0x5024('0x47')]['id']}})[_0x5024('0x23')](handleEntityNotFound(_0x5626df,null))[_0x5024('0x23')](saveUpdates(_0x507a4c[_0x5024('0x4a')],null))[_0x5024('0x23')](respondWithResult(_0x5626df,null))['catch'](handleError(_0x5626df,null));};exports[_0x5024('0x24')]=function(_0x27f1b2,_0x2a0cff){return db['CannedAnswer'][_0x5024('0x49')]({'where':{'id':_0x27f1b2[_0x5024('0x47')]['id']}})[_0x5024('0x23')](handleEntityNotFound(_0x2a0cff,null))[_0x5024('0x23')](removeEntity(_0x2a0cff,null))[_0x5024('0x45')](handleError(_0x2a0cff,null));};exports[_0x5024('0x4b')]=function(_0x3798bf,_0x36f405){var _0x2d6115={'key':_0x3798bf[_0x5024('0x4a')][_0x5024('0x4c')]};if(_0x3798bf[_0x5024('0x4a')][_0x5024('0x4d')]){_0x2d6115[_0x5024('0x4d')]=_0x3798bf[_0x5024('0x4a')][_0x5024('0x4d')];}else if(_0x3798bf[_0x5024('0x4a')][_0x5024('0x4e')]){_0x2d6115[_0x5024('0x4e')]=_0x3798bf['body'][_0x5024('0x4e')];}else if(_0x3798bf['body'][_0x5024('0x4f')]){_0x2d6115[_0x5024('0x4f')]=_0x3798bf['body'][_0x5024('0x4f')];}else if(_0x3798bf[_0x5024('0x4a')][_0x5024('0x50')]){_0x2d6115[_0x5024('0x50')]=_0x3798bf[_0x5024('0x4a')]['ChatWebsiteId'];}return db[_0x5024('0x42')][_0x5024('0x49')]({'where':_0x2d6115})[_0x5024('0x23')](function(_0x297860){if(_0x297860){throw new db['Sequelize'][(_0x5024('0x51'))](_0x5024('0x52'));}return db[_0x5024('0x42')][_0x5024('0x4b')](_0x3798bf['body']);})[_0x5024('0x23')](function(_0x51df94){var _0x3e5c0f=_0x3798bf[_0x5024('0x53')][_0x5024('0x25')]({'plain':!![]});if(!_0x3e5c0f)throw new Error(_0x5024('0x54'));if(_0x3e5c0f[_0x5024('0x55')]===_0x5024('0x53')){var _0x21f3b7=_0x51df94['get']({'plain':!![]});return db['UserProfileSection'][_0x5024('0x49')]({'where':{'name':_0x5024('0x26'),'userProfileId':_0x3e5c0f[_0x5024('0x56')]},'raw':!![]})[_0x5024('0x23')](function(_0x521661){if(_0x521661&&_0x521661[_0x5024('0x57')]===0x0){return db['UserProfileResource'][_0x5024('0x4b')]({'name':_0x21f3b7[_0x5024('0x2a')],'resourceId':_0x21f3b7['id'],'type':_0x521661[_0x5024('0x2a')],'sectionId':_0x521661['id']},{})[_0x5024('0x23')](function(){return _0x51df94;});}else{return _0x51df94;}})['catch'](function(_0x238795){logger['error'](_0x5024('0x58'),_0x238795);throw _0x238795;});}return _0x51df94;})[_0x5024('0x23')](respondWithResult(_0x36f405,0xc9))[_0x5024('0x45')](handleError(_0x36f405,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 56774d6..a2a1a41 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 _0x626f=['request-promise','path','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x3eadd2,_0x1ac10b){var _0x362829=function(_0x4b23c7){while(--_0x4b23c7){_0x3eadd2['push'](_0x3eadd2['shift']());}};_0x362829(++_0x1ac10b);}(_0x626f,0xdb));var _0xf626=function(_0x64b218,_0x4df215){_0x64b218=_0x64b218-0x0;var _0x213cb4=_0x626f[_0x64b218];return _0x213cb4;};'use strict';var _=require(_0xf626('0x0'));var util=require(_0xf626('0x1'));var logger=require(_0xf626('0x2'))(_0xf626('0x3'));var moment=require('moment');var BPromise=require(_0xf626('0x4'));var rp=require(_0xf626('0x5'));var fs=require('fs');var path=require(_0xf626('0x6'));var rimraf=require(_0xf626('0x7'));var config=require(_0xf626('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0xf626('0x9')]=function(_0x2331c7,_0x1714e1){return _0x2331c7['define'](_0xf626('0xa'),attributes,{'tableName':_0xf626('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf626('0xc'),'collate':_0xf626('0xd')});}; \ No newline at end of file +var _0xe613=['moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','lodash','../../config/logger','api'];(function(_0x3516e3,_0x37061e){var _0x5054e0=function(_0xa3df88){while(--_0xa3df88){_0x3516e3['push'](_0x3516e3['shift']());}};_0x5054e0(++_0x37061e);}(_0xe613,0x128));var _0x3e61=function(_0x308881,_0x3d8420){_0x308881=_0x308881-0x0;var _0x5cade8=_0xe613[_0x308881];return _0x5cade8;};'use strict';var _=require(_0x3e61('0x0'));var util=require('util');var logger=require(_0x3e61('0x1'))(_0x3e61('0x2'));var moment=require(_0x3e61('0x3'));var BPromise=require(_0x3e61('0x4'));var rp=require(_0x3e61('0x5'));var fs=require('fs');var path=require(_0x3e61('0x6'));var rimraf=require(_0x3e61('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e61('0x8'));module[_0x3e61('0x9')]=function(_0x5cb627,_0x2cd559){return _0x5cb627[_0x3e61('0xa')](_0x3e61('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e61('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 50f88c8..7161788 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(_0x670593,_0x388f3f){var _0x50eae8=function(_0x1ba14a){while(--_0x1ba14a){_0x670593['push'](_0x670593['shift']());}};_0x50eae8(++_0x388f3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d168f,_0x3efb39){var _0x1c4b25=function(_0x442948){while(--_0x442948){_0x2d168f['push'](_0x2d168f['shift']());}};_0x1c4b25(++_0x3efb39);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b142eff..e48c252 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 _0x9a2a=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated'];(function(_0x3b59ed,_0x281a70){var _0x5cf829=function(_0xca820){while(--_0xca820){_0x3b59ed['push'](_0x3b59ed['shift']());}};_0x5cf829(++_0x281a70);}(_0x9a2a,0xfa));var _0xa9a2=function(_0xb19bc6,_0x2dd9b5){_0xb19bc6=_0xb19bc6-0x0;var _0x2e3f77=_0x9a2a[_0xb19bc6];return _0x2e3f77;};'use strict';var multer=require(_0xa9a2('0x0'));var util=require(_0xa9a2('0x1'));var path=require(_0xa9a2('0x2'));var timeout=require(_0xa9a2('0x3'));var express=require(_0xa9a2('0x4'));var router=express[_0xa9a2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa9a2('0x6'));var interaction=require(_0xa9a2('0x7'));var config=require(_0xa9a2('0x8'));var controller=require(_0xa9a2('0x9'));router[_0xa9a2('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a2('0xb')]);router[_0xa9a2('0xa')](_0xa9a2('0xc'),auth[_0xa9a2('0xd')](),controller[_0xa9a2('0xe')]);router[_0xa9a2('0xf')]('/',auth[_0xa9a2('0xd')](),controller[_0xa9a2('0x10')]);router[_0xa9a2('0x11')](_0xa9a2('0xc'),auth[_0xa9a2('0xd')](),controller[_0xa9a2('0x12')]);router[_0xa9a2('0x13')](_0xa9a2('0xc'),auth['isAuthenticated'](),controller[_0xa9a2('0x14')]);module[_0xa9a2('0x15')]=router; \ No newline at end of file +var _0x545b=['/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x5c31d1,_0x248ff7){var _0x3f1ab1=function(_0x400795){while(--_0x400795){_0x5c31d1['push'](_0x5c31d1['shift']());}};_0x3f1ab1(++_0x248ff7);}(_0x545b,0xd0));var _0xb545=function(_0x36115d,_0x4071a1){_0x36115d=_0x36115d-0x0;var _0x58cd1f=_0x545b[_0x36115d];return _0x58cd1f;};'use strict';var multer=require(_0xb545('0x0'));var util=require('util');var path=require(_0xb545('0x1'));var timeout=require(_0xb545('0x2'));var express=require(_0xb545('0x3'));var router=express[_0xb545('0x4')]();var fs_extra=require(_0xb545('0x5'));var auth=require(_0xb545('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb545('0x7'));var controller=require(_0xb545('0x8'));router[_0xb545('0x9')]('/',auth[_0xb545('0xa')](),controller[_0xb545('0xb')]);router[_0xb545('0x9')](_0xb545('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb545('0xd')]('/',auth[_0xb545('0xa')](),controller[_0xb545('0xe')]);router[_0xb545('0xf')](_0xb545('0xc'),auth['isAuthenticated'](),controller[_0xb545('0x10')]);router[_0xb545('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb545('0x12')]);module[_0xb545('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 90e9112..99964d2 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 _0x68f9=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x68f9,0xca));var _0x968f=function(_0x22398c,_0x4fd56d){_0x22398c=_0x22398c-0x0;var _0x40864c=_0x68f9[_0x22398c];return _0x40864c;};'use strict';var Sequelize=require(_0x968f('0x0'));module[_0x968f('0x1')]={'calldate':{'type':Sequelize[_0x968f('0x2')],'allowNull':![],'defaultValue':_0x968f('0x3')},'clid':{'type':Sequelize[_0x968f('0x4')]},'src':{'type':Sequelize[_0x968f('0x4')]},'dst':{'type':Sequelize[_0x968f('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x968f('0x4')]},'dstchannel':{'type':Sequelize[_0x968f('0x4')]},'lastapp':{'type':Sequelize[_0x968f('0x4')]},'lastdata':{'type':Sequelize[_0x968f('0x4')]},'duration':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x968f('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x968f('0x4')]},'uniqueid':{'type':Sequelize[_0x968f('0x4')]},'linkedid':{'type':Sequelize[_0x968f('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x968f('0x4')]},'type':{'type':Sequelize[_0x968f('0x4')]},'tag':{'type':Sequelize[_0x968f('0x4')]}}; \ No newline at end of file +var _0xbf04=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x401ec9,_0x77c73f){var _0x8ef3a1=function(_0x171c3c){while(--_0x171c3c){_0x401ec9['push'](_0x401ec9['shift']());}};_0x8ef3a1(++_0x77c73f);}(_0xbf04,0xc1));var _0x4bf0=function(_0x4140a6,_0x493bb2){_0x4140a6=_0x4140a6-0x0;var _0x202fee=_0xbf04[_0x4140a6];return _0x202fee;};'use strict';var Sequelize=require(_0x4bf0('0x0'));module[_0x4bf0('0x1')]={'calldate':{'type':Sequelize[_0x4bf0('0x2')],'allowNull':![],'defaultValue':_0x4bf0('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x4bf0('0x4')]},'dst':{'type':Sequelize[_0x4bf0('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x4bf0('0x4')]},'lastapp':{'type':Sequelize[_0x4bf0('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x4bf0('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4bf0('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4bf0('0x4')]},'amaflags':{'type':Sequelize[_0x4bf0('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4bf0('0x4')]},'uniqueid':{'type':Sequelize[_0x4bf0('0x4')]},'linkedid':{'type':Sequelize[_0x4bf0('0x4')]},'sequence':{'type':Sequelize[_0x4bf0('0x4')]},'peeraccount':{'type':Sequelize[_0x4bf0('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4bf0('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 3812768..8e3b1fa 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 _0xe14b=['rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','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','error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe14b,0x93));var _0xbe14=function(_0x1ffbeb,_0x25c075){_0x1ffbeb=_0x1ffbeb-0x0;var _0x113bde=_0xe14b[_0x1ffbeb];return _0x113bde;};'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(){_0x3d3608['status'](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x5fa043,_0x1ee9c1){return function(_0x39cc81){if(!_0x39cc81){_0x5fa043[_0xbe14('0x16')](0x194);}return _0x39cc81;};}function handleError(_0x2703f5,_0x55d001){_0x55d001=_0x55d001||0x1f4;return function(_0x1822e0){logger[_0xbe14('0x23')](_0x1822e0[_0xbe14('0x24')]);if(_0x1822e0[_0xbe14('0x25')]){delete _0x1822e0['name'];}_0x2703f5[_0xbe14('0x17')](_0x55d001)[_0xbe14('0x26')](_0x1822e0);};}exports['index']=function(_0x3c3613,_0x3b3e84){var _0x1c7cc7={},_0x19252f={},_0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x2a')],'type':_0x16a159[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x19252f[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x36d4b2,_0xbe14('0x25'));_0x19252f[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x3c3613[_0xbe14('0x2e')]);_0x19252f[_0xbe14('0x30')]=_['intersection'](_0x19252f[_0xbe14('0x2d')],_0x19252f['query']);_0x1c7cc7['attributes']=_[_0xbe14('0x31')](_0x19252f['model'],qs[_0xbe14('0x32')](_0x3c3613[_0xbe14('0x2e')]['fields']));_0x1c7cc7['attributes']=_0x1c7cc7['attributes'][_0xbe14('0x33')]?_0x1c7cc7[_0xbe14('0x34')]:_0x19252f['model'];if(!_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x35')](_0xbe14('0x36'))){_0x1c7cc7[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x3c3613['query']['limit']);_0x1c7cc7[_0xbe14('0x1c')]=qs['offset'](_0x3c3613['query']['offset']);}_0x1c7cc7[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x38')]);_0x1c7cc7[_0xbe14('0x39')]=qs[_0xbe14('0x30')](_[_0xbe14('0x3a')](_0x3c3613[_0xbe14('0x2e')],_0x19252f[_0xbe14('0x30')]),_0x36d4b2);if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]){_0x1c7cc7[_0xbe14('0x39')]=_['merge'](_0x1c7cc7['where'],{'$or':_[_0xbe14('0x27')](_0x36d4b2,function(_0x2951e1){if(_0x2951e1[_0xbe14('0x2b')]!=='VIRTUAL'){var _0x326329={};_0x326329[_0x2951e1[_0xbe14('0x25')]]={'$like':'%'+_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3b')]+'%'};return _0x326329;}})});}_0x1c7cc7=_[_0xbe14('0x3c')]({},_0x1c7cc7,_0x3c3613[_0xbe14('0x3d')]);var _0x19fa30={'where':_0x1c7cc7[_0xbe14('0x39')]};return db[_0xbe14('0x28')]['count'](_0x19fa30)[_0xbe14('0x22')](function(_0x841b71){_0x34d648[_0xbe14('0x1b')]=_0x841b71;if(_0x3c3613[_0xbe14('0x2e')][_0xbe14('0x3e')]){_0x1c7cc7[_0xbe14('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0xbe14('0x40')](_0x1c7cc7);})[_0xbe14('0x22')](function(_0x1220c9){_0x34d648[_0xbe14('0x41')]=_0x1220c9;return _0x34d648;})['then'](respondWithFilteredResult(_0x3b3e84,_0x1c7cc7))['catch'](handleError(_0x3b3e84,null));};exports[_0xbe14('0x42')]=function(_0xe417b,_0x3272ae){var _0x51c859={'raw':!![],'where':{'id':_0xe417b[_0xbe14('0x43')]['id']}},_0x5d5318={};_0x5d5318['model']=_['keys'](db[_0xbe14('0x28')][_0xbe14('0x29')]);_0x5d5318[_0xbe14('0x2e')]=_['keys'](_0xe417b['query']);_0x5d5318['filters']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],_0x5d5318[_0xbe14('0x2e')]);_0x51c859['attributes']=_[_0xbe14('0x31')](_0x5d5318[_0xbe14('0x2d')],qs[_0xbe14('0x32')](_0xe417b[_0xbe14('0x2e')]['fields']));_0x51c859['attributes']=_0x51c859[_0xbe14('0x34')][_0xbe14('0x33')]?_0x51c859[_0xbe14('0x34')]:_0x5d5318[_0xbe14('0x2d')];if(_0xe417b[_0xbe14('0x2e')]['includeAll']){_0x51c859['include']=[{'all':!![]}];}_0x51c859=_[_0xbe14('0x3c')]({},_0x51c859,_0xe417b[_0xbe14('0x3d')]);return db[_0xbe14('0x28')][_0xbe14('0x44')](_0x51c859)['then'](handleEntityNotFound(_0x3272ae,null))[_0xbe14('0x22')](respondWithResult(_0x3272ae,null))[_0xbe14('0x45')](handleError(_0x3272ae,null));};exports['create']=function(_0x396e40,_0x2a35e5){return db[_0xbe14('0x28')][_0xbe14('0x46')](_0x396e40['body'],{})['then'](respondWithResult(_0x2a35e5,0xc9))[_0xbe14('0x45')](handleError(_0x2a35e5,null));};exports[_0xbe14('0x21')]=function(_0x4a1a37,_0x5acf90){if(_0x4a1a37[_0xbe14('0x47')]['id']){delete _0x4a1a37[_0xbe14('0x47')]['id'];}return db[_0xbe14('0x28')][_0xbe14('0x44')]({'where':{'id':_0x4a1a37[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x5acf90,null))[_0xbe14('0x22')](saveUpdates(_0x4a1a37['body'],null))[_0xbe14('0x22')](respondWithResult(_0x5acf90,null))[_0xbe14('0x45')](handleError(_0x5acf90,null));};exports[_0xbe14('0x48')]=function(_0x22b1f8,_0x2fc073){return db['Cdr'][_0xbe14('0x44')]({'where':{'id':_0x22b1f8[_0xbe14('0x43')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x2fc073,null))[_0xbe14('0x22')](removeEntity(_0x2fc073,null))[_0xbe14('0x45')](handleError(_0x2fc073,null));};exports[_0xbe14('0x49')]=function(_0x505829,_0x5aeea9){return db[_0xbe14('0x28')][_0xbe14('0x49')]()[_0xbe14('0x22')](respondWithResult(_0x5aeea9,null))['catch'](handleError(_0x5aeea9,null));}; \ No newline at end of file +var _0x038b=['lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','length','include','options','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x038b,0x114));var _0xb038=function(_0x1f7276,_0x7f7dbe){_0x1f7276=_0x1f7276-0x0;var _0x4fef7a=_0x038b[_0x1f7276];return _0x4fef7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24'));_0xc387d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2855a6['query']);_0xc387d[_0xb038('0x2f')]=_['intersection'](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x2d')]);_0x12b3b6[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x32')]));_0x12b3b6[_0xb038('0x30')]=_0x12b3b6[_0xb038('0x30')]['length']?_0x12b3b6[_0xb038('0x30')]:_0xc387d[_0xb038('0x2c')];if(!_0x2855a6[_0xb038('0x2d')]['hasOwnProperty']('nolimit')){_0x12b3b6['limit']=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs[_0xb038('0x18')](_0x2855a6[_0xb038('0x2d')]['offset']);}_0x12b3b6[_0xb038('0x33')]=qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x34')]);_0x12b3b6['where']=qs[_0xb038('0x2f')](_[_0xb038('0x35')](_0x2855a6['query'],_0xc387d['filters']),_0x1783d4);if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]){_0x12b3b6[_0xb038('0x37')]=_[_0xb038('0x38')](_0x12b3b6[_0xb038('0x37')],{'$or':_['map'](_0x1783d4,function(_0x404f82){if(_0x404f82[_0xb038('0x2a')]!==_0xb038('0x39')){var _0x2d1e57={};_0x2d1e57[_0x404f82['name']]={'$like':'%'+_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]+'%'};return _0x2d1e57;}})});}_0x12b3b6=_[_0xb038('0x38')]({},_0x12b3b6,_0x2855a6['options']);var _0x412d71={'where':_0x12b3b6['where']};return db[_0xb038('0x27')][_0xb038('0x1a')](_0x412d71)[_0xb038('0x22')](function(_0x5ce40c){_0x551b55[_0xb038('0x1a')]=_0x5ce40c;if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x3a')]){_0x12b3b6['include']=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3b')](_0x12b3b6);})[_0xb038('0x22')](function(_0x3c291e){_0x551b55['rows']=_0x3c291e;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x3c')](handleError(_0x28a6a9,null));};exports[_0xb038('0x3d')]=function(_0x2a0436,_0x52e1d6){var _0x19dc7b={'raw':!![],'where':{'id':_0x2a0436['params']['id']}},_0x269c7d={};_0x269c7d[_0xb038('0x2c')]=_[_0xb038('0x2e')](db[_0xb038('0x27')]['rawAttributes']);_0x269c7d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2a0436['query']);_0x269c7d['filters']=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],_0x269c7d[_0xb038('0x2d')]);_0x19dc7b[_0xb038('0x30')]=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2a0436[_0xb038('0x2d')]['fields']));_0x19dc7b['attributes']=_0x19dc7b['attributes'][_0xb038('0x3e')]?_0x19dc7b[_0xb038('0x30')]:_0x269c7d['model'];if(_0x2a0436[_0xb038('0x2d')][_0xb038('0x3a')]){_0x19dc7b[_0xb038('0x3f')]=[{'all':!![]}];}_0x19dc7b=_['merge']({},_0x19dc7b,_0x2a0436[_0xb038('0x40')]);return db['Cdr']['find'](_0x19dc7b)[_0xb038('0x22')](handleEntityNotFound(_0x52e1d6,null))[_0xb038('0x22')](respondWithResult(_0x52e1d6,null))[_0xb038('0x3c')](handleError(_0x52e1d6,null));};exports[_0xb038('0x41')]=function(_0x304515,_0x3b09e3){return db[_0xb038('0x27')][_0xb038('0x41')](_0x304515[_0xb038('0x42')],{})[_0xb038('0x22')](respondWithResult(_0x3b09e3,0xc9))['catch'](handleError(_0x3b09e3,null));};exports[_0xb038('0x21')]=function(_0x3ed968,_0x5c11d7){if(_0x3ed968[_0xb038('0x42')]['id']){delete _0x3ed968[_0xb038('0x42')]['id'];}return db['Cdr'][_0xb038('0x43')]({'where':{'id':_0x3ed968[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x5c11d7,null))[_0xb038('0x22')](saveUpdates(_0x3ed968[_0xb038('0x42')],null))[_0xb038('0x22')](respondWithResult(_0x5c11d7,null))[_0xb038('0x3c')](handleError(_0x5c11d7,null));};exports[_0xb038('0x45')]=function(_0x3a291d,_0x54a826){return db[_0xb038('0x27')][_0xb038('0x43')]({'where':{'id':_0x3a291d[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x54a826,null))[_0xb038('0x22')](removeEntity(_0x54a826,null))[_0xb038('0x3c')](handleError(_0x54a826,null));};exports['describe']=function(_0x1f4997,_0x2f3622){return db[_0xb038('0x27')][_0xb038('0x46')]()[_0xb038('0x22')](respondWithResult(_0x2f3622,null))[_0xb038('0x3c')](handleError(_0x2f3622,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 5f1e25f..909038a 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(_0x55546b,_0x24cf25){var _0x257851=function(_0x281aae){while(--_0x281aae){_0x55546b['push'](_0x55546b['shift']());}};_0x257851(++_0x24cf25);}(_0x7a54,0x106));var _0x47a5=function(_0x20eac0,_0x246d92){_0x20eac0=_0x20eac0-0x0;var _0x1bcc95=_0x7a54[_0x20eac0];return _0x1bcc95;};'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(_0x12cd9b,_0x32e030){var _0x56891f=function(_0x1a7cdb){while(--_0x1a7cdb){_0x12cd9b['push'](_0x12cd9b['shift']());}};_0x56891f(++_0x32e030);}(_0x7a54,0x106));var _0x47a5=function(_0x49b3e0,_0x4d6d9c){_0x49b3e0=_0x49b3e0-0x0;var _0x4dfd4b=_0x7a54[_0x49b3e0];return _0x4dfd4b;};'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 c53660c..1c5c036 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 _0xb9f5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird'];(function(_0x70c202,_0x30af97){var _0x343b57=function(_0x595219){while(--_0x595219){_0x70c202['push'](_0x70c202['shift']());}};_0x343b57(++_0x30af97);}(_0xb9f5,0x135));var _0x5b9f=function(_0xd3e16a,_0x28517e){_0xd3e16a=_0xd3e16a-0x0;var _0x449538=_0xb9f5[_0xd3e16a];return _0x449538;};'use strict';var _=require(_0x5b9f('0x0'));var util=require(_0x5b9f('0x1'));var moment=require('moment');var BPromise=require(_0x5b9f('0x2'));var rs=require(_0x5b9f('0x3'));var fs=require('fs');var Redis=require(_0x5b9f('0x4'));var db=require(_0x5b9f('0x5'))['db'];var utils=require(_0x5b9f('0x6'));var logger=require(_0x5b9f('0x7'))(_0x5b9f('0x8'));var config=require(_0x5b9f('0x9'));var jayson=require(_0x5b9f('0xa'));var client=jayson['client'][_0x5b9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36714f,_0x44d01d,_0x12eff3){return new BPromise(function(_0x202417,_0xc25864){return client[_0x5b9f('0xc')](_0x36714f,_0x12eff3)[_0x5b9f('0xd')](function(_0x75465d){logger['info']('Cdr,\x20%s,\x20%s',_0x44d01d,_0x5b9f('0xe'));logger['debug'](_0x5b9f('0xf'),_0x44d01d,_0x5b9f('0xe'),JSON[_0x5b9f('0x10')](_0x75465d));if(_0x75465d[_0x5b9f('0x11')]){if(_0x75465d['error'][_0x5b9f('0x12')]===0x1f4){logger[_0x5b9f('0x11')]('Cdr,\x20%s,\x20%s',_0x44d01d,_0x75465d[_0x5b9f('0x11')]['message']);return _0xc25864(_0x75465d[_0x5b9f('0x11')][_0x5b9f('0x13')]);}logger[_0x5b9f('0x11')](_0x5b9f('0x14'),_0x44d01d,_0x75465d['error'][_0x5b9f('0x13')]);return _0x202417(_0x75465d[_0x5b9f('0x11')][_0x5b9f('0x13')]);}else{logger[_0x5b9f('0x15')](_0x5b9f('0x14'),_0x44d01d,_0x5b9f('0xe'));_0x202417(_0x75465d[_0x5b9f('0x16')][_0x5b9f('0x13')]);}})[_0x5b9f('0x17')](function(_0x4fb513){logger[_0x5b9f('0x11')](_0x5b9f('0x14'),_0x44d01d,_0x4fb513);_0xc25864(_0x4fb513);});});} \ No newline at end of file +var _0x7731=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7731,0x120));var _0x1773=function(_0x3090e2,_0x3a1dbf){_0x3090e2=_0x3090e2-0x0;var _0x53fa59=_0x7731[_0x3090e2];return _0x53fa59;};'use strict';var _=require('lodash');var util=require(_0x1773('0x0'));var moment=require('moment');var BPromise=require(_0x1773('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1773('0x2'));var db=require(_0x1773('0x3'))['db'];var utils=require(_0x1773('0x4'));var logger=require('../../config/logger')(_0x1773('0x5'));var config=require(_0x1773('0x6'));var jayson=require(_0x1773('0x7'));var client=jayson[_0x1773('0x8')][_0x1773('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x67106c,_0x4e0487,_0x209515){return new BPromise(function(_0x18e4c4,_0x2434b5){return client[_0x1773('0xa')](_0x67106c,_0x209515)[_0x1773('0xb')](function(_0x91d79c){logger[_0x1773('0xc')](_0x1773('0xd'),_0x4e0487,_0x1773('0xe'));logger[_0x1773('0xf')](_0x1773('0x10'),_0x4e0487,_0x1773('0xe'),JSON[_0x1773('0x11')](_0x91d79c));if(_0x91d79c[_0x1773('0x12')]){if(_0x91d79c['error']['code']===0x1f4){logger[_0x1773('0x12')](_0x1773('0xd'),_0x4e0487,_0x91d79c['error'][_0x1773('0x13')]);return _0x2434b5(_0x91d79c[_0x1773('0x12')]['message']);}logger[_0x1773('0x12')](_0x1773('0xd'),_0x4e0487,_0x91d79c['error'][_0x1773('0x13')]);return _0x18e4c4(_0x91d79c['error'][_0x1773('0x13')]);}else{logger[_0x1773('0xc')](_0x1773('0xd'),_0x4e0487,_0x1773('0xe'));_0x18e4c4(_0x91d79c[_0x1773('0x14')][_0x1773('0x13')]);}})[_0x1773('0x15')](function(_0x28bf7d){logger[_0x1773('0x12')]('Cdr,\x20%s,\x20%s',_0x4e0487,_0x28bf7d);_0x2434b5(_0x28bf7d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 177ed2e..1bf1627 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(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 9ba2e4d..87bdb8b 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 _0x79bf=['INTEGER','STRING','noop','exports'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x79bf,0x87));var _0xf79b=function(_0x103ac4,_0x137d0c){_0x103ac4=_0x103ac4-0x0;var _0x39d4c0=_0x79bf[_0x103ac4];return _0x39d4c0;};'use strict';var Sequelize=require('sequelize');module[_0xf79b('0x0')]={'priority':{'type':Sequelize[_0xf79b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf79b('0x2')],'allowNull':![],'defaultValue':_0xf79b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf79b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2ed9=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x2ed9,0x1de));var _0x92ed=function(_0x58b900,_0x4067f4){_0x58b900=_0x58b900-0x0;var _0x142565=_0x2ed9[_0x58b900];return _0x142565;};'use strict';var Sequelize=require(_0x92ed('0x0'));module[_0x92ed('0x1')]={'priority':{'type':Sequelize[_0x92ed('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x92ed('0x3')],'allowNull':![],'defaultValue':_0x92ed('0x4')},'appdata':{'type':Sequelize[_0x92ed('0x5')]()},'description':{'type':Sequelize[_0x92ed('0x3')]},'interval':{'type':Sequelize[_0x92ed('0x3')],'defaultValue':_0x92ed('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index d71a936..98b67b6 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0xe706,0xa3));var _0x6e70=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xe706[_0x26a906];return _0x495575;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['ChatApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0x657b=['save','update','then','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','options','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x5ae1e2,_0x29ee5c){var _0x2fc7f3=function(_0x318f2f){while(--_0x318f2f){_0x5ae1e2['push'](_0x5ae1e2['shift']());}};_0x2fc7f3(++_0x29ee5c);}(_0x657b,0x131));var _0xb657=function(_0x1065bc,_0x25b539){_0x1065bc=_0x1065bc-0x0;var _0x1525fa=_0x657b[_0x1065bc];return _0x1525fa;};'use strict';var emlformat=require(_0xb657('0x0'));var rimraf=require(_0xb657('0x1'));var zipdir=require(_0xb657('0x2'));var jsonpatch=require(_0xb657('0x3'));var rp=require(_0xb657('0x4'));var moment=require('moment');var BPromise=require(_0xb657('0x5'));var Mustache=require(_0xb657('0x6'));var util=require('util');var path=require(_0xb657('0x7'));var sox=require(_0xb657('0x8'));var csv=require(_0xb657('0x9'));var ejs=require(_0xb657('0xa'));var fs=require('fs');var fs_extra=require(_0xb657('0xb'));var _=require('lodash');var squel=require(_0xb657('0xc'));var crypto=require('crypto');var jsforce=require(_0xb657('0xd'));var deskjs=require(_0xb657('0xe'));var toCsv=require(_0xb657('0x9'));var querystring=require('querystring');var Papa=require(_0xb657('0xf'));var Redis=require('ioredis');var authService=require(_0xb657('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb657('0x11'));var hardwareService=require(_0xb657('0x12'));var logger=require(_0xb657('0x13'))('api');var utils=require(_0xb657('0x14'));var config=require(_0xb657('0x15'));var licenseUtil=require(_0xb657('0x16'));var db=require(_0xb657('0x17'))['db'];function respondWithStatusCode(_0x51228b,_0x3e1ea1){_0x3e1ea1=_0x3e1ea1||0xcc;return function(_0x3ebcc2){if(_0x3ebcc2){return _0x51228b['sendStatus'](_0x3e1ea1);}return _0x51228b[_0xb657('0x18')](_0x3e1ea1)[_0xb657('0x19')]();};}function respondWithResult(_0xf04de9,_0x3ca0b4){_0x3ca0b4=_0x3ca0b4||0xc8;return function(_0x4aedb7){if(_0x4aedb7){return _0xf04de9[_0xb657('0x18')](_0x3ca0b4)[_0xb657('0x1a')](_0x4aedb7);}};}function respondWithFilteredResult(_0x511057,_0x4d253b){return function(_0x144eaf){if(_0x144eaf){var _0xbde891=typeof _0x4d253b[_0xb657('0x1b')]===_0xb657('0x1c')&&typeof _0x4d253b[_0xb657('0x1d')]===_0xb657('0x1c');var _0x20919b=_0x144eaf[_0xb657('0x1e')];var _0x9e98be=_0xbde891?0x0:_0x4d253b[_0xb657('0x1b')];var _0x2f0ba0=_0xbde891?_0x144eaf['count']:_0x4d253b[_0xb657('0x1b')]+_0x4d253b[_0xb657('0x1d')];var _0x21474b;if(_0x2f0ba0>=_0x20919b){_0x2f0ba0=_0x20919b;_0x21474b=0xc8;}else{_0x21474b=0xce;}_0x511057[_0xb657('0x18')](_0x21474b);return _0x511057['set']('Content-Range',_0x9e98be+'-'+_0x2f0ba0+'/'+_0x20919b)[_0xb657('0x1a')](_0x144eaf);}return null;};}function patchUpdates(_0x926b57){return function(_0xee3c7e){try{jsonpatch['apply'](_0xee3c7e,_0x926b57,!![]);}catch(_0x19f1e9){return BPromise['reject'](_0x19f1e9);}return _0xee3c7e[_0xb657('0x1f')]();};}function saveUpdates(_0x466a42,_0x2895ab){return function(_0x12fd7d){if(_0x12fd7d){return _0x12fd7d[_0xb657('0x20')](_0x466a42)['then'](function(_0x3de4eb){return _0x3de4eb;});}return null;};}function removeEntity(_0x13cea8,_0x38b4a0){return function(_0xfdd680){if(_0xfdd680){return _0xfdd680['destroy']()[_0xb657('0x21')](function(){_0x13cea8['status'](0xcc)[_0xb657('0x19')]();});}};}function handleEntityNotFound(_0x4e8587,_0x221794){return function(_0x4fe1c5){if(!_0x4fe1c5){_0x4e8587[_0xb657('0x22')](0x194);}return _0x4fe1c5;};}function handleError(_0x154f83,_0x5d4b01){_0x5d4b01=_0x5d4b01||0x1f4;return function(_0x241301){logger[_0xb657('0x23')](_0x241301[_0xb657('0x24')]);if(_0x241301['name']){delete _0x241301[_0xb657('0x25')];}_0x154f83[_0xb657('0x18')](_0x5d4b01)[_0xb657('0x26')](_0x241301);};}exports[_0xb657('0x27')]=function(_0x37a5af,_0xba9c05){var _0x66d5af={'raw':!![],'where':{'id':_0x37a5af[_0xb657('0x28')]['id']}},_0x3be5de={};_0x3be5de[_0xb657('0x29')]=_[_0xb657('0x2a')](db[_0xb657('0x2b')][_0xb657('0x2c')]);_0x3be5de[_0xb657('0x2d')]=_[_0xb657('0x2a')](_0x37a5af[_0xb657('0x2d')]);_0x3be5de[_0xb657('0x2e')]=_['intersection'](_0x3be5de[_0xb657('0x29')],_0x3be5de['query']);_0x66d5af[_0xb657('0x2f')]=_[_0xb657('0x30')](_0x3be5de['model'],qs[_0xb657('0x31')](_0x37a5af[_0xb657('0x2d')][_0xb657('0x31')]));_0x66d5af[_0xb657('0x2f')]=_0x66d5af[_0xb657('0x2f')]['length']?_0x66d5af[_0xb657('0x2f')]:_0x3be5de[_0xb657('0x29')];if(_0x37a5af[_0xb657('0x2d')][_0xb657('0x32')]){_0x66d5af[_0xb657('0x33')]=[{'all':!![]}];}_0x66d5af=_['merge']({},_0x66d5af,_0x37a5af[_0xb657('0x34')]);return db[_0xb657('0x2b')][_0xb657('0x35')](_0x66d5af)['then'](handleEntityNotFound(_0xba9c05,null))[_0xb657('0x21')](respondWithResult(_0xba9c05,null))['catch'](handleError(_0xba9c05,null));};exports[_0xb657('0x20')]=function(_0x461f65,_0x14021f){if(_0x461f65[_0xb657('0x36')]['id']){delete _0x461f65[_0xb657('0x36')]['id'];}return db[_0xb657('0x2b')][_0xb657('0x35')]({'where':{'id':_0x461f65[_0xb657('0x28')]['id']}})[_0xb657('0x21')](handleEntityNotFound(_0x14021f,null))[_0xb657('0x21')](saveUpdates(_0x461f65[_0xb657('0x36')],null))['then'](respondWithResult(_0x14021f,null))['catch'](handleError(_0x14021f,null));};exports[_0xb657('0x37')]=function(_0x1878e5,_0x22f93b){return db[_0xb657('0x2b')][_0xb657('0x35')]({'where':{'id':_0x1878e5[_0xb657('0x28')]['id']}})['then'](handleEntityNotFound(_0x22f93b,null))[_0xb657('0x21')](removeEntity(_0x22f93b,null))['catch'](handleError(_0x22f93b,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 798c58e..b652cb7 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 _0x319c=['../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x319c,0x1d9));var _0xc319=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x319c[_0x476bf4];return _0x788ffe;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var logger=require(_0xc319('0x1'))(_0xc319('0x2'));var moment=require(_0xc319('0x3'));var BPromise=require('bluebird');var rp=require(_0xc319('0x4'));var fs=require('fs');var path=require(_0xc319('0x5'));var rimraf=require(_0xc319('0x6'));var config=require(_0xc319('0x7'));var attributes=require(_0xc319('0x8'));module[_0xc319('0x9')]=function(_0xd892a7,_0x1c6cc6){return _0xd892a7[_0xc319('0xa')](_0xc319('0xb'),attributes,{'tableName':_0xc319('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc319('0xd'),'collate':_0xc319('0xe')});}; \ No newline at end of file +var _0x5078=['path','rimraf','./chatApplication.attributes','exports','ChatApplication','chat_applications','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4d82e1,_0x5ac72b){var _0x5f3bd9=function(_0x5380db){while(--_0x5380db){_0x4d82e1['push'](_0x4d82e1['shift']());}};_0x5f3bd9(++_0x5ac72b);}(_0x5078,0x126));var _0x8507=function(_0x40042d,_0x3ce810){_0x40042d=_0x40042d-0x0;var _0x3889a1=_0x5078[_0x40042d];return _0x3889a1;};'use strict';var _=require(_0x8507('0x0'));var util=require(_0x8507('0x1'));var logger=require(_0x8507('0x2'))('api');var moment=require(_0x8507('0x3'));var BPromise=require(_0x8507('0x4'));var rp=require(_0x8507('0x5'));var fs=require('fs');var path=require(_0x8507('0x6'));var rimraf=require(_0x8507('0x7'));var config=require('../../config/environment');var attributes=require(_0x8507('0x8'));module[_0x8507('0x9')]=function(_0x3b2e94,_0x2ba5c4){return _0x3b2e94['define'](_0x8507('0xa'),attributes,{'tableName':_0x8507('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5a70fd2..3034c33 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 _0x0df0=['code','error','ChatApplication,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0df0,0x9e));var _0x00df=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x0df0[_0x50aea5];return _0x4657f1;};'use strict';var _=require(_0x00df('0x0'));var util=require(_0x00df('0x1'));var moment=require(_0x00df('0x2'));var BPromise=require('bluebird');var rs=require(_0x00df('0x3'));var fs=require('fs');var Redis=require(_0x00df('0x4'));var db=require(_0x00df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00df('0x6'))(_0x00df('0x7'));var config=require(_0x00df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x00df('0x9')][_0x00df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be127,_0x2ab690,_0x19a2b3){return new BPromise(function(_0x16b199,_0x16feaf){return client[_0x00df('0xb')](_0x1be127,_0x19a2b3)[_0x00df('0xc')](function(_0x491225){logger[_0x00df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2ab690,_0x00df('0xe'));logger[_0x00df('0xf')](_0x00df('0x10'),_0x2ab690,_0x00df('0xe'),JSON[_0x00df('0x11')](_0x491225));if(_0x491225['error']){if(_0x491225['error'][_0x00df('0x12')]===0x1f4){logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x491225[_0x00df('0x13')][_0x00df('0x15')]);return _0x16feaf(_0x491225[_0x00df('0x13')][_0x00df('0x15')]);}logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x491225[_0x00df('0x13')][_0x00df('0x15')]);return _0x16b199(_0x491225[_0x00df('0x13')][_0x00df('0x15')]);}else{logger[_0x00df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x2ab690,'request\x20sent');_0x16b199(_0x491225['result'][_0x00df('0x15')]);}})['catch'](function(_0x52bee2){logger[_0x00df('0x13')](_0x00df('0x14'),_0x2ab690,_0x52bee2);_0x16feaf(_0x52bee2);});});} \ No newline at end of file +var _0x21ee=['code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x211b69,_0x310c1c){var _0x55b330=function(_0x5bad6c){while(--_0x5bad6c){_0x211b69['push'](_0x211b69['shift']());}};_0x55b330(++_0x310c1c);}(_0x21ee,0xb5));var _0xe21e=function(_0x3a8db5,_0x29cfa6){_0x3a8db5=_0x3a8db5-0x0;var _0x3169d1=_0x21ee[_0x3a8db5];return _0x3169d1;};'use strict';var _=require(_0xe21e('0x0'));var util=require(_0xe21e('0x1'));var moment=require(_0xe21e('0x2'));var BPromise=require(_0xe21e('0x3'));var rs=require(_0xe21e('0x4'));var fs=require('fs');var Redis=require(_0xe21e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe21e('0x6'));var logger=require('../../config/logger')(_0xe21e('0x7'));var config=require(_0xe21e('0x8'));var jayson=require(_0xe21e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x187c08,_0x18dfd4,_0x3fe2e9){return new BPromise(function(_0x4dfb22,_0x581e00){return client['request'](_0x187c08,_0x3fe2e9)[_0xe21e('0xa')](function(_0x4329b6){logger[_0xe21e('0xb')]('ChatApplication,\x20%s,\x20%s',_0x18dfd4,_0xe21e('0xc'));logger[_0xe21e('0xd')](_0xe21e('0xe'),_0x18dfd4,_0xe21e('0xc'),JSON[_0xe21e('0xf')](_0x4329b6));if(_0x4329b6[_0xe21e('0x10')]){if(_0x4329b6[_0xe21e('0x10')][_0xe21e('0x11')]===0x1f4){logger['error'](_0xe21e('0x12'),_0x18dfd4,_0x4329b6['error'][_0xe21e('0x13')]);return _0x581e00(_0x4329b6[_0xe21e('0x10')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x18dfd4,_0x4329b6[_0xe21e('0x10')]['message']);return _0x4dfb22(_0x4329b6[_0xe21e('0x10')]['message']);}else{logger['info'](_0xe21e('0x12'),_0x18dfd4,_0xe21e('0xc'));_0x4dfb22(_0x4329b6[_0xe21e('0x14')][_0xe21e('0x13')]);}})[_0xe21e('0x15')](function(_0x17371d){logger[_0xe21e('0x10')](_0xe21e('0x12'),_0x18dfd4,_0x17371d);_0x581e00(_0x17371d);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 264aba3..2c1f4d5 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 _0x8529=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','./chatApplication.controller','get','/:id','show','put','update'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x8529,0x7f));var _0x9852=function(_0x5136dc,_0x38b7c2){_0x5136dc=_0x5136dc-0x0;var _0x46f3bb=_0x8529[_0x5136dc];return _0x46f3bb;};'use strict';var multer=require(_0x9852('0x0'));var util=require(_0x9852('0x1'));var path=require(_0x9852('0x2'));var timeout=require(_0x9852('0x3'));var express=require(_0x9852('0x4'));var router=express[_0x9852('0x5')]();var fs_extra=require(_0x9852('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9852('0x7'));router[_0x9852('0x8')](_0x9852('0x9'),auth['isAuthenticated'](),controller[_0x9852('0xa')]);router[_0x9852('0xb')](_0x9852('0x9'),auth['isAuthenticated'](),controller[_0x9852('0xc')]);router[_0x9852('0xd')](_0x9852('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xaf1f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer','path','express','Router'];(function(_0x39377d,_0x12bd88){var _0x1d589f=function(_0x1b3c4d){while(--_0x1b3c4d){_0x39377d['push'](_0x39377d['shift']());}};_0x1d589f(++_0x12bd88);}(_0xaf1f,0x161));var _0xfaf1=function(_0x33ffb9,_0x57cfa7){_0x33ffb9=_0x33ffb9-0x0;var _0x39a3d8=_0xaf1f[_0x33ffb9];return _0x39a3d8;};'use strict';var multer=require(_0xfaf1('0x0'));var util=require('util');var path=require(_0xfaf1('0x1'));var timeout=require('connect-timeout');var express=require(_0xfaf1('0x2'));var router=express[_0xfaf1('0x3')]();var fs_extra=require(_0xfaf1('0x4'));var auth=require(_0xfaf1('0x5'));var interaction=require(_0xfaf1('0x6'));var config=require(_0xfaf1('0x7'));var controller=require(_0xfaf1('0x8'));router[_0xfaf1('0x9')](_0xfaf1('0xa'),auth[_0xfaf1('0xb')](),controller[_0xfaf1('0xc')]);router[_0xfaf1('0xd')](_0xfaf1('0xa'),auth['isAuthenticated'](),controller[_0xfaf1('0xe')]);router[_0xfaf1('0xf')](_0xfaf1('0xa'),auth[_0xfaf1('0xb')](),controller[_0xfaf1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 6407cd6..87f8b3b 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 _0xbdc2=['STRING','sequelize','exports'];(function(_0x4a9cb5,_0x5aa119){var _0x2dd0d2=function(_0x2aac77){while(--_0x2aac77){_0x4a9cb5['push'](_0x4a9cb5['shift']());}};_0x2dd0d2(++_0x5aa119);}(_0xbdc2,0x148));var _0x2bdc=function(_0x219daf,_0x36b307){_0x219daf=_0x219daf-0x0;var _0x4c2e61=_0xbdc2[_0x219daf];return _0x4c2e61;};'use strict';var Sequelize=require(_0x2bdc('0x0'));module[_0x2bdc('0x1')]={'name':{'type':Sequelize[_0x2bdc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2bdc('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x51a8=['sequelize','STRING','BOOLEAN'];(function(_0x13a209,_0x25d901){var _0x367942=function(_0x470830){while(--_0x470830){_0x13a209['push'](_0x13a209['shift']());}};_0x367942(++_0x25d901);}(_0x51a8,0x186));var _0x851a=function(_0x9e9e24,_0x43f9e3){_0x9e9e24=_0x9e9e24-0x0;var _0x4b22ba=_0x51a8[_0x9e9e24];return _0x4b22ba;};'use strict';var Sequelize=require(_0x851a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x851a('0x1')]},'write':{'type':Sequelize[_0x851a('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c01e1af..ce6518a 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 _0x6748=['request-promise','moment','bluebird','util','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','redis','localhost','socket.io-emitter','./chatGroup.socket','register','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','filter','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','zip-dir','fast-json-patch'];(function(_0xac15c3,_0x2451ea){var _0x3ef3db=function(_0x361906){while(--_0x361906){_0xac15c3['push'](_0xac15c3['shift']());}};_0x3ef3db(++_0x2451ea);}(_0x6748,0xc9));var _0x8674=function(_0x2beca6,_0x5f2313){_0x2beca6=_0x2beca6-0x0;var _0x4a9cea=_0x6748[_0x2beca6];return _0x4a9cea;};'use strict';var emlformat=require(_0x8674('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8674('0x1'));var jsonpatch=require(_0x8674('0x2'));var rp=require(_0x8674('0x3'));var moment=require(_0x8674('0x4'));var BPromise=require(_0x8674('0x5'));var Mustache=require('mustache');var util=require(_0x8674('0x6'));var path=require(_0x8674('0x7'));var sox=require('sox');var csv=require(_0x8674('0x8'));var ejs=require(_0x8674('0x9'));var fs=require('fs');var fs_extra=require(_0x8674('0xa'));var _=require(_0x8674('0xb'));var squel=require(_0x8674('0xc'));var crypto=require(_0x8674('0xd'));var jsforce=require(_0x8674('0xe'));var deskjs=require(_0x8674('0xf'));var toCsv=require(_0x8674('0x8'));var querystring=require(_0x8674('0x10'));var Papa=require(_0x8674('0x11'));var Redis=require('ioredis');var authService=require(_0x8674('0x12'));var qs=require(_0x8674('0x13'));var as=require(_0x8674('0x14'));var hardwareService=require(_0x8674('0x15'));var logger=require(_0x8674('0x16'))(_0x8674('0x17'));var utils=require(_0x8674('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8674('0x19')]=_['defaults'](config[_0x8674('0x19')],{'host':_0x8674('0x1a'),'port':0x18eb});var socket=require(_0x8674('0x1b'))(new Redis(config[_0x8674('0x19')]));require(_0x8674('0x1c'))[_0x8674('0x1d')](socket);function respondWithStatusCode(_0x15cd1a,_0x31677a){_0x31677a=_0x31677a||0xcc;return function(_0x51a053){if(_0x51a053){return _0x15cd1a['sendStatus'](_0x31677a);}return _0x15cd1a['status'](_0x31677a)[_0x8674('0x1e')]();};}function respondWithResult(_0x26ebb4,_0x2b9258){_0x2b9258=_0x2b9258||0xc8;return function(_0x27c8c7){if(_0x27c8c7){return _0x26ebb4['status'](_0x2b9258)['json'](_0x27c8c7);}};}function respondWithFilteredResult(_0x11df36,_0xaa46b2){return function(_0x52cfc4){if(_0x52cfc4){var _0x4d4b62=typeof _0xaa46b2['offset']===_0x8674('0x1f')&&typeof _0xaa46b2[_0x8674('0x20')]==='undefined';var _0x130ec4=_0x52cfc4[_0x8674('0x21')];var _0x58ed83=_0x4d4b62?0x0:_0xaa46b2[_0x8674('0x22')];var _0x195c4e=_0x4d4b62?_0x52cfc4[_0x8674('0x21')]:_0xaa46b2['offset']+_0xaa46b2[_0x8674('0x20')];var _0x3f5d36;if(_0x195c4e>=_0x130ec4){_0x195c4e=_0x130ec4;_0x3f5d36=0xc8;}else{_0x3f5d36=0xce;}_0x11df36[_0x8674('0x23')](_0x3f5d36);return _0x11df36[_0x8674('0x24')](_0x8674('0x25'),_0x58ed83+'-'+_0x195c4e+'/'+_0x130ec4)[_0x8674('0x26')](_0x52cfc4);}return null;};}function patchUpdates(_0x5355d0){return function(_0x4b0ef1){try{jsonpatch[_0x8674('0x27')](_0x4b0ef1,_0x5355d0,!![]);}catch(_0x245b80){return BPromise[_0x8674('0x28')](_0x245b80);}return _0x4b0ef1[_0x8674('0x29')]();};}function saveUpdates(_0x4af696,_0x24c95d){return function(_0xc150ba){if(_0xc150ba){return _0xc150ba[_0x8674('0x2a')](_0x4af696)['then'](function(_0x1e5a06){return _0x1e5a06;});}return null;};}function removeEntity(_0x1e72cd,_0x1963f5){return function(_0x480879){if(_0x480879){return _0x480879[_0x8674('0x2b')]()[_0x8674('0x2c')](function(){_0x1e72cd[_0x8674('0x23')](0xcc)[_0x8674('0x1e')]();});}};}function handleEntityNotFound(_0x7c4622,_0x5eb596){return function(_0x5a03d6){if(!_0x5a03d6){_0x7c4622[_0x8674('0x2d')](0x194);}return _0x5a03d6;};}function handleError(_0x53ec08,_0x327ff4){_0x327ff4=_0x327ff4||0x1f4;return function(_0x5e4f66){logger['error'](_0x5e4f66[_0x8674('0x2e')]);if(_0x5e4f66[_0x8674('0x2f')]){delete _0x5e4f66['name'];}_0x53ec08[_0x8674('0x23')](_0x327ff4)[_0x8674('0x30')](_0x5e4f66);};}exports[_0x8674('0x31')]=function(_0x2a31fe,_0x3a40a1){var _0x4f1170={},_0x120769={},_0x2f23e0={'count':0x0,'rows':[]};var _0x1373e0=_[_0x8674('0x32')](db[_0x8674('0x33')]['rawAttributes'],function(_0x2e5657){return{'name':_0x2e5657[_0x8674('0x34')],'type':_0x2e5657[_0x8674('0x35')][_0x8674('0x36')]};});_0x120769[_0x8674('0x37')]=_[_0x8674('0x32')](_0x1373e0,_0x8674('0x2f'));_0x120769[_0x8674('0x38')]=_[_0x8674('0x39')](_0x2a31fe[_0x8674('0x38')]);_0x120769[_0x8674('0x3a')]=_[_0x8674('0x3b')](_0x120769[_0x8674('0x37')],_0x120769[_0x8674('0x38')]);_0x4f1170['attributes']=_[_0x8674('0x3b')](_0x120769[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x2a31fe[_0x8674('0x38')][_0x8674('0x3c')]));_0x4f1170[_0x8674('0x3d')]=_0x4f1170[_0x8674('0x3d')]['length']?_0x4f1170[_0x8674('0x3d')]:_0x120769[_0x8674('0x37')];if(!_0x2a31fe['query'][_0x8674('0x3e')]('nolimit')){_0x4f1170['limit']=qs['limit'](_0x2a31fe['query'][_0x8674('0x20')]);_0x4f1170[_0x8674('0x22')]=qs['offset'](_0x2a31fe[_0x8674('0x38')][_0x8674('0x22')]);}_0x4f1170[_0x8674('0x3f')]=qs['sort'](_0x2a31fe[_0x8674('0x38')][_0x8674('0x40')]);_0x4f1170['where']=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x2a31fe[_0x8674('0x38')],_0x120769[_0x8674('0x3a')]),_0x1373e0);if(_0x2a31fe[_0x8674('0x38')]['filter']){_0x4f1170[_0x8674('0x42')]=_[_0x8674('0x43')](_0x4f1170[_0x8674('0x42')],{'$or':_['map'](_0x1373e0,function(_0x383ada){if(_0x383ada[_0x8674('0x35')]!==_0x8674('0x44')){var _0x12729f={};_0x12729f[_0x383ada['name']]={'$like':'%'+_0x2a31fe[_0x8674('0x38')]['filter']+'%'};return _0x12729f;}})});}_0x4f1170=_[_0x8674('0x43')]({},_0x4f1170,_0x2a31fe[_0x8674('0x45')]);var _0x474f2a={'where':_0x4f1170[_0x8674('0x42')]};return db[_0x8674('0x33')][_0x8674('0x21')](_0x474f2a)[_0x8674('0x2c')](function(_0x54d08e){_0x2f23e0[_0x8674('0x21')]=_0x54d08e;if(_0x2a31fe[_0x8674('0x38')]['includeAll']){_0x4f1170['include']=[{'all':!![]}];}return db['ChatGroup'][_0x8674('0x46')](_0x4f1170);})['then'](function(_0x4a6598){_0x2f23e0[_0x8674('0x47')]=_0x4a6598;return _0x2f23e0;})[_0x8674('0x2c')](respondWithFilteredResult(_0x3a40a1,_0x4f1170))[_0x8674('0x48')](handleError(_0x3a40a1,null));};exports[_0x8674('0x49')]=function(_0x43998a,_0x3fa793){var _0x5c3df5={'raw':!![],'where':{'id':_0x43998a[_0x8674('0x4a')]['id']}},_0x2f2b43={};_0x2f2b43['model']=_[_0x8674('0x39')](db[_0x8674('0x33')][_0x8674('0x4b')]);_0x2f2b43[_0x8674('0x38')]=_[_0x8674('0x39')](_0x43998a[_0x8674('0x38')]);_0x2f2b43[_0x8674('0x3a')]=_[_0x8674('0x3b')](_0x2f2b43[_0x8674('0x37')],_0x2f2b43[_0x8674('0x38')]);_0x5c3df5[_0x8674('0x3d')]=_[_0x8674('0x3b')](_0x2f2b43[_0x8674('0x37')],qs['fields'](_0x43998a[_0x8674('0x38')][_0x8674('0x3c')]));_0x5c3df5[_0x8674('0x3d')]=_0x5c3df5['attributes']['length']?_0x5c3df5[_0x8674('0x3d')]:_0x2f2b43[_0x8674('0x37')];if(_0x43998a[_0x8674('0x38')][_0x8674('0x4c')]){_0x5c3df5[_0x8674('0x4d')]=[{'all':!![]}];}_0x5c3df5=_[_0x8674('0x43')]({},_0x5c3df5,_0x43998a[_0x8674('0x45')]);return db[_0x8674('0x33')][_0x8674('0x4e')](_0x5c3df5)[_0x8674('0x2c')](handleEntityNotFound(_0x3fa793,null))[_0x8674('0x2c')](respondWithResult(_0x3fa793,null))[_0x8674('0x48')](handleError(_0x3fa793,null));};exports['create']=function(_0x560375,_0x5045ce){return db[_0x8674('0x33')][_0x8674('0x4f')](_0x560375['body'],{})[_0x8674('0x2c')](respondWithResult(_0x5045ce,0xc9))[_0x8674('0x48')](handleError(_0x5045ce,null));};exports[_0x8674('0x2a')]=function(_0x38afb1,_0x507402){if(_0x38afb1[_0x8674('0x50')]['id']){delete _0x38afb1[_0x8674('0x50')]['id'];}return db[_0x8674('0x33')]['find']({'where':{'id':_0x38afb1['params']['id']}})['then'](handleEntityNotFound(_0x507402,null))['then'](saveUpdates(_0x38afb1['body'],null))[_0x8674('0x2c')](respondWithResult(_0x507402,null))[_0x8674('0x48')](handleError(_0x507402,null));};exports[_0x8674('0x2b')]=function(_0x272757,_0x36cac1){return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x272757[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x36cac1,null))[_0x8674('0x2c')](removeEntity(_0x36cac1,null))[_0x8674('0x48')](handleError(_0x36cac1,null));};exports[_0x8674('0x51')]=function(_0x24216c,_0x2fc8dc){return db[_0x8674('0x33')]['describe']()[_0x8674('0x2c')](respondWithResult(_0x2fc8dc,null))[_0x8674('0x48')](handleError(_0x2fc8dc,null));};exports[_0x8674('0x52')]=function(_0x5830fc,_0x6712f1,_0x52f403){return db[_0x8674('0x53')][_0x8674('0x21')]({'where':{'ChatGroupId':_0x5830fc[_0x8674('0x4a')]['id'],'ToId':_0x5830fc[_0x8674('0x54')]['id'],'read':![]}})[_0x8674('0x2c')](function(_0x17224a){return{'id':_[_0x8674('0x55')](_0x5830fc['params']['id']),'count':_0x17224a};})['then'](respondWithResult(_0x6712f1,null))['catch'](handleError(_0x6712f1,null));};exports[_0x8674('0x56')]=function(_0x10411c,_0x1e5e0f,_0x284d5d){return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x10411c[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x1e5e0f,null))[_0x8674('0x2c')](function(_0x3553f0){if(_0x3553f0){return _0x3553f0[_0x8674('0x56')](_0x10411c[_0x8674('0x50')][_0x8674('0x57')],_[_0x8674('0x58')](_0x10411c[_0x8674('0x50')],[_0x8674('0x57'),'id'])||{});}})[_0x8674('0x2c')](respondWithResult(_0x1e5e0f,null))[_0x8674('0x48')](handleError(_0x1e5e0f,null));};exports[_0x8674('0x59')]=function(_0x57bb82,_0x47541d,_0x1028bb){var _0x110f80={};var _0x195436={};var _0x474874;var _0x32a3f6;return db[_0x8674('0x33')][_0x8674('0x5a')]({'where':{'id':_0x57bb82[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x47541d,null))[_0x8674('0x2c')](function(_0x9cab85){if(_0x9cab85){_0x474874=_0x9cab85;_0x195436[_0x8674('0x37')]=_[_0x8674('0x39')](db[_0x8674('0x5b')]['rawAttributes']);_0x195436[_0x8674('0x38')]=_[_0x8674('0x39')](_0x57bb82[_0x8674('0x38')]);_0x195436[_0x8674('0x3a')]=_['intersection'](_0x195436[_0x8674('0x37')],_0x195436[_0x8674('0x38')]);_0x110f80['attributes']=_[_0x8674('0x3b')](_0x195436[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x57bb82['query'][_0x8674('0x3c')]));_0x110f80[_0x8674('0x3d')]=_0x110f80[_0x8674('0x3d')][_0x8674('0x5c')]?_0x110f80[_0x8674('0x3d')]:_0x195436[_0x8674('0x37')];_0x110f80[_0x8674('0x3f')]=qs[_0x8674('0x40')](_0x57bb82[_0x8674('0x38')][_0x8674('0x40')]);_0x110f80[_0x8674('0x42')]=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x57bb82['query'],_0x195436[_0x8674('0x3a')]));if(_0x57bb82[_0x8674('0x38')][_0x8674('0x5d')]){_0x110f80['where']=_[_0x8674('0x43')](_0x110f80[_0x8674('0x42')],{'$or':_[_0x8674('0x32')](_0x110f80[_0x8674('0x3d')],function(_0x161b85){var _0x48662e={};_0x48662e[_0x161b85]={'$like':'%'+_0x57bb82[_0x8674('0x38')][_0x8674('0x5d')]+'%'};return _0x48662e;})});}_0x110f80=_[_0x8674('0x43')]({},_0x110f80,_0x57bb82[_0x8674('0x45')]);return _0x474874[_0x8674('0x59')](_0x110f80);}})[_0x8674('0x2c')](function(_0x1d62c2){if(_0x1d62c2){_0x32a3f6=_0x1d62c2[_0x8674('0x5c')];if(!_0x57bb82[_0x8674('0x38')]['hasOwnProperty']('nolimit')){_0x110f80[_0x8674('0x20')]=qs['limit'](_0x57bb82[_0x8674('0x38')][_0x8674('0x20')]);_0x110f80[_0x8674('0x22')]=qs[_0x8674('0x22')](_0x57bb82['query'][_0x8674('0x22')]);}return _0x474874[_0x8674('0x59')](_0x110f80);}})[_0x8674('0x2c')](function(_0x712112){if(_0x712112){return _0x712112?{'count':_0x32a3f6,'rows':_0x712112}:null;}})[_0x8674('0x2c')](respondWithResult(_0x47541d,null))['catch'](handleError(_0x47541d,null));};exports['removeMembers']=function(_0x28e256,_0x30db9b,_0xa16f8f){return db['ChatGroup']['find']({'where':{'id':_0x28e256[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x30db9b,null))['then'](function(_0x46afa7){if(_0x46afa7){return _0x46afa7[_0x8674('0x5e')](_0x28e256[_0x8674('0x38')][_0x8674('0x57')]);}})[_0x8674('0x2c')](respondWithStatusCode(_0x30db9b,null))[_0x8674('0x48')](handleError(_0x30db9b,null));};exports[_0x8674('0x5f')]=function(_0x2da7de,_0x3f5953,_0x3e25c8){if(_0x2da7de[_0x8674('0x50')]['id']){delete _0x2da7de[_0x8674('0x50')]['id'];}return db[_0x8674('0x33')][_0x8674('0x4e')]({'where':{'id':_0x2da7de[_0x8674('0x4a')]['id']}})[_0x8674('0x2c')](handleEntityNotFound(_0x3f5953,null))[_0x8674('0x2c')](function(_0x228ed9){if(_0x228ed9){_0x2da7de[_0x8674('0x50')][_0x8674('0x60')]=_0x228ed9['id'];return db[_0x8674('0x53')][_0x8674('0x4f')](_0x2da7de[_0x8674('0x50')]);}})[_0x8674('0x2c')](respondWithResult(_0x3f5953,null))[_0x8674('0x48')](handleError(_0x3f5953,null));};exports[_0x8674('0x61')]=function(_0x53d3a0,_0x5151de,_0x1bbe7f){var _0xa26d5c={};var _0x5ec7cd={};var _0x325a44;var _0x49ff45;return db[_0x8674('0x33')][_0x8674('0x5a')]({'where':{'id':_0x53d3a0['params']['id']}})['then'](handleEntityNotFound(_0x5151de,null))[_0x8674('0x2c')](function(_0x5165dc){if(_0x5165dc){_0x325a44=_0x5165dc;_0x5ec7cd[_0x8674('0x37')]=_[_0x8674('0x39')](db['ChatInternalMessage'][_0x8674('0x4b')]);_0x5ec7cd['query']=_['keys'](_0x53d3a0[_0x8674('0x38')]);_0x5ec7cd['filters']=_[_0x8674('0x3b')](_0x5ec7cd['model'],_0x5ec7cd['query']);_0xa26d5c[_0x8674('0x3d')]=_['intersection'](_0x5ec7cd[_0x8674('0x37')],qs[_0x8674('0x3c')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x3c')]));_0xa26d5c['attributes']=_0xa26d5c[_0x8674('0x3d')][_0x8674('0x5c')]?_0xa26d5c[_0x8674('0x3d')]:_0x5ec7cd['model'];_0xa26d5c[_0x8674('0x3f')]=qs[_0x8674('0x40')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x40')]);_0xa26d5c[_0x8674('0x42')]=qs[_0x8674('0x3a')](_[_0x8674('0x41')](_0x53d3a0[_0x8674('0x38')],_0x5ec7cd[_0x8674('0x3a')]));if(_0x53d3a0['query']['filter']){_0xa26d5c['where']=_[_0x8674('0x43')](_0xa26d5c[_0x8674('0x42')],{'$or':_[_0x8674('0x32')](_0xa26d5c[_0x8674('0x3d')],function(_0x4715a3){var _0x4bec18={};_0x4bec18[_0x4715a3]={'$like':'%'+_0x53d3a0[_0x8674('0x38')]['filter']+'%'};return _0x4bec18;})});}if(_0x53d3a0[_0x8674('0x38')][_0x8674('0x62')]){var _0x397d70=_0x53d3a0[_0x8674('0x38')][_0x8674('0x62')]['split'](',');var _0x18e553={};_0x18e553[_0x397d70[0x0]]={'$gte':moment(_0x397d70[0x1])[_0x8674('0x63')](_0x8674('0x64'))};_0xa26d5c['where']=_['merge'](_0xa26d5c[_0x8674('0x42')],_0x18e553);}_0xa26d5c=_[_0x8674('0x43')]({},_0xa26d5c,_0x53d3a0['options']);return _0x325a44[_0x8674('0x61')](_0xa26d5c);}})[_0x8674('0x2c')](function(_0x176bb5){if(_0x176bb5){_0x49ff45=_0x176bb5['length'];if(!_0x53d3a0[_0x8674('0x38')][_0x8674('0x3e')](_0x8674('0x65'))){_0xa26d5c['limit']=qs[_0x8674('0x20')](_0x53d3a0[_0x8674('0x38')][_0x8674('0x20')]);_0xa26d5c[_0x8674('0x22')]=qs[_0x8674('0x22')](_0x53d3a0['query'][_0x8674('0x22')]);}return _0x325a44['getMessages'](_0xa26d5c);}})[_0x8674('0x2c')](function(_0x5e54e5){if(_0x5e54e5){return _0x5e54e5?{'count':_0x49ff45,'rows':_0x5e54e5}:null;}})['then'](respondWithResult(_0x5151de,null))['catch'](handleError(_0x5151de,null));}; \ No newline at end of file +var _0x6228=['catch','show','params','rawAttributes','keys','length','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','findOne','User','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6228,0x147));var _0x8622=function(_0x3a1535,_0x4d0d5a){_0x3a1535=_0x3a1535-0x0;var _0x3fa8f1=_0x6228[_0x3a1535];return _0x3fa8f1;};'use strict';var emlformat=require(_0x8622('0x0'));var rimraf=require(_0x8622('0x1'));var zipdir=require(_0x8622('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8622('0x3'));var moment=require(_0x8622('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8622('0x5'));var util=require(_0x8622('0x6'));var path=require(_0x8622('0x7'));var sox=require(_0x8622('0x8'));var csv=require(_0x8622('0x9'));var ejs=require(_0x8622('0xa'));var fs=require('fs');var fs_extra=require(_0x8622('0xb'));var _=require(_0x8622('0xc'));var squel=require(_0x8622('0xd'));var crypto=require(_0x8622('0xe'));var jsforce=require(_0x8622('0xf'));var deskjs=require(_0x8622('0x10'));var toCsv=require(_0x8622('0x9'));var querystring=require(_0x8622('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8622('0x12'));var qs=require(_0x8622('0x13'));var as=require(_0x8622('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8622('0x15'))(_0x8622('0x16'));var utils=require(_0x8622('0x17'));var config=require(_0x8622('0x18'));var licenseUtil=require(_0x8622('0x19'));var db=require('../../mysqldb')['db'];config[_0x8622('0x1a')]=_[_0x8622('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8622('0x1c'))(new Redis(config[_0x8622('0x1a')]));require(_0x8622('0x1d'))['register'](socket);function respondWithStatusCode(_0x449881,_0x93232e){_0x93232e=_0x93232e||0xcc;return function(_0x8a8434){if(_0x8a8434){return _0x449881[_0x8622('0x1e')](_0x93232e);}return _0x449881[_0x8622('0x1f')](_0x93232e)[_0x8622('0x20')]();};}function respondWithResult(_0x400ab7,_0x114eef){_0x114eef=_0x114eef||0xc8;return function(_0x17540e){if(_0x17540e){return _0x400ab7[_0x8622('0x1f')](_0x114eef)[_0x8622('0x21')](_0x17540e);}};}function respondWithFilteredResult(_0x585fbc,_0x449588){return function(_0x34028a){if(_0x34028a){var _0x5e2fc5=typeof _0x449588['offset']===_0x8622('0x22')&&typeof _0x449588[_0x8622('0x23')]==='undefined';var _0x4de237=_0x34028a[_0x8622('0x24')];var _0x16856d=_0x5e2fc5?0x0:_0x449588['offset'];var _0x37855e=_0x5e2fc5?_0x34028a[_0x8622('0x24')]:_0x449588[_0x8622('0x25')]+_0x449588[_0x8622('0x23')];var _0xc74f97;if(_0x37855e>=_0x4de237){_0x37855e=_0x4de237;_0xc74f97=0xc8;}else{_0xc74f97=0xce;}_0x585fbc[_0x8622('0x1f')](_0xc74f97);return _0x585fbc[_0x8622('0x26')](_0x8622('0x27'),_0x16856d+'-'+_0x37855e+'/'+_0x4de237)['json'](_0x34028a);}return null;};}function patchUpdates(_0x2ef05b){return function(_0x397038){try{jsonpatch[_0x8622('0x28')](_0x397038,_0x2ef05b,!![]);}catch(_0x420514){return BPromise[_0x8622('0x29')](_0x420514);}return _0x397038['save']();};}function saveUpdates(_0x418a10,_0x3fe258){return function(_0xf76ecd){if(_0xf76ecd){return _0xf76ecd[_0x8622('0x2a')](_0x418a10)[_0x8622('0x2b')](function(_0x1fe2c0){return _0x1fe2c0;});}return null;};}function removeEntity(_0x2887de,_0x292be7){return function(_0x3d7f3b){if(_0x3d7f3b){return _0x3d7f3b[_0x8622('0x2c')]()['then'](function(){_0x2887de[_0x8622('0x1f')](0xcc)[_0x8622('0x20')]();});}};}function handleEntityNotFound(_0x91608c,_0x2b6521){return function(_0x22c72d){if(!_0x22c72d){_0x91608c[_0x8622('0x1e')](0x194);}return _0x22c72d;};}function handleError(_0x512ad5,_0x174e73){_0x174e73=_0x174e73||0x1f4;return function(_0x30fbc3){logger[_0x8622('0x2d')](_0x30fbc3[_0x8622('0x2e')]);if(_0x30fbc3[_0x8622('0x2f')]){delete _0x30fbc3[_0x8622('0x2f')];}_0x512ad5[_0x8622('0x1f')](_0x174e73)[_0x8622('0x30')](_0x30fbc3);};}exports[_0x8622('0x31')]=function(_0xba2dd3,_0xe32bf){var _0x1d2c95={},_0x214972={},_0x3555e4={'count':0x0,'rows':[]};var _0x4e2dc6=_[_0x8622('0x32')](db[_0x8622('0x33')]['rawAttributes'],function(_0x1303c9){return{'name':_0x1303c9[_0x8622('0x34')],'type':_0x1303c9[_0x8622('0x35')][_0x8622('0x36')]};});_0x214972[_0x8622('0x37')]=_[_0x8622('0x32')](_0x4e2dc6,'name');_0x214972['query']=_['keys'](_0xba2dd3[_0x8622('0x38')]);_0x214972['filters']=_[_0x8622('0x39')](_0x214972[_0x8622('0x37')],_0x214972[_0x8622('0x38')]);_0x1d2c95[_0x8622('0x3a')]=_[_0x8622('0x39')](_0x214972[_0x8622('0x37')],qs['fields'](_0xba2dd3[_0x8622('0x38')][_0x8622('0x3b')]));_0x1d2c95[_0x8622('0x3a')]=_0x1d2c95[_0x8622('0x3a')]['length']?_0x1d2c95[_0x8622('0x3a')]:_0x214972[_0x8622('0x37')];if(!_0xba2dd3[_0x8622('0x38')][_0x8622('0x3c')](_0x8622('0x3d'))){_0x1d2c95[_0x8622('0x23')]=qs[_0x8622('0x23')](_0xba2dd3['query'][_0x8622('0x23')]);_0x1d2c95[_0x8622('0x25')]=qs[_0x8622('0x25')](_0xba2dd3[_0x8622('0x38')][_0x8622('0x25')]);}_0x1d2c95[_0x8622('0x3e')]=qs['sort'](_0xba2dd3[_0x8622('0x38')][_0x8622('0x3f')]);_0x1d2c95[_0x8622('0x40')]=qs[_0x8622('0x41')](_[_0x8622('0x42')](_0xba2dd3['query'],_0x214972['filters']),_0x4e2dc6);if(_0xba2dd3[_0x8622('0x38')][_0x8622('0x43')]){_0x1d2c95[_0x8622('0x40')]=_[_0x8622('0x44')](_0x1d2c95[_0x8622('0x40')],{'$or':_['map'](_0x4e2dc6,function(_0x1e0e01){if(_0x1e0e01[_0x8622('0x35')]!==_0x8622('0x45')){var _0x15b764={};_0x15b764[_0x1e0e01['name']]={'$like':'%'+_0xba2dd3[_0x8622('0x38')][_0x8622('0x43')]+'%'};return _0x15b764;}})});}_0x1d2c95=_[_0x8622('0x44')]({},_0x1d2c95,_0xba2dd3[_0x8622('0x46')]);var _0x808108={'where':_0x1d2c95['where']};return db[_0x8622('0x33')][_0x8622('0x24')](_0x808108)['then'](function(_0x4f145c){_0x3555e4[_0x8622('0x24')]=_0x4f145c;if(_0xba2dd3[_0x8622('0x38')]['includeAll']){_0x1d2c95['include']=[{'all':!![]}];}return db[_0x8622('0x33')][_0x8622('0x47')](_0x1d2c95);})[_0x8622('0x2b')](function(_0x4e8fae){_0x3555e4[_0x8622('0x48')]=_0x4e8fae;return _0x3555e4;})[_0x8622('0x2b')](respondWithFilteredResult(_0xe32bf,_0x1d2c95))[_0x8622('0x49')](handleError(_0xe32bf,null));};exports[_0x8622('0x4a')]=function(_0x2f3a13,_0x1b833b){var _0x180666={'raw':!![],'where':{'id':_0x2f3a13[_0x8622('0x4b')]['id']}},_0x3e13a0={};_0x3e13a0[_0x8622('0x37')]=_['keys'](db[_0x8622('0x33')][_0x8622('0x4c')]);_0x3e13a0[_0x8622('0x38')]=_[_0x8622('0x4d')](_0x2f3a13[_0x8622('0x38')]);_0x3e13a0[_0x8622('0x41')]=_[_0x8622('0x39')](_0x3e13a0[_0x8622('0x37')],_0x3e13a0[_0x8622('0x38')]);_0x180666[_0x8622('0x3a')]=_[_0x8622('0x39')](_0x3e13a0[_0x8622('0x37')],qs[_0x8622('0x3b')](_0x2f3a13[_0x8622('0x38')][_0x8622('0x3b')]));_0x180666[_0x8622('0x3a')]=_0x180666['attributes'][_0x8622('0x4e')]?_0x180666[_0x8622('0x3a')]:_0x3e13a0[_0x8622('0x37')];if(_0x2f3a13[_0x8622('0x38')][_0x8622('0x4f')]){_0x180666[_0x8622('0x50')]=[{'all':!![]}];}_0x180666=_[_0x8622('0x44')]({},_0x180666,_0x2f3a13[_0x8622('0x46')]);return db[_0x8622('0x33')][_0x8622('0x51')](_0x180666)[_0x8622('0x2b')](handleEntityNotFound(_0x1b833b,null))['then'](respondWithResult(_0x1b833b,null))[_0x8622('0x49')](handleError(_0x1b833b,null));};exports[_0x8622('0x52')]=function(_0xb61ab0,_0x28c0db){return db['ChatGroup'][_0x8622('0x52')](_0xb61ab0[_0x8622('0x53')],{})[_0x8622('0x2b')](respondWithResult(_0x28c0db,0xc9))['catch'](handleError(_0x28c0db,null));};exports[_0x8622('0x2a')]=function(_0x51d5f5,_0x3419ca){if(_0x51d5f5['body']['id']){delete _0x51d5f5[_0x8622('0x53')]['id'];}return db[_0x8622('0x33')][_0x8622('0x51')]({'where':{'id':_0x51d5f5[_0x8622('0x4b')]['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x3419ca,null))['then'](saveUpdates(_0x51d5f5['body'],null))[_0x8622('0x2b')](respondWithResult(_0x3419ca,null))[_0x8622('0x49')](handleError(_0x3419ca,null));};exports[_0x8622('0x2c')]=function(_0x5ec7f2,_0x4d5c16){return db[_0x8622('0x33')][_0x8622('0x51')]({'where':{'id':_0x5ec7f2[_0x8622('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d5c16,null))['then'](removeEntity(_0x4d5c16,null))[_0x8622('0x49')](handleError(_0x4d5c16,null));};exports[_0x8622('0x54')]=function(_0x2688ae,_0x8f1d2){return db['ChatGroup'][_0x8622('0x54')]()['then'](respondWithResult(_0x8f1d2,null))[_0x8622('0x49')](handleError(_0x8f1d2,null));};exports[_0x8622('0x55')]=function(_0x48eeed,_0x4f491e,_0x24bd21){return db[_0x8622('0x56')][_0x8622('0x24')]({'where':{'ChatGroupId':_0x48eeed[_0x8622('0x4b')]['id'],'ToId':_0x48eeed[_0x8622('0x57')]['id'],'read':![]}})[_0x8622('0x2b')](function(_0x18b362){return{'id':_['toInteger'](_0x48eeed['params']['id']),'count':_0x18b362};})[_0x8622('0x2b')](respondWithResult(_0x4f491e,null))[_0x8622('0x49')](handleError(_0x4f491e,null));};exports[_0x8622('0x58')]=function(_0x1f39fa,_0x38b719,_0x47b31a){return db[_0x8622('0x33')][_0x8622('0x51')]({'where':{'id':_0x1f39fa[_0x8622('0x4b')]['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x38b719,null))[_0x8622('0x2b')](function(_0x504a4c){if(_0x504a4c){return _0x504a4c['addMembers'](_0x1f39fa[_0x8622('0x53')][_0x8622('0x59')],_[_0x8622('0x5a')](_0x1f39fa[_0x8622('0x53')],[_0x8622('0x59'),'id'])||{});}})['then'](respondWithResult(_0x38b719,null))[_0x8622('0x49')](handleError(_0x38b719,null));};exports[_0x8622('0x5b')]=function(_0x11d0e4,_0x3b3544,_0x1290e4){var _0x5d0516={};var _0x508ae4={};var _0x1ca6c4;var _0x5c5b81;return db[_0x8622('0x33')][_0x8622('0x5c')]({'where':{'id':_0x11d0e4[_0x8622('0x4b')]['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x3b3544,null))['then'](function(_0x7b67bf){if(_0x7b67bf){_0x1ca6c4=_0x7b67bf;_0x508ae4['model']=_['keys'](db[_0x8622('0x5d')][_0x8622('0x4c')]);_0x508ae4[_0x8622('0x38')]=_['keys'](_0x11d0e4[_0x8622('0x38')]);_0x508ae4[_0x8622('0x41')]=_['intersection'](_0x508ae4[_0x8622('0x37')],_0x508ae4[_0x8622('0x38')]);_0x5d0516[_0x8622('0x3a')]=_['intersection'](_0x508ae4[_0x8622('0x37')],qs[_0x8622('0x3b')](_0x11d0e4[_0x8622('0x38')][_0x8622('0x3b')]));_0x5d0516['attributes']=_0x5d0516[_0x8622('0x3a')][_0x8622('0x4e')]?_0x5d0516[_0x8622('0x3a')]:_0x508ae4[_0x8622('0x37')];_0x5d0516[_0x8622('0x3e')]=qs['sort'](_0x11d0e4[_0x8622('0x38')][_0x8622('0x3f')]);_0x5d0516[_0x8622('0x40')]=qs[_0x8622('0x41')](_[_0x8622('0x42')](_0x11d0e4[_0x8622('0x38')],_0x508ae4[_0x8622('0x41')]));if(_0x11d0e4[_0x8622('0x38')][_0x8622('0x43')]){_0x5d0516['where']=_[_0x8622('0x44')](_0x5d0516['where'],{'$or':_['map'](_0x5d0516[_0x8622('0x3a')],function(_0x31a44d){var _0x239ae1={};_0x239ae1[_0x31a44d]={'$like':'%'+_0x11d0e4[_0x8622('0x38')]['filter']+'%'};return _0x239ae1;})});}_0x5d0516=_[_0x8622('0x44')]({},_0x5d0516,_0x11d0e4[_0x8622('0x46')]);return _0x1ca6c4[_0x8622('0x5b')](_0x5d0516);}})[_0x8622('0x2b')](function(_0x2b2dac){if(_0x2b2dac){_0x5c5b81=_0x2b2dac[_0x8622('0x4e')];if(!_0x11d0e4[_0x8622('0x38')][_0x8622('0x3c')](_0x8622('0x3d'))){_0x5d0516[_0x8622('0x23')]=qs[_0x8622('0x23')](_0x11d0e4['query']['limit']);_0x5d0516[_0x8622('0x25')]=qs[_0x8622('0x25')](_0x11d0e4['query'][_0x8622('0x25')]);}return _0x1ca6c4[_0x8622('0x5b')](_0x5d0516);}})[_0x8622('0x2b')](function(_0x48fd34){if(_0x48fd34){return _0x48fd34?{'count':_0x5c5b81,'rows':_0x48fd34}:null;}})[_0x8622('0x2b')](respondWithResult(_0x3b3544,null))[_0x8622('0x49')](handleError(_0x3b3544,null));};exports['removeMembers']=function(_0x24cb18,_0x3f065d,_0x2558c5){return db[_0x8622('0x33')][_0x8622('0x51')]({'where':{'id':_0x24cb18[_0x8622('0x4b')]['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x3f065d,null))[_0x8622('0x2b')](function(_0x2d1da0){if(_0x2d1da0){return _0x2d1da0['removeMembers'](_0x24cb18[_0x8622('0x38')]['ids']);}})[_0x8622('0x2b')](respondWithStatusCode(_0x3f065d,null))[_0x8622('0x49')](handleError(_0x3f065d,null));};exports['addMessage']=function(_0x4f9172,_0x4ea215,_0x13ef19){if(_0x4f9172[_0x8622('0x53')]['id']){delete _0x4f9172['body']['id'];}return db[_0x8622('0x33')][_0x8622('0x51')]({'where':{'id':_0x4f9172['params']['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x4ea215,null))[_0x8622('0x2b')](function(_0x1d514b){if(_0x1d514b){_0x4f9172[_0x8622('0x53')][_0x8622('0x5e')]=_0x1d514b['id'];return db[_0x8622('0x56')][_0x8622('0x52')](_0x4f9172['body']);}})['then'](respondWithResult(_0x4ea215,null))['catch'](handleError(_0x4ea215,null));};exports['getMessages']=function(_0xfbbcda,_0x505d43,_0x50ba11){var _0x195996={};var _0x21c7fb={};var _0x42014f;var _0xa95130;return db[_0x8622('0x33')][_0x8622('0x5c')]({'where':{'id':_0xfbbcda[_0x8622('0x4b')]['id']}})[_0x8622('0x2b')](handleEntityNotFound(_0x505d43,null))[_0x8622('0x2b')](function(_0x4d4f15){if(_0x4d4f15){_0x42014f=_0x4d4f15;_0x21c7fb[_0x8622('0x37')]=_[_0x8622('0x4d')](db[_0x8622('0x56')]['rawAttributes']);_0x21c7fb[_0x8622('0x38')]=_[_0x8622('0x4d')](_0xfbbcda[_0x8622('0x38')]);_0x21c7fb['filters']=_['intersection'](_0x21c7fb[_0x8622('0x37')],_0x21c7fb[_0x8622('0x38')]);_0x195996[_0x8622('0x3a')]=_['intersection'](_0x21c7fb[_0x8622('0x37')],qs[_0x8622('0x3b')](_0xfbbcda['query'][_0x8622('0x3b')]));_0x195996[_0x8622('0x3a')]=_0x195996[_0x8622('0x3a')]['length']?_0x195996[_0x8622('0x3a')]:_0x21c7fb[_0x8622('0x37')];_0x195996[_0x8622('0x3e')]=qs['sort'](_0xfbbcda[_0x8622('0x38')]['sort']);_0x195996[_0x8622('0x40')]=qs['filters'](_[_0x8622('0x42')](_0xfbbcda['query'],_0x21c7fb[_0x8622('0x41')]));if(_0xfbbcda['query'][_0x8622('0x43')]){_0x195996['where']=_[_0x8622('0x44')](_0x195996[_0x8622('0x40')],{'$or':_['map'](_0x195996[_0x8622('0x3a')],function(_0xc65ce9){var _0x5f3cca={};_0x5f3cca[_0xc65ce9]={'$like':'%'+_0xfbbcda[_0x8622('0x38')][_0x8622('0x43')]+'%'};return _0x5f3cca;})});}if(_0xfbbcda[_0x8622('0x38')][_0x8622('0x5f')]){var _0x4772a3=_0xfbbcda['query'][_0x8622('0x5f')][_0x8622('0x60')](',');var _0x2ae055={};_0x2ae055[_0x4772a3[0x0]]={'$gte':moment(_0x4772a3[0x1])[_0x8622('0x61')](_0x8622('0x62'))};_0x195996[_0x8622('0x40')]=_[_0x8622('0x44')](_0x195996[_0x8622('0x40')],_0x2ae055);}_0x195996=_[_0x8622('0x44')]({},_0x195996,_0xfbbcda['options']);return _0x42014f[_0x8622('0x63')](_0x195996);}})['then'](function(_0x39eac9){if(_0x39eac9){_0xa95130=_0x39eac9[_0x8622('0x4e')];if(!_0xfbbcda[_0x8622('0x38')][_0x8622('0x3c')](_0x8622('0x3d'))){_0x195996[_0x8622('0x23')]=qs[_0x8622('0x23')](_0xfbbcda[_0x8622('0x38')][_0x8622('0x23')]);_0x195996[_0x8622('0x25')]=qs[_0x8622('0x25')](_0xfbbcda['query'][_0x8622('0x25')]);}return _0x42014f['getMessages'](_0x195996);}})[_0x8622('0x2b')](function(_0x521be2){if(_0x521be2){return _0x521be2?{'count':_0xa95130,'rows':_0x521be2}:null;}})[_0x8622('0x2b')](respondWithResult(_0x505d43,null))[_0x8622('0x49')](handleError(_0x505d43,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index caf360c..e8214ee 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 _0x9a78=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','ChatGroup'];(function(_0x1a11aa,_0x13ad5b){var _0xf96024=function(_0x329cb3){while(--_0x329cb3){_0x1a11aa['push'](_0x1a11aa['shift']());}};_0xf96024(++_0x13ad5b);}(_0x9a78,0x1b6));var _0x89a7=function(_0x36564c,_0x39d543){_0x36564c=_0x36564c-0x0;var _0x767851=_0x9a78[_0x36564c];return _0x767851;};'use strict';var EventEmitter=require(_0x89a7('0x0'));var ChatGroup=require(_0x89a7('0x1'))['db'][_0x89a7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x89a7('0x3')](0x0);var events={'afterCreate':_0x89a7('0x4'),'afterUpdate':_0x89a7('0x5'),'afterDestroy':_0x89a7('0x6')};function emitEvent(_0x27bd96){return function(_0x1932a,_0x236c9f,_0xda9675){ChatGroupEvents[_0x89a7('0x7')](_0x27bd96+':'+_0x1932a['id'],_0x1932a);ChatGroupEvents[_0x89a7('0x7')](_0x27bd96,_0x1932a);_0xda9675(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x89a7('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5078=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x46b793,_0x16f01d){var _0x4d471a=function(_0x28f651){while(--_0x28f651){_0x46b793['push'](_0x46b793['shift']());}};_0x4d471a(++_0x16f01d);}(_0x5078,0x148));var _0x8507=function(_0x352061,_0x176667){_0x352061=_0x352061-0x0;var _0x2cae8d=_0x5078[_0x352061];return _0x2cae8d;};'use strict';var EventEmitter=require(_0x8507('0x0'));var ChatGroup=require(_0x8507('0x1'))['db'][_0x8507('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8507('0x3')](0x0);var events={'afterCreate':_0x8507('0x4'),'afterUpdate':_0x8507('0x5'),'afterDestroy':_0x8507('0x6')};function emitEvent(_0x20608d){return function(_0x1a4930,_0x239a82,_0x2aa379){ChatGroupEvents[_0x8507('0x7')](_0x20608d+':'+_0x1a4930['id'],_0x1a4930);ChatGroupEvents[_0x8507('0x7')](_0x20608d,_0x1a4930);_0x2aa379(null);};}for(var e in events){if(events[_0x8507('0x8')](e)){var event=events[e];ChatGroup[_0x8507('0x9')](e,emitEvent(event));}}module[_0x8507('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 0c646f8..e8ae3d3 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 _0x5308=['path','rimraf','../../config/environment','exports','define','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1c5201,_0x130b4b){var _0xe369ee=function(_0x103373){while(--_0x103373){_0x1c5201['push'](_0x1c5201['shift']());}};_0xe369ee(++_0x130b4b);}(_0x5308,0x8a));var _0x8530=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x5308[_0x4eafed];return _0x159c85;};'use strict';var _=require(_0x8530('0x0'));var util=require(_0x8530('0x1'));var logger=require(_0x8530('0x2'))('api');var moment=require(_0x8530('0x3'));var BPromise=require(_0x8530('0x4'));var rp=require(_0x8530('0x5'));var fs=require('fs');var path=require(_0x8530('0x6'));var rimraf=require(_0x8530('0x7'));var config=require(_0x8530('0x8'));var attributes=require('./chatGroup.attributes');module[_0x8530('0x9')]=function(_0x156948,_0x2630e2){return _0x156948[_0x8530('0xa')]('ChatGroup',attributes,{'tableName':_0x8530('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bb3=['request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12c2ed,_0x40708b){var _0xc2ee5d=function(_0x1e014a){while(--_0x1e014a){_0x12c2ed['push'](_0x12c2ed['shift']());}};_0xc2ee5d(++_0x40708b);}(_0x6bb3,0xbe));var _0x36bb=function(_0x250bfb,_0x183c55){_0x250bfb=_0x250bfb-0x0;var _0x2fa5d0=_0x6bb3[_0x250bfb];return _0x2fa5d0;};'use strict';var _=require(_0x36bb('0x0'));var util=require(_0x36bb('0x1'));var logger=require(_0x36bb('0x2'))(_0x36bb('0x3'));var moment=require(_0x36bb('0x4'));var BPromise=require(_0x36bb('0x5'));var rp=require(_0x36bb('0x6'));var fs=require('fs');var path=require(_0x36bb('0x7'));var rimraf=require(_0x36bb('0x8'));var config=require('../../config/environment');var attributes=require(_0x36bb('0x9'));module[_0x36bb('0xa')]=function(_0x49635c,_0x55167a){return _0x49635c[_0x36bb('0xb')](_0x36bb('0xc'),attributes,{'tableName':_0x36bb('0xd'),'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 eebe28d..32ac637 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 _0xfaec=['error','code','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xfaec,0x12f));var _0xcfae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfaec[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xcfae('0x0'));var util=require(_0xcfae('0x1'));var moment=require(_0xcfae('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfae('0x3'))['db'];var utils=require(_0xcfae('0x4'));var logger=require(_0xcfae('0x5'))(_0xcfae('0x6'));var config=require(_0xcfae('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcfae('0x8')]({'port':0x232a});config[_0xcfae('0x9')]=_['defaults'](config[_0xcfae('0x9')],{'host':_0xcfae('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcfae('0xb'))[_0xcfae('0xc')](socket);function respondWithRpcPromise(_0x21b991,_0x37b9f3,_0x54b749){return new BPromise(function(_0x331670,_0x383684){return client['request'](_0x21b991,_0x54b749)[_0xcfae('0xd')](function(_0xd38855){logger[_0xcfae('0xe')](_0xcfae('0xf'),_0x37b9f3,'request\x20sent');logger[_0xcfae('0x10')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x37b9f3,_0xcfae('0x11'),JSON[_0xcfae('0x12')](_0xd38855));if(_0xd38855[_0xcfae('0x13')]){if(_0xd38855['error'][_0xcfae('0x14')]===0x1f4){logger[_0xcfae('0x13')](_0xcfae('0xf'),_0x37b9f3,_0xd38855[_0xcfae('0x13')][_0xcfae('0x15')]);return _0x383684(_0xd38855['error'][_0xcfae('0x15')]);}logger[_0xcfae('0x13')](_0xcfae('0xf'),_0x37b9f3,_0xd38855[_0xcfae('0x13')]['message']);return _0x331670(_0xd38855[_0xcfae('0x13')][_0xcfae('0x15')]);}else{logger[_0xcfae('0xe')]('ChatGroup,\x20%s,\x20%s',_0x37b9f3,'request\x20sent');_0x331670(_0xd38855[_0xcfae('0x16')]['message']);}})['catch'](function(_0x35158b){logger['error'](_0xcfae('0xf'),_0x37b9f3,_0x35158b);_0x383684(_0x35158b);});});} \ No newline at end of file +var _0x6873=['info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x6873,0xac));var _0x3687=function(_0x5e2751,_0x518a55){_0x5e2751=_0x5e2751-0x0;var _0x139a39=_0x6873[_0x5e2751];return _0x139a39;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3687('0x0'));var BPromise=require(_0x3687('0x1'));var rs=require(_0x3687('0x2'));var fs=require('fs');var Redis=require(_0x3687('0x3'));var db=require(_0x3687('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3687('0x5'))('rpc');var config=require(_0x3687('0x6'));var jayson=require(_0x3687('0x7'));var client=jayson['client'][_0x3687('0x8')]({'port':0x232a});config[_0x3687('0x9')]=_[_0x3687('0xa')](config[_0x3687('0x9')],{'host':_0x3687('0xb'),'port':0x18eb});var socket=require(_0x3687('0xc'))(new Redis(config[_0x3687('0x9')]));require(_0x3687('0xd'))[_0x3687('0xe')](socket);function respondWithRpcPromise(_0x4feba8,_0x32c490,_0x9d2c00){return new BPromise(function(_0x48e991,_0x3e81c1){return client[_0x3687('0xf')](_0x4feba8,_0x9d2c00)[_0x3687('0x10')](function(_0x3decbe){logger[_0x3687('0x11')]('ChatGroup,\x20%s,\x20%s',_0x32c490,_0x3687('0x12'));logger[_0x3687('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x32c490,_0x3687('0x12'),JSON[_0x3687('0x14')](_0x3decbe));if(_0x3decbe[_0x3687('0x15')]){if(_0x3decbe[_0x3687('0x15')][_0x3687('0x16')]===0x1f4){logger[_0x3687('0x15')](_0x3687('0x17'),_0x32c490,_0x3decbe[_0x3687('0x15')][_0x3687('0x18')]);return _0x3e81c1(_0x3decbe['error'][_0x3687('0x18')]);}logger[_0x3687('0x15')](_0x3687('0x17'),_0x32c490,_0x3decbe['error']['message']);return _0x48e991(_0x3decbe[_0x3687('0x15')][_0x3687('0x18')]);}else{logger[_0x3687('0x11')](_0x3687('0x17'),_0x32c490,_0x3687('0x12'));_0x48e991(_0x3decbe[_0x3687('0x19')]['message']);}})[_0x3687('0x1a')](function(_0x149320){logger[_0x3687('0x15')](_0x3687('0x17'),_0x32c490,_0x149320);_0x3e81c1(_0x149320);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c5232d3..161b9c0 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 _0xfe17=['save','remove','update','emit','removeListener','register','length','./chatGroup.events'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xfe17,0xbf));var _0x7fe1=function(_0xb47cd8,_0x4520f7){_0xb47cd8=_0xb47cd8-0x0;var _0x63672a=_0xfe17[_0xb47cd8];return _0x63672a;};'use strict';var ChatGroupEvents=require(_0x7fe1('0x0'));var events=[_0x7fe1('0x1'),_0x7fe1('0x2'),_0x7fe1('0x3')];function createListener(_0x5f5c57,_0x4f6b05){return function(_0x169133){_0x4f6b05[_0x7fe1('0x4')](_0x5f5c57,_0x169133);};}function removeListener(_0x25edb2,_0x4060be){return function(){ChatGroupEvents[_0x7fe1('0x5')](_0x25edb2,_0x4060be);};}exports[_0x7fe1('0x6')]=function(_0x6ed96b){for(var _0x3a8bf2=0x0,_0x3dd0e1=events[_0x7fe1('0x7')];_0x3a8bf2<_0x3dd0e1;_0x3a8bf2++){var _0x4ce9f4=events[_0x3a8bf2];var _0x1de308=createListener('chatGroup:'+_0x4ce9f4,_0x6ed96b);ChatGroupEvents['on'](_0x4ce9f4,_0x1de308);}}; \ No newline at end of file +var _0xc550=['./chatGroup.events','save','emit','removeListener','register','chatGroup:'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0xc550,0xfc));var _0x0c55=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0xc550[_0x3c2666];return _0x10c814;};'use strict';var ChatGroupEvents=require(_0x0c55('0x0'));var events=[_0x0c55('0x1'),'remove','update'];function createListener(_0x110367,_0x16cedc){return function(_0x5225b2){_0x16cedc[_0x0c55('0x2')](_0x110367,_0x5225b2);};}function removeListener(_0x3122b9,_0x4d9866){return function(){ChatGroupEvents[_0x0c55('0x3')](_0x3122b9,_0x4d9866);};}exports[_0x0c55('0x4')]=function(_0x18548b){for(var _0x5ecb3c=0x0,_0x3d9a6b=events['length'];_0x5ecb3c<_0x3d9a6b;_0x5ecb3c++){var _0x10c449=events[_0x5ecb3c];var _0x159f0f=createListener(_0x0c55('0x5')+_0x10c449,_0x18548b);ChatGroupEvents['on'](_0x10c449,_0x159f0f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6e4b09f..3c937a3 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 _0x577d=['post','create','addMessage','update','delete','destroy','removeMembers','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages'];(function(_0xb43c5e,_0x59d9fc){var _0xed2ad1=function(_0x3360a8){while(--_0x3360a8){_0xb43c5e['push'](_0xb43c5e['shift']());}};_0xed2ad1(++_0x59d9fc);}(_0x577d,0x1b0));var _0xd577=function(_0x326c9a,_0x1180e8){_0x326c9a=_0x326c9a-0x0;var _0x2dc1c3=_0x577d[_0x326c9a];return _0x2dc1c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd577('0x0'));var timeout=require('connect-timeout');var express=require(_0xd577('0x1'));var router=express[_0xd577('0x2')]();var fs_extra=require(_0xd577('0x3'));var auth=require(_0xd577('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd577('0x5'));var controller=require(_0xd577('0x6'));router[_0xd577('0x7')]('/',auth[_0xd577('0x8')](),controller[_0xd577('0x9')]);router[_0xd577('0x7')]('/describe',auth[_0xd577('0x8')](),controller['describe']);router['get'](_0xd577('0xa'),auth[_0xd577('0x8')](),controller[_0xd577('0xb')]);router[_0xd577('0x7')](_0xd577('0xc'),auth[_0xd577('0x8')](),controller[_0xd577('0xd')]);router[_0xd577('0x7')](_0xd577('0xe'),auth[_0xd577('0x8')](),controller[_0xd577('0xf')]);router[_0xd577('0x7')](_0xd577('0x10'),auth[_0xd577('0x8')](),controller[_0xd577('0x11')]);router[_0xd577('0x12')]('/',auth[_0xd577('0x8')](),controller[_0xd577('0x13')]);router[_0xd577('0x12')](_0xd577('0xe'),auth[_0xd577('0x8')](),controller['addMembers']);router[_0xd577('0x12')](_0xd577('0x10'),auth[_0xd577('0x8')](),controller[_0xd577('0x14')]);router['put']('/:id',auth[_0xd577('0x8')](),controller[_0xd577('0x15')]);router[_0xd577('0x16')](_0xd577('0xa'),auth[_0xd577('0x8')](),controller[_0xd577('0x17')]);router[_0xd577('0x16')]('/:id/members',auth[_0xd577('0x8')](),controller[_0xd577('0x18')]);module['exports']=router; \ No newline at end of file +var _0xe2f1=['/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','put','update','/:id','destroy','delete','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','show','/:id/unread','getUnread'];(function(_0x208711,_0x344b5d){var _0x2f5c95=function(_0x339454){while(--_0x339454){_0x208711['push'](_0x208711['shift']());}};_0x2f5c95(++_0x344b5d);}(_0xe2f1,0x183));var _0x1e2f=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xe2f1[_0x5a26f5];return _0x2e9ef7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1e2f('0x0'));var timeout=require(_0x1e2f('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1e2f('0x2'));var auth=require(_0x1e2f('0x3'));var interaction=require(_0x1e2f('0x4'));var config=require(_0x1e2f('0x5'));var controller=require(_0x1e2f('0x6'));router[_0x1e2f('0x7')]('/',auth[_0x1e2f('0x8')](),controller['index']);router['get'](_0x1e2f('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x1e2f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1e2f('0xa')]);router['get'](_0x1e2f('0xb'),auth[_0x1e2f('0x8')](),controller[_0x1e2f('0xc')]);router[_0x1e2f('0x7')](_0x1e2f('0xd'),auth[_0x1e2f('0x8')](),controller[_0x1e2f('0xe')]);router[_0x1e2f('0x7')](_0x1e2f('0xf'),auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x10')]);router[_0x1e2f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x1e2f('0xd'),auth[_0x1e2f('0x8')](),controller['addMembers']);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x1e2f('0x12')]);router[_0x1e2f('0x13')]('/:id',auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x14')]);router['delete'](_0x1e2f('0x15'),auth[_0x1e2f('0x8')](),controller[_0x1e2f('0x16')]);router[_0x1e2f('0x17')](_0x1e2f('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x1e2f('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index be30276..c3f200d 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 _0x7033=['star','thumb','TEXT','STRING','DATE','long','ENUM','sequelize','exports','BOOLEAN','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7033,0x19e));var _0x3703=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x7033[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'closed':{'type':Sequelize[_0x3703('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3703('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x3703('0x4'),_0x3703('0x5')),'defaultValue':_0x3703('0x4')},'ratingMessage':{'type':Sequelize[_0x3703('0x6')]},'pathTranscript':{'type':Sequelize[_0x3703('0x6')]},'mailTranscript':{'type':Sequelize[_0x3703('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3703('0x8')]},'disposition':{'type':Sequelize[_0x3703('0x7')]},'secondDisposition':{'type':Sequelize[_0x3703('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3703('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x3703('0x7')]},'osVersion':{'type':Sequelize[_0x3703('0x7')]},'deviceModel':{'type':Sequelize[_0x3703('0x7')]},'deviceVendor':{'type':Sequelize[_0x3703('0x7')]},'deviceType':{'type':Sequelize[_0x3703('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3703('0x7')]},'formData':{'type':Sequelize[_0x3703('0x6')](_0x3703('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3703('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3703('0x7')]},'customerPort':{'type':Sequelize[_0x3703('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3703('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3703('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1752=['TEXT','STRING','DATE','exports','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x170ca3,_0x8bd32d){var _0x11c4bf=function(_0x48f647){while(--_0x48f647){_0x170ca3['push'](_0x170ca3['shift']());}};_0x11c4bf(++_0x8bd32d);}(_0x1752,0xa5));var _0x2175=function(_0x577a0d,_0x394368){_0x577a0d=_0x577a0d-0x0;var _0x3ce9ee=_0x1752[_0x577a0d];return _0x3ce9ee;};'use strict';var Sequelize=require('sequelize');module[_0x2175('0x0')]={'closed':{'type':Sequelize[_0x2175('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2175('0x2')]},'ratingType':{'type':Sequelize[_0x2175('0x3')](_0x2175('0x4'),_0x2175('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x2175('0x6')]},'pathTranscript':{'type':Sequelize[_0x2175('0x6')]},'mailTranscript':{'type':Sequelize[_0x2175('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2175('0x8')]},'disposition':{'type':Sequelize[_0x2175('0x7')]},'secondDisposition':{'type':Sequelize[_0x2175('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2175('0x7')]},'note':{'type':Sequelize[_0x2175('0x7')]},'browserName':{'type':Sequelize[_0x2175('0x7')]},'browserVersion':{'type':Sequelize[_0x2175('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2175('0x7')]},'deviceModel':{'type':Sequelize[_0x2175('0x7')]},'deviceVendor':{'type':Sequelize[_0x2175('0x7')]},'deviceType':{'type':Sequelize[_0x2175('0x7')]},'referer':{'type':Sequelize[_0x2175('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x2175('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2175('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x2175('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ded4087..a24467e 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 _0x32d4=['findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','vidaooMetadata','parse','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','filters','hasOwnProperty','nolimit','sort','where','filter','$gte','count','includeAll','rows','getMyMessages','order','pick','ChatInteractionId','push','addTags','setTags','omit','spread','findAll','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','toString','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','lastName','value','views','downloadInteraction.ejs','transcript-','err','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','destroy','then','name','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','getOptions','chat','query','user','show','params','model','keys','intersection','attributes','fields','length','include','options','find','create','body','describe','createVidaooSession'];(function(_0x49a18a,_0x2f1f40){var _0x54d278=function(_0x32d7cf){while(--_0x32d7cf){_0x49a18a['push'](_0x49a18a['shift']());}};_0x54d278(++_0x2f1f40);}(_0x32d4,0x82));var _0x432d=function(_0xd08b7,_0xa23b89){_0xd08b7=_0xd08b7-0x0;var _0x10310b=_0x32d4[_0xd08b7];return _0x10310b;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x432d('0x0'));var rp=require('request-promise');var moment=require(_0x432d('0x1'));var BPromise=require(_0x432d('0x2'));var Mustache=require(_0x432d('0x3'));var util=require(_0x432d('0x4'));var path=require(_0x432d('0x5'));var ejs=require(_0x432d('0x6'));var fs=require('fs');var _=require(_0x432d('0x7'));var Redis=require('ioredis');var interaction=require(_0x432d('0x8'));var qs=require(_0x432d('0x9'));var pdf=require(_0x432d('0xa'));var logger=require('../../config/logger')(_0x432d('0xb'));var config=require(_0x432d('0xc'));var db=require(_0x432d('0xd'))['db'];config[_0x432d('0xe')]=_[_0x432d('0xf')](config[_0x432d('0xe')],{'host':_0x432d('0x10'),'port':0x18eb});var socket=require(_0x432d('0x11'))(new Redis(config[_0x432d('0xe')]));require('./chatInteraction.socket')[_0x432d('0x12')](socket);var jayson=require(_0x432d('0x13'));var client=jayson[_0x432d('0x14')]['http']({'port':0x232b});var client9004=jayson['client'][_0x432d('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x5f0c43,_0x4b050b,_0x3d899c,_0x2be426){return new BPromise(function(_0x1d51c0,_0xd0324b){var _0xe863be=_0x2be426||client;return _0xe863be[_0x432d('0x16')](_0x5f0c43,_0x3d899c)['then'](function(_0x4d2b72){logger[_0x432d('0x17')](_0x432d('0x18'),_0x4b050b,'request\x20sent');logger[_0x432d('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4b050b,'request\x20sent',JSON[_0x432d('0x1a')](_0x4d2b72));if(_0x4d2b72[_0x432d('0x1b')]){if(_0x4d2b72[_0x432d('0x1b')]['code']===0x1f4){logger[_0x432d('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4b050b,_0x4d2b72[_0x432d('0x1b')][_0x432d('0x1c')]);return _0xd0324b(_0x4d2b72['error'][_0x432d('0x1c')]);}logger[_0x432d('0x1b')](_0x432d('0x18'),_0x4b050b,_0x4d2b72[_0x432d('0x1b')][_0x432d('0x1c')]);return _0x1d51c0(_0x4d2b72['error']['message']);}else{logger[_0x432d('0x17')](_0x432d('0x18'),_0x4b050b,_0x432d('0x1d'));_0x1d51c0(_0x4d2b72[_0x432d('0x1e')][_0x432d('0x1c')]);}})[_0x432d('0x1f')](function(_0x2218ff){logger[_0x432d('0x1b')](_0x432d('0x18'),_0x4b050b,_0x2218ff);_0xd0324b(_0x2218ff);});});}function respondWithStatusCode(_0x1c317d,_0x59a68c){_0x59a68c=_0x59a68c||0xcc;return function(_0x2d2a9b){if(_0x2d2a9b){return _0x1c317d[_0x432d('0x20')](_0x59a68c);}return _0x1c317d[_0x432d('0x21')](_0x59a68c)[_0x432d('0x22')]();};}function respondWithResult(_0x1e9247,_0xa76f36){_0xa76f36=_0xa76f36||0xc8;return function(_0x115505){if(_0x115505){return _0x1e9247[_0x432d('0x21')](_0xa76f36)[_0x432d('0x23')](_0x115505);}};}function respondWithFilteredResult(_0x31c619,_0xd5049f){return function(_0x38224a){if(_0x38224a){var _0x45709a=typeof _0xd5049f[_0x432d('0x24')]===_0x432d('0x25')&&typeof _0xd5049f[_0x432d('0x26')]===_0x432d('0x25');var _0x504738=_0x38224a['count'];var _0x3cefaf=_0x45709a?0x0:_0xd5049f['offset'];var _0x5053cb=_0x45709a?_0x38224a['count']:_0xd5049f[_0x432d('0x24')]+_0xd5049f[_0x432d('0x26')];var _0x431d5b;if(_0x5053cb>=_0x504738){_0x5053cb=_0x504738;_0x431d5b=0xc8;}else{_0x431d5b=0xce;}_0x31c619[_0x432d('0x21')](_0x431d5b);return _0x31c619['set'](_0x432d('0x27'),_0x3cefaf+'-'+_0x5053cb+'/'+_0x504738)[_0x432d('0x23')](_0x38224a);}return null;};}function saveUpdates(_0x47accb){return function(_0x4f6117){if(_0x4f6117){return _0x4f6117[_0x432d('0x28')](_0x47accb)['then'](function(_0xb0d98){return _0xb0d98;});}return null;};}function removeEntity(_0x10d9a1){return function(_0x7dc9ef){if(_0x7dc9ef){return _0x7dc9ef[_0x432d('0x29')]()[_0x432d('0x2a')](function(){_0x10d9a1[_0x432d('0x21')](0xcc)[_0x432d('0x22')]();});}};}function handleEntityNotFound(_0x13bc73){return function(_0x46ad86){if(!_0x46ad86){_0x13bc73['sendStatus'](0x194);}return _0x46ad86;};}function handleError(_0x1b783f,_0x442e43){_0x442e43=_0x442e43||0x1f4;return function(_0x6dc3c3){logger[_0x432d('0x1b')](_0x6dc3c3['stack']);if(_0x6dc3c3[_0x432d('0x2b')]){delete _0x6dc3c3['name'];}_0x1b783f[_0x432d('0x21')](_0x442e43)['send'](_0x6dc3c3);};}function getMustacheRender(_0x1bf603,_0x21e97c){return Mustache[_0x432d('0x2c')](_0x1bf603,_[_0x432d('0x2d')](_0x21e97c['body'],{'contact':_0x21e97c[_0x432d('0x2e')],'message':_0x21e97c[_0x432d('0x1c')],'agent':_0x21e97c[_0x432d('0x2f')],'interaction':_0x21e97c[_0x432d('0x30')],'account':_0x21e97c[_0x432d('0x31')]}))||'';}exports[_0x432d('0x32')]=function(_0x45c73c,_0x368deb){var _0x5ed556={};var _0x5322be=_[_0x432d('0x33')](db[_0x432d('0x34')][_0x432d('0x35')],function(_0x3f7581){return{'name':_0x3f7581[_0x432d('0x36')],'type':_0x3f7581['type']['key']};});_0x5ed556=qs[_0x432d('0x37')](_0x5322be,_0x45c73c);return interaction['findAll'](_0x432d('0x38'),_0x45c73c[_0x432d('0x39')],_0x45c73c[_0x432d('0x3a')],_0x5ed556,_0x5322be)[_0x432d('0x2a')](respondWithFilteredResult(_0x368deb,_0x5ed556))[_0x432d('0x1f')](handleError(_0x368deb,null));};exports[_0x432d('0x3b')]=function(_0x32f5de,_0x41e7dd){var _0x4427b9={'raw':![],'where':{'id':_0x32f5de[_0x432d('0x3c')]['id']}},_0x4a0606={};_0x4a0606[_0x432d('0x3d')]=_[_0x432d('0x3e')](db[_0x432d('0x34')][_0x432d('0x35')]);_0x4a0606[_0x432d('0x39')]=_[_0x432d('0x3e')](_0x32f5de[_0x432d('0x39')]);_0x4a0606['filters']=_[_0x432d('0x3f')](_0x4a0606['model'],_0x4a0606[_0x432d('0x39')]);_0x4427b9[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x4a0606['model'],qs[_0x432d('0x41')](_0x32f5de[_0x432d('0x39')][_0x432d('0x41')]));_0x4427b9[_0x432d('0x40')]=_0x4427b9[_0x432d('0x40')][_0x432d('0x42')]?_0x4427b9[_0x432d('0x40')]:_0x4a0606[_0x432d('0x3d')];if(_0x32f5de[_0x432d('0x39')]['includeAll']){_0x4427b9[_0x432d('0x43')]=[{'all':!![]}];}_0x4427b9=_['merge']({},_0x4427b9,_0x32f5de[_0x432d('0x44')]);return db['ChatInteraction'][_0x432d('0x45')](_0x4427b9)[_0x432d('0x2a')](handleEntityNotFound(_0x41e7dd,null))[_0x432d('0x2a')](respondWithResult(_0x41e7dd,null))[_0x432d('0x1f')](handleError(_0x41e7dd,null));};exports[_0x432d('0x46')]=function(_0x5ba360,_0x12534a){return db['ChatInteraction']['create'](_0x5ba360[_0x432d('0x47')],{})[_0x432d('0x2a')](respondWithResult(_0x12534a,0xc9))[_0x432d('0x1f')](handleError(_0x12534a,null));};exports[_0x432d('0x28')]=function(_0x415234,_0x450ec0){if(_0x415234[_0x432d('0x47')]['id']){delete _0x415234[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x415234[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x450ec0,null))[_0x432d('0x2a')](saveUpdates(_0x415234[_0x432d('0x47')],null))[_0x432d('0x2a')](respondWithResult(_0x450ec0,null))[_0x432d('0x1f')](handleError(_0x450ec0,null));};exports[_0x432d('0x29')]=function(_0x5ccde7,_0x70460c){return db['ChatInteraction'][_0x432d('0x45')]({'where':{'id':_0x5ccde7['params']['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x70460c,null))[_0x432d('0x2a')](removeEntity(_0x70460c,null))[_0x432d('0x1f')](handleError(_0x70460c,null));};exports[_0x432d('0x48')]=function(_0x167151,_0x4615f5){return db[_0x432d('0x34')]['describe']()[_0x432d('0x2a')](respondWithResult(_0x4615f5,null))[_0x432d('0x1f')](handleError(_0x4615f5,null));};exports[_0x432d('0x49')]=function(_0x4d56ce,_0x2911e2){var _0xa2e045=_0x4d56ce['params']['id'];var _0x260e44;var _0xbd9b11;var _0x3ed02d;return db[_0x432d('0x34')][_0x432d('0x4a')]({'where':{'id':_0xa2e045}})[_0x432d('0x2a')](function(_0xc58515){_0x260e44=_0xc58515;return db[_0x432d('0x4b')][_0x432d('0x4a')]({'where':{'id':_0xc58515[_0x432d('0x4c')]},'attributes':['id','vidaooApiKey',_0x432d('0x4d'),_0x432d('0x4e'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0x432d('0x2a')](function(_0x2d98db){if(_0x2d98db&&_0x2d98db[_0x432d('0x4f')]&&_0x2d98db[_0x432d('0x4d')]){_0xbd9b11=_0x2d98db;var _0x1da43d={'interaction':{'id':_0xa2e045},'agent':{'id':_0x4d56ce[_0x432d('0x3a')]['id'],'name':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x2b')],'fullname':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x50')],'email':_0x4d56ce[_0x432d('0x3a')][_0x432d('0x51')]},'contact':_0x4d56ce[_0x432d('0x47')][_0x432d('0x2e')],'account':_0x4d56ce[_0x432d('0x47')][_0x432d('0x31')]};var _0x36e562={'rejectUnauthorized':![],'method':_0x432d('0x52'),'url':_0x432d('0x53'),'headers':{'X-APIKEY':_0x2d98db[_0x432d('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d56ce['user'][_0x432d('0x51')]],'buttons':null,'topic':_0xbd9b11[_0x432d('0x4e')],'note':_['isNull'](_0xbd9b11[_0x432d('0x54')])?null:getMustacheRender(_0xbd9b11[_0x432d('0x54')],_0x1da43d),'metadata':null},'redirect':_0x432d('0x55'),'json':!![]};try{if(!_[_0x432d('0x56')](_0xbd9b11['vidaooMetadata'])){var _0x2d5345=getMustacheRender(_0xbd9b11[_0x432d('0x57')],_0x1da43d);var _0x4e812e=JSON[_0x432d('0x58')](_0x2d5345);_0x36e562[_0x432d('0x47')]['metadata']=_0x4e812e;}}catch(_0x2cfce2){throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x36e562);}else{throw new db['Sequelize'][(_0x432d('0x5a'))](_0x432d('0x5b'));}})[_0x432d('0x2a')](function(_0x3b7925){_0x3ed02d=_0x3b7925;if(_0x3ed02d['id']){var _0x4682a2={'body':_0x3ed02d[_0x432d('0x5c')],'ChatWebsiteId':_0xbd9b11['id'],'ChatInteractionId':_0x260e44['id'],'direction':_0x432d('0x5d'),'UserId':_0x4d56ce[_0x432d('0x3a')]['id']};return db[_0x432d('0x5e')][_0x432d('0x46')](_0x4682a2,{});}else{throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x432d('0x2a')](function(){return _0x260e44['updateAttributes']({'vidaooSessionId':_0x3ed02d['id']});})[_0x432d('0x2a')](respondWithResult(_0x2911e2,null))['catch'](handleError(_0x2911e2,null));};exports[_0x432d('0x5f')]=function(_0x4609d8,_0x3ba2fe){if(_0x4609d8[_0x432d('0x47')]['id']){delete _0x4609d8[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x4609d8[_0x432d('0x3c')]['id']},'include':[{'model':db[_0x432d('0x60')],'as':_0x432d('0x61')}]})[_0x432d('0x2a')](handleEntityNotFound(_0x3ba2fe,null))[_0x432d('0x2a')](saveUpdates(_0x4609d8[_0x432d('0x47')],null))[_0x432d('0x2a')](respondWithResult(_0x3ba2fe,null))[_0x432d('0x1f')](handleError(_0x3ba2fe,null));};exports[_0x432d('0x62')]=function(_0x239f77,_0x493dbe){if(_0x239f77[_0x432d('0x47')]['id']){delete _0x239f77[_0x432d('0x47')]['id'];}return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x239f77[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](function(_0x286dc7){if(!_0x286dc7){logger[_0x432d('0x1b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x432d('0x62'),0x194,'entity\x20not\x20found');_0x493dbe['sendStatus'](0x194);}else{if(_0x286dc7[_0x432d('0x63')]){throw new db[(_0x432d('0x59'))][(_0x432d('0x5a'))](_0x432d('0x64'));}}return _0x286dc7;})[_0x432d('0x2a')](function(_0x1f440a){if(_0x1f440a){return _0x1f440a[_0x432d('0x28')]({'closed':_0x239f77[_0x432d('0x47')][_0x432d('0x65')],'disposition':_0x239f77['body']['disposition']})['then'](function(_0x5aa60c){return _0x5aa60c;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x432d('0x62'),_0x239f77[_0x432d('0x47')],client9004);})['then'](respondWithResult(_0x493dbe,null))[_0x432d('0x1f')](handleError(_0x493dbe,null));};exports[_0x432d('0x66')]=function(_0x3dd194,_0x3ef0cf){_0x3dd194[_0x432d('0x47')]['name']=_0x3dd194[_0x432d('0x67')][_0x432d('0x68')];_0x3dd194[_0x432d('0x47')][_0x432d('0x69')]=_0x3dd194[_0x432d('0x67')]['filename'];_0x3dd194['body']['type']=_0x3dd194[_0x432d('0x67')][_0x432d('0x6a')];return db[_0x432d('0x6b')]['create'](_0x3dd194[_0x432d('0x47')])[_0x432d('0x2a')](respondWithResult(_0x3ef0cf,0xc9))[_0x432d('0x1f')](handleError(_0x3ef0cf,null));};exports[_0x432d('0x6c')]=function(_0x197ec6,_0x56cae2){return db['ChatInteraction'][_0x432d('0x4a')]({'where':{'id':_0x197ec6[_0x432d('0x3c')]['id']},'raw':!![]})[_0x432d('0x2a')](handleEntityNotFound(_0x56cae2,null))[_0x432d('0x2a')](function(_0x2ad1a6){if(_0x2ad1a6){if(_0x2ad1a6[_0x432d('0x65')]){return _0x56cae2['status'](0x193)[_0x432d('0x23')]({'status':0x193,'message':_0x432d('0x6d')});}return db[_0x432d('0x6b')][_0x432d('0x4a')]({'where':{'id':_0x197ec6[_0x432d('0x39')]['attachId']},'raw':!![]})[_0x432d('0x2a')](handleEntityNotFound(_0x56cae2,null));}})[_0x432d('0x2a')](function(_0x5c4609){if(_0x5c4609){var _0x471233=_0x5c4609[_0x432d('0x6e')]!==null;var _0x46f51d=path[_0x432d('0x6f')](config[_0x432d('0x70')],_0x432d('0x71'));if(_0x471233){_0x46f51d=path[_0x432d('0x6f')](_0x46f51d,_0x432d('0x72'));}var _0x3a8e49=path[_0x432d('0x6f')](_0x46f51d,_0x5c4609[_0x432d('0x69')]);return _0x56cae2[_0x432d('0x73')](_0x3a8e49);}})[_0x432d('0x1f')](handleError(_0x56cae2,null));};exports[_0x432d('0x74')]=function(_0x40bd86,_0x8ad1c){var _0x274efd=null;var _0x6b2994=null;var _0x555024=null;if(_0x40bd86['body']['id']){delete _0x40bd86[_0x432d('0x47')]['id'];}if(_0x40bd86[_0x432d('0x47')][_0x432d('0x75')]){_0x555024=path[_0x432d('0x6f')](config['root'],'server/files/chat/upload/',util[_0x432d('0x76')](_0x432d('0x77'),Date[_0x432d('0x78')]()));_0x40bd86[_0x432d('0x47')][_0x432d('0x79')]=_0x555024;}return db[_0x432d('0x34')]['find']({'where':{'id':_0x40bd86[_0x432d('0x3c')]['id']},'include':[{'model':db[_0x432d('0x5e')],'as':_0x432d('0x7a'),'include':[{'model':db[_0x432d('0x7b')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x8ad1c,null))[_0x432d('0x2a')](saveUpdates(_0x40bd86[_0x432d('0x47')],null))['then'](function(_0x495489){if(_0x495489){_0x274efd=_0x495489;return db[_0x432d('0x4b')][_0x432d('0x45')]({'where':{'id':_0x274efd['ChatWebsiteId']}});}})[_0x432d('0x2a')](function(_0x2002bd){if(_0x2002bd){_0x6b2994=_0x2002bd;return db[_0x432d('0x60')][_0x432d('0x45')]({'where':{'id':_0x274efd[_0x432d('0x7c')]}});}})['then'](function(_0xbb7227){if(_0xbb7227){if(_0x555024){var _0xae2d39=null;for(var _0x2fe0a0=0x1;_0x2fe0a0<_0x274efd[_0x432d('0x7a')]['length'];++_0x2fe0a0){_0xae2d39=_0x274efd['Messages'][_0x2fe0a0];var _0x419778=_0xae2d39[_0x432d('0x63')]?util[_0x432d('0x76')](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):_0x432d('0x7f');var _0xaa18ff=_0x40bd86[_0x432d('0x47')][_0x432d('0x80')]||util[_0x432d('0x76')](_0x432d('0x7d'),'Visitor',_0xae2d39[_0x432d('0x7c')]);switch(_0x6b2994['agentIdentifier']){case _0x432d('0x81'):_0x419778=_0xae2d39['UserId']?util['format'](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):_0x432d('0x7f');break;case _0x432d('0x82'):_0x419778=_0xae2d39[_0x432d('0x63')]?_0xae2d39[_0x432d('0x7b')][_0x432d('0x83')]||_0xae2d39[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f');break;case'agent_fullname':_0x419778=_0xae2d39[_0x432d('0x63')]?_0xae2d39[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f');break;default:_0x419778=_0xae2d39[_0x432d('0x63')]?util['format'](_0x432d('0x7d'),_0x6b2994[_0x432d('0x7e')],_0xae2d39[_0x432d('0x63')]):'System';}var _0x7ab2f4=util[_0x432d('0x76')](_0x432d('0x84'),moment(_0xae2d39[_0x432d('0x85')])[_0x432d('0x76')](_0x432d('0x86')),_0xae2d39[_0x432d('0x87')]==='in'?_0xaa18ff:_0x419778,_0xae2d39[_0x432d('0x47')]);if(!_0xae2d39[_0x432d('0x88')]){fs[_0x432d('0x89')](_0x555024,_0x7ab2f4);}}return db[_0x432d('0x8a')][_0x432d('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x432d('0x8b')],'as':_0x432d('0x8c'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x432d('0x2a')](function(_0x46a336){if(!_0x46a336||!_0x46a336['Smtp']||!_0x40bd86['body'])return _0x274efd;var _0x365946=_0x46a336[_0x432d('0x8d')]();return respondWithRpcPromise(_0x432d('0x8e'),_0x432d('0x8f'),{'account':_0x365946,'message':{'from':util[_0x432d('0x76')](_0x432d('0x90'),_0x46a336[_0x432d('0x2b')],_0x46a336[_0x432d('0x51')]||_0x46a336[_0x432d('0x8c')]['user']),'to':_0x40bd86['body'][_0x432d('0x75')],'subject':_0x432d('0x91'),'text':util[_0x432d('0x76')](_0x432d('0x92'),_0x40bd86[_0x432d('0x47')][_0x432d('0x75')]),'attachments':[{'path':_0x555024}]}})[_0x432d('0x2a')](function(){return _0x274efd;})[_0x432d('0x1f')](function(_0xfaecb6){logger[_0x432d('0x1b')](_0xfaecb6);});})['then'](respondWithStatusCode(_0x8ad1c,0xc8))['catch'](handleError(_0x8ad1c,null));};exports[_0x432d('0x93')]=function(_0x22acf0,_0x41dbee){return db[_0x432d('0x5e')][_0x432d('0x45')]({'where':{'id':_0x22acf0[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x41dbee,null))[_0x432d('0x2a')](function(_0x5ea083){if(_0x5ea083){return _0x5ea083[_0x432d('0x93')](_0x22acf0[_0x432d('0x47')][_0x432d('0x94')],_['omit'](_0x22acf0[_0x432d('0x47')],[_0x432d('0x94'),'id'])||{});}})[_0x432d('0x2a')](respondWithResult(_0x41dbee,null))['catch'](handleError(_0x41dbee,null));};exports[_0x432d('0x95')]=function(_0x43d40d,_0x36c674){var _0x21808a={'raw':![],'where':{}};var _0xead355={};var _0xf29485={'count':0x0,'rows':[]};return db[_0x432d('0x34')][_0x432d('0x4a')]({'where':{'id':_0x43d40d[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x36c674,null))['then'](function(_0x33cf6a){if(_0x33cf6a){_0xead355['model']=_[_0x432d('0x3e')](db[_0x432d('0x5e')][_0x432d('0x35')]);_0xead355['query']=_[_0x432d('0x3e')](_0x43d40d[_0x432d('0x39')]);_0xead355[_0x432d('0x96')]=_[_0x432d('0x3f')](_0xead355[_0x432d('0x3d')],_0xead355['query']);_0x21808a[_0x432d('0x40')]=_[_0x432d('0x3f')](_0xead355['model'],qs[_0x432d('0x41')](_0x43d40d[_0x432d('0x39')][_0x432d('0x41')]));_0x21808a[_0x432d('0x40')]=_0x21808a[_0x432d('0x40')][_0x432d('0x42')]?_0x21808a[_0x432d('0x40')]:_0xead355[_0x432d('0x3d')];if(!_0x43d40d[_0x432d('0x39')][_0x432d('0x97')](_0x432d('0x98'))){_0x21808a['limit']=qs[_0x432d('0x26')](_0x43d40d['query'][_0x432d('0x26')]);_0x21808a[_0x432d('0x24')]=qs[_0x432d('0x24')](_0x43d40d[_0x432d('0x39')]['offset']);}_0x21808a['order']=qs[_0x432d('0x99')](_0x43d40d[_0x432d('0x39')][_0x432d('0x99')]);_0x21808a[_0x432d('0x9a')]=qs['filters'](_['pick'](_0x43d40d['query'],_0xead355['filters']));_0x21808a[_0x432d('0x9a')]['ChatInteractionId']=_0x33cf6a['id'];if(_0x43d40d['query'][_0x432d('0x9b')]){_0x21808a['where']=_['merge'](_0x21808a[_0x432d('0x9a')],{'$or':_[_0x432d('0x33')](_0x21808a[_0x432d('0x40')],function(_0x48f337){var _0x3d8b6a={};_0x3d8b6a[_0x48f337]={'$like':'%'+_0x43d40d[_0x432d('0x39')][_0x432d('0x9b')]+'%'};return _0x3d8b6a;})});}if(_0x43d40d['query'][_0x432d('0x9c')]){var _0x29563c=_0x43d40d[_0x432d('0x39')]['$gte']['split'](',');var _0x56314f={};_0x56314f[_0x29563c[0x0]]={'$gte':moment(_0x29563c[0x1])[_0x432d('0x76')]('YYYY-MM-DD\x20HH:mm:ss')};_0x21808a[_0x432d('0x9a')]=_['merge'](_0x21808a[_0x432d('0x9a')],_0x56314f);}_0x21808a=_[_0x432d('0x2d')]({},_0x21808a,_0x43d40d['options']);return db['ChatMessage'][_0x432d('0x9d')]({'where':_0x21808a[_0x432d('0x9a')]})[_0x432d('0x2a')](function(_0x2218e5){_0xf29485[_0x432d('0x9d')]=_0x2218e5;if(_0x43d40d[_0x432d('0x39')][_0x432d('0x9e')]){_0x21808a[_0x432d('0x43')]=[{'all':!![]}];}return db[_0x432d('0x5e')]['findAll'](_0x21808a);})[_0x432d('0x2a')](function(_0x4603ca){_0xf29485[_0x432d('0x9f')]=_0x4603ca;return _0xf29485;});}})['then'](respondWithFilteredResult(_0x36c674,_0x21808a))[_0x432d('0x1f')](handleError(_0x36c674,null));};exports[_0x432d('0xa0')]=function(_0x3b631e,_0x1574b2){var _0x9681bd={'where':{}},_0x26e129={},_0xc62975={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x432d('0x4a')]({'where':{'id':_0x3b631e[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x1574b2,null))[_0x432d('0x2a')](function(_0x1f48c9){if(_0x1f48c9){_0x26e129['model']=_[_0x432d('0x3e')](db[_0x432d('0x5e')]['rawAttributes']);_0x26e129[_0x432d('0x39')]=_[_0x432d('0x3e')](_0x3b631e[_0x432d('0x39')]);_0x26e129['filters']=_[_0x432d('0x3f')](_0x26e129['model'],_0x26e129[_0x432d('0x39')]);_0x9681bd[_0x432d('0x40')]=_[_0x432d('0x3f')](_0x26e129['model'],qs[_0x432d('0x41')](_0x3b631e[_0x432d('0x39')][_0x432d('0x41')]));_0x9681bd[_0x432d('0x40')]=_0x9681bd[_0x432d('0x40')][_0x432d('0x42')]?_0x9681bd[_0x432d('0x40')]:_0x26e129[_0x432d('0x3d')];if(!_0x3b631e['query'][_0x432d('0x97')](_0x432d('0x98'))){_0x9681bd[_0x432d('0x26')]=qs[_0x432d('0x26')](_0x3b631e[_0x432d('0x39')][_0x432d('0x26')]);_0x9681bd[_0x432d('0x24')]=qs['offset'](_0x3b631e[_0x432d('0x39')][_0x432d('0x24')]);}_0x9681bd[_0x432d('0xa1')]=qs[_0x432d('0x99')](_0x3b631e[_0x432d('0x39')]['sort']);_0x9681bd[_0x432d('0x9a')]=qs['filters'](_[_0x432d('0xa2')](_0x3b631e[_0x432d('0x39')],_0x26e129[_0x432d('0x96')]));_0x9681bd[_0x432d('0x9a')][_0x432d('0xa3')]=_0x1f48c9['id'];if(_0x3b631e[_0x432d('0x39')]['filter']){_0x9681bd[_0x432d('0x9a')]=_[_0x432d('0x2d')](_0x9681bd[_0x432d('0x9a')],{'$or':_[_0x432d('0x33')](_0x9681bd[_0x432d('0x40')],function(_0x31342f){var _0x547e59={};_0x547e59[_0x31342f]={'$like':'%'+_0x3b631e[_0x432d('0x39')]['filter']+'%'};return _0x547e59;})});}_0x9681bd[_0x432d('0x9a')][_0x432d('0x88')]=![];if(_0x3b631e[_0x432d('0x39')]['id']){_0x9681bd[_0x432d('0x9a')]['id']={'$gt':_0x3b631e[_0x432d('0x39')]['id']};}_0x9681bd=_['merge']({},_0x9681bd,_0x3b631e[_0x432d('0x44')]);return db['ChatMessage'][_0x432d('0x9d')]({'where':_0x9681bd[_0x432d('0x9a')]})[_0x432d('0x2a')](function(_0x84ff3d){_0xc62975[_0x432d('0x9d')]=_0x84ff3d;_0x9681bd[_0x432d('0x43')]=[];if(_0x3b631e['query']['includeAgent']){_0x9681bd[_0x432d('0x43')][_0x432d('0xa4')]({'model':db['User'],'as':_0x432d('0x7b'),'attributes':['id',_0x432d('0x50'),_0x432d('0x83')]});}if(_0x3b631e[_0x432d('0x39')][_0x432d('0x9e')]){_0x9681bd[_0x432d('0x43')]=[{'all':!![]}];}return db[_0x432d('0x5e')]['findAll'](_0x9681bd);})[_0x432d('0x2a')](function(_0x1c05ea){_0xc62975[_0x432d('0x9f')]=_0x1c05ea;return _0xc62975;});}})[_0x432d('0x2a')](respondWithFilteredResult(_0x1574b2,_0x9681bd))[_0x432d('0x1f')](handleError(_0x1574b2,null));};exports[_0x432d('0xa5')]=function(_0x1bd9e0,_0x5b4cd3){return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x1bd9e0[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x5b4cd3,null))[_0x432d('0x2a')](function(_0x106eb0){if(_0x106eb0){return _0x106eb0[_0x432d('0xa6')](_0x1bd9e0['body'][_0x432d('0x94')],_[_0x432d('0xa7')](_0x1bd9e0[_0x432d('0x47')],[_0x432d('0x94'),'id'])||{})[_0x432d('0xa8')](function(){return db['Tag'][_0x432d('0xa9')]({'attributes':['id',_0x432d('0x2b'),_0x432d('0xaa')],'where':{'id':_0x1bd9e0[_0x432d('0x47')][_0x432d('0x94')]}});})[_0x432d('0x2a')](function(_0xeb0f50){socket['emit'](_0x432d('0xab'),{'id':Number(_0x1bd9e0[_0x432d('0x3c')]['id']),'tags':_0xeb0f50||[]});return{'id':Number(_0x1bd9e0[_0x432d('0x3c')]['id']),'tags':_0xeb0f50||[]};});}})[_0x432d('0x2a')](respondWithResult(_0x5b4cd3,null))['catch'](handleError(_0x5b4cd3,null));};exports[_0x432d('0xac')]=function(_0x2c1ec9,_0x3f2d98){return db[_0x432d('0x34')][_0x432d('0x45')]({'where':{'id':_0x2c1ec9[_0x432d('0x3c')]['id']}})[_0x432d('0x2a')](handleEntityNotFound(_0x3f2d98,null))[_0x432d('0x2a')](function(_0x361563){if(_0x361563){return _0x361563[_0x432d('0xac')](_0x2c1ec9[_0x432d('0x39')][_0x432d('0x94')]);}})[_0x432d('0x2a')](respondWithStatusCode(_0x3f2d98,null))[_0x432d('0x1f')](handleError(_0x3f2d98,null));};exports[_0x432d('0x73')]=function(_0xf6f32,_0xe985b6){var _0x579ef0=moment()['unix']()['toString']();var _0xa5cf4b=path[_0x432d('0x6f')](config['root'],_0x432d('0xad'),_0x432d('0xae'),_0x432d('0xaf'));var _0x54583b=path[_0x432d('0x6f')](config['root'],_0x432d('0xad'),'files',_0x432d('0xb0'));var _0x16a575=path[_0x432d('0x6f')](_0xa5cf4b,_0x579ef0);var _0x5ec41c=util['format'](_0x432d('0xb1'),_0xf6f32[_0x432d('0x3c')]['id'],_0x579ef0);var _0x943af4=path[_0x432d('0x6f')](_0xa5cf4b,_0x5ec41c);var _0x57892e=[];_0x57892e[_0x432d('0xa4')]({'model':db[_0x432d('0x7b')],'as':_0x432d('0x7b'),'attributes':['id',_0x432d('0x50')],'raw':!![]});_0x57892e[_0x432d('0xa4')]({'model':db['CmContact'],'as':_0x432d('0x61'),'attributes':['id',_0x432d('0xb2'),'lastName'],'raw':!![]});if(_0xf6f32[_0x432d('0x39')][_0x432d('0xb0')]){_0x57892e[_0x432d('0xa4')]({'model':db[_0x432d('0x6b')],'as':'Attachment','raw':!![]});}var _0x19a893=[{'model':db[_0x432d('0x5e')],'as':_0x432d('0x7a'),'attributes':['id',_0x432d('0x47'),_0x432d('0x85'),'direction','secret',_0x432d('0xb3')],'include':_0x57892e}];_0x19a893[_0x432d('0xa4')]({'model':db[_0x432d('0x4b')],'as':_0x432d('0xb4'),'attributes':['id',_0x432d('0x2b')]});_0x19a893[_0x432d('0xa4')]({'model':db[_0x432d('0x7b')],'as':_0x432d('0xb5'),'attributes':['id',_0x432d('0x50')]});return db[_0x432d('0x34')]['find']({'where':{'id':_0xf6f32[_0x432d('0x3c')]['id']},'include':_0x19a893})['then'](handleEntityNotFound(_0xe985b6,null))[_0x432d('0x2a')](function(_0x3f2b16){if(_0x3f2b16){var _0x1654c4=_0x3f2b16['get']({'plain':!![]});fs[_0x432d('0xb6')](_0x16a575);var _0x4bc30f={'channel':_0x432d('0xb7'),'account':_0x1654c4[_0x432d('0xb4')][_0x432d('0x2b')],'agent':_0x1654c4[_0x432d('0xb5')]?_0x1654c4[_0x432d('0xb5')][_0x432d('0x50')]:_0x432d('0xb8'),'createdAt':moment(_0x1654c4[_0x432d('0x85')])[_0x432d('0x76')](_0x432d('0xb9'))[_0x432d('0xba')](),'closedAt':_0x1654c4[_0x432d('0x65')]?moment(_0x1654c4[_0x432d('0xbb')])[_0x432d('0x76')](_0x432d('0xb9'))[_0x432d('0xba')]():'','disposition':_0x1654c4[_0x432d('0xbc')],'chatInfo':{'browser':_0x1654c4[_0x432d('0xbd')],'os':_0x1654c4[_0x432d('0xbe')],'referer':_0x1654c4[_0x432d('0xbf')],'customerIp':_0x1654c4[_0x432d('0xc0')],'customerPort':_0x1654c4[_0x432d('0xc1')]?_0x1654c4[_0x432d('0xc1')]:'N.A.'},'messages':_(_0x1654c4[_0x432d('0x7a')])['tail']()[_0x432d('0x9b')]({'secret':![]})[_0x432d('0x33')](function(_0x696da0){if(_0x696da0[_0x432d('0x6b')]){var _0x94c1d7=path[_0x432d('0x6f')](_0x54583b,_0x696da0[_0x432d('0x6b')][_0x432d('0x69')]);if(fs[_0x432d('0xc2')](_0x94c1d7)){fs[_0x432d('0xc3')](_0x94c1d7)[_0x432d('0xc4')](fs[_0x432d('0xc5')](path[_0x432d('0x6f')](_0x16a575,_0x696da0[_0x432d('0x6b')]['basename'])));}}return{'date':moment(_0x696da0['createdAt'])[_0x432d('0x76')](_0x432d('0xb9'))['toString'](),'sender':_0x696da0['direction']==='out'?_0x696da0[_0x432d('0x7b')]?_0x696da0[_0x432d('0x7b')][_0x432d('0x50')]:_0x432d('0x7f'):_0x696da0[_0x432d('0x61')][_0x432d('0xb2')]+(_0x696da0[_0x432d('0x61')][_0x432d('0xc6')]?'\x20'+_0x696da0[_0x432d('0x61')]['lastName']:''),'body':_0x696da0[_0x432d('0x6b')]?_0x696da0['Attachment'][_0x432d('0x69')]:_0x696da0[_0x432d('0x47')],'direction':_0x696da0[_0x432d('0x87')]==='out'?'A':'C','secret':_0x696da0['secret'],'read':_0x696da0[_0x432d('0xb3')],'attachment':_0x696da0[_0x432d('0x6b')]};})[_0x432d('0xc7')]()};return ejs['renderFile'](path[_0x432d('0x6f')](config[_0x432d('0x70')],_0x432d('0xad'),_0x432d('0xc8'),_0x432d('0xc9')),{'interaction':_0x4bc30f})['then'](function(_0x3ce3c4){var _0x1ae260=path[_0x432d('0x6f')](_0x16a575,_0x432d('0xca')+_0x1654c4['id']+'-'+_0x579ef0+'.pdf');var _0x3d5686={'path':_0x1ae260,'channel':'Chat','interactionId':_0x1654c4['id']};return pdf['createPdfFromHTML'](_0x3ce3c4,_0x3d5686);})[_0x432d('0x2a')](function(){return new Promise(function(_0xd673c7,_0x1eef53){zipdir(_0x16a575,{'saveTo':_0x943af4},function(_0x4de395,_0x112414){if(_0x4de395)return _0x1eef53(_0x4de395);return _0xd673c7(_0x112414);});})['then'](function(){return new BPromise(function(_0x3927f9,_0x175747){rimraf(_0x16a575,function(_0x118b43){if(_0x118b43)_0x175747(_0x118b43);return _0x3927f9();});});})[_0x432d('0x2a')](function(){return _0xe985b6['download'](_0x943af4,_0x5ec41c,function(_0x3591d7){if(_0x3591d7){logger[_0x432d('0x1b')](_0x432d('0xcb'),_0x3591d7);}else{fs['unlinkSync'](_0x943af4);}});});});}else{return _0xe985b6[_0x432d('0x20')](0xc8);}})[_0x432d('0x1f')](handleError(_0xe985b6,null));}; \ No newline at end of file +var _0xc744=['ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','UserId','ValidationError','closed','AbandonInteraction','attachmentUpload','file','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','ContactId','length','format','System','customer','Visitor','agentIdentifier','website_alias','%s%d','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','pick','secret','includeAgent','push','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','read','Account','Owner','get','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','Contact','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','stack','name','send','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','params','model','keys','filters','intersection','attributes','fields','includeAll','include','options','create','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out'];(function(_0x4fb74e,_0x1a3a82){var _0x33da5d=function(_0x5d4705){while(--_0x5d4705){_0x4fb74e['push'](_0x4fb74e['shift']());}};_0x33da5d(++_0x1a3a82);}(_0xc744,0x6e));var _0x4c74=function(_0x3c8b68,_0x17c252){_0x3c8b68=_0x3c8b68-0x0;var _0x1f4482=_0xc744[_0x3c8b68];return _0x1f4482;};'use strict';var rimraf=require(_0x4c74('0x0'));var zipdir=require(_0x4c74('0x1'));var rp=require('request-promise');var moment=require(_0x4c74('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4c74('0x3'));var util=require(_0x4c74('0x4'));var path=require(_0x4c74('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c74('0x6'));var Redis=require(_0x4c74('0x7'));var interaction=require(_0x4c74('0x8'));var qs=require(_0x4c74('0x9'));var pdf=require(_0x4c74('0xa'));var logger=require('../../config/logger')(_0x4c74('0xb'));var config=require(_0x4c74('0xc'));var db=require(_0x4c74('0xd'))['db'];config[_0x4c74('0xe')]=_[_0x4c74('0xf')](config[_0x4c74('0xe')],{'host':_0x4c74('0x10'),'port':0x18eb});var socket=require(_0x4c74('0x11'))(new Redis(config['redis']));require(_0x4c74('0x12'))[_0x4c74('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4c74('0x14')]['http']({'port':0x232b});var client9004=jayson[_0x4c74('0x14')][_0x4c74('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x89a9c9,_0x5a7376,_0x31fb11,_0x14ab4f){return new BPromise(function(_0x1acd04,_0x345257){var _0x18ac32=_0x14ab4f||client;return _0x18ac32['request'](_0x89a9c9,_0x31fb11)[_0x4c74('0x16')](function(_0x31b9e6){logger['info'](_0x4c74('0x17'),_0x5a7376,'request\x20sent');logger[_0x4c74('0x18')](_0x4c74('0x19'),_0x5a7376,_0x4c74('0x1a'),JSON[_0x4c74('0x1b')](_0x31b9e6));if(_0x31b9e6[_0x4c74('0x1c')]){if(_0x31b9e6[_0x4c74('0x1c')][_0x4c74('0x1d')]===0x1f4){logger['error'](_0x4c74('0x17'),_0x5a7376,_0x31b9e6['error']['message']);return _0x345257(_0x31b9e6['error'][_0x4c74('0x1e')]);}logger[_0x4c74('0x1c')](_0x4c74('0x17'),_0x5a7376,_0x31b9e6[_0x4c74('0x1c')][_0x4c74('0x1e')]);return _0x1acd04(_0x31b9e6[_0x4c74('0x1c')][_0x4c74('0x1e')]);}else{logger[_0x4c74('0x1f')](_0x4c74('0x17'),_0x5a7376,'request\x20sent');_0x1acd04(_0x31b9e6[_0x4c74('0x20')]['message']);}})[_0x4c74('0x21')](function(_0x3dccfb){logger['error'](_0x4c74('0x17'),_0x5a7376,_0x3dccfb);_0x345257(_0x3dccfb);});});}function respondWithStatusCode(_0x2d2ea8,_0x17028f){_0x17028f=_0x17028f||0xcc;return function(_0x230817){if(_0x230817){return _0x2d2ea8[_0x4c74('0x22')](_0x17028f);}return _0x2d2ea8[_0x4c74('0x23')](_0x17028f)['end']();};}function respondWithResult(_0xd250b2,_0x17979d){_0x17979d=_0x17979d||0xc8;return function(_0x35de6b){if(_0x35de6b){return _0xd250b2[_0x4c74('0x23')](_0x17979d)['json'](_0x35de6b);}};}function respondWithFilteredResult(_0x2c204b,_0x2fbef9){return function(_0x3b8f2c){if(_0x3b8f2c){var _0xc222e4=typeof _0x2fbef9[_0x4c74('0x24')]===_0x4c74('0x25')&&typeof _0x2fbef9[_0x4c74('0x26')]===_0x4c74('0x25');var _0xb00019=_0x3b8f2c[_0x4c74('0x27')];var _0x6e1bac=_0xc222e4?0x0:_0x2fbef9[_0x4c74('0x24')];var _0x55a6f0=_0xc222e4?_0x3b8f2c[_0x4c74('0x27')]:_0x2fbef9[_0x4c74('0x24')]+_0x2fbef9[_0x4c74('0x26')];var _0x5efd62;if(_0x55a6f0>=_0xb00019){_0x55a6f0=_0xb00019;_0x5efd62=0xc8;}else{_0x5efd62=0xce;}_0x2c204b['status'](_0x5efd62);return _0x2c204b[_0x4c74('0x28')](_0x4c74('0x29'),_0x6e1bac+'-'+_0x55a6f0+'/'+_0xb00019)[_0x4c74('0x2a')](_0x3b8f2c);}return null;};}function saveUpdates(_0x1f1e43){return function(_0x22ba1c){if(_0x22ba1c){return _0x22ba1c[_0x4c74('0x2b')](_0x1f1e43)[_0x4c74('0x16')](function(_0x134c68){return _0x134c68;});}return null;};}function removeEntity(_0x166fa8){return function(_0xd425f2){if(_0xd425f2){return _0xd425f2[_0x4c74('0x2c')]()['then'](function(){_0x166fa8[_0x4c74('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b9e57){return function(_0x13ce50){if(!_0x13ce50){_0x9b9e57['sendStatus'](0x194);}return _0x13ce50;};}function handleError(_0x2e2029,_0x3f7057){_0x3f7057=_0x3f7057||0x1f4;return function(_0x83d299){logger['error'](_0x83d299[_0x4c74('0x2d')]);if(_0x83d299[_0x4c74('0x2e')]){delete _0x83d299[_0x4c74('0x2e')];}_0x2e2029[_0x4c74('0x23')](_0x3f7057)[_0x4c74('0x2f')](_0x83d299);};}function getMustacheRender(_0x3bbb08,_0xa4d413){return Mustache['render'](_0x3bbb08,_[_0x4c74('0x30')](_0xa4d413[_0x4c74('0x31')],{'contact':_0xa4d413[_0x4c74('0x32')],'message':_0xa4d413['message'],'agent':_0xa4d413['agent'],'interaction':_0xa4d413[_0x4c74('0x33')],'account':_0xa4d413[_0x4c74('0x34')]}))||'';}exports[_0x4c74('0x35')]=function(_0x6e58c1,_0x25890a){var _0x4fb83e={};var _0x1272b1=_[_0x4c74('0x36')](db[_0x4c74('0x37')][_0x4c74('0x38')],function(_0x130a9b){return{'name':_0x130a9b[_0x4c74('0x39')],'type':_0x130a9b[_0x4c74('0x3a')][_0x4c74('0x3b')]};});_0x4fb83e=qs[_0x4c74('0x3c')](_0x1272b1,_0x6e58c1);return interaction[_0x4c74('0x3d')](_0x4c74('0x3e'),_0x6e58c1[_0x4c74('0x3f')],_0x6e58c1['user'],_0x4fb83e,_0x1272b1)[_0x4c74('0x16')](respondWithFilteredResult(_0x25890a,_0x4fb83e))[_0x4c74('0x21')](handleError(_0x25890a,null));};exports['show']=function(_0x542f80,_0x3dfc81){var _0xaec59={'raw':![],'where':{'id':_0x542f80[_0x4c74('0x40')]['id']}},_0x490482={};_0x490482[_0x4c74('0x41')]=_[_0x4c74('0x42')](db[_0x4c74('0x37')][_0x4c74('0x38')]);_0x490482[_0x4c74('0x3f')]=_[_0x4c74('0x42')](_0x542f80[_0x4c74('0x3f')]);_0x490482[_0x4c74('0x43')]=_[_0x4c74('0x44')](_0x490482[_0x4c74('0x41')],_0x490482[_0x4c74('0x3f')]);_0xaec59[_0x4c74('0x45')]=_[_0x4c74('0x44')](_0x490482[_0x4c74('0x41')],qs[_0x4c74('0x46')](_0x542f80[_0x4c74('0x3f')][_0x4c74('0x46')]));_0xaec59[_0x4c74('0x45')]=_0xaec59[_0x4c74('0x45')]['length']?_0xaec59[_0x4c74('0x45')]:_0x490482[_0x4c74('0x41')];if(_0x542f80[_0x4c74('0x3f')][_0x4c74('0x47')]){_0xaec59[_0x4c74('0x48')]=[{'all':!![]}];}_0xaec59=_['merge']({},_0xaec59,_0x542f80[_0x4c74('0x49')]);return db['ChatInteraction']['find'](_0xaec59)[_0x4c74('0x16')](handleEntityNotFound(_0x3dfc81,null))[_0x4c74('0x16')](respondWithResult(_0x3dfc81,null))[_0x4c74('0x21')](handleError(_0x3dfc81,null));};exports[_0x4c74('0x4a')]=function(_0x3d16c3,_0x1db5dc){return db['ChatInteraction'][_0x4c74('0x4a')](_0x3d16c3[_0x4c74('0x31')],{})[_0x4c74('0x16')](respondWithResult(_0x1db5dc,0xc9))['catch'](handleError(_0x1db5dc,null));};exports[_0x4c74('0x2b')]=function(_0x32b11d,_0x224593){if(_0x32b11d['body']['id']){delete _0x32b11d[_0x4c74('0x31')]['id'];}return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0x32b11d[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0x224593,null))[_0x4c74('0x16')](saveUpdates(_0x32b11d['body'],null))['then'](respondWithResult(_0x224593,null))['catch'](handleError(_0x224593,null));};exports['destroy']=function(_0xde8850,_0xed7c5f){return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0xde8850[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0xed7c5f,null))[_0x4c74('0x16')](removeEntity(_0xed7c5f,null))[_0x4c74('0x21')](handleError(_0xed7c5f,null));};exports[_0x4c74('0x4c')]=function(_0x4acb8e,_0x57b2d3){return db[_0x4c74('0x37')][_0x4c74('0x4c')]()[_0x4c74('0x16')](respondWithResult(_0x57b2d3,null))['catch'](handleError(_0x57b2d3,null));};exports[_0x4c74('0x4d')]=function(_0x417651,_0x46cc10){var _0x2dfb43=_0x417651[_0x4c74('0x40')]['id'];var _0x9ef80b;var _0x316b98;var _0x445a65;return db['ChatInteraction'][_0x4c74('0x4e')]({'where':{'id':_0x2dfb43}})['then'](function(_0x2e7a37){_0x9ef80b=_0x2e7a37;return db['ChatWebsite']['findOne']({'where':{'id':_0x2e7a37[_0x4c74('0x4f')]},'attributes':['id',_0x4c74('0x50'),_0x4c74('0x51'),_0x4c74('0x52'),_0x4c74('0x53'),_0x4c74('0x54')],'raw':!![]});})[_0x4c74('0x16')](function(_0x45c0e9){if(_0x45c0e9&&_0x45c0e9[_0x4c74('0x50')]&&_0x45c0e9['vidaooEscalation']){_0x316b98=_0x45c0e9;var _0x319115={'interaction':{'id':_0x2dfb43},'agent':{'id':_0x417651[_0x4c74('0x55')]['id'],'name':_0x417651[_0x4c74('0x55')]['name'],'fullname':_0x417651[_0x4c74('0x55')][_0x4c74('0x56')],'email':_0x417651[_0x4c74('0x55')][_0x4c74('0x57')]},'contact':_0x417651[_0x4c74('0x31')][_0x4c74('0x32')],'account':_0x417651[_0x4c74('0x31')][_0x4c74('0x34')]};var _0x719805={'rejectUnauthorized':![],'method':_0x4c74('0x58'),'url':_0x4c74('0x59'),'headers':{'X-APIKEY':_0x45c0e9[_0x4c74('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x417651['user'][_0x4c74('0x57')]],'buttons':null,'topic':_0x316b98[_0x4c74('0x52')],'note':_[_0x4c74('0x5a')](_0x316b98[_0x4c74('0x53')])?null:getMustacheRender(_0x316b98[_0x4c74('0x53')],_0x319115),'metadata':null},'redirect':_0x4c74('0x5b'),'json':!![]};try{if(!_[_0x4c74('0x5a')](_0x316b98[_0x4c74('0x54')])){var _0x2ad627=getMustacheRender(_0x316b98[_0x4c74('0x54')],_0x319115);var _0x3ec78e=JSON[_0x4c74('0x5c')](_0x2ad627);_0x719805[_0x4c74('0x31')]['metadata']=_0x3ec78e;}}catch(_0x5a7757){throw new db[(_0x4c74('0x5d'))]['ValidationError'](_0x4c74('0x5e'));}return rp(_0x719805);}else{throw new db[(_0x4c74('0x5d'))]['ValidationError'](_0x4c74('0x5f'));}})[_0x4c74('0x16')](function(_0x4e0038){_0x445a65=_0x4e0038;if(_0x445a65['id']){var _0x597b8e={'body':_0x445a65['join_url'],'ChatWebsiteId':_0x316b98['id'],'ChatInteractionId':_0x9ef80b['id'],'direction':_0x4c74('0x60'),'UserId':_0x417651[_0x4c74('0x55')]['id']};return db[_0x4c74('0x61')]['create'](_0x597b8e,{});}else{throw new db[(_0x4c74('0x5d'))]['ValidationError'](_0x4c74('0x62'));}})[_0x4c74('0x16')](function(){return _0x9ef80b[_0x4c74('0x63')]({'vidaooSessionId':_0x445a65['id']});})[_0x4c74('0x16')](respondWithResult(_0x46cc10,null))[_0x4c74('0x21')](handleError(_0x46cc10,null));};exports[_0x4c74('0x64')]=function(_0x59e41d,_0x2ede8f){if(_0x59e41d[_0x4c74('0x31')]['id']){delete _0x59e41d[_0x4c74('0x31')]['id'];}return db[_0x4c74('0x37')]['find']({'where':{'id':_0x59e41d[_0x4c74('0x40')]['id']},'include':[{'model':db[_0x4c74('0x65')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2ede8f,null))[_0x4c74('0x16')](saveUpdates(_0x59e41d['body'],null))[_0x4c74('0x16')](respondWithResult(_0x2ede8f,null))[_0x4c74('0x21')](handleError(_0x2ede8f,null));};exports['abandon']=function(_0x20870b,_0x52c09b){if(_0x20870b['body']['id']){delete _0x20870b[_0x4c74('0x31')]['id'];}return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0x20870b[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](function(_0x1042a6){if(!_0x1042a6){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x4c74('0x66'),0x194,_0x4c74('0x67'));_0x52c09b[_0x4c74('0x22')](0x194);}else{if(_0x1042a6[_0x4c74('0x68')]){throw new db[(_0x4c74('0x5d'))][(_0x4c74('0x69'))]('Interaction\x20already\x20assigned');}}return _0x1042a6;})[_0x4c74('0x16')](function(_0x3a2633){if(_0x3a2633){return _0x3a2633[_0x4c74('0x2b')]({'closed':_0x20870b[_0x4c74('0x31')][_0x4c74('0x6a')],'disposition':_0x20870b[_0x4c74('0x31')]['disposition']})[_0x4c74('0x16')](function(_0x3e08fb){return _0x3e08fb;});}})['then'](function(){return respondWithRpcPromise(_0x4c74('0x6b'),_0x4c74('0x66'),_0x20870b['body'],client9004);})[_0x4c74('0x16')](respondWithResult(_0x52c09b,null))[_0x4c74('0x21')](handleError(_0x52c09b,null));};exports[_0x4c74('0x6c')]=function(_0x5ecbc3,_0x53b5de){_0x5ecbc3['body']['name']=_0x5ecbc3[_0x4c74('0x6d')]['originalname'];_0x5ecbc3[_0x4c74('0x31')]['basename']=_0x5ecbc3[_0x4c74('0x6d')][_0x4c74('0x6e')];_0x5ecbc3[_0x4c74('0x31')][_0x4c74('0x3a')]=_0x5ecbc3[_0x4c74('0x6d')]['mimetype'];return db[_0x4c74('0x6f')]['create'](_0x5ecbc3[_0x4c74('0x31')])[_0x4c74('0x16')](respondWithResult(_0x53b5de,0xc9))[_0x4c74('0x21')](handleError(_0x53b5de,null));};exports[_0x4c74('0x70')]=function(_0x19be80,_0x18cded){return db['ChatInteraction']['findOne']({'where':{'id':_0x19be80[_0x4c74('0x40')]['id']},'raw':!![]})[_0x4c74('0x16')](handleEntityNotFound(_0x18cded,null))['then'](function(_0x37e5fd){if(_0x37e5fd){if(_0x37e5fd[_0x4c74('0x6a')]){return _0x18cded[_0x4c74('0x23')](0x193)[_0x4c74('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db[_0x4c74('0x6f')][_0x4c74('0x4e')]({'where':{'id':_0x19be80[_0x4c74('0x3f')][_0x4c74('0x71')]},'raw':!![]})[_0x4c74('0x16')](handleEntityNotFound(_0x18cded,null));}})[_0x4c74('0x16')](function(_0x339b27){if(_0x339b27){var _0x1c6232=_0x339b27[_0x4c74('0x72')]!==null;var _0x37b7b4=path['join'](config['root'],_0x4c74('0x73'));if(_0x1c6232){_0x37b7b4=path[_0x4c74('0x74')](_0x37b7b4,_0x4c74('0x75'));}var _0x5a41a9=path[_0x4c74('0x74')](_0x37b7b4,_0x339b27[_0x4c74('0x76')]);return _0x18cded[_0x4c74('0x77')](_0x5a41a9);}})[_0x4c74('0x21')](handleError(_0x18cded,null));};exports[_0x4c74('0x78')]=function(_0x89e0a6,_0xc1a229){var _0x4b5f18=null;var _0xe67d59=null;var _0xd2d7a3=null;if(_0x89e0a6[_0x4c74('0x31')]['id']){delete _0x89e0a6[_0x4c74('0x31')]['id'];}if(_0x89e0a6['body'][_0x4c74('0x79')]){_0xd2d7a3=path[_0x4c74('0x74')](config[_0x4c74('0x7a')],_0x4c74('0x7b'),util['format'](_0x4c74('0x7c'),Date[_0x4c74('0x7d')]()));_0x89e0a6[_0x4c74('0x31')][_0x4c74('0x7e')]=_0xd2d7a3;}return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0x89e0a6[_0x4c74('0x40')]['id']},'include':[{'model':db[_0x4c74('0x61')],'as':_0x4c74('0x7f'),'include':[{'model':db[_0x4c74('0x80')],'as':'User'}]}]})['then'](handleEntityNotFound(_0xc1a229,null))['then'](saveUpdates(_0x89e0a6[_0x4c74('0x31')],null))[_0x4c74('0x16')](function(_0x586e71){if(_0x586e71){_0x4b5f18=_0x586e71;return db[_0x4c74('0x81')][_0x4c74('0x4b')]({'where':{'id':_0x4b5f18[_0x4c74('0x4f')]}});}})[_0x4c74('0x16')](function(_0x2ecc8){if(_0x2ecc8){_0xe67d59=_0x2ecc8;return db[_0x4c74('0x65')][_0x4c74('0x4b')]({'where':{'id':_0x4b5f18[_0x4c74('0x82')]}});}})[_0x4c74('0x16')](function(_0x545a5e){if(_0x545a5e){if(_0xd2d7a3){var _0xa7f8c1=null;for(var _0x411dd2=0x1;_0x411dd2<_0x4b5f18[_0x4c74('0x7f')][_0x4c74('0x83')];++_0x411dd2){_0xa7f8c1=_0x4b5f18['Messages'][_0x411dd2];var _0x226069=_0xa7f8c1['UserId']?util[_0x4c74('0x84')]('%s%d',_0xe67d59['agentAlias'],_0xa7f8c1[_0x4c74('0x68')]):_0x4c74('0x85');var _0x98f00=_0x89e0a6[_0x4c74('0x31')][_0x4c74('0x86')]||util[_0x4c74('0x84')]('%s%d',_0x4c74('0x87'),_0xa7f8c1[_0x4c74('0x82')]);switch(_0xe67d59[_0x4c74('0x88')]){case _0x4c74('0x89'):_0x226069=_0xa7f8c1['UserId']?util['format'](_0x4c74('0x8a'),_0xe67d59['agentAlias'],_0xa7f8c1[_0x4c74('0x68')]):_0x4c74('0x85');break;case _0x4c74('0x8b'):_0x226069=_0xa7f8c1[_0x4c74('0x68')]?_0xa7f8c1[_0x4c74('0x80')][_0x4c74('0x8c')]||_0xa7f8c1['User'][_0x4c74('0x56')]:_0x4c74('0x85');break;case _0x4c74('0x8d'):_0x226069=_0xa7f8c1[_0x4c74('0x68')]?_0xa7f8c1['User'][_0x4c74('0x56')]:_0x4c74('0x85');break;default:_0x226069=_0xa7f8c1['UserId']?util[_0x4c74('0x84')]('%s%d',_0xe67d59['agentAlias'],_0xa7f8c1[_0x4c74('0x68')]):'System';}var _0x270170=util[_0x4c74('0x84')](_0x4c74('0x8e'),moment(_0xa7f8c1['createdAt'])[_0x4c74('0x84')]('MM/DD/YYYY\x20HH:mm:ss'),_0xa7f8c1[_0x4c74('0x8f')]==='in'?_0x98f00:_0x226069,_0xa7f8c1[_0x4c74('0x31')]);if(!_0xa7f8c1['secret']){fs[_0x4c74('0x90')](_0xd2d7a3,_0x270170);}}return db[_0x4c74('0x91')][_0x4c74('0x4e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4c74('0x92'),'raw':!![],'include':[{'model':db[_0x4c74('0x93')],'as':_0x4c74('0x93'),'raw':!![]}]}]});}}})[_0x4c74('0x16')](function(_0x29e147){if(!_0x29e147||!_0x29e147[_0x4c74('0x92')]||!_0x89e0a6['body'])return _0x4b5f18;var _0x179ab0=_0x29e147[_0x4c74('0x94')]();return respondWithRpcPromise(_0x4c74('0x95'),_0x4c74('0x96'),{'account':_0x179ab0,'message':{'from':util[_0x4c74('0x84')](_0x4c74('0x97'),_0x29e147[_0x4c74('0x2e')],_0x29e147[_0x4c74('0x57')]||_0x29e147[_0x4c74('0x92')]['user']),'to':_0x89e0a6[_0x4c74('0x31')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x4c74('0x84')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x89e0a6[_0x4c74('0x31')][_0x4c74('0x79')]),'attachments':[{'path':_0xd2d7a3}]}})[_0x4c74('0x16')](function(){return _0x4b5f18;})['catch'](function(_0x522904){logger['error'](_0x522904);});})['then'](respondWithStatusCode(_0xc1a229,0xc8))[_0x4c74('0x21')](handleError(_0xc1a229,null));};exports[_0x4c74('0x98')]=function(_0xad299b,_0x5e9836){return db[_0x4c74('0x61')]['find']({'where':{'id':_0xad299b[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0x5e9836,null))['then'](function(_0x139a6f){if(_0x139a6f){return _0x139a6f['addMessage'](_0xad299b[_0x4c74('0x31')][_0x4c74('0x99')],_[_0x4c74('0x9a')](_0xad299b[_0x4c74('0x31')],[_0x4c74('0x99'),'id'])||{});}})[_0x4c74('0x16')](respondWithResult(_0x5e9836,null))[_0x4c74('0x21')](handleError(_0x5e9836,null));};exports[_0x4c74('0x9b')]=function(_0x549974,_0x4417f7){var _0x2336a7={'raw':![],'where':{}};var _0x1d9b69={};var _0x1c35ff={'count':0x0,'rows':[]};return db[_0x4c74('0x37')]['findOne']({'where':{'id':_0x549974[_0x4c74('0x40')]['id']}})['then'](handleEntityNotFound(_0x4417f7,null))['then'](function(_0x51af22){if(_0x51af22){_0x1d9b69['model']=_[_0x4c74('0x42')](db[_0x4c74('0x61')]['rawAttributes']);_0x1d9b69[_0x4c74('0x3f')]=_[_0x4c74('0x42')](_0x549974[_0x4c74('0x3f')]);_0x1d9b69[_0x4c74('0x43')]=_[_0x4c74('0x44')](_0x1d9b69[_0x4c74('0x41')],_0x1d9b69[_0x4c74('0x3f')]);_0x2336a7[_0x4c74('0x45')]=_[_0x4c74('0x44')](_0x1d9b69['model'],qs['fields'](_0x549974[_0x4c74('0x3f')][_0x4c74('0x46')]));_0x2336a7['attributes']=_0x2336a7[_0x4c74('0x45')]['length']?_0x2336a7[_0x4c74('0x45')]:_0x1d9b69['model'];if(!_0x549974[_0x4c74('0x3f')][_0x4c74('0x9c')]('nolimit')){_0x2336a7[_0x4c74('0x26')]=qs[_0x4c74('0x26')](_0x549974[_0x4c74('0x3f')][_0x4c74('0x26')]);_0x2336a7[_0x4c74('0x24')]=qs[_0x4c74('0x24')](_0x549974[_0x4c74('0x3f')][_0x4c74('0x24')]);}_0x2336a7[_0x4c74('0x9d')]=qs['sort'](_0x549974[_0x4c74('0x3f')][_0x4c74('0x9e')]);_0x2336a7[_0x4c74('0x9f')]=qs['filters'](_['pick'](_0x549974[_0x4c74('0x3f')],_0x1d9b69[_0x4c74('0x43')]));_0x2336a7['where']['ChatInteractionId']=_0x51af22['id'];if(_0x549974['query'][_0x4c74('0xa0')]){_0x2336a7[_0x4c74('0x9f')]=_[_0x4c74('0x30')](_0x2336a7[_0x4c74('0x9f')],{'$or':_['map'](_0x2336a7[_0x4c74('0x45')],function(_0x5c8a5c){var _0x3692d5={};_0x3692d5[_0x5c8a5c]={'$like':'%'+_0x549974['query'][_0x4c74('0xa0')]+'%'};return _0x3692d5;})});}if(_0x549974[_0x4c74('0x3f')][_0x4c74('0xa1')]){var _0x4ff25e=_0x549974[_0x4c74('0x3f')][_0x4c74('0xa1')][_0x4c74('0xa2')](',');var _0x59171b={};_0x59171b[_0x4ff25e[0x0]]={'$gte':moment(_0x4ff25e[0x1])[_0x4c74('0x84')](_0x4c74('0xa3'))};_0x2336a7[_0x4c74('0x9f')]=_[_0x4c74('0x30')](_0x2336a7['where'],_0x59171b);}_0x2336a7=_[_0x4c74('0x30')]({},_0x2336a7,_0x549974[_0x4c74('0x49')]);return db['ChatMessage'][_0x4c74('0x27')]({'where':_0x2336a7[_0x4c74('0x9f')]})[_0x4c74('0x16')](function(_0x41cf4a){_0x1c35ff[_0x4c74('0x27')]=_0x41cf4a;if(_0x549974[_0x4c74('0x3f')][_0x4c74('0x47')]){_0x2336a7['include']=[{'all':!![]}];}return db[_0x4c74('0x61')][_0x4c74('0x3d')](_0x2336a7);})[_0x4c74('0x16')](function(_0x3a6fd1){_0x1c35ff[_0x4c74('0xa4')]=_0x3a6fd1;return _0x1c35ff;});}})['then'](respondWithFilteredResult(_0x4417f7,_0x2336a7))['catch'](handleError(_0x4417f7,null));};exports[_0x4c74('0xa5')]=function(_0x20d78d,_0x481c77){var _0x3d43b2={'where':{}},_0x26ecbd={},_0x4b6f58={'count':0x0,'rows':[]};return db[_0x4c74('0x37')][_0x4c74('0x4e')]({'where':{'id':_0x20d78d[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0x481c77,null))[_0x4c74('0x16')](function(_0xee2812){if(_0xee2812){_0x26ecbd[_0x4c74('0x41')]=_[_0x4c74('0x42')](db[_0x4c74('0x61')][_0x4c74('0x38')]);_0x26ecbd[_0x4c74('0x3f')]=_[_0x4c74('0x42')](_0x20d78d[_0x4c74('0x3f')]);_0x26ecbd[_0x4c74('0x43')]=_['intersection'](_0x26ecbd[_0x4c74('0x41')],_0x26ecbd[_0x4c74('0x3f')]);_0x3d43b2[_0x4c74('0x45')]=_['intersection'](_0x26ecbd[_0x4c74('0x41')],qs['fields'](_0x20d78d[_0x4c74('0x3f')][_0x4c74('0x46')]));_0x3d43b2['attributes']=_0x3d43b2[_0x4c74('0x45')][_0x4c74('0x83')]?_0x3d43b2[_0x4c74('0x45')]:_0x26ecbd[_0x4c74('0x41')];if(!_0x20d78d[_0x4c74('0x3f')][_0x4c74('0x9c')]('nolimit')){_0x3d43b2[_0x4c74('0x26')]=qs[_0x4c74('0x26')](_0x20d78d[_0x4c74('0x3f')][_0x4c74('0x26')]);_0x3d43b2[_0x4c74('0x24')]=qs[_0x4c74('0x24')](_0x20d78d['query'][_0x4c74('0x24')]);}_0x3d43b2[_0x4c74('0x9d')]=qs[_0x4c74('0x9e')](_0x20d78d[_0x4c74('0x3f')][_0x4c74('0x9e')]);_0x3d43b2[_0x4c74('0x9f')]=qs[_0x4c74('0x43')](_[_0x4c74('0xa6')](_0x20d78d[_0x4c74('0x3f')],_0x26ecbd['filters']));_0x3d43b2[_0x4c74('0x9f')]['ChatInteractionId']=_0xee2812['id'];if(_0x20d78d[_0x4c74('0x3f')][_0x4c74('0xa0')]){_0x3d43b2['where']=_['merge'](_0x3d43b2[_0x4c74('0x9f')],{'$or':_[_0x4c74('0x36')](_0x3d43b2[_0x4c74('0x45')],function(_0x31a071){var _0x13b33b={};_0x13b33b[_0x31a071]={'$like':'%'+_0x20d78d[_0x4c74('0x3f')][_0x4c74('0xa0')]+'%'};return _0x13b33b;})});}_0x3d43b2[_0x4c74('0x9f')][_0x4c74('0xa7')]=![];if(_0x20d78d[_0x4c74('0x3f')]['id']){_0x3d43b2[_0x4c74('0x9f')]['id']={'$gt':_0x20d78d[_0x4c74('0x3f')]['id']};}_0x3d43b2=_[_0x4c74('0x30')]({},_0x3d43b2,_0x20d78d[_0x4c74('0x49')]);return db['ChatMessage'][_0x4c74('0x27')]({'where':_0x3d43b2[_0x4c74('0x9f')]})[_0x4c74('0x16')](function(_0x184a31){_0x4b6f58[_0x4c74('0x27')]=_0x184a31;_0x3d43b2[_0x4c74('0x48')]=[];if(_0x20d78d[_0x4c74('0x3f')][_0x4c74('0xa8')]){_0x3d43b2[_0x4c74('0x48')][_0x4c74('0xa9')]({'model':db[_0x4c74('0x80')],'as':_0x4c74('0x80'),'attributes':['id',_0x4c74('0x56'),_0x4c74('0x8c')]});}if(_0x20d78d[_0x4c74('0x3f')][_0x4c74('0x47')]){_0x3d43b2[_0x4c74('0x48')]=[{'all':!![]}];}return db[_0x4c74('0x61')][_0x4c74('0x3d')](_0x3d43b2);})[_0x4c74('0x16')](function(_0x560307){_0x4b6f58['rows']=_0x560307;return _0x4b6f58;});}})['then'](respondWithFilteredResult(_0x481c77,_0x3d43b2))[_0x4c74('0x21')](handleError(_0x481c77,null));};exports[_0x4c74('0xaa')]=function(_0x3bdcfd,_0x685c11){return db[_0x4c74('0x37')]['find']({'where':{'id':_0x3bdcfd[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0x685c11,null))['then'](function(_0x1ae273){if(_0x1ae273){return _0x1ae273[_0x4c74('0xab')](_0x3bdcfd[_0x4c74('0x31')]['ids'],_[_0x4c74('0x9a')](_0x3bdcfd[_0x4c74('0x31')],[_0x4c74('0x99'),'id'])||{})[_0x4c74('0xac')](function(){return db[_0x4c74('0xad')][_0x4c74('0x3d')]({'attributes':['id',_0x4c74('0x2e'),_0x4c74('0xae')],'where':{'id':_0x3bdcfd['body']['ids']}});})['then'](function(_0x3d98da){socket['emit'](_0x4c74('0xaf'),{'id':Number(_0x3bdcfd[_0x4c74('0x40')]['id']),'tags':_0x3d98da||[]});return{'id':Number(_0x3bdcfd[_0x4c74('0x40')]['id']),'tags':_0x3d98da||[]};});}})[_0x4c74('0x16')](respondWithResult(_0x685c11,null))['catch'](handleError(_0x685c11,null));};exports[_0x4c74('0xb0')]=function(_0x674365,_0x43f99d){return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0x674365[_0x4c74('0x40')]['id']}})[_0x4c74('0x16')](handleEntityNotFound(_0x43f99d,null))[_0x4c74('0x16')](function(_0x49556c){if(_0x49556c){return _0x49556c[_0x4c74('0xb0')](_0x674365[_0x4c74('0x3f')][_0x4c74('0x99')]);}})['then'](respondWithStatusCode(_0x43f99d,null))[_0x4c74('0x21')](handleError(_0x43f99d,null));};exports['download']=function(_0x56ba93,_0x874866){var _0x321259=moment()['unix']()[_0x4c74('0xb1')]();var _0x534bee=path[_0x4c74('0x74')](config[_0x4c74('0x7a')],_0x4c74('0xb2'),_0x4c74('0xb3'),_0x4c74('0xb4'));var _0x58a048=path['join'](config['root'],_0x4c74('0xb2'),_0x4c74('0xb3'),_0x4c74('0xb5'));var _0x453c0d=path[_0x4c74('0x74')](_0x534bee,_0x321259);var _0x344f5e=util['format'](_0x4c74('0xb6'),_0x56ba93[_0x4c74('0x40')]['id'],_0x321259);var _0x43f710=path[_0x4c74('0x74')](_0x534bee,_0x344f5e);var _0x5a0e83=[];_0x5a0e83[_0x4c74('0xa9')]({'model':db[_0x4c74('0x80')],'as':_0x4c74('0x80'),'attributes':['id',_0x4c74('0x56')],'raw':!![]});_0x5a0e83[_0x4c74('0xa9')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x4c74('0xb7'),_0x4c74('0xb8')],'raw':!![]});if(_0x56ba93[_0x4c74('0x3f')][_0x4c74('0xb5')]){_0x5a0e83[_0x4c74('0xa9')]({'model':db[_0x4c74('0x6f')],'as':_0x4c74('0x6f'),'raw':!![]});}var _0x40715a=[{'model':db[_0x4c74('0x61')],'as':_0x4c74('0x7f'),'attributes':['id',_0x4c74('0x31'),_0x4c74('0xb9'),_0x4c74('0x8f'),_0x4c74('0xa7'),_0x4c74('0xba')],'include':_0x5a0e83}];_0x40715a[_0x4c74('0xa9')]({'model':db[_0x4c74('0x81')],'as':_0x4c74('0xbb'),'attributes':['id',_0x4c74('0x2e')]});_0x40715a['push']({'model':db[_0x4c74('0x80')],'as':_0x4c74('0xbc'),'attributes':['id',_0x4c74('0x56')]});return db[_0x4c74('0x37')][_0x4c74('0x4b')]({'where':{'id':_0x56ba93[_0x4c74('0x40')]['id']},'include':_0x40715a})[_0x4c74('0x16')](handleEntityNotFound(_0x874866,null))[_0x4c74('0x16')](function(_0x429657){if(_0x429657){var _0x2d32da=_0x429657[_0x4c74('0xbd')]({'plain':!![]});fs['mkdirSync'](_0x453c0d);var _0x5579ec={'channel':'Chat','account':_0x2d32da[_0x4c74('0xbb')][_0x4c74('0x2e')],'agent':_0x2d32da['Owner']?_0x2d32da[_0x4c74('0xbc')][_0x4c74('0x56')]:_0x4c74('0xbe'),'createdAt':moment(_0x2d32da[_0x4c74('0xb9')])[_0x4c74('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c74('0xb1')](),'closedAt':_0x2d32da['closed']?moment(_0x2d32da[_0x4c74('0xbf')])[_0x4c74('0x84')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4c74('0xb1')]():'','disposition':_0x2d32da['disposition'],'chatInfo':{'browser':_0x2d32da[_0x4c74('0xc0')],'os':_0x2d32da[_0x4c74('0xc1')],'referer':_0x2d32da['referer'],'customerIp':_0x2d32da[_0x4c74('0xc2')],'customerPort':_0x2d32da[_0x4c74('0xc3')]?_0x2d32da[_0x4c74('0xc3')]:'N.A.'},'messages':_(_0x2d32da['Messages'])[_0x4c74('0xc4')]()['filter']({'secret':![]})[_0x4c74('0x36')](function(_0x3661e9){if(_0x3661e9['Attachment']){var _0x57fd4e=path[_0x4c74('0x74')](_0x58a048,_0x3661e9[_0x4c74('0x6f')]['basename']);if(fs[_0x4c74('0xc5')](_0x57fd4e)){fs[_0x4c74('0xc6')](_0x57fd4e)['pipe'](fs['createWriteStream'](path['join'](_0x453c0d,_0x3661e9[_0x4c74('0x6f')][_0x4c74('0x76')])));}}return{'date':moment(_0x3661e9[_0x4c74('0xb9')])[_0x4c74('0x84')](_0x4c74('0xa3'))[_0x4c74('0xb1')](),'sender':_0x3661e9[_0x4c74('0x8f')]==='out'?_0x3661e9[_0x4c74('0x80')]?_0x3661e9[_0x4c74('0x80')][_0x4c74('0x56')]:'System':_0x3661e9[_0x4c74('0xc7')][_0x4c74('0xb7')]+(_0x3661e9['Contact'][_0x4c74('0xb8')]?'\x20'+_0x3661e9[_0x4c74('0xc7')][_0x4c74('0xb8')]:''),'body':_0x3661e9[_0x4c74('0x6f')]?_0x3661e9[_0x4c74('0x6f')][_0x4c74('0x76')]:_0x3661e9[_0x4c74('0x31')],'direction':_0x3661e9[_0x4c74('0x8f')]==='out'?'A':'C','secret':_0x3661e9[_0x4c74('0xa7')],'read':_0x3661e9[_0x4c74('0xba')],'attachment':_0x3661e9[_0x4c74('0x6f')]};})[_0x4c74('0xc8')]()};return ejs[_0x4c74('0xc9')](path[_0x4c74('0x74')](config[_0x4c74('0x7a')],_0x4c74('0xb2'),'views','downloadInteraction.ejs'),{'interaction':_0x5579ec})[_0x4c74('0x16')](function(_0x29868e){var _0xa1d7a3=path[_0x4c74('0x74')](_0x453c0d,_0x4c74('0xca')+_0x2d32da['id']+'-'+_0x321259+_0x4c74('0xcb'));var _0xdf2ee1={'path':_0xa1d7a3,'channel':'Chat','interactionId':_0x2d32da['id']};return pdf[_0x4c74('0xcc')](_0x29868e,_0xdf2ee1);})['then'](function(){return new Promise(function(_0x585e98,_0x390e8b){zipdir(_0x453c0d,{'saveTo':_0x43f710},function(_0x461bae,_0x26375b){if(_0x461bae)return _0x390e8b(_0x461bae);return _0x585e98(_0x26375b);});})['then'](function(){return new BPromise(function(_0x4e4c5f,_0x3605a1){rimraf(_0x453c0d,function(_0x562749){if(_0x562749)_0x3605a1(_0x562749);return _0x4e4c5f();});});})[_0x4c74('0x16')](function(){return _0x874866[_0x4c74('0x77')](_0x43f710,_0x344f5e,function(_0x1af125){if(_0x1af125){logger[_0x4c74('0x1c')](_0x4c74('0xcd'),_0x1af125);}else{fs[_0x4c74('0xce')](_0x43f710);}});});});}else{return _0x874866['sendStatus'](0xc8);}})[_0x4c74('0x21')](handleError(_0x874866,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 0f0152a..b2545cf 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 _0x6758=['ChatMessage','save','update','getUsers','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb'];(function(_0xd3eb27,_0x212bb6){var _0x49c92b=function(_0x229dec){while(--_0x229dec){_0xd3eb27['push'](_0xd3eb27['shift']());}};_0x49c92b(++_0x212bb6);}(_0x6758,0xcd));var _0x8675=function(_0x5ae4a1,_0x1f73bb){_0x5ae4a1=_0x5ae4a1-0x0;var _0x452fb2=_0x6758[_0x5ae4a1];return _0x452fb2;};'use strict';var EventEmitter=require(_0x8675('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x8675('0x1')];var ChatMessage=require(_0x8675('0x2'))['db'][_0x8675('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8675('0x4'),'afterUpdate':_0x8675('0x5'),'afterDestroy':'remove'};function emitEvent(_0x813881){return function(_0x9bff78,_0x18bee8,_0x56852f){_0x9bff78[_0x8675('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25c4f3){_0x9bff78[_0x8675('0x7')]('Users',_0x25c4f3[_0x8675('0x8')](function(_0x3b5d76){return{'id':_0x3b5d76['id']};}));return ChatMessage[_0x8675('0x9')]({'where':{'ChatInteractionId':_0x9bff78['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x228284){_0x9bff78['setDataValue'](_0x8675('0xa'),_0x228284['length']);ChatInteractionEvents[_0x8675('0xb')](_0x813881+':'+_0x9bff78['id'],_0x9bff78);ChatInteractionEvents[_0x8675('0xb')](_0x813881,_0x9bff78);_0x56852f(null);})[_0x8675('0xc')](_0x56852f(null));};}for(var e in events){if(events[_0x8675('0xd')](e)){var event=events[e];ChatInteraction[_0x8675('0xe')](e,emitEvent(event));}}module[_0x8675('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x7b43=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x42b030,_0x252cb6){var _0x112303=function(_0x261838){while(--_0x261838){_0x42b030['push'](_0x42b030['shift']());}};_0x112303(++_0x252cb6);}(_0x7b43,0x1ea));var _0x37b4=function(_0xf0884,_0x436054){_0xf0884=_0xf0884-0x0;var _0x1be9a8=_0x7b43[_0xf0884];return _0x1be9a8;};'use strict';var EventEmitter=require(_0x37b4('0x0'));var ChatInteraction=require(_0x37b4('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x37b4('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x37b4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x37b4('0x3'),'afterDestroy':_0x37b4('0x4')};function emitEvent(_0x2167b2){return function(_0x513005,_0x4b08b7,_0x5767e2){_0x513005[_0x37b4('0x5')]({'attributes':['id'],'raw':!![]})[_0x37b4('0x6')](function(_0x3f238f){_0x513005[_0x37b4('0x7')](_0x37b4('0x8'),_0x3f238f[_0x37b4('0x9')](function(_0x5b2ce4){return{'id':_0x5b2ce4['id']};}));return ChatMessage[_0x37b4('0xa')]({'where':{'ChatInteractionId':_0x513005['id'],'direction':'in','read':![]},'raw':!![]});})[_0x37b4('0x6')](function(_0x2e2e1e){_0x513005['setDataValue'](_0x37b4('0xb'),_0x2e2e1e[_0x37b4('0xc')]);ChatInteractionEvents['emit'](_0x2167b2+':'+_0x513005['id'],_0x513005);ChatInteractionEvents[_0x37b4('0xd')](_0x2167b2,_0x513005);_0x5767e2(null);})[_0x37b4('0xe')](_0x5767e2(null));};}for(var e in events){if(events[_0x37b4('0xf')](e)){var event=events[e];ChatInteraction[_0x37b4('0x10')](e,emitEvent(event));}}module[_0x37b4('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fe24e1c..ac49887 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 _0x3d8b=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x3d8b,0x9b));var _0xb3d8=function(_0x1853d1,_0x188d19){_0x1853d1=_0x1853d1-0x0;var _0x5d3703=_0x3d8b[_0x1853d1];return _0x5d3703;};'use strict';var _=require(_0xb3d8('0x0'));var util=require(_0xb3d8('0x1'));var logger=require(_0xb3d8('0x2'))('api');var moment=require(_0xb3d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3d8('0x5'));var config=require(_0xb3d8('0x6'));var attributes=require('./chatInteraction.attributes');module[_0xb3d8('0x7')]=function(_0x245caf,_0x2e1f73){return _0x245caf[_0xb3d8('0x8')](_0xb3d8('0x9'),attributes,{'tableName':_0xb3d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x521a26,_0xeebccf,_0x2e7313){if(_0x521a26[_0xb3d8('0xb')](_0xb3d8('0xc'))){_0x521a26['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2e7313(null,_0x521a26);}},'charset':'utf8mb4','collate':_0xb3d8('0xd')});}; \ No newline at end of file +var _0xe971=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe971,0x197));var _0x1e97=function(_0x1eb357,_0x1d140a){_0x1eb357=_0x1eb357-0x0;var _0xf94da=_0xe971[_0x1eb357];return _0xf94da;};'use strict';var _=require('lodash');var util=require(_0x1e97('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1e97('0x1'));var BPromise=require(_0x1e97('0x2'));var rp=require(_0x1e97('0x3'));var fs=require('fs');var path=require(_0x1e97('0x4'));var rimraf=require(_0x1e97('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e97('0x6'));module[_0x1e97('0x7')]=function(_0x39a150,_0x4fc255){return _0x39a150[_0x1e97('0x8')](_0x1e97('0x9'),attributes,{'tableName':_0x1e97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e1e6e,_0x4fb987,_0x202c32){if(_0x4e1e6e['changed'](_0x1e97('0xb'))){_0x4e1e6e['closedAt']=moment()[_0x1e97('0xc')](_0x1e97('0xd'));}_0x202c32(null,_0x4e1e6e);}},'charset':'utf8mb4','collate':_0x1e97('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b34c69b..e78de79 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 _0x3523=['spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','AddTagsToChatInteraction','find','addTags','ids'];(function(_0x4cbc38,_0xc6e5fc){var _0x298c45=function(_0x3c66ed){while(--_0x3c66ed){_0x4cbc38['push'](_0x4cbc38['shift']());}};_0x298c45(++_0xc6e5fc);}(_0x3523,0xa6));var _0x3352=function(_0x4facd0,_0xf373ea){_0x4facd0=_0x4facd0-0x0;var _0x24829e=_0x3523[_0x4facd0];return _0x24829e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3352('0x0'));var BPromise=require(_0x3352('0x1'));var rs=require(_0x3352('0x2'));var fs=require('fs');var Redis=require(_0x3352('0x3'));var db=require(_0x3352('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3352('0x5'))(_0x3352('0x6'));var config=require('../../config/environment');var jayson=require(_0x3352('0x7'));var client=jayson[_0x3352('0x8')][_0x3352('0x9')]({'port':0x232a});config[_0x3352('0xa')]=_[_0x3352('0xb')](config['redis'],{'host':_0x3352('0xc'),'port':0x18eb});var socket=require(_0x3352('0xd'))(new Redis(config[_0x3352('0xa')]));require(_0x3352('0xe'))[_0x3352('0xf')](socket);function respondWithRpcPromise(_0x4a74ad,_0x570a7d,_0x57cfef){return new BPromise(function(_0x4a17d3,_0x12269e){return client['request'](_0x4a74ad,_0x57cfef)[_0x3352('0x10')](function(_0x8b9935){logger['info'](_0x3352('0x11'),_0x570a7d,_0x3352('0x12'));logger[_0x3352('0x13')](_0x3352('0x14'),_0x570a7d,_0x3352('0x12'),JSON[_0x3352('0x15')](_0x8b9935));if(_0x8b9935[_0x3352('0x16')]){if(_0x8b9935[_0x3352('0x16')][_0x3352('0x17')]===0x1f4){logger[_0x3352('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x570a7d,_0x8b9935[_0x3352('0x16')][_0x3352('0x18')]);return _0x12269e(_0x8b9935['error'][_0x3352('0x18')]);}logger[_0x3352('0x16')](_0x3352('0x11'),_0x570a7d,_0x8b9935[_0x3352('0x16')][_0x3352('0x18')]);return _0x4a17d3(_0x8b9935['error']['message']);}else{logger[_0x3352('0x19')](_0x3352('0x11'),_0x570a7d,_0x3352('0x12'));_0x4a17d3(_0x8b9935[_0x3352('0x1a')]['message']);}})[_0x3352('0x1b')](function(_0x15d807){logger[_0x3352('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x570a7d,_0x15d807);_0x12269e(_0x15d807);});});}exports[_0x3352('0x1c')]=function(_0x1faac2){var _0x5a77d0=this;return new Promise(function(_0x4b6da4,_0x5b8575){return db[_0x3352('0x1d')]['update'](_0x1faac2[_0x3352('0x1e')],{'raw':_0x1faac2['options']?_0x1faac2[_0x3352('0x1f')][_0x3352('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')][_0x3352('0x21')]||null:null,'attributes':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')][_0x3352('0x22')]||null:null,'limit':_0x1faac2[_0x3352('0x1f')]?_0x1faac2[_0x3352('0x1f')]['limit']||null:null})[_0x3352('0x10')](function(_0x3bef56){logger['info']('UpdateChatInteraction',_0x1faac2);logger[_0x3352('0x13')](_0x3352('0x1c'),_0x1faac2,JSON[_0x3352('0x15')](_0x3bef56));_0x4b6da4(_0x3bef56);})[_0x3352('0x1b')](function(_0x4faa71){logger[_0x3352('0x16')]('UpdateChatInteraction',_0x4faa71[_0x3352('0x18')],_0x1faac2);_0x5b8575(_0x5a77d0[_0x3352('0x16')](0x1f4,_0x4faa71[_0x3352('0x18')]));});});};exports[_0x3352('0x23')]=function(_0x3006e0){return new Promise(function(_0x405006,_0x507531){return db[_0x3352('0x1d')][_0x3352('0x24')]({'where':_0x3006e0[_0x3352('0x1f')]?_0x3006e0[_0x3352('0x1f')]['where']||null:null})[_0x3352('0x10')](function(_0x398b15){if(_0x398b15){return _0x398b15[_0x3352('0x25')](_0x3006e0[_0x3352('0x1e')][_0x3352('0x26')],_['omit'](_0x3006e0[_0x3352('0x1e')],[_0x3352('0x26'),'id'])||{});}})[_0x3352('0x27')](function(_0x587458){logger[_0x3352('0x19')](_0x3352('0x28'),_0x3006e0);logger[_0x3352('0x13')](_0x3352('0x28'),_0x3006e0,JSON[_0x3352('0x15')](_0x587458));_0x405006(_0x587458);})[_0x3352('0x1b')](function(_0xfe973a){logger[_0x3352('0x16')]('AddTags',_0xfe973a[_0x3352('0x18')],_0x3006e0);_0x507531(_this[_0x3352('0x16')](0x1f4,_0xfe973a[_0x3352('0x18')]));});});}; \ No newline at end of file +var _0x0b76=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find'];(function(_0x28689b,_0x2cbbcf){var _0x104f1c=function(_0x25279a){while(--_0x25279a){_0x28689b['push'](_0x28689b['shift']());}};_0x104f1c(++_0x2cbbcf);}(_0x0b76,0x7c));var _0x60b7=function(_0x645a1f,_0x1443fe){_0x645a1f=_0x645a1f-0x0;var _0xb3e120=_0x0b76[_0x645a1f];return _0xb3e120;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var moment=require(_0x60b7('0x2'));var BPromise=require(_0x60b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x60b7('0x6'));var client=jayson[_0x60b7('0x7')][_0x60b7('0x8')]({'port':0x232a});config[_0x60b7('0x9')]=_[_0x60b7('0xa')](config[_0x60b7('0x9')],{'host':_0x60b7('0xb'),'port':0x18eb});var socket=require(_0x60b7('0xc'))(new Redis(config[_0x60b7('0x9')]));require('./chatInteraction.socket')[_0x60b7('0xd')](socket);function respondWithRpcPromise(_0x5093fc,_0x3b91ed,_0x40009c){return new BPromise(function(_0x4896a0,_0x35f93b){return client[_0x60b7('0xe')](_0x5093fc,_0x40009c)[_0x60b7('0xf')](function(_0x544681){logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x3b91ed,_0x60b7('0x12'));logger[_0x60b7('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3b91ed,_0x60b7('0x12'),JSON[_0x60b7('0x14')](_0x544681));if(_0x544681[_0x60b7('0x15')]){if(_0x544681[_0x60b7('0x15')][_0x60b7('0x16')]===0x1f4){logger[_0x60b7('0x15')](_0x60b7('0x11'),_0x3b91ed,_0x544681[_0x60b7('0x15')][_0x60b7('0x17')]);return _0x35f93b(_0x544681[_0x60b7('0x15')][_0x60b7('0x17')]);}logger[_0x60b7('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3b91ed,_0x544681[_0x60b7('0x15')][_0x60b7('0x17')]);return _0x4896a0(_0x544681['error'][_0x60b7('0x17')]);}else{logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x3b91ed,'request\x20sent');_0x4896a0(_0x544681[_0x60b7('0x18')][_0x60b7('0x17')]);}})[_0x60b7('0x19')](function(_0x47f50b){logger[_0x60b7('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3b91ed,_0x47f50b);_0x35f93b(_0x47f50b);});});}exports[_0x60b7('0x1a')]=function(_0x42aeed){var _0x108777=this;return new Promise(function(_0x315d50,_0x56da52){return db[_0x60b7('0x1b')]['update'](_0x42aeed[_0x60b7('0x1c')],{'raw':_0x42aeed[_0x60b7('0x1d')]?_0x42aeed[_0x60b7('0x1d')][_0x60b7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42aeed['options']?_0x42aeed[_0x60b7('0x1d')][_0x60b7('0x1f')]||null:null,'attributes':_0x42aeed[_0x60b7('0x1d')]?_0x42aeed[_0x60b7('0x1d')][_0x60b7('0x20')]||null:null,'limit':_0x42aeed[_0x60b7('0x1d')]?_0x42aeed['options'][_0x60b7('0x21')]||null:null})[_0x60b7('0xf')](function(_0x1db8bf){logger[_0x60b7('0x10')](_0x60b7('0x1a'),_0x42aeed);logger[_0x60b7('0x13')](_0x60b7('0x1a'),_0x42aeed,JSON[_0x60b7('0x14')](_0x1db8bf));_0x315d50(_0x1db8bf);})[_0x60b7('0x19')](function(_0x66cd3c){logger[_0x60b7('0x15')]('UpdateChatInteraction',_0x66cd3c[_0x60b7('0x17')],_0x42aeed);_0x56da52(_0x108777[_0x60b7('0x15')](0x1f4,_0x66cd3c['message']));});});};exports[_0x60b7('0x22')]=function(_0x424c01){return new Promise(function(_0x353619,_0x5ebf01){return db['ChatInteraction'][_0x60b7('0x23')]({'where':_0x424c01[_0x60b7('0x1d')]?_0x424c01['options']['where']||null:null})[_0x60b7('0xf')](function(_0x320748){if(_0x320748){return _0x320748[_0x60b7('0x24')](_0x424c01[_0x60b7('0x1c')][_0x60b7('0x25')],_['omit'](_0x424c01[_0x60b7('0x1c')],['ids','id'])||{});}})[_0x60b7('0x26')](function(_0x50abd6){logger[_0x60b7('0x10')](_0x60b7('0x27'),_0x424c01);logger[_0x60b7('0x13')](_0x60b7('0x27'),_0x424c01,JSON[_0x60b7('0x14')](_0x50abd6));_0x353619(_0x50abd6);})['catch'](function(_0x4abf0b){logger[_0x60b7('0x15')](_0x60b7('0x27'),_0x4abf0b[_0x60b7('0x17')],_0x424c01);_0x5ebf01(_this[_0x60b7('0x15')](0x1f4,_0x4abf0b['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index bf0d2b3..37c1407 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 _0x5e93=['register','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x40b7ea,_0x550490){var _0x2627ec=function(_0x78fd8e){while(--_0x78fd8e){_0x40b7ea['push'](_0x40b7ea['shift']());}};_0x2627ec(++_0x550490);}(_0x5e93,0x174));var _0x35e9=function(_0x300429,_0x310e7a){_0x300429=_0x300429-0x0;var _0x5d433c=_0x5e93[_0x300429];return _0x5d433c;};'use strict';var ChatInteractionEvents=require(_0x35e9('0x0'));var events=[_0x35e9('0x1'),_0x35e9('0x2'),_0x35e9('0x3')];function createListener(_0xe13072,_0x311857){return function(_0x2802d0){_0x311857[_0x35e9('0x4')](_0xe13072,_0x2802d0);};}function removeListener(_0x37d735,_0x26a7b6){return function(){ChatInteractionEvents[_0x35e9('0x5')](_0x37d735,_0x26a7b6);};}exports[_0x35e9('0x6')]=function(_0x47d2a8){for(var _0x115d4c=0x0,_0x28a267=events['length'];_0x115d4c<_0x28a267;_0x115d4c++){var _0x5df77d=events[_0x115d4c];var _0x205178=createListener('chatInteraction:'+_0x5df77d,_0x47d2a8);ChatInteractionEvents['on'](_0x5df77d,_0x205178);}}; \ No newline at end of file +var _0x7056=['chatInteraction:','remove','emit','removeListener','register','length'];(function(_0x518c55,_0x133a5c){var _0x11c781=function(_0x123faf){while(--_0x123faf){_0x518c55['push'](_0x518c55['shift']());}};_0x11c781(++_0x133a5c);}(_0x7056,0x1f3));var _0x6705=function(_0x376761,_0xda556b){_0x376761=_0x376761-0x0;var _0xb883bf=_0x7056[_0x376761];return _0xb883bf;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x6705('0x0'),'update'];function createListener(_0x197327,_0xbd2009){return function(_0x14f496){_0xbd2009[_0x6705('0x1')](_0x197327,_0x14f496);};}function removeListener(_0x2c3ff8,_0x4f22a8){return function(){ChatInteractionEvents[_0x6705('0x2')](_0x2c3ff8,_0x4f22a8);};}exports[_0x6705('0x3')]=function(_0x1fca84){for(var _0x5d898e=0x0,_0x214ae2=events[_0x6705('0x4')];_0x5d898e<_0x214ae2;_0x5d898e++){var _0xa862b1=events[_0x5d898e];var _0xd0ae8e=createListener(_0x6705('0x5')+_0xa862b1,_0x1fca84);ChatInteractionEvents['on'](_0xa862b1,_0xd0ae8e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 58a4d0d..66caa55 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 _0x957c=['join','server/files/attachments/','format','now','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chatinteraction:addtags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','createVidaooSession','diskStorage'];(function(_0x2d23fa,_0x3487e7){var _0x5992a8=function(_0x3b2a79){while(--_0x3b2a79){_0x2d23fa['push'](_0x2d23fa['shift']());}};_0x5992a8(++_0x3487e7);}(_0x957c,0x102));var _0xc957=function(_0x45db27,_0x54699a){_0x45db27=_0x45db27-0x0;var _0x5a8977=_0x957c[_0x45db27];return _0x5a8977;};'use strict';var multer=require('multer');var util=require(_0xc957('0x0'));var path=require(_0xc957('0x1'));var timeout=require(_0xc957('0x2'));var express=require(_0xc957('0x3'));var router=express[_0xc957('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc957('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc957('0x6'));router['get']('/',auth[_0xc957('0x7')](),controller[_0xc957('0x8')]);router[_0xc957('0x9')](_0xc957('0xa'),auth['isAuthenticated'](),controller[_0xc957('0xb')]);router['get'](_0xc957('0xc'),auth[_0xc957('0xd')](),controller[_0xc957('0xe')]);router[_0xc957('0x9')](_0xc957('0xf'),auth[_0xc957('0xd')](),controller[_0xc957('0x10')]);router[_0xc957('0x9')](_0xc957('0x11'),auth[_0xc957('0x7')](),controller['getMessages']);router['get'](_0xc957('0x12'),auth[_0xc957('0xd')](),controller['getMyMessages']);router[_0xc957('0x9')](_0xc957('0x13'),auth[_0xc957('0x7')](),controller[_0xc957('0x14')]);router['post']('/',auth[_0xc957('0x7')](),controller['create']);router[_0xc957('0x15')]('/:id/vidaoo',auth[_0xc957('0x7')](),controller[_0xc957('0x16')]);var upload=multer({'storage':multer[_0xc957('0x17')]({'destination':function(_0x2af877,_0x3fd3a2,_0x5e4da4){_0x5e4da4(null,path[_0xc957('0x18')](config['root'],_0xc957('0x19')));},'filename':function(_0x41c034,_0x2ad0cb,_0x1f240a){_0x1f240a(null,util[_0xc957('0x1a')]('%s-%s',Date[_0xc957('0x1b')](),_0x2ad0cb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc957('0x1c'),upload[_0xc957('0x1d')](_0xc957('0x1e')),controller['attachmentUpload']);router['post'](_0xc957('0x11'),auth[_0xc957('0xd')](),controller[_0xc957('0x1f')]);router[_0xc957('0x15')](_0xc957('0x20'),auth[_0xc957('0x7')](),interaction[_0xc957('0x21')]('chat',_0xc957('0x22')),controller['addTags']);router[_0xc957('0x23')](_0xc957('0xc'),auth[_0xc957('0x7')](),interaction['tracked'](_0xc957('0x24'),_0xc957('0x25')),controller[_0xc957('0x26')]);router[_0xc957('0x23')](_0xc957('0x27'),controller[_0xc957('0x28')]);router[_0xc957('0x23')](_0xc957('0x29'),auth['isChatInteractionAuthorized'](),controller[_0xc957('0x2a')]);router[_0xc957('0x23')]('/:id/close',controller['close']);router[_0xc957('0x2b')]('/:id',auth[_0xc957('0x7')](),interaction[_0xc957('0x21')](_0xc957('0x24'),'chatinteraction:destroy'),controller[_0xc957('0x2c')]);router[_0xc957('0x2b')](_0xc957('0x20'),auth[_0xc957('0x7')](),controller[_0xc957('0x2d')]);module[_0xc957('0x2e')]=router; \ No newline at end of file +var _0xa7d8=['/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','%s-%s','originalname','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','describe','get','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages'];(function(_0x44776f,_0x198ac7){var _0x379bbd=function(_0x523ffb){while(--_0x523ffb){_0x44776f['push'](_0x44776f['shift']());}};_0x379bbd(++_0x198ac7);}(_0xa7d8,0xaf));var _0x8a7d=function(_0x521aa7,_0x38a57a){_0x521aa7=_0x521aa7-0x0;var _0x3c0b72=_0xa7d8[_0x521aa7];return _0x3c0b72;};'use strict';var multer=require(_0x8a7d('0x0'));var util=require(_0x8a7d('0x1'));var path=require(_0x8a7d('0x2'));var timeout=require(_0x8a7d('0x3'));var express=require(_0x8a7d('0x4'));var router=express[_0x8a7d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8a7d('0x6'));var config=require(_0x8a7d('0x7'));var controller=require(_0x8a7d('0x8'));router['get']('/',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0xa')]);router['get']('/describe',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0xb')]);router[_0x8a7d('0xc')](_0x8a7d('0xd'),auth[_0x8a7d('0xe')](),controller[_0x8a7d('0xf')]);router['get'](_0x8a7d('0x10'),auth[_0x8a7d('0xe')](),controller['attachmentDownload']);router[_0x8a7d('0xc')](_0x8a7d('0x11'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x12')]);router['get'](_0x8a7d('0x13'),auth[_0x8a7d('0xe')](),controller[_0x8a7d('0x14')]);router[_0x8a7d('0xc')](_0x8a7d('0x15'),auth['isAuthenticated'](),controller[_0x8a7d('0x16')]);router[_0x8a7d('0x17')]('/',auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x18')]);router[_0x8a7d('0x17')](_0x8a7d('0x19'),auth['isAuthenticated'](),controller[_0x8a7d('0x1a')]);var upload=multer({'storage':multer[_0x8a7d('0x1b')]({'destination':function(_0x248ad6,_0x5c9abe,_0x4a91ec){_0x4a91ec(null,path[_0x8a7d('0x1c')](config['root'],'server/files/attachments/'));},'filename':function(_0x3c9f8a,_0x18f4eb,_0x5b2cb3){_0x5b2cb3(null,util['format'](_0x8a7d('0x1d'),Date['now'](),_0x18f4eb[_0x8a7d('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8a7d('0x17')]('/:id/attachment_upload',upload['single'](_0x8a7d('0x1f')),controller['attachmentUpload']);router[_0x8a7d('0x17')](_0x8a7d('0x11'),auth[_0x8a7d('0xe')](),controller[_0x8a7d('0x20')]);router[_0x8a7d('0x17')](_0x8a7d('0x21'),auth[_0x8a7d('0x9')](),interaction[_0x8a7d('0x22')](_0x8a7d('0x23'),_0x8a7d('0x24')),controller['addTags']);router[_0x8a7d('0x25')](_0x8a7d('0xd'),auth[_0x8a7d('0x9')](),interaction[_0x8a7d('0x22')](_0x8a7d('0x23'),'chatinteraction:update'),controller[_0x8a7d('0x26')]);router[_0x8a7d('0x25')](_0x8a7d('0x27'),controller[_0x8a7d('0x28')]);router['put'](_0x8a7d('0x29'),auth[_0x8a7d('0xe')](),controller[_0x8a7d('0x2a')]);router[_0x8a7d('0x25')](_0x8a7d('0x2b'),controller['close']);router[_0x8a7d('0x2c')]('/:id',auth[_0x8a7d('0x9')](),interaction['tracked'](_0x8a7d('0x23'),_0x8a7d('0x2d')),controller[_0x8a7d('0x2e')]);router[_0x8a7d('0x2c')](_0x8a7d('0x21'),auth[_0x8a7d('0x9')](),controller[_0x8a7d('0x2f')]);module[_0x8a7d('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 122c007..0ffb3cf 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 _0xbad5=['TEXT','INTEGER','sequelize','exports'];(function(_0x1616d3,_0x1e12aa){var _0x3707a9=function(_0x101533){while(--_0x101533){_0x1616d3['push'](_0x1616d3['shift']());}};_0x3707a9(++_0x1e12aa);}(_0xbad5,0x106));var _0x5bad=function(_0x45bb37,_0x27793c){_0x45bb37=_0x45bb37-0x0;var _0x5194bf=_0xbad5[_0x45bb37];return _0x5194bf;};'use strict';var Sequelize=require(_0x5bad('0x0'));module[_0x5bad('0x1')]={'body':{'type':Sequelize[_0x5bad('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5bad('0x3')]}}; \ No newline at end of file +var _0xd7a2=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3d73bb,_0x533136){var _0x1345f6=function(_0x4d91c3){while(--_0x4d91c3){_0x3d73bb['push'](_0x3d73bb['shift']());}};_0x1345f6(++_0x533136);}(_0xd7a2,0x12d));var _0x2d7a=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0xd7a2[_0x24b852];return _0x180ad2;};'use strict';var Sequelize=require(_0x2d7a('0x0'));module[_0x2d7a('0x1')]={'body':{'type':Sequelize[_0x2d7a('0x2')](_0x2d7a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2d7a('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x2d7a('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 5bf8885..b9b19e6 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 _0x7753=['name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','filters','filter','merge','ChatInternalMessage','count','includeAll','findAll','catch','params','keys','include','options','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','sort','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','save','update','then','destroy'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7753,0x1eb));var _0x3775=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x7753[_0x543c51];return _0x360555;};'use strict';var emlformat=require(_0x3775('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3775('0x1'));var jsonpatch=require(_0x3775('0x2'));var rp=require(_0x3775('0x3'));var moment=require(_0x3775('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3775('0x5'));var util=require(_0x3775('0x6'));var path=require(_0x3775('0x7'));var sox=require(_0x3775('0x8'));var csv=require(_0x3775('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3775('0xa'));var _=require(_0x3775('0xb'));var squel=require(_0x3775('0xc'));var crypto=require(_0x3775('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3775('0xe'));var toCsv=require(_0x3775('0x9'));var querystring=require(_0x3775('0xf'));var Papa=require('papaparse');var Redis=require(_0x3775('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3775('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3775('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3775('0x13'))['db'];config[_0x3775('0x14')]=_[_0x3775('0x15')](config[_0x3775('0x14')],{'host':_0x3775('0x16'),'port':0x18eb});var socket=require(_0x3775('0x17'))(new Redis(config[_0x3775('0x14')]));require(_0x3775('0x18'))[_0x3775('0x19')](socket);function respondWithStatusCode(_0x468c62,_0x13f5fc){_0x13f5fc=_0x13f5fc||0xcc;return function(_0x3365f5){if(_0x3365f5){return _0x468c62[_0x3775('0x1a')](_0x13f5fc);}return _0x468c62[_0x3775('0x1b')](_0x13f5fc)[_0x3775('0x1c')]();};}function respondWithResult(_0x1d5d8c,_0x326a4e){_0x326a4e=_0x326a4e||0xc8;return function(_0x5e7b97){if(_0x5e7b97){return _0x1d5d8c[_0x3775('0x1b')](_0x326a4e)[_0x3775('0x1d')](_0x5e7b97);}};}function respondWithFilteredResult(_0x3cc547,_0x3ac160){return function(_0x4bc9a2){if(_0x4bc9a2){var _0x1df5f8=typeof _0x3ac160['offset']===_0x3775('0x1e')&&typeof _0x3ac160[_0x3775('0x1f')]===_0x3775('0x1e');var _0x22bba4=_0x4bc9a2['count'];var _0xa8f0ab=_0x1df5f8?0x0:_0x3ac160[_0x3775('0x20')];var _0x574bff=_0x1df5f8?_0x4bc9a2['count']:_0x3ac160[_0x3775('0x20')]+_0x3ac160[_0x3775('0x1f')];var _0x459ce5;if(_0x574bff>=_0x22bba4){_0x574bff=_0x22bba4;_0x459ce5=0xc8;}else{_0x459ce5=0xce;}_0x3cc547[_0x3775('0x1b')](_0x459ce5);return _0x3cc547[_0x3775('0x21')](_0x3775('0x22'),_0xa8f0ab+'-'+_0x574bff+'/'+_0x22bba4)[_0x3775('0x1d')](_0x4bc9a2);}return null;};}function patchUpdates(_0x46b789){return function(_0xd30d39){try{jsonpatch['apply'](_0xd30d39,_0x46b789,!![]);}catch(_0x566686){return BPromise['reject'](_0x566686);}return _0xd30d39[_0x3775('0x23')]();};}function saveUpdates(_0x55fde2,_0x2d79d8){return function(_0x5926db){if(_0x5926db){return _0x5926db[_0x3775('0x24')](_0x55fde2)[_0x3775('0x25')](function(_0x358042){return _0x358042;});}return null;};}function removeEntity(_0x51413b,_0x441a4a){return function(_0x3a88c1){if(_0x3a88c1){return _0x3a88c1[_0x3775('0x26')]()['then'](function(){_0x51413b[_0x3775('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513c91,_0x3655bd){return function(_0x3ce2c0){if(!_0x3ce2c0){_0x513c91[_0x3775('0x1a')](0x194);}return _0x3ce2c0;};}function handleError(_0x22c560,_0x3d46a1){_0x3d46a1=_0x3d46a1||0x1f4;return function(_0xfa57e4){logger['error'](_0xfa57e4['stack']);if(_0xfa57e4[_0x3775('0x27')]){delete _0xfa57e4[_0x3775('0x27')];}_0x22c560[_0x3775('0x1b')](_0x3d46a1)[_0x3775('0x28')](_0xfa57e4);};}exports[_0x3775('0x29')]=function(_0x3f9c01,_0x93397){var _0xa174ac={},_0x21277c={},_0x4882c7={'count':0x0,'rows':[]};var _0xae154d=_[_0x3775('0x2a')](db['ChatInternalMessage'][_0x3775('0x2b')],function(_0x326dd7){return{'name':_0x326dd7[_0x3775('0x2c')],'type':_0x326dd7[_0x3775('0x2d')][_0x3775('0x2e')]};});_0x21277c['model']=_[_0x3775('0x2a')](_0xae154d,'name');_0x21277c[_0x3775('0x2f')]=_['keys'](_0x3f9c01[_0x3775('0x2f')]);_0x21277c['filters']=_[_0x3775('0x30')](_0x21277c[_0x3775('0x31')],_0x21277c[_0x3775('0x2f')]);_0xa174ac[_0x3775('0x32')]=_['intersection'](_0x21277c['model'],qs[_0x3775('0x33')](_0x3f9c01['query'][_0x3775('0x33')]));_0xa174ac[_0x3775('0x32')]=_0xa174ac[_0x3775('0x32')][_0x3775('0x34')]?_0xa174ac[_0x3775('0x32')]:_0x21277c[_0x3775('0x31')];if(!_0x3f9c01[_0x3775('0x2f')][_0x3775('0x35')](_0x3775('0x36'))){_0xa174ac[_0x3775('0x1f')]=qs['limit'](_0x3f9c01[_0x3775('0x2f')][_0x3775('0x1f')]);_0xa174ac[_0x3775('0x20')]=qs[_0x3775('0x20')](_0x3f9c01['query'][_0x3775('0x20')]);}_0xa174ac['order']=qs['sort'](_0x3f9c01[_0x3775('0x2f')]['sort']);_0xa174ac[_0x3775('0x37')]=qs[_0x3775('0x38')](_['pick'](_0x3f9c01[_0x3775('0x2f')],_0x21277c[_0x3775('0x38')]),_0xae154d);if(_0x3f9c01[_0x3775('0x2f')][_0x3775('0x39')]){_0xa174ac[_0x3775('0x37')]=_[_0x3775('0x3a')](_0xa174ac['where'],{'$or':_['map'](_0xae154d,function(_0x4e1d4a){if(_0x4e1d4a[_0x3775('0x2d')]!=='VIRTUAL'){var _0x446e2c={};_0x446e2c[_0x4e1d4a[_0x3775('0x27')]]={'$like':'%'+_0x3f9c01['query'][_0x3775('0x39')]+'%'};return _0x446e2c;}})});}_0xa174ac=_[_0x3775('0x3a')]({},_0xa174ac,_0x3f9c01['options']);var _0xd78efa={'where':_0xa174ac[_0x3775('0x37')]};return db[_0x3775('0x3b')][_0x3775('0x3c')](_0xd78efa)[_0x3775('0x25')](function(_0x347165){_0x4882c7[_0x3775('0x3c')]=_0x347165;if(_0x3f9c01[_0x3775('0x2f')][_0x3775('0x3d')]){_0xa174ac['include']=[{'all':!![]}];}return db[_0x3775('0x3b')][_0x3775('0x3e')](_0xa174ac);})['then'](function(_0x46826e){_0x4882c7['rows']=_0x46826e;return _0x4882c7;})[_0x3775('0x25')](respondWithFilteredResult(_0x93397,_0xa174ac))[_0x3775('0x3f')](handleError(_0x93397,null));};exports['show']=function(_0x2d1cef,_0x89fc98){var _0x4bad02={'raw':!![],'where':{'id':_0x2d1cef[_0x3775('0x40')]['id']}},_0x13301f={};_0x13301f[_0x3775('0x31')]=_[_0x3775('0x41')](db[_0x3775('0x3b')][_0x3775('0x2b')]);_0x13301f[_0x3775('0x2f')]=_[_0x3775('0x41')](_0x2d1cef[_0x3775('0x2f')]);_0x13301f['filters']=_['intersection'](_0x13301f[_0x3775('0x31')],_0x13301f[_0x3775('0x2f')]);_0x4bad02[_0x3775('0x32')]=_[_0x3775('0x30')](_0x13301f[_0x3775('0x31')],qs[_0x3775('0x33')](_0x2d1cef['query']['fields']));_0x4bad02[_0x3775('0x32')]=_0x4bad02['attributes'][_0x3775('0x34')]?_0x4bad02[_0x3775('0x32')]:_0x13301f[_0x3775('0x31')];if(_0x2d1cef[_0x3775('0x2f')][_0x3775('0x3d')]){_0x4bad02[_0x3775('0x42')]=[{'all':!![]}];}_0x4bad02=_[_0x3775('0x3a')]({},_0x4bad02,_0x2d1cef[_0x3775('0x43')]);return db['ChatInternalMessage']['find'](_0x4bad02)[_0x3775('0x25')](handleEntityNotFound(_0x89fc98,null))[_0x3775('0x25')](respondWithResult(_0x89fc98,null))['catch'](handleError(_0x89fc98,null));};exports['create']=function(_0x198955,_0x141e93){return db[_0x3775('0x3b')][_0x3775('0x44')](_0x198955[_0x3775('0x45')],{})[_0x3775('0x25')](respondWithResult(_0x141e93,0xc9))[_0x3775('0x3f')](handleError(_0x141e93,null));};exports[_0x3775('0x24')]=function(_0x29d824,_0xdca0dc){if(_0x29d824['body']['id']){delete _0x29d824[_0x3775('0x45')]['id'];}return db['ChatInternalMessage'][_0x3775('0x46')]({'where':{'id':_0x29d824['params']['id']}})[_0x3775('0x25')](handleEntityNotFound(_0xdca0dc,null))[_0x3775('0x25')](saveUpdates(_0x29d824['body'],null))['then'](respondWithResult(_0xdca0dc,null))[_0x3775('0x3f')](handleError(_0xdca0dc,null));};exports[_0x3775('0x26')]=function(_0x21176f,_0x1bd415){return db[_0x3775('0x3b')][_0x3775('0x46')]({'where':{'id':_0x21176f[_0x3775('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bd415,null))['then'](removeEntity(_0x1bd415,null))['catch'](handleError(_0x1bd415,null));};exports[_0x3775('0x47')]=function(_0x5ce0e1,_0x2bdd87){return db['ChatInternalMessage'][_0x3775('0x47')]()['then'](respondWithResult(_0x2bdd87,null))['catch'](handleError(_0x2bdd87,null));};function wrapUser(_0x23fb78){return function(_0x3ace91){var _0x3bd3b1=_0x23fb78[_0x3775('0x48')]({'plain':!![]});_0x3bd3b1[_0x3775('0x49')]=[];if(_0x3ace91){_0x3bd3b1[_0x3775('0x4a')]=_0x3ace91[_0x3775('0x4b')];_0x3bd3b1[_0x3775('0x4c')]=_0x3ace91;}else{_0x3bd3b1[_0x3775('0x4a')]=moment(0x0)[_0x3775('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bd3b1['lastMessage']={};}return _0x3bd3b1;};}exports[_0x3775('0x4e')]=function(_0x52fcdf,_0x1a1fb9,_0x17aaf7){var _0x1aaa9e=[];return db[_0x3775('0x4f')][_0x3775('0x3e')]({'where':{'role':[_0x3775('0x50'),_0x3775('0x51'),_0x3775('0x52')]},'attributes':['id',_0x3775('0x53'),_0x3775('0x27'),_0x3775('0x54'),_0x3775('0x55'),_0x3775('0x56'),_0x3775('0x57'),_0x3775('0x58'),_0x3775('0x59'),'showWebBar'],'order':qs[_0x3775('0x5a')](_0x3775('0x5b')),'include':[{'model':db[_0x3775('0x5c')],'as':_0x3775('0x5d'),'attributes':['id',_0x3775('0x27'),'type'],'through':{'attributes':[]}}]})[_0x3775('0x25')](function(_0x59d144){if(_0x59d144){var _0x52c45b=_0x52fcdf['user'][_0x3775('0x48')]({'plain':!![]});if(!_0x52c45b)throw new Error(_0x3775('0x5e'));if(_0x52c45b[_0x3775('0x54')]===_0x3775('0x52')){return db[_0x3775('0x5f')]['find']({'where':{'name':_0x3775('0x60'),'userProfileId':_0x52c45b[_0x3775('0x61')]},'raw':!![]})[_0x3775('0x25')](function(_0x79e080){if(_0x79e080){if(_0x79e080[_0x3775('0x62')]===0x0){return db[_0x3775('0x63')][_0x3775('0x3e')]({'where':{'sectionId':_0x79e080['id']},'raw':!![]})['then'](function(_0x14f6c9){var _0x5eb2b0=[];if(_[_0x3775('0x64')](_0x14f6c9)){_0x5eb2b0=_['filter'](_0x59d144,function(_0x24e66e){if(_0x24e66e['role']!==_0x3775('0x50')){return _0x24e66e;}});return _0x5eb2b0;}else{for(var _0x3244e4=0x0;_0x3244e4<_0x59d144[_0x3775('0x34')];_0x3244e4++){var _0xa8862b=_0x59d144[_0x3244e4];if(_0xa8862b[_0x3775('0x54')]===_0x3775('0x50')){var _0x208f83=_[_0x3775('0x46')](_0x14f6c9,function(_0x25b7da){return _0x25b7da[_0x3775('0x65')]===_0xa8862b['id'];});if(_0x208f83)_0x5eb2b0[_0x3775('0x66')](_0xa8862b);}else{_0x5eb2b0[_0x3775('0x66')](_0xa8862b);}}return _0x5eb2b0;}});}else{return _0x59d144;}}else{var _0x154134=_['filter'](_0x59d144,function(_0x9a7833){if(_0x9a7833['role']!==_0x3775('0x50')){return _0x9a7833;}});return _0x154134;}});}else{return _0x59d144;}}})[_0x3775('0x25')](function(_0x21f7df){var _0x42a135=[];if(_0x21f7df){_0x1aaa9e=_0x21f7df;for(var _0x267052=0x0;_0x267052<_0x21f7df[_0x3775('0x34')];_0x267052+=0x1){_0x1aaa9e[_0x267052][_0x3775('0x49')]=[];_0x42a135[_0x3775('0x66')](db['ChatInternalMessage'][_0x3775('0x46')]({'where':{'FromId':[_0x52fcdf[_0x3775('0x52')]['id'],_0x21f7df[_0x267052]['id']],'ToId':[_0x52fcdf[_0x3775('0x52')]['id'],_0x21f7df[_0x267052]['id']],'ChatGroupId':null},'attributes':['id',_0x3775('0x4b'),_0x3775('0x67'),_0x3775('0x68'),_0x3775('0x69'),_0x3775('0x45')],'order':qs[_0x3775('0x5a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x21f7df[_0x267052])));}return BPromise['all'](_0x42a135);}return[];})[_0x3775('0x25')](function(_0x40a1e3){return{'rows':_0x40a1e3,'count':_0x40a1e3[_0x3775('0x34')]};})['then'](respondWithResult(_0x1a1fb9,null))[_0x3775('0x3f')](handleError(_0x1a1fb9,null));}; \ No newline at end of file +var _0xca78=['socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params','find','create','body','describe','get','messages','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','userpic','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','role','length','push','FromId','ToId','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x11b3fd,_0x296963){var _0x27e29c=function(_0x4678ec){while(--_0x4678ec){_0x11b3fd['push'](_0x11b3fd['shift']());}};_0x27e29c(++_0x296963);}(_0xca78,0xbf));var _0x8ca7=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xca78[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x8ca7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ca7('0x1'));var jsonpatch=require(_0x8ca7('0x2'));var rp=require(_0x8ca7('0x3'));var moment=require('moment');var BPromise=require(_0x8ca7('0x4'));var Mustache=require(_0x8ca7('0x5'));var util=require(_0x8ca7('0x6'));var path=require(_0x8ca7('0x7'));var sox=require(_0x8ca7('0x8'));var csv=require(_0x8ca7('0x9'));var ejs=require(_0x8ca7('0xa'));var fs=require('fs');var fs_extra=require(_0x8ca7('0xb'));var _=require(_0x8ca7('0xc'));var squel=require(_0x8ca7('0xd'));var crypto=require(_0x8ca7('0xe'));var jsforce=require(_0x8ca7('0xf'));var deskjs=require(_0x8ca7('0x10'));var toCsv=require(_0x8ca7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ca7('0x11'));var authService=require(_0x8ca7('0x12'));var qs=require(_0x8ca7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ca7('0x14'));var logger=require(_0x8ca7('0x15'))(_0x8ca7('0x16'));var utils=require(_0x8ca7('0x17'));var config=require(_0x8ca7('0x18'));var licenseUtil=require(_0x8ca7('0x19'));var db=require(_0x8ca7('0x1a'))['db'];config[_0x8ca7('0x1b')]=_['defaults'](config[_0x8ca7('0x1b')],{'host':_0x8ca7('0x1c'),'port':0x18eb});var socket=require(_0x8ca7('0x1d'))(new Redis(config['redis']));require(_0x8ca7('0x1e'))[_0x8ca7('0x1f')](socket);function respondWithStatusCode(_0x4643ef,_0x429872){_0x429872=_0x429872||0xcc;return function(_0x5a669d){if(_0x5a669d){return _0x4643ef[_0x8ca7('0x20')](_0x429872);}return _0x4643ef[_0x8ca7('0x21')](_0x429872)[_0x8ca7('0x22')]();};}function respondWithResult(_0x7c8ffb,_0x5aa2b6){_0x5aa2b6=_0x5aa2b6||0xc8;return function(_0x3cf3b6){if(_0x3cf3b6){return _0x7c8ffb[_0x8ca7('0x21')](_0x5aa2b6)[_0x8ca7('0x23')](_0x3cf3b6);}};}function respondWithFilteredResult(_0x3c3c56,_0x2c7714){return function(_0x31ed37){if(_0x31ed37){var _0x180fab=typeof _0x2c7714[_0x8ca7('0x24')]===_0x8ca7('0x25')&&typeof _0x2c7714[_0x8ca7('0x26')]==='undefined';var _0x171979=_0x31ed37[_0x8ca7('0x27')];var _0x587f58=_0x180fab?0x0:_0x2c7714['offset'];var _0x64e02f=_0x180fab?_0x31ed37[_0x8ca7('0x27')]:_0x2c7714[_0x8ca7('0x24')]+_0x2c7714[_0x8ca7('0x26')];var _0x3d4395;if(_0x64e02f>=_0x171979){_0x64e02f=_0x171979;_0x3d4395=0xc8;}else{_0x3d4395=0xce;}_0x3c3c56[_0x8ca7('0x21')](_0x3d4395);return _0x3c3c56[_0x8ca7('0x28')](_0x8ca7('0x29'),_0x587f58+'-'+_0x64e02f+'/'+_0x171979)[_0x8ca7('0x23')](_0x31ed37);}return null;};}function patchUpdates(_0x39666c){return function(_0x1e4f60){try{jsonpatch[_0x8ca7('0x2a')](_0x1e4f60,_0x39666c,!![]);}catch(_0x2e451c){return BPromise['reject'](_0x2e451c);}return _0x1e4f60['save']();};}function saveUpdates(_0x2e1cb0,_0x43c51e){return function(_0x313da5){if(_0x313da5){return _0x313da5[_0x8ca7('0x2b')](_0x2e1cb0)[_0x8ca7('0x2c')](function(_0x292fe2){return _0x292fe2;});}return null;};}function removeEntity(_0x3d2319,_0x5835b5){return function(_0x3c608a){if(_0x3c608a){return _0x3c608a[_0x8ca7('0x2d')]()[_0x8ca7('0x2c')](function(){_0x3d2319[_0x8ca7('0x21')](0xcc)[_0x8ca7('0x22')]();});}};}function handleEntityNotFound(_0x3f0d8d,_0x6d88da){return function(_0x35eb24){if(!_0x35eb24){_0x3f0d8d[_0x8ca7('0x20')](0x194);}return _0x35eb24;};}function handleError(_0x30e2f4,_0x1bb7bb){_0x1bb7bb=_0x1bb7bb||0x1f4;return function(_0xba8944){logger['error'](_0xba8944[_0x8ca7('0x2e')]);if(_0xba8944[_0x8ca7('0x2f')]){delete _0xba8944[_0x8ca7('0x2f')];}_0x30e2f4['status'](_0x1bb7bb)[_0x8ca7('0x30')](_0xba8944);};}exports[_0x8ca7('0x31')]=function(_0x15f10f,_0x53cc0b){var _0x36112f={},_0x164222={},_0x5dffd6={'count':0x0,'rows':[]};var _0x1d6af5=_['map'](db[_0x8ca7('0x32')][_0x8ca7('0x33')],function(_0x2abd4d){return{'name':_0x2abd4d[_0x8ca7('0x34')],'type':_0x2abd4d[_0x8ca7('0x35')][_0x8ca7('0x36')]};});_0x164222[_0x8ca7('0x37')]=_['map'](_0x1d6af5,_0x8ca7('0x2f'));_0x164222[_0x8ca7('0x38')]=_[_0x8ca7('0x39')](_0x15f10f[_0x8ca7('0x38')]);_0x164222[_0x8ca7('0x3a')]=_[_0x8ca7('0x3b')](_0x164222['model'],_0x164222[_0x8ca7('0x38')]);_0x36112f[_0x8ca7('0x3c')]=_['intersection'](_0x164222[_0x8ca7('0x37')],qs[_0x8ca7('0x3d')](_0x15f10f['query']['fields']));_0x36112f[_0x8ca7('0x3c')]=_0x36112f['attributes']['length']?_0x36112f[_0x8ca7('0x3c')]:_0x164222[_0x8ca7('0x37')];if(!_0x15f10f['query'][_0x8ca7('0x3e')](_0x8ca7('0x3f'))){_0x36112f[_0x8ca7('0x26')]=qs[_0x8ca7('0x26')](_0x15f10f[_0x8ca7('0x38')][_0x8ca7('0x26')]);_0x36112f[_0x8ca7('0x24')]=qs[_0x8ca7('0x24')](_0x15f10f[_0x8ca7('0x38')]['offset']);}_0x36112f[_0x8ca7('0x40')]=qs['sort'](_0x15f10f[_0x8ca7('0x38')][_0x8ca7('0x41')]);_0x36112f[_0x8ca7('0x42')]=qs[_0x8ca7('0x3a')](_[_0x8ca7('0x43')](_0x15f10f[_0x8ca7('0x38')],_0x164222['filters']),_0x1d6af5);if(_0x15f10f['query'][_0x8ca7('0x44')]){_0x36112f['where']=_[_0x8ca7('0x45')](_0x36112f[_0x8ca7('0x42')],{'$or':_[_0x8ca7('0x46')](_0x1d6af5,function(_0x53906f){if(_0x53906f[_0x8ca7('0x35')]!==_0x8ca7('0x47')){var _0x1a2537={};_0x1a2537[_0x53906f[_0x8ca7('0x2f')]]={'$like':'%'+_0x15f10f[_0x8ca7('0x38')][_0x8ca7('0x44')]+'%'};return _0x1a2537;}})});}_0x36112f=_[_0x8ca7('0x45')]({},_0x36112f,_0x15f10f['options']);var _0x10e926={'where':_0x36112f[_0x8ca7('0x42')]};return db[_0x8ca7('0x32')][_0x8ca7('0x27')](_0x10e926)[_0x8ca7('0x2c')](function(_0x164959){_0x5dffd6[_0x8ca7('0x27')]=_0x164959;if(_0x15f10f[_0x8ca7('0x38')][_0x8ca7('0x48')]){_0x36112f[_0x8ca7('0x49')]=[{'all':!![]}];}return db[_0x8ca7('0x32')][_0x8ca7('0x4a')](_0x36112f);})[_0x8ca7('0x2c')](function(_0x925ad9){_0x5dffd6['rows']=_0x925ad9;return _0x5dffd6;})['then'](respondWithFilteredResult(_0x53cc0b,_0x36112f))[_0x8ca7('0x4b')](handleError(_0x53cc0b,null));};exports[_0x8ca7('0x4c')]=function(_0x45d170,_0x1aff88){var _0x4e0591={'raw':!![],'where':{'id':_0x45d170[_0x8ca7('0x4d')]['id']}},_0x2fbdfa={};_0x2fbdfa['model']=_[_0x8ca7('0x39')](db['ChatInternalMessage'][_0x8ca7('0x33')]);_0x2fbdfa['query']=_['keys'](_0x45d170[_0x8ca7('0x38')]);_0x2fbdfa[_0x8ca7('0x3a')]=_['intersection'](_0x2fbdfa[_0x8ca7('0x37')],_0x2fbdfa[_0x8ca7('0x38')]);_0x4e0591[_0x8ca7('0x3c')]=_[_0x8ca7('0x3b')](_0x2fbdfa[_0x8ca7('0x37')],qs[_0x8ca7('0x3d')](_0x45d170['query']['fields']));_0x4e0591[_0x8ca7('0x3c')]=_0x4e0591[_0x8ca7('0x3c')]['length']?_0x4e0591[_0x8ca7('0x3c')]:_0x2fbdfa['model'];if(_0x45d170['query'][_0x8ca7('0x48')]){_0x4e0591['include']=[{'all':!![]}];}_0x4e0591=_[_0x8ca7('0x45')]({},_0x4e0591,_0x45d170['options']);return db['ChatInternalMessage'][_0x8ca7('0x4e')](_0x4e0591)[_0x8ca7('0x2c')](handleEntityNotFound(_0x1aff88,null))[_0x8ca7('0x2c')](respondWithResult(_0x1aff88,null))[_0x8ca7('0x4b')](handleError(_0x1aff88,null));};exports[_0x8ca7('0x4f')]=function(_0x5d6063,_0x2efe62){return db[_0x8ca7('0x32')][_0x8ca7('0x4f')](_0x5d6063[_0x8ca7('0x50')],{})[_0x8ca7('0x2c')](respondWithResult(_0x2efe62,0xc9))[_0x8ca7('0x4b')](handleError(_0x2efe62,null));};exports[_0x8ca7('0x2b')]=function(_0x1e7219,_0x5ce6f4){if(_0x1e7219[_0x8ca7('0x50')]['id']){delete _0x1e7219['body']['id'];}return db[_0x8ca7('0x32')][_0x8ca7('0x4e')]({'where':{'id':_0x1e7219[_0x8ca7('0x4d')]['id']}})[_0x8ca7('0x2c')](handleEntityNotFound(_0x5ce6f4,null))[_0x8ca7('0x2c')](saveUpdates(_0x1e7219['body'],null))[_0x8ca7('0x2c')](respondWithResult(_0x5ce6f4,null))[_0x8ca7('0x4b')](handleError(_0x5ce6f4,null));};exports['destroy']=function(_0xe9e1d3,_0x4ad208){return db[_0x8ca7('0x32')][_0x8ca7('0x4e')]({'where':{'id':_0xe9e1d3[_0x8ca7('0x4d')]['id']}})[_0x8ca7('0x2c')](handleEntityNotFound(_0x4ad208,null))[_0x8ca7('0x2c')](removeEntity(_0x4ad208,null))[_0x8ca7('0x4b')](handleError(_0x4ad208,null));};exports[_0x8ca7('0x51')]=function(_0x26eb9c,_0x5526a4){return db['ChatInternalMessage'][_0x8ca7('0x51')]()['then'](respondWithResult(_0x5526a4,null))[_0x8ca7('0x4b')](handleError(_0x5526a4,null));};function wrapUser(_0x24f6b3){return function(_0x158e96){var _0x38c563=_0x24f6b3[_0x8ca7('0x52')]({'plain':!![]});_0x38c563[_0x8ca7('0x53')]=[];if(_0x158e96){_0x38c563['lastMessageAt']=_0x158e96[_0x8ca7('0x54')];_0x38c563[_0x8ca7('0x55')]=_0x158e96;}else{_0x38c563['lastMessageAt']=moment(0x0)['format'](_0x8ca7('0x56'));_0x38c563[_0x8ca7('0x55')]={};}return _0x38c563;};}exports[_0x8ca7('0x57')]=function(_0x5a6f29,_0x2a6ba5,_0x204b27){var _0x418b05=[];return db[_0x8ca7('0x58')]['findAll']({'where':{'role':[_0x8ca7('0x59'),_0x8ca7('0x5a'),'user']},'attributes':['id',_0x8ca7('0x5b'),_0x8ca7('0x2f'),'role',_0x8ca7('0x5c'),'internal','online',_0x8ca7('0x5d'),'allowmessenger',_0x8ca7('0x5e')],'order':qs['sort'](_0x8ca7('0x5f')),'include':[{'model':db[_0x8ca7('0x60')],'as':_0x8ca7('0x61'),'attributes':['id',_0x8ca7('0x2f'),_0x8ca7('0x35')],'through':{'attributes':[]}}]})['then'](function(_0x2603ec){if(_0x2603ec){var _0x2c526c=_0x5a6f29['user'][_0x8ca7('0x52')]({'plain':!![]});if(!_0x2c526c)throw new Error(_0x8ca7('0x62'));if(_0x2c526c['role']===_0x8ca7('0x63')){return db[_0x8ca7('0x64')][_0x8ca7('0x4e')]({'where':{'name':'Agents','userProfileId':_0x2c526c['userProfileId']},'raw':!![]})[_0x8ca7('0x2c')](function(_0x1ad706){if(_0x1ad706){if(_0x1ad706[_0x8ca7('0x65')]===0x0){return db[_0x8ca7('0x66')][_0x8ca7('0x4a')]({'where':{'sectionId':_0x1ad706['id']},'raw':!![]})[_0x8ca7('0x2c')](function(_0x4761b6){var _0x4beb1e=[];if(_[_0x8ca7('0x67')](_0x4761b6)){_0x4beb1e=_[_0x8ca7('0x44')](_0x2603ec,function(_0x475024){if(_0x475024[_0x8ca7('0x68')]!==_0x8ca7('0x59')){return _0x475024;}});return _0x4beb1e;}else{for(var _0x174929=0x0;_0x174929<_0x2603ec[_0x8ca7('0x69')];_0x174929++){var _0x101c7e=_0x2603ec[_0x174929];if(_0x101c7e['role']===_0x8ca7('0x59')){var _0x1f30d4=_[_0x8ca7('0x4e')](_0x4761b6,function(_0xf65857){return _0xf65857['resourceId']===_0x101c7e['id'];});if(_0x1f30d4)_0x4beb1e['push'](_0x101c7e);}else{_0x4beb1e[_0x8ca7('0x6a')](_0x101c7e);}}return _0x4beb1e;}});}else{return _0x2603ec;}}else{var _0x593b34=_[_0x8ca7('0x44')](_0x2603ec,function(_0x146c53){if(_0x146c53[_0x8ca7('0x68')]!==_0x8ca7('0x59')){return _0x146c53;}});return _0x593b34;}});}else{return _0x2603ec;}}})[_0x8ca7('0x2c')](function(_0x20522d){var _0x3c55f8=[];if(_0x20522d){_0x418b05=_0x20522d;for(var _0x3a4286=0x0;_0x3a4286<_0x20522d[_0x8ca7('0x69')];_0x3a4286+=0x1){_0x418b05[_0x3a4286][_0x8ca7('0x53')]=[];_0x3c55f8[_0x8ca7('0x6a')](db['ChatInternalMessage'][_0x8ca7('0x4e')]({'where':{'FromId':[_0x5a6f29[_0x8ca7('0x63')]['id'],_0x20522d[_0x3a4286]['id']],'ToId':[_0x5a6f29['user']['id'],_0x20522d[_0x3a4286]['id']],'ChatGroupId':null},'attributes':['id',_0x8ca7('0x54'),_0x8ca7('0x6b'),_0x8ca7('0x6c'),'read',_0x8ca7('0x50')],'order':qs[_0x8ca7('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x8ca7('0x2c')](wrapUser(_0x20522d[_0x3a4286])));}return BPromise[_0x8ca7('0x6d')](_0x3c55f8);}return[];})[_0x8ca7('0x2c')](function(_0xba5843){return{'rows':_0xba5843,'count':_0xba5843[_0x8ca7('0x69')]};})[_0x8ca7('0x2c')](respondWithResult(_0x2a6ba5,null))[_0x8ca7('0x4b')](handleError(_0x2a6ba5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 52bc73a..099d88e 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 _0x9c1e=['hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dab2b,_0x573330){var _0x30aad0=function(_0x40c6b0){while(--_0x40c6b0){_0x3dab2b['push'](_0x3dab2b['shift']());}};_0x30aad0(++_0x573330);}(_0x9c1e,0x66));var _0xe9c1=function(_0x45e05c,_0x149951){_0x45e05c=_0x45e05c-0x0;var _0x877000=_0x9c1e[_0x45e05c];return _0x877000;};'use strict';var EventEmitter=require(_0xe9c1('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe9c1('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe9c1('0x2')](0x0);var events={'afterCreate':_0xe9c1('0x3'),'afterUpdate':_0xe9c1('0x4'),'afterDestroy':_0xe9c1('0x5')};function emitEvent(_0x2dd36b){return function(_0x13a41d,_0x3c7da2,_0x47a8c8){ChatInternalMessageEvents[_0xe9c1('0x6')](_0x2dd36b+':'+_0x13a41d['id'],_0x13a41d);ChatInternalMessageEvents['emit'](_0x2dd36b,_0x13a41d);_0x47a8c8(null);};}for(var e in events){if(events[_0xe9c1('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe9c1('0x8')](e,emitEvent(event));}}module[_0xe9c1('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x13c4=['exports','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x13c4,0x121));var _0x413c=function(_0x43c92a,_0x1c4901){_0x43c92a=_0x43c92a-0x0;var _0x5ebfe9=_0x13c4[_0x43c92a];return _0x5ebfe9;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x413c('0x0'))['db'][_0x413c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x413c('0x2'),'afterUpdate':_0x413c('0x3'),'afterDestroy':_0x413c('0x4')};function emitEvent(_0x194db4){return function(_0x5492e4,_0xd3c2f2,_0x124738){ChatInternalMessageEvents[_0x413c('0x5')](_0x194db4+':'+_0x5492e4['id'],_0x5492e4);ChatInternalMessageEvents[_0x413c('0x5')](_0x194db4,_0x5492e4);_0x124738(null);};}for(var e in events){if(events[_0x413c('0x6')](e)){var event=events[e];ChatInternalMessage[_0x413c('0x7')](e,emitEvent(event));}}module[_0x413c('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f049657..2fe02c7 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 _0x05f3=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes'];(function(_0x509b9d,_0x5d08e9){var _0x312b58=function(_0x314649){while(--_0x314649){_0x509b9d['push'](_0x509b9d['shift']());}};_0x312b58(++_0x5d08e9);}(_0x05f3,0x19b));var _0x305f=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x05f3[_0x25662e];return _0x59b7bc;};'use strict';var _=require(_0x305f('0x0'));var util=require(_0x305f('0x1'));var logger=require('../../config/logger')(_0x305f('0x2'));var moment=require(_0x305f('0x3'));var BPromise=require(_0x305f('0x4'));var rp=require(_0x305f('0x5'));var fs=require('fs');var path=require(_0x305f('0x6'));var rimraf=require('rimraf');var config=require(_0x305f('0x7'));var attributes=require(_0x305f('0x8'));module[_0x305f('0x9')]=function(_0x152167,_0x527440){return _0x152167[_0x305f('0xa')](_0x305f('0xb'),attributes,{'tableName':_0x305f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x305f('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x29a3=['request-promise','path','rimraf','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1a9b87,_0x4b9987){var _0x3e5a50=function(_0x488ffa){while(--_0x488ffa){_0x1a9b87['push'](_0x1a9b87['shift']());}};_0x3e5a50(++_0x4b9987);}(_0x29a3,0xa3));var _0x329a=function(_0x18c58e,_0x12e86e){_0x18c58e=_0x18c58e-0x0;var _0x5ec2e9=_0x29a3[_0x18c58e];return _0x5ec2e9;};'use strict';var _=require(_0x329a('0x0'));var util=require(_0x329a('0x1'));var logger=require(_0x329a('0x2'))(_0x329a('0x3'));var moment=require(_0x329a('0x4'));var BPromise=require('bluebird');var rp=require(_0x329a('0x5'));var fs=require('fs');var path=require(_0x329a('0x6'));var rimraf=require(_0x329a('0x7'));var config=require('../../config/environment');var attributes=require(_0x329a('0x8'));module[_0x329a('0x9')]=function(_0x146b18,_0x445b99){return _0x146b18['define'](_0x329a('0xa'),attributes,{'tableName':_0x329a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x329a('0xc'),'collate':_0x329a('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 4f564fb..f3a2b5f 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 _0x2c2b=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x555128,_0x534dae){var _0x504b88=function(_0x29b551){while(--_0x29b551){_0x555128['push'](_0x555128['shift']());}};_0x504b88(++_0x534dae);}(_0x2c2b,0x1b1));var _0xb2c2=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0x2c2b[_0x477b78];return _0x2f3f99;};'use strict';var _=require('lodash');var util=require(_0xb2c2('0x0'));var moment=require(_0xb2c2('0x1'));var BPromise=require(_0xb2c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2c2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb2c2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb2c2('0x5'));var client=jayson[_0xb2c2('0x6')][_0xb2c2('0x7')]({'port':0x232a});config[_0xb2c2('0x8')]=_[_0xb2c2('0x9')](config[_0xb2c2('0x8')],{'host':_0xb2c2('0xa'),'port':0x18eb});var socket=require(_0xb2c2('0xb'))(new Redis(config[_0xb2c2('0x8')]));require(_0xb2c2('0xc'))[_0xb2c2('0xd')](socket);function respondWithRpcPromise(_0x2280ca,_0x475bae,_0x45d1c5){return new BPromise(function(_0x32301c,_0x2876d9){return client[_0xb2c2('0xe')](_0x2280ca,_0x45d1c5)[_0xb2c2('0xf')](function(_0x19e897){logger[_0xb2c2('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x475bae,_0xb2c2('0x11'));logger[_0xb2c2('0x12')](_0xb2c2('0x13'),_0x475bae,_0xb2c2('0x11'),JSON[_0xb2c2('0x14')](_0x19e897));if(_0x19e897['error']){if(_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x16')]===0x1f4){logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x18')]);return _0x2876d9(_0x19e897[_0xb2c2('0x15')]['message']);}logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x19e897[_0xb2c2('0x15')][_0xb2c2('0x18')]);return _0x32301c(_0x19e897['error'][_0xb2c2('0x18')]);}else{logger[_0xb2c2('0x10')](_0xb2c2('0x17'),_0x475bae,_0xb2c2('0x11'));_0x32301c(_0x19e897[_0xb2c2('0x19')]['message']);}})[_0xb2c2('0x1a')](function(_0x15469b){logger[_0xb2c2('0x15')](_0xb2c2('0x17'),_0x475bae,_0x15469b);_0x2876d9(_0x15469b);});});} \ No newline at end of file +var _0x1cc7=['result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x1cc7,0x15a));var _0x71cc=function(_0x26396e,_0x39b837){_0x26396e=_0x26396e-0x0;var _0x1c237b=_0x1cc7[_0x26396e];return _0x1c237b;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71cc('0x3'))['db'];var utils=require(_0x71cc('0x4'));var logger=require(_0x71cc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71cc('0x6')]['http']({'port':0x232a});config[_0x71cc('0x7')]=_[_0x71cc('0x8')](config[_0x71cc('0x7')],{'host':_0x71cc('0x9'),'port':0x18eb});var socket=require(_0x71cc('0xa'))(new Redis(config['redis']));require(_0x71cc('0xb'))[_0x71cc('0xc')](socket);function respondWithRpcPromise(_0x47759a,_0x5ae8e7,_0x554044){return new BPromise(function(_0x50a7b7,_0x4b7514){return client[_0x71cc('0xd')](_0x47759a,_0x554044)[_0x71cc('0xe')](function(_0x37e34b){logger['info'](_0x71cc('0xf'),_0x5ae8e7,'request\x20sent');logger[_0x71cc('0x10')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5ae8e7,_0x71cc('0x11'),JSON['stringify'](_0x37e34b));if(_0x37e34b[_0x71cc('0x12')]){if(_0x37e34b[_0x71cc('0x12')][_0x71cc('0x13')]===0x1f4){logger[_0x71cc('0x12')](_0x71cc('0xf'),_0x5ae8e7,_0x37e34b['error'][_0x71cc('0x14')]);return _0x4b7514(_0x37e34b[_0x71cc('0x12')][_0x71cc('0x14')]);}logger[_0x71cc('0x12')](_0x71cc('0xf'),_0x5ae8e7,_0x37e34b[_0x71cc('0x12')][_0x71cc('0x14')]);return _0x50a7b7(_0x37e34b['error'][_0x71cc('0x14')]);}else{logger[_0x71cc('0x15')](_0x71cc('0xf'),_0x5ae8e7,_0x71cc('0x11'));_0x50a7b7(_0x37e34b[_0x71cc('0x16')][_0x71cc('0x14')]);}})['catch'](function(_0x366690){logger[_0x71cc('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ae8e7,_0x366690);_0x4b7514(_0x366690);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f3ca89c..e2a5e6e 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 _0x0c3a=['register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0c3a,0x1d2));var _0xa0c3=function(_0x28b33c,_0x360db3){_0x28b33c=_0x28b33c-0x0;var _0x238f9d=_0x0c3a[_0x28b33c];return _0x238f9d;};'use strict';var ChatInternalMessageEvents=require(_0xa0c3('0x0'));var events=[_0xa0c3('0x1'),_0xa0c3('0x2'),_0xa0c3('0x3')];function createListener(_0x2d069c,_0x28ef30){return function(_0x27f2d1){_0x28ef30[_0xa0c3('0x4')](_0x2d069c,_0x27f2d1);};}function removeListener(_0x3ab239,_0x18b0b9){return function(){ChatInternalMessageEvents[_0xa0c3('0x5')](_0x3ab239,_0x18b0b9);};}exports[_0xa0c3('0x6')]=function(_0x9621d9){for(var _0x49d14a=0x0,_0x2dca15=events['length'];_0x49d14a<_0x2dca15;_0x49d14a++){var _0x480fa0=events[_0x49d14a];var _0x5579b4=createListener(_0xa0c3('0x7')+_0x480fa0,_0x9621d9);ChatInternalMessageEvents['on'](_0x480fa0,_0x5579b4);}}; \ No newline at end of file +var _0xe0ae=['save','remove','emit','removeListener','length','chatInternalMessage:'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe0ae,0x174));var _0xee0a=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xe0ae[_0x43aee5];return _0x76d1d0;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xee0a('0x0'),_0xee0a('0x1'),'update'];function createListener(_0x540c67,_0x38c5fb){return function(_0x592b37){_0x38c5fb[_0xee0a('0x2')](_0x540c67,_0x592b37);};}function removeListener(_0x22dbb2,_0x20b2b7){return function(){ChatInternalMessageEvents[_0xee0a('0x3')](_0x22dbb2,_0x20b2b7);};}exports['register']=function(_0x4180aa){for(var _0x402528=0x0,_0x1df3f3=events[_0xee0a('0x4')];_0x402528<_0x1df3f3;_0x402528++){var _0x2e3836=events[_0x402528];var _0x338fb2=createListener(_0xee0a('0x5')+_0x2e3836,_0x4180aa);ChatInternalMessageEvents['on'](_0x2e3836,_0x338fb2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 8cb2790..74d0d80 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 _0x97cb=['../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x14933b,_0x2cb50f){var _0x2b4ee0=function(_0x5c92d0){while(--_0x5c92d0){_0x14933b['push'](_0x14933b['shift']());}};_0x2b4ee0(++_0x2cb50f);}(_0x97cb,0x125));var _0xb97c=function(_0x5a0a6b,_0x90bce8){_0x5a0a6b=_0x5a0a6b-0x0;var _0x1cf79d=_0x97cb[_0x5a0a6b];return _0x1cf79d;};'use strict';var multer=require(_0xb97c('0x0'));var util=require(_0xb97c('0x1'));var path=require(_0xb97c('0x2'));var timeout=require(_0xb97c('0x3'));var express=require('express');var router=express[_0xb97c('0x4')]();var fs_extra=require(_0xb97c('0x5'));var auth=require(_0xb97c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb97c('0x7'));var controller=require(_0xb97c('0x8'));router[_0xb97c('0x9')]('/',auth[_0xb97c('0xa')](),controller[_0xb97c('0xb')]);router[_0xb97c('0x9')](_0xb97c('0xc'),auth[_0xb97c('0xa')](),controller[_0xb97c('0xd')]);router[_0xb97c('0x9')](_0xb97c('0xe'),auth['isAuthenticated'](),controller[_0xb97c('0xf')]);router[_0xb97c('0x9')]('/:id',auth[_0xb97c('0xa')](),controller[_0xb97c('0x10')]);router[_0xb97c('0x11')]('/',auth[_0xb97c('0xa')](),controller[_0xb97c('0x12')]);router[_0xb97c('0x13')](_0xb97c('0x14'),controller['update']);router[_0xb97c('0x15')](_0xb97c('0x14'),auth[_0xb97c('0xa')](),controller['destroy']);module[_0xb97c('0x16')]=router; \ No newline at end of file +var _0xd7bf=['/describe','describe','getUsers','/:id','show','create','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get'];(function(_0x1cb71d,_0x2a1e34){var _0x2ec379=function(_0x2dc9f2){while(--_0x2dc9f2){_0x1cb71d['push'](_0x1cb71d['shift']());}};_0x2ec379(++_0x2a1e34);}(_0xd7bf,0xba));var _0xfd7b=function(_0x3ba97b,_0x1dadac){_0x3ba97b=_0x3ba97b-0x0;var _0x15b712=_0xd7bf[_0x3ba97b];return _0x15b712;};'use strict';var multer=require(_0xfd7b('0x0'));var util=require(_0xfd7b('0x1'));var path=require(_0xfd7b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd7b('0x3'));var router=express['Router']();var fs_extra=require(_0xfd7b('0x4'));var auth=require(_0xfd7b('0x5'));var interaction=require(_0xfd7b('0x6'));var config=require(_0xfd7b('0x7'));var controller=require(_0xfd7b('0x8'));router['get']('/',auth[_0xfd7b('0x9')](),controller[_0xfd7b('0xa')]);router[_0xfd7b('0xb')](_0xfd7b('0xc'),auth[_0xfd7b('0x9')](),controller[_0xfd7b('0xd')]);router[_0xfd7b('0xb')]('/users',auth[_0xfd7b('0x9')](),controller[_0xfd7b('0xe')]);router[_0xfd7b('0xb')](_0xfd7b('0xf'),auth['isAuthenticated'](),controller[_0xfd7b('0x10')]);router['post']('/',auth[_0xfd7b('0x9')](),controller[_0xfd7b('0x11')]);router['put'](_0xfd7b('0xf'),controller[_0xfd7b('0x12')]);router[_0xfd7b('0x13')](_0xfd7b('0xf'),auth[_0xfd7b('0x9')](),controller[_0xfd7b('0x14')]);module[_0xfd7b('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 2b7d7c1..8095227 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 _0x6739=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6739,0xd3));var _0x9673=function(_0x417835,_0x568e4b){_0x417835=_0x417835-0x0;var _0x35c48f=_0x6739[_0x417835];return _0x35c48f;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'body':{'type':Sequelize[_0x9673('0x2')](_0x9673('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9673('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9673('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9673('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x9673('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9ccd=['TEXT','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0x3ff6c1,_0x1cf211){var _0x4c4d19=function(_0x205718){while(--_0x205718){_0x3ff6c1['push'](_0x3ff6c1['shift']());}};_0x4c4d19(++_0x1cf211);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xd9cc('0x1')](_0xd9cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9cc('0x3')]('in','out'),'defaultValue':_0xd9cc('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9cc('0x5')]},'providerName':{'type':Sequelize[_0xd9cc('0x6')]},'providerResponse':{'type':Sequelize[_0xd9cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index e816c14..8724192 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 _0xd6f3=['key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','params','intersection','include','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE: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','contact','User','fullname','email','interface','channel','motionChannel','event','EventManager','parse','interaction','formData','reject','RejectMessage','rejectMessage','SELECT','SIP/%s','rejectmessage','eml-format','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','name','map','ChatMessage','rawAttributes','fieldName'];(function(_0x7725cb,_0x4f6d61){var _0x37d020=function(_0x81e287){while(--_0x81e287){_0x7725cb['push'](_0x7725cb['shift']());}};_0x37d020(++_0x4f6d61);}(_0xd6f3,0xc1));var _0x3d6f=function(_0x316288,_0x48e05a){_0x316288=_0x316288-0x0;var _0x20a02a=_0xd6f3[_0x316288];return _0x20a02a;};'use strict';var emlformat=require(_0x3d6f('0x0'));var rimraf=require(_0x3d6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d6f('0x2'));var rp=require('request-promise');var moment=require(_0x3d6f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3d6f('0x4'));var path=require(_0x3d6f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d6f('0x6'));var fs=require('fs');var fs_extra=require(_0x3d6f('0x7'));var _=require('lodash');var squel=require(_0x3d6f('0x8'));var crypto=require('crypto');var jsforce=require(_0x3d6f('0x9'));var deskjs=require(_0x3d6f('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3d6f('0xb'));var Papa=require(_0x3d6f('0xc'));var Redis=require(_0x3d6f('0xd'));var authService=require(_0x3d6f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3d6f('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6f('0x10'))(_0x3d6f('0x11'));var utils=require(_0x3d6f('0x12'));var config=require(_0x3d6f('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3d6f('0x14')]=_[_0x3d6f('0x15')](config[_0x3d6f('0x14')],{'host':_0x3d6f('0x16'),'port':0x18eb});var socket=require(_0x3d6f('0x17'))(new Redis(config[_0x3d6f('0x14')]));require(_0x3d6f('0x18'))[_0x3d6f('0x19')](socket);var jayson=require(_0x3d6f('0x1a'));var client=jayson[_0x3d6f('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x3d6f('0x1b')][_0x3d6f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x30c771,_0x41fb41,_0x1b4aaf,_0x178311){return new BPromise(function(_0x10e53a,_0x2080a3){var _0x3ed505=_0x178311||client;return _0x3ed505[_0x3d6f('0x1d')](_0x30c771,_0x1b4aaf)[_0x3d6f('0x1e')](function(_0x568c97){logger['info']('ChatMessage,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'));logger[_0x3d6f('0x20')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'),JSON[_0x3d6f('0x21')](_0x568c97));if(_0x568c97['error']){if(_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x23')]===0x1f4){logger[_0x3d6f('0x22')](_0x3d6f('0x24'),_0x41fb41,_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);return _0x2080a3(_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);}logger[_0x3d6f('0x22')](_0x3d6f('0x24'),_0x41fb41,_0x568c97[_0x3d6f('0x22')][_0x3d6f('0x25')]);return _0x10e53a(_0x568c97[_0x3d6f('0x22')]['message']);}else{logger[_0x3d6f('0x26')]('ChatMessage,\x20%s,\x20%s',_0x41fb41,_0x3d6f('0x1f'));_0x10e53a(_0x568c97['result'][_0x3d6f('0x25')]);}})[_0x3d6f('0x27')](function(_0x21708e){logger['error'](_0x3d6f('0x24'),_0x41fb41,_0x21708e);_0x2080a3(_0x21708e);});});}function respondWithStatusCode(_0x310d6e,_0xacfeb9){_0xacfeb9=_0xacfeb9||0xcc;return function(_0x4385af){if(_0x4385af){return _0x310d6e[_0x3d6f('0x28')](_0xacfeb9);}return _0x310d6e[_0x3d6f('0x29')](_0xacfeb9)[_0x3d6f('0x2a')]();};}function respondWithResult(_0xe16696,_0x1d75bc){_0x1d75bc=_0x1d75bc||0xc8;return function(_0x3e4fee){if(_0x3e4fee){return _0xe16696[_0x3d6f('0x29')](_0x1d75bc)[_0x3d6f('0x2b')](_0x3e4fee);}};}function respondWithFilteredResult(_0x33faf5,_0x35a364){return function(_0x4d5628){if(_0x4d5628){var _0x2d910e=typeof _0x35a364['offset']==='undefined'&&typeof _0x35a364[_0x3d6f('0x2c')]===_0x3d6f('0x2d');var _0x3b656a=_0x4d5628[_0x3d6f('0x2e')];var _0x14ad4f=_0x2d910e?0x0:_0x35a364[_0x3d6f('0x2f')];var _0x3fb7dc=_0x2d910e?_0x4d5628[_0x3d6f('0x2e')]:_0x35a364[_0x3d6f('0x2f')]+_0x35a364[_0x3d6f('0x2c')];var _0x482eb7;if(_0x3fb7dc>=_0x3b656a){_0x3fb7dc=_0x3b656a;_0x482eb7=0xc8;}else{_0x482eb7=0xce;}_0x33faf5[_0x3d6f('0x29')](_0x482eb7);return _0x33faf5[_0x3d6f('0x30')](_0x3d6f('0x31'),_0x14ad4f+'-'+_0x3fb7dc+'/'+_0x3b656a)[_0x3d6f('0x2b')](_0x4d5628);}return null;};}function patchUpdates(_0x43ec63){return function(_0xc16b4){try{jsonpatch[_0x3d6f('0x32')](_0xc16b4,_0x43ec63,!![]);}catch(_0x486b2d){return BPromise['reject'](_0x486b2d);}return _0xc16b4[_0x3d6f('0x33')]();};}function saveUpdates(_0x28c49c,_0x4bd5e0){return function(_0x352118){if(_0x352118){return _0x352118[_0x3d6f('0x34')](_0x28c49c)[_0x3d6f('0x1e')](function(_0x56ab5e){return _0x56ab5e;});}return null;};}function removeEntity(_0x4476bc,_0x50f7cb){return function(_0x45094c){if(_0x45094c){return _0x45094c[_0x3d6f('0x35')]()[_0x3d6f('0x1e')](function(){_0x4476bc[_0x3d6f('0x29')](0xcc)[_0x3d6f('0x2a')]();});}};}function handleEntityNotFound(_0x42d7c9,_0xe2388c){return function(_0x1d20df){if(!_0x1d20df){_0x42d7c9[_0x3d6f('0x28')](0x194);}return _0x1d20df;};}function handleError(_0x42ec36,_0x2cf5b1){_0x2cf5b1=_0x2cf5b1||0x1f4;return function(_0x15b5ea){logger[_0x3d6f('0x22')](_0x15b5ea['stack']);if(_0x15b5ea[_0x3d6f('0x36')]){delete _0x15b5ea[_0x3d6f('0x36')];}_0x42ec36['status'](_0x2cf5b1)['send'](_0x15b5ea);};}exports['index']=function(_0x29f8ae,_0x2d32c9){var _0x269a6d={},_0x562901={},_0x3d1b14={'count':0x0,'rows':[]};var _0x5c0852=_[_0x3d6f('0x37')](db[_0x3d6f('0x38')][_0x3d6f('0x39')],function(_0x59284c){return{'name':_0x59284c[_0x3d6f('0x3a')],'type':_0x59284c['type'][_0x3d6f('0x3b')]};});_0x562901[_0x3d6f('0x3c')]=_['map'](_0x5c0852,_0x3d6f('0x36'));_0x562901[_0x3d6f('0x3d')]=_[_0x3d6f('0x3e')](_0x29f8ae['query']);_0x562901[_0x3d6f('0x3f')]=_['intersection'](_0x562901[_0x3d6f('0x3c')],_0x562901[_0x3d6f('0x3d')]);_0x269a6d[_0x3d6f('0x40')]=_['intersection'](_0x562901[_0x3d6f('0x3c')],qs[_0x3d6f('0x41')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x41')]));_0x269a6d['attributes']=_0x269a6d['attributes']['length']?_0x269a6d[_0x3d6f('0x40')]:_0x562901[_0x3d6f('0x3c')];if(!_0x29f8ae[_0x3d6f('0x3d')]['hasOwnProperty'](_0x3d6f('0x42'))){_0x269a6d[_0x3d6f('0x2c')]=qs[_0x3d6f('0x2c')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x2c')]);_0x269a6d[_0x3d6f('0x2f')]=qs[_0x3d6f('0x2f')](_0x29f8ae[_0x3d6f('0x3d')]['offset']);}_0x269a6d[_0x3d6f('0x43')]=qs[_0x3d6f('0x44')](_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x44')]);_0x269a6d[_0x3d6f('0x45')]=qs[_0x3d6f('0x3f')](_[_0x3d6f('0x46')](_0x29f8ae[_0x3d6f('0x3d')],_0x562901[_0x3d6f('0x3f')]),_0x5c0852);if(_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x47')]){_0x269a6d[_0x3d6f('0x45')]=_[_0x3d6f('0x48')](_0x269a6d['where'],{'$or':_[_0x3d6f('0x37')](_0x5c0852,function(_0x14ca1b){if(_0x14ca1b['type']!==_0x3d6f('0x49')){var _0x2b9ac2={};_0x2b9ac2[_0x14ca1b[_0x3d6f('0x36')]]={'$like':'%'+_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x47')]+'%'};return _0x2b9ac2;}})});}_0x269a6d=_['merge']({},_0x269a6d,_0x29f8ae[_0x3d6f('0x4a')]);var _0x407bb4={'where':_0x269a6d['where']};return db['ChatMessage']['count'](_0x407bb4)['then'](function(_0x28453b){_0x3d1b14[_0x3d6f('0x2e')]=_0x28453b;if(_0x29f8ae[_0x3d6f('0x3d')][_0x3d6f('0x4b')]){_0x269a6d['include']=[{'all':!![]}];}return db[_0x3d6f('0x38')][_0x3d6f('0x4c')](_0x269a6d);})['then'](function(_0xca223b){_0x3d1b14['rows']=_0xca223b;return _0x3d1b14;})[_0x3d6f('0x1e')](respondWithFilteredResult(_0x2d32c9,_0x269a6d))[_0x3d6f('0x27')](handleError(_0x2d32c9,null));};exports['show']=function(_0x25aa9a,_0x196382){var _0x361e8e={'raw':!![],'where':{'id':_0x25aa9a[_0x3d6f('0x4d')]['id']}},_0x1935f8={};_0x1935f8[_0x3d6f('0x3c')]=_[_0x3d6f('0x3e')](db[_0x3d6f('0x38')][_0x3d6f('0x39')]);_0x1935f8[_0x3d6f('0x3d')]=_[_0x3d6f('0x3e')](_0x25aa9a[_0x3d6f('0x3d')]);_0x1935f8[_0x3d6f('0x3f')]=_['intersection'](_0x1935f8['model'],_0x1935f8[_0x3d6f('0x3d')]);_0x361e8e[_0x3d6f('0x40')]=_[_0x3d6f('0x4e')](_0x1935f8['model'],qs['fields'](_0x25aa9a['query']['fields']));_0x361e8e[_0x3d6f('0x40')]=_0x361e8e[_0x3d6f('0x40')]['length']?_0x361e8e[_0x3d6f('0x40')]:_0x1935f8[_0x3d6f('0x3c')];if(_0x25aa9a[_0x3d6f('0x3d')][_0x3d6f('0x4b')]){_0x361e8e[_0x3d6f('0x4f')]=[{'all':!![]}];}_0x361e8e=_[_0x3d6f('0x48')]({},_0x361e8e,_0x25aa9a[_0x3d6f('0x4a')]);return db[_0x3d6f('0x38')][_0x3d6f('0x50')](_0x361e8e)[_0x3d6f('0x1e')](handleEntityNotFound(_0x196382,null))[_0x3d6f('0x1e')](respondWithResult(_0x196382,null))[_0x3d6f('0x27')](handleError(_0x196382,null));};exports['create']=function(_0x5bb158,_0x16e5d2){return db['ChatMessage'][_0x3d6f('0x51')](_0x5bb158[_0x3d6f('0x52')],{})['then'](respondWithResult(_0x16e5d2,0xc9))[_0x3d6f('0x27')](handleError(_0x16e5d2,null));};exports[_0x3d6f('0x34')]=function(_0x2a64b4,_0x3af775){if(_0x2a64b4[_0x3d6f('0x52')]['id']){delete _0x2a64b4['body']['id'];}return db[_0x3d6f('0x38')][_0x3d6f('0x50')]({'where':{'id':_0x2a64b4['params']['id']}})[_0x3d6f('0x1e')](handleEntityNotFound(_0x3af775,null))['then'](saveUpdates(_0x2a64b4[_0x3d6f('0x52')],null))[_0x3d6f('0x1e')](respondWithResult(_0x3af775,null))['catch'](handleError(_0x3af775,null));};exports[_0x3d6f('0x35')]=function(_0x57506b,_0x2e0976){return db[_0x3d6f('0x38')]['find']({'where':{'id':_0x57506b[_0x3d6f('0x4d')]['id']}})[_0x3d6f('0x1e')](handleEntityNotFound(_0x2e0976,null))[_0x3d6f('0x1e')](removeEntity(_0x2e0976,null))[_0x3d6f('0x27')](handleError(_0x2e0976,null));};exports['describe']=function(_0x42fcd5,_0x315487){return db[_0x3d6f('0x38')][_0x3d6f('0x53')]()[_0x3d6f('0x1e')](respondWithResult(_0x315487,null))[_0x3d6f('0x27')](handleError(_0x315487,null));};var interaction_log=require(_0x3d6f('0x10'))(_0x3d6f('0x54'));exports[_0x3d6f('0x55')]=function(_0x59a202,_0xd74be7,_0x2e4408){var _0x429437={'agent':{},'channel':_0x3d6f('0x56')};if(_0x59a202[_0x3d6f('0x52')]['id']){delete _0x59a202['body']['id'];}_0x59a202['body'][_0x3d6f('0x57')]=!![];_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x58')]=moment()[_0x3d6f('0x59')](_0x3d6f('0x5a'));_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')]=_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')]||_0x59a202[_0x3d6f('0x5c')]['id'];_0x429437[_0x3d6f('0x5d')]['id']=_0x59a202['body']['UserId'];return db['ChatMessage'][_0x3d6f('0x50')]({'where':{'id':_0x59a202[_0x3d6f('0x4d')]['id'],'UserId':null}})[_0x3d6f('0x1e')](handleEntityNotFound(_0xd74be7,null))[_0x3d6f('0x1e')](saveUpdates(_0x59a202['body'],null))[_0x3d6f('0x1e')](function(_0x39c472){if(_0x39c472){_0x429437[_0x3d6f('0x25')]=_0x39c472[_0x3d6f('0x5e')]({'plain':!![]});return db[_0x3d6f('0x5f')]['find']({'where':{'id':_0x39c472[_0x3d6f('0x60')]}});}return null;})[_0x3d6f('0x1e')](handleEntityNotFound(_0xd74be7,null))[_0x3d6f('0x1e')](function(_0x3cd3ec){if(_0x3cd3ec){return _0x3cd3ec[_0x3d6f('0x34')]({'UserId':_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')],'read1stAt':_['isNil'](_0x3cd3ec[_0x3d6f('0x61')])?moment()[_0x3d6f('0x59')](_0x3d6f('0x5a')):undefined});}return null;})[_0x3d6f('0x1e')](function(_0xd3f098){if(_0xd3f098){_0x429437['interaction']=_0xd3f098[_0x3d6f('0x5e')]({'plain':!![]});interaction_log[_0x3d6f('0x26')](_0x3d6f('0x62'),_0x59a202[_0x3d6f('0x5c')]['id'],_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x36')],_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x63')],_0x429437['interaction']['id'],_0x59a202[_0x3d6f('0x52')]?JSON[_0x3d6f('0x21')](_0x59a202[_0x3d6f('0x52')]):_0x3d6f('0x64'));return respondWithRpcPromise(_0x3d6f('0x65'),_0x3d6f('0x66'),_0x429437);}return null;})['then'](function(_0x425cf9){var _0x3f4956=_0x3d6f('0x67')+_0x425cf9[_0x3d6f('0x25')][_0x3d6f('0x68')];return db[_0x3d6f('0x69')]['query'](_0x3f4956,{'type':db[_0x3d6f('0x6a')][_0x3d6f('0x6b')]['SELECT'],'raw':!![]})[_0x3d6f('0x1e')](function(_0x2b43d3){return _0x2b43d3;});})['then'](function(_0x1c80d3){if(_0x1c80d3){_0x429437[_0x3d6f('0x25')][_0x3d6f('0x6c')]=_0x1c80d3[0x0];if(!_0x59a202[_0x3d6f('0x52')][_0x3d6f('0x5b')])return;return db[_0x3d6f('0x6d')][_0x3d6f('0x50')]({'where':{'id':_0x59a202[_0x3d6f('0x52')]['UserId'],'role':'agent'},'attributes':['id',_0x3d6f('0x36'),_0x3d6f('0x6e'),_0x3d6f('0x6f'),'internal'],'raw':!![]});}return null;})[_0x3d6f('0x1e')](function(_0x58fb68){if(!_0x58fb68)return null;_0x429437['message'][_0x3d6f('0x5d')]=_0x58fb68;return _0x429437;})[_0x3d6f('0x1e')](function(_0x139379){if(_0x139379){if(_0x59a202['body']['manual']){_0x429437[_0x3d6f('0x25')][_0x3d6f('0x70')]=util['format']('SIP/%s',_0x59a202[_0x3d6f('0x5c')][_0x3d6f('0x36')]);_0x429437['message']['channel']=_0x429437[_0x3d6f('0x71')];_0x429437[_0x3d6f('0x25')][_0x3d6f('0x72')]=_0x429437[_0x3d6f('0x71')];_0x429437[_0x3d6f('0x25')][_0x3d6f('0x73')]='accept';return respondWithRpcPromise(_0x3d6f('0x74'),_0x3d6f('0x74'),{'event':'acceptmessage','message':_[_0x3d6f('0x48')](_0x429437[_0x3d6f('0x25')],JSON[_0x3d6f('0x75')](_0x429437[_0x3d6f('0x76')][_0x3d6f('0x77')]))},client9002)['then'](function(){return _0x429437;});}return _0x429437;}return null;})['then'](respondWithResult(_0xd74be7,null))['catch'](handleError(_0xd74be7,null));};var interaction_log=require(_0x3d6f('0x10'))(_0x3d6f('0x54'));exports[_0x3d6f('0x78')]=function(_0x4fc773,_0x241267,_0x54f0de){var _0x1ee8b2={'agent':{},'channel':_0x3d6f('0x56')};if(_0x4fc773[_0x3d6f('0x52')]['id']){delete _0x4fc773['body']['id'];}_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')]=_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')]||_0x4fc773[_0x3d6f('0x5c')]['id'];_0x1ee8b2['agent']['id']=_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')];return db[_0x3d6f('0x38')][_0x3d6f('0x50')]({'where':{'id':_0x4fc773[_0x3d6f('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x241267,null))['then'](function(_0x29f4bf){if(_0x29f4bf){_0x1ee8b2[_0x3d6f('0x25')]=_0x29f4bf[_0x3d6f('0x5e')]({'plain':!![]});return db[_0x3d6f('0x5f')][_0x3d6f('0x50')]({'where':{'id':_0x29f4bf['ChatInteractionId']}});}return null;})[_0x3d6f('0x1e')](handleEntityNotFound(_0x241267,null))['then'](function(_0x1ea481){if(_0x1ea481){_0x1ee8b2[_0x3d6f('0x76')]=_0x1ea481['get']({'plain':!![]});interaction_log[_0x3d6f('0x26')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fc773['user']['id'],_0x4fc773[_0x3d6f('0x5c')][_0x3d6f('0x36')],_0x4fc773['user']['role'],_0x1ee8b2['interaction']['id'],_0x4fc773[_0x3d6f('0x52')]?JSON['stringify'](_0x4fc773['body']):'null');return respondWithRpcPromise(_0x3d6f('0x79'),_0x3d6f('0x7a'),_0x1ee8b2);}return null;})[_0x3d6f('0x1e')](function(_0x2aa509){var _0x5ac030='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2aa509[_0x3d6f('0x25')][_0x3d6f('0x68')];return db[_0x3d6f('0x69')][_0x3d6f('0x3d')](_0x5ac030,{'type':db['Sequelize'][_0x3d6f('0x6b')][_0x3d6f('0x7b')],'raw':!![]})['then'](function(_0xcc8495){return _0xcc8495;});})[_0x3d6f('0x1e')](function(_0x5cec45){if(_0x5cec45){_0x1ee8b2['message'][_0x3d6f('0x6c')]=_0x5cec45[0x0];if(!_0x4fc773[_0x3d6f('0x52')][_0x3d6f('0x5b')])return;return db[_0x3d6f('0x6d')][_0x3d6f('0x50')]({'where':{'id':_0x4fc773['body'][_0x3d6f('0x5b')],'role':'agent'},'attributes':['id',_0x3d6f('0x36'),'fullname',_0x3d6f('0x6f'),'internal'],'raw':!![]});}return null;})[_0x3d6f('0x1e')](function(_0x453fa4){if(!_0x453fa4)return null;_0x1ee8b2['message'][_0x3d6f('0x5d')]=_0x453fa4;return _0x1ee8b2;})[_0x3d6f('0x1e')](function(_0x1d31c5){if(_0x1d31c5){_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x70')]=util[_0x3d6f('0x59')](_0x3d6f('0x7c'),_0x4fc773[_0x3d6f('0x5c')]['name']);_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x71')]=_0x1ee8b2[_0x3d6f('0x71')];_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x72')]=_0x1ee8b2[_0x3d6f('0x71')];_0x1d31c5[_0x3d6f('0x25')][_0x3d6f('0x73')]=_0x3d6f('0x78');respondWithRpcPromise(_0x3d6f('0x74'),_0x3d6f('0x74'),{'event':_0x3d6f('0x7d'),'message':_[_0x3d6f('0x48')](_0x1ee8b2[_0x3d6f('0x25')],JSON[_0x3d6f('0x75')](_0x1ee8b2['interaction'][_0x3d6f('0x77')]))},client9002);return _0x1ee8b2;}return null;})[_0x3d6f('0x1e')](respondWithResult(_0x241267,null))[_0x3d6f('0x27')](handleError(_0x241267,null));}; \ No newline at end of file +var _0x3789=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','ChatMessage','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','read','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','RejectMessage','rejectMessage','contact','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x1c5202,_0x5bc415){var _0xae684b=function(_0x3b2c80){while(--_0x3b2c80){_0x1c5202['push'](_0x1c5202['shift']());}};_0xae684b(++_0x5bc415);}(_0x3789,0x7a));var _0x9378=function(_0x1b2594,_0x2cc023){_0x1b2594=_0x1b2594-0x0;var _0x3c2509=_0x3789[_0x1b2594];return _0x3c2509;};'use strict';var emlformat=require(_0x9378('0x0'));var rimraf=require(_0x9378('0x1'));var zipdir=require(_0x9378('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9378('0x3'));var path=require(_0x9378('0x4'));var sox=require(_0x9378('0x5'));var csv=require('to-csv');var ejs=require(_0x9378('0x6'));var fs=require('fs');var fs_extra=require(_0x9378('0x7'));var _=require(_0x9378('0x8'));var squel=require(_0x9378('0x9'));var crypto=require(_0x9378('0xa'));var jsforce=require(_0x9378('0xb'));var deskjs=require(_0x9378('0xc'));var toCsv=require(_0x9378('0xd'));var querystring=require(_0x9378('0xe'));var Papa=require(_0x9378('0xf'));var Redis=require(_0x9378('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9378('0x11'));var as=require(_0x9378('0x12'));var hardwareService=require(_0x9378('0x13'));var logger=require(_0x9378('0x14'))(_0x9378('0x15'));var utils=require(_0x9378('0x16'));var config=require(_0x9378('0x17'));var licenseUtil=require(_0x9378('0x18'));var db=require('../../mysqldb')['db'];config[_0x9378('0x19')]=_[_0x9378('0x1a')](config[_0x9378('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9378('0x1b'))(new Redis(config[_0x9378('0x19')]));require('./chatMessage.socket')[_0x9378('0x1c')](socket);var jayson=require(_0x9378('0x1d'));var client=jayson[_0x9378('0x1e')][_0x9378('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x9378('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2d6af4,_0x39f451,_0x484deb,_0x1d24ff){return new BPromise(function(_0x289b1f,_0x51a8ca){var _0x2c42f0=_0x1d24ff||client;return _0x2c42f0[_0x9378('0x20')](_0x2d6af4,_0x484deb)['then'](function(_0x2f2931){logger[_0x9378('0x21')](_0x9378('0x22'),_0x39f451,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x39f451,_0x9378('0x23'),JSON[_0x9378('0x24')](_0x2f2931));if(_0x2f2931[_0x9378('0x25')]){if(_0x2f2931[_0x9378('0x25')]['code']===0x1f4){logger[_0x9378('0x25')](_0x9378('0x22'),_0x39f451,_0x2f2931[_0x9378('0x25')][_0x9378('0x26')]);return _0x51a8ca(_0x2f2931['error'][_0x9378('0x26')]);}logger[_0x9378('0x25')]('ChatMessage,\x20%s,\x20%s',_0x39f451,_0x2f2931[_0x9378('0x25')]['message']);return _0x289b1f(_0x2f2931[_0x9378('0x25')][_0x9378('0x26')]);}else{logger['info'](_0x9378('0x22'),_0x39f451,'request\x20sent');_0x289b1f(_0x2f2931[_0x9378('0x27')]['message']);}})[_0x9378('0x28')](function(_0x3221ba){logger[_0x9378('0x25')](_0x9378('0x22'),_0x39f451,_0x3221ba);_0x51a8ca(_0x3221ba);});});}function respondWithStatusCode(_0x3fafdd,_0x1c1bcb){_0x1c1bcb=_0x1c1bcb||0xcc;return function(_0x35288b){if(_0x35288b){return _0x3fafdd[_0x9378('0x29')](_0x1c1bcb);}return _0x3fafdd['status'](_0x1c1bcb)[_0x9378('0x2a')]();};}function respondWithResult(_0x393e8b,_0x34e037){_0x34e037=_0x34e037||0xc8;return function(_0x139380){if(_0x139380){return _0x393e8b[_0x9378('0x2b')](_0x34e037)[_0x9378('0x2c')](_0x139380);}};}function respondWithFilteredResult(_0xdbec54,_0x40dec1){return function(_0x3731c1){if(_0x3731c1){var _0x540559=typeof _0x40dec1[_0x9378('0x2d')]==='undefined'&&typeof _0x40dec1[_0x9378('0x2e')]===_0x9378('0x2f');var _0x173841=_0x3731c1[_0x9378('0x30')];var _0xfbe322=_0x540559?0x0:_0x40dec1[_0x9378('0x2d')];var _0x1eb513=_0x540559?_0x3731c1[_0x9378('0x30')]:_0x40dec1[_0x9378('0x2d')]+_0x40dec1[_0x9378('0x2e')];var _0x5bc112;if(_0x1eb513>=_0x173841){_0x1eb513=_0x173841;_0x5bc112=0xc8;}else{_0x5bc112=0xce;}_0xdbec54[_0x9378('0x2b')](_0x5bc112);return _0xdbec54['set'](_0x9378('0x31'),_0xfbe322+'-'+_0x1eb513+'/'+_0x173841)[_0x9378('0x2c')](_0x3731c1);}return null;};}function patchUpdates(_0x20e056){return function(_0x28f6cc){try{jsonpatch[_0x9378('0x32')](_0x28f6cc,_0x20e056,!![]);}catch(_0x3c6e49){return BPromise[_0x9378('0x33')](_0x3c6e49);}return _0x28f6cc[_0x9378('0x34')]();};}function saveUpdates(_0x4181cd,_0x152848){return function(_0x40f551){if(_0x40f551){return _0x40f551[_0x9378('0x35')](_0x4181cd)[_0x9378('0x36')](function(_0x52da8a){return _0x52da8a;});}return null;};}function removeEntity(_0x5c933b,_0x42a0c7){return function(_0x48e0c4){if(_0x48e0c4){return _0x48e0c4[_0x9378('0x37')]()[_0x9378('0x36')](function(){_0x5c933b[_0x9378('0x2b')](0xcc)[_0x9378('0x2a')]();});}};}function handleEntityNotFound(_0x1920bf,_0x4f7b56){return function(_0x581487){if(!_0x581487){_0x1920bf[_0x9378('0x29')](0x194);}return _0x581487;};}function handleError(_0x20f688,_0xa0ad27){_0xa0ad27=_0xa0ad27||0x1f4;return function(_0x16d6af){logger[_0x9378('0x25')](_0x16d6af[_0x9378('0x38')]);if(_0x16d6af[_0x9378('0x39')]){delete _0x16d6af['name'];}_0x20f688['status'](_0xa0ad27)['send'](_0x16d6af);};}exports[_0x9378('0x3a')]=function(_0xd4f63,_0x1d3771){var _0x1ec6ff={},_0xcb4d2f={},_0x5c8946={'count':0x0,'rows':[]};var _0x5badf7=_['map'](db[_0x9378('0x3b')][_0x9378('0x3c')],function(_0x3e17d3){return{'name':_0x3e17d3['fieldName'],'type':_0x3e17d3['type'][_0x9378('0x3d')]};});_0xcb4d2f[_0x9378('0x3e')]=_[_0x9378('0x3f')](_0x5badf7,_0x9378('0x39'));_0xcb4d2f[_0x9378('0x40')]=_[_0x9378('0x41')](_0xd4f63[_0x9378('0x40')]);_0xcb4d2f[_0x9378('0x42')]=_[_0x9378('0x43')](_0xcb4d2f['model'],_0xcb4d2f[_0x9378('0x40')]);_0x1ec6ff[_0x9378('0x44')]=_[_0x9378('0x43')](_0xcb4d2f[_0x9378('0x3e')],qs[_0x9378('0x45')](_0xd4f63['query'][_0x9378('0x45')]));_0x1ec6ff['attributes']=_0x1ec6ff[_0x9378('0x44')][_0x9378('0x46')]?_0x1ec6ff[_0x9378('0x44')]:_0xcb4d2f['model'];if(!_0xd4f63[_0x9378('0x40')][_0x9378('0x47')](_0x9378('0x48'))){_0x1ec6ff[_0x9378('0x2e')]=qs[_0x9378('0x2e')](_0xd4f63[_0x9378('0x40')][_0x9378('0x2e')]);_0x1ec6ff[_0x9378('0x2d')]=qs[_0x9378('0x2d')](_0xd4f63[_0x9378('0x40')][_0x9378('0x2d')]);}_0x1ec6ff[_0x9378('0x49')]=qs[_0x9378('0x4a')](_0xd4f63[_0x9378('0x40')][_0x9378('0x4a')]);_0x1ec6ff[_0x9378('0x4b')]=qs['filters'](_[_0x9378('0x4c')](_0xd4f63[_0x9378('0x40')],_0xcb4d2f[_0x9378('0x42')]),_0x5badf7);if(_0xd4f63[_0x9378('0x40')][_0x9378('0x4d')]){_0x1ec6ff[_0x9378('0x4b')]=_[_0x9378('0x4e')](_0x1ec6ff[_0x9378('0x4b')],{'$or':_[_0x9378('0x3f')](_0x5badf7,function(_0x496b87){if(_0x496b87[_0x9378('0x4f')]!==_0x9378('0x50')){var _0x2f7940={};_0x2f7940[_0x496b87['name']]={'$like':'%'+_0xd4f63[_0x9378('0x40')][_0x9378('0x4d')]+'%'};return _0x2f7940;}})});}_0x1ec6ff=_[_0x9378('0x4e')]({},_0x1ec6ff,_0xd4f63[_0x9378('0x51')]);var _0x109e30={'where':_0x1ec6ff[_0x9378('0x4b')]};return db[_0x9378('0x3b')][_0x9378('0x30')](_0x109e30)[_0x9378('0x36')](function(_0x295515){_0x5c8946[_0x9378('0x30')]=_0x295515;if(_0xd4f63[_0x9378('0x40')][_0x9378('0x52')]){_0x1ec6ff[_0x9378('0x53')]=[{'all':!![]}];}return db[_0x9378('0x3b')][_0x9378('0x54')](_0x1ec6ff);})[_0x9378('0x36')](function(_0x4219d0){_0x5c8946[_0x9378('0x55')]=_0x4219d0;return _0x5c8946;})[_0x9378('0x36')](respondWithFilteredResult(_0x1d3771,_0x1ec6ff))['catch'](handleError(_0x1d3771,null));};exports[_0x9378('0x56')]=function(_0xc14be8,_0x3f48a3){var _0x28150d={'raw':!![],'where':{'id':_0xc14be8[_0x9378('0x57')]['id']}},_0x413898={};_0x413898['model']=_[_0x9378('0x41')](db['ChatMessage'][_0x9378('0x3c')]);_0x413898['query']=_[_0x9378('0x41')](_0xc14be8[_0x9378('0x40')]);_0x413898[_0x9378('0x42')]=_[_0x9378('0x43')](_0x413898['model'],_0x413898['query']);_0x28150d['attributes']=_['intersection'](_0x413898[_0x9378('0x3e')],qs[_0x9378('0x45')](_0xc14be8['query']['fields']));_0x28150d[_0x9378('0x44')]=_0x28150d[_0x9378('0x44')][_0x9378('0x46')]?_0x28150d[_0x9378('0x44')]:_0x413898[_0x9378('0x3e')];if(_0xc14be8[_0x9378('0x40')][_0x9378('0x52')]){_0x28150d[_0x9378('0x53')]=[{'all':!![]}];}_0x28150d=_['merge']({},_0x28150d,_0xc14be8[_0x9378('0x51')]);return db[_0x9378('0x3b')][_0x9378('0x58')](_0x28150d)[_0x9378('0x36')](handleEntityNotFound(_0x3f48a3,null))[_0x9378('0x36')](respondWithResult(_0x3f48a3,null))[_0x9378('0x28')](handleError(_0x3f48a3,null));};exports['create']=function(_0x36c436,_0x33ff1f){return db[_0x9378('0x3b')][_0x9378('0x59')](_0x36c436[_0x9378('0x5a')],{})[_0x9378('0x36')](respondWithResult(_0x33ff1f,0xc9))[_0x9378('0x28')](handleError(_0x33ff1f,null));};exports[_0x9378('0x35')]=function(_0x593a09,_0x3b31c3){if(_0x593a09[_0x9378('0x5a')]['id']){delete _0x593a09[_0x9378('0x5a')]['id'];}return db['ChatMessage'][_0x9378('0x58')]({'where':{'id':_0x593a09['params']['id']}})[_0x9378('0x36')](handleEntityNotFound(_0x3b31c3,null))[_0x9378('0x36')](saveUpdates(_0x593a09[_0x9378('0x5a')],null))['then'](respondWithResult(_0x3b31c3,null))[_0x9378('0x28')](handleError(_0x3b31c3,null));};exports[_0x9378('0x37')]=function(_0x4d7464,_0x4b6bd3){return db[_0x9378('0x3b')]['find']({'where':{'id':_0x4d7464[_0x9378('0x57')]['id']}})[_0x9378('0x36')](handleEntityNotFound(_0x4b6bd3,null))['then'](removeEntity(_0x4b6bd3,null))[_0x9378('0x28')](handleError(_0x4b6bd3,null));};exports['describe']=function(_0x31c578,_0x3835ad){return db[_0x9378('0x3b')][_0x9378('0x5b')]()[_0x9378('0x36')](respondWithResult(_0x3835ad,null))[_0x9378('0x28')](handleError(_0x3835ad,null));};var interaction_log=require(_0x9378('0x14'))(_0x9378('0x5c'));exports[_0x9378('0x5d')]=function(_0x773679,_0x5e8130,_0x31c61f){var _0x20563f={'agent':{},'channel':_0x9378('0x5e')};if(_0x773679[_0x9378('0x5a')]['id']){delete _0x773679['body']['id'];}_0x773679['body'][_0x9378('0x5f')]=!![];_0x773679['body']['readAt']=moment()[_0x9378('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x773679['body']['UserId']=_0x773679[_0x9378('0x5a')][_0x9378('0x61')]||_0x773679[_0x9378('0x62')]['id'];_0x20563f[_0x9378('0x63')]['id']=_0x773679[_0x9378('0x5a')][_0x9378('0x61')];return db[_0x9378('0x3b')]['find']({'where':{'id':_0x773679[_0x9378('0x57')]['id'],'UserId':null}})[_0x9378('0x36')](handleEntityNotFound(_0x5e8130,null))['then'](saveUpdates(_0x773679[_0x9378('0x5a')],null))[_0x9378('0x36')](function(_0x201a70){if(_0x201a70){_0x20563f['message']=_0x201a70[_0x9378('0x64')]({'plain':!![]});return db[_0x9378('0x65')][_0x9378('0x58')]({'where':{'id':_0x201a70[_0x9378('0x66')]}});}return null;})[_0x9378('0x36')](handleEntityNotFound(_0x5e8130,null))[_0x9378('0x36')](function(_0x46f4cd){if(_0x46f4cd){return _0x46f4cd[_0x9378('0x35')]({'UserId':_0x773679[_0x9378('0x5a')][_0x9378('0x61')],'read1stAt':_['isNil'](_0x46f4cd[_0x9378('0x67')])?moment()[_0x9378('0x60')](_0x9378('0x68')):undefined});}return null;})[_0x9378('0x36')](function(_0x470adc){if(_0x470adc){_0x20563f[_0x9378('0x69')]=_0x470adc['get']({'plain':!![]});interaction_log[_0x9378('0x21')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x773679['user']['id'],_0x773679[_0x9378('0x62')][_0x9378('0x39')],_0x773679[_0x9378('0x62')][_0x9378('0x6a')],_0x20563f[_0x9378('0x69')]['id'],_0x773679[_0x9378('0x5a')]?JSON[_0x9378('0x24')](_0x773679[_0x9378('0x5a')]):_0x9378('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x9378('0x6c'),_0x20563f);}return null;})[_0x9378('0x36')](function(_0x36e5f4){var _0x41be97=_0x9378('0x6d')+_0x36e5f4['message'][_0x9378('0x6e')];return db[_0x9378('0x6f')][_0x9378('0x40')](_0x41be97,{'type':db[_0x9378('0x70')][_0x9378('0x71')][_0x9378('0x72')],'raw':!![]})[_0x9378('0x36')](function(_0x27d20a){return _0x27d20a;});})[_0x9378('0x36')](function(_0x1222e0){if(_0x1222e0){_0x20563f[_0x9378('0x26')]['contact']=_0x1222e0[0x0];if(!_0x773679[_0x9378('0x5a')][_0x9378('0x61')])return;return db[_0x9378('0x73')][_0x9378('0x58')]({'where':{'id':_0x773679[_0x9378('0x5a')]['UserId'],'role':_0x9378('0x63')},'attributes':['id',_0x9378('0x39'),_0x9378('0x74'),_0x9378('0x75'),_0x9378('0x76')],'raw':!![]});}return null;})[_0x9378('0x36')](function(_0x5e3289){if(!_0x5e3289)return null;_0x20563f['message'][_0x9378('0x63')]=_0x5e3289;return _0x20563f;})[_0x9378('0x36')](function(_0x250921){if(_0x250921){if(_0x773679[_0x9378('0x5a')]['manual']){_0x20563f[_0x9378('0x26')][_0x9378('0x77')]=util['format']('SIP/%s',_0x773679[_0x9378('0x62')]['name']);_0x20563f[_0x9378('0x26')][_0x9378('0x78')]=_0x20563f['channel'];_0x20563f[_0x9378('0x26')][_0x9378('0x79')]=_0x20563f[_0x9378('0x78')];_0x20563f['message'][_0x9378('0x7a')]='accept';return respondWithRpcPromise(_0x9378('0x7b'),_0x9378('0x7b'),{'event':_0x9378('0x7c'),'message':_['merge'](_0x20563f[_0x9378('0x26')],JSON[_0x9378('0x7d')](_0x20563f[_0x9378('0x69')][_0x9378('0x7e')]))},client9002)['then'](function(){return _0x20563f;});}return _0x20563f;}return null;})[_0x9378('0x36')](respondWithResult(_0x5e8130,null))[_0x9378('0x28')](handleError(_0x5e8130,null));};var interaction_log=require(_0x9378('0x14'))(_0x9378('0x5c'));exports[_0x9378('0x33')]=function(_0x53b851,_0x52712b,_0x2b0904){var _0x22c93c={'agent':{},'channel':_0x9378('0x5e')};if(_0x53b851[_0x9378('0x5a')]['id']){delete _0x53b851['body']['id'];}_0x53b851[_0x9378('0x5a')][_0x9378('0x61')]=_0x53b851[_0x9378('0x5a')][_0x9378('0x61')]||_0x53b851['user']['id'];_0x22c93c[_0x9378('0x63')]['id']=_0x53b851[_0x9378('0x5a')][_0x9378('0x61')];return db[_0x9378('0x3b')][_0x9378('0x58')]({'where':{'id':_0x53b851[_0x9378('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x52712b,null))[_0x9378('0x36')](function(_0x1952d4){if(_0x1952d4){_0x22c93c[_0x9378('0x26')]=_0x1952d4[_0x9378('0x64')]({'plain':!![]});return db[_0x9378('0x65')][_0x9378('0x58')]({'where':{'id':_0x1952d4['ChatInteractionId']}});}return null;})[_0x9378('0x36')](handleEntityNotFound(_0x52712b,null))[_0x9378('0x36')](function(_0x1d842c){if(_0x1d842c){_0x22c93c[_0x9378('0x69')]=_0x1d842c[_0x9378('0x64')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53b851[_0x9378('0x62')]['id'],_0x53b851['user'][_0x9378('0x39')],_0x53b851[_0x9378('0x62')][_0x9378('0x6a')],_0x22c93c['interaction']['id'],_0x53b851[_0x9378('0x5a')]?JSON[_0x9378('0x24')](_0x53b851[_0x9378('0x5a')]):_0x9378('0x6b'));return respondWithRpcPromise(_0x9378('0x7f'),_0x9378('0x80'),_0x22c93c);}return null;})[_0x9378('0x36')](function(_0x1e545f){var _0x5d37b1=_0x9378('0x6d')+_0x1e545f[_0x9378('0x26')]['ContactId'];return db['sequelize']['query'](_0x5d37b1,{'type':db[_0x9378('0x70')][_0x9378('0x71')][_0x9378('0x72')],'raw':!![]})[_0x9378('0x36')](function(_0x3b9f2e){return _0x3b9f2e;});})[_0x9378('0x36')](function(_0x404dd8){if(_0x404dd8){_0x22c93c['message'][_0x9378('0x81')]=_0x404dd8[0x0];if(!_0x53b851[_0x9378('0x5a')][_0x9378('0x61')])return;return db['User'][_0x9378('0x58')]({'where':{'id':_0x53b851[_0x9378('0x5a')][_0x9378('0x61')],'role':_0x9378('0x63')},'attributes':['id',_0x9378('0x39'),_0x9378('0x74'),'email',_0x9378('0x76')],'raw':!![]});}return null;})[_0x9378('0x36')](function(_0x315997){if(!_0x315997)return null;_0x22c93c[_0x9378('0x26')][_0x9378('0x63')]=_0x315997;return _0x22c93c;})[_0x9378('0x36')](function(_0x64a2bf){if(_0x64a2bf){_0x64a2bf['message'][_0x9378('0x77')]=util[_0x9378('0x60')](_0x9378('0x82'),_0x53b851[_0x9378('0x62')]['name']);_0x64a2bf[_0x9378('0x26')]['channel']=_0x22c93c[_0x9378('0x78')];_0x64a2bf['message'][_0x9378('0x79')]=_0x22c93c['channel'];_0x64a2bf[_0x9378('0x26')][_0x9378('0x7a')]=_0x9378('0x33');respondWithRpcPromise(_0x9378('0x7b'),'EventManager',{'event':_0x9378('0x83'),'message':_[_0x9378('0x4e')](_0x22c93c[_0x9378('0x26')],JSON[_0x9378('0x7d')](_0x22c93c['interaction'][_0x9378('0x7e')]))},client9002);return _0x22c93c;}return null;})[_0x9378('0x36')](respondWithResult(_0x52712b,null))[_0x9378('0x28')](handleError(_0x52712b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f5ec747..9ff5b3c 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 _0x8f0d=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2ea189,_0x594b6d){var _0x17a7c8=function(_0x214b09){while(--_0x214b09){_0x2ea189['push'](_0x2ea189['shift']());}};_0x17a7c8(++_0x594b6d);}(_0x8f0d,0x1da));var _0xd8f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f0d[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0xd8f0('0x0'));var ChatMessage=require(_0xd8f0('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8f0('0x2'),'afterDestroy':_0xd8f0('0x3')};function emitEvent(_0x121ee3){return function(_0x4a939c,_0x271d06,_0x5d7288){ChatMessageEvents['emit'](_0x121ee3+':'+_0x4a939c['id'],_0x4a939c);ChatMessageEvents[_0xd8f0('0x4')](_0x121ee3,_0x4a939c);_0x5d7288(null);};}for(var e in events){if(events[_0xd8f0('0x5')](e)){var event=events[e];ChatMessage[_0xd8f0('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x933a=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x2c4d31,_0x21f3a8){var _0x3a9785=function(_0x1fb5b8){while(--_0x1fb5b8){_0x2c4d31['push'](_0x2c4d31['shift']());}};_0x3a9785(++_0x21f3a8);}(_0x933a,0x10e));var _0xa933=function(_0x57e0ca,_0x596976){_0x57e0ca=_0x57e0ca-0x0;var _0x310a0a=_0x933a[_0x57e0ca];return _0x310a0a;};'use strict';var EventEmitter=require(_0xa933('0x0'));var ChatMessage=require(_0xa933('0x1'))['db'][_0xa933('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa933('0x3')](0x0);var events={'afterCreate':_0xa933('0x4'),'afterUpdate':_0xa933('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1bd700){return function(_0x2f2870,_0x19634e,_0x3eda65){ChatMessageEvents[_0xa933('0x6')](_0x1bd700+':'+_0x2f2870['id'],_0x2f2870);ChatMessageEvents[_0xa933('0x6')](_0x1bd700,_0x2f2870);_0x3eda65(null);};}for(var e in events){if(events[_0xa933('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xa933('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 370032d..51ccb15 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 _0xa5ef=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util'];(function(_0x343801,_0x5c99de){var _0x89bc33=function(_0x664184){while(--_0x664184){_0x343801['push'](_0x343801['shift']());}};_0x89bc33(++_0x5c99de);}(_0xa5ef,0x120));var _0xfa5e=function(_0x16a326,_0x3d0456){_0x16a326=_0x16a326-0x0;var _0x120392=_0xa5ef[_0x16a326];return _0x120392;};'use strict';var _=require(_0xfa5e('0x0'));var util=require(_0xfa5e('0x1'));var logger=require(_0xfa5e('0x2'))(_0xfa5e('0x3'));var moment=require(_0xfa5e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa5e('0x5'));var fs=require('fs');var path=require(_0xfa5e('0x6'));var rimraf=require(_0xfa5e('0x7'));var config=require(_0xfa5e('0x8'));var attributes=require('./chatMessage.attributes');module[_0xfa5e('0x9')]=function(_0x16df33,_0x595f89){return _0x16df33[_0xfa5e('0xa')](_0xfa5e('0xb'),attributes,{'tableName':_0xfa5e('0xc'),'paranoid':![],'indexes':[{'name':_0xfa5e('0xd'),'fields':[_0xfa5e('0xe')],'type':_0xfa5e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x389b54,_0x450b1b,_0x427596){var _0x43e396=_0x16df33[_0xfa5e('0x10')];var _0x113d67=_0x389b54[_0xfa5e('0x11')]({'plain':!![]});if(_0x113d67[_0xfa5e('0x12')][_0xfa5e('0x13')]()==='in'||_0x113d67[_0xfa5e('0x12')][_0xfa5e('0x13')]()==='out'&&!_0x113d67[_0xfa5e('0x14')]&&!_['isNil'](_0x113d67[_0xfa5e('0x15')])){_0x43e396['ChatInteraction'][_0xfa5e('0x16')]({'where':{'id':_0x113d67[_0xfa5e('0x17')]}})[_0xfa5e('0x18')](function(_0x315cf2){if(_0x315cf2){_0x315cf2['update']({'lastMsgAt':_0x113d67[_0xfa5e('0x19')],'lastMsgDirection':_0x113d67['direction'][_0xfa5e('0x13')]()});}})[_0xfa5e('0x1a')](function(_0x8b1f2f){console[_0xfa5e('0x1b')](_0x8b1f2f);});}_0x427596();}},'charset':'utf8mb4','collate':_0xfa5e('0x1c')});}; \ No newline at end of file +var _0xd3fe=['findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction'];(function(_0xe8c105,_0x2ed540){var _0x27f9ab=function(_0x1199b0){while(--_0x1199b0){_0xe8c105['push'](_0xe8c105['shift']());}};_0x27f9ab(++_0x2ed540);}(_0xd3fe,0xb2));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xed3f('0x0'));var logger=require(_0xed3f('0x1'))(_0xed3f('0x2'));var moment=require(_0xed3f('0x3'));var BPromise=require(_0xed3f('0x4'));var rp=require(_0xed3f('0x5'));var fs=require('fs');var path=require(_0xed3f('0x6'));var rimraf=require(_0xed3f('0x7'));var config=require(_0xed3f('0x8'));var attributes=require(_0xed3f('0x9'));module[_0xed3f('0xa')]=function(_0xe6f2d6,_0x5b42ee){return _0xe6f2d6[_0xed3f('0xb')](_0xed3f('0xc'),attributes,{'tableName':_0xed3f('0xd'),'paranoid':![],'indexes':[{'name':_0xed3f('0xe'),'fields':[_0xed3f('0xf')],'type':_0xed3f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bfa6c,_0x71e089,_0x3989e8){var _0x29e571=_0xe6f2d6[_0xed3f('0x11')];var _0xcc1f13=_0x1bfa6c[_0xed3f('0x12')]({'plain':!![]});if(_0xcc1f13[_0xed3f('0x13')][_0xed3f('0x14')]()==='in'||_0xcc1f13[_0xed3f('0x13')][_0xed3f('0x14')]()===_0xed3f('0x15')&&!_0xcc1f13[_0xed3f('0x16')]&&!_[_0xed3f('0x17')](_0xcc1f13[_0xed3f('0x18')])){_0x29e571[_0xed3f('0x19')][_0xed3f('0x1a')]({'where':{'id':_0xcc1f13[_0xed3f('0x1b')]}})[_0xed3f('0x1c')](function(_0x3fbe29){if(_0x3fbe29){_0x3fbe29['update']({'lastMsgAt':_0xcc1f13[_0xed3f('0x1d')],'lastMsgDirection':_0xcc1f13[_0xed3f('0x13')][_0xed3f('0x14')]()});}})[_0xed3f('0x1e')](function(_0xa2ec97){console[_0xed3f('0x1f')](_0xa2ec97);});}_0x3989e8();}},'charset':_0xed3f('0x20'),'collate':_0xed3f('0x21')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e5105a6..759c8d5 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 _0xbf0c=['client','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateChatMessage','ChatMessage','create','raw','lodash','util','bluebird','randomstring','rpc','jayson/promise'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0xbf0c,0x180));var _0xcbf0=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0xbf0c[_0xb65e77];return _0x38134b;};'use strict';var _=require(_0xcbf0('0x0'));var util=require(_0xcbf0('0x1'));var moment=require('moment');var BPromise=require(_0xcbf0('0x2'));var rs=require(_0xcbf0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbf0('0x4'));var config=require('../../config/environment');var jayson=require(_0xcbf0('0x5'));var client=jayson[_0xcbf0('0x6')]['http']({'port':0x232a});config[_0xcbf0('0x7')]=_['defaults'](config[_0xcbf0('0x7')],{'host':_0xcbf0('0x8'),'port':0x18eb});var socket=require(_0xcbf0('0x9'))(new Redis(config['redis']));require(_0xcbf0('0xa'))['register'](socket);function respondWithRpcPromise(_0x1294a5,_0x57f74e,_0x32d6c5){return new BPromise(function(_0x343609,_0x238ecb){return client[_0xcbf0('0xb')](_0x1294a5,_0x32d6c5)[_0xcbf0('0xc')](function(_0xd40cc5){logger['info'](_0xcbf0('0xd'),_0x57f74e,_0xcbf0('0xe'));logger[_0xcbf0('0xf')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57f74e,_0xcbf0('0xe'),JSON[_0xcbf0('0x10')](_0xd40cc5));if(_0xd40cc5[_0xcbf0('0x11')]){if(_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x12')]===0x1f4){logger[_0xcbf0('0x11')](_0xcbf0('0xd'),_0x57f74e,_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);return _0x238ecb(_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);}logger[_0xcbf0('0x11')](_0xcbf0('0xd'),_0x57f74e,_0xd40cc5[_0xcbf0('0x11')][_0xcbf0('0x13')]);return _0x343609(_0xd40cc5['error']['message']);}else{logger[_0xcbf0('0x14')](_0xcbf0('0xd'),_0x57f74e,'request\x20sent');_0x343609(_0xd40cc5[_0xcbf0('0x15')][_0xcbf0('0x13')]);}})['catch'](function(_0xe5d872){logger['error'](_0xcbf0('0xd'),_0x57f74e,_0xe5d872);_0x238ecb(_0xe5d872);});});}exports[_0xcbf0('0x16')]=function(_0x36590c){var _0x376273=this;return new Promise(function(_0x45b228,_0x58ed38){return db[_0xcbf0('0x17')][_0xcbf0('0x18')](_0x36590c['body'],{'raw':_0x36590c['options']?_0x36590c['options'][_0xcbf0('0x19')]===undefined?!![]:![]:!![]})[_0xcbf0('0xc')](function(_0x3918f2){logger[_0xcbf0('0x14')]('CreateChatMessage',_0x36590c);logger[_0xcbf0('0xf')](_0xcbf0('0x16'),_0x36590c,JSON[_0xcbf0('0x10')](_0x3918f2));_0x45b228(_0x3918f2);})['catch'](function(_0x46541b){logger['error'](_0xcbf0('0x16'),_0x46541b[_0xcbf0('0x13')],_0x36590c);_0x58ed38(_0x376273[_0xcbf0('0x11')](0x1f4,_0x46541b[_0xcbf0('0x13')]));});});}; \ No newline at end of file +var _0xc6a7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatMessage.socket','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','body','options','raw','then','moment'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xc6a7,0x192));var _0x7c6a=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xc6a7[_0x47fd36];return _0x21a0fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c6a('0x0'));var BPromise=require(_0x7c6a('0x1'));var rs=require(_0x7c6a('0x2'));var fs=require('fs');var Redis=require(_0x7c6a('0x3'));var db=require(_0x7c6a('0x4'))['db'];var utils=require(_0x7c6a('0x5'));var logger=require(_0x7c6a('0x6'))(_0x7c6a('0x7'));var config=require(_0x7c6a('0x8'));var jayson=require(_0x7c6a('0x9'));var client=jayson[_0x7c6a('0xa')][_0x7c6a('0xb')]({'port':0x232a});config[_0x7c6a('0xc')]=_['defaults'](config[_0x7c6a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c6a('0xc')]));require(_0x7c6a('0xd'))['register'](socket);function respondWithRpcPromise(_0xc2ec8a,_0x275baf,_0x56255d){return new BPromise(function(_0x50ea36,_0x4c9376){return client[_0x7c6a('0xe')](_0xc2ec8a,_0x56255d)['then'](function(_0x411fde){logger[_0x7c6a('0xf')]('ChatMessage,\x20%s,\x20%s',_0x275baf,_0x7c6a('0x10'));logger[_0x7c6a('0x11')](_0x7c6a('0x12'),_0x275baf,_0x7c6a('0x10'),JSON[_0x7c6a('0x13')](_0x411fde));if(_0x411fde['error']){if(_0x411fde[_0x7c6a('0x14')][_0x7c6a('0x15')]===0x1f4){logger[_0x7c6a('0x14')](_0x7c6a('0x16'),_0x275baf,_0x411fde[_0x7c6a('0x14')][_0x7c6a('0x17')]);return _0x4c9376(_0x411fde[_0x7c6a('0x14')]['message']);}logger['error'](_0x7c6a('0x16'),_0x275baf,_0x411fde[_0x7c6a('0x14')][_0x7c6a('0x17')]);return _0x50ea36(_0x411fde[_0x7c6a('0x14')][_0x7c6a('0x17')]);}else{logger[_0x7c6a('0xf')](_0x7c6a('0x16'),_0x275baf,_0x7c6a('0x10'));_0x50ea36(_0x411fde['result'][_0x7c6a('0x17')]);}})[_0x7c6a('0x18')](function(_0x3bad64){logger['error'](_0x7c6a('0x16'),_0x275baf,_0x3bad64);_0x4c9376(_0x3bad64);});});}exports[_0x7c6a('0x19')]=function(_0x292502){var _0x340fad=this;return new Promise(function(_0x32ce51,_0x506555){return db[_0x7c6a('0x1a')]['create'](_0x292502[_0x7c6a('0x1b')],{'raw':_0x292502['options']?_0x292502[_0x7c6a('0x1c')][_0x7c6a('0x1d')]===undefined?!![]:![]:!![]})[_0x7c6a('0x1e')](function(_0x43865a){logger[_0x7c6a('0xf')](_0x7c6a('0x19'),_0x292502);logger[_0x7c6a('0x11')]('CreateChatMessage',_0x292502,JSON['stringify'](_0x43865a));_0x32ce51(_0x43865a);})['catch'](function(_0x33f4fb){logger[_0x7c6a('0x14')](_0x7c6a('0x19'),_0x33f4fb[_0x7c6a('0x17')],_0x292502);_0x506555(_0x340fad[_0x7c6a('0x14')](0x1f4,_0x33f4fb[_0x7c6a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7a8ec6f..4270184 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 _0xc03e=['register','length','chatMessage:','./chatMessage.events','update','emit','removeListener'];(function(_0x2150af,_0x518e6b){var _0x18b16f=function(_0x359ab7){while(--_0x359ab7){_0x2150af['push'](_0x2150af['shift']());}};_0x18b16f(++_0x518e6b);}(_0xc03e,0x15a));var _0xec03=function(_0x2b90dc,_0x10b832){_0x2b90dc=_0x2b90dc-0x0;var _0x4794a6=_0xc03e[_0x2b90dc];return _0x4794a6;};'use strict';var ChatMessageEvents=require(_0xec03('0x0'));var events=['save','remove',_0xec03('0x1')];function createListener(_0x58e2d6,_0x3af7cc){return function(_0x5b2577){_0x3af7cc[_0xec03('0x2')](_0x58e2d6,_0x5b2577);};}function removeListener(_0x269001,_0x3e3a78){return function(){ChatMessageEvents[_0xec03('0x3')](_0x269001,_0x3e3a78);};}exports[_0xec03('0x4')]=function(_0x1ce78a){for(var _0x31db21=0x0,_0xcaaf03=events[_0xec03('0x5')];_0x31db21<_0xcaaf03;_0x31db21++){var _0x529ebd=events[_0x31db21];var _0x4205e9=createListener(_0xec03('0x6')+_0x529ebd,_0x1ce78a);ChatMessageEvents['on'](_0x529ebd,_0x4205e9);}}; \ No newline at end of file +var _0x7a08=['emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x256ad1,_0x397d6e){var _0x3348d5=function(_0x4c6f9b){while(--_0x4c6f9b){_0x256ad1['push'](_0x256ad1['shift']());}};_0x3348d5(++_0x397d6e);}(_0x7a08,0x11e));var _0x87a0=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0x7a08[_0x16765f];return _0x1326d4;};'use strict';var ChatMessageEvents=require(_0x87a0('0x0'));var events=[_0x87a0('0x1'),'remove','update'];function createListener(_0x305211,_0x5e6791){return function(_0x1b3e4d){_0x5e6791[_0x87a0('0x2')](_0x305211,_0x1b3e4d);};}function removeListener(_0x28c28f,_0x122d33){return function(){ChatMessageEvents[_0x87a0('0x3')](_0x28c28f,_0x122d33);};}exports[_0x87a0('0x4')]=function(_0x1b384a){for(var _0xf9199b=0x0,_0xde806e=events['length'];_0xf9199b<_0xde806e;_0xf9199b++){var _0x27736f=events[_0xf9199b];var _0x1bb04b=createListener(_0x87a0('0x5')+_0x27736f,_0x1b384a);ChatMessageEvents['on'](_0x27736f,_0x1bb04b);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 41f8850..e106ab4 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 _0xdcff=['put','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','chat','chatmessage:create','create'];(function(_0x40692d,_0x5c4d2b){var _0x412625=function(_0x5efafd){while(--_0x5efafd){_0x40692d['push'](_0x40692d['shift']());}};_0x412625(++_0x5c4d2b);}(_0xdcff,0x65));var _0xfdcf=function(_0x387c07,_0x200c86){_0x387c07=_0x387c07-0x0;var _0x58d945=_0xdcff[_0x387c07];return _0x58d945;};'use strict';var multer=require(_0xfdcf('0x0'));var util=require(_0xfdcf('0x1'));var path=require(_0xfdcf('0x2'));var timeout=require(_0xfdcf('0x3'));var express=require('express');var router=express[_0xfdcf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfdcf('0x5'));var interaction=require(_0xfdcf('0x6'));var config=require(_0xfdcf('0x7'));var controller=require(_0xfdcf('0x8'));router[_0xfdcf('0x9')]('/',auth[_0xfdcf('0xa')](),controller[_0xfdcf('0xb')]);router[_0xfdcf('0x9')](_0xfdcf('0xc'),auth[_0xfdcf('0xa')](),controller['describe']);router[_0xfdcf('0x9')](_0xfdcf('0xd'),auth[_0xfdcf('0xa')](),controller[_0xfdcf('0xe')]);router[_0xfdcf('0xf')]('/',auth[_0xfdcf('0xa')](),interaction['tracked'](_0xfdcf('0x10'),_0xfdcf('0x11')),controller[_0xfdcf('0x12')]);router[_0xfdcf('0x13')](_0xfdcf('0xd'),controller['update']);router[_0xfdcf('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xfdcf('0x14')]);router[_0xfdcf('0x13')](_0xfdcf('0x15'),auth[_0xfdcf('0xa')](),controller[_0xfdcf('0x16')]);router['delete'](_0xfdcf('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfdcf('0x17')]=router; \ No newline at end of file +var _0xb7b2=['update','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb7b2,0x73));var _0x2b7b=function(_0x49aaf4,_0x294ae3){_0x49aaf4=_0x49aaf4-0x0;var _0x21db9c=_0xb7b2[_0x49aaf4];return _0x21db9c;};'use strict';var multer=require(_0x2b7b('0x0'));var util=require(_0x2b7b('0x1'));var path=require(_0x2b7b('0x2'));var timeout=require(_0x2b7b('0x3'));var express=require(_0x2b7b('0x4'));var router=express[_0x2b7b('0x5')]();var fs_extra=require(_0x2b7b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b7b('0x7'));router[_0x2b7b('0x8')]('/',auth[_0x2b7b('0x9')](),controller['index']);router[_0x2b7b('0x8')](_0x2b7b('0xa'),auth[_0x2b7b('0x9')](),controller[_0x2b7b('0xb')]);router[_0x2b7b('0x8')](_0x2b7b('0xc'),auth[_0x2b7b('0x9')](),controller[_0x2b7b('0xd')]);router[_0x2b7b('0xe')]('/',auth['isAuthenticated'](),interaction[_0x2b7b('0xf')]('chat','chatmessage:create'),controller['create']);router[_0x2b7b('0x10')](_0x2b7b('0xc'),controller[_0x2b7b('0x11')]);router[_0x2b7b('0x10')](_0x2b7b('0x12'),auth[_0x2b7b('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0x2b7b('0x9')](),controller[_0x2b7b('0x13')]);router[_0x2b7b('0x14')](_0x2b7b('0xc'),auth[_0x2b7b('0x9')](),controller[_0x2b7b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index f5258c2..1315c79 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x293884,_0xc006bb){var _0xfac0d9=function(_0x346977){while(--_0x346977){_0x293884['push'](_0x293884['shift']());}};_0xfac0d9(++_0xc006bb);}(_0xadb5,0xad));var _0x5adb=function(_0x42d78a,_0x538a72){_0x42d78a=_0x42d78a-0x0;var _0x393c9f=_0xadb5[_0x42d78a];return _0x393c9f;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x792c70,_0x529c8a){var _0x3ed360=function(_0x3aba36){while(--_0x3aba36){_0x792c70['push'](_0x792c70['shift']());}};_0x3ed360(++_0x529c8a);}(_0xadb5,0xad));var _0x5adb=function(_0x3088bb,_0x36b664){_0x3088bb=_0x3088bb-0x0;var _0x4c1933=_0xadb5[_0x3088bb];return _0x4c1933;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 41fef83..eefae5b 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x1e62e0,_0x4f6fde){_0x1e62e0=_0x1e62e0-0x0;var _0x378acc=_0x7a54[_0x1e62e0];return _0x378acc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0x3bdd4e,_0xf68595){_0x3bdd4e=_0x3bdd4e-0x0;var _0x4b75ad=_0x7a54[_0x3bdd4e];return _0x4b75ad;};'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 5dff23c..3ee4d00 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 _0x5679=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x319249,_0x3ca975){var _0x500412=function(_0xa59d5c){while(--_0xa59d5c){_0x319249['push'](_0x319249['shift']());}};_0x500412(++_0x3ca975);}(_0x5679,0x104));var _0x9567=function(_0x3d7f60,_0x2e469b){_0x3d7f60=_0x3d7f60-0x0;var _0x29a887=_0x5679[_0x3d7f60];return _0x29a887;};'use strict';var EventEmitter=require(_0x9567('0x0'));var ChatOfflineMessage=require(_0x9567('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9567('0x2')](0x0);var events={'afterCreate':_0x9567('0x3'),'afterUpdate':_0x9567('0x4'),'afterDestroy':_0x9567('0x5')};function emitEvent(_0xa14cc9){return function(_0x43c13a,_0x158d44,_0x4a0636){ChatOfflineMessageEvents[_0x9567('0x6')](_0xa14cc9+':'+_0x43c13a['id'],_0x43c13a);ChatOfflineMessageEvents[_0x9567('0x6')](_0xa14cc9,_0x43c13a);_0x4a0636(null);};}for(var e in events){if(events[_0x9567('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x9567('0x8')](e,emitEvent(event));}}module[_0x9567('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xde7f=['remove','emit','hasOwnProperty','hook','setMaxListeners','save'];(function(_0x43ff14,_0x15b402){var _0x18925e=function(_0x471299){while(--_0x471299){_0x43ff14['push'](_0x43ff14['shift']());}};_0x18925e(++_0x15b402);}(_0xde7f,0x1f0));var _0xfde7=function(_0x600be6,_0x303ba9){_0x600be6=_0x600be6-0x0;var _0x2e3879=_0xde7f[_0x600be6];return _0x2e3879;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xfde7('0x0')](0x0);var events={'afterCreate':_0xfde7('0x1'),'afterUpdate':'update','afterDestroy':_0xfde7('0x2')};function emitEvent(_0x56cf2f){return function(_0x56bb08,_0x505273,_0x5749bc){ChatOfflineMessageEvents['emit'](_0x56cf2f+':'+_0x56bb08['id'],_0x56bb08);ChatOfflineMessageEvents[_0xfde7('0x3')](_0x56cf2f,_0x56bb08);_0x5749bc(null);};}for(var e in events){if(events[_0xfde7('0x4')](e)){var event=events[e];ChatOfflineMessage[_0xfde7('0x5')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index a84f603..56b757f 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 _0xf2b3=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xf2b3,0xd3));var _0x3f2b=function(_0x3cf504,_0x2cc551){_0x3cf504=_0x3cf504-0x0;var _0x130459=_0xf2b3[_0x3cf504];return _0x130459;};'use strict';var attributes=require(_0x3f2b('0x0'));module['exports']=function(_0x6b7509){return _0x6b7509[_0x3f2b('0x1')](_0x3f2b('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3f2b('0x3'),'collate':_0x3f2b('0x4')});}; \ No newline at end of file +var _0x354e=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x31180d,_0x5cfd35){var _0x538978=function(_0x2e2205){while(--_0x2e2205){_0x31180d['push'](_0x31180d['shift']());}};_0x538978(++_0x5cfd35);}(_0x354e,0x116));var _0xe354=function(_0xccd93b,_0x10a53d){_0xccd93b=_0xccd93b-0x0;var _0x54e149=_0x354e[_0xccd93b];return _0x54e149;};'use strict';var attributes=require(_0xe354('0x0'));module[_0xe354('0x1')]=function(_0x50a323){return _0x50a323[_0xe354('0x2')](_0xe354('0x3'),attributes,{'tableName':_0xe354('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe354('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 46f4498..089347b 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 _0x95b2=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x308a1d,_0x3d379d){var _0x5eb875=function(_0x464dbe){while(--_0x464dbe){_0x308a1d['push'](_0x308a1d['shift']());}};_0x5eb875(++_0x3d379d);}(_0x95b2,0x144));var _0x295b=function(_0x22b8dc,_0x222e30){_0x22b8dc=_0x22b8dc-0x0;var _0x1c4bdf=_0x95b2[_0x22b8dc];return _0x1c4bdf;};'use strict';var _=require(_0x295b('0x0'));var util=require(_0x295b('0x1'));var moment=require(_0x295b('0x2'));var BPromise=require(_0x295b('0x3'));var rs=require(_0x295b('0x4'));var fs=require('fs');var Redis=require(_0x295b('0x5'));var db=require(_0x295b('0x6'))['db'];var utils=require(_0x295b('0x7'));var logger=require(_0x295b('0x8'))('rpc');var config=require(_0x295b('0x9'));var jayson=require(_0x295b('0xa'));var client=jayson[_0x295b('0xb')][_0x295b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xef543d,_0x52a60b,_0x1172b6){return new BPromise(function(_0x454eb2,_0xf90f02){return client[_0x295b('0xd')](_0xef543d,_0x1172b6)[_0x295b('0xe')](function(_0x3c23e5){logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));logger['debug'](_0x295b('0x12'),_0x52a60b,_0x295b('0x11'),JSON[_0x295b('0x13')](_0x3c23e5));if(_0x3c23e5['error']){if(_0x3c23e5['error'][_0x295b('0x14')]===0x1f4){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5[_0x295b('0x15')]['message']);return _0xf90f02(_0x3c23e5[_0x295b('0x15')]['message']);}logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0x3c23e5['error'][_0x295b('0x16')]);return _0x454eb2(_0x3c23e5[_0x295b('0x15')][_0x295b('0x16')]);}else{logger[_0x295b('0xf')](_0x295b('0x10'),_0x52a60b,_0x295b('0x11'));_0x454eb2(_0x3c23e5[_0x295b('0x17')][_0x295b('0x16')]);}})['catch'](function(_0xc9604d){logger[_0x295b('0x15')](_0x295b('0x10'),_0x52a60b,_0xc9604d);_0xf90f02(_0xc9604d);});});} \ No newline at end of file +var _0xa220=['message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2774a7,_0x370440){var _0x5aadbf=function(_0x275ebc){while(--_0x275ebc){_0x2774a7['push'](_0x2774a7['shift']());}};_0x5aadbf(++_0x370440);}(_0xa220,0x100));var _0x0a22=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa220[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0a22('0x0'));var util=require(_0x0a22('0x1'));var moment=require(_0x0a22('0x2'));var BPromise=require(_0x0a22('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a22('0x4'))['db'];var utils=require(_0x0a22('0x5'));var logger=require(_0x0a22('0x6'))(_0x0a22('0x7'));var config=require(_0x0a22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a22('0x9')][_0x0a22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1583a9,_0x18249b,_0x4609b6){return new BPromise(function(_0x3822fd,_0x63a927){return client[_0x0a22('0xb')](_0x1583a9,_0x4609b6)[_0x0a22('0xc')](function(_0x409b3c){logger['info'](_0x0a22('0xd'),_0x18249b,_0x0a22('0xe'));logger[_0x0a22('0xf')](_0x0a22('0x10'),_0x18249b,_0x0a22('0xe'),JSON[_0x0a22('0x11')](_0x409b3c));if(_0x409b3c[_0x0a22('0x12')]){if(_0x409b3c[_0x0a22('0x12')][_0x0a22('0x13')]===0x1f4){logger[_0x0a22('0x12')](_0x0a22('0xd'),_0x18249b,_0x409b3c['error']['message']);return _0x63a927(_0x409b3c[_0x0a22('0x12')][_0x0a22('0x14')]);}logger[_0x0a22('0x12')](_0x0a22('0xd'),_0x18249b,_0x409b3c[_0x0a22('0x12')][_0x0a22('0x14')]);return _0x3822fd(_0x409b3c[_0x0a22('0x12')][_0x0a22('0x14')]);}else{logger[_0x0a22('0x15')](_0x0a22('0xd'),_0x18249b,_0x0a22('0xe'));_0x3822fd(_0x409b3c[_0x0a22('0x16')][_0x0a22('0x14')]);}})['catch'](function(_0x1fb5dc){logger[_0x0a22('0x12')](_0x0a22('0xd'),_0x18249b,_0x1fb5dc);_0x63a927(_0x1fb5dc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 39375d2..e885107 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 _0xd748=['delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id'];(function(_0x225379,_0x198c44){var _0x5b2308=function(_0x20c8ef){while(--_0x20c8ef){_0x225379['push'](_0x225379['shift']());}};_0x5b2308(++_0x198c44);}(_0xd748,0x111));var _0x8d74=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0xd748[_0x2b91c5];return _0xbd5531;};'use strict';var multer=require('multer');var util=require(_0x8d74('0x0'));var path=require('path');var timeout=require(_0x8d74('0x1'));var express=require(_0x8d74('0x2'));var router=express[_0x8d74('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d74('0x4'));var interaction=require(_0x8d74('0x5'));var config=require(_0x8d74('0x6'));var controller=require(_0x8d74('0x7'));router[_0x8d74('0x8')]('/',auth[_0x8d74('0x9')](),controller[_0x8d74('0xa')]);router[_0x8d74('0x8')](_0x8d74('0xb'),auth[_0x8d74('0x9')](),controller[_0x8d74('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8d74('0xd')]);router[_0x8d74('0xe')]('/',auth[_0x8d74('0x9')](),controller['create']);router['put'](_0x8d74('0xf'),auth[_0x8d74('0x9')](),controller['update']);router[_0x8d74('0x10')]('/:id',auth[_0x8d74('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7532=['/describe','describe','get','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index'];(function(_0xb2dbed,_0x4ab5f3){var _0x50a42e=function(_0x25298d){while(--_0x25298d){_0xb2dbed['push'](_0xb2dbed['shift']());}};_0x50a42e(++_0x4ab5f3);}(_0x7532,0x1c2));var _0x2753=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0x7532[_0x2ac5f8];return _0x3b8229;};'use strict';var multer=require(_0x2753('0x0'));var util=require(_0x2753('0x1'));var path=require(_0x2753('0x2'));var timeout=require(_0x2753('0x3'));var express=require('express');var router=express[_0x2753('0x4')]();var fs_extra=require(_0x2753('0x5'));var auth=require(_0x2753('0x6'));var interaction=require(_0x2753('0x7'));var config=require(_0x2753('0x8'));var controller=require(_0x2753('0x9'));router['get']('/',auth[_0x2753('0xa')](),controller[_0x2753('0xb')]);router['get'](_0x2753('0xc'),auth[_0x2753('0xa')](),controller[_0x2753('0xd')]);router[_0x2753('0xe')](_0x2753('0xf'),auth[_0x2753('0xa')](),controller[_0x2753('0x10')]);router['post']('/',auth[_0x2753('0xa')](),controller[_0x2753('0x11')]);router['put'](_0x2753('0xf'),auth['isAuthenticated'](),controller[_0x2753('0x12')]);router[_0x2753('0x13')](_0x2753('0xf'),auth['isAuthenticated'](),controller[_0x2753('0x14')]);module[_0x2753('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 5479ab7..f0ea763 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 _0x51f3=['INTEGER','sequelize','exports','timeout','mouseOver','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x51f3,0x73));var _0x351f=function(_0x4c026f,_0x1004bb){_0x4c026f=_0x4c026f-0x0;var _0x2fb4c8=_0x51f3[_0x4c026f];return _0x2fb4c8;};'use strict';var Sequelize=require(_0x351f('0x0'));module[_0x351f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0x351f('0x2')),'defaultValue':_0x351f('0x3')},'selector':{'type':Sequelize[_0x351f('0x4')]},'timeout':{'type':Sequelize[_0x351f('0x5')]}}; \ No newline at end of file +var _0xadb2=['ENUM','mouseOver','INTEGER','sequelize','exports'];(function(_0x13d757,_0xb9e660){var _0x1766f9=function(_0x153028){while(--_0x153028){_0x13d757['push'](_0x13d757['shift']());}};_0x1766f9(++_0xb9e660);}(_0xadb2,0x152));var _0x2adb=function(_0x3ea8c1,_0x330ece){_0x3ea8c1=_0x3ea8c1-0x0;var _0x280b69=_0xadb2[_0x3ea8c1];return _0x280b69;};'use strict';var Sequelize=require(_0x2adb('0x0'));module[_0x2adb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2adb('0x2')](_0x2adb('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2adb('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7597a56..1988d9d 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 _0xeb0d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','keys','query','filters','intersection','attributes','fields','includeAll','include','merge','options','catch','create','body','find','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x339cb7,_0x54ba58){var _0x216132=function(_0x21265e){while(--_0x21265e){_0x339cb7['push'](_0x339cb7['shift']());}};_0x216132(++_0x54ba58);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x3c009b,_0x13da02){_0x3c009b=_0x3c009b-0x0;var _0x560161=_0xeb0d[_0x3c009b];return _0x560161;};'use strict';var emlformat=require(_0xdeb0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdeb0('0x1'));var moment=require(_0xdeb0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdeb0('0x3'));var util=require(_0xdeb0('0x4'));var path=require(_0xdeb0('0x5'));var sox=require(_0xdeb0('0x6'));var csv=require(_0xdeb0('0x7'));var ejs=require(_0xdeb0('0x8'));var fs=require('fs');var fs_extra=require(_0xdeb0('0x9'));var _=require(_0xdeb0('0xa'));var squel=require('squel');var crypto=require(_0xdeb0('0xb'));var jsforce=require(_0xdeb0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdeb0('0x7'));var querystring=require(_0xdeb0('0xd'));var Papa=require(_0xdeb0('0xe'));var Redis=require(_0xdeb0('0xf'));var authService=require(_0xdeb0('0x10'));var qs=require(_0xdeb0('0x11'));var as=require(_0xdeb0('0x12'));var hardwareService=require(_0xdeb0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdeb0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdeb0('0x15'));var db=require(_0xdeb0('0x16'))['db'];function respondWithStatusCode(_0x30ef3a,_0x3cce39){_0x3cce39=_0x3cce39||0xcc;return function(_0xcf93dc){if(_0xcf93dc){return _0x30ef3a[_0xdeb0('0x17')](_0x3cce39);}return _0x30ef3a[_0xdeb0('0x18')](_0x3cce39)[_0xdeb0('0x19')]();};}function respondWithResult(_0x1f065c,_0x50e782){_0x50e782=_0x50e782||0xc8;return function(_0xf0995d){if(_0xf0995d){return _0x1f065c[_0xdeb0('0x18')](_0x50e782)[_0xdeb0('0x1a')](_0xf0995d);}};}function respondWithFilteredResult(_0x244001,_0x35fce3){return function(_0x55fab1){if(_0x55fab1){var _0x1510ce=typeof _0x35fce3['offset']===_0xdeb0('0x1b')&&typeof _0x35fce3[_0xdeb0('0x1c')]===_0xdeb0('0x1b');var _0x5c3c97=_0x55fab1[_0xdeb0('0x1d')];var _0x51e7ee=_0x1510ce?0x0:_0x35fce3[_0xdeb0('0x1e')];var _0x2b1efa=_0x1510ce?_0x55fab1[_0xdeb0('0x1d')]:_0x35fce3['offset']+_0x35fce3[_0xdeb0('0x1c')];var _0x5a44be;if(_0x2b1efa>=_0x5c3c97){_0x2b1efa=_0x5c3c97;_0x5a44be=0xc8;}else{_0x5a44be=0xce;}_0x244001[_0xdeb0('0x18')](_0x5a44be);return _0x244001[_0xdeb0('0x1f')](_0xdeb0('0x20'),_0x51e7ee+'-'+_0x2b1efa+'/'+_0x5c3c97)[_0xdeb0('0x1a')](_0x55fab1);}return null;};}function patchUpdates(_0x486f0d){return function(_0x2ba1ff){try{jsonpatch[_0xdeb0('0x21')](_0x2ba1ff,_0x486f0d,!![]);}catch(_0x2f6cac){return BPromise[_0xdeb0('0x22')](_0x2f6cac);}return _0x2ba1ff[_0xdeb0('0x23')]();};}function saveUpdates(_0x2a3ec4,_0x3173a2){return function(_0xd48473){if(_0xd48473){return _0xd48473[_0xdeb0('0x24')](_0x2a3ec4)[_0xdeb0('0x25')](function(_0x32cdf6){return _0x32cdf6;});}return null;};}function removeEntity(_0x5d7565,_0x566f1f){return function(_0x539652){if(_0x539652){return _0x539652[_0xdeb0('0x26')]()['then'](function(){_0x5d7565['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38bd4d,_0xbfa9e8){return function(_0x2076c4){if(!_0x2076c4){_0x38bd4d[_0xdeb0('0x17')](0x194);}return _0x2076c4;};}function handleError(_0x3ae683,_0x2cd180){_0x2cd180=_0x2cd180||0x1f4;return function(_0x19456b){logger[_0xdeb0('0x27')](_0x19456b[_0xdeb0('0x28')]);if(_0x19456b[_0xdeb0('0x29')]){delete _0x19456b[_0xdeb0('0x29')];}_0x3ae683[_0xdeb0('0x18')](_0x2cd180)[_0xdeb0('0x2a')](_0x19456b);};}exports[_0xdeb0('0x2b')]=function(_0x8f5bb3,_0x224528){var _0x9ac567={'raw':!![],'where':{'id':_0x8f5bb3[_0xdeb0('0x2c')]['id']}},_0x59cc01={};_0x59cc01[_0xdeb0('0x2d')]=_['keys'](db[_0xdeb0('0x2e')]['rawAttributes']);_0x59cc01['query']=_[_0xdeb0('0x2f')](_0x8f5bb3[_0xdeb0('0x30')]);_0x59cc01[_0xdeb0('0x31')]=_[_0xdeb0('0x32')](_0x59cc01['model'],_0x59cc01[_0xdeb0('0x30')]);_0x9ac567[_0xdeb0('0x33')]=_[_0xdeb0('0x32')](_0x59cc01['model'],qs[_0xdeb0('0x34')](_0x8f5bb3['query'][_0xdeb0('0x34')]));_0x9ac567[_0xdeb0('0x33')]=_0x9ac567[_0xdeb0('0x33')]['length']?_0x9ac567[_0xdeb0('0x33')]:_0x59cc01['model'];if(_0x8f5bb3[_0xdeb0('0x30')][_0xdeb0('0x35')]){_0x9ac567[_0xdeb0('0x36')]=[{'all':!![]}];}_0x9ac567=_[_0xdeb0('0x37')]({},_0x9ac567,_0x8f5bb3[_0xdeb0('0x38')]);return db[_0xdeb0('0x2e')]['find'](_0x9ac567)[_0xdeb0('0x25')](handleEntityNotFound(_0x224528,null))[_0xdeb0('0x25')](respondWithResult(_0x224528,null))[_0xdeb0('0x39')](handleError(_0x224528,null));};exports['create']=function(_0x301f28,_0x634bea){return db['ChatProactiveAction'][_0xdeb0('0x3a')](_0x301f28[_0xdeb0('0x3b')],{})[_0xdeb0('0x25')](respondWithResult(_0x634bea,0xc9))[_0xdeb0('0x39')](handleError(_0x634bea,null));};exports[_0xdeb0('0x24')]=function(_0x15e6ae,_0x57297c){if(_0x15e6ae[_0xdeb0('0x3b')]['id']){delete _0x15e6ae[_0xdeb0('0x3b')]['id'];}return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x15e6ae['params']['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x57297c,null))['then'](saveUpdates(_0x15e6ae[_0xdeb0('0x3b')],null))[_0xdeb0('0x25')](respondWithResult(_0x57297c,null))[_0xdeb0('0x39')](handleError(_0x57297c,null));};exports[_0xdeb0('0x26')]=function(_0x5526e0,_0x23215f){return db[_0xdeb0('0x2e')][_0xdeb0('0x3c')]({'where':{'id':_0x5526e0[_0xdeb0('0x2c')]['id']}})[_0xdeb0('0x25')](handleEntityNotFound(_0x23215f,null))[_0xdeb0('0x25')](removeEntity(_0x23215f,null))[_0xdeb0('0x39')](handleError(_0x23215f,null));}; \ No newline at end of file +var _0xdbf5=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x224e85,_0x11665b){var _0x3ed819=function(_0x297aa1){while(--_0x297aa1){_0x224e85['push'](_0x224e85['shift']());}};_0x3ed819(++_0x11665b);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5d1c67,_0x240ebe){_0x5d1c67=_0x5d1c67-0x0;var _0x452ef4=_0xdbf5[_0x5d1c67];return _0x452ef4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={'raw':!![],'where':{'id':_0x471027[_0x5dbf('0x28')]['id']}},_0x2f71eb={};_0x2f71eb[_0x5dbf('0x29')]=_[_0x5dbf('0x2a')](db[_0x5dbf('0x2b')][_0x5dbf('0x2c')]);_0x2f71eb[_0x5dbf('0x2d')]=_[_0x5dbf('0x2a')](_0x471027[_0x5dbf('0x2d')]);_0x2f71eb[_0x5dbf('0x2e')]=_[_0x5dbf('0x2f')](_0x2f71eb['model'],_0x2f71eb['query']);_0x5768b7[_0x5dbf('0x30')]=_[_0x5dbf('0x2f')](_0x2f71eb[_0x5dbf('0x29')],qs[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x2d')]['fields']));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x30')][_0x5dbf('0x32')]?_0x5768b7['attributes']:_0x2f71eb[_0x5dbf('0x29')];if(_0x471027[_0x5dbf('0x2d')][_0x5dbf('0x33')]){_0x5768b7[_0x5dbf('0x34')]=[{'all':!![]}];}_0x5768b7=_[_0x5dbf('0x35')]({},_0x5768b7,_0x471027['options']);return db[_0x5dbf('0x2b')][_0x5dbf('0x36')](_0x5768b7)[_0x5dbf('0x20')](handleEntityNotFound(_0x21cd00,null))[_0x5dbf('0x20')](respondWithResult(_0x21cd00,null))[_0x5dbf('0x37')](handleError(_0x21cd00,null));};exports['create']=function(_0x252d54,_0x7dc2da){return db[_0x5dbf('0x2b')][_0x5dbf('0x38')](_0x252d54['body'],{})[_0x5dbf('0x20')](respondWithResult(_0x7dc2da,0xc9))[_0x5dbf('0x37')](handleError(_0x7dc2da,null));};exports[_0x5dbf('0x1f')]=function(_0x3439da,_0x3e309a){if(_0x3439da[_0x5dbf('0x39')]['id']){delete _0x3439da[_0x5dbf('0x39')]['id'];}return db[_0x5dbf('0x2b')][_0x5dbf('0x36')]({'where':{'id':_0x3439da[_0x5dbf('0x28')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x3e309a,null))['then'](saveUpdates(_0x3439da[_0x5dbf('0x39')],null))[_0x5dbf('0x20')](respondWithResult(_0x3e309a,null))[_0x5dbf('0x37')](handleError(_0x3e309a,null));};exports['destroy']=function(_0x31de38,_0x43954b){return db[_0x5dbf('0x2b')]['find']({'where':{'id':_0x31de38[_0x5dbf('0x28')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x43954b,null))[_0x5dbf('0x20')](removeEntity(_0x43954b,null))['catch'](handleError(_0x43954b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index f6ac48c..8f10ae7 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 _0x8baf=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0xa41fca,_0x43e18b){var _0xca9b1e=function(_0x23cd03){while(--_0x23cd03){_0xa41fca['push'](_0xa41fca['shift']());}};_0xca9b1e(++_0x43e18b);}(_0x8baf,0xd1));var _0xf8ba=function(_0xf6affc,_0x3b7442){_0xf6affc=_0xf6affc-0x0;var _0x56199f=_0x8baf[_0xf6affc];return _0x56199f;};'use strict';var _=require(_0xf8ba('0x0'));var util=require(_0xf8ba('0x1'));var logger=require('../../config/logger')(_0xf8ba('0x2'));var moment=require(_0xf8ba('0x3'));var BPromise=require(_0xf8ba('0x4'));var rp=require(_0xf8ba('0x5'));var fs=require('fs');var path=require(_0xf8ba('0x6'));var rimraf=require(_0xf8ba('0x7'));var config=require(_0xf8ba('0x8'));var attributes=require(_0xf8ba('0x9'));module[_0xf8ba('0xa')]=function(_0x543ca9,_0x558575){return _0x543ca9[_0xf8ba('0xb')](_0xf8ba('0xc'),attributes,{'tableName':_0xf8ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9df=['path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4f6993,_0x372975){var _0x1e5f82=function(_0x81115e){while(--_0x81115e){_0x4f6993['push'](_0x4f6993['shift']());}};_0x1e5f82(++_0x372975);}(_0xd9df,0x15a));var _0xfd9d=function(_0x2b8ade,_0xffc2e){_0x2b8ade=_0x2b8ade-0x0;var _0x5dc3dc=_0xd9df[_0x2b8ade];return _0x5dc3dc;};'use strict';var _=require(_0xfd9d('0x0'));var util=require(_0xfd9d('0x1'));var logger=require('../../config/logger')(_0xfd9d('0x2'));var moment=require(_0xfd9d('0x3'));var BPromise=require(_0xfd9d('0x4'));var rp=require(_0xfd9d('0x5'));var fs=require('fs');var path=require(_0xfd9d('0x6'));var rimraf=require('rimraf');var config=require(_0xfd9d('0x7'));var attributes=require(_0xfd9d('0x8'));module[_0xfd9d('0x9')]=function(_0x54f01a,_0x177738){return _0x54f01a['define'](_0xfd9d('0xa'),attributes,{'tableName':'chat_proactive_actions','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 d7bc969..6767927 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 _0x0a36=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x21f2bd,_0x37c406){var _0x4de4f9=function(_0x1ff6cd){while(--_0x1ff6cd){_0x21f2bd['push'](_0x21f2bd['shift']());}};_0x4de4f9(++_0x37c406);}(_0x0a36,0x199));var _0x60a3=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x0a36[_0xf2628e];return _0x13863a;};'use strict';var _=require('lodash');var util=require(_0x60a3('0x0'));var moment=require(_0x60a3('0x1'));var BPromise=require(_0x60a3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x60a3('0x3'));var logger=require(_0x60a3('0x4'))(_0x60a3('0x5'));var config=require('../../config/environment');var jayson=require(_0x60a3('0x6'));var client=jayson[_0x60a3('0x7')][_0x60a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39b781,_0x417309,_0x378dbe){return new BPromise(function(_0x105a9e,_0x9edc24){return client[_0x60a3('0x9')](_0x39b781,_0x378dbe)[_0x60a3('0xa')](function(_0x1c6169){logger['info'](_0x60a3('0xb'),_0x417309,_0x60a3('0xc'));logger[_0x60a3('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x417309,'request\x20sent',JSON[_0x60a3('0xe')](_0x1c6169));if(_0x1c6169['error']){if(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x10')]===0x1f4){logger[_0x60a3('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x417309,_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);return _0x9edc24(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);}logger[_0x60a3('0xf')](_0x60a3('0xb'),_0x417309,_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);return _0x105a9e(_0x1c6169[_0x60a3('0xf')][_0x60a3('0x11')]);}else{logger[_0x60a3('0x12')](_0x60a3('0xb'),_0x417309,_0x60a3('0xc'));_0x105a9e(_0x1c6169[_0x60a3('0x13')][_0x60a3('0x11')]);}})['catch'](function(_0x452306){logger[_0x60a3('0xf')](_0x60a3('0xb'),_0x417309,_0x452306);_0x9edc24(_0x452306);});});} \ No newline at end of file +var _0x05b0=['../../config/environment','jayson/promise','client','http','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatProactiveAction,\x20%s,\x20%s','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x05b0,0x1db));var _0x005b=function(_0x50ab36,_0x4417d8){_0x50ab36=_0x50ab36-0x0;var _0x54988f=_0x05b0[_0x50ab36];return _0x54988f;};'use strict';var _=require(_0x005b('0x0'));var util=require(_0x005b('0x1'));var moment=require('moment');var BPromise=require(_0x005b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x005b('0x3'));var db=require(_0x005b('0x4'))['db'];var utils=require(_0x005b('0x5'));var logger=require(_0x005b('0x6'))(_0x005b('0x7'));var config=require(_0x005b('0x8'));var jayson=require(_0x005b('0x9'));var client=jayson[_0x005b('0xa')][_0x005b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40f9ff,_0x2d29a8,_0x33dc00){return new BPromise(function(_0x538f2b,_0x33d53e){return client['request'](_0x40f9ff,_0x33dc00)['then'](function(_0x2f5145){logger[_0x005b('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x2d29a8,'request\x20sent');logger[_0x005b('0xd')](_0x005b('0xe'),_0x2d29a8,_0x005b('0xf'),JSON[_0x005b('0x10')](_0x2f5145));if(_0x2f5145['error']){if(_0x2f5145['error'][_0x005b('0x11')]===0x1f4){logger[_0x005b('0x12')](_0x005b('0x13'),_0x2d29a8,_0x2f5145['error'][_0x005b('0x14')]);return _0x33d53e(_0x2f5145[_0x005b('0x12')][_0x005b('0x14')]);}logger[_0x005b('0x12')](_0x005b('0x13'),_0x2d29a8,_0x2f5145[_0x005b('0x12')][_0x005b('0x14')]);return _0x538f2b(_0x2f5145[_0x005b('0x12')]['message']);}else{logger[_0x005b('0xc')](_0x005b('0x13'),_0x2d29a8,_0x005b('0xf'));_0x538f2b(_0x2f5145['result'][_0x005b('0x14')]);}})['catch'](function(_0x256812){logger[_0x005b('0x12')](_0x005b('0x13'),_0x2d29a8,_0x256812);_0x33d53e(_0x256812);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 134e87a..9af0d6d 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 _0x4819=['post','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x3fb372,_0x2d9fc4){var _0x4d7b70=function(_0x517dfc){while(--_0x517dfc){_0x3fb372['push'](_0x3fb372['shift']());}};_0x4d7b70(++_0x2d9fc4);}(_0x4819,0xcd));var _0x9481=function(_0x114b7c,_0xc4b93b){_0x114b7c=_0x114b7c-0x0;var _0x47185f=_0x4819[_0x114b7c];return _0x47185f;};'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'](_0x9481('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9481('0xb')]('/',auth[_0x9481('0xc')](),controller[_0x9481('0xd')]);router[_0x9481('0xe')](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0xf')]);router['delete'](_0x9481('0xa'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);module[_0x9481('0x11')]=router; \ No newline at end of file +var _0xee14=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x5b6158,_0x5945f3){var _0x3b997b=function(_0x3546a5){while(--_0x3546a5){_0x5b6158['push'](_0x5b6158['shift']());}};_0x3b997b(++_0x5945f3);}(_0xee14,0x13a));var _0x4ee1=function(_0x2663d7,_0x52e530){_0x2663d7=_0x2663d7-0x0;var _0x1e196b=_0xee14[_0x2663d7];return _0x1e196b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get'](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xa')]);router[_0x4ee1('0xb')]('/',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0xd')]);router[_0x4ee1('0xe')](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/:id',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 81443bd..9fc3172 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 _0x426c=['ENUM','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x4a49e2,_0x4dff6f){var _0x229ace=function(_0x4b217d){while(--_0x4b217d){_0x4a49e2['push'](_0x4a49e2['shift']());}};_0x229ace(++_0x4dff6f);}(_0x426c,0x1d1));var _0xc426=function(_0x32b301,_0x380389){_0x32b301=_0x32b301-0x0;var _0xd0c417=_0x426c[_0x32b301];return _0xd0c417;};'use strict';var Sequelize=require('sequelize');module[_0xc426('0x0')]={'name':{'type':Sequelize[_0xc426('0x1')],'unique':_0xc426('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc426('0x1')]},'timeout':{'type':Sequelize[_0xc426('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc426('0x4')]('rrmemory',_0xc426('0x5'),_0xc426('0x6'))}}; \ No newline at end of file +var _0xa767=['roundrobin','sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x4e2ed7,_0x30c7e8){var _0x1e96a6=function(_0x22f860){while(--_0x22f860){_0x4e2ed7['push'](_0x4e2ed7['shift']());}};_0x1e96a6(++_0x30c7e8);}(_0xa767,0xef));var _0x7a76=function(_0x186020,_0x1fc7f9){_0x186020=_0x186020-0x0;var _0x30380a=_0xa767[_0x186020];return _0x30380a;};'use strict';var Sequelize=require(_0x7a76('0x0'));module[_0x7a76('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a76('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7a76('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7a76('0x4')]('rrmemory',_0x7a76('0x5'),_0x7a76('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 92dd6ac..505bd15 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 _0x5217=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','type','filter','options','ChatQueue','includeAll','include','rows','catch','show','length','merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','UserChatQueue','ChatQueueId','findAll','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','emit','userChatQueue:save','User','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','value','removeTeams','isEmpty','userChatQueue:remove','addAgents','omit','removeAgents','getAgents','nolimit','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5217,0x1ad));var _0x7521=function(_0x5315e1,_0x235063){_0x5315e1=_0x5315e1-0x0;var _0x215a35=_0x5217[_0x5315e1];return _0x215a35;};'use strict';var emlformat=require(_0x7521('0x0'));var rimraf=require(_0x7521('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7521('0x2'));var moment=require(_0x7521('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7521('0x4'));var util=require(_0x7521('0x5'));var path=require('path');var sox=require(_0x7521('0x6'));var csv=require(_0x7521('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7521('0x8'));var _=require(_0x7521('0x9'));var squel=require(_0x7521('0xa'));var crypto=require('crypto');var jsforce=require(_0x7521('0xb'));var deskjs=require(_0x7521('0xc'));var toCsv=require(_0x7521('0x7'));var querystring=require(_0x7521('0xd'));var Papa=require('papaparse');var Redis=require(_0x7521('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7521('0xf'));var as=require(_0x7521('0x10'));var hardwareService=require(_0x7521('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x7521('0x12'));var config=require(_0x7521('0x13'));var licenseUtil=require(_0x7521('0x14'));var db=require(_0x7521('0x15'))['db'];config[_0x7521('0x16')]=_[_0x7521('0x17')](config['redis'],{'host':_0x7521('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7521('0x16')]));require(_0x7521('0x19'))[_0x7521('0x1a')](socket);var jayson=require(_0x7521('0x1b'));var client=jayson[_0x7521('0x1c')][_0x7521('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x47dd8d,_0x4668ed,_0x351918,_0x5e4789){return new BPromise(function(_0x4d6cc2,_0x53a14a){var _0x2562bd=_0x5e4789||client;return _0x2562bd[_0x7521('0x1e')](_0x47dd8d,_0x351918)[_0x7521('0x1f')](function(_0x19f621){logger[_0x7521('0x20')](_0x7521('0x21'),_0x4668ed,_0x7521('0x22'));logger['debug'](_0x7521('0x23'),_0x4668ed,'request\x20sent',JSON[_0x7521('0x24')](_0x19f621));if(_0x19f621[_0x7521('0x25')]){if(_0x19f621[_0x7521('0x25')][_0x7521('0x26')]===0x1f4){logger[_0x7521('0x25')](_0x7521('0x21'),_0x4668ed,_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);return _0x53a14a(_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);}logger[_0x7521('0x25')](_0x7521('0x21'),_0x4668ed,_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);return _0x4d6cc2(_0x19f621[_0x7521('0x25')][_0x7521('0x27')]);}else{logger[_0x7521('0x20')](_0x7521('0x21'),_0x4668ed,_0x7521('0x22'));_0x4d6cc2(_0x19f621[_0x7521('0x28')][_0x7521('0x27')]);}})['catch'](function(_0x407ba6){logger['error'](_0x7521('0x21'),_0x4668ed,_0x407ba6);_0x53a14a(_0x407ba6);});});}function respondWithStatusCode(_0x616010,_0x4887c0){_0x4887c0=_0x4887c0||0xcc;return function(_0x14a4e9){if(_0x14a4e9){return _0x616010[_0x7521('0x29')](_0x4887c0);}return _0x616010['status'](_0x4887c0)[_0x7521('0x2a')]();};}function respondWithResult(_0x547e7c,_0x435fb){_0x435fb=_0x435fb||0xc8;return function(_0x480ddc){if(_0x480ddc){return _0x547e7c[_0x7521('0x2b')](_0x435fb)['json'](_0x480ddc);}};}function respondWithFilteredResult(_0x486a56,_0x4bf3cf){return function(_0x49e7de){if(_0x49e7de){var _0x4ee851=typeof _0x4bf3cf[_0x7521('0x2c')]==='undefined'&&typeof _0x4bf3cf['limit']==='undefined';var _0x253e2a=_0x49e7de['count'];var _0xe872d8=_0x4ee851?0x0:_0x4bf3cf[_0x7521('0x2c')];var _0x512c13=_0x4ee851?_0x49e7de[_0x7521('0x2d')]:_0x4bf3cf[_0x7521('0x2c')]+_0x4bf3cf[_0x7521('0x2e')];var _0x1cd97a;if(_0x512c13>=_0x253e2a){_0x512c13=_0x253e2a;_0x1cd97a=0xc8;}else{_0x1cd97a=0xce;}_0x486a56[_0x7521('0x2b')](_0x1cd97a);return _0x486a56[_0x7521('0x2f')](_0x7521('0x30'),_0xe872d8+'-'+_0x512c13+'/'+_0x253e2a)[_0x7521('0x31')](_0x49e7de);}return null;};}function patchUpdates(_0x1331ea){return function(_0x1f4cda){try{jsonpatch[_0x7521('0x32')](_0x1f4cda,_0x1331ea,!![]);}catch(_0x2d8593){return BPromise[_0x7521('0x33')](_0x2d8593);}return _0x1f4cda[_0x7521('0x34')]();};}function saveUpdates(_0x419b50,_0x2ff493){return function(_0x20c9ce){if(_0x20c9ce){return _0x20c9ce[_0x7521('0x35')](_0x419b50)['then'](function(_0x2b1821){return _0x2b1821;});}return null;};}function removeEntity(_0xfa5e7,_0x598979){return function(_0x2e40d0){if(_0x2e40d0){return _0x2e40d0[_0x7521('0x36')]()[_0x7521('0x1f')](function(){var _0x32b93a=_0x2e40d0[_0x7521('0x37')]({'plain':!![]});var _0x380d42=_0x7521('0x38');return db[_0x7521('0x39')][_0x7521('0x36')]({'where':{'type':_0x380d42,'resourceId':_0x32b93a['id']}})['then'](function(){return _0x2e40d0;});})[_0x7521('0x1f')](function(){_0xfa5e7[_0x7521('0x2b')](0xcc)[_0x7521('0x2a')]();});}};}function handleEntityNotFound(_0x3bce1e,_0xd32c2e){return function(_0x226d3b){if(!_0x226d3b){_0x3bce1e[_0x7521('0x29')](0x194);}return _0x226d3b;};}function handleError(_0x2bdba4,_0xedeef6){_0xedeef6=_0xedeef6||0x1f4;return function(_0x4a832e){logger[_0x7521('0x25')](_0x4a832e[_0x7521('0x3a')]);if(_0x4a832e[_0x7521('0x3b')]){delete _0x4a832e[_0x7521('0x3b')];}_0x2bdba4[_0x7521('0x2b')](_0xedeef6)['send'](_0x4a832e);};}exports[_0x7521('0x3c')]=function(_0x13250e,_0x2f4e7b){var _0x457461={},_0x366152={},_0x1b6abc={'count':0x0,'rows':[]};var _0xac6bf4=_[_0x7521('0x3d')](db['ChatQueue'][_0x7521('0x3e')],function(_0x4bc8db){return{'name':_0x4bc8db['fieldName'],'type':_0x4bc8db['type'][_0x7521('0x3f')]};});_0x366152[_0x7521('0x40')]=_['map'](_0xac6bf4,'name');_0x366152[_0x7521('0x41')]=_[_0x7521('0x42')](_0x13250e[_0x7521('0x41')]);_0x366152[_0x7521('0x43')]=_[_0x7521('0x44')](_0x366152['model'],_0x366152[_0x7521('0x41')]);_0x457461[_0x7521('0x45')]=_['intersection'](_0x366152[_0x7521('0x40')],qs['fields'](_0x13250e['query'][_0x7521('0x46')]));_0x457461[_0x7521('0x45')]=_0x457461['attributes']['length']?_0x457461[_0x7521('0x45')]:_0x366152['model'];if(!_0x13250e['query'][_0x7521('0x47')]('nolimit')){_0x457461['limit']=qs[_0x7521('0x2e')](_0x13250e[_0x7521('0x41')][_0x7521('0x2e')]);_0x457461['offset']=qs[_0x7521('0x2c')](_0x13250e[_0x7521('0x41')][_0x7521('0x2c')]);}_0x457461[_0x7521('0x48')]=qs[_0x7521('0x49')](_0x13250e[_0x7521('0x41')][_0x7521('0x49')]);_0x457461[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x13250e[_0x7521('0x41')],_0x366152[_0x7521('0x43')]),_0xac6bf4);if(_0x13250e[_0x7521('0x41')]['filter']){_0x457461[_0x7521('0x4a')]=_['merge'](_0x457461[_0x7521('0x4a')],{'$or':_['map'](_0xac6bf4,function(_0x46a7b0){if(_0x46a7b0[_0x7521('0x4c')]!=='VIRTUAL'){var _0x557709={};_0x557709[_0x46a7b0[_0x7521('0x3b')]]={'$like':'%'+_0x13250e['query'][_0x7521('0x4d')]+'%'};return _0x557709;}})});}_0x457461=_['merge']({},_0x457461,_0x13250e[_0x7521('0x4e')]);var _0x1be7fb={'where':_0x457461[_0x7521('0x4a')]};return db[_0x7521('0x4f')][_0x7521('0x2d')](_0x1be7fb)['then'](function(_0x432071){_0x1b6abc[_0x7521('0x2d')]=_0x432071;if(_0x13250e[_0x7521('0x41')][_0x7521('0x50')]){_0x457461[_0x7521('0x51')]=[{'all':!![]}];}return db[_0x7521('0x4f')]['findAll'](_0x457461);})[_0x7521('0x1f')](function(_0x26b58e){_0x1b6abc[_0x7521('0x52')]=_0x26b58e;return _0x1b6abc;})[_0x7521('0x1f')](respondWithFilteredResult(_0x2f4e7b,_0x457461))[_0x7521('0x53')](handleError(_0x2f4e7b,null));};exports[_0x7521('0x54')]=function(_0x2c1d71,_0x57e585){var _0x4c4030={'raw':!![],'where':{'id':_0x2c1d71['params']['id']}},_0x2c03f9={};_0x2c03f9[_0x7521('0x40')]=_['keys'](db[_0x7521('0x4f')][_0x7521('0x3e')]);_0x2c03f9[_0x7521('0x41')]=_[_0x7521('0x42')](_0x2c1d71['query']);_0x2c03f9[_0x7521('0x43')]=_['intersection'](_0x2c03f9[_0x7521('0x40')],_0x2c03f9[_0x7521('0x41')]);_0x4c4030[_0x7521('0x45')]=_['intersection'](_0x2c03f9[_0x7521('0x40')],qs[_0x7521('0x46')](_0x2c1d71[_0x7521('0x41')]['fields']));_0x4c4030[_0x7521('0x45')]=_0x4c4030[_0x7521('0x45')][_0x7521('0x55')]?_0x4c4030['attributes']:_0x2c03f9[_0x7521('0x40')];if(_0x2c1d71[_0x7521('0x41')][_0x7521('0x50')]){_0x4c4030['include']=[{'all':!![]}];}_0x4c4030=_[_0x7521('0x56')]({},_0x4c4030,_0x2c1d71[_0x7521('0x4e')]);return db['ChatQueue'][_0x7521('0x57')](_0x4c4030)[_0x7521('0x1f')](handleEntityNotFound(_0x57e585,null))[_0x7521('0x1f')](respondWithResult(_0x57e585,null))[_0x7521('0x53')](handleError(_0x57e585,null));};exports[_0x7521('0x58')]=function(_0x49938d,_0x14adab){return db[_0x7521('0x4f')][_0x7521('0x58')](_0x49938d['body'],{})['then'](function(_0x58fd8d){var _0x24d29e=_0x49938d['user'][_0x7521('0x37')]({'plain':!![]});if(!_0x24d29e)throw new Error(_0x7521('0x59'));if(_0x24d29e['role']==='user'){var _0x828664=_0x58fd8d[_0x7521('0x37')]({'plain':!![]});var _0x3e978c='ChatQueues';return db[_0x7521('0x5a')][_0x7521('0x57')]({'where':{'name':_0x3e978c,'userProfileId':_0x24d29e[_0x7521('0x5b')]},'raw':!![]})[_0x7521('0x1f')](function(_0x526c91){if(_0x526c91&&_0x526c91[_0x7521('0x5c')]===0x0){return db['UserProfileResource']['create']({'name':_0x828664[_0x7521('0x3b')],'resourceId':_0x828664['id'],'type':_0x526c91[_0x7521('0x3b')],'sectionId':_0x526c91['id']},{})[_0x7521('0x1f')](function(){return _0x58fd8d;});}else{return _0x58fd8d;}})['catch'](function(_0x1f405a){logger[_0x7521('0x25')](_0x7521('0x5d'),_0x1f405a);throw _0x1f405a;});}return _0x58fd8d;})[_0x7521('0x1f')](respondWithResult(_0x14adab,0xc9))[_0x7521('0x53')](handleError(_0x14adab,null));};exports[_0x7521('0x35')]=function(_0x228ac4,_0x2fe1cd){if(_0x228ac4[_0x7521('0x5e')]['id']){delete _0x228ac4['body']['id'];}return db[_0x7521('0x4f')]['find']({'where':{'id':_0x228ac4[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x2fe1cd,null))['then'](saveUpdates(_0x228ac4[_0x7521('0x5e')],null))[_0x7521('0x1f')](respondWithResult(_0x2fe1cd,null))['catch'](handleError(_0x2fe1cd,null));};exports[_0x7521('0x36')]=function(_0x1b2b40,_0x32e06c){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x1b2b40[_0x7521('0x5f')]['id']}})['then'](handleEntityNotFound(_0x32e06c,null))[_0x7521('0x1f')](removeEntity(_0x32e06c,null))[_0x7521('0x53')](handleError(_0x32e06c,null));};exports[_0x7521('0x60')]=function(_0x26093a,_0x58a547){return db[_0x7521('0x4f')][_0x7521('0x60')]()[_0x7521('0x1f')](respondWithResult(_0x58a547,null))[_0x7521('0x53')](handleError(_0x58a547,null));};exports['getMembers']=function(_0x13267a,_0x428ddf,_0x51b4a7){var _0x3bcdc0={'raw':!![],'where':{}},_0x114a3b={},_0x343d9d;return db[_0x7521('0x4f')]['findOne']({'where':{'id':_0x13267a['params']['id']}})['then'](handleEntityNotFound(_0x428ddf,null))['then'](function(_0x413fce){if(_0x413fce){_0x343d9d=_0x413fce['get']({'plain':!![]});_0x114a3b[_0x7521('0x40')]=_[_0x7521('0x42')](db[_0x7521('0x61')][_0x7521('0x3e')]);_0x114a3b[_0x7521('0x41')]=_[_0x7521('0x42')](_0x13267a[_0x7521('0x41')]);_0x114a3b[_0x7521('0x43')]=_[_0x7521('0x44')](_0x114a3b[_0x7521('0x40')],_0x114a3b[_0x7521('0x41')]);_0x3bcdc0[_0x7521('0x45')]=_[_0x7521('0x44')](_0x114a3b[_0x7521('0x40')],qs[_0x7521('0x46')](_0x13267a[_0x7521('0x41')][_0x7521('0x46')]));_0x3bcdc0['attributes']=_0x3bcdc0['attributes']['length']?_0x3bcdc0[_0x7521('0x45')]:_0x114a3b[_0x7521('0x40')];if(!_0x13267a['query']['hasOwnProperty']('nolimit')){_0x3bcdc0['limit']=qs['limit'](_0x13267a[_0x7521('0x41')]['limit']);_0x3bcdc0[_0x7521('0x2c')]=qs[_0x7521('0x2c')](_0x13267a[_0x7521('0x41')]['offset']);}_0x3bcdc0['order']=qs[_0x7521('0x49')](_0x13267a[_0x7521('0x41')]['sort']);_0x3bcdc0[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x13267a[_0x7521('0x41')],_0x114a3b['filters']));_0x3bcdc0['where'][_0x7521('0x62')]=_0x413fce['id'];if(_0x13267a['query'][_0x7521('0x4d')]){_0x3bcdc0[_0x7521('0x4a')]=_['merge'](_0x3bcdc0['where'],{'$or':_[_0x7521('0x3d')](_0x3bcdc0['attributes'],function(_0x2a6396){var _0x59d874={};_0x59d874[_0x2a6396]={'$like':'%'+_0x13267a['query']['filter']+'%'};return _0x59d874;})});}_0x3bcdc0=_[_0x7521('0x56')]({},_0x3bcdc0,_0x13267a[_0x7521('0x4e')]);return db[_0x7521('0x61')][_0x7521('0x63')](_0x3bcdc0);}})[_0x7521('0x1f')](function(_0x427b24){if(_0x427b24){return db['User'][_0x7521('0x64')]({'where':{'id':_[_0x7521('0x3d')](_0x427b24,_0x7521('0x65')),'role':_0x7521('0x66')},'attributes':['id',_0x7521('0x3b'),_0x7521('0x67'),_0x7521('0x68'),_0x7521('0x69')]});}})[_0x7521('0x1f')](function(_0x57419b){if(_0x57419b){return{'count':_0x57419b[_0x7521('0x2d')],'rows':_[_0x7521('0x3d')](_0x57419b[_0x7521('0x52')],function(_0x1fb99d){return{'membername':_0x1fb99d[_0x7521('0x3b')],'UserId':_0x1fb99d['id'],'queue_name':_0x343d9d[_0x7521('0x3b')],'ChatQueueId':_0x343d9d['id'],'interface':util[_0x7521('0x6a')]('%s/%s',_0x7521('0x6b'),_0x1fb99d[_0x7521('0x3b')]),'penalty':0x0,'paused':_0x1fb99d['chatPause'],'createdAt':_0x1fb99d[_0x7521('0x69')],'updatedAt':_0x1fb99d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x428ddf,_0x3bcdc0))[_0x7521('0x53')](handleError(_0x428ddf,null));};exports[_0x7521('0x6c')]=function(_0x3be1cc,_0x373d12,_0x870ebd){var _0x336afc={};var _0x22c45d={};var _0x414332;var _0x1f8d89;return db[_0x7521('0x4f')][_0x7521('0x6d')]({'where':{'id':_0x3be1cc[_0x7521('0x5f')]['id']}})['then'](handleEntityNotFound(_0x373d12,null))[_0x7521('0x1f')](function(_0xc7b498){if(_0xc7b498){_0x414332=_0xc7b498;_0x22c45d[_0x7521('0x40')]=_['keys'](db[_0x7521('0x6e')][_0x7521('0x3e')]);_0x22c45d[_0x7521('0x41')]=_[_0x7521('0x42')](_0x3be1cc['query']);_0x22c45d[_0x7521('0x43')]=_[_0x7521('0x44')](_0x22c45d[_0x7521('0x40')],_0x22c45d['query']);_0x336afc['attributes']=_['intersection'](_0x22c45d['model'],qs['fields'](_0x3be1cc[_0x7521('0x41')][_0x7521('0x46')]));_0x336afc[_0x7521('0x45')]=_0x336afc[_0x7521('0x45')]['length']?_0x336afc[_0x7521('0x45')]:_0x22c45d[_0x7521('0x40')];_0x336afc[_0x7521('0x48')]=qs['sort'](_0x3be1cc[_0x7521('0x41')][_0x7521('0x49')]);_0x336afc['where']=qs[_0x7521('0x43')](_['pick'](_0x3be1cc[_0x7521('0x41')],_0x22c45d[_0x7521('0x43')]));if(_0x3be1cc[_0x7521('0x41')][_0x7521('0x4d')]){_0x336afc[_0x7521('0x4a')]=_[_0x7521('0x56')](_0x336afc[_0x7521('0x4a')],{'$or':_[_0x7521('0x3d')](_0x336afc[_0x7521('0x45')],function(_0x5320da){var _0x181f49={};_0x181f49[_0x5320da]={'$like':'%'+_0x3be1cc[_0x7521('0x41')][_0x7521('0x4d')]+'%'};return _0x181f49;})});}_0x336afc=_['merge']({},_0x336afc,_0x3be1cc[_0x7521('0x4e')]);return _0x414332[_0x7521('0x6c')](_0x336afc);}})[_0x7521('0x1f')](function(_0x3b8887){if(_0x3b8887){_0x1f8d89=_0x3b8887[_0x7521('0x55')];if(!_0x3be1cc[_0x7521('0x41')]['hasOwnProperty']('nolimit')){_0x336afc['limit']=qs[_0x7521('0x2e')](_0x3be1cc[_0x7521('0x41')][_0x7521('0x2e')]);_0x336afc['offset']=qs[_0x7521('0x2c')](_0x3be1cc[_0x7521('0x41')][_0x7521('0x2c')]);}return _0x414332[_0x7521('0x6c')](_0x336afc);}})[_0x7521('0x1f')](function(_0x5e0c92){if(_0x5e0c92){return _0x5e0c92?{'count':_0x1f8d89,'rows':_0x5e0c92}:null;}})[_0x7521('0x1f')](respondWithResult(_0x373d12,null))[_0x7521('0x53')](handleError(_0x373d12,null));};exports[_0x7521('0x6f')]=function(_0x3f4b21,_0x1f2b6a,_0x4924bc){var _0xb7a4e2=_0x3f4b21[_0x7521('0x5e')][_0x7521('0x70')];return db['Team'][_0x7521('0x63')]({'where':{'id':_0xb7a4e2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7521('0x71'),'attributes':['id',_0x7521('0x3b'),_0x7521('0x72'),_0x7521('0x73'),'interface'],'raw':!![]}]})[_0x7521('0x1f')](function(_0x27a38f){if(_0x27a38f){var _0x3001ea=_[_0x7521('0x74')](_0x27a38f,function(_0x297e14){var _0xfb3ca=_0x297e14[_0x7521('0x37')]({'plain':!![]});return _0xfb3ca[_0x7521('0x71')];});return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x3f4b21[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](function(_0xe06ae8){return db['sequelize'][_0x7521('0x75')](function(_0x12a5e0){return _0xe06ae8[_0x7521('0x6f')](_0xb7a4e2,{'transaction':_0x12a5e0})[_0x7521('0x1f')](function(){return BPromise['each'](_0x3001ea,function(_0x2629db){return db[_0x7521('0x61')][_0x7521('0x76')]({'where':{'UserId':_0x2629db['id'],'ChatQueueId':_0x3f4b21[_0x7521('0x5f')]['id']},'transaction':_0x12a5e0});});})[_0x7521('0x1f')](function(){_0x3001ea[_0x7521('0x77')](function(_0x5a083a){socket[_0x7521('0x78')](_0x7521('0x79'),{'UserId':_0x5a083a['id'],'ChatQueueId':_0xe06ae8['id']});});});});});}})[_0x7521('0x1f')](respondWithStatusCode(_0x1f2b6a,null))[_0x7521('0x53')](handleError(_0x1f2b6a,null));};exports['removeTeams']=function(_0x4fedb9,_0x452589,_0x16470d){return db['Team'][_0x7521('0x63')]({'where':{'id':_0x4fedb9[_0x7521('0x41')][_0x7521('0x70')]},'attributes':['id'],'include':[{'model':db[_0x7521('0x7a')],'as':_0x7521('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x452589,null))[_0x7521('0x1f')](function(_0x18e475){var _0x5414db=_['map'](_0x18e475,'id');var _0x30624d=[];var _0x17f853=[];var _0x41f02e=squel['select']();_0x41f02e[_0x7521('0x7b')](_0x7521('0x7c'))['from'](_0x7521('0x7d'),'tq')[_0x7521('0x7e')](_0x7521('0x7f'),'ut',_0x7521('0x80'))[_0x7521('0x4a')](_0x7521('0x81'),_0x4fedb9[_0x7521('0x5f')]['id']);for(var _0x57b9d6=0x0;_0x57b9d6<_0x18e475[_0x7521('0x55')];_0x57b9d6+=0x1){let _0x4b978e=_0x18e475[_0x57b9d6];for(var _0x3840fc=0x0;_0x3840fc<_0x4b978e[_0x7521('0x71')][_0x7521('0x55')];_0x3840fc+=0x1){let _0x3d7a5f=_0x4b978e[_0x7521('0x71')][_0x3840fc];var _0x121e94=_0x41f02e[_0x7521('0x82')]();_0x121e94[_0x7521('0x4a')](_0x7521('0x83'),_0x3d7a5f['id']);_0x17f853[_0x7521('0x84')](db['sequelize'][_0x7521('0x41')](_0x121e94[_0x7521('0x85')](),{'type':db[_0x7521('0x86')][_0x7521('0x87')][_0x7521('0x88')]})['then'](function(_0x357ae9){if(_0x357ae9[_0x7521('0x55')]===0x1){return _0x3d7a5f['id'];}else{var _0x12d3b8=_[_0x7521('0x89')](_[_0x7521('0x3d')](_0x357ae9,_0x7521('0x8a')),function(_0x10d619){return _[_0x7521('0x8b')](_0x5414db,_0x10d619);});if(_0x12d3b8){return _0x3d7a5f['id'];}}}));}}return BPromise['all'](_0x17f853)[_0x7521('0x1f')](function(_0x24b701){_0x30624d=_(_0x30624d)['union'](_0x24b701)['compact']()[_0x7521('0x8c')]();return db['ChatQueue'][_0x7521('0x57')]({'where':{'id':_0x4fedb9[_0x7521('0x5f')]['id']}})['then'](function(_0x56f866){return db[_0x7521('0x86')][_0x7521('0x75')](function(_0x301038){return _0x56f866[_0x7521('0x8d')](_0x4fedb9[_0x7521('0x41')]['ids'],{'transaction':_0x301038})[_0x7521('0x1f')](function(){if(!_[_0x7521('0x8e')](_0x30624d)){return _0x56f866['removeAgents'](_0x30624d,{'transaction':_0x301038});}})[_0x7521('0x1f')](function(){_0x30624d[_0x7521('0x77')](function(_0x18cd1c){socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':_0x18cd1c,'ChatQueueId':_0x56f866['id']});});});});});});})[_0x7521('0x1f')](respondWithStatusCode(_0x452589,null))[_0x7521('0x53')](handleError(_0x452589,null));};exports[_0x7521('0x90')]=function(_0x4022ab,_0x3408e0,_0x296dff){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x4022ab['params']['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x3408e0,null))[_0x7521('0x1f')](function(_0x237472){if(_0x237472){return _0x237472[_0x7521('0x90')](_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')],_[_0x7521('0x91')](_0x4022ab[_0x7521('0x5e')],[_0x7521('0x70'),'id'])||{})['spread'](function(_0x250825){for(var _0x46aa59=0x0;_0x46aa59<_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')][_0x7521('0x55')];_0x46aa59+=0x1){socket['emit'](_0x7521('0x79'),{'UserId':Number(_0x4022ab[_0x7521('0x5e')][_0x7521('0x70')][_0x46aa59]),'ChatQueueId':Number(_0x4022ab[_0x7521('0x5f')]['id'])});}return _0x250825;});}})['then'](respondWithResult(_0x3408e0,null))[_0x7521('0x53')](handleError(_0x3408e0,null));};exports['removeAgents']=function(_0x394c12,_0x43329f,_0x21a4a1){return db[_0x7521('0x4f')][_0x7521('0x57')]({'where':{'id':_0x394c12[_0x7521('0x5f')]['id']}})[_0x7521('0x1f')](handleEntityNotFound(_0x43329f,null))['then'](function(_0x282a7a){if(_0x282a7a){return _0x282a7a[_0x7521('0x92')](_0x394c12[_0x7521('0x41')]['ids'])['then'](function(){if(_['isArray'](_0x394c12['query'][_0x7521('0x70')])){for(var _0x182cd4=0x0;_0x182cd4<_0x394c12[_0x7521('0x41')][_0x7521('0x70')][_0x7521('0x55')];_0x182cd4+=0x1){socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':Number(_0x394c12[_0x7521('0x41')][_0x7521('0x70')][_0x182cd4]),'ChatQueueId':Number(_0x394c12[_0x7521('0x5f')]['id'])});}}else{socket[_0x7521('0x78')](_0x7521('0x8f'),{'UserId':Number(_0x394c12['query'][_0x7521('0x70')]),'ChatQueueId':Number(_0x394c12[_0x7521('0x5f')]['id'])});}});}})[_0x7521('0x1f')](respondWithStatusCode(_0x43329f,null))[_0x7521('0x53')](handleError(_0x43329f,null));};exports[_0x7521('0x93')]=function(_0x193695,_0x2c0b6b,_0x371b01){var _0x2b7ef7={};var _0x36ab1d={};var _0x385999;var _0x6cbe40;return db[_0x7521('0x4f')][_0x7521('0x6d')]({'where':{'id':_0x193695['params']['id']}})['then'](handleEntityNotFound(_0x2c0b6b,null))[_0x7521('0x1f')](function(_0x3982c4){if(_0x3982c4){_0x385999=_0x3982c4;_0x36ab1d[_0x7521('0x40')]=_[_0x7521('0x42')](db[_0x7521('0x7a')][_0x7521('0x3e')]);_0x36ab1d[_0x7521('0x41')]=_[_0x7521('0x42')](_0x193695[_0x7521('0x41')]);_0x36ab1d[_0x7521('0x43')]=_[_0x7521('0x44')](_0x36ab1d[_0x7521('0x40')],_0x36ab1d['query']);_0x2b7ef7[_0x7521('0x45')]=_[_0x7521('0x44')](_0x36ab1d[_0x7521('0x40')],qs[_0x7521('0x46')](_0x193695[_0x7521('0x41')][_0x7521('0x46')]));_0x2b7ef7[_0x7521('0x45')]=_0x2b7ef7[_0x7521('0x45')][_0x7521('0x55')]?_0x2b7ef7[_0x7521('0x45')]:_0x36ab1d[_0x7521('0x40')];_0x2b7ef7[_0x7521('0x48')]=qs['sort'](_0x193695[_0x7521('0x41')][_0x7521('0x49')]);_0x2b7ef7[_0x7521('0x4a')]=qs[_0x7521('0x43')](_[_0x7521('0x4b')](_0x193695[_0x7521('0x41')],_0x36ab1d[_0x7521('0x43')]));if(_0x193695['query'][_0x7521('0x4d')]){_0x2b7ef7[_0x7521('0x4a')]=_[_0x7521('0x56')](_0x2b7ef7[_0x7521('0x4a')],{'$or':_[_0x7521('0x3d')](_0x2b7ef7[_0x7521('0x45')],function(_0x403e92){var _0x110777={};_0x110777[_0x403e92]={'$like':'%'+_0x193695['query'][_0x7521('0x4d')]+'%'};return _0x110777;})});}_0x2b7ef7=_[_0x7521('0x56')]({},_0x2b7ef7,_0x193695[_0x7521('0x4e')]);return _0x385999[_0x7521('0x93')](_0x2b7ef7);}})[_0x7521('0x1f')](function(_0x29ca0f){if(_0x29ca0f){_0x6cbe40=_0x29ca0f['length'];if(!_0x193695[_0x7521('0x41')]['hasOwnProperty'](_0x7521('0x94'))){_0x2b7ef7[_0x7521('0x2e')]=qs[_0x7521('0x2e')](_0x193695[_0x7521('0x41')][_0x7521('0x2e')]);_0x2b7ef7['offset']=qs[_0x7521('0x2c')](_0x193695[_0x7521('0x41')][_0x7521('0x2c')]);}return _0x385999[_0x7521('0x93')](_0x2b7ef7);}})[_0x7521('0x1f')](function(_0x2e8b40){if(_0x2e8b40){return _0x2e8b40?{'count':_0x6cbe40,'rows':_0x2e8b40}:null;}})[_0x7521('0x1f')](respondWithResult(_0x2c0b6b,null))[_0x7521('0x53')](handleError(_0x2c0b6b,null));}; \ No newline at end of file +var _0xa7b6=['online','interface','flatMap','sequelize','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userChatQueue:remove','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./chatQueue.socket','register','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','find','describe','ChatQueueId','findAll','User','UserId','agent','updatedAt','format','SIP','chatPause','createdAt','Team','getTeams','ids','Agents'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa7b6,0x1e2));var _0x6a7b=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0xa7b6[_0x46d87a];return _0x115296;};'use strict';var emlformat=require(_0x6a7b('0x0'));var rimraf=require(_0x6a7b('0x1'));var zipdir=require(_0x6a7b('0x2'));var jsonpatch=require(_0x6a7b('0x3'));var rp=require(_0x6a7b('0x4'));var moment=require('moment');var BPromise=require(_0x6a7b('0x5'));var Mustache=require(_0x6a7b('0x6'));var util=require(_0x6a7b('0x7'));var path=require(_0x6a7b('0x8'));var sox=require(_0x6a7b('0x9'));var csv=require(_0x6a7b('0xa'));var ejs=require(_0x6a7b('0xb'));var fs=require('fs');var fs_extra=require(_0x6a7b('0xc'));var _=require('lodash');var squel=require(_0x6a7b('0xd'));var crypto=require(_0x6a7b('0xe'));var jsforce=require(_0x6a7b('0xf'));var deskjs=require(_0x6a7b('0x10'));var toCsv=require(_0x6a7b('0xa'));var querystring=require(_0x6a7b('0x11'));var Papa=require(_0x6a7b('0x12'));var Redis=require('ioredis');var authService=require(_0x6a7b('0x13'));var qs=require(_0x6a7b('0x14'));var as=require(_0x6a7b('0x15'));var hardwareService=require(_0x6a7b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x6a7b('0x17'));var config=require(_0x6a7b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a7b('0x19'))['db'];config[_0x6a7b('0x1a')]=_[_0x6a7b('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a7b('0x1a')]));require(_0x6a7b('0x1c'))[_0x6a7b('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6a7b('0x1e')][_0x6a7b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x10fd3d,_0x364445,_0x81b666,_0x2f382c){return new BPromise(function(_0x1a0df4,_0x384ba5){var _0x2ca0f1=_0x2f382c||client;return _0x2ca0f1['request'](_0x10fd3d,_0x81b666)[_0x6a7b('0x20')](function(_0x2dc884){logger[_0x6a7b('0x21')](_0x6a7b('0x22'),_0x364445,_0x6a7b('0x23'));logger[_0x6a7b('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x364445,'request\x20sent',JSON['stringify'](_0x2dc884));if(_0x2dc884[_0x6a7b('0x25')]){if(_0x2dc884[_0x6a7b('0x25')][_0x6a7b('0x26')]===0x1f4){logger[_0x6a7b('0x25')](_0x6a7b('0x22'),_0x364445,_0x2dc884['error']['message']);return _0x384ba5(_0x2dc884[_0x6a7b('0x25')][_0x6a7b('0x27')]);}logger[_0x6a7b('0x25')](_0x6a7b('0x22'),_0x364445,_0x2dc884['error'][_0x6a7b('0x27')]);return _0x1a0df4(_0x2dc884[_0x6a7b('0x25')][_0x6a7b('0x27')]);}else{logger['info'](_0x6a7b('0x22'),_0x364445,_0x6a7b('0x23'));_0x1a0df4(_0x2dc884[_0x6a7b('0x28')][_0x6a7b('0x27')]);}})[_0x6a7b('0x29')](function(_0x5e4f96){logger[_0x6a7b('0x25')]('ChatQueue,\x20%s,\x20%s',_0x364445,_0x5e4f96);_0x384ba5(_0x5e4f96);});});}function respondWithStatusCode(_0x358ec7,_0x379b59){_0x379b59=_0x379b59||0xcc;return function(_0x3818a9){if(_0x3818a9){return _0x358ec7[_0x6a7b('0x2a')](_0x379b59);}return _0x358ec7[_0x6a7b('0x2b')](_0x379b59)['end']();};}function respondWithResult(_0x42198c,_0x5076ff){_0x5076ff=_0x5076ff||0xc8;return function(_0x363125){if(_0x363125){return _0x42198c[_0x6a7b('0x2b')](_0x5076ff)[_0x6a7b('0x2c')](_0x363125);}};}function respondWithFilteredResult(_0x2f006c,_0x54e3fa){return function(_0x15c09a){if(_0x15c09a){var _0x11141f=typeof _0x54e3fa[_0x6a7b('0x2d')]==='undefined'&&typeof _0x54e3fa[_0x6a7b('0x2e')]===_0x6a7b('0x2f');var _0x494cd8=_0x15c09a[_0x6a7b('0x30')];var _0x1c6d15=_0x11141f?0x0:_0x54e3fa[_0x6a7b('0x2d')];var _0x3cd9be=_0x11141f?_0x15c09a[_0x6a7b('0x30')]:_0x54e3fa[_0x6a7b('0x2d')]+_0x54e3fa[_0x6a7b('0x2e')];var _0x499b8d;if(_0x3cd9be>=_0x494cd8){_0x3cd9be=_0x494cd8;_0x499b8d=0xc8;}else{_0x499b8d=0xce;}_0x2f006c[_0x6a7b('0x2b')](_0x499b8d);return _0x2f006c[_0x6a7b('0x31')](_0x6a7b('0x32'),_0x1c6d15+'-'+_0x3cd9be+'/'+_0x494cd8)[_0x6a7b('0x2c')](_0x15c09a);}return null;};}function patchUpdates(_0x1624d7){return function(_0x5544d1){try{jsonpatch[_0x6a7b('0x33')](_0x5544d1,_0x1624d7,!![]);}catch(_0x453171){return BPromise[_0x6a7b('0x34')](_0x453171);}return _0x5544d1[_0x6a7b('0x35')]();};}function saveUpdates(_0x4a7cfa,_0x2e9bfd){return function(_0x122a8b){if(_0x122a8b){return _0x122a8b[_0x6a7b('0x36')](_0x4a7cfa)[_0x6a7b('0x20')](function(_0x2513fd){return _0x2513fd;});}return null;};}function removeEntity(_0x2da23c,_0x1ffb70){return function(_0x9c9233){if(_0x9c9233){return _0x9c9233[_0x6a7b('0x37')]()[_0x6a7b('0x20')](function(){var _0x117e8c=_0x9c9233[_0x6a7b('0x38')]({'plain':!![]});var _0x545a22=_0x6a7b('0x39');return db[_0x6a7b('0x3a')][_0x6a7b('0x37')]({'where':{'type':_0x545a22,'resourceId':_0x117e8c['id']}})['then'](function(){return _0x9c9233;});})[_0x6a7b('0x20')](function(){_0x2da23c['status'](0xcc)[_0x6a7b('0x3b')]();});}};}function handleEntityNotFound(_0x4eb242,_0x3eeeea){return function(_0x5366e5){if(!_0x5366e5){_0x4eb242['sendStatus'](0x194);}return _0x5366e5;};}function handleError(_0x36ca41,_0x56610f){_0x56610f=_0x56610f||0x1f4;return function(_0x59c3ca){logger[_0x6a7b('0x25')](_0x59c3ca[_0x6a7b('0x3c')]);if(_0x59c3ca[_0x6a7b('0x3d')]){delete _0x59c3ca[_0x6a7b('0x3d')];}_0x36ca41[_0x6a7b('0x2b')](_0x56610f)[_0x6a7b('0x3e')](_0x59c3ca);};}exports['index']=function(_0x56c3d0,_0x686c40){var _0x480af9={},_0x46edd6={},_0x353dbf={'count':0x0,'rows':[]};var _0x548d97=_['map'](db[_0x6a7b('0x3f')][_0x6a7b('0x40')],function(_0x1b05fc){return{'name':_0x1b05fc[_0x6a7b('0x41')],'type':_0x1b05fc[_0x6a7b('0x42')][_0x6a7b('0x43')]};});_0x46edd6[_0x6a7b('0x44')]=_[_0x6a7b('0x45')](_0x548d97,_0x6a7b('0x3d'));_0x46edd6[_0x6a7b('0x46')]=_[_0x6a7b('0x47')](_0x56c3d0[_0x6a7b('0x46')]);_0x46edd6['filters']=_[_0x6a7b('0x48')](_0x46edd6[_0x6a7b('0x44')],_0x46edd6['query']);_0x480af9[_0x6a7b('0x49')]=_['intersection'](_0x46edd6[_0x6a7b('0x44')],qs[_0x6a7b('0x4a')](_0x56c3d0[_0x6a7b('0x46')][_0x6a7b('0x4a')]));_0x480af9[_0x6a7b('0x49')]=_0x480af9[_0x6a7b('0x49')]['length']?_0x480af9['attributes']:_0x46edd6[_0x6a7b('0x44')];if(!_0x56c3d0[_0x6a7b('0x46')][_0x6a7b('0x4b')](_0x6a7b('0x4c'))){_0x480af9[_0x6a7b('0x2e')]=qs[_0x6a7b('0x2e')](_0x56c3d0[_0x6a7b('0x46')][_0x6a7b('0x2e')]);_0x480af9['offset']=qs[_0x6a7b('0x2d')](_0x56c3d0[_0x6a7b('0x46')][_0x6a7b('0x2d')]);}_0x480af9[_0x6a7b('0x4d')]=qs[_0x6a7b('0x4e')](_0x56c3d0['query'][_0x6a7b('0x4e')]);_0x480af9[_0x6a7b('0x4f')]=qs[_0x6a7b('0x50')](_[_0x6a7b('0x51')](_0x56c3d0[_0x6a7b('0x46')],_0x46edd6[_0x6a7b('0x50')]),_0x548d97);if(_0x56c3d0['query'][_0x6a7b('0x52')]){_0x480af9[_0x6a7b('0x4f')]=_[_0x6a7b('0x53')](_0x480af9[_0x6a7b('0x4f')],{'$or':_[_0x6a7b('0x45')](_0x548d97,function(_0x4af59a){if(_0x4af59a[_0x6a7b('0x42')]!=='VIRTUAL'){var _0x10db57={};_0x10db57[_0x4af59a[_0x6a7b('0x3d')]]={'$like':'%'+_0x56c3d0[_0x6a7b('0x46')][_0x6a7b('0x52')]+'%'};return _0x10db57;}})});}_0x480af9=_[_0x6a7b('0x53')]({},_0x480af9,_0x56c3d0[_0x6a7b('0x54')]);var _0x424b8a={'where':_0x480af9['where']};return db['ChatQueue'][_0x6a7b('0x30')](_0x424b8a)[_0x6a7b('0x20')](function(_0x378d6d){_0x353dbf['count']=_0x378d6d;if(_0x56c3d0['query'][_0x6a7b('0x55')]){_0x480af9[_0x6a7b('0x56')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x480af9);})[_0x6a7b('0x20')](function(_0x559a7a){_0x353dbf[_0x6a7b('0x57')]=_0x559a7a;return _0x353dbf;})['then'](respondWithFilteredResult(_0x686c40,_0x480af9))['catch'](handleError(_0x686c40,null));};exports[_0x6a7b('0x58')]=function(_0x1f57e3,_0x15431d){var _0x43cf79={'raw':!![],'where':{'id':_0x1f57e3[_0x6a7b('0x59')]['id']}},_0xd5e09={};_0xd5e09[_0x6a7b('0x44')]=_['keys'](db[_0x6a7b('0x3f')][_0x6a7b('0x40')]);_0xd5e09[_0x6a7b('0x46')]=_['keys'](_0x1f57e3[_0x6a7b('0x46')]);_0xd5e09[_0x6a7b('0x50')]=_[_0x6a7b('0x48')](_0xd5e09[_0x6a7b('0x44')],_0xd5e09[_0x6a7b('0x46')]);_0x43cf79[_0x6a7b('0x49')]=_[_0x6a7b('0x48')](_0xd5e09[_0x6a7b('0x44')],qs[_0x6a7b('0x4a')](_0x1f57e3[_0x6a7b('0x46')][_0x6a7b('0x4a')]));_0x43cf79[_0x6a7b('0x49')]=_0x43cf79[_0x6a7b('0x49')][_0x6a7b('0x5a')]?_0x43cf79[_0x6a7b('0x49')]:_0xd5e09[_0x6a7b('0x44')];if(_0x1f57e3['query'][_0x6a7b('0x55')]){_0x43cf79[_0x6a7b('0x56')]=[{'all':!![]}];}_0x43cf79=_[_0x6a7b('0x53')]({},_0x43cf79,_0x1f57e3[_0x6a7b('0x54')]);return db[_0x6a7b('0x3f')]['find'](_0x43cf79)[_0x6a7b('0x20')](handleEntityNotFound(_0x15431d,null))['then'](respondWithResult(_0x15431d,null))[_0x6a7b('0x29')](handleError(_0x15431d,null));};exports[_0x6a7b('0x5b')]=function(_0x140f11,_0x3fbbeb){return db[_0x6a7b('0x3f')][_0x6a7b('0x5b')](_0x140f11[_0x6a7b('0x5c')],{})[_0x6a7b('0x20')](function(_0x11ace1){var _0x3a3135=_0x140f11[_0x6a7b('0x5d')]['get']({'plain':!![]});if(!_0x3a3135)throw new Error(_0x6a7b('0x5e'));if(_0x3a3135['role']===_0x6a7b('0x5d')){var _0x59f2f7=_0x11ace1[_0x6a7b('0x38')]({'plain':!![]});var _0x4715ab=_0x6a7b('0x39');return db[_0x6a7b('0x5f')]['find']({'where':{'name':_0x4715ab,'userProfileId':_0x3a3135[_0x6a7b('0x60')]},'raw':!![]})['then'](function(_0x4d8319){if(_0x4d8319&&_0x4d8319[_0x6a7b('0x61')]===0x0){return db[_0x6a7b('0x3a')]['create']({'name':_0x59f2f7[_0x6a7b('0x3d')],'resourceId':_0x59f2f7['id'],'type':_0x4d8319['name'],'sectionId':_0x4d8319['id']},{})[_0x6a7b('0x20')](function(){return _0x11ace1;});}else{return _0x11ace1;}})[_0x6a7b('0x29')](function(_0x4ba35c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ba35c);throw _0x4ba35c;});}return _0x11ace1;})[_0x6a7b('0x20')](respondWithResult(_0x3fbbeb,0xc9))['catch'](handleError(_0x3fbbeb,null));};exports[_0x6a7b('0x36')]=function(_0x19549e,_0x429c84){if(_0x19549e['body']['id']){delete _0x19549e[_0x6a7b('0x5c')]['id'];}return db['ChatQueue'][_0x6a7b('0x62')]({'where':{'id':_0x19549e['params']['id']}})['then'](handleEntityNotFound(_0x429c84,null))[_0x6a7b('0x20')](saveUpdates(_0x19549e[_0x6a7b('0x5c')],null))[_0x6a7b('0x20')](respondWithResult(_0x429c84,null))['catch'](handleError(_0x429c84,null));};exports[_0x6a7b('0x37')]=function(_0x1ba501,_0x4f6287){return db[_0x6a7b('0x3f')][_0x6a7b('0x62')]({'where':{'id':_0x1ba501[_0x6a7b('0x59')]['id']}})[_0x6a7b('0x20')](handleEntityNotFound(_0x4f6287,null))[_0x6a7b('0x20')](removeEntity(_0x4f6287,null))['catch'](handleError(_0x4f6287,null));};exports[_0x6a7b('0x63')]=function(_0x549757,_0x11967b){return db[_0x6a7b('0x3f')]['describe']()['then'](respondWithResult(_0x11967b,null))[_0x6a7b('0x29')](handleError(_0x11967b,null));};exports['getMembers']=function(_0x512e1a,_0x4ed941,_0x184479){var _0x124f50={'raw':!![],'where':{}},_0x3a7e11={},_0x46925e;return db[_0x6a7b('0x3f')]['findOne']({'where':{'id':_0x512e1a[_0x6a7b('0x59')]['id']}})[_0x6a7b('0x20')](handleEntityNotFound(_0x4ed941,null))[_0x6a7b('0x20')](function(_0x4b804f){if(_0x4b804f){_0x46925e=_0x4b804f[_0x6a7b('0x38')]({'plain':!![]});_0x3a7e11[_0x6a7b('0x44')]=_[_0x6a7b('0x47')](db['UserChatQueue']['rawAttributes']);_0x3a7e11[_0x6a7b('0x46')]=_[_0x6a7b('0x47')](_0x512e1a[_0x6a7b('0x46')]);_0x3a7e11[_0x6a7b('0x50')]=_['intersection'](_0x3a7e11[_0x6a7b('0x44')],_0x3a7e11['query']);_0x124f50[_0x6a7b('0x49')]=_[_0x6a7b('0x48')](_0x3a7e11[_0x6a7b('0x44')],qs['fields'](_0x512e1a[_0x6a7b('0x46')][_0x6a7b('0x4a')]));_0x124f50['attributes']=_0x124f50[_0x6a7b('0x49')][_0x6a7b('0x5a')]?_0x124f50[_0x6a7b('0x49')]:_0x3a7e11[_0x6a7b('0x44')];if(!_0x512e1a['query'][_0x6a7b('0x4b')](_0x6a7b('0x4c'))){_0x124f50['limit']=qs[_0x6a7b('0x2e')](_0x512e1a[_0x6a7b('0x46')]['limit']);_0x124f50['offset']=qs[_0x6a7b('0x2d')](_0x512e1a[_0x6a7b('0x46')][_0x6a7b('0x2d')]);}_0x124f50[_0x6a7b('0x4d')]=qs['sort'](_0x512e1a[_0x6a7b('0x46')][_0x6a7b('0x4e')]);_0x124f50[_0x6a7b('0x4f')]=qs[_0x6a7b('0x50')](_[_0x6a7b('0x51')](_0x512e1a[_0x6a7b('0x46')],_0x3a7e11[_0x6a7b('0x50')]));_0x124f50[_0x6a7b('0x4f')][_0x6a7b('0x64')]=_0x4b804f['id'];if(_0x512e1a[_0x6a7b('0x46')][_0x6a7b('0x52')]){_0x124f50[_0x6a7b('0x4f')]=_[_0x6a7b('0x53')](_0x124f50[_0x6a7b('0x4f')],{'$or':_[_0x6a7b('0x45')](_0x124f50[_0x6a7b('0x49')],function(_0x18499f){var _0x4e518a={};_0x4e518a[_0x18499f]={'$like':'%'+_0x512e1a[_0x6a7b('0x46')]['filter']+'%'};return _0x4e518a;})});}_0x124f50=_[_0x6a7b('0x53')]({},_0x124f50,_0x512e1a[_0x6a7b('0x54')]);return db['UserChatQueue'][_0x6a7b('0x65')](_0x124f50);}})[_0x6a7b('0x20')](function(_0x26514c){if(_0x26514c){return db[_0x6a7b('0x66')]['findAndCountAll']({'where':{'id':_[_0x6a7b('0x45')](_0x26514c,_0x6a7b('0x67')),'role':_0x6a7b('0x68')},'attributes':['id',_0x6a7b('0x3d'),'chatPause',_0x6a7b('0x69'),'createdAt']});}})[_0x6a7b('0x20')](function(_0x49e0cb){if(_0x49e0cb){return{'count':_0x49e0cb[_0x6a7b('0x30')],'rows':_[_0x6a7b('0x45')](_0x49e0cb['rows'],function(_0x46bddf){return{'membername':_0x46bddf[_0x6a7b('0x3d')],'UserId':_0x46bddf['id'],'queue_name':_0x46925e[_0x6a7b('0x3d')],'ChatQueueId':_0x46925e['id'],'interface':util[_0x6a7b('0x6a')]('%s/%s',_0x6a7b('0x6b'),_0x46bddf[_0x6a7b('0x3d')]),'penalty':0x0,'paused':_0x46bddf[_0x6a7b('0x6c')],'createdAt':_0x46bddf[_0x6a7b('0x6d')],'updatedAt':_0x46bddf[_0x6a7b('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6a7b('0x20')](respondWithFilteredResult(_0x4ed941,_0x124f50))[_0x6a7b('0x29')](handleError(_0x4ed941,null));};exports['getTeams']=function(_0x3e628f,_0x2ac6c6,_0x3e3552){var _0x3166ed={};var _0x5147c6={};var _0x189395;var _0x53fd07;return db[_0x6a7b('0x3f')]['findOne']({'where':{'id':_0x3e628f[_0x6a7b('0x59')]['id']}})[_0x6a7b('0x20')](handleEntityNotFound(_0x2ac6c6,null))[_0x6a7b('0x20')](function(_0x188916){if(_0x188916){_0x189395=_0x188916;_0x5147c6[_0x6a7b('0x44')]=_['keys'](db[_0x6a7b('0x6e')][_0x6a7b('0x40')]);_0x5147c6[_0x6a7b('0x46')]=_['keys'](_0x3e628f[_0x6a7b('0x46')]);_0x5147c6[_0x6a7b('0x50')]=_['intersection'](_0x5147c6[_0x6a7b('0x44')],_0x5147c6[_0x6a7b('0x46')]);_0x3166ed['attributes']=_[_0x6a7b('0x48')](_0x5147c6['model'],qs[_0x6a7b('0x4a')](_0x3e628f[_0x6a7b('0x46')][_0x6a7b('0x4a')]));_0x3166ed[_0x6a7b('0x49')]=_0x3166ed['attributes'][_0x6a7b('0x5a')]?_0x3166ed[_0x6a7b('0x49')]:_0x5147c6[_0x6a7b('0x44')];_0x3166ed[_0x6a7b('0x4d')]=qs[_0x6a7b('0x4e')](_0x3e628f['query']['sort']);_0x3166ed[_0x6a7b('0x4f')]=qs[_0x6a7b('0x50')](_[_0x6a7b('0x51')](_0x3e628f[_0x6a7b('0x46')],_0x5147c6['filters']));if(_0x3e628f['query']['filter']){_0x3166ed[_0x6a7b('0x4f')]=_[_0x6a7b('0x53')](_0x3166ed['where'],{'$or':_['map'](_0x3166ed['attributes'],function(_0x14f942){var _0x29055f={};_0x29055f[_0x14f942]={'$like':'%'+_0x3e628f['query'][_0x6a7b('0x52')]+'%'};return _0x29055f;})});}_0x3166ed=_[_0x6a7b('0x53')]({},_0x3166ed,_0x3e628f[_0x6a7b('0x54')]);return _0x189395[_0x6a7b('0x6f')](_0x3166ed);}})[_0x6a7b('0x20')](function(_0x426179){if(_0x426179){_0x53fd07=_0x426179[_0x6a7b('0x5a')];if(!_0x3e628f[_0x6a7b('0x46')]['hasOwnProperty'](_0x6a7b('0x4c'))){_0x3166ed[_0x6a7b('0x2e')]=qs['limit'](_0x3e628f[_0x6a7b('0x46')]['limit']);_0x3166ed[_0x6a7b('0x2d')]=qs[_0x6a7b('0x2d')](_0x3e628f[_0x6a7b('0x46')][_0x6a7b('0x2d')]);}return _0x189395[_0x6a7b('0x6f')](_0x3166ed);}})[_0x6a7b('0x20')](function(_0x4a5712){if(_0x4a5712){return _0x4a5712?{'count':_0x53fd07,'rows':_0x4a5712}:null;}})['then'](respondWithResult(_0x2ac6c6,null))[_0x6a7b('0x29')](handleError(_0x2ac6c6,null));};exports['addTeams']=function(_0x326e4b,_0x1708b6,_0x552dea){var _0x157931=_0x326e4b[_0x6a7b('0x5c')][_0x6a7b('0x70')];return db[_0x6a7b('0x6e')][_0x6a7b('0x65')]({'where':{'id':_0x157931},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6a7b('0x71'),'attributes':['id',_0x6a7b('0x3d'),_0x6a7b('0x72'),'voicePause',_0x6a7b('0x73')],'raw':!![]}]})[_0x6a7b('0x20')](function(_0x23149d){if(_0x23149d){var _0x137031=_[_0x6a7b('0x74')](_0x23149d,function(_0x2def2d){var _0x176f77=_0x2def2d[_0x6a7b('0x38')]({'plain':!![]});return _0x176f77[_0x6a7b('0x71')];});return db['ChatQueue'][_0x6a7b('0x62')]({'where':{'id':_0x326e4b[_0x6a7b('0x59')]['id']}})[_0x6a7b('0x20')](function(_0x266d60){return db[_0x6a7b('0x75')]['transaction'](function(_0x104288){return _0x266d60['addTeams'](_0x157931,{'transaction':_0x104288})[_0x6a7b('0x20')](function(){return BPromise['each'](_0x137031,function(_0x4b69a8){return db['UserChatQueue'][_0x6a7b('0x76')]({'where':{'UserId':_0x4b69a8['id'],'ChatQueueId':_0x326e4b[_0x6a7b('0x59')]['id']},'transaction':_0x104288});});})[_0x6a7b('0x20')](function(){_0x137031[_0x6a7b('0x77')](function(_0x1f661b){socket[_0x6a7b('0x78')](_0x6a7b('0x79'),{'UserId':_0x1f661b['id'],'ChatQueueId':_0x266d60['id']});});});});});}})[_0x6a7b('0x20')](respondWithStatusCode(_0x1708b6,null))[_0x6a7b('0x29')](handleError(_0x1708b6,null));};exports[_0x6a7b('0x7a')]=function(_0xd4a74b,_0x3fd10e,_0x2196da){return db[_0x6a7b('0x6e')]['findAll']({'where':{'id':_0xd4a74b[_0x6a7b('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0x6a7b('0x66')],'as':_0x6a7b('0x71'),'attributes':['id'],'raw':!![]}]})[_0x6a7b('0x20')](handleEntityNotFound(_0x3fd10e,null))[_0x6a7b('0x20')](function(_0x17579c){var _0x3cb02d=_[_0x6a7b('0x45')](_0x17579c,'id');var _0x3af817=[];var _0xb64bc5=[];var _0x5e5113=squel[_0x6a7b('0x7b')]();_0x5e5113[_0x6a7b('0x7c')](_0x6a7b('0x7d'))['from'](_0x6a7b('0x7e'),'tq')[_0x6a7b('0x7f')](_0x6a7b('0x80'),'ut',_0x6a7b('0x81'))['where']('ChatQueueId\x20=\x20?',_0xd4a74b['params']['id']);for(var _0x3f22a5=0x0;_0x3f22a5<_0x17579c[_0x6a7b('0x5a')];_0x3f22a5+=0x1){let _0x80b7be=_0x17579c[_0x3f22a5];for(var _0x46f90f=0x0;_0x46f90f<_0x80b7be['Agents'][_0x6a7b('0x5a')];_0x46f90f+=0x1){let _0xd74527=_0x80b7be[_0x6a7b('0x71')][_0x46f90f];var _0xe949cd=_0x5e5113[_0x6a7b('0x82')]();_0xe949cd[_0x6a7b('0x4f')](_0x6a7b('0x83'),_0xd74527['id']);_0xb64bc5[_0x6a7b('0x84')](db[_0x6a7b('0x75')][_0x6a7b('0x46')](_0xe949cd[_0x6a7b('0x85')](),{'type':db[_0x6a7b('0x75')][_0x6a7b('0x86')][_0x6a7b('0x87')]})[_0x6a7b('0x20')](function(_0x5c57ce){if(_0x5c57ce[_0x6a7b('0x5a')]===0x1){return _0xd74527['id'];}else{var _0x1878f9=_[_0x6a7b('0x88')](_[_0x6a7b('0x45')](_0x5c57ce,_0x6a7b('0x89')),function(_0x3964d7){return _[_0x6a7b('0x8a')](_0x3cb02d,_0x3964d7);});if(_0x1878f9){return _0xd74527['id'];}}}));}}return BPromise['all'](_0xb64bc5)['then'](function(_0x1c4927){_0x3af817=_(_0x3af817)['union'](_0x1c4927)['compact']()[_0x6a7b('0x8b')]();return db['ChatQueue'][_0x6a7b('0x62')]({'where':{'id':_0xd4a74b[_0x6a7b('0x59')]['id']}})['then'](function(_0x44656c){return db[_0x6a7b('0x75')][_0x6a7b('0x8c')](function(_0x4e0297){return _0x44656c[_0x6a7b('0x7a')](_0xd4a74b[_0x6a7b('0x46')][_0x6a7b('0x70')],{'transaction':_0x4e0297})[_0x6a7b('0x20')](function(){if(!_[_0x6a7b('0x8d')](_0x3af817)){return _0x44656c[_0x6a7b('0x8e')](_0x3af817,{'transaction':_0x4e0297});}})[_0x6a7b('0x20')](function(){_0x3af817[_0x6a7b('0x77')](function(_0x5cbe0d){socket[_0x6a7b('0x78')]('userChatQueue:remove',{'UserId':_0x5cbe0d,'ChatQueueId':_0x44656c['id']});});});});});});})['then'](respondWithStatusCode(_0x3fd10e,null))[_0x6a7b('0x29')](handleError(_0x3fd10e,null));};exports[_0x6a7b('0x8f')]=function(_0x5cf49d,_0x855f2a,_0x71d4ec){return db[_0x6a7b('0x3f')]['find']({'where':{'id':_0x5cf49d[_0x6a7b('0x59')]['id']}})[_0x6a7b('0x20')](handleEntityNotFound(_0x855f2a,null))[_0x6a7b('0x20')](function(_0x4a202b){if(_0x4a202b){return _0x4a202b[_0x6a7b('0x8f')](_0x5cf49d[_0x6a7b('0x5c')][_0x6a7b('0x70')],_[_0x6a7b('0x90')](_0x5cf49d[_0x6a7b('0x5c')],[_0x6a7b('0x70'),'id'])||{})[_0x6a7b('0x91')](function(_0x5c854f){for(var _0x28737c=0x0;_0x28737c<_0x5cf49d[_0x6a7b('0x5c')][_0x6a7b('0x70')][_0x6a7b('0x5a')];_0x28737c+=0x1){socket[_0x6a7b('0x78')](_0x6a7b('0x79'),{'UserId':Number(_0x5cf49d['body'][_0x6a7b('0x70')][_0x28737c]),'ChatQueueId':Number(_0x5cf49d[_0x6a7b('0x59')]['id'])});}return _0x5c854f;});}})[_0x6a7b('0x20')](respondWithResult(_0x855f2a,null))[_0x6a7b('0x29')](handleError(_0x855f2a,null));};exports[_0x6a7b('0x8e')]=function(_0xfd7fbd,_0x19d2e0,_0x17d78c){return db[_0x6a7b('0x3f')]['find']({'where':{'id':_0xfd7fbd[_0x6a7b('0x59')]['id']}})['then'](handleEntityNotFound(_0x19d2e0,null))[_0x6a7b('0x20')](function(_0x11d215){if(_0x11d215){return _0x11d215[_0x6a7b('0x8e')](_0xfd7fbd[_0x6a7b('0x46')]['ids'])[_0x6a7b('0x20')](function(){if(_['isArray'](_0xfd7fbd[_0x6a7b('0x46')]['ids'])){for(var _0x3ea18f=0x0;_0x3ea18f<_0xfd7fbd[_0x6a7b('0x46')]['ids'][_0x6a7b('0x5a')];_0x3ea18f+=0x1){socket[_0x6a7b('0x78')](_0x6a7b('0x92'),{'UserId':Number(_0xfd7fbd[_0x6a7b('0x46')][_0x6a7b('0x70')][_0x3ea18f]),'ChatQueueId':Number(_0xfd7fbd[_0x6a7b('0x59')]['id'])});}}else{socket[_0x6a7b('0x78')]('userChatQueue:remove',{'UserId':Number(_0xfd7fbd[_0x6a7b('0x46')][_0x6a7b('0x70')]),'ChatQueueId':Number(_0xfd7fbd[_0x6a7b('0x59')]['id'])});}});}})[_0x6a7b('0x20')](respondWithStatusCode(_0x19d2e0,null))[_0x6a7b('0x29')](handleError(_0x19d2e0,null));};exports['getAgents']=function(_0x4ec632,_0x433430,_0x47a119){var _0x2ff3d0={};var _0x2416f7={};var _0x316dd2;var _0x2bd7d9;return db[_0x6a7b('0x3f')][_0x6a7b('0x93')]({'where':{'id':_0x4ec632[_0x6a7b('0x59')]['id']}})['then'](handleEntityNotFound(_0x433430,null))[_0x6a7b('0x20')](function(_0x1d84ec){if(_0x1d84ec){_0x316dd2=_0x1d84ec;_0x2416f7[_0x6a7b('0x44')]=_['keys'](db[_0x6a7b('0x66')][_0x6a7b('0x40')]);_0x2416f7['query']=_[_0x6a7b('0x47')](_0x4ec632[_0x6a7b('0x46')]);_0x2416f7[_0x6a7b('0x50')]=_['intersection'](_0x2416f7[_0x6a7b('0x44')],_0x2416f7[_0x6a7b('0x46')]);_0x2ff3d0[_0x6a7b('0x49')]=_['intersection'](_0x2416f7[_0x6a7b('0x44')],qs[_0x6a7b('0x4a')](_0x4ec632[_0x6a7b('0x46')]['fields']));_0x2ff3d0[_0x6a7b('0x49')]=_0x2ff3d0[_0x6a7b('0x49')][_0x6a7b('0x5a')]?_0x2ff3d0[_0x6a7b('0x49')]:_0x2416f7[_0x6a7b('0x44')];_0x2ff3d0[_0x6a7b('0x4d')]=qs['sort'](_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x4e')]);_0x2ff3d0[_0x6a7b('0x4f')]=qs[_0x6a7b('0x50')](_[_0x6a7b('0x51')](_0x4ec632['query'],_0x2416f7[_0x6a7b('0x50')]));if(_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x52')]){_0x2ff3d0[_0x6a7b('0x4f')]=_['merge'](_0x2ff3d0[_0x6a7b('0x4f')],{'$or':_[_0x6a7b('0x45')](_0x2ff3d0[_0x6a7b('0x49')],function(_0x4a92fd){var _0x22b918={};_0x22b918[_0x4a92fd]={'$like':'%'+_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x52')]+'%'};return _0x22b918;})});}_0x2ff3d0=_['merge']({},_0x2ff3d0,_0x4ec632[_0x6a7b('0x54')]);return _0x316dd2[_0x6a7b('0x94')](_0x2ff3d0);}})[_0x6a7b('0x20')](function(_0x478b60){if(_0x478b60){_0x2bd7d9=_0x478b60[_0x6a7b('0x5a')];if(!_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x4b')](_0x6a7b('0x4c'))){_0x2ff3d0[_0x6a7b('0x2e')]=qs['limit'](_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x2e')]);_0x2ff3d0['offset']=qs['offset'](_0x4ec632[_0x6a7b('0x46')][_0x6a7b('0x2d')]);}return _0x316dd2['getAgents'](_0x2ff3d0);}})[_0x6a7b('0x20')](function(_0x1b191c){if(_0x1b191c){return _0x1b191c?{'count':_0x2bd7d9,'rows':_0x1b191c}:null;}})[_0x6a7b('0x20')](respondWithResult(_0x433430,null))[_0x6a7b('0x29')](handleError(_0x433430,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index bddfb21..c7401b6 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 _0x7e68=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xf1e6e1,_0x58d076){var _0x43102f=function(_0x5c6ce8){while(--_0x5c6ce8){_0xf1e6e1['push'](_0xf1e6e1['shift']());}};_0x43102f(++_0x58d076);}(_0x7e68,0xd8));var _0x87e6=function(_0xbeb80a,_0x5791e2){_0xbeb80a=_0xbeb80a-0x0;var _0x522a3d=_0x7e68[_0xbeb80a];return _0x522a3d;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x87e6('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x87e6('0x1')](0x0);var events={'afterCreate':_0x87e6('0x2'),'afterUpdate':_0x87e6('0x3'),'afterDestroy':_0x87e6('0x4')};function emitEvent(_0x3691bf){return function(_0x31d611,_0xd7ecde,_0x3638e3){ChatQueueEvents[_0x87e6('0x5')](_0x3691bf+':'+_0x31d611['id'],_0x31d611);ChatQueueEvents['emit'](_0x3691bf,_0x31d611);_0x3638e3(null);};}for(var e in events){if(events[_0x87e6('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x87e6('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xd846=['../../mysqldb','ChatQueue','update','emit','hook','exports','events'];(function(_0x2d1a6d,_0xedb0){var _0x5bd1fc=function(_0x2cf26f){while(--_0x2cf26f){_0x2d1a6d['push'](_0x2d1a6d['shift']());}};_0x5bd1fc(++_0xedb0);}(_0xd846,0x195));var _0x6d84=function(_0x2e85ac,_0x1bf732){_0x2e85ac=_0x2e85ac-0x0;var _0x31e4ad=_0xd846[_0x2e85ac];return _0x31e4ad;};'use strict';var EventEmitter=require(_0x6d84('0x0'));var ChatQueue=require(_0x6d84('0x1'))['db'][_0x6d84('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d84('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47e90f){return function(_0x15fb0c,_0xa19796,_0x5c2176){ChatQueueEvents[_0x6d84('0x4')](_0x47e90f+':'+_0x15fb0c['id'],_0x15fb0c);ChatQueueEvents['emit'](_0x47e90f,_0x15fb0c);_0x5c2176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x6d84('0x5')](e,emitEvent(event));}}module[_0x6d84('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 402d4e5..1fbcfc2 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 _0xedbb=['api','moment','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','../../config/logger'];(function(_0x3d4a88,_0x62234f){var _0x24bfc1=function(_0x4a2ae8){while(--_0x4a2ae8){_0x3d4a88['push'](_0x3d4a88['shift']());}};_0x24bfc1(++_0x62234f);}(_0xedbb,0x149));var _0xbedb=function(_0x12896d,_0x4e2b28){_0x12896d=_0x12896d-0x0;var _0x58b846=_0xedbb[_0x12896d];return _0x58b846;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbedb('0x0'))(_0xbedb('0x1'));var moment=require(_0xbedb('0x2'));var BPromise=require('bluebird');var rp=require(_0xbedb('0x3'));var fs=require('fs');var path=require(_0xbedb('0x4'));var rimraf=require('rimraf');var config=require(_0xbedb('0x5'));var attributes=require(_0xbedb('0x6'));module[_0xbedb('0x7')]=function(_0x14b391,_0x40926e){return _0x14b391[_0xbedb('0x8')](_0xbedb('0x9'),attributes,{'tableName':_0xbedb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc711=['request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','util','../../config/logger','api','moment','bluebird'];(function(_0x5093a4,_0x2818d3){var _0x11a221=function(_0x2ef5a0){while(--_0x2ef5a0){_0x5093a4['push'](_0x5093a4['shift']());}};_0x11a221(++_0x2818d3);}(_0xc711,0x19f));var _0x1c71=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xc711[_0x211fef];return _0x5447bf;};'use strict';var _=require('lodash');var util=require(_0x1c71('0x0'));var logger=require(_0x1c71('0x1'))(_0x1c71('0x2'));var moment=require(_0x1c71('0x3'));var BPromise=require(_0x1c71('0x4'));var rp=require(_0x1c71('0x5'));var fs=require('fs');var path=require(_0x1c71('0x6'));var rimraf=require(_0x1c71('0x7'));var config=require(_0x1c71('0x8'));var attributes=require(_0x1c71('0x9'));module[_0x1c71('0xa')]=function(_0x459d69,_0x714ca0){return _0x459d69['define'](_0x1c71('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index aebb0f2..2b3d19d 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 _0x14c7=['attributes','GetChatQueue','find','raw','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ChatQueue','findAll','options','where','limit','map','include','model'];(function(_0x33e0db,_0x2b8d53){var _0x3f7a38=function(_0x23f437){while(--_0x23f437){_0x33e0db['push'](_0x33e0db['shift']());}};_0x3f7a38(++_0x2b8d53);}(_0x14c7,0x1d9));var _0x714c=function(_0x2d9893,_0xe29c7d){_0x2d9893=_0x2d9893-0x0;var _0x2bcfaa=_0x14c7[_0x2d9893];return _0x2bcfaa;};'use strict';var _=require(_0x714c('0x0'));var util=require(_0x714c('0x1'));var moment=require(_0x714c('0x2'));var BPromise=require('bluebird');var rs=require(_0x714c('0x3'));var fs=require('fs');var Redis=require(_0x714c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x714c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x714c('0x6'));var client=jayson[_0x714c('0x7')][_0x714c('0x8')]({'port':0x232a});config[_0x714c('0x9')]=_['defaults'](config[_0x714c('0x9')],{'host':_0x714c('0xa'),'port':0x18eb});var socket=require(_0x714c('0xb'))(new Redis(config[_0x714c('0x9')]));require(_0x714c('0xc'))['register'](socket);function respondWithRpcPromise(_0x1dc208,_0x4c420f,_0x210519){return new BPromise(function(_0x43ca0e,_0x3c3f7e){return client[_0x714c('0xd')](_0x1dc208,_0x210519)[_0x714c('0xe')](function(_0x185ee7){logger['info'](_0x714c('0xf'),_0x4c420f,'request\x20sent');logger[_0x714c('0x10')](_0x714c('0x11'),_0x4c420f,_0x714c('0x12'),JSON[_0x714c('0x13')](_0x185ee7));if(_0x185ee7['error']){if(_0x185ee7[_0x714c('0x14')][_0x714c('0x15')]===0x1f4){logger[_0x714c('0x14')](_0x714c('0xf'),_0x4c420f,_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);return _0x3c3f7e(_0x185ee7[_0x714c('0x14')]['message']);}logger[_0x714c('0x14')](_0x714c('0xf'),_0x4c420f,_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);return _0x43ca0e(_0x185ee7[_0x714c('0x14')][_0x714c('0x16')]);}else{logger[_0x714c('0x17')](_0x714c('0xf'),_0x4c420f,_0x714c('0x12'));_0x43ca0e(_0x185ee7[_0x714c('0x18')][_0x714c('0x16')]);}})[_0x714c('0x19')](function(_0x5cd454){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4c420f,_0x5cd454);_0x3c3f7e(_0x5cd454);});});}exports['GetChatQueue']=function(_0x204c4e){var _0x294e98=this;return new Promise(function(_0x32a97d,_0x171240){return db[_0x714c('0x1a')][_0x714c('0x1b')]({'raw':_0x204c4e[_0x714c('0x1c')]?_0x204c4e['options']['raw']===undefined?!![]:![]:!![],'where':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')][_0x714c('0x1d')]||null:null,'attributes':_0x204c4e[_0x714c('0x1c')]?_0x204c4e['options']['attributes']||null:null,'limit':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')][_0x714c('0x1e')]||null:null,'include':_0x204c4e[_0x714c('0x1c')]?_0x204c4e[_0x714c('0x1c')]['include']?_[_0x714c('0x1f')](_0x204c4e[_0x714c('0x1c')][_0x714c('0x20')],function(_0x37d3ad){return{'model':db[_0x37d3ad[_0x714c('0x21')]],'as':_0x37d3ad['as'],'attributes':_0x37d3ad[_0x714c('0x22')],'include':_0x37d3ad['include']?_[_0x714c('0x1f')](_0x37d3ad['include'],function(_0x132f4a){return{'model':db[_0x132f4a[_0x714c('0x21')]],'as':_0x132f4a['as'],'attributes':_0x132f4a[_0x714c('0x22')],'include':_0x132f4a[_0x714c('0x20')]?_[_0x714c('0x1f')](_0x132f4a[_0x714c('0x20')],function(_0x965577){return{'model':db[_0x965577[_0x714c('0x21')]],'as':_0x965577['as'],'attributes':_0x965577[_0x714c('0x22')]};}):[]};}):[]};}):[]:[]})[_0x714c('0xe')](function(_0x2ef5e6){logger[_0x714c('0x17')](_0x714c('0x23'),_0x204c4e);logger[_0x714c('0x10')](_0x714c('0x23'),_0x204c4e,JSON['stringify'](_0x2ef5e6));_0x32a97d(_0x2ef5e6);})[_0x714c('0x19')](function(_0x43c086){logger['error'](_0x714c('0x23'),_0x43c086['message'],_0x204c4e);_0x171240(_0x294e98[_0x714c('0x14')](0x1f4,_0x43c086[_0x714c('0x16')]));});});};exports['ShowChatQueue']=function(_0x5619db){var _0x542084=this;return new Promise(function(_0xc5454b,_0x2e8fae){return db['ChatQueue'][_0x714c('0x24')]({'raw':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x25')]===undefined?!![]:![]:!![],'where':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x1d')]||null:null,'attributes':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')]['attributes']||null:null,'include':_0x5619db[_0x714c('0x1c')]?_0x5619db[_0x714c('0x1c')][_0x714c('0x20')]?_[_0x714c('0x1f')](_0x5619db['options'][_0x714c('0x20')],function(_0x290fc6){return{'model':db[_0x290fc6[_0x714c('0x21')]],'as':_0x290fc6['as'],'attributes':_0x290fc6[_0x714c('0x22')],'include':_0x290fc6[_0x714c('0x20')]?_[_0x714c('0x1f')](_0x290fc6['include'],function(_0x205991){return{'model':db[_0x205991[_0x714c('0x21')]],'as':_0x205991['as'],'attributes':_0x205991['attributes'],'include':_0x205991['include']?_[_0x714c('0x1f')](_0x205991[_0x714c('0x20')],function(_0x4e673e){return{'model':db[_0x4e673e[_0x714c('0x21')]],'as':_0x4e673e['as'],'attributes':_0x4e673e[_0x714c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d15b7){logger[_0x714c('0x17')](_0x714c('0x26'),_0x5619db);logger[_0x714c('0x10')](_0x714c('0x26'),_0x5619db,JSON[_0x714c('0x13')](_0x3d15b7));_0xc5454b(_0x3d15b7);})[_0x714c('0x19')](function(_0x260f62){logger[_0x714c('0x14')](_0x714c('0x26'),_0x260f62['message'],_0x5619db);_0x2e8fae(_0x542084[_0x714c('0x14')](0x1f4,_0x260f62['message']));});});}; \ No newline at end of file +var _0x2b50=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','where','limit','map','include','attributes','model','ShowChatQueue','lodash'];(function(_0x2c0546,_0x316d34){var _0x391857=function(_0x3904a6){while(--_0x3904a6){_0x2c0546['push'](_0x2c0546['shift']());}};_0x391857(++_0x316d34);}(_0x2b50,0x68));var _0x02b5=function(_0x4dd284,_0x1d349a){_0x4dd284=_0x4dd284-0x0;var _0x422fec=_0x2b50[_0x4dd284];return _0x422fec;};'use strict';var _=require(_0x02b5('0x0'));var util=require('util');var moment=require(_0x02b5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02b5('0x2'))['db'];var utils=require(_0x02b5('0x3'));var logger=require(_0x02b5('0x4'))(_0x02b5('0x5'));var config=require('../../config/environment');var jayson=require(_0x02b5('0x6'));var client=jayson[_0x02b5('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x02b5('0x8')],{'host':_0x02b5('0x9'),'port':0x18eb});var socket=require(_0x02b5('0xa'))(new Redis(config[_0x02b5('0x8')]));require(_0x02b5('0xb'))[_0x02b5('0xc')](socket);function respondWithRpcPromise(_0x21ec08,_0x92c740,_0x3b6547){return new BPromise(function(_0x25d9d2,_0x3ee4da){return client[_0x02b5('0xd')](_0x21ec08,_0x3b6547)[_0x02b5('0xe')](function(_0x306838){logger[_0x02b5('0xf')](_0x02b5('0x10'),_0x92c740,_0x02b5('0x11'));logger[_0x02b5('0x12')](_0x02b5('0x13'),_0x92c740,_0x02b5('0x11'),JSON[_0x02b5('0x14')](_0x306838));if(_0x306838[_0x02b5('0x15')]){if(_0x306838[_0x02b5('0x15')]['code']===0x1f4){logger['error'](_0x02b5('0x10'),_0x92c740,_0x306838[_0x02b5('0x15')]['message']);return _0x3ee4da(_0x306838[_0x02b5('0x15')][_0x02b5('0x16')]);}logger[_0x02b5('0x15')](_0x02b5('0x10'),_0x92c740,_0x306838[_0x02b5('0x15')][_0x02b5('0x16')]);return _0x25d9d2(_0x306838[_0x02b5('0x15')][_0x02b5('0x16')]);}else{logger[_0x02b5('0xf')]('ChatQueue,\x20%s,\x20%s',_0x92c740,_0x02b5('0x11'));_0x25d9d2(_0x306838[_0x02b5('0x17')]['message']);}})[_0x02b5('0x18')](function(_0x40fcfe){logger['error'](_0x02b5('0x10'),_0x92c740,_0x40fcfe);_0x3ee4da(_0x40fcfe);});});}exports[_0x02b5('0x19')]=function(_0x24703c){var _0x31df71=this;return new Promise(function(_0x98fe5a,_0x5d9b67){return db['ChatQueue'][_0x02b5('0x1a')]({'raw':_0x24703c['options']?_0x24703c['options']['raw']===undefined?!![]:![]:!![],'where':_0x24703c[_0x02b5('0x1b')]?_0x24703c[_0x02b5('0x1b')][_0x02b5('0x1c')]||null:null,'attributes':_0x24703c[_0x02b5('0x1b')]?_0x24703c[_0x02b5('0x1b')]['attributes']||null:null,'limit':_0x24703c[_0x02b5('0x1b')]?_0x24703c[_0x02b5('0x1b')][_0x02b5('0x1d')]||null:null,'include':_0x24703c[_0x02b5('0x1b')]?_0x24703c[_0x02b5('0x1b')]['include']?_[_0x02b5('0x1e')](_0x24703c[_0x02b5('0x1b')][_0x02b5('0x1f')],function(_0x3383ef){return{'model':db[_0x3383ef['model']],'as':_0x3383ef['as'],'attributes':_0x3383ef[_0x02b5('0x20')],'include':_0x3383ef[_0x02b5('0x1f')]?_[_0x02b5('0x1e')](_0x3383ef[_0x02b5('0x1f')],function(_0x2c2522){return{'model':db[_0x2c2522['model']],'as':_0x2c2522['as'],'attributes':_0x2c2522[_0x02b5('0x20')],'include':_0x2c2522['include']?_[_0x02b5('0x1e')](_0x2c2522['include'],function(_0x5dc17e){return{'model':db[_0x5dc17e[_0x02b5('0x21')]],'as':_0x5dc17e['as'],'attributes':_0x5dc17e[_0x02b5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x535bda){logger[_0x02b5('0xf')](_0x02b5('0x19'),_0x24703c);logger[_0x02b5('0x12')](_0x02b5('0x19'),_0x24703c,JSON[_0x02b5('0x14')](_0x535bda));_0x98fe5a(_0x535bda);})['catch'](function(_0x28c0e3){logger[_0x02b5('0x15')]('GetChatQueue',_0x28c0e3[_0x02b5('0x16')],_0x24703c);_0x5d9b67(_0x31df71['error'](0x1f4,_0x28c0e3['message']));});});};exports[_0x02b5('0x22')]=function(_0x21dee5){var _0x35c5b3=this;return new Promise(function(_0x5e320f,_0x29362a){return db['ChatQueue']['find']({'raw':_0x21dee5['options']?_0x21dee5[_0x02b5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21dee5[_0x02b5('0x1b')]?_0x21dee5[_0x02b5('0x1b')][_0x02b5('0x1c')]||null:null,'attributes':_0x21dee5[_0x02b5('0x1b')]?_0x21dee5[_0x02b5('0x1b')][_0x02b5('0x20')]||null:null,'include':_0x21dee5[_0x02b5('0x1b')]?_0x21dee5['options']['include']?_['map'](_0x21dee5[_0x02b5('0x1b')]['include'],function(_0x367caa){return{'model':db[_0x367caa[_0x02b5('0x21')]],'as':_0x367caa['as'],'attributes':_0x367caa['attributes'],'include':_0x367caa[_0x02b5('0x1f')]?_[_0x02b5('0x1e')](_0x367caa['include'],function(_0x330be6){return{'model':db[_0x330be6['model']],'as':_0x330be6['as'],'attributes':_0x330be6['attributes'],'include':_0x330be6[_0x02b5('0x1f')]?_[_0x02b5('0x1e')](_0x330be6['include'],function(_0x1e4536){return{'model':db[_0x1e4536[_0x02b5('0x21')]],'as':_0x1e4536['as'],'attributes':_0x1e4536[_0x02b5('0x20')]};}):[]};}):[]};}):[]:[]})[_0x02b5('0xe')](function(_0x3a6d9b){logger[_0x02b5('0xf')](_0x02b5('0x22'),_0x21dee5);logger['debug'](_0x02b5('0x22'),_0x21dee5,JSON[_0x02b5('0x14')](_0x3a6d9b));_0x5e320f(_0x3a6d9b);})[_0x02b5('0x18')](function(_0x411feb){logger[_0x02b5('0x15')](_0x02b5('0x22'),_0x411feb[_0x02b5('0x16')],_0x21dee5);_0x29362a(_0x35c5b3[_0x02b5('0x15')](0x1f4,_0x411feb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 24c50ac..3192b40 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 _0xf109=['remove','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf109,0xce));var _0x9f10=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xf109[_0x46698a];return _0x356db0;};'use strict';var ChatQueueEvents=require(_0x9f10('0x0'));var events=[_0x9f10('0x1'),_0x9f10('0x2'),'update'];function createListener(_0x5b381d,_0x4cbc7a){return function(_0x3659ce){_0x4cbc7a[_0x9f10('0x3')](_0x5b381d,_0x3659ce);};}function removeListener(_0x74d0ee,_0x26f01c){return function(){ChatQueueEvents[_0x9f10('0x4')](_0x74d0ee,_0x26f01c);};}exports[_0x9f10('0x5')]=function(_0x408fe8){for(var _0xd3137b=0x0,_0x227a29=events[_0x9f10('0x6')];_0xd3137b<_0x227a29;_0xd3137b++){var _0x3fd82f=events[_0xd3137b];var _0x5c8719=createListener(_0x9f10('0x7')+_0x3fd82f,_0x408fe8);ChatQueueEvents['on'](_0x3fd82f,_0x5c8719);}}; \ No newline at end of file +var _0x04de=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x04de,0x107));var _0xe04d=function(_0x337194,_0x17405f){_0x337194=_0x337194-0x0;var _0x1c075e=_0x04de[_0x337194];return _0x1c075e;};'use strict';var ChatQueueEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatQueueEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatQueueEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 570cab6..d195077 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x315d75,_0x2ef646){var _0x30f11e=function(_0x69a0f){while(--_0x69a0f){_0x315d75['push'](_0x315d75['shift']());}};_0x30f11e(++_0x2ef646);}(_0xe14b,0x93));var _0xbe14=function(_0x4be773,_0x3963ca){_0x4be773=_0x4be773-0x0;var _0xde2a81=_0xe14b[_0x4be773];return _0xde2a81;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _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(_0x1e8583,_0x5181c3){var _0xba5bb0=function(_0x5b79bc){while(--_0x5b79bc){_0x1e8583['push'](_0x1e8583['shift']());}};_0xba5bb0(++_0x5181c3);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'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 18b5970..5063350 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 _0x70ff=['STRING','DATE','moment','sequelize','exports'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x70ff,0x1ce));var _0xf70f=function(_0x3c2c62,_0x2033c2){_0x3c2c62=_0x3c2c62-0x0;var _0x58bcb8=_0x70ff[_0x3c2c62];return _0x58bcb8;};'use strict';var moment=require(_0xf70f('0x0'));var Sequelize=require(_0xf70f('0x1'));module[_0xf70f('0x2')]={'uniqueid':{'type':Sequelize[_0xf70f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf70f('0x3')]},'joinAt':{'type':Sequelize[_0xf70f('0x4')]},'leaveAt':{'type':Sequelize[_0xf70f('0x4')]},'acceptAt':{'type':Sequelize[_0xf70f('0x4')]},'exitAt':{'type':Sequelize[_0xf70f('0x4')]},'reason':{'type':Sequelize[_0xf70f('0x3')]}}; \ No newline at end of file +var _0xe157=['DATE','moment','sequelize','exports','STRING'];(function(_0x15dcaf,_0x2ad551){var _0x1d4665=function(_0x5305ae){while(--_0x5305ae){_0x15dcaf['push'](_0x15dcaf['shift']());}};_0x1d4665(++_0x2ad551);}(_0xe157,0x13c));var _0x7e15=function(_0x5118d6,_0x204fca){_0x5118d6=_0x5118d6-0x0;var _0x5ab55b=_0xe157[_0x5118d6];return _0x5ab55b;};'use strict';var moment=require(_0x7e15('0x0'));var Sequelize=require(_0x7e15('0x1'));module[_0x7e15('0x2')]={'uniqueid':{'type':Sequelize[_0x7e15('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7e15('0x4')]},'exitAt':{'type':Sequelize[_0x7e15('0x4')]},'reason':{'type':Sequelize[_0x7e15('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8be2d1f..0be659e 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 _0x1921=['rows','catch','show','length','options','create','body','find','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1921,0xf2));var _0x1192=function(_0x33c729,_0x75ce23){_0x33c729=_0x33c729-0x0;var _0x1a868a=_0x1921[_0x33c729];return _0x1a868a;};'use strict';var emlformat=require(_0x1192('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1192('0x1'));var jsonpatch=require(_0x1192('0x2'));var rp=require(_0x1192('0x3'));var moment=require(_0x1192('0x4'));var BPromise=require(_0x1192('0x5'));var Mustache=require(_0x1192('0x6'));var util=require(_0x1192('0x7'));var path=require(_0x1192('0x8'));var sox=require(_0x1192('0x9'));var csv=require(_0x1192('0xa'));var ejs=require(_0x1192('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1192('0xc'));var crypto=require(_0x1192('0xd'));var jsforce=require(_0x1192('0xe'));var deskjs=require(_0x1192('0xf'));var toCsv=require(_0x1192('0xa'));var querystring=require(_0x1192('0x10'));var Papa=require(_0x1192('0x11'));var Redis=require(_0x1192('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1192('0x13'));var hardwareService=require(_0x1192('0x14'));var logger=require(_0x1192('0x15'))(_0x1192('0x16'));var utils=require(_0x1192('0x17'));var config=require(_0x1192('0x18'));var licenseUtil=require(_0x1192('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33b997,_0x594596){_0x594596=_0x594596||0xcc;return function(_0x3b7ba7){if(_0x3b7ba7){return _0x33b997[_0x1192('0x1a')](_0x594596);}return _0x33b997['status'](_0x594596)[_0x1192('0x1b')]();};}function respondWithResult(_0x1e5fcc,_0x406b97){_0x406b97=_0x406b97||0xc8;return function(_0x4c17d3){if(_0x4c17d3){return _0x1e5fcc[_0x1192('0x1c')](_0x406b97)[_0x1192('0x1d')](_0x4c17d3);}};}function respondWithFilteredResult(_0x55755b,_0x2021f2){return function(_0x3397d1){if(_0x3397d1){var _0x2a162b=typeof _0x2021f2['offset']===_0x1192('0x1e')&&typeof _0x2021f2['limit']===_0x1192('0x1e');var _0x4757bb=_0x3397d1[_0x1192('0x1f')];var _0x13a5ca=_0x2a162b?0x0:_0x2021f2[_0x1192('0x20')];var _0x24c2e1=_0x2a162b?_0x3397d1['count']:_0x2021f2['offset']+_0x2021f2[_0x1192('0x21')];var _0x1b46e2;if(_0x24c2e1>=_0x4757bb){_0x24c2e1=_0x4757bb;_0x1b46e2=0xc8;}else{_0x1b46e2=0xce;}_0x55755b[_0x1192('0x1c')](_0x1b46e2);return _0x55755b[_0x1192('0x22')]('Content-Range',_0x13a5ca+'-'+_0x24c2e1+'/'+_0x4757bb)[_0x1192('0x1d')](_0x3397d1);}return null;};}function patchUpdates(_0x2da521){return function(_0x141c9b){try{jsonpatch['apply'](_0x141c9b,_0x2da521,!![]);}catch(_0x1cfcd6){return BPromise[_0x1192('0x23')](_0x1cfcd6);}return _0x141c9b['save']();};}function saveUpdates(_0x40bee5,_0x22f4c8){return function(_0x402e64){if(_0x402e64){return _0x402e64[_0x1192('0x24')](_0x40bee5)['then'](function(_0x4ad6b4){return _0x4ad6b4;});}return null;};}function removeEntity(_0x406c87,_0x5a7774){return function(_0x3cc973){if(_0x3cc973){return _0x3cc973['destroy']()[_0x1192('0x25')](function(){_0x406c87['status'](0xcc)[_0x1192('0x1b')]();});}};}function handleEntityNotFound(_0x18e4cc,_0x572d29){return function(_0x40bdb5){if(!_0x40bdb5){_0x18e4cc[_0x1192('0x1a')](0x194);}return _0x40bdb5;};}function handleError(_0x1e198c,_0x148c22){_0x148c22=_0x148c22||0x1f4;return function(_0x288ac6){logger[_0x1192('0x26')](_0x288ac6['stack']);if(_0x288ac6[_0x1192('0x27')]){delete _0x288ac6[_0x1192('0x27')];}_0x1e198c[_0x1192('0x1c')](_0x148c22)[_0x1192('0x28')](_0x288ac6);};}exports[_0x1192('0x29')]=function(_0x3a0736,_0x469fcd){var _0x2c7c9b={},_0x3d2c78={},_0x3c2d80={'count':0x0,'rows':[]};var _0x51e8bd=_[_0x1192('0x2a')](db['ChatQueueReport']['rawAttributes'],function(_0x7218dc){return{'name':_0x7218dc[_0x1192('0x2b')],'type':_0x7218dc[_0x1192('0x2c')][_0x1192('0x2d')]};});_0x3d2c78[_0x1192('0x2e')]=_[_0x1192('0x2a')](_0x51e8bd,_0x1192('0x27'));_0x3d2c78[_0x1192('0x2f')]=_[_0x1192('0x30')](_0x3a0736[_0x1192('0x2f')]);_0x3d2c78[_0x1192('0x31')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],_0x3d2c78[_0x1192('0x2f')]);_0x2c7c9b[_0x1192('0x33')]=_[_0x1192('0x32')](_0x3d2c78[_0x1192('0x2e')],qs[_0x1192('0x34')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x34')]));_0x2c7c9b[_0x1192('0x33')]=_0x2c7c9b['attributes']['length']?_0x2c7c9b['attributes']:_0x3d2c78[_0x1192('0x2e')];if(!_0x3a0736[_0x1192('0x2f')][_0x1192('0x35')](_0x1192('0x36'))){_0x2c7c9b['limit']=qs[_0x1192('0x21')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x21')]);_0x2c7c9b[_0x1192('0x20')]=qs[_0x1192('0x20')](_0x3a0736[_0x1192('0x2f')][_0x1192('0x20')]);}_0x2c7c9b[_0x1192('0x37')]=qs['sort'](_0x3a0736['query'][_0x1192('0x38')]);_0x2c7c9b[_0x1192('0x39')]=qs[_0x1192('0x31')](_[_0x1192('0x3a')](_0x3a0736[_0x1192('0x2f')],_0x3d2c78[_0x1192('0x31')]),_0x51e8bd);if(_0x3a0736['query'][_0x1192('0x3b')]){_0x2c7c9b[_0x1192('0x39')]=_[_0x1192('0x3c')](_0x2c7c9b[_0x1192('0x39')],{'$or':_[_0x1192('0x2a')](_0x51e8bd,function(_0x40ca5a){if(_0x40ca5a['type']!==_0x1192('0x3d')){var _0x3229f7={};_0x3229f7[_0x40ca5a['name']]={'$like':'%'+_0x3a0736[_0x1192('0x2f')][_0x1192('0x3b')]+'%'};return _0x3229f7;}})});}_0x2c7c9b=_[_0x1192('0x3c')]({},_0x2c7c9b,_0x3a0736['options']);var _0x57f4d2={'where':_0x2c7c9b['where']};return db[_0x1192('0x3e')][_0x1192('0x1f')](_0x57f4d2)['then'](function(_0x2974a1){_0x3c2d80[_0x1192('0x1f')]=_0x2974a1;if(_0x3a0736[_0x1192('0x2f')][_0x1192('0x3f')]){_0x2c7c9b[_0x1192('0x40')]=[{'all':!![]}];}return db[_0x1192('0x3e')][_0x1192('0x41')](_0x2c7c9b);})[_0x1192('0x25')](function(_0x1c4198){_0x3c2d80[_0x1192('0x42')]=_0x1c4198;return _0x3c2d80;})[_0x1192('0x25')](respondWithFilteredResult(_0x469fcd,_0x2c7c9b))[_0x1192('0x43')](handleError(_0x469fcd,null));};exports[_0x1192('0x44')]=function(_0xbae0b2,_0x17cc55){var _0x290a87={'raw':!![],'where':{'id':_0xbae0b2['params']['id']}},_0x553896={};_0x553896[_0x1192('0x2e')]=_[_0x1192('0x30')](db[_0x1192('0x3e')]['rawAttributes']);_0x553896[_0x1192('0x2f')]=_[_0x1192('0x30')](_0xbae0b2[_0x1192('0x2f')]);_0x553896['filters']=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],_0x553896['query']);_0x290a87[_0x1192('0x33')]=_[_0x1192('0x32')](_0x553896[_0x1192('0x2e')],qs['fields'](_0xbae0b2[_0x1192('0x2f')][_0x1192('0x34')]));_0x290a87[_0x1192('0x33')]=_0x290a87[_0x1192('0x33')][_0x1192('0x45')]?_0x290a87['attributes']:_0x553896['model'];if(_0xbae0b2[_0x1192('0x2f')]['includeAll']){_0x290a87[_0x1192('0x40')]=[{'all':!![]}];}_0x290a87=_[_0x1192('0x3c')]({},_0x290a87,_0xbae0b2[_0x1192('0x46')]);return db[_0x1192('0x3e')]['find'](_0x290a87)[_0x1192('0x25')](handleEntityNotFound(_0x17cc55,null))[_0x1192('0x25')](respondWithResult(_0x17cc55,null))[_0x1192('0x43')](handleError(_0x17cc55,null));};exports[_0x1192('0x47')]=function(_0x2ecd11,_0x144149){return db[_0x1192('0x3e')]['create'](_0x2ecd11[_0x1192('0x48')],{})[_0x1192('0x25')](respondWithResult(_0x144149,0xc9))['catch'](handleError(_0x144149,null));};exports[_0x1192('0x24')]=function(_0x2ad1cf,_0x2822f8){if(_0x2ad1cf[_0x1192('0x48')]['id']){delete _0x2ad1cf[_0x1192('0x48')]['id'];}return db[_0x1192('0x3e')][_0x1192('0x49')]({'where':{'id':_0x2ad1cf['params']['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x2822f8,null))[_0x1192('0x25')](saveUpdates(_0x2ad1cf[_0x1192('0x48')],null))['then'](respondWithResult(_0x2822f8,null))[_0x1192('0x43')](handleError(_0x2822f8,null));};exports[_0x1192('0x4a')]=function(_0xcdda33,_0x5b735c){return db['ChatQueueReport']['find']({'where':{'id':_0xcdda33[_0x1192('0x4b')]['id']}})[_0x1192('0x25')](handleEntityNotFound(_0x5b735c,null))[_0x1192('0x25')](removeEntity(_0x5b735c,null))['catch'](handleError(_0x5b735c,null));};exports['describe']=function(_0x5e2c2e,_0x239b6c){return db['ChatQueueReport'][_0x1192('0x4c')]()[_0x1192('0x25')](respondWithResult(_0x239b6c,null))[_0x1192('0x43')](handleError(_0x239b6c,null));}; \ No newline at end of file +var _0x720b=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatQueueReport','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','send','index','rawAttributes','type','model','map','name','query','keys','intersection','fields','attributes','length'];(function(_0x47edea,_0xdfb9f){var _0x54208b=function(_0x3d703e){while(--_0x3d703e){_0x47edea['push'](_0x47edea['shift']());}};_0x54208b(++_0xdfb9f);}(_0x720b,0x1d8));var _0xb720=function(_0x4741a1,_0x35563f){_0x4741a1=_0x4741a1-0x0;var _0xaea39f=_0x720b[_0x4741a1];return _0xaea39f;};'use strict';var emlformat=require(_0xb720('0x0'));var rimraf=require(_0xb720('0x1'));var zipdir=require(_0xb720('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb720('0x3'));var moment=require(_0xb720('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb720('0x5'));var util=require(_0xb720('0x6'));var path=require(_0xb720('0x7'));var sox=require('sox');var csv=require(_0xb720('0x8'));var ejs=require(_0xb720('0x9'));var fs=require('fs');var fs_extra=require(_0xb720('0xa'));var _=require(_0xb720('0xb'));var squel=require(_0xb720('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb720('0xd'));var toCsv=require(_0xb720('0x8'));var querystring=require(_0xb720('0xe'));var Papa=require(_0xb720('0xf'));var Redis=require(_0xb720('0x10'));var authService=require(_0xb720('0x11'));var qs=require(_0xb720('0x12'));var as=require(_0xb720('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb720('0x14'))(_0xb720('0x15'));var utils=require('../../config/utils');var config=require(_0xb720('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb720('0x17'))['db'];function respondWithStatusCode(_0x4ab352,_0x62de2b){_0x62de2b=_0x62de2b||0xcc;return function(_0x12781c){if(_0x12781c){return _0x4ab352[_0xb720('0x18')](_0x62de2b);}return _0x4ab352[_0xb720('0x19')](_0x62de2b)[_0xb720('0x1a')]();};}function respondWithResult(_0x30a5dd,_0x1d29ce){_0x1d29ce=_0x1d29ce||0xc8;return function(_0x414216){if(_0x414216){return _0x30a5dd['status'](_0x1d29ce)[_0xb720('0x1b')](_0x414216);}};}function respondWithFilteredResult(_0x2749fd,_0x3e7e22){return function(_0x5a675d){if(_0x5a675d){var _0x4edde2=typeof _0x3e7e22[_0xb720('0x1c')]===_0xb720('0x1d')&&typeof _0x3e7e22[_0xb720('0x1e')]==='undefined';var _0x1bda26=_0x5a675d[_0xb720('0x1f')];var _0x453c43=_0x4edde2?0x0:_0x3e7e22[_0xb720('0x1c')];var _0x395d6a=_0x4edde2?_0x5a675d[_0xb720('0x1f')]:_0x3e7e22[_0xb720('0x1c')]+_0x3e7e22[_0xb720('0x1e')];var _0x3d8fa4;if(_0x395d6a>=_0x1bda26){_0x395d6a=_0x1bda26;_0x3d8fa4=0xc8;}else{_0x3d8fa4=0xce;}_0x2749fd[_0xb720('0x19')](_0x3d8fa4);return _0x2749fd[_0xb720('0x20')](_0xb720('0x21'),_0x453c43+'-'+_0x395d6a+'/'+_0x1bda26)[_0xb720('0x1b')](_0x5a675d);}return null;};}function patchUpdates(_0x3bcca2){return function(_0x38f815){try{jsonpatch[_0xb720('0x22')](_0x38f815,_0x3bcca2,!![]);}catch(_0x25acb4){return BPromise[_0xb720('0x23')](_0x25acb4);}return _0x38f815[_0xb720('0x24')]();};}function saveUpdates(_0x8b19ea,_0x4e366a){return function(_0x5359b5){if(_0x5359b5){return _0x5359b5['update'](_0x8b19ea)[_0xb720('0x25')](function(_0x5f47d5){return _0x5f47d5;});}return null;};}function removeEntity(_0x27d3cb,_0x20bec1){return function(_0x3b4f61){if(_0x3b4f61){return _0x3b4f61[_0xb720('0x26')]()[_0xb720('0x25')](function(){_0x27d3cb[_0xb720('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498860,_0x5cb6aa){return function(_0x298cce){if(!_0x298cce){_0x498860[_0xb720('0x18')](0x194);}return _0x298cce;};}function handleError(_0x5f1e03,_0x508eb8){_0x508eb8=_0x508eb8||0x1f4;return function(_0x1c3805){logger['error'](_0x1c3805[_0xb720('0x27')]);if(_0x1c3805['name']){delete _0x1c3805['name'];}_0x5f1e03[_0xb720('0x19')](_0x508eb8)[_0xb720('0x28')](_0x1c3805);};}exports[_0xb720('0x29')]=function(_0x416161,_0x466405){var _0xd25825={},_0x732423={},_0x17faec={'count':0x0,'rows':[]};var _0x575738=_['map'](db['ChatQueueReport'][_0xb720('0x2a')],function(_0x70faef){return{'name':_0x70faef['fieldName'],'type':_0x70faef[_0xb720('0x2b')]['key']};});_0x732423[_0xb720('0x2c')]=_[_0xb720('0x2d')](_0x575738,_0xb720('0x2e'));_0x732423[_0xb720('0x2f')]=_[_0xb720('0x30')](_0x416161[_0xb720('0x2f')]);_0x732423['filters']=_[_0xb720('0x31')](_0x732423[_0xb720('0x2c')],_0x732423[_0xb720('0x2f')]);_0xd25825['attributes']=_[_0xb720('0x31')](_0x732423[_0xb720('0x2c')],qs['fields'](_0x416161['query'][_0xb720('0x32')]));_0xd25825['attributes']=_0xd25825[_0xb720('0x33')][_0xb720('0x34')]?_0xd25825[_0xb720('0x33')]:_0x732423[_0xb720('0x2c')];if(!_0x416161['query']['hasOwnProperty'](_0xb720('0x35'))){_0xd25825[_0xb720('0x1e')]=qs[_0xb720('0x1e')](_0x416161[_0xb720('0x2f')][_0xb720('0x1e')]);_0xd25825['offset']=qs['offset'](_0x416161[_0xb720('0x2f')][_0xb720('0x1c')]);}_0xd25825[_0xb720('0x36')]=qs[_0xb720('0x37')](_0x416161[_0xb720('0x2f')][_0xb720('0x37')]);_0xd25825[_0xb720('0x38')]=qs[_0xb720('0x39')](_[_0xb720('0x3a')](_0x416161['query'],_0x732423['filters']),_0x575738);if(_0x416161[_0xb720('0x2f')][_0xb720('0x3b')]){_0xd25825[_0xb720('0x38')]=_[_0xb720('0x3c')](_0xd25825[_0xb720('0x38')],{'$or':_[_0xb720('0x2d')](_0x575738,function(_0x1e8bc2){if(_0x1e8bc2[_0xb720('0x2b')]!==_0xb720('0x3d')){var _0x4aaa5f={};_0x4aaa5f[_0x1e8bc2[_0xb720('0x2e')]]={'$like':'%'+_0x416161[_0xb720('0x2f')][_0xb720('0x3b')]+'%'};return _0x4aaa5f;}})});}_0xd25825=_[_0xb720('0x3c')]({},_0xd25825,_0x416161['options']);var _0xb50cec={'where':_0xd25825[_0xb720('0x38')]};return db[_0xb720('0x3e')][_0xb720('0x1f')](_0xb50cec)[_0xb720('0x25')](function(_0x2ebd44){_0x17faec[_0xb720('0x1f')]=_0x2ebd44;if(_0x416161[_0xb720('0x2f')][_0xb720('0x3f')]){_0xd25825[_0xb720('0x40')]=[{'all':!![]}];}return db[_0xb720('0x3e')][_0xb720('0x41')](_0xd25825);})[_0xb720('0x25')](function(_0x48ab46){_0x17faec[_0xb720('0x42')]=_0x48ab46;return _0x17faec;})[_0xb720('0x25')](respondWithFilteredResult(_0x466405,_0xd25825))[_0xb720('0x43')](handleError(_0x466405,null));};exports['show']=function(_0xddf177,_0x5f1d85){var _0x4d0201={'raw':!![],'where':{'id':_0xddf177[_0xb720('0x44')]['id']}},_0x466a98={};_0x466a98[_0xb720('0x2c')]=_[_0xb720('0x30')](db['ChatQueueReport'][_0xb720('0x2a')]);_0x466a98[_0xb720('0x2f')]=_['keys'](_0xddf177[_0xb720('0x2f')]);_0x466a98[_0xb720('0x39')]=_[_0xb720('0x31')](_0x466a98[_0xb720('0x2c')],_0x466a98[_0xb720('0x2f')]);_0x4d0201[_0xb720('0x33')]=_[_0xb720('0x31')](_0x466a98[_0xb720('0x2c')],qs['fields'](_0xddf177[_0xb720('0x2f')][_0xb720('0x32')]));_0x4d0201['attributes']=_0x4d0201[_0xb720('0x33')]['length']?_0x4d0201[_0xb720('0x33')]:_0x466a98[_0xb720('0x2c')];if(_0xddf177[_0xb720('0x2f')][_0xb720('0x3f')]){_0x4d0201[_0xb720('0x40')]=[{'all':!![]}];}_0x4d0201=_[_0xb720('0x3c')]({},_0x4d0201,_0xddf177[_0xb720('0x45')]);return db['ChatQueueReport'][_0xb720('0x46')](_0x4d0201)['then'](handleEntityNotFound(_0x5f1d85,null))[_0xb720('0x25')](respondWithResult(_0x5f1d85,null))['catch'](handleError(_0x5f1d85,null));};exports[_0xb720('0x47')]=function(_0x10ff3f,_0x428f40){return db[_0xb720('0x3e')][_0xb720('0x47')](_0x10ff3f[_0xb720('0x48')],{})[_0xb720('0x25')](respondWithResult(_0x428f40,0xc9))[_0xb720('0x43')](handleError(_0x428f40,null));};exports[_0xb720('0x49')]=function(_0x4bd743,_0x5565c9){if(_0x4bd743[_0xb720('0x48')]['id']){delete _0x4bd743[_0xb720('0x48')]['id'];}return db[_0xb720('0x3e')][_0xb720('0x46')]({'where':{'id':_0x4bd743['params']['id']}})[_0xb720('0x25')](handleEntityNotFound(_0x5565c9,null))[_0xb720('0x25')](saveUpdates(_0x4bd743['body'],null))[_0xb720('0x25')](respondWithResult(_0x5565c9,null))[_0xb720('0x43')](handleError(_0x5565c9,null));};exports['destroy']=function(_0x3652ef,_0x4e6bce){return db['ChatQueueReport'][_0xb720('0x46')]({'where':{'id':_0x3652ef[_0xb720('0x44')]['id']}})[_0xb720('0x25')](handleEntityNotFound(_0x4e6bce,null))[_0xb720('0x25')](removeEntity(_0x4e6bce,null))[_0xb720('0x43')](handleError(_0x4e6bce,null));};exports[_0xb720('0x4a')]=function(_0x10938a,_0x3eefc1){return db[_0xb720('0x3e')][_0xb720('0x4a')]()[_0xb720('0x25')](respondWithResult(_0x3eefc1,null))[_0xb720('0x43')](handleError(_0x3eefc1,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 455798b..3ea9348 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe706,0xa3));var _0x6e70=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0xe706[_0x546f9f];return _0x3513dd;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x1a4165,_0x116f6c){var _0x54e31f=function(_0x31fe06){while(--_0x31fe06){_0x1a4165['push'](_0x1a4165['shift']());}};_0x54e31f(++_0x116f6c);}(_0x757a,0xde));var _0xa757=function(_0x23dd5b,_0x246bd0){_0x23dd5b=_0x23dd5b-0x0;var _0x35fcb4=_0x757a[_0x23dd5b];return _0x35fcb4;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9f08392..2b879e1 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 _0xf929=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf929,0x164));var _0x9f92=function(_0x17be90,_0x200dfd){_0x17be90=_0x17be90-0x0;var _0x5a6276=_0xf929[_0x17be90];return _0x5a6276;};'use strict';var _=require(_0x9f92('0x0'));var util=require('util');var moment=require(_0x9f92('0x1'));var BPromise=require(_0x9f92('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f92('0x3'));var db=require(_0x9f92('0x4'))['db'];var utils=require(_0x9f92('0x5'));var logger=require(_0x9f92('0x6'))(_0x9f92('0x7'));var config=require(_0x9f92('0x8'));var jayson=require(_0x9f92('0x9'));var client=jayson[_0x9f92('0xa')][_0x9f92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29a770,_0x77aa18,_0x5f343f){return new BPromise(function(_0x98a2f5,_0x2d4115){return client[_0x9f92('0xc')](_0x29a770,_0x5f343f)[_0x9f92('0xd')](function(_0x35adc2){logger[_0x9f92('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x77aa18,_0x9f92('0xf'));logger[_0x9f92('0x10')](_0x9f92('0x11'),_0x77aa18,_0x9f92('0xf'),JSON[_0x9f92('0x12')](_0x35adc2));if(_0x35adc2[_0x9f92('0x13')]){if(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x14')]===0x1f4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x2d4115(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}logger[_0x9f92('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x77aa18,_0x35adc2[_0x9f92('0x13')]['message']);return _0x98a2f5(_0x35adc2[_0x9f92('0x13')][_0x9f92('0x16')]);}else{logger[_0x9f92('0xe')](_0x9f92('0x15'),_0x77aa18,_0x9f92('0xf'));_0x98a2f5(_0x35adc2['result']['message']);}})[_0x9f92('0x17')](function(_0x27dcf4){logger[_0x9f92('0x13')](_0x9f92('0x15'),_0x77aa18,_0x27dcf4);_0x2d4115(_0x27dcf4);});});}exports['CreateChatQueueReport']=function(_0x1045c1){var _0x1ead43=this;return new Promise(function(_0x31acf3,_0x1d058a){return db[_0x9f92('0x18')][_0x9f92('0x19')](_0x1045c1[_0x9f92('0x1a')],{'raw':_0x1045c1[_0x9f92('0x1b')]?_0x1045c1[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![]})[_0x9f92('0xd')](function(_0x340e0a){logger[_0x9f92('0xe')](_0x9f92('0x1d'),_0x1045c1);logger['debug'](_0x9f92('0x1d'),_0x1045c1,JSON[_0x9f92('0x12')](_0x340e0a));_0x31acf3(_0x340e0a);})[_0x9f92('0x17')](function(_0x5b6f2f){logger[_0x9f92('0x13')](_0x9f92('0x1d'),_0x5b6f2f[_0x9f92('0x16')],_0x1045c1);_0x1d058a(_0x1ead43[_0x9f92('0x13')](0x1f4,_0x5b6f2f[_0x9f92('0x16')]));});});};exports[_0x9f92('0x1e')]=function(_0xf2b1db){var _0x2c2812=this;return new Promise(function(_0x5ca0f2,_0x214dfd){return db['ChatQueueReport']['update'](_0xf2b1db[_0x9f92('0x1a')],{'raw':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x1f')]||null:null,'attributes':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x20')]||null:null,'limit':_0xf2b1db[_0x9f92('0x1b')]?_0xf2b1db[_0x9f92('0x1b')][_0x9f92('0x21')]||null:null})['then'](function(_0x2dc012){logger['info'](_0x9f92('0x1e'),_0xf2b1db);logger[_0x9f92('0x10')]('UpdateChatQueueReport',_0xf2b1db,JSON[_0x9f92('0x12')](_0x2dc012));_0x5ca0f2(_0x2dc012);})[_0x9f92('0x17')](function(_0x56b814){logger[_0x9f92('0x13')](_0x9f92('0x1e'),_0x56b814['message'],_0xf2b1db);_0x214dfd(_0x2c2812['error'](0x1f4,_0x56b814['message']));});});}; \ No newline at end of file +var _0xad03=['options','raw','debug','UpdateChatQueueReport','body','where','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport'];(function(_0x250053,_0x36dad1){var _0x40851a=function(_0x3da7a4){while(--_0x3da7a4){_0x250053['push'](_0x250053['shift']());}};_0x40851a(++_0x36dad1);}(_0xad03,0x1e3));var _0x3ad0=function(_0x2ca718,_0x5239ed){_0x2ca718=_0x2ca718-0x0;var _0x4e2242=_0xad03[_0x2ca718];return _0x4e2242;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ad0('0x0'));var BPromise=require(_0x3ad0('0x1'));var rs=require(_0x3ad0('0x2'));var fs=require('fs');var Redis=require(_0x3ad0('0x3'));var db=require(_0x3ad0('0x4'))['db'];var utils=require(_0x3ad0('0x5'));var logger=require(_0x3ad0('0x6'))(_0x3ad0('0x7'));var config=require('../../config/environment');var jayson=require(_0x3ad0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5cc92e,_0x5a7401,_0xfe9877){return new BPromise(function(_0x1da13b,_0x1139ac){return client['request'](_0x5cc92e,_0xfe9877)[_0x3ad0('0x9')](function(_0x353473){logger[_0x3ad0('0xa')](_0x3ad0('0xb'),_0x5a7401,_0x3ad0('0xc'));logger['debug'](_0x3ad0('0xd'),_0x5a7401,_0x3ad0('0xc'),JSON[_0x3ad0('0xe')](_0x353473));if(_0x353473['error']){if(_0x353473[_0x3ad0('0xf')]['code']===0x1f4){logger['error'](_0x3ad0('0xb'),_0x5a7401,_0x353473[_0x3ad0('0xf')]['message']);return _0x1139ac(_0x353473[_0x3ad0('0xf')][_0x3ad0('0x10')]);}logger[_0x3ad0('0xf')](_0x3ad0('0xb'),_0x5a7401,_0x353473[_0x3ad0('0xf')][_0x3ad0('0x10')]);return _0x1da13b(_0x353473[_0x3ad0('0xf')][_0x3ad0('0x10')]);}else{logger['info'](_0x3ad0('0xb'),_0x5a7401,_0x3ad0('0xc'));_0x1da13b(_0x353473[_0x3ad0('0x11')]['message']);}})[_0x3ad0('0x12')](function(_0x461fa6){logger[_0x3ad0('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5a7401,_0x461fa6);_0x1139ac(_0x461fa6);});});}exports[_0x3ad0('0x13')]=function(_0x31b56a){var _0x2f1a59=this;return new Promise(function(_0x1e0569,_0x2750a3){return db[_0x3ad0('0x14')]['create'](_0x31b56a['body'],{'raw':_0x31b56a[_0x3ad0('0x15')]?_0x31b56a[_0x3ad0('0x15')][_0x3ad0('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1062b7){logger[_0x3ad0('0xa')](_0x3ad0('0x13'),_0x31b56a);logger[_0x3ad0('0x17')](_0x3ad0('0x13'),_0x31b56a,JSON[_0x3ad0('0xe')](_0x1062b7));_0x1e0569(_0x1062b7);})[_0x3ad0('0x12')](function(_0x1abe28){logger[_0x3ad0('0xf')](_0x3ad0('0x13'),_0x1abe28[_0x3ad0('0x10')],_0x31b56a);_0x2750a3(_0x2f1a59[_0x3ad0('0xf')](0x1f4,_0x1abe28[_0x3ad0('0x10')]));});});};exports[_0x3ad0('0x18')]=function(_0x2f5fc1){var _0x5672f1=this;return new Promise(function(_0xe72ec6,_0x9b865a){return db[_0x3ad0('0x14')]['update'](_0x2f5fc1[_0x3ad0('0x19')],{'raw':_0x2f5fc1[_0x3ad0('0x15')]?_0x2f5fc1[_0x3ad0('0x15')][_0x3ad0('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f5fc1['options']?_0x2f5fc1[_0x3ad0('0x15')][_0x3ad0('0x1a')]||null:null,'attributes':_0x2f5fc1['options']?_0x2f5fc1[_0x3ad0('0x15')]['attributes']||null:null,'limit':_0x2f5fc1['options']?_0x2f5fc1['options'][_0x3ad0('0x1b')]||null:null})['then'](function(_0x55a006){logger['info'](_0x3ad0('0x18'),_0x2f5fc1);logger[_0x3ad0('0x17')](_0x3ad0('0x18'),_0x2f5fc1,JSON['stringify'](_0x55a006));_0xe72ec6(_0x55a006);})['catch'](function(_0x19299b){logger[_0x3ad0('0xf')](_0x3ad0('0x18'),_0x19299b[_0x3ad0('0x10')],_0x2f5fc1);_0x9b865a(_0x5672f1[_0x3ad0('0xf')](0x1f4,_0x19299b[_0x3ad0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1a60a75..7bab161 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 _0xd853=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','./chatQueueReport.controller','get','isAuthenticated','/describe'];(function(_0xb03acb,_0x2e9075){var _0x2e3fff=function(_0x14a82e){while(--_0x14a82e){_0xb03acb['push'](_0xb03acb['shift']());}};_0x2e3fff(++_0x2e9075);}(_0xd853,0x14c));var _0x3d85=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0xd853[_0x27332e];return _0x5882fc;};'use strict';var multer=require('multer');var util=require(_0x3d85('0x0'));var path=require('path');var timeout=require(_0x3d85('0x1'));var express=require('express');var router=express[_0x3d85('0x2')]();var fs_extra=require(_0x3d85('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d85('0x4'));router[_0x3d85('0x5')]('/',auth[_0x3d85('0x6')](),controller['index']);router[_0x3d85('0x5')](_0x3d85('0x7'),auth[_0x3d85('0x6')](),controller[_0x3d85('0x8')]);router[_0x3d85('0x5')](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xa')]);router[_0x3d85('0xb')]('/',auth[_0x3d85('0x6')](),controller[_0x3d85('0xc')]);router[_0x3d85('0xd')](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xe')]);router['delete'](_0x3d85('0x9'),auth[_0x3d85('0x6')](),controller[_0x3d85('0xf')]);module[_0x3d85('0x10')]=router; \ No newline at end of file +var _0x78dd=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','index','get','/describe','show','post','update','/:id','destroy','util','path','connect-timeout'];(function(_0x1b52e0,_0x1f0a88){var _0x581d36=function(_0x588aca){while(--_0x588aca){_0x1b52e0['push'](_0x1b52e0['shift']());}};_0x581d36(++_0x1f0a88);}(_0x78dd,0x1dd));var _0xd78d=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x78dd[_0x548627];return _0x844a84;};'use strict';var multer=require('multer');var util=require(_0xd78d('0x0'));var path=require(_0xd78d('0x1'));var timeout=require(_0xd78d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd78d('0x3'));var auth=require(_0xd78d('0x4'));var interaction=require(_0xd78d('0x5'));var config=require('../../config/environment');var controller=require(_0xd78d('0x6'));router['get']('/',auth[_0xd78d('0x7')](),controller[_0xd78d('0x8')]);router[_0xd78d('0x9')](_0xd78d('0xa'),auth[_0xd78d('0x7')](),controller['describe']);router[_0xd78d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd78d('0xb')]);router[_0xd78d('0xc')]('/',auth[_0xd78d('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd78d('0xd')]);router['delete'](_0xd78d('0xe'),auth[_0xd78d('0x7')](),controller[_0xd78d('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7fcba68..6205e0d 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x418909,_0x37114c){_0x418909=_0x418909-0x0;var _0x477448=_0x9bde[_0x418909];return _0x477448;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2bb825,_0x1da979){var _0x52e9f0=function(_0x2d51e2){while(--_0x2d51e2){_0x2bb825['push'](_0x2bb825['shift']());}};_0x52e9f0(++_0x1da979);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 34050fc..1cc9776 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 _0x80de=['map','ChatTransferReport','rawAttributes','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','params','keys','includeAll','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','stack','name','index'];(function(_0x7de12c,_0x5cbe98){var _0x135672=function(_0x5b9d32){while(--_0x5b9d32){_0x7de12c['push'](_0x7de12c['shift']());}};_0x135672(++_0x5cbe98);}(_0x80de,0xb5));var _0xe80d=function(_0x5d7d7f,_0x15ecee){_0x5d7d7f=_0x5d7d7f-0x0;var _0x30d103=_0x80de[_0x5d7d7f];return _0x30d103;};'use strict';var emlformat=require(_0xe80d('0x0'));var rimraf=require(_0xe80d('0x1'));var zipdir=require(_0xe80d('0x2'));var jsonpatch=require(_0xe80d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe80d('0x4'));var Mustache=require(_0xe80d('0x5'));var util=require(_0xe80d('0x6'));var path=require(_0xe80d('0x7'));var sox=require(_0xe80d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe80d('0x9'));var _=require(_0xe80d('0xa'));var squel=require(_0xe80d('0xb'));var crypto=require(_0xe80d('0xc'));var jsforce=require(_0xe80d('0xd'));var deskjs=require(_0xe80d('0xe'));var toCsv=require(_0xe80d('0xf'));var querystring=require(_0xe80d('0x10'));var Papa=require(_0xe80d('0x11'));var Redis=require(_0xe80d('0x12'));var authService=require(_0xe80d('0x13'));var qs=require(_0xe80d('0x14'));var as=require(_0xe80d('0x15'));var hardwareService=require(_0xe80d('0x16'));var logger=require(_0xe80d('0x17'))(_0xe80d('0x18'));var utils=require(_0xe80d('0x19'));var config=require(_0xe80d('0x1a'));var licenseUtil=require(_0xe80d('0x1b'));var db=require(_0xe80d('0x1c'))['db'];function respondWithStatusCode(_0x46ffaa,_0x3c47d6){_0x3c47d6=_0x3c47d6||0xcc;return function(_0x28726a){if(_0x28726a){return _0x46ffaa['sendStatus'](_0x3c47d6);}return _0x46ffaa[_0xe80d('0x1d')](_0x3c47d6)['end']();};}function respondWithResult(_0x204508,_0x3df3a2){_0x3df3a2=_0x3df3a2||0xc8;return function(_0x1117ed){if(_0x1117ed){return _0x204508['status'](_0x3df3a2)[_0xe80d('0x1e')](_0x1117ed);}};}function respondWithFilteredResult(_0x141d1b,_0x49aca6){return function(_0x358538){if(_0x358538){var _0x3c3610=typeof _0x49aca6['offset']===_0xe80d('0x1f')&&typeof _0x49aca6['limit']==='undefined';var _0x2a91ea=_0x358538['count'];var _0x2cb14e=_0x3c3610?0x0:_0x49aca6[_0xe80d('0x20')];var _0x397ad3=_0x3c3610?_0x358538[_0xe80d('0x21')]:_0x49aca6['offset']+_0x49aca6[_0xe80d('0x22')];var _0x5a22a0;if(_0x397ad3>=_0x2a91ea){_0x397ad3=_0x2a91ea;_0x5a22a0=0xc8;}else{_0x5a22a0=0xce;}_0x141d1b['status'](_0x5a22a0);return _0x141d1b[_0xe80d('0x23')](_0xe80d('0x24'),_0x2cb14e+'-'+_0x397ad3+'/'+_0x2a91ea)['json'](_0x358538);}return null;};}function patchUpdates(_0x159ab9){return function(_0x11f396){try{jsonpatch[_0xe80d('0x25')](_0x11f396,_0x159ab9,!![]);}catch(_0x56ee1e){return BPromise[_0xe80d('0x26')](_0x56ee1e);}return _0x11f396['save']();};}function saveUpdates(_0x3fa3f5,_0x163e93){return function(_0x2cd947){if(_0x2cd947){return _0x2cd947[_0xe80d('0x27')](_0x3fa3f5)[_0xe80d('0x28')](function(_0x11f207){return _0x11f207;});}return null;};}function removeEntity(_0x5460ed,_0x28f2d8){return function(_0x48c012){if(_0x48c012){return _0x48c012[_0xe80d('0x29')]()[_0xe80d('0x28')](function(){_0x5460ed[_0xe80d('0x1d')](0xcc)[_0xe80d('0x2a')]();});}};}function handleEntityNotFound(_0x236960,_0xb3abf3){return function(_0x13b38f){if(!_0x13b38f){_0x236960[_0xe80d('0x2b')](0x194);}return _0x13b38f;};}function handleError(_0x4e62c9,_0x2e3e2e){_0x2e3e2e=_0x2e3e2e||0x1f4;return function(_0x12c063){logger['error'](_0x12c063[_0xe80d('0x2c')]);if(_0x12c063[_0xe80d('0x2d')]){delete _0x12c063[_0xe80d('0x2d')];}_0x4e62c9[_0xe80d('0x1d')](_0x2e3e2e)['send'](_0x12c063);};}exports[_0xe80d('0x2e')]=function(_0x301b65,_0x13ddb1){var _0x2c4e79={},_0x4f0bab={},_0x12e827={'count':0x0,'rows':[]};var _0x4758b2=_[_0xe80d('0x2f')](db[_0xe80d('0x30')][_0xe80d('0x31')],function(_0x44a7ce){return{'name':_0x44a7ce['fieldName'],'type':_0x44a7ce[_0xe80d('0x32')]['key']};});_0x4f0bab['model']=_[_0xe80d('0x2f')](_0x4758b2,_0xe80d('0x2d'));_0x4f0bab[_0xe80d('0x33')]=_['keys'](_0x301b65[_0xe80d('0x33')]);_0x4f0bab[_0xe80d('0x34')]=_[_0xe80d('0x35')](_0x4f0bab['model'],_0x4f0bab['query']);_0x2c4e79[_0xe80d('0x36')]=_[_0xe80d('0x35')](_0x4f0bab[_0xe80d('0x37')],qs[_0xe80d('0x38')](_0x301b65[_0xe80d('0x33')][_0xe80d('0x38')]));_0x2c4e79[_0xe80d('0x36')]=_0x2c4e79['attributes'][_0xe80d('0x39')]?_0x2c4e79[_0xe80d('0x36')]:_0x4f0bab[_0xe80d('0x37')];if(!_0x301b65[_0xe80d('0x33')][_0xe80d('0x3a')](_0xe80d('0x3b'))){_0x2c4e79['limit']=qs['limit'](_0x301b65[_0xe80d('0x33')][_0xe80d('0x22')]);_0x2c4e79[_0xe80d('0x20')]=qs[_0xe80d('0x20')](_0x301b65['query'][_0xe80d('0x20')]);}_0x2c4e79[_0xe80d('0x3c')]=qs[_0xe80d('0x3d')](_0x301b65[_0xe80d('0x33')][_0xe80d('0x3d')]);_0x2c4e79[_0xe80d('0x3e')]=qs[_0xe80d('0x34')](_['pick'](_0x301b65[_0xe80d('0x33')],_0x4f0bab[_0xe80d('0x34')]),_0x4758b2);if(_0x301b65[_0xe80d('0x33')]['filter']){_0x2c4e79[_0xe80d('0x3e')]=_[_0xe80d('0x3f')](_0x2c4e79[_0xe80d('0x3e')],{'$or':_[_0xe80d('0x2f')](_0x4758b2,function(_0x2c5fd8){if(_0x2c5fd8['type']!==_0xe80d('0x40')){var _0x21612e={};_0x21612e[_0x2c5fd8[_0xe80d('0x2d')]]={'$like':'%'+_0x301b65['query']['filter']+'%'};return _0x21612e;}})});}_0x2c4e79=_['merge']({},_0x2c4e79,_0x301b65[_0xe80d('0x41')]);var _0x21e30b={'where':_0x2c4e79[_0xe80d('0x3e')]};return db['ChatTransferReport']['count'](_0x21e30b)[_0xe80d('0x28')](function(_0x17544f){_0x12e827[_0xe80d('0x21')]=_0x17544f;if(_0x301b65[_0xe80d('0x33')]['includeAll']){_0x2c4e79[_0xe80d('0x42')]=[{'all':!![]}];}return db[_0xe80d('0x30')][_0xe80d('0x43')](_0x2c4e79);})[_0xe80d('0x28')](function(_0x1a67af){_0x12e827['rows']=_0x1a67af;return _0x12e827;})[_0xe80d('0x28')](respondWithFilteredResult(_0x13ddb1,_0x2c4e79))['catch'](handleError(_0x13ddb1,null));};exports['show']=function(_0xa6eab3,_0x5da828){var _0x5b1d47={'raw':!![],'where':{'id':_0xa6eab3[_0xe80d('0x44')]['id']}},_0x3c6c59={};_0x3c6c59[_0xe80d('0x37')]=_[_0xe80d('0x45')](db[_0xe80d('0x30')][_0xe80d('0x31')]);_0x3c6c59['query']=_[_0xe80d('0x45')](_0xa6eab3[_0xe80d('0x33')]);_0x3c6c59[_0xe80d('0x34')]=_[_0xe80d('0x35')](_0x3c6c59['model'],_0x3c6c59[_0xe80d('0x33')]);_0x5b1d47[_0xe80d('0x36')]=_['intersection'](_0x3c6c59[_0xe80d('0x37')],qs[_0xe80d('0x38')](_0xa6eab3['query'][_0xe80d('0x38')]));_0x5b1d47[_0xe80d('0x36')]=_0x5b1d47['attributes']['length']?_0x5b1d47[_0xe80d('0x36')]:_0x3c6c59['model'];if(_0xa6eab3[_0xe80d('0x33')][_0xe80d('0x46')]){_0x5b1d47[_0xe80d('0x42')]=[{'all':!![]}];}_0x5b1d47=_[_0xe80d('0x3f')]({},_0x5b1d47,_0xa6eab3['options']);return db[_0xe80d('0x30')]['find'](_0x5b1d47)[_0xe80d('0x28')](handleEntityNotFound(_0x5da828,null))[_0xe80d('0x28')](respondWithResult(_0x5da828,null))['catch'](handleError(_0x5da828,null));};exports[_0xe80d('0x47')]=function(_0x4c3760,_0x2b988b){return db[_0xe80d('0x30')][_0xe80d('0x47')](_0x4c3760[_0xe80d('0x48')],{})[_0xe80d('0x28')](respondWithResult(_0x2b988b,0xc9))[_0xe80d('0x49')](handleError(_0x2b988b,null));};exports[_0xe80d('0x27')]=function(_0x4d39cb,_0x1afc07){if(_0x4d39cb[_0xe80d('0x48')]['id']){delete _0x4d39cb[_0xe80d('0x48')]['id'];}return db[_0xe80d('0x30')][_0xe80d('0x4a')]({'where':{'id':_0x4d39cb[_0xe80d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1afc07,null))[_0xe80d('0x28')](saveUpdates(_0x4d39cb[_0xe80d('0x48')],null))[_0xe80d('0x28')](respondWithResult(_0x1afc07,null))[_0xe80d('0x49')](handleError(_0x1afc07,null));};exports[_0xe80d('0x29')]=function(_0x5f3f26,_0x1d48ba){return db[_0xe80d('0x30')][_0xe80d('0x4a')]({'where':{'id':_0x5f3f26[_0xe80d('0x44')]['id']}})[_0xe80d('0x28')](handleEntityNotFound(_0x1d48ba,null))[_0xe80d('0x28')](removeEntity(_0x1d48ba,null))['catch'](handleError(_0x1d48ba,null));};exports[_0xe80d('0x4b')]=function(_0x2a3165,_0x42985f){return db[_0xe80d('0x30')][_0xe80d('0x4b')]()[_0xe80d('0x28')](respondWithResult(_0x42985f,null))['catch'](handleError(_0x42985f,null));}; \ No newline at end of file +var _0x034e=['include','findAll','rows','catch','find','create','body','params','describe','eml-format','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','json','apply','reject','update','destroy','then','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x526b9f,_0x5c2efb){var _0xe8dd51=function(_0x2f0e1f){while(--_0x2f0e1f){_0x526b9f['push'](_0x526b9f['shift']());}};_0xe8dd51(++_0x5c2efb);}(_0x034e,0x16c));var _0xe034=function(_0x3277dc,_0x1a8604){_0x3277dc=_0x3277dc-0x0;var _0x68c39=_0x034e[_0x3277dc];return _0x68c39;};'use strict';var emlformat=require(_0xe034('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe034('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe034('0x2'));var util=require(_0xe034('0x3'));var path=require(_0xe034('0x4'));var sox=require(_0xe034('0x5'));var csv=require('to-csv');var ejs=require(_0xe034('0x6'));var fs=require('fs');var fs_extra=require(_0xe034('0x7'));var _=require(_0xe034('0x8'));var squel=require(_0xe034('0x9'));var crypto=require(_0xe034('0xa'));var jsforce=require(_0xe034('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe034('0xc'));var querystring=require(_0xe034('0xd'));var Papa=require('papaparse');var Redis=require(_0xe034('0xe'));var authService=require(_0xe034('0xf'));var qs=require(_0xe034('0x10'));var as=require(_0xe034('0x11'));var hardwareService=require(_0xe034('0x12'));var logger=require(_0xe034('0x13'))(_0xe034('0x14'));var utils=require('../../config/utils');var config=require(_0xe034('0x15'));var licenseUtil=require(_0xe034('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x411bc9,_0x428d27){_0x428d27=_0x428d27||0xcc;return function(_0x347d1f){if(_0x347d1f){return _0x411bc9[_0xe034('0x17')](_0x428d27);}return _0x411bc9[_0xe034('0x18')](_0x428d27)[_0xe034('0x19')]();};}function respondWithResult(_0x5d0f07,_0x3ac78a){_0x3ac78a=_0x3ac78a||0xc8;return function(_0x5a60e){if(_0x5a60e){return _0x5d0f07[_0xe034('0x18')](_0x3ac78a)['json'](_0x5a60e);}};}function respondWithFilteredResult(_0x33c3a1,_0x3a85d5){return function(_0x359132){if(_0x359132){var _0x1b728a=typeof _0x3a85d5['offset']==='undefined'&&typeof _0x3a85d5[_0xe034('0x1a')]===_0xe034('0x1b');var _0x1cb7da=_0x359132[_0xe034('0x1c')];var _0x14f8f5=_0x1b728a?0x0:_0x3a85d5['offset'];var _0x3b0ee7=_0x1b728a?_0x359132[_0xe034('0x1c')]:_0x3a85d5[_0xe034('0x1d')]+_0x3a85d5['limit'];var _0x2481f9;if(_0x3b0ee7>=_0x1cb7da){_0x3b0ee7=_0x1cb7da;_0x2481f9=0xc8;}else{_0x2481f9=0xce;}_0x33c3a1[_0xe034('0x18')](_0x2481f9);return _0x33c3a1['set']('Content-Range',_0x14f8f5+'-'+_0x3b0ee7+'/'+_0x1cb7da)[_0xe034('0x1e')](_0x359132);}return null;};}function patchUpdates(_0x2e53e6){return function(_0x5a3e88){try{jsonpatch[_0xe034('0x1f')](_0x5a3e88,_0x2e53e6,!![]);}catch(_0xf2d3d4){return BPromise[_0xe034('0x20')](_0xf2d3d4);}return _0x5a3e88['save']();};}function saveUpdates(_0x23df40,_0x497580){return function(_0x59baef){if(_0x59baef){return _0x59baef[_0xe034('0x21')](_0x23df40)['then'](function(_0x3cfe4e){return _0x3cfe4e;});}return null;};}function removeEntity(_0x500098,_0x5d16b6){return function(_0x1a1102){if(_0x1a1102){return _0x1a1102[_0xe034('0x22')]()[_0xe034('0x23')](function(){_0x500098[_0xe034('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3356e,_0x14689a){return function(_0x3b86af){if(!_0x3b86af){_0x3356e[_0xe034('0x17')](0x194);}return _0x3b86af;};}function handleError(_0x453627,_0x3cd0cb){_0x3cd0cb=_0x3cd0cb||0x1f4;return function(_0x2814ad){logger[_0xe034('0x24')](_0x2814ad['stack']);if(_0x2814ad[_0xe034('0x25')]){delete _0x2814ad[_0xe034('0x25')];}_0x453627[_0xe034('0x18')](_0x3cd0cb)[_0xe034('0x26')](_0x2814ad);};}exports[_0xe034('0x27')]=function(_0x45288e,_0x41f136){var _0x60c2ed={},_0x6b6026={},_0x503f0f={'count':0x0,'rows':[]};var _0xd0d01f=_[_0xe034('0x28')](db[_0xe034('0x29')][_0xe034('0x2a')],function(_0x4ab0a3){return{'name':_0x4ab0a3[_0xe034('0x2b')],'type':_0x4ab0a3[_0xe034('0x2c')][_0xe034('0x2d')]};});_0x6b6026[_0xe034('0x2e')]=_[_0xe034('0x28')](_0xd0d01f,_0xe034('0x25'));_0x6b6026['query']=_[_0xe034('0x2f')](_0x45288e[_0xe034('0x30')]);_0x6b6026['filters']=_[_0xe034('0x31')](_0x6b6026[_0xe034('0x2e')],_0x6b6026['query']);_0x60c2ed[_0xe034('0x32')]=_[_0xe034('0x31')](_0x6b6026['model'],qs[_0xe034('0x33')](_0x45288e['query'][_0xe034('0x33')]));_0x60c2ed[_0xe034('0x32')]=_0x60c2ed['attributes'][_0xe034('0x34')]?_0x60c2ed[_0xe034('0x32')]:_0x6b6026[_0xe034('0x2e')];if(!_0x45288e[_0xe034('0x30')]['hasOwnProperty']('nolimit')){_0x60c2ed[_0xe034('0x1a')]=qs[_0xe034('0x1a')](_0x45288e[_0xe034('0x30')]['limit']);_0x60c2ed[_0xe034('0x1d')]=qs[_0xe034('0x1d')](_0x45288e[_0xe034('0x30')][_0xe034('0x1d')]);}_0x60c2ed['order']=qs[_0xe034('0x35')](_0x45288e[_0xe034('0x30')][_0xe034('0x35')]);_0x60c2ed['where']=qs[_0xe034('0x36')](_[_0xe034('0x37')](_0x45288e[_0xe034('0x30')],_0x6b6026[_0xe034('0x36')]),_0xd0d01f);if(_0x45288e['query'][_0xe034('0x38')]){_0x60c2ed[_0xe034('0x39')]=_[_0xe034('0x3a')](_0x60c2ed[_0xe034('0x39')],{'$or':_[_0xe034('0x28')](_0xd0d01f,function(_0x7abefb){if(_0x7abefb[_0xe034('0x2c')]!==_0xe034('0x3b')){var _0x1e5d60={};_0x1e5d60[_0x7abefb[_0xe034('0x25')]]={'$like':'%'+_0x45288e[_0xe034('0x30')]['filter']+'%'};return _0x1e5d60;}})});}_0x60c2ed=_['merge']({},_0x60c2ed,_0x45288e[_0xe034('0x3c')]);var _0x507ce6={'where':_0x60c2ed[_0xe034('0x39')]};return db['ChatTransferReport'][_0xe034('0x1c')](_0x507ce6)[_0xe034('0x23')](function(_0x255c5c){_0x503f0f['count']=_0x255c5c;if(_0x45288e[_0xe034('0x30')][_0xe034('0x3d')]){_0x60c2ed[_0xe034('0x3e')]=[{'all':!![]}];}return db[_0xe034('0x29')][_0xe034('0x3f')](_0x60c2ed);})[_0xe034('0x23')](function(_0x2ad97b){_0x503f0f[_0xe034('0x40')]=_0x2ad97b;return _0x503f0f;})[_0xe034('0x23')](respondWithFilteredResult(_0x41f136,_0x60c2ed))[_0xe034('0x41')](handleError(_0x41f136,null));};exports['show']=function(_0xd7f0c0,_0x46ffb7){var _0x378026={'raw':!![],'where':{'id':_0xd7f0c0['params']['id']}},_0x1f3d78={};_0x1f3d78['model']=_[_0xe034('0x2f')](db['ChatTransferReport']['rawAttributes']);_0x1f3d78[_0xe034('0x30')]=_[_0xe034('0x2f')](_0xd7f0c0[_0xe034('0x30')]);_0x1f3d78[_0xe034('0x36')]=_['intersection'](_0x1f3d78[_0xe034('0x2e')],_0x1f3d78[_0xe034('0x30')]);_0x378026[_0xe034('0x32')]=_[_0xe034('0x31')](_0x1f3d78[_0xe034('0x2e')],qs[_0xe034('0x33')](_0xd7f0c0[_0xe034('0x30')][_0xe034('0x33')]));_0x378026['attributes']=_0x378026[_0xe034('0x32')]['length']?_0x378026[_0xe034('0x32')]:_0x1f3d78['model'];if(_0xd7f0c0[_0xe034('0x30')][_0xe034('0x3d')]){_0x378026[_0xe034('0x3e')]=[{'all':!![]}];}_0x378026=_[_0xe034('0x3a')]({},_0x378026,_0xd7f0c0['options']);return db[_0xe034('0x29')][_0xe034('0x42')](_0x378026)[_0xe034('0x23')](handleEntityNotFound(_0x46ffb7,null))[_0xe034('0x23')](respondWithResult(_0x46ffb7,null))[_0xe034('0x41')](handleError(_0x46ffb7,null));};exports[_0xe034('0x43')]=function(_0x33d162,_0x19b6a3){return db[_0xe034('0x29')]['create'](_0x33d162['body'],{})[_0xe034('0x23')](respondWithResult(_0x19b6a3,0xc9))['catch'](handleError(_0x19b6a3,null));};exports[_0xe034('0x21')]=function(_0x318ec0,_0x55c770){if(_0x318ec0[_0xe034('0x44')]['id']){delete _0x318ec0[_0xe034('0x44')]['id'];}return db['ChatTransferReport'][_0xe034('0x42')]({'where':{'id':_0x318ec0[_0xe034('0x45')]['id']}})[_0xe034('0x23')](handleEntityNotFound(_0x55c770,null))['then'](saveUpdates(_0x318ec0[_0xe034('0x44')],null))[_0xe034('0x23')](respondWithResult(_0x55c770,null))[_0xe034('0x41')](handleError(_0x55c770,null));};exports[_0xe034('0x22')]=function(_0x28f4ae,_0xe3105e){return db[_0xe034('0x29')][_0xe034('0x42')]({'where':{'id':_0x28f4ae[_0xe034('0x45')]['id']}})['then'](handleEntityNotFound(_0xe3105e,null))[_0xe034('0x23')](removeEntity(_0xe3105e,null))[_0xe034('0x41')](handleError(_0xe3105e,null));};exports[_0xe034('0x46')]=function(_0x519bb7,_0xea1d54){return db['ChatTransferReport'][_0xe034('0x46')]()['then'](respondWithResult(_0xea1d54,null))[_0xe034('0x41')](handleError(_0xea1d54,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 4f80982..896fc0d 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 _0xab73=['moment','bluebird','path','rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','api'];(function(_0x157c38,_0x192d07){var _0xea7e3a=function(_0x1631bb){while(--_0x1631bb){_0x157c38['push'](_0x157c38['shift']());}};_0xea7e3a(++_0x192d07);}(_0xab73,0xe4));var _0x3ab7=function(_0x3ba98d,_0xba1a74){_0x3ba98d=_0x3ba98d-0x0;var _0x3f90a1=_0xab73[_0x3ba98d];return _0x3f90a1;};'use strict';var _=require(_0x3ab7('0x0'));var util=require(_0x3ab7('0x1'));var logger=require('../../config/logger')(_0x3ab7('0x2'));var moment=require(_0x3ab7('0x3'));var BPromise=require(_0x3ab7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab7('0x5'));var rimraf=require(_0x3ab7('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ab7('0x7'));module[_0x3ab7('0x8')]=function(_0x4d0433,_0x40d39f){return _0x4d0433['define'](_0x3ab7('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3ab7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12dd=['ChatTransferReport','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x12dd,0x65));var _0xd12d=function(_0x2b92d2,_0x4e8ded){_0x2b92d2=_0x2b92d2-0x0;var _0x133446=_0x12dd[_0x2b92d2];return _0x133446;};'use strict';var _=require(_0xd12d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd12d('0x1'));var moment=require('moment');var BPromise=require(_0xd12d('0x2'));var rp=require(_0xd12d('0x3'));var fs=require('fs');var path=require(_0xd12d('0x4'));var rimraf=require(_0xd12d('0x5'));var config=require(_0xd12d('0x6'));var attributes=require(_0xd12d('0x7'));module['exports']=function(_0x5d1637,_0x2058d5){return _0x5d1637[_0xd12d('0x8')](_0xd12d('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd12d('0xa'),'fields':[_0xd12d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 57d24d9..bdff5a6 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 _0x66ba=['jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2189ba,_0x4e74f7){var _0x18d3ae=function(_0x19d088){while(--_0x19d088){_0x2189ba['push'](_0x2189ba['shift']());}};_0x18d3ae(++_0x4e74f7);}(_0x66ba,0xbf));var _0xa66b=function(_0x47a03a,_0x1367f9){_0x47a03a=_0x47a03a-0x0;var _0x4aa157=_0x66ba[_0x47a03a];return _0x4aa157;};'use strict';var _=require('lodash');var util=require(_0xa66b('0x0'));var moment=require('moment');var BPromise=require(_0xa66b('0x1'));var rs=require(_0xa66b('0x2'));var fs=require('fs');var Redis=require(_0xa66b('0x3'));var db=require(_0xa66b('0x4'))['db'];var utils=require(_0xa66b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa66b('0x6'));var jayson=require(_0xa66b('0x7'));var client=jayson['client'][_0xa66b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e5db6,_0x578f75,_0x542484){return new BPromise(function(_0x132dd1,_0x5df9ad){return client[_0xa66b('0x9')](_0x4e5db6,_0x542484)[_0xa66b('0xa')](function(_0x4874f8){logger['info'](_0xa66b('0xb'),_0x578f75,'request\x20sent');logger[_0xa66b('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x578f75,_0xa66b('0xd'),JSON['stringify'](_0x4874f8));if(_0x4874f8[_0xa66b('0xe')]){if(_0x4874f8['error']['code']===0x1f4){logger[_0xa66b('0xe')](_0xa66b('0xb'),_0x578f75,_0x4874f8['error'][_0xa66b('0xf')]);return _0x5df9ad(_0x4874f8[_0xa66b('0xe')][_0xa66b('0xf')]);}logger[_0xa66b('0xe')](_0xa66b('0xb'),_0x578f75,_0x4874f8['error']['message']);return _0x132dd1(_0x4874f8[_0xa66b('0xe')][_0xa66b('0xf')]);}else{logger[_0xa66b('0x10')](_0xa66b('0xb'),_0x578f75,_0xa66b('0xd'));_0x132dd1(_0x4874f8['result']['message']);}})[_0xa66b('0x11')](function(_0x51075c){logger[_0xa66b('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x578f75,_0x51075c);_0x5df9ad(_0x51075c);});});} \ No newline at end of file +var _0x9b72=['error','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x453b90,_0x57cacd){var _0x14f996=function(_0x29f16d){while(--_0x29f16d){_0x453b90['push'](_0x453b90['shift']());}};_0x14f996(++_0x57cacd);}(_0x9b72,0xe8));var _0x29b7=function(_0xfca82a,_0x44cd04){_0xfca82a=_0xfca82a-0x0;var _0x4aa91d=_0x9b72[_0xfca82a];return _0x4aa91d;};'use strict';var _=require(_0x29b7('0x0'));var util=require(_0x29b7('0x1'));var moment=require('moment');var BPromise=require(_0x29b7('0x2'));var rs=require(_0x29b7('0x3'));var fs=require('fs');var Redis=require(_0x29b7('0x4'));var db=require(_0x29b7('0x5'))['db'];var utils=require(_0x29b7('0x6'));var logger=require(_0x29b7('0x7'))('rpc');var config=require(_0x29b7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x29b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x282317,_0x48bcc1,_0x3069c0){return new BPromise(function(_0x302d10,_0x2a4c4f){return client['request'](_0x282317,_0x3069c0)[_0x29b7('0xa')](function(_0xa1ca03){logger[_0x29b7('0xb')](_0x29b7('0xc'),_0x48bcc1,'request\x20sent');logger[_0x29b7('0xd')](_0x29b7('0xe'),_0x48bcc1,'request\x20sent',JSON['stringify'](_0xa1ca03));if(_0xa1ca03[_0x29b7('0xf')]){if(_0xa1ca03['error']['code']===0x1f4){logger[_0x29b7('0xf')](_0x29b7('0xc'),_0x48bcc1,_0xa1ca03[_0x29b7('0xf')]['message']);return _0x2a4c4f(_0xa1ca03[_0x29b7('0xf')][_0x29b7('0x10')]);}logger[_0x29b7('0xf')](_0x29b7('0xc'),_0x48bcc1,_0xa1ca03[_0x29b7('0xf')]['message']);return _0x302d10(_0xa1ca03[_0x29b7('0xf')][_0x29b7('0x10')]);}else{logger['info'](_0x29b7('0xc'),_0x48bcc1,_0x29b7('0x11'));_0x302d10(_0xa1ca03[_0x29b7('0x12')][_0x29b7('0x10')]);}})['catch'](function(_0x930a20){logger[_0x29b7('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x48bcc1,_0x930a20);_0x2a4c4f(_0x930a20);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 13cc752..b34980c 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 _0x90bd=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0x90bd,0x1db));var _0xd90b=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x90bd[_0x12d951];return _0x44de17;};'use strict';var multer=require('multer');var util=require(_0xd90b('0x0'));var path=require(_0xd90b('0x1'));var timeout=require(_0xd90b('0x2'));var express=require(_0xd90b('0x3'));var router=express[_0xd90b('0x4')]();var fs_extra=require(_0xd90b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd90b('0x6'));var config=require(_0xd90b('0x7'));var controller=require('./chatTransferReport.controller');router[_0xd90b('0x8')]('/',auth[_0xd90b('0x9')](),controller[_0xd90b('0xa')]);router[_0xd90b('0x8')](_0xd90b('0xb'),auth[_0xd90b('0x9')](),controller['describe']);router[_0xd90b('0x8')](_0xd90b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd90b('0xd')]('/',auth['isAuthenticated'](),controller[_0xd90b('0xe')]);router[_0xd90b('0xf')](_0xd90b('0xc'),auth[_0xd90b('0x9')](),controller[_0xd90b('0x10')]);router[_0xd90b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd90b('0x12')]);module[_0xd90b('0x13')]=router; \ No newline at end of file +var _0xbedb=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x26a84c,_0x5724a7){var _0xa7793f=function(_0x34b8e2){while(--_0x34b8e2){_0x26a84c['push'](_0x26a84c['shift']());}};_0xa7793f(++_0x5724a7);}(_0xbedb,0x105));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbbed('0x0'));var util=require(_0xbbed('0x1'));var path=require('path');var timeout=require(_0xbbed('0x2'));var express=require('express');var router=express[_0xbbed('0x3')]();var fs_extra=require(_0xbbed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbbed('0x5'));var config=require(_0xbbed('0x6'));var controller=require(_0xbbed('0x7'));router['get']('/',auth[_0xbbed('0x8')](),controller[_0xbbed('0x9')]);router[_0xbbed('0xa')](_0xbbed('0xb'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xc')]);router[_0xbbed('0xa')](_0xbbed('0xd'),auth[_0xbbed('0x8')](),controller[_0xbbed('0xe')]);router[_0xbbed('0xf')]('/',auth[_0xbbed('0x8')](),controller[_0xbbed('0x10')]);router[_0xbbed('0x11')](_0xbbed('0xd'),auth[_0xbbed('0x8')](),controller[_0xbbed('0x12')]);router[_0xbbed('0x13')](_0xbbed('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xbbed('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 3594532..2d21397 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 _0x99e9=['System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x413c57,_0x14d136){var _0x31a8bf=function(_0x58eb49){while(--_0x58eb49){_0x413c57['push'](_0x413c57['shift']());}};_0x31a8bf(++_0x14d136);}(_0x99e9,0xb4));var _0x999e=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x99e9[_0x191f9d];return _0x58e60d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x999e('0x0'));module[_0x999e('0x1')]={'name':{'type':Sequelize[_0x999e('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x999e('0x2')]},'mapKey':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x4')},'customerAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x999e('0x2')]},'animation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x999e('0x9')](_0x999e('0xa'),_0x999e('0xb')),'defaultValue':_0x999e('0xa')},'header_online':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xc')},'start_chat_button':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0xf')},'download_transcript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x999e('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x13')},'noteTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x15')},'closingMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'skipMessageButton':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'conditionAgreement':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0x999e('0x18'),_0x999e('0x19')),'defaultValue':_0x999e('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0x999e('0x1c'),'helpText':''}},{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':_0x999e('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x999e('0x1d')](_0x999e('0x1e'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')]('onlineForm')):{};},'set':function(_0x2e1cc5){return this[_0x999e('0x20')](_0x999e('0x1e'),JSON[_0x999e('0x1a')](_0x2e1cc5));}},'offlineForm':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return JSON[_0x999e('0x1a')]({'items':[{'type':_0x999e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x999e('0x3'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x999e('0x21')},'props':{'title':_0x999e('0x21'),'helpText':_0x999e('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x999e('0x23'))?JSON[_0x999e('0x1f')](this[_0x999e('0x1d')](_0x999e('0x23'))):{};},'set':function(_0x15dca1){return this[_0x999e('0x20')](_0x999e('0x23'),JSON[_0x999e('0x1a')](_0x15dca1));}},'token':{'type':Sequelize[_0x999e('0x2')],'defaultValue':function(){return rs[_0x999e('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x999e('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x999e('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x16')},'sendUnmanaged':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x999e('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x999e('0x2')]},'notificationTemplate':{'type':Sequelize[_0x999e('0x11')],'defaultValue':function(){return _0x999e('0x27');}},'notificationSound':{'type':Sequelize[_0x999e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x999e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x999e('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x999e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x999e('0x2')],'defaultValue':_0x999e('0x28')},'systemAvatar':{'type':Sequelize[_0x999e('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x999e('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'comment':_0x999e('0x29'),'set':function(_0x1e1229){if(!_0x1e1229)this[_0x999e('0x20')]('mandatoryDispositionPauseId',null);this[_0x999e('0x20')]('mandatoryDisposition',_0x1e1229);}},'vidaooEscalation':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x999e('0x2')]},'vidaooTopic':{'type':Sequelize[_0x999e('0x2')],'allowNull':![],'defaultValue':_0x999e('0x2a')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x999e('0x2b');}},'vidaooMetadata':{'type':Sequelize[_0x999e('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x999e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x54ef=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x3cef4a,_0x29891c){var _0x348a0d=function(_0x3d64bf){while(--_0x3d64bf){_0x3cef4a['push'](_0x3cef4a['shift']());}};_0x348a0d(++_0x29891c);}(_0x54ef,0x112));var _0xf54e=function(_0x6f6600,_0x2c18d4){_0x6f6600=_0x6f6600-0x0;var _0x325b47=_0x54ef[_0x6f6600];return _0x325b47;};'use strict';var Sequelize=require(_0xf54e('0x0'));var rs=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xf54e('0x3')],'allowNull':![],'unique':_0xf54e('0x4')},'description':{'type':Sequelize[_0xf54e('0x3')]},'mapKey':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x5')},'mapKeyOffline':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf54e('0x6')},'customerAlias':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf54e('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf54e('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf54e('0x3')],'allowNull':![],'defaultValue':_0xf54e('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf54e('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf54e('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf54e('0x3')]},'animation':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xf54e('0xa'),_0xf54e('0xb')),'defaultValue':_0xf54e('0xa')},'header_online':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf54e('0xc')},'header_offline':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0xd')},'download_transcript':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf54e('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xf54e('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x11')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x12')},'placeholderMessage':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x13')},'closingMessage':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x14')},'closingMessageButton':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0xc')},'skipMessageButton':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x15')},'conditionAgreement':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf54e('0x16')},'ratingType':{'type':Sequelize[_0xf54e('0x17')](_0xf54e('0x18'),_0xf54e('0x19')),'defaultValue':_0xf54e('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf54e('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf54e('0xf')],'defaultValue':function(){return JSON[_0xf54e('0x1a')]({'items':[{'type':_0xf54e('0x1b'),'variable':null,'config':{'placeholder':_0xf54e('0x1c'),'type':_0xf54e('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xf54e('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf54e('0x5'),'type':_0xf54e('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf54e('0x1e')](_0xf54e('0x1f'))?JSON[_0xf54e('0x20')](this[_0xf54e('0x1e')](_0xf54e('0x1f'))):{};},'set':function(_0x43488d){return this[_0xf54e('0x21')](_0xf54e('0x1f'),JSON[_0xf54e('0x1a')](_0x43488d));}},'offlineForm':{'type':Sequelize[_0xf54e('0xf')],'defaultValue':function(){return JSON[_0xf54e('0x1a')]({'items':[{'type':'input','props':{'title':_0xf54e('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf54e('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf54e('0x22')},'props':{'title':_0xf54e('0x22'),'helpText':_0xf54e('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xf54e('0x1e')](_0xf54e('0x24'))?JSON[_0xf54e('0x20')](this[_0xf54e('0x1e')]('offlineForm')):{};},'set':function(_0x4b3c73){return this[_0xf54e('0x21')](_0xf54e('0x24'),JSON[_0xf54e('0x1a')](_0x4b3c73));}},'token':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':function(){return rs[_0xf54e('0x25')]();}},'autoclose':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf54e('0x3')]},'forwardOffline':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf54e('0x26')},'waitingMessage':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x27')},'offlineMessageBody':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x15')},'sendUnmanaged':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf54e('0xf')],'defaultValue':function(){return _0xf54e('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x2c')},'messagesAlignment':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x2d')},'defaultTitle':{'type':Sequelize[_0xf54e('0x3')]},'customerAvatar':{'type':Sequelize[_0xf54e('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf54e('0x3')],'allowNull':![],'defaultValue':_0xf54e('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf54e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':_0xf54e('0x2f')},'systemAvatar':{'type':Sequelize[_0xf54e('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf54e('0x8')],'comment':_0xf54e('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![],'comment':_0xf54e('0x31'),'set':function(_0x2087b3){if(!_0x2087b3)this[_0xf54e('0x21')](_0xf54e('0x32'),null);this[_0xf54e('0x21')](_0xf54e('0x33'),_0x2087b3);}},'vidaooEscalation':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xf54e('0x3')],'defaultValue':function(){return _0xf54e('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf54e('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf54e('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 65c43b5..c878a7d 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 _0x3763=['interval','format','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','increment','chatLicenseExceeded','remote','connection','remoteAddress','virtual','replace','render','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','online','false','offlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','ChatWebsite','findAll','catch','show','params','options','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','ChatApplication','Applications','account','list','orderBy','applications','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','firstName','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','email','Smtp','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s'];(function(_0x27ab99,_0x5a6d79){var _0x1e66c2=function(_0x8d4dc9){while(--_0x8d4dc9){_0x27ab99['push'](_0x27ab99['shift']());}};_0x1e66c2(++_0x5a6d79);}(_0x3763,0x15c));var _0x3376=function(_0x32f657,_0x3bcd12){_0x32f657=_0x32f657-0x0;var _0x2dd60e=_0x3763[_0x32f657];return _0x2dd60e;};'use strict';var BPromise=require(_0x3376('0x0'));var Mustache=require('mustache');var util=require(_0x3376('0x1'));var path=require('path');var ejs=require(_0x3376('0x2'));var fs=require('fs');var fs_extra=require(_0x3376('0x3'));var _=require(_0x3376('0x4'));var querystring=require(_0x3376('0x5'));var Redis=require(_0x3376('0x6'));var qs=require(_0x3376('0x7'));var logger=require(_0x3376('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3376('0x9')]=_[_0x3376('0xa')](config[_0x3376('0x9')],{'host':_0x3376('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3376('0x9')]));require(_0x3376('0xc'))[_0x3376('0xd')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x3376('0xe'));var client=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232c});var client9002=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232a});var client9003=jayson[_0x3376('0xf')][_0x3376('0x10')]({'port':0x232b});var client9001=jayson['client'][_0x3376('0x10')]({'port':0x2329});function respondWithRpcPromise(_0xf8d7d6,_0x50b383,_0x21f536,_0x237d2f){return new BPromise(function(_0x1c0d43,_0x37c1ae){var _0x2f6a58=_0x237d2f||client;return _0x2f6a58[_0x3376('0x11')](_0xf8d7d6,_0x21f536)[_0x3376('0x12')](function(_0x16975b){logger['info'](_0x3376('0x13'),_0x50b383,_0x3376('0x14'));logger[_0x3376('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x50b383,'request\x20sent',JSON[_0x3376('0x16')](_0x16975b));if(_0x16975b[_0x3376('0x17')]){if(_0x16975b[_0x3376('0x17')][_0x3376('0x18')]===0x1f4){logger[_0x3376('0x17')](_0x3376('0x13'),_0x50b383,_0x16975b[_0x3376('0x17')]['message']);return _0x37c1ae(_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);}logger['error'](_0x3376('0x13'),_0x50b383,_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);return _0x1c0d43(_0x16975b[_0x3376('0x17')][_0x3376('0x19')]);}else{logger[_0x3376('0x1a')](_0x3376('0x13'),_0x50b383,_0x3376('0x14'));_0x1c0d43(_0x16975b['result']['message']);}})['catch'](function(_0x33516c){logger[_0x3376('0x17')](_0x3376('0x13'),_0x50b383,_0x33516c);_0x37c1ae(_0x33516c);});});}function respondWithStatusCode(_0x394df7,_0x21f067){_0x21f067=_0x21f067||0xcc;return function(_0x33ca11){if(_0x33ca11){return _0x394df7[_0x3376('0x1b')](_0x21f067);}return _0x394df7['status'](_0x21f067)[_0x3376('0x1c')]();};}function respondWithResult(_0x1db7d0,_0x4cf9b4){_0x4cf9b4=_0x4cf9b4||0xc8;return function(_0xae48a3){if(_0xae48a3){return _0x1db7d0[_0x3376('0x1d')](_0x4cf9b4)[_0x3376('0x1e')](_0xae48a3);}};}function respondWithFilteredResult(_0x3f063e,_0x4f16ec){return function(_0x42c8e1){if(_0x42c8e1){var _0xfc2667=typeof _0x4f16ec[_0x3376('0x1f')]===_0x3376('0x20')&&typeof _0x4f16ec[_0x3376('0x21')]===_0x3376('0x20');var _0x11e029=_0x42c8e1[_0x3376('0x22')];var _0x1c6edd=_0xfc2667?0x0:_0x4f16ec[_0x3376('0x1f')];var _0x21b315=_0xfc2667?_0x42c8e1[_0x3376('0x22')]:_0x4f16ec['offset']+_0x4f16ec[_0x3376('0x21')];var _0x430368;if(_0x21b315>=_0x11e029){_0x21b315=_0x11e029;_0x430368=0xc8;}else{_0x430368=0xce;}_0x3f063e[_0x3376('0x1d')](_0x430368);return _0x3f063e[_0x3376('0x23')](_0x3376('0x24'),_0x1c6edd+'-'+_0x21b315+'/'+_0x11e029)[_0x3376('0x1e')](_0x42c8e1);}return null;};}function saveUpdates(_0x189025){return function(_0x3fc936){if(_0x3fc936){return _0x3fc936[_0x3376('0x25')](_0x189025)['then'](function(_0x208b22){return _0x208b22;});}return null;};}function removeEntity(_0x36c2ef){return function(_0x4f29ab){if(_0x4f29ab){return _0x4f29ab[_0x3376('0x26')]()[_0x3376('0x12')](function(){var _0x4fa476=_0x4f29ab[_0x3376('0x27')]({'plain':!![]});var _0x257243=_0x3376('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x257243,'resourceId':_0x4fa476['id']}})[_0x3376('0x12')](function(){return _0x4f29ab;});})[_0x3376('0x12')](function(){_0x36c2ef['status'](0xcc)[_0x3376('0x1c')]();});}};}function handleEntityNotFound(_0x504810){return function(_0x12a9f4){if(!_0x12a9f4){_0x504810[_0x3376('0x1b')](0x194);}return _0x12a9f4;};}function handleError(_0x417c26,_0x3e30e0){_0x3e30e0=_0x3e30e0||0x1f4;return function(_0xb6ca47){logger[_0x3376('0x17')](_0xb6ca47[_0x3376('0x29')]);if(_0xb6ca47[_0x3376('0x2a')]){delete _0xb6ca47[_0x3376('0x2a')];}_0x417c26[_0x3376('0x1d')](_0x3e30e0)[_0x3376('0x2b')](_0xb6ca47);};}exports[_0x3376('0x2c')]=function(_0x6c2aaf,_0x5dfc41){var _0x334020={'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]},_0x186669={},_0x11f2db={'count':0x0,'rows':[]};var _0x5b2227=_[_0x3376('0x2f')](db['ChatWebsite'][_0x3376('0x30')],function(_0x4ee9d0){return{'name':_0x4ee9d0[_0x3376('0x31')],'type':_0x4ee9d0['type'][_0x3376('0x32')]};});_0x186669[_0x3376('0x33')]=_[_0x3376('0x2f')](_0x5b2227,_0x3376('0x2a'));_0x186669[_0x3376('0x34')]=_[_0x3376('0x35')](_0x6c2aaf['query']);_0x186669[_0x3376('0x36')]=_[_0x3376('0x37')](_0x186669[_0x3376('0x33')],_0x186669[_0x3376('0x34')]);_0x334020['attributes']=_[_0x3376('0x37')](_0x186669[_0x3376('0x33')],qs[_0x3376('0x38')](_0x6c2aaf[_0x3376('0x34')][_0x3376('0x38')]));_0x334020[_0x3376('0x39')]=_0x334020[_0x3376('0x39')][_0x3376('0x3a')]?_0x334020['attributes']:_0x186669[_0x3376('0x33')];if(!_0x6c2aaf[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0x334020[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x6c2aaf[_0x3376('0x34')]['limit']);_0x334020[_0x3376('0x1f')]=qs['offset'](_0x6c2aaf[_0x3376('0x34')]['offset']);}_0x334020['order']=qs[_0x3376('0x3c')](_0x6c2aaf[_0x3376('0x34')][_0x3376('0x3c')]);_0x334020[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x6c2aaf[_0x3376('0x34')],_0x186669[_0x3376('0x36')]),_0x5b2227);if(_0x6c2aaf[_0x3376('0x34')]['filter']){_0x334020[_0x3376('0x3d')]=_['merge'](_0x334020['where'],{'$or':_['map'](_0x5b2227,function(_0x5e3c86){if(_0x5e3c86[_0x3376('0x3f')]!==_0x3376('0x40')){var _0xb30db4={};_0xb30db4[_0x5e3c86[_0x3376('0x2a')]]={'$like':'%'+_0x6c2aaf[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0xb30db4;}})});}_0x334020=_[_0x3376('0x42')]({},_0x334020,_0x6c2aaf['options']);var _0x174672={'where':_0x334020[_0x3376('0x3d')]};return db['ChatWebsite'][_0x3376('0x22')](_0x174672)[_0x3376('0x12')](function(_0x4bd641){_0x11f2db[_0x3376('0x22')]=_0x4bd641;if(_0x6c2aaf[_0x3376('0x34')][_0x3376('0x43')]){_0x334020[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x45')][_0x3376('0x46')](_0x334020);})[_0x3376('0x12')](function(_0x348560){_0x11f2db['rows']=_0x348560;return _0x11f2db;})[_0x3376('0x12')](respondWithFilteredResult(_0x5dfc41,_0x334020))[_0x3376('0x47')](handleError(_0x5dfc41,null));};exports[_0x3376('0x48')]=function(_0x558d6d,_0x13a955){var _0x42f276={'raw':![],'where':{'id':_0x558d6d[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]},_0x4fe462={};_0x4fe462[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x45')][_0x3376('0x30')]);_0x4fe462[_0x3376('0x34')]=_['keys'](_0x558d6d[_0x3376('0x34')]);_0x4fe462['filters']=_[_0x3376('0x37')](_0x4fe462[_0x3376('0x33')],_0x4fe462[_0x3376('0x34')]);_0x42f276[_0x3376('0x39')]=_['intersection'](_0x4fe462[_0x3376('0x33')],qs[_0x3376('0x38')](_0x558d6d[_0x3376('0x34')][_0x3376('0x38')]));_0x42f276[_0x3376('0x39')]=_0x42f276[_0x3376('0x39')][_0x3376('0x3a')]?_0x42f276[_0x3376('0x39')]:_0x4fe462[_0x3376('0x33')];if(_0x558d6d['query'][_0x3376('0x43')]){_0x42f276[_0x3376('0x44')]=[{'all':!![]}];}_0x42f276=_[_0x3376('0x42')]({},_0x42f276,_0x558d6d[_0x3376('0x4a')]);return db[_0x3376('0x45')][_0x3376('0x4b')](_0x42f276)[_0x3376('0x12')](handleEntityNotFound(_0x13a955,null))['then'](respondWithResult(_0x13a955,null))[_0x3376('0x47')](handleError(_0x13a955,null));};exports[_0x3376('0x4c')]=function(_0x57666b,_0x37076b){return db['ChatWebsite'][_0x3376('0x4c')](_0x57666b[_0x3376('0x4d')],{})['then'](function(_0xace4f9){var _0x2b1dfd=_0x57666b['user'][_0x3376('0x27')]({'plain':!![]});if(!_0x2b1dfd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b1dfd[_0x3376('0x4e')]===_0x3376('0x4f')){var _0x506783=_0xace4f9['get']({'plain':!![]});var _0x3bc66b=_0x3376('0x28');return db[_0x3376('0x50')]['find']({'where':{'name':_0x3bc66b,'userProfileId':_0x2b1dfd[_0x3376('0x51')]},'raw':!![]})['then'](function(_0x12cf51){if(_0x12cf51&&_0x12cf51['autoAssociation']===0x0){return db[_0x3376('0x52')][_0x3376('0x4c')]({'name':_0x506783[_0x3376('0x2a')],'resourceId':_0x506783['id'],'type':_0x12cf51[_0x3376('0x2a')],'sectionId':_0x12cf51['id']},{})[_0x3376('0x12')](function(){return _0xace4f9;});}else{return _0xace4f9;}})[_0x3376('0x47')](function(_0x56500b){logger[_0x3376('0x17')](_0x3376('0x53'),_0x56500b);throw _0x56500b;});}return _0xace4f9;})[_0x3376('0x12')](respondWithResult(_0x37076b,0xc9))['catch'](handleError(_0x37076b,null));};exports[_0x3376('0x25')]=function(_0x2f2157,_0x980f1b){if(_0x2f2157['body']['id']){delete _0x2f2157[_0x3376('0x4d')]['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2f2157['params']['id']},'include':[{'model':db[_0x3376('0x2d')],'as':_0x3376('0x2e')}]})[_0x3376('0x12')](handleEntityNotFound(_0x980f1b,null))[_0x3376('0x12')](saveUpdates(_0x2f2157[_0x3376('0x4d')],null))[_0x3376('0x12')](respondWithResult(_0x980f1b,null))['catch'](handleError(_0x980f1b,null));};exports[_0x3376('0x26')]=function(_0x4a9d6f,_0x4c44c7){return db['ChatWebsite'][_0x3376('0x4b')]({'where':{'id':_0x4a9d6f[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x4c44c7,null))[_0x3376('0x12')](removeEntity(_0x4c44c7,null))[_0x3376('0x47')](handleError(_0x4c44c7,null));};exports[_0x3376('0x54')]=function(_0x2bbbec,_0x145e00){return db[_0x3376('0x45')]['describe']()[_0x3376('0x12')](respondWithResult(_0x145e00,null))['catch'](handleError(_0x145e00,null));};exports[_0x3376('0x55')]=function(_0x38e4c5,_0x20dcac){if(_0x38e4c5['body']['id']){delete _0x38e4c5['body']['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x38e4c5[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x20dcac,null))[_0x3376('0x12')](function(_0x46176e){if(_0x46176e){_0x38e4c5[_0x3376('0x4d')][_0x3376('0x56')]=_0x46176e['id'];return db[_0x3376('0x57')][_0x3376('0x4c')](_0x38e4c5[_0x3376('0x4d')]);}})[_0x3376('0x12')](respondWithResult(_0x20dcac,null))[_0x3376('0x47')](handleError(_0x20dcac,null));};exports[_0x3376('0x58')]=function(_0xd053e4,_0x3aa529){var _0xa0bc6c={'raw':![],'where':{}};var _0x2a57bf={};var _0x1625b0={'count':0x0,'rows':[]};return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0xd053e4['params']['id']}})['then'](handleEntityNotFound(_0x3aa529,null))[_0x3376('0x12')](function(_0x18987a){if(_0x18987a){_0x2a57bf[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x57')][_0x3376('0x30')]);_0x2a57bf[_0x3376('0x34')]=_[_0x3376('0x35')](_0xd053e4['query']);_0x2a57bf[_0x3376('0x36')]=_[_0x3376('0x37')](_0x2a57bf[_0x3376('0x33')],_0x2a57bf[_0x3376('0x34')]);_0xa0bc6c[_0x3376('0x39')]=_[_0x3376('0x37')](_0x2a57bf[_0x3376('0x33')],qs[_0x3376('0x38')](_0xd053e4['query'][_0x3376('0x38')]));_0xa0bc6c[_0x3376('0x39')]=_0xa0bc6c[_0x3376('0x39')][_0x3376('0x3a')]?_0xa0bc6c['attributes']:_0x2a57bf[_0x3376('0x33')];if(!_0xd053e4[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0xa0bc6c['limit']=qs[_0x3376('0x21')](_0xd053e4[_0x3376('0x34')][_0x3376('0x21')]);_0xa0bc6c['offset']=qs[_0x3376('0x1f')](_0xd053e4[_0x3376('0x34')]['offset']);}_0xa0bc6c[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0xd053e4[_0x3376('0x34')][_0x3376('0x3c')]);_0xa0bc6c['where']=qs[_0x3376('0x36')](_['pick'](_0xd053e4[_0x3376('0x34')],_0x2a57bf[_0x3376('0x36')]));_0xa0bc6c[_0x3376('0x3d')][_0x3376('0x56')]=_0x18987a['id'];if(_0xd053e4[_0x3376('0x34')][_0x3376('0x41')]){_0xa0bc6c['where']=_['merge'](_0xa0bc6c[_0x3376('0x3d')],{'$or':_['map'](_0xa0bc6c[_0x3376('0x39')],function(_0x2d2505){var _0xb02b3e={};_0xb02b3e[_0x2d2505]={'$like':'%'+_0xd053e4[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0xb02b3e;})});}_0xa0bc6c=_[_0x3376('0x42')]({},_0xa0bc6c,_0xd053e4['options']);return db['Disposition'][_0x3376('0x22')]({'where':_0xa0bc6c[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0x2f6b60){_0x1625b0[_0x3376('0x22')]=_0x2f6b60;if(_0xd053e4[_0x3376('0x34')][_0x3376('0x43')]){_0xa0bc6c[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x57')][_0x3376('0x46')](_0xa0bc6c);})[_0x3376('0x12')](function(_0x26d183){_0x1625b0[_0x3376('0x5b')]=_0x26d183;return _0x1625b0;});}})[_0x3376('0x12')](respondWithFilteredResult(_0x3aa529,_0xa0bc6c))[_0x3376('0x47')](handleError(_0x3aa529,null));};exports[_0x3376('0x5c')]=function(_0x59e3a0,_0x1a6b59){return db['ChatWebsite'][_0x3376('0x4b')]({'where':{'id':_0x59e3a0[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x1a6b59,null))[_0x3376('0x12')](function(_0x3c3e7c){if(_0x3c3e7c){return _0x3c3e7c[_0x3376('0x5c')](_0x59e3a0[_0x3376('0x34')][_0x3376('0x5d')]);}})['then'](respondWithStatusCode(_0x1a6b59,null))[_0x3376('0x47')](handleError(_0x1a6b59,null));};exports[_0x3376('0x5e')]=function(_0x4cccc6,_0x7550df){if(_0x4cccc6[_0x3376('0x4d')]['id']){delete _0x4cccc6[_0x3376('0x4d')]['id'];}return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x4cccc6[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x7550df,null))[_0x3376('0x12')](function(_0xb2208d){if(_0xb2208d){_0x4cccc6[_0x3376('0x4d')][_0x3376('0x56')]=_0xb2208d['id'];return db['CannedAnswer'][_0x3376('0x4c')](_0x4cccc6[_0x3376('0x4d')]);}})['then'](respondWithResult(_0x7550df,null))['catch'](handleError(_0x7550df,null));};exports[_0x3376('0x5f')]=function(_0x520c18,_0x1151d1){var _0x5a502f={'raw':![],'where':{}};var _0x401670={};var _0xbf6dda={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3376('0x59')]({'where':{'id':_0x520c18['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x1151d1,null))[_0x3376('0x12')](function(_0x472cc2){if(_0x472cc2){_0x401670[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0x60')]['rawAttributes']);_0x401670[_0x3376('0x34')]=_[_0x3376('0x35')](_0x520c18['query']);_0x401670[_0x3376('0x36')]=_[_0x3376('0x37')](_0x401670[_0x3376('0x33')],_0x401670[_0x3376('0x34')]);_0x5a502f['attributes']=_[_0x3376('0x37')](_0x401670[_0x3376('0x33')],qs[_0x3376('0x38')](_0x520c18[_0x3376('0x34')][_0x3376('0x38')]));_0x5a502f[_0x3376('0x39')]=_0x5a502f['attributes']['length']?_0x5a502f[_0x3376('0x39')]:_0x401670[_0x3376('0x33')];if(!_0x520c18[_0x3376('0x34')][_0x3376('0x61')](_0x3376('0x3b'))){_0x5a502f['limit']=qs[_0x3376('0x21')](_0x520c18[_0x3376('0x34')][_0x3376('0x21')]);_0x5a502f['offset']=qs['offset'](_0x520c18[_0x3376('0x34')][_0x3376('0x1f')]);}_0x5a502f[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x520c18['query'][_0x3376('0x3c')]);_0x5a502f[_0x3376('0x3d')]=qs['filters'](_[_0x3376('0x3e')](_0x520c18[_0x3376('0x34')],_0x401670[_0x3376('0x36')]));_0x5a502f['where'][_0x3376('0x56')]=_0x472cc2['id'];if(_0x520c18[_0x3376('0x34')][_0x3376('0x41')]){_0x5a502f[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x5a502f[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x5a502f[_0x3376('0x39')],function(_0x1c2e43){var _0x252a3f={};_0x252a3f[_0x1c2e43]={'$like':'%'+_0x520c18[_0x3376('0x34')]['filter']+'%'};return _0x252a3f;})});}_0x5a502f=_[_0x3376('0x42')]({},_0x5a502f,_0x520c18[_0x3376('0x4a')]);return db['CannedAnswer']['count']({'where':_0x5a502f[_0x3376('0x3d')]})['then'](function(_0x2198b5){_0xbf6dda['count']=_0x2198b5;if(_0x520c18[_0x3376('0x34')][_0x3376('0x43')]){_0x5a502f[_0x3376('0x44')]=[{'all':!![]}];}return db[_0x3376('0x60')][_0x3376('0x46')](_0x5a502f);})[_0x3376('0x12')](function(_0x20c656){_0xbf6dda[_0x3376('0x5b')]=_0x20c656;return _0xbf6dda;});}})['then'](respondWithFilteredResult(_0x1151d1,_0x5a502f))[_0x3376('0x47')](handleError(_0x1151d1,null));};exports['removeAnswers']=function(_0x361128,_0x46efcb){return db[_0x3376('0x45')]['find']({'where':{'id':_0x361128[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x46efcb,null))['then'](function(_0x180405){if(_0x180405){return _0x180405[_0x3376('0x62')](_0x361128['query'][_0x3376('0x5d')]);}})[_0x3376('0x12')](respondWithStatusCode(_0x46efcb,null))[_0x3376('0x47')](handleError(_0x46efcb,null));};exports[_0x3376('0x63')]=function(_0x1e006f,_0x288af6){_0x1e006f[_0x3376('0x4d')][_0x3376('0x64')]=_0x1e006f[_0x3376('0x65')][_0x3376('0x66')];return db['ChatWebsite']['find']({'where':{'id':_0x1e006f[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x288af6,null))[_0x3376('0x12')](saveUpdates(_0x1e006f[_0x3376('0x4d')],null))['then'](respondWithResult(_0x288af6,null))['catch'](handleError(_0x288af6,null));};exports[_0x3376('0x67')]=function(_0x40510e,_0x32862b){_0x40510e[_0x3376('0x4d')][_0x3376('0x68')]=_0x40510e[_0x3376('0x65')][_0x3376('0x66')];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x40510e['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x32862b,null))[_0x3376('0x12')](saveUpdates(_0x40510e['body'],null))[_0x3376('0x12')](respondWithResult(_0x32862b,null))[_0x3376('0x47')](handleError(_0x32862b,null));};exports['addCustomerAvatar']=function(_0x5927e0,_0x2d02ed){_0x5927e0[_0x3376('0x4d')]['customerAvatar']=_0x5927e0[_0x3376('0x65')]['filename'];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x5927e0[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x2d02ed,null))[_0x3376('0x12')](saveUpdates(_0x5927e0['body'],null))[_0x3376('0x12')](respondWithResult(_0x2d02ed,null))[_0x3376('0x47')](handleError(_0x2d02ed,null));};exports[_0x3376('0x69')]=function(_0x216633,_0x61d4b5){_0x216633['body'][_0x3376('0x6a')]=_0x216633[_0x3376('0x65')][_0x3376('0x66')];return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x216633[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x61d4b5,null))['then'](saveUpdates(_0x216633[_0x3376('0x4d')],null))[_0x3376('0x12')](respondWithResult(_0x61d4b5,null))['catch'](handleError(_0x61d4b5,null));};exports['getLogo']=function(_0x3cd2b6,_0xdb9c39){var _0x21f671=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x6d'));var _0x4b333d={'where':{'id':_0x3cd2b6[_0x3376('0x49')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x21c89e=![];return require(_0x3376('0x6e'))[_0x3376('0x6f')]()[_0x3376('0x12')](function(_0x2b9e47){if(_0x2b9e47){_0x21c89e=_0x2b9e47[_0x3376('0x70')];}})[_0x3376('0x12')](function(){return db[_0x3376('0x45')][_0x3376('0x4b')](_0x4b333d);})[_0x3376('0x12')](handleEntityNotFound(_0xdb9c39,null))[_0x3376('0x12')](function(_0x75f7b3){if(_0x75f7b3){if(!_[_0x3376('0x71')](_0x75f7b3[_0x3376('0x64')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x73'),_0x75f7b3['sitepic']))&&_0x21c89e){_0x21f671=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x73'),_0x75f7b3[_0x3376('0x64')]);}}return _0xdb9c39[_0x3376('0x74')](_0x21f671);}})[_0x3376('0x47')](handleError(_0xdb9c39,null));};exports[_0x3376('0x75')]=function(_0x127c1f,_0x516ff6){var _0xfdc6f1=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/default_avatar.png');var _0x29968f={'where':{'id':_0x127c1f[_0x3376('0x49')]['id']},'attributes':['id',_0x3376('0x68')],'raw':!![]};return db['ChatWebsite'][_0x3376('0x4b')](_0x29968f)[_0x3376('0x12')](handleEntityNotFound(_0x516ff6,null))[_0x3376('0x12')](function(_0x4a9cc7){if(_0x4a9cc7){if(!_[_0x3376('0x71')](_0x4a9cc7[_0x3376('0x68')])){if(fs['existsSync'](path['join'](config[_0x3376('0x6c')],_0x3376('0x76'),_0x4a9cc7['agentAvatar']))){_0xfdc6f1=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/',_0x4a9cc7['agentAvatar']);}}return _0x516ff6[_0x3376('0x74')](_0xfdc6f1);}})[_0x3376('0x47')](handleError(_0x516ff6,null));};exports[_0x3376('0x77')]=function(_0x4dd7d0,_0x271257){var _0xbe2f36=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x78'));var _0xaccca4={'where':{'id':_0x4dd7d0[_0x3376('0x49')]['id']},'attributes':['id',_0x3376('0x79'),_0x3376('0x7a')],'raw':!![]};return db['ChatWebsite']['find'](_0xaccca4)[_0x3376('0x12')](handleEntityNotFound(_0x271257,null))[_0x3376('0x12')](function(_0xeff34a){if(_0xeff34a){if(!_[_0x3376('0x71')](_0xeff34a[_0x3376('0x79')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config['root'],'server/files/images/avatars/',_0xeff34a[_0x3376('0x79')]))&&_0xeff34a['showCustomerAvatar']){_0xbe2f36=path['join'](config[_0x3376('0x6c')],_0x3376('0x76'),_0xeff34a[_0x3376('0x79')]);}}return _0x271257[_0x3376('0x74')](_0xbe2f36);}})['catch'](handleError(_0x271257,null));};exports[_0x3376('0x7b')]=function(_0x524ea9,_0x2c2cc2){var _0x30e357=path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/images/avatars/system_avatar.png');var _0x5dc46e={'where':{'id':_0x524ea9[_0x3376('0x49')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3376('0x45')][_0x3376('0x4b')](_0x5dc46e)['then'](handleEntityNotFound(_0x2c2cc2,null))[_0x3376('0x12')](function(_0x42a250){if(_0x42a250){if(!_['isNil'](_0x42a250[_0x3376('0x6a')])){if(fs[_0x3376('0x72')](path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x76'),_0x42a250[_0x3376('0x6a')]))){_0x30e357=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0x76'),_0x42a250[_0x3376('0x6a')]);}}return _0x2c2cc2[_0x3376('0x74')](_0x30e357);}})[_0x3376('0x47')](handleError(_0x2c2cc2,null));};exports[_0x3376('0x7c')]=function(_0x1dadf0,_0x53fddc){var _0x2bd794=require(_0x3376('0x7d'));var _0x3a0933=new _0x2bd794();var _0x182bcc=_0x3a0933[_0x3376('0x7e')](_0x1dadf0[_0x3376('0x7f')][_0x3376('0x80')])[_0x3376('0x81')]();var _0x14963e={'body':_0x1dadf0[_0x3376('0x4d')],'channel':_0x3376('0x82')};var _0x52726c=[];var _0x3f3eec=[];var _0x379f28={};var _0xab62d=![];return db['CmContact'][_0x3376('0x54')]()[_0x3376('0x12')](function(_0xfdf5e4){if(!_0xfdf5e4){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('no\x20available\x20attributes');}_0x52726c=_[_0x3376('0x85')](_[_0x3376('0x35')](_0xfdf5e4),[_0x3376('0x86'),_0x3376('0x87')]);_0x3f3eec=_[_0x3376('0x85')](_[_0x3376('0x35')](_0xfdf5e4),[_0x3376('0x86'),'updatedAt',_0x3376('0x88'),_0x3376('0x89')]);if(_0x1dadf0[_0x3376('0x4d')]['id']){delete _0x1dadf0[_0x3376('0x4d')]['id'];}if(_[_0x3376('0x71')](_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')])){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))](_0x3376('0x8b'));}if(_[_0x3376('0x71')](_0x1dadf0[_0x3376('0x4d')][_0x3376('0x4d')])||_0x1dadf0['body'][_0x3376('0x4d')]===''){throw new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0x8c'));}if(_[_0x3376('0x71')](_0x1dadf0['body'][_0x3376('0x8d')])){throw new db[(_0x3376('0x83'))][(_0x3376('0x84'))](_0x3376('0x8e')+_0x3f3eec);}if(!_['includes'](_0x3f3eec,_0x1dadf0['body'][_0x3376('0x8d')])){throw new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0x8f')+_0x3f3eec);}_0x379f28[_0x1dadf0['body'][_0x3376('0x8d')]]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')];})['then'](function(){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x1dadf0[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0x90')],'as':_0x3376('0x91'),'include':[{'model':db[_0x3376('0x92')],'as':_0x3376('0x93'),'where':_0x379f28,'limit':0x1,'order':[[_0x3376('0x87'),'DESC']]}]},{'model':db[_0x3376('0x94')],'as':_0x3376('0x95')}]});})[_0x3376('0x12')](handleEntityNotFound(_0x53fddc,null))['then'](function(_0x532f39){if(_0x532f39&&_0x532f39[_0x3376('0x91')]){_0x14963e[_0x3376('0x96')]=_0x532f39;_0x14963e['applications']=_0x532f39[_0x3376('0x95')];_0x14963e[_0x3376('0x97')]=_0x532f39[_0x3376('0x91')];_0x14963e['applications']=_[_0x3376('0x98')](_0x14963e[_0x3376('0x99')],['priority'],[_0x3376('0x9a')]);if(_0x14963e[_0x3376('0x96')][_0x3376('0x95')]){delete _0x14963e[_0x3376('0x96')]['Applications'];}if(_0x14963e[_0x3376('0x96')][_0x3376('0x91')]&&_0x14963e[_0x3376('0x96')][_0x3376('0x91')][_0x3376('0x93')][_0x3376('0x3a')]){return _0x14963e['account'][_0x3376('0x91')]['Contacts'][0x0];}var _0x487081=_[_0x3376('0xa')](_0x1dadf0[_0x3376('0x4d')],{'firstName':_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')],'ListId':_0x532f39[_0x3376('0x89')]});_0x487081[_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8d')]]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x8a')];return db['CmContact'][_0x3376('0x4c')](_0x487081,{'fields':_0x52726c,'raw':!![]});}})[_0x3376('0x12')](handleEntityNotFound(_0x53fddc,null))[_0x3376('0x12')](function(_0x1e5e80){_0x14963e['contact']=_0x1e5e80;var _0x19cee5=_0x1dadf0[_0x3376('0x4d')][_0x3376('0x9b')];if(_0x1dadf0['headers'][_0x3376('0x9c')]){_0x19cee5=_0x1dadf0[_0x3376('0x7f')][_0x3376('0x9c')];}else if(_0x1dadf0[_0x3376('0x7f')][_0x3376('0x9d')]){_0x19cee5=_[_0x3376('0x9e')](_0x1dadf0['headers'][_0x3376('0x9d')][_0x3376('0x9f')](','));}if(_0x1e5e80){var _0xc2e5ba={'ContactId':_0x1e5e80['id'],'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'from':(_0x1e5e80['firstName']||'')+'\x20'+(_0x1e5e80[_0x3376('0xa0')]||''),'customerIp':_0x19cee5,'customerPort':_0x1dadf0[_0x3376('0x7f')][_0x3376('0xa1')]?_0x1dadf0['headers'][_0x3376('0xa1')]:null,'referer':_0x1dadf0[_0x3376('0x4d')][_0x3376('0xa2')],'browserName':_0x182bcc[_0x3376('0xa3')][_0x3376('0x2a')]&&_0x182bcc['browser'][_0x3376('0xa4')]?util['format'](_0x3376('0xa5'),_0x182bcc[_0x3376('0xa3')][_0x3376('0x2a')],_0x182bcc[_0x3376('0xa3')][_0x3376('0xa4')]):_0x3376('0xa6'),'browserVersion':_0x182bcc[_0x3376('0xa3')]['version']||_0x3376('0xa6'),'osName':util['format'](_0x3376('0xa5'),_0x182bcc['os'][_0x3376('0x2a')],_0x182bcc['os']['version']),'osVersion':_0x182bcc['os']['version'],'deviceModel':_0x182bcc[_0x3376('0xa7')][_0x3376('0x33')]&&_0x182bcc[_0x3376('0xa7')][_0x3376('0xa8')]?util['format'](_0x3376('0xa9'),_0x182bcc['device']['model'],_0x182bcc['device'][_0x3376('0xa8')],_0x182bcc['device']['type']):null,'deviceVendor':_0x182bcc[_0x3376('0xa7')][_0x3376('0xa8')],'deviceType':_0x182bcc[_0x3376('0xa7')]['type'],'formData':JSON[_0x3376('0x16')](_0x1dadf0[_0x3376('0x4d')])};var _0x114b0e={'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'closed':![]};if(_0x1dadf0[_0x3376('0x4d')]['threadId']){_0x114b0e['threadId']=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xaa')];return db[_0x3376('0xab')][_0x3376('0x4b')]({'where':_0x114b0e})[_0x3376('0x12')](function(_0x523cc4){if(_0x523cc4){return[_0x523cc4,![]];}_0xc2e5ba[_0x3376('0xaa')]=_0x1dadf0[_0x3376('0x4d')]['threadId'];_0xc2e5ba[_0x3376('0xac')]=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xac')];return db[_0x3376('0xab')]['create'](_0xc2e5ba)['then'](function(_0x52ae33){return[_0x52ae33,!![]];});});}_0x114b0e[_0x3376('0xad')]=_0x1e5e80['id'];if(_0x1dadf0['body'][_0x3376('0xae')]&&_0x1dadf0[_0x3376('0x4d')][_0x3376('0xae')]['id']){_0x114b0e['id']=_0x1dadf0[_0x3376('0x4d')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0x114b0e})[_0x3376('0x12')](function(_0x5cba15){if(_0x5cba15){return[_0x5cba15,![]];}return db['ChatInteraction'][_0x3376('0x4c')](_0xc2e5ba)[_0x3376('0x12')](function(_0x4521a4){return[_0x4521a4,!![]];});});}return db[_0x3376('0xab')]['create'](_0xc2e5ba)[_0x3376('0x12')](function(_0x570423){return[_0x570423,!![]];});}})[_0x3376('0xaf')](function(_0x454df8,_0x467846){if(_0x454df8){_0xab62d=_0x467846;if(!_0x467846){var _0x51b692={'from':(_0x14963e[_0x3376('0xb0')][_0x3376('0xb1')]||'')+'\x20'+(_0x14963e[_0x3376('0xb0')]['lastName']||'')};if(_0x1dadf0[_0x3376('0x4d')][_0x3376('0xaa')]&&_0x1dadf0['body'][_0x3376('0xb2')]&&_0x1dadf0['body'][_0x3376('0xaa')]!=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb2')]){_0x51b692['threadId']=_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb2')];}return _0x454df8[_0x3376('0x25')](_0x51b692);}else{return _0x454df8;}}})[_0x3376('0x12')](function(_0x1ecfc8){_0x14963e[_0x3376('0xae')]=_0x1ecfc8[_0x3376('0x27')]({'plain':!![]});_0x14963e[_0x3376('0xae')][_0x3376('0xb3')]=_0xab62d;if(_0x14963e[_0x3376('0xae')][_0x3376('0xb3')]){if(_0x14963e[_0x3376('0x96')]['autoclose']){_0x14963e[_0x3376('0x99')][_0x3376('0xb4')]({'id':0x0,'priority':_0x14963e[_0x3376('0x99')][_0x3376('0x3a')]+0x1,'app':'close','appdata':_0x3376('0xb5'),'interval':_0x3376('0xb6')});}}return db[_0x3376('0xb7')][_0x3376('0x4c')]({'body':_0x1dadf0[_0x3376('0x4d')][_0x3376('0x4d')],'ChatWebsiteId':_0x1dadf0[_0x3376('0x49')]['id'],'ChatInteractionId':_0x1ecfc8['id'],'direction':'in','ContactId':_0x14963e[_0x3376('0xb0')]['id'],'AttachmentId':_0x1dadf0[_0x3376('0x4d')][_0x3376('0xb8')]});})['then'](function(_0x4f8596){_0x14963e[_0x3376('0x19')]=_0x4f8596;if(_0x14963e[_0x3376('0xae')][_0x3376('0xb9')]){return db[_0x3376('0xba')]['find']({'attributes':['id','name'],'where':{'id':_0x14963e['interaction'][_0x3376('0xb9')]}})[_0x3376('0x12')](function(_0x5162f4){if(_0x5162f4){_0x14963e[_0x3376('0x99')][_0x3376('0xbb')]({'id':0x0,'priority':0x0,'app':_0x3376('0xbc'),'appdata':_0x5162f4[_0x3376('0x2a')]+','+(_0x14963e[_0x3376('0x96')][_0x3376('0xbd')]||0xa),'interval':_0x3376('0xb6')});_0x14963e[_0x3376('0xbe')]=!![];}return respondWithRpcPromise(_0x3376('0xbf'),_0x3376('0xc0'),_0x14963e);});}return respondWithRpcPromise(_0x3376('0xbf'),_0x3376('0xc0'),_0x14963e);})[_0x3376('0x12')](function(_0x596732){respondWithRpcPromise(_0x3376('0xc1'),'EventManager',{'event':'notify','message':_0x596732},client9002);return _0x596732;})[_0x3376('0x12')](respondWithResult(_0x53fddc,null))[_0x3376('0x47')](handleError(_0x53fddc,null));};exports[_0x3376('0xc2')]=function(_0x111691,_0x5317ce){var _0x298549,_0x27deff,_0xdcbab1;var _0x210ffe=[];var _0xfdd552={};var _0x10ba2f=_0x111691[_0x3376('0xc3')]||[];var _0x62862=[];var _0x13a00b;return db[_0x3376('0x92')]['describe']()[_0x3376('0x12')](function(_0x1ea14d){if(!_0x1ea14d){throw new db['Sequelize'][(_0x3376('0x84'))](_0x3376('0xc4'));}_0x210ffe=_[_0x3376('0x85')](_[_0x3376('0x35')](_0x1ea14d),[_0x3376('0x86'),_0x3376('0x87'),'CompanyId','ListId']);if(_0x111691[_0x3376('0x4d')]['id']){delete _0x111691[_0x3376('0x4d')]['id'];}if(_[_0x3376('0x71')](_0x111691[_0x3376('0x4d')][_0x3376('0x8a')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db['Sequelize'][(_0x3376('0x84'))](_0x3376('0x8b')));}if(_[_0x3376('0x71')](_0x111691[_0x3376('0x4d')][_0x3376('0x4d')])||_0x111691['body'][_0x3376('0x4d')]===''){throw _0x5317ce[_0x3376('0x1d')](0x1f4)['send'](new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x111691[_0x3376('0x4d')][_0x3376('0xc5')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db[(_0x3376('0x83'))]['ValidationError'](_0x3376('0xc6')+_0x210ffe));}if(!_[_0x3376('0xc7')](_0x210ffe,_0x111691[_0x3376('0x4d')][_0x3376('0xc5')])){throw _0x5317ce[_0x3376('0x1d')](0x1f4)[_0x3376('0x2b')](new db[(_0x3376('0x83'))][(_0x3376('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x210ffe));}_0xfdd552[_0x111691[_0x3376('0x4d')]['mapKeyOffline']]=_0x111691['body']['from'];})[_0x3376('0x12')](function(){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x111691['params']['id']},'include':[{'model':db[_0x3376('0x90')],'as':_0x3376('0x91')},{'model':db[_0x3376('0xc8')],'as':_0x3376('0xc8')}]});})[_0x3376('0x12')](handleEntityNotFound(_0x5317ce,null))[_0x3376('0x12')](function(_0x4b76b4){if(_0x4b76b4&&_0x4b76b4[_0x3376('0x91')]){_0x27deff=_0x4b76b4;var _0x5e322a=_[_0x3376('0xa')](_0x111691[_0x3376('0x4d')],{'firstName':_0x111691[_0x3376('0x4d')]['from'],'phone':_0x111691[_0x3376('0x4d')][_0x3376('0x8a')],'ListId':_0x4b76b4['ListId']});_0x5e322a[_0x111691[_0x3376('0x4d')][_0x3376('0xc5')]]=_0x111691['body']['from'];return db['CmContact']['findOrCreate']({'where':_0xfdd552,'defaults':_0x5e322a});}})[_0x3376('0xaf')](function(_0x55f25d){if(_0x55f25d){_0xdcbab1=_0x55f25d;var _0x50a308=fs[_0x3376('0xc9')](path[_0x3376('0x6b')](config['root'],_0x3376('0xca')),_0x3376('0xcb'));var _0x15c488=ejs['render'](_0x50a308,{'body':_['toPairs'](_0x111691[_0x3376('0x4d')]['body']),'bodyTitle':_0x27deff[_0x3376('0xcc')]});return db[_0x3376('0xcd')]['create']({'body':_0x15c488,'plainBody':htmlToText[_0x3376('0xce')](_0x15c488),'ContactId':_0x55f25d['id'],'ChatWebsiteId':_0x27deff['id']});}})[_0x3376('0x12')](function(_0x2ee6d3){_0x13a00b=_0x2ee6d3;if(_0x10ba2f[_0x3376('0x3a')]){var _0x8e717b=_0x10ba2f[_0x3376('0x2f')](function(_0x1f237e){return{'name':_0x1f237e[_0x3376('0xcf')],'basename':_0x1f237e['filename'],'type':_0x1f237e[_0x3376('0xd0')],'ChatOfflineMessageId':_0x2ee6d3['id']};});_0x62862=_0x8e717b[_0x3376('0x2f')](_0x57dda7=>{var _0x4a6224={'filename':_0x57dda7[_0x3376('0x2a')],'path':path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server',_0x3376('0xc3'),_0x3376('0xd1'),_0x3376('0xd2'),_0x57dda7[_0x3376('0xd3')])};return _0x4a6224;});if(!_0x27deff['openNewInteraction']){return db[_0x3376('0xd4')][_0x3376('0xd5')](function(_0x30c282){return db[_0x3376('0xd6')][_0x3376('0xd7')](_0x8e717b,{'transaction':_0x30c282});});}}})[_0x3376('0x12')](function(){if(_0x13a00b){_0x298549=_0x13a00b;return db[_0x3376('0xc8')][_0x3376('0x59')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x3376('0xd8')],'as':_0x3376('0xd8'),'raw':!![]}]}]});}})[_0x3376('0x12')](function(_0x96a06b){if(_0x96a06b&&_0x96a06b['Smtp']&&_0x27deff[_0x3376('0xd9')]&&_0x27deff[_0x3376('0xda')]){var _0xd90095=_0x96a06b['getSmtpOptions']();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xd90095,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x96a06b['name'],_0x96a06b[_0x3376('0xdb')]||_0x96a06b[_0x3376('0xdc')][_0x3376('0x4f')]),'to':_0x27deff[_0x3376('0xda')],'subject':_0x27deff[_0x3376('0xdd')],'html':_0x298549[_0x3376('0x4d')],'attachments':_0x62862}},client9003)[_0x3376('0x12')](function(){return _0x298549;})[_0x3376('0x47')](function(_0x2ec796){logger[_0x3376('0x17')](_0x2ec796);});}})[_0x3376('0x12')](function(){if(_0x27deff&&_0x27deff[_0x3376('0xde')]&&_0x27deff[_0x3376('0xdf')]){var _0x28b2e7=[];if(_0x10ba2f['length']){_0x28b2e7=_0x10ba2f[_0x3376('0x2f')](function(_0x3940b5){return{'name':_0x3940b5['originalname'],'basename':_0x3940b5[_0x3376('0x66')],'type':_0x3940b5['mimetype'],'ChatOfflineMessageId':_0x13a00b['id']};});}var _0x416780;if(!_[_0x3376('0x71')](_0x27deff[_0x3376('0xe0')])){var _0xb47ba4=_[_0x3376('0x2f')](_0x111691[_0x3376('0x4d')],function(_0xcbf102){return _0xcbf102;});var _0x14b527=_[_0x3376('0xe1')](_0xb47ba4)[0x0];var _0x15e2b0=_['mapValues'](_0x14b527,function(_0x439031){return _0x439031;});_0x416780=_0x15e2b0[0x1][_0x27deff[_0x3376('0xe0')]];}var _0x1e550e={'from':_0xdcbab1[_0x3376('0xdb')],'firstName':_0xdcbab1['firstName'],'lastName':_0xdcbab1[_0x3376('0xa0')],'mapKey':_0x3376('0xdb'),'message':{'from':_0xdcbab1[_0x3376('0xdb')],'to':_0x27deff['MailAccount']['email'],'cc':'','subject':_[_0x3376('0x71')](_0x416780)?_0x27deff['offlineMessageSubject']:_0x416780,'messageId':'','sentAt':new Date(),'attach':_0x28b2e7['length'],'attachments':_0x28b2e7,'originChannel':'Chat','ChatWebsiteId':_0x27deff['id'],'ChatOfflineMessageId':_0x298549['id'],'originTo':_0x27deff[_0x3376('0xc8')][_0x3376('0xdb')]},'body':_0x298549[_0x3376('0x4d')]};var _0x348c11={'account':{'id':_0x27deff[_0x3376('0xdf')]},'body':_0x1e550e,'log':_0x3376('0xe2')};return respondWithRpcPromise('NotifyMailAccount',_0x3376('0xe3'),_0x348c11,client9001)[_0x3376('0x12')](function(){return _0x298549;})['catch'](function(_0x304647){logger['error'](_0x304647);});}return;})['then'](function(){if(_0x298549){return _0x298549;}})[_0x3376('0x12')](respondWithResult(_0x5317ce,null))[_0x3376('0x47')](function(_0x479ff3){logger[_0x3376('0x17')](_0x3376('0x47'),_0x479ff3);for(var _0x5fb0b2 of _0x10ba2f){var _0x2f8d92=path[_0x3376('0x6b')](config[_0x3376('0x6c')],_0x3376('0xe4'),_0x3376('0xc3'),_0x3376('0xd1'),_0x3376('0xd2'),_0x5fb0b2['filename']);fs_extra[_0x3376('0xe5')](_0x2f8d92)[_0x3376('0x47')](function(_0x4ea6d3){logger[_0x3376('0x17')](_0x3376('0xe6'),_0x2f8d92,_0x4ea6d3);});}});};exports['addInteraction']=function(_0x41ee52,_0x40255f){return db[_0x3376('0xab')][_0x3376('0x4b')]({'where':{'id':_0x41ee52[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x40255f,null))['then'](function(_0x4fcf14){if(_0x4fcf14){return _0x4fcf14['addInteraction'](_0x41ee52[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x41ee52['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x40255f,null))['catch'](handleError(_0x40255f,null));};exports[_0x3376('0xe8')]=function(_0x4e2737,_0x3772c8){var _0x4404ec={'raw':![],'where':{}};var _0x20ad74={};var _0x3a9e06={'count':0x0,'rows':[]};return db[_0x3376('0x45')]['findOne']({'where':{'id':_0x4e2737['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x3772c8,null))['then'](function(_0x12ad75){if(_0x12ad75){_0x20ad74[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0xab')][_0x3376('0x30')]);_0x20ad74[_0x3376('0x34')]=_[_0x3376('0x35')](_0x4e2737[_0x3376('0x34')]);_0x20ad74[_0x3376('0x36')]=_[_0x3376('0x37')](_0x20ad74[_0x3376('0x33')],_0x20ad74[_0x3376('0x34')]);_0x4404ec[_0x3376('0x39')]=_[_0x3376('0x37')](_0x20ad74[_0x3376('0x33')],qs[_0x3376('0x38')](_0x4e2737[_0x3376('0x34')][_0x3376('0x38')]));_0x4404ec[_0x3376('0x39')]=_0x4404ec[_0x3376('0x39')]['length']?_0x4404ec[_0x3376('0x39')]:_0x20ad74[_0x3376('0x33')];if(!_0x4e2737[_0x3376('0x34')][_0x3376('0x61')](_0x3376('0x3b'))){_0x4404ec[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x4e2737[_0x3376('0x34')][_0x3376('0x21')]);_0x4404ec['offset']=qs[_0x3376('0x1f')](_0x4e2737[_0x3376('0x34')][_0x3376('0x1f')]);}_0x4404ec['order']=qs['sort'](_0x4e2737[_0x3376('0x34')][_0x3376('0x3c')]);_0x4404ec[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x4e2737[_0x3376('0x34')],_0x20ad74['filters']));_0x4404ec[_0x3376('0x3d')][_0x3376('0x56')]=_0x12ad75['id'];if(_0x4e2737[_0x3376('0x34')][_0x3376('0x41')]){_0x4404ec[_0x3376('0x3d')]=_['merge'](_0x4404ec[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x4404ec[_0x3376('0x39')],function(_0x56e009){var _0x3a2eb3={};_0x3a2eb3[_0x56e009]={'$like':'%'+_0x4e2737[_0x3376('0x34')][_0x3376('0x41')]+'%'};return _0x3a2eb3;})});}_0x4404ec=_[_0x3376('0x42')]({},_0x4404ec,_0x4e2737['options']);return db[_0x3376('0xab')]['count']({'where':_0x4404ec[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0x2752a7){_0x3a9e06[_0x3376('0x22')]=_0x2752a7;if(_0x4e2737['query'][_0x3376('0x43')]){_0x4404ec[_0x3376('0x44')]=[{'model':db[_0x3376('0x92')],'as':'Contact','required':![]},{'model':db[_0x3376('0xba')],'as':_0x3376('0xe9'),'attributes':[_0x3376('0x2a'),_0x3376('0xea'),_0x3376('0xeb')],'required':![]},{'model':db['Tag'],'as':_0x3376('0xec'),'attributes':['id',_0x3376('0x2a'),_0x3376('0xed')],'where':_0x4e2737[_0x3376('0x34')][_0x3376('0xee')]?{'id':_0x4e2737[_0x3376('0x34')][_0x3376('0xee')]}:undefined,'required':_0x4e2737[_0x3376('0x34')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x3376('0x46')](_0x4404ec);})[_0x3376('0x12')](function(_0x417085){_0x3a9e06['rows']=_0x417085;return _0x3a9e06;});}})['then'](respondWithFilteredResult(_0x3772c8,_0x4404ec))['catch'](handleError(_0x3772c8,null));};function iftimePromise(_0x2e7bd5,_0x3f4da3){return respondWithRpcPromise(_0x3376('0xef'),_0x3376('0xf0'),{'command':_0x3f4da3['timezone']?util['format'](_0x3376('0xf1'),_0x2e7bd5[_0x3376('0xf2')],_0x3f4da3['timezone']):util[_0x3376('0xf3')](_0x3376('0xf4'),_0x2e7bd5['interval'])},client9002)[_0x3376('0x12')](function(_0x110314){var _0x2572c1=_0x110314&&_0x110314[_0x3376('0xf5')](_0x3376('0xf6'))>=0x0?!![]:![];logger['info'](_0x3376('0xf7'),_0x3f4da3['id'],_0x2e7bd5['id'],_0x2e7bd5['interval'],_0x2572c1?_0x3376('0xf8'):_0x3376('0xf9'),_0x3f4da3[_0x3376('0xfa')]?_0x3f4da3[_0x3376('0xfa')]:_0x3376('0xfb'));return _0x2572c1;})[_0x3376('0x47')](function(_0x131371){logger[_0x3376('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x3f4da3['id'],_0x2e7bd5['id'],_0x2e7bd5[_0x3376('0xf2')],util[_0x3376('0xfc')](_0x131371,{'showHidden':![],'depth':null}),_0x3f4da3[_0x3376('0xfa')]?_0x3f4da3[_0x3376('0xfa')]:_0x3376('0xfb'));return![];});}exports[_0x3376('0xf0')]=function(_0x2c13f6,_0x5779bc){var _0x118370=0x0;var _0x4b3178=0x0;var _0x34e9d0=![];var _0x27b3b6;var _0x14f0c2;return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2c13f6[_0x3376('0x49')]['id']},'include':[{'model':db[_0x3376('0xfd')],'as':_0x3376('0xfd'),'include':[{'model':db[_0x3376('0xfd')],'as':_0x3376('0xfe'),'attributes':['id',_0x3376('0xf2')],'raw':!![]}]}]})[_0x3376('0x12')](handleEntityNotFound(_0x5779bc,null))['then'](function(_0x4d4a0f){if(_0x4d4a0f){_0x27b3b6=_0x4d4a0f;return _0x4d4a0f[_0x3376('0xff')]({'raw':!![]});}})['then'](function(_0x386f00){if(_0x27b3b6){if(_0x386f00){_0x14f0c2=_0x386f00;}}return require(_0x3376('0x6e'))[_0x3376('0x6f')]();})['then'](function(_0x41cb33){if(_0x41cb33){_0x4b3178=_0x41cb33['virtual'];_0x34e9d0=_0x41cb33[_0x3376('0x70')];}})[_0x3376('0x12')](function(){return db[_0x3376('0xab')]['count']({'where':{'closed':![]}});})[_0x3376('0x12')](function(_0x2b0529){_0x118370=_0x2b0529;if(_0x4b3178&&_0x2b0529>_0x4b3178){return db['License'][_0x3376('0x59')]({'where':{'id':0x1}})[_0x3376('0x12')](function(_0x42e622){if(_0x42e622){_0x42e622[_0x3376('0x100')](_0x3376('0x101'));}});}})['then'](function(){if(_0x27b3b6['Interval']&&_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')]){var _0x209f03=[];for(var _0x303d58=0x0;_0x303d58<_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')][_0x3376('0x3a')];_0x303d58++){var _0x482f5b=_0x27b3b6[_0x3376('0xfd')][_0x3376('0xfe')][_0x303d58]['get']({'plain':!![]});_0x209f03[_0x3376('0xb4')](iftimePromise(_0x482f5b,_0x27b3b6));}return BPromise['all'](_0x209f03)[_0x3376('0x12')](function(_0x4b527d){return _['some'](_0x4b527d);});}else{return!![];}})['then'](function(_0x13eb6f){var _0xbfd25f=fs['readFileSync'](path[_0x3376('0x6b')](config[_0x3376('0x6c')],'server/files/chat/iframe.ejs'),_0x3376('0xcb'));var _0x27ded8={'remote':_0x27b3b6[_0x3376('0x102')],'query':querystring[_0x3376('0x16')](_[_0x3376('0x42')](_0x27b3b6[_0x3376('0x27')]({'plain':!![]}),{'customerIp':_0x2c13f6[_0x3376('0x7f')]['x-forwarded-for']||_0x2c13f6[_0x3376('0x7f')]['x-real-ip']||_0x2c13f6[_0x3376('0x103')][_0x3376('0x104')]||_0x2c13f6['ip'],'referer':_0x2c13f6['headers'][_0x3376('0xa2')],'openedInteractions':_0x118370,'maxInteractions':_0x4b3178,'virtual':_0x34e9d0[_0x3376('0x105')],'online':_0x13eb6f,'custom':_0x34e9d0}))[_0x3376('0x106')](/'/g,'\x5c\x27')};_0x5779bc['send'](ejs['render'](Mustache[_0x3376('0x107')](_0xbfd25f,_0x27ded8),{'proactiveActions':_0x14f0c2,'alignment':_0x27b3b6[_0x3376('0x108')],'verticalAlignment':_0x27b3b6['verticalAlignment'],'div_color':_0x27b3b6[_0x3376('0xed')],'labelText':_0x27b3b6[_0x3376('0x109')],'text_color':_0x27b3b6[_0x3376('0x10a')],'text_button_color':_0x27b3b6[_0x3376('0x10b')],'button_color':_0x27b3b6[_0x3376('0x10c')],'background_color':_0x27b3b6[_0x3376('0x10d')],'hideWhenOffline':_0x27b3b6[_0x3376('0x10e')],'interval':_0x27b3b6[_0x3376('0x10f')]}));})[_0x3376('0x47')](handleError(_0x5779bc,null));};exports['addApplications']=function(_0x3ed193,_0x3096b0){var _0x5377ce=_0x3ed193[_0x3376('0x49')]['id'];var _0x1a9863=_0x3ed193[_0x3376('0x4d')];var _0x3b9250=0xc8;var _0x455ac2=null;return db[_0x3376('0xd4')]['transaction']({'isolationLevel':db['sequelize'][_0x3376('0x110')][_0x3376('0x111')][_0x3376('0x112')]},function(_0x4fc043){return db['ChatWebsite'][_0x3376('0x59')]({'where':{'id':_0x5377ce},'transaction':_0x4fc043})['then'](function(_0x3c1bf9){if(_0x3c1bf9){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x5377ce},'transaction':_0x4fc043})[_0x3376('0x12')](function(){var _0x1754fa=_[_0x3376('0x2f')](_0x1a9863,function(_0x548d9c){_0x548d9c[_0x3376('0x56')]=_0x5377ce;return _0x548d9c;});return db[_0x3376('0x94')][_0x3376('0xd7')](_0x1754fa,{'transaction':_0x4fc043});});}else{_0x3b9250=0x194;_0x455ac2=[];}});})[_0x3376('0x12')](function(){if(_0x3b9250!==0x194){return db[_0x3376('0x94')][_0x3376('0x113')]({'where':{'ChatWebsiteId':_0x5377ce},'order':_0x3376('0x114')})['then'](function(_0x1307ec){_0x455ac2=_0x1307ec;});}})[_0x3376('0x47')](function(_0x2af281){_0x3b9250=0x1f4;logger['error'](_0x2af281[_0x3376('0x29')]);if(_0x2af281['name']){delete _0x2af281[_0x3376('0x2a')];}_0x455ac2=_0x2af281;})['finally'](function(){if(_0x455ac2===null){_0x3096b0[_0x3376('0x1b')](_0x3b9250);}else{if(_0x3b9250===0x1f4){_0x3096b0['status'](_0x3b9250)[_0x3376('0x2b')](_0x455ac2);}else{_0x3096b0[_0x3376('0x1d')](_0x3b9250)[_0x3376('0x1e')](_0x455ac2);}}});};exports['getApplications']=function(_0x1ca712,_0x10afc0){var _0x2fccd3={};var _0x3b39c8={};var _0x50baec;var _0x1c0b1d;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x1ca712[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x10afc0,null))[_0x3376('0x12')](function(_0x44b4e2){if(_0x44b4e2){_0x50baec=_0x44b4e2;_0x3b39c8['model']=_[_0x3376('0x35')](db['ChatApplication']['rawAttributes']);_0x3b39c8[_0x3376('0x34')]=_['keys'](_0x1ca712[_0x3376('0x34')]);_0x3b39c8['filters']=_[_0x3376('0x37')](_0x3b39c8['model'],_0x3b39c8['query']);_0x2fccd3['attributes']=_[_0x3376('0x37')](_0x3b39c8['model'],qs[_0x3376('0x38')](_0x1ca712[_0x3376('0x34')][_0x3376('0x38')]));_0x2fccd3['attributes']=_0x2fccd3[_0x3376('0x39')]['length']?_0x2fccd3[_0x3376('0x39')]:_0x3b39c8[_0x3376('0x33')];_0x2fccd3[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x1ca712[_0x3376('0x34')][_0x3376('0x3c')]);_0x2fccd3[_0x3376('0x3d')]=qs[_0x3376('0x36')](_['pick'](_0x1ca712[_0x3376('0x34')],_0x3b39c8[_0x3376('0x36')]));if(_0x1ca712[_0x3376('0x34')]['filter']){_0x2fccd3[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x2fccd3['where'],{'$or':_[_0x3376('0x2f')](_0x2fccd3[_0x3376('0x39')],function(_0x58040a){var _0x1ede0b={};_0x1ede0b[_0x58040a]={'$like':'%'+_0x1ca712['query'][_0x3376('0x41')]+'%'};return _0x1ede0b;})});}_0x2fccd3=_[_0x3376('0x42')]({},_0x2fccd3,_0x1ca712[_0x3376('0x4a')]);return _0x50baec[_0x3376('0x115')](_0x2fccd3);}})['then'](function(_0x20b48c){if(_0x20b48c){_0x1c0b1d=_0x20b48c[_0x3376('0x3a')];if(!_0x1ca712['query'][_0x3376('0x61')](_0x3376('0x3b'))){_0x2fccd3[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x1ca712[_0x3376('0x34')][_0x3376('0x21')]);_0x2fccd3['offset']=qs[_0x3376('0x1f')](_0x1ca712['query'][_0x3376('0x1f')]);}return _0x50baec['getApplications'](_0x2fccd3);}})['then'](function(_0x1ed0a0){if(_0x1ed0a0){return _0x1ed0a0?{'count':_0x1c0b1d,'rows':_0x1ed0a0}:null;}})['then'](respondWithResult(_0x10afc0,null))[_0x3376('0x47')](handleError(_0x10afc0,null));};exports[_0x3376('0x116')]=function(_0x6163b9,_0x5ee2c8){return db['chatProactiveAction']['find']({'where':{'id':_0x6163b9[_0x3376('0x49')]['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x5ee2c8,null))[_0x3376('0x12')](function(_0xb9bcaf){if(_0xb9bcaf){return _0xb9bcaf['addProactiveActions'](_0x6163b9[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x6163b9['body'],[_0x3376('0x5d'),'id'])||{});}})[_0x3376('0x12')](respondWithResult(_0x5ee2c8,null))['catch'](handleError(_0x5ee2c8,null));};exports[_0x3376('0xff')]=function(_0x1f8554,_0x55fea7){var _0x20e341={};var _0x21d463={};var _0x56b762;var _0x1d99a7;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x1f8554['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x55fea7,null))[_0x3376('0x12')](function(_0xb52e37){if(_0xb52e37){_0x56b762=_0xb52e37;_0x21d463['model']=_[_0x3376('0x35')](db[_0x3376('0x117')][_0x3376('0x30')]);_0x21d463['query']=_[_0x3376('0x35')](_0x1f8554['query']);_0x21d463[_0x3376('0x36')]=_['intersection'](_0x21d463[_0x3376('0x33')],_0x21d463[_0x3376('0x34')]);_0x20e341[_0x3376('0x39')]=_[_0x3376('0x37')](_0x21d463['model'],qs[_0x3376('0x38')](_0x1f8554[_0x3376('0x34')][_0x3376('0x38')]));_0x20e341[_0x3376('0x39')]=_0x20e341[_0x3376('0x39')][_0x3376('0x3a')]?_0x20e341[_0x3376('0x39')]:_0x21d463['model'];_0x20e341['order']=qs[_0x3376('0x3c')](_0x1f8554[_0x3376('0x34')][_0x3376('0x3c')]);_0x20e341['where']=qs[_0x3376('0x36')](_['pick'](_0x1f8554[_0x3376('0x34')],_0x21d463[_0x3376('0x36')]));if(_0x1f8554[_0x3376('0x34')]['filter']){_0x20e341[_0x3376('0x3d')]=_['merge'](_0x20e341[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x20e341[_0x3376('0x39')],function(_0x1f7d06){var _0x2502be={};_0x2502be[_0x1f7d06]={'$like':'%'+_0x1f8554[_0x3376('0x34')]['filter']+'%'};return _0x2502be;})});}_0x20e341=_[_0x3376('0x42')]({},_0x20e341,_0x1f8554['options']);return _0x56b762[_0x3376('0xff')](_0x20e341);}})[_0x3376('0x12')](function(_0x7666f8){if(_0x7666f8){_0x1d99a7=_0x7666f8[_0x3376('0x3a')];if(!_0x1f8554['query'][_0x3376('0x61')]('nolimit')){_0x20e341[_0x3376('0x21')]=qs[_0x3376('0x21')](_0x1f8554[_0x3376('0x34')]['limit']);_0x20e341['offset']=qs['offset'](_0x1f8554[_0x3376('0x34')][_0x3376('0x1f')]);}return _0x56b762[_0x3376('0xff')](_0x20e341);}})['then'](function(_0x5903c2){if(_0x5903c2){return _0x5903c2?{'count':_0x1d99a7,'rows':_0x5903c2}:null;}})[_0x3376('0x12')](respondWithResult(_0x55fea7,null))[_0x3376('0x47')](handleError(_0x55fea7,null));};exports['getFields']=function(_0x3df3de,_0x2ef2db){var _0x1827b0=_0x3df3de[_0x3376('0x34')][_0x3376('0x118')]===_0x3376('0x119')?_0x3376('0x11a'):'onlineForm';return db[_0x3376('0x45')][_0x3376('0x4b')]({'attributes':['id',_0x1827b0],'where':{'id':_0x3df3de[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ef2db,null))[_0x3376('0x12')](function(_0x4b5c68){if(_0x4b5c68){var _0x2aa1e1=_0x4b5c68[_0x1827b0];var _0x47ecb2=_0x2aa1e1&&_0x2aa1e1[_0x3376('0x11b')]?_0x2aa1e1[_0x3376('0x11b')]:[];_0x2ef2db['send']({'fromKey':_[_0x3376('0x71')](_0x2aa1e1['fromKey'])?undefined:_0x2aa1e1[_0x3376('0x11c')],'count':_0x47ecb2[_0x3376('0x3a')],'rows':_0x47ecb2});}})[_0x3376('0x47')](handleError(_0x2ef2db,null));};exports[_0x3376('0x11d')]=function(_0x374753,_0x51c378){var _0x44eee2={'raw':![],'where':{}};var _0x159875={};var _0x301875={'count':0x0,'rows':[]};return db[_0x3376('0x45')]['findOne']({'where':{'id':_0x374753['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x51c378,null))[_0x3376('0x12')](function(_0xadb751){if(_0xadb751){_0x159875[_0x3376('0x33')]=_[_0x3376('0x35')](db[_0x3376('0xcd')][_0x3376('0x30')]);_0x159875[_0x3376('0x34')]=_['keys'](_0x374753[_0x3376('0x34')]);_0x159875[_0x3376('0x36')]=_[_0x3376('0x37')](_0x159875[_0x3376('0x33')],_0x159875[_0x3376('0x34')]);_0x44eee2[_0x3376('0x39')]=_[_0x3376('0x37')](_0x159875[_0x3376('0x33')],qs[_0x3376('0x38')](_0x374753['query'][_0x3376('0x38')]));_0x44eee2[_0x3376('0x39')]=_0x44eee2[_0x3376('0x39')][_0x3376('0x3a')]?_0x44eee2[_0x3376('0x39')]:_0x159875[_0x3376('0x33')];if(!_0x374753[_0x3376('0x34')][_0x3376('0x61')]('nolimit')){_0x44eee2[_0x3376('0x21')]=qs['limit'](_0x374753[_0x3376('0x34')][_0x3376('0x21')]);_0x44eee2[_0x3376('0x1f')]=qs[_0x3376('0x1f')](_0x374753[_0x3376('0x34')]['offset']);}_0x44eee2[_0x3376('0x5a')]=qs[_0x3376('0x3c')](_0x374753[_0x3376('0x34')][_0x3376('0x3c')]);_0x44eee2[_0x3376('0x3d')]=qs[_0x3376('0x36')](_[_0x3376('0x3e')](_0x374753[_0x3376('0x34')],_0x159875[_0x3376('0x36')]));_0x44eee2['where']['ChatWebsiteId']=_0xadb751['id'];if(_0x374753['query'][_0x3376('0x41')]){_0x44eee2[_0x3376('0x3d')]=_[_0x3376('0x42')](_0x44eee2[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x44eee2[_0x3376('0x39')],function(_0x45b319){var _0x5a09b8={};_0x5a09b8[_0x45b319]={'$like':'%'+_0x374753['query'][_0x3376('0x41')]+'%'};return _0x5a09b8;})});}_0x44eee2=_[_0x3376('0x42')]({},_0x44eee2,_0x374753[_0x3376('0x4a')]);return db['ChatOfflineMessage'][_0x3376('0x22')]({'where':_0x44eee2[_0x3376('0x3d')]})[_0x3376('0x12')](function(_0xf6f247){_0x301875[_0x3376('0x22')]=_0xf6f247;if(_0x374753[_0x3376('0x34')]['includeAll']){_0x44eee2[_0x3376('0x44')]=[{'all':!![]}];}else{_0x44eee2[_0x3376('0x44')]=[{'model':db[_0x3376('0x92')],'as':_0x3376('0x11e'),'required':![]},{'model':db[_0x3376('0xd6')],'as':_0x3376('0x11f'),'required':![]}];}return db[_0x3376('0xcd')][_0x3376('0x46')](_0x44eee2);})[_0x3376('0x12')](function(_0x24452c){_0x301875[_0x3376('0x5b')]=_0x24452c;return _0x301875;});}})['then'](respondWithFilteredResult(_0x51c378,_0x44eee2))[_0x3376('0x47')](handleError(_0x51c378,null));};exports[_0x3376('0x120')]=function(_0x2793dd,_0x43227b){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0x2793dd['params']['id']}})[_0x3376('0x12')](handleEntityNotFound(_0x43227b,null))[_0x3376('0x12')](function(_0x198632){if(_0x198632){return _0x198632[_0x3376('0x120')](_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')],_[_0x3376('0xe7')](_0x2793dd['body'],[_0x3376('0x5d'),'id'])||{})[_0x3376('0xaf')](function(_0x4dd6d){for(var _0x2fa161=0x0;_0x2fa161<_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')][_0x3376('0x3a')];_0x2fa161+=0x1){socket['emit'](_0x3376('0x121'),{'UserId':Number(_0x2793dd[_0x3376('0x4d')][_0x3376('0x5d')][_0x2fa161]),'ChatWebsiteId':Number(_0x2793dd[_0x3376('0x49')]['id'])});}return _0x4dd6d;});}})[_0x3376('0x12')](respondWithResult(_0x43227b,null))[_0x3376('0x47')](handleError(_0x43227b,null));};exports[_0x3376('0x122')]=function(_0xb521cf,_0x154747){return db[_0x3376('0x45')][_0x3376('0x4b')]({'where':{'id':_0xb521cf[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x154747,null))[_0x3376('0x12')](function(_0x16fd13){if(_0x16fd13){return _0x16fd13[_0x3376('0x122')](_0xb521cf[_0x3376('0x34')]['ids'])[_0x3376('0x12')](function(){if(_[_0x3376('0x123')](_0xb521cf['query']['ids'])){for(var _0x440668=0x0;_0x440668<_0xb521cf['query'][_0x3376('0x5d')][_0x3376('0x3a')];_0x440668+=0x1){socket[_0x3376('0x124')]('userChatWebsite:remove',{'UserId':Number(_0xb521cf[_0x3376('0x34')][_0x3376('0x5d')][_0x440668]),'ChatWebsiteId':Number(_0xb521cf[_0x3376('0x49')]['id'])});}}else{socket['emit'](_0x3376('0x125'),{'UserId':Number(_0xb521cf['query'][_0x3376('0x5d')]),'ChatWebsiteId':Number(_0xb521cf[_0x3376('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x154747,null))[_0x3376('0x47')](handleError(_0x154747,null));};exports[_0x3376('0x126')]=function(_0x11b6fa,_0x3a61e9){var _0x127359={};var _0x2c08f7={};var _0xb17d60;var _0x3e4bda;return db[_0x3376('0x45')][_0x3376('0x59')]({'where':{'id':_0x11b6fa[_0x3376('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a61e9,null))[_0x3376('0x12')](function(_0xf169ae){if(_0xf169ae){_0xb17d60=_0xf169ae;_0x2c08f7['model']=_[_0x3376('0x35')](db[_0x3376('0xba')][_0x3376('0x30')]);_0x2c08f7[_0x3376('0x34')]=_[_0x3376('0x35')](_0x11b6fa['query']);_0x2c08f7[_0x3376('0x36')]=_['intersection'](_0x2c08f7[_0x3376('0x33')],_0x2c08f7['query']);_0x127359[_0x3376('0x39')]=_[_0x3376('0x37')](_0x2c08f7[_0x3376('0x33')],qs['fields'](_0x11b6fa[_0x3376('0x34')][_0x3376('0x38')]));_0x127359[_0x3376('0x39')]=_0x127359['attributes'][_0x3376('0x3a')]?_0x127359[_0x3376('0x39')]:_0x2c08f7[_0x3376('0x33')];_0x127359[_0x3376('0x5a')]=qs['sort'](_0x11b6fa['query'][_0x3376('0x3c')]);_0x127359[_0x3376('0x3d')]=qs[_0x3376('0x36')](_['pick'](_0x11b6fa['query'],_0x2c08f7['filters']));if(_0x11b6fa['query'][_0x3376('0x41')]){_0x127359[_0x3376('0x3d')]=_['merge'](_0x127359[_0x3376('0x3d')],{'$or':_[_0x3376('0x2f')](_0x127359['attributes'],function(_0x3a79df){var _0x5081b6={};_0x5081b6[_0x3a79df]={'$like':'%'+_0x11b6fa['query']['filter']+'%'};return _0x5081b6;})});}_0x127359=_[_0x3376('0x42')]({},_0x127359,_0x11b6fa[_0x3376('0x4a')]);return _0xb17d60[_0x3376('0x126')](_0x127359);}})[_0x3376('0x12')](function(_0x452542){if(_0x452542){_0x3e4bda=_0x452542[_0x3376('0x3a')];if(!_0x11b6fa[_0x3376('0x34')]['hasOwnProperty'](_0x3376('0x3b'))){_0x127359[_0x3376('0x21')]=qs['limit'](_0x11b6fa['query'][_0x3376('0x21')]);_0x127359['offset']=qs[_0x3376('0x1f')](_0x11b6fa[_0x3376('0x34')][_0x3376('0x1f')]);}return _0xb17d60[_0x3376('0x126')](_0x127359);}})[_0x3376('0x12')](function(_0x399b55){if(_0x399b55){return _0x399b55?{'count':_0x3e4bda,'rows':_0x399b55}:null;}})[_0x3376('0x12')](respondWithResult(_0x3a61e9,null))[_0x3376('0x47')](handleError(_0x3a61e9,null));}; \ No newline at end of file +var _0x2918=['UserProfileResource','name','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','ChatWebsiteId','removeDispositions','ids','addAnswer','CannedAnswer','pick','rows','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','join','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','existsSync','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','CompanyId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','interaction','spread','firstName','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','from\x20is\x20mandatory','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','ListId','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','user','MailAccountId','subjectOffline','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','color','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','utf8','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','hideWhenOffline','transaction','ISOLATION_LEVELS','ChatApplication','stack','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','ChatWebsites'];(function(_0x1a54c2,_0xca7365){var _0x72d724=function(_0x423c3e){while(--_0x423c3e){_0x1a54c2['push'](_0x1a54c2['shift']());}};_0x72d724(++_0xca7365);}(_0x2918,0xf7));var _0x8291=function(_0x1a30ce,_0x4f7b65){_0x1a30ce=_0x1a30ce-0x0;var _0x2b42e8=_0x2918[_0x1a30ce];return _0x2b42e8;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x8291('0x0'));var util=require(_0x8291('0x1'));var path=require('path');var ejs=require(_0x8291('0x2'));var fs=require('fs');var fs_extra=require(_0x8291('0x3'));var _=require(_0x8291('0x4'));var querystring=require(_0x8291('0x5'));var Redis=require(_0x8291('0x6'));var qs=require(_0x8291('0x7'));var logger=require(_0x8291('0x8'))('api');var config=require(_0x8291('0x9'));var db=require('../../mysqldb')['db'];config[_0x8291('0xa')]=_[_0x8291('0xb')](config[_0x8291('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8291('0xc'))(new Redis(config['redis']));require(_0x8291('0xd'))[_0x8291('0xe')](socket);var htmlToText=require(_0x8291('0xf'));var jayson=require(_0x8291('0x10'));var client=jayson[_0x8291('0x11')][_0x8291('0x12')]({'port':0x232c});var client9002=jayson[_0x8291('0x11')][_0x8291('0x12')]({'port':0x232a});var client9003=jayson[_0x8291('0x11')][_0x8291('0x12')]({'port':0x232b});var client9001=jayson[_0x8291('0x11')][_0x8291('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x3780f0,_0x3e87fa,_0xf6339a,_0x58ecfe){return new BPromise(function(_0x16a8cf,_0x115f85){var _0x17bf54=_0x58ecfe||client;return _0x17bf54[_0x8291('0x13')](_0x3780f0,_0xf6339a)[_0x8291('0x14')](function(_0x317036){logger[_0x8291('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x3e87fa,'request\x20sent');logger[_0x8291('0x16')](_0x8291('0x17'),_0x3e87fa,_0x8291('0x18'),JSON[_0x8291('0x19')](_0x317036));if(_0x317036[_0x8291('0x1a')]){if(_0x317036[_0x8291('0x1a')]['code']===0x1f4){logger['error'](_0x8291('0x1b'),_0x3e87fa,_0x317036[_0x8291('0x1a')][_0x8291('0x1c')]);return _0x115f85(_0x317036[_0x8291('0x1a')][_0x8291('0x1c')]);}logger['error'](_0x8291('0x1b'),_0x3e87fa,_0x317036[_0x8291('0x1a')][_0x8291('0x1c')]);return _0x16a8cf(_0x317036['error'][_0x8291('0x1c')]);}else{logger['info'](_0x8291('0x1b'),_0x3e87fa,_0x8291('0x18'));_0x16a8cf(_0x317036[_0x8291('0x1d')][_0x8291('0x1c')]);}})[_0x8291('0x1e')](function(_0x189b9f){logger['error'](_0x8291('0x1b'),_0x3e87fa,_0x189b9f);_0x115f85(_0x189b9f);});});}function respondWithStatusCode(_0x47146c,_0xd0e730){_0xd0e730=_0xd0e730||0xcc;return function(_0x51938a){if(_0x51938a){return _0x47146c[_0x8291('0x1f')](_0xd0e730);}return _0x47146c[_0x8291('0x20')](_0xd0e730)[_0x8291('0x21')]();};}function respondWithResult(_0x4e1fe8,_0x52ce0a){_0x52ce0a=_0x52ce0a||0xc8;return function(_0x2f3ce4){if(_0x2f3ce4){return _0x4e1fe8[_0x8291('0x20')](_0x52ce0a)[_0x8291('0x22')](_0x2f3ce4);}};}function respondWithFilteredResult(_0x2290dd,_0xd1b269){return function(_0x3dd3e3){if(_0x3dd3e3){var _0xd13709=typeof _0xd1b269[_0x8291('0x23')]===_0x8291('0x24')&&typeof _0xd1b269[_0x8291('0x25')]===_0x8291('0x24');var _0x1f49a4=_0x3dd3e3[_0x8291('0x26')];var _0x4f0293=_0xd13709?0x0:_0xd1b269[_0x8291('0x23')];var _0x10568d=_0xd13709?_0x3dd3e3[_0x8291('0x26')]:_0xd1b269[_0x8291('0x23')]+_0xd1b269[_0x8291('0x25')];var _0x5d0ae8;if(_0x10568d>=_0x1f49a4){_0x10568d=_0x1f49a4;_0x5d0ae8=0xc8;}else{_0x5d0ae8=0xce;}_0x2290dd[_0x8291('0x20')](_0x5d0ae8);return _0x2290dd[_0x8291('0x27')](_0x8291('0x28'),_0x4f0293+'-'+_0x10568d+'/'+_0x1f49a4)[_0x8291('0x22')](_0x3dd3e3);}return null;};}function saveUpdates(_0x3b01a3){return function(_0x5eb002){if(_0x5eb002){return _0x5eb002[_0x8291('0x29')](_0x3b01a3)[_0x8291('0x14')](function(_0x4894a3){return _0x4894a3;});}return null;};}function removeEntity(_0x2b949e){return function(_0x50210b){if(_0x50210b){return _0x50210b[_0x8291('0x2a')]()[_0x8291('0x14')](function(){var _0x39a213=_0x50210b[_0x8291('0x2b')]({'plain':!![]});var _0x22c33f=_0x8291('0x2c');return db[_0x8291('0x2d')][_0x8291('0x2a')]({'where':{'type':_0x22c33f,'resourceId':_0x39a213['id']}})['then'](function(){return _0x50210b;});})[_0x8291('0x14')](function(){_0x2b949e['status'](0xcc)[_0x8291('0x21')]();});}};}function handleEntityNotFound(_0x476ec9){return function(_0x3f6375){if(!_0x3f6375){_0x476ec9[_0x8291('0x1f')](0x194);}return _0x3f6375;};}function handleError(_0x56ad68,_0x4b9b14){_0x4b9b14=_0x4b9b14||0x1f4;return function(_0x4a4377){logger['error'](_0x4a4377['stack']);if(_0x4a4377[_0x8291('0x2e')]){delete _0x4a4377[_0x8291('0x2e')];}_0x56ad68[_0x8291('0x20')](_0x4b9b14)['send'](_0x4a4377);};}exports['index']=function(_0x32caeb,_0x4ae6cd){var _0x364c1e={'include':[{'model':db[_0x8291('0x2f')],'as':_0x8291('0x30')}]},_0x31bf68={},_0x1256f3={'count':0x0,'rows':[]};var _0x40fd8c=_[_0x8291('0x31')](db[_0x8291('0x32')]['rawAttributes'],function(_0x533664){return{'name':_0x533664[_0x8291('0x33')],'type':_0x533664[_0x8291('0x34')][_0x8291('0x35')]};});_0x31bf68[_0x8291('0x36')]=_[_0x8291('0x31')](_0x40fd8c,_0x8291('0x2e'));_0x31bf68[_0x8291('0x37')]=_[_0x8291('0x38')](_0x32caeb[_0x8291('0x37')]);_0x31bf68[_0x8291('0x39')]=_[_0x8291('0x3a')](_0x31bf68['model'],_0x31bf68[_0x8291('0x37')]);_0x364c1e[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x31bf68['model'],qs[_0x8291('0x3c')](_0x32caeb[_0x8291('0x37')][_0x8291('0x3c')]));_0x364c1e[_0x8291('0x3b')]=_0x364c1e[_0x8291('0x3b')][_0x8291('0x3d')]?_0x364c1e[_0x8291('0x3b')]:_0x31bf68['model'];if(!_0x32caeb[_0x8291('0x37')][_0x8291('0x3e')](_0x8291('0x3f'))){_0x364c1e['limit']=qs['limit'](_0x32caeb[_0x8291('0x37')]['limit']);_0x364c1e[_0x8291('0x23')]=qs[_0x8291('0x23')](_0x32caeb['query'][_0x8291('0x23')]);}_0x364c1e[_0x8291('0x40')]=qs['sort'](_0x32caeb[_0x8291('0x37')][_0x8291('0x41')]);_0x364c1e[_0x8291('0x42')]=qs[_0x8291('0x39')](_['pick'](_0x32caeb[_0x8291('0x37')],_0x31bf68[_0x8291('0x39')]),_0x40fd8c);if(_0x32caeb[_0x8291('0x37')][_0x8291('0x43')]){_0x364c1e['where']=_[_0x8291('0x44')](_0x364c1e[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0x40fd8c,function(_0x2d081d){if(_0x2d081d[_0x8291('0x34')]!==_0x8291('0x45')){var _0x256c3f={};_0x256c3f[_0x2d081d[_0x8291('0x2e')]]={'$like':'%'+_0x32caeb[_0x8291('0x37')][_0x8291('0x43')]+'%'};return _0x256c3f;}})});}_0x364c1e=_[_0x8291('0x44')]({},_0x364c1e,_0x32caeb[_0x8291('0x46')]);var _0x154ca8={'where':_0x364c1e['where']};return db['ChatWebsite'][_0x8291('0x26')](_0x154ca8)[_0x8291('0x14')](function(_0x281f8b){_0x1256f3['count']=_0x281f8b;if(_0x32caeb['query'][_0x8291('0x47')]){_0x364c1e[_0x8291('0x48')]=[{'all':!![]}];}return db['ChatWebsite'][_0x8291('0x49')](_0x364c1e);})[_0x8291('0x14')](function(_0x4e3218){_0x1256f3['rows']=_0x4e3218;return _0x1256f3;})[_0x8291('0x14')](respondWithFilteredResult(_0x4ae6cd,_0x364c1e))['catch'](handleError(_0x4ae6cd,null));};exports[_0x8291('0x4a')]=function(_0x1f8f41,_0x39248f){var _0x32822a={'raw':![],'where':{'id':_0x1f8f41[_0x8291('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0x8291('0x30')}]},_0x44c23e={};_0x44c23e[_0x8291('0x36')]=_[_0x8291('0x38')](db[_0x8291('0x32')]['rawAttributes']);_0x44c23e[_0x8291('0x37')]=_[_0x8291('0x38')](_0x1f8f41[_0x8291('0x37')]);_0x44c23e['filters']=_[_0x8291('0x3a')](_0x44c23e[_0x8291('0x36')],_0x44c23e['query']);_0x32822a[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x44c23e['model'],qs[_0x8291('0x3c')](_0x1f8f41[_0x8291('0x37')]['fields']));_0x32822a[_0x8291('0x3b')]=_0x32822a[_0x8291('0x3b')][_0x8291('0x3d')]?_0x32822a[_0x8291('0x3b')]:_0x44c23e[_0x8291('0x36')];if(_0x1f8f41[_0x8291('0x37')][_0x8291('0x47')]){_0x32822a[_0x8291('0x48')]=[{'all':!![]}];}_0x32822a=_[_0x8291('0x44')]({},_0x32822a,_0x1f8f41[_0x8291('0x46')]);return db[_0x8291('0x32')][_0x8291('0x4c')](_0x32822a)['then'](handleEntityNotFound(_0x39248f,null))[_0x8291('0x14')](respondWithResult(_0x39248f,null))[_0x8291('0x1e')](handleError(_0x39248f,null));};exports['create']=function(_0x5d7f4e,_0x5e09ac){return db[_0x8291('0x32')]['create'](_0x5d7f4e[_0x8291('0x4d')],{})[_0x8291('0x14')](function(_0x46f3d3){var _0x1ff2f9=_0x5d7f4e['user']['get']({'plain':!![]});if(!_0x1ff2f9)throw new Error(_0x8291('0x4e'));if(_0x1ff2f9[_0x8291('0x4f')]==='user'){var _0x1c7087=_0x46f3d3[_0x8291('0x2b')]({'plain':!![]});var _0x4e260f='ChatWebsites';return db[_0x8291('0x50')][_0x8291('0x4c')]({'where':{'name':_0x4e260f,'userProfileId':_0x1ff2f9[_0x8291('0x51')]},'raw':!![]})[_0x8291('0x14')](function(_0x506a47){if(_0x506a47&&_0x506a47[_0x8291('0x52')]===0x0){return db['UserProfileResource'][_0x8291('0x53')]({'name':_0x1c7087['name'],'resourceId':_0x1c7087['id'],'type':_0x506a47[_0x8291('0x2e')],'sectionId':_0x506a47['id']},{})[_0x8291('0x14')](function(){return _0x46f3d3;});}else{return _0x46f3d3;}})[_0x8291('0x1e')](function(_0x403402){logger[_0x8291('0x1a')](_0x8291('0x54'),_0x403402);throw _0x403402;});}return _0x46f3d3;})[_0x8291('0x14')](respondWithResult(_0x5e09ac,0xc9))['catch'](handleError(_0x5e09ac,null));};exports['update']=function(_0x2c9a70,_0x1cf8f2){if(_0x2c9a70[_0x8291('0x4d')]['id']){delete _0x2c9a70['body']['id'];}return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x2c9a70[_0x8291('0x4b')]['id']},'include':[{'model':db[_0x8291('0x2f')],'as':_0x8291('0x30')}]})['then'](handleEntityNotFound(_0x1cf8f2,null))[_0x8291('0x14')](saveUpdates(_0x2c9a70['body'],null))[_0x8291('0x14')](respondWithResult(_0x1cf8f2,null))[_0x8291('0x1e')](handleError(_0x1cf8f2,null));};exports['destroy']=function(_0x111f13,_0x19a6ff){return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x111f13[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x19a6ff,null))[_0x8291('0x14')](removeEntity(_0x19a6ff,null))[_0x8291('0x1e')](handleError(_0x19a6ff,null));};exports[_0x8291('0x55')]=function(_0x4d7946,_0x574f2f){return db[_0x8291('0x32')][_0x8291('0x55')]()[_0x8291('0x14')](respondWithResult(_0x574f2f,null))[_0x8291('0x1e')](handleError(_0x574f2f,null));};exports[_0x8291('0x56')]=function(_0x14cd72,_0xba95be){if(_0x14cd72[_0x8291('0x4d')]['id']){delete _0x14cd72[_0x8291('0x4d')]['id'];}return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x14cd72[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0xba95be,null))[_0x8291('0x14')](function(_0x28beb9){if(_0x28beb9){_0x14cd72[_0x8291('0x4d')]['ChatWebsiteId']=_0x28beb9['id'];return db[_0x8291('0x57')]['create'](_0x14cd72[_0x8291('0x4d')]);}})[_0x8291('0x14')](respondWithResult(_0xba95be,null))[_0x8291('0x1e')](handleError(_0xba95be,null));};exports[_0x8291('0x58')]=function(_0x79e921,_0x5b76df){var _0x4a9a12={'raw':![],'where':{}};var _0x986a96={};var _0x4fd2cb={'count':0x0,'rows':[]};return db[_0x8291('0x32')][_0x8291('0x59')]({'where':{'id':_0x79e921[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x5b76df,null))[_0x8291('0x14')](function(_0x25fb32){if(_0x25fb32){_0x986a96[_0x8291('0x36')]=_[_0x8291('0x38')](db['Disposition'][_0x8291('0x5a')]);_0x986a96[_0x8291('0x37')]=_['keys'](_0x79e921[_0x8291('0x37')]);_0x986a96[_0x8291('0x39')]=_['intersection'](_0x986a96[_0x8291('0x36')],_0x986a96[_0x8291('0x37')]);_0x4a9a12[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x986a96[_0x8291('0x36')],qs[_0x8291('0x3c')](_0x79e921[_0x8291('0x37')][_0x8291('0x3c')]));_0x4a9a12[_0x8291('0x3b')]=_0x4a9a12['attributes']['length']?_0x4a9a12[_0x8291('0x3b')]:_0x986a96[_0x8291('0x36')];if(!_0x79e921[_0x8291('0x37')][_0x8291('0x3e')](_0x8291('0x3f'))){_0x4a9a12[_0x8291('0x25')]=qs[_0x8291('0x25')](_0x79e921['query']['limit']);_0x4a9a12[_0x8291('0x23')]=qs[_0x8291('0x23')](_0x79e921[_0x8291('0x37')][_0x8291('0x23')]);}_0x4a9a12[_0x8291('0x40')]=qs[_0x8291('0x41')](_0x79e921[_0x8291('0x37')][_0x8291('0x41')]);_0x4a9a12[_0x8291('0x42')]=qs[_0x8291('0x39')](_['pick'](_0x79e921[_0x8291('0x37')],_0x986a96[_0x8291('0x39')]));_0x4a9a12[_0x8291('0x42')][_0x8291('0x5b')]=_0x25fb32['id'];if(_0x79e921['query']['filter']){_0x4a9a12[_0x8291('0x42')]=_[_0x8291('0x44')](_0x4a9a12['where'],{'$or':_[_0x8291('0x31')](_0x4a9a12[_0x8291('0x3b')],function(_0x20b14f){var _0x30d3a5={};_0x30d3a5[_0x20b14f]={'$like':'%'+_0x79e921[_0x8291('0x37')]['filter']+'%'};return _0x30d3a5;})});}_0x4a9a12=_[_0x8291('0x44')]({},_0x4a9a12,_0x79e921[_0x8291('0x46')]);return db[_0x8291('0x57')][_0x8291('0x26')]({'where':_0x4a9a12[_0x8291('0x42')]})[_0x8291('0x14')](function(_0x385482){_0x4fd2cb['count']=_0x385482;if(_0x79e921[_0x8291('0x37')][_0x8291('0x47')]){_0x4a9a12[_0x8291('0x48')]=[{'all':!![]}];}return db[_0x8291('0x57')]['findAll'](_0x4a9a12);})[_0x8291('0x14')](function(_0x414da2){_0x4fd2cb['rows']=_0x414da2;return _0x4fd2cb;});}})[_0x8291('0x14')](respondWithFilteredResult(_0x5b76df,_0x4a9a12))['catch'](handleError(_0x5b76df,null));};exports[_0x8291('0x5c')]=function(_0x580686,_0x410cab){return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x580686['params']['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x410cab,null))[_0x8291('0x14')](function(_0x282b06){if(_0x282b06){return _0x282b06['removeDispositions'](_0x580686['query'][_0x8291('0x5d')]);}})[_0x8291('0x14')](respondWithStatusCode(_0x410cab,null))[_0x8291('0x1e')](handleError(_0x410cab,null));};exports[_0x8291('0x5e')]=function(_0x52b3d6,_0x33acef){if(_0x52b3d6['body']['id']){delete _0x52b3d6[_0x8291('0x4d')]['id'];}return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x52b3d6[_0x8291('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33acef,null))[_0x8291('0x14')](function(_0x3faf1a){if(_0x3faf1a){_0x52b3d6[_0x8291('0x4d')][_0x8291('0x5b')]=_0x3faf1a['id'];return db[_0x8291('0x5f')][_0x8291('0x53')](_0x52b3d6[_0x8291('0x4d')]);}})[_0x8291('0x14')](respondWithResult(_0x33acef,null))[_0x8291('0x1e')](handleError(_0x33acef,null));};exports['getAnswers']=function(_0xb0a848,_0x134bd4){var _0xea405={'raw':![],'where':{}};var _0x1abd21={};var _0x3c8d34={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x8291('0x59')]({'where':{'id':_0xb0a848[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x134bd4,null))[_0x8291('0x14')](function(_0x4cff7a){if(_0x4cff7a){_0x1abd21['model']=_[_0x8291('0x38')](db[_0x8291('0x5f')][_0x8291('0x5a')]);_0x1abd21[_0x8291('0x37')]=_[_0x8291('0x38')](_0xb0a848[_0x8291('0x37')]);_0x1abd21[_0x8291('0x39')]=_['intersection'](_0x1abd21[_0x8291('0x36')],_0x1abd21[_0x8291('0x37')]);_0xea405['attributes']=_[_0x8291('0x3a')](_0x1abd21['model'],qs['fields'](_0xb0a848[_0x8291('0x37')][_0x8291('0x3c')]));_0xea405['attributes']=_0xea405['attributes'][_0x8291('0x3d')]?_0xea405[_0x8291('0x3b')]:_0x1abd21[_0x8291('0x36')];if(!_0xb0a848[_0x8291('0x37')]['hasOwnProperty']('nolimit')){_0xea405[_0x8291('0x25')]=qs[_0x8291('0x25')](_0xb0a848[_0x8291('0x37')][_0x8291('0x25')]);_0xea405[_0x8291('0x23')]=qs['offset'](_0xb0a848['query']['offset']);}_0xea405[_0x8291('0x40')]=qs[_0x8291('0x41')](_0xb0a848[_0x8291('0x37')][_0x8291('0x41')]);_0xea405['where']=qs['filters'](_[_0x8291('0x60')](_0xb0a848['query'],_0x1abd21['filters']));_0xea405[_0x8291('0x42')][_0x8291('0x5b')]=_0x4cff7a['id'];if(_0xb0a848[_0x8291('0x37')][_0x8291('0x43')]){_0xea405[_0x8291('0x42')]=_['merge'](_0xea405[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0xea405[_0x8291('0x3b')],function(_0x28c091){var _0x1104a4={};_0x1104a4[_0x28c091]={'$like':'%'+_0xb0a848['query'][_0x8291('0x43')]+'%'};return _0x1104a4;})});}_0xea405=_[_0x8291('0x44')]({},_0xea405,_0xb0a848[_0x8291('0x46')]);return db[_0x8291('0x5f')]['count']({'where':_0xea405['where']})[_0x8291('0x14')](function(_0x3d0636){_0x3c8d34[_0x8291('0x26')]=_0x3d0636;if(_0xb0a848['query'][_0x8291('0x47')]){_0xea405['include']=[{'all':!![]}];}return db[_0x8291('0x5f')][_0x8291('0x49')](_0xea405);})['then'](function(_0x77e82){_0x3c8d34[_0x8291('0x61')]=_0x77e82;return _0x3c8d34;});}})[_0x8291('0x14')](respondWithFilteredResult(_0x134bd4,_0xea405))[_0x8291('0x1e')](handleError(_0x134bd4,null));};exports[_0x8291('0x62')]=function(_0x4f7cb4,_0x2ac9b0){return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x4f7cb4[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x2ac9b0,null))[_0x8291('0x14')](function(_0x5c1b5f){if(_0x5c1b5f){return _0x5c1b5f['removeAnswers'](_0x4f7cb4[_0x8291('0x37')][_0x8291('0x5d')]);}})[_0x8291('0x14')](respondWithStatusCode(_0x2ac9b0,null))[_0x8291('0x1e')](handleError(_0x2ac9b0,null));};exports[_0x8291('0x63')]=function(_0x39953f,_0x596c4a){_0x39953f[_0x8291('0x4d')][_0x8291('0x64')]=_0x39953f[_0x8291('0x65')]['filename'];return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x39953f['params']['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x596c4a,null))['then'](saveUpdates(_0x39953f['body'],null))['then'](respondWithResult(_0x596c4a,null))['catch'](handleError(_0x596c4a,null));};exports[_0x8291('0x66')]=function(_0x3265b0,_0x3a1199){_0x3265b0['body'][_0x8291('0x67')]=_0x3265b0['file'][_0x8291('0x68')];return db[_0x8291('0x32')]['find']({'where':{'id':_0x3265b0[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x3a1199,null))[_0x8291('0x14')](saveUpdates(_0x3265b0[_0x8291('0x4d')],null))[_0x8291('0x14')](respondWithResult(_0x3a1199,null))[_0x8291('0x1e')](handleError(_0x3a1199,null));};exports[_0x8291('0x69')]=function(_0xb5739d,_0x325f90){_0xb5739d[_0x8291('0x4d')][_0x8291('0x6a')]=_0xb5739d[_0x8291('0x65')][_0x8291('0x68')];return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0xb5739d[_0x8291('0x4b')]['id']}})['then'](handleEntityNotFound(_0x325f90,null))[_0x8291('0x14')](saveUpdates(_0xb5739d['body'],null))['then'](respondWithResult(_0x325f90,null))[_0x8291('0x1e')](handleError(_0x325f90,null));};exports[_0x8291('0x6b')]=function(_0x331bd5,_0xe83597){_0x331bd5[_0x8291('0x4d')][_0x8291('0x6c')]=_0x331bd5['file']['filename'];return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x331bd5[_0x8291('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe83597,null))[_0x8291('0x14')](saveUpdates(_0x331bd5[_0x8291('0x4d')],null))[_0x8291('0x14')](respondWithResult(_0xe83597,null))[_0x8291('0x1e')](handleError(_0xe83597,null));};exports[_0x8291('0x6d')]=function(_0x5782c8,_0x164808){var _0x4293c4=path['join'](config[_0x8291('0x6e')],'server/files/images/logos/default_logo.svg');var _0x45d910={'where':{'id':_0x5782c8[_0x8291('0x4b')]['id']},'attributes':['id',_0x8291('0x64')],'raw':!![]};var _0x39096d=![];return require(_0x8291('0x6f'))[_0x8291('0x70')]()[_0x8291('0x14')](function(_0x306108){if(_0x306108){_0x39096d=_0x306108[_0x8291('0x71')];}})[_0x8291('0x14')](function(){return db[_0x8291('0x32')][_0x8291('0x4c')](_0x45d910);})[_0x8291('0x14')](handleEntityNotFound(_0x164808,null))['then'](function(_0x1c2dd1){if(_0x1c2dd1){if(!_[_0x8291('0x72')](_0x1c2dd1[_0x8291('0x64')])){if(fs['existsSync'](path['join'](config[_0x8291('0x6e')],'server/files/images/logos/',_0x1c2dd1['sitepic']))&&_0x39096d){_0x4293c4=path[_0x8291('0x73')](config['root'],'server/files/images/logos/',_0x1c2dd1[_0x8291('0x64')]);}}return _0x164808[_0x8291('0x74')](_0x4293c4);}})[_0x8291('0x1e')](handleError(_0x164808,null));};exports[_0x8291('0x75')]=function(_0xd67700,_0x1f2431){var _0x3d767c=path['join'](config['root'],_0x8291('0x76'));var _0x26bda4={'where':{'id':_0xd67700[_0x8291('0x4b')]['id']},'attributes':['id',_0x8291('0x67')],'raw':!![]};return db[_0x8291('0x32')][_0x8291('0x4c')](_0x26bda4)['then'](handleEntityNotFound(_0x1f2431,null))[_0x8291('0x14')](function(_0x1273d4){if(_0x1273d4){if(!_[_0x8291('0x72')](_0x1273d4[_0x8291('0x67')])){if(fs['existsSync'](path[_0x8291('0x73')](config['root'],_0x8291('0x77'),_0x1273d4[_0x8291('0x67')]))){_0x3d767c=path[_0x8291('0x73')](config[_0x8291('0x6e')],'server/files/images/avatars/',_0x1273d4[_0x8291('0x67')]);}}return _0x1f2431['download'](_0x3d767c);}})[_0x8291('0x1e')](handleError(_0x1f2431,null));};exports[_0x8291('0x78')]=function(_0x4cab75,_0x4a2ea0){var _0x398374=path[_0x8291('0x73')](config[_0x8291('0x6e')],'server/files/images/avatars/customer_avatar.png');var _0x15809a={'where':{'id':_0x4cab75['params']['id']},'attributes':['id',_0x8291('0x6a'),_0x8291('0x79')],'raw':!![]};return db[_0x8291('0x32')][_0x8291('0x4c')](_0x15809a)['then'](handleEntityNotFound(_0x4a2ea0,null))[_0x8291('0x14')](function(_0x402d75){if(_0x402d75){if(!_[_0x8291('0x72')](_0x402d75['customerAvatar'])){if(fs[_0x8291('0x7a')](path[_0x8291('0x73')](config[_0x8291('0x6e')],_0x8291('0x77'),_0x402d75[_0x8291('0x6a')]))&&_0x402d75[_0x8291('0x79')]){_0x398374=path['join'](config[_0x8291('0x6e')],_0x8291('0x77'),_0x402d75['customerAvatar']);}}return _0x4a2ea0['download'](_0x398374);}})[_0x8291('0x1e')](handleError(_0x4a2ea0,null));};exports['getSystemAvatar']=function(_0x492126,_0x16217e){var _0x5a6515=path[_0x8291('0x73')](config['root'],_0x8291('0x7b'));var _0x46f7c9={'where':{'id':_0x492126[_0x8291('0x4b')]['id']},'attributes':['id',_0x8291('0x6c')],'raw':!![]};return db['ChatWebsite'][_0x8291('0x4c')](_0x46f7c9)['then'](handleEntityNotFound(_0x16217e,null))[_0x8291('0x14')](function(_0x25b571){if(_0x25b571){if(!_[_0x8291('0x72')](_0x25b571['systemAvatar'])){if(fs[_0x8291('0x7a')](path[_0x8291('0x73')](config[_0x8291('0x6e')],'server/files/images/avatars/',_0x25b571['systemAvatar']))){_0x5a6515=path[_0x8291('0x73')](config['root'],_0x8291('0x77'),_0x25b571['systemAvatar']);}}return _0x16217e['download'](_0x5a6515);}})[_0x8291('0x1e')](handleError(_0x16217e,null));};exports[_0x8291('0x7c')]=function(_0x330f42,_0x1edb00){var _0x39d4e6=require(_0x8291('0x7d'));var _0x48877=new _0x39d4e6();var _0x336967=_0x48877[_0x8291('0x7e')](_0x330f42[_0x8291('0x7f')][_0x8291('0x80')])['getResult']();var _0x4d6867={'body':_0x330f42[_0x8291('0x4d')],'channel':_0x8291('0x81')};var _0x40d973=[];var _0x576506=[];var _0x909d0c={};var _0x277b27=![];return db[_0x8291('0x82')][_0x8291('0x55')]()['then'](function(_0x5b681c){if(!_0x5b681c){throw new db[(_0x8291('0x83'))][(_0x8291('0x84'))](_0x8291('0x85'));}_0x40d973=_['difference'](_[_0x8291('0x38')](_0x5b681c),[_0x8291('0x86'),'updatedAt']);_0x576506=_['difference'](_['keys'](_0x5b681c),[_0x8291('0x86'),'updatedAt',_0x8291('0x87'),'ListId']);if(_0x330f42[_0x8291('0x4d')]['id']){delete _0x330f42[_0x8291('0x4d')]['id'];}if(_[_0x8291('0x72')](_0x330f42['body'][_0x8291('0x88')])){throw new db[(_0x8291('0x83'))][(_0x8291('0x84'))]('from\x20is\x20mandatory');}if(_[_0x8291('0x72')](_0x330f42[_0x8291('0x4d')]['body'])||_0x330f42[_0x8291('0x4d')]['body']===''){throw new db[(_0x8291('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8291('0x72')](_0x330f42[_0x8291('0x4d')][_0x8291('0x89')])){throw new db['Sequelize'][(_0x8291('0x84'))](_0x8291('0x8a')+_0x576506);}if(!_[_0x8291('0x8b')](_0x576506,_0x330f42['body']['mapKey'])){throw new db[(_0x8291('0x83'))][(_0x8291('0x84'))](_0x8291('0x8c')+_0x576506);}_0x909d0c[_0x330f42[_0x8291('0x4d')][_0x8291('0x89')]]=_0x330f42['body'][_0x8291('0x88')];})[_0x8291('0x14')](function(){return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x330f42[_0x8291('0x4b')]['id']},'include':[{'model':db[_0x8291('0x8d')],'as':_0x8291('0x8e'),'include':[{'model':db[_0x8291('0x82')],'as':_0x8291('0x8f'),'where':_0x909d0c,'limit':0x1,'order':[['updatedAt',_0x8291('0x90')]]}]},{'model':db['ChatApplication'],'as':_0x8291('0x91')}]});})['then'](handleEntityNotFound(_0x1edb00,null))[_0x8291('0x14')](function(_0x70483c){if(_0x70483c&&_0x70483c[_0x8291('0x8e')]){_0x4d6867[_0x8291('0x92')]=_0x70483c;_0x4d6867[_0x8291('0x93')]=_0x70483c[_0x8291('0x91')];_0x4d6867['list']=_0x70483c[_0x8291('0x8e')];_0x4d6867[_0x8291('0x93')]=_[_0x8291('0x94')](_0x4d6867['applications'],[_0x8291('0x95')],[_0x8291('0x96')]);if(_0x4d6867[_0x8291('0x92')]['Applications']){delete _0x4d6867['account'][_0x8291('0x91')];}if(_0x4d6867['account'][_0x8291('0x8e')]&&_0x4d6867[_0x8291('0x92')]['List'][_0x8291('0x8f')][_0x8291('0x3d')]){return _0x4d6867[_0x8291('0x92')][_0x8291('0x8e')]['Contacts'][0x0];}var _0x494bae=_[_0x8291('0xb')](_0x330f42[_0x8291('0x4d')],{'firstName':_0x330f42[_0x8291('0x4d')][_0x8291('0x88')],'ListId':_0x70483c['ListId']});_0x494bae[_0x330f42[_0x8291('0x4d')]['mapKey']]=_0x330f42[_0x8291('0x4d')][_0x8291('0x88')];return db['CmContact']['create'](_0x494bae,{'fields':_0x40d973,'raw':!![]});}})['then'](handleEntityNotFound(_0x1edb00,null))[_0x8291('0x14')](function(_0x19fd96){_0x4d6867[_0x8291('0x97')]=_0x19fd96;var _0x1f985e=_0x330f42[_0x8291('0x4d')][_0x8291('0x98')];if(_0x330f42[_0x8291('0x7f')][_0x8291('0x99')]){_0x1f985e=_0x330f42[_0x8291('0x7f')][_0x8291('0x99')];}else if(_0x330f42['headers'][_0x8291('0x9a')]){_0x1f985e=_['first'](_0x330f42['headers'][_0x8291('0x9a')][_0x8291('0x9b')](','));}if(_0x19fd96){var _0x2765c7={'ContactId':_0x19fd96['id'],'ChatWebsiteId':_0x330f42['params']['id'],'from':(_0x19fd96['firstName']||'')+'\x20'+(_0x19fd96[_0x8291('0x9c')]||''),'customerIp':_0x1f985e,'customerPort':_0x330f42[_0x8291('0x7f')][_0x8291('0x9d')]?_0x330f42[_0x8291('0x7f')][_0x8291('0x9d')]:null,'referer':_0x330f42[_0x8291('0x4d')]['referer'],'browserName':_0x336967[_0x8291('0x9e')][_0x8291('0x2e')]&&_0x336967[_0x8291('0x9e')][_0x8291('0x9f')]?util[_0x8291('0xa0')](_0x8291('0xa1'),_0x336967[_0x8291('0x9e')][_0x8291('0x2e')],_0x336967[_0x8291('0x9e')][_0x8291('0x9f')]):_0x8291('0xa2'),'browserVersion':_0x336967[_0x8291('0x9e')][_0x8291('0x9f')]||_0x8291('0xa2'),'osName':util['format'](_0x8291('0xa1'),_0x336967['os'][_0x8291('0x2e')],_0x336967['os']['version']),'osVersion':_0x336967['os'][_0x8291('0x9f')],'deviceModel':_0x336967[_0x8291('0xa3')][_0x8291('0x36')]&&_0x336967[_0x8291('0xa3')][_0x8291('0xa4')]?util[_0x8291('0xa0')]('%s\x20%s\x20%s',_0x336967[_0x8291('0xa3')][_0x8291('0x36')],_0x336967[_0x8291('0xa3')]['vendor'],_0x336967['device'][_0x8291('0x34')]):null,'deviceVendor':_0x336967[_0x8291('0xa3')][_0x8291('0xa4')],'deviceType':_0x336967['device'][_0x8291('0x34')],'formData':JSON['stringify'](_0x330f42[_0x8291('0x4d')])};var _0x149f1a={'ChatWebsiteId':_0x330f42['params']['id'],'closed':![]};if(_0x330f42[_0x8291('0x4d')][_0x8291('0xa5')]){_0x149f1a[_0x8291('0xa5')]=_0x330f42[_0x8291('0x4d')]['threadId'];return db['ChatInteraction'][_0x8291('0x4c')]({'where':_0x149f1a})[_0x8291('0x14')](function(_0x2c5b8b){if(_0x2c5b8b){return[_0x2c5b8b,![]];}_0x2765c7['threadId']=_0x330f42['body'][_0x8291('0xa5')];_0x2765c7[_0x8291('0xa6')]=_0x330f42[_0x8291('0x4d')]['externalUrl'];return db[_0x8291('0xa7')][_0x8291('0x53')](_0x2765c7)[_0x8291('0x14')](function(_0x5b6adb){return[_0x5b6adb,!![]];});});}_0x149f1a['ContactId']=_0x19fd96['id'];if(_0x330f42[_0x8291('0x4d')][_0x8291('0xa8')]&&_0x330f42[_0x8291('0x4d')][_0x8291('0xa8')]['id']){_0x149f1a['id']=_0x330f42[_0x8291('0x4d')][_0x8291('0xa8')]['id'];return db[_0x8291('0xa7')][_0x8291('0x4c')]({'where':_0x149f1a})['then'](function(_0x2b7aa7){if(_0x2b7aa7){return[_0x2b7aa7,![]];}return db['ChatInteraction']['create'](_0x2765c7)[_0x8291('0x14')](function(_0x1cb4e4){return[_0x1cb4e4,!![]];});});}return db[_0x8291('0xa7')][_0x8291('0x53')](_0x2765c7)[_0x8291('0x14')](function(_0x38bc00){return[_0x38bc00,!![]];});}})[_0x8291('0xa9')](function(_0x1d1b47,_0x5e3b5b){if(_0x1d1b47){_0x277b27=_0x5e3b5b;if(!_0x5e3b5b){var _0x356f27={'from':(_0x4d6867['contact'][_0x8291('0xaa')]||'')+'\x20'+(_0x4d6867['contact'][_0x8291('0x9c')]||'')};if(_0x330f42[_0x8291('0x4d')][_0x8291('0xa5')]&&_0x330f42[_0x8291('0x4d')][_0x8291('0xab')]&&_0x330f42[_0x8291('0x4d')][_0x8291('0xa5')]!=_0x330f42['body']['messageId']){_0x356f27[_0x8291('0xa5')]=_0x330f42[_0x8291('0x4d')][_0x8291('0xab')];}return _0x1d1b47[_0x8291('0x29')](_0x356f27);}else{return _0x1d1b47;}}})[_0x8291('0x14')](function(_0x776cd5){_0x4d6867['interaction']=_0x776cd5[_0x8291('0x2b')]({'plain':!![]});_0x4d6867[_0x8291('0xa8')][_0x8291('0xac')]=_0x277b27;if(_0x4d6867[_0x8291('0xa8')][_0x8291('0xac')]){if(_0x4d6867[_0x8291('0x92')][_0x8291('0xad')]){_0x4d6867[_0x8291('0x93')][_0x8291('0xae')]({'id':0x0,'priority':_0x4d6867[_0x8291('0x93')][_0x8291('0x3d')]+0x1,'app':_0x8291('0xaf'),'appdata':'unmanaged','interval':_0x8291('0xb0')});}}return db['ChatMessage'][_0x8291('0x53')]({'body':_0x330f42['body'][_0x8291('0x4d')],'ChatWebsiteId':_0x330f42[_0x8291('0x4b')]['id'],'ChatInteractionId':_0x776cd5['id'],'direction':'in','ContactId':_0x4d6867[_0x8291('0x97')]['id'],'AttachmentId':_0x330f42['body'][_0x8291('0xb1')]});})[_0x8291('0x14')](function(_0x549f45){_0x4d6867[_0x8291('0x1c')]=_0x549f45;if(_0x4d6867[_0x8291('0xa8')][_0x8291('0xb2')]){return db[_0x8291('0xb3')][_0x8291('0x4c')]({'attributes':['id',_0x8291('0x2e')],'where':{'id':_0x4d6867[_0x8291('0xa8')]['UserId']}})['then'](function(_0x203aea){if(_0x203aea){_0x4d6867[_0x8291('0x93')][_0x8291('0xb4')]({'id':0x0,'priority':0x0,'app':_0x8291('0xb5'),'appdata':_0x203aea['name']+','+(_0x4d6867[_0x8291('0x92')][_0x8291('0xb6')]||0xa),'interval':_0x8291('0xb0')});_0x4d6867[_0x8291('0xb7')]=!![];}return respondWithRpcPromise(_0x8291('0xb8'),_0x8291('0xb9'),_0x4d6867);});}return respondWithRpcPromise('Start',_0x8291('0xb9'),_0x4d6867);})['then'](function(_0x505d70){respondWithRpcPromise(_0x8291('0xba'),_0x8291('0xba'),{'event':_0x8291('0x7c'),'message':_0x505d70},client9002);return _0x505d70;})[_0x8291('0x14')](respondWithResult(_0x1edb00,null))['catch'](handleError(_0x1edb00,null));};exports[_0x8291('0xbb')]=function(_0x1a6651,_0x30a2cf){var _0x592d62,_0x324c23,_0x2c96fd;var _0x48767a=[];var _0x5ebb29={};var _0x1e7e63=_0x1a6651[_0x8291('0xbc')]||[];var _0x1e0995=[];var _0x547a07;return db['CmContact']['describe']()['then'](function(_0x3cc485){if(!_0x3cc485){throw new db[(_0x8291('0x83'))][(_0x8291('0x84'))](_0x8291('0x85'));}_0x48767a=_[_0x8291('0xbd')](_[_0x8291('0x38')](_0x3cc485),[_0x8291('0x86'),'updatedAt',_0x8291('0x87'),'ListId']);if(_0x1a6651[_0x8291('0x4d')]['id']){delete _0x1a6651[_0x8291('0x4d')]['id'];}if(_[_0x8291('0x72')](_0x1a6651[_0x8291('0x4d')]['from'])){throw _0x30a2cf[_0x8291('0x20')](0x1f4)['send'](new db[(_0x8291('0x83'))][(_0x8291('0x84'))](_0x8291('0xbe')));}if(_[_0x8291('0x72')](_0x1a6651[_0x8291('0x4d')][_0x8291('0x4d')])||_0x1a6651[_0x8291('0x4d')][_0x8291('0x4d')]===''){throw _0x30a2cf[_0x8291('0x20')](0x1f4)[_0x8291('0xbf')](new db[(_0x8291('0x83'))]['ValidationError'](_0x8291('0xc0')));}if(_[_0x8291('0x72')](_0x1a6651['body'][_0x8291('0xc1')])){throw _0x30a2cf['status'](0x1f4)[_0x8291('0xbf')](new db['Sequelize'][(_0x8291('0x84'))](_0x8291('0xc2')+_0x48767a));}if(!_[_0x8291('0x8b')](_0x48767a,_0x1a6651['body']['mapKeyOffline'])){throw _0x30a2cf[_0x8291('0x20')](0x1f4)[_0x8291('0xbf')](new db[(_0x8291('0x83'))][(_0x8291('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x48767a));}_0x5ebb29[_0x1a6651[_0x8291('0x4d')][_0x8291('0xc1')]]=_0x1a6651['body'][_0x8291('0x88')];})[_0x8291('0x14')](function(){return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x1a6651[_0x8291('0x4b')]['id']},'include':[{'model':db[_0x8291('0x8d')],'as':'List'},{'model':db['MailAccount'],'as':_0x8291('0xc3')}]});})[_0x8291('0x14')](handleEntityNotFound(_0x30a2cf,null))['then'](function(_0x2d3c11){if(_0x2d3c11&&_0x2d3c11[_0x8291('0x8e')]){_0x324c23=_0x2d3c11;var _0xfc57f8=_[_0x8291('0xb')](_0x1a6651[_0x8291('0x4d')],{'firstName':_0x1a6651[_0x8291('0x4d')][_0x8291('0x88')],'phone':_0x1a6651[_0x8291('0x4d')][_0x8291('0x88')],'ListId':_0x2d3c11[_0x8291('0xc4')]});_0xfc57f8[_0x1a6651['body'][_0x8291('0xc1')]]=_0x1a6651[_0x8291('0x4d')][_0x8291('0x88')];return db[_0x8291('0x82')][_0x8291('0xc5')]({'where':_0x5ebb29,'defaults':_0xfc57f8});}})['spread'](function(_0x5d01fd){if(_0x5d01fd){_0x2c96fd=_0x5d01fd;var _0xdfe5f8=fs['readFileSync'](path[_0x8291('0x73')](config[_0x8291('0x6e')],_0x8291('0xc6')),'utf8');var _0x224acc=ejs[_0x8291('0xc7')](_0xdfe5f8,{'body':_[_0x8291('0xc8')](_0x1a6651['body']['body']),'bodyTitle':_0x324c23[_0x8291('0xc9')]});return db[_0x8291('0xca')][_0x8291('0x53')]({'body':_0x224acc,'plainBody':htmlToText[_0x8291('0xcb')](_0x224acc),'ContactId':_0x5d01fd['id'],'ChatWebsiteId':_0x324c23['id']});}})[_0x8291('0x14')](function(_0x31d071){_0x547a07=_0x31d071;if(_0x1e7e63['length']){var _0x355f4b=_0x1e7e63[_0x8291('0x31')](function(_0xd42789){return{'name':_0xd42789[_0x8291('0xcc')],'basename':_0xd42789[_0x8291('0x68')],'type':_0xd42789['mimetype'],'ChatOfflineMessageId':_0x31d071['id']};});_0x1e0995=_0x355f4b[_0x8291('0x31')](_0x2b7327=>{var _0x21a57a={'filename':_0x2b7327[_0x8291('0x2e')],'path':path[_0x8291('0x73')](config[_0x8291('0x6e')],_0x8291('0xcd'),_0x8291('0xbc'),'attachments',_0x8291('0xce'),_0x2b7327[_0x8291('0xcf')])};return _0x21a57a;});if(!_0x324c23[_0x8291('0xd0')]){return db[_0x8291('0xd1')]['transaction'](function(_0x3208cf){return db[_0x8291('0xd2')][_0x8291('0xd3')](_0x355f4b,{'transaction':_0x3208cf});});}}})[_0x8291('0x14')](function(){if(_0x547a07){_0x592d62=_0x547a07;return db['MailAccount'][_0x8291('0x59')]({'where':{'service':!![]},'include':[{'model':db[_0x8291('0xd4')],'as':_0x8291('0xd5'),'raw':!![],'include':[{'model':db[_0x8291('0xd6')],'as':_0x8291('0xd6'),'raw':!![]}]}]});}})[_0x8291('0x14')](function(_0x5cfb00){if(_0x5cfb00&&_0x5cfb00['Smtp']&&_0x324c23[_0x8291('0xd7')]&&_0x324c23[_0x8291('0xd8')]){var _0xb8685c=_0x5cfb00[_0x8291('0xd9')]();return respondWithRpcPromise(_0x8291('0xda'),_0x8291('0xdb'),{'account':_0xb8685c,'message':{'from':util[_0x8291('0xa0')](_0x8291('0xdc'),_0x5cfb00[_0x8291('0x2e')],_0x5cfb00[_0x8291('0xdd')]||_0x5cfb00['Smtp'][_0x8291('0xde')]),'to':_0x324c23['forwardOfflineAddress'],'subject':_0x324c23['offlineMessageSubject'],'html':_0x592d62['body'],'attachments':_0x1e0995}},client9003)[_0x8291('0x14')](function(){return _0x592d62;})[_0x8291('0x1e')](function(_0x465b7a){logger['error'](_0x465b7a);});}})[_0x8291('0x14')](function(){if(_0x324c23&&_0x324c23[_0x8291('0xd0')]&&_0x324c23[_0x8291('0xdf')]){var _0x536421=[];if(_0x1e7e63[_0x8291('0x3d')]){_0x536421=_0x1e7e63[_0x8291('0x31')](function(_0x7cb79d){return{'name':_0x7cb79d[_0x8291('0xcc')],'basename':_0x7cb79d[_0x8291('0x68')],'type':_0x7cb79d['mimetype'],'ChatOfflineMessageId':_0x547a07['id']};});}var _0x4ba89a;if(!_[_0x8291('0x72')](_0x324c23[_0x8291('0xe0')])){var _0x49c4c1=_['map'](_0x1a6651[_0x8291('0x4d')],function(_0x2cc03d){return _0x2cc03d;});var _0x47820b=_[_0x8291('0xe1')](_0x49c4c1)[0x0];var _0x921bb2=_['mapValues'](_0x47820b,function(_0x2807dd){return _0x2807dd;});_0x4ba89a=_0x921bb2[0x1][_0x324c23[_0x8291('0xe0')]];}var _0x6ad477={'from':_0x2c96fd[_0x8291('0xdd')],'firstName':_0x2c96fd[_0x8291('0xaa')],'lastName':_0x2c96fd[_0x8291('0x9c')],'mapKey':'email','message':{'from':_0x2c96fd[_0x8291('0xdd')],'to':_0x324c23[_0x8291('0xc3')][_0x8291('0xdd')],'cc':'','subject':_[_0x8291('0x72')](_0x4ba89a)?_0x324c23[_0x8291('0xe2')]:_0x4ba89a,'messageId':'','sentAt':new Date(),'attach':_0x536421[_0x8291('0x3d')],'attachments':_0x536421,'originChannel':_0x8291('0xe3'),'ChatWebsiteId':_0x324c23['id'],'ChatOfflineMessageId':_0x592d62['id'],'originTo':_0x324c23[_0x8291('0xc3')][_0x8291('0xdd')]},'body':_0x592d62[_0x8291('0x4d')]};var _0x30f278={'account':{'id':_0x324c23[_0x8291('0xdf')]},'body':_0x6ad477,'log':_0x8291('0xe4')};return respondWithRpcPromise(_0x8291('0xe4'),_0x8291('0xe5'),_0x30f278,client9001)[_0x8291('0x14')](function(){return _0x592d62;})['catch'](function(_0x4aa20b){logger[_0x8291('0x1a')](_0x4aa20b);});}return;})['then'](function(){if(_0x592d62){return _0x592d62;}})['then'](respondWithResult(_0x30a2cf,null))[_0x8291('0x1e')](function(_0x48b521){logger[_0x8291('0x1a')](_0x8291('0x1e'),_0x48b521);for(var _0x249a40 of _0x1e7e63){var _0x3adb84=path[_0x8291('0x73')](config['root'],_0x8291('0xcd'),_0x8291('0xbc'),_0x8291('0xe6'),_0x8291('0xce'),_0x249a40[_0x8291('0x68')]);fs_extra['remove'](_0x3adb84)[_0x8291('0x1e')](function(_0x1b2f2f){logger[_0x8291('0x1a')](_0x8291('0xe7'),_0x3adb84,_0x1b2f2f);});}});};exports[_0x8291('0xe8')]=function(_0x56f387,_0x48e217){return db[_0x8291('0xa7')]['find']({'where':{'id':_0x56f387['params']['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x48e217,null))[_0x8291('0x14')](function(_0x3a4de9){if(_0x3a4de9){return _0x3a4de9[_0x8291('0xe8')](_0x56f387[_0x8291('0x4d')]['ids'],_[_0x8291('0xe9')](_0x56f387['body'],[_0x8291('0x5d'),'id'])||{});}})[_0x8291('0x14')](respondWithResult(_0x48e217,null))['catch'](handleError(_0x48e217,null));};exports[_0x8291('0xea')]=function(_0x4c46d0,_0x2ddd02){var _0x232543={'raw':![],'where':{}};var _0x3d420d={};var _0x1c4b87={'count':0x0,'rows':[]};return db[_0x8291('0x32')][_0x8291('0x59')]({'where':{'id':_0x4c46d0[_0x8291('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ddd02,null))[_0x8291('0x14')](function(_0x296b93){if(_0x296b93){_0x3d420d['model']=_['keys'](db[_0x8291('0xa7')][_0x8291('0x5a')]);_0x3d420d[_0x8291('0x37')]=_[_0x8291('0x38')](_0x4c46d0[_0x8291('0x37')]);_0x3d420d[_0x8291('0x39')]=_[_0x8291('0x3a')](_0x3d420d[_0x8291('0x36')],_0x3d420d[_0x8291('0x37')]);_0x232543[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x3d420d[_0x8291('0x36')],qs['fields'](_0x4c46d0[_0x8291('0x37')][_0x8291('0x3c')]));_0x232543[_0x8291('0x3b')]=_0x232543[_0x8291('0x3b')][_0x8291('0x3d')]?_0x232543['attributes']:_0x3d420d[_0x8291('0x36')];if(!_0x4c46d0['query'][_0x8291('0x3e')](_0x8291('0x3f'))){_0x232543['limit']=qs[_0x8291('0x25')](_0x4c46d0[_0x8291('0x37')][_0x8291('0x25')]);_0x232543['offset']=qs[_0x8291('0x23')](_0x4c46d0['query'][_0x8291('0x23')]);}_0x232543['order']=qs[_0x8291('0x41')](_0x4c46d0['query']['sort']);_0x232543[_0x8291('0x42')]=qs[_0x8291('0x39')](_[_0x8291('0x60')](_0x4c46d0[_0x8291('0x37')],_0x3d420d[_0x8291('0x39')]));_0x232543['where'][_0x8291('0x5b')]=_0x296b93['id'];if(_0x4c46d0[_0x8291('0x37')][_0x8291('0x43')]){_0x232543[_0x8291('0x42')]=_[_0x8291('0x44')](_0x232543[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0x232543[_0x8291('0x3b')],function(_0x41d8ef){var _0x3b71a8={};_0x3b71a8[_0x41d8ef]={'$like':'%'+_0x4c46d0['query'][_0x8291('0x43')]+'%'};return _0x3b71a8;})});}_0x232543=_[_0x8291('0x44')]({},_0x232543,_0x4c46d0['options']);return db['ChatInteraction'][_0x8291('0x26')]({'where':_0x232543['where']})[_0x8291('0x14')](function(_0x218d42){_0x1c4b87['count']=_0x218d42;if(_0x4c46d0['query'][_0x8291('0x47')]){_0x232543['include']=[{'model':db[_0x8291('0x82')],'as':_0x8291('0xeb'),'required':![]},{'model':db[_0x8291('0xb3')],'as':_0x8291('0xec'),'attributes':[_0x8291('0x2e'),_0x8291('0xed'),_0x8291('0xee')],'required':![]},{'model':db['Tag'],'as':_0x8291('0xef'),'attributes':['id',_0x8291('0x2e'),_0x8291('0xf0')],'where':_0x4c46d0[_0x8291('0x37')]['tag']?{'id':_0x4c46d0[_0x8291('0x37')]['tag']}:undefined,'required':_0x4c46d0[_0x8291('0x37')]['tag']?!![]:![]}];}return db[_0x8291('0xa7')]['findAll'](_0x232543);})['then'](function(_0x1779ec){_0x1c4b87[_0x8291('0x61')]=_0x1779ec;return _0x1c4b87;});}})['then'](respondWithFilteredResult(_0x2ddd02,_0x232543))[_0x8291('0x1e')](handleError(_0x2ddd02,null));};function iftimePromise(_0x34b78e,_0x4a7a74){return respondWithRpcPromise(_0x8291('0xf1'),_0x8291('0xf2'),{'command':_0x4a7a74[_0x8291('0xf3')]?util[_0x8291('0xa0')]('iftime\x20%s,%s',_0x34b78e[_0x8291('0xf4')],_0x4a7a74[_0x8291('0xf3')]):util['format'](_0x8291('0xf5'),_0x34b78e[_0x8291('0xf4')])},client9002)['then'](function(_0x187162){var _0x2767b4=_0x187162&&_0x187162[_0x8291('0xf6')](_0x8291('0xf7'))>=0x0?!![]:![];logger['info'](_0x8291('0xf8'),_0x4a7a74['id'],_0x34b78e['id'],_0x34b78e[_0x8291('0xf4')],_0x2767b4?_0x8291('0xf9'):_0x8291('0xfa'),_0x4a7a74[_0x8291('0xf3')]?_0x4a7a74[_0x8291('0xf3')]:_0x8291('0xfb'));return _0x2767b4;})[_0x8291('0x1e')](function(_0x4ef242){logger[_0x8291('0x1a')](_0x8291('0xf8'),_0x4a7a74['id'],_0x34b78e['id'],_0x34b78e[_0x8291('0xf4')],util[_0x8291('0xfc')](_0x4ef242,{'showHidden':![],'depth':null}),_0x4a7a74['timezone']?_0x4a7a74[_0x8291('0xf3')]:_0x8291('0xfb'));return![];});}exports[_0x8291('0xf2')]=function(_0x378616,_0xe0a5a4){var _0x38500f=0x0;var _0x552dfd=0x0;var _0x3b94d=![];var _0x75d824;var _0x5b394a;return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x378616['params']['id']},'include':[{'model':db[_0x8291('0xfd')],'as':_0x8291('0xfd'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0xe0a5a4,null))['then'](function(_0x5ab6a4){if(_0x5ab6a4){_0x75d824=_0x5ab6a4;return _0x5ab6a4[_0x8291('0xfe')]({'raw':!![]});}})[_0x8291('0x14')](function(_0x391966){if(_0x75d824){if(_0x391966){_0x5b394a=_0x391966;}}return require('../../config/license/util')['getLicense']();})['then'](function(_0x323f8c){if(_0x323f8c){_0x552dfd=_0x323f8c[_0x8291('0xff')];_0x3b94d=_0x323f8c[_0x8291('0x71')];}})['then'](function(){return db[_0x8291('0xa7')][_0x8291('0x26')]({'where':{'closed':![]}});})[_0x8291('0x14')](function(_0x15116f){_0x38500f=_0x15116f;if(_0x552dfd&&_0x15116f>_0x552dfd){return db[_0x8291('0x100')][_0x8291('0x59')]({'where':{'id':0x1}})['then'](function(_0x13c66b){if(_0x13c66b){_0x13c66b[_0x8291('0x101')](_0x8291('0x102'));}});}})['then'](function(){if(_0x75d824[_0x8291('0xfd')]&&_0x75d824[_0x8291('0xfd')]['Intervals']){var _0xcff983=[];for(var _0x2a5840=0x0;_0x2a5840<_0x75d824[_0x8291('0xfd')][_0x8291('0x103')][_0x8291('0x3d')];_0x2a5840++){var _0x3b31f9=_0x75d824[_0x8291('0xfd')]['Intervals'][_0x2a5840][_0x8291('0x2b')]({'plain':!![]});_0xcff983[_0x8291('0xae')](iftimePromise(_0x3b31f9,_0x75d824));}return BPromise['all'](_0xcff983)['then'](function(_0x22b86e){return _['some'](_0x22b86e);});}else{return!![];}})[_0x8291('0x14')](function(_0x59c1fd){var _0x1d3bbe=fs['readFileSync'](path[_0x8291('0x73')](config[_0x8291('0x6e')],'server/files/chat/iframe.ejs'),_0x8291('0x104'));var _0x5d2feb={'remote':_0x75d824['remote'],'query':querystring[_0x8291('0x19')](_['merge'](_0x75d824[_0x8291('0x2b')]({'plain':!![]}),{'customerIp':_0x378616[_0x8291('0x7f')][_0x8291('0x9a')]||_0x378616[_0x8291('0x7f')][_0x8291('0x105')]||_0x378616[_0x8291('0x106')][_0x8291('0x107')]||_0x378616['ip'],'referer':_0x378616['headers']['referer'],'openedInteractions':_0x38500f,'maxInteractions':_0x552dfd,'virtual':_0x3b94d['virtual'],'online':_0x59c1fd,'custom':_0x3b94d}))[_0x8291('0x108')](/'/g,'\x5c\x27')};_0xe0a5a4[_0x8291('0xbf')](ejs[_0x8291('0xc7')](Mustache[_0x8291('0xc7')](_0x1d3bbe,_0x5d2feb),{'proactiveActions':_0x5b394a,'alignment':_0x75d824[_0x8291('0x109')],'verticalAlignment':_0x75d824[_0x8291('0x10a')],'div_color':_0x75d824['color'],'labelText':_0x75d824[_0x8291('0x10b')],'text_color':_0x75d824[_0x8291('0x10c')],'text_button_color':_0x75d824[_0x8291('0x10d')],'button_color':_0x75d824['color_button'],'background_color':_0x75d824['backgroundColor'],'hideWhenOffline':_0x75d824[_0x8291('0x10e')],'interval':_0x75d824['IntervalId']}));})['catch'](handleError(_0xe0a5a4,null));};exports['addApplications']=function(_0x280e20,_0x17f890){var _0x4d6de7=_0x280e20[_0x8291('0x4b')]['id'];var _0x559e3c=_0x280e20[_0x8291('0x4d')];var _0x20f149=0xc8;var _0xb393e3=null;return db['sequelize'][_0x8291('0x10f')]({'isolationLevel':db['sequelize']['Transaction'][_0x8291('0x110')]['READ_COMMITTED']},function(_0x3d319b){return db[_0x8291('0x32')]['findOne']({'where':{'id':_0x4d6de7},'transaction':_0x3d319b})[_0x8291('0x14')](function(_0x308690){if(_0x308690){return db['ChatApplication'][_0x8291('0x2a')]({'where':{'ChatWebsiteId':_0x4d6de7},'transaction':_0x3d319b})['then'](function(){var _0x179318=_['map'](_0x559e3c,function(_0x2d6a63){_0x2d6a63[_0x8291('0x5b')]=_0x4d6de7;return _0x2d6a63;});return db[_0x8291('0x111')][_0x8291('0xd3')](_0x179318,{'transaction':_0x3d319b});});}else{_0x20f149=0x194;_0xb393e3=[];}});})['then'](function(){if(_0x20f149!==0x194){return db[_0x8291('0x111')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4d6de7},'order':_0x8291('0x95')})[_0x8291('0x14')](function(_0x1b26ca){_0xb393e3=_0x1b26ca;});}})[_0x8291('0x1e')](function(_0x506537){_0x20f149=0x1f4;logger[_0x8291('0x1a')](_0x506537[_0x8291('0x112')]);if(_0x506537[_0x8291('0x2e')]){delete _0x506537[_0x8291('0x2e')];}_0xb393e3=_0x506537;})['finally'](function(){if(_0xb393e3===null){_0x17f890[_0x8291('0x1f')](_0x20f149);}else{if(_0x20f149===0x1f4){_0x17f890['status'](_0x20f149)[_0x8291('0xbf')](_0xb393e3);}else{_0x17f890['status'](_0x20f149)[_0x8291('0x22')](_0xb393e3);}}});};exports[_0x8291('0x113')]=function(_0x5c8e85,_0x904fa5){var _0x2918ef={};var _0x4219c7={};var _0x5ef593;var _0x211051;return db[_0x8291('0x32')][_0x8291('0x59')]({'where':{'id':_0x5c8e85[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x904fa5,null))['then'](function(_0x35607a){if(_0x35607a){_0x5ef593=_0x35607a;_0x4219c7[_0x8291('0x36')]=_[_0x8291('0x38')](db[_0x8291('0x111')]['rawAttributes']);_0x4219c7[_0x8291('0x37')]=_[_0x8291('0x38')](_0x5c8e85[_0x8291('0x37')]);_0x4219c7[_0x8291('0x39')]=_[_0x8291('0x3a')](_0x4219c7[_0x8291('0x36')],_0x4219c7[_0x8291('0x37')]);_0x2918ef[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x4219c7['model'],qs[_0x8291('0x3c')](_0x5c8e85[_0x8291('0x37')]['fields']));_0x2918ef[_0x8291('0x3b')]=_0x2918ef[_0x8291('0x3b')][_0x8291('0x3d')]?_0x2918ef[_0x8291('0x3b')]:_0x4219c7[_0x8291('0x36')];_0x2918ef['order']=qs[_0x8291('0x41')](_0x5c8e85[_0x8291('0x37')][_0x8291('0x41')]);_0x2918ef[_0x8291('0x42')]=qs[_0x8291('0x39')](_[_0x8291('0x60')](_0x5c8e85[_0x8291('0x37')],_0x4219c7['filters']));if(_0x5c8e85[_0x8291('0x37')][_0x8291('0x43')]){_0x2918ef[_0x8291('0x42')]=_['merge'](_0x2918ef[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0x2918ef['attributes'],function(_0x171792){var _0x4df97d={};_0x4df97d[_0x171792]={'$like':'%'+_0x5c8e85['query'][_0x8291('0x43')]+'%'};return _0x4df97d;})});}_0x2918ef=_[_0x8291('0x44')]({},_0x2918ef,_0x5c8e85[_0x8291('0x46')]);return _0x5ef593[_0x8291('0x113')](_0x2918ef);}})[_0x8291('0x14')](function(_0x18276b){if(_0x18276b){_0x211051=_0x18276b[_0x8291('0x3d')];if(!_0x5c8e85[_0x8291('0x37')][_0x8291('0x3e')]('nolimit')){_0x2918ef[_0x8291('0x25')]=qs[_0x8291('0x25')](_0x5c8e85['query'][_0x8291('0x25')]);_0x2918ef[_0x8291('0x23')]=qs[_0x8291('0x23')](_0x5c8e85[_0x8291('0x37')][_0x8291('0x23')]);}return _0x5ef593[_0x8291('0x113')](_0x2918ef);}})[_0x8291('0x14')](function(_0x5bba97){if(_0x5bba97){return _0x5bba97?{'count':_0x211051,'rows':_0x5bba97}:null;}})[_0x8291('0x14')](respondWithResult(_0x904fa5,null))['catch'](handleError(_0x904fa5,null));};exports[_0x8291('0x114')]=function(_0x4b70d6,_0x5f1d1d){return db['chatProactiveAction'][_0x8291('0x4c')]({'where':{'id':_0x4b70d6[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x5f1d1d,null))[_0x8291('0x14')](function(_0x6f1c45){if(_0x6f1c45){return _0x6f1c45[_0x8291('0x114')](_0x4b70d6[_0x8291('0x4d')][_0x8291('0x5d')],_[_0x8291('0xe9')](_0x4b70d6[_0x8291('0x4d')],[_0x8291('0x5d'),'id'])||{});}})[_0x8291('0x14')](respondWithResult(_0x5f1d1d,null))[_0x8291('0x1e')](handleError(_0x5f1d1d,null));};exports[_0x8291('0xfe')]=function(_0x12fa8b,_0x38b9ae){var _0x394953={};var _0x38cc75={};var _0x2e68f5;var _0x1a21bb;return db[_0x8291('0x32')]['findOne']({'where':{'id':_0x12fa8b['params']['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x38b9ae,null))['then'](function(_0x1cb4c6){if(_0x1cb4c6){_0x2e68f5=_0x1cb4c6;_0x38cc75[_0x8291('0x36')]=_[_0x8291('0x38')](db[_0x8291('0x115')]['rawAttributes']);_0x38cc75[_0x8291('0x37')]=_[_0x8291('0x38')](_0x12fa8b['query']);_0x38cc75[_0x8291('0x39')]=_[_0x8291('0x3a')](_0x38cc75[_0x8291('0x36')],_0x38cc75[_0x8291('0x37')]);_0x394953['attributes']=_[_0x8291('0x3a')](_0x38cc75[_0x8291('0x36')],qs[_0x8291('0x3c')](_0x12fa8b[_0x8291('0x37')]['fields']));_0x394953['attributes']=_0x394953[_0x8291('0x3b')][_0x8291('0x3d')]?_0x394953[_0x8291('0x3b')]:_0x38cc75['model'];_0x394953['order']=qs[_0x8291('0x41')](_0x12fa8b[_0x8291('0x37')]['sort']);_0x394953[_0x8291('0x42')]=qs['filters'](_[_0x8291('0x60')](_0x12fa8b[_0x8291('0x37')],_0x38cc75['filters']));if(_0x12fa8b[_0x8291('0x37')]['filter']){_0x394953['where']=_[_0x8291('0x44')](_0x394953['where'],{'$or':_['map'](_0x394953[_0x8291('0x3b')],function(_0x570fa4){var _0x3ae8c9={};_0x3ae8c9[_0x570fa4]={'$like':'%'+_0x12fa8b['query'][_0x8291('0x43')]+'%'};return _0x3ae8c9;})});}_0x394953=_['merge']({},_0x394953,_0x12fa8b[_0x8291('0x46')]);return _0x2e68f5[_0x8291('0xfe')](_0x394953);}})[_0x8291('0x14')](function(_0x12aa67){if(_0x12aa67){_0x1a21bb=_0x12aa67[_0x8291('0x3d')];if(!_0x12fa8b[_0x8291('0x37')][_0x8291('0x3e')](_0x8291('0x3f'))){_0x394953[_0x8291('0x25')]=qs[_0x8291('0x25')](_0x12fa8b[_0x8291('0x37')]['limit']);_0x394953[_0x8291('0x23')]=qs[_0x8291('0x23')](_0x12fa8b[_0x8291('0x37')][_0x8291('0x23')]);}return _0x2e68f5[_0x8291('0xfe')](_0x394953);}})[_0x8291('0x14')](function(_0x23e089){if(_0x23e089){return _0x23e089?{'count':_0x1a21bb,'rows':_0x23e089}:null;}})[_0x8291('0x14')](respondWithResult(_0x38b9ae,null))['catch'](handleError(_0x38b9ae,null));};exports[_0x8291('0x116')]=function(_0x4380a3,_0x7b21ce){var _0x9aae4e=_0x4380a3['query'][_0x8291('0x117')]===_0x8291('0x118')?_0x8291('0x119'):_0x8291('0x11a');return db[_0x8291('0x32')]['find']({'attributes':['id',_0x9aae4e],'where':{'id':_0x4380a3[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x7b21ce,null))[_0x8291('0x14')](function(_0x4c8755){if(_0x4c8755){var _0x5c26f8=_0x4c8755[_0x9aae4e];var _0x24b82f=_0x5c26f8&&_0x5c26f8['items']?_0x5c26f8[_0x8291('0x11b')]:[];_0x7b21ce['send']({'fromKey':_[_0x8291('0x72')](_0x5c26f8['fromKey'])?undefined:_0x5c26f8['fromKey'],'count':_0x24b82f[_0x8291('0x3d')],'rows':_0x24b82f});}})[_0x8291('0x1e')](handleError(_0x7b21ce,null));};exports[_0x8291('0x11c')]=function(_0x108d97,_0x359136){var _0x535543={'raw':![],'where':{}};var _0x8b966c={};var _0x2c8e8a={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x108d97['params']['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x359136,null))['then'](function(_0x440b18){if(_0x440b18){_0x8b966c['model']=_['keys'](db[_0x8291('0xca')]['rawAttributes']);_0x8b966c[_0x8291('0x37')]=_[_0x8291('0x38')](_0x108d97[_0x8291('0x37')]);_0x8b966c['filters']=_[_0x8291('0x3a')](_0x8b966c['model'],_0x8b966c[_0x8291('0x37')]);_0x535543[_0x8291('0x3b')]=_[_0x8291('0x3a')](_0x8b966c[_0x8291('0x36')],qs[_0x8291('0x3c')](_0x108d97[_0x8291('0x37')]['fields']));_0x535543['attributes']=_0x535543[_0x8291('0x3b')][_0x8291('0x3d')]?_0x535543[_0x8291('0x3b')]:_0x8b966c['model'];if(!_0x108d97[_0x8291('0x37')][_0x8291('0x3e')](_0x8291('0x3f'))){_0x535543[_0x8291('0x25')]=qs[_0x8291('0x25')](_0x108d97[_0x8291('0x37')][_0x8291('0x25')]);_0x535543[_0x8291('0x23')]=qs['offset'](_0x108d97[_0x8291('0x37')][_0x8291('0x23')]);}_0x535543['order']=qs[_0x8291('0x41')](_0x108d97[_0x8291('0x37')][_0x8291('0x41')]);_0x535543['where']=qs[_0x8291('0x39')](_[_0x8291('0x60')](_0x108d97[_0x8291('0x37')],_0x8b966c[_0x8291('0x39')]));_0x535543[_0x8291('0x42')][_0x8291('0x5b')]=_0x440b18['id'];if(_0x108d97[_0x8291('0x37')][_0x8291('0x43')]){_0x535543[_0x8291('0x42')]=_[_0x8291('0x44')](_0x535543[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0x535543[_0x8291('0x3b')],function(_0x42ce4d){var _0x4fd0e2={};_0x4fd0e2[_0x42ce4d]={'$like':'%'+_0x108d97[_0x8291('0x37')][_0x8291('0x43')]+'%'};return _0x4fd0e2;})});}_0x535543=_[_0x8291('0x44')]({},_0x535543,_0x108d97['options']);return db[_0x8291('0xca')][_0x8291('0x26')]({'where':_0x535543['where']})[_0x8291('0x14')](function(_0x56872f){_0x2c8e8a['count']=_0x56872f;if(_0x108d97[_0x8291('0x37')][_0x8291('0x47')]){_0x535543['include']=[{'all':!![]}];}else{_0x535543[_0x8291('0x48')]=[{'model':db[_0x8291('0x82')],'as':'Contact','required':![]},{'model':db[_0x8291('0xd2')],'as':'Attachments','required':![]}];}return db[_0x8291('0xca')][_0x8291('0x49')](_0x535543);})['then'](function(_0x54d9fd){_0x2c8e8a[_0x8291('0x61')]=_0x54d9fd;return _0x2c8e8a;});}})['then'](respondWithFilteredResult(_0x359136,_0x535543))[_0x8291('0x1e')](handleError(_0x359136,null));};exports[_0x8291('0x11d')]=function(_0x1043fc,_0x1b1e3a){return db[_0x8291('0x32')][_0x8291('0x4c')]({'where':{'id':_0x1043fc[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x1b1e3a,null))[_0x8291('0x14')](function(_0x53c265){if(_0x53c265){return _0x53c265[_0x8291('0x11d')](_0x1043fc['body'][_0x8291('0x5d')],_[_0x8291('0xe9')](_0x1043fc[_0x8291('0x4d')],['ids','id'])||{})['spread'](function(_0x2677fd){for(var _0x4475d9=0x0;_0x4475d9<_0x1043fc[_0x8291('0x4d')][_0x8291('0x5d')][_0x8291('0x3d')];_0x4475d9+=0x1){socket[_0x8291('0x11e')](_0x8291('0x11f'),{'UserId':Number(_0x1043fc[_0x8291('0x4d')][_0x8291('0x5d')][_0x4475d9]),'ChatWebsiteId':Number(_0x1043fc[_0x8291('0x4b')]['id'])});}return _0x2677fd;});}})['then'](respondWithResult(_0x1b1e3a,null))[_0x8291('0x1e')](handleError(_0x1b1e3a,null));};exports['removeAgents']=function(_0x3a34ad,_0x2fdc06){return db['ChatWebsite'][_0x8291('0x4c')]({'where':{'id':_0x3a34ad[_0x8291('0x4b')]['id']}})[_0x8291('0x14')](handleEntityNotFound(_0x2fdc06,null))[_0x8291('0x14')](function(_0x5c1c1c){if(_0x5c1c1c){return _0x5c1c1c[_0x8291('0x120')](_0x3a34ad['query'][_0x8291('0x5d')])[_0x8291('0x14')](function(){if(_[_0x8291('0x121')](_0x3a34ad[_0x8291('0x37')]['ids'])){for(var _0x513199=0x0;_0x513199<_0x3a34ad['query'][_0x8291('0x5d')][_0x8291('0x3d')];_0x513199+=0x1){socket[_0x8291('0x11e')](_0x8291('0x122'),{'UserId':Number(_0x3a34ad['query']['ids'][_0x513199]),'ChatWebsiteId':Number(_0x3a34ad[_0x8291('0x4b')]['id'])});}}else{socket[_0x8291('0x11e')](_0x8291('0x122'),{'UserId':Number(_0x3a34ad['query'][_0x8291('0x5d')]),'ChatWebsiteId':Number(_0x3a34ad[_0x8291('0x4b')]['id'])});}});}})[_0x8291('0x14')](respondWithStatusCode(_0x2fdc06,null))['catch'](handleError(_0x2fdc06,null));};exports[_0x8291('0x123')]=function(_0x597b53,_0x4f7b9c){var _0x3cc806={};var _0x4be0e5={};var _0x4f0acc;var _0x3af515;return db[_0x8291('0x32')][_0x8291('0x59')]({'where':{'id':_0x597b53[_0x8291('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4f7b9c,null))[_0x8291('0x14')](function(_0x318f3f){if(_0x318f3f){_0x4f0acc=_0x318f3f;_0x4be0e5['model']=_[_0x8291('0x38')](db[_0x8291('0xb3')]['rawAttributes']);_0x4be0e5[_0x8291('0x37')]=_['keys'](_0x597b53[_0x8291('0x37')]);_0x4be0e5['filters']=_[_0x8291('0x3a')](_0x4be0e5[_0x8291('0x36')],_0x4be0e5['query']);_0x3cc806['attributes']=_[_0x8291('0x3a')](_0x4be0e5['model'],qs[_0x8291('0x3c')](_0x597b53[_0x8291('0x37')][_0x8291('0x3c')]));_0x3cc806[_0x8291('0x3b')]=_0x3cc806[_0x8291('0x3b')][_0x8291('0x3d')]?_0x3cc806['attributes']:_0x4be0e5[_0x8291('0x36')];_0x3cc806[_0x8291('0x40')]=qs[_0x8291('0x41')](_0x597b53[_0x8291('0x37')][_0x8291('0x41')]);_0x3cc806['where']=qs[_0x8291('0x39')](_['pick'](_0x597b53[_0x8291('0x37')],_0x4be0e5[_0x8291('0x39')]));if(_0x597b53[_0x8291('0x37')][_0x8291('0x43')]){_0x3cc806[_0x8291('0x42')]=_[_0x8291('0x44')](_0x3cc806[_0x8291('0x42')],{'$or':_[_0x8291('0x31')](_0x3cc806[_0x8291('0x3b')],function(_0x2dc164){var _0x1fdb4e={};_0x1fdb4e[_0x2dc164]={'$like':'%'+_0x597b53[_0x8291('0x37')][_0x8291('0x43')]+'%'};return _0x1fdb4e;})});}_0x3cc806=_[_0x8291('0x44')]({},_0x3cc806,_0x597b53['options']);return _0x4f0acc['getAgents'](_0x3cc806);}})[_0x8291('0x14')](function(_0x2caa9e){if(_0x2caa9e){_0x3af515=_0x2caa9e[_0x8291('0x3d')];if(!_0x597b53[_0x8291('0x37')]['hasOwnProperty'](_0x8291('0x3f'))){_0x3cc806[_0x8291('0x25')]=qs[_0x8291('0x25')](_0x597b53[_0x8291('0x37')]['limit']);_0x3cc806['offset']=qs['offset'](_0x597b53[_0x8291('0x37')][_0x8291('0x23')]);}return _0x4f0acc[_0x8291('0x123')](_0x3cc806);}})[_0x8291('0x14')](function(_0x1edd5c){if(_0x1edd5c){return _0x1edd5c?{'count':_0x3af515,'rows':_0x1edd5c}:null;}})['then'](respondWithResult(_0x4f7b9c,null))[_0x8291('0x1e')](handleError(_0x4f7b9c,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index e63e79e..7067203 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 _0xf3cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x1b892b,_0x4efe48){var _0xa99e57=function(_0x3f957a){while(--_0x3f957a){_0x1b892b['push'](_0x1b892b['shift']());}};_0xa99e57(++_0x4efe48);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x25c044,_0xbd05f8){_0x25c044=_0x25c044-0x0;var _0x558ee5=_0xf3cd[_0x25c044];return _0x558ee5;};'use strict';var EventEmitter=require(_0xdf3c('0x0'));var ChatWebsite=require(_0xdf3c('0x1'))['db'][_0xdf3c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdf3c('0x3')](0x0);var events={'afterCreate':_0xdf3c('0x4'),'afterUpdate':_0xdf3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x401518){return function(_0x71b446,_0x9f71cb,_0x573076){ChatWebsiteEvents[_0xdf3c('0x6')](_0x401518+':'+_0x71b446['id'],_0x71b446);ChatWebsiteEvents[_0xdf3c('0x6')](_0x401518,_0x71b446);_0x573076(null);};}for(var e in events){if(events[_0xdf3c('0x7')](e)){var event=events[e];ChatWebsite[_0xdf3c('0x8')](e,emitEvent(event));}}module[_0xdf3c('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb13b=['ChatWebsite','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xb13b,0x1de));var _0xbb13=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb13b[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xbb13('0x0'));var ChatWebsite=require(_0xbb13('0x1'))['db'][_0xbb13('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbb13('0x3')](0x0);var events={'afterCreate':_0xbb13('0x4'),'afterUpdate':'update','afterDestroy':_0xbb13('0x5')};function emitEvent(_0x38600f){return function(_0x50898d,_0x9eab1b,_0x23a522){ChatWebsiteEvents[_0xbb13('0x6')](_0x38600f+':'+_0x50898d['id'],_0x50898d);ChatWebsiteEvents[_0xbb13('0x6')](_0x38600f,_0x50898d);_0x23a522(null);};}for(var e in events){if(events[_0xbb13('0x7')](e)){var event=events[e];ChatWebsite[_0xbb13('0x8')](e,emitEvent(event));}}module[_0xbb13('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a914a59..d6669b9 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 _0xf659=['ChatWebsite','chat_websites','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x5d8725,_0x1096cc){var _0x23ddb2=function(_0x5b6b12){while(--_0x5b6b12){_0x5d8725['push'](_0x5d8725['shift']());}};_0x23ddb2(++_0x1096cc);}(_0xf659,0x12e));var _0x9f65=function(_0x93aa7d,_0x1d64b5){_0x93aa7d=_0x93aa7d-0x0;var _0xc0a2a8=_0xf659[_0x93aa7d];return _0xc0a2a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9f65('0x0'))('api');var moment=require(_0x9f65('0x1'));var BPromise=require('bluebird');var rp=require(_0x9f65('0x2'));var fs=require('fs');var path=require(_0x9f65('0x3'));var rimraf=require(_0x9f65('0x4'));var config=require(_0x9f65('0x5'));var attributes=require(_0x9f65('0x6'));module[_0x9f65('0x7')]=function(_0x15d0b9,_0x42190f){return _0x15d0b9['define'](_0x9f65('0x8'),attributes,{'tableName':_0x9f65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e72=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','api','moment','path'];(function(_0x470615,_0x1c7aaa){var _0x189c81=function(_0x398e12){while(--_0x398e12){_0x470615['push'](_0x470615['shift']());}};_0x189c81(++_0x1c7aaa);}(_0x4e72,0xc7));var _0x24e7=function(_0x173b7f,_0x12b928){_0x173b7f=_0x173b7f-0x0;var _0x2e0d96=_0x4e72[_0x173b7f];return _0x2e0d96;};'use strict';var _=require('lodash');var util=require(_0x24e7('0x0'));var logger=require(_0x24e7('0x1'))(_0x24e7('0x2'));var moment=require(_0x24e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x24e7('0x4'));var rimraf=require(_0x24e7('0x5'));var config=require(_0x24e7('0x6'));var attributes=require(_0x24e7('0x7'));module[_0x24e7('0x8')]=function(_0x2a3894,_0x595418){return _0x2a3894[_0x24e7('0x9')](_0x24e7('0xa'),attributes,{'tableName':_0x24e7('0xb'),'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 5eec2f0..3c8f55c 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 _0x7a9b=['request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0xfda098,_0x533f6b){var _0x502996=function(_0x321b32){while(--_0x321b32){_0xfda098['push'](_0xfda098['shift']());}};_0x502996(++_0x533f6b);}(_0x7a9b,0x1cc));var _0xb7a9=function(_0x201852,_0x2ce317){_0x201852=_0x201852-0x0;var _0x1a3fc5=_0x7a9b[_0x201852];return _0x1a3fc5;};'use strict';var _=require(_0xb7a9('0x0'));var util=require(_0xb7a9('0x1'));var moment=require('moment');var BPromise=require(_0xb7a9('0x2'));var rs=require(_0xb7a9('0x3'));var fs=require('fs');var Redis=require(_0xb7a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7a9('0x5'));var logger=require(_0xb7a9('0x6'))(_0xb7a9('0x7'));var config=require(_0xb7a9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb7a9('0x9')][_0xb7a9('0xa')]({'port':0x232a});config['redis']=_[_0xb7a9('0xb')](config[_0xb7a9('0xc')],{'host':_0xb7a9('0xd'),'port':0x18eb});var socket=require(_0xb7a9('0xe'))(new Redis(config[_0xb7a9('0xc')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x29b864,_0x5d71c9,_0x2b6e42){return new BPromise(function(_0x421eb8,_0x9eea46){return client[_0xb7a9('0xf')](_0x29b864,_0x2b6e42)['then'](function(_0x4d962e){logger[_0xb7a9('0x10')](_0xb7a9('0x11'),_0x5d71c9,_0xb7a9('0x12'));logger[_0xb7a9('0x13')](_0xb7a9('0x14'),_0x5d71c9,_0xb7a9('0x12'),JSON['stringify'](_0x4d962e));if(_0x4d962e[_0xb7a9('0x15')]){if(_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x16')]===0x1f4){logger[_0xb7a9('0x15')](_0xb7a9('0x11'),_0x5d71c9,_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x17')]);return _0x9eea46(_0x4d962e[_0xb7a9('0x15')][_0xb7a9('0x17')]);}logger[_0xb7a9('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x5d71c9,_0x4d962e['error'][_0xb7a9('0x17')]);return _0x421eb8(_0x4d962e['error'][_0xb7a9('0x17')]);}else{logger['info'](_0xb7a9('0x11'),_0x5d71c9,_0xb7a9('0x12'));_0x421eb8(_0x4d962e[_0xb7a9('0x18')][_0xb7a9('0x17')]);}})['catch'](function(_0x4d4a1a){logger[_0xb7a9('0x15')](_0xb7a9('0x11'),_0x5d71c9,_0x4d4a1a);_0x9eea46(_0x4d4a1a);});});} \ No newline at end of file +var _0xe58a=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe58a,0x135));var _0xae58=function(_0x32e190,_0x5a1f71){_0x32e190=_0x32e190-0x0;var _0x3ff8fa=_0xe58a[_0x32e190];return _0x3ff8fa;};'use strict';var _=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var moment=require(_0xae58('0x2'));var BPromise=require(_0xae58('0x3'));var rs=require(_0xae58('0x4'));var fs=require('fs');var Redis=require(_0xae58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae58('0x6'));var logger=require('../../config/logger')(_0xae58('0x7'));var config=require(_0xae58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xae58('0x9')][_0xae58('0xa')]({'port':0x232a});config[_0xae58('0xb')]=_[_0xae58('0xc')](config[_0xae58('0xb')],{'host':_0xae58('0xd'),'port':0x18eb});var socket=require(_0xae58('0xe'))(new Redis(config[_0xae58('0xb')]));require('./chatWebsite.socket')[_0xae58('0xf')](socket);function respondWithRpcPromise(_0x6468a7,_0x231799,_0x1d7d46){return new BPromise(function(_0x5eee47,_0x45cd17){return client[_0xae58('0x10')](_0x6468a7,_0x1d7d46)[_0xae58('0x11')](function(_0x3535d4){logger[_0xae58('0x12')](_0xae58('0x13'),_0x231799,_0xae58('0x14'));logger[_0xae58('0x15')](_0xae58('0x16'),_0x231799,_0xae58('0x14'),JSON[_0xae58('0x17')](_0x3535d4));if(_0x3535d4[_0xae58('0x18')]){if(_0x3535d4[_0xae58('0x18')][_0xae58('0x19')]===0x1f4){logger[_0xae58('0x18')](_0xae58('0x13'),_0x231799,_0x3535d4['error'][_0xae58('0x1a')]);return _0x45cd17(_0x3535d4['error'][_0xae58('0x1a')]);}logger[_0xae58('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x231799,_0x3535d4[_0xae58('0x18')]['message']);return _0x5eee47(_0x3535d4[_0xae58('0x18')][_0xae58('0x1a')]);}else{logger[_0xae58('0x12')](_0xae58('0x13'),_0x231799,'request\x20sent');_0x5eee47(_0x3535d4[_0xae58('0x1b')][_0xae58('0x1a')]);}})[_0xae58('0x1c')](function(_0x59be19){logger[_0xae58('0x18')](_0xae58('0x13'),_0x231799,_0x59be19);_0x45cd17(_0x59be19);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index bb99668..74b250f 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 _0x8596=['./chatWebsite.events','save','remove','emit','register','length','chatWebsite:'];(function(_0x5de6c9,_0x471538){var _0x4f45f6=function(_0xe0c086){while(--_0xe0c086){_0x5de6c9['push'](_0x5de6c9['shift']());}};_0x4f45f6(++_0x471538);}(_0x8596,0x9a));var _0x6859=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8596[_0x4565bf];return _0x5610ba;};'use strict';var ChatWebsiteEvents=require(_0x6859('0x0'));var events=[_0x6859('0x1'),_0x6859('0x2'),'update'];function createListener(_0x1d9015,_0xb93d6){return function(_0x3b8f63){_0xb93d6[_0x6859('0x3')](_0x1d9015,_0x3b8f63);};}function removeListener(_0x34b9a6,_0x64330c){return function(){ChatWebsiteEvents['removeListener'](_0x34b9a6,_0x64330c);};}exports[_0x6859('0x4')]=function(_0x47227d){for(var _0x27dba8=0x0,_0x304f8b=events[_0x6859('0x5')];_0x27dba8<_0x304f8b;_0x27dba8++){var _0x5cc9f2=events[_0x27dba8];var _0x5d94dd=createListener(_0x6859('0x6')+_0x5cc9f2,_0x47227d);ChatWebsiteEvents['on'](_0x5cc9f2,_0x5d94dd);}}; \ No newline at end of file +var _0x4506=['./chatWebsite.events','save','remove','update','emit','removeListener','register'];(function(_0x55c611,_0x3a7225){var _0x571068=function(_0x1a6f7a){while(--_0x1a6f7a){_0x55c611['push'](_0x55c611['shift']());}};_0x571068(++_0x3a7225);}(_0x4506,0x1ea));var _0x6450=function(_0x49fbff,_0x34dc46){_0x49fbff=_0x49fbff-0x0;var _0x2ca2fb=_0x4506[_0x49fbff];return _0x2ca2fb;};'use strict';var ChatWebsiteEvents=require(_0x6450('0x0'));var events=[_0x6450('0x1'),_0x6450('0x2'),_0x6450('0x3')];function createListener(_0x4b6325,_0x17e2d4){return function(_0x4f0f9e){_0x17e2d4[_0x6450('0x4')](_0x4b6325,_0x4f0f9e);};}function removeListener(_0x5a5099,_0x5acd73){return function(){ChatWebsiteEvents[_0x6450('0x5')](_0x5a5099,_0x5acd73);};}exports[_0x6450('0x6')]=function(_0x368027){for(var _0x15e119=0x0,_0x122b68=events['length'];_0x15e119<_0x122b68;_0x15e119++){var _0x475ca1=events[_0x15e119];var _0x426986=createListener('chatWebsite:'+_0x475ca1,_0x368027);ChatWebsiteEvents['on'](_0x475ca1,_0x426986);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7c22f20..86f7348 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 _0xa48d=['server/files/images/avatars/','%s-%s','/:id/customer_avatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','replace','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','format','now','originalname','/:id/logo','single','file','addLogo','root'];(function(_0x3395c0,_0x935260){var _0x4c9ea7=function(_0x27e3bc){while(--_0x27e3bc){_0x3395c0['push'](_0x3395c0['shift']());}};_0x4c9ea7(++_0x935260);}(_0xa48d,0x170));var _0xda48=function(_0x2c1933,_0x37433d){_0x2c1933=_0x2c1933-0x0;var _0xe44b8a=_0xa48d[_0x2c1933];return _0xe44b8a;};'use strict';var multer=require(_0xda48('0x0'));var util=require(_0xda48('0x1'));var path=require(_0xda48('0x2'));var timeout=require(_0xda48('0x3'));var express=require(_0xda48('0x4'));var router=express[_0xda48('0x5')]();var fs_extra=require(_0xda48('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda48('0x7'));var controller=require('./chatWebsite.controller');router[_0xda48('0x8')]('/',auth[_0xda48('0x9')](),controller[_0xda48('0xa')]);router[_0xda48('0x8')](_0xda48('0xb'),auth['isAuthenticated'](),controller[_0xda48('0xc')]);router[_0xda48('0x8')]('/:id',auth[_0xda48('0x9')](),controller[_0xda48('0xd')]);router[_0xda48('0x8')](_0xda48('0xe'),auth[_0xda48('0x9')](),controller['getDispositions']);router[_0xda48('0x8')](_0xda48('0xf'),auth['isAuthenticated'](),controller[_0xda48('0x10')]);router[_0xda48('0x8')]('/:id/logo',controller[_0xda48('0x11')]);router[_0xda48('0x8')](_0xda48('0x12'),controller[_0xda48('0x13')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0xda48('0x14')]);router['get'](_0xda48('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xda48('0x8')](_0xda48('0x16'),controller['getSnippet']);router['get'](_0xda48('0x17'),auth[_0xda48('0x9')](),controller[_0xda48('0x18')]);router[_0xda48('0x8')](_0xda48('0x19'),auth[_0xda48('0x9')](),controller['getProactiveActions']);router[_0xda48('0x8')](_0xda48('0x1a'),controller[_0xda48('0x1b')]);router[_0xda48('0x8')](_0xda48('0x1c'),auth[_0xda48('0x9')](),controller[_0xda48('0x1d')]);router[_0xda48('0x8')](_0xda48('0x1e'),auth[_0xda48('0x9')](),controller[_0xda48('0x1f')]);router[_0xda48('0x20')]('/',auth[_0xda48('0x9')](),controller[_0xda48('0x21')]);router[_0xda48('0x20')](_0xda48('0xe'),auth['isAuthenticated'](),controller[_0xda48('0x22')]);router['post'](_0xda48('0xf'),auth['isAuthenticated'](),controller[_0xda48('0x23')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x1fb848,_0x59d412,_0x23b64f){_0x23b64f(null,path[_0xda48('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x1acd4a,_0x43d762,_0xa47276){_0xa47276(null,util[_0xda48('0x26')]('%s-%s',Date[_0xda48('0x27')](),_0x43d762[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x29'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller[_0xda48('0x2c')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x6dc2a1,_0x40247e,_0x5ea3b0){_0x5ea3b0(null,path[_0xda48('0x25')](config[_0xda48('0x2d')],_0xda48('0x2e')));},'filename':function(_0x51bd91,_0x27e73f,_0x1eac1e){_0x1eac1e(null,util[_0xda48('0x26')]('%s-%s',Date[_0xda48('0x27')](),_0x27e73f['originalname']));}})});router[_0xda48('0x20')](_0xda48('0x12'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ce05a,_0x4f95be,_0x43bcc4){_0x43bcc4(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x268875,_0x187198,_0x311bb4){_0x311bb4(null,util[_0xda48('0x26')](_0xda48('0x2f'),Date[_0xda48('0x27')](),_0x187198[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x30'),upload['single'](_0xda48('0x2b')),controller[_0xda48('0x31')]);var upload=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x5175bf,_0x4650e3,_0x20a80d){_0x20a80d(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0xd33a88,_0xbb2104,_0xc1fabe){_0xc1fabe(null,util['format']('%s-%s',Date[_0xda48('0x27')](),_0xbb2104[_0xda48('0x28')]));}})});router[_0xda48('0x20')](_0xda48('0x32'),upload[_0xda48('0x2a')](_0xda48('0x2b')),controller[_0xda48('0x33')]);router[_0xda48('0x20')](_0xda48('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xda48('0x24')]({'destination':function(_0x18a2df,_0xc3b5f8,_0x565ecd){const _0x36df46=path[_0xda48('0x25')](config[_0xda48('0x2d')],_0xda48('0x35'),_0xda48('0x36'),_0xda48('0x37'));fs_extra['ensureDir'](_0x36df46,function(){_0x565ecd(null,_0x36df46);});},'filename':function(_0x1a03cc,_0x144140,_0xf5588){const _0x33387d=_0x144140[_0xda48('0x28')][_0xda48('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xfc3bf8=path['extname'](_0x33387d);const _0x43bc72=Date['now']()+'-'+_0x33387d[_0xda48('0x38')](_0xfc3bf8,'')+_0xfc3bf8;_0xf5588(null,_0x43bc72);}})});router[_0xda48('0x20')](_0xda48('0x39'),offlineUploadMulter['any'](),controller[_0xda48('0x3a')]);router[_0xda48('0x20')]('/:id/interactions',auth[_0xda48('0x9')](),controller[_0xda48('0x3b')]);router[_0xda48('0x20')]('/:id/applications',auth[_0xda48('0x9')](),controller['addApplications']);router['post'](_0xda48('0x19'),auth['isAuthenticated'](),controller[_0xda48('0x3c')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xda48('0x3d')]);router[_0xda48('0x3e')](_0xda48('0x3f'),auth[_0xda48('0x9')](),controller[_0xda48('0x40')]);router[_0xda48('0x41')](_0xda48('0x3f'),auth[_0xda48('0x9')](),controller[_0xda48('0x42')]);router[_0xda48('0x41')](_0xda48('0xe'),auth[_0xda48('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xda48('0x9')](),controller[_0xda48('0x43')]);router[_0xda48('0x41')](_0xda48('0x1e'),auth[_0xda48('0x9')](),controller['removeAgents']);module[_0xda48('0x44')]=router; \ No newline at end of file +var _0xf0ba=['%s-%s','now','originalname','/:id/logo','single','addLogo','server/files/images/avatars/','file','addAvatar','addCustomerAvatar','addSystemAvatar','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','addProactiveActions','addAgents','destroy','delete','removeDispositions','removeAgents','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','format'];(function(_0x5aed17,_0x10274f){var _0x327c2c=function(_0x449d5d){while(--_0x449d5d){_0x5aed17['push'](_0x5aed17['shift']());}};_0x327c2c(++_0x10274f);}(_0xf0ba,0x15f));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require('path');var timeout=require(_0xaf0b('0x2'));var express=require(_0xaf0b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaf0b('0x4'));var config=require(_0xaf0b('0x5'));var controller=require(_0xaf0b('0x6'));router[_0xaf0b('0x7')]('/',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x9')]);router[_0xaf0b('0x7')](_0xaf0b('0xa'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0xb')]);router[_0xaf0b('0x7')](_0xaf0b('0xc'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0x7')]('/:id/dispositions',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0xe')]);router[_0xaf0b('0x7')](_0xaf0b('0xf'),auth[_0xaf0b('0x8')](),controller['getAnswers']);router['get']('/:id/logo',controller['getLogo']);router[_0xaf0b('0x7')]('/:id/avatar',controller[_0xaf0b('0x10')]);router[_0xaf0b('0x7')](_0xaf0b('0x11'),controller['getCustomerAvatar']);router[_0xaf0b('0x7')](_0xaf0b('0x12'),controller[_0xaf0b('0x13')]);router[_0xaf0b('0x7')](_0xaf0b('0x14'),auth['isAuthenticated'](),controller[_0xaf0b('0x15')]);router[_0xaf0b('0x7')](_0xaf0b('0x16'),controller[_0xaf0b('0x17')]);router[_0xaf0b('0x7')](_0xaf0b('0x18'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x19')]);router['get']('/:id/proactive_actions',auth[_0xaf0b('0x8')](),controller['getProactiveActions']);router[_0xaf0b('0x7')]('/:id/fields',controller['getFields']);router[_0xaf0b('0x7')](_0xaf0b('0x1a'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x1b')]);router[_0xaf0b('0x7')](_0xaf0b('0x1c'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x1d')]);router[_0xaf0b('0x1e')]('/',auth['isAuthenticated'](),controller[_0xaf0b('0x1f')]);router[_0xaf0b('0x1e')](_0xaf0b('0x20'),auth[_0xaf0b('0x8')](),controller['addDisposition']);router[_0xaf0b('0x1e')](_0xaf0b('0xf'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x21')]);var upload=multer({'storage':multer[_0xaf0b('0x22')]({'destination':function(_0x58c65c,_0x37d935,_0x116b4b){_0x116b4b(null,path[_0xaf0b('0x23')](config[_0xaf0b('0x24')],_0xaf0b('0x25')));},'filename':function(_0x3322ed,_0x2ef217,_0x2e6490){_0x2e6490(null,util[_0xaf0b('0x26')](_0xaf0b('0x27'),Date[_0xaf0b('0x28')](),_0x2ef217[_0xaf0b('0x29')]));}})});router['post'](_0xaf0b('0x2a'),upload[_0xaf0b('0x2b')]('file'),controller[_0xaf0b('0x2c')]);var upload=multer({'storage':multer[_0xaf0b('0x22')]({'destination':function(_0x49774b,_0x5aff30,_0xbb140d){_0xbb140d(null,path[_0xaf0b('0x23')](config['root'],_0xaf0b('0x2d')));},'filename':function(_0x942e23,_0x3d7ca3,_0x42a7e1){_0x42a7e1(null,util[_0xaf0b('0x26')]('%s-%s',Date[_0xaf0b('0x28')](),_0x3d7ca3[_0xaf0b('0x29')]));}})});router[_0xaf0b('0x1e')]('/:id/avatar',upload[_0xaf0b('0x2b')](_0xaf0b('0x2e')),controller[_0xaf0b('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28d336,_0x3a52ad,_0x521644){_0x521644(null,path[_0xaf0b('0x23')](config[_0xaf0b('0x24')],_0xaf0b('0x2d')));},'filename':function(_0x39a2b3,_0x40eb32,_0x1c960e){_0x1c960e(null,util[_0xaf0b('0x26')](_0xaf0b('0x27'),Date[_0xaf0b('0x28')](),_0x40eb32[_0xaf0b('0x29')]));}})});router[_0xaf0b('0x1e')](_0xaf0b('0x11'),upload[_0xaf0b('0x2b')](_0xaf0b('0x2e')),controller[_0xaf0b('0x30')]);var upload=multer({'storage':multer[_0xaf0b('0x22')]({'destination':function(_0x8f65e7,_0x2d45f1,_0x282856){_0x282856(null,path[_0xaf0b('0x23')](config[_0xaf0b('0x24')],'server/files/images/avatars/'));},'filename':function(_0x3dd0e9,_0x59fdaf,_0x1c4ece){_0x1c4ece(null,util['format'](_0xaf0b('0x27'),Date[_0xaf0b('0x28')](),_0x59fdaf[_0xaf0b('0x29')]));}})});router['post']('/:id/system_avatar',upload[_0xaf0b('0x2b')](_0xaf0b('0x2e')),controller[_0xaf0b('0x31')]);router[_0xaf0b('0x1e')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x4ba134,_0x3b8990,_0x4363fb){const _0x362074=path['join'](config[_0xaf0b('0x24')],_0xaf0b('0x32'),_0xaf0b('0x33'),_0xaf0b('0x34'));fs_extra['ensureDir'](_0x362074,function(){_0x4363fb(null,_0x362074);});},'filename':function(_0x34a661,_0xd22ca7,_0x50dc8c){const _0x5610e1=_0xd22ca7[_0xaf0b('0x29')][_0xaf0b('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3b7735=path[_0xaf0b('0x36')](_0x5610e1);const _0x2e59cc=Date[_0xaf0b('0x28')]()+'-'+_0x5610e1['replace'](_0x3b7735,'')+_0x3b7735;_0x50dc8c(null,_0x2e59cc);}})});router['post'](_0xaf0b('0x37'),offlineUploadMulter[_0xaf0b('0x38')](),controller[_0xaf0b('0x39')]);router[_0xaf0b('0x1e')]('/:id/interactions',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x3a')]);router[_0xaf0b('0x1e')]('/:id/applications',auth[_0xaf0b('0x8')](),controller['addApplications']);router[_0xaf0b('0x1e')]('/:id/proactive_actions',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x3b')]);router[_0xaf0b('0x1e')](_0xaf0b('0x1c'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x3c')]);router['put'](_0xaf0b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xaf0b('0xc'),auth['isAuthenticated'](),controller[_0xaf0b('0x3d')]);router[_0xaf0b('0x3e')]('/:id/dispositions',auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x3f')]);router[_0xaf0b('0x3e')](_0xaf0b('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xaf0b('0x3e')](_0xaf0b('0x1c'),auth[_0xaf0b('0x8')](),controller[_0xaf0b('0x40')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index dc59342..4b566af 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 _0xadaf=['exports','../components/auth/service','../config/environment','Router','app','get','Client-Side\x20logger\x20not\x20found!','use'];(function(_0xc14e9b,_0x5c3047){var _0x48f298=function(_0x3ddc68){while(--_0x3ddc68){_0xc14e9b['push'](_0xc14e9b['shift']());}};_0x48f298(++_0x5c3047);}(_0xadaf,0x199));var _0xfada=function(_0x58bd72,_0x9919db){_0x58bd72=_0x58bd72-0x0;var _0x5bd2c9=_0xadaf[_0x58bd72];return _0x5bd2c9;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xfada('0x0'));var config=require(_0xfada('0x1'));var router=express[_0xfada('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x3893f2,_0x4ee33f,_0x2eb551){var _0x392017=_0x3893f2[_0xfada('0x3')][_0xfada('0x4')]('client-side-logger');if(!_0x392017){throw new Error(_0xfada('0x5'));}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x392017,'enableCors':!isProduction})(_0x3893f2,_0x4ee33f,_0x2eb551);}router[_0xfada('0x6')](auth['isAuthenticated'](),clientSideLogs);module[_0xfada('0x7')]=router; \ No newline at end of file +var _0xfdf8=['express','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated'];(function(_0x49c42f,_0x2c5628){var _0x4b9972=function(_0x2a92da){while(--_0x2a92da){_0x49c42f['push'](_0x49c42f['shift']());}};_0x4b9972(++_0x2c5628);}(_0xfdf8,0x1ec));var _0x8fdf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfdf8[_0xa464c9];return _0x3d73c4;};var beaverLogger=require('beaver-logger/server');var express=require(_0x8fdf('0x0'));var auth=require(_0x8fdf('0x1'));var config=require(_0x8fdf('0x2'));var router=express[_0x8fdf('0x3')]();var isProduction=config[_0x8fdf('0x4')]===_0x8fdf('0x5')||![];function clientSideLogs(_0x19a5c9,_0x45e635,_0x5e8df6){var _0x102c3b=_0x19a5c9[_0x8fdf('0x6')]['get']('client-side-logger');if(!_0x102c3b){throw new Error(_0x8fdf('0x7'));}return beaverLogger[_0x8fdf('0x8')]({'uri':_0x8fdf('0x9'),'logger':_0x102c3b,'enableCors':!isProduction})(_0x19a5c9,_0x45e635,_0x5e8df6);}router[_0x8fdf('0xa')](auth[_0x8fdf('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d251765..a04ef6c 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 _0x0eaa=['sequelize','STRING','ENUM','Google','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x32ee10,_0x29ade5){var _0x39ec1b=function(_0x57fda3){while(--_0x57fda3){_0x32ee10['push'](_0x32ee10['shift']());}};_0x39ec1b(++_0x29ade5);}(_0x0eaa,0x15e));var _0xa0ea=function(_0x3e100c,_0x4fab6c){_0x3e100c=_0x3e100c-0x0;var _0x138d89=_0x0eaa[_0x3e100c];return _0x138d89;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0ea('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa0ea('0x2')]('AmazonAWS',_0xa0ea('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa0ea('0x4'),_0xa0ea('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0xa0ea('0x6')},'data2':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x7')},'data3':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x8')},'data4':{'type':Sequelize[_0xa0ea('0x1')],'comment':_0xa0ea('0x9')},'data5':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa0ea('0xc')},'data7':{'type':Sequelize[_0xa0ea('0xa')],'comment':_0xa0ea('0xd')}}; \ No newline at end of file +var _0xa08c=['Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','Google','MicrosoftAzure','ENUM','Outlook365'];(function(_0x47578f,_0xc85bd8){var _0x191e91=function(_0x339c74){while(--_0x339c74){_0x47578f['push'](_0x47578f['shift']());}};_0x191e91(++_0xc85bd8);}(_0xa08c,0x77));var _0xca08=function(_0x212a74,_0x45f93c){_0x212a74=_0x212a74-0x0;var _0x5dc1fe=_0xa08c[_0x212a74];return _0x5dc1fe;};'use strict';var Sequelize=require(_0xca08('0x0'));module[_0xca08('0x1')]={'name':{'type':Sequelize[_0xca08('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xca08('0x3'),_0xca08('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xca08('0x5')](_0xca08('0x6'),_0xca08('0x7'))},'data1':{'type':Sequelize[_0xca08('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xca08('0x2')],'comment':_0xca08('0x8')},'data3':{'type':Sequelize[_0xca08('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xca08('0x2')],'comment':_0xca08('0x9')},'data5':{'type':Sequelize['TEXT'],'comment':_0xca08('0xa')},'data6':{'type':Sequelize[_0xca08('0xb')],'comment':_0xca08('0xc')},'data7':{'type':Sequelize[_0xca08('0xb')],'comment':_0xca08('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8554b46..2872ad5 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 _0x45ce=['sort','where','pick','filter','merge','VIRTUAL','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','keys','includeAll','include','options','find','service','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x221fb4,_0x20af17){var _0x32e53d=function(_0x624c3b){while(--_0x624c3b){_0x221fb4['push'](_0x221fb4['shift']());}};_0x32e53d(++_0x20af17);}(_0x45ce,0xf5));var _0xe45c=function(_0x2bb268,_0x47314a){_0x2bb268=_0x2bb268-0x0;var _0x1df5c0=_0x45ce[_0x2bb268];return _0x1df5c0;};'use strict';var _=require(_0xe45c('0x0'));var Redis=require(_0xe45c('0x1'));var qs=require(_0xe45c('0x2'));var encryptor=require(_0xe45c('0x3'));var config=require(_0xe45c('0x4'));var logger=require('../../config/logger')(_0xe45c('0x5'));var db=require(_0xe45c('0x6'))['db'];var oauth=require(_0xe45c('0x7'));config[_0xe45c('0x8')]=_['defaults'](config[_0xe45c('0x8')],{'host':_0xe45c('0x9'),'port':0x18eb});var socket=require(_0xe45c('0xa'))(new Redis(config[_0xe45c('0x8')]));var redis=new Redis(config[_0xe45c('0x8')]);function respondWithStatusCode(_0x3002f0,_0x4f9719){_0x4f9719=_0x4f9719||0xcc;return function(_0x5c51b5){if(_0x5c51b5){return _0x3002f0[_0xe45c('0xb')](_0x4f9719);}return _0x3002f0[_0xe45c('0xc')](_0x4f9719)['end']();};}function respondWithResult(_0x294f82,_0xd8dde3){_0xd8dde3=_0xd8dde3||0xc8;return function(_0xb97f1e){if(_0xb97f1e){return _0x294f82[_0xe45c('0xc')](_0xd8dde3)[_0xe45c('0xd')](_0xb97f1e);}};}function respondWithFilteredResult(_0x30757e,_0x5a3748){return function(_0x2fcafc){if(_0x2fcafc){var _0x49f70f=typeof _0x5a3748[_0xe45c('0xe')]===_0xe45c('0xf')&&typeof _0x5a3748[_0xe45c('0x10')]===_0xe45c('0xf');var _0xe72599=_0x2fcafc['count'];var _0x49704b=_0x49f70f?0x0:_0x5a3748[_0xe45c('0xe')];var _0x2240fa=_0x49f70f?_0x2fcafc[_0xe45c('0x11')]:_0x5a3748[_0xe45c('0xe')]+_0x5a3748['limit'];var _0x3d775f;if(_0x2240fa>=_0xe72599){_0x2240fa=_0xe72599;_0x3d775f=0xc8;}else{_0x3d775f=0xce;}_0x30757e[_0xe45c('0xc')](_0x3d775f);return _0x30757e['set'](_0xe45c('0x12'),_0x49704b+'-'+_0x2240fa+'/'+_0xe72599)[_0xe45c('0xd')](_0x2fcafc);}return null;};}function saveUpdates(_0x54d241){return function(_0x59664b){if(_0x59664b){return _0x59664b[_0xe45c('0x13')](_0x54d241)[_0xe45c('0x14')](function(_0x1be06c){return _0x1be06c;});}return null;};}function removeEntity(_0x35cd75){return function(_0x1c5ac8){if(_0x1c5ac8){return _0x1c5ac8['destroy']()[_0xe45c('0x14')](function(){_0x35cd75['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5132de){return function(_0x5bfc59){if(!_0x5bfc59){_0x5132de[_0xe45c('0xb')](0x194);}return _0x5bfc59;};}function handleError(_0x466577,_0x2d35c8){_0x2d35c8=_0x2d35c8||0x1f4;return function(_0x488a99){logger[_0xe45c('0x15')](_0x488a99[_0xe45c('0x16')]);if(_0x488a99['name']){delete _0x488a99[_0xe45c('0x17')];}_0x466577['status'](_0x2d35c8)[_0xe45c('0x18')](_0x488a99);};}function maskClientSecret(_0x3bccc1){return _[_0xe45c('0x19')](_0x3bccc1[_0xe45c('0x1a')](0x0,0x3),0x14,'*');}exports[_0xe45c('0x1b')]=function(_0x11dbbb,_0x3826fe){var _0x148d95={},_0x44efa9={},_0x6fca68={'count':0x0,'rows':[]};var _0x384c3c=_[_0xe45c('0x1c')](db[_0xe45c('0x1d')][_0xe45c('0x1e')],function(_0x517acd){return{'name':_0x517acd[_0xe45c('0x1f')],'type':_0x517acd['type'][_0xe45c('0x20')]};});_0x44efa9[_0xe45c('0x21')]=_['map'](_0x384c3c,'name');_0x44efa9[_0xe45c('0x22')]=_['keys'](_0x11dbbb[_0xe45c('0x22')]);_0x44efa9[_0xe45c('0x23')]=_[_0xe45c('0x24')](_0x44efa9[_0xe45c('0x21')],_0x44efa9[_0xe45c('0x22')]);_0x148d95[_0xe45c('0x25')]=_[_0xe45c('0x24')](_0x44efa9['model'],qs[_0xe45c('0x26')](_0x11dbbb[_0xe45c('0x22')]['fields']));_0x148d95['attributes']=_0x148d95[_0xe45c('0x25')][_0xe45c('0x27')]?_0x148d95['attributes']:_0x44efa9[_0xe45c('0x21')];if(!_0x11dbbb['query']['hasOwnProperty']('nolimit')){_0x148d95[_0xe45c('0x10')]=qs[_0xe45c('0x10')](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x10')]);_0x148d95[_0xe45c('0xe')]=qs[_0xe45c('0xe')](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0xe')]);}_0x148d95['order']=qs['sort'](_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x28')]);_0x148d95[_0xe45c('0x29')]=qs[_0xe45c('0x23')](_[_0xe45c('0x2a')](_0x11dbbb[_0xe45c('0x22')],_0x44efa9[_0xe45c('0x23')]),_0x384c3c);if(_0x11dbbb['query'][_0xe45c('0x2b')]){_0x148d95[_0xe45c('0x29')]=_[_0xe45c('0x2c')](_0x148d95['where'],{'$or':_[_0xe45c('0x1c')](_0x384c3c,function(_0x56d75a){if(_0x56d75a['type']!==_0xe45c('0x2d')){var _0x5caaa6={};_0x5caaa6[_0x56d75a[_0xe45c('0x17')]]={'$like':'%'+_0x11dbbb[_0xe45c('0x22')][_0xe45c('0x2b')]+'%'};return _0x5caaa6;}})});}_0x148d95=_['merge']({},_0x148d95,_0x11dbbb['options']);var _0x358f5b={'where':_0x148d95[_0xe45c('0x29')]};return db[_0xe45c('0x1d')][_0xe45c('0x11')](_0x358f5b)[_0xe45c('0x14')](function(_0x2f0a57){_0x6fca68[_0xe45c('0x11')]=_0x2f0a57;if(_0x11dbbb[_0xe45c('0x22')]['includeAll']){_0x148d95['include']=[{'all':!![]}];}return db[_0xe45c('0x1d')][_0xe45c('0x2e')](_0x148d95);})[_0xe45c('0x14')](function(_0xf14f57){_0x6fca68[_0xe45c('0x2f')]=_['map'](_0xf14f57,function(_0x557c5a){if(_0x557c5a['service']===_0xe45c('0x30')){var _0x3924e5=encryptor[_0xe45c('0x31')](_0x557c5a[_0xe45c('0x32')]);_0x557c5a[_0xe45c('0x32')]=maskClientSecret(_0x3924e5);}return _0x557c5a;});return _0x6fca68;})[_0xe45c('0x14')](respondWithFilteredResult(_0x3826fe,_0x148d95))[_0xe45c('0x33')](handleError(_0x3826fe,null));};exports[_0xe45c('0x34')]=function(_0x591cf9,_0x24d0f0){var _0x20504a={'raw':!![],'where':{'id':_0x591cf9[_0xe45c('0x35')]['id']}},_0x300695={};_0x300695[_0xe45c('0x21')]=_['keys'](db['CloudProvider'][_0xe45c('0x1e')]);_0x300695['query']=_[_0xe45c('0x36')](_0x591cf9[_0xe45c('0x22')]);_0x300695[_0xe45c('0x23')]=_[_0xe45c('0x24')](_0x300695['model'],_0x300695[_0xe45c('0x22')]);_0x20504a[_0xe45c('0x25')]=_[_0xe45c('0x24')](_0x300695[_0xe45c('0x21')],qs[_0xe45c('0x26')](_0x591cf9[_0xe45c('0x22')][_0xe45c('0x26')]));_0x20504a[_0xe45c('0x25')]=_0x20504a['attributes']['length']?_0x20504a[_0xe45c('0x25')]:_0x300695[_0xe45c('0x21')];if(_0x591cf9['query'][_0xe45c('0x37')]){_0x20504a[_0xe45c('0x38')]=[{'all':!![]}];}_0x20504a=_[_0xe45c('0x2c')]({},_0x20504a,_0x591cf9[_0xe45c('0x39')]);return db['CloudProvider'][_0xe45c('0x3a')](_0x20504a)[_0xe45c('0x14')](handleEntityNotFound(_0x24d0f0,null))[_0xe45c('0x14')](function(_0x4c5842){if(_0x4c5842[_0xe45c('0x3b')]===_0xe45c('0x30')){var _0x3ba77f=encryptor[_0xe45c('0x31')](_0x4c5842[_0xe45c('0x32')]);_0x4c5842[_0xe45c('0x32')]=maskClientSecret(_0x3ba77f);}return _0x4c5842;})['then'](respondWithResult(_0x24d0f0,null))['catch'](handleError(_0x24d0f0,null));};exports['create']=function(_0x2d01a1,_0x53f941){if(!_0x2d01a1['body'][_0xe45c('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x2d01a1[_0xe45c('0x3c')]['service'])throw new Error(_0xe45c('0x3d'));var _0x4419d2=db['CloudProvider'][_0xe45c('0x1e')][_0xe45c('0x3b')]['values'];if(!_0x4419d2[_0xe45c('0x3e')](_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x3b')]))throw new Error(_0xe45c('0x3f')+_0x4419d2['join'](',\x20'));if(_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x3b')]==='MicrosoftAzure'&&_0x2d01a1[_0xe45c('0x3c')][_0xe45c('0x32')]){_0x2d01a1[_0xe45c('0x3c')]['data3']=encryptor[_0xe45c('0x40')](_0x2d01a1[_0xe45c('0x3c')]['data3']);}return db[_0xe45c('0x1d')]['create'](_0x2d01a1[_0xe45c('0x3c')],{})[_0xe45c('0x14')](respondWithResult(_0x53f941,0xc9))['catch'](handleError(_0x53f941,null));};exports[_0xe45c('0x13')]=function(_0x44ce75,_0x4cc2f2){if(_0x44ce75[_0xe45c('0x3c')]['id']){delete _0x44ce75[_0xe45c('0x3c')]['id'];}return db[_0xe45c('0x1d')][_0xe45c('0x3a')]({'where':{'id':_0x44ce75[_0xe45c('0x35')]['id']}})[_0xe45c('0x14')](handleEntityNotFound(_0x4cc2f2,null))[_0xe45c('0x14')](function(_0x50fe75){if(_0x50fe75[_0xe45c('0x3b')]===_0xe45c('0x30')&&_0x44ce75['body'][_0xe45c('0x32')]){_0x44ce75['body'][_0xe45c('0x32')]=encryptor[_0xe45c('0x40')](_0x44ce75[_0xe45c('0x3c')]['data3']);}return _0x50fe75;})[_0xe45c('0x14')](saveUpdates(_0x44ce75['body'],null))[_0xe45c('0x14')](respondWithResult(_0x4cc2f2,null))[_0xe45c('0x33')](handleError(_0x4cc2f2,null));};exports[_0xe45c('0x41')]=function(_0x3d6b3a,_0x5a3681){return db[_0xe45c('0x1d')][_0xe45c('0x3a')]({'where':{'id':_0x3d6b3a[_0xe45c('0x35')]['id']}})[_0xe45c('0x14')](handleEntityNotFound(_0x5a3681,null))['then'](removeEntity(_0x5a3681,null))[_0xe45c('0x33')](handleError(_0x5a3681,null));};exports[_0xe45c('0x42')]=function(_0x1427cf,_0xd62d45){return db[_0xe45c('0x1d')][_0xe45c('0x43')]({'where':{'id':_0x1427cf[_0xe45c('0x35')]['id']},'raw':!![]})['then'](function(_0x412be8){if(!_0x412be8)return _0xd62d45['sendStatus'](0x194);return{'url':oauth[_0xe45c('0x44')](_0x412be8,_0x1427cf[_0xe45c('0x45')]['id'])};})[_0xe45c('0x14')](respondWithResult(_0xd62d45,null))[_0xe45c('0x33')](handleError(_0xd62d45,null));};exports[_0xe45c('0x46')]=function(_0x7664c6,_0x344937){var _0x21b93b=_0x7664c6[_0xe45c('0x3c')];var _0x17e69e;var _0x1ab70b;if(_0x21b93b[_0xe45c('0x15')])throw _0x21b93b;redis[_0xe45c('0x47')](_0x21b93b[_0xe45c('0x48')])['then'](function(_0x3d4728){if(!_0x3d4728)throw new Error(_0xe45c('0x49'));_0x17e69e=JSON[_0xe45c('0x4a')](_0x3d4728);var _0x139287=Buffer[_0xe45c('0x4b')](_0x21b93b[_0xe45c('0x48')],_0xe45c('0x4c'))['toString'](_0xe45c('0x4d'));_0x1ab70b=JSON[_0xe45c('0x4a')](_0x139287);if(!oauth[_0xe45c('0x4e')](_0x21b93b[_0xe45c('0x4f')],_0x17e69e[_0xe45c('0x50')]))throw new Error(_0xe45c('0x51'));redis[_0xe45c('0x52')](_0x21b93b[_0xe45c('0x48')]);return oauth[_0xe45c('0x53')](_0x21b93b[_0xe45c('0x54')],_0x17e69e);})[_0xe45c('0x14')](function(_0x338ca8){_0x17e69e[_0xe45c('0x55')]=_0x338ca8['access_token'];_0x17e69e[_0xe45c('0x56')]=_0x338ca8[_0xe45c('0x57')];return db[_0xe45c('0x1d')]['update']({'data5':_0x17e69e['data5'],'data6':_0x17e69e[_0xe45c('0x56')]},{'where':{'id':_0x17e69e['id']}});})[_0xe45c('0x14')](function(){oauth['startRefreshInterval'](_0x17e69e);socket[_0xe45c('0x58')](_0xe45c('0x59'),{'id':_0x1ab70b['id']});return;})[_0xe45c('0x14')](respondWithStatusCode(_0x344937,null))[_0xe45c('0x33')](function(_0x1c284e){if(_0x1ab70b){socket[_0xe45c('0x58')](_0xe45c('0x5a'),{'id':_0x1ab70b['id']});}if(!_0x17e69e){logger[_0xe45c('0x15')](_0xe45c('0x5b'),_0x1c284e);return _0x344937['status'](0x1f4)[_0xe45c('0x18')](_0x1c284e[_0xe45c('0x5c')]);}logger[_0xe45c('0x15')](_0xe45c('0x5d'),_0x17e69e['id'],JSON[_0xe45c('0x5e')](_0x1c284e));});}; \ No newline at end of file +var _0x278b=['del','code','access_token','refresh_token','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','destroy','error','stack','name','send','padEnd','map','CloudProvider','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','service','decryptString','data3','show','params','rawAttributes','MicrosoftAzure','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','find','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','from','base64','toString','ascii','parse','id_token','oauth2Claims'];(function(_0xd86b18,_0x16e22d){var _0x496606=function(_0x4d881b){while(--_0x4d881b){_0xd86b18['push'](_0xd86b18['shift']());}};_0x496606(++_0x16e22d);}(_0x278b,0x183));var _0xb278=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x278b[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xb278('0x0'));var Redis=require(_0xb278('0x1'));var qs=require(_0xb278('0x2'));var encryptor=require(_0xb278('0x3'));var config=require(_0xb278('0x4'));var logger=require(_0xb278('0x5'))('api');var db=require(_0xb278('0x6'))['db'];var oauth=require(_0xb278('0x7'));config[_0xb278('0x8')]=_[_0xb278('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb278('0xa'))(new Redis(config[_0xb278('0x8')]));var redis=new Redis(config[_0xb278('0x8')]);function respondWithStatusCode(_0xc314b5,_0x19e61e){_0x19e61e=_0x19e61e||0xcc;return function(_0x2b2f2c){if(_0x2b2f2c){return _0xc314b5[_0xb278('0xb')](_0x19e61e);}return _0xc314b5[_0xb278('0xc')](_0x19e61e)[_0xb278('0xd')]();};}function respondWithResult(_0x27f857,_0x1041a4){_0x1041a4=_0x1041a4||0xc8;return function(_0x426ff1){if(_0x426ff1){return _0x27f857['status'](_0x1041a4)[_0xb278('0xe')](_0x426ff1);}};}function respondWithFilteredResult(_0x2a39c9,_0x454ff1){return function(_0x13bf2b){if(_0x13bf2b){var _0x7bdf01=typeof _0x454ff1['offset']===_0xb278('0xf')&&typeof _0x454ff1[_0xb278('0x10')]===_0xb278('0xf');var _0x31c68b=_0x13bf2b[_0xb278('0x11')];var _0x2a5864=_0x7bdf01?0x0:_0x454ff1['offset'];var _0x20d34a=_0x7bdf01?_0x13bf2b['count']:_0x454ff1[_0xb278('0x12')]+_0x454ff1[_0xb278('0x10')];var _0x508fb2;if(_0x20d34a>=_0x31c68b){_0x20d34a=_0x31c68b;_0x508fb2=0xc8;}else{_0x508fb2=0xce;}_0x2a39c9[_0xb278('0xc')](_0x508fb2);return _0x2a39c9['set'](_0xb278('0x13'),_0x2a5864+'-'+_0x20d34a+'/'+_0x31c68b)[_0xb278('0xe')](_0x13bf2b);}return null;};}function saveUpdates(_0x99605f){return function(_0x3070f7){if(_0x3070f7){return _0x3070f7[_0xb278('0x14')](_0x99605f)[_0xb278('0x15')](function(_0x5f5376){return _0x5f5376;});}return null;};}function removeEntity(_0xfc900e){return function(_0x1d32e6){if(_0x1d32e6){return _0x1d32e6[_0xb278('0x16')]()[_0xb278('0x15')](function(){_0xfc900e['status'](0xcc)[_0xb278('0xd')]();});}};}function handleEntityNotFound(_0x3aa98d){return function(_0x2c161a){if(!_0x2c161a){_0x3aa98d[_0xb278('0xb')](0x194);}return _0x2c161a;};}function handleError(_0x1bbd7c,_0x3f8c0e){_0x3f8c0e=_0x3f8c0e||0x1f4;return function(_0x3c64b4){logger[_0xb278('0x17')](_0x3c64b4[_0xb278('0x18')]);if(_0x3c64b4[_0xb278('0x19')]){delete _0x3c64b4[_0xb278('0x19')];}_0x1bbd7c[_0xb278('0xc')](_0x3f8c0e)[_0xb278('0x1a')](_0x3c64b4);};}function maskClientSecret(_0x339365){return _[_0xb278('0x1b')](_0x339365['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x11f3ca,_0x4ac881){var _0x52d11c={},_0x3e6c0d={},_0x4d0e84={'count':0x0,'rows':[]};var _0x1b56e7=_[_0xb278('0x1c')](db[_0xb278('0x1d')]['rawAttributes'],function(_0x202055){return{'name':_0x202055[_0xb278('0x1e')],'type':_0x202055[_0xb278('0x1f')][_0xb278('0x20')]};});_0x3e6c0d['model']=_['map'](_0x1b56e7,_0xb278('0x19'));_0x3e6c0d[_0xb278('0x21')]=_[_0xb278('0x22')](_0x11f3ca[_0xb278('0x21')]);_0x3e6c0d['filters']=_[_0xb278('0x23')](_0x3e6c0d[_0xb278('0x24')],_0x3e6c0d[_0xb278('0x21')]);_0x52d11c[_0xb278('0x25')]=_[_0xb278('0x23')](_0x3e6c0d[_0xb278('0x24')],qs['fields'](_0x11f3ca[_0xb278('0x21')][_0xb278('0x26')]));_0x52d11c[_0xb278('0x25')]=_0x52d11c[_0xb278('0x25')][_0xb278('0x27')]?_0x52d11c['attributes']:_0x3e6c0d[_0xb278('0x24')];if(!_0x11f3ca[_0xb278('0x21')][_0xb278('0x28')]('nolimit')){_0x52d11c[_0xb278('0x10')]=qs['limit'](_0x11f3ca[_0xb278('0x21')][_0xb278('0x10')]);_0x52d11c['offset']=qs[_0xb278('0x12')](_0x11f3ca['query']['offset']);}_0x52d11c[_0xb278('0x29')]=qs['sort'](_0x11f3ca['query'][_0xb278('0x2a')]);_0x52d11c[_0xb278('0x2b')]=qs[_0xb278('0x2c')](_[_0xb278('0x2d')](_0x11f3ca[_0xb278('0x21')],_0x3e6c0d[_0xb278('0x2c')]),_0x1b56e7);if(_0x11f3ca[_0xb278('0x21')]['filter']){_0x52d11c[_0xb278('0x2b')]=_[_0xb278('0x2e')](_0x52d11c[_0xb278('0x2b')],{'$or':_[_0xb278('0x1c')](_0x1b56e7,function(_0x2d3a2f){if(_0x2d3a2f[_0xb278('0x1f')]!==_0xb278('0x2f')){var _0xc76d89={};_0xc76d89[_0x2d3a2f['name']]={'$like':'%'+_0x11f3ca[_0xb278('0x21')][_0xb278('0x30')]+'%'};return _0xc76d89;}})});}_0x52d11c=_[_0xb278('0x2e')]({},_0x52d11c,_0x11f3ca[_0xb278('0x31')]);var _0x349942={'where':_0x52d11c[_0xb278('0x2b')]};return db[_0xb278('0x1d')][_0xb278('0x11')](_0x349942)[_0xb278('0x15')](function(_0x53f28b){_0x4d0e84['count']=_0x53f28b;if(_0x11f3ca['query'][_0xb278('0x32')]){_0x52d11c[_0xb278('0x33')]=[{'all':!![]}];}return db[_0xb278('0x1d')][_0xb278('0x34')](_0x52d11c);})[_0xb278('0x15')](function(_0x576d40){_0x4d0e84['rows']=_[_0xb278('0x1c')](_0x576d40,function(_0x44d906){if(_0x44d906[_0xb278('0x35')]==='MicrosoftAzure'){var _0x55a246=encryptor[_0xb278('0x36')](_0x44d906[_0xb278('0x37')]);_0x44d906['data3']=maskClientSecret(_0x55a246);}return _0x44d906;});return _0x4d0e84;})['then'](respondWithFilteredResult(_0x4ac881,_0x52d11c))['catch'](handleError(_0x4ac881,null));};exports[_0xb278('0x38')]=function(_0x314b8b,_0x5203fd){var _0x210209={'raw':!![],'where':{'id':_0x314b8b[_0xb278('0x39')]['id']}},_0x49e18a={};_0x49e18a['model']=_[_0xb278('0x22')](db[_0xb278('0x1d')][_0xb278('0x3a')]);_0x49e18a[_0xb278('0x21')]=_['keys'](_0x314b8b['query']);_0x49e18a[_0xb278('0x2c')]=_['intersection'](_0x49e18a[_0xb278('0x24')],_0x49e18a[_0xb278('0x21')]);_0x210209[_0xb278('0x25')]=_[_0xb278('0x23')](_0x49e18a[_0xb278('0x24')],qs[_0xb278('0x26')](_0x314b8b[_0xb278('0x21')][_0xb278('0x26')]));_0x210209['attributes']=_0x210209[_0xb278('0x25')][_0xb278('0x27')]?_0x210209[_0xb278('0x25')]:_0x49e18a['model'];if(_0x314b8b[_0xb278('0x21')][_0xb278('0x32')]){_0x210209[_0xb278('0x33')]=[{'all':!![]}];}_0x210209=_[_0xb278('0x2e')]({},_0x210209,_0x314b8b[_0xb278('0x31')]);return db[_0xb278('0x1d')]['find'](_0x210209)[_0xb278('0x15')](handleEntityNotFound(_0x5203fd,null))[_0xb278('0x15')](function(_0x333bf0){if(_0x333bf0[_0xb278('0x35')]===_0xb278('0x3b')){var _0x2e4328=encryptor[_0xb278('0x36')](_0x333bf0[_0xb278('0x37')]);_0x333bf0['data3']=maskClientSecret(_0x2e4328);}return _0x333bf0;})[_0xb278('0x15')](respondWithResult(_0x5203fd,null))[_0xb278('0x3c')](handleError(_0x5203fd,null));};exports[_0xb278('0x3d')]=function(_0x76768,_0x3fcd14){if(!_0x76768[_0xb278('0x3e')][_0xb278('0x19')])throw new Error(_0xb278('0x3f'));if(!_0x76768[_0xb278('0x3e')][_0xb278('0x35')])throw new Error(_0xb278('0x40'));var _0x50ddd5=db[_0xb278('0x1d')]['rawAttributes'][_0xb278('0x35')][_0xb278('0x41')];if(!_0x50ddd5[_0xb278('0x42')](_0x76768[_0xb278('0x3e')][_0xb278('0x35')]))throw new Error(_0xb278('0x43')+_0x50ddd5[_0xb278('0x44')](',\x20'));if(_0x76768[_0xb278('0x3e')][_0xb278('0x35')]===_0xb278('0x3b')&&_0x76768[_0xb278('0x3e')]['data3']){_0x76768[_0xb278('0x3e')][_0xb278('0x37')]=encryptor['encryptString'](_0x76768[_0xb278('0x3e')][_0xb278('0x37')]);}return db[_0xb278('0x1d')]['create'](_0x76768[_0xb278('0x3e')],{})[_0xb278('0x15')](respondWithResult(_0x3fcd14,0xc9))['catch'](handleError(_0x3fcd14,null));};exports[_0xb278('0x14')]=function(_0x17b475,_0x436019){if(_0x17b475[_0xb278('0x3e')]['id']){delete _0x17b475[_0xb278('0x3e')]['id'];}return db['CloudProvider'][_0xb278('0x45')]({'where':{'id':_0x17b475[_0xb278('0x39')]['id']}})['then'](handleEntityNotFound(_0x436019,null))[_0xb278('0x15')](function(_0x3f2301){if(_0x3f2301['service']==='MicrosoftAzure'&&_0x17b475[_0xb278('0x3e')][_0xb278('0x37')]){_0x17b475[_0xb278('0x3e')][_0xb278('0x37')]=encryptor[_0xb278('0x46')](_0x17b475[_0xb278('0x3e')][_0xb278('0x37')]);}return _0x3f2301;})[_0xb278('0x15')](saveUpdates(_0x17b475[_0xb278('0x3e')],null))['then'](respondWithResult(_0x436019,null))[_0xb278('0x3c')](handleError(_0x436019,null));};exports[_0xb278('0x16')]=function(_0xd3ec6d,_0x3a8731){return db[_0xb278('0x1d')][_0xb278('0x45')]({'where':{'id':_0xd3ec6d[_0xb278('0x39')]['id']}})[_0xb278('0x15')](handleEntityNotFound(_0x3a8731,null))[_0xb278('0x15')](removeEntity(_0x3a8731,null))['catch'](handleError(_0x3a8731,null));};exports[_0xb278('0x47')]=function(_0xd587dd,_0x1196c9){return db[_0xb278('0x1d')]['findOne']({'where':{'id':_0xd587dd[_0xb278('0x39')]['id']},'raw':!![]})[_0xb278('0x15')](function(_0x23b2d2){if(!_0x23b2d2)return _0x1196c9[_0xb278('0xb')](0x194);return{'url':oauth[_0xb278('0x48')](_0x23b2d2,_0xd587dd['user']['id'])};})[_0xb278('0x15')](respondWithResult(_0x1196c9,null))[_0xb278('0x3c')](handleError(_0x1196c9,null));};exports[_0xb278('0x49')]=function(_0x57536f,_0xbfa766){var _0xc8793a=_0x57536f[_0xb278('0x3e')];var _0x362093;var _0xde85e3;if(_0xc8793a[_0xb278('0x17')])throw _0xc8793a;redis[_0xb278('0x4a')](_0xc8793a[_0xb278('0x4b')])[_0xb278('0x15')](function(_0x457403){if(!_0x457403)throw new Error('Invalid\x20state\x20parameter');_0x362093=JSON['parse'](_0x457403);var _0x1b99a9=Buffer[_0xb278('0x4c')](_0xc8793a[_0xb278('0x4b')],_0xb278('0x4d'))[_0xb278('0x4e')](_0xb278('0x4f'));_0xde85e3=JSON[_0xb278('0x50')](_0x1b99a9);if(!oauth['isValidIdToken'](_0xc8793a[_0xb278('0x51')],_0x362093[_0xb278('0x52')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xb278('0x53')](_0xc8793a[_0xb278('0x4b')]);return oauth['getOauth2MicrosoftAccessToken'](_0xc8793a[_0xb278('0x54')],_0x362093);})['then'](function(_0x2eccae){_0x362093['data5']=_0x2eccae[_0xb278('0x55')];_0x362093['data6']=_0x2eccae[_0xb278('0x56')];return db['CloudProvider'][_0xb278('0x14')]({'data5':_0x362093['data5'],'data6':_0x362093['data6']},{'where':{'id':_0x362093['id']}});})[_0xb278('0x15')](function(){oauth['startRefreshInterval'](_0x362093);socket['emit'](_0xb278('0x57'),{'id':_0xde85e3['id']});return;})['then'](respondWithStatusCode(_0xbfa766,null))['catch'](function(_0x54552f){if(_0xde85e3){socket[_0xb278('0x58')](_0xb278('0x59'),{'id':_0xde85e3['id']});}if(!_0x362093){logger['error'](_0xb278('0x5a'),_0x54552f);return _0xbfa766[_0xb278('0xc')](0x1f4)[_0xb278('0x1a')](_0x54552f[_0xb278('0x5b')]);}logger['error'](_0xb278('0x5c'),_0x362093['id'],JSON[_0xb278('0x5d')](_0x54552f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6bcb5dd..f8b19fd 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 _0x692e=['bluebird','request-promise','rimraf','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','api','moment'];(function(_0x4c1991,_0x11a24b){var _0x4fbd4a=function(_0x4f478f){while(--_0x4f478f){_0x4c1991['push'](_0x4c1991['shift']());}};_0x4fbd4a(++_0x11a24b);}(_0x692e,0xa3));var _0xe692=function(_0x2bbd83,_0x3aeddb){_0x2bbd83=_0x2bbd83-0x0;var _0x45cf9d=_0x692e[_0x2bbd83];return _0x45cf9d;};'use strict';var _=require(_0xe692('0x0'));var util=require(_0xe692('0x1'));var logger=require(_0xe692('0x2'))(_0xe692('0x3'));var moment=require(_0xe692('0x4'));var BPromise=require(_0xe692('0x5'));var rp=require(_0xe692('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe692('0x7'));var config=require('../../config/environment');var attributes=require(_0xe692('0x8'));module[_0xe692('0x9')]=function(_0x571dc5,_0x595c05){return _0x571dc5[_0xe692('0xa')]('CloudProvider',attributes,{'tableName':_0xe692('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e8=['bluebird','request-promise','path','../../config/environment','define','cloud_providers','lodash','util','../../config/logger','moment'];(function(_0x24559c,_0x4f52f7){var _0xdb1e01=function(_0x14d647){while(--_0x14d647){_0x24559c['push'](_0x24559c['shift']());}};_0xdb1e01(++_0x4f52f7);}(_0xe4e8,0x10a));var _0x8e4e=function(_0xab21d1,_0x4ea754){_0xab21d1=_0xab21d1-0x0;var _0x29c22e=_0xe4e8[_0xab21d1];return _0x29c22e;};'use strict';var _=require(_0x8e4e('0x0'));var util=require(_0x8e4e('0x1'));var logger=require(_0x8e4e('0x2'))('api');var moment=require(_0x8e4e('0x3'));var BPromise=require(_0x8e4e('0x4'));var rp=require(_0x8e4e('0x5'));var fs=require('fs');var path=require(_0x8e4e('0x6'));var rimraf=require('rimraf');var config=require(_0x8e4e('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x155570,_0x318291){return _0x155570[_0x8e4e('0x8')]('CloudProvider',attributes,{'tableName':_0x8e4e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 17c2441..cf1f0c1 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 _0x702a=['client_id','data1','data4','response_mode','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','set','decode','iss','issuer','isAfter','exp','resolve','then','findOne','data6','decryptString','POST','data2','access_token','refresh_token','update','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data3','intervals','bind','CloudProvider','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','id_token','from','stringify','toString','base64','randomBytes'];(function(_0x4eae3c,_0xba4fe4){var _0x4265a6=function(_0xead087){while(--_0xead087){_0x4eae3c['push'](_0x4eae3c['shift']());}};_0x4265a6(++_0xba4fe4);}(_0x702a,0x1ba));var _0xa702=function(_0x24dade,_0x449b06){_0x24dade=_0x24dade-0x0;var _0x17eca3=_0x702a[_0x24dade];return _0x17eca3;};'use strict';var _=require(_0xa702('0x0'));var crypto=require('crypto');var jwt=require(_0xa702('0x1'));var moment=require(_0xa702('0x2'));var Redis=require('ioredis');var rp=require(_0xa702('0x3'));var util=require(_0xa702('0x4'));var encryptor=require(_0xa702('0x5'));var config=require(_0xa702('0x6'));var logger=require(_0xa702('0x7'))(_0xa702('0x8'));var schedule=require(_0xa702('0x9'));var db=require('../../mysqldb')['db'];config[_0xa702('0xa')]=_[_0xa702('0xb')](config[_0xa702('0xa')],{'host':_0xa702('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa702('0xa')]);var MICROSOFT_AUTH_URL=_0xa702('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa702('0xe'),_0xa702('0xf'),'email',_0xa702('0x10'),_0xa702('0x11'),_0xa702('0x12'),_0xa702('0x13')],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa702('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x207b64){var _0x1869e8=_[_0xa702('0x15')](AZURE_AUTH_SCOPES[_0x207b64['type']]);if(_0x207b64[_0xa702('0x16')]===_0xa702('0x17'))_0x1869e8[_0xa702('0x18')](_0x207b64[_0xa702('0x19')]+_0xa702('0x1a'));return _0x1869e8[_0xa702('0x1b')]('\x20');}function getAccessTokenScope(_0xa32011){if(_0xa32011[_0xa702('0x16')]===_0xa702('0x1c'))return _0xa702('0x11');if(_0xa32011[_0xa702('0x16')]===_0xa702('0x17'))return _0xa32011['data7']+_0xa702('0x1a');}function generateMicrosoftAuthorizationUrl(_0x402f72,_0x11d27d){var _0xd23ddf=MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x402f72['data2']);var _0x5df0d6=[_0xa702('0x1f'),_0xa702('0x20')];var _0x220f0b=Buffer[_0xa702('0x21')](JSON[_0xa702('0x22')]({'id':_0x11d27d}))[_0xa702('0x23')](_0xa702('0x24'));var _0x42bd75=crypto[_0xa702('0x25')](0x10)[_0xa702('0x23')]('hex');var _0x28ed17=getAuthorizationScopes(_0x402f72);var _0x128104=[{'key':_0xa702('0x26'),'value':_0x402f72[_0xa702('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x5df0d6[_0xa702('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x402f72[_0xa702('0x28')]},{'key':_0xa702('0x29'),'value':'form_post'},{'key':_0xa702('0x2a'),'value':encodeURIComponent(_0x28ed17)},{'key':_0xa702('0x2b'),'value':_0x220f0b},{'key':_0xa702('0x2c'),'value':_0x42bd75},{'key':_0xa702('0x2d'),'value':_0xa702('0x2e')}];var _0x3cbdff=_0xd23ddf+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x128104,function(_0x18dce1){return _0x18dce1['key']+'='+_0x18dce1[_0xa702('0x2f')];})['join']('&');_0x402f72[_0xa702('0x30')]={'issuer':_0xd23ddf[_0xa702('0x1d')](_0xa702('0x31'),''),'audience':_0x402f72['data1'],'state':_0x220f0b,'nonce':_0x42bd75};redis[_0xa702('0x32')](_0x220f0b,JSON[_0xa702('0x22')](_0x402f72));return _0x3cbdff;}function isValidIdToken(_0x27b8e6,_0x55cbf1){try{var _0x2d7dfe=jwt[_0xa702('0x33')](_0x27b8e6,{'complete':!![]});var _0x1a3a6d=_0x2d7dfe['payload'];if(_0x1a3a6d[_0xa702('0x34')]!==_0x55cbf1[_0xa702('0x35')])return![];if(_0x1a3a6d['aud']!==_0x55cbf1['audience'])return![];if(_0x1a3a6d['nonce']!==_0x55cbf1['nonce'])return![];if(moment()[_0xa702('0x36')](moment['unix'](_0x1a3a6d[_0xa702('0x37')])))return![];return!![];}catch(_0xf99eae){throw _0xf99eae;}}function refreshOauth2MicrosoftAccessToken(_0x5858b7){return Promise[_0xa702('0x38')]()[_0xa702('0x39')](function(){if(_0x5858b7['data3'])return _0x5858b7;return db['CloudProvider'][_0xa702('0x3a')]({'where':{'id':_0x5858b7['id']},'raw':!![]});})[_0xa702('0x39')](function(_0x40de28){var _0x5d1d6e={'grant_type':'refresh_token','refresh_token':_0x40de28[_0xa702('0x3b')],'scope':getAccessTokenScope(_0x40de28),'redirect_uri':_0x40de28['data4'],'client_id':_0x40de28[_0xa702('0x27')],'client_secret':encryptor[_0xa702('0x3c')](_0x40de28['data3'])};var _0x3d949b={'method':_0xa702('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x40de28[_0xa702('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d1d6e,'json':!![]};return rp(_0x3d949b);})[_0xa702('0x39')](function(_0x4219a6){_0x5858b7['data5']=_0x4219a6[_0xa702('0x3f')];_0x5858b7['data6']=_0x4219a6[_0xa702('0x40')];return db['CloudProvider'][_0xa702('0x41')]({'data5':_0x5858b7[_0xa702('0x42')],'data6':_0x5858b7['data6']},{'where':{'id':_0x5858b7['id']}});})['then'](function(){return _0x5858b7;})[_0xa702('0x43')](function(_0x34a00a){logger[_0xa702('0x44')](_0xa702('0x45'),_0x5858b7['id'],_0x34a00a);});}function getOauth2MicrosoftAccessToken(_0x228a8c,_0x20ca7c){var _0xb37884={'grant_type':_0xa702('0x46'),'code':_0x228a8c,'scope':getAccessTokenScope(_0x20ca7c),'redirect_uri':_0x20ca7c[_0xa702('0x28')],'client_id':_0x20ca7c[_0xa702('0x27')],'client_secret':encryptor[_0xa702('0x3c')](_0x20ca7c[_0xa702('0x47')])};var _0x43f9fa={'method':_0xa702('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xa702('0x1d')](_0xa702('0x1e'),_0x20ca7c[_0xa702('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xb37884,'json':!![]};return rp(_0x43f9fa);}function startRefreshInterval(_0xb54067){var _0x2ce412=schedule[_0xa702('0x48')];if(_0x2ce412[_0xb54067['id']])clearInterval(_0x2ce412[_0xb54067['id']]);_0x2ce412[_0xb54067['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa702('0x49')](this,{'id':_0xb54067['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2ce412;}function startAllRefreshIntervals(){return db[_0xa702('0x4a')][_0xa702('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa702('0x39')](function(_0x53afbe){var _0x2b6a6c=_0x53afbe[_0xa702('0x15')](function(_0x145f82){return refreshOauth2MicrosoftAccessToken(_0x145f82)[_0xa702('0x39')](function(_0xa337d){startRefreshInterval(_0xa337d);});});return Promise[_0xa702('0x4c')](_0x2b6a6c);})[_0xa702('0x43')](function(_0x2302d1){var _0x31a778=_0x2302d1?util[_0xa702('0x4d')](_0x2302d1,{'showHidden':![],'depth':null}):'';logger[_0xa702('0x44')](_0xa702('0x4e'),_0x31a778);});}module[_0xa702('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xcb0b=['decryptString','POST','data5','access_token','update','error','intervals','bind','map','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','type','push','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','nonce','prompt','login','key','value','oauth2/','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','refresh_token','data6'];(function(_0x181cba,_0x434762){var _0x1ffade=function(_0x2a994d){while(--_0x2a994d){_0x181cba['push'](_0x181cba['shift']());}};_0x1ffade(++_0x434762);}(_0xcb0b,0x199));var _0xbcb0=function(_0x1582b6,_0x3ecb05){_0x1582b6=_0x1582b6-0x0;var _0x1dbbe4=_0xcb0b[_0x1582b6];return _0x1dbbe4;};'use strict';var _=require('lodash');var crypto=require(_0xbcb0('0x0'));var jwt=require(_0xbcb0('0x1'));var moment=require('moment');var Redis=require(_0xbcb0('0x2'));var rp=require(_0xbcb0('0x3'));var util=require(_0xbcb0('0x4'));var encryptor=require(_0xbcb0('0x5'));var config=require(_0xbcb0('0x6'));var logger=require(_0xbcb0('0x7'))('api');var schedule=require(_0xbcb0('0x8'));var db=require(_0xbcb0('0x9'))['db'];config[_0xbcb0('0xa')]=_['defaults'](config[_0xbcb0('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xbcb0('0xa')]);var MICROSOFT_AUTH_URL=_0xbcb0('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xbcb0('0xc'),_0xbcb0('0xd'),_0xbcb0('0xe'),_0xbcb0('0xf'),_0xbcb0('0x10'),_0xbcb0('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xbcb0('0x12');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4ed5f3){var _0x26447c=_['map'](AZURE_AUTH_SCOPES[_0x4ed5f3[_0xbcb0('0x13')]]);if(_0x4ed5f3[_0xbcb0('0x13')]==='Dynamics365')_0x26447c[_0xbcb0('0x14')](_0x4ed5f3[_0xbcb0('0x15')]+_0xbcb0('0x16'));return _0x26447c[_0xbcb0('0x17')]('\x20');}function getAccessTokenScope(_0x4027ca){if(_0x4027ca[_0xbcb0('0x13')]===_0xbcb0('0x18'))return _0xbcb0('0x10');if(_0x4027ca[_0xbcb0('0x13')]===_0xbcb0('0x19'))return _0x4027ca[_0xbcb0('0x15')]+_0xbcb0('0x16');}function generateMicrosoftAuthorizationUrl(_0x19119a,_0x1ad0bb){var _0x3fd1b7=MICROSOFT_AUTH_URL[_0xbcb0('0x1a')](_0xbcb0('0x1b'),_0x19119a[_0xbcb0('0x1c')]);var _0x1624bb=[_0xbcb0('0x1d'),_0xbcb0('0x1e')];var _0xbf1ba7=Buffer[_0xbcb0('0x1f')](JSON[_0xbcb0('0x20')]({'id':_0x1ad0bb}))[_0xbcb0('0x21')](_0xbcb0('0x22'));var _0x19eb8e=crypto[_0xbcb0('0x23')](0x10)[_0xbcb0('0x21')](_0xbcb0('0x24'));var _0x22af41=getAuthorizationScopes(_0x19119a);var _0xea234=[{'key':_0xbcb0('0x25'),'value':_0x19119a[_0xbcb0('0x26')]},{'key':_0xbcb0('0x27'),'value':encodeURIComponent(_0x1624bb['join']('\x20'))},{'key':_0xbcb0('0x28'),'value':_0x19119a[_0xbcb0('0x29')]},{'key':_0xbcb0('0x2a'),'value':'form_post'},{'key':_0xbcb0('0x2b'),'value':encodeURIComponent(_0x22af41)},{'key':'state','value':_0xbf1ba7},{'key':_0xbcb0('0x2c'),'value':_0x19eb8e},{'key':_0xbcb0('0x2d'),'value':_0xbcb0('0x2e')}];var _0x51f054=_0x3fd1b7+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xea234,function(_0x423788){return _0x423788[_0xbcb0('0x2f')]+'='+_0x423788[_0xbcb0('0x30')];})[_0xbcb0('0x17')]('&');_0x19119a['oauth2Claims']={'issuer':_0x3fd1b7['replace'](_0xbcb0('0x31'),''),'audience':_0x19119a[_0xbcb0('0x26')],'state':_0xbf1ba7,'nonce':_0x19eb8e};redis['set'](_0xbf1ba7,JSON[_0xbcb0('0x20')](_0x19119a));return _0x51f054;}function isValidIdToken(_0x2ad6d5,_0xeb9651){try{var _0x127fe6=jwt[_0xbcb0('0x32')](_0x2ad6d5,{'complete':!![]});var _0x5ef996=_0x127fe6[_0xbcb0('0x33')];if(_0x5ef996[_0xbcb0('0x34')]!==_0xeb9651[_0xbcb0('0x35')])return![];if(_0x5ef996[_0xbcb0('0x36')]!==_0xeb9651[_0xbcb0('0x37')])return![];if(_0x5ef996[_0xbcb0('0x2c')]!==_0xeb9651[_0xbcb0('0x2c')])return![];if(moment()[_0xbcb0('0x38')](moment[_0xbcb0('0x39')](_0x5ef996[_0xbcb0('0x3a')])))return![];return!![];}catch(_0x210e41){throw _0x210e41;}}function refreshOauth2MicrosoftAccessToken(_0x30a470){return Promise[_0xbcb0('0x3b')]()[_0xbcb0('0x3c')](function(){if(_0x30a470[_0xbcb0('0x3d')])return _0x30a470;return db[_0xbcb0('0x3e')]['findOne']({'where':{'id':_0x30a470['id']},'raw':!![]});})['then'](function(_0x27cf49){var _0x4d2fff={'grant_type':_0xbcb0('0x3f'),'refresh_token':_0x27cf49[_0xbcb0('0x40')],'scope':getAccessTokenScope(_0x27cf49),'redirect_uri':_0x27cf49[_0xbcb0('0x29')],'client_id':_0x27cf49[_0xbcb0('0x26')],'client_secret':encryptor[_0xbcb0('0x41')](_0x27cf49['data3'])};var _0x1424a0={'method':_0xbcb0('0x42'),'uri':MICROSOFT_AUTH_URL['replace'](_0xbcb0('0x1b'),_0x27cf49[_0xbcb0('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4d2fff,'json':!![]};return rp(_0x1424a0);})[_0xbcb0('0x3c')](function(_0x39cd5a){_0x30a470[_0xbcb0('0x43')]=_0x39cd5a[_0xbcb0('0x44')];_0x30a470['data6']=_0x39cd5a[_0xbcb0('0x3f')];return db[_0xbcb0('0x3e')][_0xbcb0('0x45')]({'data5':_0x30a470[_0xbcb0('0x43')],'data6':_0x30a470[_0xbcb0('0x40')]},{'where':{'id':_0x30a470['id']}});})[_0xbcb0('0x3c')](function(){return _0x30a470;})['catch'](function(_0x5edcdc){logger[_0xbcb0('0x46')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x30a470['id'],_0x5edcdc);});}function getOauth2MicrosoftAccessToken(_0x5d7794,_0x4f18f2){var _0x124ed3={'grant_type':'authorization_code','code':_0x5d7794,'scope':getAccessTokenScope(_0x4f18f2),'redirect_uri':_0x4f18f2[_0xbcb0('0x29')],'client_id':_0x4f18f2[_0xbcb0('0x26')],'client_secret':encryptor['decryptString'](_0x4f18f2[_0xbcb0('0x3d')])};var _0x1f9e7e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xbcb0('0x1a')]('{TENANT_ID}',_0x4f18f2['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x124ed3,'json':!![]};return rp(_0x1f9e7e);}function startRefreshInterval(_0x31d0c3){var _0x564f41=schedule[_0xbcb0('0x47')];if(_0x564f41[_0x31d0c3['id']])clearInterval(_0x564f41[_0x31d0c3['id']]);_0x564f41[_0x31d0c3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xbcb0('0x48')](this,{'id':_0x31d0c3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xbcb0('0x47')]=_0x564f41;}function startAllRefreshIntervals(){return db[_0xbcb0('0x3e')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xbcb0('0x3c')](function(_0x505418){var _0x21d891=_0x505418[_0xbcb0('0x49')](function(_0x5a476a){return refreshOauth2MicrosoftAccessToken(_0x5a476a)[_0xbcb0('0x3c')](function(_0x1401a0){startRefreshInterval(_0x1401a0);});});return Promise[_0xbcb0('0x4a')](_0x21d891);})[_0xbcb0('0x4b')](function(_0x22a2f6){var _0x2f38a9=_0x22a2f6?util[_0xbcb0('0x4c')](_0x22a2f6,{'showHidden':![],'depth':null}):'';logger[_0xbcb0('0x46')](_0xbcb0('0x4d'),_0x2f38a9);});}module[_0xbcb0('0x4e')]={'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 5f5134c..ac8119c 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 _0x0c2b=['code','CloudProvider,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c2b,0x194));var _0xb0c2=function(_0x4b6bad,_0x2d8cfb){_0x4b6bad=_0x4b6bad-0x0;var _0x30b494=_0x0c2b[_0x4b6bad];return _0x30b494;};'use strict';var _=require(_0xb0c2('0x0'));var util=require(_0xb0c2('0x1'));var moment=require('moment');var BPromise=require(_0xb0c2('0x2'));var rs=require(_0xb0c2('0x3'));var fs=require('fs');var Redis=require(_0xb0c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0c2('0x5'))(_0xb0c2('0x6'));var config=require(_0xb0c2('0x7'));var jayson=require(_0xb0c2('0x8'));var client=jayson[_0xb0c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18649a,_0x3fe284,_0x13d064){return new BPromise(function(_0x5052b8,_0x247201){return client[_0xb0c2('0xa')](_0x18649a,_0x13d064)[_0xb0c2('0xb')](function(_0x281dd2){logger['info']('CloudProvider,\x20%s,\x20%s',_0x3fe284,_0xb0c2('0xc'));logger[_0xb0c2('0xd')](_0xb0c2('0xe'),_0x3fe284,_0xb0c2('0xc'),JSON['stringify'](_0x281dd2));if(_0x281dd2[_0xb0c2('0xf')]){if(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x10')]===0x1f4){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x247201(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);return _0x5052b8(_0x281dd2[_0xb0c2('0xf')][_0xb0c2('0x12')]);}else{logger['info'](_0xb0c2('0x11'),_0x3fe284,_0xb0c2('0xc'));_0x5052b8(_0x281dd2[_0xb0c2('0x13')]['message']);}})['catch'](function(_0x332d44){logger[_0xb0c2('0xf')](_0xb0c2('0x11'),_0x3fe284,_0x332d44);_0x247201(_0x332d44);});});} \ No newline at end of file +var _0x6a0b=['info','request\x20sent','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message'];(function(_0x342041,_0x1819d1){var _0x1c696b=function(_0x3fea1c){while(--_0x3fea1c){_0x342041['push'](_0x342041['shift']());}};_0x1c696b(++_0x1819d1);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x5f9f89,_0x18c1ac){_0x5f9f89=_0x5f9f89-0x0;var _0x241ea9=_0x6a0b[_0x5f9f89];return _0x241ea9;};'use strict';var _=require(_0xb6a0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb6a0('0x1'));var rs=require(_0xb6a0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb6a0('0x3'))['db'];var utils=require(_0xb6a0('0x4'));var logger=require(_0xb6a0('0x5'))(_0xb6a0('0x6'));var config=require(_0xb6a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb6a0('0x8')][_0xb6a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41bec1,_0xef4451,_0xb107bd){return new BPromise(function(_0x434911,_0x4357a5){return client[_0xb6a0('0xa')](_0x41bec1,_0xb107bd)[_0xb6a0('0xb')](function(_0x4e3aaf){logger['info']('CloudProvider,\x20%s,\x20%s',_0xef4451,'request\x20sent');logger['debug'](_0xb6a0('0xc'),_0xef4451,'request\x20sent',JSON[_0xb6a0('0xd')](_0x4e3aaf));if(_0x4e3aaf[_0xb6a0('0xe')]){if(_0x4e3aaf['error'][_0xb6a0('0xf')]===0x1f4){logger[_0xb6a0('0xe')](_0xb6a0('0x10'),_0xef4451,_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);return _0x4357a5(_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);}logger[_0xb6a0('0xe')](_0xb6a0('0x10'),_0xef4451,_0x4e3aaf[_0xb6a0('0xe')]['message']);return _0x434911(_0x4e3aaf[_0xb6a0('0xe')][_0xb6a0('0x11')]);}else{logger[_0xb6a0('0x12')](_0xb6a0('0x10'),_0xef4451,_0xb6a0('0x13'));_0x434911(_0x4e3aaf[_0xb6a0('0x14')][_0xb6a0('0x11')]);}})[_0xb6a0('0x15')](function(_0x1cb284){logger['error'](_0xb6a0('0x10'),_0xef4451,_0x1cb284);_0x4357a5(_0x1cb284);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c4bf6b3..72ce6ad 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x43979e,_0x1377b1){var _0x18b594=function(_0x131f80){while(--_0x131f80){_0x43979e['push'](_0x43979e['shift']());}};_0x18b594(++_0x1377b1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0x1261,0x144));var _0x1126=function(_0x2e6ab8,_0x4ea85c){_0x2e6ab8=_0x2e6ab8-0x0;var _0x16cba0=_0x1261[_0x2e6ab8];return _0x16cba0;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 5515285..257293c 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 _0x57fa=['exports','name','STRING'];(function(_0x53ee0b,_0x18950a){var _0x40074a=function(_0x571888){while(--_0x571888){_0x53ee0b['push'](_0x53ee0b['shift']());}};_0x40074a(++_0x18950a);}(_0x57fa,0x7e));var _0xa57f=function(_0x38bc5d,_0x8ba01a){_0x38bc5d=_0x38bc5d-0x0;var _0x1c729c=_0x57fa[_0x38bc5d];return _0x1c729c;};'use strict';var Sequelize=require('sequelize');module[_0xa57f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa57f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xa57f('0x2')]},'companyId':{'type':Sequelize[_0xa57f('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa57f('0x2')]},'type':{'type':Sequelize[_0xa57f('0x2')]},'street':{'type':Sequelize[_0xa57f('0x2')]},'postalCode':{'type':Sequelize[_0xa57f('0x2')]},'city':{'type':Sequelize[_0xa57f('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa57f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xa57f('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xa57f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x03fc=['name','sequelize','exports','STRING'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x03fc,0xb9));var _0xc03f=function(_0x33210d,_0xb42117){_0x33210d=_0x33210d-0x0;var _0x3d30f1=_0x03fc[_0x33210d];return _0x3d30f1;};'use strict';var Sequelize=require(_0xc03f('0x0'));module[_0xc03f('0x1')]={'name':{'type':Sequelize[_0xc03f('0x2')],'unique':_0xc03f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xc03f('0x2')]},'website':{'type':Sequelize[_0xc03f('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc03f('0x2')]},'type':{'type':Sequelize[_0xc03f('0x2')]},'street':{'type':Sequelize[_0xc03f('0x2')]},'postalCode':{'type':Sequelize[_0xc03f('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc03f('0x2')]},'email':{'type':Sequelize[_0xc03f('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc03f('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xc03f('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xc03f('0x2')]},'description':{'type':Sequelize[_0xc03f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cb2d1e2..02d57a3 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 _0x367b=['moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','intersection','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','body','CmContact','addContacts','ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x367b,0xad));var _0xb367=function(_0x2b0a4d,_0xbe72f3){_0x2b0a4d=_0x2b0a4d-0x0;var _0x2bd3b8=_0x367b[_0x2b0a4d];return _0x2bd3b8;};'use strict';var emlformat=require(_0xb367('0x0'));var rimraf=require(_0xb367('0x1'));var zipdir=require(_0xb367('0x2'));var jsonpatch=require(_0xb367('0x3'));var rp=require(_0xb367('0x4'));var moment=require(_0xb367('0x5'));var BPromise=require(_0xb367('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb367('0x7'));var csv=require(_0xb367('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb367('0x9'));var _=require(_0xb367('0xa'));var squel=require(_0xb367('0xb'));var crypto=require(_0xb367('0xc'));var jsforce=require(_0xb367('0xd'));var deskjs=require(_0xb367('0xe'));var toCsv=require(_0xb367('0x8'));var querystring=require('querystring');var Papa=require(_0xb367('0xf'));var Redis=require(_0xb367('0x10'));var authService=require(_0xb367('0x11'));var qs=require(_0xb367('0x12'));var as=require(_0xb367('0x13'));var hardwareService=require(_0xb367('0x14'));var logger=require(_0xb367('0x15'))(_0xb367('0x16'));var utils=require(_0xb367('0x17'));var config=require(_0xb367('0x18'));var licenseUtil=require(_0xb367('0x19'));var db=require(_0xb367('0x1a'))['db'];function respondWithStatusCode(_0x579e78,_0x42e559){_0x42e559=_0x42e559||0xcc;return function(_0x5ee3fd){if(_0x5ee3fd){return _0x579e78[_0xb367('0x1b')](_0x42e559);}return _0x579e78[_0xb367('0x1c')](_0x42e559)[_0xb367('0x1d')]();};}function respondWithResult(_0x36d5ad,_0x42a186){_0x42a186=_0x42a186||0xc8;return function(_0x2aeffe){if(_0x2aeffe){return _0x36d5ad[_0xb367('0x1c')](_0x42a186)[_0xb367('0x1e')](_0x2aeffe);}};}function respondWithFilteredResult(_0x5e418f,_0x45954d){return function(_0xadaef7){if(_0xadaef7){var _0x25b985=typeof _0x45954d[_0xb367('0x1f')]===_0xb367('0x20')&&typeof _0x45954d[_0xb367('0x21')]===_0xb367('0x20');var _0x1ba6c1=_0xadaef7[_0xb367('0x22')];var _0x27109a=_0x25b985?0x0:_0x45954d[_0xb367('0x1f')];var _0x334cee=_0x25b985?_0xadaef7[_0xb367('0x22')]:_0x45954d['offset']+_0x45954d[_0xb367('0x21')];var _0x162bac;if(_0x334cee>=_0x1ba6c1){_0x334cee=_0x1ba6c1;_0x162bac=0xc8;}else{_0x162bac=0xce;}_0x5e418f[_0xb367('0x1c')](_0x162bac);return _0x5e418f[_0xb367('0x23')](_0xb367('0x24'),_0x27109a+'-'+_0x334cee+'/'+_0x1ba6c1)[_0xb367('0x1e')](_0xadaef7);}return null;};}function patchUpdates(_0x9e34e){return function(_0xe68626){try{jsonpatch[_0xb367('0x25')](_0xe68626,_0x9e34e,!![]);}catch(_0x33c666){return BPromise[_0xb367('0x26')](_0x33c666);}return _0xe68626[_0xb367('0x27')]();};}function saveUpdates(_0x6eed21,_0x6a1563){return function(_0x2fb98b){if(_0x2fb98b){return _0x2fb98b[_0xb367('0x28')](_0x6eed21)[_0xb367('0x29')](function(_0x631109){return _0x631109;});}return null;};}function removeEntity(_0x5e0d23,_0x485e06){return function(_0x54bf6f){if(_0x54bf6f){return _0x54bf6f[_0xb367('0x2a')]()['then'](function(){var _0xd35e34=_0x54bf6f[_0xb367('0x2b')]({'plain':!![]});var _0x5c4780='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x5c4780,'resourceId':_0xd35e34['id']}})[_0xb367('0x29')](function(){return _0x54bf6f;});})[_0xb367('0x29')](function(){_0x5e0d23['status'](0xcc)[_0xb367('0x1d')]();});}};}function handleEntityNotFound(_0x5d32e5,_0x30bf7e){return function(_0x9e4643){if(!_0x9e4643){_0x5d32e5['sendStatus'](0x194);}return _0x9e4643;};}function handleError(_0x41736a,_0x380d7a){_0x380d7a=_0x380d7a||0x1f4;return function(_0x46584c){logger[_0xb367('0x2c')](_0x46584c['stack']);if(_0x46584c[_0xb367('0x2d')]){delete _0x46584c['name'];}_0x41736a['status'](_0x380d7a)[_0xb367('0x2e')](_0x46584c);};}exports[_0xb367('0x2f')]=function(_0x398b62,_0x4b2fd5){var _0x1f74e0={},_0x2267f2={},_0x3bf422={'count':0x0,'rows':[]};return db[_0xb367('0x30')][_0xb367('0x31')]()['then'](function(_0x524224){_0x2267f2[_0xb367('0x32')]=_[_0xb367('0x33')](_0x524224);_0x2267f2[_0xb367('0x34')]=_[_0xb367('0x33')](_0x398b62[_0xb367('0x34')]);_0x2267f2[_0xb367('0x35')]=_['intersection'](_0x2267f2[_0xb367('0x32')],_0x2267f2[_0xb367('0x34')]);_0x1f74e0[_0xb367('0x36')]=_['intersection'](_0x2267f2['model'],qs[_0xb367('0x37')](_0x398b62['query']['fields']));_0x1f74e0[_0xb367('0x36')]=_0x1f74e0[_0xb367('0x36')]['length']?_0x1f74e0[_0xb367('0x36')]:_0x2267f2[_0xb367('0x32')];if(!_0x398b62[_0xb367('0x34')][_0xb367('0x38')](_0xb367('0x39'))){_0x1f74e0[_0xb367('0x21')]=qs[_0xb367('0x21')](_0x398b62[_0xb367('0x34')][_0xb367('0x21')]);_0x1f74e0[_0xb367('0x1f')]=qs['offset'](_0x398b62[_0xb367('0x34')][_0xb367('0x1f')]);}_0x1f74e0[_0xb367('0x3a')]=qs['sort'](_0x398b62[_0xb367('0x34')][_0xb367('0x3b')]);_0x1f74e0[_0xb367('0x3c')]=qs[_0xb367('0x35')](_[_0xb367('0x3d')](_0x398b62[_0xb367('0x34')],_0x2267f2[_0xb367('0x35')]),_0x524224);if(_0x398b62[_0xb367('0x34')][_0xb367('0x3e')]){_0x1f74e0[_0xb367('0x3c')]=_[_0xb367('0x3f')](_0x1f74e0[_0xb367('0x3c')],{'$or':_[_0xb367('0x40')](_0x1f74e0['attributes'],function(_0x5d9f87){var _0x1961a5={};_0x1961a5[_0x5d9f87]={'$like':'%'+_0x398b62[_0xb367('0x34')][_0xb367('0x3e')]+'%'};return _0x1961a5;})});}_0x1f74e0=_[_0xb367('0x3f')]({},_0x1f74e0,_0x398b62[_0xb367('0x41')]);var _0x508526={'where':_0x1f74e0[_0xb367('0x3c')]};return db[_0xb367('0x30')]['count'](_0x508526)[_0xb367('0x29')](function(_0x30d5fc){_0x3bf422[_0xb367('0x22')]=_0x30d5fc;if(_0x398b62[_0xb367('0x34')][_0xb367('0x42')]){_0x1f74e0[_0xb367('0x43')]=[{'all':!![]}];}return db[_0xb367('0x30')]['findAll'](_0x1f74e0);})['then'](function(_0x2d8010){_0x3bf422[_0xb367('0x44')]=_0x2d8010;return _0x3bf422;})[_0xb367('0x29')](respondWithFilteredResult(_0x4b2fd5,_0x1f74e0))[_0xb367('0x45')](handleError(_0x4b2fd5,null));})[_0xb367('0x45')](handleError(_0x4b2fd5,null));};exports[_0xb367('0x46')]=function(_0x46f6c0,_0x5eaeca){var _0x20ddd2={'raw':![],'where':{'id':_0x46f6c0[_0xb367('0x47')]['id']}},_0x94519={};_0x94519['model']=_[_0xb367('0x33')](db[_0xb367('0x30')]['rawAttributes']);_0x94519['query']=_[_0xb367('0x33')](_0x46f6c0['query']);_0x94519['filters']=_[_0xb367('0x48')](_0x94519[_0xb367('0x32')],_0x94519[_0xb367('0x34')]);_0x20ddd2[_0xb367('0x36')]=_[_0xb367('0x48')](_0x94519[_0xb367('0x32')],qs[_0xb367('0x37')](_0x46f6c0['query'][_0xb367('0x37')]));_0x20ddd2[_0xb367('0x36')]=_0x20ddd2[_0xb367('0x36')][_0xb367('0x49')]?_0x20ddd2[_0xb367('0x36')]:_0x94519[_0xb367('0x32')];if(_0x46f6c0[_0xb367('0x34')][_0xb367('0x42')]){_0x20ddd2['include']=[{'all':!![]}];}_0x20ddd2=_['merge']({},_0x20ddd2,_0x46f6c0[_0xb367('0x41')]);return db[_0xb367('0x30')][_0xb367('0x4a')](_0x20ddd2)['then'](handleEntityNotFound(_0x5eaeca,null))['then'](respondWithResult(_0x5eaeca,null))[_0xb367('0x45')](handleError(_0x5eaeca,null));};exports[_0xb367('0x4b')]=function(_0x335e2a,_0x4e3551){return db[_0xb367('0x30')][_0xb367('0x4b')](_0x335e2a['body'],{})[_0xb367('0x29')](function(_0x47b934){var _0x4a67e6=_0x335e2a[_0xb367('0x4c')][_0xb367('0x2b')]({'plain':!![]});if(!_0x4a67e6)throw new Error(_0xb367('0x4d'));if(_0x4a67e6[_0xb367('0x4e')]===_0xb367('0x4c')){var _0x45af76=_0x47b934[_0xb367('0x2b')]({'plain':!![]});var _0x5b6245='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x5b6245,'userProfileId':_0x4a67e6[_0xb367('0x4f')]},'raw':!![]})[_0xb367('0x29')](function(_0x3afcd5){if(_0x3afcd5&&_0x3afcd5[_0xb367('0x50')]===0x0){return db[_0xb367('0x51')]['create']({'name':_0x45af76[_0xb367('0x2d')],'resourceId':_0x45af76['id'],'type':_0x3afcd5[_0xb367('0x2d')],'sectionId':_0x3afcd5['id']},{})[_0xb367('0x29')](function(){return _0x47b934;});}else{return _0x47b934;}})[_0xb367('0x45')](function(_0x589942){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x589942);throw _0x589942;});}return _0x47b934;})['then'](respondWithResult(_0x4e3551,0xc9))[_0xb367('0x45')](handleError(_0x4e3551,null));};exports['update']=function(_0x121057,_0x11a904){if(_0x121057[_0xb367('0x52')]['id']){delete _0x121057[_0xb367('0x52')]['id'];}return db[_0xb367('0x30')]['find']({'where':{'id':_0x121057['params']['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x11a904,null))[_0xb367('0x29')](saveUpdates(_0x121057[_0xb367('0x52')],null))[_0xb367('0x29')](respondWithResult(_0x11a904,null))[_0xb367('0x45')](handleError(_0x11a904,null));};exports[_0xb367('0x2a')]=function(_0x89cbef,_0x2df46c){return db[_0xb367('0x30')][_0xb367('0x4a')]({'where':{'id':_0x89cbef[_0xb367('0x47')]['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x2df46c,null))['then'](removeEntity(_0x2df46c,null))['catch'](handleError(_0x2df46c,null));};exports[_0xb367('0x31')]=function(_0x3525cb,_0x3dfce2){return db[_0xb367('0x30')]['describe']()[_0xb367('0x29')](respondWithResult(_0x3dfce2,null))[_0xb367('0x45')](handleError(_0x3dfce2,null));};exports['addContacts']=function(_0x161d70,_0x3c0b2a,_0x1bb34c){return db[_0xb367('0x53')][_0xb367('0x4a')]({'where':{'id':_0x161d70['params']['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x3c0b2a,null))['then'](function(_0x297236){if(_0x297236){return _0x297236[_0xb367('0x54')](_0x161d70[_0xb367('0x52')][_0xb367('0x55')],_['omit'](_0x161d70[_0xb367('0x52')],['ids','id'])||{});}})[_0xb367('0x29')](respondWithResult(_0x3c0b2a,null))[_0xb367('0x45')](handleError(_0x3c0b2a,null));};exports[_0xb367('0x56')]=function(_0x3083ce,_0x7e7c8c,_0x467df4){var _0x216a26={};var _0x31142f={};var _0x591100;var _0xe3817e;return db[_0xb367('0x30')][_0xb367('0x57')]({'where':{'id':_0x3083ce[_0xb367('0x47')]['id']}})[_0xb367('0x29')](handleEntityNotFound(_0x7e7c8c,null))[_0xb367('0x29')](function(_0x2550c1){if(_0x2550c1){_0x591100=_0x2550c1;_0x31142f['model']=_[_0xb367('0x33')](db[_0xb367('0x53')][_0xb367('0x58')]);_0x31142f[_0xb367('0x34')]=_['keys'](_0x3083ce['query']);_0x31142f[_0xb367('0x35')]=_[_0xb367('0x48')](_0x31142f[_0xb367('0x32')],_0x31142f['query']);_0x216a26[_0xb367('0x36')]=_[_0xb367('0x48')](_0x31142f['model'],qs[_0xb367('0x37')](_0x3083ce['query'][_0xb367('0x37')]));_0x216a26[_0xb367('0x36')]=_0x216a26[_0xb367('0x36')][_0xb367('0x49')]?_0x216a26[_0xb367('0x36')]:_0x31142f[_0xb367('0x32')];_0x216a26[_0xb367('0x3a')]=qs[_0xb367('0x3b')](_0x3083ce[_0xb367('0x34')][_0xb367('0x3b')]);_0x216a26['where']=qs['filters'](_['pick'](_0x3083ce[_0xb367('0x34')],_0x31142f[_0xb367('0x35')]));if(_0x3083ce[_0xb367('0x34')][_0xb367('0x3e')]){_0x216a26['where']=_[_0xb367('0x3f')](_0x216a26[_0xb367('0x3c')],{'$or':_[_0xb367('0x40')](_0x216a26[_0xb367('0x36')],function(_0x5e8230){var _0x254144={};_0x254144[_0x5e8230]={'$like':'%'+_0x3083ce[_0xb367('0x34')][_0xb367('0x3e')]+'%'};return _0x254144;})});}_0x216a26=_[_0xb367('0x3f')]({},_0x216a26,_0x3083ce[_0xb367('0x41')]);return _0x591100[_0xb367('0x56')](_0x216a26);}})[_0xb367('0x29')](function(_0x18f983){if(_0x18f983){_0xe3817e=_0x18f983['length'];if(!_0x3083ce[_0xb367('0x34')][_0xb367('0x38')](_0xb367('0x39'))){_0x216a26['limit']=qs['limit'](_0x3083ce[_0xb367('0x34')][_0xb367('0x21')]);_0x216a26['offset']=qs[_0xb367('0x1f')](_0x3083ce[_0xb367('0x34')][_0xb367('0x1f')]);}return _0x591100[_0xb367('0x56')](_0x216a26);}})[_0xb367('0x29')](function(_0x2710d4){if(_0x2710d4){return _0x2710d4?{'count':_0xe3817e,'rows':_0x2710d4}:null;}})[_0xb367('0x29')](respondWithResult(_0x7e7c8c,null))[_0xb367('0x45')](handleError(_0x7e7c8c,null));}; \ No newline at end of file +var _0xf526=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Companies','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','CmContact','addContacts','omit','ids','getContacts','findOne','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','save','then','destroy','get','stack','name','send','index','CmCompany','describe','model','keys','query'];(function(_0x499eaf,_0x560a5a){var _0x2fa121=function(_0x286a7b){while(--_0x286a7b){_0x499eaf['push'](_0x499eaf['shift']());}};_0x2fa121(++_0x560a5a);}(_0xf526,0x17e));var _0x6f52=function(_0x2d0db8,_0x57d377){_0x2d0db8=_0x2d0db8-0x0;var _0xfd14dc=_0xf526[_0x2d0db8];return _0xfd14dc;};'use strict';var emlformat=require(_0x6f52('0x0'));var rimraf=require(_0x6f52('0x1'));var zipdir=require(_0x6f52('0x2'));var jsonpatch=require(_0x6f52('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6f52('0x4'));var Mustache=require(_0x6f52('0x5'));var util=require(_0x6f52('0x6'));var path=require(_0x6f52('0x7'));var sox=require(_0x6f52('0x8'));var csv=require(_0x6f52('0x9'));var ejs=require(_0x6f52('0xa'));var fs=require('fs');var fs_extra=require(_0x6f52('0xb'));var _=require(_0x6f52('0xc'));var squel=require(_0x6f52('0xd'));var crypto=require('crypto');var jsforce=require(_0x6f52('0xe'));var deskjs=require(_0x6f52('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6f52('0x10'));var Redis=require(_0x6f52('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f52('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6f52('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6f52('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x330eb9,_0x8e589e){_0x8e589e=_0x8e589e||0xcc;return function(_0x2ee423){if(_0x2ee423){return _0x330eb9[_0x6f52('0x15')](_0x8e589e);}return _0x330eb9[_0x6f52('0x16')](_0x8e589e)[_0x6f52('0x17')]();};}function respondWithResult(_0x1af977,_0x4ded51){_0x4ded51=_0x4ded51||0xc8;return function(_0x49857c){if(_0x49857c){return _0x1af977[_0x6f52('0x16')](_0x4ded51)[_0x6f52('0x18')](_0x49857c);}};}function respondWithFilteredResult(_0x47ac57,_0x182786){return function(_0x456852){if(_0x456852){var _0x490bbf=typeof _0x182786[_0x6f52('0x19')]===_0x6f52('0x1a')&&typeof _0x182786['limit']==='undefined';var _0x56b0ca=_0x456852[_0x6f52('0x1b')];var _0x2e4aa5=_0x490bbf?0x0:_0x182786['offset'];var _0x2dbf2e=_0x490bbf?_0x456852['count']:_0x182786[_0x6f52('0x19')]+_0x182786[_0x6f52('0x1c')];var _0x2d4b3b;if(_0x2dbf2e>=_0x56b0ca){_0x2dbf2e=_0x56b0ca;_0x2d4b3b=0xc8;}else{_0x2d4b3b=0xce;}_0x47ac57[_0x6f52('0x16')](_0x2d4b3b);return _0x47ac57[_0x6f52('0x1d')]('Content-Range',_0x2e4aa5+'-'+_0x2dbf2e+'/'+_0x56b0ca)['json'](_0x456852);}return null;};}function patchUpdates(_0x579571){return function(_0x181758){try{jsonpatch['apply'](_0x181758,_0x579571,!![]);}catch(_0x124376){return BPromise['reject'](_0x124376);}return _0x181758[_0x6f52('0x1e')]();};}function saveUpdates(_0x3ae22c,_0x2701c9){return function(_0x2ea381){if(_0x2ea381){return _0x2ea381['update'](_0x3ae22c)[_0x6f52('0x1f')](function(_0xff84f7){return _0xff84f7;});}return null;};}function removeEntity(_0x43b93a,_0x39ee89){return function(_0xc146d2){if(_0xc146d2){return _0xc146d2[_0x6f52('0x20')]()['then'](function(){var _0x47f7d3=_0xc146d2[_0x6f52('0x21')]({'plain':!![]});var _0x36b72f='Companies';return db['UserProfileResource']['destroy']({'where':{'type':_0x36b72f,'resourceId':_0x47f7d3['id']}})[_0x6f52('0x1f')](function(){return _0xc146d2;});})[_0x6f52('0x1f')](function(){_0x43b93a[_0x6f52('0x16')](0xcc)[_0x6f52('0x17')]();});}};}function handleEntityNotFound(_0x3a6e08,_0x5bd20a){return function(_0x1909db){if(!_0x1909db){_0x3a6e08['sendStatus'](0x194);}return _0x1909db;};}function handleError(_0x2731af,_0x2521dc){_0x2521dc=_0x2521dc||0x1f4;return function(_0x40807a){logger['error'](_0x40807a[_0x6f52('0x22')]);if(_0x40807a[_0x6f52('0x23')]){delete _0x40807a[_0x6f52('0x23')];}_0x2731af['status'](_0x2521dc)[_0x6f52('0x24')](_0x40807a);};}exports[_0x6f52('0x25')]=function(_0x6bddc,_0x13d8c4){var _0x458860={},_0x17cfca={},_0x232a77={'count':0x0,'rows':[]};return db[_0x6f52('0x26')][_0x6f52('0x27')]()['then'](function(_0x56dac1){_0x17cfca[_0x6f52('0x28')]=_[_0x6f52('0x29')](_0x56dac1);_0x17cfca[_0x6f52('0x2a')]=_[_0x6f52('0x29')](_0x6bddc[_0x6f52('0x2a')]);_0x17cfca[_0x6f52('0x2b')]=_[_0x6f52('0x2c')](_0x17cfca[_0x6f52('0x28')],_0x17cfca[_0x6f52('0x2a')]);_0x458860[_0x6f52('0x2d')]=_[_0x6f52('0x2c')](_0x17cfca[_0x6f52('0x28')],qs['fields'](_0x6bddc[_0x6f52('0x2a')][_0x6f52('0x2e')]));_0x458860[_0x6f52('0x2d')]=_0x458860['attributes'][_0x6f52('0x2f')]?_0x458860[_0x6f52('0x2d')]:_0x17cfca['model'];if(!_0x6bddc[_0x6f52('0x2a')][_0x6f52('0x30')](_0x6f52('0x31'))){_0x458860[_0x6f52('0x1c')]=qs[_0x6f52('0x1c')](_0x6bddc['query'][_0x6f52('0x1c')]);_0x458860[_0x6f52('0x19')]=qs[_0x6f52('0x19')](_0x6bddc[_0x6f52('0x2a')]['offset']);}_0x458860[_0x6f52('0x32')]=qs[_0x6f52('0x33')](_0x6bddc[_0x6f52('0x2a')][_0x6f52('0x33')]);_0x458860['where']=qs[_0x6f52('0x2b')](_[_0x6f52('0x34')](_0x6bddc[_0x6f52('0x2a')],_0x17cfca[_0x6f52('0x2b')]),_0x56dac1);if(_0x6bddc[_0x6f52('0x2a')]['filter']){_0x458860['where']=_[_0x6f52('0x35')](_0x458860[_0x6f52('0x36')],{'$or':_['map'](_0x458860['attributes'],function(_0x17750e){var _0x5ef582={};_0x5ef582[_0x17750e]={'$like':'%'+_0x6bddc[_0x6f52('0x2a')][_0x6f52('0x37')]+'%'};return _0x5ef582;})});}_0x458860=_[_0x6f52('0x35')]({},_0x458860,_0x6bddc[_0x6f52('0x38')]);var _0x185a9b={'where':_0x458860['where']};return db['CmCompany'][_0x6f52('0x1b')](_0x185a9b)[_0x6f52('0x1f')](function(_0x470824){_0x232a77[_0x6f52('0x1b')]=_0x470824;if(_0x6bddc[_0x6f52('0x2a')][_0x6f52('0x39')]){_0x458860[_0x6f52('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0x6f52('0x3b')](_0x458860);})[_0x6f52('0x1f')](function(_0x7cf4f){_0x232a77[_0x6f52('0x3c')]=_0x7cf4f;return _0x232a77;})[_0x6f52('0x1f')](respondWithFilteredResult(_0x13d8c4,_0x458860))[_0x6f52('0x3d')](handleError(_0x13d8c4,null));})[_0x6f52('0x3d')](handleError(_0x13d8c4,null));};exports[_0x6f52('0x3e')]=function(_0x1190ea,_0x5efdca){var _0x1b638c={'raw':![],'where':{'id':_0x1190ea[_0x6f52('0x3f')]['id']}},_0x39697c={};_0x39697c[_0x6f52('0x28')]=_[_0x6f52('0x29')](db[_0x6f52('0x26')]['rawAttributes']);_0x39697c['query']=_[_0x6f52('0x29')](_0x1190ea[_0x6f52('0x2a')]);_0x39697c['filters']=_['intersection'](_0x39697c[_0x6f52('0x28')],_0x39697c['query']);_0x1b638c[_0x6f52('0x2d')]=_['intersection'](_0x39697c[_0x6f52('0x28')],qs[_0x6f52('0x2e')](_0x1190ea[_0x6f52('0x2a')]['fields']));_0x1b638c[_0x6f52('0x2d')]=_0x1b638c['attributes'][_0x6f52('0x2f')]?_0x1b638c[_0x6f52('0x2d')]:_0x39697c[_0x6f52('0x28')];if(_0x1190ea['query']['includeAll']){_0x1b638c[_0x6f52('0x3a')]=[{'all':!![]}];}_0x1b638c=_[_0x6f52('0x35')]({},_0x1b638c,_0x1190ea['options']);return db[_0x6f52('0x26')]['find'](_0x1b638c)[_0x6f52('0x1f')](handleEntityNotFound(_0x5efdca,null))[_0x6f52('0x1f')](respondWithResult(_0x5efdca,null))['catch'](handleError(_0x5efdca,null));};exports[_0x6f52('0x40')]=function(_0x15969c,_0x337687){return db[_0x6f52('0x26')][_0x6f52('0x40')](_0x15969c[_0x6f52('0x41')],{})['then'](function(_0x1430b4){var _0xe7b5ce=_0x15969c['user'][_0x6f52('0x21')]({'plain':!![]});if(!_0xe7b5ce)throw new Error(_0x6f52('0x42'));if(_0xe7b5ce[_0x6f52('0x43')]===_0x6f52('0x44')){var _0x27cbf3=_0x1430b4[_0x6f52('0x21')]({'plain':!![]});var _0xd03ca4=_0x6f52('0x45');return db[_0x6f52('0x46')][_0x6f52('0x47')]({'where':{'name':_0xd03ca4,'userProfileId':_0xe7b5ce[_0x6f52('0x48')]},'raw':!![]})[_0x6f52('0x1f')](function(_0x1df7dd){if(_0x1df7dd&&_0x1df7dd[_0x6f52('0x49')]===0x0){return db[_0x6f52('0x4a')]['create']({'name':_0x27cbf3['name'],'resourceId':_0x27cbf3['id'],'type':_0x1df7dd[_0x6f52('0x23')],'sectionId':_0x1df7dd['id']},{})[_0x6f52('0x1f')](function(){return _0x1430b4;});}else{return _0x1430b4;}})[_0x6f52('0x3d')](function(_0x469b1d){logger[_0x6f52('0x4b')](_0x6f52('0x4c'),_0x469b1d);throw _0x469b1d;});}return _0x1430b4;})[_0x6f52('0x1f')](respondWithResult(_0x337687,0xc9))[_0x6f52('0x3d')](handleError(_0x337687,null));};exports[_0x6f52('0x4d')]=function(_0x4e001b,_0x5bf2df){if(_0x4e001b[_0x6f52('0x41')]['id']){delete _0x4e001b['body']['id'];}return db[_0x6f52('0x26')]['find']({'where':{'id':_0x4e001b['params']['id']}})[_0x6f52('0x1f')](handleEntityNotFound(_0x5bf2df,null))[_0x6f52('0x1f')](saveUpdates(_0x4e001b[_0x6f52('0x41')],null))['then'](respondWithResult(_0x5bf2df,null))[_0x6f52('0x3d')](handleError(_0x5bf2df,null));};exports[_0x6f52('0x20')]=function(_0x419525,_0x4298bd){return db[_0x6f52('0x26')][_0x6f52('0x47')]({'where':{'id':_0x419525[_0x6f52('0x3f')]['id']}})[_0x6f52('0x1f')](handleEntityNotFound(_0x4298bd,null))['then'](removeEntity(_0x4298bd,null))[_0x6f52('0x3d')](handleError(_0x4298bd,null));};exports[_0x6f52('0x27')]=function(_0x59c701,_0x301ca8){return db[_0x6f52('0x26')]['describe']()[_0x6f52('0x1f')](respondWithResult(_0x301ca8,null))[_0x6f52('0x3d')](handleError(_0x301ca8,null));};exports['addContacts']=function(_0x49a6d6,_0x1d02ae,_0x525ce3){return db[_0x6f52('0x4e')][_0x6f52('0x47')]({'where':{'id':_0x49a6d6[_0x6f52('0x3f')]['id']}})[_0x6f52('0x1f')](handleEntityNotFound(_0x1d02ae,null))[_0x6f52('0x1f')](function(_0x345d8f){if(_0x345d8f){return _0x345d8f[_0x6f52('0x4f')](_0x49a6d6[_0x6f52('0x41')]['ids'],_[_0x6f52('0x50')](_0x49a6d6[_0x6f52('0x41')],[_0x6f52('0x51'),'id'])||{});}})['then'](respondWithResult(_0x1d02ae,null))[_0x6f52('0x3d')](handleError(_0x1d02ae,null));};exports[_0x6f52('0x52')]=function(_0x31614c,_0x456674,_0x2a9712){var _0x5178d6={};var _0x44a3cd={};var _0x59eb9d;var _0x5ae47d;return db['CmCompany'][_0x6f52('0x53')]({'where':{'id':_0x31614c[_0x6f52('0x3f')]['id']}})[_0x6f52('0x1f')](handleEntityNotFound(_0x456674,null))[_0x6f52('0x1f')](function(_0x2fd1c9){if(_0x2fd1c9){_0x59eb9d=_0x2fd1c9;_0x44a3cd['model']=_[_0x6f52('0x29')](db[_0x6f52('0x4e')][_0x6f52('0x54')]);_0x44a3cd['query']=_[_0x6f52('0x29')](_0x31614c['query']);_0x44a3cd[_0x6f52('0x2b')]=_[_0x6f52('0x2c')](_0x44a3cd['model'],_0x44a3cd[_0x6f52('0x2a')]);_0x5178d6[_0x6f52('0x2d')]=_[_0x6f52('0x2c')](_0x44a3cd[_0x6f52('0x28')],qs[_0x6f52('0x2e')](_0x31614c[_0x6f52('0x2a')][_0x6f52('0x2e')]));_0x5178d6[_0x6f52('0x2d')]=_0x5178d6[_0x6f52('0x2d')][_0x6f52('0x2f')]?_0x5178d6[_0x6f52('0x2d')]:_0x44a3cd[_0x6f52('0x28')];_0x5178d6['order']=qs[_0x6f52('0x33')](_0x31614c[_0x6f52('0x2a')]['sort']);_0x5178d6[_0x6f52('0x36')]=qs[_0x6f52('0x2b')](_[_0x6f52('0x34')](_0x31614c[_0x6f52('0x2a')],_0x44a3cd['filters']));if(_0x31614c[_0x6f52('0x2a')][_0x6f52('0x37')]){_0x5178d6[_0x6f52('0x36')]=_['merge'](_0x5178d6['where'],{'$or':_['map'](_0x5178d6['attributes'],function(_0x3c1d59){var _0x2b9402={};_0x2b9402[_0x3c1d59]={'$like':'%'+_0x31614c[_0x6f52('0x2a')][_0x6f52('0x37')]+'%'};return _0x2b9402;})});}_0x5178d6=_['merge']({},_0x5178d6,_0x31614c[_0x6f52('0x38')]);return _0x59eb9d['getContacts'](_0x5178d6);}})[_0x6f52('0x1f')](function(_0xeea434){if(_0xeea434){_0x5ae47d=_0xeea434[_0x6f52('0x2f')];if(!_0x31614c[_0x6f52('0x2a')][_0x6f52('0x30')](_0x6f52('0x31'))){_0x5178d6['limit']=qs[_0x6f52('0x1c')](_0x31614c[_0x6f52('0x2a')][_0x6f52('0x1c')]);_0x5178d6[_0x6f52('0x19')]=qs[_0x6f52('0x19')](_0x31614c[_0x6f52('0x2a')]['offset']);}return _0x59eb9d[_0x6f52('0x52')](_0x5178d6);}})[_0x6f52('0x1f')](function(_0x2094aa){if(_0x2094aa){return _0x2094aa?{'count':_0x5ae47d,'rows':_0x2094aa}:null;}})[_0x6f52('0x1f')](respondWithResult(_0x456674,null))[_0x6f52('0x3d')](handleError(_0x456674,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7e5ef52..5737cec 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 _0x26d0=['define','CmCompany','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3ed054,_0x4d4f16){var _0x16dd95=function(_0xc0c19c){while(--_0xc0c19c){_0x3ed054['push'](_0x3ed054['shift']());}};_0x16dd95(++_0x4d4f16);}(_0x26d0,0x1c4));var _0x026d=function(_0x4cdf55,_0x23f4d0){_0x4cdf55=_0x4cdf55-0x0;var _0x2e3101=_0x26d0[_0x4cdf55];return _0x2e3101;};'use strict';var _=require('lodash');var util=require(_0x026d('0x0'));var logger=require('../../config/logger')(_0x026d('0x1'));var moment=require(_0x026d('0x2'));var BPromise=require('bluebird');var rp=require(_0x026d('0x3'));var fs=require('fs');var path=require(_0x026d('0x4'));var rimraf=require('rimraf');var config=require(_0x026d('0x5'));var attributes=require('./cmCompany.attributes');module[_0x026d('0x6')]=function(_0x3ad979,_0xc5e5e1){return _0x3ad979[_0x026d('0x7')](_0x026d('0x8'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3dc=['../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa3dc,0x1d9));var _0xca3d=function(_0x1dbc22,_0x5dd20f){_0x1dbc22=_0x1dbc22-0x0;var _0x16f498=_0xa3dc[_0x1dbc22];return _0x16f498;};'use strict';var _=require(_0xca3d('0x0'));var util=require(_0xca3d('0x1'));var logger=require(_0xca3d('0x2'))(_0xca3d('0x3'));var moment=require('moment');var BPromise=require(_0xca3d('0x4'));var rp=require(_0xca3d('0x5'));var fs=require('fs');var path=require(_0xca3d('0x6'));var rimraf=require(_0xca3d('0x7'));var config=require(_0xca3d('0x8'));var attributes=require('./cmCompany.attributes');module[_0xca3d('0x9')]=function(_0x56da60,_0x1266c){return _0x56da60[_0xca3d('0xa')](_0xca3d('0xb'),attributes,{'tableName':_0xca3d('0xc'),'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 a4609a9..bebb35b 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 _0x84bd=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x214d57,_0x1bc9c5){var _0x59dfb1=function(_0x4652c1){while(--_0x4652c1){_0x214d57['push'](_0x214d57['shift']());}};_0x59dfb1(++_0x1bc9c5);}(_0x84bd,0x94));var _0xd84b=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x84bd[_0x2ba740];return _0x358bda;};'use strict';var _=require(_0xd84b('0x0'));var util=require(_0xd84b('0x1'));var moment=require(_0xd84b('0x2'));var BPromise=require('bluebird');var rs=require(_0xd84b('0x3'));var fs=require('fs');var Redis=require(_0xd84b('0x4'));var db=require(_0xd84b('0x5'))['db'];var utils=require(_0xd84b('0x6'));var logger=require(_0xd84b('0x7'))(_0xd84b('0x8'));var config=require(_0xd84b('0x9'));var jayson=require(_0xd84b('0xa'));var client=jayson[_0xd84b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x485a5c,_0x1e831b,_0x3ef017){return new BPromise(function(_0x85abf5,_0x5c2ed1){return client[_0xd84b('0xc')](_0x485a5c,_0x3ef017)[_0xd84b('0xd')](function(_0x5668e7){logger[_0xd84b('0xe')]('CmCompany,\x20%s,\x20%s',_0x1e831b,_0xd84b('0xf'));logger[_0xd84b('0x10')](_0xd84b('0x11'),_0x1e831b,_0xd84b('0xf'),JSON[_0xd84b('0x12')](_0x5668e7));if(_0x5668e7[_0xd84b('0x13')]){if(_0x5668e7[_0xd84b('0x13')][_0xd84b('0x14')]===0x1f4){logger[_0xd84b('0x13')](_0xd84b('0x15'),_0x1e831b,_0x5668e7['error'][_0xd84b('0x16')]);return _0x5c2ed1(_0x5668e7[_0xd84b('0x13')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x1e831b,_0x5668e7[_0xd84b('0x13')][_0xd84b('0x16')]);return _0x85abf5(_0x5668e7[_0xd84b('0x13')]['message']);}else{logger[_0xd84b('0xe')](_0xd84b('0x15'),_0x1e831b,_0xd84b('0xf'));_0x85abf5(_0x5668e7[_0xd84b('0x17')][_0xd84b('0x16')]);}})[_0xd84b('0x18')](function(_0x70d9af){logger[_0xd84b('0x13')](_0xd84b('0x15'),_0x1e831b,_0x70d9af);_0x5c2ed1(_0x70d9af);});});} \ No newline at end of file +var _0xc37d=['client','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x17eb80,_0x5ad17e){var _0x4af452=function(_0x59d82f){while(--_0x59d82f){_0x17eb80['push'](_0x17eb80['shift']());}};_0x4af452(++_0x5ad17e);}(_0xc37d,0x8a));var _0xdc37=function(_0x198984,_0x3c2baa){_0x198984=_0x198984-0x0;var _0x2861b9=_0xc37d[_0x198984];return _0x2861b9;};'use strict';var _=require(_0xdc37('0x0'));var util=require(_0xdc37('0x1'));var moment=require(_0xdc37('0x2'));var BPromise=require(_0xdc37('0x3'));var rs=require(_0xdc37('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc37('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc37('0x6'))(_0xdc37('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc37('0x8'));var client=jayson[_0xdc37('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bb4c0,_0x42845c,_0x71a089){return new BPromise(function(_0x2c8bde,_0x3e1aae){return client[_0xdc37('0xa')](_0x4bb4c0,_0x71a089)[_0xdc37('0xb')](function(_0x3d66e5){logger[_0xdc37('0xc')]('CmCompany,\x20%s,\x20%s',_0x42845c,_0xdc37('0xd'));logger[_0xdc37('0xe')](_0xdc37('0xf'),_0x42845c,_0xdc37('0xd'),JSON[_0xdc37('0x10')](_0x3d66e5));if(_0x3d66e5['error']){if(_0x3d66e5['error']['code']===0x1f4){logger[_0xdc37('0x11')](_0xdc37('0x12'),_0x42845c,_0x3d66e5[_0xdc37('0x11')][_0xdc37('0x13')]);return _0x3e1aae(_0x3d66e5[_0xdc37('0x11')]['message']);}logger[_0xdc37('0x11')](_0xdc37('0x12'),_0x42845c,_0x3d66e5['error']['message']);return _0x2c8bde(_0x3d66e5[_0xdc37('0x11')][_0xdc37('0x13')]);}else{logger['info'](_0xdc37('0x12'),_0x42845c,'request\x20sent');_0x2c8bde(_0x3d66e5['result'][_0xdc37('0x13')]);}})[_0xdc37('0x14')](function(_0x162fd6){logger[_0xdc37('0x11')]('CmCompany,\x20%s,\x20%s',_0x42845c,_0x162fd6);_0x3e1aae(_0x162fd6);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 04346be..135b9b2 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 _0xd562=['getContacts','post','create','addContacts','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','isAuthenticated','show','/:id/contacts'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xd562,0x18f));var _0x2d56=function(_0x4a5bb1,_0x19cd7a){_0x4a5bb1=_0x4a5bb1-0x0;var _0x240fbc=_0xd562[_0x4a5bb1];return _0x240fbc;};'use strict';var multer=require(_0x2d56('0x0'));var util=require(_0x2d56('0x1'));var path=require(_0x2d56('0x2'));var timeout=require(_0x2d56('0x3'));var express=require('express');var router=express[_0x2d56('0x4')]();var fs_extra=require(_0x2d56('0x5'));var auth=require(_0x2d56('0x6'));var interaction=require(_0x2d56('0x7'));var config=require(_0x2d56('0x8'));var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2d56('0x9')](_0x2d56('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2d56('0x9')](_0x2d56('0xb'),auth[_0x2d56('0xc')](),controller[_0x2d56('0xd')]);router['get'](_0x2d56('0xe'),auth[_0x2d56('0xc')](),controller[_0x2d56('0xf')]);router[_0x2d56('0x10')]('/',auth[_0x2d56('0xc')](),controller[_0x2d56('0x11')]);router[_0x2d56('0x10')](_0x2d56('0xe'),auth[_0x2d56('0xc')](),controller[_0x2d56('0x12')]);router[_0x2d56('0x13')](_0x2d56('0xb'),auth[_0x2d56('0xc')](),controller['update']);router[_0x2d56('0x14')]('/:id',auth[_0x2d56('0xc')](),controller[_0x2d56('0x15')]);module[_0x2d56('0x16')]=router; \ No newline at end of file +var _0xfcf4=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','show','/:id/contacts','getContacts','post','addContacts','put','/:id','delete','destroy'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xfcf4,0x1cd));var _0x4fcf=function(_0x4fbf5a,_0x68559f){_0x4fbf5a=_0x4fbf5a-0x0;var _0x2bf64e=_0xfcf4[_0x4fbf5a];return _0x2bf64e;};'use strict';var multer=require(_0x4fcf('0x0'));var util=require('util');var path=require(_0x4fcf('0x1'));var timeout=require(_0x4fcf('0x2'));var express=require(_0x4fcf('0x3'));var router=express[_0x4fcf('0x4')]();var fs_extra=require(_0x4fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4fcf('0x6'));var config=require(_0x4fcf('0x7'));var controller=require(_0x4fcf('0x8'));router[_0x4fcf('0x9')]('/',auth[_0x4fcf('0xa')](),controller[_0x4fcf('0xb')]);router[_0x4fcf('0x9')](_0x4fcf('0xc'),auth[_0x4fcf('0xa')](),controller['describe']);router['get']('/:id',auth[_0x4fcf('0xa')](),controller[_0x4fcf('0xd')]);router[_0x4fcf('0x9')](_0x4fcf('0xe'),auth['isAuthenticated'](),controller[_0x4fcf('0xf')]);router[_0x4fcf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4fcf('0x10')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x4fcf('0x11')]);router[_0x4fcf('0x12')](_0x4fcf('0x13'),auth[_0x4fcf('0xa')](),controller['update']);router[_0x4fcf('0x14')](_0x4fcf('0x13'),auth[_0x4fcf('0xa')](),controller[_0x4fcf('0x15')]);module[_0x4fcf('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5692770..d64d5c4 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 _0xf59b=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x370592,_0x3ad7a2){var _0x26872d=function(_0x1d1c64){while(--_0x1d1c64){_0x370592['push'](_0x370592['shift']());}};_0x26872d(++_0x3ad7a2);}(_0xf59b,0x18d));var _0xbf59=function(_0x457759,_0x4fb33a){_0x457759=_0x457759-0x0;var _0xc50bc9=_0xf59b[_0x457759];return _0xc50bc9;};'use strict';var _=require(_0xbf59('0x0'));var Sequelize=require(_0xbf59('0x1'));module[_0xbf59('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xbf59('0x3')]},'street':{'type':Sequelize[_0xbf59('0x3')]},'postalCode':{'type':Sequelize[_0xbf59('0x3')]},'city':{'type':Sequelize[_0xbf59('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf59('0x4')]},'phone':{'type':Sequelize[_0xbf59('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbf59('0x3')]},'email':{'type':Sequelize[_0xbf59('0x3')]},'url':{'type':Sequelize[_0xbf59('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xbf59('0x3')]},'twitter':{'type':Sequelize[_0xbf59('0x3')]},'skype':{'type':Sequelize[_0xbf59('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xbf59('0x3')]},'line':{'type':Sequelize[_0xbf59('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xbf59('0x3')]},'UserId':{'type':Sequelize[_0xbf59('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xbf59('0x3')]},'priority':{'type':Sequelize[_0xbf59('0x5')](0x2)[_0xbf59('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbf59('0x7')],'defaultValue':Sequelize[_0xbf59('0x8')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xbf59('0x5')]}}; \ No newline at end of file +var _0xa7a8=['NOW','lodash','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xa7a8,0x1f2));var _0x8a7a=function(_0x5f79aa,_0x561ce0){_0x5f79aa=_0x5f79aa-0x0;var _0x27e4a6=_0xa7a8[_0x5f79aa];return _0x27e4a6;};'use strict';var _=require(_0x8a7a('0x0'));var Sequelize=require(_0x8a7a('0x1'));module[_0x8a7a('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8a7a('0x3')]},'street':{'type':Sequelize[_0x8a7a('0x3')]},'postalCode':{'type':Sequelize[_0x8a7a('0x3')]},'city':{'type':Sequelize[_0x8a7a('0x3')]},'country':{'type':Sequelize[_0x8a7a('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8a7a('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x8a7a('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x8a7a('0x3')]},'email':{'type':Sequelize[_0x8a7a('0x3')]},'url':{'type':Sequelize[_0x8a7a('0x3')]},'facebook':{'type':Sequelize[_0x8a7a('0x3')]},'fb_data':{'type':Sequelize[_0x8a7a('0x3')]},'twitter':{'type':Sequelize[_0x8a7a('0x3')]},'skype':{'type':Sequelize[_0x8a7a('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x8a7a('0x3')]},'wechat':{'type':Sequelize[_0x8a7a('0x3')]},'telegram':{'type':Sequelize[_0x8a7a('0x3')]},'UserId':{'type':Sequelize[_0x8a7a('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8a7a('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8a7a('0x5')],'defaultValue':Sequelize[_0x8a7a('0x6')]},'dialTimezone':{'type':Sequelize[_0x8a7a('0x3')]},'utcOffset':{'type':Sequelize[_0x8a7a('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 113d9de..4e0def4 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 93c3249..36e797c 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b4c=['events','../../mysqldb','CmContact','setMaxListeners','update','emit','hook','exports'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x3b4c,0xe0));var _0xc3b4=function(_0x3b9a03,_0x5cc72d){_0x3b9a03=_0x3b9a03-0x0;var _0x3437ce=_0x3b4c[_0x3b9a03];return _0x3437ce;};'use strict';var EventEmitter=require(_0xc3b4('0x0'));var CmContact=require(_0xc3b4('0x1'))['db'][_0xc3b4('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc3b4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3b4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x135436){return function(_0x3b6c4b,_0x1b1779,_0x3b4f4c){CmContactEvents['emit'](_0x135436+':'+_0x3b6c4b['id'],_0x3b6c4b);CmContactEvents[_0xc3b4('0x5')](_0x135436,_0x3b6c4b);_0x3b4f4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xc3b4('0x6')](e,emitEvent(event));}}module[_0xc3b4('0x7')]=CmContactEvents; \ No newline at end of file +var _0x3832=['exports','events','../../mysqldb','CmContact','remove','emit','hook'];(function(_0x24fc97,_0x4778ae){var _0x496ddf=function(_0x438c67){while(--_0x438c67){_0x24fc97['push'](_0x24fc97['shift']());}};_0x496ddf(++_0x4778ae);}(_0x3832,0x10b));var _0x2383=function(_0x287809,_0x1a105e){_0x287809=_0x287809-0x0;var _0xb6942e=_0x3832[_0x287809];return _0xb6942e;};'use strict';var EventEmitter=require(_0x2383('0x0'));var CmContact=require(_0x2383('0x1'))['db'][_0x2383('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2383('0x3')};function emitEvent(_0x4c86d4){return function(_0x3d7dc3,_0x44f930,_0x495fe1){CmContactEvents[_0x2383('0x4')](_0x4c86d4+':'+_0x3d7dc3['id'],_0x3d7dc3);CmContactEvents[_0x2383('0x4')](_0x4c86d4,_0x3d7dc3);_0x495fe1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x2383('0x5')](e,emitEvent(event));}}module[_0x2383('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 3931088..2be8f46 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3611=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','request-promise','path','../../config/environment','../../config/environment/shared','exports','define','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','FULLTEXT','utf8mb4','models','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','cmContact','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','onlyIfOpen','CmList','BlackLists','CmHopperBlack','message','always','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','push','all'];(function(_0x23c052,_0x529c10){var _0x4f9d57=function(_0x2dac0d){while(--_0x2dac0d){_0x23c052['push'](_0x23c052['shift']());}};_0x4f9d57(++_0x529c10);}(_0x3611,0x95));var _0x1361=function(_0xedf6dd,_0x5991e4){_0xedf6dd=_0xedf6dd-0x0;var _0x48d026=_0x3611[_0xedf6dd];return _0x48d026;};'use strict';var _=require('lodash');var util=require(_0x1361('0x0'));var logger=require(_0x1361('0x1'))(_0x1361('0x2'));var moment=require(_0x1361('0x3'));var BPromise=require('bluebird');var rp=require(_0x1361('0x4'));var fs=require('fs');var path=require(_0x1361('0x5'));var rimraf=require('rimraf');var config=require(_0x1361('0x6'));var shared=require(_0x1361('0x7'));var attributes=require('./cmContact.attributes');module[_0x1361('0x8')]=function(_0x54ff14,_0x37ba5a){return _0x54ff14[_0x1361('0x9')]('CmContact',attributes,{'tableName':_0x1361('0xa'),'paranoid':!![],'indexes':[{'name':_0x1361('0xb'),'fields':['phone']},{'name':_0x1361('0xc'),'fields':[_0x1361('0xd'),'lastName','phone',_0x1361('0xe'),_0x1361('0xf'),'email'],'type':_0x1361('0x10')}],'timestamps':!![],'charset':_0x1361('0x11'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x16d966,_0x228b3f,_0x2a9f18){var _0x51ee0e=_0x54ff14[_0x1361('0x12')];var _0x1f6f6c=_0x16d966[_0x1361('0x13')]({'plain':!![]});function _0x2232fe(){return function(_0x5ead2b){logger[_0x1361('0x14')]('cmContact',_0x1361('0x15'),util[_0x1361('0x16')](_0x5ead2b,{'showHidden':![],'depth':null}));};}function _0x246bca(_0xb102c6,_0x384b70){var _0x9bfc42=_0x384b70[_0x1361('0x17')]?_0x384b70[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19'));return new BPromise(function(_0x87f85e,_0x25a628){if(_[_0x1361('0x1a')](_0x384b70[_0x1361('0x1b')])){_0x87f85e({'ret':_0x9bfc42});}else{_0x51ee0e[_0x1361('0x1c')][_0x1361('0x1d')]({'where':{'id':_0xb102c6['id']}})[_0x1361('0x1e')](function(_0xf0ca69){if(!_[_0x1361('0x1a')](_0xf0ca69)){var _0x2ca8c2=_0xf0ca69[_0x1361('0x1b')];if(!_['isNil'](_0x2ca8c2)){var _0x106ce5=shared[_0x1361('0x1f')];var _0x2e191f=_0x106ce5[_0x2ca8c2];var _0x340003=_0x106ce5[_0x384b70[_0x1361('0x1b')]];if(!_['isNil'](_0x2e191f)&&!_[_0x1361('0x1a')](_0x340003)){var _0x1f0a3d=_0x2e191f['utcOffset']-_0x340003[_0x1361('0x20')];_0x9bfc42=_0x384b70['scheduledat']?_0x384b70[_0x1361('0x17')]:moment();var _0xfcd8f=moment(_0x9bfc42)[_0x1361('0x21')](_0x1f0a3d,'minutes');_0x87f85e({'ret':_0xfcd8f[_0x1361('0x18')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x87f85e({'ret':_0x9bfc42});}else _0x87f85e({'ret':_0x9bfc42});}else{_0x87f85e({'ret':_0x9bfc42});}});}});return 0xa;}var _0x43705b=function(_0x32dec1){return new BPromise(function(_0x5450cb,_0x291496){_0x246bca(_0x32dec1,_0x1f6f6c)['then'](function(_0x5da1a5){_0x1f6f6c[_0x1361('0x17')]=_0x5da1a5[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')]['findOne']({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x32dec1['id']}})[_0x1361('0x1e')](function(_0xd18153){if(!_[_0x1361('0x1a')](_0xd18153)){throw new Error(_0x1361('0x24')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x25')+_0x32dec1['id']);}return _0x51ee0e[_0x1361('0x23')]['create']({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c[_0x1361('0x27')]:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'VoiceQueueId':_0x32dec1['id']});})[_0x1361('0x29')](function(_0x1efdd0){_0x291496(_0x1efdd0);});});});};var _0x41236c=function(_0x58e308){return new BPromise(function(_0x1f194e,_0x41319e){_0x246bca(_0x58e308,_0x1f6f6c)['then'](function(_0x50d719){_0x1f6f6c[_0x1361('0x17')]=_0x50d719[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x58e308['id']}})[_0x1361('0x1e')](function(_0x107fb8){if(!_[_0x1361('0x1a')](_0x107fb8)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1f6f6c['phone']+_0x1361('0x2a')+_0x58e308['id']);}return _0x51ee0e[_0x1361('0x2b')]['findOne']({'where':{'calleridnum':_0x1f6f6c[_0x1361('0xb')],'VoiceQueueId':_0x58e308['id']}});})[_0x1361('0x1e')](function(_0x2cd8cb){if(!_[_0x1361('0x1a')](_0x2cd8cb)){throw new Error(_0x1361('0x2c')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x2d')+_0x58e308['id']);}return _0x51ee0e[_0x1361('0x23')][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c['priority']:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()['format'](_0x1361('0x19')),'callback':_0x1f6f6c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f6f6c['callbackUniqueid']?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'VoiceQueueId':_0x58e308['id']});})[_0x1361('0x29')](function(_0x5db825){_0x41319e(_0x5db825);});});});};function _0x3b3023(){return function(_0x3361ca){logger[_0x1361('0x14')](_0x1361('0x2f'),_0x1361('0x15'),util[_0x1361('0x16')](_0x3361ca,{'showHidden':![],'depth':null}));};}function _0x3372e1(_0x361503,_0x25c741){var _0x1168ff=_0x25c741[_0x1361('0x17')]?_0x25c741[_0x1361('0x17')]:moment()['format'](_0x1361('0x19'));return new BPromise(function(_0x31b194,_0x1a24dc){if(_[_0x1361('0x1a')](_0x25c741['dialTimezone'])){_0x31b194({'ret':_0x1168ff});}else{_0x51ee0e[_0x1361('0x30')][_0x1361('0x1d')]({'where':{'id':_0x361503['id']}})['then'](function(_0x379f2a){if(!_[_0x1361('0x1a')](_0x379f2a)){var _0xebdb11=_0x379f2a[_0x1361('0x1b')];if(!_['isNil'](_0xebdb11)){var _0x452006=shared['timezones'];var _0x4c6eae=_0x452006[_0xebdb11];var _0x495ba5=_0x452006[_0x25c741[_0x1361('0x1b')]];if(!_[_0x1361('0x1a')](_0x4c6eae)&&!_[_0x1361('0x1a')](_0x495ba5)){var _0x4dc01b=_0x4c6eae['utcOffset']-_0x495ba5[_0x1361('0x20')];_0x1168ff=_0x25c741[_0x1361('0x17')]?_0x25c741[_0x1361('0x17')]:moment();var _0x34160e=moment(_0x1168ff)[_0x1361('0x21')](_0x4dc01b,_0x1361('0x31'));_0x31b194({'ret':_0x34160e[_0x1361('0x18')](_0x1361('0x19'))});}else _0x31b194({'ret':_0x1168ff});}else _0x31b194({'ret':_0x1168ff});}else{_0x31b194({'ret':_0x1168ff});}});}});return 0xa;}var _0xf4e6bf=function(_0x26121d){return new BPromise(function(_0x29e18f,_0x4fdddb){_0x3372e1(_0x26121d,_0x1f6f6c)[_0x1361('0x1e')](function(_0x5cede6){_0x1f6f6c[_0x1361('0x17')]=_0x5cede6[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x26121d['id']}})[_0x1361('0x1e')](function(_0xcf2638){if(!_['isNil'](_0xcf2638)){throw new Error(_0x1361('0x24')+_0x1f6f6c[_0x1361('0xb')]+_0x1361('0x32')+_0x26121d['id']);}return _0x51ee0e[_0x1361('0x23')]['create']({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c['priority']?_0x1f6f6c[_0x1361('0x27')]:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c['callbackUniqueid']?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'CampaignId':_0x26121d['id']});})[_0x1361('0x29')](function(_0x3d9ef5){_0x4fdddb(_0x3d9ef5);});});});};var _0x2a6eba=function(_0x1f7b5a){return new BPromise(function(_0x468d0c,_0x2eca60){_0x3372e1(_0x1f7b5a,_0x1f6f6c)[_0x1361('0x1e')](function(_0x332e38){_0x1f6f6c[_0x1361('0x17')]=_0x332e38['ret'];_0x51ee0e[_0x1361('0x23')][_0x1361('0x1d')]({'where':{'phone':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x1f7b5a['id']}})[_0x1361('0x1e')](function(_0xc2f9dc){if(!_[_0x1361('0x1a')](_0xc2f9dc)){throw new Error(_0x1361('0x24')+_0x1f6f6c['phone']+_0x1361('0x33')+_0x1f7b5a['id']);}return _0x51ee0e['CmHopperFinal'][_0x1361('0x1d')]({'where':{'calleridnum':_0x1f6f6c[_0x1361('0xb')],'CampaignId':_0x1f7b5a['id']}});})[_0x1361('0x1e')](function(_0x5a4eee){if(!_[_0x1361('0x1a')](_0x5a4eee)){throw new Error(_0x1361('0x2c')+_0x1f6f6c[_0x1361('0xb')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x1f7b5a['id']);}return _0x51ee0e['CmHopper'][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c['priority']:0x2,'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'callback':_0x1f6f6c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c['callbackUniqueid']:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1f7b5a['id']});})['catch'](function(_0x109f24){_0x2eca60(_0x109f24);});});});};if(_0x1f6f6c[_0x1361('0x26')]){_0x51ee0e[_0x1361('0x1c')][_0x1361('0x34')]({'where':{'type':_0x1361('0x35')},'attributes':['id',_0x1361('0x36'),_0x1361('0x1b')],'include':[{'model':_0x51ee0e['CmList'],'as':_0x1361('0x37'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x2bd241){if(_0x2bd241){var _0x414713=[];for(var _0x2330b0=0x0,_0x339009;_0x2330b0<_0x2bd241[_0x1361('0x38')];_0x2330b0+=0x1){_0x339009=_0x2bd241[_0x2330b0]['get']({'plain':!![]});switch(_0x339009[_0x1361('0x36')]){case'always':_0x41236c(_0x339009)['catch'](_0x2232fe());break;case _0x1361('0x39'):_0x43705b(_0x339009)[_0x1361('0x29')](_0x2232fe());break;default:_0x3372e1(_0x339009,_0x1f6f6c)[_0x1361('0x1e')](function(_0xae21e5){_0x1f6f6c[_0x1361('0x17')]=_0xae21e5[_0x1361('0x22')];_0x51ee0e[_0x1361('0x23')][_0x1361('0x2e')]({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c[_0x1361('0x27')]:0x2,'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c[_0x1361('0x28')]:undefined,'callbackat':_0x1f6f6c[_0x1361('0x28')]?moment()['format'](_0x1361('0x19')):undefined,'VoiceQueueId':_0x339009['id']})['catch'](_0x2232fe());});}}}})[_0x1361('0x1e')](function(){return _0x51ee0e['VoiceQueue'][_0x1361('0x34')]({'where':{'type':_0x1361('0x35')},'attributes':['id'],'include':[{'model':_0x51ee0e[_0x1361('0x3a')],'as':_0x1361('0x3b'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x3cdc2b){if(_0x3cdc2b){var _0x51d81b=[];for(var _0x4620fb=0x0,_0x211535;_0x4620fb<_0x3cdc2b[_0x1361('0x38')];_0x4620fb+=0x1){_0x211535=_0x3cdc2b[_0x4620fb][_0x1361('0x13')]({'plain':!![]});_0x51ee0e[_0x1361('0x3c')]['create']({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c[_0x1361('0x26')],'VoiceQueueId':_0x211535['id']})['catch'](function(_0x53624c){logger['error']('cmContact,\x20%s,\x20%s',_0x1361('0x15'),_0x53624c[_0x1361('0x3d')]);});}}});})[_0x1361('0x1e')](function(){return _0x51ee0e[_0x1361('0x30')][_0x1361('0x34')]({'attributes':['id',_0x1361('0x36'),_0x1361('0x1b')],'include':[{'model':_0x51ee0e[_0x1361('0x3a')],'as':_0x1361('0x37'),'where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})[_0x1361('0x1e')](function(_0x1e4fd6){if(_0x1e4fd6){var _0x3cf6a8=[];for(var _0x1160d8=0x0,_0x29fc2f;_0x1160d8<_0x1e4fd6[_0x1361('0x38')];_0x1160d8+=0x1){_0x29fc2f=_0x1e4fd6[_0x1160d8]['get']({'plain':!![]});switch(_0x29fc2f[_0x1361('0x36')]){case _0x1361('0x3e'):_0x2a6eba(_0x29fc2f)[_0x1361('0x29')](_0x3b3023());break;case _0x1361('0x39'):_0xf4e6bf(_0x29fc2f)['catch'](_0x3b3023());break;default:_0x51ee0e['CmHopper'][_0x1361('0x2e')]({'phone':_0x1f6f6c['phone'],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c['ListId'],'scheduledat':_0x1f6f6c[_0x1361('0x17')]?_0x1f6f6c[_0x1361('0x17')]:moment()[_0x1361('0x18')](_0x1361('0x19')),'priority':_0x1f6f6c[_0x1361('0x27')]?_0x1f6f6c['priority']:0x2,'callback':_0x1f6f6c[_0x1361('0x28')]?!![]:![],'callbackuniqueid':_0x1f6f6c[_0x1361('0x28')]?_0x1f6f6c['callbackUniqueid']:undefined,'callbackat':_0x1f6f6c['callbackUniqueid']?moment()[_0x1361('0x18')](_0x1361('0x19')):undefined,'CampaignId':_0x29fc2f['id']})[_0x1361('0x29')](_0x3b3023());}}}});})['then'](function(){return _0x51ee0e[_0x1361('0x30')]['findAll']({'attributes':['id'],'include':[{'model':_0x51ee0e['CmList'],'as':'BlackLists','where':{'id':_0x1f6f6c[_0x1361('0x26')]}}]})['then'](function(_0x137d99){if(_0x137d99){var _0x5597a1=[];for(var _0x3cd374=0x0,_0x25551e;_0x3cd374<_0x137d99[_0x1361('0x38')];_0x3cd374+=0x1){_0x25551e=_0x137d99[_0x3cd374][_0x1361('0x13')]({'plain':!![]});_0x51ee0e['CmHopperBlack'][_0x1361('0x2e')]({'phone':_0x1f6f6c[_0x1361('0xb')],'ContactId':_0x1f6f6c['id'],'ListId':_0x1f6f6c['ListId'],'CampaignId':_0x25551e['id']})['catch'](function(_0x1e1905){logger[_0x1361('0x14')](_0x1361('0x3f'),'afterCreate',_0x1e1905['message']);});}}});})[_0x1361('0x1e')](function(){_0x2a9f18();})['catch'](function(_0x2aa984){logger['error'](_0x1361('0x3f'),'afterCreate',_0x2aa984[_0x1361('0x3d')]);_0x2a9f18(_0x2aa984);});}else{_0x2a9f18(new Error(_0x1361('0x40')));}},'afterDestroy':function(_0x30742e,_0x21996d,_0x16aa58){var _0x3e718d=_0x54ff14[_0x1361('0x12')];var _0x3c5cc3=_0x30742e[_0x1361('0x13')]({'plain':!![]});return _0x3e718d['CmHopper'][_0x1361('0x34')]({'raw':!![],'where':{'ListId':_0x3c5cc3[_0x1361('0x26')],'ContactId':_0x3c5cc3['id']}})[_0x1361('0x1e')](function(_0x204981){if(!_[_0x1361('0x41')](_0x204981)){var _0x1065c0=[];for(var _0x17ec38=0x0;_0x17ec38<_0x204981[_0x1361('0x38')];_0x17ec38+=0x1){var _0x339f6e=_0x3e718d[_0x1361('0x23')]['destroy']({'where':{'ListId':_0x204981[_0x17ec38]['ListId'],'ContactId':_0x204981[_0x17ec38][_0x1361('0x42')],'VoiceQueueId':_0x204981[_0x17ec38][_0x1361('0x43')],'CampaignId':_0x204981[_0x17ec38]['CampaignId']}});_0x1065c0[_0x1361('0x44')](_0x339f6e);}return BPromise[_0x1361('0x45')](_0x1065c0);}})[_0x1361('0x1e')](function(_0x269002){logger[_0x1361('0x46')](_0x1361('0x47'),util[_0x1361('0x16')](_0x269002,{'showHidden':![],'depth':null}));_0x16aa58();})[_0x1361('0x29')](function(_0x2ae36b){logger['error'](_0x1361('0x48'),util[_0x1361('0x16')](_0x2ae36b,{'showHidden':![],'depth':null}));_0x16aa58(_0x2ae36b);});}}});}; \ No newline at end of file +var _0x951c=['api','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','dialCheckDuplicateType','Lists','always','onlyIfOpen','CmList','BlackLists','length','CmHopperBlack','message','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','ContactId','CampaignId','push','info','lodash','util','../../config/logger'];(function(_0x53b418,_0x1fc172){var _0x1d69f6=function(_0x30e5e4){while(--_0x30e5e4){_0x53b418['push'](_0x53b418['shift']());}};_0x1d69f6(++_0x1fc172);}(_0x951c,0x1a1));var _0xc951=function(_0x5abed7,_0x185e43){_0x5abed7=_0x5abed7-0x0;var _0x3b446b=_0x951c[_0x5abed7];return _0x3b446b;};'use strict';var _=require(_0xc951('0x0'));var util=require(_0xc951('0x1'));var logger=require(_0xc951('0x2'))(_0xc951('0x3'));var moment=require('moment');var BPromise=require(_0xc951('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc951('0x5'));var rimraf=require(_0xc951('0x6'));var config=require(_0xc951('0x7'));var shared=require(_0xc951('0x8'));var attributes=require(_0xc951('0x9'));module[_0xc951('0xa')]=function(_0x1e2d0f,_0x33b3b7){return _0x1e2d0f[_0xc951('0xb')](_0xc951('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xc951('0xd'),'fields':[_0xc951('0xd')]},{'name':'fti_cm_contacts','fields':[_0xc951('0xe'),_0xc951('0xf'),_0xc951('0xd'),_0xc951('0x10'),_0xc951('0x11'),_0xc951('0x12')],'type':_0xc951('0x13')}],'timestamps':!![],'charset':_0xc951('0x14'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0xc1eee9,_0x11033e,_0xc66585){var _0x276177=_0x1e2d0f[_0xc951('0x15')];var _0xa87e64=_0xc1eee9[_0xc951('0x16')]({'plain':!![]});function _0x15bd49(){return function(_0x21c0fb){logger[_0xc951('0x17')](_0xc951('0x18'),_0xc951('0x19'),util[_0xc951('0x1a')](_0x21c0fb,{'showHidden':![],'depth':null}));};}function _0x43a52b(_0x58e29a,_0x376bd1){var _0x4210aa=_0x376bd1['scheduledat']?_0x376bd1[_0xc951('0x1b')]:moment()[_0xc951('0x1c')](_0xc951('0x1d'));return new BPromise(function(_0x27313e,_0x2daa7c){if(_[_0xc951('0x1e')](_0x376bd1[_0xc951('0x1f')])){_0x27313e({'ret':_0x4210aa});}else{_0x276177[_0xc951('0x20')][_0xc951('0x21')]({'where':{'id':_0x58e29a['id']}})['then'](function(_0x25d423){if(!_[_0xc951('0x1e')](_0x25d423)){var _0x8106ac=_0x25d423[_0xc951('0x1f')];if(!_[_0xc951('0x1e')](_0x8106ac)){var _0x509e92=shared['timezones'];var _0x4f0db8=_0x509e92[_0x8106ac];var _0x52af89=_0x509e92[_0x376bd1[_0xc951('0x1f')]];if(!_[_0xc951('0x1e')](_0x4f0db8)&&!_['isNil'](_0x52af89)){var _0x2bbd53=_0x4f0db8[_0xc951('0x22')]-_0x52af89[_0xc951('0x22')];_0x4210aa=_0x376bd1[_0xc951('0x1b')]?_0x376bd1['scheduledat']:moment();var _0x5860a6=moment(_0x4210aa)[_0xc951('0x23')](_0x2bbd53,_0xc951('0x24'));_0x27313e({'ret':_0x5860a6['format'](_0xc951('0x1d'))});}else _0x27313e({'ret':_0x4210aa});}else _0x27313e({'ret':_0x4210aa});}else{_0x27313e({'ret':_0x4210aa});}});}});return 0xa;}var _0x3e7f7b=function(_0x3273bf){return new BPromise(function(_0x13b15f,_0x3ce08f){_0x43a52b(_0x3273bf,_0xa87e64)[_0xc951('0x25')](function(_0x34ad10){_0xa87e64[_0xc951('0x1b')]=_0x34ad10[_0xc951('0x26')];_0x276177[_0xc951('0x27')]['findOne']({'where':{'phone':_0xa87e64[_0xc951('0xd')],'VoiceQueueId':_0x3273bf['id']}})[_0xc951('0x25')](function(_0x193fa0){if(!_['isNil'](_0x193fa0)){throw new Error(_0xc951('0x28')+_0xa87e64['phone']+_0xc951('0x29')+_0x3273bf['id']);}return _0x276177[_0xc951('0x27')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64[_0xc951('0x2b')],'priority':_0xa87e64[_0xc951('0x2c')]?_0xa87e64[_0xc951('0x2c')]:0x2,'scheduledat':_0xa87e64[_0xc951('0x1b')]?_0xa87e64[_0xc951('0x1b')]:moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xa87e64['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')](_0xc951('0x1d')):undefined,'VoiceQueueId':_0x3273bf['id']});})[_0xc951('0x2e')](function(_0x4b2c0d){_0x3ce08f(_0x4b2c0d);});});});};var _0x16aac4=function(_0x4ea9f8){return new BPromise(function(_0x259fdf,_0x5c154f){_0x43a52b(_0x4ea9f8,_0xa87e64)['then'](function(_0x3ac887){_0xa87e64['scheduledat']=_0x3ac887[_0xc951('0x26')];_0x276177[_0xc951('0x27')][_0xc951('0x21')]({'where':{'phone':_0xa87e64[_0xc951('0xd')],'VoiceQueueId':_0x4ea9f8['id']}})[_0xc951('0x25')](function(_0x269fa6){if(!_[_0xc951('0x1e')](_0x269fa6)){throw new Error(_0xc951('0x28')+_0xa87e64[_0xc951('0xd')]+_0xc951('0x2f')+_0x4ea9f8['id']);}return _0x276177[_0xc951('0x30')][_0xc951('0x21')]({'where':{'calleridnum':_0xa87e64[_0xc951('0xd')],'VoiceQueueId':_0x4ea9f8['id']}});})[_0xc951('0x25')](function(_0x12f724){if(!_[_0xc951('0x1e')](_0x12f724)){throw new Error(_0xc951('0x31')+_0xa87e64['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x4ea9f8['id']);}return _0x276177[_0xc951('0x27')]['create']({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64['ListId'],'priority':_0xa87e64[_0xc951('0x2c')]?_0xa87e64['priority']:0x2,'scheduledat':_0xa87e64[_0xc951('0x1b')]?_0xa87e64[_0xc951('0x1b')]:moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xa87e64[_0xc951('0x2d')]?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')](_0xc951('0x1d')):undefined,'VoiceQueueId':_0x4ea9f8['id']});})[_0xc951('0x2e')](function(_0x23faf3){_0x5c154f(_0x23faf3);});});});};function _0x4f353e(){return function(_0x128466){logger[_0xc951('0x17')](_0xc951('0x18'),_0xc951('0x19'),util[_0xc951('0x1a')](_0x128466,{'showHidden':![],'depth':null}));};}function _0x4b3a90(_0x22601f,_0x281bab){var _0x144066=_0x281bab['scheduledat']?_0x281bab[_0xc951('0x1b')]:moment()[_0xc951('0x1c')](_0xc951('0x1d'));return new BPromise(function(_0x55aae3,_0x3fe0f6){if(_['isNil'](_0x281bab[_0xc951('0x1f')])){_0x55aae3({'ret':_0x144066});}else{_0x276177[_0xc951('0x32')][_0xc951('0x21')]({'where':{'id':_0x22601f['id']}})[_0xc951('0x25')](function(_0x304db0){if(!_['isNil'](_0x304db0)){var _0x552431=_0x304db0[_0xc951('0x1f')];if(!_[_0xc951('0x1e')](_0x552431)){var _0x4ed53b=shared[_0xc951('0x33')];var _0x2dd4fa=_0x4ed53b[_0x552431];var _0x20d700=_0x4ed53b[_0x281bab[_0xc951('0x1f')]];if(!_[_0xc951('0x1e')](_0x2dd4fa)&&!_[_0xc951('0x1e')](_0x20d700)){var _0x48eed3=_0x2dd4fa['utcOffset']-_0x20d700[_0xc951('0x22')];_0x144066=_0x281bab[_0xc951('0x1b')]?_0x281bab[_0xc951('0x1b')]:moment();var _0x521f3e=moment(_0x144066)[_0xc951('0x23')](_0x48eed3,_0xc951('0x24'));_0x55aae3({'ret':_0x521f3e[_0xc951('0x1c')](_0xc951('0x1d'))});}else _0x55aae3({'ret':_0x144066});}else _0x55aae3({'ret':_0x144066});}else{_0x55aae3({'ret':_0x144066});}});}});return 0xa;}var _0x464573=function(_0x40056a){return new BPromise(function(_0x22a89e,_0x22ac67){_0x4b3a90(_0x40056a,_0xa87e64)[_0xc951('0x25')](function(_0x59fbff){_0xa87e64['scheduledat']=_0x59fbff[_0xc951('0x26')];_0x276177['CmHopper'][_0xc951('0x21')]({'where':{'phone':_0xa87e64[_0xc951('0xd')],'CampaignId':_0x40056a['id']}})[_0xc951('0x25')](function(_0x18f17e){if(!_['isNil'](_0x18f17e)){throw new Error(_0xc951('0x28')+_0xa87e64[_0xc951('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x40056a['id']);}return _0x276177[_0xc951('0x27')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64['ListId'],'priority':_0xa87e64['priority']?_0xa87e64[_0xc951('0x2c')]:0x2,'scheduledat':_0xa87e64[_0xc951('0x1b')]?_0xa87e64['scheduledat']:moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0xa87e64[_0xc951('0x2d')]?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x40056a['id']});})['catch'](function(_0x23a3fa){_0x22ac67(_0x23a3fa);});});});};var _0x5bb2a1=function(_0x22b712){return new BPromise(function(_0x25f341,_0x7e7d6){_0x4b3a90(_0x22b712,_0xa87e64)[_0xc951('0x25')](function(_0x45da7b){_0xa87e64[_0xc951('0x1b')]=_0x45da7b['ret'];_0x276177[_0xc951('0x27')][_0xc951('0x21')]({'where':{'phone':_0xa87e64[_0xc951('0xd')],'CampaignId':_0x22b712['id']}})['then'](function(_0x6cdc85){if(!_[_0xc951('0x1e')](_0x6cdc85)){throw new Error('cmContact,\x20afterCreate\x20'+_0xa87e64[_0xc951('0xd')]+_0xc951('0x34')+_0x22b712['id']);}return _0x276177[_0xc951('0x30')]['findOne']({'where':{'calleridnum':_0xa87e64['phone'],'CampaignId':_0x22b712['id']}});})[_0xc951('0x25')](function(_0x2c6223){if(!_[_0xc951('0x1e')](_0x2c6223)){throw new Error(_0xc951('0x31')+_0xa87e64[_0xc951('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x22b712['id']);}return _0x276177[_0xc951('0x27')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64[_0xc951('0x2b')],'priority':_0xa87e64['priority']?_0xa87e64[_0xc951('0x2c')]:0x2,'scheduledat':_0xa87e64[_0xc951('0x1b')]?_0xa87e64['scheduledat']:moment()[_0xc951('0x1c')](_0xc951('0x1d')),'callback':_0xa87e64['callbackUniqueid']?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x22b712['id']});})[_0xc951('0x2e')](function(_0x5b70c1){_0x7e7d6(_0x5b70c1);});});});};if(_0xa87e64[_0xc951('0x2b')]){_0x276177['VoiceQueue'][_0xc951('0x35')]({'where':{'type':'outbound'},'attributes':['id',_0xc951('0x36'),_0xc951('0x1f')],'include':[{'model':_0x276177['CmList'],'as':_0xc951('0x37'),'where':{'id':_0xa87e64[_0xc951('0x2b')]}}]})[_0xc951('0x25')](function(_0x10b140){if(_0x10b140){var _0x1959c9=[];for(var _0x50c0e5=0x0,_0x35c4e3;_0x50c0e5<_0x10b140['length'];_0x50c0e5+=0x1){_0x35c4e3=_0x10b140[_0x50c0e5][_0xc951('0x16')]({'plain':!![]});switch(_0x35c4e3[_0xc951('0x36')]){case _0xc951('0x38'):_0x16aac4(_0x35c4e3)[_0xc951('0x2e')](_0x15bd49());break;case _0xc951('0x39'):_0x3e7f7b(_0x35c4e3)[_0xc951('0x2e')](_0x15bd49());break;default:_0x4b3a90(_0x35c4e3,_0xa87e64)[_0xc951('0x25')](function(_0x868e4b){_0xa87e64[_0xc951('0x1b')]=_0x868e4b['ret'];_0x276177['CmHopper'][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64['ListId'],'scheduledat':_0xa87e64[_0xc951('0x1b')]?_0xa87e64['scheduledat']:moment()[_0xc951('0x1c')](_0xc951('0x1d')),'priority':_0xa87e64['priority']?_0xa87e64[_0xc951('0x2c')]:0x2,'callback':_0xa87e64[_0xc951('0x2d')]?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x35c4e3['id']})[_0xc951('0x2e')](_0x15bd49());});}}}})[_0xc951('0x25')](function(){return _0x276177[_0xc951('0x20')][_0xc951('0x35')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x276177[_0xc951('0x3a')],'as':_0xc951('0x3b'),'where':{'id':_0xa87e64['ListId']}}]})['then'](function(_0x458075){if(_0x458075){var _0x5d3896=[];for(var _0xbe364=0x0,_0xf24f20;_0xbe364<_0x458075[_0xc951('0x3c')];_0xbe364+=0x1){_0xf24f20=_0x458075[_0xbe364][_0xc951('0x16')]({'plain':!![]});_0x276177[_0xc951('0x3d')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64[_0xc951('0x2b')],'VoiceQueueId':_0xf24f20['id']})[_0xc951('0x2e')](function(_0x47a56f){logger['error']('cmContact,\x20%s,\x20%s',_0xc951('0x19'),_0x47a56f[_0xc951('0x3e')]);});}}});})[_0xc951('0x25')](function(){return _0x276177[_0xc951('0x32')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x276177['CmList'],'as':_0xc951('0x37'),'where':{'id':_0xa87e64[_0xc951('0x2b')]}}]})[_0xc951('0x25')](function(_0x26d522){if(_0x26d522){var _0x4fb186=[];for(var _0x481348=0x0,_0x18371b;_0x481348<_0x26d522[_0xc951('0x3c')];_0x481348+=0x1){_0x18371b=_0x26d522[_0x481348][_0xc951('0x16')]({'plain':!![]});switch(_0x18371b[_0xc951('0x36')]){case _0xc951('0x38'):_0x5bb2a1(_0x18371b)[_0xc951('0x2e')](_0x4f353e());break;case _0xc951('0x39'):_0x464573(_0x18371b)[_0xc951('0x2e')](_0x4f353e());break;default:_0x276177[_0xc951('0x27')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64[_0xc951('0x2b')],'scheduledat':_0xa87e64['scheduledat']?_0xa87e64[_0xc951('0x1b')]:moment()[_0xc951('0x1c')](_0xc951('0x1d')),'priority':_0xa87e64[_0xc951('0x2c')]?_0xa87e64[_0xc951('0x2c')]:0x2,'callback':_0xa87e64[_0xc951('0x2d')]?!![]:![],'callbackuniqueid':_0xa87e64[_0xc951('0x2d')]?_0xa87e64['callbackUniqueid']:undefined,'callbackat':_0xa87e64[_0xc951('0x2d')]?moment()[_0xc951('0x1c')](_0xc951('0x1d')):undefined,'CampaignId':_0x18371b['id']})[_0xc951('0x2e')](_0x4f353e());}}}});})['then'](function(){return _0x276177[_0xc951('0x32')][_0xc951('0x35')]({'attributes':['id'],'include':[{'model':_0x276177[_0xc951('0x3a')],'as':_0xc951('0x3b'),'where':{'id':_0xa87e64[_0xc951('0x2b')]}}]})[_0xc951('0x25')](function(_0x599e24){if(_0x599e24){var _0x1a547b=[];for(var _0x5b344b=0x0,_0x1ff7cf;_0x5b344b<_0x599e24[_0xc951('0x3c')];_0x5b344b+=0x1){_0x1ff7cf=_0x599e24[_0x5b344b]['get']({'plain':!![]});_0x276177[_0xc951('0x3d')][_0xc951('0x2a')]({'phone':_0xa87e64[_0xc951('0xd')],'ContactId':_0xa87e64['id'],'ListId':_0xa87e64[_0xc951('0x2b')],'CampaignId':_0x1ff7cf['id']})[_0xc951('0x2e')](function(_0x399e38){logger[_0xc951('0x17')](_0xc951('0x3f'),_0xc951('0x19'),_0x399e38['message']);});}}});})[_0xc951('0x25')](function(){_0xc66585();})['catch'](function(_0x291e1f){logger['error']('cmContact,\x20%s,\x20%s',_0xc951('0x19'),_0x291e1f[_0xc951('0x3e')]);_0xc66585(_0x291e1f);});}else{_0xc66585(new Error(_0xc951('0x40')));}},'afterDestroy':function(_0x5422a6,_0x3a5278,_0x221eb7){var _0x218ff7=_0x1e2d0f[_0xc951('0x15')];var _0xdf8663=_0x5422a6['get']({'plain':!![]});return _0x218ff7[_0xc951('0x27')][_0xc951('0x35')]({'raw':!![],'where':{'ListId':_0xdf8663[_0xc951('0x2b')],'ContactId':_0xdf8663['id']}})['then'](function(_0x5bd8e2){if(!_[_0xc951('0x41')](_0x5bd8e2)){var _0x1902c3=[];for(var _0x542948=0x0;_0x542948<_0x5bd8e2[_0xc951('0x3c')];_0x542948+=0x1){var _0x865550=_0x218ff7[_0xc951('0x27')]['destroy']({'where':{'ListId':_0x5bd8e2[_0x542948][_0xc951('0x2b')],'ContactId':_0x5bd8e2[_0x542948][_0xc951('0x42')],'VoiceQueueId':_0x5bd8e2[_0x542948]['VoiceQueueId'],'CampaignId':_0x5bd8e2[_0x542948][_0xc951('0x43')]}});_0x1902c3[_0xc951('0x44')](_0x865550);}return BPromise['all'](_0x1902c3);}})[_0xc951('0x25')](function(_0x538d2c){logger[_0xc951('0x45')]('[CmContact][afterDestroy][Succesfull]',util[_0xc951('0x1a')](_0x538d2c,{'showHidden':![],'depth':null}));_0x221eb7();})[_0xc951('0x2e')](function(_0x23b28a){logger[_0xc951('0x17')]('[CmContact][afterDestroy][Error]',util[_0xc951('0x1a')](_0x23b28a,{'showHidden':![],'depth':null}));_0x221eb7(_0x23b28a);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e8a58fa..820ea73 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x5350d0,_0x1feef8){var _0x20ad9b=function(_0x19f3cc){while(--_0x19f3cc){_0x5350d0['push'](_0x5350d0['shift']());}};_0x20ad9b(++_0x1feef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index fd54764..7c6d796 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe02=['exports','INTEGER','STRING','PHONE'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0xbe02,0x124));var _0x2be0=function(_0x4c0ede,_0x190772){_0x4c0ede=_0x4c0ede-0x0;var _0x3b6132=_0xbe02[_0x4c0ede];return _0x3b6132;};'use strict';var Sequelize=require('sequelize');module[_0x2be0('0x0')]={'CmContactId':{'type':Sequelize[_0x2be0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2be0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x2be0('0x3')},'OrderBy':{'type':Sequelize[_0x2be0('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x0eaa=['STRING','sequelize','exports','INTEGER'];(function(_0x52251f,_0x5d02f3){var _0xd91ce0=function(_0x124489){while(--_0x124489){_0x52251f['push'](_0x52251f['shift']());}};_0xd91ce0(++_0x5d02f3);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x52f906,_0x23ffee){_0x52f906=_0x52f906-0x0;var _0x453ce6=_0x0eaa[_0x52f906];return _0x453ce6;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa0ea('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xa0ea('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xa0ea('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a9dbfbb..b1441be 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1c3=['where','VIRTUAL','merge','includeAll','include','findAll','show','params','options','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','CmContactHasItems','UserProfileResource','error','name','map','CmContactHasItem','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','pick','filter'];(function(_0x2f8431,_0x10a4b4){var _0x2640c7=function(_0x3ecf4b){while(--_0x3ecf4b){_0x2f8431['push'](_0x2f8431['shift']());}};_0x2640c7(++_0x10a4b4);}(_0xf1c3,0xbb));var _0x3f1c=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0xf1c3[_0x5ff517];return _0x19a245;};'use strict';var emlformat=require(_0x3f1c('0x0'));var rimraf=require(_0x3f1c('0x1'));var zipdir=require(_0x3f1c('0x2'));var jsonpatch=require(_0x3f1c('0x3'));var rp=require(_0x3f1c('0x4'));var moment=require(_0x3f1c('0x5'));var BPromise=require(_0x3f1c('0x6'));var Mustache=require(_0x3f1c('0x7'));var util=require(_0x3f1c('0x8'));var path=require(_0x3f1c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f1c('0xb'));var squel=require(_0x3f1c('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f1c('0xd'));var deskjs=require(_0x3f1c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f1c('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f1c('0x10'));var authService=require(_0x3f1c('0x11'));var qs=require(_0x3f1c('0x12'));var as=require(_0x3f1c('0x13'));var hardwareService=require(_0x3f1c('0x14'));var logger=require(_0x3f1c('0x15'))(_0x3f1c('0x16'));var utils=require(_0x3f1c('0x17'));var config=require(_0x3f1c('0x18'));var licenseUtil=require(_0x3f1c('0x19'));var db=require(_0x3f1c('0x1a'))['db'];function respondWithStatusCode(_0x8fe82c,_0x7f36cd){_0x7f36cd=_0x7f36cd||0xcc;return function(_0x26692b){if(_0x26692b){return _0x8fe82c[_0x3f1c('0x1b')](_0x7f36cd);}return _0x8fe82c['status'](_0x7f36cd)[_0x3f1c('0x1c')]();};}function respondWithResult(_0x1b8959,_0x5bca51){_0x5bca51=_0x5bca51||0xc8;return function(_0x551f53){if(_0x551f53){return _0x1b8959[_0x3f1c('0x1d')](_0x5bca51)[_0x3f1c('0x1e')](_0x551f53);}};}function respondWithFilteredResult(_0x1fe3df,_0x31832e){return function(_0x4658fc){if(_0x4658fc){var _0x76f5a8=typeof _0x31832e['offset']===_0x3f1c('0x1f')&&typeof _0x31832e[_0x3f1c('0x20')]===_0x3f1c('0x1f');var _0xfd7f73=_0x4658fc[_0x3f1c('0x21')];var _0xb2347b=_0x76f5a8?0x0:_0x31832e[_0x3f1c('0x22')];var _0x50c82a=_0x76f5a8?_0x4658fc['count']:_0x31832e[_0x3f1c('0x22')]+_0x31832e['limit'];var _0x2b2efe;if(_0x50c82a>=_0xfd7f73){_0x50c82a=_0xfd7f73;_0x2b2efe=0xc8;}else{_0x2b2efe=0xce;}_0x1fe3df[_0x3f1c('0x1d')](_0x2b2efe);return _0x1fe3df[_0x3f1c('0x23')](_0x3f1c('0x24'),_0xb2347b+'-'+_0x50c82a+'/'+_0xfd7f73)[_0x3f1c('0x1e')](_0x4658fc);}return null;};}function patchUpdates(_0x5df655){return function(_0x29f437){try{jsonpatch[_0x3f1c('0x25')](_0x29f437,_0x5df655,!![]);}catch(_0x495f8a){return BPromise['reject'](_0x495f8a);}return _0x29f437[_0x3f1c('0x26')]();};}function saveUpdates(_0x289eef,_0x18954d){return function(_0x3f8bc3){if(_0x3f8bc3){return _0x3f8bc3['update'](_0x289eef)[_0x3f1c('0x27')](function(_0x1c2e35){return _0x1c2e35;});}return null;};}function removeEntity(_0x539b22,_0x36cef4){return function(_0x4e3df3){if(_0x4e3df3){return _0x4e3df3[_0x3f1c('0x28')]()['then'](function(){var _0x32aa5a=_0x4e3df3['get']({'plain':!![]});var _0x3da6c8=_0x3f1c('0x29');return db[_0x3f1c('0x2a')][_0x3f1c('0x28')]({'where':{'type':_0x3da6c8,'resourceId':_0x32aa5a['id']}})[_0x3f1c('0x27')](function(){return _0x4e3df3;});})[_0x3f1c('0x27')](function(){_0x539b22[_0x3f1c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3272cf,_0x1f9ed4){return function(_0x1485f9){if(!_0x1485f9){_0x3272cf[_0x3f1c('0x1b')](0x194);}return _0x1485f9;};}function handleError(_0xf22a0b,_0x4992e1){_0x4992e1=_0x4992e1||0x1f4;return function(_0x4f130b){logger[_0x3f1c('0x2b')](_0x4f130b['stack']);if(_0x4f130b[_0x3f1c('0x2c')]){delete _0x4f130b['name'];}_0xf22a0b[_0x3f1c('0x1d')](_0x4992e1)['send'](_0x4f130b);};}exports['index']=function(_0x17084c,_0x14d441){var _0x4a747f={},_0x5c2d49={},_0x3c6f52={'count':0x0,'rows':[]};var _0xcc39e8=_[_0x3f1c('0x2d')](db[_0x3f1c('0x2e')]['rawAttributes'],function(_0xf37efe){return{'name':_0xf37efe[_0x3f1c('0x2f')],'type':_0xf37efe[_0x3f1c('0x30')][_0x3f1c('0x31')]};});_0x5c2d49['model']=_[_0x3f1c('0x2d')](_0xcc39e8,_0x3f1c('0x2c'));_0x5c2d49['query']=_[_0x3f1c('0x32')](_0x17084c[_0x3f1c('0x33')]);_0x5c2d49[_0x3f1c('0x34')]=_['intersection'](_0x5c2d49[_0x3f1c('0x35')],_0x5c2d49[_0x3f1c('0x33')]);_0x4a747f[_0x3f1c('0x36')]=_[_0x3f1c('0x37')](_0x5c2d49[_0x3f1c('0x35')],qs['fields'](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x38')]));_0x4a747f[_0x3f1c('0x36')]=_0x4a747f[_0x3f1c('0x36')][_0x3f1c('0x39')]?_0x4a747f['attributes']:_0x5c2d49[_0x3f1c('0x35')];if(!_0x17084c[_0x3f1c('0x33')]['hasOwnProperty'](_0x3f1c('0x3a'))){_0x4a747f[_0x3f1c('0x20')]=qs[_0x3f1c('0x20')](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x20')]);_0x4a747f[_0x3f1c('0x22')]=qs[_0x3f1c('0x22')](_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x22')]);}_0x4a747f['order']=qs[_0x3f1c('0x3b')](_0x17084c['query'][_0x3f1c('0x3b')]);_0x4a747f['where']=qs[_0x3f1c('0x34')](_[_0x3f1c('0x3c')](_0x17084c[_0x3f1c('0x33')],_0x5c2d49[_0x3f1c('0x34')]),_0xcc39e8);if(_0x17084c['query'][_0x3f1c('0x3d')]){_0x4a747f[_0x3f1c('0x3e')]=_['merge'](_0x4a747f[_0x3f1c('0x3e')],{'$or':_['map'](_0xcc39e8,function(_0x3287fd){if(_0x3287fd[_0x3f1c('0x30')]!==_0x3f1c('0x3f')){var _0x51eb3e={};_0x51eb3e[_0x3287fd['name']]={'$like':'%'+_0x17084c[_0x3f1c('0x33')]['filter']+'%'};return _0x51eb3e;}})});}_0x4a747f=_[_0x3f1c('0x40')]({},_0x4a747f,_0x17084c['options']);var _0x51678d={'where':_0x4a747f[_0x3f1c('0x3e')]};return db[_0x3f1c('0x2e')][_0x3f1c('0x21')](_0x51678d)['then'](function(_0xd0080e){_0x3c6f52[_0x3f1c('0x21')]=_0xd0080e;if(_0x17084c[_0x3f1c('0x33')][_0x3f1c('0x41')]){_0x4a747f[_0x3f1c('0x42')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x3f1c('0x43')](_0x4a747f);})[_0x3f1c('0x27')](function(_0x3e64bf){_0x3c6f52['rows']=_0x3e64bf;return _0x3c6f52;})[_0x3f1c('0x27')](respondWithFilteredResult(_0x14d441,_0x4a747f))['catch'](handleError(_0x14d441,null));};exports[_0x3f1c('0x44')]=function(_0xa7a118,_0x1a3ced){var _0x39bfbf={'raw':!![],'where':{'id':_0xa7a118[_0x3f1c('0x45')]['id']}},_0x3dfeee={};_0x3dfeee[_0x3f1c('0x35')]=_['keys'](db[_0x3f1c('0x2e')]['rawAttributes']);_0x3dfeee[_0x3f1c('0x33')]=_[_0x3f1c('0x32')](_0xa7a118[_0x3f1c('0x33')]);_0x3dfeee[_0x3f1c('0x34')]=_[_0x3f1c('0x37')](_0x3dfeee['model'],_0x3dfeee[_0x3f1c('0x33')]);_0x39bfbf[_0x3f1c('0x36')]=_[_0x3f1c('0x37')](_0x3dfeee[_0x3f1c('0x35')],qs[_0x3f1c('0x38')](_0xa7a118['query'][_0x3f1c('0x38')]));_0x39bfbf[_0x3f1c('0x36')]=_0x39bfbf[_0x3f1c('0x36')][_0x3f1c('0x39')]?_0x39bfbf[_0x3f1c('0x36')]:_0x3dfeee[_0x3f1c('0x35')];if(_0xa7a118[_0x3f1c('0x33')][_0x3f1c('0x41')]){_0x39bfbf[_0x3f1c('0x42')]=[{'all':!![]}];}_0x39bfbf=_[_0x3f1c('0x40')]({},_0x39bfbf,_0xa7a118[_0x3f1c('0x46')]);return db[_0x3f1c('0x2e')][_0x3f1c('0x47')](_0x39bfbf)[_0x3f1c('0x27')](handleEntityNotFound(_0x1a3ced,null))[_0x3f1c('0x27')](respondWithResult(_0x1a3ced,null))[_0x3f1c('0x48')](handleError(_0x1a3ced,null));};exports['create']=function(_0x370d99,_0x5d6594){return db[_0x3f1c('0x2e')]['create'](_0x370d99[_0x3f1c('0x49')],{})['then'](function(_0x516cd2){var _0x4d7765=_0x370d99[_0x3f1c('0x4a')][_0x3f1c('0x4b')]({'plain':!![]});if(!_0x4d7765)throw new Error(_0x3f1c('0x4c'));if(_0x4d7765[_0x3f1c('0x4d')]===_0x3f1c('0x4a')){var _0x324290=_0x516cd2[_0x3f1c('0x4b')]({'plain':!![]});var _0x3248db=_0x3f1c('0x29');return db[_0x3f1c('0x4e')][_0x3f1c('0x47')]({'where':{'name':_0x3248db,'userProfileId':_0x4d7765[_0x3f1c('0x4f')]},'raw':!![]})['then'](function(_0x32d130){if(_0x32d130&&_0x32d130['autoAssociation']===0x0){return db[_0x3f1c('0x2a')][_0x3f1c('0x50')]({'name':_0x324290['name'],'resourceId':_0x324290['id'],'type':_0x32d130[_0x3f1c('0x2c')],'sectionId':_0x32d130['id']},{})[_0x3f1c('0x27')](function(){return _0x516cd2;});}else{return _0x516cd2;}})[_0x3f1c('0x48')](function(_0x33d3ae){logger['error'](_0x3f1c('0x51'),_0x33d3ae);throw _0x33d3ae;});}return _0x516cd2;})[_0x3f1c('0x27')](respondWithResult(_0x5d6594,0xc9))[_0x3f1c('0x48')](handleError(_0x5d6594,null));};exports[_0x3f1c('0x52')]=function(_0x313397,_0x2247f1){if(_0x313397[_0x3f1c('0x49')]['id']){delete _0x313397['body']['id'];}return db[_0x3f1c('0x2e')][_0x3f1c('0x47')]({'where':{'id':_0x313397[_0x3f1c('0x45')]['id']}})[_0x3f1c('0x27')](handleEntityNotFound(_0x2247f1,null))[_0x3f1c('0x27')](saveUpdates(_0x313397[_0x3f1c('0x49')],null))[_0x3f1c('0x27')](respondWithResult(_0x2247f1,null))[_0x3f1c('0x48')](handleError(_0x2247f1,null));};exports['destroy']=function(_0x293722,_0x4985c4){return db[_0x3f1c('0x2e')][_0x3f1c('0x47')]({'where':{'id':_0x293722[_0x3f1c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4985c4,null))[_0x3f1c('0x27')](removeEntity(_0x4985c4,null))[_0x3f1c('0x48')](handleError(_0x4985c4,null));}; \ No newline at end of file +var _0x29af=['includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','CmContactHasItems','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29af,0x10f));var _0xf29a=function(_0x22ec53,_0x5a5549){_0x22ec53=_0x22ec53-0x0;var _0x45d6ae=_0x29af[_0x22ec53];return _0x45d6ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf29a('0x0'));var zipdir=require(_0xf29a('0x1'));var jsonpatch=require(_0xf29a('0x2'));var rp=require(_0xf29a('0x3'));var moment=require(_0xf29a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf29a('0x5'));var util=require(_0xf29a('0x6'));var path=require(_0xf29a('0x7'));var sox=require(_0xf29a('0x8'));var csv=require(_0xf29a('0x9'));var ejs=require(_0xf29a('0xa'));var fs=require('fs');var fs_extra=require(_0xf29a('0xb'));var _=require('lodash');var squel=require(_0xf29a('0xc'));var crypto=require('crypto');var jsforce=require(_0xf29a('0xd'));var deskjs=require(_0xf29a('0xe'));var toCsv=require(_0xf29a('0x9'));var querystring=require(_0xf29a('0xf'));var Papa=require(_0xf29a('0x10'));var Redis=require(_0xf29a('0x11'));var authService=require(_0xf29a('0x12'));var qs=require(_0xf29a('0x13'));var as=require(_0xf29a('0x14'));var hardwareService=require(_0xf29a('0x15'));var logger=require(_0xf29a('0x16'))(_0xf29a('0x17'));var utils=require(_0xf29a('0x18'));var config=require(_0xf29a('0x19'));var licenseUtil=require(_0xf29a('0x1a'));var db=require(_0xf29a('0x1b'))['db'];function respondWithStatusCode(_0x11de32,_0x335c87){_0x335c87=_0x335c87||0xcc;return function(_0x32d8da){if(_0x32d8da){return _0x11de32['sendStatus'](_0x335c87);}return _0x11de32[_0xf29a('0x1c')](_0x335c87)[_0xf29a('0x1d')]();};}function respondWithResult(_0x936bd7,_0x2e610){_0x2e610=_0x2e610||0xc8;return function(_0x587803){if(_0x587803){return _0x936bd7[_0xf29a('0x1c')](_0x2e610)[_0xf29a('0x1e')](_0x587803);}};}function respondWithFilteredResult(_0x5cb0e3,_0x1f21af){return function(_0x2ae6f0){if(_0x2ae6f0){var _0x53e87f=typeof _0x1f21af[_0xf29a('0x1f')]===_0xf29a('0x20')&&typeof _0x1f21af[_0xf29a('0x21')]===_0xf29a('0x20');var _0x1f4ee2=_0x2ae6f0[_0xf29a('0x22')];var _0x4c1278=_0x53e87f?0x0:_0x1f21af['offset'];var _0x30011d=_0x53e87f?_0x2ae6f0['count']:_0x1f21af[_0xf29a('0x1f')]+_0x1f21af[_0xf29a('0x21')];var _0x28ce77;if(_0x30011d>=_0x1f4ee2){_0x30011d=_0x1f4ee2;_0x28ce77=0xc8;}else{_0x28ce77=0xce;}_0x5cb0e3[_0xf29a('0x1c')](_0x28ce77);return _0x5cb0e3[_0xf29a('0x23')](_0xf29a('0x24'),_0x4c1278+'-'+_0x30011d+'/'+_0x1f4ee2)[_0xf29a('0x1e')](_0x2ae6f0);}return null;};}function patchUpdates(_0x416c49){return function(_0x436465){try{jsonpatch[_0xf29a('0x25')](_0x436465,_0x416c49,!![]);}catch(_0x5e93d2){return BPromise['reject'](_0x5e93d2);}return _0x436465['save']();};}function saveUpdates(_0x10c4a6,_0x272794){return function(_0x14463e){if(_0x14463e){return _0x14463e[_0xf29a('0x26')](_0x10c4a6)[_0xf29a('0x27')](function(_0x148e20){return _0x148e20;});}return null;};}function removeEntity(_0x5ddfca,_0x2879a3){return function(_0x52279b){if(_0x52279b){return _0x52279b[_0xf29a('0x28')]()[_0xf29a('0x27')](function(){var _0x2ee68c=_0x52279b['get']({'plain':!![]});var _0x49afa9=_0xf29a('0x29');return db[_0xf29a('0x2a')][_0xf29a('0x28')]({'where':{'type':_0x49afa9,'resourceId':_0x2ee68c['id']}})[_0xf29a('0x27')](function(){return _0x52279b;});})['then'](function(){_0x5ddfca[_0xf29a('0x1c')](0xcc)[_0xf29a('0x1d')]();});}};}function handleEntityNotFound(_0x4d857e,_0x22e93e){return function(_0x44721c){if(!_0x44721c){_0x4d857e[_0xf29a('0x2b')](0x194);}return _0x44721c;};}function handleError(_0xbf55d0,_0x1d143b){_0x1d143b=_0x1d143b||0x1f4;return function(_0x5751cd){logger[_0xf29a('0x2c')](_0x5751cd[_0xf29a('0x2d')]);if(_0x5751cd[_0xf29a('0x2e')]){delete _0x5751cd[_0xf29a('0x2e')];}_0xbf55d0['status'](_0x1d143b)[_0xf29a('0x2f')](_0x5751cd);};}exports[_0xf29a('0x30')]=function(_0x5dc676,_0x239894){var _0x1f93f9={},_0x37246f={},_0x2f55b5={'count':0x0,'rows':[]};var _0x3747e8=_[_0xf29a('0x31')](db[_0xf29a('0x32')][_0xf29a('0x33')],function(_0x5a0877){return{'name':_0x5a0877[_0xf29a('0x34')],'type':_0x5a0877[_0xf29a('0x35')][_0xf29a('0x36')]};});_0x37246f['model']=_[_0xf29a('0x31')](_0x3747e8,'name');_0x37246f[_0xf29a('0x37')]=_['keys'](_0x5dc676['query']);_0x37246f[_0xf29a('0x38')]=_[_0xf29a('0x39')](_0x37246f['model'],_0x37246f['query']);_0x1f93f9[_0xf29a('0x3a')]=_['intersection'](_0x37246f[_0xf29a('0x3b')],qs[_0xf29a('0x3c')](_0x5dc676[_0xf29a('0x37')][_0xf29a('0x3c')]));_0x1f93f9[_0xf29a('0x3a')]=_0x1f93f9[_0xf29a('0x3a')][_0xf29a('0x3d')]?_0x1f93f9[_0xf29a('0x3a')]:_0x37246f[_0xf29a('0x3b')];if(!_0x5dc676[_0xf29a('0x37')][_0xf29a('0x3e')]('nolimit')){_0x1f93f9[_0xf29a('0x21')]=qs[_0xf29a('0x21')](_0x5dc676[_0xf29a('0x37')][_0xf29a('0x21')]);_0x1f93f9[_0xf29a('0x1f')]=qs[_0xf29a('0x1f')](_0x5dc676['query']['offset']);}_0x1f93f9['order']=qs[_0xf29a('0x3f')](_0x5dc676[_0xf29a('0x37')][_0xf29a('0x3f')]);_0x1f93f9['where']=qs[_0xf29a('0x38')](_[_0xf29a('0x40')](_0x5dc676['query'],_0x37246f[_0xf29a('0x38')]),_0x3747e8);if(_0x5dc676[_0xf29a('0x37')][_0xf29a('0x41')]){_0x1f93f9[_0xf29a('0x42')]=_[_0xf29a('0x43')](_0x1f93f9[_0xf29a('0x42')],{'$or':_[_0xf29a('0x31')](_0x3747e8,function(_0x4a25b6){if(_0x4a25b6[_0xf29a('0x35')]!=='VIRTUAL'){var _0x49c85c={};_0x49c85c[_0x4a25b6[_0xf29a('0x2e')]]={'$like':'%'+_0x5dc676[_0xf29a('0x37')]['filter']+'%'};return _0x49c85c;}})});}_0x1f93f9=_[_0xf29a('0x43')]({},_0x1f93f9,_0x5dc676[_0xf29a('0x44')]);var _0x1b6999={'where':_0x1f93f9[_0xf29a('0x42')]};return db['CmContactHasItem'][_0xf29a('0x22')](_0x1b6999)[_0xf29a('0x27')](function(_0x34aaf3){_0x2f55b5[_0xf29a('0x22')]=_0x34aaf3;if(_0x5dc676[_0xf29a('0x37')][_0xf29a('0x45')]){_0x1f93f9[_0xf29a('0x46')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xf29a('0x47')](_0x1f93f9);})[_0xf29a('0x27')](function(_0x5610cf){_0x2f55b5[_0xf29a('0x48')]=_0x5610cf;return _0x2f55b5;})[_0xf29a('0x27')](respondWithFilteredResult(_0x239894,_0x1f93f9))[_0xf29a('0x49')](handleError(_0x239894,null));};exports[_0xf29a('0x4a')]=function(_0x2133de,_0x3500ea){var _0x3e22e6={'raw':!![],'where':{'id':_0x2133de[_0xf29a('0x4b')]['id']}},_0x2a28ce={};_0x2a28ce['model']=_['keys'](db[_0xf29a('0x32')][_0xf29a('0x33')]);_0x2a28ce['query']=_[_0xf29a('0x4c')](_0x2133de[_0xf29a('0x37')]);_0x2a28ce[_0xf29a('0x38')]=_[_0xf29a('0x39')](_0x2a28ce['model'],_0x2a28ce[_0xf29a('0x37')]);_0x3e22e6[_0xf29a('0x3a')]=_[_0xf29a('0x39')](_0x2a28ce['model'],qs[_0xf29a('0x3c')](_0x2133de[_0xf29a('0x37')][_0xf29a('0x3c')]));_0x3e22e6[_0xf29a('0x3a')]=_0x3e22e6['attributes'][_0xf29a('0x3d')]?_0x3e22e6[_0xf29a('0x3a')]:_0x2a28ce[_0xf29a('0x3b')];if(_0x2133de[_0xf29a('0x37')]['includeAll']){_0x3e22e6[_0xf29a('0x46')]=[{'all':!![]}];}_0x3e22e6=_[_0xf29a('0x43')]({},_0x3e22e6,_0x2133de['options']);return db['CmContactHasItem'][_0xf29a('0x4d')](_0x3e22e6)[_0xf29a('0x27')](handleEntityNotFound(_0x3500ea,null))[_0xf29a('0x27')](respondWithResult(_0x3500ea,null))[_0xf29a('0x49')](handleError(_0x3500ea,null));};exports[_0xf29a('0x4e')]=function(_0x1c40c0,_0x529dc8){return db[_0xf29a('0x32')][_0xf29a('0x4e')](_0x1c40c0['body'],{})[_0xf29a('0x27')](function(_0x476f1b){var _0x29b167=_0x1c40c0[_0xf29a('0x4f')][_0xf29a('0x50')]({'plain':!![]});if(!_0x29b167)throw new Error(_0xf29a('0x51'));if(_0x29b167['role']===_0xf29a('0x4f')){var _0x55c00f=_0x476f1b[_0xf29a('0x50')]({'plain':!![]});var _0x105c20=_0xf29a('0x29');return db[_0xf29a('0x52')][_0xf29a('0x4d')]({'where':{'name':_0x105c20,'userProfileId':_0x29b167['userProfileId']},'raw':!![]})[_0xf29a('0x27')](function(_0x25cc80){if(_0x25cc80&&_0x25cc80['autoAssociation']===0x0){return db['UserProfileResource'][_0xf29a('0x4e')]({'name':_0x55c00f[_0xf29a('0x2e')],'resourceId':_0x55c00f['id'],'type':_0x25cc80['name'],'sectionId':_0x25cc80['id']},{})[_0xf29a('0x27')](function(){return _0x476f1b;});}else{return _0x476f1b;}})[_0xf29a('0x49')](function(_0x46b42c){logger[_0xf29a('0x2c')](_0xf29a('0x53'),_0x46b42c);throw _0x46b42c;});}return _0x476f1b;})['then'](respondWithResult(_0x529dc8,0xc9))[_0xf29a('0x49')](handleError(_0x529dc8,null));};exports[_0xf29a('0x26')]=function(_0x18330c,_0x4ecce8){if(_0x18330c[_0xf29a('0x54')]['id']){delete _0x18330c[_0xf29a('0x54')]['id'];}return db[_0xf29a('0x32')]['find']({'where':{'id':_0x18330c[_0xf29a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ecce8,null))[_0xf29a('0x27')](saveUpdates(_0x18330c[_0xf29a('0x54')],null))[_0xf29a('0x27')](respondWithResult(_0x4ecce8,null))[_0xf29a('0x49')](handleError(_0x4ecce8,null));};exports[_0xf29a('0x28')]=function(_0x7ebb88,_0x2efef7){return db[_0xf29a('0x32')][_0xf29a('0x4d')]({'where':{'id':_0x7ebb88[_0xf29a('0x4b')]['id']}})[_0xf29a('0x27')](handleEntityNotFound(_0x2efef7,null))[_0xf29a('0x27')](removeEntity(_0x2efef7,null))[_0xf29a('0x49')](handleError(_0x2efef7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 8391619..7e51638 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52d1=['request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','moment','bluebird'];(function(_0x2826d9,_0x33059e){var _0x440eca=function(_0x93e748){while(--_0x93e748){_0x2826d9['push'](_0x2826d9['shift']());}};_0x440eca(++_0x33059e);}(_0x52d1,0x193));var _0x152d=function(_0x5d9efd,_0x2adcc4){_0x5d9efd=_0x5d9efd-0x0;var _0x488b00=_0x52d1[_0x5d9efd];return _0x488b00;};'use strict';var _=require(_0x152d('0x0'));var util=require(_0x152d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x152d('0x2'));var BPromise=require(_0x152d('0x3'));var rp=require(_0x152d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x152d('0x5'));var attributes=require(_0x152d('0x6'));module[_0x152d('0x7')]=function(_0x3b0a04,_0x15564d){return _0x3b0a04[_0x152d('0x8')](_0x152d('0x9'),attributes,{'tableName':_0x152d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb648=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x525519,_0x91a8da){var _0x29276a=function(_0x1ea6f5){while(--_0x1ea6f5){_0x525519['push'](_0x525519['shift']());}};_0x29276a(++_0x91a8da);}(_0xb648,0x140));var _0x8b64=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0xb648[_0x2f57b2];return _0x5ace77;};'use strict';var _=require(_0x8b64('0x0'));var util=require(_0x8b64('0x1'));var logger=require(_0x8b64('0x2'))(_0x8b64('0x3'));var moment=require(_0x8b64('0x4'));var BPromise=require('bluebird');var rp=require(_0x8b64('0x5'));var fs=require('fs');var path=require(_0x8b64('0x6'));var rimraf=require(_0x8b64('0x7'));var config=require(_0x8b64('0x8'));var attributes=require(_0x8b64('0x9'));module[_0x8b64('0xa')]=function(_0x58f21b,_0x5dc441){return _0x58f21b[_0x8b64('0xb')](_0x8b64('0xc'),attributes,{'tableName':_0x8b64('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6f3c266..06bbb56 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef5=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3d235c,_0xa18dd1){var _0x56ae19=function(_0x13e842){while(--_0x13e842){_0x3d235c['push'](_0x3d235c['shift']());}};_0x56ae19(++_0xa18dd1);}(_0x2ef5,0x9b));var _0x52ef=function(_0x334a89,_0x198192){_0x334a89=_0x334a89-0x0;var _0x4665d9=_0x2ef5[_0x334a89];return _0x4665d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52ef('0x0'));var BPromise=require(_0x52ef('0x1'));var rs=require(_0x52ef('0x2'));var fs=require('fs');var Redis=require(_0x52ef('0x3'));var db=require(_0x52ef('0x4'))['db'];var utils=require(_0x52ef('0x5'));var logger=require(_0x52ef('0x6'))(_0x52ef('0x7'));var config=require(_0x52ef('0x8'));var jayson=require(_0x52ef('0x9'));var client=jayson['client'][_0x52ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2020b7,_0xb36fe0,_0x33df60){return new BPromise(function(_0x161410,_0x5cd98d){return client[_0x52ef('0xb')](_0x2020b7,_0x33df60)['then'](function(_0x6b7939){logger[_0x52ef('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0xb36fe0,'request\x20sent');logger[_0x52ef('0xd')](_0x52ef('0xe'),_0xb36fe0,_0x52ef('0xf'),JSON[_0x52ef('0x10')](_0x6b7939));if(_0x6b7939[_0x52ef('0x11')]){if(_0x6b7939[_0x52ef('0x11')][_0x52ef('0x12')]===0x1f4){logger[_0x52ef('0x11')](_0x52ef('0x13'),_0xb36fe0,_0x6b7939[_0x52ef('0x11')][_0x52ef('0x14')]);return _0x5cd98d(_0x6b7939[_0x52ef('0x11')][_0x52ef('0x14')]);}logger['error'](_0x52ef('0x13'),_0xb36fe0,_0x6b7939[_0x52ef('0x11')]['message']);return _0x161410(_0x6b7939['error'][_0x52ef('0x14')]);}else{logger['info'](_0x52ef('0x13'),_0xb36fe0,_0x52ef('0xf'));_0x161410(_0x6b7939[_0x52ef('0x15')][_0x52ef('0x14')]);}})[_0x52ef('0x16')](function(_0x403ff3){logger[_0x52ef('0x11')](_0x52ef('0x13'),_0xb36fe0,_0x403ff3);_0x5cd98d(_0x403ff3);});});} \ No newline at end of file +var _0x8f20=['jayson/promise','http','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x39f5c7,_0x392fdf){var _0x182793=function(_0x3e09c6){while(--_0x3e09c6){_0x39f5c7['push'](_0x39f5c7['shift']());}};_0x182793(++_0x392fdf);}(_0x8f20,0x1b0));var _0x08f2=function(_0x299e1e,_0x20eab5){_0x299e1e=_0x299e1e-0x0;var _0x3757dc=_0x8f20[_0x299e1e];return _0x3757dc;};'use strict';var _=require(_0x08f2('0x0'));var util=require('util');var moment=require(_0x08f2('0x1'));var BPromise=require(_0x08f2('0x2'));var rs=require(_0x08f2('0x3'));var fs=require('fs');var Redis=require(_0x08f2('0x4'));var db=require(_0x08f2('0x5'))['db'];var utils=require(_0x08f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x08f2('0x7'));var jayson=require(_0x08f2('0x8'));var client=jayson['client'][_0x08f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e5951,_0x1543c8,_0x32cd9e){return new BPromise(function(_0x4329fd,_0x47a405){return client['request'](_0x3e5951,_0x32cd9e)['then'](function(_0x4093f6){logger['info'](_0x08f2('0xa'),_0x1543c8,_0x08f2('0xb'));logger[_0x08f2('0xc')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x1543c8,_0x08f2('0xb'),JSON[_0x08f2('0xd')](_0x4093f6));if(_0x4093f6['error']){if(_0x4093f6[_0x08f2('0xe')][_0x08f2('0xf')]===0x1f4){logger['error'](_0x08f2('0xa'),_0x1543c8,_0x4093f6[_0x08f2('0xe')]['message']);return _0x47a405(_0x4093f6[_0x08f2('0xe')][_0x08f2('0x10')]);}logger[_0x08f2('0xe')](_0x08f2('0xa'),_0x1543c8,_0x4093f6['error'][_0x08f2('0x10')]);return _0x4329fd(_0x4093f6[_0x08f2('0xe')]['message']);}else{logger[_0x08f2('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x1543c8,_0x08f2('0xb'));_0x4329fd(_0x4093f6[_0x08f2('0x12')][_0x08f2('0x10')]);}})[_0x08f2('0x13')](function(_0x282f85){logger[_0x08f2('0xe')](_0x08f2('0xa'),_0x1543c8,_0x282f85);_0x47a405(_0x282f85);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index e1a9069..884dd63 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1b8=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy'];(function(_0x226e1d,_0x150a35){var _0x2eee4b=function(_0x36a75e){while(--_0x36a75e){_0x226e1d['push'](_0x226e1d['shift']());}};_0x2eee4b(++_0x150a35);}(_0xe1b8,0x110));var _0x8e1b=function(_0x17bbc8,_0x3c9663){_0x17bbc8=_0x17bbc8-0x0;var _0x58723e=_0xe1b8[_0x17bbc8];return _0x58723e;};'use strict';var multer=require(_0x8e1b('0x0'));var util=require(_0x8e1b('0x1'));var path=require(_0x8e1b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e1b('0x3'));var router=express[_0x8e1b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e1b('0x5'));var interaction=require(_0x8e1b('0x6'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8e1b('0x7')](_0x8e1b('0x8'),auth['isAuthenticated'](),controller[_0x8e1b('0x9')]);router[_0x8e1b('0xa')]('/',auth[_0x8e1b('0xb')](),controller[_0x8e1b('0xc')]);router[_0x8e1b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8e1b('0xe')]);router[_0x8e1b('0xf')](_0x8e1b('0x8'),auth[_0x8e1b('0xb')](),controller[_0x8e1b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x40fb=['post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x40fb,0xb1));var _0xb40f=function(_0x4df17c,_0x2d2b61){_0x4df17c=_0x4df17c-0x0;var _0x4e79b5=_0x40fb[_0x4df17c];return _0x4e79b5;};'use strict';var multer=require(_0xb40f('0x0'));var util=require(_0xb40f('0x1'));var path=require('path');var timeout=require(_0xb40f('0x2'));var express=require(_0xb40f('0x3'));var router=express[_0xb40f('0x4')]();var fs_extra=require(_0xb40f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb40f('0x6'));var config=require('../../config/environment');var controller=require(_0xb40f('0x7'));router[_0xb40f('0x8')]('/',auth[_0xb40f('0x9')](),controller[_0xb40f('0xa')]);router[_0xb40f('0x8')](_0xb40f('0xb'),auth[_0xb40f('0x9')](),controller[_0xb40f('0xc')]);router[_0xb40f('0xd')]('/',auth['isAuthenticated'](),controller[_0xb40f('0xe')]);router['put'](_0xb40f('0xb'),auth[_0xb40f('0x9')](),controller[_0xb40f('0xf')]);router[_0xb40f('0x10')]('/:id',auth[_0xb40f('0x9')](),controller[_0xb40f('0x11')]);module[_0xb40f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index b435b0e..c30b9cc 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 _0xd31c=['alias','name','long','select','parse','values','setDataValue','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x3bdd7a,_0x533977){var _0x78e7b=function(_0x22aaa8){while(--_0x22aaa8){_0x3bdd7a['push'](_0x3bdd7a['shift']());}};_0x78e7b(++_0x533977);}(_0xd31c,0xb1));var _0xcd31=function(_0x2fa021,_0x122a26){_0x2fa021=_0x2fa021-0x0;var _0x585f7d=_0xd31c[_0x2fa021];return _0x585f7d;};'use strict';var Sequelize=require(_0xcd31('0x0'));var _=require(_0xcd31('0x1'));module[_0xcd31('0x2')]={'name':{'type':Sequelize[_0xcd31('0x3')],'get':function(_0x27e667){return this[_0xcd31('0x4')](_0xcd31('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x49c9af){this['setDataValue'](_0xcd31('0x5'),_0x49c9af?_0x49c9af:this[_0xcd31('0x4')](_0xcd31('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xcd31('0x7')),'get':function(){if(this[_0xcd31('0x4')]('type')===_0xcd31('0x8')){return JSON[_0xcd31('0x9')](this[_0xcd31('0x4')](_0xcd31('0xa')));}else{return this[_0xcd31('0x4')](_0xcd31('0xa'));}},'set':function(_0x336b67){if(Array['isArray'](_0x336b67)){this[_0xcd31('0xb')]('values',JSON[_0xcd31('0xc')](_0x336b67));}else{this[_0xcd31('0xb')]('values',_0x336b67);}}},'required':{'type':Sequelize[_0xcd31('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x05be=['alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x42fae4,_0x28954e){var _0x4f6ba5=function(_0x478b2f){while(--_0x478b2f){_0x42fae4['push'](_0x42fae4['shift']());}};_0x4f6ba5(++_0x28954e);}(_0x05be,0x14f));var _0xe05b=function(_0x45ecbe,_0x2324d0){_0x45ecbe=_0x45ecbe-0x0;var _0x162c6a=_0x05be[_0x45ecbe];return _0x162c6a;};'use strict';var Sequelize=require(_0xe05b('0x0'));var _=require(_0xe05b('0x1'));module[_0xe05b('0x2')]={'name':{'type':Sequelize[_0xe05b('0x3')],'get':function(_0x4ec92f){return this[_0xe05b('0x4')](_0xe05b('0x5'));}},'alias':{'type':Sequelize[_0xe05b('0x6')],'allowNull':![],'set':function(_0x29a97b){this[_0xe05b('0x7')](_0xe05b('0x5'),_0x29a97b?_0x29a97b:this[_0xe05b('0x4')](_0xe05b('0x8')));}},'type':{'type':Sequelize[_0xe05b('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xe05b('0x9')](_0xe05b('0xa')),'get':function(){if(this[_0xe05b('0x4')](_0xe05b('0xb'))===_0xe05b('0xc')){return JSON[_0xe05b('0xd')](this[_0xe05b('0x4')](_0xe05b('0xe')));}else{return this[_0xe05b('0x4')]('values');}},'set':function(_0x4eb38f){if(Array[_0xe05b('0xf')](_0x4eb38f)){this[_0xe05b('0x7')](_0xe05b('0xe'),JSON[_0xe05b('0x10')](_0x4eb38f));}else{this[_0xe05b('0x7')](_0xe05b('0xe'),_0x4eb38f);}}},'required':{'type':Sequelize[_0xe05b('0x11')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe05b('0x11')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe05b('0x12')](_0xe05b('0x13'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 4a2e68e..9ea6d27 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 _0x5315=['../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','end','error','name','send','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','body','destroy','sequelize','transaction','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5315,0x14a));var _0x5531=function(_0x575bd0,_0x37f9ad){_0x575bd0=_0x575bd0-0x0;var _0x4c9e5c=_0x5315[_0x575bd0];return _0x4c9e5c;};'use strict';var emlformat=require(_0x5531('0x0'));var rimraf=require(_0x5531('0x1'));var zipdir=require(_0x5531('0x2'));var jsonpatch=require(_0x5531('0x3'));var rp=require(_0x5531('0x4'));var moment=require(_0x5531('0x5'));var BPromise=require(_0x5531('0x6'));var Mustache=require(_0x5531('0x7'));var util=require(_0x5531('0x8'));var path=require(_0x5531('0x9'));var sox=require(_0x5531('0xa'));var csv=require(_0x5531('0xb'));var ejs=require(_0x5531('0xc'));var fs=require('fs');var fs_extra=require(_0x5531('0xd'));var _=require(_0x5531('0xe'));var squel=require(_0x5531('0xf'));var crypto=require(_0x5531('0x10'));var jsforce=require(_0x5531('0x11'));var deskjs=require(_0x5531('0x12'));var toCsv=require('to-csv');var querystring=require(_0x5531('0x13'));var Papa=require(_0x5531('0x14'));var Redis=require('ioredis');var authService=require(_0x5531('0x15'));var qs=require(_0x5531('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5531('0x17'));var logger=require('../../config/logger')(_0x5531('0x18'));var utils=require(_0x5531('0x19'));var config=require(_0x5531('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c12b4,_0xb4fe93){_0xb4fe93=_0xb4fe93||0xcc;return function(_0x2736ee){if(_0x2736ee){return _0x3c12b4[_0x5531('0x1b')](_0xb4fe93);}return _0x3c12b4[_0x5531('0x1c')](_0xb4fe93)['end']();};}function respondWithResult(_0x5ceef7,_0xa44625){_0xa44625=_0xa44625||0xc8;return function(_0x5bc9d4){if(_0x5bc9d4){return _0x5ceef7[_0x5531('0x1c')](_0xa44625)['json'](_0x5bc9d4);}};}function respondWithFilteredResult(_0x4362a1,_0x166567){return function(_0x1999d6){if(_0x1999d6){var _0x2c128f=typeof _0x166567[_0x5531('0x1d')]===_0x5531('0x1e')&&typeof _0x166567[_0x5531('0x1f')]==='undefined';var _0x3ea2c3=_0x1999d6[_0x5531('0x20')];var _0x2db502=_0x2c128f?0x0:_0x166567['offset'];var _0x40fce2=_0x2c128f?_0x1999d6['count']:_0x166567[_0x5531('0x1d')]+_0x166567[_0x5531('0x1f')];var _0x5cadbf;if(_0x40fce2>=_0x3ea2c3){_0x40fce2=_0x3ea2c3;_0x5cadbf=0xc8;}else{_0x5cadbf=0xce;}_0x4362a1[_0x5531('0x1c')](_0x5cadbf);return _0x4362a1[_0x5531('0x21')](_0x5531('0x22'),_0x2db502+'-'+_0x40fce2+'/'+_0x3ea2c3)[_0x5531('0x23')](_0x1999d6);}return null;};}function patchUpdates(_0x3103d5){return function(_0x140468){try{jsonpatch['apply'](_0x140468,_0x3103d5,!![]);}catch(_0x13e351){return BPromise[_0x5531('0x24')](_0x13e351);}return _0x140468[_0x5531('0x25')]();};}function saveUpdates(_0x78fff3,_0x5c535b){return function(_0x223deb){if(_0x223deb){return _0x223deb[_0x5531('0x26')](_0x78fff3)[_0x5531('0x27')](function(_0x4a97a3){return _0x4a97a3;});}return null;};}function removeEntity(_0x1e69e2,_0x3cf0fd){return function(_0xe51bc4){if(_0xe51bc4){return _0xe51bc4['destroy']()[_0x5531('0x27')](function(){_0x1e69e2[_0x5531('0x1c')](0xcc)[_0x5531('0x28')]();});}};}function handleEntityNotFound(_0x459cc6,_0x31d344){return function(_0x145213){if(!_0x145213){_0x459cc6[_0x5531('0x1b')](0x194);}return _0x145213;};}function handleError(_0x2e9f60,_0x176ee4){_0x176ee4=_0x176ee4||0x1f4;return function(_0x49a9f7){logger[_0x5531('0x29')](_0x49a9f7['stack']);if(_0x49a9f7[_0x5531('0x2a')]){delete _0x49a9f7[_0x5531('0x2a')];}_0x2e9f60[_0x5531('0x1c')](_0x176ee4)[_0x5531('0x2b')](_0x49a9f7);};}exports[_0x5531('0x2c')]=function(_0x1e37de,_0x1653b9){var _0x48c0e9={},_0x2645d2={},_0x3111d2={'count':0x0,'rows':[]};var _0xd65b26=_['map'](db[_0x5531('0x2d')][_0x5531('0x2e')],function(_0x188def){return{'name':_0x188def[_0x5531('0x2f')],'type':_0x188def[_0x5531('0x30')][_0x5531('0x31')]};});_0x2645d2[_0x5531('0x32')]=_[_0x5531('0x33')](_[_0x5531('0x34')](_0xd65b26,_0x5531('0x2a')),['name']);_0x2645d2[_0x5531('0x35')]=_[_0x5531('0x36')](_0x1e37de['query']);_0x2645d2[_0x5531('0x37')]=_[_0x5531('0x38')](_0x2645d2[_0x5531('0x32')],_0x2645d2[_0x5531('0x35')]);_0x48c0e9[_0x5531('0x39')]=_[_0x5531('0x38')](_0x2645d2[_0x5531('0x32')],qs['fields'](_0x1e37de[_0x5531('0x35')]['fields']));_0x48c0e9['attributes']=_0x48c0e9[_0x5531('0x39')]['length']?_0x48c0e9[_0x5531('0x39')]:_0x2645d2[_0x5531('0x32')];if(!_0x1e37de[_0x5531('0x35')][_0x5531('0x3a')]('nolimit')){_0x48c0e9['limit']=qs[_0x5531('0x1f')](_0x1e37de[_0x5531('0x35')]['limit']);_0x48c0e9['offset']=qs[_0x5531('0x1d')](_0x1e37de[_0x5531('0x35')][_0x5531('0x1d')]);}_0x48c0e9[_0x5531('0x3b')]=qs[_0x5531('0x3c')](_0x1e37de[_0x5531('0x35')][_0x5531('0x3c')]);_0x48c0e9[_0x5531('0x3d')]=qs[_0x5531('0x37')](_['pick'](_0x1e37de['query'],_0x2645d2[_0x5531('0x37')]),_0xd65b26);if(_0x1e37de[_0x5531('0x35')][_0x5531('0x3e')]){_0x48c0e9['where']=_[_0x5531('0x3f')](_0x48c0e9['where'],{'$or':_['map'](_0xd65b26,function(_0x468e4a){if(_0x468e4a[_0x5531('0x30')]!==_0x5531('0x40')){var _0x5d09={};_0x5d09[_0x468e4a[_0x5531('0x2a')]]={'$like':'%'+_0x1e37de[_0x5531('0x35')]['filter']+'%'};return _0x5d09;}})});}_0x48c0e9=_[_0x5531('0x3f')]({},_0x48c0e9,_0x1e37de['options']);var _0x697b6e={'where':_0x48c0e9[_0x5531('0x3d')]};return db[_0x5531('0x2d')][_0x5531('0x20')](_0x697b6e)[_0x5531('0x27')](function(_0x550ab3){_0x3111d2[_0x5531('0x20')]=_0x550ab3;if(_0x1e37de[_0x5531('0x35')][_0x5531('0x41')]){_0x48c0e9[_0x5531('0x42')]=[{'all':!![]}];}return db[_0x5531('0x2d')][_0x5531('0x43')](_0x48c0e9);})[_0x5531('0x27')](function(_0x63c671){_0x3111d2[_0x5531('0x44')]=_0x63c671;return _0x3111d2;})[_0x5531('0x27')](respondWithFilteredResult(_0x1653b9,_0x48c0e9))[_0x5531('0x45')](handleError(_0x1653b9,null));};exports['show']=function(_0x5db831,_0x343d97){var _0xb8864a={'raw':!![],'where':{'id':_0x5db831[_0x5531('0x46')]['id']}},_0x46d9c9={};_0x46d9c9[_0x5531('0x32')]=_[_0x5531('0x36')](db[_0x5531('0x2d')]['rawAttributes']);_0x46d9c9[_0x5531('0x35')]=_[_0x5531('0x36')](_0x5db831['query']);_0x46d9c9['filters']=_['intersection'](_0x46d9c9[_0x5531('0x32')],_0x46d9c9[_0x5531('0x35')]);_0xb8864a[_0x5531('0x39')]=_[_0x5531('0x38')](_0x46d9c9[_0x5531('0x32')],qs[_0x5531('0x47')](_0x5db831['query'][_0x5531('0x47')]));_0xb8864a['attributes']=_0xb8864a[_0x5531('0x39')]['length']?_0xb8864a['attributes']:_0x46d9c9['model'];if(_0x5db831[_0x5531('0x35')][_0x5531('0x41')]){_0xb8864a[_0x5531('0x42')]=[{'all':!![]}];}_0xb8864a=_[_0x5531('0x3f')]({},_0xb8864a,_0x5db831[_0x5531('0x48')]);return db[_0x5531('0x2d')][_0x5531('0x49')](_0xb8864a)[_0x5531('0x27')](handleEntityNotFound(_0x343d97,null))[_0x5531('0x27')](respondWithResult(_0x343d97,null))['catch'](handleError(_0x343d97,null));};exports[_0x5531('0x26')]=function(_0x1b9bbc,_0x1b1f0b){if(_0x1b9bbc[_0x5531('0x4a')]['id']){delete _0x1b9bbc[_0x5531('0x4a')]['id'];}return db[_0x5531('0x2d')][_0x5531('0x49')]({'where':{'id':_0x1b9bbc[_0x5531('0x46')]['id']}})[_0x5531('0x27')](handleEntityNotFound(_0x1b1f0b,null))[_0x5531('0x27')](saveUpdates(_0x1b9bbc[_0x5531('0x4a')],null))[_0x5531('0x27')](respondWithResult(_0x1b1f0b,null))[_0x5531('0x45')](handleError(_0x1b1f0b,null));};exports[_0x5531('0x4b')]=function(_0x413d17,_0xf6baab){return db[_0x5531('0x2d')][_0x5531('0x49')]({'where':{'id':_0x413d17[_0x5531('0x46')]['id']}})[_0x5531('0x27')](handleEntityNotFound(_0xf6baab,null))[_0x5531('0x27')](removeEntity(_0xf6baab,null))['catch'](handleError(_0xf6baab,null));};exports['create']=function(_0x3c5d88,_0x2ee823){var _0x4a63c8;return db[_0x5531('0x4c')][_0x5531('0x4d')](function(_0x16fd6f){return db[_0x5531('0x2d')]['create'](_0x3c5d88[_0x5531('0x4a')],{'transaction':_0x16fd6f})['then'](function(_0x1ab43d){_0x4a63c8=_0x1ab43d;var _0x5219d4={'type':db['Sequelize']['TEXT'],'transaction':_0x16fd6f};switch(_0x3c5d88[_0x5531('0x4a')][_0x5531('0x30')]){case _0x5531('0x4e'):_0x5219d4['type']=db[_0x5531('0x4f')]['TEXT'];break;case _0x5531('0x50'):_0x5219d4['type']=db['Sequelize']['INTEGER'];break;case _0x5531('0x51'):_0x5219d4[_0x5531('0x30')]=db[_0x5531('0x4f')][_0x5531('0x52')];_0x5219d4[_0x5531('0x53')]=![];break;default:}return db['sequelize'][_0x5531('0x54')][_0x5531('0x55')](_0x5531('0x56'),util[_0x5531('0x57')](_0x5531('0x58'),_0x4a63c8['id']),_0x5219d4);})['then'](function(){return _0x4a63c8;});})[_0x5531('0x27')](respondWithResult(_0x2ee823,0xc9))[_0x5531('0x45')](handleError(_0x2ee823,null));}; \ No newline at end of file +var _0x56d1=['rows','catch','show','params','includeAll','body','find','create','sequelize','TEXT','Sequelize','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll'];(function(_0x514e4c,_0x57af85){var _0xdeb7ad=function(_0x3cbaef){while(--_0x3cbaef){_0x514e4c['push'](_0x514e4c['shift']());}};_0xdeb7ad(++_0x57af85);}(_0x56d1,0x1d8));var _0x156d=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x56d1[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require(_0x156d('0x0'));var rimraf=require(_0x156d('0x1'));var zipdir=require(_0x156d('0x2'));var jsonpatch=require(_0x156d('0x3'));var rp=require(_0x156d('0x4'));var moment=require(_0x156d('0x5'));var BPromise=require(_0x156d('0x6'));var Mustache=require('mustache');var util=require(_0x156d('0x7'));var path=require(_0x156d('0x8'));var sox=require(_0x156d('0x9'));var csv=require('to-csv');var ejs=require(_0x156d('0xa'));var fs=require('fs');var fs_extra=require(_0x156d('0xb'));var _=require('lodash');var squel=require(_0x156d('0xc'));var crypto=require(_0x156d('0xd'));var jsforce=require(_0x156d('0xe'));var deskjs=require(_0x156d('0xf'));var toCsv=require(_0x156d('0x10'));var querystring=require(_0x156d('0x11'));var Papa=require(_0x156d('0x12'));var Redis=require(_0x156d('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x156d('0x14'));var hardwareService=require(_0x156d('0x15'));var logger=require('../../config/logger')(_0x156d('0x16'));var utils=require(_0x156d('0x17'));var config=require(_0x156d('0x18'));var licenseUtil=require(_0x156d('0x19'));var db=require(_0x156d('0x1a'))['db'];function respondWithStatusCode(_0x4d5475,_0x58a63c){_0x58a63c=_0x58a63c||0xcc;return function(_0x19be61){if(_0x19be61){return _0x4d5475[_0x156d('0x1b')](_0x58a63c);}return _0x4d5475['status'](_0x58a63c)[_0x156d('0x1c')]();};}function respondWithResult(_0x368ba6,_0x4da2a8){_0x4da2a8=_0x4da2a8||0xc8;return function(_0xaafb10){if(_0xaafb10){return _0x368ba6[_0x156d('0x1d')](_0x4da2a8)[_0x156d('0x1e')](_0xaafb10);}};}function respondWithFilteredResult(_0x47e3ee,_0x365a19){return function(_0x40cc21){if(_0x40cc21){var _0x59e569=typeof _0x365a19[_0x156d('0x1f')]===_0x156d('0x20')&&typeof _0x365a19[_0x156d('0x21')]==='undefined';var _0x5a7390=_0x40cc21['count'];var _0x3cf6b5=_0x59e569?0x0:_0x365a19[_0x156d('0x1f')];var _0x54bab8=_0x59e569?_0x40cc21[_0x156d('0x22')]:_0x365a19['offset']+_0x365a19['limit'];var _0x3b4918;if(_0x54bab8>=_0x5a7390){_0x54bab8=_0x5a7390;_0x3b4918=0xc8;}else{_0x3b4918=0xce;}_0x47e3ee[_0x156d('0x1d')](_0x3b4918);return _0x47e3ee[_0x156d('0x23')](_0x156d('0x24'),_0x3cf6b5+'-'+_0x54bab8+'/'+_0x5a7390)[_0x156d('0x1e')](_0x40cc21);}return null;};}function patchUpdates(_0x11c0b8){return function(_0x2ec8de){try{jsonpatch[_0x156d('0x25')](_0x2ec8de,_0x11c0b8,!![]);}catch(_0x1eef87){return BPromise['reject'](_0x1eef87);}return _0x2ec8de[_0x156d('0x26')]();};}function saveUpdates(_0x36ca0f,_0x49d53d){return function(_0xc8954){if(_0xc8954){return _0xc8954[_0x156d('0x27')](_0x36ca0f)['then'](function(_0x4a1f52){return _0x4a1f52;});}return null;};}function removeEntity(_0x5d1e93,_0xb083b4){return function(_0x5635a4){if(_0x5635a4){return _0x5635a4[_0x156d('0x28')]()[_0x156d('0x29')](function(){_0x5d1e93[_0x156d('0x1d')](0xcc)[_0x156d('0x1c')]();});}};}function handleEntityNotFound(_0x89b9c3,_0x378c57){return function(_0x282f5b){if(!_0x282f5b){_0x89b9c3['sendStatus'](0x194);}return _0x282f5b;};}function handleError(_0x3fa09a,_0x2ffe34){_0x2ffe34=_0x2ffe34||0x1f4;return function(_0x30d962){logger[_0x156d('0x2a')](_0x30d962[_0x156d('0x2b')]);if(_0x30d962[_0x156d('0x2c')]){delete _0x30d962['name'];}_0x3fa09a[_0x156d('0x1d')](_0x2ffe34)[_0x156d('0x2d')](_0x30d962);};}exports[_0x156d('0x2e')]=function(_0x108841,_0x210391){var _0x536695={},_0x150fba={},_0x25fc2c={'count':0x0,'rows':[]};var _0x49aee5=_[_0x156d('0x2f')](db[_0x156d('0x30')][_0x156d('0x31')],function(_0x2112f3){return{'name':_0x2112f3[_0x156d('0x32')],'type':_0x2112f3['type'][_0x156d('0x33')]};});_0x150fba[_0x156d('0x34')]=_[_0x156d('0x35')](_['map'](_0x49aee5,_0x156d('0x2c')),[_0x156d('0x2c')]);_0x150fba['query']=_[_0x156d('0x36')](_0x108841[_0x156d('0x37')]);_0x150fba[_0x156d('0x38')]=_[_0x156d('0x39')](_0x150fba[_0x156d('0x34')],_0x150fba['query']);_0x536695['attributes']=_['intersection'](_0x150fba['model'],qs[_0x156d('0x3a')](_0x108841[_0x156d('0x37')][_0x156d('0x3a')]));_0x536695[_0x156d('0x3b')]=_0x536695[_0x156d('0x3b')][_0x156d('0x3c')]?_0x536695[_0x156d('0x3b')]:_0x150fba['model'];if(!_0x108841['query'][_0x156d('0x3d')](_0x156d('0x3e'))){_0x536695[_0x156d('0x21')]=qs[_0x156d('0x21')](_0x108841['query'][_0x156d('0x21')]);_0x536695[_0x156d('0x1f')]=qs[_0x156d('0x1f')](_0x108841[_0x156d('0x37')][_0x156d('0x1f')]);}_0x536695[_0x156d('0x3f')]=qs[_0x156d('0x40')](_0x108841[_0x156d('0x37')]['sort']);_0x536695['where']=qs[_0x156d('0x38')](_[_0x156d('0x41')](_0x108841[_0x156d('0x37')],_0x150fba[_0x156d('0x38')]),_0x49aee5);if(_0x108841[_0x156d('0x37')][_0x156d('0x42')]){_0x536695[_0x156d('0x43')]=_[_0x156d('0x44')](_0x536695[_0x156d('0x43')],{'$or':_[_0x156d('0x2f')](_0x49aee5,function(_0x46ff1f){if(_0x46ff1f[_0x156d('0x45')]!==_0x156d('0x46')){var _0x391aaa={};_0x391aaa[_0x46ff1f[_0x156d('0x2c')]]={'$like':'%'+_0x108841[_0x156d('0x37')]['filter']+'%'};return _0x391aaa;}})});}_0x536695=_['merge']({},_0x536695,_0x108841[_0x156d('0x47')]);var _0x23cfc4={'where':_0x536695[_0x156d('0x43')]};return db['CmCustomField'][_0x156d('0x22')](_0x23cfc4)[_0x156d('0x29')](function(_0x17ed92){_0x25fc2c[_0x156d('0x22')]=_0x17ed92;if(_0x108841['query']['includeAll']){_0x536695[_0x156d('0x48')]=[{'all':!![]}];}return db['CmCustomField'][_0x156d('0x49')](_0x536695);})[_0x156d('0x29')](function(_0xb63f22){_0x25fc2c[_0x156d('0x4a')]=_0xb63f22;return _0x25fc2c;})['then'](respondWithFilteredResult(_0x210391,_0x536695))[_0x156d('0x4b')](handleError(_0x210391,null));};exports[_0x156d('0x4c')]=function(_0x626689,_0x3caea8){var _0x293c62={'raw':!![],'where':{'id':_0x626689[_0x156d('0x4d')]['id']}},_0x16fef7={};_0x16fef7[_0x156d('0x34')]=_['keys'](db[_0x156d('0x30')][_0x156d('0x31')]);_0x16fef7[_0x156d('0x37')]=_[_0x156d('0x36')](_0x626689[_0x156d('0x37')]);_0x16fef7[_0x156d('0x38')]=_['intersection'](_0x16fef7['model'],_0x16fef7[_0x156d('0x37')]);_0x293c62[_0x156d('0x3b')]=_[_0x156d('0x39')](_0x16fef7[_0x156d('0x34')],qs[_0x156d('0x3a')](_0x626689['query'][_0x156d('0x3a')]));_0x293c62[_0x156d('0x3b')]=_0x293c62['attributes'][_0x156d('0x3c')]?_0x293c62[_0x156d('0x3b')]:_0x16fef7[_0x156d('0x34')];if(_0x626689[_0x156d('0x37')][_0x156d('0x4e')]){_0x293c62[_0x156d('0x48')]=[{'all':!![]}];}_0x293c62=_[_0x156d('0x44')]({},_0x293c62,_0x626689[_0x156d('0x47')]);return db['CmCustomField']['find'](_0x293c62)[_0x156d('0x29')](handleEntityNotFound(_0x3caea8,null))[_0x156d('0x29')](respondWithResult(_0x3caea8,null))[_0x156d('0x4b')](handleError(_0x3caea8,null));};exports['update']=function(_0x51da4a,_0x37cd76){if(_0x51da4a[_0x156d('0x4f')]['id']){delete _0x51da4a[_0x156d('0x4f')]['id'];}return db[_0x156d('0x30')][_0x156d('0x50')]({'where':{'id':_0x51da4a['params']['id']}})[_0x156d('0x29')](handleEntityNotFound(_0x37cd76,null))[_0x156d('0x29')](saveUpdates(_0x51da4a[_0x156d('0x4f')],null))[_0x156d('0x29')](respondWithResult(_0x37cd76,null))['catch'](handleError(_0x37cd76,null));};exports[_0x156d('0x28')]=function(_0x21099e,_0x3082ca){return db[_0x156d('0x30')][_0x156d('0x50')]({'where':{'id':_0x21099e[_0x156d('0x4d')]['id']}})[_0x156d('0x29')](handleEntityNotFound(_0x3082ca,null))[_0x156d('0x29')](removeEntity(_0x3082ca,null))[_0x156d('0x4b')](handleError(_0x3082ca,null));};exports[_0x156d('0x51')]=function(_0x10f571,_0x558f9a){var _0x4068c1;return db[_0x156d('0x52')]['transaction'](function(_0x152d33){return db[_0x156d('0x30')][_0x156d('0x51')](_0x10f571['body'],{'transaction':_0x152d33})[_0x156d('0x29')](function(_0xf2c155){_0x4068c1=_0xf2c155;var _0x13df99={'type':db['Sequelize'][_0x156d('0x53')],'transaction':_0x152d33};switch(_0x10f571[_0x156d('0x4f')][_0x156d('0x45')]){case'text':_0x13df99[_0x156d('0x45')]=db[_0x156d('0x54')][_0x156d('0x53')];break;case'number':_0x13df99['type']=db[_0x156d('0x54')][_0x156d('0x55')];break;case'switch':_0x13df99[_0x156d('0x45')]=db[_0x156d('0x54')][_0x156d('0x56')];_0x13df99[_0x156d('0x57')]=![];break;default:}return db[_0x156d('0x52')][_0x156d('0x58')][_0x156d('0x59')]('cm_contacts',util['format'](_0x156d('0x5a'),_0x4068c1['id']),_0x13df99);})[_0x156d('0x29')](function(){return _0x4068c1;});})[_0x156d('0x29')](respondWithResult(_0x558f9a,0xc9))['catch'](handleError(_0x558f9a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 00ffbf0..a7a52f2 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 _0xd66f=['path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment'];(function(_0x2ae5ce,_0x481760){var _0x3ccd3c=function(_0x3b870c){while(--_0x3b870c){_0x2ae5ce['push'](_0x2ae5ce['shift']());}};_0x3ccd3c(++_0x481760);}(_0xd66f,0xf6));var _0xfd66=function(_0x7754ff,_0x3c3bce){_0x7754ff=_0x7754ff-0x0;var _0x385ffd=_0xd66f[_0x7754ff];return _0x385ffd;};'use strict';var _=require(_0xfd66('0x0'));var util=require('util');var logger=require(_0xfd66('0x1'))(_0xfd66('0x2'));var moment=require(_0xfd66('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd66('0x4'));var rimraf=require('rimraf');var config=require(_0xfd66('0x5'));var attributes=require(_0xfd66('0x6'));module['exports']=function(_0x1fd18b,_0x49b6d8){return _0x1fd18b[_0xfd66('0x7')](_0xfd66('0x8'),attributes,{'tableName':_0xfd66('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x399f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment'];(function(_0x1ad12c,_0x5bd618){var _0xb60e0f=function(_0x9fb490){while(--_0x9fb490){_0x1ad12c['push'](_0x1ad12c['shift']());}};_0xb60e0f(++_0x5bd618);}(_0x399f,0x1e5));var _0xf399=function(_0x2b0d29,_0x3e3d2d){_0x2b0d29=_0x2b0d29-0x0;var _0x54b7ce=_0x399f[_0x2b0d29];return _0x54b7ce;};'use strict';var _=require(_0xf399('0x0'));var util=require(_0xf399('0x1'));var logger=require(_0xf399('0x2'))(_0xf399('0x3'));var moment=require(_0xf399('0x4'));var BPromise=require(_0xf399('0x5'));var rp=require(_0xf399('0x6'));var fs=require('fs');var path=require(_0xf399('0x7'));var rimraf=require(_0xf399('0x8'));var config=require(_0xf399('0x9'));var attributes=require(_0xf399('0xa'));module[_0xf399('0xb')]=function(_0x5743ef,_0x43e454){return _0x5743ef['define'](_0xf399('0xc'),attributes,{'tableName':_0xf399('0xd'),'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 a650070..28a92f0 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 _0xb502=['request','info','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b0f97,_0x24ee19){var _0x58a566=function(_0x185ed8){while(--_0x185ed8){_0x4b0f97['push'](_0x4b0f97['shift']());}};_0x58a566(++_0x24ee19);}(_0xb502,0x1ae));var _0x2b50=function(_0x46c0df,_0x216b97){_0x46c0df=_0x46c0df-0x0;var _0x31ad63=_0xb502[_0x46c0df];return _0x31ad63;};'use strict';var _=require(_0x2b50('0x0'));var util=require(_0x2b50('0x1'));var moment=require('moment');var BPromise=require(_0x2b50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b50('0x4'));var logger=require(_0x2b50('0x5'))(_0x2b50('0x6'));var config=require(_0x2b50('0x7'));var jayson=require(_0x2b50('0x8'));var client=jayson[_0x2b50('0x9')][_0x2b50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e143c,_0x353b86,_0x137f50){return new BPromise(function(_0x2a03e0,_0x1ce0d3){return client[_0x2b50('0xb')](_0x2e143c,_0x137f50)['then'](function(_0x3f2519){logger[_0x2b50('0xc')]('CmCustomField,\x20%s,\x20%s',_0x353b86,'request\x20sent');logger[_0x2b50('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x353b86,'request\x20sent',JSON[_0x2b50('0xe')](_0x3f2519));if(_0x3f2519[_0x2b50('0xf')]){if(_0x3f2519[_0x2b50('0xf')][_0x2b50('0x10')]===0x1f4){logger['error'](_0x2b50('0x11'),_0x353b86,_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);return _0x1ce0d3(_0x3f2519[_0x2b50('0xf')]['message']);}logger[_0x2b50('0xf')](_0x2b50('0x11'),_0x353b86,_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);return _0x2a03e0(_0x3f2519[_0x2b50('0xf')][_0x2b50('0x12')]);}else{logger['info'](_0x2b50('0x11'),_0x353b86,_0x2b50('0x13'));_0x2a03e0(_0x3f2519[_0x2b50('0x14')]['message']);}})['catch'](function(_0x2855f5){logger[_0x2b50('0xf')]('CmCustomField,\x20%s,\x20%s',_0x353b86,_0x2855f5);_0x1ce0d3(_0x2855f5);});});} \ No newline at end of file +var _0xea5e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xac0de1,_0x12d3d9){var _0x1c1995=function(_0x3f96e8){while(--_0x3f96e8){_0xac0de1['push'](_0xac0de1['shift']());}};_0x1c1995(++_0x12d3d9);}(_0xea5e,0x1f0));var _0xeea5=function(_0x5bcdcb,_0x2cb82b){_0x5bcdcb=_0x5bcdcb-0x0;var _0x2fe7df=_0xea5e[_0x5bcdcb];return _0x2fe7df;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xeea5('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeea5('0x1'));var db=require(_0xeea5('0x2'))['db'];var utils=require(_0xeea5('0x3'));var logger=require(_0xeea5('0x4'))(_0xeea5('0x5'));var config=require(_0xeea5('0x6'));var jayson=require(_0xeea5('0x7'));var client=jayson['client'][_0xeea5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24b437,_0xe95f54,_0x506f3e){return new BPromise(function(_0x58c680,_0x34fbe8){return client[_0xeea5('0x9')](_0x24b437,_0x506f3e)[_0xeea5('0xa')](function(_0x4fa816){logger[_0xeea5('0xb')](_0xeea5('0xc'),_0xe95f54,_0xeea5('0xd'));logger[_0xeea5('0xe')](_0xeea5('0xf'),_0xe95f54,_0xeea5('0xd'),JSON[_0xeea5('0x10')](_0x4fa816));if(_0x4fa816[_0xeea5('0x11')]){if(_0x4fa816[_0xeea5('0x11')]['code']===0x1f4){logger['error'](_0xeea5('0xc'),_0xe95f54,_0x4fa816[_0xeea5('0x11')][_0xeea5('0x12')]);return _0x34fbe8(_0x4fa816[_0xeea5('0x11')]['message']);}logger['error'](_0xeea5('0xc'),_0xe95f54,_0x4fa816[_0xeea5('0x11')][_0xeea5('0x12')]);return _0x58c680(_0x4fa816[_0xeea5('0x11')]['message']);}else{logger[_0xeea5('0xb')]('CmCustomField,\x20%s,\x20%s',_0xe95f54,_0xeea5('0xd'));_0x58c680(_0x4fa816[_0xeea5('0x13')][_0xeea5('0x12')]);}})['catch'](function(_0x2974fa){logger['error']('CmCustomField,\x20%s,\x20%s',_0xe95f54,_0x2974fa);_0x34fbe8(_0x2974fa);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index feb1b7f..3e2e001 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 _0x624c=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy'];(function(_0x2355eb,_0x3ac32c){var _0x24b059=function(_0x264139){while(--_0x264139){_0x2355eb['push'](_0x2355eb['shift']());}};_0x24b059(++_0x3ac32c);}(_0x624c,0x1ee));var _0xc624=function(_0x9af652,_0x4de743){_0x9af652=_0x9af652-0x0;var _0x2eb16e=_0x624c[_0x9af652];return _0x2eb16e;};'use strict';var multer=require('multer');var util=require(_0xc624('0x0'));var path=require(_0xc624('0x1'));var timeout=require(_0xc624('0x2'));var express=require(_0xc624('0x3'));var router=express[_0xc624('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc624('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc624('0x6'));var controller=require('./cmCustomField.controller');router[_0xc624('0x7')]('/',auth[_0xc624('0x8')](),controller[_0xc624('0x9')]);router[_0xc624('0x7')](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xb')]);router['post']('/',auth[_0xc624('0x8')](),controller[_0xc624('0xc')]);router[_0xc624('0xd')]('/:id',auth[_0xc624('0x8')](),controller[_0xc624('0xe')]);router['delete'](_0xc624('0xa'),auth[_0xc624('0x8')](),controller[_0xc624('0xf')]);module[_0xc624('0x10')]=router; \ No newline at end of file +var _0x0ec6=['put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create'];(function(_0x382ef9,_0xcb6efe){var _0x5121fc=function(_0x1a2faf){while(--_0x1a2faf){_0x382ef9['push'](_0x382ef9['shift']());}};_0x5121fc(++_0xcb6efe);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x40039d,_0xb74f0){_0x40039d=_0x40039d-0x0;var _0x59ccb7=_0x0ec6[_0x40039d];return _0x59ccb7;};'use strict';var multer=require(_0x60ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x60ec('0x1'));var express=require(_0x60ec('0x2'));var router=express[_0x60ec('0x3')]();var fs_extra=require(_0x60ec('0x4'));var auth=require(_0x60ec('0x5'));var interaction=require(_0x60ec('0x6'));var config=require(_0x60ec('0x7'));var controller=require('./cmCustomField.controller');router[_0x60ec('0x8')]('/',auth[_0x60ec('0x9')](),controller[_0x60ec('0xa')]);router[_0x60ec('0x8')]('/:id',auth[_0x60ec('0x9')](),controller['show']);router[_0x60ec('0xb')]('/',auth[_0x60ec('0x9')](),controller[_0x60ec('0xc')]);router[_0x60ec('0xd')](_0x60ec('0xe'),auth[_0x60ec('0x9')](),controller['update']);router['delete'](_0x60ec('0xe'),auth[_0x60ec('0x9')](),controller[_0x60ec('0xf')]);module[_0x60ec('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7487676..0605100 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 _0xe4fe=['exports','STRING','DATE','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','sequelize'];(function(_0x578955,_0x168f8d){var _0xec9286=function(_0x2dd3b5){while(--_0x2dd3b5){_0x578955['push'](_0x578955['shift']());}};_0xec9286(++_0x168f8d);}(_0xe4fe,0x14f));var _0xee4f=function(_0x483017,_0x73092c){_0x483017=_0x483017-0x0;var _0x3cc794=_0xe4fe[_0x483017];return _0x3cc794;};'use strict';var moment=require('moment');var Sequelize=require(_0xee4f('0x0'));module[_0xee4f('0x1')]={'phone':{'type':Sequelize[_0xee4f('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee4f('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee4f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xee4f('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xee4f('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xee4f('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xee4f('0x7')},'ListId':{'type':Sequelize[_0xee4f('0x4')],'unique':_0xee4f('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xee4f('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xee4f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee4f('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xee4f('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xee4f('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xee4f('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x24e1=['UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING'];(function(_0x43f692,_0x3a06d2){var _0x365fd9=function(_0x10c6dc){while(--_0x10c6dc){_0x43f692['push'](_0x43f692['shift']());}};_0x365fd9(++_0x3a06d2);}(_0x24e1,0x136));var _0x124e=function(_0x448431,_0x5256d6){_0x448431=_0x448431-0x0;var _0x37f204=_0x24e1[_0x448431];return _0x37f204;};'use strict';var moment=require(_0x124e('0x0'));var Sequelize=require(_0x124e('0x1'));module[_0x124e('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x124e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x124e('0x4')],'defaultValue':moment()[_0x124e('0x5')](_0x124e('0x6'))},'countbusyretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x124e('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x124e('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x124e('0x4')]},'priority':{'type':Sequelize[_0x124e('0x7')](0x2)[_0x124e('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x124e('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x124e('0x7')],'unique':_0x124e('0xa')},'ListId':{'type':Sequelize[_0x124e('0x7')],'unique':_0x124e('0xa')},'UserId':{'type':Sequelize[_0x124e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x124e('0x7')],'unique':_0x124e('0xa')},'CampaignId':{'type':Sequelize[_0x124e('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x124e('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x124e('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x124e('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0x124e('0x4')],'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 771f2dd..76d1003 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 _0x56e7=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contained','$any','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','direction','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','List','VoiceQueue','dialActive','getPreviewRecall','transaction','CmCompany','Company','CmList','Queue','getOpenContacts','isNumber','json','error','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','undefined','count','offset','limit','set','update','then','sendStatus','stack','name','send'];(function(_0x5d722c,_0x5534e1){var _0x13f2a8=function(_0x417eb2){while(--_0x417eb2){_0x5d722c['push'](_0x5d722c['shift']());}};_0x13f2a8(++_0x5534e1);}(_0x56e7,0x7b));var _0x756e=function(_0x3ec380,_0x4dfdfe){_0x3ec380=_0x3ec380-0x0;var _0xb7210a=_0x56e7[_0x3ec380];return _0xb7210a;};'use strict';var moment=require('moment');var _=require(_0x756e('0x0'));var qs=require(_0x756e('0x1'));var logger=require('../../config/logger')(_0x756e('0x2'));var shared=require(_0x756e('0x3'));var db=require(_0x756e('0x4'))['db'];function respondWithResult(_0xb850c9,_0x11ce5f){_0x11ce5f=_0x11ce5f||0xc8;return function(_0x38546a){if(_0x38546a){return _0xb850c9[_0x756e('0x5')](_0x11ce5f)['json'](_0x38546a);}};}function respondWithFilteredResult(_0x3b3b8f,_0x404189){return function(_0x26519d){if(_0x26519d){var _0xcf58ec=typeof _0x404189['offset']===_0x756e('0x6')&&typeof _0x404189['limit']===_0x756e('0x6');var _0x401181=_0x26519d[_0x756e('0x7')];var _0x4738dc=_0xcf58ec?0x0:_0x404189['offset'];var _0x5d5b90=_0xcf58ec?_0x26519d[_0x756e('0x7')]:_0x404189[_0x756e('0x8')]+_0x404189[_0x756e('0x9')];var _0x4c4d7c;if(_0x5d5b90>=_0x401181){_0x5d5b90=_0x401181;_0x4c4d7c=0xc8;}else{_0x4c4d7c=0xce;}_0x3b3b8f[_0x756e('0x5')](_0x4c4d7c);return _0x3b3b8f[_0x756e('0xa')]('Content-Range',_0x4738dc+'-'+_0x5d5b90+'/'+_0x401181)['json'](_0x26519d);}return null;};}function saveUpdates(_0x1b68ef,_0x569e8f){return function(_0x459237){if(_0x459237){return _0x459237[_0x756e('0xb')](_0x1b68ef)[_0x756e('0xc')](function(_0x136052){return _0x136052;});}return null;};}function handleEntityNotFound(_0x252333,_0x4ae32a){return function(_0x4b3660){if(!_0x4b3660){_0x252333[_0x756e('0xd')](0x194);}return _0x4b3660;};}function handleError(_0x11f37b,_0xccccd4){_0xccccd4=_0xccccd4||0x1f4;return function(_0x59956f){logger['error'](_0x59956f[_0x756e('0xe')]);if(_0x59956f[_0x756e('0xf')]){delete _0x59956f[_0x756e('0xf')];}_0x11f37b[_0x756e('0x5')](_0xccccd4)[_0x756e('0x10')](_0x59956f);};}exports[_0x756e('0x11')]=function(_0x124ac0,_0x1a8614){var _0xb17214={},_0x4da91f={},_0x216ffd={'count':0x0,'rows':[]};var _0x47c3c4=_['map'](db[_0x756e('0x12')][_0x756e('0x13')],function(_0x30bc11){return{'name':_0x30bc11[_0x756e('0x14')],'type':_0x30bc11[_0x756e('0x15')][_0x756e('0x16')]};});_0x4da91f[_0x756e('0x17')]=_[_0x756e('0x18')](_0x47c3c4,_0x756e('0xf'));_0x4da91f[_0x756e('0x19')]=_[_0x756e('0x1a')](_0x124ac0[_0x756e('0x19')]);_0x4da91f[_0x756e('0x1b')]=_[_0x756e('0x1c')](_0x4da91f[_0x756e('0x17')],_0x4da91f[_0x756e('0x19')]);_0x4da91f['filters']=_[_0x756e('0x1d')](_0x4da91f['filters'],[_0x756e('0x1e'),_0x756e('0x1f'),_0x756e('0x20'),_0x756e('0x21'),'$lt',_0x756e('0x22'),_0x756e('0x23'),_0x756e('0x24'),'$not',_0x756e('0x25'),_0x756e('0x26'),_0x756e('0x27'),'$notIn',_0x756e('0x28'),_0x756e('0x29'),'$iLike',_0x756e('0x2a'),_0x756e('0x28'),_0x756e('0x2b'),'$contains',_0x756e('0x2c'),_0x756e('0x2d')]);_0xb17214['attributes']=_[_0x756e('0x1c')](_0x4da91f[_0x756e('0x17')],qs['fields'](_0x124ac0[_0x756e('0x19')][_0x756e('0x2e')]));_0xb17214[_0x756e('0x2f')]=_0xb17214[_0x756e('0x2f')][_0x756e('0x30')]?_0xb17214['attributes']:_0x4da91f[_0x756e('0x17')];if(!_0x124ac0['query']['hasOwnProperty'](_0x756e('0x31'))){_0xb17214['limit']=qs[_0x756e('0x9')](_0x124ac0[_0x756e('0x19')][_0x756e('0x9')]);_0xb17214[_0x756e('0x8')]=qs[_0x756e('0x8')](_0x124ac0[_0x756e('0x19')][_0x756e('0x8')]);}_0xb17214[_0x756e('0x32')]=qs[_0x756e('0x33')](_0x124ac0[_0x756e('0x19')][_0x756e('0x33')]);_0xb17214[_0x756e('0x34')]=qs['filters'](_['pick'](_0x124ac0[_0x756e('0x19')],_0x4da91f[_0x756e('0x1b')]),_0x47c3c4);if(_0x124ac0[_0x756e('0x19')][_0x756e('0x35')]){_0xb17214[_0x756e('0x34')]=_[_0x756e('0x36')](_0xb17214[_0x756e('0x34')],{'$or':_['map'](_0x47c3c4,function(_0x5b2b59){if(_0x5b2b59['type']!==_0x756e('0x37')){var _0xa63bf={};_0xa63bf[_0x5b2b59[_0x756e('0xf')]]={'$like':'%'+_0x124ac0['query'][_0x756e('0x35')]+'%'};return _0xa63bf;}})});}_0xb17214=_[_0x756e('0x36')]({},_0xb17214,_0x124ac0['options']);var _0x3ece0f={'where':_0xb17214[_0x756e('0x34')]};return db[_0x756e('0x12')][_0x756e('0x7')](_0x3ece0f)[_0x756e('0xc')](function(_0x26965c){_0x216ffd[_0x756e('0x7')]=_0x26965c;if(_0x124ac0[_0x756e('0x19')]['includeAll']){_0xb17214[_0x756e('0x38')]=[{'all':!![]}];}return db[_0x756e('0x12')][_0x756e('0x39')](_0xb17214);})[_0x756e('0xc')](function(_0x36b7de){_0x216ffd[_0x756e('0x3a')]=_0x36b7de;return _0x216ffd;})[_0x756e('0xc')](respondWithFilteredResult(_0x1a8614,_0xb17214))[_0x756e('0x3b')](handleError(_0x1a8614,null));};exports[_0x756e('0x3c')]=function(_0x64b70d,_0x5bb3bd){var _0x41a100={'raw':!![],'where':{'id':_0x64b70d['params']['id']}},_0x38274c={};_0x38274c[_0x756e('0x17')]=_[_0x756e('0x1a')](db[_0x756e('0x12')]['rawAttributes']);_0x38274c[_0x756e('0x19')]=_[_0x756e('0x1a')](_0x64b70d[_0x756e('0x19')]);_0x38274c['filters']=_[_0x756e('0x1c')](_0x38274c[_0x756e('0x17')],_0x38274c[_0x756e('0x19')]);_0x41a100[_0x756e('0x2f')]=_[_0x756e('0x1c')](_0x38274c[_0x756e('0x17')],qs['fields'](_0x64b70d[_0x756e('0x19')][_0x756e('0x2e')]));_0x41a100['attributes']=_0x41a100[_0x756e('0x2f')][_0x756e('0x30')]?_0x41a100[_0x756e('0x2f')]:_0x38274c[_0x756e('0x17')];if(_0x64b70d[_0x756e('0x19')][_0x756e('0x3d')]){_0x41a100[_0x756e('0x38')]=[{'all':!![]}];}_0x41a100=_[_0x756e('0x36')]({},_0x41a100,_0x64b70d[_0x756e('0x3e')]);return db['CmHopper'][_0x756e('0x3f')](_0x41a100)['then'](handleEntityNotFound(_0x5bb3bd,null))[_0x756e('0xc')](respondWithResult(_0x5bb3bd,null))[_0x756e('0x3b')](handleError(_0x5bb3bd,null));};exports[_0x756e('0x40')]=function(_0x54248c,_0x3fc697){return db[_0x756e('0x12')][_0x756e('0x40')](_0x54248c['body'],{})['then'](respondWithResult(_0x3fc697,0xc9))[_0x756e('0x3b')](handleError(_0x3fc697,null));};exports[_0x756e('0xb')]=function(_0x5a6d3e,_0x499da2){if(_0x5a6d3e[_0x756e('0x41')]['id']){delete _0x5a6d3e[_0x756e('0x41')]['id'];}return db[_0x756e('0x12')]['find']({'where':{'id':_0x5a6d3e[_0x756e('0x42')]['id']}})['then'](handleEntityNotFound(_0x499da2,null))[_0x756e('0xc')](saveUpdates(_0x5a6d3e[_0x756e('0x41')],null))[_0x756e('0xc')](respondWithResult(_0x499da2,null))['catch'](handleError(_0x499da2,null));};exports[_0x756e('0x43')]=function(_0x5224f2,_0x5064a3){return db[_0x756e('0x12')]['describe']()[_0x756e('0xc')](respondWithResult(_0x5064a3,null))[_0x756e('0x3b')](handleError(_0x5064a3,null));};exports[_0x756e('0x44')]=function(_0x2512d3,_0x95061c){var _0x2fb384;var _0x50b86e=_0x2512d3[_0x756e('0x42')]['id'];return db['CmHopper'][_0x756e('0x3f')]({'where':{'id':_0x2512d3['params']['id']}})[_0x756e('0xc')](handleEntityNotFound(_0x95061c,null))['then'](function(_0x2f08d5){if(_0x2f08d5){return _0x2f08d5['destroy']()[_0x756e('0xc')](function(_0x37ddd0){return _0x37ddd0;});}})[_0x756e('0xc')](function(_0x52c976){_0x2fb384=_0x52c976;if(_0x52c976){if(_0x52c976[_0x756e('0x45')]||_0x52c976[_0x756e('0x46')]){return db[_0x52c976['VoiceQueueId']?'VoiceQueue':_0x756e('0x47')][_0x756e('0x3f')]({'where':{'id':_0x52c976[_0x756e('0x45')]?_0x52c976[_0x756e('0x45')]:_0x52c976[_0x756e('0x46')]},'attributes':['id',_0x756e('0xf')],'raw':!![]});}}})[_0x756e('0xc')](function(_0x9e8559){var _0x33f923={};if(_0x9e8559){_['merge'](_0x33f923,_[_0x756e('0x48')](_0x2fb384[_0x756e('0x49')],[_0x756e('0x4a'),_0x756e('0x4b'),'id']));_0x33f923[_0x756e('0x4c')]=0x15;_0x33f923[_0x756e('0x4d')]=_0x756e('0x4e');_0x33f923[_0x756e('0x4f')]=_0x9e8559['name'];_0x33f923[_0x756e('0x50')]=_0x2512d3[_0x756e('0x51')]['name'];_0x33f923[_0x756e('0x52')]=_0x2512d3['user']['id'];_0x33f923[_0x756e('0x4e')]=!![];_0x33f923[_0x756e('0x53')]=moment()[_0x756e('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x33f923[_0x756e('0x55')]=_0x2fb384[_0x756e('0x56')];_0x33f923[_0x756e('0x57')]=_0x2fb384['VoiceQueueId']?_0x756e('0x58'):'ivr';return db[_0x756e('0x59')][_0x756e('0x3f')]({'where':{'id':_0x33f923[_0x756e('0x5a')]},'attributes':[_0x756e('0x5b'),_0x756e('0x5c')]})[_0x756e('0xc')](function(_0x1f0be1){if(!_[_0x756e('0x5d')](_0x95061c)&&!_['isNil'](_0x1f0be1[_0x756e('0x5b')])){_0x33f923[_0x756e('0x5e')]=_0x1f0be1[_0x756e('0x5b')];if(!_[_0x756e('0x5d')](_0x1f0be1[_0x756e('0x5c')])){_0x33f923[_0x756e('0x5e')]+='\x20'+_0x1f0be1[_0x756e('0x5c')];}}})[_0x756e('0x5f')](function(){return db[_0x756e('0x60')][_0x756e('0x40')](_0x33f923);});}})[_0x756e('0xc')](function(_0x176d84){return db[_0x756e('0x61')][_0x756e('0x44')]({'where':{'CmHopperId':_0x50b86e}});})['then'](function(){return _0x95061c[_0x756e('0x5')](0xcc)[_0x756e('0x62')]();})[_0x756e('0x3b')](handleError(_0x95061c,null));};exports[_0x756e('0x63')]=function(_0x674b74,_0xe91378){var _0x58198e=[];return db[_0x756e('0x59')][_0x756e('0x43')]()[_0x756e('0xc')](function(_0x3c5976){_0x58198e=_['keys'](_0x3c5976);return _0x674b74['user'][_0x756e('0x64')]({'where':{'type':_0x756e('0x65'),'dialActive':!![],'dialMethod':_0x756e('0x66')},'attributes':['id',_0x756e('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x756e('0xc')](function(_0x312715){if(_0x312715&&_0x312715[_0x756e('0x30')]){return db[_0x756e('0x68')]['transaction'](function(_0x5c580b){var _0x207228={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x756e('0x54')](_0x756e('0x69'))},'VoiceQueueId':{'$in':_[_0x756e('0x18')](_0x312715,'id')},'$or':[{'UserId':null},{'UserId':_0x674b74[_0x756e('0x51')]['id']}]};var _0x366dfe={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x312715)[_0x756e('0x35')]([_0x756e('0x6a'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x674b74[_0x756e('0x51')]['id']}]};var _0x86477e={'$or':[_0x207228,_0x366dfe]};var _0x4740ae=[];if(_0x674b74[_0x756e('0x41')][_0x756e('0x6b')]&&_0x674b74[_0x756e('0x41')][_0x756e('0x6b')]==='prev'){if(!_[_0x756e('0x6c')](_0x674b74['body'][_0x756e('0x6d')])){_0x86477e['id']={'$in':_0x674b74['body'][_0x756e('0x6d')]};}_0x4740ae=[[_0x756e('0x6e'),_0x756e('0x6f')],['scheduledAt',_0x312715[0x0][_0x756e('0x67')]===_0x756e('0x6f')?_0x756e('0x70'):_0x756e('0x6f')],db[_0x756e('0x68')][_0x756e('0x71')](_0x756e('0x72')),['id','DESC']];}else{if(!_['isEmpty'](_0x674b74[_0x756e('0x41')][_0x756e('0x6d')])){_0x86477e['id']={'$notIn':_0x674b74[_0x756e('0x41')][_0x756e('0x6d')]};}_0x4740ae=[[_0x756e('0x6e'),_0x756e('0x70')],['scheduledAt',_0x312715[0x0][_0x756e('0x67')]],db[_0x756e('0x68')][_0x756e('0x71')](_0x756e('0x73')),['id',_0x756e('0x6f')]];}return db[_0x756e('0x12')][_0x756e('0x74')]({'attributes':['id',_0x756e('0x75'),'phone',_0x756e('0x76')],'where':_0x86477e,'order':_0x4740ae,'transaction':_0x5c580b,'lock':_0x5c580b[_0x756e('0x77')][_0x756e('0x78')],'include':[{'model':db[_0x756e('0x59')],'as':_0x756e('0x79'),'attributes':_0x58198e,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x756e('0xf')]}]},{'model':db['CmList'],'as':_0x756e('0x7a'),'attributes':['id','name']},{'model':db[_0x756e('0x7b')],'as':'Queue','attributes':['id',_0x756e('0xf'),_0x756e('0x7c')]}]})[_0x756e('0xc')](function(_0x4afbc4){if(_0x4afbc4){return _0x4afbc4[_0x756e('0xb')]({'UserId':_0x674b74['user']['id']},{'transaction':_0x5c580b});}});});}})[_0x756e('0xc')](handleEntityNotFound(_0xe91378,null))[_0x756e('0xc')](respondWithResult(_0xe91378,null))[_0x756e('0x3b')](handleError(_0xe91378,null));};exports[_0x756e('0x7d')]=function(_0x53b551,_0x3b5d8e,_0x38c0c7){var _0x5b087a=[];var _0xe3e3b6=_0x53b551[_0x756e('0x42')]['id'];var _0x5d690a=_0x53b551[_0x756e('0x51')]['id'];return db['CmContact']['describe']()[_0x756e('0xc')](function(_0x50728b){_0x5b087a=_[_0x756e('0x1a')](_0x50728b);return db['sequelize'][_0x756e('0x7e')](function(_0x51a2ec){const _0x4456c0={'id':_0xe3e3b6};return db[_0x756e('0x12')][_0x756e('0x74')]({'attributes':['id',_0x756e('0x75'),_0x756e('0x76')],'where':_0x4456c0,'transaction':_0x51a2ec,'lock':_0x51a2ec[_0x756e('0x77')][_0x756e('0x78')],'include':[{'model':db[_0x756e('0x59')],'as':_0x756e('0x79'),'attributes':_0x5b087a,'include':[{'model':db[_0x756e('0x7f')],'as':_0x756e('0x80'),'attributes':['id',_0x756e('0xf')]}]},{'model':db[_0x756e('0x81')],'as':'List','attributes':['id','name']},{'model':db[_0x756e('0x7b')],'as':_0x756e('0x82'),'attributes':['id',_0x756e('0xf'),_0x756e('0x7c')]}]})[_0x756e('0xc')](function(_0x18df88){if(_0x18df88){return _0x18df88[_0x756e('0xb')]({'UserId':_0x5d690a},{'transaction':_0x51a2ec});}});});})['then'](handleEntityNotFound(_0x3b5d8e,null))[_0x756e('0xc')](respondWithResult(_0x3b5d8e,null))[_0x756e('0x3b')](handleError(_0x3b5d8e,null));};exports[_0x756e('0x83')]=function(_0x421a80,_0xcfaaba){return _0x421a80['user'][_0x756e('0x64')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x756e('0xc')](function(_0x48b8e8){if(_0x48b8e8&&_0x48b8e8[_0x756e('0x30')]){return db[_0x756e('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x756e('0x54')](_0x756e('0x69'))},'VoiceQueueId':{'$in':_[_0x756e('0x18')](_0x48b8e8,'id')},'$or':[{'UserId':null},{'UserId':_0x421a80[_0x756e('0x51')]['id']}]}});}return 0x0;})[_0x756e('0xc')](function(_0x5aeb07){if(!_[_0x756e('0x5d')](_0x5aeb07)&&_[_0x756e('0x84')](_0x5aeb07)){return _0xcfaaba[_0x756e('0x5')](0xc8)[_0x756e('0x85')]({'contacts':_0x5aeb07});}else{logger[_0x756e('0x86')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0xcfaaba[_0x756e('0xd')](0x194);}})['catch'](handleError(_0xcfaaba,null));};exports[_0x756e('0x87')]=function(_0x1e5942,_0x23127a){var _0x4e31a8=shared[_0x756e('0x88')];var _0x5d7bd8=[];_[_0x756e('0x18')](_0x4e31a8,function(_0x59cdd4){_0x5d7bd8[_0x756e('0x89')]({'id':_0x59cdd4[_0x756e('0xf')],'name':_0x59cdd4[_0x756e('0xf')],'utcOffset':_0x59cdd4[_0x756e('0x8a')]});});return _0x23127a[_0x756e('0x5')](0xc8)[_0x756e('0x85')]({'tz':_0x5d7bd8});};exports[_0x756e('0x8b')]=function(_0x3e72d6,_0x3b1b92){var _0x51dc21=shared[_0x756e('0x88')];var _0x3b4d66={};if(!_[_0x756e('0x5d')](_0x51dc21[_0x3e72d6[_0x756e('0x41')]['id']]))_0x3b4d66=_0x51dc21[_0x3e72d6[_0x756e('0x41')]['id']];return _0x3b1b92[_0x756e('0x5')](0xc8)[_0x756e('0x85')](_0x3b4d66);}; \ No newline at end of file +var _0xafdd=['status','json','undefined','limit','count','offset','set','Content-Range','update','then','sendStatus','error','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','intersection','concat','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','firstName','lastName','isNil','CmHopperFinal','CmHopperAdditionalPhone','getPreview','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','hopperIds','priority','ASC','scheduledAt','literal','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','Company','List','Queue','dialActive','getPreviewRecall','UPDATE','CmCompany','CmList','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x59df7f,_0x3deaea){var _0x5977c3=function(_0x86a68e){while(--_0x86a68e){_0x59df7f['push'](_0x59df7f['shift']());}};_0x5977c3(++_0x3deaea);}(_0xafdd,0x19a));var _0xdafd=function(_0x3e2dfc,_0x5454c0){_0x3e2dfc=_0x3e2dfc-0x0;var _0x733b21=_0xafdd[_0x3e2dfc];return _0x733b21;};'use strict';var moment=require(_0xdafd('0x0'));var _=require(_0xdafd('0x1'));var qs=require(_0xdafd('0x2'));var logger=require(_0xdafd('0x3'))(_0xdafd('0x4'));var shared=require(_0xdafd('0x5'));var db=require(_0xdafd('0x6'))['db'];function respondWithResult(_0x2b0752,_0x5624f6){_0x5624f6=_0x5624f6||0xc8;return function(_0x283ab1){if(_0x283ab1){return _0x2b0752[_0xdafd('0x7')](_0x5624f6)[_0xdafd('0x8')](_0x283ab1);}};}function respondWithFilteredResult(_0x37f05a,_0xfa4ad6){return function(_0x57cfee){if(_0x57cfee){var _0x2ed8ea=typeof _0xfa4ad6['offset']===_0xdafd('0x9')&&typeof _0xfa4ad6[_0xdafd('0xa')]===_0xdafd('0x9');var _0x48000b=_0x57cfee[_0xdafd('0xb')];var _0x413d23=_0x2ed8ea?0x0:_0xfa4ad6[_0xdafd('0xc')];var _0x2f3bb3=_0x2ed8ea?_0x57cfee['count']:_0xfa4ad6[_0xdafd('0xc')]+_0xfa4ad6[_0xdafd('0xa')];var _0x3ee1e9;if(_0x2f3bb3>=_0x48000b){_0x2f3bb3=_0x48000b;_0x3ee1e9=0xc8;}else{_0x3ee1e9=0xce;}_0x37f05a[_0xdafd('0x7')](_0x3ee1e9);return _0x37f05a[_0xdafd('0xd')](_0xdafd('0xe'),_0x413d23+'-'+_0x2f3bb3+'/'+_0x48000b)['json'](_0x57cfee);}return null;};}function saveUpdates(_0x166176,_0x594f47){return function(_0x553508){if(_0x553508){return _0x553508[_0xdafd('0xf')](_0x166176)[_0xdafd('0x10')](function(_0x55b05a){return _0x55b05a;});}return null;};}function handleEntityNotFound(_0x43a716,_0x490382){return function(_0x4b09da){if(!_0x4b09da){_0x43a716[_0xdafd('0x11')](0x194);}return _0x4b09da;};}function handleError(_0x14b895,_0x583b1d){_0x583b1d=_0x583b1d||0x1f4;return function(_0x267bfc){logger[_0xdafd('0x12')](_0x267bfc['stack']);if(_0x267bfc[_0xdafd('0x13')]){delete _0x267bfc[_0xdafd('0x13')];}_0x14b895[_0xdafd('0x7')](_0x583b1d)['send'](_0x267bfc);};}exports[_0xdafd('0x14')]=function(_0x15beca,_0x4fc3a4){var _0x4e6ccc={},_0x2569b2={},_0x5acc78={'count':0x0,'rows':[]};var _0x3556da=_[_0xdafd('0x15')](db[_0xdafd('0x16')][_0xdafd('0x17')],function(_0x1c2029){return{'name':_0x1c2029[_0xdafd('0x18')],'type':_0x1c2029[_0xdafd('0x19')][_0xdafd('0x1a')]};});_0x2569b2[_0xdafd('0x1b')]=_[_0xdafd('0x15')](_0x3556da,_0xdafd('0x13'));_0x2569b2[_0xdafd('0x1c')]=_[_0xdafd('0x1d')](_0x15beca[_0xdafd('0x1c')]);_0x2569b2['filters']=_[_0xdafd('0x1e')](_0x2569b2['model'],_0x2569b2[_0xdafd('0x1c')]);_0x2569b2['filters']=_[_0xdafd('0x1f')](_0x2569b2[_0xdafd('0x20')],[_0xdafd('0x21'),_0xdafd('0x22'),_0xdafd('0x23'),_0xdafd('0x24'),_0xdafd('0x25'),_0xdafd('0x26'),_0xdafd('0x27'),'$eq',_0xdafd('0x28'),_0xdafd('0x29'),_0xdafd('0x2a'),_0xdafd('0x2b'),_0xdafd('0x2c'),_0xdafd('0x2d'),_0xdafd('0x2e'),_0xdafd('0x2f'),_0xdafd('0x30'),_0xdafd('0x2d'),'$overlap',_0xdafd('0x31'),_0xdafd('0x32'),_0xdafd('0x33')]);_0x4e6ccc[_0xdafd('0x34')]=_[_0xdafd('0x1e')](_0x2569b2[_0xdafd('0x1b')],qs['fields'](_0x15beca['query']['fields']));_0x4e6ccc[_0xdafd('0x34')]=_0x4e6ccc[_0xdafd('0x34')]['length']?_0x4e6ccc['attributes']:_0x2569b2[_0xdafd('0x1b')];if(!_0x15beca[_0xdafd('0x1c')][_0xdafd('0x35')](_0xdafd('0x36'))){_0x4e6ccc[_0xdafd('0xa')]=qs[_0xdafd('0xa')](_0x15beca[_0xdafd('0x1c')]['limit']);_0x4e6ccc[_0xdafd('0xc')]=qs[_0xdafd('0xc')](_0x15beca[_0xdafd('0x1c')]['offset']);}_0x4e6ccc[_0xdafd('0x37')]=qs[_0xdafd('0x38')](_0x15beca['query'][_0xdafd('0x38')]);_0x4e6ccc[_0xdafd('0x39')]=qs[_0xdafd('0x20')](_['pick'](_0x15beca[_0xdafd('0x1c')],_0x2569b2[_0xdafd('0x20')]),_0x3556da);if(_0x15beca[_0xdafd('0x1c')][_0xdafd('0x3a')]){_0x4e6ccc[_0xdafd('0x39')]=_[_0xdafd('0x3b')](_0x4e6ccc[_0xdafd('0x39')],{'$or':_['map'](_0x3556da,function(_0x3d904a){if(_0x3d904a[_0xdafd('0x19')]!==_0xdafd('0x3c')){var _0x161d15={};_0x161d15[_0x3d904a[_0xdafd('0x13')]]={'$like':'%'+_0x15beca['query'][_0xdafd('0x3a')]+'%'};return _0x161d15;}})});}_0x4e6ccc=_[_0xdafd('0x3b')]({},_0x4e6ccc,_0x15beca['options']);var _0x3dbdb1={'where':_0x4e6ccc[_0xdafd('0x39')]};return db[_0xdafd('0x16')][_0xdafd('0xb')](_0x3dbdb1)[_0xdafd('0x10')](function(_0x1611f0){_0x5acc78[_0xdafd('0xb')]=_0x1611f0;if(_0x15beca[_0xdafd('0x1c')][_0xdafd('0x3d')]){_0x4e6ccc[_0xdafd('0x3e')]=[{'all':!![]}];}return db[_0xdafd('0x16')][_0xdafd('0x3f')](_0x4e6ccc);})[_0xdafd('0x10')](function(_0x3c446d){_0x5acc78[_0xdafd('0x40')]=_0x3c446d;return _0x5acc78;})[_0xdafd('0x10')](respondWithFilteredResult(_0x4fc3a4,_0x4e6ccc))[_0xdafd('0x41')](handleError(_0x4fc3a4,null));};exports[_0xdafd('0x42')]=function(_0x31dd01,_0x1d4be4){var _0x3f25c2={'raw':!![],'where':{'id':_0x31dd01[_0xdafd('0x43')]['id']}},_0x2605d2={};_0x2605d2[_0xdafd('0x1b')]=_[_0xdafd('0x1d')](db[_0xdafd('0x16')]['rawAttributes']);_0x2605d2['query']=_[_0xdafd('0x1d')](_0x31dd01['query']);_0x2605d2[_0xdafd('0x20')]=_[_0xdafd('0x1e')](_0x2605d2['model'],_0x2605d2['query']);_0x3f25c2[_0xdafd('0x34')]=_[_0xdafd('0x1e')](_0x2605d2[_0xdafd('0x1b')],qs[_0xdafd('0x44')](_0x31dd01[_0xdafd('0x1c')][_0xdafd('0x44')]));_0x3f25c2[_0xdafd('0x34')]=_0x3f25c2[_0xdafd('0x34')][_0xdafd('0x45')]?_0x3f25c2['attributes']:_0x2605d2['model'];if(_0x31dd01[_0xdafd('0x1c')][_0xdafd('0x3d')]){_0x3f25c2[_0xdafd('0x3e')]=[{'all':!![]}];}_0x3f25c2=_[_0xdafd('0x3b')]({},_0x3f25c2,_0x31dd01[_0xdafd('0x46')]);return db[_0xdafd('0x16')][_0xdafd('0x47')](_0x3f25c2)[_0xdafd('0x10')](handleEntityNotFound(_0x1d4be4,null))[_0xdafd('0x10')](respondWithResult(_0x1d4be4,null))[_0xdafd('0x41')](handleError(_0x1d4be4,null));};exports[_0xdafd('0x48')]=function(_0x3a9505,_0x2dee16){return db['CmHopper'][_0xdafd('0x48')](_0x3a9505['body'],{})[_0xdafd('0x10')](respondWithResult(_0x2dee16,0xc9))['catch'](handleError(_0x2dee16,null));};exports[_0xdafd('0xf')]=function(_0x4240b1,_0x4464f2){if(_0x4240b1[_0xdafd('0x49')]['id']){delete _0x4240b1[_0xdafd('0x49')]['id'];}return db[_0xdafd('0x16')]['find']({'where':{'id':_0x4240b1[_0xdafd('0x43')]['id']}})[_0xdafd('0x10')](handleEntityNotFound(_0x4464f2,null))[_0xdafd('0x10')](saveUpdates(_0x4240b1[_0xdafd('0x49')],null))[_0xdafd('0x10')](respondWithResult(_0x4464f2,null))['catch'](handleError(_0x4464f2,null));};exports['describe']=function(_0x189d61,_0x44b71a){return db[_0xdafd('0x16')][_0xdafd('0x4a')]()[_0xdafd('0x10')](respondWithResult(_0x44b71a,null))[_0xdafd('0x41')](handleError(_0x44b71a,null));};exports[_0xdafd('0x4b')]=function(_0x2f5e4c,_0x2ae4cd){var _0x5058b1;var _0x6f2f39=_0x2f5e4c[_0xdafd('0x43')]['id'];return db[_0xdafd('0x16')][_0xdafd('0x47')]({'where':{'id':_0x2f5e4c['params']['id']}})[_0xdafd('0x10')](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x10')](function(_0x254824){if(_0x254824){return _0x254824[_0xdafd('0x4b')]()[_0xdafd('0x10')](function(_0x4b6fbb){return _0x4b6fbb;});}})['then'](function(_0xc1dadb){_0x5058b1=_0xc1dadb;if(_0xc1dadb){if(_0xc1dadb[_0xdafd('0x4c')]||_0xc1dadb['CampaignId']){return db[_0xc1dadb['VoiceQueueId']?_0xdafd('0x4d'):_0xdafd('0x4e')]['find']({'where':{'id':_0xc1dadb[_0xdafd('0x4c')]?_0xc1dadb[_0xdafd('0x4c')]:_0xc1dadb[_0xdafd('0x4f')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x2feff8){var _0x38662d={};if(_0x2feff8){_['merge'](_0x38662d,_[_0xdafd('0x50')](_0x5058b1['dataValues'],['createdAt',_0xdafd('0x51'),'id']));_0x38662d[_0xdafd('0x52')]=0x15;_0x38662d[_0xdafd('0x53')]=_0xdafd('0x54');_0x38662d[_0xdafd('0x55')]=_0x2feff8[_0xdafd('0x13')];_0x38662d[_0xdafd('0x56')]=_0x2f5e4c[_0xdafd('0x57')]['name'];_0x38662d[_0xdafd('0x58')]=_0x2f5e4c[_0xdafd('0x57')]['id'];_0x38662d['deleted']=!![];_0x38662d[_0xdafd('0x59')]=moment()[_0xdafd('0x5a')](_0xdafd('0x5b'));_0x38662d[_0xdafd('0x5c')]=_0x5058b1[_0xdafd('0x5d')];_0x38662d['campaigntype']=_0x5058b1[_0xdafd('0x4c')]?_0xdafd('0x5e'):_0xdafd('0x5f');return db[_0xdafd('0x60')][_0xdafd('0x47')]({'where':{'id':_0x38662d['ContactId']},'attributes':[_0xdafd('0x61'),_0xdafd('0x62')]})['then'](function(_0x4f3059){if(!_[_0xdafd('0x63')](_0x2ae4cd)&&!_['isNil'](_0x4f3059[_0xdafd('0x61')])){_0x38662d['calleridname']=_0x4f3059[_0xdafd('0x61')];if(!_[_0xdafd('0x63')](_0x4f3059[_0xdafd('0x62')])){_0x38662d['calleridname']+='\x20'+_0x4f3059[_0xdafd('0x62')];}}})['finally'](function(){return db[_0xdafd('0x64')][_0xdafd('0x48')](_0x38662d);});}})['then'](function(_0xd9231){return db[_0xdafd('0x65')][_0xdafd('0x4b')]({'where':{'CmHopperId':_0x6f2f39}});})[_0xdafd('0x10')](function(){return _0x2ae4cd[_0xdafd('0x7')](0xcc)['end']();})[_0xdafd('0x41')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x66')]=function(_0x4e1714,_0x316699){var _0x46b3fb=[];return db[_0xdafd('0x60')][_0xdafd('0x4a')]()[_0xdafd('0x10')](function(_0x4d0667){_0x46b3fb=_[_0xdafd('0x1d')](_0x4d0667);return _0x4e1714['user']['getVoiceQueues']({'where':{'type':_0xdafd('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xdafd('0x68'),_0xdafd('0x69')],'raw':!![]});})[_0xdafd('0x10')](function(_0x46564e){if(_0x46564e&&_0x46564e['length']){return db[_0xdafd('0x6a')][_0xdafd('0x6b')](function(_0x3f080b){var _0x4049f8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdafd('0x5a')](_0xdafd('0x5b'))},'VoiceQueueId':{'$in':_[_0xdafd('0x15')](_0x46564e,'id')},'$or':[{'UserId':null},{'UserId':_0x4e1714[_0xdafd('0x57')]['id']}]};var _0x3a6bc1={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x46564e)[_0xdafd('0x3a')]([_0xdafd('0x69'),0x0])[_0xdafd('0x15')]('id')[_0xdafd('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x4e1714[_0xdafd('0x57')]['id']}]};var _0x40f9fa={'$or':[_0x4049f8,_0x3a6bc1]};var _0x339c9e=[];if(_0x4e1714[_0xdafd('0x49')]['direction']&&_0x4e1714[_0xdafd('0x49')]['direction']===_0xdafd('0x6d')){if(!_['isEmpty'](_0x4e1714[_0xdafd('0x49')][_0xdafd('0x6e')])){_0x40f9fa['id']={'$in':_0x4e1714['body']['hopperIds']};}_0x339c9e=[[_0xdafd('0x6f'),_0xdafd('0x70')],[_0xdafd('0x71'),_0x46564e[0x0]['dialOrderByScheduledAt']==='ASC'?'DESC':_0xdafd('0x70')],db['sequelize'][_0xdafd('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xdafd('0x73')]];}else{if(!_[_0xdafd('0x74')](_0x4e1714[_0xdafd('0x49')][_0xdafd('0x6e')])){_0x40f9fa['id']={'$notIn':_0x4e1714[_0xdafd('0x49')]['hopperIds']};}_0x339c9e=[['priority',_0xdafd('0x73')],['scheduledAt',_0x46564e[0x0][_0xdafd('0x68')]],db[_0xdafd('0x6a')]['literal'](_0xdafd('0x75')),['id',_0xdafd('0x70')]];}return db[_0xdafd('0x16')][_0xdafd('0x76')]({'attributes':['id',_0xdafd('0x77'),_0xdafd('0x5d'),_0xdafd('0x78')],'where':_0x40f9fa,'order':_0x339c9e,'transaction':_0x3f080b,'lock':_0x3f080b[_0xdafd('0x79')]['UPDATE'],'include':[{'model':db[_0xdafd('0x60')],'as':_0xdafd('0x7a'),'attributes':_0x46b3fb,'include':[{'model':db['CmCompany'],'as':_0xdafd('0x7b'),'attributes':['id',_0xdafd('0x13')]}]},{'model':db['CmList'],'as':_0xdafd('0x7c'),'attributes':['id',_0xdafd('0x13')]},{'model':db['VoiceQueue'],'as':_0xdafd('0x7d'),'attributes':['id',_0xdafd('0x13'),_0xdafd('0x7e')]}]})['then'](function(_0x1a0f40){if(_0x1a0f40){return _0x1a0f40[_0xdafd('0xf')]({'UserId':_0x4e1714[_0xdafd('0x57')]['id']},{'transaction':_0x3f080b});}});});}})[_0xdafd('0x10')](handleEntityNotFound(_0x316699,null))['then'](respondWithResult(_0x316699,null))['catch'](handleError(_0x316699,null));};exports[_0xdafd('0x7f')]=function(_0x1acd79,_0x5e1bef,_0x3bbf21){var _0x3d3862=[];var _0x6f3fec=_0x1acd79[_0xdafd('0x43')]['id'];var _0x221377=_0x1acd79[_0xdafd('0x57')]['id'];return db['CmContact'][_0xdafd('0x4a')]()[_0xdafd('0x10')](function(_0x5a2359){_0x3d3862=_[_0xdafd('0x1d')](_0x5a2359);return db[_0xdafd('0x6a')][_0xdafd('0x6b')](function(_0x4c09eb){const _0xdadb19={'id':_0x6f3fec};return db[_0xdafd('0x16')][_0xdafd('0x76')]({'attributes':['id',_0xdafd('0x77'),_0xdafd('0x78')],'where':_0xdadb19,'transaction':_0x4c09eb,'lock':_0x4c09eb[_0xdafd('0x79')][_0xdafd('0x80')],'include':[{'model':db['CmContact'],'as':_0xdafd('0x7a'),'attributes':_0x3d3862,'include':[{'model':db[_0xdafd('0x81')],'as':_0xdafd('0x7b'),'attributes':['id',_0xdafd('0x13')]}]},{'model':db[_0xdafd('0x82')],'as':_0xdafd('0x7c'),'attributes':['id',_0xdafd('0x13')]},{'model':db[_0xdafd('0x4d')],'as':_0xdafd('0x7d'),'attributes':['id',_0xdafd('0x13'),_0xdafd('0x7e')]}]})['then'](function(_0x174594){if(_0x174594){return _0x174594[_0xdafd('0xf')]({'UserId':_0x221377},{'transaction':_0x4c09eb});}});});})['then'](handleEntityNotFound(_0x5e1bef,null))[_0xdafd('0x10')](respondWithResult(_0x5e1bef,null))[_0xdafd('0x41')](handleError(_0x5e1bef,null));};exports[_0xdafd('0x83')]=function(_0x53e68a,_0x153578){return _0x53e68a['user'][_0xdafd('0x84')]({'where':{'type':_0xdafd('0x67'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xdafd('0x10')](function(_0x1f8091){if(_0x1f8091&&_0x1f8091[_0xdafd('0x45')]){return db[_0xdafd('0x16')][_0xdafd('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xdafd('0x5a')](_0xdafd('0x5b'))},'VoiceQueueId':{'$in':_[_0xdafd('0x15')](_0x1f8091,'id')},'$or':[{'UserId':null},{'UserId':_0x53e68a[_0xdafd('0x57')]['id']}]}});}return 0x0;})[_0xdafd('0x10')](function(_0x37b2eb){if(!_[_0xdafd('0x63')](_0x37b2eb)&&_['isNumber'](_0x37b2eb)){return _0x153578['status'](0xc8)[_0xdafd('0x8')]({'contacts':_0x37b2eb});}else{logger[_0xdafd('0x12')](_0xdafd('0x85'),_0xdafd('0x83'),0x194,_0xdafd('0x86'));_0x153578[_0xdafd('0x11')](0x194);}})[_0xdafd('0x41')](handleError(_0x153578,null));};exports[_0xdafd('0x87')]=function(_0x538449,_0x705220){var _0x368142=shared[_0xdafd('0x88')];var _0xed9bfb=[];_['map'](_0x368142,function(_0x5e6114){_0xed9bfb['push']({'id':_0x5e6114[_0xdafd('0x13')],'name':_0x5e6114['name'],'utcOffset':_0x5e6114[_0xdafd('0x89')]});});return _0x705220[_0xdafd('0x7')](0xc8)[_0xdafd('0x8')]({'tz':_0xed9bfb});};exports[_0xdafd('0x8a')]=function(_0x4ff7d5,_0xed0633){var _0x16172d=shared[_0xdafd('0x88')];var _0x1243e5={};if(!_[_0xdafd('0x63')](_0x16172d[_0x4ff7d5['body']['id']]))_0x1243e5=_0x16172d[_0x4ff7d5[_0xdafd('0x49')]['id']];return _0xed0633['status'](0xc8)[_0xdafd('0x8')](_0x1243e5);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 752d9a2..24d74ce 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xabce,0x103));var _0xeabc=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xabce[_0x2df507];return _0x1f7167;};'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('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x579681,_0x181f3f){var _0x3054e0=function(_0x3c57ac){while(--_0x3c57ac){_0x579681['push'](_0x579681['shift']());}};_0x3054e0(++_0x181f3f);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index de3dc0f..2102113 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 _0xf804=['getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','CmList','List','NOW()','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','model','include','then','debug','stringify','catch','error','message','ShowCmHopper','find','info','raw','CreateCmHopper','UpdateCmHopper','body','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','UPDATE','Contact','keys','User','Agent','voicePause','length','push','includes','update','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone'];(function(_0xe6391c,_0x322480){var _0x3f396f=function(_0x13f612){while(--_0x13f612){_0xe6391c['push'](_0xe6391c['shift']());}};_0x3f396f(++_0x322480);}(_0xf804,0x197));var _0x4f80=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf804[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x4f80('0x0'));var moment=require(_0x4f80('0x1'));var BPromise=require(_0x4f80('0x2'));var db=require(_0x4f80('0x3'))['db'];var logger=require(_0x4f80('0x4'))('rpc');exports[_0x4f80('0x5')]=function(_0x29ac69){var _0x4ff2b4=this;return new Promise(function(_0x2d469f,_0x43b627){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'raw':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')][_0x4f80('0xb')]||null:null,'include':_0x29ac69[_0x4f80('0x8')]?_0x29ac69[_0x4f80('0x8')]['include']?_[_0x4f80('0xc')](_0x29ac69[_0x4f80('0x8')]['include'],function(_0x16632a){return{'model':db[_0x16632a[_0x4f80('0xd')]],'as':_0x16632a['as'],'attributes':_0x16632a[_0x4f80('0xa')],'include':_0x16632a[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x16632a[_0x4f80('0xe')],function(_0x2139f7){return{'model':db[_0x2139f7[_0x4f80('0xd')]],'as':_0x2139f7['as'],'attributes':_0x2139f7['attributes'],'include':_0x2139f7[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x2139f7[_0x4f80('0xe')],function(_0x3a1992){return{'model':db[_0x3a1992[_0x4f80('0xd')]],'as':_0x3a1992['as'],'attributes':_0x3a1992[_0x4f80('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x49df56){logger['info']('GetCmHopper',_0x29ac69);logger[_0x4f80('0x10')](_0x4f80('0x5'),_0x29ac69,JSON[_0x4f80('0x11')](_0x49df56));_0x2d469f(_0x49df56);})[_0x4f80('0x12')](function(_0xfc2304){logger[_0x4f80('0x13')](_0x4f80('0x5'),_0xfc2304[_0x4f80('0x14')],_0x29ac69);_0x43b627(_0x4ff2b4[_0x4f80('0x13')](0x1f4,_0xfc2304[_0x4f80('0x14')]));});});};exports[_0x4f80('0x15')]=function(_0x4f5d95){var _0x394661=this;return new Promise(function(_0x1ac6c8,_0x104939){return db[_0x4f80('0x6')][_0x4f80('0x16')]({'raw':_0x4f5d95['options']?_0x4f5d95['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95['options']['attributes']||null:null,'include':_0x4f5d95[_0x4f80('0x8')]?_0x4f5d95['options']['include']?_[_0x4f80('0xc')](_0x4f5d95[_0x4f80('0x8')]['include'],function(_0x15ad1c){return{'model':db[_0x15ad1c[_0x4f80('0xd')]],'as':_0x15ad1c['as'],'attributes':_0x15ad1c[_0x4f80('0xa')],'include':_0x15ad1c[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x15ad1c[_0x4f80('0xe')],function(_0x4c1587){return{'model':db[_0x4c1587[_0x4f80('0xd')]],'as':_0x4c1587['as'],'attributes':_0x4c1587[_0x4f80('0xa')],'include':_0x4c1587[_0x4f80('0xe')]?_['map'](_0x4c1587['include'],function(_0x311fc1){return{'model':db[_0x311fc1[_0x4f80('0xd')]],'as':_0x311fc1['as'],'attributes':_0x311fc1['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x479859){logger[_0x4f80('0x17')]('ShowCmHopper',_0x4f5d95);logger[_0x4f80('0x10')](_0x4f80('0x15'),_0x4f5d95,JSON[_0x4f80('0x11')](_0x479859));_0x1ac6c8(_0x479859);})[_0x4f80('0x12')](function(_0x2da16e){logger[_0x4f80('0x13')]('ShowCmHopper',_0x2da16e[_0x4f80('0x14')],_0x4f5d95);_0x104939(_0x394661['error'](0x1f4,_0x2da16e[_0x4f80('0x14')]));});});};exports['CreateCmHopper']=function(_0x3e51d9){var _0x4ba9c5=this;return new Promise(function(_0x515c50,_0x488317){return db[_0x4f80('0x6')]['create'](_0x3e51d9['body'],{'raw':_0x3e51d9[_0x4f80('0x8')]?_0x3e51d9['options'][_0x4f80('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1fd58d){logger['info'](_0x4f80('0x19'),_0x3e51d9);logger[_0x4f80('0x10')](_0x4f80('0x19'),_0x3e51d9,JSON[_0x4f80('0x11')](_0x1fd58d));_0x515c50(_0x1fd58d);})[_0x4f80('0x12')](function(_0xea7f5b){logger[_0x4f80('0x13')](_0x4f80('0x19'),_0xea7f5b[_0x4f80('0x14')],_0x3e51d9);_0x488317(_0x4ba9c5['error'](0x1f4,_0xea7f5b[_0x4f80('0x14')]));});});};exports[_0x4f80('0x1a')]=function(_0x2ce84b){var _0x5d74ce=this;return new Promise(function(_0x1ef62f,_0x9e6623){return db['CmHopper']['update'](_0x2ce84b[_0x4f80('0x1b')],{'raw':_0x2ce84b[_0x4f80('0x8')]?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ce84b['options']?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x2ce84b[_0x4f80('0x8')]?_0x2ce84b[_0x4f80('0x8')]['attributes']||null:null,'limit':_0x2ce84b['options']?_0x2ce84b[_0x4f80('0x8')][_0x4f80('0xb')]||null:null})['then'](function(_0x21f415){logger[_0x4f80('0x17')](_0x4f80('0x1a'),_0x2ce84b);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x4f80('0x11')](_0x2ce84b[_0x4f80('0x8')]['where']),_0x2ce84b['body']['active']);logger[_0x4f80('0x10')](_0x4f80('0x1a'),_0x2ce84b,JSON[_0x4f80('0x11')](_0x21f415));_0x1ef62f(_0x21f415);})[_0x4f80('0x12')](function(_0x5ab47a){logger[_0x4f80('0x13')](_0x4f80('0x1a'),_0x5ab47a[_0x4f80('0x14')],_0x2ce84b);_0x9e6623(_0x5d74ce[_0x4f80('0x13')](0x1f4,_0x5ab47a[_0x4f80('0x14')]));});});};exports[_0x4f80('0x1c')]=function(_0x4ed733){var _0x123a88=this;return new Promise(function(_0xeb6569,_0x434055){return db[_0x4f80('0x6')][_0x4f80('0x1d')]({'where':_0x4ed733['options']?_0x4ed733['options'][_0x4f80('0x9')]||null:null})[_0x4f80('0xf')](function(_0x607f5a){logger[_0x4f80('0x17')]('DestroyCmHopper',_0x4ed733);logger[_0x4f80('0x10')](_0x4f80('0x1c'),_0x4ed733,JSON[_0x4f80('0x11')](_0x607f5a));_0xeb6569(_0x607f5a);})['catch'](function(_0x572893){logger[_0x4f80('0x13')](_0x4f80('0x1c'),_0x572893['message'],_0x4ed733);_0x434055(_0x123a88['error'](0x1f4,_0x572893['message']));});});};exports[_0x4f80('0x1e')]=function(_0x5dc880){var _0x22da2e=this;return new Promise(function(_0x500f84,_0x544a3a){return db[_0x4f80('0x1f')]['describe']()['then'](function(_0x29a424){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x2efca2){return db['CmHopper']['findAll']({'where':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x5dc880['options']?_0x5dc880[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')]['limit']||null:null,'order':_0x5dc880[_0x4f80('0x8')]?_0x5dc880[_0x4f80('0x8')][_0x4f80('0x22')]||null:null,'transaction':_0x2efca2,'lock':_0x2efca2['LOCK'][_0x4f80('0x23')],'include':[{'model':db[_0x4f80('0x1f')],'as':_0x4f80('0x24'),'attributes':_[_0x4f80('0x25')](_0x29a424)},{'model':db[_0x4f80('0x26')],'as':_0x4f80('0x27'),'attributes':['id','name',_0x4f80('0x28')]}]})[_0x4f80('0xf')](function(_0x5b759a){var _0x25c48d=[];var _0x49983b=[];for(var _0x48cd7c=0x0;_0x48cd7c<_0x5b759a[_0x4f80('0x29')];_0x48cd7c+=0x1){var _0x341cfb=_0x5b759a[_0x48cd7c]['UserId'];if(_0x341cfb===null){_0x25c48d[_0x4f80('0x2a')](_0x5b759a[_0x48cd7c]['update'](_0x5dc880['body'],{'transaction':_0x2efca2}));}else if(!_0x49983b[_0x4f80('0x2b')](_0x341cfb)){_0x49983b['push'](_0x341cfb);_0x25c48d[_0x4f80('0x2a')](_0x5b759a[_0x48cd7c][_0x4f80('0x2c')](_0x5dc880[_0x4f80('0x1b')],{'transaction':_0x2efca2}));}}return BPromise['all'](_0x25c48d);});})[_0x4f80('0xf')](function(_0x3f897a){logger[_0x4f80('0x17')](_0x4f80('0x1e'),_0x5dc880);if(_0x3f897a[_0x4f80('0x29')]>0x0){logger[_0x4f80('0x17')](_0x4f80('0x2d'),_0x3f897a[0x0][_0x4f80('0x2e')]['id'],_0x3f897a[0x0][_0x4f80('0x2e')]['ContactId'],_0x3f897a[0x0][_0x4f80('0x2e')][_0x4f80('0x2f')]);}logger[_0x4f80('0x10')](_0x4f80('0x1e'),_0x5dc880,JSON[_0x4f80('0x11')](_0x3f897a));_0x500f84(_0x3f897a);})['catch'](function(_0x12485b){logger[_0x4f80('0x13')](_0x4f80('0x1e'),_0x12485b[_0x4f80('0x14')],_0x5dc880);_0x544a3a(_0x22da2e['error'](0x1f4,_0x12485b[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x30')]=function(_0x156896){var _0x11c985=this;return new Promise(function(_0x3b5797,_0x56ffc3){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x54672f){return db[_0x4f80('0x31')][_0x4f80('0x32')](_0x156896['body'],{'raw':_0x156896[_0x4f80('0x8')]?_0x156896[_0x4f80('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x54672f})['then'](function(){logger[_0x4f80('0x17')](_0x4f80('0x33'),JSON['stringify'](_0x156896['options']['where']),_0x156896['options']['where'][_0x4f80('0x2f')]);return db[_0x4f80('0x6')][_0x4f80('0x1d')]({'where':_0x156896[_0x4f80('0x8')]?_0x156896['options']['where']||null:null,'transaction':_0x54672f});});})[_0x4f80('0xf')](function(_0x3e9669){logger[_0x4f80('0x17')]('MoveContactManagedDialer',_0x156896);logger['debug']('MoveContactManagedDialer',_0x156896,JSON['stringify'](_0x3e9669));_0x3b5797(_0x3e9669);})[_0x4f80('0x12')](function(_0x5d0ac4){logger[_0x4f80('0x13')]('MoveContactManagedDialer',_0x5d0ac4['message'],_0x156896);_0x56ffc3(_0x11c985[_0x4f80('0x13')](0x1f4,_0x5d0ac4[_0x4f80('0x14')]));});});};exports[_0x4f80('0x34')]=function(_0x3848f3){var _0x15e8be=this;return new Promise(function(_0xd43ce5,_0x32b60a){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'raw':_0x3848f3[_0x4f80('0x8')]?_0x3848f3[_0x4f80('0x8')][_0x4f80('0x18')]===undefined?!![]:![]:!![],'where':_0x3848f3['options']?_0x3848f3[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':[[db[_0x4f80('0x20')]['fn'](_0x4f80('0x35'),db[_0x4f80('0x20')]['fn']('IF',db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x37')+util['format']('\x22%s\x22',moment()[_0x4f80('0x38')](_0x4f80('0x39')))+'\x20,\x201,\x20null'))),_0x4f80('0x3a')]]})[_0x4f80('0xf')](function(_0x2477ed){logger[_0x4f80('0x17')](_0x4f80('0x34'),_0x3848f3);logger[_0x4f80('0x10')]('CountReScheduled',_0x3848f3,JSON['stringify'](_0x2477ed));_0xd43ce5(_0x2477ed);})[_0x4f80('0x12')](function(_0x56cc82){logger['error']('CountReScheduled',_0x56cc82[_0x4f80('0x14')],_0x3848f3);_0x32b60a(_0x15e8be[_0x4f80('0x13')](0x1f4,_0x56cc82[_0x4f80('0x14')]));});});};exports[_0x4f80('0x3b')]=function(_0x38351d){var _0x2df6fa=this;return new Promise(function(_0xeab893,_0x700b7){return db[_0x4f80('0x1f')][_0x4f80('0x3c')]()['then'](function(){return db[_0x4f80('0x20')]['transaction'](function(_0x452df7){return db['CmHopper'][_0x4f80('0x7')]({'where':_0x38351d[_0x4f80('0x8')]?_0x38351d[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x38351d[_0x4f80('0x8')]?_0x38351d['options'][_0x4f80('0xa')]||null:null,'limit':0x1,'order':_0x38351d['options']?_0x38351d[_0x4f80('0x8')]['order']||null:null,'group':db[_0x4f80('0x6')][_0x4f80('0x3d')],'transaction':_0x452df7,'lock':_0x452df7['LOCK']['UPDATE'],'include':_0x38351d[_0x4f80('0x8')]?_0x38351d['options']['include']?_[_0x4f80('0xc')](_0x38351d[_0x4f80('0x8')][_0x4f80('0xe')],function(_0x20854e){return{'model':db[_0x20854e['model']],'as':_0x20854e['as'],'attributes':_0x20854e[_0x4f80('0xa')],'include':_0x20854e[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x20854e[_0x4f80('0xe')],function(_0x5695bf){return{'model':db[_0x5695bf['model']],'as':_0x5695bf['as'],'attributes':_0x5695bf[_0x4f80('0xa')],'include':_0x5695bf[_0x4f80('0xe')]?_['map'](_0x5695bf['include'],function(_0x5112ce){return{'model':db[_0x5112ce[_0x4f80('0xd')]],'as':_0x5112ce['as'],'attributes':_0x5112ce[_0x4f80('0xa')]};}):[]};}):[]};}):[]:[]})[_0x4f80('0xf')](function(_0x1867d1){var _0x1e4e59=[];for(var _0x5e9f6b=0x0;_0x5e9f6b<_0x1867d1[_0x4f80('0x29')];_0x5e9f6b+=0x1){_0x1e4e59[_0x4f80('0x2a')](_0x1867d1[_0x5e9f6b][_0x4f80('0x2c')](_0x38351d['body'],{'transaction':_0x452df7}));}return BPromise['all'](_0x1e4e59);});})['then'](function(_0x1c644b){logger['info'](_0x4f80('0x3b'),_0x38351d);logger[_0x4f80('0x10')](_0x4f80('0x3b'),_0x38351d,JSON[_0x4f80('0x11')](_0x1c644b));_0xeab893(_0x1c644b);})[_0x4f80('0x12')](function(_0x21f874){logger[_0x4f80('0x13')](_0x4f80('0x3b'),_0x21f874['message'],_0x38351d);_0x700b7(_0x2df6fa['error'](0x1f4,_0x21f874[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x3e')]=function(_0x3a3bab){var _0x3c7407=this;return new Promise(function(_0x1946ca,_0x1cb7f1){db[_0x4f80('0x1f')][_0x4f80('0x3c')]()[_0x4f80('0xf')](function(_0x91a723){return db['CmHopper'][_0x4f80('0x7')]({'raw':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0x9')]||null:null,'attributes':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xa')]||null:null,'limit':_0x3a3bab['options']?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xb')]||null:null,'include':_0x3a3bab[_0x4f80('0x8')]?_0x3a3bab[_0x4f80('0x8')][_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x3a3bab['options'][_0x4f80('0xe')],function(_0x2e3b4d){return{'model':db[_0x2e3b4d[_0x4f80('0xd')]],'as':_0x2e3b4d['as'],'attributes':_0x2e3b4d['as']==='Contact'?_[_0x4f80('0x25')](_0x91a723):_0x2e3b4d[_0x4f80('0xa')],'include':_0x2e3b4d[_0x4f80('0xe')]?_[_0x4f80('0xc')](_0x2e3b4d['include'],function(_0x4ac25e){return{'model':db[_0x4ac25e[_0x4f80('0xd')]],'as':_0x4ac25e['as'],'attributes':_0x4ac25e[_0x4f80('0xa')],'include':_0x4ac25e[_0x4f80('0xe')]?_['map'](_0x4ac25e[_0x4f80('0xe')],function(_0x536877){return{'model':db[_0x536877[_0x4f80('0xd')]],'as':_0x536877['as'],'attributes':_0x536877['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a595e){logger[_0x4f80('0x17')]('GetCmHopper',_0x3a3bab);logger['debug'](_0x4f80('0x5'),_0x3a3bab,JSON['stringify'](_0x4a595e));_0x1946ca(_0x4a595e);})[_0x4f80('0x12')](function(_0x560366){logger[_0x4f80('0x13')]('GetCmHopper',_0x560366['message'],_0x3a3bab);_0x1cb7f1(_0x3c7407['error'](0x1f4,_0x560366[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x3f')]=function(_0xdab754){var _0x22ec8f=this;return new Promise(function(_0x4d4790,_0x3a96c4){return db[_0x4f80('0x1f')][_0x4f80('0x40')]({'raw':!![],'where':{'phone':_0xdab754[_0x4f80('0x8')]['where'][_0x4f80('0x41')]},'attributes':['id',_0x4f80('0x42')],'order':[['id','DESC']]})['then'](function(_0x35edda){logger['info'](_0x4f80('0x43'),_0xdab754);logger[_0x4f80('0x10')](_0x4f80('0x43'),_0xdab754,JSON[_0x4f80('0x11')](_0x35edda));_0x4d4790(_0x35edda);})['catch'](function(_0x27539c){logger['error']('getContactByPhone',_0x27539c[_0x4f80('0x14')],_0xdab754);_0x3a96c4(_0x22ec8f[_0x4f80('0x13')](0x1f4,_0x27539c[_0x4f80('0x14')]));});});};exports[_0x4f80('0x44')]=function(_0x4d278b){var _0x801ee5=this;return new Promise(function(_0x3f9445,_0xcf4afb){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x35767d){var _0x4a899c=_0x4d278b[_0x4f80('0x8')]&&_0x4d278b[_0x4f80('0x8')][_0x4f80('0x9')]?_0x4d278b[_0x4f80('0x8')][_0x4f80('0x9')]:{};return db[_0x4f80('0x6')][_0x4f80('0x2c')](_0x4d278b[_0x4f80('0x1b')],{'where':_0x4a899c,'transaction':_0x35767d})['then'](function(_0x56b97e){logger['info'](_0x4f80('0x44'),_0x4d278b);logger[_0x4f80('0x10')](_0x4f80('0x44'),_0x4d278b,JSON['stringify'](_0x56b97e));_0x3f9445(_0x56b97e);})['catch'](function(_0x5e0abb){logger['error'](_0x4f80('0x44'),_0x5e0abb[_0x4f80('0x14')],_0x4d278b);_0xcf4afb(_0x801ee5[_0x4f80('0x13')](0x1f4,_0x5e0abb[_0x4f80('0x14')]));});});});};exports[_0x4f80('0x45')]=function(_0x131c34){var _0x1fdfe7=this;var _0x3c0b8c=_0x131c34[_0x4f80('0x1b')][_0x4f80('0x9')][_0x4f80('0x46')];var _0x569e7f=_0x131c34[_0x4f80('0x1b')]['where'][_0x4f80('0x47')];var _0xd2586a=_0x131c34['body'][_0x4f80('0x9')][_0x4f80('0x48')];return new Promise(function(_0x390628,_0x3ff660){return db[_0x4f80('0x6')][_0x4f80('0x7')]({'where':{'voiceQueueId':{'$in':_0x3c0b8c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x49')+_0x569e7f+_0x4f80('0x4a')),'$gt':db[_0x4f80('0x20')][_0x4f80('0x36')]('NOW()')}},'UserId':{'$in':_0xd2586a}},'include':[{'model':db['CmContact'],'as':_0x4f80('0x24')},{'model':db[_0x4f80('0x26')],'as':'Agent','attributes':['id',_0x4f80('0x4b'),_0x4f80('0x28')]},{'model':db[_0x4f80('0x4c')],'as':_0x4f80('0x4d')}]})[_0x4f80('0xf')](function(_0x4d4b84){if(_0x4d4b84[_0x4f80('0x29')]>0x0){return db[_0x4f80('0x20')][_0x4f80('0x21')](function(_0x2f8462){return db['CmHopper'][_0x4f80('0x2c')]({'recallmeNotifiedDate':db[_0x4f80('0x20')][_0x4f80('0x36')](_0x4f80('0x4e'))},{'where':{'id':{'$in':_['map'](_0x4d4b84,'id')}},'transaction':_0x2f8462})[_0x4f80('0xf')](function(){_0x390628(_0x4d4b84);})[_0x4f80('0x12')](function(_0x397a6c){logger[_0x4f80('0x13')](_0x4f80('0x45'),_0x397a6c[_0x4f80('0x14')],_0x131c34);_0x3ff660(_0x1fdfe7[_0x4f80('0x13')](0x1f4,_0x397a6c[_0x4f80('0x14')]));});})['catch'](function(_0x12f0e0){logger['error'](_0x4f80('0x45'),_0x12f0e0[_0x4f80('0x14')],_0x131c34);_0x3ff660(_0x1fdfe7[_0x4f80('0x13')](0x1f4,_0x12f0e0[_0x4f80('0x14')]));});}else{_0x390628(_0x4d4b84);}});});}; \ No newline at end of file +var _0x3a25=['rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','catch','message','error','ShowCmHopper','find','debug','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','length','UserId','push','update','all','dataValues','ContactId','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','lodash','util','moment','bluebird','../../config/logger'];(function(_0x12af15,_0x82cf34){var _0x45da2a=function(_0x158c1d){while(--_0x158c1d){_0x12af15['push'](_0x12af15['shift']());}};_0x45da2a(++_0x82cf34);}(_0x3a25,0x1c9));var _0x53a2=function(_0x9a7a34,_0x1147cd){_0x9a7a34=_0x9a7a34-0x0;var _0x55e54d=_0x3a25[_0x9a7a34];return _0x55e54d;};'use strict';var _=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var moment=require(_0x53a2('0x2'));var BPromise=require(_0x53a2('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x53a2('0x4'))(_0x53a2('0x5'));exports[_0x53a2('0x6')]=function(_0x3e2a87){var _0x230463=this;return new Promise(function(_0x600c73,_0x167516){return db[_0x53a2('0x7')][_0x53a2('0x8')]({'raw':_0x3e2a87[_0x53a2('0x9')]?_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'where':_0x3e2a87[_0x53a2('0x9')]?_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0x3e2a87[_0x53a2('0x9')]?_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xc')]||null:null,'limit':_0x3e2a87[_0x53a2('0x9')]?_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xd')]||null:null,'include':_0x3e2a87[_0x53a2('0x9')]?_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x3e2a87[_0x53a2('0x9')][_0x53a2('0xe')],function(_0x287e16){return{'model':db[_0x287e16[_0x53a2('0x10')]],'as':_0x287e16['as'],'attributes':_0x287e16[_0x53a2('0xc')],'include':_0x287e16['include']?_[_0x53a2('0xf')](_0x287e16[_0x53a2('0xe')],function(_0x2a0e93){return{'model':db[_0x2a0e93[_0x53a2('0x10')]],'as':_0x2a0e93['as'],'attributes':_0x2a0e93[_0x53a2('0xc')],'include':_0x2a0e93[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x2a0e93['include'],function(_0x11ce75){return{'model':db[_0x11ce75[_0x53a2('0x10')]],'as':_0x11ce75['as'],'attributes':_0x11ce75[_0x53a2('0xc')]};}):[]};}):[]};}):[]:[]})[_0x53a2('0x11')](function(_0x4bc578){logger[_0x53a2('0x12')](_0x53a2('0x6'),_0x3e2a87);logger['debug'](_0x53a2('0x6'),_0x3e2a87,JSON[_0x53a2('0x13')](_0x4bc578));_0x600c73(_0x4bc578);})[_0x53a2('0x14')](function(_0x924cd){logger['error'](_0x53a2('0x6'),_0x924cd[_0x53a2('0x15')],_0x3e2a87);_0x167516(_0x230463[_0x53a2('0x16')](0x1f4,_0x924cd[_0x53a2('0x15')]));});});};exports[_0x53a2('0x17')]=function(_0xaa0809){var _0x549156=this;return new Promise(function(_0x375186,_0x38d98c){return db['CmHopper'][_0x53a2('0x18')]({'raw':_0xaa0809[_0x53a2('0x9')]?_0xaa0809[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'where':_0xaa0809[_0x53a2('0x9')]?_0xaa0809[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0xaa0809['options']?_0xaa0809['options'][_0x53a2('0xc')]||null:null,'include':_0xaa0809['options']?_0xaa0809[_0x53a2('0x9')][_0x53a2('0xe')]?_['map'](_0xaa0809[_0x53a2('0x9')][_0x53a2('0xe')],function(_0x2a6481){return{'model':db[_0x2a6481[_0x53a2('0x10')]],'as':_0x2a6481['as'],'attributes':_0x2a6481[_0x53a2('0xc')],'include':_0x2a6481[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x2a6481[_0x53a2('0xe')],function(_0x27062b){return{'model':db[_0x27062b[_0x53a2('0x10')]],'as':_0x27062b['as'],'attributes':_0x27062b[_0x53a2('0xc')],'include':_0x27062b[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x27062b[_0x53a2('0xe')],function(_0x8a144e){return{'model':db[_0x8a144e[_0x53a2('0x10')]],'as':_0x8a144e['as'],'attributes':_0x8a144e[_0x53a2('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x70bac2){logger['info'](_0x53a2('0x17'),_0xaa0809);logger[_0x53a2('0x19')](_0x53a2('0x17'),_0xaa0809,JSON[_0x53a2('0x13')](_0x70bac2));_0x375186(_0x70bac2);})['catch'](function(_0xc3f792){logger[_0x53a2('0x16')]('ShowCmHopper',_0xc3f792['message'],_0xaa0809);_0x38d98c(_0x549156[_0x53a2('0x16')](0x1f4,_0xc3f792[_0x53a2('0x15')]));});});};exports['CreateCmHopper']=function(_0xebf839){var _0x4acb5b=this;return new Promise(function(_0x209c2b,_0x2bb963){return db[_0x53a2('0x7')][_0x53a2('0x1a')](_0xebf839[_0x53a2('0x1b')],{'raw':_0xebf839[_0x53a2('0x9')]?_0xebf839[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![]})[_0x53a2('0x11')](function(_0x20cf71){logger[_0x53a2('0x12')](_0x53a2('0x1c'),_0xebf839);logger[_0x53a2('0x19')](_0x53a2('0x1c'),_0xebf839,JSON[_0x53a2('0x13')](_0x20cf71));_0x209c2b(_0x20cf71);})['catch'](function(_0x4f6380){logger['error'](_0x53a2('0x1c'),_0x4f6380['message'],_0xebf839);_0x2bb963(_0x4acb5b[_0x53a2('0x16')](0x1f4,_0x4f6380[_0x53a2('0x15')]));});});};exports[_0x53a2('0x1d')]=function(_0x2f63e3){var _0x2d73e0=this;return new Promise(function(_0x1f334,_0x448873){return db[_0x53a2('0x7')]['update'](_0x2f63e3['body'],{'raw':_0x2f63e3[_0x53a2('0x9')]?_0x2f63e3[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f63e3[_0x53a2('0x9')]?_0x2f63e3[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0x2f63e3[_0x53a2('0x9')]?_0x2f63e3[_0x53a2('0x9')][_0x53a2('0xc')]||null:null,'limit':_0x2f63e3[_0x53a2('0x9')]?_0x2f63e3[_0x53a2('0x9')][_0x53a2('0xd')]||null:null})['then'](function(_0x35c010){logger[_0x53a2('0x12')](_0x53a2('0x1d'),_0x2f63e3);logger[_0x53a2('0x12')](_0x53a2('0x1e'),JSON[_0x53a2('0x13')](_0x2f63e3[_0x53a2('0x9')]['where']),_0x2f63e3['body'][_0x53a2('0x1f')]);logger[_0x53a2('0x19')]('UpdateCmHopper',_0x2f63e3,JSON[_0x53a2('0x13')](_0x35c010));_0x1f334(_0x35c010);})[_0x53a2('0x14')](function(_0x3cf06d){logger[_0x53a2('0x16')](_0x53a2('0x1d'),_0x3cf06d['message'],_0x2f63e3);_0x448873(_0x2d73e0[_0x53a2('0x16')](0x1f4,_0x3cf06d[_0x53a2('0x15')]));});});};exports[_0x53a2('0x20')]=function(_0x504750){var _0x39f296=this;return new Promise(function(_0xfc6dc7,_0x2ff3d3){return db['CmHopper'][_0x53a2('0x21')]({'where':_0x504750[_0x53a2('0x9')]?_0x504750[_0x53a2('0x9')]['where']||null:null})[_0x53a2('0x11')](function(_0x17f578){logger[_0x53a2('0x12')](_0x53a2('0x20'),_0x504750);logger[_0x53a2('0x19')](_0x53a2('0x20'),_0x504750,JSON[_0x53a2('0x13')](_0x17f578));_0xfc6dc7(_0x17f578);})[_0x53a2('0x14')](function(_0x17717c){logger[_0x53a2('0x16')](_0x53a2('0x20'),_0x17717c['message'],_0x504750);_0x2ff3d3(_0x39f296[_0x53a2('0x16')](0x1f4,_0x17717c[_0x53a2('0x15')]));});});};exports[_0x53a2('0x22')]=function(_0x402cb6){var _0x29c049=this;return new Promise(function(_0xd6e95e,_0x2ae612){return db[_0x53a2('0x23')][_0x53a2('0x24')]()['then'](function(_0x204678){return db[_0x53a2('0x25')][_0x53a2('0x26')](function(_0x4382b8){return db[_0x53a2('0x7')][_0x53a2('0x8')]({'where':_0x402cb6[_0x53a2('0x9')]?_0x402cb6[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0x402cb6[_0x53a2('0x9')]?_0x402cb6[_0x53a2('0x9')][_0x53a2('0xc')]||null:null,'limit':_0x402cb6[_0x53a2('0x9')]?_0x402cb6[_0x53a2('0x9')]['limit']||null:null,'order':_0x402cb6[_0x53a2('0x9')]?_0x402cb6['options'][_0x53a2('0x27')]||null:null,'transaction':_0x4382b8,'lock':_0x4382b8[_0x53a2('0x28')][_0x53a2('0x29')],'include':[{'model':db[_0x53a2('0x23')],'as':_0x53a2('0x2a'),'attributes':_['keys'](_0x204678)},{'model':db[_0x53a2('0x2b')],'as':_0x53a2('0x2c'),'attributes':['id',_0x53a2('0x2d'),'voicePause']}]})[_0x53a2('0x11')](function(_0x5449ee){var _0x45a412=[];var _0xe77603=[];for(var _0x123348=0x0;_0x123348<_0x5449ee[_0x53a2('0x2e')];_0x123348+=0x1){var _0x419aef=_0x5449ee[_0x123348][_0x53a2('0x2f')];if(_0x419aef===null){_0x45a412[_0x53a2('0x30')](_0x5449ee[_0x123348]['update'](_0x402cb6['body'],{'transaction':_0x4382b8}));}else if(!_0xe77603['includes'](_0x419aef)){_0xe77603[_0x53a2('0x30')](_0x419aef);_0x45a412[_0x53a2('0x30')](_0x5449ee[_0x123348][_0x53a2('0x31')](_0x402cb6[_0x53a2('0x1b')],{'transaction':_0x4382b8}));}}return BPromise[_0x53a2('0x32')](_0x45a412);});})[_0x53a2('0x11')](function(_0x4e4245){logger[_0x53a2('0x12')](_0x53a2('0x22'),_0x402cb6);if(_0x4e4245[_0x53a2('0x2e')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x4e4245[0x0]['dataValues']['id'],_0x4e4245[0x0][_0x53a2('0x33')][_0x53a2('0x34')],_0x4e4245[0x0][_0x53a2('0x33')]['active']);}logger[_0x53a2('0x19')](_0x53a2('0x22'),_0x402cb6,JSON['stringify'](_0x4e4245));_0xd6e95e(_0x4e4245);})[_0x53a2('0x14')](function(_0x12f900){logger['error']('GetContactDialer',_0x12f900[_0x53a2('0x15')],_0x402cb6);_0x2ae612(_0x29c049['error'](0x1f4,_0x12f900[_0x53a2('0x15')]));});});});};exports[_0x53a2('0x35')]=function(_0xb83970){var _0x38d944=this;return new Promise(function(_0x41b714,_0x5ac612){return db['sequelize'][_0x53a2('0x26')](function(_0x6854aa){return db['CmHopperFinal'][_0x53a2('0x1a')](_0xb83970[_0x53a2('0x1b')],{'raw':_0xb83970[_0x53a2('0x9')]?_0xb83970[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'transaction':_0x6854aa})[_0x53a2('0x11')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x53a2('0x13')](_0xb83970[_0x53a2('0x9')][_0x53a2('0xb')]),_0xb83970['options']['where'][_0x53a2('0x1f')]);return db[_0x53a2('0x7')][_0x53a2('0x21')]({'where':_0xb83970[_0x53a2('0x9')]?_0xb83970['options'][_0x53a2('0xb')]||null:null,'transaction':_0x6854aa});});})[_0x53a2('0x11')](function(_0x289b55){logger[_0x53a2('0x12')](_0x53a2('0x35'),_0xb83970);logger['debug'](_0x53a2('0x35'),_0xb83970,JSON[_0x53a2('0x13')](_0x289b55));_0x41b714(_0x289b55);})[_0x53a2('0x14')](function(_0x5a2809){logger['error'](_0x53a2('0x35'),_0x5a2809[_0x53a2('0x15')],_0xb83970);_0x5ac612(_0x38d944[_0x53a2('0x16')](0x1f4,_0x5a2809['message']));});});};exports['CountReScheduled']=function(_0x302ad5){var _0x5c6649=this;return new Promise(function(_0x3934c4,_0x1cecfe){return db[_0x53a2('0x7')][_0x53a2('0x8')]({'raw':_0x302ad5[_0x53a2('0x9')]?_0x302ad5[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'where':_0x302ad5[_0x53a2('0x9')]?_0x302ad5['options'][_0x53a2('0xb')]||null:null,'attributes':[[db[_0x53a2('0x25')]['fn'](_0x53a2('0x36'),db[_0x53a2('0x25')]['fn']('IF',db[_0x53a2('0x25')][_0x53a2('0x37')](_0x53a2('0x38')+util[_0x53a2('0x39')]('\x22%s\x22',moment()['format'](_0x53a2('0x3a')))+_0x53a2('0x3b')))),_0x53a2('0x3c')]]})['then'](function(_0x533977){logger[_0x53a2('0x12')]('CountReScheduled',_0x302ad5);logger[_0x53a2('0x19')](_0x53a2('0x3d'),_0x302ad5,JSON[_0x53a2('0x13')](_0x533977));_0x3934c4(_0x533977);})[_0x53a2('0x14')](function(_0x1291bc){logger['error'](_0x53a2('0x3d'),_0x1291bc['message'],_0x302ad5);_0x1cecfe(_0x5c6649[_0x53a2('0x16')](0x1f4,_0x1291bc[_0x53a2('0x15')]));});});};exports[_0x53a2('0x3e')]=function(_0x19d3d1){var _0xffaf50=this;return new Promise(function(_0x190eaf,_0xc719a5){return db[_0x53a2('0x23')][_0x53a2('0x24')]()[_0x53a2('0x11')](function(){return db[_0x53a2('0x25')][_0x53a2('0x26')](function(_0x54a385){return db[_0x53a2('0x7')]['findAll']({'where':_0x19d3d1[_0x53a2('0x9')]?_0x19d3d1[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0x19d3d1[_0x53a2('0x9')]?_0x19d3d1[_0x53a2('0x9')][_0x53a2('0xc')]||null:null,'limit':0x1,'order':_0x19d3d1[_0x53a2('0x9')]?_0x19d3d1[_0x53a2('0x9')]['order']||null:null,'group':db[_0x53a2('0x7')]['UserId'],'transaction':_0x54a385,'lock':_0x54a385[_0x53a2('0x28')][_0x53a2('0x29')],'include':_0x19d3d1[_0x53a2('0x9')]?_0x19d3d1[_0x53a2('0x9')]['include']?_[_0x53a2('0xf')](_0x19d3d1[_0x53a2('0x9')][_0x53a2('0xe')],function(_0x1260aa){return{'model':db[_0x1260aa[_0x53a2('0x10')]],'as':_0x1260aa['as'],'attributes':_0x1260aa[_0x53a2('0xc')],'include':_0x1260aa[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x1260aa[_0x53a2('0xe')],function(_0x247381){return{'model':db[_0x247381[_0x53a2('0x10')]],'as':_0x247381['as'],'attributes':_0x247381[_0x53a2('0xc')],'include':_0x247381[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x247381[_0x53a2('0xe')],function(_0x1039eb){return{'model':db[_0x1039eb[_0x53a2('0x10')]],'as':_0x1039eb['as'],'attributes':_0x1039eb['attributes']};}):[]};}):[]};}):[]:[]})[_0x53a2('0x11')](function(_0x4c1b70){var _0x39a9dc=[];for(var _0x53b458=0x0;_0x53b458<_0x4c1b70[_0x53a2('0x2e')];_0x53b458+=0x1){_0x39a9dc['push'](_0x4c1b70[_0x53b458]['update'](_0x19d3d1['body'],{'transaction':_0x54a385}));}return BPromise[_0x53a2('0x32')](_0x39a9dc);});})[_0x53a2('0x11')](function(_0x4ed8c4){logger['info']('GetContactRecallMe',_0x19d3d1);logger[_0x53a2('0x19')](_0x53a2('0x3e'),_0x19d3d1,JSON[_0x53a2('0x13')](_0x4ed8c4));_0x190eaf(_0x4ed8c4);})[_0x53a2('0x14')](function(_0x589451){logger['error'](_0x53a2('0x3e'),_0x589451['message'],_0x19d3d1);_0xc719a5(_0xffaf50[_0x53a2('0x16')](0x1f4,_0x589451['message']));});});});};exports[_0x53a2('0x3f')]=function(_0x3f6016){var _0x37ee8f=this;return new Promise(function(_0x2da86d,_0x4e5e80){db[_0x53a2('0x23')][_0x53a2('0x24')]()[_0x53a2('0x11')](function(_0x3630e5){return db[_0x53a2('0x7')][_0x53a2('0x8')]({'raw':_0x3f6016['options']?_0x3f6016[_0x53a2('0x9')][_0x53a2('0xa')]===undefined?!![]:![]:!![],'where':_0x3f6016[_0x53a2('0x9')]?_0x3f6016[_0x53a2('0x9')][_0x53a2('0xb')]||null:null,'attributes':_0x3f6016[_0x53a2('0x9')]?_0x3f6016[_0x53a2('0x9')][_0x53a2('0xc')]||null:null,'limit':_0x3f6016['options']?_0x3f6016[_0x53a2('0x9')][_0x53a2('0xd')]||null:null,'include':_0x3f6016[_0x53a2('0x9')]?_0x3f6016[_0x53a2('0x9')][_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x3f6016[_0x53a2('0x9')][_0x53a2('0xe')],function(_0xbe4334){return{'model':db[_0xbe4334[_0x53a2('0x10')]],'as':_0xbe4334['as'],'attributes':_0xbe4334['as']===_0x53a2('0x2a')?_[_0x53a2('0x40')](_0x3630e5):_0xbe4334['attributes'],'include':_0xbe4334[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0xbe4334['include'],function(_0x2e619b){return{'model':db[_0x2e619b['model']],'as':_0x2e619b['as'],'attributes':_0x2e619b[_0x53a2('0xc')],'include':_0x2e619b[_0x53a2('0xe')]?_[_0x53a2('0xf')](_0x2e619b[_0x53a2('0xe')],function(_0x50686e){return{'model':db[_0x50686e['model']],'as':_0x50686e['as'],'attributes':_0x50686e['attributes']};}):[]};}):[]};}):[]:[]})[_0x53a2('0x11')](function(_0x58fd96){logger[_0x53a2('0x12')](_0x53a2('0x6'),_0x3f6016);logger[_0x53a2('0x19')](_0x53a2('0x6'),_0x3f6016,JSON['stringify'](_0x58fd96));_0x2da86d(_0x58fd96);})['catch'](function(_0x17695f){logger['error'](_0x53a2('0x6'),_0x17695f['message'],_0x3f6016);_0x4e5e80(_0x37ee8f[_0x53a2('0x16')](0x1f4,_0x17695f['message']));});});});};exports[_0x53a2('0x41')]=function(_0x144f2b){var _0x2ef536=this;return new Promise(function(_0x34ac2b,_0x519ea8){return db[_0x53a2('0x23')]['findOne']({'raw':!![],'where':{'phone':_0x144f2b[_0x53a2('0x9')]['where'][_0x53a2('0x42')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x53a2('0x11')](function(_0x6eb76e){logger[_0x53a2('0x12')](_0x53a2('0x43'),_0x144f2b);logger[_0x53a2('0x19')]('getContactByPhone',_0x144f2b,JSON[_0x53a2('0x13')](_0x6eb76e));_0x34ac2b(_0x6eb76e);})['catch'](function(_0xfaa84c){logger[_0x53a2('0x16')](_0x53a2('0x43'),_0xfaa84c[_0x53a2('0x15')],_0x144f2b);_0x519ea8(_0x2ef536[_0x53a2('0x16')](0x1f4,_0xfaa84c[_0x53a2('0x15')]));});});};exports[_0x53a2('0x44')]=function(_0x5ba853){var _0x2508ea=this;return new Promise(function(_0x422279,_0x5b82dd){return db['sequelize'][_0x53a2('0x26')](function(_0x3f3669){var _0x106f16=_0x5ba853[_0x53a2('0x9')]&&_0x5ba853[_0x53a2('0x9')][_0x53a2('0xb')]?_0x5ba853[_0x53a2('0x9')]['where']:{};return db[_0x53a2('0x7')]['update'](_0x5ba853[_0x53a2('0x1b')],{'where':_0x106f16,'transaction':_0x3f3669})[_0x53a2('0x11')](function(_0x4b90c8){logger[_0x53a2('0x12')](_0x53a2('0x44'),_0x5ba853);logger[_0x53a2('0x19')](_0x53a2('0x44'),_0x5ba853,JSON['stringify'](_0x4b90c8));_0x422279(_0x4b90c8);})[_0x53a2('0x14')](function(_0x566808){logger[_0x53a2('0x16')](_0x53a2('0x44'),_0x566808[_0x53a2('0x15')],_0x5ba853);_0x5b82dd(_0x2508ea[_0x53a2('0x16')](0x1f4,_0x566808[_0x53a2('0x15')]));});});});};exports[_0x53a2('0x45')]=function(_0xb2132c){var _0x279b64=this;var _0x119f29=_0xb2132c['body']['where'][_0x53a2('0x46')];var _0x140017=_0xb2132c['body']['where'][_0x53a2('0x47')];var _0x360939=_0xb2132c['body']['where']['availableAgentsIds'];return new Promise(function(_0x38d4d3,_0x3e86df){return db['CmHopper'][_0x53a2('0x8')]({'where':{'voiceQueueId':{'$in':_0x119f29},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x53a2('0x48')+_0x140017+_0x53a2('0x49')),'$gt':db[_0x53a2('0x25')][_0x53a2('0x37')]('NOW()')}},'UserId':{'$in':_0x360939}},'include':[{'model':db[_0x53a2('0x23')],'as':'Contact'},{'model':db[_0x53a2('0x2b')],'as':'Agent','attributes':['id',_0x53a2('0x2d'),'voicePause']},{'model':db[_0x53a2('0x4a')],'as':_0x53a2('0x4b')}]})[_0x53a2('0x11')](function(_0x37d016){if(_0x37d016[_0x53a2('0x2e')]>0x0){return db[_0x53a2('0x25')]['transaction'](function(_0x1207e7){return db[_0x53a2('0x7')][_0x53a2('0x31')]({'recallmeNotifiedDate':db['sequelize'][_0x53a2('0x37')](_0x53a2('0x4c'))},{'where':{'id':{'$in':_['map'](_0x37d016,'id')}},'transaction':_0x1207e7})[_0x53a2('0x11')](function(){_0x38d4d3(_0x37d016);})[_0x53a2('0x14')](function(_0x1abe6f){logger[_0x53a2('0x16')](_0x53a2('0x45'),_0x1abe6f['message'],_0xb2132c);_0x3e86df(_0x279b64['error'](0x1f4,_0x1abe6f[_0x53a2('0x15')]));});})[_0x53a2('0x14')](function(_0x19810c){logger[_0x53a2('0x16')](_0x53a2('0x45'),_0x19810c['message'],_0xb2132c);_0x3e86df(_0x279b64[_0x53a2('0x16')](0x1f4,_0x19810c['message']));});}else{_0x38d4d3(_0x37d016);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b80433d..8628d73 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 _0x5b44=['/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','create','post','/preview','/timezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','getOpenContacts'];(function(_0x1bcd90,_0xf18e30){var _0x500264=function(_0x37ab1b){while(--_0x37ab1b){_0x1bcd90['push'](_0x1bcd90['shift']());}};_0x500264(++_0xf18e30);}(_0x5b44,0x92));var _0x45b4=function(_0x97b938,_0x138552){_0x97b938=_0x97b938-0x0;var _0x3f1b29=_0x5b44[_0x97b938];return _0x3f1b29;};'use strict';var express=require(_0x45b4('0x0'));var router=express[_0x45b4('0x1')]();var auth=require(_0x45b4('0x2'));var controller=require('./cmHopper.controller');router[_0x45b4('0x3')]('/',auth[_0x45b4('0x4')](),controller[_0x45b4('0x5')]);router['get'](_0x45b4('0x6'),auth[_0x45b4('0x4')](),controller['describe']);router[_0x45b4('0x3')]('/opencontacts',auth[_0x45b4('0x4')](),controller[_0x45b4('0x7')]);router['get'](_0x45b4('0x8'),auth[_0x45b4('0x4')](),controller[_0x45b4('0x9')]);router[_0x45b4('0x3')](_0x45b4('0xa'),auth[_0x45b4('0x4')](),controller['show']);router[_0x45b4('0x3')](_0x45b4('0xb'),auth['isAuthenticated'](),controller[_0x45b4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x45b4('0xd')]);router[_0x45b4('0xe')](_0x45b4('0xf'),auth[_0x45b4('0x4')](),controller['getPreview']);router[_0x45b4('0xe')](_0x45b4('0x10'),auth[_0x45b4('0x4')](),controller['getTimezone']);router[_0x45b4('0x11')](_0x45b4('0xa'),auth[_0x45b4('0x4')](),controller[_0x45b4('0x12')]);router[_0x45b4('0x13')]('/:id',auth[_0x45b4('0x4')](),controller[_0x45b4('0x14')]);module[_0x45b4('0x15')]=router; \ No newline at end of file +var _0x9b9f=['/:id','/:id/previewrecall','post','/preview','getPreview','destroy','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones'];(function(_0x3db285,_0x2ce3dc){var _0x287478=function(_0x146324){while(--_0x146324){_0x3db285['push'](_0x3db285['shift']());}};_0x287478(++_0x2ce3dc);}(_0x9b9f,0x17d));var _0xf9b9=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x9b9f[_0xcf581b];return _0x4f454d;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf9b9('0x0'));router[_0xf9b9('0x1')]('/',auth[_0xf9b9('0x2')](),controller[_0xf9b9('0x3')]);router['get'](_0xf9b9('0x4'),auth[_0xf9b9('0x2')](),controller[_0xf9b9('0x5')]);router['get'](_0xf9b9('0x6'),auth[_0xf9b9('0x2')](),controller[_0xf9b9('0x7')]);router[_0xf9b9('0x1')]('/timezones',auth[_0xf9b9('0x2')](),controller[_0xf9b9('0x8')]);router['get'](_0xf9b9('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf9b9('0xa'),auth[_0xf9b9('0x2')](),controller['getPreviewRecall']);router[_0xf9b9('0xb')]('/',auth[_0xf9b9('0x2')](),controller['create']);router[_0xf9b9('0xb')](_0xf9b9('0xc'),auth[_0xf9b9('0x2')](),controller[_0xf9b9('0xd')]);router[_0xf9b9('0xb')]('/timezone',auth[_0xf9b9('0x2')](),controller['getTimezone']);router['put'](_0xf9b9('0x9'),auth[_0xf9b9('0x2')](),controller['update']);router['delete'](_0xf9b9('0x9'),auth['isAuthenticated'](),controller[_0xf9b9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 790a123..8d06698 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeca8=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x973f7a,_0x19fd27){var _0x31e2c4=function(_0x28cc0a){while(--_0x28cc0a){_0x973f7a['push'](_0x973f7a['shift']());}};_0x31e2c4(++_0x19fd27);}(_0xeca8,0x16b));var _0x8eca=function(_0x20c047,_0x5edfba){_0x20c047=_0x20c047-0x0;var _0x2e0400=_0xeca8[_0x20c047];return _0x2e0400;};'use strict';var moment=require('moment');var Sequelize=require(_0x8eca('0x0'));module[_0x8eca('0x1')]={'CmHopperId':{'type':Sequelize[_0x8eca('0x2')]},'phone':{'type':Sequelize[_0x8eca('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8eca('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8eca('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6e04=['DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING'];(function(_0x54e6f5,_0x4f4e99){var _0x5e8794=function(_0x27512b){while(--_0x27512b){_0x54e6f5['push'](_0x54e6f5['shift']());}};_0x5e8794(++_0x4f4e99);}(_0x6e04,0xb1));var _0x46e0=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0x6e04[_0x18d631];return _0x50d708;};'use strict';var moment=require(_0x46e0('0x0'));var Sequelize=require(_0x46e0('0x1'));module[_0x46e0('0x2')]={'CmHopperId':{'type':Sequelize[_0x46e0('0x3')]},'phone':{'type':Sequelize[_0x46e0('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x46e0('0x5')],'defaultValue':moment()['format'](_0x46e0('0x6'))},'countbusyretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x46e0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index dfb3f40..46895c6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d0c=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0xf17786,_0x22bf88){var _0x7d3eb1=function(_0x178705){while(--_0x178705){_0xf17786['push'](_0xf17786['shift']());}};_0x7d3eb1(++_0x22bf88);}(_0x0d0c,0x100));var _0xc0d0=function(_0x315e45,_0x43294c){_0x315e45=_0x315e45-0x0;var _0x578624=_0x0d0c[_0x315e45];return _0x578624;};'use strict';var emlformat=require(_0xc0d0('0x0'));var rimraf=require(_0xc0d0('0x1'));var zipdir=require(_0xc0d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0d0('0x3'));var BPromise=require(_0xc0d0('0x4'));var Mustache=require('mustache');var util=require(_0xc0d0('0x5'));var path=require('path');var sox=require(_0xc0d0('0x6'));var csv=require(_0xc0d0('0x7'));var ejs=require(_0xc0d0('0x8'));var fs=require('fs');var fs_extra=require(_0xc0d0('0x9'));var _=require(_0xc0d0('0xa'));var squel=require(_0xc0d0('0xb'));var crypto=require(_0xc0d0('0xc'));var jsforce=require(_0xc0d0('0xd'));var deskjs=require(_0xc0d0('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0d0('0xf'));var Redis=require(_0xc0d0('0x10'));var authService=require(_0xc0d0('0x11'));var qs=require(_0xc0d0('0x12'));var as=require(_0xc0d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0d0('0x14'))('api');var utils=require(_0xc0d0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc0d0('0x16'));var db=require(_0xc0d0('0x17'))['db'];function respondWithStatusCode(_0x5c6b4a,_0x22a732){_0x22a732=_0x22a732||0xcc;return function(_0xf602b3){if(_0xf602b3){return _0x5c6b4a[_0xc0d0('0x18')](_0x22a732);}return _0x5c6b4a[_0xc0d0('0x19')](_0x22a732)[_0xc0d0('0x1a')]();};}function respondWithResult(_0x2a5dc0,_0x2583ba){_0x2583ba=_0x2583ba||0xc8;return function(_0x3c6f51){if(_0x3c6f51){return _0x2a5dc0[_0xc0d0('0x19')](_0x2583ba)[_0xc0d0('0x1b')](_0x3c6f51);}};}function respondWithFilteredResult(_0x286867,_0x583223){return function(_0x2bffe4){if(_0x2bffe4){var _0x4fb027=typeof _0x583223[_0xc0d0('0x1c')]==='undefined'&&typeof _0x583223[_0xc0d0('0x1d')]===_0xc0d0('0x1e');var _0x37409f=_0x2bffe4[_0xc0d0('0x1f')];var _0x5aa230=_0x4fb027?0x0:_0x583223[_0xc0d0('0x1c')];var _0x1f2f2a=_0x4fb027?_0x2bffe4['count']:_0x583223['offset']+_0x583223[_0xc0d0('0x1d')];var _0x329470;if(_0x1f2f2a>=_0x37409f){_0x1f2f2a=_0x37409f;_0x329470=0xc8;}else{_0x329470=0xce;}_0x286867[_0xc0d0('0x19')](_0x329470);return _0x286867[_0xc0d0('0x20')]('Content-Range',_0x5aa230+'-'+_0x1f2f2a+'/'+_0x37409f)['json'](_0x2bffe4);}return null;};}function patchUpdates(_0x1b0922){return function(_0x1c4b5e){try{jsonpatch[_0xc0d0('0x21')](_0x1c4b5e,_0x1b0922,!![]);}catch(_0x51ed92){return BPromise[_0xc0d0('0x22')](_0x51ed92);}return _0x1c4b5e[_0xc0d0('0x23')]();};}function saveUpdates(_0x52f247,_0x55ad70){return function(_0x528875){if(_0x528875){return _0x528875['update'](_0x52f247)[_0xc0d0('0x24')](function(_0x3689c9){return _0x3689c9;});}return null;};}function removeEntity(_0x518d28,_0x169012){return function(_0x47a5de){if(_0x47a5de){return _0x47a5de[_0xc0d0('0x25')]()[_0xc0d0('0x24')](function(){var _0x48b39e=_0x47a5de[_0xc0d0('0x26')]({'plain':!![]});var _0xe46139=_0xc0d0('0x27');return db[_0xc0d0('0x28')][_0xc0d0('0x25')]({'where':{'type':_0xe46139,'resourceId':_0x48b39e['id']}})['then'](function(){return _0x47a5de;});})['then'](function(){_0x518d28[_0xc0d0('0x19')](0xcc)[_0xc0d0('0x1a')]();});}};}function handleEntityNotFound(_0x1a7aa3,_0x2e67bf){return function(_0x1cb64c){if(!_0x1cb64c){_0x1a7aa3['sendStatus'](0x194);}return _0x1cb64c;};}function handleError(_0x5a87fa,_0x317be4){_0x317be4=_0x317be4||0x1f4;return function(_0x464a00){logger[_0xc0d0('0x29')](_0x464a00[_0xc0d0('0x2a')]);if(_0x464a00[_0xc0d0('0x2b')]){delete _0x464a00[_0xc0d0('0x2b')];}_0x5a87fa[_0xc0d0('0x19')](_0x317be4)[_0xc0d0('0x2c')](_0x464a00);};}exports[_0xc0d0('0x2d')]=function(_0x59f9e7,_0x312655){var _0x9abc7b={},_0x42a2f4={},_0x1e48b4={'count':0x0,'rows':[]};var _0x56c0dc=_['map'](db[_0xc0d0('0x2e')][_0xc0d0('0x2f')],function(_0x5af89c){return{'name':_0x5af89c[_0xc0d0('0x30')],'type':_0x5af89c[_0xc0d0('0x31')][_0xc0d0('0x32')]};});_0x42a2f4[_0xc0d0('0x33')]=_[_0xc0d0('0x34')](_0x56c0dc,'name');_0x42a2f4[_0xc0d0('0x35')]=_['keys'](_0x59f9e7[_0xc0d0('0x35')]);_0x42a2f4[_0xc0d0('0x36')]=_['intersection'](_0x42a2f4['model'],_0x42a2f4[_0xc0d0('0x35')]);_0x9abc7b[_0xc0d0('0x37')]=_[_0xc0d0('0x38')](_0x42a2f4[_0xc0d0('0x33')],qs['fields'](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x39')]));_0x9abc7b[_0xc0d0('0x37')]=_0x9abc7b[_0xc0d0('0x37')][_0xc0d0('0x3a')]?_0x9abc7b[_0xc0d0('0x37')]:_0x42a2f4[_0xc0d0('0x33')];if(!_0x59f9e7['query'][_0xc0d0('0x3b')](_0xc0d0('0x3c'))){_0x9abc7b[_0xc0d0('0x1d')]=qs[_0xc0d0('0x1d')](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x1d')]);_0x9abc7b[_0xc0d0('0x1c')]=qs['offset'](_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x1c')]);}_0x9abc7b[_0xc0d0('0x3d')]=qs[_0xc0d0('0x3e')](_0x59f9e7['query']['sort']);_0x9abc7b[_0xc0d0('0x3f')]=qs['filters'](_['pick'](_0x59f9e7['query'],_0x42a2f4[_0xc0d0('0x36')]),_0x56c0dc);if(_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x40')]){_0x9abc7b[_0xc0d0('0x3f')]=_[_0xc0d0('0x41')](_0x9abc7b[_0xc0d0('0x3f')],{'$or':_['map'](_0x56c0dc,function(_0x285ad2){if(_0x285ad2[_0xc0d0('0x31')]!==_0xc0d0('0x42')){var _0x3bd7b9={};_0x3bd7b9[_0x285ad2[_0xc0d0('0x2b')]]={'$like':'%'+_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x40')]+'%'};return _0x3bd7b9;}})});}_0x9abc7b=_[_0xc0d0('0x41')]({},_0x9abc7b,_0x59f9e7[_0xc0d0('0x43')]);var _0x1664dc={'where':_0x9abc7b[_0xc0d0('0x3f')]};return db[_0xc0d0('0x2e')][_0xc0d0('0x1f')](_0x1664dc)[_0xc0d0('0x24')](function(_0x1000f9){_0x1e48b4[_0xc0d0('0x1f')]=_0x1000f9;if(_0x59f9e7[_0xc0d0('0x35')][_0xc0d0('0x44')]){_0x9abc7b['include']=[{'all':!![]}];}return db[_0xc0d0('0x2e')][_0xc0d0('0x45')](_0x9abc7b);})[_0xc0d0('0x24')](function(_0xbcd8a6){_0x1e48b4[_0xc0d0('0x46')]=_0xbcd8a6;return _0x1e48b4;})[_0xc0d0('0x24')](respondWithFilteredResult(_0x312655,_0x9abc7b))[_0xc0d0('0x47')](handleError(_0x312655,null));};exports[_0xc0d0('0x48')]=function(_0x3565e5,_0x7fc060){var _0x578a35={'raw':!![],'where':{'id':_0x3565e5[_0xc0d0('0x49')]['id']}},_0x4b0de5={};_0x4b0de5[_0xc0d0('0x33')]=_['keys'](db[_0xc0d0('0x2e')]['rawAttributes']);_0x4b0de5['query']=_['keys'](_0x3565e5[_0xc0d0('0x35')]);_0x4b0de5[_0xc0d0('0x36')]=_[_0xc0d0('0x38')](_0x4b0de5[_0xc0d0('0x33')],_0x4b0de5[_0xc0d0('0x35')]);_0x578a35[_0xc0d0('0x37')]=_['intersection'](_0x4b0de5['model'],qs['fields'](_0x3565e5[_0xc0d0('0x35')]['fields']));_0x578a35[_0xc0d0('0x37')]=_0x578a35[_0xc0d0('0x37')][_0xc0d0('0x3a')]?_0x578a35[_0xc0d0('0x37')]:_0x4b0de5['model'];if(_0x3565e5[_0xc0d0('0x35')]['includeAll']){_0x578a35[_0xc0d0('0x4a')]=[{'all':!![]}];}_0x578a35=_[_0xc0d0('0x41')]({},_0x578a35,_0x3565e5['options']);return db[_0xc0d0('0x2e')][_0xc0d0('0x4b')](_0x578a35)[_0xc0d0('0x24')](handleEntityNotFound(_0x7fc060,null))[_0xc0d0('0x24')](respondWithResult(_0x7fc060,null))[_0xc0d0('0x47')](handleError(_0x7fc060,null));};exports[_0xc0d0('0x4c')]=function(_0x403fbe,_0xf51390){return db[_0xc0d0('0x2e')]['create'](_0x403fbe['body'],{})[_0xc0d0('0x24')](function(_0x4f6e20){var _0x1cfea4=_0x403fbe[_0xc0d0('0x4d')][_0xc0d0('0x26')]({'plain':!![]});if(!_0x1cfea4)throw new Error(_0xc0d0('0x4e'));if(_0x1cfea4['role']===_0xc0d0('0x4d')){var _0xaca22=_0x4f6e20['get']({'plain':!![]});var _0x79d375=_0xc0d0('0x27');return db[_0xc0d0('0x4f')][_0xc0d0('0x4b')]({'where':{'name':_0x79d375,'userProfileId':_0x1cfea4[_0xc0d0('0x50')]},'raw':!![]})[_0xc0d0('0x24')](function(_0x4138d1){if(_0x4138d1&&_0x4138d1[_0xc0d0('0x51')]===0x0){return db[_0xc0d0('0x28')][_0xc0d0('0x4c')]({'name':_0xaca22[_0xc0d0('0x2b')],'resourceId':_0xaca22['id'],'type':_0x4138d1[_0xc0d0('0x2b')],'sectionId':_0x4138d1['id']},{})['then'](function(){return _0x4f6e20;});}else{return _0x4f6e20;}})[_0xc0d0('0x47')](function(_0x27a6d1){logger[_0xc0d0('0x29')](_0xc0d0('0x52'),_0x27a6d1);throw _0x27a6d1;});}return _0x4f6e20;})[_0xc0d0('0x24')](respondWithResult(_0xf51390,0xc9))[_0xc0d0('0x47')](handleError(_0xf51390,null));};exports['update']=function(_0x51c85c,_0x1d28fe){if(_0x51c85c[_0xc0d0('0x53')]['id']){delete _0x51c85c[_0xc0d0('0x53')]['id'];}return db['CmHopperAdditionalPhone'][_0xc0d0('0x4b')]({'where':{'id':_0x51c85c[_0xc0d0('0x49')]['id']}})[_0xc0d0('0x24')](handleEntityNotFound(_0x1d28fe,null))[_0xc0d0('0x24')](saveUpdates(_0x51c85c[_0xc0d0('0x53')],null))[_0xc0d0('0x24')](respondWithResult(_0x1d28fe,null))[_0xc0d0('0x47')](handleError(_0x1d28fe,null));};exports[_0xc0d0('0x25')]=function(_0x1d10e1,_0x4386af){return db[_0xc0d0('0x2e')]['find']({'where':{'id':_0x1d10e1[_0xc0d0('0x49')]['id']}})[_0xc0d0('0x24')](handleEntityNotFound(_0x4386af,null))['then'](removeEntity(_0x4386af,null))[_0xc0d0('0x47')](handleError(_0x4386af,null));}; \ No newline at end of file +var _0x36a8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','end','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x36a8,0x1a7));var _0x836a=function(_0x38d92b,_0x1be181){_0x38d92b=_0x38d92b-0x0;var _0x56c746=_0x36a8[_0x38d92b];return _0x56c746;};'use strict';var emlformat=require(_0x836a('0x0'));var rimraf=require(_0x836a('0x1'));var zipdir=require(_0x836a('0x2'));var jsonpatch=require(_0x836a('0x3'));var rp=require('request-promise');var moment=require(_0x836a('0x4'));var BPromise=require(_0x836a('0x5'));var Mustache=require('mustache');var util=require(_0x836a('0x6'));var path=require(_0x836a('0x7'));var sox=require(_0x836a('0x8'));var csv=require(_0x836a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x836a('0xa'));var _=require(_0x836a('0xb'));var squel=require('squel');var crypto=require(_0x836a('0xc'));var jsforce=require(_0x836a('0xd'));var deskjs=require(_0x836a('0xe'));var toCsv=require(_0x836a('0x9'));var querystring=require(_0x836a('0xf'));var Papa=require(_0x836a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x836a('0x11'));var as=require(_0x836a('0x12'));var hardwareService=require(_0x836a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x836a('0x14'));var config=require(_0x836a('0x15'));var licenseUtil=require(_0x836a('0x16'));var db=require(_0x836a('0x17'))['db'];function respondWithStatusCode(_0x3f9b74,_0x570707){_0x570707=_0x570707||0xcc;return function(_0x51a7a5){if(_0x51a7a5){return _0x3f9b74[_0x836a('0x18')](_0x570707);}return _0x3f9b74[_0x836a('0x19')](_0x570707)['end']();};}function respondWithResult(_0x59953d,_0x265c25){_0x265c25=_0x265c25||0xc8;return function(_0x469335){if(_0x469335){return _0x59953d[_0x836a('0x19')](_0x265c25)[_0x836a('0x1a')](_0x469335);}};}function respondWithFilteredResult(_0x4c43be,_0x57afcf){return function(_0x4f69a4){if(_0x4f69a4){var _0x39528a=typeof _0x57afcf[_0x836a('0x1b')]===_0x836a('0x1c')&&typeof _0x57afcf['limit']===_0x836a('0x1c');var _0x23d8c5=_0x4f69a4[_0x836a('0x1d')];var _0x5ae84f=_0x39528a?0x0:_0x57afcf['offset'];var _0x110a80=_0x39528a?_0x4f69a4['count']:_0x57afcf['offset']+_0x57afcf[_0x836a('0x1e')];var _0x46269e;if(_0x110a80>=_0x23d8c5){_0x110a80=_0x23d8c5;_0x46269e=0xc8;}else{_0x46269e=0xce;}_0x4c43be[_0x836a('0x19')](_0x46269e);return _0x4c43be[_0x836a('0x1f')](_0x836a('0x20'),_0x5ae84f+'-'+_0x110a80+'/'+_0x23d8c5)['json'](_0x4f69a4);}return null;};}function patchUpdates(_0x1bca83){return function(_0x225642){try{jsonpatch[_0x836a('0x21')](_0x225642,_0x1bca83,!![]);}catch(_0x115806){return BPromise[_0x836a('0x22')](_0x115806);}return _0x225642[_0x836a('0x23')]();};}function saveUpdates(_0x4502e4,_0x51972f){return function(_0x55b397){if(_0x55b397){return _0x55b397[_0x836a('0x24')](_0x4502e4)['then'](function(_0x597db9){return _0x597db9;});}return null;};}function removeEntity(_0x1738b6,_0x5a3ed4){return function(_0x442aab){if(_0x442aab){return _0x442aab[_0x836a('0x25')]()['then'](function(){var _0x42307b=_0x442aab[_0x836a('0x26')]({'plain':!![]});var _0x2b7d7e='CmHopperAdditionalPhones';return db[_0x836a('0x27')][_0x836a('0x25')]({'where':{'type':_0x2b7d7e,'resourceId':_0x42307b['id']}})[_0x836a('0x28')](function(){return _0x442aab;});})['then'](function(){_0x1738b6[_0x836a('0x19')](0xcc)[_0x836a('0x29')]();});}};}function handleEntityNotFound(_0x51f62d,_0x2bd885){return function(_0x91f173){if(!_0x91f173){_0x51f62d[_0x836a('0x18')](0x194);}return _0x91f173;};}function handleError(_0x102731,_0x407065){_0x407065=_0x407065||0x1f4;return function(_0x3dd5db){logger[_0x836a('0x2a')](_0x3dd5db[_0x836a('0x2b')]);if(_0x3dd5db['name']){delete _0x3dd5db[_0x836a('0x2c')];}_0x102731[_0x836a('0x19')](_0x407065)[_0x836a('0x2d')](_0x3dd5db);};}exports[_0x836a('0x2e')]=function(_0x30ae16,_0x57f9c7){var _0x2dbe31={},_0x52e256={},_0x488513={'count':0x0,'rows':[]};var _0x43de48=_['map'](db[_0x836a('0x2f')][_0x836a('0x30')],function(_0x365078){return{'name':_0x365078[_0x836a('0x31')],'type':_0x365078[_0x836a('0x32')][_0x836a('0x33')]};});_0x52e256[_0x836a('0x34')]=_[_0x836a('0x35')](_0x43de48,_0x836a('0x2c'));_0x52e256[_0x836a('0x36')]=_['keys'](_0x30ae16[_0x836a('0x36')]);_0x52e256[_0x836a('0x37')]=_[_0x836a('0x38')](_0x52e256[_0x836a('0x34')],_0x52e256[_0x836a('0x36')]);_0x2dbe31['attributes']=_[_0x836a('0x38')](_0x52e256[_0x836a('0x34')],qs['fields'](_0x30ae16['query'][_0x836a('0x39')]));_0x2dbe31[_0x836a('0x3a')]=_0x2dbe31['attributes'][_0x836a('0x3b')]?_0x2dbe31['attributes']:_0x52e256[_0x836a('0x34')];if(!_0x30ae16[_0x836a('0x36')][_0x836a('0x3c')](_0x836a('0x3d'))){_0x2dbe31['limit']=qs[_0x836a('0x1e')](_0x30ae16[_0x836a('0x36')][_0x836a('0x1e')]);_0x2dbe31[_0x836a('0x1b')]=qs[_0x836a('0x1b')](_0x30ae16['query'][_0x836a('0x1b')]);}_0x2dbe31[_0x836a('0x3e')]=qs[_0x836a('0x3f')](_0x30ae16[_0x836a('0x36')][_0x836a('0x3f')]);_0x2dbe31['where']=qs[_0x836a('0x37')](_[_0x836a('0x40')](_0x30ae16[_0x836a('0x36')],_0x52e256[_0x836a('0x37')]),_0x43de48);if(_0x30ae16[_0x836a('0x36')][_0x836a('0x41')]){_0x2dbe31[_0x836a('0x42')]=_[_0x836a('0x43')](_0x2dbe31[_0x836a('0x42')],{'$or':_[_0x836a('0x35')](_0x43de48,function(_0xb05b8d){if(_0xb05b8d['type']!==_0x836a('0x44')){var _0xbf4349={};_0xbf4349[_0xb05b8d['name']]={'$like':'%'+_0x30ae16[_0x836a('0x36')][_0x836a('0x41')]+'%'};return _0xbf4349;}})});}_0x2dbe31=_[_0x836a('0x43')]({},_0x2dbe31,_0x30ae16[_0x836a('0x45')]);var _0x12ccec={'where':_0x2dbe31['where']};return db['CmHopperAdditionalPhone'][_0x836a('0x1d')](_0x12ccec)['then'](function(_0x3b913f){_0x488513[_0x836a('0x1d')]=_0x3b913f;if(_0x30ae16['query'][_0x836a('0x46')]){_0x2dbe31[_0x836a('0x47')]=[{'all':!![]}];}return db[_0x836a('0x2f')][_0x836a('0x48')](_0x2dbe31);})[_0x836a('0x28')](function(_0x2d6de8){_0x488513['rows']=_0x2d6de8;return _0x488513;})['then'](respondWithFilteredResult(_0x57f9c7,_0x2dbe31))[_0x836a('0x49')](handleError(_0x57f9c7,null));};exports[_0x836a('0x4a')]=function(_0x1847c1,_0xa99a08){var _0x23674f={'raw':!![],'where':{'id':_0x1847c1[_0x836a('0x4b')]['id']}},_0x30543e={};_0x30543e[_0x836a('0x34')]=_[_0x836a('0x4c')](db[_0x836a('0x2f')][_0x836a('0x30')]);_0x30543e[_0x836a('0x36')]=_[_0x836a('0x4c')](_0x1847c1[_0x836a('0x36')]);_0x30543e['filters']=_[_0x836a('0x38')](_0x30543e[_0x836a('0x34')],_0x30543e[_0x836a('0x36')]);_0x23674f[_0x836a('0x3a')]=_[_0x836a('0x38')](_0x30543e[_0x836a('0x34')],qs[_0x836a('0x39')](_0x1847c1[_0x836a('0x36')]['fields']));_0x23674f[_0x836a('0x3a')]=_0x23674f['attributes'][_0x836a('0x3b')]?_0x23674f[_0x836a('0x3a')]:_0x30543e[_0x836a('0x34')];if(_0x1847c1[_0x836a('0x36')][_0x836a('0x46')]){_0x23674f[_0x836a('0x47')]=[{'all':!![]}];}_0x23674f=_[_0x836a('0x43')]({},_0x23674f,_0x1847c1[_0x836a('0x45')]);return db[_0x836a('0x2f')][_0x836a('0x4d')](_0x23674f)[_0x836a('0x28')](handleEntityNotFound(_0xa99a08,null))[_0x836a('0x28')](respondWithResult(_0xa99a08,null))[_0x836a('0x49')](handleError(_0xa99a08,null));};exports['create']=function(_0x4b6d8a,_0x131836){return db[_0x836a('0x2f')][_0x836a('0x4e')](_0x4b6d8a[_0x836a('0x4f')],{})[_0x836a('0x28')](function(_0x2774ca){var _0x2a8bfc=_0x4b6d8a[_0x836a('0x50')][_0x836a('0x26')]({'plain':!![]});if(!_0x2a8bfc)throw new Error(_0x836a('0x51'));if(_0x2a8bfc[_0x836a('0x52')]===_0x836a('0x50')){var _0x1cb1a0=_0x2774ca['get']({'plain':!![]});var _0x51f9fe=_0x836a('0x53');return db[_0x836a('0x54')][_0x836a('0x4d')]({'where':{'name':_0x51f9fe,'userProfileId':_0x2a8bfc[_0x836a('0x55')]},'raw':!![]})['then'](function(_0x16ef89){if(_0x16ef89&&_0x16ef89[_0x836a('0x56')]===0x0){return db['UserProfileResource'][_0x836a('0x4e')]({'name':_0x1cb1a0[_0x836a('0x2c')],'resourceId':_0x1cb1a0['id'],'type':_0x16ef89[_0x836a('0x2c')],'sectionId':_0x16ef89['id']},{})['then'](function(){return _0x2774ca;});}else{return _0x2774ca;}})[_0x836a('0x49')](function(_0x15a824){logger[_0x836a('0x2a')](_0x836a('0x57'),_0x15a824);throw _0x15a824;});}return _0x2774ca;})[_0x836a('0x28')](respondWithResult(_0x131836,0xc9))[_0x836a('0x49')](handleError(_0x131836,null));};exports['update']=function(_0x1b415e,_0x538db6){if(_0x1b415e[_0x836a('0x4f')]['id']){delete _0x1b415e[_0x836a('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0x836a('0x4d')]({'where':{'id':_0x1b415e[_0x836a('0x4b')]['id']}})[_0x836a('0x28')](handleEntityNotFound(_0x538db6,null))[_0x836a('0x28')](saveUpdates(_0x1b415e[_0x836a('0x4f')],null))['then'](respondWithResult(_0x538db6,null))[_0x836a('0x49')](handleError(_0x538db6,null));};exports[_0x836a('0x25')]=function(_0x294e16,_0x398d3e){return db[_0x836a('0x2f')]['find']({'where':{'id':_0x294e16[_0x836a('0x4b')]['id']}})[_0x836a('0x28')](handleEntityNotFound(_0x398d3e,null))[_0x836a('0x28')](removeEntity(_0x398d3e,null))[_0x836a('0x49')](handleError(_0x398d3e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index cb93c00..38ffc14 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e3e=['moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','util','../../config/logger','api'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe1e3('0x0'));var logger=require(_0xe1e3('0x1'))(_0xe1e3('0x2'));var moment=require(_0xe1e3('0x3'));var BPromise=require(_0xe1e3('0x4'));var rp=require(_0xe1e3('0x5'));var fs=require('fs');var path=require(_0xe1e3('0x6'));var rimraf=require('rimraf');var config=require(_0xe1e3('0x7'));var attributes=require(_0xe1e3('0x8'));module[_0xe1e3('0x9')]=function(_0x21f80e,_0x18f17f){return _0x21f80e['define'](_0xe1e3('0xa'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4369=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','util','api','moment','request-promise','rimraf'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x4369,0x108));var _0x9436=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0x4369[_0x5f4cd7];return _0x47c93f;};'use strict';var _=require(_0x9436('0x0'));var util=require(_0x9436('0x1'));var logger=require('../../config/logger')(_0x9436('0x2'));var moment=require(_0x9436('0x3'));var BPromise=require('bluebird');var rp=require(_0x9436('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9436('0x5'));var config=require(_0x9436('0x6'));var attributes=require(_0x9436('0x7'));module[_0x9436('0x8')]=function(_0x2a5744,_0x430d5c){return _0x2a5744['define'](_0x9436('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 64e47e1..f803ff6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0758=['CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnosuchnumberretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ccb8d,_0x529c1a){var _0x39d361=function(_0x28f512){while(--_0x28f512){_0x1ccb8d['push'](_0x1ccb8d['shift']());}};_0x39d361(++_0x529c1a);}(_0x0758,0x18b));var _0x8075=function(_0xc7bcf7,_0x11b0f8){_0xc7bcf7=_0xc7bcf7-0x0;var _0x214f24=_0x0758[_0xc7bcf7];return _0x214f24;};'use strict';var _=require('lodash');var util=require(_0x8075('0x0'));var moment=require(_0x8075('0x1'));var BPromise=require(_0x8075('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8075('0x3'));var db=require(_0x8075('0x4'))['db'];var utils=require(_0x8075('0x5'));var logger=require(_0x8075('0x6'))(_0x8075('0x7'));var config=require(_0x8075('0x8'));var jayson=require(_0x8075('0x9'));var client=jayson[_0x8075('0xa')][_0x8075('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c069,_0x5e0bf5,_0xb15836){return new BPromise(function(_0x3c706f,_0x288faa){return client[_0x8075('0xc')](_0x47c069,_0xb15836)[_0x8075('0xd')](function(_0x2005b0){logger[_0x8075('0xe')](_0x8075('0xf'),_0x5e0bf5,_0x8075('0x10'));logger[_0x8075('0x11')](_0x8075('0x12'),_0x5e0bf5,'request\x20sent',JSON[_0x8075('0x13')](_0x2005b0));if(_0x2005b0['error']){if(_0x2005b0[_0x8075('0x14')][_0x8075('0x15')]===0x1f4){logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x2005b0['error']['message']);return _0x288faa(_0x2005b0[_0x8075('0x14')][_0x8075('0x16')]);}logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x2005b0['error']['message']);return _0x3c706f(_0x2005b0[_0x8075('0x14')][_0x8075('0x16')]);}else{logger[_0x8075('0xe')](_0x8075('0xf'),_0x5e0bf5,'request\x20sent');_0x3c706f(_0x2005b0['result']['message']);}})[_0x8075('0x17')](function(_0x203dbb){logger[_0x8075('0x14')](_0x8075('0xf'),_0x5e0bf5,_0x203dbb);_0x288faa(_0x203dbb);});});}exports[_0x8075('0x18')]=function(_0x46df39){var _0x1c75dd=this;return new Promise(function(_0x269121,_0x273d41){return db[_0x8075('0x19')][_0x8075('0x1a')]({'raw':!![],'where':{'ContactId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1c')],'ListId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1d')],'VoiceQueueId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1e')]===undefined?null:_0x46df39['body'][_0x8075('0x1e')],'CampaignId':_0x46df39[_0x8075('0x1b')][_0x8075('0x1f')]===undefined?null:_0x46df39[_0x8075('0x1b')][_0x8075('0x1f')]}})['then'](function(_0x46361d){if(_0x46361d!=null){return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46361d['id'],'OrderBy':{'$gt':_0x46361d['OrderBy']}},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x4c3e56){var _0x5cd0=0x0;if(_0x4c3e56){if(_0x4c3e56[_0x8075('0x23')]+_0x4c3e56[_0x8075('0x24')]+_0x4c3e56[_0x8075('0x25')]+_0x4c3e56['countnosuchnumberretry']+_0x4c3e56[_0x8075('0x26')]+_0x4c3e56[_0x8075('0x27')]+_0x4c3e56[_0x8075('0x28')]+_0x4c3e56[_0x8075('0x29')]<_0x46df39[_0x8075('0x2a')]['dialGlobalMaxRetry'])_0x5cd0=0x1;_0x269121({'additional':_0x5cd0});}else{return db['CmHopperAdditionalPhone'][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x46361d['id']},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x2df049){var _0x48fc9f=0x0;if(_0x2df049){if(_0x2df049[_0x8075('0x23')]+_0x2df049[_0x8075('0x24')]+_0x2df049[_0x8075('0x25')]+_0x2df049[_0x8075('0x2b')]+_0x2df049[_0x8075('0x26')]+_0x2df049['countabandonedretry']+_0x2df049[_0x8075('0x28')]+_0x2df049[_0x8075('0x29')]<_0x46df39[_0x8075('0x2a')][_0x8075('0x2c')])_0x48fc9f=0x1;_0x269121({'additional':_0x48fc9f});}else{_0x269121({'additional':0x0});}})[_0x8075('0x17')](function(_0x1c7d4b){logger['error'](_0x8075('0x18'),_0x1c7d4b[_0x8075('0x16')]);_0x273d41(_0x1c75dd[_0x8075('0x14')](0x1f4,_0x1c7d4b[_0x8075('0x16')]));});}})[_0x8075('0x17')](function(_0x1ed9bc){logger[_0x8075('0x14')](_0x8075('0x18'),_0x1ed9bc[_0x8075('0x16')]);_0x273d41(_0x1c75dd[_0x8075('0x14')](0x1f4,_0x1ed9bc[_0x8075('0x16')]));});}else _0x269121({'additional':0x0});});});};exports[_0x8075('0x2d')]=function(_0x28e3f9){var _0x53709c=this;return new Promise(function(_0x24b964,_0x37f7e8){return db['CmHopper'][_0x8075('0x1a')]({'raw':!![],'where':{'ContactId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1c')],'ListId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1d')],'VoiceQueueId':_0x28e3f9[_0x8075('0x1b')]['VoiceQueueId']===undefined?null:_0x28e3f9[_0x8075('0x1b')]['VoiceQueueId'],'CampaignId':_0x28e3f9[_0x8075('0x1b')][_0x8075('0x1f')]===undefined?null:_0x28e3f9['body']['CampaignId']}})['then'](function(_0x637c1d){if(_0x637c1d!=null){return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x637c1d['id'],'OrderBy':{'$gte':_0x637c1d[_0x8075('0x21')]}},'order':[[_0x8075('0x21'),_0x8075('0x22')]]})[_0x8075('0xd')](function(_0x55a276){if(_0x55a276)return activateAdditionalPhone(_0x637c1d,_0x28e3f9[_0x8075('0x1b')],_0x55a276,_0x28e3f9[_0x8075('0x2e')],_0x28e3f9[_0x8075('0x2f')])['then'](function(_0x3fc6b1){_0x24b964(_0x3fc6b1);});else{return db[_0x8075('0x20')][_0x8075('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x637c1d['id']},'order':[['OrderBy',_0x8075('0x22')]]})['then'](function(_0xf40a98){if(_0xf40a98)return activateAdditionalPhone(_0x637c1d,_0x28e3f9[_0x8075('0x1b')],_0xf40a98,_0x28e3f9[_0x8075('0x2e')],_0x28e3f9[_0x8075('0x2f')])[_0x8075('0xd')](function(_0x2a708e){_0x24b964(_0x2a708e);});else{_0x24b964({'id':_0x637c1d['id'],'phone':''});}})[_0x8075('0x17')](function(_0x128414){logger[_0x8075('0x14')](_0x8075('0x18'),_0x128414[_0x8075('0x16')]);_0x37f7e8(_0x53709c[_0x8075('0x14')](0x1f4,_0x128414['message']));});}})['catch'](function(_0xb101e9){logger[_0x8075('0x14')](_0x8075('0x18'),_0xb101e9['message']);_0x37f7e8(_0x53709c[_0x8075('0x14')](0x1f4,_0xb101e9[_0x8075('0x16')]));});}else _0x24b964(0x1);});});};function activateAdditionalPhone(_0x4b92b7,_0x5d743a,_0x3ee3cb,_0x3b75ef,_0x5ee476){return new Promise(function(_0x3a72d9,_0x150266){var _0xb842fc;if(_['isNil'](_0x3ee3cb[_0x8075('0x30')])){_0x3ee3cb['scheduledat']=moment();}if(moment()>moment(_0x3ee3cb[_0x8075('0x30')])){_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}else{if(_0x3ee3cb['OrderBy']==0x0){_0xb842fc=moment(_0x3ee3cb[_0x8075('0x30')]);}else{_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}}if(_['isNil'](_0xb842fc)){_0xb842fc=moment()[_0x8075('0x31')](_0x5ee476||0x3,_0x8075('0x32'));}var _0x30cd27={'phone':_0x4b92b7[_0x8075('0x33')],'active':0x0,'OrderBy':_[_0x8075('0x34')](_0x4b92b7['OrderBy'])?0x0:_0x4b92b7['OrderBy'],'scheduledat':moment()[_0x8075('0x31')](_0x3b75ef||0x1,_0x8075('0x32')),'countbusyretry':_0x5d743a[_0x8075('0x23')],'countcongestionretry':_0x5d743a[_0x8075('0x24')],'countnoanswerretry':_0x5d743a['countnoanswerretry'],'countnosuchnumberretry':_0x5d743a[_0x8075('0x2b')],'countdropretry':_0x5d743a['countdropretry'],'countabandonedretry':_0x5d743a[_0x8075('0x27')],'countmachineretry':_0x5d743a[_0x8075('0x28')],'countagentrejectretry':_0x5d743a['countagentrejectretry'],'createdAt':_0x5d743a['createdAt'],'updatedAt':_0x5d743a['updatedAt']};var _0x468534={'CmHopperId':_0x4b92b7['id'],'phone':_0x3ee3cb[_0x8075('0x33')],'active':0x0,'OrderBy':_[_0x8075('0x34')](_0x3ee3cb['OrderBy'])?0x0:_0x3ee3cb[_0x8075('0x21')],'scheduledat':_0xb842fc,'countbusyretry':_0x3ee3cb[_0x8075('0x23')],'countcongestionretry':_0x3ee3cb['countcongestionretry'],'countnoanswerretry':_0x3ee3cb['countnoanswerretry'],'countnosuchnumberretry':_0x3ee3cb[_0x8075('0x2b')],'countdropretry':_0x3ee3cb[_0x8075('0x26')],'countabandonedretry':_0x3ee3cb[_0x8075('0x27')],'countmachineretry':_0x3ee3cb['countmachineretry'],'countagentrejectretry':_0x3ee3cb['countagentrejectretry'],'createdAt':_0x3ee3cb['createdAt'],'updatedAt':_0x3ee3cb[_0x8075('0x35')]};return db[_0x8075('0x36')]['transaction'](function(_0x3e260f){return db[_0x8075('0x20')][_0x8075('0x37')](_0x30cd27,{'where':{'id':_0x3ee3cb['id']}},{'transaction':_0x3e260f})[_0x8075('0xd')](function(){return db['CmHopper'][_0x8075('0x37')](_0x468534,{'where':{'id':_0x4b92b7['id']}},{'transaction':_0x3e260f});});})['then'](function(_0x102825){_0x3a72d9({'id':_0x4b92b7['id'],'phone':_0x3ee3cb[_0x8075('0x33')]});})[_0x8075('0x17')](function(_0x39c3a1){logger[_0x8075('0x14')](_0x8075('0x38'),_0x39c3a1['message']);_0x150266({'error':_0x39c3a1[_0x8075('0x16')]});});});}exports['IncrementPreviewCounters']=function(_0x44cf37){var _0x201195=this;return new Promise(function(_0x1e27af,_0x18870e){return db['CmHopper'][_0x8075('0x37')](_0x44cf37[_0x8075('0x1b')][_0x8075('0x39')],{'where':{'id':_0x44cf37[_0x8075('0x1b')]['id']}})[_0x8075('0xd')](function(_0x395675){_0x1e27af(_0x395675);})[_0x8075('0x17')](function(_0x3e0bf9){logger[_0x8075('0x14')](_0x8075('0x3a'),_0x3e0bf9[_0x8075('0x16')]);_0x18870e(_0x201195[_0x8075('0x14')](0x1f4,_0x3e0bf9[_0x8075('0x16')]));});});}; \ No newline at end of file +var _0x6379=['duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','countabandonedretry','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','catch','SwapAdditionalPhones','VoiceQueueId'];(function(_0x1254ad,_0x15f0d6){var _0x10f41f=function(_0x2e1739){while(--_0x2e1739){_0x1254ad['push'](_0x1254ad['shift']());}};_0x10f41f(++_0x15f0d6);}(_0x6379,0x19d));var _0x9637=function(_0x4ffab6,_0x303961){_0x4ffab6=_0x4ffab6-0x0;var _0x507dc7=_0x6379[_0x4ffab6];return _0x507dc7;};'use strict';var _=require(_0x9637('0x0'));var util=require('util');var moment=require(_0x9637('0x1'));var BPromise=require(_0x9637('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9637('0x3'));var db=require(_0x9637('0x4'))['db'];var utils=require(_0x9637('0x5'));var logger=require(_0x9637('0x6'))('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52d009,_0x55978b,_0x587140){return new BPromise(function(_0x17d9dc,_0x49683c){return client[_0x9637('0xb')](_0x52d009,_0x587140)[_0x9637('0xc')](function(_0x2bd7bf){logger[_0x9637('0xd')](_0x9637('0xe'),_0x55978b,'request\x20sent');logger[_0x9637('0xf')](_0x9637('0x10'),_0x55978b,_0x9637('0x11'),JSON[_0x9637('0x12')](_0x2bd7bf));if(_0x2bd7bf[_0x9637('0x13')]){if(_0x2bd7bf[_0x9637('0x13')]['code']===0x1f4){logger['error'](_0x9637('0xe'),_0x55978b,_0x2bd7bf['error'][_0x9637('0x14')]);return _0x49683c(_0x2bd7bf[_0x9637('0x13')][_0x9637('0x14')]);}logger[_0x9637('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x55978b,_0x2bd7bf[_0x9637('0x13')][_0x9637('0x14')]);return _0x17d9dc(_0x2bd7bf[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x55978b,_0x9637('0x11'));_0x17d9dc(_0x2bd7bf[_0x9637('0x15')][_0x9637('0x14')]);}})['catch'](function(_0x50a153){logger[_0x9637('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x55978b,_0x50a153);_0x49683c(_0x50a153);});});}exports[_0x9637('0x16')]=function(_0xe812e7){var _0x500729=this;return new Promise(function(_0x5c403b,_0x1e17f2){return db[_0x9637('0x17')][_0x9637('0x18')]({'raw':!![],'where':{'ContactId':_0xe812e7[_0x9637('0x19')][_0x9637('0x1a')],'ListId':_0xe812e7[_0x9637('0x19')]['ListId'],'VoiceQueueId':_0xe812e7['body']['VoiceQueueId']===undefined?null:_0xe812e7[_0x9637('0x19')]['VoiceQueueId'],'CampaignId':_0xe812e7[_0x9637('0x19')][_0x9637('0x1b')]===undefined?null:_0xe812e7[_0x9637('0x19')][_0x9637('0x1b')]}})[_0x9637('0xc')](function(_0x5b81f4){if(_0x5b81f4!=null){return db[_0x9637('0x1c')][_0x9637('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5b81f4['id'],'OrderBy':{'$gt':_0x5b81f4[_0x9637('0x1d')]}},'order':[[_0x9637('0x1d'),'ASC']]})['then'](function(_0x267ff1){var _0xc780d=0x0;if(_0x267ff1){if(_0x267ff1[_0x9637('0x1e')]+_0x267ff1[_0x9637('0x1f')]+_0x267ff1[_0x9637('0x20')]+_0x267ff1[_0x9637('0x21')]+_0x267ff1[_0x9637('0x22')]+_0x267ff1['countabandonedretry']+_0x267ff1[_0x9637('0x23')]+_0x267ff1[_0x9637('0x24')]<_0xe812e7[_0x9637('0x25')][_0x9637('0x26')])_0xc780d=0x1;_0x5c403b({'additional':_0xc780d});}else{return db[_0x9637('0x1c')][_0x9637('0x18')]({'raw':!![],'where':{'CmHopperId':_0x5b81f4['id']},'order':[[_0x9637('0x1d'),_0x9637('0x27')]]})['then'](function(_0x2ef454){var _0x3086ec=0x0;if(_0x2ef454){if(_0x2ef454['countbusyretry']+_0x2ef454[_0x9637('0x1f')]+_0x2ef454[_0x9637('0x20')]+_0x2ef454[_0x9637('0x21')]+_0x2ef454[_0x9637('0x22')]+_0x2ef454['countabandonedretry']+_0x2ef454[_0x9637('0x23')]+_0x2ef454[_0x9637('0x24')]<_0xe812e7[_0x9637('0x25')][_0x9637('0x26')])_0x3086ec=0x1;_0x5c403b({'additional':_0x3086ec});}else{_0x5c403b({'additional':0x0});}})[_0x9637('0x28')](function(_0x3d7566){logger[_0x9637('0x13')](_0x9637('0x16'),_0x3d7566[_0x9637('0x14')]);_0x1e17f2(_0x500729[_0x9637('0x13')](0x1f4,_0x3d7566[_0x9637('0x14')]));});}})[_0x9637('0x28')](function(_0x22839e){logger['error'](_0x9637('0x16'),_0x22839e[_0x9637('0x14')]);_0x1e17f2(_0x500729[_0x9637('0x13')](0x1f4,_0x22839e['message']));});}else _0x5c403b({'additional':0x0});});});};exports[_0x9637('0x29')]=function(_0x3f6802){var _0x4fa1f9=this;return new Promise(function(_0x21e021,_0x163f6c){return db[_0x9637('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x3f6802['body'][_0x9637('0x1a')],'ListId':_0x3f6802[_0x9637('0x19')]['ListId'],'VoiceQueueId':_0x3f6802[_0x9637('0x19')][_0x9637('0x2a')]===undefined?null:_0x3f6802['body'][_0x9637('0x2a')],'CampaignId':_0x3f6802['body'][_0x9637('0x1b')]===undefined?null:_0x3f6802[_0x9637('0x19')][_0x9637('0x1b')]}})[_0x9637('0xc')](function(_0x3dacd3){if(_0x3dacd3!=null){return db[_0x9637('0x1c')][_0x9637('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3dacd3['id'],'OrderBy':{'$gte':_0x3dacd3[_0x9637('0x1d')]}},'order':[[_0x9637('0x1d'),_0x9637('0x27')]]})['then'](function(_0x244ce3){if(_0x244ce3)return activateAdditionalPhone(_0x3dacd3,_0x3f6802[_0x9637('0x19')],_0x244ce3,_0x3f6802[_0x9637('0x2b')],_0x3f6802[_0x9637('0x2c')])[_0x9637('0xc')](function(_0x5866e3){_0x21e021(_0x5866e3);});else{return db[_0x9637('0x1c')][_0x9637('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3dacd3['id']},'order':[['OrderBy','ASC']]})[_0x9637('0xc')](function(_0x16a8f1){if(_0x16a8f1)return activateAdditionalPhone(_0x3dacd3,_0x3f6802['body'],_0x16a8f1,_0x3f6802[_0x9637('0x2b')],_0x3f6802['waitTime'])['then'](function(_0x52c0b7){_0x21e021(_0x52c0b7);});else{_0x21e021({'id':_0x3dacd3['id'],'phone':''});}})[_0x9637('0x28')](function(_0x24c36f){logger[_0x9637('0x13')](_0x9637('0x16'),_0x24c36f[_0x9637('0x14')]);_0x163f6c(_0x4fa1f9[_0x9637('0x13')](0x1f4,_0x24c36f['message']));});}})['catch'](function(_0x406a49){logger[_0x9637('0x13')](_0x9637('0x16'),_0x406a49['message']);_0x163f6c(_0x4fa1f9[_0x9637('0x13')](0x1f4,_0x406a49['message']));});}else _0x21e021(0x1);});});};function activateAdditionalPhone(_0x25cb44,_0x17d814,_0x389fb9,_0x17f2bc,_0x483b8b){return new Promise(function(_0x115f91,_0x25d835){var _0x2f59ee;if(_[_0x9637('0x2d')](_0x389fb9['scheduledat'])){_0x389fb9[_0x9637('0x2e')]=moment();}if(moment()>moment(_0x389fb9[_0x9637('0x2e')])){_0x2f59ee=moment()[_0x9637('0x2f')](_0x483b8b||0x3,_0x9637('0x30'));}else{if(_0x389fb9['OrderBy']==0x0){_0x2f59ee=moment(_0x389fb9[_0x9637('0x2e')]);}else{_0x2f59ee=moment()[_0x9637('0x2f')](_0x483b8b||0x3,_0x9637('0x30'));}}if(_[_0x9637('0x2d')](_0x2f59ee)){_0x2f59ee=moment()[_0x9637('0x2f')](_0x483b8b||0x3,_0x9637('0x30'));}var _0x30be4a={'phone':_0x25cb44[_0x9637('0x31')],'active':0x0,'OrderBy':_[_0x9637('0x2d')](_0x25cb44[_0x9637('0x1d')])?0x0:_0x25cb44['OrderBy'],'scheduledat':moment()[_0x9637('0x2f')](_0x17f2bc||0x1,_0x9637('0x30')),'countbusyretry':_0x17d814[_0x9637('0x1e')],'countcongestionretry':_0x17d814['countcongestionretry'],'countnoanswerretry':_0x17d814[_0x9637('0x20')],'countnosuchnumberretry':_0x17d814[_0x9637('0x21')],'countdropretry':_0x17d814[_0x9637('0x22')],'countabandonedretry':_0x17d814['countabandonedretry'],'countmachineretry':_0x17d814[_0x9637('0x23')],'countagentrejectretry':_0x17d814[_0x9637('0x24')],'createdAt':_0x17d814['createdAt'],'updatedAt':_0x17d814[_0x9637('0x32')]};var _0x1d7846={'CmHopperId':_0x25cb44['id'],'phone':_0x389fb9['phone'],'active':0x0,'OrderBy':_['isNil'](_0x389fb9[_0x9637('0x1d')])?0x0:_0x389fb9['OrderBy'],'scheduledat':_0x2f59ee,'countbusyretry':_0x389fb9[_0x9637('0x1e')],'countcongestionretry':_0x389fb9[_0x9637('0x1f')],'countnoanswerretry':_0x389fb9[_0x9637('0x20')],'countnosuchnumberretry':_0x389fb9[_0x9637('0x21')],'countdropretry':_0x389fb9[_0x9637('0x22')],'countabandonedretry':_0x389fb9[_0x9637('0x33')],'countmachineretry':_0x389fb9['countmachineretry'],'countagentrejectretry':_0x389fb9[_0x9637('0x24')],'createdAt':_0x389fb9['createdAt'],'updatedAt':_0x389fb9[_0x9637('0x32')]};return db[_0x9637('0x34')][_0x9637('0x35')](function(_0x5a581c){return db[_0x9637('0x1c')][_0x9637('0x36')](_0x30be4a,{'where':{'id':_0x389fb9['id']}},{'transaction':_0x5a581c})[_0x9637('0xc')](function(){return db['CmHopper'][_0x9637('0x36')](_0x1d7846,{'where':{'id':_0x25cb44['id']}},{'transaction':_0x5a581c});});})[_0x9637('0xc')](function(_0x1f293a){_0x115f91({'id':_0x25cb44['id'],'phone':_0x389fb9[_0x9637('0x31')]});})[_0x9637('0x28')](function(_0x16321a){logger[_0x9637('0x13')]('activateAdditionalPhone',_0x16321a[_0x9637('0x14')]);_0x25d835({'error':_0x16321a['message']});});});}exports[_0x9637('0x37')]=function(_0x290bfa){var _0x180480=this;return new Promise(function(_0x1fd082,_0xac3fff){return db[_0x9637('0x17')][_0x9637('0x36')](_0x290bfa[_0x9637('0x19')][_0x9637('0x38')],{'where':{'id':_0x290bfa[_0x9637('0x19')]['id']}})['then'](function(_0x9bae16){_0x1fd082(_0x9bae16);})['catch'](function(_0x35c7d8){logger[_0x9637('0x13')]('IncrementPreviewCounters',_0x35c7d8['message']);_0xac3fff(_0x180480['error'](0x1f4,_0x35c7d8[_0x9637('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 5616a25..06f2f60 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bf2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','/:id','show','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bf2,0xa3));var _0x24bf=function(_0xe3b7bb,_0x263836){_0xe3b7bb=_0xe3b7bb-0x0;var _0x2df486=_0x4bf2[_0xe3b7bb];return _0x2df486;};'use strict';var multer=require('multer');var util=require(_0x24bf('0x0'));var path=require(_0x24bf('0x1'));var timeout=require(_0x24bf('0x2'));var express=require(_0x24bf('0x3'));var router=express[_0x24bf('0x4')]();var fs_extra=require(_0x24bf('0x5'));var auth=require(_0x24bf('0x6'));var interaction=require(_0x24bf('0x7'));var config=require(_0x24bf('0x8'));var controller=require(_0x24bf('0x9'));router['get']('/',auth[_0x24bf('0xa')](),controller['index']);router['get'](_0x24bf('0xb'),auth[_0x24bf('0xa')](),controller[_0x24bf('0xc')]);router['post']('/',auth[_0x24bf('0xa')](),controller[_0x24bf('0xd')]);router[_0x24bf('0xe')](_0x24bf('0xb'),auth['isAuthenticated'](),controller[_0x24bf('0xf')]);router[_0x24bf('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x24bf('0x11')]=router; \ No newline at end of file +var _0xbc5e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer'];(function(_0x10153f,_0x165bd6){var _0x42b00d=function(_0x40fca0){while(--_0x40fca0){_0x10153f['push'](_0x10153f['shift']());}};_0x42b00d(++_0x165bd6);}(_0xbc5e,0x7d));var _0xebc5=function(_0x26cb84,_0x59462a){_0x26cb84=_0x26cb84-0x0;var _0x4d54fa=_0xbc5e[_0x26cb84];return _0x4d54fa;};'use strict';var multer=require(_0xebc5('0x0'));var util=require(_0xebc5('0x1'));var path=require(_0xebc5('0x2'));var timeout=require(_0xebc5('0x3'));var express=require(_0xebc5('0x4'));var router=express[_0xebc5('0x5')]();var fs_extra=require(_0xebc5('0x6'));var auth=require(_0xebc5('0x7'));var interaction=require(_0xebc5('0x8'));var config=require('../../config/environment');var controller=require(_0xebc5('0x9'));router[_0xebc5('0xa')]('/',auth[_0xebc5('0xb')](),controller[_0xebc5('0xc')]);router[_0xebc5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xebc5('0xd')]);router[_0xebc5('0xe')]('/',auth[_0xebc5('0xb')](),controller[_0xebc5('0xf')]);router['put'](_0xebc5('0x10'),auth['isAuthenticated'](),controller[_0xebc5('0x11')]);router[_0xebc5('0x12')]('/:id',auth[_0xebc5('0xb')](),controller[_0xebc5('0x13')]);module[_0xebc5('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 8a73324..91dbf08 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 _0x6363=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x243011,_0x2be6dc){var _0x5eb4c0=function(_0x1c5cff){while(--_0x1c5cff){_0x243011['push'](_0x243011['shift']());}};_0x5eb4c0(++_0x2be6dc);}(_0x6363,0x13a));var _0x3636=function(_0x13b15e,_0x45fe46){_0x13b15e=_0x13b15e-0x0;var _0x2ef81c=_0x6363[_0x13b15e];return _0x2ef81c;};'use strict';var moment=require(_0x3636('0x0'));var Sequelize=require('sequelize');module[_0x3636('0x1')]={'phone':{'type':Sequelize[_0x3636('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')},'ListId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')},'VoiceQueueId':{'type':Sequelize[_0x3636('0x3')],'unique':_0x3636('0x4')}}; \ No newline at end of file +var _0x84cb=['moment','exports','INTEGER','contactListQueue'];(function(_0x133fe4,_0x1f473b){var _0x4c4017=function(_0x3c1fb1){while(--_0x3c1fb1){_0x133fe4['push'](_0x133fe4['shift']());}};_0x4c4017(++_0x1f473b);}(_0x84cb,0xf8));var _0xb84c=function(_0x22bf60,_0x21611c){_0x22bf60=_0x22bf60-0x0;var _0x42ed96=_0x84cb[_0x22bf60];return _0x42ed96;};'use strict';var moment=require(_0xb84c('0x0'));var Sequelize=require('sequelize');module[_0xb84c('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb84c('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb84c('0x2')],'unique':_0xb84c('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb84c('0x2')],'unique':_0xb84c('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f6c37cb..239d98c 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 _0x97f4=['../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x14c04f,_0x1ac242){var _0x5300df=function(_0x56d8f5){while(--_0x56d8f5){_0x14c04f['push'](_0x14c04f['shift']());}};_0x5300df(++_0x1ac242);}(_0x97f4,0xcf));var _0x497f=function(_0x4a1daf,_0x2c758a){_0x4a1daf=_0x4a1daf-0x0;var _0x2df426=_0x97f4[_0x4a1daf];return _0x2df426;};'use strict';var emlformat=require(_0x497f('0x0'));var rimraf=require(_0x497f('0x1'));var zipdir=require(_0x497f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x497f('0x3'));var moment=require(_0x497f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x497f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x497f('0x6'));var csv=require(_0x497f('0x7'));var ejs=require(_0x497f('0x8'));var fs=require('fs');var fs_extra=require(_0x497f('0x9'));var _=require(_0x497f('0xa'));var squel=require('squel');var crypto=require(_0x497f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x497f('0xc'));var toCsv=require(_0x497f('0x7'));var querystring=require(_0x497f('0xd'));var Papa=require(_0x497f('0xe'));var Redis=require('ioredis');var authService=require(_0x497f('0xf'));var qs=require(_0x497f('0x10'));var as=require(_0x497f('0x11'));var hardwareService=require(_0x497f('0x12'));var logger=require(_0x497f('0x13'))(_0x497f('0x14'));var utils=require(_0x497f('0x15'));var config=require(_0x497f('0x16'));var licenseUtil=require(_0x497f('0x17'));var db=require(_0x497f('0x18'))['db'];function respondWithStatusCode(_0x3b9ae7,_0x2e4335){_0x2e4335=_0x2e4335||0xcc;return function(_0x3342b1){if(_0x3342b1){return _0x3b9ae7['sendStatus'](_0x2e4335);}return _0x3b9ae7[_0x497f('0x19')](_0x2e4335)[_0x497f('0x1a')]();};}function respondWithResult(_0x4bca08,_0x5c8b52){_0x5c8b52=_0x5c8b52||0xc8;return function(_0xfa4099){if(_0xfa4099){return _0x4bca08['status'](_0x5c8b52)[_0x497f('0x1b')](_0xfa4099);}};}function respondWithFilteredResult(_0x5caa29,_0xf0f44c){return function(_0x25775f){if(_0x25775f){var _0x981941=typeof _0xf0f44c[_0x497f('0x1c')]==='undefined'&&typeof _0xf0f44c[_0x497f('0x1d')]===_0x497f('0x1e');var _0x3beac5=_0x25775f[_0x497f('0x1f')];var _0xc2692e=_0x981941?0x0:_0xf0f44c[_0x497f('0x1c')];var _0x512ce5=_0x981941?_0x25775f[_0x497f('0x1f')]:_0xf0f44c[_0x497f('0x1c')]+_0xf0f44c[_0x497f('0x1d')];var _0x3a160c;if(_0x512ce5>=_0x3beac5){_0x512ce5=_0x3beac5;_0x3a160c=0xc8;}else{_0x3a160c=0xce;}_0x5caa29[_0x497f('0x19')](_0x3a160c);return _0x5caa29[_0x497f('0x20')](_0x497f('0x21'),_0xc2692e+'-'+_0x512ce5+'/'+_0x3beac5)[_0x497f('0x1b')](_0x25775f);}return null;};}function patchUpdates(_0x544ecc){return function(_0x31760c){try{jsonpatch[_0x497f('0x22')](_0x31760c,_0x544ecc,!![]);}catch(_0x14b54a){return BPromise[_0x497f('0x23')](_0x14b54a);}return _0x31760c[_0x497f('0x24')]();};}function saveUpdates(_0x1ea4cb,_0x1e31ae){return function(_0xe8f13b){if(_0xe8f13b){return _0xe8f13b[_0x497f('0x25')](_0x1ea4cb)[_0x497f('0x26')](function(_0x4bca0c){return _0x4bca0c;});}return null;};}function removeEntity(_0x1adcf2,_0x3af3ea){return function(_0x18a73f){if(_0x18a73f){return _0x18a73f['destroy']()[_0x497f('0x26')](function(){_0x1adcf2[_0x497f('0x19')](0xcc)[_0x497f('0x1a')]();});}};}function handleEntityNotFound(_0x2f9cd8,_0x519b4d){return function(_0x518c39){if(!_0x518c39){_0x2f9cd8[_0x497f('0x27')](0x194);}return _0x518c39;};}function handleError(_0x984d3a,_0x38ecad){_0x38ecad=_0x38ecad||0x1f4;return function(_0x250fa6){logger[_0x497f('0x28')](_0x250fa6[_0x497f('0x29')]);if(_0x250fa6[_0x497f('0x2a')]){delete _0x250fa6[_0x497f('0x2a')];}_0x984d3a[_0x497f('0x19')](_0x38ecad)[_0x497f('0x2b')](_0x250fa6);};}exports['index']=function(_0x15b01c,_0x43841c){var _0x3f2417={},_0x4bce4e={},_0x4e73ea={'count':0x0,'rows':[]};var _0x164efe=_[_0x497f('0x2c')](db[_0x497f('0x2d')][_0x497f('0x2e')],function(_0x31e618){return{'name':_0x31e618[_0x497f('0x2f')],'type':_0x31e618[_0x497f('0x30')][_0x497f('0x31')]};});_0x4bce4e[_0x497f('0x32')]=_[_0x497f('0x2c')](_0x164efe,'name');_0x4bce4e[_0x497f('0x33')]=_['keys'](_0x15b01c[_0x497f('0x33')]);_0x4bce4e['filters']=_[_0x497f('0x34')](_0x4bce4e[_0x497f('0x32')],_0x4bce4e[_0x497f('0x33')]);_0x3f2417[_0x497f('0x35')]=_[_0x497f('0x34')](_0x4bce4e[_0x497f('0x32')],qs[_0x497f('0x36')](_0x15b01c['query'][_0x497f('0x36')]));_0x3f2417['attributes']=_0x3f2417['attributes'][_0x497f('0x37')]?_0x3f2417[_0x497f('0x35')]:_0x4bce4e[_0x497f('0x32')];if(!_0x15b01c[_0x497f('0x33')][_0x497f('0x38')](_0x497f('0x39'))){_0x3f2417[_0x497f('0x1d')]=qs[_0x497f('0x1d')](_0x15b01c['query'][_0x497f('0x1d')]);_0x3f2417[_0x497f('0x1c')]=qs[_0x497f('0x1c')](_0x15b01c[_0x497f('0x33')][_0x497f('0x1c')]);}_0x3f2417[_0x497f('0x3a')]=qs[_0x497f('0x3b')](_0x15b01c['query'][_0x497f('0x3b')]);_0x3f2417[_0x497f('0x3c')]=qs[_0x497f('0x3d')](_['pick'](_0x15b01c[_0x497f('0x33')],_0x4bce4e[_0x497f('0x3d')]),_0x164efe);if(_0x15b01c['query'][_0x497f('0x3e')]){_0x3f2417['where']=_[_0x497f('0x3f')](_0x3f2417[_0x497f('0x3c')],{'$or':_[_0x497f('0x2c')](_0x164efe,function(_0x2c256d){if(_0x2c256d[_0x497f('0x30')]!==_0x497f('0x40')){var _0x1ea0b7={};_0x1ea0b7[_0x2c256d['name']]={'$like':'%'+_0x15b01c[_0x497f('0x33')][_0x497f('0x3e')]+'%'};return _0x1ea0b7;}})});}_0x3f2417=_[_0x497f('0x3f')]({},_0x3f2417,_0x15b01c['options']);var _0x4fa9ef={'where':_0x3f2417[_0x497f('0x3c')]};return db[_0x497f('0x2d')][_0x497f('0x1f')](_0x4fa9ef)['then'](function(_0x4dbf1a){_0x4e73ea['count']=_0x4dbf1a;if(_0x15b01c['query'][_0x497f('0x41')]){_0x3f2417[_0x497f('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x497f('0x43')](_0x3f2417);})[_0x497f('0x26')](function(_0x2e9317){_0x4e73ea['rows']=_0x2e9317;return _0x4e73ea;})[_0x497f('0x26')](respondWithFilteredResult(_0x43841c,_0x3f2417))[_0x497f('0x44')](handleError(_0x43841c,null));};exports[_0x497f('0x45')]=function(_0x4914d6,_0x428974){var _0xf0dc25={'raw':!![],'where':{'id':_0x4914d6[_0x497f('0x46')]['id']}},_0x2e6c24={};_0x2e6c24[_0x497f('0x32')]=_[_0x497f('0x47')](db[_0x497f('0x2d')]['rawAttributes']);_0x2e6c24[_0x497f('0x33')]=_[_0x497f('0x47')](_0x4914d6[_0x497f('0x33')]);_0x2e6c24['filters']=_[_0x497f('0x34')](_0x2e6c24[_0x497f('0x32')],_0x2e6c24[_0x497f('0x33')]);_0xf0dc25['attributes']=_['intersection'](_0x2e6c24[_0x497f('0x32')],qs[_0x497f('0x36')](_0x4914d6[_0x497f('0x33')][_0x497f('0x36')]));_0xf0dc25[_0x497f('0x35')]=_0xf0dc25['attributes'][_0x497f('0x37')]?_0xf0dc25[_0x497f('0x35')]:_0x2e6c24[_0x497f('0x32')];if(_0x4914d6['query'][_0x497f('0x41')]){_0xf0dc25[_0x497f('0x42')]=[{'all':!![]}];}_0xf0dc25=_[_0x497f('0x3f')]({},_0xf0dc25,_0x4914d6[_0x497f('0x48')]);return db[_0x497f('0x2d')]['find'](_0xf0dc25)[_0x497f('0x26')](handleEntityNotFound(_0x428974,null))['then'](respondWithResult(_0x428974,null))[_0x497f('0x44')](handleError(_0x428974,null));};exports[_0x497f('0x25')]=function(_0x40a9f1,_0x234c6d){if(_0x40a9f1[_0x497f('0x49')]['id']){delete _0x40a9f1[_0x497f('0x49')]['id'];}return db['CmHopperBlack'][_0x497f('0x4a')]({'where':{'id':_0x40a9f1['params']['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x234c6d,null))[_0x497f('0x26')](saveUpdates(_0x40a9f1[_0x497f('0x49')],null))[_0x497f('0x26')](respondWithResult(_0x234c6d,null))[_0x497f('0x44')](handleError(_0x234c6d,null));};exports[_0x497f('0x4b')]=function(_0x46b85e,_0x74c76d){return db['CmHopperBlack'][_0x497f('0x4a')]({'where':{'id':_0x46b85e[_0x497f('0x46')]['id']}})[_0x497f('0x26')](handleEntityNotFound(_0x74c76d,null))['then'](removeEntity(_0x74c76d,null))['catch'](handleError(_0x74c76d,null));};exports[_0x497f('0x4c')]=function(_0x3be6a4,_0x6ff5e5){return db['CmHopperBlack']['describe']()[_0x497f('0x26')](respondWithResult(_0x6ff5e5,null))[_0x497f('0x44')](handleError(_0x6ff5e5,null));}; \ No newline at end of file +var _0x8544=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','CmHopperBlack','fieldName','key','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','model','find','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x482686,_0x24b099){var _0x401d43=function(_0x54000e){while(--_0x54000e){_0x482686['push'](_0x482686['shift']());}};_0x401d43(++_0x24b099);}(_0x8544,0x11c));var _0x4854=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x8544[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0x4854('0x0'));var rimraf=require(_0x4854('0x1'));var zipdir=require(_0x4854('0x2'));var jsonpatch=require(_0x4854('0x3'));var rp=require('request-promise');var moment=require(_0x4854('0x4'));var BPromise=require(_0x4854('0x5'));var Mustache=require(_0x4854('0x6'));var util=require(_0x4854('0x7'));var path=require(_0x4854('0x8'));var sox=require(_0x4854('0x9'));var csv=require(_0x4854('0xa'));var ejs=require(_0x4854('0xb'));var fs=require('fs');var fs_extra=require(_0x4854('0xc'));var _=require(_0x4854('0xd'));var squel=require(_0x4854('0xe'));var crypto=require(_0x4854('0xf'));var jsforce=require(_0x4854('0x10'));var deskjs=require(_0x4854('0x11'));var toCsv=require(_0x4854('0xa'));var querystring=require(_0x4854('0x12'));var Papa=require('papaparse');var Redis=require(_0x4854('0x13'));var authService=require(_0x4854('0x14'));var qs=require(_0x4854('0x15'));var as=require(_0x4854('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4854('0x17'))(_0x4854('0x18'));var utils=require(_0x4854('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x4854('0x1a'));var db=require(_0x4854('0x1b'))['db'];function respondWithStatusCode(_0x26dbfd,_0x1f9c2b){_0x1f9c2b=_0x1f9c2b||0xcc;return function(_0x132796){if(_0x132796){return _0x26dbfd[_0x4854('0x1c')](_0x1f9c2b);}return _0x26dbfd[_0x4854('0x1d')](_0x1f9c2b)[_0x4854('0x1e')]();};}function respondWithResult(_0x59ecac,_0x383580){_0x383580=_0x383580||0xc8;return function(_0xd43a02){if(_0xd43a02){return _0x59ecac[_0x4854('0x1d')](_0x383580)['json'](_0xd43a02);}};}function respondWithFilteredResult(_0x4d25e1,_0x5aeafe){return function(_0x5efaed){if(_0x5efaed){var _0x3b80cf=typeof _0x5aeafe[_0x4854('0x1f')]===_0x4854('0x20')&&typeof _0x5aeafe[_0x4854('0x21')]===_0x4854('0x20');var _0x514b32=_0x5efaed[_0x4854('0x22')];var _0x10fbd2=_0x3b80cf?0x0:_0x5aeafe[_0x4854('0x1f')];var _0x2e7ecd=_0x3b80cf?_0x5efaed[_0x4854('0x22')]:_0x5aeafe[_0x4854('0x1f')]+_0x5aeafe[_0x4854('0x21')];var _0xe93230;if(_0x2e7ecd>=_0x514b32){_0x2e7ecd=_0x514b32;_0xe93230=0xc8;}else{_0xe93230=0xce;}_0x4d25e1[_0x4854('0x1d')](_0xe93230);return _0x4d25e1[_0x4854('0x23')](_0x4854('0x24'),_0x10fbd2+'-'+_0x2e7ecd+'/'+_0x514b32)['json'](_0x5efaed);}return null;};}function patchUpdates(_0x4eb4ea){return function(_0x2c27f1){try{jsonpatch[_0x4854('0x25')](_0x2c27f1,_0x4eb4ea,!![]);}catch(_0x2c1dc5){return BPromise[_0x4854('0x26')](_0x2c1dc5);}return _0x2c27f1[_0x4854('0x27')]();};}function saveUpdates(_0x5026f5,_0x101803){return function(_0x3ad899){if(_0x3ad899){return _0x3ad899['update'](_0x5026f5)[_0x4854('0x28')](function(_0x4d29f4){return _0x4d29f4;});}return null;};}function removeEntity(_0x549456,_0x337d67){return function(_0x24336b){if(_0x24336b){return _0x24336b[_0x4854('0x29')]()[_0x4854('0x28')](function(){_0x549456[_0x4854('0x1d')](0xcc)[_0x4854('0x1e')]();});}};}function handleEntityNotFound(_0x1f1df2,_0x1f275d){return function(_0x4a5e08){if(!_0x4a5e08){_0x1f1df2[_0x4854('0x1c')](0x194);}return _0x4a5e08;};}function handleError(_0x40205b,_0x249c10){_0x249c10=_0x249c10||0x1f4;return function(_0xc2335){logger[_0x4854('0x2a')](_0xc2335[_0x4854('0x2b')]);if(_0xc2335[_0x4854('0x2c')]){delete _0xc2335[_0x4854('0x2c')];}_0x40205b[_0x4854('0x1d')](_0x249c10)[_0x4854('0x2d')](_0xc2335);};}exports[_0x4854('0x2e')]=function(_0x1f401e,_0x586cf4){var _0x1ebf15={},_0x139444={},_0x4ab15b={'count':0x0,'rows':[]};var _0x40a655=_['map'](db[_0x4854('0x2f')]['rawAttributes'],function(_0x17c82a){return{'name':_0x17c82a[_0x4854('0x30')],'type':_0x17c82a['type'][_0x4854('0x31')]};});_0x139444['model']=_[_0x4854('0x32')](_0x40a655,_0x4854('0x2c'));_0x139444['query']=_[_0x4854('0x33')](_0x1f401e[_0x4854('0x34')]);_0x139444[_0x4854('0x35')]=_[_0x4854('0x36')](_0x139444['model'],_0x139444[_0x4854('0x34')]);_0x1ebf15[_0x4854('0x37')]=_['intersection'](_0x139444['model'],qs[_0x4854('0x38')](_0x1f401e['query'][_0x4854('0x38')]));_0x1ebf15[_0x4854('0x37')]=_0x1ebf15[_0x4854('0x37')][_0x4854('0x39')]?_0x1ebf15['attributes']:_0x139444['model'];if(!_0x1f401e[_0x4854('0x34')][_0x4854('0x3a')](_0x4854('0x3b'))){_0x1ebf15[_0x4854('0x21')]=qs[_0x4854('0x21')](_0x1f401e[_0x4854('0x34')][_0x4854('0x21')]);_0x1ebf15[_0x4854('0x1f')]=qs[_0x4854('0x1f')](_0x1f401e['query'][_0x4854('0x1f')]);}_0x1ebf15['order']=qs[_0x4854('0x3c')](_0x1f401e[_0x4854('0x34')][_0x4854('0x3c')]);_0x1ebf15[_0x4854('0x3d')]=qs[_0x4854('0x35')](_[_0x4854('0x3e')](_0x1f401e[_0x4854('0x34')],_0x139444[_0x4854('0x35')]),_0x40a655);if(_0x1f401e[_0x4854('0x34')][_0x4854('0x3f')]){_0x1ebf15[_0x4854('0x3d')]=_[_0x4854('0x40')](_0x1ebf15[_0x4854('0x3d')],{'$or':_[_0x4854('0x32')](_0x40a655,function(_0x1b1975){if(_0x1b1975[_0x4854('0x41')]!==_0x4854('0x42')){var _0xf9fbb3={};_0xf9fbb3[_0x1b1975[_0x4854('0x2c')]]={'$like':'%'+_0x1f401e['query']['filter']+'%'};return _0xf9fbb3;}})});}_0x1ebf15=_[_0x4854('0x40')]({},_0x1ebf15,_0x1f401e[_0x4854('0x43')]);var _0x433e7f={'where':_0x1ebf15[_0x4854('0x3d')]};return db[_0x4854('0x2f')][_0x4854('0x22')](_0x433e7f)[_0x4854('0x28')](function(_0x1b18ec){_0x4ab15b['count']=_0x1b18ec;if(_0x1f401e[_0x4854('0x34')][_0x4854('0x44')]){_0x1ebf15[_0x4854('0x45')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1ebf15);})[_0x4854('0x28')](function(_0x3c5969){_0x4ab15b[_0x4854('0x46')]=_0x3c5969;return _0x4ab15b;})[_0x4854('0x28')](respondWithFilteredResult(_0x586cf4,_0x1ebf15))[_0x4854('0x47')](handleError(_0x586cf4,null));};exports[_0x4854('0x48')]=function(_0x4e5c9d,_0x44e881){var _0x36204d={'raw':!![],'where':{'id':_0x4e5c9d['params']['id']}},_0x213039={};_0x213039[_0x4854('0x49')]=_[_0x4854('0x33')](db[_0x4854('0x2f')]['rawAttributes']);_0x213039[_0x4854('0x34')]=_[_0x4854('0x33')](_0x4e5c9d['query']);_0x213039[_0x4854('0x35')]=_[_0x4854('0x36')](_0x213039['model'],_0x213039['query']);_0x36204d['attributes']=_[_0x4854('0x36')](_0x213039['model'],qs[_0x4854('0x38')](_0x4e5c9d[_0x4854('0x34')][_0x4854('0x38')]));_0x36204d[_0x4854('0x37')]=_0x36204d[_0x4854('0x37')][_0x4854('0x39')]?_0x36204d['attributes']:_0x213039['model'];if(_0x4e5c9d['query'][_0x4854('0x44')]){_0x36204d[_0x4854('0x45')]=[{'all':!![]}];}_0x36204d=_[_0x4854('0x40')]({},_0x36204d,_0x4e5c9d['options']);return db['CmHopperBlack'][_0x4854('0x4a')](_0x36204d)[_0x4854('0x28')](handleEntityNotFound(_0x44e881,null))[_0x4854('0x28')](respondWithResult(_0x44e881,null))[_0x4854('0x47')](handleError(_0x44e881,null));};exports[_0x4854('0x4b')]=function(_0x478d9e,_0x17530d){if(_0x478d9e['body']['id']){delete _0x478d9e['body']['id'];}return db[_0x4854('0x2f')][_0x4854('0x4a')]({'where':{'id':_0x478d9e[_0x4854('0x4c')]['id']}})[_0x4854('0x28')](handleEntityNotFound(_0x17530d,null))[_0x4854('0x28')](saveUpdates(_0x478d9e['body'],null))[_0x4854('0x28')](respondWithResult(_0x17530d,null))[_0x4854('0x47')](handleError(_0x17530d,null));};exports[_0x4854('0x29')]=function(_0x4c1e54,_0x23138e){return db[_0x4854('0x2f')]['find']({'where':{'id':_0x4c1e54['params']['id']}})[_0x4854('0x28')](handleEntityNotFound(_0x23138e,null))[_0x4854('0x28')](removeEntity(_0x23138e,null))[_0x4854('0x47')](handleError(_0x23138e,null));};exports[_0x4854('0x4d')]=function(_0x2056fd,_0x4a3727){return db[_0x4854('0x2f')][_0x4854('0x4d')]()[_0x4854('0x28')](respondWithResult(_0x4a3727,null))[_0x4854('0x47')](handleError(_0x4a3727,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6458c28..2f1ac9f 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 _0x58b8=['rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x58b8,0x14b));var _0x858b=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0x58b8[_0x10d618];return _0x57d044;};'use strict';var _=require(_0x858b('0x0'));var util=require(_0x858b('0x1'));var logger=require('../../config/logger')(_0x858b('0x2'));var moment=require(_0x858b('0x3'));var BPromise=require(_0x858b('0x4'));var rp=require(_0x858b('0x5'));var fs=require('fs');var path=require(_0x858b('0x6'));var rimraf=require(_0x858b('0x7'));var config=require('../../config/environment');var attributes=require(_0x858b('0x8'));module[_0x858b('0x9')]=function(_0x28cb38,_0x6895bb){return _0x28cb38[_0x858b('0xa')](_0x858b('0xb'),attributes,{'tableName':_0x858b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0913=['./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x18dc32,_0x26d38e){var _0x2adfaf=function(_0x59f994){while(--_0x59f994){_0x18dc32['push'](_0x18dc32['shift']());}};_0x2adfaf(++_0x26d38e);}(_0x0913,0x7d));var _0x3091=function(_0x3738d7,_0x5e5fac){_0x3738d7=_0x3738d7-0x0;var _0x4315d9=_0x0913[_0x3738d7];return _0x4315d9;};'use strict';var _=require('lodash');var util=require(_0x3091('0x0'));var logger=require(_0x3091('0x1'))(_0x3091('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3091('0x3'));var fs=require('fs');var path=require(_0x3091('0x4'));var rimraf=require(_0x3091('0x5'));var config=require(_0x3091('0x6'));var attributes=require(_0x3091('0x7'));module['exports']=function(_0x4dd438,_0x259349){return _0x4dd438[_0x3091('0x8')](_0x3091('0x9'),attributes,{'tableName':_0x3091('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 9ff8658..a67a363 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 _0xe820=['body','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','request\x20sent','stringify','code','error','message','CmHopperBlack,\x20%s,\x20%s','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe820,0x106));var _0x0e82=function(_0x6746d4,_0x2734c3){_0x6746d4=_0x6746d4-0x0;var _0x24c311=_0xe820[_0x6746d4];return _0x24c311;};'use strict';var _=require('lodash');var util=require(_0x0e82('0x0'));var moment=require(_0x0e82('0x1'));var BPromise=require(_0x0e82('0x2'));var rs=require(_0x0e82('0x3'));var fs=require('fs');var Redis=require(_0x0e82('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e82('0x5'));var logger=require(_0x0e82('0x6'))(_0x0e82('0x7'));var config=require(_0x0e82('0x8'));var jayson=require(_0x0e82('0x9'));var client=jayson[_0x0e82('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15fad5,_0x225bd3,_0x4ed6da){return new BPromise(function(_0x480711,_0x1a2280){return client['request'](_0x15fad5,_0x4ed6da)[_0x0e82('0xb')](function(_0x2616b4){logger[_0x0e82('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,'request\x20sent');logger[_0x0e82('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x225bd3,_0x0e82('0xe'),JSON[_0x0e82('0xf')](_0x2616b4));if(_0x2616b4['error']){if(_0x2616b4['error'][_0x0e82('0x10')]===0x1f4){logger[_0x0e82('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);return _0x1a2280(_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);}logger[_0x0e82('0x11')](_0x0e82('0x13'),_0x225bd3,_0x2616b4[_0x0e82('0x11')][_0x0e82('0x12')]);return _0x480711(_0x2616b4['error']['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x225bd3,_0x0e82('0xe'));_0x480711(_0x2616b4[_0x0e82('0x14')]['message']);}})[_0x0e82('0x15')](function(_0x4ce50c){logger[_0x0e82('0x11')](_0x0e82('0x13'),_0x225bd3,_0x4ce50c);_0x1a2280(_0x4ce50c);});});}exports[_0x0e82('0x16')]=function(_0x5b80ba){var _0x3c494c=this;return new Promise(function(_0x5722d7,_0x5dc582){return db[_0x0e82('0x17')]['findAll']({'raw':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x19')]===undefined?!![]:![]:!![],'where':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1a')]||null:null,'attributes':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1b')]||null:null,'limit':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')][_0x0e82('0x1c')]||null:null,'include':_0x5b80ba[_0x0e82('0x18')]?_0x5b80ba[_0x0e82('0x18')]['include']?_[_0x0e82('0x1d')](_0x5b80ba['options'][_0x0e82('0x1e')],function(_0x32e49a){return{'model':db[_0x32e49a[_0x0e82('0x1f')]],'as':_0x32e49a['as'],'attributes':_0x32e49a[_0x0e82('0x1b')],'include':_0x32e49a['include']?_[_0x0e82('0x1d')](_0x32e49a[_0x0e82('0x1e')],function(_0x51db1e){return{'model':db[_0x51db1e[_0x0e82('0x1f')]],'as':_0x51db1e['as'],'attributes':_0x51db1e[_0x0e82('0x1b')],'include':_0x51db1e['include']?_[_0x0e82('0x1d')](_0x51db1e['include'],function(_0x4cea92){return{'model':db[_0x4cea92['model']],'as':_0x4cea92['as'],'attributes':_0x4cea92['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xaa52f9){logger[_0x0e82('0xc')]('GetCmHopperBlack',_0x5b80ba);logger[_0x0e82('0xd')]('GetCmHopperBlack',_0x5b80ba,JSON[_0x0e82('0xf')](_0xaa52f9));_0x5722d7(_0xaa52f9);})['catch'](function(_0x48e6da){logger['error'](_0x0e82('0x16'),_0x48e6da['message'],_0x5b80ba);_0x5dc582(_0x3c494c[_0x0e82('0x11')](0x1f4,_0x48e6da[_0x0e82('0x12')]));});});};exports[_0x0e82('0x20')]=function(_0x43e963){var _0x46e903=this;return new Promise(function(_0x1949a7,_0x2ebe89){return db['CmHopperBlack'][_0x0e82('0x21')](_0x43e963[_0x0e82('0x22')],{'raw':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e963[_0x0e82('0x18')]?_0x43e963['options'][_0x0e82('0x1a')]||null:null,'attributes':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')]['attributes']||null:null,'limit':_0x43e963[_0x0e82('0x18')]?_0x43e963[_0x0e82('0x18')][_0x0e82('0x1c')]||null:null})['then'](function(_0x333ff2){logger[_0x0e82('0xc')](_0x0e82('0x20'),_0x43e963);logger[_0x0e82('0xd')](_0x0e82('0x20'),_0x43e963,JSON[_0x0e82('0xf')](_0x333ff2));_0x1949a7(_0x333ff2);})[_0x0e82('0x15')](function(_0x19d2de){logger[_0x0e82('0x11')](_0x0e82('0x20'),_0x19d2de[_0x0e82('0x12')],_0x43e963);_0x2ebe89(_0x46e903[_0x0e82('0x11')](0x1f4,_0x19d2de[_0x0e82('0x12')]));});});};exports[_0x0e82('0x23')]=function(_0x4cd9f0){var _0xaf6a71=this;return new Promise(function(_0x274ec8,_0x2592c3){return db[_0x0e82('0x17')][_0x0e82('0x24')]({'where':_0x4cd9f0['options']?_0x4cd9f0[_0x0e82('0x18')][_0x0e82('0x1a')]||null:null})[_0x0e82('0xb')](function(_0x4d5220){logger[_0x0e82('0xc')](_0x0e82('0x23'),_0x4cd9f0);logger[_0x0e82('0xd')]('DestroyCmHopperBlack',_0x4cd9f0,JSON[_0x0e82('0xf')](_0x4d5220));_0x274ec8(_0x4d5220);})['catch'](function(_0x2926e5){logger[_0x0e82('0x11')]('DestroyCmHopperBlack',_0x2926e5[_0x0e82('0x12')],_0x4cd9f0);_0x2592c3(_0xaf6a71[_0x0e82('0x11')](0x1f4,_0x2926e5['message']));});});}; \ No newline at end of file +var _0xd9c9=['error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','include','map','attributes','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xd9c9,0xb5));var _0x9d9c=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0xd9c9[_0x224ad0];return _0x2e04fc;};'use strict';var _=require(_0x9d9c('0x0'));var util=require(_0x9d9c('0x1'));var moment=require(_0x9d9c('0x2'));var BPromise=require(_0x9d9c('0x3'));var rs=require(_0x9d9c('0x4'));var fs=require('fs');var Redis=require(_0x9d9c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d9c('0x6'));var logger=require(_0x9d9c('0x7'))(_0x9d9c('0x8'));var config=require('../../config/environment');var jayson=require(_0x9d9c('0x9'));var client=jayson[_0x9d9c('0xa')][_0x9d9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x174238,_0x5b7dcb,_0x291355){return new BPromise(function(_0x407b3b,_0x5a7f06){return client[_0x9d9c('0xc')](_0x174238,_0x291355)[_0x9d9c('0xd')](function(_0x4e8632){logger[_0x9d9c('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x5b7dcb,_0x9d9c('0xf'));logger[_0x9d9c('0x10')](_0x9d9c('0x11'),_0x5b7dcb,_0x9d9c('0xf'),JSON[_0x9d9c('0x12')](_0x4e8632));if(_0x4e8632[_0x9d9c('0x13')]){if(_0x4e8632['error'][_0x9d9c('0x14')]===0x1f4){logger['error'](_0x9d9c('0x15'),_0x5b7dcb,_0x4e8632[_0x9d9c('0x13')][_0x9d9c('0x16')]);return _0x5a7f06(_0x4e8632[_0x9d9c('0x13')][_0x9d9c('0x16')]);}logger[_0x9d9c('0x13')](_0x9d9c('0x15'),_0x5b7dcb,_0x4e8632['error'][_0x9d9c('0x16')]);return _0x407b3b(_0x4e8632[_0x9d9c('0x13')][_0x9d9c('0x16')]);}else{logger['info'](_0x9d9c('0x15'),_0x5b7dcb,_0x9d9c('0xf'));_0x407b3b(_0x4e8632['result'][_0x9d9c('0x16')]);}})[_0x9d9c('0x17')](function(_0x5f1612){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x5b7dcb,_0x5f1612);_0x5a7f06(_0x5f1612);});});}exports[_0x9d9c('0x18')]=function(_0x3799fa){var _0x4312d1=this;return new Promise(function(_0x5131f2,_0x14c22c){return db[_0x9d9c('0x19')][_0x9d9c('0x1a')]({'raw':_0x3799fa['options']?_0x3799fa[_0x9d9c('0x1b')][_0x9d9c('0x1c')]===undefined?!![]:![]:!![],'where':_0x3799fa[_0x9d9c('0x1b')]?_0x3799fa[_0x9d9c('0x1b')][_0x9d9c('0x1d')]||null:null,'attributes':_0x3799fa[_0x9d9c('0x1b')]?_0x3799fa['options']['attributes']||null:null,'limit':_0x3799fa[_0x9d9c('0x1b')]?_0x3799fa['options'][_0x9d9c('0x1e')]||null:null,'include':_0x3799fa[_0x9d9c('0x1b')]?_0x3799fa[_0x9d9c('0x1b')][_0x9d9c('0x1f')]?_[_0x9d9c('0x20')](_0x3799fa[_0x9d9c('0x1b')][_0x9d9c('0x1f')],function(_0x3ea50c){return{'model':db[_0x3ea50c['model']],'as':_0x3ea50c['as'],'attributes':_0x3ea50c[_0x9d9c('0x21')],'include':_0x3ea50c[_0x9d9c('0x1f')]?_[_0x9d9c('0x20')](_0x3ea50c[_0x9d9c('0x1f')],function(_0x38598e){return{'model':db[_0x38598e[_0x9d9c('0x22')]],'as':_0x38598e['as'],'attributes':_0x38598e[_0x9d9c('0x21')],'include':_0x38598e[_0x9d9c('0x1f')]?_[_0x9d9c('0x20')](_0x38598e['include'],function(_0x4b2881){return{'model':db[_0x4b2881[_0x9d9c('0x22')]],'as':_0x4b2881['as'],'attributes':_0x4b2881[_0x9d9c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9d9c('0xd')](function(_0x1b9711){logger[_0x9d9c('0xe')](_0x9d9c('0x18'),_0x3799fa);logger[_0x9d9c('0x10')](_0x9d9c('0x18'),_0x3799fa,JSON[_0x9d9c('0x12')](_0x1b9711));_0x5131f2(_0x1b9711);})[_0x9d9c('0x17')](function(_0x3ee25b){logger[_0x9d9c('0x13')](_0x9d9c('0x18'),_0x3ee25b[_0x9d9c('0x16')],_0x3799fa);_0x14c22c(_0x4312d1[_0x9d9c('0x13')](0x1f4,_0x3ee25b[_0x9d9c('0x16')]));});});};exports[_0x9d9c('0x23')]=function(_0x45d76e){var _0x545e3d=this;return new Promise(function(_0x4ab2a0,_0x24354f){return db[_0x9d9c('0x19')][_0x9d9c('0x24')](_0x45d76e[_0x9d9c('0x25')],{'raw':_0x45d76e['options']?_0x45d76e[_0x9d9c('0x1b')][_0x9d9c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45d76e[_0x9d9c('0x1b')]?_0x45d76e[_0x9d9c('0x1b')][_0x9d9c('0x1d')]||null:null,'attributes':_0x45d76e[_0x9d9c('0x1b')]?_0x45d76e[_0x9d9c('0x1b')][_0x9d9c('0x21')]||null:null,'limit':_0x45d76e[_0x9d9c('0x1b')]?_0x45d76e[_0x9d9c('0x1b')][_0x9d9c('0x1e')]||null:null})[_0x9d9c('0xd')](function(_0x297da5){logger['info'](_0x9d9c('0x23'),_0x45d76e);logger[_0x9d9c('0x10')]('UpdateCmHopperBlack',_0x45d76e,JSON[_0x9d9c('0x12')](_0x297da5));_0x4ab2a0(_0x297da5);})['catch'](function(_0x434ba0){logger[_0x9d9c('0x13')](_0x9d9c('0x23'),_0x434ba0[_0x9d9c('0x16')],_0x45d76e);_0x24354f(_0x545e3d['error'](0x1f4,_0x434ba0['message']));});});};exports[_0x9d9c('0x26')]=function(_0x33da8a){var _0x260aa8=this;return new Promise(function(_0x5d45f4,_0x226783){return db[_0x9d9c('0x19')][_0x9d9c('0x27')]({'where':_0x33da8a['options']?_0x33da8a[_0x9d9c('0x1b')][_0x9d9c('0x1d')]||null:null})[_0x9d9c('0xd')](function(_0x5e9b50){logger['info']('DestroyCmHopperBlack',_0x33da8a);logger[_0x9d9c('0x10')](_0x9d9c('0x26'),_0x33da8a,JSON[_0x9d9c('0x12')](_0x5e9b50));_0x5d45f4(_0x5e9b50);})[_0x9d9c('0x17')](function(_0x551da1){logger[_0x9d9c('0x13')]('DestroyCmHopperBlack',_0x551da1[_0x9d9c('0x16')],_0x33da8a);_0x226783(_0x260aa8['error'](0x1f4,_0x551da1[_0x9d9c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 233ee82..f0b9539 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 _0xef17=['show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','describe'];(function(_0xfc1071,_0x46736b){var _0x12e63d=function(_0x5af5a1){while(--_0x5af5a1){_0xfc1071['push'](_0xfc1071['shift']());}};_0x12e63d(++_0x46736b);}(_0xef17,0x136));var _0x7ef1=function(_0x2ca8a3,_0x174c0f){_0x2ca8a3=_0x2ca8a3-0x0;var _0x24aa82=_0xef17[_0x2ca8a3];return _0x24aa82;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require(_0x7ef1('0x3'));var express=require(_0x7ef1('0x4'));var router=express[_0x7ef1('0x5')]();var fs_extra=require(_0x7ef1('0x6'));var auth=require(_0x7ef1('0x7'));var interaction=require(_0x7ef1('0x8'));var config=require('../../config/environment');var controller=require(_0x7ef1('0x9'));router['get']('/',auth[_0x7ef1('0xa')](),controller['index']);router[_0x7ef1('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0xb')]('/:id',auth[_0x7ef1('0xa')](),controller[_0x7ef1('0xd')]);router[_0x7ef1('0xe')](_0x7ef1('0xf'),auth[_0x7ef1('0xa')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7ef1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xed1c=['describe','/:id','show','put','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x42f7a2,_0xd5200d){var _0x588cc8=function(_0x58b167){while(--_0x58b167){_0x42f7a2['push'](_0x42f7a2['shift']());}};_0x588cc8(++_0xd5200d);}(_0xed1c,0xe4));var _0xced1=function(_0x4ca17a,_0x2423aa){_0x4ca17a=_0x4ca17a-0x0;var _0x1fc70d=_0xed1c[_0x4ca17a];return _0x1fc70d;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0xd')]('/:id',auth[_0xced1('0x7')](),controller['update']);router[_0xced1('0xe')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xf')]);module[_0xced1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 072fa69..e08a096 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 _0xa728=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','exports'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0xa728,0x9a));var _0x8a72=function(_0x3e391d,_0x28d6fc){_0x3e391d=_0x3e391d-0x0;var _0x1855ef=_0xa728[_0x3e391d];return _0x1855ef;};'use strict';var Sequelize=require(_0x8a72('0x0'));var moment=require('moment');module[_0x8a72('0x1')]={'state':{'type':Sequelize[_0x8a72('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x8a72('0x3')]},'scheduledat':{'type':Sequelize[_0x8a72('0x4')]},'countbusyretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8a72('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8a72('0x3')]},'originatecalleridname':{'type':Sequelize[_0x8a72('0x3')]},'calleridnum':{'type':Sequelize[_0x8a72('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8a72('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8a72('0x4')]},'droptime':{'type':Sequelize[_0x8a72('0x4')]},'endtime':{'type':Sequelize[_0x8a72('0x4')]},'ringtime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8a72('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x8a72('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8a72('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8a72('0x3')]},'dispositionat':{'type':Sequelize[_0x8a72('0x4')],'set':function(_0x462712){var _0x35a695=this[_0x8a72('0x5')](_0x8a72('0x6'));if(_0x35a695&&_0x462712){this[_0x8a72('0x7')](_0x8a72('0x8'),moment(_0x462712)[_0x8a72('0x9')](moment(_0x35a695),_0x8a72('0xa')));}}},'amd':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8a72('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8a72('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8a72('0x4')]},'recallme':{'type':Sequelize[_0x8a72('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8a72('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8a72('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8213=['sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','BOOLEAN'];(function(_0x3fa6ab,_0x3181e2){var _0x310f2c=function(_0x5a70dc){while(--_0x5a70dc){_0x3fa6ab['push'](_0x3fa6ab['shift']());}};_0x310f2c(++_0x3181e2);}(_0x8213,0x1b8));var _0x3821=function(_0x2c82d9,_0x17271f){_0x2c82d9=_0x2c82d9-0x0;var _0x37782e=_0x8213[_0x2c82d9];return _0x37782e;};'use strict';var Sequelize=require(_0x3821('0x0'));var moment=require('moment');module[_0x3821('0x1')]={'state':{'type':Sequelize[_0x3821('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3821('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3821('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3821('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3821('0x4')]},'responsetime':{'type':Sequelize[_0x3821('0x4')]},'answertime':{'type':Sequelize[_0x3821('0x4')]},'droptime':{'type':Sequelize[_0x3821('0x4')]},'endtime':{'type':Sequelize[_0x3821('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3821('0x3')]},'campaigntype':{'type':Sequelize[_0x3821('0x3')]},'membername':{'type':Sequelize[_0x3821('0x3')]},'reason':{'type':Sequelize[_0x3821('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3821('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3821('0x3')]},'dispositionat':{'type':Sequelize[_0x3821('0x4')],'set':function(_0x435dbd){var _0x351fa8=this[_0x3821('0x5')](_0x3821('0x6'));if(_0x351fa8&&_0x435dbd){this[_0x3821('0x7')]('followuptime',moment(_0x435dbd)[_0x3821('0x8')](moment(_0x351fa8),_0x3821('0x9')));}}},'amd':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3821('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3821('0x4')]},'deleted':{'type':Sequelize[_0x3821('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3821('0x4')]},'recallme':{'type':Sequelize[_0x3821('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3821('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3821('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 0a06e19..8ba8cc8 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 _0xd8fb=['updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','toString','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','reCallContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt'];(function(_0x4f04b5,_0x5b91c2){var _0x1b3b58=function(_0x4a3ee9){while(--_0x4a3ee9){_0x4f04b5['push'](_0x4f04b5['shift']());}};_0x1b3b58(++_0x5b91c2);}(_0xd8fb,0x99));var _0xbd8f=function(_0x4d0131,_0x1197fb){_0x4d0131=_0x4d0131-0x0;var _0x23c7cc=_0xd8fb[_0x4d0131];return _0x23c7cc;};'use strict';var emlformat=require(_0xbd8f('0x0'));var rimraf=require(_0xbd8f('0x1'));var zipdir=require(_0xbd8f('0x2'));var jsonpatch=require(_0xbd8f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd8f('0x4'));var util=require(_0xbd8f('0x5'));var path=require('path');var sox=require(_0xbd8f('0x6'));var csv=require(_0xbd8f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd8f('0x8'));var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var licenseUtil=require(_0xbd8f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230988,_0x159f09){_0x159f09=_0x159f09||0xcc;return function(_0x39be16){if(_0x39be16){return _0x230988[_0xbd8f('0x14')](_0x159f09);}return _0x230988[_0xbd8f('0x15')](_0x159f09)[_0xbd8f('0x16')]();};}function respondWithResult(_0x37d4d5,_0x29ffe8){_0x29ffe8=_0x29ffe8||0xc8;return function(_0x14606c){if(_0x14606c){return _0x37d4d5['status'](_0x29ffe8)[_0xbd8f('0x17')](_0x14606c);}};}function respondWithFilteredResult(_0x829fb2,_0xa57e91){return function(_0x10d72e){if(_0x10d72e){var _0x4da96f=typeof _0xa57e91[_0xbd8f('0x18')]===_0xbd8f('0x19')&&typeof _0xa57e91['limit']===_0xbd8f('0x19');var _0xf5e7a=_0x10d72e['count'];var _0x4435b9=_0x4da96f?0x0:_0xa57e91[_0xbd8f('0x18')];var _0x47d317=_0x4da96f?_0x10d72e['count']:_0xa57e91[_0xbd8f('0x18')]+_0xa57e91['limit'];var _0x5705c5;if(_0x47d317>=_0xf5e7a){_0x47d317=_0xf5e7a;_0x5705c5=0xc8;}else{_0x5705c5=0xce;}_0x829fb2[_0xbd8f('0x15')](_0x5705c5);return _0x829fb2['set'](_0xbd8f('0x1a'),_0x4435b9+'-'+_0x47d317+'/'+_0xf5e7a)[_0xbd8f('0x17')](_0x10d72e);}return null;};}function patchUpdates(_0xb47c8e){return function(_0x897f25){try{jsonpatch[_0xbd8f('0x1b')](_0x897f25,_0xb47c8e,!![]);}catch(_0x20cab7){return BPromise[_0xbd8f('0x1c')](_0x20cab7);}return _0x897f25[_0xbd8f('0x1d')]();};}function saveUpdates(_0x2fbe3b,_0x775acc){return function(_0xfe4048){if(_0xfe4048){return _0xfe4048[_0xbd8f('0x1e')](_0x2fbe3b)[_0xbd8f('0x1f')](function(_0x15c4a9){return _0x15c4a9;});}return null;};}function removeEntity(_0x320ede,_0xd11ae){return function(_0x395b1b){if(_0x395b1b){return _0x395b1b['destroy']()[_0xbd8f('0x1f')](function(){_0x320ede[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x2f3df7,_0xa88414){return function(_0x2257fd){if(!_0x2257fd){_0x2f3df7[_0xbd8f('0x14')](0x194);}return _0x2257fd;};}function handleError(_0x264e62,_0x4ea554){_0x4ea554=_0x4ea554||0x1f4;return function(_0x40cb43){logger[_0xbd8f('0x20')](_0x40cb43['stack']);if(_0x40cb43[_0xbd8f('0x21')]){delete _0x40cb43['name'];}_0x264e62[_0xbd8f('0x15')](_0x4ea554)[_0xbd8f('0x22')](_0x40cb43);};}exports[_0xbd8f('0x23')]=function(_0x202126,_0x2aefa2){var _0x247b07={},_0x4c4431={},_0x166de7={'count':0x0,'rows':[]};var _0x14f3cb=_[_0xbd8f('0x24')](db[_0xbd8f('0x25')][_0xbd8f('0x26')],function(_0x2ac26f){return{'name':_0x2ac26f[_0xbd8f('0x27')],'type':_0x2ac26f['type'][_0xbd8f('0x28')]};});_0x4c4431[_0xbd8f('0x29')]=_[_0xbd8f('0x24')](_0x14f3cb,_0xbd8f('0x21'));_0x4c4431['query']=_['keys'](_0x202126[_0xbd8f('0x2a')]);_0x4c4431[_0xbd8f('0x2b')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],_0x4c4431['query']);_0x247b07[_0xbd8f('0x2d')]=_[_0xbd8f('0x2c')](_0x4c4431[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x202126[_0xbd8f('0x2a')]['fields']));_0x247b07[_0xbd8f('0x2d')]=_0x247b07[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x247b07[_0xbd8f('0x2d')]:_0x4c4431[_0xbd8f('0x29')];if(!_0x202126['query'][_0xbd8f('0x30')]('nolimit')){_0x247b07[_0xbd8f('0x31')]=qs[_0xbd8f('0x31')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x31')]);_0x247b07[_0xbd8f('0x18')]=qs[_0xbd8f('0x18')](_0x202126['query']['offset']);}_0x247b07['order']=qs[_0xbd8f('0x32')](_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x32')]);_0x247b07[_0xbd8f('0x33')]=qs[_0xbd8f('0x2b')](_[_0xbd8f('0x34')](_0x202126[_0xbd8f('0x2a')],_0x4c4431[_0xbd8f('0x2b')]),_0x14f3cb);if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]){_0x247b07[_0xbd8f('0x33')]=_[_0xbd8f('0x36')](_0x247b07[_0xbd8f('0x33')],{'$or':_[_0xbd8f('0x24')](_0x14f3cb,function(_0x391d45){if(_0x391d45['type']!==_0xbd8f('0x37')){var _0x4181e0={};_0x4181e0[_0x391d45['name']]={'$like':'%'+_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x35')]+'%'};return _0x4181e0;}})});}_0x247b07=_[_0xbd8f('0x36')]({},_0x247b07,_0x202126['options']);var _0x21da54={'where':_0x247b07['where']};return db[_0xbd8f('0x25')][_0xbd8f('0x38')](_0x21da54)[_0xbd8f('0x1f')](function(_0x4f2ebc){_0x166de7[_0xbd8f('0x38')]=_0x4f2ebc;if(_0x202126[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x247b07['include']=[{'all':!![]}];}return db[_0xbd8f('0x25')][_0xbd8f('0x3a')](_0x247b07);})[_0xbd8f('0x1f')](function(_0x351027){_0x166de7[_0xbd8f('0x3b')]=_0x351027;return _0x166de7;})[_0xbd8f('0x1f')](respondWithFilteredResult(_0x2aefa2,_0x247b07))[_0xbd8f('0x3c')](handleError(_0x2aefa2,null));};exports[_0xbd8f('0x3d')]=function(_0x14b768,_0x5e1e77){var _0x52c62b={'raw':!![],'where':{'id':_0x14b768[_0xbd8f('0x3e')]['id']}},_0x2907a3={};_0x2907a3[_0xbd8f('0x29')]=_[_0xbd8f('0x3f')](db['CmHopperFinal'][_0xbd8f('0x26')]);_0x2907a3[_0xbd8f('0x2a')]=_[_0xbd8f('0x3f')](_0x14b768[_0xbd8f('0x2a')]);_0x2907a3[_0xbd8f('0x2b')]=_['intersection'](_0x2907a3['model'],_0x2907a3[_0xbd8f('0x2a')]);_0x52c62b['attributes']=_[_0xbd8f('0x2c')](_0x2907a3[_0xbd8f('0x29')],qs[_0xbd8f('0x2e')](_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x2e')]));_0x52c62b[_0xbd8f('0x2d')]=_0x52c62b[_0xbd8f('0x2d')][_0xbd8f('0x2f')]?_0x52c62b['attributes']:_0x2907a3[_0xbd8f('0x29')];if(_0x14b768[_0xbd8f('0x2a')][_0xbd8f('0x39')]){_0x52c62b[_0xbd8f('0x40')]=[{'all':!![]}];}_0x52c62b=_[_0xbd8f('0x36')]({},_0x52c62b,_0x14b768[_0xbd8f('0x41')]);return db[_0xbd8f('0x25')][_0xbd8f('0x42')](_0x52c62b)['then'](handleEntityNotFound(_0x5e1e77,null))[_0xbd8f('0x1f')](respondWithResult(_0x5e1e77,null))[_0xbd8f('0x3c')](handleError(_0x5e1e77,null));};exports[_0xbd8f('0x43')]=function(_0x1f12dd,_0x2fdbd0){return db[_0xbd8f('0x25')][_0xbd8f('0x43')]()[_0xbd8f('0x1f')](respondWithResult(_0x2fdbd0,null))[_0xbd8f('0x3c')](handleError(_0x2fdbd0,null));};exports[_0xbd8f('0x1e')]=function(_0x406741,_0x255c59){if(_0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')]){delete _0x406741[_0xbd8f('0x44')][_0xbd8f('0x45')];}return db[_0xbd8f('0x25')][_0xbd8f('0x42')]({'where':{'uniqueid':_0x406741[_0xbd8f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x255c59,null))[_0xbd8f('0x1f')](saveUpdates(_0x406741[_0xbd8f('0x44')],null))[_0xbd8f('0x1f')](respondWithResult(_0x255c59,null))[_0xbd8f('0x3c')](handleError(_0x255c59,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x1b38ad,_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'VoiceQueueId':_0x1b38ad[_0xbd8f('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')]('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),_0xbd8f('0x51')],[db['sequelize']['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),'reCallContacts'],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x5a33c5,null))[_0xbd8f('0x1f')](respondWithResult(_0x5a33c5,null))[_0xbd8f('0x3c')](handleError(_0x5a33c5,null));};exports[_0xbd8f('0x54')]=function(_0x93452d,_0x4a86a9,_0x5ea275){return db[_0xbd8f('0x25')][_0xbd8f('0x3a')]({'raw':![],'where':{'CampaignId':_0x93452d[_0xbd8f('0x3e')]['id']},'attributes':[[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x49')))),_0xbd8f('0x4a')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x4b')))),_0xbd8f('0x4c')],[db[_0xbd8f('0x47')]['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xbd8f('0x4d')],[db[_0xbd8f('0x47')]['fn'](_0xbd8f('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd8f('0x48')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x4e')))),_0xbd8f('0x4f')],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x50')))),'abandonedContacts'],[db['sequelize']['fn'](_0xbd8f('0x46'),db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')][_0xbd8f('0x48')](_0xbd8f('0x52')))),_0xbd8f('0x55')],[db['sequelize']['fn']('COUNT',db[_0xbd8f('0x47')]['fn']('IF',db[_0xbd8f('0x47')]['literal'](_0xbd8f('0x56')))),_0xbd8f('0x53')]]})['then'](handleEntityNotFound(_0x4a86a9,null))[_0xbd8f('0x1f')](respondWithResult(_0x4a86a9,null))[_0xbd8f('0x3c')](handleError(_0x4a86a9,null));};exports[_0xbd8f('0x57')]=function(_0x5a8c8f,_0x5c04d9,_0x2407e7){return db[_0xbd8f('0x58')][_0xbd8f('0x42')]({'where':{'id':_0x5a8c8f[_0xbd8f('0x3e')]['id']}})[_0xbd8f('0x1f')](handleEntityNotFound(_0x5c04d9,null))['then'](function(_0x200718){var _0x27ec14;if(_0x200718){_0x27ec14=squel[_0xbd8f('0x59')]()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x61'),_0xbd8f('0x62'),_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x66'),_0xbd8f('0x5d'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),'ListId')['field'](_0xbd8f('0x69'),_0xbd8f('0x61'))['field'](_0xbd8f('0x6a'),'createdAt')[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')]('cm_hopper_final')[_0xbd8f('0x33')](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x5a8c8f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')](_0xbd8f('0x5d'))[_0xbd8f('0x6b')]('cm_hopper')[_0xbd8f('0x33')]('VoiceQueueId\x20=\x20?',_0x5a8c8f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()[_0xbd8f('0x65')](_0xbd8f('0x71'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))['where'](_0xbd8f('0x6c'),_0x5a8c8f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')]('state\x20=\x204'))['group'](_0xbd8f('0x5f')))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x27ec14);}return[];})[_0xbd8f('0x1f')](respondWithResult(_0x5c04d9,null))['catch'](handleError(_0x5c04d9,null));};exports[_0xbd8f('0x74')]=function(_0x13314f,_0x328bd6,_0x11a05a){return db[_0xbd8f('0x75')]['find']({'where':{'id':_0x13314f['params']['id']}})['then'](handleEntityNotFound(_0x328bd6,null))[_0xbd8f('0x1f')](function(_0x5df0e1){var _0x535869;if(_0x5df0e1){_0x535869=squel['insert']()[_0xbd8f('0x5a')](_0xbd8f('0x5b'))[_0xbd8f('0x5c')]([_0xbd8f('0x5d'),_0xbd8f('0x5e'),_0xbd8f('0x5f'),_0xbd8f('0x60'),_0xbd8f('0x76'),'createdAt',_0xbd8f('0x63')],squel[_0xbd8f('0x64')]()[_0xbd8f('0x65')]('ANY_VALUE(calleridnum)',_0xbd8f('0x5d'))[_0xbd8f('0x65')](_0xbd8f('0x6a'),_0xbd8f('0x5e'))[_0xbd8f('0x65')](_0xbd8f('0x67'),_0xbd8f('0x5f'))[_0xbd8f('0x65')](_0xbd8f('0x68'),_0xbd8f('0x60'))['field'](_0xbd8f('0x77'),_0xbd8f('0x76'))[_0xbd8f('0x65')]('NOW()',_0xbd8f('0x62'))['field'](_0xbd8f('0x6a'),_0xbd8f('0x63'))[_0xbd8f('0x6b')](_0xbd8f('0x72'))[_0xbd8f('0x33')]('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x6d'),_0x13314f[_0xbd8f('0x44')][_0xbd8f('0x6e')]['toString']())[_0xbd8f('0x33')](_0xbd8f('0x6f'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xbd8f('0x64')]()['field']('phone')['from'](_0xbd8f('0x5b'))[_0xbd8f('0x33')](_0xbd8f('0x78'),_0x13314f[_0xbd8f('0x3e')]['id']['toString']()))[_0xbd8f('0x33')](_0xbd8f('0x70'),squel['select']()['field'](_0xbd8f('0x71'))['from'](_0xbd8f('0x72'))['where']('CampaignId\x20=\x20?',_0x13314f[_0xbd8f('0x3e')]['id'][_0xbd8f('0x73')]())[_0xbd8f('0x33')](_0xbd8f('0x79')))[_0xbd8f('0x7a')]('ContactId'))[_0xbd8f('0x73')]();return db[_0xbd8f('0x47')][_0xbd8f('0x2a')](_0x535869);}return[];})['then'](respondWithResult(_0x328bd6,null))[_0xbd8f('0x3c')](handleError(_0x328bd6,null));};exports[_0xbd8f('0x7b')]=function(_0x38d1a6,_0x31b92c,_0x11fb11){return db[_0xbd8f('0x7c')][_0xbd8f('0x7d')]({'where':{'VoiceQueueId':_0x38d1a6[_0xbd8f('0x44')][_0xbd8f('0x61')],'CampaignId':_0x38d1a6[_0xbd8f('0x44')]['CampaignId'],'ContactId':_0x38d1a6['body']['ContactId']}})['then'](handleEntityNotFound(_0x31b92c,null))[_0xbd8f('0x1f')](function(_0x3ff503){if(_0x3ff503){return _0x3ff503;}return null;})['then'](respondWithResult(_0x31b92c,null))['catch'](handleError(_0x31b92c,null));}; \ No newline at end of file +var _0xfdbd=['status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','length','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','params','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','checkContactHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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'];(function(_0x42ab91,_0x2a0179){var _0x259d35=function(_0x2d48bf){while(--_0x2d48bf){_0x42ab91['push'](_0x42ab91['shift']());}};_0x259d35(++_0x2a0179);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x300e96,_0x329b01){_0x300e96=_0x300e96-0x0;var _0x3a4fe6=_0xfdbd[_0x300e96];return _0x3a4fe6;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':!![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['CmHopperFinal']['describe']()[_0xdfdb('0x26')](respondWithResult(_0x273477,null))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports[_0xdfdb('0x24')]=function(_0x4bbb88,_0x36149e){if(_0x4bbb88[_0xdfdb('0x4b')][_0xdfdb('0x4c')]){delete _0x4bbb88[_0xdfdb('0x4b')]['uniqueid'];}return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'uniqueid':_0x4bbb88['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x36149e,null))[_0xdfdb('0x26')](saveUpdates(_0x4bbb88[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x36149e,null))[_0xdfdb('0x49')](handleError(_0x36149e,null));};exports[_0xdfdb('0x4d')]=function(_0x17dfdb,_0x1f5b88,_0x1da7af){return db['CmHopperFinal'][_0xdfdb('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x17dfdb['params']['id']},'attributes':[[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x53')))),'noAnswerContacts'],[db[_0xdfdb('0x4e')]['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x54')))),_0xdfdb('0x55')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x56')))),_0xdfdb('0x57')],[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x58')))),_0xdfdb('0x59')],[db['sequelize']['fn']('COUNT',db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5b')))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')]['literal'](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x1f5b88,null))['then'](respondWithResult(_0x1f5b88,null))[_0xdfdb('0x49')](handleError(_0x1f5b88,null));};exports[_0xdfdb('0x5f')]=function(_0x349cf7,_0x2f69a8,_0x424212){return db[_0xdfdb('0x2d')][_0xdfdb('0x44')]({'raw':![],'where':{'CampaignId':_0x349cf7[_0xdfdb('0x60')]['id']},'attributes':[[db['sequelize']['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x51')))),_0xdfdb('0x52')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xdfdb('0x61')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')](_0xdfdb('0x54')))),'busyContacts'],[db['sequelize']['fn'](_0xdfdb('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xdfdb('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xdfdb('0x57')],[db[_0xdfdb('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdfdb('0x59')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xdfdb('0x5a')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdfdb('0x5c')],[db[_0xdfdb('0x4e')]['fn'](_0xdfdb('0x4f'),db[_0xdfdb('0x4e')]['fn']('IF',db[_0xdfdb('0x4e')][_0xdfdb('0x50')](_0xdfdb('0x5d')))),_0xdfdb('0x5e')]]})[_0xdfdb('0x26')](handleEntityNotFound(_0x2f69a8,null))[_0xdfdb('0x26')](respondWithResult(_0x2f69a8,null))['catch'](handleError(_0x2f69a8,null));};exports[_0xdfdb('0x62')]=function(_0x198cfa,_0x2831d6,_0x45bfc0){return db[_0xdfdb('0x63')]['find']({'where':{'id':_0x198cfa[_0xdfdb('0x60')]['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x2831d6,null))[_0xdfdb('0x26')](function(_0x1a31b9){var _0x4999c4;if(_0x1a31b9){_0x4999c4=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')](_0xdfdb('0x66'))[_0xdfdb('0x67')]([_0xdfdb('0x68'),_0xdfdb('0x69'),_0xdfdb('0x6a'),_0xdfdb('0x6b'),_0xdfdb('0x6c'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel['select']()[_0xdfdb('0x6f')](_0xdfdb('0x70'),'phone')[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)','ContactId')[_0xdfdb('0x6f')](_0xdfdb('0x72'),_0xdfdb('0x6b'))[_0xdfdb('0x6f')](_0xdfdb('0x73'),_0xdfdb('0x6c'))[_0xdfdb('0x6f')]('NOW()',_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')]('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id'][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x77'),_0x198cfa[_0xdfdb('0x4b')]['state'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')]('phone')[_0xdfdb('0x74')](_0xdfdb('0x66'))['where']('VoiceQueueId\x20=\x20?',_0x198cfa[_0xdfdb('0x60')]['id']['toString']()))['where'](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x7c'),_0x198cfa['params']['id'][_0xdfdb('0x76')]())['where'](_0xdfdb('0x7d')))[_0xdfdb('0x7e')](_0xdfdb('0x6a')))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x4999c4);}return[];})[_0xdfdb('0x26')](respondWithResult(_0x2831d6,null))[_0xdfdb('0x49')](handleError(_0x2831d6,null));};exports[_0xdfdb('0x7f')]=function(_0x1b6445,_0x36241c,_0x4c833f){return db['Campaign'][_0xdfdb('0x48')]({'where':{'id':_0x1b6445[_0xdfdb('0x60')]['id']}})['then'](handleEntityNotFound(_0x36241c,null))[_0xdfdb('0x26')](function(_0x50d5d4){var _0x158454;if(_0x50d5d4){_0x158454=squel[_0xdfdb('0x64')]()[_0xdfdb('0x65')]('cm_hopper')[_0xdfdb('0x67')](['phone','scheduledAt',_0xdfdb('0x6a'),'ListId',_0xdfdb('0x80'),_0xdfdb('0x6d'),_0xdfdb('0x6e')],squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x70'),_0xdfdb('0x68'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x69'))['field']('ANY_VALUE(ContactId)',_0xdfdb('0x6a'))['field']('ANY_VALUE(ListId)','ListId')['field'](_0xdfdb('0x81'),_0xdfdb('0x80'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6d'))[_0xdfdb('0x6f')](_0xdfdb('0x71'),_0xdfdb('0x6e'))[_0xdfdb('0x74')](_0xdfdb('0x75'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x77'),_0x1b6445[_0xdfdb('0x4b')][_0xdfdb('0x83')][_0xdfdb('0x76')]())[_0xdfdb('0x3d')](_0xdfdb('0x78'))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()['field'](_0xdfdb('0x68'))[_0xdfdb('0x74')](_0xdfdb('0x66'))[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']()))[_0xdfdb('0x3d')](_0xdfdb('0x79'),squel[_0xdfdb('0x7a')]()[_0xdfdb('0x6f')](_0xdfdb('0x7b'))[_0xdfdb('0x74')]('cm_hopper_final')[_0xdfdb('0x3d')](_0xdfdb('0x82'),_0x1b6445[_0xdfdb('0x60')]['id']['toString']())['where'](_0xdfdb('0x7d')))['group']('ContactId'))[_0xdfdb('0x76')]();return db[_0xdfdb('0x4e')]['query'](_0x158454);}return[];})['then'](respondWithResult(_0x36241c,null))[_0xdfdb('0x49')](handleError(_0x36241c,null));};exports[_0xdfdb('0x84')]=function(_0x1f87d3,_0x1bc293,_0x36b01e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x1f87d3[_0xdfdb('0x4b')]['VoiceQueueId'],'CampaignId':_0x1f87d3[_0xdfdb('0x4b')][_0xdfdb('0x80')],'ContactId':_0x1f87d3[_0xdfdb('0x4b')]['ContactId']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x1bc293,null))[_0xdfdb('0x26')](function(_0x3e0208){if(_0x3e0208){return _0x3e0208;}return null;})[_0xdfdb('0x26')](respondWithResult(_0x1bc293,null))['catch'](handleError(_0x1bc293,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 09ffd6c..aed7cd2 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 _0x5b46=['path','rimraf','./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x586685,_0x5a257b){var _0x2d40f5=function(_0x4821dd){while(--_0x4821dd){_0x586685['push'](_0x586685['shift']());}};_0x2d40f5(++_0x5a257b);}(_0x5b46,0x1c3));var _0x65b4=function(_0x2a1cc2,_0x15fea0){_0x2a1cc2=_0x2a1cc2-0x0;var _0x20f8c4=_0x5b46[_0x2a1cc2];return _0x20f8c4;};'use strict';var _=require(_0x65b4('0x0'));var util=require('util');var logger=require(_0x65b4('0x1'))(_0x65b4('0x2'));var moment=require(_0x65b4('0x3'));var BPromise=require('bluebird');var rp=require(_0x65b4('0x4'));var fs=require('fs');var path=require(_0x65b4('0x5'));var rimraf=require(_0x65b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x65b4('0x7'));module[_0x65b4('0x8')]=function(_0x2126bd,_0x1506a7){return _0x2126bd['define']('CmHopperFinal',attributes,{'tableName':_0x65b4('0x9'),'paranoid':![],'indexes':[{'name':_0x65b4('0xa'),'fields':[_0x65b4('0xa')]},{'name':_0x65b4('0xb'),'fields':[_0x65b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8fef=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x4a2130,_0x453445){var _0x3e7809=function(_0xf2f1c9){while(--_0xf2f1c9){_0x4a2130['push'](_0x4a2130['shift']());}};_0x3e7809(++_0x453445);}(_0x8fef,0x66));var _0xf8fe=function(_0x4eba43,_0x32d832){_0x4eba43=_0x4eba43-0x0;var _0x130567=_0x8fef[_0x4eba43];return _0x130567;};'use strict';var _=require(_0xf8fe('0x0'));var util=require(_0xf8fe('0x1'));var logger=require(_0xf8fe('0x2'))(_0xf8fe('0x3'));var moment=require(_0xf8fe('0x4'));var BPromise=require(_0xf8fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf8fe('0x6'));var config=require(_0xf8fe('0x7'));var attributes=require(_0xf8fe('0x8'));module[_0xf8fe('0x9')]=function(_0x4c4ec4,_0x3d04cb){return _0x4c4ec4['define'](_0xf8fe('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xf8fe('0xb'),'fields':[_0xf8fe('0xb')]},{'name':_0xf8fe('0xc'),'fields':[_0xf8fe('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 f8e1cbf..c6682c5 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5e340f,_0x10ce51){var _0x2f014f=function(_0x1bdf59){while(--_0x1bdf59){_0x5e340f['push'](_0x5e340f['shift']());}};_0x2f014f(++_0x10ce51);}(_0x7a54,0x106));var _0x47a5=function(_0x162d90,_0x5e34ef){_0x162d90=_0x162d90-0x0;var _0x55ab7c=_0x7a54[_0x162d90];return _0x55ab7c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x256e22,_0x44a67f){var _0x12265a=function(_0xc301ec){while(--_0xc301ec){_0x256e22['push'](_0x256e22['shift']());}};_0x12265a(++_0x44a67f);}(_0xb10b,0x12a));var _0xbb10=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0xb10b[_0x20fdc1];return _0x25397c;};'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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 343d633..f6fb92e 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 _0xe20c=['express','Router','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path'];(function(_0x325590,_0x39b7ef){var _0x4925a5=function(_0x35e447){while(--_0x35e447){_0x325590['push'](_0x325590['shift']());}};_0x4925a5(++_0x39b7ef);}(_0xe20c,0x9f));var _0xce20=function(_0x5b2b80,_0x324e9d){_0x5b2b80=_0x5b2b80-0x0;var _0x401ac7=_0xe20c[_0x5b2b80];return _0x401ac7;};'use strict';var multer=require(_0xce20('0x0'));var util=require('util');var path=require(_0xce20('0x1'));var timeout=require('connect-timeout');var express=require(_0xce20('0x2'));var router=express[_0xce20('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce20('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xce20('0x5')](),controller['index']);router[_0xce20('0x6')](_0xce20('0x7'),auth[_0xce20('0x5')](),controller[_0xce20('0x8')]);router[_0xce20('0x6')](_0xce20('0x9'),auth[_0xce20('0x5')](),controller[_0xce20('0xa')]);router[_0xce20('0x6')](_0xce20('0xb'),auth[_0xce20('0x5')](),controller[_0xce20('0xc')]);router[_0xce20('0x6')]('/campaign/countAttributes/:id',auth[_0xce20('0x5')](),controller[_0xce20('0xd')]);router[_0xce20('0xe')](_0xce20('0xf'),auth[_0xce20('0x5')](),controller[_0xce20('0x10')]);router[_0xce20('0xe')]('/voice/campaign/moveContacts/:id',auth[_0xce20('0x5')](),controller[_0xce20('0x11')]);router[_0xce20('0xe')](_0xce20('0x12'),auth[_0xce20('0x5')](),controller[_0xce20('0x13')]);router[_0xce20('0x14')](_0xce20('0x9'),auth[_0xce20('0x5')](),controller[_0xce20('0x15')]);module[_0xce20('0x16')]=router; \ No newline at end of file +var _0x95ef=['moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','put','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id'];(function(_0x102977,_0x3a99a6){var _0x15c466=function(_0x1a6a12){while(--_0x1a6a12){_0x102977['push'](_0x102977['shift']());}};_0x15c466(++_0x3a99a6);}(_0x95ef,0x119));var _0xf95e=function(_0x4c7701,_0x1c79be){_0x4c7701=_0x4c7701-0x0;var _0x4f89eb=_0x95ef[_0x4c7701];return _0x4f89eb;};'use strict';var multer=require(_0xf95e('0x0'));var util=require('util');var path=require(_0xf95e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf95e('0x2'));var router=express[_0xf95e('0x3')]();var fs_extra=require(_0xf95e('0x4'));var auth=require(_0xf95e('0x5'));var interaction=require(_0xf95e('0x6'));var config=require(_0xf95e('0x7'));var controller=require('./cmHopperFinal.controller');router[_0xf95e('0x8')]('/',auth[_0xf95e('0x9')](),controller['index']);router['get'](_0xf95e('0xa'),auth['isAuthenticated'](),controller[_0xf95e('0xb')]);router[_0xf95e('0x8')](_0xf95e('0xc'),auth[_0xf95e('0x9')](),controller['show']);router[_0xf95e('0x8')]('/voice/queue/countAttributes/:id',auth[_0xf95e('0x9')](),controller[_0xf95e('0xd')]);router[_0xf95e('0x8')](_0xf95e('0xe'),auth[_0xf95e('0x9')](),controller[_0xf95e('0xf')]);router['post'](_0xf95e('0x10'),auth['isAuthenticated'](),controller[_0xf95e('0x11')]);router['post'](_0xf95e('0x12'),auth['isAuthenticated'](),controller[_0xf95e('0x13')]);router[_0xf95e('0x14')](_0xf95e('0x15'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xf95e('0x16')](_0xf95e('0xc'),auth[_0xf95e('0x9')](),controller[_0xf95e('0x17')]);module[_0xf95e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index cc41f3b..12beaca 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 _0xadf4=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xadf4,0x8d));var _0x4adf=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xadf4[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require('sequelize');module[_0x4adf('0x0')]={'state':{'type':Sequelize[_0x4adf('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4adf('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4adf('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4adf('0x3')]},'responsetime':{'type':Sequelize[_0x4adf('0x3')]},'answertime':{'type':Sequelize[_0x4adf('0x3')]},'droptime':{'type':Sequelize[_0x4adf('0x3')]},'endtime':{'type':Sequelize[_0x4adf('0x3')]},'ringtime':{'type':Sequelize[_0x4adf('0x1')],'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['STRING']},'campaigntype':{'type':Sequelize[_0x4adf('0x2')]},'membername':{'type':Sequelize[_0x4adf('0x2')]},'reason':{'type':Sequelize[_0x4adf('0x2')]},'amd':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4adf('0x3')]},'recallme':{'type':Sequelize[_0x4adf('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4adf('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4adf('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4adf('0x2')]}}; \ No newline at end of file +var _0xdf13=['INTEGER','STRING','DATE','BOOLEAN','exports'];(function(_0x2f4e46,_0x58ed62){var _0x35380b=function(_0x321c45){while(--_0x321c45){_0x2f4e46['push'](_0x2f4e46['shift']());}};_0x35380b(++_0x58ed62);}(_0xdf13,0x171));var _0x3df1=function(_0x3b3947,_0x1c5e57){_0x3b3947=_0x3b3947-0x0;var _0x4113d7=_0xdf13[_0x3b3947];return _0x4113d7;};'use strict';var Sequelize=require('sequelize');module[_0x3df1('0x0')]={'state':{'type':Sequelize[_0x3df1('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3df1('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3df1('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x3df1('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3df1('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3df1('0x2')]},'starttime':{'type':Sequelize[_0x3df1('0x3')]},'responsetime':{'type':Sequelize[_0x3df1('0x3')]},'answertime':{'type':Sequelize[_0x3df1('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3df1('0x3')]},'ringtime':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3df1('0x2')]},'campaign':{'type':Sequelize[_0x3df1('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3df1('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x3df1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3df1('0x3')]},'recallme':{'type':Sequelize[_0x3df1('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3df1('0x3')]},'edited':{'type':Sequelize[_0x3df1('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3df1('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3df1('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3aebd92..0512333 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 _0x77e2=['CmHopperHistory','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','uniqueid','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x77e2,0x188));var _0x277e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x277e('0x0'));var rp=require(_0x277e('0x1'));var moment=require(_0x277e('0x2'));var BPromise=require(_0x277e('0x3'));var Mustache=require(_0x277e('0x4'));var util=require(_0x277e('0x5'));var path=require(_0x277e('0x6'));var sox=require(_0x277e('0x7'));var csv=require(_0x277e('0x8'));var ejs=require(_0x277e('0x9'));var fs=require('fs');var fs_extra=require(_0x277e('0xa'));var _=require(_0x277e('0xb'));var squel=require('squel');var crypto=require(_0x277e('0xc'));var jsforce=require(_0x277e('0xd'));var deskjs=require(_0x277e('0xe'));var toCsv=require(_0x277e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x277e('0xf'));var authService=require(_0x277e('0x10'));var qs=require(_0x277e('0x11'));var as=require(_0x277e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x277e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x277e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1daaa9,_0x201c61){_0x201c61=_0x201c61||0xcc;return function(_0x5a5e6e){if(_0x5a5e6e){return _0x1daaa9[_0x277e('0x15')](_0x201c61);}return _0x1daaa9[_0x277e('0x16')](_0x201c61)[_0x277e('0x17')]();};}function respondWithResult(_0x86fe29,_0x5a8ec9){_0x5a8ec9=_0x5a8ec9||0xc8;return function(_0x53f0e1){if(_0x53f0e1){return _0x86fe29[_0x277e('0x16')](_0x5a8ec9)[_0x277e('0x18')](_0x53f0e1);}};}function respondWithFilteredResult(_0x25533e,_0x47f34f){return function(_0x4bc480){if(_0x4bc480){var _0x4714a4=typeof _0x47f34f[_0x277e('0x19')]===_0x277e('0x1a')&&typeof _0x47f34f[_0x277e('0x1b')]===_0x277e('0x1a');var _0x1e757b=_0x4bc480['count'];var _0x4dafa9=_0x4714a4?0x0:_0x47f34f[_0x277e('0x19')];var _0xfe57f3=_0x4714a4?_0x4bc480[_0x277e('0x1c')]:_0x47f34f[_0x277e('0x19')]+_0x47f34f[_0x277e('0x1b')];var _0x1c9e28;if(_0xfe57f3>=_0x1e757b){_0xfe57f3=_0x1e757b;_0x1c9e28=0xc8;}else{_0x1c9e28=0xce;}_0x25533e[_0x277e('0x16')](_0x1c9e28);return _0x25533e[_0x277e('0x1d')](_0x277e('0x1e'),_0x4dafa9+'-'+_0xfe57f3+'/'+_0x1e757b)[_0x277e('0x18')](_0x4bc480);}return null;};}function patchUpdates(_0x205cf9){return function(_0xbd25a0){try{jsonpatch[_0x277e('0x1f')](_0xbd25a0,_0x205cf9,!![]);}catch(_0xcdb8c7){return BPromise['reject'](_0xcdb8c7);}return _0xbd25a0[_0x277e('0x20')]();};}function saveUpdates(_0x5ccea9,_0x3b5882){return function(_0x38bc8b){if(_0x38bc8b){return _0x38bc8b['update'](_0x5ccea9)[_0x277e('0x21')](function(_0x141eaa){return _0x141eaa;});}return null;};}function removeEntity(_0x527b83,_0x361b30){return function(_0x36f525){if(_0x36f525){return _0x36f525[_0x277e('0x22')]()[_0x277e('0x21')](function(){_0x527b83[_0x277e('0x16')](0xcc)[_0x277e('0x17')]();});}};}function handleEntityNotFound(_0x1a0dd1,_0x606770){return function(_0xb2eb8e){if(!_0xb2eb8e){_0x1a0dd1['sendStatus'](0x194);}return _0xb2eb8e;};}function handleError(_0xc34c8c,_0x2b20b8){_0x2b20b8=_0x2b20b8||0x1f4;return function(_0x29e1c0){logger[_0x277e('0x23')](_0x29e1c0['stack']);if(_0x29e1c0[_0x277e('0x24')]){delete _0x29e1c0[_0x277e('0x24')];}_0xc34c8c[_0x277e('0x16')](_0x2b20b8)[_0x277e('0x25')](_0x29e1c0);};}exports[_0x277e('0x26')]=function(_0x3e6328,_0x463c67){var _0x40847a={},_0x2ac524={},_0x36cde6={'count':0x0,'rows':[]};var _0x52cd05=_[_0x277e('0x27')](db[_0x277e('0x28')][_0x277e('0x29')],function(_0xf021b1){return{'name':_0xf021b1[_0x277e('0x2a')],'type':_0xf021b1[_0x277e('0x2b')][_0x277e('0x2c')]};});_0x2ac524['model']=_['map'](_0x52cd05,_0x277e('0x24'));_0x2ac524['query']=_[_0x277e('0x2d')](_0x3e6328['query']);_0x2ac524[_0x277e('0x2e')]=_[_0x277e('0x2f')](_0x2ac524[_0x277e('0x30')],_0x2ac524[_0x277e('0x31')]);_0x40847a[_0x277e('0x32')]=_[_0x277e('0x2f')](_0x2ac524[_0x277e('0x30')],qs[_0x277e('0x33')](_0x3e6328[_0x277e('0x31')]['fields']));_0x40847a[_0x277e('0x32')]=_0x40847a[_0x277e('0x32')]['length']?_0x40847a[_0x277e('0x32')]:_0x2ac524['model'];if(!_0x3e6328[_0x277e('0x31')][_0x277e('0x34')](_0x277e('0x35'))){_0x40847a[_0x277e('0x1b')]=qs[_0x277e('0x1b')](_0x3e6328['query'][_0x277e('0x1b')]);_0x40847a[_0x277e('0x19')]=qs[_0x277e('0x19')](_0x3e6328['query'][_0x277e('0x19')]);}_0x40847a['order']=qs[_0x277e('0x36')](_0x3e6328['query']['sort']);_0x40847a[_0x277e('0x37')]=qs[_0x277e('0x2e')](_['pick'](_0x3e6328[_0x277e('0x31')],_0x2ac524[_0x277e('0x2e')]),_0x52cd05);if(_0x3e6328[_0x277e('0x31')]['filter']){_0x40847a['where']=_[_0x277e('0x38')](_0x40847a['where'],{'$or':_['map'](_0x52cd05,function(_0x4b03bc){if(_0x4b03bc[_0x277e('0x2b')]!==_0x277e('0x39')){var _0x2ca52b={};_0x2ca52b[_0x4b03bc[_0x277e('0x24')]]={'$like':'%'+_0x3e6328['query'][_0x277e('0x3a')]+'%'};return _0x2ca52b;}})});}_0x40847a=_['merge']({},_0x40847a,_0x3e6328[_0x277e('0x3b')]);var _0x29ef63={'where':_0x40847a[_0x277e('0x37')]};return db[_0x277e('0x28')][_0x277e('0x1c')](_0x29ef63)[_0x277e('0x21')](function(_0x4988e1){_0x36cde6[_0x277e('0x1c')]=_0x4988e1;if(_0x3e6328['query'][_0x277e('0x3c')]){_0x40847a[_0x277e('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x277e('0x3e')](_0x40847a);})[_0x277e('0x21')](function(_0xbff7f){_0x36cde6[_0x277e('0x3f')]=_0xbff7f;return _0x36cde6;})['then'](respondWithFilteredResult(_0x463c67,_0x40847a))[_0x277e('0x40')](handleError(_0x463c67,null));};exports[_0x277e('0x41')]=function(_0x2373e9,_0x4c8169){var _0x112c0c={'raw':!![],'where':{'id':_0x2373e9[_0x277e('0x42')]['id']}},_0x3a93e2={};_0x3a93e2['model']=_[_0x277e('0x2d')](db[_0x277e('0x28')]['rawAttributes']);_0x3a93e2[_0x277e('0x31')]=_[_0x277e('0x2d')](_0x2373e9['query']);_0x3a93e2[_0x277e('0x2e')]=_['intersection'](_0x3a93e2['model'],_0x3a93e2[_0x277e('0x31')]);_0x112c0c[_0x277e('0x32')]=_[_0x277e('0x2f')](_0x3a93e2[_0x277e('0x30')],qs[_0x277e('0x33')](_0x2373e9['query'][_0x277e('0x33')]));_0x112c0c['attributes']=_0x112c0c[_0x277e('0x32')]['length']?_0x112c0c['attributes']:_0x3a93e2[_0x277e('0x30')];if(_0x2373e9[_0x277e('0x31')][_0x277e('0x3c')]){_0x112c0c[_0x277e('0x3d')]=[{'all':!![]}];}_0x112c0c=_[_0x277e('0x38')]({},_0x112c0c,_0x2373e9[_0x277e('0x3b')]);return db['CmHopperHistory'][_0x277e('0x43')](_0x112c0c)[_0x277e('0x21')](handleEntityNotFound(_0x4c8169,null))[_0x277e('0x21')](respondWithResult(_0x4c8169,null))[_0x277e('0x40')](handleError(_0x4c8169,null));};exports[_0x277e('0x44')]=function(_0x677e1c,_0x393c51){return db['CmHopperHistory'][_0x277e('0x44')](_0x677e1c['body'],{})['then'](respondWithResult(_0x393c51,0xc9))[_0x277e('0x40')](handleError(_0x393c51,null));};exports['describe']=function(_0x28d910,_0xcdc49e){return db[_0x277e('0x28')]['describe']()[_0x277e('0x21')](respondWithResult(_0xcdc49e,null))['catch'](handleError(_0xcdc49e,null));};exports[_0x277e('0x45')]=function(_0x426d58,_0x315320){if(_0x426d58[_0x277e('0x46')][_0x277e('0x47')]){delete _0x426d58[_0x277e('0x46')]['uniqueid'];}return db[_0x277e('0x28')][_0x277e('0x43')]({'where':{'uniqueid':_0x426d58[_0x277e('0x42')]['id']}})['then'](handleEntityNotFound(_0x315320,null))['then'](saveUpdates(_0x426d58[_0x277e('0x46')],null))[_0x277e('0x21')](respondWithResult(_0x315320,null))['catch'](handleError(_0x315320,null));}; \ No newline at end of file +var _0x78c9=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','update','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','Content-Range','apply','then','end','stack','name','send','index','map','CmHopperHistory','fieldName','type','key','model','query'];(function(_0x5ae2ff,_0x26b2e8){var _0xc6a1ef=function(_0x15bc6b){while(--_0x15bc6b){_0x5ae2ff['push'](_0x5ae2ff['shift']());}};_0xc6a1ef(++_0x26b2e8);}(_0x78c9,0x182));var _0x978c=function(_0x27fd11,_0x54b502){_0x27fd11=_0x27fd11-0x0;var _0x102e71=_0x78c9[_0x27fd11];return _0x102e71;};'use strict';var emlformat=require(_0x978c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x978c('0x1'));var jsonpatch=require(_0x978c('0x2'));var rp=require(_0x978c('0x3'));var moment=require(_0x978c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x978c('0x5'));var util=require(_0x978c('0x6'));var path=require(_0x978c('0x7'));var sox=require(_0x978c('0x8'));var csv=require(_0x978c('0x9'));var ejs=require(_0x978c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x978c('0xb'));var crypto=require('crypto');var jsforce=require(_0x978c('0xc'));var deskjs=require(_0x978c('0xd'));var toCsv=require(_0x978c('0x9'));var querystring=require(_0x978c('0xe'));var Papa=require(_0x978c('0xf'));var Redis=require('ioredis');var authService=require(_0x978c('0x10'));var qs=require(_0x978c('0x11'));var as=require(_0x978c('0x12'));var hardwareService=require(_0x978c('0x13'));var logger=require(_0x978c('0x14'))(_0x978c('0x15'));var utils=require(_0x978c('0x16'));var config=require(_0x978c('0x17'));var licenseUtil=require(_0x978c('0x18'));var db=require(_0x978c('0x19'))['db'];function respondWithStatusCode(_0x39b2c7,_0x4371ab){_0x4371ab=_0x4371ab||0xcc;return function(_0x53ff71){if(_0x53ff71){return _0x39b2c7['sendStatus'](_0x4371ab);}return _0x39b2c7[_0x978c('0x1a')](_0x4371ab)['end']();};}function respondWithResult(_0x52dc6e,_0x4c924b){_0x4c924b=_0x4c924b||0xc8;return function(_0x45f521){if(_0x45f521){return _0x52dc6e[_0x978c('0x1a')](_0x4c924b)['json'](_0x45f521);}};}function respondWithFilteredResult(_0x2c3006,_0x740164){return function(_0x2924ad){if(_0x2924ad){var _0x4f73a8=typeof _0x740164['offset']===_0x978c('0x1b')&&typeof _0x740164[_0x978c('0x1c')]===_0x978c('0x1b');var _0x4135ec=_0x2924ad[_0x978c('0x1d')];var _0xe96afe=_0x4f73a8?0x0:_0x740164[_0x978c('0x1e')];var _0x3adffc=_0x4f73a8?_0x2924ad['count']:_0x740164[_0x978c('0x1e')]+_0x740164[_0x978c('0x1c')];var _0x36fa51;if(_0x3adffc>=_0x4135ec){_0x3adffc=_0x4135ec;_0x36fa51=0xc8;}else{_0x36fa51=0xce;}_0x2c3006[_0x978c('0x1a')](_0x36fa51);return _0x2c3006['set'](_0x978c('0x1f'),_0xe96afe+'-'+_0x3adffc+'/'+_0x4135ec)['json'](_0x2924ad);}return null;};}function patchUpdates(_0x22993b){return function(_0x507583){try{jsonpatch[_0x978c('0x20')](_0x507583,_0x22993b,!![]);}catch(_0x337f78){return BPromise['reject'](_0x337f78);}return _0x507583['save']();};}function saveUpdates(_0x270b72,_0x1a8bee){return function(_0x421067){if(_0x421067){return _0x421067['update'](_0x270b72)[_0x978c('0x21')](function(_0x51f322){return _0x51f322;});}return null;};}function removeEntity(_0x54cc09,_0x5145dc){return function(_0x191bf7){if(_0x191bf7){return _0x191bf7['destroy']()[_0x978c('0x21')](function(){_0x54cc09[_0x978c('0x1a')](0xcc)[_0x978c('0x22')]();});}};}function handleEntityNotFound(_0x6c2d3b,_0x4c5945){return function(_0x34f2b6){if(!_0x34f2b6){_0x6c2d3b['sendStatus'](0x194);}return _0x34f2b6;};}function handleError(_0x25ceba,_0x56a8ca){_0x56a8ca=_0x56a8ca||0x1f4;return function(_0x1c4895){logger['error'](_0x1c4895[_0x978c('0x23')]);if(_0x1c4895['name']){delete _0x1c4895[_0x978c('0x24')];}_0x25ceba[_0x978c('0x1a')](_0x56a8ca)[_0x978c('0x25')](_0x1c4895);};}exports[_0x978c('0x26')]=function(_0x3947e3,_0x497921){var _0x163a7b={},_0xe3b0ea={},_0x34cce5={'count':0x0,'rows':[]};var _0x19ce67=_[_0x978c('0x27')](db[_0x978c('0x28')]['rawAttributes'],function(_0x576b08){return{'name':_0x576b08[_0x978c('0x29')],'type':_0x576b08[_0x978c('0x2a')][_0x978c('0x2b')]};});_0xe3b0ea[_0x978c('0x2c')]=_['map'](_0x19ce67,_0x978c('0x24'));_0xe3b0ea[_0x978c('0x2d')]=_['keys'](_0x3947e3[_0x978c('0x2d')]);_0xe3b0ea[_0x978c('0x2e')]=_[_0x978c('0x2f')](_0xe3b0ea[_0x978c('0x2c')],_0xe3b0ea['query']);_0x163a7b[_0x978c('0x30')]=_[_0x978c('0x2f')](_0xe3b0ea['model'],qs['fields'](_0x3947e3[_0x978c('0x2d')][_0x978c('0x31')]));_0x163a7b[_0x978c('0x30')]=_0x163a7b[_0x978c('0x30')][_0x978c('0x32')]?_0x163a7b[_0x978c('0x30')]:_0xe3b0ea[_0x978c('0x2c')];if(!_0x3947e3[_0x978c('0x2d')][_0x978c('0x33')]('nolimit')){_0x163a7b[_0x978c('0x1c')]=qs[_0x978c('0x1c')](_0x3947e3[_0x978c('0x2d')]['limit']);_0x163a7b[_0x978c('0x1e')]=qs[_0x978c('0x1e')](_0x3947e3[_0x978c('0x2d')][_0x978c('0x1e')]);}_0x163a7b[_0x978c('0x34')]=qs['sort'](_0x3947e3[_0x978c('0x2d')][_0x978c('0x35')]);_0x163a7b[_0x978c('0x36')]=qs[_0x978c('0x2e')](_[_0x978c('0x37')](_0x3947e3[_0x978c('0x2d')],_0xe3b0ea['filters']),_0x19ce67);if(_0x3947e3['query']['filter']){_0x163a7b[_0x978c('0x36')]=_[_0x978c('0x38')](_0x163a7b['where'],{'$or':_[_0x978c('0x27')](_0x19ce67,function(_0x519e16){if(_0x519e16[_0x978c('0x2a')]!==_0x978c('0x39')){var _0x456889={};_0x456889[_0x519e16['name']]={'$like':'%'+_0x3947e3[_0x978c('0x2d')][_0x978c('0x3a')]+'%'};return _0x456889;}})});}_0x163a7b=_['merge']({},_0x163a7b,_0x3947e3[_0x978c('0x3b')]);var _0x2d1a01={'where':_0x163a7b[_0x978c('0x36')]};return db[_0x978c('0x28')][_0x978c('0x1d')](_0x2d1a01)[_0x978c('0x21')](function(_0x4c8daf){_0x34cce5[_0x978c('0x1d')]=_0x4c8daf;if(_0x3947e3[_0x978c('0x2d')]['includeAll']){_0x163a7b[_0x978c('0x3c')]=[{'all':!![]}];}return db[_0x978c('0x28')][_0x978c('0x3d')](_0x163a7b);})[_0x978c('0x21')](function(_0x1cd03d){_0x34cce5[_0x978c('0x3e')]=_0x1cd03d;return _0x34cce5;})[_0x978c('0x21')](respondWithFilteredResult(_0x497921,_0x163a7b))[_0x978c('0x3f')](handleError(_0x497921,null));};exports['show']=function(_0xf9827f,_0x5dc8f2){var _0x51bfaa={'raw':!![],'where':{'id':_0xf9827f[_0x978c('0x40')]['id']}},_0x309e71={};_0x309e71[_0x978c('0x2c')]=_['keys'](db[_0x978c('0x28')][_0x978c('0x41')]);_0x309e71[_0x978c('0x2d')]=_['keys'](_0xf9827f[_0x978c('0x2d')]);_0x309e71[_0x978c('0x2e')]=_[_0x978c('0x2f')](_0x309e71[_0x978c('0x2c')],_0x309e71['query']);_0x51bfaa[_0x978c('0x30')]=_[_0x978c('0x2f')](_0x309e71['model'],qs[_0x978c('0x31')](_0xf9827f[_0x978c('0x2d')][_0x978c('0x31')]));_0x51bfaa[_0x978c('0x30')]=_0x51bfaa['attributes'][_0x978c('0x32')]?_0x51bfaa[_0x978c('0x30')]:_0x309e71[_0x978c('0x2c')];if(_0xf9827f[_0x978c('0x2d')][_0x978c('0x42')]){_0x51bfaa['include']=[{'all':!![]}];}_0x51bfaa=_[_0x978c('0x38')]({},_0x51bfaa,_0xf9827f[_0x978c('0x3b')]);return db['CmHopperHistory'][_0x978c('0x43')](_0x51bfaa)[_0x978c('0x21')](handleEntityNotFound(_0x5dc8f2,null))[_0x978c('0x21')](respondWithResult(_0x5dc8f2,null))[_0x978c('0x3f')](handleError(_0x5dc8f2,null));};exports[_0x978c('0x44')]=function(_0x3e5fa4,_0x1d3530){return db[_0x978c('0x28')]['create'](_0x3e5fa4[_0x978c('0x45')],{})['then'](respondWithResult(_0x1d3530,0xc9))[_0x978c('0x3f')](handleError(_0x1d3530,null));};exports['describe']=function(_0x2fb386,_0x34dfe2){return db['CmHopperHistory']['describe']()[_0x978c('0x21')](respondWithResult(_0x34dfe2,null))[_0x978c('0x3f')](handleError(_0x34dfe2,null));};exports[_0x978c('0x46')]=function(_0x2e976c,_0x35d001){if(_0x2e976c[_0x978c('0x45')][_0x978c('0x47')]){delete _0x2e976c[_0x978c('0x45')][_0x978c('0x47')];}return db[_0x978c('0x28')]['find']({'where':{'uniqueid':_0x2e976c[_0x978c('0x40')]['id']}})['then'](handleEntityNotFound(_0x35d001,null))[_0x978c('0x21')](saveUpdates(_0x2e976c[_0x978c('0x45')],null))[_0x978c('0x21')](respondWithResult(_0x35d001,null))[_0x978c('0x3f')](handleError(_0x35d001,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 7c59987..d3918d4 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x59bf1d,_0x31cf5a){var _0xd48420=function(_0x3eba23){while(--_0x3eba23){_0x59bf1d['push'](_0x59bf1d['shift']());}};_0xd48420(++_0x31cf5a);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x762e=['exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x148816,_0x37e211){var _0x30584e=function(_0x2bb597){while(--_0x2bb597){_0x148816['push'](_0x148816['shift']());}};_0x30584e(++_0x37e211);}(_0x762e,0xea));var _0xe762=function(_0x54dea4,_0x1b5109){_0x54dea4=_0x54dea4-0x0;var _0x3a2d64=_0x762e[_0x54dea4];return _0x3a2d64;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe762('0x2'));var fs=require('fs');var path=require(_0xe762('0x3'));var rimraf=require(_0xe762('0x4'));var config=require('../../config/environment');var attributes=require(_0xe762('0x5'));module[_0xe762('0x6')]=function(_0x48995a,_0x4abeb6){return _0x48995a[_0xe762('0x7')](_0xe762('0x8'),attributes,{'tableName':_0xe762('0x9'),'paranoid':![],'indexes':[{'name':_0xe762('0xa'),'fields':[_0xe762('0xa')]},{'name':_0xe762('0xb'),'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 b0f47c1..81488ea 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 _0xd73a=['outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CmHopperHistory','create','options','then','CreateCmHopperHistory','stringify','AvgHandleTime','findAll','raw','where','sequelize','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x1aec7c,_0x185063){var _0x471cae=function(_0x304287){while(--_0x304287){_0x1aec7c['push'](_0x1aec7c['shift']());}};_0x471cae(++_0x185063);}(_0xd73a,0x171));var _0xad73=function(_0x27f2d7,_0x548782){_0x27f2d7=_0x27f2d7-0x0;var _0x50b1d6=_0xd73a[_0x27f2d7];return _0x50b1d6;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var moment=require(_0xad73('0x2'));var BPromise=require(_0xad73('0x3'));var rs=require(_0xad73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad73('0x5'));var logger=require(_0xad73('0x6'))(_0xad73('0x7'));var config=require(_0xad73('0x8'));var jayson=require(_0xad73('0x9'));var client=jayson[_0xad73('0xa')][_0xad73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4736,_0x24d620,_0x15cf28){return new BPromise(function(_0x1352b3,_0x524324){return client[_0xad73('0xc')](_0x2f4736,_0x15cf28)['then'](function(_0x3c07fa){logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,'request\x20sent');logger[_0xad73('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x24d620,_0xad73('0x10'),JSON['stringify'](_0x3c07fa));if(_0x3c07fa[_0xad73('0x11')]){if(_0x3c07fa[_0xad73('0x11')][_0xad73('0x12')]===0x1f4){logger['error'](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')]['message']);return _0x524324(_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);}logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);return _0x1352b3(_0x3c07fa['error'][_0xad73('0x13')]);}else{logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,_0xad73('0x10'));_0x1352b3(_0x3c07fa[_0xad73('0x14')][_0xad73('0x13')]);}})[_0xad73('0x15')](function(_0x367a5d){logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x367a5d);_0x524324(_0x367a5d);});});}exports['CreateCmHopperHistory']=function(_0x47381a){var _0x4cafad=this;return new Promise(function(_0x5bd242,_0x28bd73){return db[_0xad73('0x16')][_0xad73('0x17')](_0x47381a['body'],{'raw':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xad73('0x19')](function(_0x4289df){logger[_0xad73('0xd')](_0xad73('0x1a'),_0x47381a);logger[_0xad73('0xf')](_0xad73('0x1a'),_0x47381a,JSON[_0xad73('0x1b')](_0x4289df));_0x5bd242(_0x4289df);})['catch'](function(_0xfe2758){logger[_0xad73('0x11')](_0xad73('0x1a'),_0xfe2758[_0xad73('0x13')],_0x47381a);_0x28bd73(_0x4cafad[_0xad73('0x11')](0x1f4,_0xfe2758[_0xad73('0x13')]));});});};exports[_0xad73('0x1c')]=function(_0x439f09){var _0xcdb93d=this;return new Promise(function(_0x68aa8c,_0x18e58b){return db[_0xad73('0x16')][_0xad73('0x1d')]({'raw':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[[db[_0xad73('0x20')]['fn']('COUNT',db['sequelize']['col']('id')),_0xad73('0x21')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db['sequelize']['literal'](_0xad73('0x22')))),_0xad73('0x23')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0xad73('0x27'),db['sequelize']['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x28')))),_0xad73('0x29')],[db['sequelize']['fn']('AVG',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xad73('0x2a')]]})['then'](function(_0x4016ec){logger[_0xad73('0xd')]('AvgHandleTime',_0x439f09);logger[_0xad73('0xf')]('AvgHandleTime',_0x439f09,JSON[_0xad73('0x1b')](_0x4016ec));_0x68aa8c(_0x4016ec);})[_0xad73('0x15')](function(_0x41f470){logger[_0xad73('0x11')](_0xad73('0x1c'),_0x41f470[_0xad73('0x13')],_0x439f09);_0x18e58b(_0xcdb93d[_0xad73('0x11')](0x1f4,_0x41f470[_0xad73('0x13')]));});});};exports[_0xad73('0x2b')]=function(_0x4cb85b){var _0x37e863=this;return new Promise(function(_0x3db333,_0x52169f){return db[_0xad73('0x16')][_0xad73('0x1d')]({'raw':_0x4cb85b[_0xad73('0x18')]?_0x4cb85b[_0xad73('0x18')][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cb85b[_0xad73('0x18')]?_0x4cb85b[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[[_0xad73('0x2c'),'name'],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db['sequelize']['literal'](_0xad73('0x2d')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0xad73('0x2e')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x22')))),_0xad73('0x2f')],[db[_0xad73('0x20')]['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x30')))),_0xad73('0x31')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x32')))),_0xad73('0x33')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db['sequelize'][_0xad73('0x25')](_0xad73('0x34')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xad73('0x35')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x36')))),_0xad73('0x37')],[db['sequelize']['fn']('COUNT',db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x38')))),_0xad73('0x39')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0xad73('0x3a')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x3b')))),_0xad73('0x3c')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x3d')))),_0xad73('0x3e')],[db[_0xad73('0x20')]['fn'](_0xad73('0x24'),db['sequelize']['fn']('IF',db['sequelize'][_0xad73('0x25')](_0xad73('0x3f')))),_0xad73('0x3c')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')][_0xad73('0x25')](_0xad73('0x40')))),_0xad73('0x41')]],'group':[_0xad73('0x2c')]})[_0xad73('0x19')](function(_0x49c661){logger[_0xad73('0xd')]('GetVoiceQueueHopperHistory',_0x4cb85b);logger[_0xad73('0xf')]('GetVoiceQueueHopperHistory',_0x4cb85b,JSON['stringify'](_0x49c661));_0x3db333(_0x49c661);})[_0xad73('0x15')](function(_0x3f0e65){logger['error'](_0xad73('0x2b'),_0x3f0e65[_0xad73('0x13')],_0x4cb85b);_0x52169f(_0x37e863[_0xad73('0x11')](0x1f4,_0x3f0e65[_0xad73('0x13')]));});});};exports[_0xad73('0x42')]=function(_0x1202c4){var _0x3c804f=this;return new Promise(function(_0xf71ea2,_0xeeaa26){return db[_0xad73('0x16')]['findAll']({'raw':_0x1202c4[_0xad73('0x18')]?_0x1202c4['options'][_0xad73('0x1e')]===undefined?!![]:![]:!![],'where':_0x1202c4[_0xad73('0x18')]?_0x1202c4[_0xad73('0x18')][_0xad73('0x1f')]||null:null,'attributes':[['campaign',_0xad73('0x43')],[db['sequelize']['fn']('COUNT',db[_0xad73('0x20')]['col']('id')),_0xad73('0x44')],[db['sequelize']['fn'](_0xad73('0x24'),db[_0xad73('0x20')]['fn']('IF',db[_0xad73('0x20')]['literal'](_0xad73('0x22')))),_0xad73('0x45')]],'group':[_0xad73('0x2c')]})['then'](function(_0x206e3a){logger['info']('GetCampaignHopperHistory',_0x1202c4);logger[_0xad73('0xf')](_0xad73('0x42'),_0x1202c4,JSON['stringify'](_0x206e3a));_0xf71ea2(_0x206e3a);})['catch'](function(_0x2fc49a){logger[_0xad73('0x11')]('GetCampaignHopperHistory',_0x2fc49a['message'],_0x1202c4);_0xeeaa26(_0x3c804f[_0xad73('0x11')](0x1f4,_0x2fc49a[_0xad73('0x13')]));});});}; \ No newline at end of file +var _0x795a=['create','body','raw','AvgHandleTime','findAll','options','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateCmHopperHistory','CmHopperHistory'];(function(_0x5026ee,_0x40159f){var _0x282909=function(_0x1ad403){while(--_0x1ad403){_0x5026ee['push'](_0x5026ee['shift']());}};_0x282909(++_0x40159f);}(_0x795a,0xeb));var _0xa795=function(_0x4b8887,_0x235d6f){_0x4b8887=_0x4b8887-0x0;var _0x578987=_0x795a[_0x4b8887];return _0x578987;};'use strict';var _=require('lodash');var util=require(_0xa795('0x0'));var moment=require(_0xa795('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa795('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa795('0x3'));var logger=require(_0xa795('0x4'))(_0xa795('0x5'));var config=require(_0xa795('0x6'));var jayson=require(_0xa795('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39e56e,_0x364200,_0x2fa091){return new BPromise(function(_0x467fa1,_0x227d7d){return client[_0xa795('0x8')](_0x39e56e,_0x2fa091)[_0xa795('0x9')](function(_0x41bec1){logger[_0xa795('0xa')](_0xa795('0xb'),_0x364200,_0xa795('0xc'));logger[_0xa795('0xd')](_0xa795('0xe'),_0x364200,_0xa795('0xc'),JSON[_0xa795('0xf')](_0x41bec1));if(_0x41bec1[_0xa795('0x10')]){if(_0x41bec1[_0xa795('0x10')]['code']===0x1f4){logger[_0xa795('0x10')](_0xa795('0xb'),_0x364200,_0x41bec1[_0xa795('0x10')][_0xa795('0x11')]);return _0x227d7d(_0x41bec1[_0xa795('0x10')]['message']);}logger[_0xa795('0x10')](_0xa795('0xb'),_0x364200,_0x41bec1[_0xa795('0x10')]['message']);return _0x467fa1(_0x41bec1[_0xa795('0x10')][_0xa795('0x11')]);}else{logger[_0xa795('0xa')](_0xa795('0xb'),_0x364200,_0xa795('0xc'));_0x467fa1(_0x41bec1['result'][_0xa795('0x11')]);}})[_0xa795('0x12')](function(_0x3577e4){logger[_0xa795('0x10')](_0xa795('0xb'),_0x364200,_0x3577e4);_0x227d7d(_0x3577e4);});});}exports[_0xa795('0x13')]=function(_0x45a9bf){var _0xf103f0=this;return new Promise(function(_0x44e9bd,_0x1ebf4b){return db[_0xa795('0x14')][_0xa795('0x15')](_0x45a9bf[_0xa795('0x16')],{'raw':_0x45a9bf['options']?_0x45a9bf['options'][_0xa795('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x583af7){logger[_0xa795('0xa')](_0xa795('0x13'),_0x45a9bf);logger['debug']('CreateCmHopperHistory',_0x45a9bf,JSON[_0xa795('0xf')](_0x583af7));_0x44e9bd(_0x583af7);})['catch'](function(_0x36c96d){logger[_0xa795('0x10')](_0xa795('0x13'),_0x36c96d['message'],_0x45a9bf);_0x1ebf4b(_0xf103f0[_0xa795('0x10')](0x1f4,_0x36c96d[_0xa795('0x11')]));});});};exports[_0xa795('0x18')]=function(_0x2b7446){var _0x5527a6=this;return new Promise(function(_0x52b1af,_0x40c2b4){return db[_0xa795('0x14')][_0xa795('0x19')]({'raw':_0x2b7446['options']?_0x2b7446['options'][_0xa795('0x17')]===undefined?!![]:![]:!![],'where':_0x2b7446['options']?_0x2b7446[_0xa795('0x1a')]['where']||null:null,'attributes':[[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')][_0xa795('0x1d')]('id')),_0xa795('0x1e')],[db['sequelize']['fn']('COUNT',db[_0xa795('0x1b')]['fn']('IF',db['sequelize'][_0xa795('0x1f')](_0xa795('0x20')))),_0xa795('0x21')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x22')))),_0xa795('0x23')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0xa795('0x24')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x25'),db['sequelize']['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x26')))),'predictiveIntervalAvgHoldtime'],[db[_0xa795('0x1b')]['fn']('AVG',db[_0xa795('0x1b')]['fn']('IF',db['sequelize'][_0xa795('0x1f')](_0xa795('0x27')))),_0xa795('0x28')]]})[_0xa795('0x9')](function(_0x1ad9dd){logger[_0xa795('0xa')](_0xa795('0x18'),_0x2b7446);logger['debug'](_0xa795('0x18'),_0x2b7446,JSON['stringify'](_0x1ad9dd));_0x52b1af(_0x1ad9dd);})[_0xa795('0x12')](function(_0x9b9f18){logger[_0xa795('0x10')]('AvgHandleTime',_0x9b9f18['message'],_0x2b7446);_0x40c2b4(_0x5527a6['error'](0x1f4,_0x9b9f18[_0xa795('0x11')]));});});};exports[_0xa795('0x29')]=function(_0x1b810d){var _0x194ddf=this;return new Promise(function(_0x20316f,_0x2cf4e0){return db[_0xa795('0x14')][_0xa795('0x19')]({'raw':_0x1b810d[_0xa795('0x1a')]?_0x1b810d[_0xa795('0x1a')][_0xa795('0x17')]===undefined?!![]:![]:!![],'where':_0x1b810d[_0xa795('0x1a')]?_0x1b810d['options']['where']||null:null,'attributes':[[_0xa795('0x2a'),_0xa795('0x2b')],[db[_0xa795('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa795('0x1b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0xa795('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x2c')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0xa795('0x1c'),db['sequelize']['fn']('IF',db[_0xa795('0x1b')]['literal'](_0xa795('0x20')))),_0xa795('0x2d')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')]('`state`\x20=\x205,\x201,\x20null'))),_0xa795('0x2e')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')]['literal'](_0xa795('0x2f')))),_0xa795('0x30')],[db[_0xa795('0x1b')]['fn']('COUNT',db[_0xa795('0x1b')]['fn']('IF',db['sequelize'][_0xa795('0x1f')](_0xa795('0x31')))),_0xa795('0x32')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db['sequelize'][_0xa795('0x1f')](_0xa795('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x34')))),'outboundUnknownCallsDay'],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x35')))),_0xa795('0x36')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x37')))),_0xa795('0x38')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa795('0x39')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa795('0x3a')],[db['sequelize']['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')][_0xa795('0x1f')](_0xa795('0x3b')))),_0xa795('0x39')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')]['literal'](_0xa795('0x3c')))),'outboundReCallsDay']],'group':[_0xa795('0x2a')]})[_0xa795('0x9')](function(_0x2af625){logger[_0xa795('0xa')](_0xa795('0x29'),_0x1b810d);logger[_0xa795('0xd')](_0xa795('0x29'),_0x1b810d,JSON[_0xa795('0xf')](_0x2af625));_0x20316f(_0x2af625);})[_0xa795('0x12')](function(_0x39d5a1){logger[_0xa795('0x10')](_0xa795('0x29'),_0x39d5a1[_0xa795('0x11')],_0x1b810d);_0x2cf4e0(_0x194ddf[_0xa795('0x10')](0x1f4,_0x39d5a1['message']));});});};exports[_0xa795('0x3d')]=function(_0x5c92b5){var _0xae99e6=this;return new Promise(function(_0x7cbd86,_0x7ea1d8){return db[_0xa795('0x14')]['findAll']({'raw':_0x5c92b5[_0xa795('0x1a')]?_0x5c92b5[_0xa795('0x1a')][_0xa795('0x17')]===undefined?!![]:![]:!![],'where':_0x5c92b5[_0xa795('0x1a')]?_0x5c92b5[_0xa795('0x1a')]['where']||null:null,'attributes':[['campaign',_0xa795('0x2b')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')][_0xa795('0x1d')]('id')),_0xa795('0x3e')],[db[_0xa795('0x1b')]['fn'](_0xa795('0x1c'),db[_0xa795('0x1b')]['fn']('IF',db[_0xa795('0x1b')]['literal'](_0xa795('0x20')))),_0xa795('0x3f')]],'group':[_0xa795('0x2a')]})[_0xa795('0x9')](function(_0x40b630){logger[_0xa795('0xa')](_0xa795('0x3d'),_0x5c92b5);logger[_0xa795('0xd')](_0xa795('0x3d'),_0x5c92b5,JSON['stringify'](_0x40b630));_0x7cbd86(_0x40b630);})[_0xa795('0x12')](function(_0x2bcbaa){logger['error'](_0xa795('0x3d'),_0x2bcbaa[_0xa795('0x11')],_0x5c92b5);_0x7ea1d8(_0xae99e6['error'](0x1f4,_0x2bcbaa[_0xa795('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 8baa71d..adef571 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 _0x76ec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','create','put','update','exports','multer','path'];(function(_0x1c69f0,_0x1b1385){var _0x437044=function(_0x4da23d){while(--_0x4da23d){_0x1c69f0['push'](_0x1c69f0['shift']());}};_0x437044(++_0x1b1385);}(_0x76ec,0x18d));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc76e('0x0'));var util=require('util');var path=require(_0xc76e('0x1'));var timeout=require(_0xc76e('0x2'));var express=require(_0xc76e('0x3'));var router=express[_0xc76e('0x4')]();var fs_extra=require(_0xc76e('0x5'));var auth=require(_0xc76e('0x6'));var interaction=require(_0xc76e('0x7'));var config=require(_0xc76e('0x8'));var controller=require('./cmHopperHistory.controller');router[_0xc76e('0x9')]('/',auth['isAuthenticated'](),controller[_0xc76e('0xa')]);router[_0xc76e('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc76e('0xb')]);router[_0xc76e('0x9')](_0xc76e('0xc'),auth[_0xc76e('0xd')](),controller[_0xc76e('0xe')]);router['post']('/',auth[_0xc76e('0xd')](),controller[_0xc76e('0xf')]);router[_0xc76e('0x10')](_0xc76e('0xc'),auth[_0xc76e('0xd')](),controller[_0xc76e('0x11')]);module[_0xc76e('0x12')]=router; \ No newline at end of file +var _0xea43=['create','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xea43,0x147));var _0x3ea4=function(_0x27e369,_0x113dca){_0x27e369=_0x27e369-0x0;var _0x4824ea=_0xea43[_0x27e369];return _0x4824ea;};'use strict';var multer=require('multer');var util=require(_0x3ea4('0x0'));var path=require(_0x3ea4('0x1'));var timeout=require(_0x3ea4('0x2'));var express=require('express');var router=express[_0x3ea4('0x3')]();var fs_extra=require(_0x3ea4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3ea4('0x5'));var config=require(_0x3ea4('0x6'));var controller=require(_0x3ea4('0x7'));router[_0x3ea4('0x8')]('/',auth[_0x3ea4('0x9')](),controller[_0x3ea4('0xa')]);router[_0x3ea4('0x8')](_0x3ea4('0xb'),auth['isAuthenticated'](),controller[_0x3ea4('0xc')]);router[_0x3ea4('0x8')](_0x3ea4('0xd'),auth[_0x3ea4('0x9')](),controller['show']);router[_0x3ea4('0xe')]('/',auth[_0x3ea4('0x9')](),controller[_0x3ea4('0xf')]);router[_0x3ea4('0x10')](_0x3ea4('0xd'),auth[_0x3ea4('0x9')](),controller[_0x3ea4('0x11')]);module[_0x3ea4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5c14075..3bb1cd1 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 _0x1793=['STRING','name','sequelize','exports'];(function(_0x2bc48a,_0x4b3055){var _0x3c9c6d=function(_0x1cfed4){while(--_0x1cfed4){_0x2bc48a['push'](_0x2bc48a['shift']());}};_0x3c9c6d(++_0x4b3055);}(_0x1793,0x1ce));var _0x3179=function(_0x17db01,_0x4e3110){_0x17db01=_0x17db01-0x0;var _0x5b02aa=_0x1793[_0x17db01];return _0x5b02aa;};'use strict';var Sequelize=require(_0x3179('0x0'));module[_0x3179('0x1')]={'name':{'type':Sequelize[_0x3179('0x2')],'unique':_0x3179('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3179('0x2')]}}; \ No newline at end of file +var _0xe799=['sequelize','STRING'];(function(_0x8e3ad8,_0x5d5edd){var _0x1e347d=function(_0x159ccc){while(--_0x159ccc){_0x8e3ad8['push'](_0x8e3ad8['shift']());}};_0x1e347d(++_0x5d5edd);}(_0xe799,0x170));var _0x9e79=function(_0x5d5234,_0x99d06){_0x5d5234=_0x5d5234-0x0;var _0x9c194f=_0xe799[_0x5d5234];return _0x9c194f;};'use strict';var Sequelize=require(_0x9e79('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e79('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9e79('0x1')]},'dialPrefix':{'type':Sequelize[_0x9e79('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 48ebb7f..3b04ab2 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 _0x67f9=['localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','model','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','includeAll','findAll','rows','show','params','keys','merge','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','CmContact','tags','isArray','length','join','push','each','omit','success','dataValues','errors','json','getContacts','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','message','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x5706ee,_0x3fa312){var _0x1e63af=function(_0x589630){while(--_0x589630){_0x5706ee['push'](_0x5706ee['shift']());}};_0x1e63af(++_0x3fa312);}(_0x67f9,0x1da));var _0x967f=function(_0x431d3b,_0x3a0377){_0x431d3b=_0x431d3b-0x0;var _0x22bcbb=_0x67f9[_0x431d3b];return _0x22bcbb;};'use strict';var emlformat=require(_0x967f('0x0'));var rimraf=require(_0x967f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x967f('0x2'));var rp=require(_0x967f('0x3'));var moment=require('moment');var BPromise=require(_0x967f('0x4'));var Mustache=require(_0x967f('0x5'));var util=require(_0x967f('0x6'));var path=require('path');var sox=require(_0x967f('0x7'));var csv=require(_0x967f('0x8'));var ejs=require(_0x967f('0x9'));var fs=require('fs');var fs_extra=require(_0x967f('0xa'));var _=require(_0x967f('0xb'));var squel=require(_0x967f('0xc'));var crypto=require(_0x967f('0xd'));var jsforce=require(_0x967f('0xe'));var deskjs=require(_0x967f('0xf'));var toCsv=require(_0x967f('0x8'));var querystring=require(_0x967f('0x10'));var Papa=require('papaparse');var Redis=require(_0x967f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x967f('0x12'));var as=require(_0x967f('0x13'));var hardwareService=require(_0x967f('0x14'));var logger=require('../../config/logger')(_0x967f('0x15'));var utils=require(_0x967f('0x16'));var config=require(_0x967f('0x17'));var licenseUtil=require(_0x967f('0x18'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x967f('0x19')]=_[_0x967f('0x1a')](config[_0x967f('0x19')],{'host':_0x967f('0x1b'),'port':0x18eb});var socket=require(_0x967f('0x1c'))(new Redis(config[_0x967f('0x19')]));require(_0x967f('0x1d'))[_0x967f('0x1e')](socket);function respondWithStatusCode(_0x3dc5cd,_0x54493c){_0x54493c=_0x54493c||0xcc;return function(_0x583d60){if(_0x583d60){return _0x3dc5cd[_0x967f('0x1f')](_0x54493c);}return _0x3dc5cd[_0x967f('0x20')](_0x54493c)[_0x967f('0x21')]();};}function respondWithResult(_0x3c8c77,_0x46eb3a){_0x46eb3a=_0x46eb3a||0xc8;return function(_0x56c8de){if(_0x56c8de){return _0x3c8c77['status'](_0x46eb3a)['json'](_0x56c8de);}};}function respondWithFilteredResult(_0x5da617,_0x2f7616){return function(_0x367d7e){if(_0x367d7e){var _0x485100=typeof _0x2f7616['offset']===_0x967f('0x22')&&typeof _0x2f7616['limit']===_0x967f('0x22');var _0x2eeb24=_0x367d7e[_0x967f('0x23')];var _0x1163cb=_0x485100?0x0:_0x2f7616['offset'];var _0x59f1e2=_0x485100?_0x367d7e['count']:_0x2f7616[_0x967f('0x24')]+_0x2f7616[_0x967f('0x25')];var _0xd29432;if(_0x59f1e2>=_0x2eeb24){_0x59f1e2=_0x2eeb24;_0xd29432=0xc8;}else{_0xd29432=0xce;}_0x5da617[_0x967f('0x20')](_0xd29432);return _0x5da617[_0x967f('0x26')]('Content-Range',_0x1163cb+'-'+_0x59f1e2+'/'+_0x2eeb24)['json'](_0x367d7e);}return null;};}function patchUpdates(_0xbdcd20){return function(_0x19424b){try{jsonpatch[_0x967f('0x27')](_0x19424b,_0xbdcd20,!![]);}catch(_0x3c96de){return BPromise[_0x967f('0x28')](_0x3c96de);}return _0x19424b[_0x967f('0x29')]();};}function saveUpdates(_0x1093c6,_0x2cb589){return function(_0x243cbc){if(_0x243cbc){return _0x243cbc[_0x967f('0x2a')](_0x1093c6)[_0x967f('0x2b')](function(_0x4f4680){return _0x4f4680;});}return null;};}function removeEntity(_0x5820a2,_0x1a1de7){return function(_0x70262f){if(_0x70262f){return _0x70262f[_0x967f('0x2c')]()[_0x967f('0x2b')](function(){var _0x11c37d=_0x70262f['get']({'plain':!![]});var _0x14ff93='Lists';return db['UserProfileResource'][_0x967f('0x2c')]({'where':{'type':_0x14ff93,'resourceId':_0x11c37d['id']}})[_0x967f('0x2b')](function(){return _0x70262f;});})[_0x967f('0x2b')](function(){_0x5820a2['status'](0xcc)[_0x967f('0x21')]();});}};}function handleEntityNotFound(_0x1da7b8,_0x1e8fcf){return function(_0x448037){if(!_0x448037){_0x1da7b8['sendStatus'](0x194);}return _0x448037;};}function handleError(_0xba9a58,_0x7eeba7){_0x7eeba7=_0x7eeba7||0x1f4;return function(_0xcc63bb){logger[_0x967f('0x2d')](_0xcc63bb[_0x967f('0x2e')]);if(_0xcc63bb['name']){delete _0xcc63bb[_0x967f('0x2f')];}_0xba9a58[_0x967f('0x20')](_0x7eeba7)[_0x967f('0x30')](_0xcc63bb);};}exports[_0x967f('0x31')]=function(_0x4febb2,_0x498540){var _0x2d845c={},_0x282953={},_0x4e3b7f={'count':0x0,'rows':[]};var _0x548a28=_[_0x967f('0x32')](db[_0x967f('0x33')][_0x967f('0x34')],function(_0x570d40){return{'name':_0x570d40[_0x967f('0x35')],'type':_0x570d40['type']['key']};});_0x282953[_0x967f('0x36')]=_[_0x967f('0x32')](_0x548a28,_0x967f('0x2f'));_0x282953['query']=_['keys'](_0x4febb2[_0x967f('0x37')]);_0x282953['filters']=_['intersection'](_0x282953[_0x967f('0x36')],_0x282953[_0x967f('0x37')]);_0x2d845c[_0x967f('0x38')]=_[_0x967f('0x39')](_0x282953['model'],qs[_0x967f('0x3a')](_0x4febb2['query'][_0x967f('0x3a')]));_0x2d845c[_0x967f('0x38')]=_0x2d845c[_0x967f('0x38')]['length']?_0x2d845c[_0x967f('0x38')]:_0x282953[_0x967f('0x36')];if(!_0x4febb2[_0x967f('0x37')]['hasOwnProperty'](_0x967f('0x3b'))){_0x2d845c[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x4febb2[_0x967f('0x37')][_0x967f('0x25')]);_0x2d845c[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x4febb2[_0x967f('0x37')][_0x967f('0x24')]);}_0x2d845c[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x4febb2[_0x967f('0x37')][_0x967f('0x3d')]);_0x2d845c[_0x967f('0x3e')]=qs[_0x967f('0x3f')](_[_0x967f('0x40')](_0x4febb2['query'],_0x282953['filters']),_0x548a28);if(_0x4febb2[_0x967f('0x37')][_0x967f('0x41')]){_0x2d845c[_0x967f('0x3e')]=_['merge'](_0x2d845c[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x548a28,function(_0x22288b){if(_0x22288b[_0x967f('0x42')]!==_0x967f('0x43')){var _0x2d25bd={};_0x2d25bd[_0x22288b['name']]={'$like':'%'+_0x4febb2[_0x967f('0x37')][_0x967f('0x41')]+'%'};return _0x2d25bd;}})});}_0x2d845c=_['merge']({},_0x2d845c,_0x4febb2['options']);var _0x2e5da4={'where':_0x2d845c[_0x967f('0x3e')]};return db[_0x967f('0x33')][_0x967f('0x23')](_0x2e5da4)[_0x967f('0x2b')](function(_0x11c3cb){_0x4e3b7f['count']=_0x11c3cb;if(_0x4febb2[_0x967f('0x37')][_0x967f('0x44')]){_0x2d845c['include']=[{'all':!![]}];}return db[_0x967f('0x33')][_0x967f('0x45')](_0x2d845c);})['then'](function(_0x1f1baa){_0x4e3b7f[_0x967f('0x46')]=_0x1f1baa;return _0x4e3b7f;})['then'](respondWithFilteredResult(_0x498540,_0x2d845c))['catch'](handleError(_0x498540,null));};exports[_0x967f('0x47')]=function(_0x9e050e,_0x37f4ad){var _0x220c07={'raw':![],'where':{'id':_0x9e050e[_0x967f('0x48')]['id']}},_0x3c674a={};_0x3c674a[_0x967f('0x36')]=_[_0x967f('0x49')](db['CmList'][_0x967f('0x34')]);_0x3c674a[_0x967f('0x37')]=_[_0x967f('0x49')](_0x9e050e['query']);_0x3c674a[_0x967f('0x3f')]=_[_0x967f('0x39')](_0x3c674a[_0x967f('0x36')],_0x3c674a[_0x967f('0x37')]);_0x220c07['attributes']=_[_0x967f('0x39')](_0x3c674a[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x9e050e[_0x967f('0x37')]['fields']));_0x220c07[_0x967f('0x38')]=_0x220c07[_0x967f('0x38')]['length']?_0x220c07[_0x967f('0x38')]:_0x3c674a[_0x967f('0x36')];if(_0x9e050e[_0x967f('0x37')][_0x967f('0x44')]){_0x220c07['include']=[{'all':!![]}];}_0x220c07=_[_0x967f('0x4a')]({},_0x220c07,_0x9e050e[_0x967f('0x4b')]);return db['CmList'][_0x967f('0x4c')](_0x220c07)[_0x967f('0x2b')](handleEntityNotFound(_0x37f4ad,null))[_0x967f('0x2b')](respondWithResult(_0x37f4ad,null))[_0x967f('0x4d')](handleError(_0x37f4ad,null));};exports[_0x967f('0x4e')]=function(_0x1b2e64,_0x17cb2d){return db[_0x967f('0x33')]['create'](_0x1b2e64[_0x967f('0x4f')],{})['then'](function(_0x340c88){var _0x201242=_0x1b2e64[_0x967f('0x50')][_0x967f('0x51')]({'plain':!![]});if(!_0x201242)throw new Error(_0x967f('0x52'));if(_0x201242['role']===_0x967f('0x50')){var _0x2cb0d6=_0x340c88[_0x967f('0x51')]({'plain':!![]});var _0x273437=_0x967f('0x53');return db['UserProfileSection']['find']({'where':{'name':_0x273437,'userProfileId':_0x201242[_0x967f('0x54')]},'raw':!![]})[_0x967f('0x2b')](function(_0x342432){if(_0x342432&&_0x342432[_0x967f('0x55')]===0x0){return db[_0x967f('0x56')][_0x967f('0x4e')]({'name':_0x2cb0d6[_0x967f('0x2f')],'resourceId':_0x2cb0d6['id'],'type':_0x342432[_0x967f('0x2f')],'sectionId':_0x342432['id']},{})['then'](function(){return _0x340c88;});}else{return _0x340c88;}})[_0x967f('0x4d')](function(_0x530108){logger['error'](_0x967f('0x57'),_0x530108);throw _0x530108;});}return _0x340c88;})[_0x967f('0x2b')](respondWithResult(_0x17cb2d,0xc9))[_0x967f('0x4d')](handleError(_0x17cb2d,null));};exports[_0x967f('0x2a')]=function(_0x448662,_0x30110d){if(_0x448662[_0x967f('0x4f')]['id']){delete _0x448662['body']['id'];}return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x448662[_0x967f('0x48')]['id']}})['then'](handleEntityNotFound(_0x30110d,null))['then'](saveUpdates(_0x448662[_0x967f('0x4f')],null))[_0x967f('0x2b')](respondWithResult(_0x30110d,null))['catch'](handleError(_0x30110d,null));};exports[_0x967f('0x2c')]=function(_0x56f2d0,_0x2dd74c){return db[_0x967f('0x33')]['find']({'where':{'id':_0x56f2d0[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x2dd74c,null))[_0x967f('0x2b')](removeEntity(_0x2dd74c,null))[_0x967f('0x4d')](handleError(_0x2dd74c,null));};exports['describe']=function(_0x3ee3cd,_0x15a8f2){return db[_0x967f('0x33')][_0x967f('0x58')]()[_0x967f('0x2b')](respondWithResult(_0x15a8f2,null))[_0x967f('0x4d')](handleError(_0x15a8f2,null));};exports[_0x967f('0x59')]=function(_0x306634,_0x4078ce,_0x3af1b5){if(_0x306634['body']['id']){delete _0x306634[_0x967f('0x4f')]['id'];}return db['CmList']['find']({'where':{'id':_0x306634[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x4078ce,null))[_0x967f('0x2b')](function(_0x13fc95){if(_0x13fc95){_0x306634[_0x967f('0x4f')][_0x967f('0x5a')]=_0x13fc95['id'];return db[_0x967f('0x5b')]['create'](_0x306634['body']);}})[_0x967f('0x2b')](respondWithResult(_0x4078ce,null))[_0x967f('0x4d')](handleError(_0x4078ce,null));};exports[_0x967f('0x5c')]=function(_0x2d6096,_0xf1f706,_0x337a17){var _0x36ec5c={'raw':![],'where':{}};var _0x29ade8={};var _0x91973c={'count':0x0,'rows':[]};return db[_0x967f('0x33')][_0x967f('0x5d')]({'where':{'id':_0x2d6096['params']['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0xf1f706,null))[_0x967f('0x2b')](function(_0x24318c){if(_0x24318c){_0x29ade8[_0x967f('0x36')]=_[_0x967f('0x49')](db[_0x967f('0x5b')][_0x967f('0x34')]);_0x29ade8[_0x967f('0x37')]=_[_0x967f('0x49')](_0x2d6096[_0x967f('0x37')]);_0x29ade8[_0x967f('0x3f')]=_['intersection'](_0x29ade8[_0x967f('0x36')],_0x29ade8[_0x967f('0x37')]);_0x36ec5c[_0x967f('0x38')]=_[_0x967f('0x39')](_0x29ade8[_0x967f('0x36')],qs['fields'](_0x2d6096['query'][_0x967f('0x3a')]));_0x36ec5c[_0x967f('0x38')]=_0x36ec5c[_0x967f('0x38')]['length']?_0x36ec5c[_0x967f('0x38')]:_0x29ade8[_0x967f('0x36')];if(!_0x2d6096[_0x967f('0x37')][_0x967f('0x5e')]('nolimit')){_0x36ec5c[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x2d6096[_0x967f('0x37')][_0x967f('0x25')]);_0x36ec5c['offset']=qs[_0x967f('0x24')](_0x2d6096[_0x967f('0x37')][_0x967f('0x24')]);}_0x36ec5c['order']=qs['sort'](_0x2d6096[_0x967f('0x37')]['sort']);_0x36ec5c['where']=qs['filters'](_[_0x967f('0x40')](_0x2d6096[_0x967f('0x37')],_0x29ade8[_0x967f('0x3f')]));_0x36ec5c[_0x967f('0x3e')][_0x967f('0x5a')]=_0x24318c['id'];if(_0x2d6096[_0x967f('0x37')][_0x967f('0x41')]){_0x36ec5c[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x36ec5c[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x36ec5c[_0x967f('0x38')],function(_0x3021ea){var _0x60f240={};_0x60f240[_0x3021ea]={'$like':'%'+_0x2d6096['query'][_0x967f('0x41')]+'%'};return _0x60f240;})});}_0x36ec5c=_[_0x967f('0x4a')]({},_0x36ec5c,_0x2d6096[_0x967f('0x4b')]);return db['Disposition'][_0x967f('0x23')]({'where':_0x36ec5c[_0x967f('0x3e')]})[_0x967f('0x2b')](function(_0x246908){_0x91973c[_0x967f('0x23')]=_0x246908;if(_0x2d6096[_0x967f('0x37')][_0x967f('0x44')]){_0x36ec5c[_0x967f('0x5f')]=[{'all':!![]}];}return db[_0x967f('0x5b')][_0x967f('0x45')](_0x36ec5c);})[_0x967f('0x2b')](function(_0x1172c6){_0x91973c[_0x967f('0x46')]=_0x1172c6;return _0x91973c;});}})['then'](respondWithFilteredResult(_0xf1f706,_0x36ec5c))['catch'](handleError(_0xf1f706,null));};exports['removeDispositions']=function(_0x55a7d4,_0x420380,_0x3df23b){return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x55a7d4[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x420380,null))['then'](function(_0x1f6031){if(_0x1f6031){return _0x1f6031[_0x967f('0x60')](_0x55a7d4[_0x967f('0x37')][_0x967f('0x61')]);}})[_0x967f('0x2b')](respondWithStatusCode(_0x420380,null))[_0x967f('0x4d')](handleError(_0x420380,null));};exports['addContacts']=function(_0x3f7766,_0x57c875,_0xd8b2a3){return db['CmList'][_0x967f('0x4c')]({'where':{'id':_0x3f7766[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x57c875,null))['then'](function(_0x24caed){if(_0x24caed){var _0x791f3e=[];var _0x303a45={'success':[],'errors':[]};return db[_0x967f('0x62')][_0x967f('0x58')]()[_0x967f('0x2b')](function(_0x22c415){if(_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]&&_[_0x967f('0x64')](_0x3f7766['body']['tags'])){if(_0x3f7766['body'][_0x967f('0x63')][_0x967f('0x65')]){_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]=_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')][_0x967f('0x66')](';')+';';}else{_0x3f7766[_0x967f('0x4f')]['tags']=null;}}else{_0x3f7766[_0x967f('0x4f')][_0x967f('0x63')]=null;}if(_0x3f7766['body']&&_[_0x967f('0x64')](_0x3f7766['body'])){for(var _0x2f6f95=0x0;_0x2f6f95<_0x3f7766[_0x967f('0x4f')][_0x967f('0x65')];_0x2f6f95+=0x1){_0x3f7766[_0x967f('0x4f')][_0x2f6f95][_0x967f('0x5a')]=_0x3f7766[_0x967f('0x48')]['id'];_0x791f3e[_0x967f('0x67')](_0x3f7766['body'][_0x2f6f95]);}return BPromise[_0x967f('0x68')](_0x791f3e,function(_0x6d9913){return db[_0x967f('0x62')][_0x967f('0x4e')](_[_0x967f('0x69')](_0x6d9913,[_0x967f('0x61'),'id'])||{},{'fields':_[_0x967f('0x49')](_0x22c415),'raw':!![]})[_0x967f('0x2b')](function(_0x4aea06){_0x303a45[_0x967f('0x6a')]['push'](_0x4aea06[_0x967f('0x6b')]);})['catch'](function(_0x4b5961){_0x303a45[_0x967f('0x6c')]['push']({'data':_0x6d9913,'error':_0x4b5961['message']});});})[_0x967f('0x2b')](function(_0x2dadfd){return _0x303a45;})['catch'](function(_0xb82ba){return _0xb82ba;});}else{_0x57c875[_0x967f('0x20')](0x190)[_0x967f('0x6d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x967f('0x2b')](respondWithResult(_0x57c875,null))[_0x967f('0x4d')](handleError(_0x57c875,null));};exports[_0x967f('0x6e')]=function(_0x447338,_0x146ce6,_0x378dcc){var _0x457bd2;return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x447338['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x967f('0x6f')}]})[_0x967f('0x2b')](handleEntityNotFound(_0x146ce6,null))['then'](function(_0x31de89){if(_0x31de89){_0x457bd2=_0x31de89;return db['CmContact']['rawAttributes'];}})[_0x967f('0x2b')](function(_0x2cf1a4){if(_0x2cf1a4){var _0x70f934={};var _0x55c1c4={};_0x55c1c4[_0x967f('0x36')]=_['concat'](_['keys'](_0x2cf1a4),_['map'](_0x457bd2[_0x967f('0x6f')],function(_0x3b0f2a){return util[_0x967f('0x70')](_0x967f('0x71'),_0x3b0f2a['id']);}));_0x55c1c4['query']=_[_0x967f('0x49')](_0x447338[_0x967f('0x37')]);_0x55c1c4[_0x967f('0x3f')]=_[_0x967f('0x39')](_0x55c1c4[_0x967f('0x36')],_0x55c1c4['query']);_0x70f934['attributes']=_[_0x967f('0x39')](_0x55c1c4[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x447338[_0x967f('0x37')][_0x967f('0x3a')]));_0x70f934[_0x967f('0x38')]=_0x70f934['attributes'][_0x967f('0x65')]?_0x70f934['attributes']:_0x55c1c4[_0x967f('0x36')];if(!_0x447338[_0x967f('0x37')][_0x967f('0x5e')](_0x967f('0x3b'))){_0x70f934[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x447338[_0x967f('0x37')][_0x967f('0x25')]);_0x70f934[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x447338[_0x967f('0x37')][_0x967f('0x24')]);}_0x70f934['order']=qs[_0x967f('0x3d')](_0x447338[_0x967f('0x37')][_0x967f('0x3d')]);_0x70f934['where']=qs[_0x967f('0x3f')](_[_0x967f('0x40')](_0x447338[_0x967f('0x37')],_0x55c1c4[_0x967f('0x3f')]));_0x70f934[_0x967f('0x72')]=!![];if(_0x447338[_0x967f('0x37')][_0x967f('0x41')]){_0x70f934[_0x967f('0x3e')]=_['merge'](_0x70f934[_0x967f('0x3e')],{'$or':_[_0x967f('0x32')](_0x70f934[_0x967f('0x38')],function(_0x54df9e){var _0x296ce2={};_0x296ce2[_0x54df9e]={'$like':'%'+_0x447338['query'][_0x967f('0x41')]+'%'};return _0x296ce2;})});}_0x70f934=_['merge']({},_0x70f934,_0x447338[_0x967f('0x4b')]);return _0x457bd2['getContacts'](_0x70f934);}})[_0x967f('0x2b')](respondWithResult(_0x146ce6,null))[_0x967f('0x4d')](handleError(_0x146ce6,null));};exports[_0x967f('0x73')]=function(_0x2bfdb9,_0x43551a,_0x235698){var _0x187ab3;var _0x433f80;var _0x5f05de;var _0x47e1ca=_0x2bfdb9[_0x967f('0x48')]['id'];csv_results=[];return db[_0x967f('0x74')]['findAll']({'attributes':['id',_0x967f('0x2f')],'raw':!![],'order':[_0x967f('0x75')]})[_0x967f('0x2b')](function(_0x27e2a0){_0x187ab3=_0x27e2a0;var _0xf68ef4=_[_0x967f('0x49')](db[_0x967f('0x62')][_0x967f('0x34')]);return db[_0x967f('0x76')][_0x967f('0x45')]({'raw':!![],'attributes':['id',_0x967f('0x77')]})[_0x967f('0x2b')](function(_0x830fe0){_0x433f80=_0x830fe0;var _0x47503d=squel['select']()['fields'](_0xf68ef4)[_0x967f('0x78')](_0x967f('0x79'),'c')['where'](_0x967f('0x7a'),_0x47e1ca)['where']('c.deletedAt\x20is\x20null')[_0x967f('0x7b')]();for(var _0xa28e11=0x0;_0xa28e11<_0x433f80['length'];_0xa28e11++){_0x47503d[_0x967f('0x7c')]('c.cf_'+_0x433f80[_0xa28e11]['id'],_0x967f('0x7d')+_0x433f80[_0xa28e11][_0x967f('0x77')]);}for(var _0xa28e11=0x0;_0xa28e11<_0x187ab3[_0x967f('0x65')];_0xa28e11++){_0x47503d[_0x967f('0x7c')](squel[_0x967f('0x7e')]()[_0x967f('0x7c')](_0x967f('0x7f'))[_0x967f('0x78')](_0x967f('0x80'))['where'](_0x967f('0x81'),_0x187ab3[_0xa28e11]['id'])['where'](_0x967f('0x82')),'additionalPhone_'+_0x187ab3[_0xa28e11][_0x967f('0x2f')]);_0x47503d[_0x967f('0x7c')](squel[_0x967f('0x7e')]()[_0x967f('0x7c')](_0x967f('0x83'))[_0x967f('0x78')](_0x967f('0x80'))['where']('ItemTypeId\x20=\x20?',_0x187ab3[_0xa28e11]['id'])[_0x967f('0x3e')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x187ab3[_0xa28e11][_0x967f('0x2f')]);}var _0x40f036=[];_0x40f036[_0x967f('0x67')](_0x47503d[_0x967f('0x84')]());BPromise['each'](_0x40f036,handleQuery)[_0x967f('0x2b')](function(_0x3691ec){handleQuery(_0x47503d[_0x967f('0x84')]());var _0x2ac3d9=csv_results[0x0];if(!_[_0x967f('0x85')](_0x2ac3d9)){var _0x113af0=toCsv(_0x2ac3d9);var _0x1b7b07=Date['now']();fs[_0x967f('0x86')](util[_0x967f('0x70')](_0x967f('0x87'),_0x47e1ca,_0x1b7b07),_0x113af0);_0x43551a['setHeader'](_0x967f('0x88'),_0x967f('0x89')+util[_0x967f('0x70')](_0x967f('0x8a'),_0x47e1ca,_0x1b7b07));_0x43551a['setHeader'](_0x967f('0x8b'),_0x967f('0x8c'));return _0x43551a['download'](util[_0x967f('0x70')]('/tmp/list_%d_%s.csv',_0x47e1ca,_0x1b7b07));}else{return _0x43551a['sendStatus'](0xcc);}});});});};exports[_0x967f('0x8d')]=function(_0x1ce2b3,_0x567389,_0x3f0fee){var _0x2157b4;delete _0x1ce2b3[_0x967f('0x4f')]['id'];return db[_0x967f('0x33')]['findOne']({'where':{'id':_0x1ce2b3[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x567389,null))['then'](function(_0x4e7738){if(_0x4e7738){return db[_0x967f('0x8e')]['transaction'](function(_0x31315a){return db[_0x967f('0x76')]['create'](_0x1ce2b3[_0x967f('0x4f')],{'transaction':_0x31315a})[_0x967f('0x2b')](function(_0x332fcc){_0x2157b4=_0x332fcc;return _0x4e7738[_0x967f('0x8f')](_0x332fcc,{'transaction':_0x31315a});})[_0x967f('0x2b')](function(){var _0x31fbe2={'type':db[_0x967f('0x90')][_0x967f('0x91')],'transaction':_0x31315a};switch(_0x1ce2b3[_0x967f('0x4f')][_0x967f('0x42')]){case _0x967f('0x92'):_0x31fbe2['type']=db['Sequelize'][_0x967f('0x91')];break;case _0x967f('0x93'):_0x31fbe2[_0x967f('0x42')]=db[_0x967f('0x90')][_0x967f('0x94')];break;case'switch':_0x31fbe2['type']=db[_0x967f('0x90')][_0x967f('0x95')];_0x31fbe2[_0x967f('0x96')]=![];break;default:}return db[_0x967f('0x8e')][_0x967f('0x97')][_0x967f('0x98')]('cm_contacts',util['format'](_0x967f('0x99'),_0x2157b4['id']),_0x31fbe2);})['then'](function(){return _0x2157b4;});});}})[_0x967f('0x2b')](respondWithResult(_0x567389,null))[_0x967f('0x4d')](handleError(_0x567389,null));};exports[_0x967f('0x9a')]=function(_0x5b3183,_0x305da8,_0x353aac){var _0x69b4b1={};var _0x214244={};var _0x3d1e72;var _0x383acd;return db['CmList'][_0x967f('0x5d')]({'where':{'id':_0x5b3183['params']['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0x305da8,null))[_0x967f('0x2b')](function(_0x5e5651){if(_0x5e5651){_0x3d1e72=_0x5e5651;_0x214244[_0x967f('0x36')]=_[_0x967f('0x49')](db[_0x967f('0x76')][_0x967f('0x34')]);_0x214244['query']=_[_0x967f('0x49')](_0x5b3183[_0x967f('0x37')]);_0x214244[_0x967f('0x3f')]=_['intersection'](_0x214244['model'],_0x214244[_0x967f('0x37')]);_0x69b4b1[_0x967f('0x38')]=_[_0x967f('0x39')](_0x214244[_0x967f('0x36')],qs['fields'](_0x5b3183['query'][_0x967f('0x3a')]));_0x69b4b1[_0x967f('0x38')]=_0x69b4b1[_0x967f('0x38')][_0x967f('0x65')]?_0x69b4b1[_0x967f('0x38')]:_0x214244[_0x967f('0x36')];_0x69b4b1[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x5b3183[_0x967f('0x37')][_0x967f('0x3d')]);_0x69b4b1['where']=qs['filters'](_[_0x967f('0x40')](_0x5b3183['query'],_0x214244[_0x967f('0x3f')]));_0x69b4b1[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x69b4b1[_0x967f('0x3e')],{'$or':[{'ListId':_0x5e5651['id']},{'ListId':null}]});if(_0x5b3183['query'][_0x967f('0x41')]){_0x69b4b1[_0x967f('0x3e')]=_['merge'](_0x69b4b1[_0x967f('0x3e')],{'$or':_['map'](_0x69b4b1[_0x967f('0x38')],function(_0x4c68e8){var _0x27c919={};_0x27c919[_0x4c68e8]={'$like':'%'+_0x5b3183['query'][_0x967f('0x41')]+'%'};return _0x27c919;})});}_0x69b4b1=_[_0x967f('0x4a')]({},_0x69b4b1,_0x5b3183[_0x967f('0x4b')]);return db['CmCustomField'][_0x967f('0x9b')](_0x69b4b1);}})[_0x967f('0x2b')](respondWithResult(_0x305da8,null))[_0x967f('0x4d')](handleError(_0x305da8,null));};exports[_0x967f('0x9c')]=function(_0x39b56a,_0x12ad7b){return db[_0x967f('0x76')][_0x967f('0x9b')]({'where':{'ListId':null}})[_0x967f('0x2b')](handleEntityNotFound(_0x12ad7b,null))[_0x967f('0x2b')](function(_0x64b055){return _0x64b055;})['then'](respondWithResult(_0x12ad7b,null))[_0x967f('0x4d')](handleError(_0x12ad7b,null));};exports['addAgents']=function(_0x256e95,_0x535968,_0x47e0a8){return db[_0x967f('0x33')]['find']({'where':{'id':_0x256e95['params']['id']}})['then'](handleEntityNotFound(_0x535968,null))[_0x967f('0x2b')](function(_0x1723d3){if(_0x1723d3){return _0x1723d3[_0x967f('0x9d')](_0x256e95[_0x967f('0x4f')]['ids'],_[_0x967f('0x69')](_0x256e95[_0x967f('0x4f')],[_0x967f('0x61'),'id'])||{})['spread'](function(_0x337c10){for(var _0x1067c6=0x0;_0x1067c6<_0x256e95[_0x967f('0x4f')][_0x967f('0x61')][_0x967f('0x65')];_0x1067c6+=0x1){socket[_0x967f('0x9e')](_0x967f('0x9f'),{'UserId':Number(_0x256e95[_0x967f('0x4f')][_0x967f('0x61')][_0x1067c6]),'CmListId':Number(_0x256e95[_0x967f('0x48')]['id'])});}return _0x337c10;});}})[_0x967f('0x2b')](respondWithResult(_0x535968,null))['catch'](handleError(_0x535968,null));};exports[_0x967f('0xa0')]=function(_0x2264d1,_0x25d0d5,_0x9abb28){return db[_0x967f('0x33')][_0x967f('0x4c')]({'where':{'id':_0x2264d1[_0x967f('0x48')]['id']}})['then'](handleEntityNotFound(_0x25d0d5,null))[_0x967f('0x2b')](function(_0x760e54){if(_0x760e54){return _0x760e54[_0x967f('0xa0')](_0x2264d1['query'][_0x967f('0x61')])['then'](function(){if(_[_0x967f('0x64')](_0x2264d1['query'][_0x967f('0x61')])){for(var _0x2ebfd4=0x0;_0x2ebfd4<_0x2264d1[_0x967f('0x37')]['ids'][_0x967f('0x65')];_0x2ebfd4+=0x1){socket[_0x967f('0x9e')](_0x967f('0xa1'),{'UserId':Number(_0x2264d1[_0x967f('0x37')][_0x967f('0x61')][_0x2ebfd4]),'CmListId':Number(_0x2264d1[_0x967f('0x48')]['id'])});}}else{socket[_0x967f('0x9e')]('userCmList:remove',{'UserId':Number(_0x2264d1[_0x967f('0x37')][_0x967f('0x61')]),'CmListId':Number(_0x2264d1['params']['id'])});}});}})[_0x967f('0x2b')](respondWithStatusCode(_0x25d0d5,null))['catch'](handleError(_0x25d0d5,null));};exports[_0x967f('0xa2')]=function(_0x4aeff9,_0xe1f7d2,_0x4829c1){var _0x3f29c9={};var _0x50e935={};var _0x3e91dd;var _0x4d4f5e;return db[_0x967f('0x33')]['findOne']({'where':{'id':_0x4aeff9[_0x967f('0x48')]['id']}})[_0x967f('0x2b')](handleEntityNotFound(_0xe1f7d2,null))[_0x967f('0x2b')](function(_0x2f2423){if(_0x2f2423){_0x3e91dd=_0x2f2423;_0x50e935[_0x967f('0x36')]=_['keys'](db[_0x967f('0xa3')][_0x967f('0x34')]);_0x50e935[_0x967f('0x37')]=_[_0x967f('0x49')](_0x4aeff9[_0x967f('0x37')]);_0x50e935[_0x967f('0x3f')]=_['intersection'](_0x50e935[_0x967f('0x36')],_0x50e935[_0x967f('0x37')]);_0x3f29c9[_0x967f('0x38')]=_[_0x967f('0x39')](_0x50e935[_0x967f('0x36')],qs[_0x967f('0x3a')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x3a')]));_0x3f29c9[_0x967f('0x38')]=_0x3f29c9[_0x967f('0x38')][_0x967f('0x65')]?_0x3f29c9[_0x967f('0x38')]:_0x50e935[_0x967f('0x36')];_0x3f29c9[_0x967f('0x3c')]=qs[_0x967f('0x3d')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x3d')]);_0x3f29c9[_0x967f('0x3e')]=qs['filters'](_[_0x967f('0x40')](_0x4aeff9[_0x967f('0x37')],_0x50e935[_0x967f('0x3f')]));if(_0x4aeff9[_0x967f('0x37')]['filter']){_0x3f29c9[_0x967f('0x3e')]=_[_0x967f('0x4a')](_0x3f29c9['where'],{'$or':_[_0x967f('0x32')](_0x3f29c9[_0x967f('0x38')],function(_0x28d135){var _0x19a5c6={};_0x19a5c6[_0x28d135]={'$like':'%'+_0x4aeff9[_0x967f('0x37')][_0x967f('0x41')]+'%'};return _0x19a5c6;})});}_0x3f29c9=_['merge']({},_0x3f29c9,_0x4aeff9['options']);return _0x3e91dd[_0x967f('0xa2')](_0x3f29c9);}})[_0x967f('0x2b')](function(_0x4b42cd){if(_0x4b42cd){_0x4d4f5e=_0x4b42cd[_0x967f('0x65')];if(!_0x4aeff9[_0x967f('0x37')][_0x967f('0x5e')](_0x967f('0x3b'))){_0x3f29c9[_0x967f('0x25')]=qs[_0x967f('0x25')](_0x4aeff9['query']['limit']);_0x3f29c9[_0x967f('0x24')]=qs[_0x967f('0x24')](_0x4aeff9[_0x967f('0x37')][_0x967f('0x24')]);}return _0x3e91dd[_0x967f('0xa2')](_0x3f29c9);}})['then'](function(_0x1dbf94){if(_0x1dbf94){return _0x1dbf94?{'count':_0x4d4f5e,'rows':_0x1dbf94}:null;}})[_0x967f('0x2b')](respondWithResult(_0xe1f7d2,null))[_0x967f('0x4d')](handleError(_0xe1f7d2,null));};function handleQuery(_0x23a08d){logger[_0x967f('0xa4')](_0x23a08d);return db[_0x967f('0x8e')][_0x967f('0x37')](_0x23a08d)[_0x967f('0xa5')](function(_0x132338){csv_results[_0x967f('0x67')](_0x132338);})['catch'](function(_0x2af117){logger[_0x967f('0x2d')](_0x2af117[_0x967f('0xa6')]);});} \ No newline at end of file +var _0x6066=['destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','fields','attributes','length','query','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','CmList','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','findAll','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','ListId','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','format','cf_%d','nolimit','raw','getContactsCsv','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','isEmpty','now','writeFileSync','setHeader','Content-disposition','list_%d_%s.csv','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','TEXT','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','Lists','UserProfileResource'];(function(_0x214c5e,_0x49db2c){var _0x4ca795=function(_0x3e4328){while(--_0x3e4328){_0x214c5e['push'](_0x214c5e['shift']());}};_0x4ca795(++_0x49db2c);}(_0x6066,0x1c6));var _0x6606=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x6066[_0x999b85];return _0x1d7124;};'use strict';var emlformat=require(_0x6606('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6606('0x1'));var jsonpatch=require(_0x6606('0x2'));var rp=require(_0x6606('0x3'));var moment=require(_0x6606('0x4'));var BPromise=require(_0x6606('0x5'));var Mustache=require(_0x6606('0x6'));var util=require(_0x6606('0x7'));var path=require(_0x6606('0x8'));var sox=require(_0x6606('0x9'));var csv=require(_0x6606('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6606('0xb'));var _=require(_0x6606('0xc'));var squel=require(_0x6606('0xd'));var crypto=require(_0x6606('0xe'));var jsforce=require(_0x6606('0xf'));var deskjs=require(_0x6606('0x10'));var toCsv=require(_0x6606('0xa'));var querystring=require(_0x6606('0x11'));var Papa=require(_0x6606('0x12'));var Redis=require('ioredis');var authService=require(_0x6606('0x13'));var qs=require(_0x6606('0x14'));var as=require(_0x6606('0x15'));var hardwareService=require(_0x6606('0x16'));var logger=require(_0x6606('0x17'))(_0x6606('0x18'));var utils=require(_0x6606('0x19'));var config=require(_0x6606('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x6606('0x1b')]=_[_0x6606('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6606('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0x6606('0x1e')](socket);function respondWithStatusCode(_0x25d333,_0x2fc696){_0x2fc696=_0x2fc696||0xcc;return function(_0x24481c){if(_0x24481c){return _0x25d333['sendStatus'](_0x2fc696);}return _0x25d333[_0x6606('0x1f')](_0x2fc696)[_0x6606('0x20')]();};}function respondWithResult(_0x3dcf03,_0x39c571){_0x39c571=_0x39c571||0xc8;return function(_0x58de81){if(_0x58de81){return _0x3dcf03[_0x6606('0x1f')](_0x39c571)[_0x6606('0x21')](_0x58de81);}};}function respondWithFilteredResult(_0x198414,_0x54ba4f){return function(_0xf460ed){if(_0xf460ed){var _0x14e012=typeof _0x54ba4f[_0x6606('0x22')]===_0x6606('0x23')&&typeof _0x54ba4f[_0x6606('0x24')]===_0x6606('0x23');var _0x13bd1b=_0xf460ed[_0x6606('0x25')];var _0x22bb78=_0x14e012?0x0:_0x54ba4f[_0x6606('0x22')];var _0x575267=_0x14e012?_0xf460ed[_0x6606('0x25')]:_0x54ba4f[_0x6606('0x22')]+_0x54ba4f['limit'];var _0x2c53b3;if(_0x575267>=_0x13bd1b){_0x575267=_0x13bd1b;_0x2c53b3=0xc8;}else{_0x2c53b3=0xce;}_0x198414[_0x6606('0x1f')](_0x2c53b3);return _0x198414[_0x6606('0x26')]('Content-Range',_0x22bb78+'-'+_0x575267+'/'+_0x13bd1b)['json'](_0xf460ed);}return null;};}function patchUpdates(_0x5c5046){return function(_0x1adeeb){try{jsonpatch[_0x6606('0x27')](_0x1adeeb,_0x5c5046,!![]);}catch(_0x1a97aa){return BPromise[_0x6606('0x28')](_0x1a97aa);}return _0x1adeeb[_0x6606('0x29')]();};}function saveUpdates(_0x6be95a,_0x5ce07c){return function(_0x5ef224){if(_0x5ef224){return _0x5ef224[_0x6606('0x2a')](_0x6be95a)[_0x6606('0x2b')](function(_0x306f4c){return _0x306f4c;});}return null;};}function removeEntity(_0x2b3fa0,_0x4693b2){return function(_0x2c151e){if(_0x2c151e){return _0x2c151e['destroy']()[_0x6606('0x2b')](function(){var _0x5a3bbc=_0x2c151e[_0x6606('0x2c')]({'plain':!![]});var _0x4866b3=_0x6606('0x2d');return db[_0x6606('0x2e')][_0x6606('0x2f')]({'where':{'type':_0x4866b3,'resourceId':_0x5a3bbc['id']}})['then'](function(){return _0x2c151e;});})[_0x6606('0x2b')](function(){_0x2b3fa0[_0x6606('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38133c,_0x22b6e9){return function(_0x79a283){if(!_0x79a283){_0x38133c[_0x6606('0x30')](0x194);}return _0x79a283;};}function handleError(_0x5d9039,_0x2c3c1f){_0x2c3c1f=_0x2c3c1f||0x1f4;return function(_0x46deca){logger[_0x6606('0x31')](_0x46deca[_0x6606('0x32')]);if(_0x46deca[_0x6606('0x33')]){delete _0x46deca[_0x6606('0x33')];}_0x5d9039[_0x6606('0x1f')](_0x2c3c1f)[_0x6606('0x34')](_0x46deca);};}exports[_0x6606('0x35')]=function(_0x119499,_0x589e06){var _0x77fb9d={},_0x1e4849={},_0x2cd252={'count':0x0,'rows':[]};var _0x9fd3da=_[_0x6606('0x36')](db['CmList'][_0x6606('0x37')],function(_0x18dfee){return{'name':_0x18dfee[_0x6606('0x38')],'type':_0x18dfee[_0x6606('0x39')][_0x6606('0x3a')]};});_0x1e4849[_0x6606('0x3b')]=_[_0x6606('0x36')](_0x9fd3da,_0x6606('0x33'));_0x1e4849['query']=_[_0x6606('0x3c')](_0x119499['query']);_0x1e4849['filters']=_['intersection'](_0x1e4849[_0x6606('0x3b')],_0x1e4849['query']);_0x77fb9d['attributes']=_[_0x6606('0x3d')](_0x1e4849[_0x6606('0x3b')],qs['fields'](_0x119499['query'][_0x6606('0x3e')]));_0x77fb9d[_0x6606('0x3f')]=_0x77fb9d[_0x6606('0x3f')][_0x6606('0x40')]?_0x77fb9d[_0x6606('0x3f')]:_0x1e4849[_0x6606('0x3b')];if(!_0x119499['query']['hasOwnProperty']('nolimit')){_0x77fb9d[_0x6606('0x24')]=qs[_0x6606('0x24')](_0x119499['query']['limit']);_0x77fb9d[_0x6606('0x22')]=qs['offset'](_0x119499[_0x6606('0x41')]['offset']);}_0x77fb9d[_0x6606('0x42')]=qs[_0x6606('0x43')](_0x119499['query'][_0x6606('0x43')]);_0x77fb9d[_0x6606('0x44')]=qs[_0x6606('0x45')](_[_0x6606('0x46')](_0x119499['query'],_0x1e4849[_0x6606('0x45')]),_0x9fd3da);if(_0x119499['query'][_0x6606('0x47')]){_0x77fb9d[_0x6606('0x44')]=_['merge'](_0x77fb9d[_0x6606('0x44')],{'$or':_[_0x6606('0x36')](_0x9fd3da,function(_0x90291b){if(_0x90291b[_0x6606('0x39')]!==_0x6606('0x48')){var _0x112c51={};_0x112c51[_0x90291b['name']]={'$like':'%'+_0x119499[_0x6606('0x41')][_0x6606('0x47')]+'%'};return _0x112c51;}})});}_0x77fb9d=_[_0x6606('0x49')]({},_0x77fb9d,_0x119499[_0x6606('0x4a')]);var _0x29ba95={'where':_0x77fb9d[_0x6606('0x44')]};return db['CmList'][_0x6606('0x25')](_0x29ba95)[_0x6606('0x2b')](function(_0x4b8a1e){_0x2cd252[_0x6606('0x25')]=_0x4b8a1e;if(_0x119499['query'][_0x6606('0x4b')]){_0x77fb9d['include']=[{'all':!![]}];}return db[_0x6606('0x4c')]['findAll'](_0x77fb9d);})[_0x6606('0x2b')](function(_0x4878d8){_0x2cd252['rows']=_0x4878d8;return _0x2cd252;})[_0x6606('0x2b')](respondWithFilteredResult(_0x589e06,_0x77fb9d))[_0x6606('0x4d')](handleError(_0x589e06,null));};exports[_0x6606('0x4e')]=function(_0x5a47c0,_0x59f445){var _0x49b5e8={'raw':![],'where':{'id':_0x5a47c0[_0x6606('0x4f')]['id']}},_0x49052d={};_0x49052d[_0x6606('0x3b')]=_[_0x6606('0x3c')](db[_0x6606('0x4c')][_0x6606('0x37')]);_0x49052d['query']=_[_0x6606('0x3c')](_0x5a47c0['query']);_0x49052d[_0x6606('0x45')]=_[_0x6606('0x3d')](_0x49052d[_0x6606('0x3b')],_0x49052d[_0x6606('0x41')]);_0x49b5e8[_0x6606('0x3f')]=_[_0x6606('0x3d')](_0x49052d[_0x6606('0x3b')],qs[_0x6606('0x3e')](_0x5a47c0[_0x6606('0x41')][_0x6606('0x3e')]));_0x49b5e8[_0x6606('0x3f')]=_0x49b5e8[_0x6606('0x3f')]['length']?_0x49b5e8[_0x6606('0x3f')]:_0x49052d['model'];if(_0x5a47c0[_0x6606('0x41')][_0x6606('0x4b')]){_0x49b5e8[_0x6606('0x50')]=[{'all':!![]}];}_0x49b5e8=_[_0x6606('0x49')]({},_0x49b5e8,_0x5a47c0[_0x6606('0x4a')]);return db[_0x6606('0x4c')][_0x6606('0x51')](_0x49b5e8)[_0x6606('0x2b')](handleEntityNotFound(_0x59f445,null))[_0x6606('0x2b')](respondWithResult(_0x59f445,null))[_0x6606('0x4d')](handleError(_0x59f445,null));};exports['create']=function(_0x5d653b,_0x23f4b3){return db[_0x6606('0x4c')][_0x6606('0x52')](_0x5d653b[_0x6606('0x53')],{})[_0x6606('0x2b')](function(_0x4d0766){var _0x4849d3=_0x5d653b['user'][_0x6606('0x2c')]({'plain':!![]});if(!_0x4849d3)throw new Error(_0x6606('0x54'));if(_0x4849d3[_0x6606('0x55')]===_0x6606('0x56')){var _0x550829=_0x4d0766[_0x6606('0x2c')]({'plain':!![]});var _0x3f4d5e=_0x6606('0x2d');return db[_0x6606('0x57')][_0x6606('0x51')]({'where':{'name':_0x3f4d5e,'userProfileId':_0x4849d3[_0x6606('0x58')]},'raw':!![]})[_0x6606('0x2b')](function(_0xbf5155){if(_0xbf5155&&_0xbf5155[_0x6606('0x59')]===0x0){return db[_0x6606('0x2e')][_0x6606('0x52')]({'name':_0x550829[_0x6606('0x33')],'resourceId':_0x550829['id'],'type':_0xbf5155[_0x6606('0x33')],'sectionId':_0xbf5155['id']},{})[_0x6606('0x2b')](function(){return _0x4d0766;});}else{return _0x4d0766;}})['catch'](function(_0x3b4ec1){logger[_0x6606('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4ec1);throw _0x3b4ec1;});}return _0x4d0766;})['then'](respondWithResult(_0x23f4b3,0xc9))[_0x6606('0x4d')](handleError(_0x23f4b3,null));};exports['update']=function(_0x41cacd,_0x3717df){if(_0x41cacd[_0x6606('0x53')]['id']){delete _0x41cacd[_0x6606('0x53')]['id'];}return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0x41cacd['params']['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x3717df,null))[_0x6606('0x2b')](saveUpdates(_0x41cacd[_0x6606('0x53')],null))[_0x6606('0x2b')](respondWithResult(_0x3717df,null))[_0x6606('0x4d')](handleError(_0x3717df,null));};exports[_0x6606('0x2f')]=function(_0x3f8f55,_0x13bd7c){return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0x3f8f55[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x13bd7c,null))[_0x6606('0x2b')](removeEntity(_0x13bd7c,null))[_0x6606('0x4d')](handleError(_0x13bd7c,null));};exports['describe']=function(_0xd053f2,_0x1399fb){return db[_0x6606('0x4c')][_0x6606('0x5a')]()[_0x6606('0x2b')](respondWithResult(_0x1399fb,null))[_0x6606('0x4d')](handleError(_0x1399fb,null));};exports[_0x6606('0x5b')]=function(_0x1fe643,_0x3e3401,_0x2bd25a){if(_0x1fe643['body']['id']){delete _0x1fe643[_0x6606('0x53')]['id'];}return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0x1fe643[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x3e3401,null))[_0x6606('0x2b')](function(_0x38e691){if(_0x38e691){_0x1fe643['body']['ListId']=_0x38e691['id'];return db[_0x6606('0x5c')][_0x6606('0x52')](_0x1fe643[_0x6606('0x53')]);}})[_0x6606('0x2b')](respondWithResult(_0x3e3401,null))[_0x6606('0x4d')](handleError(_0x3e3401,null));};exports[_0x6606('0x5d')]=function(_0x235190,_0x2fea0c,_0x393ff1){var _0x11f658={'raw':![],'where':{}};var _0x46324e={};var _0x2116f0={'count':0x0,'rows':[]};return db[_0x6606('0x4c')]['findOne']({'where':{'id':_0x235190[_0x6606('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2fea0c,null))[_0x6606('0x2b')](function(_0x2cefa7){if(_0x2cefa7){_0x46324e[_0x6606('0x3b')]=_[_0x6606('0x3c')](db[_0x6606('0x5c')][_0x6606('0x37')]);_0x46324e[_0x6606('0x41')]=_['keys'](_0x235190['query']);_0x46324e['filters']=_['intersection'](_0x46324e[_0x6606('0x3b')],_0x46324e[_0x6606('0x41')]);_0x11f658[_0x6606('0x3f')]=_[_0x6606('0x3d')](_0x46324e[_0x6606('0x3b')],qs[_0x6606('0x3e')](_0x235190[_0x6606('0x41')][_0x6606('0x3e')]));_0x11f658['attributes']=_0x11f658[_0x6606('0x3f')][_0x6606('0x40')]?_0x11f658['attributes']:_0x46324e[_0x6606('0x3b')];if(!_0x235190[_0x6606('0x41')][_0x6606('0x5e')]('nolimit')){_0x11f658[_0x6606('0x24')]=qs[_0x6606('0x24')](_0x235190['query'][_0x6606('0x24')]);_0x11f658[_0x6606('0x22')]=qs[_0x6606('0x22')](_0x235190[_0x6606('0x41')][_0x6606('0x22')]);}_0x11f658[_0x6606('0x42')]=qs[_0x6606('0x43')](_0x235190[_0x6606('0x41')][_0x6606('0x43')]);_0x11f658['where']=qs[_0x6606('0x45')](_[_0x6606('0x46')](_0x235190['query'],_0x46324e[_0x6606('0x45')]));_0x11f658[_0x6606('0x44')]['ListId']=_0x2cefa7['id'];if(_0x235190['query'][_0x6606('0x47')]){_0x11f658[_0x6606('0x44')]=_[_0x6606('0x49')](_0x11f658[_0x6606('0x44')],{'$or':_[_0x6606('0x36')](_0x11f658[_0x6606('0x3f')],function(_0x5cece8){var _0x3a2ed5={};_0x3a2ed5[_0x5cece8]={'$like':'%'+_0x235190['query'][_0x6606('0x47')]+'%'};return _0x3a2ed5;})});}_0x11f658=_[_0x6606('0x49')]({},_0x11f658,_0x235190['options']);return db[_0x6606('0x5c')][_0x6606('0x25')]({'where':_0x11f658['where']})[_0x6606('0x2b')](function(_0x16a3cd){_0x2116f0[_0x6606('0x25')]=_0x16a3cd;if(_0x235190[_0x6606('0x41')][_0x6606('0x4b')]){_0x11f658[_0x6606('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x6606('0x5f')](_0x11f658);})[_0x6606('0x2b')](function(_0x41dbd4){_0x2116f0[_0x6606('0x60')]=_0x41dbd4;return _0x2116f0;});}})[_0x6606('0x2b')](respondWithFilteredResult(_0x2fea0c,_0x11f658))[_0x6606('0x4d')](handleError(_0x2fea0c,null));};exports[_0x6606('0x61')]=function(_0x11a8d3,_0xea5d88,_0x49ac29){return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0x11a8d3[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0xea5d88,null))[_0x6606('0x2b')](function(_0x4d243b){if(_0x4d243b){return _0x4d243b[_0x6606('0x61')](_0x11a8d3['query'][_0x6606('0x62')]);}})[_0x6606('0x2b')](respondWithStatusCode(_0xea5d88,null))[_0x6606('0x4d')](handleError(_0xea5d88,null));};exports[_0x6606('0x63')]=function(_0x5a8ddf,_0x4e3eb1,_0x16b5ba){return db[_0x6606('0x4c')]['find']({'where':{'id':_0x5a8ddf[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x4e3eb1,null))[_0x6606('0x2b')](function(_0x1074c0){if(_0x1074c0){var _0x1b96ed=[];var _0x48adbb={'success':[],'errors':[]};return db[_0x6606('0x64')][_0x6606('0x5a')]()[_0x6606('0x2b')](function(_0x11d8d5){if(_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')]&&_[_0x6606('0x66')](_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')])){if(_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')][_0x6606('0x40')]){_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')]=_0x5a8ddf[_0x6606('0x53')]['tags'][_0x6606('0x67')](';')+';';}else{_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')]=null;}}else{_0x5a8ddf[_0x6606('0x53')][_0x6606('0x65')]=null;}if(_0x5a8ddf[_0x6606('0x53')]&&_[_0x6606('0x66')](_0x5a8ddf['body'])){for(var _0x2a4d57=0x0;_0x2a4d57<_0x5a8ddf[_0x6606('0x53')][_0x6606('0x40')];_0x2a4d57+=0x1){_0x5a8ddf[_0x6606('0x53')][_0x2a4d57][_0x6606('0x68')]=_0x5a8ddf[_0x6606('0x4f')]['id'];_0x1b96ed[_0x6606('0x69')](_0x5a8ddf[_0x6606('0x53')][_0x2a4d57]);}return BPromise[_0x6606('0x6a')](_0x1b96ed,function(_0x28bfb3){return db[_0x6606('0x64')][_0x6606('0x52')](_[_0x6606('0x6b')](_0x28bfb3,[_0x6606('0x62'),'id'])||{},{'fields':_['keys'](_0x11d8d5),'raw':!![]})[_0x6606('0x2b')](function(_0x5dfc12){_0x48adbb[_0x6606('0x6c')][_0x6606('0x69')](_0x5dfc12[_0x6606('0x6d')]);})[_0x6606('0x4d')](function(_0x4a9cb5){_0x48adbb[_0x6606('0x6e')][_0x6606('0x69')]({'data':_0x28bfb3,'error':_0x4a9cb5['message']});});})[_0x6606('0x2b')](function(_0x466860){return _0x48adbb;})[_0x6606('0x4d')](function(_0x1ddd0b){return _0x1ddd0b;});}else{_0x4e3eb1[_0x6606('0x1f')](0x190)[_0x6606('0x21')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x6606('0x2b')](respondWithResult(_0x4e3eb1,null))['catch'](handleError(_0x4e3eb1,null));};exports[_0x6606('0x6f')]=function(_0x56535f,_0x4c210e,_0xf6c684){var _0x5d6963;return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0x56535f['params']['id']},'include':[{'model':db[_0x6606('0x70')],'as':_0x6606('0x71')}]})['then'](handleEntityNotFound(_0x4c210e,null))[_0x6606('0x2b')](function(_0x4def2a){if(_0x4def2a){_0x5d6963=_0x4def2a;return db[_0x6606('0x64')]['rawAttributes'];}})[_0x6606('0x2b')](function(_0x1bfbcd){if(_0x1bfbcd){var _0x5a6033={};var _0x116a90={};_0x116a90[_0x6606('0x3b')]=_['concat'](_[_0x6606('0x3c')](_0x1bfbcd),_[_0x6606('0x36')](_0x5d6963[_0x6606('0x71')],function(_0x357382){return util[_0x6606('0x72')](_0x6606('0x73'),_0x357382['id']);}));_0x116a90[_0x6606('0x41')]=_[_0x6606('0x3c')](_0x56535f['query']);_0x116a90[_0x6606('0x45')]=_[_0x6606('0x3d')](_0x116a90[_0x6606('0x3b')],_0x116a90[_0x6606('0x41')]);_0x5a6033[_0x6606('0x3f')]=_[_0x6606('0x3d')](_0x116a90['model'],qs['fields'](_0x56535f[_0x6606('0x41')][_0x6606('0x3e')]));_0x5a6033[_0x6606('0x3f')]=_0x5a6033['attributes'][_0x6606('0x40')]?_0x5a6033[_0x6606('0x3f')]:_0x116a90[_0x6606('0x3b')];if(!_0x56535f[_0x6606('0x41')][_0x6606('0x5e')](_0x6606('0x74'))){_0x5a6033[_0x6606('0x24')]=qs['limit'](_0x56535f[_0x6606('0x41')][_0x6606('0x24')]);_0x5a6033[_0x6606('0x22')]=qs[_0x6606('0x22')](_0x56535f['query'][_0x6606('0x22')]);}_0x5a6033[_0x6606('0x42')]=qs[_0x6606('0x43')](_0x56535f[_0x6606('0x41')][_0x6606('0x43')]);_0x5a6033[_0x6606('0x44')]=qs['filters'](_[_0x6606('0x46')](_0x56535f[_0x6606('0x41')],_0x116a90[_0x6606('0x45')]));_0x5a6033[_0x6606('0x75')]=!![];if(_0x56535f[_0x6606('0x41')][_0x6606('0x47')]){_0x5a6033[_0x6606('0x44')]=_['merge'](_0x5a6033[_0x6606('0x44')],{'$or':_[_0x6606('0x36')](_0x5a6033[_0x6606('0x3f')],function(_0x18f0c8){var _0x32a864={};_0x32a864[_0x18f0c8]={'$like':'%'+_0x56535f['query'][_0x6606('0x47')]+'%'};return _0x32a864;})});}_0x5a6033=_[_0x6606('0x49')]({},_0x5a6033,_0x56535f[_0x6606('0x4a')]);return _0x5d6963[_0x6606('0x6f')](_0x5a6033);}})[_0x6606('0x2b')](respondWithResult(_0x4c210e,null))[_0x6606('0x4d')](handleError(_0x4c210e,null));};exports[_0x6606('0x76')]=function(_0x54ab1c,_0x18fee1,_0x262b50){var _0x56323c;var _0x1f7037;var _0x49f162;var _0x267131=_0x54ab1c[_0x6606('0x4f')]['id'];csv_results=[];return db['ContactItemType'][_0x6606('0x5f')]({'attributes':['id',_0x6606('0x33')],'raw':!![],'order':['OrderBy']})[_0x6606('0x2b')](function(_0x48bf23){_0x56323c=_0x48bf23;var _0x20e802=_['keys'](db['CmContact'][_0x6606('0x37')]);return db[_0x6606('0x70')][_0x6606('0x5f')]({'raw':!![],'attributes':['id',_0x6606('0x77')]})[_0x6606('0x2b')](function(_0x399e9b){_0x1f7037=_0x399e9b;var _0x220670=squel[_0x6606('0x78')]()[_0x6606('0x3e')](_0x20e802)[_0x6606('0x79')]('cm_contacts','c')[_0x6606('0x44')](_0x6606('0x7a'),_0x267131)[_0x6606('0x44')](_0x6606('0x7b'))[_0x6606('0x7c')]();for(var _0x34074b=0x0;_0x34074b<_0x1f7037['length'];_0x34074b++){_0x220670['field'](_0x6606('0x7d')+_0x1f7037[_0x34074b]['id'],_0x6606('0x7e')+_0x1f7037[_0x34074b][_0x6606('0x77')]);}for(var _0x34074b=0x0;_0x34074b<_0x56323c['length'];_0x34074b++){_0x220670[_0x6606('0x7f')](squel[_0x6606('0x78')]()['field'](_0x6606('0x80'))['from'](_0x6606('0x81'))[_0x6606('0x44')](_0x6606('0x82'),_0x56323c[_0x34074b]['id'])['where'](_0x6606('0x83')),_0x6606('0x84')+_0x56323c[_0x34074b]['name']);_0x220670[_0x6606('0x7f')](squel[_0x6606('0x78')]()[_0x6606('0x7f')](_0x6606('0x85'))[_0x6606('0x79')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x56323c[_0x34074b]['id'])[_0x6606('0x44')](_0x6606('0x83')),_0x6606('0x86')+_0x56323c[_0x34074b][_0x6606('0x33')]);}var _0x5b1941=[];_0x5b1941[_0x6606('0x69')](_0x220670['toString']());BPromise[_0x6606('0x6a')](_0x5b1941,handleQuery)['then'](function(_0xc0d394){handleQuery(_0x220670['toString']());var _0x2afa23=csv_results[0x0];if(!_[_0x6606('0x87')](_0x2afa23)){var _0x5e022c=toCsv(_0x2afa23);var _0x12e64f=Date[_0x6606('0x88')]();fs[_0x6606('0x89')](util[_0x6606('0x72')]('/tmp/list_%d_%s.csv',_0x267131,_0x12e64f),_0x5e022c);_0x18fee1[_0x6606('0x8a')](_0x6606('0x8b'),'attachment;\x20filename='+util[_0x6606('0x72')](_0x6606('0x8c'),_0x267131,_0x12e64f));_0x18fee1[_0x6606('0x8a')]('Content-type','text/csv');return _0x18fee1['download'](util[_0x6606('0x72')](_0x6606('0x8d'),_0x267131,_0x12e64f));}else{return _0x18fee1[_0x6606('0x30')](0xcc);}});});});};exports[_0x6606('0x8e')]=function(_0x4ef882,_0x22ad86,_0x8358e2){var _0x17399b;delete _0x4ef882[_0x6606('0x53')]['id'];return db[_0x6606('0x4c')][_0x6606('0x8f')]({'where':{'id':_0x4ef882['params']['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x22ad86,null))[_0x6606('0x2b')](function(_0x1785bc){if(_0x1785bc){return db[_0x6606('0x90')][_0x6606('0x91')](function(_0x296512){return db[_0x6606('0x70')][_0x6606('0x52')](_0x4ef882[_0x6606('0x53')],{'transaction':_0x296512})[_0x6606('0x2b')](function(_0x22fa1f){_0x17399b=_0x22fa1f;return _0x1785bc['addCustomFields'](_0x22fa1f,{'transaction':_0x296512});})[_0x6606('0x2b')](function(){var _0x563172={'type':db['Sequelize'][_0x6606('0x92')],'transaction':_0x296512};switch(_0x4ef882[_0x6606('0x53')]['type']){case _0x6606('0x93'):_0x563172[_0x6606('0x39')]=db[_0x6606('0x94')][_0x6606('0x92')];break;case _0x6606('0x95'):_0x563172[_0x6606('0x39')]=db[_0x6606('0x94')]['INTEGER'];break;case _0x6606('0x96'):_0x563172[_0x6606('0x39')]=db[_0x6606('0x94')][_0x6606('0x97')];_0x563172[_0x6606('0x98')]=![];break;default:}return db['sequelize'][_0x6606('0x99')][_0x6606('0x9a')](_0x6606('0x9b'),util[_0x6606('0x72')](_0x6606('0x9c'),_0x17399b['id']),_0x563172);})['then'](function(){return _0x17399b;});});}})[_0x6606('0x2b')](respondWithResult(_0x22ad86,null))['catch'](handleError(_0x22ad86,null));};exports[_0x6606('0x9d')]=function(_0x1c7db7,_0xb28bc7,_0x158f6e){var _0x253777={};var _0x4f820c={};var _0x3db858;var _0x26bc2e;return db['CmList'][_0x6606('0x8f')]({'where':{'id':_0x1c7db7['params']['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0xb28bc7,null))['then'](function(_0x392e47){if(_0x392e47){_0x3db858=_0x392e47;_0x4f820c[_0x6606('0x3b')]=_[_0x6606('0x3c')](db[_0x6606('0x70')][_0x6606('0x37')]);_0x4f820c['query']=_[_0x6606('0x3c')](_0x1c7db7[_0x6606('0x41')]);_0x4f820c['filters']=_[_0x6606('0x3d')](_0x4f820c[_0x6606('0x3b')],_0x4f820c['query']);_0x253777[_0x6606('0x3f')]=_['intersection'](_0x4f820c[_0x6606('0x3b')],qs[_0x6606('0x3e')](_0x1c7db7[_0x6606('0x41')][_0x6606('0x3e')]));_0x253777['attributes']=_0x253777['attributes'][_0x6606('0x40')]?_0x253777[_0x6606('0x3f')]:_0x4f820c[_0x6606('0x3b')];_0x253777[_0x6606('0x42')]=qs[_0x6606('0x43')](_0x1c7db7[_0x6606('0x41')]['sort']);_0x253777[_0x6606('0x44')]=qs[_0x6606('0x45')](_[_0x6606('0x46')](_0x1c7db7[_0x6606('0x41')],_0x4f820c['filters']));_0x253777[_0x6606('0x44')]=_[_0x6606('0x49')](_0x253777[_0x6606('0x44')],{'$or':[{'ListId':_0x392e47['id']},{'ListId':null}]});if(_0x1c7db7[_0x6606('0x41')][_0x6606('0x47')]){_0x253777[_0x6606('0x44')]=_['merge'](_0x253777[_0x6606('0x44')],{'$or':_[_0x6606('0x36')](_0x253777[_0x6606('0x3f')],function(_0x44fdfa){var _0x290527={};_0x290527[_0x44fdfa]={'$like':'%'+_0x1c7db7[_0x6606('0x41')][_0x6606('0x47')]+'%'};return _0x290527;})});}_0x253777=_[_0x6606('0x49')]({},_0x253777,_0x1c7db7[_0x6606('0x4a')]);return db['CmCustomField'][_0x6606('0x9e')](_0x253777);}})['then'](respondWithResult(_0xb28bc7,null))[_0x6606('0x4d')](handleError(_0xb28bc7,null));};exports['getGlobalCustomFields']=function(_0x55d8be,_0x7df043){return db[_0x6606('0x70')]['findAndCountAll']({'where':{'ListId':null}})[_0x6606('0x2b')](handleEntityNotFound(_0x7df043,null))[_0x6606('0x2b')](function(_0x41eeca){return _0x41eeca;})[_0x6606('0x2b')](respondWithResult(_0x7df043,null))['catch'](handleError(_0x7df043,null));};exports[_0x6606('0x9f')]=function(_0x43db13,_0x5d0177,_0x3e0146){return db[_0x6606('0x4c')]['find']({'where':{'id':_0x43db13[_0x6606('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d0177,null))[_0x6606('0x2b')](function(_0x248ad7){if(_0x248ad7){return _0x248ad7[_0x6606('0x9f')](_0x43db13[_0x6606('0x53')][_0x6606('0x62')],_[_0x6606('0x6b')](_0x43db13[_0x6606('0x53')],[_0x6606('0x62'),'id'])||{})[_0x6606('0xa0')](function(_0x3ff652){for(var _0x5f3030=0x0;_0x5f3030<_0x43db13[_0x6606('0x53')][_0x6606('0x62')][_0x6606('0x40')];_0x5f3030+=0x1){socket[_0x6606('0xa1')](_0x6606('0xa2'),{'UserId':Number(_0x43db13[_0x6606('0x53')][_0x6606('0x62')][_0x5f3030]),'CmListId':Number(_0x43db13[_0x6606('0x4f')]['id'])});}return _0x3ff652;});}})['then'](respondWithResult(_0x5d0177,null))[_0x6606('0x4d')](handleError(_0x5d0177,null));};exports[_0x6606('0xa3')]=function(_0xe5db79,_0x44e406,_0x2de9b6){return db[_0x6606('0x4c')][_0x6606('0x51')]({'where':{'id':_0xe5db79[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x44e406,null))[_0x6606('0x2b')](function(_0x52dfd4){if(_0x52dfd4){return _0x52dfd4[_0x6606('0xa3')](_0xe5db79['query'][_0x6606('0x62')])[_0x6606('0x2b')](function(){if(_[_0x6606('0x66')](_0xe5db79['query']['ids'])){for(var _0x3df7ab=0x0;_0x3df7ab<_0xe5db79['query'][_0x6606('0x62')][_0x6606('0x40')];_0x3df7ab+=0x1){socket[_0x6606('0xa1')](_0x6606('0xa4'),{'UserId':Number(_0xe5db79[_0x6606('0x41')]['ids'][_0x3df7ab]),'CmListId':Number(_0xe5db79[_0x6606('0x4f')]['id'])});}}else{socket[_0x6606('0xa1')](_0x6606('0xa4'),{'UserId':Number(_0xe5db79[_0x6606('0x41')][_0x6606('0x62')]),'CmListId':Number(_0xe5db79['params']['id'])});}});}})['then'](respondWithStatusCode(_0x44e406,null))[_0x6606('0x4d')](handleError(_0x44e406,null));};exports['getAgents']=function(_0x45abd1,_0x529185,_0x362a3d){var _0x1d281d={};var _0x4d7f62={};var _0x21125b;var _0x3b3546;return db[_0x6606('0x4c')][_0x6606('0x8f')]({'where':{'id':_0x45abd1[_0x6606('0x4f')]['id']}})[_0x6606('0x2b')](handleEntityNotFound(_0x529185,null))[_0x6606('0x2b')](function(_0xf4a850){if(_0xf4a850){_0x21125b=_0xf4a850;_0x4d7f62[_0x6606('0x3b')]=_[_0x6606('0x3c')](db[_0x6606('0xa5')][_0x6606('0x37')]);_0x4d7f62['query']=_[_0x6606('0x3c')](_0x45abd1['query']);_0x4d7f62[_0x6606('0x45')]=_['intersection'](_0x4d7f62[_0x6606('0x3b')],_0x4d7f62[_0x6606('0x41')]);_0x1d281d[_0x6606('0x3f')]=_[_0x6606('0x3d')](_0x4d7f62[_0x6606('0x3b')],qs[_0x6606('0x3e')](_0x45abd1['query'][_0x6606('0x3e')]));_0x1d281d[_0x6606('0x3f')]=_0x1d281d['attributes']['length']?_0x1d281d['attributes']:_0x4d7f62[_0x6606('0x3b')];_0x1d281d[_0x6606('0x42')]=qs[_0x6606('0x43')](_0x45abd1[_0x6606('0x41')][_0x6606('0x43')]);_0x1d281d[_0x6606('0x44')]=qs[_0x6606('0x45')](_[_0x6606('0x46')](_0x45abd1['query'],_0x4d7f62[_0x6606('0x45')]));if(_0x45abd1[_0x6606('0x41')]['filter']){_0x1d281d[_0x6606('0x44')]=_[_0x6606('0x49')](_0x1d281d['where'],{'$or':_['map'](_0x1d281d[_0x6606('0x3f')],function(_0x2c0bf3){var _0x5b75a2={};_0x5b75a2[_0x2c0bf3]={'$like':'%'+_0x45abd1['query'][_0x6606('0x47')]+'%'};return _0x5b75a2;})});}_0x1d281d=_[_0x6606('0x49')]({},_0x1d281d,_0x45abd1[_0x6606('0x4a')]);return _0x21125b['getAgents'](_0x1d281d);}})['then'](function(_0x2bff4c){if(_0x2bff4c){_0x3b3546=_0x2bff4c[_0x6606('0x40')];if(!_0x45abd1[_0x6606('0x41')][_0x6606('0x5e')]('nolimit')){_0x1d281d[_0x6606('0x24')]=qs[_0x6606('0x24')](_0x45abd1[_0x6606('0x41')][_0x6606('0x24')]);_0x1d281d[_0x6606('0x22')]=qs['offset'](_0x45abd1['query'][_0x6606('0x22')]);}return _0x21125b['getAgents'](_0x1d281d);}})[_0x6606('0x2b')](function(_0x3846ee){if(_0x3846ee){return _0x3846ee?{'count':_0x3b3546,'rows':_0x3846ee}:null;}})['then'](respondWithResult(_0x529185,null))[_0x6606('0x4d')](handleError(_0x529185,null));};function handleQuery(_0x31fdc8){logger[_0x6606('0xa6')](_0x31fdc8);return db[_0x6606('0x90')][_0x6606('0x41')](_0x31fdc8)[_0x6606('0xa0')](function(_0x54fb05){csv_results[_0x6606('0x69')](_0x54fb05);})['catch'](function(_0x168845){logger[_0x6606('0x31')](_0x168845['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3561d94..9a5339e 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x4edb28,_0x1f0292){var _0x5b56c0=function(_0x38e742){while(--_0x38e742){_0x4edb28['push'](_0x4edb28['shift']());}};_0x5b56c0(++_0x1f0292);}(_0x814b,0x1a2));var _0xb814=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x814b[_0x364cf8];return _0x6a59ee;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x23496e,_0x5c2620){var _0xd5128e=function(_0x503fdc){while(--_0x503fdc){_0x23496e['push'](_0x23496e['shift']());}};_0xd5128e(++_0x5c2620);}(_0x814b,0x1a2));var _0xb814=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x814b[_0x2d4661];return _0x42ed1e;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3a79a15..815380f 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 _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x24516c,_0x59fcd8){var _0xaf2987=function(_0x9f8828){while(--_0x9f8828){_0x24516c['push'](_0x24516c['shift']());}};_0xaf2987(++_0x59fcd8);}(_0xf109,0xce));var _0x9f10=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xf109[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c76=['define','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x56f694,_0x107ec3){var _0x5b46b1=function(_0x2bd644){while(--_0x2bd644){_0x56f694['push'](_0x56f694['shift']());}};_0x5b46b1(++_0x107ec3);}(_0x6c76,0x184));var _0x66c7=function(_0x4b58e4,_0x42e0ce){_0x4b58e4=_0x4b58e4-0x0;var _0x4f3958=_0x6c76[_0x4b58e4];return _0x4f3958;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var logger=require(_0x66c7('0x2'))('api');var moment=require(_0x66c7('0x3'));var BPromise=require(_0x66c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var attributes=require('./cmList.attributes');module[_0x66c7('0x7')]=function(_0x45b0a5,_0x52f71b){return _0x45b0a5[_0x66c7('0x8')]('CmList',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 a81fd44..87c9642 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 _0x8335=['jayson/promise','client','redis','localhost','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3de0d9,_0x2ccb8f){var _0x161cd9=function(_0x8e23e7){while(--_0x8e23e7){_0x3de0d9['push'](_0x3de0d9['shift']());}};_0x161cd9(++_0x2ccb8f);}(_0x8335,0x15d));var _0x5833=function(_0x1bb3eb,_0x569874){_0x1bb3eb=_0x1bb3eb-0x0;var _0x533c14=_0x8335[_0x1bb3eb];return _0x533c14;};'use strict';var _=require(_0x5833('0x0'));var util=require(_0x5833('0x1'));var moment=require(_0x5833('0x2'));var BPromise=require(_0x5833('0x3'));var rs=require(_0x5833('0x4'));var fs=require('fs');var Redis=require(_0x5833('0x5'));var db=require(_0x5833('0x6'))['db'];var utils=require(_0x5833('0x7'));var logger=require(_0x5833('0x8'))(_0x5833('0x9'));var config=require(_0x5833('0xa'));var jayson=require(_0x5833('0xb'));var client=jayson[_0x5833('0xc')]['http']({'port':0x232a});config[_0x5833('0xd')]=_['defaults'](config[_0x5833('0xd')],{'host':_0x5833('0xe'),'port':0x18eb});var socket=require(_0x5833('0xf'))(new Redis(config[_0x5833('0xd')]));require(_0x5833('0x10'))[_0x5833('0x11')](socket);function respondWithRpcPromise(_0x516329,_0x2ae4d9,_0x456272){return new BPromise(function(_0x384c82,_0x1aca53){return client['request'](_0x516329,_0x456272)[_0x5833('0x12')](function(_0x424a20){logger['info'](_0x5833('0x13'),_0x2ae4d9,_0x5833('0x14'));logger[_0x5833('0x15')](_0x5833('0x16'),_0x2ae4d9,_0x5833('0x14'),JSON[_0x5833('0x17')](_0x424a20));if(_0x424a20[_0x5833('0x18')]){if(_0x424a20[_0x5833('0x18')][_0x5833('0x19')]===0x1f4){logger[_0x5833('0x18')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x424a20[_0x5833('0x18')]['message']);return _0x1aca53(_0x424a20[_0x5833('0x18')]['message']);}logger[_0x5833('0x18')](_0x5833('0x13'),_0x2ae4d9,_0x424a20['error'][_0x5833('0x1a')]);return _0x384c82(_0x424a20[_0x5833('0x18')][_0x5833('0x1a')]);}else{logger[_0x5833('0x1b')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x5833('0x14'));_0x384c82(_0x424a20[_0x5833('0x1c')][_0x5833('0x1a')]);}})[_0x5833('0x1d')](function(_0x523c49){logger[_0x5833('0x18')]('CmList,\x20%s,\x20%s',_0x2ae4d9,_0x523c49);_0x1aca53(_0x523c49);});});} \ No newline at end of file +var _0x27c4=['defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x27c4,0x1c3));var _0x427c=function(_0x4119cb,_0x2afccf){_0x4119cb=_0x4119cb-0x0;var _0x4dc1be=_0x27c4[_0x4119cb];return _0x4dc1be;};'use strict';var _=require(_0x427c('0x0'));var util=require(_0x427c('0x1'));var moment=require(_0x427c('0x2'));var BPromise=require(_0x427c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x427c('0x4'));var db=require(_0x427c('0x5'))['db'];var utils=require(_0x427c('0x6'));var logger=require(_0x427c('0x7'))(_0x427c('0x8'));var config=require(_0x427c('0x9'));var jayson=require(_0x427c('0xa'));var client=jayson[_0x427c('0xb')][_0x427c('0xc')]({'port':0x232a});config[_0x427c('0xd')]=_[_0x427c('0xe')](config[_0x427c('0xd')],{'host':_0x427c('0xf'),'port':0x18eb});var socket=require(_0x427c('0x10'))(new Redis(config[_0x427c('0xd')]));require('./cmList.socket')[_0x427c('0x11')](socket);function respondWithRpcPromise(_0x397bf8,_0xb3ca7b,_0x5e8e79){return new BPromise(function(_0xe050e2,_0x35d46c){return client[_0x427c('0x12')](_0x397bf8,_0x5e8e79)[_0x427c('0x13')](function(_0x4c3ebc){logger['info'](_0x427c('0x14'),_0xb3ca7b,_0x427c('0x15'));logger[_0x427c('0x16')](_0x427c('0x17'),_0xb3ca7b,_0x427c('0x15'),JSON[_0x427c('0x18')](_0x4c3ebc));if(_0x4c3ebc[_0x427c('0x19')]){if(_0x4c3ebc['error'][_0x427c('0x1a')]===0x1f4){logger[_0x427c('0x19')](_0x427c('0x14'),_0xb3ca7b,_0x4c3ebc[_0x427c('0x19')][_0x427c('0x1b')]);return _0x35d46c(_0x4c3ebc['error'][_0x427c('0x1b')]);}logger[_0x427c('0x19')](_0x427c('0x14'),_0xb3ca7b,_0x4c3ebc[_0x427c('0x19')]['message']);return _0xe050e2(_0x4c3ebc[_0x427c('0x19')][_0x427c('0x1b')]);}else{logger[_0x427c('0x1c')](_0x427c('0x14'),_0xb3ca7b,'request\x20sent');_0xe050e2(_0x4c3ebc[_0x427c('0x1d')][_0x427c('0x1b')]);}})[_0x427c('0x1e')](function(_0xc7870){logger[_0x427c('0x19')](_0x427c('0x14'),_0xb3ca7b,_0xc7870);_0x35d46c(_0xc7870);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 6199628..4408393 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 _0x6f9c=['update','removeListener','length','save'];(function(_0x1348c5,_0x47f907){var _0xdeb46e=function(_0x4090f1){while(--_0x4090f1){_0x1348c5['push'](_0x1348c5['shift']());}};_0xdeb46e(++_0x47f907);}(_0x6f9c,0x103));var _0xc6f9=function(_0x3eb98b,_0x5ac541){_0x3eb98b=_0x3eb98b-0x0;var _0x1a7269=_0x6f9c[_0x3eb98b];return _0x1a7269;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xc6f9('0x0'),'remove',_0xc6f9('0x1')];function createListener(_0xfdbf50,_0x8c2bb6){return function(_0x378b29){_0x8c2bb6['emit'](_0xfdbf50,_0x378b29);};}function removeListener(_0x59776f,_0x57f05f){return function(){CmListEvents[_0xc6f9('0x2')](_0x59776f,_0x57f05f);};}exports['register']=function(_0x75ca41){for(var _0x6d47f5=0x0,_0x1edaca=events[_0xc6f9('0x3')];_0x6d47f5<_0x1edaca;_0x6d47f5++){var _0x3ac7a6=events[_0x6d47f5];var _0xfcb38=createListener('cmList:'+_0x3ac7a6,_0x75ca41);CmListEvents['on'](_0x3ac7a6,_0xfcb38);}}; \ No newline at end of file +var _0xd190=['update','emit','removeListener','cmList:','save','remove'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xd190,0x8e));var _0x0d19=function(_0x34d470,_0x4140a6){_0x34d470=_0x34d470-0x0;var _0x54295a=_0xd190[_0x34d470];return _0x54295a;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x0d19('0x0'),_0x0d19('0x1'),_0x0d19('0x2')];function createListener(_0x404183,_0x5558ef){return function(_0x5da48c){_0x5558ef[_0x0d19('0x3')](_0x404183,_0x5da48c);};}function removeListener(_0x1bc0dc,_0x4bb027){return function(){CmListEvents[_0x0d19('0x4')](_0x1bc0dc,_0x4bb027);};}exports['register']=function(_0x224399){for(var _0x4974aa=0x0,_0x501f2f=events['length'];_0x4974aa<_0x501f2f;_0x4974aa++){var _0x4fd309=events[_0x4974aa];var _0x5656a3=createListener(_0x0d19('0x5')+_0x4fd309,_0x224399);CmListEvents['on'](_0x4fd309,_0x5656a3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9b207d7..6e67bfa 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 _0x025c=['/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addContacts','addCustomField','/:id/users','put','update','delete','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x131a94,_0x3b95ac){var _0x5b807f=function(_0x279e9f){while(--_0x279e9f){_0x131a94['push'](_0x131a94['shift']());}};_0x5b807f(++_0x3b95ac);}(_0x025c,0x1ad));var _0xc025=function(_0x5dcff6,_0x4a8796){_0x5dcff6=_0x5dcff6-0x0;var _0x2699cd=_0x025c[_0x5dcff6];return _0x2699cd;};'use strict';var multer=require('multer');var util=require(_0xc025('0x0'));var path=require(_0xc025('0x1'));var timeout=require(_0xc025('0x2'));var express=require(_0xc025('0x3'));var router=express[_0xc025('0x4')]();var fs_extra=require(_0xc025('0x5'));var auth=require(_0xc025('0x6'));var interaction=require(_0xc025('0x7'));var config=require(_0xc025('0x8'));var controller=require('./cmList.controller');router[_0xc025('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xc025('0xa')](),controller['describe']);router[_0xc025('0x9')](_0xc025('0xb'),auth['isAuthenticated'](),controller[_0xc025('0xc')]);router[_0xc025('0x9')](_0xc025('0xd'),auth[_0xc025('0xa')](),controller[_0xc025('0xe')]);router[_0xc025('0x9')](_0xc025('0xf'),auth[_0xc025('0xa')](),controller[_0xc025('0x10')]);router[_0xc025('0x9')](_0xc025('0x11'),auth[_0xc025('0xa')](),controller[_0xc025('0x12')]);router['get'](_0xc025('0x13'),auth[_0xc025('0xa')](),controller['getContactsCsv']);router[_0xc025('0x9')](_0xc025('0x14'),auth['isAuthenticated'](),controller[_0xc025('0x15')]);router[_0xc025('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xc025('0x16')]);router[_0xc025('0x17')]('/',auth['isAuthenticated'](),controller[_0xc025('0x18')]);router['post'](_0xc025('0xf'),auth[_0xc025('0xa')](),controller['addDisposition']);router[_0xc025('0x17')](_0xc025('0x11'),auth['isAuthenticated'](),controller[_0xc025('0x19')]);router['post'](_0xc025('0x14'),auth[_0xc025('0xa')](),controller[_0xc025('0x1a')]);router[_0xc025('0x17')](_0xc025('0x1b'),auth[_0xc025('0xa')](),controller['addAgents']);router[_0xc025('0x1c')](_0xc025('0xd'),auth[_0xc025('0xa')](),controller[_0xc025('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xc025('0xf'),auth[_0xc025('0xa')](),controller['removeDispositions']);router[_0xc025('0x1e')]('/:id/users',auth[_0xc025('0xa')](),controller[_0xc025('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x0773=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','describe','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','/:id','update','delete','destroy','exports','multer','util'];(function(_0x3d30d4,_0x3976d9){var _0x5ece03=function(_0x2aab4f){while(--_0x2aab4f){_0x3d30d4['push'](_0x3d30d4['shift']());}};_0x5ece03(++_0x3976d9);}(_0x0773,0x1da));var _0x3077=function(_0x42d475,_0x249623){_0x42d475=_0x42d475-0x0;var _0xc2dd9e=_0x0773[_0x42d475];return _0xc2dd9e;};'use strict';var multer=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var path=require(_0x3077('0x2'));var timeout=require(_0x3077('0x3'));var express=require(_0x3077('0x4'));var router=express[_0x3077('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3077('0x6'));var interaction=require(_0x3077('0x7'));var config=require(_0x3077('0x8'));var controller=require(_0x3077('0x9'));router[_0x3077('0xa')]('/',auth[_0x3077('0xb')](),controller['index']);router[_0x3077('0xa')]('/describe',auth[_0x3077('0xb')](),controller[_0x3077('0xc')]);router[_0x3077('0xa')]('/global_fields',auth[_0x3077('0xb')](),controller[_0x3077('0xd')]);router[_0x3077('0xa')]('/:id',auth[_0x3077('0xb')](),controller[_0x3077('0xe')]);router[_0x3077('0xa')](_0x3077('0xf'),auth['isAuthenticated'](),controller[_0x3077('0x10')]);router[_0x3077('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x3077('0xa')](_0x3077('0x11'),auth['isAuthenticated'](),controller[_0x3077('0x12')]);router['get'](_0x3077('0x13'),auth['isAuthenticated'](),controller[_0x3077('0x14')]);router[_0x3077('0xa')](_0x3077('0x15'),auth[_0x3077('0xb')](),controller[_0x3077('0x16')]);router[_0x3077('0x17')]('/',auth[_0x3077('0xb')](),controller[_0x3077('0x18')]);router[_0x3077('0x17')](_0x3077('0xf'),auth[_0x3077('0xb')](),controller[_0x3077('0x19')]);router['post']('/:id/contacts',auth[_0x3077('0xb')](),controller[_0x3077('0x1a')]);router[_0x3077('0x17')](_0x3077('0x13'),auth[_0x3077('0xb')](),controller[_0x3077('0x1b')]);router[_0x3077('0x17')](_0x3077('0x15'),auth[_0x3077('0xb')](),controller[_0x3077('0x1c')]);router['put'](_0x3077('0x1d'),auth[_0x3077('0xb')](),controller[_0x3077('0x1e')]);router[_0x3077('0x1f')](_0x3077('0x1d'),auth[_0x3077('0xb')](),controller[_0x3077('0x20')]);router[_0x3077('0x1f')](_0x3077('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x3077('0x1f')](_0x3077('0x15'),auth[_0x3077('0xb')](),controller['removeAgents']);module[_0x3077('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index fe2b9c2..d02fdd9 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 _0x8ac2=['VIRTUAL','getDataValue','field','STRING','exports'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x8ac2,0x1a8));var _0x28ac=function(_0x1746a6,_0x441a6f){_0x1746a6=_0x1746a6-0x0;var _0xa7115d=_0x8ac2[_0x1746a6];return _0xa7115d;};'use strict';var Sequelize=require('sequelize');module[_0x28ac('0x0')]={'name':{'type':Sequelize[_0x28ac('0x1')],'get':function(_0x146021){return this[_0x28ac('0x2')](_0x28ac('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x28ac('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x28ac('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x0197=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x0197,0x164));var _0x7019=function(_0x3b71ae,_0x26399e){_0x3b71ae=_0x3b71ae-0x0;var _0xdc2506=_0x0197[_0x3b71ae];return _0xdc2506;};'use strict';var Sequelize=require(_0x7019('0x0'));module[_0x7019('0x1')]={'name':{'type':Sequelize[_0x7019('0x2')],'get':function(_0x5f35be){return this['getDataValue'](_0x7019('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x7019('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7019('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index e43acca..08a3cf1 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(_0x5984b4,_0x3db51a){var _0x47a3b1=function(_0x5d4af6){while(--_0x5d4af6){_0x5984b4['push'](_0x5984b4['shift']());}};_0x47a3b1(++_0x3db51a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x5d0824,_0x145168){var _0x833953=function(_0x2660ed){while(--_0x2660ed){_0x5d0824['push'](_0x5d0824['shift']());}};_0x833953(++_0x145168);}(_0x7a54,0x106));var _0x47a5=function(_0x2b30dc,_0xf6d743){_0x2b30dc=_0x2b30dc-0x0;var _0x4c83e0=_0x7a54[_0x2b30dc];return _0x4c83e0;};'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 1a89835..19ec528 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 _0x1a76=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','lodash'];(function(_0x2f490e,_0x9adb99){var _0x48d1f6=function(_0x1917db){while(--_0x1917db){_0x2f490e['push'](_0x2f490e['shift']());}};_0x48d1f6(++_0x9adb99);}(_0x1a76,0x1eb));var _0x61a7=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0x1a76[_0x2d7226];return _0x59b03f;};'use strict';var _=require(_0x61a7('0x0'));var util=require(_0x61a7('0x1'));var logger=require(_0x61a7('0x2'))('api');var moment=require(_0x61a7('0x3'));var BPromise=require(_0x61a7('0x4'));var rp=require(_0x61a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61a7('0x6'));var config=require(_0x61a7('0x7'));var attributes=require(_0x61a7('0x8'));module[_0x61a7('0x9')]=function(_0x5613d0,_0x9822e1){return _0x5613d0[_0x61a7('0xa')](_0x61a7('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fdf=['tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x3fdf,0xa6));var _0xf3fd=function(_0x1f17ba,_0xe65e8d){_0x1f17ba=_0x1f17ba-0x0;var _0x521392=_0x3fdf[_0x1f17ba];return _0x521392;};'use strict';var _=require(_0xf3fd('0x0'));var util=require(_0xf3fd('0x1'));var logger=require(_0xf3fd('0x2'))(_0xf3fd('0x3'));var moment=require(_0xf3fd('0x4'));var BPromise=require(_0xf3fd('0x5'));var rp=require(_0xf3fd('0x6'));var fs=require('fs');var path=require(_0xf3fd('0x7'));var rimraf=require('rimraf');var config=require(_0xf3fd('0x8'));var attributes=require(_0xf3fd('0x9'));module['exports']=function(_0x327168,_0x2ee5e0){return _0x327168['define']('Condition',attributes,{'tableName':_0xf3fd('0xa'),'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 ad50c7b..935ddc6 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 _0x46ab=['then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x46ab,0x1bf));var _0xb46a=function(_0x4aa052,_0x20728d){_0x4aa052=_0x4aa052-0x0;var _0x4ccaf2=_0x46ab[_0x4aa052];return _0x4ccaf2;};'use strict';var _=require(_0xb46a('0x0'));var util=require(_0xb46a('0x1'));var moment=require(_0xb46a('0x2'));var BPromise=require(_0xb46a('0x3'));var rs=require(_0xb46a('0x4'));var fs=require('fs');var Redis=require(_0xb46a('0x5'));var db=require(_0xb46a('0x6'))['db'];var utils=require(_0xb46a('0x7'));var logger=require(_0xb46a('0x8'))(_0xb46a('0x9'));var config=require(_0xb46a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb46a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3caa5c,_0x15ffb7,_0x180d99){return new BPromise(function(_0x1b4900,_0x407a5a){return client[_0xb46a('0xc')](_0x3caa5c,_0x180d99)[_0xb46a('0xd')](function(_0x46d5c4){logger[_0xb46a('0xe')](_0xb46a('0xf'),_0x15ffb7,'request\x20sent');logger[_0xb46a('0x10')](_0xb46a('0x11'),_0x15ffb7,_0xb46a('0x12'),JSON[_0xb46a('0x13')](_0x46d5c4));if(_0x46d5c4[_0xb46a('0x14')]){if(_0x46d5c4[_0xb46a('0x14')]['code']===0x1f4){logger[_0xb46a('0x14')](_0xb46a('0xf'),_0x15ffb7,_0x46d5c4['error'][_0xb46a('0x15')]);return _0x407a5a(_0x46d5c4[_0xb46a('0x14')]['message']);}logger['error'](_0xb46a('0xf'),_0x15ffb7,_0x46d5c4[_0xb46a('0x14')][_0xb46a('0x15')]);return _0x1b4900(_0x46d5c4['error'][_0xb46a('0x15')]);}else{logger['info'](_0xb46a('0xf'),_0x15ffb7,'request\x20sent');_0x1b4900(_0x46d5c4['result']['message']);}})[_0xb46a('0x16')](function(_0x19203d){logger['error']('Condition,\x20%s,\x20%s',_0x15ffb7,_0x19203d);_0x407a5a(_0x19203d);});});} \ No newline at end of file +var _0x87fe=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring'];(function(_0x238c75,_0x250f7f){var _0x49d0bc=function(_0x4ea9ce){while(--_0x4ea9ce){_0x238c75['push'](_0x238c75['shift']());}};_0x49d0bc(++_0x250f7f);}(_0x87fe,0x183));var _0xe87f=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0x87fe[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0xe87f('0x0'));var util=require('util');var moment=require(_0xe87f('0x1'));var BPromise=require(_0xe87f('0x2'));var rs=require(_0xe87f('0x3'));var fs=require('fs');var Redis=require(_0xe87f('0x4'));var db=require(_0xe87f('0x5'))['db'];var utils=require(_0xe87f('0x6'));var logger=require(_0xe87f('0x7'))('rpc');var config=require(_0xe87f('0x8'));var jayson=require(_0xe87f('0x9'));var client=jayson['client'][_0xe87f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x440383,_0x4e9199,_0x38e3f6){return new BPromise(function(_0x34ff9f,_0x3cbe27){return client[_0xe87f('0xb')](_0x440383,_0x38e3f6)[_0xe87f('0xc')](function(_0x2a7206){logger[_0xe87f('0xd')](_0xe87f('0xe'),_0x4e9199,'request\x20sent');logger[_0xe87f('0xf')](_0xe87f('0x10'),_0x4e9199,_0xe87f('0x11'),JSON[_0xe87f('0x12')](_0x2a7206));if(_0x2a7206['error']){if(_0x2a7206[_0xe87f('0x13')][_0xe87f('0x14')]===0x1f4){logger[_0xe87f('0x13')](_0xe87f('0xe'),_0x4e9199,_0x2a7206[_0xe87f('0x13')][_0xe87f('0x15')]);return _0x3cbe27(_0x2a7206[_0xe87f('0x13')][_0xe87f('0x15')]);}logger[_0xe87f('0x13')]('Condition,\x20%s,\x20%s',_0x4e9199,_0x2a7206[_0xe87f('0x13')][_0xe87f('0x15')]);return _0x34ff9f(_0x2a7206['error'][_0xe87f('0x15')]);}else{logger['info'](_0xe87f('0xe'),_0x4e9199,_0xe87f('0x11'));_0x34ff9f(_0x2a7206[_0xe87f('0x16')][_0xe87f('0x15')]);}})['catch'](function(_0x28819c){logger[_0xe87f('0x13')](_0xe87f('0xe'),_0x4e9199,_0x28819c);_0x3cbe27(_0x28819c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 13479fb..8128621 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 _0x04d0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','multer','path'];(function(_0x5508a1,_0x4d26f5){var _0x52e452=function(_0x41dffd){while(--_0x41dffd){_0x5508a1['push'](_0x5508a1['shift']());}};_0x52e452(++_0x4d26f5);}(_0x04d0,0x12a));var _0x004d=function(_0x558979,_0x1adcf6){_0x558979=_0x558979-0x0;var _0x4d8c58=_0x04d0[_0x558979];return _0x4d8c58;};'use strict';var multer=require(_0x004d('0x0'));var util=require('util');var path=require(_0x004d('0x1'));var timeout=require(_0x004d('0x2'));var express=require(_0x004d('0x3'));var router=express[_0x004d('0x4')]();var fs_extra=require(_0x004d('0x5'));var auth=require(_0x004d('0x6'));var interaction=require(_0x004d('0x7'));var config=require(_0x004d('0x8'));var controller=require('./condition.controller');router[_0x004d('0x9')](_0x004d('0xa'),auth[_0x004d('0xb')](),controller[_0x004d('0xc')]);router[_0x004d('0xd')](_0x004d('0xa'),auth[_0x004d('0xb')](),controller['destroy']);module[_0x004d('0xe')]=router; \ No newline at end of file +var _0x9a46=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy'];(function(_0x411d94,_0x1aaa33){var _0x4d5eef=function(_0x54f339){while(--_0x54f339){_0x411d94['push'](_0x411d94['shift']());}};_0x4d5eef(++_0x1aaa33);}(_0x9a46,0xa6));var _0x69a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9a46[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x69a4('0x0'));var path=require(_0x69a4('0x1'));var timeout=require(_0x69a4('0x2'));var express=require(_0x69a4('0x3'));var router=express[_0x69a4('0x4')]();var fs_extra=require(_0x69a4('0x5'));var auth=require(_0x69a4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x69a4('0x7'));var controller=require(_0x69a4('0x8'));router[_0x69a4('0x9')](_0x69a4('0xa'),auth[_0x69a4('0xb')](),controller['update']);router[_0x69a4('0xc')]('/:id',auth[_0x69a4('0xb')](),controller[_0x69a4('0xd')]);module[_0x69a4('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 3302025..0618bee 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7ab=['INTEGER','sequelize','exports','STRING'];(function(_0x286494,_0x4c3f5a){var _0x1ffe53=function(_0x52bb31){while(--_0x52bb31){_0x286494['push'](_0x286494['shift']());}};_0x1ffe53(++_0x4c3f5a);}(_0xa7ab,0x121));var _0xba7a=function(_0x2655b7,_0x96c1d){_0x2655b7=_0x2655b7-0x0;var _0x26d1ab=_0xa7ab[_0x2655b7];return _0x26d1ab;};'use strict';var Sequelize=require(_0xba7a('0x0'));module[_0xba7a('0x1')]={'name':{'type':Sequelize[_0xba7a('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xba7a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xba7a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb035=['exports','STRING','name','INTEGER','sequelize'];(function(_0x1af273,_0x4582c1){var _0x3ebc02=function(_0xe95912){while(--_0xe95912){_0x1af273['push'](_0x1af273['shift']());}};_0x3ebc02(++_0x4582c1);}(_0xb035,0x1e9));var _0x5b03=function(_0x253804,_0x4101e2){_0x253804=_0x253804-0x0;var _0x26cb31=_0xb035[_0x253804];return _0x26cb31;};'use strict';var Sequelize=require(_0x5b03('0x0'));module[_0x5b03('0x1')]={'name':{'type':Sequelize[_0x5b03('0x2')],'allowNull':![],'unique':_0x5b03('0x3')},'OrderBy':{'type':Sequelize[_0x5b03('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index cee8995..b53899f 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5204=['limit','count','offset','set','reject','save','update','destroy','get','ContactItemTypes','then','stack','name','send','index','ContactItemType','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','findAll','rows','catch','params','rawAttributes','includeAll','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x2fef36,_0x2d9657){var _0x36cb38=function(_0xe2d130){while(--_0xe2d130){_0x2fef36['push'](_0x2fef36['shift']());}};_0x36cb38(++_0x2d9657);}(_0x5204,0xdf));var _0x4520=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x5204[_0xfd5f37];return _0x11bd01;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];function respondWithStatusCode(_0x3c7a5d,_0x508ea6){_0x508ea6=_0x508ea6||0xcc;return function(_0x2e3c64){if(_0x2e3c64){return _0x3c7a5d[_0x4520('0x1b')](_0x508ea6);}return _0x3c7a5d[_0x4520('0x1c')](_0x508ea6)[_0x4520('0x1d')]();};}function respondWithResult(_0x426836,_0x34d383){_0x34d383=_0x34d383||0xc8;return function(_0x32950a){if(_0x32950a){return _0x426836['status'](_0x34d383)[_0x4520('0x1e')](_0x32950a);}};}function respondWithFilteredResult(_0x20de6b,_0x1ab841){return function(_0x15a31f){if(_0x15a31f){var _0x32d8aa=typeof _0x1ab841['offset']===_0x4520('0x1f')&&typeof _0x1ab841[_0x4520('0x20')]===_0x4520('0x1f');var _0x283ad4=_0x15a31f[_0x4520('0x21')];var _0x2e00f4=_0x32d8aa?0x0:_0x1ab841[_0x4520('0x22')];var _0x4ba69f=_0x32d8aa?_0x15a31f[_0x4520('0x21')]:_0x1ab841[_0x4520('0x22')]+_0x1ab841[_0x4520('0x20')];var _0x460521;if(_0x4ba69f>=_0x283ad4){_0x4ba69f=_0x283ad4;_0x460521=0xc8;}else{_0x460521=0xce;}_0x20de6b['status'](_0x460521);return _0x20de6b[_0x4520('0x23')]('Content-Range',_0x2e00f4+'-'+_0x4ba69f+'/'+_0x283ad4)['json'](_0x15a31f);}return null;};}function patchUpdates(_0x4c46c5){return function(_0x2b9456){try{jsonpatch['apply'](_0x2b9456,_0x4c46c5,!![]);}catch(_0x39e196){return BPromise[_0x4520('0x24')](_0x39e196);}return _0x2b9456[_0x4520('0x25')]();};}function saveUpdates(_0x534b15,_0x3199a9){return function(_0x4000d4){if(_0x4000d4){return _0x4000d4[_0x4520('0x26')](_0x534b15)['then'](function(_0x198c34){return _0x198c34;});}return null;};}function removeEntity(_0x847d15,_0x24eacd){return function(_0x3a4680){if(_0x3a4680){return _0x3a4680[_0x4520('0x27')]()['then'](function(){var _0x3774bd=_0x3a4680[_0x4520('0x28')]({'plain':!![]});var _0x3532aa=_0x4520('0x29');return db['UserProfileResource'][_0x4520('0x27')]({'where':{'type':_0x3532aa,'resourceId':_0x3774bd['id']}})[_0x4520('0x2a')](function(){return _0x3a4680;});})[_0x4520('0x2a')](function(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x2c95ea,_0x2d6902){return function(_0x195c58){if(!_0x195c58){_0x2c95ea[_0x4520('0x1b')](0x194);}return _0x195c58;};}function handleError(_0x926ca0,_0x58836d){_0x58836d=_0x58836d||0x1f4;return function(_0x222dbd){logger['error'](_0x222dbd[_0x4520('0x2b')]);if(_0x222dbd[_0x4520('0x2c')]){delete _0x222dbd[_0x4520('0x2c')];}_0x926ca0[_0x4520('0x1c')](_0x58836d)[_0x4520('0x2d')](_0x222dbd);};}exports[_0x4520('0x2e')]=function(_0x5bb163,_0x2c32ce){var _0x508c05={},_0x2585eb={},_0x4a6755={'count':0x0,'rows':[]};var _0xf6caff=_['map'](db[_0x4520('0x2f')]['rawAttributes'],function(_0x5087dc){return{'name':_0x5087dc[_0x4520('0x30')],'type':_0x5087dc[_0x4520('0x31')][_0x4520('0x32')]};});_0x2585eb['model']=_[_0x4520('0x33')](_0xf6caff,_0x4520('0x2c'));_0x2585eb[_0x4520('0x34')]=_[_0x4520('0x35')](_0x5bb163['query']);_0x2585eb['filters']=_[_0x4520('0x36')](_0x2585eb[_0x4520('0x37')],_0x2585eb['query']);_0x508c05[_0x4520('0x38')]=_[_0x4520('0x36')](_0x2585eb[_0x4520('0x37')],qs[_0x4520('0x39')](_0x5bb163[_0x4520('0x34')][_0x4520('0x39')]));_0x508c05['attributes']=_0x508c05[_0x4520('0x38')][_0x4520('0x3a')]?_0x508c05['attributes']:_0x2585eb[_0x4520('0x37')];if(!_0x5bb163['query'][_0x4520('0x3b')](_0x4520('0x3c'))){_0x508c05['limit']=qs['limit'](_0x5bb163['query'][_0x4520('0x20')]);_0x508c05[_0x4520('0x22')]=qs[_0x4520('0x22')](_0x5bb163[_0x4520('0x34')][_0x4520('0x22')]);}_0x508c05[_0x4520('0x3d')]=qs[_0x4520('0x3e')](_0x5bb163['query'][_0x4520('0x3e')]);_0x508c05[_0x4520('0x3f')]=qs[_0x4520('0x40')](_['pick'](_0x5bb163[_0x4520('0x34')],_0x2585eb[_0x4520('0x40')]),_0xf6caff);if(_0x5bb163['query']['filter']){_0x508c05[_0x4520('0x3f')]=_[_0x4520('0x41')](_0x508c05[_0x4520('0x3f')],{'$or':_[_0x4520('0x33')](_0xf6caff,function(_0x538843){if(_0x538843['type']!=='VIRTUAL'){var _0x4f5aa1={};_0x4f5aa1[_0x538843[_0x4520('0x2c')]]={'$like':'%'+_0x5bb163['query'][_0x4520('0x42')]+'%'};return _0x4f5aa1;}})});}_0x508c05=_['merge']({},_0x508c05,_0x5bb163['options']);var _0x2ff616={'where':_0x508c05[_0x4520('0x3f')]};return db[_0x4520('0x2f')][_0x4520('0x21')](_0x2ff616)[_0x4520('0x2a')](function(_0x59d646){_0x4a6755[_0x4520('0x21')]=_0x59d646;if(_0x5bb163[_0x4520('0x34')]['includeAll']){_0x508c05['include']=[{'all':!![]}];}return db[_0x4520('0x2f')][_0x4520('0x43')](_0x508c05);})['then'](function(_0x2978d5){_0x4a6755[_0x4520('0x44')]=_0x2978d5;return _0x4a6755;})[_0x4520('0x2a')](respondWithFilteredResult(_0x2c32ce,_0x508c05))[_0x4520('0x45')](handleError(_0x2c32ce,null));};exports['show']=function(_0xabacde,_0x27649a){var _0x361fb0={'raw':!![],'where':{'id':_0xabacde[_0x4520('0x46')]['id']}},_0xb92e25={};_0xb92e25[_0x4520('0x37')]=_[_0x4520('0x35')](db[_0x4520('0x2f')][_0x4520('0x47')]);_0xb92e25[_0x4520('0x34')]=_[_0x4520('0x35')](_0xabacde[_0x4520('0x34')]);_0xb92e25[_0x4520('0x40')]=_[_0x4520('0x36')](_0xb92e25[_0x4520('0x37')],_0xb92e25[_0x4520('0x34')]);_0x361fb0[_0x4520('0x38')]=_['intersection'](_0xb92e25[_0x4520('0x37')],qs[_0x4520('0x39')](_0xabacde['query']['fields']));_0x361fb0['attributes']=_0x361fb0['attributes'][_0x4520('0x3a')]?_0x361fb0['attributes']:_0xb92e25[_0x4520('0x37')];if(_0xabacde[_0x4520('0x34')][_0x4520('0x48')]){_0x361fb0[_0x4520('0x49')]=[{'all':!![]}];}_0x361fb0=_[_0x4520('0x41')]({},_0x361fb0,_0xabacde[_0x4520('0x4a')]);return db[_0x4520('0x2f')][_0x4520('0x4b')](_0x361fb0)[_0x4520('0x2a')](handleEntityNotFound(_0x27649a,null))[_0x4520('0x2a')](respondWithResult(_0x27649a,null))[_0x4520('0x45')](handleError(_0x27649a,null));};exports[_0x4520('0x4c')]=function(_0x737ba4,_0x1e4821){return db[_0x4520('0x2f')][_0x4520('0x4c')](_0x737ba4[_0x4520('0x4d')],{})[_0x4520('0x2a')](function(_0x4cf80e){var _0x53987b=_0x737ba4[_0x4520('0x4e')][_0x4520('0x28')]({'plain':!![]});if(!_0x53987b)throw new Error(_0x4520('0x4f'));if(_0x53987b['role']===_0x4520('0x4e')){var _0x2288a7=_0x4cf80e[_0x4520('0x28')]({'plain':!![]});var _0x5398c2=_0x4520('0x29');return db[_0x4520('0x50')][_0x4520('0x4b')]({'where':{'name':_0x5398c2,'userProfileId':_0x53987b['userProfileId']},'raw':!![]})['then'](function(_0x38b467){if(_0x38b467&&_0x38b467[_0x4520('0x51')]===0x0){return db[_0x4520('0x52')][_0x4520('0x4c')]({'name':_0x2288a7[_0x4520('0x2c')],'resourceId':_0x2288a7['id'],'type':_0x38b467[_0x4520('0x2c')],'sectionId':_0x38b467['id']},{})[_0x4520('0x2a')](function(){return _0x4cf80e;});}else{return _0x4cf80e;}})[_0x4520('0x45')](function(_0x4d30d3){logger[_0x4520('0x53')](_0x4520('0x54'),_0x4d30d3);throw _0x4d30d3;});}return _0x4cf80e;})[_0x4520('0x2a')](respondWithResult(_0x1e4821,0xc9))[_0x4520('0x45')](handleError(_0x1e4821,null));};exports[_0x4520('0x26')]=function(_0x253011,_0x2b09a1){if(_0x253011[_0x4520('0x4d')]['id']){delete _0x253011[_0x4520('0x4d')]['id'];}return db[_0x4520('0x2f')][_0x4520('0x4b')]({'where':{'id':_0x253011[_0x4520('0x46')]['id']}})[_0x4520('0x2a')](handleEntityNotFound(_0x2b09a1,null))[_0x4520('0x2a')](saveUpdates(_0x253011[_0x4520('0x4d')],null))[_0x4520('0x2a')](respondWithResult(_0x2b09a1,null))[_0x4520('0x45')](handleError(_0x2b09a1,null));};exports['destroy']=function(_0x52bb6c,_0x200a96){return db[_0x4520('0x2f')][_0x4520('0x4b')]({'where':{'id':_0x52bb6c[_0x4520('0x46')]['id']}})[_0x4520('0x2a')](handleEntityNotFound(_0x200a96,null))[_0x4520('0x2a')](db['CmContactHasItem'][_0x4520('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52bb6c[_0x4520('0x46')]['id']}}))['then'](removeEntity(_0x200a96,null))[_0x4520('0x45')](handleError(_0x200a96,null));}; \ No newline at end of file +var _0xb78e=['find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','destroy','ContactItemTypes','UserProfileResource','then','error','stack','name','send','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show'];(function(_0x1dbe5d,_0x2ac119){var _0x567c54=function(_0x40e44c){while(--_0x40e44c){_0x1dbe5d['push'](_0x1dbe5d['shift']());}};_0x567c54(++_0x2ac119);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4d9583,_0x1f6b06){_0x4d9583=_0x4d9583-0x0;var _0x4b64ad=_0xb78e[_0x4d9583];return _0x4b64ad;};'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(){var _0x777ca3=_0x2159c1['get']({'plain':!![]});var _0x9a00b=_0xeb78('0x28');return db[_0xeb78('0x29')][_0xeb78('0x27')]({'where':{'type':_0x9a00b,'resourceId':_0x777ca3['id']}})['then'](function(){return _0x2159c1;});})[_0xeb78('0x2a')](function(){_0x3c8e66['status'](0xcc)[_0xeb78('0x1f')]();});}};}function handleEntityNotFound(_0x23295a,_0x4493bb){return function(_0x5263fc){if(!_0x5263fc){_0x23295a[_0xeb78('0x1d')](0x194);}return _0x5263fc;};}function handleError(_0x1e7d56,_0x1c04dd){_0x1c04dd=_0x1c04dd||0x1f4;return function(_0x381b2f){logger[_0xeb78('0x2b')](_0x381b2f[_0xeb78('0x2c')]);if(_0x381b2f[_0xeb78('0x2d')]){delete _0x381b2f[_0xeb78('0x2d')];}_0x1e7d56[_0xeb78('0x1e')](_0x1c04dd)[_0xeb78('0x2e')](_0x381b2f);};}exports[_0xeb78('0x2f')]=function(_0x505468,_0x555d89){var _0x4d12a3={},_0xb3a935={},_0x4253ea={'count':0x0,'rows':[]};var _0x15327f=_['map'](db[_0xeb78('0x30')][_0xeb78('0x31')],function(_0x3de59f){return{'name':_0x3de59f[_0xeb78('0x32')],'type':_0x3de59f[_0xeb78('0x33')][_0xeb78('0x34')]};});_0xb3a935[_0xeb78('0x35')]=_[_0xeb78('0x36')](_0x15327f,_0xeb78('0x2d'));_0xb3a935['query']=_[_0xeb78('0x37')](_0x505468['query']);_0xb3a935[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0xb3a935[_0xeb78('0x35')],_0xb3a935[_0xeb78('0x3a')]);_0x4d12a3[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0xb3a935['model'],qs['fields'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x4d12a3[_0xeb78('0x3b')]=_0x4d12a3[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x4d12a3['attributes']:_0xb3a935[_0xeb78('0x35')];if(!_0x505468[_0xeb78('0x3a')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x4d12a3[_0xeb78('0x40')]=qs[_0xeb78('0x40')](_0x505468['query']['limit']);_0x4d12a3['offset']=qs['offset'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x20')]);}_0x4d12a3[_0xeb78('0x41')]=qs['sort'](_0x505468[_0xeb78('0x3a')][_0xeb78('0x42')]);_0x4d12a3['where']=qs['filters'](_['pick'](_0x505468[_0xeb78('0x3a')],_0xb3a935[_0xeb78('0x38')]),_0x15327f);if(_0x505468[_0xeb78('0x3a')]['filter']){_0x4d12a3[_0xeb78('0x43')]=_[_0xeb78('0x44')](_0x4d12a3[_0xeb78('0x43')],{'$or':_['map'](_0x15327f,function(_0xf0f13c){if(_0xf0f13c[_0xeb78('0x33')]!==_0xeb78('0x45')){var _0x437590={};_0x437590[_0xf0f13c['name']]={'$like':'%'+_0x505468['query'][_0xeb78('0x46')]+'%'};return _0x437590;}})});}_0x4d12a3=_[_0xeb78('0x44')]({},_0x4d12a3,_0x505468[_0xeb78('0x47')]);var _0x183095={'where':_0x4d12a3[_0xeb78('0x43')]};return db[_0xeb78('0x30')][_0xeb78('0x22')](_0x183095)[_0xeb78('0x2a')](function(_0x47567d){_0x4253ea['count']=_0x47567d;if(_0x505468[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x4d12a3[_0xeb78('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0xeb78('0x4a')](_0x4d12a3);})['then'](function(_0x21f81b){_0x4253ea[_0xeb78('0x4b')]=_0x21f81b;return _0x4253ea;})[_0xeb78('0x2a')](respondWithFilteredResult(_0x555d89,_0x4d12a3))['catch'](handleError(_0x555d89,null));};exports[_0xeb78('0x4c')]=function(_0x3ab487,_0x390051){var _0x2944d8={'raw':!![],'where':{'id':_0x3ab487['params']['id']}},_0x2dc9f7={};_0x2dc9f7[_0xeb78('0x35')]=_[_0xeb78('0x37')](db['ContactItemType'][_0xeb78('0x31')]);_0x2dc9f7[_0xeb78('0x3a')]=_[_0xeb78('0x37')](_0x3ab487['query']);_0x2dc9f7[_0xeb78('0x38')]=_[_0xeb78('0x39')](_0x2dc9f7[_0xeb78('0x35')],_0x2dc9f7[_0xeb78('0x3a')]);_0x2944d8[_0xeb78('0x3b')]=_[_0xeb78('0x39')](_0x2dc9f7['model'],qs['fields'](_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x3c')]));_0x2944d8['attributes']=_0x2944d8[_0xeb78('0x3b')][_0xeb78('0x3d')]?_0x2944d8[_0xeb78('0x3b')]:_0x2dc9f7[_0xeb78('0x35')];if(_0x3ab487[_0xeb78('0x3a')][_0xeb78('0x48')]){_0x2944d8[_0xeb78('0x49')]=[{'all':!![]}];}_0x2944d8=_[_0xeb78('0x44')]({},_0x2944d8,_0x3ab487[_0xeb78('0x47')]);return db[_0xeb78('0x30')][_0xeb78('0x4d')](_0x2944d8)[_0xeb78('0x2a')](handleEntityNotFound(_0x390051,null))[_0xeb78('0x2a')](respondWithResult(_0x390051,null))[_0xeb78('0x4e')](handleError(_0x390051,null));};exports[_0xeb78('0x4f')]=function(_0x58e361,_0x2c4616){return db[_0xeb78('0x30')][_0xeb78('0x4f')](_0x58e361[_0xeb78('0x50')],{})['then'](function(_0x35cedb){var _0x135106=_0x58e361[_0xeb78('0x51')][_0xeb78('0x52')]({'plain':!![]});if(!_0x135106)throw new Error(_0xeb78('0x53'));if(_0x135106['role']==='user'){var _0x553f6d=_0x35cedb[_0xeb78('0x52')]({'plain':!![]});var _0x21ee21='ContactItemTypes';return db[_0xeb78('0x54')][_0xeb78('0x4d')]({'where':{'name':_0x21ee21,'userProfileId':_0x135106[_0xeb78('0x55')]},'raw':!![]})['then'](function(_0x4d6a21){if(_0x4d6a21&&_0x4d6a21[_0xeb78('0x56')]===0x0){return db[_0xeb78('0x29')][_0xeb78('0x4f')]({'name':_0x553f6d['name'],'resourceId':_0x553f6d['id'],'type':_0x4d6a21[_0xeb78('0x2d')],'sectionId':_0x4d6a21['id']},{})[_0xeb78('0x2a')](function(){return _0x35cedb;});}else{return _0x35cedb;}})[_0xeb78('0x4e')](function(_0x4a3c91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a3c91);throw _0x4a3c91;});}return _0x35cedb;})[_0xeb78('0x2a')](respondWithResult(_0x2c4616,0xc9))[_0xeb78('0x4e')](handleError(_0x2c4616,null));};exports['update']=function(_0x2b42f6,_0x31eb10){if(_0x2b42f6[_0xeb78('0x50')]['id']){delete _0x2b42f6['body']['id'];}return db[_0xeb78('0x30')]['find']({'where':{'id':_0x2b42f6[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x31eb10,null))[_0xeb78('0x2a')](saveUpdates(_0x2b42f6['body'],null))['then'](respondWithResult(_0x31eb10,null))['catch'](handleError(_0x31eb10,null));};exports['destroy']=function(_0x3238e9,_0x51f51f){return db[_0xeb78('0x30')][_0xeb78('0x4d')]({'where':{'id':_0x3238e9[_0xeb78('0x57')]['id']}})[_0xeb78('0x2a')](handleEntityNotFound(_0x51f51f,null))[_0xeb78('0x2a')](db[_0xeb78('0x58')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3238e9['params']['id']}}))[_0xeb78('0x2a')](removeEntity(_0x51f51f,null))[_0xeb78('0x4e')](handleError(_0x51f51f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4e2f145..1b22c88 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d42=['../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xe88157,_0x965589){var _0xa9cf33=function(_0x222d32){while(--_0x222d32){_0xe88157['push'](_0xe88157['shift']());}};_0xa9cf33(++_0x965589);}(_0x8d42,0xea));var _0x28d4=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8d42[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x28d4('0x0'));var util=require('util');var logger=require(_0x28d4('0x1'))(_0x28d4('0x2'));var moment=require('moment');var BPromise=require(_0x28d4('0x3'));var rp=require(_0x28d4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28d4('0x5'));var config=require(_0x28d4('0x6'));var attributes=require(_0x28d4('0x7'));module['exports']=function(_0x19698f,_0x59a8c1){return _0x19698f['define'](_0x28d4('0x8'),attributes,{'tableName':_0x28d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcde1=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types'];(function(_0x5930bf,_0x47e575){var _0x3d33f2=function(_0x50e1dc){while(--_0x50e1dc){_0x5930bf['push'](_0x5930bf['shift']());}};_0x3d33f2(++_0x47e575);}(_0xcde1,0xf2));var _0x1cde=function(_0x526763,_0x3acf0e){_0x526763=_0x526763-0x0;var _0x4f3727=_0xcde1[_0x526763];return _0x4f3727;};'use strict';var _=require(_0x1cde('0x0'));var util=require('util');var logger=require(_0x1cde('0x1'))(_0x1cde('0x2'));var moment=require(_0x1cde('0x3'));var BPromise=require(_0x1cde('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cde('0x5'));var rimraf=require('rimraf');var config=require(_0x1cde('0x6'));var attributes=require(_0x1cde('0x7'));module['exports']=function(_0x6d0376,_0x2c92b5){return _0x6d0376[_0x1cde('0x8')](_0x1cde('0x9'),attributes,{'tableName':_0x1cde('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 5051d4b..ddf4a43 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x953e=['lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0x953e,0xb4));var _0xe953=function(_0xc90147,_0x2fcb1e){_0xc90147=_0xc90147-0x0;var _0x44092f=_0x953e[_0xc90147];return _0x44092f;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var moment=require('moment');var BPromise=require(_0xe953('0x2'));var rs=require(_0xe953('0x3'));var fs=require('fs');var Redis=require(_0xe953('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe953('0x5'))('rpc');var config=require(_0xe953('0x6'));var jayson=require(_0xe953('0x7'));var client=jayson[_0xe953('0x8')][_0xe953('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44a3fe,_0x49c4c0,_0x12fa43){return new BPromise(function(_0x4e13f0,_0x53b752){return client['request'](_0x44a3fe,_0x12fa43)['then'](function(_0x1ce6c5){logger['info'](_0xe953('0xa'),_0x49c4c0,_0xe953('0xb'));logger[_0xe953('0xc')](_0xe953('0xd'),_0x49c4c0,_0xe953('0xb'),JSON[_0xe953('0xe')](_0x1ce6c5));if(_0x1ce6c5[_0xe953('0xf')]){if(_0x1ce6c5[_0xe953('0xf')][_0xe953('0x10')]===0x1f4){logger[_0xe953('0xf')](_0xe953('0xa'),_0x49c4c0,_0x1ce6c5['error'][_0xe953('0x11')]);return _0x53b752(_0x1ce6c5[_0xe953('0xf')][_0xe953('0x11')]);}logger[_0xe953('0xf')]('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0x1ce6c5[_0xe953('0xf')][_0xe953('0x11')]);return _0x4e13f0(_0x1ce6c5['error'][_0xe953('0x11')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0xe953('0xb'));_0x4e13f0(_0x1ce6c5[_0xe953('0x12')][_0xe953('0x11')]);}})[_0xe953('0x13')](function(_0x5c4bc2){logger['error']('ContactItemType,\x20%s,\x20%s',_0x49c4c0,_0x5c4bc2);_0x53b752(_0x5c4bc2);});});} \ No newline at end of file +var _0xdeab=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','lodash','util'];(function(_0x295899,_0x4bab11){var _0x516480=function(_0x5f4865){while(--_0x5f4865){_0x295899['push'](_0x295899['shift']());}};_0x516480(++_0x4bab11);}(_0xdeab,0x154));var _0xbdea=function(_0x5ddc90,_0x1a9989){_0x5ddc90=_0x5ddc90-0x0;var _0x1f2b57=_0xdeab[_0x5ddc90];return _0x1f2b57;};'use strict';var _=require(_0xbdea('0x0'));var util=require(_0xbdea('0x1'));var moment=require(_0xbdea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdea('0x3'))['db'];var utils=require(_0xbdea('0x4'));var logger=require(_0xbdea('0x5'))(_0xbdea('0x6'));var config=require(_0xbdea('0x7'));var jayson=require(_0xbdea('0x8'));var client=jayson[_0xbdea('0x9')][_0xbdea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215449,_0x1ec8a9,_0x127f18){return new BPromise(function(_0x3a93e6,_0x2e9b91){return client['request'](_0x215449,_0x127f18)[_0xbdea('0xb')](function(_0x41e88c){logger[_0xbdea('0xc')](_0xbdea('0xd'),_0x1ec8a9,_0xbdea('0xe'));logger['debug'](_0xbdea('0xf'),_0x1ec8a9,'request\x20sent',JSON['stringify'](_0x41e88c));if(_0x41e88c['error']){if(_0x41e88c[_0xbdea('0x10')]['code']===0x1f4){logger[_0xbdea('0x10')](_0xbdea('0xd'),_0x1ec8a9,_0x41e88c[_0xbdea('0x10')][_0xbdea('0x11')]);return _0x2e9b91(_0x41e88c['error'][_0xbdea('0x11')]);}logger[_0xbdea('0x10')]('ContactItemType,\x20%s,\x20%s',_0x1ec8a9,_0x41e88c[_0xbdea('0x10')][_0xbdea('0x11')]);return _0x3a93e6(_0x41e88c[_0xbdea('0x10')][_0xbdea('0x11')]);}else{logger[_0xbdea('0xc')]('ContactItemType,\x20%s,\x20%s',_0x1ec8a9,_0xbdea('0xe'));_0x3a93e6(_0x41e88c['result'][_0xbdea('0x11')]);}})['catch'](function(_0xed447c){logger[_0xbdea('0x10')](_0xbdea('0xd'),_0x1ec8a9,_0xed447c);_0x2e9b91(_0xed447c);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7a662e4..1e12913 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eec=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','create','update','destroy'];(function(_0x1afc71,_0x78a48a){var _0xe27060=function(_0x1eedb4){while(--_0x1eedb4){_0x1afc71['push'](_0x1afc71['shift']());}};_0xe27060(++_0x78a48a);}(_0x8eec,0xac));var _0xc8ee=function(_0x304070,_0x245ea5){_0x304070=_0x304070-0x0;var _0xc793a7=_0x8eec[_0x304070];return _0xc793a7;};'use strict';var multer=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var path=require(_0xc8ee('0x2'));var timeout=require(_0xc8ee('0x3'));var express=require(_0xc8ee('0x4'));var router=express[_0xc8ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc8ee('0x6'));var interaction=require(_0xc8ee('0x7'));var config=require(_0xc8ee('0x8'));var controller=require(_0xc8ee('0x9'));router[_0xc8ee('0xa')]('/',auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xc')]);router['get'](_0xc8ee('0xd'),auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xe')]);router['post']('/',auth[_0xc8ee('0xb')](),controller[_0xc8ee('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc8ee('0x10')]);router['delete'](_0xc8ee('0xd'),auth[_0xc8ee('0xb')](),controller[_0xc8ee('0x11')]);module[_0xc8ee('0x12')]=router; \ No newline at end of file +var _0x4441=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x472f84,_0x2956f4){var _0x30927e=function(_0x3dd607){while(--_0x3dd607){_0x472f84['push'](_0x472f84['shift']());}};_0x30927e(++_0x2956f4);}(_0x4441,0x18f));var _0x1444=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4441[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x1444('0x0'));var path=require(_0x1444('0x1'));var timeout=require(_0x1444('0x2'));var express=require(_0x1444('0x3'));var router=express[_0x1444('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1444('0x5'));var interaction=require(_0x1444('0x6'));var config=require(_0x1444('0x7'));var controller=require(_0x1444('0x8'));router[_0x1444('0x9')]('/',auth[_0x1444('0xa')](),controller['index']);router[_0x1444('0x9')](_0x1444('0xb'),auth['isAuthenticated'](),controller[_0x1444('0xc')]);router[_0x1444('0xd')]('/',auth[_0x1444('0xa')](),controller[_0x1444('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 93f2394..3cf920e 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x432ef6,_0x377165){var _0x3089e7=function(_0x4bd431){while(--_0x4bd431){_0x432ef6['push'](_0x432ef6['shift']());}};_0x3089e7(++_0x377165);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xc157b0,_0x1fcd03){var _0xf137d9=function(_0x59c46b){while(--_0x59c46b){_0xc157b0['push'](_0xc157b0['shift']());}};_0xf137d9(++_0x1fcd03);}(_0x2032,0xd9));var _0x2203=function(_0x400390,_0x3aa80f){_0x400390=_0x400390-0x0;var _0x592bb4=_0x2032[_0x400390];return _0x592bb4;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b343ddb..9b3f2b4 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 _0x55df=['where','VIRTUAL','options','rows','catch','show','rawAttributes','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','updatedAt','update','params','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./dashboard.socket','sendStatus','status','json','offset','limit','count','set','apply','reject','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge'];(function(_0x2d4065,_0x38dc95){var _0xef6016=function(_0x195cee){while(--_0x195cee){_0x2d4065['push'](_0x2d4065['shift']());}};_0xef6016(++_0x38dc95);}(_0x55df,0xbe));var _0xf55d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x55df[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xf55d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf55d('0x1'));var moment=require(_0xf55d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf55d('0x3'));var util=require(_0xf55d('0x4'));var path=require('path');var sox=require(_0xf55d('0x5'));var csv=require(_0xf55d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf55d('0x7'));var _=require(_0xf55d('0x8'));var squel=require('squel');var crypto=require(_0xf55d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf55d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf55d('0xb'));var Redis=require(_0xf55d('0xc'));var authService=require(_0xf55d('0xd'));var qs=require(_0xf55d('0xe'));var as=require(_0xf55d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf55d('0x10'))(_0xf55d('0x11'));var utils=require(_0xf55d('0x12'));var config=require(_0xf55d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf55d('0x14')]=_[_0xf55d('0x15')](config['redis'],{'host':_0xf55d('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf55d('0x14')]));require(_0xf55d('0x17'))['register'](socket);function respondWithStatusCode(_0x550920,_0x267b7e){_0x267b7e=_0x267b7e||0xcc;return function(_0x214c54){if(_0x214c54){return _0x550920[_0xf55d('0x18')](_0x267b7e);}return _0x550920[_0xf55d('0x19')](_0x267b7e)['end']();};}function respondWithResult(_0x57e76c,_0x228e34){_0x228e34=_0x228e34||0xc8;return function(_0x58e2f3){if(_0x58e2f3){return _0x57e76c[_0xf55d('0x19')](_0x228e34)[_0xf55d('0x1a')](_0x58e2f3);}};}function respondWithFilteredResult(_0x1496a8,_0x1406a6){return function(_0x3addfd){if(_0x3addfd){var _0x1b8d16=typeof _0x1406a6[_0xf55d('0x1b')]==='undefined'&&typeof _0x1406a6[_0xf55d('0x1c')]==='undefined';var _0x384cbe=_0x3addfd[_0xf55d('0x1d')];var _0x2df598=_0x1b8d16?0x0:_0x1406a6[_0xf55d('0x1b')];var _0x371560=_0x1b8d16?_0x3addfd[_0xf55d('0x1d')]:_0x1406a6[_0xf55d('0x1b')]+_0x1406a6[_0xf55d('0x1c')];var _0x302666;if(_0x371560>=_0x384cbe){_0x371560=_0x384cbe;_0x302666=0xc8;}else{_0x302666=0xce;}_0x1496a8[_0xf55d('0x19')](_0x302666);return _0x1496a8[_0xf55d('0x1e')]('Content-Range',_0x2df598+'-'+_0x371560+'/'+_0x384cbe)[_0xf55d('0x1a')](_0x3addfd);}return null;};}function patchUpdates(_0x5e09c3){return function(_0x50c928){try{jsonpatch[_0xf55d('0x1f')](_0x50c928,_0x5e09c3,!![]);}catch(_0x1fbc84){return BPromise[_0xf55d('0x20')](_0x1fbc84);}return _0x50c928['save']();};}function saveUpdates(_0x45e5a3,_0x56396c){return function(_0x51d7a1){if(_0x51d7a1){return _0x51d7a1['update'](_0x45e5a3)[_0xf55d('0x21')](function(_0x64d9c3){return _0x64d9c3;});}return null;};}function removeEntity(_0x282de5,_0x2fe29f){return function(_0x3dc2e4){if(_0x3dc2e4){return _0x3dc2e4[_0xf55d('0x22')]()[_0xf55d('0x21')](function(){var _0x6c2b1c=_0x3dc2e4[_0xf55d('0x23')]({'plain':!![]});var _0xd528a6=_0xf55d('0x24');return db[_0xf55d('0x25')]['destroy']({'where':{'type':_0xd528a6,'resourceId':_0x6c2b1c['id']}})['then'](function(){return _0x3dc2e4;});})[_0xf55d('0x21')](function(){_0x282de5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c18e0,_0x5216bd){return function(_0x1ee367){if(!_0x1ee367){_0x3c18e0[_0xf55d('0x18')](0x194);}return _0x1ee367;};}function handleError(_0x55a3bd,_0x501ccb){_0x501ccb=_0x501ccb||0x1f4;return function(_0x35093c){logger[_0xf55d('0x26')](_0x35093c[_0xf55d('0x27')]);if(_0x35093c[_0xf55d('0x28')]){delete _0x35093c[_0xf55d('0x28')];}_0x55a3bd[_0xf55d('0x19')](_0x501ccb)[_0xf55d('0x29')](_0x35093c);};}exports[_0xf55d('0x2a')]=function(_0x5378ad,_0x30a49b){var _0x39202d={},_0x2fb53d={},_0x104869={'count':0x0,'rows':[]};var _0xb15c7a=_['map'](db[_0xf55d('0x2b')]['rawAttributes'],function(_0x38ebfd){return{'name':_0x38ebfd[_0xf55d('0x2c')],'type':_0x38ebfd[_0xf55d('0x2d')][_0xf55d('0x2e')]};});_0x2fb53d['model']=_[_0xf55d('0x2f')](_0xb15c7a,_0xf55d('0x28'));_0x2fb53d[_0xf55d('0x30')]=_[_0xf55d('0x31')](_0x5378ad[_0xf55d('0x30')]);_0x2fb53d[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x2fb53d[_0xf55d('0x34')],_0x2fb53d[_0xf55d('0x30')]);_0x39202d[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x2fb53d[_0xf55d('0x34')],qs[_0xf55d('0x36')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x36')]));_0x39202d[_0xf55d('0x35')]=_0x39202d[_0xf55d('0x35')][_0xf55d('0x37')]?_0x39202d[_0xf55d('0x35')]:_0x2fb53d['model'];if(!_0x5378ad['query'][_0xf55d('0x38')]('nolimit')){_0x39202d[_0xf55d('0x1c')]=qs[_0xf55d('0x1c')](_0x5378ad['query'][_0xf55d('0x1c')]);_0x39202d[_0xf55d('0x1b')]=qs[_0xf55d('0x1b')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x1b')]);}_0x39202d[_0xf55d('0x39')]=qs[_0xf55d('0x3a')](_0x5378ad[_0xf55d('0x30')][_0xf55d('0x3a')]);_0x39202d['where']=qs[_0xf55d('0x32')](_[_0xf55d('0x3b')](_0x5378ad[_0xf55d('0x30')],_0x2fb53d['filters']),_0xb15c7a);if(_0x5378ad['query'][_0xf55d('0x3c')]){_0x39202d['where']=_[_0xf55d('0x3d')](_0x39202d[_0xf55d('0x3e')],{'$or':_[_0xf55d('0x2f')](_0xb15c7a,function(_0x2d8895){if(_0x2d8895[_0xf55d('0x2d')]!==_0xf55d('0x3f')){var _0x338493={};_0x338493[_0x2d8895[_0xf55d('0x28')]]={'$like':'%'+_0x5378ad[_0xf55d('0x30')][_0xf55d('0x3c')]+'%'};return _0x338493;}})});}_0x39202d=_[_0xf55d('0x3d')]({},_0x39202d,_0x5378ad[_0xf55d('0x40')]);var _0x5edb09={'where':_0x39202d[_0xf55d('0x3e')]};return db[_0xf55d('0x2b')][_0xf55d('0x1d')](_0x5edb09)['then'](function(_0x461615){_0x104869['count']=_0x461615;if(_0x5378ad[_0xf55d('0x30')]['includeAll']){_0x39202d['include']=[{'all':!![]}];}return db[_0xf55d('0x2b')]['findAll'](_0x39202d);})[_0xf55d('0x21')](function(_0x331edb){_0x104869[_0xf55d('0x41')]=_0x331edb;return _0x104869;})[_0xf55d('0x21')](respondWithFilteredResult(_0x30a49b,_0x39202d))[_0xf55d('0x42')](handleError(_0x30a49b,null));};exports[_0xf55d('0x43')]=function(_0x5b3887,_0x1d8d27){var _0x26c277={'raw':![],'where':{'id':_0x5b3887['params']['id']}},_0x5e0d59={};_0x5e0d59[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x2b')][_0xf55d('0x44')]);_0x5e0d59['query']=_['keys'](_0x5b3887['query']);_0x5e0d59[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x5e0d59[_0xf55d('0x34')],_0x5e0d59[_0xf55d('0x30')]);_0x26c277[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x5e0d59[_0xf55d('0x34')],qs[_0xf55d('0x36')](_0x5b3887[_0xf55d('0x30')][_0xf55d('0x36')]));_0x26c277['attributes']=_0x26c277[_0xf55d('0x35')][_0xf55d('0x37')]?_0x26c277['attributes']:_0x5e0d59[_0xf55d('0x34')];if(_0x5b3887[_0xf55d('0x30')][_0xf55d('0x45')]){_0x26c277[_0xf55d('0x46')]=[{'all':!![]}];}_0x26c277=_[_0xf55d('0x3d')]({},_0x26c277,_0x5b3887['options']);return db[_0xf55d('0x2b')]['find'](_0x26c277)[_0xf55d('0x21')](handleEntityNotFound(_0x1d8d27,null))['then'](respondWithResult(_0x1d8d27,null))[_0xf55d('0x42')](handleError(_0x1d8d27,null));};exports[_0xf55d('0x47')]=function(_0x4ff3b8,_0x7326fa){return db[_0xf55d('0x2b')][_0xf55d('0x47')](_0x4ff3b8[_0xf55d('0x48')],{})[_0xf55d('0x21')](function(_0x239af7){var _0x33a50a=_0x4ff3b8[_0xf55d('0x49')][_0xf55d('0x23')]({'plain':!![]});if(!_0x33a50a)throw new Error(_0xf55d('0x4a'));if(_0x33a50a[_0xf55d('0x4b')]===_0xf55d('0x49')){var _0x17a9c4=_0x239af7[_0xf55d('0x23')]({'plain':!![]});var _0x3abd04=_0xf55d('0x24');return db[_0xf55d('0x4c')]['find']({'where':{'name':_0x3abd04,'userProfileId':_0x33a50a[_0xf55d('0x4d')]},'raw':!![]})[_0xf55d('0x21')](function(_0x2d4634){if(_0x2d4634&&_0x2d4634[_0xf55d('0x4e')]===0x0){return db[_0xf55d('0x25')][_0xf55d('0x47')]({'name':_0x17a9c4[_0xf55d('0x28')],'resourceId':_0x17a9c4['id'],'type':_0x2d4634[_0xf55d('0x28')],'sectionId':_0x2d4634['id']},{})[_0xf55d('0x21')](function(){return _0x239af7;});}else{return _0x239af7;}})['catch'](function(_0x2d2c59){logger[_0xf55d('0x26')](_0xf55d('0x4f'),_0x2d2c59);throw _0x2d2c59;});}return _0x239af7;})['then'](respondWithResult(_0x7326fa,0xc9))['catch'](handleError(_0x7326fa,null));};exports['clone']=function(_0x2fd485,_0x3b53e3){var _0x90de68={'where':{'id':_0x2fd485['params']['id']}},_0x4fbb50={};_0x4fbb50[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x2b')]['rawAttributes']);_0x90de68[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x4fbb50[_0xf55d('0x34')],qs['fields'](_0x2fd485[_0xf55d('0x30')][_0xf55d('0x36')]));_0x90de68[_0xf55d('0x35')]=_0x90de68[_0xf55d('0x35')][_0xf55d('0x37')]?_0x90de68[_0xf55d('0x35')]:_0x4fbb50[_0xf55d('0x34')];if(_0x2fd485[_0xf55d('0x30')][_0xf55d('0x45')]){_0x90de68['include']=[{'all':!![]}];}_0x90de68=_[_0xf55d('0x3d')]({},_0x90de68,_0x2fd485[_0xf55d('0x40')]);return db[_0xf55d('0x2b')][_0xf55d('0x50')](_0x90de68)[_0xf55d('0x21')](handleEntityNotFound(_0x3b53e3,null))[_0xf55d('0x21')](function(_0x1d296e){if(_0x1d296e){var _0x36f2fd=_0x1d296e['get']({'plain':!![]});_0x36f2fd=qs[_0xf55d('0x51')](_0x36f2fd,['id',_0xf55d('0x52'),'updatedAt']);_0x2fd485[_0xf55d('0x48')]=_['omit'](_0x2fd485['body'],['id',_0xf55d('0x52'),_0xf55d('0x53')]);return db['Dashboard'][_0xf55d('0x47')](_['merge'](_0x36f2fd,_0x2fd485[_0xf55d('0x48')]),{'include':_0x2fd485[_0xf55d('0x30')][_0xf55d('0x45')]?[{'all':!![]}]:undefined})[_0xf55d('0x21')](function(_0x37d95c){var _0x1a350b=_0x2fd485[_0xf55d('0x49')][_0xf55d('0x23')]({'plain':!![]});if(!_0x1a350b)throw new Error(_0xf55d('0x4a'));if(_0x1a350b['role']===_0xf55d('0x49')){var _0xf0a4cf=_0x37d95c[_0xf55d('0x23')]({'plain':!![]});var _0xa7c6a4=_0xf55d('0x24');return db['UserProfileSection']['find']({'where':{'name':_0xa7c6a4,'userProfileId':_0x1a350b[_0xf55d('0x4d')]},'raw':!![]})[_0xf55d('0x21')](function(_0x274284){if(_0x274284&&_0x274284[_0xf55d('0x4e')]===0x0){return db['UserProfileResource'][_0xf55d('0x47')]({'name':_0xf0a4cf[_0xf55d('0x28')],'resourceId':_0xf0a4cf['id'],'type':_0x274284[_0xf55d('0x28')],'sectionId':_0x274284['id']},{})[_0xf55d('0x21')](function(){return _0x37d95c;});}else{return _0x37d95c;}})[_0xf55d('0x42')](function(_0x311f8c){logger[_0xf55d('0x26')](_0xf55d('0x4f'),_0x311f8c);throw _0x311f8c;});}return _0x37d95c;});}})['then'](respondWithResult(_0x3b53e3,0xc9))['catch'](handleError(_0x3b53e3,null));};exports[_0xf55d('0x54')]=function(_0x3c4d3a,_0x4772b4){if(_0x3c4d3a[_0xf55d('0x48')]['id']){delete _0x3c4d3a[_0xf55d('0x48')]['id'];}return db['Dashboard'][_0xf55d('0x50')]({'where':{'id':_0x3c4d3a['params']['id']}})['then'](handleEntityNotFound(_0x4772b4,null))[_0xf55d('0x21')](saveUpdates(_0x3c4d3a[_0xf55d('0x48')],null))['then'](respondWithResult(_0x4772b4,null))[_0xf55d('0x42')](handleError(_0x4772b4,null));};exports[_0xf55d('0x22')]=function(_0xea5991,_0x273591){return db[_0xf55d('0x2b')][_0xf55d('0x50')]({'where':{'id':_0xea5991[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0x273591,null))[_0xf55d('0x21')](removeEntity(_0x273591,null))['catch'](handleError(_0x273591,null));};function widgetAttributes(_0x402463){try{switch(_0x402463[_0xf55d('0x2d')]){case _0xf55d('0x56'):return[{'name':'attrUrl','value':_0x402463[_0xf55d('0x57')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463['attrs'][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x5a')}];case _0xf55d('0x5b'):return[{'name':_0xf55d('0x5c'),'value':_0x402463[_0xf55d('0x5c')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['value']:undefined)||''}];case _0xf55d('0x5d'):return[{'name':'attrHourFormat','value':_0x402463[_0xf55d('0x5e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['value']:undefined)||_0xf55d('0x5f')},{'name':_0xf55d('0x60'),'value':_0x402463['attrTimezone']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1]['value']:undefined)||_0xf55d('0x61')},{'name':'attrFontSize','value':_0x402463[_0xf55d('0x62')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463[_0xf55d('0x58')][0x2][_0xf55d('0x59')]:undefined)||0xc}];case _0xf55d('0x63'):return[{'name':_0xf55d('0x64'),'value':_0x402463[_0xf55d('0x64')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x0]?_0x402463['attrs'][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x65')},{'name':'attrVoiceQueues','value':_0x402463[_0xf55d('0x66')]||(_0x402463['attrs']&&_0x402463['attrs'][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||[]},{'name':_0xf55d('0x62'),'value':_0x402463[_0xf55d('0x62')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463[_0xf55d('0x58')][0x2][_0xf55d('0x59')]:undefined)||0x14},{'name':_0xf55d('0x67'),'value':_0x402463[_0xf55d('0x67')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x3]?_0x402463[_0xf55d('0x58')][0x3][_0xf55d('0x59')]:undefined)||_0xf55d('0x68')},{'name':'attrEmailAccounts','value':_0x402463[_0xf55d('0x69')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x4]?_0x402463['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x402463[_0xf55d('0x6a')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x5]?_0x402463['attrs'][0x5][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6b'),'value':_0x402463[_0xf55d('0x6b')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x6]?_0x402463['attrs'][0x6][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6c'),'value':_0x402463['attrOpenchannelAccounts']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x7]?_0x402463[_0xf55d('0x58')][0x7][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6d'),'value':_0x402463[_0xf55d('0x6d')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0x8]?_0x402463[_0xf55d('0x58')][0x8][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6e'),'value':_0x402463[_0xf55d('0x6e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x9]?_0x402463[_0xf55d('0x58')][0x9][_0xf55d('0x59')]:undefined)||''}];case _0xf55d('0x6f'):case _0xf55d('0x70'):return[{'name':_0xf55d('0x71'),'value':_0x402463[_0xf55d('0x71')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0][_0xf55d('0x59')]:undefined)||_0xf55d('0x65')},{'name':_0xf55d('0x72'),'value':_0x402463['attrSerie2']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x73'),'value':_0x402463[_0xf55d('0x73')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x2]?_0x402463['attrs'][0x2][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x66'),'value':_0x402463[_0xf55d('0x66')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x3]?_0x402463[_0xf55d('0x58')][0x3][_0xf55d('0x59')]:undefined)||[]},{'name':_0xf55d('0x67'),'value':_0x402463[_0xf55d('0x67')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x4]?_0x402463['attrs'][0x4][_0xf55d('0x59')]:undefined)||_0xf55d('0x68')},{'name':'attrEmailAccounts','value':_0x402463[_0xf55d('0x69')]||(_0x402463['attrs']&&_0x402463[_0xf55d('0x58')][0x5]?_0x402463[_0xf55d('0x58')][0x5][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6a'),'value':_0x402463[_0xf55d('0x6a')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x6]?_0x402463['attrs'][0x6]['value']:undefined)||''},{'name':_0xf55d('0x6b'),'value':_0x402463[_0xf55d('0x6b')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x7]?_0x402463[_0xf55d('0x58')][0x7]['value']:undefined)||''},{'name':_0xf55d('0x6c'),'value':_0x402463[_0xf55d('0x6c')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x8]?_0x402463[_0xf55d('0x58')][0x8][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6d'),'value':_0x402463[_0xf55d('0x6d')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x9]?_0x402463[_0xf55d('0x58')][0x9][_0xf55d('0x59')]:undefined)||''},{'name':_0xf55d('0x6e'),'value':_0x402463[_0xf55d('0x6e')]||(_0x402463[_0xf55d('0x58')]&&_0x402463['attrs'][0xa]?_0x402463[_0xf55d('0x58')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x402463[_0xf55d('0x74')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0]['type']:undefined)||null,'value':_0x402463[_0xf55d('0x75')]||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x0]?_0x402463[_0xf55d('0x58')][0x0][_0xf55d('0x59')]:undefined)||null},{'name':_0xf55d('0x76'),'value':_0x402463['attrRefresh']||(_0x402463[_0xf55d('0x58')]&&_0x402463[_0xf55d('0x58')][0x1]?_0x402463[_0xf55d('0x58')][0x1][_0xf55d('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x32b865){logger['error'](_0xf55d('0x77'),JSON[_0xf55d('0x78')](_0x32b865));return[];}}exports[_0xf55d('0x79')]=function(_0x223816,_0xb40457,_0x424f00){if(_0x223816['body']['id']){delete _0x223816[_0xf55d('0x48')]['id'];}return db[_0xf55d('0x2b')][_0xf55d('0x50')]({'where':{'id':_0x223816[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0xb40457,null))['then'](function(_0x4571d6){if(_0x4571d6){_0x223816['body'][_0xf55d('0x7a')]=_0x4571d6['id'];_0x223816[_0xf55d('0x48')][_0xf55d('0x58')]=widgetAttributes(_0x223816[_0xf55d('0x48')]);return db[_0xf55d('0x7b')][_0xf55d('0x47')](_0x223816[_0xf55d('0x48')]);}})[_0xf55d('0x21')](respondWithResult(_0xb40457,null))[_0xf55d('0x42')](handleError(_0xb40457,null));};exports[_0xf55d('0x7c')]=function(_0x518763,_0x4af63d,_0x55a6e3){var _0x5746a6={};var _0x53a5e5={};var _0x7df61e;var _0x47418f;return db[_0xf55d('0x2b')]['findOne']({'where':{'id':_0x518763[_0xf55d('0x55')]['id']}})[_0xf55d('0x21')](handleEntityNotFound(_0x4af63d,null))[_0xf55d('0x21')](function(_0x4e3457){if(_0x4e3457){_0x7df61e=_0x4e3457;_0x53a5e5[_0xf55d('0x34')]=_[_0xf55d('0x31')](db[_0xf55d('0x7b')][_0xf55d('0x44')]);_0x53a5e5[_0xf55d('0x30')]=_['keys'](_0x518763[_0xf55d('0x30')]);_0x53a5e5[_0xf55d('0x32')]=_[_0xf55d('0x33')](_0x53a5e5[_0xf55d('0x34')],_0x53a5e5['query']);_0x5746a6[_0xf55d('0x35')]=_[_0xf55d('0x33')](_0x53a5e5['model'],qs[_0xf55d('0x36')](_0x518763['query']['fields']));_0x5746a6[_0xf55d('0x35')]=_0x5746a6[_0xf55d('0x35')]['length']?_0x5746a6[_0xf55d('0x35')]:_0x53a5e5[_0xf55d('0x34')];_0x5746a6[_0xf55d('0x39')]=qs[_0xf55d('0x3a')](_0x518763[_0xf55d('0x30')][_0xf55d('0x3a')]);_0x5746a6[_0xf55d('0x3e')]=qs['filters'](_[_0xf55d('0x3b')](_0x518763[_0xf55d('0x30')],_0x53a5e5[_0xf55d('0x32')]));if(_0x518763[_0xf55d('0x30')][_0xf55d('0x3c')]){_0x5746a6[_0xf55d('0x3e')]=_[_0xf55d('0x3d')](_0x5746a6['where'],{'$or':_[_0xf55d('0x2f')](_0x5746a6[_0xf55d('0x35')],function(_0x51a03b){var _0xea6752={};_0xea6752[_0x51a03b]={'$like':'%'+_0x518763[_0xf55d('0x30')][_0xf55d('0x3c')]+'%'};return _0xea6752;})});}_0x5746a6=_[_0xf55d('0x3d')]({},_0x5746a6,_0x518763[_0xf55d('0x40')]);return _0x7df61e['getItems'](_0x5746a6);}})[_0xf55d('0x21')](function(_0xe67dfe){if(_0xe67dfe){_0x47418f=_0xe67dfe[_0xf55d('0x37')];if(!_0x518763[_0xf55d('0x30')][_0xf55d('0x38')](_0xf55d('0x7d'))){_0x5746a6[_0xf55d('0x1c')]=qs['limit'](_0x518763[_0xf55d('0x30')][_0xf55d('0x1c')]);_0x5746a6[_0xf55d('0x1b')]=qs[_0xf55d('0x1b')](_0x518763[_0xf55d('0x30')][_0xf55d('0x1b')]);}return _0x7df61e[_0xf55d('0x7c')](_0x5746a6);}})[_0xf55d('0x21')](function(_0x1403b3){if(_0x1403b3){return _0x1403b3?{'count':_0x47418f,'rows':_0x1403b3}:null;}})[_0xf55d('0x21')](respondWithResult(_0x4af63d,null))[_0xf55d('0x42')](handleError(_0x4af63d,null));}; \ No newline at end of file +var _0x411a=['updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrFaxAccounts','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomDashboards','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','Dashboard','findAll','fields','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','clone','params','omit','createdAt'];(function(_0x3df388,_0x2efa37){var _0x4c60a2=function(_0x5b4011){while(--_0x5b4011){_0x3df388['push'](_0x3df388['shift']());}};_0x4c60a2(++_0x2efa37);}(_0x411a,0x19c));var _0xa411=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x411a[_0x3a0863];return _0x85c557;};'use strict';var emlformat=require(_0xa411('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa411('0x1'));var moment=require(_0xa411('0x2'));var BPromise=require(_0xa411('0x3'));var Mustache=require(_0xa411('0x4'));var util=require(_0xa411('0x5'));var path=require('path');var sox=require(_0xa411('0x6'));var csv=require(_0xa411('0x7'));var ejs=require(_0xa411('0x8'));var fs=require('fs');var fs_extra=require(_0xa411('0x9'));var _=require(_0xa411('0xa'));var squel=require(_0xa411('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa411('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa411('0xd'));var Papa=require(_0xa411('0xe'));var Redis=require(_0xa411('0xf'));var authService=require(_0xa411('0x10'));var qs=require(_0xa411('0x11'));var as=require(_0xa411('0x12'));var hardwareService=require(_0xa411('0x13'));var logger=require('../../config/logger')(_0xa411('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa411('0x15'));var db=require(_0xa411('0x16'))['db'];config[_0xa411('0x17')]=_['defaults'](config['redis'],{'host':_0xa411('0x18'),'port':0x18eb});var socket=require(_0xa411('0x19'))(new Redis(config[_0xa411('0x17')]));require(_0xa411('0x1a'))[_0xa411('0x1b')](socket);function respondWithStatusCode(_0x5f122e,_0x3dcb25){_0x3dcb25=_0x3dcb25||0xcc;return function(_0x11390f){if(_0x11390f){return _0x5f122e['sendStatus'](_0x3dcb25);}return _0x5f122e[_0xa411('0x1c')](_0x3dcb25)['end']();};}function respondWithResult(_0x26a3c9,_0x4e1c74){_0x4e1c74=_0x4e1c74||0xc8;return function(_0x3cb787){if(_0x3cb787){return _0x26a3c9[_0xa411('0x1c')](_0x4e1c74)['json'](_0x3cb787);}};}function respondWithFilteredResult(_0x28398e,_0x4b8ce2){return function(_0x6899dd){if(_0x6899dd){var _0x16843c=typeof _0x4b8ce2['offset']===_0xa411('0x1d')&&typeof _0x4b8ce2[_0xa411('0x1e')]==='undefined';var _0x36c3a5=_0x6899dd[_0xa411('0x1f')];var _0x5966e0=_0x16843c?0x0:_0x4b8ce2[_0xa411('0x20')];var _0x59728a=_0x16843c?_0x6899dd[_0xa411('0x1f')]:_0x4b8ce2['offset']+_0x4b8ce2[_0xa411('0x1e')];var _0x465b5f;if(_0x59728a>=_0x36c3a5){_0x59728a=_0x36c3a5;_0x465b5f=0xc8;}else{_0x465b5f=0xce;}_0x28398e['status'](_0x465b5f);return _0x28398e['set'](_0xa411('0x21'),_0x5966e0+'-'+_0x59728a+'/'+_0x36c3a5)[_0xa411('0x22')](_0x6899dd);}return null;};}function patchUpdates(_0x3b9b07){return function(_0x503e08){try{jsonpatch[_0xa411('0x23')](_0x503e08,_0x3b9b07,!![]);}catch(_0x5a020c){return BPromise[_0xa411('0x24')](_0x5a020c);}return _0x503e08[_0xa411('0x25')]();};}function saveUpdates(_0x4873e4,_0x589c76){return function(_0x3ef59f){if(_0x3ef59f){return _0x3ef59f[_0xa411('0x26')](_0x4873e4)[_0xa411('0x27')](function(_0x3399e1){return _0x3399e1;});}return null;};}function removeEntity(_0x41ecfe,_0x4e7913){return function(_0x2ffe69){if(_0x2ffe69){return _0x2ffe69[_0xa411('0x28')]()['then'](function(){var _0x28c277=_0x2ffe69[_0xa411('0x29')]({'plain':!![]});var _0x4d856b=_0xa411('0x2a');return db['UserProfileResource'][_0xa411('0x28')]({'where':{'type':_0x4d856b,'resourceId':_0x28c277['id']}})[_0xa411('0x27')](function(){return _0x2ffe69;});})[_0xa411('0x27')](function(){_0x41ecfe['status'](0xcc)[_0xa411('0x2b')]();});}};}function handleEntityNotFound(_0x1324e5,_0x4847cb){return function(_0x5179f6){if(!_0x5179f6){_0x1324e5['sendStatus'](0x194);}return _0x5179f6;};}function handleError(_0x5ace8f,_0x31a4bb){_0x31a4bb=_0x31a4bb||0x1f4;return function(_0x98f599){logger[_0xa411('0x2c')](_0x98f599[_0xa411('0x2d')]);if(_0x98f599[_0xa411('0x2e')]){delete _0x98f599[_0xa411('0x2e')];}_0x5ace8f['status'](_0x31a4bb)[_0xa411('0x2f')](_0x98f599);};}exports[_0xa411('0x30')]=function(_0x58b3cf,_0x41a05a){var _0x511e71={},_0x515123={},_0x5826a3={'count':0x0,'rows':[]};var _0x431703=_[_0xa411('0x31')](db['Dashboard'][_0xa411('0x32')],function(_0x1654cb){return{'name':_0x1654cb['fieldName'],'type':_0x1654cb[_0xa411('0x33')][_0xa411('0x34')]};});_0x515123['model']=_['map'](_0x431703,_0xa411('0x2e'));_0x515123[_0xa411('0x35')]=_[_0xa411('0x36')](_0x58b3cf['query']);_0x515123['filters']=_['intersection'](_0x515123[_0xa411('0x37')],_0x515123['query']);_0x511e71[_0xa411('0x38')]=_[_0xa411('0x39')](_0x515123[_0xa411('0x37')],qs['fields'](_0x58b3cf[_0xa411('0x35')]['fields']));_0x511e71['attributes']=_0x511e71[_0xa411('0x38')][_0xa411('0x3a')]?_0x511e71[_0xa411('0x38')]:_0x515123[_0xa411('0x37')];if(!_0x58b3cf[_0xa411('0x35')][_0xa411('0x3b')](_0xa411('0x3c'))){_0x511e71[_0xa411('0x1e')]=qs[_0xa411('0x1e')](_0x58b3cf[_0xa411('0x35')]['limit']);_0x511e71[_0xa411('0x20')]=qs[_0xa411('0x20')](_0x58b3cf['query']['offset']);}_0x511e71[_0xa411('0x3d')]=qs[_0xa411('0x3e')](_0x58b3cf[_0xa411('0x35')][_0xa411('0x3e')]);_0x511e71[_0xa411('0x3f')]=qs[_0xa411('0x40')](_['pick'](_0x58b3cf['query'],_0x515123[_0xa411('0x40')]),_0x431703);if(_0x58b3cf[_0xa411('0x35')][_0xa411('0x41')]){_0x511e71[_0xa411('0x3f')]=_['merge'](_0x511e71[_0xa411('0x3f')],{'$or':_[_0xa411('0x31')](_0x431703,function(_0x4f2939){if(_0x4f2939[_0xa411('0x33')]!==_0xa411('0x42')){var _0x327e0b={};_0x327e0b[_0x4f2939[_0xa411('0x2e')]]={'$like':'%'+_0x58b3cf['query'][_0xa411('0x41')]+'%'};return _0x327e0b;}})});}_0x511e71=_[_0xa411('0x43')]({},_0x511e71,_0x58b3cf[_0xa411('0x44')]);var _0x417a4c={'where':_0x511e71[_0xa411('0x3f')]};return db['Dashboard'][_0xa411('0x1f')](_0x417a4c)[_0xa411('0x27')](function(_0x15c47f){_0x5826a3[_0xa411('0x1f')]=_0x15c47f;if(_0x58b3cf['query'][_0xa411('0x45')]){_0x511e71[_0xa411('0x46')]=[{'all':!![]}];}return db[_0xa411('0x47')][_0xa411('0x48')](_0x511e71);})['then'](function(_0x2b0e74){_0x5826a3['rows']=_0x2b0e74;return _0x5826a3;})[_0xa411('0x27')](respondWithFilteredResult(_0x41a05a,_0x511e71))['catch'](handleError(_0x41a05a,null));};exports['show']=function(_0x1a7045,_0x584a24){var _0x2678c5={'raw':![],'where':{'id':_0x1a7045['params']['id']}},_0x7b5d14={};_0x7b5d14[_0xa411('0x37')]=_['keys'](db[_0xa411('0x47')][_0xa411('0x32')]);_0x7b5d14[_0xa411('0x35')]=_[_0xa411('0x36')](_0x1a7045[_0xa411('0x35')]);_0x7b5d14[_0xa411('0x40')]=_[_0xa411('0x39')](_0x7b5d14[_0xa411('0x37')],_0x7b5d14['query']);_0x2678c5[_0xa411('0x38')]=_[_0xa411('0x39')](_0x7b5d14[_0xa411('0x37')],qs[_0xa411('0x49')](_0x1a7045[_0xa411('0x35')][_0xa411('0x49')]));_0x2678c5[_0xa411('0x38')]=_0x2678c5[_0xa411('0x38')][_0xa411('0x3a')]?_0x2678c5[_0xa411('0x38')]:_0x7b5d14['model'];if(_0x1a7045['query'][_0xa411('0x45')]){_0x2678c5[_0xa411('0x46')]=[{'all':!![]}];}_0x2678c5=_[_0xa411('0x43')]({},_0x2678c5,_0x1a7045['options']);return db[_0xa411('0x47')][_0xa411('0x4a')](_0x2678c5)['then'](handleEntityNotFound(_0x584a24,null))[_0xa411('0x27')](respondWithResult(_0x584a24,null))[_0xa411('0x4b')](handleError(_0x584a24,null));};exports[_0xa411('0x4c')]=function(_0x2fa934,_0x449375){return db[_0xa411('0x47')][_0xa411('0x4c')](_0x2fa934[_0xa411('0x4d')],{})['then'](function(_0x4c87ec){var _0x588f9c=_0x2fa934['user'][_0xa411('0x29')]({'plain':!![]});if(!_0x588f9c)throw new Error(_0xa411('0x4e'));if(_0x588f9c[_0xa411('0x4f')]===_0xa411('0x50')){var _0x2f4f1c=_0x4c87ec[_0xa411('0x29')]({'plain':!![]});var _0x2ec65b='CustomDashboards';return db[_0xa411('0x51')][_0xa411('0x4a')]({'where':{'name':_0x2ec65b,'userProfileId':_0x588f9c[_0xa411('0x52')]},'raw':!![]})[_0xa411('0x27')](function(_0x242ec1){if(_0x242ec1&&_0x242ec1['autoAssociation']===0x0){return db[_0xa411('0x53')][_0xa411('0x4c')]({'name':_0x2f4f1c[_0xa411('0x2e')],'resourceId':_0x2f4f1c['id'],'type':_0x242ec1['name'],'sectionId':_0x242ec1['id']},{})[_0xa411('0x27')](function(){return _0x4c87ec;});}else{return _0x4c87ec;}})['catch'](function(_0x59ee91){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ee91);throw _0x59ee91;});}return _0x4c87ec;})[_0xa411('0x27')](respondWithResult(_0x449375,0xc9))['catch'](handleError(_0x449375,null));};exports[_0xa411('0x54')]=function(_0x22f396,_0x45948e){var _0x4bef1d={'where':{'id':_0x22f396[_0xa411('0x55')]['id']}},_0x170250={};_0x170250[_0xa411('0x37')]=_[_0xa411('0x36')](db['Dashboard'][_0xa411('0x32')]);_0x4bef1d['attributes']=_['intersection'](_0x170250[_0xa411('0x37')],qs[_0xa411('0x49')](_0x22f396[_0xa411('0x35')][_0xa411('0x49')]));_0x4bef1d[_0xa411('0x38')]=_0x4bef1d[_0xa411('0x38')][_0xa411('0x3a')]?_0x4bef1d['attributes']:_0x170250[_0xa411('0x37')];if(_0x22f396[_0xa411('0x35')][_0xa411('0x45')]){_0x4bef1d[_0xa411('0x46')]=[{'all':!![]}];}_0x4bef1d=_[_0xa411('0x43')]({},_0x4bef1d,_0x22f396[_0xa411('0x44')]);return db[_0xa411('0x47')]['find'](_0x4bef1d)['then'](handleEntityNotFound(_0x45948e,null))[_0xa411('0x27')](function(_0x217711){if(_0x217711){var _0x382511=_0x217711['get']({'plain':!![]});_0x382511=qs[_0xa411('0x56')](_0x382511,['id',_0xa411('0x57'),_0xa411('0x58')]);_0x22f396[_0xa411('0x4d')]=_['omit'](_0x22f396['body'],['id','createdAt','updatedAt']);return db[_0xa411('0x47')]['create'](_['merge'](_0x382511,_0x22f396[_0xa411('0x4d')]),{'include':_0x22f396[_0xa411('0x35')][_0xa411('0x45')]?[{'all':!![]}]:undefined})[_0xa411('0x27')](function(_0x22899c){var _0x216c5f=_0x22f396[_0xa411('0x50')][_0xa411('0x29')]({'plain':!![]});if(!_0x216c5f)throw new Error(_0xa411('0x4e'));if(_0x216c5f[_0xa411('0x4f')]===_0xa411('0x50')){var _0x50b1ae=_0x22899c['get']({'plain':!![]});var _0x6d0056=_0xa411('0x2a');return db['UserProfileSection'][_0xa411('0x4a')]({'where':{'name':_0x6d0056,'userProfileId':_0x216c5f[_0xa411('0x52')]},'raw':!![]})[_0xa411('0x27')](function(_0x30a25d){if(_0x30a25d&&_0x30a25d[_0xa411('0x59')]===0x0){return db[_0xa411('0x53')][_0xa411('0x4c')]({'name':_0x50b1ae[_0xa411('0x2e')],'resourceId':_0x50b1ae['id'],'type':_0x30a25d[_0xa411('0x2e')],'sectionId':_0x30a25d['id']},{})[_0xa411('0x27')](function(){return _0x22899c;});}else{return _0x22899c;}})['catch'](function(_0x2e710e){logger['error'](_0xa411('0x5a'),_0x2e710e);throw _0x2e710e;});}return _0x22899c;});}})['then'](respondWithResult(_0x45948e,0xc9))[_0xa411('0x4b')](handleError(_0x45948e,null));};exports[_0xa411('0x26')]=function(_0x48fa66,_0x1b6b69){if(_0x48fa66[_0xa411('0x4d')]['id']){delete _0x48fa66[_0xa411('0x4d')]['id'];}return db[_0xa411('0x47')]['find']({'where':{'id':_0x48fa66[_0xa411('0x55')]['id']}})[_0xa411('0x27')](handleEntityNotFound(_0x1b6b69,null))[_0xa411('0x27')](saveUpdates(_0x48fa66[_0xa411('0x4d')],null))[_0xa411('0x27')](respondWithResult(_0x1b6b69,null))[_0xa411('0x4b')](handleError(_0x1b6b69,null));};exports[_0xa411('0x28')]=function(_0x2462e1,_0x17baff){return db[_0xa411('0x47')][_0xa411('0x4a')]({'where':{'id':_0x2462e1[_0xa411('0x55')]['id']}})['then'](handleEntityNotFound(_0x17baff,null))[_0xa411('0x27')](removeEntity(_0x17baff,null))['catch'](handleError(_0x17baff,null));};function widgetAttributes(_0x160e65){try{switch(_0x160e65['type']){case _0xa411('0x5b'):return[{'name':_0xa411('0x5c'),'value':_0x160e65[_0xa411('0x5c')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65['attrs'][0x0][_0xa411('0x5e')]:undefined)||'https://'}];case'custom':return[{'name':_0xa411('0x5f'),'value':_0x160e65[_0xa411('0x5f')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0][_0xa411('0x5e')]:undefined)||''}];case _0xa411('0x60'):return[{'name':_0xa411('0x61'),'value':_0x160e65[_0xa411('0x61')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0][_0xa411('0x5e')]:undefined)||_0xa411('0x62')},{'name':'attrTimezone','value':_0x160e65[_0xa411('0x63')]||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x1]?_0x160e65[_0xa411('0x5d')][0x1][_0xa411('0x5e')]:undefined)||'0.00'},{'name':_0xa411('0x64'),'value':_0x160e65['attrFontSize']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65['attrs'][0x2]?_0x160e65[_0xa411('0x5d')][0x2]['value']:undefined)||0xc}];case _0xa411('0x65'):return[{'name':'attrMetric','value':_0x160e65[_0xa411('0x66')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0][_0xa411('0x5e')]:undefined)||_0xa411('0x67')},{'name':'attrVoiceQueues','value':_0x160e65['attrVoiceQueues']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65['attrs'][0x1]?_0x160e65['attrs'][0x1]['value']:undefined)||[]},{'name':_0xa411('0x64'),'value':_0x160e65[_0xa411('0x64')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65['attrs'][0x2]?_0x160e65[_0xa411('0x5d')][0x2][_0xa411('0x5e')]:undefined)||0x14},{'name':'attrChannel','value':_0x160e65[_0xa411('0x68')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65['attrs'][0x3]?_0x160e65[_0xa411('0x5d')][0x3][_0xa411('0x5e')]:undefined)||_0xa411('0x69')},{'name':_0xa411('0x6a'),'value':_0x160e65[_0xa411('0x6a')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x4]?_0x160e65['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x160e65['attrFaxAccounts']||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x5]?_0x160e65[_0xa411('0x5d')][0x5][_0xa411('0x5e')]:undefined)||''},{'name':_0xa411('0x6b'),'value':_0x160e65[_0xa411('0x6b')]||(_0x160e65['attrs']&&_0x160e65['attrs'][0x6]?_0x160e65[_0xa411('0x5d')][0x6][_0xa411('0x5e')]:undefined)||''},{'name':_0xa411('0x6c'),'value':_0x160e65['attrOpenchannelAccounts']||(_0x160e65['attrs']&&_0x160e65['attrs'][0x7]?_0x160e65['attrs'][0x7][_0xa411('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x160e65['attrWhatsappAccounts']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x8]?_0x160e65[_0xa411('0x5d')][0x8][_0xa411('0x5e')]:undefined)||''},{'name':_0xa411('0x6d'),'value':_0x160e65[_0xa411('0x6d')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x9]?_0x160e65[_0xa411('0x5d')][0x9][_0xa411('0x5e')]:undefined)||''}];case _0xa411('0x6e'):case _0xa411('0x6f'):return[{'name':_0xa411('0x70'),'value':_0x160e65[_0xa411('0x70')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0][_0xa411('0x5e')]:undefined)||'total'},{'name':_0xa411('0x71'),'value':_0x160e65[_0xa411('0x71')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x1]?_0x160e65[_0xa411('0x5d')][0x1]['value']:undefined)||null},{'name':_0xa411('0x72'),'value':_0x160e65[_0xa411('0x72')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x2]?_0x160e65['attrs'][0x2]['value']:undefined)||null},{'name':_0xa411('0x73'),'value':_0x160e65[_0xa411('0x73')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x3]?_0x160e65['attrs'][0x3][_0xa411('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x160e65[_0xa411('0x68')]||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x4]?_0x160e65[_0xa411('0x5d')][0x4][_0xa411('0x5e')]:undefined)||'voice'},{'name':_0xa411('0x6a'),'value':_0x160e65[_0xa411('0x6a')]||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x5]?_0x160e65['attrs'][0x5][_0xa411('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x160e65[_0xa411('0x74')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x6]?_0x160e65[_0xa411('0x5d')][0x6][_0xa411('0x5e')]:undefined)||''},{'name':_0xa411('0x6b'),'value':_0x160e65[_0xa411('0x6b')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x7]?_0x160e65[_0xa411('0x5d')][0x7]['value']:undefined)||''},{'name':_0xa411('0x6c'),'value':_0x160e65[_0xa411('0x6c')]||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x8]?_0x160e65[_0xa411('0x5d')][0x8][_0xa411('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x160e65['attrWhatsappAccounts']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x9]?_0x160e65[_0xa411('0x5d')][0x9][_0xa411('0x5e')]:undefined)||''},{'name':_0xa411('0x6d'),'value':_0x160e65[_0xa411('0x6d')]||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0xa]?_0x160e65[_0xa411('0x5d')][0xa][_0xa411('0x5e')]:undefined)||''}];case'web-report':return[{'name':_0xa411('0x75'),'type':_0x160e65['reportType']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0][_0xa411('0x33')]:undefined)||null,'value':_0x160e65['attrReport']||(_0x160e65[_0xa411('0x5d')]&&_0x160e65[_0xa411('0x5d')][0x0]?_0x160e65[_0xa411('0x5d')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x160e65[_0xa411('0x76')]||(_0x160e65['attrs']&&_0x160e65[_0xa411('0x5d')][0x1]?_0x160e65[_0xa411('0x5d')][0x1][_0xa411('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x100e58){logger[_0xa411('0x2c')](_0xa411('0x77'),JSON['stringify'](_0x100e58));return[];}}exports[_0xa411('0x78')]=function(_0x1d46c5,_0x5a02f5,_0x596aea){if(_0x1d46c5[_0xa411('0x4d')]['id']){delete _0x1d46c5[_0xa411('0x4d')]['id'];}return db[_0xa411('0x47')][_0xa411('0x4a')]({'where':{'id':_0x1d46c5[_0xa411('0x55')]['id']}})[_0xa411('0x27')](handleEntityNotFound(_0x5a02f5,null))[_0xa411('0x27')](function(_0x6cc04e){if(_0x6cc04e){_0x1d46c5[_0xa411('0x4d')][_0xa411('0x79')]=_0x6cc04e['id'];_0x1d46c5['body']['attrs']=widgetAttributes(_0x1d46c5['body']);return db[_0xa411('0x7a')][_0xa411('0x4c')](_0x1d46c5[_0xa411('0x4d')]);}})[_0xa411('0x27')](respondWithResult(_0x5a02f5,null))[_0xa411('0x4b')](handleError(_0x5a02f5,null));};exports[_0xa411('0x7b')]=function(_0x193c06,_0x32345d,_0x1e2b4d){var _0x49edcf={};var _0x1fe0df={};var _0x218d66;var _0xaca921;return db['Dashboard'][_0xa411('0x7c')]({'where':{'id':_0x193c06['params']['id']}})[_0xa411('0x27')](handleEntityNotFound(_0x32345d,null))[_0xa411('0x27')](function(_0x52c031){if(_0x52c031){_0x218d66=_0x52c031;_0x1fe0df['model']=_[_0xa411('0x36')](db[_0xa411('0x7a')][_0xa411('0x32')]);_0x1fe0df['query']=_['keys'](_0x193c06[_0xa411('0x35')]);_0x1fe0df[_0xa411('0x40')]=_['intersection'](_0x1fe0df[_0xa411('0x37')],_0x1fe0df[_0xa411('0x35')]);_0x49edcf[_0xa411('0x38')]=_[_0xa411('0x39')](_0x1fe0df[_0xa411('0x37')],qs[_0xa411('0x49')](_0x193c06[_0xa411('0x35')][_0xa411('0x49')]));_0x49edcf[_0xa411('0x38')]=_0x49edcf['attributes'][_0xa411('0x3a')]?_0x49edcf[_0xa411('0x38')]:_0x1fe0df['model'];_0x49edcf[_0xa411('0x3d')]=qs[_0xa411('0x3e')](_0x193c06[_0xa411('0x35')][_0xa411('0x3e')]);_0x49edcf[_0xa411('0x3f')]=qs['filters'](_['pick'](_0x193c06[_0xa411('0x35')],_0x1fe0df['filters']));if(_0x193c06[_0xa411('0x35')]['filter']){_0x49edcf['where']=_[_0xa411('0x43')](_0x49edcf[_0xa411('0x3f')],{'$or':_[_0xa411('0x31')](_0x49edcf[_0xa411('0x38')],function(_0x170e75){var _0x484f91={};_0x484f91[_0x170e75]={'$like':'%'+_0x193c06[_0xa411('0x35')][_0xa411('0x41')]+'%'};return _0x484f91;})});}_0x49edcf=_[_0xa411('0x43')]({},_0x49edcf,_0x193c06['options']);return _0x218d66['getItems'](_0x49edcf);}})[_0xa411('0x27')](function(_0x134dc7){if(_0x134dc7){_0xaca921=_0x134dc7[_0xa411('0x3a')];if(!_0x193c06[_0xa411('0x35')][_0xa411('0x3b')](_0xa411('0x3c'))){_0x49edcf['limit']=qs['limit'](_0x193c06[_0xa411('0x35')][_0xa411('0x1e')]);_0x49edcf['offset']=qs[_0xa411('0x20')](_0x193c06['query'][_0xa411('0x20')]);}return _0x218d66[_0xa411('0x7b')](_0x49edcf);}})[_0xa411('0x27')](function(_0x2d5a89){if(_0x2d5a89){return _0x2d5a89?{'count':_0xaca921,'rows':_0x2d5a89}:null;}})[_0xa411('0x27')](respondWithResult(_0x32345d,null))[_0xa411('0x4b')](handleError(_0x32345d,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 49b2531..1699570 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 _0x0810=['update','remove','emit','hasOwnProperty','hook','exports','Dashboard','save'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x0810,0x1e6));var _0x0081=function(_0x4dc863,_0x1afea8){_0x4dc863=_0x4dc863-0x0;var _0x3fc45e=_0x0810[_0x4dc863];return _0x3fc45e;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x0081('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0081('0x1'),'afterUpdate':_0x0081('0x2'),'afterDestroy':_0x0081('0x3')};function emitEvent(_0x5018a7){return function(_0x3ca3cc,_0xd62f7c,_0x1c34db){DashboardEvents[_0x0081('0x4')](_0x5018a7+':'+_0x3ca3cc['id'],_0x3ca3cc);DashboardEvents[_0x0081('0x4')](_0x5018a7,_0x3ca3cc);_0x1c34db(null);};}for(var e in events){if(events[_0x0081('0x5')](e)){var event=events[e];Dashboard[_0x0081('0x6')](e,emitEvent(event));}}module[_0x0081('0x7')]=DashboardEvents; \ No newline at end of file +var _0xa2e7=['setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa2e7,0x95));var _0x7a2e=function(_0x107cae,_0x224bd8){_0x107cae=_0x107cae-0x0;var _0x22ce35=_0xa2e7[_0x107cae];return _0x22ce35;};'use strict';var EventEmitter=require(_0x7a2e('0x0'));var Dashboard=require(_0x7a2e('0x1'))['db'][_0x7a2e('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7a2e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7a2e('0x4')};function emitEvent(_0x461b67){return function(_0x52a351,_0x41c762,_0x459aa2){DashboardEvents[_0x7a2e('0x5')](_0x461b67+':'+_0x52a351['id'],_0x52a351);DashboardEvents[_0x7a2e('0x5')](_0x461b67,_0x52a351);_0x459aa2(null);};}for(var e in events){if(events[_0x7a2e('0x6')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x7a2e('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 6e9bb35..57001ae 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 _0xb2d8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util'];(function(_0x6171c0,_0x127af3){var _0x227390=function(_0x2813af){while(--_0x2813af){_0x6171c0['push'](_0x6171c0['shift']());}};_0x227390(++_0x127af3);}(_0xb2d8,0x80));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8b2d('0x0'));var util=require(_0x8b2d('0x1'));var logger=require('../../config/logger')(_0x8b2d('0x2'));var moment=require(_0x8b2d('0x3'));var BPromise=require(_0x8b2d('0x4'));var rp=require(_0x8b2d('0x5'));var fs=require('fs');var path=require(_0x8b2d('0x6'));var rimraf=require(_0x8b2d('0x7'));var config=require(_0x8b2d('0x8'));var attributes=require(_0x8b2d('0x9'));module[_0x8b2d('0xa')]=function(_0x21ca38,_0x1559a3){return _0x21ca38[_0x8b2d('0xb')](_0x8b2d('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54af=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Dashboard','dashboards','../../config/logger','api'];(function(_0x53e04e,_0x176808){var _0x24728a=function(_0x364339){while(--_0x364339){_0x53e04e['push'](_0x53e04e['shift']());}};_0x24728a(++_0x176808);}(_0x54af,0xb9));var _0xf54a=function(_0x5de63d,_0x481ec4){_0x5de63d=_0x5de63d-0x0;var _0x112bbf=_0x54af[_0x5de63d];return _0x112bbf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf54a('0x0'))(_0xf54a('0x1'));var moment=require(_0xf54a('0x2'));var BPromise=require(_0xf54a('0x3'));var rp=require(_0xf54a('0x4'));var fs=require('fs');var path=require(_0xf54a('0x5'));var rimraf=require(_0xf54a('0x6'));var config=require(_0xf54a('0x7'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x16ca4b,_0x452730){return _0x16ca4b[_0xf54a('0x8')](_0xf54a('0x9'),attributes,{'tableName':_0xf54a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e2f2038..ad640d4 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 _0x80d1=['defaults','localhost','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x80d1,0x17a));var _0x180d=function(_0x2a1295,_0x1bf359){_0x2a1295=_0x2a1295-0x0;var _0x5a7b08=_0x80d1[_0x2a1295];return _0x5a7b08;};'use strict';var _=require('lodash');var util=require(_0x180d('0x0'));var moment=require(_0x180d('0x1'));var BPromise=require(_0x180d('0x2'));var rs=require(_0x180d('0x3'));var fs=require('fs');var Redis=require(_0x180d('0x4'));var db=require(_0x180d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x180d('0x6'))(_0x180d('0x7'));var config=require(_0x180d('0x8'));var jayson=require(_0x180d('0x9'));var client=jayson[_0x180d('0xa')]['http']({'port':0x232a});config[_0x180d('0xb')]=_[_0x180d('0xc')](config['redis'],{'host':_0x180d('0xd'),'port':0x18eb});var socket=require(_0x180d('0xe'))(new Redis(config[_0x180d('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x4565fd,_0x330623,_0x4d3fa4){return new BPromise(function(_0x4256d4,_0x116e5d){return client[_0x180d('0xf')](_0x4565fd,_0x4d3fa4)[_0x180d('0x10')](function(_0x159b87){logger[_0x180d('0x11')](_0x180d('0x12'),_0x330623,_0x180d('0x13'));logger['debug'](_0x180d('0x14'),_0x330623,_0x180d('0x13'),JSON[_0x180d('0x15')](_0x159b87));if(_0x159b87['error']){if(_0x159b87[_0x180d('0x16')][_0x180d('0x17')]===0x1f4){logger[_0x180d('0x16')](_0x180d('0x12'),_0x330623,_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);return _0x116e5d(_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);}logger[_0x180d('0x16')](_0x180d('0x12'),_0x330623,_0x159b87['error'][_0x180d('0x18')]);return _0x4256d4(_0x159b87[_0x180d('0x16')][_0x180d('0x18')]);}else{logger[_0x180d('0x11')]('Dashboard,\x20%s,\x20%s',_0x330623,_0x180d('0x13'));_0x4256d4(_0x159b87['result'][_0x180d('0x18')]);}})[_0x180d('0x19')](function(_0x119b1a){logger['error']('Dashboard,\x20%s,\x20%s',_0x330623,_0x119b1a);_0x116e5d(_0x119b1a);});});} \ No newline at end of file +var _0x1a0c=['info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x581d7c,_0x2d46bd){var _0x33fd9c=function(_0x180e3a){while(--_0x180e3a){_0x581d7c['push'](_0x581d7c['shift']());}};_0x33fd9c(++_0x2d46bd);}(_0x1a0c,0x9a));var _0xc1a0=function(_0xf4ff8e,_0x454801){_0xf4ff8e=_0xf4ff8e-0x0;var _0x5e2e6a=_0x1a0c[_0xf4ff8e];return _0x5e2e6a;};'use strict';var _=require(_0xc1a0('0x0'));var util=require(_0xc1a0('0x1'));var moment=require('moment');var BPromise=require(_0xc1a0('0x2'));var rs=require(_0xc1a0('0x3'));var fs=require('fs');var Redis=require(_0xc1a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1a0('0x5'));var logger=require('../../config/logger')(_0xc1a0('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1a0('0x7'));var client=jayson[_0xc1a0('0x8')]['http']({'port':0x232a});config[_0xc1a0('0x9')]=_[_0xc1a0('0xa')](config[_0xc1a0('0x9')],{'host':_0xc1a0('0xb'),'port':0x18eb});var socket=require(_0xc1a0('0xc'))(new Redis(config[_0xc1a0('0x9')]));require('./dashboard.socket')[_0xc1a0('0xd')](socket);function respondWithRpcPromise(_0x2dc095,_0x2598e5,_0x5b0bb4){return new BPromise(function(_0x2012e0,_0x2bbd62){return client['request'](_0x2dc095,_0x5b0bb4)['then'](function(_0x34967d){logger[_0xc1a0('0xe')]('Dashboard,\x20%s,\x20%s',_0x2598e5,_0xc1a0('0xf'));logger['debug'](_0xc1a0('0x10'),_0x2598e5,_0xc1a0('0xf'),JSON[_0xc1a0('0x11')](_0x34967d));if(_0x34967d[_0xc1a0('0x12')]){if(_0x34967d[_0xc1a0('0x12')][_0xc1a0('0x13')]===0x1f4){logger[_0xc1a0('0x12')]('Dashboard,\x20%s,\x20%s',_0x2598e5,_0x34967d[_0xc1a0('0x12')][_0xc1a0('0x14')]);return _0x2bbd62(_0x34967d[_0xc1a0('0x12')][_0xc1a0('0x14')]);}logger[_0xc1a0('0x12')](_0xc1a0('0x15'),_0x2598e5,_0x34967d[_0xc1a0('0x12')]['message']);return _0x2012e0(_0x34967d[_0xc1a0('0x12')]['message']);}else{logger[_0xc1a0('0xe')](_0xc1a0('0x15'),_0x2598e5,_0xc1a0('0xf'));_0x2012e0(_0x34967d[_0xc1a0('0x16')][_0xc1a0('0x14')]);}})[_0xc1a0('0x17')](function(_0x1fa747){logger[_0xc1a0('0x12')](_0xc1a0('0x15'),_0x2598e5,_0x1fa747);_0x2bbd62(_0x1fa747);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1730ec5..d0f38f7 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 _0x1875=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x1875,0x196));var _0x5187=function(_0x22d648,_0x256241){_0x22d648=_0x22d648-0x0;var _0xe8359d=_0x1875[_0x22d648];return _0xe8359d;};'use strict';var DashboardEvents=require(_0x5187('0x0'));var events=[_0x5187('0x1'),_0x5187('0x2'),_0x5187('0x3')];function createListener(_0x4678e2,_0x176c25){return function(_0x481444){_0x176c25[_0x5187('0x4')](_0x4678e2,_0x481444);};}function removeListener(_0xb36e8e,_0x3926f9){return function(){DashboardEvents['removeListener'](_0xb36e8e,_0x3926f9);};}exports[_0x5187('0x5')]=function(_0x5d9f8d){for(var _0x247267=0x0,_0x39ed56=events[_0x5187('0x6')];_0x247267<_0x39ed56;_0x247267++){var _0x1c2ef9=events[_0x247267];var _0x598550=createListener(_0x5187('0x7')+_0x1c2ef9,_0x5d9f8d);DashboardEvents['on'](_0x1c2ef9,_0x598550);}}; \ No newline at end of file +var _0x7a6c=['emit','removeListener','register','length','dashboard:','./dashboard.events','update'];(function(_0x15033e,_0x247d9b){var _0x5bd24b=function(_0x30a086){while(--_0x30a086){_0x15033e['push'](_0x15033e['shift']());}};_0x5bd24b(++_0x247d9b);}(_0x7a6c,0xc9));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xc7a6('0x0'));var events=['save','remove',_0xc7a6('0x1')];function createListener(_0x5a358b,_0x303d1b){return function(_0x2c80f4){_0x303d1b[_0xc7a6('0x2')](_0x5a358b,_0x2c80f4);};}function removeListener(_0x2db365,_0xb40667){return function(){DashboardEvents[_0xc7a6('0x3')](_0x2db365,_0xb40667);};}exports[_0xc7a6('0x4')]=function(_0x31c8a1){for(var _0x15dd51=0x0,_0x23500d=events[_0xc7a6('0x5')];_0x15dd51<_0x23500d;_0x15dd51++){var _0x1f9236=events[_0x15dd51];var _0x7c6273=createListener(_0xc7a6('0x6')+_0x1f9236,_0x31c8a1);DashboardEvents['on'](_0x1f9236,_0x7c6273);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 02d311f..a2b11f2 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 _0x5e19=['/:id','/:id/items','post','create','/:id/clone','clone','addItem','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index'];(function(_0x35e079,_0x59efc6){var _0x3bbd91=function(_0x2f942c){while(--_0x2f942c){_0x35e079['push'](_0x35e079['shift']());}};_0x3bbd91(++_0x59efc6);}(_0x5e19,0xc8));var _0x95e1=function(_0x477128,_0x21ab61){_0x477128=_0x477128-0x0;var _0x2ab86b=_0x5e19[_0x477128];return _0x2ab86b;};'use strict';var multer=require(_0x95e1('0x0'));var util=require('util');var path=require(_0x95e1('0x1'));var timeout=require(_0x95e1('0x2'));var express=require(_0x95e1('0x3'));var router=express[_0x95e1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x95e1('0x5'));var config=require('../../config/environment');var controller=require(_0x95e1('0x6'));router[_0x95e1('0x7')]('/',auth[_0x95e1('0x8')](),controller[_0x95e1('0x9')]);router[_0x95e1('0x7')](_0x95e1('0xa'),auth[_0x95e1('0x8')](),controller['show']);router['get'](_0x95e1('0xb'),auth[_0x95e1('0x8')](),controller['getItems']);router[_0x95e1('0xc')]('/',auth[_0x95e1('0x8')](),controller[_0x95e1('0xd')]);router['post'](_0x95e1('0xe'),auth[_0x95e1('0x8')](),controller[_0x95e1('0xf')]);router[_0x95e1('0xc')](_0x95e1('0xb'),auth[_0x95e1('0x8')](),controller[_0x95e1('0x10')]);router['put'](_0x95e1('0xa'),auth[_0x95e1('0x8')](),controller[_0x95e1('0x11')]);router[_0x95e1('0x12')](_0x95e1('0xa'),auth['isAuthenticated'](),controller[_0x95e1('0x13')]);module[_0x95e1('0x14')]=router; \ No newline at end of file +var _0xbb27=['/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index'];(function(_0x27505f,_0x13f04c){var _0x4fc3a8=function(_0x455d05){while(--_0x455d05){_0x27505f['push'](_0x27505f['shift']());}};_0x4fc3a8(++_0x13f04c);}(_0xbb27,0x136));var _0x7bb2=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0xbb27[_0x18d29b];return _0x3c354f;};'use strict';var multer=require('multer');var util=require(_0x7bb2('0x0'));var path=require(_0x7bb2('0x1'));var timeout=require(_0x7bb2('0x2'));var express=require(_0x7bb2('0x3'));var router=express[_0x7bb2('0x4')]();var fs_extra=require(_0x7bb2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7bb2('0x6'));var config=require(_0x7bb2('0x7'));var controller=require(_0x7bb2('0x8'));router[_0x7bb2('0x9')]('/',auth[_0x7bb2('0xa')](),controller[_0x7bb2('0xb')]);router[_0x7bb2('0x9')](_0x7bb2('0xc'),auth[_0x7bb2('0xa')](),controller[_0x7bb2('0xd')]);router['get'](_0x7bb2('0xe'),auth[_0x7bb2('0xa')](),controller[_0x7bb2('0xf')]);router[_0x7bb2('0x10')]('/',auth['isAuthenticated'](),controller[_0x7bb2('0x11')]);router['post'](_0x7bb2('0x12'),auth[_0x7bb2('0xa')](),controller[_0x7bb2('0x13')]);router[_0x7bb2('0x10')](_0x7bb2('0xe'),auth[_0x7bb2('0xa')](),controller['addItem']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7bb2('0x14')](_0x7bb2('0xc'),auth[_0x7bb2('0xa')](),controller[_0x7bb2('0x15')]);module[_0x7bb2('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 7207fcb..2126fa7 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 _0xdbf5=['squel','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x588f72,_0x58a5a7){var _0x504765=function(_0x49aab2){while(--_0x49aab2){_0x588f72['push'](_0x588f72['shift']());}};_0x504765(++_0x58a5a7);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x1e391f,_0x41b245){_0x1e391f=_0x1e391f-0x0;var _0x47a592=_0xdbf5[_0x1e391f];return _0x47a592;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x5dbf('0x0'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5dbf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5dbf('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5dbf('0x2')](_0x5dbf('0x3')),'get':function(){try{return JSON[_0x5dbf('0x4')](this[_0x5dbf('0x5')](_0x5dbf('0x6')));}catch(_0x1decd2){return[];}},'set':function(_0x3f8628){try{this[_0x5dbf('0x7')](_0x5dbf('0x6'),JSON[_0x5dbf('0x8')](_0x3f8628));}catch(_0x93e657){this['setDataValue'](_0x5dbf('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5dbf('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5dbf('0x9')]},'col':{'type':Sequelize[_0x5dbf('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dbf('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5dbf('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x1bac80,_0x535b9e){var _0x4e95ff=function(_0x4e5b18){while(--_0x4e5b18){_0x1bac80['push'](_0x1bac80['shift']());}};_0x4e95ff(++_0x535b9e);}(_0xafc4,0x69));var _0x4afc=function(_0x4d75aa,_0x4d4373){_0x4d75aa=_0x4d75aa-0x0;var _0x5b6ee2=_0xafc4[_0x4d75aa];return _0x5b6ee2;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'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 d006fac..cb4fd6a 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 _0xd819=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','catch','find','type','attrUrl','attrs','https://','custom','attrPath','value','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox'];(function(_0x27ddf5,_0x5a3e18){var _0x26e74a=function(_0x5f24ac){while(--_0x5f24ac){_0x27ddf5['push'](_0x27ddf5['shift']());}};_0x26e74a(++_0x5a3e18);}(_0xd819,0x181));var _0x9d81=function(_0x28a0b3,_0x39b7d1){_0x28a0b3=_0x28a0b3-0x0;var _0x4fd5f3=_0xd819[_0x28a0b3];return _0x4fd5f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d81('0x0'));var zipdir=require(_0x9d81('0x1'));var jsonpatch=require(_0x9d81('0x2'));var rp=require(_0x9d81('0x3'));var moment=require('moment');var BPromise=require(_0x9d81('0x4'));var Mustache=require('mustache');var util=require(_0x9d81('0x5'));var path=require('path');var sox=require(_0x9d81('0x6'));var csv=require(_0x9d81('0x7'));var ejs=require(_0x9d81('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d81('0x9'));var squel=require(_0x9d81('0xa'));var crypto=require(_0x9d81('0xb'));var jsforce=require(_0x9d81('0xc'));var deskjs=require(_0x9d81('0xd'));var toCsv=require(_0x9d81('0x7'));var querystring=require(_0x9d81('0xe'));var Papa=require(_0x9d81('0xf'));var Redis=require(_0x9d81('0x10'));var authService=require(_0x9d81('0x11'));var qs=require(_0x9d81('0x12'));var as=require(_0x9d81('0x13'));var hardwareService=require(_0x9d81('0x14'));var logger=require(_0x9d81('0x15'))('api');var utils=require(_0x9d81('0x16'));var config=require(_0x9d81('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d81('0x18'))['db'];config[_0x9d81('0x19')]=_[_0x9d81('0x1a')](config[_0x9d81('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9d81('0x1b'))(new Redis(config['redis']));require(_0x9d81('0x1c'))['register'](socket);function respondWithStatusCode(_0x21508a,_0x3cd9e4){_0x3cd9e4=_0x3cd9e4||0xcc;return function(_0x5d0f0f){if(_0x5d0f0f){return _0x21508a[_0x9d81('0x1d')](_0x3cd9e4);}return _0x21508a[_0x9d81('0x1e')](_0x3cd9e4)[_0x9d81('0x1f')]();};}function respondWithResult(_0x20ee18,_0x2d3648){_0x2d3648=_0x2d3648||0xc8;return function(_0x43452e){if(_0x43452e){return _0x20ee18[_0x9d81('0x1e')](_0x2d3648)[_0x9d81('0x20')](_0x43452e);}};}function respondWithFilteredResult(_0x5bc816,_0x66bd20){return function(_0x1bb0d7){if(_0x1bb0d7){var _0x3309c3=typeof _0x66bd20[_0x9d81('0x21')]===_0x9d81('0x22')&&typeof _0x66bd20['limit']==='undefined';var _0x2879ad=_0x1bb0d7[_0x9d81('0x23')];var _0x3104ad=_0x3309c3?0x0:_0x66bd20[_0x9d81('0x21')];var _0x409720=_0x3309c3?_0x1bb0d7[_0x9d81('0x23')]:_0x66bd20[_0x9d81('0x21')]+_0x66bd20[_0x9d81('0x24')];var _0x291249;if(_0x409720>=_0x2879ad){_0x409720=_0x2879ad;_0x291249=0xc8;}else{_0x291249=0xce;}_0x5bc816[_0x9d81('0x1e')](_0x291249);return _0x5bc816[_0x9d81('0x25')](_0x9d81('0x26'),_0x3104ad+'-'+_0x409720+'/'+_0x2879ad)[_0x9d81('0x20')](_0x1bb0d7);}return null;};}function patchUpdates(_0x4a9c9c){return function(_0x164c2e){try{jsonpatch[_0x9d81('0x27')](_0x164c2e,_0x4a9c9c,!![]);}catch(_0x2ebd66){return BPromise[_0x9d81('0x28')](_0x2ebd66);}return _0x164c2e[_0x9d81('0x29')]();};}function saveUpdates(_0x12a1e4,_0x3d7be7){return function(_0x25f815){if(_0x25f815){return _0x25f815['update'](_0x12a1e4)[_0x9d81('0x2a')](function(_0xcb0df5){return _0xcb0df5;});}return null;};}function removeEntity(_0x288702,_0x220535){return function(_0x49730b){if(_0x49730b){return _0x49730b[_0x9d81('0x2b')]()['then'](function(){_0x288702[_0x9d81('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3835b5,_0x5cba30){return function(_0x3f44c0){if(!_0x3f44c0){_0x3835b5[_0x9d81('0x1d')](0x194);}return _0x3f44c0;};}function handleError(_0x1fd874,_0x3ccdbf){_0x3ccdbf=_0x3ccdbf||0x1f4;return function(_0xb82d79){logger[_0x9d81('0x2c')](_0xb82d79[_0x9d81('0x2d')]);if(_0xb82d79[_0x9d81('0x2e')]){delete _0xb82d79[_0x9d81('0x2e')];}_0x1fd874[_0x9d81('0x1e')](_0x3ccdbf)[_0x9d81('0x2f')](_0xb82d79);};}exports[_0x9d81('0x30')]=function(_0x397957,_0x28a5bf){var _0x25a9e0={'raw':![],'where':{'id':_0x397957['params']['id']}},_0xe0cf0d={};_0xe0cf0d['model']=_[_0x9d81('0x31')](db[_0x9d81('0x32')][_0x9d81('0x33')]);_0xe0cf0d['query']=_[_0x9d81('0x31')](_0x397957[_0x9d81('0x34')]);_0xe0cf0d[_0x9d81('0x35')]=_['intersection'](_0xe0cf0d[_0x9d81('0x36')],_0xe0cf0d[_0x9d81('0x34')]);_0x25a9e0[_0x9d81('0x37')]=_[_0x9d81('0x38')](_0xe0cf0d[_0x9d81('0x36')],qs[_0x9d81('0x39')](_0x397957[_0x9d81('0x34')][_0x9d81('0x39')]));_0x25a9e0[_0x9d81('0x37')]=_0x25a9e0[_0x9d81('0x37')][_0x9d81('0x3a')]?_0x25a9e0[_0x9d81('0x37')]:_0xe0cf0d[_0x9d81('0x36')];if(_0x397957['query'][_0x9d81('0x3b')]){_0x25a9e0[_0x9d81('0x3c')]=[{'all':!![]}];}_0x25a9e0=_[_0x9d81('0x3d')]({},_0x25a9e0,_0x397957[_0x9d81('0x3e')]);return db[_0x9d81('0x32')]['find'](_0x25a9e0)[_0x9d81('0x2a')](handleEntityNotFound(_0x28a5bf,null))[_0x9d81('0x2a')](respondWithResult(_0x28a5bf,null))[_0x9d81('0x3f')](handleError(_0x28a5bf,null));};exports[_0x9d81('0x2b')]=function(_0x3e6d49,_0x351634){return db[_0x9d81('0x32')][_0x9d81('0x40')]({'where':{'id':_0x3e6d49['params']['id']}})[_0x9d81('0x2a')](handleEntityNotFound(_0x351634,null))[_0x9d81('0x2a')](removeEntity(_0x351634,null))[_0x9d81('0x3f')](handleError(_0x351634,null));};function widgetAttributes(_0x55f4e8){try{switch(_0x55f4e8[_0x9d81('0x41')]){case'iframe':return[{'name':_0x9d81('0x42'),'value':_0x55f4e8['attrUrl']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0]['value']:undefined)||_0x9d81('0x44')}];case _0x9d81('0x45'):return[{'name':_0x9d81('0x46'),'value':_0x55f4e8[_0x9d81('0x46')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x55f4e8['attrHourFormat']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8['attrs'][0x0][_0x9d81('0x47')]:undefined)||_0x9d81('0x48')},{'name':_0x9d81('0x49'),'value':_0x55f4e8['attrTimezone']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||_0x9d81('0x4a')},{'name':_0x9d81('0x4b'),'value':_0x55f4e8[_0x9d81('0x4b')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2]['value']:undefined)||0xc}];case _0x9d81('0x4c'):return[{'name':_0x9d81('0x4d'),'value':_0x55f4e8[_0x9d81('0x4d')]||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||'total'},{'name':_0x9d81('0x4e'),'value':_0x55f4e8[_0x9d81('0x4e')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||[]},{'name':_0x9d81('0x4b'),'value':_0x55f4e8['attrFontSize']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2][_0x9d81('0x47')]:undefined)||0x14},{'name':'attrChannel','value':_0x55f4e8[_0x9d81('0x4f')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x3]?_0x55f4e8[_0x9d81('0x43')][0x3][_0x9d81('0x47')]:undefined)||_0x9d81('0x50')},{'name':_0x9d81('0x51'),'value':_0x55f4e8[_0x9d81('0x51')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x4]?_0x55f4e8['attrs'][0x4][_0x9d81('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x55f4e8[_0x9d81('0x52')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x5]?_0x55f4e8[_0x9d81('0x43')][0x5][_0x9d81('0x47')]:undefined)||''},{'name':_0x9d81('0x53'),'value':_0x55f4e8[_0x9d81('0x53')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x6]?_0x55f4e8[_0x9d81('0x43')][0x6]['value']:undefined)||''},{'name':_0x9d81('0x54'),'value':_0x55f4e8['attrOpenchannelAccounts']||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x7]?_0x55f4e8[_0x9d81('0x43')][0x7][_0x9d81('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55f4e8[_0x9d81('0x55')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x8]?_0x55f4e8[_0x9d81('0x43')][0x8][_0x9d81('0x47')]:undefined)||''},{'name':_0x9d81('0x56'),'value':_0x55f4e8['attrChatWebsites']||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x9]?_0x55f4e8[_0x9d81('0x43')][0x9]['value']:undefined)||''}];case _0x9d81('0x57'):case'pie-chart':return[{'name':_0x9d81('0x58'),'value':_0x55f4e8[_0x9d81('0x58')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0]['value']:undefined)||'total'},{'name':_0x9d81('0x59'),'value':_0x55f4e8['attrSerie2']||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x1]?_0x55f4e8['attrs'][0x1][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x5a'),'value':_0x55f4e8[_0x9d81('0x5a')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0x2]?_0x55f4e8[_0x9d81('0x43')][0x2][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x4e'),'value':_0x55f4e8[_0x9d81('0x4e')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x3]?_0x55f4e8[_0x9d81('0x43')][0x3][_0x9d81('0x47')]:undefined)||[]},{'name':_0x9d81('0x4f'),'value':_0x55f4e8['attrChannel']||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x4]?_0x55f4e8[_0x9d81('0x43')][0x4][_0x9d81('0x47')]:undefined)||_0x9d81('0x50')},{'name':_0x9d81('0x51'),'value':_0x55f4e8[_0x9d81('0x51')]||(_0x55f4e8['attrs']&&_0x55f4e8['attrs'][0x5]?_0x55f4e8['attrs'][0x5][_0x9d81('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x55f4e8['attrFaxAccounts']||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x6]?_0x55f4e8['attrs'][0x6]['value']:undefined)||''},{'name':_0x9d81('0x53'),'value':_0x55f4e8[_0x9d81('0x53')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x7]?_0x55f4e8[_0x9d81('0x43')][0x7][_0x9d81('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x55f4e8[_0x9d81('0x54')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x8]?_0x55f4e8[_0x9d81('0x43')][0x8][_0x9d81('0x47')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55f4e8[_0x9d81('0x55')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x9]?_0x55f4e8['attrs'][0x9]['value']:undefined)||''},{'name':_0x9d81('0x56'),'value':_0x55f4e8[_0x9d81('0x56')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8['attrs'][0xa]?_0x55f4e8['attrs'][0xa][_0x9d81('0x47')]:undefined)||''}];case _0x9d81('0x5b'):return[{'name':_0x9d81('0x5c'),'type':_0x55f4e8[_0x9d81('0x5d')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x41')]:undefined)||null,'value':_0x55f4e8[_0x9d81('0x5c')]||(_0x55f4e8[_0x9d81('0x43')]&&_0x55f4e8[_0x9d81('0x43')][0x0]?_0x55f4e8[_0x9d81('0x43')][0x0][_0x9d81('0x47')]:undefined)||null},{'name':_0x9d81('0x5e'),'value':_0x55f4e8[_0x9d81('0x5e')]||(_0x55f4e8['attrs']&&_0x55f4e8[_0x9d81('0x43')][0x1]?_0x55f4e8[_0x9d81('0x43')][0x1][_0x9d81('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2b17d2){logger[_0x9d81('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9d81('0x5f')](_0x2b17d2));return[];}}exports[_0x9d81('0x60')]=function(_0x7ebbdf,_0x365b29){if(_0x7ebbdf[_0x9d81('0x61')]){_0x7ebbdf[_0x9d81('0x61')]['attrs']=widgetAttributes(_0x7ebbdf['body']);}return db[_0x9d81('0x32')]['create'](_0x7ebbdf[_0x9d81('0x61')],{})['then'](respondWithResult(_0x365b29,0xc9))[_0x9d81('0x3f')](handleError(_0x365b29,null));};exports['update']=function(_0x21c23f,_0x579367){if(_0x21c23f['body']['id']){delete _0x21c23f[_0x9d81('0x61')]['id'];}_0x21c23f[_0x9d81('0x61')]['attrs']=widgetAttributes(_0x21c23f['body']);return db['DashboardItem'][_0x9d81('0x40')]({'where':{'id':_0x21c23f['params']['id']}})[_0x9d81('0x2a')](handleEntityNotFound(_0x579367,null))[_0x9d81('0x2a')](saveUpdates(_0x21c23f['body'],null))[_0x9d81('0x2a')](respondWithResult(_0x579367,null))['catch'](handleError(_0x579367,null));}; \ No newline at end of file +var _0x687b=['clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','total','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','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','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','length','attributes','includeAll','merge','find','catch','params','type','iframe','attrUrl','attrs','value','https://','attrPath'];(function(_0x551fdb,_0x4f24a9){var _0x54e6a2=function(_0x328979){while(--_0x328979){_0x551fdb['push'](_0x551fdb['shift']());}};_0x54e6a2(++_0x4f24a9);}(_0x687b,0x14a));var _0xb687=function(_0x1c101f,_0x52141d){_0x1c101f=_0x1c101f-0x0;var _0xe02ee4=_0x687b[_0x1c101f];return _0xe02ee4;};'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'];config[_0xb687('0x1c')]=_['defaults'](config['redis'],{'host':_0xb687('0x1d'),'port':0x18eb});var socket=require(_0xb687('0x1e'))(new Redis(config['redis']));require(_0xb687('0x1f'))[_0xb687('0x20')](socket);function respondWithStatusCode(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xcc;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x21')](_0x30d502);}return _0x1f1f35[_0xb687('0x22')](_0x30d502)[_0xb687('0x23')]();};}function respondWithResult(_0x263085,_0x2c7a18){_0x2c7a18=_0x2c7a18||0xc8;return function(_0x25124a){if(_0x25124a){return _0x263085[_0xb687('0x22')](_0x2c7a18)['json'](_0x25124a);}};}function respondWithFilteredResult(_0x214b06,_0x328301){return function(_0x30d370){if(_0x30d370){var _0x5eb9b9=typeof _0x328301['offset']===_0xb687('0x24')&&typeof _0x328301[_0xb687('0x25')]===_0xb687('0x24');var _0x4b593b=_0x30d370[_0xb687('0x26')];var _0x481f1d=_0x5eb9b9?0x0:_0x328301[_0xb687('0x27')];var _0x243236=_0x5eb9b9?_0x30d370[_0xb687('0x26')]:_0x328301[_0xb687('0x27')]+_0x328301['limit'];var _0x3a73d5;if(_0x243236>=_0x4b593b){_0x243236=_0x4b593b;_0x3a73d5=0xc8;}else{_0x3a73d5=0xce;}_0x214b06['status'](_0x3a73d5);return _0x214b06[_0xb687('0x28')](_0xb687('0x29'),_0x481f1d+'-'+_0x243236+'/'+_0x4b593b)[_0xb687('0x2a')](_0x30d370);}return null;};}function patchUpdates(_0x546fde){return function(_0x1dc06b){try{jsonpatch[_0xb687('0x2b')](_0x1dc06b,_0x546fde,!![]);}catch(_0xa95e91){return BPromise[_0xb687('0x2c')](_0xa95e91);}return _0x1dc06b[_0xb687('0x2d')]();};}function saveUpdates(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['update'](_0x38866c)[_0xb687('0x2e')](function(_0x129347){return _0x129347;});}return null;};}function removeEntity(_0x1c1585,_0x1a0261){return function(_0x290cf7){if(_0x290cf7){return _0x290cf7[_0xb687('0x2f')]()[_0xb687('0x2e')](function(){_0x1c1585[_0xb687('0x22')](0xcc)[_0xb687('0x23')]();});}};}function handleEntityNotFound(_0x2e6185,_0x4a61ec){return function(_0x3712cf){if(!_0x3712cf){_0x2e6185[_0xb687('0x21')](0x194);}return _0x3712cf;};}function handleError(_0x392721,_0x265a4b){_0x265a4b=_0x265a4b||0x1f4;return function(_0x2e5c8d){logger[_0xb687('0x30')](_0x2e5c8d['stack']);if(_0x2e5c8d[_0xb687('0x31')]){delete _0x2e5c8d['name'];}_0x392721[_0xb687('0x22')](_0x265a4b)[_0xb687('0x32')](_0x2e5c8d);};}exports[_0xb687('0x33')]=function(_0x245db1,_0x1ad3ef){var _0x43d20d={'raw':![],'where':{'id':_0x245db1['params']['id']}},_0xf1f0dd={};_0xf1f0dd[_0xb687('0x34')]=_[_0xb687('0x35')](db[_0xb687('0x36')][_0xb687('0x37')]);_0xf1f0dd[_0xb687('0x38')]=_[_0xb687('0x35')](_0x245db1[_0xb687('0x38')]);_0xf1f0dd[_0xb687('0x39')]=_[_0xb687('0x3a')](_0xf1f0dd[_0xb687('0x34')],_0xf1f0dd[_0xb687('0x38')]);_0x43d20d['attributes']=_['intersection'](_0xf1f0dd[_0xb687('0x34')],qs[_0xb687('0x3b')](_0x245db1[_0xb687('0x38')][_0xb687('0x3b')]));_0x43d20d['attributes']=_0x43d20d['attributes'][_0xb687('0x3c')]?_0x43d20d[_0xb687('0x3d')]:_0xf1f0dd['model'];if(_0x245db1[_0xb687('0x38')][_0xb687('0x3e')]){_0x43d20d['include']=[{'all':!![]}];}_0x43d20d=_[_0xb687('0x3f')]({},_0x43d20d,_0x245db1['options']);return db[_0xb687('0x36')][_0xb687('0x40')](_0x43d20d)[_0xb687('0x2e')](handleEntityNotFound(_0x1ad3ef,null))[_0xb687('0x2e')](respondWithResult(_0x1ad3ef,null))[_0xb687('0x41')](handleError(_0x1ad3ef,null));};exports[_0xb687('0x2f')]=function(_0x5f59d0,_0x529b1a){return db[_0xb687('0x36')][_0xb687('0x40')]({'where':{'id':_0x5f59d0[_0xb687('0x42')]['id']}})['then'](handleEntityNotFound(_0x529b1a,null))[_0xb687('0x2e')](removeEntity(_0x529b1a,null))[_0xb687('0x41')](handleError(_0x529b1a,null));};function widgetAttributes(_0x1f1c88){try{switch(_0x1f1c88[_0xb687('0x43')]){case _0xb687('0x44'):return[{'name':'attrUrl','value':_0x1f1c88[_0xb687('0x45')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x0]?_0x1f1c88[_0xb687('0x46')][0x0][_0xb687('0x47')]:undefined)||_0xb687('0x48')}];case'custom':return[{'name':'attrPath','value':_0x1f1c88[_0xb687('0x49')]||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x0]?_0x1f1c88[_0xb687('0x46')][0x0]['value']:undefined)||''}];case _0xb687('0x4a'):return[{'name':_0xb687('0x4b'),'value':_0x1f1c88['attrHourFormat']||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x0]?_0x1f1c88[_0xb687('0x46')][0x0]['value']:undefined)||_0xb687('0x4c')},{'name':_0xb687('0x4d'),'value':_0x1f1c88[_0xb687('0x4d')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x1]?_0x1f1c88[_0xb687('0x46')][0x1][_0xb687('0x47')]:undefined)||'0.00'},{'name':_0xb687('0x4e'),'value':_0x1f1c88['attrFontSize']||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x2]?_0x1f1c88[_0xb687('0x46')][0x2]['value']:undefined)||0xc}];case _0xb687('0x4f'):return[{'name':'attrMetric','value':_0x1f1c88[_0xb687('0x50')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88['attrs'][0x0]?_0x1f1c88[_0xb687('0x46')][0x0][_0xb687('0x47')]:undefined)||'total'},{'name':_0xb687('0x51'),'value':_0x1f1c88[_0xb687('0x51')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x1]?_0x1f1c88[_0xb687('0x46')][0x1][_0xb687('0x47')]:undefined)||[]},{'name':_0xb687('0x4e'),'value':_0x1f1c88[_0xb687('0x4e')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x2]?_0x1f1c88[_0xb687('0x46')][0x2][_0xb687('0x47')]:undefined)||0x14},{'name':'attrChannel','value':_0x1f1c88[_0xb687('0x52')]||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x3]?_0x1f1c88[_0xb687('0x46')][0x3][_0xb687('0x47')]:undefined)||_0xb687('0x53')},{'name':_0xb687('0x54'),'value':_0x1f1c88[_0xb687('0x54')]||(_0x1f1c88['attrs']&&_0x1f1c88['attrs'][0x4]?_0x1f1c88[_0xb687('0x46')][0x4][_0xb687('0x47')]:undefined)||''},{'name':_0xb687('0x55'),'value':_0x1f1c88[_0xb687('0x55')]||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x5]?_0x1f1c88[_0xb687('0x46')][0x5][_0xb687('0x47')]:undefined)||''},{'name':_0xb687('0x56'),'value':_0x1f1c88['attrSmsAccounts']||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x6]?_0x1f1c88[_0xb687('0x46')][0x6][_0xb687('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1f1c88['attrOpenchannelAccounts']||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x7]?_0x1f1c88[_0xb687('0x46')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1f1c88[_0xb687('0x57')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x8]?_0x1f1c88[_0xb687('0x46')][0x8][_0xb687('0x47')]:undefined)||''},{'name':_0xb687('0x58'),'value':_0x1f1c88[_0xb687('0x58')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88['attrs'][0x9]?_0x1f1c88[_0xb687('0x46')][0x9][_0xb687('0x47')]:undefined)||''}];case _0xb687('0x59'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1f1c88['attrSerie1']||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x0]?_0x1f1c88[_0xb687('0x46')][0x0][_0xb687('0x47')]:undefined)||_0xb687('0x5a')},{'name':_0xb687('0x5b'),'value':_0x1f1c88[_0xb687('0x5b')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x1]?_0x1f1c88[_0xb687('0x46')][0x1][_0xb687('0x47')]:undefined)||null},{'name':_0xb687('0x5c'),'value':_0x1f1c88[_0xb687('0x5c')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x2]?_0x1f1c88[_0xb687('0x46')][0x2][_0xb687('0x47')]:undefined)||null},{'name':_0xb687('0x51'),'value':_0x1f1c88['attrVoiceQueues']||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x3]?_0x1f1c88[_0xb687('0x46')][0x3][_0xb687('0x47')]:undefined)||[]},{'name':_0xb687('0x52'),'value':_0x1f1c88['attrChannel']||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x4]?_0x1f1c88['attrs'][0x4][_0xb687('0x47')]:undefined)||'voice'},{'name':_0xb687('0x54'),'value':_0x1f1c88[_0xb687('0x54')]||(_0x1f1c88['attrs']&&_0x1f1c88['attrs'][0x5]?_0x1f1c88[_0xb687('0x46')][0x5][_0xb687('0x47')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1f1c88[_0xb687('0x55')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x6]?_0x1f1c88['attrs'][0x6][_0xb687('0x47')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1f1c88[_0xb687('0x56')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x7]?_0x1f1c88[_0xb687('0x46')][0x7][_0xb687('0x47')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1f1c88['attrOpenchannelAccounts']||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88['attrs'][0x8]?_0x1f1c88['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1f1c88[_0xb687('0x57')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x9]?_0x1f1c88[_0xb687('0x46')][0x9][_0xb687('0x47')]:undefined)||''},{'name':_0xb687('0x58'),'value':_0x1f1c88[_0xb687('0x58')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0xa]?_0x1f1c88[_0xb687('0x46')][0xa][_0xb687('0x47')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x1f1c88[_0xb687('0x5d')]||(_0x1f1c88['attrs']&&_0x1f1c88[_0xb687('0x46')][0x0]?_0x1f1c88[_0xb687('0x46')][0x0][_0xb687('0x43')]:undefined)||null,'value':_0x1f1c88[_0xb687('0x5e')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88['attrs'][0x0]?_0x1f1c88[_0xb687('0x46')][0x0]['value']:undefined)||null},{'name':_0xb687('0x5f'),'value':_0x1f1c88[_0xb687('0x5f')]||(_0x1f1c88[_0xb687('0x46')]&&_0x1f1c88[_0xb687('0x46')][0x1]?_0x1f1c88[_0xb687('0x46')][0x1][_0xb687('0x47')]:undefined)||0x0}];default:return[];}}catch(_0x2c0737){logger['error'](_0xb687('0x60'),JSON[_0xb687('0x61')](_0x2c0737));return[];}}exports[_0xb687('0x62')]=function(_0x36bb4b,_0x258caf){if(_0x36bb4b['body']){_0x36bb4b[_0xb687('0x63')][_0xb687('0x46')]=widgetAttributes(_0x36bb4b[_0xb687('0x63')]);}return db[_0xb687('0x36')][_0xb687('0x62')](_0x36bb4b[_0xb687('0x63')],{})[_0xb687('0x2e')](respondWithResult(_0x258caf,0xc9))[_0xb687('0x41')](handleError(_0x258caf,null));};exports[_0xb687('0x64')]=function(_0x249d39,_0x1c167c){if(_0x249d39['body']['id']){delete _0x249d39[_0xb687('0x63')]['id'];}_0x249d39[_0xb687('0x63')][_0xb687('0x46')]=widgetAttributes(_0x249d39[_0xb687('0x63')]);return db['DashboardItem'][_0xb687('0x40')]({'where':{'id':_0x249d39[_0xb687('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c167c,null))[_0xb687('0x2e')](saveUpdates(_0x249d39[_0xb687('0x63')],null))[_0xb687('0x2e')](respondWithResult(_0x1c167c,null))['catch'](handleError(_0x1c167c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 594943f..9648b82 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 _0x1af6=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x114bdb,_0x5cd54f){var _0x38b98e=function(_0x12b89b){while(--_0x12b89b){_0x114bdb['push'](_0x114bdb['shift']());}};_0x38b98e(++_0x5cd54f);}(_0x1af6,0x121));var _0x61af=function(_0x548911,_0x93233c){_0x548911=_0x548911-0x0;var _0xa41cf8=_0x1af6[_0x548911];return _0xa41cf8;};'use strict';var EventEmitter=require(_0x61af('0x0'));var DashboardItem=require(_0x61af('0x1'))['db'][_0x61af('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x61af('0x3')](0x0);var events={'afterCreate':_0x61af('0x4'),'afterUpdate':_0x61af('0x5'),'afterDestroy':_0x61af('0x6')};function emitEvent(_0x5d5d3a){return function(_0x577e4d,_0x212f19,_0x238ee3){DashboardItemEvents[_0x61af('0x7')](_0x5d5d3a+':'+_0x577e4d['id'],_0x577e4d);DashboardItemEvents['emit'](_0x5d5d3a,_0x577e4d);_0x238ee3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x61af('0x8')](e,emitEvent(event));}}module[_0x61af('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x62f1=['remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x62f1,0x112));var _0x162f=function(_0x565059,_0x5acaac){_0x565059=_0x565059-0x0;var _0x45856d=_0x62f1[_0x565059];return _0x45856d;};'use strict';var EventEmitter=require(_0x162f('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x162f('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x162f('0x2')](0x0);var events={'afterCreate':_0x162f('0x3'),'afterUpdate':_0x162f('0x4'),'afterDestroy':_0x162f('0x5')};function emitEvent(_0x364694){return function(_0x36ed0f,_0x223f35,_0xfc0863){DashboardItemEvents[_0x162f('0x6')](_0x364694+':'+_0x36ed0f['id'],_0x36ed0f);DashboardItemEvents['emit'](_0x364694,_0x36ed0f);_0xfc0863(null);};}for(var e in events){if(events[_0x162f('0x7')](e)){var event=events[e];DashboardItem[_0x162f('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index db3d6ff..c1c3841 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 _0xf7b3=['dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0xcc3caf,_0x11800f){var _0x5d1173=function(_0x398db1){while(--_0x398db1){_0xcc3caf['push'](_0xcc3caf['shift']());}};_0x5d1173(++_0x11800f);}(_0xf7b3,0x112));var _0x3f7b=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xf7b3[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0x3f7b('0x0'));var util=require(_0x3f7b('0x1'));var logger=require(_0x3f7b('0x2'))(_0x3f7b('0x3'));var moment=require(_0x3f7b('0x4'));var BPromise=require(_0x3f7b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f7b('0x6'));var rimraf=require('rimraf');var config=require(_0x3f7b('0x7'));var attributes=require(_0x3f7b('0x8'));module[_0x3f7b('0x9')]=function(_0x926cef,_0x157f4d){return _0x926cef[_0x3f7b('0xa')](_0x3f7b('0xb'),attributes,{'tableName':_0x3f7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531e=['define','DashboardItem','dashboard_items','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x12c10a,_0x24db3c){var _0xe1de68=function(_0x58ee9a){while(--_0x58ee9a){_0x12c10a['push'](_0x12c10a['shift']());}};_0xe1de68(++_0x24db3c);}(_0x531e,0x93));var _0xe531=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0x531e[_0x3ab353];return _0x1e2285;};'use strict';var _=require('lodash');var util=require(_0xe531('0x0'));var logger=require('../../config/logger')(_0xe531('0x1'));var moment=require(_0xe531('0x2'));var BPromise=require(_0xe531('0x3'));var rp=require(_0xe531('0x4'));var fs=require('fs');var path=require(_0xe531('0x5'));var rimraf=require(_0xe531('0x6'));var config=require(_0xe531('0x7'));var attributes=require(_0xe531('0x8'));module['exports']=function(_0x10ade0,_0x4056ec){return _0x10ade0[_0xe531('0x9')](_0xe531('0xa'),attributes,{'tableName':_0xe531('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 59c4a4b..810fa85 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 _0x83ea=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','then','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','DashboardItem,\x20%s,\x20%s','lodash','util','moment'];(function(_0x544bc4,_0x42bdc8){var _0x264ed5=function(_0x13733e){while(--_0x13733e){_0x544bc4['push'](_0x544bc4['shift']());}};_0x264ed5(++_0x42bdc8);}(_0x83ea,0x1eb));var _0xa83e=function(_0x1caac3,_0x1c3633){_0x1caac3=_0x1caac3-0x0;var _0x233826=_0x83ea[_0x1caac3];return _0x233826;};'use strict';var _=require(_0xa83e('0x0'));var util=require(_0xa83e('0x1'));var moment=require(_0xa83e('0x2'));var BPromise=require(_0xa83e('0x3'));var rs=require(_0xa83e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa83e('0x5'))['db'];var utils=require(_0xa83e('0x6'));var logger=require(_0xa83e('0x7'))(_0xa83e('0x8'));var config=require(_0xa83e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa83e('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa83e('0xb')](config[_0xa83e('0xc')],{'host':_0xa83e('0xd'),'port':0x18eb});var socket=require(_0xa83e('0xe'))(new Redis(config['redis']));require(_0xa83e('0xf'))[_0xa83e('0x10')](socket);function respondWithRpcPromise(_0x5070d1,_0xf7e541,_0x379190){return new BPromise(function(_0x317631,_0x576a85){return client['request'](_0x5070d1,_0x379190)[_0xa83e('0x11')](function(_0x45594a){logger['info']('DashboardItem,\x20%s,\x20%s',_0xf7e541,'request\x20sent');logger[_0xa83e('0x12')](_0xa83e('0x13'),_0xf7e541,_0xa83e('0x14'),JSON['stringify'](_0x45594a));if(_0x45594a[_0xa83e('0x15')]){if(_0x45594a[_0xa83e('0x15')][_0xa83e('0x16')]===0x1f4){logger[_0xa83e('0x15')]('DashboardItem,\x20%s,\x20%s',_0xf7e541,_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);return _0x576a85(_0x45594a[_0xa83e('0x15')]['message']);}logger[_0xa83e('0x15')]('DashboardItem,\x20%s,\x20%s',_0xf7e541,_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);return _0x317631(_0x45594a[_0xa83e('0x15')][_0xa83e('0x17')]);}else{logger[_0xa83e('0x18')](_0xa83e('0x19'),_0xf7e541,_0xa83e('0x14'));_0x317631(_0x45594a['result'][_0xa83e('0x17')]);}})['catch'](function(_0x4b9f20){logger[_0xa83e('0x15')](_0xa83e('0x19'),_0xf7e541,_0x4b9f20);_0x576a85(_0x4b9f20);});});} \ No newline at end of file +var _0x8fdc=['jayson/promise','client','defaults','redis','localhost','./dashboardItem.socket','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8fdc,0x19a));var _0xc8fd=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8fdc[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require(_0xc8fd('0x0'));var moment=require(_0xc8fd('0x1'));var BPromise=require(_0xc8fd('0x2'));var rs=require(_0xc8fd('0x3'));var fs=require('fs');var Redis=require(_0xc8fd('0x4'));var db=require(_0xc8fd('0x5'))['db'];var utils=require(_0xc8fd('0x6'));var logger=require(_0xc8fd('0x7'))(_0xc8fd('0x8'));var config=require(_0xc8fd('0x9'));var jayson=require(_0xc8fd('0xa'));var client=jayson[_0xc8fd('0xb')]['http']({'port':0x232a});config['redis']=_[_0xc8fd('0xc')](config[_0xc8fd('0xd')],{'host':_0xc8fd('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8fd('0xf'))['register'](socket);function respondWithRpcPromise(_0x4ee4fe,_0x18012a,_0x455dec){return new BPromise(function(_0x166c73,_0x31ed24){return client[_0xc8fd('0x10')](_0x4ee4fe,_0x455dec)[_0xc8fd('0x11')](function(_0x148a48){logger['info'](_0xc8fd('0x12'),_0x18012a,_0xc8fd('0x13'));logger[_0xc8fd('0x14')](_0xc8fd('0x15'),_0x18012a,'request\x20sent',JSON[_0xc8fd('0x16')](_0x148a48));if(_0x148a48['error']){if(_0x148a48[_0xc8fd('0x17')]['code']===0x1f4){logger[_0xc8fd('0x17')](_0xc8fd('0x12'),_0x18012a,_0x148a48['error']['message']);return _0x31ed24(_0x148a48[_0xc8fd('0x17')][_0xc8fd('0x18')]);}logger[_0xc8fd('0x17')](_0xc8fd('0x12'),_0x18012a,_0x148a48[_0xc8fd('0x17')]['message']);return _0x166c73(_0x148a48[_0xc8fd('0x17')][_0xc8fd('0x18')]);}else{logger[_0xc8fd('0x19')]('DashboardItem,\x20%s,\x20%s',_0x18012a,'request\x20sent');_0x166c73(_0x148a48[_0xc8fd('0x1a')][_0xc8fd('0x18')]);}})[_0xc8fd('0x1b')](function(_0xec1ebe){logger[_0xc8fd('0x17')](_0xc8fd('0x12'),_0x18012a,_0xec1ebe);_0x31ed24(_0xec1ebe);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a7f5b07..dfcdd01 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 _0x5fb3=['length','./dashboardItem.events','save','update','emit','removeListener','register'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x5fb3,0x143));var _0x35fb=function(_0x15b77d,_0x1d0e76){_0x15b77d=_0x15b77d-0x0;var _0x34c983=_0x5fb3[_0x15b77d];return _0x34c983;};'use strict';var DashboardItemEvents=require(_0x35fb('0x0'));var events=[_0x35fb('0x1'),'remove',_0x35fb('0x2')];function createListener(_0x15377a,_0x15e4d3){return function(_0x169886){_0x15e4d3[_0x35fb('0x3')](_0x15377a,_0x169886);};}function removeListener(_0x2805eb,_0x2481d2){return function(){DashboardItemEvents[_0x35fb('0x4')](_0x2805eb,_0x2481d2);};}exports[_0x35fb('0x5')]=function(_0x48c786){for(var _0xbb2493=0x0,_0x307ad4=events[_0x35fb('0x6')];_0xbb2493<_0x307ad4;_0xbb2493++){var _0x5ee11d=events[_0xbb2493];var _0x159adf=createListener('dashboardItem:'+_0x5ee11d,_0x48c786);DashboardItemEvents['on'](_0x5ee11d,_0x159adf);}}; \ No newline at end of file +var _0x55ce=['emit','register','length','remove'];(function(_0x35af53,_0x5966b1){var _0x6bbbce=function(_0x3a79c0){while(--_0x3a79c0){_0x35af53['push'](_0x35af53['shift']());}};_0x6bbbce(++_0x5966b1);}(_0x55ce,0x14f));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xe55c('0x0'),'update'];function createListener(_0x5bf01b,_0x14f8cd){return function(_0xb95179){_0x14f8cd[_0xe55c('0x1')](_0x5bf01b,_0xb95179);};}function removeListener(_0x33bb53,_0x4b938d){return function(){DashboardItemEvents['removeListener'](_0x33bb53,_0x4b938d);};}exports[_0xe55c('0x2')]=function(_0x50d7a4){for(var _0x51b5e2=0x0,_0xf7e6ce=events[_0xe55c('0x3')];_0x51b5e2<_0xf7e6ce;_0x51b5e2++){var _0x43325a=events[_0x51b5e2];var _0xf6085=createListener('dashboardItem:'+_0x43325a,_0x50d7a4);DashboardItemEvents['on'](_0x43325a,_0xf6085);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4086903..9a553da 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 _0xd80d=['Router','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xd80d,0x72));var _0xdd80=function(_0x516fa9,_0x3d7f4c){_0x516fa9=_0x516fa9-0x0;var _0x4007a3=_0xd80d[_0x516fa9];return _0x4007a3;};'use strict';var multer=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var path=require(_0xdd80('0x2'));var timeout=require(_0xdd80('0x3'));var express=require(_0xdd80('0x4'));var router=express[_0xdd80('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd80('0x6'));var controller=require(_0xdd80('0x7'));router[_0xdd80('0x8')](_0xdd80('0x9'),auth[_0xdd80('0xa')](),controller['show']);router[_0xdd80('0xb')]('/',auth[_0xdd80('0xa')](),controller[_0xdd80('0xc')]);router[_0xdd80('0xd')](_0xdd80('0x9'),auth[_0xdd80('0xa')](),controller[_0xdd80('0xe')]);router[_0xdd80('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xdd80('0x10')]=router; \ No newline at end of file +var _0xb006=['show','post','create','update','delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated'];(function(_0x358eeb,_0x32e5d3){var _0x32e71d=function(_0x479615){while(--_0x479615){_0x358eeb['push'](_0x358eeb['shift']());}};_0x32e71d(++_0x32e5d3);}(_0xb006,0x122));var _0x6b00=function(_0x40c62b,_0x2c2efe){_0x40c62b=_0x40c62b-0x0;var _0x568cf0=_0xb006[_0x40c62b];return _0x568cf0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b00('0x0'));var timeout=require(_0x6b00('0x1'));var express=require('express');var router=express[_0x6b00('0x2')]();var fs_extra=require(_0x6b00('0x3'));var auth=require(_0x6b00('0x4'));var interaction=require(_0x6b00('0x5'));var config=require('../../config/environment');var controller=require(_0x6b00('0x6'));router[_0x6b00('0x7')](_0x6b00('0x8'),auth[_0x6b00('0x9')](),controller[_0x6b00('0xa')]);router[_0x6b00('0xb')]('/',auth[_0x6b00('0x9')](),controller[_0x6b00('0xc')]);router['put'](_0x6b00('0x8'),auth[_0x6b00('0x9')](),controller[_0x6b00('0xd')]);router[_0x6b00('0xe')]('/:id',auth[_0x6b00('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 7d81d29..5a2a8dc 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 _0xde78=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xde78,0xbe));var _0x8de7=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xde78[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x8de7('0x0'));module[_0x8de7('0x1')]={'name':{'type':Sequelize[_0x8de7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x8de7('0x3')](_0x8de7('0x4'),_0x8de7('0x5'),_0x8de7('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x8de7('0x2')]}}; \ No newline at end of file +var _0xcc76=['sequelize','exports','STRING','ENUM','first','second'];(function(_0xf4fd01,_0x40de62){var _0x321f94=function(_0x546f27){while(--_0x546f27){_0xf4fd01['push'](_0xf4fd01['shift']());}};_0x321f94(++_0x40de62);}(_0xcc76,0x108));var _0x6cc7=function(_0x444dfa,_0x6ed07c){_0x444dfa=_0x444dfa-0x0;var _0x3fcfc7=_0xcc76[_0x444dfa];return _0x3fcfc7;};'use strict';var Sequelize=require(_0x6cc7('0x0'));module[_0x6cc7('0x1')]={'name':{'type':Sequelize[_0x6cc7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6cc7('0x3')](_0x6cc7('0x4'),_0x6cc7('0x5'),'third'),'allowNull':![],'defaultValue':_0x6cc7('0x4')},'description':{'type':Sequelize[_0x6cc7('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 7ec0eba..338b7ca 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 _0x80d5=['UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','order','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Dispositions'];(function(_0x53b7df,_0xdd8632){var _0x384866=function(_0x768494){while(--_0x768494){_0x53b7df['push'](_0x53b7df['shift']());}};_0x384866(++_0xdd8632);}(_0x80d5,0x186));var _0x580d=function(_0x55bbd0,_0x12e624){_0x55bbd0=_0x55bbd0-0x0;var _0x4d44a6=_0x80d5[_0x55bbd0];return _0x4d44a6;};'use strict';var emlformat=require(_0x580d('0x0'));var rimraf=require(_0x580d('0x1'));var zipdir=require(_0x580d('0x2'));var jsonpatch=require(_0x580d('0x3'));var rp=require(_0x580d('0x4'));var moment=require(_0x580d('0x5'));var BPromise=require(_0x580d('0x6'));var Mustache=require(_0x580d('0x7'));var util=require(_0x580d('0x8'));var path=require(_0x580d('0x9'));var sox=require(_0x580d('0xa'));var csv=require(_0x580d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x580d('0xc'));var squel=require(_0x580d('0xd'));var crypto=require(_0x580d('0xe'));var jsforce=require(_0x580d('0xf'));var deskjs=require(_0x580d('0x10'));var toCsv=require(_0x580d('0xb'));var querystring=require(_0x580d('0x11'));var Papa=require(_0x580d('0x12'));var Redis=require(_0x580d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x580d('0x14'));var as=require(_0x580d('0x15'));var hardwareService=require(_0x580d('0x16'));var logger=require(_0x580d('0x17'))(_0x580d('0x18'));var utils=require(_0x580d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x580d('0x1a'));var db=require(_0x580d('0x1b'))['db'];function respondWithStatusCode(_0x48477b,_0x19b04b){_0x19b04b=_0x19b04b||0xcc;return function(_0x34355e){if(_0x34355e){return _0x48477b[_0x580d('0x1c')](_0x19b04b);}return _0x48477b[_0x580d('0x1d')](_0x19b04b)[_0x580d('0x1e')]();};}function respondWithResult(_0x184d3e,_0x37d6d2){_0x37d6d2=_0x37d6d2||0xc8;return function(_0x2f671f){if(_0x2f671f){return _0x184d3e['status'](_0x37d6d2)[_0x580d('0x1f')](_0x2f671f);}};}function respondWithFilteredResult(_0x3e0d4c,_0x2223ee){return function(_0x3915f4){if(_0x3915f4){var _0x1a6c19=typeof _0x2223ee[_0x580d('0x20')]===_0x580d('0x21')&&typeof _0x2223ee[_0x580d('0x22')]===_0x580d('0x21');var _0x4dff2e=_0x3915f4[_0x580d('0x23')];var _0x20946e=_0x1a6c19?0x0:_0x2223ee[_0x580d('0x20')];var _0x2c9a7c=_0x1a6c19?_0x3915f4['count']:_0x2223ee['offset']+_0x2223ee[_0x580d('0x22')];var _0x49f9d7;if(_0x2c9a7c>=_0x4dff2e){_0x2c9a7c=_0x4dff2e;_0x49f9d7=0xc8;}else{_0x49f9d7=0xce;}_0x3e0d4c['status'](_0x49f9d7);return _0x3e0d4c[_0x580d('0x24')](_0x580d('0x25'),_0x20946e+'-'+_0x2c9a7c+'/'+_0x4dff2e)[_0x580d('0x1f')](_0x3915f4);}return null;};}function patchUpdates(_0x1ddb26){return function(_0x1e670b){try{jsonpatch[_0x580d('0x26')](_0x1e670b,_0x1ddb26,!![]);}catch(_0x21be9e){return BPromise[_0x580d('0x27')](_0x21be9e);}return _0x1e670b[_0x580d('0x28')]();};}function saveUpdates(_0x1e4b1a,_0x28c976){return function(_0x51afa5){if(_0x51afa5){return _0x51afa5['update'](_0x1e4b1a)[_0x580d('0x29')](function(_0x2e66b4){return _0x2e66b4;});}return null;};}function removeEntity(_0x525b95,_0x4ec597){return function(_0x5c7641){if(_0x5c7641){return _0x5c7641[_0x580d('0x2a')]()[_0x580d('0x29')](function(){var _0x4e1dae=_0x5c7641[_0x580d('0x2b')]({'plain':!![]});var _0x3f8659=_0x580d('0x2c');return db[_0x580d('0x2d')]['destroy']({'where':{'type':_0x3f8659,'resourceId':_0x4e1dae['id']}})[_0x580d('0x29')](function(){return _0x5c7641;});})[_0x580d('0x29')](function(){_0x525b95['status'](0xcc)[_0x580d('0x1e')]();});}};}function handleEntityNotFound(_0x3362bb,_0x3a73e3){return function(_0x4de3a9){if(!_0x4de3a9){_0x3362bb[_0x580d('0x1c')](0x194);}return _0x4de3a9;};}function handleError(_0x36077d,_0x16cecd){_0x16cecd=_0x16cecd||0x1f4;return function(_0x266885){logger['error'](_0x266885[_0x580d('0x2e')]);if(_0x266885[_0x580d('0x2f')]){delete _0x266885[_0x580d('0x2f')];}_0x36077d[_0x580d('0x1d')](_0x16cecd)[_0x580d('0x30')](_0x266885);};}exports[_0x580d('0x31')]=function(_0x4846ea,_0x5dfe63){var _0x140a74={},_0x407984={},_0x75720={'count':0x0,'rows':[]};var _0x4953da=_[_0x580d('0x32')](db[_0x580d('0x33')][_0x580d('0x34')],function(_0x2be5e3){return{'name':_0x2be5e3['fieldName'],'type':_0x2be5e3[_0x580d('0x35')][_0x580d('0x36')]};});_0x407984['model']=_[_0x580d('0x32')](_0x4953da,'name');_0x407984[_0x580d('0x37')]=_[_0x580d('0x38')](_0x4846ea[_0x580d('0x37')]);_0x407984[_0x580d('0x39')]=_[_0x580d('0x3a')](_0x407984[_0x580d('0x3b')],_0x407984[_0x580d('0x37')]);_0x140a74[_0x580d('0x3c')]=_['intersection'](_0x407984[_0x580d('0x3b')],qs[_0x580d('0x3d')](_0x4846ea['query'][_0x580d('0x3d')]));_0x140a74[_0x580d('0x3c')]=_0x140a74[_0x580d('0x3c')][_0x580d('0x3e')]?_0x140a74['attributes']:_0x407984[_0x580d('0x3b')];if(!_0x4846ea['query']['hasOwnProperty']('nolimit')){_0x140a74[_0x580d('0x22')]=qs[_0x580d('0x22')](_0x4846ea[_0x580d('0x37')][_0x580d('0x22')]);_0x140a74[_0x580d('0x20')]=qs[_0x580d('0x20')](_0x4846ea[_0x580d('0x37')][_0x580d('0x20')]);}_0x140a74[_0x580d('0x3f')]=qs['sort'](_0x4846ea[_0x580d('0x37')]['sort']);_0x140a74['where']=qs[_0x580d('0x39')](_[_0x580d('0x40')](_0x4846ea[_0x580d('0x37')],_0x407984[_0x580d('0x39')]),_0x4953da);if(_0x4846ea['query']['filter']){_0x140a74[_0x580d('0x41')]=_['merge'](_0x140a74[_0x580d('0x41')],{'$or':_[_0x580d('0x32')](_0x4953da,function(_0x14358a){if(_0x14358a[_0x580d('0x35')]!==_0x580d('0x42')){var _0x226e2d={};_0x226e2d[_0x14358a['name']]={'$like':'%'+_0x4846ea[_0x580d('0x37')]['filter']+'%'};return _0x226e2d;}})});}_0x140a74=_[_0x580d('0x43')]({},_0x140a74,_0x4846ea[_0x580d('0x44')]);var _0x542be5={'where':_0x140a74[_0x580d('0x41')]};return db['Disposition']['count'](_0x542be5)['then'](function(_0x2e8cde){_0x75720[_0x580d('0x23')]=_0x2e8cde;if(_0x4846ea[_0x580d('0x37')][_0x580d('0x45')]){_0x140a74[_0x580d('0x46')]=[{'all':!![]}];}return db[_0x580d('0x33')][_0x580d('0x47')](_0x140a74);})[_0x580d('0x29')](function(_0xf7cdb5){_0x75720[_0x580d('0x48')]=_0xf7cdb5;return _0x75720;})[_0x580d('0x29')](respondWithFilteredResult(_0x5dfe63,_0x140a74))[_0x580d('0x49')](handleError(_0x5dfe63,null));};exports[_0x580d('0x4a')]=function(_0x4095bb,_0x53978){var _0x1a7bb2={'raw':!![],'where':{'id':_0x4095bb[_0x580d('0x4b')]['id']}},_0x4412ac={};_0x4412ac[_0x580d('0x3b')]=_[_0x580d('0x38')](db[_0x580d('0x33')][_0x580d('0x34')]);_0x4412ac['query']=_[_0x580d('0x38')](_0x4095bb[_0x580d('0x37')]);_0x4412ac[_0x580d('0x39')]=_[_0x580d('0x3a')](_0x4412ac['model'],_0x4412ac['query']);_0x1a7bb2[_0x580d('0x3c')]=_[_0x580d('0x3a')](_0x4412ac[_0x580d('0x3b')],qs[_0x580d('0x3d')](_0x4095bb[_0x580d('0x37')][_0x580d('0x3d')]));_0x1a7bb2[_0x580d('0x3c')]=_0x1a7bb2[_0x580d('0x3c')][_0x580d('0x3e')]?_0x1a7bb2[_0x580d('0x3c')]:_0x4412ac[_0x580d('0x3b')];if(_0x4095bb[_0x580d('0x37')]['includeAll']){_0x1a7bb2[_0x580d('0x46')]=[{'all':!![]}];}_0x1a7bb2=_[_0x580d('0x43')]({},_0x1a7bb2,_0x4095bb[_0x580d('0x44')]);return db[_0x580d('0x33')][_0x580d('0x4c')](_0x1a7bb2)[_0x580d('0x29')](handleEntityNotFound(_0x53978,null))['then'](respondWithResult(_0x53978,null))[_0x580d('0x49')](handleError(_0x53978,null));};exports[_0x580d('0x4d')]=function(_0x150444,_0xe6b1ad){return db['Disposition']['create'](_0x150444[_0x580d('0x4e')],{})[_0x580d('0x29')](function(_0x913aac){var _0x41b60a=_0x150444[_0x580d('0x4f')][_0x580d('0x2b')]({'plain':!![]});if(!_0x41b60a)throw new Error(_0x580d('0x50'));if(_0x41b60a['role']===_0x580d('0x4f')){var _0x18ce00=_0x913aac['get']({'plain':!![]});var _0x1619b3=_0x580d('0x2c');return db[_0x580d('0x51')][_0x580d('0x4c')]({'where':{'name':_0x1619b3,'userProfileId':_0x41b60a[_0x580d('0x52')]},'raw':!![]})[_0x580d('0x29')](function(_0x52594c){if(_0x52594c&&_0x52594c[_0x580d('0x53')]===0x0){return db['UserProfileResource'][_0x580d('0x4d')]({'name':_0x18ce00[_0x580d('0x2f')],'resourceId':_0x18ce00['id'],'type':_0x52594c['name'],'sectionId':_0x52594c['id']},{})['then'](function(){return _0x913aac;});}else{return _0x913aac;}})['catch'](function(_0x45ee78){logger[_0x580d('0x54')](_0x580d('0x55'),_0x45ee78);throw _0x45ee78;});}return _0x913aac;})['then'](respondWithResult(_0xe6b1ad,0xc9))['catch'](handleError(_0xe6b1ad,null));};exports[_0x580d('0x56')]=function(_0x180050,_0x356fcc){if(_0x180050[_0x580d('0x4e')]['id']){delete _0x180050[_0x580d('0x4e')]['id'];}return db['Disposition'][_0x580d('0x4c')]({'where':{'id':_0x180050[_0x580d('0x4b')]['id']}})[_0x580d('0x29')](handleEntityNotFound(_0x356fcc,null))[_0x580d('0x29')](saveUpdates(_0x180050['body'],null))[_0x580d('0x29')](respondWithResult(_0x356fcc,null))['catch'](handleError(_0x356fcc,null));};exports[_0x580d('0x2a')]=function(_0x304b6e,_0xdec5f){return db['Disposition']['find']({'where':{'id':_0x304b6e[_0x580d('0x4b')]['id']}})[_0x580d('0x29')](handleEntityNotFound(_0xdec5f,null))['then'](removeEntity(_0xdec5f,null))[_0x580d('0x49')](handleError(_0xdec5f,null));}; \ No newline at end of file +var _0x3b61=['options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','save','update','then','get','Dispositions','UserProfileResource','destroy','stack','name','send','index','map','Disposition','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL'];(function(_0x29184b,_0xb55b72){var _0x2fefd9=function(_0x598549){while(--_0x598549){_0x29184b['push'](_0x29184b['shift']());}};_0x2fefd9(++_0xb55b72);}(_0x3b61,0x67));var _0x13b6=function(_0x22cdb9,_0x869d6b){_0x22cdb9=_0x22cdb9-0x0;var _0x2ff544=_0x3b61[_0x22cdb9];return _0x2ff544;};'use strict';var emlformat=require(_0x13b6('0x0'));var rimraf=require(_0x13b6('0x1'));var zipdir=require(_0x13b6('0x2'));var jsonpatch=require(_0x13b6('0x3'));var rp=require(_0x13b6('0x4'));var moment=require(_0x13b6('0x5'));var BPromise=require(_0x13b6('0x6'));var Mustache=require(_0x13b6('0x7'));var util=require('util');var path=require(_0x13b6('0x8'));var sox=require(_0x13b6('0x9'));var csv=require(_0x13b6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b6('0xb'));var _=require(_0x13b6('0xc'));var squel=require(_0x13b6('0xd'));var crypto=require(_0x13b6('0xe'));var jsforce=require(_0x13b6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x13b6('0xa'));var querystring=require(_0x13b6('0x10'));var Papa=require(_0x13b6('0x11'));var Redis=require(_0x13b6('0x12'));var authService=require(_0x13b6('0x13'));var qs=require(_0x13b6('0x14'));var as=require(_0x13b6('0x15'));var hardwareService=require(_0x13b6('0x16'));var logger=require(_0x13b6('0x17'))(_0x13b6('0x18'));var utils=require(_0x13b6('0x19'));var config=require(_0x13b6('0x1a'));var licenseUtil=require(_0x13b6('0x1b'));var db=require(_0x13b6('0x1c'))['db'];function respondWithStatusCode(_0xa9c2d5,_0x51bfc9){_0x51bfc9=_0x51bfc9||0xcc;return function(_0x56e051){if(_0x56e051){return _0xa9c2d5[_0x13b6('0x1d')](_0x51bfc9);}return _0xa9c2d5[_0x13b6('0x1e')](_0x51bfc9)[_0x13b6('0x1f')]();};}function respondWithResult(_0x8425d4,_0xb6b2c3){_0xb6b2c3=_0xb6b2c3||0xc8;return function(_0x1770a5){if(_0x1770a5){return _0x8425d4[_0x13b6('0x1e')](_0xb6b2c3)[_0x13b6('0x20')](_0x1770a5);}};}function respondWithFilteredResult(_0x58326e,_0x556a01){return function(_0x3e7acb){if(_0x3e7acb){var _0x194d58=typeof _0x556a01[_0x13b6('0x21')]===_0x13b6('0x22')&&typeof _0x556a01['limit']===_0x13b6('0x22');var _0x24dbfb=_0x3e7acb['count'];var _0x3ac9b2=_0x194d58?0x0:_0x556a01[_0x13b6('0x21')];var _0x41bfc8=_0x194d58?_0x3e7acb['count']:_0x556a01[_0x13b6('0x21')]+_0x556a01['limit'];var _0xac6905;if(_0x41bfc8>=_0x24dbfb){_0x41bfc8=_0x24dbfb;_0xac6905=0xc8;}else{_0xac6905=0xce;}_0x58326e['status'](_0xac6905);return _0x58326e[_0x13b6('0x23')](_0x13b6('0x24'),_0x3ac9b2+'-'+_0x41bfc8+'/'+_0x24dbfb)['json'](_0x3e7acb);}return null;};}function patchUpdates(_0x3d077d){return function(_0x393cc3){try{jsonpatch[_0x13b6('0x25')](_0x393cc3,_0x3d077d,!![]);}catch(_0x4090d5){return BPromise['reject'](_0x4090d5);}return _0x393cc3[_0x13b6('0x26')]();};}function saveUpdates(_0xc91e2e,_0x1239c7){return function(_0xb38191){if(_0xb38191){return _0xb38191[_0x13b6('0x27')](_0xc91e2e)[_0x13b6('0x28')](function(_0x450caf){return _0x450caf;});}return null;};}function removeEntity(_0xc5e484,_0x3090d7){return function(_0x16471b){if(_0x16471b){return _0x16471b['destroy']()[_0x13b6('0x28')](function(){var _0x54aa3b=_0x16471b[_0x13b6('0x29')]({'plain':!![]});var _0x2ca6ec=_0x13b6('0x2a');return db[_0x13b6('0x2b')][_0x13b6('0x2c')]({'where':{'type':_0x2ca6ec,'resourceId':_0x54aa3b['id']}})[_0x13b6('0x28')](function(){return _0x16471b;});})[_0x13b6('0x28')](function(){_0xc5e484[_0x13b6('0x1e')](0xcc)[_0x13b6('0x1f')]();});}};}function handleEntityNotFound(_0x47a27a,_0x11d669){return function(_0x258f12){if(!_0x258f12){_0x47a27a[_0x13b6('0x1d')](0x194);}return _0x258f12;};}function handleError(_0x26f59b,_0x171acd){_0x171acd=_0x171acd||0x1f4;return function(_0x3a5b75){logger['error'](_0x3a5b75[_0x13b6('0x2d')]);if(_0x3a5b75[_0x13b6('0x2e')]){delete _0x3a5b75[_0x13b6('0x2e')];}_0x26f59b['status'](_0x171acd)[_0x13b6('0x2f')](_0x3a5b75);};}exports[_0x13b6('0x30')]=function(_0x23c6b7,_0xd40925){var _0x35d95a={},_0x5703c3={},_0x2fe151={'count':0x0,'rows':[]};var _0x39d9d0=_[_0x13b6('0x31')](db[_0x13b6('0x32')]['rawAttributes'],function(_0x3a5d8c){return{'name':_0x3a5d8c['fieldName'],'type':_0x3a5d8c['type']['key']};});_0x5703c3[_0x13b6('0x33')]=_[_0x13b6('0x31')](_0x39d9d0,_0x13b6('0x2e'));_0x5703c3[_0x13b6('0x34')]=_[_0x13b6('0x35')](_0x23c6b7['query']);_0x5703c3['filters']=_[_0x13b6('0x36')](_0x5703c3[_0x13b6('0x33')],_0x5703c3[_0x13b6('0x34')]);_0x35d95a['attributes']=_[_0x13b6('0x36')](_0x5703c3[_0x13b6('0x33')],qs['fields'](_0x23c6b7['query'][_0x13b6('0x37')]));_0x35d95a[_0x13b6('0x38')]=_0x35d95a['attributes']['length']?_0x35d95a[_0x13b6('0x38')]:_0x5703c3['model'];if(!_0x23c6b7['query'][_0x13b6('0x39')](_0x13b6('0x3a'))){_0x35d95a[_0x13b6('0x3b')]=qs[_0x13b6('0x3b')](_0x23c6b7[_0x13b6('0x34')]['limit']);_0x35d95a[_0x13b6('0x21')]=qs[_0x13b6('0x21')](_0x23c6b7['query']['offset']);}_0x35d95a[_0x13b6('0x3c')]=qs[_0x13b6('0x3d')](_0x23c6b7[_0x13b6('0x34')][_0x13b6('0x3d')]);_0x35d95a[_0x13b6('0x3e')]=qs[_0x13b6('0x3f')](_[_0x13b6('0x40')](_0x23c6b7[_0x13b6('0x34')],_0x5703c3[_0x13b6('0x3f')]),_0x39d9d0);if(_0x23c6b7['query'][_0x13b6('0x41')]){_0x35d95a['where']=_[_0x13b6('0x42')](_0x35d95a[_0x13b6('0x3e')],{'$or':_['map'](_0x39d9d0,function(_0x1324fb){if(_0x1324fb[_0x13b6('0x43')]!==_0x13b6('0x44')){var _0x34eac6={};_0x34eac6[_0x1324fb['name']]={'$like':'%'+_0x23c6b7['query'][_0x13b6('0x41')]+'%'};return _0x34eac6;}})});}_0x35d95a=_[_0x13b6('0x42')]({},_0x35d95a,_0x23c6b7[_0x13b6('0x45')]);var _0xff0419={'where':_0x35d95a[_0x13b6('0x3e')]};return db[_0x13b6('0x32')][_0x13b6('0x46')](_0xff0419)['then'](function(_0x4cfb40){_0x2fe151['count']=_0x4cfb40;if(_0x23c6b7['query'][_0x13b6('0x47')]){_0x35d95a[_0x13b6('0x48')]=[{'all':!![]}];}return db['Disposition'][_0x13b6('0x49')](_0x35d95a);})[_0x13b6('0x28')](function(_0x18c36b){_0x2fe151[_0x13b6('0x4a')]=_0x18c36b;return _0x2fe151;})[_0x13b6('0x28')](respondWithFilteredResult(_0xd40925,_0x35d95a))[_0x13b6('0x4b')](handleError(_0xd40925,null));};exports['show']=function(_0x18c3b1,_0x3675c8){var _0x1051d2={'raw':!![],'where':{'id':_0x18c3b1[_0x13b6('0x4c')]['id']}},_0x23c341={};_0x23c341[_0x13b6('0x33')]=_[_0x13b6('0x35')](db[_0x13b6('0x32')][_0x13b6('0x4d')]);_0x23c341[_0x13b6('0x34')]=_[_0x13b6('0x35')](_0x18c3b1[_0x13b6('0x34')]);_0x23c341[_0x13b6('0x3f')]=_[_0x13b6('0x36')](_0x23c341[_0x13b6('0x33')],_0x23c341[_0x13b6('0x34')]);_0x1051d2[_0x13b6('0x38')]=_['intersection'](_0x23c341[_0x13b6('0x33')],qs['fields'](_0x18c3b1[_0x13b6('0x34')]['fields']));_0x1051d2['attributes']=_0x1051d2['attributes']['length']?_0x1051d2['attributes']:_0x23c341[_0x13b6('0x33')];if(_0x18c3b1[_0x13b6('0x34')][_0x13b6('0x47')]){_0x1051d2['include']=[{'all':!![]}];}_0x1051d2=_[_0x13b6('0x42')]({},_0x1051d2,_0x18c3b1[_0x13b6('0x45')]);return db['Disposition'][_0x13b6('0x4e')](_0x1051d2)[_0x13b6('0x28')](handleEntityNotFound(_0x3675c8,null))[_0x13b6('0x28')](respondWithResult(_0x3675c8,null))[_0x13b6('0x4b')](handleError(_0x3675c8,null));};exports['create']=function(_0x277def,_0x576d97){return db[_0x13b6('0x32')]['create'](_0x277def['body'],{})[_0x13b6('0x28')](function(_0x1954e1){var _0x29ea9d=_0x277def['user'][_0x13b6('0x29')]({'plain':!![]});if(!_0x29ea9d)throw new Error(_0x13b6('0x4f'));if(_0x29ea9d[_0x13b6('0x50')]===_0x13b6('0x51')){var _0x467b10=_0x1954e1[_0x13b6('0x29')]({'plain':!![]});var _0x3ef113=_0x13b6('0x2a');return db[_0x13b6('0x52')][_0x13b6('0x4e')]({'where':{'name':_0x3ef113,'userProfileId':_0x29ea9d[_0x13b6('0x53')]},'raw':!![]})[_0x13b6('0x28')](function(_0x2125fb){if(_0x2125fb&&_0x2125fb[_0x13b6('0x54')]===0x0){return db[_0x13b6('0x2b')]['create']({'name':_0x467b10[_0x13b6('0x2e')],'resourceId':_0x467b10['id'],'type':_0x2125fb[_0x13b6('0x2e')],'sectionId':_0x2125fb['id']},{})[_0x13b6('0x28')](function(){return _0x1954e1;});}else{return _0x1954e1;}})[_0x13b6('0x4b')](function(_0x33ec2c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33ec2c);throw _0x33ec2c;});}return _0x1954e1;})['then'](respondWithResult(_0x576d97,0xc9))[_0x13b6('0x4b')](handleError(_0x576d97,null));};exports[_0x13b6('0x27')]=function(_0x5b7a3d,_0x107cdd){if(_0x5b7a3d[_0x13b6('0x55')]['id']){delete _0x5b7a3d['body']['id'];}return db[_0x13b6('0x32')][_0x13b6('0x4e')]({'where':{'id':_0x5b7a3d[_0x13b6('0x4c')]['id']}})[_0x13b6('0x28')](handleEntityNotFound(_0x107cdd,null))[_0x13b6('0x28')](saveUpdates(_0x5b7a3d[_0x13b6('0x55')],null))[_0x13b6('0x28')](respondWithResult(_0x107cdd,null))[_0x13b6('0x4b')](handleError(_0x107cdd,null));};exports[_0x13b6('0x2c')]=function(_0x6af2b4,_0xb45d83){return db[_0x13b6('0x32')][_0x13b6('0x4e')]({'where':{'id':_0x6af2b4['params']['id']}})[_0x13b6('0x28')](handleEntityNotFound(_0xb45d83,null))[_0x13b6('0x28')](removeEntity(_0xb45d83,null))[_0x13b6('0x4b')](handleError(_0xb45d83,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 724fea5..d2fa9a0 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 _0x4b9d=['define','Disposition','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x238b75,_0x389992){var _0x236aff=function(_0x44fece){while(--_0x44fece){_0x238b75['push'](_0x238b75['shift']());}};_0x236aff(++_0x389992);}(_0x4b9d,0x1c3));var _0xd4b9=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x4b9d[_0x7275e9];return _0x17b99d;};'use strict';var _=require(_0xd4b9('0x0'));var util=require(_0xd4b9('0x1'));var logger=require('../../config/logger')(_0xd4b9('0x2'));var moment=require(_0xd4b9('0x3'));var BPromise=require('bluebird');var rp=require(_0xd4b9('0x4'));var fs=require('fs');var path=require(_0xd4b9('0x5'));var rimraf=require(_0xd4b9('0x6'));var config=require(_0xd4b9('0x7'));var attributes=require('./disposition.attributes');module[_0xd4b9('0x8')]=function(_0x58e9f1,_0x3cd18c){return _0x58e9f1[_0xd4b9('0x9')](_0xd4b9('0xa'),attributes,{'tableName':_0xd4b9('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xd4b9('0xc'),_0xd4b9('0xd')]},{'unique':!![],'name':_0xd4b9('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xd4b9('0xf'),'fields':['name',_0xd4b9('0x10')]},{'unique':!![],'name':_0xd4b9('0x11'),'fields':[_0xd4b9('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xd4b9('0x12'),'fields':[_0xd4b9('0xc'),_0xd4b9('0x13')]},{'unique':!![],'name':_0xd4b9('0x14'),'fields':[_0xd4b9('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0xd4b9('0x15'),'fields':[_0xd4b9('0xc'),_0xd4b9('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacc1=['path','rimraf','./disposition.attributes','exports','define','tools_dispositions','name','ListId','name_chat','name_mail','MailAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','request-promise'];(function(_0x50696d,_0x274c7a){var _0x74d5c8=function(_0x377dc6){while(--_0x377dc6){_0x50696d['push'](_0x50696d['shift']());}};_0x74d5c8(++_0x274c7a);}(_0xacc1,0x187));var _0x1acc=function(_0x312bd5,_0xbed416){_0x312bd5=_0x312bd5-0x0;var _0x5c43bc=_0xacc1[_0x312bd5];return _0x5c43bc;};'use strict';var _=require(_0x1acc('0x0'));var util=require(_0x1acc('0x1'));var logger=require(_0x1acc('0x2'))(_0x1acc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1acc('0x4'));var fs=require('fs');var path=require(_0x1acc('0x5'));var rimraf=require(_0x1acc('0x6'));var config=require('../../config/environment');var attributes=require(_0x1acc('0x7'));module[_0x1acc('0x8')]=function(_0x5899c0,_0x2bf33c){return _0x5899c0[_0x1acc('0x9')]('Disposition',attributes,{'tableName':_0x1acc('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x1acc('0xb'),_0x1acc('0xc')]},{'unique':!![],'name':_0x1acc('0xd'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x1acc('0xe'),'fields':['name',_0x1acc('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x1acc('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x1acc('0xb'),_0x1acc('0x10')]},{'unique':!![],'name':_0x1acc('0x11'),'fields':[_0x1acc('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 87cfc33..af0edc7 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(_0x23540e,_0x7082fb){var _0x31ba8f=function(_0x3969b1){while(--_0x3969b1){_0x23540e['push'](_0x23540e['shift']());}};_0x31ba8f(++_0x7082fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0xf7f355,_0x497a8c){var _0x1faa66=function(_0x799954){while(--_0x799954){_0xf7f355['push'](_0xf7f355['shift']());}};_0x1faa66(++_0x497a8c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 0c34242..5d3bc9e 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 _0x43ad=['./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment'];(function(_0x149947,_0x34b5d6){var _0x1169c9=function(_0x53c932){while(--_0x53c932){_0x149947['push'](_0x149947['shift']());}};_0x1169c9(++_0x34b5d6);}(_0x43ad,0xd1));var _0xd43a=function(_0xbe694d,_0x3893d4){_0xbe694d=_0xbe694d-0x0;var _0x517acf=_0x43ad[_0xbe694d];return _0x517acf;};'use strict';var multer=require(_0xd43a('0x0'));var util=require(_0xd43a('0x1'));var path=require(_0xd43a('0x2'));var timeout=require(_0xd43a('0x3'));var express=require(_0xd43a('0x4'));var router=express[_0xd43a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd43a('0x6'));var controller=require(_0xd43a('0x7'));router['get']('/',auth[_0xd43a('0x8')](),controller[_0xd43a('0x9')]);router[_0xd43a('0xa')](_0xd43a('0xb'),auth[_0xd43a('0x8')](),controller[_0xd43a('0xc')]);router[_0xd43a('0xd')]('/',auth[_0xd43a('0x8')](),controller[_0xd43a('0xe')]);router['put'](_0xd43a('0xb'),auth[_0xd43a('0x8')](),controller[_0xd43a('0xf')]);router['delete']('/:id',auth[_0xd43a('0x8')](),controller[_0xd43a('0x10')]);module[_0xd43a('0x11')]=router; \ No newline at end of file +var _0xc844=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xc844,0x1d0));var _0x4c84=function(_0x167370,_0x457858){_0x167370=_0x167370-0x0;var _0x4ac979=_0xc844[_0x167370];return _0x4ac979;};'use strict';var multer=require(_0x4c84('0x0'));var util=require('util');var path=require(_0x4c84('0x1'));var timeout=require(_0x4c84('0x2'));var express=require(_0x4c84('0x3'));var router=express['Router']();var fs_extra=require(_0x4c84('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4c84('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x4c84('0x6')]('/',auth[_0x4c84('0x7')](),controller[_0x4c84('0x8')]);router[_0x4c84('0x6')](_0x4c84('0x9'),auth[_0x4c84('0x7')](),controller[_0x4c84('0xa')]);router[_0x4c84('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4c84('0xc')]('/:id',auth[_0x4c84('0x7')](),controller[_0x4c84('0xd')]);router[_0x4c84('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4c84('0xf')]);module[_0x4c84('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 31e13c4..03e87f1 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 _0xe856=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','14400','7200','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING'];(function(_0x464c67,_0x3cefd6){var _0x51b2a8=function(_0xca358c){while(--_0xca358c){_0x464c67['push'](_0x464c67['shift']());}};_0x51b2a8(++_0x3cefd6);}(_0xe856,0x1ae));var _0x6e85=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe856[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x6e85('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e85('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6e85('0x1')]},'ecm':{'type':Sequelize[_0x6e85('0x2')](_0x6e85('0x3'),'no'),'defaultValue':_0x6e85('0x3')},'headerinfo':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':_0x6e85('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x6e85('0x5')},'minrate':{'type':Sequelize[_0x6e85('0x2')](_0x6e85('0x6'),_0x6e85('0x7'),'7200',_0x6e85('0x8'),'12000',_0x6e85('0x9')),'defaultValue':_0x6e85('0x7')},'maxrate':{'type':Sequelize['ENUM']('2400','4800',_0x6e85('0xa'),_0x6e85('0x8'),_0x6e85('0xb'),_0x6e85('0x9')),'defaultValue':_0x6e85('0x9')},'modem':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':_0x6e85('0xc')},'gateway':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6e85('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6e85('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6e85('0xe'),_0x6e85('0xf'),_0x6e85('0x10'),_0x6e85('0x11')),'defaultValue':_0x6e85('0xe')},'key':{'type':Sequelize[_0x6e85('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6e85('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e85('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e85('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e85('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x6e85('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6e85('0x13')],'defaultValue':![],'comment':_0x6e85('0x15'),'set':function(_0x30baf0){if(!_0x30baf0)this[_0x6e85('0x16')]('mandatoryDispositionPauseId',null);this[_0x6e85('0x16')](_0x6e85('0x17'),_0x30baf0);}}}; \ No newline at end of file +var _0xe322=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','9600','12000','14400','4800','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x4f14b7,_0xed057d){var _0x1b03f0=function(_0x5f366c){while(--_0x5f366c){_0x4f14b7['push'](_0x4f14b7['shift']());}};_0x1b03f0(++_0xed057d);}(_0xe322,0xc6));var _0x2e32=function(_0x6ad15d,_0x24cb0b){_0x6ad15d=_0x6ad15d-0x0;var _0x24b9cb=_0xe322[_0x6ad15d];return _0x24b9cb;};'use strict';var Sequelize=require(_0x2e32('0x0'));module[_0x2e32('0x1')]={'name':{'type':Sequelize[_0x2e32('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2e32('0x2')]},'ecm':{'type':Sequelize[_0x2e32('0x3')](_0x2e32('0x4'),'no'),'defaultValue':_0x2e32('0x4')},'headerinfo':{'type':Sequelize[_0x2e32('0x2')],'defaultValue':_0x2e32('0x5')},'localstationid':{'type':Sequelize[_0x2e32('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x2e32('0x3')](_0x2e32('0x6'),'4800','7200',_0x2e32('0x7'),_0x2e32('0x8'),_0x2e32('0x9')),'defaultValue':_0x2e32('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x2e32('0x6'),_0x2e32('0xa'),_0x2e32('0xb'),'9600',_0x2e32('0x8'),_0x2e32('0x9')),'defaultValue':_0x2e32('0x9')},'modem':{'type':Sequelize[_0x2e32('0x2')],'defaultValue':_0x2e32('0xc')},'gateway':{'type':Sequelize[_0x2e32('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2e32('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2e32('0x3')](_0x2e32('0xe'),_0x2e32('0xf'),_0x2e32('0x10'),_0x2e32('0x11')),'defaultValue':_0x2e32('0xe')},'key':{'type':Sequelize[_0x2e32('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2e32('0x12')],'defaultValue':function(){return _0x2e32('0x13');}},'notificationSound':{'type':Sequelize[_0x2e32('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e32('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e32('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e32('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e32('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e32('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2e32('0x14')],'defaultValue':![],'comment':_0x2e32('0x15'),'set':function(_0x5e318a){if(!_0x5e318a)this[_0x2e32('0x16')](_0x2e32('0x17'),null);this[_0x2e32('0x16')](_0x2e32('0x18'),_0x5e318a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index cc8c1fb..1d3e454 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 _0xee5a=['emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','get','FaxAccounts','UserProfileResource','name','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','ids','omit','getInteractions','CmContact','Contact','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','from-voip-provider','exten','localstationid','app','description','appdata','push','Answer','Set','ecm','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','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','fax','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents'];(function(_0x1381d,_0x189e37){var _0x4715d6=function(_0x264a13){while(--_0x264a13){_0x1381d['push'](_0x1381d['shift']());}};_0x4715d6(++_0x189e37);}(_0xee5a,0xcf));var _0xaee5=function(_0xd7fdbd,_0x4e2759){_0xd7fdbd=_0xd7fdbd-0x0;var _0x5e71b5=_0xee5a[_0xd7fdbd];return _0x5e71b5;};'use strict';var emlformat=require(_0xaee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaee5('0x1'));var jsonpatch=require(_0xaee5('0x2'));var rp=require(_0xaee5('0x3'));var moment=require(_0xaee5('0x4'));var BPromise=require(_0xaee5('0x5'));var Mustache=require(_0xaee5('0x6'));var util=require(_0xaee5('0x7'));var path=require(_0xaee5('0x8'));var sox=require(_0xaee5('0x9'));var csv=require(_0xaee5('0xa'));var ejs=require(_0xaee5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaee5('0xc'));var squel=require(_0xaee5('0xd'));var crypto=require(_0xaee5('0xe'));var jsforce=require(_0xaee5('0xf'));var deskjs=require(_0xaee5('0x10'));var toCsv=require(_0xaee5('0xa'));var querystring=require(_0xaee5('0x11'));var Papa=require(_0xaee5('0x12'));var Redis=require('ioredis');var authService=require(_0xaee5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaee5('0x14'));var hardwareService=require(_0xaee5('0x15'));var logger=require(_0xaee5('0x16'))(_0xaee5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaee5('0x18'))['db'];config[_0xaee5('0x19')]=_[_0xaee5('0x1a')](config[_0xaee5('0x19')],{'host':_0xaee5('0x1b'),'port':0x18eb});var socket=require(_0xaee5('0x1c'))(new Redis(config[_0xaee5('0x19')]));require(_0xaee5('0x1d'))[_0xaee5('0x1e')](socket);var jayson=require(_0xaee5('0x1f'));var client=jayson[_0xaee5('0x20')][_0xaee5('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xaee5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1292f5,_0x303c73,_0x11a764,_0x34ea10){return new BPromise(function(_0x299008,_0x5e5ef4){var _0x3ec5d0=_0x34ea10||client;return _0x3ec5d0[_0xaee5('0x22')](_0x1292f5,_0x11a764)[_0xaee5('0x23')](function(_0x46df3d){logger[_0xaee5('0x24')](_0xaee5('0x25'),_0x303c73,_0xaee5('0x26'));logger[_0xaee5('0x27')](_0xaee5('0x28'),_0x303c73,'request\x20sent',JSON[_0xaee5('0x29')](_0x46df3d));if(_0x46df3d[_0xaee5('0x2a')]){if(_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2b')]===0x1f4){logger['error'](_0xaee5('0x25'),_0x303c73,_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);return _0x5e5ef4(_0x46df3d['error'][_0xaee5('0x2c')]);}logger['error'](_0xaee5('0x25'),_0x303c73,_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);return _0x299008(_0x46df3d[_0xaee5('0x2a')][_0xaee5('0x2c')]);}else{logger[_0xaee5('0x24')](_0xaee5('0x25'),_0x303c73,_0xaee5('0x26'));_0x299008(_0x46df3d[_0xaee5('0x2d')][_0xaee5('0x2c')]);}})['catch'](function(_0x4a7791){logger[_0xaee5('0x2a')](_0xaee5('0x25'),_0x303c73,_0x4a7791);_0x5e5ef4(_0x4a7791);});});}function respondWithStatusCode(_0x57c9d3,_0x17ad4b){_0x17ad4b=_0x17ad4b||0xcc;return function(_0x3300e3){if(_0x3300e3){return _0x57c9d3[_0xaee5('0x2e')](_0x17ad4b);}return _0x57c9d3[_0xaee5('0x2f')](_0x17ad4b)[_0xaee5('0x30')]();};}function respondWithResult(_0x34098e,_0x378e5b){_0x378e5b=_0x378e5b||0xc8;return function(_0x599b34){if(_0x599b34){return _0x34098e[_0xaee5('0x2f')](_0x378e5b)[_0xaee5('0x31')](_0x599b34);}};}function respondWithFilteredResult(_0x3568c5,_0x18e023){return function(_0x21b3b8){if(_0x21b3b8){var _0x2281c7=typeof _0x18e023[_0xaee5('0x32')]==='undefined'&&typeof _0x18e023[_0xaee5('0x33')]==='undefined';var _0xb06e51=_0x21b3b8[_0xaee5('0x34')];var _0x15e255=_0x2281c7?0x0:_0x18e023[_0xaee5('0x32')];var _0x5ef4d4=_0x2281c7?_0x21b3b8[_0xaee5('0x34')]:_0x18e023[_0xaee5('0x32')]+_0x18e023[_0xaee5('0x33')];var _0x47eedf;if(_0x5ef4d4>=_0xb06e51){_0x5ef4d4=_0xb06e51;_0x47eedf=0xc8;}else{_0x47eedf=0xce;}_0x3568c5['status'](_0x47eedf);return _0x3568c5[_0xaee5('0x35')](_0xaee5('0x36'),_0x15e255+'-'+_0x5ef4d4+'/'+_0xb06e51)[_0xaee5('0x31')](_0x21b3b8);}return null;};}function patchUpdates(_0x378526){return function(_0x487f65){try{jsonpatch['apply'](_0x487f65,_0x378526,!![]);}catch(_0x386160){return BPromise[_0xaee5('0x37')](_0x386160);}return _0x487f65[_0xaee5('0x38')]();};}function saveUpdates(_0x140ce8,_0x437788){return function(_0x3e6ece){if(_0x3e6ece){return _0x3e6ece[_0xaee5('0x39')](_0x140ce8)[_0xaee5('0x23')](function(_0x55f3a2){return _0x55f3a2;});}return null;};}function removeEntity(_0x1581f4,_0x3e397d){return function(_0x43c87d){if(_0x43c87d){return _0x43c87d['destroy']()[_0xaee5('0x23')](function(){var _0x5d8f69=_0x43c87d[_0xaee5('0x3a')]({'plain':!![]});var _0xf465b=_0xaee5('0x3b');return db[_0xaee5('0x3c')]['destroy']({'where':{'type':_0xf465b,'resourceId':_0x5d8f69['id']}})[_0xaee5('0x23')](function(){return _0x43c87d;});})[_0xaee5('0x23')](function(){_0x1581f4[_0xaee5('0x2f')](0xcc)[_0xaee5('0x30')]();});}};}function handleEntityNotFound(_0x81598,_0x5751cb){return function(_0x16be48){if(!_0x16be48){_0x81598['sendStatus'](0x194);}return _0x16be48;};}function handleError(_0x3604f4,_0x5761c7){_0x5761c7=_0x5761c7||0x1f4;return function(_0x17a773){logger[_0xaee5('0x2a')](_0x17a773['stack']);if(_0x17a773[_0xaee5('0x3d')]){delete _0x17a773[_0xaee5('0x3d')];}_0x3604f4['status'](_0x5761c7)['send'](_0x17a773);};}exports[_0xaee5('0x3e')]=function(_0x2e9a2b,_0x3db219){var _0x934e9f={'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]},_0x5c4e8f={},_0x1280bb={'count':0x0,'rows':[]};var _0x5170c9=_['map'](db[_0xaee5('0x40')][_0xaee5('0x41')],function(_0x2f6e8b){return{'name':_0x2f6e8b[_0xaee5('0x42')],'type':_0x2f6e8b['type'][_0xaee5('0x43')]};});_0x5c4e8f[_0xaee5('0x44')]=_[_0xaee5('0x45')](_0x5170c9,'name');_0x5c4e8f['query']=_[_0xaee5('0x46')](_0x2e9a2b[_0xaee5('0x47')]);_0x5c4e8f[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x5c4e8f[_0xaee5('0x44')],_0x5c4e8f[_0xaee5('0x47')]);_0x934e9f[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x5c4e8f['model'],qs['fields'](_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x934e9f[_0xaee5('0x4a')]=_0x934e9f['attributes'][_0xaee5('0x4c')]?_0x934e9f[_0xaee5('0x4a')]:_0x5c4e8f['model'];if(!_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x934e9f[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x33')]);_0x934e9f[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x2e9a2b[_0xaee5('0x47')]['offset']);}_0x934e9f[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x2e9a2b[_0xaee5('0x47')]['sort']);_0x934e9f['where']=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x2e9a2b[_0xaee5('0x47')],_0x5c4e8f[_0xaee5('0x48')]),_0x5170c9);if(_0x2e9a2b[_0xaee5('0x47')]['filter']){_0x934e9f[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x934e9f[_0xaee5('0x52')],{'$or':_['map'](_0x5170c9,function(_0x1a036f){if(_0x1a036f[_0xaee5('0x54')]!==_0xaee5('0x55')){var _0xe7a7ca={};_0xe7a7ca[_0x1a036f['name']]={'$like':'%'+_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0xe7a7ca;}})});}_0x934e9f=_[_0xaee5('0x53')]({},_0x934e9f,_0x2e9a2b['options']);var _0x33d8a3={'where':_0x934e9f[_0xaee5('0x52')]};return db[_0xaee5('0x40')][_0xaee5('0x34')](_0x33d8a3)['then'](function(_0x316b01){_0x1280bb[_0xaee5('0x34')]=_0x316b01;if(_0x2e9a2b[_0xaee5('0x47')][_0xaee5('0x57')]){_0x934e9f[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0x40')][_0xaee5('0x59')](_0x934e9f);})[_0xaee5('0x23')](function(_0x15c45a){_0x1280bb[_0xaee5('0x5a')]=_0x15c45a;return _0x1280bb;})[_0xaee5('0x23')](respondWithFilteredResult(_0x3db219,_0x934e9f))[_0xaee5('0x5b')](handleError(_0x3db219,null));};exports[_0xaee5('0x5c')]=function(_0x36cd5a,_0x3c5269){var _0x36a4d0={'raw':![],'where':{'id':_0x36cd5a[_0xaee5('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]},_0x313c90={};_0x313c90[_0xaee5('0x44')]=_['keys'](db[_0xaee5('0x40')][_0xaee5('0x41')]);_0x313c90[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x36cd5a['query']);_0x313c90[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x313c90[_0xaee5('0x44')],_0x313c90['query']);_0x36a4d0[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x313c90[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x36cd5a[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x36a4d0[_0xaee5('0x4a')]=_0x36a4d0[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x36a4d0[_0xaee5('0x4a')]:_0x313c90[_0xaee5('0x44')];if(_0x36cd5a[_0xaee5('0x47')][_0xaee5('0x57')]){_0x36a4d0[_0xaee5('0x58')]=[{'all':!![]}];}_0x36a4d0=_[_0xaee5('0x53')]({},_0x36a4d0,_0x36cd5a[_0xaee5('0x5e')]);return db[_0xaee5('0x40')][_0xaee5('0x5f')](_0x36a4d0)[_0xaee5('0x23')](handleEntityNotFound(_0x3c5269,null))[_0xaee5('0x23')](respondWithResult(_0x3c5269,null))[_0xaee5('0x5b')](handleError(_0x3c5269,null));};exports[_0xaee5('0x60')]=function(_0xbbf22a,_0x205595){return db[_0xaee5('0x40')]['create'](_0xbbf22a[_0xaee5('0x61')],{})['then'](function(_0x2dc13d){var _0x2567f6=_0xbbf22a['user'][_0xaee5('0x3a')]({'plain':!![]});if(!_0x2567f6)throw new Error(_0xaee5('0x62'));if(_0x2567f6[_0xaee5('0x63')]===_0xaee5('0x64')){var _0x570888=_0x2dc13d[_0xaee5('0x3a')]({'plain':!![]});var _0x2fafd5=_0xaee5('0x3b');return db['UserProfileSection'][_0xaee5('0x5f')]({'where':{'name':_0x2fafd5,'userProfileId':_0x2567f6[_0xaee5('0x65')]},'raw':!![]})['then'](function(_0x62dbf5){if(_0x62dbf5&&_0x62dbf5[_0xaee5('0x66')]===0x0){return db[_0xaee5('0x3c')][_0xaee5('0x60')]({'name':_0x570888[_0xaee5('0x3d')],'resourceId':_0x570888['id'],'type':_0x62dbf5[_0xaee5('0x3d')],'sectionId':_0x62dbf5['id']},{})['then'](function(){return _0x2dc13d;});}else{return _0x2dc13d;}})[_0xaee5('0x5b')](function(_0x2c56d4){logger[_0xaee5('0x2a')](_0xaee5('0x67'),_0x2c56d4);throw _0x2c56d4;});}return _0x2dc13d;})['then'](respondWithResult(_0x205595,0xc9))[_0xaee5('0x5b')](handleError(_0x205595,null));};exports[_0xaee5('0x39')]=function(_0x1eb721,_0x1eabf1){if(_0x1eb721['body']['id']){delete _0x1eb721[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1eb721[_0xaee5('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xaee5('0x3f')}]})['then'](handleEntityNotFound(_0x1eabf1,null))[_0xaee5('0x23')](saveUpdates(_0x1eb721[_0xaee5('0x61')],null))[_0xaee5('0x23')](respondWithResult(_0x1eabf1,null))[_0xaee5('0x5b')](handleError(_0x1eabf1,null));};exports[_0xaee5('0x68')]=function(_0x2450ac,_0x5a3bd8){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x2450ac[_0xaee5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5a3bd8,null))['then'](removeEntity(_0x5a3bd8,null))[_0xaee5('0x5b')](handleError(_0x5a3bd8,null));};exports['describe']=function(_0x3213d0,_0xac39f3){return db[_0xaee5('0x40')]['describe']()[_0xaee5('0x23')](respondWithResult(_0xac39f3,null))['catch'](handleError(_0xac39f3,null));};exports[_0xaee5('0x69')]=function(_0x40d5db,_0x240070,_0x39f0aa){if(_0x40d5db[_0xaee5('0x61')]['id']){delete _0x40d5db[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x40d5db[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x240070,null))['then'](function(_0x3ac585){if(_0x3ac585){_0x40d5db[_0xaee5('0x61')][_0xaee5('0x6a')]=_0x3ac585['id'];return db[_0xaee5('0x6b')]['create'](_0x40d5db['body']);}})['then'](respondWithResult(_0x240070,null))[_0xaee5('0x5b')](handleError(_0x240070,null));};exports[_0xaee5('0x6c')]=function(_0x3a38f3,_0x4cfa84,_0x35e1e6){var _0x543c30={'raw':![],'where':{}};var _0xc7bec7={};var _0x5060da={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x3a38f3[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x4cfa84,null))[_0xaee5('0x23')](function(_0x1789d6){if(_0x1789d6){_0xc7bec7[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0x6b')][_0xaee5('0x41')]);_0xc7bec7['query']=_['keys'](_0x3a38f3[_0xaee5('0x47')]);_0xc7bec7[_0xaee5('0x48')]=_['intersection'](_0xc7bec7[_0xaee5('0x44')],_0xc7bec7[_0xaee5('0x47')]);_0x543c30[_0xaee5('0x4a')]=_['intersection'](_0xc7bec7[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x543c30[_0xaee5('0x4a')]=_0x543c30[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x543c30['attributes']:_0xc7bec7[_0xaee5('0x44')];if(!_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x543c30[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x3a38f3['query'][_0xaee5('0x33')]);_0x543c30[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x3a38f3['query'][_0xaee5('0x32')]);}_0x543c30[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x50')]);_0x543c30['where']=qs['filters'](_['pick'](_0x3a38f3[_0xaee5('0x47')],_0xc7bec7['filters']));_0x543c30['where']['FaxAccountId']=_0x1789d6['id'];if(_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x56')]){_0x543c30['where']=_['merge'](_0x543c30[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x543c30['attributes'],function(_0x3a2c95){var _0x3e2e8b={};_0x3e2e8b[_0x3a2c95]={'$like':'%'+_0x3a38f3['query'][_0xaee5('0x56')]+'%'};return _0x3e2e8b;})});}_0x543c30=_[_0xaee5('0x53')]({},_0x543c30,_0x3a38f3[_0xaee5('0x5e')]);return db[_0xaee5('0x6b')][_0xaee5('0x34')]({'where':_0x543c30[_0xaee5('0x52')]})['then'](function(_0x3c3d5c){_0x5060da[_0xaee5('0x34')]=_0x3c3d5c;if(_0x3a38f3[_0xaee5('0x47')][_0xaee5('0x57')]){_0x543c30['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x543c30);})[_0xaee5('0x23')](function(_0x1c602d){_0x5060da[_0xaee5('0x5a')]=_0x1c602d;return _0x5060da;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x4cfa84,_0x543c30))[_0xaee5('0x5b')](handleError(_0x4cfa84,null));};exports[_0xaee5('0x6e')]=function(_0x51e64d,_0x4208f5,_0xd6711f){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x51e64d[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x4208f5,null))[_0xaee5('0x23')](function(_0x5a2304){if(_0x5a2304){return _0x5a2304[_0xaee5('0x6e')](_0x51e64d['query']['ids']);}})[_0xaee5('0x23')](respondWithStatusCode(_0x4208f5,null))['catch'](handleError(_0x4208f5,null));};exports[_0xaee5('0x6f')]=function(_0x1431a3,_0x28d60e,_0x1c4a97){if(_0x1431a3[_0xaee5('0x61')]['id']){delete _0x1431a3[_0xaee5('0x61')]['id'];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1431a3['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x28d60e,null))[_0xaee5('0x23')](function(_0x48adeb){if(_0x48adeb){_0x1431a3[_0xaee5('0x61')][_0xaee5('0x6a')]=_0x48adeb['id'];return db[_0xaee5('0x70')][_0xaee5('0x60')](_0x1431a3[_0xaee5('0x61')]);}})[_0xaee5('0x23')](respondWithResult(_0x28d60e,null))[_0xaee5('0x5b')](handleError(_0x28d60e,null));};exports['getAnswers']=function(_0x19c055,_0x24e1a1,_0x553fb9){var _0x2697a2={'raw':![],'where':{}};var _0x3cb5f7={};var _0x448cb1={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x19c055['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x24e1a1,null))[_0xaee5('0x23')](function(_0x15b771){if(_0x15b771){_0x3cb5f7[_0xaee5('0x44')]=_[_0xaee5('0x46')](db['CannedAnswer']['rawAttributes']);_0x3cb5f7[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x19c055[_0xaee5('0x47')]);_0x3cb5f7[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x3cb5f7[_0xaee5('0x44')],_0x3cb5f7[_0xaee5('0x47')]);_0x2697a2[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x3cb5f7[_0xaee5('0x44')],qs['fields'](_0x19c055[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x2697a2[_0xaee5('0x4a')]=_0x2697a2[_0xaee5('0x4a')]['length']?_0x2697a2[_0xaee5('0x4a')]:_0x3cb5f7[_0xaee5('0x44')];if(!_0x19c055[_0xaee5('0x47')][_0xaee5('0x4d')]('nolimit')){_0x2697a2[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x19c055[_0xaee5('0x47')][_0xaee5('0x33')]);_0x2697a2[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x19c055[_0xaee5('0x47')]['offset']);}_0x2697a2[_0xaee5('0x4f')]=qs['sort'](_0x19c055['query'][_0xaee5('0x50')]);_0x2697a2['where']=qs['filters'](_[_0xaee5('0x51')](_0x19c055['query'],_0x3cb5f7['filters']));_0x2697a2[_0xaee5('0x52')]['FaxAccountId']=_0x15b771['id'];if(_0x19c055[_0xaee5('0x47')][_0xaee5('0x56')]){_0x2697a2['where']=_[_0xaee5('0x53')](_0x2697a2[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x2697a2['attributes'],function(_0x615e67){var _0x10784d={};_0x10784d[_0x615e67]={'$like':'%'+_0x19c055[_0xaee5('0x47')]['filter']+'%'};return _0x10784d;})});}_0x2697a2=_[_0xaee5('0x53')]({},_0x2697a2,_0x19c055[_0xaee5('0x5e')]);return db[_0xaee5('0x70')][_0xaee5('0x34')]({'where':_0x2697a2[_0xaee5('0x52')]})['then'](function(_0x1cf88e){_0x448cb1[_0xaee5('0x34')]=_0x1cf88e;if(_0x19c055[_0xaee5('0x47')][_0xaee5('0x57')]){_0x2697a2[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0x70')][_0xaee5('0x59')](_0x2697a2);})['then'](function(_0x4f3a1c){_0x448cb1['rows']=_0x4f3a1c;return _0x448cb1;});}})['then'](respondWithFilteredResult(_0x24e1a1,_0x2697a2))['catch'](handleError(_0x24e1a1,null));};exports['removeAnswers']=function(_0x141e3a,_0x28efd0,_0x7522ef){return db[_0xaee5('0x40')]['find']({'where':{'id':_0x141e3a['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x28efd0,null))[_0xaee5('0x23')](function(_0x1320d7){if(_0x1320d7){return _0x1320d7[_0xaee5('0x71')](_0x141e3a[_0xaee5('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x28efd0,null))['catch'](handleError(_0x28efd0,null));};exports[_0xaee5('0x72')]=function(_0x18cfff,_0x467d3f,_0x22bf0a){return db[_0xaee5('0x73')]['find']({'where':{'id':_0x18cfff[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x467d3f,null))[_0xaee5('0x23')](function(_0x1acb96){if(_0x1acb96){return _0x1acb96[_0xaee5('0x72')](_0x18cfff[_0xaee5('0x61')][_0xaee5('0x74')],_[_0xaee5('0x75')](_0x18cfff[_0xaee5('0x61')],['ids','id'])||{});}})[_0xaee5('0x23')](respondWithResult(_0x467d3f,null))[_0xaee5('0x5b')](handleError(_0x467d3f,null));};exports[_0xaee5('0x76')]=function(_0x32cd7b,_0x7ac540,_0x37da1a){var _0x5803d4={'raw':![],'where':{}};var _0x771b86={};var _0x5111e3={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x32cd7b[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x7ac540,null))[_0xaee5('0x23')](function(_0x5bb932){if(_0x5bb932){_0x771b86[_0xaee5('0x44')]=_['keys'](db[_0xaee5('0x73')]['rawAttributes']);_0x771b86[_0xaee5('0x47')]=_['keys'](_0x32cd7b[_0xaee5('0x47')]);_0x771b86[_0xaee5('0x48')]=_['intersection'](_0x771b86[_0xaee5('0x44')],_0x771b86[_0xaee5('0x47')]);_0x5803d4[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x771b86[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x5803d4['attributes']=_0x5803d4[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x5803d4['attributes']:_0x771b86[_0xaee5('0x44')];if(!_0x32cd7b[_0xaee5('0x47')]['hasOwnProperty'](_0xaee5('0x4e'))){_0x5803d4[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x32cd7b[_0xaee5('0x47')]['limit']);_0x5803d4[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x32cd7b['query'][_0xaee5('0x32')]);}_0x5803d4[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x50')]);_0x5803d4['where']=qs[_0xaee5('0x48')](_['pick'](_0x32cd7b[_0xaee5('0x47')],_0x771b86['filters']));_0x5803d4[_0xaee5('0x52')][_0xaee5('0x6a')]=_0x5bb932['id'];if(_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x56')]){_0x5803d4[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x5803d4[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x5803d4[_0xaee5('0x4a')],function(_0x5be22e){var _0x6d0871={};_0x6d0871[_0x5be22e]={'$like':'%'+_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0x6d0871;})});}_0x5803d4=_[_0xaee5('0x53')]({},_0x5803d4,_0x32cd7b[_0xaee5('0x5e')]);return db[_0xaee5('0x73')][_0xaee5('0x34')]({'where':_0x5803d4[_0xaee5('0x52')]})['then'](function(_0x3231fc){_0x5111e3[_0xaee5('0x34')]=_0x3231fc;if(_0x32cd7b['query'][_0xaee5('0x57')]){_0x5803d4[_0xaee5('0x58')]=[{'model':db[_0xaee5('0x77')],'as':_0xaee5('0x78'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xaee5('0x3d'),'fullname','internal'],'required':![]},{'model':db[_0xaee5('0x79')],'as':'Tags','attributes':['id',_0xaee5('0x3d'),_0xaee5('0x7a')],'where':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]?{'id':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]}:undefined,'required':_0x32cd7b[_0xaee5('0x47')][_0xaee5('0x7b')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5803d4);})[_0xaee5('0x23')](function(_0xbe3b68){_0x5111e3[_0xaee5('0x5a')]=_0xbe3b68;return _0x5111e3;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x7ac540,_0x5803d4))[_0xaee5('0x5b')](handleError(_0x7ac540,null));};exports[_0xaee5('0x7c')]=function(_0x47e3c5,_0x50c04e){var _0x1d6d92=_0x47e3c5['params']['id'];var _0x36b014=_0x47e3c5['body'];var _0x357bf1=0xc8;var _0x12888d=null;return db[_0xaee5('0x7d')]['transaction']({'isolationLevel':db[_0xaee5('0x7d')][_0xaee5('0x7e')][_0xaee5('0x7f')]['READ_COMMITTED']},function(_0x43dec8){return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x1d6d92},'transaction':_0x43dec8})['then'](function(_0x77251){if(_0x77251){return db[_0xaee5('0x80')][_0xaee5('0x68')]({'where':{'FaxAccountId':_0x1d6d92},'transaction':_0x43dec8})[_0xaee5('0x23')](function(){var _0x4eef4d=_[_0xaee5('0x45')](_0x36b014,function(_0x344305){_0x344305['FaxAccountId']=_0x1d6d92;return _0x344305;});return db[_0xaee5('0x80')][_0xaee5('0x81')](_0x4eef4d,{'transaction':_0x43dec8});});}else{_0x357bf1=0x194;_0x12888d=[];}});})['then'](function(){if(_0x357bf1!==0x194){return db[_0xaee5('0x80')][_0xaee5('0x82')]({'where':{'FaxAccountId':_0x1d6d92},'order':_0xaee5('0x83')})[_0xaee5('0x23')](function(_0x19c575){_0x12888d=_0x19c575;});}})[_0xaee5('0x5b')](function(_0x14a1a9){_0x357bf1=0x1f4;logger[_0xaee5('0x2a')](_0x14a1a9[_0xaee5('0x84')]);if(_0x14a1a9[_0xaee5('0x3d')]){delete _0x14a1a9['name'];}_0x12888d=_0x14a1a9;})[_0xaee5('0x85')](function(){if(_0x12888d===null){_0x50c04e[_0xaee5('0x2e')](_0x357bf1);}else{if(_0x357bf1===0x1f4){_0x50c04e[_0xaee5('0x2f')](_0x357bf1)[_0xaee5('0x86')](_0x12888d);}else{_0x50c04e[_0xaee5('0x2f')](_0x357bf1)[_0xaee5('0x31')](_0x12888d);}}});};exports[_0xaee5('0x87')]=function(_0x48bc76,_0x581e40,_0x5ecac9){var _0xc5242d={};var _0x4e0565={};var _0x49f44e;var _0x3c9fe3;return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x48bc76['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x581e40,null))[_0xaee5('0x23')](function(_0x40cf6c){if(_0x40cf6c){_0x49f44e=_0x40cf6c;_0x4e0565[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0x80')][_0xaee5('0x41')]);_0x4e0565[_0xaee5('0x47')]=_['keys'](_0x48bc76['query']);_0x4e0565[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x4e0565[_0xaee5('0x44')],_0x4e0565[_0xaee5('0x47')]);_0xc5242d[_0xaee5('0x4a')]=_[_0xaee5('0x49')](_0x4e0565['model'],qs['fields'](_0x48bc76[_0xaee5('0x47')]['fields']));_0xc5242d[_0xaee5('0x4a')]=_0xc5242d[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0xc5242d[_0xaee5('0x4a')]:_0x4e0565['model'];_0xc5242d[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x48bc76[_0xaee5('0x47')]['sort']);_0xc5242d[_0xaee5('0x52')]=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x48bc76['query'],_0x4e0565[_0xaee5('0x48')]));if(_0x48bc76[_0xaee5('0x47')][_0xaee5('0x56')]){_0xc5242d['where']=_[_0xaee5('0x53')](_0xc5242d['where'],{'$or':_[_0xaee5('0x45')](_0xc5242d[_0xaee5('0x4a')],function(_0x144573){var _0x9f3cca={};_0x9f3cca[_0x144573]={'$like':'%'+_0x48bc76['query'][_0xaee5('0x56')]+'%'};return _0x9f3cca;})});}_0xc5242d=_['merge']({},_0xc5242d,_0x48bc76[_0xaee5('0x5e')]);return _0x49f44e[_0xaee5('0x87')](_0xc5242d);}})['then'](function(_0x3c90b9){if(_0x3c90b9){_0x3c9fe3=_0x3c90b9['length'];if(!_0x48bc76[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0xc5242d[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x48bc76[_0xaee5('0x47')][_0xaee5('0x33')]);_0xc5242d['offset']=qs['offset'](_0x48bc76[_0xaee5('0x47')][_0xaee5('0x32')]);}return _0x49f44e[_0xaee5('0x87')](_0xc5242d);}})['then'](function(_0xac989){if(_0xac989){return _0xac989?{'count':_0x3c9fe3,'rows':_0xac989}:null;}})['then'](respondWithResult(_0x581e40,null))['catch'](handleError(_0x581e40,null));};function Extension(_0x2e857e,_0x48ac50,_0x4e8a08,_0xd065d1){this['context']=_0xaee5('0x88');this[_0xaee5('0x89')]=_0x2e857e[_0xaee5('0x8a')];this[_0xaee5('0x8b')]=_0xd065d1;this[_0xaee5('0x54')]='system';this[_0xaee5('0x8c')]='Fax\x20Extension';this['FaxAccountId']=_0x2e857e['id'];this[_0xaee5('0x83')]=_0x48ac50;this[_0xaee5('0x8d')]=_0x4e8a08;}function createExtensionsReciveFax(_0x5391ef){var _0xa0e65=0x1;var _0x466165=[];_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'',_0xaee5('0x8f')));_0xa0e65+=0x1;_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'CDR(type)=inbound-fax',_0xaee5('0x90')));_0xa0e65+=0x1;for(var _0x187eee in _0x5391ef){if(_0x5391ef[_0xaee5('0x4d')](_0x187eee)&&(_0x187eee===_0xaee5('0x91')||_0x187eee===_0xaee5('0x8a')||_0x187eee==='gateway'||_0x187eee===_0xaee5('0x92')||_0x187eee===_0xaee5('0x93')||_0x187eee===_0xaee5('0x94')||_0x187eee===_0xaee5('0x95')||_0x187eee===_0xaee5('0x96')||_0x187eee===_0xaee5('0x97'))){_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,_0xaee5('0x98')+_0x187eee+')='+_0x5391ef[_0x187eee],_0xaee5('0x90')));_0xa0e65+=0x1;}}_0x466165[_0xaee5('0x8e')](new Extension(_0x5391ef,_0xa0e65,'6',_0xaee5('0x99')));_0xa0e65+=0x1;_0x466165['push'](new Extension(_0x5391ef,_0xa0e65,_0xaee5('0x9a'),_0xaee5('0x9b')));_0xa0e65=0x0;return _0x466165;}exports[_0xaee5('0x9c')]=function(_0xcf9dcf,_0x3ea13e,_0x54159e){var _0x2c35a2;return db[_0xaee5('0x7d')]['transaction'](function(_0xcecb0){return db[_0xaee5('0x40')]['create'](_0xcf9dcf[_0xaee5('0x61')],{'transaction':_0xcecb0})[_0xaee5('0x23')](function(_0x4aeba6){_0x2c35a2=_0x4aeba6[_0xaee5('0x3a')]({'plain':!![]});return db[_0xaee5('0x9d')][_0xaee5('0x81')](createExtensionsReciveFax(_0x2c35a2),{'transaction':_0xcecb0});});})[_0xaee5('0x23')](function(){return _0x2c35a2;})['then'](respondWithResult(_0x3ea13e,null))['catch'](handleError(_0x3ea13e,null));};exports[_0xaee5('0x9e')]=function(_0x514424,_0x5ca5c3,_0x4b0ab0){var _0x56cade;return db[_0xaee5('0x7d')]['transaction'](function(_0x46fd35){return db[_0xaee5('0x40')]['update'](_0x514424['body'],{'where':{'id':_0x514424[_0xaee5('0x61')]['id']},'transaction':_0x46fd35})[_0xaee5('0x23')](function(_0x514696){return db[_0xaee5('0x9d')][_0xaee5('0x68')]({'where':{'FaxAccountId':_0x514424[_0xaee5('0x61')]['id']},'transaction':_0x46fd35})['then'](function(_0x134dd9){return db[_0xaee5('0x9d')][_0xaee5('0x81')](createExtensionsReciveFax(_[_0xaee5('0x75')](_0x514424['body'],[_0xaee5('0x9f'),_0xaee5('0x43'),_0xaee5('0xa0'),_0xaee5('0xa1'),_0xaee5('0xa2'),_0xaee5('0xa3')])),{'transaction':_0x46fd35});});});})['then'](function(){return db[_0xaee5('0x40')][_0xaee5('0xa4')](_0x514424[_0xaee5('0x61')]['id']);})[_0xaee5('0x23')](respondWithResult(_0x5ca5c3,null))[_0xaee5('0x5b')](handleError(_0x5ca5c3,null));};exports[_0xaee5('0xa5')]=function(_0x136e3d,_0x22632b,_0x50b334){var _0x1324bf={'raw':!![],'where':{}};var _0x3e3935={};var _0x56a269={'count':0x0,'rows':[]};return db[_0xaee5('0x40')][_0xaee5('0x6d')]({'where':{'id':_0x136e3d[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x22632b,null))[_0xaee5('0x23')](function(_0x2eb719){if(_0x2eb719){_0x3e3935[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0xa6')]['rawAttributes']);_0x3e3935['query']=_[_0xaee5('0x46')](_0x136e3d['query']);_0x3e3935[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x3e3935['model'],_0x3e3935[_0xaee5('0x47')]);_0x1324bf[_0xaee5('0x4a')]=_['intersection'](_0x3e3935[_0xaee5('0x44')],qs[_0xaee5('0x4b')](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x4b')]));_0x1324bf['attributes']=_0x1324bf[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x1324bf[_0xaee5('0x4a')]:_0x3e3935[_0xaee5('0x44')];if(!_0x136e3d[_0xaee5('0x47')][_0xaee5('0x4d')]('nolimit')){_0x1324bf[_0xaee5('0x33')]=qs['limit'](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x33')]);_0x1324bf[_0xaee5('0x32')]=qs['offset'](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x32')]);}_0x1324bf[_0xaee5('0x4f')]=qs[_0xaee5('0x50')](_0x136e3d[_0xaee5('0x47')][_0xaee5('0x50')]);_0x1324bf[_0xaee5('0x52')]=qs[_0xaee5('0x48')](_[_0xaee5('0x51')](_0x136e3d[_0xaee5('0x47')],_0x3e3935[_0xaee5('0x48')]));_0x1324bf[_0xaee5('0x52')][_0xaee5('0x6a')]=_0x2eb719['id'];if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0x56')]){_0x1324bf[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x1324bf[_0xaee5('0x52')],{'$or':_[_0xaee5('0x45')](_0x1324bf[_0xaee5('0x4a')],function(_0x1cbdac){var _0xa9de79={};_0xa9de79[_0x1cbdac]={'$like':'%'+_0x136e3d[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0xa9de79;})});}if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0xa7')]){var _0x5224ed=_0x136e3d[_0xaee5('0x47')]['$gte'][_0xaee5('0xa8')](',');var _0x349003={};_0x349003[_0x5224ed[0x0]]={'$gte':moment(_0x5224ed[0x1])[_0xaee5('0xa9')](_0xaee5('0xaa'))};_0x1324bf[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x1324bf['where'],_0x349003);}_0x1324bf=_['merge']({},_0x1324bf,_0x136e3d[_0xaee5('0x5e')]);return db[_0xaee5('0xa6')][_0xaee5('0x34')]({'where':_0x1324bf['where']})[_0xaee5('0x23')](function(_0x174b16){_0x56a269[_0xaee5('0x34')]=_0x174b16;if(_0x136e3d[_0xaee5('0x47')][_0xaee5('0x57')]){_0x1324bf[_0xaee5('0x58')]=[{'all':!![]}];}return db[_0xaee5('0xa6')][_0xaee5('0x59')](_0x1324bf);})['then'](function(_0x6058e3){_0x56a269[_0xaee5('0x5a')]=_0x6058e3;return _0x56a269;});}})[_0xaee5('0x23')](respondWithFilteredResult(_0x22632b,_0x1324bf))[_0xaee5('0x5b')](handleError(_0x22632b,null));};exports['send']=function(_0x5aa9d5,_0x45fe22,_0x203ab9){var _0x3d56df,_0x31acaa={},_0x59580e;if(_0x5aa9d5[_0xaee5('0x61')]['to']){_0x59580e=_0x5aa9d5['body']['to'][0x0];}return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x5aa9d5[_0xaee5('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xaee5('0xab'),'include':[{'model':db[_0xaee5('0x77')],'as':_0xaee5('0xac'),'where':{'fax':_0x59580e},'limit':0x1,'order':[[_0xaee5('0xa1'),_0xaee5('0xad')]]}]}]})[_0xaee5('0x23')](handleEntityNotFound(_0x45fe22,null))[_0xaee5('0x23')](function(_0xc46e64){_0x3d56df=_0xc46e64;if(_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')]&&_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0xaee5('0x4c')]){for(var _0x35fc8c=0x0;_0x35fc8c<_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0xaee5('0x4c')];_0x35fc8c+=0x1){_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0x35fc8c]={'filename':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][_0x35fc8c]['name'],'id':_0x5aa9d5['body'][_0xaee5('0xae')][_0x35fc8c]['id'],'path':path[_0xaee5('0xaf')](config[_0xaee5('0xb0')],_0xaee5('0xb1'),_0x5aa9d5[_0xaee5('0x61')]['attachments'][_0x35fc8c]['basename'])};}}return respondWithRpcPromise(_0xaee5('0xb2'),_0xaee5('0xb2'),{'FaxAccountId':_['isNil'](_0x5aa9d5[_0xaee5('0x5d')]['id'])?undefined:_0x5aa9d5[_0xaee5('0x5d')]['id'],'path':_[_0xaee5('0xb3')](_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')])?undefined:_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')],'fax':_[_0xaee5('0xb3')](_0x5aa9d5['body']['to'][0x0])?undefined:_0x5aa9d5['body']['to'][0x0]},client9002);})[_0xaee5('0x23')](function(){if(_0x3d56df){if(_[_0xaee5('0xb3')](_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xb4')])){_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xb4')]=util['format']('\x22%s\x22\x20<%s>',_0x3d56df[_0xaee5('0x3d')],_0x3d56df[_0xaee5('0xb5')]);}if(_0x3d56df[_0xaee5('0xab')]){if(_0x3d56df[_0xaee5('0xab')]['Contacts'][_0xaee5('0x4c')]){return _0x3d56df[_0xaee5('0xab')][_0xaee5('0xac')][0x0];}else{return db[_0xaee5('0x77')][_0xaee5('0x60')](_[_0xaee5('0x1a')](_0x5aa9d5['body'],{'firstName':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'phone':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'fax':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'ListId':_0x3d56df[_0xaee5('0xa3')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xaee5('0xb6'));}})[_0xaee5('0x23')](function(_0x470136){if(_0x470136){return db[_0xaee5('0x73')][_0xaee5('0x5f')]({'where':{'ContactId':_0x470136['id'],'closed':![],'FaxAccountId':_0x3d56df['id']}})[_0xaee5('0x23')](function(_0xa8b6){if(_0xa8b6){return[_0xa8b6,![]];}return db[_0xaee5('0x73')][_0xaee5('0x60')]({'UserId':_0x5aa9d5[_0xaee5('0x64')]['id'],'ContactId':_0x470136['id'],'FaxAccountId':_0x3d56df['id'],'fax':_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'firstMsgDirection':_0xaee5('0xb7'),'Messages':[_['merge'](_0x5aa9d5[_0xaee5('0x61')],{'read':![],'body':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0xb8')],'FaxAccountId':_0x3d56df['id'],'UserId':_0x5aa9d5[_0xaee5('0x64')]['id'],'ContactId':_0x470136['id'],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xaee5('0x23')](function(_0x34487e){return[_0x34487e,!![]];});});}else{throw new Error(_0xaee5('0xb9'));}})[_0xaee5('0xba')](function(_0x5580a5,_0x43fa48){if(_0x43fa48){return _0x5580a5;}return db[_0xaee5('0xa6')][_0xaee5('0x60')]({'direction':_0xaee5('0xb7'),'read':![],'body':_0x5aa9d5[_0xaee5('0x61')]['attachments'][0x0][_0xaee5('0xb8')],'FaxAccountId':_0x3d56df['id'],'FaxInteractionId':_0x5580a5['id'],'UserId':_0x5aa9d5['user']['id'],'ContactId':_0x5580a5[_0xaee5('0xbb')],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']})['then'](function(_0xa5bc9){_0x5580a5[_0xaee5('0xbc')][_0xaee5('0xbd')]=[];_0x5580a5[_0xaee5('0xbc')][_0xaee5('0xbd')]['push'](_0xa5bc9['dataValues']);return _0x5580a5;});})[_0xaee5('0x23')](function(_0x4a99ca){respondWithRpcPromise(_0xaee5('0xbe'),'SendFax',{'FaxAccountId':_['isNil'](_0x5aa9d5[_0xaee5('0x5d')]['id'])?undefined:_0x5aa9d5[_0xaee5('0x5d')]['id'],'path':_[_0xaee5('0xb3')](_0x5aa9d5['body'][_0xaee5('0xae')][0x0]['path'])?undefined:_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0][_0xaee5('0x8')],'fax':_[_0xaee5('0xb3')](_0x5aa9d5['body']['to'][0x0])?undefined:_0x5aa9d5[_0xaee5('0x61')]['to'][0x0],'AttachmentId':_0x5aa9d5[_0xaee5('0x61')][_0xaee5('0xae')][0x0]['id']},client9002)[_0xaee5('0x23')](function(_0x33edf4){logger['info'](_0xaee5('0xbf'),_0x33edf4);})[_0xaee5('0x5b')](function(_0x1b1379){logger[_0xaee5('0x24')](_0xaee5('0xbf'),_0x1b1379);});return _0x4a99ca;})[_0xaee5('0x23')](respondWithResult(_0x45fe22,null))[_0xaee5('0x5b')](handleError(_0x45fe22,null));};exports[_0xaee5('0xc0')]=function(_0x5cbb63,_0x598af0,_0x13ff02){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x5cbb63[_0xaee5('0x5d')]['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x598af0,null))[_0xaee5('0x23')](function(_0x56c68d){if(_0x56c68d){return _0x56c68d[_0xaee5('0xc0')](_0x5cbb63['body'][_0xaee5('0x74')],_[_0xaee5('0x75')](_0x5cbb63[_0xaee5('0x61')],[_0xaee5('0x74'),'id'])||{})[_0xaee5('0xba')](function(_0x329ad0){for(var _0x466bf3=0x0;_0x466bf3<_0x5cbb63[_0xaee5('0x61')][_0xaee5('0x74')]['length'];_0x466bf3+=0x1){socket[_0xaee5('0xc1')](_0xaee5('0xc2'),{'UserId':Number(_0x5cbb63[_0xaee5('0x61')][_0xaee5('0x74')][_0x466bf3]),'FaxAccountId':Number(_0x5cbb63[_0xaee5('0x5d')]['id'])});}return _0x329ad0;});}})[_0xaee5('0x23')](respondWithResult(_0x598af0,null))[_0xaee5('0x5b')](handleError(_0x598af0,null));};exports[_0xaee5('0xc3')]=function(_0x1532e2,_0x165c36,_0x361b31){return db[_0xaee5('0x40')][_0xaee5('0x5f')]({'where':{'id':_0x1532e2['params']['id']}})[_0xaee5('0x23')](handleEntityNotFound(_0x165c36,null))[_0xaee5('0x23')](function(_0x54e280){if(_0x54e280){return _0x54e280[_0xaee5('0xc3')](_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')])[_0xaee5('0x23')](function(){if(_[_0xaee5('0xc4')](_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')])){for(var _0x81282c=0x0;_0x81282c<_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')]['length'];_0x81282c+=0x1){socket[_0xaee5('0xc1')](_0xaee5('0xc5'),{'UserId':Number(_0x1532e2[_0xaee5('0x47')][_0xaee5('0x74')][_0x81282c]),'FaxAccountId':Number(_0x1532e2[_0xaee5('0x5d')]['id'])});}}else{socket[_0xaee5('0xc1')](_0xaee5('0xc5'),{'UserId':Number(_0x1532e2[_0xaee5('0x47')]['ids']),'FaxAccountId':Number(_0x1532e2['params']['id'])});}});}})[_0xaee5('0x23')](respondWithStatusCode(_0x165c36,null))[_0xaee5('0x5b')](handleError(_0x165c36,null));};exports[_0xaee5('0xc6')]=function(_0x59b28d,_0x2c6d2c,_0x1e48f5){var _0x4d9dec={};var _0x44bcf6={};var _0x39bd70;var _0x3683b3;return db['FaxAccount'][_0xaee5('0x6d')]({'where':{'id':_0x59b28d[_0xaee5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2c6d2c,null))[_0xaee5('0x23')](function(_0x41c8d0){if(_0x41c8d0){_0x39bd70=_0x41c8d0;_0x44bcf6[_0xaee5('0x44')]=_[_0xaee5('0x46')](db[_0xaee5('0xc7')]['rawAttributes']);_0x44bcf6[_0xaee5('0x47')]=_[_0xaee5('0x46')](_0x59b28d[_0xaee5('0x47')]);_0x44bcf6[_0xaee5('0x48')]=_[_0xaee5('0x49')](_0x44bcf6[_0xaee5('0x44')],_0x44bcf6['query']);_0x4d9dec[_0xaee5('0x4a')]=_['intersection'](_0x44bcf6['model'],qs[_0xaee5('0x4b')](_0x59b28d['query'][_0xaee5('0x4b')]));_0x4d9dec[_0xaee5('0x4a')]=_0x4d9dec[_0xaee5('0x4a')][_0xaee5('0x4c')]?_0x4d9dec[_0xaee5('0x4a')]:_0x44bcf6[_0xaee5('0x44')];_0x4d9dec['order']=qs[_0xaee5('0x50')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x50')]);_0x4d9dec[_0xaee5('0x52')]=qs['filters'](_['pick'](_0x59b28d[_0xaee5('0x47')],_0x44bcf6[_0xaee5('0x48')]));if(_0x59b28d['query'][_0xaee5('0x56')]){_0x4d9dec[_0xaee5('0x52')]=_[_0xaee5('0x53')](_0x4d9dec['where'],{'$or':_[_0xaee5('0x45')](_0x4d9dec[_0xaee5('0x4a')],function(_0x24cc53){var _0x5d5695={};_0x5d5695[_0x24cc53]={'$like':'%'+_0x59b28d[_0xaee5('0x47')][_0xaee5('0x56')]+'%'};return _0x5d5695;})});}_0x4d9dec=_[_0xaee5('0x53')]({},_0x4d9dec,_0x59b28d[_0xaee5('0x5e')]);return _0x39bd70['getAgents'](_0x4d9dec);}})['then'](function(_0x2df1d4){if(_0x2df1d4){_0x3683b3=_0x2df1d4[_0xaee5('0x4c')];if(!_0x59b28d[_0xaee5('0x47')][_0xaee5('0x4d')](_0xaee5('0x4e'))){_0x4d9dec[_0xaee5('0x33')]=qs[_0xaee5('0x33')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x33')]);_0x4d9dec[_0xaee5('0x32')]=qs[_0xaee5('0x32')](_0x59b28d[_0xaee5('0x47')][_0xaee5('0x32')]);}return _0x39bd70[_0xaee5('0xc6')](_0x4d9dec);}})[_0xaee5('0x23')](function(_0x18c30c){if(_0x18c30c){return _0x18c30c?{'count':_0x3683b3,'rows':_0x18c30c}:null;}})[_0xaee5('0x23')](respondWithResult(_0x2c6d2c,null))['catch'](handleError(_0x2c6d2c,null));}; \ No newline at end of file +var _0x9e4d=['Content-Range','apply','destroy','FaxAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','keys','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','ecm','headerinfo','maxrate','minrate','modem','t38timeout','Set','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','update','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','status','json','offset','limit','undefined','count'];(function(_0x2c9148,_0x578953){var _0x1b77b9=function(_0x163367){while(--_0x163367){_0x2c9148['push'](_0x2c9148['shift']());}};_0x1b77b9(++_0x578953);}(_0x9e4d,0x90));var _0xd9e4=function(_0x3c9c4a,_0x28100d){_0x3c9c4a=_0x3c9c4a-0x0;var _0x1e7991=_0x9e4d[_0x3c9c4a];return _0x1e7991;};'use strict';var emlformat=require(_0xd9e4('0x0'));var rimraf=require(_0xd9e4('0x1'));var zipdir=require(_0xd9e4('0x2'));var jsonpatch=require(_0xd9e4('0x3'));var rp=require(_0xd9e4('0x4'));var moment=require('moment');var BPromise=require(_0xd9e4('0x5'));var Mustache=require(_0xd9e4('0x6'));var util=require(_0xd9e4('0x7'));var path=require(_0xd9e4('0x8'));var sox=require('sox');var csv=require(_0xd9e4('0x9'));var ejs=require(_0xd9e4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd9e4('0xb'));var crypto=require(_0xd9e4('0xc'));var jsforce=require(_0xd9e4('0xd'));var deskjs=require(_0xd9e4('0xe'));var toCsv=require(_0xd9e4('0x9'));var querystring=require(_0xd9e4('0xf'));var Papa=require(_0xd9e4('0x10'));var Redis=require(_0xd9e4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd9e4('0x12'));var as=require(_0xd9e4('0x13'));var hardwareService=require(_0xd9e4('0x14'));var logger=require(_0xd9e4('0x15'))(_0xd9e4('0x16'));var utils=require(_0xd9e4('0x17'));var config=require(_0xd9e4('0x18'));var licenseUtil=require(_0xd9e4('0x19'));var db=require(_0xd9e4('0x1a'))['db'];config['redis']=_[_0xd9e4('0x1b')](config[_0xd9e4('0x1c')],{'host':_0xd9e4('0x1d'),'port':0x18eb});var socket=require(_0xd9e4('0x1e'))(new Redis(config['redis']));require(_0xd9e4('0x1f'))[_0xd9e4('0x20')](socket);var jayson=require(_0xd9e4('0x21'));var client=jayson[_0xd9e4('0x22')][_0xd9e4('0x23')]({'port':0x232c});var client9002=jayson[_0xd9e4('0x22')][_0xd9e4('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1ab66b,_0x3947a5,_0x361e94,_0x4e6693){return new BPromise(function(_0x5f91cb,_0x4a664c){var _0x40edd3=_0x4e6693||client;return _0x40edd3[_0xd9e4('0x24')](_0x1ab66b,_0x361e94)[_0xd9e4('0x25')](function(_0x303b6a){logger[_0xd9e4('0x26')](_0xd9e4('0x27'),_0x3947a5,_0xd9e4('0x28'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3947a5,'request\x20sent',JSON[_0xd9e4('0x29')](_0x303b6a));if(_0x303b6a[_0xd9e4('0x2a')]){if(_0x303b6a[_0xd9e4('0x2a')]['code']===0x1f4){logger[_0xd9e4('0x2a')](_0xd9e4('0x27'),_0x3947a5,_0x303b6a[_0xd9e4('0x2a')]['message']);return _0x4a664c(_0x303b6a['error']['message']);}logger[_0xd9e4('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x3947a5,_0x303b6a[_0xd9e4('0x2a')][_0xd9e4('0x2b')]);return _0x5f91cb(_0x303b6a[_0xd9e4('0x2a')][_0xd9e4('0x2b')]);}else{logger[_0xd9e4('0x26')](_0xd9e4('0x27'),_0x3947a5,_0xd9e4('0x28'));_0x5f91cb(_0x303b6a[_0xd9e4('0x2c')][_0xd9e4('0x2b')]);}})[_0xd9e4('0x2d')](function(_0x36f8ce){logger['error'](_0xd9e4('0x27'),_0x3947a5,_0x36f8ce);_0x4a664c(_0x36f8ce);});});}function respondWithStatusCode(_0x4499c4,_0x3af606){_0x3af606=_0x3af606||0xcc;return function(_0x49777d){if(_0x49777d){return _0x4499c4['sendStatus'](_0x3af606);}return _0x4499c4['status'](_0x3af606)[_0xd9e4('0x2e')]();};}function respondWithResult(_0x47bbe1,_0x281bd5){_0x281bd5=_0x281bd5||0xc8;return function(_0xf792e3){if(_0xf792e3){return _0x47bbe1[_0xd9e4('0x2f')](_0x281bd5)[_0xd9e4('0x30')](_0xf792e3);}};}function respondWithFilteredResult(_0x49e1d4,_0x527481){return function(_0x37c82e){if(_0x37c82e){var _0x515876=typeof _0x527481[_0xd9e4('0x31')]==='undefined'&&typeof _0x527481[_0xd9e4('0x32')]===_0xd9e4('0x33');var _0x542ad0=_0x37c82e[_0xd9e4('0x34')];var _0x5ab96b=_0x515876?0x0:_0x527481['offset'];var _0x35b41f=_0x515876?_0x37c82e[_0xd9e4('0x34')]:_0x527481[_0xd9e4('0x31')]+_0x527481[_0xd9e4('0x32')];var _0x45511c;if(_0x35b41f>=_0x542ad0){_0x35b41f=_0x542ad0;_0x45511c=0xc8;}else{_0x45511c=0xce;}_0x49e1d4[_0xd9e4('0x2f')](_0x45511c);return _0x49e1d4['set'](_0xd9e4('0x35'),_0x5ab96b+'-'+_0x35b41f+'/'+_0x542ad0)[_0xd9e4('0x30')](_0x37c82e);}return null;};}function patchUpdates(_0x2e34b7){return function(_0x201ddc){try{jsonpatch[_0xd9e4('0x36')](_0x201ddc,_0x2e34b7,!![]);}catch(_0x2563b5){return BPromise['reject'](_0x2563b5);}return _0x201ddc['save']();};}function saveUpdates(_0x4a34e6,_0x44118d){return function(_0x12002a){if(_0x12002a){return _0x12002a['update'](_0x4a34e6)[_0xd9e4('0x25')](function(_0x4889b7){return _0x4889b7;});}return null;};}function removeEntity(_0x368a04,_0x17bda0){return function(_0x31c78a){if(_0x31c78a){return _0x31c78a[_0xd9e4('0x37')]()[_0xd9e4('0x25')](function(){var _0x481d5e=_0x31c78a['get']({'plain':!![]});var _0x2cebd9=_0xd9e4('0x38');return db['UserProfileResource'][_0xd9e4('0x37')]({'where':{'type':_0x2cebd9,'resourceId':_0x481d5e['id']}})['then'](function(){return _0x31c78a;});})[_0xd9e4('0x25')](function(){_0x368a04[_0xd9e4('0x2f')](0xcc)[_0xd9e4('0x2e')]();});}};}function handleEntityNotFound(_0x405ff8,_0xa2f9a){return function(_0x4be136){if(!_0x4be136){_0x405ff8[_0xd9e4('0x39')](0x194);}return _0x4be136;};}function handleError(_0x1f6388,_0xe7b166){_0xe7b166=_0xe7b166||0x1f4;return function(_0x8179a6){logger[_0xd9e4('0x2a')](_0x8179a6[_0xd9e4('0x3a')]);if(_0x8179a6['name']){delete _0x8179a6[_0xd9e4('0x3b')];}_0x1f6388[_0xd9e4('0x2f')](_0xe7b166)[_0xd9e4('0x3c')](_0x8179a6);};}exports[_0xd9e4('0x3d')]=function(_0x4b303b,_0x30f441){var _0x4d795c={'include':[{'model':db[_0xd9e4('0x3e')],'as':_0xd9e4('0x3f')}]},_0x45fd06={},_0x54c09d={'count':0x0,'rows':[]};var _0x17821d=_[_0xd9e4('0x40')](db[_0xd9e4('0x41')][_0xd9e4('0x42')],function(_0x30dbe7){return{'name':_0x30dbe7[_0xd9e4('0x43')],'type':_0x30dbe7[_0xd9e4('0x44')][_0xd9e4('0x45')]};});_0x45fd06[_0xd9e4('0x46')]=_['map'](_0x17821d,'name');_0x45fd06[_0xd9e4('0x47')]=_['keys'](_0x4b303b['query']);_0x45fd06['filters']=_[_0xd9e4('0x48')](_0x45fd06[_0xd9e4('0x46')],_0x45fd06['query']);_0x4d795c[_0xd9e4('0x49')]=_['intersection'](_0x45fd06[_0xd9e4('0x46')],qs[_0xd9e4('0x4a')](_0x4b303b['query'][_0xd9e4('0x4a')]));_0x4d795c[_0xd9e4('0x49')]=_0x4d795c['attributes'][_0xd9e4('0x4b')]?_0x4d795c[_0xd9e4('0x49')]:_0x45fd06['model'];if(!_0x4b303b[_0xd9e4('0x47')]['hasOwnProperty'](_0xd9e4('0x4c'))){_0x4d795c[_0xd9e4('0x32')]=qs[_0xd9e4('0x32')](_0x4b303b[_0xd9e4('0x47')][_0xd9e4('0x32')]);_0x4d795c[_0xd9e4('0x31')]=qs[_0xd9e4('0x31')](_0x4b303b[_0xd9e4('0x47')][_0xd9e4('0x31')]);}_0x4d795c[_0xd9e4('0x4d')]=qs['sort'](_0x4b303b[_0xd9e4('0x47')][_0xd9e4('0x4e')]);_0x4d795c[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_[_0xd9e4('0x51')](_0x4b303b[_0xd9e4('0x47')],_0x45fd06[_0xd9e4('0x50')]),_0x17821d);if(_0x4b303b[_0xd9e4('0x47')][_0xd9e4('0x52')]){_0x4d795c[_0xd9e4('0x4f')]=_['merge'](_0x4d795c[_0xd9e4('0x4f')],{'$or':_[_0xd9e4('0x40')](_0x17821d,function(_0x548830){if(_0x548830[_0xd9e4('0x44')]!=='VIRTUAL'){var _0x348974={};_0x348974[_0x548830[_0xd9e4('0x3b')]]={'$like':'%'+_0x4b303b['query'][_0xd9e4('0x52')]+'%'};return _0x348974;}})});}_0x4d795c=_[_0xd9e4('0x53')]({},_0x4d795c,_0x4b303b['options']);var _0x3dbc86={'where':_0x4d795c[_0xd9e4('0x4f')]};return db[_0xd9e4('0x41')]['count'](_0x3dbc86)[_0xd9e4('0x25')](function(_0x6306dc){_0x54c09d['count']=_0x6306dc;if(_0x4b303b[_0xd9e4('0x47')][_0xd9e4('0x54')]){_0x4d795c[_0xd9e4('0x55')]=[{'all':!![]}];}return db[_0xd9e4('0x41')][_0xd9e4('0x56')](_0x4d795c);})[_0xd9e4('0x25')](function(_0x22166d){_0x54c09d[_0xd9e4('0x57')]=_0x22166d;return _0x54c09d;})[_0xd9e4('0x25')](respondWithFilteredResult(_0x30f441,_0x4d795c))[_0xd9e4('0x2d')](handleError(_0x30f441,null));};exports['show']=function(_0x2da533,_0x12932a){var _0x172b07={'raw':![],'where':{'id':_0x2da533['params']['id']},'include':[{'model':db[_0xd9e4('0x3e')],'as':_0xd9e4('0x3f')}]},_0x3e7db5={};_0x3e7db5[_0xd9e4('0x46')]=_[_0xd9e4('0x58')](db['FaxAccount'][_0xd9e4('0x42')]);_0x3e7db5['query']=_[_0xd9e4('0x58')](_0x2da533['query']);_0x3e7db5[_0xd9e4('0x50')]=_['intersection'](_0x3e7db5[_0xd9e4('0x46')],_0x3e7db5[_0xd9e4('0x47')]);_0x172b07[_0xd9e4('0x49')]=_['intersection'](_0x3e7db5['model'],qs[_0xd9e4('0x4a')](_0x2da533['query'][_0xd9e4('0x4a')]));_0x172b07[_0xd9e4('0x49')]=_0x172b07[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x172b07[_0xd9e4('0x49')]:_0x3e7db5[_0xd9e4('0x46')];if(_0x2da533['query'][_0xd9e4('0x54')]){_0x172b07[_0xd9e4('0x55')]=[{'all':!![]}];}_0x172b07=_['merge']({},_0x172b07,_0x2da533[_0xd9e4('0x59')]);return db[_0xd9e4('0x41')][_0xd9e4('0x5a')](_0x172b07)[_0xd9e4('0x25')](handleEntityNotFound(_0x12932a,null))['then'](respondWithResult(_0x12932a,null))['catch'](handleError(_0x12932a,null));};exports[_0xd9e4('0x5b')]=function(_0x4b06a7,_0xeb0ac7){return db[_0xd9e4('0x41')][_0xd9e4('0x5b')](_0x4b06a7['body'],{})[_0xd9e4('0x25')](function(_0x3be21c){var _0x202a51=_0x4b06a7['user'][_0xd9e4('0x5c')]({'plain':!![]});if(!_0x202a51)throw new Error(_0xd9e4('0x5d'));if(_0x202a51['role']==='user'){var _0x430ac0=_0x3be21c['get']({'plain':!![]});var _0x22aef9=_0xd9e4('0x38');return db[_0xd9e4('0x5e')][_0xd9e4('0x5a')]({'where':{'name':_0x22aef9,'userProfileId':_0x202a51['userProfileId']},'raw':!![]})[_0xd9e4('0x25')](function(_0x4b8ec9){if(_0x4b8ec9&&_0x4b8ec9[_0xd9e4('0x5f')]===0x0){return db[_0xd9e4('0x60')][_0xd9e4('0x5b')]({'name':_0x430ac0[_0xd9e4('0x3b')],'resourceId':_0x430ac0['id'],'type':_0x4b8ec9[_0xd9e4('0x3b')],'sectionId':_0x4b8ec9['id']},{})[_0xd9e4('0x25')](function(){return _0x3be21c;});}else{return _0x3be21c;}})[_0xd9e4('0x2d')](function(_0xb1b984){logger[_0xd9e4('0x2a')](_0xd9e4('0x61'),_0xb1b984);throw _0xb1b984;});}return _0x3be21c;})[_0xd9e4('0x25')](respondWithResult(_0xeb0ac7,0xc9))['catch'](handleError(_0xeb0ac7,null));};exports['update']=function(_0xb9eefb,_0x2f9d7d){if(_0xb9eefb[_0xd9e4('0x62')]['id']){delete _0xb9eefb[_0xd9e4('0x62')]['id'];}return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0xb9eefb[_0xd9e4('0x63')]['id']},'include':[{'model':db[_0xd9e4('0x3e')],'as':_0xd9e4('0x3f')}]})[_0xd9e4('0x25')](handleEntityNotFound(_0x2f9d7d,null))[_0xd9e4('0x25')](saveUpdates(_0xb9eefb['body'],null))[_0xd9e4('0x25')](respondWithResult(_0x2f9d7d,null))[_0xd9e4('0x2d')](handleError(_0x2f9d7d,null));};exports[_0xd9e4('0x37')]=function(_0x29a7c5,_0x76c38b){return db['FaxAccount'][_0xd9e4('0x5a')]({'where':{'id':_0x29a7c5['params']['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x76c38b,null))[_0xd9e4('0x25')](removeEntity(_0x76c38b,null))[_0xd9e4('0x2d')](handleError(_0x76c38b,null));};exports[_0xd9e4('0x64')]=function(_0x57ab37,_0x5030a4){return db[_0xd9e4('0x41')][_0xd9e4('0x64')]()[_0xd9e4('0x25')](respondWithResult(_0x5030a4,null))['catch'](handleError(_0x5030a4,null));};exports['addDisposition']=function(_0x52e3d0,_0x4e254e,_0x4ad278){if(_0x52e3d0['body']['id']){delete _0x52e3d0[_0xd9e4('0x62')]['id'];}return db['FaxAccount'][_0xd9e4('0x5a')]({'where':{'id':_0x52e3d0[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x4e254e,null))[_0xd9e4('0x25')](function(_0xa25ed3){if(_0xa25ed3){_0x52e3d0[_0xd9e4('0x62')][_0xd9e4('0x65')]=_0xa25ed3['id'];return db[_0xd9e4('0x66')][_0xd9e4('0x5b')](_0x52e3d0[_0xd9e4('0x62')]);}})[_0xd9e4('0x25')](respondWithResult(_0x4e254e,null))[_0xd9e4('0x2d')](handleError(_0x4e254e,null));};exports[_0xd9e4('0x67')]=function(_0x1634bb,_0x351129,_0x13876a){var _0x366b07={'raw':![],'where':{}};var _0x131d8d={};var _0x22eb4f={'count':0x0,'rows':[]};return db[_0xd9e4('0x41')][_0xd9e4('0x68')]({'where':{'id':_0x1634bb['params']['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x351129,null))[_0xd9e4('0x25')](function(_0x4ccb19){if(_0x4ccb19){_0x131d8d['model']=_[_0xd9e4('0x58')](db[_0xd9e4('0x66')]['rawAttributes']);_0x131d8d[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x1634bb[_0xd9e4('0x47')]);_0x131d8d[_0xd9e4('0x50')]=_[_0xd9e4('0x48')](_0x131d8d[_0xd9e4('0x46')],_0x131d8d[_0xd9e4('0x47')]);_0x366b07[_0xd9e4('0x49')]=_[_0xd9e4('0x48')](_0x131d8d[_0xd9e4('0x46')],qs['fields'](_0x1634bb['query'][_0xd9e4('0x4a')]));_0x366b07['attributes']=_0x366b07[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x366b07[_0xd9e4('0x49')]:_0x131d8d[_0xd9e4('0x46')];if(!_0x1634bb[_0xd9e4('0x47')][_0xd9e4('0x69')](_0xd9e4('0x4c'))){_0x366b07[_0xd9e4('0x32')]=qs['limit'](_0x1634bb[_0xd9e4('0x47')][_0xd9e4('0x32')]);_0x366b07['offset']=qs[_0xd9e4('0x31')](_0x1634bb[_0xd9e4('0x47')][_0xd9e4('0x31')]);}_0x366b07['order']=qs[_0xd9e4('0x4e')](_0x1634bb['query']['sort']);_0x366b07[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_['pick'](_0x1634bb[_0xd9e4('0x47')],_0x131d8d[_0xd9e4('0x50')]));_0x366b07[_0xd9e4('0x4f')][_0xd9e4('0x65')]=_0x4ccb19['id'];if(_0x1634bb[_0xd9e4('0x47')][_0xd9e4('0x52')]){_0x366b07[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x366b07[_0xd9e4('0x4f')],{'$or':_[_0xd9e4('0x40')](_0x366b07[_0xd9e4('0x49')],function(_0x1b8c37){var _0x151f19={};_0x151f19[_0x1b8c37]={'$like':'%'+_0x1634bb[_0xd9e4('0x47')]['filter']+'%'};return _0x151f19;})});}_0x366b07=_[_0xd9e4('0x53')]({},_0x366b07,_0x1634bb[_0xd9e4('0x59')]);return db[_0xd9e4('0x66')][_0xd9e4('0x34')]({'where':_0x366b07[_0xd9e4('0x4f')]})[_0xd9e4('0x25')](function(_0x5eb601){_0x22eb4f['count']=_0x5eb601;if(_0x1634bb[_0xd9e4('0x47')][_0xd9e4('0x54')]){_0x366b07[_0xd9e4('0x55')]=[{'all':!![]}];}return db[_0xd9e4('0x66')][_0xd9e4('0x56')](_0x366b07);})[_0xd9e4('0x25')](function(_0x508144){_0x22eb4f[_0xd9e4('0x57')]=_0x508144;return _0x22eb4f;});}})[_0xd9e4('0x25')](respondWithFilteredResult(_0x351129,_0x366b07))[_0xd9e4('0x2d')](handleError(_0x351129,null));};exports[_0xd9e4('0x6a')]=function(_0x29ab97,_0x1e1d28,_0x63812a){return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x29ab97[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x1e1d28,null))[_0xd9e4('0x25')](function(_0x4b99b8){if(_0x4b99b8){return _0x4b99b8[_0xd9e4('0x6a')](_0x29ab97['query'][_0xd9e4('0x6b')]);}})[_0xd9e4('0x25')](respondWithStatusCode(_0x1e1d28,null))[_0xd9e4('0x2d')](handleError(_0x1e1d28,null));};exports['addAnswer']=function(_0x48a50a,_0x190f6f,_0x19c292){if(_0x48a50a[_0xd9e4('0x62')]['id']){delete _0x48a50a['body']['id'];}return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x48a50a['params']['id']}})['then'](handleEntityNotFound(_0x190f6f,null))[_0xd9e4('0x25')](function(_0x5f5adb){if(_0x5f5adb){_0x48a50a['body'][_0xd9e4('0x65')]=_0x5f5adb['id'];return db[_0xd9e4('0x6c')]['create'](_0x48a50a[_0xd9e4('0x62')]);}})[_0xd9e4('0x25')](respondWithResult(_0x190f6f,null))[_0xd9e4('0x2d')](handleError(_0x190f6f,null));};exports[_0xd9e4('0x6d')]=function(_0x481027,_0x544029,_0x3d35ff){var _0x1c662d={'raw':![],'where':{}};var _0x356ada={};var _0x22e29e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x481027[_0xd9e4('0x63')]['id']}})['then'](handleEntityNotFound(_0x544029,null))[_0xd9e4('0x25')](function(_0x15b389){if(_0x15b389){_0x356ada['model']=_[_0xd9e4('0x58')](db[_0xd9e4('0x6c')][_0xd9e4('0x42')]);_0x356ada[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x481027[_0xd9e4('0x47')]);_0x356ada['filters']=_[_0xd9e4('0x48')](_0x356ada['model'],_0x356ada[_0xd9e4('0x47')]);_0x1c662d[_0xd9e4('0x49')]=_[_0xd9e4('0x48')](_0x356ada['model'],qs[_0xd9e4('0x4a')](_0x481027[_0xd9e4('0x47')]['fields']));_0x1c662d[_0xd9e4('0x49')]=_0x1c662d['attributes'][_0xd9e4('0x4b')]?_0x1c662d[_0xd9e4('0x49')]:_0x356ada[_0xd9e4('0x46')];if(!_0x481027[_0xd9e4('0x47')]['hasOwnProperty']('nolimit')){_0x1c662d[_0xd9e4('0x32')]=qs[_0xd9e4('0x32')](_0x481027[_0xd9e4('0x47')][_0xd9e4('0x32')]);_0x1c662d[_0xd9e4('0x31')]=qs[_0xd9e4('0x31')](_0x481027[_0xd9e4('0x47')][_0xd9e4('0x31')]);}_0x1c662d[_0xd9e4('0x4d')]=qs[_0xd9e4('0x4e')](_0x481027[_0xd9e4('0x47')]['sort']);_0x1c662d[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_[_0xd9e4('0x51')](_0x481027[_0xd9e4('0x47')],_0x356ada['filters']));_0x1c662d[_0xd9e4('0x4f')]['FaxAccountId']=_0x15b389['id'];if(_0x481027['query'][_0xd9e4('0x52')]){_0x1c662d[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x1c662d[_0xd9e4('0x4f')],{'$or':_[_0xd9e4('0x40')](_0x1c662d[_0xd9e4('0x49')],function(_0x35dcfe){var _0x182301={};_0x182301[_0x35dcfe]={'$like':'%'+_0x481027['query'][_0xd9e4('0x52')]+'%'};return _0x182301;})});}_0x1c662d=_['merge']({},_0x1c662d,_0x481027[_0xd9e4('0x59')]);return db[_0xd9e4('0x6c')][_0xd9e4('0x34')]({'where':_0x1c662d[_0xd9e4('0x4f')]})[_0xd9e4('0x25')](function(_0x313374){_0x22e29e[_0xd9e4('0x34')]=_0x313374;if(_0x481027[_0xd9e4('0x47')][_0xd9e4('0x54')]){_0x1c662d[_0xd9e4('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd9e4('0x56')](_0x1c662d);})[_0xd9e4('0x25')](function(_0x13b303){_0x22e29e[_0xd9e4('0x57')]=_0x13b303;return _0x22e29e;});}})[_0xd9e4('0x25')](respondWithFilteredResult(_0x544029,_0x1c662d))[_0xd9e4('0x2d')](handleError(_0x544029,null));};exports[_0xd9e4('0x6e')]=function(_0x10f1a9,_0x504082,_0x1f16ae){return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x10f1a9[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x504082,null))['then'](function(_0x44e274){if(_0x44e274){return _0x44e274[_0xd9e4('0x6e')](_0x10f1a9[_0xd9e4('0x47')][_0xd9e4('0x6b')]);}})[_0xd9e4('0x25')](respondWithStatusCode(_0x504082,null))[_0xd9e4('0x2d')](handleError(_0x504082,null));};exports[_0xd9e4('0x6f')]=function(_0xa3f22f,_0x310a40,_0x4f87c8){return db[_0xd9e4('0x70')][_0xd9e4('0x5a')]({'where':{'id':_0xa3f22f['params']['id']}})['then'](handleEntityNotFound(_0x310a40,null))[_0xd9e4('0x25')](function(_0x1d3c53){if(_0x1d3c53){return _0x1d3c53['addInteraction'](_0xa3f22f[_0xd9e4('0x62')]['ids'],_[_0xd9e4('0x71')](_0xa3f22f[_0xd9e4('0x62')],['ids','id'])||{});}})[_0xd9e4('0x25')](respondWithResult(_0x310a40,null))[_0xd9e4('0x2d')](handleError(_0x310a40,null));};exports[_0xd9e4('0x72')]=function(_0x648cb,_0x4c6c8f,_0x3596ee){var _0x319074={'raw':![],'where':{}};var _0x3363f2={};var _0x1454fa={'count':0x0,'rows':[]};return db[_0xd9e4('0x41')]['findOne']({'where':{'id':_0x648cb[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x4c6c8f,null))['then'](function(_0xa8ecd7){if(_0xa8ecd7){_0x3363f2[_0xd9e4('0x46')]=_[_0xd9e4('0x58')](db[_0xd9e4('0x70')][_0xd9e4('0x42')]);_0x3363f2[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x648cb['query']);_0x3363f2[_0xd9e4('0x50')]=_['intersection'](_0x3363f2[_0xd9e4('0x46')],_0x3363f2[_0xd9e4('0x47')]);_0x319074[_0xd9e4('0x49')]=_[_0xd9e4('0x48')](_0x3363f2[_0xd9e4('0x46')],qs[_0xd9e4('0x4a')](_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x4a')]));_0x319074['attributes']=_0x319074[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x319074[_0xd9e4('0x49')]:_0x3363f2['model'];if(!_0x648cb['query'][_0xd9e4('0x69')]('nolimit')){_0x319074[_0xd9e4('0x32')]=qs[_0xd9e4('0x32')](_0x648cb['query']['limit']);_0x319074['offset']=qs['offset'](_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x31')]);}_0x319074['order']=qs[_0xd9e4('0x4e')](_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x4e')]);_0x319074[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_['pick'](_0x648cb[_0xd9e4('0x47')],_0x3363f2[_0xd9e4('0x50')]));_0x319074[_0xd9e4('0x4f')][_0xd9e4('0x65')]=_0xa8ecd7['id'];if(_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x52')]){_0x319074[_0xd9e4('0x4f')]=_['merge'](_0x319074['where'],{'$or':_[_0xd9e4('0x40')](_0x319074[_0xd9e4('0x49')],function(_0x25eb1b){var _0x392b71={};_0x392b71[_0x25eb1b]={'$like':'%'+_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x52')]+'%'};return _0x392b71;})});}_0x319074=_[_0xd9e4('0x53')]({},_0x319074,_0x648cb[_0xd9e4('0x59')]);return db[_0xd9e4('0x70')][_0xd9e4('0x34')]({'where':_0x319074['where']})[_0xd9e4('0x25')](function(_0x482b52){_0x1454fa[_0xd9e4('0x34')]=_0x482b52;if(_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x54')]){_0x319074[_0xd9e4('0x55')]=[{'model':db[_0xd9e4('0x73')],'as':_0xd9e4('0x74'),'required':![]},{'model':db['User'],'as':_0xd9e4('0x75'),'attributes':[_0xd9e4('0x3b'),_0xd9e4('0x76'),_0xd9e4('0x77')],'required':![]},{'model':db['Tag'],'as':_0xd9e4('0x78'),'attributes':['id','name','color'],'where':_0x648cb['query'][_0xd9e4('0x79')]?{'id':_0x648cb[_0xd9e4('0x47')][_0xd9e4('0x79')]}:undefined,'required':_0x648cb[_0xd9e4('0x47')]['tag']?!![]:![]}];}return db[_0xd9e4('0x70')][_0xd9e4('0x56')](_0x319074);})[_0xd9e4('0x25')](function(_0x5e7cef){_0x1454fa[_0xd9e4('0x57')]=_0x5e7cef;return _0x1454fa;});}})['then'](respondWithFilteredResult(_0x4c6c8f,_0x319074))[_0xd9e4('0x2d')](handleError(_0x4c6c8f,null));};exports['addApplications']=function(_0x2b009f,_0x3e885f){var _0x879a28=_0x2b009f[_0xd9e4('0x63')]['id'];var _0x4de41e=_0x2b009f['body'];var _0x47a2f5=0xc8;var _0x38d152=null;return db[_0xd9e4('0x7a')][_0xd9e4('0x7b')]({'isolationLevel':db[_0xd9e4('0x7a')][_0xd9e4('0x7c')][_0xd9e4('0x7d')][_0xd9e4('0x7e')]},function(_0x45adcc){return db['FaxAccount'][_0xd9e4('0x68')]({'where':{'id':_0x879a28},'transaction':_0x45adcc})[_0xd9e4('0x25')](function(_0x52a0bf){if(_0x52a0bf){return db[_0xd9e4('0x7f')][_0xd9e4('0x37')]({'where':{'FaxAccountId':_0x879a28},'transaction':_0x45adcc})['then'](function(){var _0x5c1fc7=_[_0xd9e4('0x40')](_0x4de41e,function(_0x588b16){_0x588b16['FaxAccountId']=_0x879a28;return _0x588b16;});return db[_0xd9e4('0x7f')]['bulkCreate'](_0x5c1fc7,{'transaction':_0x45adcc});});}else{_0x47a2f5=0x194;_0x38d152=[];}});})[_0xd9e4('0x25')](function(){if(_0x47a2f5!==0x194){return db[_0xd9e4('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x879a28},'order':'priority'})[_0xd9e4('0x25')](function(_0x4c969c){_0x38d152=_0x4c969c;});}})[_0xd9e4('0x2d')](function(_0x510d0d){_0x47a2f5=0x1f4;logger['error'](_0x510d0d['stack']);if(_0x510d0d['name']){delete _0x510d0d[_0xd9e4('0x3b')];}_0x38d152=_0x510d0d;})['finally'](function(){if(_0x38d152===null){_0x3e885f[_0xd9e4('0x39')](_0x47a2f5);}else{if(_0x47a2f5===0x1f4){_0x3e885f[_0xd9e4('0x2f')](_0x47a2f5)[_0xd9e4('0x3c')](_0x38d152);}else{_0x3e885f[_0xd9e4('0x2f')](_0x47a2f5)[_0xd9e4('0x30')](_0x38d152);}}});};exports[_0xd9e4('0x80')]=function(_0x5b12bb,_0x31d4e2,_0x24d5e0){var _0x5d5ac8={};var _0x1b60ef={};var _0x5546fb;var _0x5db3d0;return db[_0xd9e4('0x41')][_0xd9e4('0x68')]({'where':{'id':_0x5b12bb[_0xd9e4('0x63')]['id']}})['then'](handleEntityNotFound(_0x31d4e2,null))[_0xd9e4('0x25')](function(_0x44cacb){if(_0x44cacb){_0x5546fb=_0x44cacb;_0x1b60ef[_0xd9e4('0x46')]=_['keys'](db['FaxApplication'][_0xd9e4('0x42')]);_0x1b60ef[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x5b12bb['query']);_0x1b60ef[_0xd9e4('0x50')]=_[_0xd9e4('0x48')](_0x1b60ef[_0xd9e4('0x46')],_0x1b60ef[_0xd9e4('0x47')]);_0x5d5ac8[_0xd9e4('0x49')]=_['intersection'](_0x1b60ef[_0xd9e4('0x46')],qs[_0xd9e4('0x4a')](_0x5b12bb[_0xd9e4('0x47')][_0xd9e4('0x4a')]));_0x5d5ac8[_0xd9e4('0x49')]=_0x5d5ac8[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x5d5ac8[_0xd9e4('0x49')]:_0x1b60ef['model'];_0x5d5ac8[_0xd9e4('0x4d')]=qs[_0xd9e4('0x4e')](_0x5b12bb[_0xd9e4('0x47')][_0xd9e4('0x4e')]);_0x5d5ac8[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_[_0xd9e4('0x51')](_0x5b12bb['query'],_0x1b60ef[_0xd9e4('0x50')]));if(_0x5b12bb['query'][_0xd9e4('0x52')]){_0x5d5ac8[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x5d5ac8[_0xd9e4('0x4f')],{'$or':_[_0xd9e4('0x40')](_0x5d5ac8[_0xd9e4('0x49')],function(_0x440507){var _0x441110={};_0x441110[_0x440507]={'$like':'%'+_0x5b12bb['query'][_0xd9e4('0x52')]+'%'};return _0x441110;})});}_0x5d5ac8=_['merge']({},_0x5d5ac8,_0x5b12bb[_0xd9e4('0x59')]);return _0x5546fb[_0xd9e4('0x80')](_0x5d5ac8);}})[_0xd9e4('0x25')](function(_0xb668b8){if(_0xb668b8){_0x5db3d0=_0xb668b8[_0xd9e4('0x4b')];if(!_0x5b12bb[_0xd9e4('0x47')][_0xd9e4('0x69')](_0xd9e4('0x4c'))){_0x5d5ac8[_0xd9e4('0x32')]=qs[_0xd9e4('0x32')](_0x5b12bb[_0xd9e4('0x47')]['limit']);_0x5d5ac8[_0xd9e4('0x31')]=qs[_0xd9e4('0x31')](_0x5b12bb[_0xd9e4('0x47')][_0xd9e4('0x31')]);}return _0x5546fb[_0xd9e4('0x80')](_0x5d5ac8);}})[_0xd9e4('0x25')](function(_0x201710){if(_0x201710){return _0x201710?{'count':_0x5db3d0,'rows':_0x201710}:null;}})['then'](respondWithResult(_0x31d4e2,null))['catch'](handleError(_0x31d4e2,null));};function Extension(_0x4ae17b,_0x346925,_0x22f882,_0x5d6d86){this[_0xd9e4('0x81')]=_0xd9e4('0x82');this[_0xd9e4('0x83')]=_0x4ae17b[_0xd9e4('0x84')];this[_0xd9e4('0x85')]=_0x5d6d86;this[_0xd9e4('0x44')]=_0xd9e4('0x86');this[_0xd9e4('0x87')]=_0xd9e4('0x88');this[_0xd9e4('0x65')]=_0x4ae17b['id'];this[_0xd9e4('0x89')]=_0x346925;this[_0xd9e4('0x8a')]=_0x22f882;}function createExtensionsReciveFax(_0x46cf26){var _0x17d153=0x1;var _0x1cb3dd=[];_0x1cb3dd[_0xd9e4('0x8b')](new Extension(_0x46cf26,_0x17d153,'',_0xd9e4('0x8c')));_0x17d153+=0x1;_0x1cb3dd[_0xd9e4('0x8b')](new Extension(_0x46cf26,_0x17d153,_0xd9e4('0x8d'),'Set'));_0x17d153+=0x1;for(var _0x409eb8 in _0x46cf26){if(_0x46cf26[_0xd9e4('0x69')](_0x409eb8)&&(_0x409eb8===_0xd9e4('0x8e')||_0x409eb8===_0xd9e4('0x84')||_0x409eb8==='gateway'||_0x409eb8==='faxdetect'||_0x409eb8===_0xd9e4('0x8f')||_0x409eb8===_0xd9e4('0x90')||_0x409eb8===_0xd9e4('0x91')||_0x409eb8===_0xd9e4('0x92')||_0x409eb8===_0xd9e4('0x93'))){_0x1cb3dd[_0xd9e4('0x8b')](new Extension(_0x46cf26,_0x17d153,'FAXOPT('+_0x409eb8+')='+_0x46cf26[_0x409eb8],_0xd9e4('0x94')));_0x17d153+=0x1;}}_0x1cb3dd['push'](new Extension(_0x46cf26,_0x17d153,'6','Wait'));_0x17d153+=0x1;_0x1cb3dd[_0xd9e4('0x8b')](new Extension(_0x46cf26,_0x17d153,'/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',_0xd9e4('0x95')));_0x17d153=0x0;return _0x1cb3dd;}exports[_0xd9e4('0x96')]=function(_0xd3ed19,_0x1e9118,_0x372507){var _0x594aaa;return db[_0xd9e4('0x7a')][_0xd9e4('0x7b')](function(_0x313418){return db['FaxAccount']['create'](_0xd3ed19[_0xd9e4('0x62')],{'transaction':_0x313418})[_0xd9e4('0x25')](function(_0x2c35ef){_0x594aaa=_0x2c35ef['get']({'plain':!![]});return db['VoiceExtension'][_0xd9e4('0x97')](createExtensionsReciveFax(_0x594aaa),{'transaction':_0x313418});});})['then'](function(){return _0x594aaa;})[_0xd9e4('0x25')](respondWithResult(_0x1e9118,null))[_0xd9e4('0x2d')](handleError(_0x1e9118,null));};exports[_0xd9e4('0x98')]=function(_0x5e166a,_0xfff59b,_0x346bff){var _0x38e2c1;return db[_0xd9e4('0x7a')][_0xd9e4('0x7b')](function(_0x32b56d){return db['FaxAccount'][_0xd9e4('0x99')](_0x5e166a['body'],{'where':{'id':_0x5e166a[_0xd9e4('0x62')]['id']},'transaction':_0x32b56d})['then'](function(_0x482b4c){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x5e166a['body']['id']},'transaction':_0x32b56d})[_0xd9e4('0x25')](function(_0x46f887){return db['VoiceExtension'][_0xd9e4('0x97')](createExtensionsReciveFax(_[_0xd9e4('0x71')](_0x5e166a['body'],[_0xd9e4('0x9a'),_0xd9e4('0x45'),_0xd9e4('0x9b'),_0xd9e4('0x9c'),_0xd9e4('0x9d'),_0xd9e4('0x9e')])),{'transaction':_0x32b56d});});});})[_0xd9e4('0x25')](function(){return db[_0xd9e4('0x41')][_0xd9e4('0x9f')](_0x5e166a[_0xd9e4('0x62')]['id']);})[_0xd9e4('0x25')](respondWithResult(_0xfff59b,null))['catch'](handleError(_0xfff59b,null));};exports['getMessages']=function(_0x539f6f,_0x3c6633,_0x50dfc6){var _0x46d38d={'raw':!![],'where':{}};var _0x14b828={};var _0x1c1299={'count':0x0,'rows':[]};return db[_0xd9e4('0x41')][_0xd9e4('0x68')]({'where':{'id':_0x539f6f['params']['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x3c6633,null))[_0xd9e4('0x25')](function(_0x2f228d){if(_0x2f228d){_0x14b828[_0xd9e4('0x46')]=_[_0xd9e4('0x58')](db[_0xd9e4('0xa0')][_0xd9e4('0x42')]);_0x14b828[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x539f6f[_0xd9e4('0x47')]);_0x14b828['filters']=_[_0xd9e4('0x48')](_0x14b828[_0xd9e4('0x46')],_0x14b828[_0xd9e4('0x47')]);_0x46d38d[_0xd9e4('0x49')]=_[_0xd9e4('0x48')](_0x14b828[_0xd9e4('0x46')],qs[_0xd9e4('0x4a')](_0x539f6f['query'][_0xd9e4('0x4a')]));_0x46d38d['attributes']=_0x46d38d[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x46d38d[_0xd9e4('0x49')]:_0x14b828[_0xd9e4('0x46')];if(!_0x539f6f[_0xd9e4('0x47')][_0xd9e4('0x69')](_0xd9e4('0x4c'))){_0x46d38d[_0xd9e4('0x32')]=qs['limit'](_0x539f6f[_0xd9e4('0x47')][_0xd9e4('0x32')]);_0x46d38d[_0xd9e4('0x31')]=qs[_0xd9e4('0x31')](_0x539f6f[_0xd9e4('0x47')][_0xd9e4('0x31')]);}_0x46d38d['order']=qs[_0xd9e4('0x4e')](_0x539f6f['query'][_0xd9e4('0x4e')]);_0x46d38d['where']=qs[_0xd9e4('0x50')](_['pick'](_0x539f6f[_0xd9e4('0x47')],_0x14b828['filters']));_0x46d38d['where'][_0xd9e4('0x65')]=_0x2f228d['id'];if(_0x539f6f[_0xd9e4('0x47')][_0xd9e4('0x52')]){_0x46d38d[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x46d38d['where'],{'$or':_['map'](_0x46d38d['attributes'],function(_0x50636f){var _0x4e70fb={};_0x4e70fb[_0x50636f]={'$like':'%'+_0x539f6f['query'][_0xd9e4('0x52')]+'%'};return _0x4e70fb;})});}if(_0x539f6f['query'][_0xd9e4('0xa1')]){var _0x5426d8=_0x539f6f[_0xd9e4('0x47')]['$gte'][_0xd9e4('0xa2')](',');var _0x36fcec={};_0x36fcec[_0x5426d8[0x0]]={'$gte':moment(_0x5426d8[0x1])[_0xd9e4('0xa3')](_0xd9e4('0xa4'))};_0x46d38d[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x46d38d[_0xd9e4('0x4f')],_0x36fcec);}_0x46d38d=_['merge']({},_0x46d38d,_0x539f6f[_0xd9e4('0x59')]);return db['FaxMessage'][_0xd9e4('0x34')]({'where':_0x46d38d[_0xd9e4('0x4f')]})[_0xd9e4('0x25')](function(_0x2a52a2){_0x1c1299[_0xd9e4('0x34')]=_0x2a52a2;if(_0x539f6f['query'][_0xd9e4('0x54')]){_0x46d38d[_0xd9e4('0x55')]=[{'all':!![]}];}return db[_0xd9e4('0xa0')][_0xd9e4('0x56')](_0x46d38d);})[_0xd9e4('0x25')](function(_0x342bf2){_0x1c1299['rows']=_0x342bf2;return _0x1c1299;});}})[_0xd9e4('0x25')](respondWithFilteredResult(_0x3c6633,_0x46d38d))[_0xd9e4('0x2d')](handleError(_0x3c6633,null));};exports['send']=function(_0x44ccef,_0x54f2f9,_0x3a5080){var _0x5b4746,_0x2e7d57={},_0x484bbe;if(_0x44ccef['body']['to']){_0x484bbe=_0x44ccef['body']['to'][0x0];}return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x44ccef['params']['id']},'include':[{'model':db[_0xd9e4('0xa5')],'as':_0xd9e4('0xa6'),'include':[{'model':db[_0xd9e4('0x73')],'as':_0xd9e4('0xa7'),'where':{'fax':_0x484bbe},'limit':0x1,'order':[[_0xd9e4('0x9c'),'DESC']]}]}]})[_0xd9e4('0x25')](handleEntityNotFound(_0x54f2f9,null))['then'](function(_0x6443){_0x5b4746=_0x6443;if(_0x44ccef[_0xd9e4('0x62')]['attachments']&&_0x44ccef[_0xd9e4('0x62')]['attachments'][_0xd9e4('0x4b')]){for(var _0x3fe962=0x0;_0x3fe962<_0x44ccef[_0xd9e4('0x62')]['attachments'][_0xd9e4('0x4b')];_0x3fe962+=0x1){_0x44ccef['body'][_0xd9e4('0xa8')][_0x3fe962]={'filename':_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][_0x3fe962][_0xd9e4('0x3b')],'id':_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][_0x3fe962]['id'],'path':path[_0xd9e4('0xa9')](config[_0xd9e4('0xaa')],_0xd9e4('0xab'),_0x44ccef[_0xd9e4('0x62')]['attachments'][_0x3fe962][_0xd9e4('0xac')])};}}return respondWithRpcPromise(_0xd9e4('0xad'),_0xd9e4('0xad'),{'FaxAccountId':_[_0xd9e4('0xae')](_0x44ccef['params']['id'])?undefined:_0x44ccef[_0xd9e4('0x63')]['id'],'path':_[_0xd9e4('0xae')](_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0][_0xd9e4('0x8')])?undefined:_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0][_0xd9e4('0x8')],'fax':_[_0xd9e4('0xae')](_0x44ccef[_0xd9e4('0x62')]['to'][0x0])?undefined:_0x44ccef[_0xd9e4('0x62')]['to'][0x0]},client9002);})[_0xd9e4('0x25')](function(){if(_0x5b4746){if(_[_0xd9e4('0xae')](_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xaf')])){_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xaf')]=util['format'](_0xd9e4('0xb0'),_0x5b4746[_0xd9e4('0x3b')],_0x5b4746[_0xd9e4('0xb1')]);}if(_0x5b4746['List']){if(_0x5b4746[_0xd9e4('0xa6')][_0xd9e4('0xa7')]['length']){return _0x5b4746[_0xd9e4('0xa6')][_0xd9e4('0xa7')][0x0];}else{return db[_0xd9e4('0x73')][_0xd9e4('0x5b')](_['defaults'](_0x44ccef[_0xd9e4('0x62')],{'firstName':_0x44ccef['body']['to'][0x0],'phone':_0x44ccef[_0xd9e4('0x62')]['to'][0x0],'fax':_0x44ccef[_0xd9e4('0x62')]['to'][0x0],'ListId':_0x5b4746['ListId']}));}}else{throw new Error(_0xd9e4('0xb2'));}}else{throw new Error(_0xd9e4('0xb3'));}})[_0xd9e4('0x25')](function(_0x104703){if(_0x104703){return db[_0xd9e4('0x70')][_0xd9e4('0x5a')]({'where':{'ContactId':_0x104703['id'],'closed':![],'FaxAccountId':_0x5b4746['id']}})[_0xd9e4('0x25')](function(_0x2b8fdc){if(_0x2b8fdc){return[_0x2b8fdc,![]];}return db[_0xd9e4('0x70')][_0xd9e4('0x5b')]({'UserId':_0x44ccef[_0xd9e4('0xb4')]['id'],'ContactId':_0x104703['id'],'FaxAccountId':_0x5b4746['id'],'fax':_0x44ccef['body']['to'][0x0],'firstMsgDirection':_0xd9e4('0xb5'),'Messages':[_[_0xd9e4('0x53')](_0x44ccef['body'],{'read':![],'body':_0x44ccef['body'][_0xd9e4('0xa8')][0x0][_0xd9e4('0xb6')],'FaxAccountId':_0x5b4746['id'],'UserId':_0x44ccef[_0xd9e4('0xb4')]['id'],'ContactId':_0x104703['id'],'AttachmentId':_0x44ccef['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xd9e4('0xa0')],'as':_0xd9e4('0xb7')}]})[_0xd9e4('0x25')](function(_0x38f282){return[_0x38f282,!![]];});});}else{throw new Error(_0xd9e4('0xb8'));}})[_0xd9e4('0xb9')](function(_0x40b56d,_0x1f94c7){if(_0x1f94c7){return _0x40b56d;}return db[_0xd9e4('0xa0')][_0xd9e4('0x5b')]({'direction':_0xd9e4('0xb5'),'read':![],'body':_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0][_0xd9e4('0xb6')],'FaxAccountId':_0x5b4746['id'],'FaxInteractionId':_0x40b56d['id'],'UserId':_0x44ccef[_0xd9e4('0xb4')]['id'],'ContactId':_0x40b56d[_0xd9e4('0xba')],'AttachmentId':_0x44ccef['body']['attachments'][0x0]['id']})['then'](function(_0x28f571){_0x40b56d[_0xd9e4('0xbb')][_0xd9e4('0xb7')]=[];_0x40b56d[_0xd9e4('0xbb')]['Messages']['push'](_0x28f571['dataValues']);return _0x40b56d;});})['then'](function(_0x5b8e27){respondWithRpcPromise(_0xd9e4('0xbc'),_0xd9e4('0xbc'),{'FaxAccountId':_[_0xd9e4('0xae')](_0x44ccef['params']['id'])?undefined:_0x44ccef[_0xd9e4('0x63')]['id'],'path':_[_0xd9e4('0xae')](_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0][_0xd9e4('0x8')])?undefined:_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0][_0xd9e4('0x8')],'fax':_[_0xd9e4('0xae')](_0x44ccef[_0xd9e4('0x62')]['to'][0x0])?undefined:_0x44ccef[_0xd9e4('0x62')]['to'][0x0],'AttachmentId':_0x44ccef[_0xd9e4('0x62')][_0xd9e4('0xa8')][0x0]['id']},client9002)[_0xd9e4('0x25')](function(_0x2bd865){logger[_0xd9e4('0x26')](_0xd9e4('0xbd'),_0x2bd865);})['catch'](function(_0x51eef1){logger[_0xd9e4('0x26')]('SendFaxRpc,\x20%s',_0x51eef1);});return _0x5b8e27;})['then'](respondWithResult(_0x54f2f9,null))[_0xd9e4('0x2d')](handleError(_0x54f2f9,null));};exports[_0xd9e4('0xbe')]=function(_0x1a1ebc,_0x487970,_0x21f870){return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x1a1ebc[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x487970,null))[_0xd9e4('0x25')](function(_0x57ecb8){if(_0x57ecb8){return _0x57ecb8[_0xd9e4('0xbe')](_0x1a1ebc[_0xd9e4('0x62')][_0xd9e4('0x6b')],_[_0xd9e4('0x71')](_0x1a1ebc['body'],[_0xd9e4('0x6b'),'id'])||{})[_0xd9e4('0xb9')](function(_0x3f42dd){for(var _0x3b2d48=0x0;_0x3b2d48<_0x1a1ebc[_0xd9e4('0x62')]['ids'][_0xd9e4('0x4b')];_0x3b2d48+=0x1){socket[_0xd9e4('0xbf')](_0xd9e4('0xc0'),{'UserId':Number(_0x1a1ebc[_0xd9e4('0x62')][_0xd9e4('0x6b')][_0x3b2d48]),'FaxAccountId':Number(_0x1a1ebc[_0xd9e4('0x63')]['id'])});}return _0x3f42dd;});}})[_0xd9e4('0x25')](respondWithResult(_0x487970,null))['catch'](handleError(_0x487970,null));};exports['removeAgents']=function(_0x1c5070,_0xa3adde,_0x58b0b2){return db[_0xd9e4('0x41')][_0xd9e4('0x5a')]({'where':{'id':_0x1c5070['params']['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0xa3adde,null))[_0xd9e4('0x25')](function(_0x93f80f){if(_0x93f80f){return _0x93f80f[_0xd9e4('0xc1')](_0x1c5070['query']['ids'])['then'](function(){if(_['isArray'](_0x1c5070[_0xd9e4('0x47')][_0xd9e4('0x6b')])){for(var _0x5803d3=0x0;_0x5803d3<_0x1c5070[_0xd9e4('0x47')][_0xd9e4('0x6b')][_0xd9e4('0x4b')];_0x5803d3+=0x1){socket[_0xd9e4('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x1c5070[_0xd9e4('0x47')][_0xd9e4('0x6b')][_0x5803d3]),'FaxAccountId':Number(_0x1c5070[_0xd9e4('0x63')]['id'])});}}else{socket[_0xd9e4('0xbf')](_0xd9e4('0xc2'),{'UserId':Number(_0x1c5070[_0xd9e4('0x47')][_0xd9e4('0x6b')]),'FaxAccountId':Number(_0x1c5070[_0xd9e4('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0xa3adde,null))[_0xd9e4('0x2d')](handleError(_0xa3adde,null));};exports[_0xd9e4('0xc3')]=function(_0x21943c,_0x99a6fa,_0x1a1206){var _0x248c42={};var _0x217583={};var _0x433f51;var _0x2bad4b;return db[_0xd9e4('0x41')]['findOne']({'where':{'id':_0x21943c[_0xd9e4('0x63')]['id']}})[_0xd9e4('0x25')](handleEntityNotFound(_0x99a6fa,null))['then'](function(_0x288f21){if(_0x288f21){_0x433f51=_0x288f21;_0x217583['model']=_[_0xd9e4('0x58')](db[_0xd9e4('0xc4')][_0xd9e4('0x42')]);_0x217583[_0xd9e4('0x47')]=_[_0xd9e4('0x58')](_0x21943c['query']);_0x217583[_0xd9e4('0x50')]=_['intersection'](_0x217583[_0xd9e4('0x46')],_0x217583[_0xd9e4('0x47')]);_0x248c42[_0xd9e4('0x49')]=_['intersection'](_0x217583['model'],qs[_0xd9e4('0x4a')](_0x21943c['query'][_0xd9e4('0x4a')]));_0x248c42['attributes']=_0x248c42[_0xd9e4('0x49')][_0xd9e4('0x4b')]?_0x248c42[_0xd9e4('0x49')]:_0x217583[_0xd9e4('0x46')];_0x248c42[_0xd9e4('0x4d')]=qs[_0xd9e4('0x4e')](_0x21943c[_0xd9e4('0x47')][_0xd9e4('0x4e')]);_0x248c42[_0xd9e4('0x4f')]=qs[_0xd9e4('0x50')](_[_0xd9e4('0x51')](_0x21943c[_0xd9e4('0x47')],_0x217583[_0xd9e4('0x50')]));if(_0x21943c[_0xd9e4('0x47')][_0xd9e4('0x52')]){_0x248c42[_0xd9e4('0x4f')]=_[_0xd9e4('0x53')](_0x248c42['where'],{'$or':_[_0xd9e4('0x40')](_0x248c42['attributes'],function(_0x2bfd34){var _0x543640={};_0x543640[_0x2bfd34]={'$like':'%'+_0x21943c[_0xd9e4('0x47')][_0xd9e4('0x52')]+'%'};return _0x543640;})});}_0x248c42=_[_0xd9e4('0x53')]({},_0x248c42,_0x21943c[_0xd9e4('0x59')]);return _0x433f51['getAgents'](_0x248c42);}})['then'](function(_0x2f3633){if(_0x2f3633){_0x2bad4b=_0x2f3633['length'];if(!_0x21943c[_0xd9e4('0x47')][_0xd9e4('0x69')](_0xd9e4('0x4c'))){_0x248c42['limit']=qs['limit'](_0x21943c['query'][_0xd9e4('0x32')]);_0x248c42[_0xd9e4('0x31')]=qs['offset'](_0x21943c['query']['offset']);}return _0x433f51[_0xd9e4('0xc3')](_0x248c42);}})[_0xd9e4('0x25')](function(_0x2fa880){if(_0x2fa880){return _0x2fa880?{'count':_0x2bad4b,'rows':_0x2fa880}:null;}})[_0xd9e4('0x25')](respondWithResult(_0x99a6fa,null))[_0xd9e4('0x2d')](handleError(_0x99a6fa,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9c3ec7f..ec04f62 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 _0xc469=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x48b4f2,_0x1097c0){var _0xa20d72=function(_0x48cd71){while(--_0x48cd71){_0x48b4f2['push'](_0x48b4f2['shift']());}};_0xa20d72(++_0x1097c0);}(_0xc469,0x1f2));var _0x9c46=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xc469[_0x23b655];return _0x364b32;};'use strict';var EventEmitter=require(_0x9c46('0x0'));var FaxAccount=require(_0x9c46('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9c46('0x2')](0x0);var events={'afterCreate':_0x9c46('0x3'),'afterUpdate':'update','afterDestroy':_0x9c46('0x4')};function emitEvent(_0x28ce7a){return function(_0x56afc0,_0x18d122,_0xd64a9a){FaxAccountEvents['emit'](_0x28ce7a+':'+_0x56afc0['id'],_0x56afc0);FaxAccountEvents[_0x9c46('0x5')](_0x28ce7a,_0x56afc0);_0xd64a9a(null);};}for(var e in events){if(events[_0x9c46('0x6')](e)){var event=events[e];FaxAccount[_0x9c46('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x8eb7=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x8eb7,0xfb));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x78eb('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x78eb('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x78eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x78eb('0x3'),'afterDestroy':_0x78eb('0x4')};function emitEvent(_0x2bafd3){return function(_0x5143a0,_0x545373,_0x3122af){FaxAccountEvents[_0x78eb('0x5')](_0x2bafd3+':'+_0x5143a0['id'],_0x5143a0);FaxAccountEvents[_0x78eb('0x5')](_0x2bafd3,_0x5143a0);_0x3122af(null);};}for(var e in events){if(events[_0x78eb('0x6')](e)){var event=events[e];FaxAccount[_0x78eb('0x7')](e,emitEvent(event));}}module[_0x78eb('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9da904a..91059e7 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 _0x6eae=['./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6eae,0x1d8));var _0xe6ea=function(_0x2e90f9,_0x551105){_0x2e90f9=_0x2e90f9-0x0;var _0x265ccf=_0x6eae[_0x2e90f9];return _0x265ccf;};'use strict';var _=require(_0xe6ea('0x0'));var util=require(_0xe6ea('0x1'));var logger=require(_0xe6ea('0x2'))(_0xe6ea('0x3'));var moment=require(_0xe6ea('0x4'));var BPromise=require('bluebird');var rp=require(_0xe6ea('0x5'));var fs=require('fs');var path=require(_0xe6ea('0x6'));var rimraf=require('rimraf');var config=require(_0xe6ea('0x7'));var attributes=require(_0xe6ea('0x8'));module[_0xe6ea('0x9')]=function(_0x1ab8e3,_0x11be75){return _0x1ab8e3[_0xe6ea('0xa')]('FaxAccount',attributes,{'tableName':_0xe6ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fc6=['bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x110ae1,_0x551598){var _0xf1f963=function(_0x3c75d3){while(--_0x3c75d3){_0x110ae1['push'](_0x110ae1['shift']());}};_0xf1f963(++_0x551598);}(_0x2fc6,0xcb));var _0x62fc=function(_0x29c2c3,_0x798c57){_0x29c2c3=_0x29c2c3-0x0;var _0x2fdc13=_0x2fc6[_0x29c2c3];return _0x2fdc13;};'use strict';var _=require(_0x62fc('0x0'));var util=require(_0x62fc('0x1'));var logger=require(_0x62fc('0x2'))(_0x62fc('0x3'));var moment=require(_0x62fc('0x4'));var BPromise=require(_0x62fc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62fc('0x6'));var rimraf=require(_0x62fc('0x7'));var config=require(_0x62fc('0x8'));var attributes=require(_0x62fc('0x9'));module[_0x62fc('0xa')]=function(_0x4583ae,_0x37123f){return _0x4583ae['define'](_0x62fc('0xb'),attributes,{'tableName':_0x62fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 0360628..b2eec33 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 _0xd9e9=['include','map','model','GetFaxAccount','NotifyFaxAccount','body','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','CmContact','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','defaults','mapKey','contact','fax','FaxInteraction','find','spread','autoclose','length','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','ContactId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes'];(function(_0x4648a8,_0x469d5c){var _0x33ad1c=function(_0x33edfa){while(--_0x33edfa){_0x4648a8['push'](_0x4648a8['shift']());}};_0x33ad1c(++_0x469d5c);}(_0xd9e9,0x97));var _0x9d9e=function(_0x2d3a40,_0x1e31f){_0x2d3a40=_0x2d3a40-0x0;var _0x4da998=_0xd9e9[_0x2d3a40];return _0x4da998;};'use strict';var _=require(_0x9d9e('0x0'));var util=require(_0x9d9e('0x1'));var moment=require(_0x9d9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d9e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d9e('0x4'))(_0x9d9e('0x5'));var config=require(_0x9d9e('0x6'));var jayson=require(_0x9d9e('0x7'));var client=jayson[_0x9d9e('0x8')][_0x9d9e('0x9')]({'port':0x232c});config[_0x9d9e('0xa')]=_['defaults'](config[_0x9d9e('0xa')],{'host':_0x9d9e('0xb'),'port':0x18eb});var socket=require(_0x9d9e('0xc'))(new Redis(config[_0x9d9e('0xa')]));require(_0x9d9e('0xd'))[_0x9d9e('0xe')](socket);function respondWithRpcPromise(_0x1233c5,_0x1668bd,_0xc88d00){return new BPromise(function(_0x3bfe82,_0x46a1cf){return client[_0x9d9e('0xf')](_0x1233c5,_0xc88d00)[_0x9d9e('0x10')](function(_0x2bbd0e){logger[_0x9d9e('0x11')](_0x9d9e('0x12'),_0x1668bd,_0x9d9e('0x13'));logger[_0x9d9e('0x14')](_0x9d9e('0x15'),_0x1668bd,'request\x20sent',JSON[_0x9d9e('0x16')](_0x2bbd0e));if(_0x2bbd0e['error']){if(_0x2bbd0e['error']['code']===0x1f4){logger['error'](_0x9d9e('0x12'),_0x1668bd,_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);return _0x46a1cf(_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);}logger[_0x9d9e('0x17')](_0x9d9e('0x12'),_0x1668bd,_0x2bbd0e[_0x9d9e('0x17')]['message']);return _0x3bfe82(_0x2bbd0e[_0x9d9e('0x17')][_0x9d9e('0x18')]);}else{logger[_0x9d9e('0x11')]('FaxAccount,\x20%s,\x20%s',_0x1668bd,_0x9d9e('0x13'));_0x3bfe82(_0x2bbd0e[_0x9d9e('0x19')][_0x9d9e('0x18')]);}})[_0x9d9e('0x1a')](function(_0x51f196){logger[_0x9d9e('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1668bd,_0x51f196);_0x46a1cf(_0x51f196);});});}exports['GetFaxAccount']=function(_0x2c65e1){var _0xe2c608=this;return new Promise(function(_0x32be8f,_0x2564de){return db[_0x9d9e('0x1b')][_0x9d9e('0x1c')]({'raw':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x1f')]||null:null,'attributes':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x20')]||null:null,'limit':_0x2c65e1['options']?_0x2c65e1[_0x9d9e('0x1d')]['limit']||null:null,'include':_0x2c65e1[_0x9d9e('0x1d')]?_0x2c65e1[_0x9d9e('0x1d')][_0x9d9e('0x21')]?_[_0x9d9e('0x22')](_0x2c65e1['options'][_0x9d9e('0x21')],function(_0x1d1208){return{'model':db[_0x1d1208[_0x9d9e('0x23')]],'as':_0x1d1208['as'],'attributes':_0x1d1208[_0x9d9e('0x20')],'include':_0x1d1208[_0x9d9e('0x21')]?_[_0x9d9e('0x22')](_0x1d1208['include'],function(_0x2686b8){return{'model':db[_0x2686b8[_0x9d9e('0x23')]],'as':_0x2686b8['as'],'attributes':_0x2686b8[_0x9d9e('0x20')],'include':_0x2686b8[_0x9d9e('0x21')]?_['map'](_0x2686b8[_0x9d9e('0x21')],function(_0x2107fa){return{'model':db[_0x2107fa['model']],'as':_0x2107fa['as'],'attributes':_0x2107fa['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d9e('0x10')](function(_0x2118df){logger['info'](_0x9d9e('0x24'),_0x2c65e1);logger[_0x9d9e('0x14')](_0x9d9e('0x24'),_0x2c65e1,JSON[_0x9d9e('0x16')](_0x2118df));_0x32be8f(_0x2118df);})['catch'](function(_0x116753){logger[_0x9d9e('0x17')](_0x9d9e('0x24'),_0x116753[_0x9d9e('0x18')],_0x2c65e1);_0x2564de(_0xe2c608[_0x9d9e('0x17')](0x1f4,_0x116753['message']));});});};exports[_0x9d9e('0x25')]=function(_0x6ba640,_0x40583f,_0x5a7c2c){var _0xa03f00=this;return new Promise(function(_0xd8333e,_0x2fff4e){var _0x271edb={'body':_0x6ba640[_0x9d9e('0x26')],'channel':'fax'};var _0x4d4be5=[];var _0x214200=[];var _0x4f15df={};return db['CmContact'][_0x9d9e('0x27')]()[_0x9d9e('0x10')](function(_0x3a36c3){if(!_0x3a36c3){throw new db[(_0x9d9e('0x28'))]['ValidationError'](_0x9d9e('0x29'));}_0x4d4be5=_[_0x9d9e('0x2a')](_[_0x9d9e('0x2b')](_0x3a36c3),[_0x9d9e('0x2c'),'updatedAt']);_0x214200=_[_0x9d9e('0x2a')](_[_0x9d9e('0x2b')](_0x3a36c3),[_0x9d9e('0x2c'),_0x9d9e('0x2d'),_0x9d9e('0x2e'),_0x9d9e('0x2f')]);if(_0x6ba640['body']['id']){delete _0x6ba640[_0x9d9e('0x26')]['id'];}if(_['isNil'](_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x30')])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x32'));}if(_[_0x9d9e('0x33')](_0x6ba640['body'][_0x9d9e('0x26')])||_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x26')]===''){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x34'));}if(_[_0x9d9e('0x33')](_0x6ba640['body']['mapKey'])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x35')+_0x214200);}if(!_[_0x9d9e('0x36')](_0x214200,_0x6ba640[_0x9d9e('0x26')]['mapKey'])){throw new db[(_0x9d9e('0x28'))][(_0x9d9e('0x31'))](_0x9d9e('0x37')+_0x214200);}_0x4f15df[_0x6ba640[_0x9d9e('0x26')]['mapKey']]=_0x6ba640['body'][_0x9d9e('0x30')];})[_0x9d9e('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x6ba640[_0x9d9e('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0x9d9e('0x39'),'include':[{'model':db[_0x9d9e('0x3a')],'as':'Contacts','where':_0x4f15df,'limit':0x1,'order':[[_0x9d9e('0x2d'),_0x9d9e('0x3b')]]}]},{'model':db[_0x9d9e('0x3c')],'as':_0x9d9e('0x3d')}]});})['then'](function(_0xf6d822){if(_0xf6d822&&_0xf6d822[_0x9d9e('0x39')]){var _0xf9a195=_0xf6d822[_0x9d9e('0x3e')]({'plain':!![]});_0x271edb[_0x9d9e('0x38')]=_0xf9a195;_0x271edb[_0x9d9e('0x3f')]=_0xf9a195[_0x9d9e('0x3d')];_0x271edb[_0x9d9e('0x40')]=_0xf9a195[_0x9d9e('0x39')];_0x271edb['applications']=_[_0x9d9e('0x41')](_0x271edb['applications'],[_0x9d9e('0x42')],[_0x9d9e('0x43')]);if(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x3d')]){delete _0x271edb['account']['Applications'];}if(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x39')]&&_0x271edb['account']['List']['Contacts']['length']){return _0x271edb[_0x9d9e('0x38')]['List']['Contacts'][0x0];}var _0x31266f=_[_0x9d9e('0x44')](_0x6ba640[_0x9d9e('0x26')],{'firstName':_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x30')],'ListId':_0xf9a195[_0x9d9e('0x2f')]});_0x31266f[_0x6ba640[_0x9d9e('0x26')][_0x9d9e('0x45')]]=_0x6ba640['body'][_0x9d9e('0x30')];return db['CmContact']['create'](_0x31266f,{'fields':_0x4d4be5,'raw':!![]});}})[_0x9d9e('0x10')](function(_0xb055fd){_0x271edb[_0x9d9e('0x46')]=_0xb055fd;if(_0xb055fd){var _0x2e7da7={'ContactId':_0xb055fd['id'],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id'],'fax':_0xb055fd[_0x9d9e('0x47')]};return db[_0x9d9e('0x48')][_0x9d9e('0x49')]({'where':{'ContactId':_0xb055fd['id'],'closed':![],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id']}})[_0x9d9e('0x10')](function(_0x1c5d0d){if(_0x1c5d0d){return[_0x1c5d0d,![]];}return db[_0x9d9e('0x48')]['create'](_0x2e7da7)[_0x9d9e('0x10')](function(_0x9c5f5a){return[_0x9c5f5a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9d9e('0x4a')](function(_0x283007,_0x2b1476){var _0x17b42b=_0x283007[_0x9d9e('0x3e')]({'plain':!![]});if(_0x2b1476){if(_0x271edb['account'][_0x9d9e('0x4b')]){_0x271edb[_0x9d9e('0x3f')]['push']({'id':0x0,'priority':_0x271edb['applications'][_0x9d9e('0x4c')]+0x1,'app':'close','appdata':_0x9d9e('0x4d'),'interval':_0x9d9e('0x4e')});}_0x17b42b[_0x9d9e('0x4f')]=!![];}else{_0x17b42b[_0x9d9e('0x4f')]=![];}_0x271edb[_0x9d9e('0x50')]=_0x17b42b;return db[_0x9d9e('0x51')][_0x9d9e('0x52')]({'body':_0x6ba640['body'][_0x9d9e('0x26')],'FaxAccountId':_0x6ba640[_0x9d9e('0x38')]['id'],'FaxInteractionId':_0x283007['id'],'direction':'in','ContactId':_0x283007[_0x9d9e('0x53')],'AttachmentId':_0x6ba640[_0x9d9e('0x26')]['AttachmentId']});})['then'](function(_0x79eb82){_0x271edb[_0x9d9e('0x18')]=_0x79eb82;if(_0x271edb[_0x9d9e('0x50')]['UserId']){return db[_0x9d9e('0x54')][_0x9d9e('0x49')]({'attributes':['id','name'],'where':{'id':_0x271edb[_0x9d9e('0x50')][_0x9d9e('0x55')]}})[_0x9d9e('0x10')](function(_0x15a099){if(_0x15a099){_0x271edb[_0x9d9e('0x3f')][_0x9d9e('0x56')]({'id':0x0,'priority':0x0,'app':_0x9d9e('0x57'),'appdata':_0x15a099[_0x9d9e('0x58')]+','+(_0x271edb[_0x9d9e('0x38')][_0x9d9e('0x59')]||0xa),'interval':_0x9d9e('0x4e')});}return respondWithRpcPromise(_0x9d9e('0x5a'),_0x9d9e('0x5b'),_0x271edb);});}return respondWithRpcPromise(_0x9d9e('0x5a'),_0x9d9e('0x5b'),_0x271edb);})[_0x9d9e('0x10')](function(_0x440370){_0xd8333e(_0x440370);})['catch'](function(_0x5ee78c){_0x2fff4e(_0xa03f00[_0x9d9e('0x17')](0x1f4,_0x5ee78c['message']));});});}; \ No newline at end of file +var _0x112c=['result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','model','map','NotifyFaxAccount','body','fax','describe','Sequelize','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','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','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','create','contact','FaxInteraction','spread','autoclose','length','close','unmanaged','*,*,*,*','created','FaxMessage','interaction','User','name','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x112c,0xf5));var _0xc112=function(_0x37aabf,_0x44cc10){_0x37aabf=_0x37aabf-0x0;var _0x881478=_0x112c[_0x37aabf];return _0x881478;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var moment=require(_0xc112('0x2'));var BPromise=require(_0xc112('0x3'));var rs=require(_0xc112('0x4'));var fs=require('fs');var Redis=require(_0xc112('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc112('0x6'));var logger=require(_0xc112('0x7'))(_0xc112('0x8'));var config=require(_0xc112('0x9'));var jayson=require(_0xc112('0xa'));var client=jayson[_0xc112('0xb')][_0xc112('0xc')]({'port':0x232c});config[_0xc112('0xd')]=_[_0xc112('0xe')](config['redis'],{'host':_0xc112('0xf'),'port':0x18eb});var socket=require(_0xc112('0x10'))(new Redis(config['redis']));require(_0xc112('0x11'))[_0xc112('0x12')](socket);function respondWithRpcPromise(_0xc763e2,_0x5acf3f,_0x4c05ea){return new BPromise(function(_0x5f148f,_0x39e168){return client[_0xc112('0x13')](_0xc763e2,_0x4c05ea)[_0xc112('0x14')](function(_0x423277){logger[_0xc112('0x15')](_0xc112('0x16'),_0x5acf3f,_0xc112('0x17'));logger[_0xc112('0x18')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5acf3f,_0xc112('0x17'),JSON[_0xc112('0x19')](_0x423277));if(_0x423277['error']){if(_0x423277[_0xc112('0x1a')]['code']===0x1f4){logger[_0xc112('0x1a')](_0xc112('0x16'),_0x5acf3f,_0x423277['error'][_0xc112('0x1b')]);return _0x39e168(_0x423277['error'][_0xc112('0x1b')]);}logger[_0xc112('0x1a')](_0xc112('0x16'),_0x5acf3f,_0x423277[_0xc112('0x1a')][_0xc112('0x1b')]);return _0x5f148f(_0x423277[_0xc112('0x1a')][_0xc112('0x1b')]);}else{logger[_0xc112('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5acf3f,_0xc112('0x17'));_0x5f148f(_0x423277[_0xc112('0x1c')][_0xc112('0x1b')]);}})[_0xc112('0x1d')](function(_0x136a89){logger[_0xc112('0x1a')]('FaxAccount,\x20%s,\x20%s',_0x5acf3f,_0x136a89);_0x39e168(_0x136a89);});});}exports[_0xc112('0x1e')]=function(_0x322bea){var _0xf916b8=this;return new Promise(function(_0x13987a,_0x78e5be){return db[_0xc112('0x1f')][_0xc112('0x20')]({'raw':_0x322bea['options']?_0x322bea[_0xc112('0x21')][_0xc112('0x22')]===undefined?!![]:![]:!![],'where':_0x322bea[_0xc112('0x21')]?_0x322bea[_0xc112('0x21')]['where']||null:null,'attributes':_0x322bea[_0xc112('0x21')]?_0x322bea[_0xc112('0x21')][_0xc112('0x23')]||null:null,'limit':_0x322bea[_0xc112('0x21')]?_0x322bea[_0xc112('0x21')]['limit']||null:null,'include':_0x322bea['options']?_0x322bea[_0xc112('0x21')]['include']?_['map'](_0x322bea[_0xc112('0x21')][_0xc112('0x24')],function(_0x5dfb3f){return{'model':db[_0x5dfb3f[_0xc112('0x25')]],'as':_0x5dfb3f['as'],'attributes':_0x5dfb3f['attributes'],'include':_0x5dfb3f['include']?_['map'](_0x5dfb3f[_0xc112('0x24')],function(_0x24acca){return{'model':db[_0x24acca['model']],'as':_0x24acca['as'],'attributes':_0x24acca[_0xc112('0x23')],'include':_0x24acca[_0xc112('0x24')]?_[_0xc112('0x26')](_0x24acca[_0xc112('0x24')],function(_0x3a9be7){return{'model':db[_0x3a9be7['model']],'as':_0x3a9be7['as'],'attributes':_0x3a9be7[_0xc112('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x597f64){logger[_0xc112('0x15')](_0xc112('0x1e'),_0x322bea);logger[_0xc112('0x18')]('GetFaxAccount',_0x322bea,JSON[_0xc112('0x19')](_0x597f64));_0x13987a(_0x597f64);})[_0xc112('0x1d')](function(_0x3f401d){logger[_0xc112('0x1a')]('GetFaxAccount',_0x3f401d[_0xc112('0x1b')],_0x322bea);_0x78e5be(_0xf916b8[_0xc112('0x1a')](0x1f4,_0x3f401d[_0xc112('0x1b')]));});});};exports[_0xc112('0x27')]=function(_0x24988a,_0x541caf,_0x314766){var _0x18648b=this;return new Promise(function(_0x17bb4e,_0x2197cd){var _0x17a11c={'body':_0x24988a[_0xc112('0x28')],'channel':_0xc112('0x29')};var _0x1b8e29=[];var _0x57e8f7=[];var _0x55b3a9={};return db['CmContact'][_0xc112('0x2a')]()[_0xc112('0x14')](function(_0x225d25){if(!_0x225d25){throw new db[(_0xc112('0x2b'))]['ValidationError']('no\x20available\x20attributes');}_0x1b8e29=_[_0xc112('0x2c')](_[_0xc112('0x2d')](_0x225d25),[_0xc112('0x2e'),_0xc112('0x2f')]);_0x57e8f7=_['difference'](_[_0xc112('0x2d')](_0x225d25),[_0xc112('0x2e'),'updatedAt',_0xc112('0x30'),_0xc112('0x31')]);if(_0x24988a[_0xc112('0x28')]['id']){delete _0x24988a['body']['id'];}if(_[_0xc112('0x32')](_0x24988a[_0xc112('0x28')][_0xc112('0x33')])){throw new db[(_0xc112('0x2b'))][(_0xc112('0x34'))]('from\x20is\x20mandatory');}if(_[_0xc112('0x32')](_0x24988a[_0xc112('0x28')][_0xc112('0x28')])||_0x24988a[_0xc112('0x28')][_0xc112('0x28')]===''){throw new db[(_0xc112('0x2b'))]['ValidationError'](_0xc112('0x35'));}if(_['isNil'](_0x24988a[_0xc112('0x28')][_0xc112('0x36')])){throw new db[(_0xc112('0x2b'))]['ValidationError'](_0xc112('0x37')+_0x57e8f7);}if(!_[_0xc112('0x38')](_0x57e8f7,_0x24988a['body'][_0xc112('0x36')])){throw new db[(_0xc112('0x2b'))][(_0xc112('0x34'))](_0xc112('0x39')+_0x57e8f7);}_0x55b3a9[_0x24988a['body'][_0xc112('0x36')]]=_0x24988a[_0xc112('0x28')][_0xc112('0x33')];})[_0xc112('0x14')](function(){return db[_0xc112('0x1f')][_0xc112('0x3a')]({'where':{'id':_0x24988a[_0xc112('0x3b')]['id']},'include':[{'model':db[_0xc112('0x3c')],'as':_0xc112('0x3d'),'include':[{'model':db[_0xc112('0x3e')],'as':_0xc112('0x3f'),'where':_0x55b3a9,'limit':0x1,'order':[['updatedAt',_0xc112('0x40')]]}]},{'model':db[_0xc112('0x41')],'as':_0xc112('0x42')}]});})[_0xc112('0x14')](function(_0x20c9cb){if(_0x20c9cb&&_0x20c9cb[_0xc112('0x3d')]){var _0x3a9e41=_0x20c9cb[_0xc112('0x43')]({'plain':!![]});_0x17a11c[_0xc112('0x3b')]=_0x3a9e41;_0x17a11c[_0xc112('0x44')]=_0x3a9e41[_0xc112('0x42')];_0x17a11c[_0xc112('0x45')]=_0x3a9e41[_0xc112('0x3d')];_0x17a11c[_0xc112('0x44')]=_[_0xc112('0x46')](_0x17a11c['applications'],[_0xc112('0x47')],['asc']);if(_0x17a11c['account']['Applications']){delete _0x17a11c[_0xc112('0x3b')]['Applications'];}if(_0x17a11c[_0xc112('0x3b')][_0xc112('0x3d')]&&_0x17a11c['account'][_0xc112('0x3d')][_0xc112('0x3f')]['length']){return _0x17a11c[_0xc112('0x3b')][_0xc112('0x3d')][_0xc112('0x3f')][0x0];}var _0x55705d=_[_0xc112('0xe')](_0x24988a[_0xc112('0x28')],{'firstName':_0x24988a[_0xc112('0x28')]['from'],'ListId':_0x3a9e41[_0xc112('0x31')]});_0x55705d[_0x24988a[_0xc112('0x28')][_0xc112('0x36')]]=_0x24988a[_0xc112('0x28')][_0xc112('0x33')];return db[_0xc112('0x3e')][_0xc112('0x48')](_0x55705d,{'fields':_0x1b8e29,'raw':!![]});}})[_0xc112('0x14')](function(_0x4ac125){_0x17a11c[_0xc112('0x49')]=_0x4ac125;if(_0x4ac125){var _0x5cdce4={'ContactId':_0x4ac125['id'],'FaxAccountId':_0x24988a[_0xc112('0x3b')]['id'],'fax':_0x4ac125[_0xc112('0x29')]};return db[_0xc112('0x4a')][_0xc112('0x3a')]({'where':{'ContactId':_0x4ac125['id'],'closed':![],'FaxAccountId':_0x24988a[_0xc112('0x3b')]['id']}})['then'](function(_0x5527ea){if(_0x5527ea){return[_0x5527ea,![]];}return db['FaxInteraction'][_0xc112('0x48')](_0x5cdce4)[_0xc112('0x14')](function(_0x3720f1){return[_0x3720f1,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc112('0x4b')](function(_0x24f42c,_0x4fa344){var _0x1de9e3=_0x24f42c[_0xc112('0x43')]({'plain':!![]});if(_0x4fa344){if(_0x17a11c[_0xc112('0x3b')][_0xc112('0x4c')]){_0x17a11c[_0xc112('0x44')]['push']({'id':0x0,'priority':_0x17a11c[_0xc112('0x44')][_0xc112('0x4d')]+0x1,'app':_0xc112('0x4e'),'appdata':_0xc112('0x4f'),'interval':_0xc112('0x50')});}_0x1de9e3[_0xc112('0x51')]=!![];}else{_0x1de9e3['created']=![];}_0x17a11c['interaction']=_0x1de9e3;return db[_0xc112('0x52')][_0xc112('0x48')]({'body':_0x24988a[_0xc112('0x28')]['body'],'FaxAccountId':_0x24988a[_0xc112('0x3b')]['id'],'FaxInteractionId':_0x24f42c['id'],'direction':'in','ContactId':_0x24f42c['ContactId'],'AttachmentId':_0x24988a[_0xc112('0x28')]['AttachmentId']});})[_0xc112('0x14')](function(_0x4c2891){_0x17a11c[_0xc112('0x1b')]=_0x4c2891;if(_0x17a11c[_0xc112('0x53')]['UserId']){return db[_0xc112('0x54')][_0xc112('0x3a')]({'attributes':['id',_0xc112('0x55')],'where':{'id':_0x17a11c[_0xc112('0x53')][_0xc112('0x56')]}})['then'](function(_0xaa9487){if(_0xaa9487){_0x17a11c[_0xc112('0x44')][_0xc112('0x57')]({'id':0x0,'priority':0x0,'app':_0xc112('0x58'),'appdata':_0xaa9487['name']+','+(_0x17a11c[_0xc112('0x3b')][_0xc112('0x59')]||0xa),'interval':_0xc112('0x50')});}return respondWithRpcPromise('Start',_0xc112('0x5a'),_0x17a11c);});}return respondWithRpcPromise('Start',_0xc112('0x5a'),_0x17a11c);})['then'](function(_0x427686){_0x17bb4e(_0x427686);})[_0xc112('0x1d')](function(_0x1cb115){_0x2197cd(_0x18648b[_0xc112('0x1a')](0x1f4,_0x1cb115[_0xc112('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 90c9ba0..46dad88 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 _0x526c=['register','./faxAccount.events','save','remove','update'];(function(_0x550b36,_0x5c0cc7){var _0x5e7b34=function(_0x1e83b2){while(--_0x1e83b2){_0x550b36['push'](_0x550b36['shift']());}};_0x5e7b34(++_0x5c0cc7);}(_0x526c,0x173));var _0xc526=function(_0x2211b2,_0x3c32a7){_0x2211b2=_0x2211b2-0x0;var _0x1ff209=_0x526c[_0x2211b2];return _0x1ff209;};'use strict';var FaxAccountEvents=require(_0xc526('0x0'));var events=[_0xc526('0x1'),_0xc526('0x2'),_0xc526('0x3')];function createListener(_0xaff817,_0x23ff28){return function(_0x46542a){_0x23ff28['emit'](_0xaff817,_0x46542a);};}function removeListener(_0x5e0104,_0xd08f18){return function(){FaxAccountEvents['removeListener'](_0x5e0104,_0xd08f18);};}exports[_0xc526('0x4')]=function(_0x19f828){for(var _0x322aff=0x0,_0x5f1fc4=events['length'];_0x322aff<_0x5f1fc4;_0x322aff++){var _0x17913c=events[_0x322aff];var _0x411c03=createListener('faxAccount:'+_0x17913c,_0x19f828);FaxAccountEvents['on'](_0x17913c,_0x411c03);}}; \ No newline at end of file +var _0x8220=['length','./faxAccount.events','save','removeListener'];(function(_0x456f45,_0x1c53a5){var _0x2ddc34=function(_0x5d42c5){while(--_0x5d42c5){_0x456f45['push'](_0x456f45['shift']());}};_0x2ddc34(++_0x1c53a5);}(_0x8220,0x99));var _0x0822=function(_0x2ea183,_0x3cff11){_0x2ea183=_0x2ea183-0x0;var _0x47c16c=_0x8220[_0x2ea183];return _0x47c16c;};'use strict';var FaxAccountEvents=require(_0x0822('0x0'));var events=[_0x0822('0x1'),'remove','update'];function createListener(_0x2efbe0,_0x49b1bd){return function(_0x2ef8b9){_0x49b1bd['emit'](_0x2efbe0,_0x2ef8b9);};}function removeListener(_0xffdceb,_0x2fc244){return function(){FaxAccountEvents[_0x0822('0x2')](_0xffdceb,_0x2fc244);};}exports['register']=function(_0x329568){for(var _0x504016=0x0,_0x3814ab=events[_0x0822('0x3')];_0x504016<_0x3814ab;_0x504016++){var _0x413335=events[_0x504016];var _0xe48074=createListener('faxAccount:'+_0x413335,_0x329568);FaxAccountEvents['on'](_0x413335,_0xe48074);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d1bd200..aae0b9d 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(_0x3f9383,_0x5da6dd){var _0x14c351=function(_0x10c839){while(--_0x10c839){_0x3f9383['push'](_0x3f9383['shift']());}};_0x14c351(++_0x5da6dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x54793c,_0x2fd39a){var _0x45ccf4=function(_0x265bdc){while(--_0x265bdc){_0x54793c['push'](_0x54793c['shift']());}};_0x45ccf4(++_0x2fd39a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 67e1cb8..071d3b9 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 _0x7571=['TEXT','STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x31ba05,_0x1c9962){var _0x44918a=function(_0x516421){while(--_0x516421){_0x31ba05['push'](_0x31ba05['shift']());}};_0x44918a(++_0x1c9962);}(_0x7571,0x14d));var _0x1757=function(_0x4b23ff,_0x4cd098){_0x4b23ff=_0x4b23ff-0x0;var _0x5ebef7=_0x7571[_0x4b23ff];return _0x5ebef7;};'use strict';var Sequelize=require('sequelize');module[_0x1757('0x0')]={'priority':{'type':Sequelize[_0x1757('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1757('0x2')},'appdata':{'type':Sequelize[_0x1757('0x3')]()},'description':{'type':Sequelize[_0x1757('0x4')]},'interval':{'type':Sequelize[_0x1757('0x4')],'defaultValue':_0x1757('0x5')}}; \ No newline at end of file +var _0xf10e=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x304e3a,_0x249170){var _0x2f51b3=function(_0x4f635c){while(--_0x4f635c){_0x304e3a['push'](_0x304e3a['shift']());}};_0x2f51b3(++_0x249170);}(_0xf10e,0x194));var _0xef10=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xf10e[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require('sequelize');module[_0xef10('0x0')]={'priority':{'type':Sequelize[_0xef10('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xef10('0x2')],'allowNull':![],'defaultValue':_0xef10('0x3')},'appdata':{'type':Sequelize[_0xef10('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xef10('0x2')],'defaultValue':_0xef10('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e70dea6..d890acb 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 _0xef92=['options','then','includeAll','include','rows','catch','show','merge','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','apply','save','destroy','end','error','stack','name','send','index','map','FaxApplication','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x2d4c47,_0xb34b19){var _0x1d761d=function(_0x57a124){while(--_0x57a124){_0x2d4c47['push'](_0x2d4c47['shift']());}};_0x1d761d(++_0xb34b19);}(_0xef92,0xa7));var _0x2ef9=function(_0x259b67,_0x5de37e){_0x259b67=_0x259b67-0x0;var _0x2e7e2b=_0xef92[_0x259b67];return _0x2e7e2b;};'use strict';var emlformat=require(_0x2ef9('0x0'));var rimraf=require(_0x2ef9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ef9('0x2'));var rp=require(_0x2ef9('0x3'));var moment=require(_0x2ef9('0x4'));var BPromise=require(_0x2ef9('0x5'));var Mustache=require(_0x2ef9('0x6'));var util=require(_0x2ef9('0x7'));var path=require(_0x2ef9('0x8'));var sox=require(_0x2ef9('0x9'));var csv=require('to-csv');var ejs=require(_0x2ef9('0xa'));var fs=require('fs');var fs_extra=require(_0x2ef9('0xb'));var _=require(_0x2ef9('0xc'));var squel=require(_0x2ef9('0xd'));var crypto=require(_0x2ef9('0xe'));var jsforce=require(_0x2ef9('0xf'));var deskjs=require(_0x2ef9('0x10'));var toCsv=require(_0x2ef9('0x11'));var querystring=require(_0x2ef9('0x12'));var Papa=require(_0x2ef9('0x13'));var Redis=require(_0x2ef9('0x14'));var authService=require(_0x2ef9('0x15'));var qs=require(_0x2ef9('0x16'));var as=require(_0x2ef9('0x17'));var hardwareService=require(_0x2ef9('0x18'));var logger=require(_0x2ef9('0x19'))('api');var utils=require(_0x2ef9('0x1a'));var config=require(_0x2ef9('0x1b'));var licenseUtil=require(_0x2ef9('0x1c'));var db=require(_0x2ef9('0x1d'))['db'];function respondWithStatusCode(_0x50f22f,_0x22ba46){_0x22ba46=_0x22ba46||0xcc;return function(_0x4d5493){if(_0x4d5493){return _0x50f22f['sendStatus'](_0x22ba46);}return _0x50f22f[_0x2ef9('0x1e')](_0x22ba46)['end']();};}function respondWithResult(_0x2a3860,_0x2dc8a1){_0x2dc8a1=_0x2dc8a1||0xc8;return function(_0x10017f){if(_0x10017f){return _0x2a3860[_0x2ef9('0x1e')](_0x2dc8a1)[_0x2ef9('0x1f')](_0x10017f);}};}function respondWithFilteredResult(_0xd76be,_0x25a204){return function(_0x56594f){if(_0x56594f){var _0x133df9=typeof _0x25a204[_0x2ef9('0x20')]==='undefined'&&typeof _0x25a204[_0x2ef9('0x21')]==='undefined';var _0x3306c6=_0x56594f[_0x2ef9('0x22')];var _0x698e19=_0x133df9?0x0:_0x25a204[_0x2ef9('0x20')];var _0x2847ae=_0x133df9?_0x56594f['count']:_0x25a204['offset']+_0x25a204[_0x2ef9('0x21')];var _0x3387f3;if(_0x2847ae>=_0x3306c6){_0x2847ae=_0x3306c6;_0x3387f3=0xc8;}else{_0x3387f3=0xce;}_0xd76be[_0x2ef9('0x1e')](_0x3387f3);return _0xd76be[_0x2ef9('0x23')]('Content-Range',_0x698e19+'-'+_0x2847ae+'/'+_0x3306c6)[_0x2ef9('0x1f')](_0x56594f);}return null;};}function patchUpdates(_0x24d4ef){return function(_0x2088b1){try{jsonpatch[_0x2ef9('0x24')](_0x2088b1,_0x24d4ef,!![]);}catch(_0x4e3b05){return BPromise['reject'](_0x4e3b05);}return _0x2088b1[_0x2ef9('0x25')]();};}function saveUpdates(_0x1e720d,_0x17ca14){return function(_0x27dbac){if(_0x27dbac){return _0x27dbac['update'](_0x1e720d)['then'](function(_0x508e64){return _0x508e64;});}return null;};}function removeEntity(_0x4545e9,_0x3389aa){return function(_0x5b065c){if(_0x5b065c){return _0x5b065c[_0x2ef9('0x26')]()['then'](function(){_0x4545e9[_0x2ef9('0x1e')](0xcc)[_0x2ef9('0x27')]();});}};}function handleEntityNotFound(_0x1abfd6,_0x57bbee){return function(_0x4f6e79){if(!_0x4f6e79){_0x1abfd6['sendStatus'](0x194);}return _0x4f6e79;};}function handleError(_0x5b4b89,_0x168126){_0x168126=_0x168126||0x1f4;return function(_0x1e9dcf){logger[_0x2ef9('0x28')](_0x1e9dcf[_0x2ef9('0x29')]);if(_0x1e9dcf[_0x2ef9('0x2a')]){delete _0x1e9dcf[_0x2ef9('0x2a')];}_0x5b4b89[_0x2ef9('0x1e')](_0x168126)[_0x2ef9('0x2b')](_0x1e9dcf);};}exports[_0x2ef9('0x2c')]=function(_0x4cd563,_0x2fa259){var _0x4a112a={},_0x1749ee={},_0x127beb={'count':0x0,'rows':[]};var _0x238b09=_[_0x2ef9('0x2d')](db[_0x2ef9('0x2e')]['rawAttributes'],function(_0x433c33){return{'name':_0x433c33['fieldName'],'type':_0x433c33[_0x2ef9('0x2f')][_0x2ef9('0x30')]};});_0x1749ee[_0x2ef9('0x31')]=_['map'](_0x238b09,_0x2ef9('0x2a'));_0x1749ee[_0x2ef9('0x32')]=_[_0x2ef9('0x33')](_0x4cd563[_0x2ef9('0x32')]);_0x1749ee[_0x2ef9('0x34')]=_[_0x2ef9('0x35')](_0x1749ee[_0x2ef9('0x31')],_0x1749ee[_0x2ef9('0x32')]);_0x4a112a[_0x2ef9('0x36')]=_[_0x2ef9('0x35')](_0x1749ee[_0x2ef9('0x31')],qs[_0x2ef9('0x37')](_0x4cd563[_0x2ef9('0x32')][_0x2ef9('0x37')]));_0x4a112a['attributes']=_0x4a112a['attributes'][_0x2ef9('0x38')]?_0x4a112a[_0x2ef9('0x36')]:_0x1749ee[_0x2ef9('0x31')];if(!_0x4cd563['query']['hasOwnProperty'](_0x2ef9('0x39'))){_0x4a112a['limit']=qs['limit'](_0x4cd563['query'][_0x2ef9('0x21')]);_0x4a112a[_0x2ef9('0x20')]=qs[_0x2ef9('0x20')](_0x4cd563['query']['offset']);}_0x4a112a[_0x2ef9('0x3a')]=qs[_0x2ef9('0x3b')](_0x4cd563[_0x2ef9('0x32')]['sort']);_0x4a112a['where']=qs['filters'](_[_0x2ef9('0x3c')](_0x4cd563[_0x2ef9('0x32')],_0x1749ee[_0x2ef9('0x34')]),_0x238b09);if(_0x4cd563['query'][_0x2ef9('0x3d')]){_0x4a112a['where']=_['merge'](_0x4a112a[_0x2ef9('0x3e')],{'$or':_[_0x2ef9('0x2d')](_0x238b09,function(_0x5d0d77){if(_0x5d0d77[_0x2ef9('0x2f')]!==_0x2ef9('0x3f')){var _0x53eaa5={};_0x53eaa5[_0x5d0d77[_0x2ef9('0x2a')]]={'$like':'%'+_0x4cd563[_0x2ef9('0x32')]['filter']+'%'};return _0x53eaa5;}})});}_0x4a112a=_['merge']({},_0x4a112a,_0x4cd563[_0x2ef9('0x40')]);var _0x15e74a={'where':_0x4a112a[_0x2ef9('0x3e')]};return db['FaxApplication'][_0x2ef9('0x22')](_0x15e74a)[_0x2ef9('0x41')](function(_0x98cb95){_0x127beb[_0x2ef9('0x22')]=_0x98cb95;if(_0x4cd563[_0x2ef9('0x32')][_0x2ef9('0x42')]){_0x4a112a[_0x2ef9('0x43')]=[{'all':!![]}];}return db[_0x2ef9('0x2e')]['findAll'](_0x4a112a);})[_0x2ef9('0x41')](function(_0x5787cb){_0x127beb[_0x2ef9('0x44')]=_0x5787cb;return _0x127beb;})[_0x2ef9('0x41')](respondWithFilteredResult(_0x2fa259,_0x4a112a))[_0x2ef9('0x45')](handleError(_0x2fa259,null));};exports[_0x2ef9('0x46')]=function(_0x2882b8,_0x59bbab){var _0x35a23a={'raw':!![],'where':{'id':_0x2882b8['params']['id']}},_0x3f0083={};_0x3f0083[_0x2ef9('0x31')]=_[_0x2ef9('0x33')](db['FaxApplication']['rawAttributes']);_0x3f0083[_0x2ef9('0x32')]=_['keys'](_0x2882b8[_0x2ef9('0x32')]);_0x3f0083[_0x2ef9('0x34')]=_[_0x2ef9('0x35')](_0x3f0083[_0x2ef9('0x31')],_0x3f0083['query']);_0x35a23a['attributes']=_[_0x2ef9('0x35')](_0x3f0083[_0x2ef9('0x31')],qs[_0x2ef9('0x37')](_0x2882b8['query'][_0x2ef9('0x37')]));_0x35a23a['attributes']=_0x35a23a['attributes']['length']?_0x35a23a[_0x2ef9('0x36')]:_0x3f0083[_0x2ef9('0x31')];if(_0x2882b8[_0x2ef9('0x32')][_0x2ef9('0x42')]){_0x35a23a[_0x2ef9('0x43')]=[{'all':!![]}];}_0x35a23a=_[_0x2ef9('0x47')]({},_0x35a23a,_0x2882b8['options']);return db[_0x2ef9('0x2e')][_0x2ef9('0x48')](_0x35a23a)[_0x2ef9('0x41')](handleEntityNotFound(_0x59bbab,null))[_0x2ef9('0x41')](respondWithResult(_0x59bbab,null))[_0x2ef9('0x45')](handleError(_0x59bbab,null));};exports[_0x2ef9('0x49')]=function(_0x31ae39,_0x5b98fb){return db[_0x2ef9('0x2e')][_0x2ef9('0x49')](_0x31ae39[_0x2ef9('0x4a')],{})[_0x2ef9('0x41')](respondWithResult(_0x5b98fb,0xc9))['catch'](handleError(_0x5b98fb,null));};exports[_0x2ef9('0x4b')]=function(_0x10cf40,_0x2cd1ee){if(_0x10cf40[_0x2ef9('0x4a')]['id']){delete _0x10cf40['body']['id'];}return db[_0x2ef9('0x2e')][_0x2ef9('0x48')]({'where':{'id':_0x10cf40[_0x2ef9('0x4c')]['id']}})[_0x2ef9('0x41')](handleEntityNotFound(_0x2cd1ee,null))[_0x2ef9('0x41')](saveUpdates(_0x10cf40[_0x2ef9('0x4a')],null))[_0x2ef9('0x41')](respondWithResult(_0x2cd1ee,null))[_0x2ef9('0x45')](handleError(_0x2cd1ee,null));};exports['destroy']=function(_0x51520c,_0xe57461){return db['FaxApplication'][_0x2ef9('0x48')]({'where':{'id':_0x51520c[_0x2ef9('0x4c')]['id']}})[_0x2ef9('0x41')](handleEntityNotFound(_0xe57461,null))[_0x2ef9('0x41')](removeEntity(_0xe57461,null))[_0x2ef9('0x45')](handleError(_0xe57461,null));}; \ No newline at end of file +var _0x2037=['offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','VIRTUAL','merge','FaxApplication','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xbbaf87,_0x43b64f){var _0x454b4f=function(_0x25936f){while(--_0x25936f){_0xbbaf87['push'](_0xbbaf87['shift']());}};_0x454b4f(++_0x43b64f);}(_0x2037,0x77));var _0x7203=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x2037[_0x34b821];return _0x5e00a0;};'use strict';var emlformat=require(_0x7203('0x0'));var rimraf=require(_0x7203('0x1'));var zipdir=require(_0x7203('0x2'));var jsonpatch=require(_0x7203('0x3'));var rp=require(_0x7203('0x4'));var moment=require(_0x7203('0x5'));var BPromise=require(_0x7203('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7203('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7203('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7203('0x9'));var jsforce=require(_0x7203('0xa'));var deskjs=require(_0x7203('0xb'));var toCsv=require(_0x7203('0x7'));var querystring=require(_0x7203('0xc'));var Papa=require(_0x7203('0xd'));var Redis=require(_0x7203('0xe'));var authService=require(_0x7203('0xf'));var qs=require(_0x7203('0x10'));var as=require(_0x7203('0x11'));var hardwareService=require(_0x7203('0x12'));var logger=require(_0x7203('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x7203('0x14'));var licenseUtil=require(_0x7203('0x15'));var db=require(_0x7203('0x16'))['db'];function respondWithStatusCode(_0x52c36d,_0x1bfd7c){_0x1bfd7c=_0x1bfd7c||0xcc;return function(_0x315805){if(_0x315805){return _0x52c36d[_0x7203('0x17')](_0x1bfd7c);}return _0x52c36d[_0x7203('0x18')](_0x1bfd7c)[_0x7203('0x19')]();};}function respondWithResult(_0x3250a9,_0x2341eb){_0x2341eb=_0x2341eb||0xc8;return function(_0x185e79){if(_0x185e79){return _0x3250a9[_0x7203('0x18')](_0x2341eb)[_0x7203('0x1a')](_0x185e79);}};}function respondWithFilteredResult(_0x5b49fb,_0x3d3f1f){return function(_0x351a97){if(_0x351a97){var _0x4bed49=typeof _0x3d3f1f[_0x7203('0x1b')]===_0x7203('0x1c')&&typeof _0x3d3f1f['limit']===_0x7203('0x1c');var _0x7a9ce8=_0x351a97[_0x7203('0x1d')];var _0x4fd6c5=_0x4bed49?0x0:_0x3d3f1f[_0x7203('0x1b')];var _0x523c98=_0x4bed49?_0x351a97[_0x7203('0x1d')]:_0x3d3f1f[_0x7203('0x1b')]+_0x3d3f1f['limit'];var _0x55e9f1;if(_0x523c98>=_0x7a9ce8){_0x523c98=_0x7a9ce8;_0x55e9f1=0xc8;}else{_0x55e9f1=0xce;}_0x5b49fb[_0x7203('0x18')](_0x55e9f1);return _0x5b49fb[_0x7203('0x1e')](_0x7203('0x1f'),_0x4fd6c5+'-'+_0x523c98+'/'+_0x7a9ce8)[_0x7203('0x1a')](_0x351a97);}return null;};}function patchUpdates(_0x1e4aa2){return function(_0x35628f){try{jsonpatch[_0x7203('0x20')](_0x35628f,_0x1e4aa2,!![]);}catch(_0x276215){return BPromise[_0x7203('0x21')](_0x276215);}return _0x35628f[_0x7203('0x22')]();};}function saveUpdates(_0x4ab47c,_0x47cc60){return function(_0x572556){if(_0x572556){return _0x572556['update'](_0x4ab47c)['then'](function(_0x5b15bb){return _0x5b15bb;});}return null;};}function removeEntity(_0x27e769,_0x547ed5){return function(_0x4232d4){if(_0x4232d4){return _0x4232d4[_0x7203('0x23')]()[_0x7203('0x24')](function(){_0x27e769[_0x7203('0x18')](0xcc)[_0x7203('0x19')]();});}};}function handleEntityNotFound(_0x4d221b,_0x358d3d){return function(_0x5989bc){if(!_0x5989bc){_0x4d221b['sendStatus'](0x194);}return _0x5989bc;};}function handleError(_0x4a9aef,_0xf7509){_0xf7509=_0xf7509||0x1f4;return function(_0x3244b){logger[_0x7203('0x25')](_0x3244b[_0x7203('0x26')]);if(_0x3244b[_0x7203('0x27')]){delete _0x3244b[_0x7203('0x27')];}_0x4a9aef['status'](_0xf7509)['send'](_0x3244b);};}exports[_0x7203('0x28')]=function(_0x231c41,_0x119513){var _0x1a4fd9={},_0x5aaf10={},_0x480b8f={'count':0x0,'rows':[]};var _0x5617eb=_[_0x7203('0x29')](db['FaxApplication'][_0x7203('0x2a')],function(_0x3c8e65){return{'name':_0x3c8e65['fieldName'],'type':_0x3c8e65[_0x7203('0x2b')][_0x7203('0x2c')]};});_0x5aaf10[_0x7203('0x2d')]=_[_0x7203('0x29')](_0x5617eb,_0x7203('0x27'));_0x5aaf10[_0x7203('0x2e')]=_[_0x7203('0x2f')](_0x231c41[_0x7203('0x2e')]);_0x5aaf10[_0x7203('0x30')]=_[_0x7203('0x31')](_0x5aaf10[_0x7203('0x2d')],_0x5aaf10['query']);_0x1a4fd9[_0x7203('0x32')]=_[_0x7203('0x31')](_0x5aaf10[_0x7203('0x2d')],qs[_0x7203('0x33')](_0x231c41[_0x7203('0x2e')][_0x7203('0x33')]));_0x1a4fd9[_0x7203('0x32')]=_0x1a4fd9['attributes']['length']?_0x1a4fd9[_0x7203('0x32')]:_0x5aaf10[_0x7203('0x2d')];if(!_0x231c41[_0x7203('0x2e')][_0x7203('0x34')](_0x7203('0x35'))){_0x1a4fd9[_0x7203('0x36')]=qs[_0x7203('0x36')](_0x231c41['query']['limit']);_0x1a4fd9[_0x7203('0x1b')]=qs[_0x7203('0x1b')](_0x231c41[_0x7203('0x2e')]['offset']);}_0x1a4fd9[_0x7203('0x37')]=qs[_0x7203('0x38')](_0x231c41[_0x7203('0x2e')]['sort']);_0x1a4fd9['where']=qs[_0x7203('0x30')](_['pick'](_0x231c41[_0x7203('0x2e')],_0x5aaf10[_0x7203('0x30')]),_0x5617eb);if(_0x231c41[_0x7203('0x2e')][_0x7203('0x39')]){_0x1a4fd9['where']=_['merge'](_0x1a4fd9['where'],{'$or':_['map'](_0x5617eb,function(_0x36b609){if(_0x36b609[_0x7203('0x2b')]!==_0x7203('0x3a')){var _0xa37e2c={};_0xa37e2c[_0x36b609[_0x7203('0x27')]]={'$like':'%'+_0x231c41[_0x7203('0x2e')][_0x7203('0x39')]+'%'};return _0xa37e2c;}})});}_0x1a4fd9=_[_0x7203('0x3b')]({},_0x1a4fd9,_0x231c41['options']);var _0x7bad93={'where':_0x1a4fd9['where']};return db[_0x7203('0x3c')][_0x7203('0x1d')](_0x7bad93)['then'](function(_0x27d062){_0x480b8f[_0x7203('0x1d')]=_0x27d062;if(_0x231c41[_0x7203('0x2e')][_0x7203('0x3d')]){_0x1a4fd9[_0x7203('0x3e')]=[{'all':!![]}];}return db[_0x7203('0x3c')][_0x7203('0x3f')](_0x1a4fd9);})[_0x7203('0x24')](function(_0x266fe8){_0x480b8f[_0x7203('0x40')]=_0x266fe8;return _0x480b8f;})[_0x7203('0x24')](respondWithFilteredResult(_0x119513,_0x1a4fd9))[_0x7203('0x41')](handleError(_0x119513,null));};exports['show']=function(_0x2aadc3,_0xfabe22){var _0x37cafd={'raw':!![],'where':{'id':_0x2aadc3[_0x7203('0x42')]['id']}},_0x6fba03={};_0x6fba03[_0x7203('0x2d')]=_[_0x7203('0x2f')](db[_0x7203('0x3c')]['rawAttributes']);_0x6fba03[_0x7203('0x2e')]=_[_0x7203('0x2f')](_0x2aadc3[_0x7203('0x2e')]);_0x6fba03[_0x7203('0x30')]=_[_0x7203('0x31')](_0x6fba03[_0x7203('0x2d')],_0x6fba03[_0x7203('0x2e')]);_0x37cafd[_0x7203('0x32')]=_[_0x7203('0x31')](_0x6fba03[_0x7203('0x2d')],qs['fields'](_0x2aadc3[_0x7203('0x2e')]['fields']));_0x37cafd[_0x7203('0x32')]=_0x37cafd[_0x7203('0x32')][_0x7203('0x43')]?_0x37cafd[_0x7203('0x32')]:_0x6fba03[_0x7203('0x2d')];if(_0x2aadc3['query'][_0x7203('0x3d')]){_0x37cafd[_0x7203('0x3e')]=[{'all':!![]}];}_0x37cafd=_[_0x7203('0x3b')]({},_0x37cafd,_0x2aadc3[_0x7203('0x44')]);return db[_0x7203('0x3c')][_0x7203('0x45')](_0x37cafd)[_0x7203('0x24')](handleEntityNotFound(_0xfabe22,null))[_0x7203('0x24')](respondWithResult(_0xfabe22,null))[_0x7203('0x41')](handleError(_0xfabe22,null));};exports[_0x7203('0x46')]=function(_0x426b68,_0xb68898){return db[_0x7203('0x3c')][_0x7203('0x46')](_0x426b68[_0x7203('0x47')],{})[_0x7203('0x24')](respondWithResult(_0xb68898,0xc9))[_0x7203('0x41')](handleError(_0xb68898,null));};exports[_0x7203('0x48')]=function(_0x409032,_0x2a5929){if(_0x409032['body']['id']){delete _0x409032[_0x7203('0x47')]['id'];}return db[_0x7203('0x3c')][_0x7203('0x45')]({'where':{'id':_0x409032[_0x7203('0x42')]['id']}})[_0x7203('0x24')](handleEntityNotFound(_0x2a5929,null))[_0x7203('0x24')](saveUpdates(_0x409032[_0x7203('0x47')],null))['then'](respondWithResult(_0x2a5929,null))[_0x7203('0x41')](handleError(_0x2a5929,null));};exports[_0x7203('0x23')]=function(_0x767ba4,_0x1b927e){return db['FaxApplication'][_0x7203('0x45')]({'where':{'id':_0x767ba4[_0x7203('0x42')]['id']}})[_0x7203('0x24')](handleEntityNotFound(_0x1b927e,null))[_0x7203('0x24')](removeEntity(_0x1b927e,null))[_0x7203('0x41')](handleError(_0x1b927e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index efae8cc..3d804bf 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 _0x5250=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x49d522,_0x2b324f){var _0x3f88a3=function(_0x459562){while(--_0x459562){_0x49d522['push'](_0x49d522['shift']());}};_0x3f88a3(++_0x2b324f);}(_0x5250,0x7b));var _0x0525=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0x5250[_0x15d18f];return _0xd12bf7;};'use strict';var _=require(_0x0525('0x0'));var util=require(_0x0525('0x1'));var logger=require(_0x0525('0x2'))(_0x0525('0x3'));var moment=require(_0x0525('0x4'));var BPromise=require('bluebird');var rp=require(_0x0525('0x5'));var fs=require('fs');var path=require(_0x0525('0x6'));var rimraf=require(_0x0525('0x7'));var config=require(_0x0525('0x8'));var attributes=require('./faxApplication.attributes');module[_0x0525('0x9')]=function(_0x394c0b,_0x35eb7a){return _0x394c0b[_0x0525('0xa')](_0x0525('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0525('0xc'),'collate':_0x0525('0xd')});}; \ No newline at end of file +var _0x37cc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x12bfd2,_0x2079b6){var _0x2c6a25=function(_0x1ed3ee){while(--_0x1ed3ee){_0x12bfd2['push'](_0x12bfd2['shift']());}};_0x2c6a25(++_0x2079b6);}(_0x37cc,0xf6));var _0xc37c=function(_0x567793,_0x270c72){_0x567793=_0x567793-0x0;var _0x1d7cc9=_0x37cc[_0x567793];return _0x1d7cc9;};'use strict';var _=require('lodash');var util=require(_0xc37c('0x0'));var logger=require(_0xc37c('0x1'))('api');var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rp=require(_0xc37c('0x4'));var fs=require('fs');var path=require(_0xc37c('0x5'));var rimraf=require(_0xc37c('0x6'));var config=require('../../config/environment');var attributes=require(_0xc37c('0x7'));module[_0xc37c('0x8')]=function(_0x33b49b,_0x56522a){return _0x33b49b[_0xc37c('0x9')]('FaxApplication',attributes,{'tableName':_0xc37c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc37c('0xb'),'collate':_0xc37c('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 3fadead..7beedb8 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 _0x7ca3=['rpc','../../config/environment','jayson/promise','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateFaxApplication','FaxApplication','update','options','raw','attributes','limit','then','info','stringify','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7ca3,0xa3));var _0x37ca=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0x7ca3[_0x323c7e];return _0x2b0f72;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37ca('0x0'));var BPromise=require(_0x37ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37ca('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x37ca('0x3'));var logger=require(_0x37ca('0x4'))(_0x37ca('0x5'));var config=require(_0x37ca('0x6'));var jayson=require(_0x37ca('0x7'));var client=jayson['client'][_0x37ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25d9a8,_0x3611b7,_0x317972){return new BPromise(function(_0x5bcfcf,_0x2b6cca){return client[_0x37ca('0x9')](_0x25d9a8,_0x317972)['then'](function(_0x1404d3){logger['info'](_0x37ca('0xa'),_0x3611b7,_0x37ca('0xb'));logger[_0x37ca('0xc')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3611b7,_0x37ca('0xb'),JSON['stringify'](_0x1404d3));if(_0x1404d3['error']){if(_0x1404d3[_0x37ca('0xd')][_0x37ca('0xe')]===0x1f4){logger['error'](_0x37ca('0xa'),_0x3611b7,_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);return _0x2b6cca(_0x1404d3[_0x37ca('0xd')]['message']);}logger[_0x37ca('0xd')](_0x37ca('0xa'),_0x3611b7,_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);return _0x5bcfcf(_0x1404d3[_0x37ca('0xd')][_0x37ca('0xf')]);}else{logger['info'](_0x37ca('0xa'),_0x3611b7,_0x37ca('0xb'));_0x5bcfcf(_0x1404d3[_0x37ca('0x10')][_0x37ca('0xf')]);}})['catch'](function(_0x53a786){logger[_0x37ca('0xd')](_0x37ca('0xa'),_0x3611b7,_0x53a786);_0x2b6cca(_0x53a786);});});}exports[_0x37ca('0x11')]=function(_0x102cd0){var _0x41f65b=this;return new Promise(function(_0x4dd287,_0x10ca94){return db[_0x37ca('0x12')][_0x37ca('0x13')](_0x102cd0['body'],{'raw':_0x102cd0['options']?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102cd0[_0x37ca('0x14')]?_0x102cd0[_0x37ca('0x14')]['where']||null:null,'attributes':_0x102cd0[_0x37ca('0x14')]?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x16')]||null:null,'limit':_0x102cd0['options']?_0x102cd0[_0x37ca('0x14')][_0x37ca('0x17')]||null:null})[_0x37ca('0x18')](function(_0x51068b){logger[_0x37ca('0x19')](_0x37ca('0x11'),_0x102cd0);logger['debug']('UpdateFaxApplication',_0x102cd0,JSON[_0x37ca('0x1a')](_0x51068b));_0x4dd287(_0x51068b);})[_0x37ca('0x1b')](function(_0x9a237f){logger[_0x37ca('0xd')](_0x37ca('0x11'),_0x9a237f[_0x37ca('0xf')],_0x102cd0);_0x10ca94(_0x41f65b[_0x37ca('0xd')](0x1f4,_0x9a237f[_0x37ca('0xf')]));});});}; \ No newline at end of file +var _0x7b3a=['code','message','result','UpdateFaxApplication','update','body','options','attributes','limit','info','debug','catch','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x35665d,_0x30573a){var _0x25d130=function(_0x4a29a6){while(--_0x4a29a6){_0x35665d['push'](_0x35665d['shift']());}};_0x25d130(++_0x30573a);}(_0x7b3a,0x93));var _0xa7b3=function(_0x395cd1,_0x29b587){_0x395cd1=_0x395cd1-0x0;var _0x3a92c2=_0x7b3a[_0x395cd1];return _0x3a92c2;};'use strict';var _=require(_0xa7b3('0x0'));var util=require('util');var moment=require(_0xa7b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa7b3('0x3'))(_0xa7b3('0x4'));var config=require(_0xa7b3('0x5'));var jayson=require(_0xa7b3('0x6'));var client=jayson['client'][_0xa7b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x175ce0,_0x1b97ee,_0x3e4294){return new BPromise(function(_0x4c5d54,_0x1b14cf){return client[_0xa7b3('0x8')](_0x175ce0,_0x3e4294)[_0xa7b3('0x9')](function(_0x41e1ab){logger['info'](_0xa7b3('0xa'),_0x1b97ee,'request\x20sent');logger['debug'](_0xa7b3('0xb'),_0x1b97ee,_0xa7b3('0xc'),JSON[_0xa7b3('0xd')](_0x41e1ab));if(_0x41e1ab[_0xa7b3('0xe')]){if(_0x41e1ab['error'][_0xa7b3('0xf')]===0x1f4){logger[_0xa7b3('0xe')](_0xa7b3('0xa'),_0x1b97ee,_0x41e1ab[_0xa7b3('0xe')][_0xa7b3('0x10')]);return _0x1b14cf(_0x41e1ab[_0xa7b3('0xe')]['message']);}logger[_0xa7b3('0xe')](_0xa7b3('0xa'),_0x1b97ee,_0x41e1ab[_0xa7b3('0xe')][_0xa7b3('0x10')]);return _0x4c5d54(_0x41e1ab[_0xa7b3('0xe')]['message']);}else{logger['info'](_0xa7b3('0xa'),_0x1b97ee,'request\x20sent');_0x4c5d54(_0x41e1ab[_0xa7b3('0x11')][_0xa7b3('0x10')]);}})['catch'](function(_0xd6ef97){logger[_0xa7b3('0xe')](_0xa7b3('0xa'),_0x1b97ee,_0xd6ef97);_0x1b14cf(_0xd6ef97);});});}exports[_0xa7b3('0x12')]=function(_0xfa06){var _0x141422=this;return new Promise(function(_0x31778a,_0x1edfdd){return db['FaxApplication'][_0xa7b3('0x13')](_0xfa06[_0xa7b3('0x14')],{'raw':_0xfa06['options']?_0xfa06[_0xa7b3('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa06['options']?_0xfa06[_0xa7b3('0x15')]['where']||null:null,'attributes':_0xfa06['options']?_0xfa06[_0xa7b3('0x15')][_0xa7b3('0x16')]||null:null,'limit':_0xfa06[_0xa7b3('0x15')]?_0xfa06[_0xa7b3('0x15')][_0xa7b3('0x17')]||null:null})[_0xa7b3('0x9')](function(_0x3eee32){logger[_0xa7b3('0x18')](_0xa7b3('0x12'),_0xfa06);logger[_0xa7b3('0x19')](_0xa7b3('0x12'),_0xfa06,JSON[_0xa7b3('0xd')](_0x3eee32));_0x31778a(_0x3eee32);})[_0xa7b3('0x1a')](function(_0x54782b){logger[_0xa7b3('0xe')]('UpdateFaxApplication',_0x54782b[_0xa7b3('0x10')],_0xfa06);_0x1edfdd(_0x141422[_0xa7b3('0xe')](0x1f4,_0x54782b[_0xa7b3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 742b274..d6a608e 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 _0x087b=['destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x11a544,_0x2c66a0){var _0xf18e28=function(_0x132a14){while(--_0x132a14){_0x11a544['push'](_0x11a544['shift']());}};_0xf18e28(++_0x2c66a0);}(_0x087b,0x11a));var _0xb087=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x087b[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0xd')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0xf')](_0xb087('0xb'),auth['isAuthenticated'](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);module[_0xb087('0x13')]=router; \ No newline at end of file +var _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x14e247,_0x517da7){var _0x24e0f7=function(_0x4b0f0c){while(--_0x4b0f0c){_0x14e247['push'](_0x14e247['shift']());}};_0x24e0f7(++_0x517da7);}(_0x5c00,0x17e));var _0x05c0=function(_0x26601e,_0x139a4c){_0x26601e=_0x26601e-0x0;var _0x116282=_0x5c00[_0x26601e];return _0x116282;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index fb6bf75..3da9f24 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 _0xb4f5=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x34fbf,_0x1f7da3){var _0x1d7897=function(_0x2d2817){while(--_0x2d2817){_0x34fbf['push'](_0x34fbf['shift']());}};_0x1d7897(++_0x1f7da3);}(_0xb4f5,0x68));var _0x5b4f=function(_0x27f9d3,_0x54ee48){_0x27f9d3=_0x27f9d3-0x0;var _0x1d2c10=_0xb4f5[_0x27f9d3];return _0x1d2c10;};'use strict';var Sequelize=require(_0x5b4f('0x0'));module[_0x5b4f('0x1')]={'closed':{'type':Sequelize[_0x5b4f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b4f('0x3')]},'disposition':{'type':Sequelize[_0x5b4f('0x4')]},'secondDisposition':{'type':Sequelize[_0x5b4f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b4f('0x4')]},'read1stAt':{'type':Sequelize[_0x5b4f('0x3')]},'fax':{'type':Sequelize[_0x5b4f('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5b4f('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5b4f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5b4f('0x5')]('in',_0x5b4f('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2f4b=['STRING','DATE','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0x2f4b,0x1ee));var _0xb2f4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2f4b[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb2f4('0x0'));module[_0xb2f4('0x1')]={'closed':{'type':Sequelize[_0xb2f4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb2f4('0x3')]},'secondDisposition':{'type':Sequelize[_0xb2f4('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb2f4('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb2f4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb2f4('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb2f4('0x6')]('in',_0xb2f4('0x5')),'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 725a463..b9f686c 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 _0x4bad=['faxInteractionTags:save','removeTags','unix','toString','server','files','join','root','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','download','log','unlinkSync','rimraf','moment','util','path','lodash','ioredis','../../components/parsers/qs','../../config/environment','localhost','redis','./faxInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','create','body','find','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','length','hasOwnProperty','order','sort','where','pick','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','Tag','color'];(function(_0x2944a4,_0x21a845){var _0x46476e=function(_0x16e105){while(--_0x16e105){_0x2944a4['push'](_0x2944a4['shift']());}};_0x46476e(++_0x21a845);}(_0x4bad,0x7a));var _0xd4ba=function(_0x79f7fb,_0xe3713f){_0x79f7fb=_0x79f7fb-0x0;var _0x355f45=_0x4bad[_0x79f7fb];return _0x355f45;};'use strict';var rimraf=require(_0xd4ba('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd4ba('0x1'));var BPromise=require('bluebird');var util=require(_0xd4ba('0x2'));var path=require(_0xd4ba('0x3'));var fs=require('fs');var _=require(_0xd4ba('0x4'));var Redis=require(_0xd4ba('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xd4ba('0x6'));var logger=require('../../config/logger')('api');var config=require(_0xd4ba('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd4ba('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4ba('0x9')]));require(_0xd4ba('0xa'))[_0xd4ba('0xb')](socket);function respondWithStatusCode(_0xec1e5e,_0x3b66fd){_0x3b66fd=_0x3b66fd||0xcc;return function(_0x3dca77){if(_0x3dca77){return _0xec1e5e['sendStatus'](_0x3b66fd);}return _0xec1e5e[_0xd4ba('0xc')](_0x3b66fd)[_0xd4ba('0xd')]();};}function respondWithResult(_0x882ed8,_0x9b67ea){_0x9b67ea=_0x9b67ea||0xc8;return function(_0x3df2ed){if(_0x3df2ed){return _0x882ed8['status'](_0x9b67ea)[_0xd4ba('0xe')](_0x3df2ed);}};}function respondWithFilteredResult(_0x206b86,_0x202755){return function(_0x2a12d4){if(_0x2a12d4){var _0x423bb7=typeof _0x202755[_0xd4ba('0xf')]===_0xd4ba('0x10')&&typeof _0x202755[_0xd4ba('0x11')]===_0xd4ba('0x10');var _0x4e7a6e=_0x2a12d4['count'];var _0x13ffbb=_0x423bb7?0x0:_0x202755[_0xd4ba('0xf')];var _0x36f831=_0x423bb7?_0x2a12d4[_0xd4ba('0x12')]:_0x202755[_0xd4ba('0xf')]+_0x202755['limit'];var _0x468b3c;if(_0x36f831>=_0x4e7a6e){_0x36f831=_0x4e7a6e;_0x468b3c=0xc8;}else{_0x468b3c=0xce;}_0x206b86['status'](_0x468b3c);return _0x206b86[_0xd4ba('0x13')](_0xd4ba('0x14'),_0x13ffbb+'-'+_0x36f831+'/'+_0x4e7a6e)['json'](_0x2a12d4);}return null;};}function saveUpdates(_0x52ad22){return function(_0x39188d){if(_0x39188d){return _0x39188d[_0xd4ba('0x15')](_0x52ad22)[_0xd4ba('0x16')](function(_0x478785){return _0x478785;});}return null;};}function removeEntity(_0x3b08c0){return function(_0x47ee72){if(_0x47ee72){return _0x47ee72['destroy']()[_0xd4ba('0x16')](function(){_0x3b08c0[_0xd4ba('0xc')](0xcc)[_0xd4ba('0xd')]();});}};}function handleEntityNotFound(_0x4f75c5){return function(_0x3cdf78){if(!_0x3cdf78){_0x4f75c5['sendStatus'](0x194);}return _0x3cdf78;};}function handleError(_0x32a6bf,_0x2d4561){_0x2d4561=_0x2d4561||0x1f4;return function(_0x14c674){logger['error'](_0x14c674[_0xd4ba('0x17')]);if(_0x14c674[_0xd4ba('0x18')]){delete _0x14c674[_0xd4ba('0x18')];}_0x32a6bf[_0xd4ba('0xc')](_0x2d4561)[_0xd4ba('0x19')](_0x14c674);};}exports['index']=function(_0x1c4321,_0x5578de){var _0x469ff9={};var _0x4f41cc=_[_0xd4ba('0x1a')](db[_0xd4ba('0x1b')][_0xd4ba('0x1c')],function(_0x1cae38){return{'name':_0x1cae38[_0xd4ba('0x1d')],'type':_0x1cae38[_0xd4ba('0x1e')][_0xd4ba('0x1f')]};});_0x469ff9=qs[_0xd4ba('0x20')](_0x4f41cc,_0x1c4321);return interaction[_0xd4ba('0x21')](_0xd4ba('0x22'),_0x1c4321[_0xd4ba('0x23')],_0x1c4321[_0xd4ba('0x24')],_0x469ff9,_0x4f41cc)[_0xd4ba('0x16')](respondWithFilteredResult(_0x5578de,_0x469ff9))[_0xd4ba('0x25')](handleError(_0x5578de,null));};exports[_0xd4ba('0x26')]=function(_0x3f4c9c,_0xad823a){var _0x3fe647={'raw':![],'where':{'id':_0x3f4c9c[_0xd4ba('0x27')]['id']}},_0x213d4e={};_0x213d4e[_0xd4ba('0x28')]=_['keys'](db['FaxInteraction'][_0xd4ba('0x1c')]);_0x213d4e['query']=_[_0xd4ba('0x29')](_0x3f4c9c[_0xd4ba('0x23')]);_0x213d4e[_0xd4ba('0x2a')]=_[_0xd4ba('0x2b')](_0x213d4e[_0xd4ba('0x28')],_0x213d4e['query']);_0x3fe647[_0xd4ba('0x2c')]=_[_0xd4ba('0x2b')](_0x213d4e['model'],qs[_0xd4ba('0x2d')](_0x3f4c9c['query'][_0xd4ba('0x2d')]));_0x3fe647[_0xd4ba('0x2c')]=_0x3fe647[_0xd4ba('0x2c')]['length']?_0x3fe647['attributes']:_0x213d4e[_0xd4ba('0x28')];if(_0x3f4c9c[_0xd4ba('0x23')][_0xd4ba('0x2e')]){_0x3fe647[_0xd4ba('0x2f')]=[{'all':!![]}];}_0x3fe647=_[_0xd4ba('0x30')]({},_0x3fe647,_0x3f4c9c[_0xd4ba('0x31')]);return db[_0xd4ba('0x1b')]['find'](_0x3fe647)[_0xd4ba('0x16')](handleEntityNotFound(_0xad823a,null))[_0xd4ba('0x16')](respondWithResult(_0xad823a,null))[_0xd4ba('0x25')](handleError(_0xad823a,null));};exports[_0xd4ba('0x32')]=function(_0x178fd4,_0x243d25){return db[_0xd4ba('0x1b')][_0xd4ba('0x32')](_0x178fd4['body'],{})[_0xd4ba('0x16')](respondWithResult(_0x243d25,0xc9))['catch'](handleError(_0x243d25,null));};exports['update']=function(_0x2501b6,_0x2f625c){if(_0x2501b6[_0xd4ba('0x33')]['id']){delete _0x2501b6[_0xd4ba('0x33')]['id'];}return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x2501b6[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0x2f625c,null))[_0xd4ba('0x16')](saveUpdates(_0x2501b6[_0xd4ba('0x33')],null))[_0xd4ba('0x16')](respondWithResult(_0x2f625c,null))[_0xd4ba('0x25')](handleError(_0x2f625c,null));};exports[_0xd4ba('0x35')]=function(_0x5e60ec,_0xc81ae){return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x5e60ec[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0xc81ae,null))[_0xd4ba('0x16')](removeEntity(_0xc81ae,null))[_0xd4ba('0x25')](handleError(_0xc81ae,null));};exports[_0xd4ba('0x36')]=function(_0x4b3aa3,_0xf4b84){return db['FaxInteraction'][_0xd4ba('0x36')]()[_0xd4ba('0x16')](respondWithResult(_0xf4b84,null))['catch'](handleError(_0xf4b84,null));};exports[_0xd4ba('0x37')]=function(_0xf8fb6b,_0xe38631){return db[_0xd4ba('0x38')]['find']({'where':{'id':_0xf8fb6b[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0xe38631,null))[_0xd4ba('0x16')](function(_0xfa874a){if(_0xfa874a){return _0xfa874a['addMessage'](_0xf8fb6b[_0xd4ba('0x33')][_0xd4ba('0x39')],_[_0xd4ba('0x3a')](_0xf8fb6b[_0xd4ba('0x33')],[_0xd4ba('0x39'),'id'])||{});}})['then'](respondWithResult(_0xe38631,null))[_0xd4ba('0x25')](handleError(_0xe38631,null));};exports[_0xd4ba('0x3b')]=function(_0x33f21c,_0x534b80){var _0x4745ca={'raw':![],'where':{}};var _0x29b5bc={};var _0x3e949e={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x33f21c[_0xd4ba('0x27')]['id']}})[_0xd4ba('0x16')](handleEntityNotFound(_0x534b80,null))[_0xd4ba('0x16')](function(_0x40130d){if(_0x40130d){_0x29b5bc[_0xd4ba('0x28')]=_[_0xd4ba('0x29')](db[_0xd4ba('0x38')][_0xd4ba('0x1c')]);_0x29b5bc['query']=_['keys'](_0x33f21c[_0xd4ba('0x23')]);_0x29b5bc[_0xd4ba('0x2a')]=_['intersection'](_0x29b5bc[_0xd4ba('0x28')],_0x29b5bc[_0xd4ba('0x23')]);_0x4745ca[_0xd4ba('0x2c')]=_[_0xd4ba('0x2b')](_0x29b5bc[_0xd4ba('0x28')],qs[_0xd4ba('0x2d')](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x2d')]));_0x4745ca[_0xd4ba('0x2c')]=_0x4745ca[_0xd4ba('0x2c')][_0xd4ba('0x3c')]?_0x4745ca['attributes']:_0x29b5bc[_0xd4ba('0x28')];if(!_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x3d')]('nolimit')){_0x4745ca[_0xd4ba('0x11')]=qs['limit'](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x11')]);_0x4745ca['offset']=qs[_0xd4ba('0xf')](_0x33f21c[_0xd4ba('0x23')]['offset']);}_0x4745ca[_0xd4ba('0x3e')]=qs[_0xd4ba('0x3f')](_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x3f')]);_0x4745ca[_0xd4ba('0x40')]=qs['filters'](_[_0xd4ba('0x41')](_0x33f21c[_0xd4ba('0x23')],_0x29b5bc[_0xd4ba('0x2a')]));_0x4745ca['where']['FaxInteractionId']=_0x40130d['id'];if(_0x33f21c['query'][_0xd4ba('0x42')]){_0x4745ca[_0xd4ba('0x40')]=_[_0xd4ba('0x30')](_0x4745ca[_0xd4ba('0x40')],{'$or':_['map'](_0x4745ca[_0xd4ba('0x2c')],function(_0x5f5cec){var _0x1cb53c={};_0x1cb53c[_0x5f5cec]={'$like':'%'+_0x33f21c['query'][_0xd4ba('0x42')]+'%'};return _0x1cb53c;})});}if(_0x33f21c['query'][_0xd4ba('0x43')]){var _0x210c08=_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x43')]['split'](',');var _0x3e9968={};_0x3e9968[_0x210c08[0x0]]={'$gte':moment(_0x210c08[0x1])[_0xd4ba('0x44')](_0xd4ba('0x45'))};_0x4745ca['where']=_['merge'](_0x4745ca[_0xd4ba('0x40')],_0x3e9968);}_0x4745ca=_[_0xd4ba('0x30')]({},_0x4745ca,_0x33f21c[_0xd4ba('0x31')]);return db['FaxMessage'][_0xd4ba('0x12')]({'where':_0x4745ca[_0xd4ba('0x40')]})['then'](function(_0x561567){_0x3e949e[_0xd4ba('0x12')]=_0x561567;if(_0x33f21c[_0xd4ba('0x23')][_0xd4ba('0x2e')]){_0x4745ca[_0xd4ba('0x2f')]=[{'all':!![]}];}return db['FaxMessage'][_0xd4ba('0x21')](_0x4745ca);})['then'](function(_0x5843f5){_0x3e949e['rows']=_0x5843f5;return _0x3e949e;});}})['then'](respondWithFilteredResult(_0x534b80,_0x4745ca))[_0xd4ba('0x25')](handleError(_0x534b80,null));};exports['addTags']=function(_0x74c314,_0x4d4a6c){return db[_0xd4ba('0x1b')][_0xd4ba('0x34')]({'where':{'id':_0x74c314[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x4d4a6c,null))[_0xd4ba('0x16')](function(_0x430329){if(_0x430329){return _0x430329[_0xd4ba('0x46')](_0x74c314[_0xd4ba('0x33')][_0xd4ba('0x39')],_[_0xd4ba('0x3a')](_0x74c314[_0xd4ba('0x33')],[_0xd4ba('0x39'),'id'])||{})[_0xd4ba('0x47')](function(){return db[_0xd4ba('0x48')][_0xd4ba('0x21')]({'attributes':['id',_0xd4ba('0x18'),_0xd4ba('0x49')],'where':{'id':_0x74c314[_0xd4ba('0x33')][_0xd4ba('0x39')]}});})[_0xd4ba('0x16')](function(_0x21c9ed){socket['emit'](_0xd4ba('0x4a'),{'id':Number(_0x74c314[_0xd4ba('0x27')]['id']),'tags':_0x21c9ed||[]});return{'id':Number(_0x74c314['params']['id']),'tags':_0x21c9ed||[]};});}})['then'](respondWithResult(_0x4d4a6c,null))[_0xd4ba('0x25')](handleError(_0x4d4a6c,null));};exports[_0xd4ba('0x4b')]=function(_0x1e63ba,_0xb4a3c6){return db[_0xd4ba('0x1b')]['find']({'where':{'id':_0x1e63ba[_0xd4ba('0x27')]['id']}})['then'](handleEntityNotFound(_0xb4a3c6,null))[_0xd4ba('0x16')](function(_0x75d26d){if(_0x75d26d){return _0x75d26d[_0xd4ba('0x4b')](_0x1e63ba[_0xd4ba('0x23')][_0xd4ba('0x39')]);}})[_0xd4ba('0x16')](respondWithStatusCode(_0xb4a3c6,null))[_0xd4ba('0x25')](handleError(_0xb4a3c6,null));};exports['download']=function(_0x51361f,_0x536215){var _0x2721a8=moment()[_0xd4ba('0x4c')]()[_0xd4ba('0x4d')]();var _0x1cfe55=path['join'](config['root'],_0xd4ba('0x4e'),_0xd4ba('0x4f'),'tmp');var _0x143dbc=path[_0xd4ba('0x50')](config[_0xd4ba('0x51')],_0xd4ba('0x4e'),_0xd4ba('0x4f'),_0xd4ba('0x52'));var _0x35bdaf=path[_0xd4ba('0x50')](_0x1cfe55,_0x2721a8);var _0x271198=util[_0xd4ba('0x44')](_0xd4ba('0x53'),_0x51361f['params']['id'],_0x2721a8);var _0x1f6958=path[_0xd4ba('0x50')](_0x1cfe55,_0x271198);var _0x4c755e=[];_0x4c755e[_0xd4ba('0x54')]({'model':db[_0xd4ba('0x55')],'as':'Attachment','raw':!![]});var _0x11816d=[{'model':db[_0xd4ba('0x38')],'as':'Messages','attributes':['id',_0xd4ba('0x33'),_0xd4ba('0x56')],'include':_0x4c755e}];return db['FaxInteraction'][_0xd4ba('0x34')]({'where':{'id':_0x51361f[_0xd4ba('0x27')]['id']},'include':_0x11816d})[_0xd4ba('0x16')](handleEntityNotFound(_0x536215,null))[_0xd4ba('0x16')](function(_0x586ddf){if(_0x586ddf&&_0x586ddf[_0xd4ba('0x57')]){var _0x1ee11c=_0x586ddf[_0xd4ba('0x58')]({'plain':!![]});fs[_0xd4ba('0x59')](_0x35bdaf);for(var _0x11f6ae=0x0;_0x11f6ae<_0x1ee11c['Messages']['length'];_0x11f6ae++){var _0x37cd5c=_0x1ee11c[_0xd4ba('0x57')][_0x11f6ae][_0xd4ba('0x55')];if(_0x37cd5c){var _0x4bb5cc=path[_0xd4ba('0x50')](_0x143dbc,_0x37cd5c[_0xd4ba('0x5a')]);if(fs['existsSync'](_0x4bb5cc)){fs[_0xd4ba('0x5b')](_0x4bb5cc)[_0xd4ba('0x5c')](fs[_0xd4ba('0x5d')](path[_0xd4ba('0x50')](_0x35bdaf,_0x37cd5c[_0xd4ba('0x5a')])));}}}return BPromise[_0xd4ba('0x5e')]()[_0xd4ba('0x16')](function(){return new BPromise(function(_0x56c823,_0x5d6ca3){zipdir(_0x35bdaf,{'saveTo':_0x1f6958},function(_0x14c940,_0x3b8002){if(_0x14c940)return _0x5d6ca3(_0x14c940);return _0x56c823(_0x3b8002);});})[_0xd4ba('0x16')](function(){return new BPromise(function(_0x17ebda,_0x3898c1){rimraf(_0x35bdaf,function(_0x173dd4){if(_0x173dd4)_0x3898c1(_0x173dd4);return _0x17ebda();});});})[_0xd4ba('0x16')](function(){return _0x536215[_0xd4ba('0x5f')](_0x1f6958,_0x271198,function(_0x149d75){if(_0x149d75){console[_0xd4ba('0x60')]('err',_0x149d75);}else{fs[_0xd4ba('0x61')](_0x1f6958);}});});});}else{return _0x536215['sendStatus'](0xc8);}})['catch'](handleError(_0x536215,null));}; \ No newline at end of file +var _0x2ec7=['offset','undefined','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','FaxInteraction','type','key','getOptions','fax','query','user','model','rawAttributes','keys','filters','intersection','fields','attributes','length','merge','options','find','catch','create','body','params','destroy','describe','addMessage','FaxMessage','omit','getMessages','findOne','hasOwnProperty','limit','order','sort','where','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','addTags','setTags','ids','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','root','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','./faxInteraction.socket','register','status','end','json'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x2ec7,0x131));var _0x72ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ec7[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0x72ec('0x0'));var BPromise=require('bluebird');var util=require(_0x72ec('0x1'));var path=require(_0x72ec('0x2'));var fs=require('fs');var _=require(_0x72ec('0x3'));var Redis=require(_0x72ec('0x4'));var interaction=require(_0x72ec('0x5'));var qs=require(_0x72ec('0x6'));var logger=require('../../config/logger')(_0x72ec('0x7'));var config=require('../../config/environment');var db=require(_0x72ec('0x8'))['db'];config[_0x72ec('0x9')]=_[_0x72ec('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72ec('0x9')]));require(_0x72ec('0xb'))[_0x72ec('0xc')](socket);function respondWithStatusCode(_0x57115a,_0x7b148c){_0x7b148c=_0x7b148c||0xcc;return function(_0x1cedd1){if(_0x1cedd1){return _0x57115a['sendStatus'](_0x7b148c);}return _0x57115a[_0x72ec('0xd')](_0x7b148c)[_0x72ec('0xe')]();};}function respondWithResult(_0x434c6d,_0x1d9299){_0x1d9299=_0x1d9299||0xc8;return function(_0x48b74e){if(_0x48b74e){return _0x434c6d[_0x72ec('0xd')](_0x1d9299)[_0x72ec('0xf')](_0x48b74e);}};}function respondWithFilteredResult(_0x46c4af,_0x2606fe){return function(_0x2ea79d){if(_0x2ea79d){var _0x1f3f14=typeof _0x2606fe[_0x72ec('0x10')]===_0x72ec('0x11')&&typeof _0x2606fe['limit']===_0x72ec('0x11');var _0x799783=_0x2ea79d[_0x72ec('0x12')];var _0x45f9f2=_0x1f3f14?0x0:_0x2606fe[_0x72ec('0x10')];var _0x4ad5a5=_0x1f3f14?_0x2ea79d[_0x72ec('0x12')]:_0x2606fe['offset']+_0x2606fe['limit'];var _0x395f11;if(_0x4ad5a5>=_0x799783){_0x4ad5a5=_0x799783;_0x395f11=0xc8;}else{_0x395f11=0xce;}_0x46c4af[_0x72ec('0xd')](_0x395f11);return _0x46c4af[_0x72ec('0x13')](_0x72ec('0x14'),_0x45f9f2+'-'+_0x4ad5a5+'/'+_0x799783)['json'](_0x2ea79d);}return null;};}function saveUpdates(_0x2bcc83){return function(_0x355477){if(_0x355477){return _0x355477[_0x72ec('0x15')](_0x2bcc83)['then'](function(_0xaaaead){return _0xaaaead;});}return null;};}function removeEntity(_0x534e9d){return function(_0x46c6e4){if(_0x46c6e4){return _0x46c6e4['destroy']()[_0x72ec('0x16')](function(){_0x534e9d[_0x72ec('0xd')](0xcc)[_0x72ec('0xe')]();});}};}function handleEntityNotFound(_0x661aba){return function(_0x307252){if(!_0x307252){_0x661aba[_0x72ec('0x17')](0x194);}return _0x307252;};}function handleError(_0x8c2265,_0x2745b2){_0x2745b2=_0x2745b2||0x1f4;return function(_0x2f5626){logger[_0x72ec('0x18')](_0x2f5626[_0x72ec('0x19')]);if(_0x2f5626[_0x72ec('0x1a')]){delete _0x2f5626[_0x72ec('0x1a')];}_0x8c2265[_0x72ec('0xd')](_0x2745b2)[_0x72ec('0x1b')](_0x2f5626);};}exports[_0x72ec('0x1c')]=function(_0x22a748,_0x281da2){var _0x4f4500={};var _0x285f8f=_[_0x72ec('0x1d')](db[_0x72ec('0x1e')]['rawAttributes'],function(_0x8192e2){return{'name':_0x8192e2['fieldName'],'type':_0x8192e2[_0x72ec('0x1f')][_0x72ec('0x20')]};});_0x4f4500=qs[_0x72ec('0x21')](_0x285f8f,_0x22a748);return interaction['findAll'](_0x72ec('0x22'),_0x22a748[_0x72ec('0x23')],_0x22a748[_0x72ec('0x24')],_0x4f4500,_0x285f8f)['then'](respondWithFilteredResult(_0x281da2,_0x4f4500))['catch'](handleError(_0x281da2,null));};exports['show']=function(_0x308d47,_0x4b0564){var _0x3e5adc={'raw':![],'where':{'id':_0x308d47['params']['id']}},_0x201ab6={};_0x201ab6[_0x72ec('0x25')]=_['keys'](db[_0x72ec('0x1e')][_0x72ec('0x26')]);_0x201ab6['query']=_[_0x72ec('0x27')](_0x308d47[_0x72ec('0x23')]);_0x201ab6[_0x72ec('0x28')]=_['intersection'](_0x201ab6[_0x72ec('0x25')],_0x201ab6[_0x72ec('0x23')]);_0x3e5adc['attributes']=_[_0x72ec('0x29')](_0x201ab6[_0x72ec('0x25')],qs[_0x72ec('0x2a')](_0x308d47[_0x72ec('0x23')][_0x72ec('0x2a')]));_0x3e5adc[_0x72ec('0x2b')]=_0x3e5adc[_0x72ec('0x2b')][_0x72ec('0x2c')]?_0x3e5adc[_0x72ec('0x2b')]:_0x201ab6['model'];if(_0x308d47['query']['includeAll']){_0x3e5adc['include']=[{'all':!![]}];}_0x3e5adc=_[_0x72ec('0x2d')]({},_0x3e5adc,_0x308d47[_0x72ec('0x2e')]);return db[_0x72ec('0x1e')][_0x72ec('0x2f')](_0x3e5adc)[_0x72ec('0x16')](handleEntityNotFound(_0x4b0564,null))['then'](respondWithResult(_0x4b0564,null))[_0x72ec('0x30')](handleError(_0x4b0564,null));};exports[_0x72ec('0x31')]=function(_0x41b481,_0x11d759){return db['FaxInteraction'][_0x72ec('0x31')](_0x41b481[_0x72ec('0x32')],{})['then'](respondWithResult(_0x11d759,0xc9))[_0x72ec('0x30')](handleError(_0x11d759,null));};exports[_0x72ec('0x15')]=function(_0x513ef4,_0x2e50e2){if(_0x513ef4['body']['id']){delete _0x513ef4[_0x72ec('0x32')]['id'];}return db[_0x72ec('0x1e')][_0x72ec('0x2f')]({'where':{'id':_0x513ef4[_0x72ec('0x33')]['id']}})['then'](handleEntityNotFound(_0x2e50e2,null))[_0x72ec('0x16')](saveUpdates(_0x513ef4[_0x72ec('0x32')],null))['then'](respondWithResult(_0x2e50e2,null))[_0x72ec('0x30')](handleError(_0x2e50e2,null));};exports[_0x72ec('0x34')]=function(_0x1cbaaf,_0x3efb4c){return db[_0x72ec('0x1e')]['find']({'where':{'id':_0x1cbaaf['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x3efb4c,null))['then'](removeEntity(_0x3efb4c,null))[_0x72ec('0x30')](handleError(_0x3efb4c,null));};exports['describe']=function(_0x13f517,_0x2480b3){return db[_0x72ec('0x1e')][_0x72ec('0x35')]()[_0x72ec('0x16')](respondWithResult(_0x2480b3,null))[_0x72ec('0x30')](handleError(_0x2480b3,null));};exports[_0x72ec('0x36')]=function(_0x458c5e,_0x11ea8c){return db[_0x72ec('0x37')][_0x72ec('0x2f')]({'where':{'id':_0x458c5e['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x11ea8c,null))[_0x72ec('0x16')](function(_0x35daf4){if(_0x35daf4){return _0x35daf4[_0x72ec('0x36')](_0x458c5e[_0x72ec('0x32')]['ids'],_[_0x72ec('0x38')](_0x458c5e['body'],['ids','id'])||{});}})[_0x72ec('0x16')](respondWithResult(_0x11ea8c,null))[_0x72ec('0x30')](handleError(_0x11ea8c,null));};exports[_0x72ec('0x39')]=function(_0x4deddc,_0x146794){var _0xa22839={'raw':![],'where':{}};var _0x422365={};var _0x4de112={'count':0x0,'rows':[]};return db[_0x72ec('0x1e')][_0x72ec('0x3a')]({'where':{'id':_0x4deddc['params']['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x146794,null))['then'](function(_0x352065){if(_0x352065){_0x422365[_0x72ec('0x25')]=_['keys'](db[_0x72ec('0x37')][_0x72ec('0x26')]);_0x422365[_0x72ec('0x23')]=_[_0x72ec('0x27')](_0x4deddc[_0x72ec('0x23')]);_0x422365[_0x72ec('0x28')]=_[_0x72ec('0x29')](_0x422365[_0x72ec('0x25')],_0x422365['query']);_0xa22839['attributes']=_['intersection'](_0x422365[_0x72ec('0x25')],qs['fields'](_0x4deddc[_0x72ec('0x23')][_0x72ec('0x2a')]));_0xa22839[_0x72ec('0x2b')]=_0xa22839[_0x72ec('0x2b')][_0x72ec('0x2c')]?_0xa22839[_0x72ec('0x2b')]:_0x422365['model'];if(!_0x4deddc[_0x72ec('0x23')][_0x72ec('0x3b')]('nolimit')){_0xa22839[_0x72ec('0x3c')]=qs[_0x72ec('0x3c')](_0x4deddc['query'][_0x72ec('0x3c')]);_0xa22839[_0x72ec('0x10')]=qs[_0x72ec('0x10')](_0x4deddc[_0x72ec('0x23')][_0x72ec('0x10')]);}_0xa22839[_0x72ec('0x3d')]=qs[_0x72ec('0x3e')](_0x4deddc['query'][_0x72ec('0x3e')]);_0xa22839[_0x72ec('0x3f')]=qs['filters'](_['pick'](_0x4deddc[_0x72ec('0x23')],_0x422365[_0x72ec('0x28')]));_0xa22839[_0x72ec('0x3f')][_0x72ec('0x40')]=_0x352065['id'];if(_0x4deddc[_0x72ec('0x23')][_0x72ec('0x41')]){_0xa22839['where']=_[_0x72ec('0x2d')](_0xa22839[_0x72ec('0x3f')],{'$or':_['map'](_0xa22839[_0x72ec('0x2b')],function(_0x59d791){var _0x22fe64={};_0x22fe64[_0x59d791]={'$like':'%'+_0x4deddc[_0x72ec('0x23')][_0x72ec('0x41')]+'%'};return _0x22fe64;})});}if(_0x4deddc['query'][_0x72ec('0x42')]){var _0x3dab3b=_0x4deddc[_0x72ec('0x23')][_0x72ec('0x42')][_0x72ec('0x43')](',');var _0x2bfc1a={};_0x2bfc1a[_0x3dab3b[0x0]]={'$gte':moment(_0x3dab3b[0x1])[_0x72ec('0x44')](_0x72ec('0x45'))};_0xa22839[_0x72ec('0x3f')]=_['merge'](_0xa22839[_0x72ec('0x3f')],_0x2bfc1a);}_0xa22839=_[_0x72ec('0x2d')]({},_0xa22839,_0x4deddc[_0x72ec('0x2e')]);return db[_0x72ec('0x37')][_0x72ec('0x12')]({'where':_0xa22839['where']})[_0x72ec('0x16')](function(_0x3f60d1){_0x4de112[_0x72ec('0x12')]=_0x3f60d1;if(_0x4deddc[_0x72ec('0x23')][_0x72ec('0x46')]){_0xa22839[_0x72ec('0x47')]=[{'all':!![]}];}return db[_0x72ec('0x37')][_0x72ec('0x48')](_0xa22839);})[_0x72ec('0x16')](function(_0x3d559b){_0x4de112[_0x72ec('0x49')]=_0x3d559b;return _0x4de112;});}})['then'](respondWithFilteredResult(_0x146794,_0xa22839))['catch'](handleError(_0x146794,null));};exports[_0x72ec('0x4a')]=function(_0x5830ff,_0x2e29e1){return db['FaxInteraction'][_0x72ec('0x2f')]({'where':{'id':_0x5830ff[_0x72ec('0x33')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x2e29e1,null))['then'](function(_0x3648ea){if(_0x3648ea){return _0x3648ea[_0x72ec('0x4b')](_0x5830ff[_0x72ec('0x32')][_0x72ec('0x4c')],_[_0x72ec('0x38')](_0x5830ff[_0x72ec('0x32')],['ids','id'])||{})[_0x72ec('0x4d')](function(){return db[_0x72ec('0x4e')][_0x72ec('0x48')]({'attributes':['id','name',_0x72ec('0x4f')],'where':{'id':_0x5830ff['body'][_0x72ec('0x4c')]}});})[_0x72ec('0x16')](function(_0x5c0828){socket[_0x72ec('0x50')](_0x72ec('0x51'),{'id':Number(_0x5830ff[_0x72ec('0x33')]['id']),'tags':_0x5c0828||[]});return{'id':Number(_0x5830ff[_0x72ec('0x33')]['id']),'tags':_0x5c0828||[]};});}})[_0x72ec('0x16')](respondWithResult(_0x2e29e1,null))[_0x72ec('0x30')](handleError(_0x2e29e1,null));};exports[_0x72ec('0x52')]=function(_0x343722,_0x3b3431){return db[_0x72ec('0x1e')]['find']({'where':{'id':_0x343722[_0x72ec('0x33')]['id']}})[_0x72ec('0x16')](handleEntityNotFound(_0x3b3431,null))[_0x72ec('0x16')](function(_0x40f90a){if(_0x40f90a){return _0x40f90a[_0x72ec('0x52')](_0x343722['query'][_0x72ec('0x4c')]);}})[_0x72ec('0x16')](respondWithStatusCode(_0x3b3431,null))[_0x72ec('0x30')](handleError(_0x3b3431,null));};exports[_0x72ec('0x53')]=function(_0x7b4e32,_0x2b391c){var _0x3b7597=moment()[_0x72ec('0x54')]()[_0x72ec('0x55')]();var _0x3e93c0=path[_0x72ec('0x56')](config['root'],_0x72ec('0x57'),_0x72ec('0x58'),_0x72ec('0x59'));var _0x372239=path[_0x72ec('0x56')](config[_0x72ec('0x5a')],_0x72ec('0x57'),_0x72ec('0x58'),_0x72ec('0x5b'));var _0x4b9e56=path['join'](_0x3e93c0,_0x3b7597);var _0x4d3e59=util[_0x72ec('0x44')]('transcript-%d-%s.zip',_0x7b4e32[_0x72ec('0x33')]['id'],_0x3b7597);var _0x24a586=path[_0x72ec('0x56')](_0x3e93c0,_0x4d3e59);var _0x1791ad=[];_0x1791ad[_0x72ec('0x5c')]({'model':db[_0x72ec('0x5d')],'as':_0x72ec('0x5d'),'raw':!![]});var _0x2c64f1=[{'model':db[_0x72ec('0x37')],'as':_0x72ec('0x5e'),'attributes':['id',_0x72ec('0x32'),_0x72ec('0x5f')],'include':_0x1791ad}];return db['FaxInteraction']['find']({'where':{'id':_0x7b4e32[_0x72ec('0x33')]['id']},'include':_0x2c64f1})[_0x72ec('0x16')](handleEntityNotFound(_0x2b391c,null))[_0x72ec('0x16')](function(_0x3897f2){if(_0x3897f2&&_0x3897f2[_0x72ec('0x5e')]){var _0x3e62c0=_0x3897f2[_0x72ec('0x60')]({'plain':!![]});fs[_0x72ec('0x61')](_0x4b9e56);for(var _0x5781e9=0x0;_0x5781e9<_0x3e62c0[_0x72ec('0x5e')][_0x72ec('0x2c')];_0x5781e9++){var _0x1d537f=_0x3e62c0['Messages'][_0x5781e9][_0x72ec('0x5d')];if(_0x1d537f){var _0x19864c=path['join'](_0x372239,_0x1d537f[_0x72ec('0x62')]);if(fs[_0x72ec('0x63')](_0x19864c)){fs[_0x72ec('0x64')](_0x19864c)[_0x72ec('0x65')](fs[_0x72ec('0x66')](path[_0x72ec('0x56')](_0x4b9e56,_0x1d537f[_0x72ec('0x62')])));}}}return BPromise[_0x72ec('0x67')]()[_0x72ec('0x16')](function(){return new BPromise(function(_0x34f428,_0x4fa4ee){zipdir(_0x4b9e56,{'saveTo':_0x24a586},function(_0x463612,_0x5c622e){if(_0x463612)return _0x4fa4ee(_0x463612);return _0x34f428(_0x5c622e);});})['then'](function(){return new BPromise(function(_0x234fdc,_0x4768d8){rimraf(_0x4b9e56,function(_0x473109){if(_0x473109)_0x4768d8(_0x473109);return _0x234fdc();});});})[_0x72ec('0x16')](function(){return _0x2b391c[_0x72ec('0x53')](_0x24a586,_0x4d3e59,function(_0x5a5c1a){if(_0x5a5c1a){console[_0x72ec('0x68')](_0x72ec('0x69'),_0x5a5c1a);}else{fs[_0x72ec('0x6a')](_0x24a586);}});});});}else{return _0x2b391c[_0x72ec('0x17')](0xc8);}})[_0x72ec('0x30')](handleError(_0x2b391c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d3c2e29..4a74b00 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 _0xa3c7=['hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','getUsers','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa3c7,0x16a));var _0x7a3c=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0xa3c7[_0x2e6e12];return _0x4bebf6;};'use strict';var EventEmitter=require(_0x7a3c('0x0'));var FaxInteraction=require(_0x7a3c('0x1'))['db'][_0x7a3c('0x2')];var FaxMessage=require(_0x7a3c('0x1'))['db'][_0x7a3c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7a3c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7a3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x51f797){return function(_0x3744cf,_0x1723e0,_0x110eed){_0x3744cf[_0x7a3c('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5b747f){_0x3744cf['setDataValue'](_0x7a3c('0x7'),_0x5b747f[_0x7a3c('0x8')](function(_0x10ffb0){return{'id':_0x10ffb0['id']};}));return FaxMessage[_0x7a3c('0x9')]({'where':{'FaxInteractionId':_0x3744cf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14a1b7){_0x3744cf[_0x7a3c('0xa')](_0x7a3c('0xb'),_0x14a1b7[_0x7a3c('0xc')]);FaxInteractionEvents[_0x7a3c('0xd')](_0x51f797+':'+_0x3744cf['id'],_0x3744cf);FaxInteractionEvents['emit'](_0x51f797,_0x3744cf);_0x110eed(null);})[_0x7a3c('0xe')](_0x110eed(null));};}for(var e in events){if(events[_0x7a3c('0xf')](e)){var event=events[e];FaxInteraction[_0x7a3c('0x10')](e,emitEvent(event));}}module[_0x7a3c('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xeac9=['FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','hook','events','FaxInteraction'];(function(_0x5fae11,_0x812d2a){var _0x22695b=function(_0xae0edd){while(--_0xae0edd){_0x5fae11['push'](_0x5fae11['shift']());}};_0x22695b(++_0x812d2a);}(_0xeac9,0x1c0));var _0x9eac=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xeac9[_0x55abd9];return _0x3e5669;};'use strict';var EventEmitter=require(_0x9eac('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x9eac('0x1')];var FaxMessage=require('../../mysqldb')['db'][_0x9eac('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9eac('0x3')](0x0);var events={'afterCreate':_0x9eac('0x4'),'afterUpdate':_0x9eac('0x5'),'afterDestroy':'remove'};function emitEvent(_0x207b25){return function(_0xd05c93,_0x3a7e1c,_0x541037){_0xd05c93[_0x9eac('0x6')]({'attributes':['id'],'raw':!![]})[_0x9eac('0x7')](function(_0x273b7a){_0xd05c93[_0x9eac('0x8')](_0x9eac('0x9'),_0x273b7a[_0x9eac('0xa')](function(_0x4424a0){return{'id':_0x4424a0['id']};}));return FaxMessage[_0x9eac('0xb')]({'where':{'FaxInteractionId':_0xd05c93['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1a59b7){_0xd05c93[_0x9eac('0x8')]('unreadMessages',_0x1a59b7[_0x9eac('0xc')]);FaxInteractionEvents[_0x9eac('0xd')](_0x207b25+':'+_0xd05c93['id'],_0xd05c93);FaxInteractionEvents[_0x9eac('0xd')](_0x207b25,_0xd05c93);_0x541037(null);})['catch'](_0x541037(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x9eac('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 4e2069e..64c2fe4 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 _0x9d49=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2a27de,_0x4aaa18){var _0x4335d=function(_0xc8eb38){while(--_0xc8eb38){_0x2a27de['push'](_0x2a27de['shift']());}};_0x4335d(++_0x4aaa18);}(_0x9d49,0xcf));var _0x99d4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d49[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x99d4('0x0'));var util=require('util');var logger=require(_0x99d4('0x1'))(_0x99d4('0x2'));var moment=require(_0x99d4('0x3'));var BPromise=require(_0x99d4('0x4'));var rp=require(_0x99d4('0x5'));var fs=require('fs');var path=require(_0x99d4('0x6'));var rimraf=require(_0x99d4('0x7'));var config=require(_0x99d4('0x8'));var attributes=require(_0x99d4('0x9'));module[_0x99d4('0xa')]=function(_0x599b8f,_0x586b08){return _0x599b8f[_0x99d4('0xb')](_0x99d4('0xc'),attributes,{'tableName':_0x99d4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d168d,_0x5dbe19,_0x38f097){if(_0x3d168d[_0x99d4('0xe')]('closed')){_0x3d168d[_0x99d4('0xf')]=moment()[_0x99d4('0x10')](_0x99d4('0x11'));}_0x38f097(null,_0x3d168d);}}});}; \ No newline at end of file +var _0xb2e6=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2e6,0x1da));var _0x6b2e=function(_0x5c7273,_0x74ad7b){_0x5c7273=_0x5c7273-0x0;var _0x1f5fdf=_0xb2e6[_0x5c7273];return _0x1f5fdf;};'use strict';var _=require(_0x6b2e('0x0'));var util=require(_0x6b2e('0x1'));var logger=require('../../config/logger')(_0x6b2e('0x2'));var moment=require(_0x6b2e('0x3'));var BPromise=require(_0x6b2e('0x4'));var rp=require(_0x6b2e('0x5'));var fs=require('fs');var path=require(_0x6b2e('0x6'));var rimraf=require(_0x6b2e('0x7'));var config=require(_0x6b2e('0x8'));var attributes=require(_0x6b2e('0x9'));module[_0x6b2e('0xa')]=function(_0x28b0c5,_0x2dda6b){return _0x28b0c5[_0x6b2e('0xb')](_0x6b2e('0xc'),attributes,{'tableName':_0x6b2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1045bc,_0x4b535f,_0x484e96){if(_0x1045bc[_0x6b2e('0xe')](_0x6b2e('0xf'))){_0x1045bc[_0x6b2e('0x10')]=moment()[_0x6b2e('0x11')](_0x6b2e('0x12'));}_0x484e96(null,_0x1045bc);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6f9b439..bb309d3 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 _0xd9a7=['limit','catch','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','body','ids','omit','spread','AddTags','debug','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','UpdateFaxInteraction','update','options','attributes'];(function(_0x1d10fd,_0x46848f){var _0x4d65d9=function(_0x2c53ce){while(--_0x2c53ce){_0x1d10fd['push'](_0x1d10fd['shift']());}};_0x4d65d9(++_0x46848f);}(_0xd9a7,0x1a2));var _0x7d9a=function(_0x48183f,_0x1318ef){_0x48183f=_0x48183f-0x0;var _0x228eb9=_0xd9a7[_0x48183f];return _0x228eb9;};'use strict';var _=require(_0x7d9a('0x0'));var util=require(_0x7d9a('0x1'));var moment=require('moment');var BPromise=require(_0x7d9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d9a('0x3'))['db'];var utils=require(_0x7d9a('0x4'));var logger=require(_0x7d9a('0x5'))(_0x7d9a('0x6'));var config=require(_0x7d9a('0x7'));var jayson=require(_0x7d9a('0x8'));var client=jayson[_0x7d9a('0x9')][_0x7d9a('0xa')]({'port':0x232a});config['redis']=_[_0x7d9a('0xb')](config['redis'],{'host':_0x7d9a('0xc'),'port':0x18eb});var socket=require(_0x7d9a('0xd'))(new Redis(config[_0x7d9a('0xe')]));require(_0x7d9a('0xf'))[_0x7d9a('0x10')](socket);function respondWithRpcPromise(_0x58d69d,_0x2b2ab5,_0x146fc3){return new BPromise(function(_0x3bf1ca,_0x3187f3){return client[_0x7d9a('0x11')](_0x58d69d,_0x146fc3)[_0x7d9a('0x12')](function(_0x86a744){logger[_0x7d9a('0x13')](_0x7d9a('0x14'),_0x2b2ab5,_0x7d9a('0x15'));logger['debug'](_0x7d9a('0x16'),_0x2b2ab5,_0x7d9a('0x15'),JSON[_0x7d9a('0x17')](_0x86a744));if(_0x86a744['error']){if(_0x86a744['error'][_0x7d9a('0x18')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x2b2ab5,_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);return _0x3187f3(_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);}logger[_0x7d9a('0x19')](_0x7d9a('0x14'),_0x2b2ab5,_0x86a744[_0x7d9a('0x19')][_0x7d9a('0x1a')]);return _0x3bf1ca(_0x86a744['error']['message']);}else{logger['info'](_0x7d9a('0x14'),_0x2b2ab5,_0x7d9a('0x15'));_0x3bf1ca(_0x86a744[_0x7d9a('0x1b')]['message']);}})['catch'](function(_0x29e235){logger[_0x7d9a('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x2b2ab5,_0x29e235);_0x3187f3(_0x29e235);});});}exports[_0x7d9a('0x1c')]=function(_0x39a2b2){var _0x5ebc13=this;return new Promise(function(_0x26502f,_0x3a326c){return db['FaxInteraction'][_0x7d9a('0x1d')](_0x39a2b2['body'],{'raw':_0x39a2b2['options']?_0x39a2b2[_0x7d9a('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a2b2[_0x7d9a('0x1e')]?_0x39a2b2[_0x7d9a('0x1e')]['where']||null:null,'attributes':_0x39a2b2['options']?_0x39a2b2[_0x7d9a('0x1e')][_0x7d9a('0x1f')]||null:null,'limit':_0x39a2b2[_0x7d9a('0x1e')]?_0x39a2b2[_0x7d9a('0x1e')][_0x7d9a('0x20')]||null:null})['then'](function(_0x2bbf30){logger[_0x7d9a('0x13')]('UpdateFaxInteraction',_0x39a2b2);logger['debug'](_0x7d9a('0x1c'),_0x39a2b2,JSON[_0x7d9a('0x17')](_0x2bbf30));_0x26502f(_0x2bbf30);})[_0x7d9a('0x21')](function(_0x492e75){logger[_0x7d9a('0x19')]('UpdateFaxInteraction',_0x492e75[_0x7d9a('0x1a')],_0x39a2b2);_0x3a326c(_0x5ebc13['error'](0x1f4,_0x492e75['message']));});});};exports[_0x7d9a('0x22')]=function(_0x2f0294){return new Promise(function(_0x1624a0,_0x30db1f){return db[_0x7d9a('0x23')][_0x7d9a('0x24')]({'where':_0x2f0294[_0x7d9a('0x1e')]?_0x2f0294[_0x7d9a('0x1e')][_0x7d9a('0x25')]||null:null})[_0x7d9a('0x12')](function(_0x40d22e){if(_0x40d22e){return _0x40d22e[_0x7d9a('0x26')](_0x2f0294[_0x7d9a('0x27')][_0x7d9a('0x28')],_[_0x7d9a('0x29')](_0x2f0294[_0x7d9a('0x27')],[_0x7d9a('0x28'),'id'])||{});}})[_0x7d9a('0x2a')](function(_0x1fae48){logger['info'](_0x7d9a('0x2b'),_0x2f0294);logger[_0x7d9a('0x2c')](_0x7d9a('0x2b'),_0x2f0294,JSON[_0x7d9a('0x17')](_0x1fae48));_0x1624a0(_0x1fae48);})[_0x7d9a('0x21')](function(_0x4a5d28){logger[_0x7d9a('0x19')]('AddTags',_0x4a5d28[_0x7d9a('0x1a')],_0x2f0294);_0x30db1f(_this[_0x7d9a('0x19')](0x1f4,_0x4a5d28[_0x7d9a('0x1a')]));});});}; \ No newline at end of file +var _0x5c29=['../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','update','body','options','raw','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','ids','omit','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5c29,0x141));var _0x95c2=function(_0x2e4408,_0x3cae6e){_0x2e4408=_0x2e4408-0x0;var _0x52c5ce=_0x5c29[_0x2e4408];return _0x52c5ce;};'use strict';var _=require(_0x95c2('0x0'));var util=require('util');var moment=require(_0x95c2('0x1'));var BPromise=require('bluebird');var rs=require(_0x95c2('0x2'));var fs=require('fs');var Redis=require(_0x95c2('0x3'));var db=require(_0x95c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95c2('0x5'))(_0x95c2('0x6'));var config=require(_0x95c2('0x7'));var jayson=require(_0x95c2('0x8'));var client=jayson[_0x95c2('0x9')][_0x95c2('0xa')]({'port':0x232a});config['redis']=_[_0x95c2('0xb')](config[_0x95c2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x95c2('0xd'))(new Redis(config[_0x95c2('0xc')]));require('./faxInteraction.socket')[_0x95c2('0xe')](socket);function respondWithRpcPromise(_0x3d312a,_0x34534c,_0x4c6532){return new BPromise(function(_0x4d6a1e,_0x449d3c){return client[_0x95c2('0xf')](_0x3d312a,_0x4c6532)[_0x95c2('0x10')](function(_0x3afd36){logger[_0x95c2('0x11')](_0x95c2('0x12'),_0x34534c,_0x95c2('0x13'));logger[_0x95c2('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x34534c,_0x95c2('0x13'),JSON[_0x95c2('0x15')](_0x3afd36));if(_0x3afd36[_0x95c2('0x16')]){if(_0x3afd36[_0x95c2('0x16')][_0x95c2('0x17')]===0x1f4){logger[_0x95c2('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x34534c,_0x3afd36[_0x95c2('0x16')][_0x95c2('0x18')]);return _0x449d3c(_0x3afd36[_0x95c2('0x16')][_0x95c2('0x18')]);}logger[_0x95c2('0x16')](_0x95c2('0x12'),_0x34534c,_0x3afd36['error']['message']);return _0x4d6a1e(_0x3afd36[_0x95c2('0x16')][_0x95c2('0x18')]);}else{logger['info'](_0x95c2('0x12'),_0x34534c,_0x95c2('0x13'));_0x4d6a1e(_0x3afd36[_0x95c2('0x19')][_0x95c2('0x18')]);}})[_0x95c2('0x1a')](function(_0x3727c8){logger[_0x95c2('0x16')](_0x95c2('0x12'),_0x34534c,_0x3727c8);_0x449d3c(_0x3727c8);});});}exports['UpdateFaxInteraction']=function(_0x3dec2d){var _0x1a321a=this;return new Promise(function(_0x50ff9d,_0x431c46){return db['FaxInteraction'][_0x95c2('0x1b')](_0x3dec2d[_0x95c2('0x1c')],{'raw':_0x3dec2d[_0x95c2('0x1d')]?_0x3dec2d[_0x95c2('0x1d')][_0x95c2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dec2d[_0x95c2('0x1d')]?_0x3dec2d['options']['where']||null:null,'attributes':_0x3dec2d[_0x95c2('0x1d')]?_0x3dec2d[_0x95c2('0x1d')][_0x95c2('0x1f')]||null:null,'limit':_0x3dec2d[_0x95c2('0x1d')]?_0x3dec2d[_0x95c2('0x1d')]['limit']||null:null})[_0x95c2('0x10')](function(_0x55aa36){logger['info'](_0x95c2('0x20'),_0x3dec2d);logger[_0x95c2('0x14')](_0x95c2('0x20'),_0x3dec2d,JSON[_0x95c2('0x15')](_0x55aa36));_0x50ff9d(_0x55aa36);})[_0x95c2('0x1a')](function(_0xd777e7){logger[_0x95c2('0x16')]('UpdateFaxInteraction',_0xd777e7['message'],_0x3dec2d);_0x431c46(_0x1a321a[_0x95c2('0x16')](0x1f4,_0xd777e7['message']));});});};exports[_0x95c2('0x21')]=function(_0x23c228){return new Promise(function(_0x15a55f,_0x5e2b1b){return db[_0x95c2('0x22')][_0x95c2('0x23')]({'where':_0x23c228[_0x95c2('0x1d')]?_0x23c228['options'][_0x95c2('0x24')]||null:null})[_0x95c2('0x10')](function(_0x615951){if(_0x615951){return _0x615951[_0x95c2('0x25')](_0x23c228[_0x95c2('0x1c')][_0x95c2('0x26')],_[_0x95c2('0x27')](_0x23c228['body'],[_0x95c2('0x26'),'id'])||{});}})['spread'](function(_0x43083e){logger[_0x95c2('0x11')](_0x95c2('0x28'),_0x23c228);logger[_0x95c2('0x14')](_0x95c2('0x28'),_0x23c228,JSON[_0x95c2('0x15')](_0x43083e));_0x15a55f(_0x43083e);})[_0x95c2('0x1a')](function(_0x84b20d){logger[_0x95c2('0x16')]('AddTags',_0x84b20d[_0x95c2('0x18')],_0x23c228);_0x5e2b1b(_this[_0x95c2('0x16')](0x1f4,_0x84b20d[_0x95c2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5a8b41b..7cc9925 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 _0xac87=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xac87,0x19c));var _0x7ac8=function(_0x1f630b,_0x214015){_0x1f630b=_0x1f630b-0x0;var _0x56f307=_0xac87[_0x1f630b];return _0x56f307;};'use strict';var FaxInteractionEvents=require(_0x7ac8('0x0'));var events=[_0x7ac8('0x1'),_0x7ac8('0x2'),_0x7ac8('0x3')];function createListener(_0x597242,_0x8db17b){return function(_0x1acd59){_0x8db17b[_0x7ac8('0x4')](_0x597242,_0x1acd59);};}function removeListener(_0x453b5c,_0x1ee866){return function(){FaxInteractionEvents[_0x7ac8('0x5')](_0x453b5c,_0x1ee866);};}exports[_0x7ac8('0x6')]=function(_0x4dc0e6){for(var _0x583450=0x0,_0x3cb037=events[_0x7ac8('0x7')];_0x583450<_0x3cb037;_0x583450++){var _0x24e4bc=events[_0x583450];var _0x32c977=createListener(_0x7ac8('0x8')+_0x24e4bc,_0x4dc0e6);FaxInteractionEvents['on'](_0x24e4bc,_0x32c977);}}; \ No newline at end of file +var _0x4966=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x184cb6,_0x1ae06c){var _0x2e2c5d=function(_0x15c29f){while(--_0x15c29f){_0x184cb6['push'](_0x184cb6['shift']());}};_0x2e2c5d(++_0x1ae06c);}(_0x4966,0x93));var _0x6496=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x4966[_0x4fa738];return _0x55bf55;};'use strict';var FaxInteractionEvents=require(_0x6496('0x0'));var events=[_0x6496('0x1'),_0x6496('0x2'),_0x6496('0x3')];function createListener(_0x1642c3,_0x3d71a8){return function(_0x589647){_0x3d71a8[_0x6496('0x4')](_0x1642c3,_0x589647);};}function removeListener(_0x4b68da,_0x3d0d9c){return function(){FaxInteractionEvents[_0x6496('0x5')](_0x4b68da,_0x3d0d9c);};}exports[_0x6496('0x6')]=function(_0x4aefc2){for(var _0x49417b=0x0,_0x1b9a33=events[_0x6496('0x7')];_0x49417b<_0x1b9a33;_0x49417b++){var _0xf2bc58=events[_0x49417b];var _0x3b8b92=createListener(_0x6496('0x8')+_0xf2bc58,_0x4aefc2);FaxInteractionEvents['on'](_0xf2bc58,_0x3b8b92);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index c727574..a1136cb 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 _0xaf40=['download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download'];(function(_0x36f762,_0x453f40){var _0x47131a=function(_0x2d979f){while(--_0x2d979f){_0x36f762['push'](_0x36f762['shift']());}};_0x47131a(++_0x453f40);}(_0xaf40,0x75));var _0x0af4=function(_0xa855f0,_0x149fae){_0xa855f0=_0xa855f0-0x0;var _0x4199b5=_0xaf40[_0xa855f0];return _0x4199b5;};'use strict';var multer=require('multer');var util=require(_0x0af4('0x0'));var path=require(_0x0af4('0x1'));var timeout=require(_0x0af4('0x2'));var express=require(_0x0af4('0x3'));var router=express[_0x0af4('0x4')]();var fs_extra=require(_0x0af4('0x5'));var auth=require(_0x0af4('0x6'));var interaction=require(_0x0af4('0x7'));var config=require(_0x0af4('0x8'));var controller=require(_0x0af4('0x9'));router[_0x0af4('0xa')]('/',auth[_0x0af4('0xb')](),controller[_0x0af4('0xc')]);router[_0x0af4('0xa')](_0x0af4('0xd'),auth['isAuthenticated'](),controller[_0x0af4('0xe')]);router[_0x0af4('0xa')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),controller['show']);router['get'](_0x0af4('0x10'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x11')]);router['get'](_0x0af4('0x12'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x13')]);router[_0x0af4('0x14')]('/',auth[_0x0af4('0xb')](),controller['create']);router[_0x0af4('0x14')]('/:id/messages',auth[_0x0af4('0xb')](),controller[_0x0af4('0x15')]);router[_0x0af4('0x14')](_0x0af4('0x16'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x19')),controller[_0x0af4('0x1a')]);router['put'](_0x0af4('0xf'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x1b')),controller[_0x0af4('0x1c')]);router[_0x0af4('0x1d')](_0x0af4('0xf'),auth[_0x0af4('0xb')](),interaction[_0x0af4('0x17')](_0x0af4('0x18'),_0x0af4('0x1e')),controller[_0x0af4('0x1f')]);router[_0x0af4('0x1d')](_0x0af4('0x16'),auth[_0x0af4('0xb')](),controller[_0x0af4('0x20')]);module[_0x0af4('0x21')]=router; \ No newline at end of file +var _0xf541=['/describe','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','/:id','faxinteraction:update','delete','faxinteraction:destroy','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index'];(function(_0x41ed9b,_0x34783e){var _0xcfc90f=function(_0x1ed307){while(--_0x1ed307){_0x41ed9b['push'](_0x41ed9b['shift']());}};_0xcfc90f(++_0x34783e);}(_0xf541,0x1f4));var _0x1f54=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xf541[_0x5b740b];return _0x6f8f4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f54('0x0'));var timeout=require('connect-timeout');var express=require(_0x1f54('0x1'));var router=express[_0x1f54('0x2')]();var fs_extra=require(_0x1f54('0x3'));var auth=require(_0x1f54('0x4'));var interaction=require(_0x1f54('0x5'));var config=require(_0x1f54('0x6'));var controller=require(_0x1f54('0x7'));router[_0x1f54('0x8')]('/',auth['isAuthenticated'](),controller[_0x1f54('0x9')]);router[_0x1f54('0x8')](_0x1f54('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1f54('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1f54('0x8')](_0x1f54('0xb'),auth[_0x1f54('0xc')](),controller[_0x1f54('0xd')]);router[_0x1f54('0x8')](_0x1f54('0xe'),auth[_0x1f54('0xc')](),controller[_0x1f54('0xf')]);router[_0x1f54('0x10')]('/',auth['isAuthenticated'](),controller[_0x1f54('0x11')]);router[_0x1f54('0x10')](_0x1f54('0xb'),auth[_0x1f54('0xc')](),controller[_0x1f54('0x12')]);router[_0x1f54('0x10')](_0x1f54('0x13'),auth['isAuthenticated'](),interaction[_0x1f54('0x14')](_0x1f54('0x15'),_0x1f54('0x16')),controller['addTags']);router[_0x1f54('0x17')](_0x1f54('0x18'),auth[_0x1f54('0xc')](),interaction[_0x1f54('0x14')](_0x1f54('0x15'),_0x1f54('0x19')),controller['update']);router[_0x1f54('0x1a')](_0x1f54('0x18'),auth[_0x1f54('0xc')](),interaction[_0x1f54('0x14')](_0x1f54('0x15'),_0x1f54('0x1b')),controller[_0x1f54('0x1c')]);router[_0x1f54('0x1a')]('/:id/tags',auth[_0x1f54('0xc')](),controller['removeTags']);module[_0x1f54('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8102cf5..034cd93 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 _0xe630=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xe630,0x149));var _0x0e63=function(_0x5c4669,_0x7f9bcd){_0x5c4669=_0x5c4669-0x0;var _0xf18b6a=_0xe630[_0x5c4669];return _0xf18b6a;};'use strict';var Sequelize=require(_0x0e63('0x0'));module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x4')]('in','out'),'defaultValue':_0x0e63('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0e63('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0e63('0x7')]}}; \ No newline at end of file +var _0xa41a=['out','TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x4b4e2d,_0x1480c5){var _0x1ce3cf=function(_0x317e03){while(--_0x317e03){_0x4b4e2d['push'](_0x4b4e2d['shift']());}};_0x1ce3cf(++_0x1480c5);}(_0xa41a,0x6b));var _0xaa41=function(_0x36c3fa,_0x38497b){_0x36c3fa=_0x36c3fa-0x0;var _0x4b40b0=_0xa41a[_0x36c3fa];return _0x4b40b0;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'body':{'type':Sequelize['TEXT'](_0xaa41('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaa41('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa41('0x4')]('in',_0xaa41('0x5')),'defaultValue':_0xaa41('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xaa41('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0xaa41('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6f51ca2..598865f 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 _0x2c7d=['accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','format','SIP/%s','channel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','interface','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','options','FaxMessage','include','rows','show','find','body','params','describe'];(function(_0x1efcc0,_0x3afbfb){var _0x302556=function(_0x30d975){while(--_0x30d975){_0x1efcc0['push'](_0x1efcc0['shift']());}};_0x302556(++_0x3afbfb);}(_0x2c7d,0xc1));var _0xd2c7=function(_0x32b9eb,_0x287876){_0x32b9eb=_0x32b9eb-0x0;var _0x46d325=_0x2c7d[_0x32b9eb];return _0x46d325;};'use strict';var emlformat=require(_0xd2c7('0x0'));var rimraf=require(_0xd2c7('0x1'));var zipdir=require(_0xd2c7('0x2'));var jsonpatch=require(_0xd2c7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd2c7('0x4'));var Mustache=require(_0xd2c7('0x5'));var util=require('util');var path=require(_0xd2c7('0x6'));var sox=require(_0xd2c7('0x7'));var csv=require('to-csv');var ejs=require(_0xd2c7('0x8'));var fs=require('fs');var fs_extra=require(_0xd2c7('0x9'));var _=require(_0xd2c7('0xa'));var squel=require(_0xd2c7('0xb'));var crypto=require('crypto');var jsforce=require(_0xd2c7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd2c7('0xd'));var querystring=require(_0xd2c7('0xe'));var Papa=require(_0xd2c7('0xf'));var Redis=require(_0xd2c7('0x10'));var authService=require(_0xd2c7('0x11'));var qs=require(_0xd2c7('0x12'));var as=require(_0xd2c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd2c7('0x14'))(_0xd2c7('0x15'));var utils=require(_0xd2c7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd2c7('0x17'));var db=require(_0xd2c7('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd2c7('0x19'),'port':0x18eb});var socket=require(_0xd2c7('0x1a'))(new Redis(config[_0xd2c7('0x1b')]));require(_0xd2c7('0x1c'))[_0xd2c7('0x1d')](socket);var jayson=require(_0xd2c7('0x1e'));var client=jayson[_0xd2c7('0x1f')][_0xd2c7('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xd2c7('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1879d9,_0x54aee4,_0x51c227,_0x25287b){return new BPromise(function(_0xdb59a6,_0x165062){var _0x401ee1=_0x25287b||client;return _0x401ee1['request'](_0x1879d9,_0x51c227)[_0xd2c7('0x21')](function(_0xcdacf3){logger[_0xd2c7('0x22')](_0xd2c7('0x23'),_0x54aee4,_0xd2c7('0x24'));logger['debug'](_0xd2c7('0x25'),_0x54aee4,_0xd2c7('0x24'),JSON[_0xd2c7('0x26')](_0xcdacf3));if(_0xcdacf3[_0xd2c7('0x27')]){if(_0xcdacf3['error'][_0xd2c7('0x28')]===0x1f4){logger[_0xd2c7('0x27')]('FaxMessage,\x20%s,\x20%s',_0x54aee4,_0xcdacf3[_0xd2c7('0x27')][_0xd2c7('0x29')]);return _0x165062(_0xcdacf3[_0xd2c7('0x27')]['message']);}logger[_0xd2c7('0x27')](_0xd2c7('0x23'),_0x54aee4,_0xcdacf3[_0xd2c7('0x27')]['message']);return _0xdb59a6(_0xcdacf3[_0xd2c7('0x27')][_0xd2c7('0x29')]);}else{logger[_0xd2c7('0x22')]('FaxMessage,\x20%s,\x20%s',_0x54aee4,'request\x20sent');_0xdb59a6(_0xcdacf3[_0xd2c7('0x2a')][_0xd2c7('0x29')]);}})[_0xd2c7('0x2b')](function(_0x419aa2){logger[_0xd2c7('0x27')](_0xd2c7('0x23'),_0x54aee4,_0x419aa2);_0x165062(_0x419aa2);});});}function respondWithStatusCode(_0x5ad3d1,_0x597187){_0x597187=_0x597187||0xcc;return function(_0x145eb0){if(_0x145eb0){return _0x5ad3d1['sendStatus'](_0x597187);}return _0x5ad3d1[_0xd2c7('0x2c')](_0x597187)[_0xd2c7('0x2d')]();};}function respondWithResult(_0x3dd0fb,_0x4c85ec){_0x4c85ec=_0x4c85ec||0xc8;return function(_0x50cd16){if(_0x50cd16){return _0x3dd0fb[_0xd2c7('0x2c')](_0x4c85ec)[_0xd2c7('0x2e')](_0x50cd16);}};}function respondWithFilteredResult(_0x594b7d,_0x474751){return function(_0x145b8d){if(_0x145b8d){var _0x3d00fe=typeof _0x474751[_0xd2c7('0x2f')]===_0xd2c7('0x30')&&typeof _0x474751[_0xd2c7('0x31')]===_0xd2c7('0x30');var _0x1cb450=_0x145b8d[_0xd2c7('0x32')];var _0x4c1fea=_0x3d00fe?0x0:_0x474751[_0xd2c7('0x2f')];var _0x4306eb=_0x3d00fe?_0x145b8d[_0xd2c7('0x32')]:_0x474751[_0xd2c7('0x2f')]+_0x474751[_0xd2c7('0x31')];var _0x3047cb;if(_0x4306eb>=_0x1cb450){_0x4306eb=_0x1cb450;_0x3047cb=0xc8;}else{_0x3047cb=0xce;}_0x594b7d['status'](_0x3047cb);return _0x594b7d[_0xd2c7('0x33')]('Content-Range',_0x4c1fea+'-'+_0x4306eb+'/'+_0x1cb450)[_0xd2c7('0x2e')](_0x145b8d);}return null;};}function patchUpdates(_0x92efa4){return function(_0x59b380){try{jsonpatch[_0xd2c7('0x34')](_0x59b380,_0x92efa4,!![]);}catch(_0x171c32){return BPromise['reject'](_0x171c32);}return _0x59b380[_0xd2c7('0x35')]();};}function saveUpdates(_0x475229,_0xfaed00){return function(_0x2dd353){if(_0x2dd353){return _0x2dd353[_0xd2c7('0x36')](_0x475229)[_0xd2c7('0x21')](function(_0x1a3660){return _0x1a3660;});}return null;};}function removeEntity(_0x2a2285,_0x4816c4){return function(_0x353616){if(_0x353616){return _0x353616[_0xd2c7('0x37')]()[_0xd2c7('0x21')](function(){_0x2a2285[_0xd2c7('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5041d6,_0x2969a8){return function(_0x1d9cae){if(!_0x1d9cae){_0x5041d6[_0xd2c7('0x38')](0x194);}return _0x1d9cae;};}function handleError(_0x5b5669,_0x1673ac){_0x1673ac=_0x1673ac||0x1f4;return function(_0x5ac80a){logger[_0xd2c7('0x27')](_0x5ac80a['stack']);if(_0x5ac80a[_0xd2c7('0x39')]){delete _0x5ac80a['name'];}_0x5b5669[_0xd2c7('0x2c')](_0x1673ac)[_0xd2c7('0x3a')](_0x5ac80a);};}exports[_0xd2c7('0x3b')]=function(_0x5584f1,_0xb5b064){var _0x992d8={},_0x407a66={},_0x3d5a4b={'count':0x0,'rows':[]};var _0x4503b5=_['map'](db['FaxMessage'][_0xd2c7('0x3c')],function(_0x26e2fb){return{'name':_0x26e2fb[_0xd2c7('0x3d')],'type':_0x26e2fb[_0xd2c7('0x3e')][_0xd2c7('0x3f')]};});_0x407a66[_0xd2c7('0x40')]=_[_0xd2c7('0x41')](_0x4503b5,_0xd2c7('0x39'));_0x407a66[_0xd2c7('0x42')]=_[_0xd2c7('0x43')](_0x5584f1[_0xd2c7('0x42')]);_0x407a66['filters']=_[_0xd2c7('0x44')](_0x407a66['model'],_0x407a66[_0xd2c7('0x42')]);_0x992d8['attributes']=_[_0xd2c7('0x44')](_0x407a66[_0xd2c7('0x40')],qs[_0xd2c7('0x45')](_0x5584f1[_0xd2c7('0x42')]['fields']));_0x992d8[_0xd2c7('0x46')]=_0x992d8[_0xd2c7('0x46')][_0xd2c7('0x47')]?_0x992d8['attributes']:_0x407a66['model'];if(!_0x5584f1['query']['hasOwnProperty'](_0xd2c7('0x48'))){_0x992d8['limit']=qs[_0xd2c7('0x31')](_0x5584f1['query']['limit']);_0x992d8[_0xd2c7('0x2f')]=qs[_0xd2c7('0x2f')](_0x5584f1['query']['offset']);}_0x992d8[_0xd2c7('0x49')]=qs['sort'](_0x5584f1[_0xd2c7('0x42')][_0xd2c7('0x4a')]);_0x992d8[_0xd2c7('0x4b')]=qs['filters'](_[_0xd2c7('0x4c')](_0x5584f1[_0xd2c7('0x42')],_0x407a66[_0xd2c7('0x4d')]),_0x4503b5);if(_0x5584f1[_0xd2c7('0x42')][_0xd2c7('0x4e')]){_0x992d8['where']=_['merge'](_0x992d8[_0xd2c7('0x4b')],{'$or':_[_0xd2c7('0x41')](_0x4503b5,function(_0x2b1dd6){if(_0x2b1dd6[_0xd2c7('0x3e')]!=='VIRTUAL'){var _0x125b84={};_0x125b84[_0x2b1dd6[_0xd2c7('0x39')]]={'$like':'%'+_0x5584f1['query'][_0xd2c7('0x4e')]+'%'};return _0x125b84;}})});}_0x992d8=_[_0xd2c7('0x4f')]({},_0x992d8,_0x5584f1[_0xd2c7('0x50')]);var _0x2b50fb={'where':_0x992d8['where']};return db[_0xd2c7('0x51')][_0xd2c7('0x32')](_0x2b50fb)[_0xd2c7('0x21')](function(_0x23f01e){_0x3d5a4b[_0xd2c7('0x32')]=_0x23f01e;if(_0x5584f1[_0xd2c7('0x42')]['includeAll']){_0x992d8[_0xd2c7('0x52')]=[{'all':!![]}];}return db[_0xd2c7('0x51')]['findAll'](_0x992d8);})[_0xd2c7('0x21')](function(_0x379e51){_0x3d5a4b[_0xd2c7('0x53')]=_0x379e51;return _0x3d5a4b;})[_0xd2c7('0x21')](respondWithFilteredResult(_0xb5b064,_0x992d8))[_0xd2c7('0x2b')](handleError(_0xb5b064,null));};exports[_0xd2c7('0x54')]=function(_0x3b449a,_0x21f466){var _0x5ec3b0={'raw':!![],'where':{'id':_0x3b449a['params']['id']}},_0x14f2b7={};_0x14f2b7[_0xd2c7('0x40')]=_['keys'](db[_0xd2c7('0x51')]['rawAttributes']);_0x14f2b7[_0xd2c7('0x42')]=_[_0xd2c7('0x43')](_0x3b449a['query']);_0x14f2b7[_0xd2c7('0x4d')]=_['intersection'](_0x14f2b7[_0xd2c7('0x40')],_0x14f2b7['query']);_0x5ec3b0[_0xd2c7('0x46')]=_[_0xd2c7('0x44')](_0x14f2b7[_0xd2c7('0x40')],qs[_0xd2c7('0x45')](_0x3b449a[_0xd2c7('0x42')][_0xd2c7('0x45')]));_0x5ec3b0[_0xd2c7('0x46')]=_0x5ec3b0[_0xd2c7('0x46')][_0xd2c7('0x47')]?_0x5ec3b0[_0xd2c7('0x46')]:_0x14f2b7[_0xd2c7('0x40')];if(_0x3b449a['query']['includeAll']){_0x5ec3b0['include']=[{'all':!![]}];}_0x5ec3b0=_[_0xd2c7('0x4f')]({},_0x5ec3b0,_0x3b449a['options']);return db[_0xd2c7('0x51')][_0xd2c7('0x55')](_0x5ec3b0)[_0xd2c7('0x21')](handleEntityNotFound(_0x21f466,null))[_0xd2c7('0x21')](respondWithResult(_0x21f466,null))[_0xd2c7('0x2b')](handleError(_0x21f466,null));};exports[_0xd2c7('0x36')]=function(_0x41496c,_0x5dcc06){if(_0x41496c[_0xd2c7('0x56')]['id']){delete _0x41496c[_0xd2c7('0x56')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x41496c[_0xd2c7('0x57')]['id']}})['then'](handleEntityNotFound(_0x5dcc06,null))[_0xd2c7('0x21')](saveUpdates(_0x41496c[_0xd2c7('0x56')],null))[_0xd2c7('0x21')](respondWithResult(_0x5dcc06,null))['catch'](handleError(_0x5dcc06,null));};exports[_0xd2c7('0x37')]=function(_0x5bcf4a,_0x22baa0){return db[_0xd2c7('0x51')]['find']({'where':{'id':_0x5bcf4a['params']['id']}})[_0xd2c7('0x21')](handleEntityNotFound(_0x22baa0,null))['then'](removeEntity(_0x22baa0,null))[_0xd2c7('0x2b')](handleError(_0x22baa0,null));};exports[_0xd2c7('0x58')]=function(_0x5074c6,_0x40e226){return db[_0xd2c7('0x51')][_0xd2c7('0x58')]()['then'](respondWithResult(_0x40e226,null))[_0xd2c7('0x2b')](handleError(_0x40e226,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xd2c7('0x59')]=function(_0x501d49,_0x295566,_0x59a8f3){var _0x43244d={'agent':{},'channel':_0xd2c7('0x5a')};if(_0x501d49[_0xd2c7('0x56')]['id']){delete _0x501d49[_0xd2c7('0x56')]['id'];}_0x501d49['body'][_0xd2c7('0x5b')]=!![];_0x501d49['body'][_0xd2c7('0x5c')]=moment()['format'](_0xd2c7('0x5d'));_0x501d49[_0xd2c7('0x56')]['UserId']=_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')]||_0x501d49[_0xd2c7('0x5f')]['id'];_0x43244d[_0xd2c7('0x60')]['id']=_0x501d49[_0xd2c7('0x56')]['UserId'];return db['FaxMessage']['find']({'where':{'id':_0x501d49[_0xd2c7('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x295566,null))[_0xd2c7('0x21')](saveUpdates(_0x501d49[_0xd2c7('0x56')],null))[_0xd2c7('0x21')](function(_0x1147c8){if(_0x1147c8){_0x43244d[_0xd2c7('0x29')]=_0x1147c8['get']({'plain':!![]});return db[_0xd2c7('0x61')][_0xd2c7('0x55')]({'where':{'id':_0x1147c8[_0xd2c7('0x62')]}});}return null;})[_0xd2c7('0x21')](handleEntityNotFound(_0x295566,null))[_0xd2c7('0x21')](function(_0x5c245c){if(_0x5c245c){return _0x5c245c[_0xd2c7('0x36')]({'UserId':_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')],'read1stAt':_[_0xd2c7('0x63')](_0x5c245c[_0xd2c7('0x64')])?moment()['format'](_0xd2c7('0x5d')):undefined});}return null;})[_0xd2c7('0x21')](function(_0x45ea17){if(_0x45ea17){_0x43244d['interaction']=_0x45ea17['get']({'plain':!![]});interaction_log[_0xd2c7('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x501d49[_0xd2c7('0x5f')]['id'],_0x501d49['user']['name'],_0x501d49[_0xd2c7('0x5f')]['role'],_0x43244d[_0xd2c7('0x65')]['id'],_0x501d49[_0xd2c7('0x56')]?JSON['stringify'](_0x501d49['body']):_0xd2c7('0x66'));return respondWithRpcPromise(_0xd2c7('0x67'),_0xd2c7('0x68'),_0x43244d);}return null;})['then'](function(_0x4bf4f9){var _0x137f11=_0xd2c7('0x69')+_0x4bf4f9[_0xd2c7('0x29')][_0xd2c7('0x6a')];return db[_0xd2c7('0x6b')]['query'](_0x137f11,{'type':db['Sequelize'][_0xd2c7('0x6c')][_0xd2c7('0x6d')],'raw':!![]})[_0xd2c7('0x21')](function(_0x5bf8fe){return _0x5bf8fe;});})['then'](function(_0x37ab18){if(_0x37ab18){_0x43244d[_0xd2c7('0x29')][_0xd2c7('0x6e')]=_0x37ab18[0x0];if(!_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')])return;return db[_0xd2c7('0x6f')]['find']({'where':{'id':_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x5e')],'role':_0xd2c7('0x60')},'attributes':['id',_0xd2c7('0x39'),_0xd2c7('0x70'),_0xd2c7('0x71'),_0xd2c7('0x72')],'raw':!![]});}return null;})[_0xd2c7('0x21')](function(_0x4e0ab8){if(!_0x4e0ab8)return null;_0x43244d[_0xd2c7('0x29')]['agent']=_0x4e0ab8;return _0x43244d;})[_0xd2c7('0x21')](function(_0x4564cb){if(_0x4564cb){if(_0x501d49[_0xd2c7('0x56')][_0xd2c7('0x73')]){_0x43244d[_0xd2c7('0x29')]['interface']=util[_0xd2c7('0x74')](_0xd2c7('0x75'),_0x501d49[_0xd2c7('0x5f')][_0xd2c7('0x39')]);_0x43244d[_0xd2c7('0x29')]['channel']=_0x43244d[_0xd2c7('0x76')];_0x43244d[_0xd2c7('0x29')]['motionChannel']=_0x43244d[_0xd2c7('0x76')];_0x43244d[_0xd2c7('0x29')][_0xd2c7('0x77')]=_0xd2c7('0x59');return respondWithRpcPromise(_0xd2c7('0x78'),_0xd2c7('0x78'),{'event':_0xd2c7('0x79'),'message':_0x43244d[_0xd2c7('0x29')]},client9002)['then'](function(){return _0x43244d;});}return _0x43244d;}return null;})[_0xd2c7('0x21')](respondWithResult(_0x295566,null))[_0xd2c7('0x2b')](handleError(_0x295566,null));};var interaction_log=require(_0xd2c7('0x14'))('fax-interactions');exports[_0xd2c7('0x7a')]=function(_0x5c1d7f,_0x351d2b,_0x24020d){var _0x2391b2={'agent':{},'channel':_0xd2c7('0x5a')};if(_0x5c1d7f[_0xd2c7('0x56')]['id']){delete _0x5c1d7f[_0xd2c7('0x56')]['id'];}_0x5c1d7f[_0xd2c7('0x56')][_0xd2c7('0x5e')]=_0x5c1d7f[_0xd2c7('0x56')]['UserId']||_0x5c1d7f[_0xd2c7('0x5f')]['id'];_0x2391b2['agent']['id']=_0x5c1d7f[_0xd2c7('0x56')][_0xd2c7('0x5e')];return db[_0xd2c7('0x51')][_0xd2c7('0x55')]({'where':{'id':_0x5c1d7f['params']['id'],'UserId':null}})[_0xd2c7('0x21')](handleEntityNotFound(_0x351d2b,null))[_0xd2c7('0x21')](function(_0x2d414c){if(_0x2d414c){_0x2391b2[_0xd2c7('0x29')]=_0x2d414c['get']({'plain':!![]});return db[_0xd2c7('0x61')][_0xd2c7('0x55')]({'where':{'id':_0x2d414c[_0xd2c7('0x62')]}});}return null;})[_0xd2c7('0x21')](handleEntityNotFound(_0x351d2b,null))['then'](function(_0x11c57b){if(_0x11c57b){_0x2391b2[_0xd2c7('0x65')]=_0x11c57b['get']({'plain':!![]});interaction_log[_0xd2c7('0x22')](_0xd2c7('0x7b'),_0x5c1d7f[_0xd2c7('0x5f')]['id'],_0x5c1d7f[_0xd2c7('0x5f')][_0xd2c7('0x39')],_0x5c1d7f[_0xd2c7('0x5f')]['role'],_0x2391b2[_0xd2c7('0x65')]['id'],_0x5c1d7f[_0xd2c7('0x56')]?JSON[_0xd2c7('0x26')](_0x5c1d7f[_0xd2c7('0x56')]):_0xd2c7('0x66'));return respondWithRpcPromise(_0xd2c7('0x7c'),_0xd2c7('0x7d'),_0x2391b2);}return null;})[_0xd2c7('0x21')](function(_0x25389c){var _0x33dd75=_0xd2c7('0x69')+_0x25389c[_0xd2c7('0x29')]['ContactId'];return db[_0xd2c7('0x6b')][_0xd2c7('0x42')](_0x33dd75,{'type':db[_0xd2c7('0x7e')][_0xd2c7('0x6c')][_0xd2c7('0x6d')],'raw':!![]})[_0xd2c7('0x21')](function(_0x2d9151){return _0x2d9151;});})[_0xd2c7('0x21')](function(_0x3e9037){if(_0x3e9037){_0x2391b2[_0xd2c7('0x29')][_0xd2c7('0x6e')]=_0x3e9037[0x0];if(!_0x5c1d7f['body'][_0xd2c7('0x5e')])return;return db[_0xd2c7('0x6f')][_0xd2c7('0x55')]({'where':{'id':_0x5c1d7f['body'][_0xd2c7('0x5e')],'role':_0xd2c7('0x60')},'attributes':['id','name',_0xd2c7('0x70'),_0xd2c7('0x71'),_0xd2c7('0x72')],'raw':!![]});}return null;})['then'](function(_0x16c5f6){if(!_0x16c5f6)return null;_0x2391b2[_0xd2c7('0x29')]['agent']=_0x16c5f6;return _0x2391b2;})[_0xd2c7('0x21')](function(_0x29edcb){if(_0x29edcb){_0x29edcb['message'][_0xd2c7('0x7f')]=util[_0xd2c7('0x74')]('SIP/%s',_0x5c1d7f[_0xd2c7('0x5f')][_0xd2c7('0x39')]);_0x29edcb[_0xd2c7('0x29')][_0xd2c7('0x76')]=_0x2391b2['channel'];_0x29edcb[_0xd2c7('0x29')]['motionChannel']=_0x2391b2['channel'];_0x29edcb[_0xd2c7('0x29')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xd2c7('0x80'),'message':_0x29edcb['message']},client9002);return _0x2391b2;}return null;})['then'](respondWithResult(_0x351d2b,null))[_0xd2c7('0x2b')](handleError(_0x351d2b,null));};exports[_0xd2c7('0x81')]=function(_0x363e9d,_0x1e96bb){var _0x384c47;return db[_0xd2c7('0x51')]['create'](_0x363e9d['body'],{})[_0xd2c7('0x21')](function(_0x337db0){_0x384c47=_0x337db0;return db[_0xd2c7('0x82')]['findOne']({'where':{'id':_0x384c47[_0xd2c7('0x6a')]}});})[_0xd2c7('0x21')](function(_0x2881d1){if(_[_0xd2c7('0x63')](_0x2881d1)){return;}else{_0x384c47[_0xd2c7('0x5a')]=_0x2881d1[_0xd2c7('0x5a')];return db[_0xd2c7('0x83')][_0xd2c7('0x84')]({'where':{'id':_0x384c47[_0xd2c7('0x85')]}});}})[_0xd2c7('0x21')](function(_0xeff291){return respondWithRpcPromise(_0xd2c7('0x86'),_0xd2c7('0x86'),{'FaxAccountId':_['isNil'](_0x363e9d[_0xd2c7('0x56')])?undefined:_0x363e9d[_0xd2c7('0x56')][_0xd2c7('0x87')],'path':_[_0xd2c7('0x63')](_0xeff291)?undefined:util[_0xd2c7('0x74')]('/var/opt/motion2/server/files/attachments/%s',_0xeff291[_0xd2c7('0x88')]),'fax':_[_0xd2c7('0x63')](_0x384c47[_0xd2c7('0x5a')])?undefined:_0x384c47[_0xd2c7('0x5a')],'AttachmentId':_0x384c47[_0xd2c7('0x85')]},client9002);})[_0xd2c7('0x21')](respondWithResult(_0x1e96bb,0xc9))[_0xd2c7('0x2b')](handleError(_0x1e96bb,null));};exports[_0xd2c7('0x89')]=function(_0x19e016,_0x74ba0a){var _0x1328cf=path[_0xd2c7('0x8a')](config[_0xd2c7('0x8b')],_0xd2c7('0x8c'),'files','attachments');return db[_0xd2c7('0x51')][_0xd2c7('0x55')]({'where':{'id':_0x19e016[_0xd2c7('0x57')]['id']},'include':[{'model':db[_0xd2c7('0x83')],'as':_0xd2c7('0x83')}]})[_0xd2c7('0x21')](handleEntityNotFound(_0x74ba0a,null))['then'](function(_0x148e00){if(_0x148e00){return _0x74ba0a[_0xd2c7('0x89')](path[_0xd2c7('0x8a')](_0x1328cf,_0x148e00[_0xd2c7('0x83')][_0xd2c7('0x88')]));}})[_0xd2c7('0x2b')](handleError(_0x74ba0a,null));}; \ No newline at end of file +var _0x0eb7=['format','UserId','user','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','fax','get','info','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','motionChannel','event','rejectmessage','create','CmContact','findOne','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','download','join','root','server','files','attachments','basename','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','sendStatus','stack','send','index','map','FaxMessage','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','show','params','rawAttributes','options','find','update','body','destroy','describe','fax-interactions','accept','read','readAt'];(function(_0x4b7d2a,_0x41a4ba){var _0x4d2f32=function(_0x7b066){while(--_0x7b066){_0x4b7d2a['push'](_0x4b7d2a['shift']());}};_0x4d2f32(++_0x41a4ba);}(_0x0eb7,0x1f3));var _0x70eb=function(_0x22adac,_0x4f8462){_0x22adac=_0x22adac-0x0;var _0x410db7=_0x0eb7[_0x22adac];return _0x410db7;};'use strict';var emlformat=require(_0x70eb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x70eb('0x1'));var rp=require(_0x70eb('0x2'));var moment=require(_0x70eb('0x3'));var BPromise=require(_0x70eb('0x4'));var Mustache=require('mustache');var util=require(_0x70eb('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x70eb('0x6'));var ejs=require(_0x70eb('0x7'));var fs=require('fs');var fs_extra=require(_0x70eb('0x8'));var _=require(_0x70eb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x70eb('0xa'));var toCsv=require(_0x70eb('0x6'));var querystring=require('querystring');var Papa=require(_0x70eb('0xb'));var Redis=require('ioredis');var authService=require(_0x70eb('0xc'));var qs=require(_0x70eb('0xd'));var as=require(_0x70eb('0xe'));var hardwareService=require(_0x70eb('0xf'));var logger=require(_0x70eb('0x10'))(_0x70eb('0x11'));var utils=require(_0x70eb('0x12'));var config=require(_0x70eb('0x13'));var licenseUtil=require(_0x70eb('0x14'));var db=require(_0x70eb('0x15'))['db'];config[_0x70eb('0x16')]=_[_0x70eb('0x17')](config[_0x70eb('0x16')],{'host':_0x70eb('0x18'),'port':0x18eb});var socket=require(_0x70eb('0x19'))(new Redis(config[_0x70eb('0x16')]));require(_0x70eb('0x1a'))[_0x70eb('0x1b')](socket);var jayson=require(_0x70eb('0x1c'));var client=jayson[_0x70eb('0x1d')][_0x70eb('0x1e')]({'port':0x232c});var client9002=jayson[_0x70eb('0x1d')][_0x70eb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5d0e23,_0x125d79,_0x4296d0,_0x71c42e){return new BPromise(function(_0x768a22,_0x2b4daf){var _0x2dd8f8=_0x71c42e||client;return _0x2dd8f8[_0x70eb('0x1f')](_0x5d0e23,_0x4296d0)[_0x70eb('0x20')](function(_0x383b50){logger['info'](_0x70eb('0x21'),_0x125d79,_0x70eb('0x22'));logger[_0x70eb('0x23')](_0x70eb('0x24'),_0x125d79,'request\x20sent',JSON['stringify'](_0x383b50));if(_0x383b50[_0x70eb('0x25')]){if(_0x383b50[_0x70eb('0x25')][_0x70eb('0x26')]===0x1f4){logger[_0x70eb('0x25')]('FaxMessage,\x20%s,\x20%s',_0x125d79,_0x383b50[_0x70eb('0x25')][_0x70eb('0x27')]);return _0x2b4daf(_0x383b50[_0x70eb('0x25')][_0x70eb('0x27')]);}logger['error'](_0x70eb('0x21'),_0x125d79,_0x383b50[_0x70eb('0x25')][_0x70eb('0x27')]);return _0x768a22(_0x383b50[_0x70eb('0x25')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x125d79,_0x70eb('0x22'));_0x768a22(_0x383b50['result']['message']);}})[_0x70eb('0x28')](function(_0x206ff8){logger[_0x70eb('0x25')](_0x70eb('0x21'),_0x125d79,_0x206ff8);_0x2b4daf(_0x206ff8);});});}function respondWithStatusCode(_0x424241,_0x5e0909){_0x5e0909=_0x5e0909||0xcc;return function(_0x1b362b){if(_0x1b362b){return _0x424241['sendStatus'](_0x5e0909);}return _0x424241[_0x70eb('0x29')](_0x5e0909)[_0x70eb('0x2a')]();};}function respondWithResult(_0x3913a4,_0x308a49){_0x308a49=_0x308a49||0xc8;return function(_0x67130b){if(_0x67130b){return _0x3913a4[_0x70eb('0x29')](_0x308a49)[_0x70eb('0x2b')](_0x67130b);}};}function respondWithFilteredResult(_0x23466a,_0x2c53c3){return function(_0x25b84e){if(_0x25b84e){var _0x56138b=typeof _0x2c53c3[_0x70eb('0x2c')]==='undefined'&&typeof _0x2c53c3[_0x70eb('0x2d')]===_0x70eb('0x2e');var _0x564653=_0x25b84e[_0x70eb('0x2f')];var _0x1a6168=_0x56138b?0x0:_0x2c53c3[_0x70eb('0x2c')];var _0x523f83=_0x56138b?_0x25b84e['count']:_0x2c53c3[_0x70eb('0x2c')]+_0x2c53c3[_0x70eb('0x2d')];var _0x42b08c;if(_0x523f83>=_0x564653){_0x523f83=_0x564653;_0x42b08c=0xc8;}else{_0x42b08c=0xce;}_0x23466a[_0x70eb('0x29')](_0x42b08c);return _0x23466a[_0x70eb('0x30')](_0x70eb('0x31'),_0x1a6168+'-'+_0x523f83+'/'+_0x564653)[_0x70eb('0x2b')](_0x25b84e);}return null;};}function patchUpdates(_0x133169){return function(_0x56c716){try{jsonpatch['apply'](_0x56c716,_0x133169,!![]);}catch(_0x2b8f3d){return BPromise[_0x70eb('0x32')](_0x2b8f3d);}return _0x56c716[_0x70eb('0x33')]();};}function saveUpdates(_0x516a1e,_0xa73669){return function(_0x418618){if(_0x418618){return _0x418618['update'](_0x516a1e)['then'](function(_0x1d0900){return _0x1d0900;});}return null;};}function removeEntity(_0x50d806,_0x3c17df){return function(_0x39b787){if(_0x39b787){return _0x39b787['destroy']()[_0x70eb('0x20')](function(){_0x50d806[_0x70eb('0x29')](0xcc)[_0x70eb('0x2a')]();});}};}function handleEntityNotFound(_0xa01702,_0x487beb){return function(_0x53fb9e){if(!_0x53fb9e){_0xa01702[_0x70eb('0x34')](0x194);}return _0x53fb9e;};}function handleError(_0x15e576,_0x42c86c){_0x42c86c=_0x42c86c||0x1f4;return function(_0x5a831b){logger[_0x70eb('0x25')](_0x5a831b[_0x70eb('0x35')]);if(_0x5a831b['name']){delete _0x5a831b['name'];}_0x15e576['status'](_0x42c86c)[_0x70eb('0x36')](_0x5a831b);};}exports[_0x70eb('0x37')]=function(_0x1b55c2,_0x297d63){var _0x1bd3f5={},_0x22cc11={},_0x2e9cd5={'count':0x0,'rows':[]};var _0x6be411=_[_0x70eb('0x38')](db[_0x70eb('0x39')]['rawAttributes'],function(_0x3f1403){return{'name':_0x3f1403[_0x70eb('0x3a')],'type':_0x3f1403['type'][_0x70eb('0x3b')]};});_0x22cc11[_0x70eb('0x3c')]=_['map'](_0x6be411,_0x70eb('0x3d'));_0x22cc11[_0x70eb('0x3e')]=_[_0x70eb('0x3f')](_0x1b55c2[_0x70eb('0x3e')]);_0x22cc11[_0x70eb('0x40')]=_[_0x70eb('0x41')](_0x22cc11[_0x70eb('0x3c')],_0x22cc11[_0x70eb('0x3e')]);_0x1bd3f5[_0x70eb('0x42')]=_['intersection'](_0x22cc11[_0x70eb('0x3c')],qs['fields'](_0x1b55c2['query'][_0x70eb('0x43')]));_0x1bd3f5['attributes']=_0x1bd3f5[_0x70eb('0x42')][_0x70eb('0x44')]?_0x1bd3f5[_0x70eb('0x42')]:_0x22cc11[_0x70eb('0x3c')];if(!_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x45')](_0x70eb('0x46'))){_0x1bd3f5[_0x70eb('0x2d')]=qs[_0x70eb('0x2d')](_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x2d')]);_0x1bd3f5[_0x70eb('0x2c')]=qs[_0x70eb('0x2c')](_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x2c')]);}_0x1bd3f5['order']=qs[_0x70eb('0x47')](_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x47')]);_0x1bd3f5[_0x70eb('0x48')]=qs[_0x70eb('0x40')](_[_0x70eb('0x49')](_0x1b55c2[_0x70eb('0x3e')],_0x22cc11[_0x70eb('0x40')]),_0x6be411);if(_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x4a')]){_0x1bd3f5['where']=_[_0x70eb('0x4b')](_0x1bd3f5[_0x70eb('0x48')],{'$or':_[_0x70eb('0x38')](_0x6be411,function(_0x40d519){if(_0x40d519[_0x70eb('0x4c')]!=='VIRTUAL'){var _0x40df6c={};_0x40df6c[_0x40d519[_0x70eb('0x3d')]]={'$like':'%'+_0x1b55c2[_0x70eb('0x3e')]['filter']+'%'};return _0x40df6c;}})});}_0x1bd3f5=_[_0x70eb('0x4b')]({},_0x1bd3f5,_0x1b55c2['options']);var _0x3557a4={'where':_0x1bd3f5[_0x70eb('0x48')]};return db[_0x70eb('0x39')][_0x70eb('0x2f')](_0x3557a4)[_0x70eb('0x20')](function(_0xf0aea7){_0x2e9cd5['count']=_0xf0aea7;if(_0x1b55c2[_0x70eb('0x3e')][_0x70eb('0x4d')]){_0x1bd3f5[_0x70eb('0x4e')]=[{'all':!![]}];}return db[_0x70eb('0x39')][_0x70eb('0x4f')](_0x1bd3f5);})[_0x70eb('0x20')](function(_0x3d7a49){_0x2e9cd5['rows']=_0x3d7a49;return _0x2e9cd5;})[_0x70eb('0x20')](respondWithFilteredResult(_0x297d63,_0x1bd3f5))[_0x70eb('0x28')](handleError(_0x297d63,null));};exports[_0x70eb('0x50')]=function(_0x507e30,_0x4419e8){var _0x7e44d={'raw':!![],'where':{'id':_0x507e30[_0x70eb('0x51')]['id']}},_0x6ba9b5={};_0x6ba9b5[_0x70eb('0x3c')]=_['keys'](db[_0x70eb('0x39')][_0x70eb('0x52')]);_0x6ba9b5[_0x70eb('0x3e')]=_[_0x70eb('0x3f')](_0x507e30['query']);_0x6ba9b5['filters']=_[_0x70eb('0x41')](_0x6ba9b5['model'],_0x6ba9b5[_0x70eb('0x3e')]);_0x7e44d[_0x70eb('0x42')]=_[_0x70eb('0x41')](_0x6ba9b5[_0x70eb('0x3c')],qs[_0x70eb('0x43')](_0x507e30['query'][_0x70eb('0x43')]));_0x7e44d[_0x70eb('0x42')]=_0x7e44d[_0x70eb('0x42')][_0x70eb('0x44')]?_0x7e44d['attributes']:_0x6ba9b5[_0x70eb('0x3c')];if(_0x507e30[_0x70eb('0x3e')][_0x70eb('0x4d')]){_0x7e44d[_0x70eb('0x4e')]=[{'all':!![]}];}_0x7e44d=_[_0x70eb('0x4b')]({},_0x7e44d,_0x507e30[_0x70eb('0x53')]);return db[_0x70eb('0x39')][_0x70eb('0x54')](_0x7e44d)[_0x70eb('0x20')](handleEntityNotFound(_0x4419e8,null))[_0x70eb('0x20')](respondWithResult(_0x4419e8,null))[_0x70eb('0x28')](handleError(_0x4419e8,null));};exports[_0x70eb('0x55')]=function(_0x172218,_0x54b479){if(_0x172218[_0x70eb('0x56')]['id']){delete _0x172218[_0x70eb('0x56')]['id'];}return db['FaxMessage'][_0x70eb('0x54')]({'where':{'id':_0x172218[_0x70eb('0x51')]['id']}})['then'](handleEntityNotFound(_0x54b479,null))[_0x70eb('0x20')](saveUpdates(_0x172218[_0x70eb('0x56')],null))[_0x70eb('0x20')](respondWithResult(_0x54b479,null))[_0x70eb('0x28')](handleError(_0x54b479,null));};exports[_0x70eb('0x57')]=function(_0x58074e,_0x234688){return db['FaxMessage'][_0x70eb('0x54')]({'where':{'id':_0x58074e[_0x70eb('0x51')]['id']}})[_0x70eb('0x20')](handleEntityNotFound(_0x234688,null))['then'](removeEntity(_0x234688,null))[_0x70eb('0x28')](handleError(_0x234688,null));};exports['describe']=function(_0x36e1b7,_0x5bb9dd){return db['FaxMessage'][_0x70eb('0x58')]()[_0x70eb('0x20')](respondWithResult(_0x5bb9dd,null))[_0x70eb('0x28')](handleError(_0x5bb9dd,null));};var interaction_log=require('../../config/logger')(_0x70eb('0x59'));exports[_0x70eb('0x5a')]=function(_0x2237a1,_0x35b80d,_0x3291dc){var _0x292ea3={'agent':{},'channel':'fax'};if(_0x2237a1[_0x70eb('0x56')]['id']){delete _0x2237a1[_0x70eb('0x56')]['id'];}_0x2237a1[_0x70eb('0x56')][_0x70eb('0x5b')]=!![];_0x2237a1[_0x70eb('0x56')][_0x70eb('0x5c')]=moment()[_0x70eb('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2237a1[_0x70eb('0x56')][_0x70eb('0x5e')]=_0x2237a1[_0x70eb('0x56')]['UserId']||_0x2237a1[_0x70eb('0x5f')]['id'];_0x292ea3['agent']['id']=_0x2237a1[_0x70eb('0x56')][_0x70eb('0x5e')];return db[_0x70eb('0x39')][_0x70eb('0x54')]({'where':{'id':_0x2237a1['params']['id'],'UserId':null}})[_0x70eb('0x20')](handleEntityNotFound(_0x35b80d,null))[_0x70eb('0x20')](saveUpdates(_0x2237a1[_0x70eb('0x56')],null))[_0x70eb('0x20')](function(_0x557c58){if(_0x557c58){_0x292ea3[_0x70eb('0x27')]=_0x557c58['get']({'plain':!![]});return db[_0x70eb('0x60')][_0x70eb('0x54')]({'where':{'id':_0x557c58[_0x70eb('0x61')]}});}return null;})[_0x70eb('0x20')](handleEntityNotFound(_0x35b80d,null))[_0x70eb('0x20')](function(_0xe8d886){if(_0xe8d886){return _0xe8d886[_0x70eb('0x55')]({'UserId':_0x2237a1[_0x70eb('0x56')]['UserId'],'read1stAt':_[_0x70eb('0x62')](_0xe8d886[_0x70eb('0x63')])?moment()[_0x70eb('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x70eb('0x20')](function(_0x1901be){if(_0x1901be){_0x292ea3[_0x70eb('0x64')]=_0x1901be['get']({'plain':!![]});interaction_log['info'](_0x70eb('0x65'),_0x2237a1['user']['id'],_0x2237a1[_0x70eb('0x5f')][_0x70eb('0x3d')],_0x2237a1[_0x70eb('0x5f')][_0x70eb('0x66')],_0x292ea3['interaction']['id'],_0x2237a1[_0x70eb('0x56')]?JSON[_0x70eb('0x67')](_0x2237a1[_0x70eb('0x56')]):_0x70eb('0x68'));return respondWithRpcPromise(_0x70eb('0x69'),_0x70eb('0x6a'),_0x292ea3);}return null;})[_0x70eb('0x20')](function(_0x3f67d8){var _0x37e634=_0x70eb('0x6b')+_0x3f67d8[_0x70eb('0x27')][_0x70eb('0x6c')];return db[_0x70eb('0x6d')][_0x70eb('0x3e')](_0x37e634,{'type':db[_0x70eb('0x6e')][_0x70eb('0x6f')]['SELECT'],'raw':!![]})[_0x70eb('0x20')](function(_0xb9c062){return _0xb9c062;});})[_0x70eb('0x20')](function(_0x27562b){if(_0x27562b){_0x292ea3[_0x70eb('0x27')][_0x70eb('0x70')]=_0x27562b[0x0];if(!_0x2237a1[_0x70eb('0x56')][_0x70eb('0x5e')])return;return db[_0x70eb('0x71')][_0x70eb('0x54')]({'where':{'id':_0x2237a1['body'][_0x70eb('0x5e')],'role':_0x70eb('0x72')},'attributes':['id','name',_0x70eb('0x73'),_0x70eb('0x74'),_0x70eb('0x75')],'raw':!![]});}return null;})[_0x70eb('0x20')](function(_0x298b78){if(!_0x298b78)return null;_0x292ea3[_0x70eb('0x27')]['agent']=_0x298b78;return _0x292ea3;})['then'](function(_0x7b0272){if(_0x7b0272){if(_0x2237a1['body'][_0x70eb('0x76')]){_0x292ea3[_0x70eb('0x27')][_0x70eb('0x77')]=util[_0x70eb('0x5d')](_0x70eb('0x78'),_0x2237a1[_0x70eb('0x5f')][_0x70eb('0x3d')]);_0x292ea3[_0x70eb('0x27')][_0x70eb('0x79')]=_0x292ea3[_0x70eb('0x79')];_0x292ea3[_0x70eb('0x27')]['motionChannel']=_0x292ea3[_0x70eb('0x79')];_0x292ea3['message']['event']=_0x70eb('0x5a');return respondWithRpcPromise('EventManager',_0x70eb('0x7a'),{'event':_0x70eb('0x7b'),'message':_0x292ea3['message']},client9002)[_0x70eb('0x20')](function(){return _0x292ea3;});}return _0x292ea3;}return null;})[_0x70eb('0x20')](respondWithResult(_0x35b80d,null))[_0x70eb('0x28')](handleError(_0x35b80d,null));};var interaction_log=require(_0x70eb('0x10'))(_0x70eb('0x59'));exports[_0x70eb('0x32')]=function(_0x319b24,_0x4c5c72,_0x1888e9){var _0x4306c9={'agent':{},'channel':_0x70eb('0x7c')};if(_0x319b24[_0x70eb('0x56')]['id']){delete _0x319b24[_0x70eb('0x56')]['id'];}_0x319b24[_0x70eb('0x56')]['UserId']=_0x319b24[_0x70eb('0x56')]['UserId']||_0x319b24[_0x70eb('0x5f')]['id'];_0x4306c9[_0x70eb('0x72')]['id']=_0x319b24[_0x70eb('0x56')]['UserId'];return db[_0x70eb('0x39')][_0x70eb('0x54')]({'where':{'id':_0x319b24[_0x70eb('0x51')]['id'],'UserId':null}})[_0x70eb('0x20')](handleEntityNotFound(_0x4c5c72,null))[_0x70eb('0x20')](function(_0x1c3684){if(_0x1c3684){_0x4306c9[_0x70eb('0x27')]=_0x1c3684[_0x70eb('0x7d')]({'plain':!![]});return db[_0x70eb('0x60')][_0x70eb('0x54')]({'where':{'id':_0x1c3684[_0x70eb('0x61')]}});}return null;})[_0x70eb('0x20')](handleEntityNotFound(_0x4c5c72,null))[_0x70eb('0x20')](function(_0x1ca96c){if(_0x1ca96c){_0x4306c9[_0x70eb('0x64')]=_0x1ca96c[_0x70eb('0x7d')]({'plain':!![]});interaction_log[_0x70eb('0x7e')](_0x70eb('0x7f'),_0x319b24['user']['id'],_0x319b24['user'][_0x70eb('0x3d')],_0x319b24[_0x70eb('0x5f')][_0x70eb('0x66')],_0x4306c9[_0x70eb('0x64')]['id'],_0x319b24['body']?JSON[_0x70eb('0x67')](_0x319b24['body']):'null');return respondWithRpcPromise(_0x70eb('0x80'),_0x70eb('0x81'),_0x4306c9);}return null;})[_0x70eb('0x20')](function(_0xbe71e8){var _0xc2ece2=_0x70eb('0x6b')+_0xbe71e8[_0x70eb('0x27')]['ContactId'];return db[_0x70eb('0x6d')][_0x70eb('0x3e')](_0xc2ece2,{'type':db[_0x70eb('0x6e')]['QueryTypes'][_0x70eb('0x82')],'raw':!![]})[_0x70eb('0x20')](function(_0x47738c){return _0x47738c;});})[_0x70eb('0x20')](function(_0x12188e){if(_0x12188e){_0x4306c9[_0x70eb('0x27')][_0x70eb('0x70')]=_0x12188e[0x0];if(!_0x319b24[_0x70eb('0x56')]['UserId'])return;return db[_0x70eb('0x71')][_0x70eb('0x54')]({'where':{'id':_0x319b24[_0x70eb('0x56')][_0x70eb('0x5e')],'role':'agent'},'attributes':['id',_0x70eb('0x3d'),'fullname',_0x70eb('0x74'),'internal'],'raw':!![]});}return null;})[_0x70eb('0x20')](function(_0x12184a){if(!_0x12184a)return null;_0x4306c9['message']['agent']=_0x12184a;return _0x4306c9;})[_0x70eb('0x20')](function(_0x103f24){if(_0x103f24){_0x103f24[_0x70eb('0x27')]['interface']=util['format'](_0x70eb('0x78'),_0x319b24[_0x70eb('0x5f')][_0x70eb('0x3d')]);_0x103f24[_0x70eb('0x27')]['channel']=_0x4306c9[_0x70eb('0x79')];_0x103f24['message'][_0x70eb('0x83')]=_0x4306c9[_0x70eb('0x79')];_0x103f24[_0x70eb('0x27')][_0x70eb('0x84')]=_0x70eb('0x32');respondWithRpcPromise('EventManager',_0x70eb('0x7a'),{'event':_0x70eb('0x85'),'message':_0x103f24['message']},client9002);return _0x4306c9;}return null;})[_0x70eb('0x20')](respondWithResult(_0x4c5c72,null))[_0x70eb('0x28')](handleError(_0x4c5c72,null));};exports[_0x70eb('0x86')]=function(_0x49f8a8,_0x1a841a){var _0x47e22c;return db[_0x70eb('0x39')][_0x70eb('0x86')](_0x49f8a8[_0x70eb('0x56')],{})[_0x70eb('0x20')](function(_0x26ec35){_0x47e22c=_0x26ec35;return db[_0x70eb('0x87')][_0x70eb('0x88')]({'where':{'id':_0x47e22c[_0x70eb('0x6c')]}});})[_0x70eb('0x20')](function(_0x2ed54f){if(_['isNil'](_0x2ed54f)){return;}else{_0x47e22c['fax']=_0x2ed54f[_0x70eb('0x7c')];return db[_0x70eb('0x89')][_0x70eb('0x88')]({'where':{'id':_0x47e22c['AttachmentId']}});}})['then'](function(_0x39db0d){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x70eb('0x62')](_0x49f8a8[_0x70eb('0x56')])?undefined:_0x49f8a8['body'][_0x70eb('0x8a')],'path':_[_0x70eb('0x62')](_0x39db0d)?undefined:util[_0x70eb('0x5d')](_0x70eb('0x8b'),_0x39db0d['basename']),'fax':_[_0x70eb('0x62')](_0x47e22c[_0x70eb('0x7c')])?undefined:_0x47e22c[_0x70eb('0x7c')],'AttachmentId':_0x47e22c[_0x70eb('0x8c')]},client9002);})[_0x70eb('0x20')](respondWithResult(_0x1a841a,0xc9))[_0x70eb('0x28')](handleError(_0x1a841a,null));};exports[_0x70eb('0x8d')]=function(_0x5f2bfa,_0x18d85d){var _0x3afe6e=path[_0x70eb('0x8e')](config[_0x70eb('0x8f')],_0x70eb('0x90'),_0x70eb('0x91'),_0x70eb('0x92'));return db['FaxMessage'][_0x70eb('0x54')]({'where':{'id':_0x5f2bfa['params']['id']},'include':[{'model':db['Attachment'],'as':_0x70eb('0x89')}]})['then'](handleEntityNotFound(_0x18d85d,null))[_0x70eb('0x20')](function(_0x40be07){if(_0x40be07){return _0x18d85d[_0x70eb('0x8d')](path[_0x70eb('0x8e')](_0x3afe6e,_0x40be07[_0x70eb('0x89')][_0x70eb('0x93')]));}})['catch'](handleError(_0x18d85d,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e06f3d1..fb732f6 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 _0x78f4=['../../mysqldb','FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x5c1a27,_0xebb5dd){var _0x45f58f=function(_0x226ef2){while(--_0x226ef2){_0x5c1a27['push'](_0x5c1a27['shift']());}};_0x45f58f(++_0xebb5dd);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x478f('0x0'))['db'][_0x478f('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x478f('0x2')](0x0);var events={'afterCreate':_0x478f('0x3'),'afterUpdate':'update','afterDestroy':_0x478f('0x4')};function emitEvent(_0x4d004a){return function(_0x1965e3,_0xc3eb,_0x229f69){FaxMessageEvents['emit'](_0x4d004a+':'+_0x1965e3['id'],_0x1965e3);FaxMessageEvents[_0x478f('0x5')](_0x4d004a,_0x1965e3);_0x229f69(null);};}for(var e in events){if(events[_0x478f('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x478f('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x1059=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x1b32b4,_0x286da1){var _0x35866e=function(_0x2e127f){while(--_0x2e127f){_0x1b32b4['push'](_0x1b32b4['shift']());}};_0x35866e(++_0x286da1);}(_0x1059,0x176));var _0x9105=function(_0x5f2870,_0x184054){_0x5f2870=_0x5f2870-0x0;var _0x51b9b0=_0x1059[_0x5f2870];return _0x51b9b0;};'use strict';var EventEmitter=require(_0x9105('0x0'));var FaxMessage=require(_0x9105('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9105('0x2')](0x0);var events={'afterCreate':_0x9105('0x3'),'afterUpdate':_0x9105('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3565b3){return function(_0x59b3db,_0x44878b,_0x219176){FaxMessageEvents['emit'](_0x3565b3+':'+_0x59b3db['id'],_0x59b3db);FaxMessageEvents[_0x9105('0x5')](_0x3565b3,_0x59b3db);_0x219176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x9105('0x6')](e,emitEvent(event));}}module[_0x9105('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d26b57c..2eaade4 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 _0xe83c=['findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction'];(function(_0x4650f8,_0x4fd197){var _0x18b8f6=function(_0x58ee0f){while(--_0x58ee0f){_0x4650f8['push'](_0x4650f8['shift']());}};_0x18b8f6(++_0x4fd197);}(_0xe83c,0x88));var _0xce83=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0xe83c[_0x2726ad];return _0xd87993;};'use strict';var _=require(_0xce83('0x0'));var util=require(_0xce83('0x1'));var logger=require(_0xce83('0x2'))(_0xce83('0x3'));var moment=require(_0xce83('0x4'));var BPromise=require(_0xce83('0x5'));var rp=require(_0xce83('0x6'));var fs=require('fs');var path=require(_0xce83('0x7'));var rimraf=require(_0xce83('0x8'));var config=require(_0xce83('0x9'));var attributes=require(_0xce83('0xa'));module[_0xce83('0xb')]=function(_0x206306,_0x2ee363){return _0x206306['define'](_0xce83('0xc'),attributes,{'tableName':_0xce83('0xd'),'paranoid':![],'indexes':[{'name':_0xce83('0xe'),'fields':[_0xce83('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf8f3bc,_0x4f4ffe,_0x593279){var _0xeb07b5=_0x206306[_0xce83('0x10')];var _0x2423dc=_0xf8f3bc['get']({'plain':!![]});if(_0x2423dc[_0xce83('0x11')][_0xce83('0x12')]()==='in'||_0x2423dc['direction'][_0xce83('0x12')]()===_0xce83('0x13')&&!_0x2423dc[_0xce83('0x14')]&&!_[_0xce83('0x15')](_0x2423dc[_0xce83('0x16')])){_0xeb07b5[_0xce83('0x17')][_0xce83('0x18')]({'where':{'id':_0x2423dc[_0xce83('0x19')]}})[_0xce83('0x1a')](function(_0x2f3f32){if(_0x2f3f32){_0x2f3f32[_0xce83('0x1b')]({'lastMsgAt':_0x2423dc['createdAt'],'lastMsgDirection':_0x2423dc['direction'][_0xce83('0x12')]()});}})[_0xce83('0x1c')](function(_0x4df997){console[_0xce83('0x1d')](_0x4df997);});}_0x593279();}},'charset':_0xce83('0x1e'),'collate':_0xce83('0x1f')});}; \ No newline at end of file +var _0x33d5=['toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction'];(function(_0x4620fa,_0x6cd23d){var _0x15e179=function(_0x3af884){while(--_0x3af884){_0x4620fa['push'](_0x4620fa['shift']());}};_0x15e179(++_0x6cd23d);}(_0x33d5,0x157));var _0x533d=function(_0x4a2c5d,_0x1cfe0e){_0x4a2c5d=_0x4a2c5d-0x0;var _0x40bde1=_0x33d5[_0x4a2c5d];return _0x40bde1;};'use strict';var _=require(_0x533d('0x0'));var util=require(_0x533d('0x1'));var logger=require('../../config/logger')(_0x533d('0x2'));var moment=require(_0x533d('0x3'));var BPromise=require(_0x533d('0x4'));var rp=require(_0x533d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x533d('0x6'));var config=require(_0x533d('0x7'));var attributes=require(_0x533d('0x8'));module['exports']=function(_0x491598,_0x545a56){return _0x491598[_0x533d('0x9')](_0x533d('0xa'),attributes,{'tableName':_0x533d('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x533d('0xc')],'type':_0x533d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a1b0e,_0x4c905c,_0x2eaa00){var _0x1f2b7e=_0x491598[_0x533d('0xe')];var _0x57f5b2=_0x3a1b0e[_0x533d('0xf')]({'plain':!![]});if(_0x57f5b2[_0x533d('0x10')][_0x533d('0x11')]()==='in'||_0x57f5b2[_0x533d('0x10')][_0x533d('0x11')]()===_0x533d('0x12')&&!_0x57f5b2[_0x533d('0x13')]&&!_[_0x533d('0x14')](_0x57f5b2[_0x533d('0x15')])){_0x1f2b7e[_0x533d('0x16')][_0x533d('0x17')]({'where':{'id':_0x57f5b2[_0x533d('0x18')]}})['then'](function(_0x41a4d4){if(_0x41a4d4){_0x41a4d4[_0x533d('0x19')]({'lastMsgAt':_0x57f5b2[_0x533d('0x1a')],'lastMsgDirection':_0x57f5b2['direction']['toLowerCase']()});}})[_0x533d('0x1b')](function(_0x49b209){console[_0x533d('0x1c')](_0x49b209);});}_0x2eaa00();}},'charset':'utf8mb4','collate':_0x533d('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index a4e65ea..ec568f3 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 _0xac9d=['then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FaxMessage','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request'];(function(_0x5431f1,_0x31180d){var _0xb1537e=function(_0x51758f){while(--_0x51758f){_0x5431f1['push'](_0x5431f1['shift']());}};_0xb1537e(++_0x31180d);}(_0xac9d,0x14d));var _0xdac9=function(_0x4566db,_0x5da9a1){_0x4566db=_0x4566db-0x0;var _0x3167e6=_0xac9d[_0x4566db];return _0x3167e6;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('FaxMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});}exports['CreateFaxMessage']=function(_0x520369){var _0x4029fc=this;return new Promise(function(_0x20ece3,_0x2b9d91){return db[_0xdac9('0x1d')]['create'](_0x520369[_0xdac9('0x1e')],{'raw':_0x520369[_0xdac9('0x1f')]?_0x520369[_0xdac9('0x1f')][_0xdac9('0x20')]===undefined?!![]:![]:!![]})[_0xdac9('0x12')](function(_0x42317c){logger[_0xdac9('0x13')](_0xdac9('0x21'),_0x520369);logger[_0xdac9('0x15')](_0xdac9('0x21'),_0x520369,JSON['stringify'](_0x42317c));_0x20ece3(_0x42317c);})[_0xdac9('0x1c')](function(_0x11f4fd){logger[_0xdac9('0x18')](_0xdac9('0x21'),_0x11f4fd['message'],_0x520369);_0x2b9d91(_0x4029fc[_0xdac9('0x18')](0x1f4,_0x11f4fd['message']));});});};exports[_0xdac9('0x22')]=function(_0x2fce71){var _0x566d8c=this;return new Promise(function(_0x433be9,_0x5105f1){return db[_0xdac9('0x1d')][_0xdac9('0x23')](_0x2fce71[_0xdac9('0x1e')],{'raw':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')]['where']||null:null,'attributes':_0x2fce71['options']?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x24')]||null:null,'limit':_0x2fce71[_0xdac9('0x1f')]?_0x2fce71[_0xdac9('0x1f')][_0xdac9('0x25')]||null:null})[_0xdac9('0x12')](function(_0xed99f9){logger[_0xdac9('0x13')](_0xdac9('0x22'),_0x2fce71);logger[_0xdac9('0x15')](_0xdac9('0x22'),_0x2fce71,JSON[_0xdac9('0x26')](_0xed99f9));_0x433be9(_0xed99f9);})[_0xdac9('0x1c')](function(_0x336fd5){logger[_0xdac9('0x18')](_0xdac9('0x22'),_0x336fd5[_0xdac9('0x1a')],_0x2fce71);_0x5105f1(_0x566d8c[_0xdac9('0x18')](0x1f4,_0x336fd5[_0xdac9('0x1a')]));});});}; \ No newline at end of file +var _0x5636=['error','code','message','result','CreateFaxMessage','FaxMessage','body','options','then','UpdateFaxMessage','update','where','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d007f,_0x52f761){var _0x341999=function(_0x414676){while(--_0x414676){_0x3d007f['push'](_0x3d007f['shift']());}};_0x341999(++_0x52f761);}(_0x5636,0x102));var _0x6563=function(_0x3b3ffc,_0x170aed){_0x3b3ffc=_0x3b3ffc-0x0;var _0x37c0c7=_0x5636[_0x3b3ffc];return _0x37c0c7;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var utils=require(_0x6563('0x4'));var logger=require('../../config/logger')(_0x6563('0x5'));var config=require(_0x6563('0x6'));var jayson=require(_0x6563('0x7'));var client=jayson[_0x6563('0x8')][_0x6563('0x9')]({'port':0x232a});config[_0x6563('0xa')]=_[_0x6563('0xb')](config[_0x6563('0xa')],{'host':_0x6563('0xc'),'port':0x18eb});var socket=require(_0x6563('0xd'))(new Redis(config[_0x6563('0xa')]));require(_0x6563('0xe'))[_0x6563('0xf')](socket);function respondWithRpcPromise(_0x516d1a,_0x51fdc2,_0x2946f3){return new BPromise(function(_0x129fa3,_0x490a56){return client['request'](_0x516d1a,_0x2946f3)['then'](function(_0x1ef002){logger[_0x6563('0x10')](_0x6563('0x11'),_0x51fdc2,_0x6563('0x12'));logger[_0x6563('0x13')](_0x6563('0x14'),_0x51fdc2,_0x6563('0x12'),JSON[_0x6563('0x15')](_0x1ef002));if(_0x1ef002[_0x6563('0x16')]){if(_0x1ef002['error'][_0x6563('0x17')]===0x1f4){logger['error'](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x490a56(_0x1ef002[_0x6563('0x16')]['message']);}logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x1ef002[_0x6563('0x16')][_0x6563('0x18')]);return _0x129fa3(_0x1ef002['error'][_0x6563('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x51fdc2,'request\x20sent');_0x129fa3(_0x1ef002[_0x6563('0x19')]['message']);}})['catch'](function(_0x27651b){logger[_0x6563('0x16')](_0x6563('0x11'),_0x51fdc2,_0x27651b);_0x490a56(_0x27651b);});});}exports[_0x6563('0x1a')]=function(_0xf8b544){var _0x10811d=this;return new Promise(function(_0x37ba3,_0x93a45){return db[_0x6563('0x1b')]['create'](_0xf8b544[_0x6563('0x1c')],{'raw':_0xf8b544[_0x6563('0x1d')]?_0xf8b544[_0x6563('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6563('0x1e')](function(_0x5c37bb){logger[_0x6563('0x10')](_0x6563('0x1a'),_0xf8b544);logger['debug']('CreateFaxMessage',_0xf8b544,JSON[_0x6563('0x15')](_0x5c37bb));_0x37ba3(_0x5c37bb);})['catch'](function(_0x1097d0){logger[_0x6563('0x16')](_0x6563('0x1a'),_0x1097d0['message'],_0xf8b544);_0x93a45(_0x10811d[_0x6563('0x16')](0x1f4,_0x1097d0['message']));});});};exports[_0x6563('0x1f')]=function(_0x1590e6){var _0x5e5aeb=this;return new Promise(function(_0x365b16,_0x28252d){return db['FaxMessage'][_0x6563('0x20')](_0x1590e6['body'],{'raw':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')][_0x6563('0x21')]||null:null,'attributes':_0x1590e6[_0x6563('0x1d')]?_0x1590e6[_0x6563('0x1d')]['attributes']||null:null,'limit':_0x1590e6[_0x6563('0x1d')]?_0x1590e6['options']['limit']||null:null})[_0x6563('0x1e')](function(_0x35af37){logger[_0x6563('0x10')](_0x6563('0x1f'),_0x1590e6);logger[_0x6563('0x13')](_0x6563('0x1f'),_0x1590e6,JSON[_0x6563('0x15')](_0x35af37));_0x365b16(_0x35af37);})[_0x6563('0x22')](function(_0x101b24){logger[_0x6563('0x16')]('UpdateFaxMessage',_0x101b24[_0x6563('0x18')],_0x1590e6);_0x28252d(_0x5e5aeb[_0x6563('0x16')](0x1f4,_0x101b24[_0x6563('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b301884..040acdd 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 _0x3876=['removeListener','./faxMessage.events','save','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3876,0x13d));var _0x6387=function(_0x1e6dc6,_0x216de4){_0x1e6dc6=_0x1e6dc6-0x0;var _0x54d1c9=_0x3876[_0x1e6dc6];return _0x54d1c9;};'use strict';var FaxMessageEvents=require(_0x6387('0x0'));var events=[_0x6387('0x1'),'remove',_0x6387('0x2')];function createListener(_0x4c93d5,_0x204917){return function(_0xaf02fa){_0x204917['emit'](_0x4c93d5,_0xaf02fa);};}function removeListener(_0x25a241,_0x43c56d){return function(){FaxMessageEvents[_0x6387('0x3')](_0x25a241,_0x43c56d);};}exports['register']=function(_0x251e93){for(var _0x5dd99f=0x0,_0x5f1f20=events['length'];_0x5dd99f<_0x5f1f20;_0x5dd99f++){var _0x49e631=events[_0x5dd99f];var _0x273f70=createListener('faxMessage:'+_0x49e631,_0x251e93);FaxMessageEvents['on'](_0x49e631,_0x273f70);}}; \ No newline at end of file +var _0x55b9=['remove','emit','removeListener','faxMessage:','./faxMessage.events','save'];(function(_0xf396af,_0x9f3cd5){var _0x53da40=function(_0x457870){while(--_0x457870){_0xf396af['push'](_0xf396af['shift']());}};_0x53da40(++_0x9f3cd5);}(_0x55b9,0x16c));var _0x955b=function(_0x31d372,_0x142ec6){_0x31d372=_0x31d372-0x0;var _0xa25f53=_0x55b9[_0x31d372];return _0xa25f53;};'use strict';var FaxMessageEvents=require(_0x955b('0x0'));var events=[_0x955b('0x1'),_0x955b('0x2'),'update'];function createListener(_0xc478b0,_0x44cdd8){return function(_0x395705){_0x44cdd8[_0x955b('0x3')](_0xc478b0,_0x395705);};}function removeListener(_0x4a6af3,_0x352ddd){return function(){FaxMessageEvents[_0x955b('0x4')](_0x4a6af3,_0x352ddd);};}exports['register']=function(_0x50164d){for(var _0x3991ee=0x0,_0x392ac2=events['length'];_0x3991ee<_0x392ac2;_0x3991ee++){var _0x499d9b=events[_0x3991ee];var _0x12606b=createListener(_0x955b('0x5')+_0x499d9b,_0x50164d);FaxMessageEvents['on'](_0x499d9b,_0x12606b);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4679c56..9a8c041 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 _0xbee3=['update','/:id/accept','accept','/:id/reject','reject','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','fax','create','put'];(function(_0x359433,_0x2398b0){var _0x2db8ab=function(_0xefac8f){while(--_0xefac8f){_0x359433['push'](_0x359433['shift']());}};_0x2db8ab(++_0x2398b0);}(_0xbee3,0xd5));var _0x3bee=function(_0x2bd8fe,_0x4aeef7){_0x2bd8fe=_0x2bd8fe-0x0;var _0x2979e6=_0xbee3[_0x2bd8fe];return _0x2979e6;};'use strict';var multer=require('multer');var util=require(_0x3bee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bee('0x1'));var router=express[_0x3bee('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3bee('0x3'));var interaction=require(_0x3bee('0x4'));var config=require(_0x3bee('0x5'));var controller=require('./faxMessage.controller');router[_0x3bee('0x6')]('/',auth[_0x3bee('0x7')](),controller['index']);router[_0x3bee('0x6')](_0x3bee('0x8'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x6')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller['show']);router[_0x3bee('0x6')](_0x3bee('0xb'),auth[_0x3bee('0x7')](),controller[_0x3bee('0xc')]);router[_0x3bee('0xd')]('/',auth[_0x3bee('0x7')](),interaction['tracked'](_0x3bee('0xe'),'faxmessage:create'),controller[_0x3bee('0xf')]);router[_0x3bee('0x10')](_0x3bee('0xa'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x11')]);router[_0x3bee('0x10')](_0x3bee('0x12'),auth['isAuthenticated'](),controller[_0x3bee('0x13')]);router[_0x3bee('0x10')](_0x3bee('0x14'),auth[_0x3bee('0x7')](),controller[_0x3bee('0x15')]);router['delete']('/:id',auth[_0x3bee('0x7')](),controller['destroy']);module[_0x3bee('0x16')]=router; \ No newline at end of file +var _0x5ec6=['express','fs-extra','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','/describe','get','/:id','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path'];(function(_0x3abdf0,_0x1984eb){var _0x78ba4e=function(_0x42ef4c){while(--_0x42ef4c){_0x3abdf0['push'](_0x3abdf0['shift']());}};_0x78ba4e(++_0x1984eb);}(_0x5ec6,0x7f));var _0x65ec=function(_0x135551,_0x4a0223){_0x135551=_0x135551-0x0;var _0x353ef3=_0x5ec6[_0x135551];return _0x353ef3;};'use strict';var multer=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var path=require(_0x65ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x65ec('0x3'));var router=express['Router']();var fs_extra=require(_0x65ec('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x65ec('0x5'));var config=require('../../config/environment');var controller=require(_0x65ec('0x6'));router['get']('/',auth[_0x65ec('0x7')](),controller[_0x65ec('0x8')]);router['get'](_0x65ec('0x9'),auth[_0x65ec('0x7')](),controller['describe']);router[_0x65ec('0xa')](_0x65ec('0xb'),auth[_0x65ec('0x7')](),controller['show']);router['get'](_0x65ec('0xc'),auth['isAuthenticated'](),controller[_0x65ec('0xd')]);router[_0x65ec('0xe')]('/',auth['isAuthenticated'](),interaction[_0x65ec('0xf')](_0x65ec('0x10'),'faxmessage:create'),controller[_0x65ec('0x11')]);router[_0x65ec('0x12')]('/:id',auth[_0x65ec('0x7')](),controller[_0x65ec('0x13')]);router[_0x65ec('0x12')](_0x65ec('0x14'),auth[_0x65ec('0x7')](),controller[_0x65ec('0x15')]);router[_0x65ec('0x12')](_0x65ec('0x16'),auth['isAuthenticated'](),controller[_0x65ec('0x17')]);router[_0x65ec('0x18')](_0x65ec('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x65ec('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a78a9de..87c37f6 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 _0x5b51=['roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x5b51,0xa2));var _0x15b5=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x5b51[_0x1d7300];return _0x46ee98;};'use strict';var Sequelize=require(_0x15b5('0x0'));module[_0x15b5('0x1')]={'name':{'type':Sequelize[_0x15b5('0x2')],'unique':_0x15b5('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15b5('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15b5('0x4')](_0x15b5('0x5'),'beepall',_0x15b5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x15b5('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b53=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x213ef2,_0x4062dd){var _0x427409=function(_0x5cec32){while(--_0x5cec32){_0x213ef2['push'](_0x213ef2['shift']());}};_0x427409(++_0x4062dd);}(_0x5b53,0x1b1));var _0x35b5=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0x5b53[_0x842858];return _0x46c2a2;};'use strict';var Sequelize=require(_0x35b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x35b5('0x1')],'unique':_0x35b5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x35b5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x35b5('0x4')](_0x35b5('0x5'),'beepall',_0x35b5('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x35b5('0x3')],'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 b214cad..494277e 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 _0x8a2d=['tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','FaxQueue','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select'];(function(_0x8f8a5d,_0x5e5eba){var _0x5f5609=function(_0x3503dc){while(--_0x3503dc){_0x8f8a5d['push'](_0x8f8a5d['shift']());}};_0x5f5609(++_0x5e5eba);}(_0x8a2d,0xaa));var _0xd8a2=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8a2d[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require(_0xd8a2('0x0'));var rimraf=require(_0xd8a2('0x1'));var zipdir=require(_0xd8a2('0x2'));var jsonpatch=require(_0xd8a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8a2('0x4'));var Mustache=require(_0xd8a2('0x5'));var util=require('util');var path=require(_0xd8a2('0x6'));var sox=require(_0xd8a2('0x7'));var csv=require(_0xd8a2('0x8'));var ejs=require(_0xd8a2('0x9'));var fs=require('fs');var fs_extra=require(_0xd8a2('0xa'));var _=require(_0xd8a2('0xb'));var squel=require(_0xd8a2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd8a2('0x8'));var querystring=require('querystring');var Papa=require(_0xd8a2('0xd'));var Redis=require(_0xd8a2('0xe'));var authService=require(_0xd8a2('0xf'));var qs=require(_0xd8a2('0x10'));var as=require(_0xd8a2('0x11'));var hardwareService=require(_0xd8a2('0x12'));var logger=require(_0xd8a2('0x13'))(_0xd8a2('0x14'));var utils=require(_0xd8a2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd8a2('0x16'));var db=require(_0xd8a2('0x17'))['db'];config['redis']=_[_0xd8a2('0x18')](config[_0xd8a2('0x19')],{'host':_0xd8a2('0x1a'),'port':0x18eb});var socket=require(_0xd8a2('0x1b'))(new Redis(config[_0xd8a2('0x19')]));require(_0xd8a2('0x1c'))['register'](socket);function respondWithStatusCode(_0x61a78d,_0x19a4ee){_0x19a4ee=_0x19a4ee||0xcc;return function(_0x25902d){if(_0x25902d){return _0x61a78d[_0xd8a2('0x1d')](_0x19a4ee);}return _0x61a78d[_0xd8a2('0x1e')](_0x19a4ee)['end']();};}function respondWithResult(_0xc9607c,_0x27fd01){_0x27fd01=_0x27fd01||0xc8;return function(_0x32608f){if(_0x32608f){return _0xc9607c['status'](_0x27fd01)[_0xd8a2('0x1f')](_0x32608f);}};}function respondWithFilteredResult(_0x3ed595,_0x30caa4){return function(_0x529c2b){if(_0x529c2b){var _0x2c384f=typeof _0x30caa4[_0xd8a2('0x20')]===_0xd8a2('0x21')&&typeof _0x30caa4[_0xd8a2('0x22')]===_0xd8a2('0x21');var _0x240337=_0x529c2b[_0xd8a2('0x23')];var _0x50a8ec=_0x2c384f?0x0:_0x30caa4[_0xd8a2('0x20')];var _0x4a7f23=_0x2c384f?_0x529c2b['count']:_0x30caa4['offset']+_0x30caa4[_0xd8a2('0x22')];var _0x5b010f;if(_0x4a7f23>=_0x240337){_0x4a7f23=_0x240337;_0x5b010f=0xc8;}else{_0x5b010f=0xce;}_0x3ed595['status'](_0x5b010f);return _0x3ed595['set']('Content-Range',_0x50a8ec+'-'+_0x4a7f23+'/'+_0x240337)[_0xd8a2('0x1f')](_0x529c2b);}return null;};}function patchUpdates(_0x5b991e){return function(_0x5a4579){try{jsonpatch[_0xd8a2('0x24')](_0x5a4579,_0x5b991e,!![]);}catch(_0x251aad){return BPromise[_0xd8a2('0x25')](_0x251aad);}return _0x5a4579['save']();};}function saveUpdates(_0x1bd80d,_0x153204){return function(_0x25ad0d){if(_0x25ad0d){return _0x25ad0d[_0xd8a2('0x26')](_0x1bd80d)[_0xd8a2('0x27')](function(_0x528ca3){return _0x528ca3;});}return null;};}function removeEntity(_0x47975a,_0x5e87c9){return function(_0x9ec0a7){if(_0x9ec0a7){return _0x9ec0a7[_0xd8a2('0x28')]()[_0xd8a2('0x27')](function(){var _0xb98dad=_0x9ec0a7[_0xd8a2('0x29')]({'plain':!![]});var _0x5c20a8='FaxQueues';return db[_0xd8a2('0x2a')]['destroy']({'where':{'type':_0x5c20a8,'resourceId':_0xb98dad['id']}})['then'](function(){return _0x9ec0a7;});})[_0xd8a2('0x27')](function(){_0x47975a['status'](0xcc)[_0xd8a2('0x2b')]();});}};}function handleEntityNotFound(_0x11f0eb,_0x146a70){return function(_0x437d47){if(!_0x437d47){_0x11f0eb[_0xd8a2('0x1d')](0x194);}return _0x437d47;};}function handleError(_0xa16dd2,_0x5acc44){_0x5acc44=_0x5acc44||0x1f4;return function(_0x1f4f31){logger[_0xd8a2('0x2c')](_0x1f4f31[_0xd8a2('0x2d')]);if(_0x1f4f31[_0xd8a2('0x2e')]){delete _0x1f4f31['name'];}_0xa16dd2[_0xd8a2('0x1e')](_0x5acc44)[_0xd8a2('0x2f')](_0x1f4f31);};}exports[_0xd8a2('0x30')]=function(_0x4b0715,_0x448099){var _0xcb3b87={},_0x5d99f5={},_0x1a17b7={'count':0x0,'rows':[]};var _0x3bf3d6=_[_0xd8a2('0x31')](db[_0xd8a2('0x32')]['rawAttributes'],function(_0x5ec1b0){return{'name':_0x5ec1b0[_0xd8a2('0x33')],'type':_0x5ec1b0['type'][_0xd8a2('0x34')]};});_0x5d99f5[_0xd8a2('0x35')]=_[_0xd8a2('0x31')](_0x3bf3d6,_0xd8a2('0x2e'));_0x5d99f5[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x4b0715['query']);_0x5d99f5['filters']=_[_0xd8a2('0x38')](_0x5d99f5[_0xd8a2('0x35')],_0x5d99f5['query']);_0xcb3b87[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x5d99f5['model'],qs[_0xd8a2('0x3a')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0xcb3b87['attributes']=_0xcb3b87['attributes'][_0xd8a2('0x3b')]?_0xcb3b87[_0xd8a2('0x39')]:_0x5d99f5[_0xd8a2('0x35')];if(!_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0xcb3b87['limit']=qs[_0xd8a2('0x22')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x22')]);_0xcb3b87[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x20')]);}_0xcb3b87[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x4b0715[_0xd8a2('0x36')]['sort']);_0xcb3b87[_0xd8a2('0x40')]=qs[_0xd8a2('0x41')](_['pick'](_0x4b0715['query'],_0x5d99f5[_0xd8a2('0x41')]),_0x3bf3d6);if(_0x4b0715[_0xd8a2('0x36')][_0xd8a2('0x42')]){_0xcb3b87[_0xd8a2('0x40')]=_[_0xd8a2('0x43')](_0xcb3b87[_0xd8a2('0x40')],{'$or':_[_0xd8a2('0x31')](_0x3bf3d6,function(_0x3cbf18){if(_0x3cbf18[_0xd8a2('0x44')]!==_0xd8a2('0x45')){var _0x3f131d={};_0x3f131d[_0x3cbf18[_0xd8a2('0x2e')]]={'$like':'%'+_0x4b0715['query'][_0xd8a2('0x42')]+'%'};return _0x3f131d;}})});}_0xcb3b87=_[_0xd8a2('0x43')]({},_0xcb3b87,_0x4b0715[_0xd8a2('0x46')]);var _0x4fc60a={'where':_0xcb3b87[_0xd8a2('0x40')]};return db[_0xd8a2('0x32')][_0xd8a2('0x23')](_0x4fc60a)[_0xd8a2('0x27')](function(_0x4c832f){_0x1a17b7[_0xd8a2('0x23')]=_0x4c832f;if(_0x4b0715['query'][_0xd8a2('0x47')]){_0xcb3b87['include']=[{'all':!![]}];}return db[_0xd8a2('0x32')][_0xd8a2('0x48')](_0xcb3b87);})[_0xd8a2('0x27')](function(_0x5cdcd4){_0x1a17b7[_0xd8a2('0x49')]=_0x5cdcd4;return _0x1a17b7;})[_0xd8a2('0x27')](respondWithFilteredResult(_0x448099,_0xcb3b87))[_0xd8a2('0x4a')](handleError(_0x448099,null));};exports[_0xd8a2('0x4b')]=function(_0x1bf630,_0x14f729){var _0x223cc2={'raw':!![],'where':{'id':_0x1bf630[_0xd8a2('0x4c')]['id']}},_0x7f3b41={};_0x7f3b41['model']=_['keys'](db[_0xd8a2('0x32')][_0xd8a2('0x4d')]);_0x7f3b41[_0xd8a2('0x36')]=_['keys'](_0x1bf630[_0xd8a2('0x36')]);_0x7f3b41[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x7f3b41[_0xd8a2('0x35')],_0x7f3b41[_0xd8a2('0x36')]);_0x223cc2['attributes']=_[_0xd8a2('0x38')](_0x7f3b41[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x1bf630[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0x223cc2[_0xd8a2('0x39')]=_0x223cc2[_0xd8a2('0x39')]['length']?_0x223cc2[_0xd8a2('0x39')]:_0x7f3b41[_0xd8a2('0x35')];if(_0x1bf630['query'][_0xd8a2('0x47')]){_0x223cc2['include']=[{'all':!![]}];}_0x223cc2=_['merge']({},_0x223cc2,_0x1bf630[_0xd8a2('0x46')]);return db['FaxQueue'][_0xd8a2('0x4e')](_0x223cc2)[_0xd8a2('0x27')](handleEntityNotFound(_0x14f729,null))[_0xd8a2('0x27')](respondWithResult(_0x14f729,null))[_0xd8a2('0x4a')](handleError(_0x14f729,null));};exports[_0xd8a2('0x4f')]=function(_0x2e5a32,_0x4161ac){return db['FaxQueue'][_0xd8a2('0x4f')](_0x2e5a32[_0xd8a2('0x50')],{})[_0xd8a2('0x27')](function(_0x2668a4){var _0x56f49b=_0x2e5a32[_0xd8a2('0x51')][_0xd8a2('0x29')]({'plain':!![]});if(!_0x56f49b)throw new Error(_0xd8a2('0x52'));if(_0x56f49b[_0xd8a2('0x53')]===_0xd8a2('0x51')){var _0x1abf60=_0x2668a4['get']({'plain':!![]});var _0x593ad0=_0xd8a2('0x54');return db[_0xd8a2('0x55')]['find']({'where':{'name':_0x593ad0,'userProfileId':_0x56f49b[_0xd8a2('0x56')]},'raw':!![]})[_0xd8a2('0x27')](function(_0x4710d2){if(_0x4710d2&&_0x4710d2[_0xd8a2('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x1abf60[_0xd8a2('0x2e')],'resourceId':_0x1abf60['id'],'type':_0x4710d2['name'],'sectionId':_0x4710d2['id']},{})[_0xd8a2('0x27')](function(){return _0x2668a4;});}else{return _0x2668a4;}})[_0xd8a2('0x4a')](function(_0x3aedba){logger['error'](_0xd8a2('0x58'),_0x3aedba);throw _0x3aedba;});}return _0x2668a4;})[_0xd8a2('0x27')](respondWithResult(_0x4161ac,0xc9))[_0xd8a2('0x4a')](handleError(_0x4161ac,null));};exports['update']=function(_0x36266d,_0x455f6c){if(_0x36266d[_0xd8a2('0x50')]['id']){delete _0x36266d[_0xd8a2('0x50')]['id'];}return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x36266d['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x455f6c,null))['then'](saveUpdates(_0x36266d[_0xd8a2('0x50')],null))[_0xd8a2('0x27')](respondWithResult(_0x455f6c,null))[_0xd8a2('0x4a')](handleError(_0x455f6c,null));};exports['destroy']=function(_0x40a606,_0x57467f){return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x40a606[_0xd8a2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57467f,null))[_0xd8a2('0x27')](removeEntity(_0x57467f,null))['catch'](handleError(_0x57467f,null));};exports[_0xd8a2('0x59')]=function(_0x67b78b,_0x17d496){return db['FaxQueue'][_0xd8a2('0x59')]()[_0xd8a2('0x27')](respondWithResult(_0x17d496,null))[_0xd8a2('0x4a')](handleError(_0x17d496,null));};exports[_0xd8a2('0x5a')]=function(_0x3e105d,_0x1b0e3e,_0x1ca873){var _0x378b59={'raw':!![],'where':{}},_0x3995e1={},_0x3cd07d;return db[_0xd8a2('0x32')]['findOne']({'where':{'id':_0x3e105d[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x1b0e3e,null))['then'](function(_0x2b9341){if(_0x2b9341){_0x3cd07d=_0x2b9341[_0xd8a2('0x29')]({'plain':!![]});_0x3995e1[_0xd8a2('0x35')]=_['keys'](db[_0xd8a2('0x5b')][_0xd8a2('0x4d')]);_0x3995e1[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x3e105d[_0xd8a2('0x36')]);_0x3995e1[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x3995e1[_0xd8a2('0x35')],_0x3995e1[_0xd8a2('0x36')]);_0x378b59['attributes']=_[_0xd8a2('0x38')](_0x3995e1[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x3a')]));_0x378b59[_0xd8a2('0x39')]=_0x378b59[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x378b59[_0xd8a2('0x39')]:_0x3995e1[_0xd8a2('0x35')];if(!_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x3c')]('nolimit')){_0x378b59[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x3e105d[_0xd8a2('0x36')]['limit']);_0x378b59[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x20')]);}_0x378b59[_0xd8a2('0x3e')]=qs['sort'](_0x3e105d['query'][_0xd8a2('0x3f')]);_0x378b59['where']=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x3e105d[_0xd8a2('0x36')],_0x3995e1[_0xd8a2('0x41')]));_0x378b59[_0xd8a2('0x40')][_0xd8a2('0x5d')]=_0x2b9341['id'];if(_0x3e105d[_0xd8a2('0x36')][_0xd8a2('0x42')]){_0x378b59[_0xd8a2('0x40')]=_['merge'](_0x378b59[_0xd8a2('0x40')],{'$or':_['map'](_0x378b59[_0xd8a2('0x39')],function(_0x5078c6){var _0x29590b={};_0x29590b[_0x5078c6]={'$like':'%'+_0x3e105d[_0xd8a2('0x36')]['filter']+'%'};return _0x29590b;})});}_0x378b59=_[_0xd8a2('0x43')]({},_0x378b59,_0x3e105d[_0xd8a2('0x46')]);return db['UserFaxQueue']['findAll'](_0x378b59);}})[_0xd8a2('0x27')](function(_0x2cec3e){if(_0x2cec3e){return db[_0xd8a2('0x5e')][_0xd8a2('0x5f')]({'where':{'id':_[_0xd8a2('0x31')](_0x2cec3e,_0xd8a2('0x60')),'role':'agent'},'attributes':['id',_0xd8a2('0x2e'),_0xd8a2('0x61'),_0xd8a2('0x62'),_0xd8a2('0x63')]});}})[_0xd8a2('0x27')](function(_0xc2d0a9){if(_0xc2d0a9){return{'count':_0xc2d0a9[_0xd8a2('0x23')],'rows':_['map'](_0xc2d0a9[_0xd8a2('0x49')],function(_0x74f565){return{'membername':_0x74f565[_0xd8a2('0x2e')],'UserId':_0x74f565['id'],'queue_name':_0x3cd07d[_0xd8a2('0x2e')],'FaxQueueId':_0x3cd07d['id'],'interface':util['format'](_0xd8a2('0x64'),_0xd8a2('0x65'),_0x74f565['name']),'penalty':0x0,'paused':_0x74f565[_0xd8a2('0x61')],'createdAt':_0x74f565[_0xd8a2('0x63')],'updatedAt':_0x74f565[_0xd8a2('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd8a2('0x27')](respondWithFilteredResult(_0x1b0e3e,_0x378b59))[_0xd8a2('0x4a')](handleError(_0x1b0e3e,null));};exports[_0xd8a2('0x66')]=function(_0x2dbdee,_0x34df39,_0x274b8a){var _0x4b2df0={};var _0x4458c6={};var _0x13983b;var _0x2fffdd;return db[_0xd8a2('0x32')][_0xd8a2('0x67')]({'where':{'id':_0x2dbdee['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x34df39,null))['then'](function(_0x22bb9d){if(_0x22bb9d){_0x13983b=_0x22bb9d;_0x4458c6[_0xd8a2('0x35')]=_[_0xd8a2('0x37')](db[_0xd8a2('0x68')][_0xd8a2('0x4d')]);_0x4458c6['query']=_[_0xd8a2('0x37')](_0x2dbdee['query']);_0x4458c6['filters']=_[_0xd8a2('0x38')](_0x4458c6[_0xd8a2('0x35')],_0x4458c6['query']);_0x4b2df0[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x4458c6[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x2dbdee['query'][_0xd8a2('0x3a')]));_0x4b2df0[_0xd8a2('0x39')]=_0x4b2df0[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x4b2df0[_0xd8a2('0x39')]:_0x4458c6[_0xd8a2('0x35')];_0x4b2df0[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x3f')]);_0x4b2df0[_0xd8a2('0x40')]=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x2dbdee[_0xd8a2('0x36')],_0x4458c6['filters']));if(_0x2dbdee['query'][_0xd8a2('0x42')]){_0x4b2df0[_0xd8a2('0x40')]=_[_0xd8a2('0x43')](_0x4b2df0['where'],{'$or':_[_0xd8a2('0x31')](_0x4b2df0[_0xd8a2('0x39')],function(_0x4837ec){var _0x4e662a={};_0x4e662a[_0x4837ec]={'$like':'%'+_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x42')]+'%'};return _0x4e662a;})});}_0x4b2df0=_[_0xd8a2('0x43')]({},_0x4b2df0,_0x2dbdee[_0xd8a2('0x46')]);return _0x13983b[_0xd8a2('0x66')](_0x4b2df0);}})[_0xd8a2('0x27')](function(_0x47b379){if(_0x47b379){_0x2fffdd=_0x47b379[_0xd8a2('0x3b')];if(!_0x2dbdee['query'][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0x4b2df0[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x2dbdee[_0xd8a2('0x36')]['limit']);_0x4b2df0[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x2dbdee[_0xd8a2('0x36')][_0xd8a2('0x20')]);}return _0x13983b[_0xd8a2('0x66')](_0x4b2df0);}})[_0xd8a2('0x27')](function(_0x1e167d){if(_0x1e167d){return _0x1e167d?{'count':_0x2fffdd,'rows':_0x1e167d}:null;}})[_0xd8a2('0x27')](respondWithResult(_0x34df39,null))[_0xd8a2('0x4a')](handleError(_0x34df39,null));};exports[_0xd8a2('0x69')]=function(_0x9eb7ed,_0xd1ae6c,_0x4e7634){var _0x336b60=_0x9eb7ed['body'][_0xd8a2('0x6a')];return db['Team'][_0xd8a2('0x48')]({'where':{'id':_0x336b60},'attributes':['id'],'include':[{'model':db[_0xd8a2('0x5e')],'as':_0xd8a2('0x6b'),'attributes':['id',_0xd8a2('0x2e'),_0xd8a2('0x6c'),_0xd8a2('0x6d'),_0xd8a2('0x6e')],'raw':!![]}]})[_0xd8a2('0x27')](function(_0x2926b3){if(_0x2926b3){var _0x37e0b7=_[_0xd8a2('0x6f')](_0x2926b3,function(_0x107b77){var _0x2dcd4c=_0x107b77[_0xd8a2('0x29')]({'plain':!![]});return _0x2dcd4c[_0xd8a2('0x6b')];});return db['FaxQueue']['find']({'where':{'id':_0x9eb7ed[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](function(_0x1e24ea){return db[_0xd8a2('0x70')][_0xd8a2('0x71')](function(_0x171909){return _0x1e24ea[_0xd8a2('0x69')](_0x336b60,{'transaction':_0x171909})[_0xd8a2('0x27')](function(){return BPromise[_0xd8a2('0x72')](_0x37e0b7,function(_0x16fda6){return db[_0xd8a2('0x5b')][_0xd8a2('0x73')]({'where':{'UserId':_0x16fda6['id'],'FaxQueueId':_0x9eb7ed[_0xd8a2('0x4c')]['id']},'transaction':_0x171909});});})[_0xd8a2('0x27')](function(){_0x37e0b7[_0xd8a2('0x74')](function(_0x1eab78){socket[_0xd8a2('0x75')](_0xd8a2('0x76'),{'UserId':_0x1eab78['id'],'FaxQueueId':_0x1e24ea['id']});});});});});}})[_0xd8a2('0x27')](respondWithStatusCode(_0xd1ae6c,null))[_0xd8a2('0x4a')](handleError(_0xd1ae6c,null));};exports['removeTeams']=function(_0x5ec354,_0x19f4f2,_0x395f50){return db['Team'][_0xd8a2('0x48')]({'where':{'id':_0x5ec354[_0xd8a2('0x36')][_0xd8a2('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd8a2('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd8a2('0x27')](handleEntityNotFound(_0x19f4f2,null))[_0xd8a2('0x27')](function(_0x46fd6c){var _0x14e91e=_['map'](_0x46fd6c,'id');var _0x9db56e=[];var _0xa655b=[];var _0x238bb3=squel[_0xd8a2('0x77')]();_0x238bb3['field'](_0xd8a2('0x78'))['from'](_0xd8a2('0x79'),'tq')[_0xd8a2('0x7a')](_0xd8a2('0x7b'),'ut',_0xd8a2('0x7c'))['where']('FaxQueueId\x20=\x20?',_0x5ec354[_0xd8a2('0x4c')]['id']);for(var _0x6bafc4=0x0;_0x6bafc4<_0x46fd6c[_0xd8a2('0x3b')];_0x6bafc4+=0x1){let _0x173065=_0x46fd6c[_0x6bafc4];for(var _0x301d2e=0x0;_0x301d2e<_0x173065[_0xd8a2('0x6b')]['length'];_0x301d2e+=0x1){let _0x138700=_0x173065[_0xd8a2('0x6b')][_0x301d2e];var _0x3e661f=_0x238bb3[_0xd8a2('0x7d')]();_0x3e661f[_0xd8a2('0x40')](_0xd8a2('0x7e'),_0x138700['id']);_0xa655b[_0xd8a2('0x7f')](db[_0xd8a2('0x70')]['query'](_0x3e661f[_0xd8a2('0x80')](),{'type':db['sequelize'][_0xd8a2('0x81')][_0xd8a2('0x82')]})[_0xd8a2('0x27')](function(_0x15d4de){if(_0x15d4de[_0xd8a2('0x3b')]===0x1){return _0x138700['id'];}else{var _0x4d0b15=_[_0xd8a2('0x83')](_[_0xd8a2('0x31')](_0x15d4de,_0xd8a2('0x84')),function(_0x3dfa65){return _[_0xd8a2('0x85')](_0x14e91e,_0x3dfa65);});if(_0x4d0b15){return _0x138700['id'];}}}));}}return BPromise[_0xd8a2('0x86')](_0xa655b)[_0xd8a2('0x27')](function(_0x9c9581){_0x9db56e=_(_0x9db56e)[_0xd8a2('0x87')](_0x9c9581)[_0xd8a2('0x88')]()[_0xd8a2('0x89')]();return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x5ec354['params']['id']}})[_0xd8a2('0x27')](function(_0x4f23c0){return db[_0xd8a2('0x70')]['transaction'](function(_0x43f6bc){return _0x4f23c0['removeTeams'](_0x5ec354[_0xd8a2('0x36')][_0xd8a2('0x6a')],{'transaction':_0x43f6bc})[_0xd8a2('0x27')](function(){if(!_[_0xd8a2('0x8a')](_0x9db56e)){return _0x4f23c0[_0xd8a2('0x8b')](_0x9db56e,{'transaction':_0x43f6bc});}})[_0xd8a2('0x27')](function(){_0x9db56e['forEach'](function(_0x329183){socket['emit']('userFaxQueue:remove',{'UserId':_0x329183,'FaxQueueId':_0x4f23c0['id']});});});});});});})['then'](respondWithStatusCode(_0x19f4f2,null))['catch'](handleError(_0x19f4f2,null));};exports['addAgents']=function(_0x2623f9,_0x1020c7,_0x25c132){return db[_0xd8a2('0x32')][_0xd8a2('0x4e')]({'where':{'id':_0x2623f9[_0xd8a2('0x4c')]['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x1020c7,null))[_0xd8a2('0x27')](function(_0x56ea16){if(_0x56ea16){return _0x56ea16[_0xd8a2('0x8c')](_0x2623f9[_0xd8a2('0x50')]['ids'],_[_0xd8a2('0x8d')](_0x2623f9[_0xd8a2('0x50')],[_0xd8a2('0x6a'),'id'])||{})['spread'](function(_0x5da61e){for(var _0x504eef=0x0;_0x504eef<_0x2623f9['body'][_0xd8a2('0x6a')][_0xd8a2('0x3b')];_0x504eef+=0x1){socket['emit'](_0xd8a2('0x76'),{'UserId':Number(_0x2623f9[_0xd8a2('0x50')]['ids'][_0x504eef]),'FaxQueueId':Number(_0x2623f9[_0xd8a2('0x4c')]['id'])});}return _0x5da61e;});}})['then'](respondWithResult(_0x1020c7,null))['catch'](handleError(_0x1020c7,null));};exports['removeAgents']=function(_0x18d394,_0x46d605,_0x9b3528){return db['FaxQueue'][_0xd8a2('0x4e')]({'where':{'id':_0x18d394['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x46d605,null))[_0xd8a2('0x27')](function(_0xe84a12){if(_0xe84a12){return _0xe84a12[_0xd8a2('0x8b')](_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')])[_0xd8a2('0x27')](function(){if(_[_0xd8a2('0x8e')](_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')])){for(var _0x3db6e7=0x0;_0x3db6e7<_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')][_0xd8a2('0x3b')];_0x3db6e7+=0x1){socket[_0xd8a2('0x75')](_0xd8a2('0x8f'),{'UserId':Number(_0x18d394[_0xd8a2('0x36')][_0xd8a2('0x6a')][_0x3db6e7]),'FaxQueueId':Number(_0x18d394[_0xd8a2('0x4c')]['id'])});}}else{socket[_0xd8a2('0x75')]('userFaxQueue:remove',{'UserId':Number(_0x18d394[_0xd8a2('0x36')]['ids']),'FaxQueueId':Number(_0x18d394['params']['id'])});}});}})[_0xd8a2('0x27')](respondWithStatusCode(_0x46d605,null))[_0xd8a2('0x4a')](handleError(_0x46d605,null));};exports[_0xd8a2('0x90')]=function(_0x45336e,_0x56da6a,_0x5397d2){var _0x50b9ba={};var _0x410259={};var _0x442bf1;var _0x2516b5;return db[_0xd8a2('0x32')][_0xd8a2('0x67')]({'where':{'id':_0x45336e['params']['id']}})[_0xd8a2('0x27')](handleEntityNotFound(_0x56da6a,null))['then'](function(_0x567c6f){if(_0x567c6f){_0x442bf1=_0x567c6f;_0x410259[_0xd8a2('0x35')]=_[_0xd8a2('0x37')](db['User'][_0xd8a2('0x4d')]);_0x410259[_0xd8a2('0x36')]=_[_0xd8a2('0x37')](_0x45336e[_0xd8a2('0x36')]);_0x410259[_0xd8a2('0x41')]=_[_0xd8a2('0x38')](_0x410259[_0xd8a2('0x35')],_0x410259[_0xd8a2('0x36')]);_0x50b9ba[_0xd8a2('0x39')]=_[_0xd8a2('0x38')](_0x410259[_0xd8a2('0x35')],qs[_0xd8a2('0x3a')](_0x45336e['query'][_0xd8a2('0x3a')]));_0x50b9ba['attributes']=_0x50b9ba[_0xd8a2('0x39')][_0xd8a2('0x3b')]?_0x50b9ba[_0xd8a2('0x39')]:_0x410259[_0xd8a2('0x35')];_0x50b9ba[_0xd8a2('0x3e')]=qs[_0xd8a2('0x3f')](_0x45336e['query'][_0xd8a2('0x3f')]);_0x50b9ba['where']=qs[_0xd8a2('0x41')](_[_0xd8a2('0x5c')](_0x45336e[_0xd8a2('0x36')],_0x410259[_0xd8a2('0x41')]));if(_0x45336e[_0xd8a2('0x36')]['filter']){_0x50b9ba['where']=_[_0xd8a2('0x43')](_0x50b9ba[_0xd8a2('0x40')],{'$or':_[_0xd8a2('0x31')](_0x50b9ba[_0xd8a2('0x39')],function(_0x58f27c){var _0x1b306b={};_0x1b306b[_0x58f27c]={'$like':'%'+_0x45336e['query'][_0xd8a2('0x42')]+'%'};return _0x1b306b;})});}_0x50b9ba=_[_0xd8a2('0x43')]({},_0x50b9ba,_0x45336e[_0xd8a2('0x46')]);return _0x442bf1[_0xd8a2('0x90')](_0x50b9ba);}})[_0xd8a2('0x27')](function(_0x546b37){if(_0x546b37){_0x2516b5=_0x546b37['length'];if(!_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x3c')](_0xd8a2('0x3d'))){_0x50b9ba[_0xd8a2('0x22')]=qs[_0xd8a2('0x22')](_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x22')]);_0x50b9ba[_0xd8a2('0x20')]=qs[_0xd8a2('0x20')](_0x45336e[_0xd8a2('0x36')][_0xd8a2('0x20')]);}return _0x442bf1[_0xd8a2('0x90')](_0x50b9ba);}})[_0xd8a2('0x27')](function(_0x504b88){if(_0x504b88){return _0x504b88?{'count':_0x2516b5,'rows':_0x504b88}:null;}})[_0xd8a2('0x27')](respondWithResult(_0x56da6a,null))[_0xd8a2('0x4a')](handleError(_0x56da6a,null));}; \ No newline at end of file +var _0xb863=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','User','interface','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','ids','Agents','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','QueryTypes','every','includes','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','get','FaxQueues','then','error','name','send','map','FaxQueue','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x55bb70,_0x2decbc){var _0x186400=function(_0x409778){while(--_0x409778){_0x55bb70['push'](_0x55bb70['shift']());}};_0x186400(++_0x2decbc);}(_0xb863,0x1c9));var _0x3b86=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb863[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b86('0x0'));var jsonpatch=require(_0x3b86('0x1'));var rp=require(_0x3b86('0x2'));var moment=require('moment');var BPromise=require(_0x3b86('0x3'));var Mustache=require('mustache');var util=require(_0x3b86('0x4'));var path=require(_0x3b86('0x5'));var sox=require(_0x3b86('0x6'));var csv=require(_0x3b86('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b86('0x8'));var _=require(_0x3b86('0x9'));var squel=require(_0x3b86('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b86('0x7'));var querystring=require(_0x3b86('0xb'));var Papa=require('papaparse');var Redis=require(_0x3b86('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3b86('0xd'));var as=require(_0x3b86('0xe'));var hardwareService=require(_0x3b86('0xf'));var logger=require('../../config/logger')(_0x3b86('0x10'));var utils=require(_0x3b86('0x11'));var config=require(_0x3b86('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b86('0x13'))['db'];config[_0x3b86('0x14')]=_[_0x3b86('0x15')](config['redis'],{'host':_0x3b86('0x16'),'port':0x18eb});var socket=require(_0x3b86('0x17'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x3b86('0x18')](socket);function respondWithStatusCode(_0x45acef,_0x9811f2){_0x9811f2=_0x9811f2||0xcc;return function(_0x5d71f4){if(_0x5d71f4){return _0x45acef['sendStatus'](_0x9811f2);}return _0x45acef[_0x3b86('0x19')](_0x9811f2)['end']();};}function respondWithResult(_0x5ede9e,_0x226970){_0x226970=_0x226970||0xc8;return function(_0x407d93){if(_0x407d93){return _0x5ede9e[_0x3b86('0x19')](_0x226970)['json'](_0x407d93);}};}function respondWithFilteredResult(_0x46b05c,_0x2382e8){return function(_0x4f5e61){if(_0x4f5e61){var _0x459d2e=typeof _0x2382e8[_0x3b86('0x1a')]===_0x3b86('0x1b')&&typeof _0x2382e8['limit']===_0x3b86('0x1b');var _0x475e9e=_0x4f5e61[_0x3b86('0x1c')];var _0xe0a03=_0x459d2e?0x0:_0x2382e8['offset'];var _0x2e5901=_0x459d2e?_0x4f5e61[_0x3b86('0x1c')]:_0x2382e8['offset']+_0x2382e8[_0x3b86('0x1d')];var _0x559400;if(_0x2e5901>=_0x475e9e){_0x2e5901=_0x475e9e;_0x559400=0xc8;}else{_0x559400=0xce;}_0x46b05c[_0x3b86('0x19')](_0x559400);return _0x46b05c[_0x3b86('0x1e')](_0x3b86('0x1f'),_0xe0a03+'-'+_0x2e5901+'/'+_0x475e9e)['json'](_0x4f5e61);}return null;};}function patchUpdates(_0x3d4ca4){return function(_0x411eee){try{jsonpatch[_0x3b86('0x20')](_0x411eee,_0x3d4ca4,!![]);}catch(_0x4b2068){return BPromise[_0x3b86('0x21')](_0x4b2068);}return _0x411eee['save']();};}function saveUpdates(_0x462ebd,_0x5367ae){return function(_0x41f418){if(_0x41f418){return _0x41f418['update'](_0x462ebd)['then'](function(_0x5e0f0c){return _0x5e0f0c;});}return null;};}function removeEntity(_0x539651,_0x43a698){return function(_0x500d8a){if(_0x500d8a){return _0x500d8a[_0x3b86('0x22')]()['then'](function(){var _0x2a0efc=_0x500d8a[_0x3b86('0x23')]({'plain':!![]});var _0x12b69d=_0x3b86('0x24');return db['UserProfileResource'][_0x3b86('0x22')]({'where':{'type':_0x12b69d,'resourceId':_0x2a0efc['id']}})['then'](function(){return _0x500d8a;});})[_0x3b86('0x25')](function(){_0x539651['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x294d01,_0x56b1b8){return function(_0x5ef7ed){if(!_0x5ef7ed){_0x294d01['sendStatus'](0x194);}return _0x5ef7ed;};}function handleError(_0x2f6975,_0x39c0aa){_0x39c0aa=_0x39c0aa||0x1f4;return function(_0x152308){logger[_0x3b86('0x26')](_0x152308['stack']);if(_0x152308[_0x3b86('0x27')]){delete _0x152308[_0x3b86('0x27')];}_0x2f6975[_0x3b86('0x19')](_0x39c0aa)[_0x3b86('0x28')](_0x152308);};}exports['index']=function(_0x280a0f,_0x2f89d8){var _0x5d15ab={},_0xe71451={},_0x337ef3={'count':0x0,'rows':[]};var _0x20201c=_[_0x3b86('0x29')](db[_0x3b86('0x2a')][_0x3b86('0x2b')],function(_0xdc0168){return{'name':_0xdc0168['fieldName'],'type':_0xdc0168[_0x3b86('0x2c')]['key']};});_0xe71451[_0x3b86('0x2d')]=_[_0x3b86('0x29')](_0x20201c,_0x3b86('0x27'));_0xe71451[_0x3b86('0x2e')]=_[_0x3b86('0x2f')](_0x280a0f[_0x3b86('0x2e')]);_0xe71451[_0x3b86('0x30')]=_[_0x3b86('0x31')](_0xe71451[_0x3b86('0x2d')],_0xe71451[_0x3b86('0x2e')]);_0x5d15ab['attributes']=_[_0x3b86('0x31')](_0xe71451['model'],qs[_0x3b86('0x32')](_0x280a0f[_0x3b86('0x2e')][_0x3b86('0x32')]));_0x5d15ab[_0x3b86('0x33')]=_0x5d15ab[_0x3b86('0x33')][_0x3b86('0x34')]?_0x5d15ab[_0x3b86('0x33')]:_0xe71451[_0x3b86('0x2d')];if(!_0x280a0f[_0x3b86('0x2e')][_0x3b86('0x35')]('nolimit')){_0x5d15ab[_0x3b86('0x1d')]=qs['limit'](_0x280a0f[_0x3b86('0x2e')][_0x3b86('0x1d')]);_0x5d15ab[_0x3b86('0x1a')]=qs[_0x3b86('0x1a')](_0x280a0f['query'][_0x3b86('0x1a')]);}_0x5d15ab[_0x3b86('0x36')]=qs[_0x3b86('0x37')](_0x280a0f[_0x3b86('0x2e')]['sort']);_0x5d15ab[_0x3b86('0x38')]=qs[_0x3b86('0x30')](_[_0x3b86('0x39')](_0x280a0f['query'],_0xe71451[_0x3b86('0x30')]),_0x20201c);if(_0x280a0f['query'][_0x3b86('0x3a')]){_0x5d15ab[_0x3b86('0x38')]=_['merge'](_0x5d15ab[_0x3b86('0x38')],{'$or':_[_0x3b86('0x29')](_0x20201c,function(_0x4643d9){if(_0x4643d9[_0x3b86('0x2c')]!==_0x3b86('0x3b')){var _0x2d7b65={};_0x2d7b65[_0x4643d9[_0x3b86('0x27')]]={'$like':'%'+_0x280a0f['query']['filter']+'%'};return _0x2d7b65;}})});}_0x5d15ab=_['merge']({},_0x5d15ab,_0x280a0f[_0x3b86('0x3c')]);var _0x2577f9={'where':_0x5d15ab[_0x3b86('0x38')]};return db[_0x3b86('0x2a')][_0x3b86('0x1c')](_0x2577f9)['then'](function(_0x23ed37){_0x337ef3[_0x3b86('0x1c')]=_0x23ed37;if(_0x280a0f[_0x3b86('0x2e')][_0x3b86('0x3d')]){_0x5d15ab[_0x3b86('0x3e')]=[{'all':!![]}];}return db['FaxQueue'][_0x3b86('0x3f')](_0x5d15ab);})[_0x3b86('0x25')](function(_0x2b2c3f){_0x337ef3[_0x3b86('0x40')]=_0x2b2c3f;return _0x337ef3;})[_0x3b86('0x25')](respondWithFilteredResult(_0x2f89d8,_0x5d15ab))[_0x3b86('0x41')](handleError(_0x2f89d8,null));};exports['show']=function(_0x58c6dc,_0x5db6f4){var _0x43ed0b={'raw':!![],'where':{'id':_0x58c6dc[_0x3b86('0x42')]['id']}},_0xbb8769={};_0xbb8769[_0x3b86('0x2d')]=_[_0x3b86('0x2f')](db[_0x3b86('0x2a')]['rawAttributes']);_0xbb8769[_0x3b86('0x2e')]=_[_0x3b86('0x2f')](_0x58c6dc[_0x3b86('0x2e')]);_0xbb8769[_0x3b86('0x30')]=_['intersection'](_0xbb8769[_0x3b86('0x2d')],_0xbb8769[_0x3b86('0x2e')]);_0x43ed0b[_0x3b86('0x33')]=_['intersection'](_0xbb8769[_0x3b86('0x2d')],qs['fields'](_0x58c6dc[_0x3b86('0x2e')][_0x3b86('0x32')]));_0x43ed0b[_0x3b86('0x33')]=_0x43ed0b['attributes'][_0x3b86('0x34')]?_0x43ed0b[_0x3b86('0x33')]:_0xbb8769[_0x3b86('0x2d')];if(_0x58c6dc['query'][_0x3b86('0x3d')]){_0x43ed0b[_0x3b86('0x3e')]=[{'all':!![]}];}_0x43ed0b=_[_0x3b86('0x43')]({},_0x43ed0b,_0x58c6dc[_0x3b86('0x3c')]);return db[_0x3b86('0x2a')][_0x3b86('0x44')](_0x43ed0b)[_0x3b86('0x25')](handleEntityNotFound(_0x5db6f4,null))[_0x3b86('0x25')](respondWithResult(_0x5db6f4,null))[_0x3b86('0x41')](handleError(_0x5db6f4,null));};exports[_0x3b86('0x45')]=function(_0x53a04b,_0x444e30){return db[_0x3b86('0x2a')]['create'](_0x53a04b[_0x3b86('0x46')],{})[_0x3b86('0x25')](function(_0x845b13){var _0x3d110f=_0x53a04b[_0x3b86('0x47')]['get']({'plain':!![]});if(!_0x3d110f)throw new Error(_0x3b86('0x48'));if(_0x3d110f[_0x3b86('0x49')]===_0x3b86('0x47')){var _0x419961=_0x845b13[_0x3b86('0x23')]({'plain':!![]});var _0x5e444a=_0x3b86('0x24');return db[_0x3b86('0x4a')][_0x3b86('0x44')]({'where':{'name':_0x5e444a,'userProfileId':_0x3d110f[_0x3b86('0x4b')]},'raw':!![]})['then'](function(_0x23201f){if(_0x23201f&&_0x23201f['autoAssociation']===0x0){return db[_0x3b86('0x4c')][_0x3b86('0x45')]({'name':_0x419961[_0x3b86('0x27')],'resourceId':_0x419961['id'],'type':_0x23201f[_0x3b86('0x27')],'sectionId':_0x23201f['id']},{})['then'](function(){return _0x845b13;});}else{return _0x845b13;}})[_0x3b86('0x41')](function(_0x2150bf){logger[_0x3b86('0x26')](_0x3b86('0x4d'),_0x2150bf);throw _0x2150bf;});}return _0x845b13;})['then'](respondWithResult(_0x444e30,0xc9))[_0x3b86('0x41')](handleError(_0x444e30,null));};exports[_0x3b86('0x4e')]=function(_0x9c8828,_0x1c465d){if(_0x9c8828[_0x3b86('0x46')]['id']){delete _0x9c8828[_0x3b86('0x46')]['id'];}return db[_0x3b86('0x2a')][_0x3b86('0x44')]({'where':{'id':_0x9c8828[_0x3b86('0x42')]['id']}})[_0x3b86('0x25')](handleEntityNotFound(_0x1c465d,null))['then'](saveUpdates(_0x9c8828[_0x3b86('0x46')],null))[_0x3b86('0x25')](respondWithResult(_0x1c465d,null))[_0x3b86('0x41')](handleError(_0x1c465d,null));};exports[_0x3b86('0x22')]=function(_0x80f27a,_0x80a9c3){return db[_0x3b86('0x2a')][_0x3b86('0x44')]({'where':{'id':_0x80f27a[_0x3b86('0x42')]['id']}})[_0x3b86('0x25')](handleEntityNotFound(_0x80a9c3,null))[_0x3b86('0x25')](removeEntity(_0x80a9c3,null))['catch'](handleError(_0x80a9c3,null));};exports[_0x3b86('0x4f')]=function(_0x1e5a56,_0x55cfa2){return db[_0x3b86('0x2a')][_0x3b86('0x4f')]()[_0x3b86('0x25')](respondWithResult(_0x55cfa2,null))[_0x3b86('0x41')](handleError(_0x55cfa2,null));};exports[_0x3b86('0x50')]=function(_0x39e5e8,_0x20508b,_0x2c30fb){var _0x24603a={'raw':!![],'where':{}},_0x1f1bec={},_0x1c9a75;return db['FaxQueue'][_0x3b86('0x51')]({'where':{'id':_0x39e5e8['params']['id']}})[_0x3b86('0x25')](handleEntityNotFound(_0x20508b,null))[_0x3b86('0x25')](function(_0x266c5f){if(_0x266c5f){_0x1c9a75=_0x266c5f['get']({'plain':!![]});_0x1f1bec[_0x3b86('0x2d')]=_['keys'](db['UserFaxQueue'][_0x3b86('0x2b')]);_0x1f1bec[_0x3b86('0x2e')]=_['keys'](_0x39e5e8[_0x3b86('0x2e')]);_0x1f1bec[_0x3b86('0x30')]=_[_0x3b86('0x31')](_0x1f1bec[_0x3b86('0x2d')],_0x1f1bec['query']);_0x24603a['attributes']=_[_0x3b86('0x31')](_0x1f1bec[_0x3b86('0x2d')],qs['fields'](_0x39e5e8[_0x3b86('0x2e')][_0x3b86('0x32')]));_0x24603a[_0x3b86('0x33')]=_0x24603a[_0x3b86('0x33')][_0x3b86('0x34')]?_0x24603a[_0x3b86('0x33')]:_0x1f1bec[_0x3b86('0x2d')];if(!_0x39e5e8[_0x3b86('0x2e')]['hasOwnProperty'](_0x3b86('0x52'))){_0x24603a['limit']=qs['limit'](_0x39e5e8[_0x3b86('0x2e')][_0x3b86('0x1d')]);_0x24603a[_0x3b86('0x1a')]=qs[_0x3b86('0x1a')](_0x39e5e8[_0x3b86('0x2e')]['offset']);}_0x24603a[_0x3b86('0x36')]=qs[_0x3b86('0x37')](_0x39e5e8[_0x3b86('0x2e')][_0x3b86('0x37')]);_0x24603a[_0x3b86('0x38')]=qs[_0x3b86('0x30')](_['pick'](_0x39e5e8[_0x3b86('0x2e')],_0x1f1bec[_0x3b86('0x30')]));_0x24603a['where']['FaxQueueId']=_0x266c5f['id'];if(_0x39e5e8[_0x3b86('0x2e')][_0x3b86('0x3a')]){_0x24603a[_0x3b86('0x38')]=_['merge'](_0x24603a[_0x3b86('0x38')],{'$or':_[_0x3b86('0x29')](_0x24603a[_0x3b86('0x33')],function(_0x2191df){var _0x489d87={};_0x489d87[_0x2191df]={'$like':'%'+_0x39e5e8[_0x3b86('0x2e')][_0x3b86('0x3a')]+'%'};return _0x489d87;})});}_0x24603a=_[_0x3b86('0x43')]({},_0x24603a,_0x39e5e8[_0x3b86('0x3c')]);return db[_0x3b86('0x53')]['findAll'](_0x24603a);}})[_0x3b86('0x25')](function(_0x1eabcd){if(_0x1eabcd){return db['User'][_0x3b86('0x54')]({'where':{'id':_['map'](_0x1eabcd,_0x3b86('0x55')),'role':_0x3b86('0x56')},'attributes':['id',_0x3b86('0x27'),_0x3b86('0x57'),_0x3b86('0x58'),_0x3b86('0x59')]});}})[_0x3b86('0x25')](function(_0x34a7c2){if(_0x34a7c2){return{'count':_0x34a7c2[_0x3b86('0x1c')],'rows':_[_0x3b86('0x29')](_0x34a7c2[_0x3b86('0x40')],function(_0x27ee96){return{'membername':_0x27ee96[_0x3b86('0x27')],'UserId':_0x27ee96['id'],'queue_name':_0x1c9a75[_0x3b86('0x27')],'FaxQueueId':_0x1c9a75['id'],'interface':util[_0x3b86('0x5a')](_0x3b86('0x5b'),_0x3b86('0x5c'),_0x27ee96[_0x3b86('0x27')]),'penalty':0x0,'paused':_0x27ee96[_0x3b86('0x57')],'createdAt':_0x27ee96[_0x3b86('0x59')],'updatedAt':_0x27ee96[_0x3b86('0x58')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3b86('0x25')](respondWithFilteredResult(_0x20508b,_0x24603a))[_0x3b86('0x41')](handleError(_0x20508b,null));};exports['getTeams']=function(_0x1a1ec2,_0x542e82,_0x5d2852){var _0x876485={};var _0x599150={};var _0x4fa281;var _0xc1f001;return db['FaxQueue'][_0x3b86('0x51')]({'where':{'id':_0x1a1ec2[_0x3b86('0x42')]['id']}})[_0x3b86('0x25')](handleEntityNotFound(_0x542e82,null))['then'](function(_0x47f801){if(_0x47f801){_0x4fa281=_0x47f801;_0x599150[_0x3b86('0x2d')]=_['keys'](db['Team'][_0x3b86('0x2b')]);_0x599150[_0x3b86('0x2e')]=_['keys'](_0x1a1ec2[_0x3b86('0x2e')]);_0x599150[_0x3b86('0x30')]=_['intersection'](_0x599150[_0x3b86('0x2d')],_0x599150[_0x3b86('0x2e')]);_0x876485['attributes']=_[_0x3b86('0x31')](_0x599150[_0x3b86('0x2d')],qs['fields'](_0x1a1ec2[_0x3b86('0x2e')]['fields']));_0x876485['attributes']=_0x876485['attributes']['length']?_0x876485[_0x3b86('0x33')]:_0x599150['model'];_0x876485[_0x3b86('0x36')]=qs[_0x3b86('0x37')](_0x1a1ec2[_0x3b86('0x2e')][_0x3b86('0x37')]);_0x876485['where']=qs[_0x3b86('0x30')](_[_0x3b86('0x39')](_0x1a1ec2[_0x3b86('0x2e')],_0x599150[_0x3b86('0x30')]));if(_0x1a1ec2[_0x3b86('0x2e')][_0x3b86('0x3a')]){_0x876485[_0x3b86('0x38')]=_['merge'](_0x876485[_0x3b86('0x38')],{'$or':_[_0x3b86('0x29')](_0x876485[_0x3b86('0x33')],function(_0x226886){var _0x3d8e8b={};_0x3d8e8b[_0x226886]={'$like':'%'+_0x1a1ec2['query'][_0x3b86('0x3a')]+'%'};return _0x3d8e8b;})});}_0x876485=_['merge']({},_0x876485,_0x1a1ec2['options']);return _0x4fa281[_0x3b86('0x5d')](_0x876485);}})[_0x3b86('0x25')](function(_0x586613){if(_0x586613){_0xc1f001=_0x586613['length'];if(!_0x1a1ec2[_0x3b86('0x2e')][_0x3b86('0x35')](_0x3b86('0x52'))){_0x876485[_0x3b86('0x1d')]=qs[_0x3b86('0x1d')](_0x1a1ec2['query'][_0x3b86('0x1d')]);_0x876485[_0x3b86('0x1a')]=qs[_0x3b86('0x1a')](_0x1a1ec2[_0x3b86('0x2e')]['offset']);}return _0x4fa281[_0x3b86('0x5d')](_0x876485);}})[_0x3b86('0x25')](function(_0x947c76){if(_0x947c76){return _0x947c76?{'count':_0xc1f001,'rows':_0x947c76}:null;}})[_0x3b86('0x25')](respondWithResult(_0x542e82,null))[_0x3b86('0x41')](handleError(_0x542e82,null));};exports[_0x3b86('0x5e')]=function(_0x3484f9,_0xd97501,_0x5de966){var _0x2ec85c=_0x3484f9['body']['ids'];return db[_0x3b86('0x5f')][_0x3b86('0x3f')]({'where':{'id':_0x2ec85c},'attributes':['id'],'include':[{'model':db[_0x3b86('0x60')],'as':'Agents','attributes':['id',_0x3b86('0x27'),'online','voicePause',_0x3b86('0x61')],'raw':!![]}]})[_0x3b86('0x25')](function(_0x12633a){if(_0x12633a){var _0x28ed2e=_['flatMap'](_0x12633a,function(_0x2948ac){var _0xdd40af=_0x2948ac[_0x3b86('0x23')]({'plain':!![]});return _0xdd40af['Agents'];});return db[_0x3b86('0x2a')][_0x3b86('0x44')]({'where':{'id':_0x3484f9[_0x3b86('0x42')]['id']}})[_0x3b86('0x25')](function(_0x482c1a){return db[_0x3b86('0x62')][_0x3b86('0x63')](function(_0x4a93f7){return _0x482c1a[_0x3b86('0x5e')](_0x2ec85c,{'transaction':_0x4a93f7})['then'](function(){return BPromise[_0x3b86('0x64')](_0x28ed2e,function(_0x5a0d53){return db[_0x3b86('0x53')][_0x3b86('0x65')]({'where':{'UserId':_0x5a0d53['id'],'FaxQueueId':_0x3484f9[_0x3b86('0x42')]['id']},'transaction':_0x4a93f7});});})['then'](function(){_0x28ed2e['forEach'](function(_0x191675){socket[_0x3b86('0x66')](_0x3b86('0x67'),{'UserId':_0x191675['id'],'FaxQueueId':_0x482c1a['id']});});});});});}})[_0x3b86('0x25')](respondWithStatusCode(_0xd97501,null))[_0x3b86('0x41')](handleError(_0xd97501,null));};exports[_0x3b86('0x68')]=function(_0x4a5050,_0x1c1fc9,_0x1f2ca8){return db['Team'][_0x3b86('0x3f')]({'where':{'id':_0x4a5050[_0x3b86('0x2e')][_0x3b86('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3b86('0x60')],'as':_0x3b86('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x3b86('0x25')](handleEntityNotFound(_0x1c1fc9,null))[_0x3b86('0x25')](function(_0x6ac1a2){var _0x5aaa24=_[_0x3b86('0x29')](_0x6ac1a2,'id');var _0x228152=[];var _0x2bc77d=[];var _0x3c8f19=squel[_0x3b86('0x6b')]();_0x3c8f19[_0x3b86('0x6c')]('tq.TeamId')[_0x3b86('0x6d')](_0x3b86('0x6e'),'tq')['join'](_0x3b86('0x6f'),'ut',_0x3b86('0x70'))['where'](_0x3b86('0x71'),_0x4a5050[_0x3b86('0x42')]['id']);for(var _0x35b6c0=0x0;_0x35b6c0<_0x6ac1a2['length'];_0x35b6c0+=0x1){let _0x83a30a=_0x6ac1a2[_0x35b6c0];for(var _0x7d2af6=0x0;_0x7d2af6<_0x83a30a[_0x3b86('0x6a')]['length'];_0x7d2af6+=0x1){let _0x24018a=_0x83a30a['Agents'][_0x7d2af6];var _0x4a7968=_0x3c8f19['clone']();_0x4a7968['where']('ut.UserId\x20=\x20?',_0x24018a['id']);_0x2bc77d[_0x3b86('0x72')](db[_0x3b86('0x62')][_0x3b86('0x2e')](_0x4a7968[_0x3b86('0x73')](),{'type':db[_0x3b86('0x62')][_0x3b86('0x74')]['SELECT']})[_0x3b86('0x25')](function(_0x296747){if(_0x296747[_0x3b86('0x34')]===0x1){return _0x24018a['id'];}else{var _0x26d4b9=_[_0x3b86('0x75')](_[_0x3b86('0x29')](_0x296747,'TeamId'),function(_0x48fd34){return _[_0x3b86('0x76')](_0x5aaa24,_0x48fd34);});if(_0x26d4b9){return _0x24018a['id'];}}}));}}return BPromise['all'](_0x2bc77d)[_0x3b86('0x25')](function(_0x24d789){_0x228152=_(_0x228152)[_0x3b86('0x77')](_0x24d789)[_0x3b86('0x78')]()['value']();return db[_0x3b86('0x2a')]['find']({'where':{'id':_0x4a5050[_0x3b86('0x42')]['id']}})['then'](function(_0x39021a){return db['sequelize'][_0x3b86('0x63')](function(_0x389377){return _0x39021a['removeTeams'](_0x4a5050[_0x3b86('0x2e')][_0x3b86('0x69')],{'transaction':_0x389377})[_0x3b86('0x25')](function(){if(!_[_0x3b86('0x79')](_0x228152)){return _0x39021a[_0x3b86('0x7a')](_0x228152,{'transaction':_0x389377});}})[_0x3b86('0x25')](function(){_0x228152['forEach'](function(_0x54be0b){socket['emit']('userFaxQueue:remove',{'UserId':_0x54be0b,'FaxQueueId':_0x39021a['id']});});});});});});})[_0x3b86('0x25')](respondWithStatusCode(_0x1c1fc9,null))[_0x3b86('0x41')](handleError(_0x1c1fc9,null));};exports[_0x3b86('0x7b')]=function(_0x3161a2,_0x2fee36,_0x2e99fe){return db[_0x3b86('0x2a')][_0x3b86('0x44')]({'where':{'id':_0x3161a2[_0x3b86('0x42')]['id']}})[_0x3b86('0x25')](handleEntityNotFound(_0x2fee36,null))[_0x3b86('0x25')](function(_0x11d2c3){if(_0x11d2c3){return _0x11d2c3[_0x3b86('0x7b')](_0x3161a2['body'][_0x3b86('0x69')],_[_0x3b86('0x7c')](_0x3161a2[_0x3b86('0x46')],[_0x3b86('0x69'),'id'])||{})[_0x3b86('0x7d')](function(_0x222e71){for(var _0x2a9230=0x0;_0x2a9230<_0x3161a2[_0x3b86('0x46')][_0x3b86('0x69')][_0x3b86('0x34')];_0x2a9230+=0x1){socket[_0x3b86('0x66')](_0x3b86('0x67'),{'UserId':Number(_0x3161a2['body']['ids'][_0x2a9230]),'FaxQueueId':Number(_0x3161a2[_0x3b86('0x42')]['id'])});}return _0x222e71;});}})['then'](respondWithResult(_0x2fee36,null))[_0x3b86('0x41')](handleError(_0x2fee36,null));};exports['removeAgents']=function(_0x48a88c,_0x2c06d0,_0x1d1fa3){return db[_0x3b86('0x2a')][_0x3b86('0x44')]({'where':{'id':_0x48a88c['params']['id']}})['then'](handleEntityNotFound(_0x2c06d0,null))[_0x3b86('0x25')](function(_0x1f16e1){if(_0x1f16e1){return _0x1f16e1[_0x3b86('0x7a')](_0x48a88c[_0x3b86('0x2e')][_0x3b86('0x69')])['then'](function(){if(_[_0x3b86('0x7e')](_0x48a88c[_0x3b86('0x2e')][_0x3b86('0x69')])){for(var _0x22d140=0x0;_0x22d140<_0x48a88c[_0x3b86('0x2e')][_0x3b86('0x69')]['length'];_0x22d140+=0x1){socket[_0x3b86('0x66')](_0x3b86('0x7f'),{'UserId':Number(_0x48a88c['query']['ids'][_0x22d140]),'FaxQueueId':Number(_0x48a88c[_0x3b86('0x42')]['id'])});}}else{socket['emit'](_0x3b86('0x7f'),{'UserId':Number(_0x48a88c['query'][_0x3b86('0x69')]),'FaxQueueId':Number(_0x48a88c[_0x3b86('0x42')]['id'])});}});}})[_0x3b86('0x25')](respondWithStatusCode(_0x2c06d0,null))[_0x3b86('0x41')](handleError(_0x2c06d0,null));};exports[_0x3b86('0x80')]=function(_0x374289,_0x328eba,_0x242d0d){var _0x2f5bc4={};var _0x5aa118={};var _0x5a01a2;var _0x5bdb6c;return db[_0x3b86('0x2a')]['findOne']({'where':{'id':_0x374289[_0x3b86('0x42')]['id']}})['then'](handleEntityNotFound(_0x328eba,null))[_0x3b86('0x25')](function(_0x2740ad){if(_0x2740ad){_0x5a01a2=_0x2740ad;_0x5aa118[_0x3b86('0x2d')]=_['keys'](db['User'][_0x3b86('0x2b')]);_0x5aa118[_0x3b86('0x2e')]=_[_0x3b86('0x2f')](_0x374289['query']);_0x5aa118['filters']=_[_0x3b86('0x31')](_0x5aa118[_0x3b86('0x2d')],_0x5aa118[_0x3b86('0x2e')]);_0x2f5bc4[_0x3b86('0x33')]=_[_0x3b86('0x31')](_0x5aa118[_0x3b86('0x2d')],qs[_0x3b86('0x32')](_0x374289['query'][_0x3b86('0x32')]));_0x2f5bc4['attributes']=_0x2f5bc4['attributes'][_0x3b86('0x34')]?_0x2f5bc4[_0x3b86('0x33')]:_0x5aa118[_0x3b86('0x2d')];_0x2f5bc4[_0x3b86('0x36')]=qs[_0x3b86('0x37')](_0x374289['query'][_0x3b86('0x37')]);_0x2f5bc4[_0x3b86('0x38')]=qs[_0x3b86('0x30')](_[_0x3b86('0x39')](_0x374289[_0x3b86('0x2e')],_0x5aa118[_0x3b86('0x30')]));if(_0x374289['query']['filter']){_0x2f5bc4[_0x3b86('0x38')]=_['merge'](_0x2f5bc4[_0x3b86('0x38')],{'$or':_[_0x3b86('0x29')](_0x2f5bc4[_0x3b86('0x33')],function(_0x3e7dd2){var _0xde3171={};_0xde3171[_0x3e7dd2]={'$like':'%'+_0x374289[_0x3b86('0x2e')][_0x3b86('0x3a')]+'%'};return _0xde3171;})});}_0x2f5bc4=_[_0x3b86('0x43')]({},_0x2f5bc4,_0x374289['options']);return _0x5a01a2[_0x3b86('0x80')](_0x2f5bc4);}})[_0x3b86('0x25')](function(_0x187de6){if(_0x187de6){_0x5bdb6c=_0x187de6[_0x3b86('0x34')];if(!_0x374289['query'][_0x3b86('0x35')](_0x3b86('0x52'))){_0x2f5bc4[_0x3b86('0x1d')]=qs[_0x3b86('0x1d')](_0x374289['query'][_0x3b86('0x1d')]);_0x2f5bc4['offset']=qs[_0x3b86('0x1a')](_0x374289[_0x3b86('0x2e')][_0x3b86('0x1a')]);}return _0x5a01a2[_0x3b86('0x80')](_0x2f5bc4);}})['then'](function(_0x5155f4){if(_0x5155f4){return _0x5155f4?{'count':_0x5bdb6c,'rows':_0x5155f4}:null;}})[_0x3b86('0x25')](respondWithResult(_0x328eba,null))[_0x3b86('0x41')](handleError(_0x328eba,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0c53b4f..8c08fc3 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 _0xb6e4=['hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb6e4,0x11a));var _0x4b6e=function(_0x1a0ad9,_0x5a820d){_0x1a0ad9=_0x1a0ad9-0x0;var _0x285395=_0xb6e4[_0x1a0ad9];return _0x285395;};'use strict';var EventEmitter=require(_0x4b6e('0x0'));var FaxQueue=require(_0x4b6e('0x1'))['db'][_0x4b6e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4b6e('0x3')](0x0);var events={'afterCreate':_0x4b6e('0x4'),'afterUpdate':_0x4b6e('0x5'),'afterDestroy':_0x4b6e('0x6')};function emitEvent(_0x501653){return function(_0x1cf836,_0x392ad7,_0x34a068){FaxQueueEvents[_0x4b6e('0x7')](_0x501653+':'+_0x1cf836['id'],_0x1cf836);FaxQueueEvents[_0x4b6e('0x7')](_0x501653,_0x1cf836);_0x34a068(null);};}for(var e in events){if(events[_0x4b6e('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4b6e('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x762c=['emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x762c,0xb7));var _0xc762=function(_0x24081f,_0x28a2b4){_0x24081f=_0x24081f-0x0;var _0xb567e4=_0x762c[_0x24081f];return _0xb567e4;};'use strict';var EventEmitter=require(_0xc762('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc762('0x1')](0x0);var events={'afterCreate':_0xc762('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd14f3d){return function(_0x36d0c0,_0x2f333d,_0x2eaa58){FaxQueueEvents[_0xc762('0x3')](_0xd14f3d+':'+_0x36d0c0['id'],_0x36d0c0);FaxQueueEvents[_0xc762('0x3')](_0xd14f3d,_0x36d0c0);_0x2eaa58(null);};}for(var e in events){if(events[_0xc762('0x4')](e)){var event=events[e];FaxQueue[_0xc762('0x5')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index efabe38..678bee7 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 _0x70b3=['./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4249d6,_0x788291){var _0x201616=function(_0x471df1){while(--_0x471df1){_0x4249d6['push'](_0x4249d6['shift']());}};_0x201616(++_0x788291);}(_0x70b3,0x1a8));var _0x370b=function(_0x447685,_0x1defd0){_0x447685=_0x447685-0x0;var _0x2222f4=_0x70b3[_0x447685];return _0x2222f4;};'use strict';var _=require(_0x370b('0x0'));var util=require(_0x370b('0x1'));var logger=require(_0x370b('0x2'))(_0x370b('0x3'));var moment=require('moment');var BPromise=require(_0x370b('0x4'));var rp=require(_0x370b('0x5'));var fs=require('fs');var path=require(_0x370b('0x6'));var rimraf=require(_0x370b('0x7'));var config=require('../../config/environment');var attributes=require(_0x370b('0x8'));module[_0x370b('0x9')]=function(_0x234734,_0xc3102f){return _0x234734['define'](_0x370b('0xa'),attributes,{'tableName':_0x370b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf417=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues'];(function(_0xb3999f,_0x7a3a3a){var _0x45fc7e=function(_0x20a863){while(--_0x20a863){_0xb3999f['push'](_0xb3999f['shift']());}};_0x45fc7e(++_0x7a3a3a);}(_0xf417,0x78));var _0x7f41=function(_0x229059,_0x324ab9){_0x229059=_0x229059-0x0;var _0x98067d=_0xf417[_0x229059];return _0x98067d;};'use strict';var _=require('lodash');var util=require(_0x7f41('0x0'));var logger=require(_0x7f41('0x1'))(_0x7f41('0x2'));var moment=require(_0x7f41('0x3'));var BPromise=require(_0x7f41('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f41('0x5'));var rimraf=require(_0x7f41('0x6'));var config=require(_0x7f41('0x7'));var attributes=require(_0x7f41('0x8'));module['exports']=function(_0x66654e,_0x2e4fc8){return _0x66654e[_0x7f41('0x9')](_0x7f41('0xa'),attributes,{'tableName':_0x7f41('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 75fab57..6316df2 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 _0x2b56=['message','result','GetFaxQueue','options','raw','where','attributes','include','map','model','catch','ShowFaxQueue','FaxQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0x2b56,0x180));var _0x62b5=function(_0x18e335,_0x283f27){_0x18e335=_0x18e335-0x0;var _0x1556b4=_0x2b56[_0x18e335];return _0x1556b4;};'use strict';var _=require('lodash');var util=require(_0x62b5('0x0'));var moment=require(_0x62b5('0x1'));var BPromise=require(_0x62b5('0x2'));var rs=require(_0x62b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62b5('0x4'))['db'];var utils=require(_0x62b5('0x5'));var logger=require('../../config/logger')(_0x62b5('0x6'));var config=require(_0x62b5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x62b5('0x8')]({'port':0x232a});config['redis']=_[_0x62b5('0x9')](config[_0x62b5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x62b5('0xb'))(new Redis(config[_0x62b5('0xa')]));require(_0x62b5('0xc'))[_0x62b5('0xd')](socket);function respondWithRpcPromise(_0x3c3612,_0x1497ed,_0x2c9b43){return new BPromise(function(_0x3f5006,_0x5af6bd){return client[_0x62b5('0xe')](_0x3c3612,_0x2c9b43)[_0x62b5('0xf')](function(_0x1e0e8a){logger[_0x62b5('0x10')]('FaxQueue,\x20%s,\x20%s',_0x1497ed,'request\x20sent');logger[_0x62b5('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1497ed,_0x62b5('0x12'),JSON[_0x62b5('0x13')](_0x1e0e8a));if(_0x1e0e8a['error']){if(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x15')]===0x1f4){logger['error'](_0x62b5('0x16'),_0x1497ed,_0x1e0e8a[_0x62b5('0x14')]['message']);return _0x5af6bd(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);}logger[_0x62b5('0x14')](_0x62b5('0x16'),_0x1497ed,_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);return _0x3f5006(_0x1e0e8a[_0x62b5('0x14')][_0x62b5('0x17')]);}else{logger[_0x62b5('0x10')]('FaxQueue,\x20%s,\x20%s',_0x1497ed,_0x62b5('0x12'));_0x3f5006(_0x1e0e8a[_0x62b5('0x18')][_0x62b5('0x17')]);}})['catch'](function(_0x4055ee){logger['error'](_0x62b5('0x16'),_0x1497ed,_0x4055ee);_0x5af6bd(_0x4055ee);});});}exports[_0x62b5('0x19')]=function(_0x4bbdcf){var _0x416b4e=this;return new Promise(function(_0x5e31e2,_0x2ff294){return db['FaxQueue']['findAll']({'raw':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1b')]===undefined?!![]:![]:!![],'where':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf['options'][_0x62b5('0x1c')]||null:null,'attributes':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf['options'][_0x62b5('0x1d')]||null:null,'limit':_0x4bbdcf['options']?_0x4bbdcf[_0x62b5('0x1a')]['limit']||null:null,'include':_0x4bbdcf[_0x62b5('0x1a')]?_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x4bbdcf[_0x62b5('0x1a')][_0x62b5('0x1e')],function(_0x491219){return{'model':db[_0x491219[_0x62b5('0x20')]],'as':_0x491219['as'],'attributes':_0x491219['attributes'],'include':_0x491219[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x491219[_0x62b5('0x1e')],function(_0x5b3ea3){return{'model':db[_0x5b3ea3[_0x62b5('0x20')]],'as':_0x5b3ea3['as'],'attributes':_0x5b3ea3['attributes'],'include':_0x5b3ea3[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x5b3ea3[_0x62b5('0x1e')],function(_0x2832e9){return{'model':db[_0x2832e9[_0x62b5('0x20')]],'as':_0x2832e9['as'],'attributes':_0x2832e9[_0x62b5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x62b5('0xf')](function(_0x357677){logger[_0x62b5('0x10')](_0x62b5('0x19'),_0x4bbdcf);logger[_0x62b5('0x11')]('GetFaxQueue',_0x4bbdcf,JSON[_0x62b5('0x13')](_0x357677));_0x5e31e2(_0x357677);})[_0x62b5('0x21')](function(_0x3de351){logger[_0x62b5('0x14')](_0x62b5('0x19'),_0x3de351[_0x62b5('0x17')],_0x4bbdcf);_0x2ff294(_0x416b4e[_0x62b5('0x14')](0x1f4,_0x3de351[_0x62b5('0x17')]));});});};exports[_0x62b5('0x22')]=function(_0x2ba27a){var _0x1c8f95=this;return new Promise(function(_0x6ca665,_0x10f3d2){return db[_0x62b5('0x23')][_0x62b5('0x24')]({'raw':_0x2ba27a['options']?_0x2ba27a[_0x62b5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ba27a[_0x62b5('0x1a')]?_0x2ba27a['options'][_0x62b5('0x1c')]||null:null,'attributes':_0x2ba27a['options']?_0x2ba27a[_0x62b5('0x1a')][_0x62b5('0x1d')]||null:null,'include':_0x2ba27a[_0x62b5('0x1a')]?_0x2ba27a[_0x62b5('0x1a')]['include']?_[_0x62b5('0x1f')](_0x2ba27a[_0x62b5('0x1a')][_0x62b5('0x1e')],function(_0x404696){return{'model':db[_0x404696[_0x62b5('0x20')]],'as':_0x404696['as'],'attributes':_0x404696['attributes'],'include':_0x404696[_0x62b5('0x1e')]?_[_0x62b5('0x1f')](_0x404696[_0x62b5('0x1e')],function(_0x3db9d9){return{'model':db[_0x3db9d9[_0x62b5('0x20')]],'as':_0x3db9d9['as'],'attributes':_0x3db9d9[_0x62b5('0x1d')],'include':_0x3db9d9['include']?_[_0x62b5('0x1f')](_0x3db9d9[_0x62b5('0x1e')],function(_0x4ac049){return{'model':db[_0x4ac049[_0x62b5('0x20')]],'as':_0x4ac049['as'],'attributes':_0x4ac049[_0x62b5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20c9f6){logger[_0x62b5('0x10')]('ShowFaxQueue',_0x2ba27a);logger[_0x62b5('0x11')](_0x62b5('0x22'),_0x2ba27a,JSON[_0x62b5('0x13')](_0x20c9f6));_0x6ca665(_0x20c9f6);})[_0x62b5('0x21')](function(_0x4f11ae){logger[_0x62b5('0x14')](_0x62b5('0x22'),_0x4f11ae[_0x62b5('0x17')],_0x2ba27a);_0x10f3d2(_0x1c8f95['error'](0x1f4,_0x4f11ae['message']));});});}; \ No newline at end of file +var _0x5370=['FaxQueue','findAll','options','raw','where','attributes','include','model','map','then','ShowFaxQueue','util','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFaxQueue'];(function(_0x6474ce,_0x1af163){var _0x30be84=function(_0xf26348){while(--_0xf26348){_0x6474ce['push'](_0x6474ce['shift']());}};_0x30be84(++_0x1af163);}(_0x5370,0xd1));var _0x0537=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5370[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x0537('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0537('0x1'));var fs=require('fs');var Redis=require(_0x0537('0x2'));var db=require(_0x0537('0x3'))['db'];var utils=require(_0x0537('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0537('0x5'));var client=jayson[_0x0537('0x6')]['http']({'port':0x232a});config[_0x0537('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0537('0x8'))(new Redis(config['redis']));require(_0x0537('0x9'))[_0x0537('0xa')](socket);function respondWithRpcPromise(_0x50cb62,_0xb95327,_0x128e11){return new BPromise(function(_0x3dcb81,_0xf2a9b){return client[_0x0537('0xb')](_0x50cb62,_0x128e11)['then'](function(_0x255e44){logger[_0x0537('0xc')](_0x0537('0xd'),_0xb95327,_0x0537('0xe'));logger[_0x0537('0xf')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xb95327,_0x0537('0xe'),JSON[_0x0537('0x10')](_0x255e44));if(_0x255e44[_0x0537('0x11')]){if(_0x255e44[_0x0537('0x11')][_0x0537('0x12')]===0x1f4){logger[_0x0537('0x11')](_0x0537('0xd'),_0xb95327,_0x255e44[_0x0537('0x11')][_0x0537('0x13')]);return _0xf2a9b(_0x255e44[_0x0537('0x11')][_0x0537('0x13')]);}logger[_0x0537('0x11')](_0x0537('0xd'),_0xb95327,_0x255e44['error'][_0x0537('0x13')]);return _0x3dcb81(_0x255e44[_0x0537('0x11')][_0x0537('0x13')]);}else{logger[_0x0537('0xc')]('FaxQueue,\x20%s,\x20%s',_0xb95327,_0x0537('0xe'));_0x3dcb81(_0x255e44['result']['message']);}})[_0x0537('0x14')](function(_0x2c934b){logger[_0x0537('0x11')](_0x0537('0xd'),_0xb95327,_0x2c934b);_0xf2a9b(_0x2c934b);});});}exports[_0x0537('0x15')]=function(_0x31b414){var _0x1df77b=this;return new Promise(function(_0xfe4dad,_0x3aa916){return db[_0x0537('0x16')][_0x0537('0x17')]({'raw':_0x31b414[_0x0537('0x18')]?_0x31b414[_0x0537('0x18')][_0x0537('0x19')]===undefined?!![]:![]:!![],'where':_0x31b414[_0x0537('0x18')]?_0x31b414['options'][_0x0537('0x1a')]||null:null,'attributes':_0x31b414[_0x0537('0x18')]?_0x31b414['options'][_0x0537('0x1b')]||null:null,'limit':_0x31b414[_0x0537('0x18')]?_0x31b414[_0x0537('0x18')]['limit']||null:null,'include':_0x31b414[_0x0537('0x18')]?_0x31b414['options']['include']?_['map'](_0x31b414[_0x0537('0x18')][_0x0537('0x1c')],function(_0x542acb){return{'model':db[_0x542acb[_0x0537('0x1d')]],'as':_0x542acb['as'],'attributes':_0x542acb[_0x0537('0x1b')],'include':_0x542acb[_0x0537('0x1c')]?_['map'](_0x542acb['include'],function(_0x244c4e){return{'model':db[_0x244c4e['model']],'as':_0x244c4e['as'],'attributes':_0x244c4e['attributes'],'include':_0x244c4e[_0x0537('0x1c')]?_[_0x0537('0x1e')](_0x244c4e[_0x0537('0x1c')],function(_0x5ef791){return{'model':db[_0x5ef791['model']],'as':_0x5ef791['as'],'attributes':_0x5ef791[_0x0537('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0537('0x1f')](function(_0x19a7ce){logger['info']('GetFaxQueue',_0x31b414);logger['debug'](_0x0537('0x15'),_0x31b414,JSON['stringify'](_0x19a7ce));_0xfe4dad(_0x19a7ce);})[_0x0537('0x14')](function(_0x408a63){logger[_0x0537('0x11')]('GetFaxQueue',_0x408a63[_0x0537('0x13')],_0x31b414);_0x3aa916(_0x1df77b[_0x0537('0x11')](0x1f4,_0x408a63['message']));});});};exports[_0x0537('0x20')]=function(_0xfef84a){var _0x241816=this;return new Promise(function(_0x5742f8,_0x1ebeb8){return db[_0x0537('0x16')]['find']({'raw':_0xfef84a[_0x0537('0x18')]?_0xfef84a[_0x0537('0x18')][_0x0537('0x19')]===undefined?!![]:![]:!![],'where':_0xfef84a[_0x0537('0x18')]?_0xfef84a[_0x0537('0x18')][_0x0537('0x1a')]||null:null,'attributes':_0xfef84a[_0x0537('0x18')]?_0xfef84a[_0x0537('0x18')]['attributes']||null:null,'include':_0xfef84a[_0x0537('0x18')]?_0xfef84a[_0x0537('0x18')]['include']?_[_0x0537('0x1e')](_0xfef84a[_0x0537('0x18')][_0x0537('0x1c')],function(_0x372f48){return{'model':db[_0x372f48[_0x0537('0x1d')]],'as':_0x372f48['as'],'attributes':_0x372f48['attributes'],'include':_0x372f48[_0x0537('0x1c')]?_[_0x0537('0x1e')](_0x372f48[_0x0537('0x1c')],function(_0x2593bb){return{'model':db[_0x2593bb[_0x0537('0x1d')]],'as':_0x2593bb['as'],'attributes':_0x2593bb[_0x0537('0x1b')],'include':_0x2593bb[_0x0537('0x1c')]?_['map'](_0x2593bb[_0x0537('0x1c')],function(_0x1bdbd3){return{'model':db[_0x1bdbd3['model']],'as':_0x1bdbd3['as'],'attributes':_0x1bdbd3[_0x0537('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0537('0x1f')](function(_0xd5957c){logger[_0x0537('0xc')]('ShowFaxQueue',_0xfef84a);logger[_0x0537('0xf')](_0x0537('0x20'),_0xfef84a,JSON[_0x0537('0x10')](_0xd5957c));_0x5742f8(_0xd5957c);})[_0x0537('0x14')](function(_0x172e5f){logger[_0x0537('0x11')](_0x0537('0x20'),_0x172e5f[_0x0537('0x13')],_0xfef84a);_0x1ebeb8(_0x241816[_0x0537('0x11')](0x1f4,_0x172e5f[_0x0537('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2cde891..6db2730 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 _0x06da=['register','length','faxQueue:','remove','removeListener'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x06da,0x8f));var _0xa06d=function(_0xcafdb4,_0x302640){_0xcafdb4=_0xcafdb4-0x0;var _0x5d2775=_0x06da[_0xcafdb4];return _0x5d2775;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0xa06d('0x0'),'update'];function createListener(_0x1cdeaa,_0x5d8389){return function(_0xb26efc){_0x5d8389['emit'](_0x1cdeaa,_0xb26efc);};}function removeListener(_0x2b6fdd,_0x5a4590){return function(){FaxQueueEvents[_0xa06d('0x1')](_0x2b6fdd,_0x5a4590);};}exports[_0xa06d('0x2')]=function(_0x3c7035){for(var _0x5d4266=0x0,_0x3abe3f=events[_0xa06d('0x3')];_0x5d4266<_0x3abe3f;_0x5d4266++){var _0x21f2d4=events[_0x5d4266];var _0x25d5cb=createListener(_0xa06d('0x4')+_0x21f2d4,_0x3c7035);FaxQueueEvents['on'](_0x21f2d4,_0x25d5cb);}}; \ No newline at end of file +var _0x0b5b=['update','emit','register','length','faxQueue:','save','remove'];(function(_0x20029d,_0x4890cb){var _0x242b96=function(_0x1cb19b){while(--_0x1cb19b){_0x20029d['push'](_0x20029d['shift']());}};_0x242b96(++_0x4890cb);}(_0x0b5b,0x147));var _0xb0b5=function(_0x35171f,_0x3a35f6){_0x35171f=_0x35171f-0x0;var _0x1af363=_0x0b5b[_0x35171f];return _0x1af363;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xb0b5('0x0'),_0xb0b5('0x1'),_0xb0b5('0x2')];function createListener(_0x393c1a,_0x1571eb){return function(_0x3ecd7c){_0x1571eb[_0xb0b5('0x3')](_0x393c1a,_0x3ecd7c);};}function removeListener(_0x358f31,_0x42ff09){return function(){FaxQueueEvents['removeListener'](_0x358f31,_0x42ff09);};}exports[_0xb0b5('0x4')]=function(_0xbc2de4){for(var _0x2e716d=0x0,_0x2d7f52=events[_0xb0b5('0x5')];_0x2e716d<_0x2d7f52;_0x2e716d++){var _0x55020b=events[_0x2e716d];var _0xba58ce=createListener(_0xb0b5('0x6')+_0x55020b,_0xbc2de4);FaxQueueEvents['on'](_0x55020b,_0xba58ce);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ef7843d..97f69c8 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 _0xe2bc=['/:id/users','update','destroy','delete','removeTeams','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xe2bc[_0x1cb18a];return _0x22442e;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/describe',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['get'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xd')]);router[_0xce2b('0x8')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x8')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['getTeams']);router[_0xce2b('0x8')]('/:id/users',auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);router[_0xce2b('0x12')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0x13')]);router[_0xce2b('0x12')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller['addTeams']);router[_0xce2b('0x12')](_0xce2b('0x14'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xce2b('0xc'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x15')]);router['delete']('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0x16')]);router[_0xce2b('0x17')](_0xce2b('0x10'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x18')]);router[_0xce2b('0x17')](_0xce2b('0x14'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xdf55=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams'];(function(_0x29edb3,_0x510265){var _0x28ca00=function(_0x1fb6bd){while(--_0x1fb6bd){_0x29edb3['push'](_0x29edb3['shift']());}};_0x28ca00(++_0x510265);}(_0xdf55,0x83));var _0x5df5=function(_0x27a7d3,_0x24ca5b){_0x27a7d3=_0x27a7d3-0x0;var _0x107ab8=_0xdf55[_0x27a7d3];return _0x107ab8;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['get']('/:id/members',auth[_0x5df5('0x9')](),controller['getMembers']);router[_0x5df5('0x8')](_0x5df5('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x5df5('0x8')](_0x5df5('0x10'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x11')]);router[_0x5df5('0x12')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0x13')]);router[_0x5df5('0x12')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller['addTeams']);router[_0x5df5('0x12')]('/:id/users',auth[_0x5df5('0x9')](),controller[_0x5df5('0x14')]);router[_0x5df5('0x15')](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0x16')](_0x5df5('0xd'),auth['isAuthenticated'](),controller[_0x5df5('0x17')]);router[_0x5df5('0x16')](_0x5df5('0xf'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x18')]);router['delete']('/:id/users',auth[_0x5df5('0x9')](),controller['removeAgents']);module[_0x5df5('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f9ae699..54d6d39 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 _0x6704=['moment','sequelize','exports','STRING','DATE'];(function(_0x1b8b7f,_0x432d21){var _0x185697=function(_0x506600){while(--_0x506600){_0x1b8b7f['push'](_0x1b8b7f['shift']());}};_0x185697(++_0x432d21);}(_0x6704,0x127));var _0x4670=function(_0x400955,_0xd0898a){_0x400955=_0x400955-0x0;var _0x2466af=_0x6704[_0x400955];return _0x2466af;};'use strict';var moment=require(_0x4670('0x0'));var Sequelize=require(_0x4670('0x1'));module[_0x4670('0x2')]={'uniqueid':{'type':Sequelize[_0x4670('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4670('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4670('0x4')]},'acceptAt':{'type':Sequelize[_0x4670('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4670('0x3')]}}; \ No newline at end of file +var _0x9b56=['DATE','sequelize','STRING'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x9b56,0xac));var _0x69b5=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x9b56[_0x421196];return _0x2738af;};'use strict';var moment=require('moment');var Sequelize=require(_0x69b5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x69b5('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x69b5('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x69b5('0x2')]},'acceptAt':{'type':Sequelize[_0x69b5('0x2')]},'exitAt':{'type':Sequelize[_0x69b5('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7dfa07a..b2d6640 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 _0xd4bd=['limit','count','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x4bda95,_0x9ccebb){_0x4bda95=_0x4bda95-0x0;var _0x37490e=_0xd4bd[_0x4bda95];return _0x37490e;};'use strict';var emlformat=require(_0xdd4b('0x0'));var rimraf=require(_0xdd4b('0x1'));var zipdir=require(_0xdd4b('0x2'));var jsonpatch=require(_0xdd4b('0x3'));var rp=require(_0xdd4b('0x4'));var moment=require('moment');var BPromise=require(_0xdd4b('0x5'));var Mustache=require(_0xdd4b('0x6'));var util=require(_0xdd4b('0x7'));var path=require(_0xdd4b('0x8'));var sox=require(_0xdd4b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd4b('0xa'));var _=require('lodash');var squel=require(_0xdd4b('0xb'));var crypto=require(_0xdd4b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd4b('0xd'));var querystring=require(_0xdd4b('0xe'));var Papa=require('papaparse');var Redis=require(_0xdd4b('0xf'));var authService=require(_0xdd4b('0x10'));var qs=require(_0xdd4b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd4b('0x12'));var logger=require(_0xdd4b('0x13'))(_0xdd4b('0x14'));var utils=require(_0xdd4b('0x15'));var config=require(_0xdd4b('0x16'));var licenseUtil=require(_0xdd4b('0x17'));var db=require(_0xdd4b('0x18'))['db'];function respondWithStatusCode(_0x115e70,_0x594339){_0x594339=_0x594339||0xcc;return function(_0x2a88ab){if(_0x2a88ab){return _0x115e70['sendStatus'](_0x594339);}return _0x115e70[_0xdd4b('0x19')](_0x594339)[_0xdd4b('0x1a')]();};}function respondWithResult(_0x2dc062,_0x5dc694){_0x5dc694=_0x5dc694||0xc8;return function(_0x327f9e){if(_0x327f9e){return _0x2dc062[_0xdd4b('0x19')](_0x5dc694)['json'](_0x327f9e);}};}function respondWithFilteredResult(_0x5ccc78,_0x3a7f2a){return function(_0x368842){if(_0x368842){var _0x39f053=typeof _0x3a7f2a[_0xdd4b('0x1b')]===_0xdd4b('0x1c')&&typeof _0x3a7f2a[_0xdd4b('0x1d')]===_0xdd4b('0x1c');var _0x5817fa=_0x368842[_0xdd4b('0x1e')];var _0x423e39=_0x39f053?0x0:_0x3a7f2a[_0xdd4b('0x1b')];var _0x5331d7=_0x39f053?_0x368842[_0xdd4b('0x1e')]:_0x3a7f2a['offset']+_0x3a7f2a['limit'];var _0x3b0232;if(_0x5331d7>=_0x5817fa){_0x5331d7=_0x5817fa;_0x3b0232=0xc8;}else{_0x3b0232=0xce;}_0x5ccc78[_0xdd4b('0x19')](_0x3b0232);return _0x5ccc78['set'](_0xdd4b('0x1f'),_0x423e39+'-'+_0x5331d7+'/'+_0x5817fa)[_0xdd4b('0x20')](_0x368842);}return null;};}function patchUpdates(_0xf6eb51){return function(_0x1fbbe7){try{jsonpatch[_0xdd4b('0x21')](_0x1fbbe7,_0xf6eb51,!![]);}catch(_0x5a19ca){return BPromise[_0xdd4b('0x22')](_0x5a19ca);}return _0x1fbbe7['save']();};}function saveUpdates(_0x48e75e,_0x2325fe){return function(_0x26c32b){if(_0x26c32b){return _0x26c32b[_0xdd4b('0x23')](_0x48e75e)['then'](function(_0xa66301){return _0xa66301;});}return null;};}function removeEntity(_0x1ba012,_0x1b55b5){return function(_0x333a3f){if(_0x333a3f){return _0x333a3f[_0xdd4b('0x24')]()[_0xdd4b('0x25')](function(){_0x1ba012['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4800de,_0xd6bfcb){return function(_0x304f46){if(!_0x304f46){_0x4800de['sendStatus'](0x194);}return _0x304f46;};}function handleError(_0x4d9896,_0x2d4f73){_0x2d4f73=_0x2d4f73||0x1f4;return function(_0x24fa06){logger[_0xdd4b('0x26')](_0x24fa06[_0xdd4b('0x27')]);if(_0x24fa06[_0xdd4b('0x28')]){delete _0x24fa06['name'];}_0x4d9896[_0xdd4b('0x19')](_0x2d4f73)[_0xdd4b('0x29')](_0x24fa06);};}exports[_0xdd4b('0x2a')]=function(_0x1f70b3,_0x32489f){var _0x14a40f={},_0x4de481={},_0x420597={'count':0x0,'rows':[]};var _0x3c841a=_[_0xdd4b('0x2b')](db[_0xdd4b('0x2c')][_0xdd4b('0x2d')],function(_0x132646){return{'name':_0x132646[_0xdd4b('0x2e')],'type':_0x132646[_0xdd4b('0x2f')][_0xdd4b('0x30')]};});_0x4de481[_0xdd4b('0x31')]=_[_0xdd4b('0x2b')](_0x3c841a,_0xdd4b('0x28'));_0x4de481[_0xdd4b('0x32')]=_[_0xdd4b('0x33')](_0x1f70b3[_0xdd4b('0x32')]);_0x4de481[_0xdd4b('0x34')]=_['intersection'](_0x4de481['model'],_0x4de481[_0xdd4b('0x32')]);_0x14a40f[_0xdd4b('0x35')]=_[_0xdd4b('0x36')](_0x4de481['model'],qs[_0xdd4b('0x37')](_0x1f70b3[_0xdd4b('0x32')]['fields']));_0x14a40f['attributes']=_0x14a40f[_0xdd4b('0x35')]['length']?_0x14a40f[_0xdd4b('0x35')]:_0x4de481['model'];if(!_0x1f70b3['query'][_0xdd4b('0x38')](_0xdd4b('0x39'))){_0x14a40f['limit']=qs[_0xdd4b('0x1d')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x1d')]);_0x14a40f[_0xdd4b('0x1b')]=qs[_0xdd4b('0x1b')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x1b')]);}_0x14a40f[_0xdd4b('0x3a')]=qs[_0xdd4b('0x3b')](_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x3b')]);_0x14a40f[_0xdd4b('0x3c')]=qs[_0xdd4b('0x34')](_[_0xdd4b('0x3d')](_0x1f70b3[_0xdd4b('0x32')],_0x4de481['filters']),_0x3c841a);if(_0x1f70b3[_0xdd4b('0x32')][_0xdd4b('0x3e')]){_0x14a40f[_0xdd4b('0x3c')]=_[_0xdd4b('0x3f')](_0x14a40f[_0xdd4b('0x3c')],{'$or':_[_0xdd4b('0x2b')](_0x3c841a,function(_0x3af2d8){if(_0x3af2d8[_0xdd4b('0x2f')]!==_0xdd4b('0x40')){var _0x1bc914={};_0x1bc914[_0x3af2d8[_0xdd4b('0x28')]]={'$like':'%'+_0x1f70b3['query'][_0xdd4b('0x3e')]+'%'};return _0x1bc914;}})});}_0x14a40f=_[_0xdd4b('0x3f')]({},_0x14a40f,_0x1f70b3[_0xdd4b('0x41')]);var _0x566669={'where':_0x14a40f[_0xdd4b('0x3c')]};return db[_0xdd4b('0x2c')][_0xdd4b('0x1e')](_0x566669)[_0xdd4b('0x25')](function(_0x88002d){_0x420597[_0xdd4b('0x1e')]=_0x88002d;if(_0x1f70b3['query'][_0xdd4b('0x42')]){_0x14a40f[_0xdd4b('0x43')]=[{'all':!![]}];}return db[_0xdd4b('0x2c')]['findAll'](_0x14a40f);})[_0xdd4b('0x25')](function(_0x255e2b){_0x420597[_0xdd4b('0x44')]=_0x255e2b;return _0x420597;})[_0xdd4b('0x25')](respondWithFilteredResult(_0x32489f,_0x14a40f))[_0xdd4b('0x45')](handleError(_0x32489f,null));};exports['show']=function(_0x293878,_0x44bf64){var _0x53d98a={'raw':!![],'where':{'id':_0x293878['params']['id']}},_0x333bed={};_0x333bed[_0xdd4b('0x31')]=_['keys'](db['FaxQueueReport'][_0xdd4b('0x2d')]);_0x333bed[_0xdd4b('0x32')]=_[_0xdd4b('0x33')](_0x293878[_0xdd4b('0x32')]);_0x333bed['filters']=_[_0xdd4b('0x36')](_0x333bed[_0xdd4b('0x31')],_0x333bed[_0xdd4b('0x32')]);_0x53d98a[_0xdd4b('0x35')]=_[_0xdd4b('0x36')](_0x333bed[_0xdd4b('0x31')],qs[_0xdd4b('0x37')](_0x293878['query']['fields']));_0x53d98a[_0xdd4b('0x35')]=_0x53d98a['attributes'][_0xdd4b('0x46')]?_0x53d98a[_0xdd4b('0x35')]:_0x333bed[_0xdd4b('0x31')];if(_0x293878[_0xdd4b('0x32')][_0xdd4b('0x42')]){_0x53d98a['include']=[{'all':!![]}];}_0x53d98a=_[_0xdd4b('0x3f')]({},_0x53d98a,_0x293878[_0xdd4b('0x41')]);return db[_0xdd4b('0x2c')][_0xdd4b('0x47')](_0x53d98a)['then'](handleEntityNotFound(_0x44bf64,null))[_0xdd4b('0x25')](respondWithResult(_0x44bf64,null))[_0xdd4b('0x45')](handleError(_0x44bf64,null));};exports[_0xdd4b('0x48')]=function(_0x59edf7,_0x401152){return db[_0xdd4b('0x2c')]['create'](_0x59edf7[_0xdd4b('0x49')],{})['then'](respondWithResult(_0x401152,0xc9))[_0xdd4b('0x45')](handleError(_0x401152,null));};exports[_0xdd4b('0x23')]=function(_0xffa891,_0x3121ee){if(_0xffa891[_0xdd4b('0x49')]['id']){delete _0xffa891[_0xdd4b('0x49')]['id'];}return db[_0xdd4b('0x2c')][_0xdd4b('0x47')]({'where':{'id':_0xffa891[_0xdd4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3121ee,null))[_0xdd4b('0x25')](saveUpdates(_0xffa891[_0xdd4b('0x49')],null))[_0xdd4b('0x25')](respondWithResult(_0x3121ee,null))['catch'](handleError(_0x3121ee,null));};exports[_0xdd4b('0x24')]=function(_0xd1bde8,_0x539f05){return db[_0xdd4b('0x2c')][_0xdd4b('0x47')]({'where':{'id':_0xd1bde8[_0xdd4b('0x4a')]['id']}})[_0xdd4b('0x25')](handleEntityNotFound(_0x539f05,null))[_0xdd4b('0x25')](removeEntity(_0x539f05,null))[_0xdd4b('0x45')](handleError(_0x539f05,null));};exports[_0xdd4b('0x4b')]=function(_0x43e6ca,_0xda3cc4){return db[_0xdd4b('0x2c')]['describe']()[_0xdd4b('0x25')](respondWithResult(_0xda3cc4,null))['catch'](handleError(_0xda3cc4,null));}; \ No newline at end of file +var _0x1152=['key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','show','keys','include','merge','create','body','catch','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes'];(function(_0x5f364a,_0x523e4a){var _0x59b906=function(_0x47fe06){while(--_0x47fe06){_0x5f364a['push'](_0x5f364a['shift']());}};_0x59b906(++_0x523e4a);}(_0x1152,0x182));var _0x2115=function(_0x3fccbb,_0x473396){_0x3fccbb=_0x3fccbb-0x0;var _0x11df6e=_0x1152[_0x3fccbb];return _0x11df6e;};'use strict';var emlformat=require(_0x2115('0x0'));var rimraf=require(_0x2115('0x1'));var zipdir=require(_0x2115('0x2'));var jsonpatch=require(_0x2115('0x3'));var rp=require(_0x2115('0x4'));var moment=require(_0x2115('0x5'));var BPromise=require(_0x2115('0x6'));var Mustache=require(_0x2115('0x7'));var util=require('util');var path=require(_0x2115('0x8'));var sox=require('sox');var csv=require(_0x2115('0x9'));var ejs=require(_0x2115('0xa'));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(_0x2115('0xb'));var toCsv=require(_0x2115('0x9'));var querystring=require(_0x2115('0xc'));var Papa=require('papaparse');var Redis=require(_0x2115('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2115('0xe'));var hardwareService=require(_0x2115('0xf'));var logger=require(_0x2115('0x10'))('api');var utils=require(_0x2115('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x2115('0x12'));var db=require(_0x2115('0x13'))['db'];function respondWithStatusCode(_0x2bb885,_0x33d38b){_0x33d38b=_0x33d38b||0xcc;return function(_0x22475e){if(_0x22475e){return _0x2bb885['sendStatus'](_0x33d38b);}return _0x2bb885[_0x2115('0x14')](_0x33d38b)['end']();};}function respondWithResult(_0x3727a3,_0x38e406){_0x38e406=_0x38e406||0xc8;return function(_0x17028e){if(_0x17028e){return _0x3727a3[_0x2115('0x14')](_0x38e406)[_0x2115('0x15')](_0x17028e);}};}function respondWithFilteredResult(_0x113ce2,_0x350969){return function(_0x5e8f81){if(_0x5e8f81){var _0xdf3e24=typeof _0x350969[_0x2115('0x16')]===_0x2115('0x17')&&typeof _0x350969[_0x2115('0x18')]===_0x2115('0x17');var _0x1bdef9=_0x5e8f81[_0x2115('0x19')];var _0x77e2c6=_0xdf3e24?0x0:_0x350969['offset'];var _0x154f69=_0xdf3e24?_0x5e8f81[_0x2115('0x19')]:_0x350969[_0x2115('0x16')]+_0x350969['limit'];var _0x2dfb3c;if(_0x154f69>=_0x1bdef9){_0x154f69=_0x1bdef9;_0x2dfb3c=0xc8;}else{_0x2dfb3c=0xce;}_0x113ce2[_0x2115('0x14')](_0x2dfb3c);return _0x113ce2[_0x2115('0x1a')](_0x2115('0x1b'),_0x77e2c6+'-'+_0x154f69+'/'+_0x1bdef9)[_0x2115('0x15')](_0x5e8f81);}return null;};}function patchUpdates(_0xcc2d7b){return function(_0x21d079){try{jsonpatch[_0x2115('0x1c')](_0x21d079,_0xcc2d7b,!![]);}catch(_0x464af4){return BPromise[_0x2115('0x1d')](_0x464af4);}return _0x21d079[_0x2115('0x1e')]();};}function saveUpdates(_0x8b7304,_0x8e37c){return function(_0x13fde1){if(_0x13fde1){return _0x13fde1['update'](_0x8b7304)[_0x2115('0x1f')](function(_0x340c42){return _0x340c42;});}return null;};}function removeEntity(_0x40d19f,_0x4ac436){return function(_0x27c2f5){if(_0x27c2f5){return _0x27c2f5[_0x2115('0x20')]()['then'](function(){_0x40d19f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x201c94,_0x5e9d07){return function(_0x1a2ec3){if(!_0x1a2ec3){_0x201c94['sendStatus'](0x194);}return _0x1a2ec3;};}function handleError(_0x1283ec,_0x115800){_0x115800=_0x115800||0x1f4;return function(_0x1b7f47){logger[_0x2115('0x21')](_0x1b7f47[_0x2115('0x22')]);if(_0x1b7f47['name']){delete _0x1b7f47[_0x2115('0x23')];}_0x1283ec[_0x2115('0x14')](_0x115800)['send'](_0x1b7f47);};}exports[_0x2115('0x24')]=function(_0x33d81c,_0x26eff7){var _0x1262e7={},_0x59ca70={},_0x19c595={'count':0x0,'rows':[]};var _0x15229e=_[_0x2115('0x25')](db[_0x2115('0x26')][_0x2115('0x27')],function(_0x27969d){return{'name':_0x27969d['fieldName'],'type':_0x27969d['type'][_0x2115('0x28')]};});_0x59ca70[_0x2115('0x29')]=_[_0x2115('0x25')](_0x15229e,_0x2115('0x23'));_0x59ca70[_0x2115('0x2a')]=_['keys'](_0x33d81c[_0x2115('0x2a')]);_0x59ca70[_0x2115('0x2b')]=_[_0x2115('0x2c')](_0x59ca70['model'],_0x59ca70[_0x2115('0x2a')]);_0x1262e7['attributes']=_[_0x2115('0x2c')](_0x59ca70['model'],qs[_0x2115('0x2d')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x2d')]));_0x1262e7['attributes']=_0x1262e7['attributes'][_0x2115('0x2e')]?_0x1262e7[_0x2115('0x2f')]:_0x59ca70['model'];if(!_0x33d81c[_0x2115('0x2a')][_0x2115('0x30')](_0x2115('0x31'))){_0x1262e7[_0x2115('0x18')]=qs['limit'](_0x33d81c[_0x2115('0x2a')][_0x2115('0x18')]);_0x1262e7[_0x2115('0x16')]=qs[_0x2115('0x16')](_0x33d81c['query'][_0x2115('0x16')]);}_0x1262e7[_0x2115('0x32')]=qs[_0x2115('0x33')](_0x33d81c[_0x2115('0x2a')][_0x2115('0x33')]);_0x1262e7[_0x2115('0x34')]=qs['filters'](_[_0x2115('0x35')](_0x33d81c[_0x2115('0x2a')],_0x59ca70[_0x2115('0x2b')]),_0x15229e);if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]){_0x1262e7[_0x2115('0x34')]=_['merge'](_0x1262e7[_0x2115('0x34')],{'$or':_['map'](_0x15229e,function(_0x59b531){if(_0x59b531[_0x2115('0x37')]!==_0x2115('0x38')){var _0x4572f3={};_0x4572f3[_0x59b531[_0x2115('0x23')]]={'$like':'%'+_0x33d81c[_0x2115('0x2a')][_0x2115('0x36')]+'%'};return _0x4572f3;}})});}_0x1262e7=_['merge']({},_0x1262e7,_0x33d81c[_0x2115('0x39')]);var _0x1c2508={'where':_0x1262e7[_0x2115('0x34')]};return db[_0x2115('0x26')][_0x2115('0x19')](_0x1c2508)[_0x2115('0x1f')](function(_0x1aa165){_0x19c595[_0x2115('0x19')]=_0x1aa165;if(_0x33d81c[_0x2115('0x2a')][_0x2115('0x3a')]){_0x1262e7['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0x2115('0x3b')](_0x1262e7);})['then'](function(_0xa652de){_0x19c595['rows']=_0xa652de;return _0x19c595;})['then'](respondWithFilteredResult(_0x26eff7,_0x1262e7))['catch'](handleError(_0x26eff7,null));};exports[_0x2115('0x3c')]=function(_0x40d5d6,_0x11b840){var _0x96847d={'raw':!![],'where':{'id':_0x40d5d6['params']['id']}},_0x16f022={};_0x16f022[_0x2115('0x29')]=_['keys'](db[_0x2115('0x26')][_0x2115('0x27')]);_0x16f022['query']=_[_0x2115('0x3d')](_0x40d5d6[_0x2115('0x2a')]);_0x16f022['filters']=_['intersection'](_0x16f022[_0x2115('0x29')],_0x16f022[_0x2115('0x2a')]);_0x96847d['attributes']=_['intersection'](_0x16f022[_0x2115('0x29')],qs[_0x2115('0x2d')](_0x40d5d6['query']['fields']));_0x96847d[_0x2115('0x2f')]=_0x96847d[_0x2115('0x2f')][_0x2115('0x2e')]?_0x96847d['attributes']:_0x16f022[_0x2115('0x29')];if(_0x40d5d6['query'][_0x2115('0x3a')]){_0x96847d[_0x2115('0x3e')]=[{'all':!![]}];}_0x96847d=_[_0x2115('0x3f')]({},_0x96847d,_0x40d5d6[_0x2115('0x39')]);return db[_0x2115('0x26')]['find'](_0x96847d)[_0x2115('0x1f')](handleEntityNotFound(_0x11b840,null))['then'](respondWithResult(_0x11b840,null))['catch'](handleError(_0x11b840,null));};exports[_0x2115('0x40')]=function(_0xa67937,_0x583575){return db[_0x2115('0x26')][_0x2115('0x40')](_0xa67937[_0x2115('0x41')],{})[_0x2115('0x1f')](respondWithResult(_0x583575,0xc9))[_0x2115('0x42')](handleError(_0x583575,null));};exports[_0x2115('0x43')]=function(_0x41d1a4,_0x347f16){if(_0x41d1a4[_0x2115('0x41')]['id']){delete _0x41d1a4['body']['id'];}return db[_0x2115('0x26')][_0x2115('0x44')]({'where':{'id':_0x41d1a4[_0x2115('0x45')]['id']}})['then'](handleEntityNotFound(_0x347f16,null))[_0x2115('0x1f')](saveUpdates(_0x41d1a4['body'],null))['then'](respondWithResult(_0x347f16,null))['catch'](handleError(_0x347f16,null));};exports[_0x2115('0x20')]=function(_0x24d601,_0x4820c7){return db['FaxQueueReport'][_0x2115('0x44')]({'where':{'id':_0x24d601[_0x2115('0x45')]['id']}})[_0x2115('0x1f')](handleEntityNotFound(_0x4820c7,null))[_0x2115('0x1f')](removeEntity(_0x4820c7,null))[_0x2115('0x42')](handleError(_0x4820c7,null));};exports[_0x2115('0x46')]=function(_0x3b8586,_0x9539e2){return db['FaxQueueReport'][_0x2115('0x46')]()[_0x2115('0x1f')](respondWithResult(_0x9539e2,null))['catch'](handleError(_0x9539e2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 319bcb6..484d138 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x360d8e,_0x18e770){var _0x3ad3fa=function(_0x4023be){while(--_0x4023be){_0x360d8e['push'](_0x360d8e['shift']());}};_0x3ad3fa(++_0x18e770);}(_0x53ec,0x192));var _0xc53e=function(_0x2aae2d,_0x257260){_0x2aae2d=_0x2aae2d-0x0;var _0x420302=_0x53ec[_0x2aae2d];return _0x420302;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x3f441c,_0x43bf79){var _0x165313=function(_0x303dbb){while(--_0x303dbb){_0x3f441c['push'](_0x3f441c['shift']());}};_0x165313(++_0x43bf79);}(_0x5fab,0x177));var _0xb5fa=function(_0x2def85,_0x39b650){_0x2def85=_0x2def85-0x0;var _0x12ce04=_0x5fab[_0x2def85];return _0x12ce04;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['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 fa347e6..48a1cef 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 _0x952c=['error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a0643,_0x5270db){var _0x5718c7=function(_0xf68a5e){while(--_0xf68a5e){_0x2a0643['push'](_0x2a0643['shift']());}};_0x5718c7(++_0x5270db);}(_0x952c,0xfe));var _0xc952=function(_0x420f2a,_0x2cc58d){_0x420f2a=_0x420f2a-0x0;var _0x28f802=_0x952c[_0x420f2a];return _0x28f802;};'use strict';var _=require(_0xc952('0x0'));var util=require(_0xc952('0x1'));var moment=require(_0xc952('0x2'));var BPromise=require(_0xc952('0x3'));var rs=require(_0xc952('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc952('0x5'))['db'];var utils=require(_0xc952('0x6'));var logger=require(_0xc952('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc952('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26ce98,_0x4706f3,_0x52f386){return new BPromise(function(_0x4c3a53,_0xb5d96d){return client[_0xc952('0x9')](_0x26ce98,_0x52f386)[_0xc952('0xa')](function(_0x52dcc3){logger[_0xc952('0xb')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0xc952('0xc'));logger[_0xc952('0xd')](_0xc952('0xe'),_0x4706f3,_0xc952('0xc'),JSON[_0xc952('0xf')](_0x52dcc3));if(_0x52dcc3[_0xc952('0x10')]){if(_0x52dcc3[_0xc952('0x10')][_0xc952('0x11')]===0x1f4){logger['error'](_0xc952('0x12'),_0x4706f3,_0x52dcc3[_0xc952('0x10')][_0xc952('0x13')]);return _0xb5d96d(_0x52dcc3[_0xc952('0x10')]['message']);}logger[_0xc952('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0x52dcc3[_0xc952('0x10')]['message']);return _0x4c3a53(_0x52dcc3[_0xc952('0x10')][_0xc952('0x13')]);}else{logger['info'](_0xc952('0x12'),_0x4706f3,'request\x20sent');_0x4c3a53(_0x52dcc3[_0xc952('0x14')]['message']);}})[_0xc952('0x15')](function(_0xc87fc8){logger[_0xc952('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x4706f3,_0xc87fc8);_0xb5d96d(_0xc87fc8);});});}exports[_0xc952('0x16')]=function(_0x294a6c){var _0x29a5eb=this;return new Promise(function(_0x328f84,_0x343947){return db[_0xc952('0x17')]['create'](_0x294a6c['body'],{'raw':_0x294a6c[_0xc952('0x18')]?_0x294a6c['options'][_0xc952('0x19')]===undefined?!![]:![]:!![]})[_0xc952('0xa')](function(_0x36b2da){logger[_0xc952('0xb')](_0xc952('0x16'),_0x294a6c);logger['debug'](_0xc952('0x16'),_0x294a6c,JSON['stringify'](_0x36b2da));_0x328f84(_0x36b2da);})['catch'](function(_0x5e14f){logger[_0xc952('0x10')](_0xc952('0x16'),_0x5e14f[_0xc952('0x13')],_0x294a6c);_0x343947(_0x29a5eb[_0xc952('0x10')](0x1f4,_0x5e14f[_0xc952('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x32d37f){var _0x39ecc1=this;return new Promise(function(_0x48e35a,_0x2076a1){return db[_0xc952('0x17')]['update'](_0x32d37f['body'],{'raw':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32d37f['options']?_0x32d37f[_0xc952('0x18')][_0xc952('0x1a')]||null:null,'attributes':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x1b')]||null:null,'limit':_0x32d37f[_0xc952('0x18')]?_0x32d37f[_0xc952('0x18')][_0xc952('0x1c')]||null:null})[_0xc952('0xa')](function(_0xafd37d){logger['info'](_0xc952('0x1d'),_0x32d37f);logger[_0xc952('0xd')]('UpdateFaxQueueReport',_0x32d37f,JSON[_0xc952('0xf')](_0xafd37d));_0x48e35a(_0xafd37d);})[_0xc952('0x15')](function(_0x523b5f){logger[_0xc952('0x10')](_0xc952('0x1d'),_0x523b5f[_0xc952('0x13')],_0x32d37f);_0x2076a1(_0x39ecc1[_0xc952('0x10')](0x1f4,_0x523b5f[_0xc952('0x13')]));});});}; \ No newline at end of file +var _0x4457=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxQueueReport,\x20%s,\x20%s','result','catch','CreateFaxQueueReport','create','options','info','UpdateFaxQueueReport','FaxQueueReport','update','body','where','attributes','lodash'];(function(_0xb0bfd6,_0xc3164f){var _0x59e733=function(_0x5ee6a1){while(--_0x5ee6a1){_0xb0bfd6['push'](_0xb0bfd6['shift']());}};_0x59e733(++_0xc3164f);}(_0x4457,0xc5));var _0x7445=function(_0xc2f54d,_0x242f6f){_0xc2f54d=_0xc2f54d-0x0;var _0x85900c=_0x4457[_0xc2f54d];return _0x85900c;};'use strict';var _=require(_0x7445('0x0'));var util=require('util');var moment=require(_0x7445('0x1'));var BPromise=require(_0x7445('0x2'));var rs=require(_0x7445('0x3'));var fs=require('fs');var Redis=require(_0x7445('0x4'));var db=require(_0x7445('0x5'))['db'];var utils=require(_0x7445('0x6'));var logger=require(_0x7445('0x7'))(_0x7445('0x8'));var config=require(_0x7445('0x9'));var jayson=require(_0x7445('0xa'));var client=jayson[_0x7445('0xb')][_0x7445('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20f563,_0x382f77,_0xe39c11){return new BPromise(function(_0x8f0e85,_0x1c2a87){return client[_0x7445('0xd')](_0x20f563,_0xe39c11)['then'](function(_0x3c28b9){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x382f77,_0x7445('0xe'));logger[_0x7445('0xf')](_0x7445('0x10'),_0x382f77,_0x7445('0xe'),JSON['stringify'](_0x3c28b9));if(_0x3c28b9[_0x7445('0x11')]){if(_0x3c28b9[_0x7445('0x11')][_0x7445('0x12')]===0x1f4){logger[_0x7445('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x382f77,_0x3c28b9[_0x7445('0x11')]['message']);return _0x1c2a87(_0x3c28b9['error'][_0x7445('0x13')]);}logger['error'](_0x7445('0x14'),_0x382f77,_0x3c28b9['error'][_0x7445('0x13')]);return _0x8f0e85(_0x3c28b9[_0x7445('0x11')]['message']);}else{logger['info'](_0x7445('0x14'),_0x382f77,'request\x20sent');_0x8f0e85(_0x3c28b9[_0x7445('0x15')][_0x7445('0x13')]);}})[_0x7445('0x16')](function(_0x1d726e){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x382f77,_0x1d726e);_0x1c2a87(_0x1d726e);});});}exports[_0x7445('0x17')]=function(_0x1eba1c){var _0x45aaec=this;return new Promise(function(_0x50ca4b,_0x2e3193){return db['FaxQueueReport'][_0x7445('0x18')](_0x1eba1c['body'],{'raw':_0x1eba1c[_0x7445('0x19')]?_0x1eba1c[_0x7445('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a1674){logger[_0x7445('0x1a')](_0x7445('0x17'),_0x1eba1c);logger[_0x7445('0xf')]('CreateFaxQueueReport',_0x1eba1c,JSON['stringify'](_0x4a1674));_0x50ca4b(_0x4a1674);})[_0x7445('0x16')](function(_0x152f42){logger['error'](_0x7445('0x17'),_0x152f42['message'],_0x1eba1c);_0x2e3193(_0x45aaec[_0x7445('0x11')](0x1f4,_0x152f42[_0x7445('0x13')]));});});};exports[_0x7445('0x1b')]=function(_0xe8fdb1){var _0x52965c=this;return new Promise(function(_0x315089,_0x340a1b){return db[_0x7445('0x1c')][_0x7445('0x1d')](_0xe8fdb1[_0x7445('0x1e')],{'raw':_0xe8fdb1[_0x7445('0x19')]?_0xe8fdb1[_0x7445('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe8fdb1['options']?_0xe8fdb1[_0x7445('0x19')][_0x7445('0x1f')]||null:null,'attributes':_0xe8fdb1['options']?_0xe8fdb1[_0x7445('0x19')][_0x7445('0x20')]||null:null,'limit':_0xe8fdb1[_0x7445('0x19')]?_0xe8fdb1[_0x7445('0x19')]['limit']||null:null})['then'](function(_0x5b685d){logger[_0x7445('0x1a')]('UpdateFaxQueueReport',_0xe8fdb1);logger[_0x7445('0xf')]('UpdateFaxQueueReport',_0xe8fdb1,JSON['stringify'](_0x5b685d));_0x315089(_0x5b685d);})[_0x7445('0x16')](function(_0x348ea1){logger[_0x7445('0x11')](_0x7445('0x1b'),_0x348ea1[_0x7445('0x13')],_0xe8fdb1);_0x340a1b(_0x52965c[_0x7445('0x11')](0x1f4,_0x348ea1[_0x7445('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2ccf8cd..c12da74 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 _0x319b=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x4dec61,_0x387467){var _0x12cf79=function(_0x186ef4){while(--_0x186ef4){_0x4dec61['push'](_0x4dec61['shift']());}};_0x12cf79(++_0x387467);}(_0x319b,0xce));var _0xb319=function(_0x482149,_0x5645f9){_0x482149=_0x482149-0x0;var _0x120fd2=_0x319b[_0x482149];return _0x120fd2;};'use strict';var multer=require(_0xb319('0x0'));var util=require('util');var path=require(_0xb319('0x1'));var timeout=require(_0xb319('0x2'));var express=require(_0xb319('0x3'));var router=express[_0xb319('0x4')]();var fs_extra=require(_0xb319('0x5'));var auth=require(_0xb319('0x6'));var interaction=require(_0xb319('0x7'));var config=require(_0xb319('0x8'));var controller=require(_0xb319('0x9'));router[_0xb319('0xa')]('/',auth[_0xb319('0xb')](),controller[_0xb319('0xc')]);router['get'](_0xb319('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xb319('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb319('0xe')]);router[_0xb319('0xf')]('/',auth[_0xb319('0xb')](),controller[_0xb319('0x10')]);router[_0xb319('0x11')](_0xb319('0x12'),auth[_0xb319('0xb')](),controller[_0xb319('0x13')]);router[_0xb319('0x14')](_0xb319('0x12'),auth[_0xb319('0xb')](),controller[_0xb319('0x15')]);module[_0xb319('0x16')]=router; \ No newline at end of file +var _0x551a=['../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xe3dc82,_0x51412c){var _0xa81f3e=function(_0x324d64){while(--_0x324d64){_0xe3dc82['push'](_0xe3dc82['shift']());}};_0xa81f3e(++_0x51412c);}(_0x551a,0x110));var _0xa551=function(_0x2bd268,_0x3a9500){_0x2bd268=_0x2bd268-0x0;var _0xa21fae=_0x551a[_0x2bd268];return _0xa21fae;};'use strict';var multer=require(_0xa551('0x0'));var util=require(_0xa551('0x1'));var path=require(_0xa551('0x2'));var timeout=require(_0xa551('0x3'));var express=require(_0xa551('0x4'));var router=express['Router']();var fs_extra=require(_0xa551('0x5'));var auth=require(_0xa551('0x6'));var interaction=require(_0xa551('0x7'));var config=require(_0xa551('0x8'));var controller=require(_0xa551('0x9'));router[_0xa551('0xa')]('/',auth['isAuthenticated'](),controller[_0xa551('0xb')]);router[_0xa551('0xa')](_0xa551('0xc'),auth[_0xa551('0xd')](),controller[_0xa551('0xe')]);router[_0xa551('0xa')](_0xa551('0xf'),auth[_0xa551('0xd')](),controller['show']);router[_0xa551('0x10')]('/',auth[_0xa551('0xd')](),controller['create']);router[_0xa551('0x11')](_0xa551('0xf'),auth[_0xa551('0xd')](),controller[_0xa551('0x12')]);router['delete']('/:id',auth[_0xa551('0xd')](),controller[_0xa551('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 910c9af..d316ae8 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0x34e8,0x12c));var _0x834e=function(_0x17a17f,_0x14c6c8){_0x17a17f=_0x17a17f-0x0;var _0x41d3ee=_0x34e8[_0x17a17f];return _0x41d3ee;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x2d21cc,_0x27ef2a){var _0x7ab87e=function(_0xa7b1f0){while(--_0xa7b1f0){_0x2d21cc['push'](_0x2d21cc['shift']());}};_0x7ab87e(++_0x27ef2a);}(_0x54ef,0x112));var _0xf54e=function(_0x837988,_0x3639da){_0x837988=_0x837988-0x0;var _0x5b4999=_0x54ef[_0x837988];return _0x5b4999;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 81cc7f6..d95440e 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 _0x99ae=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','destroy','then','error','stack','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','VIRTUAL','name','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','describe','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x34c8ab,_0x3d5269){var _0x4b9470=function(_0x3301e8){while(--_0x3301e8){_0x34c8ab['push'](_0x34c8ab['shift']());}};_0x4b9470(++_0x3d5269);}(_0x99ae,0x15c));var _0xe99a=function(_0x2c2988,_0x2bac3e){_0x2c2988=_0x2c2988-0x0;var _0x328eb4=_0x99ae[_0x2c2988];return _0x328eb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe99a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe99a('0x1'));var rp=require(_0xe99a('0x2'));var moment=require('moment');var BPromise=require(_0xe99a('0x3'));var Mustache=require('mustache');var util=require(_0xe99a('0x4'));var path=require(_0xe99a('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe99a('0x6'));var fs=require('fs');var fs_extra=require(_0xe99a('0x7'));var _=require(_0xe99a('0x8'));var squel=require(_0xe99a('0x9'));var crypto=require('crypto');var jsforce=require(_0xe99a('0xa'));var deskjs=require(_0xe99a('0xb'));var toCsv=require(_0xe99a('0xc'));var querystring=require(_0xe99a('0xd'));var Papa=require(_0xe99a('0xe'));var Redis=require(_0xe99a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe99a('0x10'));var hardwareService=require(_0xe99a('0x11'));var logger=require(_0xe99a('0x12'))(_0xe99a('0x13'));var utils=require(_0xe99a('0x14'));var config=require(_0xe99a('0x15'));var licenseUtil=require(_0xe99a('0x16'));var db=require(_0xe99a('0x17'))['db'];function respondWithStatusCode(_0x6948,_0x1a8219){_0x1a8219=_0x1a8219||0xcc;return function(_0x5256f2){if(_0x5256f2){return _0x6948[_0xe99a('0x18')](_0x1a8219);}return _0x6948[_0xe99a('0x19')](_0x1a8219)[_0xe99a('0x1a')]();};}function respondWithResult(_0x4626b5,_0x53ae01){_0x53ae01=_0x53ae01||0xc8;return function(_0xbb6047){if(_0xbb6047){return _0x4626b5[_0xe99a('0x19')](_0x53ae01)[_0xe99a('0x1b')](_0xbb6047);}};}function respondWithFilteredResult(_0xc3bc63,_0x2b4bf5){return function(_0x132681){if(_0x132681){var _0xc9f817=typeof _0x2b4bf5['offset']==='undefined'&&typeof _0x2b4bf5[_0xe99a('0x1c')]===_0xe99a('0x1d');var _0x3ebf0b=_0x132681[_0xe99a('0x1e')];var _0x3ed264=_0xc9f817?0x0:_0x2b4bf5[_0xe99a('0x1f')];var _0x5e5c0f=_0xc9f817?_0x132681[_0xe99a('0x1e')]:_0x2b4bf5[_0xe99a('0x1f')]+_0x2b4bf5[_0xe99a('0x1c')];var _0x58292f;if(_0x5e5c0f>=_0x3ebf0b){_0x5e5c0f=_0x3ebf0b;_0x58292f=0xc8;}else{_0x58292f=0xce;}_0xc3bc63[_0xe99a('0x19')](_0x58292f);return _0xc3bc63['set'](_0xe99a('0x20'),_0x3ed264+'-'+_0x5e5c0f+'/'+_0x3ebf0b)[_0xe99a('0x1b')](_0x132681);}return null;};}function patchUpdates(_0x1d5ad4){return function(_0x439616){try{jsonpatch[_0xe99a('0x21')](_0x439616,_0x1d5ad4,!![]);}catch(_0x3217c5){return BPromise['reject'](_0x3217c5);}return _0x439616[_0xe99a('0x22')]();};}function saveUpdates(_0x489f2b,_0x52e273){return function(_0x5d3115){if(_0x5d3115){return _0x5d3115[_0xe99a('0x23')](_0x489f2b)['then'](function(_0x4d347c){return _0x4d347c;});}return null;};}function removeEntity(_0xbecd6a,_0x357f39){return function(_0x5743d0){if(_0x5743d0){return _0x5743d0[_0xe99a('0x24')]()[_0xe99a('0x25')](function(){_0xbecd6a[_0xe99a('0x19')](0xcc)[_0xe99a('0x1a')]();});}};}function handleEntityNotFound(_0xbc852f,_0x3a52de){return function(_0x134214){if(!_0x134214){_0xbc852f[_0xe99a('0x18')](0x194);}return _0x134214;};}function handleError(_0x14026a,_0x520549){_0x520549=_0x520549||0x1f4;return function(_0x187f19){logger[_0xe99a('0x26')](_0x187f19[_0xe99a('0x27')]);if(_0x187f19['name']){delete _0x187f19['name'];}_0x14026a[_0xe99a('0x19')](_0x520549)['send'](_0x187f19);};}exports[_0xe99a('0x28')]=function(_0x4ad359,_0x4b33f8){var _0x19a645={},_0x51ec41={},_0x33b253={'count':0x0,'rows':[]};var _0x403083=_['map'](db[_0xe99a('0x29')][_0xe99a('0x2a')],function(_0x35d80d){return{'name':_0x35d80d[_0xe99a('0x2b')],'type':_0x35d80d[_0xe99a('0x2c')][_0xe99a('0x2d')]};});_0x51ec41[_0xe99a('0x2e')]=_[_0xe99a('0x2f')](_0x403083,'name');_0x51ec41[_0xe99a('0x30')]=_[_0xe99a('0x31')](_0x4ad359['query']);_0x51ec41[_0xe99a('0x32')]=_[_0xe99a('0x33')](_0x51ec41[_0xe99a('0x2e')],_0x51ec41[_0xe99a('0x30')]);_0x19a645[_0xe99a('0x34')]=_[_0xe99a('0x33')](_0x51ec41['model'],qs[_0xe99a('0x35')](_0x4ad359[_0xe99a('0x30')]['fields']));_0x19a645[_0xe99a('0x34')]=_0x19a645['attributes']['length']?_0x19a645[_0xe99a('0x34')]:_0x51ec41[_0xe99a('0x2e')];if(!_0x4ad359[_0xe99a('0x30')][_0xe99a('0x36')](_0xe99a('0x37'))){_0x19a645[_0xe99a('0x1c')]=qs[_0xe99a('0x1c')](_0x4ad359[_0xe99a('0x30')][_0xe99a('0x1c')]);_0x19a645[_0xe99a('0x1f')]=qs['offset'](_0x4ad359[_0xe99a('0x30')][_0xe99a('0x1f')]);}_0x19a645['order']=qs[_0xe99a('0x38')](_0x4ad359['query']['sort']);_0x19a645[_0xe99a('0x39')]=qs[_0xe99a('0x32')](_['pick'](_0x4ad359['query'],_0x51ec41[_0xe99a('0x32')]),_0x403083);if(_0x4ad359[_0xe99a('0x30')]['filter']){_0x19a645[_0xe99a('0x39')]=_['merge'](_0x19a645[_0xe99a('0x39')],{'$or':_[_0xe99a('0x2f')](_0x403083,function(_0x21fadd){if(_0x21fadd[_0xe99a('0x2c')]!==_0xe99a('0x3a')){var _0x40cb12={};_0x40cb12[_0x21fadd[_0xe99a('0x3b')]]={'$like':'%'+_0x4ad359[_0xe99a('0x30')][_0xe99a('0x3c')]+'%'};return _0x40cb12;}})});}_0x19a645=_[_0xe99a('0x3d')]({},_0x19a645,_0x4ad359[_0xe99a('0x3e')]);var _0x4ca23b={'where':_0x19a645['where']};return db[_0xe99a('0x29')][_0xe99a('0x1e')](_0x4ca23b)[_0xe99a('0x25')](function(_0x2de0e9){_0x33b253['count']=_0x2de0e9;if(_0x4ad359[_0xe99a('0x30')][_0xe99a('0x3f')]){_0x19a645[_0xe99a('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xe99a('0x41')](_0x19a645);})[_0xe99a('0x25')](function(_0x22b6a0){_0x33b253[_0xe99a('0x42')]=_0x22b6a0;return _0x33b253;})[_0xe99a('0x25')](respondWithFilteredResult(_0x4b33f8,_0x19a645))[_0xe99a('0x43')](handleError(_0x4b33f8,null));};exports['show']=function(_0x19587f,_0x4ce7ba){var _0x145715={'raw':!![],'where':{'id':_0x19587f[_0xe99a('0x44')]['id']}},_0x3cec06={};_0x3cec06[_0xe99a('0x2e')]=_[_0xe99a('0x31')](db[_0xe99a('0x29')][_0xe99a('0x2a')]);_0x3cec06[_0xe99a('0x30')]=_['keys'](_0x19587f[_0xe99a('0x30')]);_0x3cec06['filters']=_['intersection'](_0x3cec06['model'],_0x3cec06[_0xe99a('0x30')]);_0x145715[_0xe99a('0x34')]=_['intersection'](_0x3cec06[_0xe99a('0x2e')],qs['fields'](_0x19587f[_0xe99a('0x30')][_0xe99a('0x35')]));_0x145715[_0xe99a('0x34')]=_0x145715[_0xe99a('0x34')][_0xe99a('0x45')]?_0x145715[_0xe99a('0x34')]:_0x3cec06[_0xe99a('0x2e')];if(_0x19587f[_0xe99a('0x30')][_0xe99a('0x3f')]){_0x145715[_0xe99a('0x40')]=[{'all':!![]}];}_0x145715=_[_0xe99a('0x3d')]({},_0x145715,_0x19587f[_0xe99a('0x3e')]);return db[_0xe99a('0x29')]['find'](_0x145715)[_0xe99a('0x25')](handleEntityNotFound(_0x4ce7ba,null))[_0xe99a('0x25')](respondWithResult(_0x4ce7ba,null))[_0xe99a('0x43')](handleError(_0x4ce7ba,null));};exports[_0xe99a('0x46')]=function(_0x5326f0,_0x5e27c6){return db[_0xe99a('0x29')][_0xe99a('0x46')](_0x5326f0[_0xe99a('0x47')],{})[_0xe99a('0x25')](respondWithResult(_0x5e27c6,0xc9))[_0xe99a('0x43')](handleError(_0x5e27c6,null));};exports[_0xe99a('0x23')]=function(_0xb1c83d,_0x2ebd0d){if(_0xb1c83d[_0xe99a('0x47')]['id']){delete _0xb1c83d[_0xe99a('0x47')]['id'];}return db[_0xe99a('0x29')][_0xe99a('0x48')]({'where':{'id':_0xb1c83d[_0xe99a('0x44')]['id']}})[_0xe99a('0x25')](handleEntityNotFound(_0x2ebd0d,null))['then'](saveUpdates(_0xb1c83d[_0xe99a('0x47')],null))[_0xe99a('0x25')](respondWithResult(_0x2ebd0d,null))['catch'](handleError(_0x2ebd0d,null));};exports[_0xe99a('0x24')]=function(_0x3c030e,_0x5c65a5){return db[_0xe99a('0x29')][_0xe99a('0x48')]({'where':{'id':_0x3c030e[_0xe99a('0x44')]['id']}})[_0xe99a('0x25')](handleEntityNotFound(_0x5c65a5,null))[_0xe99a('0x25')](removeEntity(_0x5c65a5,null))[_0xe99a('0x43')](handleError(_0x5c65a5,null));};exports[_0xe99a('0x49')]=function(_0x350de1,_0xfc86ba){return db[_0xe99a('0x29')]['describe']()[_0xe99a('0x25')](respondWithResult(_0xfc86ba,null))[_0xe99a('0x43')](handleError(_0xfc86ba,null));}; \ No newline at end of file +var _0x2ed1=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','rows','catch','show','params','keys','length','FaxTransferReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0xd45224,_0x112a37){var _0x35f162=function(_0x52f0d8){while(--_0x52f0d8){_0xd45224['push'](_0xd45224['shift']());}};_0x35f162(++_0x112a37);}(_0x2ed1,0x100));var _0x12ed=function(_0x117cdf,_0x5360f2){_0x117cdf=_0x117cdf-0x0;var _0x1a3ef4=_0x2ed1[_0x117cdf];return _0x1a3ef4;};'use strict';var emlformat=require(_0x12ed('0x0'));var rimraf=require(_0x12ed('0x1'));var zipdir=require(_0x12ed('0x2'));var jsonpatch=require(_0x12ed('0x3'));var rp=require(_0x12ed('0x4'));var moment=require('moment');var BPromise=require(_0x12ed('0x5'));var Mustache=require(_0x12ed('0x6'));var util=require(_0x12ed('0x7'));var path=require(_0x12ed('0x8'));var sox=require(_0x12ed('0x9'));var csv=require(_0x12ed('0xa'));var ejs=require(_0x12ed('0xb'));var fs=require('fs');var fs_extra=require(_0x12ed('0xc'));var _=require(_0x12ed('0xd'));var squel=require(_0x12ed('0xe'));var crypto=require(_0x12ed('0xf'));var jsforce=require(_0x12ed('0x10'));var deskjs=require(_0x12ed('0x11'));var toCsv=require(_0x12ed('0xa'));var querystring=require(_0x12ed('0x12'));var Papa=require(_0x12ed('0x13'));var Redis=require(_0x12ed('0x14'));var authService=require(_0x12ed('0x15'));var qs=require(_0x12ed('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ed('0x17'));var logger=require(_0x12ed('0x18'))(_0x12ed('0x19'));var utils=require(_0x12ed('0x1a'));var config=require(_0x12ed('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x12ed('0x1c'))['db'];function respondWithStatusCode(_0x336253,_0x796849){_0x796849=_0x796849||0xcc;return function(_0x56b919){if(_0x56b919){return _0x336253['sendStatus'](_0x796849);}return _0x336253[_0x12ed('0x1d')](_0x796849)['end']();};}function respondWithResult(_0x782e0f,_0x4a63c6){_0x4a63c6=_0x4a63c6||0xc8;return function(_0x2037ce){if(_0x2037ce){return _0x782e0f['status'](_0x4a63c6)['json'](_0x2037ce);}};}function respondWithFilteredResult(_0x42c65b,_0x29c9cd){return function(_0xc8bbb8){if(_0xc8bbb8){var _0x3e6511=typeof _0x29c9cd['offset']===_0x12ed('0x1e')&&typeof _0x29c9cd[_0x12ed('0x1f')]===_0x12ed('0x1e');var _0x1b2f04=_0xc8bbb8['count'];var _0x27999f=_0x3e6511?0x0:_0x29c9cd[_0x12ed('0x20')];var _0xba3d61=_0x3e6511?_0xc8bbb8[_0x12ed('0x21')]:_0x29c9cd[_0x12ed('0x20')]+_0x29c9cd[_0x12ed('0x1f')];var _0x2862f3;if(_0xba3d61>=_0x1b2f04){_0xba3d61=_0x1b2f04;_0x2862f3=0xc8;}else{_0x2862f3=0xce;}_0x42c65b[_0x12ed('0x1d')](_0x2862f3);return _0x42c65b[_0x12ed('0x22')](_0x12ed('0x23'),_0x27999f+'-'+_0xba3d61+'/'+_0x1b2f04)['json'](_0xc8bbb8);}return null;};}function patchUpdates(_0x359333){return function(_0x9225ed){try{jsonpatch[_0x12ed('0x24')](_0x9225ed,_0x359333,!![]);}catch(_0x43190c){return BPromise[_0x12ed('0x25')](_0x43190c);}return _0x9225ed['save']();};}function saveUpdates(_0x3f92f6,_0x544ea0){return function(_0x45c8df){if(_0x45c8df){return _0x45c8df[_0x12ed('0x26')](_0x3f92f6)['then'](function(_0x59b1b4){return _0x59b1b4;});}return null;};}function removeEntity(_0x4d3c96,_0x420440){return function(_0x4fbbf4){if(_0x4fbbf4){return _0x4fbbf4[_0x12ed('0x27')]()['then'](function(){_0x4d3c96['status'](0xcc)[_0x12ed('0x28')]();});}};}function handleEntityNotFound(_0x2618cd,_0x419055){return function(_0x50ca9a){if(!_0x50ca9a){_0x2618cd['sendStatus'](0x194);}return _0x50ca9a;};}function handleError(_0xc27f15,_0x5de74d){_0x5de74d=_0x5de74d||0x1f4;return function(_0x2eaea5){logger[_0x12ed('0x29')](_0x2eaea5[_0x12ed('0x2a')]);if(_0x2eaea5['name']){delete _0x2eaea5[_0x12ed('0x2b')];}_0xc27f15[_0x12ed('0x1d')](_0x5de74d)['send'](_0x2eaea5);};}exports[_0x12ed('0x2c')]=function(_0x5a677a,_0x40fc83){var _0x5979b3={},_0x247233={},_0x5ad204={'count':0x0,'rows':[]};var _0x4f840a=_['map'](db['FaxTransferReport'][_0x12ed('0x2d')],function(_0x3d99df){return{'name':_0x3d99df[_0x12ed('0x2e')],'type':_0x3d99df[_0x12ed('0x2f')]['key']};});_0x247233[_0x12ed('0x30')]=_[_0x12ed('0x31')](_0x4f840a,_0x12ed('0x2b'));_0x247233[_0x12ed('0x32')]=_['keys'](_0x5a677a[_0x12ed('0x32')]);_0x247233[_0x12ed('0x33')]=_[_0x12ed('0x34')](_0x247233[_0x12ed('0x30')],_0x247233[_0x12ed('0x32')]);_0x5979b3[_0x12ed('0x35')]=_[_0x12ed('0x34')](_0x247233[_0x12ed('0x30')],qs[_0x12ed('0x36')](_0x5a677a[_0x12ed('0x32')][_0x12ed('0x36')]));_0x5979b3[_0x12ed('0x35')]=_0x5979b3[_0x12ed('0x35')]['length']?_0x5979b3[_0x12ed('0x35')]:_0x247233[_0x12ed('0x30')];if(!_0x5a677a[_0x12ed('0x32')][_0x12ed('0x37')](_0x12ed('0x38'))){_0x5979b3[_0x12ed('0x1f')]=qs[_0x12ed('0x1f')](_0x5a677a[_0x12ed('0x32')][_0x12ed('0x1f')]);_0x5979b3[_0x12ed('0x20')]=qs[_0x12ed('0x20')](_0x5a677a[_0x12ed('0x32')][_0x12ed('0x20')]);}_0x5979b3[_0x12ed('0x39')]=qs[_0x12ed('0x3a')](_0x5a677a[_0x12ed('0x32')][_0x12ed('0x3a')]);_0x5979b3['where']=qs['filters'](_[_0x12ed('0x3b')](_0x5a677a[_0x12ed('0x32')],_0x247233[_0x12ed('0x33')]),_0x4f840a);if(_0x5a677a[_0x12ed('0x32')][_0x12ed('0x3c')]){_0x5979b3[_0x12ed('0x3d')]=_[_0x12ed('0x3e')](_0x5979b3[_0x12ed('0x3d')],{'$or':_[_0x12ed('0x31')](_0x4f840a,function(_0x33e830){if(_0x33e830['type']!==_0x12ed('0x3f')){var _0x2d8073={};_0x2d8073[_0x33e830['name']]={'$like':'%'+_0x5a677a['query'][_0x12ed('0x3c')]+'%'};return _0x2d8073;}})});}_0x5979b3=_[_0x12ed('0x3e')]({},_0x5979b3,_0x5a677a[_0x12ed('0x40')]);var _0x5e5076={'where':_0x5979b3[_0x12ed('0x3d')]};return db['FaxTransferReport']['count'](_0x5e5076)[_0x12ed('0x41')](function(_0x1bbc16){_0x5ad204[_0x12ed('0x21')]=_0x1bbc16;if(_0x5a677a[_0x12ed('0x32')][_0x12ed('0x42')]){_0x5979b3['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x5979b3);})[_0x12ed('0x41')](function(_0x400538){_0x5ad204[_0x12ed('0x43')]=_0x400538;return _0x5ad204;})[_0x12ed('0x41')](respondWithFilteredResult(_0x40fc83,_0x5979b3))[_0x12ed('0x44')](handleError(_0x40fc83,null));};exports[_0x12ed('0x45')]=function(_0x1686c7,_0x4d5788){var _0x222b09={'raw':!![],'where':{'id':_0x1686c7[_0x12ed('0x46')]['id']}},_0x42eee5={};_0x42eee5[_0x12ed('0x30')]=_[_0x12ed('0x47')](db['FaxTransferReport'][_0x12ed('0x2d')]);_0x42eee5[_0x12ed('0x32')]=_[_0x12ed('0x47')](_0x1686c7[_0x12ed('0x32')]);_0x42eee5['filters']=_[_0x12ed('0x34')](_0x42eee5[_0x12ed('0x30')],_0x42eee5[_0x12ed('0x32')]);_0x222b09[_0x12ed('0x35')]=_[_0x12ed('0x34')](_0x42eee5[_0x12ed('0x30')],qs[_0x12ed('0x36')](_0x1686c7[_0x12ed('0x32')][_0x12ed('0x36')]));_0x222b09[_0x12ed('0x35')]=_0x222b09[_0x12ed('0x35')][_0x12ed('0x48')]?_0x222b09[_0x12ed('0x35')]:_0x42eee5[_0x12ed('0x30')];if(_0x1686c7[_0x12ed('0x32')]['includeAll']){_0x222b09['include']=[{'all':!![]}];}_0x222b09=_[_0x12ed('0x3e')]({},_0x222b09,_0x1686c7[_0x12ed('0x40')]);return db[_0x12ed('0x49')][_0x12ed('0x4a')](_0x222b09)['then'](handleEntityNotFound(_0x4d5788,null))[_0x12ed('0x41')](respondWithResult(_0x4d5788,null))[_0x12ed('0x44')](handleError(_0x4d5788,null));};exports[_0x12ed('0x4b')]=function(_0x4b2a2b,_0x248e12){return db[_0x12ed('0x49')][_0x12ed('0x4b')](_0x4b2a2b[_0x12ed('0x4c')],{})[_0x12ed('0x41')](respondWithResult(_0x248e12,0xc9))[_0x12ed('0x44')](handleError(_0x248e12,null));};exports[_0x12ed('0x26')]=function(_0x4c6cd2,_0x3752e1){if(_0x4c6cd2['body']['id']){delete _0x4c6cd2[_0x12ed('0x4c')]['id'];}return db[_0x12ed('0x49')]['find']({'where':{'id':_0x4c6cd2[_0x12ed('0x46')]['id']}})[_0x12ed('0x41')](handleEntityNotFound(_0x3752e1,null))[_0x12ed('0x41')](saveUpdates(_0x4c6cd2['body'],null))[_0x12ed('0x41')](respondWithResult(_0x3752e1,null))['catch'](handleError(_0x3752e1,null));};exports[_0x12ed('0x27')]=function(_0x155237,_0x29e290){return db['FaxTransferReport'][_0x12ed('0x4a')]({'where':{'id':_0x155237[_0x12ed('0x46')]['id']}})[_0x12ed('0x41')](handleEntityNotFound(_0x29e290,null))['then'](removeEntity(_0x29e290,null))[_0x12ed('0x44')](handleError(_0x29e290,null));};exports['describe']=function(_0x4904a9,_0x1831ef){return db['FaxTransferReport'][_0x12ed('0x4d')]()[_0x12ed('0x41')](respondWithResult(_0x1831ef,null))['catch'](handleError(_0x1831ef,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index b004d0b..306cb41 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 _0xc357=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x538c70,_0x35531f){var _0x42ae01=function(_0x5c7368){while(--_0x5c7368){_0x538c70['push'](_0x538c70['shift']());}};_0x42ae01(++_0x35531f);}(_0xc357,0x8b));var _0x7c35=function(_0x1fec74,_0x111e2b){_0x1fec74=_0x1fec74-0x0;var _0x54bf57=_0xc357[_0x1fec74];return _0x54bf57;};'use strict';var _=require('lodash');var util=require(_0x7c35('0x0'));var logger=require(_0x7c35('0x1'))(_0x7c35('0x2'));var moment=require('moment');var BPromise=require(_0x7c35('0x3'));var rp=require(_0x7c35('0x4'));var fs=require('fs');var path=require(_0x7c35('0x5'));var rimraf=require(_0x7c35('0x6'));var config=require(_0x7c35('0x7'));var attributes=require(_0x7c35('0x8'));module['exports']=function(_0x2b1f35,_0x146120){return _0x2b1f35[_0x7c35('0x9')](_0x7c35('0xa'),attributes,{'tableName':_0x7c35('0xb'),'paranoid':![],'indexes':[{'name':_0x7c35('0xc'),'fields':[_0x7c35('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e9a=['path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x5e9a,0x72));var _0xa5e9=function(_0x426df2,_0x1df2dd){_0x426df2=_0x426df2-0x0;var _0x5ab5bd=_0x5e9a[_0x426df2];return _0x5ab5bd;};'use strict';var _=require('lodash');var util=require(_0xa5e9('0x0'));var logger=require(_0xa5e9('0x1'))(_0xa5e9('0x2'));var moment=require(_0xa5e9('0x3'));var BPromise=require(_0xa5e9('0x4'));var rp=require(_0xa5e9('0x5'));var fs=require('fs');var path=require(_0xa5e9('0x6'));var rimraf=require(_0xa5e9('0x7'));var config=require(_0xa5e9('0x8'));var attributes=require(_0xa5e9('0x9'));module[_0xa5e9('0xa')]=function(_0x2e8d81,_0x29ae50){return _0x2e8d81[_0xa5e9('0xb')](_0xa5e9('0xc'),attributes,{'tableName':_0xa5e9('0xd'),'paranoid':![],'indexes':[{'name':_0xa5e9('0xe'),'fields':[_0xa5e9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 2e1d0c6..3af08b1 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 _0x56ae=['error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56ae,0x88));var _0xe56a=function(_0x19b6a7,_0x45b396){_0x19b6a7=_0x19b6a7-0x0;var _0x26603e=_0x56ae[_0x19b6a7];return _0x26603e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe56a('0x0'));var rs=require(_0xe56a('0x1'));var fs=require('fs');var Redis=require(_0xe56a('0x2'));var db=require(_0xe56a('0x3'))['db'];var utils=require(_0xe56a('0x4'));var logger=require(_0xe56a('0x5'))(_0xe56a('0x6'));var config=require(_0xe56a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe56a('0x8')][_0xe56a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x205d8b,_0x1c7d3c,_0x511a0e){return new BPromise(function(_0x3d8181,_0x59b74f){return client[_0xe56a('0xa')](_0x205d8b,_0x511a0e)[_0xe56a('0xb')](function(_0x4438f4){logger[_0xe56a('0xc')](_0xe56a('0xd'),_0x1c7d3c,'request\x20sent');logger[_0xe56a('0xe')](_0xe56a('0xf'),_0x1c7d3c,_0xe56a('0x10'),JSON[_0xe56a('0x11')](_0x4438f4));if(_0x4438f4[_0xe56a('0x12')]){if(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x13')]===0x1f4){logger['error'](_0xe56a('0xd'),_0x1c7d3c,_0x4438f4[_0xe56a('0x12')]['message']);return _0x59b74f(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x14')]);}logger[_0xe56a('0x12')](_0xe56a('0xd'),_0x1c7d3c,_0x4438f4['error'][_0xe56a('0x14')]);return _0x3d8181(_0x4438f4[_0xe56a('0x12')][_0xe56a('0x14')]);}else{logger[_0xe56a('0xc')](_0xe56a('0xd'),_0x1c7d3c,'request\x20sent');_0x3d8181(_0x4438f4[_0xe56a('0x15')]['message']);}})['catch'](function(_0xf7c66f){logger[_0xe56a('0x12')](_0xe56a('0xd'),_0x1c7d3c,_0xf7c66f);_0x59b74f(_0xf7c66f);});});} \ No newline at end of file +var _0x7ab5=['../../config/environment','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x83ee0a,_0x44947d){var _0x5dc29f=function(_0x3e1433){while(--_0x3e1433){_0x83ee0a['push'](_0x83ee0a['shift']());}};_0x5dc29f(++_0x44947d);}(_0x7ab5,0xea));var _0x57ab=function(_0x219172,_0x1a6385){_0x219172=_0x219172-0x0;var _0x4f8f38=_0x7ab5[_0x219172];return _0x4f8f38;};'use strict';var _=require('lodash');var util=require(_0x57ab('0x0'));var moment=require(_0x57ab('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57ab('0x2'))['db'];var utils=require(_0x57ab('0x3'));var logger=require(_0x57ab('0x4'))(_0x57ab('0x5'));var config=require(_0x57ab('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x57ab('0x7')][_0x57ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ca78a,_0x213b8b,_0x485969){return new BPromise(function(_0x4e4d11,_0x4ef6d8){return client[_0x57ab('0x9')](_0x3ca78a,_0x485969)[_0x57ab('0xa')](function(_0x16274f){logger[_0x57ab('0xb')](_0x57ab('0xc'),_0x213b8b,'request\x20sent');logger[_0x57ab('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x213b8b,_0x57ab('0xe'),JSON[_0x57ab('0xf')](_0x16274f));if(_0x16274f[_0x57ab('0x10')]){if(_0x16274f['error']['code']===0x1f4){logger[_0x57ab('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x213b8b,_0x16274f[_0x57ab('0x10')][_0x57ab('0x11')]);return _0x4ef6d8(_0x16274f[_0x57ab('0x10')][_0x57ab('0x11')]);}logger[_0x57ab('0x10')](_0x57ab('0xc'),_0x213b8b,_0x16274f['error'][_0x57ab('0x11')]);return _0x4e4d11(_0x16274f[_0x57ab('0x10')][_0x57ab('0x11')]);}else{logger[_0x57ab('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x213b8b,_0x57ab('0xe'));_0x4e4d11(_0x16274f[_0x57ab('0x12')]['message']);}})[_0x57ab('0x13')](function(_0x5f463f){logger[_0x57ab('0x10')](_0x57ab('0xc'),_0x213b8b,_0x5f463f);_0x4ef6d8(_0x5f463f);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 8b09e8b..b7565b6 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 _0x6f1a=['./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x541974,_0x20b88f){var _0x1c269b=function(_0x285306){while(--_0x285306){_0x541974['push'](_0x541974['shift']());}};_0x1c269b(++_0x20b88f);}(_0x6f1a,0x98));var _0xa6f1=function(_0x111ce3,_0x5e12aa){_0x111ce3=_0x111ce3-0x0;var _0xd0c223=_0x6f1a[_0x111ce3];return _0xd0c223;};'use strict';var multer=require(_0xa6f1('0x0'));var util=require('util');var path=require(_0xa6f1('0x1'));var timeout=require(_0xa6f1('0x2'));var express=require(_0xa6f1('0x3'));var router=express[_0xa6f1('0x4')]();var fs_extra=require(_0xa6f1('0x5'));var auth=require(_0xa6f1('0x6'));var interaction=require(_0xa6f1('0x7'));var config=require(_0xa6f1('0x8'));var controller=require(_0xa6f1('0x9'));router[_0xa6f1('0xa')]('/',auth[_0xa6f1('0xb')](),controller[_0xa6f1('0xc')]);router[_0xa6f1('0xa')](_0xa6f1('0xd'),auth['isAuthenticated'](),controller[_0xa6f1('0xe')]);router['get'](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x10')]);router[_0xa6f1('0x11')]('/',auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x12')]);router[_0xa6f1('0x13')](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x14')]);router[_0xa6f1('0x15')](_0xa6f1('0xf'),auth[_0xa6f1('0xb')](),controller[_0xa6f1('0x16')]);module['exports']=router; \ No newline at end of file +var _0xad2f=['multer','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','put','delete','/:id','destroy','exports'];(function(_0x531ea5,_0x3b4ad9){var _0x1f0228=function(_0x35d990){while(--_0x35d990){_0x531ea5['push'](_0x531ea5['shift']());}};_0x1f0228(++_0x3b4ad9);}(_0xad2f,0x132));var _0xfad2=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xad2f[_0x334841];return _0x5beb4b;};'use strict';var multer=require(_0xfad2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfad2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfad2('0x2'));var auth=require(_0xfad2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfad2('0x4'));var controller=require(_0xfad2('0x5'));router[_0xfad2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfad2('0x6')](_0xfad2('0x7'),auth[_0xfad2('0x8')](),controller[_0xfad2('0x9')]);router[_0xfad2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xfad2('0xa')]);router[_0xfad2('0xb')]('/',auth[_0xfad2('0x8')](),controller['create']);router[_0xfad2('0xc')]('/:id',auth[_0xfad2('0x8')](),controller['update']);router[_0xfad2('0xd')](_0xfad2('0xe'),auth[_0xfad2('0x8')](),controller[_0xfad2('0xf')]);module[_0xfad2('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c617acd..01cbcf5 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 _0xcd88=['put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x588267,_0x270ffc){var _0x546b0d=function(_0x2127e1){while(--_0x2127e1){_0x588267['push'](_0x588267['shift']());}};_0x546b0d(++_0x270ffc);}(_0xcd88,0x16c));var _0x8cd8=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xcd88[_0x16db8b];return _0x5ba017;};'use strict';var multer=require(_0x8cd8('0x0'));var util=require(_0x8cd8('0x1'));var path=require('path');var timeout=require(_0x8cd8('0x2'));var express=require(_0x8cd8('0x3'));var router=express[_0x8cd8('0x4')]();var fs_extra=require(_0x8cd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8cd8('0x6'));var config=require(_0x8cd8('0x7'));var controller=require(_0x8cd8('0x8'));router[_0x8cd8('0x9')]('/',auth[_0x8cd8('0xa')](),controller['index']);router[_0x8cd8('0x9')](_0x8cd8('0xb'),auth['isAuthenticated'](),controller[_0x8cd8('0xc')]);router[_0x8cd8('0x9')](_0x8cd8('0xd'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0xe')]);router[_0x8cd8('0x9')](_0x8cd8('0xf'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x10')]);router[_0x8cd8('0x11')]('/',auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x12')]);router[_0x8cd8('0x11')](_0x8cd8('0xd'),auth[_0x8cd8('0xa')](),controller[_0x8cd8('0x13')]);router[_0x8cd8('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8cd8('0x15')]);router[_0x8cd8('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8cd8('0x17')]=router; \ No newline at end of file +var _0x592d=['delete','destroy','express','Router','fs-extra','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','put','/:id','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x592d,0x1cd));var _0xd592=function(_0x54861d,_0x2325db){_0x54861d=_0x54861d-0x0;var _0x3d0afd=_0x592d[_0x54861d];return _0x3d0afd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd592('0x0'));var router=express[_0xd592('0x1')]();var fs_extra=require(_0xd592('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd592('0x3'));var controller=require(_0xd592('0x4'));router[_0xd592('0x5')]('/',auth[_0xd592('0x6')](),controller[_0xd592('0x7')]);router[_0xd592('0x5')]('/:id',auth[_0xd592('0x6')](),controller[_0xd592('0x8')]);router['get'](_0xd592('0x9'),auth[_0xd592('0x6')](),controller['getConfigurations']);router[_0xd592('0x5')](_0xd592('0xa'),auth[_0xd592('0x6')](),controller[_0xd592('0xb')]);router['post']('/',auth[_0xd592('0x6')](),controller['create']);router['post'](_0xd592('0x9'),auth[_0xd592('0x6')](),controller['addConfiguration']);router[_0xd592('0xc')](_0xd592('0xd'),auth['isAuthenticated'](),controller[_0xd592('0xe')]);router[_0xd592('0xf')](_0xd592('0xd'),auth[_0xd592('0x6')](),controller[_0xd592('0x10')]);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 4a3f18f..f734661 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 _0x762a=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x4dbb11,_0x322354){var _0x1d7e84=function(_0x493d16){while(--_0x493d16){_0x4dbb11['push'](_0x4dbb11['shift']());}};_0x1d7e84(++_0x322354);}(_0x762a,0xd4));var _0xa762=function(_0x369d7a,_0xb33fd9){_0x369d7a=_0x369d7a-0x0;var _0x189cc3=_0x762a[_0x369d7a];return _0x189cc3;};'use strict';var Sequelize=require(_0xa762('0x0'));module[_0xa762('0x1')]={'name':{'type':Sequelize[_0xa762('0x2')]},'description':{'type':Sequelize[_0xa762('0x2')]},'username':{'type':Sequelize[_0xa762('0x2')]},'remoteUri':{'type':Sequelize[_0xa762('0x2')]},'authType':{'type':Sequelize[_0xa762('0x3')](_0xa762('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xa762('0x2')]},'consumerKey':{'type':Sequelize[_0xa762('0x2')]},'consumerSecret':{'type':Sequelize[_0xa762('0x2')]},'token':{'type':Sequelize[_0xa762('0x2')]},'tokenSecret':{'type':Sequelize[_0xa762('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa762('0x3')](_0xa762('0x5'),_0xa762('0x6')),'defaultValue':_0xa762('0x5')}}; \ No newline at end of file +var _0x17bf=['ENUM','basic','integrationTab','sequelize','exports','STRING'];(function(_0x5e0f88,_0x524f02){var _0x211f1b=function(_0x421ce0){while(--_0x421ce0){_0x5e0f88['push'](_0x5e0f88['shift']());}};_0x211f1b(++_0x524f02);}(_0x17bf,0x13b));var _0xf17b=function(_0x28195f,_0x51a295){_0x28195f=_0x28195f-0x0;var _0x546ae1=_0x17bf[_0x28195f];return _0x546ae1;};'use strict';var Sequelize=require(_0xf17b('0x0'));module[_0xf17b('0x1')]={'name':{'type':Sequelize[_0xf17b('0x2')]},'description':{'type':Sequelize[_0xf17b('0x2')]},'username':{'type':Sequelize[_0xf17b('0x2')]},'remoteUri':{'type':Sequelize[_0xf17b('0x2')]},'authType':{'type':Sequelize[_0xf17b('0x3')](_0xf17b('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xf17b('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xf17b('0x2')]},'tokenSecret':{'type':Sequelize[_0xf17b('0x2')]},'serverUrl':{'type':Sequelize[_0xf17b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf17b('0x3')](_0xf17b('0x5'),'newTab'),'defaultValue':_0xf17b('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b21f070..49b3a4c 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 _0x1c71=['Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','params','length','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test'];(function(_0x43c7cd,_0x2a81d4){var _0x215814=function(_0x261a14){while(--_0x261a14){_0x43c7cd['push'](_0x43c7cd['shift']());}};_0x215814(++_0x2a81d4);}(_0x1c71,0xe6));var _0x11c7=function(_0x5c22f8,_0x211987){_0x5c22f8=_0x5c22f8-0x0;var _0x1b0833=_0x1c71[_0x5c22f8];return _0x1b0833;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11c7('0x0'));var jsonpatch=require(_0x11c7('0x1'));var rp=require(_0x11c7('0x2'));var moment=require(_0x11c7('0x3'));var BPromise=require(_0x11c7('0x4'));var Mustache=require(_0x11c7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11c7('0x6'));var csv=require(_0x11c7('0x7'));var ejs=require(_0x11c7('0x8'));var fs=require('fs');var fs_extra=require(_0x11c7('0x9'));var _=require(_0x11c7('0xa'));var squel=require('squel');var crypto=require(_0x11c7('0xb'));var jsforce=require(_0x11c7('0xc'));var deskjs=require(_0x11c7('0xd'));var toCsv=require(_0x11c7('0x7'));var querystring=require('querystring');var Papa=require(_0x11c7('0xe'));var Redis=require(_0x11c7('0xf'));var authService=require(_0x11c7('0x10'));var qs=require(_0x11c7('0x11'));var as=require(_0x11c7('0x12'));var hardwareService=require(_0x11c7('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x11c7('0x14'));var licenseUtil=require(_0x11c7('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x11c7('0x16'));function respondWithStatusCode(_0x1fa1cb,_0x3e4222){_0x3e4222=_0x3e4222||0xcc;return function(_0x35fbc1){if(_0x35fbc1){return _0x1fa1cb['sendStatus'](_0x3e4222);}return _0x1fa1cb[_0x11c7('0x17')](_0x3e4222)[_0x11c7('0x18')]();};}function respondWithResult(_0x316d8f,_0x1260cb){_0x1260cb=_0x1260cb||0xc8;return function(_0x46f0a0){if(_0x46f0a0){return _0x316d8f['status'](_0x1260cb)[_0x11c7('0x19')](_0x46f0a0);}};}function respondWithFilteredResult(_0x29a0f,_0x3ab14d){return function(_0x1d0f90){if(_0x1d0f90){var _0x33f05e=typeof _0x3ab14d[_0x11c7('0x1a')]===_0x11c7('0x1b')&&typeof _0x3ab14d[_0x11c7('0x1c')]===_0x11c7('0x1b');var _0x19b101=_0x1d0f90['count'];var _0x5ed65a=_0x33f05e?0x0:_0x3ab14d[_0x11c7('0x1a')];var _0x137f72=_0x33f05e?_0x1d0f90[_0x11c7('0x1d')]:_0x3ab14d[_0x11c7('0x1a')]+_0x3ab14d[_0x11c7('0x1c')];var _0x4cc089;if(_0x137f72>=_0x19b101){_0x137f72=_0x19b101;_0x4cc089=0xc8;}else{_0x4cc089=0xce;}_0x29a0f['status'](_0x4cc089);return _0x29a0f['set'](_0x11c7('0x1e'),_0x5ed65a+'-'+_0x137f72+'/'+_0x19b101)[_0x11c7('0x19')](_0x1d0f90);}return null;};}function patchUpdates(_0x3e2b68){return function(_0x1e979b){try{jsonpatch[_0x11c7('0x1f')](_0x1e979b,_0x3e2b68,!![]);}catch(_0x5d0a38){return BPromise['reject'](_0x5d0a38);}return _0x1e979b['save']();};}function saveUpdates(_0x563148,_0x2af522){return function(_0xde5069){if(_0xde5069){return _0xde5069[_0x11c7('0x20')](_0x563148)[_0x11c7('0x21')](function(_0xa84cd9){return _0xa84cd9;});}return null;};}function removeEntity(_0x5ecf76,_0x2c8e52){return function(_0x12724d){if(_0x12724d){return _0x12724d[_0x11c7('0x22')]()[_0x11c7('0x21')](function(){_0x5ecf76[_0x11c7('0x17')](0xcc)[_0x11c7('0x18')]();});}};}function handleEntityNotFound(_0x16a0a7,_0x329e46){return function(_0x6141fc){if(!_0x6141fc){_0x16a0a7[_0x11c7('0x23')](0x194);}return _0x6141fc;};}function handleError(_0x460370,_0x4f786e){_0x4f786e=_0x4f786e||0x1f4;return function(_0x4e4f3e){logger['error'](_0x4e4f3e['stack']);if(_0x4e4f3e[_0x11c7('0x24')]){delete _0x4e4f3e[_0x11c7('0x24')];}_0x460370[_0x11c7('0x17')](_0x4f786e)[_0x11c7('0x25')](_0x4e4f3e);};}exports[_0x11c7('0x26')]=function(_0x5d7fbe,_0xd33bd5){var _0x4963d7={},_0x8999e={},_0x4ee2e8={'count':0x0,'rows':[]};var _0x216409=_[_0x11c7('0x27')](db['DeskAccount'][_0x11c7('0x28')],function(_0x53a3be){return{'name':_0x53a3be[_0x11c7('0x29')],'type':_0x53a3be[_0x11c7('0x2a')][_0x11c7('0x2b')]};});_0x8999e[_0x11c7('0x2c')]=_[_0x11c7('0x27')](_0x216409,_0x11c7('0x24'));_0x8999e['query']=_[_0x11c7('0x2d')](_0x5d7fbe['query']);_0x8999e[_0x11c7('0x2e')]=_[_0x11c7('0x2f')](_0x8999e[_0x11c7('0x2c')],_0x8999e[_0x11c7('0x30')]);_0x4963d7['attributes']=_[_0x11c7('0x2f')](_0x8999e[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x5d7fbe[_0x11c7('0x30')]['fields']));_0x4963d7['attributes']=_0x4963d7[_0x11c7('0x32')]['length']?_0x4963d7[_0x11c7('0x32')]:_0x8999e['model'];if(!_0x5d7fbe['query'][_0x11c7('0x33')](_0x11c7('0x34'))){_0x4963d7[_0x11c7('0x1c')]=qs[_0x11c7('0x1c')](_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x1c')]);_0x4963d7[_0x11c7('0x1a')]=qs['offset'](_0x5d7fbe['query'][_0x11c7('0x1a')]);}_0x4963d7[_0x11c7('0x35')]=qs[_0x11c7('0x36')](_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x36')]);_0x4963d7[_0x11c7('0x37')]=qs[_0x11c7('0x2e')](_[_0x11c7('0x38')](_0x5d7fbe['query'],_0x8999e[_0x11c7('0x2e')]),_0x216409);if(_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x39')]){_0x4963d7[_0x11c7('0x37')]=_[_0x11c7('0x3a')](_0x4963d7['where'],{'$or':_[_0x11c7('0x27')](_0x216409,function(_0x59ca1f){if(_0x59ca1f[_0x11c7('0x2a')]!==_0x11c7('0x3b')){var _0x514a47={};_0x514a47[_0x59ca1f['name']]={'$like':'%'+_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x39')]+'%'};return _0x514a47;}})});}_0x4963d7=_[_0x11c7('0x3a')]({},_0x4963d7,_0x5d7fbe[_0x11c7('0x3c')]);var _0x4ab8a9={'where':_0x4963d7[_0x11c7('0x37')]};return db[_0x11c7('0x3d')]['count'](_0x4ab8a9)[_0x11c7('0x21')](function(_0x10a7d8){_0x4ee2e8[_0x11c7('0x1d')]=_0x10a7d8;if(_0x5d7fbe[_0x11c7('0x30')][_0x11c7('0x3e')]){_0x4963d7[_0x11c7('0x3f')]=[{'all':!![]}];}return db[_0x11c7('0x3d')][_0x11c7('0x40')](_0x4963d7);})[_0x11c7('0x21')](function(_0x4d830c){_0x4ee2e8['rows']=_0x4d830c;return _0x4ee2e8;})[_0x11c7('0x21')](respondWithFilteredResult(_0xd33bd5,_0x4963d7))['catch'](handleError(_0xd33bd5,null));};exports['show']=function(_0x171d3c,_0x186a03){var _0x37a256={'raw':![],'where':{'id':_0x171d3c[_0x11c7('0x41')]['id']}},_0x525249={};_0x525249[_0x11c7('0x2c')]=_[_0x11c7('0x2d')](db['DeskAccount'][_0x11c7('0x28')]);_0x525249['query']=_[_0x11c7('0x2d')](_0x171d3c['query']);_0x525249[_0x11c7('0x2e')]=_[_0x11c7('0x2f')](_0x525249[_0x11c7('0x2c')],_0x525249['query']);_0x37a256[_0x11c7('0x32')]=_[_0x11c7('0x2f')](_0x525249[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x171d3c[_0x11c7('0x30')]['fields']));_0x37a256[_0x11c7('0x32')]=_0x37a256[_0x11c7('0x32')][_0x11c7('0x42')]?_0x37a256[_0x11c7('0x32')]:_0x525249[_0x11c7('0x2c')];if(_0x171d3c[_0x11c7('0x30')][_0x11c7('0x3e')]){_0x37a256[_0x11c7('0x3f')]=[{'all':!![]}];}_0x37a256=_[_0x11c7('0x3a')]({},_0x37a256,_0x171d3c['options']);return db[_0x11c7('0x3d')][_0x11c7('0x43')](_0x37a256)[_0x11c7('0x21')](handleEntityNotFound(_0x186a03,null))[_0x11c7('0x21')](respondWithResult(_0x186a03,null))[_0x11c7('0x44')](handleError(_0x186a03,null));};exports[_0x11c7('0x45')]=function(_0x10719f,_0x4c2a91){return db[_0x11c7('0x3d')][_0x11c7('0x45')](_0x10719f[_0x11c7('0x46')],{})[_0x11c7('0x21')](respondWithResult(_0x4c2a91,0xc9))[_0x11c7('0x44')](handleError(_0x4c2a91,null));};exports[_0x11c7('0x20')]=function(_0x19fae3,_0xa90aff){if(_0x19fae3[_0x11c7('0x46')]['id']){delete _0x19fae3[_0x11c7('0x46')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x19fae3[_0x11c7('0x41')]['id']}})[_0x11c7('0x21')](handleEntityNotFound(_0xa90aff,null))[_0x11c7('0x21')](saveUpdates(_0x19fae3['body'],null))[_0x11c7('0x21')](respondWithResult(_0xa90aff,null))[_0x11c7('0x44')](handleError(_0xa90aff,null));};exports[_0x11c7('0x22')]=function(_0x42ea45,_0x596981){return db[_0x11c7('0x3d')][_0x11c7('0x43')]({'where':{'id':_0x42ea45['params']['id']}})['then'](handleEntityNotFound(_0x596981,null))[_0x11c7('0x21')](removeEntity(_0x596981,null))[_0x11c7('0x44')](handleError(_0x596981,null));};exports[_0x11c7('0x47')]=function(_0x3c791c,_0x21a63a,_0x23614c){var _0x23f7e7={};var _0x315655={};var _0x487892;var _0x41b220;return db[_0x11c7('0x3d')][_0x11c7('0x48')]({'where':{'id':_0x3c791c[_0x11c7('0x41')]['id']}})[_0x11c7('0x21')](handleEntityNotFound(_0x21a63a,null))[_0x11c7('0x21')](function(_0x2cc642){if(_0x2cc642){_0x487892=_0x2cc642;_0x315655['model']=_[_0x11c7('0x2d')](db[_0x11c7('0x49')]['rawAttributes']);_0x315655[_0x11c7('0x30')]=_[_0x11c7('0x2d')](_0x3c791c[_0x11c7('0x30')]);_0x315655['filters']=_[_0x11c7('0x2f')](_0x315655[_0x11c7('0x2c')],_0x315655['query']);_0x23f7e7['attributes']=_[_0x11c7('0x2f')](_0x315655[_0x11c7('0x2c')],qs[_0x11c7('0x31')](_0x3c791c['query']['fields']));_0x23f7e7[_0x11c7('0x32')]=_0x23f7e7[_0x11c7('0x32')][_0x11c7('0x42')]?_0x23f7e7['attributes']:_0x315655['model'];_0x23f7e7['order']=qs['sort'](_0x3c791c[_0x11c7('0x30')][_0x11c7('0x36')]);_0x23f7e7[_0x11c7('0x37')]=qs[_0x11c7('0x2e')](_[_0x11c7('0x38')](_0x3c791c[_0x11c7('0x30')],_0x315655['filters']));if(_0x3c791c[_0x11c7('0x30')]['filter']){_0x23f7e7[_0x11c7('0x37')]=_[_0x11c7('0x3a')](_0x23f7e7['where'],{'$or':_['map'](_0x23f7e7['attributes'],function(_0x412bfd){var _0x35c718={};_0x35c718[_0x412bfd]={'$like':'%'+_0x3c791c[_0x11c7('0x30')][_0x11c7('0x39')]+'%'};return _0x35c718;})});}_0x23f7e7=_[_0x11c7('0x3a')]({},_0x23f7e7,_0x3c791c[_0x11c7('0x3c')]);return _0x487892[_0x11c7('0x47')](_0x23f7e7);}})[_0x11c7('0x21')](function(_0x66c522){if(_0x66c522){_0x41b220=_0x66c522[_0x11c7('0x42')];if(!_0x3c791c[_0x11c7('0x30')][_0x11c7('0x33')](_0x11c7('0x34'))){_0x23f7e7['limit']=qs[_0x11c7('0x1c')](_0x3c791c[_0x11c7('0x30')][_0x11c7('0x1c')]);_0x23f7e7[_0x11c7('0x1a')]=qs[_0x11c7('0x1a')](_0x3c791c['query']['offset']);}return _0x487892[_0x11c7('0x47')](_0x23f7e7);}})[_0x11c7('0x21')](function(_0x426c70){if(_0x426c70){return _0x426c70?{'count':_0x41b220,'rows':_0x426c70}:null;}})[_0x11c7('0x21')](respondWithResult(_0x21a63a,null))['catch'](handleError(_0x21a63a,null));};exports[_0x11c7('0x4a')]=function(_0x148055,_0xc6ffb8,_0x5f3930){if(_0x148055[_0x11c7('0x46')]['id']){delete _0x148055[_0x11c7('0x46')]['id'];}return db[_0x11c7('0x3d')]['findOne']({'where':{'id':_0x148055[_0x11c7('0x41')]['id']}})['then'](handleEntityNotFound(_0xc6ffb8,null))[_0x11c7('0x21')](function(_0x169208){if(_0x169208){_0x148055[_0x11c7('0x46')]['AccountId']=_0x169208['id'];_0x148055['body'][_0x11c7('0x4b')]=integrations[_0x11c7('0x4c')](_0x148055[_0x11c7('0x46')][_0x11c7('0x4d')],_0x148055[_0x11c7('0x46')][_0x11c7('0x2a')]);_0x148055[_0x11c7('0x46')]['Descriptions']=integrations[_0x11c7('0x4e')](_0x148055[_0x11c7('0x46')][_0x11c7('0x4d')],_0x148055[_0x11c7('0x46')][_0x11c7('0x2a')]);return db[_0x11c7('0x49')][_0x11c7('0x45')](_0x148055['body'],{'include':[{'model':db['DeskField'],'as':_0x11c7('0x4b')},{'model':db[_0x11c7('0x4f')],'as':_0x11c7('0x50')}]});}return null;})[_0x11c7('0x21')](respondWithResult(_0xc6ffb8,null))['catch'](handleError(_0xc6ffb8,null));};exports['getFields']=function(_0x27bb69,_0x38de54,_0x487f36){var _0x1c94f5=[{'name':_0x11c7('0x51'),'label':_0x11c7('0x51'),'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 _0x4d2e17='';return db[_0x11c7('0x3d')][_0x11c7('0x48')]({'where':{'id':_0x27bb69[_0x11c7('0x41')]['id']},'attributes':['id',_0x11c7('0x52'),_0x11c7('0x53'),_0x11c7('0x54'),_0x11c7('0x55'),_0x11c7('0x56'),_0x11c7('0x57'),_0x11c7('0x58'),_0x11c7('0x59')]})[_0x11c7('0x21')](handleEntityNotFound(_0x38de54,null))[_0x11c7('0x21')](function(_0x4abf9a){if(_0x4abf9a){_0x4d2e17=_0x4abf9a['remoteUri'];var _0x49a7d4=_0x4d2e17[_0x11c7('0x5a')](-0x1);if(_0x49a7d4==='/'){_0x4d2e17=_0x4d2e17[_0x11c7('0x5b')](0x0,_0x4d2e17[_0x11c7('0x5c')](_0x49a7d4));}var _0x36fdef={'method':_0x11c7('0x5d'),'uri':util[_0x11c7('0x5e')](_0x11c7('0x5f'),_0x4d2e17),'headers':{'Content-Type':'application/json','Accept':_0x11c7('0x60')},'json':!![]};if(_0x4abf9a['authType']===_0x11c7('0x61')){_0x36fdef[_0x11c7('0x62')]['Authorization']=util[_0x11c7('0x5e')](_0x11c7('0x63'),new Buffer(util['format'](_0x11c7('0x64'),_0x4abf9a[_0x11c7('0x54')],_0x4abf9a[_0x11c7('0x55')]))[_0x11c7('0x65')](_0x11c7('0x66')));}return rp(_0x36fdef)[_0x11c7('0x21')](function(_0x38ed5b){return _0x1c94f5[_0x11c7('0x67')](_['map'](_0x38ed5b[_0x11c7('0x68')][_0x11c7('0x69')],function(_0x1d210d){return{'id':_0x1d210d['name'],'name':_0x1d210d[_0x11c7('0x24')],'type':_0x1d210d[_0x11c7('0x2a')],'active':_0x1d210d['active'],'label':_0x1d210d[_0x11c7('0x6a')],'custom':!![]};}));});}})['then'](function(_0x2f82aa){return{'count':_0x2f82aa[_0x11c7('0x42')],'rows':_0x2f82aa};})[_0x11c7('0x21')](respondWithResult(_0x38de54,null))[_0x11c7('0x44')](function(_0x418d3f){var _0x366a54=_0x27bb69[_0x11c7('0x30')]['test']?0x1f4:_0x418d3f['statusCode']||0x1f4;logger[_0x11c7('0x6b')](_0x11c7('0x6c'),_0x11c7('0x6d'),_0x366a54,JSON[_0x11c7('0x6e')](_0x418d3f));delete _0x418d3f[_0x11c7('0x24')];if(_0x366a54===0x191){_0x366a54=0x190;}_0x38de54['status'](_0x366a54)[_0x11c7('0x25')](_0x27bb69[_0x11c7('0x30')][_0x11c7('0x6f')]?{'message':_0x11c7('0x70'),'statusCode':_0x418d3f[_0x11c7('0x71')]}:_0x418d3f);});}; \ No newline at end of file +var _0xd693=['substring','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','username','toString','base64','_embedded','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','zip-dir','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','DeskAccount','includeAll','findAll','rows','catch','show','intersection','include','find','create','body','params','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','findOne','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x53c493,_0x425909){var _0x1478ab=function(_0x411efa){while(--_0x411efa){_0x53c493['push'](_0x53c493['shift']());}};_0x1478ab(++_0x425909);}(_0xd693,0x82));var _0x3d69=function(_0x169098,_0x55fa34){_0x169098=_0x169098-0x0;var _0x43d9b2=_0xd693[_0x169098];return _0x43d9b2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d69('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3d69('0x1'));var BPromise=require(_0x3d69('0x2'));var Mustache=require(_0x3d69('0x3'));var util=require('util');var path=require('path');var sox=require(_0x3d69('0x4'));var csv=require(_0x3d69('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d69('0x6'));var _=require(_0x3d69('0x7'));var squel=require('squel');var crypto=require(_0x3d69('0x8'));var jsforce=require(_0x3d69('0x9'));var deskjs=require(_0x3d69('0xa'));var toCsv=require(_0x3d69('0x5'));var querystring=require(_0x3d69('0xb'));var Papa=require(_0x3d69('0xc'));var Redis=require(_0x3d69('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3d69('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d69('0xf'));var logger=require(_0x3d69('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3d69('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d69('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4c35e8,_0x133925){_0x133925=_0x133925||0xcc;return function(_0x5afd01){if(_0x5afd01){return _0x4c35e8[_0x3d69('0x13')](_0x133925);}return _0x4c35e8['status'](_0x133925)[_0x3d69('0x14')]();};}function respondWithResult(_0x1aa460,_0x3291af){_0x3291af=_0x3291af||0xc8;return function(_0x2e04a5){if(_0x2e04a5){return _0x1aa460[_0x3d69('0x15')](_0x3291af)[_0x3d69('0x16')](_0x2e04a5);}};}function respondWithFilteredResult(_0x1b0979,_0x4af1d8){return function(_0x5b0d5a){if(_0x5b0d5a){var _0x3327f9=typeof _0x4af1d8['offset']===_0x3d69('0x17')&&typeof _0x4af1d8[_0x3d69('0x18')]===_0x3d69('0x17');var _0x556b07=_0x5b0d5a[_0x3d69('0x19')];var _0x599484=_0x3327f9?0x0:_0x4af1d8[_0x3d69('0x1a')];var _0x2094ae=_0x3327f9?_0x5b0d5a[_0x3d69('0x19')]:_0x4af1d8['offset']+_0x4af1d8[_0x3d69('0x18')];var _0x228c6a;if(_0x2094ae>=_0x556b07){_0x2094ae=_0x556b07;_0x228c6a=0xc8;}else{_0x228c6a=0xce;}_0x1b0979[_0x3d69('0x15')](_0x228c6a);return _0x1b0979[_0x3d69('0x1b')](_0x3d69('0x1c'),_0x599484+'-'+_0x2094ae+'/'+_0x556b07)[_0x3d69('0x16')](_0x5b0d5a);}return null;};}function patchUpdates(_0x5ca2af){return function(_0x4645e9){try{jsonpatch[_0x3d69('0x1d')](_0x4645e9,_0x5ca2af,!![]);}catch(_0x353254){return BPromise['reject'](_0x353254);}return _0x4645e9['save']();};}function saveUpdates(_0x4fdf33,_0x3862ed){return function(_0x2aaa3d){if(_0x2aaa3d){return _0x2aaa3d[_0x3d69('0x1e')](_0x4fdf33)[_0x3d69('0x1f')](function(_0x2a96a1){return _0x2a96a1;});}return null;};}function removeEntity(_0x142c96,_0x1f4798){return function(_0xb4523f){if(_0xb4523f){return _0xb4523f[_0x3d69('0x20')]()[_0x3d69('0x1f')](function(){_0x142c96[_0x3d69('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f74d4,_0xe61c3f){return function(_0x259310){if(!_0x259310){_0x2f74d4[_0x3d69('0x13')](0x194);}return _0x259310;};}function handleError(_0x39fa03,_0x32a188){_0x32a188=_0x32a188||0x1f4;return function(_0x38330a){logger[_0x3d69('0x21')](_0x38330a[_0x3d69('0x22')]);if(_0x38330a[_0x3d69('0x23')]){delete _0x38330a[_0x3d69('0x23')];}_0x39fa03[_0x3d69('0x15')](_0x32a188)[_0x3d69('0x24')](_0x38330a);};}exports[_0x3d69('0x25')]=function(_0x17bef1,_0x2a4cf0){var _0x22a022={},_0x584adb={},_0x51e627={'count':0x0,'rows':[]};var _0x489103=_['map'](db['DeskAccount'][_0x3d69('0x26')],function(_0x39f006){return{'name':_0x39f006[_0x3d69('0x27')],'type':_0x39f006[_0x3d69('0x28')][_0x3d69('0x29')]};});_0x584adb[_0x3d69('0x2a')]=_[_0x3d69('0x2b')](_0x489103,'name');_0x584adb[_0x3d69('0x2c')]=_[_0x3d69('0x2d')](_0x17bef1[_0x3d69('0x2c')]);_0x584adb[_0x3d69('0x2e')]=_['intersection'](_0x584adb['model'],_0x584adb['query']);_0x22a022['attributes']=_['intersection'](_0x584adb[_0x3d69('0x2a')],qs[_0x3d69('0x2f')](_0x17bef1[_0x3d69('0x2c')][_0x3d69('0x2f')]));_0x22a022[_0x3d69('0x30')]=_0x22a022['attributes'][_0x3d69('0x31')]?_0x22a022[_0x3d69('0x30')]:_0x584adb[_0x3d69('0x2a')];if(!_0x17bef1[_0x3d69('0x2c')]['hasOwnProperty'](_0x3d69('0x32'))){_0x22a022[_0x3d69('0x18')]=qs[_0x3d69('0x18')](_0x17bef1[_0x3d69('0x2c')][_0x3d69('0x18')]);_0x22a022[_0x3d69('0x1a')]=qs['offset'](_0x17bef1[_0x3d69('0x2c')][_0x3d69('0x1a')]);}_0x22a022['order']=qs[_0x3d69('0x33')](_0x17bef1[_0x3d69('0x2c')][_0x3d69('0x33')]);_0x22a022[_0x3d69('0x34')]=qs[_0x3d69('0x2e')](_[_0x3d69('0x35')](_0x17bef1[_0x3d69('0x2c')],_0x584adb[_0x3d69('0x2e')]),_0x489103);if(_0x17bef1[_0x3d69('0x2c')]['filter']){_0x22a022[_0x3d69('0x34')]=_[_0x3d69('0x36')](_0x22a022[_0x3d69('0x34')],{'$or':_[_0x3d69('0x2b')](_0x489103,function(_0x5487ec){if(_0x5487ec['type']!==_0x3d69('0x37')){var _0x244d31={};_0x244d31[_0x5487ec['name']]={'$like':'%'+_0x17bef1[_0x3d69('0x2c')][_0x3d69('0x38')]+'%'};return _0x244d31;}})});}_0x22a022=_[_0x3d69('0x36')]({},_0x22a022,_0x17bef1[_0x3d69('0x39')]);var _0x1d42b7={'where':_0x22a022['where']};return db[_0x3d69('0x3a')]['count'](_0x1d42b7)[_0x3d69('0x1f')](function(_0x1fb76b){_0x51e627[_0x3d69('0x19')]=_0x1fb76b;if(_0x17bef1['query'][_0x3d69('0x3b')]){_0x22a022['include']=[{'all':!![]}];}return db[_0x3d69('0x3a')][_0x3d69('0x3c')](_0x22a022);})[_0x3d69('0x1f')](function(_0x31fdbd){_0x51e627[_0x3d69('0x3d')]=_0x31fdbd;return _0x51e627;})[_0x3d69('0x1f')](respondWithFilteredResult(_0x2a4cf0,_0x22a022))[_0x3d69('0x3e')](handleError(_0x2a4cf0,null));};exports[_0x3d69('0x3f')]=function(_0x51ff4e,_0x1f13ad){var _0x5aa74e={'raw':![],'where':{'id':_0x51ff4e['params']['id']}},_0xa055ea={};_0xa055ea[_0x3d69('0x2a')]=_[_0x3d69('0x2d')](db[_0x3d69('0x3a')]['rawAttributes']);_0xa055ea[_0x3d69('0x2c')]=_['keys'](_0x51ff4e['query']);_0xa055ea[_0x3d69('0x2e')]=_[_0x3d69('0x40')](_0xa055ea[_0x3d69('0x2a')],_0xa055ea[_0x3d69('0x2c')]);_0x5aa74e[_0x3d69('0x30')]=_[_0x3d69('0x40')](_0xa055ea[_0x3d69('0x2a')],qs[_0x3d69('0x2f')](_0x51ff4e[_0x3d69('0x2c')][_0x3d69('0x2f')]));_0x5aa74e[_0x3d69('0x30')]=_0x5aa74e['attributes'][_0x3d69('0x31')]?_0x5aa74e[_0x3d69('0x30')]:_0xa055ea[_0x3d69('0x2a')];if(_0x51ff4e[_0x3d69('0x2c')][_0x3d69('0x3b')]){_0x5aa74e[_0x3d69('0x41')]=[{'all':!![]}];}_0x5aa74e=_[_0x3d69('0x36')]({},_0x5aa74e,_0x51ff4e['options']);return db['DeskAccount'][_0x3d69('0x42')](_0x5aa74e)[_0x3d69('0x1f')](handleEntityNotFound(_0x1f13ad,null))['then'](respondWithResult(_0x1f13ad,null))['catch'](handleError(_0x1f13ad,null));};exports[_0x3d69('0x43')]=function(_0x836d33,_0x27ae42){return db[_0x3d69('0x3a')]['create'](_0x836d33['body'],{})[_0x3d69('0x1f')](respondWithResult(_0x27ae42,0xc9))[_0x3d69('0x3e')](handleError(_0x27ae42,null));};exports['update']=function(_0xc8cc55,_0x3eeeb5){if(_0xc8cc55[_0x3d69('0x44')]['id']){delete _0xc8cc55[_0x3d69('0x44')]['id'];}return db[_0x3d69('0x3a')]['find']({'where':{'id':_0xc8cc55[_0x3d69('0x45')]['id']}})[_0x3d69('0x1f')](handleEntityNotFound(_0x3eeeb5,null))[_0x3d69('0x1f')](saveUpdates(_0xc8cc55['body'],null))['then'](respondWithResult(_0x3eeeb5,null))[_0x3d69('0x3e')](handleError(_0x3eeeb5,null));};exports[_0x3d69('0x20')]=function(_0x9a79f4,_0x21b323){return db[_0x3d69('0x3a')]['find']({'where':{'id':_0x9a79f4[_0x3d69('0x45')]['id']}})['then'](handleEntityNotFound(_0x21b323,null))[_0x3d69('0x1f')](removeEntity(_0x21b323,null))[_0x3d69('0x3e')](handleError(_0x21b323,null));};exports['getConfigurations']=function(_0x112fe1,_0x1cff01,_0x6a2da0){var _0x2fbf2c={};var _0x547456={};var _0x34fb51;var _0x57d88b;return db['DeskAccount']['findOne']({'where':{'id':_0x112fe1['params']['id']}})[_0x3d69('0x1f')](handleEntityNotFound(_0x1cff01,null))['then'](function(_0x2a6a29){if(_0x2a6a29){_0x34fb51=_0x2a6a29;_0x547456[_0x3d69('0x2a')]=_['keys'](db['DeskConfiguration'][_0x3d69('0x26')]);_0x547456['query']=_['keys'](_0x112fe1[_0x3d69('0x2c')]);_0x547456[_0x3d69('0x2e')]=_['intersection'](_0x547456[_0x3d69('0x2a')],_0x547456[_0x3d69('0x2c')]);_0x2fbf2c[_0x3d69('0x30')]=_['intersection'](_0x547456[_0x3d69('0x2a')],qs[_0x3d69('0x2f')](_0x112fe1['query'][_0x3d69('0x2f')]));_0x2fbf2c['attributes']=_0x2fbf2c[_0x3d69('0x30')][_0x3d69('0x31')]?_0x2fbf2c['attributes']:_0x547456[_0x3d69('0x2a')];_0x2fbf2c['order']=qs[_0x3d69('0x33')](_0x112fe1[_0x3d69('0x2c')][_0x3d69('0x33')]);_0x2fbf2c[_0x3d69('0x34')]=qs['filters'](_[_0x3d69('0x35')](_0x112fe1[_0x3d69('0x2c')],_0x547456['filters']));if(_0x112fe1[_0x3d69('0x2c')][_0x3d69('0x38')]){_0x2fbf2c[_0x3d69('0x34')]=_[_0x3d69('0x36')](_0x2fbf2c[_0x3d69('0x34')],{'$or':_[_0x3d69('0x2b')](_0x2fbf2c['attributes'],function(_0x49b2ca){var _0x14d324={};_0x14d324[_0x49b2ca]={'$like':'%'+_0x112fe1[_0x3d69('0x2c')][_0x3d69('0x38')]+'%'};return _0x14d324;})});}_0x2fbf2c=_['merge']({},_0x2fbf2c,_0x112fe1[_0x3d69('0x39')]);return _0x34fb51[_0x3d69('0x46')](_0x2fbf2c);}})[_0x3d69('0x1f')](function(_0x1cf4b8){if(_0x1cf4b8){_0x57d88b=_0x1cf4b8[_0x3d69('0x31')];if(!_0x112fe1['query'][_0x3d69('0x47')]('nolimit')){_0x2fbf2c[_0x3d69('0x18')]=qs[_0x3d69('0x18')](_0x112fe1[_0x3d69('0x2c')][_0x3d69('0x18')]);_0x2fbf2c[_0x3d69('0x1a')]=qs[_0x3d69('0x1a')](_0x112fe1['query']['offset']);}return _0x34fb51[_0x3d69('0x46')](_0x2fbf2c);}})[_0x3d69('0x1f')](function(_0x560d24){if(_0x560d24){return _0x560d24?{'count':_0x57d88b,'rows':_0x560d24}:null;}})[_0x3d69('0x1f')](respondWithResult(_0x1cff01,null))[_0x3d69('0x3e')](handleError(_0x1cff01,null));};exports[_0x3d69('0x48')]=function(_0x5b83b4,_0x58715a,_0x3a2e0e){if(_0x5b83b4[_0x3d69('0x44')]['id']){delete _0x5b83b4['body']['id'];}return db[_0x3d69('0x3a')]['findOne']({'where':{'id':_0x5b83b4['params']['id']}})['then'](handleEntityNotFound(_0x58715a,null))[_0x3d69('0x1f')](function(_0x490111){if(_0x490111){_0x5b83b4['body'][_0x3d69('0x49')]=_0x490111['id'];_0x5b83b4[_0x3d69('0x44')][_0x3d69('0x4a')]=integrations[_0x3d69('0x4b')](_0x5b83b4[_0x3d69('0x44')]['channel'],_0x5b83b4[_0x3d69('0x44')][_0x3d69('0x28')]);_0x5b83b4[_0x3d69('0x44')][_0x3d69('0x4c')]=integrations[_0x3d69('0x4d')](_0x5b83b4[_0x3d69('0x44')][_0x3d69('0x4e')],_0x5b83b4[_0x3d69('0x44')][_0x3d69('0x28')]);return db['DeskConfiguration'][_0x3d69('0x43')](_0x5b83b4[_0x3d69('0x44')],{'include':[{'model':db[_0x3d69('0x4f')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x3d69('0x4c')}]});}return null;})[_0x3d69('0x1f')](respondWithResult(_0x58715a,null))[_0x3d69('0x3e')](handleError(_0x58715a,null));};exports[_0x3d69('0x50')]=function(_0x4bd6c8,_0xc86459,_0x5a1f14){var _0x1378a8=[{'name':_0x3d69('0x51'),'label':_0x3d69('0x51'),'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 _0x546456='';return db[_0x3d69('0x3a')][_0x3d69('0x52')]({'where':{'id':_0x4bd6c8[_0x3d69('0x45')]['id']},'attributes':['id',_0x3d69('0x53'),_0x3d69('0x54'),'username',_0x3d69('0x55'),_0x3d69('0x56'),_0x3d69('0x57'),_0x3d69('0x58'),_0x3d69('0x59')]})['then'](handleEntityNotFound(_0xc86459,null))[_0x3d69('0x1f')](function(_0x3bd68e){if(_0x3bd68e){_0x546456=_0x3bd68e[_0x3d69('0x53')];var _0x48a3e8=_0x546456['slice'](-0x1);if(_0x48a3e8==='/'){_0x546456=_0x546456[_0x3d69('0x5a')](0x0,_0x546456['lastIndexOf'](_0x48a3e8));}var _0x138435={'method':_0x3d69('0x5b'),'uri':util[_0x3d69('0x5c')](_0x3d69('0x5d'),_0x546456),'headers':{'Content-Type':_0x3d69('0x5e'),'Accept':_0x3d69('0x5e')},'json':!![]};if(_0x3bd68e[_0x3d69('0x54')]===_0x3d69('0x5f')){_0x138435[_0x3d69('0x60')]['Authorization']=util[_0x3d69('0x5c')](_0x3d69('0x61'),new Buffer(util[_0x3d69('0x5c')](_0x3d69('0x62'),_0x3bd68e[_0x3d69('0x63')],_0x3bd68e[_0x3d69('0x55')]))[_0x3d69('0x64')](_0x3d69('0x65')));}return rp(_0x138435)['then'](function(_0x212c7f){return _0x1378a8['concat'](_['map'](_0x212c7f[_0x3d69('0x66')][_0x3d69('0x67')],function(_0x4c74b6){return{'id':_0x4c74b6['name'],'name':_0x4c74b6['name'],'type':_0x4c74b6['type'],'active':_0x4c74b6[_0x3d69('0x68')],'label':_0x4c74b6['label'],'custom':!![]};}));});}})[_0x3d69('0x1f')](function(_0x20f23a){return{'count':_0x20f23a['length'],'rows':_0x20f23a};})[_0x3d69('0x1f')](respondWithResult(_0xc86459,null))[_0x3d69('0x3e')](function(_0x518177){var _0x42888e=_0x4bd6c8[_0x3d69('0x2c')][_0x3d69('0x69')]?0x1f4:_0x518177['statusCode']||0x1f4;logger[_0x3d69('0x21')](_0x3d69('0x6a'),_0x3d69('0x50'),_0x42888e,JSON[_0x3d69('0x6b')](_0x518177));delete _0x518177[_0x3d69('0x23')];if(_0x42888e===0x191){_0x42888e=0x190;}_0xc86459[_0x3d69('0x15')](_0x42888e)[_0x3d69('0x24')](_0x4bd6c8[_0x3d69('0x2c')][_0x3d69('0x69')]?{'message':_0x3d69('0x6c'),'statusCode':_0x518177[_0x3d69('0x6d')]}:_0x518177);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 69a4fa2..78098dc 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 _0x3fb0=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x29524a,_0x29aab3){var _0x22d793=function(_0x4d4a05){while(--_0x4d4a05){_0x29524a['push'](_0x29524a['shift']());}};_0x22d793(++_0x29aab3);}(_0x3fb0,0x1c8));var _0x03fb=function(_0x2d3796,_0x38125a){_0x2d3796=_0x2d3796-0x0;var _0x26ecb5=_0x3fb0[_0x2d3796];return _0x26ecb5;};'use strict';var _=require(_0x03fb('0x0'));var util=require(_0x03fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x03fb('0x2'));var BPromise=require(_0x03fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03fb('0x4'));var rimraf=require(_0x03fb('0x5'));var config=require(_0x03fb('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x03fb('0x7'));module[_0x03fb('0x8')]=function(_0x33e711,_0x33c0c6){return _0x33e711[_0x03fb('0x9')](_0x03fb('0xa'),attributes,{'tableName':_0x03fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf308=['path','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','util','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf308,0x141));var _0x8f30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf308[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8f30('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8f30('0x1'));var rp=require(_0x8f30('0x2'));var fs=require('fs');var path=require(_0x8f30('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f30('0x4'));var integrations=require(_0x8f30('0x5'));module[_0x8f30('0x6')]=function(_0x6ba4c3,_0x3ef25e){return _0x6ba4c3[_0x8f30('0x7')]('DeskAccount',attributes,{'tableName':_0x8f30('0x8'),'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 fd2bea7..2e9f4ca 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 _0x698f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','find','raw','ShowDeskAccount','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x567ec0,_0x676a8e){var _0x109c75=function(_0x3087d5){while(--_0x3087d5){_0x567ec0['push'](_0x567ec0['shift']());}};_0x109c75(++_0x676a8e);}(_0x698f,0xd3));var _0xf698=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x698f[_0x13b392];return _0x39db24;};'use strict';var _=require('lodash');var util=require(_0xf698('0x0'));var moment=require(_0xf698('0x1'));var BPromise=require(_0xf698('0x2'));var rs=require(_0xf698('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf698('0x4'))['db'];var utils=require(_0xf698('0x5'));var logger=require('../../config/logger')(_0xf698('0x6'));var config=require(_0xf698('0x7'));var jayson=require(_0xf698('0x8'));var client=jayson[_0xf698('0x9')][_0xf698('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x86d430,_0x258ba1,_0x139ff8){return new BPromise(function(_0x5587a0,_0x435031){return client[_0xf698('0xb')](_0x86d430,_0x139ff8)[_0xf698('0xc')](function(_0x370080){logger[_0xf698('0xd')](_0xf698('0xe'),_0x258ba1,_0xf698('0xf'));logger[_0xf698('0x10')](_0xf698('0x11'),_0x258ba1,_0xf698('0xf'),JSON['stringify'](_0x370080));if(_0x370080[_0xf698('0x12')]){if(_0x370080[_0xf698('0x12')][_0xf698('0x13')]===0x1f4){logger[_0xf698('0x12')](_0xf698('0xe'),_0x258ba1,_0x370080['error'][_0xf698('0x14')]);return _0x435031(_0x370080[_0xf698('0x12')][_0xf698('0x14')]);}logger['error'](_0xf698('0xe'),_0x258ba1,_0x370080['error'][_0xf698('0x14')]);return _0x5587a0(_0x370080[_0xf698('0x12')][_0xf698('0x14')]);}else{logger[_0xf698('0xd')](_0xf698('0xe'),_0x258ba1,'request\x20sent');_0x5587a0(_0x370080['result'][_0xf698('0x14')]);}})[_0xf698('0x15')](function(_0x9dba58){logger[_0xf698('0x12')](_0xf698('0xe'),_0x258ba1,_0x9dba58);_0x435031(_0x9dba58);});});}exports[_0xf698('0x16')]=function(_0x36ad36){var _0x1b4fa0=this;return new Promise(function(_0x5ed26a,_0x174b52){return db[_0xf698('0x17')][_0xf698('0x18')]({'raw':_0x36ad36[_0xf698('0x19')]?_0x36ad36[_0xf698('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x36ad36[_0xf698('0x19')]?_0x36ad36[_0xf698('0x19')][_0xf698('0x1a')]||null:null,'attributes':_0x36ad36[_0xf698('0x19')]?_0x36ad36['options'][_0xf698('0x1b')]||null:null,'limit':_0x36ad36[_0xf698('0x19')]?_0x36ad36['options'][_0xf698('0x1c')]||null:null,'include':_0x36ad36['options']?_0x36ad36[_0xf698('0x19')][_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x36ad36[_0xf698('0x19')][_0xf698('0x1d')],function(_0x30c6fc){return{'model':db[_0x30c6fc[_0xf698('0x1f')]],'as':_0x30c6fc['as'],'attributes':_0x30c6fc[_0xf698('0x1b')],'include':_0x30c6fc['include']?_[_0xf698('0x1e')](_0x30c6fc[_0xf698('0x1d')],function(_0x274d8e){return{'model':db[_0x274d8e['model']],'as':_0x274d8e['as'],'attributes':_0x274d8e[_0xf698('0x1b')],'include':_0x274d8e[_0xf698('0x1d')]?_['map'](_0x274d8e[_0xf698('0x1d')],function(_0xa175f6){return{'model':db[_0xa175f6[_0xf698('0x1f')]],'as':_0xa175f6['as'],'attributes':_0xa175f6[_0xf698('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf698('0xc')](function(_0x4e8f39){logger[_0xf698('0xd')](_0xf698('0x16'),_0x36ad36);logger[_0xf698('0x10')](_0xf698('0x16'),_0x36ad36,JSON[_0xf698('0x20')](_0x4e8f39));_0x5ed26a(_0x4e8f39);})['catch'](function(_0x5b755d){logger[_0xf698('0x12')](_0xf698('0x16'),_0x5b755d[_0xf698('0x14')],_0x36ad36);_0x174b52(_0x1b4fa0['error'](0x1f4,_0x5b755d['message']));});});};exports['ShowDeskAccount']=function(_0xc22bd4){var _0x40b1d3=this;return new Promise(function(_0x4f572c,_0x3ad494){return db['DeskAccount'][_0xf698('0x21')]({'raw':_0xc22bd4['options']?_0xc22bd4['options'][_0xf698('0x22')]===undefined?!![]:![]:!![],'where':_0xc22bd4['options']?_0xc22bd4['options'][_0xf698('0x1a')]||null:null,'attributes':_0xc22bd4[_0xf698('0x19')]?_0xc22bd4[_0xf698('0x19')][_0xf698('0x1b')]||null:null,'include':_0xc22bd4['options']?_0xc22bd4['options']['include']?_['map'](_0xc22bd4[_0xf698('0x19')]['include'],function(_0x2e152e){return{'model':db[_0x2e152e[_0xf698('0x1f')]],'as':_0x2e152e['as'],'attributes':_0x2e152e[_0xf698('0x1b')],'include':_0x2e152e[_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x2e152e[_0xf698('0x1d')],function(_0x945df0){return{'model':db[_0x945df0[_0xf698('0x1f')]],'as':_0x945df0['as'],'attributes':_0x945df0[_0xf698('0x1b')],'include':_0x945df0[_0xf698('0x1d')]?_[_0xf698('0x1e')](_0x945df0['include'],function(_0x1facd3){return{'model':db[_0x1facd3[_0xf698('0x1f')]],'as':_0x1facd3['as'],'attributes':_0x1facd3[_0xf698('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf698('0xc')](function(_0xdbadc7){logger[_0xf698('0xd')](_0xf698('0x23'),_0xc22bd4);logger[_0xf698('0x10')]('ShowDeskAccount',_0xc22bd4,JSON['stringify'](_0xdbadc7));_0x4f572c(_0xdbadc7);})[_0xf698('0x15')](function(_0x434606){logger[_0xf698('0x12')](_0xf698('0x23'),_0x434606[_0xf698('0x14')],_0xc22bd4);_0x3ad494(_0x40b1d3[_0xf698('0x12')](0x1f4,_0x434606[_0xf698('0x14')]));});});}; \ No newline at end of file +var _0x47ac=['GetDeskAccount','stringify','catch','ShowDeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x90f6cf,_0x579861){var _0x3029ff=function(_0x37fccc){while(--_0x37fccc){_0x90f6cf['push'](_0x90f6cf['shift']());}};_0x3029ff(++_0x579861);}(_0x47ac,0x70));var _0xc47a=function(_0x290d65,_0x32ef9c){_0x290d65=_0x290d65-0x0;var _0x1aa903=_0x47ac[_0x290d65];return _0x1aa903;};'use strict';var _=require(_0xc47a('0x0'));var util=require(_0xc47a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc47a('0x2'));var fs=require('fs');var Redis=require(_0xc47a('0x3'));var db=require(_0xc47a('0x4'))['db'];var utils=require(_0xc47a('0x5'));var logger=require('../../config/logger')(_0xc47a('0x6'));var config=require(_0xc47a('0x7'));var jayson=require(_0xc47a('0x8'));var client=jayson[_0xc47a('0x9')][_0xc47a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f78cc,_0x57ca54,_0x17a82b){return new BPromise(function(_0x1aee5e,_0xa7e243){return client[_0xc47a('0xb')](_0x1f78cc,_0x17a82b)[_0xc47a('0xc')](function(_0x397a4c){logger[_0xc47a('0xd')](_0xc47a('0xe'),_0x57ca54,_0xc47a('0xf'));logger[_0xc47a('0x10')](_0xc47a('0x11'),_0x57ca54,_0xc47a('0xf'),JSON['stringify'](_0x397a4c));if(_0x397a4c[_0xc47a('0x12')]){if(_0x397a4c[_0xc47a('0x12')][_0xc47a('0x13')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x57ca54,_0x397a4c[_0xc47a('0x12')][_0xc47a('0x14')]);return _0xa7e243(_0x397a4c['error']['message']);}logger['error'](_0xc47a('0xe'),_0x57ca54,_0x397a4c[_0xc47a('0x12')][_0xc47a('0x14')]);return _0x1aee5e(_0x397a4c[_0xc47a('0x12')][_0xc47a('0x14')]);}else{logger[_0xc47a('0xd')](_0xc47a('0xe'),_0x57ca54,_0xc47a('0xf'));_0x1aee5e(_0x397a4c[_0xc47a('0x15')][_0xc47a('0x14')]);}})['catch'](function(_0x25cfef){logger[_0xc47a('0x12')](_0xc47a('0xe'),_0x57ca54,_0x25cfef);_0xa7e243(_0x25cfef);});});}exports['GetDeskAccount']=function(_0x34dc34){var _0x1415e2=this;return new Promise(function(_0x5c557e,_0x302638){return db[_0xc47a('0x16')][_0xc47a('0x17')]({'raw':_0x34dc34[_0xc47a('0x18')]?_0x34dc34['options'][_0xc47a('0x19')]===undefined?!![]:![]:!![],'where':_0x34dc34[_0xc47a('0x18')]?_0x34dc34['options'][_0xc47a('0x1a')]||null:null,'attributes':_0x34dc34[_0xc47a('0x18')]?_0x34dc34[_0xc47a('0x18')][_0xc47a('0x1b')]||null:null,'limit':_0x34dc34['options']?_0x34dc34[_0xc47a('0x18')][_0xc47a('0x1c')]||null:null,'include':_0x34dc34[_0xc47a('0x18')]?_0x34dc34[_0xc47a('0x18')]['include']?_['map'](_0x34dc34[_0xc47a('0x18')]['include'],function(_0x54a5eb){return{'model':db[_0x54a5eb['model']],'as':_0x54a5eb['as'],'attributes':_0x54a5eb['attributes'],'include':_0x54a5eb[_0xc47a('0x1d')]?_[_0xc47a('0x1e')](_0x54a5eb['include'],function(_0x20450b){return{'model':db[_0x20450b[_0xc47a('0x1f')]],'as':_0x20450b['as'],'attributes':_0x20450b[_0xc47a('0x1b')],'include':_0x20450b[_0xc47a('0x1d')]?_[_0xc47a('0x1e')](_0x20450b[_0xc47a('0x1d')],function(_0x46c04e){return{'model':db[_0x46c04e[_0xc47a('0x1f')]],'as':_0x46c04e['as'],'attributes':_0x46c04e[_0xc47a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc47a('0xc')](function(_0x34aff4){logger['info'](_0xc47a('0x20'),_0x34dc34);logger['debug']('GetDeskAccount',_0x34dc34,JSON[_0xc47a('0x21')](_0x34aff4));_0x5c557e(_0x34aff4);})[_0xc47a('0x22')](function(_0x5011b7){logger[_0xc47a('0x12')](_0xc47a('0x20'),_0x5011b7[_0xc47a('0x14')],_0x34dc34);_0x302638(_0x1415e2[_0xc47a('0x12')](0x1f4,_0x5011b7[_0xc47a('0x14')]));});});};exports[_0xc47a('0x23')]=function(_0x59a729){var _0x53f08b=this;return new Promise(function(_0x3a8fe1,_0x2767d8){return db['DeskAccount']['find']({'raw':_0x59a729[_0xc47a('0x18')]?_0x59a729[_0xc47a('0x18')][_0xc47a('0x19')]===undefined?!![]:![]:!![],'where':_0x59a729['options']?_0x59a729[_0xc47a('0x18')][_0xc47a('0x1a')]||null:null,'attributes':_0x59a729[_0xc47a('0x18')]?_0x59a729[_0xc47a('0x18')]['attributes']||null:null,'include':_0x59a729[_0xc47a('0x18')]?_0x59a729['options'][_0xc47a('0x1d')]?_[_0xc47a('0x1e')](_0x59a729[_0xc47a('0x18')][_0xc47a('0x1d')],function(_0x35efb5){return{'model':db[_0x35efb5[_0xc47a('0x1f')]],'as':_0x35efb5['as'],'attributes':_0x35efb5[_0xc47a('0x1b')],'include':_0x35efb5[_0xc47a('0x1d')]?_[_0xc47a('0x1e')](_0x35efb5[_0xc47a('0x1d')],function(_0x4e07ed){return{'model':db[_0x4e07ed['model']],'as':_0x4e07ed['as'],'attributes':_0x4e07ed[_0xc47a('0x1b')],'include':_0x4e07ed[_0xc47a('0x1d')]?_['map'](_0x4e07ed[_0xc47a('0x1d')],function(_0x3ed07e){return{'model':db[_0x3ed07e['model']],'as':_0x3ed07e['as'],'attributes':_0x3ed07e[_0xc47a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc47a('0xc')](function(_0x24990e){logger[_0xc47a('0xd')]('ShowDeskAccount',_0x59a729);logger[_0xc47a('0x10')]('ShowDeskAccount',_0x59a729,JSON[_0xc47a('0x21')](_0x24990e));_0x3a8fe1(_0x24990e);})[_0xc47a('0x22')](function(_0x4ac008){logger[_0xc47a('0x12')](_0xc47a('0x23'),_0x4ac008[_0xc47a('0x14')],_0x59a729);_0x2767d8(_0x53f08b[_0xc47a('0x12')](0x1f4,_0x4ac008[_0xc47a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 68b1bc9..03165b7 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ccf4d,_0x22a5d6){var _0x76cdda=function(_0x5a1281){while(--_0x5a1281){_0x1ccf4d['push'](_0x1ccf4d['shift']());}};_0x76cdda(++_0x22a5d6);}(_0x008c,0x188));var _0xc008=function(_0xb02766,_0xa37d90){_0xb02766=_0xb02766-0x0;var _0x560e6c=_0x008c[_0xb02766];return _0x560e6c;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x5a8167,_0x3da992){var _0x236a3b=function(_0x34aa47){while(--_0x34aa47){_0x5a8167['push'](_0x5a8167['shift']());}};_0x236a3b(++_0x3da992);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c207817..4210883 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 _0x6567=['STRING','sequelize'];(function(_0x1354c9,_0x475347){var _0x116916=function(_0x24051b){while(--_0x24051b){_0x1354c9['push'](_0x1354c9['shift']());}};_0x116916(++_0x475347);}(_0x6567,0x17d));var _0x7656=function(_0x5eb71a,_0x5e0ad4){_0x5eb71a=_0x5eb71a-0x0;var _0x34abdd=_0x6567[_0x5eb71a];return _0x34abdd;};'use strict';var Sequelize=require(_0x7656('0x0'));module['exports']={'name':{'type':Sequelize[_0x7656('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc19d=['STRING','sequelize','exports'];(function(_0x100682,_0x11afec){var _0xcb6e87=function(_0x3ef421){while(--_0x3ef421){_0x100682['push'](_0x100682['shift']());}};_0xcb6e87(++_0x11afec);}(_0xc19d,0xd9));var _0xdc19=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0xc19d[_0x12a554];return _0x244ba0;};'use strict';var Sequelize=require(_0xdc19('0x0'));module[_0xdc19('0x1')]={'name':{'type':Sequelize[_0xdc19('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fc14f20..a68c807 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 _0x8bd9=['DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','getFields','findOne','DeskField','getSubjects','order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8bd9,0x80));var _0x98bd=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8bd9[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0x98bd('0x0'));var rimraf=require(_0x98bd('0x1'));var zipdir=require(_0x98bd('0x2'));var jsonpatch=require(_0x98bd('0x3'));var rp=require(_0x98bd('0x4'));var moment=require('moment');var BPromise=require(_0x98bd('0x5'));var Mustache=require(_0x98bd('0x6'));var util=require(_0x98bd('0x7'));var path=require('path');var sox=require(_0x98bd('0x8'));var csv=require(_0x98bd('0x9'));var ejs=require(_0x98bd('0xa'));var fs=require('fs');var fs_extra=require(_0x98bd('0xb'));var _=require(_0x98bd('0xc'));var squel=require('squel');var crypto=require(_0x98bd('0xd'));var jsforce=require(_0x98bd('0xe'));var deskjs=require(_0x98bd('0xf'));var toCsv=require(_0x98bd('0x9'));var querystring=require(_0x98bd('0x10'));var Papa=require('papaparse');var Redis=require(_0x98bd('0x11'));var authService=require(_0x98bd('0x12'));var qs=require(_0x98bd('0x13'));var as=require(_0x98bd('0x14'));var hardwareService=require(_0x98bd('0x15'));var logger=require(_0x98bd('0x16'))(_0x98bd('0x17'));var utils=require(_0x98bd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x98bd('0x19'));var db=require(_0x98bd('0x1a'))['db'];function respondWithStatusCode(_0x1567c1,_0xecd29){_0xecd29=_0xecd29||0xcc;return function(_0x5d4cf0){if(_0x5d4cf0){return _0x1567c1[_0x98bd('0x1b')](_0xecd29);}return _0x1567c1['status'](_0xecd29)['end']();};}function respondWithResult(_0x1f9ce1,_0x322426){_0x322426=_0x322426||0xc8;return function(_0x47a39a){if(_0x47a39a){return _0x1f9ce1[_0x98bd('0x1c')](_0x322426)[_0x98bd('0x1d')](_0x47a39a);}};}function respondWithFilteredResult(_0x321ff1,_0x58ef4f){return function(_0xa5211f){if(_0xa5211f){var _0x1ac30f=typeof _0x58ef4f[_0x98bd('0x1e')]===_0x98bd('0x1f')&&typeof _0x58ef4f['limit']===_0x98bd('0x1f');var _0x431b73=_0xa5211f['count'];var _0x45d32a=_0x1ac30f?0x0:_0x58ef4f['offset'];var _0x40d233=_0x1ac30f?_0xa5211f[_0x98bd('0x20')]:_0x58ef4f[_0x98bd('0x1e')]+_0x58ef4f[_0x98bd('0x21')];var _0x520289;if(_0x40d233>=_0x431b73){_0x40d233=_0x431b73;_0x520289=0xc8;}else{_0x520289=0xce;}_0x321ff1[_0x98bd('0x1c')](_0x520289);return _0x321ff1[_0x98bd('0x22')](_0x98bd('0x23'),_0x45d32a+'-'+_0x40d233+'/'+_0x431b73)['json'](_0xa5211f);}return null;};}function patchUpdates(_0x3556e1){return function(_0x5d19cb){try{jsonpatch[_0x98bd('0x24')](_0x5d19cb,_0x3556e1,!![]);}catch(_0x494c7e){return BPromise[_0x98bd('0x25')](_0x494c7e);}return _0x5d19cb[_0x98bd('0x26')]();};}function saveUpdates(_0x1e4352,_0x6ba6b7){return function(_0x331c49){if(_0x331c49){return _0x331c49[_0x98bd('0x27')](_0x1e4352)[_0x98bd('0x28')](function(_0x4d80eb){return _0x4d80eb;});}return null;};}function removeEntity(_0x1ab5f0,_0x299837){return function(_0x36381d){if(_0x36381d){return _0x36381d[_0x98bd('0x29')]()[_0x98bd('0x28')](function(){_0x1ab5f0[_0x98bd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171453,_0x564e9c){return function(_0x24359e){if(!_0x24359e){_0x171453[_0x98bd('0x1b')](0x194);}return _0x24359e;};}function handleError(_0x1a68d0,_0xc17ae5){_0xc17ae5=_0xc17ae5||0x1f4;return function(_0x499aed){logger[_0x98bd('0x2a')](_0x499aed[_0x98bd('0x2b')]);if(_0x499aed['name']){delete _0x499aed[_0x98bd('0x2c')];}_0x1a68d0[_0x98bd('0x1c')](_0xc17ae5)['send'](_0x499aed);};}exports[_0x98bd('0x2d')]=function(_0xb63dc8,_0x3c68c7){var _0x259c53={},_0x6786a2={},_0x51b91d={'count':0x0,'rows':[]};var _0x26f3ae=_['map'](db[_0x98bd('0x2e')]['rawAttributes'],function(_0x1fceda){return{'name':_0x1fceda[_0x98bd('0x2f')],'type':_0x1fceda['type'][_0x98bd('0x30')]};});_0x6786a2[_0x98bd('0x31')]=_[_0x98bd('0x32')](_0x26f3ae,_0x98bd('0x2c'));_0x6786a2[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0xb63dc8[_0x98bd('0x33')]);_0x6786a2[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x6786a2[_0x98bd('0x31')],_0x6786a2['query']);_0x259c53['attributes']=_[_0x98bd('0x36')](_0x6786a2[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0xb63dc8['query'][_0x98bd('0x37')]));_0x259c53['attributes']=_0x259c53['attributes'][_0x98bd('0x38')]?_0x259c53[_0x98bd('0x39')]:_0x6786a2[_0x98bd('0x31')];if(!_0xb63dc8['query'][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x259c53[_0x98bd('0x21')]=qs['limit'](_0xb63dc8[_0x98bd('0x33')]['limit']);_0x259c53[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x1e')]);}_0x259c53['order']=qs[_0x98bd('0x3c')](_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3c')]);_0x259c53['where']=qs[_0x98bd('0x35')](_[_0x98bd('0x3d')](_0xb63dc8[_0x98bd('0x33')],_0x6786a2[_0x98bd('0x35')]),_0x26f3ae);if(_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3e')]){_0x259c53[_0x98bd('0x3f')]=_[_0x98bd('0x40')](_0x259c53[_0x98bd('0x3f')],{'$or':_[_0x98bd('0x32')](_0x26f3ae,function(_0xa512a2){if(_0xa512a2[_0x98bd('0x41')]!=='VIRTUAL'){var _0x2eac90={};_0x2eac90[_0xa512a2[_0x98bd('0x2c')]]={'$like':'%'+_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x2eac90;}})});}_0x259c53=_[_0x98bd('0x40')]({},_0x259c53,_0xb63dc8[_0x98bd('0x42')]);var _0x47f45b={'where':_0x259c53['where']};return db['DeskConfiguration']['count'](_0x47f45b)[_0x98bd('0x28')](function(_0x5ac9d5){_0x51b91d[_0x98bd('0x20')]=_0x5ac9d5;if(_0xb63dc8[_0x98bd('0x33')][_0x98bd('0x43')]){_0x259c53[_0x98bd('0x44')]=[{'all':!![]}];}return db[_0x98bd('0x2e')][_0x98bd('0x45')](_0x259c53);})[_0x98bd('0x28')](function(_0x1e954d){_0x51b91d[_0x98bd('0x46')]=_0x1e954d;return _0x51b91d;})[_0x98bd('0x28')](respondWithFilteredResult(_0x3c68c7,_0x259c53))[_0x98bd('0x47')](handleError(_0x3c68c7,null));};exports['show']=function(_0x2be1bd,_0x509425){var _0x164a3f={'raw':![],'where':{'id':_0x2be1bd['params']['id']}},_0x38bb63={};_0x38bb63[_0x98bd('0x31')]=_['keys'](db[_0x98bd('0x2e')][_0x98bd('0x48')]);_0x38bb63['query']=_[_0x98bd('0x34')](_0x2be1bd[_0x98bd('0x33')]);_0x38bb63[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x38bb63[_0x98bd('0x31')],_0x38bb63['query']);_0x164a3f['attributes']=_[_0x98bd('0x36')](_0x38bb63[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0x2be1bd[_0x98bd('0x33')]['fields']));_0x164a3f[_0x98bd('0x39')]=_0x164a3f[_0x98bd('0x39')]['length']?_0x164a3f['attributes']:_0x38bb63[_0x98bd('0x31')];if(_0x2be1bd[_0x98bd('0x33')]['includeAll']){_0x164a3f[_0x98bd('0x44')]=[{'all':!![]}];}_0x164a3f=_[_0x98bd('0x40')]({},_0x164a3f,_0x2be1bd[_0x98bd('0x42')]);return db[_0x98bd('0x2e')][_0x98bd('0x49')](_0x164a3f)['then'](handleEntityNotFound(_0x509425,null))[_0x98bd('0x28')](respondWithResult(_0x509425,null))[_0x98bd('0x47')](handleError(_0x509425,null));};exports[_0x98bd('0x4a')]=function(_0x120c52,_0x29821a){return db['DeskConfiguration'][_0x98bd('0x4a')](_0x120c52[_0x98bd('0x4b')],{})[_0x98bd('0x28')](respondWithResult(_0x29821a,0xc9))[_0x98bd('0x47')](handleError(_0x29821a,null));};exports[_0x98bd('0x27')]=function(_0x1c6e92,_0x1fc684){if(_0x1c6e92[_0x98bd('0x4b')]['id']){delete _0x1c6e92[_0x98bd('0x4b')]['id'];}return db[_0x98bd('0x2e')][_0x98bd('0x49')]({'where':{'id':_0x1c6e92[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x1fc684,null))[_0x98bd('0x28')](saveUpdates(_0x1c6e92[_0x98bd('0x4b')],null))[_0x98bd('0x28')](respondWithResult(_0x1fc684,null))[_0x98bd('0x47')](handleError(_0x1fc684,null));};exports['destroy']=function(_0x1b6c84,_0x2a90f4){return db[_0x98bd('0x2e')][_0x98bd('0x49')]({'where':{'id':_0x1b6c84['params']['id']}})['then'](handleEntityNotFound(_0x2a90f4,null))['then'](removeEntity(_0x2a90f4,null))['catch'](handleError(_0x2a90f4,null));};exports[_0x98bd('0x4d')]=function(_0xaeafc7,_0x669a59,_0x435972){var _0x3ae542={};var _0x595ed8={};var _0x5d7aea;var _0x1658eb;return db[_0x98bd('0x2e')][_0x98bd('0x4e')]({'where':{'id':_0xaeafc7[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x669a59,null))[_0x98bd('0x28')](function(_0x190b64){if(_0x190b64){_0x5d7aea=_0x190b64;_0x595ed8[_0x98bd('0x31')]=_[_0x98bd('0x34')](db[_0x98bd('0x4f')]['rawAttributes']);_0x595ed8['query']=_[_0x98bd('0x34')](_0xaeafc7[_0x98bd('0x33')]);_0x595ed8[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x595ed8[_0x98bd('0x31')],_0x595ed8[_0x98bd('0x33')]);_0x3ae542[_0x98bd('0x39')]=_[_0x98bd('0x36')](_0x595ed8[_0x98bd('0x31')],qs[_0x98bd('0x37')](_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x37')]));_0x3ae542[_0x98bd('0x39')]=_0x3ae542[_0x98bd('0x39')]['length']?_0x3ae542[_0x98bd('0x39')]:_0x595ed8[_0x98bd('0x31')];_0x3ae542['order']=qs[_0x98bd('0x3c')](_0xaeafc7['query'][_0x98bd('0x3c')]);_0x3ae542['where']=qs[_0x98bd('0x35')](_['pick'](_0xaeafc7[_0x98bd('0x33')],_0x595ed8['filters']));if(_0xaeafc7[_0x98bd('0x33')]['filter']){_0x3ae542[_0x98bd('0x3f')]=_['merge'](_0x3ae542[_0x98bd('0x3f')],{'$or':_['map'](_0x3ae542[_0x98bd('0x39')],function(_0x555877){var _0x466b1e={};_0x466b1e[_0x555877]={'$like':'%'+_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x466b1e;})});}_0x3ae542=_[_0x98bd('0x40')]({},_0x3ae542,_0xaeafc7['options']);return _0x5d7aea[_0x98bd('0x4d')](_0x3ae542);}})[_0x98bd('0x28')](function(_0x3a0b90){if(_0x3a0b90){_0x1658eb=_0x3a0b90['length'];if(!_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x3ae542[_0x98bd('0x21')]=qs['limit'](_0xaeafc7['query'][_0x98bd('0x21')]);_0x3ae542[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xaeafc7[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x5d7aea[_0x98bd('0x4d')](_0x3ae542);}})[_0x98bd('0x28')](function(_0x1ffed4){if(_0x1ffed4){return _0x1ffed4?{'count':_0x1658eb,'rows':_0x1ffed4}:null;}})['then'](respondWithResult(_0x669a59,null))['catch'](handleError(_0x669a59,null));};exports[_0x98bd('0x50')]=function(_0xc79f44,_0x416ccd,_0x41017e){var _0x5c1421={};var _0x58f527={};var _0x5d9187;var _0x18e395;return db['DeskConfiguration']['findOne']({'where':{'id':_0xc79f44[_0x98bd('0x4c')]['id']}})['then'](handleEntityNotFound(_0x416ccd,null))[_0x98bd('0x28')](function(_0x4187c6){if(_0x4187c6){_0x5d9187=_0x4187c6;_0x58f527[_0x98bd('0x31')]=_[_0x98bd('0x34')](db['DeskField'][_0x98bd('0x48')]);_0x58f527[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0xc79f44[_0x98bd('0x33')]);_0x58f527[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x58f527['model'],_0x58f527[_0x98bd('0x33')]);_0x5c1421['attributes']=_[_0x98bd('0x36')](_0x58f527['model'],qs[_0x98bd('0x37')](_0xc79f44['query'][_0x98bd('0x37')]));_0x5c1421[_0x98bd('0x39')]=_0x5c1421['attributes'][_0x98bd('0x38')]?_0x5c1421['attributes']:_0x58f527[_0x98bd('0x31')];_0x5c1421[_0x98bd('0x51')]=qs[_0x98bd('0x3c')](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x3c')]);_0x5c1421[_0x98bd('0x3f')]=qs['filters'](_[_0x98bd('0x3d')](_0xc79f44[_0x98bd('0x33')],_0x58f527[_0x98bd('0x35')]));if(_0xc79f44['query'][_0x98bd('0x3e')]){_0x5c1421[_0x98bd('0x3f')]=_[_0x98bd('0x40')](_0x5c1421[_0x98bd('0x3f')],{'$or':_['map'](_0x5c1421[_0x98bd('0x39')],function(_0x153278){var _0x4791ce={};_0x4791ce[_0x153278]={'$like':'%'+_0xc79f44[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x4791ce;})});}_0x5c1421=_['merge']({},_0x5c1421,_0xc79f44[_0x98bd('0x42')]);return _0x5d9187[_0x98bd('0x50')](_0x5c1421);}})['then'](function(_0x3f9ff1){if(_0x3f9ff1){_0x18e395=_0x3f9ff1[_0x98bd('0x38')];if(!_0xc79f44[_0x98bd('0x33')]['hasOwnProperty'](_0x98bd('0x3b'))){_0x5c1421[_0x98bd('0x21')]=qs['limit'](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x21')]);_0x5c1421[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0xc79f44[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x5d9187[_0x98bd('0x50')](_0x5c1421);}})[_0x98bd('0x28')](function(_0x224258){if(_0x224258){return _0x224258?{'count':_0x18e395,'rows':_0x224258}:null;}})['then'](respondWithResult(_0x416ccd,null))['catch'](handleError(_0x416ccd,null));};exports[_0x98bd('0x52')]=function(_0x4092b2,_0x15b205,_0x39514c){var _0x7d12d={};var _0x67aff5={};var _0x32846f;var _0x356e2a;return db[_0x98bd('0x2e')][_0x98bd('0x4e')]({'where':{'id':_0x4092b2[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x15b205,null))['then'](function(_0x14f43){if(_0x14f43){_0x32846f=_0x14f43;_0x67aff5[_0x98bd('0x31')]=_['keys'](db['DeskField'][_0x98bd('0x48')]);_0x67aff5[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0x4092b2[_0x98bd('0x33')]);_0x67aff5[_0x98bd('0x35')]=_[_0x98bd('0x36')](_0x67aff5[_0x98bd('0x31')],_0x67aff5[_0x98bd('0x33')]);_0x7d12d['attributes']=_[_0x98bd('0x36')](_0x67aff5['model'],qs['fields'](_0x4092b2[_0x98bd('0x33')][_0x98bd('0x37')]));_0x7d12d['attributes']=_0x7d12d[_0x98bd('0x39')]['length']?_0x7d12d[_0x98bd('0x39')]:_0x67aff5['model'];_0x7d12d[_0x98bd('0x51')]=qs['sort'](_0x4092b2[_0x98bd('0x33')]['sort']);_0x7d12d[_0x98bd('0x3f')]=qs[_0x98bd('0x35')](_['pick'](_0x4092b2[_0x98bd('0x33')],_0x67aff5['filters']));if(_0x4092b2['query'][_0x98bd('0x3e')]){_0x7d12d['where']=_[_0x98bd('0x40')](_0x7d12d[_0x98bd('0x3f')],{'$or':_[_0x98bd('0x32')](_0x7d12d[_0x98bd('0x39')],function(_0x2921d1){var _0x39523d={};_0x39523d[_0x2921d1]={'$like':'%'+_0x4092b2['query']['filter']+'%'};return _0x39523d;})});}_0x7d12d=_[_0x98bd('0x40')]({},_0x7d12d,_0x4092b2[_0x98bd('0x42')]);return _0x32846f[_0x98bd('0x52')](_0x7d12d);}})[_0x98bd('0x28')](function(_0x3ec4be){if(_0x3ec4be){_0x356e2a=_0x3ec4be[_0x98bd('0x38')];if(!_0x4092b2[_0x98bd('0x33')]['hasOwnProperty'](_0x98bd('0x3b'))){_0x7d12d['limit']=qs[_0x98bd('0x21')](_0x4092b2['query'][_0x98bd('0x21')]);_0x7d12d[_0x98bd('0x1e')]=qs[_0x98bd('0x1e')](_0x4092b2[_0x98bd('0x33')][_0x98bd('0x1e')]);}return _0x32846f['getDescriptions'](_0x7d12d);}})[_0x98bd('0x28')](function(_0x552573){if(_0x552573){return _0x552573?{'count':_0x356e2a,'rows':_0x552573}:null;}})[_0x98bd('0x28')](respondWithResult(_0x15b205,null))['catch'](handleError(_0x15b205,null));};exports[_0x98bd('0x53')]=function(_0x242ce0,_0x23ea29,_0x234c1e){var _0x303ebd={};var _0x52b645={};var _0xb62b99;var _0x28cdfe;return db['DeskConfiguration'][_0x98bd('0x4e')]({'where':{'id':_0x242ce0['params']['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x23ea29,null))[_0x98bd('0x28')](function(_0x4c28cf){if(_0x4c28cf){_0xb62b99=_0x4c28cf;_0x52b645[_0x98bd('0x31')]=_[_0x98bd('0x34')](db[_0x98bd('0x54')][_0x98bd('0x48')]);_0x52b645[_0x98bd('0x33')]=_[_0x98bd('0x34')](_0x242ce0[_0x98bd('0x33')]);_0x52b645['filters']=_[_0x98bd('0x36')](_0x52b645[_0x98bd('0x31')],_0x52b645['query']);_0x303ebd[_0x98bd('0x39')]=_[_0x98bd('0x36')](_0x52b645['model'],qs[_0x98bd('0x37')](_0x242ce0[_0x98bd('0x33')][_0x98bd('0x37')]));_0x303ebd[_0x98bd('0x39')]=_0x303ebd[_0x98bd('0x39')][_0x98bd('0x38')]?_0x303ebd[_0x98bd('0x39')]:_0x52b645['model'];_0x303ebd['order']=qs[_0x98bd('0x3c')](_0x242ce0['query'][_0x98bd('0x3c')]);_0x303ebd[_0x98bd('0x3f')]=qs[_0x98bd('0x35')](_[_0x98bd('0x3d')](_0x242ce0[_0x98bd('0x33')],_0x52b645[_0x98bd('0x35')]));if(_0x242ce0[_0x98bd('0x33')][_0x98bd('0x3e')]){_0x303ebd['where']=_[_0x98bd('0x40')](_0x303ebd['where'],{'$or':_[_0x98bd('0x32')](_0x303ebd[_0x98bd('0x39')],function(_0xd5340d){var _0x4e18f={};_0x4e18f[_0xd5340d]={'$like':'%'+_0x242ce0[_0x98bd('0x33')][_0x98bd('0x3e')]+'%'};return _0x4e18f;})});}_0x303ebd=_[_0x98bd('0x40')]({},_0x303ebd,_0x242ce0[_0x98bd('0x42')]);return _0xb62b99[_0x98bd('0x53')](_0x303ebd);}})[_0x98bd('0x28')](function(_0x198a0c){if(_0x198a0c){_0x28cdfe=_0x198a0c[_0x98bd('0x38')];if(!_0x242ce0['query'][_0x98bd('0x3a')](_0x98bd('0x3b'))){_0x303ebd[_0x98bd('0x21')]=qs[_0x98bd('0x21')](_0x242ce0[_0x98bd('0x33')]['limit']);_0x303ebd[_0x98bd('0x1e')]=qs['offset'](_0x242ce0['query'][_0x98bd('0x1e')]);}return _0xb62b99['getTags'](_0x303ebd);}})[_0x98bd('0x28')](function(_0x204a8c){if(_0x204a8c){return _0x204a8c?{'count':_0x28cdfe,'rows':_0x204a8c}:null;}})['then'](respondWithResult(_0x23ea29,null))[_0x98bd('0x47')](handleError(_0x23ea29,null));};exports['setTags']=function(_0x5cf42c,_0x56fb20,_0x84e73b){if(_0x5cf42c['body']['id']){delete _0x5cf42c[_0x98bd('0x4b')]['id'];}return db['DeskConfiguration'][_0x98bd('0x4e')]({'where':{'id':_0x5cf42c[_0x98bd('0x4c')]['id']}})[_0x98bd('0x28')](handleEntityNotFound(_0x56fb20,null))[_0x98bd('0x28')](function(_0x3a4dae){if(_0x3a4dae){return _0x3a4dae[_0x98bd('0x55')](_0x5cf42c[_0x98bd('0x4b')][_0x98bd('0x56')]||[]);}return null;})[_0x98bd('0x28')](respondWithResult(_0x56fb20,null))['catch'](handleError(_0x56fb20,null));}; \ No newline at end of file +var _0xb809=['count','offset','status','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','order','pick','nolimit','getFields','getSubjects','findOne','DeskField','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','sendStatus','end','json','undefined','limit'];(function(_0x13ba9d,_0x539071){var _0x21c954=function(_0x38479e){while(--_0x38479e){_0x13ba9d['push'](_0x13ba9d['shift']());}};_0x21c954(++_0x539071);}(_0xb809,0x1d5));var _0x9b80=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xb809[_0x4347ec];return _0x4c8314;};'use strict';var emlformat=require(_0x9b80('0x0'));var rimraf=require(_0x9b80('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b80('0x2'));var rp=require(_0x9b80('0x3'));var moment=require(_0x9b80('0x4'));var BPromise=require(_0x9b80('0x5'));var Mustache=require(_0x9b80('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9b80('0x7'));var csv=require(_0x9b80('0x8'));var ejs=require(_0x9b80('0x9'));var fs=require('fs');var fs_extra=require(_0x9b80('0xa'));var _=require(_0x9b80('0xb'));var squel=require(_0x9b80('0xc'));var crypto=require('crypto');var jsforce=require(_0x9b80('0xd'));var deskjs=require(_0x9b80('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9b80('0xf'));var Papa=require(_0x9b80('0x10'));var Redis=require(_0x9b80('0x11'));var authService=require(_0x9b80('0x12'));var qs=require(_0x9b80('0x13'));var as=require(_0x9b80('0x14'));var hardwareService=require(_0x9b80('0x15'));var logger=require('../../config/logger')(_0x9b80('0x16'));var utils=require('../../config/utils');var config=require(_0x9b80('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27cae2,_0x4e0772){_0x4e0772=_0x4e0772||0xcc;return function(_0xab86b9){if(_0xab86b9){return _0x27cae2[_0x9b80('0x18')](_0x4e0772);}return _0x27cae2['status'](_0x4e0772)[_0x9b80('0x19')]();};}function respondWithResult(_0x7124ba,_0x31fd30){_0x31fd30=_0x31fd30||0xc8;return function(_0x52911e){if(_0x52911e){return _0x7124ba['status'](_0x31fd30)[_0x9b80('0x1a')](_0x52911e);}};}function respondWithFilteredResult(_0x13ffbc,_0x11362b){return function(_0x5a90cd){if(_0x5a90cd){var _0x1db8f8=typeof _0x11362b['offset']===_0x9b80('0x1b')&&typeof _0x11362b[_0x9b80('0x1c')]===_0x9b80('0x1b');var _0x25babe=_0x5a90cd[_0x9b80('0x1d')];var _0x49386b=_0x1db8f8?0x0:_0x11362b[_0x9b80('0x1e')];var _0x57eb24=_0x1db8f8?_0x5a90cd['count']:_0x11362b[_0x9b80('0x1e')]+_0x11362b[_0x9b80('0x1c')];var _0xf2de93;if(_0x57eb24>=_0x25babe){_0x57eb24=_0x25babe;_0xf2de93=0xc8;}else{_0xf2de93=0xce;}_0x13ffbc[_0x9b80('0x1f')](_0xf2de93);return _0x13ffbc['set']('Content-Range',_0x49386b+'-'+_0x57eb24+'/'+_0x25babe)[_0x9b80('0x1a')](_0x5a90cd);}return null;};}function patchUpdates(_0x590b78){return function(_0x551c79){try{jsonpatch[_0x9b80('0x20')](_0x551c79,_0x590b78,!![]);}catch(_0x2359d0){return BPromise[_0x9b80('0x21')](_0x2359d0);}return _0x551c79[_0x9b80('0x22')]();};}function saveUpdates(_0x48490b,_0x5ce6a3){return function(_0x1a2cb2){if(_0x1a2cb2){return _0x1a2cb2[_0x9b80('0x23')](_0x48490b)['then'](function(_0x1241d5){return _0x1241d5;});}return null;};}function removeEntity(_0x5ea356,_0x24ff4b){return function(_0x56078d){if(_0x56078d){return _0x56078d[_0x9b80('0x24')]()[_0x9b80('0x25')](function(){_0x5ea356[_0x9b80('0x1f')](0xcc)[_0x9b80('0x19')]();});}};}function handleEntityNotFound(_0xe6b777,_0x1e1537){return function(_0x53e700){if(!_0x53e700){_0xe6b777[_0x9b80('0x18')](0x194);}return _0x53e700;};}function handleError(_0x322dfc,_0x2a80af){_0x2a80af=_0x2a80af||0x1f4;return function(_0x241584){logger[_0x9b80('0x26')](_0x241584[_0x9b80('0x27')]);if(_0x241584[_0x9b80('0x28')]){delete _0x241584[_0x9b80('0x28')];}_0x322dfc['status'](_0x2a80af)[_0x9b80('0x29')](_0x241584);};}exports[_0x9b80('0x2a')]=function(_0x6b50fe,_0x5bf429){var _0x1994d7={},_0x2e6939={},_0x6a09dd={'count':0x0,'rows':[]};var _0x481ea2=_[_0x9b80('0x2b')](db[_0x9b80('0x2c')][_0x9b80('0x2d')],function(_0x2b14e1){return{'name':_0x2b14e1[_0x9b80('0x2e')],'type':_0x2b14e1[_0x9b80('0x2f')][_0x9b80('0x30')]};});_0x2e6939['model']=_[_0x9b80('0x2b')](_0x481ea2,_0x9b80('0x28'));_0x2e6939[_0x9b80('0x31')]=_[_0x9b80('0x32')](_0x6b50fe[_0x9b80('0x31')]);_0x2e6939[_0x9b80('0x33')]=_[_0x9b80('0x34')](_0x2e6939[_0x9b80('0x35')],_0x2e6939[_0x9b80('0x31')]);_0x1994d7[_0x9b80('0x36')]=_[_0x9b80('0x34')](_0x2e6939[_0x9b80('0x35')],qs[_0x9b80('0x37')](_0x6b50fe['query'][_0x9b80('0x37')]));_0x1994d7[_0x9b80('0x36')]=_0x1994d7[_0x9b80('0x36')]['length']?_0x1994d7[_0x9b80('0x36')]:_0x2e6939[_0x9b80('0x35')];if(!_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x38')]('nolimit')){_0x1994d7[_0x9b80('0x1c')]=qs['limit'](_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x1c')]);_0x1994d7[_0x9b80('0x1e')]=qs[_0x9b80('0x1e')](_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x1e')]);}_0x1994d7['order']=qs[_0x9b80('0x39')](_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x39')]);_0x1994d7[_0x9b80('0x3a')]=qs[_0x9b80('0x33')](_['pick'](_0x6b50fe[_0x9b80('0x31')],_0x2e6939['filters']),_0x481ea2);if(_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x3b')]){_0x1994d7['where']=_[_0x9b80('0x3c')](_0x1994d7[_0x9b80('0x3a')],{'$or':_['map'](_0x481ea2,function(_0x3a5ae1){if(_0x3a5ae1[_0x9b80('0x2f')]!==_0x9b80('0x3d')){var _0x45eea5={};_0x45eea5[_0x3a5ae1['name']]={'$like':'%'+_0x6b50fe[_0x9b80('0x31')][_0x9b80('0x3b')]+'%'};return _0x45eea5;}})});}_0x1994d7=_[_0x9b80('0x3c')]({},_0x1994d7,_0x6b50fe[_0x9b80('0x3e')]);var _0x285a79={'where':_0x1994d7['where']};return db[_0x9b80('0x2c')]['count'](_0x285a79)[_0x9b80('0x25')](function(_0x206e92){_0x6a09dd[_0x9b80('0x1d')]=_0x206e92;if(_0x6b50fe['query'][_0x9b80('0x3f')]){_0x1994d7[_0x9b80('0x40')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x1994d7);})['then'](function(_0x12a902){_0x6a09dd['rows']=_0x12a902;return _0x6a09dd;})[_0x9b80('0x25')](respondWithFilteredResult(_0x5bf429,_0x1994d7))[_0x9b80('0x41')](handleError(_0x5bf429,null));};exports[_0x9b80('0x42')]=function(_0x397b36,_0x2a2002){var _0x527483={'raw':![],'where':{'id':_0x397b36[_0x9b80('0x43')]['id']}},_0x440d41={};_0x440d41[_0x9b80('0x35')]=_[_0x9b80('0x32')](db['DeskConfiguration'][_0x9b80('0x2d')]);_0x440d41[_0x9b80('0x31')]=_['keys'](_0x397b36[_0x9b80('0x31')]);_0x440d41['filters']=_[_0x9b80('0x34')](_0x440d41['model'],_0x440d41[_0x9b80('0x31')]);_0x527483[_0x9b80('0x36')]=_[_0x9b80('0x34')](_0x440d41[_0x9b80('0x35')],qs[_0x9b80('0x37')](_0x397b36[_0x9b80('0x31')][_0x9b80('0x37')]));_0x527483['attributes']=_0x527483[_0x9b80('0x36')][_0x9b80('0x44')]?_0x527483[_0x9b80('0x36')]:_0x440d41['model'];if(_0x397b36[_0x9b80('0x31')]['includeAll']){_0x527483[_0x9b80('0x40')]=[{'all':!![]}];}_0x527483=_[_0x9b80('0x3c')]({},_0x527483,_0x397b36[_0x9b80('0x3e')]);return db['DeskConfiguration'][_0x9b80('0x45')](_0x527483)[_0x9b80('0x25')](handleEntityNotFound(_0x2a2002,null))[_0x9b80('0x25')](respondWithResult(_0x2a2002,null))[_0x9b80('0x41')](handleError(_0x2a2002,null));};exports[_0x9b80('0x46')]=function(_0x42f327,_0x1f4a9f){return db[_0x9b80('0x2c')][_0x9b80('0x46')](_0x42f327[_0x9b80('0x47')],{})[_0x9b80('0x25')](respondWithResult(_0x1f4a9f,0xc9))[_0x9b80('0x41')](handleError(_0x1f4a9f,null));};exports[_0x9b80('0x23')]=function(_0xc2c330,_0x5770d9){if(_0xc2c330['body']['id']){delete _0xc2c330['body']['id'];}return db[_0x9b80('0x2c')][_0x9b80('0x45')]({'where':{'id':_0xc2c330['params']['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x5770d9,null))[_0x9b80('0x25')](saveUpdates(_0xc2c330[_0x9b80('0x47')],null))[_0x9b80('0x25')](respondWithResult(_0x5770d9,null))[_0x9b80('0x41')](handleError(_0x5770d9,null));};exports[_0x9b80('0x24')]=function(_0x506cba,_0x48ffc6){return db['DeskConfiguration'][_0x9b80('0x45')]({'where':{'id':_0x506cba[_0x9b80('0x43')]['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x48ffc6,null))['then'](removeEntity(_0x48ffc6,null))[_0x9b80('0x41')](handleError(_0x48ffc6,null));};exports['getFields']=function(_0x4afb65,_0x153332,_0x1c412c){var _0x589a33={};var _0x2115f2={};var _0x343f5a;var _0x32d207;return db[_0x9b80('0x2c')]['findOne']({'where':{'id':_0x4afb65[_0x9b80('0x43')]['id']}})['then'](handleEntityNotFound(_0x153332,null))[_0x9b80('0x25')](function(_0x4c67a0){if(_0x4c67a0){_0x343f5a=_0x4c67a0;_0x2115f2[_0x9b80('0x35')]=_[_0x9b80('0x32')](db['DeskField']['rawAttributes']);_0x2115f2[_0x9b80('0x31')]=_['keys'](_0x4afb65[_0x9b80('0x31')]);_0x2115f2[_0x9b80('0x33')]=_['intersection'](_0x2115f2[_0x9b80('0x35')],_0x2115f2[_0x9b80('0x31')]);_0x589a33[_0x9b80('0x36')]=_['intersection'](_0x2115f2[_0x9b80('0x35')],qs[_0x9b80('0x37')](_0x4afb65['query']['fields']));_0x589a33['attributes']=_0x589a33[_0x9b80('0x36')]['length']?_0x589a33['attributes']:_0x2115f2['model'];_0x589a33[_0x9b80('0x48')]=qs[_0x9b80('0x39')](_0x4afb65[_0x9b80('0x31')][_0x9b80('0x39')]);_0x589a33[_0x9b80('0x3a')]=qs['filters'](_[_0x9b80('0x49')](_0x4afb65[_0x9b80('0x31')],_0x2115f2[_0x9b80('0x33')]));if(_0x4afb65[_0x9b80('0x31')][_0x9b80('0x3b')]){_0x589a33['where']=_['merge'](_0x589a33[_0x9b80('0x3a')],{'$or':_[_0x9b80('0x2b')](_0x589a33[_0x9b80('0x36')],function(_0x439b89){var _0x1c22bd={};_0x1c22bd[_0x439b89]={'$like':'%'+_0x4afb65[_0x9b80('0x31')]['filter']+'%'};return _0x1c22bd;})});}_0x589a33=_[_0x9b80('0x3c')]({},_0x589a33,_0x4afb65['options']);return _0x343f5a['getFields'](_0x589a33);}})[_0x9b80('0x25')](function(_0x32733f){if(_0x32733f){_0x32d207=_0x32733f[_0x9b80('0x44')];if(!_0x4afb65['query'][_0x9b80('0x38')](_0x9b80('0x4a'))){_0x589a33[_0x9b80('0x1c')]=qs[_0x9b80('0x1c')](_0x4afb65[_0x9b80('0x31')]['limit']);_0x589a33[_0x9b80('0x1e')]=qs[_0x9b80('0x1e')](_0x4afb65[_0x9b80('0x31')][_0x9b80('0x1e')]);}return _0x343f5a[_0x9b80('0x4b')](_0x589a33);}})[_0x9b80('0x25')](function(_0x8ed529){if(_0x8ed529){return _0x8ed529?{'count':_0x32d207,'rows':_0x8ed529}:null;}})['then'](respondWithResult(_0x153332,null))[_0x9b80('0x41')](handleError(_0x153332,null));};exports[_0x9b80('0x4c')]=function(_0x306a0a,_0x3772c3,_0x469b54){var _0x5558e5={};var _0xd841f0={};var _0x477a37;var _0x4d1f51;return db[_0x9b80('0x2c')][_0x9b80('0x4d')]({'where':{'id':_0x306a0a[_0x9b80('0x43')]['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x3772c3,null))['then'](function(_0x2c787d){if(_0x2c787d){_0x477a37=_0x2c787d;_0xd841f0[_0x9b80('0x35')]=_[_0x9b80('0x32')](db[_0x9b80('0x4e')][_0x9b80('0x2d')]);_0xd841f0[_0x9b80('0x31')]=_[_0x9b80('0x32')](_0x306a0a[_0x9b80('0x31')]);_0xd841f0[_0x9b80('0x33')]=_['intersection'](_0xd841f0['model'],_0xd841f0[_0x9b80('0x31')]);_0x5558e5[_0x9b80('0x36')]=_[_0x9b80('0x34')](_0xd841f0[_0x9b80('0x35')],qs[_0x9b80('0x37')](_0x306a0a[_0x9b80('0x31')]['fields']));_0x5558e5[_0x9b80('0x36')]=_0x5558e5[_0x9b80('0x36')][_0x9b80('0x44')]?_0x5558e5['attributes']:_0xd841f0[_0x9b80('0x35')];_0x5558e5[_0x9b80('0x48')]=qs['sort'](_0x306a0a[_0x9b80('0x31')][_0x9b80('0x39')]);_0x5558e5[_0x9b80('0x3a')]=qs[_0x9b80('0x33')](_[_0x9b80('0x49')](_0x306a0a['query'],_0xd841f0['filters']));if(_0x306a0a[_0x9b80('0x31')][_0x9b80('0x3b')]){_0x5558e5[_0x9b80('0x3a')]=_[_0x9b80('0x3c')](_0x5558e5['where'],{'$or':_['map'](_0x5558e5[_0x9b80('0x36')],function(_0x37aeb1){var _0x46b85f={};_0x46b85f[_0x37aeb1]={'$like':'%'+_0x306a0a['query'][_0x9b80('0x3b')]+'%'};return _0x46b85f;})});}_0x5558e5=_[_0x9b80('0x3c')]({},_0x5558e5,_0x306a0a['options']);return _0x477a37[_0x9b80('0x4c')](_0x5558e5);}})[_0x9b80('0x25')](function(_0x29d55e){if(_0x29d55e){_0x4d1f51=_0x29d55e['length'];if(!_0x306a0a[_0x9b80('0x31')][_0x9b80('0x38')](_0x9b80('0x4a'))){_0x5558e5[_0x9b80('0x1c')]=qs['limit'](_0x306a0a['query'][_0x9b80('0x1c')]);_0x5558e5['offset']=qs[_0x9b80('0x1e')](_0x306a0a[_0x9b80('0x31')]['offset']);}return _0x477a37[_0x9b80('0x4c')](_0x5558e5);}})[_0x9b80('0x25')](function(_0x52ad2c){if(_0x52ad2c){return _0x52ad2c?{'count':_0x4d1f51,'rows':_0x52ad2c}:null;}})['then'](respondWithResult(_0x3772c3,null))[_0x9b80('0x41')](handleError(_0x3772c3,null));};exports[_0x9b80('0x4f')]=function(_0x27d3cc,_0x24eb4f,_0x150474){var _0x9f4999={};var _0x5489b6={};var _0x33ceeb;var _0x46d6ce;return db['DeskConfiguration'][_0x9b80('0x4d')]({'where':{'id':_0x27d3cc['params']['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x24eb4f,null))['then'](function(_0x3d933f){if(_0x3d933f){_0x33ceeb=_0x3d933f;_0x5489b6['model']=_[_0x9b80('0x32')](db['DeskField'][_0x9b80('0x2d')]);_0x5489b6[_0x9b80('0x31')]=_[_0x9b80('0x32')](_0x27d3cc[_0x9b80('0x31')]);_0x5489b6[_0x9b80('0x33')]=_[_0x9b80('0x34')](_0x5489b6[_0x9b80('0x35')],_0x5489b6[_0x9b80('0x31')]);_0x9f4999[_0x9b80('0x36')]=_[_0x9b80('0x34')](_0x5489b6[_0x9b80('0x35')],qs[_0x9b80('0x37')](_0x27d3cc[_0x9b80('0x31')]['fields']));_0x9f4999['attributes']=_0x9f4999[_0x9b80('0x36')][_0x9b80('0x44')]?_0x9f4999[_0x9b80('0x36')]:_0x5489b6[_0x9b80('0x35')];_0x9f4999[_0x9b80('0x48')]=qs[_0x9b80('0x39')](_0x27d3cc[_0x9b80('0x31')][_0x9b80('0x39')]);_0x9f4999[_0x9b80('0x3a')]=qs[_0x9b80('0x33')](_['pick'](_0x27d3cc[_0x9b80('0x31')],_0x5489b6['filters']));if(_0x27d3cc['query'][_0x9b80('0x3b')]){_0x9f4999[_0x9b80('0x3a')]=_[_0x9b80('0x3c')](_0x9f4999[_0x9b80('0x3a')],{'$or':_[_0x9b80('0x2b')](_0x9f4999[_0x9b80('0x36')],function(_0x19f71d){var _0xdf58f5={};_0xdf58f5[_0x19f71d]={'$like':'%'+_0x27d3cc[_0x9b80('0x31')][_0x9b80('0x3b')]+'%'};return _0xdf58f5;})});}_0x9f4999=_[_0x9b80('0x3c')]({},_0x9f4999,_0x27d3cc[_0x9b80('0x3e')]);return _0x33ceeb['getDescriptions'](_0x9f4999);}})[_0x9b80('0x25')](function(_0x56431f){if(_0x56431f){_0x46d6ce=_0x56431f[_0x9b80('0x44')];if(!_0x27d3cc[_0x9b80('0x31')]['hasOwnProperty'](_0x9b80('0x4a'))){_0x9f4999['limit']=qs['limit'](_0x27d3cc[_0x9b80('0x31')][_0x9b80('0x1c')]);_0x9f4999[_0x9b80('0x1e')]=qs[_0x9b80('0x1e')](_0x27d3cc[_0x9b80('0x31')]['offset']);}return _0x33ceeb[_0x9b80('0x4f')](_0x9f4999);}})[_0x9b80('0x25')](function(_0xb9ff){if(_0xb9ff){return _0xb9ff?{'count':_0x46d6ce,'rows':_0xb9ff}:null;}})['then'](respondWithResult(_0x24eb4f,null))[_0x9b80('0x41')](handleError(_0x24eb4f,null));};exports[_0x9b80('0x50')]=function(_0x4e3f8a,_0x57f203,_0xa0c9e){var _0xcca657={};var _0x2f306a={};var _0x53dad7;var _0x50a1b3;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4e3f8a['params']['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x57f203,null))['then'](function(_0x1a81ed){if(_0x1a81ed){_0x53dad7=_0x1a81ed;_0x2f306a[_0x9b80('0x35')]=_[_0x9b80('0x32')](db['Tag'][_0x9b80('0x2d')]);_0x2f306a[_0x9b80('0x31')]=_[_0x9b80('0x32')](_0x4e3f8a[_0x9b80('0x31')]);_0x2f306a[_0x9b80('0x33')]=_[_0x9b80('0x34')](_0x2f306a[_0x9b80('0x35')],_0x2f306a[_0x9b80('0x31')]);_0xcca657[_0x9b80('0x36')]=_['intersection'](_0x2f306a[_0x9b80('0x35')],qs['fields'](_0x4e3f8a[_0x9b80('0x31')][_0x9b80('0x37')]));_0xcca657[_0x9b80('0x36')]=_0xcca657['attributes'][_0x9b80('0x44')]?_0xcca657['attributes']:_0x2f306a[_0x9b80('0x35')];_0xcca657[_0x9b80('0x48')]=qs[_0x9b80('0x39')](_0x4e3f8a[_0x9b80('0x31')][_0x9b80('0x39')]);_0xcca657[_0x9b80('0x3a')]=qs[_0x9b80('0x33')](_['pick'](_0x4e3f8a[_0x9b80('0x31')],_0x2f306a[_0x9b80('0x33')]));if(_0x4e3f8a['query'][_0x9b80('0x3b')]){_0xcca657[_0x9b80('0x3a')]=_[_0x9b80('0x3c')](_0xcca657[_0x9b80('0x3a')],{'$or':_[_0x9b80('0x2b')](_0xcca657[_0x9b80('0x36')],function(_0x59ff78){var _0x3693dd={};_0x3693dd[_0x59ff78]={'$like':'%'+_0x4e3f8a[_0x9b80('0x31')]['filter']+'%'};return _0x3693dd;})});}_0xcca657=_[_0x9b80('0x3c')]({},_0xcca657,_0x4e3f8a[_0x9b80('0x3e')]);return _0x53dad7[_0x9b80('0x50')](_0xcca657);}})[_0x9b80('0x25')](function(_0x212343){if(_0x212343){_0x50a1b3=_0x212343[_0x9b80('0x44')];if(!_0x4e3f8a[_0x9b80('0x31')][_0x9b80('0x38')](_0x9b80('0x4a'))){_0xcca657['limit']=qs['limit'](_0x4e3f8a[_0x9b80('0x31')][_0x9b80('0x1c')]);_0xcca657[_0x9b80('0x1e')]=qs[_0x9b80('0x1e')](_0x4e3f8a['query'][_0x9b80('0x1e')]);}return _0x53dad7[_0x9b80('0x50')](_0xcca657);}})['then'](function(_0x50862b){if(_0x50862b){return _0x50862b?{'count':_0x50a1b3,'rows':_0x50862b}:null;}})['then'](respondWithResult(_0x57f203,null))[_0x9b80('0x41')](handleError(_0x57f203,null));};exports['setTags']=function(_0x539fe7,_0x5cb7f8,_0x44e20d){if(_0x539fe7[_0x9b80('0x47')]['id']){delete _0x539fe7[_0x9b80('0x47')]['id'];}return db[_0x9b80('0x2c')][_0x9b80('0x4d')]({'where':{'id':_0x539fe7[_0x9b80('0x43')]['id']}})[_0x9b80('0x25')](handleEntityNotFound(_0x5cb7f8,null))[_0x9b80('0x25')](function(_0x4318fe){if(_0x4318fe){return _0x4318fe[_0x9b80('0x51')](_0x539fe7['body'][_0x9b80('0x52')]||[]);}return null;})['then'](respondWithResult(_0x5cb7f8,null))[_0x9b80('0x41')](handleError(_0x5cb7f8,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3ed16e8..265dd90 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 _0x8a11=['api','bluebird','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x58d092,_0x36a559){var _0xe2d411=function(_0x3b3c34){while(--_0x3b3c34){_0x58d092['push'](_0x58d092['shift']());}};_0xe2d411(++_0x36a559);}(_0x8a11,0x196));var _0x18a1=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x8a11[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var logger=require('../../config/logger')(_0x18a1('0x2'));var moment=require('moment');var BPromise=require(_0x18a1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18a1('0x4'));var rimraf=require(_0x18a1('0x5'));var config=require(_0x18a1('0x6'));var attributes=require(_0x18a1('0x7'));module[_0x18a1('0x8')]=function(_0x24f96a,_0x277164){return _0x24f96a[_0x18a1('0x9')](_0x18a1('0xa'),attributes,{'tableName':_0x18a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71e2=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','DeskConfiguration','int_desk_configurations','util'];(function(_0x335986,_0x2225b0){var _0x4520af=function(_0x58046d){while(--_0x58046d){_0x335986['push'](_0x335986['shift']());}};_0x4520af(++_0x2225b0);}(_0x71e2,0x99));var _0x271e=function(_0x239804,_0x5adcea){_0x239804=_0x239804-0x0;var _0x5ab826=_0x71e2[_0x239804];return _0x5ab826;};'use strict';var _=require('lodash');var util=require(_0x271e('0x0'));var logger=require(_0x271e('0x1'))(_0x271e('0x2'));var moment=require(_0x271e('0x3'));var BPromise=require('bluebird');var rp=require(_0x271e('0x4'));var fs=require('fs');var path=require(_0x271e('0x5'));var rimraf=require(_0x271e('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x271e('0x7')]=function(_0x48dc14,_0x7fa8cb){return _0x48dc14[_0x271e('0x8')](_0x271e('0x9'),attributes,{'tableName':_0x271e('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 d71e203..f500376 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 _0xc132=['client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5bfa8b,_0x25ade1){var _0x43a9c2=function(_0x4e6783){while(--_0x4e6783){_0x5bfa8b['push'](_0x5bfa8b['shift']());}};_0x43a9c2(++_0x25ade1);}(_0xc132,0x11e));var _0x2c13=function(_0x39d6ca,_0x400091){_0x39d6ca=_0x39d6ca-0x0;var _0x59ef7a=_0xc132[_0x39d6ca];return _0x59ef7a;};'use strict';var _=require(_0x2c13('0x0'));var util=require(_0x2c13('0x1'));var moment=require(_0x2c13('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c13('0x3'));var db=require(_0x2c13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2c13('0x5'))('rpc');var config=require(_0x2c13('0x6'));var jayson=require(_0x2c13('0x7'));var client=jayson[_0x2c13('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41581e,_0x3bc603,_0x591296){return new BPromise(function(_0x4d98aa,_0x25cc6c){return client[_0x2c13('0x9')](_0x41581e,_0x591296)[_0x2c13('0xa')](function(_0x3c2a5a){logger[_0x2c13('0xb')](_0x2c13('0xc'),_0x3bc603,_0x2c13('0xd'));logger[_0x2c13('0xe')](_0x2c13('0xf'),_0x3bc603,'request\x20sent',JSON['stringify'](_0x3c2a5a));if(_0x3c2a5a[_0x2c13('0x10')]){if(_0x3c2a5a[_0x2c13('0x10')][_0x2c13('0x11')]===0x1f4){logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x3c2a5a[_0x2c13('0x10')]['message']);return _0x25cc6c(_0x3c2a5a[_0x2c13('0x10')]['message']);}logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x3c2a5a[_0x2c13('0x10')]['message']);return _0x4d98aa(_0x3c2a5a[_0x2c13('0x10')][_0x2c13('0x12')]);}else{logger['info'](_0x2c13('0xc'),_0x3bc603,_0x2c13('0xd'));_0x4d98aa(_0x3c2a5a[_0x2c13('0x13')][_0x2c13('0x12')]);}})[_0x2c13('0x14')](function(_0x44c9af){logger[_0x2c13('0x10')](_0x2c13('0xc'),_0x3bc603,_0x44c9af);_0x25cc6c(_0x44c9af);});});} \ No newline at end of file +var _0x552c=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x13b2a7,_0x3fc11a){var _0x282bff=function(_0x517dfd){while(--_0x517dfd){_0x13b2a7['push'](_0x13b2a7['shift']());}};_0x282bff(++_0x3fc11a);}(_0x552c,0xa0));var _0xc552=function(_0x5d2f0c,_0x2d0172){_0x5d2f0c=_0x5d2f0c-0x0;var _0xa5f33f=_0x552c[_0x5d2f0c];return _0xa5f33f;};'use strict';var _=require('lodash');var util=require(_0xc552('0x0'));var moment=require(_0xc552('0x1'));var BPromise=require(_0xc552('0x2'));var rs=require(_0xc552('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc552('0x4'));var jayson=require(_0xc552('0x5'));var client=jayson[_0xc552('0x6')][_0xc552('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c383d,_0x1e52ea,_0xea3322){return new BPromise(function(_0x3cb4d3,_0x568306){return client[_0xc552('0x8')](_0x1c383d,_0xea3322)['then'](function(_0x437317){logger['info'](_0xc552('0x9'),_0x1e52ea,_0xc552('0xa'));logger[_0xc552('0xb')](_0xc552('0xc'),_0x1e52ea,'request\x20sent',JSON[_0xc552('0xd')](_0x437317));if(_0x437317[_0xc552('0xe')]){if(_0x437317[_0xc552('0xe')][_0xc552('0xf')]===0x1f4){logger['error'](_0xc552('0x9'),_0x1e52ea,_0x437317[_0xc552('0xe')][_0xc552('0x10')]);return _0x568306(_0x437317[_0xc552('0xe')][_0xc552('0x10')]);}logger['error'](_0xc552('0x9'),_0x1e52ea,_0x437317[_0xc552('0xe')][_0xc552('0x10')]);return _0x3cb4d3(_0x437317['error'][_0xc552('0x10')]);}else{logger['info'](_0xc552('0x9'),_0x1e52ea,'request\x20sent');_0x3cb4d3(_0x437317[_0xc552('0x11')][_0xc552('0x10')]);}})[_0xc552('0x12')](function(_0x26ae4e){logger[_0xc552('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x1e52ea,_0x26ae4e);_0x568306(_0x26ae4e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3e769dc..fc979be 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 _0xc60c=['update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc60c,0x109));var _0xcc60=function(_0x4d5cac,_0x5bf7bd){_0x4d5cac=_0x4d5cac-0x0;var _0x513307=_0xc60c[_0x4d5cac];return _0x513307;};'use strict';var multer=require(_0xcc60('0x0'));var util=require('util');var path=require(_0xcc60('0x1'));var timeout=require(_0xcc60('0x2'));var express=require(_0xcc60('0x3'));var router=express[_0xcc60('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcc60('0x5'));var interaction=require(_0xcc60('0x6'));var config=require('../../config/environment');var controller=require(_0xcc60('0x7'));router[_0xcc60('0x8')]('/',auth[_0xcc60('0x9')](),controller[_0xcc60('0xa')]);router['get']('/:id',auth[_0xcc60('0x9')](),controller[_0xcc60('0xb')]);router[_0xcc60('0xc')]('/',auth[_0xcc60('0x9')](),controller[_0xcc60('0xd')]);router[_0xcc60('0xe')]('/:id',auth[_0xcc60('0x9')](),controller[_0xcc60('0xf')]);router[_0xcc60('0x10')](_0xcc60('0x11'),auth[_0xcc60('0x9')](),controller[_0xcc60('0x12')]);module[_0xcc60('0x13')]=router; \ No newline at end of file +var _0xb2ed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x101713,_0x5fd5cd){var _0x22dab7=function(_0x319850){while(--_0x319850){_0x101713['push'](_0x101713['shift']());}};_0x22dab7(++_0x5fd5cd);}(_0xb2ed,0x86));var _0xdb2e=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0xb2ed[_0x3d9176];return _0x12adc5;};'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/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d4bbfb6..fc774a4 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 _0xa54d=['sequelize','exports','string','customVariable','keyValue','picklist','variable','STRING','BOOLEAN'];(function(_0x4f87d6,_0x49c366){var _0x4ccb54=function(_0x16cb67){while(--_0x16cb67){_0x4f87d6['push'](_0x4f87d6['shift']());}};_0x4ccb54(++_0x49c366);}(_0xa54d,0xfc));var _0xda54=function(_0x5390b3,_0x3648d8){_0x5390b3=_0x5390b3-0x0;var _0x3f04cb=_0xa54d[_0x5390b3];return _0x3f04cb;};'use strict';var Sequelize=require(_0xda54('0x0'));module[_0xda54('0x1')]={'type':{'type':Sequelize['ENUM'](_0xda54('0x2'),'variable',_0xda54('0x3'),_0xda54('0x4'),_0xda54('0x5')),'defaultValue':_0xda54('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xda54('0x6'),_0xda54('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xda54('0x7')]},'nameField':{'type':Sequelize[_0xda54('0x7')]},'customField':{'type':Sequelize[_0xda54('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xda54('0x7')]}}; \ No newline at end of file +var _0x3ea5=['variable','customVariable','keyValue','STRING','ENUM','sequelize','exports','string'];(function(_0xd64ea1,_0x5a40d9){var _0x11a857=function(_0x32b046){while(--_0x32b046){_0xd64ea1['push'](_0xd64ea1['shift']());}};_0x11a857(++_0x5a40d9);}(_0x3ea5,0xe5));var _0x53ea=function(_0x3efbc0,_0x3d627c){_0x3efbc0=_0x3efbc0-0x0;var _0x19b805=_0x3ea5[_0x3efbc0];return _0x19b805;};'use strict';var Sequelize=require(_0x53ea('0x0'));module[_0x53ea('0x1')]={'type':{'type':Sequelize['ENUM'](_0x53ea('0x2'),_0x53ea('0x3'),_0x53ea('0x4'),_0x53ea('0x5'),'picklist'),'defaultValue':_0x53ea('0x2')},'content':{'type':Sequelize[_0x53ea('0x6')]},'key':{'type':Sequelize[_0x53ea('0x6')]},'keyType':{'type':Sequelize[_0x53ea('0x7')](_0x53ea('0x2'),_0x53ea('0x3'),_0x53ea('0x4'))},'keyContent':{'type':Sequelize[_0x53ea('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x53ea('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x53ea('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 707a20c..adb527f 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 _0x9b97=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','DeskField','includeAll','include','findAll','rows','rawAttributes','keys','intersection','length','find','catch','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x9b97,0x11e));var _0x79b9=function(_0x5cc8bc,_0x522d27){_0x5cc8bc=_0x5cc8bc-0x0;var _0x180720=_0x9b97[_0x5cc8bc];return _0x180720;};'use strict';var emlformat=require(_0x79b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79b9('0x1'));var jsonpatch=require(_0x79b9('0x2'));var rp=require(_0x79b9('0x3'));var moment=require(_0x79b9('0x4'));var BPromise=require(_0x79b9('0x5'));var Mustache=require(_0x79b9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b9('0x7'));var csv=require(_0x79b9('0x8'));var ejs=require(_0x79b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79b9('0xa'));var squel=require(_0x79b9('0xb'));var crypto=require('crypto');var jsforce=require(_0x79b9('0xc'));var deskjs=require(_0x79b9('0xd'));var toCsv=require(_0x79b9('0x8'));var querystring=require(_0x79b9('0xe'));var Papa=require(_0x79b9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x79b9('0x10'));var as=require(_0x79b9('0x11'));var hardwareService=require(_0x79b9('0x12'));var logger=require(_0x79b9('0x13'))(_0x79b9('0x14'));var utils=require(_0x79b9('0x15'));var config=require(_0x79b9('0x16'));var licenseUtil=require(_0x79b9('0x17'));var db=require(_0x79b9('0x18'))['db'];function respondWithStatusCode(_0xc0f6ae,_0x3f0a9e){_0x3f0a9e=_0x3f0a9e||0xcc;return function(_0x51682c){if(_0x51682c){return _0xc0f6ae[_0x79b9('0x19')](_0x3f0a9e);}return _0xc0f6ae[_0x79b9('0x1a')](_0x3f0a9e)['end']();};}function respondWithResult(_0x548f65,_0x4f90fe){_0x4f90fe=_0x4f90fe||0xc8;return function(_0x2e175d){if(_0x2e175d){return _0x548f65[_0x79b9('0x1a')](_0x4f90fe)[_0x79b9('0x1b')](_0x2e175d);}};}function respondWithFilteredResult(_0xbf8150,_0x398977){return function(_0x4fad8e){if(_0x4fad8e){var _0x4e465a=typeof _0x398977[_0x79b9('0x1c')]===_0x79b9('0x1d')&&typeof _0x398977[_0x79b9('0x1e')]===_0x79b9('0x1d');var _0x5917ab=_0x4fad8e[_0x79b9('0x1f')];var _0x621505=_0x4e465a?0x0:_0x398977['offset'];var _0x54dc9d=_0x4e465a?_0x4fad8e[_0x79b9('0x1f')]:_0x398977['offset']+_0x398977['limit'];var _0x5e1572;if(_0x54dc9d>=_0x5917ab){_0x54dc9d=_0x5917ab;_0x5e1572=0xc8;}else{_0x5e1572=0xce;}_0xbf8150[_0x79b9('0x1a')](_0x5e1572);return _0xbf8150[_0x79b9('0x20')]('Content-Range',_0x621505+'-'+_0x54dc9d+'/'+_0x5917ab)[_0x79b9('0x1b')](_0x4fad8e);}return null;};}function patchUpdates(_0x26f60c){return function(_0x2de174){try{jsonpatch[_0x79b9('0x21')](_0x2de174,_0x26f60c,!![]);}catch(_0x58b88c){return BPromise[_0x79b9('0x22')](_0x58b88c);}return _0x2de174[_0x79b9('0x23')]();};}function saveUpdates(_0x16cb83,_0x25006f){return function(_0x2dcf13){if(_0x2dcf13){return _0x2dcf13[_0x79b9('0x24')](_0x16cb83)[_0x79b9('0x25')](function(_0x50d357){return _0x50d357;});}return null;};}function removeEntity(_0xdd133f,_0x2399fa){return function(_0x495971){if(_0x495971){return _0x495971['destroy']()[_0x79b9('0x25')](function(){_0xdd133f[_0x79b9('0x1a')](0xcc)[_0x79b9('0x26')]();});}};}function handleEntityNotFound(_0x59ae09,_0x2ee1e4){return function(_0x3fd9d2){if(!_0x3fd9d2){_0x59ae09[_0x79b9('0x19')](0x194);}return _0x3fd9d2;};}function handleError(_0xa213d3,_0x400677){_0x400677=_0x400677||0x1f4;return function(_0x186764){logger[_0x79b9('0x27')](_0x186764[_0x79b9('0x28')]);if(_0x186764[_0x79b9('0x29')]){delete _0x186764[_0x79b9('0x29')];}_0xa213d3[_0x79b9('0x1a')](_0x400677)[_0x79b9('0x2a')](_0x186764);};}exports[_0x79b9('0x2b')]=function(_0x1bfadb,_0x322d7e){var _0x8f0513={},_0x12d87e={},_0x1d307f={'count':0x0,'rows':[]};var _0x531e7f=_[_0x79b9('0x2c')](db['DeskField']['rawAttributes'],function(_0x4edc64){return{'name':_0x4edc64[_0x79b9('0x2d')],'type':_0x4edc64[_0x79b9('0x2e')][_0x79b9('0x2f')]};});_0x12d87e[_0x79b9('0x30')]=_['map'](_0x531e7f,'name');_0x12d87e[_0x79b9('0x31')]=_['keys'](_0x1bfadb['query']);_0x12d87e[_0x79b9('0x32')]=_['intersection'](_0x12d87e[_0x79b9('0x30')],_0x12d87e[_0x79b9('0x31')]);_0x8f0513['attributes']=_['intersection'](_0x12d87e[_0x79b9('0x30')],qs[_0x79b9('0x33')](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x33')]));_0x8f0513[_0x79b9('0x34')]=_0x8f0513['attributes']['length']?_0x8f0513['attributes']:_0x12d87e[_0x79b9('0x30')];if(!_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x35')](_0x79b9('0x36'))){_0x8f0513[_0x79b9('0x1e')]=qs[_0x79b9('0x1e')](_0x1bfadb[_0x79b9('0x31')]['limit']);_0x8f0513[_0x79b9('0x1c')]=qs['offset'](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x1c')]);}_0x8f0513[_0x79b9('0x37')]=qs['sort'](_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x38')]);_0x8f0513[_0x79b9('0x39')]=qs[_0x79b9('0x32')](_['pick'](_0x1bfadb['query'],_0x12d87e[_0x79b9('0x32')]),_0x531e7f);if(_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x3a')]){_0x8f0513[_0x79b9('0x39')]=_['merge'](_0x8f0513[_0x79b9('0x39')],{'$or':_['map'](_0x531e7f,function(_0x5e71f2){if(_0x5e71f2[_0x79b9('0x2e')]!==_0x79b9('0x3b')){var _0x4d5187={};_0x4d5187[_0x5e71f2[_0x79b9('0x29')]]={'$like':'%'+_0x1bfadb[_0x79b9('0x31')][_0x79b9('0x3a')]+'%'};return _0x4d5187;}})});}_0x8f0513=_[_0x79b9('0x3c')]({},_0x8f0513,_0x1bfadb[_0x79b9('0x3d')]);var _0x5bc1de={'where':_0x8f0513[_0x79b9('0x39')]};return db[_0x79b9('0x3e')]['count'](_0x5bc1de)['then'](function(_0x2eab0d){_0x1d307f[_0x79b9('0x1f')]=_0x2eab0d;if(_0x1bfadb['query'][_0x79b9('0x3f')]){_0x8f0513[_0x79b9('0x40')]=[{'all':!![]}];}return db[_0x79b9('0x3e')][_0x79b9('0x41')](_0x8f0513);})[_0x79b9('0x25')](function(_0xbabbce){_0x1d307f[_0x79b9('0x42')]=_0xbabbce;return _0x1d307f;})[_0x79b9('0x25')](respondWithFilteredResult(_0x322d7e,_0x8f0513))['catch'](handleError(_0x322d7e,null));};exports['show']=function(_0x53563c,_0xe21f32){var _0x1125ec={'raw':!![],'where':{'id':_0x53563c['params']['id']}},_0x17f05f={};_0x17f05f['model']=_['keys'](db['DeskField'][_0x79b9('0x43')]);_0x17f05f[_0x79b9('0x31')]=_[_0x79b9('0x44')](_0x53563c[_0x79b9('0x31')]);_0x17f05f[_0x79b9('0x32')]=_['intersection'](_0x17f05f[_0x79b9('0x30')],_0x17f05f[_0x79b9('0x31')]);_0x1125ec[_0x79b9('0x34')]=_[_0x79b9('0x45')](_0x17f05f[_0x79b9('0x30')],qs[_0x79b9('0x33')](_0x53563c[_0x79b9('0x31')][_0x79b9('0x33')]));_0x1125ec[_0x79b9('0x34')]=_0x1125ec[_0x79b9('0x34')][_0x79b9('0x46')]?_0x1125ec[_0x79b9('0x34')]:_0x17f05f[_0x79b9('0x30')];if(_0x53563c[_0x79b9('0x31')][_0x79b9('0x3f')]){_0x1125ec[_0x79b9('0x40')]=[{'all':!![]}];}_0x1125ec=_[_0x79b9('0x3c')]({},_0x1125ec,_0x53563c[_0x79b9('0x3d')]);return db[_0x79b9('0x3e')][_0x79b9('0x47')](_0x1125ec)[_0x79b9('0x25')](handleEntityNotFound(_0xe21f32,null))[_0x79b9('0x25')](respondWithResult(_0xe21f32,null))[_0x79b9('0x48')](handleError(_0xe21f32,null));};exports[_0x79b9('0x49')]=function(_0x3f972e,_0xca2ca8){return db[_0x79b9('0x3e')]['create'](_0x3f972e[_0x79b9('0x4a')],{})[_0x79b9('0x25')](respondWithResult(_0xca2ca8,0xc9))['catch'](handleError(_0xca2ca8,null));};exports[_0x79b9('0x24')]=function(_0x5bc93f,_0x151cb0){if(_0x5bc93f['body']['id']){delete _0x5bc93f[_0x79b9('0x4a')]['id'];}return db[_0x79b9('0x3e')]['find']({'where':{'id':_0x5bc93f[_0x79b9('0x4b')]['id']}})[_0x79b9('0x25')](handleEntityNotFound(_0x151cb0,null))[_0x79b9('0x25')](saveUpdates(_0x5bc93f[_0x79b9('0x4a')],null))['then'](respondWithResult(_0x151cb0,null))[_0x79b9('0x48')](handleError(_0x151cb0,null));};exports[_0x79b9('0x4c')]=function(_0x1b8d57,_0x3fdde0){return db[_0x79b9('0x3e')][_0x79b9('0x47')]({'where':{'id':_0x1b8d57[_0x79b9('0x4b')]['id']}})[_0x79b9('0x25')](handleEntityNotFound(_0x3fdde0,null))['then'](removeEntity(_0x3fdde0,null))[_0x79b9('0x48')](handleError(_0x3fdde0,null));}; \ No newline at end of file +var _0x7919=['nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','show','rawAttributes','includeAll','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','name','map','DeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x1745df,_0x44077b){var _0x39e1d5=function(_0x1fb197){while(--_0x1fb197){_0x1745df['push'](_0x1745df['shift']());}};_0x39e1d5(++_0x44077b);}(_0x7919,0xeb));var _0x9791=function(_0x221e05,_0x15b733){_0x221e05=_0x221e05-0x0;var _0x27770c=_0x7919[_0x221e05];return _0x27770c;};'use strict';var emlformat=require(_0x9791('0x0'));var rimraf=require(_0x9791('0x1'));var zipdir=require(_0x9791('0x2'));var jsonpatch=require(_0x9791('0x3'));var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require('mustache');var util=require(_0x9791('0x7'));var path=require(_0x9791('0x8'));var sox=require('sox');var csv=require(_0x9791('0x9'));var ejs=require(_0x9791('0xa'));var fs=require('fs');var fs_extra=require(_0x9791('0xb'));var _=require(_0x9791('0xc'));var squel=require(_0x9791('0xd'));var crypto=require('crypto');var jsforce=require(_0x9791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9791('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9791('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9791('0x10'));var as=require(_0x9791('0x11'));var hardwareService=require(_0x9791('0x12'));var logger=require(_0x9791('0x13'))(_0x9791('0x14'));var utils=require(_0x9791('0x15'));var config=require(_0x9791('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9791('0x17'))['db'];function respondWithStatusCode(_0x54b75d,_0xa2d583){_0xa2d583=_0xa2d583||0xcc;return function(_0x3dc66b){if(_0x3dc66b){return _0x54b75d['sendStatus'](_0xa2d583);}return _0x54b75d[_0x9791('0x18')](_0xa2d583)['end']();};}function respondWithResult(_0x197e83,_0x4602fc){_0x4602fc=_0x4602fc||0xc8;return function(_0x1e05a2){if(_0x1e05a2){return _0x197e83[_0x9791('0x18')](_0x4602fc)[_0x9791('0x19')](_0x1e05a2);}};}function respondWithFilteredResult(_0x1672d9,_0x2bd7a6){return function(_0x3e1eca){if(_0x3e1eca){var _0x1b3626=typeof _0x2bd7a6[_0x9791('0x1a')]===_0x9791('0x1b')&&typeof _0x2bd7a6[_0x9791('0x1c')]===_0x9791('0x1b');var _0x566a69=_0x3e1eca[_0x9791('0x1d')];var _0x402c83=_0x1b3626?0x0:_0x2bd7a6[_0x9791('0x1a')];var _0x2962ae=_0x1b3626?_0x3e1eca[_0x9791('0x1d')]:_0x2bd7a6['offset']+_0x2bd7a6[_0x9791('0x1c')];var _0x6d90c9;if(_0x2962ae>=_0x566a69){_0x2962ae=_0x566a69;_0x6d90c9=0xc8;}else{_0x6d90c9=0xce;}_0x1672d9[_0x9791('0x18')](_0x6d90c9);return _0x1672d9[_0x9791('0x1e')](_0x9791('0x1f'),_0x402c83+'-'+_0x2962ae+'/'+_0x566a69)[_0x9791('0x19')](_0x3e1eca);}return null;};}function patchUpdates(_0x36e5f7){return function(_0x377ec9){try{jsonpatch[_0x9791('0x20')](_0x377ec9,_0x36e5f7,!![]);}catch(_0x27a5e4){return BPromise[_0x9791('0x21')](_0x27a5e4);}return _0x377ec9['save']();};}function saveUpdates(_0x2d29f8,_0x4ec262){return function(_0x4fe98f){if(_0x4fe98f){return _0x4fe98f[_0x9791('0x22')](_0x2d29f8)[_0x9791('0x23')](function(_0x557e2b){return _0x557e2b;});}return null;};}function removeEntity(_0x189251,_0x72e127){return function(_0x7f08c8){if(_0x7f08c8){return _0x7f08c8['destroy']()[_0x9791('0x23')](function(){_0x189251[_0x9791('0x18')](0xcc)[_0x9791('0x24')]();});}};}function handleEntityNotFound(_0x4c3c00,_0x1c188b){return function(_0x5264b6){if(!_0x5264b6){_0x4c3c00[_0x9791('0x25')](0x194);}return _0x5264b6;};}function handleError(_0x15beb8,_0x50760e){_0x50760e=_0x50760e||0x1f4;return function(_0x852e59){logger['error'](_0x852e59[_0x9791('0x26')]);if(_0x852e59['name']){delete _0x852e59[_0x9791('0x27')];}_0x15beb8[_0x9791('0x18')](_0x50760e)['send'](_0x852e59);};}exports['index']=function(_0x55614a,_0x339932){var _0x228703={},_0x24bb84={},_0xf84fe3={'count':0x0,'rows':[]};var _0x52a5d7=_[_0x9791('0x28')](db[_0x9791('0x29')]['rawAttributes'],function(_0x1814fa){return{'name':_0x1814fa[_0x9791('0x2a')],'type':_0x1814fa[_0x9791('0x2b')][_0x9791('0x2c')]};});_0x24bb84[_0x9791('0x2d')]=_[_0x9791('0x28')](_0x52a5d7,'name');_0x24bb84[_0x9791('0x2e')]=_[_0x9791('0x2f')](_0x55614a[_0x9791('0x2e')]);_0x24bb84['filters']=_[_0x9791('0x30')](_0x24bb84['model'],_0x24bb84[_0x9791('0x2e')]);_0x228703['attributes']=_['intersection'](_0x24bb84[_0x9791('0x2d')],qs['fields'](_0x55614a[_0x9791('0x2e')][_0x9791('0x31')]));_0x228703['attributes']=_0x228703[_0x9791('0x32')][_0x9791('0x33')]?_0x228703[_0x9791('0x32')]:_0x24bb84['model'];if(!_0x55614a[_0x9791('0x2e')][_0x9791('0x34')](_0x9791('0x35'))){_0x228703['limit']=qs[_0x9791('0x1c')](_0x55614a['query'][_0x9791('0x1c')]);_0x228703['offset']=qs[_0x9791('0x1a')](_0x55614a[_0x9791('0x2e')]['offset']);}_0x228703[_0x9791('0x36')]=qs[_0x9791('0x37')](_0x55614a[_0x9791('0x2e')][_0x9791('0x37')]);_0x228703[_0x9791('0x38')]=qs['filters'](_[_0x9791('0x39')](_0x55614a[_0x9791('0x2e')],_0x24bb84[_0x9791('0x3a')]),_0x52a5d7);if(_0x55614a[_0x9791('0x2e')][_0x9791('0x3b')]){_0x228703[_0x9791('0x38')]=_[_0x9791('0x3c')](_0x228703['where'],{'$or':_[_0x9791('0x28')](_0x52a5d7,function(_0x36aaef){if(_0x36aaef['type']!==_0x9791('0x3d')){var _0x5ae670={};_0x5ae670[_0x36aaef[_0x9791('0x27')]]={'$like':'%'+_0x55614a[_0x9791('0x2e')]['filter']+'%'};return _0x5ae670;}})});}_0x228703=_[_0x9791('0x3c')]({},_0x228703,_0x55614a['options']);var _0x205471={'where':_0x228703['where']};return db[_0x9791('0x29')]['count'](_0x205471)['then'](function(_0xa96c90){_0xf84fe3[_0x9791('0x1d')]=_0xa96c90;if(_0x55614a['query']['includeAll']){_0x228703[_0x9791('0x3e')]=[{'all':!![]}];}return db[_0x9791('0x29')]['findAll'](_0x228703);})[_0x9791('0x23')](function(_0x4497de){_0xf84fe3['rows']=_0x4497de;return _0xf84fe3;})[_0x9791('0x23')](respondWithFilteredResult(_0x339932,_0x228703))['catch'](handleError(_0x339932,null));};exports[_0x9791('0x3f')]=function(_0x54383c,_0x5e2604){var _0x3c8073={'raw':!![],'where':{'id':_0x54383c['params']['id']}},_0x291d96={};_0x291d96['model']=_[_0x9791('0x2f')](db[_0x9791('0x29')][_0x9791('0x40')]);_0x291d96[_0x9791('0x2e')]=_[_0x9791('0x2f')](_0x54383c[_0x9791('0x2e')]);_0x291d96[_0x9791('0x3a')]=_[_0x9791('0x30')](_0x291d96[_0x9791('0x2d')],_0x291d96['query']);_0x3c8073[_0x9791('0x32')]=_[_0x9791('0x30')](_0x291d96[_0x9791('0x2d')],qs[_0x9791('0x31')](_0x54383c[_0x9791('0x2e')][_0x9791('0x31')]));_0x3c8073[_0x9791('0x32')]=_0x3c8073['attributes'][_0x9791('0x33')]?_0x3c8073[_0x9791('0x32')]:_0x291d96[_0x9791('0x2d')];if(_0x54383c[_0x9791('0x2e')][_0x9791('0x41')]){_0x3c8073[_0x9791('0x3e')]=[{'all':!![]}];}_0x3c8073=_[_0x9791('0x3c')]({},_0x3c8073,_0x54383c[_0x9791('0x42')]);return db['DeskField'][_0x9791('0x43')](_0x3c8073)[_0x9791('0x23')](handleEntityNotFound(_0x5e2604,null))[_0x9791('0x23')](respondWithResult(_0x5e2604,null))[_0x9791('0x44')](handleError(_0x5e2604,null));};exports['create']=function(_0x3df77c,_0x152245){return db[_0x9791('0x29')][_0x9791('0x45')](_0x3df77c[_0x9791('0x46')],{})['then'](respondWithResult(_0x152245,0xc9))[_0x9791('0x44')](handleError(_0x152245,null));};exports['update']=function(_0x23678e,_0xd3c149){if(_0x23678e[_0x9791('0x46')]['id']){delete _0x23678e[_0x9791('0x46')]['id'];}return db[_0x9791('0x29')][_0x9791('0x43')]({'where':{'id':_0x23678e['params']['id']}})[_0x9791('0x23')](handleEntityNotFound(_0xd3c149,null))[_0x9791('0x23')](saveUpdates(_0x23678e['body'],null))[_0x9791('0x23')](respondWithResult(_0xd3c149,null))['catch'](handleError(_0xd3c149,null));};exports['destroy']=function(_0x2997be,_0x1fd2ac){return db[_0x9791('0x29')][_0x9791('0x43')]({'where':{'id':_0x2997be[_0x9791('0x47')]['id']}})[_0x9791('0x23')](handleEntityNotFound(_0x1fd2ac,null))[_0x9791('0x23')](removeEntity(_0x1fd2ac,null))[_0x9791('0x44')](handleError(_0x1fd2ac,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 950e66e..93f3169 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 _0xf785=['request-promise','path','../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','FieldId','util','moment'];(function(_0x36919b,_0x233833){var _0x4c687e=function(_0x2ec77b){while(--_0x2ec77b){_0x36919b['push'](_0x36919b['shift']());}};_0x4c687e(++_0x233833);}(_0xf785,0x170));var _0x5f78=function(_0x71043e,_0x4e0888){_0x71043e=_0x71043e-0x0;var _0x5223bf=_0xf785[_0x71043e];return _0x5223bf;};'use strict';var _=require('lodash');var util=require(_0x5f78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5f78('0x1'));var BPromise=require('bluebird');var rp=require(_0x5f78('0x2'));var fs=require('fs');var path=require(_0x5f78('0x3'));var rimraf=require('rimraf');var config=require(_0x5f78('0x4'));var attributes=require(_0x5f78('0x5'));module['exports']=function(_0x5d24a3,_0x4a1043){return _0x5d24a3['define'](_0x5f78('0x6'),attributes,{'tableName':_0x5f78('0x7'),'paranoid':![],'indexes':[{'name':_0x5f78('0x8'),'fields':['idField',_0x5f78('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cf1=['idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index'];(function(_0x4100ba,_0xa2460e){var _0x57a4f3=function(_0x528887){while(--_0x528887){_0x4100ba['push'](_0x4100ba['shift']());}};_0x57a4f3(++_0xa2460e);}(_0x0cf1,0x69));var _0x10cf=function(_0x272ac6,_0x2e1cb2){_0x272ac6=_0x272ac6-0x0;var _0xc969ff=_0x0cf1[_0x272ac6];return _0xc969ff;};'use strict';var _=require('lodash');var util=require(_0x10cf('0x0'));var logger=require(_0x10cf('0x1'))(_0x10cf('0x2'));var moment=require(_0x10cf('0x3'));var BPromise=require(_0x10cf('0x4'));var rp=require(_0x10cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10cf('0x6'));var config=require(_0x10cf('0x7'));var attributes=require(_0x10cf('0x8'));module[_0x10cf('0x9')]=function(_0x2d095c,_0x16e9ab){return _0x2d095c[_0x10cf('0xa')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x10cf('0xb'),'fields':[_0x10cf('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ff667de..6adf363 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 _0x3ed2=['catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x42b611,_0x256f69){var _0x53f6c8=function(_0x3f1a9b){while(--_0x3f1a9b){_0x42b611['push'](_0x42b611['shift']());}};_0x53f6c8(++_0x256f69);}(_0x3ed2,0xa1));var _0x23ed=function(_0x5ba736,_0x3470bb){_0x5ba736=_0x5ba736-0x0;var _0xa338e4=_0x3ed2[_0x5ba736];return _0xa338e4;};'use strict';var _=require('lodash');var util=require(_0x23ed('0x0'));var moment=require(_0x23ed('0x1'));var BPromise=require(_0x23ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23ed('0x3'))['db'];var utils=require(_0x23ed('0x4'));var logger=require('../../config/logger')(_0x23ed('0x5'));var config=require(_0x23ed('0x6'));var jayson=require(_0x23ed('0x7'));var client=jayson[_0x23ed('0x8')][_0x23ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x396628,_0x3ba15f,_0x2e5456){return new BPromise(function(_0x1854fe,_0x59af48){return client['request'](_0x396628,_0x2e5456)[_0x23ed('0xa')](function(_0x2ff427){logger[_0x23ed('0xb')](_0x23ed('0xc'),_0x3ba15f,'request\x20sent');logger[_0x23ed('0xd')](_0x23ed('0xe'),_0x3ba15f,_0x23ed('0xf'),JSON['stringify'](_0x2ff427));if(_0x2ff427[_0x23ed('0x10')]){if(_0x2ff427['error'][_0x23ed('0x11')]===0x1f4){logger[_0x23ed('0x10')]('DeskField,\x20%s,\x20%s',_0x3ba15f,_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);return _0x59af48(_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);}logger[_0x23ed('0x10')](_0x23ed('0xc'),_0x3ba15f,_0x2ff427[_0x23ed('0x10')][_0x23ed('0x12')]);return _0x1854fe(_0x2ff427['error'][_0x23ed('0x12')]);}else{logger[_0x23ed('0xb')]('DeskField,\x20%s,\x20%s',_0x3ba15f,_0x23ed('0xf'));_0x1854fe(_0x2ff427['result'][_0x23ed('0x12')]);}})[_0x23ed('0x13')](function(_0x1f1bb7){logger[_0x23ed('0x10')](_0x23ed('0xc'),_0x3ba15f,_0x1f1bb7);_0x59af48(_0x1f1bb7);});});} \ No newline at end of file +var _0x8b64=['moment','ioredis','../../config/environment','jayson/promise','client','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x44608c,_0x55fcff){var _0x4ffaf2=function(_0x4e28a8){while(--_0x4e28a8){_0x44608c['push'](_0x44608c['shift']());}};_0x4ffaf2(++_0x55fcff);}(_0x8b64,0x18a));var _0x48b6=function(_0x468a75,_0x3ef4ab){_0x468a75=_0x468a75-0x0;var _0x3bbcb3=_0x8b64[_0x468a75];return _0x3bbcb3;};'use strict';var _=require(_0x48b6('0x0'));var util=require(_0x48b6('0x1'));var moment=require(_0x48b6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x48b6('0x4'));var jayson=require(_0x48b6('0x5'));var client=jayson[_0x48b6('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf22014,_0x1a6cab,_0x1660a2){return new BPromise(function(_0x45307a,_0x49b9c9){return client[_0x48b6('0x7')](_0xf22014,_0x1660a2)['then'](function(_0x5f35b5){logger[_0x48b6('0x8')](_0x48b6('0x9'),_0x1a6cab,_0x48b6('0xa'));logger[_0x48b6('0xb')](_0x48b6('0xc'),_0x1a6cab,_0x48b6('0xa'),JSON[_0x48b6('0xd')](_0x5f35b5));if(_0x5f35b5[_0x48b6('0xe')]){if(_0x5f35b5[_0x48b6('0xe')][_0x48b6('0xf')]===0x1f4){logger['error'](_0x48b6('0x9'),_0x1a6cab,_0x5f35b5[_0x48b6('0xe')]['message']);return _0x49b9c9(_0x5f35b5[_0x48b6('0xe')]['message']);}logger[_0x48b6('0xe')](_0x48b6('0x9'),_0x1a6cab,_0x5f35b5['error'][_0x48b6('0x10')]);return _0x45307a(_0x5f35b5['error']['message']);}else{logger['info'](_0x48b6('0x9'),_0x1a6cab,_0x48b6('0xa'));_0x45307a(_0x5f35b5[_0x48b6('0x11')][_0x48b6('0x10')]);}})['catch'](function(_0x2f0dec){logger['error']('DeskField,\x20%s,\x20%s',_0x1a6cab,_0x2f0dec);_0x49b9c9(_0x2f0dec);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 689f08a..c9dd6aa 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 _0xfae2=['index','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated'];(function(_0x794312,_0xace952){var _0x82928a=function(_0x5a5649){while(--_0x5a5649){_0x794312['push'](_0x794312['shift']());}};_0x82928a(++_0xace952);}(_0xfae2,0x1af));var _0x2fae=function(_0x7f677f,_0x5f2c1c){_0x7f677f=_0x7f677f-0x0;var _0x5acea1=_0xfae2[_0x7f677f];return _0x5acea1;};'use strict';var multer=require(_0x2fae('0x0'));var util=require('util');var path=require(_0x2fae('0x1'));var timeout=require(_0x2fae('0x2'));var express=require(_0x2fae('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2fae('0x4'));var interaction=require(_0x2fae('0x5'));var config=require(_0x2fae('0x6'));var controller=require(_0x2fae('0x7'));router[_0x2fae('0x8')]('/',auth[_0x2fae('0x9')](),controller[_0x2fae('0xa')]);router[_0x2fae('0x8')](_0x2fae('0xb'),auth[_0x2fae('0x9')](),controller[_0x2fae('0xc')]);router[_0x2fae('0x8')]('/:id/configurations',auth[_0x2fae('0x9')](),controller['getConfigurations']);router[_0x2fae('0x8')](_0x2fae('0xd'),auth[_0x2fae('0x9')](),controller[_0x2fae('0xe')]);router[_0x2fae('0xf')]('/',auth[_0x2fae('0x9')](),controller['create']);router['post'](_0x2fae('0x10'),auth[_0x2fae('0x9')](),controller[_0x2fae('0x11')]);router[_0x2fae('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x2fae('0x13')]);router[_0x2fae('0x14')](_0x2fae('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd813=['util','path','connect-timeout','express','Router','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','multer'];(function(_0x3b0697,_0x2e17bb){var _0xabb05=function(_0x2bcef7){while(--_0x2bcef7){_0x3b0697['push'](_0x3b0697['shift']());}};_0xabb05(++_0x2e17bb);}(_0xd813,0x168));var _0x3d81=function(_0x3f3a92,_0xb232c){_0x3f3a92=_0x3f3a92-0x0;var _0x52727a=_0xd813[_0x3f3a92];return _0x52727a;};'use strict';var multer=require(_0x3d81('0x0'));var util=require(_0x3d81('0x1'));var path=require(_0x3d81('0x2'));var timeout=require(_0x3d81('0x3'));var express=require(_0x3d81('0x4'));var router=express[_0x3d81('0x5')]();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('./intDynamics365Account.controller');router[_0x3d81('0x6')]('/',auth[_0x3d81('0x7')](),controller['index']);router[_0x3d81('0x6')](_0x3d81('0x8'),auth[_0x3d81('0x7')](),controller[_0x3d81('0x9')]);router[_0x3d81('0x6')](_0x3d81('0xa'),auth[_0x3d81('0x7')](),controller[_0x3d81('0xb')]);router[_0x3d81('0x6')](_0x3d81('0xc'),auth[_0x3d81('0x7')](),controller[_0x3d81('0xd')]);router[_0x3d81('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d81('0xe')]('/:id/configurations',auth[_0x3d81('0x7')](),controller[_0x3d81('0xf')]);router[_0x3d81('0x10')](_0x3d81('0x8'),auth[_0x3d81('0x7')](),controller['update']);router[_0x3d81('0x11')](_0x3d81('0x8'),auth[_0x3d81('0x7')](),controller[_0x3d81('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 19c1d17..90359d8 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 _0x6379=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x6379,0x84));var _0x9637=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x6379[_0x60286b];return _0x5dff69;};'use strict';var Sequelize=require(_0x9637('0x0'));module[_0x9637('0x1')]={'name':{'type':Sequelize[_0x9637('0x2')]},'username':{'type':Sequelize[_0x9637('0x2')]},'password':{'type':Sequelize[_0x9637('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x9637('0x2')]},'clientId':{'type':Sequelize[_0x9637('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x9637('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9637('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8784=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5e28cc,_0x4a5cd4){var _0x23ec61=function(_0xeb3e15){while(--_0xeb3e15){_0x5e28cc['push'](_0x5e28cc['shift']());}};_0x23ec61(++_0x4a5cd4);}(_0x8784,0x172));var _0x4878=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x8784[_0x1db481];return _0x3db95b;};'use strict';var Sequelize=require(_0x4878('0x0'));module[_0x4878('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4878('0x2')]},'password':{'type':Sequelize[_0x4878('0x2')]},'remoteUri':{'type':Sequelize[_0x4878('0x2')]},'tenantId':{'type':Sequelize[_0x4878('0x2')]},'clientId':{'type':Sequelize[_0x4878('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4878('0x2')]},'modernAuthentication':{'type':Sequelize[_0x4878('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 eebcf42..54b0d10 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 _0x4d00=['PhoneCall','title','description','customerid','caseorigincode','subject','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','data7','access_token','CloudProvider','data5','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','json','update','destroy','then','end','sendStatus','error','name','send','index','map','Dynamics365Account','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filters','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','merge','filter','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Descriptions','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x4d00,0x7c));var _0x04d0=function(_0x2fc236,_0x43f894){_0x2fc236=_0x2fc236-0x0;var _0x50a4f1=_0x4d00[_0x2fc236];return _0x50a4f1;};'use strict';var rp=require(_0x04d0('0x0'));var util=require(_0x04d0('0x1'));var _=require('lodash');var qs=require(_0x04d0('0x2'));var logger=require(_0x04d0('0x3'))(_0x04d0('0x4'));var db=require(_0x04d0('0x5'))['db'];var integrations=require(_0x04d0('0x6'));function respondWithResult(_0x3307ff,_0xe00684){_0xe00684=_0xe00684||0xc8;return function(_0x45919d){if(_0x45919d){return _0x3307ff[_0x04d0('0x7')](_0xe00684)['json'](_0x45919d);}};}function respondWithFilteredResult(_0x11608c,_0x1b652a){return function(_0x2cf9d5){if(_0x2cf9d5){var _0xbc896=typeof _0x1b652a['offset']===_0x04d0('0x8')&&typeof _0x1b652a[_0x04d0('0x9')]==='undefined';var _0x50cf8c=_0x2cf9d5[_0x04d0('0xa')];var _0x8c686a=_0xbc896?0x0:_0x1b652a['offset'];var _0x14cba7=_0xbc896?_0x2cf9d5[_0x04d0('0xa')]:_0x1b652a[_0x04d0('0xb')]+_0x1b652a[_0x04d0('0x9')];var _0x5886eb;if(_0x14cba7>=_0x50cf8c){_0x14cba7=_0x50cf8c;_0x5886eb=0xc8;}else{_0x5886eb=0xce;}_0x11608c[_0x04d0('0x7')](_0x5886eb);return _0x11608c[_0x04d0('0xc')](_0x04d0('0xd'),_0x8c686a+'-'+_0x14cba7+'/'+_0x50cf8c)[_0x04d0('0xe')](_0x2cf9d5);}return null;};}function saveUpdates(_0x201497){return function(_0x511ec4){if(_0x511ec4){return _0x511ec4[_0x04d0('0xf')](_0x201497)['then'](function(_0x35a3c8){return _0x35a3c8;});}return null;};}function removeEntity(_0x1c43b2){return function(_0x5a0788){if(_0x5a0788){return _0x5a0788[_0x04d0('0x10')]()[_0x04d0('0x11')](function(){_0x1c43b2[_0x04d0('0x7')](0xcc)[_0x04d0('0x12')]();});}};}function handleEntityNotFound(_0x151efa){return function(_0x1e98b8){if(!_0x1e98b8){_0x151efa[_0x04d0('0x13')](0x194);}return _0x1e98b8;};}function handleError(_0xcd3bf3,_0xb414b3){_0xb414b3=_0xb414b3||0x1f4;return function(_0xb3c53e){logger[_0x04d0('0x14')](_0xb3c53e['stack']);if(_0xb3c53e[_0x04d0('0x15')]){delete _0xb3c53e[_0x04d0('0x15')];}_0xcd3bf3[_0x04d0('0x7')](_0xb414b3)[_0x04d0('0x16')](_0xb3c53e);};}exports[_0x04d0('0x17')]=function(_0x376913,_0x427629){var _0x2aeaf1={},_0x3eec02={},_0x4adbe0={'count':0x0,'rows':[]};var _0x35397b=_[_0x04d0('0x18')](db[_0x04d0('0x19')]['rawAttributes'],function(_0x2fbcb6){return{'name':_0x2fbcb6['fieldName'],'type':_0x2fbcb6[_0x04d0('0x1a')]['key']};});_0x3eec02[_0x04d0('0x1b')]=_['map'](_0x35397b,_0x04d0('0x15'));_0x3eec02[_0x04d0('0x1c')]=_[_0x04d0('0x1d')](_0x376913[_0x04d0('0x1c')]);_0x3eec02['filters']=_[_0x04d0('0x1e')](_0x3eec02[_0x04d0('0x1b')],_0x3eec02[_0x04d0('0x1c')]);_0x2aeaf1[_0x04d0('0x1f')]=_[_0x04d0('0x1e')](_0x3eec02['model'],qs[_0x04d0('0x20')](_0x376913[_0x04d0('0x1c')][_0x04d0('0x20')]));_0x2aeaf1[_0x04d0('0x1f')]=_0x2aeaf1[_0x04d0('0x1f')][_0x04d0('0x21')]?_0x2aeaf1[_0x04d0('0x1f')]:_0x3eec02[_0x04d0('0x1b')];if(!_0x376913[_0x04d0('0x1c')][_0x04d0('0x22')]('nolimit')){_0x2aeaf1[_0x04d0('0x9')]=qs['limit'](_0x376913[_0x04d0('0x1c')][_0x04d0('0x9')]);_0x2aeaf1[_0x04d0('0xb')]=qs[_0x04d0('0xb')](_0x376913['query'][_0x04d0('0xb')]);}_0x2aeaf1[_0x04d0('0x23')]=qs['sort'](_0x376913['query']['sort']);_0x2aeaf1[_0x04d0('0x24')]=qs['filters'](_[_0x04d0('0x25')](_0x376913[_0x04d0('0x1c')],_0x3eec02[_0x04d0('0x26')]),_0x35397b);if(_0x376913['query']['filter']){_0x2aeaf1[_0x04d0('0x24')]=_['merge'](_0x2aeaf1['where'],{'$or':_[_0x04d0('0x18')](_0x35397b,function(_0x446b66){if(_0x446b66['type']!==_0x04d0('0x27')){var _0x4acf8f={};_0x4acf8f[_0x446b66[_0x04d0('0x15')]]={'$like':'%'+_0x376913[_0x04d0('0x1c')]['filter']+'%'};return _0x4acf8f;}})});}_0x2aeaf1=_['merge']({},_0x2aeaf1,_0x376913[_0x04d0('0x28')]);var _0x3b8080={'where':_0x2aeaf1['where']};return db[_0x04d0('0x19')][_0x04d0('0xa')](_0x3b8080)[_0x04d0('0x11')](function(_0x167f7d){_0x4adbe0[_0x04d0('0xa')]=_0x167f7d;if(_0x376913[_0x04d0('0x1c')][_0x04d0('0x29')]){_0x2aeaf1[_0x04d0('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x04d0('0x2b')](_0x2aeaf1);})[_0x04d0('0x11')](function(_0x204c02){_0x4adbe0[_0x04d0('0x2c')]=_0x204c02;return _0x4adbe0;})[_0x04d0('0x11')](respondWithFilteredResult(_0x427629,_0x2aeaf1))[_0x04d0('0x2d')](handleError(_0x427629,null));};exports[_0x04d0('0x2e')]=function(_0x28bffb,_0x27e986){var _0xfddadc={'raw':![],'where':{'id':_0x28bffb['params']['id']}},_0x1a6459={};_0x1a6459[_0x04d0('0x1b')]=_[_0x04d0('0x1d')](db[_0x04d0('0x19')]['rawAttributes']);_0x1a6459[_0x04d0('0x1c')]=_[_0x04d0('0x1d')](_0x28bffb['query']);_0x1a6459[_0x04d0('0x26')]=_[_0x04d0('0x1e')](_0x1a6459[_0x04d0('0x1b')],_0x1a6459[_0x04d0('0x1c')]);_0xfddadc['attributes']=_['intersection'](_0x1a6459['model'],qs[_0x04d0('0x20')](_0x28bffb['query'][_0x04d0('0x20')]));_0xfddadc[_0x04d0('0x1f')]=_0xfddadc[_0x04d0('0x1f')]['length']?_0xfddadc[_0x04d0('0x1f')]:_0x1a6459[_0x04d0('0x1b')];if(_0x28bffb['query'][_0x04d0('0x29')]){_0xfddadc['include']=[{'all':!![]}];}_0xfddadc=_['merge']({},_0xfddadc,_0x28bffb[_0x04d0('0x28')]);return db['Dynamics365Account'][_0x04d0('0x2f')](_0xfddadc)[_0x04d0('0x11')](handleEntityNotFound(_0x27e986,null))[_0x04d0('0x11')](respondWithResult(_0x27e986,null))[_0x04d0('0x2d')](handleError(_0x27e986,null));};exports[_0x04d0('0x30')]=function(_0x6fb1e8,_0x5d5e3c){return db[_0x04d0('0x19')][_0x04d0('0x30')](_0x6fb1e8[_0x04d0('0x31')],{})[_0x04d0('0x11')](respondWithResult(_0x5d5e3c,0xc9))[_0x04d0('0x2d')](handleError(_0x5d5e3c,null));};exports[_0x04d0('0xf')]=function(_0x15ea84,_0x3f6911){if(_0x15ea84['body']['id']){delete _0x15ea84[_0x04d0('0x31')]['id'];}return db[_0x04d0('0x19')][_0x04d0('0x2f')]({'where':{'id':_0x15ea84['params']['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x3f6911,null))[_0x04d0('0x11')](saveUpdates(_0x15ea84[_0x04d0('0x31')],null))[_0x04d0('0x11')](respondWithResult(_0x3f6911,null))[_0x04d0('0x2d')](handleError(_0x3f6911,null));};exports[_0x04d0('0x10')]=function(_0x427d97,_0x2ac2dd){return db[_0x04d0('0x19')][_0x04d0('0x2f')]({'where':{'id':_0x427d97[_0x04d0('0x32')]['id']}})['then'](handleEntityNotFound(_0x2ac2dd,null))[_0x04d0('0x11')](removeEntity(_0x2ac2dd,null))[_0x04d0('0x2d')](handleError(_0x2ac2dd,null));};exports['getConfigurations']=function(_0x116fef,_0x30e77e){var _0x43afc7={};var _0x282c53={};var _0x54c62f;var _0x103647;return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x116fef[_0x04d0('0x32')]['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x30e77e,null))[_0x04d0('0x11')](function(_0x535e05){if(_0x535e05){_0x54c62f=_0x535e05;_0x282c53[_0x04d0('0x1b')]=_[_0x04d0('0x1d')](db['Dynamics365Configuration']['rawAttributes']);_0x282c53['query']=_['keys'](_0x116fef[_0x04d0('0x1c')]);_0x282c53[_0x04d0('0x26')]=_[_0x04d0('0x1e')](_0x282c53[_0x04d0('0x1b')],_0x282c53[_0x04d0('0x1c')]);_0x43afc7['attributes']=_[_0x04d0('0x1e')](_0x282c53[_0x04d0('0x1b')],qs['fields'](_0x116fef[_0x04d0('0x1c')][_0x04d0('0x20')]));_0x43afc7[_0x04d0('0x1f')]=_0x43afc7[_0x04d0('0x1f')][_0x04d0('0x21')]?_0x43afc7[_0x04d0('0x1f')]:_0x282c53[_0x04d0('0x1b')];_0x43afc7[_0x04d0('0x23')]=qs['sort'](_0x116fef['query']['sort']);_0x43afc7[_0x04d0('0x24')]=qs[_0x04d0('0x26')](_[_0x04d0('0x25')](_0x116fef[_0x04d0('0x1c')],_0x282c53['filters']));if(_0x116fef[_0x04d0('0x1c')]['filter']){_0x43afc7[_0x04d0('0x24')]=_[_0x04d0('0x34')](_0x43afc7[_0x04d0('0x24')],{'$or':_[_0x04d0('0x18')](_0x43afc7[_0x04d0('0x1f')],function(_0x7d55b1){var _0x3e8c11={};_0x3e8c11[_0x7d55b1]={'$like':'%'+_0x116fef[_0x04d0('0x1c')][_0x04d0('0x35')]+'%'};return _0x3e8c11;})});}_0x43afc7=_[_0x04d0('0x34')]({},_0x43afc7,_0x116fef[_0x04d0('0x28')]);return _0x54c62f['getConfigurations'](_0x43afc7);}})[_0x04d0('0x11')](function(_0x5e2200){if(_0x5e2200){_0x103647=_0x5e2200['length'];if(!_0x116fef[_0x04d0('0x1c')][_0x04d0('0x22')](_0x04d0('0x36'))){_0x43afc7[_0x04d0('0x9')]=qs[_0x04d0('0x9')](_0x116fef[_0x04d0('0x1c')][_0x04d0('0x9')]);_0x43afc7[_0x04d0('0xb')]=qs[_0x04d0('0xb')](_0x116fef[_0x04d0('0x1c')][_0x04d0('0xb')]);}return _0x54c62f[_0x04d0('0x37')](_0x43afc7);}})[_0x04d0('0x11')](function(_0x3f602b){if(_0x3f602b){return _0x3f602b?{'count':_0x103647,'rows':_0x3f602b}:null;}})[_0x04d0('0x11')](respondWithResult(_0x30e77e,null))['catch'](handleError(_0x30e77e,null));};exports[_0x04d0('0x38')]=function(_0x33c0bb,_0x45c39d){if(_0x33c0bb[_0x04d0('0x31')]['id']){delete _0x33c0bb['body']['id'];}return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x33c0bb[_0x04d0('0x32')]['id']}})[_0x04d0('0x11')](handleEntityNotFound(_0x45c39d,null))['then'](function(_0x3c6b1f){if(_0x3c6b1f){_0x33c0bb['body'][_0x04d0('0x39')]=_0x3c6b1f['id'];_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x3a')]=integrations[_0x04d0('0x3b')](_0x33c0bb['body'][_0x04d0('0x3c')],_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x1a')]);_0x33c0bb['body']['Descriptions']=integrations[_0x04d0('0x3d')](_0x33c0bb[_0x04d0('0x31')]['channel'],_0x33c0bb[_0x04d0('0x31')][_0x04d0('0x1a')]);return db[_0x04d0('0x3e')][_0x04d0('0x30')](_0x33c0bb[_0x04d0('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x04d0('0x3f')],'as':_0x04d0('0x40')}]});}return null;})[_0x04d0('0x11')](respondWithResult(_0x45c39d,null))['catch'](handleError(_0x45c39d,null));};function sanitizeRemoteUri(_0x4f060e){var _0x410857=_0x4f060e['slice'](-0x1);if(_0x410857==='/')return _0x4f060e[_0x04d0('0x41')](0x0,_0x4f060e[_0x04d0('0x42')](_0x410857));return _0x4f060e;}function getWebApiUrl(_0x128512){return util['format'](_0x04d0('0x43'),_0x128512);}exports[_0x04d0('0x44')]=function(_0x34d2bf,_0x6765f9){var _0x355f16=_0x34d2bf[_0x04d0('0x1c')][_0x04d0('0x45')];var _0x356ba8=_0x355f16===_0x04d0('0x46')?'Incident':_0x04d0('0x47');var _0x4925a8='';var _0x1bba2b='';var _0x333cb5='';var _0x1a33ba='';var _0x495cd5='';var _0x2e5711='';var _0x2ba6f8='';var _0x3aa748='';var _0x117a18=[_0x04d0('0x48'),_0x04d0('0x49'),_0x04d0('0x4a'),'ownerid',_0x04d0('0x4b'),_0x04d0('0x4c'),'phonenumber','regardingobjectid','directioncode',_0x04d0('0x4d')];var _0x2e98a8=[_0x04d0('0x4e'),_0x04d0('0x4f'),_0x04d0('0x50'),_0x04d0('0x51'),_0x04d0('0x52'),_0x04d0('0x53'),_0x04d0('0x54'),_0x04d0('0x55'),_0x04d0('0x56'),_0x04d0('0x57'),_0x04d0('0x58'),'createdbyyominame',_0x04d0('0x59'),_0x04d0('0x5a'),'createdonbehalfbyyominame',_0x04d0('0x5b'),_0x04d0('0x5c'),_0x04d0('0x5d'),'emailaddress',_0x04d0('0x5e'),_0x04d0('0x5f'),_0x04d0('0x60'),_0x04d0('0x61'),_0x04d0('0x62'),_0x04d0('0x63'),_0x04d0('0x64'),_0x04d0('0x65'),_0x04d0('0x66'),'kbarticleidname',_0x04d0('0x67'),'masteridname',_0x04d0('0x68'),_0x04d0('0x69'),_0x04d0('0x6a'),_0x04d0('0x6b'),_0x04d0('0x6c'),_0x04d0('0x6d'),_0x04d0('0x6e'),_0x04d0('0x6f'),_0x04d0('0x70'),_0x04d0('0x71'),_0x04d0('0x72'),_0x04d0('0x73'),_0x04d0('0x74'),'owneridtype',_0x04d0('0x75'),_0x04d0('0x76'),_0x04d0('0x77'),_0x04d0('0x78'),_0x04d0('0x79'),_0x04d0('0x7a'),_0x04d0('0x7b'),_0x04d0('0x7c'),_0x04d0('0x7d'),_0x04d0('0x7e'),_0x04d0('0x7f'),'responsiblecontactidyominame',_0x04d0('0x80'),_0x04d0('0x81'),_0x04d0('0x82'),_0x04d0('0x83'),_0x04d0('0x84'),_0x04d0('0x85'),_0x04d0('0x86'),_0x04d0('0x87'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x04d0('0x88')];var _0xbcf3e6=_0x117a18[_0x04d0('0x89')](_0x2e98a8);return db[_0x04d0('0x19')][_0x04d0('0x33')]({'where':{'id':_0x34d2bf[_0x04d0('0x32')]['id']},'attributes':['id',_0x04d0('0x8a'),_0x04d0('0x8b'),'remoteUri',_0x04d0('0x8c'),_0x04d0('0x8d'),_0x04d0('0x8e'),_0x04d0('0x8f')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id','data5',_0x04d0('0x90')]}]})[_0x04d0('0x11')](handleEntityNotFound(_0x6765f9,null))[_0x04d0('0x11')](function(_0x3b905f){if(_0x3b905f){if(_0x3b905f[_0x04d0('0x8f')]){_0x3b905f[_0x04d0('0x91')]=_0x3b905f[_0x04d0('0x92')][_0x04d0('0x93')];_0x3aa748=sanitizeRemoteUri(_0x3b905f[_0x04d0('0x92')][_0x04d0('0x90')]);_0x2ba6f8=getWebApiUrl(_0x3aa748);return _0x3b905f;}_0x3aa748=sanitizeRemoteUri(_0x3b905f[_0x04d0('0x94')]);_0x2ba6f8=getWebApiUrl(_0x3aa748);var _0x31fec3={'method':_0x04d0('0x95'),'uri':_0x04d0('0x96')+_0x3b905f['tenantId']+_0x04d0('0x97'),'form':{'client_id':_0x3b905f['clientId'],'resource':_0x3aa748,'username':_0x3b905f[_0x04d0('0x8a')],'password':_0x3b905f[_0x04d0('0x8b')],'grant_type':_0x04d0('0x8b'),'client_secret':_0x3b905f['clientSecret']},'json':!![]};return rp(_0x31fec3);}})[_0x04d0('0x11')](function(_0xa2dea6){_0x2e5711=_0xa2dea6[_0x04d0('0x91')];var _0x5a83fd={'method':_0x04d0('0x98'),'uri':encodeURI(_0x2ba6f8+_0x04d0('0x99')+_0x356ba8+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2e5711,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0x5a83fd);})[_0x04d0('0x11')](function(_0x4d3881){var _0x244317=_0x4d3881[_0x04d0('0x9b')][0x0];var _0x4154e7=_0x244317[_0x04d0('0x9c')];var _0x3264c9={'method':_0x04d0('0x98'),'uri':_0x2ba6f8+_0x04d0('0x9d')+_0x4154e7+_0x04d0('0x9e'),'headers':{'Authorization':_0x04d0('0x9f')+_0x2e5711,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3264c9);})['then'](function(_0x363de2){_0x4925a8=_0x363de2;_0x1bba2b=_0x4925a8['Attributes'];_0x1bba2b=_[_0x04d0('0xa0')](_0x1bba2b,function(_0x134f9e){return!_0xbcf3e6[_0x04d0('0xa1')](_0x134f9e[_0x04d0('0xa2')]);});var _0x1b2b59=[];var _0x51e56f=[];_0x1bba2b[_0x04d0('0xa3')](function(_0x461190){if(_0x461190[_0x04d0('0xa4')]){var _0x47a02e=_0x461190['@odata.type'][_0x04d0('0x41')](_0x461190[_0x04d0('0xa4')][_0x04d0('0x42')]('.')+0x1);if(_0x47a02e==='PicklistAttributeMetadata'){_0x1b2b59[_0x04d0('0xa5')](getSelectList(_0x2ba6f8,_0x355f16,_0x51e56f,_0x4925a8['MetadataId'],_0x461190[_0x04d0('0x9c')],_0x2e5711));}}});return Promise[_0x04d0('0xa6')](_0x1b2b59);})[_0x04d0('0x11')](function(_0x4a2eb5){_0x333cb5=_0x4a2eb5[0x0];var _0x11a6b7=[];var _0xf6bb6d=[];_0x1bba2b['forEach'](function(_0x55a04a){if(!_['isNil'](_0x55a04a[_0x04d0('0xa4')])){var _0x577267=_0x55a04a[_0x04d0('0xa4')][_0x04d0('0x41')](_0x55a04a['@odata.type']['lastIndexOf']('.')+0x1);if(_0x577267===_0x04d0('0xa7')){_0x11a6b7[_0x04d0('0xa5')](getBooleanList(_0x2ba6f8,_0x355f16,_0xf6bb6d,_0x4925a8[_0x04d0('0x9c')],_0x55a04a[_0x04d0('0x9c')],_0x2e5711));}}});return Promise[_0x04d0('0xa6')](_0x11a6b7);})[_0x04d0('0x11')](function(_0x44f01e){_0x1a33ba=_0x44f01e[0x0];var _0x3e674f=[];var _0x126b38=[];_0x1bba2b['forEach'](function(_0x27e126){if(_0x27e126[_0x04d0('0xa4')]){var _0x669c75=_0x27e126['@odata.type'][_0x04d0('0x41')](_0x27e126[_0x04d0('0xa4')][_0x04d0('0x42')]('.')+0x1);if(_0x669c75===_0x04d0('0xa8')||_0x669c75===_0x04d0('0xa9')||_0x669c75===_0x04d0('0xaa')||_0x669c75===_0x04d0('0xab')||_0x669c75===_0x04d0('0xac')||_0x669c75===_0x04d0('0xad')||_0x669c75===_0x04d0('0xae')||_0x669c75==='EntityNameAttributeMetadata'||_0x669c75===_0x04d0('0xaf')||_0x669c75===_0x04d0('0xb0')){_0x3e674f[_0x04d0('0xa5')](getInputList(_0x2ba6f8,_0x355f16,_0x669c75,_0x126b38,_0x4925a8[_0x04d0('0x9c')],_0x27e126[_0x04d0('0x9c')],_0x2e5711));}}});return Promise['all'](_0x3e674f);})[_0x04d0('0x11')](function(_0x1d998e){_0x495cd5=_0x1d998e[0x0];var _0x548819=_0x333cb5[_0x04d0('0x89')](_0x1a33ba)['concat'](_0x495cd5);var _0x6e4b3b={'count':_0x548819[_0x04d0('0x21')],'rows':_0x548819};return _0x6e4b3b;})[_0x04d0('0x11')](respondWithResult(_0x6765f9,null))[_0x04d0('0x2d')](function(_0x1ccd6b){var _0x1b8cf6=_0x34d2bf[_0x04d0('0x1c')]['test']?0x1f4:_0x1ccd6b[_0x04d0('0xb1')]||0x1f4;logger[_0x04d0('0x14')](_0x1ccd6b[_0x04d0('0xb2')]);delete _0x1ccd6b['name'];if(_0x1b8cf6===0x191){_0x1b8cf6=0x190;}_0x6765f9['status'](_0x1b8cf6)[_0x04d0('0x16')](_0x34d2bf[_0x04d0('0x1c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x1ccd6b['statusCode']}:_0x1ccd6b);});};function getSelectList(_0x199dc1,_0x35f7a4,_0x353abe,_0x2b9c31,_0x4f2bec,_0x3dd12d){var _0xb60be={'method':_0x04d0('0x98'),'uri':_0x199dc1+_0x04d0('0x9d')+_0x2b9c31+_0x04d0('0xb3')+_0x4f2bec+_0x04d0('0xb4')+_0x04d0('0xb5'),'headers':{'Authorization':_0x04d0('0x9f')+_0x3dd12d,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0xb60be)[_0x04d0('0x11')](function(_0x562c26){var _0x30b490=[];var _0x5b4dd9=_0x562c26[_0x04d0('0xb6')][_0x04d0('0xb7')];_0x5b4dd9['forEach'](function(_0xcfc851){_0x30b490[_0x04d0('0xa5')]({'name':_0xcfc851[_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':String(_0xcfc851[_0x04d0('0xba')])});});var _0x5debbd={'id':_0x35f7a4+'_'+_0x562c26['LogicalName'],'name':_0x562c26['DisplayName'][_0x04d0('0xb9')][_0x04d0('0xb8')],'custom':![],'options':_0x30b490};_0x353abe[_0x04d0('0xa5')](_0x5debbd);return _0x353abe;});}function getBooleanList(_0x2187a9,_0x3e198c,_0x28a590,_0x2125dd,_0x4d5ea0,_0x2e6039){var _0xaabd5e={'method':_0x04d0('0x98'),'uri':_0x2187a9+'EntityDefinitions('+_0x2125dd+_0x04d0('0xb3')+_0x4d5ea0+_0x04d0('0xbb'),'headers':{'Authorization':'Bearer\x20'+_0x2e6039,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0xaabd5e)[_0x04d0('0x11')](function(_0x5bb366){var _0x1d1bc1=[];_0x1d1bc1[_0x04d0('0xa5')]({'name':_0x5bb366['OptionSet'][_0x04d0('0xbc')][_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':_0x04d0('0xbd')},{'name':_0x5bb366[_0x04d0('0xb6')][_0x04d0('0xbe')][_0x04d0('0xb8')][_0x04d0('0xb9')][_0x04d0('0xb8')],'value':_0x04d0('0xbf')});var _0x450731={'id':_0x3e198c+'_'+_0x5bb366[_0x04d0('0xa2')],'name':_0x5bb366[_0x04d0('0xc0')][_0x04d0('0xb9')][_0x04d0('0xb8')],'custom':![],'options':_0x1d1bc1};_0x28a590[_0x04d0('0xa5')](_0x450731);return _0x28a590;});}function getInputList(_0x188f11,_0x17c3d2,_0x104d3e,_0x15ebc9,_0x4825c8,_0x12becc,_0x5c3dec){var _0x10a3c4={'method':_0x04d0('0x98'),'uri':_0x188f11+_0x04d0('0x9d')+_0x4825c8+_0x04d0('0xb3')+_0x12becc+_0x04d0('0xc1')+_0x104d3e+_0x04d0('0xc2'),'headers':{'Authorization':'Bearer\x20'+_0x5c3dec,'If-None-Match':null,'OData-Version':_0x04d0('0x9a')},'json':!![]};return rp(_0x10a3c4)[_0x04d0('0x11')](function(_0x47ca2b){var _0x259eec={'id':_0x17c3d2+'_'+_0x47ca2b[_0x04d0('0xa2')],'name':_0x47ca2b[_0x04d0('0xc0')]['UserLocalizedLabel']?_0x47ca2b[_0x04d0('0xc0')]['UserLocalizedLabel'][_0x04d0('0xb8')]:_0x47ca2b[_0x04d0('0xa2')],'custom':![],'options':[]};_0x15ebc9['push'](_0x259eec);return _0x15ebc9;});} \ No newline at end of file +var _0xc28f=['StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Attributes(','FalseOption','false','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','Dynamics365Account','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','length','addConfiguration','Subjects','channel','Descriptions','substring','format','%s/api/data/v9.0/','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','EntityDefinitions(','Attributes','remove','includes','@odata.type','lastIndexOf','PicklistAttributeMetadata','MetadataId','all','forEach','BooleanAttributeMetadata','push','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata'];(function(_0x4b2649,_0x197797){var _0x7e0664=function(_0x3683cf){while(--_0x3683cf){_0x4b2649['push'](_0x4b2649['shift']());}};_0x7e0664(++_0x197797);}(_0xc28f,0xcf));var _0xfc28=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xc28f[_0x24237f];return _0x48298e;};'use strict';var rp=require(_0xfc28('0x0'));var util=require(_0xfc28('0x1'));var _=require(_0xfc28('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xfc28('0x3'))(_0xfc28('0x4'));var db=require(_0xfc28('0x5'))['db'];var integrations=require(_0xfc28('0x6'));function respondWithResult(_0x538f49,_0x5aa0ff){_0x5aa0ff=_0x5aa0ff||0xc8;return function(_0xff562a){if(_0xff562a){return _0x538f49[_0xfc28('0x7')](_0x5aa0ff)[_0xfc28('0x8')](_0xff562a);}};}function respondWithFilteredResult(_0x3d5fe0,_0x40adec){return function(_0x1d306c){if(_0x1d306c){var _0x1cdee6=typeof _0x40adec[_0xfc28('0x9')]===_0xfc28('0xa')&&typeof _0x40adec[_0xfc28('0xb')]===_0xfc28('0xa');var _0x307ee2=_0x1d306c[_0xfc28('0xc')];var _0x27db34=_0x1cdee6?0x0:_0x40adec[_0xfc28('0x9')];var _0x33ba33=_0x1cdee6?_0x1d306c[_0xfc28('0xc')]:_0x40adec[_0xfc28('0x9')]+_0x40adec[_0xfc28('0xb')];var _0x3add79;if(_0x33ba33>=_0x307ee2){_0x33ba33=_0x307ee2;_0x3add79=0xc8;}else{_0x3add79=0xce;}_0x3d5fe0['status'](_0x3add79);return _0x3d5fe0[_0xfc28('0xd')](_0xfc28('0xe'),_0x27db34+'-'+_0x33ba33+'/'+_0x307ee2)[_0xfc28('0x8')](_0x1d306c);}return null;};}function saveUpdates(_0x34cc6a){return function(_0x1ef19e){if(_0x1ef19e){return _0x1ef19e[_0xfc28('0xf')](_0x34cc6a)[_0xfc28('0x10')](function(_0x4c8227){return _0x4c8227;});}return null;};}function removeEntity(_0x58e668){return function(_0x2972a9){if(_0x2972a9){return _0x2972a9[_0xfc28('0x11')]()[_0xfc28('0x10')](function(){_0x58e668[_0xfc28('0x7')](0xcc)[_0xfc28('0x12')]();});}};}function handleEntityNotFound(_0x3863f5){return function(_0x33180c){if(!_0x33180c){_0x3863f5[_0xfc28('0x13')](0x194);}return _0x33180c;};}function handleError(_0x10ff6a,_0x1fa2a9){_0x1fa2a9=_0x1fa2a9||0x1f4;return function(_0x2ed89c){logger[_0xfc28('0x14')](_0x2ed89c[_0xfc28('0x15')]);if(_0x2ed89c[_0xfc28('0x16')]){delete _0x2ed89c[_0xfc28('0x16')];}_0x10ff6a['status'](_0x1fa2a9)[_0xfc28('0x17')](_0x2ed89c);};}exports[_0xfc28('0x18')]=function(_0x12f264,_0x875231){var _0x3c0506={},_0x3e64d4={},_0x3f71b9={'count':0x0,'rows':[]};var _0x510b35=_['map'](db[_0xfc28('0x19')]['rawAttributes'],function(_0x31020e){return{'name':_0x31020e['fieldName'],'type':_0x31020e['type'][_0xfc28('0x1a')]};});_0x3e64d4[_0xfc28('0x1b')]=_[_0xfc28('0x1c')](_0x510b35,_0xfc28('0x16'));_0x3e64d4[_0xfc28('0x1d')]=_[_0xfc28('0x1e')](_0x12f264[_0xfc28('0x1d')]);_0x3e64d4[_0xfc28('0x1f')]=_[_0xfc28('0x20')](_0x3e64d4[_0xfc28('0x1b')],_0x3e64d4[_0xfc28('0x1d')]);_0x3c0506[_0xfc28('0x21')]=_[_0xfc28('0x20')](_0x3e64d4[_0xfc28('0x1b')],qs[_0xfc28('0x22')](_0x12f264['query']['fields']));_0x3c0506['attributes']=_0x3c0506['attributes']['length']?_0x3c0506[_0xfc28('0x21')]:_0x3e64d4[_0xfc28('0x1b')];if(!_0x12f264[_0xfc28('0x1d')][_0xfc28('0x23')]('nolimit')){_0x3c0506[_0xfc28('0xb')]=qs[_0xfc28('0xb')](_0x12f264[_0xfc28('0x1d')][_0xfc28('0xb')]);_0x3c0506[_0xfc28('0x9')]=qs['offset'](_0x12f264[_0xfc28('0x1d')][_0xfc28('0x9')]);}_0x3c0506[_0xfc28('0x24')]=qs[_0xfc28('0x25')](_0x12f264[_0xfc28('0x1d')]['sort']);_0x3c0506['where']=qs[_0xfc28('0x1f')](_[_0xfc28('0x26')](_0x12f264['query'],_0x3e64d4['filters']),_0x510b35);if(_0x12f264[_0xfc28('0x1d')]['filter']){_0x3c0506[_0xfc28('0x27')]=_[_0xfc28('0x28')](_0x3c0506[_0xfc28('0x27')],{'$or':_[_0xfc28('0x1c')](_0x510b35,function(_0x41bd3f){if(_0x41bd3f[_0xfc28('0x29')]!==_0xfc28('0x2a')){var _0x485514={};_0x485514[_0x41bd3f['name']]={'$like':'%'+_0x12f264[_0xfc28('0x1d')][_0xfc28('0x2b')]+'%'};return _0x485514;}})});}_0x3c0506=_[_0xfc28('0x28')]({},_0x3c0506,_0x12f264[_0xfc28('0x2c')]);var _0x164b0b={'where':_0x3c0506[_0xfc28('0x27')]};return db[_0xfc28('0x19')][_0xfc28('0xc')](_0x164b0b)[_0xfc28('0x10')](function(_0x2deedb){_0x3f71b9[_0xfc28('0xc')]=_0x2deedb;if(_0x12f264['query'][_0xfc28('0x2d')]){_0x3c0506['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0xfc28('0x2e')](_0x3c0506);})['then'](function(_0x5e1fc9){_0x3f71b9[_0xfc28('0x2f')]=_0x5e1fc9;return _0x3f71b9;})[_0xfc28('0x10')](respondWithFilteredResult(_0x875231,_0x3c0506))[_0xfc28('0x30')](handleError(_0x875231,null));};exports[_0xfc28('0x31')]=function(_0x270676,_0x53853a){var _0xd99819={'raw':![],'where':{'id':_0x270676['params']['id']}},_0x4a66e9={};_0x4a66e9['model']=_[_0xfc28('0x1e')](db[_0xfc28('0x19')][_0xfc28('0x32')]);_0x4a66e9[_0xfc28('0x1d')]=_['keys'](_0x270676[_0xfc28('0x1d')]);_0x4a66e9['filters']=_[_0xfc28('0x20')](_0x4a66e9['model'],_0x4a66e9[_0xfc28('0x1d')]);_0xd99819[_0xfc28('0x21')]=_[_0xfc28('0x20')](_0x4a66e9[_0xfc28('0x1b')],qs[_0xfc28('0x22')](_0x270676[_0xfc28('0x1d')][_0xfc28('0x22')]));_0xd99819[_0xfc28('0x21')]=_0xd99819[_0xfc28('0x21')]['length']?_0xd99819['attributes']:_0x4a66e9[_0xfc28('0x1b')];if(_0x270676[_0xfc28('0x1d')][_0xfc28('0x2d')]){_0xd99819[_0xfc28('0x33')]=[{'all':!![]}];}_0xd99819=_[_0xfc28('0x28')]({},_0xd99819,_0x270676[_0xfc28('0x2c')]);return db[_0xfc28('0x19')][_0xfc28('0x34')](_0xd99819)[_0xfc28('0x10')](handleEntityNotFound(_0x53853a,null))[_0xfc28('0x10')](respondWithResult(_0x53853a,null))[_0xfc28('0x30')](handleError(_0x53853a,null));};exports[_0xfc28('0x35')]=function(_0x2d8076,_0x2b6c4f){return db[_0xfc28('0x19')]['create'](_0x2d8076['body'],{})[_0xfc28('0x10')](respondWithResult(_0x2b6c4f,0xc9))[_0xfc28('0x30')](handleError(_0x2b6c4f,null));};exports[_0xfc28('0xf')]=function(_0x208f4a,_0x1dc3a8){if(_0x208f4a['body']['id']){delete _0x208f4a[_0xfc28('0x36')]['id'];}return db[_0xfc28('0x19')][_0xfc28('0x34')]({'where':{'id':_0x208f4a[_0xfc28('0x37')]['id']}})[_0xfc28('0x10')](handleEntityNotFound(_0x1dc3a8,null))[_0xfc28('0x10')](saveUpdates(_0x208f4a[_0xfc28('0x36')],null))[_0xfc28('0x10')](respondWithResult(_0x1dc3a8,null))[_0xfc28('0x30')](handleError(_0x1dc3a8,null));};exports['destroy']=function(_0x3c3021,_0x2f59ed){return db[_0xfc28('0x19')][_0xfc28('0x34')]({'where':{'id':_0x3c3021[_0xfc28('0x37')]['id']}})[_0xfc28('0x10')](handleEntityNotFound(_0x2f59ed,null))[_0xfc28('0x10')](removeEntity(_0x2f59ed,null))[_0xfc28('0x30')](handleError(_0x2f59ed,null));};exports[_0xfc28('0x38')]=function(_0x2634b6,_0x3282a8){var _0x899c58={};var _0x2017c9={};var _0x23f561;var _0x27b6b1;return db[_0xfc28('0x19')][_0xfc28('0x39')]({'where':{'id':_0x2634b6[_0xfc28('0x37')]['id']}})[_0xfc28('0x10')](handleEntityNotFound(_0x3282a8,null))[_0xfc28('0x10')](function(_0x5d8eb0){if(_0x5d8eb0){_0x23f561=_0x5d8eb0;_0x2017c9[_0xfc28('0x1b')]=_[_0xfc28('0x1e')](db[_0xfc28('0x3a')][_0xfc28('0x32')]);_0x2017c9['query']=_[_0xfc28('0x1e')](_0x2634b6[_0xfc28('0x1d')]);_0x2017c9[_0xfc28('0x1f')]=_[_0xfc28('0x20')](_0x2017c9[_0xfc28('0x1b')],_0x2017c9[_0xfc28('0x1d')]);_0x899c58['attributes']=_[_0xfc28('0x20')](_0x2017c9['model'],qs[_0xfc28('0x22')](_0x2634b6[_0xfc28('0x1d')][_0xfc28('0x22')]));_0x899c58[_0xfc28('0x21')]=_0x899c58[_0xfc28('0x21')][_0xfc28('0x3b')]?_0x899c58[_0xfc28('0x21')]:_0x2017c9[_0xfc28('0x1b')];_0x899c58[_0xfc28('0x24')]=qs[_0xfc28('0x25')](_0x2634b6[_0xfc28('0x1d')][_0xfc28('0x25')]);_0x899c58[_0xfc28('0x27')]=qs['filters'](_[_0xfc28('0x26')](_0x2634b6[_0xfc28('0x1d')],_0x2017c9['filters']));if(_0x2634b6[_0xfc28('0x1d')]['filter']){_0x899c58[_0xfc28('0x27')]=_[_0xfc28('0x28')](_0x899c58['where'],{'$or':_[_0xfc28('0x1c')](_0x899c58[_0xfc28('0x21')],function(_0x36c729){var _0x26c56a={};_0x26c56a[_0x36c729]={'$like':'%'+_0x2634b6['query']['filter']+'%'};return _0x26c56a;})});}_0x899c58=_[_0xfc28('0x28')]({},_0x899c58,_0x2634b6[_0xfc28('0x2c')]);return _0x23f561['getConfigurations'](_0x899c58);}})[_0xfc28('0x10')](function(_0x130ebf){if(_0x130ebf){_0x27b6b1=_0x130ebf[_0xfc28('0x3b')];if(!_0x2634b6[_0xfc28('0x1d')][_0xfc28('0x23')]('nolimit')){_0x899c58[_0xfc28('0xb')]=qs[_0xfc28('0xb')](_0x2634b6['query'][_0xfc28('0xb')]);_0x899c58['offset']=qs[_0xfc28('0x9')](_0x2634b6[_0xfc28('0x1d')][_0xfc28('0x9')]);}return _0x23f561[_0xfc28('0x38')](_0x899c58);}})[_0xfc28('0x10')](function(_0x52cb35){if(_0x52cb35){return _0x52cb35?{'count':_0x27b6b1,'rows':_0x52cb35}:null;}})['then'](respondWithResult(_0x3282a8,null))[_0xfc28('0x30')](handleError(_0x3282a8,null));};exports[_0xfc28('0x3c')]=function(_0x159240,_0x5a375b){if(_0x159240['body']['id']){delete _0x159240['body']['id'];}return db['Dynamics365Account'][_0xfc28('0x39')]({'where':{'id':_0x159240[_0xfc28('0x37')]['id']}})[_0xfc28('0x10')](handleEntityNotFound(_0x5a375b,null))[_0xfc28('0x10')](function(_0x5bbf12){if(_0x5bbf12){_0x159240[_0xfc28('0x36')]['AccountId']=_0x5bbf12['id'];_0x159240[_0xfc28('0x36')][_0xfc28('0x3d')]=integrations['getSubjects'](_0x159240[_0xfc28('0x36')][_0xfc28('0x3e')],_0x159240[_0xfc28('0x36')][_0xfc28('0x29')]);_0x159240[_0xfc28('0x36')][_0xfc28('0x3f')]=integrations['getDescriptions'](_0x159240[_0xfc28('0x36')][_0xfc28('0x3e')],_0x159240[_0xfc28('0x36')][_0xfc28('0x29')]);return db[_0xfc28('0x3a')][_0xfc28('0x35')](_0x159240[_0xfc28('0x36')],{'include':[{'model':db['Dynamics365Field'],'as':_0xfc28('0x3d')},{'model':db['Dynamics365Field'],'as':_0xfc28('0x3f')}]});}return null;})[_0xfc28('0x10')](respondWithResult(_0x5a375b,null))[_0xfc28('0x30')](handleError(_0x5a375b,null));};function sanitizeRemoteUri(_0x5ce3e5){var _0x4a33d2=_0x5ce3e5['slice'](-0x1);if(_0x4a33d2==='/')return _0x5ce3e5[_0xfc28('0x40')](0x0,_0x5ce3e5['lastIndexOf'](_0x4a33d2));return _0x5ce3e5;}function getWebApiUrl(_0x33193e){return util[_0xfc28('0x41')](_0xfc28('0x42'),_0x33193e);}exports['getFields']=function(_0x49e595,_0x142b02){var _0x2179f8=_0x49e595[_0xfc28('0x1d')]['ticketType'];var _0x3389e4=_0x2179f8===_0xfc28('0x43')?_0xfc28('0x44'):_0xfc28('0x45');var _0x592e1c='';var _0x4cab39='';var _0x44a541='';var _0x2f28e5='';var _0x1d697f='';var _0x52b27d='';var _0x1f19ab='';var _0x3c1c5c='';var _0x9712b1=[_0xfc28('0x46'),_0xfc28('0x47'),'customerid',_0xfc28('0x48'),_0xfc28('0x49'),_0xfc28('0x4a'),_0xfc28('0x4b'),_0xfc28('0x4c'),_0xfc28('0x4d'),_0xfc28('0x4e')];var _0x3c1a56=[_0xfc28('0x4f'),_0xfc28('0x50'),_0xfc28('0x51'),_0xfc28('0x52'),_0xfc28('0x53'),_0xfc28('0x54'),'contractdetailidname',_0xfc28('0x55'),_0xfc28('0x56'),_0xfc28('0x57'),_0xfc28('0x58'),_0xfc28('0x59'),_0xfc28('0x5a'),_0xfc28('0x5b'),_0xfc28('0x5c'),_0xfc28('0x5d'),_0xfc28('0x5e'),_0xfc28('0x5f'),_0xfc28('0x60'),_0xfc28('0x61'),_0xfc28('0x62'),_0xfc28('0x63'),_0xfc28('0x64'),'exchangerate',_0xfc28('0x65'),_0xfc28('0x66'),_0xfc28('0x67'),_0xfc28('0x68'),_0xfc28('0x69'),_0xfc28('0x6a'),_0xfc28('0x6b'),'modifiedbyexternalpartyname',_0xfc28('0x6c'),'modifiedbyname','modifiedbyyominame',_0xfc28('0x6d'),_0xfc28('0x6e'),_0xfc28('0x6f'),_0xfc28('0x70'),_0xfc28('0x71'),'numberofchildincidents','onholdtime',_0xfc28('0x72'),_0xfc28('0x73'),_0xfc28('0x74'),_0xfc28('0x75'),_0xfc28('0x76'),_0xfc28('0x77'),_0xfc28('0x78'),_0xfc28('0x79'),_0xfc28('0x7a'),_0xfc28('0x7b'),_0xfc28('0x7c'),'resolvebykpiidname',_0xfc28('0x7d'),'responsiblecontactidname',_0xfc28('0x7e'),_0xfc28('0x7f'),_0xfc28('0x80'),_0xfc28('0x81'),_0xfc28('0x82'),_0xfc28('0x83'),_0xfc28('0x84'),'subjectidname',_0xfc28('0x85'),'timezoneruleversionnumber',_0xfc28('0x86'),_0xfc28('0x87'),_0xfc28('0x88'),_0xfc28('0x89')];var _0x1f677a=_0x9712b1['concat'](_0x3c1a56);return db[_0xfc28('0x19')][_0xfc28('0x39')]({'where':{'id':_0x49e595[_0xfc28('0x37')]['id']},'attributes':['id',_0xfc28('0x8a'),_0xfc28('0x8b'),_0xfc28('0x8c'),'tenantId',_0xfc28('0x8d'),_0xfc28('0x8e'),'modernAuthentication'],'include':[{'model':db[_0xfc28('0x8f')],'as':_0xfc28('0x8f'),'attributes':['id',_0xfc28('0x90'),'data7']}]})[_0xfc28('0x10')](handleEntityNotFound(_0x142b02,null))[_0xfc28('0x10')](function(_0x37a008){if(_0x37a008){if(_0x37a008[_0xfc28('0x91')]){_0x37a008[_0xfc28('0x92')]=_0x37a008['CloudProvider']['data5'];_0x3c1c5c=sanitizeRemoteUri(_0x37a008[_0xfc28('0x8f')][_0xfc28('0x93')]);_0x1f19ab=getWebApiUrl(_0x3c1c5c);return _0x37a008;}_0x3c1c5c=sanitizeRemoteUri(_0x37a008['remoteUri']);_0x1f19ab=getWebApiUrl(_0x3c1c5c);var _0x5dde9a={'method':_0xfc28('0x94'),'uri':_0xfc28('0x95')+_0x37a008[_0xfc28('0x96')]+_0xfc28('0x97'),'form':{'client_id':_0x37a008[_0xfc28('0x8d')],'resource':_0x3c1c5c,'username':_0x37a008[_0xfc28('0x8a')],'password':_0x37a008[_0xfc28('0x8b')],'grant_type':_0xfc28('0x8b'),'client_secret':_0x37a008[_0xfc28('0x8e')]},'json':!![]};return rp(_0x5dde9a);}})[_0xfc28('0x10')](function(_0x2c8aaf){_0x52b27d=_0x2c8aaf[_0xfc28('0x92')];var _0x2186c3={'method':_0xfc28('0x98'),'uri':encodeURI(_0x1f19ab+_0xfc28('0x99')+_0x3389e4+'\x27'),'headers':{'Authorization':_0xfc28('0x9a')+_0x52b27d,'If-None-Match':null,'OData-Version':_0xfc28('0x9b')},'json':!![]};return rp(_0x2186c3);})[_0xfc28('0x10')](function(_0x4a79a6){var _0x450004=_0x4a79a6['value'][0x0];var _0x36a29c=_0x450004['MetadataId'];var _0x1734fd={'method':_0xfc28('0x98'),'uri':_0x1f19ab+_0xfc28('0x9c')+_0x36a29c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xfc28('0x9a')+_0x52b27d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1734fd);})[_0xfc28('0x10')](function(_0x5b0448){_0x592e1c=_0x5b0448;_0x4cab39=_0x592e1c[_0xfc28('0x9d')];_0x4cab39=_[_0xfc28('0x9e')](_0x4cab39,function(_0x1f9304){return!_0x1f677a[_0xfc28('0x9f')](_0x1f9304['LogicalName']);});var _0x548f3d=[];var _0x188868=[];_0x4cab39['forEach'](function(_0x4059ae){if(_0x4059ae[_0xfc28('0xa0')]){var _0x46514c=_0x4059ae[_0xfc28('0xa0')][_0xfc28('0x40')](_0x4059ae[_0xfc28('0xa0')][_0xfc28('0xa1')]('.')+0x1);if(_0x46514c===_0xfc28('0xa2')){_0x548f3d['push'](getSelectList(_0x1f19ab,_0x2179f8,_0x188868,_0x592e1c[_0xfc28('0xa3')],_0x4059ae[_0xfc28('0xa3')],_0x52b27d));}}});return Promise[_0xfc28('0xa4')](_0x548f3d);})[_0xfc28('0x10')](function(_0x204cb1){_0x44a541=_0x204cb1[0x0];var _0x26c2f1=[];var _0x207c21=[];_0x4cab39[_0xfc28('0xa5')](function(_0x4f2880){if(!_['isNil'](_0x4f2880['@odata.type'])){var _0x1843ec=_0x4f2880[_0xfc28('0xa0')][_0xfc28('0x40')](_0x4f2880[_0xfc28('0xa0')][_0xfc28('0xa1')]('.')+0x1);if(_0x1843ec===_0xfc28('0xa6')){_0x26c2f1[_0xfc28('0xa7')](getBooleanList(_0x1f19ab,_0x2179f8,_0x207c21,_0x592e1c[_0xfc28('0xa3')],_0x4f2880['MetadataId'],_0x52b27d));}}});return Promise[_0xfc28('0xa4')](_0x26c2f1);})['then'](function(_0x21ad0a){_0x2f28e5=_0x21ad0a[0x0];var _0x160370=[];var _0x4bfdd9=[];_0x4cab39[_0xfc28('0xa5')](function(_0x2aa2d7){if(_0x2aa2d7['@odata.type']){var _0x1ca45b=_0x2aa2d7[_0xfc28('0xa0')][_0xfc28('0x40')](_0x2aa2d7[_0xfc28('0xa0')][_0xfc28('0xa1')]('.')+0x1);if(_0x1ca45b==='StringAttributeMetadata'||_0x1ca45b===_0xfc28('0xa8')||_0x1ca45b===_0xfc28('0xa9')||_0x1ca45b===_0xfc28('0xaa')||_0x1ca45b===_0xfc28('0xab')||_0x1ca45b===_0xfc28('0xac')||_0x1ca45b===_0xfc28('0xad')||_0x1ca45b===_0xfc28('0xae')||_0x1ca45b==='StateAttributeMetadata'||_0x1ca45b===_0xfc28('0xaf')){_0x160370[_0xfc28('0xa7')](getInputList(_0x1f19ab,_0x2179f8,_0x1ca45b,_0x4bfdd9,_0x592e1c[_0xfc28('0xa3')],_0x2aa2d7['MetadataId'],_0x52b27d));}}});return Promise[_0xfc28('0xa4')](_0x160370);})[_0xfc28('0x10')](function(_0x1602c0){_0x1d697f=_0x1602c0[0x0];var _0x3b75f1=_0x44a541[_0xfc28('0xb0')](_0x2f28e5)['concat'](_0x1d697f);var _0x432bbe={'count':_0x3b75f1[_0xfc28('0x3b')],'rows':_0x3b75f1};return _0x432bbe;})[_0xfc28('0x10')](respondWithResult(_0x142b02,null))['catch'](function(_0x20f127){var _0x26ef13=_0x49e595[_0xfc28('0x1d')][_0xfc28('0xb1')]?0x1f4:_0x20f127[_0xfc28('0xb2')]||0x1f4;logger[_0xfc28('0x14')](_0x20f127[_0xfc28('0x15')]);delete _0x20f127[_0xfc28('0x16')];if(_0x26ef13===0x191){_0x26ef13=0x190;}_0x142b02['status'](_0x26ef13)[_0xfc28('0x17')](_0x49e595['query'][_0xfc28('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x20f127[_0xfc28('0xb2')]}:_0x20f127);});};function getSelectList(_0x407eba,_0x3fd996,_0x48e38b,_0x45feb1,_0x65c28f,_0x5218bb){var _0x18268f={'method':'GET','uri':_0x407eba+'EntityDefinitions('+_0x45feb1+')/Attributes('+_0x65c28f+_0xfc28('0xb3')+_0xfc28('0xb4'),'headers':{'Authorization':_0xfc28('0x9a')+_0x5218bb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18268f)[_0xfc28('0x10')](function(_0x53c8bb){var _0x49320b=[];var _0xf907b=_0x53c8bb[_0xfc28('0xb5')]['Options'];_0xf907b['forEach'](function(_0x3538f0){_0x49320b[_0xfc28('0xa7')]({'name':_0x3538f0[_0xfc28('0xb6')][_0xfc28('0xb7')]['Label'],'value':String(_0x3538f0[_0xfc28('0xb8')])});});var _0x3db369={'id':_0x3fd996+'_'+_0x53c8bb[_0xfc28('0xb9')],'name':_0x53c8bb[_0xfc28('0xba')][_0xfc28('0xb7')]['Label'],'custom':![],'options':_0x49320b};_0x48e38b['push'](_0x3db369);return _0x48e38b;});}function getBooleanList(_0x56d65d,_0x3233f4,_0x48c69b,_0x53ee6f,_0x500e7e,_0x3bdca1){var _0x2d1edb={'method':_0xfc28('0x98'),'uri':_0x56d65d+_0xfc28('0x9c')+_0x53ee6f+_0xfc28('0xbb')+_0x500e7e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xfc28('0x9a')+_0x3bdca1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2d1edb)['then'](function(_0x41445c){var _0x44b734=[];_0x44b734[_0xfc28('0xa7')]({'name':_0x41445c['OptionSet']['TrueOption']['Label'][_0xfc28('0xb7')][_0xfc28('0xb6')],'value':'true'},{'name':_0x41445c[_0xfc28('0xb5')][_0xfc28('0xbc')][_0xfc28('0xb6')]['UserLocalizedLabel'][_0xfc28('0xb6')],'value':_0xfc28('0xbd')});var _0xdf368b={'id':_0x3233f4+'_'+_0x41445c[_0xfc28('0xb9')],'name':_0x41445c['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x44b734};_0x48c69b[_0xfc28('0xa7')](_0xdf368b);return _0x48c69b;});}function getInputList(_0x16c38d,_0x1c2497,_0x117f11,_0x473f3c,_0x318420,_0x7314ef,_0x42c65a){var _0x2eaa5c={'method':_0xfc28('0x98'),'uri':_0x16c38d+_0xfc28('0x9c')+_0x318420+')/Attributes('+_0x7314ef+')/Microsoft.Dynamics.CRM.'+_0x117f11+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xfc28('0x9a')+_0x42c65a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2eaa5c)[_0xfc28('0x10')](function(_0x29ed1e){var _0x3ff5c0={'id':_0x1c2497+'_'+_0x29ed1e[_0xfc28('0xb9')],'name':_0x29ed1e[_0xfc28('0xba')][_0xfc28('0xb7')]?_0x29ed1e[_0xfc28('0xba')]['UserLocalizedLabel'][_0xfc28('0xb6')]:_0x29ed1e[_0xfc28('0xb9')],'custom':![],'options':[]};_0x473f3c['push'](_0x3ff5c0);return _0x473f3c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 00beb70..40f4444 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 _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x43987f,_0x22335c){var _0x536b31=function(_0x5e2071){while(--_0x5e2071){_0x43987f['push'](_0x43987f['shift']());}};_0x536b31(++_0x22335c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xcb91[_0x587ba2];return _0x50ec73;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x576cf9,_0x8687e3){var _0x4db907=function(_0x376dc7){while(--_0x376dc7){_0x576cf9['push'](_0x576cf9['shift']());}};_0x4db907(++_0x8687e3);}(_0x757a,0xde));var _0xa757=function(_0x4385b7,_0x287738){_0x4385b7=_0x4385b7-0x0;var _0x4b6bb0=_0x757a[_0x4385b7];return _0x4b6bb0;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 8edacf7..c86642a 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 _0x38ed=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDynamics365Account','findAll','options','attributes','map','include','model','ShowDynamics365Account','find','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x2ceba7,_0x451ce4){var _0x5348eb=function(_0x3596fc){while(--_0x3596fc){_0x2ceba7['push'](_0x2ceba7['shift']());}};_0x5348eb(++_0x451ce4);}(_0x38ed,0x118));var _0xd38e=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x38ed[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xd38e('0x0'));var util=require('util');var moment=require(_0xd38e('0x1'));var BPromise=require(_0xd38e('0x2'));var rs=require(_0xd38e('0x3'));var fs=require('fs');var Redis=require(_0xd38e('0x4'));var db=require(_0xd38e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd38e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd38e('0x7'));var client=jayson[_0xd38e('0x8')][_0xd38e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x187594,_0xf6638f,_0x436c9b){return new BPromise(function(_0x5d12ac,_0x4b8bc){return client[_0xd38e('0xa')](_0x187594,_0x436c9b)[_0xd38e('0xb')](function(_0x1ee253){logger[_0xd38e('0xc')](_0xd38e('0xd'),_0xf6638f,_0xd38e('0xe'));logger[_0xd38e('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xf6638f,_0xd38e('0xe'),JSON[_0xd38e('0x10')](_0x1ee253));if(_0x1ee253[_0xd38e('0x11')]){if(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x12')]===0x1f4){logger['error'](_0xd38e('0xd'),_0xf6638f,_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);return _0x4b8bc(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);}logger[_0xd38e('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0xf6638f,_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);return _0x5d12ac(_0x1ee253[_0xd38e('0x11')][_0xd38e('0x13')]);}else{logger[_0xd38e('0xc')](_0xd38e('0xd'),_0xf6638f,_0xd38e('0xe'));_0x5d12ac(_0x1ee253[_0xd38e('0x14')][_0xd38e('0x13')]);}})[_0xd38e('0x15')](function(_0x361d95){logger['error'](_0xd38e('0xd'),_0xf6638f,_0x361d95);_0x4b8bc(_0x361d95);});});}exports[_0xd38e('0x16')]=function(_0x323cdf){var _0x5efc4e=this;return new Promise(function(_0x58bf15,_0x373c08){return db['Dynamics365Account'][_0xd38e('0x17')]({'raw':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['where']||null:null,'attributes':_0x323cdf[_0xd38e('0x18')]?_0x323cdf['options'][_0xd38e('0x19')]||null:null,'limit':_0x323cdf[_0xd38e('0x18')]?_0x323cdf['options']['limit']||null:null,'include':_0x323cdf[_0xd38e('0x18')]?_0x323cdf[_0xd38e('0x18')]['include']?_[_0xd38e('0x1a')](_0x323cdf[_0xd38e('0x18')][_0xd38e('0x1b')],function(_0x69d10){return{'model':db[_0x69d10['model']],'as':_0x69d10['as'],'attributes':_0x69d10['attributes'],'include':_0x69d10[_0xd38e('0x1b')]?_['map'](_0x69d10[_0xd38e('0x1b')],function(_0x5f8eae){return{'model':db[_0x5f8eae[_0xd38e('0x1c')]],'as':_0x5f8eae['as'],'attributes':_0x5f8eae[_0xd38e('0x19')],'include':_0x5f8eae[_0xd38e('0x1b')]?_[_0xd38e('0x1a')](_0x5f8eae[_0xd38e('0x1b')],function(_0x3f3e1f){return{'model':db[_0x3f3e1f[_0xd38e('0x1c')]],'as':_0x3f3e1f['as'],'attributes':_0x3f3e1f[_0xd38e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41449e){logger[_0xd38e('0xc')]('GetDynamics365Account',_0x323cdf);logger['debug'](_0xd38e('0x16'),_0x323cdf,JSON[_0xd38e('0x10')](_0x41449e));_0x58bf15(_0x41449e);})[_0xd38e('0x15')](function(_0xf7dcc9){logger[_0xd38e('0x11')](_0xd38e('0x16'),_0xf7dcc9[_0xd38e('0x13')],_0x323cdf);_0x373c08(_0x5efc4e[_0xd38e('0x11')](0x1f4,_0xf7dcc9[_0xd38e('0x13')]));});});};exports[_0xd38e('0x1d')]=function(_0x911444){var _0x50ba28=this;return new Promise(function(_0x39cf09,_0x30feb2){return db['Dynamics365Account'][_0xd38e('0x1e')]({'raw':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')][_0xd38e('0x1f')]===undefined?!![]:![]:!![],'where':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')]['where']||null:null,'attributes':_0x911444[_0xd38e('0x18')]?_0x911444['options'][_0xd38e('0x19')]||null:null,'include':_0x911444[_0xd38e('0x18')]?_0x911444[_0xd38e('0x18')]['include']?_['map'](_0x911444['options'][_0xd38e('0x1b')],function(_0x1f66f6){return{'model':db[_0x1f66f6[_0xd38e('0x1c')]],'as':_0x1f66f6['as'],'attributes':_0x1f66f6[_0xd38e('0x19')],'include':_0x1f66f6[_0xd38e('0x1b')]?_[_0xd38e('0x1a')](_0x1f66f6[_0xd38e('0x1b')],function(_0x30888e){return{'model':db[_0x30888e[_0xd38e('0x1c')]],'as':_0x30888e['as'],'attributes':_0x30888e[_0xd38e('0x19')],'include':_0x30888e['include']?_[_0xd38e('0x1a')](_0x30888e[_0xd38e('0x1b')],function(_0x457daa){return{'model':db[_0x457daa[_0xd38e('0x1c')]],'as':_0x457daa['as'],'attributes':_0x457daa[_0xd38e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd38e('0xb')](function(_0x423dd9){logger[_0xd38e('0xc')](_0xd38e('0x1d'),_0x911444);logger[_0xd38e('0xf')](_0xd38e('0x1d'),_0x911444,JSON[_0xd38e('0x10')](_0x423dd9));_0x39cf09(_0x423dd9);})[_0xd38e('0x15')](function(_0xaee9fc){logger[_0xd38e('0x11')](_0xd38e('0x1d'),_0xaee9fc[_0xd38e('0x13')],_0x911444);_0x30feb2(_0x50ba28[_0xd38e('0x11')](0x1f4,_0xaee9fc[_0xd38e('0x13')]));});});}; \ No newline at end of file +var _0x026c=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Dynamics365Account','findAll','options','attributes','limit','include','model','map','then','GetDynamics365Account','catch','ShowDynamics365Account','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x026c,0x1ad));var _0xc026=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x026c[_0x5c7a85];return _0x35290f;};'use strict';var _=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var moment=require('moment');var BPromise=require(_0xc026('0x2'));var rs=require(_0xc026('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc026('0x4'))['db'];var utils=require(_0xc026('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc026('0x6'));var jayson=require(_0xc026('0x7'));var client=jayson['client'][_0xc026('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aecaf,_0x123ea2,_0x1906cc){return new BPromise(function(_0x238ae5,_0x3ddcca){return client[_0xc026('0x9')](_0x1aecaf,_0x1906cc)['then'](function(_0x20f15b){logger[_0xc026('0xa')](_0xc026('0xb'),_0x123ea2,_0xc026('0xc'));logger[_0xc026('0xd')](_0xc026('0xe'),_0x123ea2,_0xc026('0xc'),JSON[_0xc026('0xf')](_0x20f15b));if(_0x20f15b[_0xc026('0x10')]){if(_0x20f15b[_0xc026('0x10')][_0xc026('0x11')]===0x1f4){logger[_0xc026('0x10')](_0xc026('0xb'),_0x123ea2,_0x20f15b[_0xc026('0x10')][_0xc026('0x12')]);return _0x3ddcca(_0x20f15b[_0xc026('0x10')][_0xc026('0x12')]);}logger['error'](_0xc026('0xb'),_0x123ea2,_0x20f15b[_0xc026('0x10')][_0xc026('0x12')]);return _0x238ae5(_0x20f15b['error'][_0xc026('0x12')]);}else{logger[_0xc026('0xa')](_0xc026('0xb'),_0x123ea2,'request\x20sent');_0x238ae5(_0x20f15b[_0xc026('0x13')]['message']);}})['catch'](function(_0x5e248a){logger[_0xc026('0x10')](_0xc026('0xb'),_0x123ea2,_0x5e248a);_0x3ddcca(_0x5e248a);});});}exports['GetDynamics365Account']=function(_0x1e9de7){var _0xd112d2=this;return new Promise(function(_0x4c0ba4,_0xaab1d3){return db[_0xc026('0x14')][_0xc026('0x15')]({'raw':_0x1e9de7[_0xc026('0x16')]?_0x1e9de7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1e9de7[_0xc026('0x16')]?_0x1e9de7[_0xc026('0x16')]['where']||null:null,'attributes':_0x1e9de7[_0xc026('0x16')]?_0x1e9de7[_0xc026('0x16')][_0xc026('0x17')]||null:null,'limit':_0x1e9de7['options']?_0x1e9de7[_0xc026('0x16')][_0xc026('0x18')]||null:null,'include':_0x1e9de7[_0xc026('0x16')]?_0x1e9de7[_0xc026('0x16')][_0xc026('0x19')]?_['map'](_0x1e9de7[_0xc026('0x16')]['include'],function(_0x5ca4f8){return{'model':db[_0x5ca4f8[_0xc026('0x1a')]],'as':_0x5ca4f8['as'],'attributes':_0x5ca4f8[_0xc026('0x17')],'include':_0x5ca4f8[_0xc026('0x19')]?_[_0xc026('0x1b')](_0x5ca4f8[_0xc026('0x19')],function(_0x326ab7){return{'model':db[_0x326ab7[_0xc026('0x1a')]],'as':_0x326ab7['as'],'attributes':_0x326ab7['attributes'],'include':_0x326ab7[_0xc026('0x19')]?_['map'](_0x326ab7[_0xc026('0x19')],function(_0xa0a3c){return{'model':db[_0xa0a3c['model']],'as':_0xa0a3c['as'],'attributes':_0xa0a3c[_0xc026('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc026('0x1c')](function(_0x29a295){logger['info'](_0xc026('0x1d'),_0x1e9de7);logger['debug'](_0xc026('0x1d'),_0x1e9de7,JSON[_0xc026('0xf')](_0x29a295));_0x4c0ba4(_0x29a295);})[_0xc026('0x1e')](function(_0x233dc3){logger[_0xc026('0x10')]('GetDynamics365Account',_0x233dc3[_0xc026('0x12')],_0x1e9de7);_0xaab1d3(_0xd112d2[_0xc026('0x10')](0x1f4,_0x233dc3[_0xc026('0x12')]));});});};exports[_0xc026('0x1f')]=function(_0x117a84){var _0x1d5c7f=this;return new Promise(function(_0x186892,_0xf67f90){return db[_0xc026('0x14')][_0xc026('0x20')]({'raw':_0x117a84[_0xc026('0x16')]?_0x117a84[_0xc026('0x16')][_0xc026('0x21')]===undefined?!![]:![]:!![],'where':_0x117a84[_0xc026('0x16')]?_0x117a84[_0xc026('0x16')]['where']||null:null,'attributes':_0x117a84[_0xc026('0x16')]?_0x117a84['options'][_0xc026('0x17')]||null:null,'include':_0x117a84[_0xc026('0x16')]?_0x117a84[_0xc026('0x16')]['include']?_[_0xc026('0x1b')](_0x117a84[_0xc026('0x16')]['include'],function(_0x325950){return{'model':db[_0x325950['model']],'as':_0x325950['as'],'attributes':_0x325950[_0xc026('0x17')],'include':_0x325950[_0xc026('0x19')]?_[_0xc026('0x1b')](_0x325950['include'],function(_0x2b51ad){return{'model':db[_0x2b51ad[_0xc026('0x1a')]],'as':_0x2b51ad['as'],'attributes':_0x2b51ad[_0xc026('0x17')],'include':_0x2b51ad['include']?_[_0xc026('0x1b')](_0x2b51ad['include'],function(_0x24d88d){return{'model':db[_0x24d88d[_0xc026('0x1a')]],'as':_0x24d88d['as'],'attributes':_0x24d88d[_0xc026('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc026('0x1c')](function(_0x60b831){logger[_0xc026('0xa')](_0xc026('0x1f'),_0x117a84);logger['debug']('ShowDynamics365Account',_0x117a84,JSON[_0xc026('0xf')](_0x60b831));_0x186892(_0x60b831);})[_0xc026('0x1e')](function(_0x420f1d){logger['error'](_0xc026('0x1f'),_0x420f1d['message'],_0x117a84);_0xf67f90(_0x1d5c7f[_0xc026('0x10')](0x1f4,_0x420f1d[_0xc026('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 15a7ebe..ae6e77d 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 _0xa3c3=['./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x532dec,_0x325cc7){_0x532dec=_0x532dec-0x0;var _0x3a491a=_0xa3c3[_0x532dec];return _0x3a491a;};'use strict';var multer=require(_0x3a3c('0x0'));var util=require('util');var path=require(_0x3a3c('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a3c('0x2'));var router=express['Router']();var fs_extra=require(_0x3a3c('0x3'));var auth=require(_0x3a3c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3a3c('0x5'));var controller=require(_0x3a3c('0x6'));router[_0x3a3c('0x7')]('/',auth[_0x3a3c('0x8')](),controller['index']);router['get'](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0xa')]);router[_0x3a3c('0x7')](_0x3a3c('0xb'),auth['isAuthenticated'](),controller[_0x3a3c('0xc')]);router[_0x3a3c('0x7')](_0x3a3c('0xd'),auth[_0x3a3c('0x8')](),controller['getSubjects']);router[_0x3a3c('0x7')](_0x3a3c('0xe'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0xf')]);router['post']('/',auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x10')]);router[_0x3a3c('0x11')](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x12')]);router[_0x3a3c('0x13')](_0x3a3c('0x9'),auth[_0x3a3c('0x8')](),controller[_0x3a3c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd276=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','index','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','post','create','put','/:id','update','exports','multer'];(function(_0x4cfff8,_0x37aa0a){var _0x3617d7=function(_0x20ce32){while(--_0x20ce32){_0x4cfff8['push'](_0x4cfff8['shift']());}};_0x3617d7(++_0x37aa0a);}(_0xd276,0xfc));var _0x6d27=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0xd276[_0x18b5e8];return _0x25baed;};'use strict';var multer=require(_0x6d27('0x0'));var util=require(_0x6d27('0x1'));var path=require(_0x6d27('0x2'));var timeout=require(_0x6d27('0x3'));var express=require('express');var router=express[_0x6d27('0x4')]();var fs_extra=require(_0x6d27('0x5'));var auth=require(_0x6d27('0x6'));var interaction=require(_0x6d27('0x7'));var config=require('../../config/environment');var controller=require(_0x6d27('0x8'));router[_0x6d27('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d27('0xa')]);router[_0x6d27('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6d27('0xb')]);router[_0x6d27('0x9')](_0x6d27('0xc'),auth[_0x6d27('0xd')](),controller[_0x6d27('0xe')]);router[_0x6d27('0x9')](_0x6d27('0xf'),auth[_0x6d27('0xd')](),controller[_0x6d27('0x10')]);router[_0x6d27('0x9')]('/:id/descriptions',auth[_0x6d27('0xd')](),controller['getDescriptions']);router[_0x6d27('0x11')]('/',auth[_0x6d27('0xd')](),controller[_0x6d27('0x12')]);router[_0x6d27('0x13')](_0x6d27('0x14'),auth[_0x6d27('0xd')](),controller[_0x6d27('0x15')]);router['delete']('/:id',auth[_0x6d27('0xd')](),controller['destroy']);module[_0x6d27('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 b5799f2..cd82447 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 _0xb2f6=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident'];(function(_0x11f5ff,_0xa0ef18){var _0x46eefb=function(_0x51872a){while(--_0x51872a){_0x11f5ff['push'](_0x11f5ff['shift']());}};_0x46eefb(++_0xa0ef18);}(_0xb2f6,0xb9));var _0x6b2f=function(_0x149fc0,_0x133113){_0x149fc0=_0x149fc0-0x0;var _0x63a2a2=_0xb2f6[_0x149fc0];return _0x63a2a2;};'use strict';var Sequelize=require('sequelize');module[_0x6b2f('0x0')]={'name':{'type':Sequelize[_0x6b2f('0x1')]},'description':{'type':Sequelize[_0x6b2f('0x1')]},'ticketType':{'type':Sequelize[_0x6b2f('0x2')]('incident','phonecall'),'defaultValue':_0x6b2f('0x3')},'moduleCreate':{'type':Sequelize[_0x6b2f('0x2')](_0x6b2f('0x4'),_0x6b2f('0x5')),'defaultValue':_0x6b2f('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x6b2f('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x6b2f('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8849=['sequelize','STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8849,0x100));var _0x9884=function(_0x6fc601,_0xb5fcfb){_0x6fc601=_0x6fc601-0x0;var _0x47041d=_0x8849[_0x6fc601];return _0x47041d;};'use strict';var Sequelize=require(_0x9884('0x0'));module['exports']={'name':{'type':Sequelize[_0x9884('0x1')]},'description':{'type':Sequelize[_0x9884('0x1')]},'ticketType':{'type':Sequelize[_0x9884('0x2')](_0x9884('0x3'),_0x9884('0x4')),'defaultValue':_0x9884('0x3')},'moduleCreate':{'type':Sequelize[_0x9884('0x2')](_0x9884('0x5'),_0x9884('0x6')),'defaultValue':_0x9884('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9884('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9884('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 24545de..dd6b598 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 _0xa1aa=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','rows','show','keys','fields','include','find','catch','create','body','params','getFields','findOne','rawAttributes','order','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x1ba9bd,_0x3299e8){var _0x19aae2=function(_0x1ebe8f){while(--_0x1ebe8f){_0x1ba9bd['push'](_0x1ba9bd['shift']());}};_0x19aae2(++_0x3299e8);}(_0xa1aa,0x1d5));var _0xaa1a=function(_0x4906b1,_0x3e502b){_0x4906b1=_0x4906b1-0x0;var _0x16488a=_0xa1aa[_0x4906b1];return _0x16488a;};'use strict';var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var moment=require(_0xaa1a('0x5'));var BPromise=require(_0xaa1a('0x6'));var Mustache=require(_0xaa1a('0x7'));var util=require('util');var path=require(_0xaa1a('0x8'));var sox=require(_0xaa1a('0x9'));var csv=require(_0xaa1a('0xa'));var ejs=require(_0xaa1a('0xb'));var fs=require('fs');var fs_extra=require(_0xaa1a('0xc'));var _=require(_0xaa1a('0xd'));var squel=require(_0xaa1a('0xe'));var crypto=require(_0xaa1a('0xf'));var jsforce=require(_0xaa1a('0x10'));var deskjs=require(_0xaa1a('0x11'));var toCsv=require(_0xaa1a('0xa'));var querystring=require(_0xaa1a('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0x13'));var qs=require(_0xaa1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa1a('0x15'));var logger=require(_0xaa1a('0x16'))('api');var utils=require(_0xaa1a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa1a('0x18'))['db'];function respondWithStatusCode(_0x2aa4a5,_0x425d3d){_0x425d3d=_0x425d3d||0xcc;return function(_0x2c1193){if(_0x2c1193){return _0x2aa4a5[_0xaa1a('0x19')](_0x425d3d);}return _0x2aa4a5[_0xaa1a('0x1a')](_0x425d3d)['end']();};}function respondWithResult(_0x4666cf,_0x531ee5){_0x531ee5=_0x531ee5||0xc8;return function(_0x1e55e1){if(_0x1e55e1){return _0x4666cf[_0xaa1a('0x1a')](_0x531ee5)[_0xaa1a('0x1b')](_0x1e55e1);}};}function respondWithFilteredResult(_0x4e00ea,_0xc0500e){return function(_0xf34d73){if(_0xf34d73){var _0x1380c6=typeof _0xc0500e[_0xaa1a('0x1c')]===_0xaa1a('0x1d')&&typeof _0xc0500e[_0xaa1a('0x1e')]==='undefined';var _0x40923e=_0xf34d73['count'];var _0x43b3d9=_0x1380c6?0x0:_0xc0500e[_0xaa1a('0x1c')];var _0x1212a2=_0x1380c6?_0xf34d73[_0xaa1a('0x1f')]:_0xc0500e['offset']+_0xc0500e[_0xaa1a('0x1e')];var _0x1737d0;if(_0x1212a2>=_0x40923e){_0x1212a2=_0x40923e;_0x1737d0=0xc8;}else{_0x1737d0=0xce;}_0x4e00ea[_0xaa1a('0x1a')](_0x1737d0);return _0x4e00ea['set'](_0xaa1a('0x20'),_0x43b3d9+'-'+_0x1212a2+'/'+_0x40923e)[_0xaa1a('0x1b')](_0xf34d73);}return null;};}function patchUpdates(_0x5c32d0){return function(_0x193935){try{jsonpatch[_0xaa1a('0x21')](_0x193935,_0x5c32d0,!![]);}catch(_0x4833c2){return BPromise[_0xaa1a('0x22')](_0x4833c2);}return _0x193935['save']();};}function saveUpdates(_0x572355,_0x1f5ec5){return function(_0x274e28){if(_0x274e28){return _0x274e28[_0xaa1a('0x23')](_0x572355)[_0xaa1a('0x24')](function(_0x3cf7aa){return _0x3cf7aa;});}return null;};}function removeEntity(_0x74bd3,_0x4945c2){return function(_0x5f2361){if(_0x5f2361){return _0x5f2361[_0xaa1a('0x25')]()[_0xaa1a('0x24')](function(){_0x74bd3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa6691f,_0xb48b92){return function(_0x41930a){if(!_0x41930a){_0xa6691f[_0xaa1a('0x19')](0x194);}return _0x41930a;};}function handleError(_0x2e6b0a,_0x891830){_0x891830=_0x891830||0x1f4;return function(_0x4b1475){logger[_0xaa1a('0x26')](_0x4b1475[_0xaa1a('0x27')]);if(_0x4b1475[_0xaa1a('0x28')]){delete _0x4b1475[_0xaa1a('0x28')];}_0x2e6b0a[_0xaa1a('0x1a')](_0x891830)[_0xaa1a('0x29')](_0x4b1475);};}exports[_0xaa1a('0x2a')]=function(_0x502093,_0x43f8b0){var _0x42108a={},_0x5d96d3={},_0x235d4d={'count':0x0,'rows':[]};var _0x4831e9=_[_0xaa1a('0x2b')](db[_0xaa1a('0x2c')]['rawAttributes'],function(_0x322799){return{'name':_0x322799[_0xaa1a('0x2d')],'type':_0x322799['type'][_0xaa1a('0x2e')]};});_0x5d96d3[_0xaa1a('0x2f')]=_[_0xaa1a('0x2b')](_0x4831e9,'name');_0x5d96d3[_0xaa1a('0x30')]=_['keys'](_0x502093[_0xaa1a('0x30')]);_0x5d96d3[_0xaa1a('0x31')]=_['intersection'](_0x5d96d3['model'],_0x5d96d3[_0xaa1a('0x30')]);_0x42108a['attributes']=_[_0xaa1a('0x32')](_0x5d96d3[_0xaa1a('0x2f')],qs['fields'](_0x502093['query']['fields']));_0x42108a[_0xaa1a('0x33')]=_0x42108a[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x42108a[_0xaa1a('0x33')]:_0x5d96d3[_0xaa1a('0x2f')];if(!_0x502093[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x42108a[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x502093[_0xaa1a('0x30')][_0xaa1a('0x1e')]);_0x42108a[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x502093[_0xaa1a('0x30')][_0xaa1a('0x1c')]);}_0x42108a['order']=qs[_0xaa1a('0x37')](_0x502093[_0xaa1a('0x30')]['sort']);_0x42108a['where']=qs[_0xaa1a('0x31')](_[_0xaa1a('0x38')](_0x502093['query'],_0x5d96d3['filters']),_0x4831e9);if(_0x502093[_0xaa1a('0x30')][_0xaa1a('0x39')]){_0x42108a[_0xaa1a('0x3a')]=_[_0xaa1a('0x3b')](_0x42108a[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x4831e9,function(_0x2c59d2){if(_0x2c59d2[_0xaa1a('0x3c')]!=='VIRTUAL'){var _0xeadaf0={};_0xeadaf0[_0x2c59d2[_0xaa1a('0x28')]]={'$like':'%'+_0x502093[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0xeadaf0;}})});}_0x42108a=_[_0xaa1a('0x3b')]({},_0x42108a,_0x502093[_0xaa1a('0x3d')]);var _0x55a104={'where':_0x42108a[_0xaa1a('0x3a')]};return db[_0xaa1a('0x2c')][_0xaa1a('0x1f')](_0x55a104)['then'](function(_0x1eb409){_0x235d4d[_0xaa1a('0x1f')]=_0x1eb409;if(_0x502093[_0xaa1a('0x30')][_0xaa1a('0x3e')]){_0x42108a['include']=[{'all':!![]}];}return db[_0xaa1a('0x2c')]['findAll'](_0x42108a);})[_0xaa1a('0x24')](function(_0x48cb2d){_0x235d4d[_0xaa1a('0x3f')]=_0x48cb2d;return _0x235d4d;})[_0xaa1a('0x24')](respondWithFilteredResult(_0x43f8b0,_0x42108a))['catch'](handleError(_0x43f8b0,null));};exports[_0xaa1a('0x40')]=function(_0x1e6126,_0xdd3542){var _0x4a7c12={'raw':![],'where':{'id':_0x1e6126['params']['id']}},_0x2f48a5={};_0x2f48a5[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db['Dynamics365Configuration']['rawAttributes']);_0x2f48a5[_0xaa1a('0x30')]=_[_0xaa1a('0x41')](_0x1e6126['query']);_0x2f48a5[_0xaa1a('0x31')]=_['intersection'](_0x2f48a5[_0xaa1a('0x2f')],_0x2f48a5[_0xaa1a('0x30')]);_0x4a7c12[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x2f48a5[_0xaa1a('0x2f')],qs[_0xaa1a('0x42')](_0x1e6126['query'][_0xaa1a('0x42')]));_0x4a7c12['attributes']=_0x4a7c12[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x4a7c12[_0xaa1a('0x33')]:_0x2f48a5['model'];if(_0x1e6126[_0xaa1a('0x30')][_0xaa1a('0x3e')]){_0x4a7c12[_0xaa1a('0x43')]=[{'all':!![]}];}_0x4a7c12=_['merge']({},_0x4a7c12,_0x1e6126['options']);return db[_0xaa1a('0x2c')][_0xaa1a('0x44')](_0x4a7c12)[_0xaa1a('0x24')](handleEntityNotFound(_0xdd3542,null))[_0xaa1a('0x24')](respondWithResult(_0xdd3542,null))[_0xaa1a('0x45')](handleError(_0xdd3542,null));};exports[_0xaa1a('0x46')]=function(_0x43fff1,_0x1ba57f){return db['Dynamics365Configuration']['create'](_0x43fff1[_0xaa1a('0x47')],{})[_0xaa1a('0x24')](respondWithResult(_0x1ba57f,0xc9))[_0xaa1a('0x45')](handleError(_0x1ba57f,null));};exports['update']=function(_0x48d48c,_0x165290){if(_0x48d48c[_0xaa1a('0x47')]['id']){delete _0x48d48c[_0xaa1a('0x47')]['id'];}return db['Dynamics365Configuration'][_0xaa1a('0x44')]({'where':{'id':_0x48d48c[_0xaa1a('0x48')]['id']}})['then'](handleEntityNotFound(_0x165290,null))[_0xaa1a('0x24')](saveUpdates(_0x48d48c[_0xaa1a('0x47')],null))[_0xaa1a('0x24')](respondWithResult(_0x165290,null))['catch'](handleError(_0x165290,null));};exports['destroy']=function(_0x2521b0,_0x361db2){return db[_0xaa1a('0x2c')][_0xaa1a('0x44')]({'where':{'id':_0x2521b0['params']['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x361db2,null))[_0xaa1a('0x24')](removeEntity(_0x361db2,null))[_0xaa1a('0x45')](handleError(_0x361db2,null));};exports[_0xaa1a('0x49')]=function(_0x3ff571,_0x291704,_0x12fc0a){var _0x38281d={};var _0x8a1c92={};var _0x432b49;var _0x29fa09;return db[_0xaa1a('0x2c')][_0xaa1a('0x4a')]({'where':{'id':_0x3ff571[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x291704,null))['then'](function(_0x484774){if(_0x484774){_0x432b49=_0x484774;_0x8a1c92[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db['Dynamics365Field'][_0xaa1a('0x4b')]);_0x8a1c92[_0xaa1a('0x30')]=_[_0xaa1a('0x41')](_0x3ff571[_0xaa1a('0x30')]);_0x8a1c92[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x8a1c92[_0xaa1a('0x2f')],_0x8a1c92[_0xaa1a('0x30')]);_0x38281d['attributes']=_[_0xaa1a('0x32')](_0x8a1c92[_0xaa1a('0x2f')],qs[_0xaa1a('0x42')](_0x3ff571[_0xaa1a('0x30')]['fields']));_0x38281d[_0xaa1a('0x33')]=_0x38281d['attributes'][_0xaa1a('0x34')]?_0x38281d[_0xaa1a('0x33')]:_0x8a1c92['model'];_0x38281d[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x3ff571['query'][_0xaa1a('0x37')]);_0x38281d['where']=qs[_0xaa1a('0x31')](_[_0xaa1a('0x38')](_0x3ff571[_0xaa1a('0x30')],_0x8a1c92[_0xaa1a('0x31')]));if(_0x3ff571[_0xaa1a('0x30')]['filter']){_0x38281d[_0xaa1a('0x3a')]=_['merge'](_0x38281d[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x38281d['attributes'],function(_0x340d82){var _0x334bdf={};_0x334bdf[_0x340d82]={'$like':'%'+_0x3ff571['query'][_0xaa1a('0x39')]+'%'};return _0x334bdf;})});}_0x38281d=_[_0xaa1a('0x3b')]({},_0x38281d,_0x3ff571[_0xaa1a('0x3d')]);return _0x432b49[_0xaa1a('0x49')](_0x38281d);}})[_0xaa1a('0x24')](function(_0x5432ce){if(_0x5432ce){_0x29fa09=_0x5432ce[_0xaa1a('0x34')];if(!_0x3ff571[_0xaa1a('0x30')][_0xaa1a('0x35')]('nolimit')){_0x38281d[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x3ff571[_0xaa1a('0x30')]['limit']);_0x38281d[_0xaa1a('0x1c')]=qs['offset'](_0x3ff571['query'][_0xaa1a('0x1c')]);}return _0x432b49[_0xaa1a('0x49')](_0x38281d);}})[_0xaa1a('0x24')](function(_0x368a17){if(_0x368a17){return _0x368a17?{'count':_0x29fa09,'rows':_0x368a17}:null;}})[_0xaa1a('0x24')](respondWithResult(_0x291704,null))[_0xaa1a('0x45')](handleError(_0x291704,null));};exports['getSubjects']=function(_0x58a0d6,_0x8ee699,_0xf5bc5d){var _0x304292={};var _0x253ca2={};var _0x151596;var _0x41d333;return db[_0xaa1a('0x2c')][_0xaa1a('0x4a')]({'where':{'id':_0x58a0d6[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x8ee699,null))[_0xaa1a('0x24')](function(_0x17e6f9){if(_0x17e6f9){_0x151596=_0x17e6f9;_0x253ca2[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db[_0xaa1a('0x4d')]['rawAttributes']);_0x253ca2[_0xaa1a('0x30')]=_['keys'](_0x58a0d6[_0xaa1a('0x30')]);_0x253ca2[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x253ca2['model'],_0x253ca2[_0xaa1a('0x30')]);_0x304292[_0xaa1a('0x33')]=_['intersection'](_0x253ca2[_0xaa1a('0x2f')],qs['fields'](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x42')]));_0x304292[_0xaa1a('0x33')]=_0x304292[_0xaa1a('0x33')]['length']?_0x304292[_0xaa1a('0x33')]:_0x253ca2[_0xaa1a('0x2f')];_0x304292[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x37')]);_0x304292['where']=qs[_0xaa1a('0x31')](_['pick'](_0x58a0d6['query'],_0x253ca2[_0xaa1a('0x31')]));if(_0x58a0d6['query'][_0xaa1a('0x39')]){_0x304292['where']=_['merge'](_0x304292[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x304292['attributes'],function(_0x2d0666){var _0x5bdbbd={};_0x5bdbbd[_0x2d0666]={'$like':'%'+_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0x5bdbbd;})});}_0x304292=_[_0xaa1a('0x3b')]({},_0x304292,_0x58a0d6[_0xaa1a('0x3d')]);return _0x151596[_0xaa1a('0x4e')](_0x304292);}})[_0xaa1a('0x24')](function(_0x4b7487){if(_0x4b7487){_0x41d333=_0x4b7487[_0xaa1a('0x34')];if(!_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x304292[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x58a0d6[_0xaa1a('0x30')]['limit']);_0x304292[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x58a0d6[_0xaa1a('0x30')][_0xaa1a('0x1c')]);}return _0x151596[_0xaa1a('0x4e')](_0x304292);}})[_0xaa1a('0x24')](function(_0x5ca30f){if(_0x5ca30f){return _0x5ca30f?{'count':_0x41d333,'rows':_0x5ca30f}:null;}})['then'](respondWithResult(_0x8ee699,null))[_0xaa1a('0x45')](handleError(_0x8ee699,null));};exports['getDescriptions']=function(_0x3a9187,_0x56363,_0x27e1c8){var _0x2ba125={};var _0x5d46bb={};var _0xba1882;var _0x39a5e1;return db[_0xaa1a('0x2c')]['findOne']({'where':{'id':_0x3a9187[_0xaa1a('0x48')]['id']}})[_0xaa1a('0x24')](handleEntityNotFound(_0x56363,null))[_0xaa1a('0x24')](function(_0x57e23b){if(_0x57e23b){_0xba1882=_0x57e23b;_0x5d46bb[_0xaa1a('0x2f')]=_[_0xaa1a('0x41')](db[_0xaa1a('0x4d')][_0xaa1a('0x4b')]);_0x5d46bb[_0xaa1a('0x30')]=_['keys'](_0x3a9187[_0xaa1a('0x30')]);_0x5d46bb[_0xaa1a('0x31')]=_[_0xaa1a('0x32')](_0x5d46bb['model'],_0x5d46bb[_0xaa1a('0x30')]);_0x2ba125[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x5d46bb['model'],qs[_0xaa1a('0x42')](_0x3a9187['query']['fields']));_0x2ba125['attributes']=_0x2ba125[_0xaa1a('0x33')][_0xaa1a('0x34')]?_0x2ba125[_0xaa1a('0x33')]:_0x5d46bb[_0xaa1a('0x2f')];_0x2ba125[_0xaa1a('0x4c')]=qs[_0xaa1a('0x37')](_0x3a9187['query'][_0xaa1a('0x37')]);_0x2ba125['where']=qs['filters'](_[_0xaa1a('0x38')](_0x3a9187[_0xaa1a('0x30')],_0x5d46bb['filters']));if(_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x39')]){_0x2ba125[_0xaa1a('0x3a')]=_['merge'](_0x2ba125[_0xaa1a('0x3a')],{'$or':_[_0xaa1a('0x2b')](_0x2ba125[_0xaa1a('0x33')],function(_0x499ac4){var _0x5433b2={};_0x5433b2[_0x499ac4]={'$like':'%'+_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x39')]+'%'};return _0x5433b2;})});}_0x2ba125=_[_0xaa1a('0x3b')]({},_0x2ba125,_0x3a9187[_0xaa1a('0x3d')]);return _0xba1882[_0xaa1a('0x4f')](_0x2ba125);}})['then'](function(_0x39ce06){if(_0x39ce06){_0x39a5e1=_0x39ce06['length'];if(!_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x35')](_0xaa1a('0x36'))){_0x2ba125[_0xaa1a('0x1e')]=qs[_0xaa1a('0x1e')](_0x3a9187[_0xaa1a('0x30')][_0xaa1a('0x1e')]);_0x2ba125[_0xaa1a('0x1c')]=qs['offset'](_0x3a9187[_0xaa1a('0x30')]['offset']);}return _0xba1882['getDescriptions'](_0x2ba125);}})[_0xaa1a('0x24')](function(_0x405850){if(_0x405850){return _0x405850?{'count':_0x39a5e1,'rows':_0x405850}:null;}})[_0xaa1a('0x24')](respondWithResult(_0x56363,null))[_0xaa1a('0x45')](handleError(_0x56363,null));}; \ No newline at end of file +var _0xdb42=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','rows','catch','find','create','body','destroy','getFields','findOne','params','Dynamics365Field','filter','getSubjects','pick','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x376de5,_0x1b44a9){var _0x58d8f7=function(_0x2f3480){while(--_0x2f3480){_0x376de5['push'](_0x376de5['shift']());}};_0x58d8f7(++_0x1b44a9);}(_0xdb42,0xfa));var _0x2db4=function(_0x29675d,_0x207e7d){_0x29675d=_0x29675d-0x0;var _0x376fa3=_0xdb42[_0x29675d];return _0x376fa3;};'use strict';var emlformat=require(_0x2db4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2db4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2db4('0x2'));var moment=require(_0x2db4('0x3'));var BPromise=require(_0x2db4('0x4'));var Mustache=require(_0x2db4('0x5'));var util=require(_0x2db4('0x6'));var path=require(_0x2db4('0x7'));var sox=require(_0x2db4('0x8'));var csv=require(_0x2db4('0x9'));var ejs=require(_0x2db4('0xa'));var fs=require('fs');var fs_extra=require(_0x2db4('0xb'));var _=require(_0x2db4('0xc'));var squel=require(_0x2db4('0xd'));var crypto=require(_0x2db4('0xe'));var jsforce=require(_0x2db4('0xf'));var deskjs=require(_0x2db4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2db4('0x11'));var Papa=require(_0x2db4('0x12'));var Redis=require(_0x2db4('0x13'));var authService=require(_0x2db4('0x14'));var qs=require(_0x2db4('0x15'));var as=require(_0x2db4('0x16'));var hardwareService=require(_0x2db4('0x17'));var logger=require(_0x2db4('0x18'))(_0x2db4('0x19'));var utils=require(_0x2db4('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2db4('0x1b'))['db'];function respondWithStatusCode(_0x1f34cb,_0x152e20){_0x152e20=_0x152e20||0xcc;return function(_0x4802cf){if(_0x4802cf){return _0x1f34cb[_0x2db4('0x1c')](_0x152e20);}return _0x1f34cb[_0x2db4('0x1d')](_0x152e20)[_0x2db4('0x1e')]();};}function respondWithResult(_0x380b90,_0x56f333){_0x56f333=_0x56f333||0xc8;return function(_0x1b522e){if(_0x1b522e){return _0x380b90[_0x2db4('0x1d')](_0x56f333)[_0x2db4('0x1f')](_0x1b522e);}};}function respondWithFilteredResult(_0x4032fa,_0x4faa62){return function(_0x8483ca){if(_0x8483ca){var _0x96e3b=typeof _0x4faa62['offset']===_0x2db4('0x20')&&typeof _0x4faa62[_0x2db4('0x21')]==='undefined';var _0xf7542=_0x8483ca[_0x2db4('0x22')];var _0x4f319d=_0x96e3b?0x0:_0x4faa62[_0x2db4('0x23')];var _0x436aea=_0x96e3b?_0x8483ca[_0x2db4('0x22')]:_0x4faa62['offset']+_0x4faa62[_0x2db4('0x21')];var _0x11d4ee;if(_0x436aea>=_0xf7542){_0x436aea=_0xf7542;_0x11d4ee=0xc8;}else{_0x11d4ee=0xce;}_0x4032fa[_0x2db4('0x1d')](_0x11d4ee);return _0x4032fa[_0x2db4('0x24')](_0x2db4('0x25'),_0x4f319d+'-'+_0x436aea+'/'+_0xf7542)[_0x2db4('0x1f')](_0x8483ca);}return null;};}function patchUpdates(_0x442c9a){return function(_0x1c1199){try{jsonpatch[_0x2db4('0x26')](_0x1c1199,_0x442c9a,!![]);}catch(_0x130813){return BPromise[_0x2db4('0x27')](_0x130813);}return _0x1c1199[_0x2db4('0x28')]();};}function saveUpdates(_0x297ae6,_0x21a670){return function(_0x3b9711){if(_0x3b9711){return _0x3b9711[_0x2db4('0x29')](_0x297ae6)[_0x2db4('0x2a')](function(_0x1bf8bd){return _0x1bf8bd;});}return null;};}function removeEntity(_0x114542,_0x4fc7a9){return function(_0x53082a){if(_0x53082a){return _0x53082a['destroy']()['then'](function(){_0x114542[_0x2db4('0x1d')](0xcc)[_0x2db4('0x1e')]();});}};}function handleEntityNotFound(_0x51ceaf,_0x55c0c0){return function(_0x41f968){if(!_0x41f968){_0x51ceaf[_0x2db4('0x1c')](0x194);}return _0x41f968;};}function handleError(_0x277fee,_0x202d38){_0x202d38=_0x202d38||0x1f4;return function(_0xd6f695){logger[_0x2db4('0x2b')](_0xd6f695['stack']);if(_0xd6f695[_0x2db4('0x2c')]){delete _0xd6f695[_0x2db4('0x2c')];}_0x277fee[_0x2db4('0x1d')](_0x202d38)[_0x2db4('0x2d')](_0xd6f695);};}exports[_0x2db4('0x2e')]=function(_0x58b92d,_0x488d72){var _0x4a1450={},_0x5c1643={},_0x1bf9a0={'count':0x0,'rows':[]};var _0x22b419=_[_0x2db4('0x2f')](db['Dynamics365Configuration'][_0x2db4('0x30')],function(_0xd40ee){return{'name':_0xd40ee[_0x2db4('0x31')],'type':_0xd40ee[_0x2db4('0x32')][_0x2db4('0x33')]};});_0x5c1643[_0x2db4('0x34')]=_[_0x2db4('0x2f')](_0x22b419,'name');_0x5c1643[_0x2db4('0x35')]=_[_0x2db4('0x36')](_0x58b92d[_0x2db4('0x35')]);_0x5c1643[_0x2db4('0x37')]=_[_0x2db4('0x38')](_0x5c1643[_0x2db4('0x34')],_0x5c1643[_0x2db4('0x35')]);_0x4a1450[_0x2db4('0x39')]=_[_0x2db4('0x38')](_0x5c1643['model'],qs[_0x2db4('0x3a')](_0x58b92d['query'][_0x2db4('0x3a')]));_0x4a1450[_0x2db4('0x39')]=_0x4a1450['attributes'][_0x2db4('0x3b')]?_0x4a1450['attributes']:_0x5c1643['model'];if(!_0x58b92d[_0x2db4('0x35')][_0x2db4('0x3c')](_0x2db4('0x3d'))){_0x4a1450[_0x2db4('0x21')]=qs['limit'](_0x58b92d[_0x2db4('0x35')][_0x2db4('0x21')]);_0x4a1450[_0x2db4('0x23')]=qs['offset'](_0x58b92d[_0x2db4('0x35')][_0x2db4('0x23')]);}_0x4a1450[_0x2db4('0x3e')]=qs[_0x2db4('0x3f')](_0x58b92d[_0x2db4('0x35')][_0x2db4('0x3f')]);_0x4a1450[_0x2db4('0x40')]=qs[_0x2db4('0x37')](_['pick'](_0x58b92d[_0x2db4('0x35')],_0x5c1643[_0x2db4('0x37')]),_0x22b419);if(_0x58b92d[_0x2db4('0x35')]['filter']){_0x4a1450[_0x2db4('0x40')]=_[_0x2db4('0x41')](_0x4a1450[_0x2db4('0x40')],{'$or':_[_0x2db4('0x2f')](_0x22b419,function(_0x139305){if(_0x139305[_0x2db4('0x32')]!==_0x2db4('0x42')){var _0x130536={};_0x130536[_0x139305[_0x2db4('0x2c')]]={'$like':'%'+_0x58b92d[_0x2db4('0x35')]['filter']+'%'};return _0x130536;}})});}_0x4a1450=_[_0x2db4('0x41')]({},_0x4a1450,_0x58b92d[_0x2db4('0x43')]);var _0x513a13={'where':_0x4a1450[_0x2db4('0x40')]};return db[_0x2db4('0x44')][_0x2db4('0x22')](_0x513a13)[_0x2db4('0x2a')](function(_0x3b6852){_0x1bf9a0[_0x2db4('0x22')]=_0x3b6852;if(_0x58b92d[_0x2db4('0x35')][_0x2db4('0x45')]){_0x4a1450[_0x2db4('0x46')]=[{'all':!![]}];}return db[_0x2db4('0x44')]['findAll'](_0x4a1450);})[_0x2db4('0x2a')](function(_0x2c44ab){_0x1bf9a0[_0x2db4('0x47')]=_0x2c44ab;return _0x1bf9a0;})[_0x2db4('0x2a')](respondWithFilteredResult(_0x488d72,_0x4a1450))[_0x2db4('0x48')](handleError(_0x488d72,null));};exports['show']=function(_0xfeca9a,_0x35891e){var _0x52570e={'raw':![],'where':{'id':_0xfeca9a['params']['id']}},_0xcd7e56={};_0xcd7e56[_0x2db4('0x34')]=_[_0x2db4('0x36')](db['Dynamics365Configuration'][_0x2db4('0x30')]);_0xcd7e56[_0x2db4('0x35')]=_[_0x2db4('0x36')](_0xfeca9a[_0x2db4('0x35')]);_0xcd7e56[_0x2db4('0x37')]=_[_0x2db4('0x38')](_0xcd7e56[_0x2db4('0x34')],_0xcd7e56[_0x2db4('0x35')]);_0x52570e[_0x2db4('0x39')]=_[_0x2db4('0x38')](_0xcd7e56['model'],qs[_0x2db4('0x3a')](_0xfeca9a[_0x2db4('0x35')][_0x2db4('0x3a')]));_0x52570e['attributes']=_0x52570e[_0x2db4('0x39')]['length']?_0x52570e[_0x2db4('0x39')]:_0xcd7e56['model'];if(_0xfeca9a[_0x2db4('0x35')][_0x2db4('0x45')]){_0x52570e[_0x2db4('0x46')]=[{'all':!![]}];}_0x52570e=_[_0x2db4('0x41')]({},_0x52570e,_0xfeca9a['options']);return db[_0x2db4('0x44')][_0x2db4('0x49')](_0x52570e)[_0x2db4('0x2a')](handleEntityNotFound(_0x35891e,null))[_0x2db4('0x2a')](respondWithResult(_0x35891e,null))[_0x2db4('0x48')](handleError(_0x35891e,null));};exports[_0x2db4('0x4a')]=function(_0x2b68eb,_0x42a5f1){return db['Dynamics365Configuration'][_0x2db4('0x4a')](_0x2b68eb['body'],{})[_0x2db4('0x2a')](respondWithResult(_0x42a5f1,0xc9))['catch'](handleError(_0x42a5f1,null));};exports[_0x2db4('0x29')]=function(_0x5be200,_0x2824a9){if(_0x5be200[_0x2db4('0x4b')]['id']){delete _0x5be200[_0x2db4('0x4b')]['id'];}return db[_0x2db4('0x44')][_0x2db4('0x49')]({'where':{'id':_0x5be200['params']['id']}})['then'](handleEntityNotFound(_0x2824a9,null))[_0x2db4('0x2a')](saveUpdates(_0x5be200[_0x2db4('0x4b')],null))[_0x2db4('0x2a')](respondWithResult(_0x2824a9,null))[_0x2db4('0x48')](handleError(_0x2824a9,null));};exports[_0x2db4('0x4c')]=function(_0x5de01a,_0x24ccf1){return db[_0x2db4('0x44')][_0x2db4('0x49')]({'where':{'id':_0x5de01a['params']['id']}})[_0x2db4('0x2a')](handleEntityNotFound(_0x24ccf1,null))[_0x2db4('0x2a')](removeEntity(_0x24ccf1,null))[_0x2db4('0x48')](handleError(_0x24ccf1,null));};exports[_0x2db4('0x4d')]=function(_0x141e03,_0x2c0718,_0x474f8a){var _0x5cbaa9={};var _0x11eed1={};var _0x4790c9;var _0x105e7e;return db[_0x2db4('0x44')][_0x2db4('0x4e')]({'where':{'id':_0x141e03[_0x2db4('0x4f')]['id']}})[_0x2db4('0x2a')](handleEntityNotFound(_0x2c0718,null))[_0x2db4('0x2a')](function(_0x3fa039){if(_0x3fa039){_0x4790c9=_0x3fa039;_0x11eed1[_0x2db4('0x34')]=_['keys'](db[_0x2db4('0x50')][_0x2db4('0x30')]);_0x11eed1[_0x2db4('0x35')]=_[_0x2db4('0x36')](_0x141e03[_0x2db4('0x35')]);_0x11eed1['filters']=_[_0x2db4('0x38')](_0x11eed1[_0x2db4('0x34')],_0x11eed1['query']);_0x5cbaa9['attributes']=_[_0x2db4('0x38')](_0x11eed1[_0x2db4('0x34')],qs[_0x2db4('0x3a')](_0x141e03[_0x2db4('0x35')][_0x2db4('0x3a')]));_0x5cbaa9['attributes']=_0x5cbaa9['attributes'][_0x2db4('0x3b')]?_0x5cbaa9[_0x2db4('0x39')]:_0x11eed1[_0x2db4('0x34')];_0x5cbaa9[_0x2db4('0x3e')]=qs['sort'](_0x141e03[_0x2db4('0x35')]['sort']);_0x5cbaa9[_0x2db4('0x40')]=qs['filters'](_['pick'](_0x141e03[_0x2db4('0x35')],_0x11eed1[_0x2db4('0x37')]));if(_0x141e03[_0x2db4('0x35')][_0x2db4('0x51')]){_0x5cbaa9[_0x2db4('0x40')]=_[_0x2db4('0x41')](_0x5cbaa9['where'],{'$or':_['map'](_0x5cbaa9[_0x2db4('0x39')],function(_0x6fadff){var _0x3d2de7={};_0x3d2de7[_0x6fadff]={'$like':'%'+_0x141e03['query'][_0x2db4('0x51')]+'%'};return _0x3d2de7;})});}_0x5cbaa9=_['merge']({},_0x5cbaa9,_0x141e03['options']);return _0x4790c9['getFields'](_0x5cbaa9);}})['then'](function(_0xb037fb){if(_0xb037fb){_0x105e7e=_0xb037fb[_0x2db4('0x3b')];if(!_0x141e03[_0x2db4('0x35')][_0x2db4('0x3c')]('nolimit')){_0x5cbaa9[_0x2db4('0x21')]=qs['limit'](_0x141e03['query'][_0x2db4('0x21')]);_0x5cbaa9[_0x2db4('0x23')]=qs['offset'](_0x141e03[_0x2db4('0x35')][_0x2db4('0x23')]);}return _0x4790c9[_0x2db4('0x4d')](_0x5cbaa9);}})['then'](function(_0x26fc81){if(_0x26fc81){return _0x26fc81?{'count':_0x105e7e,'rows':_0x26fc81}:null;}})[_0x2db4('0x2a')](respondWithResult(_0x2c0718,null))[_0x2db4('0x48')](handleError(_0x2c0718,null));};exports[_0x2db4('0x52')]=function(_0x4bf3c6,_0x2e931d,_0x3ebc89){var _0x38f5fa={};var _0x598243={};var _0x1308a9;var _0x2efd34;return db[_0x2db4('0x44')][_0x2db4('0x4e')]({'where':{'id':_0x4bf3c6[_0x2db4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2e931d,null))['then'](function(_0x5cfa41){if(_0x5cfa41){_0x1308a9=_0x5cfa41;_0x598243[_0x2db4('0x34')]=_[_0x2db4('0x36')](db[_0x2db4('0x50')][_0x2db4('0x30')]);_0x598243[_0x2db4('0x35')]=_[_0x2db4('0x36')](_0x4bf3c6[_0x2db4('0x35')]);_0x598243[_0x2db4('0x37')]=_[_0x2db4('0x38')](_0x598243[_0x2db4('0x34')],_0x598243[_0x2db4('0x35')]);_0x38f5fa[_0x2db4('0x39')]=_[_0x2db4('0x38')](_0x598243[_0x2db4('0x34')],qs['fields'](_0x4bf3c6[_0x2db4('0x35')][_0x2db4('0x3a')]));_0x38f5fa['attributes']=_0x38f5fa[_0x2db4('0x39')][_0x2db4('0x3b')]?_0x38f5fa['attributes']:_0x598243['model'];_0x38f5fa['order']=qs['sort'](_0x4bf3c6[_0x2db4('0x35')][_0x2db4('0x3f')]);_0x38f5fa['where']=qs[_0x2db4('0x37')](_[_0x2db4('0x53')](_0x4bf3c6[_0x2db4('0x35')],_0x598243[_0x2db4('0x37')]));if(_0x4bf3c6['query']['filter']){_0x38f5fa['where']=_['merge'](_0x38f5fa[_0x2db4('0x40')],{'$or':_[_0x2db4('0x2f')](_0x38f5fa[_0x2db4('0x39')],function(_0x1d1e5e){var _0x15f4b6={};_0x15f4b6[_0x1d1e5e]={'$like':'%'+_0x4bf3c6[_0x2db4('0x35')]['filter']+'%'};return _0x15f4b6;})});}_0x38f5fa=_['merge']({},_0x38f5fa,_0x4bf3c6[_0x2db4('0x43')]);return _0x1308a9['getSubjects'](_0x38f5fa);}})[_0x2db4('0x2a')](function(_0x2766d8){if(_0x2766d8){_0x2efd34=_0x2766d8['length'];if(!_0x4bf3c6[_0x2db4('0x35')][_0x2db4('0x3c')](_0x2db4('0x3d'))){_0x38f5fa[_0x2db4('0x21')]=qs[_0x2db4('0x21')](_0x4bf3c6[_0x2db4('0x35')]['limit']);_0x38f5fa['offset']=qs[_0x2db4('0x23')](_0x4bf3c6['query']['offset']);}return _0x1308a9['getSubjects'](_0x38f5fa);}})['then'](function(_0x5bc7e7){if(_0x5bc7e7){return _0x5bc7e7?{'count':_0x2efd34,'rows':_0x5bc7e7}:null;}})[_0x2db4('0x2a')](respondWithResult(_0x2e931d,null))[_0x2db4('0x48')](handleError(_0x2e931d,null));};exports[_0x2db4('0x54')]=function(_0x3d2d92,_0x166c4f,_0x59664e){var _0x35f8c8={};var _0x27a1b4={};var _0x41817a;var _0x434667;return db[_0x2db4('0x44')][_0x2db4('0x4e')]({'where':{'id':_0x3d2d92[_0x2db4('0x4f')]['id']}})[_0x2db4('0x2a')](handleEntityNotFound(_0x166c4f,null))[_0x2db4('0x2a')](function(_0x2f8cd0){if(_0x2f8cd0){_0x41817a=_0x2f8cd0;_0x27a1b4[_0x2db4('0x34')]=_[_0x2db4('0x36')](db[_0x2db4('0x50')][_0x2db4('0x30')]);_0x27a1b4[_0x2db4('0x35')]=_[_0x2db4('0x36')](_0x3d2d92[_0x2db4('0x35')]);_0x27a1b4[_0x2db4('0x37')]=_[_0x2db4('0x38')](_0x27a1b4[_0x2db4('0x34')],_0x27a1b4[_0x2db4('0x35')]);_0x35f8c8[_0x2db4('0x39')]=_[_0x2db4('0x38')](_0x27a1b4[_0x2db4('0x34')],qs[_0x2db4('0x3a')](_0x3d2d92[_0x2db4('0x35')]['fields']));_0x35f8c8['attributes']=_0x35f8c8['attributes'][_0x2db4('0x3b')]?_0x35f8c8[_0x2db4('0x39')]:_0x27a1b4[_0x2db4('0x34')];_0x35f8c8[_0x2db4('0x3e')]=qs[_0x2db4('0x3f')](_0x3d2d92[_0x2db4('0x35')][_0x2db4('0x3f')]);_0x35f8c8['where']=qs[_0x2db4('0x37')](_['pick'](_0x3d2d92['query'],_0x27a1b4[_0x2db4('0x37')]));if(_0x3d2d92[_0x2db4('0x35')]['filter']){_0x35f8c8['where']=_[_0x2db4('0x41')](_0x35f8c8[_0x2db4('0x40')],{'$or':_[_0x2db4('0x2f')](_0x35f8c8[_0x2db4('0x39')],function(_0x12da9e){var _0x298cb0={};_0x298cb0[_0x12da9e]={'$like':'%'+_0x3d2d92['query'][_0x2db4('0x51')]+'%'};return _0x298cb0;})});}_0x35f8c8=_[_0x2db4('0x41')]({},_0x35f8c8,_0x3d2d92[_0x2db4('0x43')]);return _0x41817a[_0x2db4('0x54')](_0x35f8c8);}})[_0x2db4('0x2a')](function(_0x1c08a5){if(_0x1c08a5){_0x434667=_0x1c08a5[_0x2db4('0x3b')];if(!_0x3d2d92[_0x2db4('0x35')][_0x2db4('0x3c')](_0x2db4('0x3d'))){_0x35f8c8[_0x2db4('0x21')]=qs[_0x2db4('0x21')](_0x3d2d92[_0x2db4('0x35')]['limit']);_0x35f8c8['offset']=qs[_0x2db4('0x23')](_0x3d2d92['query'][_0x2db4('0x23')]);}return _0x41817a[_0x2db4('0x54')](_0x35f8c8);}})[_0x2db4('0x2a')](function(_0x59986b){if(_0x59986b){return _0x59986b?{'count':_0x434667,'rows':_0x59986b}:null;}})[_0x2db4('0x2a')](respondWithResult(_0x166c4f,null))[_0x2db4('0x48')](handleError(_0x166c4f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 6ef4091..d3f36ca 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 _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2ecf77,_0x3bcd01){var _0x22f96f=function(_0x1647f1){while(--_0x1647f1){_0x2ecf77['push'](_0x2ecf77['shift']());}};_0x22f96f(++_0x3bcd01);}(_0xb43b,0x1b2));var _0xbb43=function(_0x425e7e,_0x43234d){_0x425e7e=_0x425e7e-0x0;var _0x1b36a8=_0xb43b[_0x425e7e];return _0x1b36a8;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x1056d3,_0x8190a3){var _0x59188c=function(_0x33506f){while(--_0x33506f){_0x1056d3['push'](_0x1056d3['shift']());}};_0x59188c(++_0x8190a3);}(_0x9f62,0x154));var _0x29f6=function(_0x2e9910,_0x21b45b){_0x2e9910=_0x2e9910-0x0;var _0x321796=_0x9f62[_0x2e9910];return _0x321796;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'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 bc4fdbe..c6d3922 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 _0xe800=['Dynamics365Configuration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6c8566,_0x2c4e69){var _0x54e39b=function(_0x2c382f){while(--_0x2c382f){_0x6c8566['push'](_0x6c8566['shift']());}};_0x54e39b(++_0x2c4e69);}(_0xe800,0xe0));var _0x0e80=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe800[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x0e80('0x0'));var util=require(_0x0e80('0x1'));var moment=require(_0x0e80('0x2'));var BPromise=require(_0x0e80('0x3'));var rs=require(_0x0e80('0x4'));var fs=require('fs');var Redis=require(_0x0e80('0x5'));var db=require(_0x0e80('0x6'))['db'];var utils=require(_0x0e80('0x7'));var logger=require(_0x0e80('0x8'))(_0x0e80('0x9'));var config=require('../../config/environment');var jayson=require(_0x0e80('0xa'));var client=jayson[_0x0e80('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26edf8,_0x472141,_0x1cf799){return new BPromise(function(_0x353274,_0x2abc02){return client[_0x0e80('0xc')](_0x26edf8,_0x1cf799)['then'](function(_0xda6dd3){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x472141,'request\x20sent');logger[_0x0e80('0xd')](_0x0e80('0xe'),_0x472141,_0x0e80('0xf'),JSON[_0x0e80('0x10')](_0xda6dd3));if(_0xda6dd3[_0x0e80('0x11')]){if(_0xda6dd3['error']['code']===0x1f4){logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0xda6dd3[_0x0e80('0x11')]['message']);return _0x2abc02(_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);}logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);return _0x353274(_0xda6dd3[_0x0e80('0x11')][_0x0e80('0x13')]);}else{logger[_0x0e80('0x14')](_0x0e80('0x12'),_0x472141,_0x0e80('0xf'));_0x353274(_0xda6dd3['result'][_0x0e80('0x13')]);}})[_0x0e80('0x15')](function(_0x2b5e4c){logger[_0x0e80('0x11')](_0x0e80('0x12'),_0x472141,_0x2b5e4c);_0x2abc02(_0x2b5e4c);});});} \ No newline at end of file +var _0x7387=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7387,0xa7));var _0x7738=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7387[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x7738('0x0'));var util=require(_0x7738('0x1'));var moment=require('moment');var BPromise=require(_0x7738('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7738('0x3'))['db'];var utils=require(_0x7738('0x4'));var logger=require(_0x7738('0x5'))(_0x7738('0x6'));var config=require(_0x7738('0x7'));var jayson=require(_0x7738('0x8'));var client=jayson[_0x7738('0x9')][_0x7738('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa0b8f4,_0x21bc1c,_0x3a1b53){return new BPromise(function(_0x2f44e4,_0x20529d){return client[_0x7738('0xb')](_0xa0b8f4,_0x3a1b53)[_0x7738('0xc')](function(_0x38af89){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x21bc1c,_0x7738('0xd'));logger['debug'](_0x7738('0xe'),_0x21bc1c,_0x7738('0xd'),JSON['stringify'](_0x38af89));if(_0x38af89[_0x7738('0xf')]){if(_0x38af89['error'][_0x7738('0x10')]===0x1f4){logger[_0x7738('0xf')](_0x7738('0x11'),_0x21bc1c,_0x38af89[_0x7738('0xf')][_0x7738('0x12')]);return _0x20529d(_0x38af89['error'][_0x7738('0x12')]);}logger[_0x7738('0xf')](_0x7738('0x11'),_0x21bc1c,_0x38af89[_0x7738('0xf')][_0x7738('0x12')]);return _0x2f44e4(_0x38af89[_0x7738('0xf')][_0x7738('0x12')]);}else{logger[_0x7738('0x13')](_0x7738('0x11'),_0x21bc1c,_0x7738('0xd'));_0x2f44e4(_0x38af89[_0x7738('0x14')][_0x7738('0x12')]);}})['catch'](function(_0x517eda){logger[_0x7738('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x21bc1c,_0x517eda);_0x20529d(_0x517eda);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index e43d93a..b21a5ca 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 _0xda35=['destroy','exports','multer','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','create','put','update','delete'];(function(_0x471559,_0x42866c){var _0x16622b=function(_0x4e74d){while(--_0x4e74d){_0x471559['push'](_0x471559['shift']());}};_0x16622b(++_0x42866c);}(_0xda35,0xf2));var _0x5da3=function(_0x74f73,_0x2acc98){_0x74f73=_0x74f73-0x0;var _0x3827c2=_0xda35[_0x74f73];return _0x3827c2;};'use strict';var multer=require(_0x5da3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da3('0x1'));var router=express['Router']();var fs_extra=require(_0x5da3('0x2'));var auth=require(_0x5da3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5da3('0x4'));var controller=require(_0x5da3('0x5'));router['get']('/',auth[_0x5da3('0x6')](),controller[_0x5da3('0x7')]);router[_0x5da3('0x8')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller['show']);router['post']('/',auth[_0x5da3('0x6')](),controller[_0x5da3('0xa')]);router[_0x5da3('0xb')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller[_0x5da3('0xc')]);router[_0x5da3('0xd')](_0x5da3('0x9'),auth[_0x5da3('0x6')](),controller[_0x5da3('0xe')]);module[_0x5da3('0xf')]=router; \ No newline at end of file +var _0xa399=['update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x4e7490,_0x4b26ae){var _0x3622d0=function(_0x40a2bb){while(--_0x40a2bb){_0x4e7490['push'](_0x4e7490['shift']());}};_0x3622d0(++_0x4b26ae);}(_0xa399,0xe1));var _0x9a39=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xa399[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0x9a39('0x0'));var util=require(_0x9a39('0x1'));var path=require('path');var timeout=require(_0x9a39('0x2'));var express=require(_0x9a39('0x3'));var router=express[_0x9a39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a39('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9a39('0x6'));var controller=require(_0x9a39('0x7'));router[_0x9a39('0x8')]('/',auth[_0x9a39('0x9')](),controller[_0x9a39('0xa')]);router[_0x9a39('0x8')]('/:id',auth[_0x9a39('0x9')](),controller[_0x9a39('0xb')]);router[_0x9a39('0xc')]('/',auth[_0x9a39('0x9')](),controller[_0x9a39('0xd')]);router[_0x9a39('0xe')]('/:id',auth[_0x9a39('0x9')](),controller[_0x9a39('0xf')]);router[_0x9a39('0x10')](_0x9a39('0x11'),auth[_0x9a39('0x9')](),controller[_0x9a39('0x12')]);module[_0x9a39('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index dbaa030..59eca14 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 _0xcf6a=['sequelize','ENUM','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x5c4c27,_0x58edca){var _0x5c3a99=function(_0x571f19){while(--_0x571f19){_0x5c4c27['push'](_0x5c4c27['shift']());}};_0x5c3a99(++_0x58edca);}(_0xcf6a,0xe8));var _0xacf6=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xcf6a[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0xacf6('0x0'));module['exports']={'type':{'type':Sequelize[_0xacf6('0x1')]('string','variable',_0xacf6('0x2'),_0xacf6('0x3'),_0xacf6('0x4')),'defaultValue':_0xacf6('0x5')},'content':{'type':Sequelize[_0xacf6('0x6')]},'key':{'type':Sequelize[_0xacf6('0x6')]},'keyType':{'type':Sequelize[_0xacf6('0x1')](_0xacf6('0x5'),'variable',_0xacf6('0x2'))},'keyContent':{'type':Sequelize[_0xacf6('0x6')]},'idField':{'type':Sequelize[_0xacf6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xacf6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x634a=['STRING','string','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x634a,0x1e3));var _0xa634=function(_0x463417,_0x1e29af){_0x463417=_0x463417-0x0;var _0x4a5241=_0x634a[_0x463417];return _0x4a5241;};'use strict';var Sequelize=require(_0xa634('0x0'));module[_0xa634('0x1')]={'type':{'type':Sequelize[_0xa634('0x2')]('string',_0xa634('0x3'),'customVariable',_0xa634('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa634('0x5')]},'keyType':{'type':Sequelize[_0xa634('0x2')](_0xa634('0x6'),_0xa634('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa634('0x5')]},'nameField':{'type':Sequelize[_0xa634('0x5')]},'customField':{'type':Sequelize[_0xa634('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa634('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b8ac612..287ceeb 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 _0x8773=['create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch'];(function(_0x5e0926,_0x5f5ca7){var _0x2ffe9e=function(_0x4f23c2){while(--_0x4f23c2){_0x5e0926['push'](_0x5e0926['shift']());}};_0x2ffe9e(++_0x5f5ca7);}(_0x8773,0x12c));var _0x3877=function(_0x3e6679,_0xf6529b){_0x3e6679=_0x3e6679-0x0;var _0x155619=_0x8773[_0x3e6679];return _0x155619;};'use strict';var emlformat=require(_0x3877('0x0'));var rimraf=require(_0x3877('0x1'));var zipdir=require(_0x3877('0x2'));var jsonpatch=require(_0x3877('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3877('0x4'));var Mustache=require('mustache');var util=require(_0x3877('0x5'));var path=require('path');var sox=require(_0x3877('0x6'));var csv=require(_0x3877('0x7'));var ejs=require(_0x3877('0x8'));var fs=require('fs');var fs_extra=require(_0x3877('0x9'));var _=require(_0x3877('0xa'));var squel=require(_0x3877('0xb'));var crypto=require('crypto');var jsforce=require(_0x3877('0xc'));var deskjs=require(_0x3877('0xd'));var toCsv=require(_0x3877('0x7'));var querystring=require(_0x3877('0xe'));var Papa=require(_0x3877('0xf'));var Redis=require(_0x3877('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3877('0x11'));var hardwareService=require(_0x3877('0x12'));var logger=require(_0x3877('0x13'))('api');var utils=require(_0x3877('0x14'));var config=require(_0x3877('0x15'));var licenseUtil=require(_0x3877('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9d64c5,_0x522cfa){_0x522cfa=_0x522cfa||0xcc;return function(_0x14ef4c){if(_0x14ef4c){return _0x9d64c5[_0x3877('0x17')](_0x522cfa);}return _0x9d64c5[_0x3877('0x18')](_0x522cfa)['end']();};}function respondWithResult(_0x2f5fff,_0x1cc845){_0x1cc845=_0x1cc845||0xc8;return function(_0x541e6b){if(_0x541e6b){return _0x2f5fff['status'](_0x1cc845)[_0x3877('0x19')](_0x541e6b);}};}function respondWithFilteredResult(_0x1bd99e,_0x3c10a9){return function(_0xc604cb){if(_0xc604cb){var _0xf5c50e=typeof _0x3c10a9['offset']===_0x3877('0x1a')&&typeof _0x3c10a9[_0x3877('0x1b')]==='undefined';var _0x577225=_0xc604cb[_0x3877('0x1c')];var _0xb6fb99=_0xf5c50e?0x0:_0x3c10a9[_0x3877('0x1d')];var _0xe86ad=_0xf5c50e?_0xc604cb[_0x3877('0x1c')]:_0x3c10a9['offset']+_0x3c10a9[_0x3877('0x1b')];var _0x5a0ae3;if(_0xe86ad>=_0x577225){_0xe86ad=_0x577225;_0x5a0ae3=0xc8;}else{_0x5a0ae3=0xce;}_0x1bd99e[_0x3877('0x18')](_0x5a0ae3);return _0x1bd99e['set'](_0x3877('0x1e'),_0xb6fb99+'-'+_0xe86ad+'/'+_0x577225)[_0x3877('0x19')](_0xc604cb);}return null;};}function patchUpdates(_0x39eebe){return function(_0x3d2598){try{jsonpatch[_0x3877('0x1f')](_0x3d2598,_0x39eebe,!![]);}catch(_0x532aeb){return BPromise[_0x3877('0x20')](_0x532aeb);}return _0x3d2598[_0x3877('0x21')]();};}function saveUpdates(_0x1c6aa1,_0x2e3f73){return function(_0x208357){if(_0x208357){return _0x208357['update'](_0x1c6aa1)[_0x3877('0x22')](function(_0x312921){return _0x312921;});}return null;};}function removeEntity(_0x13cfb0,_0x14076b){return function(_0x12a682){if(_0x12a682){return _0x12a682['destroy']()[_0x3877('0x22')](function(){_0x13cfb0[_0x3877('0x18')](0xcc)[_0x3877('0x23')]();});}};}function handleEntityNotFound(_0x55656c,_0xfd70f8){return function(_0x3f80e8){if(!_0x3f80e8){_0x55656c[_0x3877('0x17')](0x194);}return _0x3f80e8;};}function handleError(_0xb15eb5,_0x3076bc){_0x3076bc=_0x3076bc||0x1f4;return function(_0x2b89c5){logger[_0x3877('0x24')](_0x2b89c5[_0x3877('0x25')]);if(_0x2b89c5['name']){delete _0x2b89c5[_0x3877('0x26')];}_0xb15eb5['status'](_0x3076bc)[_0x3877('0x27')](_0x2b89c5);};}exports[_0x3877('0x28')]=function(_0x396320,_0x9cc44b){var _0x53ffdd={},_0x13b79f={},_0x345b39={'count':0x0,'rows':[]};var _0x56f2a8=_[_0x3877('0x29')](db[_0x3877('0x2a')][_0x3877('0x2b')],function(_0x13b774){return{'name':_0x13b774[_0x3877('0x2c')],'type':_0x13b774[_0x3877('0x2d')][_0x3877('0x2e')]};});_0x13b79f[_0x3877('0x2f')]=_[_0x3877('0x29')](_0x56f2a8,_0x3877('0x26'));_0x13b79f[_0x3877('0x30')]=_[_0x3877('0x31')](_0x396320['query']);_0x13b79f[_0x3877('0x32')]=_[_0x3877('0x33')](_0x13b79f[_0x3877('0x2f')],_0x13b79f['query']);_0x53ffdd[_0x3877('0x34')]=_[_0x3877('0x33')](_0x13b79f[_0x3877('0x2f')],qs['fields'](_0x396320[_0x3877('0x30')][_0x3877('0x35')]));_0x53ffdd[_0x3877('0x34')]=_0x53ffdd[_0x3877('0x34')][_0x3877('0x36')]?_0x53ffdd['attributes']:_0x13b79f['model'];if(!_0x396320[_0x3877('0x30')][_0x3877('0x37')](_0x3877('0x38'))){_0x53ffdd[_0x3877('0x1b')]=qs['limit'](_0x396320[_0x3877('0x30')][_0x3877('0x1b')]);_0x53ffdd[_0x3877('0x1d')]=qs[_0x3877('0x1d')](_0x396320[_0x3877('0x30')]['offset']);}_0x53ffdd[_0x3877('0x39')]=qs['sort'](_0x396320[_0x3877('0x30')]['sort']);_0x53ffdd['where']=qs['filters'](_['pick'](_0x396320[_0x3877('0x30')],_0x13b79f[_0x3877('0x32')]),_0x56f2a8);if(_0x396320[_0x3877('0x30')][_0x3877('0x3a')]){_0x53ffdd[_0x3877('0x3b')]=_[_0x3877('0x3c')](_0x53ffdd[_0x3877('0x3b')],{'$or':_['map'](_0x56f2a8,function(_0x3f6ec5){if(_0x3f6ec5[_0x3877('0x2d')]!==_0x3877('0x3d')){var _0x5a2b31={};_0x5a2b31[_0x3f6ec5[_0x3877('0x26')]]={'$like':'%'+_0x396320[_0x3877('0x30')][_0x3877('0x3a')]+'%'};return _0x5a2b31;}})});}_0x53ffdd=_[_0x3877('0x3c')]({},_0x53ffdd,_0x396320[_0x3877('0x3e')]);var _0x2cf8af={'where':_0x53ffdd[_0x3877('0x3b')]};return db[_0x3877('0x2a')][_0x3877('0x1c')](_0x2cf8af)[_0x3877('0x22')](function(_0xe3957a){_0x345b39[_0x3877('0x1c')]=_0xe3957a;if(_0x396320['query'][_0x3877('0x3f')]){_0x53ffdd[_0x3877('0x40')]=[{'all':!![]}];}return db[_0x3877('0x2a')][_0x3877('0x41')](_0x53ffdd);})[_0x3877('0x22')](function(_0x306601){_0x345b39['rows']=_0x306601;return _0x345b39;})[_0x3877('0x22')](respondWithFilteredResult(_0x9cc44b,_0x53ffdd))['catch'](handleError(_0x9cc44b,null));};exports[_0x3877('0x42')]=function(_0x4640d1,_0x3f3962){var _0x598809={'raw':!![],'where':{'id':_0x4640d1[_0x3877('0x43')]['id']}},_0x7433ec={};_0x7433ec[_0x3877('0x2f')]=_[_0x3877('0x31')](db[_0x3877('0x2a')][_0x3877('0x2b')]);_0x7433ec[_0x3877('0x30')]=_[_0x3877('0x31')](_0x4640d1['query']);_0x7433ec[_0x3877('0x32')]=_[_0x3877('0x33')](_0x7433ec[_0x3877('0x2f')],_0x7433ec[_0x3877('0x30')]);_0x598809[_0x3877('0x34')]=_[_0x3877('0x33')](_0x7433ec[_0x3877('0x2f')],qs['fields'](_0x4640d1['query'][_0x3877('0x35')]));_0x598809['attributes']=_0x598809[_0x3877('0x34')][_0x3877('0x36')]?_0x598809[_0x3877('0x34')]:_0x7433ec[_0x3877('0x2f')];if(_0x4640d1[_0x3877('0x30')][_0x3877('0x3f')]){_0x598809['include']=[{'all':!![]}];}_0x598809=_[_0x3877('0x3c')]({},_0x598809,_0x4640d1[_0x3877('0x3e')]);return db[_0x3877('0x2a')][_0x3877('0x44')](_0x598809)[_0x3877('0x22')](handleEntityNotFound(_0x3f3962,null))['then'](respondWithResult(_0x3f3962,null))[_0x3877('0x45')](handleError(_0x3f3962,null));};exports[_0x3877('0x46')]=function(_0x2ed693,_0x92bea0){return db['Dynamics365Field'][_0x3877('0x46')](_0x2ed693[_0x3877('0x47')],{})[_0x3877('0x22')](respondWithResult(_0x92bea0,0xc9))[_0x3877('0x45')](handleError(_0x92bea0,null));};exports[_0x3877('0x48')]=function(_0x18fa3b,_0x26b5b2){if(_0x18fa3b['body']['id']){delete _0x18fa3b['body']['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x18fa3b['params']['id']}})[_0x3877('0x22')](handleEntityNotFound(_0x26b5b2,null))[_0x3877('0x22')](saveUpdates(_0x18fa3b[_0x3877('0x47')],null))[_0x3877('0x22')](respondWithResult(_0x26b5b2,null))['catch'](handleError(_0x26b5b2,null));};exports[_0x3877('0x49')]=function(_0x412b78,_0x30197f){return db[_0x3877('0x2a')]['find']({'where':{'id':_0x412b78[_0x3877('0x43')]['id']}})['then'](handleEntityNotFound(_0x30197f,null))[_0x3877('0x22')](removeEntity(_0x30197f,null))[_0x3877('0x45')](handleError(_0x30197f,null));}; \ No newline at end of file +var _0xcb68=['query','fields','attributes','nolimit','order','sort','where','pick','filters','filter','merge','options','Dynamics365Field','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','intersection','model'];(function(_0x459d95,_0x5cd3e2){var _0x49659a=function(_0x14b0d3){while(--_0x14b0d3){_0x459d95['push'](_0x459d95['shift']());}};_0x49659a(++_0x5cd3e2);}(_0xcb68,0x19a));var _0x8cb6=function(_0x576c23,_0x126114){_0x576c23=_0x576c23-0x0;var _0x3d7a0d=_0xcb68[_0x576c23];return _0x3d7a0d;};'use strict';var emlformat=require(_0x8cb6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8cb6('0x1'));var jsonpatch=require(_0x8cb6('0x2'));var rp=require(_0x8cb6('0x3'));var moment=require(_0x8cb6('0x4'));var BPromise=require(_0x8cb6('0x5'));var Mustache=require(_0x8cb6('0x6'));var util=require('util');var path=require(_0x8cb6('0x7'));var sox=require(_0x8cb6('0x8'));var csv=require(_0x8cb6('0x9'));var ejs=require(_0x8cb6('0xa'));var fs=require('fs');var fs_extra=require(_0x8cb6('0xb'));var _=require(_0x8cb6('0xc'));var squel=require(_0x8cb6('0xd'));var crypto=require(_0x8cb6('0xe'));var jsforce=require(_0x8cb6('0xf'));var deskjs=require(_0x8cb6('0x10'));var toCsv=require(_0x8cb6('0x9'));var querystring=require(_0x8cb6('0x11'));var Papa=require(_0x8cb6('0x12'));var Redis=require(_0x8cb6('0x13'));var authService=require(_0x8cb6('0x14'));var qs=require(_0x8cb6('0x15'));var as=require(_0x8cb6('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8cb6('0x17'));var utils=require(_0x8cb6('0x18'));var config=require(_0x8cb6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cb6('0x1a'))['db'];function respondWithStatusCode(_0x482f1d,_0x43c413){_0x43c413=_0x43c413||0xcc;return function(_0x211751){if(_0x211751){return _0x482f1d[_0x8cb6('0x1b')](_0x43c413);}return _0x482f1d[_0x8cb6('0x1c')](_0x43c413)[_0x8cb6('0x1d')]();};}function respondWithResult(_0x34129b,_0x2e3510){_0x2e3510=_0x2e3510||0xc8;return function(_0x259591){if(_0x259591){return _0x34129b[_0x8cb6('0x1c')](_0x2e3510)['json'](_0x259591);}};}function respondWithFilteredResult(_0x6e2861,_0x5be066){return function(_0x175dcc){if(_0x175dcc){var _0x251f9d=typeof _0x5be066[_0x8cb6('0x1e')]==='undefined'&&typeof _0x5be066[_0x8cb6('0x1f')]===_0x8cb6('0x20');var _0x441622=_0x175dcc[_0x8cb6('0x21')];var _0x5409a1=_0x251f9d?0x0:_0x5be066['offset'];var _0x477235=_0x251f9d?_0x175dcc[_0x8cb6('0x21')]:_0x5be066[_0x8cb6('0x1e')]+_0x5be066[_0x8cb6('0x1f')];var _0x27dc0e;if(_0x477235>=_0x441622){_0x477235=_0x441622;_0x27dc0e=0xc8;}else{_0x27dc0e=0xce;}_0x6e2861[_0x8cb6('0x1c')](_0x27dc0e);return _0x6e2861[_0x8cb6('0x22')]('Content-Range',_0x5409a1+'-'+_0x477235+'/'+_0x441622)[_0x8cb6('0x23')](_0x175dcc);}return null;};}function patchUpdates(_0x329bd3){return function(_0x4eb939){try{jsonpatch[_0x8cb6('0x24')](_0x4eb939,_0x329bd3,!![]);}catch(_0x2157ff){return BPromise['reject'](_0x2157ff);}return _0x4eb939[_0x8cb6('0x25')]();};}function saveUpdates(_0x37f962,_0x4bdcaa){return function(_0xeae573){if(_0xeae573){return _0xeae573[_0x8cb6('0x26')](_0x37f962)[_0x8cb6('0x27')](function(_0x417438){return _0x417438;});}return null;};}function removeEntity(_0x2cdfe6,_0x1485d4){return function(_0x4f13a7){if(_0x4f13a7){return _0x4f13a7[_0x8cb6('0x28')]()['then'](function(){_0x2cdfe6[_0x8cb6('0x1c')](0xcc)[_0x8cb6('0x1d')]();});}};}function handleEntityNotFound(_0x2ba964,_0x166192){return function(_0x4166cf){if(!_0x4166cf){_0x2ba964[_0x8cb6('0x1b')](0x194);}return _0x4166cf;};}function handleError(_0x244eb1,_0x1d14de){_0x1d14de=_0x1d14de||0x1f4;return function(_0x2abe4c){logger[_0x8cb6('0x29')](_0x2abe4c[_0x8cb6('0x2a')]);if(_0x2abe4c[_0x8cb6('0x2b')]){delete _0x2abe4c[_0x8cb6('0x2b')];}_0x244eb1['status'](_0x1d14de)[_0x8cb6('0x2c')](_0x2abe4c);};}exports[_0x8cb6('0x2d')]=function(_0x1efb62,_0x968dcb){var _0xf965c5={},_0x906fde={},_0x4b6c1f={'count':0x0,'rows':[]};var _0x26cf66=_[_0x8cb6('0x2e')](db['Dynamics365Field'][_0x8cb6('0x2f')],function(_0x454daf){return{'name':_0x454daf['fieldName'],'type':_0x454daf[_0x8cb6('0x30')][_0x8cb6('0x31')]};});_0x906fde['model']=_['map'](_0x26cf66,'name');_0x906fde['query']=_['keys'](_0x1efb62['query']);_0x906fde['filters']=_[_0x8cb6('0x32')](_0x906fde[_0x8cb6('0x33')],_0x906fde[_0x8cb6('0x34')]);_0xf965c5['attributes']=_['intersection'](_0x906fde[_0x8cb6('0x33')],qs[_0x8cb6('0x35')](_0x1efb62[_0x8cb6('0x34')][_0x8cb6('0x35')]));_0xf965c5[_0x8cb6('0x36')]=_0xf965c5[_0x8cb6('0x36')]['length']?_0xf965c5[_0x8cb6('0x36')]:_0x906fde[_0x8cb6('0x33')];if(!_0x1efb62[_0x8cb6('0x34')]['hasOwnProperty'](_0x8cb6('0x37'))){_0xf965c5[_0x8cb6('0x1f')]=qs[_0x8cb6('0x1f')](_0x1efb62[_0x8cb6('0x34')]['limit']);_0xf965c5[_0x8cb6('0x1e')]=qs[_0x8cb6('0x1e')](_0x1efb62[_0x8cb6('0x34')][_0x8cb6('0x1e')]);}_0xf965c5[_0x8cb6('0x38')]=qs[_0x8cb6('0x39')](_0x1efb62[_0x8cb6('0x34')]['sort']);_0xf965c5[_0x8cb6('0x3a')]=qs['filters'](_[_0x8cb6('0x3b')](_0x1efb62[_0x8cb6('0x34')],_0x906fde[_0x8cb6('0x3c')]),_0x26cf66);if(_0x1efb62[_0x8cb6('0x34')][_0x8cb6('0x3d')]){_0xf965c5[_0x8cb6('0x3a')]=_['merge'](_0xf965c5[_0x8cb6('0x3a')],{'$or':_[_0x8cb6('0x2e')](_0x26cf66,function(_0x137024){if(_0x137024[_0x8cb6('0x30')]!=='VIRTUAL'){var _0x2d0407={};_0x2d0407[_0x137024[_0x8cb6('0x2b')]]={'$like':'%'+_0x1efb62[_0x8cb6('0x34')][_0x8cb6('0x3d')]+'%'};return _0x2d0407;}})});}_0xf965c5=_[_0x8cb6('0x3e')]({},_0xf965c5,_0x1efb62[_0x8cb6('0x3f')]);var _0x2436c4={'where':_0xf965c5[_0x8cb6('0x3a')]};return db[_0x8cb6('0x40')]['count'](_0x2436c4)[_0x8cb6('0x27')](function(_0x37aef0){_0x4b6c1f[_0x8cb6('0x21')]=_0x37aef0;if(_0x1efb62[_0x8cb6('0x34')][_0x8cb6('0x41')]){_0xf965c5[_0x8cb6('0x42')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x8cb6('0x43')](_0xf965c5);})[_0x8cb6('0x27')](function(_0x22ee44){_0x4b6c1f[_0x8cb6('0x44')]=_0x22ee44;return _0x4b6c1f;})['then'](respondWithFilteredResult(_0x968dcb,_0xf965c5))['catch'](handleError(_0x968dcb,null));};exports[_0x8cb6('0x45')]=function(_0xdf5e17,_0x57a981){var _0x44a228={'raw':!![],'where':{'id':_0xdf5e17[_0x8cb6('0x46')]['id']}},_0x356862={};_0x356862[_0x8cb6('0x33')]=_[_0x8cb6('0x47')](db[_0x8cb6('0x40')][_0x8cb6('0x2f')]);_0x356862[_0x8cb6('0x34')]=_['keys'](_0xdf5e17[_0x8cb6('0x34')]);_0x356862[_0x8cb6('0x3c')]=_[_0x8cb6('0x32')](_0x356862[_0x8cb6('0x33')],_0x356862[_0x8cb6('0x34')]);_0x44a228[_0x8cb6('0x36')]=_[_0x8cb6('0x32')](_0x356862[_0x8cb6('0x33')],qs[_0x8cb6('0x35')](_0xdf5e17[_0x8cb6('0x34')]['fields']));_0x44a228[_0x8cb6('0x36')]=_0x44a228[_0x8cb6('0x36')][_0x8cb6('0x48')]?_0x44a228[_0x8cb6('0x36')]:_0x356862[_0x8cb6('0x33')];if(_0xdf5e17['query'][_0x8cb6('0x41')]){_0x44a228[_0x8cb6('0x42')]=[{'all':!![]}];}_0x44a228=_[_0x8cb6('0x3e')]({},_0x44a228,_0xdf5e17['options']);return db[_0x8cb6('0x40')][_0x8cb6('0x49')](_0x44a228)[_0x8cb6('0x27')](handleEntityNotFound(_0x57a981,null))[_0x8cb6('0x27')](respondWithResult(_0x57a981,null))[_0x8cb6('0x4a')](handleError(_0x57a981,null));};exports[_0x8cb6('0x4b')]=function(_0x3b153a,_0xa9bd91){return db[_0x8cb6('0x40')][_0x8cb6('0x4b')](_0x3b153a[_0x8cb6('0x4c')],{})[_0x8cb6('0x27')](respondWithResult(_0xa9bd91,0xc9))[_0x8cb6('0x4a')](handleError(_0xa9bd91,null));};exports[_0x8cb6('0x26')]=function(_0x3ac5ea,_0x127f05){if(_0x3ac5ea['body']['id']){delete _0x3ac5ea[_0x8cb6('0x4c')]['id'];}return db[_0x8cb6('0x40')][_0x8cb6('0x49')]({'where':{'id':_0x3ac5ea['params']['id']}})[_0x8cb6('0x27')](handleEntityNotFound(_0x127f05,null))['then'](saveUpdates(_0x3ac5ea[_0x8cb6('0x4c')],null))[_0x8cb6('0x27')](respondWithResult(_0x127f05,null))[_0x8cb6('0x4a')](handleError(_0x127f05,null));};exports[_0x8cb6('0x28')]=function(_0x242238,_0x39c21e){return db[_0x8cb6('0x40')]['find']({'where':{'id':_0x242238['params']['id']}})[_0x8cb6('0x27')](handleEntityNotFound(_0x39c21e,null))[_0x8cb6('0x27')](removeEntity(_0x39c21e,null))[_0x8cb6('0x4a')](handleError(_0x39c21e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9f7ee36..9c3d945 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 _0x5b1f=['util','../../config/logger','moment','path','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x317725,_0x1bd734){var _0x1e08cb=function(_0x42d51c){while(--_0x42d51c){_0x317725['push'](_0x317725['shift']());}};_0x1e08cb(++_0x1bd734);}(_0x5b1f,0xd7));var _0xf5b1=function(_0x5444b3,_0xb3fa08){_0x5444b3=_0x5444b3-0x0;var _0x495258=_0x5b1f[_0x5444b3];return _0x495258;};'use strict';var _=require(_0xf5b1('0x0'));var util=require(_0xf5b1('0x1'));var logger=require(_0xf5b1('0x2'))('api');var moment=require(_0xf5b1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5b1('0x4'));var rimraf=require('rimraf');var config=require(_0xf5b1('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0xf5b1('0x6')]=function(_0x416725,_0x2b6a85){return _0x416725[_0xf5b1('0x7')]('Dynamics365Field',attributes,{'tableName':_0xf5b1('0x8'),'paranoid':![],'indexes':[{'name':_0xf5b1('0x9'),'fields':[_0xf5b1('0xa'),_0xf5b1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd4f=['../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0xc7394,_0x3f3d5b){var _0x4344f9=function(_0x1812e7){while(--_0x1812e7){_0xc7394['push'](_0xc7394['shift']());}};_0x4344f9(++_0x3f3d5b);}(_0xfd4f,0x125));var _0xffd4=function(_0x44fc36,_0x2c1c0a){_0x44fc36=_0x44fc36-0x0;var _0x3c40f2=_0xfd4f[_0x44fc36];return _0x3c40f2;};'use strict';var _=require(_0xffd4('0x0'));var util=require('util');var logger=require(_0xffd4('0x1'))(_0xffd4('0x2'));var moment=require('moment');var BPromise=require(_0xffd4('0x3'));var rp=require(_0xffd4('0x4'));var fs=require('fs');var path=require(_0xffd4('0x5'));var rimraf=require('rimraf');var config=require(_0xffd4('0x6'));var attributes=require(_0xffd4('0x7'));module[_0xffd4('0x8')]=function(_0x4cd5d2,_0x1054a3){return _0x4cd5d2[_0xffd4('0x9')](_0xffd4('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xffd4('0xb'),'fields':['idField',_0xffd4('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 15b153a..e564d45 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 _0xfcff=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x41012a,_0x8410ed){var _0x2019a7=function(_0x2557ec){while(--_0x2557ec){_0x41012a['push'](_0x41012a['shift']());}};_0x2019a7(++_0x8410ed);}(_0xfcff,0x15d));var _0xffcf=function(_0x53f56f,_0x25aacc){_0x53f56f=_0x53f56f-0x0;var _0x2d01de=_0xfcff[_0x53f56f];return _0x2d01de;};'use strict';var _=require(_0xffcf('0x0'));var util=require('util');var moment=require(_0xffcf('0x1'));var BPromise=require(_0xffcf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffcf('0x3'));var db=require(_0xffcf('0x4'))['db'];var utils=require(_0xffcf('0x5'));var logger=require(_0xffcf('0x6'))('rpc');var config=require(_0xffcf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xffcf('0x8')][_0xffcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21aea6,_0x25d873,_0x54388e){return new BPromise(function(_0x107e6c,_0x3d1dbe){return client[_0xffcf('0xa')](_0x21aea6,_0x54388e)[_0xffcf('0xb')](function(_0x4f70fc){logger[_0xffcf('0xc')](_0xffcf('0xd'),_0x25d873,_0xffcf('0xe'));logger[_0xffcf('0xf')](_0xffcf('0x10'),_0x25d873,_0xffcf('0xe'),JSON['stringify'](_0x4f70fc));if(_0x4f70fc[_0xffcf('0x11')]){if(_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x12')]===0x1f4){logger[_0xffcf('0x11')](_0xffcf('0xd'),_0x25d873,_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);return _0x3d1dbe(_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);}logger[_0xffcf('0x11')](_0xffcf('0xd'),_0x25d873,_0x4f70fc[_0xffcf('0x11')][_0xffcf('0x13')]);return _0x107e6c(_0x4f70fc[_0xffcf('0x11')]['message']);}else{logger[_0xffcf('0xc')](_0xffcf('0xd'),_0x25d873,_0xffcf('0xe'));_0x107e6c(_0x4f70fc[_0xffcf('0x14')][_0xffcf('0x13')]);}})['catch'](function(_0x28ed96){logger['error'](_0xffcf('0xd'),_0x25d873,_0x28ed96);_0x3d1dbe(_0x28ed96);});});} \ No newline at end of file +var _0xeec4=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0xada46d,_0x44fc56){var _0x3b04ef=function(_0x1675ef){while(--_0x1675ef){_0xada46d['push'](_0xada46d['shift']());}};_0x3b04ef(++_0x44fc56);}(_0xeec4,0x9e));var _0x4eec=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0xeec4[_0x77d310];return _0x2cdce4;};'use strict';var _=require(_0x4eec('0x0'));var util=require('util');var moment=require(_0x4eec('0x1'));var BPromise=require(_0x4eec('0x2'));var rs=require(_0x4eec('0x3'));var fs=require('fs');var Redis=require(_0x4eec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4eec('0x5'));var logger=require(_0x4eec('0x6'))(_0x4eec('0x7'));var config=require('../../config/environment');var jayson=require(_0x4eec('0x8'));var client=jayson[_0x4eec('0x9')][_0x4eec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e48f8,_0x59cd90,_0x50d171){return new BPromise(function(_0x19855b,_0x2ebd2b){return client['request'](_0x4e48f8,_0x50d171)[_0x4eec('0xb')](function(_0x472bf5){logger[_0x4eec('0xc')](_0x4eec('0xd'),_0x59cd90,'request\x20sent');logger[_0x4eec('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x59cd90,_0x4eec('0xf'),JSON[_0x4eec('0x10')](_0x472bf5));if(_0x472bf5[_0x4eec('0x11')]){if(_0x472bf5[_0x4eec('0x11')][_0x4eec('0x12')]===0x1f4){logger[_0x4eec('0x11')](_0x4eec('0xd'),_0x59cd90,_0x472bf5[_0x4eec('0x11')][_0x4eec('0x13')]);return _0x2ebd2b(_0x472bf5[_0x4eec('0x11')]['message']);}logger[_0x4eec('0x11')](_0x4eec('0xd'),_0x59cd90,_0x472bf5[_0x4eec('0x11')][_0x4eec('0x13')]);return _0x19855b(_0x472bf5[_0x4eec('0x11')][_0x4eec('0x13')]);}else{logger[_0x4eec('0xc')](_0x4eec('0xd'),_0x59cd90,_0x4eec('0xf'));_0x19855b(_0x472bf5[_0x4eec('0x14')][_0x4eec('0x13')]);}})[_0x4eec('0x15')](function(_0x43bde9){logger[_0x4eec('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x59cd90,_0x43bde9);_0x2ebd2b(_0x43bde9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4f01f15..b5e897b 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 _0xf178=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf178,0xd8));var _0x8f17=function(_0x10b4f2,_0x2d4ec8){_0x10b4f2=_0x10b4f2-0x0;var _0x1d9640=_0xf178[_0x10b4f2];return _0x1d9640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f17('0x0'));var timeout=require(_0x8f17('0x1'));var express=require('express');var router=express[_0x8f17('0x2')]();var fs_extra=require(_0x8f17('0x3'));var auth=require(_0x8f17('0x4'));var interaction=require(_0x8f17('0x5'));var config=require(_0x8f17('0x6'));var controller=require(_0x8f17('0x7'));router[_0x8f17('0x8')]('/',auth[_0x8f17('0x9')](),controller['index']);router[_0x8f17('0x8')](_0x8f17('0xa'),auth[_0x8f17('0x9')](),controller[_0x8f17('0xb')]);router[_0x8f17('0x8')](_0x8f17('0xc'),auth[_0x8f17('0x9')](),controller['getConfigurations']);router[_0x8f17('0x8')]('/:id/fields',auth[_0x8f17('0x9')](),controller[_0x8f17('0xd')]);router['post']('/',auth[_0x8f17('0x9')](),controller[_0x8f17('0xe')]);router[_0x8f17('0xf')](_0x8f17('0xc'),auth[_0x8f17('0x9')](),controller[_0x8f17('0x10')]);router[_0x8f17('0x11')](_0x8f17('0xa'),auth[_0x8f17('0x9')](),controller[_0x8f17('0x12')]);router[_0x8f17('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8f17('0x14')]);module[_0x8f17('0x15')]=router; \ No newline at end of file +var _0x45e1=['post','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x46e73f,_0x34fa36){var _0x4cdaf4=function(_0x1da265){while(--_0x1da265){_0x46e73f['push'](_0x46e73f['shift']());}};_0x4cdaf4(++_0x34fa36);}(_0x45e1,0x150));var _0x145e=function(_0x2ca970,_0x32fe25){_0x2ca970=_0x2ca970-0x0;var _0x45f6e8=_0x45e1[_0x2ca970];return _0x45f6e8;};'use strict';var multer=require(_0x145e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x145e('0x1'));var router=express['Router']();var fs_extra=require(_0x145e('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x145e('0x3'));var config=require(_0x145e('0x4'));var controller=require(_0x145e('0x5'));router[_0x145e('0x6')]('/',auth[_0x145e('0x7')](),controller[_0x145e('0x8')]);router[_0x145e('0x6')](_0x145e('0x9'),auth[_0x145e('0x7')](),controller[_0x145e('0xa')]);router['get'](_0x145e('0xb'),auth[_0x145e('0x7')](),controller[_0x145e('0xc')]);router[_0x145e('0x6')](_0x145e('0xd'),auth['isAuthenticated'](),controller[_0x145e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x145e('0xf')]);router[_0x145e('0x10')](_0x145e('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x145e('0x11')](_0x145e('0x9'),auth[_0x145e('0x7')](),controller[_0x145e('0x12')]);router[_0x145e('0x13')](_0x145e('0x9'),auth[_0x145e('0x7')](),controller[_0x145e('0x14')]);module[_0x145e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d2c7203..f2841c4 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 _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x4e9aa6,_0x5bba38){var _0x3c0488=function(_0x373436){while(--_0x373436){_0x4e9aa6['push'](_0x4e9aa6['shift']());}};_0x3c0488(++_0x5bba38);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2bdecd,_0x21805f){var _0x56116e=function(_0x297d20){while(--_0x297d20){_0x2bdecd['push'](_0x2bdecd['shift']());}};_0x56116e(++_0x21805f);}(_0x25e7,0x1d6));var _0x725e=function(_0x405541,_0x2945cc){_0x405541=_0x405541-0x0;var _0x194a1e=_0x25e7[_0x405541];return _0x194a1e;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('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 a181ee4..3b2ee68 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 _0xe28e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskAccount','includeAll','include','findAll','catch','params','fields','options','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe28e,0x1ba));var _0xee28=function(_0x26992e,_0x34653d){_0x26992e=_0x26992e-0x0;var _0x586da5=_0xe28e[_0x26992e];return _0x586da5;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];var integrations=require(_0xee28('0x1a'));function respondWithStatusCode(_0x267031,_0x46e784){_0x46e784=_0x46e784||0xcc;return function(_0x236de4){if(_0x236de4){return _0x267031['sendStatus'](_0x46e784);}return _0x267031[_0xee28('0x1b')](_0x46e784)[_0xee28('0x1c')]();};}function respondWithResult(_0x555b9c,_0x331b7c){_0x331b7c=_0x331b7c||0xc8;return function(_0x2ae3e0){if(_0x2ae3e0){return _0x555b9c['status'](_0x331b7c)[_0xee28('0x1d')](_0x2ae3e0);}};}function respondWithFilteredResult(_0x17c99a,_0x3d3a5c){return function(_0x343358){if(_0x343358){var _0x1ff99e=typeof _0x3d3a5c[_0xee28('0x1e')]==='undefined'&&typeof _0x3d3a5c[_0xee28('0x1f')]==='undefined';var _0x37e429=_0x343358[_0xee28('0x20')];var _0x5afd11=_0x1ff99e?0x0:_0x3d3a5c[_0xee28('0x1e')];var _0x49be69=_0x1ff99e?_0x343358[_0xee28('0x20')]:_0x3d3a5c['offset']+_0x3d3a5c[_0xee28('0x1f')];var _0x577332;if(_0x49be69>=_0x37e429){_0x49be69=_0x37e429;_0x577332=0xc8;}else{_0x577332=0xce;}_0x17c99a[_0xee28('0x1b')](_0x577332);return _0x17c99a['set'](_0xee28('0x21'),_0x5afd11+'-'+_0x49be69+'/'+_0x37e429)[_0xee28('0x1d')](_0x343358);}return null;};}function patchUpdates(_0x96f5db){return function(_0x3674c7){try{jsonpatch[_0xee28('0x22')](_0x3674c7,_0x96f5db,!![]);}catch(_0x1280f5){return BPromise[_0xee28('0x23')](_0x1280f5);}return _0x3674c7['save']();};}function saveUpdates(_0x342798,_0x44d7ff){return function(_0x3198d0){if(_0x3198d0){return _0x3198d0['update'](_0x342798)['then'](function(_0x17d8e4){return _0x17d8e4;});}return null;};}function removeEntity(_0x4a524d,_0x1519ae){return function(_0x29360e){if(_0x29360e){return _0x29360e[_0xee28('0x24')]()[_0xee28('0x25')](function(){_0x4a524d[_0xee28('0x1b')](0xcc)[_0xee28('0x1c')]();});}};}function handleEntityNotFound(_0x2a7c95,_0x733ca8){return function(_0x281c8a){if(!_0x281c8a){_0x2a7c95['sendStatus'](0x194);}return _0x281c8a;};}function handleError(_0x2c847b,_0x5b1b1e){_0x5b1b1e=_0x5b1b1e||0x1f4;return function(_0x51a87e){logger['error'](_0x51a87e['stack']);if(_0x51a87e['name']){delete _0x51a87e[_0xee28('0x26')];}_0x2c847b[_0xee28('0x1b')](_0x5b1b1e)[_0xee28('0x27')](_0x51a87e);};}exports[_0xee28('0x28')]=function(_0x346201,_0x417840){var _0xbafd67={},_0x4fcc8f={},_0x84e0ba={'count':0x0,'rows':[]};var _0x7390dc=_[_0xee28('0x29')](db['FreshdeskAccount'][_0xee28('0x2a')],function(_0x2890ad){return{'name':_0x2890ad[_0xee28('0x2b')],'type':_0x2890ad[_0xee28('0x2c')][_0xee28('0x2d')]};});_0x4fcc8f[_0xee28('0x2e')]=_[_0xee28('0x29')](_0x7390dc,'name');_0x4fcc8f[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x346201['query']);_0x4fcc8f[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],_0x4fcc8f[_0xee28('0x2f')]);_0xbafd67[_0xee28('0x33')]=_[_0xee28('0x32')](_0x4fcc8f[_0xee28('0x2e')],qs['fields'](_0x346201['query']['fields']));_0xbafd67[_0xee28('0x33')]=_0xbafd67[_0xee28('0x33')][_0xee28('0x34')]?_0xbafd67[_0xee28('0x33')]:_0x4fcc8f[_0xee28('0x2e')];if(!_0x346201[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0xbafd67[_0xee28('0x1f')]=qs['limit'](_0x346201['query'][_0xee28('0x1f')]);_0xbafd67[_0xee28('0x1e')]=qs['offset'](_0x346201['query'][_0xee28('0x1e')]);}_0xbafd67[_0xee28('0x36')]=qs['sort'](_0x346201[_0xee28('0x2f')][_0xee28('0x37')]);_0xbafd67[_0xee28('0x38')]=qs[_0xee28('0x31')](_[_0xee28('0x39')](_0x346201[_0xee28('0x2f')],_0x4fcc8f[_0xee28('0x31')]),_0x7390dc);if(_0x346201[_0xee28('0x2f')][_0xee28('0x3a')]){_0xbafd67[_0xee28('0x38')]=_[_0xee28('0x3b')](_0xbafd67[_0xee28('0x38')],{'$or':_['map'](_0x7390dc,function(_0x191d7d){if(_0x191d7d['type']!=='VIRTUAL'){var _0x265ae5={};_0x265ae5[_0x191d7d['name']]={'$like':'%'+_0x346201[_0xee28('0x2f')]['filter']+'%'};return _0x265ae5;}})});}_0xbafd67=_[_0xee28('0x3b')]({},_0xbafd67,_0x346201['options']);var _0x1faf46={'where':_0xbafd67[_0xee28('0x38')]};return db[_0xee28('0x3c')][_0xee28('0x20')](_0x1faf46)['then'](function(_0x1cf211){_0x84e0ba['count']=_0x1cf211;if(_0x346201[_0xee28('0x2f')][_0xee28('0x3d')]){_0xbafd67[_0xee28('0x3e')]=[{'all':!![]}];}return db[_0xee28('0x3c')][_0xee28('0x3f')](_0xbafd67);})[_0xee28('0x25')](function(_0x216ca7){_0x84e0ba['rows']=_0x216ca7;return _0x84e0ba;})['then'](respondWithFilteredResult(_0x417840,_0xbafd67))[_0xee28('0x40')](handleError(_0x417840,null));};exports['show']=function(_0x52b666,_0x4064cf){var _0x14bd8d={'raw':![],'where':{'id':_0x52b666[_0xee28('0x41')]['id']}},_0x4ffb08={};_0x4ffb08[_0xee28('0x2e')]=_[_0xee28('0x30')](db[_0xee28('0x3c')][_0xee28('0x2a')]);_0x4ffb08[_0xee28('0x2f')]=_[_0xee28('0x30')](_0x52b666['query']);_0x4ffb08[_0xee28('0x31')]=_[_0xee28('0x32')](_0x4ffb08[_0xee28('0x2e')],_0x4ffb08[_0xee28('0x2f')]);_0x14bd8d[_0xee28('0x33')]=_['intersection'](_0x4ffb08[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x52b666['query'][_0xee28('0x42')]));_0x14bd8d[_0xee28('0x33')]=_0x14bd8d[_0xee28('0x33')][_0xee28('0x34')]?_0x14bd8d[_0xee28('0x33')]:_0x4ffb08[_0xee28('0x2e')];if(_0x52b666['query'][_0xee28('0x3d')]){_0x14bd8d['include']=[{'all':!![]}];}_0x14bd8d=_['merge']({},_0x14bd8d,_0x52b666[_0xee28('0x43')]);return db[_0xee28('0x3c')]['find'](_0x14bd8d)[_0xee28('0x25')](handleEntityNotFound(_0x4064cf,null))[_0xee28('0x25')](respondWithResult(_0x4064cf,null))[_0xee28('0x40')](handleError(_0x4064cf,null));};exports['create']=function(_0x57e57e,_0x18c96c){return db[_0xee28('0x3c')][_0xee28('0x44')](_0x57e57e[_0xee28('0x45')],{})[_0xee28('0x25')](respondWithResult(_0x18c96c,0xc9))[_0xee28('0x40')](handleError(_0x18c96c,null));};exports[_0xee28('0x46')]=function(_0x2b5f36,_0x3e31c3){if(_0x2b5f36[_0xee28('0x45')]['id']){delete _0x2b5f36['body']['id'];}return db[_0xee28('0x3c')]['find']({'where':{'id':_0x2b5f36[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x3e31c3,null))[_0xee28('0x25')](saveUpdates(_0x2b5f36[_0xee28('0x45')],null))[_0xee28('0x25')](respondWithResult(_0x3e31c3,null))['catch'](handleError(_0x3e31c3,null));};exports['destroy']=function(_0x5ca018,_0x1b15a4){return db['FreshdeskAccount']['find']({'where':{'id':_0x5ca018[_0xee28('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b15a4,null))[_0xee28('0x25')](removeEntity(_0x1b15a4,null))[_0xee28('0x40')](handleError(_0x1b15a4,null));};exports[_0xee28('0x47')]=function(_0x3a4e74,_0x398120,_0x34a89e){var _0x326c85={};var _0xc1bdba={};var _0x44402a;var _0x10d393;return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x3a4e74[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x398120,null))['then'](function(_0x5b9ced){if(_0x5b9ced){_0x44402a=_0x5b9ced;_0xc1bdba['model']=_['keys'](db[_0xee28('0x49')][_0xee28('0x2a')]);_0xc1bdba[_0xee28('0x2f')]=_['keys'](_0x3a4e74[_0xee28('0x2f')]);_0xc1bdba[_0xee28('0x31')]=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],_0xc1bdba[_0xee28('0x2f')]);_0x326c85['attributes']=_[_0xee28('0x32')](_0xc1bdba[_0xee28('0x2e')],qs[_0xee28('0x42')](_0x3a4e74['query'][_0xee28('0x42')]));_0x326c85[_0xee28('0x33')]=_0x326c85[_0xee28('0x33')][_0xee28('0x34')]?_0x326c85[_0xee28('0x33')]:_0xc1bdba[_0xee28('0x2e')];_0x326c85[_0xee28('0x36')]=qs['sort'](_0x3a4e74[_0xee28('0x2f')]['sort']);_0x326c85['where']=qs['filters'](_[_0xee28('0x39')](_0x3a4e74[_0xee28('0x2f')],_0xc1bdba[_0xee28('0x31')]));if(_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]){_0x326c85[_0xee28('0x38')]=_[_0xee28('0x3b')](_0x326c85[_0xee28('0x38')],{'$or':_['map'](_0x326c85[_0xee28('0x33')],function(_0x386e24){var _0x32c06f={};_0x32c06f[_0x386e24]={'$like':'%'+_0x3a4e74[_0xee28('0x2f')][_0xee28('0x3a')]+'%'};return _0x32c06f;})});}_0x326c85=_[_0xee28('0x3b')]({},_0x326c85,_0x3a4e74[_0xee28('0x43')]);return _0x44402a['getConfigurations'](_0x326c85);}})[_0xee28('0x25')](function(_0x4fbb16){if(_0x4fbb16){_0x10d393=_0x4fbb16[_0xee28('0x34')];if(!_0x3a4e74[_0xee28('0x2f')]['hasOwnProperty'](_0xee28('0x35'))){_0x326c85[_0xee28('0x1f')]=qs[_0xee28('0x1f')](_0x3a4e74[_0xee28('0x2f')]['limit']);_0x326c85[_0xee28('0x1e')]=qs[_0xee28('0x1e')](_0x3a4e74[_0xee28('0x2f')][_0xee28('0x1e')]);}return _0x44402a[_0xee28('0x47')](_0x326c85);}})[_0xee28('0x25')](function(_0xf3416b){if(_0xf3416b){return _0xf3416b?{'count':_0x10d393,'rows':_0xf3416b}:null;}})['then'](respondWithResult(_0x398120,null))[_0xee28('0x40')](handleError(_0x398120,null));};exports['addConfiguration']=function(_0x1aa19f,_0x152331,_0x48ad2b){if(_0x1aa19f['body']['id']){delete _0x1aa19f[_0xee28('0x45')]['id'];}return db['FreshdeskAccount'][_0xee28('0x48')]({'where':{'id':_0x1aa19f[_0xee28('0x41')]['id']}})[_0xee28('0x25')](handleEntityNotFound(_0x152331,null))[_0xee28('0x25')](function(_0x6e5bab){if(_0x6e5bab){_0x1aa19f[_0xee28('0x45')][_0xee28('0x4a')]=_0x6e5bab['id'];_0x1aa19f['body'][_0xee28('0x4b')]=integrations[_0xee28('0x4c')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);_0x1aa19f[_0xee28('0x45')][_0xee28('0x4d')]=integrations[_0xee28('0x4e')](_0x1aa19f[_0xee28('0x45')]['channel'],_0x1aa19f[_0xee28('0x45')][_0xee28('0x2c')]);return db[_0xee28('0x49')][_0xee28('0x44')](_0x1aa19f[_0xee28('0x45')],{'include':[{'model':db[_0xee28('0x4f')],'as':'Subjects'},{'model':db[_0xee28('0x4f')],'as':_0xee28('0x4d')}]});}return null;})['then'](respondWithResult(_0x152331,null))['catch'](handleError(_0x152331,null));};exports['getFields']=function(_0x57f6d6,_0x149959,_0x56949a){var _0x24bc85='';return db[_0xee28('0x3c')][_0xee28('0x48')]({'where':{'id':_0x57f6d6['params']['id']},'attributes':['id',_0xee28('0x50'),_0xee28('0x51')]})[_0xee28('0x25')](handleEntityNotFound(_0x149959,null))[_0xee28('0x25')](function(_0x52f4e4){if(_0x52f4e4){_0x24bc85=_0x52f4e4[_0xee28('0x50')];var _0x4cb851=_0x24bc85[_0xee28('0x52')](-0x1);if(_0x4cb851==='/'){_0x24bc85=_0x24bc85[_0xee28('0x53')](0x0,_0x24bc85[_0xee28('0x54')](_0x4cb851));}return rp({'method':'GET','uri':util[_0xee28('0x55')](_0xee28('0x56'),_0x24bc85,_0xee28('0x57')),'headers':{'Authorization':util[_0xee28('0x55')]('Basic\x20%s',new Buffer(util[_0xee28('0x55')]('%s:X',_0x52f4e4[_0xee28('0x51')]))[_0xee28('0x58')](_0xee28('0x59')))},'json':!![]});}})[_0xee28('0x25')](function(_0x4d643b){if(_0x4d643b){var _0x182ad0=[_0xee28('0x5a'),_0xee28('0x5b'),'agent',_0xee28('0x5c'),'status',_0xee28('0x5d'),_0xee28('0x5e'),_0xee28('0x5f'),_0xee28('0x60'),_0xee28('0x5e'),_0xee28('0x61')];_['remove'](_0x4d643b,function(_0x4e0260){return _0x182ad0[_0xee28('0x62')](_0x4e0260[_0xee28('0x26')])||!_0x4e0260[_0xee28('0x63')]&&_0x4e0260[_0xee28('0x2c')]!==_0xee28('0x64')&&_0x4e0260[_0xee28('0x2c')]!=='custom_dropdown';});return{'count':_0x4d643b[_0xee28('0x34')],'rows':_[_0xee28('0x29')](_0x4d643b,function(_0x14cae0){return{'id':_0x14cae0[_0xee28('0x26')],'name':_0x14cae0[_0xee28('0x65')],'custom':!_0x14cae0[_0xee28('0x63')],'options':_0x14cae0[_0xee28('0x66')]?_[_0xee28('0x29')](_0x14cae0[_0xee28('0x66')],function(_0x2a6984){return{'name':_[_0xee28('0x67')](_0x2a6984),'value':_0x2a6984};}):[]};})};}})[_0xee28('0x25')](respondWithResult(_0x149959,null))[_0xee28('0x40')](function(_0x441ac1){var _0x46998f=_0x57f6d6[_0xee28('0x2f')][_0xee28('0x68')]?0x1f4:_0x441ac1['statusCode']||0x1f4;logger[_0xee28('0x69')](_0xee28('0x6a'),_0xee28('0x6b'),_0x46998f,JSON[_0xee28('0x6c')](_0x441ac1));delete _0x441ac1[_0xee28('0x26')];if(_0x46998f===0x191){_0x46998f=0x190;}_0x149959[_0xee28('0x1b')](_0x46998f)['send'](_0x57f6d6[_0xee28('0x2f')]['test']?{'message':_0xee28('0x6d'),'statusCode':_0x441ac1[_0xee28('0x6e')]}:_0x441ac1);});}; \ No newline at end of file +var _0xd9dc=['../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','FreshdeskAccount','fieldName','type','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','getConfigurations','FreshdeskConfiguration','length','pick','hasOwnProperty','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:X','toString','base64','agent','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x57dd90,_0x58ddc4){_0x57dd90=_0x57dd90-0x0;var _0x34abca=_0xd9dc[_0x57dd90];return _0x34abca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd9d('0x0'));var zipdir=require(_0xcd9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd9d('0x2'));var moment=require(_0xcd9d('0x3'));var BPromise=require(_0xcd9d('0x4'));var Mustache=require('mustache');var util=require(_0xcd9d('0x5'));var path=require(_0xcd9d('0x6'));var sox=require(_0xcd9d('0x7'));var csv=require(_0xcd9d('0x8'));var ejs=require(_0xcd9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd9d('0xa'));var squel=require(_0xcd9d('0xb'));var crypto=require(_0xcd9d('0xc'));var jsforce=require(_0xcd9d('0xd'));var deskjs=require(_0xcd9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcd9d('0xf'));var Papa=require(_0xcd9d('0x10'));var Redis=require(_0xcd9d('0x11'));var authService=require(_0xcd9d('0x12'));var qs=require(_0xcd9d('0x13'));var as=require(_0xcd9d('0x14'));var hardwareService=require(_0xcd9d('0x15'));var logger=require(_0xcd9d('0x16'))('api');var utils=require(_0xcd9d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd9d('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcd9d('0x19'));function respondWithStatusCode(_0x3ab0af,_0x2fa1d0){_0x2fa1d0=_0x2fa1d0||0xcc;return function(_0x49028e){if(_0x49028e){return _0x3ab0af[_0xcd9d('0x1a')](_0x2fa1d0);}return _0x3ab0af['status'](_0x2fa1d0)[_0xcd9d('0x1b')]();};}function respondWithResult(_0x957089,_0x31ddbb){_0x31ddbb=_0x31ddbb||0xc8;return function(_0x582a92){if(_0x582a92){return _0x957089[_0xcd9d('0x1c')](_0x31ddbb)[_0xcd9d('0x1d')](_0x582a92);}};}function respondWithFilteredResult(_0x50f14d,_0x40d5aa){return function(_0x5a7248){if(_0x5a7248){var _0x3ea72c=typeof _0x40d5aa['offset']===_0xcd9d('0x1e')&&typeof _0x40d5aa[_0xcd9d('0x1f')]===_0xcd9d('0x1e');var _0xf82796=_0x5a7248[_0xcd9d('0x20')];var _0x4381e2=_0x3ea72c?0x0:_0x40d5aa[_0xcd9d('0x21')];var _0x3c544d=_0x3ea72c?_0x5a7248[_0xcd9d('0x20')]:_0x40d5aa[_0xcd9d('0x21')]+_0x40d5aa[_0xcd9d('0x1f')];var _0x497425;if(_0x3c544d>=_0xf82796){_0x3c544d=_0xf82796;_0x497425=0xc8;}else{_0x497425=0xce;}_0x50f14d[_0xcd9d('0x1c')](_0x497425);return _0x50f14d[_0xcd9d('0x22')](_0xcd9d('0x23'),_0x4381e2+'-'+_0x3c544d+'/'+_0xf82796)['json'](_0x5a7248);}return null;};}function patchUpdates(_0x2a5848){return function(_0xe04bb8){try{jsonpatch[_0xcd9d('0x24')](_0xe04bb8,_0x2a5848,!![]);}catch(_0x851388){return BPromise[_0xcd9d('0x25')](_0x851388);}return _0xe04bb8[_0xcd9d('0x26')]();};}function saveUpdates(_0x1e7d4d,_0x12e585){return function(_0x4ad511){if(_0x4ad511){return _0x4ad511['update'](_0x1e7d4d)[_0xcd9d('0x27')](function(_0x222afe){return _0x222afe;});}return null;};}function removeEntity(_0x2560fd,_0x474bb4){return function(_0x58b632){if(_0x58b632){return _0x58b632[_0xcd9d('0x28')]()[_0xcd9d('0x27')](function(){_0x2560fd[_0xcd9d('0x1c')](0xcc)[_0xcd9d('0x1b')]();});}};}function handleEntityNotFound(_0x32686a,_0x5ed51f){return function(_0x33aca7){if(!_0x33aca7){_0x32686a[_0xcd9d('0x1a')](0x194);}return _0x33aca7;};}function handleError(_0xf21e2,_0x4ce785){_0x4ce785=_0x4ce785||0x1f4;return function(_0x14a5e9){logger[_0xcd9d('0x29')](_0x14a5e9[_0xcd9d('0x2a')]);if(_0x14a5e9['name']){delete _0x14a5e9[_0xcd9d('0x2b')];}_0xf21e2[_0xcd9d('0x1c')](_0x4ce785)['send'](_0x14a5e9);};}exports['index']=function(_0xf84e80,_0x124da9){var _0x5b1fd6={},_0xcf8b36={},_0x2d3347={'count':0x0,'rows':[]};var _0x3c70de=_[_0xcd9d('0x2c')](db[_0xcd9d('0x2d')]['rawAttributes'],function(_0x4bd53d){return{'name':_0x4bd53d[_0xcd9d('0x2e')],'type':_0x4bd53d[_0xcd9d('0x2f')]['key']};});_0xcf8b36[_0xcd9d('0x30')]=_[_0xcd9d('0x2c')](_0x3c70de,_0xcd9d('0x2b'));_0xcf8b36['query']=_[_0xcd9d('0x31')](_0xf84e80[_0xcd9d('0x32')]);_0xcf8b36[_0xcd9d('0x33')]=_[_0xcd9d('0x34')](_0xcf8b36['model'],_0xcf8b36['query']);_0x5b1fd6[_0xcd9d('0x35')]=_['intersection'](_0xcf8b36['model'],qs[_0xcd9d('0x36')](_0xf84e80[_0xcd9d('0x32')][_0xcd9d('0x36')]));_0x5b1fd6[_0xcd9d('0x35')]=_0x5b1fd6['attributes']['length']?_0x5b1fd6[_0xcd9d('0x35')]:_0xcf8b36[_0xcd9d('0x30')];if(!_0xf84e80[_0xcd9d('0x32')]['hasOwnProperty'](_0xcd9d('0x37'))){_0x5b1fd6[_0xcd9d('0x1f')]=qs[_0xcd9d('0x1f')](_0xf84e80[_0xcd9d('0x32')][_0xcd9d('0x1f')]);_0x5b1fd6[_0xcd9d('0x21')]=qs[_0xcd9d('0x21')](_0xf84e80[_0xcd9d('0x32')][_0xcd9d('0x21')]);}_0x5b1fd6[_0xcd9d('0x38')]=qs[_0xcd9d('0x39')](_0xf84e80[_0xcd9d('0x32')]['sort']);_0x5b1fd6[_0xcd9d('0x3a')]=qs[_0xcd9d('0x33')](_['pick'](_0xf84e80['query'],_0xcf8b36[_0xcd9d('0x33')]),_0x3c70de);if(_0xf84e80['query']['filter']){_0x5b1fd6[_0xcd9d('0x3a')]=_[_0xcd9d('0x3b')](_0x5b1fd6[_0xcd9d('0x3a')],{'$or':_[_0xcd9d('0x2c')](_0x3c70de,function(_0x49b83d){if(_0x49b83d[_0xcd9d('0x2f')]!==_0xcd9d('0x3c')){var _0x532174={};_0x532174[_0x49b83d[_0xcd9d('0x2b')]]={'$like':'%'+_0xf84e80[_0xcd9d('0x32')][_0xcd9d('0x3d')]+'%'};return _0x532174;}})});}_0x5b1fd6=_[_0xcd9d('0x3b')]({},_0x5b1fd6,_0xf84e80['options']);var _0x4f06e6={'where':_0x5b1fd6[_0xcd9d('0x3a')]};return db['FreshdeskAccount'][_0xcd9d('0x20')](_0x4f06e6)[_0xcd9d('0x27')](function(_0x10c35a){_0x2d3347['count']=_0x10c35a;if(_0xf84e80[_0xcd9d('0x32')][_0xcd9d('0x3e')]){_0x5b1fd6[_0xcd9d('0x3f')]=[{'all':!![]}];}return db[_0xcd9d('0x2d')][_0xcd9d('0x40')](_0x5b1fd6);})[_0xcd9d('0x27')](function(_0x23065b){_0x2d3347[_0xcd9d('0x41')]=_0x23065b;return _0x2d3347;})[_0xcd9d('0x27')](respondWithFilteredResult(_0x124da9,_0x5b1fd6))[_0xcd9d('0x42')](handleError(_0x124da9,null));};exports[_0xcd9d('0x43')]=function(_0x5e8223,_0x4a2dec){var _0x52b882={'raw':![],'where':{'id':_0x5e8223[_0xcd9d('0x44')]['id']}},_0x2b4584={};_0x2b4584[_0xcd9d('0x30')]=_['keys'](db[_0xcd9d('0x2d')][_0xcd9d('0x45')]);_0x2b4584['query']=_[_0xcd9d('0x31')](_0x5e8223['query']);_0x2b4584[_0xcd9d('0x33')]=_[_0xcd9d('0x34')](_0x2b4584['model'],_0x2b4584['query']);_0x52b882[_0xcd9d('0x35')]=_[_0xcd9d('0x34')](_0x2b4584[_0xcd9d('0x30')],qs[_0xcd9d('0x36')](_0x5e8223[_0xcd9d('0x32')][_0xcd9d('0x36')]));_0x52b882['attributes']=_0x52b882['attributes']['length']?_0x52b882[_0xcd9d('0x35')]:_0x2b4584[_0xcd9d('0x30')];if(_0x5e8223['query'][_0xcd9d('0x3e')]){_0x52b882[_0xcd9d('0x3f')]=[{'all':!![]}];}_0x52b882=_[_0xcd9d('0x3b')]({},_0x52b882,_0x5e8223[_0xcd9d('0x46')]);return db[_0xcd9d('0x2d')][_0xcd9d('0x47')](_0x52b882)[_0xcd9d('0x27')](handleEntityNotFound(_0x4a2dec,null))[_0xcd9d('0x27')](respondWithResult(_0x4a2dec,null))[_0xcd9d('0x42')](handleError(_0x4a2dec,null));};exports[_0xcd9d('0x48')]=function(_0x55c374,_0x28b724){return db[_0xcd9d('0x2d')][_0xcd9d('0x48')](_0x55c374[_0xcd9d('0x49')],{})[_0xcd9d('0x27')](respondWithResult(_0x28b724,0xc9))[_0xcd9d('0x42')](handleError(_0x28b724,null));};exports[_0xcd9d('0x4a')]=function(_0x3234ea,_0x5a1c79){if(_0x3234ea[_0xcd9d('0x49')]['id']){delete _0x3234ea[_0xcd9d('0x49')]['id'];}return db[_0xcd9d('0x2d')]['find']({'where':{'id':_0x3234ea[_0xcd9d('0x44')]['id']}})[_0xcd9d('0x27')](handleEntityNotFound(_0x5a1c79,null))[_0xcd9d('0x27')](saveUpdates(_0x3234ea[_0xcd9d('0x49')],null))[_0xcd9d('0x27')](respondWithResult(_0x5a1c79,null))[_0xcd9d('0x42')](handleError(_0x5a1c79,null));};exports[_0xcd9d('0x28')]=function(_0x346776,_0x5c541e){return db[_0xcd9d('0x2d')][_0xcd9d('0x47')]({'where':{'id':_0x346776[_0xcd9d('0x44')]['id']}})[_0xcd9d('0x27')](handleEntityNotFound(_0x5c541e,null))['then'](removeEntity(_0x5c541e,null))[_0xcd9d('0x42')](handleError(_0x5c541e,null));};exports[_0xcd9d('0x4b')]=function(_0x26b475,_0x10fb9f,_0x5bdcfd){var _0x27a363={};var _0x3e6754={};var _0x1bf893;var _0x425e86;return db[_0xcd9d('0x2d')]['findOne']({'where':{'id':_0x26b475[_0xcd9d('0x44')]['id']}})[_0xcd9d('0x27')](handleEntityNotFound(_0x10fb9f,null))['then'](function(_0x2c2782){if(_0x2c2782){_0x1bf893=_0x2c2782;_0x3e6754[_0xcd9d('0x30')]=_['keys'](db[_0xcd9d('0x4c')][_0xcd9d('0x45')]);_0x3e6754[_0xcd9d('0x32')]=_[_0xcd9d('0x31')](_0x26b475[_0xcd9d('0x32')]);_0x3e6754[_0xcd9d('0x33')]=_['intersection'](_0x3e6754['model'],_0x3e6754['query']);_0x27a363[_0xcd9d('0x35')]=_[_0xcd9d('0x34')](_0x3e6754[_0xcd9d('0x30')],qs['fields'](_0x26b475[_0xcd9d('0x32')][_0xcd9d('0x36')]));_0x27a363['attributes']=_0x27a363[_0xcd9d('0x35')][_0xcd9d('0x4d')]?_0x27a363[_0xcd9d('0x35')]:_0x3e6754['model'];_0x27a363[_0xcd9d('0x38')]=qs[_0xcd9d('0x39')](_0x26b475['query'][_0xcd9d('0x39')]);_0x27a363['where']=qs[_0xcd9d('0x33')](_[_0xcd9d('0x4e')](_0x26b475[_0xcd9d('0x32')],_0x3e6754['filters']));if(_0x26b475[_0xcd9d('0x32')][_0xcd9d('0x3d')]){_0x27a363[_0xcd9d('0x3a')]=_[_0xcd9d('0x3b')](_0x27a363[_0xcd9d('0x3a')],{'$or':_[_0xcd9d('0x2c')](_0x27a363[_0xcd9d('0x35')],function(_0x288d3e){var _0xf9b506={};_0xf9b506[_0x288d3e]={'$like':'%'+_0x26b475['query'][_0xcd9d('0x3d')]+'%'};return _0xf9b506;})});}_0x27a363=_[_0xcd9d('0x3b')]({},_0x27a363,_0x26b475[_0xcd9d('0x46')]);return _0x1bf893['getConfigurations'](_0x27a363);}})[_0xcd9d('0x27')](function(_0x282048){if(_0x282048){_0x425e86=_0x282048[_0xcd9d('0x4d')];if(!_0x26b475[_0xcd9d('0x32')][_0xcd9d('0x4f')](_0xcd9d('0x37'))){_0x27a363['limit']=qs['limit'](_0x26b475[_0xcd9d('0x32')][_0xcd9d('0x1f')]);_0x27a363[_0xcd9d('0x21')]=qs[_0xcd9d('0x21')](_0x26b475[_0xcd9d('0x32')]['offset']);}return _0x1bf893[_0xcd9d('0x4b')](_0x27a363);}})['then'](function(_0xe4aace){if(_0xe4aace){return _0xe4aace?{'count':_0x425e86,'rows':_0xe4aace}:null;}})['then'](respondWithResult(_0x10fb9f,null))[_0xcd9d('0x42')](handleError(_0x10fb9f,null));};exports['addConfiguration']=function(_0x380e8b,_0x32fd7e,_0x5608f1){if(_0x380e8b[_0xcd9d('0x49')]['id']){delete _0x380e8b['body']['id'];}return db[_0xcd9d('0x2d')][_0xcd9d('0x50')]({'where':{'id':_0x380e8b['params']['id']}})[_0xcd9d('0x27')](handleEntityNotFound(_0x32fd7e,null))[_0xcd9d('0x27')](function(_0x23998d){if(_0x23998d){_0x380e8b['body'][_0xcd9d('0x51')]=_0x23998d['id'];_0x380e8b['body']['Subjects']=integrations[_0xcd9d('0x52')](_0x380e8b[_0xcd9d('0x49')][_0xcd9d('0x53')],_0x380e8b['body'][_0xcd9d('0x2f')]);_0x380e8b[_0xcd9d('0x49')][_0xcd9d('0x54')]=integrations[_0xcd9d('0x55')](_0x380e8b[_0xcd9d('0x49')][_0xcd9d('0x53')],_0x380e8b['body'][_0xcd9d('0x2f')]);return db[_0xcd9d('0x4c')]['create'](_0x380e8b[_0xcd9d('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xcd9d('0x56')},{'model':db[_0xcd9d('0x57')],'as':_0xcd9d('0x54')}]});}return null;})[_0xcd9d('0x27')](respondWithResult(_0x32fd7e,null))[_0xcd9d('0x42')](handleError(_0x32fd7e,null));};exports[_0xcd9d('0x58')]=function(_0xf8932c,_0xb62b90,_0x2e7eef){var _0x4a16f8='';return db[_0xcd9d('0x2d')]['findOne']({'where':{'id':_0xf8932c[_0xcd9d('0x44')]['id']},'attributes':['id',_0xcd9d('0x59'),_0xcd9d('0x5a')]})[_0xcd9d('0x27')](handleEntityNotFound(_0xb62b90,null))[_0xcd9d('0x27')](function(_0x5587cf){if(_0x5587cf){_0x4a16f8=_0x5587cf[_0xcd9d('0x59')];var _0x6fe93a=_0x4a16f8[_0xcd9d('0x5b')](-0x1);if(_0x6fe93a==='/'){_0x4a16f8=_0x4a16f8[_0xcd9d('0x5c')](0x0,_0x4a16f8[_0xcd9d('0x5d')](_0x6fe93a));}return rp({'method':'GET','uri':util['format'](_0xcd9d('0x5e'),_0x4a16f8,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xcd9d('0x5f')](_0xcd9d('0x60'),new Buffer(util['format'](_0xcd9d('0x61'),_0x5587cf[_0xcd9d('0x5a')]))[_0xcd9d('0x62')](_0xcd9d('0x63')))},'json':!![]});}})['then'](function(_0x52b1bc){if(_0x52b1bc){var _0x565ee7=['requester','subject',_0xcd9d('0x64'),'description',_0xcd9d('0x1c'),_0xcd9d('0x65'),_0xcd9d('0x66'),_0xcd9d('0x67'),_0xcd9d('0x68'),_0xcd9d('0x66'),'company'];_[_0xcd9d('0x69')](_0x52b1bc,function(_0x470a1d){return _0x565ee7[_0xcd9d('0x6a')](_0x470a1d['name'])||!_0x470a1d[_0xcd9d('0x6b')]&&_0x470a1d[_0xcd9d('0x2f')]!==_0xcd9d('0x6c')&&_0x470a1d['type']!==_0xcd9d('0x6d');});return{'count':_0x52b1bc['length'],'rows':_[_0xcd9d('0x2c')](_0x52b1bc,function(_0x2fbeee){return{'id':_0x2fbeee[_0xcd9d('0x2b')],'name':_0x2fbeee[_0xcd9d('0x6e')],'custom':!_0x2fbeee[_0xcd9d('0x6b')],'options':_0x2fbeee[_0xcd9d('0x6f')]?_[_0xcd9d('0x2c')](_0x2fbeee[_0xcd9d('0x6f')],function(_0x32ad9c){return{'name':_[_0xcd9d('0x70')](_0x32ad9c),'value':_0x32ad9c};}):[]};})};}})['then'](respondWithResult(_0xb62b90,null))['catch'](function(_0xa4ae71){var _0x14b11a=_0xf8932c[_0xcd9d('0x32')][_0xcd9d('0x71')]?0x1f4:_0xa4ae71['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xcd9d('0x58'),_0x14b11a,JSON['stringify'](_0xa4ae71));delete _0xa4ae71[_0xcd9d('0x2b')];if(_0x14b11a===0x191){_0x14b11a=0x190;}_0xb62b90[_0xcd9d('0x1c')](_0x14b11a)[_0xcd9d('0x72')](_0xf8932c[_0xcd9d('0x32')][_0xcd9d('0x71')]?{'message':_0xcd9d('0x73'),'statusCode':_0xa4ae71[_0xcd9d('0x74')]}:_0xa4ae71);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 817a431..131495d 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 _0x78d8=['lodash','util','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0xad38ee,_0x3ec70b){var _0x126ffb=function(_0x587353){while(--_0x587353){_0xad38ee['push'](_0xad38ee['shift']());}};_0x126ffb(++_0x3ec70b);}(_0x78d8,0x198));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x878d('0x0'));var util=require(_0x878d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x878d('0x2'));var fs=require('fs');var path=require(_0x878d('0x3'));var rimraf=require(_0x878d('0x4'));var config=require(_0x878d('0x5'));var attributes=require(_0x878d('0x6'));var integrations=require(_0x878d('0x7'));module[_0x878d('0x8')]=function(_0x3ec514,_0x21dc64){return _0x3ec514[_0x878d('0x9')](_0x878d('0xa'),attributes,{'tableName':_0x878d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43b1=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','api','moment','rimraf'];(function(_0x30d644,_0x2ec12){var _0x4e99f4=function(_0x5d3c46){while(--_0x5d3c46){_0x30d644['push'](_0x30d644['shift']());}};_0x4e99f4(++_0x2ec12);}(_0x43b1,0x159));var _0x143b=function(_0x1d1360,_0x6ec181){_0x1d1360=_0x1d1360-0x0;var _0x37b739=_0x43b1[_0x1d1360];return _0x37b739;};'use strict';var _=require(_0x143b('0x0'));var util=require(_0x143b('0x1'));var logger=require('../../config/logger')(_0x143b('0x2'));var moment=require(_0x143b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x143b('0x4'));var config=require(_0x143b('0x5'));var attributes=require(_0x143b('0x6'));var integrations=require(_0x143b('0x7'));module[_0x143b('0x8')]=function(_0x404a6c,_0x5aa8bb){return _0x404a6c[_0x143b('0x9')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','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 23e4589..072458a 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 _0xbd76=['include','model','attributes','map','info','ShowFreshdeskAccount','find','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','limit'];(function(_0x3ab424,_0x1c24f2){var _0x596ab1=function(_0x37e745){while(--_0x37e745){_0x3ab424['push'](_0x3ab424['shift']());}};_0x596ab1(++_0x1c24f2);}(_0xbd76,0x105));var _0x6bd7=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xbd76[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x6bd7('0x0'));var util=require(_0x6bd7('0x1'));var moment=require(_0x6bd7('0x2'));var BPromise=require(_0x6bd7('0x3'));var rs=require(_0x6bd7('0x4'));var fs=require('fs');var Redis=require(_0x6bd7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6bd7('0x6'))('rpc');var config=require(_0x6bd7('0x7'));var jayson=require(_0x6bd7('0x8'));var client=jayson[_0x6bd7('0x9')][_0x6bd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2c4b,_0xc0ec14,_0x24e98b){return new BPromise(function(_0xe61423,_0x51c14e){return client[_0x6bd7('0xb')](_0x3d2c4b,_0x24e98b)[_0x6bd7('0xc')](function(_0x4a1254){logger['info'](_0x6bd7('0xd'),_0xc0ec14,_0x6bd7('0xe'));logger[_0x6bd7('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xc0ec14,_0x6bd7('0xe'),JSON['stringify'](_0x4a1254));if(_0x4a1254['error']){if(_0x4a1254['error'][_0x6bd7('0x10')]===0x1f4){logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x4a1254['error'][_0x6bd7('0x12')]);return _0x51c14e(_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);}logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);return _0xe61423(_0x4a1254[_0x6bd7('0x11')][_0x6bd7('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0xc0ec14,'request\x20sent');_0xe61423(_0x4a1254[_0x6bd7('0x13')][_0x6bd7('0x12')]);}})[_0x6bd7('0x14')](function(_0x5acf5c){logger[_0x6bd7('0x11')](_0x6bd7('0xd'),_0xc0ec14,_0x5acf5c);_0x51c14e(_0x5acf5c);});});}exports[_0x6bd7('0x15')]=function(_0x1fd79f){var _0x2c3056=this;return new Promise(function(_0x321cfa,_0x43edf6){return db[_0x6bd7('0x16')][_0x6bd7('0x17')]({'raw':_0x1fd79f['options']?_0x1fd79f[_0x6bd7('0x18')][_0x6bd7('0x19')]===undefined?!![]:![]:!![],'where':_0x1fd79f[_0x6bd7('0x18')]?_0x1fd79f['options']['where']||null:null,'attributes':_0x1fd79f['options']?_0x1fd79f['options']['attributes']||null:null,'limit':_0x1fd79f['options']?_0x1fd79f['options'][_0x6bd7('0x1a')]||null:null,'include':_0x1fd79f[_0x6bd7('0x18')]?_0x1fd79f[_0x6bd7('0x18')][_0x6bd7('0x1b')]?_['map'](_0x1fd79f[_0x6bd7('0x18')]['include'],function(_0x267bcb){return{'model':db[_0x267bcb[_0x6bd7('0x1c')]],'as':_0x267bcb['as'],'attributes':_0x267bcb[_0x6bd7('0x1d')],'include':_0x267bcb[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x267bcb['include'],function(_0x2cb6f3){return{'model':db[_0x2cb6f3['model']],'as':_0x2cb6f3['as'],'attributes':_0x2cb6f3[_0x6bd7('0x1d')],'include':_0x2cb6f3[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x2cb6f3[_0x6bd7('0x1b')],function(_0x1853cc){return{'model':db[_0x1853cc[_0x6bd7('0x1c')]],'as':_0x1853cc['as'],'attributes':_0x1853cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x6bd7('0xc')](function(_0x147c4b){logger[_0x6bd7('0x1f')]('GetFreshdeskAccount',_0x1fd79f);logger['debug']('GetFreshdeskAccount',_0x1fd79f,JSON['stringify'](_0x147c4b));_0x321cfa(_0x147c4b);})[_0x6bd7('0x14')](function(_0x288f51){logger[_0x6bd7('0x11')](_0x6bd7('0x15'),_0x288f51['message'],_0x1fd79f);_0x43edf6(_0x2c3056[_0x6bd7('0x11')](0x1f4,_0x288f51[_0x6bd7('0x12')]));});});};exports[_0x6bd7('0x20')]=function(_0x566050){var _0x13f35d=this;return new Promise(function(_0x22be17,_0xa7ea71){return db[_0x6bd7('0x16')][_0x6bd7('0x21')]({'raw':_0x566050['options']?_0x566050[_0x6bd7('0x18')][_0x6bd7('0x19')]===undefined?!![]:![]:!![],'where':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')][_0x6bd7('0x22')]||null:null,'attributes':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')]['attributes']||null:null,'include':_0x566050[_0x6bd7('0x18')]?_0x566050[_0x6bd7('0x18')]['include']?_[_0x6bd7('0x1e')](_0x566050[_0x6bd7('0x18')][_0x6bd7('0x1b')],function(_0x5a3050){return{'model':db[_0x5a3050['model']],'as':_0x5a3050['as'],'attributes':_0x5a3050[_0x6bd7('0x1d')],'include':_0x5a3050['include']?_[_0x6bd7('0x1e')](_0x5a3050[_0x6bd7('0x1b')],function(_0x88008f){return{'model':db[_0x88008f[_0x6bd7('0x1c')]],'as':_0x88008f['as'],'attributes':_0x88008f[_0x6bd7('0x1d')],'include':_0x88008f[_0x6bd7('0x1b')]?_[_0x6bd7('0x1e')](_0x88008f['include'],function(_0x3ffe3c){return{'model':db[_0x3ffe3c[_0x6bd7('0x1c')]],'as':_0x3ffe3c['as'],'attributes':_0x3ffe3c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb171f3){logger[_0x6bd7('0x1f')](_0x6bd7('0x20'),_0x566050);logger[_0x6bd7('0xf')]('ShowFreshdeskAccount',_0x566050,JSON[_0x6bd7('0x23')](_0xb171f3));_0x22be17(_0xb171f3);})[_0x6bd7('0x14')](function(_0x219970){logger[_0x6bd7('0x11')]('ShowFreshdeskAccount',_0x219970[_0x6bd7('0x12')],_0x566050);_0xa7ea71(_0x13f35d[_0x6bd7('0x11')](0x1f4,_0x219970[_0x6bd7('0x12')]));});});}; \ No newline at end of file +var _0xaccf=['../../config/logger','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','raw','options','attributes','map','include','model','ShowFreshdeskAccount','find','where','info','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4ed8f3,_0x3807ad){var _0x316395=function(_0x186459){while(--_0x186459){_0x4ed8f3['push'](_0x4ed8f3['shift']());}};_0x316395(++_0x3807ad);}(_0xaccf,0x182));var _0xfacc=function(_0x4f116c,_0x44f323){_0x4f116c=_0x4f116c-0x0;var _0xfeea8b=_0xaccf[_0x4f116c];return _0xfeea8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfacc('0x0'));var BPromise=require(_0xfacc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfacc('0x2'));var db=require(_0xfacc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfacc('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfacc('0x5'));var client=jayson[_0xfacc('0x6')][_0xfacc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x87058c,_0x133f38,_0x25bcf9){return new BPromise(function(_0xe6690,_0x1f9195){return client[_0xfacc('0x8')](_0x87058c,_0x25bcf9)[_0xfacc('0x9')](function(_0x1349dc){logger['info'](_0xfacc('0xa'),_0x133f38,_0xfacc('0xb'));logger[_0xfacc('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x133f38,_0xfacc('0xb'),JSON[_0xfacc('0xd')](_0x1349dc));if(_0x1349dc[_0xfacc('0xe')]){if(_0x1349dc[_0xfacc('0xe')][_0xfacc('0xf')]===0x1f4){logger['error'](_0xfacc('0xa'),_0x133f38,_0x1349dc[_0xfacc('0xe')]['message']);return _0x1f9195(_0x1349dc[_0xfacc('0xe')][_0xfacc('0x10')]);}logger[_0xfacc('0xe')](_0xfacc('0xa'),_0x133f38,_0x1349dc[_0xfacc('0xe')][_0xfacc('0x10')]);return _0xe6690(_0x1349dc[_0xfacc('0xe')][_0xfacc('0x10')]);}else{logger['info'](_0xfacc('0xa'),_0x133f38,_0xfacc('0xb'));_0xe6690(_0x1349dc['result'][_0xfacc('0x10')]);}})[_0xfacc('0x11')](function(_0x19845b){logger[_0xfacc('0xe')](_0xfacc('0xa'),_0x133f38,_0x19845b);_0x1f9195(_0x19845b);});});}exports[_0xfacc('0x12')]=function(_0x19b094){var _0x3807e8=this;return new Promise(function(_0x583f51,_0x5d82bd){return db[_0xfacc('0x13')]['findAll']({'raw':_0x19b094['options']?_0x19b094['options'][_0xfacc('0x14')]===undefined?!![]:![]:!![],'where':_0x19b094[_0xfacc('0x15')]?_0x19b094[_0xfacc('0x15')]['where']||null:null,'attributes':_0x19b094['options']?_0x19b094[_0xfacc('0x15')][_0xfacc('0x16')]||null:null,'limit':_0x19b094['options']?_0x19b094[_0xfacc('0x15')]['limit']||null:null,'include':_0x19b094[_0xfacc('0x15')]?_0x19b094['options']['include']?_[_0xfacc('0x17')](_0x19b094[_0xfacc('0x15')][_0xfacc('0x18')],function(_0x529282){return{'model':db[_0x529282[_0xfacc('0x19')]],'as':_0x529282['as'],'attributes':_0x529282[_0xfacc('0x16')],'include':_0x529282[_0xfacc('0x18')]?_[_0xfacc('0x17')](_0x529282[_0xfacc('0x18')],function(_0x59dd4d){return{'model':db[_0x59dd4d[_0xfacc('0x19')]],'as':_0x59dd4d['as'],'attributes':_0x59dd4d[_0xfacc('0x16')],'include':_0x59dd4d[_0xfacc('0x18')]?_['map'](_0x59dd4d[_0xfacc('0x18')],function(_0xa7bd52){return{'model':db[_0xa7bd52['model']],'as':_0xa7bd52['as'],'attributes':_0xa7bd52[_0xfacc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfacc('0x9')](function(_0x1f1111){logger['info'](_0xfacc('0x12'),_0x19b094);logger[_0xfacc('0xc')](_0xfacc('0x12'),_0x19b094,JSON[_0xfacc('0xd')](_0x1f1111));_0x583f51(_0x1f1111);})[_0xfacc('0x11')](function(_0x173f25){logger['error']('GetFreshdeskAccount',_0x173f25['message'],_0x19b094);_0x5d82bd(_0x3807e8['error'](0x1f4,_0x173f25[_0xfacc('0x10')]));});});};exports[_0xfacc('0x1a')]=function(_0x3ca79d){var _0x36739a=this;return new Promise(function(_0x12c47a,_0x33bf9){return db[_0xfacc('0x13')][_0xfacc('0x1b')]({'raw':_0x3ca79d[_0xfacc('0x15')]?_0x3ca79d[_0xfacc('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3ca79d[_0xfacc('0x15')]?_0x3ca79d[_0xfacc('0x15')][_0xfacc('0x1c')]||null:null,'attributes':_0x3ca79d[_0xfacc('0x15')]?_0x3ca79d[_0xfacc('0x15')][_0xfacc('0x16')]||null:null,'include':_0x3ca79d[_0xfacc('0x15')]?_0x3ca79d[_0xfacc('0x15')][_0xfacc('0x18')]?_['map'](_0x3ca79d[_0xfacc('0x15')][_0xfacc('0x18')],function(_0x15753c){return{'model':db[_0x15753c[_0xfacc('0x19')]],'as':_0x15753c['as'],'attributes':_0x15753c[_0xfacc('0x16')],'include':_0x15753c[_0xfacc('0x18')]?_[_0xfacc('0x17')](_0x15753c[_0xfacc('0x18')],function(_0x484427){return{'model':db[_0x484427['model']],'as':_0x484427['as'],'attributes':_0x484427[_0xfacc('0x16')],'include':_0x484427[_0xfacc('0x18')]?_[_0xfacc('0x17')](_0x484427[_0xfacc('0x18')],function(_0x1225bf){return{'model':db[_0x1225bf[_0xfacc('0x19')]],'as':_0x1225bf['as'],'attributes':_0x1225bf[_0xfacc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfacc('0x9')](function(_0x51f0a2){logger[_0xfacc('0x1d')](_0xfacc('0x1a'),_0x3ca79d);logger[_0xfacc('0xc')](_0xfacc('0x1a'),_0x3ca79d,JSON[_0xfacc('0xd')](_0x51f0a2));_0x12c47a(_0x51f0a2);})['catch'](function(_0x18ee1b){logger['error']('ShowFreshdeskAccount',_0x18ee1b[_0xfacc('0x10')],_0x3ca79d);_0x33bf9(_0x36739a[_0xfacc('0xe')](0x1f4,_0x18ee1b[_0xfacc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 46fdd86..dac364a 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 _0x1d6c=['index','get','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0x1d6c,0x171));var _0xc1d6=function(_0x2b9825,_0x2548db){_0x2b9825=_0x2b9825-0x0;var _0x5bb660=_0x1d6c[_0x2b9825];return _0x5bb660;};'use strict';var multer=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var path=require(_0xc1d6('0x2'));var timeout=require(_0xc1d6('0x3'));var express=require('express');var router=express[_0xc1d6('0x4')]();var fs_extra=require(_0xc1d6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1d6('0x6'));var config=require(_0xc1d6('0x7'));var controller=require(_0xc1d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1d6('0x9')]);router[_0xc1d6('0xa')]('/:id',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xc')]);router[_0xc1d6('0xa')](_0xc1d6('0xd'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc1d6('0xa')](_0xc1d6('0xf'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x10')]);router[_0xc1d6('0xa')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x12')]);router[_0xc1d6('0x13')]('/',auth[_0xc1d6('0xb')](),controller['create']);router[_0xc1d6('0x13')](_0xc1d6('0x11'),auth['isAuthenticated'](),controller[_0xc1d6('0x14')]);router[_0xc1d6('0x15')]('/:id',auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x16')]);router[_0xc1d6('0x17')](_0xc1d6('0x18'),auth[_0xc1d6('0xb')](),controller[_0xc1d6('0x19')]);module[_0xc1d6('0x1a')]=router; \ No newline at end of file +var _0x5e4c=['util','path','connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports'];(function(_0x45b1fc,_0x8c36e6){var _0x2467c3=function(_0x26e3ca){while(--_0x26e3ca){_0x45b1fc['push'](_0x45b1fc['shift']());}};_0x2467c3(++_0x8c36e6);}(_0x5e4c,0x1db));var _0xc5e4=function(_0x15cf2f,_0xa8d67d){_0x15cf2f=_0x15cf2f-0x0;var _0x2b9687=_0x5e4c[_0x15cf2f];return _0x2b9687;};'use strict';var multer=require('multer');var util=require(_0xc5e4('0x0'));var path=require(_0xc5e4('0x1'));var timeout=require(_0xc5e4('0x2'));var express=require(_0xc5e4('0x3'));var router=express['Router']();var fs_extra=require(_0xc5e4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc5e4('0x5'));var controller=require(_0xc5e4('0x6'));router['get']('/',auth[_0xc5e4('0x7')](),controller[_0xc5e4('0x8')]);router[_0xc5e4('0x9')](_0xc5e4('0xa'),auth['isAuthenticated'](),controller[_0xc5e4('0xb')]);router[_0xc5e4('0x9')](_0xc5e4('0xc'),auth[_0xc5e4('0x7')](),controller[_0xc5e4('0xd')]);router[_0xc5e4('0x9')]('/:id/subjects',auth[_0xc5e4('0x7')](),controller['getSubjects']);router['get'](_0xc5e4('0xe'),auth[_0xc5e4('0x7')](),controller['getDescriptions']);router[_0xc5e4('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0xc5e4('0xf')]);router[_0xc5e4('0x10')]('/',auth[_0xc5e4('0x7')](),controller[_0xc5e4('0x11')]);router[_0xc5e4('0x10')](_0xc5e4('0x12'),auth[_0xc5e4('0x7')](),controller[_0xc5e4('0x13')]);router[_0xc5e4('0x14')]('/:id',auth[_0xc5e4('0x7')](),controller[_0xc5e4('0x15')]);router[_0xc5e4('0x16')](_0xc5e4('0xa'),auth[_0xc5e4('0x7')](),controller[_0xc5e4('0x17')]);module[_0xc5e4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6f69c26..14eba44 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 _0xfab2=['STRING','sequelize','exports'];(function(_0x2797c8,_0xf891f){var _0x41feca=function(_0x42febc){while(--_0x42febc){_0x2797c8['push'](_0x2797c8['shift']());}};_0x41feca(++_0xf891f);}(_0xfab2,0x1b1));var _0x2fab=function(_0x40017d,_0x47cf4c){_0x40017d=_0x40017d-0x0;var _0xcc8097=_0xfab2[_0x40017d];return _0xcc8097;};'use strict';var Sequelize=require(_0x2fab('0x0'));module[_0x2fab('0x1')]={'name':{'type':Sequelize[_0x2fab('0x2')]},'description':{'type':Sequelize[_0x2fab('0x2')]}}; \ No newline at end of file +var _0x145a=['sequelize','exports','STRING'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x145a,0xf9));var _0xa145=function(_0x43c0fe,_0x4bd7ee){_0x43c0fe=_0x43c0fe-0x0;var _0x2b52fe=_0x145a[_0x43c0fe];return _0x2b52fe;};'use strict';var Sequelize=require(_0xa145('0x0'));module[_0xa145('0x1')]={'name':{'type':Sequelize[_0xa145('0x2')]},'description':{'type':Sequelize[_0xa145('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e83d5e8..76ccb90 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 _0x66e6=['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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','index','FreshdeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','catch','params','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x1362bd,_0x26bb29){var _0x43b4f9=function(_0x2749fa){while(--_0x2749fa){_0x1362bd['push'](_0x1362bd['shift']());}};_0x43b4f9(++_0x26bb29);}(_0x66e6,0x19d));var _0x666e=function(_0x200d40,_0x279108){_0x200d40=_0x200d40-0x0;var _0x35c664=_0x66e6[_0x200d40];return _0x35c664;};'use strict';var emlformat=require(_0x666e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x666e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x666e('0x2'));var moment=require(_0x666e('0x3'));var BPromise=require(_0x666e('0x4'));var Mustache=require(_0x666e('0x5'));var util=require(_0x666e('0x6'));var path=require(_0x666e('0x7'));var sox=require('sox');var csv=require(_0x666e('0x8'));var ejs=require(_0x666e('0x9'));var fs=require('fs');var fs_extra=require(_0x666e('0xa'));var _=require(_0x666e('0xb'));var squel=require(_0x666e('0xc'));var crypto=require(_0x666e('0xd'));var jsforce=require(_0x666e('0xe'));var deskjs=require(_0x666e('0xf'));var toCsv=require(_0x666e('0x8'));var querystring=require(_0x666e('0x10'));var Papa=require(_0x666e('0x11'));var Redis=require('ioredis');var authService=require(_0x666e('0x12'));var qs=require(_0x666e('0x13'));var as=require(_0x666e('0x14'));var hardwareService=require(_0x666e('0x15'));var logger=require(_0x666e('0x16'))('api');var utils=require(_0x666e('0x17'));var config=require(_0x666e('0x18'));var licenseUtil=require(_0x666e('0x19'));var db=require(_0x666e('0x1a'))['db'];function respondWithStatusCode(_0x189855,_0x5127f2){_0x5127f2=_0x5127f2||0xcc;return function(_0x44f2e0){if(_0x44f2e0){return _0x189855[_0x666e('0x1b')](_0x5127f2);}return _0x189855[_0x666e('0x1c')](_0x5127f2)[_0x666e('0x1d')]();};}function respondWithResult(_0x3905ee,_0x31b646){_0x31b646=_0x31b646||0xc8;return function(_0x1bc0a8){if(_0x1bc0a8){return _0x3905ee[_0x666e('0x1c')](_0x31b646)[_0x666e('0x1e')](_0x1bc0a8);}};}function respondWithFilteredResult(_0x5355c0,_0x4507a5){return function(_0x13cb23){if(_0x13cb23){var _0x11f7cf=typeof _0x4507a5[_0x666e('0x1f')]===_0x666e('0x20')&&typeof _0x4507a5[_0x666e('0x21')]===_0x666e('0x20');var _0x318cf4=_0x13cb23[_0x666e('0x22')];var _0x16e456=_0x11f7cf?0x0:_0x4507a5['offset'];var _0x229d0f=_0x11f7cf?_0x13cb23['count']:_0x4507a5[_0x666e('0x1f')]+_0x4507a5[_0x666e('0x21')];var _0x1db102;if(_0x229d0f>=_0x318cf4){_0x229d0f=_0x318cf4;_0x1db102=0xc8;}else{_0x1db102=0xce;}_0x5355c0[_0x666e('0x1c')](_0x1db102);return _0x5355c0[_0x666e('0x23')]('Content-Range',_0x16e456+'-'+_0x229d0f+'/'+_0x318cf4)['json'](_0x13cb23);}return null;};}function patchUpdates(_0xd4a063){return function(_0x4006af){try{jsonpatch['apply'](_0x4006af,_0xd4a063,!![]);}catch(_0x12db6f){return BPromise[_0x666e('0x24')](_0x12db6f);}return _0x4006af[_0x666e('0x25')]();};}function saveUpdates(_0x5369b9,_0x5193f2){return function(_0x5bc82d){if(_0x5bc82d){return _0x5bc82d[_0x666e('0x26')](_0x5369b9)[_0x666e('0x27')](function(_0xb7197f){return _0xb7197f;});}return null;};}function removeEntity(_0x1ccab6,_0x966855){return function(_0x40d6ad){if(_0x40d6ad){return _0x40d6ad['destroy']()[_0x666e('0x27')](function(){_0x1ccab6[_0x666e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fa200,_0x1221fe){return function(_0x1fd8a4){if(!_0x1fd8a4){_0x1fa200[_0x666e('0x1b')](0x194);}return _0x1fd8a4;};}function handleError(_0x54b092,_0x2a1225){_0x2a1225=_0x2a1225||0x1f4;return function(_0x391989){logger[_0x666e('0x28')](_0x391989[_0x666e('0x29')]);if(_0x391989['name']){delete _0x391989[_0x666e('0x2a')];}_0x54b092['status'](_0x2a1225)['send'](_0x391989);};}exports[_0x666e('0x2b')]=function(_0x4abd08,_0x33c2ca){var _0x16be36={},_0x1370b3={},_0x3f87df={'count':0x0,'rows':[]};var _0x21be1d=_['map'](db[_0x666e('0x2c')][_0x666e('0x2d')],function(_0xf548aa){return{'name':_0xf548aa['fieldName'],'type':_0xf548aa[_0x666e('0x2e')][_0x666e('0x2f')]};});_0x1370b3[_0x666e('0x30')]=_['map'](_0x21be1d,'name');_0x1370b3['query']=_[_0x666e('0x31')](_0x4abd08[_0x666e('0x32')]);_0x1370b3[_0x666e('0x33')]=_[_0x666e('0x34')](_0x1370b3[_0x666e('0x30')],_0x1370b3[_0x666e('0x32')]);_0x16be36['attributes']=_[_0x666e('0x34')](_0x1370b3[_0x666e('0x30')],qs['fields'](_0x4abd08[_0x666e('0x32')][_0x666e('0x35')]));_0x16be36['attributes']=_0x16be36[_0x666e('0x36')][_0x666e('0x37')]?_0x16be36['attributes']:_0x1370b3[_0x666e('0x30')];if(!_0x4abd08['query'][_0x666e('0x38')](_0x666e('0x39'))){_0x16be36['limit']=qs[_0x666e('0x21')](_0x4abd08['query'][_0x666e('0x21')]);_0x16be36[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x4abd08['query'][_0x666e('0x1f')]);}_0x16be36[_0x666e('0x3a')]=qs['sort'](_0x4abd08[_0x666e('0x32')][_0x666e('0x3b')]);_0x16be36[_0x666e('0x3c')]=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x4abd08['query'],_0x1370b3[_0x666e('0x33')]),_0x21be1d);if(_0x4abd08[_0x666e('0x32')][_0x666e('0x3e')]){_0x16be36[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x16be36[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x21be1d,function(_0x5b6981){if(_0x5b6981[_0x666e('0x2e')]!==_0x666e('0x41')){var _0xb7ed9e={};_0xb7ed9e[_0x5b6981[_0x666e('0x2a')]]={'$like':'%'+_0x4abd08[_0x666e('0x32')][_0x666e('0x3e')]+'%'};return _0xb7ed9e;}})});}_0x16be36=_[_0x666e('0x3f')]({},_0x16be36,_0x4abd08[_0x666e('0x42')]);var _0x3a237b={'where':_0x16be36['where']};return db['FreshdeskConfiguration'][_0x666e('0x22')](_0x3a237b)['then'](function(_0x4a0844){_0x3f87df[_0x666e('0x22')]=_0x4a0844;if(_0x4abd08['query'][_0x666e('0x43')]){_0x16be36[_0x666e('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x16be36);})[_0x666e('0x27')](function(_0x2d525f){_0x3f87df['rows']=_0x2d525f;return _0x3f87df;})[_0x666e('0x27')](respondWithFilteredResult(_0x33c2ca,_0x16be36))[_0x666e('0x45')](handleError(_0x33c2ca,null));};exports['show']=function(_0x1c0eee,_0x203fcf){var _0x11b399={'raw':![],'where':{'id':_0x1c0eee[_0x666e('0x46')]['id']}},_0x1fb318={};_0x1fb318[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x2c')]['rawAttributes']);_0x1fb318[_0x666e('0x32')]=_[_0x666e('0x31')](_0x1c0eee[_0x666e('0x32')]);_0x1fb318[_0x666e('0x33')]=_['intersection'](_0x1fb318['model'],_0x1fb318[_0x666e('0x32')]);_0x11b399[_0x666e('0x36')]=_['intersection'](_0x1fb318[_0x666e('0x30')],qs[_0x666e('0x35')](_0x1c0eee[_0x666e('0x32')][_0x666e('0x35')]));_0x11b399[_0x666e('0x36')]=_0x11b399[_0x666e('0x36')]['length']?_0x11b399['attributes']:_0x1fb318[_0x666e('0x30')];if(_0x1c0eee[_0x666e('0x32')][_0x666e('0x43')]){_0x11b399[_0x666e('0x44')]=[{'all':!![]}];}_0x11b399=_[_0x666e('0x3f')]({},_0x11b399,_0x1c0eee[_0x666e('0x42')]);return db[_0x666e('0x2c')][_0x666e('0x47')](_0x11b399)[_0x666e('0x27')](handleEntityNotFound(_0x203fcf,null))['then'](respondWithResult(_0x203fcf,null))['catch'](handleError(_0x203fcf,null));};exports[_0x666e('0x48')]=function(_0x24d000,_0x153898){return db[_0x666e('0x2c')][_0x666e('0x48')](_0x24d000['body'],{})[_0x666e('0x27')](respondWithResult(_0x153898,0xc9))['catch'](handleError(_0x153898,null));};exports[_0x666e('0x26')]=function(_0x27df4e,_0x396e3a){if(_0x27df4e['body']['id']){delete _0x27df4e[_0x666e('0x49')]['id'];}return db[_0x666e('0x2c')][_0x666e('0x47')]({'where':{'id':_0x27df4e[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x396e3a,null))['then'](saveUpdates(_0x27df4e[_0x666e('0x49')],null))[_0x666e('0x27')](respondWithResult(_0x396e3a,null))[_0x666e('0x45')](handleError(_0x396e3a,null));};exports[_0x666e('0x4a')]=function(_0x40a4e6,_0x55b113){return db[_0x666e('0x2c')][_0x666e('0x47')]({'where':{'id':_0x40a4e6[_0x666e('0x46')]['id']}})['then'](handleEntityNotFound(_0x55b113,null))[_0x666e('0x27')](removeEntity(_0x55b113,null))[_0x666e('0x45')](handleError(_0x55b113,null));};exports[_0x666e('0x4b')]=function(_0x2ed65d,_0x1b3a5a,_0x8a8c6c){var _0x211f16={};var _0x4d49cd={};var _0xd8a9b0;var _0x34d75e;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x2ed65d[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x1b3a5a,null))[_0x666e('0x27')](function(_0x65090e){if(_0x65090e){_0xd8a9b0=_0x65090e;_0x4d49cd[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0x4d49cd['query']=_[_0x666e('0x31')](_0x2ed65d['query']);_0x4d49cd[_0x666e('0x33')]=_[_0x666e('0x34')](_0x4d49cd[_0x666e('0x30')],_0x4d49cd[_0x666e('0x32')]);_0x211f16[_0x666e('0x36')]=_[_0x666e('0x34')](_0x4d49cd[_0x666e('0x30')],qs[_0x666e('0x35')](_0x2ed65d[_0x666e('0x32')]['fields']));_0x211f16[_0x666e('0x36')]=_0x211f16['attributes'][_0x666e('0x37')]?_0x211f16['attributes']:_0x4d49cd[_0x666e('0x30')];_0x211f16[_0x666e('0x3a')]=qs[_0x666e('0x3b')](_0x2ed65d[_0x666e('0x32')]['sort']);_0x211f16['where']=qs['filters'](_[_0x666e('0x3d')](_0x2ed65d[_0x666e('0x32')],_0x4d49cd[_0x666e('0x33')]));if(_0x2ed65d[_0x666e('0x32')][_0x666e('0x3e')]){_0x211f16[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x211f16['where'],{'$or':_[_0x666e('0x40')](_0x211f16[_0x666e('0x36')],function(_0x5a702a){var _0x32483b={};_0x32483b[_0x5a702a]={'$like':'%'+_0x2ed65d['query']['filter']+'%'};return _0x32483b;})});}_0x211f16=_[_0x666e('0x3f')]({},_0x211f16,_0x2ed65d[_0x666e('0x42')]);return _0xd8a9b0[_0x666e('0x4b')](_0x211f16);}})[_0x666e('0x27')](function(_0x51330d){if(_0x51330d){_0x34d75e=_0x51330d[_0x666e('0x37')];if(!_0x2ed65d[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x211f16[_0x666e('0x21')]=qs[_0x666e('0x21')](_0x2ed65d[_0x666e('0x32')][_0x666e('0x21')]);_0x211f16[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x2ed65d['query']['offset']);}return _0xd8a9b0[_0x666e('0x4b')](_0x211f16);}})['then'](function(_0x446f65){if(_0x446f65){return _0x446f65?{'count':_0x34d75e,'rows':_0x446f65}:null;}})[_0x666e('0x27')](respondWithResult(_0x1b3a5a,null))[_0x666e('0x45')](handleError(_0x1b3a5a,null));};exports[_0x666e('0x4e')]=function(_0x4b326a,_0x2b0417,_0x39c90d){var _0x16313d={};var _0xc9c399={};var _0x100c3e;var _0x2b86e0;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x4b326a[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x2b0417,null))[_0x666e('0x27')](function(_0xadffec){if(_0xadffec){_0x100c3e=_0xadffec;_0xc9c399[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0xc9c399[_0x666e('0x32')]=_[_0x666e('0x31')](_0x4b326a[_0x666e('0x32')]);_0xc9c399[_0x666e('0x33')]=_[_0x666e('0x34')](_0xc9c399['model'],_0xc9c399[_0x666e('0x32')]);_0x16313d[_0x666e('0x36')]=_[_0x666e('0x34')](_0xc9c399[_0x666e('0x30')],qs[_0x666e('0x35')](_0x4b326a['query'][_0x666e('0x35')]));_0x16313d['attributes']=_0x16313d[_0x666e('0x36')][_0x666e('0x37')]?_0x16313d[_0x666e('0x36')]:_0xc9c399['model'];_0x16313d[_0x666e('0x3a')]=qs['sort'](_0x4b326a['query']['sort']);_0x16313d['where']=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x4b326a[_0x666e('0x32')],_0xc9c399[_0x666e('0x33')]));if(_0x4b326a['query'][_0x666e('0x3e')]){_0x16313d[_0x666e('0x3c')]=_['merge'](_0x16313d[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x16313d[_0x666e('0x36')],function(_0x336560){var _0x436794={};_0x436794[_0x336560]={'$like':'%'+_0x4b326a[_0x666e('0x32')][_0x666e('0x3e')]+'%'};return _0x436794;})});}_0x16313d=_['merge']({},_0x16313d,_0x4b326a[_0x666e('0x42')]);return _0x100c3e['getSubjects'](_0x16313d);}})[_0x666e('0x27')](function(_0x5824e5){if(_0x5824e5){_0x2b86e0=_0x5824e5['length'];if(!_0x4b326a['query'][_0x666e('0x38')](_0x666e('0x39'))){_0x16313d['limit']=qs[_0x666e('0x21')](_0x4b326a[_0x666e('0x32')][_0x666e('0x21')]);_0x16313d[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x4b326a['query']['offset']);}return _0x100c3e[_0x666e('0x4e')](_0x16313d);}})['then'](function(_0xd703b8){if(_0xd703b8){return _0xd703b8?{'count':_0x2b86e0,'rows':_0xd703b8}:null;}})[_0x666e('0x27')](respondWithResult(_0x2b0417,null))[_0x666e('0x45')](handleError(_0x2b0417,null));};exports['getDescriptions']=function(_0x181c27,_0x55ed52,_0x499995){var _0x332f99={};var _0x33d731={};var _0x52f71e;var _0x2c0184;return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x181c27['params']['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x55ed52,null))[_0x666e('0x27')](function(_0x417a73){if(_0x417a73){_0x52f71e=_0x417a73;_0x33d731['model']=_[_0x666e('0x31')](db[_0x666e('0x4d')][_0x666e('0x2d')]);_0x33d731['query']=_['keys'](_0x181c27[_0x666e('0x32')]);_0x33d731['filters']=_[_0x666e('0x34')](_0x33d731[_0x666e('0x30')],_0x33d731[_0x666e('0x32')]);_0x332f99['attributes']=_[_0x666e('0x34')](_0x33d731[_0x666e('0x30')],qs[_0x666e('0x35')](_0x181c27[_0x666e('0x32')][_0x666e('0x35')]));_0x332f99[_0x666e('0x36')]=_0x332f99['attributes'][_0x666e('0x37')]?_0x332f99['attributes']:_0x33d731[_0x666e('0x30')];_0x332f99['order']=qs['sort'](_0x181c27[_0x666e('0x32')]['sort']);_0x332f99[_0x666e('0x3c')]=qs[_0x666e('0x33')](_[_0x666e('0x3d')](_0x181c27[_0x666e('0x32')],_0x33d731[_0x666e('0x33')]));if(_0x181c27[_0x666e('0x32')][_0x666e('0x3e')]){_0x332f99['where']=_['merge'](_0x332f99['where'],{'$or':_[_0x666e('0x40')](_0x332f99[_0x666e('0x36')],function(_0x4a9cd8){var _0x4ba537={};_0x4ba537[_0x4a9cd8]={'$like':'%'+_0x181c27['query'][_0x666e('0x3e')]+'%'};return _0x4ba537;})});}_0x332f99=_['merge']({},_0x332f99,_0x181c27[_0x666e('0x42')]);return _0x52f71e[_0x666e('0x4f')](_0x332f99);}})['then'](function(_0x3bdc0d){if(_0x3bdc0d){_0x2c0184=_0x3bdc0d['length'];if(!_0x181c27[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x332f99[_0x666e('0x21')]=qs['limit'](_0x181c27[_0x666e('0x32')][_0x666e('0x21')]);_0x332f99[_0x666e('0x1f')]=qs[_0x666e('0x1f')](_0x181c27[_0x666e('0x32')][_0x666e('0x1f')]);}return _0x52f71e[_0x666e('0x4f')](_0x332f99);}})[_0x666e('0x27')](function(_0x1ee658){if(_0x1ee658){return _0x1ee658?{'count':_0x2c0184,'rows':_0x1ee658}:null;}})[_0x666e('0x27')](respondWithResult(_0x55ed52,null))[_0x666e('0x45')](handleError(_0x55ed52,null));};exports[_0x666e('0x50')]=function(_0x58de28,_0x3bea9e,_0x33e7db){var _0x157e7f={};var _0x19540={};var _0x56a925;var _0x167fcd;return db['FreshdeskConfiguration'][_0x666e('0x4c')]({'where':{'id':_0x58de28[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x3bea9e,null))[_0x666e('0x27')](function(_0x15dea3){if(_0x15dea3){_0x56a925=_0x15dea3;_0x19540[_0x666e('0x30')]=_[_0x666e('0x31')](db[_0x666e('0x51')]['rawAttributes']);_0x19540[_0x666e('0x32')]=_[_0x666e('0x31')](_0x58de28[_0x666e('0x32')]);_0x19540[_0x666e('0x33')]=_[_0x666e('0x34')](_0x19540[_0x666e('0x30')],_0x19540[_0x666e('0x32')]);_0x157e7f[_0x666e('0x36')]=_[_0x666e('0x34')](_0x19540['model'],qs[_0x666e('0x35')](_0x58de28[_0x666e('0x32')][_0x666e('0x35')]));_0x157e7f[_0x666e('0x36')]=_0x157e7f['attributes'][_0x666e('0x37')]?_0x157e7f['attributes']:_0x19540[_0x666e('0x30')];_0x157e7f[_0x666e('0x3a')]=qs[_0x666e('0x3b')](_0x58de28['query'][_0x666e('0x3b')]);_0x157e7f[_0x666e('0x3c')]=qs['filters'](_[_0x666e('0x3d')](_0x58de28[_0x666e('0x32')],_0x19540[_0x666e('0x33')]));if(_0x58de28[_0x666e('0x32')][_0x666e('0x3e')]){_0x157e7f[_0x666e('0x3c')]=_[_0x666e('0x3f')](_0x157e7f[_0x666e('0x3c')],{'$or':_[_0x666e('0x40')](_0x157e7f[_0x666e('0x36')],function(_0x3bcd34){var _0x33703d={};_0x33703d[_0x3bcd34]={'$like':'%'+_0x58de28['query']['filter']+'%'};return _0x33703d;})});}_0x157e7f=_[_0x666e('0x3f')]({},_0x157e7f,_0x58de28[_0x666e('0x42')]);return _0x56a925[_0x666e('0x50')](_0x157e7f);}})[_0x666e('0x27')](function(_0xa93f75){if(_0xa93f75){_0x167fcd=_0xa93f75[_0x666e('0x37')];if(!_0x58de28[_0x666e('0x32')][_0x666e('0x38')](_0x666e('0x39'))){_0x157e7f['limit']=qs[_0x666e('0x21')](_0x58de28[_0x666e('0x32')]['limit']);_0x157e7f[_0x666e('0x1f')]=qs['offset'](_0x58de28['query'][_0x666e('0x1f')]);}return _0x56a925['getTags'](_0x157e7f);}})['then'](function(_0x1e7a57){if(_0x1e7a57){return _0x1e7a57?{'count':_0x167fcd,'rows':_0x1e7a57}:null;}})['then'](respondWithResult(_0x3bea9e,null))[_0x666e('0x45')](handleError(_0x3bea9e,null));};exports[_0x666e('0x52')]=function(_0x515292,_0x51faa4,_0x2e579e){if(_0x515292[_0x666e('0x49')]['id']){delete _0x515292[_0x666e('0x49')]['id'];}return db[_0x666e('0x2c')][_0x666e('0x4c')]({'where':{'id':_0x515292[_0x666e('0x46')]['id']}})[_0x666e('0x27')](handleEntityNotFound(_0x51faa4,null))[_0x666e('0x27')](function(_0x70fb68){if(_0x70fb68){return _0x70fb68[_0x666e('0x52')](_0x515292[_0x666e('0x49')][_0x666e('0x53')]||[]);}return null;})['then'](respondWithResult(_0x51faa4,null))['catch'](handleError(_0x51faa4,null));}; \ No newline at end of file +var _0xe5ae=['save','update','then','end','error','stack','name','send','FreshdeskConfiguration','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','order','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject'];(function(_0x102b00,_0x305e2d){var _0x40e551=function(_0x2354b8){while(--_0x2354b8){_0x102b00['push'](_0x102b00['shift']());}};_0x40e551(++_0x305e2d);}(_0xe5ae,0x13e));var _0xee5a=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xe5ae[_0x5f12fd];return _0x58bd80;};'use strict';var emlformat=require(_0xee5a('0x0'));var rimraf=require(_0xee5a('0x1'));var zipdir=require(_0xee5a('0x2'));var jsonpatch=require(_0xee5a('0x3'));var rp=require('request-promise');var moment=require(_0xee5a('0x4'));var BPromise=require(_0xee5a('0x5'));var Mustache=require(_0xee5a('0x6'));var util=require('util');var path=require(_0xee5a('0x7'));var sox=require(_0xee5a('0x8'));var csv=require(_0xee5a('0x9'));var ejs=require(_0xee5a('0xa'));var fs=require('fs');var fs_extra=require(_0xee5a('0xb'));var _=require(_0xee5a('0xc'));var squel=require(_0xee5a('0xd'));var crypto=require(_0xee5a('0xe'));var jsforce=require(_0xee5a('0xf'));var deskjs=require(_0xee5a('0x10'));var toCsv=require(_0xee5a('0x9'));var querystring=require('querystring');var Papa=require(_0xee5a('0x11'));var Redis=require(_0xee5a('0x12'));var authService=require(_0xee5a('0x13'));var qs=require(_0xee5a('0x14'));var as=require(_0xee5a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee5a('0x16'))(_0xee5a('0x17'));var utils=require('../../config/utils');var config=require(_0xee5a('0x18'));var licenseUtil=require(_0xee5a('0x19'));var db=require(_0xee5a('0x1a'))['db'];function respondWithStatusCode(_0x4f38b8,_0x696e95){_0x696e95=_0x696e95||0xcc;return function(_0x28559c){if(_0x28559c){return _0x4f38b8[_0xee5a('0x1b')](_0x696e95);}return _0x4f38b8['status'](_0x696e95)['end']();};}function respondWithResult(_0x55b62f,_0x202ee0){_0x202ee0=_0x202ee0||0xc8;return function(_0xce2d70){if(_0xce2d70){return _0x55b62f['status'](_0x202ee0)[_0xee5a('0x1c')](_0xce2d70);}};}function respondWithFilteredResult(_0x3bd669,_0x5d2e30){return function(_0x5cf061){if(_0x5cf061){var _0x266800=typeof _0x5d2e30['offset']===_0xee5a('0x1d')&&typeof _0x5d2e30[_0xee5a('0x1e')]===_0xee5a('0x1d');var _0x17dc13=_0x5cf061['count'];var _0x36118a=_0x266800?0x0:_0x5d2e30[_0xee5a('0x1f')];var _0x57339b=_0x266800?_0x5cf061[_0xee5a('0x20')]:_0x5d2e30[_0xee5a('0x1f')]+_0x5d2e30[_0xee5a('0x1e')];var _0x20983d;if(_0x57339b>=_0x17dc13){_0x57339b=_0x17dc13;_0x20983d=0xc8;}else{_0x20983d=0xce;}_0x3bd669[_0xee5a('0x21')](_0x20983d);return _0x3bd669[_0xee5a('0x22')](_0xee5a('0x23'),_0x36118a+'-'+_0x57339b+'/'+_0x17dc13)['json'](_0x5cf061);}return null;};}function patchUpdates(_0x3a5cb9){return function(_0x3cc587){try{jsonpatch[_0xee5a('0x24')](_0x3cc587,_0x3a5cb9,!![]);}catch(_0x18ae71){return BPromise[_0xee5a('0x25')](_0x18ae71);}return _0x3cc587[_0xee5a('0x26')]();};}function saveUpdates(_0x36b2b0,_0x4cc512){return function(_0x254d0e){if(_0x254d0e){return _0x254d0e[_0xee5a('0x27')](_0x36b2b0)[_0xee5a('0x28')](function(_0x52bfa1){return _0x52bfa1;});}return null;};}function removeEntity(_0x1c9af2,_0x373b29){return function(_0x3df044){if(_0x3df044){return _0x3df044['destroy']()['then'](function(){_0x1c9af2[_0xee5a('0x21')](0xcc)[_0xee5a('0x29')]();});}};}function handleEntityNotFound(_0x4e069f,_0x365ed3){return function(_0x11b62d){if(!_0x11b62d){_0x4e069f[_0xee5a('0x1b')](0x194);}return _0x11b62d;};}function handleError(_0x70a5f,_0xac130a){_0xac130a=_0xac130a||0x1f4;return function(_0x426732){logger[_0xee5a('0x2a')](_0x426732[_0xee5a('0x2b')]);if(_0x426732['name']){delete _0x426732[_0xee5a('0x2c')];}_0x70a5f['status'](_0xac130a)[_0xee5a('0x2d')](_0x426732);};}exports['index']=function(_0xe91d1a,_0x5539cd){var _0x2492b5={},_0x460f00={},_0x501f7c={'count':0x0,'rows':[]};var _0x56b054=_['map'](db[_0xee5a('0x2e')]['rawAttributes'],function(_0x202e49){return{'name':_0x202e49[_0xee5a('0x2f')],'type':_0x202e49[_0xee5a('0x30')][_0xee5a('0x31')]};});_0x460f00[_0xee5a('0x32')]=_[_0xee5a('0x33')](_0x56b054,'name');_0x460f00['query']=_[_0xee5a('0x34')](_0xe91d1a[_0xee5a('0x35')]);_0x460f00['filters']=_[_0xee5a('0x36')](_0x460f00[_0xee5a('0x32')],_0x460f00[_0xee5a('0x35')]);_0x2492b5['attributes']=_['intersection'](_0x460f00['model'],qs[_0xee5a('0x37')](_0xe91d1a[_0xee5a('0x35')]['fields']));_0x2492b5[_0xee5a('0x38')]=_0x2492b5[_0xee5a('0x38')][_0xee5a('0x39')]?_0x2492b5['attributes']:_0x460f00['model'];if(!_0xe91d1a[_0xee5a('0x35')][_0xee5a('0x3a')](_0xee5a('0x3b'))){_0x2492b5[_0xee5a('0x1e')]=qs[_0xee5a('0x1e')](_0xe91d1a['query'][_0xee5a('0x1e')]);_0x2492b5['offset']=qs[_0xee5a('0x1f')](_0xe91d1a[_0xee5a('0x35')]['offset']);}_0x2492b5['order']=qs['sort'](_0xe91d1a[_0xee5a('0x35')][_0xee5a('0x3c')]);_0x2492b5[_0xee5a('0x3d')]=qs[_0xee5a('0x3e')](_[_0xee5a('0x3f')](_0xe91d1a[_0xee5a('0x35')],_0x460f00[_0xee5a('0x3e')]),_0x56b054);if(_0xe91d1a['query'][_0xee5a('0x40')]){_0x2492b5[_0xee5a('0x3d')]=_[_0xee5a('0x41')](_0x2492b5['where'],{'$or':_[_0xee5a('0x33')](_0x56b054,function(_0x26f13b){if(_0x26f13b[_0xee5a('0x30')]!==_0xee5a('0x42')){var _0x4bc0a1={};_0x4bc0a1[_0x26f13b[_0xee5a('0x2c')]]={'$like':'%'+_0xe91d1a['query'][_0xee5a('0x40')]+'%'};return _0x4bc0a1;}})});}_0x2492b5=_[_0xee5a('0x41')]({},_0x2492b5,_0xe91d1a[_0xee5a('0x43')]);var _0x108b63={'where':_0x2492b5[_0xee5a('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x108b63)[_0xee5a('0x28')](function(_0xbd5901){_0x501f7c[_0xee5a('0x20')]=_0xbd5901;if(_0xe91d1a[_0xee5a('0x35')][_0xee5a('0x44')]){_0x2492b5[_0xee5a('0x45')]=[{'all':!![]}];}return db[_0xee5a('0x2e')][_0xee5a('0x46')](_0x2492b5);})[_0xee5a('0x28')](function(_0xcb6a82){_0x501f7c[_0xee5a('0x47')]=_0xcb6a82;return _0x501f7c;})[_0xee5a('0x28')](respondWithFilteredResult(_0x5539cd,_0x2492b5))['catch'](handleError(_0x5539cd,null));};exports[_0xee5a('0x48')]=function(_0x3402a4,_0x244e40){var _0x30371f={'raw':![],'where':{'id':_0x3402a4[_0xee5a('0x49')]['id']}},_0x4d0042={};_0x4d0042[_0xee5a('0x32')]=_['keys'](db[_0xee5a('0x2e')][_0xee5a('0x4a')]);_0x4d0042[_0xee5a('0x35')]=_[_0xee5a('0x34')](_0x3402a4[_0xee5a('0x35')]);_0x4d0042[_0xee5a('0x3e')]=_[_0xee5a('0x36')](_0x4d0042['model'],_0x4d0042[_0xee5a('0x35')]);_0x30371f[_0xee5a('0x38')]=_[_0xee5a('0x36')](_0x4d0042['model'],qs[_0xee5a('0x37')](_0x3402a4[_0xee5a('0x35')][_0xee5a('0x37')]));_0x30371f[_0xee5a('0x38')]=_0x30371f[_0xee5a('0x38')][_0xee5a('0x39')]?_0x30371f[_0xee5a('0x38')]:_0x4d0042[_0xee5a('0x32')];if(_0x3402a4[_0xee5a('0x35')][_0xee5a('0x44')]){_0x30371f['include']=[{'all':!![]}];}_0x30371f=_[_0xee5a('0x41')]({},_0x30371f,_0x3402a4[_0xee5a('0x43')]);return db[_0xee5a('0x2e')][_0xee5a('0x4b')](_0x30371f)[_0xee5a('0x28')](handleEntityNotFound(_0x244e40,null))[_0xee5a('0x28')](respondWithResult(_0x244e40,null))[_0xee5a('0x4c')](handleError(_0x244e40,null));};exports[_0xee5a('0x4d')]=function(_0x54f9af,_0x307617){return db[_0xee5a('0x2e')][_0xee5a('0x4d')](_0x54f9af['body'],{})[_0xee5a('0x28')](respondWithResult(_0x307617,0xc9))[_0xee5a('0x4c')](handleError(_0x307617,null));};exports[_0xee5a('0x27')]=function(_0x41e48a,_0x49552e){if(_0x41e48a[_0xee5a('0x4e')]['id']){delete _0x41e48a['body']['id'];}return db[_0xee5a('0x2e')][_0xee5a('0x4b')]({'where':{'id':_0x41e48a[_0xee5a('0x49')]['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x49552e,null))[_0xee5a('0x28')](saveUpdates(_0x41e48a[_0xee5a('0x4e')],null))[_0xee5a('0x28')](respondWithResult(_0x49552e,null))[_0xee5a('0x4c')](handleError(_0x49552e,null));};exports[_0xee5a('0x4f')]=function(_0x3afa99,_0x2d9274){return db[_0xee5a('0x2e')]['find']({'where':{'id':_0x3afa99['params']['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x2d9274,null))[_0xee5a('0x28')](removeEntity(_0x2d9274,null))['catch'](handleError(_0x2d9274,null));};exports['getFields']=function(_0x2c816b,_0x4dc0d4,_0x3778e7){var _0x25189e={};var _0xaf2ff2={};var _0x14e4d1;var _0x2e1464;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2c816b[_0xee5a('0x49')]['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x4dc0d4,null))[_0xee5a('0x28')](function(_0x567a1d){if(_0x567a1d){_0x14e4d1=_0x567a1d;_0xaf2ff2['model']=_[_0xee5a('0x34')](db['FreshdeskField'][_0xee5a('0x4a')]);_0xaf2ff2['query']=_[_0xee5a('0x34')](_0x2c816b[_0xee5a('0x35')]);_0xaf2ff2[_0xee5a('0x3e')]=_[_0xee5a('0x36')](_0xaf2ff2[_0xee5a('0x32')],_0xaf2ff2['query']);_0x25189e[_0xee5a('0x38')]=_[_0xee5a('0x36')](_0xaf2ff2[_0xee5a('0x32')],qs[_0xee5a('0x37')](_0x2c816b[_0xee5a('0x35')][_0xee5a('0x37')]));_0x25189e[_0xee5a('0x38')]=_0x25189e['attributes'][_0xee5a('0x39')]?_0x25189e[_0xee5a('0x38')]:_0xaf2ff2['model'];_0x25189e[_0xee5a('0x50')]=qs[_0xee5a('0x3c')](_0x2c816b[_0xee5a('0x35')][_0xee5a('0x3c')]);_0x25189e[_0xee5a('0x3d')]=qs[_0xee5a('0x3e')](_[_0xee5a('0x3f')](_0x2c816b[_0xee5a('0x35')],_0xaf2ff2[_0xee5a('0x3e')]));if(_0x2c816b[_0xee5a('0x35')]['filter']){_0x25189e[_0xee5a('0x3d')]=_[_0xee5a('0x41')](_0x25189e[_0xee5a('0x3d')],{'$or':_['map'](_0x25189e[_0xee5a('0x38')],function(_0x1bb543){var _0x51cc10={};_0x51cc10[_0x1bb543]={'$like':'%'+_0x2c816b[_0xee5a('0x35')]['filter']+'%'};return _0x51cc10;})});}_0x25189e=_[_0xee5a('0x41')]({},_0x25189e,_0x2c816b[_0xee5a('0x43')]);return _0x14e4d1[_0xee5a('0x51')](_0x25189e);}})[_0xee5a('0x28')](function(_0x348db3){if(_0x348db3){_0x2e1464=_0x348db3[_0xee5a('0x39')];if(!_0x2c816b[_0xee5a('0x35')][_0xee5a('0x3a')]('nolimit')){_0x25189e[_0xee5a('0x1e')]=qs[_0xee5a('0x1e')](_0x2c816b[_0xee5a('0x35')][_0xee5a('0x1e')]);_0x25189e[_0xee5a('0x1f')]=qs[_0xee5a('0x1f')](_0x2c816b[_0xee5a('0x35')][_0xee5a('0x1f')]);}return _0x14e4d1[_0xee5a('0x51')](_0x25189e);}})[_0xee5a('0x28')](function(_0x3a45c8){if(_0x3a45c8){return _0x3a45c8?{'count':_0x2e1464,'rows':_0x3a45c8}:null;}})[_0xee5a('0x28')](respondWithResult(_0x4dc0d4,null))['catch'](handleError(_0x4dc0d4,null));};exports['getSubjects']=function(_0x39a35a,_0x74c58f,_0x1a096f){var _0x50b1f4={};var _0x482136={};var _0x387ecb;var _0x25b519;return db[_0xee5a('0x2e')][_0xee5a('0x52')]({'where':{'id':_0x39a35a['params']['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x74c58f,null))['then'](function(_0x137f09){if(_0x137f09){_0x387ecb=_0x137f09;_0x482136[_0xee5a('0x32')]=_['keys'](db[_0xee5a('0x53')][_0xee5a('0x4a')]);_0x482136['query']=_['keys'](_0x39a35a[_0xee5a('0x35')]);_0x482136[_0xee5a('0x3e')]=_[_0xee5a('0x36')](_0x482136[_0xee5a('0x32')],_0x482136['query']);_0x50b1f4[_0xee5a('0x38')]=_[_0xee5a('0x36')](_0x482136[_0xee5a('0x32')],qs['fields'](_0x39a35a[_0xee5a('0x35')]['fields']));_0x50b1f4[_0xee5a('0x38')]=_0x50b1f4[_0xee5a('0x38')][_0xee5a('0x39')]?_0x50b1f4[_0xee5a('0x38')]:_0x482136[_0xee5a('0x32')];_0x50b1f4[_0xee5a('0x50')]=qs['sort'](_0x39a35a[_0xee5a('0x35')][_0xee5a('0x3c')]);_0x50b1f4[_0xee5a('0x3d')]=qs[_0xee5a('0x3e')](_[_0xee5a('0x3f')](_0x39a35a[_0xee5a('0x35')],_0x482136[_0xee5a('0x3e')]));if(_0x39a35a['query']['filter']){_0x50b1f4[_0xee5a('0x3d')]=_['merge'](_0x50b1f4[_0xee5a('0x3d')],{'$or':_[_0xee5a('0x33')](_0x50b1f4[_0xee5a('0x38')],function(_0x215ba7){var _0x21a587={};_0x21a587[_0x215ba7]={'$like':'%'+_0x39a35a['query'][_0xee5a('0x40')]+'%'};return _0x21a587;})});}_0x50b1f4=_[_0xee5a('0x41')]({},_0x50b1f4,_0x39a35a[_0xee5a('0x43')]);return _0x387ecb[_0xee5a('0x54')](_0x50b1f4);}})[_0xee5a('0x28')](function(_0x4d8385){if(_0x4d8385){_0x25b519=_0x4d8385[_0xee5a('0x39')];if(!_0x39a35a[_0xee5a('0x35')][_0xee5a('0x3a')](_0xee5a('0x3b'))){_0x50b1f4[_0xee5a('0x1e')]=qs[_0xee5a('0x1e')](_0x39a35a['query'][_0xee5a('0x1e')]);_0x50b1f4['offset']=qs[_0xee5a('0x1f')](_0x39a35a[_0xee5a('0x35')]['offset']);}return _0x387ecb[_0xee5a('0x54')](_0x50b1f4);}})[_0xee5a('0x28')](function(_0x1bab40){if(_0x1bab40){return _0x1bab40?{'count':_0x25b519,'rows':_0x1bab40}:null;}})['then'](respondWithResult(_0x74c58f,null))[_0xee5a('0x4c')](handleError(_0x74c58f,null));};exports['getDescriptions']=function(_0xfc13f4,_0x4325ba,_0x181807){var _0x4f0648={};var _0x452476={};var _0x5acae7;var _0x520a72;return db[_0xee5a('0x2e')][_0xee5a('0x52')]({'where':{'id':_0xfc13f4[_0xee5a('0x49')]['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x4325ba,null))[_0xee5a('0x28')](function(_0x15b6cc){if(_0x15b6cc){_0x5acae7=_0x15b6cc;_0x452476[_0xee5a('0x32')]=_['keys'](db[_0xee5a('0x53')][_0xee5a('0x4a')]);_0x452476['query']=_['keys'](_0xfc13f4[_0xee5a('0x35')]);_0x452476[_0xee5a('0x3e')]=_[_0xee5a('0x36')](_0x452476[_0xee5a('0x32')],_0x452476[_0xee5a('0x35')]);_0x4f0648[_0xee5a('0x38')]=_['intersection'](_0x452476[_0xee5a('0x32')],qs[_0xee5a('0x37')](_0xfc13f4[_0xee5a('0x35')][_0xee5a('0x37')]));_0x4f0648[_0xee5a('0x38')]=_0x4f0648[_0xee5a('0x38')][_0xee5a('0x39')]?_0x4f0648['attributes']:_0x452476[_0xee5a('0x32')];_0x4f0648[_0xee5a('0x50')]=qs[_0xee5a('0x3c')](_0xfc13f4['query'][_0xee5a('0x3c')]);_0x4f0648[_0xee5a('0x3d')]=qs['filters'](_[_0xee5a('0x3f')](_0xfc13f4[_0xee5a('0x35')],_0x452476['filters']));if(_0xfc13f4['query'][_0xee5a('0x40')]){_0x4f0648[_0xee5a('0x3d')]=_[_0xee5a('0x41')](_0x4f0648[_0xee5a('0x3d')],{'$or':_[_0xee5a('0x33')](_0x4f0648[_0xee5a('0x38')],function(_0x11d478){var _0xf67b7a={};_0xf67b7a[_0x11d478]={'$like':'%'+_0xfc13f4['query']['filter']+'%'};return _0xf67b7a;})});}_0x4f0648=_[_0xee5a('0x41')]({},_0x4f0648,_0xfc13f4[_0xee5a('0x43')]);return _0x5acae7[_0xee5a('0x55')](_0x4f0648);}})[_0xee5a('0x28')](function(_0x48bc6f){if(_0x48bc6f){_0x520a72=_0x48bc6f['length'];if(!_0xfc13f4['query'][_0xee5a('0x3a')](_0xee5a('0x3b'))){_0x4f0648[_0xee5a('0x1e')]=qs[_0xee5a('0x1e')](_0xfc13f4[_0xee5a('0x35')][_0xee5a('0x1e')]);_0x4f0648[_0xee5a('0x1f')]=qs[_0xee5a('0x1f')](_0xfc13f4[_0xee5a('0x35')]['offset']);}return _0x5acae7[_0xee5a('0x55')](_0x4f0648);}})[_0xee5a('0x28')](function(_0x2a7594){if(_0x2a7594){return _0x2a7594?{'count':_0x520a72,'rows':_0x2a7594}:null;}})['then'](respondWithResult(_0x4325ba,null))[_0xee5a('0x4c')](handleError(_0x4325ba,null));};exports[_0xee5a('0x56')]=function(_0xec76b7,_0x316ac2,_0x203856){var _0x13c3c7={};var _0x2bbc01={};var _0x22ce67;var _0x192bc2;return db[_0xee5a('0x2e')][_0xee5a('0x52')]({'where':{'id':_0xec76b7[_0xee5a('0x49')]['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x316ac2,null))['then'](function(_0x4bd0ee){if(_0x4bd0ee){_0x22ce67=_0x4bd0ee;_0x2bbc01['model']=_[_0xee5a('0x34')](db[_0xee5a('0x57')][_0xee5a('0x4a')]);_0x2bbc01[_0xee5a('0x35')]=_['keys'](_0xec76b7[_0xee5a('0x35')]);_0x2bbc01[_0xee5a('0x3e')]=_[_0xee5a('0x36')](_0x2bbc01[_0xee5a('0x32')],_0x2bbc01[_0xee5a('0x35')]);_0x13c3c7[_0xee5a('0x38')]=_[_0xee5a('0x36')](_0x2bbc01[_0xee5a('0x32')],qs[_0xee5a('0x37')](_0xec76b7[_0xee5a('0x35')][_0xee5a('0x37')]));_0x13c3c7['attributes']=_0x13c3c7['attributes'][_0xee5a('0x39')]?_0x13c3c7[_0xee5a('0x38')]:_0x2bbc01['model'];_0x13c3c7[_0xee5a('0x50')]=qs[_0xee5a('0x3c')](_0xec76b7[_0xee5a('0x35')]['sort']);_0x13c3c7[_0xee5a('0x3d')]=qs['filters'](_['pick'](_0xec76b7['query'],_0x2bbc01[_0xee5a('0x3e')]));if(_0xec76b7[_0xee5a('0x35')]['filter']){_0x13c3c7[_0xee5a('0x3d')]=_[_0xee5a('0x41')](_0x13c3c7[_0xee5a('0x3d')],{'$or':_['map'](_0x13c3c7['attributes'],function(_0x3a505d){var _0x242cef={};_0x242cef[_0x3a505d]={'$like':'%'+_0xec76b7['query'][_0xee5a('0x40')]+'%'};return _0x242cef;})});}_0x13c3c7=_['merge']({},_0x13c3c7,_0xec76b7[_0xee5a('0x43')]);return _0x22ce67['getTags'](_0x13c3c7);}})[_0xee5a('0x28')](function(_0x3c3a42){if(_0x3c3a42){_0x192bc2=_0x3c3a42[_0xee5a('0x39')];if(!_0xec76b7[_0xee5a('0x35')][_0xee5a('0x3a')](_0xee5a('0x3b'))){_0x13c3c7[_0xee5a('0x1e')]=qs[_0xee5a('0x1e')](_0xec76b7[_0xee5a('0x35')][_0xee5a('0x1e')]);_0x13c3c7[_0xee5a('0x1f')]=qs[_0xee5a('0x1f')](_0xec76b7['query']['offset']);}return _0x22ce67[_0xee5a('0x56')](_0x13c3c7);}})[_0xee5a('0x28')](function(_0xa787cd){if(_0xa787cd){return _0xa787cd?{'count':_0x192bc2,'rows':_0xa787cd}:null;}})['then'](respondWithResult(_0x316ac2,null))['catch'](handleError(_0x316ac2,null));};exports['setTags']=function(_0x4f8858,_0x330797,_0x4ec185){if(_0x4f8858[_0xee5a('0x4e')]['id']){delete _0x4f8858[_0xee5a('0x4e')]['id'];}return db[_0xee5a('0x2e')][_0xee5a('0x52')]({'where':{'id':_0x4f8858[_0xee5a('0x49')]['id']}})[_0xee5a('0x28')](handleEntityNotFound(_0x330797,null))[_0xee5a('0x28')](function(_0x1e1db5){if(_0x1e1db5){return _0x1e1db5['setTags'](_0x4f8858[_0xee5a('0x4e')][_0xee5a('0x58')]||[]);}return null;})['then'](respondWithResult(_0x330797,null))[_0xee5a('0x4c')](handleError(_0x330797,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cc8140e..0dfcbf1 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 _0x8fe4=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8fe4,0x175));var _0x48fe=function(_0x4292c7,_0x4dad8b){_0x4292c7=_0x4292c7-0x0;var _0x409d04=_0x8fe4[_0x4292c7];return _0x409d04;};'use strict';var _=require(_0x48fe('0x0'));var util=require(_0x48fe('0x1'));var logger=require(_0x48fe('0x2'))(_0x48fe('0x3'));var moment=require(_0x48fe('0x4'));var BPromise=require(_0x48fe('0x5'));var rp=require(_0x48fe('0x6'));var fs=require('fs');var path=require(_0x48fe('0x7'));var rimraf=require('rimraf');var config=require(_0x48fe('0x8'));var attributes=require(_0x48fe('0x9'));module[_0x48fe('0xa')]=function(_0x3eeb02,_0x22eb5e){return _0x3eeb02[_0x48fe('0xb')]('FreshdeskConfiguration',attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x925e=['request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','moment'];(function(_0x2c196f,_0xb47e50){var _0x378683=function(_0x4a1498){while(--_0x4a1498){_0x2c196f['push'](_0x2c196f['shift']());}};_0x378683(++_0xb47e50);}(_0x925e,0xfa));var _0xe925=function(_0x505a1d,_0x1136e8){_0x505a1d=_0x505a1d-0x0;var _0x114138=_0x925e[_0x505a1d];return _0x114138;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe925('0x0'))('api');var moment=require(_0xe925('0x1'));var BPromise=require('bluebird');var rp=require(_0xe925('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe925('0x3'));var attributes=require(_0xe925('0x4'));module[_0xe925('0x5')]=function(_0x1b5a2d,_0x26a3a0){return _0x1b5a2d[_0xe925('0x6')](_0xe925('0x7'),attributes,{'tableName':_0xe925('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 8eccbb7..c1a45ee 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 _0xfb2a=['request','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x38dc89,_0x4844f1){var _0x2a069c=function(_0x345e0b){while(--_0x345e0b){_0x38dc89['push'](_0x38dc89['shift']());}};_0x2a069c(++_0x4844f1);}(_0xfb2a,0x1c3));var _0xafb2=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfb2a[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xafb2('0x0'));var util=require('util');var moment=require(_0xafb2('0x1'));var BPromise=require(_0xafb2('0x2'));var rs=require(_0xafb2('0x3'));var fs=require('fs');var Redis=require(_0xafb2('0x4'));var db=require(_0xafb2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xafb2('0x6'))(_0xafb2('0x7'));var config=require(_0xafb2('0x8'));var jayson=require(_0xafb2('0x9'));var client=jayson['client'][_0xafb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7cf7,_0xa47065,_0x1468c9){return new BPromise(function(_0xc48557,_0x1fd167){return client[_0xafb2('0xb')](_0x4b7cf7,_0x1468c9)['then'](function(_0x4b2a93){logger['info'](_0xafb2('0xc'),_0xa47065,'request\x20sent');logger[_0xafb2('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xa47065,_0xafb2('0xe'),JSON['stringify'](_0x4b2a93));if(_0x4b2a93[_0xafb2('0xf')]){if(_0x4b2a93[_0xafb2('0xf')][_0xafb2('0x10')]===0x1f4){logger[_0xafb2('0xf')](_0xafb2('0xc'),_0xa47065,_0x4b2a93[_0xafb2('0xf')][_0xafb2('0x11')]);return _0x1fd167(_0x4b2a93[_0xafb2('0xf')]['message']);}logger[_0xafb2('0xf')](_0xafb2('0xc'),_0xa47065,_0x4b2a93[_0xafb2('0xf')]['message']);return _0xc48557(_0x4b2a93[_0xafb2('0xf')]['message']);}else{logger[_0xafb2('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xa47065,_0xafb2('0xe'));_0xc48557(_0x4b2a93[_0xafb2('0x13')][_0xafb2('0x11')]);}})[_0xafb2('0x14')](function(_0x56780c){logger['error'](_0xafb2('0xc'),_0xa47065,_0x56780c);_0x1fd167(_0x56780c);});});} \ No newline at end of file +var _0xf37c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird'];(function(_0x5ab238,_0x4ddda9){var _0x236db6=function(_0x5f1f3f){while(--_0x5f1f3f){_0x5ab238['push'](_0x5ab238['shift']());}};_0x236db6(++_0x4ddda9);}(_0xf37c,0x13c));var _0xcf37=function(_0x43c211,_0x86ae16){_0x43c211=_0x43c211-0x0;var _0x5f3e83=_0xf37c[_0x43c211];return _0x5f3e83;};'use strict';var _=require(_0xcf37('0x0'));var util=require(_0xcf37('0x1'));var moment=require(_0xcf37('0x2'));var BPromise=require(_0xcf37('0x3'));var rs=require(_0xcf37('0x4'));var fs=require('fs');var Redis=require(_0xcf37('0x5'));var db=require(_0xcf37('0x6'))['db'];var utils=require(_0xcf37('0x7'));var logger=require(_0xcf37('0x8'))(_0xcf37('0x9'));var config=require('../../config/environment');var jayson=require(_0xcf37('0xa'));var client=jayson[_0xcf37('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b93af,_0x9dfb04,_0x33837f){return new BPromise(function(_0x2ecce2,_0x4dd0f1){return client[_0xcf37('0xc')](_0x1b93af,_0x33837f)['then'](function(_0x5c59e7){logger['info'](_0xcf37('0xd'),_0x9dfb04,_0xcf37('0xe'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x9dfb04,'request\x20sent',JSON[_0xcf37('0xf')](_0x5c59e7));if(_0x5c59e7[_0xcf37('0x10')]){if(_0x5c59e7[_0xcf37('0x10')][_0xcf37('0x11')]===0x1f4){logger['error'](_0xcf37('0xd'),_0x9dfb04,_0x5c59e7[_0xcf37('0x10')]['message']);return _0x4dd0f1(_0x5c59e7[_0xcf37('0x10')][_0xcf37('0x12')]);}logger[_0xcf37('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x9dfb04,_0x5c59e7[_0xcf37('0x10')][_0xcf37('0x12')]);return _0x2ecce2(_0x5c59e7['error'][_0xcf37('0x12')]);}else{logger[_0xcf37('0x13')](_0xcf37('0xd'),_0x9dfb04,_0xcf37('0xe'));_0x2ecce2(_0x5c59e7['result'][_0xcf37('0x12')]);}})['catch'](function(_0xdcf322){logger[_0xcf37('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x9dfb04,_0xdcf322);_0x4dd0f1(_0xdcf322);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c0bfc10..866a18b 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 _0xd1cf=['/:id','show','post','create','put','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0xd1cf,0x140));var _0xfd1c=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xd1cf[_0x3f59b1];return _0x11d2e8;};'use strict';var multer=require(_0xfd1c('0x0'));var util=require(_0xfd1c('0x1'));var path=require(_0xfd1c('0x2'));var timeout=require(_0xfd1c('0x3'));var express=require(_0xfd1c('0x4'));var router=express[_0xfd1c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd1c('0x6'));var controller=require(_0xfd1c('0x7'));router[_0xfd1c('0x8')]('/',auth[_0xfd1c('0x9')](),controller['index']);router[_0xfd1c('0x8')](_0xfd1c('0xa'),auth[_0xfd1c('0x9')](),controller[_0xfd1c('0xb')]);router[_0xfd1c('0xc')]('/',auth['isAuthenticated'](),controller[_0xfd1c('0xd')]);router[_0xfd1c('0xe')](_0xfd1c('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xce6e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2c2e54,_0x55ff9e){var _0x3b067=function(_0xfc31f9){while(--_0xfc31f9){_0x2c2e54['push'](_0x2c2e54['shift']());}};_0x3b067(++_0x55ff9e);}(_0xce6e,0xfd));var _0xece6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce6e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xece6('0x0'));var util=require(_0xece6('0x1'));var path=require(_0xece6('0x2'));var timeout=require(_0xece6('0x3'));var express=require(_0xece6('0x4'));var router=express[_0xece6('0x5')]();var fs_extra=require(_0xece6('0x6'));var auth=require(_0xece6('0x7'));var interaction=require(_0xece6('0x8'));var config=require(_0xece6('0x9'));var controller=require(_0xece6('0xa'));router[_0xece6('0xb')]('/',auth[_0xece6('0xc')](),controller[_0xece6('0xd')]);router[_0xece6('0xb')](_0xece6('0xe'),auth[_0xece6('0xc')](),controller[_0xece6('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xece6('0x10')]);router[_0xece6('0x11')](_0xece6('0xe'),auth[_0xece6('0xc')](),controller['update']);router['delete'](_0xece6('0xe'),auth['isAuthenticated'](),controller[_0xece6('0x12')]);module[_0xece6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 0781607..a0f9812 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 _0x5a1c=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x15a34f,_0x1378ba){var _0x2e7b6b=function(_0x1fbfa2){while(--_0x1fbfa2){_0x15a34f['push'](_0x15a34f['shift']());}};_0x2e7b6b(++_0x1378ba);}(_0x5a1c,0xb7));var _0xc5a1=function(_0x2ee497,_0x56cc42){_0x2ee497=_0x2ee497-0x0;var _0x26ff38=_0x5a1c[_0x2ee497];return _0x26ff38;};'use strict';var Sequelize=require(_0xc5a1('0x0'));module[_0xc5a1('0x1')]={'type':{'type':Sequelize[_0xc5a1('0x2')](_0xc5a1('0x3'),_0xc5a1('0x4'),_0xc5a1('0x5'),'keyValue',_0xc5a1('0x6')),'defaultValue':_0xc5a1('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc5a1('0x7')]},'keyType':{'type':Sequelize[_0xc5a1('0x2')](_0xc5a1('0x3'),_0xc5a1('0x4'),_0xc5a1('0x5'))},'keyContent':{'type':Sequelize[_0xc5a1('0x7')]},'idField':{'type':Sequelize[_0xc5a1('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc5a1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb037=['sequelize','string','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x24bd83,_0x1830c4){var _0x3a047e=function(_0x5d8bc4){while(--_0x5d8bc4){_0x24bd83['push'](_0x24bd83['shift']());}};_0x3a047e(++_0x1830c4);}(_0xb037,0x165));var _0x7b03=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb037[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require(_0x7b03('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7b03('0x1'),'variable','customVariable',_0x7b03('0x2'),_0x7b03('0x3')),'defaultValue':_0x7b03('0x1')},'content':{'type':Sequelize[_0x7b03('0x4')]},'key':{'type':Sequelize[_0x7b03('0x4')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x7b03('0x5'))},'keyContent':{'type':Sequelize[_0x7b03('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7b03('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 510ede5..b50e354 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 _0x5b02=['length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys'];(function(_0x3fed1c,_0x4b1ca8){var _0x1b6393=function(_0x118484){while(--_0x118484){_0x3fed1c['push'](_0x3fed1c['shift']());}};_0x1b6393(++_0x4b1ca8);}(_0x5b02,0xe9));var _0x25b0=function(_0x488f0a,_0x54ac16){_0x488f0a=_0x488f0a-0x0;var _0x32bfa8=_0x5b02[_0x488f0a];return _0x32bfa8;};'use strict';var emlformat=require(_0x25b0('0x0'));var rimraf=require(_0x25b0('0x1'));var zipdir=require(_0x25b0('0x2'));var jsonpatch=require(_0x25b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25b0('0x4'));var Mustache=require('mustache');var util=require(_0x25b0('0x5'));var path=require(_0x25b0('0x6'));var sox=require(_0x25b0('0x7'));var csv=require(_0x25b0('0x8'));var ejs=require(_0x25b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];function respondWithStatusCode(_0x1d3178,_0x184452){_0x184452=_0x184452||0xcc;return function(_0x26a34f){if(_0x26a34f){return _0x1d3178[_0x25b0('0x19')](_0x184452);}return _0x1d3178[_0x25b0('0x1a')](_0x184452)[_0x25b0('0x1b')]();};}function respondWithResult(_0x42cc07,_0x293203){_0x293203=_0x293203||0xc8;return function(_0x211658){if(_0x211658){return _0x42cc07[_0x25b0('0x1a')](_0x293203)[_0x25b0('0x1c')](_0x211658);}};}function respondWithFilteredResult(_0x40071c,_0x5ac18d){return function(_0x51542b){if(_0x51542b){var _0xfe1ea6=typeof _0x5ac18d['offset']===_0x25b0('0x1d')&&typeof _0x5ac18d[_0x25b0('0x1e')]===_0x25b0('0x1d');var _0x3267b9=_0x51542b['count'];var _0x1d850f=_0xfe1ea6?0x0:_0x5ac18d[_0x25b0('0x1f')];var _0x20762e=_0xfe1ea6?_0x51542b[_0x25b0('0x20')]:_0x5ac18d[_0x25b0('0x1f')]+_0x5ac18d[_0x25b0('0x1e')];var _0x54f458;if(_0x20762e>=_0x3267b9){_0x20762e=_0x3267b9;_0x54f458=0xc8;}else{_0x54f458=0xce;}_0x40071c[_0x25b0('0x1a')](_0x54f458);return _0x40071c[_0x25b0('0x21')](_0x25b0('0x22'),_0x1d850f+'-'+_0x20762e+'/'+_0x3267b9)[_0x25b0('0x1c')](_0x51542b);}return null;};}function patchUpdates(_0x1dc691){return function(_0xea4162){try{jsonpatch[_0x25b0('0x23')](_0xea4162,_0x1dc691,!![]);}catch(_0x19599b){return BPromise[_0x25b0('0x24')](_0x19599b);}return _0xea4162[_0x25b0('0x25')]();};}function saveUpdates(_0x2b2eda,_0x3ce1da){return function(_0x5cb746){if(_0x5cb746){return _0x5cb746[_0x25b0('0x26')](_0x2b2eda)[_0x25b0('0x27')](function(_0x517ec5){return _0x517ec5;});}return null;};}function removeEntity(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(_0x3546f0){return _0x3546f0['destroy']()['then'](function(){_0x2d7c17['status'](0xcc)[_0x25b0('0x1b')]();});}};}function handleEntityNotFound(_0x433085,_0x99bd3a){return function(_0x24f847){if(!_0x24f847){_0x433085[_0x25b0('0x19')](0x194);}return _0x24f847;};}function handleError(_0x23b396,_0x40268a){_0x40268a=_0x40268a||0x1f4;return function(_0x75ce7a){logger[_0x25b0('0x28')](_0x75ce7a['stack']);if(_0x75ce7a[_0x25b0('0x29')]){delete _0x75ce7a[_0x25b0('0x29')];}_0x23b396['status'](_0x40268a)['send'](_0x75ce7a);};}exports['index']=function(_0x1a6212,_0x3f0a54){var _0x251fad={},_0x105129={},_0x214377={'count':0x0,'rows':[]};var _0x3285ae=_[_0x25b0('0x2a')](db[_0x25b0('0x2b')][_0x25b0('0x2c')],function(_0x285a2b){return{'name':_0x285a2b[_0x25b0('0x2d')],'type':_0x285a2b[_0x25b0('0x2e')][_0x25b0('0x2f')]};});_0x105129['model']=_['map'](_0x3285ae,_0x25b0('0x29'));_0x105129['query']=_['keys'](_0x1a6212[_0x25b0('0x30')]);_0x105129[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],_0x105129[_0x25b0('0x30')]);_0x251fad['attributes']=_[_0x25b0('0x32')](_0x105129[_0x25b0('0x33')],qs['fields'](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x34')]));_0x251fad['attributes']=_0x251fad[_0x25b0('0x35')]['length']?_0x251fad[_0x25b0('0x35')]:_0x105129[_0x25b0('0x33')];if(!_0x1a6212[_0x25b0('0x30')][_0x25b0('0x36')](_0x25b0('0x37'))){_0x251fad[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1e')]);_0x251fad['offset']=qs[_0x25b0('0x1f')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x1f')]);}_0x251fad[_0x25b0('0x38')]=qs[_0x25b0('0x39')](_0x1a6212[_0x25b0('0x30')][_0x25b0('0x39')]);_0x251fad[_0x25b0('0x3a')]=qs[_0x25b0('0x31')](_[_0x25b0('0x3b')](_0x1a6212['query'],_0x105129[_0x25b0('0x31')]),_0x3285ae);if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x3c')]){_0x251fad['where']=_[_0x25b0('0x3d')](_0x251fad[_0x25b0('0x3a')],{'$or':_[_0x25b0('0x2a')](_0x3285ae,function(_0x43e140){if(_0x43e140[_0x25b0('0x2e')]!==_0x25b0('0x3e')){var _0x28f1cd={};_0x28f1cd[_0x43e140[_0x25b0('0x29')]]={'$like':'%'+_0x1a6212['query']['filter']+'%'};return _0x28f1cd;}})});}_0x251fad=_[_0x25b0('0x3d')]({},_0x251fad,_0x1a6212[_0x25b0('0x3f')]);var _0x3f4ae0={'where':_0x251fad['where']};return db[_0x25b0('0x2b')]['count'](_0x3f4ae0)[_0x25b0('0x27')](function(_0x39617a){_0x214377[_0x25b0('0x20')]=_0x39617a;if(_0x1a6212[_0x25b0('0x30')][_0x25b0('0x40')]){_0x251fad['include']=[{'all':!![]}];}return db[_0x25b0('0x2b')][_0x25b0('0x41')](_0x251fad);})[_0x25b0('0x27')](function(_0x376d8a){_0x214377[_0x25b0('0x42')]=_0x376d8a;return _0x214377;})['then'](respondWithFilteredResult(_0x3f0a54,_0x251fad))[_0x25b0('0x43')](handleError(_0x3f0a54,null));};exports[_0x25b0('0x44')]=function(_0x3d1262,_0x44c400){var _0x35fc00={'raw':!![],'where':{'id':_0x3d1262[_0x25b0('0x45')]['id']}},_0x1adf8d={};_0x1adf8d[_0x25b0('0x33')]=_[_0x25b0('0x46')](db[_0x25b0('0x2b')][_0x25b0('0x2c')]);_0x1adf8d['query']=_[_0x25b0('0x46')](_0x3d1262['query']);_0x1adf8d[_0x25b0('0x31')]=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],_0x1adf8d[_0x25b0('0x30')]);_0x35fc00['attributes']=_[_0x25b0('0x32')](_0x1adf8d[_0x25b0('0x33')],qs[_0x25b0('0x34')](_0x3d1262['query'][_0x25b0('0x34')]));_0x35fc00[_0x25b0('0x35')]=_0x35fc00[_0x25b0('0x35')][_0x25b0('0x47')]?_0x35fc00[_0x25b0('0x35')]:_0x1adf8d[_0x25b0('0x33')];if(_0x3d1262[_0x25b0('0x30')]['includeAll']){_0x35fc00[_0x25b0('0x48')]=[{'all':!![]}];}_0x35fc00=_[_0x25b0('0x3d')]({},_0x35fc00,_0x3d1262[_0x25b0('0x3f')]);return db['FreshdeskField'][_0x25b0('0x49')](_0x35fc00)[_0x25b0('0x27')](handleEntityNotFound(_0x44c400,null))[_0x25b0('0x27')](respondWithResult(_0x44c400,null))[_0x25b0('0x43')](handleError(_0x44c400,null));};exports[_0x25b0('0x4a')]=function(_0x568d83,_0x1e8a8d){return db[_0x25b0('0x2b')][_0x25b0('0x4a')](_0x568d83['body'],{})[_0x25b0('0x27')](respondWithResult(_0x1e8a8d,0xc9))[_0x25b0('0x43')](handleError(_0x1e8a8d,null));};exports[_0x25b0('0x26')]=function(_0x1d6d55,_0x29165e){if(_0x1d6d55[_0x25b0('0x4b')]['id']){delete _0x1d6d55['body']['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x1d6d55[_0x25b0('0x45')]['id']}})['then'](handleEntityNotFound(_0x29165e,null))['then'](saveUpdates(_0x1d6d55[_0x25b0('0x4b')],null))['then'](respondWithResult(_0x29165e,null))[_0x25b0('0x43')](handleError(_0x29165e,null));};exports['destroy']=function(_0x4fc22d,_0x394e52){return db[_0x25b0('0x2b')][_0x25b0('0x49')]({'where':{'id':_0x4fc22d[_0x25b0('0x45')]['id']}})[_0x25b0('0x27')](handleEntityNotFound(_0x394e52,null))[_0x25b0('0x27')](removeEntity(_0x394e52,null))[_0x25b0('0x43')](handleError(_0x394e52,null));}; \ No newline at end of file +var _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x4c7c4a,_0x520920){_0x4c7c4a=_0x4c7c4a-0x0;var _0x4d78ae=_0x9c5e[_0x4c7c4a];return _0x4d78ae;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index da513af..ceb539e 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 _0x7c53=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define'];(function(_0xc125ac,_0x446552){var _0x4daccf=function(_0x1ed278){while(--_0x1ed278){_0xc125ac['push'](_0xc125ac['shift']());}};_0x4daccf(++_0x446552);}(_0x7c53,0xbb));var _0x37c5=function(_0x2524fd,_0x3f2151){_0x2524fd=_0x2524fd-0x0;var _0x77ec95=_0x7c53[_0x2524fd];return _0x77ec95;};'use strict';var _=require(_0x37c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x37c5('0x1'));var BPromise=require(_0x37c5('0x2'));var rp=require(_0x37c5('0x3'));var fs=require('fs');var path=require(_0x37c5('0x4'));var rimraf=require(_0x37c5('0x5'));var config=require(_0x37c5('0x6'));var attributes=require(_0x37c5('0x7'));module['exports']=function(_0x186929,_0x9ce684){return _0x186929[_0x37c5('0x8')](_0x37c5('0x9'),attributes,{'tableName':_0x37c5('0xa'),'paranoid':![],'indexes':[{'name':_0x37c5('0xb'),'fields':[_0x37c5('0xc'),_0x37c5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb1f=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x40c96d,_0x388bd6){var _0x5b61f7=function(_0x364c43){while(--_0x364c43){_0x40c96d['push'](_0x40c96d['shift']());}};_0x5b61f7(++_0x388bd6);}(_0xfb1f,0x6a));var _0xffb1=function(_0x52f3a4,_0x5afa6c){_0x52f3a4=_0x52f3a4-0x0;var _0x49f39d=_0xfb1f[_0x52f3a4];return _0x49f39d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffb1('0x0'))(_0xffb1('0x1'));var moment=require(_0xffb1('0x2'));var BPromise=require(_0xffb1('0x3'));var rp=require(_0xffb1('0x4'));var fs=require('fs');var path=require(_0xffb1('0x5'));var rimraf=require(_0xffb1('0x6'));var config=require(_0xffb1('0x7'));var attributes=require(_0xffb1('0x8'));module[_0xffb1('0x9')]=function(_0x3239ef,_0x46aadf){return _0x3239ef[_0xffb1('0xa')](_0xffb1('0xb'),attributes,{'tableName':_0xffb1('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xffb1('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index ed016b6..e77b466 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 _0x2930=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','randomstring','../../mysqldb'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x2930,0x9e));var _0x0293=function(_0x21268e,_0x55faa4){_0x21268e=_0x21268e-0x0;var _0x125d40=_0x2930[_0x21268e];return _0x125d40;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0293('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0293('0x1'))['db'];var utils=require(_0x0293('0x2'));var logger=require(_0x0293('0x3'))(_0x0293('0x4'));var config=require(_0x0293('0x5'));var jayson=require(_0x0293('0x6'));var client=jayson[_0x0293('0x7')][_0x0293('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x340473,_0x4dd6e3,_0x448df7){return new BPromise(function(_0x50333e,_0x195493){return client[_0x0293('0x9')](_0x340473,_0x448df7)[_0x0293('0xa')](function(_0x22513b){logger[_0x0293('0xb')](_0x0293('0xc'),_0x4dd6e3,'request\x20sent');logger[_0x0293('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4dd6e3,_0x0293('0xe'),JSON[_0x0293('0xf')](_0x22513b));if(_0x22513b[_0x0293('0x10')]){if(_0x22513b['error']['code']===0x1f4){logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x22513b['error'][_0x0293('0x11')]);return _0x195493(_0x22513b[_0x0293('0x10')]['message']);}logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x22513b[_0x0293('0x10')][_0x0293('0x11')]);return _0x50333e(_0x22513b[_0x0293('0x10')][_0x0293('0x11')]);}else{logger[_0x0293('0xb')](_0x0293('0xc'),_0x4dd6e3,'request\x20sent');_0x50333e(_0x22513b[_0x0293('0x12')][_0x0293('0x11')]);}})[_0x0293('0x13')](function(_0x234bc4){logger[_0x0293('0x10')](_0x0293('0xc'),_0x4dd6e3,_0x234bc4);_0x195493(_0x234bc4);});});} \ No newline at end of file +var _0x94bf=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2569f6,_0x2436f0){var _0x33b771=function(_0x290370){while(--_0x290370){_0x2569f6['push'](_0x2569f6['shift']());}};_0x33b771(++_0x2436f0);}(_0x94bf,0x1c2));var _0xf94b=function(_0x32948f,_0x110256){_0x32948f=_0x32948f-0x0;var _0x59bd64=_0x94bf[_0x32948f];return _0x59bd64;};'use strict';var _=require('lodash');var util=require(_0xf94b('0x0'));var moment=require('moment');var BPromise=require(_0xf94b('0x1'));var rs=require(_0xf94b('0x2'));var fs=require('fs');var Redis=require(_0xf94b('0x3'));var db=require(_0xf94b('0x4'))['db'];var utils=require(_0xf94b('0x5'));var logger=require(_0xf94b('0x6'))(_0xf94b('0x7'));var config=require(_0xf94b('0x8'));var jayson=require(_0xf94b('0x9'));var client=jayson['client'][_0xf94b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9a8ae7,_0x13e671,_0x5643b6){return new BPromise(function(_0x5cb253,_0x3a4ad7){return client[_0xf94b('0xb')](_0x9a8ae7,_0x5643b6)[_0xf94b('0xc')](function(_0x5afaa3){logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));logger[_0xf94b('0x10')](_0xf94b('0x11'),_0x13e671,'request\x20sent',JSON[_0xf94b('0x12')](_0x5afaa3));if(_0x5afaa3[_0xf94b('0x13')]){if(_0x5afaa3[_0xf94b('0x13')]['code']===0x1f4){logger[_0xf94b('0x13')](_0xf94b('0xe'),_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x3a4ad7(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}logger[_0xf94b('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x5cb253(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}else{logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));_0x5cb253(_0x5afaa3[_0xf94b('0x15')][_0xf94b('0x14')]);}})[_0xf94b('0x16')](function(_0xe5a61b){logger['error'](_0xf94b('0xe'),_0x13e671,_0xe5a61b);_0x3a4ad7(_0xe5a61b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index fad7bfb..31a4e68 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 _0x6b20=['destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0x6b20,0xd1));var _0x06b2=function(_0x3ca6ba,_0x2a49f2){_0x3ca6ba=_0x3ca6ba-0x0;var _0x211b3a=_0x6b20[_0x3ca6ba];return _0x211b3a;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));var controller=require(_0x06b2('0x7'));router[_0x06b2('0x8')]('/',auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0x8')](_0x06b2('0xb'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0x8')](_0x06b2('0xd'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);router['get'](_0x06b2('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x06b2('0x10')]('/',auth[_0x06b2('0x9')](),controller['create']);router[_0x06b2('0x10')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x11')]);router[_0x06b2('0x12')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x13')]);router[_0x06b2('0x14')](_0x06b2('0xb'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x15')]);module[_0x06b2('0x16')]=router; \ No newline at end of file +var _0xa74f=['post','create','/:id/configurations','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0x53263b,_0x299c08){var _0x3fd94b=function(_0x489939){while(--_0x489939){_0x53263b['push'](_0x53263b['shift']());}};_0x3fd94b(++_0x299c08);}(_0xa74f,0x9a));var _0xfa74=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0xa74f[_0x5519a9];return _0x32f2cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id/configurations',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0xe')](_0xfa74('0x10'),auth[_0xfa74('0x9')](),controller['addConfiguration']);router[_0xfa74('0x11')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x12')]);router['delete'](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x13')]);module[_0xfa74('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2748bf6..9bf1883 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x50c7e5,_0x380f0f){var _0x108f56=function(_0x1959cf){while(--_0x1959cf){_0x50c7e5['push'](_0x50c7e5['shift']());}};_0x108f56(++_0x380f0f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x95fd97,_0x13b945){_0x95fd97=_0x95fd97-0x0;var _0x2eabcb=_0xdd4f[_0x95fd97];return _0x2eabcb;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5464=['remoteUri','sequelize','exports','STRING'];(function(_0x8d692,_0x16d6a2){var _0x22b7be=function(_0x5cb4f0){while(--_0x5cb4f0){_0x8d692['push'](_0x8d692['shift']());}};_0x22b7be(++_0x16d6a2);}(_0x5464,0x15d));var _0x4546=function(_0x33321b,_0x46df65){_0x33321b=_0x33321b-0x0;var _0x471461=_0x5464[_0x33321b];return _0x471461;};'use strict';var Sequelize=require(_0x4546('0x0'));module[_0x4546('0x1')]={'name':{'type':Sequelize[_0x4546('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4546('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x4546('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x4546('0x3')},'serverUrl':{'type':Sequelize[_0x4546('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 2023bd3..8b587b7 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 _0xf145=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','getConfigurations','findOne','FreshsalesConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x2b02f9,_0x17359d){var _0x452117=function(_0x58726f){while(--_0x58726f){_0x2b02f9['push'](_0x2b02f9['shift']());}};_0x452117(++_0x17359d);}(_0xf145,0x17e));var _0x5f14=function(_0x4beb42,_0x3066df){_0x4beb42=_0x4beb42-0x0;var _0x198c48=_0xf145[_0x4beb42];return _0x198c48;};'use strict';var emlformat=require(_0x5f14('0x0'));var rimraf=require(_0x5f14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f14('0x2'));var rp=require(_0x5f14('0x3'));var moment=require('moment');var BPromise=require(_0x5f14('0x4'));var Mustache=require(_0x5f14('0x5'));var util=require('util');var path=require(_0x5f14('0x6'));var sox=require(_0x5f14('0x7'));var csv=require(_0x5f14('0x8'));var ejs=require(_0x5f14('0x9'));var fs=require('fs');var fs_extra=require(_0x5f14('0xa'));var _=require(_0x5f14('0xb'));var squel=require('squel');var crypto=require(_0x5f14('0xc'));var jsforce=require(_0x5f14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5f14('0x8'));var querystring=require(_0x5f14('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f14('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5f14('0x10'));var as=require(_0x5f14('0x11'));var hardwareService=require(_0x5f14('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5f14('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5f14('0x14'));var db=require(_0x5f14('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x50a693,_0xd23139){_0xd23139=_0xd23139||0xcc;return function(_0x9c68d6){if(_0x9c68d6){return _0x50a693[_0x5f14('0x16')](_0xd23139);}return _0x50a693[_0x5f14('0x17')](_0xd23139)[_0x5f14('0x18')]();};}function respondWithResult(_0x2ce15f,_0x54d173){_0x54d173=_0x54d173||0xc8;return function(_0x24dc2c){if(_0x24dc2c){return _0x2ce15f[_0x5f14('0x17')](_0x54d173)['json'](_0x24dc2c);}};}function respondWithFilteredResult(_0x2d4c4e,_0x3b5c03){return function(_0x58729f){if(_0x58729f){var _0x2659c1=typeof _0x3b5c03[_0x5f14('0x19')]===_0x5f14('0x1a')&&typeof _0x3b5c03[_0x5f14('0x1b')]===_0x5f14('0x1a');var _0x2fb3a4=_0x58729f[_0x5f14('0x1c')];var _0x54b468=_0x2659c1?0x0:_0x3b5c03[_0x5f14('0x19')];var _0x384a28=_0x2659c1?_0x58729f[_0x5f14('0x1c')]:_0x3b5c03[_0x5f14('0x19')]+_0x3b5c03[_0x5f14('0x1b')];var _0x250830;if(_0x384a28>=_0x2fb3a4){_0x384a28=_0x2fb3a4;_0x250830=0xc8;}else{_0x250830=0xce;}_0x2d4c4e[_0x5f14('0x17')](_0x250830);return _0x2d4c4e[_0x5f14('0x1d')](_0x5f14('0x1e'),_0x54b468+'-'+_0x384a28+'/'+_0x2fb3a4)[_0x5f14('0x1f')](_0x58729f);}return null;};}function patchUpdates(_0x8cafef){return function(_0x498cad){try{jsonpatch[_0x5f14('0x20')](_0x498cad,_0x8cafef,!![]);}catch(_0x453628){return BPromise['reject'](_0x453628);}return _0x498cad[_0x5f14('0x21')]();};}function saveUpdates(_0x3b33fa,_0x3fba06){return function(_0x10f152){if(_0x10f152){return _0x10f152['update'](_0x3b33fa)[_0x5f14('0x22')](function(_0x49d482){return _0x49d482;});}return null;};}function removeEntity(_0x119dd8,_0x217b6d){return function(_0x3268bc){if(_0x3268bc){return _0x3268bc[_0x5f14('0x23')]()['then'](function(){_0x119dd8[_0x5f14('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a03e2,_0x397c5a){return function(_0x1d7ab2){if(!_0x1d7ab2){_0x3a03e2[_0x5f14('0x16')](0x194);}return _0x1d7ab2;};}function handleError(_0x482cfa,_0x3691fc){_0x3691fc=_0x3691fc||0x1f4;return function(_0x1736ec){logger['error'](_0x1736ec[_0x5f14('0x24')]);if(_0x1736ec[_0x5f14('0x25')]){delete _0x1736ec['name'];}_0x482cfa[_0x5f14('0x17')](_0x3691fc)[_0x5f14('0x26')](_0x1736ec);};}exports[_0x5f14('0x27')]=function(_0x5be194,_0x482daf){var _0x53d920={},_0x2d08ad={},_0x2b1a2a={'count':0x0,'rows':[]};var _0x2671df=_['map'](db['FreshsalesAccount'][_0x5f14('0x28')],function(_0x2957c5){return{'name':_0x2957c5['fieldName'],'type':_0x2957c5[_0x5f14('0x29')][_0x5f14('0x2a')]};});_0x2d08ad[_0x5f14('0x2b')]=_[_0x5f14('0x2c')](_0x2671df,_0x5f14('0x25'));_0x2d08ad['query']=_[_0x5f14('0x2d')](_0x5be194[_0x5f14('0x2e')]);_0x2d08ad[_0x5f14('0x2f')]=_[_0x5f14('0x30')](_0x2d08ad[_0x5f14('0x2b')],_0x2d08ad[_0x5f14('0x2e')]);_0x53d920['attributes']=_['intersection'](_0x2d08ad[_0x5f14('0x2b')],qs[_0x5f14('0x31')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x31')]));_0x53d920[_0x5f14('0x32')]=_0x53d920[_0x5f14('0x32')][_0x5f14('0x33')]?_0x53d920['attributes']:_0x2d08ad[_0x5f14('0x2b')];if(!_0x5be194[_0x5f14('0x2e')][_0x5f14('0x34')](_0x5f14('0x35'))){_0x53d920[_0x5f14('0x1b')]=qs[_0x5f14('0x1b')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x1b')]);_0x53d920[_0x5f14('0x19')]=qs[_0x5f14('0x19')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x19')]);}_0x53d920[_0x5f14('0x36')]=qs[_0x5f14('0x37')](_0x5be194[_0x5f14('0x2e')][_0x5f14('0x37')]);_0x53d920[_0x5f14('0x38')]=qs['filters'](_[_0x5f14('0x39')](_0x5be194[_0x5f14('0x2e')],_0x2d08ad['filters']),_0x2671df);if(_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3a')]){_0x53d920[_0x5f14('0x38')]=_[_0x5f14('0x3b')](_0x53d920[_0x5f14('0x38')],{'$or':_['map'](_0x2671df,function(_0x4fef52){if(_0x4fef52[_0x5f14('0x29')]!==_0x5f14('0x3c')){var _0x5593f2={};_0x5593f2[_0x4fef52[_0x5f14('0x25')]]={'$like':'%'+_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3a')]+'%'};return _0x5593f2;}})});}_0x53d920=_[_0x5f14('0x3b')]({},_0x53d920,_0x5be194[_0x5f14('0x3d')]);var _0x22109a={'where':_0x53d920[_0x5f14('0x38')]};return db[_0x5f14('0x3e')][_0x5f14('0x1c')](_0x22109a)[_0x5f14('0x22')](function(_0xe766a2){_0x2b1a2a[_0x5f14('0x1c')]=_0xe766a2;if(_0x5be194[_0x5f14('0x2e')][_0x5f14('0x3f')]){_0x53d920[_0x5f14('0x40')]=[{'all':!![]}];}return db[_0x5f14('0x3e')][_0x5f14('0x41')](_0x53d920);})[_0x5f14('0x22')](function(_0x22d8ce){_0x2b1a2a[_0x5f14('0x42')]=_0x22d8ce;return _0x2b1a2a;})['then'](respondWithFilteredResult(_0x482daf,_0x53d920))[_0x5f14('0x43')](handleError(_0x482daf,null));};exports[_0x5f14('0x44')]=function(_0x887827,_0x54a942){var _0x260f39={'raw':![],'where':{'id':_0x887827[_0x5f14('0x45')]['id']}},_0x21db78={};_0x21db78[_0x5f14('0x2b')]=_[_0x5f14('0x2d')](db[_0x5f14('0x3e')][_0x5f14('0x28')]);_0x21db78['query']=_[_0x5f14('0x2d')](_0x887827[_0x5f14('0x2e')]);_0x21db78[_0x5f14('0x2f')]=_[_0x5f14('0x30')](_0x21db78[_0x5f14('0x2b')],_0x21db78[_0x5f14('0x2e')]);_0x260f39[_0x5f14('0x32')]=_[_0x5f14('0x30')](_0x21db78[_0x5f14('0x2b')],qs[_0x5f14('0x31')](_0x887827['query'][_0x5f14('0x31')]));_0x260f39[_0x5f14('0x32')]=_0x260f39[_0x5f14('0x32')]['length']?_0x260f39[_0x5f14('0x32')]:_0x21db78['model'];if(_0x887827[_0x5f14('0x2e')][_0x5f14('0x3f')]){_0x260f39[_0x5f14('0x40')]=[{'all':!![]}];}_0x260f39=_[_0x5f14('0x3b')]({},_0x260f39,_0x887827['options']);return db['FreshsalesAccount']['find'](_0x260f39)[_0x5f14('0x22')](handleEntityNotFound(_0x54a942,null))[_0x5f14('0x22')](respondWithResult(_0x54a942,null))[_0x5f14('0x43')](handleError(_0x54a942,null));};exports['create']=function(_0x3352cd,_0x48ad3f){return db[_0x5f14('0x3e')][_0x5f14('0x46')](_0x3352cd[_0x5f14('0x47')],{})[_0x5f14('0x22')](respondWithResult(_0x48ad3f,0xc9))[_0x5f14('0x43')](handleError(_0x48ad3f,null));};exports[_0x5f14('0x48')]=function(_0xfe3c86,_0x3cec2c){if(_0xfe3c86['body']['id']){delete _0xfe3c86['body']['id'];}return db[_0x5f14('0x3e')][_0x5f14('0x49')]({'where':{'id':_0xfe3c86[_0x5f14('0x45')]['id']}})[_0x5f14('0x22')](handleEntityNotFound(_0x3cec2c,null))['then'](saveUpdates(_0xfe3c86[_0x5f14('0x47')],null))[_0x5f14('0x22')](respondWithResult(_0x3cec2c,null))[_0x5f14('0x43')](handleError(_0x3cec2c,null));};exports[_0x5f14('0x23')]=function(_0x3b21bd,_0x161032){return db['FreshsalesAccount'][_0x5f14('0x49')]({'where':{'id':_0x3b21bd[_0x5f14('0x45')]['id']}})['then'](handleEntityNotFound(_0x161032,null))[_0x5f14('0x22')](removeEntity(_0x161032,null))[_0x5f14('0x43')](handleError(_0x161032,null));};exports[_0x5f14('0x4a')]=function(_0x43ebab,_0x7fbe79,_0x43ea44){var _0x5adc5f={};var _0xee072f={};var _0x5c4606;var _0x5d59f4;return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x43ebab['params']['id']}})[_0x5f14('0x22')](handleEntityNotFound(_0x7fbe79,null))[_0x5f14('0x22')](function(_0x539b93){if(_0x539b93){_0x5c4606=_0x539b93;_0xee072f[_0x5f14('0x2b')]=_[_0x5f14('0x2d')](db[_0x5f14('0x4c')][_0x5f14('0x28')]);_0xee072f[_0x5f14('0x2e')]=_[_0x5f14('0x2d')](_0x43ebab['query']);_0xee072f['filters']=_[_0x5f14('0x30')](_0xee072f[_0x5f14('0x2b')],_0xee072f[_0x5f14('0x2e')]);_0x5adc5f['attributes']=_[_0x5f14('0x30')](_0xee072f['model'],qs[_0x5f14('0x31')](_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x31')]));_0x5adc5f[_0x5f14('0x32')]=_0x5adc5f['attributes'][_0x5f14('0x33')]?_0x5adc5f[_0x5f14('0x32')]:_0xee072f['model'];_0x5adc5f[_0x5f14('0x36')]=qs[_0x5f14('0x37')](_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x37')]);_0x5adc5f[_0x5f14('0x38')]=qs['filters'](_[_0x5f14('0x39')](_0x43ebab[_0x5f14('0x2e')],_0xee072f[_0x5f14('0x2f')]));if(_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x3a')]){_0x5adc5f[_0x5f14('0x38')]=_[_0x5f14('0x3b')](_0x5adc5f[_0x5f14('0x38')],{'$or':_[_0x5f14('0x2c')](_0x5adc5f[_0x5f14('0x32')],function(_0x1ced6f){var _0x1a6ea4={};_0x1a6ea4[_0x1ced6f]={'$like':'%'+_0x43ebab[_0x5f14('0x2e')][_0x5f14('0x3a')]+'%'};return _0x1a6ea4;})});}_0x5adc5f=_[_0x5f14('0x3b')]({},_0x5adc5f,_0x43ebab['options']);return _0x5c4606[_0x5f14('0x4a')](_0x5adc5f);}})['then'](function(_0xeaf8f6){if(_0xeaf8f6){_0x5d59f4=_0xeaf8f6['length'];if(!_0x43ebab['query'][_0x5f14('0x34')](_0x5f14('0x35'))){_0x5adc5f[_0x5f14('0x1b')]=qs['limit'](_0x43ebab[_0x5f14('0x2e')]['limit']);_0x5adc5f[_0x5f14('0x19')]=qs['offset'](_0x43ebab[_0x5f14('0x2e')]['offset']);}return _0x5c4606[_0x5f14('0x4a')](_0x5adc5f);}})['then'](function(_0x1447db){if(_0x1447db){return _0x1447db?{'count':_0x5d59f4,'rows':_0x1447db}:null;}})[_0x5f14('0x22')](respondWithResult(_0x7fbe79,null))[_0x5f14('0x43')](handleError(_0x7fbe79,null));};exports['addConfiguration']=function(_0x3397ab,_0x25e813,_0x1494b6){if(_0x3397ab['body']['id']){delete _0x3397ab[_0x5f14('0x47')]['id'];}return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x3397ab[_0x5f14('0x45')]['id']}})['then'](handleEntityNotFound(_0x25e813,null))[_0x5f14('0x22')](function(_0x425f35){if(_0x425f35){_0x3397ab[_0x5f14('0x47')][_0x5f14('0x4d')]=_0x425f35['id'];_0x3397ab[_0x5f14('0x47')]['Subjects']=integrations[_0x5f14('0x4e')](_0x3397ab['body']['channel'],_0x3397ab[_0x5f14('0x47')][_0x5f14('0x29')]);_0x3397ab['body'][_0x5f14('0x4f')]=integrations[_0x5f14('0x50')](_0x3397ab['body'][_0x5f14('0x51')],_0x3397ab[_0x5f14('0x47')][_0x5f14('0x29')]);return db['FreshsalesConfiguration'][_0x5f14('0x46')](_0x3397ab['body'],{'include':[{'model':db[_0x5f14('0x52')],'as':_0x5f14('0x53')},{'model':db[_0x5f14('0x52')],'as':_0x5f14('0x4f')}]});}return null;})[_0x5f14('0x22')](respondWithResult(_0x25e813,null))['catch'](handleError(_0x25e813,null));};exports[_0x5f14('0x54')]=function(_0x36f898,_0x3e1e4f,_0x44d943){var _0x59d454='';var _0x123339='';return db[_0x5f14('0x3e')][_0x5f14('0x4b')]({'where':{'id':_0x36f898[_0x5f14('0x45')]['id']},'attributes':['id','username',_0x5f14('0x55'),_0x5f14('0x56')]})[_0x5f14('0x22')](handleEntityNotFound(_0x3e1e4f,null))[_0x5f14('0x22')](function(_0x335a5f){if(_0x335a5f){_0x123339=_0x335a5f['username'];_0x59d454=_0x335a5f['remoteUri'];var _0x5a75a1=_0x335a5f[_0x5f14('0x55')][_0x5f14('0x57')](-0x1);if(_0x5a75a1==='/'){_0x59d454=_0x59d454[_0x5f14('0x58')](0x0,_0x59d454[_0x5f14('0x59')](_0x5a75a1));}return rp({'method':_0x5f14('0x5a'),'uri':util[_0x5f14('0x5b')](_0x5f14('0x5c'),_0x59d454,_0x5f14('0x5d')),'headers':{'Authorization':_0x5f14('0x5e')+_0x335a5f[_0x5f14('0x56')]},'json':!![]});}})[_0x5f14('0x22')](function(_0x519787){if(_0x519787){var _0x4fcdea=_0x519787['users'];var _0x4edce5=![];var _0x16fbe0=null;for(_0x16fbe0=0x0;_0x16fbe0<_0x4fcdea[_0x5f14('0x33')];_0x16fbe0++){if(_0x4fcdea[_0x16fbe0]['email']===_0x123339){_0x4edce5=!![];}}if(_0x4edce5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5f14('0x5f')});}}})[_0x5f14('0x22')](respondWithResult(_0x3e1e4f,null))['catch'](function(_0x4c4970){var _0x39b2c4=_0x36f898[_0x5f14('0x2e')][_0x5f14('0x60')]?0x1f4:_0x4c4970[_0x5f14('0x61')]||0x1f4;logger['error'](_0x5f14('0x62'),'getFields',_0x39b2c4,JSON[_0x5f14('0x63')](_0x4c4970));delete _0x4c4970[_0x5f14('0x25')];if(_0x39b2c4===0x191){_0x39b2c4=0x190;}_0x3e1e4f[_0x5f14('0x17')](_0x39b2c4)[_0x5f14('0x26')](_0x36f898[_0x5f14('0x2e')][_0x5f14('0x60')]?{'message':_0x5f14('0x64'),'statusCode':_0x4c4970[_0x5f14('0x61')]}:_0x4c4970);});}; \ No newline at end of file +var _0x7da8=['set','Content-Range','json','apply','reject','update','then','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','Token\x20token=','apiKey','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count'];(function(_0x448663,_0xdb8798){var _0x4c5d71=function(_0x6a2234){while(--_0x6a2234){_0x448663['push'](_0x448663['shift']());}};_0x4c5d71(++_0xdb8798);}(_0x7da8,0x17e));var _0x87da=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7da8[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87da('0x0'));var zipdir=require(_0x87da('0x1'));var jsonpatch=require(_0x87da('0x2'));var rp=require(_0x87da('0x3'));var moment=require(_0x87da('0x4'));var BPromise=require(_0x87da('0x5'));var Mustache=require(_0x87da('0x6'));var util=require(_0x87da('0x7'));var path=require('path');var sox=require(_0x87da('0x8'));var csv=require(_0x87da('0x9'));var ejs=require(_0x87da('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87da('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x87da('0xc'));var deskjs=require(_0x87da('0xd'));var toCsv=require(_0x87da('0x9'));var querystring=require(_0x87da('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87da('0xf'));var qs=require(_0x87da('0x10'));var as=require(_0x87da('0x11'));var hardwareService=require(_0x87da('0x12'));var logger=require(_0x87da('0x13'))(_0x87da('0x14'));var utils=require(_0x87da('0x15'));var config=require(_0x87da('0x16'));var licenseUtil=require(_0x87da('0x17'));var db=require(_0x87da('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4f7a61,_0x5eeaf7){_0x5eeaf7=_0x5eeaf7||0xcc;return function(_0xb6d377){if(_0xb6d377){return _0x4f7a61[_0x87da('0x19')](_0x5eeaf7);}return _0x4f7a61[_0x87da('0x1a')](_0x5eeaf7)['end']();};}function respondWithResult(_0x32035d,_0x4876d6){_0x4876d6=_0x4876d6||0xc8;return function(_0x332e56){if(_0x332e56){return _0x32035d[_0x87da('0x1a')](_0x4876d6)['json'](_0x332e56);}};}function respondWithFilteredResult(_0x225bff,_0x3bff6e){return function(_0x562435){if(_0x562435){var _0x2ef1ef=typeof _0x3bff6e['offset']===_0x87da('0x1b')&&typeof _0x3bff6e[_0x87da('0x1c')]==='undefined';var _0x1be26b=_0x562435[_0x87da('0x1d')];var _0x1ae754=_0x2ef1ef?0x0:_0x3bff6e['offset'];var _0x3d2194=_0x2ef1ef?_0x562435['count']:_0x3bff6e['offset']+_0x3bff6e['limit'];var _0x2e385e;if(_0x3d2194>=_0x1be26b){_0x3d2194=_0x1be26b;_0x2e385e=0xc8;}else{_0x2e385e=0xce;}_0x225bff[_0x87da('0x1a')](_0x2e385e);return _0x225bff[_0x87da('0x1e')](_0x87da('0x1f'),_0x1ae754+'-'+_0x3d2194+'/'+_0x1be26b)[_0x87da('0x20')](_0x562435);}return null;};}function patchUpdates(_0x3174c5){return function(_0x2087db){try{jsonpatch[_0x87da('0x21')](_0x2087db,_0x3174c5,!![]);}catch(_0x3488a3){return BPromise[_0x87da('0x22')](_0x3488a3);}return _0x2087db['save']();};}function saveUpdates(_0x53abd2,_0x26284d){return function(_0x349410){if(_0x349410){return _0x349410[_0x87da('0x23')](_0x53abd2)['then'](function(_0x5ad228){return _0x5ad228;});}return null;};}function removeEntity(_0x325c2f,_0xdfb423){return function(_0x49cf71){if(_0x49cf71){return _0x49cf71['destroy']()[_0x87da('0x24')](function(){_0x325c2f[_0x87da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7934dd,_0x2e4f0d){return function(_0x3cd779){if(!_0x3cd779){_0x7934dd[_0x87da('0x19')](0x194);}return _0x3cd779;};}function handleError(_0xda5f14,_0x493e39){_0x493e39=_0x493e39||0x1f4;return function(_0x407792){logger[_0x87da('0x25')](_0x407792[_0x87da('0x26')]);if(_0x407792['name']){delete _0x407792[_0x87da('0x27')];}_0xda5f14['status'](_0x493e39)['send'](_0x407792);};}exports[_0x87da('0x28')]=function(_0x50ff7c,_0x559281){var _0x462f19={},_0x48e032={},_0x1c16df={'count':0x0,'rows':[]};var _0x43c5be=_[_0x87da('0x29')](db[_0x87da('0x2a')][_0x87da('0x2b')],function(_0x3e8385){return{'name':_0x3e8385[_0x87da('0x2c')],'type':_0x3e8385['type'][_0x87da('0x2d')]};});_0x48e032[_0x87da('0x2e')]=_[_0x87da('0x29')](_0x43c5be,_0x87da('0x27'));_0x48e032[_0x87da('0x2f')]=_[_0x87da('0x30')](_0x50ff7c[_0x87da('0x2f')]);_0x48e032[_0x87da('0x31')]=_[_0x87da('0x32')](_0x48e032[_0x87da('0x2e')],_0x48e032[_0x87da('0x2f')]);_0x462f19['attributes']=_[_0x87da('0x32')](_0x48e032['model'],qs[_0x87da('0x33')](_0x50ff7c[_0x87da('0x2f')]['fields']));_0x462f19[_0x87da('0x34')]=_0x462f19['attributes'][_0x87da('0x35')]?_0x462f19[_0x87da('0x34')]:_0x48e032[_0x87da('0x2e')];if(!_0x50ff7c['query'][_0x87da('0x36')](_0x87da('0x37'))){_0x462f19[_0x87da('0x1c')]=qs[_0x87da('0x1c')](_0x50ff7c['query']['limit']);_0x462f19['offset']=qs[_0x87da('0x38')](_0x50ff7c[_0x87da('0x2f')][_0x87da('0x38')]);}_0x462f19['order']=qs['sort'](_0x50ff7c[_0x87da('0x2f')][_0x87da('0x39')]);_0x462f19[_0x87da('0x3a')]=qs['filters'](_[_0x87da('0x3b')](_0x50ff7c[_0x87da('0x2f')],_0x48e032[_0x87da('0x31')]),_0x43c5be);if(_0x50ff7c[_0x87da('0x2f')]['filter']){_0x462f19[_0x87da('0x3a')]=_[_0x87da('0x3c')](_0x462f19['where'],{'$or':_[_0x87da('0x29')](_0x43c5be,function(_0x339ad4){if(_0x339ad4[_0x87da('0x3d')]!==_0x87da('0x3e')){var _0x5bf612={};_0x5bf612[_0x339ad4[_0x87da('0x27')]]={'$like':'%'+_0x50ff7c[_0x87da('0x2f')][_0x87da('0x3f')]+'%'};return _0x5bf612;}})});}_0x462f19=_[_0x87da('0x3c')]({},_0x462f19,_0x50ff7c[_0x87da('0x40')]);var _0x260d8a={'where':_0x462f19[_0x87da('0x3a')]};return db[_0x87da('0x2a')][_0x87da('0x1d')](_0x260d8a)[_0x87da('0x24')](function(_0x4bf0d5){_0x1c16df[_0x87da('0x1d')]=_0x4bf0d5;if(_0x50ff7c[_0x87da('0x2f')][_0x87da('0x41')]){_0x462f19[_0x87da('0x42')]=[{'all':!![]}];}return db[_0x87da('0x2a')]['findAll'](_0x462f19);})[_0x87da('0x24')](function(_0xa7f1c8){_0x1c16df[_0x87da('0x43')]=_0xa7f1c8;return _0x1c16df;})[_0x87da('0x24')](respondWithFilteredResult(_0x559281,_0x462f19))['catch'](handleError(_0x559281,null));};exports[_0x87da('0x44')]=function(_0x121d0c,_0x375867){var _0x454786={'raw':![],'where':{'id':_0x121d0c[_0x87da('0x45')]['id']}},_0x500a22={};_0x500a22[_0x87da('0x2e')]=_[_0x87da('0x30')](db[_0x87da('0x2a')][_0x87da('0x2b')]);_0x500a22['query']=_['keys'](_0x121d0c[_0x87da('0x2f')]);_0x500a22[_0x87da('0x31')]=_['intersection'](_0x500a22[_0x87da('0x2e')],_0x500a22['query']);_0x454786['attributes']=_['intersection'](_0x500a22[_0x87da('0x2e')],qs['fields'](_0x121d0c[_0x87da('0x2f')][_0x87da('0x33')]));_0x454786[_0x87da('0x34')]=_0x454786[_0x87da('0x34')]['length']?_0x454786[_0x87da('0x34')]:_0x500a22[_0x87da('0x2e')];if(_0x121d0c[_0x87da('0x2f')][_0x87da('0x41')]){_0x454786['include']=[{'all':!![]}];}_0x454786=_[_0x87da('0x3c')]({},_0x454786,_0x121d0c[_0x87da('0x40')]);return db[_0x87da('0x2a')][_0x87da('0x46')](_0x454786)[_0x87da('0x24')](handleEntityNotFound(_0x375867,null))[_0x87da('0x24')](respondWithResult(_0x375867,null))[_0x87da('0x47')](handleError(_0x375867,null));};exports[_0x87da('0x48')]=function(_0x177e1d,_0x22d6c1){return db['FreshsalesAccount'][_0x87da('0x48')](_0x177e1d[_0x87da('0x49')],{})[_0x87da('0x24')](respondWithResult(_0x22d6c1,0xc9))[_0x87da('0x47')](handleError(_0x22d6c1,null));};exports['update']=function(_0x48ed75,_0x2cb639){if(_0x48ed75[_0x87da('0x49')]['id']){delete _0x48ed75[_0x87da('0x49')]['id'];}return db[_0x87da('0x2a')][_0x87da('0x46')]({'where':{'id':_0x48ed75[_0x87da('0x45')]['id']}})[_0x87da('0x24')](handleEntityNotFound(_0x2cb639,null))[_0x87da('0x24')](saveUpdates(_0x48ed75[_0x87da('0x49')],null))[_0x87da('0x24')](respondWithResult(_0x2cb639,null))['catch'](handleError(_0x2cb639,null));};exports[_0x87da('0x4a')]=function(_0x4d7aa5,_0x4f9935){return db[_0x87da('0x2a')][_0x87da('0x46')]({'where':{'id':_0x4d7aa5[_0x87da('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f9935,null))[_0x87da('0x24')](removeEntity(_0x4f9935,null))[_0x87da('0x47')](handleError(_0x4f9935,null));};exports['getConfigurations']=function(_0x2381b9,_0x1aa3b3,_0xcb3ffb){var _0x482f65={};var _0x1d8a67={};var _0x1146ee;var _0x5e130;return db['FreshsalesAccount'][_0x87da('0x4b')]({'where':{'id':_0x2381b9[_0x87da('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aa3b3,null))[_0x87da('0x24')](function(_0x5aa27d){if(_0x5aa27d){_0x1146ee=_0x5aa27d;_0x1d8a67['model']=_[_0x87da('0x30')](db['FreshsalesConfiguration'][_0x87da('0x2b')]);_0x1d8a67[_0x87da('0x2f')]=_[_0x87da('0x30')](_0x2381b9['query']);_0x1d8a67['filters']=_[_0x87da('0x32')](_0x1d8a67[_0x87da('0x2e')],_0x1d8a67['query']);_0x482f65[_0x87da('0x34')]=_[_0x87da('0x32')](_0x1d8a67[_0x87da('0x2e')],qs['fields'](_0x2381b9[_0x87da('0x2f')][_0x87da('0x33')]));_0x482f65[_0x87da('0x34')]=_0x482f65[_0x87da('0x34')][_0x87da('0x35')]?_0x482f65[_0x87da('0x34')]:_0x1d8a67[_0x87da('0x2e')];_0x482f65['order']=qs[_0x87da('0x39')](_0x2381b9['query'][_0x87da('0x39')]);_0x482f65['where']=qs[_0x87da('0x31')](_[_0x87da('0x3b')](_0x2381b9[_0x87da('0x2f')],_0x1d8a67[_0x87da('0x31')]));if(_0x2381b9[_0x87da('0x2f')][_0x87da('0x3f')]){_0x482f65[_0x87da('0x3a')]=_[_0x87da('0x3c')](_0x482f65[_0x87da('0x3a')],{'$or':_[_0x87da('0x29')](_0x482f65[_0x87da('0x34')],function(_0x52420c){var _0x2e65db={};_0x2e65db[_0x52420c]={'$like':'%'+_0x2381b9[_0x87da('0x2f')][_0x87da('0x3f')]+'%'};return _0x2e65db;})});}_0x482f65=_[_0x87da('0x3c')]({},_0x482f65,_0x2381b9[_0x87da('0x40')]);return _0x1146ee['getConfigurations'](_0x482f65);}})[_0x87da('0x24')](function(_0x3b0ac9){if(_0x3b0ac9){_0x5e130=_0x3b0ac9[_0x87da('0x35')];if(!_0x2381b9[_0x87da('0x2f')][_0x87da('0x36')](_0x87da('0x37'))){_0x482f65['limit']=qs['limit'](_0x2381b9[_0x87da('0x2f')][_0x87da('0x1c')]);_0x482f65[_0x87da('0x38')]=qs['offset'](_0x2381b9[_0x87da('0x2f')][_0x87da('0x38')]);}return _0x1146ee[_0x87da('0x4c')](_0x482f65);}})[_0x87da('0x24')](function(_0x54bf88){if(_0x54bf88){return _0x54bf88?{'count':_0x5e130,'rows':_0x54bf88}:null;}})[_0x87da('0x24')](respondWithResult(_0x1aa3b3,null))['catch'](handleError(_0x1aa3b3,null));};exports[_0x87da('0x4d')]=function(_0x30640f,_0x3a3149,_0x44cd30){if(_0x30640f[_0x87da('0x49')]['id']){delete _0x30640f[_0x87da('0x49')]['id'];}return db[_0x87da('0x2a')][_0x87da('0x4b')]({'where':{'id':_0x30640f[_0x87da('0x45')]['id']}})[_0x87da('0x24')](handleEntityNotFound(_0x3a3149,null))[_0x87da('0x24')](function(_0x4cbd7b){if(_0x4cbd7b){_0x30640f['body'][_0x87da('0x4e')]=_0x4cbd7b['id'];_0x30640f[_0x87da('0x49')][_0x87da('0x4f')]=integrations[_0x87da('0x50')](_0x30640f[_0x87da('0x49')][_0x87da('0x51')],_0x30640f[_0x87da('0x49')][_0x87da('0x3d')]);_0x30640f['body'][_0x87da('0x52')]=integrations[_0x87da('0x53')](_0x30640f[_0x87da('0x49')]['channel'],_0x30640f['body'][_0x87da('0x3d')]);return db[_0x87da('0x54')][_0x87da('0x48')](_0x30640f[_0x87da('0x49')],{'include':[{'model':db[_0x87da('0x55')],'as':_0x87da('0x4f')},{'model':db[_0x87da('0x55')],'as':_0x87da('0x52')}]});}return null;})[_0x87da('0x24')](respondWithResult(_0x3a3149,null))[_0x87da('0x47')](handleError(_0x3a3149,null));};exports[_0x87da('0x56')]=function(_0x54e7ac,_0x528929,_0xfb7043){var _0x32d197='';var _0x1e7a38='';return db[_0x87da('0x2a')][_0x87da('0x4b')]({'where':{'id':_0x54e7ac[_0x87da('0x45')]['id']},'attributes':['id',_0x87da('0x57'),_0x87da('0x58'),'apiKey']})['then'](handleEntityNotFound(_0x528929,null))['then'](function(_0x351642){if(_0x351642){_0x1e7a38=_0x351642[_0x87da('0x57')];_0x32d197=_0x351642[_0x87da('0x58')];var _0x549fab=_0x351642['remoteUri'][_0x87da('0x59')](-0x1);if(_0x549fab==='/'){_0x32d197=_0x32d197['substring'](0x0,_0x32d197[_0x87da('0x5a')](_0x549fab));}return rp({'method':_0x87da('0x5b'),'uri':util[_0x87da('0x5c')](_0x87da('0x5d'),_0x32d197,'/api/selector/owners'),'headers':{'Authorization':_0x87da('0x5e')+_0x351642[_0x87da('0x5f')]},'json':!![]});}})[_0x87da('0x24')](function(_0x10b36b){if(_0x10b36b){var _0x1445a0=_0x10b36b['users'];var _0x2b17d5=![];var _0x53b1cf=null;for(_0x53b1cf=0x0;_0x53b1cf<_0x1445a0[_0x87da('0x35')];_0x53b1cf++){if(_0x1445a0[_0x53b1cf][_0x87da('0x60')]===_0x1e7a38){_0x2b17d5=!![];}}if(_0x2b17d5){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x528929,null))['catch'](function(_0x7bf0ac){var _0x23cd13=_0x54e7ac['query'][_0x87da('0x61')]?0x1f4:_0x7bf0ac[_0x87da('0x62')]||0x1f4;logger[_0x87da('0x25')](_0x87da('0x63'),_0x87da('0x56'),_0x23cd13,JSON[_0x87da('0x64')](_0x7bf0ac));delete _0x7bf0ac[_0x87da('0x27')];if(_0x23cd13===0x191){_0x23cd13=0x190;}_0x528929[_0x87da('0x1a')](_0x23cd13)[_0x87da('0x65')](_0x54e7ac[_0x87da('0x2f')][_0x87da('0x61')]?{'message':_0x87da('0x66'),'statusCode':_0x7bf0ac[_0x87da('0x62')]}:_0x7bf0ac);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 251b39d..5a1fb00 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 _0x430c=['define','FreshsalesAccount','int_freshsales_accounts','lodash','api','moment','bluebird','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x5ec726,_0x202923){var _0x17312a=function(_0x33afbe){while(--_0x33afbe){_0x5ec726['push'](_0x5ec726['shift']());}};_0x17312a(++_0x202923);}(_0x430c,0x1a1));var _0xc430=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x430c[_0x6c0123];return _0x5a87d2;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));var integrations=require(_0xc430('0x5'));module['exports']=function(_0x42aa9c,_0x4de44f){return _0x42aa9c[_0xc430('0x6')](_0xc430('0x7'),attributes,{'tableName':_0xc430('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ace=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xc069,_0x3005d6){_0xc069=_0xc069-0x0;var _0x3f143c=_0x8ace[_0xc069];return _0x3f143c;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var logger=require(_0xe8ac('0x2'))(_0xe8ac('0x3'));var moment=require(_0xe8ac('0x4'));var BPromise=require(_0xe8ac('0x5'));var rp=require(_0xe8ac('0x6'));var fs=require('fs');var path=require(_0xe8ac('0x7'));var rimraf=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var attributes=require(_0xe8ac('0xa'));var integrations=require(_0xe8ac('0xb'));module[_0xe8ac('0xc')]=function(_0x2b48ec,_0x4eb087){return _0x2b48ec[_0xe8ac('0xd')](_0xe8ac('0xe'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index af8e2a5..3a95077 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 _0x9582=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','FreshsalesAccount','options','raw','limit','include','map','model','attributes','then','GetFreshsalesAccount','ShowFreshsalesAccount','find'];(function(_0x10f596,_0x30776f){var _0x169e83=function(_0x3747ba){while(--_0x3747ba){_0x10f596['push'](_0x10f596['shift']());}};_0x169e83(++_0x30776f);}(_0x9582,0x95));var _0x2958=function(_0x11404f,_0x3ccd42){_0x11404f=_0x11404f-0x0;var _0x4ff0a7=_0x9582[_0x11404f];return _0x4ff0a7;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309525,_0xa385ec,_0x2e571b){return new BPromise(function(_0x56ca85,_0x5ec1b3){return client[_0x2958('0xd')](_0x309525,_0x2e571b)['then'](function(_0x10db1e){logger['info'](_0x2958('0xe'),_0xa385ec,'request\x20sent');logger[_0x2958('0xf')](_0x2958('0x10'),_0xa385ec,_0x2958('0x11'),JSON[_0x2958('0x12')](_0x10db1e));if(_0x10db1e[_0x2958('0x13')]){if(_0x10db1e['error'][_0x2958('0x14')]===0x1f4){logger[_0x2958('0x13')](_0x2958('0xe'),_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x5ec1b3(_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);}logger[_0x2958('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0xa385ec,_0x10db1e[_0x2958('0x13')][_0x2958('0x15')]);return _0x56ca85(_0x10db1e['error']['message']);}else{logger[_0x2958('0x16')](_0x2958('0xe'),_0xa385ec,'request\x20sent');_0x56ca85(_0x10db1e[_0x2958('0x17')]['message']);}})['catch'](function(_0x429d42){logger[_0x2958('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['GetFreshsalesAccount']=function(_0x28a92c){var _0x160949=this;return new Promise(function(_0x310d07,_0x42bb99){return db[_0x2958('0x18')]['findAll']({'raw':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x28a92c['options']?_0x28a92c[_0x2958('0x19')]['where']||null:null,'attributes':_0x28a92c[_0x2958('0x19')]?_0x28a92c['options']['attributes']||null:null,'limit':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1b')]||null:null,'include':_0x28a92c[_0x2958('0x19')]?_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x28a92c[_0x2958('0x19')][_0x2958('0x1c')],function(_0x2aa514){return{'model':db[_0x2aa514[_0x2958('0x1e')]],'as':_0x2aa514['as'],'attributes':_0x2aa514[_0x2958('0x1f')],'include':_0x2aa514[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x2aa514[_0x2958('0x1c')],function(_0x4f811a){return{'model':db[_0x4f811a['model']],'as':_0x4f811a['as'],'attributes':_0x4f811a[_0x2958('0x1f')],'include':_0x4f811a[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x4f811a[_0x2958('0x1c')],function(_0x52bd32){return{'model':db[_0x52bd32[_0x2958('0x1e')]],'as':_0x52bd32['as'],'attributes':_0x52bd32['attributes']};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0x40adce){logger[_0x2958('0x16')](_0x2958('0x21'),_0x28a92c);logger[_0x2958('0xf')](_0x2958('0x21'),_0x28a92c,JSON[_0x2958('0x12')](_0x40adce));_0x310d07(_0x40adce);})['catch'](function(_0x21b919){logger['error']('GetFreshsalesAccount',_0x21b919[_0x2958('0x15')],_0x28a92c);_0x42bb99(_0x160949[_0x2958('0x13')](0x1f4,_0x21b919[_0x2958('0x15')]));});});};exports[_0x2958('0x22')]=function(_0x584179){var _0x2d9472=this;return new Promise(function(_0x222b83,_0x2c73e9){return db['FreshsalesAccount'][_0x2958('0x23')]({'raw':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1a')]===undefined?!![]:![]:!![],'where':_0x584179['options']?_0x584179[_0x2958('0x19')]['where']||null:null,'attributes':_0x584179[_0x2958('0x19')]?_0x584179['options'][_0x2958('0x1f')]||null:null,'include':_0x584179[_0x2958('0x19')]?_0x584179[_0x2958('0x19')][_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x584179[_0x2958('0x19')][_0x2958('0x1c')],function(_0x58f9b4){return{'model':db[_0x58f9b4[_0x2958('0x1e')]],'as':_0x58f9b4['as'],'attributes':_0x58f9b4['attributes'],'include':_0x58f9b4[_0x2958('0x1c')]?_['map'](_0x58f9b4[_0x2958('0x1c')],function(_0x517f55){return{'model':db[_0x517f55[_0x2958('0x1e')]],'as':_0x517f55['as'],'attributes':_0x517f55[_0x2958('0x1f')],'include':_0x517f55[_0x2958('0x1c')]?_[_0x2958('0x1d')](_0x517f55[_0x2958('0x1c')],function(_0x24aca5){return{'model':db[_0x24aca5[_0x2958('0x1e')]],'as':_0x24aca5['as'],'attributes':_0x24aca5[_0x2958('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2958('0x20')](function(_0xc4a303){logger[_0x2958('0x16')](_0x2958('0x22'),_0x584179);logger[_0x2958('0xf')]('ShowFreshsalesAccount',_0x584179,JSON[_0x2958('0x12')](_0xc4a303));_0x222b83(_0xc4a303);})[_0x2958('0x24')](function(_0x281817){logger[_0x2958('0x13')]('ShowFreshsalesAccount',_0x281817[_0x2958('0x15')],_0x584179);_0x2c73e9(_0x2d9472[_0x2958('0x13')](0x1f4,_0x281817[_0x2958('0x15')]));});});}; \ No newline at end of file +var _0x7096=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','find','ShowFreshsalesAccount','util','bluebird','ioredis','../../mysqldb'];(function(_0xaa8c2c,_0x36d94f){var _0x18f841=function(_0x332014){while(--_0x332014){_0xaa8c2c['push'](_0xaa8c2c['shift']());}};_0x18f841(++_0x36d94f);}(_0x7096,0x10c));var _0x6709=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7096[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var moment=require('moment');var BPromise=require(_0x6709('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];var utils=require(_0x6709('0x4'));var logger=require(_0x6709('0x5'))(_0x6709('0x6'));var config=require(_0x6709('0x7'));var jayson=require(_0x6709('0x8'));var client=jayson[_0x6709('0x9')][_0x6709('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e2223,_0x11ad23,_0x985814){return new BPromise(function(_0x30147f,_0x513ab6){return client['request'](_0x3e2223,_0x985814)[_0x6709('0xb')](function(_0x2d8c0b){logger[_0x6709('0xc')](_0x6709('0xd'),_0x11ad23,_0x6709('0xe'));logger[_0x6709('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x11ad23,'request\x20sent',JSON[_0x6709('0x10')](_0x2d8c0b));if(_0x2d8c0b[_0x6709('0x11')]){if(_0x2d8c0b[_0x6709('0x11')][_0x6709('0x12')]===0x1f4){logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')][_0x6709('0x13')]);return _0x513ab6(_0x2d8c0b['error'][_0x6709('0x13')]);}logger[_0x6709('0x11')](_0x6709('0xd'),_0x11ad23,_0x2d8c0b[_0x6709('0x11')]['message']);return _0x30147f(_0x2d8c0b[_0x6709('0x11')]['message']);}else{logger[_0x6709('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});}exports[_0x6709('0x16')]=function(_0x235a54){var _0x4a732e=this;return new Promise(function(_0x9c1fd8,_0x166c97){return db[_0x6709('0x17')]['findAll']({'raw':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x235a54[_0x6709('0x18')]?_0x235a54['options'][_0x6709('0x1a')]||null:null,'attributes':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1b')]||null:null,'limit':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1c')]||null:null,'include':_0x235a54[_0x6709('0x18')]?_0x235a54[_0x6709('0x18')][_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x235a54[_0x6709('0x18')]['include'],function(_0x29f25f){return{'model':db[_0x29f25f[_0x6709('0x1f')]],'as':_0x29f25f['as'],'attributes':_0x29f25f[_0x6709('0x1b')],'include':_0x29f25f['include']?_[_0x6709('0x1e')](_0x29f25f[_0x6709('0x1d')],function(_0x20a347){return{'model':db[_0x20a347[_0x6709('0x1f')]],'as':_0x20a347['as'],'attributes':_0x20a347['attributes'],'include':_0x20a347[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x20a347['include'],function(_0x585073){return{'model':db[_0x585073[_0x6709('0x1f')]],'as':_0x585073['as'],'attributes':_0x585073['attributes']};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x2499a2){logger['info'](_0x6709('0x16'),_0x235a54);logger['debug'](_0x6709('0x16'),_0x235a54,JSON[_0x6709('0x10')](_0x2499a2));_0x9c1fd8(_0x2499a2);})['catch'](function(_0x137137){logger['error'](_0x6709('0x16'),_0x137137[_0x6709('0x13')],_0x235a54);_0x166c97(_0x4a732e['error'](0x1f4,_0x137137[_0x6709('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x138318){var _0x135f46=this;return new Promise(function(_0x4b93b2,_0x564dcb){return db[_0x6709('0x17')][_0x6709('0x20')]({'raw':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x19')]===undefined?!![]:![]:!![],'where':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1a')]||null:null,'attributes':_0x138318[_0x6709('0x18')]?_0x138318['options'][_0x6709('0x1b')]||null:null,'include':_0x138318[_0x6709('0x18')]?_0x138318[_0x6709('0x18')][_0x6709('0x1d')]?_['map'](_0x138318[_0x6709('0x18')][_0x6709('0x1d')],function(_0x124e01){return{'model':db[_0x124e01[_0x6709('0x1f')]],'as':_0x124e01['as'],'attributes':_0x124e01['attributes'],'include':_0x124e01[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x124e01['include'],function(_0x8952f1){return{'model':db[_0x8952f1[_0x6709('0x1f')]],'as':_0x8952f1['as'],'attributes':_0x8952f1['attributes'],'include':_0x8952f1[_0x6709('0x1d')]?_[_0x6709('0x1e')](_0x8952f1[_0x6709('0x1d')],function(_0xf30c4c){return{'model':db[_0xf30c4c[_0x6709('0x1f')]],'as':_0xf30c4c['as'],'attributes':_0xf30c4c[_0x6709('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6709('0xb')](function(_0x4bfed4){logger[_0x6709('0xc')](_0x6709('0x21'),_0x138318);logger['debug'](_0x6709('0x21'),_0x138318,JSON[_0x6709('0x10')](_0x4bfed4));_0x4b93b2(_0x4bfed4);})[_0x6709('0x15')](function(_0x2bb89c){logger[_0x6709('0x11')](_0x6709('0x21'),_0x2bb89c['message'],_0x138318);_0x564dcb(_0x135f46[_0x6709('0x11')](0x1f4,_0x2bb89c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c14f427..6baf8f9 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 _0x11d2=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy'];(function(_0xd05552,_0xc3f3d4){var _0x2567df=function(_0x3e8c28){while(--_0x3e8c28){_0xd05552['push'](_0xd05552['shift']());}};_0x2567df(++_0xc3f3d4);}(_0x11d2,0x1b6));var _0x211d=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x11d2[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x211d('0x0'));var util=require('util');var path=require(_0x211d('0x1'));var timeout=require('connect-timeout');var express=require(_0x211d('0x2'));var router=express[_0x211d('0x3')]();var fs_extra=require(_0x211d('0x4'));var auth=require(_0x211d('0x5'));var interaction=require(_0x211d('0x6'));var config=require('../../config/environment');var controller=require(_0x211d('0x7'));router['get']('/',auth[_0x211d('0x8')](),controller[_0x211d('0x9')]);router[_0x211d('0xa')](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0xc')]);router[_0x211d('0xa')](_0x211d('0xd'),auth[_0x211d('0x8')](),controller[_0x211d('0xe')]);router['get'](_0x211d('0xf'),auth[_0x211d('0x8')](),controller[_0x211d('0x10')]);router[_0x211d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x211d('0x11')]('/',auth[_0x211d('0x8')](),controller[_0x211d('0x12')]);router[_0x211d('0x13')](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0x14')]);router['delete'](_0x211d('0xb'),auth[_0x211d('0x8')](),controller[_0x211d('0x15')]);module[_0x211d('0x16')]=router; \ No newline at end of file +var _0x2b5a=['getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0xb3a08a,_0x16324e){var _0x163346=function(_0x6c2337){while(--_0x6c2337){_0xb3a08a['push'](_0xb3a08a['shift']());}};_0x163346(++_0x16324e);}(_0x2b5a,0xc0));var _0xa2b5=function(_0x2a8238,_0x1e5d8){_0x2a8238=_0x2a8238-0x0;var _0x3c3a88=_0x2b5a[_0x2a8238];return _0x3c3a88;};'use strict';var multer=require(_0xa2b5('0x0'));var util=require(_0xa2b5('0x1'));var path=require(_0xa2b5('0x2'));var timeout=require(_0xa2b5('0x3'));var express=require('express');var router=express[_0xa2b5('0x4')]();var fs_extra=require(_0xa2b5('0x5'));var auth=require(_0xa2b5('0x6'));var interaction=require(_0xa2b5('0x7'));var config=require(_0xa2b5('0x8'));var controller=require(_0xa2b5('0x9'));router[_0xa2b5('0xa')]('/',auth[_0xa2b5('0xb')](),controller[_0xa2b5('0xc')]);router[_0xa2b5('0xa')](_0xa2b5('0xd'),auth['isAuthenticated'](),controller[_0xa2b5('0xe')]);router[_0xa2b5('0xa')](_0xa2b5('0xf'),auth[_0xa2b5('0xb')](),controller[_0xa2b5('0x10')]);router[_0xa2b5('0xa')](_0xa2b5('0x11'),auth[_0xa2b5('0xb')](),controller[_0xa2b5('0x12')]);router[_0xa2b5('0xa')](_0xa2b5('0x13'),auth[_0xa2b5('0xb')](),controller[_0xa2b5('0x14')]);router['post']('/',auth[_0xa2b5('0xb')](),controller['create']);router[_0xa2b5('0x15')](_0xa2b5('0xd'),auth[_0xa2b5('0xb')](),controller[_0xa2b5('0x16')]);router[_0xa2b5('0x17')](_0xa2b5('0xd'),auth['isAuthenticated'](),controller[_0xa2b5('0x18')]);module[_0xa2b5('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2e5322c..37d8a13 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 _0xef38=['sequelize','exports','STRING'];(function(_0x39fc7a,_0x3a3ac3){var _0x1277c5=function(_0x2fa08d){while(--_0x2fa08d){_0x39fc7a['push'](_0x39fc7a['shift']());}};_0x1277c5(++_0x3a3ac3);}(_0xef38,0x1d7));var _0x8ef3=function(_0x17cef1,_0x2ec1a2){_0x17cef1=_0x17cef1-0x0;var _0xd67b10=_0xef38[_0x17cef1];return _0xd67b10;};'use strict';var Sequelize=require(_0x8ef3('0x0'));module[_0x8ef3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8ef3('0x2')]}}; \ No newline at end of file +var _0x04a9=['exports','STRING','sequelize'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x04a9,0x16d));var _0x904a=function(_0xcd59b2,_0x1f5c43){_0xcd59b2=_0xcd59b2-0x0;var _0x44837d=_0x04a9[_0xcd59b2];return _0x44837d;};'use strict';var Sequelize=require(_0x904a('0x0'));module[_0x904a('0x1')]={'name':{'type':Sequelize[_0x904a('0x2')]},'description':{'type':Sequelize[_0x904a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8c0464d..ed1eb1c 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 _0x7651=['length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','getFields','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3b392c,_0x72f9ff){var _0x486928=function(_0x25b372){while(--_0x25b372){_0x3b392c['push'](_0x3b392c['shift']());}};_0x486928(++_0x72f9ff);}(_0x7651,0x6c));var _0x1765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7651[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1765('0x0'));var rimraf=require(_0x1765('0x1'));var zipdir=require(_0x1765('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1765('0x3'));var BPromise=require(_0x1765('0x4'));var Mustache=require(_0x1765('0x5'));var util=require(_0x1765('0x6'));var path=require(_0x1765('0x7'));var sox=require(_0x1765('0x8'));var csv=require(_0x1765('0x9'));var ejs=require(_0x1765('0xa'));var fs=require('fs');var fs_extra=require(_0x1765('0xb'));var _=require(_0x1765('0xc'));var squel=require(_0x1765('0xd'));var crypto=require(_0x1765('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1765('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1765('0x10'));var Papa=require(_0x1765('0x11'));var Redis=require('ioredis');var authService=require(_0x1765('0x12'));var qs=require(_0x1765('0x13'));var as=require(_0x1765('0x14'));var hardwareService=require(_0x1765('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1765('0x16'));var config=require(_0x1765('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1765('0x18'))['db'];function respondWithStatusCode(_0x23d93d,_0x3b6c3a){_0x3b6c3a=_0x3b6c3a||0xcc;return function(_0x1e5d74){if(_0x1e5d74){return _0x23d93d['sendStatus'](_0x3b6c3a);}return _0x23d93d[_0x1765('0x19')](_0x3b6c3a)['end']();};}function respondWithResult(_0x35652f,_0x439194){_0x439194=_0x439194||0xc8;return function(_0x2be0ae){if(_0x2be0ae){return _0x35652f[_0x1765('0x19')](_0x439194)[_0x1765('0x1a')](_0x2be0ae);}};}function respondWithFilteredResult(_0x2213ec,_0x5fb7e2){return function(_0x43c82f){if(_0x43c82f){var _0x1e48ef=typeof _0x5fb7e2[_0x1765('0x1b')]===_0x1765('0x1c')&&typeof _0x5fb7e2[_0x1765('0x1d')]===_0x1765('0x1c');var _0x4583cf=_0x43c82f['count'];var _0xdf0e44=_0x1e48ef?0x0:_0x5fb7e2[_0x1765('0x1b')];var _0x1892b5=_0x1e48ef?_0x43c82f[_0x1765('0x1e')]:_0x5fb7e2[_0x1765('0x1b')]+_0x5fb7e2[_0x1765('0x1d')];var _0x33971b;if(_0x1892b5>=_0x4583cf){_0x1892b5=_0x4583cf;_0x33971b=0xc8;}else{_0x33971b=0xce;}_0x2213ec[_0x1765('0x19')](_0x33971b);return _0x2213ec[_0x1765('0x1f')](_0x1765('0x20'),_0xdf0e44+'-'+_0x1892b5+'/'+_0x4583cf)[_0x1765('0x1a')](_0x43c82f);}return null;};}function patchUpdates(_0x50b08d){return function(_0x1ce006){try{jsonpatch[_0x1765('0x21')](_0x1ce006,_0x50b08d,!![]);}catch(_0x148e0a){return BPromise[_0x1765('0x22')](_0x148e0a);}return _0x1ce006[_0x1765('0x23')]();};}function saveUpdates(_0x2b4a99,_0x5be216){return function(_0x138216){if(_0x138216){return _0x138216[_0x1765('0x24')](_0x2b4a99)['then'](function(_0x562af0){return _0x562af0;});}return null;};}function removeEntity(_0x4a0bb4,_0x4e4c2a){return function(_0x3b40c3){if(_0x3b40c3){return _0x3b40c3[_0x1765('0x25')]()[_0x1765('0x26')](function(){_0x4a0bb4[_0x1765('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293003,_0x6ad7ab){return function(_0x1b3fda){if(!_0x1b3fda){_0x293003[_0x1765('0x27')](0x194);}return _0x1b3fda;};}function handleError(_0x579994,_0x2762f3){_0x2762f3=_0x2762f3||0x1f4;return function(_0x2936f){logger[_0x1765('0x28')](_0x2936f[_0x1765('0x29')]);if(_0x2936f[_0x1765('0x2a')]){delete _0x2936f['name'];}_0x579994[_0x1765('0x19')](_0x2762f3)[_0x1765('0x2b')](_0x2936f);};}exports[_0x1765('0x2c')]=function(_0x109468,_0x1c395e){var _0x3b0a62={},_0x65137c={},_0x3e3882={'count':0x0,'rows':[]};var _0x311da4=_[_0x1765('0x2d')](db[_0x1765('0x2e')][_0x1765('0x2f')],function(_0x589522){return{'name':_0x589522['fieldName'],'type':_0x589522[_0x1765('0x30')]['key']};});_0x65137c['model']=_[_0x1765('0x2d')](_0x311da4,_0x1765('0x2a'));_0x65137c[_0x1765('0x31')]=_[_0x1765('0x32')](_0x109468['query']);_0x65137c[_0x1765('0x33')]=_[_0x1765('0x34')](_0x65137c[_0x1765('0x35')],_0x65137c[_0x1765('0x31')]);_0x3b0a62[_0x1765('0x36')]=_['intersection'](_0x65137c[_0x1765('0x35')],qs[_0x1765('0x37')](_0x109468[_0x1765('0x31')]['fields']));_0x3b0a62[_0x1765('0x36')]=_0x3b0a62[_0x1765('0x36')][_0x1765('0x38')]?_0x3b0a62[_0x1765('0x36')]:_0x65137c[_0x1765('0x35')];if(!_0x109468[_0x1765('0x31')][_0x1765('0x39')]('nolimit')){_0x3b0a62['limit']=qs[_0x1765('0x1d')](_0x109468['query']['limit']);_0x3b0a62[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x109468[_0x1765('0x31')][_0x1765('0x1b')]);}_0x3b0a62[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x109468[_0x1765('0x31')][_0x1765('0x3b')]);_0x3b0a62['where']=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x109468[_0x1765('0x31')],_0x65137c[_0x1765('0x33')]),_0x311da4);if(_0x109468[_0x1765('0x31')][_0x1765('0x3d')]){_0x3b0a62[_0x1765('0x3e')]=_['merge'](_0x3b0a62[_0x1765('0x3e')],{'$or':_['map'](_0x311da4,function(_0xf11f2c){if(_0xf11f2c['type']!==_0x1765('0x3f')){var _0x496504={};_0x496504[_0xf11f2c['name']]={'$like':'%'+_0x109468[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x496504;}})});}_0x3b0a62=_[_0x1765('0x40')]({},_0x3b0a62,_0x109468[_0x1765('0x41')]);var _0x1e521a={'where':_0x3b0a62[_0x1765('0x3e')]};return db['FreshsalesConfiguration'][_0x1765('0x1e')](_0x1e521a)[_0x1765('0x26')](function(_0x284a87){_0x3e3882[_0x1765('0x1e')]=_0x284a87;if(_0x109468[_0x1765('0x31')][_0x1765('0x42')]){_0x3b0a62[_0x1765('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x1765('0x44')](_0x3b0a62);})[_0x1765('0x26')](function(_0x479045){_0x3e3882[_0x1765('0x45')]=_0x479045;return _0x3e3882;})['then'](respondWithFilteredResult(_0x1c395e,_0x3b0a62))[_0x1765('0x46')](handleError(_0x1c395e,null));};exports[_0x1765('0x47')]=function(_0x18f0df,_0x465836){var _0x5cf0d2={'raw':![],'where':{'id':_0x18f0df['params']['id']}},_0x3bd4c0={};_0x3bd4c0['model']=_[_0x1765('0x32')](db[_0x1765('0x2e')][_0x1765('0x2f')]);_0x3bd4c0['query']=_[_0x1765('0x32')](_0x18f0df[_0x1765('0x31')]);_0x3bd4c0['filters']=_[_0x1765('0x34')](_0x3bd4c0[_0x1765('0x35')],_0x3bd4c0[_0x1765('0x31')]);_0x5cf0d2['attributes']=_[_0x1765('0x34')](_0x3bd4c0[_0x1765('0x35')],qs['fields'](_0x18f0df[_0x1765('0x31')][_0x1765('0x37')]));_0x5cf0d2['attributes']=_0x5cf0d2[_0x1765('0x36')][_0x1765('0x38')]?_0x5cf0d2['attributes']:_0x3bd4c0['model'];if(_0x18f0df[_0x1765('0x31')][_0x1765('0x42')]){_0x5cf0d2[_0x1765('0x43')]=[{'all':!![]}];}_0x5cf0d2=_[_0x1765('0x40')]({},_0x5cf0d2,_0x18f0df[_0x1765('0x41')]);return db['FreshsalesConfiguration'][_0x1765('0x48')](_0x5cf0d2)[_0x1765('0x26')](handleEntityNotFound(_0x465836,null))['then'](respondWithResult(_0x465836,null))[_0x1765('0x46')](handleError(_0x465836,null));};exports[_0x1765('0x49')]=function(_0x46ea5d,_0x4efae2){return db[_0x1765('0x2e')][_0x1765('0x49')](_0x46ea5d[_0x1765('0x4a')],{})[_0x1765('0x26')](respondWithResult(_0x4efae2,0xc9))['catch'](handleError(_0x4efae2,null));};exports[_0x1765('0x24')]=function(_0x5a7c99,_0x1d36c3){if(_0x5a7c99[_0x1765('0x4a')]['id']){delete _0x5a7c99[_0x1765('0x4a')]['id'];}return db['FreshsalesConfiguration'][_0x1765('0x48')]({'where':{'id':_0x5a7c99['params']['id']}})['then'](handleEntityNotFound(_0x1d36c3,null))[_0x1765('0x26')](saveUpdates(_0x5a7c99['body'],null))[_0x1765('0x26')](respondWithResult(_0x1d36c3,null))['catch'](handleError(_0x1d36c3,null));};exports['destroy']=function(_0x2b9e32,_0x395113){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2b9e32[_0x1765('0x4b')]['id']}})[_0x1765('0x26')](handleEntityNotFound(_0x395113,null))[_0x1765('0x26')](removeEntity(_0x395113,null))[_0x1765('0x46')](handleError(_0x395113,null));};exports[_0x1765('0x4c')]=function(_0x377423,_0x5218fa,_0x523ebb){var _0x32a08a={};var _0x2b2d9a={};var _0x1fc32b;var _0x586ab8;return db[_0x1765('0x2e')][_0x1765('0x4d')]({'where':{'id':_0x377423['params']['id']}})[_0x1765('0x26')](handleEntityNotFound(_0x5218fa,null))['then'](function(_0x55c7a7){if(_0x55c7a7){_0x1fc32b=_0x55c7a7;_0x2b2d9a['model']=_[_0x1765('0x32')](db[_0x1765('0x4e')][_0x1765('0x2f')]);_0x2b2d9a['query']=_['keys'](_0x377423[_0x1765('0x31')]);_0x2b2d9a[_0x1765('0x33')]=_[_0x1765('0x34')](_0x2b2d9a[_0x1765('0x35')],_0x2b2d9a[_0x1765('0x31')]);_0x32a08a[_0x1765('0x36')]=_['intersection'](_0x2b2d9a['model'],qs[_0x1765('0x37')](_0x377423[_0x1765('0x31')][_0x1765('0x37')]));_0x32a08a[_0x1765('0x36')]=_0x32a08a[_0x1765('0x36')][_0x1765('0x38')]?_0x32a08a[_0x1765('0x36')]:_0x2b2d9a[_0x1765('0x35')];_0x32a08a[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x377423[_0x1765('0x31')][_0x1765('0x3b')]);_0x32a08a[_0x1765('0x3e')]=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x377423['query'],_0x2b2d9a['filters']));if(_0x377423[_0x1765('0x31')][_0x1765('0x3d')]){_0x32a08a[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x32a08a[_0x1765('0x3e')],{'$or':_[_0x1765('0x2d')](_0x32a08a['attributes'],function(_0x525429){var _0x4482c9={};_0x4482c9[_0x525429]={'$like':'%'+_0x377423[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x4482c9;})});}_0x32a08a=_['merge']({},_0x32a08a,_0x377423['options']);return _0x1fc32b[_0x1765('0x4c')](_0x32a08a);}})['then'](function(_0xf4dad4){if(_0xf4dad4){_0x586ab8=_0xf4dad4[_0x1765('0x38')];if(!_0x377423['query']['hasOwnProperty'](_0x1765('0x4f'))){_0x32a08a[_0x1765('0x1d')]=qs[_0x1765('0x1d')](_0x377423[_0x1765('0x31')][_0x1765('0x1d')]);_0x32a08a[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x377423[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x1fc32b[_0x1765('0x4c')](_0x32a08a);}})['then'](function(_0x5b92b3){if(_0x5b92b3){return _0x5b92b3?{'count':_0x586ab8,'rows':_0x5b92b3}:null;}})[_0x1765('0x26')](respondWithResult(_0x5218fa,null))[_0x1765('0x46')](handleError(_0x5218fa,null));};exports['getDescriptions']=function(_0x2fbf15,_0x44187a,_0x391408){var _0x4c994e={};var _0x1e38d7={};var _0x464000;var _0x423b0e;return db['FreshsalesConfiguration'][_0x1765('0x4d')]({'where':{'id':_0x2fbf15[_0x1765('0x4b')]['id']}})['then'](handleEntityNotFound(_0x44187a,null))['then'](function(_0x1c69fe){if(_0x1c69fe){_0x464000=_0x1c69fe;_0x1e38d7['model']=_[_0x1765('0x32')](db[_0x1765('0x4e')][_0x1765('0x2f')]);_0x1e38d7[_0x1765('0x31')]=_[_0x1765('0x32')](_0x2fbf15['query']);_0x1e38d7[_0x1765('0x33')]=_[_0x1765('0x34')](_0x1e38d7[_0x1765('0x35')],_0x1e38d7[_0x1765('0x31')]);_0x4c994e[_0x1765('0x36')]=_[_0x1765('0x34')](_0x1e38d7[_0x1765('0x35')],qs[_0x1765('0x37')](_0x2fbf15['query']['fields']));_0x4c994e[_0x1765('0x36')]=_0x4c994e[_0x1765('0x36')][_0x1765('0x38')]?_0x4c994e[_0x1765('0x36')]:_0x1e38d7[_0x1765('0x35')];_0x4c994e[_0x1765('0x3a')]=qs[_0x1765('0x3b')](_0x2fbf15[_0x1765('0x31')][_0x1765('0x3b')]);_0x4c994e[_0x1765('0x3e')]=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x2fbf15[_0x1765('0x31')],_0x1e38d7[_0x1765('0x33')]));if(_0x2fbf15[_0x1765('0x31')][_0x1765('0x3d')]){_0x4c994e[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x4c994e['where'],{'$or':_[_0x1765('0x2d')](_0x4c994e['attributes'],function(_0x8e5154){var _0x323894={};_0x323894[_0x8e5154]={'$like':'%'+_0x2fbf15[_0x1765('0x31')]['filter']+'%'};return _0x323894;})});}_0x4c994e=_['merge']({},_0x4c994e,_0x2fbf15['options']);return _0x464000['getDescriptions'](_0x4c994e);}})['then'](function(_0x241468){if(_0x241468){_0x423b0e=_0x241468[_0x1765('0x38')];if(!_0x2fbf15[_0x1765('0x31')][_0x1765('0x39')]('nolimit')){_0x4c994e['limit']=qs[_0x1765('0x1d')](_0x2fbf15[_0x1765('0x31')]['limit']);_0x4c994e[_0x1765('0x1b')]=qs[_0x1765('0x1b')](_0x2fbf15[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x464000[_0x1765('0x50')](_0x4c994e);}})['then'](function(_0x333db3){if(_0x333db3){return _0x333db3?{'count':_0x423b0e,'rows':_0x333db3}:null;}})['then'](respondWithResult(_0x44187a,null))[_0x1765('0x46')](handleError(_0x44187a,null));};exports[_0x1765('0x51')]=function(_0x42a402,_0x4b243c,_0x4c7c12){var _0x5cf060={};var _0x2c2ad6={};var _0x26269f;var _0x324c45;return db[_0x1765('0x2e')]['findOne']({'where':{'id':_0x42a402[_0x1765('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b243c,null))[_0x1765('0x26')](function(_0x493749){if(_0x493749){_0x26269f=_0x493749;_0x2c2ad6[_0x1765('0x35')]=_[_0x1765('0x32')](db['FreshsalesField'][_0x1765('0x2f')]);_0x2c2ad6['query']=_['keys'](_0x42a402['query']);_0x2c2ad6[_0x1765('0x33')]=_[_0x1765('0x34')](_0x2c2ad6[_0x1765('0x35')],_0x2c2ad6['query']);_0x5cf060[_0x1765('0x36')]=_[_0x1765('0x34')](_0x2c2ad6['model'],qs[_0x1765('0x37')](_0x42a402['query'][_0x1765('0x37')]));_0x5cf060[_0x1765('0x36')]=_0x5cf060[_0x1765('0x36')][_0x1765('0x38')]?_0x5cf060[_0x1765('0x36')]:_0x2c2ad6['model'];_0x5cf060['order']=qs[_0x1765('0x3b')](_0x42a402[_0x1765('0x31')][_0x1765('0x3b')]);_0x5cf060['where']=qs[_0x1765('0x33')](_[_0x1765('0x3c')](_0x42a402[_0x1765('0x31')],_0x2c2ad6[_0x1765('0x33')]));if(_0x42a402[_0x1765('0x31')][_0x1765('0x3d')]){_0x5cf060[_0x1765('0x3e')]=_[_0x1765('0x40')](_0x5cf060[_0x1765('0x3e')],{'$or':_[_0x1765('0x2d')](_0x5cf060[_0x1765('0x36')],function(_0x53bc33){var _0x1c089c={};_0x1c089c[_0x53bc33]={'$like':'%'+_0x42a402[_0x1765('0x31')][_0x1765('0x3d')]+'%'};return _0x1c089c;})});}_0x5cf060=_[_0x1765('0x40')]({},_0x5cf060,_0x42a402[_0x1765('0x41')]);return _0x26269f[_0x1765('0x51')](_0x5cf060);}})['then'](function(_0x1fa3b7){if(_0x1fa3b7){_0x324c45=_0x1fa3b7[_0x1765('0x38')];if(!_0x42a402['query'][_0x1765('0x39')](_0x1765('0x4f'))){_0x5cf060[_0x1765('0x1d')]=qs['limit'](_0x42a402['query'][_0x1765('0x1d')]);_0x5cf060[_0x1765('0x1b')]=qs['offset'](_0x42a402[_0x1765('0x31')][_0x1765('0x1b')]);}return _0x26269f['getFields'](_0x5cf060);}})['then'](function(_0x3fa022){if(_0x3fa022){return _0x3fa022?{'count':_0x324c45,'rows':_0x3fa022}:null;}})[_0x1765('0x26')](respondWithResult(_0x4b243c,null))[_0x1765('0x46')](handleError(_0x4b243c,null));}; \ No newline at end of file +var _0xcf9c=['include','findAll','rows','catch','params','includeAll','create','body','find','getSubjects','findOne','FreshsalesField','order','options','getDescriptions','getFields','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf9c,0x1de));var _0xccf9=function(_0x2ac056,_0x2e138){_0x2ac056=_0x2ac056-0x0;var _0x2e40b3=_0xcf9c[_0x2ac056];return _0x2e40b3;};'use strict';var emlformat=require(_0xccf9('0x0'));var rimraf=require(_0xccf9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xccf9('0x2'));var moment=require(_0xccf9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xccf9('0x4'));var util=require('util');var path=require(_0xccf9('0x5'));var sox=require(_0xccf9('0x6'));var csv=require(_0xccf9('0x7'));var ejs=require(_0xccf9('0x8'));var fs=require('fs');var fs_extra=require(_0xccf9('0x9'));var _=require('lodash');var squel=require(_0xccf9('0xa'));var crypto=require(_0xccf9('0xb'));var jsforce=require(_0xccf9('0xc'));var deskjs=require(_0xccf9('0xd'));var toCsv=require(_0xccf9('0x7'));var querystring=require('querystring');var Papa=require(_0xccf9('0xe'));var Redis=require(_0xccf9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xccf9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xccf9('0x11'));var logger=require(_0xccf9('0x12'))('api');var utils=require(_0xccf9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xccf9('0x14'));var db=require(_0xccf9('0x15'))['db'];function respondWithStatusCode(_0x5ab10d,_0x25ffd8){_0x25ffd8=_0x25ffd8||0xcc;return function(_0x14bf58){if(_0x14bf58){return _0x5ab10d[_0xccf9('0x16')](_0x25ffd8);}return _0x5ab10d[_0xccf9('0x17')](_0x25ffd8)[_0xccf9('0x18')]();};}function respondWithResult(_0x46a9f2,_0x20cfdc){_0x20cfdc=_0x20cfdc||0xc8;return function(_0x49acea){if(_0x49acea){return _0x46a9f2[_0xccf9('0x17')](_0x20cfdc)[_0xccf9('0x19')](_0x49acea);}};}function respondWithFilteredResult(_0x2ebf88,_0x1f7088){return function(_0x1af10a){if(_0x1af10a){var _0x4f80b7=typeof _0x1f7088[_0xccf9('0x1a')]==='undefined'&&typeof _0x1f7088[_0xccf9('0x1b')]==='undefined';var _0xaa1c0=_0x1af10a[_0xccf9('0x1c')];var _0x2547c4=_0x4f80b7?0x0:_0x1f7088[_0xccf9('0x1a')];var _0x311425=_0x4f80b7?_0x1af10a[_0xccf9('0x1c')]:_0x1f7088['offset']+_0x1f7088[_0xccf9('0x1b')];var _0x5ddfd5;if(_0x311425>=_0xaa1c0){_0x311425=_0xaa1c0;_0x5ddfd5=0xc8;}else{_0x5ddfd5=0xce;}_0x2ebf88[_0xccf9('0x17')](_0x5ddfd5);return _0x2ebf88[_0xccf9('0x1d')](_0xccf9('0x1e'),_0x2547c4+'-'+_0x311425+'/'+_0xaa1c0)['json'](_0x1af10a);}return null;};}function patchUpdates(_0x55469f){return function(_0x45d52c){try{jsonpatch[_0xccf9('0x1f')](_0x45d52c,_0x55469f,!![]);}catch(_0x5eebbd){return BPromise[_0xccf9('0x20')](_0x5eebbd);}return _0x45d52c[_0xccf9('0x21')]();};}function saveUpdates(_0x26bdda,_0x30e70d){return function(_0x1d3f1b){if(_0x1d3f1b){return _0x1d3f1b[_0xccf9('0x22')](_0x26bdda)[_0xccf9('0x23')](function(_0x45652a){return _0x45652a;});}return null;};}function removeEntity(_0x4c3350,_0x453e2c){return function(_0x39f19e){if(_0x39f19e){return _0x39f19e[_0xccf9('0x24')]()[_0xccf9('0x23')](function(){_0x4c3350[_0xccf9('0x17')](0xcc)[_0xccf9('0x18')]();});}};}function handleEntityNotFound(_0x5174c7,_0xf22447){return function(_0x59a358){if(!_0x59a358){_0x5174c7[_0xccf9('0x16')](0x194);}return _0x59a358;};}function handleError(_0x44185e,_0x5f0221){_0x5f0221=_0x5f0221||0x1f4;return function(_0x147fb5){logger['error'](_0x147fb5[_0xccf9('0x25')]);if(_0x147fb5[_0xccf9('0x26')]){delete _0x147fb5['name'];}_0x44185e[_0xccf9('0x17')](_0x5f0221)['send'](_0x147fb5);};}exports[_0xccf9('0x27')]=function(_0x2b8212,_0x279f9a){var _0x5a99ba={},_0x444f2f={},_0x392cef={'count':0x0,'rows':[]};var _0x1b6c71=_[_0xccf9('0x28')](db[_0xccf9('0x29')][_0xccf9('0x2a')],function(_0x4e7e5d){return{'name':_0x4e7e5d[_0xccf9('0x2b')],'type':_0x4e7e5d[_0xccf9('0x2c')]['key']};});_0x444f2f['model']=_[_0xccf9('0x28')](_0x1b6c71,'name');_0x444f2f['query']=_[_0xccf9('0x2d')](_0x2b8212[_0xccf9('0x2e')]);_0x444f2f[_0xccf9('0x2f')]=_[_0xccf9('0x30')](_0x444f2f['model'],_0x444f2f[_0xccf9('0x2e')]);_0x5a99ba['attributes']=_['intersection'](_0x444f2f[_0xccf9('0x31')],qs['fields'](_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x32')]));_0x5a99ba[_0xccf9('0x33')]=_0x5a99ba['attributes'][_0xccf9('0x34')]?_0x5a99ba[_0xccf9('0x33')]:_0x444f2f[_0xccf9('0x31')];if(!_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x35')](_0xccf9('0x36'))){_0x5a99ba[_0xccf9('0x1b')]=qs[_0xccf9('0x1b')](_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x1b')]);_0x5a99ba[_0xccf9('0x1a')]=qs[_0xccf9('0x1a')](_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x1a')]);}_0x5a99ba['order']=qs['sort'](_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x37')]);_0x5a99ba[_0xccf9('0x38')]=qs[_0xccf9('0x2f')](_[_0xccf9('0x39')](_0x2b8212[_0xccf9('0x2e')],_0x444f2f['filters']),_0x1b6c71);if(_0x2b8212['query']['filter']){_0x5a99ba[_0xccf9('0x38')]=_['merge'](_0x5a99ba[_0xccf9('0x38')],{'$or':_[_0xccf9('0x28')](_0x1b6c71,function(_0x571670){if(_0x571670['type']!==_0xccf9('0x3a')){var _0x13ebda={};_0x13ebda[_0x571670[_0xccf9('0x26')]]={'$like':'%'+_0x2b8212[_0xccf9('0x2e')][_0xccf9('0x3b')]+'%'};return _0x13ebda;}})});}_0x5a99ba=_[_0xccf9('0x3c')]({},_0x5a99ba,_0x2b8212['options']);var _0x47704d={'where':_0x5a99ba[_0xccf9('0x38')]};return db[_0xccf9('0x29')][_0xccf9('0x1c')](_0x47704d)[_0xccf9('0x23')](function(_0x544239){_0x392cef[_0xccf9('0x1c')]=_0x544239;if(_0x2b8212[_0xccf9('0x2e')]['includeAll']){_0x5a99ba[_0xccf9('0x3d')]=[{'all':!![]}];}return db[_0xccf9('0x29')][_0xccf9('0x3e')](_0x5a99ba);})[_0xccf9('0x23')](function(_0x12b37c){_0x392cef[_0xccf9('0x3f')]=_0x12b37c;return _0x392cef;})[_0xccf9('0x23')](respondWithFilteredResult(_0x279f9a,_0x5a99ba))[_0xccf9('0x40')](handleError(_0x279f9a,null));};exports['show']=function(_0x317785,_0x4f8333){var _0x126e04={'raw':![],'where':{'id':_0x317785[_0xccf9('0x41')]['id']}},_0x1bbb91={};_0x1bbb91[_0xccf9('0x31')]=_['keys'](db[_0xccf9('0x29')]['rawAttributes']);_0x1bbb91[_0xccf9('0x2e')]=_[_0xccf9('0x2d')](_0x317785[_0xccf9('0x2e')]);_0x1bbb91[_0xccf9('0x2f')]=_[_0xccf9('0x30')](_0x1bbb91['model'],_0x1bbb91['query']);_0x126e04['attributes']=_[_0xccf9('0x30')](_0x1bbb91[_0xccf9('0x31')],qs['fields'](_0x317785[_0xccf9('0x2e')][_0xccf9('0x32')]));_0x126e04[_0xccf9('0x33')]=_0x126e04[_0xccf9('0x33')][_0xccf9('0x34')]?_0x126e04[_0xccf9('0x33')]:_0x1bbb91[_0xccf9('0x31')];if(_0x317785[_0xccf9('0x2e')][_0xccf9('0x42')]){_0x126e04[_0xccf9('0x3d')]=[{'all':!![]}];}_0x126e04=_[_0xccf9('0x3c')]({},_0x126e04,_0x317785['options']);return db[_0xccf9('0x29')]['find'](_0x126e04)[_0xccf9('0x23')](handleEntityNotFound(_0x4f8333,null))['then'](respondWithResult(_0x4f8333,null))[_0xccf9('0x40')](handleError(_0x4f8333,null));};exports[_0xccf9('0x43')]=function(_0x39d97c,_0x1b1e7c){return db[_0xccf9('0x29')]['create'](_0x39d97c[_0xccf9('0x44')],{})[_0xccf9('0x23')](respondWithResult(_0x1b1e7c,0xc9))[_0xccf9('0x40')](handleError(_0x1b1e7c,null));};exports['update']=function(_0x4d8e98,_0x10a412){if(_0x4d8e98[_0xccf9('0x44')]['id']){delete _0x4d8e98[_0xccf9('0x44')]['id'];}return db[_0xccf9('0x29')][_0xccf9('0x45')]({'where':{'id':_0x4d8e98[_0xccf9('0x41')]['id']}})['then'](handleEntityNotFound(_0x10a412,null))[_0xccf9('0x23')](saveUpdates(_0x4d8e98['body'],null))[_0xccf9('0x23')](respondWithResult(_0x10a412,null))[_0xccf9('0x40')](handleError(_0x10a412,null));};exports[_0xccf9('0x24')]=function(_0x275f2f,_0x595716){return db[_0xccf9('0x29')]['find']({'where':{'id':_0x275f2f['params']['id']}})[_0xccf9('0x23')](handleEntityNotFound(_0x595716,null))[_0xccf9('0x23')](removeEntity(_0x595716,null))[_0xccf9('0x40')](handleError(_0x595716,null));};exports[_0xccf9('0x46')]=function(_0x43ddc3,_0x5ccfdd,_0x5955ef){var _0x561ca9={};var _0x3119cf={};var _0x2a44ac;var _0x1a68e9;return db[_0xccf9('0x29')][_0xccf9('0x47')]({'where':{'id':_0x43ddc3[_0xccf9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ccfdd,null))[_0xccf9('0x23')](function(_0x15b912){if(_0x15b912){_0x2a44ac=_0x15b912;_0x3119cf[_0xccf9('0x31')]=_[_0xccf9('0x2d')](db[_0xccf9('0x48')][_0xccf9('0x2a')]);_0x3119cf[_0xccf9('0x2e')]=_[_0xccf9('0x2d')](_0x43ddc3[_0xccf9('0x2e')]);_0x3119cf[_0xccf9('0x2f')]=_[_0xccf9('0x30')](_0x3119cf[_0xccf9('0x31')],_0x3119cf['query']);_0x561ca9[_0xccf9('0x33')]=_[_0xccf9('0x30')](_0x3119cf[_0xccf9('0x31')],qs['fields'](_0x43ddc3[_0xccf9('0x2e')][_0xccf9('0x32')]));_0x561ca9['attributes']=_0x561ca9[_0xccf9('0x33')][_0xccf9('0x34')]?_0x561ca9[_0xccf9('0x33')]:_0x3119cf[_0xccf9('0x31')];_0x561ca9[_0xccf9('0x49')]=qs[_0xccf9('0x37')](_0x43ddc3['query'][_0xccf9('0x37')]);_0x561ca9[_0xccf9('0x38')]=qs[_0xccf9('0x2f')](_[_0xccf9('0x39')](_0x43ddc3[_0xccf9('0x2e')],_0x3119cf[_0xccf9('0x2f')]));if(_0x43ddc3[_0xccf9('0x2e')][_0xccf9('0x3b')]){_0x561ca9['where']=_[_0xccf9('0x3c')](_0x561ca9[_0xccf9('0x38')],{'$or':_[_0xccf9('0x28')](_0x561ca9[_0xccf9('0x33')],function(_0x21bf68){var _0x3d0226={};_0x3d0226[_0x21bf68]={'$like':'%'+_0x43ddc3['query'][_0xccf9('0x3b')]+'%'};return _0x3d0226;})});}_0x561ca9=_[_0xccf9('0x3c')]({},_0x561ca9,_0x43ddc3[_0xccf9('0x4a')]);return _0x2a44ac['getSubjects'](_0x561ca9);}})[_0xccf9('0x23')](function(_0x4c1710){if(_0x4c1710){_0x1a68e9=_0x4c1710[_0xccf9('0x34')];if(!_0x43ddc3['query'][_0xccf9('0x35')](_0xccf9('0x36'))){_0x561ca9['limit']=qs[_0xccf9('0x1b')](_0x43ddc3['query'][_0xccf9('0x1b')]);_0x561ca9[_0xccf9('0x1a')]=qs[_0xccf9('0x1a')](_0x43ddc3[_0xccf9('0x2e')][_0xccf9('0x1a')]);}return _0x2a44ac[_0xccf9('0x46')](_0x561ca9);}})[_0xccf9('0x23')](function(_0x20b370){if(_0x20b370){return _0x20b370?{'count':_0x1a68e9,'rows':_0x20b370}:null;}})['then'](respondWithResult(_0x5ccfdd,null))['catch'](handleError(_0x5ccfdd,null));};exports[_0xccf9('0x4b')]=function(_0x4083b1,_0x120c37,_0x5862bf){var _0x452c3f={};var _0x2f7a53={};var _0x2c37a2;var _0x51dc86;return db[_0xccf9('0x29')]['findOne']({'where':{'id':_0x4083b1[_0xccf9('0x41')]['id']}})['then'](handleEntityNotFound(_0x120c37,null))[_0xccf9('0x23')](function(_0xb07d02){if(_0xb07d02){_0x2c37a2=_0xb07d02;_0x2f7a53[_0xccf9('0x31')]=_[_0xccf9('0x2d')](db[_0xccf9('0x48')][_0xccf9('0x2a')]);_0x2f7a53[_0xccf9('0x2e')]=_['keys'](_0x4083b1['query']);_0x2f7a53['filters']=_[_0xccf9('0x30')](_0x2f7a53['model'],_0x2f7a53[_0xccf9('0x2e')]);_0x452c3f[_0xccf9('0x33')]=_[_0xccf9('0x30')](_0x2f7a53[_0xccf9('0x31')],qs[_0xccf9('0x32')](_0x4083b1[_0xccf9('0x2e')][_0xccf9('0x32')]));_0x452c3f[_0xccf9('0x33')]=_0x452c3f[_0xccf9('0x33')][_0xccf9('0x34')]?_0x452c3f[_0xccf9('0x33')]:_0x2f7a53['model'];_0x452c3f[_0xccf9('0x49')]=qs[_0xccf9('0x37')](_0x4083b1[_0xccf9('0x2e')][_0xccf9('0x37')]);_0x452c3f['where']=qs[_0xccf9('0x2f')](_[_0xccf9('0x39')](_0x4083b1[_0xccf9('0x2e')],_0x2f7a53[_0xccf9('0x2f')]));if(_0x4083b1[_0xccf9('0x2e')]['filter']){_0x452c3f[_0xccf9('0x38')]=_['merge'](_0x452c3f['where'],{'$or':_[_0xccf9('0x28')](_0x452c3f['attributes'],function(_0x39b9d6){var _0x4bdf0a={};_0x4bdf0a[_0x39b9d6]={'$like':'%'+_0x4083b1['query'][_0xccf9('0x3b')]+'%'};return _0x4bdf0a;})});}_0x452c3f=_[_0xccf9('0x3c')]({},_0x452c3f,_0x4083b1[_0xccf9('0x4a')]);return _0x2c37a2[_0xccf9('0x4b')](_0x452c3f);}})[_0xccf9('0x23')](function(_0x14dec5){if(_0x14dec5){_0x51dc86=_0x14dec5[_0xccf9('0x34')];if(!_0x4083b1[_0xccf9('0x2e')][_0xccf9('0x35')](_0xccf9('0x36'))){_0x452c3f[_0xccf9('0x1b')]=qs['limit'](_0x4083b1[_0xccf9('0x2e')]['limit']);_0x452c3f[_0xccf9('0x1a')]=qs[_0xccf9('0x1a')](_0x4083b1['query'][_0xccf9('0x1a')]);}return _0x2c37a2[_0xccf9('0x4b')](_0x452c3f);}})['then'](function(_0x22b44d){if(_0x22b44d){return _0x22b44d?{'count':_0x51dc86,'rows':_0x22b44d}:null;}})[_0xccf9('0x23')](respondWithResult(_0x120c37,null))['catch'](handleError(_0x120c37,null));};exports['getFields']=function(_0x33a4ad,_0xd95959,_0x38850a){var _0x367f89={};var _0xe85b48={};var _0x1cd856;var _0x885492;return db[_0xccf9('0x29')][_0xccf9('0x47')]({'where':{'id':_0x33a4ad[_0xccf9('0x41')]['id']}})[_0xccf9('0x23')](handleEntityNotFound(_0xd95959,null))[_0xccf9('0x23')](function(_0x1c3bc0){if(_0x1c3bc0){_0x1cd856=_0x1c3bc0;_0xe85b48['model']=_[_0xccf9('0x2d')](db[_0xccf9('0x48')][_0xccf9('0x2a')]);_0xe85b48[_0xccf9('0x2e')]=_[_0xccf9('0x2d')](_0x33a4ad[_0xccf9('0x2e')]);_0xe85b48[_0xccf9('0x2f')]=_[_0xccf9('0x30')](_0xe85b48['model'],_0xe85b48[_0xccf9('0x2e')]);_0x367f89[_0xccf9('0x33')]=_[_0xccf9('0x30')](_0xe85b48[_0xccf9('0x31')],qs[_0xccf9('0x32')](_0x33a4ad['query']['fields']));_0x367f89[_0xccf9('0x33')]=_0x367f89[_0xccf9('0x33')]['length']?_0x367f89[_0xccf9('0x33')]:_0xe85b48[_0xccf9('0x31')];_0x367f89[_0xccf9('0x49')]=qs[_0xccf9('0x37')](_0x33a4ad[_0xccf9('0x2e')]['sort']);_0x367f89[_0xccf9('0x38')]=qs[_0xccf9('0x2f')](_[_0xccf9('0x39')](_0x33a4ad[_0xccf9('0x2e')],_0xe85b48[_0xccf9('0x2f')]));if(_0x33a4ad['query'][_0xccf9('0x3b')]){_0x367f89[_0xccf9('0x38')]=_[_0xccf9('0x3c')](_0x367f89[_0xccf9('0x38')],{'$or':_[_0xccf9('0x28')](_0x367f89[_0xccf9('0x33')],function(_0x5cbe2a){var _0x3f0562={};_0x3f0562[_0x5cbe2a]={'$like':'%'+_0x33a4ad[_0xccf9('0x2e')][_0xccf9('0x3b')]+'%'};return _0x3f0562;})});}_0x367f89=_[_0xccf9('0x3c')]({},_0x367f89,_0x33a4ad[_0xccf9('0x4a')]);return _0x1cd856[_0xccf9('0x4c')](_0x367f89);}})[_0xccf9('0x23')](function(_0x195d4a){if(_0x195d4a){_0x885492=_0x195d4a[_0xccf9('0x34')];if(!_0x33a4ad['query'][_0xccf9('0x35')]('nolimit')){_0x367f89['limit']=qs[_0xccf9('0x1b')](_0x33a4ad['query'][_0xccf9('0x1b')]);_0x367f89[_0xccf9('0x1a')]=qs[_0xccf9('0x1a')](_0x33a4ad['query']['offset']);}return _0x1cd856[_0xccf9('0x4c')](_0x367f89);}})[_0xccf9('0x23')](function(_0x3d4e12){if(_0x3d4e12){return _0x3d4e12?{'count':_0x885492,'rows':_0x3d4e12}:null;}})[_0xccf9('0x23')](respondWithResult(_0xd95959,null))['catch'](handleError(_0xd95959,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 40e9c46..bb07c65 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 _0x610f=['./intFreshsalesConfiguration.attributes','bluebird','request-promise','../../config/environment'];(function(_0x1502b0,_0x323f9b){var _0x274f05=function(_0x3e3afa){while(--_0x3e3afa){_0x1502b0['push'](_0x1502b0['shift']());}};_0x274f05(++_0x323f9b);}(_0x610f,0xa5));var _0xf610=function(_0x22ad0c,_0x56e8a1){_0x22ad0c=_0x22ad0c-0x0;var _0x3787a9=_0x610f[_0x22ad0c];return _0x3787a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf610('0x0'));var rp=require(_0xf610('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf610('0x2'));var attributes=require(_0xf610('0x3'));module['exports']=function(_0x44cec7,_0x2524bb){return _0x44cec7['define']('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2120=['rimraf','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','moment','bluebird','request-promise','path'];(function(_0x16d04c,_0x4e2aaf){var _0x4769f1=function(_0x40043a){while(--_0x40043a){_0x16d04c['push'](_0x16d04c['shift']());}};_0x4769f1(++_0x4e2aaf);}(_0x2120,0x16c));var _0x0212=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x2120[_0x34eb31];return _0x254994;};'use strict';var _=require(_0x0212('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0212('0x1'));var BPromise=require(_0x0212('0x2'));var rp=require(_0x0212('0x3'));var fs=require('fs');var path=require(_0x0212('0x4'));var rimraf=require(_0x0212('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x1c6cdf,_0x2e773a){return _0x1c6cdf[_0x0212('0x6')](_0x0212('0x7'),attributes,{'tableName':_0x0212('0x8'),'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 0982ecd..9fa8464 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 _0x640a=['FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b7708,_0x243af9){var _0x3a13c0=function(_0x2d3cd7){while(--_0x2d3cd7){_0x3b7708['push'](_0x3b7708['shift']());}};_0x3a13c0(++_0x243af9);}(_0x640a,0xcd));var _0xa640=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x640a[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xa640('0x0'));var util=require(_0xa640('0x1'));var moment=require(_0xa640('0x2'));var BPromise=require(_0xa640('0x3'));var rs=require(_0xa640('0x4'));var fs=require('fs');var Redis=require(_0xa640('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa640('0x6'));var logger=require(_0xa640('0x7'))(_0xa640('0x8'));var config=require(_0xa640('0x9'));var jayson=require(_0xa640('0xa'));var client=jayson[_0xa640('0xb')][_0xa640('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f6d7a,_0x8dc2ae,_0x395f29){return new BPromise(function(_0x2255d3,_0x3c2d46){return client[_0xa640('0xd')](_0x4f6d7a,_0x395f29)['then'](function(_0x3051c8){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x8dc2ae,_0xa640('0xe'));logger[_0xa640('0xf')](_0xa640('0x10'),_0x8dc2ae,_0xa640('0xe'),JSON[_0xa640('0x11')](_0x3051c8));if(_0x3051c8[_0xa640('0x12')]){if(_0x3051c8[_0xa640('0x12')][_0xa640('0x13')]===0x1f4){logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);return _0x3c2d46(_0x3051c8[_0xa640('0x12')]['message']);}logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);return _0x2255d3(_0x3051c8[_0xa640('0x12')][_0xa640('0x15')]);}else{logger[_0xa640('0x16')](_0xa640('0x14'),_0x8dc2ae,'request\x20sent');_0x2255d3(_0x3051c8[_0xa640('0x17')][_0xa640('0x15')]);}})[_0xa640('0x18')](function(_0x33b8dd){logger[_0xa640('0x12')](_0xa640('0x14'),_0x8dc2ae,_0x33b8dd);_0x3c2d46(_0x33b8dd);});});} \ No newline at end of file +var _0xa5b7=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf714cf,_0x584b1b){var _0x4570d6=function(_0xd1eb1){while(--_0xd1eb1){_0xf714cf['push'](_0xf714cf['shift']());}};_0x4570d6(++_0x584b1b);}(_0xa5b7,0x7e));var _0x7a5b=function(_0x552b0c,_0x490a49){_0x552b0c=_0x552b0c-0x0;var _0x4d5bdf=_0xa5b7[_0x552b0c];return _0x4d5bdf;};'use strict';var _=require('lodash');var util=require(_0x7a5b('0x0'));var moment=require(_0x7a5b('0x1'));var BPromise=require(_0x7a5b('0x2'));var rs=require(_0x7a5b('0x3'));var fs=require('fs');var Redis=require(_0x7a5b('0x4'));var db=require(_0x7a5b('0x5'))['db'];var utils=require(_0x7a5b('0x6'));var logger=require(_0x7a5b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a5b('0x8'));var client=jayson[_0x7a5b('0x9')][_0x7a5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x448548,_0x4db60f,_0x34fbe1){return new BPromise(function(_0x289d9c,_0x5ae20e){return client[_0x7a5b('0xb')](_0x448548,_0x34fbe1)[_0x7a5b('0xc')](function(_0x48f3d5){logger[_0x7a5b('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4db60f,_0x7a5b('0xe'));logger[_0x7a5b('0xf')](_0x7a5b('0x10'),_0x4db60f,_0x7a5b('0xe'),JSON[_0x7a5b('0x11')](_0x48f3d5));if(_0x48f3d5[_0x7a5b('0x12')]){if(_0x48f3d5[_0x7a5b('0x12')]['code']===0x1f4){logger[_0x7a5b('0x12')](_0x7a5b('0x13'),_0x4db60f,_0x48f3d5['error'][_0x7a5b('0x14')]);return _0x5ae20e(_0x48f3d5[_0x7a5b('0x12')][_0x7a5b('0x14')]);}logger['error'](_0x7a5b('0x13'),_0x4db60f,_0x48f3d5['error'][_0x7a5b('0x14')]);return _0x289d9c(_0x48f3d5[_0x7a5b('0x12')][_0x7a5b('0x14')]);}else{logger[_0x7a5b('0xd')](_0x7a5b('0x13'),_0x4db60f,_0x7a5b('0xe'));_0x289d9c(_0x48f3d5['result'][_0x7a5b('0x14')]);}})[_0x7a5b('0x15')](function(_0x30923d){logger[_0x7a5b('0x12')](_0x7a5b('0x13'),_0x4db60f,_0x30923d);_0x5ae20e(_0x30923d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4560f5e..f933c01 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 _0xa75b=['/:id','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x5dea35,_0x892157){var _0x54f2ea=function(_0x6072eb){while(--_0x6072eb){_0x5dea35['push'](_0x5dea35['shift']());}};_0x54f2ea(++_0x892157);}(_0xa75b,0x170));var _0xba75=function(_0x2760ef,_0x4e889d){_0x2760ef=_0x2760ef-0x0;var _0xe84387=_0xa75b[_0x2760ef];return _0xe84387;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xba75('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba75('0xe')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')](_0xba75('0xc'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);module[_0xba75('0x12')]=router; \ No newline at end of file +var _0x3379=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x66f017,_0x7a13e6){var _0x1df4cc=function(_0x6e1ee5){while(--_0x6e1ee5){_0x66f017['push'](_0x66f017['shift']());}};_0x1df4cc(++_0x7a13e6);}(_0x3379,0x115));var _0x9337=function(_0x3334ed,_0x2faaf6){_0x3334ed=_0x3334ed-0x0;var _0x461494=_0x3379[_0x3334ed];return _0x461494;};'use strict';var multer=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var path=require(_0x9337('0x2'));var timeout=require(_0x9337('0x3'));var express=require('express');var router=express[_0x9337('0x4')]();var fs_extra=require(_0x9337('0x5'));var auth=require(_0x9337('0x6'));var interaction=require(_0x9337('0x7'));var config=require('../../config/environment');var controller=require(_0x9337('0x8'));router[_0x9337('0x9')]('/',auth[_0x9337('0xa')](),controller[_0x9337('0xb')]);router['get'](_0x9337('0xc'),auth['isAuthenticated'](),controller[_0x9337('0xd')]);router[_0x9337('0xe')]('/',auth[_0x9337('0xa')](),controller[_0x9337('0xf')]);router[_0x9337('0x10')]('/:id',auth[_0x9337('0xa')](),controller[_0x9337('0x11')]);router[_0x9337('0x12')](_0x9337('0xc'),auth[_0x9337('0xa')](),controller['destroy']);module[_0x9337('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 459b961..6f5f0fc 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 _0xc15b=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x3ddc7b,_0xdcd659){var _0x8a4b3e=function(_0x3f5e8d){while(--_0x3f5e8d){_0x3ddc7b['push'](_0x3ddc7b['shift']());}};_0x8a4b3e(++_0xdcd659);}(_0xc15b,0x1b8));var _0xbc15=function(_0x52684f,_0xff73fc){_0x52684f=_0x52684f-0x0;var _0x4a55f0=_0xc15b[_0x52684f];return _0x4a55f0;};'use strict';var Sequelize=require(_0xbc15('0x0'));module[_0xbc15('0x1')]={'type':{'type':Sequelize[_0xbc15('0x2')](_0xbc15('0x3'),_0xbc15('0x4'),_0xbc15('0x5'),'keyValue','picklist'),'defaultValue':_0xbc15('0x3')},'content':{'type':Sequelize[_0xbc15('0x6')]},'key':{'type':Sequelize[_0xbc15('0x6')]},'keyType':{'type':Sequelize[_0xbc15('0x2')]('string','variable',_0xbc15('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbc15('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbc15('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbc15('0x6')]}}; \ No newline at end of file +var _0x8f38=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','string'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f38,0xc6));var _0x88f3=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8f38[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require('sequelize');module[_0x88f3('0x0')]={'type':{'type':Sequelize['ENUM'](_0x88f3('0x1'),_0x88f3('0x2'),_0x88f3('0x3'),_0x88f3('0x4'),_0x88f3('0x5')),'defaultValue':_0x88f3('0x1')},'content':{'type':Sequelize[_0x88f3('0x6')]},'key':{'type':Sequelize[_0x88f3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x88f3('0x1'),_0x88f3('0x2'),_0x88f3('0x3'))},'keyContent':{'type':Sequelize[_0x88f3('0x6')]},'idField':{'type':Sequelize[_0x88f3('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x88f3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88f3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b722d5b..f20b826 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 _0xc046=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesField','fieldName','type','key','keys','query','filters','attributes','intersection','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','fields','length','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x5c1769,_0x1e1b10){var _0x5997c3=function(_0xd33813){while(--_0xd33813){_0x5c1769['push'](_0x5c1769['shift']());}};_0x5997c3(++_0x1e1b10);}(_0xc046,0xd1));var _0x6c04=function(_0x13535e,_0x590ff9){_0x13535e=_0x13535e-0x0;var _0x410ddc=_0xc046[_0x13535e];return _0x410ddc;};'use strict';var emlformat=require(_0x6c04('0x0'));var rimraf=require(_0x6c04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c04('0x2'));var moment=require(_0x6c04('0x3'));var BPromise=require(_0x6c04('0x4'));var Mustache=require(_0x6c04('0x5'));var util=require(_0x6c04('0x6'));var path=require(_0x6c04('0x7'));var sox=require(_0x6c04('0x8'));var csv=require('to-csv');var ejs=require(_0x6c04('0x9'));var fs=require('fs');var fs_extra=require(_0x6c04('0xa'));var _=require(_0x6c04('0xb'));var squel=require(_0x6c04('0xc'));var crypto=require(_0x6c04('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c04('0xe'));var toCsv=require(_0x6c04('0xf'));var querystring=require(_0x6c04('0x10'));var Papa=require(_0x6c04('0x11'));var Redis=require(_0x6c04('0x12'));var authService=require(_0x6c04('0x13'));var qs=require(_0x6c04('0x14'));var as=require(_0x6c04('0x15'));var hardwareService=require(_0x6c04('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6c04('0x17'))['db'];function respondWithStatusCode(_0x5a24ab,_0x517def){_0x517def=_0x517def||0xcc;return function(_0x226714){if(_0x226714){return _0x5a24ab[_0x6c04('0x18')](_0x517def);}return _0x5a24ab[_0x6c04('0x19')](_0x517def)[_0x6c04('0x1a')]();};}function respondWithResult(_0x56456a,_0x47be74){_0x47be74=_0x47be74||0xc8;return function(_0x292c13){if(_0x292c13){return _0x56456a[_0x6c04('0x19')](_0x47be74)['json'](_0x292c13);}};}function respondWithFilteredResult(_0x42790f,_0x46003a){return function(_0x222010){if(_0x222010){var _0x366444=typeof _0x46003a['offset']===_0x6c04('0x1b')&&typeof _0x46003a[_0x6c04('0x1c')]===_0x6c04('0x1b');var _0x4ba8a6=_0x222010[_0x6c04('0x1d')];var _0x2d065c=_0x366444?0x0:_0x46003a[_0x6c04('0x1e')];var _0xefb5dc=_0x366444?_0x222010[_0x6c04('0x1d')]:_0x46003a[_0x6c04('0x1e')]+_0x46003a[_0x6c04('0x1c')];var _0x124786;if(_0xefb5dc>=_0x4ba8a6){_0xefb5dc=_0x4ba8a6;_0x124786=0xc8;}else{_0x124786=0xce;}_0x42790f[_0x6c04('0x19')](_0x124786);return _0x42790f[_0x6c04('0x1f')]('Content-Range',_0x2d065c+'-'+_0xefb5dc+'/'+_0x4ba8a6)[_0x6c04('0x20')](_0x222010);}return null;};}function patchUpdates(_0x344240){return function(_0xcd201c){try{jsonpatch[_0x6c04('0x21')](_0xcd201c,_0x344240,!![]);}catch(_0x53f588){return BPromise[_0x6c04('0x22')](_0x53f588);}return _0xcd201c[_0x6c04('0x23')]();};}function saveUpdates(_0x1568e6,_0x3be096){return function(_0x14c0b8){if(_0x14c0b8){return _0x14c0b8['update'](_0x1568e6)[_0x6c04('0x24')](function(_0x240962){return _0x240962;});}return null;};}function removeEntity(_0x19b626,_0x2bdea8){return function(_0x470b23){if(_0x470b23){return _0x470b23[_0x6c04('0x25')]()[_0x6c04('0x24')](function(){_0x19b626[_0x6c04('0x19')](0xcc)[_0x6c04('0x1a')]();});}};}function handleEntityNotFound(_0x3168fb,_0xf24ff9){return function(_0xf4d037){if(!_0xf4d037){_0x3168fb[_0x6c04('0x18')](0x194);}return _0xf4d037;};}function handleError(_0x356bfd,_0x7ef048){_0x7ef048=_0x7ef048||0x1f4;return function(_0x2fa165){logger[_0x6c04('0x26')](_0x2fa165[_0x6c04('0x27')]);if(_0x2fa165['name']){delete _0x2fa165[_0x6c04('0x28')];}_0x356bfd[_0x6c04('0x19')](_0x7ef048)['send'](_0x2fa165);};}exports[_0x6c04('0x29')]=function(_0x2aef4e,_0x51363f){var _0x282521={},_0x320a54={},_0x4120c5={'count':0x0,'rows':[]};var _0x1e6efc=_[_0x6c04('0x2a')](db[_0x6c04('0x2b')]['rawAttributes'],function(_0x3af126){return{'name':_0x3af126[_0x6c04('0x2c')],'type':_0x3af126[_0x6c04('0x2d')][_0x6c04('0x2e')]};});_0x320a54['model']=_[_0x6c04('0x2a')](_0x1e6efc,_0x6c04('0x28'));_0x320a54['query']=_[_0x6c04('0x2f')](_0x2aef4e[_0x6c04('0x30')]);_0x320a54[_0x6c04('0x31')]=_['intersection'](_0x320a54['model'],_0x320a54[_0x6c04('0x30')]);_0x282521[_0x6c04('0x32')]=_[_0x6c04('0x33')](_0x320a54['model'],qs['fields'](_0x2aef4e[_0x6c04('0x30')]['fields']));_0x282521[_0x6c04('0x32')]=_0x282521[_0x6c04('0x32')]['length']?_0x282521[_0x6c04('0x32')]:_0x320a54[_0x6c04('0x34')];if(!_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x35')](_0x6c04('0x36'))){_0x282521['limit']=qs[_0x6c04('0x1c')](_0x2aef4e[_0x6c04('0x30')]['limit']);_0x282521[_0x6c04('0x1e')]=qs['offset'](_0x2aef4e[_0x6c04('0x30')]['offset']);}_0x282521['order']=qs[_0x6c04('0x37')](_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x37')]);_0x282521[_0x6c04('0x38')]=qs['filters'](_[_0x6c04('0x39')](_0x2aef4e[_0x6c04('0x30')],_0x320a54[_0x6c04('0x31')]),_0x1e6efc);if(_0x2aef4e['query'][_0x6c04('0x3a')]){_0x282521['where']=_[_0x6c04('0x3b')](_0x282521[_0x6c04('0x38')],{'$or':_[_0x6c04('0x2a')](_0x1e6efc,function(_0x170f98){if(_0x170f98[_0x6c04('0x2d')]!==_0x6c04('0x3c')){var _0x2f7e43={};_0x2f7e43[_0x170f98[_0x6c04('0x28')]]={'$like':'%'+_0x2aef4e[_0x6c04('0x30')]['filter']+'%'};return _0x2f7e43;}})});}_0x282521=_[_0x6c04('0x3b')]({},_0x282521,_0x2aef4e[_0x6c04('0x3d')]);var _0x3c7822={'where':_0x282521[_0x6c04('0x38')]};return db[_0x6c04('0x2b')][_0x6c04('0x1d')](_0x3c7822)[_0x6c04('0x24')](function(_0x5b0a43){_0x4120c5[_0x6c04('0x1d')]=_0x5b0a43;if(_0x2aef4e[_0x6c04('0x30')][_0x6c04('0x3e')]){_0x282521[_0x6c04('0x3f')]=[{'all':!![]}];}return db[_0x6c04('0x2b')][_0x6c04('0x40')](_0x282521);})[_0x6c04('0x24')](function(_0x1b98db){_0x4120c5[_0x6c04('0x41')]=_0x1b98db;return _0x4120c5;})[_0x6c04('0x24')](respondWithFilteredResult(_0x51363f,_0x282521))['catch'](handleError(_0x51363f,null));};exports['show']=function(_0x39f5dd,_0x587161){var _0x1227ca={'raw':!![],'where':{'id':_0x39f5dd[_0x6c04('0x42')]['id']}},_0xf9c647={};_0xf9c647[_0x6c04('0x34')]=_[_0x6c04('0x2f')](db[_0x6c04('0x2b')][_0x6c04('0x43')]);_0xf9c647['query']=_[_0x6c04('0x2f')](_0x39f5dd[_0x6c04('0x30')]);_0xf9c647[_0x6c04('0x31')]=_[_0x6c04('0x33')](_0xf9c647[_0x6c04('0x34')],_0xf9c647[_0x6c04('0x30')]);_0x1227ca[_0x6c04('0x32')]=_[_0x6c04('0x33')](_0xf9c647[_0x6c04('0x34')],qs[_0x6c04('0x44')](_0x39f5dd[_0x6c04('0x30')][_0x6c04('0x44')]));_0x1227ca[_0x6c04('0x32')]=_0x1227ca['attributes'][_0x6c04('0x45')]?_0x1227ca[_0x6c04('0x32')]:_0xf9c647[_0x6c04('0x34')];if(_0x39f5dd[_0x6c04('0x30')][_0x6c04('0x3e')]){_0x1227ca[_0x6c04('0x3f')]=[{'all':!![]}];}_0x1227ca=_['merge']({},_0x1227ca,_0x39f5dd['options']);return db[_0x6c04('0x2b')]['find'](_0x1227ca)[_0x6c04('0x24')](handleEntityNotFound(_0x587161,null))[_0x6c04('0x24')](respondWithResult(_0x587161,null))[_0x6c04('0x46')](handleError(_0x587161,null));};exports['create']=function(_0xfad6a0,_0x5d2cef){return db['FreshsalesField'][_0x6c04('0x47')](_0xfad6a0[_0x6c04('0x48')],{})[_0x6c04('0x24')](respondWithResult(_0x5d2cef,0xc9))[_0x6c04('0x46')](handleError(_0x5d2cef,null));};exports['update']=function(_0x583ccc,_0x58bd84){if(_0x583ccc[_0x6c04('0x48')]['id']){delete _0x583ccc[_0x6c04('0x48')]['id'];}return db[_0x6c04('0x2b')][_0x6c04('0x49')]({'where':{'id':_0x583ccc['params']['id']}})['then'](handleEntityNotFound(_0x58bd84,null))[_0x6c04('0x24')](saveUpdates(_0x583ccc[_0x6c04('0x48')],null))[_0x6c04('0x24')](respondWithResult(_0x58bd84,null))[_0x6c04('0x46')](handleError(_0x58bd84,null));};exports['destroy']=function(_0x138088,_0x4233f7){return db[_0x6c04('0x2b')][_0x6c04('0x49')]({'where':{'id':_0x138088['params']['id']}})[_0x6c04('0x24')](handleEntityNotFound(_0x4233f7,null))[_0x6c04('0x24')](removeEntity(_0x4233f7,null))['catch'](handleError(_0x4233f7,null));}; \ No newline at end of file +var _0x3542=['stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','FreshsalesField','count','include','findAll','rows','params','keys','includeAll','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','squel','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','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x3542,0x194));var _0x2354=function(_0x40292e,_0xaa2a7b){_0x40292e=_0x40292e-0x0;var _0x1ed986=_0x3542[_0x40292e];return _0x1ed986;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2354('0x0'));var zipdir=require(_0x2354('0x1'));var jsonpatch=require(_0x2354('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2354('0x3'));var Mustache=require(_0x2354('0x4'));var util=require(_0x2354('0x5'));var path=require('path');var sox=require(_0x2354('0x6'));var csv=require('to-csv');var ejs=require(_0x2354('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2354('0x8'));var squel=require(_0x2354('0x9'));var crypto=require('crypto');var jsforce=require(_0x2354('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2354('0xb'));var querystring=require(_0x2354('0xc'));var Papa=require(_0x2354('0xd'));var Redis=require(_0x2354('0xe'));var authService=require(_0x2354('0xf'));var qs=require(_0x2354('0x10'));var as=require(_0x2354('0x11'));var hardwareService=require(_0x2354('0x12'));var logger=require(_0x2354('0x13'))(_0x2354('0x14'));var utils=require(_0x2354('0x15'));var config=require(_0x2354('0x16'));var licenseUtil=require(_0x2354('0x17'));var db=require(_0x2354('0x18'))['db'];function respondWithStatusCode(_0x4fa737,_0x3b973c){_0x3b973c=_0x3b973c||0xcc;return function(_0x4d14e7){if(_0x4d14e7){return _0x4fa737[_0x2354('0x19')](_0x3b973c);}return _0x4fa737[_0x2354('0x1a')](_0x3b973c)[_0x2354('0x1b')]();};}function respondWithResult(_0x24c8c5,_0x271814){_0x271814=_0x271814||0xc8;return function(_0x34a4fe){if(_0x34a4fe){return _0x24c8c5[_0x2354('0x1a')](_0x271814)[_0x2354('0x1c')](_0x34a4fe);}};}function respondWithFilteredResult(_0x328c16,_0x2c8d8d){return function(_0x467a04){if(_0x467a04){var _0x49ae46=typeof _0x2c8d8d[_0x2354('0x1d')]===_0x2354('0x1e')&&typeof _0x2c8d8d[_0x2354('0x1f')]===_0x2354('0x1e');var _0x5edc98=_0x467a04['count'];var _0x37acdf=_0x49ae46?0x0:_0x2c8d8d[_0x2354('0x1d')];var _0x12d5a0=_0x49ae46?_0x467a04['count']:_0x2c8d8d[_0x2354('0x1d')]+_0x2c8d8d[_0x2354('0x1f')];var _0x96ab90;if(_0x12d5a0>=_0x5edc98){_0x12d5a0=_0x5edc98;_0x96ab90=0xc8;}else{_0x96ab90=0xce;}_0x328c16[_0x2354('0x1a')](_0x96ab90);return _0x328c16[_0x2354('0x20')]('Content-Range',_0x37acdf+'-'+_0x12d5a0+'/'+_0x5edc98)['json'](_0x467a04);}return null;};}function patchUpdates(_0x15005c){return function(_0x134564){try{jsonpatch[_0x2354('0x21')](_0x134564,_0x15005c,!![]);}catch(_0x495f61){return BPromise[_0x2354('0x22')](_0x495f61);}return _0x134564[_0x2354('0x23')]();};}function saveUpdates(_0x1d33cd,_0x2eb24e){return function(_0xa4969){if(_0xa4969){return _0xa4969[_0x2354('0x24')](_0x1d33cd)[_0x2354('0x25')](function(_0x7b344c){return _0x7b344c;});}return null;};}function removeEntity(_0x1d2d66,_0x5b7dd6){return function(_0x3d7360){if(_0x3d7360){return _0x3d7360[_0x2354('0x26')]()[_0x2354('0x25')](function(){_0x1d2d66[_0x2354('0x1a')](0xcc)[_0x2354('0x1b')]();});}};}function handleEntityNotFound(_0x140181,_0x10629a){return function(_0x2ea728){if(!_0x2ea728){_0x140181[_0x2354('0x19')](0x194);}return _0x2ea728;};}function handleError(_0x580f63,_0x32a231){_0x32a231=_0x32a231||0x1f4;return function(_0x529436){logger[_0x2354('0x27')](_0x529436[_0x2354('0x28')]);if(_0x529436[_0x2354('0x29')]){delete _0x529436[_0x2354('0x29')];}_0x580f63[_0x2354('0x1a')](_0x32a231)[_0x2354('0x2a')](_0x529436);};}exports['index']=function(_0x1055b0,_0x3a71ad){var _0x1dd241={},_0x16044f={},_0x559da4={'count':0x0,'rows':[]};var _0x5e529=_[_0x2354('0x2b')](db['FreshsalesField'][_0x2354('0x2c')],function(_0x2106d1){return{'name':_0x2106d1[_0x2354('0x2d')],'type':_0x2106d1[_0x2354('0x2e')][_0x2354('0x2f')]};});_0x16044f[_0x2354('0x30')]=_['map'](_0x5e529,'name');_0x16044f[_0x2354('0x31')]=_['keys'](_0x1055b0['query']);_0x16044f[_0x2354('0x32')]=_[_0x2354('0x33')](_0x16044f[_0x2354('0x30')],_0x16044f[_0x2354('0x31')]);_0x1dd241[_0x2354('0x34')]=_['intersection'](_0x16044f[_0x2354('0x30')],qs[_0x2354('0x35')](_0x1055b0['query'][_0x2354('0x35')]));_0x1dd241[_0x2354('0x34')]=_0x1dd241['attributes'][_0x2354('0x36')]?_0x1dd241[_0x2354('0x34')]:_0x16044f[_0x2354('0x30')];if(!_0x1055b0['query']['hasOwnProperty']('nolimit')){_0x1dd241[_0x2354('0x1f')]=qs[_0x2354('0x1f')](_0x1055b0[_0x2354('0x31')][_0x2354('0x1f')]);_0x1dd241[_0x2354('0x1d')]=qs[_0x2354('0x1d')](_0x1055b0['query']['offset']);}_0x1dd241['order']=qs[_0x2354('0x37')](_0x1055b0[_0x2354('0x31')][_0x2354('0x37')]);_0x1dd241['where']=qs['filters'](_[_0x2354('0x38')](_0x1055b0[_0x2354('0x31')],_0x16044f['filters']),_0x5e529);if(_0x1055b0[_0x2354('0x31')][_0x2354('0x39')]){_0x1dd241[_0x2354('0x3a')]=_[_0x2354('0x3b')](_0x1dd241[_0x2354('0x3a')],{'$or':_[_0x2354('0x2b')](_0x5e529,function(_0x34ae58){if(_0x34ae58[_0x2354('0x2e')]!==_0x2354('0x3c')){var _0x55cded={};_0x55cded[_0x34ae58['name']]={'$like':'%'+_0x1055b0[_0x2354('0x31')]['filter']+'%'};return _0x55cded;}})});}_0x1dd241=_[_0x2354('0x3b')]({},_0x1dd241,_0x1055b0['options']);var _0x2b6cff={'where':_0x1dd241[_0x2354('0x3a')]};return db[_0x2354('0x3d')][_0x2354('0x3e')](_0x2b6cff)['then'](function(_0x8b384f){_0x559da4[_0x2354('0x3e')]=_0x8b384f;if(_0x1055b0[_0x2354('0x31')]['includeAll']){_0x1dd241[_0x2354('0x3f')]=[{'all':!![]}];}return db[_0x2354('0x3d')][_0x2354('0x40')](_0x1dd241);})[_0x2354('0x25')](function(_0x447205){_0x559da4[_0x2354('0x41')]=_0x447205;return _0x559da4;})[_0x2354('0x25')](respondWithFilteredResult(_0x3a71ad,_0x1dd241))['catch'](handleError(_0x3a71ad,null));};exports['show']=function(_0x1d4737,_0x5edeef){var _0x4355b8={'raw':!![],'where':{'id':_0x1d4737[_0x2354('0x42')]['id']}},_0x217bd1={};_0x217bd1[_0x2354('0x30')]=_['keys'](db[_0x2354('0x3d')][_0x2354('0x2c')]);_0x217bd1[_0x2354('0x31')]=_[_0x2354('0x43')](_0x1d4737[_0x2354('0x31')]);_0x217bd1[_0x2354('0x32')]=_[_0x2354('0x33')](_0x217bd1[_0x2354('0x30')],_0x217bd1[_0x2354('0x31')]);_0x4355b8[_0x2354('0x34')]=_[_0x2354('0x33')](_0x217bd1[_0x2354('0x30')],qs[_0x2354('0x35')](_0x1d4737[_0x2354('0x31')]['fields']));_0x4355b8['attributes']=_0x4355b8[_0x2354('0x34')][_0x2354('0x36')]?_0x4355b8[_0x2354('0x34')]:_0x217bd1[_0x2354('0x30')];if(_0x1d4737[_0x2354('0x31')][_0x2354('0x44')]){_0x4355b8[_0x2354('0x3f')]=[{'all':!![]}];}_0x4355b8=_[_0x2354('0x3b')]({},_0x4355b8,_0x1d4737[_0x2354('0x45')]);return db[_0x2354('0x3d')][_0x2354('0x46')](_0x4355b8)[_0x2354('0x25')](handleEntityNotFound(_0x5edeef,null))['then'](respondWithResult(_0x5edeef,null))[_0x2354('0x47')](handleError(_0x5edeef,null));};exports['create']=function(_0x5ed2d9,_0xa54d8){return db['FreshsalesField'][_0x2354('0x48')](_0x5ed2d9['body'],{})[_0x2354('0x25')](respondWithResult(_0xa54d8,0xc9))[_0x2354('0x47')](handleError(_0xa54d8,null));};exports['update']=function(_0x346ab9,_0x5d9dbb){if(_0x346ab9['body']['id']){delete _0x346ab9[_0x2354('0x49')]['id'];}return db[_0x2354('0x3d')][_0x2354('0x46')]({'where':{'id':_0x346ab9[_0x2354('0x42')]['id']}})[_0x2354('0x25')](handleEntityNotFound(_0x5d9dbb,null))[_0x2354('0x25')](saveUpdates(_0x346ab9[_0x2354('0x49')],null))['then'](respondWithResult(_0x5d9dbb,null))[_0x2354('0x47')](handleError(_0x5d9dbb,null));};exports['destroy']=function(_0x438f04,_0x2f72fb){return db[_0x2354('0x3d')][_0x2354('0x46')]({'where':{'id':_0x438f04['params']['id']}})[_0x2354('0x25')](handleEntityNotFound(_0x2f72fb,null))[_0x2354('0x25')](removeEntity(_0x2f72fb,null))[_0x2354('0x47')](handleError(_0x2f72fb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 9008179..b42d7e2 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 _0xbe51=['idField','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xbe51,0x1e2));var _0x1be5=function(_0x32293f,_0x6ac095){_0x32293f=_0x32293f-0x0;var _0x3e0d02=_0xbe51[_0x32293f];return _0x3e0d02;};'use strict';var _=require(_0x1be5('0x0'));var util=require(_0x1be5('0x1'));var logger=require('../../config/logger')(_0x1be5('0x2'));var moment=require('moment');var BPromise=require(_0x1be5('0x3'));var rp=require(_0x1be5('0x4'));var fs=require('fs');var path=require(_0x1be5('0x5'));var rimraf=require(_0x1be5('0x6'));var config=require(_0x1be5('0x7'));var attributes=require(_0x1be5('0x8'));module[_0x1be5('0x9')]=function(_0x372836,_0x288927){return _0x372836[_0x1be5('0xa')](_0x1be5('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x1be5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x27fb=['moment','request-promise','path','rimraf','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2b503e,_0x2bf9a9){var _0x234b33=function(_0x17b7b4){while(--_0x17b7b4){_0x2b503e['push'](_0x2b503e['shift']());}};_0x234b33(++_0x2bf9a9);}(_0x27fb,0x1de));var _0xb27f=function(_0x1b944d,_0x14ac0f){_0x1b944d=_0x1b944d-0x0;var _0x1caddc=_0x27fb[_0x1b944d];return _0x1caddc;};'use strict';var _=require(_0xb27f('0x0'));var util=require(_0xb27f('0x1'));var logger=require(_0xb27f('0x2'))('api');var moment=require(_0xb27f('0x3'));var BPromise=require('bluebird');var rp=require(_0xb27f('0x4'));var fs=require('fs');var path=require(_0xb27f('0x5'));var rimraf=require(_0xb27f('0x6'));var config=require('../../config/environment');var attributes=require(_0xb27f('0x7'));module['exports']=function(_0x2a1fa2,_0x3d70f3){return _0x2a1fa2[_0xb27f('0x8')](_0xb27f('0x9'),attributes,{'tableName':_0xb27f('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xb27f('0xb'),_0xb27f('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 8692576..1acbf57 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x2fe5bd,_0x771691){var _0x1127f6=function(_0x2b5ecc){while(--_0x2b5ecc){_0x2fe5bd['push'](_0x2fe5bd['shift']());}};_0x1127f6(++_0x771691);}(_0xabce,0x103));var _0xeabc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xabce[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('FreshsalesField,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x673722,_0x275d7e){var _0x21249c=function(_0x25b4e7){while(--_0x25b4e7){_0x673722['push'](_0x673722['shift']());}};_0x21249c(++_0x275d7e);}(_0xd8fb,0x99));var _0xbd8f=function(_0x7f8009,_0x182798){_0x7f8009=_0x7f8009-0x0;var _0x4bc0ef=_0xd8fb[_0x7f8009];return _0x4bc0ef;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b2bd1b3..07b7c45 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(_0x278854,_0x1adff0){var _0x1024b9=function(_0x52e275){while(--_0x52e275){_0x278854['push'](_0x278854['shift']());}};_0x1024b9(++_0x1adff0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x44817a,_0x16f8ae){var _0x55af6b=function(_0x1e6d12){while(--_0x1e6d12){_0x44817a['push'](_0x44817a['shift']());}};_0x55af6b(++_0x16f8ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 3468b20..ceb9fee 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 _0xc17b=['sequelize','exports','STRING','username','integrationTab','newTab'];(function(_0x5405d5,_0x55d1fe){var _0xa67e1e=function(_0x221206){while(--_0x221206){_0x5405d5['push'](_0x5405d5['shift']());}};_0xa67e1e(++_0x55d1fe);}(_0xc17b,0xa2));var _0xbc17=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xc17b[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xbc17('0x0'));module[_0xbc17('0x1')]={'name':{'type':Sequelize[_0xbc17('0x2')]},'description':{'type':Sequelize[_0xbc17('0x2')]},'username':{'type':Sequelize[_0xbc17('0x2')],'unique':_0xbc17('0x3')},'remoteUri':{'type':Sequelize[_0xbc17('0x2')]},'password':{'type':Sequelize[_0xbc17('0x2')]},'clientId':{'type':Sequelize[_0xbc17('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xbc17('0x2')]},'serverUrl':{'type':Sequelize[_0xbc17('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbc17('0x4'),_0xbc17('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2432=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2432,0x7a));var _0x2243=function(_0x44046e,_0x43f1c3){_0x44046e=_0x44046e-0x0;var _0x4d8ed7=_0x2432[_0x44046e];return _0x4d8ed7;};'use strict';var Sequelize=require(_0x2243('0x0'));module[_0x2243('0x1')]={'name':{'type':Sequelize[_0x2243('0x2')]},'description':{'type':Sequelize[_0x2243('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x2243('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2243('0x2')]},'clientId':{'type':Sequelize[_0x2243('0x2')]},'clientSecret':{'type':Sequelize[_0x2243('0x2')]},'securityToken':{'type':Sequelize[_0x2243('0x2')]},'serverUrl':{'type':Sequelize[_0x2243('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2243('0x4')](_0x2243('0x5'),_0x2243('0x6')),'defaultValue':_0x2243('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d5dff98..75a76a6 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 _0x89b8=['False','false','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','../../components/integrations/configuration','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceAccount','includeAll','include','findAll','then','show','params','find','catch','create','body','destroy','findOne','SalesforceConfiguration','nolimit','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','slice','login','username','password','concat','securityToken','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','true'];(function(_0x4b4100,_0x1b7591){var _0x31487a=function(_0x1da4fe){while(--_0x1da4fe){_0x4b4100['push'](_0x4b4100['shift']());}};_0x31487a(++_0x1b7591);}(_0x89b8,0x17a));var _0x889b=function(_0x46cb65,_0x21a706){_0x46cb65=_0x46cb65-0x0;var _0x1246c3=_0x89b8[_0x46cb65];return _0x1246c3;};'use strict';var emlformat=require(_0x889b('0x0'));var rimraf=require(_0x889b('0x1'));var zipdir=require(_0x889b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x889b('0x3'));var BPromise=require(_0x889b('0x4'));var Mustache=require('mustache');var util=require(_0x889b('0x5'));var path=require(_0x889b('0x6'));var sox=require(_0x889b('0x7'));var csv=require(_0x889b('0x8'));var ejs=require(_0x889b('0x9'));var fs=require('fs');var fs_extra=require(_0x889b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x889b('0xb'));var jsforce=require(_0x889b('0xc'));var deskjs=require(_0x889b('0xd'));var toCsv=require(_0x889b('0x8'));var querystring=require('querystring');var Papa=require(_0x889b('0xe'));var Redis=require('ioredis');var authService=require(_0x889b('0xf'));var qs=require(_0x889b('0x10'));var as=require(_0x889b('0x11'));var hardwareService=require(_0x889b('0x12'));var logger=require(_0x889b('0x13'))(_0x889b('0x14'));var utils=require(_0x889b('0x15'));var config=require(_0x889b('0x16'));var licenseUtil=require(_0x889b('0x17'));var db=require(_0x889b('0x18'))['db'];var integrations=require(_0x889b('0x19'));function respondWithStatusCode(_0x14eeb0,_0x11b872){_0x11b872=_0x11b872||0xcc;return function(_0x44d960){if(_0x44d960){return _0x14eeb0['sendStatus'](_0x11b872);}return _0x14eeb0[_0x889b('0x1a')](_0x11b872)[_0x889b('0x1b')]();};}function respondWithResult(_0x30f6cf,_0x17f829){_0x17f829=_0x17f829||0xc8;return function(_0x543743){if(_0x543743){return _0x30f6cf[_0x889b('0x1a')](_0x17f829)[_0x889b('0x1c')](_0x543743);}};}function respondWithFilteredResult(_0x1c8c18,_0x1b6602){return function(_0x45686e){if(_0x45686e){var _0x44b426=typeof _0x1b6602[_0x889b('0x1d')]===_0x889b('0x1e')&&typeof _0x1b6602['limit']===_0x889b('0x1e');var _0x1c5fc2=_0x45686e[_0x889b('0x1f')];var _0x2a7579=_0x44b426?0x0:_0x1b6602['offset'];var _0x4763c7=_0x44b426?_0x45686e[_0x889b('0x1f')]:_0x1b6602[_0x889b('0x1d')]+_0x1b6602['limit'];var _0x3cd89e;if(_0x4763c7>=_0x1c5fc2){_0x4763c7=_0x1c5fc2;_0x3cd89e=0xc8;}else{_0x3cd89e=0xce;}_0x1c8c18[_0x889b('0x1a')](_0x3cd89e);return _0x1c8c18[_0x889b('0x20')](_0x889b('0x21'),_0x2a7579+'-'+_0x4763c7+'/'+_0x1c5fc2)[_0x889b('0x1c')](_0x45686e);}return null;};}function patchUpdates(_0x12633c){return function(_0x5464f6){try{jsonpatch[_0x889b('0x22')](_0x5464f6,_0x12633c,!![]);}catch(_0x45b519){return BPromise[_0x889b('0x23')](_0x45b519);}return _0x5464f6['save']();};}function saveUpdates(_0x1e6d7d,_0x2509ea){return function(_0x564d9d){if(_0x564d9d){return _0x564d9d[_0x889b('0x24')](_0x1e6d7d)['then'](function(_0x3eb4a3){return _0x3eb4a3;});}return null;};}function removeEntity(_0x17d272,_0x158c9c){return function(_0x347e2b){if(_0x347e2b){return _0x347e2b['destroy']()['then'](function(){_0x17d272['status'](0xcc)[_0x889b('0x1b')]();});}};}function handleEntityNotFound(_0x5e7923,_0x42ba2b){return function(_0x4cf285){if(!_0x4cf285){_0x5e7923[_0x889b('0x25')](0x194);}return _0x4cf285;};}function handleError(_0x5b2312,_0xd171d4){_0xd171d4=_0xd171d4||0x1f4;return function(_0x342ce8){logger[_0x889b('0x26')](_0x342ce8[_0x889b('0x27')]);if(_0x342ce8[_0x889b('0x28')]){delete _0x342ce8[_0x889b('0x28')];}_0x5b2312[_0x889b('0x1a')](_0xd171d4)['send'](_0x342ce8);};}exports[_0x889b('0x29')]=function(_0x351a3b,_0x297743){var _0x5ef0e0={},_0xec78e4={},_0x307dfb={'count':0x0,'rows':[]};var _0x5260d3=_[_0x889b('0x2a')](db['SalesforceAccount'][_0x889b('0x2b')],function(_0x4b3363){return{'name':_0x4b3363[_0x889b('0x2c')],'type':_0x4b3363[_0x889b('0x2d')]['key']};});_0xec78e4['model']=_['map'](_0x5260d3,'name');_0xec78e4[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x351a3b[_0x889b('0x2e')]);_0xec78e4[_0x889b('0x30')]=_[_0x889b('0x31')](_0xec78e4[_0x889b('0x32')],_0xec78e4[_0x889b('0x2e')]);_0x5ef0e0[_0x889b('0x33')]=_[_0x889b('0x31')](_0xec78e4[_0x889b('0x32')],qs['fields'](_0x351a3b[_0x889b('0x2e')][_0x889b('0x34')]));_0x5ef0e0['attributes']=_0x5ef0e0['attributes'][_0x889b('0x35')]?_0x5ef0e0[_0x889b('0x33')]:_0xec78e4[_0x889b('0x32')];if(!_0x351a3b['query'][_0x889b('0x36')]('nolimit')){_0x5ef0e0[_0x889b('0x37')]=qs['limit'](_0x351a3b['query'][_0x889b('0x37')]);_0x5ef0e0[_0x889b('0x1d')]=qs[_0x889b('0x1d')](_0x351a3b['query'][_0x889b('0x1d')]);}_0x5ef0e0[_0x889b('0x38')]=qs[_0x889b('0x39')](_0x351a3b[_0x889b('0x2e')][_0x889b('0x39')]);_0x5ef0e0[_0x889b('0x3a')]=qs[_0x889b('0x30')](_[_0x889b('0x3b')](_0x351a3b[_0x889b('0x2e')],_0xec78e4[_0x889b('0x30')]),_0x5260d3);if(_0x351a3b[_0x889b('0x2e')][_0x889b('0x3c')]){_0x5ef0e0[_0x889b('0x3a')]=_['merge'](_0x5ef0e0['where'],{'$or':_[_0x889b('0x2a')](_0x5260d3,function(_0x1a61b5){if(_0x1a61b5[_0x889b('0x2d')]!==_0x889b('0x3d')){var _0x272201={};_0x272201[_0x1a61b5['name']]={'$like':'%'+_0x351a3b[_0x889b('0x2e')][_0x889b('0x3c')]+'%'};return _0x272201;}})});}_0x5ef0e0=_[_0x889b('0x3e')]({},_0x5ef0e0,_0x351a3b[_0x889b('0x3f')]);var _0x485e0e={'where':_0x5ef0e0[_0x889b('0x3a')]};return db[_0x889b('0x40')]['count'](_0x485e0e)['then'](function(_0xaa9785){_0x307dfb['count']=_0xaa9785;if(_0x351a3b['query'][_0x889b('0x41')]){_0x5ef0e0[_0x889b('0x42')]=[{'all':!![]}];}return db[_0x889b('0x40')][_0x889b('0x43')](_0x5ef0e0);})[_0x889b('0x44')](function(_0x4cf39d){_0x307dfb['rows']=_0x4cf39d;return _0x307dfb;})[_0x889b('0x44')](respondWithFilteredResult(_0x297743,_0x5ef0e0))['catch'](handleError(_0x297743,null));};exports[_0x889b('0x45')]=function(_0x262a87,_0xf98f3d){var _0x24bbf2={'raw':![],'where':{'id':_0x262a87[_0x889b('0x46')]['id']}},_0x5ba8c9={};_0x5ba8c9[_0x889b('0x32')]=_[_0x889b('0x2f')](db[_0x889b('0x40')][_0x889b('0x2b')]);_0x5ba8c9[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x262a87[_0x889b('0x2e')]);_0x5ba8c9[_0x889b('0x30')]=_['intersection'](_0x5ba8c9[_0x889b('0x32')],_0x5ba8c9['query']);_0x24bbf2[_0x889b('0x33')]=_['intersection'](_0x5ba8c9['model'],qs[_0x889b('0x34')](_0x262a87[_0x889b('0x2e')][_0x889b('0x34')]));_0x24bbf2[_0x889b('0x33')]=_0x24bbf2['attributes'][_0x889b('0x35')]?_0x24bbf2['attributes']:_0x5ba8c9[_0x889b('0x32')];if(_0x262a87[_0x889b('0x2e')][_0x889b('0x41')]){_0x24bbf2['include']=[{'all':!![]}];}_0x24bbf2=_[_0x889b('0x3e')]({},_0x24bbf2,_0x262a87[_0x889b('0x3f')]);return db[_0x889b('0x40')][_0x889b('0x47')](_0x24bbf2)[_0x889b('0x44')](handleEntityNotFound(_0xf98f3d,null))[_0x889b('0x44')](respondWithResult(_0xf98f3d,null))[_0x889b('0x48')](handleError(_0xf98f3d,null));};exports[_0x889b('0x49')]=function(_0x43c837,_0x49d60c){return db['SalesforceAccount'][_0x889b('0x49')](_0x43c837[_0x889b('0x4a')],{})['then'](respondWithResult(_0x49d60c,0xc9))['catch'](handleError(_0x49d60c,null));};exports[_0x889b('0x24')]=function(_0x275178,_0x197c1d){if(_0x275178[_0x889b('0x4a')]['id']){delete _0x275178[_0x889b('0x4a')]['id'];}return db[_0x889b('0x40')][_0x889b('0x47')]({'where':{'id':_0x275178[_0x889b('0x46')]['id']}})['then'](handleEntityNotFound(_0x197c1d,null))[_0x889b('0x44')](saveUpdates(_0x275178[_0x889b('0x4a')],null))[_0x889b('0x44')](respondWithResult(_0x197c1d,null))[_0x889b('0x48')](handleError(_0x197c1d,null));};exports[_0x889b('0x4b')]=function(_0x29b44d,_0x556c22){return db[_0x889b('0x40')][_0x889b('0x47')]({'where':{'id':_0x29b44d[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x556c22,null))[_0x889b('0x44')](removeEntity(_0x556c22,null))[_0x889b('0x48')](handleError(_0x556c22,null));};exports['getConfigurations']=function(_0x468c03,_0x3cdf8b,_0x1ed66e){var _0x116c86={};var _0x1fa3c9={};var _0xafb166;var _0x18393e;return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x468c03[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x3cdf8b,null))['then'](function(_0x191f4d){if(_0x191f4d){_0xafb166=_0x191f4d;_0x1fa3c9[_0x889b('0x32')]=_[_0x889b('0x2f')](db[_0x889b('0x4d')]['rawAttributes']);_0x1fa3c9[_0x889b('0x2e')]=_[_0x889b('0x2f')](_0x468c03[_0x889b('0x2e')]);_0x1fa3c9[_0x889b('0x30')]=_[_0x889b('0x31')](_0x1fa3c9['model'],_0x1fa3c9['query']);_0x116c86[_0x889b('0x33')]=_[_0x889b('0x31')](_0x1fa3c9['model'],qs['fields'](_0x468c03[_0x889b('0x2e')]['fields']));_0x116c86[_0x889b('0x33')]=_0x116c86[_0x889b('0x33')]['length']?_0x116c86[_0x889b('0x33')]:_0x1fa3c9[_0x889b('0x32')];_0x116c86[_0x889b('0x38')]=qs['sort'](_0x468c03[_0x889b('0x2e')]['sort']);_0x116c86[_0x889b('0x3a')]=qs['filters'](_[_0x889b('0x3b')](_0x468c03[_0x889b('0x2e')],_0x1fa3c9[_0x889b('0x30')]));if(_0x468c03['query'][_0x889b('0x3c')]){_0x116c86[_0x889b('0x3a')]=_['merge'](_0x116c86[_0x889b('0x3a')],{'$or':_[_0x889b('0x2a')](_0x116c86[_0x889b('0x33')],function(_0x598c88){var _0x3e0073={};_0x3e0073[_0x598c88]={'$like':'%'+_0x468c03['query'][_0x889b('0x3c')]+'%'};return _0x3e0073;})});}_0x116c86=_[_0x889b('0x3e')]({},_0x116c86,_0x468c03[_0x889b('0x3f')]);return _0xafb166['getConfigurations'](_0x116c86);}})['then'](function(_0x499cb1){if(_0x499cb1){_0x18393e=_0x499cb1['length'];if(!_0x468c03[_0x889b('0x2e')][_0x889b('0x36')](_0x889b('0x4e'))){_0x116c86[_0x889b('0x37')]=qs[_0x889b('0x37')](_0x468c03[_0x889b('0x2e')]['limit']);_0x116c86[_0x889b('0x1d')]=qs[_0x889b('0x1d')](_0x468c03[_0x889b('0x2e')][_0x889b('0x1d')]);}return _0xafb166[_0x889b('0x4f')](_0x116c86);}})[_0x889b('0x44')](function(_0x10e735){if(_0x10e735){return _0x10e735?{'count':_0x18393e,'rows':_0x10e735}:null;}})[_0x889b('0x44')](respondWithResult(_0x3cdf8b,null))['catch'](handleError(_0x3cdf8b,null));};exports[_0x889b('0x50')]=function(_0x2f2bcc,_0x2e5bee,_0x1b7b9c){if(_0x2f2bcc[_0x889b('0x4a')]['id']){delete _0x2f2bcc[_0x889b('0x4a')]['id'];}return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x2f2bcc[_0x889b('0x46')]['id']}})[_0x889b('0x44')](handleEntityNotFound(_0x2e5bee,null))[_0x889b('0x44')](function(_0xcba81b){if(_0xcba81b){_0x2f2bcc['body']['AccountId']=_0xcba81b['id'];_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x51')]=integrations[_0x889b('0x52')](_0x2f2bcc[_0x889b('0x4a')]['channel'],_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x2d')]);_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x53')]=integrations[_0x889b('0x54')](_0x2f2bcc[_0x889b('0x4a')][_0x889b('0x55')],_0x2f2bcc[_0x889b('0x4a')]['type']);return db[_0x889b('0x4d')][_0x889b('0x49')](_0x2f2bcc[_0x889b('0x4a')],{'include':[{'model':db[_0x889b('0x56')],'as':'Subjects'},{'model':db[_0x889b('0x56')],'as':_0x889b('0x53')}]});}return null;})[_0x889b('0x44')](respondWithResult(_0x2e5bee,null))[_0x889b('0x48')](handleError(_0x2e5bee,null));};exports[_0x889b('0x57')]=function(_0x2379d6,_0x4ee253,_0x4a2119){var _0x24e663;var _0x5a91db='';var _0x54f485=_0x889b('0x58');return db[_0x889b('0x40')][_0x889b('0x4c')]({'where':{'id':_0x2379d6[_0x889b('0x46')]['id']},'attributes':['id',_0x889b('0x59'),_0x889b('0x5a'),_0x889b('0x5b'),'username','password','securityToken']})['then'](handleEntityNotFound(_0x4ee253,null))[_0x889b('0x44')](function(_0x3404bc){if(_0x3404bc){_0x5a91db=_0x3404bc[_0x889b('0x59')];var _0x235b91=_0x5a91db[_0x889b('0x5c')](-0x1);if(_0x235b91==='/'){_0x5a91db=_0x5a91db['substring'](0x0,_0x5a91db['lastIndexOf'](_0x235b91));}_0x24e663=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5a91db,'clientId':_0x3404bc[_0x889b('0x5a')],'clientSecret':_0x3404bc[_0x889b('0x5b')]}});return _0x24e663[_0x889b('0x5d')](_0x3404bc[_0x889b('0x5e')],_0x3404bc[_0x889b('0x5f')][_0x889b('0x60')](_0x3404bc[_0x889b('0x61')]));}})['then'](function(_0x18b805){if(_0x18b805){if(!_[_0x889b('0x62')](_0x2379d6['query'][_0x889b('0x63')])){_0x54f485=_0x2379d6[_0x889b('0x2e')][_0x889b('0x63')];}return _0x24e663['sobject'](_0x54f485)[_0x889b('0x64')]();}})[_0x889b('0x44')](function(_0x26d146){var _0x473eb9=[_0x889b('0x65'),_0x889b('0x66'),_0x889b('0x67'),'IsRecurrence',_0x889b('0x68'),'Description'];var _0x5b0be4=[_0x889b('0x69'),_0x889b('0x6a'),'picklist',_0x889b('0x6b'),_0x889b('0x6c'),_0x889b('0x6d'),_0x889b('0x6e')];if(_0x26d146){_[_0x889b('0x6f')](_0x26d146[_0x889b('0x34')],function(_0x19fdeb){return _0x473eb9['includes'](_0x19fdeb['name'])||!_0x5b0be4[_0x889b('0x70')](_0x19fdeb[_0x889b('0x2d')]);});return{'count':_0x26d146['fields']['length'],'rows':_[_0x889b('0x2a')](_0x26d146['fields'],function(_0x3cba2e){return{'id':_0x3cba2e[_0x889b('0x28')],'name':_0x3cba2e[_0x889b('0x71')],'custom':_0x3cba2e['custom'],'options':_0x3cba2e[_0x889b('0x72')][_0x889b('0x35')]>0x0?_[_0x889b('0x2a')](_0x3cba2e[_0x889b('0x72')],function(_0xe73f77){return{'name':_0xe73f77['label'],'value':_0xe73f77[_0x889b('0x73')]};}):_0x3cba2e[_0x889b('0x2d')]==_0x889b('0x6b')?[{'name':_0x889b('0x74'),'value':_0x889b('0x75')},{'name':_0x889b('0x76'),'value':_0x889b('0x77')}]:[]};})};}})[_0x889b('0x44')](respondWithResult(_0x4ee253,null))['catch'](function(_0x26fb22){var _0x19871d=_0x2379d6[_0x889b('0x2e')][_0x889b('0x78')]?0x1f4:_0x26fb22[_0x889b('0x79')]||0x1f4;logger[_0x889b('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x889b('0x57'),_0x19871d,JSON['stringify'](_0x26fb22));delete _0x26fb22[_0x889b('0x28')];if(_0x19871d===0x191){_0x19871d=0x190;}_0x4ee253[_0x889b('0x1a')](_0x19871d)[_0x889b('0x7a')](_0x2379d6[_0x889b('0x2e')]['test']?{'message':_0x889b('0x7b'),'statusCode':_0x26fb22[_0x889b('0x79')]}:_0x26fb22);});}; \ No newline at end of file +var _0x6167=['where','filter','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','username','securityToken','slice','lastIndexOf','Connection','clientSecret','login','password','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort'];(function(_0x13aba8,_0x4217f7){var _0x37c8ba=function(_0x32dc49){while(--_0x32dc49){_0x13aba8['push'](_0x13aba8['shift']());}};_0x37c8ba(++_0x4217f7);}(_0x6167,0x136));var _0x7616=function(_0x3e5af7,_0x522cbf){_0x3e5af7=_0x3e5af7-0x0;var _0x25915a=_0x6167[_0x3e5af7];return _0x25915a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7616('0x0'));var jsonpatch=require(_0x7616('0x1'));var rp=require(_0x7616('0x2'));var moment=require('moment');var BPromise=require(_0x7616('0x3'));var Mustache=require(_0x7616('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7616('0x5'));var fs=require('fs');var fs_extra=require(_0x7616('0x6'));var _=require(_0x7616('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7616('0x8'));var deskjs=require(_0x7616('0x9'));var toCsv=require(_0x7616('0xa'));var querystring=require('querystring');var Papa=require(_0x7616('0xb'));var Redis=require(_0x7616('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7616('0xd'));var logger=require(_0x7616('0xe'))(_0x7616('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7616('0x10'));var db=require(_0x7616('0x11'))['db'];var integrations=require(_0x7616('0x12'));function respondWithStatusCode(_0x5cfa76,_0x122f1c){_0x122f1c=_0x122f1c||0xcc;return function(_0x375962){if(_0x375962){return _0x5cfa76[_0x7616('0x13')](_0x122f1c);}return _0x5cfa76[_0x7616('0x14')](_0x122f1c)[_0x7616('0x15')]();};}function respondWithResult(_0x2da939,_0x40dbc8){_0x40dbc8=_0x40dbc8||0xc8;return function(_0x15d9f3){if(_0x15d9f3){return _0x2da939['status'](_0x40dbc8)[_0x7616('0x16')](_0x15d9f3);}};}function respondWithFilteredResult(_0x940309,_0x3b9873){return function(_0x1b9208){if(_0x1b9208){var _0x26be0f=typeof _0x3b9873[_0x7616('0x17')]===_0x7616('0x18')&&typeof _0x3b9873[_0x7616('0x19')]===_0x7616('0x18');var _0x384779=_0x1b9208[_0x7616('0x1a')];var _0x1182bd=_0x26be0f?0x0:_0x3b9873[_0x7616('0x17')];var _0x162007=_0x26be0f?_0x1b9208[_0x7616('0x1a')]:_0x3b9873[_0x7616('0x17')]+_0x3b9873[_0x7616('0x19')];var _0x58252f;if(_0x162007>=_0x384779){_0x162007=_0x384779;_0x58252f=0xc8;}else{_0x58252f=0xce;}_0x940309['status'](_0x58252f);return _0x940309[_0x7616('0x1b')]('Content-Range',_0x1182bd+'-'+_0x162007+'/'+_0x384779)['json'](_0x1b9208);}return null;};}function patchUpdates(_0x287a0c){return function(_0x151d68){try{jsonpatch[_0x7616('0x1c')](_0x151d68,_0x287a0c,!![]);}catch(_0x6713d5){return BPromise[_0x7616('0x1d')](_0x6713d5);}return _0x151d68[_0x7616('0x1e')]();};}function saveUpdates(_0x3e6b52,_0x457e6e){return function(_0x31e67b){if(_0x31e67b){return _0x31e67b[_0x7616('0x1f')](_0x3e6b52)['then'](function(_0x2849a2){return _0x2849a2;});}return null;};}function removeEntity(_0x31e598,_0x2fdddd){return function(_0x123711){if(_0x123711){return _0x123711[_0x7616('0x20')]()[_0x7616('0x21')](function(){_0x31e598['status'](0xcc)[_0x7616('0x15')]();});}};}function handleEntityNotFound(_0x591425,_0x5a5603){return function(_0x235ee8){if(!_0x235ee8){_0x591425[_0x7616('0x13')](0x194);}return _0x235ee8;};}function handleError(_0x5b2aed,_0x9883f7){_0x9883f7=_0x9883f7||0x1f4;return function(_0x59bb17){logger[_0x7616('0x22')](_0x59bb17['stack']);if(_0x59bb17[_0x7616('0x23')]){delete _0x59bb17['name'];}_0x5b2aed['status'](_0x9883f7)[_0x7616('0x24')](_0x59bb17);};}exports['index']=function(_0x3ea373,_0x476f44){var _0x5c2de0={},_0x35477b={},_0x30501b={'count':0x0,'rows':[]};var _0x2521ce=_[_0x7616('0x25')](db[_0x7616('0x26')][_0x7616('0x27')],function(_0x198416){return{'name':_0x198416[_0x7616('0x28')],'type':_0x198416[_0x7616('0x29')][_0x7616('0x2a')]};});_0x35477b[_0x7616('0x2b')]=_[_0x7616('0x25')](_0x2521ce,_0x7616('0x23'));_0x35477b[_0x7616('0x2c')]=_[_0x7616('0x2d')](_0x3ea373[_0x7616('0x2c')]);_0x35477b[_0x7616('0x2e')]=_['intersection'](_0x35477b[_0x7616('0x2b')],_0x35477b[_0x7616('0x2c')]);_0x5c2de0[_0x7616('0x2f')]=_[_0x7616('0x30')](_0x35477b[_0x7616('0x2b')],qs[_0x7616('0x31')](_0x3ea373[_0x7616('0x2c')]['fields']));_0x5c2de0['attributes']=_0x5c2de0[_0x7616('0x2f')][_0x7616('0x32')]?_0x5c2de0['attributes']:_0x35477b[_0x7616('0x2b')];if(!_0x3ea373[_0x7616('0x2c')]['hasOwnProperty'](_0x7616('0x33'))){_0x5c2de0[_0x7616('0x19')]=qs[_0x7616('0x19')](_0x3ea373[_0x7616('0x2c')][_0x7616('0x19')]);_0x5c2de0[_0x7616('0x17')]=qs['offset'](_0x3ea373[_0x7616('0x2c')][_0x7616('0x17')]);}_0x5c2de0['order']=qs[_0x7616('0x34')](_0x3ea373['query'][_0x7616('0x34')]);_0x5c2de0[_0x7616('0x35')]=qs[_0x7616('0x2e')](_['pick'](_0x3ea373[_0x7616('0x2c')],_0x35477b['filters']),_0x2521ce);if(_0x3ea373[_0x7616('0x2c')][_0x7616('0x36')]){_0x5c2de0[_0x7616('0x35')]=_['merge'](_0x5c2de0[_0x7616('0x35')],{'$or':_[_0x7616('0x25')](_0x2521ce,function(_0x1d6e0c){if(_0x1d6e0c[_0x7616('0x29')]!==_0x7616('0x37')){var _0x2ef82f={};_0x2ef82f[_0x1d6e0c[_0x7616('0x23')]]={'$like':'%'+_0x3ea373[_0x7616('0x2c')][_0x7616('0x36')]+'%'};return _0x2ef82f;}})});}_0x5c2de0=_['merge']({},_0x5c2de0,_0x3ea373[_0x7616('0x38')]);var _0x465af2={'where':_0x5c2de0['where']};return db[_0x7616('0x26')][_0x7616('0x1a')](_0x465af2)[_0x7616('0x21')](function(_0x22f2a6){_0x30501b[_0x7616('0x1a')]=_0x22f2a6;if(_0x3ea373['query']['includeAll']){_0x5c2de0['include']=[{'all':!![]}];}return db[_0x7616('0x26')][_0x7616('0x39')](_0x5c2de0);})[_0x7616('0x21')](function(_0x398cfa){_0x30501b[_0x7616('0x3a')]=_0x398cfa;return _0x30501b;})[_0x7616('0x21')](respondWithFilteredResult(_0x476f44,_0x5c2de0))[_0x7616('0x3b')](handleError(_0x476f44,null));};exports[_0x7616('0x3c')]=function(_0x5cf314,_0xda16b0){var _0x3bc7ac={'raw':![],'where':{'id':_0x5cf314[_0x7616('0x3d')]['id']}},_0x37f6bd={};_0x37f6bd['model']=_['keys'](db[_0x7616('0x26')]['rawAttributes']);_0x37f6bd['query']=_[_0x7616('0x2d')](_0x5cf314[_0x7616('0x2c')]);_0x37f6bd['filters']=_['intersection'](_0x37f6bd[_0x7616('0x2b')],_0x37f6bd[_0x7616('0x2c')]);_0x3bc7ac[_0x7616('0x2f')]=_[_0x7616('0x30')](_0x37f6bd[_0x7616('0x2b')],qs[_0x7616('0x31')](_0x5cf314[_0x7616('0x2c')]['fields']));_0x3bc7ac['attributes']=_0x3bc7ac['attributes'][_0x7616('0x32')]?_0x3bc7ac[_0x7616('0x2f')]:_0x37f6bd['model'];if(_0x5cf314[_0x7616('0x2c')][_0x7616('0x3e')]){_0x3bc7ac[_0x7616('0x3f')]=[{'all':!![]}];}_0x3bc7ac=_[_0x7616('0x40')]({},_0x3bc7ac,_0x5cf314[_0x7616('0x38')]);return db[_0x7616('0x26')]['find'](_0x3bc7ac)['then'](handleEntityNotFound(_0xda16b0,null))[_0x7616('0x21')](respondWithResult(_0xda16b0,null))[_0x7616('0x3b')](handleError(_0xda16b0,null));};exports[_0x7616('0x41')]=function(_0xb00c71,_0x3e39b2){return db['SalesforceAccount']['create'](_0xb00c71[_0x7616('0x42')],{})[_0x7616('0x21')](respondWithResult(_0x3e39b2,0xc9))['catch'](handleError(_0x3e39b2,null));};exports[_0x7616('0x1f')]=function(_0x2aaae6,_0x34968a){if(_0x2aaae6[_0x7616('0x42')]['id']){delete _0x2aaae6[_0x7616('0x42')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x2aaae6[_0x7616('0x3d')]['id']}})[_0x7616('0x21')](handleEntityNotFound(_0x34968a,null))['then'](saveUpdates(_0x2aaae6[_0x7616('0x42')],null))[_0x7616('0x21')](respondWithResult(_0x34968a,null))[_0x7616('0x3b')](handleError(_0x34968a,null));};exports[_0x7616('0x20')]=function(_0x2393ea,_0x572988){return db[_0x7616('0x26')]['find']({'where':{'id':_0x2393ea[_0x7616('0x3d')]['id']}})[_0x7616('0x21')](handleEntityNotFound(_0x572988,null))[_0x7616('0x21')](removeEntity(_0x572988,null))['catch'](handleError(_0x572988,null));};exports[_0x7616('0x43')]=function(_0x1a59ff,_0x272e93,_0x4f54b8){var _0x2ea34b={};var _0x4d06e3={};var _0x36ae1d;var _0x2811c4;return db[_0x7616('0x26')][_0x7616('0x44')]({'where':{'id':_0x1a59ff['params']['id']}})['then'](handleEntityNotFound(_0x272e93,null))[_0x7616('0x21')](function(_0x4ce3ad){if(_0x4ce3ad){_0x36ae1d=_0x4ce3ad;_0x4d06e3[_0x7616('0x2b')]=_[_0x7616('0x2d')](db[_0x7616('0x45')][_0x7616('0x27')]);_0x4d06e3[_0x7616('0x2c')]=_[_0x7616('0x2d')](_0x1a59ff[_0x7616('0x2c')]);_0x4d06e3[_0x7616('0x2e')]=_[_0x7616('0x30')](_0x4d06e3[_0x7616('0x2b')],_0x4d06e3[_0x7616('0x2c')]);_0x2ea34b[_0x7616('0x2f')]=_[_0x7616('0x30')](_0x4d06e3[_0x7616('0x2b')],qs[_0x7616('0x31')](_0x1a59ff[_0x7616('0x2c')][_0x7616('0x31')]));_0x2ea34b[_0x7616('0x2f')]=_0x2ea34b[_0x7616('0x2f')][_0x7616('0x32')]?_0x2ea34b[_0x7616('0x2f')]:_0x4d06e3[_0x7616('0x2b')];_0x2ea34b['order']=qs[_0x7616('0x34')](_0x1a59ff['query']['sort']);_0x2ea34b['where']=qs[_0x7616('0x2e')](_[_0x7616('0x46')](_0x1a59ff[_0x7616('0x2c')],_0x4d06e3[_0x7616('0x2e')]));if(_0x1a59ff[_0x7616('0x2c')]['filter']){_0x2ea34b[_0x7616('0x35')]=_[_0x7616('0x40')](_0x2ea34b[_0x7616('0x35')],{'$or':_['map'](_0x2ea34b[_0x7616('0x2f')],function(_0x723287){var _0x51d11d={};_0x51d11d[_0x723287]={'$like':'%'+_0x1a59ff[_0x7616('0x2c')]['filter']+'%'};return _0x51d11d;})});}_0x2ea34b=_[_0x7616('0x40')]({},_0x2ea34b,_0x1a59ff[_0x7616('0x38')]);return _0x36ae1d[_0x7616('0x43')](_0x2ea34b);}})['then'](function(_0x192a5f){if(_0x192a5f){_0x2811c4=_0x192a5f['length'];if(!_0x1a59ff[_0x7616('0x2c')][_0x7616('0x47')]('nolimit')){_0x2ea34b[_0x7616('0x19')]=qs[_0x7616('0x19')](_0x1a59ff[_0x7616('0x2c')][_0x7616('0x19')]);_0x2ea34b[_0x7616('0x17')]=qs[_0x7616('0x17')](_0x1a59ff[_0x7616('0x2c')][_0x7616('0x17')]);}return _0x36ae1d['getConfigurations'](_0x2ea34b);}})[_0x7616('0x21')](function(_0xcbb70f){if(_0xcbb70f){return _0xcbb70f?{'count':_0x2811c4,'rows':_0xcbb70f}:null;}})[_0x7616('0x21')](respondWithResult(_0x272e93,null))[_0x7616('0x3b')](handleError(_0x272e93,null));};exports[_0x7616('0x48')]=function(_0x35f8a0,_0x40755e,_0x26c540){if(_0x35f8a0[_0x7616('0x42')]['id']){delete _0x35f8a0[_0x7616('0x42')]['id'];}return db[_0x7616('0x26')][_0x7616('0x44')]({'where':{'id':_0x35f8a0[_0x7616('0x3d')]['id']}})[_0x7616('0x21')](handleEntityNotFound(_0x40755e,null))['then'](function(_0x50f9be){if(_0x50f9be){_0x35f8a0['body']['AccountId']=_0x50f9be['id'];_0x35f8a0[_0x7616('0x42')][_0x7616('0x49')]=integrations[_0x7616('0x4a')](_0x35f8a0[_0x7616('0x42')][_0x7616('0x4b')],_0x35f8a0[_0x7616('0x42')][_0x7616('0x29')]);_0x35f8a0[_0x7616('0x42')][_0x7616('0x4c')]=integrations[_0x7616('0x4d')](_0x35f8a0[_0x7616('0x42')][_0x7616('0x4b')],_0x35f8a0['body']['type']);return db['SalesforceConfiguration'][_0x7616('0x41')](_0x35f8a0[_0x7616('0x42')],{'include':[{'model':db[_0x7616('0x4e')],'as':_0x7616('0x49')},{'model':db['SalesforceField'],'as':_0x7616('0x4c')}]});}return null;})['then'](respondWithResult(_0x40755e,null))[_0x7616('0x3b')](handleError(_0x40755e,null));};exports['getFields']=function(_0x223312,_0x58a112,_0x315d9f){var _0x3731d3;var _0x5f31e9='';var _0x2591ad=_0x7616('0x4f');return db['SalesforceAccount'][_0x7616('0x44')]({'where':{'id':_0x223312[_0x7616('0x3d')]['id']},'attributes':['id',_0x7616('0x50'),_0x7616('0x51'),'clientSecret',_0x7616('0x52'),'password',_0x7616('0x53')]})[_0x7616('0x21')](handleEntityNotFound(_0x58a112,null))[_0x7616('0x21')](function(_0x1ebc3a){if(_0x1ebc3a){_0x5f31e9=_0x1ebc3a[_0x7616('0x50')];var _0x7b09e=_0x5f31e9[_0x7616('0x54')](-0x1);if(_0x7b09e==='/'){_0x5f31e9=_0x5f31e9['substring'](0x0,_0x5f31e9[_0x7616('0x55')](_0x7b09e));}_0x3731d3=new jsforce[(_0x7616('0x56'))]({'oauth2':{'loginUrl':_0x5f31e9,'clientId':_0x1ebc3a[_0x7616('0x51')],'clientSecret':_0x1ebc3a[_0x7616('0x57')]}});return _0x3731d3[_0x7616('0x58')](_0x1ebc3a[_0x7616('0x52')],_0x1ebc3a[_0x7616('0x59')][_0x7616('0x5a')](_0x1ebc3a['securityToken']));}})['then'](function(_0x422a62){if(_0x422a62){if(!_[_0x7616('0x5b')](_0x223312[_0x7616('0x2c')][_0x7616('0x5c')])){_0x2591ad=_0x223312['query']['ticketType'];}return _0x3731d3[_0x7616('0x5d')](_0x2591ad)['describe']();}})['then'](function(_0x514d4b){var _0x208f43=['OwnerId',_0x7616('0x5e'),_0x7616('0x5f'),_0x7616('0x60'),_0x7616('0x61'),_0x7616('0x62')];var _0x4a0140=[_0x7616('0x63'),_0x7616('0x64'),_0x7616('0x65'),_0x7616('0x66'),_0x7616('0x67'),_0x7616('0x68'),_0x7616('0x69')];if(_0x514d4b){_[_0x7616('0x6a')](_0x514d4b[_0x7616('0x31')],function(_0x29de68){return _0x208f43[_0x7616('0x6b')](_0x29de68['name'])||!_0x4a0140[_0x7616('0x6b')](_0x29de68[_0x7616('0x29')]);});return{'count':_0x514d4b[_0x7616('0x31')][_0x7616('0x32')],'rows':_[_0x7616('0x25')](_0x514d4b['fields'],function(_0x967ab9){return{'id':_0x967ab9[_0x7616('0x23')],'name':_0x967ab9['label'],'custom':_0x967ab9[_0x7616('0x6c')],'options':_0x967ab9[_0x7616('0x6d')][_0x7616('0x32')]>0x0?_[_0x7616('0x25')](_0x967ab9['picklistValues'],function(_0x11d2fb){return{'name':_0x11d2fb[_0x7616('0x6e')],'value':_0x11d2fb[_0x7616('0x6f')]};}):_0x967ab9[_0x7616('0x29')]==_0x7616('0x66')?[{'name':_0x7616('0x70'),'value':'true'},{'name':_0x7616('0x71'),'value':_0x7616('0x72')}]:[]};})};}})[_0x7616('0x21')](respondWithResult(_0x58a112,null))[_0x7616('0x3b')](function(_0xcc3782){var _0x4fe015=_0x223312[_0x7616('0x2c')][_0x7616('0x73')]?0x1f4:_0xcc3782[_0x7616('0x74')]||0x1f4;logger['error'](_0x7616('0x75'),_0x7616('0x76'),_0x4fe015,JSON[_0x7616('0x77')](_0xcc3782));delete _0xcc3782[_0x7616('0x23')];if(_0x4fe015===0x191){_0x4fe015=0x190;}_0x58a112['status'](_0x4fe015)[_0x7616('0x24')](_0x223312[_0x7616('0x2c')][_0x7616('0x73')]?{'message':_0x7616('0x78'),'statusCode':_0xcc3782[_0x7616('0x74')]}:_0xcc3782);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6eaafa7..b96046b 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 _0xb0de=['exports','SalesforceAccount','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xb0de,0xec));var _0xeb0d=function(_0x1fdf9a,_0x417b48){_0x1fdf9a=_0x1fdf9a-0x0;var _0x442f8f=_0xb0de[_0x1fdf9a];return _0x442f8f;};'use strict';var _=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var logger=require(_0xeb0d('0x2'))(_0xeb0d('0x3'));var moment=require(_0xeb0d('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb0d('0x5'));var fs=require('fs');var path=require(_0xeb0d('0x6'));var rimraf=require(_0xeb0d('0x7'));var config=require(_0xeb0d('0x8'));var attributes=require(_0xeb0d('0x9'));var integrations=require(_0xeb0d('0xa'));module[_0xeb0d('0xb')]=function(_0x53c055,_0x3d5bb7){return _0x53c055['define'](_0xeb0d('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c18=['SalesforceAccount','int_salesforce_accounts','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x5df4d7,_0x1b05bf){var _0x5672c3=function(_0x49f8e1){while(--_0x49f8e1){_0x5df4d7['push'](_0x5df4d7['shift']());}};_0x5672c3(++_0x1b05bf);}(_0x4c18,0x18e));var _0x84c1=function(_0x4293a8,_0x385fc5){_0x4293a8=_0x4293a8-0x0;var _0x2ad40e=_0x4c18[_0x4293a8];return _0x2ad40e;};'use strict';var _=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var logger=require('../../config/logger')(_0x84c1('0x2'));var moment=require('moment');var BPromise=require(_0x84c1('0x3'));var rp=require(_0x84c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84c1('0x5'));var config=require(_0x84c1('0x6'));var attributes=require(_0x84c1('0x7'));var integrations=require(_0x84c1('0x8'));module['exports']=function(_0x597cdb,_0x1b174e){return _0x597cdb['define'](_0x84c1('0x9'),attributes,{'tableName':_0x84c1('0xa'),'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 993092b..e2b508a 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 _0xed83=['SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetSalesforceAccount'];(function(_0x4cddfe,_0x55362c){var _0x544786=function(_0x203695){while(--_0x203695){_0x4cddfe['push'](_0x4cddfe['shift']());}};_0x544786(++_0x55362c);}(_0xed83,0x160));var _0x3ed8=function(_0x1e31fa,_0x2dea6b){_0x1e31fa=_0x1e31fa-0x0;var _0x1b9c65=_0xed83[_0x1e31fa];return _0x1b9c65;};'use strict';var _=require('lodash');var util=require(_0x3ed8('0x0'));var moment=require(_0x3ed8('0x1'));var BPromise=require(_0x3ed8('0x2'));var rs=require(_0x3ed8('0x3'));var fs=require('fs');var Redis=require(_0x3ed8('0x4'));var db=require(_0x3ed8('0x5'))['db'];var utils=require(_0x3ed8('0x6'));var logger=require(_0x3ed8('0x7'))(_0x3ed8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ed8('0x9')][_0x3ed8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4edef1,_0xbb7d25,_0xf91a57){return new BPromise(function(_0x40f21c,_0x3b87d9){return client['request'](_0x4edef1,_0xf91a57)['then'](function(_0x3939a9){logger['info'](_0x3ed8('0xb'),_0xbb7d25,'request\x20sent');logger[_0x3ed8('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0xbb7d25,_0x3ed8('0xd'),JSON[_0x3ed8('0xe')](_0x3939a9));if(_0x3939a9[_0x3ed8('0xf')]){if(_0x3939a9['error'][_0x3ed8('0x10')]===0x1f4){logger[_0x3ed8('0xf')](_0x3ed8('0xb'),_0xbb7d25,_0x3939a9[_0x3ed8('0xf')]['message']);return _0x3b87d9(_0x3939a9[_0x3ed8('0xf')]['message']);}logger[_0x3ed8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0xbb7d25,_0x3939a9['error'][_0x3ed8('0x11')]);return _0x40f21c(_0x3939a9[_0x3ed8('0xf')][_0x3ed8('0x11')]);}else{logger[_0x3ed8('0x12')](_0x3ed8('0xb'),_0xbb7d25,_0x3ed8('0xd'));_0x40f21c(_0x3939a9[_0x3ed8('0x13')][_0x3ed8('0x11')]);}})[_0x3ed8('0x14')](function(_0x4c6608){logger[_0x3ed8('0xf')](_0x3ed8('0xb'),_0xbb7d25,_0x4c6608);_0x3b87d9(_0x4c6608);});});}exports[_0x3ed8('0x15')]=function(_0x281b2f){var _0x3474ef=this;return new Promise(function(_0x42556f,_0x1e78ab){return db[_0x3ed8('0x16')][_0x3ed8('0x17')]({'raw':_0x281b2f['options']?_0x281b2f[_0x3ed8('0x18')][_0x3ed8('0x19')]===undefined?!![]:![]:!![],'where':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1a')]||null:null,'attributes':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1b')]||null:null,'limit':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f[_0x3ed8('0x18')][_0x3ed8('0x1c')]||null:null,'include':_0x281b2f[_0x3ed8('0x18')]?_0x281b2f['options'][_0x3ed8('0x1d')]?_[_0x3ed8('0x1e')](_0x281b2f[_0x3ed8('0x18')]['include'],function(_0x4f7bbd){return{'model':db[_0x4f7bbd[_0x3ed8('0x1f')]],'as':_0x4f7bbd['as'],'attributes':_0x4f7bbd[_0x3ed8('0x1b')],'include':_0x4f7bbd['include']?_[_0x3ed8('0x1e')](_0x4f7bbd['include'],function(_0x8f1aaa){return{'model':db[_0x8f1aaa[_0x3ed8('0x1f')]],'as':_0x8f1aaa['as'],'attributes':_0x8f1aaa['attributes'],'include':_0x8f1aaa['include']?_[_0x3ed8('0x1e')](_0x8f1aaa['include'],function(_0x22e306){return{'model':db[_0x22e306[_0x3ed8('0x1f')]],'as':_0x22e306['as'],'attributes':_0x22e306[_0x3ed8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed8('0x20')](function(_0x2b0a6f){logger[_0x3ed8('0x12')]('GetSalesforceAccount',_0x281b2f);logger[_0x3ed8('0xc')](_0x3ed8('0x15'),_0x281b2f,JSON[_0x3ed8('0xe')](_0x2b0a6f));_0x42556f(_0x2b0a6f);})[_0x3ed8('0x14')](function(_0x56bb68){logger[_0x3ed8('0xf')]('GetSalesforceAccount',_0x56bb68['message'],_0x281b2f);_0x1e78ab(_0x3474ef[_0x3ed8('0xf')](0x1f4,_0x56bb68[_0x3ed8('0x11')]));});});};exports[_0x3ed8('0x21')]=function(_0x1e1a26){var _0x27f6f2=this;return new Promise(function(_0x3ce8b5,_0x27a80b){return db[_0x3ed8('0x16')]['find']({'raw':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x19')]===undefined?!![]:![]:!![],'where':_0x1e1a26[_0x3ed8('0x18')]?_0x1e1a26['options'][_0x3ed8('0x1a')]||null:null,'attributes':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x1b')]||null:null,'include':_0x1e1a26['options']?_0x1e1a26[_0x3ed8('0x18')]['include']?_[_0x3ed8('0x1e')](_0x1e1a26[_0x3ed8('0x18')][_0x3ed8('0x1d')],function(_0x151843){return{'model':db[_0x151843[_0x3ed8('0x1f')]],'as':_0x151843['as'],'attributes':_0x151843['attributes'],'include':_0x151843['include']?_[_0x3ed8('0x1e')](_0x151843['include'],function(_0x488c53){return{'model':db[_0x488c53['model']],'as':_0x488c53['as'],'attributes':_0x488c53[_0x3ed8('0x1b')],'include':_0x488c53['include']?_['map'](_0x488c53['include'],function(_0x3b7bae){return{'model':db[_0x3b7bae[_0x3ed8('0x1f')]],'as':_0x3b7bae['as'],'attributes':_0x3b7bae[_0x3ed8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3ed8('0x20')](function(_0x4a89bf){logger['info'](_0x3ed8('0x21'),_0x1e1a26);logger[_0x3ed8('0xc')]('ShowSalesforceAccount',_0x1e1a26,JSON['stringify'](_0x4a89bf));_0x3ce8b5(_0x4a89bf);})[_0x3ed8('0x14')](function(_0x1982f9){logger[_0x3ed8('0xf')](_0x3ed8('0x21'),_0x1982f9[_0x3ed8('0x11')],_0x1e1a26);_0x27a80b(_0x27f6f2[_0x3ed8('0xf')](0x1f4,_0x1982f9[_0x3ed8('0x11')]));});});}; \ No newline at end of file +var _0xc26e=['rpc','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SalesforceAccount','findAll','options','raw','where','attributes','include','map','model','GetSalesforceAccount','ShowSalesforceAccount','find','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x218b73,_0x224d06){var _0xb3f8dc=function(_0x543721){while(--_0x543721){_0x218b73['push'](_0x218b73['shift']());}};_0xb3f8dc(++_0x224d06);}(_0xc26e,0x103));var _0xec26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec26('0x0'));var BPromise=require('bluebird');var rs=require(_0xec26('0x1'));var fs=require('fs');var Redis=require(_0xec26('0x2'));var db=require(_0xec26('0x3'))['db'];var utils=require(_0xec26('0x4'));var logger=require('../../config/logger')(_0xec26('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xec26('0x6')][_0xec26('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x380276,_0x5b97b4,_0x5733a6){return new BPromise(function(_0x29846c,_0x40e0f6){return client[_0xec26('0x8')](_0x380276,_0x5733a6)[_0xec26('0x9')](function(_0x254cc6){logger[_0xec26('0xa')](_0xec26('0xb'),_0x5b97b4,_0xec26('0xc'));logger[_0xec26('0xd')](_0xec26('0xe'),_0x5b97b4,'request\x20sent',JSON['stringify'](_0x254cc6));if(_0x254cc6[_0xec26('0xf')]){if(_0x254cc6['error'][_0xec26('0x10')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5b97b4,_0x254cc6['error'][_0xec26('0x11')]);return _0x40e0f6(_0x254cc6[_0xec26('0xf')][_0xec26('0x11')]);}logger[_0xec26('0xf')](_0xec26('0xb'),_0x5b97b4,_0x254cc6[_0xec26('0xf')][_0xec26('0x11')]);return _0x29846c(_0x254cc6['error'][_0xec26('0x11')]);}else{logger['info'](_0xec26('0xb'),_0x5b97b4,_0xec26('0xc'));_0x29846c(_0x254cc6[_0xec26('0x12')][_0xec26('0x11')]);}})[_0xec26('0x13')](function(_0x4b1c89){logger[_0xec26('0xf')](_0xec26('0xb'),_0x5b97b4,_0x4b1c89);_0x40e0f6(_0x4b1c89);});});}exports['GetSalesforceAccount']=function(_0x1c5fcc){var _0x2be1b2=this;return new Promise(function(_0x330d56,_0x1e7b64){return db[_0xec26('0x14')][_0xec26('0x15')]({'raw':_0x1c5fcc[_0xec26('0x16')]?_0x1c5fcc['options'][_0xec26('0x17')]===undefined?!![]:![]:!![],'where':_0x1c5fcc[_0xec26('0x16')]?_0x1c5fcc[_0xec26('0x16')][_0xec26('0x18')]||null:null,'attributes':_0x1c5fcc['options']?_0x1c5fcc[_0xec26('0x16')][_0xec26('0x19')]||null:null,'limit':_0x1c5fcc['options']?_0x1c5fcc[_0xec26('0x16')]['limit']||null:null,'include':_0x1c5fcc[_0xec26('0x16')]?_0x1c5fcc[_0xec26('0x16')][_0xec26('0x1a')]?_[_0xec26('0x1b')](_0x1c5fcc[_0xec26('0x16')]['include'],function(_0x4f88dc){return{'model':db[_0x4f88dc[_0xec26('0x1c')]],'as':_0x4f88dc['as'],'attributes':_0x4f88dc[_0xec26('0x19')],'include':_0x4f88dc[_0xec26('0x1a')]?_[_0xec26('0x1b')](_0x4f88dc[_0xec26('0x1a')],function(_0x41eedc){return{'model':db[_0x41eedc['model']],'as':_0x41eedc['as'],'attributes':_0x41eedc['attributes'],'include':_0x41eedc[_0xec26('0x1a')]?_[_0xec26('0x1b')](_0x41eedc[_0xec26('0x1a')],function(_0x5dd9bd){return{'model':db[_0x5dd9bd[_0xec26('0x1c')]],'as':_0x5dd9bd['as'],'attributes':_0x5dd9bd[_0xec26('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4711bb){logger[_0xec26('0xa')](_0xec26('0x1d'),_0x1c5fcc);logger[_0xec26('0xd')]('GetSalesforceAccount',_0x1c5fcc,JSON['stringify'](_0x4711bb));_0x330d56(_0x4711bb);})['catch'](function(_0x5c18a2){logger[_0xec26('0xf')](_0xec26('0x1d'),_0x5c18a2[_0xec26('0x11')],_0x1c5fcc);_0x1e7b64(_0x2be1b2[_0xec26('0xf')](0x1f4,_0x5c18a2[_0xec26('0x11')]));});});};exports[_0xec26('0x1e')]=function(_0x505fa9){var _0x37a614=this;return new Promise(function(_0x905884,_0xe599c9){return db['SalesforceAccount'][_0xec26('0x1f')]({'raw':_0x505fa9['options']?_0x505fa9[_0xec26('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x505fa9[_0xec26('0x16')]?_0x505fa9[_0xec26('0x16')]['where']||null:null,'attributes':_0x505fa9[_0xec26('0x16')]?_0x505fa9[_0xec26('0x16')][_0xec26('0x19')]||null:null,'include':_0x505fa9['options']?_0x505fa9[_0xec26('0x16')][_0xec26('0x1a')]?_[_0xec26('0x1b')](_0x505fa9['options'][_0xec26('0x1a')],function(_0xd2268e){return{'model':db[_0xd2268e[_0xec26('0x1c')]],'as':_0xd2268e['as'],'attributes':_0xd2268e[_0xec26('0x19')],'include':_0xd2268e[_0xec26('0x1a')]?_[_0xec26('0x1b')](_0xd2268e['include'],function(_0x4f8cac){return{'model':db[_0x4f8cac['model']],'as':_0x4f8cac['as'],'attributes':_0x4f8cac[_0xec26('0x19')],'include':_0x4f8cac[_0xec26('0x1a')]?_[_0xec26('0x1b')](_0x4f8cac[_0xec26('0x1a')],function(_0x16f8ea){return{'model':db[_0x16f8ea['model']],'as':_0x16f8ea['as'],'attributes':_0x16f8ea[_0xec26('0x19')]};}):[]};}):[]};}):[]:[]})[_0xec26('0x9')](function(_0x553edd){logger[_0xec26('0xa')]('ShowSalesforceAccount',_0x505fa9);logger[_0xec26('0xd')](_0xec26('0x1e'),_0x505fa9,JSON[_0xec26('0x20')](_0x553edd));_0x905884(_0x553edd);})[_0xec26('0x13')](function(_0x38cf48){logger['error'](_0xec26('0x1e'),_0x38cf48[_0xec26('0x11')],_0x505fa9);_0xe599c9(_0x37a614[_0xec26('0xf')](0x1f4,_0x38cf48[_0xec26('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5f100d5..3e1f55c 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(_0x1f2d1e,_0x277fee){var _0x510f3d=function(_0x346c5c){while(--_0x346c5c){_0x1f2d1e['push'](_0x1f2d1e['shift']());}};_0x510f3d(++_0x277fee);}(_0x2ef3,0xba));var _0x32ef=function(_0x18e65c,_0x2ac0a5){_0x18e65c=_0x18e65c-0x0;var _0x1adaa1=_0x2ef3[_0x18e65c];return _0x1adaa1;};'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 _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(_0x2515e8,_0xb4c2c){var _0x4ada9a=function(_0x3852b1){while(--_0x3852b1){_0x2515e8['push'](_0x2515e8['shift']());}};_0x4ada9a(++_0xb4c2c);}(_0x2ef3,0xba));var _0x32ef=function(_0x454d23,_0x22695a){_0x454d23=_0x454d23-0x0;var _0x5f094e=_0x2ef3[_0x454d23];return _0x5f094e;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d656b93..4fb3816 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 _0x7be0=['account','contact_lead','contact','lead','sequelize','STRING','ENUM','Task','account_contact_lead'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7be0,0x8b));var _0x07be=function(_0x12d718,_0x5176e5){_0x12d718=_0x12d718-0x0;var _0x21d8cb=_0x7be0[_0x12d718];return _0x21d8cb;};'use strict';var Sequelize=require(_0x07be('0x0'));module['exports']={'name':{'type':Sequelize[_0x07be('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x07be('0x2')](_0x07be('0x3'),'Case'),'defaultValue':_0x07be('0x3')},'moduleSearch':{'type':Sequelize[_0x07be('0x2')]('contact_lead','contact','lead',_0x07be('0x4'),_0x07be('0x5')),'defaultValue':_0x07be('0x6')},'moduleCreate':{'type':Sequelize[_0x07be('0x2')]('nothing',_0x07be('0x7'),_0x07be('0x8'),_0x07be('0x5')),'defaultValue':_0x07be('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x07be('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x07be('0x1')]}}; \ No newline at end of file +var _0xcde4=['nothing','account','sequelize','exports','STRING','Case','Task','contact','lead','account_contact_lead','contact_lead','ENUM'];(function(_0x31ec99,_0x23a6d0){var _0x586649=function(_0x4205be){while(--_0x4205be){_0x31ec99['push'](_0x31ec99['shift']());}};_0x586649(++_0x23a6d0);}(_0xcde4,0x13a));var _0x4cde=function(_0x289891,_0x49a0fa){_0x289891=_0x289891-0x0;var _0x31cf2e=_0xcde4[_0x289891];return _0x31cf2e;};'use strict';var Sequelize=require(_0x4cde('0x0'));module[_0x4cde('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4cde('0x2')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x4cde('0x3')),'defaultValue':_0x4cde('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x4cde('0x5'),_0x4cde('0x6'),_0x4cde('0x7'),'account'),'defaultValue':_0x4cde('0x8')},'moduleCreate':{'type':Sequelize[_0x4cde('0x9')](_0x4cde('0xa'),_0x4cde('0x5'),_0x4cde('0x6'),_0x4cde('0xb')),'defaultValue':_0x4cde('0x6')},'leadId':{'type':Sequelize[_0x4cde('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4cde('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4cde('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x4cde('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 727ed11..294f519 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 _0xa220=['pick','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','body','getFields','SalesforceField'];(function(_0x1e9cd3,_0x14dbe1){var _0x4c4dfe=function(_0x463cd9){while(--_0x463cd9){_0x1e9cd3['push'](_0x1e9cd3['shift']());}};_0x4c4dfe(++_0x14dbe1);}(_0xa220,0x100));var _0x0a22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa220[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x0a22('0x0'));var rimraf=require(_0x0a22('0x1'));var zipdir=require(_0x0a22('0x2'));var jsonpatch=require(_0x0a22('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a22('0x4'));var Mustache=require(_0x0a22('0x5'));var util=require(_0x0a22('0x6'));var path=require(_0x0a22('0x7'));var sox=require(_0x0a22('0x8'));var csv=require('to-csv');var ejs=require(_0x0a22('0x9'));var fs=require('fs');var fs_extra=require(_0x0a22('0xa'));var _=require(_0x0a22('0xb'));var squel=require(_0x0a22('0xc'));var crypto=require(_0x0a22('0xd'));var jsforce=require(_0x0a22('0xe'));var deskjs=require(_0x0a22('0xf'));var toCsv=require(_0x0a22('0x10'));var querystring=require(_0x0a22('0x11'));var Papa=require(_0x0a22('0x12'));var Redis=require('ioredis');var authService=require(_0x0a22('0x13'));var qs=require(_0x0a22('0x14'));var as=require(_0x0a22('0x15'));var hardwareService=require(_0x0a22('0x16'));var logger=require(_0x0a22('0x17'))(_0x0a22('0x18'));var utils=require(_0x0a22('0x19'));var config=require(_0x0a22('0x1a'));var licenseUtil=require(_0x0a22('0x1b'));var db=require(_0x0a22('0x1c'))['db'];function respondWithStatusCode(_0xd96f4c,_0x4988a3){_0x4988a3=_0x4988a3||0xcc;return function(_0x577c22){if(_0x577c22){return _0xd96f4c[_0x0a22('0x1d')](_0x4988a3);}return _0xd96f4c[_0x0a22('0x1e')](_0x4988a3)[_0x0a22('0x1f')]();};}function respondWithResult(_0x18bc17,_0x363355){_0x363355=_0x363355||0xc8;return function(_0xc7e1ae){if(_0xc7e1ae){return _0x18bc17[_0x0a22('0x1e')](_0x363355)[_0x0a22('0x20')](_0xc7e1ae);}};}function respondWithFilteredResult(_0x4750bb,_0x17f501){return function(_0x38c40b){if(_0x38c40b){var _0x20b587=typeof _0x17f501[_0x0a22('0x21')]==='undefined'&&typeof _0x17f501[_0x0a22('0x22')]===_0x0a22('0x23');var _0x3f6139=_0x38c40b[_0x0a22('0x24')];var _0x32707b=_0x20b587?0x0:_0x17f501['offset'];var _0x15ddcc=_0x20b587?_0x38c40b[_0x0a22('0x24')]:_0x17f501[_0x0a22('0x21')]+_0x17f501[_0x0a22('0x22')];var _0x29bd8b;if(_0x15ddcc>=_0x3f6139){_0x15ddcc=_0x3f6139;_0x29bd8b=0xc8;}else{_0x29bd8b=0xce;}_0x4750bb[_0x0a22('0x1e')](_0x29bd8b);return _0x4750bb[_0x0a22('0x25')](_0x0a22('0x26'),_0x32707b+'-'+_0x15ddcc+'/'+_0x3f6139)[_0x0a22('0x20')](_0x38c40b);}return null;};}function patchUpdates(_0x1f27ca){return function(_0x22c05a){try{jsonpatch[_0x0a22('0x27')](_0x22c05a,_0x1f27ca,!![]);}catch(_0x8ab9a7){return BPromise[_0x0a22('0x28')](_0x8ab9a7);}return _0x22c05a['save']();};}function saveUpdates(_0x1fc60b,_0x1ad190){return function(_0x28d693){if(_0x28d693){return _0x28d693[_0x0a22('0x29')](_0x1fc60b)[_0x0a22('0x2a')](function(_0xf24df){return _0xf24df;});}return null;};}function removeEntity(_0x13acea,_0x584c99){return function(_0x2c9861){if(_0x2c9861){return _0x2c9861[_0x0a22('0x2b')]()[_0x0a22('0x2a')](function(){_0x13acea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b39a5,_0x33cfda){return function(_0x2c906a){if(!_0x2c906a){_0x1b39a5[_0x0a22('0x1d')](0x194);}return _0x2c906a;};}function handleError(_0x3de2b5,_0x1798ec){_0x1798ec=_0x1798ec||0x1f4;return function(_0x4e6209){logger[_0x0a22('0x2c')](_0x4e6209['stack']);if(_0x4e6209[_0x0a22('0x2d')]){delete _0x4e6209[_0x0a22('0x2d')];}_0x3de2b5['status'](_0x1798ec)[_0x0a22('0x2e')](_0x4e6209);};}exports[_0x0a22('0x2f')]=function(_0x3f71e8,_0x3ebd1e){var _0x4d74bf={},_0x477475={},_0x163853={'count':0x0,'rows':[]};var _0x4194bb=_[_0x0a22('0x30')](db[_0x0a22('0x31')]['rawAttributes'],function(_0xf3435b){return{'name':_0xf3435b['fieldName'],'type':_0xf3435b[_0x0a22('0x32')][_0x0a22('0x33')]};});_0x477475[_0x0a22('0x34')]=_[_0x0a22('0x30')](_0x4194bb,_0x0a22('0x2d'));_0x477475[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x3f71e8['query']);_0x477475[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x477475[_0x0a22('0x34')],_0x477475[_0x0a22('0x35')]);_0x4d74bf[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x477475[_0x0a22('0x34')],qs[_0x0a22('0x3a')](_0x3f71e8[_0x0a22('0x35')]['fields']));_0x4d74bf['attributes']=_0x4d74bf[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x4d74bf[_0x0a22('0x39')]:_0x477475[_0x0a22('0x34')];if(!_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x3c')](_0x0a22('0x3d'))){_0x4d74bf[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x3f71e8[_0x0a22('0x35')]['limit']);_0x4d74bf[_0x0a22('0x21')]=qs[_0x0a22('0x21')](_0x3f71e8['query'][_0x0a22('0x21')]);}_0x4d74bf[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x3f71e8['query']['sort']);_0x4d74bf[_0x0a22('0x40')]=qs[_0x0a22('0x37')](_['pick'](_0x3f71e8['query'],_0x477475[_0x0a22('0x37')]),_0x4194bb);if(_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x41')]){_0x4d74bf[_0x0a22('0x40')]=_[_0x0a22('0x42')](_0x4d74bf[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x4194bb,function(_0xa51b1b){if(_0xa51b1b[_0x0a22('0x32')]!==_0x0a22('0x43')){var _0x3889a9={};_0x3889a9[_0xa51b1b['name']]={'$like':'%'+_0x3f71e8['query']['filter']+'%'};return _0x3889a9;}})});}_0x4d74bf=_['merge']({},_0x4d74bf,_0x3f71e8[_0x0a22('0x44')]);var _0x26adc0={'where':_0x4d74bf[_0x0a22('0x40')]};return db['SalesforceConfiguration']['count'](_0x26adc0)['then'](function(_0x2213cd){_0x163853[_0x0a22('0x24')]=_0x2213cd;if(_0x3f71e8[_0x0a22('0x35')][_0x0a22('0x45')]){_0x4d74bf[_0x0a22('0x46')]=[{'all':!![]}];}return db[_0x0a22('0x31')][_0x0a22('0x47')](_0x4d74bf);})[_0x0a22('0x2a')](function(_0x32a6b2){_0x163853[_0x0a22('0x48')]=_0x32a6b2;return _0x163853;})[_0x0a22('0x2a')](respondWithFilteredResult(_0x3ebd1e,_0x4d74bf))[_0x0a22('0x49')](handleError(_0x3ebd1e,null));};exports['show']=function(_0x50d150,_0x18d33a){var _0x57f6c2={'raw':![],'where':{'id':_0x50d150[_0x0a22('0x4a')]['id']}},_0x28bfe7={};_0x28bfe7['model']=_[_0x0a22('0x36')](db['SalesforceConfiguration'][_0x0a22('0x4b')]);_0x28bfe7[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x50d150['query']);_0x28bfe7[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x28bfe7['model'],_0x28bfe7[_0x0a22('0x35')]);_0x57f6c2[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x28bfe7[_0x0a22('0x34')],qs[_0x0a22('0x3a')](_0x50d150[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x57f6c2[_0x0a22('0x39')]=_0x57f6c2[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x57f6c2[_0x0a22('0x39')]:_0x28bfe7[_0x0a22('0x34')];if(_0x50d150['query']['includeAll']){_0x57f6c2[_0x0a22('0x46')]=[{'all':!![]}];}_0x57f6c2=_[_0x0a22('0x42')]({},_0x57f6c2,_0x50d150[_0x0a22('0x44')]);return db[_0x0a22('0x31')][_0x0a22('0x4c')](_0x57f6c2)[_0x0a22('0x2a')](handleEntityNotFound(_0x18d33a,null))[_0x0a22('0x2a')](respondWithResult(_0x18d33a,null))[_0x0a22('0x49')](handleError(_0x18d33a,null));};exports['create']=function(_0x2bad49,_0x211195){return db[_0x0a22('0x31')]['create'](_0x2bad49[_0x0a22('0x4d')],{})[_0x0a22('0x2a')](respondWithResult(_0x211195,0xc9))[_0x0a22('0x49')](handleError(_0x211195,null));};exports[_0x0a22('0x29')]=function(_0x51d6a6,_0x118d7c){if(_0x51d6a6['body']['id']){delete _0x51d6a6['body']['id'];}return db[_0x0a22('0x31')]['find']({'where':{'id':_0x51d6a6['params']['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x118d7c,null))[_0x0a22('0x2a')](saveUpdates(_0x51d6a6['body'],null))[_0x0a22('0x2a')](respondWithResult(_0x118d7c,null))[_0x0a22('0x49')](handleError(_0x118d7c,null));};exports[_0x0a22('0x2b')]=function(_0x5b6703,_0x177360){return db['SalesforceConfiguration'][_0x0a22('0x4c')]({'where':{'id':_0x5b6703[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x177360,null))[_0x0a22('0x2a')](removeEntity(_0x177360,null))['catch'](handleError(_0x177360,null));};exports[_0x0a22('0x4e')]=function(_0x403004,_0x275651,_0x9bb741){var _0x23188b={};var _0x6e8ce9={};var _0xb74c50;var _0xf3a00c;return db[_0x0a22('0x31')]['findOne']({'where':{'id':_0x403004[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x275651,null))[_0x0a22('0x2a')](function(_0x3149a7){if(_0x3149a7){_0xb74c50=_0x3149a7;_0x6e8ce9[_0x0a22('0x34')]=_[_0x0a22('0x36')](db[_0x0a22('0x4f')][_0x0a22('0x4b')]);_0x6e8ce9[_0x0a22('0x35')]=_[_0x0a22('0x36')](_0x403004[_0x0a22('0x35')]);_0x6e8ce9['filters']=_[_0x0a22('0x38')](_0x6e8ce9[_0x0a22('0x34')],_0x6e8ce9[_0x0a22('0x35')]);_0x23188b[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x6e8ce9['model'],qs[_0x0a22('0x3a')](_0x403004[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x23188b[_0x0a22('0x39')]=_0x23188b[_0x0a22('0x39')]['length']?_0x23188b[_0x0a22('0x39')]:_0x6e8ce9[_0x0a22('0x34')];_0x23188b['order']=qs[_0x0a22('0x3f')](_0x403004['query'][_0x0a22('0x3f')]);_0x23188b[_0x0a22('0x40')]=qs['filters'](_[_0x0a22('0x50')](_0x403004[_0x0a22('0x35')],_0x6e8ce9[_0x0a22('0x37')]));if(_0x403004[_0x0a22('0x35')][_0x0a22('0x41')]){_0x23188b['where']=_['merge'](_0x23188b[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x23188b[_0x0a22('0x39')],function(_0x1e7343){var _0x15372b={};_0x15372b[_0x1e7343]={'$like':'%'+_0x403004['query'][_0x0a22('0x41')]+'%'};return _0x15372b;})});}_0x23188b=_['merge']({},_0x23188b,_0x403004[_0x0a22('0x44')]);return _0xb74c50[_0x0a22('0x4e')](_0x23188b);}})[_0x0a22('0x2a')](function(_0x117b41){if(_0x117b41){_0xf3a00c=_0x117b41[_0x0a22('0x3b')];if(!_0x403004[_0x0a22('0x35')]['hasOwnProperty']('nolimit')){_0x23188b[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x403004[_0x0a22('0x35')][_0x0a22('0x22')]);_0x23188b[_0x0a22('0x21')]=qs[_0x0a22('0x21')](_0x403004[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0xb74c50[_0x0a22('0x4e')](_0x23188b);}})[_0x0a22('0x2a')](function(_0xde594a){if(_0xde594a){return _0xde594a?{'count':_0xf3a00c,'rows':_0xde594a}:null;}})['then'](respondWithResult(_0x275651,null))[_0x0a22('0x49')](handleError(_0x275651,null));};exports['getSubjects']=function(_0x162731,_0x28e715,_0x538327){var _0x55b0b4={};var _0x194155={};var _0x5ce55e;var _0x297bdf;return db['SalesforceConfiguration'][_0x0a22('0x51')]({'where':{'id':_0x162731[_0x0a22('0x4a')]['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x28e715,null))['then'](function(_0x6cdde9){if(_0x6cdde9){_0x5ce55e=_0x6cdde9;_0x194155[_0x0a22('0x34')]=_[_0x0a22('0x36')](db['SalesforceField'][_0x0a22('0x4b')]);_0x194155['query']=_['keys'](_0x162731[_0x0a22('0x35')]);_0x194155[_0x0a22('0x37')]=_[_0x0a22('0x38')](_0x194155[_0x0a22('0x34')],_0x194155['query']);_0x55b0b4['attributes']=_[_0x0a22('0x38')](_0x194155['model'],qs['fields'](_0x162731[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x55b0b4['attributes']=_0x55b0b4[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x55b0b4['attributes']:_0x194155[_0x0a22('0x34')];_0x55b0b4[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x162731[_0x0a22('0x35')][_0x0a22('0x3f')]);_0x55b0b4['where']=qs['filters'](_[_0x0a22('0x50')](_0x162731[_0x0a22('0x35')],_0x194155['filters']));if(_0x162731[_0x0a22('0x35')][_0x0a22('0x41')]){_0x55b0b4[_0x0a22('0x40')]=_[_0x0a22('0x42')](_0x55b0b4[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x55b0b4[_0x0a22('0x39')],function(_0x185a69){var _0xf6cf6e={};_0xf6cf6e[_0x185a69]={'$like':'%'+_0x162731[_0x0a22('0x35')][_0x0a22('0x41')]+'%'};return _0xf6cf6e;})});}_0x55b0b4=_[_0x0a22('0x42')]({},_0x55b0b4,_0x162731['options']);return _0x5ce55e[_0x0a22('0x52')](_0x55b0b4);}})[_0x0a22('0x2a')](function(_0x19172f){if(_0x19172f){_0x297bdf=_0x19172f[_0x0a22('0x3b')];if(!_0x162731[_0x0a22('0x35')][_0x0a22('0x3c')]('nolimit')){_0x55b0b4[_0x0a22('0x22')]=qs[_0x0a22('0x22')](_0x162731[_0x0a22('0x35')][_0x0a22('0x22')]);_0x55b0b4['offset']=qs[_0x0a22('0x21')](_0x162731[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0x5ce55e['getSubjects'](_0x55b0b4);}})[_0x0a22('0x2a')](function(_0x4f7b67){if(_0x4f7b67){return _0x4f7b67?{'count':_0x297bdf,'rows':_0x4f7b67}:null;}})[_0x0a22('0x2a')](respondWithResult(_0x28e715,null))['catch'](handleError(_0x28e715,null));};exports['getDescriptions']=function(_0x2a5f24,_0x37c9f6,_0x40cb47){var _0x2a0d00={};var _0x571178={};var _0x250b96;var _0x520f89;return db[_0x0a22('0x31')][_0x0a22('0x51')]({'where':{'id':_0x2a5f24['params']['id']}})[_0x0a22('0x2a')](handleEntityNotFound(_0x37c9f6,null))['then'](function(_0x123b87){if(_0x123b87){_0x250b96=_0x123b87;_0x571178[_0x0a22('0x34')]=_[_0x0a22('0x36')](db['SalesforceField'][_0x0a22('0x4b')]);_0x571178[_0x0a22('0x35')]=_['keys'](_0x2a5f24[_0x0a22('0x35')]);_0x571178[_0x0a22('0x37')]=_['intersection'](_0x571178[_0x0a22('0x34')],_0x571178[_0x0a22('0x35')]);_0x2a0d00[_0x0a22('0x39')]=_[_0x0a22('0x38')](_0x571178[_0x0a22('0x34')],qs['fields'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3a')]));_0x2a0d00[_0x0a22('0x39')]=_0x2a0d00[_0x0a22('0x39')][_0x0a22('0x3b')]?_0x2a0d00[_0x0a22('0x39')]:_0x571178[_0x0a22('0x34')];_0x2a0d00[_0x0a22('0x3e')]=qs[_0x0a22('0x3f')](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3f')]);_0x2a0d00[_0x0a22('0x40')]=qs[_0x0a22('0x37')](_[_0x0a22('0x50')](_0x2a5f24[_0x0a22('0x35')],_0x571178[_0x0a22('0x37')]));if(_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x41')]){_0x2a0d00[_0x0a22('0x40')]=_['merge'](_0x2a0d00[_0x0a22('0x40')],{'$or':_[_0x0a22('0x30')](_0x2a0d00[_0x0a22('0x39')],function(_0x487d8f){var _0x237925={};_0x237925[_0x487d8f]={'$like':'%'+_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x41')]+'%'};return _0x237925;})});}_0x2a0d00=_[_0x0a22('0x42')]({},_0x2a0d00,_0x2a5f24[_0x0a22('0x44')]);return _0x250b96[_0x0a22('0x53')](_0x2a0d00);}})[_0x0a22('0x2a')](function(_0x377116){if(_0x377116){_0x520f89=_0x377116['length'];if(!_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x3c')](_0x0a22('0x3d'))){_0x2a0d00[_0x0a22('0x22')]=qs['limit'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x22')]);_0x2a0d00['offset']=qs['offset'](_0x2a5f24[_0x0a22('0x35')][_0x0a22('0x21')]);}return _0x250b96['getDescriptions'](_0x2a0d00);}})['then'](function(_0x16235e){if(_0x16235e){return _0x16235e?{'count':_0x520f89,'rows':_0x16235e}:null;}})[_0x0a22('0x2a')](respondWithResult(_0x37c9f6,null))[_0x0a22('0x49')](handleError(_0x37c9f6,null));}; \ No newline at end of file +var _0xf768=['create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','findAll','catch','params','keys','include','find'];(function(_0x12ef9a,_0x5dfbf7){var _0x3a6833=function(_0x38e1bd){while(--_0x38e1bd){_0x12ef9a['push'](_0x12ef9a['shift']());}};_0x3a6833(++_0x5dfbf7);}(_0xf768,0x1dc));var _0x8f76=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf768[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x8f76('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f76('0x1'));var jsonpatch=require(_0x8f76('0x2'));var rp=require('request-promise');var moment=require(_0x8f76('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f76('0x4'));var util=require('util');var path=require(_0x8f76('0x5'));var sox=require(_0x8f76('0x6'));var csv=require(_0x8f76('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f76('0x8'));var _=require(_0x8f76('0x9'));var squel=require(_0x8f76('0xa'));var crypto=require(_0x8f76('0xb'));var jsforce=require(_0x8f76('0xc'));var deskjs=require(_0x8f76('0xd'));var toCsv=require(_0x8f76('0x7'));var querystring=require(_0x8f76('0xe'));var Papa=require(_0x8f76('0xf'));var Redis=require(_0x8f76('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8f76('0x11'));var as=require(_0x8f76('0x12'));var hardwareService=require(_0x8f76('0x13'));var logger=require(_0x8f76('0x14'))('api');var utils=require(_0x8f76('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8f76('0x16'));var db=require(_0x8f76('0x17'))['db'];function respondWithStatusCode(_0x4cc5d0,_0x1fcb32){_0x1fcb32=_0x1fcb32||0xcc;return function(_0x3080d6){if(_0x3080d6){return _0x4cc5d0[_0x8f76('0x18')](_0x1fcb32);}return _0x4cc5d0[_0x8f76('0x19')](_0x1fcb32)[_0x8f76('0x1a')]();};}function respondWithResult(_0x32c84a,_0x21032d){_0x21032d=_0x21032d||0xc8;return function(_0x4b1756){if(_0x4b1756){return _0x32c84a[_0x8f76('0x19')](_0x21032d)[_0x8f76('0x1b')](_0x4b1756);}};}function respondWithFilteredResult(_0x40d399,_0x5538d6){return function(_0x30e0b2){if(_0x30e0b2){var _0x48f7a1=typeof _0x5538d6[_0x8f76('0x1c')]==='undefined'&&typeof _0x5538d6[_0x8f76('0x1d')]===_0x8f76('0x1e');var _0x1e0069=_0x30e0b2[_0x8f76('0x1f')];var _0x303d66=_0x48f7a1?0x0:_0x5538d6[_0x8f76('0x1c')];var _0x3300d0=_0x48f7a1?_0x30e0b2[_0x8f76('0x1f')]:_0x5538d6[_0x8f76('0x1c')]+_0x5538d6['limit'];var _0xcc48c9;if(_0x3300d0>=_0x1e0069){_0x3300d0=_0x1e0069;_0xcc48c9=0xc8;}else{_0xcc48c9=0xce;}_0x40d399['status'](_0xcc48c9);return _0x40d399['set']('Content-Range',_0x303d66+'-'+_0x3300d0+'/'+_0x1e0069)[_0x8f76('0x1b')](_0x30e0b2);}return null;};}function patchUpdates(_0xf6a8e1){return function(_0x18ba30){try{jsonpatch[_0x8f76('0x20')](_0x18ba30,_0xf6a8e1,!![]);}catch(_0x5d4e0a){return BPromise['reject'](_0x5d4e0a);}return _0x18ba30[_0x8f76('0x21')]();};}function saveUpdates(_0x197790,_0x3e7006){return function(_0x433018){if(_0x433018){return _0x433018[_0x8f76('0x22')](_0x197790)[_0x8f76('0x23')](function(_0x427e9d){return _0x427e9d;});}return null;};}function removeEntity(_0x3ce90a,_0x1b0213){return function(_0x12d856){if(_0x12d856){return _0x12d856[_0x8f76('0x24')]()['then'](function(){_0x3ce90a[_0x8f76('0x19')](0xcc)[_0x8f76('0x1a')]();});}};}function handleEntityNotFound(_0x5e4859,_0x4d6633){return function(_0x3181ad){if(!_0x3181ad){_0x5e4859['sendStatus'](0x194);}return _0x3181ad;};}function handleError(_0x4f0177,_0x90fa55){_0x90fa55=_0x90fa55||0x1f4;return function(_0x50c24f){logger[_0x8f76('0x25')](_0x50c24f[_0x8f76('0x26')]);if(_0x50c24f[_0x8f76('0x27')]){delete _0x50c24f[_0x8f76('0x27')];}_0x4f0177['status'](_0x90fa55)[_0x8f76('0x28')](_0x50c24f);};}exports[_0x8f76('0x29')]=function(_0xc522cf,_0x25d0f9){var _0x59a623={},_0x442410={},_0x5aeffc={'count':0x0,'rows':[]};var _0x4d165f=_['map'](db[_0x8f76('0x2a')][_0x8f76('0x2b')],function(_0x44f83c){return{'name':_0x44f83c[_0x8f76('0x2c')],'type':_0x44f83c[_0x8f76('0x2d')]['key']};});_0x442410[_0x8f76('0x2e')]=_[_0x8f76('0x2f')](_0x4d165f,_0x8f76('0x27'));_0x442410[_0x8f76('0x30')]=_['keys'](_0xc522cf['query']);_0x442410['filters']=_[_0x8f76('0x31')](_0x442410[_0x8f76('0x2e')],_0x442410[_0x8f76('0x30')]);_0x59a623[_0x8f76('0x32')]=_[_0x8f76('0x31')](_0x442410['model'],qs['fields'](_0xc522cf['query'][_0x8f76('0x33')]));_0x59a623[_0x8f76('0x32')]=_0x59a623[_0x8f76('0x32')][_0x8f76('0x34')]?_0x59a623[_0x8f76('0x32')]:_0x442410['model'];if(!_0xc522cf[_0x8f76('0x30')][_0x8f76('0x35')](_0x8f76('0x36'))){_0x59a623[_0x8f76('0x1d')]=qs[_0x8f76('0x1d')](_0xc522cf[_0x8f76('0x30')][_0x8f76('0x1d')]);_0x59a623[_0x8f76('0x1c')]=qs[_0x8f76('0x1c')](_0xc522cf[_0x8f76('0x30')][_0x8f76('0x1c')]);}_0x59a623['order']=qs[_0x8f76('0x37')](_0xc522cf[_0x8f76('0x30')][_0x8f76('0x37')]);_0x59a623[_0x8f76('0x38')]=qs[_0x8f76('0x39')](_[_0x8f76('0x3a')](_0xc522cf[_0x8f76('0x30')],_0x442410['filters']),_0x4d165f);if(_0xc522cf[_0x8f76('0x30')]['filter']){_0x59a623[_0x8f76('0x38')]=_['merge'](_0x59a623[_0x8f76('0x38')],{'$or':_[_0x8f76('0x2f')](_0x4d165f,function(_0x45ea57){if(_0x45ea57[_0x8f76('0x2d')]!==_0x8f76('0x3b')){var _0x301ef8={};_0x301ef8[_0x45ea57['name']]={'$like':'%'+_0xc522cf[_0x8f76('0x30')][_0x8f76('0x3c')]+'%'};return _0x301ef8;}})});}_0x59a623=_[_0x8f76('0x3d')]({},_0x59a623,_0xc522cf[_0x8f76('0x3e')]);var _0x168671={'where':_0x59a623[_0x8f76('0x38')]};return db['SalesforceConfiguration']['count'](_0x168671)[_0x8f76('0x23')](function(_0x3d5e78){_0x5aeffc['count']=_0x3d5e78;if(_0xc522cf[_0x8f76('0x30')][_0x8f76('0x3f')]){_0x59a623['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x8f76('0x40')](_0x59a623);})[_0x8f76('0x23')](function(_0x59f8bf){_0x5aeffc['rows']=_0x59f8bf;return _0x5aeffc;})[_0x8f76('0x23')](respondWithFilteredResult(_0x25d0f9,_0x59a623))[_0x8f76('0x41')](handleError(_0x25d0f9,null));};exports['show']=function(_0x2cf1f2,_0xa325fc){var _0x2b9267={'raw':![],'where':{'id':_0x2cf1f2[_0x8f76('0x42')]['id']}},_0x9c8be3={};_0x9c8be3['model']=_[_0x8f76('0x43')](db[_0x8f76('0x2a')][_0x8f76('0x2b')]);_0x9c8be3['query']=_['keys'](_0x2cf1f2[_0x8f76('0x30')]);_0x9c8be3[_0x8f76('0x39')]=_[_0x8f76('0x31')](_0x9c8be3[_0x8f76('0x2e')],_0x9c8be3[_0x8f76('0x30')]);_0x2b9267[_0x8f76('0x32')]=_['intersection'](_0x9c8be3[_0x8f76('0x2e')],qs[_0x8f76('0x33')](_0x2cf1f2[_0x8f76('0x30')][_0x8f76('0x33')]));_0x2b9267[_0x8f76('0x32')]=_0x2b9267['attributes'][_0x8f76('0x34')]?_0x2b9267[_0x8f76('0x32')]:_0x9c8be3['model'];if(_0x2cf1f2[_0x8f76('0x30')]['includeAll']){_0x2b9267[_0x8f76('0x44')]=[{'all':!![]}];}_0x2b9267=_[_0x8f76('0x3d')]({},_0x2b9267,_0x2cf1f2[_0x8f76('0x3e')]);return db[_0x8f76('0x2a')][_0x8f76('0x45')](_0x2b9267)[_0x8f76('0x23')](handleEntityNotFound(_0xa325fc,null))[_0x8f76('0x23')](respondWithResult(_0xa325fc,null))['catch'](handleError(_0xa325fc,null));};exports[_0x8f76('0x46')]=function(_0x4481fa,_0x5e5a98){return db[_0x8f76('0x2a')][_0x8f76('0x46')](_0x4481fa[_0x8f76('0x47')],{})[_0x8f76('0x23')](respondWithResult(_0x5e5a98,0xc9))[_0x8f76('0x41')](handleError(_0x5e5a98,null));};exports[_0x8f76('0x22')]=function(_0x3ba9fd,_0x82bc51){if(_0x3ba9fd['body']['id']){delete _0x3ba9fd[_0x8f76('0x47')]['id'];}return db[_0x8f76('0x2a')][_0x8f76('0x45')]({'where':{'id':_0x3ba9fd[_0x8f76('0x42')]['id']}})[_0x8f76('0x23')](handleEntityNotFound(_0x82bc51,null))[_0x8f76('0x23')](saveUpdates(_0x3ba9fd['body'],null))['then'](respondWithResult(_0x82bc51,null))[_0x8f76('0x41')](handleError(_0x82bc51,null));};exports[_0x8f76('0x24')]=function(_0x4abe,_0x151652){return db[_0x8f76('0x2a')]['find']({'where':{'id':_0x4abe[_0x8f76('0x42')]['id']}})[_0x8f76('0x23')](handleEntityNotFound(_0x151652,null))['then'](removeEntity(_0x151652,null))['catch'](handleError(_0x151652,null));};exports[_0x8f76('0x48')]=function(_0x11c5fe,_0x1501db,_0x19101a){var _0xbdbc8f={};var _0x372c99={};var _0x225efd;var _0x42bfab;return db['SalesforceConfiguration'][_0x8f76('0x49')]({'where':{'id':_0x11c5fe[_0x8f76('0x42')]['id']}})['then'](handleEntityNotFound(_0x1501db,null))[_0x8f76('0x23')](function(_0x45afd8){if(_0x45afd8){_0x225efd=_0x45afd8;_0x372c99[_0x8f76('0x2e')]=_[_0x8f76('0x43')](db[_0x8f76('0x4a')]['rawAttributes']);_0x372c99[_0x8f76('0x30')]=_[_0x8f76('0x43')](_0x11c5fe[_0x8f76('0x30')]);_0x372c99[_0x8f76('0x39')]=_['intersection'](_0x372c99[_0x8f76('0x2e')],_0x372c99[_0x8f76('0x30')]);_0xbdbc8f[_0x8f76('0x32')]=_[_0x8f76('0x31')](_0x372c99['model'],qs[_0x8f76('0x33')](_0x11c5fe[_0x8f76('0x30')][_0x8f76('0x33')]));_0xbdbc8f['attributes']=_0xbdbc8f[_0x8f76('0x32')][_0x8f76('0x34')]?_0xbdbc8f[_0x8f76('0x32')]:_0x372c99['model'];_0xbdbc8f[_0x8f76('0x4b')]=qs[_0x8f76('0x37')](_0x11c5fe[_0x8f76('0x30')]['sort']);_0xbdbc8f['where']=qs['filters'](_[_0x8f76('0x3a')](_0x11c5fe['query'],_0x372c99[_0x8f76('0x39')]));if(_0x11c5fe['query'][_0x8f76('0x3c')]){_0xbdbc8f['where']=_['merge'](_0xbdbc8f[_0x8f76('0x38')],{'$or':_['map'](_0xbdbc8f[_0x8f76('0x32')],function(_0x3fe315){var _0x23a814={};_0x23a814[_0x3fe315]={'$like':'%'+_0x11c5fe[_0x8f76('0x30')][_0x8f76('0x3c')]+'%'};return _0x23a814;})});}_0xbdbc8f=_[_0x8f76('0x3d')]({},_0xbdbc8f,_0x11c5fe[_0x8f76('0x3e')]);return _0x225efd[_0x8f76('0x48')](_0xbdbc8f);}})['then'](function(_0x3973e5){if(_0x3973e5){_0x42bfab=_0x3973e5[_0x8f76('0x34')];if(!_0x11c5fe[_0x8f76('0x30')][_0x8f76('0x35')](_0x8f76('0x36'))){_0xbdbc8f[_0x8f76('0x1d')]=qs[_0x8f76('0x1d')](_0x11c5fe[_0x8f76('0x30')][_0x8f76('0x1d')]);_0xbdbc8f[_0x8f76('0x1c')]=qs[_0x8f76('0x1c')](_0x11c5fe[_0x8f76('0x30')][_0x8f76('0x1c')]);}return _0x225efd[_0x8f76('0x48')](_0xbdbc8f);}})['then'](function(_0x212898){if(_0x212898){return _0x212898?{'count':_0x42bfab,'rows':_0x212898}:null;}})['then'](respondWithResult(_0x1501db,null))[_0x8f76('0x41')](handleError(_0x1501db,null));};exports[_0x8f76('0x4c')]=function(_0x22ebac,_0x27ee1d,_0x188f2c){var _0x3676d7={};var _0x465551={};var _0x514ddd;var _0x618e7c;return db[_0x8f76('0x2a')][_0x8f76('0x49')]({'where':{'id':_0x22ebac['params']['id']}})[_0x8f76('0x23')](handleEntityNotFound(_0x27ee1d,null))[_0x8f76('0x23')](function(_0x44f552){if(_0x44f552){_0x514ddd=_0x44f552;_0x465551[_0x8f76('0x2e')]=_[_0x8f76('0x43')](db['SalesforceField']['rawAttributes']);_0x465551[_0x8f76('0x30')]=_[_0x8f76('0x43')](_0x22ebac[_0x8f76('0x30')]);_0x465551[_0x8f76('0x39')]=_[_0x8f76('0x31')](_0x465551[_0x8f76('0x2e')],_0x465551[_0x8f76('0x30')]);_0x3676d7[_0x8f76('0x32')]=_[_0x8f76('0x31')](_0x465551[_0x8f76('0x2e')],qs[_0x8f76('0x33')](_0x22ebac[_0x8f76('0x30')][_0x8f76('0x33')]));_0x3676d7[_0x8f76('0x32')]=_0x3676d7[_0x8f76('0x32')]['length']?_0x3676d7[_0x8f76('0x32')]:_0x465551['model'];_0x3676d7[_0x8f76('0x4b')]=qs[_0x8f76('0x37')](_0x22ebac[_0x8f76('0x30')][_0x8f76('0x37')]);_0x3676d7[_0x8f76('0x38')]=qs[_0x8f76('0x39')](_['pick'](_0x22ebac[_0x8f76('0x30')],_0x465551['filters']));if(_0x22ebac[_0x8f76('0x30')][_0x8f76('0x3c')]){_0x3676d7[_0x8f76('0x38')]=_[_0x8f76('0x3d')](_0x3676d7[_0x8f76('0x38')],{'$or':_['map'](_0x3676d7[_0x8f76('0x32')],function(_0x6ef2c6){var _0x4e10f7={};_0x4e10f7[_0x6ef2c6]={'$like':'%'+_0x22ebac[_0x8f76('0x30')][_0x8f76('0x3c')]+'%'};return _0x4e10f7;})});}_0x3676d7=_[_0x8f76('0x3d')]({},_0x3676d7,_0x22ebac[_0x8f76('0x3e')]);return _0x514ddd[_0x8f76('0x4c')](_0x3676d7);}})['then'](function(_0x55f194){if(_0x55f194){_0x618e7c=_0x55f194[_0x8f76('0x34')];if(!_0x22ebac[_0x8f76('0x30')]['hasOwnProperty']('nolimit')){_0x3676d7[_0x8f76('0x1d')]=qs['limit'](_0x22ebac['query'][_0x8f76('0x1d')]);_0x3676d7['offset']=qs[_0x8f76('0x1c')](_0x22ebac[_0x8f76('0x30')][_0x8f76('0x1c')]);}return _0x514ddd[_0x8f76('0x4c')](_0x3676d7);}})[_0x8f76('0x23')](function(_0x430b18){if(_0x430b18){return _0x430b18?{'count':_0x618e7c,'rows':_0x430b18}:null;}})['then'](respondWithResult(_0x27ee1d,null))[_0x8f76('0x41')](handleError(_0x27ee1d,null));};exports[_0x8f76('0x4d')]=function(_0x235643,_0x3240af,_0x3cb620){var _0x2ba5c4={};var _0x45a7f4={};var _0x6073c6;var _0x9e361e;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x235643['params']['id']}})[_0x8f76('0x23')](handleEntityNotFound(_0x3240af,null))[_0x8f76('0x23')](function(_0x2a9897){if(_0x2a9897){_0x6073c6=_0x2a9897;_0x45a7f4[_0x8f76('0x2e')]=_[_0x8f76('0x43')](db[_0x8f76('0x4a')][_0x8f76('0x2b')]);_0x45a7f4['query']=_[_0x8f76('0x43')](_0x235643[_0x8f76('0x30')]);_0x45a7f4[_0x8f76('0x39')]=_['intersection'](_0x45a7f4[_0x8f76('0x2e')],_0x45a7f4['query']);_0x2ba5c4[_0x8f76('0x32')]=_[_0x8f76('0x31')](_0x45a7f4[_0x8f76('0x2e')],qs[_0x8f76('0x33')](_0x235643['query']['fields']));_0x2ba5c4[_0x8f76('0x32')]=_0x2ba5c4[_0x8f76('0x32')][_0x8f76('0x34')]?_0x2ba5c4[_0x8f76('0x32')]:_0x45a7f4[_0x8f76('0x2e')];_0x2ba5c4[_0x8f76('0x4b')]=qs[_0x8f76('0x37')](_0x235643[_0x8f76('0x30')][_0x8f76('0x37')]);_0x2ba5c4['where']=qs[_0x8f76('0x39')](_['pick'](_0x235643[_0x8f76('0x30')],_0x45a7f4[_0x8f76('0x39')]));if(_0x235643[_0x8f76('0x30')][_0x8f76('0x3c')]){_0x2ba5c4[_0x8f76('0x38')]=_['merge'](_0x2ba5c4[_0x8f76('0x38')],{'$or':_[_0x8f76('0x2f')](_0x2ba5c4[_0x8f76('0x32')],function(_0x59c3c2){var _0x570e3e={};_0x570e3e[_0x59c3c2]={'$like':'%'+_0x235643[_0x8f76('0x30')][_0x8f76('0x3c')]+'%'};return _0x570e3e;})});}_0x2ba5c4=_[_0x8f76('0x3d')]({},_0x2ba5c4,_0x235643['options']);return _0x6073c6['getDescriptions'](_0x2ba5c4);}})[_0x8f76('0x23')](function(_0x43991c){if(_0x43991c){_0x9e361e=_0x43991c[_0x8f76('0x34')];if(!_0x235643[_0x8f76('0x30')]['hasOwnProperty'](_0x8f76('0x36'))){_0x2ba5c4[_0x8f76('0x1d')]=qs['limit'](_0x235643['query'][_0x8f76('0x1d')]);_0x2ba5c4[_0x8f76('0x1c')]=qs[_0x8f76('0x1c')](_0x235643[_0x8f76('0x30')][_0x8f76('0x1c')]);}return _0x6073c6[_0x8f76('0x4d')](_0x2ba5c4);}})[_0x8f76('0x23')](function(_0x2b4b2c){if(_0x2b4b2c){return _0x2b4b2c?{'count':_0x9e361e,'rows':_0x2b4b2c}:null;}})[_0x8f76('0x23')](respondWithResult(_0x3240af,null))['catch'](handleError(_0x3240af,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 48abfcc..c62e9a3 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 _0xc137=['../../config/logger','moment','bluebird','request-promise','path','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','lodash','util'];(function(_0x5ce075,_0x20b649){var _0x595e7d=function(_0x4384dc){while(--_0x4384dc){_0x5ce075['push'](_0x5ce075['shift']());}};_0x595e7d(++_0x20b649);}(_0xc137,0x166));var _0x7c13=function(_0x5dcb0a,_0x1d4ba1){_0x5dcb0a=_0x5dcb0a-0x0;var _0x5a1e53=_0xc137[_0x5dcb0a];return _0x5a1e53;};'use strict';var _=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var logger=require(_0x7c13('0x2'))('api');var moment=require(_0x7c13('0x3'));var BPromise=require(_0x7c13('0x4'));var rp=require(_0x7c13('0x5'));var fs=require('fs');var path=require(_0x7c13('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c13('0x7'));module['exports']=function(_0x3380aa,_0x52505f){return _0x3380aa[_0x7c13('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0x7c13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d33=['SalesforceConfiguration','lodash','../../config/logger','api','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x49aa1e,_0x19c7f3){var _0x366524=function(_0x5914ca){while(--_0x5914ca){_0x49aa1e['push'](_0x49aa1e['shift']());}};_0x366524(++_0x19c7f3);}(_0x0d33,0x187));var _0x30d3=function(_0x306fd5,_0xc37859){_0x306fd5=_0x306fd5-0x0;var _0x663169=_0x0d33[_0x306fd5];return _0x663169;};'use strict';var _=require(_0x30d3('0x0'));var util=require('util');var logger=require(_0x30d3('0x1'))(_0x30d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30d3('0x3'));var fs=require('fs');var path=require(_0x30d3('0x4'));var rimraf=require('rimraf');var config=require(_0x30d3('0x5'));var attributes=require(_0x30d3('0x6'));module[_0x30d3('0x7')]=function(_0x2cf2d4,_0x26bef4){return _0x2cf2d4[_0x30d3('0x8')](_0x30d3('0x9'),attributes,{'tableName':'int_salesforce_configurations','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 33155e0..1d3a3bb 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 _0x447d=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info'];(function(_0x5ae227,_0x459b0c){var _0xa4a479=function(_0x3bf9d6){while(--_0x3bf9d6){_0x5ae227['push'](_0x5ae227['shift']());}};_0xa4a479(++_0x459b0c);}(_0x447d,0x96));var _0xd447=function(_0x29a73e,_0x2cb43e){_0x29a73e=_0x29a73e-0x0;var _0x14c50e=_0x447d[_0x29a73e];return _0x14c50e;};'use strict';var _=require(_0xd447('0x0'));var util=require(_0xd447('0x1'));var moment=require('moment');var BPromise=require(_0xd447('0x2'));var rs=require(_0xd447('0x3'));var fs=require('fs');var Redis=require(_0xd447('0x4'));var db=require(_0xd447('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd447('0x6'))(_0xd447('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd447('0x8')][_0xd447('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb69f70,_0x1b53ef,_0x4d1c7b){return new BPromise(function(_0x3502b7,_0x127a27){return client[_0xd447('0xa')](_0xb69f70,_0x4d1c7b)['then'](function(_0x2ad6fe){logger[_0xd447('0xb')](_0xd447('0xc'),_0x1b53ef,_0xd447('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1b53ef,'request\x20sent',JSON[_0xd447('0xe')](_0x2ad6fe));if(_0x2ad6fe['error']){if(_0x2ad6fe[_0xd447('0xf')]['code']===0x1f4){logger[_0xd447('0xf')](_0xd447('0xc'),_0x1b53ef,_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);return _0x127a27(_0x2ad6fe['error']['message']);}logger[_0xd447('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b53ef,_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);return _0x3502b7(_0x2ad6fe[_0xd447('0xf')][_0xd447('0x10')]);}else{logger[_0xd447('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1b53ef,_0xd447('0xd'));_0x3502b7(_0x2ad6fe[_0xd447('0x11')][_0xd447('0x10')]);}})['catch'](function(_0x1f87a7){logger[_0xd447('0xf')](_0xd447('0xc'),_0x1b53ef,_0x1f87a7);_0x127a27(_0x1f87a7);});});} \ No newline at end of file +var _0x8c55=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info'];(function(_0x1c2464,_0x4515ea){var _0x15001d=function(_0x396cef){while(--_0x396cef){_0x1c2464['push'](_0x1c2464['shift']());}};_0x15001d(++_0x4515ea);}(_0x8c55,0xb9));var _0x58c5=function(_0x5893d1,_0x1c10fd){_0x5893d1=_0x5893d1-0x0;var _0x478fe9=_0x8c55[_0x5893d1];return _0x478fe9;};'use strict';var _=require(_0x58c5('0x0'));var util=require(_0x58c5('0x1'));var moment=require(_0x58c5('0x2'));var BPromise=require(_0x58c5('0x3'));var rs=require(_0x58c5('0x4'));var fs=require('fs');var Redis=require(_0x58c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x58c5('0x6'));var logger=require(_0x58c5('0x7'))(_0x58c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x58c5('0x9'));var client=jayson['client'][_0x58c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x352639,_0x10e3f0,_0x4c12a1){return new BPromise(function(_0x4256a4,_0x276a49){return client[_0x58c5('0xb')](_0x352639,_0x4c12a1)[_0x58c5('0xc')](function(_0x1b84cf){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x10e3f0,_0x58c5('0xd'));logger[_0x58c5('0xe')](_0x58c5('0xf'),_0x10e3f0,'request\x20sent',JSON[_0x58c5('0x10')](_0x1b84cf));if(_0x1b84cf[_0x58c5('0x11')]){if(_0x1b84cf['error'][_0x58c5('0x12')]===0x1f4){logger[_0x58c5('0x11')](_0x58c5('0x13'),_0x10e3f0,_0x1b84cf[_0x58c5('0x11')][_0x58c5('0x14')]);return _0x276a49(_0x1b84cf[_0x58c5('0x11')][_0x58c5('0x14')]);}logger[_0x58c5('0x11')](_0x58c5('0x13'),_0x10e3f0,_0x1b84cf['error']['message']);return _0x4256a4(_0x1b84cf[_0x58c5('0x11')][_0x58c5('0x14')]);}else{logger[_0x58c5('0x15')]('SalesforceConfiguration,\x20%s,\x20%s',_0x10e3f0,'request\x20sent');_0x4256a4(_0x1b84cf['result'][_0x58c5('0x14')]);}})[_0x58c5('0x16')](function(_0x4d378e){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x10e3f0,_0x4d378e);_0x276a49(_0x4d378e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 62ee00a..9374fb1 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 _0xca42=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x464461,_0x2f7d85){var _0x5c595a=function(_0x2059a6){while(--_0x2059a6){_0x464461['push'](_0x464461['shift']());}};_0x5c595a(++_0x2f7d85);}(_0xca42,0xe8));var _0x2ca4=function(_0x23d179,_0x2b5be0){_0x23d179=_0x23d179-0x0;var _0x27124d=_0xca42[_0x23d179];return _0x27124d;};'use strict';var multer=require('multer');var util=require(_0x2ca4('0x0'));var path=require(_0x2ca4('0x1'));var timeout=require(_0x2ca4('0x2'));var express=require('express');var router=express[_0x2ca4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2ca4('0x4'));var interaction=require(_0x2ca4('0x5'));var config=require(_0x2ca4('0x6'));var controller=require(_0x2ca4('0x7'));router[_0x2ca4('0x8')]('/',auth[_0x2ca4('0x9')](),controller['index']);router[_0x2ca4('0x8')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0xb')]);router[_0x2ca4('0xc')]('/',auth['isAuthenticated'](),controller[_0x2ca4('0xd')]);router[_0x2ca4('0xe')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0xf')]);router[_0x2ca4('0x10')](_0x2ca4('0xa'),auth[_0x2ca4('0x9')](),controller[_0x2ca4('0x11')]);module[_0x2ca4('0x12')]=router; \ No newline at end of file +var _0xdc03=['isAuthenticated','/:id','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSalesforceField.controller','get'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0xdc03,0x186));var _0x3dc0=function(_0x1d393d,_0x3e3ed2){_0x1d393d=_0x1d393d-0x0;var _0x48e93c=_0xdc03[_0x1d393d];return _0x48e93c;};'use strict';var multer=require(_0x3dc0('0x0'));var util=require(_0x3dc0('0x1'));var path=require(_0x3dc0('0x2'));var timeout=require(_0x3dc0('0x3'));var express=require(_0x3dc0('0x4'));var router=express[_0x3dc0('0x5')]();var fs_extra=require(_0x3dc0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3dc0('0x7'));var config=require('../../config/environment');var controller=require(_0x3dc0('0x8'));router[_0x3dc0('0x9')]('/',auth[_0x3dc0('0xa')](),controller['index']);router[_0x3dc0('0x9')](_0x3dc0('0xb'),auth[_0x3dc0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3dc0('0xc')]);router[_0x3dc0('0xd')]('/:id',auth[_0x3dc0('0xa')](),controller['update']);router[_0x3dc0('0xe')](_0x3dc0('0xb'),auth[_0x3dc0('0xa')](),controller[_0x3dc0('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index a93adfa..087b30a 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 _0x720f=['string','variable','keyValue','picklist','STRING','customVariable','ENUM'];(function(_0x43b6db,_0x5eab00){var _0x4b845b=function(_0xf0e926){while(--_0xf0e926){_0x43b6db['push'](_0x43b6db['shift']());}};_0x4b845b(++_0x5eab00);}(_0x720f,0x179));var _0xf720=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x720f[_0x1b828b];return _0x98da1a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf720('0x0')](_0xf720('0x1'),_0xf720('0x2'),'customVariable',_0xf720('0x3'),_0xf720('0x4')),'defaultValue':_0xf720('0x1')},'content':{'type':Sequelize[_0xf720('0x5')]},'key':{'type':Sequelize[_0xf720('0x5')]},'keyType':{'type':Sequelize[_0xf720('0x0')]('string',_0xf720('0x2'),_0xf720('0x6'))},'keyContent':{'type':Sequelize[_0xf720('0x5')]},'idField':{'type':Sequelize[_0xf720('0x5')]},'variableName':{'type':Sequelize[_0xf720('0x5')]}}; \ No newline at end of file +var _0xfa59=['picklist','string','STRING','sequelize','ENUM','variable','customVariable'];(function(_0x3e94e2,_0x30790e){var _0x2a75d3=function(_0x58a633){while(--_0x58a633){_0x3e94e2['push'](_0x3e94e2['shift']());}};_0x2a75d3(++_0x30790e);}(_0xfa59,0x1e6));var _0x9fa5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfa59[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x9fa5('0x0'));module['exports']={'type':{'type':Sequelize[_0x9fa5('0x1')]('string',_0x9fa5('0x2'),_0x9fa5('0x3'),'keyValue',_0x9fa5('0x4')),'defaultValue':_0x9fa5('0x5')},'content':{'type':Sequelize[_0x9fa5('0x6')]},'key':{'type':Sequelize[_0x9fa5('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9fa5('0x5'),'variable',_0x9fa5('0x3'))},'keyContent':{'type':Sequelize[_0x9fa5('0x6')]},'idField':{'type':Sequelize[_0x9fa5('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 0c99ae0..8dd0e98 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 _0xc76a=['reject','then','destroy','error','stack','name','send','SalesforceField','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','rawAttributes','create','body','update','find','params','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xc76a,0x6e));var _0xac76=function(_0x307cdd,_0x51463a){_0x307cdd=_0x307cdd-0x0;var _0x4477dc=_0xc76a[_0x307cdd];return _0x4477dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac76('0x0'));var zipdir=require(_0xac76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac76('0x2'));var moment=require(_0xac76('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xac76('0x4'));var util=require(_0xac76('0x5'));var path=require(_0xac76('0x6'));var sox=require(_0xac76('0x7'));var csv=require('to-csv');var ejs=require(_0xac76('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac76('0x9'));var squel=require(_0xac76('0xa'));var crypto=require('crypto');var jsforce=require(_0xac76('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xac76('0xc'));var querystring=require(_0xac76('0xd'));var Papa=require(_0xac76('0xe'));var Redis=require('ioredis');var authService=require(_0xac76('0xf'));var qs=require(_0xac76('0x10'));var as=require(_0xac76('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac76('0x12'))(_0xac76('0x13'));var utils=require('../../config/utils');var config=require(_0xac76('0x14'));var licenseUtil=require(_0xac76('0x15'));var db=require(_0xac76('0x16'))['db'];function respondWithStatusCode(_0x511263,_0x31d107){_0x31d107=_0x31d107||0xcc;return function(_0xc774e3){if(_0xc774e3){return _0x511263[_0xac76('0x17')](_0x31d107);}return _0x511263['status'](_0x31d107)[_0xac76('0x18')]();};}function respondWithResult(_0x268a1f,_0x180042){_0x180042=_0x180042||0xc8;return function(_0x178079){if(_0x178079){return _0x268a1f[_0xac76('0x19')](_0x180042)[_0xac76('0x1a')](_0x178079);}};}function respondWithFilteredResult(_0x5b335e,_0x2b0a79){return function(_0x4bf4ac){if(_0x4bf4ac){var _0x385737=typeof _0x2b0a79[_0xac76('0x1b')]==='undefined'&&typeof _0x2b0a79[_0xac76('0x1c')]===_0xac76('0x1d');var _0x3431f2=_0x4bf4ac[_0xac76('0x1e')];var _0x4b9627=_0x385737?0x0:_0x2b0a79[_0xac76('0x1b')];var _0x258f5a=_0x385737?_0x4bf4ac[_0xac76('0x1e')]:_0x2b0a79[_0xac76('0x1b')]+_0x2b0a79['limit'];var _0x3d7456;if(_0x258f5a>=_0x3431f2){_0x258f5a=_0x3431f2;_0x3d7456=0xc8;}else{_0x3d7456=0xce;}_0x5b335e[_0xac76('0x19')](_0x3d7456);return _0x5b335e[_0xac76('0x1f')](_0xac76('0x20'),_0x4b9627+'-'+_0x258f5a+'/'+_0x3431f2)['json'](_0x4bf4ac);}return null;};}function patchUpdates(_0x5e1c66){return function(_0x588974){try{jsonpatch[_0xac76('0x21')](_0x588974,_0x5e1c66,!![]);}catch(_0x172ba7){return BPromise[_0xac76('0x22')](_0x172ba7);}return _0x588974['save']();};}function saveUpdates(_0x44a7a0,_0x2ec106){return function(_0xd6cf7d){if(_0xd6cf7d){return _0xd6cf7d['update'](_0x44a7a0)[_0xac76('0x23')](function(_0x4416cb){return _0x4416cb;});}return null;};}function removeEntity(_0x25ab19,_0x439054){return function(_0x5adf2b){if(_0x5adf2b){return _0x5adf2b[_0xac76('0x24')]()[_0xac76('0x23')](function(){_0x25ab19['status'](0xcc)[_0xac76('0x18')]();});}};}function handleEntityNotFound(_0x2781b8,_0x4d2099){return function(_0x2972bd){if(!_0x2972bd){_0x2781b8[_0xac76('0x17')](0x194);}return _0x2972bd;};}function handleError(_0x11b5c1,_0x2da0d2){_0x2da0d2=_0x2da0d2||0x1f4;return function(_0x521405){logger[_0xac76('0x25')](_0x521405[_0xac76('0x26')]);if(_0x521405[_0xac76('0x27')]){delete _0x521405[_0xac76('0x27')];}_0x11b5c1[_0xac76('0x19')](_0x2da0d2)[_0xac76('0x28')](_0x521405);};}exports['index']=function(_0x505b50,_0x5bb01e){var _0x304ce7={},_0x1dd4a2={},_0x44005b={'count':0x0,'rows':[]};var _0xb7c2f7=_['map'](db[_0xac76('0x29')]['rawAttributes'],function(_0x1ea127){return{'name':_0x1ea127[_0xac76('0x2a')],'type':_0x1ea127[_0xac76('0x2b')]['key']};});_0x1dd4a2['model']=_[_0xac76('0x2c')](_0xb7c2f7,_0xac76('0x27'));_0x1dd4a2[_0xac76('0x2d')]=_['keys'](_0x505b50['query']);_0x1dd4a2[_0xac76('0x2e')]=_[_0xac76('0x2f')](_0x1dd4a2[_0xac76('0x30')],_0x1dd4a2[_0xac76('0x2d')]);_0x304ce7['attributes']=_[_0xac76('0x2f')](_0x1dd4a2[_0xac76('0x30')],qs['fields'](_0x505b50[_0xac76('0x2d')][_0xac76('0x31')]));_0x304ce7[_0xac76('0x32')]=_0x304ce7[_0xac76('0x32')][_0xac76('0x33')]?_0x304ce7['attributes']:_0x1dd4a2[_0xac76('0x30')];if(!_0x505b50[_0xac76('0x2d')][_0xac76('0x34')](_0xac76('0x35'))){_0x304ce7['limit']=qs[_0xac76('0x1c')](_0x505b50[_0xac76('0x2d')][_0xac76('0x1c')]);_0x304ce7[_0xac76('0x1b')]=qs[_0xac76('0x1b')](_0x505b50[_0xac76('0x2d')][_0xac76('0x1b')]);}_0x304ce7[_0xac76('0x36')]=qs['sort'](_0x505b50[_0xac76('0x2d')]['sort']);_0x304ce7['where']=qs[_0xac76('0x2e')](_[_0xac76('0x37')](_0x505b50['query'],_0x1dd4a2['filters']),_0xb7c2f7);if(_0x505b50[_0xac76('0x2d')]['filter']){_0x304ce7[_0xac76('0x38')]=_[_0xac76('0x39')](_0x304ce7[_0xac76('0x38')],{'$or':_[_0xac76('0x2c')](_0xb7c2f7,function(_0x3be25f){if(_0x3be25f[_0xac76('0x2b')]!==_0xac76('0x3a')){var _0x5db31d={};_0x5db31d[_0x3be25f['name']]={'$like':'%'+_0x505b50[_0xac76('0x2d')][_0xac76('0x3b')]+'%'};return _0x5db31d;}})});}_0x304ce7=_[_0xac76('0x39')]({},_0x304ce7,_0x505b50[_0xac76('0x3c')]);var _0x494da8={'where':_0x304ce7[_0xac76('0x38')]};return db['SalesforceField'][_0xac76('0x1e')](_0x494da8)[_0xac76('0x23')](function(_0x52741e){_0x44005b[_0xac76('0x1e')]=_0x52741e;if(_0x505b50['query'][_0xac76('0x3d')]){_0x304ce7[_0xac76('0x3e')]=[{'all':!![]}];}return db[_0xac76('0x29')]['findAll'](_0x304ce7);})[_0xac76('0x23')](function(_0x4c8df1){_0x44005b['rows']=_0x4c8df1;return _0x44005b;})[_0xac76('0x23')](respondWithFilteredResult(_0x5bb01e,_0x304ce7))[_0xac76('0x3f')](handleError(_0x5bb01e,null));};exports[_0xac76('0x40')]=function(_0x28d3fb,_0x4f3f69){var _0x44c7f0={'raw':!![],'where':{'id':_0x28d3fb['params']['id']}},_0x3290bd={};_0x3290bd[_0xac76('0x30')]=_[_0xac76('0x41')](db['SalesforceField'][_0xac76('0x42')]);_0x3290bd[_0xac76('0x2d')]=_[_0xac76('0x41')](_0x28d3fb[_0xac76('0x2d')]);_0x3290bd[_0xac76('0x2e')]=_[_0xac76('0x2f')](_0x3290bd[_0xac76('0x30')],_0x3290bd[_0xac76('0x2d')]);_0x44c7f0[_0xac76('0x32')]=_[_0xac76('0x2f')](_0x3290bd[_0xac76('0x30')],qs[_0xac76('0x31')](_0x28d3fb['query'][_0xac76('0x31')]));_0x44c7f0[_0xac76('0x32')]=_0x44c7f0['attributes'][_0xac76('0x33')]?_0x44c7f0[_0xac76('0x32')]:_0x3290bd[_0xac76('0x30')];if(_0x28d3fb[_0xac76('0x2d')][_0xac76('0x3d')]){_0x44c7f0['include']=[{'all':!![]}];}_0x44c7f0=_[_0xac76('0x39')]({},_0x44c7f0,_0x28d3fb[_0xac76('0x3c')]);return db['SalesforceField']['find'](_0x44c7f0)[_0xac76('0x23')](handleEntityNotFound(_0x4f3f69,null))[_0xac76('0x23')](respondWithResult(_0x4f3f69,null))[_0xac76('0x3f')](handleError(_0x4f3f69,null));};exports[_0xac76('0x43')]=function(_0x5e728b,_0x12679f){return db[_0xac76('0x29')]['create'](_0x5e728b[_0xac76('0x44')],{})[_0xac76('0x23')](respondWithResult(_0x12679f,0xc9))['catch'](handleError(_0x12679f,null));};exports[_0xac76('0x45')]=function(_0xb29d19,_0x4806bf){if(_0xb29d19[_0xac76('0x44')]['id']){delete _0xb29d19['body']['id'];}return db['SalesforceField'][_0xac76('0x46')]({'where':{'id':_0xb29d19[_0xac76('0x47')]['id']}})[_0xac76('0x23')](handleEntityNotFound(_0x4806bf,null))[_0xac76('0x23')](saveUpdates(_0xb29d19['body'],null))[_0xac76('0x23')](respondWithResult(_0x4806bf,null))[_0xac76('0x3f')](handleError(_0x4806bf,null));};exports[_0xac76('0x24')]=function(_0x44b1cd,_0x4371f7){return db[_0xac76('0x29')][_0xac76('0x46')]({'where':{'id':_0x44b1cd[_0xac76('0x47')]['id']}})['then'](handleEntityNotFound(_0x4371f7,null))['then'](removeEntity(_0x4371f7,null))[_0xac76('0x3f')](handleError(_0x4371f7,null));}; \ No newline at end of file +var _0xe06e=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe06e,0x132));var _0xee06=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xe06e[_0x1e4150];return _0x1ce3ee;};'use strict';var emlformat=require(_0xee06('0x0'));var rimraf=require(_0xee06('0x1'));var zipdir=require(_0xee06('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee06('0x3'));var moment=require(_0xee06('0x4'));var BPromise=require(_0xee06('0x5'));var Mustache=require(_0xee06('0x6'));var util=require(_0xee06('0x7'));var path=require('path');var sox=require(_0xee06('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xee06('0x9'));var crypto=require(_0xee06('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xee06('0xb'));var toCsv=require('to-csv');var querystring=require(_0xee06('0xc'));var Papa=require('papaparse');var Redis=require(_0xee06('0xd'));var authService=require(_0xee06('0xe'));var qs=require(_0xee06('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee06('0x10'));var logger=require(_0xee06('0x11'))('api');var utils=require(_0xee06('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xee06('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5a08,_0x42e7bc){_0x42e7bc=_0x42e7bc||0xcc;return function(_0x32549c){if(_0x32549c){return _0x1e5a08['sendStatus'](_0x42e7bc);}return _0x1e5a08[_0xee06('0x14')](_0x42e7bc)['end']();};}function respondWithResult(_0x1f1745,_0x5c3443){_0x5c3443=_0x5c3443||0xc8;return function(_0x5cf5ee){if(_0x5cf5ee){return _0x1f1745['status'](_0x5c3443)[_0xee06('0x15')](_0x5cf5ee);}};}function respondWithFilteredResult(_0x2253e6,_0x3022c9){return function(_0x4da7b7){if(_0x4da7b7){var _0x572a69=typeof _0x3022c9['offset']===_0xee06('0x16')&&typeof _0x3022c9[_0xee06('0x17')]==='undefined';var _0x3e27f9=_0x4da7b7[_0xee06('0x18')];var _0x372e64=_0x572a69?0x0:_0x3022c9[_0xee06('0x19')];var _0x15eae4=_0x572a69?_0x4da7b7['count']:_0x3022c9[_0xee06('0x19')]+_0x3022c9[_0xee06('0x17')];var _0x2a5c7d;if(_0x15eae4>=_0x3e27f9){_0x15eae4=_0x3e27f9;_0x2a5c7d=0xc8;}else{_0x2a5c7d=0xce;}_0x2253e6[_0xee06('0x14')](_0x2a5c7d);return _0x2253e6[_0xee06('0x1a')]('Content-Range',_0x372e64+'-'+_0x15eae4+'/'+_0x3e27f9)[_0xee06('0x15')](_0x4da7b7);}return null;};}function patchUpdates(_0x2fa6b4){return function(_0xfa401f){try{jsonpatch[_0xee06('0x1b')](_0xfa401f,_0x2fa6b4,!![]);}catch(_0xdf123b){return BPromise[_0xee06('0x1c')](_0xdf123b);}return _0xfa401f[_0xee06('0x1d')]();};}function saveUpdates(_0x39ab06,_0x59cbde){return function(_0x43444d){if(_0x43444d){return _0x43444d[_0xee06('0x1e')](_0x39ab06)[_0xee06('0x1f')](function(_0x263245){return _0x263245;});}return null;};}function removeEntity(_0x5bf609,_0x56ff1a){return function(_0x1143dc){if(_0x1143dc){return _0x1143dc[_0xee06('0x20')]()[_0xee06('0x1f')](function(){_0x5bf609['status'](0xcc)[_0xee06('0x21')]();});}};}function handleEntityNotFound(_0x235d12,_0x1d7206){return function(_0x197dde){if(!_0x197dde){_0x235d12[_0xee06('0x22')](0x194);}return _0x197dde;};}function handleError(_0x107ac1,_0x52e290){_0x52e290=_0x52e290||0x1f4;return function(_0x2da93e){logger['error'](_0x2da93e['stack']);if(_0x2da93e[_0xee06('0x23')]){delete _0x2da93e[_0xee06('0x23')];}_0x107ac1[_0xee06('0x14')](_0x52e290)[_0xee06('0x24')](_0x2da93e);};}exports[_0xee06('0x25')]=function(_0x1d4309,_0x5f1e0b){var _0x47cb49={},_0x53b14c={},_0x392ef8={'count':0x0,'rows':[]};var _0x4dcbe1=_[_0xee06('0x26')](db[_0xee06('0x27')][_0xee06('0x28')],function(_0x3ff8af){return{'name':_0x3ff8af[_0xee06('0x29')],'type':_0x3ff8af['type'][_0xee06('0x2a')]};});_0x53b14c[_0xee06('0x2b')]=_[_0xee06('0x26')](_0x4dcbe1,_0xee06('0x23'));_0x53b14c[_0xee06('0x2c')]=_[_0xee06('0x2d')](_0x1d4309[_0xee06('0x2c')]);_0x53b14c[_0xee06('0x2e')]=_[_0xee06('0x2f')](_0x53b14c[_0xee06('0x2b')],_0x53b14c[_0xee06('0x2c')]);_0x47cb49['attributes']=_[_0xee06('0x2f')](_0x53b14c[_0xee06('0x2b')],qs[_0xee06('0x30')](_0x1d4309[_0xee06('0x2c')][_0xee06('0x30')]));_0x47cb49[_0xee06('0x31')]=_0x47cb49['attributes'][_0xee06('0x32')]?_0x47cb49[_0xee06('0x31')]:_0x53b14c[_0xee06('0x2b')];if(!_0x1d4309[_0xee06('0x2c')][_0xee06('0x33')](_0xee06('0x34'))){_0x47cb49[_0xee06('0x17')]=qs['limit'](_0x1d4309['query']['limit']);_0x47cb49['offset']=qs[_0xee06('0x19')](_0x1d4309[_0xee06('0x2c')]['offset']);}_0x47cb49[_0xee06('0x35')]=qs[_0xee06('0x36')](_0x1d4309[_0xee06('0x2c')][_0xee06('0x36')]);_0x47cb49[_0xee06('0x37')]=qs[_0xee06('0x2e')](_[_0xee06('0x38')](_0x1d4309['query'],_0x53b14c[_0xee06('0x2e')]),_0x4dcbe1);if(_0x1d4309[_0xee06('0x2c')][_0xee06('0x39')]){_0x47cb49[_0xee06('0x37')]=_[_0xee06('0x3a')](_0x47cb49[_0xee06('0x37')],{'$or':_[_0xee06('0x26')](_0x4dcbe1,function(_0x5a9ffb){if(_0x5a9ffb[_0xee06('0x3b')]!==_0xee06('0x3c')){var _0x69803={};_0x69803[_0x5a9ffb['name']]={'$like':'%'+_0x1d4309['query'][_0xee06('0x39')]+'%'};return _0x69803;}})});}_0x47cb49=_[_0xee06('0x3a')]({},_0x47cb49,_0x1d4309['options']);var _0x27c0c6={'where':_0x47cb49[_0xee06('0x37')]};return db['SalesforceField'][_0xee06('0x18')](_0x27c0c6)[_0xee06('0x1f')](function(_0x271720){_0x392ef8['count']=_0x271720;if(_0x1d4309['query'][_0xee06('0x3d')]){_0x47cb49[_0xee06('0x3e')]=[{'all':!![]}];}return db[_0xee06('0x27')][_0xee06('0x3f')](_0x47cb49);})[_0xee06('0x1f')](function(_0x45f7ee){_0x392ef8['rows']=_0x45f7ee;return _0x392ef8;})['then'](respondWithFilteredResult(_0x5f1e0b,_0x47cb49))[_0xee06('0x40')](handleError(_0x5f1e0b,null));};exports[_0xee06('0x41')]=function(_0x49a68a,_0x2eec23){var _0x63028a={'raw':!![],'where':{'id':_0x49a68a[_0xee06('0x42')]['id']}},_0x2c1518={};_0x2c1518[_0xee06('0x2b')]=_[_0xee06('0x2d')](db[_0xee06('0x27')][_0xee06('0x28')]);_0x2c1518[_0xee06('0x2c')]=_[_0xee06('0x2d')](_0x49a68a[_0xee06('0x2c')]);_0x2c1518['filters']=_[_0xee06('0x2f')](_0x2c1518[_0xee06('0x2b')],_0x2c1518[_0xee06('0x2c')]);_0x63028a[_0xee06('0x31')]=_[_0xee06('0x2f')](_0x2c1518[_0xee06('0x2b')],qs[_0xee06('0x30')](_0x49a68a[_0xee06('0x2c')][_0xee06('0x30')]));_0x63028a[_0xee06('0x31')]=_0x63028a[_0xee06('0x31')][_0xee06('0x32')]?_0x63028a[_0xee06('0x31')]:_0x2c1518['model'];if(_0x49a68a[_0xee06('0x2c')][_0xee06('0x3d')]){_0x63028a[_0xee06('0x3e')]=[{'all':!![]}];}_0x63028a=_[_0xee06('0x3a')]({},_0x63028a,_0x49a68a[_0xee06('0x43')]);return db[_0xee06('0x27')]['find'](_0x63028a)[_0xee06('0x1f')](handleEntityNotFound(_0x2eec23,null))[_0xee06('0x1f')](respondWithResult(_0x2eec23,null))['catch'](handleError(_0x2eec23,null));};exports['create']=function(_0x29f40c,_0x1b7427){return db['SalesforceField'][_0xee06('0x44')](_0x29f40c[_0xee06('0x45')],{})['then'](respondWithResult(_0x1b7427,0xc9))[_0xee06('0x40')](handleError(_0x1b7427,null));};exports[_0xee06('0x1e')]=function(_0x5bb2a8,_0x469f41){if(_0x5bb2a8[_0xee06('0x45')]['id']){delete _0x5bb2a8[_0xee06('0x45')]['id'];}return db['SalesforceField'][_0xee06('0x46')]({'where':{'id':_0x5bb2a8[_0xee06('0x42')]['id']}})[_0xee06('0x1f')](handleEntityNotFound(_0x469f41,null))['then'](saveUpdates(_0x5bb2a8[_0xee06('0x45')],null))['then'](respondWithResult(_0x469f41,null))[_0xee06('0x40')](handleError(_0x469f41,null));};exports[_0xee06('0x20')]=function(_0x176353,_0x1931bb){return db['SalesforceField'][_0xee06('0x46')]({'where':{'id':_0x176353[_0xee06('0x42')]['id']}})[_0xee06('0x1f')](handleEntityNotFound(_0x1931bb,null))[_0xee06('0x1f')](removeEntity(_0x1931bb,null))[_0xee06('0x40')](handleError(_0x1931bb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 4c2b4f7..d5c770a 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 _0x0866=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','SalesforceField','int_salesforce_fields','FieldId','lodash'];(function(_0x4dd9c2,_0x1066b4){var _0x5048a2=function(_0x237598){while(--_0x237598){_0x4dd9c2['push'](_0x4dd9c2['shift']());}};_0x5048a2(++_0x1066b4);}(_0x0866,0x8f));var _0x6086=function(_0x482303,_0x3c4bd1){_0x482303=_0x482303-0x0;var _0x28ed7c=_0x0866[_0x482303];return _0x28ed7c;};'use strict';var _=require(_0x6086('0x0'));var util=require(_0x6086('0x1'));var logger=require(_0x6086('0x2'))(_0x6086('0x3'));var moment=require('moment');var BPromise=require(_0x6086('0x4'));var rp=require(_0x6086('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6086('0x6'));var config=require(_0x6086('0x7'));var attributes=require(_0x6086('0x8'));module['exports']=function(_0x17d810,_0x28d552){return _0x17d810['define'](_0x6086('0x9'),attributes,{'tableName':_0x6086('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0x6086('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce2=['request-promise','path','rimraf','exports','define','SalesforceField','salesforce_unique_index','idField','util','../../config/logger','api','moment','bluebird'];(function(_0x4c102e,_0x14dd36){var _0x20f51f=function(_0x5cf55c){while(--_0x5cf55c){_0x4c102e['push'](_0x4c102e['shift']());}};_0x20f51f(++_0x14dd36);}(_0x2ce2,0xb1));var _0x22ce=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0x2ce2[_0x48ea38];return _0xa6780;};'use strict';var _=require('lodash');var util=require(_0x22ce('0x0'));var logger=require(_0x22ce('0x1'))(_0x22ce('0x2'));var moment=require(_0x22ce('0x3'));var BPromise=require(_0x22ce('0x4'));var rp=require(_0x22ce('0x5'));var fs=require('fs');var path=require(_0x22ce('0x6'));var rimraf=require(_0x22ce('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x22ce('0x8')]=function(_0x2c7cc9,_0x48a3aa){return _0x2c7cc9[_0x22ce('0x9')](_0x22ce('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x22ce('0xb'),'fields':[_0x22ce('0xc'),'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 f06090e..d6ef6ff 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 _0xa32e=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/logger','rpc'];(function(_0x1270c6,_0x920f24){var _0x4910df=function(_0x2e32b4){while(--_0x2e32b4){_0x1270c6['push'](_0x1270c6['shift']());}};_0x4910df(++_0x920f24);}(_0xa32e,0x1b2));var _0xea32=function(_0x3a6077,_0x3270d8){_0x3a6077=_0x3a6077-0x0;var _0x40b429=_0xa32e[_0x3a6077];return _0x40b429;};'use strict';var _=require(_0xea32('0x0'));var util=require(_0xea32('0x1'));var moment=require(_0xea32('0x2'));var BPromise=require(_0xea32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xea32('0x4'))(_0xea32('0x5'));var config=require(_0xea32('0x6'));var jayson=require(_0xea32('0x7'));var client=jayson[_0xea32('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d4b1,_0x1fe732,_0x6cee32){return new BPromise(function(_0x359c15,_0x3d8d38){return client[_0xea32('0x9')](_0x11d4b1,_0x6cee32)[_0xea32('0xa')](function(_0x198196){logger[_0xea32('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1fe732,_0xea32('0xc'));logger[_0xea32('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1fe732,_0xea32('0xc'),JSON[_0xea32('0xe')](_0x198196));if(_0x198196[_0xea32('0xf')]){if(_0x198196[_0xea32('0xf')]['code']===0x1f4){logger[_0xea32('0xf')](_0xea32('0x10'),_0x1fe732,_0x198196[_0xea32('0xf')][_0xea32('0x11')]);return _0x3d8d38(_0x198196[_0xea32('0xf')][_0xea32('0x11')]);}logger[_0xea32('0xf')]('SalesforceField,\x20%s,\x20%s',_0x1fe732,_0x198196[_0xea32('0xf')][_0xea32('0x11')]);return _0x359c15(_0x198196[_0xea32('0xf')][_0xea32('0x11')]);}else{logger[_0xea32('0xb')](_0xea32('0x10'),_0x1fe732,_0xea32('0xc'));_0x359c15(_0x198196[_0xea32('0x12')]['message']);}})[_0xea32('0x13')](function(_0x97466){logger[_0xea32('0xf')](_0xea32('0x10'),_0x1fe732,_0x97466);_0x3d8d38(_0x97466);});});} \ No newline at end of file +var _0x6c60=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','message','info','catch','util'];(function(_0x5ceb59,_0x5d802b){var _0x2a4c20=function(_0x56ab43){while(--_0x56ab43){_0x5ceb59['push'](_0x5ceb59['shift']());}};_0x2a4c20(++_0x5d802b);}(_0x6c60,0xe3));var _0x06c6=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x6c60[_0x11e30d];return _0x2d4e29;};'use strict';var _=require('lodash');var util=require(_0x06c6('0x0'));var moment=require('moment');var BPromise=require(_0x06c6('0x1'));var rs=require(_0x06c6('0x2'));var fs=require('fs');var Redis=require(_0x06c6('0x3'));var db=require(_0x06c6('0x4'))['db'];var utils=require(_0x06c6('0x5'));var logger=require(_0x06c6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x06c6('0x7'));var client=jayson[_0x06c6('0x8')][_0x06c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a284c,_0x1d4224,_0x47b2aa){return new BPromise(function(_0x40a584,_0x4d7c56){return client[_0x06c6('0xa')](_0x2a284c,_0x47b2aa)[_0x06c6('0xb')](function(_0x41c19c){logger['info'](_0x06c6('0xc'),_0x1d4224,_0x06c6('0xd'));logger[_0x06c6('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1d4224,_0x06c6('0xd'),JSON['stringify'](_0x41c19c));if(_0x41c19c[_0x06c6('0xf')]){if(_0x41c19c[_0x06c6('0xf')]['code']===0x1f4){logger[_0x06c6('0xf')](_0x06c6('0xc'),_0x1d4224,_0x41c19c[_0x06c6('0xf')][_0x06c6('0x10')]);return _0x4d7c56(_0x41c19c[_0x06c6('0xf')]['message']);}logger[_0x06c6('0xf')](_0x06c6('0xc'),_0x1d4224,_0x41c19c[_0x06c6('0xf')][_0x06c6('0x10')]);return _0x40a584(_0x41c19c[_0x06c6('0xf')][_0x06c6('0x10')]);}else{logger[_0x06c6('0x11')](_0x06c6('0xc'),_0x1d4224,_0x06c6('0xd'));_0x40a584(_0x41c19c['result'][_0x06c6('0x10')]);}})[_0x06c6('0x12')](function(_0x4c7a46){logger[_0x06c6('0xf')]('SalesforceField,\x20%s,\x20%s',_0x1d4224,_0x4c7a46);_0x4d7c56(_0x4c7a46);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index f9a66b2..0091e6a 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 _0x151a=['../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x151a,0x12f));var _0xa151=function(_0x4d8f6f,_0x559720){_0x4d8f6f=_0x4d8f6f-0x0;var _0x441c71=_0x151a[_0x4d8f6f];return _0x441c71;};'use strict';var multer=require(_0xa151('0x0'));var util=require(_0xa151('0x1'));var path=require(_0xa151('0x2'));var timeout=require(_0xa151('0x3'));var express=require('express');var router=express[_0xa151('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa151('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa151('0x6'));var controller=require(_0xa151('0x7'));router['get']('/',auth[_0xa151('0x8')](),controller['index']);router[_0xa151('0x9')](_0xa151('0xa'),auth[_0xa151('0x8')](),controller[_0xa151('0xb')]);router[_0xa151('0x9')]('/:id/configurations',auth[_0xa151('0x8')](),controller[_0xa151('0xc')]);router[_0xa151('0x9')](_0xa151('0xd'),auth[_0xa151('0x8')](),controller[_0xa151('0xe')]);router[_0xa151('0xf')]('/',auth[_0xa151('0x8')](),controller[_0xa151('0x10')]);router[_0xa151('0xf')]('/:id/configurations',auth[_0xa151('0x8')](),controller[_0xa151('0x11')]);router[_0xa151('0x12')]('/:id',auth[_0xa151('0x8')](),controller['update']);router[_0xa151('0x13')](_0xa151('0xa'),auth[_0xa151('0x8')](),controller[_0xa151('0x14')]);module[_0xa151('0x15')]=router; \ No newline at end of file +var _0x6037=['post','addConfiguration','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','getFields'];(function(_0x16de8a,_0x2c0e2f){var _0x1fcc53=function(_0x1596cb){while(--_0x1596cb){_0x16de8a['push'](_0x16de8a['shift']());}};_0x1fcc53(++_0x2c0e2f);}(_0x6037,0xe2));var _0x7603=function(_0x3bd2b7,_0x31ae17){_0x3bd2b7=_0x3bd2b7-0x0;var _0x11405c=_0x6037[_0x3bd2b7];return _0x11405c;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var timeout=require('connect-timeout');var express=require(_0x7603('0x3'));var router=express['Router']();var fs_extra=require(_0x7603('0x4'));var auth=require(_0x7603('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7603('0x6'));var controller=require(_0x7603('0x7'));router['get']('/',auth[_0x7603('0x8')](),controller[_0x7603('0x9')]);router[_0x7603('0xa')](_0x7603('0xb'),auth[_0x7603('0x8')](),controller[_0x7603('0xc')]);router[_0x7603('0xa')]('/:id/configurations',auth[_0x7603('0x8')](),controller['getConfigurations']);router[_0x7603('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7603('0xd')]);router[_0x7603('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7603('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x7603('0xf')]);router[_0x7603('0x10')](_0x7603('0xb'),auth[_0x7603('0x8')](),controller[_0x7603('0x11')]);router['delete'](_0x7603('0xb'),auth[_0x7603('0x8')](),controller[_0x7603('0x12')]);module[_0x7603('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b35c9ef..830c27c 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 _0xb610=['STRING','username','remoteUri','sequelize','exports'];(function(_0x11f075,_0x36efc6){var _0x64bb64=function(_0x17627c){while(--_0x17627c){_0x11f075['push'](_0x11f075['shift']());}};_0x64bb64(++_0x36efc6);}(_0xb610,0x9e));var _0x0b61=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb610[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x0b61('0x0'));module[_0x0b61('0x1')]={'name':{'type':Sequelize[_0x0b61('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0b61('0x3')},'password':{'type':Sequelize[_0x0b61('0x2')]},'email':{'type':Sequelize[_0x0b61('0x2')]},'remoteUri':{'type':Sequelize[_0x0b61('0x2')],'unique':_0x0b61('0x4')},'serverUrl':{'type':Sequelize[_0x0b61('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb37b=['exports','STRING'];(function(_0x3171c8,_0x2e7019){var _0x5f1ee5=function(_0x316c4c){while(--_0x316c4c){_0x3171c8['push'](_0x3171c8['shift']());}};_0x5f1ee5(++_0x2e7019);}(_0xb37b,0x1e0));var _0xbb37=function(_0x5395f2,_0x5b7554){_0x5395f2=_0x5395f2-0x0;var _0x396944=_0xb37b[_0x5395f2];return _0x396944;};'use strict';var Sequelize=require('sequelize');module[_0xbb37('0x0')]={'name':{'type':Sequelize[_0xbb37('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbb37('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xbb37('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 4e6abc0..f71c6a6 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 _0xd0f9=['hasOwnProperty','nolimit','order','where','pick','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','sort','addConfiguration','AccountId','getSubjects','channel','ServicenowField','Subjects','Descriptions','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','knowledge','calendar_stc','delivery_plan','business_service','time_worked','expected_start','business_duration','resolved_at','caller_id','approval_set','work_notes','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','correlation_id','username','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','incident\x20table\x20objects','remove','includes','forEach','internalType','label','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','push','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','map','ServicenowAccount','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length'];(function(_0x3b2ffd,_0x39702e){var _0x2b84bc=function(_0x25e081){while(--_0x25e081){_0x3b2ffd['push'](_0x3b2ffd['shift']());}};_0x2b84bc(++_0x39702e);}(_0xd0f9,0x76));var _0x9d0f=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xd0f9[_0x1b70e3];return _0x1452ab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d0f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d0f('0x1'));var moment=require(_0x9d0f('0x2'));var BPromise=require(_0x9d0f('0x3'));var Mustache=require(_0x9d0f('0x4'));var util=require(_0x9d0f('0x5'));var path=require('path');var sox=require(_0x9d0f('0x6'));var csv=require(_0x9d0f('0x7'));var ejs=require(_0x9d0f('0x8'));var fs=require('fs');var fs_extra=require(_0x9d0f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d0f('0xa'));var jsforce=require(_0x9d0f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9d0f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d0f('0xc'));var qs=require(_0x9d0f('0xd'));var as=require(_0x9d0f('0xe'));var hardwareService=require(_0x9d0f('0xf'));var logger=require(_0x9d0f('0x10'))('api');var utils=require(_0x9d0f('0x11'));var config=require(_0x9d0f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x9d0f('0x13'));function respondWithStatusCode(_0x59625,_0x18fefa){_0x18fefa=_0x18fefa||0xcc;return function(_0x1872b1){if(_0x1872b1){return _0x59625[_0x9d0f('0x14')](_0x18fefa);}return _0x59625[_0x9d0f('0x15')](_0x18fefa)['end']();};}function respondWithResult(_0x19ea4c,_0x364a24){_0x364a24=_0x364a24||0xc8;return function(_0x6b102a){if(_0x6b102a){return _0x19ea4c[_0x9d0f('0x15')](_0x364a24)['json'](_0x6b102a);}};}function respondWithFilteredResult(_0x2c3a7e,_0x1bc3d3){return function(_0x2a7d26){if(_0x2a7d26){var _0x53f36a=typeof _0x1bc3d3['offset']===_0x9d0f('0x16')&&typeof _0x1bc3d3[_0x9d0f('0x17')]==='undefined';var _0x14a88a=_0x2a7d26[_0x9d0f('0x18')];var _0x362a48=_0x53f36a?0x0:_0x1bc3d3[_0x9d0f('0x19')];var _0x4aaa50=_0x53f36a?_0x2a7d26[_0x9d0f('0x18')]:_0x1bc3d3[_0x9d0f('0x19')]+_0x1bc3d3[_0x9d0f('0x17')];var _0x397342;if(_0x4aaa50>=_0x14a88a){_0x4aaa50=_0x14a88a;_0x397342=0xc8;}else{_0x397342=0xce;}_0x2c3a7e[_0x9d0f('0x15')](_0x397342);return _0x2c3a7e['set'](_0x9d0f('0x1a'),_0x362a48+'-'+_0x4aaa50+'/'+_0x14a88a)['json'](_0x2a7d26);}return null;};}function patchUpdates(_0x4a72c1){return function(_0x1e7b1b){try{jsonpatch[_0x9d0f('0x1b')](_0x1e7b1b,_0x4a72c1,!![]);}catch(_0x447ade){return BPromise[_0x9d0f('0x1c')](_0x447ade);}return _0x1e7b1b[_0x9d0f('0x1d')]();};}function saveUpdates(_0x10f269,_0x1bf750){return function(_0x4f97f5){if(_0x4f97f5){return _0x4f97f5[_0x9d0f('0x1e')](_0x10f269)[_0x9d0f('0x1f')](function(_0x5ae514){return _0x5ae514;});}return null;};}function removeEntity(_0x1bf34c,_0x39e426){return function(_0x54f1ea){if(_0x54f1ea){return _0x54f1ea['destroy']()[_0x9d0f('0x1f')](function(){_0x1bf34c[_0x9d0f('0x15')](0xcc)[_0x9d0f('0x20')]();});}};}function handleEntityNotFound(_0x428515,_0x1632ed){return function(_0x2c8c24){if(!_0x2c8c24){_0x428515[_0x9d0f('0x14')](0x194);}return _0x2c8c24;};}function handleError(_0x4848e0,_0xbc3af7){_0xbc3af7=_0xbc3af7||0x1f4;return function(_0x324ee7){logger[_0x9d0f('0x21')](_0x324ee7[_0x9d0f('0x22')]);if(_0x324ee7[_0x9d0f('0x23')]){delete _0x324ee7[_0x9d0f('0x23')];}_0x4848e0[_0x9d0f('0x15')](_0xbc3af7)[_0x9d0f('0x24')](_0x324ee7);};}exports['index']=function(_0x5a8427,_0x259bf3){var _0x29ff6c={},_0x54c69d={},_0x3e5105={'count':0x0,'rows':[]};var _0x3c44d4=_[_0x9d0f('0x25')](db[_0x9d0f('0x26')][_0x9d0f('0x27')],function(_0x1ea7af){return{'name':_0x1ea7af['fieldName'],'type':_0x1ea7af[_0x9d0f('0x28')][_0x9d0f('0x29')]};});_0x54c69d['model']=_[_0x9d0f('0x25')](_0x3c44d4,_0x9d0f('0x23'));_0x54c69d['query']=_[_0x9d0f('0x2a')](_0x5a8427['query']);_0x54c69d[_0x9d0f('0x2b')]=_[_0x9d0f('0x2c')](_0x54c69d[_0x9d0f('0x2d')],_0x54c69d[_0x9d0f('0x2e')]);_0x29ff6c[_0x9d0f('0x2f')]=_[_0x9d0f('0x2c')](_0x54c69d[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x30')]));_0x29ff6c[_0x9d0f('0x2f')]=_0x29ff6c[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x29ff6c[_0x9d0f('0x2f')]:_0x54c69d[_0x9d0f('0x2d')];if(!_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x32')](_0x9d0f('0x33'))){_0x29ff6c['limit']=qs[_0x9d0f('0x17')](_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x17')]);_0x29ff6c[_0x9d0f('0x19')]=qs['offset'](_0x5a8427['query'][_0x9d0f('0x19')]);}_0x29ff6c[_0x9d0f('0x34')]=qs['sort'](_0x5a8427[_0x9d0f('0x2e')]['sort']);_0x29ff6c[_0x9d0f('0x35')]=qs[_0x9d0f('0x2b')](_[_0x9d0f('0x36')](_0x5a8427[_0x9d0f('0x2e')],_0x54c69d[_0x9d0f('0x2b')]),_0x3c44d4);if(_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x37')]){_0x29ff6c['where']=_[_0x9d0f('0x38')](_0x29ff6c[_0x9d0f('0x35')],{'$or':_[_0x9d0f('0x25')](_0x3c44d4,function(_0x246a40){if(_0x246a40[_0x9d0f('0x28')]!=='VIRTUAL'){var _0x571395={};_0x571395[_0x246a40[_0x9d0f('0x23')]]={'$like':'%'+_0x5a8427[_0x9d0f('0x2e')][_0x9d0f('0x37')]+'%'};return _0x571395;}})});}_0x29ff6c=_['merge']({},_0x29ff6c,_0x5a8427[_0x9d0f('0x39')]);var _0x3045be={'where':_0x29ff6c['where']};return db[_0x9d0f('0x26')][_0x9d0f('0x18')](_0x3045be)['then'](function(_0x38044d){_0x3e5105[_0x9d0f('0x18')]=_0x38044d;if(_0x5a8427[_0x9d0f('0x2e')]['includeAll']){_0x29ff6c['include']=[{'all':!![]}];}return db[_0x9d0f('0x26')][_0x9d0f('0x3a')](_0x29ff6c);})['then'](function(_0x3e780f){_0x3e5105['rows']=_0x3e780f;return _0x3e5105;})[_0x9d0f('0x1f')](respondWithFilteredResult(_0x259bf3,_0x29ff6c))[_0x9d0f('0x3b')](handleError(_0x259bf3,null));};exports[_0x9d0f('0x3c')]=function(_0x5cae01,_0xbd1691){var _0x32946b={'raw':![],'where':{'id':_0x5cae01[_0x9d0f('0x3d')]['id']}},_0x21c869={};_0x21c869[_0x9d0f('0x2d')]=_[_0x9d0f('0x2a')](db[_0x9d0f('0x26')][_0x9d0f('0x27')]);_0x21c869[_0x9d0f('0x2e')]=_[_0x9d0f('0x2a')](_0x5cae01[_0x9d0f('0x2e')]);_0x21c869['filters']=_['intersection'](_0x21c869['model'],_0x21c869[_0x9d0f('0x2e')]);_0x32946b['attributes']=_[_0x9d0f('0x2c')](_0x21c869[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x5cae01[_0x9d0f('0x2e')][_0x9d0f('0x30')]));_0x32946b[_0x9d0f('0x2f')]=_0x32946b[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x32946b[_0x9d0f('0x2f')]:_0x21c869[_0x9d0f('0x2d')];if(_0x5cae01['query'][_0x9d0f('0x3e')]){_0x32946b[_0x9d0f('0x3f')]=[{'all':!![]}];}_0x32946b=_[_0x9d0f('0x38')]({},_0x32946b,_0x5cae01['options']);return db['ServicenowAccount'][_0x9d0f('0x40')](_0x32946b)['then'](handleEntityNotFound(_0xbd1691,null))[_0x9d0f('0x1f')](respondWithResult(_0xbd1691,null))['catch'](handleError(_0xbd1691,null));};exports[_0x9d0f('0x41')]=function(_0x52bb83,_0x2fbe87){return db[_0x9d0f('0x26')][_0x9d0f('0x41')](_0x52bb83['body'],{})[_0x9d0f('0x1f')](respondWithResult(_0x2fbe87,0xc9))[_0x9d0f('0x3b')](handleError(_0x2fbe87,null));};exports[_0x9d0f('0x1e')]=function(_0x103272,_0x59f56c){if(_0x103272['body']['id']){delete _0x103272[_0x9d0f('0x42')]['id'];}return db['ServicenowAccount'][_0x9d0f('0x40')]({'where':{'id':_0x103272[_0x9d0f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59f56c,null))[_0x9d0f('0x1f')](saveUpdates(_0x103272[_0x9d0f('0x42')],null))[_0x9d0f('0x1f')](respondWithResult(_0x59f56c,null))[_0x9d0f('0x3b')](handleError(_0x59f56c,null));};exports[_0x9d0f('0x43')]=function(_0x157b93,_0x5eb836){return db[_0x9d0f('0x26')][_0x9d0f('0x40')]({'where':{'id':_0x157b93[_0x9d0f('0x3d')]['id']}})[_0x9d0f('0x1f')](handleEntityNotFound(_0x5eb836,null))[_0x9d0f('0x1f')](removeEntity(_0x5eb836,null))[_0x9d0f('0x3b')](handleError(_0x5eb836,null));};exports[_0x9d0f('0x44')]=function(_0x3a69b1,_0xe6a5b3,_0x358c4a){var _0x2b1486={};var _0x2d2471={};var _0x56a4af;var _0x49931d;return db['ServicenowAccount'][_0x9d0f('0x45')]({'where':{'id':_0x3a69b1['params']['id']}})['then'](handleEntityNotFound(_0xe6a5b3,null))[_0x9d0f('0x1f')](function(_0x5d7956){if(_0x5d7956){_0x56a4af=_0x5d7956;_0x2d2471['model']=_[_0x9d0f('0x2a')](db[_0x9d0f('0x46')][_0x9d0f('0x27')]);_0x2d2471['query']=_[_0x9d0f('0x2a')](_0x3a69b1[_0x9d0f('0x2e')]);_0x2d2471['filters']=_[_0x9d0f('0x2c')](_0x2d2471[_0x9d0f('0x2d')],_0x2d2471[_0x9d0f('0x2e')]);_0x2b1486[_0x9d0f('0x2f')]=_[_0x9d0f('0x2c')](_0x2d2471[_0x9d0f('0x2d')],qs[_0x9d0f('0x30')](_0x3a69b1['query']['fields']));_0x2b1486[_0x9d0f('0x2f')]=_0x2b1486[_0x9d0f('0x2f')][_0x9d0f('0x31')]?_0x2b1486[_0x9d0f('0x2f')]:_0x2d2471['model'];_0x2b1486[_0x9d0f('0x34')]=qs[_0x9d0f('0x47')](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x47')]);_0x2b1486[_0x9d0f('0x35')]=qs[_0x9d0f('0x2b')](_[_0x9d0f('0x36')](_0x3a69b1['query'],_0x2d2471[_0x9d0f('0x2b')]));if(_0x3a69b1['query'][_0x9d0f('0x37')]){_0x2b1486[_0x9d0f('0x35')]=_[_0x9d0f('0x38')](_0x2b1486[_0x9d0f('0x35')],{'$or':_[_0x9d0f('0x25')](_0x2b1486['attributes'],function(_0x53925a){var _0x368576={};_0x368576[_0x53925a]={'$like':'%'+_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x37')]+'%'};return _0x368576;})});}_0x2b1486=_[_0x9d0f('0x38')]({},_0x2b1486,_0x3a69b1[_0x9d0f('0x39')]);return _0x56a4af[_0x9d0f('0x44')](_0x2b1486);}})[_0x9d0f('0x1f')](function(_0xd636ac){if(_0xd636ac){_0x49931d=_0xd636ac[_0x9d0f('0x31')];if(!_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x32')]('nolimit')){_0x2b1486[_0x9d0f('0x17')]=qs['limit'](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x17')]);_0x2b1486[_0x9d0f('0x19')]=qs[_0x9d0f('0x19')](_0x3a69b1[_0x9d0f('0x2e')][_0x9d0f('0x19')]);}return _0x56a4af[_0x9d0f('0x44')](_0x2b1486);}})['then'](function(_0xcff771){if(_0xcff771){return _0xcff771?{'count':_0x49931d,'rows':_0xcff771}:null;}})[_0x9d0f('0x1f')](respondWithResult(_0xe6a5b3,null))['catch'](handleError(_0xe6a5b3,null));};exports[_0x9d0f('0x48')]=function(_0x521649,_0x1dd9b6,_0x10cf70){if(_0x521649[_0x9d0f('0x42')]['id']){delete _0x521649[_0x9d0f('0x42')]['id'];}return db[_0x9d0f('0x26')][_0x9d0f('0x45')]({'where':{'id':_0x521649[_0x9d0f('0x3d')]['id']}})[_0x9d0f('0x1f')](handleEntityNotFound(_0x1dd9b6,null))[_0x9d0f('0x1f')](function(_0x41c51a){if(_0x41c51a){_0x521649[_0x9d0f('0x42')][_0x9d0f('0x49')]=_0x41c51a['id'];_0x521649[_0x9d0f('0x42')]['Subjects']=integrations[_0x9d0f('0x4a')](_0x521649['body'][_0x9d0f('0x4b')],_0x521649['body'][_0x9d0f('0x28')]);_0x521649[_0x9d0f('0x42')]['Descriptions']=integrations['getDescriptions'](_0x521649[_0x9d0f('0x42')][_0x9d0f('0x4b')],_0x521649['body'][_0x9d0f('0x28')]);return db['ServicenowConfiguration']['create'](_0x521649['body'],{'include':[{'model':db[_0x9d0f('0x4c')],'as':_0x9d0f('0x4d')},{'model':db['ServicenowField'],'as':_0x9d0f('0x4e')}]});}return null;})['then'](respondWithResult(_0x1dd9b6,null))[_0x9d0f('0x3b')](handleError(_0x1dd9b6,null));};exports[_0x9d0f('0x4f')]=function(_0x28d7dc,_0x5c55ce,_0x418bdb){var _0x721ea4=[_0x9d0f('0x50'),_0x9d0f('0x51'),'knowledge',_0x9d0f('0x52'),_0x9d0f('0x53'),_0x9d0f('0x54'),_0x9d0f('0x55'),_0x9d0f('0x56'),_0x9d0f('0x57')];var _0x1944cf=[_0x9d0f('0x58'),'made_sla',_0x9d0f('0x59'),'watch_list',_0x9d0f('0x5a'),_0x9d0f('0x5b'),_0x9d0f('0x5c'),_0x9d0f('0x51'),_0x9d0f('0x5d'),_0x9d0f('0x5e'),'resolved_by',_0x9d0f('0x5f'),_0x9d0f('0x60'),_0x9d0f('0x61'),'sys_created_on',_0x9d0f('0x62'),_0x9d0f('0x63'),_0x9d0f('0x64'),_0x9d0f('0x65'),'order',_0x9d0f('0x66'),'closed_at','cmdb_ci',_0x9d0f('0x67'),'impact','active','work_notes_list',_0x9d0f('0x68'),'priority','sys_domain_path','rfc',_0x9d0f('0x69'),_0x9d0f('0x6a'),'opened_at',_0x9d0f('0x6b'),'group_list','work_end','reopened_time',_0x9d0f('0x6c'),_0x9d0f('0x6d'),_0x9d0f('0x6e'),_0x9d0f('0x52'),_0x9d0f('0x6f'),'short_description',_0x9d0f('0x53'),'correlation_display',_0x9d0f('0x70'),_0x9d0f('0x71'),_0x9d0f('0x72'),'business_stc',_0x9d0f('0x73'),_0x9d0f('0x74'),_0x9d0f('0x75'),'notify',_0x9d0f('0x76'),_0x9d0f('0x77'),'closed_by',_0x9d0f('0x78'),_0x9d0f('0x79'),_0x9d0f('0x7a'),_0x9d0f('0x7b'),_0x9d0f('0x7c'),'incident_state',_0x9d0f('0x7d'),_0x9d0f('0x7e'),'company',_0x9d0f('0x7f'),_0x9d0f('0x80'),'assigned_to',_0x9d0f('0x56'),_0x9d0f('0x81'),'sla_due','approval',_0x9d0f('0x82'),_0x9d0f('0x83'),'sys_mod_count',_0x9d0f('0x84'),_0x9d0f('0x85'),_0x9d0f('0x86'),'upon_approval',_0x9d0f('0x87'),'location',_0x9d0f('0x57')];var _0x419b1d='';var _0x251c73='';var _0x4b525d=[];var _0x356a47='';var _0xbb7922='';var _0x5f2cd2=[];var _0x489476='';var _0x16c470='';var _0x2e4be5={};var _0x17214f='';return db[_0x9d0f('0x26')][_0x9d0f('0x45')]({'where':{'id':_0x28d7dc[_0x9d0f('0x3d')]['id']},'attributes':['id',_0x9d0f('0x88'),'password','email','remoteUri','serverUrl']})['then'](handleEntityNotFound(_0x5c55ce,null))['then'](function(_0x107e07){if(_0x107e07){_0x17214f=_0x107e07[_0x9d0f('0x89')];var _0x10efd4=_0x17214f[_0x9d0f('0x8a')](-0x1);if(_0x10efd4==='/'){_0x17214f=_0x17214f['substring'](0x0,_0x17214f[_0x9d0f('0x8b')](_0x10efd4));}_0x16c470=util[_0x9d0f('0x8c')](_0x9d0f('0x8d'),_0x17214f);_0x489476=util[_0x9d0f('0x8c')](_0x9d0f('0x8e'),_0x17214f);_0x2e4be5={'user':_0x107e07[_0x9d0f('0x88')],'pass':_0x107e07[_0x9d0f('0x8f')]};var _0x1c793d={'method':_0x9d0f('0x90'),'uri':_0x16c470+'incident?sysparm_display_value=all','auth':_0x2e4be5,'json':!![]};return rp(_0x1c793d);}})[_0x9d0f('0x1f')](function(_0x391669){if(_0x391669[_0x9d0f('0x91')]['length']>0x0){_0x419b1d=_0x391669[_0x9d0f('0x91')];}console['log'](_0x9d0f('0x92'),_0x419b1d);_0x5f2cd2=[];_0x251c73=Object['assign']([],_0x419b1d);_[_0x9d0f('0x93')](_0x251c73,function(_0x4ce444){return!_0x721ea4[_0x9d0f('0x94')](_0x4ce444[_0x9d0f('0x23')]);});_0x251c73[_0x9d0f('0x95')](function(_0x22f57d){var _0x36e33d=createFieldObject(_0x489476,_0x2e4be5,_0x22f57d[_0x9d0f('0x96')],_0x22f57d['name'],_0x22f57d[_0x9d0f('0x97')],![]);_0x5f2cd2['push'](_0x36e33d);});return Promise[_0x9d0f('0x98')](_0x5f2cd2);})[_0x9d0f('0x1f')](function(_0x339716){_0x4b525d=_0x339716;_0x356a47=Object[_0x9d0f('0x99')]([],_0x419b1d);console[_0x9d0f('0x9a')]('TCL:\x20_object',_0x419b1d);_[_0x9d0f('0x93')](_0x356a47,function(_0x59d937){return _0x1944cf[_0x9d0f('0x94')](_0x59d937[_0x9d0f('0x23')]);});console[_0x9d0f('0x9a')](_0x9d0f('0x9b'),_0x356a47);_0x5f2cd2=[];_0x356a47['forEach'](function(_0x3cd8d9){var _0x1d5945=createFieldObject(_0x489476,_0x2e4be5,_0x3cd8d9[_0x9d0f('0x96')],_0x3cd8d9[_0x9d0f('0x23')],_0x3cd8d9[_0x9d0f('0x97')],!![]);_0x5f2cd2['push'](_0x1d5945);});return Promise[_0x9d0f('0x98')](_0x5f2cd2);})[_0x9d0f('0x1f')](function(_0x597c3d){_0xbb7922=_0x597c3d;var _0x7b2910=_0x4b525d['concat'](_0xbb7922);return{'count':_0x7b2910[_0x9d0f('0x31')],'rows':_0x7b2910};})[_0x9d0f('0x1f')](respondWithResult(_0x5c55ce,null))[_0x9d0f('0x3b')](function(_0xc8f428){console[_0x9d0f('0x9a')](_0x9d0f('0x9c')+_0xc8f428);var _0x1ec409=_0x28d7dc[_0x9d0f('0x2e')]['test']?0x1f4:_0xc8f428[_0x9d0f('0x9d')]||0x1f4;logger[_0x9d0f('0x21')](_0xc8f428[_0x9d0f('0x22')]);delete _0xc8f428[_0x9d0f('0x23')];if(_0x1ec409===0x191){_0x1ec409=0x190;}_0x5c55ce[_0x9d0f('0x15')](_0x1ec409)[_0x9d0f('0x24')](_0x28d7dc[_0x9d0f('0x2e')][_0x9d0f('0x9e')]?{'message':_0x9d0f('0x9f'),'statusCode':_0xc8f428[_0x9d0f('0x9d')]}:_0xc8f428);});};function createFieldObject(_0x1fdecf,_0x27f498,_0x4a6eab,_0x9aa5a9,_0x333383,_0x6602bf){return new Promise(function(_0x36e321,_0x5b4f0f){var _0x29773f={'id':_0x9aa5a9,'name':_0x333383,'custom':_0x6602bf};if(_0x4a6eab==='boolean'){_0x29773f[_0x9d0f('0x39')]=[{'name':_0x9d0f('0xa0'),'value':_0x9d0f('0xa1')},{'name':_0x9d0f('0xa2'),'value':_0x9d0f('0xa3')}];_0x36e321(_0x29773f);}else{var _0x46d8a9={'method':'GET','uri':_0x1fdecf+_0x9d0f('0xa4')+_0x9aa5a9,'auth':_0x27f498,'json':!![]};return rp(_0x46d8a9)['then'](function(_0x44756d){var _0x23884c=[];if(_0x44756d['result'][_0x9d0f('0x31')]>0x0){_0x44756d[_0x9d0f('0x91')][_0x9d0f('0x95')](function(_0x4b7343){if(_0x4b7343[_0x9d0f('0xa5')]===_0x9d0f('0xa3')){var _0x268f33={'name':_0x4b7343[_0x9d0f('0x97')],'value':_0x4b7343[_0x9d0f('0xa6')]};_0x23884c[_0x9d0f('0xa7')](_0x268f33);}});}_0x29773f[_0x9d0f('0x39')]=_0x23884c;if(_0x29773f[_0x9d0f('0x39')][_0x9d0f('0x31')]>0x0){_0x36e321(_0x29773f);}else{if(_0x6602bf==![]){_0x36e321();}else{_0x36e321(_0x29773f);}}});}});} \ No newline at end of file +var _0x2d00=['sendStatus','end','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','destroy','ServicenowConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','severity','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','result','log','incident\x20table\x20objects','assign','includes','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x361627,_0x34262e){var _0x5adc0f=function(_0x465f31){while(--_0x465f31){_0x361627['push'](_0x361627['shift']());}};_0x5adc0f(++_0x34262e);}(_0x2d00,0xa9));var _0x02d0=function(_0x5b253c,_0x456461){_0x5b253c=_0x5b253c-0x0;var _0x433ba2=_0x2d00[_0x5b253c];return _0x433ba2;};'use strict';var emlformat=require(_0x02d0('0x0'));var rimraf=require(_0x02d0('0x1'));var zipdir=require(_0x02d0('0x2'));var jsonpatch=require(_0x02d0('0x3'));var rp=require(_0x02d0('0x4'));var moment=require(_0x02d0('0x5'));var BPromise=require(_0x02d0('0x6'));var Mustache=require(_0x02d0('0x7'));var util=require(_0x02d0('0x8'));var path=require(_0x02d0('0x9'));var sox=require(_0x02d0('0xa'));var csv=require(_0x02d0('0xb'));var ejs=require(_0x02d0('0xc'));var fs=require('fs');var fs_extra=require(_0x02d0('0xd'));var _=require('lodash');var squel=require(_0x02d0('0xe'));var crypto=require(_0x02d0('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02d0('0xb'));var querystring=require(_0x02d0('0x10'));var Papa=require(_0x02d0('0x11'));var Redis=require(_0x02d0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x02d0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02d0('0x14'));var logger=require('../../config/logger')(_0x02d0('0x15'));var utils=require(_0x02d0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x02d0('0x17'));var db=require(_0x02d0('0x18'))['db'];var integrations=require(_0x02d0('0x19'));function respondWithStatusCode(_0x47ef54,_0x3b5584){_0x3b5584=_0x3b5584||0xcc;return function(_0x752743){if(_0x752743){return _0x47ef54[_0x02d0('0x1a')](_0x3b5584);}return _0x47ef54['status'](_0x3b5584)[_0x02d0('0x1b')]();};}function respondWithResult(_0x30cb72,_0x3fa62f){_0x3fa62f=_0x3fa62f||0xc8;return function(_0x34b9e0){if(_0x34b9e0){return _0x30cb72[_0x02d0('0x1c')](_0x3fa62f)[_0x02d0('0x1d')](_0x34b9e0);}};}function respondWithFilteredResult(_0x8ff190,_0x13fd34){return function(_0x283777){if(_0x283777){var _0x4c6b75=typeof _0x13fd34['offset']==='undefined'&&typeof _0x13fd34[_0x02d0('0x1e')]===_0x02d0('0x1f');var _0x470fc2=_0x283777[_0x02d0('0x20')];var _0x5a8616=_0x4c6b75?0x0:_0x13fd34['offset'];var _0x1f1ebd=_0x4c6b75?_0x283777['count']:_0x13fd34['offset']+_0x13fd34['limit'];var _0x1b9e73;if(_0x1f1ebd>=_0x470fc2){_0x1f1ebd=_0x470fc2;_0x1b9e73=0xc8;}else{_0x1b9e73=0xce;}_0x8ff190[_0x02d0('0x1c')](_0x1b9e73);return _0x8ff190[_0x02d0('0x21')](_0x02d0('0x22'),_0x5a8616+'-'+_0x1f1ebd+'/'+_0x470fc2)[_0x02d0('0x1d')](_0x283777);}return null;};}function patchUpdates(_0xd5a0d1){return function(_0x372d2a){try{jsonpatch[_0x02d0('0x23')](_0x372d2a,_0xd5a0d1,!![]);}catch(_0x40e37f){return BPromise[_0x02d0('0x24')](_0x40e37f);}return _0x372d2a[_0x02d0('0x25')]();};}function saveUpdates(_0x1b280e,_0x346e55){return function(_0x1cf235){if(_0x1cf235){return _0x1cf235[_0x02d0('0x26')](_0x1b280e)['then'](function(_0x2b7dad){return _0x2b7dad;});}return null;};}function removeEntity(_0x40d8c4,_0x447254){return function(_0x26225b){if(_0x26225b){return _0x26225b['destroy']()[_0x02d0('0x27')](function(){_0x40d8c4[_0x02d0('0x1c')](0xcc)[_0x02d0('0x1b')]();});}};}function handleEntityNotFound(_0xbcd0a2,_0x50c48c){return function(_0x495566){if(!_0x495566){_0xbcd0a2[_0x02d0('0x1a')](0x194);}return _0x495566;};}function handleError(_0x13a2bc,_0x4475e4){_0x4475e4=_0x4475e4||0x1f4;return function(_0x1eaaf9){logger[_0x02d0('0x28')](_0x1eaaf9[_0x02d0('0x29')]);if(_0x1eaaf9[_0x02d0('0x2a')]){delete _0x1eaaf9[_0x02d0('0x2a')];}_0x13a2bc[_0x02d0('0x1c')](_0x4475e4)['send'](_0x1eaaf9);};}exports['index']=function(_0x1e2cbd,_0x4463a0){var _0x50f677={},_0x354e06={},_0xc53a59={'count':0x0,'rows':[]};var _0x27d607=_[_0x02d0('0x2b')](db[_0x02d0('0x2c')][_0x02d0('0x2d')],function(_0x54b67a){return{'name':_0x54b67a[_0x02d0('0x2e')],'type':_0x54b67a[_0x02d0('0x2f')][_0x02d0('0x30')]};});_0x354e06[_0x02d0('0x31')]=_[_0x02d0('0x2b')](_0x27d607,'name');_0x354e06[_0x02d0('0x32')]=_[_0x02d0('0x33')](_0x1e2cbd[_0x02d0('0x32')]);_0x354e06[_0x02d0('0x34')]=_[_0x02d0('0x35')](_0x354e06[_0x02d0('0x31')],_0x354e06['query']);_0x50f677[_0x02d0('0x36')]=_[_0x02d0('0x35')](_0x354e06[_0x02d0('0x31')],qs[_0x02d0('0x37')](_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x37')]));_0x50f677['attributes']=_0x50f677[_0x02d0('0x36')][_0x02d0('0x38')]?_0x50f677[_0x02d0('0x36')]:_0x354e06[_0x02d0('0x31')];if(!_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x39')](_0x02d0('0x3a'))){_0x50f677[_0x02d0('0x1e')]=qs['limit'](_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x1e')]);_0x50f677[_0x02d0('0x3b')]=qs['offset'](_0x1e2cbd[_0x02d0('0x32')]['offset']);}_0x50f677[_0x02d0('0x3c')]=qs[_0x02d0('0x3d')](_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x3d')]);_0x50f677[_0x02d0('0x3e')]=qs[_0x02d0('0x34')](_['pick'](_0x1e2cbd[_0x02d0('0x32')],_0x354e06[_0x02d0('0x34')]),_0x27d607);if(_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x3f')]){_0x50f677[_0x02d0('0x3e')]=_['merge'](_0x50f677[_0x02d0('0x3e')],{'$or':_['map'](_0x27d607,function(_0x21c9db){if(_0x21c9db[_0x02d0('0x2f')]!==_0x02d0('0x40')){var _0x5e26ee={};_0x5e26ee[_0x21c9db['name']]={'$like':'%'+_0x1e2cbd[_0x02d0('0x32')][_0x02d0('0x3f')]+'%'};return _0x5e26ee;}})});}_0x50f677=_[_0x02d0('0x41')]({},_0x50f677,_0x1e2cbd[_0x02d0('0x42')]);var _0x5737b8={'where':_0x50f677[_0x02d0('0x3e')]};return db[_0x02d0('0x2c')][_0x02d0('0x20')](_0x5737b8)[_0x02d0('0x27')](function(_0xf7be18){_0xc53a59[_0x02d0('0x20')]=_0xf7be18;if(_0x1e2cbd['query']['includeAll']){_0x50f677[_0x02d0('0x43')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x02d0('0x44')](_0x50f677);})[_0x02d0('0x27')](function(_0xd4e746){_0xc53a59[_0x02d0('0x45')]=_0xd4e746;return _0xc53a59;})['then'](respondWithFilteredResult(_0x4463a0,_0x50f677))[_0x02d0('0x46')](handleError(_0x4463a0,null));};exports['show']=function(_0x25308d,_0x5628e0){var _0x2e1ff3={'raw':![],'where':{'id':_0x25308d[_0x02d0('0x47')]['id']}},_0x28f882={};_0x28f882['model']=_[_0x02d0('0x33')](db[_0x02d0('0x2c')]['rawAttributes']);_0x28f882[_0x02d0('0x32')]=_[_0x02d0('0x33')](_0x25308d[_0x02d0('0x32')]);_0x28f882['filters']=_[_0x02d0('0x35')](_0x28f882[_0x02d0('0x31')],_0x28f882[_0x02d0('0x32')]);_0x2e1ff3[_0x02d0('0x36')]=_['intersection'](_0x28f882[_0x02d0('0x31')],qs['fields'](_0x25308d[_0x02d0('0x32')][_0x02d0('0x37')]));_0x2e1ff3[_0x02d0('0x36')]=_0x2e1ff3[_0x02d0('0x36')][_0x02d0('0x38')]?_0x2e1ff3['attributes']:_0x28f882['model'];if(_0x25308d[_0x02d0('0x32')][_0x02d0('0x48')]){_0x2e1ff3[_0x02d0('0x43')]=[{'all':!![]}];}_0x2e1ff3=_['merge']({},_0x2e1ff3,_0x25308d[_0x02d0('0x42')]);return db[_0x02d0('0x2c')][_0x02d0('0x49')](_0x2e1ff3)[_0x02d0('0x27')](handleEntityNotFound(_0x5628e0,null))['then'](respondWithResult(_0x5628e0,null))['catch'](handleError(_0x5628e0,null));};exports[_0x02d0('0x4a')]=function(_0x4ab822,_0x5414d8){return db[_0x02d0('0x2c')][_0x02d0('0x4a')](_0x4ab822['body'],{})['then'](respondWithResult(_0x5414d8,0xc9))['catch'](handleError(_0x5414d8,null));};exports['update']=function(_0x3aa839,_0x1e0cfa){if(_0x3aa839[_0x02d0('0x4b')]['id']){delete _0x3aa839[_0x02d0('0x4b')]['id'];}return db['ServicenowAccount'][_0x02d0('0x49')]({'where':{'id':_0x3aa839[_0x02d0('0x47')]['id']}})[_0x02d0('0x27')](handleEntityNotFound(_0x1e0cfa,null))[_0x02d0('0x27')](saveUpdates(_0x3aa839[_0x02d0('0x4b')],null))[_0x02d0('0x27')](respondWithResult(_0x1e0cfa,null))['catch'](handleError(_0x1e0cfa,null));};exports[_0x02d0('0x4c')]=function(_0x1349b1,_0x20b3ec){return db[_0x02d0('0x2c')][_0x02d0('0x49')]({'where':{'id':_0x1349b1[_0x02d0('0x47')]['id']}})[_0x02d0('0x27')](handleEntityNotFound(_0x20b3ec,null))['then'](removeEntity(_0x20b3ec,null))[_0x02d0('0x46')](handleError(_0x20b3ec,null));};exports['getConfigurations']=function(_0x191445,_0x59ffeb,_0x17d6ad){var _0x76e6d={};var _0x63b7a2={};var _0x50a388;var _0x59bfcc;return db[_0x02d0('0x2c')]['findOne']({'where':{'id':_0x191445[_0x02d0('0x47')]['id']}})[_0x02d0('0x27')](handleEntityNotFound(_0x59ffeb,null))['then'](function(_0x2a968e){if(_0x2a968e){_0x50a388=_0x2a968e;_0x63b7a2[_0x02d0('0x31')]=_['keys'](db[_0x02d0('0x4d')][_0x02d0('0x2d')]);_0x63b7a2['query']=_[_0x02d0('0x33')](_0x191445[_0x02d0('0x32')]);_0x63b7a2[_0x02d0('0x34')]=_['intersection'](_0x63b7a2['model'],_0x63b7a2[_0x02d0('0x32')]);_0x76e6d[_0x02d0('0x36')]=_['intersection'](_0x63b7a2[_0x02d0('0x31')],qs[_0x02d0('0x37')](_0x191445[_0x02d0('0x32')][_0x02d0('0x37')]));_0x76e6d['attributes']=_0x76e6d[_0x02d0('0x36')][_0x02d0('0x38')]?_0x76e6d[_0x02d0('0x36')]:_0x63b7a2['model'];_0x76e6d[_0x02d0('0x3c')]=qs[_0x02d0('0x3d')](_0x191445[_0x02d0('0x32')][_0x02d0('0x3d')]);_0x76e6d['where']=qs[_0x02d0('0x34')](_[_0x02d0('0x4e')](_0x191445['query'],_0x63b7a2['filters']));if(_0x191445[_0x02d0('0x32')]['filter']){_0x76e6d[_0x02d0('0x3e')]=_['merge'](_0x76e6d['where'],{'$or':_[_0x02d0('0x2b')](_0x76e6d[_0x02d0('0x36')],function(_0x240415){var _0x1d60c4={};_0x1d60c4[_0x240415]={'$like':'%'+_0x191445[_0x02d0('0x32')][_0x02d0('0x3f')]+'%'};return _0x1d60c4;})});}_0x76e6d=_[_0x02d0('0x41')]({},_0x76e6d,_0x191445[_0x02d0('0x42')]);return _0x50a388['getConfigurations'](_0x76e6d);}})[_0x02d0('0x27')](function(_0x57a44d){if(_0x57a44d){_0x59bfcc=_0x57a44d[_0x02d0('0x38')];if(!_0x191445['query'][_0x02d0('0x39')](_0x02d0('0x3a'))){_0x76e6d[_0x02d0('0x1e')]=qs[_0x02d0('0x1e')](_0x191445[_0x02d0('0x32')]['limit']);_0x76e6d[_0x02d0('0x3b')]=qs['offset'](_0x191445[_0x02d0('0x32')][_0x02d0('0x3b')]);}return _0x50a388['getConfigurations'](_0x76e6d);}})[_0x02d0('0x27')](function(_0x4cce12){if(_0x4cce12){return _0x4cce12?{'count':_0x59bfcc,'rows':_0x4cce12}:null;}})[_0x02d0('0x27')](respondWithResult(_0x59ffeb,null))['catch'](handleError(_0x59ffeb,null));};exports[_0x02d0('0x4f')]=function(_0x3a88da,_0x26f690,_0x206ba7){if(_0x3a88da[_0x02d0('0x4b')]['id']){delete _0x3a88da[_0x02d0('0x4b')]['id'];}return db[_0x02d0('0x2c')][_0x02d0('0x50')]({'where':{'id':_0x3a88da[_0x02d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x26f690,null))[_0x02d0('0x27')](function(_0xfffc0c){if(_0xfffc0c){_0x3a88da['body'][_0x02d0('0x51')]=_0xfffc0c['id'];_0x3a88da[_0x02d0('0x4b')][_0x02d0('0x52')]=integrations[_0x02d0('0x53')](_0x3a88da[_0x02d0('0x4b')][_0x02d0('0x54')],_0x3a88da['body'][_0x02d0('0x2f')]);_0x3a88da['body'][_0x02d0('0x55')]=integrations[_0x02d0('0x56')](_0x3a88da[_0x02d0('0x4b')][_0x02d0('0x54')],_0x3a88da[_0x02d0('0x4b')][_0x02d0('0x2f')]);return db['ServicenowConfiguration']['create'](_0x3a88da[_0x02d0('0x4b')],{'include':[{'model':db[_0x02d0('0x57')],'as':_0x02d0('0x52')},{'model':db['ServicenowField'],'as':_0x02d0('0x55')}]});}return null;})[_0x02d0('0x27')](respondWithResult(_0x26f690,null))[_0x02d0('0x46')](handleError(_0x26f690,null));};exports[_0x02d0('0x58')]=function(_0x118a77,_0x5d045d,_0x34ffd4){var _0xa36d2d=[_0x02d0('0x59'),'hold_reason',_0x02d0('0x5a'),_0x02d0('0x5b'),_0x02d0('0x5c'),'notify',_0x02d0('0x5d'),'severity',_0x02d0('0x5e')];var _0x4008ab=[_0x02d0('0x5f'),_0x02d0('0x59'),_0x02d0('0x60'),_0x02d0('0x61'),_0x02d0('0x62'),'sys_updated_on',_0x02d0('0x63'),_0x02d0('0x64'),_0x02d0('0x65'),'number',_0x02d0('0x66'),_0x02d0('0x67'),_0x02d0('0x68'),_0x02d0('0x69'),_0x02d0('0x6a'),'sys_domain',_0x02d0('0x6b'),_0x02d0('0x6c'),_0x02d0('0x5a'),_0x02d0('0x3c'),_0x02d0('0x6d'),_0x02d0('0x6e'),_0x02d0('0x6f'),_0x02d0('0x70'),_0x02d0('0x71'),_0x02d0('0x72'),_0x02d0('0x73'),_0x02d0('0x74'),_0x02d0('0x75'),_0x02d0('0x76'),_0x02d0('0x77'),_0x02d0('0x78'),_0x02d0('0x79'),_0x02d0('0x7a'),_0x02d0('0x7b'),_0x02d0('0x7c'),_0x02d0('0x7d'),_0x02d0('0x7e'),'resolved_at','caller_id',_0x02d0('0x7f'),'subcategory',_0x02d0('0x80'),_0x02d0('0x81'),_0x02d0('0x5c'),'correlation_display',_0x02d0('0x82'),_0x02d0('0x83'),_0x02d0('0x84'),_0x02d0('0x85'),_0x02d0('0x86'),_0x02d0('0x87'),'calendar_duration',_0x02d0('0x88'),'sys_class_name',_0x02d0('0x89'),_0x02d0('0x8a'),_0x02d0('0x8b'),_0x02d0('0x8c'),_0x02d0('0x8d'),_0x02d0('0x8e'),_0x02d0('0x8f'),_0x02d0('0x5d'),'urgency',_0x02d0('0x90'),_0x02d0('0x91'),_0x02d0('0x92'),_0x02d0('0x93'),'assigned_to',_0x02d0('0x94'),_0x02d0('0x95'),'sla_due',_0x02d0('0x96'),_0x02d0('0x97'),_0x02d0('0x98'),_0x02d0('0x99'),_0x02d0('0x9a'),_0x02d0('0x9b'),_0x02d0('0x9c'),'upon_approval','correlation_id',_0x02d0('0x9d'),'category'];var _0x16a5b3='';var _0x461647='';var _0x39c24d=[];var _0x44866d='';var _0xa763f8='';var _0x13a345=[];var _0x1eb53f='';var _0x31b013='';var _0x36e985={};var _0x63e8b='';return db[_0x02d0('0x2c')][_0x02d0('0x50')]({'where':{'id':_0x118a77[_0x02d0('0x47')]['id']},'attributes':['id',_0x02d0('0x9e'),'password',_0x02d0('0x9f'),_0x02d0('0xa0'),_0x02d0('0xa1')]})[_0x02d0('0x27')](handleEntityNotFound(_0x5d045d,null))[_0x02d0('0x27')](function(_0x5afe62){if(_0x5afe62){_0x63e8b=_0x5afe62[_0x02d0('0xa0')];var _0x5b054f=_0x63e8b['slice'](-0x1);if(_0x5b054f==='/'){_0x63e8b=_0x63e8b[_0x02d0('0xa2')](0x0,_0x63e8b[_0x02d0('0xa3')](_0x5b054f));}_0x31b013=util[_0x02d0('0xa4')](_0x02d0('0xa5'),_0x63e8b);_0x1eb53f=util[_0x02d0('0xa4')](_0x02d0('0xa6'),_0x63e8b);_0x36e985={'user':_0x5afe62['username'],'pass':_0x5afe62[_0x02d0('0xa7')]};var _0x3f5fb0={'method':_0x02d0('0xa8'),'uri':_0x31b013+'incident?sysparm_display_value=all','auth':_0x36e985,'json':!![]};return rp(_0x3f5fb0);}})[_0x02d0('0x27')](function(_0x27fd93){if(_0x27fd93[_0x02d0('0xa9')][_0x02d0('0x38')]>0x0){_0x16a5b3=_0x27fd93[_0x02d0('0xa9')];}console[_0x02d0('0xaa')](_0x02d0('0xab'),_0x16a5b3);_0x13a345=[];_0x461647=Object[_0x02d0('0xac')]([],_0x16a5b3);_['remove'](_0x461647,function(_0x545384){return!_0xa36d2d[_0x02d0('0xad')](_0x545384['name']);});_0x461647['forEach'](function(_0x231193){var _0x2daff0=createFieldObject(_0x1eb53f,_0x36e985,_0x231193[_0x02d0('0xae')],_0x231193['name'],_0x231193[_0x02d0('0xaf')],![]);_0x13a345[_0x02d0('0xb0')](_0x2daff0);});return Promise[_0x02d0('0xb1')](_0x13a345);})[_0x02d0('0x27')](function(_0x2c6943){_0x39c24d=_0x2c6943;_0x44866d=Object['assign']([],_0x16a5b3);console[_0x02d0('0xaa')]('TCL:\x20_object',_0x16a5b3);_[_0x02d0('0xb2')](_0x44866d,function(_0x5de5cb){return _0x4008ab['includes'](_0x5de5cb[_0x02d0('0x2a')]);});console[_0x02d0('0xaa')](_0x02d0('0xb3'),_0x44866d);_0x13a345=[];_0x44866d[_0x02d0('0xb4')](function(_0xe67cf4){var _0xfcbfa=createFieldObject(_0x1eb53f,_0x36e985,_0xe67cf4[_0x02d0('0xae')],_0xe67cf4[_0x02d0('0x2a')],_0xe67cf4[_0x02d0('0xaf')],!![]);_0x13a345['push'](_0xfcbfa);});return Promise[_0x02d0('0xb1')](_0x13a345);})[_0x02d0('0x27')](function(_0x4170f6){_0xa763f8=_0x4170f6;var _0x4177a5=_0x39c24d[_0x02d0('0xb5')](_0xa763f8);return{'count':_0x4177a5[_0x02d0('0x38')],'rows':_0x4177a5};})[_0x02d0('0x27')](respondWithResult(_0x5d045d,null))['catch'](function(_0x2bdc59){console['log'](_0x02d0('0xb6')+_0x2bdc59);var _0x112240=_0x118a77[_0x02d0('0x32')][_0x02d0('0xb7')]?0x1f4:_0x2bdc59[_0x02d0('0xb8')]||0x1f4;logger['error'](_0x2bdc59[_0x02d0('0x29')]);delete _0x2bdc59[_0x02d0('0x2a')];if(_0x112240===0x191){_0x112240=0x190;}_0x5d045d['status'](_0x112240)[_0x02d0('0xb9')](_0x118a77[_0x02d0('0x32')][_0x02d0('0xb7')]?{'message':_0x02d0('0xba'),'statusCode':_0x2bdc59[_0x02d0('0xb8')]}:_0x2bdc59);});};function createFieldObject(_0x340cea,_0x535f7a,_0xf9bbcb,_0xb6e516,_0x539f4c,_0x46c53f){return new Promise(function(_0x2296f1,_0x5abb8f){var _0x957840={'id':_0xb6e516,'name':_0x539f4c,'custom':_0x46c53f};if(_0xf9bbcb===_0x02d0('0xbb')){_0x957840[_0x02d0('0x42')]=[{'name':_0x02d0('0xbc'),'value':_0x02d0('0xbd')},{'name':_0x02d0('0xbe'),'value':_0x02d0('0xbf')}];_0x2296f1(_0x957840);}else{var _0xcd9be9={'method':_0x02d0('0xa8'),'uri':_0x340cea+_0x02d0('0xc0')+_0xb6e516,'auth':_0x535f7a,'json':!![]};return rp(_0xcd9be9)[_0x02d0('0x27')](function(_0x2c816c){var _0x4c431f=[];if(_0x2c816c[_0x02d0('0xa9')][_0x02d0('0x38')]>0x0){_0x2c816c[_0x02d0('0xa9')][_0x02d0('0xb4')](function(_0x20f845){if(_0x20f845[_0x02d0('0xc1')]===_0x02d0('0xbf')){var _0x3441a8={'name':_0x20f845[_0x02d0('0xaf')],'value':_0x20f845[_0x02d0('0xc2')]};_0x4c431f[_0x02d0('0xb0')](_0x3441a8);}});}_0x957840[_0x02d0('0x42')]=_0x4c431f;if(_0x957840['options'][_0x02d0('0x38')]>0x0){_0x2296f1(_0x957840);}else{if(_0x46c53f==![]){_0x2296f1();}else{_0x2296f1(_0x957840);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index da30d29..955eab5 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount'];(function(_0x10968f,_0xa9c0b2){var _0x3b5f97=function(_0x35b75c){while(--_0x35b75c){_0x10968f['push'](_0x10968f['shift']());}};_0x3b5f97(++_0xa9c0b2);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x473be3,_0x2c7c04){_0x473be3=_0x473be3-0x0;var _0x44603e=_0xdbf5[_0x473be3];return _0x44603e;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));var integrations=require(_0x5dbf('0x8'));module[_0x5dbf('0x9')]=function(_0x3f8222,_0x209b7d){return _0x3f8222[_0x5dbf('0xa')](_0x5dbf('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','api','bluebird','request-promise'];(function(_0x4da7aa,_0x5d830c){var _0x3ffc2f=function(_0x3d050b){while(--_0x3d050b){_0x4da7aa['push'](_0x4da7aa['shift']());}};_0x3ffc2f(++_0x5d830c);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7e9223c..643e30a 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 _0x183b=['catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','limit','include','model','attributes','map','ShowServicenowAccount','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x2bafde,_0x39326c){var _0x5733dc=function(_0x3aa9a6){while(--_0x3aa9a6){_0x2bafde['push'](_0x2bafde['shift']());}};_0x5733dc(++_0x39326c);}(_0x183b,0xda));var _0xb183=function(_0x7c20f7,_0x119eab){_0x7c20f7=_0x7c20f7-0x0;var _0x26113b=_0x183b[_0x7c20f7];return _0x26113b;};'use strict';var _=require(_0xb183('0x0'));var util=require('util');var moment=require(_0xb183('0x1'));var BPromise=require('bluebird');var rs=require(_0xb183('0x2'));var fs=require('fs');var Redis=require(_0xb183('0x3'));var db=require(_0xb183('0x4'))['db'];var utils=require(_0xb183('0x5'));var logger=require(_0xb183('0x6'))('rpc');var config=require(_0xb183('0x7'));var jayson=require(_0xb183('0x8'));var client=jayson[_0xb183('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1520f1,_0x29ae11,_0x40cd8a){return new BPromise(function(_0x3605be,_0xd32442){return client[_0xb183('0xa')](_0x1520f1,_0x40cd8a)[_0xb183('0xb')](function(_0x14a79b){logger[_0xb183('0xc')](_0xb183('0xd'),_0x29ae11,_0xb183('0xe'));logger['debug'](_0xb183('0xf'),_0x29ae11,'request\x20sent',JSON['stringify'](_0x14a79b));if(_0x14a79b['error']){if(_0x14a79b['error'][_0xb183('0x10')]===0x1f4){logger[_0xb183('0x11')](_0xb183('0xd'),_0x29ae11,_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);return _0xd32442(_0x14a79b[_0xb183('0x11')]['message']);}logger['error'](_0xb183('0xd'),_0x29ae11,_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);return _0x3605be(_0x14a79b[_0xb183('0x11')][_0xb183('0x12')]);}else{logger[_0xb183('0xc')](_0xb183('0xd'),_0x29ae11,_0xb183('0xe'));_0x3605be(_0x14a79b[_0xb183('0x13')]['message']);}})[_0xb183('0x14')](function(_0x4c0421){logger['error'](_0xb183('0xd'),_0x29ae11,_0x4c0421);_0xd32442(_0x4c0421);});});}exports[_0xb183('0x15')]=function(_0x8b03be){var _0x9fce32=this;return new Promise(function(_0x4b2d88,_0x36254b){return db[_0xb183('0x16')][_0xb183('0x17')]({'raw':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')][_0xb183('0x19')]||null:null,'attributes':_0x8b03be['options']?_0x8b03be['options']['attributes']||null:null,'limit':_0x8b03be[_0xb183('0x18')]?_0x8b03be['options'][_0xb183('0x1a')]||null:null,'include':_0x8b03be[_0xb183('0x18')]?_0x8b03be[_0xb183('0x18')][_0xb183('0x1b')]?_['map'](_0x8b03be[_0xb183('0x18')]['include'],function(_0x494dc8){return{'model':db[_0x494dc8[_0xb183('0x1c')]],'as':_0x494dc8['as'],'attributes':_0x494dc8[_0xb183('0x1d')],'include':_0x494dc8[_0xb183('0x1b')]?_['map'](_0x494dc8[_0xb183('0x1b')],function(_0xc72848){return{'model':db[_0xc72848[_0xb183('0x1c')]],'as':_0xc72848['as'],'attributes':_0xc72848[_0xb183('0x1d')],'include':_0xc72848[_0xb183('0x1b')]?_[_0xb183('0x1e')](_0xc72848['include'],function(_0x3437c2){return{'model':db[_0x3437c2[_0xb183('0x1c')]],'as':_0x3437c2['as'],'attributes':_0x3437c2[_0xb183('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb183('0xb')](function(_0x5212a2){logger[_0xb183('0xc')](_0xb183('0x15'),_0x8b03be);logger['debug'](_0xb183('0x15'),_0x8b03be,JSON['stringify'](_0x5212a2));_0x4b2d88(_0x5212a2);})[_0xb183('0x14')](function(_0x107dd3){logger[_0xb183('0x11')](_0xb183('0x15'),_0x107dd3[_0xb183('0x12')],_0x8b03be);_0x36254b(_0x9fce32[_0xb183('0x11')](0x1f4,_0x107dd3['message']));});});};exports[_0xb183('0x1f')]=function(_0x1a0fa4){var _0x202c29=this;return new Promise(function(_0x4ade6e,_0x5b04ae){return db['ServicenowAccount'][_0xb183('0x20')]({'raw':_0x1a0fa4[_0xb183('0x18')]?_0x1a0fa4[_0xb183('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0fa4['options']?_0x1a0fa4[_0xb183('0x18')][_0xb183('0x19')]||null:null,'attributes':_0x1a0fa4[_0xb183('0x18')]?_0x1a0fa4[_0xb183('0x18')][_0xb183('0x1d')]||null:null,'include':_0x1a0fa4['options']?_0x1a0fa4['options'][_0xb183('0x1b')]?_[_0xb183('0x1e')](_0x1a0fa4[_0xb183('0x18')][_0xb183('0x1b')],function(_0xd49a41){return{'model':db[_0xd49a41[_0xb183('0x1c')]],'as':_0xd49a41['as'],'attributes':_0xd49a41[_0xb183('0x1d')],'include':_0xd49a41[_0xb183('0x1b')]?_['map'](_0xd49a41[_0xb183('0x1b')],function(_0x3056f2){return{'model':db[_0x3056f2[_0xb183('0x1c')]],'as':_0x3056f2['as'],'attributes':_0x3056f2[_0xb183('0x1d')],'include':_0x3056f2[_0xb183('0x1b')]?_[_0xb183('0x1e')](_0x3056f2[_0xb183('0x1b')],function(_0x2e51c7){return{'model':db[_0x2e51c7[_0xb183('0x1c')]],'as':_0x2e51c7['as'],'attributes':_0x2e51c7[_0xb183('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb183('0xb')](function(_0x44cec7){logger['info']('ShowServicenowAccount',_0x1a0fa4);logger[_0xb183('0x21')](_0xb183('0x1f'),_0x1a0fa4,JSON['stringify'](_0x44cec7));_0x4ade6e(_0x44cec7);})[_0xb183('0x14')](function(_0x7328ae){logger[_0xb183('0x11')]('ShowServicenowAccount',_0x7328ae[_0xb183('0x12')],_0x1a0fa4);_0x5b04ae(_0x202c29[_0xb183('0x11')](0x1f4,_0x7328ae['message']));});});}; \ No newline at end of file +var _0xc0b7=['model','ShowServicenowAccount','ServicenowAccount','find','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x445ab2,_0x28d7ed){var _0x3eae9f=function(_0x2d4b5a){while(--_0x2d4b5a){_0x445ab2['push'](_0x445ab2['shift']());}};_0x3eae9f(++_0x28d7ed);}(_0xc0b7,0xbe));var _0x7c0b=function(_0x19b16e,_0x3c3fa8){_0x19b16e=_0x19b16e-0x0;var _0x51eabf=_0xc0b7[_0x19b16e];return _0x51eabf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c0b('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c0b('0x1'))['db'];var utils=require(_0x7c0b('0x2'));var logger=require('../../config/logger')(_0x7c0b('0x3'));var config=require('../../config/environment');var jayson=require(_0x7c0b('0x4'));var client=jayson['client'][_0x7c0b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x741cc5,_0x38765a,_0x42f22e){return new BPromise(function(_0x32c6c8,_0x468c82){return client[_0x7c0b('0x6')](_0x741cc5,_0x42f22e)[_0x7c0b('0x7')](function(_0x50d28f){logger['info'](_0x7c0b('0x8'),_0x38765a,_0x7c0b('0x9'));logger[_0x7c0b('0xa')](_0x7c0b('0xb'),_0x38765a,_0x7c0b('0x9'),JSON[_0x7c0b('0xc')](_0x50d28f));if(_0x50d28f[_0x7c0b('0xd')]){if(_0x50d28f['error'][_0x7c0b('0xe')]===0x1f4){logger[_0x7c0b('0xd')](_0x7c0b('0x8'),_0x38765a,_0x50d28f[_0x7c0b('0xd')][_0x7c0b('0xf')]);return _0x468c82(_0x50d28f['error']['message']);}logger['error'](_0x7c0b('0x8'),_0x38765a,_0x50d28f[_0x7c0b('0xd')][_0x7c0b('0xf')]);return _0x32c6c8(_0x50d28f['error'][_0x7c0b('0xf')]);}else{logger[_0x7c0b('0x10')](_0x7c0b('0x8'),_0x38765a,_0x7c0b('0x9'));_0x32c6c8(_0x50d28f['result'][_0x7c0b('0xf')]);}})[_0x7c0b('0x11')](function(_0x4cabad){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x38765a,_0x4cabad);_0x468c82(_0x4cabad);});});}exports[_0x7c0b('0x12')]=function(_0x4b12b7){var _0x3a2548=this;return new Promise(function(_0x5090eb,_0x9af20c){return db['ServicenowAccount'][_0x7c0b('0x13')]({'raw':_0x4b12b7[_0x7c0b('0x14')]?_0x4b12b7[_0x7c0b('0x14')][_0x7c0b('0x15')]===undefined?!![]:![]:!![],'where':_0x4b12b7[_0x7c0b('0x14')]?_0x4b12b7[_0x7c0b('0x14')][_0x7c0b('0x16')]||null:null,'attributes':_0x4b12b7['options']?_0x4b12b7[_0x7c0b('0x14')][_0x7c0b('0x17')]||null:null,'limit':_0x4b12b7[_0x7c0b('0x14')]?_0x4b12b7[_0x7c0b('0x14')][_0x7c0b('0x18')]||null:null,'include':_0x4b12b7[_0x7c0b('0x14')]?_0x4b12b7[_0x7c0b('0x14')][_0x7c0b('0x19')]?_[_0x7c0b('0x1a')](_0x4b12b7['options'][_0x7c0b('0x19')],function(_0x1873c5){return{'model':db[_0x1873c5['model']],'as':_0x1873c5['as'],'attributes':_0x1873c5[_0x7c0b('0x17')],'include':_0x1873c5[_0x7c0b('0x19')]?_[_0x7c0b('0x1a')](_0x1873c5['include'],function(_0x4c2a20){return{'model':db[_0x4c2a20[_0x7c0b('0x1b')]],'as':_0x4c2a20['as'],'attributes':_0x4c2a20[_0x7c0b('0x17')],'include':_0x4c2a20[_0x7c0b('0x19')]?_[_0x7c0b('0x1a')](_0x4c2a20[_0x7c0b('0x19')],function(_0x6695ae){return{'model':db[_0x6695ae[_0x7c0b('0x1b')]],'as':_0x6695ae['as'],'attributes':_0x6695ae[_0x7c0b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x564cc5){logger['info'](_0x7c0b('0x12'),_0x4b12b7);logger[_0x7c0b('0xa')](_0x7c0b('0x12'),_0x4b12b7,JSON[_0x7c0b('0xc')](_0x564cc5));_0x5090eb(_0x564cc5);})[_0x7c0b('0x11')](function(_0x1d3cdf){logger['error'](_0x7c0b('0x12'),_0x1d3cdf['message'],_0x4b12b7);_0x9af20c(_0x3a2548[_0x7c0b('0xd')](0x1f4,_0x1d3cdf[_0x7c0b('0xf')]));});});};exports[_0x7c0b('0x1c')]=function(_0x9bd775){var _0x12dd48=this;return new Promise(function(_0xf10e9a,_0x1eccbc){return db[_0x7c0b('0x1d')][_0x7c0b('0x1e')]({'raw':_0x9bd775[_0x7c0b('0x14')]?_0x9bd775[_0x7c0b('0x14')][_0x7c0b('0x15')]===undefined?!![]:![]:!![],'where':_0x9bd775['options']?_0x9bd775[_0x7c0b('0x14')][_0x7c0b('0x16')]||null:null,'attributes':_0x9bd775[_0x7c0b('0x14')]?_0x9bd775[_0x7c0b('0x14')]['attributes']||null:null,'include':_0x9bd775[_0x7c0b('0x14')]?_0x9bd775[_0x7c0b('0x14')]['include']?_[_0x7c0b('0x1a')](_0x9bd775[_0x7c0b('0x14')]['include'],function(_0x233bbf){return{'model':db[_0x233bbf[_0x7c0b('0x1b')]],'as':_0x233bbf['as'],'attributes':_0x233bbf['attributes'],'include':_0x233bbf[_0x7c0b('0x19')]?_[_0x7c0b('0x1a')](_0x233bbf[_0x7c0b('0x19')],function(_0x56c52f){return{'model':db[_0x56c52f[_0x7c0b('0x1b')]],'as':_0x56c52f['as'],'attributes':_0x56c52f[_0x7c0b('0x17')],'include':_0x56c52f[_0x7c0b('0x19')]?_[_0x7c0b('0x1a')](_0x56c52f[_0x7c0b('0x19')],function(_0x55d6a6){return{'model':db[_0x55d6a6[_0x7c0b('0x1b')]],'as':_0x55d6a6['as'],'attributes':_0x55d6a6[_0x7c0b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c07d6){logger[_0x7c0b('0x10')](_0x7c0b('0x1c'),_0x9bd775);logger[_0x7c0b('0xa')](_0x7c0b('0x1c'),_0x9bd775,JSON[_0x7c0b('0xc')](_0x2c07d6));_0xf10e9a(_0x2c07d6);})['catch'](function(_0x336d07){logger[_0x7c0b('0xd')](_0x7c0b('0x1c'),_0x336d07[_0x7c0b('0xf')],_0x9bd775);_0x1eccbc(_0x12dd48[_0x7c0b('0xd')](0x1f4,_0x336d07[_0x7c0b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index adf9ac4..078fd98 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 _0xe8ce=['put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xe8ce,0x18b));var _0xee8c=function(_0x502de0,_0x98868e){_0x502de0=_0x502de0-0x0;var _0x3b9539=_0xe8ce[_0x502de0];return _0x3b9539;};'use strict';var multer=require(_0xee8c('0x0'));var util=require('util');var path=require(_0xee8c('0x1'));var timeout=require(_0xee8c('0x2'));var express=require(_0xee8c('0x3'));var router=express[_0xee8c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xee8c('0x5'));var interaction=require(_0xee8c('0x6'));var config=require('../../config/environment');var controller=require(_0xee8c('0x7'));router[_0xee8c('0x8')]('/',auth[_0xee8c('0x9')](),controller[_0xee8c('0xa')]);router[_0xee8c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xee8c('0xb')]);router[_0xee8c('0x8')](_0xee8c('0xc'),auth[_0xee8c('0x9')](),controller[_0xee8c('0xd')]);router[_0xee8c('0x8')](_0xee8c('0xe'),auth[_0xee8c('0x9')](),controller['getSubjects']);router[_0xee8c('0x8')](_0xee8c('0xf'),auth[_0xee8c('0x9')](),controller[_0xee8c('0x10')]);router[_0xee8c('0x11')]('/',auth[_0xee8c('0x9')](),controller[_0xee8c('0x12')]);router[_0xee8c('0x13')](_0xee8c('0x14'),auth[_0xee8c('0x9')](),controller['update']);router['delete'](_0xee8c('0x14'),auth[_0xee8c('0x9')](),controller[_0xee8c('0x15')]);module[_0xee8c('0x16')]=router; \ No newline at end of file +var _0x3b23=['put','/:id','update','delete','destroy','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','create'];(function(_0x1cf516,_0x2d2305){var _0x188f04=function(_0x302d7a){while(--_0x302d7a){_0x1cf516['push'](_0x1cf516['shift']());}};_0x188f04(++_0x2d2305);}(_0x3b23,0x16a));var _0x33b2=function(_0x56ea64,_0x10f838){_0x56ea64=_0x56ea64-0x0;var _0x13f4fa=_0x3b23[_0x56ea64];return _0x13f4fa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x33b2('0x0'));var express=require(_0x33b2('0x1'));var router=express[_0x33b2('0x2')]();var fs_extra=require(_0x33b2('0x3'));var auth=require(_0x33b2('0x4'));var interaction=require(_0x33b2('0x5'));var config=require(_0x33b2('0x6'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x33b2('0x7')]);router[_0x33b2('0x8')]('/:id',auth[_0x33b2('0x9')](),controller[_0x33b2('0xa')]);router[_0x33b2('0x8')](_0x33b2('0xb'),auth['isAuthenticated'](),controller[_0x33b2('0xc')]);router['get'](_0x33b2('0xd'),auth[_0x33b2('0x9')](),controller[_0x33b2('0xe')]);router[_0x33b2('0x8')]('/:id/descriptions',auth[_0x33b2('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x33b2('0x9')](),controller[_0x33b2('0xf')]);router[_0x33b2('0x10')](_0x33b2('0x11'),auth[_0x33b2('0x9')](),controller[_0x33b2('0x12')]);router[_0x33b2('0x13')](_0x33b2('0x11'),auth[_0x33b2('0x9')](),controller[_0x33b2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 4260b97..72d652a 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 _0xa686=['STRING','sequelize','exports'];(function(_0x342013,_0x1c6ecf){var _0x2f4423=function(_0x1f2bb5){while(--_0x1f2bb5){_0x342013['push'](_0x342013['shift']());}};_0x2f4423(++_0x1c6ecf);}(_0xa686,0xe8));var _0x6a68=function(_0x1035ec,_0x5bb464){_0x1035ec=_0x1035ec-0x0;var _0x3d87e0=_0xa686[_0x1035ec];return _0x3d87e0;};'use strict';var Sequelize=require(_0x6a68('0x0'));module[_0x6a68('0x1')]={'name':{'type':Sequelize[_0x6a68('0x2')]},'description':{'type':Sequelize[_0x6a68('0x2')]}}; \ No newline at end of file +var _0x6641=['STRING','sequelize','exports'];(function(_0x3a3c05,_0x50368d){var _0x481b00=function(_0x3fd875){while(--_0x3fd875){_0x3a3c05['push'](_0x3a3c05['shift']());}};_0x481b00(++_0x50368d);}(_0x6641,0x163));var _0x1664=function(_0x2b4153,_0x1caadb){_0x2b4153=_0x2b4153-0x0;var _0x1e467f=_0x6641[_0x2b4153];return _0x1e467f;};'use strict';var Sequelize=require(_0x1664('0x0'));module[_0x1664('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1664('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index d092e42..93feee4 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 _0x9c34=['findAll','rows','show','params','catch','create','body','find','findOne','ServicenowField','getFields','nolimit','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','update','then','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x9c34,0x1ee));var _0x49c3=function(_0x2635be,_0x28a5eb){_0x2635be=_0x2635be-0x0;var _0x454c66=_0x9c34[_0x2635be];return _0x454c66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49c3('0x1'));var rp=require(_0x49c3('0x2'));var moment=require(_0x49c3('0x3'));var BPromise=require(_0x49c3('0x4'));var Mustache=require(_0x49c3('0x5'));var util=require(_0x49c3('0x6'));var path=require(_0x49c3('0x7'));var sox=require(_0x49c3('0x8'));var csv=require(_0x49c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x49c3('0xa'));var _=require('lodash');var squel=require(_0x49c3('0xb'));var crypto=require(_0x49c3('0xc'));var jsforce=require(_0x49c3('0xd'));var deskjs=require(_0x49c3('0xe'));var toCsv=require(_0x49c3('0x9'));var querystring=require('querystring');var Papa=require(_0x49c3('0xf'));var Redis=require('ioredis');var authService=require(_0x49c3('0x10'));var qs=require(_0x49c3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49c3('0x12'));var logger=require(_0x49c3('0x13'))(_0x49c3('0x14'));var utils=require(_0x49c3('0x15'));var config=require(_0x49c3('0x16'));var licenseUtil=require(_0x49c3('0x17'));var db=require(_0x49c3('0x18'))['db'];function respondWithStatusCode(_0x2fc6ae,_0x2ab0bb){_0x2ab0bb=_0x2ab0bb||0xcc;return function(_0x3618fa){if(_0x3618fa){return _0x2fc6ae[_0x49c3('0x19')](_0x2ab0bb);}return _0x2fc6ae[_0x49c3('0x1a')](_0x2ab0bb)[_0x49c3('0x1b')]();};}function respondWithResult(_0x26b992,_0x411e84){_0x411e84=_0x411e84||0xc8;return function(_0x40e45c){if(_0x40e45c){return _0x26b992[_0x49c3('0x1a')](_0x411e84)[_0x49c3('0x1c')](_0x40e45c);}};}function respondWithFilteredResult(_0x39711b,_0x5bbaa4){return function(_0x7766a6){if(_0x7766a6){var _0x5e1697=typeof _0x5bbaa4[_0x49c3('0x1d')]===_0x49c3('0x1e')&&typeof _0x5bbaa4['limit']===_0x49c3('0x1e');var _0x5358f3=_0x7766a6['count'];var _0x4dbafd=_0x5e1697?0x0:_0x5bbaa4[_0x49c3('0x1d')];var _0x1d806b=_0x5e1697?_0x7766a6['count']:_0x5bbaa4[_0x49c3('0x1d')]+_0x5bbaa4[_0x49c3('0x1f')];var _0x22afbe;if(_0x1d806b>=_0x5358f3){_0x1d806b=_0x5358f3;_0x22afbe=0xc8;}else{_0x22afbe=0xce;}_0x39711b['status'](_0x22afbe);return _0x39711b[_0x49c3('0x20')]('Content-Range',_0x4dbafd+'-'+_0x1d806b+'/'+_0x5358f3)[_0x49c3('0x1c')](_0x7766a6);}return null;};}function patchUpdates(_0x7747af){return function(_0x3cc033){try{jsonpatch[_0x49c3('0x21')](_0x3cc033,_0x7747af,!![]);}catch(_0x2d12a2){return BPromise[_0x49c3('0x22')](_0x2d12a2);}return _0x3cc033['save']();};}function saveUpdates(_0x250ba9,_0xe65dc){return function(_0x3a756e){if(_0x3a756e){return _0x3a756e[_0x49c3('0x23')](_0x250ba9)[_0x49c3('0x24')](function(_0x1130ec){return _0x1130ec;});}return null;};}function removeEntity(_0x44c3ed,_0x354024){return function(_0x5a99f0){if(_0x5a99f0){return _0x5a99f0['destroy']()['then'](function(){_0x44c3ed[_0x49c3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b2dc2,_0x4b93aa){return function(_0x192363){if(!_0x192363){_0x4b2dc2[_0x49c3('0x19')](0x194);}return _0x192363;};}function handleError(_0x3d5188,_0x4a5bdf){_0x4a5bdf=_0x4a5bdf||0x1f4;return function(_0x26a6df){logger[_0x49c3('0x25')](_0x26a6df[_0x49c3('0x26')]);if(_0x26a6df[_0x49c3('0x27')]){delete _0x26a6df[_0x49c3('0x27')];}_0x3d5188[_0x49c3('0x1a')](_0x4a5bdf)['send'](_0x26a6df);};}exports[_0x49c3('0x28')]=function(_0x4c6082,_0x7ddc09){var _0x187358={},_0x2b24b0={},_0x5f030a={'count':0x0,'rows':[]};var _0x274ae8=_[_0x49c3('0x29')](db[_0x49c3('0x2a')][_0x49c3('0x2b')],function(_0x52b76e){return{'name':_0x52b76e[_0x49c3('0x2c')],'type':_0x52b76e[_0x49c3('0x2d')]['key']};});_0x2b24b0[_0x49c3('0x2e')]=_[_0x49c3('0x29')](_0x274ae8,_0x49c3('0x27'));_0x2b24b0[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x4c6082[_0x49c3('0x2f')]);_0x2b24b0[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0x2b24b0[_0x49c3('0x2e')],_0x2b24b0[_0x49c3('0x2f')]);_0x187358[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x2b24b0['model'],qs[_0x49c3('0x34')](_0x4c6082['query'][_0x49c3('0x34')]));_0x187358[_0x49c3('0x33')]=_0x187358[_0x49c3('0x33')][_0x49c3('0x35')]?_0x187358[_0x49c3('0x33')]:_0x2b24b0['model'];if(!_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x36')]('nolimit')){_0x187358[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x187358[_0x49c3('0x1d')]=qs['offset'](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x1d')]);}_0x187358[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x38')]);_0x187358['where']=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x4c6082['query'],_0x2b24b0[_0x49c3('0x31')]),_0x274ae8);if(_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x187358[_0x49c3('0x3b')]=_[_0x49c3('0x3c')](_0x187358[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x274ae8,function(_0x68a7f0){if(_0x68a7f0[_0x49c3('0x2d')]!==_0x49c3('0x3d')){var _0x42fdb4={};_0x42fdb4[_0x68a7f0[_0x49c3('0x27')]]={'$like':'%'+_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x3a')]+'%'};return _0x42fdb4;}})});}_0x187358=_[_0x49c3('0x3c')]({},_0x187358,_0x4c6082[_0x49c3('0x3e')]);var _0x55bf39={'where':_0x187358[_0x49c3('0x3b')]};return db[_0x49c3('0x2a')]['count'](_0x55bf39)[_0x49c3('0x24')](function(_0x4fb7c8){_0x5f030a[_0x49c3('0x3f')]=_0x4fb7c8;if(_0x4c6082[_0x49c3('0x2f')][_0x49c3('0x40')]){_0x187358[_0x49c3('0x41')]=[{'all':!![]}];}return db[_0x49c3('0x2a')][_0x49c3('0x42')](_0x187358);})[_0x49c3('0x24')](function(_0xd5c2ba){_0x5f030a[_0x49c3('0x43')]=_0xd5c2ba;return _0x5f030a;})['then'](respondWithFilteredResult(_0x7ddc09,_0x187358))['catch'](handleError(_0x7ddc09,null));};exports[_0x49c3('0x44')]=function(_0x3ab780,_0x2f377b){var _0x962013={'raw':![],'where':{'id':_0x3ab780[_0x49c3('0x45')]['id']}},_0x40da0f={};_0x40da0f[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db['ServicenowConfiguration'][_0x49c3('0x2b')]);_0x40da0f[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x3ab780[_0x49c3('0x2f')]);_0x40da0f[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0x40da0f[_0x49c3('0x2e')],_0x40da0f[_0x49c3('0x2f')]);_0x962013[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x40da0f[_0x49c3('0x2e')],qs['fields'](_0x3ab780[_0x49c3('0x2f')]['fields']));_0x962013['attributes']=_0x962013[_0x49c3('0x33')][_0x49c3('0x35')]?_0x962013[_0x49c3('0x33')]:_0x40da0f[_0x49c3('0x2e')];if(_0x3ab780[_0x49c3('0x2f')][_0x49c3('0x40')]){_0x962013[_0x49c3('0x41')]=[{'all':!![]}];}_0x962013=_[_0x49c3('0x3c')]({},_0x962013,_0x3ab780['options']);return db[_0x49c3('0x2a')]['find'](_0x962013)[_0x49c3('0x24')](handleEntityNotFound(_0x2f377b,null))[_0x49c3('0x24')](respondWithResult(_0x2f377b,null))[_0x49c3('0x46')](handleError(_0x2f377b,null));};exports[_0x49c3('0x47')]=function(_0x1e3f55,_0x29a691){return db[_0x49c3('0x2a')][_0x49c3('0x47')](_0x1e3f55['body'],{})[_0x49c3('0x24')](respondWithResult(_0x29a691,0xc9))[_0x49c3('0x46')](handleError(_0x29a691,null));};exports[_0x49c3('0x23')]=function(_0x5bf6d0,_0xae2331){if(_0x5bf6d0[_0x49c3('0x48')]['id']){delete _0x5bf6d0[_0x49c3('0x48')]['id'];}return db['ServicenowConfiguration'][_0x49c3('0x49')]({'where':{'id':_0x5bf6d0[_0x49c3('0x45')]['id']}})[_0x49c3('0x24')](handleEntityNotFound(_0xae2331,null))[_0x49c3('0x24')](saveUpdates(_0x5bf6d0[_0x49c3('0x48')],null))[_0x49c3('0x24')](respondWithResult(_0xae2331,null))[_0x49c3('0x46')](handleError(_0xae2331,null));};exports['destroy']=function(_0x3b77c3,_0x5cb9dd){return db[_0x49c3('0x2a')][_0x49c3('0x49')]({'where':{'id':_0x3b77c3['params']['id']}})['then'](handleEntityNotFound(_0x5cb9dd,null))[_0x49c3('0x24')](removeEntity(_0x5cb9dd,null))[_0x49c3('0x46')](handleError(_0x5cb9dd,null));};exports['getFields']=function(_0x2c8668,_0x222626,_0x3cb14c){var _0x9d3ad7={};var _0x4c1899={};var _0x5699f5;var _0x1502b4;return db[_0x49c3('0x2a')][_0x49c3('0x4a')]({'where':{'id':_0x2c8668[_0x49c3('0x45')]['id']}})[_0x49c3('0x24')](handleEntityNotFound(_0x222626,null))[_0x49c3('0x24')](function(_0x3de151){if(_0x3de151){_0x5699f5=_0x3de151;_0x4c1899[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db[_0x49c3('0x4b')]['rawAttributes']);_0x4c1899[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x2c8668[_0x49c3('0x2f')]);_0x4c1899['filters']=_[_0x49c3('0x32')](_0x4c1899[_0x49c3('0x2e')],_0x4c1899[_0x49c3('0x2f')]);_0x9d3ad7[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0x4c1899['model'],qs[_0x49c3('0x34')](_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x34')]));_0x9d3ad7['attributes']=_0x9d3ad7[_0x49c3('0x33')][_0x49c3('0x35')]?_0x9d3ad7[_0x49c3('0x33')]:_0x4c1899[_0x49c3('0x2e')];_0x9d3ad7[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x2c8668[_0x49c3('0x2f')]['sort']);_0x9d3ad7[_0x49c3('0x3b')]=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x2c8668[_0x49c3('0x2f')],_0x4c1899[_0x49c3('0x31')]));if(_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x9d3ad7['where']=_[_0x49c3('0x3c')](_0x9d3ad7[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x9d3ad7['attributes'],function(_0x7764f6){var _0xed8b5d={};_0xed8b5d[_0x7764f6]={'$like':'%'+_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x3a')]+'%'};return _0xed8b5d;})});}_0x9d3ad7=_[_0x49c3('0x3c')]({},_0x9d3ad7,_0x2c8668[_0x49c3('0x3e')]);return _0x5699f5[_0x49c3('0x4c')](_0x9d3ad7);}})[_0x49c3('0x24')](function(_0x4566b1){if(_0x4566b1){_0x1502b4=_0x4566b1[_0x49c3('0x35')];if(!_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x36')](_0x49c3('0x4d'))){_0x9d3ad7[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x2c8668[_0x49c3('0x2f')]['limit']);_0x9d3ad7[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x2c8668[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x5699f5['getFields'](_0x9d3ad7);}})['then'](function(_0x3d6e50){if(_0x3d6e50){return _0x3d6e50?{'count':_0x1502b4,'rows':_0x3d6e50}:null;}})[_0x49c3('0x24')](respondWithResult(_0x222626,null))[_0x49c3('0x46')](handleError(_0x222626,null));};exports[_0x49c3('0x4e')]=function(_0x48310c,_0x4bac78,_0x967419){var _0x2a3043={};var _0xb46861={};var _0x512329;var _0x104a58;return db['ServicenowConfiguration'][_0x49c3('0x4a')]({'where':{'id':_0x48310c[_0x49c3('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bac78,null))[_0x49c3('0x24')](function(_0x19db33){if(_0x19db33){_0x512329=_0x19db33;_0xb46861[_0x49c3('0x2e')]=_['keys'](db[_0x49c3('0x4b')][_0x49c3('0x2b')]);_0xb46861['query']=_[_0x49c3('0x30')](_0x48310c[_0x49c3('0x2f')]);_0xb46861[_0x49c3('0x31')]=_[_0x49c3('0x32')](_0xb46861[_0x49c3('0x2e')],_0xb46861[_0x49c3('0x2f')]);_0x2a3043[_0x49c3('0x33')]=_[_0x49c3('0x32')](_0xb46861[_0x49c3('0x2e')],qs['fields'](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x34')]));_0x2a3043[_0x49c3('0x33')]=_0x2a3043[_0x49c3('0x33')][_0x49c3('0x35')]?_0x2a3043['attributes']:_0xb46861['model'];_0x2a3043[_0x49c3('0x37')]=qs[_0x49c3('0x38')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x38')]);_0x2a3043[_0x49c3('0x3b')]=qs[_0x49c3('0x31')](_[_0x49c3('0x39')](_0x48310c[_0x49c3('0x2f')],_0xb46861[_0x49c3('0x31')]));if(_0x48310c['query']['filter']){_0x2a3043[_0x49c3('0x3b')]=_[_0x49c3('0x3c')](_0x2a3043[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x2a3043[_0x49c3('0x33')],function(_0x5ad009){var _0x27c9e9={};_0x27c9e9[_0x5ad009]={'$like':'%'+_0x48310c['query'][_0x49c3('0x3a')]+'%'};return _0x27c9e9;})});}_0x2a3043=_[_0x49c3('0x3c')]({},_0x2a3043,_0x48310c[_0x49c3('0x3e')]);return _0x512329[_0x49c3('0x4e')](_0x2a3043);}})[_0x49c3('0x24')](function(_0xa6dad3){if(_0xa6dad3){_0x104a58=_0xa6dad3[_0x49c3('0x35')];if(!_0x48310c['query']['hasOwnProperty'](_0x49c3('0x4d'))){_0x2a3043[_0x49c3('0x1f')]=qs[_0x49c3('0x1f')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x2a3043[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x48310c[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x512329[_0x49c3('0x4e')](_0x2a3043);}})['then'](function(_0xb7b449){if(_0xb7b449){return _0xb7b449?{'count':_0x104a58,'rows':_0xb7b449}:null;}})[_0x49c3('0x24')](respondWithResult(_0x4bac78,null))['catch'](handleError(_0x4bac78,null));};exports[_0x49c3('0x4f')]=function(_0x3dd068,_0x4454fa,_0x3f4624){var _0x4198d4={};var _0x5cec92={};var _0x1c3f34;var _0x47872f;return db[_0x49c3('0x2a')][_0x49c3('0x4a')]({'where':{'id':_0x3dd068['params']['id']}})['then'](handleEntityNotFound(_0x4454fa,null))['then'](function(_0x42c334){if(_0x42c334){_0x1c3f34=_0x42c334;_0x5cec92[_0x49c3('0x2e')]=_[_0x49c3('0x30')](db[_0x49c3('0x4b')][_0x49c3('0x2b')]);_0x5cec92[_0x49c3('0x2f')]=_[_0x49c3('0x30')](_0x3dd068[_0x49c3('0x2f')]);_0x5cec92['filters']=_['intersection'](_0x5cec92['model'],_0x5cec92[_0x49c3('0x2f')]);_0x4198d4['attributes']=_[_0x49c3('0x32')](_0x5cec92['model'],qs[_0x49c3('0x34')](_0x3dd068['query'][_0x49c3('0x34')]));_0x4198d4['attributes']=_0x4198d4['attributes'][_0x49c3('0x35')]?_0x4198d4[_0x49c3('0x33')]:_0x5cec92[_0x49c3('0x2e')];_0x4198d4['order']=qs['sort'](_0x3dd068[_0x49c3('0x2f')]['sort']);_0x4198d4['where']=qs[_0x49c3('0x31')](_['pick'](_0x3dd068[_0x49c3('0x2f')],_0x5cec92[_0x49c3('0x31')]));if(_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x3a')]){_0x4198d4['where']=_[_0x49c3('0x3c')](_0x4198d4[_0x49c3('0x3b')],{'$or':_[_0x49c3('0x29')](_0x4198d4[_0x49c3('0x33')],function(_0x5a6cb0){var _0x43a049={};_0x43a049[_0x5a6cb0]={'$like':'%'+_0x3dd068[_0x49c3('0x2f')]['filter']+'%'};return _0x43a049;})});}_0x4198d4=_[_0x49c3('0x3c')]({},_0x4198d4,_0x3dd068[_0x49c3('0x3e')]);return _0x1c3f34[_0x49c3('0x4f')](_0x4198d4);}})[_0x49c3('0x24')](function(_0x572a1e){if(_0x572a1e){_0x47872f=_0x572a1e[_0x49c3('0x35')];if(!_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x36')]('nolimit')){_0x4198d4[_0x49c3('0x1f')]=qs['limit'](_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x1f')]);_0x4198d4[_0x49c3('0x1d')]=qs[_0x49c3('0x1d')](_0x3dd068[_0x49c3('0x2f')][_0x49c3('0x1d')]);}return _0x1c3f34[_0x49c3('0x4f')](_0x4198d4);}})['then'](function(_0x40fa07){if(_0x40fa07){return _0x40fa07?{'count':_0x47872f,'rows':_0x40fa07}:null;}})[_0x49c3('0x24')](respondWithResult(_0x4454fa,null))[_0x49c3('0x46')](handleError(_0x4454fa,null));}; \ No newline at end of file +var _0xb1ce=['getFields','findOne','ServicenowField','length','nolimit','getSubjects','rawAttributes','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','find','create','body'];(function(_0x5d01e3,_0x580578){var _0x4671b9=function(_0x233638){while(--_0x233638){_0x5d01e3['push'](_0x5d01e3['shift']());}};_0x4671b9(++_0x580578);}(_0xb1ce,0xf8));var _0xeb1c=function(_0x11d570,_0x59fa8f){_0x11d570=_0x11d570-0x0;var _0x14f446=_0xb1ce[_0x11d570];return _0x14f446;};'use strict';var emlformat=require(_0xeb1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb1c('0x1'));var jsonpatch=require(_0xeb1c('0x2'));var rp=require(_0xeb1c('0x3'));var moment=require(_0xeb1c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb1c('0x5'));var path=require(_0xeb1c('0x6'));var sox=require(_0xeb1c('0x7'));var csv=require(_0xeb1c('0x8'));var ejs=require(_0xeb1c('0x9'));var fs=require('fs');var fs_extra=require(_0xeb1c('0xa'));var _=require(_0xeb1c('0xb'));var squel=require(_0xeb1c('0xc'));var crypto=require(_0xeb1c('0xd'));var jsforce=require(_0xeb1c('0xe'));var deskjs=require(_0xeb1c('0xf'));var toCsv=require(_0xeb1c('0x8'));var querystring=require(_0xeb1c('0x10'));var Papa=require(_0xeb1c('0x11'));var Redis=require(_0xeb1c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeb1c('0x13'));var hardwareService=require(_0xeb1c('0x14'));var logger=require(_0xeb1c('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb1c('0x16'));var db=require(_0xeb1c('0x17'))['db'];function respondWithStatusCode(_0x5b04e2,_0x2ad513){_0x2ad513=_0x2ad513||0xcc;return function(_0x8f786e){if(_0x8f786e){return _0x5b04e2[_0xeb1c('0x18')](_0x2ad513);}return _0x5b04e2[_0xeb1c('0x19')](_0x2ad513)[_0xeb1c('0x1a')]();};}function respondWithResult(_0x7787c5,_0x1d7c8a){_0x1d7c8a=_0x1d7c8a||0xc8;return function(_0xb9c093){if(_0xb9c093){return _0x7787c5[_0xeb1c('0x19')](_0x1d7c8a)[_0xeb1c('0x1b')](_0xb9c093);}};}function respondWithFilteredResult(_0x109276,_0x2ae9cd){return function(_0x5d8831){if(_0x5d8831){var _0x2c9b2f=typeof _0x2ae9cd[_0xeb1c('0x1c')]===_0xeb1c('0x1d')&&typeof _0x2ae9cd[_0xeb1c('0x1e')]===_0xeb1c('0x1d');var _0x579256=_0x5d8831[_0xeb1c('0x1f')];var _0x38812a=_0x2c9b2f?0x0:_0x2ae9cd['offset'];var _0x1d5a15=_0x2c9b2f?_0x5d8831[_0xeb1c('0x1f')]:_0x2ae9cd[_0xeb1c('0x1c')]+_0x2ae9cd[_0xeb1c('0x1e')];var _0x279957;if(_0x1d5a15>=_0x579256){_0x1d5a15=_0x579256;_0x279957=0xc8;}else{_0x279957=0xce;}_0x109276[_0xeb1c('0x19')](_0x279957);return _0x109276[_0xeb1c('0x20')](_0xeb1c('0x21'),_0x38812a+'-'+_0x1d5a15+'/'+_0x579256)[_0xeb1c('0x1b')](_0x5d8831);}return null;};}function patchUpdates(_0x5a3419){return function(_0x37bb2e){try{jsonpatch[_0xeb1c('0x22')](_0x37bb2e,_0x5a3419,!![]);}catch(_0x48aa96){return BPromise['reject'](_0x48aa96);}return _0x37bb2e['save']();};}function saveUpdates(_0x31ac90,_0x5c15c4){return function(_0x495798){if(_0x495798){return _0x495798[_0xeb1c('0x23')](_0x31ac90)['then'](function(_0x370e89){return _0x370e89;});}return null;};}function removeEntity(_0x155707,_0x2d0aa8){return function(_0x5f04a2){if(_0x5f04a2){return _0x5f04a2[_0xeb1c('0x24')]()[_0xeb1c('0x25')](function(){_0x155707[_0xeb1c('0x19')](0xcc)[_0xeb1c('0x1a')]();});}};}function handleEntityNotFound(_0xfe46c6,_0x177236){return function(_0x60bb03){if(!_0x60bb03){_0xfe46c6['sendStatus'](0x194);}return _0x60bb03;};}function handleError(_0x1aea6e,_0x2acc2d){_0x2acc2d=_0x2acc2d||0x1f4;return function(_0x231168){logger[_0xeb1c('0x26')](_0x231168[_0xeb1c('0x27')]);if(_0x231168[_0xeb1c('0x28')]){delete _0x231168[_0xeb1c('0x28')];}_0x1aea6e[_0xeb1c('0x19')](_0x2acc2d)[_0xeb1c('0x29')](_0x231168);};}exports[_0xeb1c('0x2a')]=function(_0x5b7880,_0x483614){var _0x41d5c4={},_0x1e1be7={},_0x3634dd={'count':0x0,'rows':[]};var _0xe972a9=_[_0xeb1c('0x2b')](db[_0xeb1c('0x2c')]['rawAttributes'],function(_0xf09383){return{'name':_0xf09383[_0xeb1c('0x2d')],'type':_0xf09383[_0xeb1c('0x2e')][_0xeb1c('0x2f')]};});_0x1e1be7[_0xeb1c('0x30')]=_[_0xeb1c('0x2b')](_0xe972a9,_0xeb1c('0x28'));_0x1e1be7[_0xeb1c('0x31')]=_[_0xeb1c('0x32')](_0x5b7880[_0xeb1c('0x31')]);_0x1e1be7[_0xeb1c('0x33')]=_['intersection'](_0x1e1be7[_0xeb1c('0x30')],_0x1e1be7['query']);_0x41d5c4[_0xeb1c('0x34')]=_['intersection'](_0x1e1be7[_0xeb1c('0x30')],qs[_0xeb1c('0x35')](_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x35')]));_0x41d5c4[_0xeb1c('0x34')]=_0x41d5c4[_0xeb1c('0x34')]['length']?_0x41d5c4[_0xeb1c('0x34')]:_0x1e1be7[_0xeb1c('0x30')];if(!_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x36')]('nolimit')){_0x41d5c4[_0xeb1c('0x1e')]=qs[_0xeb1c('0x1e')](_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x1e')]);_0x41d5c4[_0xeb1c('0x1c')]=qs[_0xeb1c('0x1c')](_0x5b7880['query'][_0xeb1c('0x1c')]);}_0x41d5c4[_0xeb1c('0x37')]=qs[_0xeb1c('0x38')](_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x38')]);_0x41d5c4[_0xeb1c('0x39')]=qs[_0xeb1c('0x33')](_[_0xeb1c('0x3a')](_0x5b7880[_0xeb1c('0x31')],_0x1e1be7['filters']),_0xe972a9);if(_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x3b')]){_0x41d5c4['where']=_[_0xeb1c('0x3c')](_0x41d5c4[_0xeb1c('0x39')],{'$or':_[_0xeb1c('0x2b')](_0xe972a9,function(_0x5a3988){if(_0x5a3988[_0xeb1c('0x2e')]!==_0xeb1c('0x3d')){var _0x56201b={};_0x56201b[_0x5a3988['name']]={'$like':'%'+_0x5b7880['query'][_0xeb1c('0x3b')]+'%'};return _0x56201b;}})});}_0x41d5c4=_[_0xeb1c('0x3c')]({},_0x41d5c4,_0x5b7880[_0xeb1c('0x3e')]);var _0x155f90={'where':_0x41d5c4[_0xeb1c('0x39')]};return db[_0xeb1c('0x2c')][_0xeb1c('0x1f')](_0x155f90)[_0xeb1c('0x25')](function(_0x6a36c1){_0x3634dd[_0xeb1c('0x1f')]=_0x6a36c1;if(_0x5b7880[_0xeb1c('0x31')][_0xeb1c('0x3f')]){_0x41d5c4['include']=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x41d5c4);})[_0xeb1c('0x25')](function(_0xdbbc85){_0x3634dd[_0xeb1c('0x40')]=_0xdbbc85;return _0x3634dd;})[_0xeb1c('0x25')](respondWithFilteredResult(_0x483614,_0x41d5c4))[_0xeb1c('0x41')](handleError(_0x483614,null));};exports[_0xeb1c('0x42')]=function(_0x290c8d,_0x4474b4){var _0x451828={'raw':![],'where':{'id':_0x290c8d[_0xeb1c('0x43')]['id']}},_0x1178d1={};_0x1178d1[_0xeb1c('0x30')]=_[_0xeb1c('0x32')](db[_0xeb1c('0x2c')]['rawAttributes']);_0x1178d1['query']=_[_0xeb1c('0x32')](_0x290c8d['query']);_0x1178d1[_0xeb1c('0x33')]=_[_0xeb1c('0x44')](_0x1178d1[_0xeb1c('0x30')],_0x1178d1[_0xeb1c('0x31')]);_0x451828[_0xeb1c('0x34')]=_[_0xeb1c('0x44')](_0x1178d1[_0xeb1c('0x30')],qs['fields'](_0x290c8d[_0xeb1c('0x31')][_0xeb1c('0x35')]));_0x451828[_0xeb1c('0x34')]=_0x451828[_0xeb1c('0x34')]['length']?_0x451828[_0xeb1c('0x34')]:_0x1178d1['model'];if(_0x290c8d[_0xeb1c('0x31')]['includeAll']){_0x451828['include']=[{'all':!![]}];}_0x451828=_['merge']({},_0x451828,_0x290c8d[_0xeb1c('0x3e')]);return db[_0xeb1c('0x2c')][_0xeb1c('0x45')](_0x451828)[_0xeb1c('0x25')](handleEntityNotFound(_0x4474b4,null))[_0xeb1c('0x25')](respondWithResult(_0x4474b4,null))[_0xeb1c('0x41')](handleError(_0x4474b4,null));};exports[_0xeb1c('0x46')]=function(_0x7a4ced,_0x2c8cad){return db['ServicenowConfiguration'][_0xeb1c('0x46')](_0x7a4ced[_0xeb1c('0x47')],{})[_0xeb1c('0x25')](respondWithResult(_0x2c8cad,0xc9))[_0xeb1c('0x41')](handleError(_0x2c8cad,null));};exports[_0xeb1c('0x23')]=function(_0x95e417,_0x3afebe){if(_0x95e417[_0xeb1c('0x47')]['id']){delete _0x95e417[_0xeb1c('0x47')]['id'];}return db['ServicenowConfiguration'][_0xeb1c('0x45')]({'where':{'id':_0x95e417[_0xeb1c('0x43')]['id']}})[_0xeb1c('0x25')](handleEntityNotFound(_0x3afebe,null))[_0xeb1c('0x25')](saveUpdates(_0x95e417['body'],null))['then'](respondWithResult(_0x3afebe,null))[_0xeb1c('0x41')](handleError(_0x3afebe,null));};exports[_0xeb1c('0x24')]=function(_0x49cba2,_0x5068b7){return db[_0xeb1c('0x2c')]['find']({'where':{'id':_0x49cba2[_0xeb1c('0x43')]['id']}})[_0xeb1c('0x25')](handleEntityNotFound(_0x5068b7,null))['then'](removeEntity(_0x5068b7,null))[_0xeb1c('0x41')](handleError(_0x5068b7,null));};exports[_0xeb1c('0x48')]=function(_0x59b42a,_0x50d021,_0x3d02c6){var _0x2a1387={};var _0x4dbd82={};var _0x30fd99;var _0x4344f8;return db[_0xeb1c('0x2c')][_0xeb1c('0x49')]({'where':{'id':_0x59b42a[_0xeb1c('0x43')]['id']}})[_0xeb1c('0x25')](handleEntityNotFound(_0x50d021,null))[_0xeb1c('0x25')](function(_0x331b80){if(_0x331b80){_0x30fd99=_0x331b80;_0x4dbd82['model']=_[_0xeb1c('0x32')](db[_0xeb1c('0x4a')]['rawAttributes']);_0x4dbd82[_0xeb1c('0x31')]=_['keys'](_0x59b42a['query']);_0x4dbd82[_0xeb1c('0x33')]=_['intersection'](_0x4dbd82[_0xeb1c('0x30')],_0x4dbd82[_0xeb1c('0x31')]);_0x2a1387[_0xeb1c('0x34')]=_[_0xeb1c('0x44')](_0x4dbd82['model'],qs[_0xeb1c('0x35')](_0x59b42a['query'][_0xeb1c('0x35')]));_0x2a1387['attributes']=_0x2a1387[_0xeb1c('0x34')]['length']?_0x2a1387[_0xeb1c('0x34')]:_0x4dbd82[_0xeb1c('0x30')];_0x2a1387['order']=qs[_0xeb1c('0x38')](_0x59b42a['query'][_0xeb1c('0x38')]);_0x2a1387[_0xeb1c('0x39')]=qs['filters'](_[_0xeb1c('0x3a')](_0x59b42a['query'],_0x4dbd82[_0xeb1c('0x33')]));if(_0x59b42a[_0xeb1c('0x31')]['filter']){_0x2a1387['where']=_[_0xeb1c('0x3c')](_0x2a1387[_0xeb1c('0x39')],{'$or':_[_0xeb1c('0x2b')](_0x2a1387[_0xeb1c('0x34')],function(_0xe25fff){var _0x5efd33={};_0x5efd33[_0xe25fff]={'$like':'%'+_0x59b42a[_0xeb1c('0x31')][_0xeb1c('0x3b')]+'%'};return _0x5efd33;})});}_0x2a1387=_[_0xeb1c('0x3c')]({},_0x2a1387,_0x59b42a[_0xeb1c('0x3e')]);return _0x30fd99[_0xeb1c('0x48')](_0x2a1387);}})[_0xeb1c('0x25')](function(_0xd393b6){if(_0xd393b6){_0x4344f8=_0xd393b6[_0xeb1c('0x4b')];if(!_0x59b42a[_0xeb1c('0x31')][_0xeb1c('0x36')](_0xeb1c('0x4c'))){_0x2a1387['limit']=qs[_0xeb1c('0x1e')](_0x59b42a[_0xeb1c('0x31')]['limit']);_0x2a1387[_0xeb1c('0x1c')]=qs[_0xeb1c('0x1c')](_0x59b42a[_0xeb1c('0x31')]['offset']);}return _0x30fd99[_0xeb1c('0x48')](_0x2a1387);}})[_0xeb1c('0x25')](function(_0x4339f5){if(_0x4339f5){return _0x4339f5?{'count':_0x4344f8,'rows':_0x4339f5}:null;}})[_0xeb1c('0x25')](respondWithResult(_0x50d021,null))[_0xeb1c('0x41')](handleError(_0x50d021,null));};exports[_0xeb1c('0x4d')]=function(_0x58b589,_0x1d97a2,_0x1d7787){var _0x43640e={};var _0x5782fd={};var _0x3c2ead;var _0x1f8b3d;return db[_0xeb1c('0x2c')]['findOne']({'where':{'id':_0x58b589[_0xeb1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d97a2,null))[_0xeb1c('0x25')](function(_0x3ab2e1){if(_0x3ab2e1){_0x3c2ead=_0x3ab2e1;_0x5782fd[_0xeb1c('0x30')]=_[_0xeb1c('0x32')](db['ServicenowField'][_0xeb1c('0x4e')]);_0x5782fd[_0xeb1c('0x31')]=_[_0xeb1c('0x32')](_0x58b589[_0xeb1c('0x31')]);_0x5782fd['filters']=_[_0xeb1c('0x44')](_0x5782fd['model'],_0x5782fd['query']);_0x43640e[_0xeb1c('0x34')]=_['intersection'](_0x5782fd[_0xeb1c('0x30')],qs['fields'](_0x58b589[_0xeb1c('0x31')][_0xeb1c('0x35')]));_0x43640e[_0xeb1c('0x34')]=_0x43640e['attributes'][_0xeb1c('0x4b')]?_0x43640e[_0xeb1c('0x34')]:_0x5782fd[_0xeb1c('0x30')];_0x43640e[_0xeb1c('0x37')]=qs['sort'](_0x58b589['query'][_0xeb1c('0x38')]);_0x43640e[_0xeb1c('0x39')]=qs[_0xeb1c('0x33')](_[_0xeb1c('0x3a')](_0x58b589['query'],_0x5782fd[_0xeb1c('0x33')]));if(_0x58b589[_0xeb1c('0x31')][_0xeb1c('0x3b')]){_0x43640e[_0xeb1c('0x39')]=_[_0xeb1c('0x3c')](_0x43640e['where'],{'$or':_['map'](_0x43640e[_0xeb1c('0x34')],function(_0x5a1995){var _0x33442f={};_0x33442f[_0x5a1995]={'$like':'%'+_0x58b589[_0xeb1c('0x31')][_0xeb1c('0x3b')]+'%'};return _0x33442f;})});}_0x43640e=_[_0xeb1c('0x3c')]({},_0x43640e,_0x58b589[_0xeb1c('0x3e')]);return _0x3c2ead['getSubjects'](_0x43640e);}})[_0xeb1c('0x25')](function(_0x1ac758){if(_0x1ac758){_0x1f8b3d=_0x1ac758['length'];if(!_0x58b589[_0xeb1c('0x31')][_0xeb1c('0x36')]('nolimit')){_0x43640e[_0xeb1c('0x1e')]=qs[_0xeb1c('0x1e')](_0x58b589['query'][_0xeb1c('0x1e')]);_0x43640e[_0xeb1c('0x1c')]=qs['offset'](_0x58b589['query']['offset']);}return _0x3c2ead[_0xeb1c('0x4d')](_0x43640e);}})[_0xeb1c('0x25')](function(_0x24e3d8){if(_0x24e3d8){return _0x24e3d8?{'count':_0x1f8b3d,'rows':_0x24e3d8}:null;}})['then'](respondWithResult(_0x1d97a2,null))[_0xeb1c('0x41')](handleError(_0x1d97a2,null));};exports[_0xeb1c('0x4f')]=function(_0xfd2965,_0x32ef13,_0x444a27){var _0x5cf073={};var _0x48b7d4={};var _0x23c806;var _0x316054;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xfd2965[_0xeb1c('0x43')]['id']}})[_0xeb1c('0x25')](handleEntityNotFound(_0x32ef13,null))[_0xeb1c('0x25')](function(_0x4eebe1){if(_0x4eebe1){_0x23c806=_0x4eebe1;_0x48b7d4[_0xeb1c('0x30')]=_[_0xeb1c('0x32')](db[_0xeb1c('0x4a')][_0xeb1c('0x4e')]);_0x48b7d4['query']=_['keys'](_0xfd2965[_0xeb1c('0x31')]);_0x48b7d4[_0xeb1c('0x33')]=_[_0xeb1c('0x44')](_0x48b7d4[_0xeb1c('0x30')],_0x48b7d4[_0xeb1c('0x31')]);_0x5cf073[_0xeb1c('0x34')]=_[_0xeb1c('0x44')](_0x48b7d4[_0xeb1c('0x30')],qs[_0xeb1c('0x35')](_0xfd2965[_0xeb1c('0x31')][_0xeb1c('0x35')]));_0x5cf073[_0xeb1c('0x34')]=_0x5cf073[_0xeb1c('0x34')][_0xeb1c('0x4b')]?_0x5cf073['attributes']:_0x48b7d4[_0xeb1c('0x30')];_0x5cf073['order']=qs['sort'](_0xfd2965[_0xeb1c('0x31')][_0xeb1c('0x38')]);_0x5cf073[_0xeb1c('0x39')]=qs[_0xeb1c('0x33')](_[_0xeb1c('0x3a')](_0xfd2965[_0xeb1c('0x31')],_0x48b7d4[_0xeb1c('0x33')]));if(_0xfd2965[_0xeb1c('0x31')]['filter']){_0x5cf073['where']=_['merge'](_0x5cf073[_0xeb1c('0x39')],{'$or':_[_0xeb1c('0x2b')](_0x5cf073[_0xeb1c('0x34')],function(_0x49a5fb){var _0x174d86={};_0x174d86[_0x49a5fb]={'$like':'%'+_0xfd2965[_0xeb1c('0x31')][_0xeb1c('0x3b')]+'%'};return _0x174d86;})});}_0x5cf073=_[_0xeb1c('0x3c')]({},_0x5cf073,_0xfd2965[_0xeb1c('0x3e')]);return _0x23c806[_0xeb1c('0x4f')](_0x5cf073);}})[_0xeb1c('0x25')](function(_0x18a0e0){if(_0x18a0e0){_0x316054=_0x18a0e0['length'];if(!_0xfd2965['query'][_0xeb1c('0x36')](_0xeb1c('0x4c'))){_0x5cf073[_0xeb1c('0x1e')]=qs[_0xeb1c('0x1e')](_0xfd2965['query'][_0xeb1c('0x1e')]);_0x5cf073[_0xeb1c('0x1c')]=qs['offset'](_0xfd2965[_0xeb1c('0x31')][_0xeb1c('0x1c')]);}return _0x23c806['getDescriptions'](_0x5cf073);}})['then'](function(_0x4b1e31){if(_0x4b1e31){return _0x4b1e31?{'count':_0x316054,'rows':_0x4b1e31}:null;}})[_0xeb1c('0x25')](respondWithResult(_0x32ef13,null))[_0xeb1c('0x41')](handleError(_0x32ef13,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 31780d7..ad66bf0 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 _0x34bd=['../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x34bd,0x1d2));var _0xd34b=function(_0x3f7982,_0x24c737){_0x3f7982=_0x3f7982-0x0;var _0x4e6a0d=_0x34bd[_0x3f7982];return _0x4e6a0d;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd34b('0x1'));var moment=require(_0xd34b('0x2'));var BPromise=require(_0xd34b('0x3'));var rp=require(_0xd34b('0x4'));var fs=require('fs');var path=require(_0xd34b('0x5'));var rimraf=require(_0xd34b('0x6'));var config=require(_0xd34b('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xd34b('0x8')]=function(_0x5d161e,_0x4e6e94){return _0x5d161e['define'](_0xd34b('0x9'),attributes,{'tableName':_0xd34b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f72=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x3f72,0xaf));var _0x23f7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23f7('0x0'));var util=require(_0x23f7('0x1'));var logger=require(_0x23f7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x23f7('0x3'));var rp=require(_0x23f7('0x4'));var fs=require('fs');var path=require(_0x23f7('0x5'));var rimraf=require(_0x23f7('0x6'));var config=require(_0x23f7('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x23f7('0x8')]=function(_0x4d8274,_0xac4499){return _0x4d8274['define'](_0x23f7('0x9'),attributes,{'tableName':_0x23f7('0xa'),'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 21d5d6c..63627d8 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 _0x89d6=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x48b724,_0x5a8e26){var _0x4d38b3=function(_0xef820f){while(--_0xef820f){_0x48b724['push'](_0x48b724['shift']());}};_0x4d38b3(++_0x5a8e26);}(_0x89d6,0x119));var _0x689d=function(_0x1791d9,_0x438e56){_0x1791d9=_0x1791d9-0x0;var _0x1905d0=_0x89d6[_0x1791d9];return _0x1905d0;};'use strict';var _=require(_0x689d('0x0'));var util=require(_0x689d('0x1'));var moment=require(_0x689d('0x2'));var BPromise=require(_0x689d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x689d('0x4'));var db=require(_0x689d('0x5'))['db'];var utils=require(_0x689d('0x6'));var logger=require('../../config/logger')(_0x689d('0x7'));var config=require(_0x689d('0x8'));var jayson=require(_0x689d('0x9'));var client=jayson[_0x689d('0xa')][_0x689d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x255067,_0x5beecb,_0x1ff5b5){return new BPromise(function(_0x25bda4,_0xaa8c77){return client['request'](_0x255067,_0x1ff5b5)['then'](function(_0x34d080){logger[_0x689d('0xc')](_0x689d('0xd'),_0x5beecb,_0x689d('0xe'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5beecb,_0x689d('0xe'),JSON[_0x689d('0xf')](_0x34d080));if(_0x34d080[_0x689d('0x10')]){if(_0x34d080[_0x689d('0x10')]['code']===0x1f4){logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x34d080['error'][_0x689d('0x11')]);return _0xaa8c77(_0x34d080[_0x689d('0x10')][_0x689d('0x11')]);}logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x34d080['error'][_0x689d('0x11')]);return _0x25bda4(_0x34d080[_0x689d('0x10')]['message']);}else{logger['info'](_0x689d('0xd'),_0x5beecb,_0x689d('0xe'));_0x25bda4(_0x34d080[_0x689d('0x12')][_0x689d('0x11')]);}})[_0x689d('0x13')](function(_0x561301){logger[_0x689d('0x10')](_0x689d('0xd'),_0x5beecb,_0x561301);_0xaa8c77(_0x561301);});});} \ No newline at end of file +var _0xfbc7=['rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0xfbc7,0x134));var _0x7fbc=function(_0x377090,_0x47d4e5){_0x377090=_0x377090-0x0;var _0x57d752=_0xfbc7[_0x377090];return _0x57d752;};'use strict';var _=require('lodash');var util=require(_0x7fbc('0x0'));var moment=require(_0x7fbc('0x1'));var BPromise=require('bluebird');var rs=require(_0x7fbc('0x2'));var fs=require('fs');var Redis=require(_0x7fbc('0x3'));var db=require(_0x7fbc('0x4'))['db'];var utils=require(_0x7fbc('0x5'));var logger=require(_0x7fbc('0x6'))(_0x7fbc('0x7'));var config=require('../../config/environment');var jayson=require(_0x7fbc('0x8'));var client=jayson[_0x7fbc('0x9')][_0x7fbc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ae468,_0x313e54,_0x4dbd91){return new BPromise(function(_0x452e31,_0x8ba0ad){return client[_0x7fbc('0xb')](_0x3ae468,_0x4dbd91)['then'](function(_0x2c458f){logger[_0x7fbc('0xc')](_0x7fbc('0xd'),_0x313e54,'request\x20sent');logger['debug'](_0x7fbc('0xe'),_0x313e54,'request\x20sent',JSON[_0x7fbc('0xf')](_0x2c458f));if(_0x2c458f['error']){if(_0x2c458f[_0x7fbc('0x10')]['code']===0x1f4){logger[_0x7fbc('0x10')](_0x7fbc('0xd'),_0x313e54,_0x2c458f['error'][_0x7fbc('0x11')]);return _0x8ba0ad(_0x2c458f[_0x7fbc('0x10')]['message']);}logger[_0x7fbc('0x10')](_0x7fbc('0xd'),_0x313e54,_0x2c458f[_0x7fbc('0x10')][_0x7fbc('0x11')]);return _0x452e31(_0x2c458f[_0x7fbc('0x10')][_0x7fbc('0x11')]);}else{logger['info'](_0x7fbc('0xd'),_0x313e54,_0x7fbc('0x12'));_0x452e31(_0x2c458f[_0x7fbc('0x13')][_0x7fbc('0x11')]);}})[_0x7fbc('0x14')](function(_0x4433cc){logger['error'](_0x7fbc('0xd'),_0x313e54,_0x4433cc);_0x8ba0ad(_0x4433cc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index db4b8b4..5fac7a5 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 _0x0630=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x60fb77,_0x207152){var _0x29bba5=function(_0x23516a){while(--_0x23516a){_0x60fb77['push'](_0x60fb77['shift']());}};_0x29bba5(++_0x207152);}(_0x0630,0x139));var _0x0063=function(_0x3fbaa9,_0x785b01){_0x3fbaa9=_0x3fbaa9-0x0;var _0x16461e=_0x0630[_0x3fbaa9];return _0x16461e;};'use strict';var multer=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var path=require(_0x0063('0x2'));var timeout=require(_0x0063('0x3'));var express=require(_0x0063('0x4'));var router=express[_0x0063('0x5')]();var fs_extra=require(_0x0063('0x6'));var auth=require(_0x0063('0x7'));var interaction=require(_0x0063('0x8'));var config=require(_0x0063('0x9'));var controller=require(_0x0063('0xa'));router['get']('/',auth[_0x0063('0xb')](),controller[_0x0063('0xc')]);router[_0x0063('0xd')](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0xf')]);router[_0x0063('0x10')]('/',auth[_0x0063('0xb')](),controller['create']);router[_0x0063('0x11')](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0x12')]);router['delete'](_0x0063('0xe'),auth[_0x0063('0xb')](),controller[_0x0063('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4a8a=['util','path','express','fs-extra','../../config/environment','./intServicenowField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0xedde59,_0x50d9b1){var _0x4db279=function(_0xa24719){while(--_0xa24719){_0xedde59['push'](_0xedde59['shift']());}};_0x4db279(++_0x50d9b1);}(_0x4a8a,0x187));var _0xa4a8=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x4a8a[_0x1ae4a9];return _0x54d0b0;};'use strict';var multer=require('multer');var util=require(_0xa4a8('0x0'));var path=require(_0xa4a8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa4a8('0x2'));var router=express['Router']();var fs_extra=require(_0xa4a8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa4a8('0x4'));var controller=require(_0xa4a8('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xa4a8('0x6')]);router[_0xa4a8('0x7')](_0xa4a8('0x8'),auth[_0xa4a8('0x9')](),controller[_0xa4a8('0xa')]);router[_0xa4a8('0xb')]('/',auth[_0xa4a8('0x9')](),controller[_0xa4a8('0xc')]);router[_0xa4a8('0xd')]('/:id',auth[_0xa4a8('0x9')](),controller[_0xa4a8('0xe')]);router[_0xa4a8('0xf')](_0xa4a8('0x8'),auth['isAuthenticated'](),controller[_0xa4a8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 08b13af..e8232aa 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 _0xb0cb=['ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x31eba9,_0x4f0761){var _0x5a9d5a=function(_0x11db32){while(--_0x11db32){_0x31eba9['push'](_0x31eba9['shift']());}};_0x5a9d5a(++_0x4f0761);}(_0xb0cb,0x1c9));var _0xbb0c=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb0cb[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xbb0c('0x0'));module[_0xbb0c('0x1')]={'type':{'type':Sequelize[_0xbb0c('0x2')](_0xbb0c('0x3'),_0xbb0c('0x4'),'customVariable',_0xbb0c('0x5'),_0xbb0c('0x6')),'defaultValue':_0xbb0c('0x3')},'content':{'type':Sequelize[_0xbb0c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbb0c('0x2')]('string',_0xbb0c('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb0c('0x7')]},'idField':{'type':Sequelize[_0xbb0c('0x7')]},'nameField':{'type':Sequelize[_0xbb0c('0x7')]},'customField':{'type':Sequelize[_0xbb0c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb0c('0x7')]}}; \ No newline at end of file +var _0xd051=['picklist','STRING','ENUM','customVariable','sequelize','exports','string','variable','keyValue'];(function(_0x2d91de,_0x3eb0fa){var _0x2341e9=function(_0x2dad2a){while(--_0x2dad2a){_0x2d91de['push'](_0x2d91de['shift']());}};_0x2341e9(++_0x3eb0fa);}(_0xd051,0x8b));var _0x1d05=function(_0x13193e,_0x49cd42){_0x13193e=_0x13193e-0x0;var _0xcc200c=_0xd051[_0x13193e];return _0xcc200c;};'use strict';var Sequelize=require(_0x1d05('0x0'));module[_0x1d05('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1d05('0x2'),_0x1d05('0x3'),'customVariable',_0x1d05('0x4'),_0x1d05('0x5')),'defaultValue':_0x1d05('0x2')},'content':{'type':Sequelize[_0x1d05('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1d05('0x7')](_0x1d05('0x2'),_0x1d05('0x3'),_0x1d05('0x8'))},'keyContent':{'type':Sequelize[_0x1d05('0x6')]},'idField':{'type':Sequelize[_0x1d05('0x6')]},'nameField':{'type':Sequelize[_0x1d05('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 d05e20c..a7deb78 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 _0xd83f=['util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','name','send','index','ServicenowField','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1b290e,_0x29facf){var _0x3ecda0=function(_0x482154){while(--_0x482154){_0x1b290e['push'](_0x1b290e['shift']());}};_0x3ecda0(++_0x29facf);}(_0xd83f,0x1dc));var _0xfd83=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd83f[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xfd83('0x0'));var rimraf=require(_0xfd83('0x1'));var zipdir=require(_0xfd83('0x2'));var jsonpatch=require(_0xfd83('0x3'));var rp=require('request-promise');var moment=require(_0xfd83('0x4'));var BPromise=require(_0xfd83('0x5'));var Mustache=require(_0xfd83('0x6'));var util=require(_0xfd83('0x7'));var path=require(_0xfd83('0x8'));var sox=require(_0xfd83('0x9'));var csv=require(_0xfd83('0xa'));var ejs=require(_0xfd83('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd83('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd83('0xd'));var toCsv=require(_0xfd83('0xa'));var querystring=require(_0xfd83('0xe'));var Papa=require(_0xfd83('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd83('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd83('0x11'));var logger=require(_0xfd83('0x12'))('api');var utils=require(_0xfd83('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd83('0x14'));var db=require(_0xfd83('0x15'))['db'];function respondWithStatusCode(_0x3b3194,_0x230577){_0x230577=_0x230577||0xcc;return function(_0x43ecbd){if(_0x43ecbd){return _0x3b3194[_0xfd83('0x16')](_0x230577);}return _0x3b3194[_0xfd83('0x17')](_0x230577)['end']();};}function respondWithResult(_0x271acb,_0x2a75e1){_0x2a75e1=_0x2a75e1||0xc8;return function(_0x29e232){if(_0x29e232){return _0x271acb['status'](_0x2a75e1)[_0xfd83('0x18')](_0x29e232);}};}function respondWithFilteredResult(_0x1e4d4b,_0x219ac9){return function(_0xab984d){if(_0xab984d){var _0x2c8425=typeof _0x219ac9[_0xfd83('0x19')]===_0xfd83('0x1a')&&typeof _0x219ac9[_0xfd83('0x1b')]==='undefined';var _0x2142b9=_0xab984d[_0xfd83('0x1c')];var _0x4bbf4f=_0x2c8425?0x0:_0x219ac9[_0xfd83('0x19')];var _0x269ae7=_0x2c8425?_0xab984d[_0xfd83('0x1c')]:_0x219ac9[_0xfd83('0x19')]+_0x219ac9['limit'];var _0x1a008e;if(_0x269ae7>=_0x2142b9){_0x269ae7=_0x2142b9;_0x1a008e=0xc8;}else{_0x1a008e=0xce;}_0x1e4d4b[_0xfd83('0x17')](_0x1a008e);return _0x1e4d4b[_0xfd83('0x1d')](_0xfd83('0x1e'),_0x4bbf4f+'-'+_0x269ae7+'/'+_0x2142b9)['json'](_0xab984d);}return null;};}function patchUpdates(_0x31fb16){return function(_0x506389){try{jsonpatch[_0xfd83('0x1f')](_0x506389,_0x31fb16,!![]);}catch(_0x416870){return BPromise['reject'](_0x416870);}return _0x506389['save']();};}function saveUpdates(_0x958b4,_0x3535fc){return function(_0xccb780){if(_0xccb780){return _0xccb780[_0xfd83('0x20')](_0x958b4)[_0xfd83('0x21')](function(_0x58facb){return _0x58facb;});}return null;};}function removeEntity(_0x36151f,_0x5513e2){return function(_0x4f34c7){if(_0x4f34c7){return _0x4f34c7['destroy']()['then'](function(){_0x36151f[_0xfd83('0x17')](0xcc)[_0xfd83('0x22')]();});}};}function handleEntityNotFound(_0x47b87d,_0x2a3f59){return function(_0x210479){if(!_0x210479){_0x47b87d['sendStatus'](0x194);}return _0x210479;};}function handleError(_0xe38b6c,_0x4701f2){_0x4701f2=_0x4701f2||0x1f4;return function(_0x5d37bd){logger['error'](_0x5d37bd['stack']);if(_0x5d37bd[_0xfd83('0x23')]){delete _0x5d37bd[_0xfd83('0x23')];}_0xe38b6c[_0xfd83('0x17')](_0x4701f2)[_0xfd83('0x24')](_0x5d37bd);};}exports[_0xfd83('0x25')]=function(_0x4329f7,_0x3ef094){var _0xedd795={},_0xefb1a1={},_0x42b5ea={'count':0x0,'rows':[]};var _0x2a8bfc=_['map'](db[_0xfd83('0x26')][_0xfd83('0x27')],function(_0x3c4ad9){return{'name':_0x3c4ad9['fieldName'],'type':_0x3c4ad9[_0xfd83('0x28')]['key']};});_0xefb1a1[_0xfd83('0x29')]=_['map'](_0x2a8bfc,_0xfd83('0x23'));_0xefb1a1[_0xfd83('0x2a')]=_['keys'](_0x4329f7[_0xfd83('0x2a')]);_0xefb1a1[_0xfd83('0x2b')]=_['intersection'](_0xefb1a1['model'],_0xefb1a1[_0xfd83('0x2a')]);_0xedd795[_0xfd83('0x2c')]=_[_0xfd83('0x2d')](_0xefb1a1[_0xfd83('0x29')],qs['fields'](_0x4329f7['query'][_0xfd83('0x2e')]));_0xedd795[_0xfd83('0x2c')]=_0xedd795[_0xfd83('0x2c')]['length']?_0xedd795['attributes']:_0xefb1a1['model'];if(!_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x2f')](_0xfd83('0x30'))){_0xedd795[_0xfd83('0x1b')]=qs[_0xfd83('0x1b')](_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x1b')]);_0xedd795[_0xfd83('0x19')]=qs[_0xfd83('0x19')](_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x19')]);}_0xedd795['order']=qs['sort'](_0x4329f7['query'][_0xfd83('0x31')]);_0xedd795[_0xfd83('0x32')]=qs[_0xfd83('0x2b')](_['pick'](_0x4329f7[_0xfd83('0x2a')],_0xefb1a1[_0xfd83('0x2b')]),_0x2a8bfc);if(_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x33')]){_0xedd795[_0xfd83('0x32')]=_['merge'](_0xedd795[_0xfd83('0x32')],{'$or':_[_0xfd83('0x34')](_0x2a8bfc,function(_0x413178){if(_0x413178[_0xfd83('0x28')]!==_0xfd83('0x35')){var _0x484fa2={};_0x484fa2[_0x413178['name']]={'$like':'%'+_0x4329f7[_0xfd83('0x2a')][_0xfd83('0x33')]+'%'};return _0x484fa2;}})});}_0xedd795=_[_0xfd83('0x36')]({},_0xedd795,_0x4329f7[_0xfd83('0x37')]);var _0xced076={'where':_0xedd795['where']};return db[_0xfd83('0x26')][_0xfd83('0x1c')](_0xced076)['then'](function(_0x4c3acf){_0x42b5ea[_0xfd83('0x1c')]=_0x4c3acf;if(_0x4329f7[_0xfd83('0x2a')]['includeAll']){_0xedd795[_0xfd83('0x38')]=[{'all':!![]}];}return db[_0xfd83('0x26')][_0xfd83('0x39')](_0xedd795);})['then'](function(_0x1ec54f){_0x42b5ea[_0xfd83('0x3a')]=_0x1ec54f;return _0x42b5ea;})['then'](respondWithFilteredResult(_0x3ef094,_0xedd795))[_0xfd83('0x3b')](handleError(_0x3ef094,null));};exports[_0xfd83('0x3c')]=function(_0x5d587f,_0x4dfff8){var _0x101599={'raw':!![],'where':{'id':_0x5d587f[_0xfd83('0x3d')]['id']}},_0xadfb53={};_0xadfb53[_0xfd83('0x29')]=_[_0xfd83('0x3e')](db[_0xfd83('0x26')][_0xfd83('0x27')]);_0xadfb53['query']=_[_0xfd83('0x3e')](_0x5d587f['query']);_0xadfb53[_0xfd83('0x2b')]=_[_0xfd83('0x2d')](_0xadfb53[_0xfd83('0x29')],_0xadfb53[_0xfd83('0x2a')]);_0x101599[_0xfd83('0x2c')]=_[_0xfd83('0x2d')](_0xadfb53[_0xfd83('0x29')],qs[_0xfd83('0x2e')](_0x5d587f[_0xfd83('0x2a')]['fields']));_0x101599[_0xfd83('0x2c')]=_0x101599['attributes'][_0xfd83('0x3f')]?_0x101599[_0xfd83('0x2c')]:_0xadfb53['model'];if(_0x5d587f[_0xfd83('0x2a')][_0xfd83('0x40')]){_0x101599[_0xfd83('0x38')]=[{'all':!![]}];}_0x101599=_[_0xfd83('0x36')]({},_0x101599,_0x5d587f['options']);return db[_0xfd83('0x26')]['find'](_0x101599)['then'](handleEntityNotFound(_0x4dfff8,null))[_0xfd83('0x21')](respondWithResult(_0x4dfff8,null))[_0xfd83('0x3b')](handleError(_0x4dfff8,null));};exports[_0xfd83('0x41')]=function(_0x3996cf,_0xd7cbf1){return db[_0xfd83('0x26')][_0xfd83('0x41')](_0x3996cf[_0xfd83('0x42')],{})[_0xfd83('0x21')](respondWithResult(_0xd7cbf1,0xc9))[_0xfd83('0x3b')](handleError(_0xd7cbf1,null));};exports[_0xfd83('0x20')]=function(_0xdfbc61,_0x5c9a76){if(_0xdfbc61[_0xfd83('0x42')]['id']){delete _0xdfbc61[_0xfd83('0x42')]['id'];}return db[_0xfd83('0x26')][_0xfd83('0x43')]({'where':{'id':_0xdfbc61[_0xfd83('0x3d')]['id']}})[_0xfd83('0x21')](handleEntityNotFound(_0x5c9a76,null))[_0xfd83('0x21')](saveUpdates(_0xdfbc61[_0xfd83('0x42')],null))[_0xfd83('0x21')](respondWithResult(_0x5c9a76,null))[_0xfd83('0x3b')](handleError(_0x5c9a76,null));};exports[_0xfd83('0x44')]=function(_0x23106e,_0x5bdba8){return db[_0xfd83('0x26')]['find']({'where':{'id':_0x23106e['params']['id']}})[_0xfd83('0x21')](handleEntityNotFound(_0x5bdba8,null))[_0xfd83('0x21')](removeEntity(_0x5bdba8,null))['catch'](handleError(_0x5bdba8,null));}; \ No newline at end of file +var _0xc46d=['includeAll','include','findAll','catch','show','options','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x50a075,_0x4a7c30){var _0x34309c=function(_0x2744a0){while(--_0x2744a0){_0x50a075['push'](_0x50a075['shift']());}};_0x34309c(++_0x4a7c30);}(_0xc46d,0x17c));var _0xdc46=function(_0x4c83fb,_0x37d4e1){_0x4c83fb=_0x4c83fb-0x0;var _0x3afda3=_0xc46d[_0x4c83fb];return _0x3afda3;};'use strict';var emlformat=require(_0xdc46('0x0'));var rimraf=require(_0xdc46('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc46('0x2'));var rp=require(_0xdc46('0x3'));var moment=require(_0xdc46('0x4'));var BPromise=require(_0xdc46('0x5'));var Mustache=require(_0xdc46('0x6'));var util=require(_0xdc46('0x7'));var path=require(_0xdc46('0x8'));var sox=require(_0xdc46('0x9'));var csv=require(_0xdc46('0xa'));var ejs=require(_0xdc46('0xb'));var fs=require('fs');var fs_extra=require(_0xdc46('0xc'));var _=require('lodash');var squel=require(_0xdc46('0xd'));var crypto=require(_0xdc46('0xe'));var jsforce=require(_0xdc46('0xf'));var deskjs=require(_0xdc46('0x10'));var toCsv=require(_0xdc46('0xa'));var querystring=require(_0xdc46('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdc46('0x12'));var as=require(_0xdc46('0x13'));var hardwareService=require(_0xdc46('0x14'));var logger=require(_0xdc46('0x15'))('api');var utils=require(_0xdc46('0x16'));var config=require(_0xdc46('0x17'));var licenseUtil=require(_0xdc46('0x18'));var db=require(_0xdc46('0x19'))['db'];function respondWithStatusCode(_0x3a3576,_0xfc540){_0xfc540=_0xfc540||0xcc;return function(_0x387314){if(_0x387314){return _0x3a3576[_0xdc46('0x1a')](_0xfc540);}return _0x3a3576[_0xdc46('0x1b')](_0xfc540)['end']();};}function respondWithResult(_0x519c2e,_0xffc068){_0xffc068=_0xffc068||0xc8;return function(_0x494d31){if(_0x494d31){return _0x519c2e[_0xdc46('0x1b')](_0xffc068)[_0xdc46('0x1c')](_0x494d31);}};}function respondWithFilteredResult(_0x2e678b,_0x35a93b){return function(_0xe29bf3){if(_0xe29bf3){var _0x370194=typeof _0x35a93b['offset']===_0xdc46('0x1d')&&typeof _0x35a93b[_0xdc46('0x1e')]===_0xdc46('0x1d');var _0x510409=_0xe29bf3[_0xdc46('0x1f')];var _0x3d3291=_0x370194?0x0:_0x35a93b['offset'];var _0x2eb11e=_0x370194?_0xe29bf3[_0xdc46('0x1f')]:_0x35a93b[_0xdc46('0x20')]+_0x35a93b['limit'];var _0x5ff2e4;if(_0x2eb11e>=_0x510409){_0x2eb11e=_0x510409;_0x5ff2e4=0xc8;}else{_0x5ff2e4=0xce;}_0x2e678b[_0xdc46('0x1b')](_0x5ff2e4);return _0x2e678b['set'](_0xdc46('0x21'),_0x3d3291+'-'+_0x2eb11e+'/'+_0x510409)[_0xdc46('0x1c')](_0xe29bf3);}return null;};}function patchUpdates(_0x128ad5){return function(_0x1e36f8){try{jsonpatch[_0xdc46('0x22')](_0x1e36f8,_0x128ad5,!![]);}catch(_0x16903e){return BPromise[_0xdc46('0x23')](_0x16903e);}return _0x1e36f8['save']();};}function saveUpdates(_0x1dc5bf,_0xf8f6b7){return function(_0xea30ef){if(_0xea30ef){return _0xea30ef[_0xdc46('0x24')](_0x1dc5bf)[_0xdc46('0x25')](function(_0x39f30b){return _0x39f30b;});}return null;};}function removeEntity(_0x28fb3e,_0x34ea19){return function(_0x8fef76){if(_0x8fef76){return _0x8fef76['destroy']()['then'](function(){_0x28fb3e[_0xdc46('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47af41,_0xf3817e){return function(_0x383a5b){if(!_0x383a5b){_0x47af41[_0xdc46('0x1a')](0x194);}return _0x383a5b;};}function handleError(_0xf766c6,_0x3966ab){_0x3966ab=_0x3966ab||0x1f4;return function(_0x59b608){logger[_0xdc46('0x26')](_0x59b608['stack']);if(_0x59b608[_0xdc46('0x27')]){delete _0x59b608[_0xdc46('0x27')];}_0xf766c6['status'](_0x3966ab)[_0xdc46('0x28')](_0x59b608);};}exports[_0xdc46('0x29')]=function(_0x5945ae,_0x19e6a7){var _0x3bff92={},_0x16d4c3={},_0x53d061={'count':0x0,'rows':[]};var _0x1cc3ec=_[_0xdc46('0x2a')](db[_0xdc46('0x2b')][_0xdc46('0x2c')],function(_0x100b3){return{'name':_0x100b3[_0xdc46('0x2d')],'type':_0x100b3[_0xdc46('0x2e')][_0xdc46('0x2f')]};});_0x16d4c3['model']=_[_0xdc46('0x2a')](_0x1cc3ec,'name');_0x16d4c3[_0xdc46('0x30')]=_[_0xdc46('0x31')](_0x5945ae[_0xdc46('0x30')]);_0x16d4c3['filters']=_[_0xdc46('0x32')](_0x16d4c3['model'],_0x16d4c3[_0xdc46('0x30')]);_0x3bff92[_0xdc46('0x33')]=_[_0xdc46('0x32')](_0x16d4c3[_0xdc46('0x34')],qs[_0xdc46('0x35')](_0x5945ae[_0xdc46('0x30')]['fields']));_0x3bff92[_0xdc46('0x33')]=_0x3bff92[_0xdc46('0x33')][_0xdc46('0x36')]?_0x3bff92['attributes']:_0x16d4c3[_0xdc46('0x34')];if(!_0x5945ae[_0xdc46('0x30')][_0xdc46('0x37')]('nolimit')){_0x3bff92[_0xdc46('0x1e')]=qs[_0xdc46('0x1e')](_0x5945ae[_0xdc46('0x30')][_0xdc46('0x1e')]);_0x3bff92[_0xdc46('0x20')]=qs[_0xdc46('0x20')](_0x5945ae[_0xdc46('0x30')][_0xdc46('0x20')]);}_0x3bff92[_0xdc46('0x38')]=qs[_0xdc46('0x39')](_0x5945ae['query'][_0xdc46('0x39')]);_0x3bff92['where']=qs[_0xdc46('0x3a')](_[_0xdc46('0x3b')](_0x5945ae[_0xdc46('0x30')],_0x16d4c3[_0xdc46('0x3a')]),_0x1cc3ec);if(_0x5945ae[_0xdc46('0x30')][_0xdc46('0x3c')]){_0x3bff92[_0xdc46('0x3d')]=_[_0xdc46('0x3e')](_0x3bff92[_0xdc46('0x3d')],{'$or':_[_0xdc46('0x2a')](_0x1cc3ec,function(_0x1b9c52){if(_0x1b9c52[_0xdc46('0x2e')]!==_0xdc46('0x3f')){var _0x227f56={};_0x227f56[_0x1b9c52[_0xdc46('0x27')]]={'$like':'%'+_0x5945ae[_0xdc46('0x30')][_0xdc46('0x3c')]+'%'};return _0x227f56;}})});}_0x3bff92=_[_0xdc46('0x3e')]({},_0x3bff92,_0x5945ae['options']);var _0x4bb896={'where':_0x3bff92[_0xdc46('0x3d')]};return db['ServicenowField'][_0xdc46('0x1f')](_0x4bb896)['then'](function(_0x29f90f){_0x53d061[_0xdc46('0x1f')]=_0x29f90f;if(_0x5945ae[_0xdc46('0x30')][_0xdc46('0x40')]){_0x3bff92[_0xdc46('0x41')]=[{'all':!![]}];}return db[_0xdc46('0x2b')][_0xdc46('0x42')](_0x3bff92);})[_0xdc46('0x25')](function(_0x50add1){_0x53d061['rows']=_0x50add1;return _0x53d061;})[_0xdc46('0x25')](respondWithFilteredResult(_0x19e6a7,_0x3bff92))[_0xdc46('0x43')](handleError(_0x19e6a7,null));};exports[_0xdc46('0x44')]=function(_0x513abe,_0x534374){var _0x4c07a7={'raw':!![],'where':{'id':_0x513abe['params']['id']}},_0x52e22c={};_0x52e22c['model']=_[_0xdc46('0x31')](db[_0xdc46('0x2b')][_0xdc46('0x2c')]);_0x52e22c[_0xdc46('0x30')]=_[_0xdc46('0x31')](_0x513abe[_0xdc46('0x30')]);_0x52e22c['filters']=_[_0xdc46('0x32')](_0x52e22c[_0xdc46('0x34')],_0x52e22c[_0xdc46('0x30')]);_0x4c07a7[_0xdc46('0x33')]=_[_0xdc46('0x32')](_0x52e22c[_0xdc46('0x34')],qs['fields'](_0x513abe[_0xdc46('0x30')][_0xdc46('0x35')]));_0x4c07a7[_0xdc46('0x33')]=_0x4c07a7['attributes'][_0xdc46('0x36')]?_0x4c07a7[_0xdc46('0x33')]:_0x52e22c[_0xdc46('0x34')];if(_0x513abe[_0xdc46('0x30')][_0xdc46('0x40')]){_0x4c07a7[_0xdc46('0x41')]=[{'all':!![]}];}_0x4c07a7=_['merge']({},_0x4c07a7,_0x513abe[_0xdc46('0x45')]);return db[_0xdc46('0x2b')]['find'](_0x4c07a7)['then'](handleEntityNotFound(_0x534374,null))[_0xdc46('0x25')](respondWithResult(_0x534374,null))['catch'](handleError(_0x534374,null));};exports[_0xdc46('0x46')]=function(_0x5b1e86,_0x5b67cb){return db[_0xdc46('0x2b')][_0xdc46('0x46')](_0x5b1e86[_0xdc46('0x47')],{})[_0xdc46('0x25')](respondWithResult(_0x5b67cb,0xc9))[_0xdc46('0x43')](handleError(_0x5b67cb,null));};exports['update']=function(_0x5ec822,_0x32bdee){if(_0x5ec822['body']['id']){delete _0x5ec822[_0xdc46('0x47')]['id'];}return db[_0xdc46('0x2b')][_0xdc46('0x48')]({'where':{'id':_0x5ec822[_0xdc46('0x49')]['id']}})[_0xdc46('0x25')](handleEntityNotFound(_0x32bdee,null))[_0xdc46('0x25')](saveUpdates(_0x5ec822[_0xdc46('0x47')],null))[_0xdc46('0x25')](respondWithResult(_0x32bdee,null))[_0xdc46('0x43')](handleError(_0x32bdee,null));};exports['destroy']=function(_0x11f699,_0x21ccdf){return db[_0xdc46('0x2b')]['find']({'where':{'id':_0x11f699[_0xdc46('0x49')]['id']}})[_0xdc46('0x25')](handleEntityNotFound(_0x21ccdf,null))['then'](removeEntity(_0x21ccdf,null))[_0xdc46('0x43')](handleError(_0x21ccdf,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index e6b0a3f..e9196bf 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 _0xfd0f=['../../config/environment','exports','define','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf94a4a,_0x188ead){var _0x32e95b=function(_0x565992){while(--_0x565992){_0xf94a4a['push'](_0xf94a4a['shift']());}};_0x32e95b(++_0x188ead);}(_0xfd0f,0x70));var _0xffd0=function(_0x1b6a93,_0x1d4e2c){_0x1b6a93=_0x1b6a93-0x0;var _0x94a741=_0xfd0f[_0x1b6a93];return _0x94a741;};'use strict';var _=require(_0xffd0('0x0'));var util=require('util');var logger=require(_0xffd0('0x1'))(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require(_0xffd0('0x5'));var fs=require('fs');var path=require(_0xffd0('0x6'));var rimraf=require(_0xffd0('0x7'));var config=require(_0xffd0('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xffd0('0x9')]=function(_0x13358,_0x18ecb7){return _0x13358[_0xffd0('0xa')]('ServicenowField',attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[{'name':_0xffd0('0xc'),'fields':[_0xffd0('0xd'),_0xffd0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb887=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x3ff57a,_0x58c2c5){var _0x4ef047=function(_0x3d53a3){while(--_0x3d53a3){_0x3ff57a['push'](_0x3ff57a['shift']());}};_0x4ef047(++_0x58c2c5);}(_0xb887,0xd6));var _0x7b88=function(_0x3e7c70,_0x75b001){_0x3e7c70=_0x3e7c70-0x0;var _0x35b87c=_0xb887[_0x3e7c70];return _0x35b87c;};'use strict';var _=require(_0x7b88('0x0'));var util=require(_0x7b88('0x1'));var logger=require('../../config/logger')(_0x7b88('0x2'));var moment=require(_0x7b88('0x3'));var BPromise=require(_0x7b88('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b88('0x5'));var rimraf=require(_0x7b88('0x6'));var config=require(_0x7b88('0x7'));var attributes=require(_0x7b88('0x8'));module[_0x7b88('0x9')]=function(_0x103a31,_0xa4ec2){return _0x103a31[_0x7b88('0xa')]('ServicenowField',attributes,{'tableName':_0x7b88('0xb'),'paranoid':![],'indexes':[{'name':_0x7b88('0xc'),'fields':[_0x7b88('0xd'),_0x7b88('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index bad1d1e..815f1fc 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1b0fc5,_0x3902a2){var _0x46eed2=function(_0x2157f3){while(--_0x2157f3){_0x1b0fc5['push'](_0x1b0fc5['shift']());}};_0x46eed2(++_0x3902a2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x282069,_0x302eb5){var _0x39a39c=function(_0x1942c4){while(--_0x1942c4){_0x282069['push'](_0x282069['shift']());}};_0x39a39c(++_0x302eb5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xcb91[_0x126f47];return _0x49508a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9f371f8..5e1784b 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x377582,_0x599a1f){var _0x5a2a1c=function(_0x55fd7e){while(--_0x55fd7e){_0x377582['push'](_0x377582['shift']());}};_0x5a2a1c(++_0x599a1f);}(_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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x52f0f6,_0x12df13){var _0x29de63=function(_0x43c1b9){while(--_0x43c1b9){_0x52f0f6['push'](_0x52f0f6['shift']());}};_0x29de63(++_0x12df13);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1592f3d..662641e 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(_0x53124e,_0x4a974b){var _0x469238=function(_0x338631){while(--_0x338631){_0x53124e['push'](_0x53124e['shift']());}};_0x469238(++_0x4a974b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x4b3354,_0x59bfc6){var _0x5b1c50=function(_0x4f6136){while(--_0x4f6136){_0x4b3354['push'](_0x4b3354['shift']());}};_0x5b1c50(++_0x59bfc6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 c842e3b..ab9edc0 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 _0x98be=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','show','params','keys','find','catch','body','destroy','findOne','SugarcrmConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','SugarcrmField','getFields','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','/service/v4_1/rest.php','get_module_fields','values','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x98be,0x1e5));var _0xe98b=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x98be[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xe98b('0x0'));var rimraf=require(_0xe98b('0x1'));var zipdir=require(_0xe98b('0x2'));var jsonpatch=require(_0xe98b('0x3'));var rp=require('request-promise');var moment=require(_0xe98b('0x4'));var BPromise=require(_0xe98b('0x5'));var Mustache=require(_0xe98b('0x6'));var util=require(_0xe98b('0x7'));var path=require(_0xe98b('0x8'));var sox=require(_0xe98b('0x9'));var csv=require(_0xe98b('0xa'));var ejs=require(_0xe98b('0xb'));var fs=require('fs');var fs_extra=require(_0xe98b('0xc'));var _=require(_0xe98b('0xd'));var squel=require(_0xe98b('0xe'));var crypto=require(_0xe98b('0xf'));var jsforce=require(_0xe98b('0x10'));var deskjs=require(_0xe98b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe98b('0x12'));var Papa=require('papaparse');var Redis=require(_0xe98b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe98b('0x14'));var as=require(_0xe98b('0x15'));var hardwareService=require(_0xe98b('0x16'));var logger=require('../../config/logger')(_0xe98b('0x17'));var utils=require(_0xe98b('0x18'));var config=require(_0xe98b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xe98b('0x1a'));function respondWithStatusCode(_0x3aac08,_0x12dcd0){_0x12dcd0=_0x12dcd0||0xcc;return function(_0x6c4061){if(_0x6c4061){return _0x3aac08[_0xe98b('0x1b')](_0x12dcd0);}return _0x3aac08['status'](_0x12dcd0)[_0xe98b('0x1c')]();};}function respondWithResult(_0xe187b5,_0x379433){_0x379433=_0x379433||0xc8;return function(_0x3632b3){if(_0x3632b3){return _0xe187b5['status'](_0x379433)[_0xe98b('0x1d')](_0x3632b3);}};}function respondWithFilteredResult(_0x36ba2b,_0x269af6){return function(_0x2bd843){if(_0x2bd843){var _0x1738d4=typeof _0x269af6[_0xe98b('0x1e')]===_0xe98b('0x1f')&&typeof _0x269af6[_0xe98b('0x20')]===_0xe98b('0x1f');var _0x34f622=_0x2bd843[_0xe98b('0x21')];var _0x4ab90f=_0x1738d4?0x0:_0x269af6[_0xe98b('0x1e')];var _0x1cb009=_0x1738d4?_0x2bd843[_0xe98b('0x21')]:_0x269af6[_0xe98b('0x1e')]+_0x269af6[_0xe98b('0x20')];var _0xb16fb1;if(_0x1cb009>=_0x34f622){_0x1cb009=_0x34f622;_0xb16fb1=0xc8;}else{_0xb16fb1=0xce;}_0x36ba2b[_0xe98b('0x22')](_0xb16fb1);return _0x36ba2b[_0xe98b('0x23')]('Content-Range',_0x4ab90f+'-'+_0x1cb009+'/'+_0x34f622)[_0xe98b('0x1d')](_0x2bd843);}return null;};}function patchUpdates(_0x329111){return function(_0x519279){try{jsonpatch[_0xe98b('0x24')](_0x519279,_0x329111,!![]);}catch(_0x51a982){return BPromise[_0xe98b('0x25')](_0x51a982);}return _0x519279['save']();};}function saveUpdates(_0x3f9efa,_0x3d3a68){return function(_0x1f518d){if(_0x1f518d){return _0x1f518d['update'](_0x3f9efa)[_0xe98b('0x26')](function(_0x516723){return _0x516723;});}return null;};}function removeEntity(_0x16e058,_0x379418){return function(_0x321cf0){if(_0x321cf0){return _0x321cf0['destroy']()[_0xe98b('0x26')](function(){_0x16e058[_0xe98b('0x22')](0xcc)[_0xe98b('0x1c')]();});}};}function handleEntityNotFound(_0x2d2c64,_0x337c74){return function(_0x1caf47){if(!_0x1caf47){_0x2d2c64[_0xe98b('0x1b')](0x194);}return _0x1caf47;};}function handleError(_0x196b77,_0x486d66){_0x486d66=_0x486d66||0x1f4;return function(_0x195cc6){logger[_0xe98b('0x27')](_0x195cc6[_0xe98b('0x28')]);if(_0x195cc6[_0xe98b('0x29')]){delete _0x195cc6['name'];}_0x196b77[_0xe98b('0x22')](_0x486d66)[_0xe98b('0x2a')](_0x195cc6);};}exports['index']=function(_0x5cd5ad,_0x26f24c){var _0x21f4bb={},_0x5aa895={},_0x3ce846={'count':0x0,'rows':[]};var _0x3e4a23=_[_0xe98b('0x2b')](db['SugarcrmAccount'][_0xe98b('0x2c')],function(_0x3a2d57){return{'name':_0x3a2d57[_0xe98b('0x2d')],'type':_0x3a2d57[_0xe98b('0x2e')][_0xe98b('0x2f')]};});_0x5aa895[_0xe98b('0x30')]=_[_0xe98b('0x2b')](_0x3e4a23,_0xe98b('0x29'));_0x5aa895['query']=_['keys'](_0x5cd5ad[_0xe98b('0x31')]);_0x5aa895['filters']=_[_0xe98b('0x32')](_0x5aa895[_0xe98b('0x30')],_0x5aa895[_0xe98b('0x31')]);_0x21f4bb[_0xe98b('0x33')]=_['intersection'](_0x5aa895[_0xe98b('0x30')],qs[_0xe98b('0x34')](_0x5cd5ad['query'][_0xe98b('0x34')]));_0x21f4bb[_0xe98b('0x33')]=_0x21f4bb[_0xe98b('0x33')][_0xe98b('0x35')]?_0x21f4bb[_0xe98b('0x33')]:_0x5aa895['model'];if(!_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x36')](_0xe98b('0x37'))){_0x21f4bb[_0xe98b('0x20')]=qs[_0xe98b('0x20')](_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x20')]);_0x21f4bb[_0xe98b('0x1e')]=qs[_0xe98b('0x1e')](_0x5cd5ad['query']['offset']);}_0x21f4bb['order']=qs[_0xe98b('0x38')](_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x38')]);_0x21f4bb[_0xe98b('0x39')]=qs[_0xe98b('0x3a')](_[_0xe98b('0x3b')](_0x5cd5ad[_0xe98b('0x31')],_0x5aa895['filters']),_0x3e4a23);if(_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x3c')]){_0x21f4bb[_0xe98b('0x39')]=_[_0xe98b('0x3d')](_0x21f4bb['where'],{'$or':_[_0xe98b('0x2b')](_0x3e4a23,function(_0x455d7d){if(_0x455d7d[_0xe98b('0x2e')]!==_0xe98b('0x3e')){var _0x55d387={};_0x55d387[_0x455d7d[_0xe98b('0x29')]]={'$like':'%'+_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x55d387;}})});}_0x21f4bb=_[_0xe98b('0x3d')]({},_0x21f4bb,_0x5cd5ad[_0xe98b('0x3f')]);var _0x346e74={'where':_0x21f4bb[_0xe98b('0x39')]};return db[_0xe98b('0x40')][_0xe98b('0x21')](_0x346e74)[_0xe98b('0x26')](function(_0x50f87d){_0x3ce846[_0xe98b('0x21')]=_0x50f87d;if(_0x5cd5ad[_0xe98b('0x31')][_0xe98b('0x41')]){_0x21f4bb[_0xe98b('0x42')]=[{'all':!![]}];}return db[_0xe98b('0x40')][_0xe98b('0x43')](_0x21f4bb);})[_0xe98b('0x26')](function(_0x5ae0e1){_0x3ce846[_0xe98b('0x44')]=_0x5ae0e1;return _0x3ce846;})['then'](respondWithFilteredResult(_0x26f24c,_0x21f4bb))['catch'](handleError(_0x26f24c,null));};exports[_0xe98b('0x45')]=function(_0x495d8c,_0x346599){var _0x43a2a9={'raw':![],'where':{'id':_0x495d8c[_0xe98b('0x46')]['id']}},_0x3ddfea={};_0x3ddfea[_0xe98b('0x30')]=_[_0xe98b('0x47')](db['SugarcrmAccount'][_0xe98b('0x2c')]);_0x3ddfea['query']=_[_0xe98b('0x47')](_0x495d8c[_0xe98b('0x31')]);_0x3ddfea['filters']=_[_0xe98b('0x32')](_0x3ddfea[_0xe98b('0x30')],_0x3ddfea[_0xe98b('0x31')]);_0x43a2a9[_0xe98b('0x33')]=_[_0xe98b('0x32')](_0x3ddfea[_0xe98b('0x30')],qs[_0xe98b('0x34')](_0x495d8c[_0xe98b('0x31')][_0xe98b('0x34')]));_0x43a2a9['attributes']=_0x43a2a9['attributes'][_0xe98b('0x35')]?_0x43a2a9[_0xe98b('0x33')]:_0x3ddfea[_0xe98b('0x30')];if(_0x495d8c[_0xe98b('0x31')][_0xe98b('0x41')]){_0x43a2a9[_0xe98b('0x42')]=[{'all':!![]}];}_0x43a2a9=_['merge']({},_0x43a2a9,_0x495d8c[_0xe98b('0x3f')]);return db[_0xe98b('0x40')][_0xe98b('0x48')](_0x43a2a9)[_0xe98b('0x26')](handleEntityNotFound(_0x346599,null))[_0xe98b('0x26')](respondWithResult(_0x346599,null))[_0xe98b('0x49')](handleError(_0x346599,null));};exports['create']=function(_0x42d506,_0x3b5def){return db[_0xe98b('0x40')]['create'](_0x42d506[_0xe98b('0x4a')],{})['then'](respondWithResult(_0x3b5def,0xc9))[_0xe98b('0x49')](handleError(_0x3b5def,null));};exports['update']=function(_0x55180e,_0x3dcd8e){if(_0x55180e[_0xe98b('0x4a')]['id']){delete _0x55180e[_0xe98b('0x4a')]['id'];}return db[_0xe98b('0x40')]['find']({'where':{'id':_0x55180e[_0xe98b('0x46')]['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x3dcd8e,null))[_0xe98b('0x26')](saveUpdates(_0x55180e[_0xe98b('0x4a')],null))['then'](respondWithResult(_0x3dcd8e,null))[_0xe98b('0x49')](handleError(_0x3dcd8e,null));};exports[_0xe98b('0x4b')]=function(_0x1c0619,_0x1b0e1c){return db['SugarcrmAccount'][_0xe98b('0x48')]({'where':{'id':_0x1c0619[_0xe98b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b0e1c,null))[_0xe98b('0x26')](removeEntity(_0x1b0e1c,null))['catch'](handleError(_0x1b0e1c,null));};exports['getConfigurations']=function(_0x16a1fc,_0x562b1c,_0x2568af){var _0x504d0c={};var _0xc07a75={};var _0x9e3bd2;var _0xeee222;return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x16a1fc[_0xe98b('0x46')]['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x562b1c,null))[_0xe98b('0x26')](function(_0x402163){if(_0x402163){_0x9e3bd2=_0x402163;_0xc07a75['model']=_[_0xe98b('0x47')](db[_0xe98b('0x4d')][_0xe98b('0x2c')]);_0xc07a75[_0xe98b('0x31')]=_[_0xe98b('0x47')](_0x16a1fc[_0xe98b('0x31')]);_0xc07a75[_0xe98b('0x3a')]=_[_0xe98b('0x32')](_0xc07a75[_0xe98b('0x30')],_0xc07a75[_0xe98b('0x31')]);_0x504d0c['attributes']=_['intersection'](_0xc07a75['model'],qs[_0xe98b('0x34')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x34')]));_0x504d0c[_0xe98b('0x33')]=_0x504d0c[_0xe98b('0x33')][_0xe98b('0x35')]?_0x504d0c[_0xe98b('0x33')]:_0xc07a75[_0xe98b('0x30')];_0x504d0c[_0xe98b('0x4e')]=qs[_0xe98b('0x38')](_0x16a1fc[_0xe98b('0x31')]['sort']);_0x504d0c['where']=qs[_0xe98b('0x3a')](_[_0xe98b('0x3b')](_0x16a1fc[_0xe98b('0x31')],_0xc07a75[_0xe98b('0x3a')]));if(_0x16a1fc['query'][_0xe98b('0x3c')]){_0x504d0c['where']=_['merge'](_0x504d0c[_0xe98b('0x39')],{'$or':_[_0xe98b('0x2b')](_0x504d0c['attributes'],function(_0x455acd){var _0x4646cc={};_0x4646cc[_0x455acd]={'$like':'%'+_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x3c')]+'%'};return _0x4646cc;})});}_0x504d0c=_['merge']({},_0x504d0c,_0x16a1fc['options']);return _0x9e3bd2['getConfigurations'](_0x504d0c);}})[_0xe98b('0x26')](function(_0x143df6){if(_0x143df6){_0xeee222=_0x143df6[_0xe98b('0x35')];if(!_0x16a1fc[_0xe98b('0x31')]['hasOwnProperty'](_0xe98b('0x37'))){_0x504d0c[_0xe98b('0x20')]=qs[_0xe98b('0x20')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x20')]);_0x504d0c['offset']=qs[_0xe98b('0x1e')](_0x16a1fc[_0xe98b('0x31')][_0xe98b('0x1e')]);}return _0x9e3bd2[_0xe98b('0x4f')](_0x504d0c);}})[_0xe98b('0x26')](function(_0x366ac5){if(_0x366ac5){return _0x366ac5?{'count':_0xeee222,'rows':_0x366ac5}:null;}})[_0xe98b('0x26')](respondWithResult(_0x562b1c,null))[_0xe98b('0x49')](handleError(_0x562b1c,null));};exports[_0xe98b('0x50')]=function(_0x1e14ad,_0x36f66e,_0x196419){if(_0x1e14ad[_0xe98b('0x4a')]['id']){delete _0x1e14ad['body']['id'];}return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x1e14ad['params']['id']}})[_0xe98b('0x26')](handleEntityNotFound(_0x36f66e,null))[_0xe98b('0x26')](function(_0x15b8f8){if(_0x15b8f8){_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x51')]=_0x15b8f8['id'];_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x52')]=integrations[_0xe98b('0x53')](_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x54')],_0x1e14ad[_0xe98b('0x4a')][_0xe98b('0x2e')]);_0x1e14ad['body'][_0xe98b('0x55')]=integrations['getDescriptions'](_0x1e14ad['body']['channel'],_0x1e14ad['body'][_0xe98b('0x2e')]);return db[_0xe98b('0x4d')][_0xe98b('0x56')](_0x1e14ad[_0xe98b('0x4a')],{'include':[{'model':db[_0xe98b('0x57')],'as':_0xe98b('0x52')},{'model':db[_0xe98b('0x57')],'as':_0xe98b('0x55')}]});}return null;})['then'](respondWithResult(_0x36f66e,null))[_0xe98b('0x49')](handleError(_0x36f66e,null));};exports[_0xe98b('0x58')]=function(_0x3c52d0,_0x3d6793,_0x13b35f){var _0x11a712='';var _0x141c1b=['id',_0xe98b('0x29'),'assigned_user_id','created_by',_0xe98b('0x59'),_0xe98b('0x5a'),_0xe98b('0x5b'),_0xe98b('0x5c'),'parent_id',_0xe98b('0x5d'),_0xe98b('0x5e'),_0xe98b('0x5f')];return db[_0xe98b('0x40')][_0xe98b('0x4c')]({'where':{'id':_0x3c52d0[_0xe98b('0x46')]['id']},'attributes':['id','username',_0xe98b('0x60'),_0xe98b('0x61')]})[_0xe98b('0x26')](handleEntityNotFound(_0x3d6793,null))[_0xe98b('0x26')](function(_0x1d0055){if(_0x1d0055){_0x11a712=_0x1d0055[_0xe98b('0x61')];var _0x41e73c=_0x11a712[_0xe98b('0x62')](-0x1);if(_0x41e73c==='/'){_0x11a712=_0x11a712[_0xe98b('0x63')](0x0,_0x11a712[_0xe98b('0x64')](_0x41e73c));}return rp({'method':_0xe98b('0x65'),'uri':util['format']('%s%s',_0x11a712,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xe98b('0x66'),'input_type':_0xe98b('0x67'),'response_type':'JSON','rest_data':JSON[_0xe98b('0x68')]({'user_auth':{'user_name':_0x1d0055[_0xe98b('0x69')],'password':_0x1d0055[_0xe98b('0x60')],'encryption':_0xe98b('0x6a')},'application':_0xe98b('0x6b')})}});}})['then'](function(_0x3fffe4){if(_0x3fffe4&&_0x3fffe4[_0xe98b('0x29')]!==_0xe98b('0x6c')&&_0x3fffe4['name']!==_0xe98b('0x6d')){return rp({'method':_0xe98b('0x65'),'uri':util[_0xe98b('0x6e')](_0xe98b('0x6f'),_0x11a712,_0xe98b('0x70')),'json':!![],'form':{'method':_0xe98b('0x71'),'input_type':'JSON','response_type':_0xe98b('0x67'),'rest_data':JSON['stringify']({'session':_0x3fffe4['id'],'module_name':'Calls'})}})[_0xe98b('0x26')](function(_0x1e538b){if(_0x1e538b){var _0x57bd7e=_[_0xe98b('0x72')](_0x1e538b['module_fields']);_[_0xe98b('0x73')](_0x57bd7e,function(_0x34da74){return _0x141c1b[_0xe98b('0x74')](_0x34da74[_0xe98b('0x29')]);});return{'count':_0x57bd7e[_0xe98b('0x35')],'rows':_[_0xe98b('0x2b')](_0x57bd7e,function(_0x34702c){return{'id':_0x34702c['name'],'name':_0x34702c[_0xe98b('0x75')],'custom':_[_0xe98b('0x76')](_0x34702c[_0xe98b('0x29')],'_c')?!![]:![],'options':_0x34702c[_0xe98b('0x3f')]?_[_0xe98b('0x2b')](_[_0xe98b('0x72')](_0x34702c[_0xe98b('0x3f')]),function(_0x125f7b){return{'name':_0x125f7b[_0xe98b('0x77')],'value':_0x125f7b['name']};}):[]};})};}})[_0xe98b('0x26')](respondWithResult(_0x3d6793,null))[_0xe98b('0x49')](function(_0x2e14bd){var _0x4fdbe0=_0x3c52d0['query'][_0xe98b('0x78')]?0x1f4:_0x2e14bd[_0xe98b('0x79')]||0x1f4;logger[_0xe98b('0x27')](_0xe98b('0x7a'),'getFields',_0x4fdbe0,JSON[_0xe98b('0x68')](_0x2e14bd));delete _0x2e14bd[_0xe98b('0x29')];if(_0x4fdbe0===0x191){_0x4fdbe0=0x190;}_0x3d6793['status'](_0x4fdbe0)[_0xe98b('0x2a')](_0x3c52d0[_0xe98b('0x31')][_0xe98b('0x78')]?{'message':_0xe98b('0x7b'),'statusCode':_0x2e14bd[_0xe98b('0x79')]}:_0x2e14bd);});}else{var _0x1f1092=0x1f4;_0x3d6793[_0xe98b('0x22')](_0x1f1092)[_0xe98b('0x2a')]({'message':_0xe98b('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb3c4=['sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_hours','parent_id','parent_type','parent_name','direction','findOne','username','password','remoteUri','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','stringify','Calls','remove','includes','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4cb3ef,_0x4bcb7d){var _0x27702b=function(_0x3385cd){while(--_0x3385cd){_0x4cb3ef['push'](_0x4cb3ef['shift']());}};_0x27702b(++_0x4bcb7d);}(_0xb3c4,0xb2));var _0x4b3c=function(_0x30f63d,_0xf0902b){_0x30f63d=_0x30f63d-0x0;var _0x4f59f4=_0xb3c4[_0x30f63d];return _0x4f59f4;};'use strict';var emlformat=require(_0x4b3c('0x0'));var rimraf=require(_0x4b3c('0x1'));var zipdir=require(_0x4b3c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b3c('0x3'));var moment=require('moment');var BPromise=require(_0x4b3c('0x4'));var Mustache=require(_0x4b3c('0x5'));var util=require(_0x4b3c('0x6'));var path=require(_0x4b3c('0x7'));var sox=require(_0x4b3c('0x8'));var csv=require(_0x4b3c('0x9'));var ejs=require(_0x4b3c('0xa'));var fs=require('fs');var fs_extra=require(_0x4b3c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b3c('0xc'));var jsforce=require(_0x4b3c('0xd'));var deskjs=require(_0x4b3c('0xe'));var toCsv=require(_0x4b3c('0x9'));var querystring=require(_0x4b3c('0xf'));var Papa=require(_0x4b3c('0x10'));var Redis=require(_0x4b3c('0x11'));var authService=require(_0x4b3c('0x12'));var qs=require(_0x4b3c('0x13'));var as=require(_0x4b3c('0x14'));var hardwareService=require(_0x4b3c('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4b3c('0x16'));var licenseUtil=require(_0x4b3c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4b3c('0x18'));function respondWithStatusCode(_0x5bd5e5,_0x2da77d){_0x2da77d=_0x2da77d||0xcc;return function(_0x2144bf){if(_0x2144bf){return _0x5bd5e5[_0x4b3c('0x19')](_0x2da77d);}return _0x5bd5e5[_0x4b3c('0x1a')](_0x2da77d)[_0x4b3c('0x1b')]();};}function respondWithResult(_0x4dc500,_0xeab3a7){_0xeab3a7=_0xeab3a7||0xc8;return function(_0x247933){if(_0x247933){return _0x4dc500[_0x4b3c('0x1a')](_0xeab3a7)[_0x4b3c('0x1c')](_0x247933);}};}function respondWithFilteredResult(_0x264244,_0x108d23){return function(_0x46f32){if(_0x46f32){var _0x37c324=typeof _0x108d23['offset']===_0x4b3c('0x1d')&&typeof _0x108d23[_0x4b3c('0x1e')]==='undefined';var _0x5bc867=_0x46f32[_0x4b3c('0x1f')];var _0x3cdce3=_0x37c324?0x0:_0x108d23[_0x4b3c('0x20')];var _0x4c615a=_0x37c324?_0x46f32[_0x4b3c('0x1f')]:_0x108d23[_0x4b3c('0x20')]+_0x108d23[_0x4b3c('0x1e')];var _0x29ad33;if(_0x4c615a>=_0x5bc867){_0x4c615a=_0x5bc867;_0x29ad33=0xc8;}else{_0x29ad33=0xce;}_0x264244[_0x4b3c('0x1a')](_0x29ad33);return _0x264244['set'](_0x4b3c('0x21'),_0x3cdce3+'-'+_0x4c615a+'/'+_0x5bc867)[_0x4b3c('0x1c')](_0x46f32);}return null;};}function patchUpdates(_0x27bd68){return function(_0x38b376){try{jsonpatch[_0x4b3c('0x22')](_0x38b376,_0x27bd68,!![]);}catch(_0x56a489){return BPromise['reject'](_0x56a489);}return _0x38b376[_0x4b3c('0x23')]();};}function saveUpdates(_0x3b5b40,_0x384648){return function(_0x1c59bf){if(_0x1c59bf){return _0x1c59bf[_0x4b3c('0x24')](_0x3b5b40)[_0x4b3c('0x25')](function(_0x54486b){return _0x54486b;});}return null;};}function removeEntity(_0x51840f,_0xf6b7ec){return function(_0x4651d8){if(_0x4651d8){return _0x4651d8[_0x4b3c('0x26')]()['then'](function(){_0x51840f[_0x4b3c('0x1a')](0xcc)[_0x4b3c('0x1b')]();});}};}function handleEntityNotFound(_0x53851a,_0x34664f){return function(_0x3b32ec){if(!_0x3b32ec){_0x53851a['sendStatus'](0x194);}return _0x3b32ec;};}function handleError(_0x50fd66,_0x30a0b3){_0x30a0b3=_0x30a0b3||0x1f4;return function(_0x1a5495){logger[_0x4b3c('0x27')](_0x1a5495['stack']);if(_0x1a5495['name']){delete _0x1a5495['name'];}_0x50fd66[_0x4b3c('0x1a')](_0x30a0b3)['send'](_0x1a5495);};}exports[_0x4b3c('0x28')]=function(_0x31b8d7,_0x57b8df){var _0x27f104={},_0x2f0ea9={},_0x4fcba8={'count':0x0,'rows':[]};var _0x45f9c8=_[_0x4b3c('0x29')](db[_0x4b3c('0x2a')][_0x4b3c('0x2b')],function(_0x2bf618){return{'name':_0x2bf618[_0x4b3c('0x2c')],'type':_0x2bf618[_0x4b3c('0x2d')][_0x4b3c('0x2e')]};});_0x2f0ea9[_0x4b3c('0x2f')]=_[_0x4b3c('0x29')](_0x45f9c8,_0x4b3c('0x30'));_0x2f0ea9[_0x4b3c('0x31')]=_[_0x4b3c('0x32')](_0x31b8d7[_0x4b3c('0x31')]);_0x2f0ea9['filters']=_[_0x4b3c('0x33')](_0x2f0ea9['model'],_0x2f0ea9[_0x4b3c('0x31')]);_0x27f104[_0x4b3c('0x34')]=_[_0x4b3c('0x33')](_0x2f0ea9['model'],qs[_0x4b3c('0x35')](_0x31b8d7[_0x4b3c('0x31')][_0x4b3c('0x35')]));_0x27f104[_0x4b3c('0x34')]=_0x27f104[_0x4b3c('0x34')][_0x4b3c('0x36')]?_0x27f104[_0x4b3c('0x34')]:_0x2f0ea9[_0x4b3c('0x2f')];if(!_0x31b8d7[_0x4b3c('0x31')][_0x4b3c('0x37')](_0x4b3c('0x38'))){_0x27f104['limit']=qs[_0x4b3c('0x1e')](_0x31b8d7[_0x4b3c('0x31')][_0x4b3c('0x1e')]);_0x27f104[_0x4b3c('0x20')]=qs[_0x4b3c('0x20')](_0x31b8d7['query'][_0x4b3c('0x20')]);}_0x27f104[_0x4b3c('0x39')]=qs[_0x4b3c('0x3a')](_0x31b8d7[_0x4b3c('0x31')][_0x4b3c('0x3a')]);_0x27f104[_0x4b3c('0x3b')]=qs[_0x4b3c('0x3c')](_[_0x4b3c('0x3d')](_0x31b8d7[_0x4b3c('0x31')],_0x2f0ea9['filters']),_0x45f9c8);if(_0x31b8d7[_0x4b3c('0x31')]['filter']){_0x27f104[_0x4b3c('0x3b')]=_['merge'](_0x27f104['where'],{'$or':_[_0x4b3c('0x29')](_0x45f9c8,function(_0x5a8bd7){if(_0x5a8bd7[_0x4b3c('0x2d')]!==_0x4b3c('0x3e')){var _0x21000={};_0x21000[_0x5a8bd7[_0x4b3c('0x30')]]={'$like':'%'+_0x31b8d7[_0x4b3c('0x31')][_0x4b3c('0x3f')]+'%'};return _0x21000;}})});}_0x27f104=_[_0x4b3c('0x40')]({},_0x27f104,_0x31b8d7[_0x4b3c('0x41')]);var _0x229430={'where':_0x27f104[_0x4b3c('0x3b')]};return db[_0x4b3c('0x2a')][_0x4b3c('0x1f')](_0x229430)[_0x4b3c('0x25')](function(_0x502de1){_0x4fcba8[_0x4b3c('0x1f')]=_0x502de1;if(_0x31b8d7[_0x4b3c('0x31')]['includeAll']){_0x27f104[_0x4b3c('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x4b3c('0x43')](_0x27f104);})[_0x4b3c('0x25')](function(_0x62cf7e){_0x4fcba8[_0x4b3c('0x44')]=_0x62cf7e;return _0x4fcba8;})['then'](respondWithFilteredResult(_0x57b8df,_0x27f104))[_0x4b3c('0x45')](handleError(_0x57b8df,null));};exports[_0x4b3c('0x46')]=function(_0x22cd7f,_0x54f995){var _0x256362={'raw':![],'where':{'id':_0x22cd7f[_0x4b3c('0x47')]['id']}},_0x1fc22c={};_0x1fc22c[_0x4b3c('0x2f')]=_[_0x4b3c('0x32')](db[_0x4b3c('0x2a')][_0x4b3c('0x2b')]);_0x1fc22c['query']=_[_0x4b3c('0x32')](_0x22cd7f[_0x4b3c('0x31')]);_0x1fc22c[_0x4b3c('0x3c')]=_['intersection'](_0x1fc22c['model'],_0x1fc22c[_0x4b3c('0x31')]);_0x256362[_0x4b3c('0x34')]=_[_0x4b3c('0x33')](_0x1fc22c[_0x4b3c('0x2f')],qs[_0x4b3c('0x35')](_0x22cd7f[_0x4b3c('0x31')]['fields']));_0x256362['attributes']=_0x256362[_0x4b3c('0x34')][_0x4b3c('0x36')]?_0x256362['attributes']:_0x1fc22c['model'];if(_0x22cd7f['query']['includeAll']){_0x256362[_0x4b3c('0x42')]=[{'all':!![]}];}_0x256362=_[_0x4b3c('0x40')]({},_0x256362,_0x22cd7f[_0x4b3c('0x41')]);return db[_0x4b3c('0x2a')]['find'](_0x256362)['then'](handleEntityNotFound(_0x54f995,null))[_0x4b3c('0x25')](respondWithResult(_0x54f995,null))['catch'](handleError(_0x54f995,null));};exports[_0x4b3c('0x48')]=function(_0x657400,_0x567781){return db['SugarcrmAccount']['create'](_0x657400[_0x4b3c('0x49')],{})[_0x4b3c('0x25')](respondWithResult(_0x567781,0xc9))[_0x4b3c('0x45')](handleError(_0x567781,null));};exports[_0x4b3c('0x24')]=function(_0x3af425,_0x46a5ea){if(_0x3af425['body']['id']){delete _0x3af425[_0x4b3c('0x49')]['id'];}return db[_0x4b3c('0x2a')][_0x4b3c('0x4a')]({'where':{'id':_0x3af425[_0x4b3c('0x47')]['id']}})[_0x4b3c('0x25')](handleEntityNotFound(_0x46a5ea,null))[_0x4b3c('0x25')](saveUpdates(_0x3af425[_0x4b3c('0x49')],null))[_0x4b3c('0x25')](respondWithResult(_0x46a5ea,null))['catch'](handleError(_0x46a5ea,null));};exports['destroy']=function(_0x5b1537,_0x46339d){return db['SugarcrmAccount']['find']({'where':{'id':_0x5b1537[_0x4b3c('0x47')]['id']}})[_0x4b3c('0x25')](handleEntityNotFound(_0x46339d,null))[_0x4b3c('0x25')](removeEntity(_0x46339d,null))[_0x4b3c('0x45')](handleError(_0x46339d,null));};exports[_0x4b3c('0x4b')]=function(_0x3b72c6,_0x1c5cf2,_0xc7ff4b){var _0x5664f9={};var _0xe8bb47={};var _0x1602b7;var _0x46c4e1;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3b72c6[_0x4b3c('0x47')]['id']}})[_0x4b3c('0x25')](handleEntityNotFound(_0x1c5cf2,null))[_0x4b3c('0x25')](function(_0x44d7ac){if(_0x44d7ac){_0x1602b7=_0x44d7ac;_0xe8bb47[_0x4b3c('0x2f')]=_[_0x4b3c('0x32')](db[_0x4b3c('0x4c')][_0x4b3c('0x2b')]);_0xe8bb47['query']=_[_0x4b3c('0x32')](_0x3b72c6[_0x4b3c('0x31')]);_0xe8bb47['filters']=_['intersection'](_0xe8bb47['model'],_0xe8bb47[_0x4b3c('0x31')]);_0x5664f9[_0x4b3c('0x34')]=_[_0x4b3c('0x33')](_0xe8bb47[_0x4b3c('0x2f')],qs[_0x4b3c('0x35')](_0x3b72c6[_0x4b3c('0x31')][_0x4b3c('0x35')]));_0x5664f9['attributes']=_0x5664f9[_0x4b3c('0x34')][_0x4b3c('0x36')]?_0x5664f9[_0x4b3c('0x34')]:_0xe8bb47[_0x4b3c('0x2f')];_0x5664f9[_0x4b3c('0x39')]=qs[_0x4b3c('0x3a')](_0x3b72c6[_0x4b3c('0x31')][_0x4b3c('0x3a')]);_0x5664f9[_0x4b3c('0x3b')]=qs[_0x4b3c('0x3c')](_[_0x4b3c('0x3d')](_0x3b72c6['query'],_0xe8bb47[_0x4b3c('0x3c')]));if(_0x3b72c6[_0x4b3c('0x31')]['filter']){_0x5664f9[_0x4b3c('0x3b')]=_[_0x4b3c('0x40')](_0x5664f9['where'],{'$or':_[_0x4b3c('0x29')](_0x5664f9[_0x4b3c('0x34')],function(_0x21c521){var _0x3150b0={};_0x3150b0[_0x21c521]={'$like':'%'+_0x3b72c6['query'][_0x4b3c('0x3f')]+'%'};return _0x3150b0;})});}_0x5664f9=_[_0x4b3c('0x40')]({},_0x5664f9,_0x3b72c6[_0x4b3c('0x41')]);return _0x1602b7[_0x4b3c('0x4b')](_0x5664f9);}})[_0x4b3c('0x25')](function(_0x1700a){if(_0x1700a){_0x46c4e1=_0x1700a[_0x4b3c('0x36')];if(!_0x3b72c6['query'][_0x4b3c('0x37')](_0x4b3c('0x38'))){_0x5664f9[_0x4b3c('0x1e')]=qs[_0x4b3c('0x1e')](_0x3b72c6[_0x4b3c('0x31')][_0x4b3c('0x1e')]);_0x5664f9[_0x4b3c('0x20')]=qs[_0x4b3c('0x20')](_0x3b72c6[_0x4b3c('0x31')]['offset']);}return _0x1602b7['getConfigurations'](_0x5664f9);}})[_0x4b3c('0x25')](function(_0x182021){if(_0x182021){return _0x182021?{'count':_0x46c4e1,'rows':_0x182021}:null;}})[_0x4b3c('0x25')](respondWithResult(_0x1c5cf2,null))[_0x4b3c('0x45')](handleError(_0x1c5cf2,null));};exports[_0x4b3c('0x4d')]=function(_0x568812,_0x4372fd,_0x425ba3){if(_0x568812[_0x4b3c('0x49')]['id']){delete _0x568812[_0x4b3c('0x49')]['id'];}return db[_0x4b3c('0x2a')]['findOne']({'where':{'id':_0x568812['params']['id']}})[_0x4b3c('0x25')](handleEntityNotFound(_0x4372fd,null))['then'](function(_0x5f4d26){if(_0x5f4d26){_0x568812[_0x4b3c('0x49')][_0x4b3c('0x4e')]=_0x5f4d26['id'];_0x568812['body'][_0x4b3c('0x4f')]=integrations[_0x4b3c('0x50')](_0x568812['body']['channel'],_0x568812['body']['type']);_0x568812['body'][_0x4b3c('0x51')]=integrations['getDescriptions'](_0x568812[_0x4b3c('0x49')]['channel'],_0x568812['body'][_0x4b3c('0x2d')]);return db['SugarcrmConfiguration'][_0x4b3c('0x48')](_0x568812[_0x4b3c('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0x4b3c('0x4f')},{'model':db['SugarcrmField'],'as':_0x4b3c('0x51')}]});}return null;})[_0x4b3c('0x25')](respondWithResult(_0x4372fd,null))[_0x4b3c('0x45')](handleError(_0x4372fd,null));};exports[_0x4b3c('0x52')]=function(_0x54d35e,_0x550809,_0x8c533a){var _0x3584da='';var _0x3fa73d=['id',_0x4b3c('0x30'),_0x4b3c('0x53'),_0x4b3c('0x54'),'description',_0x4b3c('0x55'),_0x4b3c('0x56'),'duration_minutes',_0x4b3c('0x57'),_0x4b3c('0x58'),_0x4b3c('0x59'),_0x4b3c('0x5a')];return db[_0x4b3c('0x2a')][_0x4b3c('0x5b')]({'where':{'id':_0x54d35e[_0x4b3c('0x47')]['id']},'attributes':['id',_0x4b3c('0x5c'),_0x4b3c('0x5d'),_0x4b3c('0x5e')]})[_0x4b3c('0x25')](handleEntityNotFound(_0x550809,null))[_0x4b3c('0x25')](function(_0x5535b9){if(_0x5535b9){_0x3584da=_0x5535b9['remoteUri'];var _0x1cce4a=_0x3584da['slice'](-0x1);if(_0x1cce4a==='/'){_0x3584da=_0x3584da[_0x4b3c('0x5f')](0x0,_0x3584da[_0x4b3c('0x60')](_0x1cce4a));}return rp({'method':'POST','uri':util[_0x4b3c('0x61')](_0x4b3c('0x62'),_0x3584da,_0x4b3c('0x63')),'json':!![],'form':{'method':_0x4b3c('0x64'),'input_type':'JSON','response_type':_0x4b3c('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5535b9['username'],'password':_0x5535b9[_0x4b3c('0x5d')],'encryption':_0x4b3c('0x66')},'application':_0x4b3c('0x67')})}});}})[_0x4b3c('0x25')](function(_0x40ca60){if(_0x40ca60&&_0x40ca60['name']!==_0x4b3c('0x68')&&_0x40ca60[_0x4b3c('0x30')]!==_0x4b3c('0x69')){return rp({'method':_0x4b3c('0x6a'),'uri':util[_0x4b3c('0x61')](_0x4b3c('0x62'),_0x3584da,_0x4b3c('0x63')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4b3c('0x6b')]({'session':_0x40ca60['id'],'module_name':_0x4b3c('0x6c')})}})[_0x4b3c('0x25')](function(_0x120c81){if(_0x120c81){var _0x1f995a=_['values'](_0x120c81['module_fields']);_[_0x4b3c('0x6d')](_0x1f995a,function(_0x4a4ecd){return _0x3fa73d[_0x4b3c('0x6e')](_0x4a4ecd[_0x4b3c('0x30')]);});return{'count':_0x1f995a['length'],'rows':_[_0x4b3c('0x29')](_0x1f995a,function(_0x3bf99d){return{'id':_0x3bf99d[_0x4b3c('0x30')],'name':_0x3bf99d['label'],'custom':_[_0x4b3c('0x6f')](_0x3bf99d[_0x4b3c('0x30')],'_c')?!![]:![],'options':_0x3bf99d[_0x4b3c('0x41')]?_[_0x4b3c('0x29')](_['values'](_0x3bf99d['options']),function(_0x24089c){return{'name':_0x24089c[_0x4b3c('0x70')],'value':_0x24089c['name']};}):[]};})};}})['then'](respondWithResult(_0x550809,null))[_0x4b3c('0x45')](function(_0x4559ce){var _0x325371=_0x54d35e[_0x4b3c('0x31')]['test']?0x1f4:_0x4559ce[_0x4b3c('0x71')]||0x1f4;logger[_0x4b3c('0x27')](_0x4b3c('0x72'),_0x4b3c('0x52'),_0x325371,JSON[_0x4b3c('0x6b')](_0x4559ce));delete _0x4559ce[_0x4b3c('0x30')];if(_0x325371===0x191){_0x325371=0x190;}_0x550809[_0x4b3c('0x1a')](_0x325371)[_0x4b3c('0x73')](_0x54d35e[_0x4b3c('0x31')][_0x4b3c('0x74')]?{'message':_0x4b3c('0x75'),'statusCode':_0x4559ce[_0x4b3c('0x71')]}:_0x4559ce);});}else{var _0x3b2661=0x1f4;_0x550809['status'](_0x3b2661)[_0x4b3c('0x73')]({'message':_0x4b3c('0x75'),'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 0489d35..1634872 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 _0x06f7=['./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x06f7,0xd7));var _0x706f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x06f7[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x706f('0x0'));var util=require(_0x706f('0x1'));var logger=require(_0x706f('0x2'))(_0x706f('0x3'));var moment=require(_0x706f('0x4'));var BPromise=require(_0x706f('0x5'));var rp=require(_0x706f('0x6'));var fs=require('fs');var path=require(_0x706f('0x7'));var rimraf=require('rimraf');var config=require(_0x706f('0x8'));var attributes=require(_0x706f('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x706f('0xa')]=function(_0x3f8f3e,_0x30a043){return _0x3f8f3e[_0x706f('0xb')](_0x706f('0xc'),attributes,{'tableName':_0x706f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6059=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2e1cd7,_0x293ea1){var _0x515226=function(_0x816b94){while(--_0x816b94){_0x2e1cd7['push'](_0x2e1cd7['shift']());}};_0x515226(++_0x293ea1);}(_0x6059,0x186));var _0x9605=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x6059[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x9605('0x0'));var util=require(_0x9605('0x1'));var logger=require('../../config/logger')(_0x9605('0x2'));var moment=require(_0x9605('0x3'));var BPromise=require(_0x9605('0x4'));var rp=require(_0x9605('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9605('0x6'));var config=require(_0x9605('0x7'));var attributes=require(_0x9605('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x9605('0x9')]=function(_0x299077,_0x1913de){return _0x299077['define'](_0x9605('0xa'),attributes,{'tableName':_0x9605('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0ee5db4..b914062 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 _0xe6f1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowSugarcrmAccount'];(function(_0x7db4da,_0x1b384d){var _0x4a5198=function(_0x56680f){while(--_0x56680f){_0x7db4da['push'](_0x7db4da['shift']());}};_0x4a5198(++_0x1b384d);}(_0xe6f1,0x1d4));var _0x1e6f=function(_0x3d7f78,_0x17e4d0){_0x3d7f78=_0x3d7f78-0x0;var _0x3bf252=_0xe6f1[_0x3d7f78];return _0x3bf252;};'use strict';var _=require('lodash');var util=require(_0x1e6f('0x0'));var moment=require(_0x1e6f('0x1'));var BPromise=require(_0x1e6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e6f('0x3'));var db=require(_0x1e6f('0x4'))['db'];var utils=require(_0x1e6f('0x5'));var logger=require(_0x1e6f('0x6'))(_0x1e6f('0x7'));var config=require(_0x1e6f('0x8'));var jayson=require(_0x1e6f('0x9'));var client=jayson[_0x1e6f('0xa')][_0x1e6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d7922,_0x435d17,_0x563c4b){return new BPromise(function(_0x460ec3,_0x2eb7e9){return client[_0x1e6f('0xc')](_0x4d7922,_0x563c4b)[_0x1e6f('0xd')](function(_0x34537e){logger['info'](_0x1e6f('0xe'),_0x435d17,'request\x20sent');logger['debug'](_0x1e6f('0xf'),_0x435d17,_0x1e6f('0x10'),JSON[_0x1e6f('0x11')](_0x34537e));if(_0x34537e[_0x1e6f('0x12')]){if(_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x13')]===0x1f4){logger[_0x1e6f('0x12')](_0x1e6f('0xe'),_0x435d17,_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);return _0x2eb7e9(_0x34537e[_0x1e6f('0x12')]['message']);}logger['error'](_0x1e6f('0xe'),_0x435d17,_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);return _0x460ec3(_0x34537e[_0x1e6f('0x12')][_0x1e6f('0x14')]);}else{logger[_0x1e6f('0x15')](_0x1e6f('0xe'),_0x435d17,_0x1e6f('0x10'));_0x460ec3(_0x34537e['result'][_0x1e6f('0x14')]);}})[_0x1e6f('0x16')](function(_0x1ad7d5){logger['error'](_0x1e6f('0xe'),_0x435d17,_0x1ad7d5);_0x2eb7e9(_0x1ad7d5);});});}exports[_0x1e6f('0x17')]=function(_0x2cb441){var _0x141651=this;return new Promise(function(_0x5a75c3,_0x4fb94a){return db[_0x1e6f('0x18')][_0x1e6f('0x19')]({'raw':_0x2cb441[_0x1e6f('0x1a')]?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cb441[_0x1e6f('0x1a')]?_0x2cb441['options'][_0x1e6f('0x1c')]||null:null,'attributes':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')]['attributes']||null:null,'limit':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1d')]||null:null,'include':_0x2cb441['options']?_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x2cb441[_0x1e6f('0x1a')][_0x1e6f('0x1e')],function(_0x528a6c){return{'model':db[_0x528a6c[_0x1e6f('0x20')]],'as':_0x528a6c['as'],'attributes':_0x528a6c[_0x1e6f('0x21')],'include':_0x528a6c[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x528a6c[_0x1e6f('0x1e')],function(_0x41717d){return{'model':db[_0x41717d['model']],'as':_0x41717d['as'],'attributes':_0x41717d['attributes'],'include':_0x41717d[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x41717d['include'],function(_0x220aae){return{'model':db[_0x220aae[_0x1e6f('0x20')]],'as':_0x220aae['as'],'attributes':_0x220aae['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x154e71){logger['info'](_0x1e6f('0x17'),_0x2cb441);logger['debug'](_0x1e6f('0x17'),_0x2cb441,JSON[_0x1e6f('0x11')](_0x154e71));_0x5a75c3(_0x154e71);})[_0x1e6f('0x16')](function(_0x1117e4){logger[_0x1e6f('0x12')](_0x1e6f('0x17'),_0x1117e4['message'],_0x2cb441);_0x4fb94a(_0x141651[_0x1e6f('0x12')](0x1f4,_0x1117e4['message']));});});};exports['ShowSugarcrmAccount']=function(_0x3fdf0e){var _0x58b4b0=this;return new Promise(function(_0x2ae8e8,_0x239ced){return db[_0x1e6f('0x18')][_0x1e6f('0x22')]({'raw':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e['options'][_0x1e6f('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fdf0e['options']?_0x3fdf0e[_0x1e6f('0x1a')][_0x1e6f('0x1c')]||null:null,'attributes':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e[_0x1e6f('0x1a')]['attributes']||null:null,'include':_0x3fdf0e[_0x1e6f('0x1a')]?_0x3fdf0e['options'][_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x3fdf0e[_0x1e6f('0x1a')]['include'],function(_0x44149d){return{'model':db[_0x44149d[_0x1e6f('0x20')]],'as':_0x44149d['as'],'attributes':_0x44149d[_0x1e6f('0x21')],'include':_0x44149d[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x44149d['include'],function(_0x47d75b){return{'model':db[_0x47d75b['model']],'as':_0x47d75b['as'],'attributes':_0x47d75b['attributes'],'include':_0x47d75b[_0x1e6f('0x1e')]?_[_0x1e6f('0x1f')](_0x47d75b[_0x1e6f('0x1e')],function(_0x792a4e){return{'model':db[_0x792a4e[_0x1e6f('0x20')]],'as':_0x792a4e['as'],'attributes':_0x792a4e[_0x1e6f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1e6f('0xd')](function(_0x502c70){logger['info'](_0x1e6f('0x23'),_0x3fdf0e);logger['debug'](_0x1e6f('0x23'),_0x3fdf0e,JSON['stringify'](_0x502c70));_0x2ae8e8(_0x502c70);})[_0x1e6f('0x16')](function(_0x152b3d){logger['error']('ShowSugarcrmAccount',_0x152b3d[_0x1e6f('0x14')],_0x3fdf0e);_0x239ced(_0x58b4b0[_0x1e6f('0x12')](0x1f4,_0x152b3d[_0x1e6f('0x14')]));});});}; \ No newline at end of file +var _0xeff7=['raw','attributes','limit','map','model','include','catch','ShowSugarcrmAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0xeff7,0x17b));var _0x7eff=function(_0x101634,_0x40c0b2){_0x101634=_0x101634-0x0;var _0x3ab53c=_0xeff7[_0x101634];return _0x3ab53c;};'use strict';var _=require(_0x7eff('0x0'));var util=require(_0x7eff('0x1'));var moment=require(_0x7eff('0x2'));var BPromise=require(_0x7eff('0x3'));var rs=require(_0x7eff('0x4'));var fs=require('fs');var Redis=require(_0x7eff('0x5'));var db=require(_0x7eff('0x6'))['db'];var utils=require(_0x7eff('0x7'));var logger=require(_0x7eff('0x8'))(_0x7eff('0x9'));var config=require(_0x7eff('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7eff('0xb')][_0x7eff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55bdb5,_0x4e721e,_0x2d8a63){return new BPromise(function(_0x314164,_0x58cbbb){return client[_0x7eff('0xd')](_0x55bdb5,_0x2d8a63)[_0x7eff('0xe')](function(_0x52e601){logger['info'](_0x7eff('0xf'),_0x4e721e,_0x7eff('0x10'));logger[_0x7eff('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4e721e,_0x7eff('0x10'),JSON[_0x7eff('0x12')](_0x52e601));if(_0x52e601['error']){if(_0x52e601[_0x7eff('0x13')][_0x7eff('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4e721e,_0x52e601[_0x7eff('0x13')]['message']);return _0x58cbbb(_0x52e601[_0x7eff('0x13')][_0x7eff('0x15')]);}logger['error'](_0x7eff('0xf'),_0x4e721e,_0x52e601[_0x7eff('0x13')][_0x7eff('0x15')]);return _0x314164(_0x52e601[_0x7eff('0x13')][_0x7eff('0x15')]);}else{logger[_0x7eff('0x16')]('SugarcrmAccount,\x20%s,\x20%s',_0x4e721e,_0x7eff('0x10'));_0x314164(_0x52e601[_0x7eff('0x17')]['message']);}})['catch'](function(_0x2c4b2b){logger[_0x7eff('0x13')](_0x7eff('0xf'),_0x4e721e,_0x2c4b2b);_0x58cbbb(_0x2c4b2b);});});}exports[_0x7eff('0x18')]=function(_0x3a94ce){var _0x4f1207=this;return new Promise(function(_0x37bd09,_0x40dc06){return db[_0x7eff('0x19')][_0x7eff('0x1a')]({'raw':_0x3a94ce[_0x7eff('0x1b')]?_0x3a94ce[_0x7eff('0x1b')][_0x7eff('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a94ce[_0x7eff('0x1b')]?_0x3a94ce[_0x7eff('0x1b')]['where']||null:null,'attributes':_0x3a94ce['options']?_0x3a94ce[_0x7eff('0x1b')][_0x7eff('0x1d')]||null:null,'limit':_0x3a94ce['options']?_0x3a94ce[_0x7eff('0x1b')][_0x7eff('0x1e')]||null:null,'include':_0x3a94ce[_0x7eff('0x1b')]?_0x3a94ce[_0x7eff('0x1b')]['include']?_[_0x7eff('0x1f')](_0x3a94ce[_0x7eff('0x1b')]['include'],function(_0x368bc5){return{'model':db[_0x368bc5[_0x7eff('0x20')]],'as':_0x368bc5['as'],'attributes':_0x368bc5[_0x7eff('0x1d')],'include':_0x368bc5[_0x7eff('0x21')]?_['map'](_0x368bc5[_0x7eff('0x21')],function(_0x5e9265){return{'model':db[_0x5e9265['model']],'as':_0x5e9265['as'],'attributes':_0x5e9265['attributes'],'include':_0x5e9265[_0x7eff('0x21')]?_[_0x7eff('0x1f')](_0x5e9265[_0x7eff('0x21')],function(_0x3bdae9){return{'model':db[_0x3bdae9[_0x7eff('0x20')]],'as':_0x3bdae9['as'],'attributes':_0x3bdae9['attributes']};}):[]};}):[]};}):[]:[]})[_0x7eff('0xe')](function(_0x112cd4){logger[_0x7eff('0x16')](_0x7eff('0x18'),_0x3a94ce);logger[_0x7eff('0x11')]('GetSugarcrmAccount',_0x3a94ce,JSON[_0x7eff('0x12')](_0x112cd4));_0x37bd09(_0x112cd4);})[_0x7eff('0x22')](function(_0x54195a){logger[_0x7eff('0x13')](_0x7eff('0x18'),_0x54195a[_0x7eff('0x15')],_0x3a94ce);_0x40dc06(_0x4f1207['error'](0x1f4,_0x54195a[_0x7eff('0x15')]));});});};exports[_0x7eff('0x23')]=function(_0x57d7ac){var _0x54a375=this;return new Promise(function(_0xdcd626,_0x5796b6){return db[_0x7eff('0x19')]['find']({'raw':_0x57d7ac[_0x7eff('0x1b')]?_0x57d7ac[_0x7eff('0x1b')][_0x7eff('0x1c')]===undefined?!![]:![]:!![],'where':_0x57d7ac[_0x7eff('0x1b')]?_0x57d7ac[_0x7eff('0x1b')][_0x7eff('0x24')]||null:null,'attributes':_0x57d7ac[_0x7eff('0x1b')]?_0x57d7ac[_0x7eff('0x1b')][_0x7eff('0x1d')]||null:null,'include':_0x57d7ac['options']?_0x57d7ac[_0x7eff('0x1b')]['include']?_[_0x7eff('0x1f')](_0x57d7ac[_0x7eff('0x1b')][_0x7eff('0x21')],function(_0x17375c){return{'model':db[_0x17375c[_0x7eff('0x20')]],'as':_0x17375c['as'],'attributes':_0x17375c[_0x7eff('0x1d')],'include':_0x17375c[_0x7eff('0x21')]?_[_0x7eff('0x1f')](_0x17375c[_0x7eff('0x21')],function(_0x63370d){return{'model':db[_0x63370d[_0x7eff('0x20')]],'as':_0x63370d['as'],'attributes':_0x63370d[_0x7eff('0x1d')],'include':_0x63370d[_0x7eff('0x21')]?_[_0x7eff('0x1f')](_0x63370d[_0x7eff('0x21')],function(_0x2640f3){return{'model':db[_0x2640f3[_0x7eff('0x20')]],'as':_0x2640f3['as'],'attributes':_0x2640f3[_0x7eff('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7eff('0xe')](function(_0x672420){logger['info'](_0x7eff('0x23'),_0x57d7ac);logger['debug'](_0x7eff('0x23'),_0x57d7ac,JSON['stringify'](_0x672420));_0xdcd626(_0x672420);})['catch'](function(_0x60a9e3){logger[_0x7eff('0x13')](_0x7eff('0x23'),_0x60a9e3[_0x7eff('0x15')],_0x57d7ac);_0x5796b6(_0x54a375['error'](0x1f4,_0x60a9e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4bd7d7e..4c132b5 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 _0xe5eb=['isAuthenticated','index','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x33055f,_0x24cf57){var _0x8dae2e=function(_0x253a94){while(--_0x253a94){_0x33055f['push'](_0x33055f['shift']());}};_0x8dae2e(++_0x24cf57);}(_0xe5eb,0x19b));var _0xbe5e=function(_0x33dc51,_0x1d6b24){_0x33dc51=_0x33dc51-0x0;var _0x5bbd34=_0xe5eb[_0x33dc51];return _0x5bbd34;};'use strict';var multer=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe5e('0x2'));var router=express[_0xbe5e('0x3')]();var fs_extra=require(_0xbe5e('0x4'));var auth=require(_0xbe5e('0x5'));var interaction=require(_0xbe5e('0x6'));var config=require('../../config/environment');var controller=require(_0xbe5e('0x7'));router[_0xbe5e('0x8')]('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xa')]);router[_0xbe5e('0x8')]('/:id',auth[_0xbe5e('0x9')](),controller['show']);router[_0xbe5e('0x8')]('/:id/fields',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xb')]);router[_0xbe5e('0x8')](_0xbe5e('0xc'),auth['isAuthenticated'](),controller[_0xbe5e('0xd')]);router[_0xbe5e('0x8')]('/:id/descriptions',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0xe')]);router[_0xbe5e('0xf')]('/',auth[_0xbe5e('0x9')](),controller[_0xbe5e('0x10')]);router[_0xbe5e('0x11')](_0xbe5e('0x12'),auth['isAuthenticated'](),controller[_0xbe5e('0x13')]);router[_0xbe5e('0x14')](_0xbe5e('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcd94=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','/:id','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x382f8e,_0x164e01){var _0x2fe7cb=function(_0x324708){while(--_0x324708){_0x382f8e['push'](_0x382f8e['shift']());}};_0x2fe7cb(++_0x164e01);}(_0xcd94,0x1ee));var _0x4cd9=function(_0x280a2e,_0x244c6f){_0x280a2e=_0x280a2e-0x0;var _0x286f67=_0xcd94[_0x280a2e];return _0x286f67;};'use strict';var multer=require(_0x4cd9('0x0'));var util=require(_0x4cd9('0x1'));var path=require(_0x4cd9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4cd9('0x3')]();var fs_extra=require(_0x4cd9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4cd9('0x5'));var config=require(_0x4cd9('0x6'));var controller=require(_0x4cd9('0x7'));router[_0x4cd9('0x8')]('/',auth[_0x4cd9('0x9')](),controller[_0x4cd9('0xa')]);router[_0x4cd9('0x8')]('/:id',auth[_0x4cd9('0x9')](),controller[_0x4cd9('0xb')]);router[_0x4cd9('0x8')](_0x4cd9('0xc'),auth['isAuthenticated'](),controller[_0x4cd9('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x4cd9('0xe')]);router[_0x4cd9('0x8')](_0x4cd9('0xf'),auth['isAuthenticated'](),controller[_0x4cd9('0x10')]);router['post']('/',auth[_0x4cd9('0x9')](),controller[_0x4cd9('0x11')]);router['put'](_0x4cd9('0x12'),auth[_0x4cd9('0x9')](),controller['update']);router[_0x4cd9('0x13')]('/:id',auth[_0x4cd9('0x9')](),controller[_0x4cd9('0x14')]);module[_0x4cd9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index eaf214d..67fdb56 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 _0xa7df=['exports','STRING'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xa7df,0xf0));var _0xfa7d=function(_0x1b030d,_0x33bdf4){_0x1b030d=_0x1b030d-0x0;var _0x1be548=_0xa7df[_0x1b030d];return _0x1be548;};'use strict';var Sequelize=require('sequelize');module[_0xfa7d('0x0')]={'name':{'type':Sequelize[_0xfa7d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x940c=['exports','STRING','sequelize'];(function(_0x28be65,_0x32f3e8){var _0x3f4707=function(_0x1876c1){while(--_0x1876c1){_0x28be65['push'](_0x28be65['shift']());}};_0x3f4707(++_0x32f3e8);}(_0x940c,0x19a));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc940('0x0'));module[_0xc940('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc940('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 45ee20c..85647e1 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 _0x42be=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','key','map','query','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','fields','find','create','body','catch','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x590678,_0x35aa33){var _0xfd7bca=function(_0x2ae17a){while(--_0x2ae17a){_0x590678['push'](_0x590678['shift']());}};_0xfd7bca(++_0x35aa33);}(_0x42be,0xe5));var _0xe42b=function(_0x20c865,_0x8f8ec2){_0x20c865=_0x20c865-0x0;var _0x3369b4=_0x42be[_0x20c865];return _0x3369b4;};'use strict';var emlformat=require(_0xe42b('0x0'));var rimraf=require(_0xe42b('0x1'));var zipdir=require(_0xe42b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe42b('0x3'));var moment=require(_0xe42b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe42b('0x5'));var util=require('util');var path=require(_0xe42b('0x6'));var sox=require(_0xe42b('0x7'));var csv=require(_0xe42b('0x8'));var ejs=require(_0xe42b('0x9'));var fs=require('fs');var fs_extra=require(_0xe42b('0xa'));var _=require(_0xe42b('0xb'));var squel=require(_0xe42b('0xc'));var crypto=require(_0xe42b('0xd'));var jsforce=require(_0xe42b('0xe'));var deskjs=require(_0xe42b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe42b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe42b('0x11'));var authService=require(_0xe42b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe42b('0x13'));var hardwareService=require(_0xe42b('0x14'));var logger=require(_0xe42b('0x15'))('api');var utils=require(_0xe42b('0x16'));var config=require(_0xe42b('0x17'));var licenseUtil=require(_0xe42b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c165a,_0x4a6909){_0x4a6909=_0x4a6909||0xcc;return function(_0x3a9d64){if(_0x3a9d64){return _0x3c165a['sendStatus'](_0x4a6909);}return _0x3c165a[_0xe42b('0x19')](_0x4a6909)[_0xe42b('0x1a')]();};}function respondWithResult(_0x297b26,_0xa788a){_0xa788a=_0xa788a||0xc8;return function(_0x308664){if(_0x308664){return _0x297b26[_0xe42b('0x19')](_0xa788a)[_0xe42b('0x1b')](_0x308664);}};}function respondWithFilteredResult(_0xba51df,_0x388397){return function(_0x1d6271){if(_0x1d6271){var _0x5122c7=typeof _0x388397[_0xe42b('0x1c')]===_0xe42b('0x1d')&&typeof _0x388397[_0xe42b('0x1e')]===_0xe42b('0x1d');var _0x405fe6=_0x1d6271[_0xe42b('0x1f')];var _0x287736=_0x5122c7?0x0:_0x388397['offset'];var _0x5d2272=_0x5122c7?_0x1d6271['count']:_0x388397[_0xe42b('0x1c')]+_0x388397[_0xe42b('0x1e')];var _0xd17ae3;if(_0x5d2272>=_0x405fe6){_0x5d2272=_0x405fe6;_0xd17ae3=0xc8;}else{_0xd17ae3=0xce;}_0xba51df[_0xe42b('0x19')](_0xd17ae3);return _0xba51df[_0xe42b('0x20')](_0xe42b('0x21'),_0x287736+'-'+_0x5d2272+'/'+_0x405fe6)[_0xe42b('0x1b')](_0x1d6271);}return null;};}function patchUpdates(_0x4cabd9){return function(_0x2aa399){try{jsonpatch[_0xe42b('0x22')](_0x2aa399,_0x4cabd9,!![]);}catch(_0x4f0c5b){return BPromise[_0xe42b('0x23')](_0x4f0c5b);}return _0x2aa399['save']();};}function saveUpdates(_0x3515f0,_0x19ecc1){return function(_0x1687c4){if(_0x1687c4){return _0x1687c4[_0xe42b('0x24')](_0x3515f0)[_0xe42b('0x25')](function(_0x2953cf){return _0x2953cf;});}return null;};}function removeEntity(_0x344dc3,_0x14ea23){return function(_0x42663e){if(_0x42663e){return _0x42663e[_0xe42b('0x26')]()['then'](function(){_0x344dc3[_0xe42b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x588f35,_0x148dbe){return function(_0x9ff601){if(!_0x9ff601){_0x588f35[_0xe42b('0x27')](0x194);}return _0x9ff601;};}function handleError(_0x5d7831,_0x130861){_0x130861=_0x130861||0x1f4;return function(_0x224e44){logger[_0xe42b('0x28')](_0x224e44[_0xe42b('0x29')]);if(_0x224e44[_0xe42b('0x2a')]){delete _0x224e44[_0xe42b('0x2a')];}_0x5d7831['status'](_0x130861)[_0xe42b('0x2b')](_0x224e44);};}exports['index']=function(_0x120bc1,_0x495877){var _0x5dc867={},_0x15b359={},_0x560b95={'count':0x0,'rows':[]};var _0x59e82c=_['map'](db[_0xe42b('0x2c')][_0xe42b('0x2d')],function(_0x196b94){return{'name':_0x196b94[_0xe42b('0x2e')],'type':_0x196b94['type'][_0xe42b('0x2f')]};});_0x15b359['model']=_[_0xe42b('0x30')](_0x59e82c,_0xe42b('0x2a'));_0x15b359[_0xe42b('0x31')]=_['keys'](_0x120bc1[_0xe42b('0x31')]);_0x15b359['filters']=_[_0xe42b('0x32')](_0x15b359[_0xe42b('0x33')],_0x15b359[_0xe42b('0x31')]);_0x5dc867['attributes']=_[_0xe42b('0x32')](_0x15b359[_0xe42b('0x33')],qs['fields'](_0x120bc1[_0xe42b('0x31')]['fields']));_0x5dc867[_0xe42b('0x34')]=_0x5dc867[_0xe42b('0x34')][_0xe42b('0x35')]?_0x5dc867[_0xe42b('0x34')]:_0x15b359[_0xe42b('0x33')];if(!_0x120bc1[_0xe42b('0x31')][_0xe42b('0x36')](_0xe42b('0x37'))){_0x5dc867['limit']=qs[_0xe42b('0x1e')](_0x120bc1[_0xe42b('0x31')][_0xe42b('0x1e')]);_0x5dc867[_0xe42b('0x1c')]=qs['offset'](_0x120bc1['query']['offset']);}_0x5dc867[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x120bc1[_0xe42b('0x31')][_0xe42b('0x39')]);_0x5dc867[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_[_0xe42b('0x3c')](_0x120bc1['query'],_0x15b359[_0xe42b('0x3b')]),_0x59e82c);if(_0x120bc1[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x5dc867[_0xe42b('0x3a')]=_[_0xe42b('0x3e')](_0x5dc867[_0xe42b('0x3a')],{'$or':_['map'](_0x59e82c,function(_0x15f179){if(_0x15f179[_0xe42b('0x3f')]!==_0xe42b('0x40')){var _0xbeafd5={};_0xbeafd5[_0x15f179[_0xe42b('0x2a')]]={'$like':'%'+_0x120bc1['query']['filter']+'%'};return _0xbeafd5;}})});}_0x5dc867=_['merge']({},_0x5dc867,_0x120bc1[_0xe42b('0x41')]);var _0x23cf18={'where':_0x5dc867[_0xe42b('0x3a')]};return db[_0xe42b('0x2c')][_0xe42b('0x1f')](_0x23cf18)[_0xe42b('0x25')](function(_0x30d393){_0x560b95['count']=_0x30d393;if(_0x120bc1[_0xe42b('0x31')][_0xe42b('0x42')]){_0x5dc867[_0xe42b('0x43')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5dc867);})[_0xe42b('0x25')](function(_0x5f98cb){_0x560b95[_0xe42b('0x44')]=_0x5f98cb;return _0x560b95;})[_0xe42b('0x25')](respondWithFilteredResult(_0x495877,_0x5dc867))['catch'](handleError(_0x495877,null));};exports[_0xe42b('0x45')]=function(_0x2f4b23,_0x138d78){var _0x83c9df={'raw':![],'where':{'id':_0x2f4b23[_0xe42b('0x46')]['id']}},_0x410862={};_0x410862[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x2c')][_0xe42b('0x2d')]);_0x410862[_0xe42b('0x31')]=_[_0xe42b('0x47')](_0x2f4b23[_0xe42b('0x31')]);_0x410862[_0xe42b('0x3b')]=_['intersection'](_0x410862[_0xe42b('0x33')],_0x410862[_0xe42b('0x31')]);_0x83c9df[_0xe42b('0x34')]=_['intersection'](_0x410862[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x2f4b23[_0xe42b('0x31')][_0xe42b('0x48')]));_0x83c9df[_0xe42b('0x34')]=_0x83c9df[_0xe42b('0x34')][_0xe42b('0x35')]?_0x83c9df[_0xe42b('0x34')]:_0x410862[_0xe42b('0x33')];if(_0x2f4b23[_0xe42b('0x31')]['includeAll']){_0x83c9df['include']=[{'all':!![]}];}_0x83c9df=_[_0xe42b('0x3e')]({},_0x83c9df,_0x2f4b23[_0xe42b('0x41')]);return db['SugarcrmConfiguration'][_0xe42b('0x49')](_0x83c9df)[_0xe42b('0x25')](handleEntityNotFound(_0x138d78,null))[_0xe42b('0x25')](respondWithResult(_0x138d78,null))['catch'](handleError(_0x138d78,null));};exports[_0xe42b('0x4a')]=function(_0x3ff3f3,_0x43f862){return db[_0xe42b('0x2c')][_0xe42b('0x4a')](_0x3ff3f3[_0xe42b('0x4b')],{})['then'](respondWithResult(_0x43f862,0xc9))[_0xe42b('0x4c')](handleError(_0x43f862,null));};exports[_0xe42b('0x24')]=function(_0x54517f,_0x1355ec){if(_0x54517f[_0xe42b('0x4b')]['id']){delete _0x54517f[_0xe42b('0x4b')]['id'];}return db[_0xe42b('0x2c')][_0xe42b('0x49')]({'where':{'id':_0x54517f[_0xe42b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1355ec,null))[_0xe42b('0x25')](saveUpdates(_0x54517f['body'],null))[_0xe42b('0x25')](respondWithResult(_0x1355ec,null))[_0xe42b('0x4c')](handleError(_0x1355ec,null));};exports[_0xe42b('0x26')]=function(_0x354242,_0xa3c7f3){return db[_0xe42b('0x2c')][_0xe42b('0x49')]({'where':{'id':_0x354242[_0xe42b('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3c7f3,null))[_0xe42b('0x25')](removeEntity(_0xa3c7f3,null))['catch'](handleError(_0xa3c7f3,null));};exports[_0xe42b('0x4d')]=function(_0x1b7734,_0xf8bb97,_0x28e350){var _0x203d9c={};var _0x150bc2={};var _0x419734;var _0x392a3b;return db[_0xe42b('0x2c')][_0xe42b('0x4e')]({'where':{'id':_0x1b7734[_0xe42b('0x46')]['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0xf8bb97,null))['then'](function(_0x647f4e){if(_0x647f4e){_0x419734=_0x647f4e;_0x150bc2['model']=_[_0xe42b('0x47')](db[_0xe42b('0x4f')][_0xe42b('0x2d')]);_0x150bc2[_0xe42b('0x31')]=_['keys'](_0x1b7734[_0xe42b('0x31')]);_0x150bc2[_0xe42b('0x3b')]=_['intersection'](_0x150bc2[_0xe42b('0x33')],_0x150bc2[_0xe42b('0x31')]);_0x203d9c['attributes']=_['intersection'](_0x150bc2[_0xe42b('0x33')],qs['fields'](_0x1b7734[_0xe42b('0x31')]['fields']));_0x203d9c[_0xe42b('0x34')]=_0x203d9c['attributes'][_0xe42b('0x35')]?_0x203d9c[_0xe42b('0x34')]:_0x150bc2[_0xe42b('0x33')];_0x203d9c[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x1b7734[_0xe42b('0x31')]['sort']);_0x203d9c[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_['pick'](_0x1b7734[_0xe42b('0x31')],_0x150bc2[_0xe42b('0x3b')]));if(_0x1b7734[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x203d9c['where']=_[_0xe42b('0x3e')](_0x203d9c[_0xe42b('0x3a')],{'$or':_[_0xe42b('0x30')](_0x203d9c[_0xe42b('0x34')],function(_0x59a845){var _0x5d3eb7={};_0x5d3eb7[_0x59a845]={'$like':'%'+_0x1b7734['query'][_0xe42b('0x3d')]+'%'};return _0x5d3eb7;})});}_0x203d9c=_[_0xe42b('0x3e')]({},_0x203d9c,_0x1b7734[_0xe42b('0x41')]);return _0x419734[_0xe42b('0x4d')](_0x203d9c);}})['then'](function(_0x1ece7f){if(_0x1ece7f){_0x392a3b=_0x1ece7f[_0xe42b('0x35')];if(!_0x1b7734['query']['hasOwnProperty']('nolimit')){_0x203d9c[_0xe42b('0x1e')]=qs[_0xe42b('0x1e')](_0x1b7734['query'][_0xe42b('0x1e')]);_0x203d9c[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x1b7734[_0xe42b('0x31')]['offset']);}return _0x419734[_0xe42b('0x4d')](_0x203d9c);}})[_0xe42b('0x25')](function(_0x3f3cca){if(_0x3f3cca){return _0x3f3cca?{'count':_0x392a3b,'rows':_0x3f3cca}:null;}})[_0xe42b('0x25')](respondWithResult(_0xf8bb97,null))[_0xe42b('0x4c')](handleError(_0xf8bb97,null));};exports['getSubjects']=function(_0x3ad922,_0x17fd41,_0xccd029){var _0x2c5eee={};var _0x22ab84={};var _0x1af563;var _0x4894a3;return db[_0xe42b('0x2c')][_0xe42b('0x4e')]({'where':{'id':_0x3ad922[_0xe42b('0x46')]['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0x17fd41,null))[_0xe42b('0x25')](function(_0x321897){if(_0x321897){_0x1af563=_0x321897;_0x22ab84[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x4f')]['rawAttributes']);_0x22ab84['query']=_[_0xe42b('0x47')](_0x3ad922[_0xe42b('0x31')]);_0x22ab84[_0xe42b('0x3b')]=_[_0xe42b('0x32')](_0x22ab84[_0xe42b('0x33')],_0x22ab84['query']);_0x2c5eee[_0xe42b('0x34')]=_[_0xe42b('0x32')](_0x22ab84[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x3ad922[_0xe42b('0x31')][_0xe42b('0x48')]));_0x2c5eee[_0xe42b('0x34')]=_0x2c5eee[_0xe42b('0x34')]['length']?_0x2c5eee['attributes']:_0x22ab84['model'];_0x2c5eee['order']=qs['sort'](_0x3ad922['query'][_0xe42b('0x39')]);_0x2c5eee['where']=qs[_0xe42b('0x3b')](_[_0xe42b('0x3c')](_0x3ad922[_0xe42b('0x31')],_0x22ab84['filters']));if(_0x3ad922[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x2c5eee['where']=_['merge'](_0x2c5eee[_0xe42b('0x3a')],{'$or':_['map'](_0x2c5eee[_0xe42b('0x34')],function(_0x3ed7f6){var _0x312fcb={};_0x312fcb[_0x3ed7f6]={'$like':'%'+_0x3ad922[_0xe42b('0x31')][_0xe42b('0x3d')]+'%'};return _0x312fcb;})});}_0x2c5eee=_[_0xe42b('0x3e')]({},_0x2c5eee,_0x3ad922[_0xe42b('0x41')]);return _0x1af563[_0xe42b('0x50')](_0x2c5eee);}})['then'](function(_0x3b0537){if(_0x3b0537){_0x4894a3=_0x3b0537['length'];if(!_0x3ad922['query'][_0xe42b('0x36')](_0xe42b('0x37'))){_0x2c5eee[_0xe42b('0x1e')]=qs[_0xe42b('0x1e')](_0x3ad922[_0xe42b('0x31')]['limit']);_0x2c5eee[_0xe42b('0x1c')]=qs[_0xe42b('0x1c')](_0x3ad922['query'][_0xe42b('0x1c')]);}return _0x1af563['getSubjects'](_0x2c5eee);}})[_0xe42b('0x25')](function(_0x21473b){if(_0x21473b){return _0x21473b?{'count':_0x4894a3,'rows':_0x21473b}:null;}})[_0xe42b('0x25')](respondWithResult(_0x17fd41,null))[_0xe42b('0x4c')](handleError(_0x17fd41,null));};exports[_0xe42b('0x51')]=function(_0x5668c2,_0x3a192b,_0x4c7297){var _0x1bb9a3={};var _0x3ad34={};var _0x1c7468;var _0x2ae725;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5668c2['params']['id']}})[_0xe42b('0x25')](handleEntityNotFound(_0x3a192b,null))[_0xe42b('0x25')](function(_0x423c36){if(_0x423c36){_0x1c7468=_0x423c36;_0x3ad34[_0xe42b('0x33')]=_[_0xe42b('0x47')](db[_0xe42b('0x4f')]['rawAttributes']);_0x3ad34[_0xe42b('0x31')]=_[_0xe42b('0x47')](_0x5668c2[_0xe42b('0x31')]);_0x3ad34[_0xe42b('0x3b')]=_[_0xe42b('0x32')](_0x3ad34[_0xe42b('0x33')],_0x3ad34[_0xe42b('0x31')]);_0x1bb9a3[_0xe42b('0x34')]=_[_0xe42b('0x32')](_0x3ad34[_0xe42b('0x33')],qs[_0xe42b('0x48')](_0x5668c2[_0xe42b('0x31')]['fields']));_0x1bb9a3[_0xe42b('0x34')]=_0x1bb9a3[_0xe42b('0x34')][_0xe42b('0x35')]?_0x1bb9a3[_0xe42b('0x34')]:_0x3ad34['model'];_0x1bb9a3[_0xe42b('0x38')]=qs[_0xe42b('0x39')](_0x5668c2[_0xe42b('0x31')]['sort']);_0x1bb9a3[_0xe42b('0x3a')]=qs[_0xe42b('0x3b')](_['pick'](_0x5668c2[_0xe42b('0x31')],_0x3ad34[_0xe42b('0x3b')]));if(_0x5668c2[_0xe42b('0x31')][_0xe42b('0x3d')]){_0x1bb9a3[_0xe42b('0x3a')]=_[_0xe42b('0x3e')](_0x1bb9a3[_0xe42b('0x3a')],{'$or':_[_0xe42b('0x30')](_0x1bb9a3['attributes'],function(_0x450979){var _0x2dd0a7={};_0x2dd0a7[_0x450979]={'$like':'%'+_0x5668c2['query'][_0xe42b('0x3d')]+'%'};return _0x2dd0a7;})});}_0x1bb9a3=_['merge']({},_0x1bb9a3,_0x5668c2[_0xe42b('0x41')]);return _0x1c7468[_0xe42b('0x51')](_0x1bb9a3);}})[_0xe42b('0x25')](function(_0x14bcb8){if(_0x14bcb8){_0x2ae725=_0x14bcb8[_0xe42b('0x35')];if(!_0x5668c2[_0xe42b('0x31')][_0xe42b('0x36')](_0xe42b('0x37'))){_0x1bb9a3['limit']=qs[_0xe42b('0x1e')](_0x5668c2[_0xe42b('0x31')]['limit']);_0x1bb9a3[_0xe42b('0x1c')]=qs['offset'](_0x5668c2['query'][_0xe42b('0x1c')]);}return _0x1c7468[_0xe42b('0x51')](_0x1bb9a3);}})[_0xe42b('0x25')](function(_0x4e265d){if(_0x4e265d){return _0x4e265d?{'count':_0x2ae725,'rows':_0x4e265d}:null;}})['then'](respondWithResult(_0x3a192b,null))['catch'](handleError(_0x3a192b,null));}; \ No newline at end of file +var _0xda7b=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','SugarcrmField','getFields','getSubjects','findOne','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x2ff5f2,_0x292be9){var _0x17f937=function(_0x12aa28){while(--_0x12aa28){_0x2ff5f2['push'](_0x2ff5f2['shift']());}};_0x17f937(++_0x292be9);}(_0xda7b,0xdd));var _0xbda7=function(_0x1019e7,_0xb4147a){_0x1019e7=_0x1019e7-0x0;var _0x527b17=_0xda7b[_0x1019e7];return _0x527b17;};'use strict';var emlformat=require(_0xbda7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbda7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbda7('0x2'));var moment=require(_0xbda7('0x3'));var BPromise=require(_0xbda7('0x4'));var Mustache=require(_0xbda7('0x5'));var util=require('util');var path=require(_0xbda7('0x6'));var sox=require(_0xbda7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbda7('0x8'));var _=require(_0xbda7('0x9'));var squel=require(_0xbda7('0xa'));var crypto=require(_0xbda7('0xb'));var jsforce=require(_0xbda7('0xc'));var deskjs=require(_0xbda7('0xd'));var toCsv=require(_0xbda7('0xe'));var querystring=require(_0xbda7('0xf'));var Papa=require(_0xbda7('0x10'));var Redis=require(_0xbda7('0x11'));var authService=require(_0xbda7('0x12'));var qs=require(_0xbda7('0x13'));var as=require(_0xbda7('0x14'));var hardwareService=require(_0xbda7('0x15'));var logger=require('../../config/logger')(_0xbda7('0x16'));var utils=require(_0xbda7('0x17'));var config=require(_0xbda7('0x18'));var licenseUtil=require(_0xbda7('0x19'));var db=require(_0xbda7('0x1a'))['db'];function respondWithStatusCode(_0x147605,_0x53f694){_0x53f694=_0x53f694||0xcc;return function(_0x40858b){if(_0x40858b){return _0x147605[_0xbda7('0x1b')](_0x53f694);}return _0x147605[_0xbda7('0x1c')](_0x53f694)[_0xbda7('0x1d')]();};}function respondWithResult(_0x1ba6fe,_0x3cc7e5){_0x3cc7e5=_0x3cc7e5||0xc8;return function(_0x5036cc){if(_0x5036cc){return _0x1ba6fe['status'](_0x3cc7e5)[_0xbda7('0x1e')](_0x5036cc);}};}function respondWithFilteredResult(_0x2e3f03,_0x4dcd61){return function(_0xa8d684){if(_0xa8d684){var _0x119d7f=typeof _0x4dcd61[_0xbda7('0x1f')]==='undefined'&&typeof _0x4dcd61['limit']===_0xbda7('0x20');var _0x2cb5d2=_0xa8d684[_0xbda7('0x21')];var _0x227741=_0x119d7f?0x0:_0x4dcd61[_0xbda7('0x1f')];var _0x29bdc4=_0x119d7f?_0xa8d684[_0xbda7('0x21')]:_0x4dcd61['offset']+_0x4dcd61[_0xbda7('0x22')];var _0x5c5d76;if(_0x29bdc4>=_0x2cb5d2){_0x29bdc4=_0x2cb5d2;_0x5c5d76=0xc8;}else{_0x5c5d76=0xce;}_0x2e3f03[_0xbda7('0x1c')](_0x5c5d76);return _0x2e3f03[_0xbda7('0x23')](_0xbda7('0x24'),_0x227741+'-'+_0x29bdc4+'/'+_0x2cb5d2)[_0xbda7('0x1e')](_0xa8d684);}return null;};}function patchUpdates(_0x125672){return function(_0xb6fc38){try{jsonpatch[_0xbda7('0x25')](_0xb6fc38,_0x125672,!![]);}catch(_0x124e88){return BPromise[_0xbda7('0x26')](_0x124e88);}return _0xb6fc38[_0xbda7('0x27')]();};}function saveUpdates(_0x26b77a,_0x35bdb0){return function(_0x219711){if(_0x219711){return _0x219711[_0xbda7('0x28')](_0x26b77a)['then'](function(_0x16927f){return _0x16927f;});}return null;};}function removeEntity(_0x50fb4a,_0x187b80){return function(_0x5ced57){if(_0x5ced57){return _0x5ced57[_0xbda7('0x29')]()[_0xbda7('0x2a')](function(){_0x50fb4a[_0xbda7('0x1c')](0xcc)[_0xbda7('0x1d')]();});}};}function handleEntityNotFound(_0x1d7da1,_0x1a673a){return function(_0x368999){if(!_0x368999){_0x1d7da1[_0xbda7('0x1b')](0x194);}return _0x368999;};}function handleError(_0x1c33c8,_0x15430c){_0x15430c=_0x15430c||0x1f4;return function(_0x59081a){logger[_0xbda7('0x2b')](_0x59081a['stack']);if(_0x59081a[_0xbda7('0x2c')]){delete _0x59081a[_0xbda7('0x2c')];}_0x1c33c8[_0xbda7('0x1c')](_0x15430c)[_0xbda7('0x2d')](_0x59081a);};}exports[_0xbda7('0x2e')]=function(_0x2afe58,_0x3cb7b2){var _0x632911={},_0x5cede2={},_0x1809a9={'count':0x0,'rows':[]};var _0x280a13=_['map'](db[_0xbda7('0x2f')][_0xbda7('0x30')],function(_0x3b439c){return{'name':_0x3b439c['fieldName'],'type':_0x3b439c[_0xbda7('0x31')][_0xbda7('0x32')]};});_0x5cede2['model']=_['map'](_0x280a13,_0xbda7('0x2c'));_0x5cede2[_0xbda7('0x33')]=_[_0xbda7('0x34')](_0x2afe58[_0xbda7('0x33')]);_0x5cede2['filters']=_['intersection'](_0x5cede2[_0xbda7('0x35')],_0x5cede2[_0xbda7('0x33')]);_0x632911[_0xbda7('0x36')]=_[_0xbda7('0x37')](_0x5cede2[_0xbda7('0x35')],qs['fields'](_0x2afe58[_0xbda7('0x33')]['fields']));_0x632911['attributes']=_0x632911[_0xbda7('0x36')][_0xbda7('0x38')]?_0x632911['attributes']:_0x5cede2[_0xbda7('0x35')];if(!_0x2afe58[_0xbda7('0x33')][_0xbda7('0x39')](_0xbda7('0x3a'))){_0x632911[_0xbda7('0x22')]=qs[_0xbda7('0x22')](_0x2afe58['query'][_0xbda7('0x22')]);_0x632911['offset']=qs['offset'](_0x2afe58[_0xbda7('0x33')][_0xbda7('0x1f')]);}_0x632911[_0xbda7('0x3b')]=qs[_0xbda7('0x3c')](_0x2afe58[_0xbda7('0x33')][_0xbda7('0x3c')]);_0x632911['where']=qs[_0xbda7('0x3d')](_[_0xbda7('0x3e')](_0x2afe58[_0xbda7('0x33')],_0x5cede2['filters']),_0x280a13);if(_0x2afe58[_0xbda7('0x33')]['filter']){_0x632911[_0xbda7('0x3f')]=_['merge'](_0x632911[_0xbda7('0x3f')],{'$or':_[_0xbda7('0x40')](_0x280a13,function(_0x473ec9){if(_0x473ec9[_0xbda7('0x31')]!==_0xbda7('0x41')){var _0x15e762={};_0x15e762[_0x473ec9[_0xbda7('0x2c')]]={'$like':'%'+_0x2afe58[_0xbda7('0x33')][_0xbda7('0x42')]+'%'};return _0x15e762;}})});}_0x632911=_[_0xbda7('0x43')]({},_0x632911,_0x2afe58[_0xbda7('0x44')]);var _0x54f3a5={'where':_0x632911[_0xbda7('0x3f')]};return db['SugarcrmConfiguration'][_0xbda7('0x21')](_0x54f3a5)[_0xbda7('0x2a')](function(_0x30f9b5){_0x1809a9['count']=_0x30f9b5;if(_0x2afe58[_0xbda7('0x33')][_0xbda7('0x45')]){_0x632911[_0xbda7('0x46')]=[{'all':!![]}];}return db[_0xbda7('0x2f')][_0xbda7('0x47')](_0x632911);})['then'](function(_0x5cdb55){_0x1809a9[_0xbda7('0x48')]=_0x5cdb55;return _0x1809a9;})[_0xbda7('0x2a')](respondWithFilteredResult(_0x3cb7b2,_0x632911))[_0xbda7('0x49')](handleError(_0x3cb7b2,null));};exports['show']=function(_0x27f55d,_0x1ca740){var _0x3a94fb={'raw':![],'where':{'id':_0x27f55d[_0xbda7('0x4a')]['id']}},_0x2c8384={};_0x2c8384['model']=_[_0xbda7('0x34')](db[_0xbda7('0x2f')][_0xbda7('0x30')]);_0x2c8384[_0xbda7('0x33')]=_['keys'](_0x27f55d['query']);_0x2c8384[_0xbda7('0x3d')]=_['intersection'](_0x2c8384[_0xbda7('0x35')],_0x2c8384[_0xbda7('0x33')]);_0x3a94fb[_0xbda7('0x36')]=_[_0xbda7('0x37')](_0x2c8384[_0xbda7('0x35')],qs[_0xbda7('0x4b')](_0x27f55d['query']['fields']));_0x3a94fb[_0xbda7('0x36')]=_0x3a94fb[_0xbda7('0x36')][_0xbda7('0x38')]?_0x3a94fb[_0xbda7('0x36')]:_0x2c8384[_0xbda7('0x35')];if(_0x27f55d[_0xbda7('0x33')][_0xbda7('0x45')]){_0x3a94fb[_0xbda7('0x46')]=[{'all':!![]}];}_0x3a94fb=_['merge']({},_0x3a94fb,_0x27f55d[_0xbda7('0x44')]);return db[_0xbda7('0x2f')][_0xbda7('0x4c')](_0x3a94fb)['then'](handleEntityNotFound(_0x1ca740,null))['then'](respondWithResult(_0x1ca740,null))[_0xbda7('0x49')](handleError(_0x1ca740,null));};exports[_0xbda7('0x4d')]=function(_0x5a9800,_0x4f07a1){return db[_0xbda7('0x2f')][_0xbda7('0x4d')](_0x5a9800[_0xbda7('0x4e')],{})[_0xbda7('0x2a')](respondWithResult(_0x4f07a1,0xc9))[_0xbda7('0x49')](handleError(_0x4f07a1,null));};exports['update']=function(_0x9e27f7,_0x348128){if(_0x9e27f7[_0xbda7('0x4e')]['id']){delete _0x9e27f7['body']['id'];}return db[_0xbda7('0x2f')][_0xbda7('0x4c')]({'where':{'id':_0x9e27f7['params']['id']}})[_0xbda7('0x2a')](handleEntityNotFound(_0x348128,null))[_0xbda7('0x2a')](saveUpdates(_0x9e27f7['body'],null))[_0xbda7('0x2a')](respondWithResult(_0x348128,null))['catch'](handleError(_0x348128,null));};exports[_0xbda7('0x29')]=function(_0x552f47,_0x33407){return db[_0xbda7('0x2f')][_0xbda7('0x4c')]({'where':{'id':_0x552f47['params']['id']}})[_0xbda7('0x2a')](handleEntityNotFound(_0x33407,null))['then'](removeEntity(_0x33407,null))['catch'](handleError(_0x33407,null));};exports['getFields']=function(_0x528e3,_0x55266a,_0x110915){var _0x38b78f={};var _0x39f45e={};var _0x11a5a1;var _0x12c9af;return db[_0xbda7('0x2f')]['findOne']({'where':{'id':_0x528e3[_0xbda7('0x4a')]['id']}})[_0xbda7('0x2a')](handleEntityNotFound(_0x55266a,null))['then'](function(_0x544da1){if(_0x544da1){_0x11a5a1=_0x544da1;_0x39f45e['model']=_['keys'](db[_0xbda7('0x4f')][_0xbda7('0x30')]);_0x39f45e['query']=_['keys'](_0x528e3[_0xbda7('0x33')]);_0x39f45e[_0xbda7('0x3d')]=_[_0xbda7('0x37')](_0x39f45e[_0xbda7('0x35')],_0x39f45e[_0xbda7('0x33')]);_0x38b78f[_0xbda7('0x36')]=_['intersection'](_0x39f45e['model'],qs[_0xbda7('0x4b')](_0x528e3[_0xbda7('0x33')][_0xbda7('0x4b')]));_0x38b78f[_0xbda7('0x36')]=_0x38b78f['attributes'][_0xbda7('0x38')]?_0x38b78f[_0xbda7('0x36')]:_0x39f45e['model'];_0x38b78f[_0xbda7('0x3b')]=qs[_0xbda7('0x3c')](_0x528e3[_0xbda7('0x33')]['sort']);_0x38b78f[_0xbda7('0x3f')]=qs['filters'](_[_0xbda7('0x3e')](_0x528e3[_0xbda7('0x33')],_0x39f45e['filters']));if(_0x528e3[_0xbda7('0x33')][_0xbda7('0x42')]){_0x38b78f[_0xbda7('0x3f')]=_[_0xbda7('0x43')](_0x38b78f[_0xbda7('0x3f')],{'$or':_['map'](_0x38b78f[_0xbda7('0x36')],function(_0x11cb8c){var _0x324a37={};_0x324a37[_0x11cb8c]={'$like':'%'+_0x528e3[_0xbda7('0x33')]['filter']+'%'};return _0x324a37;})});}_0x38b78f=_[_0xbda7('0x43')]({},_0x38b78f,_0x528e3[_0xbda7('0x44')]);return _0x11a5a1[_0xbda7('0x50')](_0x38b78f);}})[_0xbda7('0x2a')](function(_0x5c2244){if(_0x5c2244){_0x12c9af=_0x5c2244[_0xbda7('0x38')];if(!_0x528e3[_0xbda7('0x33')][_0xbda7('0x39')](_0xbda7('0x3a'))){_0x38b78f['limit']=qs[_0xbda7('0x22')](_0x528e3['query'][_0xbda7('0x22')]);_0x38b78f[_0xbda7('0x1f')]=qs[_0xbda7('0x1f')](_0x528e3[_0xbda7('0x33')][_0xbda7('0x1f')]);}return _0x11a5a1[_0xbda7('0x50')](_0x38b78f);}})[_0xbda7('0x2a')](function(_0x34f4ad){if(_0x34f4ad){return _0x34f4ad?{'count':_0x12c9af,'rows':_0x34f4ad}:null;}})['then'](respondWithResult(_0x55266a,null))['catch'](handleError(_0x55266a,null));};exports[_0xbda7('0x51')]=function(_0x307450,_0x3ea6ac,_0x39ba7b){var _0x2c6285={};var _0xd9bcf9={};var _0x578508;var _0xdcd521;return db[_0xbda7('0x2f')][_0xbda7('0x52')]({'where':{'id':_0x307450[_0xbda7('0x4a')]['id']}})[_0xbda7('0x2a')](handleEntityNotFound(_0x3ea6ac,null))[_0xbda7('0x2a')](function(_0x4398c1){if(_0x4398c1){_0x578508=_0x4398c1;_0xd9bcf9[_0xbda7('0x35')]=_[_0xbda7('0x34')](db['SugarcrmField'][_0xbda7('0x30')]);_0xd9bcf9[_0xbda7('0x33')]=_[_0xbda7('0x34')](_0x307450[_0xbda7('0x33')]);_0xd9bcf9[_0xbda7('0x3d')]=_['intersection'](_0xd9bcf9['model'],_0xd9bcf9['query']);_0x2c6285['attributes']=_[_0xbda7('0x37')](_0xd9bcf9[_0xbda7('0x35')],qs['fields'](_0x307450[_0xbda7('0x33')][_0xbda7('0x4b')]));_0x2c6285[_0xbda7('0x36')]=_0x2c6285['attributes']['length']?_0x2c6285[_0xbda7('0x36')]:_0xd9bcf9[_0xbda7('0x35')];_0x2c6285[_0xbda7('0x3b')]=qs[_0xbda7('0x3c')](_0x307450['query'][_0xbda7('0x3c')]);_0x2c6285['where']=qs[_0xbda7('0x3d')](_['pick'](_0x307450[_0xbda7('0x33')],_0xd9bcf9['filters']));if(_0x307450[_0xbda7('0x33')]['filter']){_0x2c6285[_0xbda7('0x3f')]=_[_0xbda7('0x43')](_0x2c6285[_0xbda7('0x3f')],{'$or':_[_0xbda7('0x40')](_0x2c6285[_0xbda7('0x36')],function(_0x299d0c){var _0x1fe888={};_0x1fe888[_0x299d0c]={'$like':'%'+_0x307450[_0xbda7('0x33')][_0xbda7('0x42')]+'%'};return _0x1fe888;})});}_0x2c6285=_[_0xbda7('0x43')]({},_0x2c6285,_0x307450[_0xbda7('0x44')]);return _0x578508['getSubjects'](_0x2c6285);}})[_0xbda7('0x2a')](function(_0x3aae2f){if(_0x3aae2f){_0xdcd521=_0x3aae2f['length'];if(!_0x307450[_0xbda7('0x33')][_0xbda7('0x39')](_0xbda7('0x3a'))){_0x2c6285[_0xbda7('0x22')]=qs[_0xbda7('0x22')](_0x307450[_0xbda7('0x33')]['limit']);_0x2c6285[_0xbda7('0x1f')]=qs['offset'](_0x307450[_0xbda7('0x33')][_0xbda7('0x1f')]);}return _0x578508[_0xbda7('0x51')](_0x2c6285);}})['then'](function(_0x4bdf76){if(_0x4bdf76){return _0x4bdf76?{'count':_0xdcd521,'rows':_0x4bdf76}:null;}})[_0xbda7('0x2a')](respondWithResult(_0x3ea6ac,null))[_0xbda7('0x49')](handleError(_0x3ea6ac,null));};exports[_0xbda7('0x53')]=function(_0x9ec5d1,_0x1f113e,_0x106344){var _0x4f3454={};var _0x22345a={};var _0x1a2d38;var _0x1c42be;return db[_0xbda7('0x2f')][_0xbda7('0x52')]({'where':{'id':_0x9ec5d1[_0xbda7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1f113e,null))[_0xbda7('0x2a')](function(_0x51e5df){if(_0x51e5df){_0x1a2d38=_0x51e5df;_0x22345a[_0xbda7('0x35')]=_[_0xbda7('0x34')](db[_0xbda7('0x4f')][_0xbda7('0x30')]);_0x22345a[_0xbda7('0x33')]=_[_0xbda7('0x34')](_0x9ec5d1[_0xbda7('0x33')]);_0x22345a[_0xbda7('0x3d')]=_[_0xbda7('0x37')](_0x22345a['model'],_0x22345a[_0xbda7('0x33')]);_0x4f3454[_0xbda7('0x36')]=_[_0xbda7('0x37')](_0x22345a[_0xbda7('0x35')],qs['fields'](_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x4b')]));_0x4f3454[_0xbda7('0x36')]=_0x4f3454[_0xbda7('0x36')][_0xbda7('0x38')]?_0x4f3454[_0xbda7('0x36')]:_0x22345a[_0xbda7('0x35')];_0x4f3454[_0xbda7('0x3b')]=qs[_0xbda7('0x3c')](_0x9ec5d1['query'][_0xbda7('0x3c')]);_0x4f3454['where']=qs[_0xbda7('0x3d')](_[_0xbda7('0x3e')](_0x9ec5d1[_0xbda7('0x33')],_0x22345a[_0xbda7('0x3d')]));if(_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x42')]){_0x4f3454[_0xbda7('0x3f')]=_['merge'](_0x4f3454[_0xbda7('0x3f')],{'$or':_[_0xbda7('0x40')](_0x4f3454['attributes'],function(_0x33536f){var _0x56af62={};_0x56af62[_0x33536f]={'$like':'%'+_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x42')]+'%'};return _0x56af62;})});}_0x4f3454=_[_0xbda7('0x43')]({},_0x4f3454,_0x9ec5d1[_0xbda7('0x44')]);return _0x1a2d38[_0xbda7('0x53')](_0x4f3454);}})[_0xbda7('0x2a')](function(_0x2645b5){if(_0x2645b5){_0x1c42be=_0x2645b5[_0xbda7('0x38')];if(!_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x39')]('nolimit')){_0x4f3454['limit']=qs[_0xbda7('0x22')](_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x22')]);_0x4f3454[_0xbda7('0x1f')]=qs['offset'](_0x9ec5d1[_0xbda7('0x33')][_0xbda7('0x1f')]);}return _0x1a2d38[_0xbda7('0x53')](_0x4f3454);}})['then'](function(_0x2d7951){if(_0x2d7951){return _0x2d7951?{'count':_0x1c42be,'rows':_0x2d7951}:null;}})[_0xbda7('0x2a')](respondWithResult(_0x1f113e,null))[_0xbda7('0x49')](handleError(_0x1f113e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6cac422..9b49328 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 _0x16dc=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x505655,_0x2b888f){var _0x46d890=function(_0x3a3b0d){while(--_0x3a3b0d){_0x505655['push'](_0x505655['shift']());}};_0x46d890(++_0x2b888f);}(_0x16dc,0x178));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc16d('0x0'));var util=require('util');var logger=require(_0xc16d('0x1'))(_0xc16d('0x2'));var moment=require(_0xc16d('0x3'));var BPromise=require(_0xc16d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc16d('0x5'));var rimraf=require(_0xc16d('0x6'));var config=require(_0xc16d('0x7'));var attributes=require(_0xc16d('0x8'));module[_0xc16d('0x9')]=function(_0x528e4f,_0x1e99bd){return _0x528e4f[_0xc16d('0xa')](_0xc16d('0xb'),attributes,{'tableName':_0xc16d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d6b=['moment','bluebird','request-promise','path','../../config/environment','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x448af7,_0x2ef04e){var _0x108aa9=function(_0x4e81de){while(--_0x4e81de){_0x448af7['push'](_0x448af7['shift']());}};_0x108aa9(++_0x2ef04e);}(_0x5d6b,0xe0));var _0xb5d6=function(_0x2d07f3,_0x2e210c){_0x2d07f3=_0x2d07f3-0x0;var _0x1594d7=_0x5d6b[_0x2d07f3];return _0x1594d7;};'use strict';var _=require(_0xb5d6('0x0'));var util=require(_0xb5d6('0x1'));var logger=require(_0xb5d6('0x2'))(_0xb5d6('0x3'));var moment=require(_0xb5d6('0x4'));var BPromise=require(_0xb5d6('0x5'));var rp=require(_0xb5d6('0x6'));var fs=require('fs');var path=require(_0xb5d6('0x7'));var rimraf=require('rimraf');var config=require(_0xb5d6('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xb5d6('0x9')]=function(_0xa2d122,_0x34dcd2){return _0xa2d122['define'](_0xb5d6('0xa'),attributes,{'tableName':_0xb5d6('0xb'),'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 d37b17e..dc12b05 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 _0x6a19=['request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xf32cec,_0x20bfb0){var _0x5904b8=function(_0x453954){while(--_0x453954){_0xf32cec['push'](_0xf32cec['shift']());}};_0x5904b8(++_0x20bfb0);}(_0x6a19,0xe2));var _0x96a1=function(_0x14f8f0,_0x5e2d51){_0x14f8f0=_0x14f8f0-0x0;var _0x5a1286=_0x6a19[_0x14f8f0];return _0x5a1286;};'use strict';var _=require(_0x96a1('0x0'));var util=require('util');var moment=require(_0x96a1('0x1'));var BPromise=require(_0x96a1('0x2'));var rs=require(_0x96a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96a1('0x4'))['db'];var utils=require(_0x96a1('0x5'));var logger=require(_0x96a1('0x6'))('rpc');var config=require(_0x96a1('0x7'));var jayson=require(_0x96a1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282724,_0x48c500,_0x326fa2){return new BPromise(function(_0x3677af,_0x486ffa){return client[_0x96a1('0x9')](_0x282724,_0x326fa2)['then'](function(_0x5e2cbc){logger[_0x96a1('0xa')](_0x96a1('0xb'),_0x48c500,'request\x20sent');logger[_0x96a1('0xc')](_0x96a1('0xd'),_0x48c500,_0x96a1('0xe'),JSON[_0x96a1('0xf')](_0x5e2cbc));if(_0x5e2cbc[_0x96a1('0x10')]){if(_0x5e2cbc[_0x96a1('0x10')][_0x96a1('0x11')]===0x1f4){logger['error'](_0x96a1('0xb'),_0x48c500,_0x5e2cbc[_0x96a1('0x10')][_0x96a1('0x12')]);return _0x486ffa(_0x5e2cbc[_0x96a1('0x10')]['message']);}logger[_0x96a1('0x10')](_0x96a1('0xb'),_0x48c500,_0x5e2cbc['error']['message']);return _0x3677af(_0x5e2cbc[_0x96a1('0x10')]['message']);}else{logger['info'](_0x96a1('0xb'),_0x48c500,'request\x20sent');_0x3677af(_0x5e2cbc[_0x96a1('0x13')][_0x96a1('0x12')]);}})['catch'](function(_0x16480e){logger[_0x96a1('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x48c500,_0x16480e);_0x486ffa(_0x16480e);});});} \ No newline at end of file +var _0xd89c=['../../config/logger','rpc','jayson/promise','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50113b,_0x5b95f6){var _0xbadb16=function(_0x4914eb){while(--_0x4914eb){_0x50113b['push'](_0x50113b['shift']());}};_0xbadb16(++_0x5b95f6);}(_0xd89c,0x11b));var _0xcd89=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xd89c[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0xcd89('0x0'));var moment=require('moment');var BPromise=require(_0xcd89('0x1'));var rs=require(_0xcd89('0x2'));var fs=require('fs');var Redis=require(_0xcd89('0x3'));var db=require(_0xcd89('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd89('0x5'))(_0xcd89('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd89('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd47a,_0x3518dd,_0x4fd239){return new BPromise(function(_0x4c884a,_0x28ce52){return client[_0xcd89('0x8')](_0x2fd47a,_0x4fd239)[_0xcd89('0x9')](function(_0x1e0414){logger['info'](_0xcd89('0xa'),_0x3518dd,'request\x20sent');logger[_0xcd89('0xb')](_0xcd89('0xc'),_0x3518dd,'request\x20sent',JSON[_0xcd89('0xd')](_0x1e0414));if(_0x1e0414[_0xcd89('0xe')]){if(_0x1e0414[_0xcd89('0xe')][_0xcd89('0xf')]===0x1f4){logger[_0xcd89('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3518dd,_0x1e0414['error'][_0xcd89('0x10')]);return _0x28ce52(_0x1e0414['error']['message']);}logger[_0xcd89('0xe')](_0xcd89('0xa'),_0x3518dd,_0x1e0414[_0xcd89('0xe')]['message']);return _0x4c884a(_0x1e0414[_0xcd89('0xe')][_0xcd89('0x10')]);}else{logger['info'](_0xcd89('0xa'),_0x3518dd,'request\x20sent');_0x4c884a(_0x1e0414['result'][_0xcd89('0x10')]);}})[_0xcd89('0x11')](function(_0x1cc1ef){logger[_0xcd89('0xe')](_0xcd89('0xa'),_0x3518dd,_0x1cc1ef);_0x28ce52(_0x1cc1ef);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 90642e2..8174300 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 _0xa0c0=['put','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post'];(function(_0x81ab09,_0x385732){var _0x1400fa=function(_0x13c2ac){while(--_0x13c2ac){_0x81ab09['push'](_0x81ab09['shift']());}};_0x1400fa(++_0x385732);}(_0xa0c0,0x144));var _0x0a0c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa0c0[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x0a0c('0x0'));var util=require('util');var path=require(_0x0a0c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a0c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0a0c('0x3'));var interaction=require(_0x0a0c('0x4'));var config=require(_0x0a0c('0x5'));var controller=require(_0x0a0c('0x6'));router['get']('/',auth[_0x0a0c('0x7')](),controller['index']);router[_0x0a0c('0x8')](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller[_0x0a0c('0xa')]);router[_0x0a0c('0xb')]('/',auth[_0x0a0c('0x7')](),controller['create']);router[_0x0a0c('0xc')](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller['update']);router['delete'](_0x0a0c('0x9'),auth[_0x0a0c('0x7')](),controller['destroy']);module[_0x0a0c('0xd')]=router; \ No newline at end of file +var _0x9778=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x3ac063,_0x52424f){var _0xa682d=function(_0x47af4a){while(--_0x47af4a){_0x3ac063['push'](_0x3ac063['shift']());}};_0xa682d(++_0x52424f);}(_0x9778,0x1d5));var _0x8977=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0x9778[_0x54b396];return _0x532e6d;};'use strict';var multer=require('multer');var util=require(_0x8977('0x0'));var path=require(_0x8977('0x1'));var timeout=require(_0x8977('0x2'));var express=require('express');var router=express[_0x8977('0x3')]();var fs_extra=require(_0x8977('0x4'));var auth=require(_0x8977('0x5'));var interaction=require(_0x8977('0x6'));var config=require(_0x8977('0x7'));var controller=require('./intSugarcrmField.controller');router[_0x8977('0x8')]('/',auth[_0x8977('0x9')](),controller[_0x8977('0xa')]);router[_0x8977('0x8')](_0x8977('0xb'),auth[_0x8977('0x9')](),controller[_0x8977('0xc')]);router[_0x8977('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8977('0xe')](_0x8977('0xb'),auth[_0x8977('0x9')](),controller[_0x8977('0xf')]);router['delete'](_0x8977('0xb'),auth[_0x8977('0x9')](),controller[_0x8977('0x10')]);module[_0x8977('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 49c7868..1b7bff5 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 _0xea2f=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x183150,_0x5b5e51){var _0x203c5e=function(_0x17415d){while(--_0x17415d){_0x183150['push'](_0x183150['shift']());}};_0x203c5e(++_0x5b5e51);}(_0xea2f,0x1dc));var _0xfea2=function(_0x48b242,_0x75b6d6){_0x48b242=_0x48b242-0x0;var _0x4b1bac=_0xea2f[_0x48b242];return _0x4b1bac;};'use strict';var Sequelize=require(_0xfea2('0x0'));module[_0xfea2('0x1')]={'type':{'type':Sequelize[_0xfea2('0x2')](_0xfea2('0x3'),_0xfea2('0x4'),'customVariable',_0xfea2('0x5'),_0xfea2('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfea2('0x7')]},'keyType':{'type':Sequelize[_0xfea2('0x2')](_0xfea2('0x3'),_0xfea2('0x4'),_0xfea2('0x8'))},'keyContent':{'type':Sequelize[_0xfea2('0x7')]},'idField':{'type':Sequelize[_0xfea2('0x7')]},'nameField':{'type':Sequelize[_0xfea2('0x7')]},'customField':{'type':Sequelize[_0xfea2('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x910e=['variable','customVariable','keyValue','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x803c0d,_0x34db27){var _0x49a88a=function(_0x48a26f){while(--_0x48a26f){_0x803c0d['push'](_0x803c0d['shift']());}};_0x49a88a(++_0x34db27);}(_0x910e,0x72));var _0xe910=function(_0x4d04d5,_0x3f3eb1){_0x4d04d5=_0x4d04d5-0x0;var _0x4d37b6=_0x910e[_0x4d04d5];return _0x4d37b6;};'use strict';var Sequelize=require(_0xe910('0x0'));module[_0xe910('0x1')]={'type':{'type':Sequelize[_0xe910('0x2')]('string',_0xe910('0x3'),_0xe910('0x4'),_0xe910('0x5'),_0xe910('0x6')),'defaultValue':_0xe910('0x7')},'content':{'type':Sequelize[_0xe910('0x8')]},'key':{'type':Sequelize[_0xe910('0x8')]},'keyType':{'type':Sequelize[_0xe910('0x2')](_0xe910('0x7'),_0xe910('0x3'),_0xe910('0x4'))},'keyContent':{'type':Sequelize[_0xe910('0x8')]},'idField':{'type':Sequelize[_0xe910('0x8')]},'nameField':{'type':Sequelize[_0xe910('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe910('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index cd584f2..698a294 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 _0x13f8=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model'];(function(_0x4320a7,_0x239a92){var _0x3700bf=function(_0x2c3db0){while(--_0x2c3db0){_0x4320a7['push'](_0x4320a7['shift']());}};_0x3700bf(++_0x239a92);}(_0x13f8,0x10b));var _0x813f=function(_0x4bdfc6,_0x4c2991){_0x4bdfc6=_0x4bdfc6-0x0;var _0x5091d0=_0x13f8[_0x4bdfc6];return _0x5091d0;};'use strict';var emlformat=require(_0x813f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x813f('0x1'));var jsonpatch=require(_0x813f('0x2'));var rp=require(_0x813f('0x3'));var moment=require(_0x813f('0x4'));var BPromise=require(_0x813f('0x5'));var Mustache=require(_0x813f('0x6'));var util=require(_0x813f('0x7'));var path=require(_0x813f('0x8'));var sox=require(_0x813f('0x9'));var csv=require(_0x813f('0xa'));var ejs=require(_0x813f('0xb'));var fs=require('fs');var fs_extra=require(_0x813f('0xc'));var _=require(_0x813f('0xd'));var squel=require(_0x813f('0xe'));var crypto=require(_0x813f('0xf'));var jsforce=require(_0x813f('0x10'));var deskjs=require(_0x813f('0x11'));var toCsv=require(_0x813f('0xa'));var querystring=require(_0x813f('0x12'));var Papa=require(_0x813f('0x13'));var Redis=require('ioredis');var authService=require(_0x813f('0x14'));var qs=require(_0x813f('0x15'));var as=require(_0x813f('0x16'));var hardwareService=require(_0x813f('0x17'));var logger=require(_0x813f('0x18'))('api');var utils=require(_0x813f('0x19'));var config=require(_0x813f('0x1a'));var licenseUtil=require(_0x813f('0x1b'));var db=require(_0x813f('0x1c'))['db'];function respondWithStatusCode(_0x27120d,_0x41a934){_0x41a934=_0x41a934||0xcc;return function(_0x5335f3){if(_0x5335f3){return _0x27120d[_0x813f('0x1d')](_0x41a934);}return _0x27120d[_0x813f('0x1e')](_0x41a934)['end']();};}function respondWithResult(_0x327e6f,_0xb3eff2){_0xb3eff2=_0xb3eff2||0xc8;return function(_0x5614be){if(_0x5614be){return _0x327e6f['status'](_0xb3eff2)[_0x813f('0x1f')](_0x5614be);}};}function respondWithFilteredResult(_0x24a9dc,_0x329670){return function(_0x5294f6){if(_0x5294f6){var _0x35683b=typeof _0x329670[_0x813f('0x20')]==='undefined'&&typeof _0x329670[_0x813f('0x21')]===_0x813f('0x22');var _0x33937f=_0x5294f6[_0x813f('0x23')];var _0x57a2d5=_0x35683b?0x0:_0x329670['offset'];var _0x28294e=_0x35683b?_0x5294f6['count']:_0x329670[_0x813f('0x20')]+_0x329670[_0x813f('0x21')];var _0x17fef7;if(_0x28294e>=_0x33937f){_0x28294e=_0x33937f;_0x17fef7=0xc8;}else{_0x17fef7=0xce;}_0x24a9dc[_0x813f('0x1e')](_0x17fef7);return _0x24a9dc['set'](_0x813f('0x24'),_0x57a2d5+'-'+_0x28294e+'/'+_0x33937f)[_0x813f('0x1f')](_0x5294f6);}return null;};}function patchUpdates(_0xa55518){return function(_0x464c91){try{jsonpatch['apply'](_0x464c91,_0xa55518,!![]);}catch(_0x3ffd90){return BPromise[_0x813f('0x25')](_0x3ffd90);}return _0x464c91[_0x813f('0x26')]();};}function saveUpdates(_0xc7ea8f,_0xc1b08b){return function(_0x1f5c28){if(_0x1f5c28){return _0x1f5c28[_0x813f('0x27')](_0xc7ea8f)[_0x813f('0x28')](function(_0x2639d7){return _0x2639d7;});}return null;};}function removeEntity(_0x7a2e51,_0x495436){return function(_0x21bf46){if(_0x21bf46){return _0x21bf46[_0x813f('0x29')]()[_0x813f('0x28')](function(){_0x7a2e51['status'](0xcc)[_0x813f('0x2a')]();});}};}function handleEntityNotFound(_0x23a338,_0x4c554b){return function(_0x43315a){if(!_0x43315a){_0x23a338[_0x813f('0x1d')](0x194);}return _0x43315a;};}function handleError(_0x531463,_0x3ab314){_0x3ab314=_0x3ab314||0x1f4;return function(_0x72f011){logger[_0x813f('0x2b')](_0x72f011[_0x813f('0x2c')]);if(_0x72f011[_0x813f('0x2d')]){delete _0x72f011[_0x813f('0x2d')];}_0x531463[_0x813f('0x1e')](_0x3ab314)['send'](_0x72f011);};}exports[_0x813f('0x2e')]=function(_0xbc159b,_0xc02cc1){var _0x4e470f={},_0x5dbf33={},_0x3a1858={'count':0x0,'rows':[]};var _0x2021ea=_['map'](db[_0x813f('0x2f')][_0x813f('0x30')],function(_0x4c4e2f){return{'name':_0x4c4e2f[_0x813f('0x31')],'type':_0x4c4e2f[_0x813f('0x32')][_0x813f('0x33')]};});_0x5dbf33[_0x813f('0x34')]=_['map'](_0x2021ea,'name');_0x5dbf33[_0x813f('0x35')]=_[_0x813f('0x36')](_0xbc159b[_0x813f('0x35')]);_0x5dbf33[_0x813f('0x37')]=_[_0x813f('0x38')](_0x5dbf33[_0x813f('0x34')],_0x5dbf33['query']);_0x4e470f[_0x813f('0x39')]=_[_0x813f('0x38')](_0x5dbf33[_0x813f('0x34')],qs[_0x813f('0x3a')](_0xbc159b[_0x813f('0x35')][_0x813f('0x3a')]));_0x4e470f[_0x813f('0x39')]=_0x4e470f[_0x813f('0x39')]['length']?_0x4e470f['attributes']:_0x5dbf33['model'];if(!_0xbc159b['query'][_0x813f('0x3b')](_0x813f('0x3c'))){_0x4e470f[_0x813f('0x21')]=qs['limit'](_0xbc159b[_0x813f('0x35')][_0x813f('0x21')]);_0x4e470f[_0x813f('0x20')]=qs[_0x813f('0x20')](_0xbc159b[_0x813f('0x35')]['offset']);}_0x4e470f[_0x813f('0x3d')]=qs[_0x813f('0x3e')](_0xbc159b[_0x813f('0x35')][_0x813f('0x3e')]);_0x4e470f[_0x813f('0x3f')]=qs[_0x813f('0x37')](_[_0x813f('0x40')](_0xbc159b[_0x813f('0x35')],_0x5dbf33[_0x813f('0x37')]),_0x2021ea);if(_0xbc159b[_0x813f('0x35')][_0x813f('0x41')]){_0x4e470f[_0x813f('0x3f')]=_[_0x813f('0x42')](_0x4e470f[_0x813f('0x3f')],{'$or':_[_0x813f('0x43')](_0x2021ea,function(_0x5032f4){if(_0x5032f4['type']!==_0x813f('0x44')){var _0x1a922d={};_0x1a922d[_0x5032f4[_0x813f('0x2d')]]={'$like':'%'+_0xbc159b[_0x813f('0x35')]['filter']+'%'};return _0x1a922d;}})});}_0x4e470f=_[_0x813f('0x42')]({},_0x4e470f,_0xbc159b['options']);var _0x3d5e9c={'where':_0x4e470f[_0x813f('0x3f')]};return db[_0x813f('0x2f')][_0x813f('0x23')](_0x3d5e9c)[_0x813f('0x28')](function(_0x3e3a0a){_0x3a1858['count']=_0x3e3a0a;if(_0xbc159b['query'][_0x813f('0x45')]){_0x4e470f[_0x813f('0x46')]=[{'all':!![]}];}return db[_0x813f('0x2f')][_0x813f('0x47')](_0x4e470f);})[_0x813f('0x28')](function(_0x4ff876){_0x3a1858[_0x813f('0x48')]=_0x4ff876;return _0x3a1858;})[_0x813f('0x28')](respondWithFilteredResult(_0xc02cc1,_0x4e470f))['catch'](handleError(_0xc02cc1,null));};exports[_0x813f('0x49')]=function(_0x30e409,_0x387ab6){var _0x4ecc4c={'raw':!![],'where':{'id':_0x30e409[_0x813f('0x4a')]['id']}},_0x3c711d={};_0x3c711d[_0x813f('0x34')]=_[_0x813f('0x36')](db[_0x813f('0x2f')][_0x813f('0x30')]);_0x3c711d[_0x813f('0x35')]=_[_0x813f('0x36')](_0x30e409['query']);_0x3c711d[_0x813f('0x37')]=_[_0x813f('0x38')](_0x3c711d[_0x813f('0x34')],_0x3c711d[_0x813f('0x35')]);_0x4ecc4c[_0x813f('0x39')]=_[_0x813f('0x38')](_0x3c711d[_0x813f('0x34')],qs[_0x813f('0x3a')](_0x30e409['query'][_0x813f('0x3a')]));_0x4ecc4c[_0x813f('0x39')]=_0x4ecc4c[_0x813f('0x39')][_0x813f('0x4b')]?_0x4ecc4c[_0x813f('0x39')]:_0x3c711d[_0x813f('0x34')];if(_0x30e409[_0x813f('0x35')][_0x813f('0x45')]){_0x4ecc4c['include']=[{'all':!![]}];}_0x4ecc4c=_[_0x813f('0x42')]({},_0x4ecc4c,_0x30e409['options']);return db[_0x813f('0x2f')][_0x813f('0x4c')](_0x4ecc4c)['then'](handleEntityNotFound(_0x387ab6,null))['then'](respondWithResult(_0x387ab6,null))[_0x813f('0x4d')](handleError(_0x387ab6,null));};exports[_0x813f('0x4e')]=function(_0x1d5f23,_0x5cc871){return db[_0x813f('0x2f')][_0x813f('0x4e')](_0x1d5f23['body'],{})[_0x813f('0x28')](respondWithResult(_0x5cc871,0xc9))[_0x813f('0x4d')](handleError(_0x5cc871,null));};exports[_0x813f('0x27')]=function(_0x146771,_0x24db70){if(_0x146771['body']['id']){delete _0x146771[_0x813f('0x4f')]['id'];}return db[_0x813f('0x2f')][_0x813f('0x4c')]({'where':{'id':_0x146771['params']['id']}})[_0x813f('0x28')](handleEntityNotFound(_0x24db70,null))['then'](saveUpdates(_0x146771[_0x813f('0x4f')],null))['then'](respondWithResult(_0x24db70,null))[_0x813f('0x4d')](handleError(_0x24db70,null));};exports[_0x813f('0x29')]=function(_0x1a125e,_0x5e6079){return db[_0x813f('0x2f')][_0x813f('0x4c')]({'where':{'id':_0x1a125e[_0x813f('0x4a')]['id']}})[_0x813f('0x28')](handleEntityNotFound(_0x5e6079,null))[_0x813f('0x28')](removeEntity(_0x5e6079,null))[_0x813f('0x4d')](handleError(_0x5e6079,null));}; \ No newline at end of file +var _0x63e2=['stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','length','find','create','body','update','params','eml-format','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error'];(function(_0x3c8d16,_0x411be5){var _0x124b8d=function(_0xd09f42){while(--_0xd09f42){_0x3c8d16['push'](_0x3c8d16['shift']());}};_0x124b8d(++_0x411be5);}(_0x63e2,0xad));var _0x263e=function(_0x483940,_0x4648ee){_0x483940=_0x483940-0x0;var _0x1d4b6e=_0x63e2[_0x483940];return _0x1d4b6e;};'use strict';var emlformat=require(_0x263e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x263e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x263e('0x2'));var BPromise=require(_0x263e('0x3'));var Mustache=require('mustache');var util=require(_0x263e('0x4'));var path=require('path');var sox=require(_0x263e('0x5'));var csv=require(_0x263e('0x6'));var ejs=require(_0x263e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x263e('0x8'));var squel=require(_0x263e('0x9'));var crypto=require(_0x263e('0xa'));var jsforce=require(_0x263e('0xb'));var deskjs=require(_0x263e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x263e('0xd'));var Papa=require('papaparse');var Redis=require(_0x263e('0xe'));var authService=require(_0x263e('0xf'));var qs=require(_0x263e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x263e('0x11'));var utils=require(_0x263e('0x12'));var config=require(_0x263e('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x263e('0x14'))['db'];function respondWithStatusCode(_0x295638,_0x489e32){_0x489e32=_0x489e32||0xcc;return function(_0x57e0f5){if(_0x57e0f5){return _0x295638['sendStatus'](_0x489e32);}return _0x295638['status'](_0x489e32)['end']();};}function respondWithResult(_0x49ba7c,_0x45b220){_0x45b220=_0x45b220||0xc8;return function(_0xfc7f02){if(_0xfc7f02){return _0x49ba7c[_0x263e('0x15')](_0x45b220)[_0x263e('0x16')](_0xfc7f02);}};}function respondWithFilteredResult(_0x547cef,_0x30ff24){return function(_0xdd12f7){if(_0xdd12f7){var _0x124805=typeof _0x30ff24[_0x263e('0x17')]===_0x263e('0x18')&&typeof _0x30ff24[_0x263e('0x19')]===_0x263e('0x18');var _0x23885d=_0xdd12f7['count'];var _0x59bdc9=_0x124805?0x0:_0x30ff24['offset'];var _0x236b7e=_0x124805?_0xdd12f7[_0x263e('0x1a')]:_0x30ff24[_0x263e('0x17')]+_0x30ff24['limit'];var _0x2bf1c7;if(_0x236b7e>=_0x23885d){_0x236b7e=_0x23885d;_0x2bf1c7=0xc8;}else{_0x2bf1c7=0xce;}_0x547cef['status'](_0x2bf1c7);return _0x547cef[_0x263e('0x1b')](_0x263e('0x1c'),_0x59bdc9+'-'+_0x236b7e+'/'+_0x23885d)[_0x263e('0x16')](_0xdd12f7);}return null;};}function patchUpdates(_0x4df05a){return function(_0xa05cd){try{jsonpatch[_0x263e('0x1d')](_0xa05cd,_0x4df05a,!![]);}catch(_0xc8f787){return BPromise[_0x263e('0x1e')](_0xc8f787);}return _0xa05cd[_0x263e('0x1f')]();};}function saveUpdates(_0x557a60,_0x4ad6a3){return function(_0x7bee5b){if(_0x7bee5b){return _0x7bee5b['update'](_0x557a60)[_0x263e('0x20')](function(_0x355c99){return _0x355c99;});}return null;};}function removeEntity(_0x4d88b0,_0x342f3b){return function(_0x2eac57){if(_0x2eac57){return _0x2eac57[_0x263e('0x21')]()[_0x263e('0x20')](function(){_0x4d88b0['status'](0xcc)[_0x263e('0x22')]();});}};}function handleEntityNotFound(_0x97bb8d,_0x3f56b2){return function(_0x585acf){if(!_0x585acf){_0x97bb8d[_0x263e('0x23')](0x194);}return _0x585acf;};}function handleError(_0x2cc9c2,_0x483c8b){_0x483c8b=_0x483c8b||0x1f4;return function(_0x455674){logger[_0x263e('0x24')](_0x455674[_0x263e('0x25')]);if(_0x455674[_0x263e('0x26')]){delete _0x455674[_0x263e('0x26')];}_0x2cc9c2['status'](_0x483c8b)[_0x263e('0x27')](_0x455674);};}exports[_0x263e('0x28')]=function(_0x506ece,_0x30ef8e){var _0x15c514={},_0x2064e3={},_0x3110c0={'count':0x0,'rows':[]};var _0x312891=_[_0x263e('0x29')](db[_0x263e('0x2a')][_0x263e('0x2b')],function(_0x92becd){return{'name':_0x92becd[_0x263e('0x2c')],'type':_0x92becd[_0x263e('0x2d')]['key']};});_0x2064e3[_0x263e('0x2e')]=_[_0x263e('0x29')](_0x312891,_0x263e('0x26'));_0x2064e3[_0x263e('0x2f')]=_[_0x263e('0x30')](_0x506ece[_0x263e('0x2f')]);_0x2064e3[_0x263e('0x31')]=_[_0x263e('0x32')](_0x2064e3[_0x263e('0x2e')],_0x2064e3[_0x263e('0x2f')]);_0x15c514[_0x263e('0x33')]=_[_0x263e('0x32')](_0x2064e3[_0x263e('0x2e')],qs[_0x263e('0x34')](_0x506ece[_0x263e('0x2f')][_0x263e('0x34')]));_0x15c514[_0x263e('0x33')]=_0x15c514[_0x263e('0x33')]['length']?_0x15c514[_0x263e('0x33')]:_0x2064e3[_0x263e('0x2e')];if(!_0x506ece[_0x263e('0x2f')]['hasOwnProperty'](_0x263e('0x35'))){_0x15c514[_0x263e('0x19')]=qs[_0x263e('0x19')](_0x506ece[_0x263e('0x2f')][_0x263e('0x19')]);_0x15c514[_0x263e('0x17')]=qs[_0x263e('0x17')](_0x506ece['query'][_0x263e('0x17')]);}_0x15c514['order']=qs['sort'](_0x506ece['query']['sort']);_0x15c514[_0x263e('0x36')]=qs[_0x263e('0x31')](_[_0x263e('0x37')](_0x506ece[_0x263e('0x2f')],_0x2064e3[_0x263e('0x31')]),_0x312891);if(_0x506ece['query'][_0x263e('0x38')]){_0x15c514[_0x263e('0x36')]=_[_0x263e('0x39')](_0x15c514[_0x263e('0x36')],{'$or':_['map'](_0x312891,function(_0x13f502){if(_0x13f502['type']!=='VIRTUAL'){var _0x315cef={};_0x315cef[_0x13f502['name']]={'$like':'%'+_0x506ece[_0x263e('0x2f')][_0x263e('0x38')]+'%'};return _0x315cef;}})});}_0x15c514=_[_0x263e('0x39')]({},_0x15c514,_0x506ece[_0x263e('0x3a')]);var _0x382396={'where':_0x15c514[_0x263e('0x36')]};return db[_0x263e('0x2a')][_0x263e('0x1a')](_0x382396)[_0x263e('0x20')](function(_0x4d64a2){_0x3110c0[_0x263e('0x1a')]=_0x4d64a2;if(_0x506ece[_0x263e('0x2f')][_0x263e('0x3b')]){_0x15c514[_0x263e('0x3c')]=[{'all':!![]}];}return db[_0x263e('0x2a')][_0x263e('0x3d')](_0x15c514);})[_0x263e('0x20')](function(_0x5bd80f){_0x3110c0[_0x263e('0x3e')]=_0x5bd80f;return _0x3110c0;})[_0x263e('0x20')](respondWithFilteredResult(_0x30ef8e,_0x15c514))[_0x263e('0x3f')](handleError(_0x30ef8e,null));};exports['show']=function(_0xfbba20,_0x55c8eb){var _0x39a2cb={'raw':!![],'where':{'id':_0xfbba20['params']['id']}},_0x5527eb={};_0x5527eb['model']=_[_0x263e('0x30')](db[_0x263e('0x2a')][_0x263e('0x2b')]);_0x5527eb[_0x263e('0x2f')]=_[_0x263e('0x30')](_0xfbba20[_0x263e('0x2f')]);_0x5527eb[_0x263e('0x31')]=_[_0x263e('0x32')](_0x5527eb[_0x263e('0x2e')],_0x5527eb[_0x263e('0x2f')]);_0x39a2cb[_0x263e('0x33')]=_[_0x263e('0x32')](_0x5527eb[_0x263e('0x2e')],qs[_0x263e('0x34')](_0xfbba20[_0x263e('0x2f')][_0x263e('0x34')]));_0x39a2cb[_0x263e('0x33')]=_0x39a2cb['attributes'][_0x263e('0x40')]?_0x39a2cb[_0x263e('0x33')]:_0x5527eb[_0x263e('0x2e')];if(_0xfbba20[_0x263e('0x2f')][_0x263e('0x3b')]){_0x39a2cb['include']=[{'all':!![]}];}_0x39a2cb=_[_0x263e('0x39')]({},_0x39a2cb,_0xfbba20[_0x263e('0x3a')]);return db[_0x263e('0x2a')][_0x263e('0x41')](_0x39a2cb)[_0x263e('0x20')](handleEntityNotFound(_0x55c8eb,null))['then'](respondWithResult(_0x55c8eb,null))[_0x263e('0x3f')](handleError(_0x55c8eb,null));};exports[_0x263e('0x42')]=function(_0x315873,_0x48bc83){return db[_0x263e('0x2a')]['create'](_0x315873[_0x263e('0x43')],{})[_0x263e('0x20')](respondWithResult(_0x48bc83,0xc9))[_0x263e('0x3f')](handleError(_0x48bc83,null));};exports[_0x263e('0x44')]=function(_0x5d9d85,_0x2b734f){if(_0x5d9d85['body']['id']){delete _0x5d9d85[_0x263e('0x43')]['id'];}return db[_0x263e('0x2a')][_0x263e('0x41')]({'where':{'id':_0x5d9d85[_0x263e('0x45')]['id']}})[_0x263e('0x20')](handleEntityNotFound(_0x2b734f,null))[_0x263e('0x20')](saveUpdates(_0x5d9d85[_0x263e('0x43')],null))[_0x263e('0x20')](respondWithResult(_0x2b734f,null))['catch'](handleError(_0x2b734f,null));};exports[_0x263e('0x21')]=function(_0x1fe0b5,_0x356261){return db['SugarcrmField']['find']({'where':{'id':_0x1fe0b5[_0x263e('0x45')]['id']}})[_0x263e('0x20')](handleEntityNotFound(_0x356261,null))[_0x263e('0x20')](removeEntity(_0x356261,null))[_0x263e('0x3f')](handleError(_0x356261,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4684ae1..d5dd12c 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 _0xcc67=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField'];(function(_0x39edf1,_0x3616a9){var _0x348891=function(_0x2fd7d9){while(--_0x2fd7d9){_0x39edf1['push'](_0x39edf1['shift']());}};_0x348891(++_0x3616a9);}(_0xcc67,0xb8));var _0x7cc6=function(_0x4269b2,_0x579a41){_0x4269b2=_0x4269b2-0x0;var _0x4ee071=_0xcc67[_0x4269b2];return _0x4ee071;};'use strict';var _=require(_0x7cc6('0x0'));var util=require(_0x7cc6('0x1'));var logger=require(_0x7cc6('0x2'))('api');var moment=require(_0x7cc6('0x3'));var BPromise=require(_0x7cc6('0x4'));var rp=require(_0x7cc6('0x5'));var fs=require('fs');var path=require(_0x7cc6('0x6'));var rimraf=require(_0x7cc6('0x7'));var config=require(_0x7cc6('0x8'));var attributes=require(_0x7cc6('0x9'));module[_0x7cc6('0xa')]=function(_0x4e4c78,_0x5cb86e){return _0x4e4c78['define'](_0x7cc6('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x7cc6('0xc'),_0x7cc6('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb7b=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','api','moment','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x1c7e42,_0x17d603){var _0x1142d9=function(_0x12c2b0){while(--_0x12c2b0){_0x1c7e42['push'](_0x1c7e42['shift']());}};_0x1142d9(++_0x17d603);}(_0xbb7b,0xe4));var _0xbbb7=function(_0x28856e,_0xd57c4d){_0x28856e=_0x28856e-0x0;var _0x1432c6=_0xbb7b[_0x28856e];return _0x1432c6;};'use strict';var _=require(_0xbbb7('0x0'));var util=require(_0xbbb7('0x1'));var logger=require('../../config/logger')(_0xbbb7('0x2'));var moment=require(_0xbbb7('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbb7('0x4'));var fs=require('fs');var path=require(_0xbbb7('0x5'));var rimraf=require(_0xbbb7('0x6'));var config=require('../../config/environment');var attributes=require(_0xbbb7('0x7'));module[_0xbbb7('0x8')]=function(_0x23760b,_0x2e0a71){return _0x23760b[_0xbbb7('0x9')](_0xbbb7('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xbbb7('0xb'),'fields':[_0xbbb7('0xc'),_0xbbb7('0xd')],'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 55ac444..05ab983 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 _0x82b2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','catch','util'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x82b2,0x1cb));var _0x282b=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x82b2[_0x7d62cb];return _0x3a6266;};'use strict';var _=require('lodash');var util=require(_0x282b('0x0'));var moment=require(_0x282b('0x1'));var BPromise=require(_0x282b('0x2'));var rs=require(_0x282b('0x3'));var fs=require('fs');var Redis=require(_0x282b('0x4'));var db=require(_0x282b('0x5'))['db'];var utils=require(_0x282b('0x6'));var logger=require(_0x282b('0x7'))(_0x282b('0x8'));var config=require(_0x282b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x282b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7de2bc,_0x113d24,_0x1d8b4e){return new BPromise(function(_0x236f2a,_0x477eb4){return client['request'](_0x7de2bc,_0x1d8b4e)[_0x282b('0xb')](function(_0xd54323){logger[_0x282b('0xc')](_0x282b('0xd'),_0x113d24,_0x282b('0xe'));logger[_0x282b('0xf')](_0x282b('0x10'),_0x113d24,_0x282b('0xe'),JSON['stringify'](_0xd54323));if(_0xd54323[_0x282b('0x11')]){if(_0xd54323[_0x282b('0x11')]['code']===0x1f4){logger[_0x282b('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x113d24,_0xd54323[_0x282b('0x11')][_0x282b('0x12')]);return _0x477eb4(_0xd54323[_0x282b('0x11')]['message']);}logger[_0x282b('0x11')](_0x282b('0xd'),_0x113d24,_0xd54323[_0x282b('0x11')][_0x282b('0x12')]);return _0x236f2a(_0xd54323['error'][_0x282b('0x12')]);}else{logger[_0x282b('0xc')](_0x282b('0xd'),_0x113d24,_0x282b('0xe'));_0x236f2a(_0xd54323['result'][_0x282b('0x12')]);}})[_0x282b('0x13')](function(_0x3c99a0){logger[_0x282b('0x11')](_0x282b('0xd'),_0x113d24,_0x3c99a0);_0x477eb4(_0x3c99a0);});});} \ No newline at end of file +var _0xfbcb=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','http','then','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfbcb,0x76));var _0xbfbc=function(_0x2cc1a9,_0x534ba3){_0x2cc1a9=_0x2cc1a9-0x0;var _0x996857=_0xfbcb[_0x2cc1a9];return _0x996857;};'use strict';var _=require('lodash');var util=require(_0xbfbc('0x0'));var moment=require(_0xbfbc('0x1'));var BPromise=require('bluebird');var rs=require(_0xbfbc('0x2'));var fs=require('fs');var Redis=require(_0xbfbc('0x3'));var db=require(_0xbfbc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfbc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbfbc('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x47082a,_0xc892b8,_0x469447){return new BPromise(function(_0x4c623c,_0x42bced){return client['request'](_0x47082a,_0x469447)[_0xbfbc('0x7')](function(_0xdc717){logger[_0xbfbc('0x8')]('SugarcrmField,\x20%s,\x20%s',_0xc892b8,_0xbfbc('0x9'));logger[_0xbfbc('0xa')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xc892b8,_0xbfbc('0x9'),JSON[_0xbfbc('0xb')](_0xdc717));if(_0xdc717[_0xbfbc('0xc')]){if(_0xdc717[_0xbfbc('0xc')][_0xbfbc('0xd')]===0x1f4){logger['error'](_0xbfbc('0xe'),_0xc892b8,_0xdc717[_0xbfbc('0xc')]['message']);return _0x42bced(_0xdc717[_0xbfbc('0xc')]['message']);}logger['error'](_0xbfbc('0xe'),_0xc892b8,_0xdc717[_0xbfbc('0xc')][_0xbfbc('0xf')]);return _0x4c623c(_0xdc717[_0xbfbc('0xc')]['message']);}else{logger[_0xbfbc('0x8')](_0xbfbc('0xe'),_0xc892b8,_0xbfbc('0x9'));_0x4c623c(_0xdc717['result']['message']);}})[_0xbfbc('0x10')](function(_0x2822f6){logger[_0xbfbc('0xc')](_0xbfbc('0xe'),_0xc892b8,_0x2822f6);_0x42bced(_0x2822f6);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2f3be7b..e1f1551 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 _0x5c37=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports'];(function(_0x364548,_0x327659){var _0x289ef2=function(_0x47800a){while(--_0x47800a){_0x364548['push'](_0x364548['shift']());}};_0x289ef2(++_0x327659);}(_0x5c37,0x11e));var _0x75c3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x5c37[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var path=require(_0x75c3('0x2'));var timeout=require(_0x75c3('0x3'));var express=require(_0x75c3('0x4'));var router=express[_0x75c3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x75c3('0x6'));var interaction=require(_0x75c3('0x7'));var config=require(_0x75c3('0x8'));var controller=require('./intVtigerAccount.controller');router[_0x75c3('0x9')]('/',auth[_0x75c3('0xa')](),controller[_0x75c3('0xb')]);router[_0x75c3('0x9')]('/:id',auth[_0x75c3('0xa')](),controller['show']);router['get'](_0x75c3('0xc'),auth[_0x75c3('0xa')](),controller['getConfigurations']);router[_0x75c3('0x9')](_0x75c3('0xd'),auth[_0x75c3('0xa')](),controller[_0x75c3('0xe')]);router[_0x75c3('0xf')]('/',auth[_0x75c3('0xa')](),controller['create']);router['post'](_0x75c3('0xc'),auth[_0x75c3('0xa')](),controller[_0x75c3('0x10')]);router[_0x75c3('0x11')](_0x75c3('0x12'),auth['isAuthenticated'](),controller[_0x75c3('0x13')]);router[_0x75c3('0x14')](_0x75c3('0x12'),auth[_0x75c3('0xa')](),controller['destroy']);module[_0x75c3('0x15')]=router; \ No newline at end of file +var _0xf120=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','getFields','post','create','/:id/configurations','put','update'];(function(_0x29ff87,_0x48d794){var _0x19d029=function(_0x437824){while(--_0x437824){_0x29ff87['push'](_0x29ff87['shift']());}};_0x19d029(++_0x48d794);}(_0xf120,0x179));var _0x0f12=function(_0x25ecbe,_0x2acd32){_0x25ecbe=_0x25ecbe-0x0;var _0x18c088=_0xf120[_0x25ecbe];return _0x18c088;};'use strict';var multer=require('multer');var util=require(_0x0f12('0x0'));var path=require(_0x0f12('0x1'));var timeout=require(_0x0f12('0x2'));var express=require('express');var router=express[_0x0f12('0x3')]();var fs_extra=require(_0x0f12('0x4'));var auth=require(_0x0f12('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f12('0x6'));var controller=require(_0x0f12('0x7'));router[_0x0f12('0x8')]('/',auth[_0x0f12('0x9')](),controller[_0x0f12('0xa')]);router[_0x0f12('0x8')](_0x0f12('0xb'),auth[_0x0f12('0x9')](),controller['show']);router[_0x0f12('0x8')]('/:id/configurations',auth[_0x0f12('0x9')](),controller[_0x0f12('0xc')]);router[_0x0f12('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0f12('0xd')]);router[_0x0f12('0xe')]('/',auth[_0x0f12('0x9')](),controller[_0x0f12('0xf')]);router[_0x0f12('0xe')](_0x0f12('0x10'),auth[_0x0f12('0x9')](),controller['addConfiguration']);router[_0x0f12('0x11')](_0x0f12('0xb'),auth[_0x0f12('0x9')](),controller[_0x0f12('0x12')]);router[_0x0f12('0x13')](_0x0f12('0xb'),auth[_0x0f12('0x9')](),controller[_0x0f12('0x14')]);module[_0x0f12('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b199104..e29579f 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 _0x6ce0=['exports','STRING'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0x6ce0,0x9e));var _0x06ce=function(_0x290201,_0x279632){_0x290201=_0x290201-0x0;var _0x3d5c08=_0x6ce0[_0x290201];return _0x3d5c08;};'use strict';var Sequelize=require('sequelize');module[_0x06ce('0x0')]={'name':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x06ce('0x1')]},'username':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x06ce('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xefa6=['STRING','HelpDesk','sequelize','exports'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xefa6,0x17a));var _0x6efa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xefa6[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x6efa('0x0'));module[_0x6efa('0x1')]={'name':{'type':Sequelize[_0x6efa('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6efa('0x2')]},'username':{'type':Sequelize[_0x6efa('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6efa('0x2')],'allowNull':![],'defaultValue':_0x6efa('0x3')},'remoteUri':{'type':Sequelize[_0x6efa('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6efa('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 dfeb4df..08d9f37 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 _0x27be=['squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','end','error','name','index','VtigerAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','find','create','body','update','findOne','VtigerConfiguration','options','getConfigurations','addConfiguration','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','success','GET','describe','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x495962,_0x1f2ba0){var _0x46d881=function(_0x6e7377){while(--_0x6e7377){_0x495962['push'](_0x495962['shift']());}};_0x46d881(++_0x1f2ba0);}(_0x27be,0x161));var _0xe27b=function(_0x122415,_0xb08425){_0x122415=_0x122415-0x0;var _0x3ac79d=_0x27be[_0x122415];return _0x3ac79d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe27b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe27b('0x1'));var rp=require(_0xe27b('0x2'));var moment=require(_0xe27b('0x3'));var BPromise=require(_0xe27b('0x4'));var Mustache=require(_0xe27b('0x5'));var util=require(_0xe27b('0x6'));var path=require(_0xe27b('0x7'));var sox=require(_0xe27b('0x8'));var csv=require('to-csv');var ejs=require(_0xe27b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe27b('0xa'));var crypto=require(_0xe27b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe27b('0xc'));var toCsv=require(_0xe27b('0xd'));var querystring=require(_0xe27b('0xe'));var Papa=require('papaparse');var Redis=require(_0xe27b('0xf'));var authService=require(_0xe27b('0x10'));var qs=require(_0xe27b('0x11'));var as=require(_0xe27b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe27b('0x13'))(_0xe27b('0x14'));var utils=require(_0xe27b('0x15'));var config=require(_0xe27b('0x16'));var licenseUtil=require(_0xe27b('0x17'));var db=require(_0xe27b('0x18'))['db'];var integrations=require(_0xe27b('0x19'));function respondWithStatusCode(_0x3d7ade,_0x40b45c){_0x40b45c=_0x40b45c||0xcc;return function(_0x2fe05c){if(_0x2fe05c){return _0x3d7ade[_0xe27b('0x1a')](_0x40b45c);}return _0x3d7ade[_0xe27b('0x1b')](_0x40b45c)['end']();};}function respondWithResult(_0x202543,_0x2a31eb){_0x2a31eb=_0x2a31eb||0xc8;return function(_0x42eb9e){if(_0x42eb9e){return _0x202543[_0xe27b('0x1b')](_0x2a31eb)[_0xe27b('0x1c')](_0x42eb9e);}};}function respondWithFilteredResult(_0x419f87,_0xf56542){return function(_0x583d89){if(_0x583d89){var _0x437409=typeof _0xf56542[_0xe27b('0x1d')]===_0xe27b('0x1e')&&typeof _0xf56542['limit']===_0xe27b('0x1e');var _0x4627d2=_0x583d89[_0xe27b('0x1f')];var _0x192419=_0x437409?0x0:_0xf56542[_0xe27b('0x1d')];var _0xdc9257=_0x437409?_0x583d89[_0xe27b('0x1f')]:_0xf56542[_0xe27b('0x1d')]+_0xf56542[_0xe27b('0x20')];var _0x39b2a9;if(_0xdc9257>=_0x4627d2){_0xdc9257=_0x4627d2;_0x39b2a9=0xc8;}else{_0x39b2a9=0xce;}_0x419f87['status'](_0x39b2a9);return _0x419f87[_0xe27b('0x21')](_0xe27b('0x22'),_0x192419+'-'+_0xdc9257+'/'+_0x4627d2)['json'](_0x583d89);}return null;};}function patchUpdates(_0x44b53e){return function(_0x384524){try{jsonpatch[_0xe27b('0x23')](_0x384524,_0x44b53e,!![]);}catch(_0x357da5){return BPromise['reject'](_0x357da5);}return _0x384524[_0xe27b('0x24')]();};}function saveUpdates(_0x55abcf,_0x44c9fd){return function(_0x2351b8){if(_0x2351b8){return _0x2351b8['update'](_0x55abcf)['then'](function(_0x10187f){return _0x10187f;});}return null;};}function removeEntity(_0x6b3b53,_0x4b87b1){return function(_0x30258d){if(_0x30258d){return _0x30258d[_0xe27b('0x25')]()[_0xe27b('0x26')](function(){_0x6b3b53[_0xe27b('0x1b')](0xcc)[_0xe27b('0x27')]();});}};}function handleEntityNotFound(_0x573c70,_0x441009){return function(_0x4db4ff){if(!_0x4db4ff){_0x573c70[_0xe27b('0x1a')](0x194);}return _0x4db4ff;};}function handleError(_0x657203,_0x1630fc){_0x1630fc=_0x1630fc||0x1f4;return function(_0x13fdf2){logger[_0xe27b('0x28')](_0x13fdf2['stack']);if(_0x13fdf2[_0xe27b('0x29')]){delete _0x13fdf2[_0xe27b('0x29')];}_0x657203['status'](_0x1630fc)['send'](_0x13fdf2);};}exports[_0xe27b('0x2a')]=function(_0x4205ea,_0x2ea28c){var _0x42f323={},_0x53093d={},_0x28e6d2={'count':0x0,'rows':[]};var _0x3f32b6=_['map'](db[_0xe27b('0x2b')][_0xe27b('0x2c')],function(_0x12f0f3){return{'name':_0x12f0f3[_0xe27b('0x2d')],'type':_0x12f0f3[_0xe27b('0x2e')][_0xe27b('0x2f')]};});_0x53093d[_0xe27b('0x30')]=_[_0xe27b('0x31')](_0x3f32b6,_0xe27b('0x29'));_0x53093d[_0xe27b('0x32')]=_[_0xe27b('0x33')](_0x4205ea[_0xe27b('0x32')]);_0x53093d[_0xe27b('0x34')]=_[_0xe27b('0x35')](_0x53093d['model'],_0x53093d[_0xe27b('0x32')]);_0x42f323[_0xe27b('0x36')]=_[_0xe27b('0x35')](_0x53093d[_0xe27b('0x30')],qs['fields'](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x37')]));_0x42f323['attributes']=_0x42f323[_0xe27b('0x36')][_0xe27b('0x38')]?_0x42f323['attributes']:_0x53093d[_0xe27b('0x30')];if(!_0x4205ea[_0xe27b('0x32')][_0xe27b('0x39')](_0xe27b('0x3a'))){_0x42f323['limit']=qs[_0xe27b('0x20')](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x20')]);_0x42f323['offset']=qs['offset'](_0x4205ea['query']['offset']);}_0x42f323['order']=qs[_0xe27b('0x3b')](_0x4205ea[_0xe27b('0x32')][_0xe27b('0x3b')]);_0x42f323[_0xe27b('0x3c')]=qs[_0xe27b('0x34')](_[_0xe27b('0x3d')](_0x4205ea[_0xe27b('0x32')],_0x53093d['filters']),_0x3f32b6);if(_0x4205ea[_0xe27b('0x32')][_0xe27b('0x3e')]){_0x42f323[_0xe27b('0x3c')]=_[_0xe27b('0x3f')](_0x42f323['where'],{'$or':_[_0xe27b('0x31')](_0x3f32b6,function(_0x57f17d){if(_0x57f17d[_0xe27b('0x2e')]!=='VIRTUAL'){var _0x4f5fa5={};_0x4f5fa5[_0x57f17d[_0xe27b('0x29')]]={'$like':'%'+_0x4205ea[_0xe27b('0x32')]['filter']+'%'};return _0x4f5fa5;}})});}_0x42f323=_[_0xe27b('0x3f')]({},_0x42f323,_0x4205ea['options']);var _0x3bc3e7={'where':_0x42f323[_0xe27b('0x3c')]};return db[_0xe27b('0x2b')][_0xe27b('0x1f')](_0x3bc3e7)[_0xe27b('0x26')](function(_0x4117a6){_0x28e6d2['count']=_0x4117a6;if(_0x4205ea[_0xe27b('0x32')][_0xe27b('0x40')]){_0x42f323[_0xe27b('0x41')]=[{'all':!![]}];}return db[_0xe27b('0x2b')]['findAll'](_0x42f323);})['then'](function(_0x9150af){_0x28e6d2[_0xe27b('0x42')]=_0x9150af;return _0x28e6d2;})['then'](respondWithFilteredResult(_0x2ea28c,_0x42f323))[_0xe27b('0x43')](handleError(_0x2ea28c,null));};exports[_0xe27b('0x44')]=function(_0x3dc134,_0x22af41){var _0x4326f9={'raw':![],'where':{'id':_0x3dc134[_0xe27b('0x45')]['id']}},_0x4f3478={};_0x4f3478[_0xe27b('0x30')]=_[_0xe27b('0x33')](db['VtigerAccount'][_0xe27b('0x2c')]);_0x4f3478[_0xe27b('0x32')]=_[_0xe27b('0x33')](_0x3dc134[_0xe27b('0x32')]);_0x4f3478['filters']=_[_0xe27b('0x35')](_0x4f3478[_0xe27b('0x30')],_0x4f3478['query']);_0x4326f9[_0xe27b('0x36')]=_[_0xe27b('0x35')](_0x4f3478['model'],qs[_0xe27b('0x37')](_0x3dc134['query'][_0xe27b('0x37')]));_0x4326f9[_0xe27b('0x36')]=_0x4326f9[_0xe27b('0x36')][_0xe27b('0x38')]?_0x4326f9[_0xe27b('0x36')]:_0x4f3478[_0xe27b('0x30')];if(_0x3dc134[_0xe27b('0x32')][_0xe27b('0x40')]){_0x4326f9['include']=[{'all':!![]}];}_0x4326f9=_[_0xe27b('0x3f')]({},_0x4326f9,_0x3dc134['options']);return db[_0xe27b('0x2b')][_0xe27b('0x46')](_0x4326f9)[_0xe27b('0x26')](handleEntityNotFound(_0x22af41,null))[_0xe27b('0x26')](respondWithResult(_0x22af41,null))[_0xe27b('0x43')](handleError(_0x22af41,null));};exports[_0xe27b('0x47')]=function(_0x43c5e0,_0x309206){return db['VtigerAccount'][_0xe27b('0x47')](_0x43c5e0[_0xe27b('0x48')],{})[_0xe27b('0x26')](respondWithResult(_0x309206,0xc9))['catch'](handleError(_0x309206,null));};exports[_0xe27b('0x49')]=function(_0x4583b1,_0x152920){if(_0x4583b1['body']['id']){delete _0x4583b1[_0xe27b('0x48')]['id'];}return db[_0xe27b('0x2b')][_0xe27b('0x46')]({'where':{'id':_0x4583b1['params']['id']}})['then'](handleEntityNotFound(_0x152920,null))[_0xe27b('0x26')](saveUpdates(_0x4583b1['body'],null))['then'](respondWithResult(_0x152920,null))['catch'](handleError(_0x152920,null));};exports[_0xe27b('0x25')]=function(_0x3fdc77,_0x524be9){return db[_0xe27b('0x2b')]['find']({'where':{'id':_0x3fdc77[_0xe27b('0x45')]['id']}})['then'](handleEntityNotFound(_0x524be9,null))[_0xe27b('0x26')](removeEntity(_0x524be9,null))['catch'](handleError(_0x524be9,null));};exports['getConfigurations']=function(_0x5c4fb2,_0x1ec609,_0x522b61){var _0x30106a={};var _0x32a076={};var _0x2912d1;var _0x8836ba;return db['VtigerAccount'][_0xe27b('0x4a')]({'where':{'id':_0x5c4fb2[_0xe27b('0x45')]['id']}})[_0xe27b('0x26')](handleEntityNotFound(_0x1ec609,null))['then'](function(_0x436e7a){if(_0x436e7a){_0x2912d1=_0x436e7a;_0x32a076[_0xe27b('0x30')]=_[_0xe27b('0x33')](db[_0xe27b('0x4b')][_0xe27b('0x2c')]);_0x32a076[_0xe27b('0x32')]=_['keys'](_0x5c4fb2['query']);_0x32a076['filters']=_['intersection'](_0x32a076[_0xe27b('0x30')],_0x32a076[_0xe27b('0x32')]);_0x30106a[_0xe27b('0x36')]=_['intersection'](_0x32a076[_0xe27b('0x30')],qs[_0xe27b('0x37')](_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x37')]));_0x30106a['attributes']=_0x30106a[_0xe27b('0x36')][_0xe27b('0x38')]?_0x30106a['attributes']:_0x32a076[_0xe27b('0x30')];_0x30106a['order']=qs[_0xe27b('0x3b')](_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3b')]);_0x30106a[_0xe27b('0x3c')]=qs[_0xe27b('0x34')](_['pick'](_0x5c4fb2[_0xe27b('0x32')],_0x32a076[_0xe27b('0x34')]));if(_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3e')]){_0x30106a['where']=_[_0xe27b('0x3f')](_0x30106a['where'],{'$or':_['map'](_0x30106a[_0xe27b('0x36')],function(_0x34364d){var _0x22dff2={};_0x22dff2[_0x34364d]={'$like':'%'+_0x5c4fb2[_0xe27b('0x32')][_0xe27b('0x3e')]+'%'};return _0x22dff2;})});}_0x30106a=_['merge']({},_0x30106a,_0x5c4fb2[_0xe27b('0x4c')]);return _0x2912d1['getConfigurations'](_0x30106a);}})['then'](function(_0x4dc488){if(_0x4dc488){_0x8836ba=_0x4dc488['length'];if(!_0x5c4fb2[_0xe27b('0x32')]['hasOwnProperty'](_0xe27b('0x3a'))){_0x30106a['limit']=qs[_0xe27b('0x20')](_0x5c4fb2['query'][_0xe27b('0x20')]);_0x30106a[_0xe27b('0x1d')]=qs[_0xe27b('0x1d')](_0x5c4fb2[_0xe27b('0x32')]['offset']);}return _0x2912d1[_0xe27b('0x4d')](_0x30106a);}})['then'](function(_0x4dda7f){if(_0x4dda7f){return _0x4dda7f?{'count':_0x8836ba,'rows':_0x4dda7f}:null;}})[_0xe27b('0x26')](respondWithResult(_0x1ec609,null))[_0xe27b('0x43')](handleError(_0x1ec609,null));};exports[_0xe27b('0x4e')]=function(_0x366e4c,_0x5ca9bc,_0xe00231){if(_0x366e4c[_0xe27b('0x48')]['id']){delete _0x366e4c[_0xe27b('0x48')]['id'];}return db[_0xe27b('0x2b')][_0xe27b('0x4a')]({'where':{'id':_0x366e4c[_0xe27b('0x45')]['id']}})[_0xe27b('0x26')](handleEntityNotFound(_0x5ca9bc,null))['then'](function(_0x14c23d){if(_0x14c23d){_0x366e4c['body']['AccountId']=_0x14c23d['id'];_0x366e4c['body']['Subjects']=integrations['getSubjects'](_0x366e4c[_0xe27b('0x48')][_0xe27b('0x4f')],_0x366e4c[_0xe27b('0x48')]['type']);_0x366e4c['body'][_0xe27b('0x50')]=integrations[_0xe27b('0x51')](_0x366e4c['body'][_0xe27b('0x4f')],_0x366e4c[_0xe27b('0x48')][_0xe27b('0x2e')]);return db[_0xe27b('0x4b')]['create'](_0x366e4c['body'],{'include':[{'model':db[_0xe27b('0x52')],'as':'Subjects'},{'model':db[_0xe27b('0x52')],'as':'Descriptions'}]});}return null;})[_0xe27b('0x26')](respondWithResult(_0x5ca9bc,null))[_0xe27b('0x43')](handleError(_0x5ca9bc,null));};var md5=require(_0xe27b('0x53'));exports[_0xe27b('0x54')]=function(_0x126c6f,_0x4fcbe1,_0x4538d5){var _0x5cf3b7=null;var _0x1cd850=null;var _0x184fd3=null;var _0x5e8dfa=null;var _0x6fd129='';return db[_0xe27b('0x2b')][_0xe27b('0x4a')]({'where':{'id':_0x126c6f[_0xe27b('0x45')]['id']},'attributes':['id','name',_0xe27b('0x55'),_0xe27b('0x56'),'moduleName',_0xe27b('0x57'),_0xe27b('0x58'),_0xe27b('0x59')]})['then'](handleEntityNotFound(_0x4fcbe1,null))[_0xe27b('0x26')](function(_0x8757ee){if(_0x8757ee){_0x5cf3b7=_0x8757ee['username'];_0x1cd850=_0x8757ee[_0xe27b('0x59')];_0x184fd3=_0x8757ee['moduleName'];_0x6fd129=_0x8757ee['remoteUri'];var _0x2b0f15=_0x6fd129['slice'](-0x1);if(_0x2b0f15==='/'){_0x6fd129=_0x6fd129[_0xe27b('0x5a')](0x0,_0x6fd129[_0xe27b('0x5b')](_0x2b0f15));}_0x5e8dfa=util[_0xe27b('0x5c')](_0xe27b('0x5d'),_0x6fd129);var _0x3c5996={'method':'GET','uri':_0x5e8dfa,'qs':{'operation':_0xe27b('0x5e'),'username':_0x8757ee[_0xe27b('0x55')]},'json':!![]};return rp(_0x3c5996);}})['then'](function(_0x18eaa1){if(_0x18eaa1['success']){var _0x4d1674={'method':_0xe27b('0x5f'),'uri':_0x5e8dfa,'form':{'operation':_0xe27b('0x60'),'username':_0x5cf3b7,'accessKey':md5(_0x18eaa1[_0xe27b('0x61')][_0xe27b('0x62')]+_0x1cd850)},'json':!![]};return rp(_0x4d1674);}})[_0xe27b('0x26')](function(_0x1312ad){if(_0x1312ad[_0xe27b('0x63')]){var _0x512b28={'method':_0xe27b('0x64'),'uri':_0x5e8dfa,'qs':{'operation':_0xe27b('0x65'),'username':_0x5cf3b7,'sessionName':_0x1312ad['result'][_0xe27b('0x66')],'elementType':_0x184fd3},'json':!![]};return rp(_0x512b28);}})['then'](function(_0x31e3c3){if(_0x31e3c3['success']){var _0x2eab27=[_0xe27b('0x67'),_0xe27b('0x68'),_0xe27b('0x69')];_[_0xe27b('0x6a')](_0x31e3c3['result'][_0xe27b('0x37')],function(_0x354851){return _0x2eab27['includes'](_0x354851[_0xe27b('0x2e')][_0xe27b('0x29')]);});_[_0xe27b('0x6a')](_0x31e3c3[_0xe27b('0x61')]['fields'],function(_0x1e7138){return _0x1e7138[_0xe27b('0x6b')]===_0xe27b('0x6c');});return{'count':_0x31e3c3[_0xe27b('0x61')][_0xe27b('0x37')][_0xe27b('0x38')],'rows':_[_0xe27b('0x31')](_0x31e3c3['result'][_0xe27b('0x37')],function(_0x25b26d){return{'id':_0x25b26d[_0xe27b('0x29')],'name':_0x25b26d[_0xe27b('0x6d')],'custom':_[_0xe27b('0x6e')](_0x25b26d[_0xe27b('0x29')],_0xe27b('0x6f'))?!![]:![],'options':_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x29')]===_0xe27b('0x70')&&_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x71')][_0xe27b('0x38')]>0x0?_[_0xe27b('0x31')](_0x25b26d[_0xe27b('0x2e')][_0xe27b('0x71')],function(_0x2c6696){return{'name':_0x2c6696[_0xe27b('0x6d')],'value':_0x2c6696['value']};}):[]};})};}})['then'](respondWithResult(_0x4fcbe1,null))[_0xe27b('0x43')](function(_0xb63329){console[_0xe27b('0x72')](_0xe27b('0x73')+_0xb63329);var _0x58d59b=_0x126c6f[_0xe27b('0x32')][_0xe27b('0x74')]?0x1f4:_0xb63329[_0xe27b('0x75')]||0x1f4;logger[_0xe27b('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xe27b('0x54'),_0x58d59b,JSON[_0xe27b('0x76')](_0xb63329));delete _0xb63329['name'];if(_0x58d59b===0x191){_0x58d59b=0x190;}_0x4fcbe1['status'](_0x58d59b)[_0xe27b('0x77')](_0x126c6f[_0xe27b('0x32')][_0xe27b('0x74')]?{'message':_0xe27b('0x78'),'statusCode':_0xb63329[_0xe27b('0x75')]}:_0xb63329);});}; \ No newline at end of file +var _0xe017=['then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','VtigerAccount','include','findAll','rows','catch','show','params','find','create','body','findOne','VtigerConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','label','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x1b34aa,_0x218c95){var _0x424c7c=function(_0x5d0206){while(--_0x5d0206){_0x1b34aa['push'](_0x1b34aa['shift']());}};_0x424c7c(++_0x218c95);}(_0xe017,0x1e0));var _0x7e01=function(_0x382671,_0x176b3c){_0x382671=_0x382671-0x0;var _0x50218b=_0xe017[_0x382671];return _0x50218b;};'use strict';var emlformat=require(_0x7e01('0x0'));var rimraf=require(_0x7e01('0x1'));var zipdir=require(_0x7e01('0x2'));var jsonpatch=require(_0x7e01('0x3'));var rp=require(_0x7e01('0x4'));var moment=require(_0x7e01('0x5'));var BPromise=require(_0x7e01('0x6'));var Mustache=require(_0x7e01('0x7'));var util=require(_0x7e01('0x8'));var path=require(_0x7e01('0x9'));var sox=require(_0x7e01('0xa'));var csv=require('to-csv');var ejs=require(_0x7e01('0xb'));var fs=require('fs');var fs_extra=require(_0x7e01('0xc'));var _=require(_0x7e01('0xd'));var squel=require(_0x7e01('0xe'));var crypto=require(_0x7e01('0xf'));var jsforce=require(_0x7e01('0x10'));var deskjs=require(_0x7e01('0x11'));var toCsv=require(_0x7e01('0x12'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e01('0x13'));var authService=require(_0x7e01('0x14'));var qs=require(_0x7e01('0x15'));var as=require(_0x7e01('0x16'));var hardwareService=require(_0x7e01('0x17'));var logger=require(_0x7e01('0x18'))(_0x7e01('0x19'));var utils=require(_0x7e01('0x1a'));var config=require(_0x7e01('0x1b'));var licenseUtil=require(_0x7e01('0x1c'));var db=require(_0x7e01('0x1d'))['db'];var integrations=require(_0x7e01('0x1e'));function respondWithStatusCode(_0x3a2381,_0x32fd50){_0x32fd50=_0x32fd50||0xcc;return function(_0x528d2a){if(_0x528d2a){return _0x3a2381[_0x7e01('0x1f')](_0x32fd50);}return _0x3a2381['status'](_0x32fd50)[_0x7e01('0x20')]();};}function respondWithResult(_0x15ba5a,_0x44d0ef){_0x44d0ef=_0x44d0ef||0xc8;return function(_0x1b90f1){if(_0x1b90f1){return _0x15ba5a[_0x7e01('0x21')](_0x44d0ef)[_0x7e01('0x22')](_0x1b90f1);}};}function respondWithFilteredResult(_0x10051f,_0x591f32){return function(_0x12be92){if(_0x12be92){var _0x11373e=typeof _0x591f32[_0x7e01('0x23')]===_0x7e01('0x24')&&typeof _0x591f32[_0x7e01('0x25')]==='undefined';var _0x308bdb=_0x12be92[_0x7e01('0x26')];var _0x5bb1af=_0x11373e?0x0:_0x591f32[_0x7e01('0x23')];var _0x407afe=_0x11373e?_0x12be92[_0x7e01('0x26')]:_0x591f32[_0x7e01('0x23')]+_0x591f32['limit'];var _0x44d5ba;if(_0x407afe>=_0x308bdb){_0x407afe=_0x308bdb;_0x44d5ba=0xc8;}else{_0x44d5ba=0xce;}_0x10051f[_0x7e01('0x21')](_0x44d5ba);return _0x10051f['set'](_0x7e01('0x27'),_0x5bb1af+'-'+_0x407afe+'/'+_0x308bdb)[_0x7e01('0x22')](_0x12be92);}return null;};}function patchUpdates(_0x1f1f11){return function(_0x24539f){try{jsonpatch[_0x7e01('0x28')](_0x24539f,_0x1f1f11,!![]);}catch(_0x1788e9){return BPromise[_0x7e01('0x29')](_0x1788e9);}return _0x24539f[_0x7e01('0x2a')]();};}function saveUpdates(_0x59a9d9,_0x276a3f){return function(_0x3df1d2){if(_0x3df1d2){return _0x3df1d2[_0x7e01('0x2b')](_0x59a9d9)[_0x7e01('0x2c')](function(_0x1988c8){return _0x1988c8;});}return null;};}function removeEntity(_0x15cfdc,_0x3d3b81){return function(_0x2ac439){if(_0x2ac439){return _0x2ac439[_0x7e01('0x2d')]()['then'](function(){_0x15cfdc[_0x7e01('0x21')](0xcc)[_0x7e01('0x20')]();});}};}function handleEntityNotFound(_0x557c79,_0x10ce60){return function(_0x4cd6d7){if(!_0x4cd6d7){_0x557c79[_0x7e01('0x1f')](0x194);}return _0x4cd6d7;};}function handleError(_0x25ef2e,_0x944676){_0x944676=_0x944676||0x1f4;return function(_0x179c1d){logger['error'](_0x179c1d[_0x7e01('0x2e')]);if(_0x179c1d[_0x7e01('0x2f')]){delete _0x179c1d[_0x7e01('0x2f')];}_0x25ef2e['status'](_0x944676)[_0x7e01('0x30')](_0x179c1d);};}exports[_0x7e01('0x31')]=function(_0x401856,_0x4854ea){var _0x846840={},_0x36e893={},_0x15bb6b={'count':0x0,'rows':[]};var _0x521dd8=_['map'](db['VtigerAccount'][_0x7e01('0x32')],function(_0x154ff9){return{'name':_0x154ff9[_0x7e01('0x33')],'type':_0x154ff9[_0x7e01('0x34')][_0x7e01('0x35')]};});_0x36e893[_0x7e01('0x36')]=_['map'](_0x521dd8,_0x7e01('0x2f'));_0x36e893[_0x7e01('0x37')]=_[_0x7e01('0x38')](_0x401856[_0x7e01('0x37')]);_0x36e893[_0x7e01('0x39')]=_[_0x7e01('0x3a')](_0x36e893['model'],_0x36e893['query']);_0x846840['attributes']=_['intersection'](_0x36e893[_0x7e01('0x36')],qs[_0x7e01('0x3b')](_0x401856[_0x7e01('0x37')]['fields']));_0x846840[_0x7e01('0x3c')]=_0x846840[_0x7e01('0x3c')][_0x7e01('0x3d')]?_0x846840[_0x7e01('0x3c')]:_0x36e893[_0x7e01('0x36')];if(!_0x401856['query'][_0x7e01('0x3e')](_0x7e01('0x3f'))){_0x846840['limit']=qs[_0x7e01('0x25')](_0x401856[_0x7e01('0x37')][_0x7e01('0x25')]);_0x846840[_0x7e01('0x23')]=qs[_0x7e01('0x23')](_0x401856[_0x7e01('0x37')][_0x7e01('0x23')]);}_0x846840[_0x7e01('0x40')]=qs[_0x7e01('0x41')](_0x401856[_0x7e01('0x37')][_0x7e01('0x41')]);_0x846840[_0x7e01('0x42')]=qs[_0x7e01('0x39')](_[_0x7e01('0x43')](_0x401856[_0x7e01('0x37')],_0x36e893[_0x7e01('0x39')]),_0x521dd8);if(_0x401856[_0x7e01('0x37')][_0x7e01('0x44')]){_0x846840[_0x7e01('0x42')]=_[_0x7e01('0x45')](_0x846840[_0x7e01('0x42')],{'$or':_[_0x7e01('0x46')](_0x521dd8,function(_0x52fc16){if(_0x52fc16[_0x7e01('0x34')]!==_0x7e01('0x47')){var _0x1dc083={};_0x1dc083[_0x52fc16[_0x7e01('0x2f')]]={'$like':'%'+_0x401856[_0x7e01('0x37')][_0x7e01('0x44')]+'%'};return _0x1dc083;}})});}_0x846840=_[_0x7e01('0x45')]({},_0x846840,_0x401856[_0x7e01('0x48')]);var _0x361899={'where':_0x846840['where']};return db[_0x7e01('0x49')]['count'](_0x361899)[_0x7e01('0x2c')](function(_0x43ef8b){_0x15bb6b[_0x7e01('0x26')]=_0x43ef8b;if(_0x401856[_0x7e01('0x37')]['includeAll']){_0x846840[_0x7e01('0x4a')]=[{'all':!![]}];}return db[_0x7e01('0x49')][_0x7e01('0x4b')](_0x846840);})[_0x7e01('0x2c')](function(_0x5ecf65){_0x15bb6b[_0x7e01('0x4c')]=_0x5ecf65;return _0x15bb6b;})[_0x7e01('0x2c')](respondWithFilteredResult(_0x4854ea,_0x846840))[_0x7e01('0x4d')](handleError(_0x4854ea,null));};exports[_0x7e01('0x4e')]=function(_0x14cfb8,_0x1bfb64){var _0x4ce258={'raw':![],'where':{'id':_0x14cfb8[_0x7e01('0x4f')]['id']}},_0x4e7cc3={};_0x4e7cc3[_0x7e01('0x36')]=_['keys'](db[_0x7e01('0x49')]['rawAttributes']);_0x4e7cc3[_0x7e01('0x37')]=_[_0x7e01('0x38')](_0x14cfb8[_0x7e01('0x37')]);_0x4e7cc3[_0x7e01('0x39')]=_[_0x7e01('0x3a')](_0x4e7cc3[_0x7e01('0x36')],_0x4e7cc3['query']);_0x4ce258['attributes']=_[_0x7e01('0x3a')](_0x4e7cc3[_0x7e01('0x36')],qs['fields'](_0x14cfb8['query'][_0x7e01('0x3b')]));_0x4ce258[_0x7e01('0x3c')]=_0x4ce258['attributes'][_0x7e01('0x3d')]?_0x4ce258[_0x7e01('0x3c')]:_0x4e7cc3[_0x7e01('0x36')];if(_0x14cfb8[_0x7e01('0x37')]['includeAll']){_0x4ce258[_0x7e01('0x4a')]=[{'all':!![]}];}_0x4ce258=_[_0x7e01('0x45')]({},_0x4ce258,_0x14cfb8[_0x7e01('0x48')]);return db[_0x7e01('0x49')][_0x7e01('0x50')](_0x4ce258)[_0x7e01('0x2c')](handleEntityNotFound(_0x1bfb64,null))['then'](respondWithResult(_0x1bfb64,null))[_0x7e01('0x4d')](handleError(_0x1bfb64,null));};exports[_0x7e01('0x51')]=function(_0x2c722b,_0x105b81){return db[_0x7e01('0x49')][_0x7e01('0x51')](_0x2c722b[_0x7e01('0x52')],{})['then'](respondWithResult(_0x105b81,0xc9))[_0x7e01('0x4d')](handleError(_0x105b81,null));};exports[_0x7e01('0x2b')]=function(_0x3c4064,_0x487ef5){if(_0x3c4064[_0x7e01('0x52')]['id']){delete _0x3c4064[_0x7e01('0x52')]['id'];}return db[_0x7e01('0x49')][_0x7e01('0x50')]({'where':{'id':_0x3c4064[_0x7e01('0x4f')]['id']}})[_0x7e01('0x2c')](handleEntityNotFound(_0x487ef5,null))[_0x7e01('0x2c')](saveUpdates(_0x3c4064[_0x7e01('0x52')],null))[_0x7e01('0x2c')](respondWithResult(_0x487ef5,null))['catch'](handleError(_0x487ef5,null));};exports[_0x7e01('0x2d')]=function(_0x3828ec,_0x419553){return db[_0x7e01('0x49')][_0x7e01('0x50')]({'where':{'id':_0x3828ec[_0x7e01('0x4f')]['id']}})[_0x7e01('0x2c')](handleEntityNotFound(_0x419553,null))[_0x7e01('0x2c')](removeEntity(_0x419553,null))[_0x7e01('0x4d')](handleError(_0x419553,null));};exports['getConfigurations']=function(_0x184a75,_0x3839ff,_0x1aaee5){var _0x4244d2={};var _0x2d0c5f={};var _0x41ff74;var _0x36459a;return db[_0x7e01('0x49')][_0x7e01('0x53')]({'where':{'id':_0x184a75[_0x7e01('0x4f')]['id']}})[_0x7e01('0x2c')](handleEntityNotFound(_0x3839ff,null))[_0x7e01('0x2c')](function(_0x519b13){if(_0x519b13){_0x41ff74=_0x519b13;_0x2d0c5f['model']=_[_0x7e01('0x38')](db[_0x7e01('0x54')][_0x7e01('0x32')]);_0x2d0c5f['query']=_[_0x7e01('0x38')](_0x184a75[_0x7e01('0x37')]);_0x2d0c5f['filters']=_[_0x7e01('0x3a')](_0x2d0c5f[_0x7e01('0x36')],_0x2d0c5f[_0x7e01('0x37')]);_0x4244d2[_0x7e01('0x3c')]=_[_0x7e01('0x3a')](_0x2d0c5f['model'],qs['fields'](_0x184a75[_0x7e01('0x37')][_0x7e01('0x3b')]));_0x4244d2['attributes']=_0x4244d2['attributes'][_0x7e01('0x3d')]?_0x4244d2[_0x7e01('0x3c')]:_0x2d0c5f[_0x7e01('0x36')];_0x4244d2['order']=qs[_0x7e01('0x41')](_0x184a75[_0x7e01('0x37')][_0x7e01('0x41')]);_0x4244d2['where']=qs[_0x7e01('0x39')](_['pick'](_0x184a75[_0x7e01('0x37')],_0x2d0c5f[_0x7e01('0x39')]));if(_0x184a75['query'][_0x7e01('0x44')]){_0x4244d2[_0x7e01('0x42')]=_[_0x7e01('0x45')](_0x4244d2[_0x7e01('0x42')],{'$or':_['map'](_0x4244d2[_0x7e01('0x3c')],function(_0x21f36f){var _0xf70a4c={};_0xf70a4c[_0x21f36f]={'$like':'%'+_0x184a75[_0x7e01('0x37')][_0x7e01('0x44')]+'%'};return _0xf70a4c;})});}_0x4244d2=_[_0x7e01('0x45')]({},_0x4244d2,_0x184a75[_0x7e01('0x48')]);return _0x41ff74[_0x7e01('0x55')](_0x4244d2);}})[_0x7e01('0x2c')](function(_0x5236e9){if(_0x5236e9){_0x36459a=_0x5236e9['length'];if(!_0x184a75[_0x7e01('0x37')]['hasOwnProperty'](_0x7e01('0x3f'))){_0x4244d2['limit']=qs['limit'](_0x184a75[_0x7e01('0x37')][_0x7e01('0x25')]);_0x4244d2['offset']=qs[_0x7e01('0x23')](_0x184a75[_0x7e01('0x37')]['offset']);}return _0x41ff74['getConfigurations'](_0x4244d2);}})[_0x7e01('0x2c')](function(_0xca89d8){if(_0xca89d8){return _0xca89d8?{'count':_0x36459a,'rows':_0xca89d8}:null;}})[_0x7e01('0x2c')](respondWithResult(_0x3839ff,null))[_0x7e01('0x4d')](handleError(_0x3839ff,null));};exports['addConfiguration']=function(_0xc4645b,_0xab19f6,_0xebb066){if(_0xc4645b['body']['id']){delete _0xc4645b[_0x7e01('0x52')]['id'];}return db['VtigerAccount'][_0x7e01('0x53')]({'where':{'id':_0xc4645b['params']['id']}})[_0x7e01('0x2c')](handleEntityNotFound(_0xab19f6,null))[_0x7e01('0x2c')](function(_0x56f652){if(_0x56f652){_0xc4645b[_0x7e01('0x52')][_0x7e01('0x56')]=_0x56f652['id'];_0xc4645b['body'][_0x7e01('0x57')]=integrations[_0x7e01('0x58')](_0xc4645b['body'][_0x7e01('0x59')],_0xc4645b[_0x7e01('0x52')][_0x7e01('0x34')]);_0xc4645b[_0x7e01('0x52')][_0x7e01('0x5a')]=integrations[_0x7e01('0x5b')](_0xc4645b['body']['channel'],_0xc4645b[_0x7e01('0x52')][_0x7e01('0x34')]);return db['VtigerConfiguration']['create'](_0xc4645b['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x7e01('0x5c')],'as':_0x7e01('0x5a')}]});}return null;})[_0x7e01('0x2c')](respondWithResult(_0xab19f6,null))[_0x7e01('0x4d')](handleError(_0xab19f6,null));};var md5=require(_0x7e01('0x5d'));exports[_0x7e01('0x5e')]=function(_0x30ee21,_0x9b1e57,_0x5ec246){var _0x521567=null;var _0x472674=null;var _0x2edbfe=null;var _0x577ce7=null;var _0x10232e='';return db[_0x7e01('0x49')]['findOne']({'where':{'id':_0x30ee21[_0x7e01('0x4f')]['id']},'attributes':['id','name',_0x7e01('0x5f'),_0x7e01('0x60'),_0x7e01('0x61'),_0x7e01('0x62'),_0x7e01('0x63'),_0x7e01('0x64')]})[_0x7e01('0x2c')](handleEntityNotFound(_0x9b1e57,null))[_0x7e01('0x2c')](function(_0x23a072){if(_0x23a072){_0x521567=_0x23a072['username'];_0x472674=_0x23a072[_0x7e01('0x64')];_0x2edbfe=_0x23a072[_0x7e01('0x61')];_0x10232e=_0x23a072['remoteUri'];var _0x3e736e=_0x10232e['slice'](-0x1);if(_0x3e736e==='/'){_0x10232e=_0x10232e[_0x7e01('0x65')](0x0,_0x10232e[_0x7e01('0x66')](_0x3e736e));}_0x577ce7=util[_0x7e01('0x67')](_0x7e01('0x68'),_0x10232e);var _0x27695f={'method':_0x7e01('0x69'),'uri':_0x577ce7,'qs':{'operation':_0x7e01('0x6a'),'username':_0x23a072['username']},'json':!![]};return rp(_0x27695f);}})[_0x7e01('0x2c')](function(_0x16d72b){if(_0x16d72b[_0x7e01('0x6b')]){var _0x488e6e={'method':_0x7e01('0x6c'),'uri':_0x577ce7,'form':{'operation':_0x7e01('0x6d'),'username':_0x521567,'accessKey':md5(_0x16d72b[_0x7e01('0x6e')][_0x7e01('0x6f')]+_0x472674)},'json':!![]};return rp(_0x488e6e);}})[_0x7e01('0x2c')](function(_0x30b6b8){if(_0x30b6b8[_0x7e01('0x6b')]){var _0x126eed={'method':_0x7e01('0x69'),'uri':_0x577ce7,'qs':{'operation':_0x7e01('0x70'),'username':_0x521567,'sessionName':_0x30b6b8[_0x7e01('0x6e')][_0x7e01('0x71')],'elementType':_0x2edbfe},'json':!![]};return rp(_0x126eed);}})[_0x7e01('0x2c')](function(_0x13226e){if(_0x13226e[_0x7e01('0x6b')]){var _0x2819e4=[_0x7e01('0x72'),_0x7e01('0x73'),_0x7e01('0x74')];_[_0x7e01('0x75')](_0x13226e[_0x7e01('0x6e')]['fields'],function(_0x101d92){return _0x2819e4[_0x7e01('0x76')](_0x101d92[_0x7e01('0x34')]['name']);});_[_0x7e01('0x75')](_0x13226e['result'][_0x7e01('0x3b')],function(_0x87bb15){return _0x87bb15[_0x7e01('0x77')]==='false';});return{'count':_0x13226e[_0x7e01('0x6e')]['fields'][_0x7e01('0x3d')],'rows':_['map'](_0x13226e['result'][_0x7e01('0x3b')],function(_0x11fae5){return{'id':_0x11fae5['name'],'name':_0x11fae5[_0x7e01('0x78')],'custom':_['startsWith'](_0x11fae5[_0x7e01('0x2f')],_0x7e01('0x79'))?!![]:![],'options':_0x11fae5[_0x7e01('0x34')][_0x7e01('0x2f')]===_0x7e01('0x7a')&&_0x11fae5['type'][_0x7e01('0x7b')][_0x7e01('0x3d')]>0x0?_[_0x7e01('0x46')](_0x11fae5[_0x7e01('0x34')][_0x7e01('0x7b')],function(_0x1f60eb){return{'name':_0x1f60eb[_0x7e01('0x78')],'value':_0x1f60eb[_0x7e01('0x7c')]};}):[]};})};}})[_0x7e01('0x2c')](respondWithResult(_0x9b1e57,null))[_0x7e01('0x4d')](function(_0x92b90b){console[_0x7e01('0x7d')](_0x7e01('0x7e')+_0x92b90b);var _0x1355a8=_0x30ee21[_0x7e01('0x37')][_0x7e01('0x7f')]?0x1f4:_0x92b90b['statusCode']||0x1f4;logger['error'](_0x7e01('0x80'),_0x7e01('0x5e'),_0x1355a8,JSON['stringify'](_0x92b90b));delete _0x92b90b['name'];if(_0x1355a8===0x191){_0x1355a8=0x190;}_0x9b1e57['status'](_0x1355a8)['send'](_0x30ee21[_0x7e01('0x37')][_0x7e01('0x7f')]?{'message':_0x7e01('0x81'),'statusCode':_0x92b90b[_0x7e01('0x82')]}:_0x92b90b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8ac95c3..6d0fd2d 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 _0x9e9a=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes'];(function(_0x5272ce,_0x47346f){var _0x501f98=function(_0x2e2ed4){while(--_0x2e2ed4){_0x5272ce['push'](_0x5272ce['shift']());}};_0x501f98(++_0x47346f);}(_0x9e9a,0xfc));var _0xa9e9=function(_0x44d3d7,_0x1c6356){_0x44d3d7=_0x44d3d7-0x0;var _0x1886c0=_0x9e9a[_0x44d3d7];return _0x1886c0;};'use strict';var _=require(_0xa9e9('0x0'));var util=require('util');var logger=require(_0xa9e9('0x1'))('api');var moment=require(_0xa9e9('0x2'));var BPromise=require(_0xa9e9('0x3'));var rp=require(_0xa9e9('0x4'));var fs=require('fs');var path=require(_0xa9e9('0x5'));var rimraf=require('rimraf');var config=require(_0xa9e9('0x6'));var attributes=require(_0xa9e9('0x7'));var integrations=require(_0xa9e9('0x8'));module[_0xa9e9('0x9')]=function(_0x1e156b,_0x323e68){return _0x1e156b[_0xa9e9('0xa')](_0xa9e9('0xb'),attributes,{'tableName':_0xa9e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3755=['int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount'];(function(_0x385814,_0x21c0cb){var _0x188862=function(_0x1f6fe1){while(--_0x1f6fe1){_0x385814['push'](_0x385814['shift']());}};_0x188862(++_0x21c0cb);}(_0x3755,0x1bb));var _0x5375=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3755[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5375('0x0'));var util=require(_0x5375('0x1'));var logger=require(_0x5375('0x2'))(_0x5375('0x3'));var moment=require('moment');var BPromise=require(_0x5375('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5375('0x5'));var rimraf=require(_0x5375('0x6'));var config=require(_0x5375('0x7'));var attributes=require(_0x5375('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5375('0x9')]=function(_0x97e569,_0x343094){return _0x97e569[_0x5375('0xa')](_0x5375('0xb'),attributes,{'tableName':_0x5375('0xc'),'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 b0c12c5..d013a17 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 _0xf45e=['options','raw','where','attributes','limit','include','model','map','VtigerAccount','find','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','findAll'];(function(_0x39f1da,_0x497301){var _0x2d5907=function(_0x59f3ec){while(--_0x59f3ec){_0x39f1da['push'](_0x39f1da['shift']());}};_0x2d5907(++_0x497301);}(_0xf45e,0x115));var _0xef45=function(_0x9ad312,_0x13a508){_0x9ad312=_0x9ad312-0x0;var _0x2d236b=_0xf45e[_0x9ad312];return _0x2d236b;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2e92,_0x3303ad,_0x1a68c4){return new BPromise(function(_0x1e0def,_0x268ef6){return client[_0xef45('0xc')](_0x2f2e92,_0x1a68c4)[_0xef45('0xd')](function(_0x158a0b){logger[_0xef45('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0xef45('0xf'));logger[_0xef45('0x10')](_0xef45('0x11'),_0x3303ad,_0xef45('0xf'),JSON[_0xef45('0x12')](_0x158a0b));if(_0x158a0b[_0xef45('0x13')]){if(_0x158a0b['error'][_0xef45('0x14')]===0x1f4){logger[_0xef45('0x13')](_0xef45('0x15'),_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x268ef6(_0x158a0b['error']['message']);}logger[_0xef45('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x158a0b[_0xef45('0x13')][_0xef45('0x16')]);return _0x1e0def(_0x158a0b[_0xef45('0x13')]['message']);}else{logger['info'](_0xef45('0x15'),_0x3303ad,'request\x20sent');_0x1e0def(_0x158a0b[_0xef45('0x17')][_0xef45('0x16')]);}})[_0xef45('0x18')](function(_0x3f40e5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3303ad,_0x3f40e5);_0x268ef6(_0x3f40e5);});});}exports[_0xef45('0x19')]=function(_0x219778){var _0x3ba1f4=this;return new Promise(function(_0x258785,_0x4ca902){return db['VtigerAccount'][_0xef45('0x1a')]({'raw':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1c')]===undefined?!![]:![]:!![],'where':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x219778['options']?_0x219778[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'limit':_0x219778[_0xef45('0x1b')]?_0x219778[_0xef45('0x1b')][_0xef45('0x1f')]||null:null,'include':_0x219778['options']?_0x219778[_0xef45('0x1b')]['include']?_['map'](_0x219778[_0xef45('0x1b')][_0xef45('0x20')],function(_0xbb859b){return{'model':db[_0xbb859b[_0xef45('0x21')]],'as':_0xbb859b['as'],'attributes':_0xbb859b[_0xef45('0x1e')],'include':_0xbb859b[_0xef45('0x20')]?_[_0xef45('0x22')](_0xbb859b['include'],function(_0x208b35){return{'model':db[_0x208b35['model']],'as':_0x208b35['as'],'attributes':_0x208b35[_0xef45('0x1e')],'include':_0x208b35[_0xef45('0x20')]?_['map'](_0x208b35[_0xef45('0x20')],function(_0x2c356d){return{'model':db[_0x2c356d['model']],'as':_0x2c356d['as'],'attributes':_0x2c356d[_0xef45('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550e18){logger['info']('GetVtigerAccount',_0x219778);logger[_0xef45('0x10')](_0xef45('0x19'),_0x219778,JSON[_0xef45('0x12')](_0x550e18));_0x258785(_0x550e18);})[_0xef45('0x18')](function(_0x5782d0){logger[_0xef45('0x13')]('GetVtigerAccount',_0x5782d0[_0xef45('0x16')],_0x219778);_0x4ca902(_0x3ba1f4['error'](0x1f4,_0x5782d0[_0xef45('0x16')]));});});};exports['ShowVtigerAccount']=function(_0x575734){var _0x14ce5a=this;return new Promise(function(_0x3e45de,_0x390a7a){return db[_0xef45('0x23')][_0xef45('0x24')]({'raw':_0x575734['options']?_0x575734['options']['raw']===undefined?!![]:![]:!![],'where':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1d')]||null:null,'attributes':_0x575734[_0xef45('0x1b')]?_0x575734[_0xef45('0x1b')][_0xef45('0x1e')]||null:null,'include':_0x575734[_0xef45('0x1b')]?_0x575734['options']['include']?_[_0xef45('0x22')](_0x575734['options'][_0xef45('0x20')],function(_0x5116b0){return{'model':db[_0x5116b0[_0xef45('0x21')]],'as':_0x5116b0['as'],'attributes':_0x5116b0[_0xef45('0x1e')],'include':_0x5116b0[_0xef45('0x20')]?_[_0xef45('0x22')](_0x5116b0[_0xef45('0x20')],function(_0x5b7d73){return{'model':db[_0x5b7d73[_0xef45('0x21')]],'as':_0x5b7d73['as'],'attributes':_0x5b7d73[_0xef45('0x1e')],'include':_0x5b7d73[_0xef45('0x20')]?_['map'](_0x5b7d73['include'],function(_0x787387){return{'model':db[_0x787387[_0xef45('0x21')]],'as':_0x787387['as'],'attributes':_0x787387['attributes']};}):[]};}):[]};}):[]:[]})[_0xef45('0xd')](function(_0x501eb3){logger['info'](_0xef45('0x25'),_0x575734);logger[_0xef45('0x10')](_0xef45('0x25'),_0x575734,JSON['stringify'](_0x501eb3));_0x3e45de(_0x501eb3);})[_0xef45('0x18')](function(_0x3a1bcc){logger[_0xef45('0x13')](_0xef45('0x25'),_0x3a1bcc['message'],_0x575734);_0x390a7a(_0x14ce5a['error'](0x1f4,_0x3a1bcc[_0xef45('0x16')]));});});}; \ No newline at end of file +var _0xf4eb=['VtigerAccount','findAll','options','where','attributes','limit','map','model','include','find','raw','ShowVtigerAccount','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount'];(function(_0x24c09a,_0x416174){var _0x28fdf5=function(_0x2a844d){while(--_0x2a844d){_0x24c09a['push'](_0x24c09a['shift']());}};_0x28fdf5(++_0x416174);}(_0xf4eb,0xec));var _0xbf4e=function(_0x282a3d,_0x5516df){_0x282a3d=_0x282a3d-0x0;var _0x2e3d12=_0xf4eb[_0x282a3d];return _0x2e3d12;};'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')]('VtigerAccount,\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')]('VtigerAccount,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});}exports[_0xbf4e('0x13')]=function(_0x577c27){var _0x5db03f=this;return new Promise(function(_0x566ec3,_0x4f8762){return db[_0xbf4e('0x14')][_0xbf4e('0x15')]({'raw':_0x577c27[_0xbf4e('0x16')]?_0x577c27['options']['raw']===undefined?!![]:![]:!![],'where':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x18')]||null:null,'limit':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')][_0xbf4e('0x19')]||null:null,'include':_0x577c27[_0xbf4e('0x16')]?_0x577c27[_0xbf4e('0x16')]['include']?_[_0xbf4e('0x1a')](_0x577c27[_0xbf4e('0x16')]['include'],function(_0x31e3f5){return{'model':db[_0x31e3f5[_0xbf4e('0x1b')]],'as':_0x31e3f5['as'],'attributes':_0x31e3f5[_0xbf4e('0x18')],'include':_0x31e3f5[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x31e3f5['include'],function(_0x90635e){return{'model':db[_0x90635e[_0xbf4e('0x1b')]],'as':_0x90635e['as'],'attributes':_0x90635e[_0xbf4e('0x18')],'include':_0x90635e['include']?_[_0xbf4e('0x1a')](_0x90635e['include'],function(_0x5bcf71){return{'model':db[_0x5bcf71[_0xbf4e('0x1b')]],'as':_0x5bcf71['as'],'attributes':_0x5bcf71['attributes']};}):[]};}):[]};}):[]:[]})[_0xbf4e('0x9')](function(_0x315df3){logger[_0xbf4e('0xa')](_0xbf4e('0x13'),_0x577c27);logger['debug'](_0xbf4e('0x13'),_0x577c27,JSON[_0xbf4e('0xe')](_0x315df3));_0x566ec3(_0x315df3);})[_0xbf4e('0x12')](function(_0x4cd4a1){logger[_0xbf4e('0xf')]('GetVtigerAccount',_0x4cd4a1[_0xbf4e('0x11')],_0x577c27);_0x4f8762(_0x5db03f[_0xbf4e('0xf')](0x1f4,_0x4cd4a1[_0xbf4e('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x1d12e2){var _0x362716=this;return new Promise(function(_0x2f3cf8,_0xc7ca87){return db[_0xbf4e('0x14')][_0xbf4e('0x1d')]({'raw':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')][_0xbf4e('0x17')]||null:null,'attributes':_0x1d12e2['options']?_0x1d12e2[_0xbf4e('0x16')]['attributes']||null:null,'include':_0x1d12e2[_0xbf4e('0x16')]?_0x1d12e2['options'][_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x1d12e2[_0xbf4e('0x16')]['include'],function(_0x2716b7){return{'model':db[_0x2716b7[_0xbf4e('0x1b')]],'as':_0x2716b7['as'],'attributes':_0x2716b7[_0xbf4e('0x18')],'include':_0x2716b7[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x2716b7[_0xbf4e('0x1c')],function(_0x5b8440){return{'model':db[_0x5b8440[_0xbf4e('0x1b')]],'as':_0x5b8440['as'],'attributes':_0x5b8440[_0xbf4e('0x18')],'include':_0x5b8440[_0xbf4e('0x1c')]?_[_0xbf4e('0x1a')](_0x5b8440[_0xbf4e('0x1c')],function(_0x5b7ea1){return{'model':db[_0x5b7ea1['model']],'as':_0x5b7ea1['as'],'attributes':_0x5b7ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x429c07){logger[_0xbf4e('0xa')](_0xbf4e('0x1f'),_0x1d12e2);logger[_0xbf4e('0xd')](_0xbf4e('0x1f'),_0x1d12e2,JSON[_0xbf4e('0xe')](_0x429c07));_0x2f3cf8(_0x429c07);})[_0xbf4e('0x12')](function(_0x467b74){logger[_0xbf4e('0xf')]('ShowVtigerAccount',_0x467b74['message'],_0x1d12e2);_0xc7ca87(_0x362716[_0xbf4e('0xf')](0x1f4,_0x467b74[_0xbf4e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 595e539..38aa10a 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 _0x3562=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','util','path','express','Router'];(function(_0x16528d,_0x3089e0){var _0x1fd73e=function(_0x1dca68){while(--_0x1dca68){_0x16528d['push'](_0x16528d['shift']());}};_0x1fd73e(++_0x3089e0);}(_0x3562,0x178));var _0x2356=function(_0x2ce286,_0x4104e4){_0x2ce286=_0x2ce286-0x0;var _0x4c471f=_0x3562[_0x2ce286];return _0x4c471f;};'use strict';var multer=require('multer');var util=require(_0x2356('0x0'));var path=require(_0x2356('0x1'));var timeout=require('connect-timeout');var express=require(_0x2356('0x2'));var router=express[_0x2356('0x3')]();var fs_extra=require(_0x2356('0x4'));var auth=require(_0x2356('0x5'));var interaction=require(_0x2356('0x6'));var config=require(_0x2356('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x2356('0x8')]('/',auth[_0x2356('0x9')](),controller['index']);router['get']('/:id',auth[_0x2356('0x9')](),controller['show']);router['get'](_0x2356('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x2356('0x8')](_0x2356('0xb'),auth[_0x2356('0x9')](),controller[_0x2356('0xc')]);router[_0x2356('0x8')](_0x2356('0xd'),auth[_0x2356('0x9')](),controller[_0x2356('0xe')]);router[_0x2356('0xf')]('/',auth[_0x2356('0x9')](),controller['create']);router[_0x2356('0x10')](_0x2356('0x11'),auth[_0x2356('0x9')](),controller[_0x2356('0x12')]);router['delete'](_0x2356('0x11'),auth[_0x2356('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf7a5=['show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4b5375,_0x4aa25f){var _0x58b94c=function(_0x5547c2){while(--_0x5547c2){_0x4b5375['push'](_0x4b5375['shift']());}};_0x58b94c(++_0x4aa25f);}(_0xf7a5,0xe6));var _0x5f7a=function(_0xb87d55,_0x578ce1){_0xb87d55=_0xb87d55-0x0;var _0x1c31c8=_0xf7a5[_0xb87d55];return _0x1c31c8;};'use strict';var multer=require('multer');var util=require(_0x5f7a('0x0'));var path=require('path');var timeout=require(_0x5f7a('0x1'));var express=require(_0x5f7a('0x2'));var router=express[_0x5f7a('0x3')]();var fs_extra=require(_0x5f7a('0x4'));var auth=require(_0x5f7a('0x5'));var interaction=require(_0x5f7a('0x6'));var config=require(_0x5f7a('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x5f7a('0x8')]('/',auth[_0x5f7a('0x9')](),controller[_0x5f7a('0xa')]);router[_0x5f7a('0x8')](_0x5f7a('0xb'),auth[_0x5f7a('0x9')](),controller[_0x5f7a('0xc')]);router[_0x5f7a('0x8')](_0x5f7a('0xd'),auth[_0x5f7a('0x9')](),controller['getFields']);router['get'](_0x5f7a('0xe'),auth[_0x5f7a('0x9')](),controller[_0x5f7a('0xf')]);router[_0x5f7a('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5f7a('0x10')]);router[_0x5f7a('0x11')]('/',auth['isAuthenticated'](),controller[_0x5f7a('0x12')]);router[_0x5f7a('0x13')](_0x5f7a('0xb'),auth[_0x5f7a('0x9')](),controller[_0x5f7a('0x14')]);router[_0x5f7a('0x15')](_0x5f7a('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 55f738f..7cac86f 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 _0x6f86=['sequelize','exports','STRING'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0x6f86,0x141));var _0x66f8=function(_0x1f736e,_0x23a84d){_0x1f736e=_0x1f736e-0x0;var _0x5760f1=_0x6f86[_0x1f736e];return _0x5760f1;};'use strict';var Sequelize=require(_0x66f8('0x0'));module[_0x66f8('0x1')]={'name':{'type':Sequelize[_0x66f8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc07b=['STRING','sequelize'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xc07b,0x187));var _0xbc07=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0xc07b[_0x4b03c9];return _0x161ba2;};'use strict';var Sequelize=require(_0xbc07('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc07('0x1')]},'description':{'type':Sequelize[_0xbc07('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ed1550e..045ad06 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 _0x436b=['bluebird','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','catch','create','body','find','getFields','findOne','nolimit','getSubjects','VtigerField','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3ab7fe,_0xaaa25){var _0x51c2a8=function(_0x3029a2){while(--_0x3029a2){_0x3ab7fe['push'](_0x3ab7fe['shift']());}};_0x51c2a8(++_0xaaa25);}(_0x436b,0x9a));var _0xb436=function(_0x24bb57,_0x4b43f4){_0x24bb57=_0x24bb57-0x0;var _0x329956=_0x436b[_0x24bb57];return _0x329956;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb436('0x0'));var zipdir=require(_0xb436('0x1'));var jsonpatch=require(_0xb436('0x2'));var rp=require(_0xb436('0x3'));var moment=require('moment');var BPromise=require(_0xb436('0x4'));var Mustache=require('mustache');var util=require(_0xb436('0x5'));var path=require(_0xb436('0x6'));var sox=require(_0xb436('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb436('0x8'));var squel=require(_0xb436('0x9'));var crypto=require(_0xb436('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb436('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb436('0xc'));var Papa=require(_0xb436('0xd'));var Redis=require(_0xb436('0xe'));var authService=require(_0xb436('0xf'));var qs=require(_0xb436('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb436('0x11'));var logger=require(_0xb436('0x12'))(_0xb436('0x13'));var utils=require(_0xb436('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb436('0x15'))['db'];function respondWithStatusCode(_0xca2e18,_0x3a373f){_0x3a373f=_0x3a373f||0xcc;return function(_0x5e2131){if(_0x5e2131){return _0xca2e18[_0xb436('0x16')](_0x3a373f);}return _0xca2e18[_0xb436('0x17')](_0x3a373f)[_0xb436('0x18')]();};}function respondWithResult(_0x2c1b56,_0x5d0654){_0x5d0654=_0x5d0654||0xc8;return function(_0x28dcf3){if(_0x28dcf3){return _0x2c1b56[_0xb436('0x17')](_0x5d0654)['json'](_0x28dcf3);}};}function respondWithFilteredResult(_0x14d5f2,_0x3a0b52){return function(_0x6ef7e0){if(_0x6ef7e0){var _0x32591e=typeof _0x3a0b52[_0xb436('0x19')]===_0xb436('0x1a')&&typeof _0x3a0b52[_0xb436('0x1b')]===_0xb436('0x1a');var _0x1d1e00=_0x6ef7e0[_0xb436('0x1c')];var _0xe5239a=_0x32591e?0x0:_0x3a0b52['offset'];var _0xbcbad0=_0x32591e?_0x6ef7e0[_0xb436('0x1c')]:_0x3a0b52['offset']+_0x3a0b52[_0xb436('0x1b')];var _0x4282ec;if(_0xbcbad0>=_0x1d1e00){_0xbcbad0=_0x1d1e00;_0x4282ec=0xc8;}else{_0x4282ec=0xce;}_0x14d5f2['status'](_0x4282ec);return _0x14d5f2[_0xb436('0x1d')](_0xb436('0x1e'),_0xe5239a+'-'+_0xbcbad0+'/'+_0x1d1e00)[_0xb436('0x1f')](_0x6ef7e0);}return null;};}function patchUpdates(_0x30fe5f){return function(_0x6e6a78){try{jsonpatch['apply'](_0x6e6a78,_0x30fe5f,!![]);}catch(_0x48c6a4){return BPromise[_0xb436('0x20')](_0x48c6a4);}return _0x6e6a78[_0xb436('0x21')]();};}function saveUpdates(_0x399a96,_0x58f407){return function(_0x2f97ea){if(_0x2f97ea){return _0x2f97ea[_0xb436('0x22')](_0x399a96)[_0xb436('0x23')](function(_0x5c9b5a){return _0x5c9b5a;});}return null;};}function removeEntity(_0x514c95,_0x1ece28){return function(_0x154a7f){if(_0x154a7f){return _0x154a7f[_0xb436('0x24')]()[_0xb436('0x23')](function(){_0x514c95[_0xb436('0x17')](0xcc)[_0xb436('0x18')]();});}};}function handleEntityNotFound(_0x4b8769,_0x4ee687){return function(_0x3a9cd7){if(!_0x3a9cd7){_0x4b8769[_0xb436('0x16')](0x194);}return _0x3a9cd7;};}function handleError(_0x4ee723,_0x92ab8e){_0x92ab8e=_0x92ab8e||0x1f4;return function(_0x2f41e0){logger[_0xb436('0x25')](_0x2f41e0['stack']);if(_0x2f41e0[_0xb436('0x26')]){delete _0x2f41e0[_0xb436('0x26')];}_0x4ee723['status'](_0x92ab8e)[_0xb436('0x27')](_0x2f41e0);};}exports[_0xb436('0x28')]=function(_0x1de4d3,_0xea6b9d){var _0x48b409={},_0x115783={},_0x17ec73={'count':0x0,'rows':[]};var _0x35ddc8=_[_0xb436('0x29')](db[_0xb436('0x2a')][_0xb436('0x2b')],function(_0x2c11a6){return{'name':_0x2c11a6[_0xb436('0x2c')],'type':_0x2c11a6[_0xb436('0x2d')][_0xb436('0x2e')]};});_0x115783[_0xb436('0x2f')]=_[_0xb436('0x29')](_0x35ddc8,_0xb436('0x26'));_0x115783['query']=_[_0xb436('0x30')](_0x1de4d3[_0xb436('0x31')]);_0x115783[_0xb436('0x32')]=_['intersection'](_0x115783[_0xb436('0x2f')],_0x115783['query']);_0x48b409[_0xb436('0x33')]=_[_0xb436('0x34')](_0x115783[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x35')]));_0x48b409[_0xb436('0x33')]=_0x48b409[_0xb436('0x33')][_0xb436('0x36')]?_0x48b409['attributes']:_0x115783[_0xb436('0x2f')];if(!_0x1de4d3[_0xb436('0x31')][_0xb436('0x37')]('nolimit')){_0x48b409[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x1de4d3['query']['limit']);_0x48b409[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x19')]);}_0x48b409[_0xb436('0x38')]=qs[_0xb436('0x39')](_0x1de4d3[_0xb436('0x31')][_0xb436('0x39')]);_0x48b409[_0xb436('0x3a')]=qs[_0xb436('0x32')](_['pick'](_0x1de4d3[_0xb436('0x31')],_0x115783[_0xb436('0x32')]),_0x35ddc8);if(_0x1de4d3[_0xb436('0x31')]['filter']){_0x48b409['where']=_[_0xb436('0x3b')](_0x48b409['where'],{'$or':_[_0xb436('0x29')](_0x35ddc8,function(_0x399d77){if(_0x399d77[_0xb436('0x2d')]!==_0xb436('0x3c')){var _0x407495={};_0x407495[_0x399d77[_0xb436('0x26')]]={'$like':'%'+_0x1de4d3['query'][_0xb436('0x3d')]+'%'};return _0x407495;}})});}_0x48b409=_[_0xb436('0x3b')]({},_0x48b409,_0x1de4d3[_0xb436('0x3e')]);var _0x4ea2d5={'where':_0x48b409[_0xb436('0x3a')]};return db[_0xb436('0x2a')]['count'](_0x4ea2d5)[_0xb436('0x23')](function(_0x56a111){_0x17ec73[_0xb436('0x1c')]=_0x56a111;if(_0x1de4d3[_0xb436('0x31')]['includeAll']){_0x48b409[_0xb436('0x3f')]=[{'all':!![]}];}return db[_0xb436('0x2a')][_0xb436('0x40')](_0x48b409);})['then'](function(_0x5f2575){_0x17ec73[_0xb436('0x41')]=_0x5f2575;return _0x17ec73;})[_0xb436('0x23')](respondWithFilteredResult(_0xea6b9d,_0x48b409))['catch'](handleError(_0xea6b9d,null));};exports[_0xb436('0x42')]=function(_0x2b55d8,_0x250591){var _0x3236d2={'raw':![],'where':{'id':_0x2b55d8[_0xb436('0x43')]['id']}},_0x721a2b={};_0x721a2b['model']=_[_0xb436('0x30')](db['VtigerConfiguration']['rawAttributes']);_0x721a2b[_0xb436('0x31')]=_[_0xb436('0x30')](_0x2b55d8['query']);_0x721a2b['filters']=_['intersection'](_0x721a2b[_0xb436('0x2f')],_0x721a2b['query']);_0x3236d2[_0xb436('0x33')]=_[_0xb436('0x34')](_0x721a2b[_0xb436('0x2f')],qs['fields'](_0x2b55d8[_0xb436('0x31')][_0xb436('0x35')]));_0x3236d2[_0xb436('0x33')]=_0x3236d2['attributes'][_0xb436('0x36')]?_0x3236d2[_0xb436('0x33')]:_0x721a2b[_0xb436('0x2f')];if(_0x2b55d8[_0xb436('0x31')]['includeAll']){_0x3236d2[_0xb436('0x3f')]=[{'all':!![]}];}_0x3236d2=_[_0xb436('0x3b')]({},_0x3236d2,_0x2b55d8[_0xb436('0x3e')]);return db[_0xb436('0x2a')]['find'](_0x3236d2)[_0xb436('0x23')](handleEntityNotFound(_0x250591,null))[_0xb436('0x23')](respondWithResult(_0x250591,null))[_0xb436('0x44')](handleError(_0x250591,null));};exports[_0xb436('0x45')]=function(_0x63e9ab,_0x25001c){return db[_0xb436('0x2a')][_0xb436('0x45')](_0x63e9ab[_0xb436('0x46')],{})[_0xb436('0x23')](respondWithResult(_0x25001c,0xc9))['catch'](handleError(_0x25001c,null));};exports[_0xb436('0x22')]=function(_0x58ec02,_0x3f5abf){if(_0x58ec02[_0xb436('0x46')]['id']){delete _0x58ec02[_0xb436('0x46')]['id'];}return db[_0xb436('0x2a')][_0xb436('0x47')]({'where':{'id':_0x58ec02[_0xb436('0x43')]['id']}})['then'](handleEntityNotFound(_0x3f5abf,null))[_0xb436('0x23')](saveUpdates(_0x58ec02[_0xb436('0x46')],null))[_0xb436('0x23')](respondWithResult(_0x3f5abf,null))[_0xb436('0x44')](handleError(_0x3f5abf,null));};exports[_0xb436('0x24')]=function(_0x55c0f2,_0x386fc9){return db[_0xb436('0x2a')]['find']({'where':{'id':_0x55c0f2['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x386fc9,null))[_0xb436('0x23')](removeEntity(_0x386fc9,null))[_0xb436('0x44')](handleError(_0x386fc9,null));};exports[_0xb436('0x48')]=function(_0x3912ae,_0x3902ac,_0x234886){var _0x51d2c5={};var _0x1cd369={};var _0x2878cf;var _0x29ba5d;return db[_0xb436('0x2a')][_0xb436('0x49')]({'where':{'id':_0x3912ae['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x3902ac,null))[_0xb436('0x23')](function(_0x24820b){if(_0x24820b){_0x2878cf=_0x24820b;_0x1cd369[_0xb436('0x2f')]=_[_0xb436('0x30')](db['VtigerField'][_0xb436('0x2b')]);_0x1cd369[_0xb436('0x31')]=_[_0xb436('0x30')](_0x3912ae[_0xb436('0x31')]);_0x1cd369[_0xb436('0x32')]=_[_0xb436('0x34')](_0x1cd369[_0xb436('0x2f')],_0x1cd369[_0xb436('0x31')]);_0x51d2c5[_0xb436('0x33')]=_[_0xb436('0x34')](_0x1cd369[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x3912ae[_0xb436('0x31')][_0xb436('0x35')]));_0x51d2c5['attributes']=_0x51d2c5[_0xb436('0x33')][_0xb436('0x36')]?_0x51d2c5['attributes']:_0x1cd369[_0xb436('0x2f')];_0x51d2c5[_0xb436('0x38')]=qs[_0xb436('0x39')](_0x3912ae['query']['sort']);_0x51d2c5[_0xb436('0x3a')]=qs['filters'](_['pick'](_0x3912ae[_0xb436('0x31')],_0x1cd369[_0xb436('0x32')]));if(_0x3912ae[_0xb436('0x31')][_0xb436('0x3d')]){_0x51d2c5[_0xb436('0x3a')]=_['merge'](_0x51d2c5[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x51d2c5[_0xb436('0x33')],function(_0x10bbe0){var _0x5e2185={};_0x5e2185[_0x10bbe0]={'$like':'%'+_0x3912ae[_0xb436('0x31')][_0xb436('0x3d')]+'%'};return _0x5e2185;})});}_0x51d2c5=_[_0xb436('0x3b')]({},_0x51d2c5,_0x3912ae['options']);return _0x2878cf[_0xb436('0x48')](_0x51d2c5);}})[_0xb436('0x23')](function(_0x3348da){if(_0x3348da){_0x29ba5d=_0x3348da['length'];if(!_0x3912ae[_0xb436('0x31')][_0xb436('0x37')](_0xb436('0x4a'))){_0x51d2c5[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x3912ae['query']['limit']);_0x51d2c5[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x3912ae[_0xb436('0x31')]['offset']);}return _0x2878cf['getFields'](_0x51d2c5);}})[_0xb436('0x23')](function(_0x2646df){if(_0x2646df){return _0x2646df?{'count':_0x29ba5d,'rows':_0x2646df}:null;}})[_0xb436('0x23')](respondWithResult(_0x3902ac,null))[_0xb436('0x44')](handleError(_0x3902ac,null));};exports[_0xb436('0x4b')]=function(_0x5602aa,_0x5d5088,_0x3e71ae){var _0x2a8722={};var _0x297349={};var _0x195429;var _0x521440;return db[_0xb436('0x2a')][_0xb436('0x49')]({'where':{'id':_0x5602aa[_0xb436('0x43')]['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x5d5088,null))[_0xb436('0x23')](function(_0x42ef70){if(_0x42ef70){_0x195429=_0x42ef70;_0x297349[_0xb436('0x2f')]=_[_0xb436('0x30')](db[_0xb436('0x4c')][_0xb436('0x2b')]);_0x297349['query']=_[_0xb436('0x30')](_0x5602aa[_0xb436('0x31')]);_0x297349[_0xb436('0x32')]=_[_0xb436('0x34')](_0x297349[_0xb436('0x2f')],_0x297349[_0xb436('0x31')]);_0x2a8722[_0xb436('0x33')]=_['intersection'](_0x297349[_0xb436('0x2f')],qs['fields'](_0x5602aa[_0xb436('0x31')][_0xb436('0x35')]));_0x2a8722[_0xb436('0x33')]=_0x2a8722[_0xb436('0x33')]['length']?_0x2a8722[_0xb436('0x33')]:_0x297349[_0xb436('0x2f')];_0x2a8722[_0xb436('0x38')]=qs['sort'](_0x5602aa['query'][_0xb436('0x39')]);_0x2a8722[_0xb436('0x3a')]=qs['filters'](_[_0xb436('0x4d')](_0x5602aa[_0xb436('0x31')],_0x297349[_0xb436('0x32')]));if(_0x5602aa[_0xb436('0x31')][_0xb436('0x3d')]){_0x2a8722['where']=_[_0xb436('0x3b')](_0x2a8722[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x2a8722[_0xb436('0x33')],function(_0x3e7c83){var _0x27ddce={};_0x27ddce[_0x3e7c83]={'$like':'%'+_0x5602aa['query'][_0xb436('0x3d')]+'%'};return _0x27ddce;})});}_0x2a8722=_[_0xb436('0x3b')]({},_0x2a8722,_0x5602aa[_0xb436('0x3e')]);return _0x195429['getSubjects'](_0x2a8722);}})[_0xb436('0x23')](function(_0x1ef9fa){if(_0x1ef9fa){_0x521440=_0x1ef9fa[_0xb436('0x36')];if(!_0x5602aa[_0xb436('0x31')][_0xb436('0x37')]('nolimit')){_0x2a8722[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x5602aa[_0xb436('0x31')][_0xb436('0x1b')]);_0x2a8722[_0xb436('0x19')]=qs[_0xb436('0x19')](_0x5602aa[_0xb436('0x31')][_0xb436('0x19')]);}return _0x195429['getSubjects'](_0x2a8722);}})['then'](function(_0x1c6365){if(_0x1c6365){return _0x1c6365?{'count':_0x521440,'rows':_0x1c6365}:null;}})[_0xb436('0x23')](respondWithResult(_0x5d5088,null))[_0xb436('0x44')](handleError(_0x5d5088,null));};exports[_0xb436('0x4e')]=function(_0x344fc7,_0x1c3288,_0x26605f){var _0x3734f4={};var _0x5adee8={};var _0x1eddd7;var _0x4b2f79;return db['VtigerConfiguration'][_0xb436('0x49')]({'where':{'id':_0x344fc7['params']['id']}})[_0xb436('0x23')](handleEntityNotFound(_0x1c3288,null))[_0xb436('0x23')](function(_0x51638e){if(_0x51638e){_0x1eddd7=_0x51638e;_0x5adee8['model']=_[_0xb436('0x30')](db[_0xb436('0x4c')][_0xb436('0x2b')]);_0x5adee8[_0xb436('0x31')]=_[_0xb436('0x30')](_0x344fc7[_0xb436('0x31')]);_0x5adee8[_0xb436('0x32')]=_['intersection'](_0x5adee8[_0xb436('0x2f')],_0x5adee8[_0xb436('0x31')]);_0x3734f4[_0xb436('0x33')]=_[_0xb436('0x34')](_0x5adee8[_0xb436('0x2f')],qs[_0xb436('0x35')](_0x344fc7[_0xb436('0x31')][_0xb436('0x35')]));_0x3734f4['attributes']=_0x3734f4['attributes'][_0xb436('0x36')]?_0x3734f4[_0xb436('0x33')]:_0x5adee8['model'];_0x3734f4['order']=qs[_0xb436('0x39')](_0x344fc7[_0xb436('0x31')][_0xb436('0x39')]);_0x3734f4[_0xb436('0x3a')]=qs[_0xb436('0x32')](_[_0xb436('0x4d')](_0x344fc7['query'],_0x5adee8[_0xb436('0x32')]));if(_0x344fc7['query'][_0xb436('0x3d')]){_0x3734f4[_0xb436('0x3a')]=_[_0xb436('0x3b')](_0x3734f4[_0xb436('0x3a')],{'$or':_[_0xb436('0x29')](_0x3734f4[_0xb436('0x33')],function(_0x7021ac){var _0x4eeb39={};_0x4eeb39[_0x7021ac]={'$like':'%'+_0x344fc7[_0xb436('0x31')][_0xb436('0x3d')]+'%'};return _0x4eeb39;})});}_0x3734f4=_[_0xb436('0x3b')]({},_0x3734f4,_0x344fc7['options']);return _0x1eddd7[_0xb436('0x4e')](_0x3734f4);}})['then'](function(_0x2f3766){if(_0x2f3766){_0x4b2f79=_0x2f3766[_0xb436('0x36')];if(!_0x344fc7[_0xb436('0x31')]['hasOwnProperty']('nolimit')){_0x3734f4[_0xb436('0x1b')]=qs[_0xb436('0x1b')](_0x344fc7[_0xb436('0x31')][_0xb436('0x1b')]);_0x3734f4['offset']=qs[_0xb436('0x19')](_0x344fc7[_0xb436('0x31')]['offset']);}return _0x1eddd7[_0xb436('0x4e')](_0x3734f4);}})[_0xb436('0x23')](function(_0x1cf790){if(_0x1cf790){return _0x1cf790?{'count':_0x4b2f79,'rows':_0x1cf790}:null;}})[_0xb436('0x23')](respondWithResult(_0x1c3288,null))['catch'](handleError(_0x1c3288,null));}; \ No newline at end of file +var _0x61ce=['util','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','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','type','VIRTUAL','filter','merge','options','includeAll','include','catch','show','params','length','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x5be3eb,_0x42f789){var _0x1c219b=function(_0x2c883c){while(--_0x2c883c){_0x5be3eb['push'](_0x5be3eb['shift']());}};_0x1c219b(++_0x42f789);}(_0x61ce,0xeb));var _0xe61c=function(_0x1c6a5a,_0x3568e1){_0x1c6a5a=_0x1c6a5a-0x0;var _0x282c86=_0x61ce[_0x1c6a5a];return _0x282c86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe61c('0x0'));var zipdir=require(_0xe61c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe61c('0x2'));var BPromise=require(_0xe61c('0x3'));var Mustache=require(_0xe61c('0x4'));var util=require(_0xe61c('0x5'));var path=require(_0xe61c('0x6'));var sox=require(_0xe61c('0x7'));var csv=require(_0xe61c('0x8'));var ejs=require(_0xe61c('0x9'));var fs=require('fs');var fs_extra=require(_0xe61c('0xa'));var _=require('lodash');var squel=require(_0xe61c('0xb'));var crypto=require(_0xe61c('0xc'));var jsforce=require(_0xe61c('0xd'));var deskjs=require(_0xe61c('0xe'));var toCsv=require(_0xe61c('0x8'));var querystring=require('querystring');var Papa=require(_0xe61c('0xf'));var Redis=require(_0xe61c('0x10'));var authService=require(_0xe61c('0x11'));var qs=require(_0xe61c('0x12'));var as=require(_0xe61c('0x13'));var hardwareService=require(_0xe61c('0x14'));var logger=require('../../config/logger')(_0xe61c('0x15'));var utils=require(_0xe61c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe61c('0x17'))['db'];function respondWithStatusCode(_0x145f8c,_0x1d5f35){_0x1d5f35=_0x1d5f35||0xcc;return function(_0x3bd46b){if(_0x3bd46b){return _0x145f8c['sendStatus'](_0x1d5f35);}return _0x145f8c[_0xe61c('0x18')](_0x1d5f35)[_0xe61c('0x19')]();};}function respondWithResult(_0x3e0b1f,_0x365ceb){_0x365ceb=_0x365ceb||0xc8;return function(_0x349237){if(_0x349237){return _0x3e0b1f[_0xe61c('0x18')](_0x365ceb)[_0xe61c('0x1a')](_0x349237);}};}function respondWithFilteredResult(_0x1a7883,_0x2f4f76){return function(_0x20a1a1){if(_0x20a1a1){var _0x2d28c6=typeof _0x2f4f76[_0xe61c('0x1b')]==='undefined'&&typeof _0x2f4f76[_0xe61c('0x1c')]===_0xe61c('0x1d');var _0x3c2454=_0x20a1a1[_0xe61c('0x1e')];var _0x11866b=_0x2d28c6?0x0:_0x2f4f76[_0xe61c('0x1b')];var _0x5754dc=_0x2d28c6?_0x20a1a1[_0xe61c('0x1e')]:_0x2f4f76['offset']+_0x2f4f76['limit'];var _0x26db92;if(_0x5754dc>=_0x3c2454){_0x5754dc=_0x3c2454;_0x26db92=0xc8;}else{_0x26db92=0xce;}_0x1a7883[_0xe61c('0x18')](_0x26db92);return _0x1a7883[_0xe61c('0x1f')](_0xe61c('0x20'),_0x11866b+'-'+_0x5754dc+'/'+_0x3c2454)[_0xe61c('0x1a')](_0x20a1a1);}return null;};}function patchUpdates(_0x429e14){return function(_0x2c5036){try{jsonpatch['apply'](_0x2c5036,_0x429e14,!![]);}catch(_0x4bb7eb){return BPromise[_0xe61c('0x21')](_0x4bb7eb);}return _0x2c5036[_0xe61c('0x22')]();};}function saveUpdates(_0x2cb0d8,_0x1be15f){return function(_0x133318){if(_0x133318){return _0x133318[_0xe61c('0x23')](_0x2cb0d8)[_0xe61c('0x24')](function(_0x4f81ec){return _0x4f81ec;});}return null;};}function removeEntity(_0x46bbda,_0x2a0dbe){return function(_0x34d941){if(_0x34d941){return _0x34d941['destroy']()['then'](function(){_0x46bbda['status'](0xcc)[_0xe61c('0x19')]();});}};}function handleEntityNotFound(_0x3d7827,_0x34b7a0){return function(_0x1ff5b4){if(!_0x1ff5b4){_0x3d7827[_0xe61c('0x25')](0x194);}return _0x1ff5b4;};}function handleError(_0x480bbc,_0x493dc1){_0x493dc1=_0x493dc1||0x1f4;return function(_0x447c34){logger[_0xe61c('0x26')](_0x447c34[_0xe61c('0x27')]);if(_0x447c34[_0xe61c('0x28')]){delete _0x447c34[_0xe61c('0x28')];}_0x480bbc['status'](_0x493dc1)[_0xe61c('0x29')](_0x447c34);};}exports[_0xe61c('0x2a')]=function(_0x340004,_0x146d1d){var _0x3714ef={},_0x22e506={},_0x250cff={'count':0x0,'rows':[]};var _0x4fd7e0=_[_0xe61c('0x2b')](db[_0xe61c('0x2c')][_0xe61c('0x2d')],function(_0x48ec19){return{'name':_0x48ec19[_0xe61c('0x2e')],'type':_0x48ec19['type']['key']};});_0x22e506[_0xe61c('0x2f')]=_[_0xe61c('0x2b')](_0x4fd7e0,'name');_0x22e506[_0xe61c('0x30')]=_[_0xe61c('0x31')](_0x340004[_0xe61c('0x30')]);_0x22e506['filters']=_[_0xe61c('0x32')](_0x22e506[_0xe61c('0x2f')],_0x22e506[_0xe61c('0x30')]);_0x3714ef[_0xe61c('0x33')]=_[_0xe61c('0x32')](_0x22e506['model'],qs[_0xe61c('0x34')](_0x340004[_0xe61c('0x30')][_0xe61c('0x34')]));_0x3714ef[_0xe61c('0x33')]=_0x3714ef[_0xe61c('0x33')]['length']?_0x3714ef[_0xe61c('0x33')]:_0x22e506['model'];if(!_0x340004[_0xe61c('0x30')][_0xe61c('0x35')]('nolimit')){_0x3714ef[_0xe61c('0x1c')]=qs['limit'](_0x340004['query']['limit']);_0x3714ef[_0xe61c('0x1b')]=qs[_0xe61c('0x1b')](_0x340004[_0xe61c('0x30')][_0xe61c('0x1b')]);}_0x3714ef[_0xe61c('0x36')]=qs[_0xe61c('0x37')](_0x340004[_0xe61c('0x30')][_0xe61c('0x37')]);_0x3714ef[_0xe61c('0x38')]=qs['filters'](_[_0xe61c('0x39')](_0x340004[_0xe61c('0x30')],_0x22e506[_0xe61c('0x3a')]),_0x4fd7e0);if(_0x340004[_0xe61c('0x30')]['filter']){_0x3714ef[_0xe61c('0x38')]=_['merge'](_0x3714ef['where'],{'$or':_['map'](_0x4fd7e0,function(_0x4a03be){if(_0x4a03be[_0xe61c('0x3b')]!==_0xe61c('0x3c')){var _0x1fa9b0={};_0x1fa9b0[_0x4a03be[_0xe61c('0x28')]]={'$like':'%'+_0x340004[_0xe61c('0x30')][_0xe61c('0x3d')]+'%'};return _0x1fa9b0;}})});}_0x3714ef=_[_0xe61c('0x3e')]({},_0x3714ef,_0x340004[_0xe61c('0x3f')]);var _0x259ab6={'where':_0x3714ef[_0xe61c('0x38')]};return db[_0xe61c('0x2c')]['count'](_0x259ab6)[_0xe61c('0x24')](function(_0x295b9e){_0x250cff['count']=_0x295b9e;if(_0x340004[_0xe61c('0x30')][_0xe61c('0x40')]){_0x3714ef[_0xe61c('0x41')]=[{'all':!![]}];}return db[_0xe61c('0x2c')]['findAll'](_0x3714ef);})[_0xe61c('0x24')](function(_0x264841){_0x250cff['rows']=_0x264841;return _0x250cff;})[_0xe61c('0x24')](respondWithFilteredResult(_0x146d1d,_0x3714ef))[_0xe61c('0x42')](handleError(_0x146d1d,null));};exports[_0xe61c('0x43')]=function(_0x53234b,_0x25a795){var _0x3d5953={'raw':![],'where':{'id':_0x53234b[_0xe61c('0x44')]['id']}},_0x5ab798={};_0x5ab798['model']=_[_0xe61c('0x31')](db[_0xe61c('0x2c')][_0xe61c('0x2d')]);_0x5ab798[_0xe61c('0x30')]=_[_0xe61c('0x31')](_0x53234b[_0xe61c('0x30')]);_0x5ab798[_0xe61c('0x3a')]=_[_0xe61c('0x32')](_0x5ab798[_0xe61c('0x2f')],_0x5ab798[_0xe61c('0x30')]);_0x3d5953[_0xe61c('0x33')]=_[_0xe61c('0x32')](_0x5ab798[_0xe61c('0x2f')],qs[_0xe61c('0x34')](_0x53234b[_0xe61c('0x30')][_0xe61c('0x34')]));_0x3d5953[_0xe61c('0x33')]=_0x3d5953['attributes'][_0xe61c('0x45')]?_0x3d5953[_0xe61c('0x33')]:_0x5ab798[_0xe61c('0x2f')];if(_0x53234b['query'][_0xe61c('0x40')]){_0x3d5953[_0xe61c('0x41')]=[{'all':!![]}];}_0x3d5953=_[_0xe61c('0x3e')]({},_0x3d5953,_0x53234b['options']);return db[_0xe61c('0x2c')][_0xe61c('0x46')](_0x3d5953)[_0xe61c('0x24')](handleEntityNotFound(_0x25a795,null))[_0xe61c('0x24')](respondWithResult(_0x25a795,null))[_0xe61c('0x42')](handleError(_0x25a795,null));};exports[_0xe61c('0x47')]=function(_0x4da263,_0x5b5984){return db[_0xe61c('0x2c')][_0xe61c('0x47')](_0x4da263[_0xe61c('0x48')],{})[_0xe61c('0x24')](respondWithResult(_0x5b5984,0xc9))[_0xe61c('0x42')](handleError(_0x5b5984,null));};exports[_0xe61c('0x23')]=function(_0x4afa70,_0x165a56){if(_0x4afa70[_0xe61c('0x48')]['id']){delete _0x4afa70[_0xe61c('0x48')]['id'];}return db[_0xe61c('0x2c')]['find']({'where':{'id':_0x4afa70[_0xe61c('0x44')]['id']}})[_0xe61c('0x24')](handleEntityNotFound(_0x165a56,null))[_0xe61c('0x24')](saveUpdates(_0x4afa70[_0xe61c('0x48')],null))[_0xe61c('0x24')](respondWithResult(_0x165a56,null))[_0xe61c('0x42')](handleError(_0x165a56,null));};exports[_0xe61c('0x49')]=function(_0xc1b4f,_0x539b1d){return db[_0xe61c('0x2c')][_0xe61c('0x46')]({'where':{'id':_0xc1b4f[_0xe61c('0x44')]['id']}})['then'](handleEntityNotFound(_0x539b1d,null))['then'](removeEntity(_0x539b1d,null))[_0xe61c('0x42')](handleError(_0x539b1d,null));};exports[_0xe61c('0x4a')]=function(_0x241ab6,_0x5d2119,_0x5607b7){var _0x17cf0c={};var _0xbe0355={};var _0x108ea9;var _0x1895dd;return db[_0xe61c('0x2c')][_0xe61c('0x4b')]({'where':{'id':_0x241ab6['params']['id']}})[_0xe61c('0x24')](handleEntityNotFound(_0x5d2119,null))[_0xe61c('0x24')](function(_0x3a216e){if(_0x3a216e){_0x108ea9=_0x3a216e;_0xbe0355[_0xe61c('0x2f')]=_[_0xe61c('0x31')](db[_0xe61c('0x4c')][_0xe61c('0x2d')]);_0xbe0355['query']=_['keys'](_0x241ab6[_0xe61c('0x30')]);_0xbe0355['filters']=_[_0xe61c('0x32')](_0xbe0355[_0xe61c('0x2f')],_0xbe0355[_0xe61c('0x30')]);_0x17cf0c[_0xe61c('0x33')]=_[_0xe61c('0x32')](_0xbe0355['model'],qs[_0xe61c('0x34')](_0x241ab6[_0xe61c('0x30')][_0xe61c('0x34')]));_0x17cf0c[_0xe61c('0x33')]=_0x17cf0c[_0xe61c('0x33')][_0xe61c('0x45')]?_0x17cf0c['attributes']:_0xbe0355[_0xe61c('0x2f')];_0x17cf0c[_0xe61c('0x36')]=qs[_0xe61c('0x37')](_0x241ab6[_0xe61c('0x30')][_0xe61c('0x37')]);_0x17cf0c[_0xe61c('0x38')]=qs[_0xe61c('0x3a')](_[_0xe61c('0x39')](_0x241ab6[_0xe61c('0x30')],_0xbe0355['filters']));if(_0x241ab6[_0xe61c('0x30')][_0xe61c('0x3d')]){_0x17cf0c['where']=_[_0xe61c('0x3e')](_0x17cf0c[_0xe61c('0x38')],{'$or':_['map'](_0x17cf0c['attributes'],function(_0x1b9e1e){var _0x22a160={};_0x22a160[_0x1b9e1e]={'$like':'%'+_0x241ab6[_0xe61c('0x30')][_0xe61c('0x3d')]+'%'};return _0x22a160;})});}_0x17cf0c=_[_0xe61c('0x3e')]({},_0x17cf0c,_0x241ab6[_0xe61c('0x3f')]);return _0x108ea9[_0xe61c('0x4a')](_0x17cf0c);}})[_0xe61c('0x24')](function(_0x21b160){if(_0x21b160){_0x1895dd=_0x21b160[_0xe61c('0x45')];if(!_0x241ab6[_0xe61c('0x30')]['hasOwnProperty'](_0xe61c('0x4d'))){_0x17cf0c[_0xe61c('0x1c')]=qs['limit'](_0x241ab6['query']['limit']);_0x17cf0c[_0xe61c('0x1b')]=qs[_0xe61c('0x1b')](_0x241ab6[_0xe61c('0x30')]['offset']);}return _0x108ea9[_0xe61c('0x4a')](_0x17cf0c);}})['then'](function(_0x268cd8){if(_0x268cd8){return _0x268cd8?{'count':_0x1895dd,'rows':_0x268cd8}:null;}})[_0xe61c('0x24')](respondWithResult(_0x5d2119,null))['catch'](handleError(_0x5d2119,null));};exports['getSubjects']=function(_0x35236a,_0x21e17f,_0x4ca77d){var _0x5607ab={};var _0x1084cb={};var _0x5277f7;var _0x4aa62e;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x35236a[_0xe61c('0x44')]['id']}})['then'](handleEntityNotFound(_0x21e17f,null))[_0xe61c('0x24')](function(_0x21233c){if(_0x21233c){_0x5277f7=_0x21233c;_0x1084cb[_0xe61c('0x2f')]=_[_0xe61c('0x31')](db[_0xe61c('0x4c')][_0xe61c('0x2d')]);_0x1084cb[_0xe61c('0x30')]=_[_0xe61c('0x31')](_0x35236a[_0xe61c('0x30')]);_0x1084cb[_0xe61c('0x3a')]=_['intersection'](_0x1084cb['model'],_0x1084cb[_0xe61c('0x30')]);_0x5607ab[_0xe61c('0x33')]=_[_0xe61c('0x32')](_0x1084cb[_0xe61c('0x2f')],qs['fields'](_0x35236a[_0xe61c('0x30')]['fields']));_0x5607ab[_0xe61c('0x33')]=_0x5607ab[_0xe61c('0x33')][_0xe61c('0x45')]?_0x5607ab[_0xe61c('0x33')]:_0x1084cb['model'];_0x5607ab['order']=qs[_0xe61c('0x37')](_0x35236a['query'][_0xe61c('0x37')]);_0x5607ab[_0xe61c('0x38')]=qs[_0xe61c('0x3a')](_['pick'](_0x35236a['query'],_0x1084cb['filters']));if(_0x35236a['query'][_0xe61c('0x3d')]){_0x5607ab[_0xe61c('0x38')]=_[_0xe61c('0x3e')](_0x5607ab[_0xe61c('0x38')],{'$or':_[_0xe61c('0x2b')](_0x5607ab[_0xe61c('0x33')],function(_0x36fb38){var _0x290ab0={};_0x290ab0[_0x36fb38]={'$like':'%'+_0x35236a['query'][_0xe61c('0x3d')]+'%'};return _0x290ab0;})});}_0x5607ab=_[_0xe61c('0x3e')]({},_0x5607ab,_0x35236a[_0xe61c('0x3f')]);return _0x5277f7[_0xe61c('0x4e')](_0x5607ab);}})['then'](function(_0x57c963){if(_0x57c963){_0x4aa62e=_0x57c963[_0xe61c('0x45')];if(!_0x35236a[_0xe61c('0x30')][_0xe61c('0x35')]('nolimit')){_0x5607ab[_0xe61c('0x1c')]=qs['limit'](_0x35236a[_0xe61c('0x30')]['limit']);_0x5607ab[_0xe61c('0x1b')]=qs[_0xe61c('0x1b')](_0x35236a[_0xe61c('0x30')][_0xe61c('0x1b')]);}return _0x5277f7['getSubjects'](_0x5607ab);}})[_0xe61c('0x24')](function(_0xa92d40){if(_0xa92d40){return _0xa92d40?{'count':_0x4aa62e,'rows':_0xa92d40}:null;}})['then'](respondWithResult(_0x21e17f,null))[_0xe61c('0x42')](handleError(_0x21e17f,null));};exports[_0xe61c('0x4f')]=function(_0x24556b,_0x5672a0,_0x550020){var _0x2178f7={};var _0x5d884e={};var _0x2518cc;var _0x556a7a;return db[_0xe61c('0x2c')][_0xe61c('0x4b')]({'where':{'id':_0x24556b[_0xe61c('0x44')]['id']}})[_0xe61c('0x24')](handleEntityNotFound(_0x5672a0,null))[_0xe61c('0x24')](function(_0x2ef863){if(_0x2ef863){_0x2518cc=_0x2ef863;_0x5d884e[_0xe61c('0x2f')]=_[_0xe61c('0x31')](db[_0xe61c('0x4c')][_0xe61c('0x2d')]);_0x5d884e[_0xe61c('0x30')]=_[_0xe61c('0x31')](_0x24556b[_0xe61c('0x30')]);_0x5d884e['filters']=_[_0xe61c('0x32')](_0x5d884e[_0xe61c('0x2f')],_0x5d884e[_0xe61c('0x30')]);_0x2178f7[_0xe61c('0x33')]=_['intersection'](_0x5d884e[_0xe61c('0x2f')],qs[_0xe61c('0x34')](_0x24556b['query'][_0xe61c('0x34')]));_0x2178f7[_0xe61c('0x33')]=_0x2178f7[_0xe61c('0x33')]['length']?_0x2178f7[_0xe61c('0x33')]:_0x5d884e[_0xe61c('0x2f')];_0x2178f7[_0xe61c('0x36')]=qs['sort'](_0x24556b[_0xe61c('0x30')][_0xe61c('0x37')]);_0x2178f7[_0xe61c('0x38')]=qs[_0xe61c('0x3a')](_['pick'](_0x24556b[_0xe61c('0x30')],_0x5d884e[_0xe61c('0x3a')]));if(_0x24556b['query']['filter']){_0x2178f7[_0xe61c('0x38')]=_[_0xe61c('0x3e')](_0x2178f7[_0xe61c('0x38')],{'$or':_[_0xe61c('0x2b')](_0x2178f7[_0xe61c('0x33')],function(_0x13239a){var _0x119907={};_0x119907[_0x13239a]={'$like':'%'+_0x24556b[_0xe61c('0x30')]['filter']+'%'};return _0x119907;})});}_0x2178f7=_['merge']({},_0x2178f7,_0x24556b[_0xe61c('0x3f')]);return _0x2518cc['getDescriptions'](_0x2178f7);}})[_0xe61c('0x24')](function(_0xa273da){if(_0xa273da){_0x556a7a=_0xa273da[_0xe61c('0x45')];if(!_0x24556b['query'][_0xe61c('0x35')](_0xe61c('0x4d'))){_0x2178f7[_0xe61c('0x1c')]=qs[_0xe61c('0x1c')](_0x24556b[_0xe61c('0x30')]['limit']);_0x2178f7[_0xe61c('0x1b')]=qs[_0xe61c('0x1b')](_0x24556b[_0xe61c('0x30')][_0xe61c('0x1b')]);}return _0x2518cc[_0xe61c('0x4f')](_0x2178f7);}})['then'](function(_0x55450c){if(_0x55450c){return _0x55450c?{'count':_0x556a7a,'rows':_0x55450c}:null;}})['then'](respondWithResult(_0x5672a0,null))['catch'](handleError(_0x5672a0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f44550c..bc2ff48 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 _0x05f7=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0xcf7127,_0x29f98a){var _0x2c9c55=function(_0x1c7fa6){while(--_0x1c7fa6){_0xcf7127['push'](_0xcf7127['shift']());}};_0x2c9c55(++_0x29f98a);}(_0x05f7,0x158));var _0x705f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x05f7[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x705f('0x0'));var util=require('util');var logger=require(_0x705f('0x1'))(_0x705f('0x2'));var moment=require(_0x705f('0x3'));var BPromise=require('bluebird');var rp=require(_0x705f('0x4'));var fs=require('fs');var path=require(_0x705f('0x5'));var rimraf=require('rimraf');var config=require(_0x705f('0x6'));var attributes=require(_0x705f('0x7'));module[_0x705f('0x8')]=function(_0x627bb5,_0x4b924b){return _0x627bb5[_0x705f('0x9')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80cd=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','define'];(function(_0x43e4b3,_0x38f0d9){var _0x2d9e75=function(_0x3d1b25){while(--_0x3d1b25){_0x43e4b3['push'](_0x43e4b3['shift']());}};_0x2d9e75(++_0x38f0d9);}(_0x80cd,0x176));var _0xd80c=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x80cd[_0x7148a3];return _0x52f31d;};'use strict';var _=require(_0xd80c('0x0'));var util=require(_0xd80c('0x1'));var logger=require(_0xd80c('0x2'))(_0xd80c('0x3'));var moment=require(_0xd80c('0x4'));var BPromise=require(_0xd80c('0x5'));var rp=require(_0xd80c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd80c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd80c('0x8'));module['exports']=function(_0x1eb25e,_0x1c333c){return _0x1eb25e[_0xd80c('0x9')](_0xd80c('0xa'),attributes,{'tableName':_0xd80c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 4a8a9db..bf02fdf 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 _0x1e05=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1e05,0xb4));var _0x51e0=function(_0x1dd034,_0x5f5a76){_0x1dd034=_0x1dd034-0x0;var _0x4ecb48=_0x1e05[_0x1dd034];return _0x4ecb48;};'use strict';var _=require(_0x51e0('0x0'));var util=require(_0x51e0('0x1'));var moment=require(_0x51e0('0x2'));var BPromise=require(_0x51e0('0x3'));var rs=require(_0x51e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51e0('0x5'))['db'];var utils=require(_0x51e0('0x6'));var logger=require('../../config/logger')(_0x51e0('0x7'));var config=require(_0x51e0('0x8'));var jayson=require(_0x51e0('0x9'));var client=jayson[_0x51e0('0xa')][_0x51e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5014b3,_0x828b64,_0x3331f0){return new BPromise(function(_0x59fa58,_0x2e1cb8){return client[_0x51e0('0xc')](_0x5014b3,_0x3331f0)[_0x51e0('0xd')](function(_0x30e4d2){logger[_0x51e0('0xe')](_0x51e0('0xf'),_0x828b64,_0x51e0('0x10'));logger[_0x51e0('0x11')](_0x51e0('0x12'),_0x828b64,_0x51e0('0x10'),JSON[_0x51e0('0x13')](_0x30e4d2));if(_0x30e4d2[_0x51e0('0x14')]){if(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x15')]===0x1f4){logger[_0x51e0('0x14')](_0x51e0('0xf'),_0x828b64,_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);return _0x2e1cb8(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);}logger[_0x51e0('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x828b64,_0x30e4d2[_0x51e0('0x14')]['message']);return _0x59fa58(_0x30e4d2[_0x51e0('0x14')][_0x51e0('0x16')]);}else{logger['info'](_0x51e0('0xf'),_0x828b64,_0x51e0('0x10'));_0x59fa58(_0x30e4d2['result'][_0x51e0('0x16')]);}})[_0x51e0('0x17')](function(_0x96619b){logger[_0x51e0('0x14')](_0x51e0('0xf'),_0x828b64,_0x96619b);_0x2e1cb8(_0x96619b);});});} \ No newline at end of file +var _0xbe89=['request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x3a1dec,_0x1f943f){var _0x60ede0=function(_0x285fd5){while(--_0x285fd5){_0x3a1dec['push'](_0x3a1dec['shift']());}};_0x60ede0(++_0x1f943f);}(_0xbe89,0x6e));var _0x9be8=function(_0x39ddb5,_0x322d8e){_0x39ddb5=_0x39ddb5-0x0;var _0x5c6fae=_0xbe89[_0x39ddb5];return _0x5c6fae;};'use strict';var _=require(_0x9be8('0x0'));var util=require(_0x9be8('0x1'));var moment=require(_0x9be8('0x2'));var BPromise=require(_0x9be8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9be8('0x4'));var db=require(_0x9be8('0x5'))['db'];var utils=require(_0x9be8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9be8('0x7'));var client=jayson[_0x9be8('0x8')][_0x9be8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233f03,_0xbf206d,_0x36156a){return new BPromise(function(_0x319d49,_0x3cd8cc){return client[_0x9be8('0xa')](_0x233f03,_0x36156a)[_0x9be8('0xb')](function(_0x4e7725){logger[_0x9be8('0xc')](_0x9be8('0xd'),_0xbf206d,_0x9be8('0xe'));logger['debug'](_0x9be8('0xf'),_0xbf206d,_0x9be8('0xe'),JSON[_0x9be8('0x10')](_0x4e7725));if(_0x4e7725[_0x9be8('0x11')]){if(_0x4e7725['error'][_0x9be8('0x12')]===0x1f4){logger[_0x9be8('0x11')](_0x9be8('0xd'),_0xbf206d,_0x4e7725[_0x9be8('0x11')][_0x9be8('0x13')]);return _0x3cd8cc(_0x4e7725[_0x9be8('0x11')]['message']);}logger['error'](_0x9be8('0xd'),_0xbf206d,_0x4e7725[_0x9be8('0x11')][_0x9be8('0x13')]);return _0x319d49(_0x4e7725[_0x9be8('0x11')][_0x9be8('0x13')]);}else{logger[_0x9be8('0xc')](_0x9be8('0xd'),_0xbf206d,'request\x20sent');_0x319d49(_0x4e7725['result'][_0x9be8('0x13')]);}})['catch'](function(_0x4e7f8a){logger['error'](_0x9be8('0xd'),_0xbf206d,_0x4e7f8a);_0x3cd8cc(_0x4e7f8a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ba64094..cf6d767 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 _0x473e=['isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x473e,0xe0));var _0xe473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x473e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe473('0x0'));var util=require(_0xe473('0x1'));var path=require(_0xe473('0x2'));var timeout=require(_0xe473('0x3'));var express=require(_0xe473('0x4'));var router=express[_0xe473('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe473('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe473('0x7'));var controller=require(_0xe473('0x8'));router[_0xe473('0x9')]('/',auth[_0xe473('0xa')](),controller['index']);router['get'](_0xe473('0xb'),auth[_0xe473('0xa')](),controller['show']);router[_0xe473('0xc')]('/',auth[_0xe473('0xa')](),controller[_0xe473('0xd')]);router['put'](_0xe473('0xb'),auth[_0xe473('0xa')](),controller[_0xe473('0xe')]);router[_0xe473('0xf')](_0xe473('0xb'),auth[_0xe473('0xa')](),controller[_0xe473('0x10')]);module[_0xe473('0x11')]=router; \ No newline at end of file +var _0xf3d3=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x56ea29,_0x1f50b0){var _0x441aaa=function(_0x264399){while(--_0x264399){_0x56ea29['push'](_0x56ea29['shift']());}};_0x441aaa(++_0x1f50b0);}(_0xf3d3,0x79));var _0x3f3d=function(_0x13d153,_0x3edda1){_0x13d153=_0x13d153-0x0;var _0x508a08=_0xf3d3[_0x13d153];return _0x508a08;};'use strict';var multer=require(_0x3f3d('0x0'));var util=require(_0x3f3d('0x1'));var path=require(_0x3f3d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f3d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f3d('0x4'));var interaction=require(_0x3f3d('0x5'));var config=require('../../config/environment');var controller=require(_0x3f3d('0x6'));router[_0x3f3d('0x7')]('/',auth[_0x3f3d('0x8')](),controller['index']);router[_0x3f3d('0x7')](_0x3f3d('0x9'),auth[_0x3f3d('0x8')](),controller[_0x3f3d('0xa')]);router[_0x3f3d('0xb')]('/',auth['isAuthenticated'](),controller[_0x3f3d('0xc')]);router[_0x3f3d('0xd')](_0x3f3d('0x9'),auth[_0x3f3d('0x8')](),controller['update']);router[_0x3f3d('0xe')]('/:id',auth[_0x3f3d('0x8')](),controller[_0x3f3d('0xf')]);module[_0x3f3d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c16a81c..afba1d3 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 _0x2541=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x2541,0x1e0));var _0x1254=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2541[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1254('0x0'));module[_0x1254('0x1')]={'type':{'type':Sequelize[_0x1254('0x2')](_0x1254('0x3'),_0x1254('0x4'),_0x1254('0x5'),'keyValue',_0x1254('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1254('0x7')]},'key':{'type':Sequelize[_0x1254('0x7')]},'keyType':{'type':Sequelize[_0x1254('0x2')](_0x1254('0x3'),_0x1254('0x4'),_0x1254('0x5'))},'keyContent':{'type':Sequelize[_0x1254('0x7')]},'idField':{'type':Sequelize[_0x1254('0x7')]},'nameField':{'type':Sequelize[_0x1254('0x7')]},'customField':{'type':Sequelize[_0x1254('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1254('0x7')]}}; \ No newline at end of file +var _0x1ea1=['exports','ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1ea1,0x98));var _0x11ea=function(_0x29b8ea,_0x1bfd3d){_0x29b8ea=_0x29b8ea-0x0;var _0x24ac0a=_0x1ea1[_0x29b8ea];return _0x24ac0a;};'use strict';var Sequelize=require(_0x11ea('0x0'));module[_0x11ea('0x1')]={'type':{'type':Sequelize[_0x11ea('0x2')](_0x11ea('0x3'),'variable','customVariable',_0x11ea('0x4'),'picklist'),'defaultValue':_0x11ea('0x3')},'content':{'type':Sequelize[_0x11ea('0x5')]},'key':{'type':Sequelize[_0x11ea('0x5')]},'keyType':{'type':Sequelize[_0x11ea('0x2')](_0x11ea('0x3'),_0x11ea('0x6'),_0x11ea('0x7'))},'keyContent':{'type':Sequelize[_0x11ea('0x5')]},'idField':{'type':Sequelize[_0x11ea('0x5')]},'nameField':{'type':Sequelize[_0x11ea('0x5')]},'customField':{'type':Sequelize[_0x11ea('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x11ea('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7926aed..3e56301 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 _0x4ed7=['index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x368a21,_0x3f60cb){var _0x4007d5=function(_0x1647f2){while(--_0x1647f2){_0x368a21['push'](_0x368a21['shift']());}};_0x4007d5(++_0x3f60cb);}(_0x4ed7,0x19d));var _0x74ed=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x4ed7[_0x2cd1fb];return _0x48fd2b;};'use strict';var emlformat=require(_0x74ed('0x0'));var rimraf=require(_0x74ed('0x1'));var zipdir=require(_0x74ed('0x2'));var jsonpatch=require(_0x74ed('0x3'));var rp=require(_0x74ed('0x4'));var moment=require(_0x74ed('0x5'));var BPromise=require(_0x74ed('0x6'));var Mustache=require('mustache');var util=require(_0x74ed('0x7'));var path=require(_0x74ed('0x8'));var sox=require(_0x74ed('0x9'));var csv=require(_0x74ed('0xa'));var ejs=require(_0x74ed('0xb'));var fs=require('fs');var fs_extra=require(_0x74ed('0xc'));var _=require('lodash');var squel=require(_0x74ed('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x74ed('0xe'));var toCsv=require(_0x74ed('0xa'));var querystring=require(_0x74ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x74ed('0x10'));var authService=require(_0x74ed('0x11'));var qs=require(_0x74ed('0x12'));var as=require(_0x74ed('0x13'));var hardwareService=require(_0x74ed('0x14'));var logger=require('../../config/logger')(_0x74ed('0x15'));var utils=require('../../config/utils');var config=require(_0x74ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x74ed('0x17'))['db'];function respondWithStatusCode(_0x268f08,_0x3aaddb){_0x3aaddb=_0x3aaddb||0xcc;return function(_0x100935){if(_0x100935){return _0x268f08['sendStatus'](_0x3aaddb);}return _0x268f08[_0x74ed('0x18')](_0x3aaddb)[_0x74ed('0x19')]();};}function respondWithResult(_0x3b39e3,_0x5dbe9f){_0x5dbe9f=_0x5dbe9f||0xc8;return function(_0x14de29){if(_0x14de29){return _0x3b39e3[_0x74ed('0x18')](_0x5dbe9f)['json'](_0x14de29);}};}function respondWithFilteredResult(_0x527137,_0x484dac){return function(_0x30a3f7){if(_0x30a3f7){var _0x442494=typeof _0x484dac[_0x74ed('0x1a')]===_0x74ed('0x1b')&&typeof _0x484dac[_0x74ed('0x1c')]===_0x74ed('0x1b');var _0x49e18a=_0x30a3f7[_0x74ed('0x1d')];var _0x5f8587=_0x442494?0x0:_0x484dac[_0x74ed('0x1a')];var _0x50cf52=_0x442494?_0x30a3f7['count']:_0x484dac[_0x74ed('0x1a')]+_0x484dac[_0x74ed('0x1c')];var _0x1e6ce3;if(_0x50cf52>=_0x49e18a){_0x50cf52=_0x49e18a;_0x1e6ce3=0xc8;}else{_0x1e6ce3=0xce;}_0x527137[_0x74ed('0x18')](_0x1e6ce3);return _0x527137[_0x74ed('0x1e')](_0x74ed('0x1f'),_0x5f8587+'-'+_0x50cf52+'/'+_0x49e18a)['json'](_0x30a3f7);}return null;};}function patchUpdates(_0x24b589){return function(_0x50d09d){try{jsonpatch[_0x74ed('0x20')](_0x50d09d,_0x24b589,!![]);}catch(_0x5661fb){return BPromise[_0x74ed('0x21')](_0x5661fb);}return _0x50d09d[_0x74ed('0x22')]();};}function saveUpdates(_0x338612,_0x5aee2d){return function(_0x397295){if(_0x397295){return _0x397295[_0x74ed('0x23')](_0x338612)[_0x74ed('0x24')](function(_0xb5eab8){return _0xb5eab8;});}return null;};}function removeEntity(_0x55fb6a,_0x16ee17){return function(_0x86e7d){if(_0x86e7d){return _0x86e7d[_0x74ed('0x25')]()['then'](function(){_0x55fb6a['status'](0xcc)[_0x74ed('0x19')]();});}};}function handleEntityNotFound(_0x463f3b,_0x3afd1b){return function(_0x2eb294){if(!_0x2eb294){_0x463f3b[_0x74ed('0x26')](0x194);}return _0x2eb294;};}function handleError(_0x37ac27,_0xee5425){_0xee5425=_0xee5425||0x1f4;return function(_0x25b9b9){logger[_0x74ed('0x27')](_0x25b9b9[_0x74ed('0x28')]);if(_0x25b9b9[_0x74ed('0x29')]){delete _0x25b9b9[_0x74ed('0x29')];}_0x37ac27[_0x74ed('0x18')](_0xee5425)[_0x74ed('0x2a')](_0x25b9b9);};}exports[_0x74ed('0x2b')]=function(_0x51018b,_0xfbc666){var _0x1d1559={},_0x1782cc={},_0x2e08c1={'count':0x0,'rows':[]};var _0x3d36e1=_[_0x74ed('0x2c')](db[_0x74ed('0x2d')][_0x74ed('0x2e')],function(_0x716cf7){return{'name':_0x716cf7[_0x74ed('0x2f')],'type':_0x716cf7[_0x74ed('0x30')][_0x74ed('0x31')]};});_0x1782cc[_0x74ed('0x32')]=_[_0x74ed('0x2c')](_0x3d36e1,_0x74ed('0x29'));_0x1782cc[_0x74ed('0x33')]=_[_0x74ed('0x34')](_0x51018b[_0x74ed('0x33')]);_0x1782cc[_0x74ed('0x35')]=_['intersection'](_0x1782cc[_0x74ed('0x32')],_0x1782cc[_0x74ed('0x33')]);_0x1d1559['attributes']=_[_0x74ed('0x36')](_0x1782cc['model'],qs['fields'](_0x51018b[_0x74ed('0x33')][_0x74ed('0x37')]));_0x1d1559[_0x74ed('0x38')]=_0x1d1559['attributes'][_0x74ed('0x39')]?_0x1d1559['attributes']:_0x1782cc[_0x74ed('0x32')];if(!_0x51018b['query']['hasOwnProperty'](_0x74ed('0x3a'))){_0x1d1559['limit']=qs[_0x74ed('0x1c')](_0x51018b['query'][_0x74ed('0x1c')]);_0x1d1559[_0x74ed('0x1a')]=qs[_0x74ed('0x1a')](_0x51018b[_0x74ed('0x33')][_0x74ed('0x1a')]);}_0x1d1559[_0x74ed('0x3b')]=qs[_0x74ed('0x3c')](_0x51018b[_0x74ed('0x33')][_0x74ed('0x3c')]);_0x1d1559[_0x74ed('0x3d')]=qs[_0x74ed('0x35')](_[_0x74ed('0x3e')](_0x51018b[_0x74ed('0x33')],_0x1782cc[_0x74ed('0x35')]),_0x3d36e1);if(_0x51018b[_0x74ed('0x33')][_0x74ed('0x3f')]){_0x1d1559[_0x74ed('0x3d')]=_[_0x74ed('0x40')](_0x1d1559[_0x74ed('0x3d')],{'$or':_[_0x74ed('0x2c')](_0x3d36e1,function(_0x594c24){if(_0x594c24[_0x74ed('0x30')]!=='VIRTUAL'){var _0x4d7147={};_0x4d7147[_0x594c24['name']]={'$like':'%'+_0x51018b[_0x74ed('0x33')][_0x74ed('0x3f')]+'%'};return _0x4d7147;}})});}_0x1d1559=_[_0x74ed('0x40')]({},_0x1d1559,_0x51018b[_0x74ed('0x41')]);var _0x51998a={'where':_0x1d1559[_0x74ed('0x3d')]};return db[_0x74ed('0x2d')]['count'](_0x51998a)[_0x74ed('0x24')](function(_0x9a9e17){_0x2e08c1[_0x74ed('0x1d')]=_0x9a9e17;if(_0x51018b[_0x74ed('0x33')][_0x74ed('0x42')]){_0x1d1559[_0x74ed('0x43')]=[{'all':!![]}];}return db[_0x74ed('0x2d')][_0x74ed('0x44')](_0x1d1559);})[_0x74ed('0x24')](function(_0x4f5893){_0x2e08c1[_0x74ed('0x45')]=_0x4f5893;return _0x2e08c1;})[_0x74ed('0x24')](respondWithFilteredResult(_0xfbc666,_0x1d1559))[_0x74ed('0x46')](handleError(_0xfbc666,null));};exports[_0x74ed('0x47')]=function(_0x3827fb,_0x3e42d6){var _0x9d3d0c={'raw':!![],'where':{'id':_0x3827fb['params']['id']}},_0x875658={};_0x875658['model']=_[_0x74ed('0x34')](db[_0x74ed('0x2d')][_0x74ed('0x2e')]);_0x875658['query']=_[_0x74ed('0x34')](_0x3827fb[_0x74ed('0x33')]);_0x875658[_0x74ed('0x35')]=_[_0x74ed('0x36')](_0x875658[_0x74ed('0x32')],_0x875658[_0x74ed('0x33')]);_0x9d3d0c[_0x74ed('0x38')]=_[_0x74ed('0x36')](_0x875658['model'],qs['fields'](_0x3827fb['query']['fields']));_0x9d3d0c[_0x74ed('0x38')]=_0x9d3d0c[_0x74ed('0x38')]['length']?_0x9d3d0c['attributes']:_0x875658[_0x74ed('0x32')];if(_0x3827fb[_0x74ed('0x33')]['includeAll']){_0x9d3d0c[_0x74ed('0x43')]=[{'all':!![]}];}_0x9d3d0c=_[_0x74ed('0x40')]({},_0x9d3d0c,_0x3827fb[_0x74ed('0x41')]);return db['VtigerField'][_0x74ed('0x48')](_0x9d3d0c)['then'](handleEntityNotFound(_0x3e42d6,null))[_0x74ed('0x24')](respondWithResult(_0x3e42d6,null))[_0x74ed('0x46')](handleError(_0x3e42d6,null));};exports[_0x74ed('0x49')]=function(_0xd2602e,_0xff8e41){return db[_0x74ed('0x2d')]['create'](_0xd2602e[_0x74ed('0x4a')],{})[_0x74ed('0x24')](respondWithResult(_0xff8e41,0xc9))[_0x74ed('0x46')](handleError(_0xff8e41,null));};exports[_0x74ed('0x23')]=function(_0x2c454d,_0x358089){if(_0x2c454d[_0x74ed('0x4a')]['id']){delete _0x2c454d[_0x74ed('0x4a')]['id'];}return db[_0x74ed('0x2d')]['find']({'where':{'id':_0x2c454d[_0x74ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x358089,null))[_0x74ed('0x24')](saveUpdates(_0x2c454d['body'],null))[_0x74ed('0x24')](respondWithResult(_0x358089,null))[_0x74ed('0x46')](handleError(_0x358089,null));};exports[_0x74ed('0x25')]=function(_0x37a92b,_0x519ae9){return db[_0x74ed('0x2d')]['find']({'where':{'id':_0x37a92b['params']['id']}})[_0x74ed('0x24')](handleEntityNotFound(_0x519ae9,null))[_0x74ed('0x24')](removeEntity(_0x519ae9,null))[_0x74ed('0x46')](handleError(_0x519ae9,null));}; \ No newline at end of file +var _0xb0e3=['type','VIRTUAL','options','include','rows','catch','show','params','intersection','find','create','body','update','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','then','destroy','sendStatus','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where'];(function(_0x55bdd9,_0x50b4df){var _0xb8e992=function(_0xee67c9){while(--_0xee67c9){_0x55bdd9['push'](_0x55bdd9['shift']());}};_0xb8e992(++_0x50b4df);}(_0xb0e3,0x184));var _0x3b0e=function(_0x508d54,_0x3dcfe){_0x508d54=_0x508d54-0x0;var _0x1e346c=_0xb0e3[_0x508d54];return _0x1e346c;};'use strict';var emlformat=require(_0x3b0e('0x0'));var rimraf=require(_0x3b0e('0x1'));var zipdir=require(_0x3b0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b0e('0x3'));var moment=require('moment');var BPromise=require(_0x3b0e('0x4'));var Mustache=require(_0x3b0e('0x5'));var util=require(_0x3b0e('0x6'));var path=require(_0x3b0e('0x7'));var sox=require(_0x3b0e('0x8'));var csv=require(_0x3b0e('0x9'));var ejs=require(_0x3b0e('0xa'));var fs=require('fs');var fs_extra=require(_0x3b0e('0xb'));var _=require(_0x3b0e('0xc'));var squel=require(_0x3b0e('0xd'));var crypto=require(_0x3b0e('0xe'));var jsforce=require(_0x3b0e('0xf'));var deskjs=require(_0x3b0e('0x10'));var toCsv=require(_0x3b0e('0x9'));var querystring=require(_0x3b0e('0x11'));var Papa=require(_0x3b0e('0x12'));var Redis=require(_0x3b0e('0x13'));var authService=require(_0x3b0e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3b0e('0x15'));var hardwareService=require(_0x3b0e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x3b0e('0x17'));var config=require(_0x3b0e('0x18'));var licenseUtil=require(_0x3b0e('0x19'));var db=require(_0x3b0e('0x1a'))['db'];function respondWithStatusCode(_0x1e9cc2,_0x2f56a5){_0x2f56a5=_0x2f56a5||0xcc;return function(_0x59f803){if(_0x59f803){return _0x1e9cc2['sendStatus'](_0x2f56a5);}return _0x1e9cc2['status'](_0x2f56a5)[_0x3b0e('0x1b')]();};}function respondWithResult(_0x518980,_0x5eba8a){_0x5eba8a=_0x5eba8a||0xc8;return function(_0x25248c){if(_0x25248c){return _0x518980['status'](_0x5eba8a)['json'](_0x25248c);}};}function respondWithFilteredResult(_0x10ff19,_0x1467d6){return function(_0x1f7091){if(_0x1f7091){var _0x30c5bd=typeof _0x1467d6[_0x3b0e('0x1c')]===_0x3b0e('0x1d')&&typeof _0x1467d6[_0x3b0e('0x1e')]===_0x3b0e('0x1d');var _0x189285=_0x1f7091[_0x3b0e('0x1f')];var _0x502621=_0x30c5bd?0x0:_0x1467d6['offset'];var _0x2cd68f=_0x30c5bd?_0x1f7091[_0x3b0e('0x1f')]:_0x1467d6[_0x3b0e('0x1c')]+_0x1467d6[_0x3b0e('0x1e')];var _0x250ec6;if(_0x2cd68f>=_0x189285){_0x2cd68f=_0x189285;_0x250ec6=0xc8;}else{_0x250ec6=0xce;}_0x10ff19[_0x3b0e('0x20')](_0x250ec6);return _0x10ff19['set'](_0x3b0e('0x21'),_0x502621+'-'+_0x2cd68f+'/'+_0x189285)[_0x3b0e('0x22')](_0x1f7091);}return null;};}function patchUpdates(_0x1affd4){return function(_0x4dd61a){try{jsonpatch[_0x3b0e('0x23')](_0x4dd61a,_0x1affd4,!![]);}catch(_0x505788){return BPromise[_0x3b0e('0x24')](_0x505788);}return _0x4dd61a[_0x3b0e('0x25')]();};}function saveUpdates(_0x59cc8a,_0x515a3d){return function(_0x179957){if(_0x179957){return _0x179957['update'](_0x59cc8a)[_0x3b0e('0x26')](function(_0x2647e2){return _0x2647e2;});}return null;};}function removeEntity(_0x2b72a7,_0x53dcf5){return function(_0x3f1056){if(_0x3f1056){return _0x3f1056[_0x3b0e('0x27')]()[_0x3b0e('0x26')](function(){_0x2b72a7[_0x3b0e('0x20')](0xcc)[_0x3b0e('0x1b')]();});}};}function handleEntityNotFound(_0x16537c,_0x14bc3e){return function(_0x2db57c){if(!_0x2db57c){_0x16537c[_0x3b0e('0x28')](0x194);}return _0x2db57c;};}function handleError(_0x22480a,_0x33690c){_0x33690c=_0x33690c||0x1f4;return function(_0x559775){logger['error'](_0x559775['stack']);if(_0x559775['name']){delete _0x559775[_0x3b0e('0x29')];}_0x22480a[_0x3b0e('0x20')](_0x33690c)[_0x3b0e('0x2a')](_0x559775);};}exports[_0x3b0e('0x2b')]=function(_0x34706d,_0x119cdf){var _0x132057={},_0x44c964={},_0x5638dc={'count':0x0,'rows':[]};var _0x35f077=_[_0x3b0e('0x2c')](db[_0x3b0e('0x2d')][_0x3b0e('0x2e')],function(_0x5e4f0f){return{'name':_0x5e4f0f[_0x3b0e('0x2f')],'type':_0x5e4f0f['type'][_0x3b0e('0x30')]};});_0x44c964[_0x3b0e('0x31')]=_['map'](_0x35f077,_0x3b0e('0x29'));_0x44c964[_0x3b0e('0x32')]=_[_0x3b0e('0x33')](_0x34706d[_0x3b0e('0x32')]);_0x44c964['filters']=_['intersection'](_0x44c964[_0x3b0e('0x31')],_0x44c964[_0x3b0e('0x32')]);_0x132057[_0x3b0e('0x34')]=_['intersection'](_0x44c964[_0x3b0e('0x31')],qs[_0x3b0e('0x35')](_0x34706d['query']['fields']));_0x132057[_0x3b0e('0x34')]=_0x132057[_0x3b0e('0x34')][_0x3b0e('0x36')]?_0x132057[_0x3b0e('0x34')]:_0x44c964[_0x3b0e('0x31')];if(!_0x34706d['query']['hasOwnProperty'](_0x3b0e('0x37'))){_0x132057['limit']=qs[_0x3b0e('0x1e')](_0x34706d['query']['limit']);_0x132057[_0x3b0e('0x1c')]=qs[_0x3b0e('0x1c')](_0x34706d[_0x3b0e('0x32')]['offset']);}_0x132057[_0x3b0e('0x38')]=qs[_0x3b0e('0x39')](_0x34706d[_0x3b0e('0x32')][_0x3b0e('0x39')]);_0x132057['where']=qs[_0x3b0e('0x3a')](_['pick'](_0x34706d[_0x3b0e('0x32')],_0x44c964['filters']),_0x35f077);if(_0x34706d['query'][_0x3b0e('0x3b')]){_0x132057['where']=_[_0x3b0e('0x3c')](_0x132057[_0x3b0e('0x3d')],{'$or':_['map'](_0x35f077,function(_0x4fefd2){if(_0x4fefd2[_0x3b0e('0x3e')]!==_0x3b0e('0x3f')){var _0x39f3dd={};_0x39f3dd[_0x4fefd2['name']]={'$like':'%'+_0x34706d[_0x3b0e('0x32')][_0x3b0e('0x3b')]+'%'};return _0x39f3dd;}})});}_0x132057=_[_0x3b0e('0x3c')]({},_0x132057,_0x34706d[_0x3b0e('0x40')]);var _0x5ccc30={'where':_0x132057[_0x3b0e('0x3d')]};return db[_0x3b0e('0x2d')][_0x3b0e('0x1f')](_0x5ccc30)[_0x3b0e('0x26')](function(_0x56b9d8){_0x5638dc['count']=_0x56b9d8;if(_0x34706d['query']['includeAll']){_0x132057[_0x3b0e('0x41')]=[{'all':!![]}];}return db[_0x3b0e('0x2d')]['findAll'](_0x132057);})[_0x3b0e('0x26')](function(_0xecd5f1){_0x5638dc[_0x3b0e('0x42')]=_0xecd5f1;return _0x5638dc;})[_0x3b0e('0x26')](respondWithFilteredResult(_0x119cdf,_0x132057))[_0x3b0e('0x43')](handleError(_0x119cdf,null));};exports[_0x3b0e('0x44')]=function(_0x341adc,_0x25e1cf){var _0x3f74={'raw':!![],'where':{'id':_0x341adc[_0x3b0e('0x45')]['id']}},_0x1dfdd1={};_0x1dfdd1[_0x3b0e('0x31')]=_[_0x3b0e('0x33')](db[_0x3b0e('0x2d')]['rawAttributes']);_0x1dfdd1[_0x3b0e('0x32')]=_[_0x3b0e('0x33')](_0x341adc['query']);_0x1dfdd1['filters']=_['intersection'](_0x1dfdd1['model'],_0x1dfdd1[_0x3b0e('0x32')]);_0x3f74[_0x3b0e('0x34')]=_[_0x3b0e('0x46')](_0x1dfdd1[_0x3b0e('0x31')],qs[_0x3b0e('0x35')](_0x341adc['query'][_0x3b0e('0x35')]));_0x3f74[_0x3b0e('0x34')]=_0x3f74[_0x3b0e('0x34')][_0x3b0e('0x36')]?_0x3f74[_0x3b0e('0x34')]:_0x1dfdd1[_0x3b0e('0x31')];if(_0x341adc['query']['includeAll']){_0x3f74['include']=[{'all':!![]}];}_0x3f74=_[_0x3b0e('0x3c')]({},_0x3f74,_0x341adc[_0x3b0e('0x40')]);return db[_0x3b0e('0x2d')][_0x3b0e('0x47')](_0x3f74)[_0x3b0e('0x26')](handleEntityNotFound(_0x25e1cf,null))[_0x3b0e('0x26')](respondWithResult(_0x25e1cf,null))[_0x3b0e('0x43')](handleError(_0x25e1cf,null));};exports['create']=function(_0x2f5e89,_0x52dbbd){return db['VtigerField'][_0x3b0e('0x48')](_0x2f5e89[_0x3b0e('0x49')],{})['then'](respondWithResult(_0x52dbbd,0xc9))[_0x3b0e('0x43')](handleError(_0x52dbbd,null));};exports[_0x3b0e('0x4a')]=function(_0x1a49a6,_0x36f0ce){if(_0x1a49a6[_0x3b0e('0x49')]['id']){delete _0x1a49a6['body']['id'];}return db[_0x3b0e('0x2d')]['find']({'where':{'id':_0x1a49a6['params']['id']}})[_0x3b0e('0x26')](handleEntityNotFound(_0x36f0ce,null))[_0x3b0e('0x26')](saveUpdates(_0x1a49a6[_0x3b0e('0x49')],null))[_0x3b0e('0x26')](respondWithResult(_0x36f0ce,null))[_0x3b0e('0x43')](handleError(_0x36f0ce,null));};exports[_0x3b0e('0x27')]=function(_0x111be7,_0x168d80){return db[_0x3b0e('0x2d')]['find']({'where':{'id':_0x111be7[_0x3b0e('0x45')]['id']}})[_0x3b0e('0x26')](handleEntityNotFound(_0x168d80,null))[_0x3b0e('0x26')](removeEntity(_0x168d80,null))['catch'](handleError(_0x168d80,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7df4806..70bffc8 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 _0x1c33=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index'];(function(_0x389637,_0x121e2c){var _0x29f8ae=function(_0x3d2bc0){while(--_0x3d2bc0){_0x389637['push'](_0x389637['shift']());}};_0x29f8ae(++_0x121e2c);}(_0x1c33,0x81));var _0x31c3=function(_0x171920,_0x4c0ff0){_0x171920=_0x171920-0x0;var _0x4c9042=_0x1c33[_0x171920];return _0x4c9042;};'use strict';var _=require(_0x31c3('0x0'));var util=require(_0x31c3('0x1'));var logger=require(_0x31c3('0x2'))(_0x31c3('0x3'));var moment=require(_0x31c3('0x4'));var BPromise=require(_0x31c3('0x5'));var rp=require(_0x31c3('0x6'));var fs=require('fs');var path=require(_0x31c3('0x7'));var rimraf=require(_0x31c3('0x8'));var config=require(_0x31c3('0x9'));var attributes=require('./intVtigerField.attributes');module[_0x31c3('0xa')]=function(_0x2cff2e,_0xbf02cb){return _0x2cff2e[_0x31c3('0xb')](_0x31c3('0xc'),attributes,{'tableName':_0x31c3('0xd'),'paranoid':![],'indexes':[{'name':_0x31c3('0xe'),'fields':[_0x31c3('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8ec=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x309c93,_0x549e2e){var _0x25567d=function(_0x3f1e43){while(--_0x3f1e43){_0x309c93['push'](_0x309c93['shift']());}};_0x25567d(++_0x549e2e);}(_0xf8ec,0x192));var _0xcf8e=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xf8ec[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xcf8e('0x0'));var util=require(_0xcf8e('0x1'));var logger=require(_0xcf8e('0x2'))(_0xcf8e('0x3'));var moment=require(_0xcf8e('0x4'));var BPromise=require(_0xcf8e('0x5'));var rp=require(_0xcf8e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf8e('0x7'));var config=require(_0xcf8e('0x8'));var attributes=require(_0xcf8e('0x9'));module[_0xcf8e('0xa')]=function(_0xe78817,_0x281182){return _0xe78817['define'](_0xcf8e('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xcf8e('0xc'),'fields':[_0xcf8e('0xd'),_0xcf8e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index d1976a6..99a063c 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 _0x3efa=['request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x3f9ebc,_0x3ec902){var _0x36858e=function(_0x40d20e){while(--_0x40d20e){_0x3f9ebc['push'](_0x3f9ebc['shift']());}};_0x36858e(++_0x3ec902);}(_0x3efa,0xab));var _0xa3ef=function(_0x94756f,_0x2a3c19){_0x94756f=_0x94756f-0x0;var _0x1e90f7=_0x3efa[_0x94756f];return _0x1e90f7;};'use strict';var _=require(_0xa3ef('0x0'));var util=require(_0xa3ef('0x1'));var moment=require('moment');var BPromise=require(_0xa3ef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ef('0x4'))('rpc');var config=require(_0xa3ef('0x5'));var jayson=require(_0xa3ef('0x6'));var client=jayson[_0xa3ef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x835471,_0x1bf644,_0x491eb8){return new BPromise(function(_0x2509ab,_0x15a8b0){return client['request'](_0x835471,_0x491eb8)[_0xa3ef('0x8')](function(_0x1cdcc4){logger['info']('VtigerField,\x20%s,\x20%s',_0x1bf644,_0xa3ef('0x9'));logger[_0xa3ef('0xa')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1bf644,_0xa3ef('0x9'),JSON[_0xa3ef('0xb')](_0x1cdcc4));if(_0x1cdcc4[_0xa3ef('0xc')]){if(_0x1cdcc4['error'][_0xa3ef('0xd')]===0x1f4){logger[_0xa3ef('0xc')](_0xa3ef('0xe'),_0x1bf644,_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);return _0x15a8b0(_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);}logger[_0xa3ef('0xc')](_0xa3ef('0xe'),_0x1bf644,_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);return _0x2509ab(_0x1cdcc4[_0xa3ef('0xc')][_0xa3ef('0xf')]);}else{logger[_0xa3ef('0x10')](_0xa3ef('0xe'),_0x1bf644,_0xa3ef('0x9'));_0x2509ab(_0x1cdcc4[_0xa3ef('0x11')]['message']);}})['catch'](function(_0x1efb7b){logger[_0xa3ef('0xc')]('VtigerField,\x20%s,\x20%s',_0x1bf644,_0x1efb7b);_0x15a8b0(_0x1efb7b);});});} \ No newline at end of file +var _0x003a=['client','http','request','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe453a3,_0x1848f0){var _0x6d49fb=function(_0x4750a8){while(--_0x4750a8){_0xe453a3['push'](_0xe453a3['shift']());}};_0x6d49fb(++_0x1848f0);}(_0x003a,0xdc));var _0xa003=function(_0x8acd9f,_0x211497){_0x8acd9f=_0x8acd9f-0x0;var _0x4dd98c=_0x003a[_0x8acd9f];return _0x4dd98c;};'use strict';var _=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var moment=require('moment');var BPromise=require(_0xa003('0x2'));var rs=require(_0xa003('0x3'));var fs=require('fs');var Redis=require(_0xa003('0x4'));var db=require(_0xa003('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa003('0x6'))(_0xa003('0x7'));var config=require(_0xa003('0x8'));var jayson=require(_0xa003('0x9'));var client=jayson[_0xa003('0xa')][_0xa003('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1446e9,_0x5a855c,_0x475521){return new BPromise(function(_0x5338fb,_0x3f36ed){return client[_0xa003('0xc')](_0x1446e9,_0x475521)['then'](function(_0x50270b){logger['info'](_0xa003('0xd'),_0x5a855c,_0xa003('0xe'));logger[_0xa003('0xf')](_0xa003('0x10'),_0x5a855c,_0xa003('0xe'),JSON[_0xa003('0x11')](_0x50270b));if(_0x50270b[_0xa003('0x12')]){if(_0x50270b['error'][_0xa003('0x13')]===0x1f4){logger['error'](_0xa003('0xd'),_0x5a855c,_0x50270b[_0xa003('0x12')][_0xa003('0x14')]);return _0x3f36ed(_0x50270b['error'][_0xa003('0x14')]);}logger[_0xa003('0x12')]('VtigerField,\x20%s,\x20%s',_0x5a855c,_0x50270b[_0xa003('0x12')]['message']);return _0x5338fb(_0x50270b[_0xa003('0x12')][_0xa003('0x14')]);}else{logger[_0xa003('0x15')](_0xa003('0xd'),_0x5a855c,'request\x20sent');_0x5338fb(_0x50270b[_0xa003('0x16')][_0xa003('0x14')]);}})['catch'](function(_0x5b9abc){logger[_0xa003('0x12')](_0xa003('0xd'),_0x5a855c,_0x5b9abc);_0x3f36ed(_0x5b9abc);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 6f31745..bf453c5 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 _0x9552=['../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','addConfiguration','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e42ae,_0x199bcc){var _0x1fde53=function(_0x1f23df){while(--_0x1f23df){_0x3e42ae['push'](_0x3e42ae['shift']());}};_0x1fde53(++_0x199bcc);}(_0x9552,0xea));var _0x2955=function(_0x53518a,_0x1311df){_0x53518a=_0x53518a-0x0;var _0x18c5f0=_0x9552[_0x53518a];return _0x18c5f0;};'use strict';var multer=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var path=require(_0x2955('0x2'));var timeout=require('connect-timeout');var express=require(_0x2955('0x3'));var router=express[_0x2955('0x4')]();var fs_extra=require(_0x2955('0x5'));var auth=require(_0x2955('0x6'));var interaction=require(_0x2955('0x7'));var config=require(_0x2955('0x8'));var controller=require(_0x2955('0x9'));router[_0x2955('0xa')]('/',auth[_0x2955('0xb')](),controller['index']);router[_0x2955('0xa')](_0x2955('0xc'),auth[_0x2955('0xb')](),controller[_0x2955('0xd')]);router['get'](_0x2955('0xe'),auth[_0x2955('0xb')](),controller[_0x2955('0xf')]);router[_0x2955('0xa')]('/:id/fields',auth[_0x2955('0xb')](),controller['getFields']);router[_0x2955('0x10')]('/',auth[_0x2955('0xb')](),controller['create']);router[_0x2955('0x10')]('/:id/configurations',auth[_0x2955('0xb')](),controller[_0x2955('0x11')]);router[_0x2955('0x12')](_0x2955('0xc'),auth[_0x2955('0xb')](),controller['update']);router[_0x2955('0x13')](_0x2955('0xc'),auth['isAuthenticated'](),controller[_0x2955('0x14')]);module[_0x2955('0x15')]=router; \ No newline at end of file +var _0x37de=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x132d9e,_0x4a0839){var _0x40b733=function(_0x30c113){while(--_0x30c113){_0x132d9e['push'](_0x132d9e['shift']());}};_0x40b733(++_0x4a0839);}(_0x37de,0xed));var _0xe37d=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0x37de[_0x45313f];return _0x402910;};'use strict';var multer=require(_0xe37d('0x0'));var util=require(_0xe37d('0x1'));var path=require(_0xe37d('0x2'));var timeout=require(_0xe37d('0x3'));var express=require('express');var router=express[_0xe37d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe37d('0x5'));var config=require(_0xe37d('0x6'));var controller=require('./intZendeskAccount.controller');router[_0xe37d('0x7')]('/',auth['isAuthenticated'](),controller[_0xe37d('0x8')]);router[_0xe37d('0x7')](_0xe37d('0x9'),auth[_0xe37d('0xa')](),controller[_0xe37d('0xb')]);router['get'](_0xe37d('0xc'),auth[_0xe37d('0xa')](),controller[_0xe37d('0xd')]);router[_0xe37d('0x7')](_0xe37d('0xe'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0xe37d('0xa')](),controller[_0xe37d('0xf')]);router['post'](_0xe37d('0xc'),auth[_0xe37d('0xa')](),controller['addConfiguration']);router[_0xe37d('0x10')](_0xe37d('0x9'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x11')]);router[_0xe37d('0x12')](_0xe37d('0x9'),auth[_0xe37d('0xa')](),controller[_0xe37d('0x13')]);module[_0xe37d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ec58474..d42d2e8 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 _0xe1d3=['integrationTab','sequelize','exports','STRING','remoteUri','token','password','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe1d3,0x159));var _0x3e1d=function(_0x41b804,_0x4c36df){_0x41b804=_0x41b804-0x0;var _0xe4fcc4=_0xe1d3[_0x41b804];return _0xe4fcc4;};'use strict';var Sequelize=require(_0x3e1d('0x0'));module[_0x3e1d('0x1')]={'name':{'type':Sequelize[_0x3e1d('0x2')]},'description':{'type':Sequelize[_0x3e1d('0x2')]},'username':{'type':Sequelize[_0x3e1d('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3e1d('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3e1d('0x2')],'unique':_0x3e1d('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x3e1d('0x4')),'defaultValue':_0x3e1d('0x5')},'serverUrl':{'type':Sequelize[_0x3e1d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3e1d('0x6')](_0x3e1d('0x7'),'newTab'),'defaultValue':_0x3e1d('0x7')}}; \ No newline at end of file +var _0x6d11=['token','integrationTab','sequelize','exports','STRING','ENUM','password'];(function(_0x4b43ce,_0x29237c){var _0x1c36e0=function(_0x54c4d5){while(--_0x54c4d5){_0x4b43ce['push'](_0x4b43ce['shift']());}};_0x1c36e0(++_0x29237c);}(_0x6d11,0xbf));var _0x16d1=function(_0x4fd27b,_0x16905f){_0x4fd27b=_0x4fd27b-0x0;var _0x3e5b4d=_0x6d11[_0x4fd27b];return _0x3e5b4d;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x16d1('0x2')]},'token':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x4'),_0x16d1('0x5')),'defaultValue':_0x16d1('0x4')},'serverUrl':{'type':Sequelize[_0x16d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x16d1('0x3')](_0x16d1('0x6'),'newTab'),'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 2a5b66c..c10ff19 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 _0xefda=['getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','ticket_fields','includes','position','system_field_options','custom_field_options','test','statusCode','stringify','send','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../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','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','channel','type','Descriptions'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xefda,0x96));var _0xaefd=function(_0x5ffbe5,_0xe6e990){_0x5ffbe5=_0x5ffbe5-0x0;var _0x494d0f=_0xefda[_0x5ffbe5];return _0x494d0f;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];var integrations=require(_0xaefd('0x18'));function respondWithStatusCode(_0x2a310c,_0x4b2b5c){_0x4b2b5c=_0x4b2b5c||0xcc;return function(_0x3172d3){if(_0x3172d3){return _0x2a310c['sendStatus'](_0x4b2b5c);}return _0x2a310c[_0xaefd('0x19')](_0x4b2b5c)[_0xaefd('0x1a')]();};}function respondWithResult(_0x9dfdf6,_0x43b82a){_0x43b82a=_0x43b82a||0xc8;return function(_0x4ec92a){if(_0x4ec92a){return _0x9dfdf6[_0xaefd('0x19')](_0x43b82a)[_0xaefd('0x1b')](_0x4ec92a);}};}function respondWithFilteredResult(_0x41f345,_0x411701){return function(_0x10ee28){if(_0x10ee28){var _0x32f75e=typeof _0x411701[_0xaefd('0x1c')]===_0xaefd('0x1d')&&typeof _0x411701['limit']===_0xaefd('0x1d');var _0x109604=_0x10ee28[_0xaefd('0x1e')];var _0x1737a1=_0x32f75e?0x0:_0x411701[_0xaefd('0x1c')];var _0x244956=_0x32f75e?_0x10ee28['count']:_0x411701[_0xaefd('0x1c')]+_0x411701[_0xaefd('0x1f')];var _0x24f131;if(_0x244956>=_0x109604){_0x244956=_0x109604;_0x24f131=0xc8;}else{_0x24f131=0xce;}_0x41f345[_0xaefd('0x19')](_0x24f131);return _0x41f345[_0xaefd('0x20')](_0xaefd('0x21'),_0x1737a1+'-'+_0x244956+'/'+_0x109604)['json'](_0x10ee28);}return null;};}function patchUpdates(_0x463d48){return function(_0x18e71c){try{jsonpatch[_0xaefd('0x22')](_0x18e71c,_0x463d48,!![]);}catch(_0x3d9823){return BPromise[_0xaefd('0x23')](_0x3d9823);}return _0x18e71c['save']();};}function saveUpdates(_0x479486,_0x5b9967){return function(_0x21680a){if(_0x21680a){return _0x21680a[_0xaefd('0x24')](_0x479486)[_0xaefd('0x25')](function(_0x5a44ed){return _0x5a44ed;});}return null;};}function removeEntity(_0x23060f,_0x4cd9b2){return function(_0x3deec8){if(_0x3deec8){return _0x3deec8[_0xaefd('0x26')]()[_0xaefd('0x25')](function(){_0x23060f['status'](0xcc)[_0xaefd('0x1a')]();});}};}function handleEntityNotFound(_0x3ffc9c,_0x18e720){return function(_0x14cc9d){if(!_0x14cc9d){_0x3ffc9c[_0xaefd('0x27')](0x194);}return _0x14cc9d;};}function handleError(_0x5a170c,_0x2fe27e){_0x2fe27e=_0x2fe27e||0x1f4;return function(_0x58c008){logger[_0xaefd('0x28')](_0x58c008[_0xaefd('0x29')]);if(_0x58c008['name']){delete _0x58c008[_0xaefd('0x2a')];}_0x5a170c[_0xaefd('0x19')](_0x2fe27e)['send'](_0x58c008);};}exports[_0xaefd('0x2b')]=function(_0x114ec0,_0x36b6b7){var _0x4c0898={},_0x45f0e8={},_0x5c573b={'count':0x0,'rows':[]};var _0x109e19=_['map'](db['ZendeskAccount'][_0xaefd('0x2c')],function(_0x1b470c){return{'name':_0x1b470c['fieldName'],'type':_0x1b470c['type']['key']};});_0x45f0e8[_0xaefd('0x2d')]=_[_0xaefd('0x2e')](_0x109e19,'name');_0x45f0e8['query']=_[_0xaefd('0x2f')](_0x114ec0[_0xaefd('0x30')]);_0x45f0e8[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x45f0e8['model'],_0x45f0e8[_0xaefd('0x30')]);_0x4c0898[_0xaefd('0x33')]=_[_0xaefd('0x32')](_0x45f0e8[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x34')]));_0x4c0898[_0xaefd('0x33')]=_0x4c0898[_0xaefd('0x33')][_0xaefd('0x35')]?_0x4c0898[_0xaefd('0x33')]:_0x45f0e8[_0xaefd('0x2d')];if(!_0x114ec0[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4c0898[_0xaefd('0x1f')]=qs['limit'](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4c0898[_0xaefd('0x1c')]=qs['offset'](_0x114ec0[_0xaefd('0x30')]['offset']);}_0x4c0898[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x114ec0[_0xaefd('0x30')][_0xaefd('0x39')]);_0x4c0898[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x114ec0[_0xaefd('0x30')],_0x45f0e8[_0xaefd('0x31')]),_0x109e19);if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4c0898[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4c0898[_0xaefd('0x3a')],{'$or':_['map'](_0x109e19,function(_0x1cfd6d){if(_0x1cfd6d['type']!==_0xaefd('0x3e')){var _0x6562={};_0x6562[_0x1cfd6d[_0xaefd('0x2a')]]={'$like':'%'+_0x114ec0[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x6562;}})});}_0x4c0898=_[_0xaefd('0x3d')]({},_0x4c0898,_0x114ec0[_0xaefd('0x3f')]);var _0x145e9e={'where':_0x4c0898[_0xaefd('0x3a')]};return db[_0xaefd('0x40')]['count'](_0x145e9e)[_0xaefd('0x25')](function(_0x3296ac){_0x5c573b['count']=_0x3296ac;if(_0x114ec0[_0xaefd('0x30')][_0xaefd('0x41')]){_0x4c0898[_0xaefd('0x42')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x4c0898);})[_0xaefd('0x25')](function(_0x3d0abf){_0x5c573b[_0xaefd('0x43')]=_0x3d0abf;return _0x5c573b;})[_0xaefd('0x25')](respondWithFilteredResult(_0x36b6b7,_0x4c0898))[_0xaefd('0x44')](handleError(_0x36b6b7,null));};exports[_0xaefd('0x45')]=function(_0x2e17b5,_0x2e98aa){var _0x48a7af={'raw':![],'where':{'id':_0x2e17b5[_0xaefd('0x46')]['id']}},_0x26587e={};_0x26587e[_0xaefd('0x2d')]=_[_0xaefd('0x2f')](db[_0xaefd('0x40')][_0xaefd('0x2c')]);_0x26587e[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x2e17b5['query']);_0x26587e['filters']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],_0x26587e['query']);_0x48a7af['attributes']=_[_0xaefd('0x32')](_0x26587e[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x34')]));_0x48a7af[_0xaefd('0x33')]=_0x48a7af[_0xaefd('0x33')][_0xaefd('0x35')]?_0x48a7af[_0xaefd('0x33')]:_0x26587e['model'];if(_0x2e17b5[_0xaefd('0x30')][_0xaefd('0x41')]){_0x48a7af[_0xaefd('0x42')]=[{'all':!![]}];}_0x48a7af=_[_0xaefd('0x3d')]({},_0x48a7af,_0x2e17b5[_0xaefd('0x3f')]);return db[_0xaefd('0x40')][_0xaefd('0x47')](_0x48a7af)['then'](handleEntityNotFound(_0x2e98aa,null))[_0xaefd('0x25')](respondWithResult(_0x2e98aa,null))['catch'](handleError(_0x2e98aa,null));};exports[_0xaefd('0x48')]=function(_0x374845,_0x16c664){return db[_0xaefd('0x40')]['create'](_0x374845['body'],{})[_0xaefd('0x25')](respondWithResult(_0x16c664,0xc9))[_0xaefd('0x44')](handleError(_0x16c664,null));};exports[_0xaefd('0x24')]=function(_0x4eeb56,_0x2a836a){if(_0x4eeb56[_0xaefd('0x49')]['id']){delete _0x4eeb56['body']['id'];}return db[_0xaefd('0x40')][_0xaefd('0x47')]({'where':{'id':_0x4eeb56[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x2a836a,null))[_0xaefd('0x25')](saveUpdates(_0x4eeb56[_0xaefd('0x49')],null))[_0xaefd('0x25')](respondWithResult(_0x2a836a,null))[_0xaefd('0x44')](handleError(_0x2a836a,null));};exports['destroy']=function(_0x567ceb,_0x1406b8){return db[_0xaefd('0x40')]['find']({'where':{'id':_0x567ceb[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x1406b8,null))[_0xaefd('0x25')](removeEntity(_0x1406b8,null))[_0xaefd('0x44')](handleError(_0x1406b8,null));};exports[_0xaefd('0x4a')]=function(_0x69185e,_0x27fd3f,_0xf727cd){var _0x4b709a={};var _0x56e180={};var _0x1fd0b0;var _0x338823;return db['ZendeskAccount'][_0xaefd('0x4b')]({'where':{'id':_0x69185e[_0xaefd('0x46')]['id']}})[_0xaefd('0x25')](handleEntityNotFound(_0x27fd3f,null))[_0xaefd('0x25')](function(_0x4a883b){if(_0x4a883b){_0x1fd0b0=_0x4a883b;_0x56e180['model']=_[_0xaefd('0x2f')](db[_0xaefd('0x4c')][_0xaefd('0x2c')]);_0x56e180[_0xaefd('0x30')]=_[_0xaefd('0x2f')](_0x69185e['query']);_0x56e180[_0xaefd('0x31')]=_[_0xaefd('0x32')](_0x56e180['model'],_0x56e180[_0xaefd('0x30')]);_0x4b709a[_0xaefd('0x33')]=_['intersection'](_0x56e180[_0xaefd('0x2d')],qs[_0xaefd('0x34')](_0x69185e[_0xaefd('0x30')]['fields']));_0x4b709a[_0xaefd('0x33')]=_0x4b709a[_0xaefd('0x33')]['length']?_0x4b709a[_0xaefd('0x33')]:_0x56e180[_0xaefd('0x2d')];_0x4b709a[_0xaefd('0x38')]=qs[_0xaefd('0x39')](_0x69185e['query']['sort']);_0x4b709a[_0xaefd('0x3a')]=qs[_0xaefd('0x31')](_[_0xaefd('0x3b')](_0x69185e[_0xaefd('0x30')],_0x56e180[_0xaefd('0x31')]));if(_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]){_0x4b709a[_0xaefd('0x3a')]=_[_0xaefd('0x3d')](_0x4b709a[_0xaefd('0x3a')],{'$or':_['map'](_0x4b709a['attributes'],function(_0x324eb4){var _0x431c1a={};_0x431c1a[_0x324eb4]={'$like':'%'+_0x69185e[_0xaefd('0x30')][_0xaefd('0x3c')]+'%'};return _0x431c1a;})});}_0x4b709a=_['merge']({},_0x4b709a,_0x69185e[_0xaefd('0x3f')]);return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x1ad04e){if(_0x1ad04e){_0x338823=_0x1ad04e[_0xaefd('0x35')];if(!_0x69185e[_0xaefd('0x30')][_0xaefd('0x36')](_0xaefd('0x37'))){_0x4b709a['limit']=qs[_0xaefd('0x1f')](_0x69185e[_0xaefd('0x30')][_0xaefd('0x1f')]);_0x4b709a[_0xaefd('0x1c')]=qs['offset'](_0x69185e[_0xaefd('0x30')]['offset']);}return _0x1fd0b0[_0xaefd('0x4a')](_0x4b709a);}})[_0xaefd('0x25')](function(_0x516913){if(_0x516913){return _0x516913?{'count':_0x338823,'rows':_0x516913}:null;}})['then'](respondWithResult(_0x27fd3f,null))[_0xaefd('0x44')](handleError(_0x27fd3f,null));};exports['addConfiguration']=function(_0x5e0068,_0x4e75bc,_0xe2397c){if(_0x5e0068[_0xaefd('0x49')]['id']){delete _0x5e0068[_0xaefd('0x49')]['id'];}return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x5e0068[_0xaefd('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e75bc,null))['then'](function(_0x4f8e16){if(_0x4f8e16){_0x5e0068['body'][_0xaefd('0x4d')]=_0x4f8e16['id'];_0x5e0068['body'][_0xaefd('0x4e')]=integrations['getSubjects'](_0x5e0068[_0xaefd('0x49')][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);_0x5e0068[_0xaefd('0x49')][_0xaefd('0x51')]=integrations[_0xaefd('0x52')](_0x5e0068['body'][_0xaefd('0x4f')],_0x5e0068[_0xaefd('0x49')][_0xaefd('0x50')]);return db[_0xaefd('0x4c')]['create'](_0x5e0068[_0xaefd('0x49')],{'include':[{'model':db['ZendeskField'],'as':_0xaefd('0x4e')},{'model':db[_0xaefd('0x53')],'as':_0xaefd('0x51')}]});}return null;})[_0xaefd('0x25')](respondWithResult(_0x4e75bc,null))[_0xaefd('0x44')](handleError(_0x4e75bc,null));};exports[_0xaefd('0x54')]=function(_0x57776e,_0x1a6195,_0x3b39db){var _0x4a9fa5='';return db[_0xaefd('0x40')][_0xaefd('0x4b')]({'where':{'id':_0x57776e['params']['id']},'attributes':['id',_0xaefd('0x55'),_0xaefd('0x56'),_0xaefd('0x57'),_0xaefd('0x58'),_0xaefd('0x59')]})[_0xaefd('0x25')](handleEntityNotFound(_0x1a6195,null))[_0xaefd('0x25')](function(_0x6f99b0){if(_0x6f99b0){_0x4a9fa5=_0x6f99b0[_0xaefd('0x59')];var _0x1ec9be=_0x4a9fa5[_0xaefd('0x5a')](-0x1);if(_0x1ec9be==='/'){_0x4a9fa5=_0x4a9fa5[_0xaefd('0x5b')](0x0,_0x4a9fa5[_0xaefd('0x5c')](_0x1ec9be));}var _0x43338b={'method':_0xaefd('0x5d'),'uri':util[_0xaefd('0x5e')](_0xaefd('0x5f'),_0x4a9fa5,'ticket_fields'),'json':!![]};switch(_0x6f99b0[_0xaefd('0x58')]){case _0xaefd('0x56'):_0x43338b[_0xaefd('0x60')]={'Authorization':util['format'](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')](_0xaefd('0x62'),_0x6f99b0[_0xaefd('0x55')],_0x6f99b0['password']))[_0xaefd('0x63')]('base64'))};break;case _0xaefd('0x57'):_0x43338b['headers']={'Authorization':util[_0xaefd('0x5e')](_0xaefd('0x61'),new Buffer(util[_0xaefd('0x5e')]('%s/token:%s',_0x6f99b0['username'],_0x6f99b0[_0xaefd('0x57')]))[_0xaefd('0x63')](_0xaefd('0x64')))};break;default:throw new db[(_0xaefd('0x65'))][(_0xaefd('0x66'))](_0xaefd('0x67'));}return rp(_0x43338b);}})['then'](function(_0x499d7d){if(_0x499d7d){var _0x58c97c=['subject','description',_0xaefd('0x68'),_0xaefd('0x69')];_[_0xaefd('0x6a')](_0x499d7d[_0xaefd('0x6b')],function(_0x5ae635){return _0x58c97c[_0xaefd('0x6c')](_0x5ae635[_0xaefd('0x50')]);});return{'count':_0x499d7d['ticket_fields'][_0xaefd('0x35')],'rows':_['map'](_0x499d7d[_0xaefd('0x6b')],function(_0x51b6f1){return{'id':_0x51b6f1['id'],'name':_0x51b6f1[_0xaefd('0x6d')]>0x7?_0x51b6f1['title']:_0x51b6f1[_0xaefd('0x50')],'custom':_0x51b6f1['position']>0x7?!![]:![],'options':_0x51b6f1[_0xaefd('0x6e')]?_0x51b6f1[_0xaefd('0x6e')]:_0x51b6f1['custom_field_options']?_0x51b6f1[_0xaefd('0x6f')]:[]};})};}})[_0xaefd('0x25')](respondWithResult(_0x1a6195,null))[_0xaefd('0x44')](function(_0x564c89){var _0x42c55c=_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?0x1f4:_0x564c89[_0xaefd('0x71')]||0x1f4;logger[_0xaefd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xaefd('0x54'),_0x42c55c,JSON[_0xaefd('0x72')](_0x564c89));delete _0x564c89['name'];if(_0x42c55c===0x191){_0x42c55c=0x190;}_0x1a6195[_0xaefd('0x19')](_0x42c55c)[_0xaefd('0x73')](_0x57776e[_0xaefd('0x30')][_0xaefd('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x564c89[_0xaefd('0x71')]}:_0x564c89);});}; \ No newline at end of file +var _0x0bb5=['offset','limit','undefined','count','set','json','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','ZendeskAccount','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','authType','remoteUri','substring','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x1ce00b,_0x24359c){var _0x2f8f37=function(_0x92bdf2){while(--_0x92bdf2){_0x1ce00b['push'](_0x1ce00b['shift']());}};_0x2f8f37(++_0x24359c);}(_0x0bb5,0x148));var _0x50bb=function(_0x1ec5dc,_0xc37e68){_0x1ec5dc=_0x1ec5dc-0x0;var _0x4d2682=_0x0bb5[_0x1ec5dc];return _0x4d2682;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x50bb('0x19'));function respondWithStatusCode(_0x58837d,_0x283f04){_0x283f04=_0x283f04||0xcc;return function(_0xd8ab27){if(_0xd8ab27){return _0x58837d[_0x50bb('0x1a')](_0x283f04);}return _0x58837d['status'](_0x283f04)[_0x50bb('0x1b')]();};}function respondWithResult(_0x309986,_0x3094f2){_0x3094f2=_0x3094f2||0xc8;return function(_0x5244b0){if(_0x5244b0){return _0x309986[_0x50bb('0x1c')](_0x3094f2)['json'](_0x5244b0);}};}function respondWithFilteredResult(_0x21befa,_0x3e1a51){return function(_0x253073){if(_0x253073){var _0x42ffab=typeof _0x3e1a51[_0x50bb('0x1d')]==='undefined'&&typeof _0x3e1a51[_0x50bb('0x1e')]===_0x50bb('0x1f');var _0x4b1f5f=_0x253073[_0x50bb('0x20')];var _0x4796ec=_0x42ffab?0x0:_0x3e1a51[_0x50bb('0x1d')];var _0x431ed4=_0x42ffab?_0x253073['count']:_0x3e1a51['offset']+_0x3e1a51[_0x50bb('0x1e')];var _0x1499dc;if(_0x431ed4>=_0x4b1f5f){_0x431ed4=_0x4b1f5f;_0x1499dc=0xc8;}else{_0x1499dc=0xce;}_0x21befa[_0x50bb('0x1c')](_0x1499dc);return _0x21befa[_0x50bb('0x21')]('Content-Range',_0x4796ec+'-'+_0x431ed4+'/'+_0x4b1f5f)[_0x50bb('0x22')](_0x253073);}return null;};}function patchUpdates(_0x32bfc3){return function(_0x4020a0){try{jsonpatch['apply'](_0x4020a0,_0x32bfc3,!![]);}catch(_0x3104c8){return BPromise[_0x50bb('0x23')](_0x3104c8);}return _0x4020a0[_0x50bb('0x24')]();};}function saveUpdates(_0x4825f8,_0x1dbba2){return function(_0x4cc7f9){if(_0x4cc7f9){return _0x4cc7f9[_0x50bb('0x25')](_0x4825f8)[_0x50bb('0x26')](function(_0x1a2a0b){return _0x1a2a0b;});}return null;};}function removeEntity(_0x2ee87a,_0x846311){return function(_0x342078){if(_0x342078){return _0x342078['destroy']()[_0x50bb('0x26')](function(){_0x2ee87a[_0x50bb('0x1c')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x3462c1,_0x5234d7){return function(_0x75fea6){if(!_0x75fea6){_0x3462c1['sendStatus'](0x194);}return _0x75fea6;};}function handleError(_0x55e87b,_0x2befd9){_0x2befd9=_0x2befd9||0x1f4;return function(_0x491632){logger['error'](_0x491632[_0x50bb('0x27')]);if(_0x491632[_0x50bb('0x28')]){delete _0x491632[_0x50bb('0x28')];}_0x55e87b[_0x50bb('0x1c')](_0x2befd9)[_0x50bb('0x29')](_0x491632);};}exports[_0x50bb('0x2a')]=function(_0x41a8ad,_0x41d479){var _0x4f7514={},_0x44ce86={},_0x461cf3={'count':0x0,'rows':[]};var _0x15ee2e=_[_0x50bb('0x2b')](db['ZendeskAccount'][_0x50bb('0x2c')],function(_0x1a62fb){return{'name':_0x1a62fb[_0x50bb('0x2d')],'type':_0x1a62fb[_0x50bb('0x2e')][_0x50bb('0x2f')]};});_0x44ce86[_0x50bb('0x30')]=_[_0x50bb('0x2b')](_0x15ee2e,_0x50bb('0x28'));_0x44ce86[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x41a8ad[_0x50bb('0x31')]);_0x44ce86[_0x50bb('0x33')]=_['intersection'](_0x44ce86[_0x50bb('0x30')],_0x44ce86[_0x50bb('0x31')]);_0x4f7514[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x44ce86[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x36')]));_0x4f7514[_0x50bb('0x34')]=_0x4f7514[_0x50bb('0x34')][_0x50bb('0x37')]?_0x4f7514['attributes']:_0x44ce86[_0x50bb('0x30')];if(!_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x38')](_0x50bb('0x39'))){_0x4f7514[_0x50bb('0x1e')]=qs[_0x50bb('0x1e')](_0x41a8ad['query']['limit']);_0x4f7514[_0x50bb('0x1d')]=qs['offset'](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x1d')]);}_0x4f7514[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x41a8ad[_0x50bb('0x31')]['sort']);_0x4f7514[_0x50bb('0x3c')]=qs['filters'](_[_0x50bb('0x3d')](_0x41a8ad[_0x50bb('0x31')],_0x44ce86[_0x50bb('0x33')]),_0x15ee2e);if(_0x41a8ad['query']['filter']){_0x4f7514[_0x50bb('0x3c')]=_[_0x50bb('0x3e')](_0x4f7514[_0x50bb('0x3c')],{'$or':_[_0x50bb('0x2b')](_0x15ee2e,function(_0x51750b){if(_0x51750b[_0x50bb('0x2e')]!=='VIRTUAL'){var _0x52059b={};_0x52059b[_0x51750b[_0x50bb('0x28')]]={'$like':'%'+_0x41a8ad['query'][_0x50bb('0x3f')]+'%'};return _0x52059b;}})});}_0x4f7514=_[_0x50bb('0x3e')]({},_0x4f7514,_0x41a8ad[_0x50bb('0x40')]);var _0x1f156e={'where':_0x4f7514[_0x50bb('0x3c')]};return db[_0x50bb('0x41')][_0x50bb('0x20')](_0x1f156e)[_0x50bb('0x26')](function(_0x46039a){_0x461cf3[_0x50bb('0x20')]=_0x46039a;if(_0x41a8ad['query']['includeAll']){_0x4f7514[_0x50bb('0x42')]=[{'all':!![]}];}return db[_0x50bb('0x41')][_0x50bb('0x43')](_0x4f7514);})[_0x50bb('0x26')](function(_0x5e8085){_0x461cf3[_0x50bb('0x44')]=_0x5e8085;return _0x461cf3;})['then'](respondWithFilteredResult(_0x41d479,_0x4f7514))[_0x50bb('0x45')](handleError(_0x41d479,null));};exports[_0x50bb('0x46')]=function(_0x379944,_0x40748d){var _0x1c438b={'raw':![],'where':{'id':_0x379944[_0x50bb('0x47')]['id']}},_0x355726={};_0x355726[_0x50bb('0x30')]=_[_0x50bb('0x32')](db[_0x50bb('0x41')][_0x50bb('0x2c')]);_0x355726[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x379944[_0x50bb('0x31')]);_0x355726[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x355726['model'],_0x355726[_0x50bb('0x31')]);_0x1c438b['attributes']=_[_0x50bb('0x35')](_0x355726[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x379944[_0x50bb('0x31')][_0x50bb('0x36')]));_0x1c438b[_0x50bb('0x34')]=_0x1c438b[_0x50bb('0x34')][_0x50bb('0x37')]?_0x1c438b[_0x50bb('0x34')]:_0x355726[_0x50bb('0x30')];if(_0x379944[_0x50bb('0x31')][_0x50bb('0x48')]){_0x1c438b[_0x50bb('0x42')]=[{'all':!![]}];}_0x1c438b=_[_0x50bb('0x3e')]({},_0x1c438b,_0x379944['options']);return db[_0x50bb('0x41')]['find'](_0x1c438b)[_0x50bb('0x26')](handleEntityNotFound(_0x40748d,null))[_0x50bb('0x26')](respondWithResult(_0x40748d,null))[_0x50bb('0x45')](handleError(_0x40748d,null));};exports[_0x50bb('0x49')]=function(_0x650e91,_0x39ac1a){return db[_0x50bb('0x41')][_0x50bb('0x49')](_0x650e91['body'],{})[_0x50bb('0x26')](respondWithResult(_0x39ac1a,0xc9))[_0x50bb('0x45')](handleError(_0x39ac1a,null));};exports[_0x50bb('0x25')]=function(_0x13afe2,_0x3659c4){if(_0x13afe2['body']['id']){delete _0x13afe2[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x13afe2[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3659c4,null))['then'](saveUpdates(_0x13afe2['body'],null))[_0x50bb('0x26')](respondWithResult(_0x3659c4,null))['catch'](handleError(_0x3659c4,null));};exports[_0x50bb('0x4c')]=function(_0x57ee0e,_0x4316e4){return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x57ee0e['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x4316e4,null))[_0x50bb('0x26')](removeEntity(_0x4316e4,null))['catch'](handleError(_0x4316e4,null));};exports[_0x50bb('0x4d')]=function(_0x1dff6a,_0x8d62af,_0x3c525c){var _0x55a4a6={};var _0x33e71f={};var _0x46b51e;var _0x2e0032;return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x1dff6a['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x8d62af,null))['then'](function(_0x38a775){if(_0x38a775){_0x46b51e=_0x38a775;_0x33e71f['model']=_['keys'](db[_0x50bb('0x4f')]['rawAttributes']);_0x33e71f['query']=_[_0x50bb('0x32')](_0x1dff6a[_0x50bb('0x31')]);_0x33e71f[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x33e71f[_0x50bb('0x30')],_0x33e71f[_0x50bb('0x31')]);_0x55a4a6[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x33e71f['model'],qs['fields'](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x36')]));_0x55a4a6[_0x50bb('0x34')]=_0x55a4a6[_0x50bb('0x34')][_0x50bb('0x37')]?_0x55a4a6[_0x50bb('0x34')]:_0x33e71f[_0x50bb('0x30')];_0x55a4a6['order']=qs[_0x50bb('0x3b')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3b')]);_0x55a4a6[_0x50bb('0x3c')]=qs[_0x50bb('0x33')](_['pick'](_0x1dff6a[_0x50bb('0x31')],_0x33e71f[_0x50bb('0x33')]));if(_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]){_0x55a4a6[_0x50bb('0x3c')]=_['merge'](_0x55a4a6[_0x50bb('0x3c')],{'$or':_['map'](_0x55a4a6['attributes'],function(_0x170761){var _0x3057f2={};_0x3057f2[_0x170761]={'$like':'%'+_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]+'%'};return _0x3057f2;})});}_0x55a4a6=_[_0x50bb('0x3e')]({},_0x55a4a6,_0x1dff6a[_0x50bb('0x40')]);return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x330299){if(_0x330299){_0x2e0032=_0x330299[_0x50bb('0x37')];if(!_0x1dff6a[_0x50bb('0x31')]['hasOwnProperty'](_0x50bb('0x39'))){_0x55a4a6['limit']=qs[_0x50bb('0x1e')](_0x1dff6a[_0x50bb('0x31')]['limit']);_0x55a4a6[_0x50bb('0x1d')]=qs[_0x50bb('0x1d')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x1d')]);}return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x2b7df6){if(_0x2b7df6){return _0x2b7df6?{'count':_0x2e0032,'rows':_0x2b7df6}:null;}})[_0x50bb('0x26')](respondWithResult(_0x8d62af,null))['catch'](handleError(_0x8d62af,null));};exports[_0x50bb('0x50')]=function(_0x2dc832,_0x3b17c8,_0x4a226d){if(_0x2dc832[_0x50bb('0x4a')]['id']){delete _0x2dc832[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x2dc832[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3b17c8,null))['then'](function(_0xf47641){if(_0xf47641){_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x51')]=_0xf47641['id'];_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x52')]=integrations[_0x50bb('0x53')](_0x2dc832['body'][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x2e')]);_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x55')]=integrations[_0x50bb('0x56')](_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')]['type']);return db[_0x50bb('0x4f')][_0x50bb('0x49')](_0x2dc832[_0x50bb('0x4a')],{'include':[{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x52')},{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x55')}]});}return null;})[_0x50bb('0x26')](respondWithResult(_0x3b17c8,null))[_0x50bb('0x45')](handleError(_0x3b17c8,null));};exports['getFields']=function(_0x58ad41,_0x5babbc,_0x4159ad){var _0x5ba597='';return db['ZendeskAccount'][_0x50bb('0x4e')]({'where':{'id':_0x58ad41[_0x50bb('0x47')]['id']},'attributes':['id',_0x50bb('0x58'),_0x50bb('0x59'),'token',_0x50bb('0x5a'),_0x50bb('0x5b')]})['then'](handleEntityNotFound(_0x5babbc,null))[_0x50bb('0x26')](function(_0x51e64f){if(_0x51e64f){_0x5ba597=_0x51e64f[_0x50bb('0x5b')];var _0x239a82=_0x5ba597['slice'](-0x1);if(_0x239a82==='/'){_0x5ba597=_0x5ba597[_0x50bb('0x5c')](0x0,_0x5ba597['lastIndexOf'](_0x239a82));}var _0x8f5df6={'method':_0x50bb('0x5d'),'uri':util['format'](_0x50bb('0x5e'),_0x5ba597,_0x50bb('0x5f')),'json':!![]};switch(_0x51e64f[_0x50bb('0x5a')]){case'password':_0x8f5df6[_0x50bb('0x60')]={'Authorization':util[_0x50bb('0x61')](_0x50bb('0x62'),new Buffer(util[_0x50bb('0x61')]('%s:%s',_0x51e64f[_0x50bb('0x58')],_0x51e64f[_0x50bb('0x59')]))['toString']('base64'))};break;case _0x50bb('0x63'):_0x8f5df6[_0x50bb('0x60')]={'Authorization':util['format'](_0x50bb('0x62'),new Buffer(util[_0x50bb('0x61')](_0x50bb('0x64'),_0x51e64f[_0x50bb('0x58')],_0x51e64f[_0x50bb('0x63')]))['toString']('base64'))};break;default:throw new db[(_0x50bb('0x65'))][(_0x50bb('0x66'))](_0x50bb('0x67'));}return rp(_0x8f5df6);}})[_0x50bb('0x26')](function(_0x4b51d4){if(_0x4b51d4){var _0x1975f7=['subject',_0x50bb('0x68'),_0x50bb('0x69'),_0x50bb('0x6a')];_[_0x50bb('0x6b')](_0x4b51d4[_0x50bb('0x5f')],function(_0x217170){return _0x1975f7[_0x50bb('0x6c')](_0x217170['type']);});return{'count':_0x4b51d4[_0x50bb('0x5f')][_0x50bb('0x37')],'rows':_[_0x50bb('0x2b')](_0x4b51d4[_0x50bb('0x5f')],function(_0x5d2dc4){return{'id':_0x5d2dc4['id'],'name':_0x5d2dc4[_0x50bb('0x6d')]>0x7?_0x5d2dc4[_0x50bb('0x6e')]:_0x5d2dc4['type'],'custom':_0x5d2dc4[_0x50bb('0x6d')]>0x7?!![]:![],'options':_0x5d2dc4[_0x50bb('0x6f')]?_0x5d2dc4[_0x50bb('0x6f')]:_0x5d2dc4[_0x50bb('0x70')]?_0x5d2dc4[_0x50bb('0x70')]:[]};})};}})['then'](respondWithResult(_0x5babbc,null))['catch'](function(_0x145cf8){var _0x47e80f=_0x58ad41[_0x50bb('0x31')][_0x50bb('0x71')]?0x1f4:_0x145cf8['statusCode']||0x1f4;logger['error'](_0x50bb('0x72'),_0x50bb('0x73'),_0x47e80f,JSON[_0x50bb('0x74')](_0x145cf8));delete _0x145cf8['name'];if(_0x47e80f===0x191){_0x47e80f=0x190;}_0x5babbc[_0x50bb('0x1c')](_0x47e80f)[_0x50bb('0x29')](_0x58ad41[_0x50bb('0x31')][_0x50bb('0x71')]?{'message':_0x50bb('0x75'),'statusCode':_0x145cf8[_0x50bb('0x76')]}:_0x145cf8);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 61c2416..e780d3f 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 _0x428f=['../../config/environment','../../components/integrations/configuration','exports','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x428f,0x143));var _0xf428=function(_0x38ceb5,_0x4a2585){_0x38ceb5=_0x38ceb5-0x0;var _0x276de6=_0x428f[_0x38ceb5];return _0x276de6;};'use strict';var _=require(_0xf428('0x0'));var util=require(_0xf428('0x1'));var logger=require('../../config/logger')(_0xf428('0x2'));var moment=require('moment');var BPromise=require(_0xf428('0x3'));var rp=require(_0xf428('0x4'));var fs=require('fs');var path=require(_0xf428('0x5'));var rimraf=require(_0xf428('0x6'));var config=require(_0xf428('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xf428('0x8'));module[_0xf428('0x9')]=function(_0x1b20da,_0xd06b07){return _0x1b20da['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7114=['exports','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x7114,0x161));var _0x4711=function(_0x44e36b,_0x5c2eaa){_0x44e36b=_0x44e36b-0x0;var _0x5f3292=_0x7114[_0x44e36b];return _0x5f3292;};'use strict';var _=require(_0x4711('0x0'));var util=require('util');var logger=require(_0x4711('0x1'))('api');var moment=require(_0x4711('0x2'));var BPromise=require('bluebird');var rp=require(_0x4711('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4711('0x4'));var config=require(_0x4711('0x5'));var attributes=require(_0x4711('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x4711('0x7')]=function(_0xb77528,_0x148c39){return _0xb77528['define'](_0x4711('0x8'),attributes,{'tableName':_0x4711('0x9'),'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 7940e51..9834eea 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 _0x0ac1=['stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options','raw','where','attributes','include','map','model','ZendeskAccount','find','ShowZendeskAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x493761,_0x427606){var _0x169ead=function(_0x76ac51){while(--_0x76ac51){_0x493761['push'](_0x493761['shift']());}};_0x169ead(++_0x427606);}(_0x0ac1,0x167));var _0x10ac=function(_0x4f33b8,_0x1285fc){_0x4f33b8=_0x4f33b8-0x0;var _0x101a99=_0x0ac1[_0x4f33b8];return _0x101a99;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x10ac('0x0'));var BPromise=require(_0x10ac('0x1'));var rs=require(_0x10ac('0x2'));var fs=require('fs');var Redis=require(_0x10ac('0x3'));var db=require(_0x10ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x10ac('0x5'));var config=require(_0x10ac('0x6'));var jayson=require(_0x10ac('0x7'));var client=jayson[_0x10ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ced67,_0x412bfa,_0x1a2f01){return new BPromise(function(_0x296642,_0x2943ec){return client[_0x10ac('0x9')](_0x1ced67,_0x1a2f01)[_0x10ac('0xa')](function(_0x5a8a97){logger['info'](_0x10ac('0xb'),_0x412bfa,_0x10ac('0xc'));logger[_0x10ac('0xd')](_0x10ac('0xe'),_0x412bfa,'request\x20sent',JSON[_0x10ac('0xf')](_0x5a8a97));if(_0x5a8a97[_0x10ac('0x10')]){if(_0x5a8a97['error'][_0x10ac('0x11')]===0x1f4){logger[_0x10ac('0x10')](_0x10ac('0xb'),_0x412bfa,_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);return _0x2943ec(_0x5a8a97['error'][_0x10ac('0x12')]);}logger[_0x10ac('0x10')](_0x10ac('0xb'),_0x412bfa,_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);return _0x296642(_0x5a8a97[_0x10ac('0x10')][_0x10ac('0x12')]);}else{logger[_0x10ac('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x412bfa,_0x10ac('0xc'));_0x296642(_0x5a8a97[_0x10ac('0x14')][_0x10ac('0x12')]);}})[_0x10ac('0x15')](function(_0x1ccf2b){logger['error'](_0x10ac('0xb'),_0x412bfa,_0x1ccf2b);_0x2943ec(_0x1ccf2b);});});}exports[_0x10ac('0x16')]=function(_0x23c083){var _0x434c09=this;return new Promise(function(_0x278a7b,_0x2b24ad){return db['ZendeskAccount'][_0x10ac('0x17')]({'raw':_0x23c083[_0x10ac('0x18')]?_0x23c083['options'][_0x10ac('0x19')]===undefined?!![]:![]:!![],'where':_0x23c083[_0x10ac('0x18')]?_0x23c083[_0x10ac('0x18')][_0x10ac('0x1a')]||null:null,'attributes':_0x23c083[_0x10ac('0x18')]?_0x23c083['options'][_0x10ac('0x1b')]||null:null,'limit':_0x23c083['options']?_0x23c083[_0x10ac('0x18')]['limit']||null:null,'include':_0x23c083['options']?_0x23c083[_0x10ac('0x18')][_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x23c083[_0x10ac('0x18')][_0x10ac('0x1c')],function(_0x260f09){return{'model':db[_0x260f09[_0x10ac('0x1e')]],'as':_0x260f09['as'],'attributes':_0x260f09[_0x10ac('0x1b')],'include':_0x260f09[_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x260f09[_0x10ac('0x1c')],function(_0x2ed4ce){return{'model':db[_0x2ed4ce[_0x10ac('0x1e')]],'as':_0x2ed4ce['as'],'attributes':_0x2ed4ce['attributes'],'include':_0x2ed4ce[_0x10ac('0x1c')]?_['map'](_0x2ed4ce['include'],function(_0x3c2302){return{'model':db[_0x3c2302[_0x10ac('0x1e')]],'as':_0x3c2302['as'],'attributes':_0x3c2302[_0x10ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x10ac('0xa')](function(_0x3fe685){logger[_0x10ac('0x13')](_0x10ac('0x16'),_0x23c083);logger[_0x10ac('0xd')](_0x10ac('0x16'),_0x23c083,JSON[_0x10ac('0xf')](_0x3fe685));_0x278a7b(_0x3fe685);})[_0x10ac('0x15')](function(_0x31cebf){logger[_0x10ac('0x10')](_0x10ac('0x16'),_0x31cebf[_0x10ac('0x12')],_0x23c083);_0x2b24ad(_0x434c09['error'](0x1f4,_0x31cebf[_0x10ac('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x66cd2b){var _0x186318=this;return new Promise(function(_0x15332d,_0x138453){return db[_0x10ac('0x1f')][_0x10ac('0x20')]({'raw':_0x66cd2b[_0x10ac('0x18')]?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x19')]===undefined?!![]:![]:!![],'where':_0x66cd2b['options']?_0x66cd2b['options'][_0x10ac('0x1a')]||null:null,'attributes':_0x66cd2b['options']?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x1b')]||null:null,'include':_0x66cd2b['options']?_0x66cd2b[_0x10ac('0x18')][_0x10ac('0x1c')]?_['map'](_0x66cd2b[_0x10ac('0x18')]['include'],function(_0x3ee983){return{'model':db[_0x3ee983['model']],'as':_0x3ee983['as'],'attributes':_0x3ee983['attributes'],'include':_0x3ee983[_0x10ac('0x1c')]?_[_0x10ac('0x1d')](_0x3ee983[_0x10ac('0x1c')],function(_0x4c036b){return{'model':db[_0x4c036b['model']],'as':_0x4c036b['as'],'attributes':_0x4c036b['attributes'],'include':_0x4c036b['include']?_[_0x10ac('0x1d')](_0x4c036b[_0x10ac('0x1c')],function(_0x1c073f){return{'model':db[_0x1c073f['model']],'as':_0x1c073f['as'],'attributes':_0x1c073f[_0x10ac('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x10ac('0xa')](function(_0x39ccd3){logger[_0x10ac('0x13')](_0x10ac('0x21'),_0x66cd2b);logger[_0x10ac('0xd')]('ShowZendeskAccount',_0x66cd2b,JSON[_0x10ac('0xf')](_0x39ccd3));_0x15332d(_0x39ccd3);})[_0x10ac('0x15')](function(_0x4718cc){logger['error'](_0x10ac('0x21'),_0x4718cc[_0x10ac('0x12')],_0x66cd2b);_0x138453(_0x186318[_0x10ac('0x10')](0x1f4,_0x4718cc[_0x10ac('0x12')]));});});}; \ No newline at end of file +var _0x938d=['find','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZendeskAccount'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var moment=require('moment');var BPromise=require(_0xd938('0x2'));var rs=require(_0xd938('0x3'));var fs=require('fs');var Redis=require(_0xd938('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd938('0x5'))(_0xd938('0x6'));var config=require(_0xd938('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd938('0x8')][_0xd938('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ed46b,_0x29fcaa,_0x678164){return new BPromise(function(_0x419e0b,_0x4792db){return client[_0xd938('0xa')](_0x1ed46b,_0x678164)[_0xd938('0xb')](function(_0x19fac0){logger[_0xd938('0xc')](_0xd938('0xd'),_0x29fcaa,_0xd938('0xe'));logger['debug'](_0xd938('0xf'),_0x29fcaa,_0xd938('0xe'),JSON[_0xd938('0x10')](_0x19fac0));if(_0x19fac0[_0xd938('0x11')]){if(_0x19fac0[_0xd938('0x11')][_0xd938('0x12')]===0x1f4){logger[_0xd938('0x11')](_0xd938('0xd'),_0x29fcaa,_0x19fac0[_0xd938('0x11')][_0xd938('0x13')]);return _0x4792db(_0x19fac0[_0xd938('0x11')][_0xd938('0x13')]);}logger[_0xd938('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x29fcaa,_0x19fac0['error']['message']);return _0x419e0b(_0x19fac0[_0xd938('0x11')][_0xd938('0x13')]);}else{logger[_0xd938('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x29fcaa,'request\x20sent');_0x419e0b(_0x19fac0[_0xd938('0x14')][_0xd938('0x13')]);}})['catch'](function(_0x5aef15){logger['error'](_0xd938('0xd'),_0x29fcaa,_0x5aef15);_0x4792db(_0x5aef15);});});}exports[_0xd938('0x15')]=function(_0x355185){var _0x54b652=this;return new Promise(function(_0x103e84,_0x34d512){return db[_0xd938('0x16')][_0xd938('0x17')]({'raw':_0x355185[_0xd938('0x18')]?_0x355185['options'][_0xd938('0x19')]===undefined?!![]:![]:!![],'where':_0x355185['options']?_0x355185['options'][_0xd938('0x1a')]||null:null,'attributes':_0x355185['options']?_0x355185[_0xd938('0x18')][_0xd938('0x1b')]||null:null,'limit':_0x355185[_0xd938('0x18')]?_0x355185[_0xd938('0x18')][_0xd938('0x1c')]||null:null,'include':_0x355185['options']?_0x355185[_0xd938('0x18')][_0xd938('0x1d')]?_[_0xd938('0x1e')](_0x355185[_0xd938('0x18')][_0xd938('0x1d')],function(_0x28f56a){return{'model':db[_0x28f56a[_0xd938('0x1f')]],'as':_0x28f56a['as'],'attributes':_0x28f56a[_0xd938('0x1b')],'include':_0x28f56a[_0xd938('0x1d')]?_[_0xd938('0x1e')](_0x28f56a[_0xd938('0x1d')],function(_0x5bc216){return{'model':db[_0x5bc216['model']],'as':_0x5bc216['as'],'attributes':_0x5bc216[_0xd938('0x1b')],'include':_0x5bc216[_0xd938('0x1d')]?_[_0xd938('0x1e')](_0x5bc216['include'],function(_0x10044c){return{'model':db[_0x10044c['model']],'as':_0x10044c['as'],'attributes':_0x10044c[_0xd938('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43fc62){logger['info'](_0xd938('0x15'),_0x355185);logger[_0xd938('0x20')](_0xd938('0x15'),_0x355185,JSON[_0xd938('0x10')](_0x43fc62));_0x103e84(_0x43fc62);})['catch'](function(_0x20a873){logger[_0xd938('0x11')](_0xd938('0x15'),_0x20a873[_0xd938('0x13')],_0x355185);_0x34d512(_0x54b652['error'](0x1f4,_0x20a873[_0xd938('0x13')]));});});};exports[_0xd938('0x21')]=function(_0xd55990){var _0x4bf006=this;return new Promise(function(_0x3ff1ce,_0x2d8fc0){return db[_0xd938('0x16')][_0xd938('0x22')]({'raw':_0xd55990[_0xd938('0x18')]?_0xd55990[_0xd938('0x18')][_0xd938('0x19')]===undefined?!![]:![]:!![],'where':_0xd55990[_0xd938('0x18')]?_0xd55990['options'][_0xd938('0x1a')]||null:null,'attributes':_0xd55990[_0xd938('0x18')]?_0xd55990[_0xd938('0x18')][_0xd938('0x1b')]||null:null,'include':_0xd55990['options']?_0xd55990[_0xd938('0x18')][_0xd938('0x1d')]?_[_0xd938('0x1e')](_0xd55990[_0xd938('0x18')]['include'],function(_0x29a978){return{'model':db[_0x29a978[_0xd938('0x1f')]],'as':_0x29a978['as'],'attributes':_0x29a978[_0xd938('0x1b')],'include':_0x29a978[_0xd938('0x1d')]?_['map'](_0x29a978[_0xd938('0x1d')],function(_0x1a77fc){return{'model':db[_0x1a77fc['model']],'as':_0x1a77fc['as'],'attributes':_0x1a77fc[_0xd938('0x1b')],'include':_0x1a77fc['include']?_['map'](_0x1a77fc[_0xd938('0x1d')],function(_0x216627){return{'model':db[_0x216627[_0xd938('0x1f')]],'as':_0x216627['as'],'attributes':_0x216627['attributes']};}):[]};}):[]};}):[]:[]})[_0xd938('0xb')](function(_0x100594){logger[_0xd938('0xc')](_0xd938('0x21'),_0xd55990);logger['debug']('ShowZendeskAccount',_0xd55990,JSON[_0xd938('0x10')](_0x100594));_0x3ff1ce(_0x100594);})[_0xd938('0x23')](function(_0x5e49e0){logger['error']('ShowZendeskAccount',_0x5e49e0[_0xd938('0x13')],_0xd55990);_0x2d8fc0(_0x4bf006[_0xd938('0x11')](0x1f4,_0x5e49e0[_0xd938('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2e9400d..d13f706 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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5ed099,_0x304e8a){var _0x46e1d7=function(_0x2b57f1){while(--_0x2b57f1){_0x5ed099['push'](_0x5ed099['shift']());}};_0x46e1d7(++_0x304e8a);}(_0xac4a,0x13f));var _0xaac4=function(_0x5a2ee2,_0x2dcc19){_0x5a2ee2=_0x5a2ee2-0x0;var _0xf2fcb7=_0xac4a[_0x5a2ee2];return _0xf2fcb7;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +var _0x153f=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x849fd8,_0xf76b4d){var _0x2b2c37=function(_0x479ce3){while(--_0x479ce3){_0x849fd8['push'](_0x849fd8['shift']());}};_0x2b2c37(++_0xf76b4d);}(_0x153f,0x15b));var _0xf153=function(_0x2e9887,_0x964cb4){_0x2e9887=_0x2e9887-0x0;var _0x5b5e39=_0x153f[_0x2e9887];return _0x5b5e39;};'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')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['get'](_0xf153('0x11'),auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router['get'](_0xf153('0x13'),auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);router[_0xf153('0x15')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x16')]);router[_0xf153('0x15')](_0xf153('0x13'),auth[_0xf153('0xa')](),controller['setTags']);router[_0xf153('0x17')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 68d8271..54cd493 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 _0xa20d=['exports','STRING','sequelize'];(function(_0x4f3d00,_0x188abc){var _0x484889=function(_0x13eb9c){while(--_0x13eb9c){_0x4f3d00['push'](_0x4f3d00['shift']());}};_0x484889(++_0x188abc);}(_0xa20d,0xb3));var _0xda20=function(_0x3d3c75,_0x36f20d){_0x3d3c75=_0x3d3c75-0x0;var _0x1f3063=_0xa20d[_0x3d3c75];return _0x1f3063;};'use strict';var Sequelize=require(_0xda20('0x0'));module[_0xda20('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xda20('0x2')]}}; \ No newline at end of file +var _0x9006=['exports','STRING','sequelize'];(function(_0x1f632a,_0x5872bc){var _0x228b4a=function(_0x4fb482){while(--_0x4fb482){_0x1f632a['push'](_0x1f632a['shift']());}};_0x228b4a(++_0x5872bc);}(_0x9006,0x1d6));var _0x6900=function(_0x4d9565,_0x32a730){_0x4d9565=_0x4d9565-0x0;var _0x535f76=_0x9006[_0x4d9565];return _0x535f76;};'use strict';var Sequelize=require(_0x6900('0x0'));module[_0x6900('0x1')]={'name':{'type':Sequelize[_0x6900('0x2')]},'description':{'type':Sequelize[_0x6900('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 91a5f3f..31d33e6 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 _0x1b51=['fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ZendeskField','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x1b51,0xa0));var _0x11b5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b51[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x11b5('0x0'));var rimraf=require(_0x11b5('0x1'));var zipdir=require(_0x11b5('0x2'));var jsonpatch=require(_0x11b5('0x3'));var rp=require(_0x11b5('0x4'));var moment=require(_0x11b5('0x5'));var BPromise=require(_0x11b5('0x6'));var Mustache=require(_0x11b5('0x7'));var util=require(_0x11b5('0x8'));var path=require(_0x11b5('0x9'));var sox=require(_0x11b5('0xa'));var csv=require(_0x11b5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11b5('0xc'));var _=require(_0x11b5('0xd'));var squel=require(_0x11b5('0xe'));var crypto=require(_0x11b5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x11b5('0x10'));var toCsv=require(_0x11b5('0xb'));var querystring=require('querystring');var Papa=require(_0x11b5('0x11'));var Redis=require(_0x11b5('0x12'));var authService=require(_0x11b5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x11b5('0x14'));var hardwareService=require(_0x11b5('0x15'));var logger=require(_0x11b5('0x16'))('api');var utils=require(_0x11b5('0x17'));var config=require(_0x11b5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x11b5('0x19'))['db'];function respondWithStatusCode(_0x4a7339,_0x2bd553){_0x2bd553=_0x2bd553||0xcc;return function(_0x236054){if(_0x236054){return _0x4a7339[_0x11b5('0x1a')](_0x2bd553);}return _0x4a7339['status'](_0x2bd553)[_0x11b5('0x1b')]();};}function respondWithResult(_0x143000,_0x2f4895){_0x2f4895=_0x2f4895||0xc8;return function(_0x27b386){if(_0x27b386){return _0x143000['status'](_0x2f4895)[_0x11b5('0x1c')](_0x27b386);}};}function respondWithFilteredResult(_0x29ad3f,_0x3f00be){return function(_0x3e5785){if(_0x3e5785){var _0x3e0ce6=typeof _0x3f00be[_0x11b5('0x1d')]===_0x11b5('0x1e')&&typeof _0x3f00be[_0x11b5('0x1f')]==='undefined';var _0x95bab1=_0x3e5785['count'];var _0x17353b=_0x3e0ce6?0x0:_0x3f00be[_0x11b5('0x1d')];var _0x4a8de6=_0x3e0ce6?_0x3e5785[_0x11b5('0x20')]:_0x3f00be[_0x11b5('0x1d')]+_0x3f00be[_0x11b5('0x1f')];var _0x4e9187;if(_0x4a8de6>=_0x95bab1){_0x4a8de6=_0x95bab1;_0x4e9187=0xc8;}else{_0x4e9187=0xce;}_0x29ad3f[_0x11b5('0x21')](_0x4e9187);return _0x29ad3f[_0x11b5('0x22')](_0x11b5('0x23'),_0x17353b+'-'+_0x4a8de6+'/'+_0x95bab1)[_0x11b5('0x1c')](_0x3e5785);}return null;};}function patchUpdates(_0x959bcd){return function(_0x4f1ec9){try{jsonpatch[_0x11b5('0x24')](_0x4f1ec9,_0x959bcd,!![]);}catch(_0x2d82fb){return BPromise[_0x11b5('0x25')](_0x2d82fb);}return _0x4f1ec9[_0x11b5('0x26')]();};}function saveUpdates(_0x420beb,_0x34812b){return function(_0x3b9ccd){if(_0x3b9ccd){return _0x3b9ccd[_0x11b5('0x27')](_0x420beb)[_0x11b5('0x28')](function(_0x3a42dc){return _0x3a42dc;});}return null;};}function removeEntity(_0x53dd32,_0x1b642b){return function(_0x756ca8){if(_0x756ca8){return _0x756ca8[_0x11b5('0x29')]()[_0x11b5('0x28')](function(){_0x53dd32[_0x11b5('0x21')](0xcc)[_0x11b5('0x1b')]();});}};}function handleEntityNotFound(_0x1d7061,_0x597c0){return function(_0x440f1d){if(!_0x440f1d){_0x1d7061[_0x11b5('0x1a')](0x194);}return _0x440f1d;};}function handleError(_0x4e9168,_0x1743fc){_0x1743fc=_0x1743fc||0x1f4;return function(_0x39f325){logger['error'](_0x39f325[_0x11b5('0x2a')]);if(_0x39f325[_0x11b5('0x2b')]){delete _0x39f325['name'];}_0x4e9168['status'](_0x1743fc)[_0x11b5('0x2c')](_0x39f325);};}exports[_0x11b5('0x2d')]=function(_0x2a4854,_0x4a9860){var _0x2b24fa={},_0x610408={},_0x48682d={'count':0x0,'rows':[]};var _0x2f9a20=_['map'](db[_0x11b5('0x2e')]['rawAttributes'],function(_0x59b21d){return{'name':_0x59b21d[_0x11b5('0x2f')],'type':_0x59b21d[_0x11b5('0x30')][_0x11b5('0x31')]};});_0x610408[_0x11b5('0x32')]=_[_0x11b5('0x33')](_0x2f9a20,_0x11b5('0x2b'));_0x610408['query']=_[_0x11b5('0x34')](_0x2a4854[_0x11b5('0x35')]);_0x610408[_0x11b5('0x36')]=_[_0x11b5('0x37')](_0x610408[_0x11b5('0x32')],_0x610408[_0x11b5('0x35')]);_0x2b24fa[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0x610408[_0x11b5('0x32')],qs[_0x11b5('0x39')](_0x2a4854['query'][_0x11b5('0x39')]));_0x2b24fa[_0x11b5('0x38')]=_0x2b24fa[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x2b24fa[_0x11b5('0x38')]:_0x610408[_0x11b5('0x32')];if(!_0x2a4854[_0x11b5('0x35')][_0x11b5('0x3b')](_0x11b5('0x3c'))){_0x2b24fa[_0x11b5('0x1f')]=qs['limit'](_0x2a4854[_0x11b5('0x35')][_0x11b5('0x1f')]);_0x2b24fa[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x2a4854[_0x11b5('0x35')][_0x11b5('0x1d')]);}_0x2b24fa[_0x11b5('0x3d')]=qs[_0x11b5('0x3e')](_0x2a4854['query'][_0x11b5('0x3e')]);_0x2b24fa[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x2a4854[_0x11b5('0x35')],_0x610408[_0x11b5('0x36')]),_0x2f9a20);if(_0x2a4854['query'][_0x11b5('0x41')]){_0x2b24fa[_0x11b5('0x3f')]=_[_0x11b5('0x42')](_0x2b24fa[_0x11b5('0x3f')],{'$or':_['map'](_0x2f9a20,function(_0x1be66d){if(_0x1be66d['type']!==_0x11b5('0x43')){var _0x4acc71={};_0x4acc71[_0x1be66d[_0x11b5('0x2b')]]={'$like':'%'+_0x2a4854[_0x11b5('0x35')][_0x11b5('0x41')]+'%'};return _0x4acc71;}})});}_0x2b24fa=_['merge']({},_0x2b24fa,_0x2a4854[_0x11b5('0x44')]);var _0x326913={'where':_0x2b24fa[_0x11b5('0x3f')]};return db[_0x11b5('0x2e')][_0x11b5('0x20')](_0x326913)[_0x11b5('0x28')](function(_0x94d521){_0x48682d['count']=_0x94d521;if(_0x2a4854[_0x11b5('0x35')][_0x11b5('0x45')]){_0x2b24fa[_0x11b5('0x46')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x2b24fa);})[_0x11b5('0x28')](function(_0x25c757){_0x48682d[_0x11b5('0x47')]=_0x25c757;return _0x48682d;})['then'](respondWithFilteredResult(_0x4a9860,_0x2b24fa))[_0x11b5('0x48')](handleError(_0x4a9860,null));};exports[_0x11b5('0x49')]=function(_0x2ac213,_0x5efccc){var _0xd61f9a={'raw':![],'where':{'id':_0x2ac213[_0x11b5('0x4a')]['id']}},_0x44efeb={};_0x44efeb[_0x11b5('0x32')]=_['keys'](db[_0x11b5('0x2e')][_0x11b5('0x4b')]);_0x44efeb[_0x11b5('0x35')]=_['keys'](_0x2ac213[_0x11b5('0x35')]);_0x44efeb['filters']=_[_0x11b5('0x37')](_0x44efeb['model'],_0x44efeb['query']);_0xd61f9a[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0x44efeb[_0x11b5('0x32')],qs[_0x11b5('0x39')](_0x2ac213[_0x11b5('0x35')][_0x11b5('0x39')]));_0xd61f9a[_0x11b5('0x38')]=_0xd61f9a[_0x11b5('0x38')]['length']?_0xd61f9a['attributes']:_0x44efeb[_0x11b5('0x32')];if(_0x2ac213[_0x11b5('0x35')][_0x11b5('0x45')]){_0xd61f9a[_0x11b5('0x46')]=[{'all':!![]}];}_0xd61f9a=_[_0x11b5('0x42')]({},_0xd61f9a,_0x2ac213[_0x11b5('0x44')]);return db['ZendeskConfiguration'][_0x11b5('0x4c')](_0xd61f9a)[_0x11b5('0x28')](handleEntityNotFound(_0x5efccc,null))[_0x11b5('0x28')](respondWithResult(_0x5efccc,null))['catch'](handleError(_0x5efccc,null));};exports['create']=function(_0x488f47,_0x383e24){return db[_0x11b5('0x2e')][_0x11b5('0x4d')](_0x488f47[_0x11b5('0x4e')],{})['then'](respondWithResult(_0x383e24,0xc9))[_0x11b5('0x48')](handleError(_0x383e24,null));};exports[_0x11b5('0x27')]=function(_0xe81418,_0x13d5e7){if(_0xe81418['body']['id']){delete _0xe81418[_0x11b5('0x4e')]['id'];}return db[_0x11b5('0x2e')]['find']({'where':{'id':_0xe81418[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x13d5e7,null))[_0x11b5('0x28')](saveUpdates(_0xe81418[_0x11b5('0x4e')],null))['then'](respondWithResult(_0x13d5e7,null))[_0x11b5('0x48')](handleError(_0x13d5e7,null));};exports['destroy']=function(_0x5aa607,_0x3c16ce){return db[_0x11b5('0x2e')][_0x11b5('0x4c')]({'where':{'id':_0x5aa607[_0x11b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c16ce,null))[_0x11b5('0x28')](removeEntity(_0x3c16ce,null))[_0x11b5('0x48')](handleError(_0x3c16ce,null));};exports[_0x11b5('0x4f')]=function(_0x5507ea,_0x4ac5fa,_0x3b8aa8){var _0x1836e3={};var _0x30ab56={};var _0x76f42c;var _0x4f5dca;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x5507ea[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x4ac5fa,null))[_0x11b5('0x28')](function(_0x66afc7){if(_0x66afc7){_0x76f42c=_0x66afc7;_0x30ab56['model']=_['keys'](db['ZendeskField'][_0x11b5('0x4b')]);_0x30ab56['query']=_[_0x11b5('0x34')](_0x5507ea[_0x11b5('0x35')]);_0x30ab56[_0x11b5('0x36')]=_['intersection'](_0x30ab56['model'],_0x30ab56[_0x11b5('0x35')]);_0x1836e3['attributes']=_['intersection'](_0x30ab56['model'],qs['fields'](_0x5507ea[_0x11b5('0x35')][_0x11b5('0x39')]));_0x1836e3[_0x11b5('0x38')]=_0x1836e3[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x1836e3['attributes']:_0x30ab56['model'];_0x1836e3['order']=qs[_0x11b5('0x3e')](_0x5507ea[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x1836e3[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x5507ea['query'],_0x30ab56[_0x11b5('0x36')]));if(_0x5507ea['query'][_0x11b5('0x41')]){_0x1836e3['where']=_[_0x11b5('0x42')](_0x1836e3[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x1836e3['attributes'],function(_0x17b89d){var _0x4e06b9={};_0x4e06b9[_0x17b89d]={'$like':'%'+_0x5507ea[_0x11b5('0x35')][_0x11b5('0x41')]+'%'};return _0x4e06b9;})});}_0x1836e3=_[_0x11b5('0x42')]({},_0x1836e3,_0x5507ea['options']);return _0x76f42c[_0x11b5('0x4f')](_0x1836e3);}})[_0x11b5('0x28')](function(_0x4382ba){if(_0x4382ba){_0x4f5dca=_0x4382ba['length'];if(!_0x5507ea[_0x11b5('0x35')][_0x11b5('0x3b')]('nolimit')){_0x1836e3[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0x5507ea[_0x11b5('0x35')]['limit']);_0x1836e3[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x5507ea[_0x11b5('0x35')]['offset']);}return _0x76f42c[_0x11b5('0x4f')](_0x1836e3);}})['then'](function(_0x597d82){if(_0x597d82){return _0x597d82?{'count':_0x4f5dca,'rows':_0x597d82}:null;}})[_0x11b5('0x28')](respondWithResult(_0x4ac5fa,null))[_0x11b5('0x48')](handleError(_0x4ac5fa,null));};exports[_0x11b5('0x51')]=function(_0x3f39c0,_0x2965ee,_0x1bc4de){var _0xc980e8={};var _0xdc592d={};var _0x37f81e;var _0x29bc40;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x3f39c0[_0x11b5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2965ee,null))[_0x11b5('0x28')](function(_0x5e23f5){if(_0x5e23f5){_0x37f81e=_0x5e23f5;_0xdc592d['model']=_[_0x11b5('0x34')](db[_0x11b5('0x52')][_0x11b5('0x4b')]);_0xdc592d[_0x11b5('0x35')]=_['keys'](_0x3f39c0[_0x11b5('0x35')]);_0xdc592d['filters']=_[_0x11b5('0x37')](_0xdc592d[_0x11b5('0x32')],_0xdc592d[_0x11b5('0x35')]);_0xc980e8[_0x11b5('0x38')]=_[_0x11b5('0x37')](_0xdc592d['model'],qs[_0x11b5('0x39')](_0x3f39c0['query'][_0x11b5('0x39')]));_0xc980e8[_0x11b5('0x38')]=_0xc980e8[_0x11b5('0x38')][_0x11b5('0x3a')]?_0xc980e8[_0x11b5('0x38')]:_0xdc592d['model'];_0xc980e8[_0x11b5('0x3d')]=qs[_0x11b5('0x3e')](_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x3e')]);_0xc980e8[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x3f39c0['query'],_0xdc592d[_0x11b5('0x36')]));if(_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x41')]){_0xc980e8['where']=_['merge'](_0xc980e8['where'],{'$or':_[_0x11b5('0x33')](_0xc980e8[_0x11b5('0x38')],function(_0x3a6eb7){var _0x1022d5={};_0x1022d5[_0x3a6eb7]={'$like':'%'+_0x3f39c0['query'][_0x11b5('0x41')]+'%'};return _0x1022d5;})});}_0xc980e8=_[_0x11b5('0x42')]({},_0xc980e8,_0x3f39c0['options']);return _0x37f81e[_0x11b5('0x51')](_0xc980e8);}})[_0x11b5('0x28')](function(_0x6ddf0e){if(_0x6ddf0e){_0x29bc40=_0x6ddf0e['length'];if(!_0x3f39c0[_0x11b5('0x35')]['hasOwnProperty']('nolimit')){_0xc980e8['limit']=qs[_0x11b5('0x1f')](_0x3f39c0[_0x11b5('0x35')][_0x11b5('0x1f')]);_0xc980e8[_0x11b5('0x1d')]=qs[_0x11b5('0x1d')](_0x3f39c0[_0x11b5('0x35')]['offset']);}return _0x37f81e[_0x11b5('0x51')](_0xc980e8);}})['then'](function(_0x43f949){if(_0x43f949){return _0x43f949?{'count':_0x29bc40,'rows':_0x43f949}:null;}})[_0x11b5('0x28')](respondWithResult(_0x2965ee,null))['catch'](handleError(_0x2965ee,null));};exports['getDescriptions']=function(_0x16143b,_0x1e09c6,_0x20bd86){var _0x18e76e={};var _0x199169={};var _0x4f0708;var _0x4b7c30;return db[_0x11b5('0x2e')]['findOne']({'where':{'id':_0x16143b[_0x11b5('0x4a')]['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x1e09c6,null))[_0x11b5('0x28')](function(_0xb41c86){if(_0xb41c86){_0x4f0708=_0xb41c86;_0x199169[_0x11b5('0x32')]=_[_0x11b5('0x34')](db[_0x11b5('0x52')][_0x11b5('0x4b')]);_0x199169[_0x11b5('0x35')]=_[_0x11b5('0x34')](_0x16143b[_0x11b5('0x35')]);_0x199169['filters']=_[_0x11b5('0x37')](_0x199169[_0x11b5('0x32')],_0x199169[_0x11b5('0x35')]);_0x18e76e[_0x11b5('0x38')]=_['intersection'](_0x199169[_0x11b5('0x32')],qs['fields'](_0x16143b[_0x11b5('0x35')][_0x11b5('0x39')]));_0x18e76e[_0x11b5('0x38')]=_0x18e76e[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x18e76e['attributes']:_0x199169[_0x11b5('0x32')];_0x18e76e['order']=qs[_0x11b5('0x3e')](_0x16143b[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x18e76e[_0x11b5('0x3f')]=qs[_0x11b5('0x36')](_[_0x11b5('0x40')](_0x16143b[_0x11b5('0x35')],_0x199169[_0x11b5('0x36')]));if(_0x16143b[_0x11b5('0x35')][_0x11b5('0x41')]){_0x18e76e['where']=_[_0x11b5('0x42')](_0x18e76e[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x18e76e[_0x11b5('0x38')],function(_0x538e59){var _0x3bb48b={};_0x3bb48b[_0x538e59]={'$like':'%'+_0x16143b['query'][_0x11b5('0x41')]+'%'};return _0x3bb48b;})});}_0x18e76e=_[_0x11b5('0x42')]({},_0x18e76e,_0x16143b[_0x11b5('0x44')]);return _0x4f0708['getDescriptions'](_0x18e76e);}})[_0x11b5('0x28')](function(_0x161784){if(_0x161784){_0x4b7c30=_0x161784['length'];if(!_0x16143b[_0x11b5('0x35')][_0x11b5('0x3b')](_0x11b5('0x3c'))){_0x18e76e[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0x16143b[_0x11b5('0x35')]['limit']);_0x18e76e['offset']=qs[_0x11b5('0x1d')](_0x16143b['query'][_0x11b5('0x1d')]);}return _0x4f0708['getDescriptions'](_0x18e76e);}})['then'](function(_0x2a5628){if(_0x2a5628){return _0x2a5628?{'count':_0x4b7c30,'rows':_0x2a5628}:null;}})[_0x11b5('0x28')](respondWithResult(_0x1e09c6,null))[_0x11b5('0x48')](handleError(_0x1e09c6,null));};exports[_0x11b5('0x53')]=function(_0xbf26e6,_0x3e8406,_0x5093e4){var _0x2c4c95={};var _0x17db2b={};var _0x5f2e5a;var _0x5dff6c;return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0xbf26e6['params']['id']}})[_0x11b5('0x28')](handleEntityNotFound(_0x3e8406,null))[_0x11b5('0x28')](function(_0x3ef648){if(_0x3ef648){_0x5f2e5a=_0x3ef648;_0x17db2b[_0x11b5('0x32')]=_['keys'](db[_0x11b5('0x54')][_0x11b5('0x4b')]);_0x17db2b[_0x11b5('0x35')]=_[_0x11b5('0x34')](_0xbf26e6[_0x11b5('0x35')]);_0x17db2b[_0x11b5('0x36')]=_[_0x11b5('0x37')](_0x17db2b[_0x11b5('0x32')],_0x17db2b['query']);_0x2c4c95[_0x11b5('0x38')]=_['intersection'](_0x17db2b['model'],qs[_0x11b5('0x39')](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x39')]));_0x2c4c95['attributes']=_0x2c4c95[_0x11b5('0x38')][_0x11b5('0x3a')]?_0x2c4c95[_0x11b5('0x38')]:_0x17db2b[_0x11b5('0x32')];_0x2c4c95['order']=qs[_0x11b5('0x3e')](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x3e')]);_0x2c4c95['where']=qs['filters'](_[_0x11b5('0x40')](_0xbf26e6['query'],_0x17db2b[_0x11b5('0x36')]));if(_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x41')]){_0x2c4c95[_0x11b5('0x3f')]=_['merge'](_0x2c4c95[_0x11b5('0x3f')],{'$or':_[_0x11b5('0x33')](_0x2c4c95['attributes'],function(_0x4451bd){var _0x3405fb={};_0x3405fb[_0x4451bd]={'$like':'%'+_0xbf26e6[_0x11b5('0x35')]['filter']+'%'};return _0x3405fb;})});}_0x2c4c95=_['merge']({},_0x2c4c95,_0xbf26e6[_0x11b5('0x44')]);return _0x5f2e5a[_0x11b5('0x53')](_0x2c4c95);}})[_0x11b5('0x28')](function(_0xb41a25){if(_0xb41a25){_0x5dff6c=_0xb41a25['length'];if(!_0xbf26e6[_0x11b5('0x35')]['hasOwnProperty']('nolimit')){_0x2c4c95[_0x11b5('0x1f')]=qs[_0x11b5('0x1f')](_0xbf26e6['query'][_0x11b5('0x1f')]);_0x2c4c95['offset']=qs['offset'](_0xbf26e6[_0x11b5('0x35')][_0x11b5('0x1d')]);}return _0x5f2e5a[_0x11b5('0x53')](_0x2c4c95);}})[_0x11b5('0x28')](function(_0x1eb53b){if(_0x1eb53b){return _0x1eb53b?{'count':_0x5dff6c,'rows':_0x1eb53b}:null;}})[_0x11b5('0x28')](respondWithResult(_0x3e8406,null))[_0x11b5('0x48')](handleError(_0x3e8406,null));};exports[_0x11b5('0x55')]=function(_0x209aec,_0x52058c,_0xd97514){if(_0x209aec[_0x11b5('0x4e')]['id']){delete _0x209aec[_0x11b5('0x4e')]['id'];}return db[_0x11b5('0x2e')][_0x11b5('0x50')]({'where':{'id':_0x209aec['params']['id']}})['then'](handleEntityNotFound(_0x52058c,null))[_0x11b5('0x28')](function(_0x23738e){if(_0x23738e){return _0x23738e['setTags'](_0x209aec[_0x11b5('0x4e')]['ids']||[]);}return null;})[_0x11b5('0x28')](respondWithResult(_0x52058c,null))[_0x11b5('0x48')](handleError(_0x52058c,null));}; \ No newline at end of file +var _0x308a=['filter','VIRTUAL','merge','options','where','include','findAll','catch','show','fields','includeAll','find','create','update','body','params','ZendeskField','order','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','intersection','length','hasOwnProperty','sort','pick'];(function(_0x3bd4be,_0x20633b){var _0x1cec6b=function(_0x13aca4){while(--_0x13aca4){_0x3bd4be['push'](_0x3bd4be['shift']());}};_0x1cec6b(++_0x20633b);}(_0x308a,0x1ce));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa308('0x0'));var rimraf=require(_0xa308('0x1'));var zipdir=require(_0xa308('0x2'));var jsonpatch=require(_0xa308('0x3'));var rp=require('request-promise');var moment=require(_0xa308('0x4'));var BPromise=require(_0xa308('0x5'));var Mustache=require(_0xa308('0x6'));var util=require(_0xa308('0x7'));var path=require(_0xa308('0x8'));var sox=require('sox');var csv=require(_0xa308('0x9'));var ejs=require(_0xa308('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa308('0xb'));var squel=require(_0xa308('0xc'));var crypto=require(_0xa308('0xd'));var jsforce=require(_0xa308('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa308('0x9'));var querystring=require('querystring');var Papa=require(_0xa308('0xf'));var Redis=require(_0xa308('0x10'));var authService=require(_0xa308('0x11'));var qs=require(_0xa308('0x12'));var as=require(_0xa308('0x13'));var hardwareService=require(_0xa308('0x14'));var logger=require('../../config/logger')(_0xa308('0x15'));var utils=require(_0xa308('0x16'));var config=require(_0xa308('0x17'));var licenseUtil=require(_0xa308('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d099,_0x476a35){_0x476a35=_0x476a35||0xcc;return function(_0x53736f){if(_0x53736f){return _0x11d099['sendStatus'](_0x476a35);}return _0x11d099[_0xa308('0x19')](_0x476a35)[_0xa308('0x1a')]();};}function respondWithResult(_0x41f085,_0x4d3fba){_0x4d3fba=_0x4d3fba||0xc8;return function(_0x5168c1){if(_0x5168c1){return _0x41f085[_0xa308('0x19')](_0x4d3fba)[_0xa308('0x1b')](_0x5168c1);}};}function respondWithFilteredResult(_0x558735,_0x2fe2a5){return function(_0x18edda){if(_0x18edda){var _0xcd2a37=typeof _0x2fe2a5[_0xa308('0x1c')]==='undefined'&&typeof _0x2fe2a5[_0xa308('0x1d')]===_0xa308('0x1e');var _0xba4ba7=_0x18edda['count'];var _0x38a1db=_0xcd2a37?0x0:_0x2fe2a5[_0xa308('0x1c')];var _0x55d7c9=_0xcd2a37?_0x18edda[_0xa308('0x1f')]:_0x2fe2a5['offset']+_0x2fe2a5[_0xa308('0x1d')];var _0xc06f39;if(_0x55d7c9>=_0xba4ba7){_0x55d7c9=_0xba4ba7;_0xc06f39=0xc8;}else{_0xc06f39=0xce;}_0x558735[_0xa308('0x19')](_0xc06f39);return _0x558735[_0xa308('0x20')](_0xa308('0x21'),_0x38a1db+'-'+_0x55d7c9+'/'+_0xba4ba7)[_0xa308('0x1b')](_0x18edda);}return null;};}function patchUpdates(_0x265343){return function(_0x1eb2e4){try{jsonpatch[_0xa308('0x22')](_0x1eb2e4,_0x265343,!![]);}catch(_0x42216c){return BPromise[_0xa308('0x23')](_0x42216c);}return _0x1eb2e4[_0xa308('0x24')]();};}function saveUpdates(_0x584aae,_0x2bab47){return function(_0x399f39){if(_0x399f39){return _0x399f39['update'](_0x584aae)['then'](function(_0x3eb14e){return _0x3eb14e;});}return null;};}function removeEntity(_0x1af789,_0x5da43d){return function(_0x458f44){if(_0x458f44){return _0x458f44[_0xa308('0x25')]()[_0xa308('0x26')](function(){_0x1af789[_0xa308('0x19')](0xcc)[_0xa308('0x1a')]();});}};}function handleEntityNotFound(_0x32d6b4,_0x36826b){return function(_0x2a806b){if(!_0x2a806b){_0x32d6b4[_0xa308('0x27')](0x194);}return _0x2a806b;};}function handleError(_0x8f076f,_0x244df5){_0x244df5=_0x244df5||0x1f4;return function(_0x363686){logger['error'](_0x363686[_0xa308('0x28')]);if(_0x363686['name']){delete _0x363686['name'];}_0x8f076f['status'](_0x244df5)[_0xa308('0x29')](_0x363686);};}exports[_0xa308('0x2a')]=function(_0x20d788,_0x4f490f){var _0x28b8ec={},_0x1e2dcc={},_0x4125df={'count':0x0,'rows':[]};var _0x52140e=_[_0xa308('0x2b')](db[_0xa308('0x2c')][_0xa308('0x2d')],function(_0x3ea5e3){return{'name':_0x3ea5e3[_0xa308('0x2e')],'type':_0x3ea5e3[_0xa308('0x2f')][_0xa308('0x30')]};});_0x1e2dcc[_0xa308('0x31')]=_[_0xa308('0x2b')](_0x52140e,_0xa308('0x32'));_0x1e2dcc['query']=_[_0xa308('0x33')](_0x20d788[_0xa308('0x34')]);_0x1e2dcc[_0xa308('0x35')]=_['intersection'](_0x1e2dcc[_0xa308('0x31')],_0x1e2dcc[_0xa308('0x34')]);_0x28b8ec[_0xa308('0x36')]=_[_0xa308('0x37')](_0x1e2dcc['model'],qs['fields'](_0x20d788[_0xa308('0x34')]['fields']));_0x28b8ec[_0xa308('0x36')]=_0x28b8ec[_0xa308('0x36')][_0xa308('0x38')]?_0x28b8ec[_0xa308('0x36')]:_0x1e2dcc[_0xa308('0x31')];if(!_0x20d788[_0xa308('0x34')][_0xa308('0x39')]('nolimit')){_0x28b8ec[_0xa308('0x1d')]=qs[_0xa308('0x1d')](_0x20d788[_0xa308('0x34')]['limit']);_0x28b8ec[_0xa308('0x1c')]=qs[_0xa308('0x1c')](_0x20d788[_0xa308('0x34')][_0xa308('0x1c')]);}_0x28b8ec['order']=qs[_0xa308('0x3a')](_0x20d788['query'][_0xa308('0x3a')]);_0x28b8ec['where']=qs[_0xa308('0x35')](_[_0xa308('0x3b')](_0x20d788[_0xa308('0x34')],_0x1e2dcc[_0xa308('0x35')]),_0x52140e);if(_0x20d788[_0xa308('0x34')][_0xa308('0x3c')]){_0x28b8ec['where']=_['merge'](_0x28b8ec['where'],{'$or':_[_0xa308('0x2b')](_0x52140e,function(_0x24deed){if(_0x24deed[_0xa308('0x2f')]!==_0xa308('0x3d')){var _0x27fa32={};_0x27fa32[_0x24deed[_0xa308('0x32')]]={'$like':'%'+_0x20d788[_0xa308('0x34')][_0xa308('0x3c')]+'%'};return _0x27fa32;}})});}_0x28b8ec=_[_0xa308('0x3e')]({},_0x28b8ec,_0x20d788[_0xa308('0x3f')]);var _0x4bd936={'where':_0x28b8ec[_0xa308('0x40')]};return db[_0xa308('0x2c')][_0xa308('0x1f')](_0x4bd936)[_0xa308('0x26')](function(_0x4f308d){_0x4125df[_0xa308('0x1f')]=_0x4f308d;if(_0x20d788['query']['includeAll']){_0x28b8ec[_0xa308('0x41')]=[{'all':!![]}];}return db[_0xa308('0x2c')][_0xa308('0x42')](_0x28b8ec);})[_0xa308('0x26')](function(_0x3fe537){_0x4125df['rows']=_0x3fe537;return _0x4125df;})['then'](respondWithFilteredResult(_0x4f490f,_0x28b8ec))[_0xa308('0x43')](handleError(_0x4f490f,null));};exports[_0xa308('0x44')]=function(_0x3ebb47,_0xe71208){var _0x2a2915={'raw':![],'where':{'id':_0x3ebb47['params']['id']}},_0x3af3d8={};_0x3af3d8[_0xa308('0x31')]=_['keys'](db[_0xa308('0x2c')][_0xa308('0x2d')]);_0x3af3d8[_0xa308('0x34')]=_[_0xa308('0x33')](_0x3ebb47[_0xa308('0x34')]);_0x3af3d8['filters']=_['intersection'](_0x3af3d8['model'],_0x3af3d8[_0xa308('0x34')]);_0x2a2915[_0xa308('0x36')]=_['intersection'](_0x3af3d8[_0xa308('0x31')],qs[_0xa308('0x45')](_0x3ebb47[_0xa308('0x34')][_0xa308('0x45')]));_0x2a2915['attributes']=_0x2a2915[_0xa308('0x36')]['length']?_0x2a2915[_0xa308('0x36')]:_0x3af3d8[_0xa308('0x31')];if(_0x3ebb47[_0xa308('0x34')][_0xa308('0x46')]){_0x2a2915[_0xa308('0x41')]=[{'all':!![]}];}_0x2a2915=_['merge']({},_0x2a2915,_0x3ebb47[_0xa308('0x3f')]);return db[_0xa308('0x2c')][_0xa308('0x47')](_0x2a2915)['then'](handleEntityNotFound(_0xe71208,null))[_0xa308('0x26')](respondWithResult(_0xe71208,null))['catch'](handleError(_0xe71208,null));};exports['create']=function(_0x238db4,_0x307d5b){return db[_0xa308('0x2c')][_0xa308('0x48')](_0x238db4['body'],{})[_0xa308('0x26')](respondWithResult(_0x307d5b,0xc9))[_0xa308('0x43')](handleError(_0x307d5b,null));};exports[_0xa308('0x49')]=function(_0x46a19b,_0x413126){if(_0x46a19b[_0xa308('0x4a')]['id']){delete _0x46a19b[_0xa308('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xa308('0x47')]({'where':{'id':_0x46a19b[_0xa308('0x4b')]['id']}})[_0xa308('0x26')](handleEntityNotFound(_0x413126,null))[_0xa308('0x26')](saveUpdates(_0x46a19b[_0xa308('0x4a')],null))[_0xa308('0x26')](respondWithResult(_0x413126,null))[_0xa308('0x43')](handleError(_0x413126,null));};exports[_0xa308('0x25')]=function(_0x29040d,_0x4f3dc0){return db[_0xa308('0x2c')][_0xa308('0x47')]({'where':{'id':_0x29040d[_0xa308('0x4b')]['id']}})[_0xa308('0x26')](handleEntityNotFound(_0x4f3dc0,null))[_0xa308('0x26')](removeEntity(_0x4f3dc0,null))['catch'](handleError(_0x4f3dc0,null));};exports['getFields']=function(_0x36847b,_0x5c584e,_0x5de277){var _0x4fddbc={};var _0x5e1cdf={};var _0x3a18f7;var _0x5482ab;return db[_0xa308('0x2c')]['findOne']({'where':{'id':_0x36847b[_0xa308('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c584e,null))[_0xa308('0x26')](function(_0x105bf9){if(_0x105bf9){_0x3a18f7=_0x105bf9;_0x5e1cdf[_0xa308('0x31')]=_[_0xa308('0x33')](db[_0xa308('0x4c')][_0xa308('0x2d')]);_0x5e1cdf['query']=_[_0xa308('0x33')](_0x36847b[_0xa308('0x34')]);_0x5e1cdf[_0xa308('0x35')]=_[_0xa308('0x37')](_0x5e1cdf['model'],_0x5e1cdf[_0xa308('0x34')]);_0x4fddbc[_0xa308('0x36')]=_[_0xa308('0x37')](_0x5e1cdf['model'],qs['fields'](_0x36847b['query'][_0xa308('0x45')]));_0x4fddbc[_0xa308('0x36')]=_0x4fddbc[_0xa308('0x36')][_0xa308('0x38')]?_0x4fddbc['attributes']:_0x5e1cdf['model'];_0x4fddbc[_0xa308('0x4d')]=qs[_0xa308('0x3a')](_0x36847b[_0xa308('0x34')][_0xa308('0x3a')]);_0x4fddbc[_0xa308('0x40')]=qs[_0xa308('0x35')](_[_0xa308('0x3b')](_0x36847b['query'],_0x5e1cdf[_0xa308('0x35')]));if(_0x36847b[_0xa308('0x34')][_0xa308('0x3c')]){_0x4fddbc[_0xa308('0x40')]=_[_0xa308('0x3e')](_0x4fddbc[_0xa308('0x40')],{'$or':_['map'](_0x4fddbc[_0xa308('0x36')],function(_0x5009bc){var _0x4478c1={};_0x4478c1[_0x5009bc]={'$like':'%'+_0x36847b[_0xa308('0x34')]['filter']+'%'};return _0x4478c1;})});}_0x4fddbc=_[_0xa308('0x3e')]({},_0x4fddbc,_0x36847b[_0xa308('0x3f')]);return _0x3a18f7[_0xa308('0x4e')](_0x4fddbc);}})[_0xa308('0x26')](function(_0x31bea2){if(_0x31bea2){_0x5482ab=_0x31bea2[_0xa308('0x38')];if(!_0x36847b['query'][_0xa308('0x39')](_0xa308('0x4f'))){_0x4fddbc[_0xa308('0x1d')]=qs['limit'](_0x36847b[_0xa308('0x34')][_0xa308('0x1d')]);_0x4fddbc[_0xa308('0x1c')]=qs['offset'](_0x36847b[_0xa308('0x34')][_0xa308('0x1c')]);}return _0x3a18f7[_0xa308('0x4e')](_0x4fddbc);}})[_0xa308('0x26')](function(_0xa208fa){if(_0xa208fa){return _0xa208fa?{'count':_0x5482ab,'rows':_0xa208fa}:null;}})[_0xa308('0x26')](respondWithResult(_0x5c584e,null))[_0xa308('0x43')](handleError(_0x5c584e,null));};exports[_0xa308('0x50')]=function(_0x4fe3ac,_0x1d3816,_0x222080){var _0x566cfa={};var _0x22b1e0={};var _0x4e8c8a;var _0x17b694;return db[_0xa308('0x2c')][_0xa308('0x51')]({'where':{'id':_0x4fe3ac[_0xa308('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d3816,null))['then'](function(_0x150092){if(_0x150092){_0x4e8c8a=_0x150092;_0x22b1e0[_0xa308('0x31')]=_[_0xa308('0x33')](db['ZendeskField'][_0xa308('0x2d')]);_0x22b1e0[_0xa308('0x34')]=_[_0xa308('0x33')](_0x4fe3ac[_0xa308('0x34')]);_0x22b1e0[_0xa308('0x35')]=_['intersection'](_0x22b1e0['model'],_0x22b1e0[_0xa308('0x34')]);_0x566cfa[_0xa308('0x36')]=_[_0xa308('0x37')](_0x22b1e0[_0xa308('0x31')],qs[_0xa308('0x45')](_0x4fe3ac[_0xa308('0x34')][_0xa308('0x45')]));_0x566cfa[_0xa308('0x36')]=_0x566cfa[_0xa308('0x36')]['length']?_0x566cfa[_0xa308('0x36')]:_0x22b1e0[_0xa308('0x31')];_0x566cfa[_0xa308('0x4d')]=qs['sort'](_0x4fe3ac[_0xa308('0x34')]['sort']);_0x566cfa[_0xa308('0x40')]=qs['filters'](_['pick'](_0x4fe3ac[_0xa308('0x34')],_0x22b1e0[_0xa308('0x35')]));if(_0x4fe3ac[_0xa308('0x34')][_0xa308('0x3c')]){_0x566cfa[_0xa308('0x40')]=_['merge'](_0x566cfa[_0xa308('0x40')],{'$or':_['map'](_0x566cfa[_0xa308('0x36')],function(_0x521526){var _0xbea805={};_0xbea805[_0x521526]={'$like':'%'+_0x4fe3ac[_0xa308('0x34')][_0xa308('0x3c')]+'%'};return _0xbea805;})});}_0x566cfa=_[_0xa308('0x3e')]({},_0x566cfa,_0x4fe3ac['options']);return _0x4e8c8a[_0xa308('0x50')](_0x566cfa);}})[_0xa308('0x26')](function(_0xc0176e){if(_0xc0176e){_0x17b694=_0xc0176e[_0xa308('0x38')];if(!_0x4fe3ac[_0xa308('0x34')]['hasOwnProperty'](_0xa308('0x4f'))){_0x566cfa[_0xa308('0x1d')]=qs[_0xa308('0x1d')](_0x4fe3ac[_0xa308('0x34')]['limit']);_0x566cfa[_0xa308('0x1c')]=qs[_0xa308('0x1c')](_0x4fe3ac['query'][_0xa308('0x1c')]);}return _0x4e8c8a[_0xa308('0x50')](_0x566cfa);}})[_0xa308('0x26')](function(_0x24479c){if(_0x24479c){return _0x24479c?{'count':_0x17b694,'rows':_0x24479c}:null;}})['then'](respondWithResult(_0x1d3816,null))[_0xa308('0x43')](handleError(_0x1d3816,null));};exports[_0xa308('0x52')]=function(_0x52b130,_0x4b99e7,_0x5ef807){var _0x15c802={};var _0x44b1ab={};var _0x371b90;var _0x1cf5d4;return db['ZendeskConfiguration'][_0xa308('0x51')]({'where':{'id':_0x52b130['params']['id']}})['then'](handleEntityNotFound(_0x4b99e7,null))[_0xa308('0x26')](function(_0x24ab73){if(_0x24ab73){_0x371b90=_0x24ab73;_0x44b1ab[_0xa308('0x31')]=_[_0xa308('0x33')](db[_0xa308('0x4c')][_0xa308('0x2d')]);_0x44b1ab[_0xa308('0x34')]=_[_0xa308('0x33')](_0x52b130[_0xa308('0x34')]);_0x44b1ab[_0xa308('0x35')]=_[_0xa308('0x37')](_0x44b1ab[_0xa308('0x31')],_0x44b1ab[_0xa308('0x34')]);_0x15c802[_0xa308('0x36')]=_[_0xa308('0x37')](_0x44b1ab['model'],qs[_0xa308('0x45')](_0x52b130[_0xa308('0x34')][_0xa308('0x45')]));_0x15c802['attributes']=_0x15c802[_0xa308('0x36')]['length']?_0x15c802['attributes']:_0x44b1ab[_0xa308('0x31')];_0x15c802[_0xa308('0x4d')]=qs[_0xa308('0x3a')](_0x52b130[_0xa308('0x34')][_0xa308('0x3a')]);_0x15c802[_0xa308('0x40')]=qs[_0xa308('0x35')](_[_0xa308('0x3b')](_0x52b130[_0xa308('0x34')],_0x44b1ab[_0xa308('0x35')]));if(_0x52b130[_0xa308('0x34')][_0xa308('0x3c')]){_0x15c802[_0xa308('0x40')]=_[_0xa308('0x3e')](_0x15c802[_0xa308('0x40')],{'$or':_[_0xa308('0x2b')](_0x15c802[_0xa308('0x36')],function(_0x3e3a4a){var _0x4bbc88={};_0x4bbc88[_0x3e3a4a]={'$like':'%'+_0x52b130['query'][_0xa308('0x3c')]+'%'};return _0x4bbc88;})});}_0x15c802=_[_0xa308('0x3e')]({},_0x15c802,_0x52b130['options']);return _0x371b90['getDescriptions'](_0x15c802);}})[_0xa308('0x26')](function(_0x3053ab){if(_0x3053ab){_0x1cf5d4=_0x3053ab[_0xa308('0x38')];if(!_0x52b130[_0xa308('0x34')]['hasOwnProperty']('nolimit')){_0x15c802[_0xa308('0x1d')]=qs[_0xa308('0x1d')](_0x52b130['query']['limit']);_0x15c802[_0xa308('0x1c')]=qs['offset'](_0x52b130[_0xa308('0x34')][_0xa308('0x1c')]);}return _0x371b90['getDescriptions'](_0x15c802);}})[_0xa308('0x26')](function(_0x3556f0){if(_0x3556f0){return _0x3556f0?{'count':_0x1cf5d4,'rows':_0x3556f0}:null;}})['then'](respondWithResult(_0x4b99e7,null))[_0xa308('0x43')](handleError(_0x4b99e7,null));};exports[_0xa308('0x53')]=function(_0x4fe4cb,_0x44fdf1,_0x307b84){var _0x5a1449={};var _0xf6618={};var _0x2a2654;var _0x3dea51;return db[_0xa308('0x2c')][_0xa308('0x51')]({'where':{'id':_0x4fe4cb[_0xa308('0x4b')]['id']}})[_0xa308('0x26')](handleEntityNotFound(_0x44fdf1,null))['then'](function(_0x475326){if(_0x475326){_0x2a2654=_0x475326;_0xf6618['model']=_[_0xa308('0x33')](db[_0xa308('0x54')][_0xa308('0x2d')]);_0xf6618['query']=_['keys'](_0x4fe4cb[_0xa308('0x34')]);_0xf6618['filters']=_[_0xa308('0x37')](_0xf6618[_0xa308('0x31')],_0xf6618['query']);_0x5a1449[_0xa308('0x36')]=_[_0xa308('0x37')](_0xf6618[_0xa308('0x31')],qs[_0xa308('0x45')](_0x4fe4cb['query'][_0xa308('0x45')]));_0x5a1449['attributes']=_0x5a1449[_0xa308('0x36')][_0xa308('0x38')]?_0x5a1449[_0xa308('0x36')]:_0xf6618[_0xa308('0x31')];_0x5a1449[_0xa308('0x4d')]=qs['sort'](_0x4fe4cb['query'][_0xa308('0x3a')]);_0x5a1449[_0xa308('0x40')]=qs['filters'](_[_0xa308('0x3b')](_0x4fe4cb[_0xa308('0x34')],_0xf6618[_0xa308('0x35')]));if(_0x4fe4cb[_0xa308('0x34')][_0xa308('0x3c')]){_0x5a1449['where']=_[_0xa308('0x3e')](_0x5a1449['where'],{'$or':_['map'](_0x5a1449['attributes'],function(_0x37bb79){var _0x243f7a={};_0x243f7a[_0x37bb79]={'$like':'%'+_0x4fe4cb[_0xa308('0x34')][_0xa308('0x3c')]+'%'};return _0x243f7a;})});}_0x5a1449=_[_0xa308('0x3e')]({},_0x5a1449,_0x4fe4cb['options']);return _0x2a2654['getTags'](_0x5a1449);}})['then'](function(_0x35524f){if(_0x35524f){_0x3dea51=_0x35524f['length'];if(!_0x4fe4cb[_0xa308('0x34')][_0xa308('0x39')](_0xa308('0x4f'))){_0x5a1449['limit']=qs[_0xa308('0x1d')](_0x4fe4cb[_0xa308('0x34')][_0xa308('0x1d')]);_0x5a1449[_0xa308('0x1c')]=qs[_0xa308('0x1c')](_0x4fe4cb[_0xa308('0x34')][_0xa308('0x1c')]);}return _0x2a2654[_0xa308('0x53')](_0x5a1449);}})['then'](function(_0x15d355){if(_0x15d355){return _0x15d355?{'count':_0x3dea51,'rows':_0x15d355}:null;}})['then'](respondWithResult(_0x44fdf1,null))[_0xa308('0x43')](handleError(_0x44fdf1,null));};exports['setTags']=function(_0x250014,_0x350e12,_0x44555d){if(_0x250014[_0xa308('0x4a')]['id']){delete _0x250014[_0xa308('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xa308('0x51')]({'where':{'id':_0x250014[_0xa308('0x4b')]['id']}})[_0xa308('0x26')](handleEntityNotFound(_0x350e12,null))['then'](function(_0x3af077){if(_0x3af077){return _0x3af077[_0xa308('0x55')](_0x250014['body'][_0xa308('0x56')]||[]);}return null;})[_0xa308('0x26')](respondWithResult(_0x350e12,null))['catch'](handleError(_0x350e12,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 81aecb5..109a231 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 _0xeb3b=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api'];(function(_0x386199,_0x42c3d7){var _0x4416de=function(_0x41514d){while(--_0x41514d){_0x386199['push'](_0x386199['shift']());}};_0x4416de(++_0x42c3d7);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2d3a4d,_0x47561e){_0x2d3a4d=_0x2d3a4d-0x0;var _0x3a94a3=_0xeb3b[_0x2d3a4d];return _0x3a94a3;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var logger=require(_0xbeb3('0x2'))(_0xbeb3('0x3'));var moment=require(_0xbeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeb3('0x5'));var rimraf=require('rimraf');var config=require(_0xbeb3('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xbeb3('0x7')]=function(_0x5ae6f9,_0x8d8cce){return _0x5ae6f9[_0xbeb3('0x8')](_0xbeb3('0x9'),attributes,{'tableName':_0xbeb3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x58a3da,_0x4bb384){var _0x2612a2=function(_0x2178ab){while(--_0x2178ab){_0x58a3da['push'](_0x58a3da['shift']());}};_0x2612a2(++_0x4bb384);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 58cca0f..1f86637 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 _0x043c=['rpc','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x360488,_0x25cd23){var _0x436645=function(_0x2e8e64){while(--_0x2e8e64){_0x360488['push'](_0x360488['shift']());}};_0x436645(++_0x25cd23);}(_0x043c,0xf2));var _0xc043=function(_0xfc0976,_0x33776f){_0xfc0976=_0xfc0976-0x0;var _0x23579f=_0x043c[_0xfc0976];return _0x23579f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc043('0x0'));var rs=require(_0xc043('0x1'));var fs=require('fs');var Redis=require(_0xc043('0x2'));var db=require(_0xc043('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc043('0x4'))(_0xc043('0x5'));var config=require('../../config/environment');var jayson=require(_0xc043('0x6'));var client=jayson['client'][_0xc043('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f1063,_0x2e5311,_0xd3cccf){return new BPromise(function(_0x3836da,_0x5ced0d){return client[_0xc043('0x8')](_0x1f1063,_0xd3cccf)[_0xc043('0x9')](function(_0x33ce80){logger[_0xc043('0xa')](_0xc043('0xb'),_0x2e5311,'request\x20sent');logger[_0xc043('0xc')](_0xc043('0xd'),_0x2e5311,'request\x20sent',JSON[_0xc043('0xe')](_0x33ce80));if(_0x33ce80[_0xc043('0xf')]){if(_0x33ce80[_0xc043('0xf')][_0xc043('0x10')]===0x1f4){logger[_0xc043('0xf')](_0xc043('0xb'),_0x2e5311,_0x33ce80[_0xc043('0xf')][_0xc043('0x11')]);return _0x5ced0d(_0x33ce80['error'][_0xc043('0x11')]);}logger[_0xc043('0xf')](_0xc043('0xb'),_0x2e5311,_0x33ce80[_0xc043('0xf')][_0xc043('0x11')]);return _0x3836da(_0x33ce80[_0xc043('0xf')]['message']);}else{logger['info'](_0xc043('0xb'),_0x2e5311,'request\x20sent');_0x3836da(_0x33ce80['result']['message']);}})[_0xc043('0x12')](function(_0x52f863){logger['error'](_0xc043('0xb'),_0x2e5311,_0x52f863);_0x5ced0d(_0x52f863);});});} \ No newline at end of file +var _0xf392=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0xf392,0xe0));var _0x2f39=function(_0xc7f01,_0xe3bd03){_0xc7f01=_0xc7f01-0x0;var _0x32b22f=_0xf392[_0xc7f01];return _0x32b22f;};'use strict';var _=require(_0x2f39('0x0'));var util=require(_0x2f39('0x1'));var moment=require(_0x2f39('0x2'));var BPromise=require(_0x2f39('0x3'));var rs=require(_0x2f39('0x4'));var fs=require('fs');var Redis=require(_0x2f39('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f39('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2f39('0x7'));var jayson=require(_0x2f39('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f7adf,_0x508d2a,_0x15e159){return new BPromise(function(_0x279267,_0x163929){return client[_0x2f39('0x9')](_0x1f7adf,_0x15e159)['then'](function(_0x5c6e7){logger[_0x2f39('0xa')](_0x2f39('0xb'),_0x508d2a,_0x2f39('0xc'));logger['debug'](_0x2f39('0xd'),_0x508d2a,_0x2f39('0xc'),JSON['stringify'](_0x5c6e7));if(_0x5c6e7['error']){if(_0x5c6e7[_0x2f39('0xe')][_0x2f39('0xf')]===0x1f4){logger['error'](_0x2f39('0xb'),_0x508d2a,_0x5c6e7[_0x2f39('0xe')][_0x2f39('0x10')]);return _0x163929(_0x5c6e7['error'][_0x2f39('0x10')]);}logger['error'](_0x2f39('0xb'),_0x508d2a,_0x5c6e7['error'][_0x2f39('0x10')]);return _0x279267(_0x5c6e7[_0x2f39('0xe')][_0x2f39('0x10')]);}else{logger[_0x2f39('0xa')](_0x2f39('0xb'),_0x508d2a,_0x2f39('0xc'));_0x279267(_0x5c6e7[_0x2f39('0x11')]['message']);}})[_0x2f39('0x12')](function(_0x94624b){logger[_0x2f39('0xe')](_0x2f39('0xb'),_0x508d2a,_0x94624b);_0x163929(_0x94624b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1814b2b..a284479 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 _0x34f1=['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','exports','multer','path'];(function(_0x5901db,_0x10b4af){var _0x508d64=function(_0x3d5694){while(--_0x3d5694){_0x5901db['push'](_0x5901db['shift']());}};_0x508d64(++_0x10b4af);}(_0x34f1,0x139));var _0x134f=function(_0x1c89a3,_0x7867f3){_0x1c89a3=_0x1c89a3-0x0;var _0x50140a=_0x34f1[_0x1c89a3];return _0x50140a;};'use strict';var multer=require(_0x134f('0x0'));var util=require('util');var path=require(_0x134f('0x1'));var timeout=require('connect-timeout');var express=require(_0x134f('0x2'));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(_0x134f('0x8'));router[_0x134f('0x9')]('/',auth[_0x134f('0xa')](),controller[_0x134f('0xb')]);router['get'](_0x134f('0xc'),auth[_0x134f('0xa')](),controller[_0x134f('0xd')]);router[_0x134f('0xe')]('/',auth[_0x134f('0xa')](),controller[_0x134f('0xf')]);router[_0x134f('0x10')](_0x134f('0xc'),auth['isAuthenticated'](),controller[_0x134f('0x11')]);router[_0x134f('0x12')](_0x134f('0xc'),auth[_0x134f('0xa')](),controller[_0x134f('0x13')]);module[_0x134f('0x14')]=router; \ No newline at end of file +var _0x75be=['get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller'];(function(_0xc0cf6d,_0x5e1b19){var _0xeb7bf2=function(_0x59c6dc){while(--_0x59c6dc){_0xc0cf6d['push'](_0xc0cf6d['shift']());}};_0xeb7bf2(++_0x5e1b19);}(_0x75be,0x15e));var _0xe75b=function(_0x3f2cbd,_0x26a36e){_0x3f2cbd=_0x3f2cbd-0x0;var _0xef597b=_0x75be[_0x3f2cbd];return _0xef597b;};'use strict';var multer=require(_0xe75b('0x0'));var util=require(_0xe75b('0x1'));var path=require(_0xe75b('0x2'));var timeout=require(_0xe75b('0x3'));var express=require(_0xe75b('0x4'));var router=express[_0xe75b('0x5')]();var fs_extra=require(_0xe75b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe75b('0x7'));var config=require(_0xe75b('0x8'));var controller=require(_0xe75b('0x9'));router[_0xe75b('0xa')]('/',auth[_0xe75b('0xb')](),controller[_0xe75b('0xc')]);router['get'](_0xe75b('0xd'),auth['isAuthenticated'](),controller[_0xe75b('0xe')]);router[_0xe75b('0xf')]('/',auth[_0xe75b('0xb')](),controller[_0xe75b('0x10')]);router[_0xe75b('0x11')](_0xe75b('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe75b('0xd'),auth['isAuthenticated'](),controller[_0xe75b('0x12')]);module[_0xe75b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9b2f689..cf640ef 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 _0x5e2f=['exports','ENUM','customVariable','keyValue','picklist','STRING','string','BOOLEAN','sequelize'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5e2f,0x182));var _0xf5e2=function(_0x5e101c,_0x22b01f){_0x5e101c=_0x5e101c-0x0;var _0x456d97=_0x5e2f[_0x5e101c];return _0x456d97;};'use strict';var Sequelize=require(_0xf5e2('0x0'));module[_0xf5e2('0x1')]={'type':{'type':Sequelize[_0xf5e2('0x2')]('string','variable',_0xf5e2('0x3'),_0xf5e2('0x4'),_0xf5e2('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf5e2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf5e2('0x2')](_0xf5e2('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf5e2('0x6')]},'customField':{'type':Sequelize[_0xf5e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf5e2('0x6')]}}; \ No newline at end of file +var _0x6402=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x36a521,_0x3c4a33){var _0x380f4b=function(_0x1e84bc){while(--_0x1e84bc){_0x36a521['push'](_0x36a521['shift']());}};_0x380f4b(++_0x3c4a33);}(_0x6402,0x10f));var _0x2640=function(_0x2de114,_0xc8e415){_0x2de114=_0x2de114-0x0;var _0x467c98=_0x6402[_0x2de114];return _0x467c98;};'use strict';var Sequelize=require(_0x2640('0x0'));module[_0x2640('0x1')]={'type':{'type':Sequelize[_0x2640('0x2')]('string',_0x2640('0x3'),_0x2640('0x4'),_0x2640('0x5'),_0x2640('0x6')),'defaultValue':_0x2640('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2640('0x8')]},'keyType':{'type':Sequelize[_0x2640('0x2')](_0x2640('0x7'),_0x2640('0x3'),_0x2640('0x4'))},'keyContent':{'type':Sequelize[_0x2640('0x8')]},'idField':{'type':Sequelize[_0x2640('0x8')]},'nameField':{'type':Sequelize[_0x2640('0x8')]},'customField':{'type':Sequelize[_0x2640('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 497d9c2..6bb4501 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 _0x4e8b=['map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index'];(function(_0x2d8cb3,_0x1b86f8){var _0x25536c=function(_0x43f577){while(--_0x43f577){_0x2d8cb3['push'](_0x2d8cb3['shift']());}};_0x25536c(++_0x1b86f8);}(_0x4e8b,0xb8));var _0xb4e8=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x4e8b[_0x3b90ab];return _0x206e92;};'use strict';var emlformat=require(_0xb4e8('0x0'));var rimraf=require(_0xb4e8('0x1'));var zipdir=require(_0xb4e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4e8('0x3'));var moment=require('moment');var BPromise=require(_0xb4e8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb4e8('0x5'));var sox=require(_0xb4e8('0x6'));var csv=require(_0xb4e8('0x7'));var ejs=require(_0xb4e8('0x8'));var fs=require('fs');var fs_extra=require(_0xb4e8('0x9'));var _=require(_0xb4e8('0xa'));var squel=require(_0xb4e8('0xb'));var crypto=require(_0xb4e8('0xc'));var jsforce=require(_0xb4e8('0xd'));var deskjs=require(_0xb4e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb4e8('0xf'));var Papa=require(_0xb4e8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb4e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4e8('0x12'));var logger=require(_0xb4e8('0x13'))('api');var utils=require(_0xb4e8('0x14'));var config=require(_0xb4e8('0x15'));var licenseUtil=require(_0xb4e8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab1e7,_0x4cd78c){_0x4cd78c=_0x4cd78c||0xcc;return function(_0x484524){if(_0x484524){return _0x5ab1e7[_0xb4e8('0x17')](_0x4cd78c);}return _0x5ab1e7[_0xb4e8('0x18')](_0x4cd78c)[_0xb4e8('0x19')]();};}function respondWithResult(_0x241851,_0x33b367){_0x33b367=_0x33b367||0xc8;return function(_0x24efa5){if(_0x24efa5){return _0x241851[_0xb4e8('0x18')](_0x33b367)[_0xb4e8('0x1a')](_0x24efa5);}};}function respondWithFilteredResult(_0x40d858,_0x1d7c6b){return function(_0x40ec74){if(_0x40ec74){var _0x5beb86=typeof _0x1d7c6b['offset']==='undefined'&&typeof _0x1d7c6b['limit']===_0xb4e8('0x1b');var _0x163906=_0x40ec74['count'];var _0x29fa1e=_0x5beb86?0x0:_0x1d7c6b['offset'];var _0x1ed68d=_0x5beb86?_0x40ec74[_0xb4e8('0x1c')]:_0x1d7c6b[_0xb4e8('0x1d')]+_0x1d7c6b[_0xb4e8('0x1e')];var _0x54fc6f;if(_0x1ed68d>=_0x163906){_0x1ed68d=_0x163906;_0x54fc6f=0xc8;}else{_0x54fc6f=0xce;}_0x40d858[_0xb4e8('0x18')](_0x54fc6f);return _0x40d858[_0xb4e8('0x1f')](_0xb4e8('0x20'),_0x29fa1e+'-'+_0x1ed68d+'/'+_0x163906)['json'](_0x40ec74);}return null;};}function patchUpdates(_0x471a1f){return function(_0x308401){try{jsonpatch[_0xb4e8('0x21')](_0x308401,_0x471a1f,!![]);}catch(_0x55517e){return BPromise[_0xb4e8('0x22')](_0x55517e);}return _0x308401['save']();};}function saveUpdates(_0x4aa464,_0x3d5ec5){return function(_0x2019b2){if(_0x2019b2){return _0x2019b2[_0xb4e8('0x23')](_0x4aa464)['then'](function(_0x42f81d){return _0x42f81d;});}return null;};}function removeEntity(_0x154011,_0x30340c){return function(_0x19e8fa){if(_0x19e8fa){return _0x19e8fa[_0xb4e8('0x24')]()['then'](function(){_0x154011['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7bf6,_0x5f4136){return function(_0x28c274){if(!_0x28c274){_0x1f7bf6['sendStatus'](0x194);}return _0x28c274;};}function handleError(_0x3778b7,_0x3791dc){_0x3791dc=_0x3791dc||0x1f4;return function(_0x4d0c48){logger['error'](_0x4d0c48[_0xb4e8('0x25')]);if(_0x4d0c48['name']){delete _0x4d0c48[_0xb4e8('0x26')];}_0x3778b7[_0xb4e8('0x18')](_0x3791dc)[_0xb4e8('0x27')](_0x4d0c48);};}exports[_0xb4e8('0x28')]=function(_0x15f225,_0x634a01){var _0x1b8e80={},_0x3ad969={},_0x505567={'count':0x0,'rows':[]};var _0x4ecc62=_[_0xb4e8('0x29')](db[_0xb4e8('0x2a')][_0xb4e8('0x2b')],function(_0x4c9d88){return{'name':_0x4c9d88[_0xb4e8('0x2c')],'type':_0x4c9d88[_0xb4e8('0x2d')][_0xb4e8('0x2e')]};});_0x3ad969[_0xb4e8('0x2f')]=_[_0xb4e8('0x29')](_0x4ecc62,_0xb4e8('0x26'));_0x3ad969[_0xb4e8('0x30')]=_[_0xb4e8('0x31')](_0x15f225['query']);_0x3ad969[_0xb4e8('0x32')]=_[_0xb4e8('0x33')](_0x3ad969[_0xb4e8('0x2f')],_0x3ad969[_0xb4e8('0x30')]);_0x1b8e80[_0xb4e8('0x34')]=_[_0xb4e8('0x33')](_0x3ad969['model'],qs['fields'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x35')]));_0x1b8e80[_0xb4e8('0x34')]=_0x1b8e80[_0xb4e8('0x34')]['length']?_0x1b8e80['attributes']:_0x3ad969[_0xb4e8('0x2f')];if(!_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x36')](_0xb4e8('0x37'))){_0x1b8e80['limit']=qs[_0xb4e8('0x1e')](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x1e')]);_0x1b8e80[_0xb4e8('0x1d')]=qs['offset'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x1d')]);}_0x1b8e80[_0xb4e8('0x38')]=qs['sort'](_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x39')]);_0x1b8e80[_0xb4e8('0x3a')]=qs[_0xb4e8('0x32')](_[_0xb4e8('0x3b')](_0x15f225['query'],_0x3ad969[_0xb4e8('0x32')]),_0x4ecc62);if(_0x15f225['query'][_0xb4e8('0x3c')]){_0x1b8e80[_0xb4e8('0x3a')]=_[_0xb4e8('0x3d')](_0x1b8e80[_0xb4e8('0x3a')],{'$or':_['map'](_0x4ecc62,function(_0x5d351d){if(_0x5d351d[_0xb4e8('0x2d')]!==_0xb4e8('0x3e')){var _0x5a5215={};_0x5a5215[_0x5d351d[_0xb4e8('0x26')]]={'$like':'%'+_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x3c')]+'%'};return _0x5a5215;}})});}_0x1b8e80=_[_0xb4e8('0x3d')]({},_0x1b8e80,_0x15f225['options']);var _0x1ce5dc={'where':_0x1b8e80[_0xb4e8('0x3a')]};return db[_0xb4e8('0x2a')][_0xb4e8('0x1c')](_0x1ce5dc)[_0xb4e8('0x3f')](function(_0x2b2cec){_0x505567['count']=_0x2b2cec;if(_0x15f225[_0xb4e8('0x30')][_0xb4e8('0x40')]){_0x1b8e80['include']=[{'all':!![]}];}return db[_0xb4e8('0x2a')][_0xb4e8('0x41')](_0x1b8e80);})[_0xb4e8('0x3f')](function(_0x107ebb){_0x505567[_0xb4e8('0x42')]=_0x107ebb;return _0x505567;})['then'](respondWithFilteredResult(_0x634a01,_0x1b8e80))[_0xb4e8('0x43')](handleError(_0x634a01,null));};exports[_0xb4e8('0x44')]=function(_0x38fef8,_0x2b965f){var _0x529ae0={'raw':!![],'where':{'id':_0x38fef8[_0xb4e8('0x45')]['id']}},_0x465ca5={};_0x465ca5[_0xb4e8('0x2f')]=_['keys'](db[_0xb4e8('0x2a')][_0xb4e8('0x2b')]);_0x465ca5[_0xb4e8('0x30')]=_['keys'](_0x38fef8['query']);_0x465ca5[_0xb4e8('0x32')]=_[_0xb4e8('0x33')](_0x465ca5['model'],_0x465ca5[_0xb4e8('0x30')]);_0x529ae0[_0xb4e8('0x34')]=_['intersection'](_0x465ca5[_0xb4e8('0x2f')],qs[_0xb4e8('0x35')](_0x38fef8[_0xb4e8('0x30')]['fields']));_0x529ae0['attributes']=_0x529ae0['attributes'][_0xb4e8('0x46')]?_0x529ae0[_0xb4e8('0x34')]:_0x465ca5['model'];if(_0x38fef8[_0xb4e8('0x30')]['includeAll']){_0x529ae0['include']=[{'all':!![]}];}_0x529ae0=_['merge']({},_0x529ae0,_0x38fef8[_0xb4e8('0x47')]);return db['ZendeskField'][_0xb4e8('0x48')](_0x529ae0)['then'](handleEntityNotFound(_0x2b965f,null))['then'](respondWithResult(_0x2b965f,null))[_0xb4e8('0x43')](handleError(_0x2b965f,null));};exports['create']=function(_0x1a5bd6,_0x411348){return db[_0xb4e8('0x2a')][_0xb4e8('0x49')](_0x1a5bd6[_0xb4e8('0x4a')],{})[_0xb4e8('0x3f')](respondWithResult(_0x411348,0xc9))[_0xb4e8('0x43')](handleError(_0x411348,null));};exports['update']=function(_0x2bf323,_0x7ff42b){if(_0x2bf323[_0xb4e8('0x4a')]['id']){delete _0x2bf323[_0xb4e8('0x4a')]['id'];}return db['ZendeskField'][_0xb4e8('0x48')]({'where':{'id':_0x2bf323[_0xb4e8('0x45')]['id']}})[_0xb4e8('0x3f')](handleEntityNotFound(_0x7ff42b,null))[_0xb4e8('0x3f')](saveUpdates(_0x2bf323[_0xb4e8('0x4a')],null))[_0xb4e8('0x3f')](respondWithResult(_0x7ff42b,null))[_0xb4e8('0x43')](handleError(_0x7ff42b,null));};exports[_0xb4e8('0x24')]=function(_0x229c2d,_0x2d6290){return db[_0xb4e8('0x2a')][_0xb4e8('0x48')]({'where':{'id':_0x229c2d[_0xb4e8('0x45')]['id']}})[_0xb4e8('0x3f')](handleEntityNotFound(_0x2d6290,null))['then'](removeEntity(_0x2d6290,null))[_0xb4e8('0x43')](handleError(_0x2d6290,null));}; \ No newline at end of file +var _0xba30=['includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','then','sendStatus','error','stack','name','map','ZendeskField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x1443c4,_0x291ebe){var _0x493131=function(_0x458d91){while(--_0x458d91){_0x1443c4['push'](_0x1443c4['shift']());}};_0x493131(++_0x291ebe);}(_0xba30,0xf0));var _0x0ba3=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xba30[_0x58175c];return _0x55b88f;};'use strict';var emlformat=require(_0x0ba3('0x0'));var rimraf=require(_0x0ba3('0x1'));var zipdir=require(_0x0ba3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ba3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0ba3('0x4'));var util=require(_0x0ba3('0x5'));var path=require('path');var sox=require(_0x0ba3('0x6'));var csv=require(_0x0ba3('0x7'));var ejs=require(_0x0ba3('0x8'));var fs=require('fs');var fs_extra=require(_0x0ba3('0x9'));var _=require(_0x0ba3('0xa'));var squel=require(_0x0ba3('0xb'));var crypto=require(_0x0ba3('0xc'));var jsforce=require(_0x0ba3('0xd'));var deskjs=require(_0x0ba3('0xe'));var toCsv=require(_0x0ba3('0x7'));var querystring=require(_0x0ba3('0xf'));var Papa=require(_0x0ba3('0x10'));var Redis=require(_0x0ba3('0x11'));var authService=require(_0x0ba3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0ba3('0x13'));var hardwareService=require(_0x0ba3('0x14'));var logger=require(_0x0ba3('0x15'))(_0x0ba3('0x16'));var utils=require(_0x0ba3('0x17'));var config=require(_0x0ba3('0x18'));var licenseUtil=require(_0x0ba3('0x19'));var db=require(_0x0ba3('0x1a'))['db'];function respondWithStatusCode(_0xad75f4,_0x1ec211){_0x1ec211=_0x1ec211||0xcc;return function(_0x177470){if(_0x177470){return _0xad75f4['sendStatus'](_0x1ec211);}return _0xad75f4[_0x0ba3('0x1b')](_0x1ec211)[_0x0ba3('0x1c')]();};}function respondWithResult(_0xcfe51b,_0x55b17c){_0x55b17c=_0x55b17c||0xc8;return function(_0x7a333f){if(_0x7a333f){return _0xcfe51b[_0x0ba3('0x1b')](_0x55b17c)[_0x0ba3('0x1d')](_0x7a333f);}};}function respondWithFilteredResult(_0x25a224,_0x24cfcf){return function(_0x9295dc){if(_0x9295dc){var _0x2add8e=typeof _0x24cfcf[_0x0ba3('0x1e')]===_0x0ba3('0x1f')&&typeof _0x24cfcf[_0x0ba3('0x20')]===_0x0ba3('0x1f');var _0x4910d5=_0x9295dc[_0x0ba3('0x21')];var _0x4f8dff=_0x2add8e?0x0:_0x24cfcf[_0x0ba3('0x1e')];var _0x13c515=_0x2add8e?_0x9295dc[_0x0ba3('0x21')]:_0x24cfcf['offset']+_0x24cfcf['limit'];var _0x3fe514;if(_0x13c515>=_0x4910d5){_0x13c515=_0x4910d5;_0x3fe514=0xc8;}else{_0x3fe514=0xce;}_0x25a224[_0x0ba3('0x1b')](_0x3fe514);return _0x25a224[_0x0ba3('0x22')]('Content-Range',_0x4f8dff+'-'+_0x13c515+'/'+_0x4910d5)[_0x0ba3('0x1d')](_0x9295dc);}return null;};}function patchUpdates(_0x2a2315){return function(_0x15913e){try{jsonpatch[_0x0ba3('0x23')](_0x15913e,_0x2a2315,!![]);}catch(_0x43868a){return BPromise['reject'](_0x43868a);}return _0x15913e[_0x0ba3('0x24')]();};}function saveUpdates(_0x18c425,_0xeb2208){return function(_0x3cc9b4){if(_0x3cc9b4){return _0x3cc9b4['update'](_0x18c425)[_0x0ba3('0x25')](function(_0x323c40){return _0x323c40;});}return null;};}function removeEntity(_0x261a43,_0x3b133b){return function(_0x2e64ff){if(_0x2e64ff){return _0x2e64ff['destroy']()[_0x0ba3('0x25')](function(){_0x261a43[_0x0ba3('0x1b')](0xcc)[_0x0ba3('0x1c')]();});}};}function handleEntityNotFound(_0x4ce335,_0xdeff0b){return function(_0x59754d){if(!_0x59754d){_0x4ce335[_0x0ba3('0x26')](0x194);}return _0x59754d;};}function handleError(_0x42865d,_0x5669e5){_0x5669e5=_0x5669e5||0x1f4;return function(_0x345354){logger[_0x0ba3('0x27')](_0x345354[_0x0ba3('0x28')]);if(_0x345354[_0x0ba3('0x29')]){delete _0x345354[_0x0ba3('0x29')];}_0x42865d[_0x0ba3('0x1b')](_0x5669e5)['send'](_0x345354);};}exports['index']=function(_0xbded04,_0x4cdb55){var _0x1bddf3={},_0xd60db={},_0x5eb53c={'count':0x0,'rows':[]};var _0x4dbbbe=_[_0x0ba3('0x2a')](db[_0x0ba3('0x2b')][_0x0ba3('0x2c')],function(_0x523bb0){return{'name':_0x523bb0[_0x0ba3('0x2d')],'type':_0x523bb0[_0x0ba3('0x2e')]['key']};});_0xd60db[_0x0ba3('0x2f')]=_[_0x0ba3('0x2a')](_0x4dbbbe,_0x0ba3('0x29'));_0xd60db[_0x0ba3('0x30')]=_[_0x0ba3('0x31')](_0xbded04[_0x0ba3('0x30')]);_0xd60db[_0x0ba3('0x32')]=_['intersection'](_0xd60db[_0x0ba3('0x2f')],_0xd60db[_0x0ba3('0x30')]);_0x1bddf3[_0x0ba3('0x33')]=_[_0x0ba3('0x34')](_0xd60db[_0x0ba3('0x2f')],qs[_0x0ba3('0x35')](_0xbded04[_0x0ba3('0x30')]['fields']));_0x1bddf3[_0x0ba3('0x33')]=_0x1bddf3[_0x0ba3('0x33')][_0x0ba3('0x36')]?_0x1bddf3[_0x0ba3('0x33')]:_0xd60db['model'];if(!_0xbded04[_0x0ba3('0x30')][_0x0ba3('0x37')](_0x0ba3('0x38'))){_0x1bddf3['limit']=qs[_0x0ba3('0x20')](_0xbded04[_0x0ba3('0x30')][_0x0ba3('0x20')]);_0x1bddf3[_0x0ba3('0x1e')]=qs['offset'](_0xbded04[_0x0ba3('0x30')]['offset']);}_0x1bddf3[_0x0ba3('0x39')]=qs[_0x0ba3('0x3a')](_0xbded04[_0x0ba3('0x30')][_0x0ba3('0x3a')]);_0x1bddf3['where']=qs[_0x0ba3('0x32')](_[_0x0ba3('0x3b')](_0xbded04[_0x0ba3('0x30')],_0xd60db[_0x0ba3('0x32')]),_0x4dbbbe);if(_0xbded04[_0x0ba3('0x30')][_0x0ba3('0x3c')]){_0x1bddf3[_0x0ba3('0x3d')]=_[_0x0ba3('0x3e')](_0x1bddf3['where'],{'$or':_['map'](_0x4dbbbe,function(_0x3616ab){if(_0x3616ab[_0x0ba3('0x2e')]!=='VIRTUAL'){var _0x37b538={};_0x37b538[_0x3616ab[_0x0ba3('0x29')]]={'$like':'%'+_0xbded04[_0x0ba3('0x30')]['filter']+'%'};return _0x37b538;}})});}_0x1bddf3=_[_0x0ba3('0x3e')]({},_0x1bddf3,_0xbded04[_0x0ba3('0x3f')]);var _0x4fc13a={'where':_0x1bddf3[_0x0ba3('0x3d')]};return db[_0x0ba3('0x2b')]['count'](_0x4fc13a)['then'](function(_0x37083d){_0x5eb53c[_0x0ba3('0x21')]=_0x37083d;if(_0xbded04[_0x0ba3('0x30')][_0x0ba3('0x40')]){_0x1bddf3[_0x0ba3('0x41')]=[{'all':!![]}];}return db['ZendeskField'][_0x0ba3('0x42')](_0x1bddf3);})[_0x0ba3('0x25')](function(_0x29a4d6){_0x5eb53c[_0x0ba3('0x43')]=_0x29a4d6;return _0x5eb53c;})[_0x0ba3('0x25')](respondWithFilteredResult(_0x4cdb55,_0x1bddf3))[_0x0ba3('0x44')](handleError(_0x4cdb55,null));};exports[_0x0ba3('0x45')]=function(_0x41a03e,_0x272df8){var _0x32a5f0={'raw':!![],'where':{'id':_0x41a03e[_0x0ba3('0x46')]['id']}},_0x3486f4={};_0x3486f4[_0x0ba3('0x2f')]=_[_0x0ba3('0x31')](db['ZendeskField'][_0x0ba3('0x2c')]);_0x3486f4[_0x0ba3('0x30')]=_[_0x0ba3('0x31')](_0x41a03e[_0x0ba3('0x30')]);_0x3486f4[_0x0ba3('0x32')]=_['intersection'](_0x3486f4[_0x0ba3('0x2f')],_0x3486f4[_0x0ba3('0x30')]);_0x32a5f0['attributes']=_[_0x0ba3('0x34')](_0x3486f4['model'],qs[_0x0ba3('0x35')](_0x41a03e[_0x0ba3('0x30')][_0x0ba3('0x35')]));_0x32a5f0[_0x0ba3('0x33')]=_0x32a5f0['attributes']['length']?_0x32a5f0[_0x0ba3('0x33')]:_0x3486f4[_0x0ba3('0x2f')];if(_0x41a03e[_0x0ba3('0x30')]['includeAll']){_0x32a5f0[_0x0ba3('0x41')]=[{'all':!![]}];}_0x32a5f0=_[_0x0ba3('0x3e')]({},_0x32a5f0,_0x41a03e[_0x0ba3('0x3f')]);return db[_0x0ba3('0x2b')][_0x0ba3('0x47')](_0x32a5f0)[_0x0ba3('0x25')](handleEntityNotFound(_0x272df8,null))[_0x0ba3('0x25')](respondWithResult(_0x272df8,null))[_0x0ba3('0x44')](handleError(_0x272df8,null));};exports[_0x0ba3('0x48')]=function(_0x5d9f60,_0x5aa86b){return db[_0x0ba3('0x2b')][_0x0ba3('0x48')](_0x5d9f60[_0x0ba3('0x49')],{})[_0x0ba3('0x25')](respondWithResult(_0x5aa86b,0xc9))['catch'](handleError(_0x5aa86b,null));};exports[_0x0ba3('0x4a')]=function(_0x541af3,_0x4c0c0e){if(_0x541af3[_0x0ba3('0x49')]['id']){delete _0x541af3[_0x0ba3('0x49')]['id'];}return db[_0x0ba3('0x2b')][_0x0ba3('0x47')]({'where':{'id':_0x541af3[_0x0ba3('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c0c0e,null))[_0x0ba3('0x25')](saveUpdates(_0x541af3[_0x0ba3('0x49')],null))['then'](respondWithResult(_0x4c0c0e,null))['catch'](handleError(_0x4c0c0e,null));};exports[_0x0ba3('0x4b')]=function(_0x1935f7,_0x2d625a){return db[_0x0ba3('0x2b')][_0x0ba3('0x47')]({'where':{'id':_0x1935f7[_0x0ba3('0x46')]['id']}})[_0x0ba3('0x25')](handleEntityNotFound(_0x2d625a,null))['then'](removeEntity(_0x2d625a,null))[_0x0ba3('0x44')](handleError(_0x2d625a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d703b48..d37d588 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 _0xa8c7=['request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','lodash','util','../../config/logger','api','moment'];(function(_0x11183c,_0x3c6d41){var _0x365319=function(_0x3c2d08){while(--_0x3c2d08){_0x11183c['push'](_0x11183c['shift']());}};_0x365319(++_0x3c6d41);}(_0xa8c7,0x1e9));var _0x7a8c=function(_0x3afe14,_0xd30ca7){_0x3afe14=_0x3afe14-0x0;var _0x18bb93=_0xa8c7[_0x3afe14];return _0x18bb93;};'use strict';var _=require(_0x7a8c('0x0'));var util=require(_0x7a8c('0x1'));var logger=require(_0x7a8c('0x2'))(_0x7a8c('0x3'));var moment=require(_0x7a8c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a8c('0x5'));var fs=require('fs');var path=require(_0x7a8c('0x6'));var rimraf=require(_0x7a8c('0x7'));var config=require(_0x7a8c('0x8'));var attributes=require(_0x7a8c('0x9'));module[_0x7a8c('0xa')]=function(_0x45cac1,_0x364129){return _0x45cac1[_0x7a8c('0xb')](_0x7a8c('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7afb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','idField','lodash','util'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x7afb,0x7c));var _0xb7af=function(_0x4aa68b,_0x4ebaf3){_0x4aa68b=_0x4aa68b-0x0;var _0x5a6487=_0x7afb[_0x4aa68b];return _0x5a6487;};'use strict';var _=require(_0xb7af('0x0'));var util=require(_0xb7af('0x1'));var logger=require(_0xb7af('0x2'))(_0xb7af('0x3'));var moment=require(_0xb7af('0x4'));var BPromise=require(_0xb7af('0x5'));var rp=require(_0xb7af('0x6'));var fs=require('fs');var path=require(_0xb7af('0x7'));var rimraf=require(_0xb7af('0x8'));var config=require(_0xb7af('0x9'));var attributes=require(_0xb7af('0xa'));module['exports']=function(_0x2830e4,_0x5f5df6){return _0x2830e4['define'](_0xb7af('0xb'),attributes,{'tableName':_0xb7af('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb7af('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index bdbf421..3e539c0 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 _0x7334=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7334,0x135));var _0x4733=function(_0x43d097,_0x104d6a){_0x43d097=_0x43d097-0x0;var _0x5c0a2d=_0x7334[_0x43d097];return _0x5c0a2d;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require(_0x4733('0x3'));var rs=require(_0x4733('0x4'));var fs=require('fs');var Redis=require(_0x4733('0x5'));var db=require(_0x4733('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4733('0x7'))(_0x4733('0x8'));var config=require(_0x4733('0x9'));var jayson=require(_0x4733('0xa'));var client=jayson['client'][_0x4733('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48a0b2,_0xca0086,_0x4017d3){return new BPromise(function(_0x4f2fa6,_0x50109d){return client['request'](_0x48a0b2,_0x4017d3)[_0x4733('0xc')](function(_0x33f144){logger[_0x4733('0xd')](_0x4733('0xe'),_0xca0086,_0x4733('0xf'));logger[_0x4733('0x10')](_0x4733('0x11'),_0xca0086,_0x4733('0xf'),JSON['stringify'](_0x33f144));if(_0x33f144[_0x4733('0x12')]){if(_0x33f144['error'][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0xca0086,_0x33f144[_0x4733('0x12')][_0x4733('0x14')]);return _0x50109d(_0x33f144[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('ZendeskField,\x20%s,\x20%s',_0xca0086,_0x33f144[_0x4733('0x12')]['message']);return _0x4f2fa6(_0x33f144[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0xca0086,_0x4733('0xf'));_0x4f2fa6(_0x33f144[_0x4733('0x15')][_0x4733('0x14')]);}})[_0x4733('0x16')](function(_0xc3a582){logger['error'](_0x4733('0xe'),_0xca0086,_0xc3a582);_0x50109d(_0xc3a582);});});} \ No newline at end of file +var _0x6395=['then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x6395,0x113));var _0x5639=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6395[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5639('0x0'));var util=require(_0x5639('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5639('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5639('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5639('0x4'))(_0x5639('0x5'));var config=require(_0x5639('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5639('0x7')][_0x5639('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bf057,_0x168566,_0x39c480){return new BPromise(function(_0x316350,_0x4a4268){return client[_0x5639('0x9')](_0x5bf057,_0x39c480)[_0x5639('0xa')](function(_0x4c6faa){logger[_0x5639('0xb')](_0x5639('0xc'),_0x168566,'request\x20sent');logger[_0x5639('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x168566,_0x5639('0xe'),JSON[_0x5639('0xf')](_0x4c6faa));if(_0x4c6faa['error']){if(_0x4c6faa['error']['code']===0x1f4){logger[_0x5639('0x10')](_0x5639('0xc'),_0x168566,_0x4c6faa[_0x5639('0x10')][_0x5639('0x11')]);return _0x4a4268(_0x4c6faa[_0x5639('0x10')][_0x5639('0x11')]);}logger[_0x5639('0x10')](_0x5639('0xc'),_0x168566,_0x4c6faa[_0x5639('0x10')][_0x5639('0x11')]);return _0x316350(_0x4c6faa[_0x5639('0x10')][_0x5639('0x11')]);}else{logger[_0x5639('0xb')](_0x5639('0xc'),_0x168566,_0x5639('0xe'));_0x316350(_0x4c6faa['result'][_0x5639('0x11')]);}})[_0x5639('0x12')](function(_0x7ebd59){logger[_0x5639('0x10')](_0x5639('0xc'),_0x168566,_0x7ebd59);_0x4a4268(_0x7ebd59);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6b85c0f..3762844 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 _0x5ae4=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x305b4c,_0x20f176){var _0x301bee=function(_0x1c8987){while(--_0x1c8987){_0x305b4c['push'](_0x305b4c['shift']());}};_0x301bee(++_0x20f176);}(_0x5ae4,0x72));var _0x45ae=function(_0x150747,_0x6e849b){_0x150747=_0x150747-0x0;var _0x654974=_0x5ae4[_0x150747];return _0x654974;};'use strict';var multer=require('multer');var util=require(_0x45ae('0x0'));var path=require(_0x45ae('0x1'));var timeout=require(_0x45ae('0x2'));var express=require('express');var router=express[_0x45ae('0x3')]();var fs_extra=require(_0x45ae('0x4'));var auth=require(_0x45ae('0x5'));var interaction=require(_0x45ae('0x6'));var config=require(_0x45ae('0x7'));var controller=require(_0x45ae('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x45ae('0x9')]);router['get'](_0x45ae('0xa'),auth[_0x45ae('0xb')](),controller[_0x45ae('0xc')]);router[_0x45ae('0xd')](_0x45ae('0xe'),auth[_0x45ae('0xb')](),controller[_0x45ae('0xf')]);router['get']('/:id/fields',auth[_0x45ae('0xb')](),controller[_0x45ae('0x10')]);router['post']('/',auth[_0x45ae('0xb')](),controller[_0x45ae('0x11')]);router[_0x45ae('0x12')]('/:id/configurations',auth[_0x45ae('0xb')](),controller[_0x45ae('0x13')]);router[_0x45ae('0x14')](_0x45ae('0xa'),auth[_0x45ae('0xb')](),controller[_0x45ae('0x15')]);router[_0x45ae('0x16')]('/:id',auth[_0x45ae('0xb')](),controller[_0x45ae('0x17')]);module['exports']=router; \ No newline at end of file +var _0xb1c4=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','isAuthenticated','create','post','addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','/:id'];(function(_0x4516be,_0x381ced){var _0x2a87b5=function(_0x53e5a5){while(--_0x53e5a5){_0x4516be['push'](_0x4516be['shift']());}};_0x2a87b5(++_0x381ced);}(_0xb1c4,0xe5));var _0x4b1c=function(_0x42be8b,_0x8ad475){_0x42be8b=_0x42be8b-0x0;var _0x3345fe=_0xb1c4[_0x42be8b];return _0x3345fe;};'use strict';var multer=require('multer');var util=require(_0x4b1c('0x0'));var path=require(_0x4b1c('0x1'));var timeout=require(_0x4b1c('0x2'));var express=require(_0x4b1c('0x3'));var router=express[_0x4b1c('0x4')]();var fs_extra=require(_0x4b1c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4b1c('0x6'));var config=require(_0x4b1c('0x7'));var controller=require(_0x4b1c('0x8'));router[_0x4b1c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4b1c('0xa'),auth['isAuthenticated'](),controller[_0x4b1c('0xb')]);router['get'](_0x4b1c('0xc'),auth['isAuthenticated'](),controller[_0x4b1c('0xd')]);router[_0x4b1c('0x9')](_0x4b1c('0xe'),auth['isAuthenticated'](),controller[_0x4b1c('0xf')]);router['post']('/',auth[_0x4b1c('0x10')](),controller[_0x4b1c('0x11')]);router[_0x4b1c('0x12')]('/:id/configurations',auth[_0x4b1c('0x10')](),controller[_0x4b1c('0x13')]);router['put']('/:id',auth[_0x4b1c('0x10')](),controller[_0x4b1c('0x14')]);router[_0x4b1c('0x15')](_0x4b1c('0xa'),auth[_0x4b1c('0x10')](),controller[_0x4b1c('0x16')]);module[_0x4b1c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 43a7409..2aaf059 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 _0x99e9=['exports','STRING'];(function(_0x597040,_0x9eb682){var _0x13df75=function(_0xec2ed){while(--_0xec2ed){_0x597040['push'](_0x597040['shift']());}};_0x13df75(++_0x9eb682);}(_0x99e9,0xb4));var _0x999e=function(_0x5427c8,_0x18f384){_0x5427c8=_0x5427c8-0x0;var _0x33a129=_0x99e9[_0x5427c8];return _0x33a129;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0xdace=['STRING','sequelize'];(function(_0xe35782,_0x173323){var _0x276375=function(_0x4af4d8){while(--_0x4af4d8){_0xe35782['push'](_0xe35782['shift']());}};_0x276375(++_0x173323);}(_0xdace,0xc5));var _0xedac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdace[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9607a5e..5f3a102 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 _0xc38f=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ZohoAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZohoConfiguration','order','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','Call_Result','Call_Start_Time','includes','api_name','push','display_label','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment'];(function(_0x2cd247,_0x60b603){var _0x4d8386=function(_0x23ec56){while(--_0x23ec56){_0x2cd247['push'](_0x2cd247['shift']());}};_0x4d8386(++_0x60b603);}(_0xc38f,0xfc));var _0xfc38=function(_0x35d408,_0x5c30ce){_0x35d408=_0x35d408-0x0;var _0x12a981=_0xc38f[_0x35d408];return _0x12a981;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc38('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc38('0x1'));var rp=require(_0xfc38('0x2'));var moment=require(_0xfc38('0x3'));var BPromise=require(_0xfc38('0x4'));var Mustache=require(_0xfc38('0x5'));var util=require(_0xfc38('0x6'));var path=require(_0xfc38('0x7'));var sox=require(_0xfc38('0x8'));var csv=require(_0xfc38('0x9'));var ejs=require(_0xfc38('0xa'));var fs=require('fs');var fs_extra=require(_0xfc38('0xb'));var _=require('lodash');var squel=require(_0xfc38('0xc'));var crypto=require(_0xfc38('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc38('0xe'));var toCsv=require(_0xfc38('0x9'));var querystring=require(_0xfc38('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc38('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc38('0x11'));var hardwareService=require(_0xfc38('0x12'));var logger=require('../../config/logger')(_0xfc38('0x13'));var utils=require(_0xfc38('0x14'));var config=require(_0xfc38('0x15'));var licenseUtil=require(_0xfc38('0x16'));var db=require(_0xfc38('0x17'))['db'];var integrations=require(_0xfc38('0x18'));function respondWithStatusCode(_0x5848c4,_0x5660b2){_0x5660b2=_0x5660b2||0xcc;return function(_0x225bf7){if(_0x225bf7){return _0x5848c4[_0xfc38('0x19')](_0x5660b2);}return _0x5848c4[_0xfc38('0x1a')](_0x5660b2)['end']();};}function respondWithResult(_0x5b292b,_0x15de58){_0x15de58=_0x15de58||0xc8;return function(_0x1b12f7){if(_0x1b12f7){return _0x5b292b[_0xfc38('0x1a')](_0x15de58)[_0xfc38('0x1b')](_0x1b12f7);}};}function respondWithFilteredResult(_0x1b86a,_0xf4640c){return function(_0xbc070f){if(_0xbc070f){var _0x10fee9=typeof _0xf4640c[_0xfc38('0x1c')]===_0xfc38('0x1d')&&typeof _0xf4640c['limit']==='undefined';var _0xa3679a=_0xbc070f[_0xfc38('0x1e')];var _0x5dab57=_0x10fee9?0x0:_0xf4640c[_0xfc38('0x1c')];var _0x375b76=_0x10fee9?_0xbc070f['count']:_0xf4640c[_0xfc38('0x1c')]+_0xf4640c[_0xfc38('0x1f')];var _0xdd2ef;if(_0x375b76>=_0xa3679a){_0x375b76=_0xa3679a;_0xdd2ef=0xc8;}else{_0xdd2ef=0xce;}_0x1b86a['status'](_0xdd2ef);return _0x1b86a[_0xfc38('0x20')](_0xfc38('0x21'),_0x5dab57+'-'+_0x375b76+'/'+_0xa3679a)['json'](_0xbc070f);}return null;};}function patchUpdates(_0x1ef529){return function(_0x4c43ab){try{jsonpatch[_0xfc38('0x22')](_0x4c43ab,_0x1ef529,!![]);}catch(_0x3d617e){return BPromise[_0xfc38('0x23')](_0x3d617e);}return _0x4c43ab['save']();};}function saveUpdates(_0x1e990d,_0x3ec585){return function(_0x1a6814){if(_0x1a6814){return _0x1a6814[_0xfc38('0x24')](_0x1e990d)[_0xfc38('0x25')](function(_0x24ab2c){return _0x24ab2c;});}return null;};}function removeEntity(_0x10b5f6,_0x5d980f){return function(_0x2b97b7){if(_0x2b97b7){return _0x2b97b7[_0xfc38('0x26')]()[_0xfc38('0x25')](function(){_0x10b5f6[_0xfc38('0x1a')](0xcc)[_0xfc38('0x27')]();});}};}function handleEntityNotFound(_0x1e5a27,_0x4322e4){return function(_0x585299){if(!_0x585299){_0x1e5a27[_0xfc38('0x19')](0x194);}return _0x585299;};}function handleError(_0x4df872,_0x1c1ab1){_0x1c1ab1=_0x1c1ab1||0x1f4;return function(_0x59a354){logger[_0xfc38('0x28')](_0x59a354['stack']);if(_0x59a354[_0xfc38('0x29')]){delete _0x59a354[_0xfc38('0x29')];}_0x4df872[_0xfc38('0x1a')](_0x1c1ab1)['send'](_0x59a354);};}exports[_0xfc38('0x2a')]=function(_0x245cec,_0x29229b){var _0xc61913={},_0x2567d4={},_0xe2e9c2={'count':0x0,'rows':[]};var _0x44642d=_[_0xfc38('0x2b')](db[_0xfc38('0x2c')][_0xfc38('0x2d')],function(_0x935ade){return{'name':_0x935ade[_0xfc38('0x2e')],'type':_0x935ade['type'][_0xfc38('0x2f')]};});_0x2567d4['model']=_['map'](_0x44642d,_0xfc38('0x29'));_0x2567d4[_0xfc38('0x30')]=_[_0xfc38('0x31')](_0x245cec[_0xfc38('0x30')]);_0x2567d4[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x2567d4[_0xfc38('0x34')],_0x2567d4[_0xfc38('0x30')]);_0xc61913[_0xfc38('0x35')]=_[_0xfc38('0x33')](_0x2567d4[_0xfc38('0x34')],qs[_0xfc38('0x36')](_0x245cec[_0xfc38('0x30')][_0xfc38('0x36')]));_0xc61913[_0xfc38('0x35')]=_0xc61913[_0xfc38('0x35')][_0xfc38('0x37')]?_0xc61913['attributes']:_0x2567d4['model'];if(!_0x245cec[_0xfc38('0x30')][_0xfc38('0x38')](_0xfc38('0x39'))){_0xc61913[_0xfc38('0x1f')]=qs[_0xfc38('0x1f')](_0x245cec[_0xfc38('0x30')][_0xfc38('0x1f')]);_0xc61913['offset']=qs[_0xfc38('0x1c')](_0x245cec['query'][_0xfc38('0x1c')]);}_0xc61913['order']=qs[_0xfc38('0x3a')](_0x245cec['query'][_0xfc38('0x3a')]);_0xc61913[_0xfc38('0x3b')]=qs[_0xfc38('0x32')](_[_0xfc38('0x3c')](_0x245cec[_0xfc38('0x30')],_0x2567d4[_0xfc38('0x32')]),_0x44642d);if(_0x245cec[_0xfc38('0x30')][_0xfc38('0x3d')]){_0xc61913[_0xfc38('0x3b')]=_[_0xfc38('0x3e')](_0xc61913[_0xfc38('0x3b')],{'$or':_['map'](_0x44642d,function(_0x35685c){if(_0x35685c[_0xfc38('0x3f')]!=='VIRTUAL'){var _0x594507={};_0x594507[_0x35685c['name']]={'$like':'%'+_0x245cec[_0xfc38('0x30')][_0xfc38('0x3d')]+'%'};return _0x594507;}})});}_0xc61913=_[_0xfc38('0x3e')]({},_0xc61913,_0x245cec[_0xfc38('0x40')]);var _0x14e2ca={'where':_0xc61913[_0xfc38('0x3b')]};return db[_0xfc38('0x2c')]['count'](_0x14e2ca)[_0xfc38('0x25')](function(_0x5a6597){_0xe2e9c2[_0xfc38('0x1e')]=_0x5a6597;if(_0x245cec[_0xfc38('0x30')][_0xfc38('0x41')]){_0xc61913[_0xfc38('0x42')]=[{'all':!![]}];}return db[_0xfc38('0x2c')][_0xfc38('0x43')](_0xc61913);})[_0xfc38('0x25')](function(_0xc2f45e){_0xe2e9c2[_0xfc38('0x44')]=_0xc2f45e;return _0xe2e9c2;})[_0xfc38('0x25')](respondWithFilteredResult(_0x29229b,_0xc61913))[_0xfc38('0x45')](handleError(_0x29229b,null));};exports[_0xfc38('0x46')]=function(_0xd403e2,_0x15d686){var _0x49beaf={'raw':![],'where':{'id':_0xd403e2[_0xfc38('0x47')]['id']}},_0x578b48={};_0x578b48[_0xfc38('0x34')]=_[_0xfc38('0x31')](db[_0xfc38('0x2c')][_0xfc38('0x2d')]);_0x578b48['query']=_['keys'](_0xd403e2[_0xfc38('0x30')]);_0x578b48[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x578b48[_0xfc38('0x34')],_0x578b48['query']);_0x49beaf[_0xfc38('0x35')]=_[_0xfc38('0x33')](_0x578b48[_0xfc38('0x34')],qs['fields'](_0xd403e2['query'][_0xfc38('0x36')]));_0x49beaf[_0xfc38('0x35')]=_0x49beaf[_0xfc38('0x35')][_0xfc38('0x37')]?_0x49beaf['attributes']:_0x578b48[_0xfc38('0x34')];if(_0xd403e2[_0xfc38('0x30')][_0xfc38('0x41')]){_0x49beaf[_0xfc38('0x42')]=[{'all':!![]}];}_0x49beaf=_[_0xfc38('0x3e')]({},_0x49beaf,_0xd403e2['options']);return db[_0xfc38('0x2c')][_0xfc38('0x48')](_0x49beaf)[_0xfc38('0x25')](handleEntityNotFound(_0x15d686,null))[_0xfc38('0x25')](respondWithResult(_0x15d686,null))[_0xfc38('0x45')](handleError(_0x15d686,null));};exports[_0xfc38('0x49')]=function(_0x3faf64,_0x21093a){return db[_0xfc38('0x2c')][_0xfc38('0x49')](_0x3faf64[_0xfc38('0x4a')],{})[_0xfc38('0x25')](respondWithResult(_0x21093a,0xc9))[_0xfc38('0x45')](handleError(_0x21093a,null));};exports[_0xfc38('0x24')]=function(_0x3ce1dc,_0x596e31){if(_0x3ce1dc[_0xfc38('0x4a')]['id']){delete _0x3ce1dc[_0xfc38('0x4a')]['id'];}return db[_0xfc38('0x2c')][_0xfc38('0x48')]({'where':{'id':_0x3ce1dc[_0xfc38('0x47')]['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0x596e31,null))[_0xfc38('0x25')](saveUpdates(_0x3ce1dc[_0xfc38('0x4a')],null))[_0xfc38('0x25')](respondWithResult(_0x596e31,null))[_0xfc38('0x45')](handleError(_0x596e31,null));};exports[_0xfc38('0x26')]=function(_0x15813a,_0xd674d2){return db[_0xfc38('0x2c')]['find']({'where':{'id':_0x15813a[_0xfc38('0x47')]['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0xd674d2,null))[_0xfc38('0x25')](removeEntity(_0xd674d2,null))[_0xfc38('0x45')](handleError(_0xd674d2,null));};exports['getConfigurations']=function(_0x4baa95,_0x29dff8,_0x193cf5){var _0x53afb6={};var _0x4a89de={};var _0x2f15b8;var _0x37007e;return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x4baa95['params']['id']}})[_0xfc38('0x25')](handleEntityNotFound(_0x29dff8,null))[_0xfc38('0x25')](function(_0x460dea){if(_0x460dea){_0x2f15b8=_0x460dea;_0x4a89de[_0xfc38('0x34')]=_[_0xfc38('0x31')](db[_0xfc38('0x4c')][_0xfc38('0x2d')]);_0x4a89de[_0xfc38('0x30')]=_[_0xfc38('0x31')](_0x4baa95[_0xfc38('0x30')]);_0x4a89de[_0xfc38('0x32')]=_[_0xfc38('0x33')](_0x4a89de[_0xfc38('0x34')],_0x4a89de['query']);_0x53afb6['attributes']=_[_0xfc38('0x33')](_0x4a89de['model'],qs['fields'](_0x4baa95[_0xfc38('0x30')]['fields']));_0x53afb6[_0xfc38('0x35')]=_0x53afb6[_0xfc38('0x35')][_0xfc38('0x37')]?_0x53afb6[_0xfc38('0x35')]:_0x4a89de[_0xfc38('0x34')];_0x53afb6[_0xfc38('0x4d')]=qs[_0xfc38('0x3a')](_0x4baa95['query'][_0xfc38('0x3a')]);_0x53afb6[_0xfc38('0x3b')]=qs[_0xfc38('0x32')](_['pick'](_0x4baa95[_0xfc38('0x30')],_0x4a89de[_0xfc38('0x32')]));if(_0x4baa95[_0xfc38('0x30')][_0xfc38('0x3d')]){_0x53afb6[_0xfc38('0x3b')]=_[_0xfc38('0x3e')](_0x53afb6['where'],{'$or':_['map'](_0x53afb6[_0xfc38('0x35')],function(_0x42dedf){var _0x562f57={};_0x562f57[_0x42dedf]={'$like':'%'+_0x4baa95[_0xfc38('0x30')]['filter']+'%'};return _0x562f57;})});}_0x53afb6=_['merge']({},_0x53afb6,_0x4baa95[_0xfc38('0x40')]);return _0x2f15b8[_0xfc38('0x4e')](_0x53afb6);}})[_0xfc38('0x25')](function(_0x2d436c){if(_0x2d436c){_0x37007e=_0x2d436c['length'];if(!_0x4baa95[_0xfc38('0x30')]['hasOwnProperty'](_0xfc38('0x39'))){_0x53afb6[_0xfc38('0x1f')]=qs[_0xfc38('0x1f')](_0x4baa95[_0xfc38('0x30')][_0xfc38('0x1f')]);_0x53afb6[_0xfc38('0x1c')]=qs[_0xfc38('0x1c')](_0x4baa95[_0xfc38('0x30')][_0xfc38('0x1c')]);}return _0x2f15b8['getConfigurations'](_0x53afb6);}})[_0xfc38('0x25')](function(_0x2fc2e2){if(_0x2fc2e2){return _0x2fc2e2?{'count':_0x37007e,'rows':_0x2fc2e2}:null;}})[_0xfc38('0x25')](respondWithResult(_0x29dff8,null))[_0xfc38('0x45')](handleError(_0x29dff8,null));};exports[_0xfc38('0x4f')]=function(_0x554517,_0x3e5fd4,_0x25245e){if(_0x554517['body']['id']){delete _0x554517[_0xfc38('0x4a')]['id'];}return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x554517[_0xfc38('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e5fd4,null))[_0xfc38('0x25')](function(_0x1788d6){if(_0x1788d6){_0x554517[_0xfc38('0x4a')][_0xfc38('0x50')]=_0x1788d6['id'];_0x554517[_0xfc38('0x4a')]['Subjects']=integrations[_0xfc38('0x51')](_0x554517[_0xfc38('0x4a')][_0xfc38('0x52')],_0x554517['body'][_0xfc38('0x3f')]);_0x554517[_0xfc38('0x4a')][_0xfc38('0x53')]=integrations[_0xfc38('0x54')](_0x554517['body'][_0xfc38('0x52')],_0x554517[_0xfc38('0x4a')]['type']);return db[_0xfc38('0x4c')][_0xfc38('0x49')](_0x554517[_0xfc38('0x4a')],{'include':[{'model':db[_0xfc38('0x55')],'as':_0xfc38('0x56')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xfc38('0x25')](respondWithResult(_0x3e5fd4,null))[_0xfc38('0x45')](handleError(_0x3e5fd4,null));};function getAccessToken(_0x210605){return new Promise(function(_0x5bc91b,_0x5957d9){var _0x437229;switch(_0x210605[_0xfc38('0x57')]){case'US':_0x437229=_0xfc38('0x58');break;case'AU':_0x437229=_0xfc38('0x59');break;case'EU':_0x437229='https://accounts.zoho.eu';break;case'IN':_0x437229=_0xfc38('0x5a');break;case'CN':_0x437229=_0xfc38('0x5b');break;default:_0x437229='https://accounts.zoho.eu';break;}var _0x260c34={'method':_0xfc38('0x5c'),'uri':_0x437229+_0xfc38('0x5d'),'qs':{'refresh_token':_0x210605[_0xfc38('0x5e')],'client_id':_0x210605[_0xfc38('0x5f')],'client_secret':_0x210605[_0xfc38('0x60')],'grant_type':_0xfc38('0x61')},'json':!![]};return rp(_0x260c34)['then'](function(_0x5c1cd0){if(_0x5c1cd0['access_token']){_0x5bc91b(_0x5c1cd0[_0xfc38('0x62')]);}else{_0x5957d9('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xfc38('0x45')](function(_0x1665a3){_0x5957d9(_0x1665a3);});});}exports[_0xfc38('0x63')]=function(_0x2994c1,_0x3650e9,_0x114dd4){var _0x424a3f,_0x3089bc,_0x4be672,_0x4ae4b7,_0x420e80;return db[_0xfc38('0x2c')][_0xfc38('0x4b')]({'where':{'id':_0x2994c1[_0xfc38('0x47')]['id']},'attributes':['id',_0xfc38('0x64'),_0xfc38('0x57'),_0xfc38('0x5f'),_0xfc38('0x60'),_0xfc38('0x65'),'code',_0xfc38('0x5e')]})[_0xfc38('0x25')](handleEntityNotFound(_0x3650e9,null))[_0xfc38('0x25')](function(_0x241111){_0x420e80=_0x241111;_0x424a3f=_0x420e80['host'];_0x3089bc=_0x424a3f===_0xfc38('0x66')?'eu':'com';_0x4be672=_0x420e80[_0xfc38('0x65')];var _0x1f0eb8=_0x4be672['slice'](-0x1);if(_0x1f0eb8==='/'||_0x1f0eb8==='\x5c'||_0x1f0eb8===':'){_0x4be672=_0x4be672[_0xfc38('0x67')](0x0,_0x4be672['lastIndexOf'](_0x1f0eb8));}if(!_0x420e80[_0xfc38('0x5e')]){throw new Error(_0xfc38('0x68'));}return getAccessToken(_0x420e80);})[_0xfc38('0x25')](function(_0x461e50){if(_0x461e50){return rp({'method':_0xfc38('0x69'),'uri':util[_0xfc38('0x6a')](_0xfc38('0x6b'),_0x3089bc),'qs':{'module':_0xfc38('0x6c')},'headers':{'Authorization':_0xfc38('0x6d')+_0x461e50},'json':!![]});}})[_0xfc38('0x25')](function(_0x4dd5b2){if(_0x4dd5b2){if(_0x4dd5b2[_0xfc38('0x6e')]&&_0x4dd5b2['response'][_0xfc38('0x28')]){throw new Error(_0x4dd5b2[_0xfc38('0x6e')][_0xfc38('0x28')][_0xfc38('0x6f')]);}var _0x298b8c=[];var _0x41784f=[];var _0x4b0f07=['Owner',_0xfc38('0x70'),_0xfc38('0x71'),'WhoId','Call_Duration',_0xfc38('0x72'),_0xfc38('0x73'),'Call_Type'];_0x41784f=_['remove'](_0x4dd5b2['fields'],function(_0x1d7877){return _0x4b0f07[_0xfc38('0x74')](_0x1d7877[_0xfc38('0x75')]);});for(var _0x59d1b0=0x0;_0x59d1b0<_0x41784f[_0xfc38('0x37')];_0x59d1b0++){if(_0x41784f[_0x59d1b0]['system_mandatory']===![]){_0x298b8c[_0xfc38('0x76')]({'id':_0x41784f[_0x59d1b0]['id'],'name':_0x41784f[_0x59d1b0][_0xfc38('0x77')],'custom':_0x41784f[_0x59d1b0]['custom_field'],'options':_0x41784f[_0x59d1b0][_0xfc38('0x78')]==='picklist'&&_0x41784f[_0x59d1b0][_0xfc38('0x79')]['length']>-0x1?_[_0xfc38('0x2b')](_0x41784f[_0x59d1b0]['pick_list_values'],function(_0x964046){return{'name':_0x964046,'value':_0x964046};}):[]});}}return{'count':_0x298b8c['length'],'rows':_0x298b8c};}else{return{'count':0x0,'rows':[]};}})[_0xfc38('0x25')](respondWithResult(_0x3650e9,null))['catch'](function(_0xa6fbd2){var _0x3c5979=_0x2994c1[_0xfc38('0x30')][_0xfc38('0x7a')]?0x1f4:_0xa6fbd2[_0xfc38('0x7b')]||0x1f4;logger[_0xfc38('0x28')](_0xfc38('0x7c'),'getFields',_0x3c5979,JSON[_0xfc38('0x7d')](_0xa6fbd2));delete _0xa6fbd2[_0xfc38('0x29')];if(_0x3c5979===0x191){_0x3c5979=0x190;}_0x3650e9[_0xfc38('0x1a')](_0x3c5979)[_0xfc38('0x7e')](_0x2994c1[_0xfc38('0x30')]['test']?{'message':_0xfc38('0x7f'),'statusCode':_0xa6fbd2[_0xfc38('0x7b')]}:_0xa6fbd2);});}; \ No newline at end of file +var _0x3b78=['response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','system_mandatory','push','display_label','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','name','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','filter','options','includeAll','findAll','rows','show','params','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','AccountId','Descriptions','getDescriptions','channel','Subjects','ZohoField','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','zone','code','host','zoho.eu','com','serverUrl','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20'];(function(_0x3e9577,_0x2f6d4c){var _0x2e8331=function(_0x22b2f7){while(--_0x22b2f7){_0x3e9577['push'](_0x3e9577['shift']());}};_0x2e8331(++_0x2f6d4c);}(_0x3b78,0x107));var _0x83b7=function(_0x1fac98,_0x3a615e){_0x1fac98=_0x1fac98-0x0;var _0x56dfff=_0x3b78[_0x1fac98];return _0x56dfff;};'use strict';var emlformat=require(_0x83b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83b7('0x2'));var moment=require(_0x83b7('0x3'));var BPromise=require(_0x83b7('0x4'));var Mustache=require(_0x83b7('0x5'));var util=require(_0x83b7('0x6'));var path=require('path');var sox=require(_0x83b7('0x7'));var csv=require(_0x83b7('0x8'));var ejs=require(_0x83b7('0x9'));var fs=require('fs');var fs_extra=require(_0x83b7('0xa'));var _=require('lodash');var squel=require(_0x83b7('0xb'));var crypto=require(_0x83b7('0xc'));var jsforce=require(_0x83b7('0xd'));var deskjs=require(_0x83b7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x83b7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83b7('0x10'));var hardwareService=require(_0x83b7('0x11'));var logger=require(_0x83b7('0x12'))(_0x83b7('0x13'));var utils=require(_0x83b7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x83b7('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x47f639,_0x4283bd){_0x4283bd=_0x4283bd||0xcc;return function(_0x1f32ac){if(_0x1f32ac){return _0x47f639[_0x83b7('0x16')](_0x4283bd);}return _0x47f639[_0x83b7('0x17')](_0x4283bd)[_0x83b7('0x18')]();};}function respondWithResult(_0x12f7d5,_0x3b483f){_0x3b483f=_0x3b483f||0xc8;return function(_0x3be4d3){if(_0x3be4d3){return _0x12f7d5[_0x83b7('0x17')](_0x3b483f)[_0x83b7('0x19')](_0x3be4d3);}};}function respondWithFilteredResult(_0x86a333,_0x44f1a5){return function(_0x34a37a){if(_0x34a37a){var _0x1f6c00=typeof _0x44f1a5['offset']===_0x83b7('0x1a')&&typeof _0x44f1a5[_0x83b7('0x1b')]===_0x83b7('0x1a');var _0x2693a2=_0x34a37a[_0x83b7('0x1c')];var _0x400119=_0x1f6c00?0x0:_0x44f1a5[_0x83b7('0x1d')];var _0x46bca4=_0x1f6c00?_0x34a37a[_0x83b7('0x1c')]:_0x44f1a5[_0x83b7('0x1d')]+_0x44f1a5[_0x83b7('0x1b')];var _0x2df6a8;if(_0x46bca4>=_0x2693a2){_0x46bca4=_0x2693a2;_0x2df6a8=0xc8;}else{_0x2df6a8=0xce;}_0x86a333['status'](_0x2df6a8);return _0x86a333[_0x83b7('0x1e')]('Content-Range',_0x400119+'-'+_0x46bca4+'/'+_0x2693a2)[_0x83b7('0x19')](_0x34a37a);}return null;};}function patchUpdates(_0x59089a){return function(_0x569b8a){try{jsonpatch[_0x83b7('0x1f')](_0x569b8a,_0x59089a,!![]);}catch(_0x273b61){return BPromise[_0x83b7('0x20')](_0x273b61);}return _0x569b8a['save']();};}function saveUpdates(_0x1cfc48,_0x13c52c){return function(_0x410052){if(_0x410052){return _0x410052[_0x83b7('0x21')](_0x1cfc48)[_0x83b7('0x22')](function(_0x143843){return _0x143843;});}return null;};}function removeEntity(_0xda17db,_0x418cf1){return function(_0x5e9c4f){if(_0x5e9c4f){return _0x5e9c4f[_0x83b7('0x23')]()['then'](function(){_0xda17db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36f238,_0x501b8f){return function(_0x215fa9){if(!_0x215fa9){_0x36f238[_0x83b7('0x16')](0x194);}return _0x215fa9;};}function handleError(_0x13c868,_0x5bc45e){_0x5bc45e=_0x5bc45e||0x1f4;return function(_0x2ca706){logger[_0x83b7('0x24')](_0x2ca706['stack']);if(_0x2ca706['name']){delete _0x2ca706[_0x83b7('0x25')];}_0x13c868['status'](_0x5bc45e)['send'](_0x2ca706);};}exports['index']=function(_0x43e078,_0x1f91b8){var _0xd1464b={},_0x3bc55f={},_0xf93236={'count':0x0,'rows':[]};var _0x59679c=_['map'](db[_0x83b7('0x26')][_0x83b7('0x27')],function(_0x2794e8){return{'name':_0x2794e8[_0x83b7('0x28')],'type':_0x2794e8[_0x83b7('0x29')][_0x83b7('0x2a')]};});_0x3bc55f[_0x83b7('0x2b')]=_[_0x83b7('0x2c')](_0x59679c,_0x83b7('0x25'));_0x3bc55f[_0x83b7('0x2d')]=_[_0x83b7('0x2e')](_0x43e078[_0x83b7('0x2d')]);_0x3bc55f['filters']=_[_0x83b7('0x2f')](_0x3bc55f[_0x83b7('0x2b')],_0x3bc55f[_0x83b7('0x2d')]);_0xd1464b[_0x83b7('0x30')]=_[_0x83b7('0x2f')](_0x3bc55f['model'],qs['fields'](_0x43e078[_0x83b7('0x2d')][_0x83b7('0x31')]));_0xd1464b[_0x83b7('0x30')]=_0xd1464b['attributes'][_0x83b7('0x32')]?_0xd1464b[_0x83b7('0x30')]:_0x3bc55f[_0x83b7('0x2b')];if(!_0x43e078[_0x83b7('0x2d')]['hasOwnProperty'](_0x83b7('0x33'))){_0xd1464b[_0x83b7('0x1b')]=qs['limit'](_0x43e078[_0x83b7('0x2d')][_0x83b7('0x1b')]);_0xd1464b[_0x83b7('0x1d')]=qs[_0x83b7('0x1d')](_0x43e078[_0x83b7('0x2d')][_0x83b7('0x1d')]);}_0xd1464b[_0x83b7('0x34')]=qs['sort'](_0x43e078[_0x83b7('0x2d')][_0x83b7('0x35')]);_0xd1464b['where']=qs[_0x83b7('0x36')](_[_0x83b7('0x37')](_0x43e078[_0x83b7('0x2d')],_0x3bc55f[_0x83b7('0x36')]),_0x59679c);if(_0x43e078['query']['filter']){_0xd1464b[_0x83b7('0x38')]=_[_0x83b7('0x39')](_0xd1464b[_0x83b7('0x38')],{'$or':_['map'](_0x59679c,function(_0x3bf990){if(_0x3bf990[_0x83b7('0x29')]!=='VIRTUAL'){var _0x14cb87={};_0x14cb87[_0x3bf990[_0x83b7('0x25')]]={'$like':'%'+_0x43e078[_0x83b7('0x2d')][_0x83b7('0x3a')]+'%'};return _0x14cb87;}})});}_0xd1464b=_[_0x83b7('0x39')]({},_0xd1464b,_0x43e078[_0x83b7('0x3b')]);var _0x3f6404={'where':_0xd1464b['where']};return db[_0x83b7('0x26')][_0x83b7('0x1c')](_0x3f6404)['then'](function(_0x5d2dd9){_0xf93236[_0x83b7('0x1c')]=_0x5d2dd9;if(_0x43e078[_0x83b7('0x2d')][_0x83b7('0x3c')]){_0xd1464b['include']=[{'all':!![]}];}return db[_0x83b7('0x26')][_0x83b7('0x3d')](_0xd1464b);})[_0x83b7('0x22')](function(_0x562222){_0xf93236[_0x83b7('0x3e')]=_0x562222;return _0xf93236;})['then'](respondWithFilteredResult(_0x1f91b8,_0xd1464b))['catch'](handleError(_0x1f91b8,null));};exports[_0x83b7('0x3f')]=function(_0x5dd3e3,_0x531e8b){var _0x59d584={'raw':![],'where':{'id':_0x5dd3e3[_0x83b7('0x40')]['id']}},_0x479910={};_0x479910[_0x83b7('0x2b')]=_['keys'](db['ZohoAccount'][_0x83b7('0x27')]);_0x479910[_0x83b7('0x2d')]=_[_0x83b7('0x2e')](_0x5dd3e3['query']);_0x479910[_0x83b7('0x36')]=_[_0x83b7('0x2f')](_0x479910[_0x83b7('0x2b')],_0x479910[_0x83b7('0x2d')]);_0x59d584[_0x83b7('0x30')]=_[_0x83b7('0x2f')](_0x479910[_0x83b7('0x2b')],qs[_0x83b7('0x31')](_0x5dd3e3[_0x83b7('0x2d')][_0x83b7('0x31')]));_0x59d584[_0x83b7('0x30')]=_0x59d584[_0x83b7('0x30')][_0x83b7('0x32')]?_0x59d584[_0x83b7('0x30')]:_0x479910[_0x83b7('0x2b')];if(_0x5dd3e3[_0x83b7('0x2d')][_0x83b7('0x3c')]){_0x59d584['include']=[{'all':!![]}];}_0x59d584=_[_0x83b7('0x39')]({},_0x59d584,_0x5dd3e3[_0x83b7('0x3b')]);return db['ZohoAccount'][_0x83b7('0x41')](_0x59d584)[_0x83b7('0x22')](handleEntityNotFound(_0x531e8b,null))['then'](respondWithResult(_0x531e8b,null))[_0x83b7('0x42')](handleError(_0x531e8b,null));};exports[_0x83b7('0x43')]=function(_0x554912,_0x5a1216){return db[_0x83b7('0x26')][_0x83b7('0x43')](_0x554912[_0x83b7('0x44')],{})['then'](respondWithResult(_0x5a1216,0xc9))[_0x83b7('0x42')](handleError(_0x5a1216,null));};exports[_0x83b7('0x21')]=function(_0x2b8594,_0x1695a5){if(_0x2b8594[_0x83b7('0x44')]['id']){delete _0x2b8594[_0x83b7('0x44')]['id'];}return db[_0x83b7('0x26')]['find']({'where':{'id':_0x2b8594[_0x83b7('0x40')]['id']}})[_0x83b7('0x22')](handleEntityNotFound(_0x1695a5,null))[_0x83b7('0x22')](saveUpdates(_0x2b8594[_0x83b7('0x44')],null))[_0x83b7('0x22')](respondWithResult(_0x1695a5,null))[_0x83b7('0x42')](handleError(_0x1695a5,null));};exports[_0x83b7('0x23')]=function(_0x2af80d,_0x3a8349){return db[_0x83b7('0x26')][_0x83b7('0x41')]({'where':{'id':_0x2af80d['params']['id']}})['then'](handleEntityNotFound(_0x3a8349,null))[_0x83b7('0x22')](removeEntity(_0x3a8349,null))['catch'](handleError(_0x3a8349,null));};exports[_0x83b7('0x45')]=function(_0x2bd30a,_0x3e8b18,_0x30d97d){var _0x30bd64={};var _0x271ce8={};var _0x5df5fc;var _0x3e49d3;return db[_0x83b7('0x26')][_0x83b7('0x46')]({'where':{'id':_0x2bd30a[_0x83b7('0x40')]['id']}})[_0x83b7('0x22')](handleEntityNotFound(_0x3e8b18,null))[_0x83b7('0x22')](function(_0x4179ba){if(_0x4179ba){_0x5df5fc=_0x4179ba;_0x271ce8[_0x83b7('0x2b')]=_[_0x83b7('0x2e')](db[_0x83b7('0x47')][_0x83b7('0x27')]);_0x271ce8[_0x83b7('0x2d')]=_['keys'](_0x2bd30a[_0x83b7('0x2d')]);_0x271ce8[_0x83b7('0x36')]=_[_0x83b7('0x2f')](_0x271ce8['model'],_0x271ce8[_0x83b7('0x2d')]);_0x30bd64['attributes']=_[_0x83b7('0x2f')](_0x271ce8[_0x83b7('0x2b')],qs[_0x83b7('0x31')](_0x2bd30a['query'][_0x83b7('0x31')]));_0x30bd64[_0x83b7('0x30')]=_0x30bd64[_0x83b7('0x30')][_0x83b7('0x32')]?_0x30bd64['attributes']:_0x271ce8[_0x83b7('0x2b')];_0x30bd64[_0x83b7('0x34')]=qs[_0x83b7('0x35')](_0x2bd30a[_0x83b7('0x2d')][_0x83b7('0x35')]);_0x30bd64[_0x83b7('0x38')]=qs[_0x83b7('0x36')](_[_0x83b7('0x37')](_0x2bd30a[_0x83b7('0x2d')],_0x271ce8[_0x83b7('0x36')]));if(_0x2bd30a['query']['filter']){_0x30bd64['where']=_['merge'](_0x30bd64[_0x83b7('0x38')],{'$or':_[_0x83b7('0x2c')](_0x30bd64[_0x83b7('0x30')],function(_0x3bc462){var _0x653844={};_0x653844[_0x3bc462]={'$like':'%'+_0x2bd30a['query'][_0x83b7('0x3a')]+'%'};return _0x653844;})});}_0x30bd64=_[_0x83b7('0x39')]({},_0x30bd64,_0x2bd30a[_0x83b7('0x3b')]);return _0x5df5fc['getConfigurations'](_0x30bd64);}})['then'](function(_0x5c07a9){if(_0x5c07a9){_0x3e49d3=_0x5c07a9[_0x83b7('0x32')];if(!_0x2bd30a[_0x83b7('0x2d')][_0x83b7('0x48')]('nolimit')){_0x30bd64[_0x83b7('0x1b')]=qs[_0x83b7('0x1b')](_0x2bd30a['query'][_0x83b7('0x1b')]);_0x30bd64['offset']=qs['offset'](_0x2bd30a[_0x83b7('0x2d')][_0x83b7('0x1d')]);}return _0x5df5fc['getConfigurations'](_0x30bd64);}})['then'](function(_0x17886e){if(_0x17886e){return _0x17886e?{'count':_0x3e49d3,'rows':_0x17886e}:null;}})[_0x83b7('0x22')](respondWithResult(_0x3e8b18,null))[_0x83b7('0x42')](handleError(_0x3e8b18,null));};exports['addConfiguration']=function(_0x2e26e5,_0x9df1c1,_0x5c302a){if(_0x2e26e5[_0x83b7('0x44')]['id']){delete _0x2e26e5[_0x83b7('0x44')]['id'];}return db['ZohoAccount'][_0x83b7('0x46')]({'where':{'id':_0x2e26e5[_0x83b7('0x40')]['id']}})['then'](handleEntityNotFound(_0x9df1c1,null))[_0x83b7('0x22')](function(_0x39b722){if(_0x39b722){_0x2e26e5[_0x83b7('0x44')][_0x83b7('0x49')]=_0x39b722['id'];_0x2e26e5[_0x83b7('0x44')]['Subjects']=integrations['getSubjects'](_0x2e26e5[_0x83b7('0x44')]['channel'],_0x2e26e5[_0x83b7('0x44')][_0x83b7('0x29')]);_0x2e26e5['body'][_0x83b7('0x4a')]=integrations[_0x83b7('0x4b')](_0x2e26e5[_0x83b7('0x44')][_0x83b7('0x4c')],_0x2e26e5[_0x83b7('0x44')][_0x83b7('0x29')]);return db['ZohoConfiguration'][_0x83b7('0x43')](_0x2e26e5[_0x83b7('0x44')],{'include':[{'model':db['ZohoField'],'as':_0x83b7('0x4d')},{'model':db[_0x83b7('0x4e')],'as':_0x83b7('0x4a')}]});}return null;})['then'](respondWithResult(_0x9df1c1,null))['catch'](handleError(_0x9df1c1,null));};function getAccessToken(_0x3df03d){return new Promise(function(_0x41d89f,_0x266699){var _0x68a8bb;switch(_0x3df03d['zone']){case'US':_0x68a8bb='https://accounts.zoho.com';break;case'AU':_0x68a8bb='https://accounts.zoho.com.au';break;case'EU':_0x68a8bb=_0x83b7('0x4f');break;case'IN':_0x68a8bb=_0x83b7('0x50');break;case'CN':_0x68a8bb=_0x83b7('0x51');break;default:_0x68a8bb=_0x83b7('0x4f');break;}var _0x58242f={'method':_0x83b7('0x52'),'uri':_0x68a8bb+_0x83b7('0x53'),'qs':{'refresh_token':_0x3df03d[_0x83b7('0x54')],'client_id':_0x3df03d[_0x83b7('0x55')],'client_secret':_0x3df03d[_0x83b7('0x56')],'grant_type':_0x83b7('0x57')},'json':!![]};return rp(_0x58242f)['then'](function(_0x407e82){if(_0x407e82[_0x83b7('0x58')]){_0x41d89f(_0x407e82[_0x83b7('0x58')]);}else{_0x266699('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x23cd53){_0x266699(_0x23cd53);});});}exports[_0x83b7('0x59')]=function(_0x4e9828,_0x5a4538,_0x5ad7f3){var _0x4f8cc9,_0x2a1ead,_0xfb2146,_0xa957df,_0x4771e4;return db[_0x83b7('0x26')][_0x83b7('0x46')]({'where':{'id':_0x4e9828['params']['id']},'attributes':['id','host',_0x83b7('0x5a'),_0x83b7('0x55'),_0x83b7('0x56'),'serverUrl',_0x83b7('0x5b'),'refreshToken']})[_0x83b7('0x22')](handleEntityNotFound(_0x5a4538,null))[_0x83b7('0x22')](function(_0x59cfba){_0x4771e4=_0x59cfba;_0x4f8cc9=_0x4771e4[_0x83b7('0x5c')];_0x2a1ead=_0x4f8cc9===_0x83b7('0x5d')?'eu':_0x83b7('0x5e');_0xfb2146=_0x4771e4[_0x83b7('0x5f')];var _0x541ed9=_0xfb2146['slice'](-0x1);if(_0x541ed9==='/'||_0x541ed9==='\x5c'||_0x541ed9===':'){_0xfb2146=_0xfb2146[_0x83b7('0x60')](0x0,_0xfb2146[_0x83b7('0x61')](_0x541ed9));}if(!_0x4771e4[_0x83b7('0x54')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4771e4);})['then'](function(_0x4b3f95){if(_0x4b3f95){return rp({'method':_0x83b7('0x62'),'uri':util[_0x83b7('0x63')](_0x83b7('0x64'),_0x2a1ead),'qs':{'module':_0x83b7('0x65')},'headers':{'Authorization':_0x83b7('0x66')+_0x4b3f95},'json':!![]});}})[_0x83b7('0x22')](function(_0x29c0a8){if(_0x29c0a8){if(_0x29c0a8['response']&&_0x29c0a8[_0x83b7('0x67')]['error']){throw new Error(_0x29c0a8[_0x83b7('0x67')][_0x83b7('0x24')]['message']);}var _0x5e38bc=[];var _0x20bd4f=[];var _0x181e3b=[_0x83b7('0x68'),_0x83b7('0x69'),_0x83b7('0x6a'),_0x83b7('0x6b'),_0x83b7('0x6c'),_0x83b7('0x6d'),'Call_Start_Time',_0x83b7('0x6e')];_0x20bd4f=_['remove'](_0x29c0a8['fields'],function(_0x54621f){return _0x181e3b[_0x83b7('0x6f')](_0x54621f['api_name']);});for(var _0x15cd78=0x0;_0x15cd78<_0x20bd4f[_0x83b7('0x32')];_0x15cd78++){if(_0x20bd4f[_0x15cd78][_0x83b7('0x70')]===![]){_0x5e38bc[_0x83b7('0x71')]({'id':_0x20bd4f[_0x15cd78]['id'],'name':_0x20bd4f[_0x15cd78][_0x83b7('0x72')],'custom':_0x20bd4f[_0x15cd78]['custom_field'],'options':_0x20bd4f[_0x15cd78]['data_type']===_0x83b7('0x73')&&_0x20bd4f[_0x15cd78][_0x83b7('0x74')][_0x83b7('0x32')]>-0x1?_[_0x83b7('0x2c')](_0x20bd4f[_0x15cd78][_0x83b7('0x74')],function(_0x2f4c85){return{'name':_0x2f4c85,'value':_0x2f4c85};}):[]});}}return{'count':_0x5e38bc[_0x83b7('0x32')],'rows':_0x5e38bc};}else{return{'count':0x0,'rows':[]};}})[_0x83b7('0x22')](respondWithResult(_0x5a4538,null))['catch'](function(_0x3363cb){var _0x4be851=_0x4e9828[_0x83b7('0x2d')][_0x83b7('0x75')]?0x1f4:_0x3363cb[_0x83b7('0x76')]||0x1f4;logger[_0x83b7('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x83b7('0x59'),_0x4be851,JSON[_0x83b7('0x77')](_0x3363cb));delete _0x3363cb[_0x83b7('0x25')];if(_0x4be851===0x191){_0x4be851=0x190;}_0x5a4538['status'](_0x4be851)[_0x83b7('0x78')](_0x4e9828[_0x83b7('0x2d')][_0x83b7('0x75')]?{'message':_0x83b7('0x79'),'statusCode':_0x3363cb[_0x83b7('0x76')]}:_0x3363cb);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d452578..c378ed0 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 _0xc364=['https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','format','inspect','https://accounts.zoho.com','https://accounts.zoho.com.au','/oauth/v2/token','then','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.in'];(function(_0x3fdddb,_0x244a31){var _0x1bd806=function(_0x20443a){while(--_0x20443a){_0x3fdddb['push'](_0x3fdddb['shift']());}};_0x1bd806(++_0x244a31);}(_0xc364,0xbc));var _0x4c36=function(_0x44be9a,_0x5ce1a6){_0x44be9a=_0x44be9a-0x0;var _0x3dbb78=_0xc364[_0x44be9a];return _0x3dbb78;};'use strict';var _=require(_0x4c36('0x0'));var util=require('util');var logger=require(_0x4c36('0x1'))(_0x4c36('0x2'));var moment=require(_0x4c36('0x3'));var BPromise=require(_0x4c36('0x4'));var rp=require(_0x4c36('0x5'));var fs=require('fs');var path=require(_0x4c36('0x6'));var rimraf=require(_0x4c36('0x7'));var config=require('../../config/environment');var attributes=require(_0x4c36('0x8'));var integrations=require(_0x4c36('0x9'));module['exports']=function(_0x267153,_0x560f3f){return _0x267153[_0x4c36('0xa')](_0x4c36('0xb'),attributes,{'tableName':_0x4c36('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x418a10,_0x8f914b,_0x35090b){if(_0x418a10[_0x4c36('0xd')](_0x4c36('0xe'))||_0x418a10[_0x4c36('0xd')]('serverUrl')||_0x418a10['changed'](_0x4c36('0xf'))||_0x418a10['changed']('clientSecret')||_0x418a10[_0x4c36('0xd')](_0x4c36('0x10'))||_0x418a10[_0x4c36('0xd')]('host')){var _0x41d03e,_0x589999;_0x41d03e=_0x418a10[_0x4c36('0x11')];var _0x10b541=_0x41d03e[_0x4c36('0x12')](-0x1);if(_0x10b541==='/'||_0x10b541==='\x5c'||_0x10b541===':'){_0x41d03e=_0x41d03e[_0x4c36('0x13')](0x0,_0x41d03e[_0x4c36('0x14')](_0x10b541));}switch(_0x418a10[_0x4c36('0xe')]){case'US':_0x589999='https://accounts.zoho.com';break;case'AU':_0x589999='https://accounts.zoho.com.au';break;case'IN':_0x589999=_0x4c36('0x15');break;case'CN':_0x589999=_0x4c36('0x16');break;default:_0x589999=_0x4c36('0x17');break;}var _0x5bcb44={'method':_0x4c36('0x18'),'uri':_0x589999+'/oauth/v2/token','form':{'grant_type':_0x4c36('0x19'),'client_id':_0x418a10[_0x4c36('0xf')],'client_secret':_0x418a10[_0x4c36('0x1a')],'redirect_uri':_0x418a10[_0x4c36('0x11')],'code':_0x418a10[_0x4c36('0x10')]},'headers':{'Content-Type':_0x4c36('0x1b')}};return rp(_0x5bcb44)['then'](function(_0x40c5aa){var _0x2d25e5=JSON[_0x4c36('0x1c')](_0x40c5aa);if(_0x2d25e5[_0x4c36('0x1d')]){_0x418a10[_0x4c36('0x1e')]=_0x2d25e5[_0x4c36('0x1d')];logger[_0x4c36('0x1f')](util['format'](_0x4c36('0x20'),_0x418a10['name'],_0x418a10['id']));}else{logger['error'](util['format'](_0x4c36('0x21'),_0x418a10[_0x4c36('0x22')],_0x418a10['id']),util['inspect'](_0x2d25e5,{'showHidden':![],'depth':null}));}return _0x35090b(null,_0x8f914b);})[_0x4c36('0x23')](function(_0x48927f){logger['error'](util[_0x4c36('0x24')](_0x4c36('0x21'),_0x418a10[_0x4c36('0x22')],_0x418a10['id']),util[_0x4c36('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x35090b(_0x48927f);});}else{return _0x35090b(null,_0x8f914b);}},'beforeUpdate':function(_0x50ed0b,_0x45d94e,_0xf4c88d){if(_0x50ed0b['changed']('zone')||_0x50ed0b[_0x4c36('0xd')]('serverUrl')||_0x50ed0b[_0x4c36('0xd')](_0x4c36('0xf'))||_0x50ed0b[_0x4c36('0xd')]('clientSecret')||_0x50ed0b[_0x4c36('0xd')]('code')||_0x50ed0b[_0x4c36('0xd')]('host')){var _0xc75595,_0x173e60;_0xc75595=_0x50ed0b[_0x4c36('0x11')];var _0x49261e=_0xc75595['slice'](-0x1);if(_0x49261e==='/'||_0x49261e==='\x5c'||_0x49261e===':'){_0xc75595=_0xc75595['substring'](0x0,_0xc75595['lastIndexOf'](_0x49261e));}switch(_0x50ed0b['zone']){case'US':_0x173e60=_0x4c36('0x26');break;case'AU':_0x173e60=_0x4c36('0x27');break;case'IN':_0x173e60=_0x4c36('0x15');break;case'CN':_0x173e60=_0x4c36('0x16');break;default:_0x173e60=_0x4c36('0x17');break;}var _0x56fb50={'method':_0x4c36('0x18'),'uri':_0x173e60+_0x4c36('0x28'),'form':{'grant_type':_0x4c36('0x19'),'client_id':_0x50ed0b[_0x4c36('0xf')],'client_secret':_0x50ed0b[_0x4c36('0x1a')],'redirect_uri':_0x50ed0b[_0x4c36('0x11')],'code':_0x50ed0b['code']},'headers':{'Content-Type':_0x4c36('0x1b')}};return rp(_0x56fb50)[_0x4c36('0x29')](function(_0x4f1347){var _0x3db4ae=JSON[_0x4c36('0x1c')](_0x4f1347);if(_0x3db4ae['refresh_token']){_0x50ed0b[_0x4c36('0x1e')]=_0x3db4ae['refresh_token'];logger['info'](util[_0x4c36('0x24')](_0x4c36('0x20'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']));}else{logger['error'](util[_0x4c36('0x24')](_0x4c36('0x21'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']),util[_0x4c36('0x25')](_0x3db4ae,{'showHidden':![],'depth':null}));}return _0xf4c88d(null,_0x45d94e);})[_0x4c36('0x23')](function(_0x76c2d1){logger['error'](util['format'](_0x4c36('0x21'),_0x50ed0b[_0x4c36('0x22')],_0x50ed0b['id']),util[_0x4c36('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xf4c88d(_0x76c2d1);});}else{return _0xf4c88d(null,_0x45d94e);}}}});}; \ No newline at end of file +var _0x24bd=['https://accounts.zoho.eu','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','lastIndexOf','/oauth/v2/token','authorization_code','catch','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','serverUrl','clientId','clientSecret','code','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x5a68c4,_0x1c6c70){var _0x41ada2=function(_0x49555a){while(--_0x49555a){_0x5a68c4['push'](_0x5a68c4['shift']());}};_0x41ada2(++_0x1c6c70);}(_0x24bd,0x194));var _0xd24b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x24bd[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xd24b('0x0'));var util=require(_0xd24b('0x1'));var logger=require(_0xd24b('0x2'))(_0xd24b('0x3'));var moment=require(_0xd24b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd24b('0x5'));var fs=require('fs');var path=require(_0xd24b('0x6'));var rimraf=require(_0xd24b('0x7'));var config=require(_0xd24b('0x8'));var attributes=require(_0xd24b('0x9'));var integrations=require(_0xd24b('0xa'));module[_0xd24b('0xb')]=function(_0x51ac76,_0x188586){return _0x51ac76[_0xd24b('0xc')](_0xd24b('0xd'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x542916,_0x46eac0,_0x4bb1d9){if(_0x542916['changed']('zone')||_0x542916[_0xd24b('0xe')](_0xd24b('0xf'))||_0x542916[_0xd24b('0xe')](_0xd24b('0x10'))||_0x542916[_0xd24b('0xe')](_0xd24b('0x11'))||_0x542916[_0xd24b('0xe')](_0xd24b('0x12'))||_0x542916['changed']('host')){var _0x31a23c,_0x41db78;_0x31a23c=_0x542916[_0xd24b('0xf')];var _0x54b579=_0x31a23c[_0xd24b('0x13')](-0x1);if(_0x54b579==='/'||_0x54b579==='\x5c'||_0x54b579===':'){_0x31a23c=_0x31a23c[_0xd24b('0x14')](0x0,_0x31a23c['lastIndexOf'](_0x54b579));}switch(_0x542916[_0xd24b('0x15')]){case'US':_0x41db78=_0xd24b('0x16');break;case'AU':_0x41db78=_0xd24b('0x17');break;case'IN':_0x41db78=_0xd24b('0x18');break;case'CN':_0x41db78=_0xd24b('0x19');break;default:_0x41db78=_0xd24b('0x1a');break;}var _0x310290={'method':'POST','uri':_0x41db78+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x542916[_0xd24b('0x10')],'client_secret':_0x542916[_0xd24b('0x11')],'redirect_uri':_0x542916[_0xd24b('0xf')],'code':_0x542916[_0xd24b('0x12')]},'headers':{'Content-Type':_0xd24b('0x1b')}};return rp(_0x310290)[_0xd24b('0x1c')](function(_0x4670a9){var _0x218760=JSON[_0xd24b('0x1d')](_0x4670a9);if(_0x218760[_0xd24b('0x1e')]){_0x542916[_0xd24b('0x1f')]=_0x218760[_0xd24b('0x1e')];logger['info'](util['format'](_0xd24b('0x20'),_0x542916[_0xd24b('0x21')],_0x542916['id']));}else{logger[_0xd24b('0x22')](util[_0xd24b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x542916[_0xd24b('0x21')],_0x542916['id']),util['inspect'](_0x218760,{'showHidden':![],'depth':null}));}return _0x4bb1d9(null,_0x46eac0);})['catch'](function(_0x4842e7){logger['error'](util[_0xd24b('0x23')](_0xd24b('0x24'),_0x542916[_0xd24b('0x21')],_0x542916['id']),util[_0xd24b('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x4bb1d9(_0x4842e7);});}else{return _0x4bb1d9(null,_0x46eac0);}},'beforeUpdate':function(_0x280553,_0x29d449,_0x116172){if(_0x280553[_0xd24b('0xe')](_0xd24b('0x15'))||_0x280553[_0xd24b('0xe')](_0xd24b('0xf'))||_0x280553[_0xd24b('0xe')](_0xd24b('0x10'))||_0x280553[_0xd24b('0xe')](_0xd24b('0x11'))||_0x280553[_0xd24b('0xe')](_0xd24b('0x12'))||_0x280553['changed'](_0xd24b('0x26'))){var _0x5d3288,_0xce9dc3;_0x5d3288=_0x280553[_0xd24b('0xf')];var _0x701610=_0x5d3288['slice'](-0x1);if(_0x701610==='/'||_0x701610==='\x5c'||_0x701610===':'){_0x5d3288=_0x5d3288[_0xd24b('0x14')](0x0,_0x5d3288[_0xd24b('0x27')](_0x701610));}switch(_0x280553[_0xd24b('0x15')]){case'US':_0xce9dc3=_0xd24b('0x16');break;case'AU':_0xce9dc3=_0xd24b('0x17');break;case'IN':_0xce9dc3=_0xd24b('0x18');break;case'CN':_0xce9dc3=_0xd24b('0x19');break;default:_0xce9dc3='https://accounts.zoho.eu';break;}var _0x5a863e={'method':'POST','uri':_0xce9dc3+_0xd24b('0x28'),'form':{'grant_type':_0xd24b('0x29'),'client_id':_0x280553[_0xd24b('0x10')],'client_secret':_0x280553[_0xd24b('0x11')],'redirect_uri':_0x280553[_0xd24b('0xf')],'code':_0x280553[_0xd24b('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5a863e)[_0xd24b('0x1c')](function(_0x315da2){var _0x44c03c=JSON[_0xd24b('0x1d')](_0x315da2);if(_0x44c03c[_0xd24b('0x1e')]){_0x280553['refreshToken']=_0x44c03c[_0xd24b('0x1e')];logger['info'](util[_0xd24b('0x23')](_0xd24b('0x20'),_0x280553[_0xd24b('0x21')],_0x280553['id']));}else{logger['error'](util[_0xd24b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x280553[_0xd24b('0x21')],_0x280553['id']),util[_0xd24b('0x25')](_0x44c03c,{'showHidden':![],'depth':null}));}return _0x116172(null,_0x29d449);})[_0xd24b('0x2a')](function(_0x1ed001){logger['error'](util[_0xd24b('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x280553[_0xd24b('0x21')],_0x280553['id']),util[_0xd24b('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x116172(_0x1ed001);});}else{return _0x116172(null,_0x29d449);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8b12fb8..bfffa36 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 _0xdf55=['ZohoAccount,\x20%s,\x20%s','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdf55,0x83));var _0x5df5=function(_0x57120e,_0x427d2d){_0x57120e=_0x57120e-0x0;var _0x1539f5=_0xdf55[_0x57120e];return _0x1539f5;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['ZohoAccount'][_0x5df5('0x17')]({'raw':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'attributes':_0xb7e1c2['options']?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1c')]||null:null,'include':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2['options'][_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x5ca542){return{'model':db[_0x5ca542[_0x5df5('0x1f')]],'as':_0x5ca542['as'],'attributes':_0x5ca542[_0x5df5('0x1b')],'include':_0x5ca542[_0x5df5('0x1d')]?_['map'](_0x5ca542['include'],function(_0x532923){return{'model':db[_0x532923[_0x5df5('0x1f')]],'as':_0x532923['as'],'attributes':_0x532923[_0x5df5('0x1b')],'include':_0x532923[_0x5df5('0x1d')]?_[_0x5df5('0x1e')](_0x532923[_0x5df5('0x1d')],function(_0x1fd83c){return{'model':db[_0x1fd83c[_0x5df5('0x1f')]],'as':_0x1fd83c['as'],'attributes':_0x1fd83c[_0x5df5('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18bb61){logger['info'](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x20')]('GetZohoAccount',_0xb7e1c2,JSON[_0x5df5('0x21')](_0x18bb61));_0x215d59(_0x18bb61);})['catch'](function(_0xd2b213){logger['error'](_0x5df5('0x16'),_0xd2b213['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0xd2b213['message']));});});};exports[_0x5df5('0x22')]=function(_0x47bebb){var _0x4784ca=this;return new Promise(function(_0x485484,_0xf445de){return db[_0x5df5('0x23')][_0x5df5('0x24')]({'raw':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'where':_0x47bebb[_0x5df5('0x18')]?_0x47bebb['options']['where']||null:null,'attributes':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null,'include':_0x47bebb[_0x5df5('0x18')]?_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')]?_['map'](_0x47bebb[_0x5df5('0x18')][_0x5df5('0x1d')],function(_0x2f1001){return{'model':db[_0x2f1001[_0x5df5('0x1f')]],'as':_0x2f1001['as'],'attributes':_0x2f1001['attributes'],'include':_0x2f1001[_0x5df5('0x1d')]?_['map'](_0x2f1001[_0x5df5('0x1d')],function(_0x394676){return{'model':db[_0x394676['model']],'as':_0x394676['as'],'attributes':_0x394676[_0x5df5('0x1b')],'include':_0x394676['include']?_[_0x5df5('0x1e')](_0x394676[_0x5df5('0x1d')],function(_0x4697c2){return{'model':db[_0x4697c2[_0x5df5('0x1f')]],'as':_0x4697c2['as'],'attributes':_0x4697c2['attributes']};}):[]};}):[]};}):[]:[]})[_0x5df5('0xc')](function(_0x2e7e64){logger[_0x5df5('0x13')](_0x5df5('0x22'),_0x47bebb);logger['debug'](_0x5df5('0x22'),_0x47bebb,JSON[_0x5df5('0x21')](_0x2e7e64));_0x485484(_0x2e7e64);})[_0x5df5('0x15')](function(_0x18b597){logger[_0x5df5('0xf')](_0x5df5('0x22'),_0x18b597[_0x5df5('0x12')],_0x47bebb);_0xf445de(_0x4784ca['error'](0x1f4,_0x18b597[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0xed5c=['client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','then','stringify','ShowZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x49e10a,_0x506386){var _0xc31416=function(_0x31fb3c){while(--_0x31fb3c){_0x49e10a['push'](_0x49e10a['shift']());}};_0xc31416(++_0x506386);}(_0xed5c,0x81));var _0xced5=function(_0x32f69a,_0x43e98a){_0x32f69a=_0x32f69a-0x0;var _0x4e8374=_0xed5c[_0x32f69a];return _0x4e8374;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require(_0xced5('0x3'));var rs=require(_0xced5('0x4'));var fs=require('fs');var Redis=require(_0xced5('0x5'));var db=require(_0xced5('0x6'))['db'];var utils=require(_0xced5('0x7'));var logger=require(_0xced5('0x8'))(_0xced5('0x9'));var config=require('../../config/environment');var jayson=require(_0xced5('0xa'));var client=jayson[_0xced5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c59d1,_0x31a495,_0xc738da){return new BPromise(function(_0x2857d8,_0x2113e4){return client[_0xced5('0xc')](_0x5c59d1,_0xc738da)['then'](function(_0x50d620){logger[_0xced5('0xd')](_0xced5('0xe'),_0x31a495,_0xced5('0xf'));logger[_0xced5('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x31a495,_0xced5('0xf'),JSON['stringify'](_0x50d620));if(_0x50d620[_0xced5('0x11')]){if(_0x50d620[_0xced5('0x11')]['code']===0x1f4){logger[_0xced5('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x31a495,_0x50d620[_0xced5('0x11')][_0xced5('0x12')]);return _0x2113e4(_0x50d620[_0xced5('0x11')][_0xced5('0x12')]);}logger[_0xced5('0x11')](_0xced5('0xe'),_0x31a495,_0x50d620[_0xced5('0x11')]['message']);return _0x2857d8(_0x50d620['error'][_0xced5('0x12')]);}else{logger[_0xced5('0xd')](_0xced5('0xe'),_0x31a495,'request\x20sent');_0x2857d8(_0x50d620['result'][_0xced5('0x12')]);}})[_0xced5('0x13')](function(_0x3e1dfc){logger[_0xced5('0x11')](_0xced5('0xe'),_0x31a495,_0x3e1dfc);_0x2113e4(_0x3e1dfc);});});}exports[_0xced5('0x14')]=function(_0x54c5a4){var _0x29a3ba=this;return new Promise(function(_0x153e29,_0x5d1615){return db[_0xced5('0x15')][_0xced5('0x16')]({'raw':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4['options'][_0xced5('0x18')]===undefined?!![]:![]:!![],'where':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')]['where']||null:null,'attributes':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')][_0xced5('0x19')]||null:null,'limit':_0x54c5a4[_0xced5('0x17')]?_0x54c5a4[_0xced5('0x17')][_0xced5('0x1a')]||null:null,'include':_0x54c5a4['options']?_0x54c5a4[_0xced5('0x17')][_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x54c5a4[_0xced5('0x17')][_0xced5('0x1b')],function(_0x18f299){return{'model':db[_0x18f299[_0xced5('0x1d')]],'as':_0x18f299['as'],'attributes':_0x18f299[_0xced5('0x19')],'include':_0x18f299[_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x18f299[_0xced5('0x1b')],function(_0x2f092b){return{'model':db[_0x2f092b[_0xced5('0x1d')]],'as':_0x2f092b['as'],'attributes':_0x2f092b[_0xced5('0x19')],'include':_0x2f092b['include']?_['map'](_0x2f092b[_0xced5('0x1b')],function(_0x2cd6c4){return{'model':db[_0x2cd6c4[_0xced5('0x1d')]],'as':_0x2cd6c4['as'],'attributes':_0x2cd6c4[_0xced5('0x19')]};}):[]};}):[]};}):[]:[]})[_0xced5('0x1e')](function(_0x26790a){logger[_0xced5('0xd')](_0xced5('0x14'),_0x54c5a4);logger[_0xced5('0x10')](_0xced5('0x14'),_0x54c5a4,JSON[_0xced5('0x1f')](_0x26790a));_0x153e29(_0x26790a);})['catch'](function(_0x20aa83){logger[_0xced5('0x11')]('GetZohoAccount',_0x20aa83['message'],_0x54c5a4);_0x5d1615(_0x29a3ba['error'](0x1f4,_0x20aa83['message']));});});};exports[_0xced5('0x20')]=function(_0x2f7cd4){var _0x9d2fee=this;return new Promise(function(_0x409ff4,_0xd502de){return db['ZohoAccount'][_0xced5('0x21')]({'raw':_0x2f7cd4['options']?_0x2f7cd4[_0xced5('0x17')][_0xced5('0x18')]===undefined?!![]:![]:!![],'where':_0x2f7cd4['options']?_0x2f7cd4['options'][_0xced5('0x22')]||null:null,'attributes':_0x2f7cd4['options']?_0x2f7cd4[_0xced5('0x17')][_0xced5('0x19')]||null:null,'include':_0x2f7cd4[_0xced5('0x17')]?_0x2f7cd4[_0xced5('0x17')][_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x2f7cd4[_0xced5('0x17')]['include'],function(_0x1f49b5){return{'model':db[_0x1f49b5[_0xced5('0x1d')]],'as':_0x1f49b5['as'],'attributes':_0x1f49b5['attributes'],'include':_0x1f49b5[_0xced5('0x1b')]?_[_0xced5('0x1c')](_0x1f49b5['include'],function(_0x288ab0){return{'model':db[_0x288ab0[_0xced5('0x1d')]],'as':_0x288ab0['as'],'attributes':_0x288ab0['attributes'],'include':_0x288ab0[_0xced5('0x1b')]?_['map'](_0x288ab0[_0xced5('0x1b')],function(_0x4f64a4){return{'model':db[_0x4f64a4[_0xced5('0x1d')]],'as':_0x4f64a4['as'],'attributes':_0x4f64a4[_0xced5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ba805){logger[_0xced5('0xd')](_0xced5('0x20'),_0x2f7cd4);logger['debug'](_0xced5('0x20'),_0x2f7cd4,JSON[_0xced5('0x1f')](_0x5ba805));_0x409ff4(_0x5ba805);})['catch'](function(_0x43c1d8){logger[_0xced5('0x11')](_0xced5('0x20'),_0x43c1d8['message'],_0x2f7cd4);_0xd502de(_0x9d2fee[_0xced5('0x11')](0x1f4,_0x43c1d8[_0xced5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 875e02a..3bde860 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 _0x8d5a=['isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x164ef0,_0x3e2f09){var _0x3415e=function(_0x45bc93){while(--_0x45bc93){_0x164ef0['push'](_0x164ef0['shift']());}};_0x3415e(++_0x3e2f09);}(_0x8d5a,0x1d8));var _0xa8d5=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x8d5a[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0xa8d5('0x0'));var util=require(_0xa8d5('0x1'));var path=require(_0xa8d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8d5('0x3'));var router=express[_0xa8d5('0x4')]();var fs_extra=require(_0xa8d5('0x5'));var auth=require(_0xa8d5('0x6'));var interaction=require(_0xa8d5('0x7'));var config=require(_0xa8d5('0x8'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8d5('0x9')](_0xa8d5('0xa'),auth[_0xa8d5('0xb')](),controller['show']);router[_0xa8d5('0x9')](_0xa8d5('0xc'),auth[_0xa8d5('0xb')](),controller[_0xa8d5('0xd')]);router[_0xa8d5('0x9')]('/:id/subjects',auth[_0xa8d5('0xb')](),controller['getSubjects']);router[_0xa8d5('0x9')](_0xa8d5('0xe'),auth['isAuthenticated'](),controller[_0xa8d5('0xf')]);router[_0xa8d5('0x10')]('/',auth[_0xa8d5('0xb')](),controller['create']);router[_0xa8d5('0x11')](_0xa8d5('0xa'),auth[_0xa8d5('0xb')](),controller[_0xa8d5('0x12')]);router['delete'](_0xa8d5('0xa'),auth['isAuthenticated'](),controller[_0xa8d5('0x13')]);module[_0xa8d5('0x14')]=router; \ No newline at end of file +var _0x614d=['../../components/interaction/service','get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4c4683,_0x241657){var _0x78ee7e=function(_0x4c9489){while(--_0x4c9489){_0x4c4683['push'](_0x4c4683['shift']());}};_0x78ee7e(++_0x241657);}(_0x614d,0x1ee));var _0xd614=function(_0x2a370c,_0x37bc17){_0x2a370c=_0x2a370c-0x0;var _0x5c4621=_0x614d[_0x2a370c];return _0x5c4621;};'use strict';var multer=require(_0xd614('0x0'));var util=require(_0xd614('0x1'));var path=require(_0xd614('0x2'));var timeout=require(_0xd614('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd614('0x4'));var auth=require(_0xd614('0x5'));var interaction=require(_0xd614('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xd614('0x7')]('/',auth['isAuthenticated'](),controller[_0xd614('0x8')]);router[_0xd614('0x7')](_0xd614('0x9'),auth['isAuthenticated'](),controller[_0xd614('0xa')]);router[_0xd614('0x7')](_0xd614('0xb'),auth['isAuthenticated'](),controller[_0xd614('0xc')]);router[_0xd614('0x7')](_0xd614('0xd'),auth[_0xd614('0xe')](),controller[_0xd614('0xf')]);router[_0xd614('0x7')](_0xd614('0x10'),auth[_0xd614('0xe')](),controller[_0xd614('0x11')]);router[_0xd614('0x12')]('/',auth['isAuthenticated'](),controller[_0xd614('0x13')]);router[_0xd614('0x14')](_0xd614('0x9'),auth[_0xd614('0xe')](),controller[_0xd614('0x15')]);router[_0xd614('0x16')](_0xd614('0x9'),auth[_0xd614('0xe')](),controller[_0xd614('0x17')]);module[_0xd614('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 36ddeb1..d9be6e8 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 _0x77aa=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0xbcdc22,_0x1e50f7){var _0x358688=function(_0x41c020){while(--_0x41c020){_0xbcdc22['push'](_0xbcdc22['shift']());}};_0x358688(++_0x1e50f7);}(_0x77aa,0x126));var _0xa77a=function(_0xdf81fe,_0x7944e7){_0xdf81fe=_0xdf81fe-0x0;var _0x4145ce=_0x77aa[_0xdf81fe];return _0x4145ce;};'use strict';var Sequelize=require(_0xa77a('0x0'));module[_0xa77a('0x1')]={'name':{'type':Sequelize[_0xa77a('0x2')]},'moduleCreate':{'type':Sequelize[_0xa77a('0x3')](_0xa77a('0x4'),_0xa77a('0x5'),_0xa77a('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa77a('0x3')](_0xa77a('0x7'),'contact','lead'),'defaultValue':_0xa77a('0x7')},'description':{'type':Sequelize[_0xa77a('0x2')]}}; \ No newline at end of file +var _0x5a01=['contact','nothing','ENUM','contact_lead','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5a01,0x1af));var _0x15a0=function(_0x108831,_0x5e4f70){_0x108831=_0x108831-0x0;var _0x4da77a=_0x5a01[_0x108831];return _0x4da77a;};'use strict';var Sequelize=require(_0x15a0('0x0'));module[_0x15a0('0x1')]={'name':{'type':Sequelize[_0x15a0('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x15a0('0x3'),_0x15a0('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x15a0('0x5')](_0x15a0('0x6'),_0x15a0('0x3'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x15a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 392fabd..99118d2 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 _0xdcd6=['fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xdcd6,0x114));var _0x6dcd=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0xdcd6[_0x1e0c0e];return _0x53fecc;};'use strict';var emlformat=require(_0x6dcd('0x0'));var rimraf=require(_0x6dcd('0x1'));var zipdir=require(_0x6dcd('0x2'));var jsonpatch=require(_0x6dcd('0x3'));var rp=require(_0x6dcd('0x4'));var moment=require(_0x6dcd('0x5'));var BPromise=require(_0x6dcd('0x6'));var Mustache=require(_0x6dcd('0x7'));var util=require(_0x6dcd('0x8'));var path=require(_0x6dcd('0x9'));var sox=require(_0x6dcd('0xa'));var csv=require(_0x6dcd('0xb'));var ejs=require(_0x6dcd('0xc'));var fs=require('fs');var fs_extra=require(_0x6dcd('0xd'));var _=require(_0x6dcd('0xe'));var squel=require(_0x6dcd('0xf'));var crypto=require(_0x6dcd('0x10'));var jsforce=require(_0x6dcd('0x11'));var deskjs=require(_0x6dcd('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6dcd('0x13'));var Papa=require(_0x6dcd('0x14'));var Redis=require(_0x6dcd('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x6dcd('0x16'));var as=require(_0x6dcd('0x17'));var hardwareService=require(_0x6dcd('0x18'));var logger=require(_0x6dcd('0x19'))(_0x6dcd('0x1a'));var utils=require(_0x6dcd('0x1b'));var config=require(_0x6dcd('0x1c'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x110d70,_0x2a3b4a){_0x2a3b4a=_0x2a3b4a||0xcc;return function(_0x285689){if(_0x285689){return _0x110d70['sendStatus'](_0x2a3b4a);}return _0x110d70[_0x6dcd('0x1d')](_0x2a3b4a)[_0x6dcd('0x1e')]();};}function respondWithResult(_0x4197b2,_0xf88d15){_0xf88d15=_0xf88d15||0xc8;return function(_0x1bfe61){if(_0x1bfe61){return _0x4197b2[_0x6dcd('0x1d')](_0xf88d15)['json'](_0x1bfe61);}};}function respondWithFilteredResult(_0x3b194b,_0x5a6b70){return function(_0x3553c3){if(_0x3553c3){var _0x17660f=typeof _0x5a6b70[_0x6dcd('0x1f')]===_0x6dcd('0x20')&&typeof _0x5a6b70['limit']===_0x6dcd('0x20');var _0x5255c5=_0x3553c3[_0x6dcd('0x21')];var _0x3ead39=_0x17660f?0x0:_0x5a6b70[_0x6dcd('0x1f')];var _0x32439d=_0x17660f?_0x3553c3[_0x6dcd('0x21')]:_0x5a6b70[_0x6dcd('0x1f')]+_0x5a6b70['limit'];var _0x411ee8;if(_0x32439d>=_0x5255c5){_0x32439d=_0x5255c5;_0x411ee8=0xc8;}else{_0x411ee8=0xce;}_0x3b194b[_0x6dcd('0x1d')](_0x411ee8);return _0x3b194b[_0x6dcd('0x22')](_0x6dcd('0x23'),_0x3ead39+'-'+_0x32439d+'/'+_0x5255c5)['json'](_0x3553c3);}return null;};}function patchUpdates(_0x408d62){return function(_0x186224){try{jsonpatch[_0x6dcd('0x24')](_0x186224,_0x408d62,!![]);}catch(_0x4296d8){return BPromise[_0x6dcd('0x25')](_0x4296d8);}return _0x186224['save']();};}function saveUpdates(_0x1dab72,_0x2a6ed4){return function(_0x103b10){if(_0x103b10){return _0x103b10['update'](_0x1dab72)[_0x6dcd('0x26')](function(_0x2a384d){return _0x2a384d;});}return null;};}function removeEntity(_0x1d5281,_0x2670e1){return function(_0x42f7df){if(_0x42f7df){return _0x42f7df['destroy']()[_0x6dcd('0x26')](function(){_0x1d5281[_0x6dcd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3a55,_0x48c7e7){return function(_0x25e8b7){if(!_0x25e8b7){_0x5d3a55[_0x6dcd('0x27')](0x194);}return _0x25e8b7;};}function handleError(_0x1e5acd,_0x360740){_0x360740=_0x360740||0x1f4;return function(_0x1dabaa){logger[_0x6dcd('0x28')](_0x1dabaa[_0x6dcd('0x29')]);if(_0x1dabaa[_0x6dcd('0x2a')]){delete _0x1dabaa[_0x6dcd('0x2a')];}_0x1e5acd[_0x6dcd('0x1d')](_0x360740)[_0x6dcd('0x2b')](_0x1dabaa);};}exports[_0x6dcd('0x2c')]=function(_0x9579a7,_0x56625a){var _0x5839f9={},_0x87a314={},_0x79f8a4={'count':0x0,'rows':[]};var _0x50eb12=_[_0x6dcd('0x2d')](db[_0x6dcd('0x2e')][_0x6dcd('0x2f')],function(_0xdbacff){return{'name':_0xdbacff['fieldName'],'type':_0xdbacff[_0x6dcd('0x30')][_0x6dcd('0x31')]};});_0x87a314[_0x6dcd('0x32')]=_[_0x6dcd('0x2d')](_0x50eb12,_0x6dcd('0x2a'));_0x87a314[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x9579a7[_0x6dcd('0x33')]);_0x87a314[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x87a314[_0x6dcd('0x32')],_0x87a314['query']);_0x5839f9[_0x6dcd('0x37')]=_[_0x6dcd('0x36')](_0x87a314[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x9579a7[_0x6dcd('0x33')]['fields']));_0x5839f9['attributes']=_0x5839f9[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x5839f9[_0x6dcd('0x37')]:_0x87a314[_0x6dcd('0x32')];if(!_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x5839f9[_0x6dcd('0x3c')]=qs['limit'](_0x9579a7[_0x6dcd('0x33')]['limit']);_0x5839f9['offset']=qs[_0x6dcd('0x1f')](_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}_0x5839f9[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x5839f9[_0x6dcd('0x3f')]=qs['filters'](_[_0x6dcd('0x40')](_0x9579a7[_0x6dcd('0x33')],_0x87a314[_0x6dcd('0x35')]),_0x50eb12);if(_0x9579a7[_0x6dcd('0x33')][_0x6dcd('0x41')]){_0x5839f9['where']=_[_0x6dcd('0x42')](_0x5839f9[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x50eb12,function(_0x50322a){if(_0x50322a[_0x6dcd('0x30')]!=='VIRTUAL'){var _0x9a3eec={};_0x9a3eec[_0x50322a[_0x6dcd('0x2a')]]={'$like':'%'+_0x9579a7['query'][_0x6dcd('0x41')]+'%'};return _0x9a3eec;}})});}_0x5839f9=_[_0x6dcd('0x42')]({},_0x5839f9,_0x9579a7['options']);var _0x2e2d95={'where':_0x5839f9['where']};return db[_0x6dcd('0x2e')][_0x6dcd('0x21')](_0x2e2d95)[_0x6dcd('0x26')](function(_0x2abb32){_0x79f8a4['count']=_0x2abb32;if(_0x9579a7['query']['includeAll']){_0x5839f9[_0x6dcd('0x43')]=[{'all':!![]}];}return db[_0x6dcd('0x2e')][_0x6dcd('0x44')](_0x5839f9);})[_0x6dcd('0x26')](function(_0x229335){_0x79f8a4[_0x6dcd('0x45')]=_0x229335;return _0x79f8a4;})[_0x6dcd('0x26')](respondWithFilteredResult(_0x56625a,_0x5839f9))[_0x6dcd('0x46')](handleError(_0x56625a,null));};exports['show']=function(_0x37927c,_0x4ff25f){var _0x46c310={'raw':![],'where':{'id':_0x37927c[_0x6dcd('0x47')]['id']}},_0x1e6028={};_0x1e6028['model']=_[_0x6dcd('0x34')](db[_0x6dcd('0x2e')][_0x6dcd('0x2f')]);_0x1e6028[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x37927c[_0x6dcd('0x33')]);_0x1e6028[_0x6dcd('0x35')]=_['intersection'](_0x1e6028['model'],_0x1e6028[_0x6dcd('0x33')]);_0x46c310[_0x6dcd('0x37')]=_['intersection'](_0x1e6028[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x37927c[_0x6dcd('0x33')][_0x6dcd('0x38')]));_0x46c310[_0x6dcd('0x37')]=_0x46c310[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x46c310[_0x6dcd('0x37')]:_0x1e6028['model'];if(_0x37927c[_0x6dcd('0x33')][_0x6dcd('0x48')]){_0x46c310[_0x6dcd('0x43')]=[{'all':!![]}];}_0x46c310=_[_0x6dcd('0x42')]({},_0x46c310,_0x37927c[_0x6dcd('0x49')]);return db['ZohoConfiguration'][_0x6dcd('0x4a')](_0x46c310)['then'](handleEntityNotFound(_0x4ff25f,null))[_0x6dcd('0x26')](respondWithResult(_0x4ff25f,null))['catch'](handleError(_0x4ff25f,null));};exports[_0x6dcd('0x4b')]=function(_0x255cfc,_0x5dfa8d){return db[_0x6dcd('0x2e')][_0x6dcd('0x4b')](_0x255cfc[_0x6dcd('0x4c')],{})['then'](respondWithResult(_0x5dfa8d,0xc9))[_0x6dcd('0x46')](handleError(_0x5dfa8d,null));};exports[_0x6dcd('0x4d')]=function(_0x15d149,_0x1b6ace){if(_0x15d149['body']['id']){delete _0x15d149[_0x6dcd('0x4c')]['id'];}return db['ZohoConfiguration'][_0x6dcd('0x4a')]({'where':{'id':_0x15d149[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0x1b6ace,null))[_0x6dcd('0x26')](saveUpdates(_0x15d149[_0x6dcd('0x4c')],null))['then'](respondWithResult(_0x1b6ace,null))[_0x6dcd('0x46')](handleError(_0x1b6ace,null));};exports['destroy']=function(_0x4a2bf7,_0x4a63f7){return db[_0x6dcd('0x2e')][_0x6dcd('0x4a')]({'where':{'id':_0x4a2bf7['params']['id']}})['then'](handleEntityNotFound(_0x4a63f7,null))[_0x6dcd('0x26')](removeEntity(_0x4a63f7,null))[_0x6dcd('0x46')](handleError(_0x4a63f7,null));};exports[_0x6dcd('0x4e')]=function(_0x5ac012,_0xa6ad2,_0x3b0899){var _0x3426cf={};var _0x527ed8={};var _0x27b2e0;var _0x5658e0;return db[_0x6dcd('0x2e')][_0x6dcd('0x4f')]({'where':{'id':_0x5ac012[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0xa6ad2,null))[_0x6dcd('0x26')](function(_0x349c3f){if(_0x349c3f){_0x27b2e0=_0x349c3f;_0x527ed8[_0x6dcd('0x32')]=_[_0x6dcd('0x34')](db['ZohoField'][_0x6dcd('0x2f')]);_0x527ed8[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x5ac012[_0x6dcd('0x33')]);_0x527ed8[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x527ed8[_0x6dcd('0x32')],_0x527ed8[_0x6dcd('0x33')]);_0x3426cf['attributes']=_[_0x6dcd('0x36')](_0x527ed8[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x5ac012['query'][_0x6dcd('0x38')]));_0x3426cf['attributes']=_0x3426cf[_0x6dcd('0x37')][_0x6dcd('0x39')]?_0x3426cf[_0x6dcd('0x37')]:_0x527ed8[_0x6dcd('0x32')];_0x3426cf[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x3426cf['where']=qs[_0x6dcd('0x35')](_[_0x6dcd('0x40')](_0x5ac012['query'],_0x527ed8[_0x6dcd('0x35')]));if(_0x5ac012['query'][_0x6dcd('0x41')]){_0x3426cf[_0x6dcd('0x3f')]=_['merge'](_0x3426cf[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x3426cf[_0x6dcd('0x37')],function(_0x1d3091){var _0x1e5dda={};_0x1e5dda[_0x1d3091]={'$like':'%'+_0x5ac012['query'][_0x6dcd('0x41')]+'%'};return _0x1e5dda;})});}_0x3426cf=_['merge']({},_0x3426cf,_0x5ac012['options']);return _0x27b2e0[_0x6dcd('0x4e')](_0x3426cf);}})['then'](function(_0x11713a){if(_0x11713a){_0x5658e0=_0x11713a['length'];if(!_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x3426cf[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x5ac012['query'][_0x6dcd('0x3c')]);_0x3426cf[_0x6dcd('0x1f')]=qs[_0x6dcd('0x1f')](_0x5ac012[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}return _0x27b2e0[_0x6dcd('0x4e')](_0x3426cf);}})[_0x6dcd('0x26')](function(_0x232901){if(_0x232901){return _0x232901?{'count':_0x5658e0,'rows':_0x232901}:null;}})[_0x6dcd('0x26')](respondWithResult(_0xa6ad2,null))[_0x6dcd('0x46')](handleError(_0xa6ad2,null));};exports[_0x6dcd('0x50')]=function(_0x357bc0,_0x215e7a,_0x44261c){var _0x569057={};var _0x56270b={};var _0x300713;var _0x56c42b;return db['ZohoConfiguration'][_0x6dcd('0x4f')]({'where':{'id':_0x357bc0[_0x6dcd('0x47')]['id']}})[_0x6dcd('0x26')](handleEntityNotFound(_0x215e7a,null))[_0x6dcd('0x26')](function(_0x21f476){if(_0x21f476){_0x300713=_0x21f476;_0x56270b['model']=_[_0x6dcd('0x34')](db[_0x6dcd('0x51')][_0x6dcd('0x2f')]);_0x56270b['query']=_[_0x6dcd('0x34')](_0x357bc0[_0x6dcd('0x33')]);_0x56270b['filters']=_[_0x6dcd('0x36')](_0x56270b[_0x6dcd('0x32')],_0x56270b['query']);_0x569057['attributes']=_[_0x6dcd('0x36')](_0x56270b[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x38')]));_0x569057[_0x6dcd('0x37')]=_0x569057['attributes']['length']?_0x569057['attributes']:_0x56270b[_0x6dcd('0x32')];_0x569057[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x357bc0['query'][_0x6dcd('0x3e')]);_0x569057['where']=qs[_0x6dcd('0x35')](_[_0x6dcd('0x40')](_0x357bc0[_0x6dcd('0x33')],_0x56270b[_0x6dcd('0x35')]));if(_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x41')]){_0x569057['where']=_[_0x6dcd('0x42')](_0x569057[_0x6dcd('0x3f')],{'$or':_[_0x6dcd('0x2d')](_0x569057[_0x6dcd('0x37')],function(_0x48afe7){var _0x5cabb2={};_0x5cabb2[_0x48afe7]={'$like':'%'+_0x357bc0['query']['filter']+'%'};return _0x5cabb2;})});}_0x569057=_[_0x6dcd('0x42')]({},_0x569057,_0x357bc0[_0x6dcd('0x49')]);return _0x300713[_0x6dcd('0x50')](_0x569057);}})[_0x6dcd('0x26')](function(_0x49c3dd){if(_0x49c3dd){_0x56c42b=_0x49c3dd['length'];if(!_0x357bc0[_0x6dcd('0x33')][_0x6dcd('0x3a')](_0x6dcd('0x3b'))){_0x569057[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x357bc0[_0x6dcd('0x33')]['limit']);_0x569057[_0x6dcd('0x1f')]=qs[_0x6dcd('0x1f')](_0x357bc0[_0x6dcd('0x33')]['offset']);}return _0x300713[_0x6dcd('0x50')](_0x569057);}})[_0x6dcd('0x26')](function(_0x5849e6){if(_0x5849e6){return _0x5849e6?{'count':_0x56c42b,'rows':_0x5849e6}:null;}})[_0x6dcd('0x26')](respondWithResult(_0x215e7a,null))[_0x6dcd('0x46')](handleError(_0x215e7a,null));};exports['getDescriptions']=function(_0x1d300a,_0x4d81aa,_0x14e195){var _0x2ba0b9={};var _0x12f8c5={};var _0x5086e2;var _0x5acbde;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x1d300a[_0x6dcd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d81aa,null))['then'](function(_0x4fb82e){if(_0x4fb82e){_0x5086e2=_0x4fb82e;_0x12f8c5['model']=_['keys'](db[_0x6dcd('0x51')][_0x6dcd('0x2f')]);_0x12f8c5[_0x6dcd('0x33')]=_[_0x6dcd('0x34')](_0x1d300a[_0x6dcd('0x33')]);_0x12f8c5[_0x6dcd('0x35')]=_[_0x6dcd('0x36')](_0x12f8c5['model'],_0x12f8c5[_0x6dcd('0x33')]);_0x2ba0b9[_0x6dcd('0x37')]=_[_0x6dcd('0x36')](_0x12f8c5[_0x6dcd('0x32')],qs[_0x6dcd('0x38')](_0x1d300a['query'][_0x6dcd('0x38')]));_0x2ba0b9[_0x6dcd('0x37')]=_0x2ba0b9['attributes'][_0x6dcd('0x39')]?_0x2ba0b9[_0x6dcd('0x37')]:_0x12f8c5[_0x6dcd('0x32')];_0x2ba0b9[_0x6dcd('0x3d')]=qs[_0x6dcd('0x3e')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x3e')]);_0x2ba0b9['where']=qs[_0x6dcd('0x35')](_['pick'](_0x1d300a[_0x6dcd('0x33')],_0x12f8c5['filters']));if(_0x1d300a[_0x6dcd('0x33')]['filter']){_0x2ba0b9[_0x6dcd('0x3f')]=_[_0x6dcd('0x42')](_0x2ba0b9['where'],{'$or':_[_0x6dcd('0x2d')](_0x2ba0b9[_0x6dcd('0x37')],function(_0x4d981c){var _0x1ed96c={};_0x1ed96c[_0x4d981c]={'$like':'%'+_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x41')]+'%'};return _0x1ed96c;})});}_0x2ba0b9=_[_0x6dcd('0x42')]({},_0x2ba0b9,_0x1d300a[_0x6dcd('0x49')]);return _0x5086e2[_0x6dcd('0x52')](_0x2ba0b9);}})[_0x6dcd('0x26')](function(_0x5af063){if(_0x5af063){_0x5acbde=_0x5af063['length'];if(!_0x1d300a[_0x6dcd('0x33')]['hasOwnProperty'](_0x6dcd('0x3b'))){_0x2ba0b9[_0x6dcd('0x3c')]=qs[_0x6dcd('0x3c')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x3c')]);_0x2ba0b9['offset']=qs[_0x6dcd('0x1f')](_0x1d300a[_0x6dcd('0x33')][_0x6dcd('0x1f')]);}return _0x5086e2[_0x6dcd('0x52')](_0x2ba0b9);}})[_0x6dcd('0x26')](function(_0x2b89b0){if(_0x2b89b0){return _0x2b89b0?{'count':_0x5acbde,'rows':_0x2b89b0}:null;}})['then'](respondWithResult(_0x4d81aa,null))[_0x6dcd('0x46')](handleError(_0x4d81aa,null));}; \ No newline at end of file +var _0x3507=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x3507,0x169));var _0x7350=function(_0x4cb095,_0x58da07){_0x4cb095=_0x4cb095-0x0;var _0x2b565d=_0x3507[_0x4cb095];return _0x2b565d;};'use strict';var emlformat=require(_0x7350('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7350('0x1'));var jsonpatch=require(_0x7350('0x2'));var rp=require(_0x7350('0x3'));var moment=require('moment');var BPromise=require(_0x7350('0x4'));var Mustache=require(_0x7350('0x5'));var util=require(_0x7350('0x6'));var path=require(_0x7350('0x7'));var sox=require(_0x7350('0x8'));var csv=require(_0x7350('0x9'));var ejs=require(_0x7350('0xa'));var fs=require('fs');var fs_extra=require(_0x7350('0xb'));var _=require(_0x7350('0xc'));var squel=require('squel');var crypto=require(_0x7350('0xd'));var jsforce=require(_0x7350('0xe'));var deskjs=require(_0x7350('0xf'));var toCsv=require(_0x7350('0x9'));var querystring=require(_0x7350('0x10'));var Papa=require(_0x7350('0x11'));var Redis=require(_0x7350('0x12'));var authService=require(_0x7350('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7350('0x14'));var hardwareService=require(_0x7350('0x15'));var logger=require('../../config/logger')(_0x7350('0x16'));var utils=require(_0x7350('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7350('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a6b89,_0x86e26f){_0x86e26f=_0x86e26f||0xcc;return function(_0x2b4bd6){if(_0x2b4bd6){return _0x4a6b89['sendStatus'](_0x86e26f);}return _0x4a6b89[_0x7350('0x19')](_0x86e26f)[_0x7350('0x1a')]();};}function respondWithResult(_0x4593dd,_0x8f9284){_0x8f9284=_0x8f9284||0xc8;return function(_0x3b2c14){if(_0x3b2c14){return _0x4593dd[_0x7350('0x19')](_0x8f9284)[_0x7350('0x1b')](_0x3b2c14);}};}function respondWithFilteredResult(_0x563073,_0x4a7cc3){return function(_0x55b653){if(_0x55b653){var _0xc55cf=typeof _0x4a7cc3[_0x7350('0x1c')]==='undefined'&&typeof _0x4a7cc3[_0x7350('0x1d')]===_0x7350('0x1e');var _0x985e1e=_0x55b653[_0x7350('0x1f')];var _0x5dc356=_0xc55cf?0x0:_0x4a7cc3[_0x7350('0x1c')];var _0x1f1e79=_0xc55cf?_0x55b653[_0x7350('0x1f')]:_0x4a7cc3['offset']+_0x4a7cc3[_0x7350('0x1d')];var _0xa47278;if(_0x1f1e79>=_0x985e1e){_0x1f1e79=_0x985e1e;_0xa47278=0xc8;}else{_0xa47278=0xce;}_0x563073[_0x7350('0x19')](_0xa47278);return _0x563073[_0x7350('0x20')](_0x7350('0x21'),_0x5dc356+'-'+_0x1f1e79+'/'+_0x985e1e)[_0x7350('0x1b')](_0x55b653);}return null;};}function patchUpdates(_0x2a1f64){return function(_0x105a15){try{jsonpatch[_0x7350('0x22')](_0x105a15,_0x2a1f64,!![]);}catch(_0x41b562){return BPromise['reject'](_0x41b562);}return _0x105a15[_0x7350('0x23')]();};}function saveUpdates(_0xc4aac8,_0xecbe96){return function(_0x291d28){if(_0x291d28){return _0x291d28[_0x7350('0x24')](_0xc4aac8)['then'](function(_0x3b7ab9){return _0x3b7ab9;});}return null;};}function removeEntity(_0x5beb73,_0xdf8e48){return function(_0x4b3f7b){if(_0x4b3f7b){return _0x4b3f7b['destroy']()[_0x7350('0x25')](function(){_0x5beb73['status'](0xcc)[_0x7350('0x1a')]();});}};}function handleEntityNotFound(_0x2a719d,_0x8e1a2a){return function(_0x5d2dfd){if(!_0x5d2dfd){_0x2a719d[_0x7350('0x26')](0x194);}return _0x5d2dfd;};}function handleError(_0x5ef0bd,_0x319624){_0x319624=_0x319624||0x1f4;return function(_0x5a14fc){logger[_0x7350('0x27')](_0x5a14fc[_0x7350('0x28')]);if(_0x5a14fc[_0x7350('0x29')]){delete _0x5a14fc[_0x7350('0x29')];}_0x5ef0bd['status'](_0x319624)[_0x7350('0x2a')](_0x5a14fc);};}exports[_0x7350('0x2b')]=function(_0x490a36,_0x7e7e6a){var _0x1792c0={},_0x52014e={},_0x13623a={'count':0x0,'rows':[]};var _0x4e2f50=_[_0x7350('0x2c')](db[_0x7350('0x2d')][_0x7350('0x2e')],function(_0x1026cc){return{'name':_0x1026cc[_0x7350('0x2f')],'type':_0x1026cc[_0x7350('0x30')][_0x7350('0x31')]};});_0x52014e[_0x7350('0x32')]=_[_0x7350('0x2c')](_0x4e2f50,'name');_0x52014e[_0x7350('0x33')]=_['keys'](_0x490a36[_0x7350('0x33')]);_0x52014e[_0x7350('0x34')]=_[_0x7350('0x35')](_0x52014e[_0x7350('0x32')],_0x52014e[_0x7350('0x33')]);_0x1792c0[_0x7350('0x36')]=_[_0x7350('0x35')](_0x52014e[_0x7350('0x32')],qs[_0x7350('0x37')](_0x490a36[_0x7350('0x33')][_0x7350('0x37')]));_0x1792c0[_0x7350('0x36')]=_0x1792c0['attributes'][_0x7350('0x38')]?_0x1792c0[_0x7350('0x36')]:_0x52014e[_0x7350('0x32')];if(!_0x490a36[_0x7350('0x33')][_0x7350('0x39')](_0x7350('0x3a'))){_0x1792c0['limit']=qs[_0x7350('0x1d')](_0x490a36[_0x7350('0x33')][_0x7350('0x1d')]);_0x1792c0['offset']=qs[_0x7350('0x1c')](_0x490a36[_0x7350('0x33')][_0x7350('0x1c')]);}_0x1792c0[_0x7350('0x3b')]=qs[_0x7350('0x3c')](_0x490a36[_0x7350('0x33')][_0x7350('0x3c')]);_0x1792c0[_0x7350('0x3d')]=qs['filters'](_[_0x7350('0x3e')](_0x490a36[_0x7350('0x33')],_0x52014e[_0x7350('0x34')]),_0x4e2f50);if(_0x490a36['query'][_0x7350('0x3f')]){_0x1792c0[_0x7350('0x3d')]=_['merge'](_0x1792c0[_0x7350('0x3d')],{'$or':_[_0x7350('0x2c')](_0x4e2f50,function(_0x1c798b){if(_0x1c798b[_0x7350('0x30')]!==_0x7350('0x40')){var _0x2895bc={};_0x2895bc[_0x1c798b[_0x7350('0x29')]]={'$like':'%'+_0x490a36[_0x7350('0x33')]['filter']+'%'};return _0x2895bc;}})});}_0x1792c0=_[_0x7350('0x41')]({},_0x1792c0,_0x490a36[_0x7350('0x42')]);var _0x125ec4={'where':_0x1792c0['where']};return db[_0x7350('0x2d')][_0x7350('0x1f')](_0x125ec4)[_0x7350('0x25')](function(_0x11b481){_0x13623a[_0x7350('0x1f')]=_0x11b481;if(_0x490a36[_0x7350('0x33')][_0x7350('0x43')]){_0x1792c0[_0x7350('0x44')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x7350('0x45')](_0x1792c0);})[_0x7350('0x25')](function(_0xcade23){_0x13623a[_0x7350('0x46')]=_0xcade23;return _0x13623a;})['then'](respondWithFilteredResult(_0x7e7e6a,_0x1792c0))[_0x7350('0x47')](handleError(_0x7e7e6a,null));};exports[_0x7350('0x48')]=function(_0x4f2927,_0x4347d7){var _0x4cc1b3={'raw':![],'where':{'id':_0x4f2927[_0x7350('0x49')]['id']}},_0x30f0dd={};_0x30f0dd['model']=_[_0x7350('0x4a')](db[_0x7350('0x2d')][_0x7350('0x2e')]);_0x30f0dd['query']=_[_0x7350('0x4a')](_0x4f2927[_0x7350('0x33')]);_0x30f0dd['filters']=_[_0x7350('0x35')](_0x30f0dd[_0x7350('0x32')],_0x30f0dd[_0x7350('0x33')]);_0x4cc1b3[_0x7350('0x36')]=_[_0x7350('0x35')](_0x30f0dd[_0x7350('0x32')],qs[_0x7350('0x37')](_0x4f2927[_0x7350('0x33')]['fields']));_0x4cc1b3[_0x7350('0x36')]=_0x4cc1b3['attributes']['length']?_0x4cc1b3[_0x7350('0x36')]:_0x30f0dd['model'];if(_0x4f2927['query'][_0x7350('0x43')]){_0x4cc1b3[_0x7350('0x44')]=[{'all':!![]}];}_0x4cc1b3=_[_0x7350('0x41')]({},_0x4cc1b3,_0x4f2927['options']);return db[_0x7350('0x2d')][_0x7350('0x4b')](_0x4cc1b3)[_0x7350('0x25')](handleEntityNotFound(_0x4347d7,null))[_0x7350('0x25')](respondWithResult(_0x4347d7,null))[_0x7350('0x47')](handleError(_0x4347d7,null));};exports[_0x7350('0x4c')]=function(_0x29b036,_0x2df082){return db[_0x7350('0x2d')]['create'](_0x29b036[_0x7350('0x4d')],{})[_0x7350('0x25')](respondWithResult(_0x2df082,0xc9))['catch'](handleError(_0x2df082,null));};exports[_0x7350('0x24')]=function(_0x52ed13,_0x55b64a){if(_0x52ed13['body']['id']){delete _0x52ed13['body']['id'];}return db[_0x7350('0x2d')]['find']({'where':{'id':_0x52ed13['params']['id']}})['then'](handleEntityNotFound(_0x55b64a,null))[_0x7350('0x25')](saveUpdates(_0x52ed13[_0x7350('0x4d')],null))[_0x7350('0x25')](respondWithResult(_0x55b64a,null))[_0x7350('0x47')](handleError(_0x55b64a,null));};exports[_0x7350('0x4e')]=function(_0x214834,_0x19186a){return db[_0x7350('0x2d')][_0x7350('0x4b')]({'where':{'id':_0x214834[_0x7350('0x49')]['id']}})[_0x7350('0x25')](handleEntityNotFound(_0x19186a,null))[_0x7350('0x25')](removeEntity(_0x19186a,null))[_0x7350('0x47')](handleError(_0x19186a,null));};exports['getFields']=function(_0x413ac2,_0x812f04,_0x2f4897){var _0x25fcbc={};var _0x5fb497={};var _0x5eb158;var _0x20f271;return db[_0x7350('0x2d')][_0x7350('0x4f')]({'where':{'id':_0x413ac2[_0x7350('0x49')]['id']}})[_0x7350('0x25')](handleEntityNotFound(_0x812f04,null))[_0x7350('0x25')](function(_0x1f4ec6){if(_0x1f4ec6){_0x5eb158=_0x1f4ec6;_0x5fb497[_0x7350('0x32')]=_['keys'](db[_0x7350('0x50')]['rawAttributes']);_0x5fb497[_0x7350('0x33')]=_[_0x7350('0x4a')](_0x413ac2[_0x7350('0x33')]);_0x5fb497[_0x7350('0x34')]=_[_0x7350('0x35')](_0x5fb497['model'],_0x5fb497['query']);_0x25fcbc[_0x7350('0x36')]=_[_0x7350('0x35')](_0x5fb497[_0x7350('0x32')],qs['fields'](_0x413ac2['query'][_0x7350('0x37')]));_0x25fcbc[_0x7350('0x36')]=_0x25fcbc[_0x7350('0x36')]['length']?_0x25fcbc[_0x7350('0x36')]:_0x5fb497['model'];_0x25fcbc[_0x7350('0x3b')]=qs[_0x7350('0x3c')](_0x413ac2[_0x7350('0x33')][_0x7350('0x3c')]);_0x25fcbc[_0x7350('0x3d')]=qs[_0x7350('0x34')](_[_0x7350('0x3e')](_0x413ac2[_0x7350('0x33')],_0x5fb497['filters']));if(_0x413ac2[_0x7350('0x33')]['filter']){_0x25fcbc[_0x7350('0x3d')]=_[_0x7350('0x41')](_0x25fcbc[_0x7350('0x3d')],{'$or':_[_0x7350('0x2c')](_0x25fcbc[_0x7350('0x36')],function(_0x6167bb){var _0x2a9542={};_0x2a9542[_0x6167bb]={'$like':'%'+_0x413ac2[_0x7350('0x33')]['filter']+'%'};return _0x2a9542;})});}_0x25fcbc=_[_0x7350('0x41')]({},_0x25fcbc,_0x413ac2['options']);return _0x5eb158['getFields'](_0x25fcbc);}})[_0x7350('0x25')](function(_0x41d962){if(_0x41d962){_0x20f271=_0x41d962[_0x7350('0x38')];if(!_0x413ac2['query'][_0x7350('0x39')](_0x7350('0x3a'))){_0x25fcbc[_0x7350('0x1d')]=qs[_0x7350('0x1d')](_0x413ac2[_0x7350('0x33')]['limit']);_0x25fcbc[_0x7350('0x1c')]=qs[_0x7350('0x1c')](_0x413ac2[_0x7350('0x33')]['offset']);}return _0x5eb158[_0x7350('0x51')](_0x25fcbc);}})[_0x7350('0x25')](function(_0x2a05b4){if(_0x2a05b4){return _0x2a05b4?{'count':_0x20f271,'rows':_0x2a05b4}:null;}})[_0x7350('0x25')](respondWithResult(_0x812f04,null))['catch'](handleError(_0x812f04,null));};exports['getSubjects']=function(_0xe86bae,_0x2ec093,_0xe183e7){var _0x49b848={};var _0x3b089f={};var _0x42c967;var _0x409575;return db[_0x7350('0x2d')][_0x7350('0x4f')]({'where':{'id':_0xe86bae[_0x7350('0x49')]['id']}})[_0x7350('0x25')](handleEntityNotFound(_0x2ec093,null))['then'](function(_0x53d768){if(_0x53d768){_0x42c967=_0x53d768;_0x3b089f[_0x7350('0x32')]=_[_0x7350('0x4a')](db[_0x7350('0x50')][_0x7350('0x2e')]);_0x3b089f[_0x7350('0x33')]=_[_0x7350('0x4a')](_0xe86bae[_0x7350('0x33')]);_0x3b089f[_0x7350('0x34')]=_[_0x7350('0x35')](_0x3b089f[_0x7350('0x32')],_0x3b089f[_0x7350('0x33')]);_0x49b848[_0x7350('0x36')]=_[_0x7350('0x35')](_0x3b089f[_0x7350('0x32')],qs[_0x7350('0x37')](_0xe86bae[_0x7350('0x33')][_0x7350('0x37')]));_0x49b848['attributes']=_0x49b848[_0x7350('0x36')][_0x7350('0x38')]?_0x49b848[_0x7350('0x36')]:_0x3b089f[_0x7350('0x32')];_0x49b848[_0x7350('0x3b')]=qs[_0x7350('0x3c')](_0xe86bae['query'][_0x7350('0x3c')]);_0x49b848[_0x7350('0x3d')]=qs['filters'](_['pick'](_0xe86bae[_0x7350('0x33')],_0x3b089f[_0x7350('0x34')]));if(_0xe86bae[_0x7350('0x33')]['filter']){_0x49b848[_0x7350('0x3d')]=_[_0x7350('0x41')](_0x49b848[_0x7350('0x3d')],{'$or':_['map'](_0x49b848[_0x7350('0x36')],function(_0x3a8f23){var _0x26bac2={};_0x26bac2[_0x3a8f23]={'$like':'%'+_0xe86bae['query']['filter']+'%'};return _0x26bac2;})});}_0x49b848=_[_0x7350('0x41')]({},_0x49b848,_0xe86bae[_0x7350('0x42')]);return _0x42c967[_0x7350('0x52')](_0x49b848);}})[_0x7350('0x25')](function(_0x5bc10f){if(_0x5bc10f){_0x409575=_0x5bc10f[_0x7350('0x38')];if(!_0xe86bae['query'][_0x7350('0x39')](_0x7350('0x3a'))){_0x49b848[_0x7350('0x1d')]=qs[_0x7350('0x1d')](_0xe86bae[_0x7350('0x33')]['limit']);_0x49b848[_0x7350('0x1c')]=qs[_0x7350('0x1c')](_0xe86bae[_0x7350('0x33')][_0x7350('0x1c')]);}return _0x42c967['getSubjects'](_0x49b848);}})[_0x7350('0x25')](function(_0x4c87ef){if(_0x4c87ef){return _0x4c87ef?{'count':_0x409575,'rows':_0x4c87ef}:null;}})[_0x7350('0x25')](respondWithResult(_0x2ec093,null))[_0x7350('0x47')](handleError(_0x2ec093,null));};exports[_0x7350('0x53')]=function(_0x2c2e42,_0x30706e,_0x58b5a0){var _0x3a39ff={};var _0x3201e1={};var _0xb5931c;var _0x2d7316;return db[_0x7350('0x2d')][_0x7350('0x4f')]({'where':{'id':_0x2c2e42[_0x7350('0x49')]['id']}})[_0x7350('0x25')](handleEntityNotFound(_0x30706e,null))[_0x7350('0x25')](function(_0x3ffdd7){if(_0x3ffdd7){_0xb5931c=_0x3ffdd7;_0x3201e1[_0x7350('0x32')]=_[_0x7350('0x4a')](db['ZohoField']['rawAttributes']);_0x3201e1[_0x7350('0x33')]=_[_0x7350('0x4a')](_0x2c2e42[_0x7350('0x33')]);_0x3201e1[_0x7350('0x34')]=_[_0x7350('0x35')](_0x3201e1[_0x7350('0x32')],_0x3201e1[_0x7350('0x33')]);_0x3a39ff[_0x7350('0x36')]=_[_0x7350('0x35')](_0x3201e1[_0x7350('0x32')],qs[_0x7350('0x37')](_0x2c2e42[_0x7350('0x33')]['fields']));_0x3a39ff[_0x7350('0x36')]=_0x3a39ff[_0x7350('0x36')]['length']?_0x3a39ff[_0x7350('0x36')]:_0x3201e1['model'];_0x3a39ff['order']=qs[_0x7350('0x3c')](_0x2c2e42[_0x7350('0x33')][_0x7350('0x3c')]);_0x3a39ff['where']=qs['filters'](_['pick'](_0x2c2e42[_0x7350('0x33')],_0x3201e1[_0x7350('0x34')]));if(_0x2c2e42[_0x7350('0x33')][_0x7350('0x3f')]){_0x3a39ff['where']=_[_0x7350('0x41')](_0x3a39ff[_0x7350('0x3d')],{'$or':_[_0x7350('0x2c')](_0x3a39ff[_0x7350('0x36')],function(_0x377461){var _0x2ad2a4={};_0x2ad2a4[_0x377461]={'$like':'%'+_0x2c2e42[_0x7350('0x33')][_0x7350('0x3f')]+'%'};return _0x2ad2a4;})});}_0x3a39ff=_[_0x7350('0x41')]({},_0x3a39ff,_0x2c2e42[_0x7350('0x42')]);return _0xb5931c[_0x7350('0x53')](_0x3a39ff);}})[_0x7350('0x25')](function(_0x43e7c0){if(_0x43e7c0){_0x2d7316=_0x43e7c0[_0x7350('0x38')];if(!_0x2c2e42[_0x7350('0x33')][_0x7350('0x39')](_0x7350('0x3a'))){_0x3a39ff[_0x7350('0x1d')]=qs['limit'](_0x2c2e42[_0x7350('0x33')]['limit']);_0x3a39ff[_0x7350('0x1c')]=qs['offset'](_0x2c2e42['query'][_0x7350('0x1c')]);}return _0xb5931c[_0x7350('0x53')](_0x3a39ff);}})[_0x7350('0x25')](function(_0x3241e0){if(_0x3241e0){return _0x3241e0?{'count':_0x2d7316,'rows':_0x3241e0}:null;}})['then'](respondWithResult(_0x30706e,null))[_0x7350('0x47')](handleError(_0x30706e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 21d2220..337d33a 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 _0xad34=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x33e402,_0x670be3){var _0x56f8a0=function(_0x55fcce){while(--_0x55fcce){_0x33e402['push'](_0x33e402['shift']());}};_0x56f8a0(++_0x670be3);}(_0xad34,0xb7));var _0x4ad3=function(_0x1550a9,_0x3a2d5e){_0x1550a9=_0x1550a9-0x0;var _0x5261e1=_0xad34[_0x1550a9];return _0x5261e1;};'use strict';var _=require(_0x4ad3('0x0'));var util=require(_0x4ad3('0x1'));var logger=require(_0x4ad3('0x2'))(_0x4ad3('0x3'));var moment=require(_0x4ad3('0x4'));var BPromise=require(_0x4ad3('0x5'));var rp=require(_0x4ad3('0x6'));var fs=require('fs');var path=require(_0x4ad3('0x7'));var rimraf=require(_0x4ad3('0x8'));var config=require(_0x4ad3('0x9'));var attributes=require(_0x4ad3('0xa'));module[_0x4ad3('0xb')]=function(_0x35481a,_0x1f57e6){return _0x35481a[_0x4ad3('0xc')](_0x4ad3('0xd'),attributes,{'tableName':_0x4ad3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8401=['api','moment','bluebird','path','rimraf','./intZohoConfiguration.attributes','int_zoho_configurations','lodash','../../config/logger'];(function(_0x3b1413,_0x308e98){var _0x2cafbc=function(_0xa3aee2){while(--_0xa3aee2){_0x3b1413['push'](_0x3b1413['shift']());}};_0x2cafbc(++_0x308e98);}(_0x8401,0x6a));var _0x1840=function(_0x51e4dd,_0x814134){_0x51e4dd=_0x51e4dd-0x0;var _0x5a4f30=_0x8401[_0x51e4dd];return _0x5a4f30;};'use strict';var _=require(_0x1840('0x0'));var util=require('util');var logger=require(_0x1840('0x1'))(_0x1840('0x2'));var moment=require(_0x1840('0x3'));var BPromise=require(_0x1840('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1840('0x5'));var rimraf=require(_0x1840('0x6'));var config=require('../../config/environment');var attributes=require(_0x1840('0x7'));module['exports']=function(_0xc66434,_0x3a6d03){return _0xc66434['define']('ZohoConfiguration',attributes,{'tableName':_0x1840('0x8'),'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 747cfed..f35caf4 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 _0xcac3=['info','request\x20sent','error','message','ZohoConfiguration,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x14a34a,_0x424129){var _0x4d921e=function(_0x1982be){while(--_0x1982be){_0x14a34a['push'](_0x14a34a['shift']());}};_0x4d921e(++_0x424129);}(_0xcac3,0xaf));var _0x3cac=function(_0x3960a3,_0x5e59b8){_0x3960a3=_0x3960a3-0x0;var _0x2e103b=_0xcac3[_0x3960a3];return _0x2e103b;};'use strict';var _=require(_0x3cac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3cac('0x1'));var rs=require(_0x3cac('0x2'));var fs=require('fs');var Redis=require(_0x3cac('0x3'));var db=require(_0x3cac('0x4'))['db'];var utils=require(_0x3cac('0x5'));var logger=require(_0x3cac('0x6'))(_0x3cac('0x7'));var config=require(_0x3cac('0x8'));var jayson=require(_0x3cac('0x9'));var client=jayson[_0x3cac('0xa')][_0x3cac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x182e67,_0x468238,_0x2ed12f){return new BPromise(function(_0x2d92f2,_0x522154){return client[_0x3cac('0xc')](_0x182e67,_0x2ed12f)[_0x3cac('0xd')](function(_0x5a913b){logger[_0x3cac('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x468238,_0x3cac('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x468238,_0x3cac('0xf'),JSON['stringify'](_0x5a913b));if(_0x5a913b['error']){if(_0x5a913b[_0x3cac('0x10')]['code']===0x1f4){logger[_0x3cac('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x468238,_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);return _0x522154(_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);}logger['error'](_0x3cac('0x12'),_0x468238,_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);return _0x2d92f2(_0x5a913b[_0x3cac('0x10')][_0x3cac('0x11')]);}else{logger[_0x3cac('0xe')](_0x3cac('0x12'),_0x468238,_0x3cac('0xf'));_0x2d92f2(_0x5a913b[_0x3cac('0x13')][_0x3cac('0x11')]);}})[_0x3cac('0x14')](function(_0x1a7d7f){logger[_0x3cac('0x10')](_0x3cac('0x12'),_0x468238,_0x1a7d7f);_0x522154(_0x1a7d7f);});});} \ No newline at end of file +var _0x2ab5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b150f,_0x31722f){var _0x784f7e=function(_0x8050dc){while(--_0x8050dc){_0x3b150f['push'](_0x3b150f['shift']());}};_0x784f7e(++_0x31722f);}(_0x2ab5,0x76));var _0x52ab=function(_0x53e32a,_0x3c7964){_0x53e32a=_0x53e32a-0x0;var _0x15a8bf=_0x2ab5[_0x53e32a];return _0x15a8bf;};'use strict';var _=require(_0x52ab('0x0'));var util=require(_0x52ab('0x1'));var moment=require(_0x52ab('0x2'));var BPromise=require(_0x52ab('0x3'));var rs=require(_0x52ab('0x4'));var fs=require('fs');var Redis=require(_0x52ab('0x5'));var db=require(_0x52ab('0x6'))['db'];var utils=require(_0x52ab('0x7'));var logger=require(_0x52ab('0x8'))(_0x52ab('0x9'));var config=require(_0x52ab('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x52ab('0xb')][_0x52ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3622dd,_0x83ae6d,_0x18e8ee){return new BPromise(function(_0x13d763,_0x4c2899){return client['request'](_0x3622dd,_0x18e8ee)[_0x52ab('0xd')](function(_0x2356b4){logger[_0x52ab('0xe')](_0x52ab('0xf'),_0x83ae6d,'request\x20sent');logger[_0x52ab('0x10')](_0x52ab('0x11'),_0x83ae6d,_0x52ab('0x12'),JSON[_0x52ab('0x13')](_0x2356b4));if(_0x2356b4[_0x52ab('0x14')]){if(_0x2356b4['error'][_0x52ab('0x15')]===0x1f4){logger['error'](_0x52ab('0xf'),_0x83ae6d,_0x2356b4[_0x52ab('0x14')]['message']);return _0x4c2899(_0x2356b4[_0x52ab('0x14')]['message']);}logger[_0x52ab('0x14')](_0x52ab('0xf'),_0x83ae6d,_0x2356b4['error'][_0x52ab('0x16')]);return _0x13d763(_0x2356b4[_0x52ab('0x14')][_0x52ab('0x16')]);}else{logger[_0x52ab('0xe')](_0x52ab('0xf'),_0x83ae6d,_0x52ab('0x12'));_0x13d763(_0x2356b4[_0x52ab('0x17')][_0x52ab('0x16')]);}})[_0x52ab('0x18')](function(_0x34c4cf){logger[_0x52ab('0x14')](_0x52ab('0xf'),_0x83ae6d,_0x34c4cf);_0x4c2899(_0x34c4cf);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 36e383f..f1da380 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 _0x5c23=['delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x1b6158,_0x1b7c2f){var _0x5c6338=function(_0x3672bb){while(--_0x3672bb){_0x1b6158['push'](_0x1b6158['shift']());}};_0x5c6338(++_0x1b7c2f);}(_0x5c23,0x178));var _0x35c2=function(_0x300b39,_0x2479fa){_0x300b39=_0x300b39-0x0;var _0x59eda5=_0x5c23[_0x300b39];return _0x59eda5;};'use strict';var multer=require(_0x35c2('0x0'));var util=require(_0x35c2('0x1'));var path=require(_0x35c2('0x2'));var timeout=require(_0x35c2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x35c2('0x4'));var auth=require(_0x35c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x35c2('0x6'));var controller=require(_0x35c2('0x7'));router[_0x35c2('0x8')]('/',auth[_0x35c2('0x9')](),controller[_0x35c2('0xa')]);router[_0x35c2('0x8')](_0x35c2('0xb'),auth['isAuthenticated'](),controller[_0x35c2('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x35c2('0xd')]);router['put'](_0x35c2('0xb'),auth[_0x35c2('0x9')](),controller[_0x35c2('0xe')]);router[_0x35c2('0xf')]('/:id',auth[_0x35c2('0x9')](),controller[_0x35c2('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7078=['put','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x4c8d03,_0x3ca8cd){var _0x4dbec9=function(_0x3ba3f4){while(--_0x3ba3f4){_0x4c8d03['push'](_0x4c8d03['shift']());}};_0x4dbec9(++_0x3ca8cd);}(_0x7078,0x10e));var _0x8707=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x7078[_0x189d3c];return _0x485959;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8707('0x0'));var express=require(_0x8707('0x1'));var router=express[_0x8707('0x2')]();var fs_extra=require(_0x8707('0x3'));var auth=require(_0x8707('0x4'));var interaction=require(_0x8707('0x5'));var config=require(_0x8707('0x6'));var controller=require(_0x8707('0x7'));router['get']('/',auth[_0x8707('0x8')](),controller[_0x8707('0x9')]);router[_0x8707('0xa')](_0x8707('0xb'),auth[_0x8707('0x8')](),controller[_0x8707('0xc')]);router[_0x8707('0xd')]('/',auth[_0x8707('0x8')](),controller[_0x8707('0xe')]);router[_0x8707('0xf')](_0x8707('0xb'),auth[_0x8707('0x8')](),controller[_0x8707('0x10')]);router['delete']('/:id',auth[_0x8707('0x8')](),controller[_0x8707('0x11')]);module[_0x8707('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 180937f..0e4b05d 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 _0x583e=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0xfc4cc1,_0x3aad8){var _0x4b73eb=function(_0x296fc3){while(--_0x296fc3){_0xfc4cc1['push'](_0xfc4cc1['shift']());}};_0x4b73eb(++_0x3aad8);}(_0x583e,0x132));var _0xe583=function(_0x5d494a,_0x5cf774){_0x5d494a=_0x5d494a-0x0;var _0x418723=_0x583e[_0x5d494a];return _0x418723;};'use strict';var Sequelize=require(_0xe583('0x0'));module[_0xe583('0x1')]={'type':{'type':Sequelize[_0xe583('0x2')](_0xe583('0x3'),'variable',_0xe583('0x4'),_0xe583('0x5'),_0xe583('0x6')),'defaultValue':_0xe583('0x3')},'content':{'type':Sequelize[_0xe583('0x7')]},'key':{'type':Sequelize[_0xe583('0x7')]},'keyType':{'type':Sequelize[_0xe583('0x2')](_0xe583('0x3'),_0xe583('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe583('0x7')]},'nameField':{'type':Sequelize[_0xe583('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe583('0x7')]}}; \ No newline at end of file +var _0xae1a=['string','variable','keyValue','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae1a,0xe6));var _0xaae1=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xae1a[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0xaae1('0x0')]={'type':{'type':Sequelize[_0xaae1('0x1')](_0xaae1('0x2'),_0xaae1('0x3'),'customVariable',_0xaae1('0x4'),'picklist'),'defaultValue':_0xaae1('0x2')},'content':{'type':Sequelize[_0xaae1('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xaae1('0x2'),_0xaae1('0x3'),_0xaae1('0x6'))},'keyContent':{'type':Sequelize[_0xaae1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaae1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0fce204..f4ef22b 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 _0x1a54=['json','offset','undefined','count','limit','set','Content-Range','reject','save','update','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','ZohoField','then','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x1a54,0x1d6));var _0x41a5=function(_0x28dd23,_0xd92e21){_0x28dd23=_0x28dd23-0x0;var _0x5c9817=_0x1a54[_0x28dd23];return _0x5c9817;};'use strict';var emlformat=require(_0x41a5('0x0'));var rimraf=require(_0x41a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41a5('0x2'));var rp=require('request-promise');var moment=require(_0x41a5('0x3'));var BPromise=require(_0x41a5('0x4'));var Mustache=require('mustache');var util=require(_0x41a5('0x5'));var path=require(_0x41a5('0x6'));var sox=require(_0x41a5('0x7'));var csv=require(_0x41a5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41a5('0x9'));var _=require(_0x41a5('0xa'));var squel=require(_0x41a5('0xb'));var crypto=require(_0x41a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x41a5('0xd'));var toCsv=require(_0x41a5('0x8'));var querystring=require(_0x41a5('0xe'));var Papa=require(_0x41a5('0xf'));var Redis=require(_0x41a5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x41a5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41a5('0x12'))(_0x41a5('0x13'));var utils=require(_0x41a5('0x14'));var config=require(_0x41a5('0x15'));var licenseUtil=require(_0x41a5('0x16'));var db=require(_0x41a5('0x17'))['db'];function respondWithStatusCode(_0x200716,_0x178032){_0x178032=_0x178032||0xcc;return function(_0x32df7b){if(_0x32df7b){return _0x200716[_0x41a5('0x18')](_0x178032);}return _0x200716[_0x41a5('0x19')](_0x178032)[_0x41a5('0x1a')]();};}function respondWithResult(_0xd3e709,_0xb27f16){_0xb27f16=_0xb27f16||0xc8;return function(_0x32e2be){if(_0x32e2be){return _0xd3e709[_0x41a5('0x19')](_0xb27f16)[_0x41a5('0x1b')](_0x32e2be);}};}function respondWithFilteredResult(_0x421528,_0x17ce41){return function(_0x279472){if(_0x279472){var _0x3cdb1a=typeof _0x17ce41[_0x41a5('0x1c')]==='undefined'&&typeof _0x17ce41['limit']===_0x41a5('0x1d');var _0x133148=_0x279472[_0x41a5('0x1e')];var _0x468139=_0x3cdb1a?0x0:_0x17ce41['offset'];var _0x175a79=_0x3cdb1a?_0x279472[_0x41a5('0x1e')]:_0x17ce41[_0x41a5('0x1c')]+_0x17ce41[_0x41a5('0x1f')];var _0x17c44b;if(_0x175a79>=_0x133148){_0x175a79=_0x133148;_0x17c44b=0xc8;}else{_0x17c44b=0xce;}_0x421528[_0x41a5('0x19')](_0x17c44b);return _0x421528[_0x41a5('0x20')](_0x41a5('0x21'),_0x468139+'-'+_0x175a79+'/'+_0x133148)[_0x41a5('0x1b')](_0x279472);}return null;};}function patchUpdates(_0x459d6c){return function(_0x5849b9){try{jsonpatch['apply'](_0x5849b9,_0x459d6c,!![]);}catch(_0x290cbf){return BPromise[_0x41a5('0x22')](_0x290cbf);}return _0x5849b9[_0x41a5('0x23')]();};}function saveUpdates(_0x4dc31,_0x32fa62){return function(_0x15eb82){if(_0x15eb82){return _0x15eb82[_0x41a5('0x24')](_0x4dc31)['then'](function(_0x94506f){return _0x94506f;});}return null;};}function removeEntity(_0x56e301,_0x57bbf5){return function(_0x1cade7){if(_0x1cade7){return _0x1cade7['destroy']()['then'](function(){_0x56e301[_0x41a5('0x19')](0xcc)[_0x41a5('0x1a')]();});}};}function handleEntityNotFound(_0x19ddd5,_0xaa1db0){return function(_0x80172d){if(!_0x80172d){_0x19ddd5[_0x41a5('0x18')](0x194);}return _0x80172d;};}function handleError(_0x2c8667,_0x56b6ce){_0x56b6ce=_0x56b6ce||0x1f4;return function(_0x4852a1){logger['error'](_0x4852a1['stack']);if(_0x4852a1[_0x41a5('0x25')]){delete _0x4852a1[_0x41a5('0x25')];}_0x2c8667['status'](_0x56b6ce)['send'](_0x4852a1);};}exports[_0x41a5('0x26')]=function(_0x5cb33a,_0x5568a2){var _0x128d1e={},_0x1c5e5e={},_0x38c592={'count':0x0,'rows':[]};var _0x308005=_[_0x41a5('0x27')](db['ZohoField'][_0x41a5('0x28')],function(_0x159c49){return{'name':_0x159c49[_0x41a5('0x29')],'type':_0x159c49[_0x41a5('0x2a')][_0x41a5('0x2b')]};});_0x1c5e5e[_0x41a5('0x2c')]=_[_0x41a5('0x27')](_0x308005,_0x41a5('0x25'));_0x1c5e5e[_0x41a5('0x2d')]=_['keys'](_0x5cb33a[_0x41a5('0x2d')]);_0x1c5e5e[_0x41a5('0x2e')]=_[_0x41a5('0x2f')](_0x1c5e5e['model'],_0x1c5e5e[_0x41a5('0x2d')]);_0x128d1e[_0x41a5('0x30')]=_['intersection'](_0x1c5e5e[_0x41a5('0x2c')],qs['fields'](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x31')]));_0x128d1e[_0x41a5('0x30')]=_0x128d1e[_0x41a5('0x30')][_0x41a5('0x32')]?_0x128d1e[_0x41a5('0x30')]:_0x1c5e5e[_0x41a5('0x2c')];if(!_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x33')](_0x41a5('0x34'))){_0x128d1e[_0x41a5('0x1f')]=qs[_0x41a5('0x1f')](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x1f')]);_0x128d1e['offset']=qs[_0x41a5('0x1c')](_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x1c')]);}_0x128d1e[_0x41a5('0x35')]=qs[_0x41a5('0x36')](_0x5cb33a['query']['sort']);_0x128d1e['where']=qs[_0x41a5('0x2e')](_['pick'](_0x5cb33a[_0x41a5('0x2d')],_0x1c5e5e[_0x41a5('0x2e')]),_0x308005);if(_0x5cb33a[_0x41a5('0x2d')][_0x41a5('0x37')]){_0x128d1e[_0x41a5('0x38')]=_[_0x41a5('0x39')](_0x128d1e[_0x41a5('0x38')],{'$or':_[_0x41a5('0x27')](_0x308005,function(_0x6280bf){if(_0x6280bf[_0x41a5('0x2a')]!=='VIRTUAL'){var _0x4cbe09={};_0x4cbe09[_0x6280bf[_0x41a5('0x25')]]={'$like':'%'+_0x5cb33a[_0x41a5('0x2d')]['filter']+'%'};return _0x4cbe09;}})});}_0x128d1e=_[_0x41a5('0x39')]({},_0x128d1e,_0x5cb33a['options']);var _0x296fd7={'where':_0x128d1e[_0x41a5('0x38')]};return db[_0x41a5('0x3a')]['count'](_0x296fd7)[_0x41a5('0x3b')](function(_0x51d4cc){_0x38c592[_0x41a5('0x1e')]=_0x51d4cc;if(_0x5cb33a['query']['includeAll']){_0x128d1e['include']=[{'all':!![]}];}return db['ZohoField'][_0x41a5('0x3c')](_0x128d1e);})['then'](function(_0x57e5c3){_0x38c592[_0x41a5('0x3d')]=_0x57e5c3;return _0x38c592;})[_0x41a5('0x3b')](respondWithFilteredResult(_0x5568a2,_0x128d1e))[_0x41a5('0x3e')](handleError(_0x5568a2,null));};exports[_0x41a5('0x3f')]=function(_0x1c6381,_0x1e8229){var _0x3a9030={'raw':!![],'where':{'id':_0x1c6381[_0x41a5('0x40')]['id']}},_0x25b5c0={};_0x25b5c0[_0x41a5('0x2c')]=_[_0x41a5('0x41')](db['ZohoField']['rawAttributes']);_0x25b5c0['query']=_[_0x41a5('0x41')](_0x1c6381[_0x41a5('0x2d')]);_0x25b5c0[_0x41a5('0x2e')]=_[_0x41a5('0x2f')](_0x25b5c0[_0x41a5('0x2c')],_0x25b5c0[_0x41a5('0x2d')]);_0x3a9030[_0x41a5('0x30')]=_['intersection'](_0x25b5c0['model'],qs[_0x41a5('0x31')](_0x1c6381[_0x41a5('0x2d')][_0x41a5('0x31')]));_0x3a9030[_0x41a5('0x30')]=_0x3a9030[_0x41a5('0x30')][_0x41a5('0x32')]?_0x3a9030[_0x41a5('0x30')]:_0x25b5c0[_0x41a5('0x2c')];if(_0x1c6381[_0x41a5('0x2d')]['includeAll']){_0x3a9030[_0x41a5('0x42')]=[{'all':!![]}];}_0x3a9030=_['merge']({},_0x3a9030,_0x1c6381['options']);return db[_0x41a5('0x3a')][_0x41a5('0x43')](_0x3a9030)['then'](handleEntityNotFound(_0x1e8229,null))[_0x41a5('0x3b')](respondWithResult(_0x1e8229,null))[_0x41a5('0x3e')](handleError(_0x1e8229,null));};exports[_0x41a5('0x44')]=function(_0x53098f,_0x49d8fb){return db[_0x41a5('0x3a')][_0x41a5('0x44')](_0x53098f[_0x41a5('0x45')],{})[_0x41a5('0x3b')](respondWithResult(_0x49d8fb,0xc9))[_0x41a5('0x3e')](handleError(_0x49d8fb,null));};exports['update']=function(_0xe5ad8d,_0x4b9d94){if(_0xe5ad8d[_0x41a5('0x45')]['id']){delete _0xe5ad8d[_0x41a5('0x45')]['id'];}return db[_0x41a5('0x3a')][_0x41a5('0x43')]({'where':{'id':_0xe5ad8d['params']['id']}})[_0x41a5('0x3b')](handleEntityNotFound(_0x4b9d94,null))['then'](saveUpdates(_0xe5ad8d['body'],null))['then'](respondWithResult(_0x4b9d94,null))[_0x41a5('0x3e')](handleError(_0x4b9d94,null));};exports[_0x41a5('0x46')]=function(_0x3602cd,_0x1ff53b){return db[_0x41a5('0x3a')]['find']({'where':{'id':_0x3602cd[_0x41a5('0x40')]['id']}})[_0x41a5('0x3b')](handleEntityNotFound(_0x1ff53b,null))[_0x41a5('0x3b')](removeEntity(_0x1ff53b,null))[_0x41a5('0x3e')](handleError(_0x1ff53b,null));}; \ No newline at end of file +var _0x56d1=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','name','ZohoField','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra'];(function(_0xa765b1,_0x50d5ce){var _0x46197b=function(_0x44e98e){while(--_0x44e98e){_0xa765b1['push'](_0xa765b1['shift']());}};_0x46197b(++_0x50d5ce);}(_0x56d1,0x1ac));var _0x156d=function(_0x18a16d,_0x199976){_0x18a16d=_0x18a16d-0x0;var _0x21cf0c=_0x56d1[_0x18a16d];return _0x21cf0c;};'use strict';var emlformat=require(_0x156d('0x0'));var rimraf=require(_0x156d('0x1'));var zipdir=require(_0x156d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x156d('0x3'));var moment=require(_0x156d('0x4'));var BPromise=require(_0x156d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x156d('0x6'));var csv=require(_0x156d('0x7'));var ejs=require(_0x156d('0x8'));var fs=require('fs');var fs_extra=require(_0x156d('0x9'));var _=require(_0x156d('0xa'));var squel=require(_0x156d('0xb'));var crypto=require(_0x156d('0xc'));var jsforce=require(_0x156d('0xd'));var deskjs=require(_0x156d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x156d('0xf'));var Papa=require(_0x156d('0x10'));var Redis=require(_0x156d('0x11'));var authService=require(_0x156d('0x12'));var qs=require(_0x156d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x156d('0x14'));var logger=require(_0x156d('0x15'))(_0x156d('0x16'));var utils=require('../../config/utils');var config=require(_0x156d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x156d('0x18'))['db'];function respondWithStatusCode(_0x46db55,_0x1d58df){_0x1d58df=_0x1d58df||0xcc;return function(_0x3ab84e){if(_0x3ab84e){return _0x46db55[_0x156d('0x19')](_0x1d58df);}return _0x46db55[_0x156d('0x1a')](_0x1d58df)[_0x156d('0x1b')]();};}function respondWithResult(_0x2f4df1,_0x1a1539){_0x1a1539=_0x1a1539||0xc8;return function(_0x49f7f2){if(_0x49f7f2){return _0x2f4df1[_0x156d('0x1a')](_0x1a1539)['json'](_0x49f7f2);}};}function respondWithFilteredResult(_0x104e71,_0x343de9){return function(_0xc6ccbc){if(_0xc6ccbc){var _0x3f50ec=typeof _0x343de9[_0x156d('0x1c')]===_0x156d('0x1d')&&typeof _0x343de9[_0x156d('0x1e')]==='undefined';var _0x3880f9=_0xc6ccbc['count'];var _0xdbe874=_0x3f50ec?0x0:_0x343de9['offset'];var _0x1c9ef0=_0x3f50ec?_0xc6ccbc['count']:_0x343de9[_0x156d('0x1c')]+_0x343de9['limit'];var _0x57a845;if(_0x1c9ef0>=_0x3880f9){_0x1c9ef0=_0x3880f9;_0x57a845=0xc8;}else{_0x57a845=0xce;}_0x104e71[_0x156d('0x1a')](_0x57a845);return _0x104e71[_0x156d('0x1f')]('Content-Range',_0xdbe874+'-'+_0x1c9ef0+'/'+_0x3880f9)[_0x156d('0x20')](_0xc6ccbc);}return null;};}function patchUpdates(_0x27d8a3){return function(_0x39ec67){try{jsonpatch[_0x156d('0x21')](_0x39ec67,_0x27d8a3,!![]);}catch(_0x579c62){return BPromise[_0x156d('0x22')](_0x579c62);}return _0x39ec67[_0x156d('0x23')]();};}function saveUpdates(_0x326250,_0x1016d1){return function(_0x46a219){if(_0x46a219){return _0x46a219['update'](_0x326250)[_0x156d('0x24')](function(_0xeedd4){return _0xeedd4;});}return null;};}function removeEntity(_0x751bae,_0x237d23){return function(_0x378167){if(_0x378167){return _0x378167[_0x156d('0x25')]()[_0x156d('0x24')](function(){_0x751bae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d10aa,_0x20a539){return function(_0x26790c){if(!_0x26790c){_0x4d10aa[_0x156d('0x19')](0x194);}return _0x26790c;};}function handleError(_0x44d1e7,_0x93a33){_0x93a33=_0x93a33||0x1f4;return function(_0xdc8283){logger['error'](_0xdc8283['stack']);if(_0xdc8283[_0x156d('0x26')]){delete _0xdc8283[_0x156d('0x26')];}_0x44d1e7['status'](_0x93a33)['send'](_0xdc8283);};}exports['index']=function(_0x22340f,_0xf96cb2){var _0x351fd0={},_0x11c493={},_0x5f075c={'count':0x0,'rows':[]};var _0x17a43c=_['map'](db[_0x156d('0x27')]['rawAttributes'],function(_0x40f40b){return{'name':_0x40f40b[_0x156d('0x28')],'type':_0x40f40b[_0x156d('0x29')][_0x156d('0x2a')]};});_0x11c493['model']=_[_0x156d('0x2b')](_0x17a43c,_0x156d('0x26'));_0x11c493[_0x156d('0x2c')]=_[_0x156d('0x2d')](_0x22340f['query']);_0x11c493[_0x156d('0x2e')]=_['intersection'](_0x11c493[_0x156d('0x2f')],_0x11c493[_0x156d('0x2c')]);_0x351fd0[_0x156d('0x30')]=_[_0x156d('0x31')](_0x11c493['model'],qs[_0x156d('0x32')](_0x22340f[_0x156d('0x2c')][_0x156d('0x32')]));_0x351fd0[_0x156d('0x30')]=_0x351fd0[_0x156d('0x30')][_0x156d('0x33')]?_0x351fd0['attributes']:_0x11c493['model'];if(!_0x22340f[_0x156d('0x2c')][_0x156d('0x34')]('nolimit')){_0x351fd0[_0x156d('0x1e')]=qs[_0x156d('0x1e')](_0x22340f[_0x156d('0x2c')][_0x156d('0x1e')]);_0x351fd0[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x22340f[_0x156d('0x2c')][_0x156d('0x1c')]);}_0x351fd0[_0x156d('0x35')]=qs[_0x156d('0x36')](_0x22340f['query'][_0x156d('0x36')]);_0x351fd0[_0x156d('0x37')]=qs[_0x156d('0x2e')](_['pick'](_0x22340f[_0x156d('0x2c')],_0x11c493['filters']),_0x17a43c);if(_0x22340f[_0x156d('0x2c')][_0x156d('0x38')]){_0x351fd0['where']=_[_0x156d('0x39')](_0x351fd0[_0x156d('0x37')],{'$or':_[_0x156d('0x2b')](_0x17a43c,function(_0xd51c76){if(_0xd51c76[_0x156d('0x29')]!==_0x156d('0x3a')){var _0x48640d={};_0x48640d[_0xd51c76[_0x156d('0x26')]]={'$like':'%'+_0x22340f['query'][_0x156d('0x38')]+'%'};return _0x48640d;}})});}_0x351fd0=_[_0x156d('0x39')]({},_0x351fd0,_0x22340f[_0x156d('0x3b')]);var _0x2e4c0d={'where':_0x351fd0[_0x156d('0x37')]};return db[_0x156d('0x27')][_0x156d('0x3c')](_0x2e4c0d)[_0x156d('0x24')](function(_0x4fa4b8){_0x5f075c[_0x156d('0x3c')]=_0x4fa4b8;if(_0x22340f[_0x156d('0x2c')][_0x156d('0x3d')]){_0x351fd0[_0x156d('0x3e')]=[{'all':!![]}];}return db[_0x156d('0x27')][_0x156d('0x3f')](_0x351fd0);})[_0x156d('0x24')](function(_0x265f87){_0x5f075c[_0x156d('0x40')]=_0x265f87;return _0x5f075c;})[_0x156d('0x24')](respondWithFilteredResult(_0xf96cb2,_0x351fd0))[_0x156d('0x41')](handleError(_0xf96cb2,null));};exports[_0x156d('0x42')]=function(_0x3b5e9,_0x55aa7e){var _0xb8270e={'raw':!![],'where':{'id':_0x3b5e9[_0x156d('0x43')]['id']}},_0x1c6faf={};_0x1c6faf[_0x156d('0x2f')]=_[_0x156d('0x2d')](db['ZohoField'][_0x156d('0x44')]);_0x1c6faf[_0x156d('0x2c')]=_['keys'](_0x3b5e9[_0x156d('0x2c')]);_0x1c6faf['filters']=_['intersection'](_0x1c6faf[_0x156d('0x2f')],_0x1c6faf[_0x156d('0x2c')]);_0xb8270e[_0x156d('0x30')]=_[_0x156d('0x31')](_0x1c6faf[_0x156d('0x2f')],qs['fields'](_0x3b5e9[_0x156d('0x2c')][_0x156d('0x32')]));_0xb8270e[_0x156d('0x30')]=_0xb8270e[_0x156d('0x30')][_0x156d('0x33')]?_0xb8270e['attributes']:_0x1c6faf[_0x156d('0x2f')];if(_0x3b5e9['query'][_0x156d('0x3d')]){_0xb8270e['include']=[{'all':!![]}];}_0xb8270e=_[_0x156d('0x39')]({},_0xb8270e,_0x3b5e9[_0x156d('0x3b')]);return db[_0x156d('0x27')][_0x156d('0x45')](_0xb8270e)[_0x156d('0x24')](handleEntityNotFound(_0x55aa7e,null))[_0x156d('0x24')](respondWithResult(_0x55aa7e,null))[_0x156d('0x41')](handleError(_0x55aa7e,null));};exports[_0x156d('0x46')]=function(_0x460743,_0xe5caa2){return db[_0x156d('0x27')][_0x156d('0x46')](_0x460743[_0x156d('0x47')],{})[_0x156d('0x24')](respondWithResult(_0xe5caa2,0xc9))[_0x156d('0x41')](handleError(_0xe5caa2,null));};exports[_0x156d('0x48')]=function(_0x592510,_0x12987d){if(_0x592510[_0x156d('0x47')]['id']){delete _0x592510[_0x156d('0x47')]['id'];}return db[_0x156d('0x27')][_0x156d('0x45')]({'where':{'id':_0x592510['params']['id']}})['then'](handleEntityNotFound(_0x12987d,null))[_0x156d('0x24')](saveUpdates(_0x592510[_0x156d('0x47')],null))['then'](respondWithResult(_0x12987d,null))[_0x156d('0x41')](handleError(_0x12987d,null));};exports['destroy']=function(_0x2a889c,_0x4c76db){return db[_0x156d('0x27')][_0x156d('0x45')]({'where':{'id':_0x2a889c[_0x156d('0x43')]['id']}})[_0x156d('0x24')](handleEntityNotFound(_0x4c76db,null))['then'](removeEntity(_0x4c76db,null))[_0x156d('0x41')](handleError(_0x4c76db,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6d2b46d..1dec7d4 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 _0x0424=['define','ZohoField','int_zoho_fields','FieldId','../../config/logger','api','moment','bluebird','path','./intZohoField.attributes','exports'];(function(_0x380f1f,_0x6f489b){var _0x4c53c6=function(_0x1d996d){while(--_0x1d996d){_0x380f1f['push'](_0x380f1f['shift']());}};_0x4c53c6(++_0x6f489b);}(_0x0424,0x159));var _0x4042=function(_0x1bda09,_0x1d8be5){_0x1bda09=_0x1bda09-0x0;var _0x17be2d=_0x0424[_0x1bda09];return _0x17be2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x4042('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x781d=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd781('0x2'));var BPromise=require(_0xd781('0x3'));var rp=require(_0xd781('0x4'));var fs=require('fs');var path=require(_0xd781('0x5'));var rimraf=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var attributes=require(_0xd781('0x8'));module[_0xd781('0x9')]=function(_0x830b,_0x2f98ee){return _0x830b['define'](_0xd781('0xa'),attributes,{'tableName':_0xd781('0xb'),'paranoid':![],'indexes':[{'name':_0xd781('0xc'),'fields':[_0xd781('0xd'),'FieldId'],'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 f0b1c17..505b97d 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 _0xb0c9=['http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\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','client'];(function(_0x4474c2,_0x59cf02){var _0x435fbb=function(_0x3c86eb){while(--_0x3c86eb){_0x4474c2['push'](_0x4474c2['shift']());}};_0x435fbb(++_0x59cf02);}(_0xb0c9,0x1d5));var _0x9b0c=function(_0x5011f5,_0x92181b){_0x5011f5=_0x5011f5-0x0;var _0x2b0e3f=_0xb0c9[_0x5011f5];return _0x2b0e3f;};'use strict';var _=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var moment=require(_0x9b0c('0x2'));var BPromise=require(_0x9b0c('0x3'));var rs=require(_0x9b0c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b0c('0x5'))['db'];var utils=require(_0x9b0c('0x6'));var logger=require('../../config/logger')(_0x9b0c('0x7'));var config=require(_0x9b0c('0x8'));var jayson=require(_0x9b0c('0x9'));var client=jayson[_0x9b0c('0xa')][_0x9b0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8d9c,_0x149ade,_0x1d67ce){return new BPromise(function(_0x4fdedc,_0x5a8ff2){return client['request'](_0x5c8d9c,_0x1d67ce)[_0x9b0c('0xc')](function(_0x4fb160){logger[_0x9b0c('0xd')](_0x9b0c('0xe'),_0x149ade,_0x9b0c('0xf'));logger[_0x9b0c('0x10')](_0x9b0c('0x11'),_0x149ade,'request\x20sent',JSON[_0x9b0c('0x12')](_0x4fb160));if(_0x4fb160[_0x9b0c('0x13')]){if(_0x4fb160[_0x9b0c('0x13')][_0x9b0c('0x14')]===0x1f4){logger[_0x9b0c('0x13')](_0x9b0c('0xe'),_0x149ade,_0x4fb160[_0x9b0c('0x13')][_0x9b0c('0x15')]);return _0x5a8ff2(_0x4fb160['error'][_0x9b0c('0x15')]);}logger[_0x9b0c('0x13')](_0x9b0c('0xe'),_0x149ade,_0x4fb160[_0x9b0c('0x13')]['message']);return _0x4fdedc(_0x4fb160['error'][_0x9b0c('0x15')]);}else{logger[_0x9b0c('0xd')]('ZohoField,\x20%s,\x20%s',_0x149ade,_0x9b0c('0xf'));_0x4fdedc(_0x4fb160[_0x9b0c('0x16')][_0x9b0c('0x15')]);}})[_0x9b0c('0x17')](function(_0x39c60c){logger[_0x9b0c('0x13')]('ZohoField,\x20%s,\x20%s',_0x149ade,_0x39c60c);_0x5a8ff2(_0x39c60c);});});} \ No newline at end of file +var _0x914b=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1cbc47,_0x58b1e4){var _0x2759ff=function(_0x4294af){while(--_0x4294af){_0x1cbc47['push'](_0x1cbc47['shift']());}};_0x2759ff(++_0x58b1e4);}(_0x914b,0x168));var _0xb914=function(_0x46884f,_0x2b5c5a){_0x46884f=_0x46884f-0x0;var _0x78c6c0=_0x914b[_0x46884f];return _0x78c6c0;};'use strict';var _=require(_0xb914('0x0'));var util=require(_0xb914('0x1'));var moment=require(_0xb914('0x2'));var BPromise=require('bluebird');var rs=require(_0xb914('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb914('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb914('0x5'))(_0xb914('0x6'));var config=require(_0xb914('0x7'));var jayson=require(_0xb914('0x8'));var client=jayson[_0xb914('0x9')][_0xb914('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x504fff,_0x105a16,_0x4315e0){return new BPromise(function(_0x1036ab,_0xe15113){return client[_0xb914('0xb')](_0x504fff,_0x4315e0)['then'](function(_0x18f410){logger[_0xb914('0xc')](_0xb914('0xd'),_0x105a16,'request\x20sent');logger['debug'](_0xb914('0xe'),_0x105a16,'request\x20sent',JSON[_0xb914('0xf')](_0x18f410));if(_0x18f410['error']){if(_0x18f410[_0xb914('0x10')]['code']===0x1f4){logger[_0xb914('0x10')](_0xb914('0xd'),_0x105a16,_0x18f410['error'][_0xb914('0x11')]);return _0xe15113(_0x18f410[_0xb914('0x10')][_0xb914('0x11')]);}logger[_0xb914('0x10')](_0xb914('0xd'),_0x105a16,_0x18f410[_0xb914('0x10')][_0xb914('0x11')]);return _0x1036ab(_0x18f410[_0xb914('0x10')][_0xb914('0x11')]);}else{logger['info'](_0xb914('0xd'),_0x105a16,'request\x20sent');_0x1036ab(_0x18f410[_0xb914('0x12')]['message']);}})[_0xb914('0x13')](function(_0x4a6839){logger[_0xb914('0x10')]('ZohoField,\x20%s,\x20%s',_0x105a16,_0x4a6839);_0xe15113(_0x4a6839);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 624da05..b585b13 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3dbfea,_0x32c32b){var _0x2a837b=function(_0x37a5e1){while(--_0x37a5e1){_0x3dbfea['push'](_0x3dbfea['shift']());}};_0x2a837b(++_0x32c32b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x57c977,_0x3c6280){var _0x3795c7=function(_0x104ba3){while(--_0x104ba3){_0x57c977['push'](_0x57c977['shift']());}};_0x3795c7(++_0x3c6280);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 367cb9a..107938f 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 _0x4ce5=['STRING','unique_name_and_version','app.js','state','sequelize'];(function(_0x2c5885,_0x23f458){var _0x43c2d4=function(_0x5d1110){while(--_0x5d1110){_0x2c5885['push'](_0x2c5885['shift']());}};_0x43c2d4(++_0x23f458);}(_0x4ce5,0x1b2));var _0x54ce=function(_0x4ecfe7,_0x1e2a9b){_0x4ecfe7=_0x4ecfe7-0x0;var _0x5b958b=_0x4ce5[_0x4ecfe7];return _0x5b958b;};'use strict';var Sequelize=require(_0x54ce('0x0'));module['exports']={'name':{'type':Sequelize[_0x54ce('0x1')],'allowNull':![],'unique':_0x54ce('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':_0x54ce('0x3')},'filename':{'type':Sequelize[_0x54ce('0x1')]},'path':{'type':Sequelize[_0x54ce('0x1')]},'type':{'type':Sequelize[_0x54ce('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x54ce('0x1')]},'logo':{'type':Sequelize[_0x54ce('0x1')]},'state':{'type':Sequelize[_0x54ce('0x1')],'unique':_0x54ce('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x54ce('0x1')]},'remoteUri':{'type':Sequelize[_0x54ce('0x1')]},'link':{'type':Sequelize[_0x54ce('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x3e05=['unique_name_and_version','app.js','INTEGER','BOOLEAN','exports','STRING'];(function(_0x275894,_0xdfda5c){var _0x17e919=function(_0x57a301){while(--_0x57a301){_0x275894['push'](_0x275894['shift']());}};_0x17e919(++_0xdfda5c);}(_0x3e05,0x64));var _0x53e0=function(_0x5d37cd,_0x43fed3){_0x5d37cd=_0x5d37cd-0x0;var _0x1d45ac=_0x3e05[_0x5d37cd];return _0x1d45ac;};'use strict';var Sequelize=require('sequelize');module[_0x53e0('0x0')]={'name':{'type':Sequelize[_0x53e0('0x1')],'allowNull':![],'unique':_0x53e0('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x53e0('0x1')],'defaultValue':_0x53e0('0x3')},'filename':{'type':Sequelize[_0x53e0('0x1')]},'path':{'type':Sequelize[_0x53e0('0x1')]},'type':{'type':Sequelize[_0x53e0('0x1')]},'size':{'type':Sequelize[_0x53e0('0x4')]},'active':{'type':Sequelize[_0x53e0('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x53e0('0x1')]},'logo':{'type':Sequelize[_0x53e0('0x1')]},'state':{'type':Sequelize[_0x53e0('0x1')],'unique':'state'},'description':{'type':Sequelize[_0x53e0('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x53e0('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ba3a3d1..2efb709 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 _0x71ab=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','Integration','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key'];(function(_0x9105f4,_0x3bf6f7){var _0x57a818=function(_0x1c5cf4){while(--_0x1c5cf4){_0x9105f4['push'](_0x9105f4['shift']());}};_0x57a818(++_0x3bf6f7);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['Integration']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['Integration']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['Integration'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x46bea6,_0x4398cb){var _0x89d185=function(_0x182b68){while(--_0x182b68){_0x46bea6['push'](_0x46bea6['shift']());}};_0x89d185(++_0x4398cb);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x34fc37,_0x45095e){_0x34fc37=_0x34fc37-0x0;var _0x19abb7=_0xc1c6[_0x34fc37];return _0x19abb7;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a2e3fec..04f3ad0 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 _0x1241=['integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x1241,0x1ef));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require('util');var logger=require(_0x1124('0x1'))(_0x1124('0x2'));var moment=require(_0x1124('0x3'));var BPromise=require(_0x1124('0x4'));var rp=require(_0x1124('0x5'));var fs=require('fs');var path=require(_0x1124('0x6'));var rimraf=require(_0x1124('0x7'));var config=require(_0x1124('0x8'));var attributes=require(_0x1124('0x9'));module[_0x1124('0xa')]=function(_0x58edde,_0x2f34fe){return _0x58edde[_0x1124('0xb')]('Integration',attributes,{'tableName':_0x1124('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x090a=['exports','define','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xca8958,_0x25eed8){var _0x3d7165=function(_0x5dcced){while(--_0x5dcced){_0xca8958['push'](_0xca8958['shift']());}};_0x3d7165(++_0x25eed8);}(_0x090a,0x156));var _0xa090=function(_0x3676f1,_0x19c567){_0x3676f1=_0x3676f1-0x0;var _0x19f97d=_0x090a[_0x3676f1];return _0x19f97d;};'use strict';var _=require(_0xa090('0x0'));var util=require('util');var logger=require(_0xa090('0x1'))(_0xa090('0x2'));var moment=require(_0xa090('0x3'));var BPromise=require(_0xa090('0x4'));var rp=require(_0xa090('0x5'));var fs=require('fs');var path=require(_0xa090('0x6'));var rimraf=require(_0xa090('0x7'));var config=require(_0xa090('0x8'));var attributes=require('./integration.attributes');module[_0xa090('0x9')]=function(_0x1c135e,_0x2989ae){return _0x1c135e[_0xa090('0xa')](_0xa090('0xb'),attributes,{'tableName':_0xa090('0xc'),'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 bbabddc..a35cecc 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5f3ea5,_0x16d76d){var _0x3bbc1f=function(_0x2c9be3){while(--_0x2c9be3){_0x5f3ea5['push'](_0x5f3ea5['shift']());}};_0x3bbc1f(++_0x16d76d);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x59ce6a,_0x234b9f){var _0x59bc1d=function(_0x20a10c){while(--_0x20a10c){_0x59ce6a['push'](_0x59ce6a['shift']());}};_0x59bc1d(++_0x234b9f);}(_0xdb28,0x106));var _0x8db2=function(_0x104c7a,_0xb15a53){_0x104c7a=_0x104c7a-0x0;var _0x3c81f6=_0xdb28[_0x104c7a];return _0x3c81f6;};'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')]('Integration,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 7802cc6..d88edf0 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x568039,_0x570f8e){var _0x1595fc=function(_0x50ac8f){while(--_0x50ac8f){_0x568039['push'](_0x568039['shift']());}};_0x1595fc(++_0x570f8e);}(_0xadb5,0xad));var _0x5adb=function(_0x2c8ce2,_0x1f744d){_0x2c8ce2=_0x2c8ce2-0x0;var _0x3a44bc=_0xadb5[_0x2c8ce2];return _0x3a44bc;};'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('./integrationReport.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')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x55e1d1,_0x3c9376){var _0x1165db=function(_0x5b0120){while(--_0x5b0120){_0x55e1d1['push'](_0x55e1d1['shift']());}};_0x1165db(++_0x3c9376);}(_0xd943,0x15d));var _0x3d94=function(_0x833be8,_0x1df9fe){_0x833be8=_0x833be8-0x0;var _0x3a3088=_0xd943[_0x833be8];return _0x3a3088;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 0297f9c..fee108a 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 _0x8c99=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x556e6f,_0x4dd56a){var _0x252902=function(_0x41817f){while(--_0x41817f){_0x556e6f['push'](_0x556e6f['shift']());}};_0x252902(++_0x4dd56a);}(_0x8c99,0x1a8));var _0x98c9=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x8c99[_0x7feb90];return _0x3c5b33;};'use strict';var Sequelize=require(_0x98c9('0x0'));module[_0x98c9('0x1')]={'integration':{'type':Sequelize[_0x98c9('0x2')]},'eventChannel':{'type':Sequelize[_0x98c9('0x2')]},'exitStatus':{'type':Sequelize[_0x98c9('0x2')]},'ticketId':{'type':Sequelize[_0x98c9('0x2')]},'integrationId':{'type':Sequelize[_0x98c9('0x3')]},'contacts':{'type':Sequelize[_0x98c9('0x2')]},'uniqueid':{'type':Sequelize[_0x98c9('0x2')]},'calleridnum':{'type':Sequelize[_0x98c9('0x2')]},'calleridname':{'type':Sequelize[_0x98c9('0x2')]},'queue':{'type':Sequelize[_0x98c9('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x98c9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x98c9('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x98c9('0x4')]},'talktime':{'type':Sequelize[_0x98c9('0x3')]},'agentacw':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x98c9('0x3')]},'reason':{'type':Sequelize[_0x98c9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x98c9('0x4')]},'agentdump':{'type':Sequelize[_0x98c9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x98c9('0x4')]},'lastevent':{'type':Sequelize[_0x98c9('0x2')]},'channel':{'type':Sequelize[_0x98c9('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x98c9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x98c9('0x2')]},'connectedlinename':{'type':Sequelize[_0x98c9('0x2')]},'language':{'type':Sequelize[_0x98c9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x98c9('0x2')]},'exten':{'type':Sequelize[_0x98c9('0x2')]},'priority':{'type':Sequelize[_0x98c9('0x2')]},'destchannel':{'type':Sequelize[_0x98c9('0x2')]},'destchannelstate':{'type':Sequelize[_0x98c9('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x98c9('0x2')]},'destcalleridname':{'type':Sequelize[_0x98c9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x98c9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x98c9('0x2')]},'destlanguage':{'type':Sequelize[_0x98c9('0x2')]},'destaccountcode':{'type':Sequelize[_0x98c9('0x2')]},'destcontext':{'type':Sequelize[_0x98c9('0x2')]},'destexten':{'type':Sequelize[_0x98c9('0x2')]},'destpriority':{'type':Sequelize[_0x98c9('0x2')]},'destuniqueid':{'type':Sequelize[_0x98c9('0x2')]},'messageId':{'type':Sequelize[_0x98c9('0x2')]},'inReplyTo':{'type':Sequelize[_0x98c9('0x2')]},'subject':{'type':Sequelize[_0x98c9('0x2')]},'from':{'type':Sequelize[_0x98c9('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x98c9('0x2')]},'attachment':{'type':Sequelize[_0x98c9('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x98c9('0x6')]},'status':{'type':Sequelize['ENUM'](_0x98c9('0x7'),_0x98c9('0x8'),_0x98c9('0x9'),_0x98c9('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x98c9('0x2')]},'appdata':{'type':Sequelize[_0x98c9('0x2')]},'projectId':{'type':Sequelize[_0x98c9('0x3')]}}; \ No newline at end of file +var _0x28ff=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','exports','STRING'];(function(_0x556e75,_0x244403){var _0xd46094=function(_0x164334){while(--_0x164334){_0x556e75['push'](_0x556e75['shift']());}};_0xd46094(++_0x244403);}(_0x28ff,0x1b7));var _0xf28f=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x28ff[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0xf28f('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xf28f('0x1')]},'ticketId':{'type':Sequelize[_0xf28f('0x1')]},'integrationId':{'type':Sequelize[_0xf28f('0x2')]},'contacts':{'type':Sequelize[_0xf28f('0x1')]},'uniqueid':{'type':Sequelize[_0xf28f('0x1')]},'calleridnum':{'type':Sequelize[_0xf28f('0x1')]},'calleridname':{'type':Sequelize[_0xf28f('0x1')]},'queue':{'type':Sequelize[_0xf28f('0x1')]},'interface':{'type':Sequelize[_0xf28f('0x1')]},'membername':{'type':Sequelize[_0xf28f('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf28f('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf28f('0x3')]},'holdtime':{'type':Sequelize[_0xf28f('0x2')]},'agentcomplete':{'type':Sequelize[_0xf28f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf28f('0x3')]},'talktime':{'type':Sequelize[_0xf28f('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf28f('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf28f('0x3')]},'agentdump':{'type':Sequelize[_0xf28f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf28f('0x3')]},'lastevent':{'type':Sequelize[_0xf28f('0x1')]},'channel':{'type':Sequelize[_0xf28f('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf28f('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf28f('0x1')]},'language':{'type':Sequelize[_0xf28f('0x1')]},'accountcode':{'type':Sequelize[_0xf28f('0x1')]},'context':{'type':Sequelize[_0xf28f('0x1')]},'exten':{'type':Sequelize[_0xf28f('0x1')]},'priority':{'type':Sequelize[_0xf28f('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf28f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf28f('0x1')]},'destcalleridname':{'type':Sequelize[_0xf28f('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf28f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf28f('0x1')]},'destlanguage':{'type':Sequelize[_0xf28f('0x1')]},'destaccountcode':{'type':Sequelize[_0xf28f('0x1')]},'destcontext':{'type':Sequelize[_0xf28f('0x1')]},'destexten':{'type':Sequelize[_0xf28f('0x1')]},'destpriority':{'type':Sequelize[_0xf28f('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xf28f('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf28f('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf28f('0x1')]},'cc':{'type':Sequelize[_0xf28f('0x1')]},'attachment':{'type':Sequelize[_0xf28f('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf28f('0x5')]},'status':{'type':Sequelize[_0xf28f('0x6')]('SENT','SENDING',_0xf28f('0x7'),_0xf28f('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xf28f('0x1')]},'projectId':{'type':Sequelize[_0xf28f('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3f51a0a..0792e07 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 _0xaec5=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','fields','create','body','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0xaec5,0x1b3));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5aec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5aec('0x1'));var rp=require(_0x5aec('0x2'));var moment=require(_0x5aec('0x3'));var BPromise=require(_0x5aec('0x4'));var Mustache=require(_0x5aec('0x5'));var util=require(_0x5aec('0x6'));var path=require(_0x5aec('0x7'));var sox=require(_0x5aec('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5aec('0x9'));var crypto=require(_0x5aec('0xa'));var jsforce=require(_0x5aec('0xb'));var deskjs=require(_0x5aec('0xc'));var toCsv=require(_0x5aec('0xd'));var querystring=require(_0x5aec('0xe'));var Papa=require(_0x5aec('0xf'));var Redis=require(_0x5aec('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5aec('0x11'));var as=require(_0x5aec('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5aec('0x13'))(_0x5aec('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5aec('0x15'));var db=require(_0x5aec('0x16'))['db'];function respondWithStatusCode(_0x19b7db,_0x1bd510){_0x1bd510=_0x1bd510||0xcc;return function(_0x29985d){if(_0x29985d){return _0x19b7db[_0x5aec('0x17')](_0x1bd510);}return _0x19b7db[_0x5aec('0x18')](_0x1bd510)['end']();};}function respondWithResult(_0x5dc061,_0x765fd5){_0x765fd5=_0x765fd5||0xc8;return function(_0x29a352){if(_0x29a352){return _0x5dc061[_0x5aec('0x18')](_0x765fd5)[_0x5aec('0x19')](_0x29a352);}};}function respondWithFilteredResult(_0x3f72ab,_0x31bac7){return function(_0x18bd30){if(_0x18bd30){var _0x3e2401=typeof _0x31bac7[_0x5aec('0x1a')]===_0x5aec('0x1b')&&typeof _0x31bac7[_0x5aec('0x1c')]===_0x5aec('0x1b');var _0x2cd02f=_0x18bd30[_0x5aec('0x1d')];var _0x201aa1=_0x3e2401?0x0:_0x31bac7['offset'];var _0x2a27e5=_0x3e2401?_0x18bd30['count']:_0x31bac7['offset']+_0x31bac7[_0x5aec('0x1c')];var _0x3632f8;if(_0x2a27e5>=_0x2cd02f){_0x2a27e5=_0x2cd02f;_0x3632f8=0xc8;}else{_0x3632f8=0xce;}_0x3f72ab[_0x5aec('0x18')](_0x3632f8);return _0x3f72ab[_0x5aec('0x1e')](_0x5aec('0x1f'),_0x201aa1+'-'+_0x2a27e5+'/'+_0x2cd02f)[_0x5aec('0x19')](_0x18bd30);}return null;};}function patchUpdates(_0x44283f){return function(_0x4c9939){try{jsonpatch[_0x5aec('0x20')](_0x4c9939,_0x44283f,!![]);}catch(_0x21d3b1){return BPromise[_0x5aec('0x21')](_0x21d3b1);}return _0x4c9939[_0x5aec('0x22')]();};}function saveUpdates(_0x363ae4,_0x15d31a){return function(_0x25e240){if(_0x25e240){return _0x25e240[_0x5aec('0x23')](_0x363ae4)[_0x5aec('0x24')](function(_0x19cc07){return _0x19cc07;});}return null;};}function removeEntity(_0x1f57c7,_0x5c1a8a){return function(_0x4d64b5){if(_0x4d64b5){return _0x4d64b5[_0x5aec('0x25')]()[_0x5aec('0x24')](function(){_0x1f57c7[_0x5aec('0x18')](0xcc)[_0x5aec('0x26')]();});}};}function handleEntityNotFound(_0x2c77d0,_0x46a732){return function(_0x4f1fb8){if(!_0x4f1fb8){_0x2c77d0[_0x5aec('0x17')](0x194);}return _0x4f1fb8;};}function handleError(_0x233685,_0x344986){_0x344986=_0x344986||0x1f4;return function(_0x3500d5){logger[_0x5aec('0x27')](_0x3500d5['stack']);if(_0x3500d5[_0x5aec('0x28')]){delete _0x3500d5[_0x5aec('0x28')];}_0x233685[_0x5aec('0x18')](_0x344986)[_0x5aec('0x29')](_0x3500d5);};}exports[_0x5aec('0x2a')]=function(_0x2be5ca,_0x8829f3){var _0x54ddf6={},_0x447669={},_0x30c00d={'count':0x0,'rows':[]};var _0x1ad552=_[_0x5aec('0x2b')](db[_0x5aec('0x2c')][_0x5aec('0x2d')],function(_0x4731a7){return{'name':_0x4731a7[_0x5aec('0x2e')],'type':_0x4731a7[_0x5aec('0x2f')][_0x5aec('0x30')]};});_0x447669[_0x5aec('0x31')]=_[_0x5aec('0x2b')](_0x1ad552,'name');_0x447669[_0x5aec('0x32')]=_[_0x5aec('0x33')](_0x2be5ca['query']);_0x447669[_0x5aec('0x34')]=_['intersection'](_0x447669['model'],_0x447669[_0x5aec('0x32')]);_0x54ddf6[_0x5aec('0x35')]=_[_0x5aec('0x36')](_0x447669[_0x5aec('0x31')],qs['fields'](_0x2be5ca[_0x5aec('0x32')]['fields']));_0x54ddf6['attributes']=_0x54ddf6[_0x5aec('0x35')][_0x5aec('0x37')]?_0x54ddf6[_0x5aec('0x35')]:_0x447669[_0x5aec('0x31')];if(!_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x38')]('nolimit')){_0x54ddf6[_0x5aec('0x1c')]=qs[_0x5aec('0x1c')](_0x2be5ca[_0x5aec('0x32')]['limit']);_0x54ddf6[_0x5aec('0x1a')]=qs[_0x5aec('0x1a')](_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x1a')]);}_0x54ddf6[_0x5aec('0x39')]=qs[_0x5aec('0x3a')](_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x3a')]);_0x54ddf6[_0x5aec('0x3b')]=qs['filters'](_['pick'](_0x2be5ca['query'],_0x447669[_0x5aec('0x34')]),_0x1ad552);if(_0x2be5ca[_0x5aec('0x32')]['filter']){_0x54ddf6[_0x5aec('0x3b')]=_[_0x5aec('0x3c')](_0x54ddf6[_0x5aec('0x3b')],{'$or':_[_0x5aec('0x2b')](_0x1ad552,function(_0x1acac8){if(_0x1acac8[_0x5aec('0x2f')]!=='VIRTUAL'){var _0x34a483={};_0x34a483[_0x1acac8[_0x5aec('0x28')]]={'$like':'%'+_0x2be5ca['query'][_0x5aec('0x3d')]+'%'};return _0x34a483;}})});}_0x54ddf6=_[_0x5aec('0x3c')]({},_0x54ddf6,_0x2be5ca[_0x5aec('0x3e')]);var _0x3869b6={'where':_0x54ddf6['where']};return db[_0x5aec('0x2c')][_0x5aec('0x1d')](_0x3869b6)[_0x5aec('0x24')](function(_0x110990){_0x30c00d[_0x5aec('0x1d')]=_0x110990;if(_0x2be5ca[_0x5aec('0x32')][_0x5aec('0x3f')]){_0x54ddf6[_0x5aec('0x40')]=[{'all':!![]}];}return db[_0x5aec('0x2c')][_0x5aec('0x41')](_0x54ddf6);})[_0x5aec('0x24')](function(_0x4a1bd0){_0x30c00d[_0x5aec('0x42')]=_0x4a1bd0;return _0x30c00d;})[_0x5aec('0x24')](respondWithFilteredResult(_0x8829f3,_0x54ddf6))[_0x5aec('0x43')](handleError(_0x8829f3,null));};exports['show']=function(_0x467708,_0x3352e1){var _0xba9910={'raw':![],'where':{'id':_0x467708['params']['id']}},_0x34fa20={};_0x34fa20[_0x5aec('0x31')]=_[_0x5aec('0x33')](db[_0x5aec('0x2c')][_0x5aec('0x2d')]);_0x34fa20['query']=_[_0x5aec('0x33')](_0x467708[_0x5aec('0x32')]);_0x34fa20['filters']=_['intersection'](_0x34fa20[_0x5aec('0x31')],_0x34fa20[_0x5aec('0x32')]);_0xba9910[_0x5aec('0x35')]=_[_0x5aec('0x36')](_0x34fa20['model'],qs['fields'](_0x467708['query'][_0x5aec('0x44')]));_0xba9910[_0x5aec('0x35')]=_0xba9910[_0x5aec('0x35')][_0x5aec('0x37')]?_0xba9910[_0x5aec('0x35')]:_0x34fa20[_0x5aec('0x31')];if(_0x467708[_0x5aec('0x32')][_0x5aec('0x3f')]){_0xba9910['include']=[{'all':!![]}];}_0xba9910=_['merge']({},_0xba9910,_0x467708['options']);return db[_0x5aec('0x2c')]['find'](_0xba9910)['then'](handleEntityNotFound(_0x3352e1,null))[_0x5aec('0x24')](respondWithResult(_0x3352e1,null))[_0x5aec('0x43')](handleError(_0x3352e1,null));};exports[_0x5aec('0x45')]=function(_0x56e069,_0x5af35e){return db[_0x5aec('0x2c')]['create'](_0x56e069['body'],{})[_0x5aec('0x24')](respondWithResult(_0x5af35e,0xc9))[_0x5aec('0x43')](handleError(_0x5af35e,null));};exports[_0x5aec('0x23')]=function(_0x1b21f8,_0x2e1cc7){if(_0x1b21f8[_0x5aec('0x46')]['id']){delete _0x1b21f8[_0x5aec('0x46')]['id'];}return db['IntegrationReport'][_0x5aec('0x47')]({'where':{'id':_0x1b21f8[_0x5aec('0x48')]['id']}})[_0x5aec('0x24')](handleEntityNotFound(_0x2e1cc7,null))[_0x5aec('0x24')](saveUpdates(_0x1b21f8[_0x5aec('0x46')],null))[_0x5aec('0x24')](respondWithResult(_0x2e1cc7,null))[_0x5aec('0x43')](handleError(_0x2e1cc7,null));};exports[_0x5aec('0x25')]=function(_0x7c8bab,_0x1272af){return db[_0x5aec('0x2c')]['find']({'where':{'id':_0x7c8bab[_0x5aec('0x48')]['id']}})[_0x5aec('0x24')](handleEntityNotFound(_0x1272af,null))[_0x5aec('0x24')](removeEntity(_0x1272af,null))['catch'](handleError(_0x1272af,null));};exports[_0x5aec('0x49')]=function(_0x356fad,_0x1e07c3){return db['IntegrationReport'][_0x5aec('0x49')]()[_0x5aec('0x24')](respondWithResult(_0x1e07c3,null))[_0x5aec('0x43')](handleError(_0x1e07c3,null));}; \ No newline at end of file +var _0x1550=['limit','sort','filters','filter','where','VIRTUAL','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','status','reject','save','update','then','destroy','error','stack','name','send','index','type','key','map','query','intersection','model','attributes','fields','length','nolimit'];(function(_0x242357,_0x15ed16){var _0x556e04=function(_0x310d9a){while(--_0x310d9a){_0x242357['push'](_0x242357['shift']());}};_0x556e04(++_0x15ed16);}(_0x1550,0x131));var _0x0155=function(_0x55ac0a,_0x2e5512){_0x55ac0a=_0x55ac0a-0x0;var _0x268277=_0x1550[_0x55ac0a];return _0x268277;};'use strict';var emlformat=require(_0x0155('0x0'));var rimraf=require(_0x0155('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0155('0x2'));var rp=require('request-promise');var moment=require(_0x0155('0x3'));var BPromise=require(_0x0155('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0155('0x5'));var sox=require('sox');var csv=require(_0x0155('0x6'));var ejs=require(_0x0155('0x7'));var fs=require('fs');var fs_extra=require(_0x0155('0x8'));var _=require(_0x0155('0x9'));var squel=require(_0x0155('0xa'));var crypto=require(_0x0155('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0155('0xc'));var toCsv=require(_0x0155('0x6'));var querystring=require(_0x0155('0xd'));var Papa=require(_0x0155('0xe'));var Redis=require(_0x0155('0xf'));var authService=require(_0x0155('0x10'));var qs=require(_0x0155('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0155('0x12'));var logger=require('../../config/logger')(_0x0155('0x13'));var utils=require(_0x0155('0x14'));var config=require(_0x0155('0x15'));var licenseUtil=require(_0x0155('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc5df,_0x3566b8){_0x3566b8=_0x3566b8||0xcc;return function(_0x23afaa){if(_0x23afaa){return _0x5dc5df[_0x0155('0x17')](_0x3566b8);}return _0x5dc5df['status'](_0x3566b8)[_0x0155('0x18')]();};}function respondWithResult(_0x1f0ec7,_0x1dcace){_0x1dcace=_0x1dcace||0xc8;return function(_0x20b2d1){if(_0x20b2d1){return _0x1f0ec7['status'](_0x1dcace)[_0x0155('0x19')](_0x20b2d1);}};}function respondWithFilteredResult(_0x4429ed,_0x473064){return function(_0xe52956){if(_0xe52956){var _0x2ca1c6=typeof _0x473064[_0x0155('0x1a')]===_0x0155('0x1b')&&typeof _0x473064['limit']===_0x0155('0x1b');var _0x3ed6e3=_0xe52956[_0x0155('0x1c')];var _0x3e4fec=_0x2ca1c6?0x0:_0x473064['offset'];var _0x20470f=_0x2ca1c6?_0xe52956[_0x0155('0x1c')]:_0x473064[_0x0155('0x1a')]+_0x473064['limit'];var _0x42c718;if(_0x20470f>=_0x3ed6e3){_0x20470f=_0x3ed6e3;_0x42c718=0xc8;}else{_0x42c718=0xce;}_0x4429ed[_0x0155('0x1d')](_0x42c718);return _0x4429ed['set']('Content-Range',_0x3e4fec+'-'+_0x20470f+'/'+_0x3ed6e3)[_0x0155('0x19')](_0xe52956);}return null;};}function patchUpdates(_0x547825){return function(_0x352a09){try{jsonpatch['apply'](_0x352a09,_0x547825,!![]);}catch(_0x42cb20){return BPromise[_0x0155('0x1e')](_0x42cb20);}return _0x352a09[_0x0155('0x1f')]();};}function saveUpdates(_0x4bb8eb,_0x15e9a3){return function(_0x4ae4aa){if(_0x4ae4aa){return _0x4ae4aa[_0x0155('0x20')](_0x4bb8eb)[_0x0155('0x21')](function(_0x1a3ac0){return _0x1a3ac0;});}return null;};}function removeEntity(_0xfdc9e5,_0x36e58f){return function(_0x2336ba){if(_0x2336ba){return _0x2336ba[_0x0155('0x22')]()[_0x0155('0x21')](function(){_0xfdc9e5[_0x0155('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc305,_0x4299ad){return function(_0x1742c9){if(!_0x1742c9){_0x3fc305['sendStatus'](0x194);}return _0x1742c9;};}function handleError(_0x3b99b4,_0x12e404){_0x12e404=_0x12e404||0x1f4;return function(_0x330ad8){logger[_0x0155('0x23')](_0x330ad8[_0x0155('0x24')]);if(_0x330ad8['name']){delete _0x330ad8[_0x0155('0x25')];}_0x3b99b4[_0x0155('0x1d')](_0x12e404)[_0x0155('0x26')](_0x330ad8);};}exports[_0x0155('0x27')]=function(_0x196c9d,_0x54a2be){var _0x28f450={},_0x10ce41={},_0x1e0e4f={'count':0x0,'rows':[]};var _0x2995d3=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x5c737d){return{'name':_0x5c737d['fieldName'],'type':_0x5c737d[_0x0155('0x28')][_0x0155('0x29')]};});_0x10ce41['model']=_[_0x0155('0x2a')](_0x2995d3,_0x0155('0x25'));_0x10ce41[_0x0155('0x2b')]=_['keys'](_0x196c9d[_0x0155('0x2b')]);_0x10ce41['filters']=_[_0x0155('0x2c')](_0x10ce41[_0x0155('0x2d')],_0x10ce41[_0x0155('0x2b')]);_0x28f450[_0x0155('0x2e')]=_[_0x0155('0x2c')](_0x10ce41[_0x0155('0x2d')],qs['fields'](_0x196c9d[_0x0155('0x2b')][_0x0155('0x2f')]));_0x28f450[_0x0155('0x2e')]=_0x28f450[_0x0155('0x2e')][_0x0155('0x30')]?_0x28f450[_0x0155('0x2e')]:_0x10ce41[_0x0155('0x2d')];if(!_0x196c9d[_0x0155('0x2b')]['hasOwnProperty'](_0x0155('0x31'))){_0x28f450[_0x0155('0x32')]=qs[_0x0155('0x32')](_0x196c9d[_0x0155('0x2b')]['limit']);_0x28f450[_0x0155('0x1a')]=qs['offset'](_0x196c9d[_0x0155('0x2b')][_0x0155('0x1a')]);}_0x28f450['order']=qs['sort'](_0x196c9d['query'][_0x0155('0x33')]);_0x28f450['where']=qs[_0x0155('0x34')](_['pick'](_0x196c9d[_0x0155('0x2b')],_0x10ce41[_0x0155('0x34')]),_0x2995d3);if(_0x196c9d[_0x0155('0x2b')][_0x0155('0x35')]){_0x28f450[_0x0155('0x36')]=_['merge'](_0x28f450['where'],{'$or':_['map'](_0x2995d3,function(_0xc8c4aa){if(_0xc8c4aa[_0x0155('0x28')]!==_0x0155('0x37')){var _0x29012d={};_0x29012d[_0xc8c4aa['name']]={'$like':'%'+_0x196c9d['query'][_0x0155('0x35')]+'%'};return _0x29012d;}})});}_0x28f450=_['merge']({},_0x28f450,_0x196c9d['options']);var _0x49e46f={'where':_0x28f450[_0x0155('0x36')]};return db[_0x0155('0x38')][_0x0155('0x1c')](_0x49e46f)['then'](function(_0x3e2155){_0x1e0e4f[_0x0155('0x1c')]=_0x3e2155;if(_0x196c9d[_0x0155('0x2b')][_0x0155('0x39')]){_0x28f450[_0x0155('0x3a')]=[{'all':!![]}];}return db[_0x0155('0x38')][_0x0155('0x3b')](_0x28f450);})[_0x0155('0x21')](function(_0x3f92d3){_0x1e0e4f[_0x0155('0x3c')]=_0x3f92d3;return _0x1e0e4f;})[_0x0155('0x21')](respondWithFilteredResult(_0x54a2be,_0x28f450))[_0x0155('0x3d')](handleError(_0x54a2be,null));};exports[_0x0155('0x3e')]=function(_0x4b67f5,_0x28de4b){var _0x51a55c={'raw':![],'where':{'id':_0x4b67f5[_0x0155('0x3f')]['id']}},_0x1cedff={};_0x1cedff['model']=_['keys'](db[_0x0155('0x38')]['rawAttributes']);_0x1cedff[_0x0155('0x2b')]=_[_0x0155('0x40')](_0x4b67f5[_0x0155('0x2b')]);_0x1cedff[_0x0155('0x34')]=_[_0x0155('0x2c')](_0x1cedff[_0x0155('0x2d')],_0x1cedff['query']);_0x51a55c[_0x0155('0x2e')]=_[_0x0155('0x2c')](_0x1cedff['model'],qs['fields'](_0x4b67f5[_0x0155('0x2b')][_0x0155('0x2f')]));_0x51a55c[_0x0155('0x2e')]=_0x51a55c['attributes']['length']?_0x51a55c[_0x0155('0x2e')]:_0x1cedff[_0x0155('0x2d')];if(_0x4b67f5[_0x0155('0x2b')]['includeAll']){_0x51a55c[_0x0155('0x3a')]=[{'all':!![]}];}_0x51a55c=_[_0x0155('0x41')]({},_0x51a55c,_0x4b67f5[_0x0155('0x42')]);return db['IntegrationReport']['find'](_0x51a55c)[_0x0155('0x21')](handleEntityNotFound(_0x28de4b,null))[_0x0155('0x21')](respondWithResult(_0x28de4b,null))['catch'](handleError(_0x28de4b,null));};exports[_0x0155('0x43')]=function(_0x16318e,_0x336049){return db[_0x0155('0x38')][_0x0155('0x43')](_0x16318e['body'],{})[_0x0155('0x21')](respondWithResult(_0x336049,0xc9))[_0x0155('0x3d')](handleError(_0x336049,null));};exports[_0x0155('0x20')]=function(_0x4c8e79,_0x1811cc){if(_0x4c8e79[_0x0155('0x44')]['id']){delete _0x4c8e79[_0x0155('0x44')]['id'];}return db[_0x0155('0x38')]['find']({'where':{'id':_0x4c8e79[_0x0155('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1811cc,null))[_0x0155('0x21')](saveUpdates(_0x4c8e79[_0x0155('0x44')],null))[_0x0155('0x21')](respondWithResult(_0x1811cc,null))[_0x0155('0x3d')](handleError(_0x1811cc,null));};exports['destroy']=function(_0x11c332,_0x162298){return db[_0x0155('0x38')][_0x0155('0x45')]({'where':{'id':_0x11c332[_0x0155('0x3f')]['id']}})[_0x0155('0x21')](handleEntityNotFound(_0x162298,null))[_0x0155('0x21')](removeEntity(_0x162298,null))[_0x0155('0x3d')](handleError(_0x162298,null));};exports['describe']=function(_0x2146bb,_0x28fdc9){return db['IntegrationReport'][_0x0155('0x46')]()['then'](respondWithResult(_0x28fdc9,null))['catch'](handleError(_0x28fdc9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 495e28f..398a99e 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 _0x4a8c=['exports','report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x191f28,_0x29f917){var _0x3f421a=function(_0xf52828){while(--_0xf52828){_0x191f28['push'](_0x191f28['shift']());}};_0x3f421a(++_0x29f917);}(_0x4a8c,0x147));var _0xc4a8=function(_0x273315,_0x273ae2){_0x273315=_0x273315-0x0;var _0x534691=_0x4a8c[_0x273315];return _0x534691;};'use strict';var _=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var logger=require(_0xc4a8('0x2'))(_0xc4a8('0x3'));var moment=require(_0xc4a8('0x4'));var BPromise=require(_0xc4a8('0x5'));var rp=require(_0xc4a8('0x6'));var fs=require('fs');var path=require(_0xc4a8('0x7'));var rimraf=require(_0xc4a8('0x8'));var config=require(_0xc4a8('0x9'));var attributes=require(_0xc4a8('0xa'));module[_0xc4a8('0xb')]=function(_0x561234,_0x57b332){return _0x561234['define']('IntegrationReport',attributes,{'tableName':_0xc4a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03cb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x3e478c,_0x3afee8){var _0x3a0906=function(_0x580d99){while(--_0x580d99){_0x3e478c['push'](_0x3e478c['shift']());}};_0x3a0906(++_0x3afee8);}(_0x03cb,0x1ad));var _0xb03c=function(_0x21d52b,_0x354e04){_0x21d52b=_0x21d52b-0x0;var _0x13c3b0=_0x03cb[_0x21d52b];return _0x13c3b0;};'use strict';var _=require(_0xb03c('0x0'));var util=require(_0xb03c('0x1'));var logger=require(_0xb03c('0x2'))(_0xb03c('0x3'));var moment=require(_0xb03c('0x4'));var BPromise=require(_0xb03c('0x5'));var rp=require(_0xb03c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb03c('0x7'));var config=require(_0xb03c('0x8'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x5b6726,_0x3ede50){return _0x5b6726[_0xb03c('0x9')](_0xb03c('0xa'),attributes,{'tableName':_0xb03c('0xb'),'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 576ecd2..00e2a53 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x38752b,_0x5e9b2c){var _0x2c0bac=function(_0xd573d2){while(--_0xd573d2){_0x38752b['push'](_0x38752b['shift']());}};_0x2c0bac(++_0x5e9b2c);}(_0x2542,0x169));var _0x2254=function(_0x30bef8,_0x420ad8){_0x30bef8=_0x30bef8-0x0;var _0x17454d=_0x2542[_0x30bef8];return _0x17454d;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x429674,_0x2f8675){var _0x3831eb=function(_0xab7564){while(--_0xab7564){_0x429674['push'](_0x429674['shift']());}};_0x3831eb(++_0x2f8675);}(_0xda19,0xd5));var _0x9da1=function(_0x93d2c9,_0x1a3046){_0x93d2c9=_0x93d2c9-0x0;var _0x108bd0=_0xda19[_0x93d2c9];return _0x108bd0;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1fd1ce1..456bbb3 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 _0x102b=['create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','getIntervals'];(function(_0x26b3f9,_0x2be7c8){var _0x1293d1=function(_0x3a462f){while(--_0x3a462f){_0x26b3f9['push'](_0x26b3f9['shift']());}};_0x1293d1(++_0x2be7c8);}(_0x102b,0x1be));var _0xb102=function(_0x3d26cc,_0x298156){_0x3d26cc=_0x3d26cc-0x0;var _0x758c4e=_0x102b[_0x3d26cc];return _0x758c4e;};'use strict';var multer=require('multer');var util=require(_0xb102('0x0'));var path=require('path');var timeout=require(_0xb102('0x1'));var express=require(_0xb102('0x2'));var router=express[_0xb102('0x3')]();var fs_extra=require(_0xb102('0x4'));var auth=require(_0xb102('0x5'));var interaction=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var controller=require(_0xb102('0x8'));router['get']('/',auth[_0xb102('0x9')](),controller[_0xb102('0xa')]);router[_0xb102('0xb')](_0xb102('0xc'),auth[_0xb102('0x9')](),controller['show']);router[_0xb102('0xb')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xb102('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb102('0xe')]);router[_0xb102('0xf')]('/:id/sub_intervals',auth[_0xb102('0x9')](),controller[_0xb102('0x10')]);router[_0xb102('0xf')](_0xb102('0x11'),auth[_0xb102('0x9')](),controller[_0xb102('0x12')]);router[_0xb102('0x13')]('/:id',auth[_0xb102('0x9')](),controller['update']);router[_0xb102('0x14')](_0xb102('0xc'),auth['isAuthenticated'](),controller[_0xb102('0x15')]);module[_0xb102('0x16')]=router; \ No newline at end of file +var _0x3079=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./interval.controller','get','isAuthenticated','index','show','/:id/sub_intervals','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3079,0x110));var _0x9307=function(_0x3b1ed4,_0x158fec){_0x3b1ed4=_0x3b1ed4-0x0;var _0x2fc35e=_0x3079[_0x3b1ed4];return _0x2fc35e;};'use strict';var multer=require('multer');var util=require(_0x9307('0x0'));var path=require(_0x9307('0x1'));var timeout=require(_0x9307('0x2'));var express=require(_0x9307('0x3'));var router=express['Router']();var fs_extra=require(_0x9307('0x4'));var auth=require(_0x9307('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9307('0x6'));router[_0x9307('0x7')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0x9')]);router[_0x9307('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9307('0xa')]);router['get'](_0x9307('0xb'),auth[_0x9307('0x8')](),controller['getIntervals']);router[_0x9307('0xc')]('/',auth[_0x9307('0x8')](),controller[_0x9307('0xd')]);router['post']('/:id/sub_intervals',auth[_0x9307('0x8')](),controller[_0x9307('0xe')]);router[_0x9307('0xc')](_0x9307('0xf'),auth[_0x9307('0x8')](),controller[_0x9307('0x10')]);router['put'](_0x9307('0x11'),auth[_0x9307('0x8')](),controller['update']);router['delete'](_0x9307('0x11'),auth[_0x9307('0x8')](),controller['destroy']);module[_0x9307('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 2ae904f..4874d6b 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 _0x4e43=['exports','STRING','sequelize'];(function(_0x438dab,_0x13bfc4){var _0x43ae2c=function(_0x4b9fb3){while(--_0x4b9fb3){_0x438dab['push'](_0x438dab['shift']());}};_0x43ae2c(++_0x13bfc4);}(_0x4e43,0x140));var _0x34e4=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0x4e43[_0x3acee8];return _0x5046cc;};'use strict';var Sequelize=require(_0x34e4('0x0'));module[_0x34e4('0x1')]={'name':{'type':Sequelize[_0x34e4('0x2')]},'description':{'type':Sequelize[_0x34e4('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x0c1a=['exports','STRING'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x0c1a,0x160));var _0xa0c1=function(_0x20a487,_0x545b40){_0x20a487=_0x20a487-0x0;var _0x1e5742=_0x0c1a[_0x20a487];return _0x1e5742;};'use strict';var Sequelize=require('sequelize');module[_0xa0c1('0x0')]={'name':{'type':Sequelize[_0xa0c1('0x1')]},'description':{'type':Sequelize[_0xa0c1('0x1')]},'interval':{'type':Sequelize[_0xa0c1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f6046f5..58e5c76 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 _0x944b=['create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','Intervals','UserProfileResource','destroy','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find'];(function(_0x559a11,_0x18f39f){var _0xb8d692=function(_0x584700){while(--_0x584700){_0x559a11['push'](_0x559a11['shift']());}};_0xb8d692(++_0x18f39f);}(_0x944b,0x1a0));var _0xb944=function(_0x21750a,_0x35ee25){_0x21750a=_0x21750a-0x0;var _0x3c391f=_0x944b[_0x21750a];return _0x3c391f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb944('0x0'));var jsonpatch=require(_0xb944('0x1'));var rp=require('request-promise');var moment=require(_0xb944('0x2'));var BPromise=require(_0xb944('0x3'));var Mustache=require(_0xb944('0x4'));var util=require(_0xb944('0x5'));var path=require(_0xb944('0x6'));var sox=require(_0xb944('0x7'));var csv=require(_0xb944('0x8'));var ejs=require(_0xb944('0x9'));var fs=require('fs');var fs_extra=require(_0xb944('0xa'));var _=require('lodash');var squel=require(_0xb944('0xb'));var crypto=require(_0xb944('0xc'));var jsforce=require(_0xb944('0xd'));var deskjs=require(_0xb944('0xe'));var toCsv=require(_0xb944('0x8'));var querystring=require('querystring');var Papa=require(_0xb944('0xf'));var Redis=require(_0xb944('0x10'));var authService=require(_0xb944('0x11'));var qs=require(_0xb944('0x12'));var as=require(_0xb944('0x13'));var hardwareService=require(_0xb944('0x14'));var logger=require(_0xb944('0x15'))(_0xb944('0x16'));var utils=require(_0xb944('0x17'));var config=require(_0xb944('0x18'));var licenseUtil=require(_0xb944('0x19'));var db=require(_0xb944('0x1a'))['db'];var extensions=require(_0xb944('0x1b'));function respondWithStatusCode(_0x177b72,_0x513e2e){_0x513e2e=_0x513e2e||0xcc;return function(_0xb8d97f){if(_0xb8d97f){return _0x177b72[_0xb944('0x1c')](_0x513e2e);}return _0x177b72['status'](_0x513e2e)[_0xb944('0x1d')]();};}function respondWithResult(_0x2db243,_0x518684){_0x518684=_0x518684||0xc8;return function(_0x2e10ce){if(_0x2e10ce){return _0x2db243[_0xb944('0x1e')](_0x518684)[_0xb944('0x1f')](_0x2e10ce);}};}function respondWithFilteredResult(_0x11012c,_0x23f4ee){return function(_0x526517){if(_0x526517){var _0x3cf76c=typeof _0x23f4ee[_0xb944('0x20')]===_0xb944('0x21')&&typeof _0x23f4ee[_0xb944('0x22')]===_0xb944('0x21');var _0x452311=_0x526517[_0xb944('0x23')];var _0x6a9cd6=_0x3cf76c?0x0:_0x23f4ee[_0xb944('0x20')];var _0x18da8f=_0x3cf76c?_0x526517['count']:_0x23f4ee['offset']+_0x23f4ee[_0xb944('0x22')];var _0x2661de;if(_0x18da8f>=_0x452311){_0x18da8f=_0x452311;_0x2661de=0xc8;}else{_0x2661de=0xce;}_0x11012c['status'](_0x2661de);return _0x11012c[_0xb944('0x24')](_0xb944('0x25'),_0x6a9cd6+'-'+_0x18da8f+'/'+_0x452311)['json'](_0x526517);}return null;};}function patchUpdates(_0x15b21a){return function(_0x1c2af0){try{jsonpatch[_0xb944('0x26')](_0x1c2af0,_0x15b21a,!![]);}catch(_0x5277a6){return BPromise[_0xb944('0x27')](_0x5277a6);}return _0x1c2af0[_0xb944('0x28')]();};}function saveUpdates(_0x4e3811,_0x4f0019){return function(_0x2c334a){if(_0x2c334a){return _0x2c334a['update'](_0x4e3811)[_0xb944('0x29')](function(_0x3b8fce){return _0x3b8fce;});}return null;};}function removeEntity(_0x215673,_0x1efcb9){return function(_0x6f2b6b){if(_0x6f2b6b){return _0x6f2b6b['destroy']()[_0xb944('0x29')](function(){var _0x442548=_0x6f2b6b['get']({'plain':!![]});var _0x229474=_0xb944('0x2a');return db[_0xb944('0x2b')][_0xb944('0x2c')]({'where':{'type':_0x229474,'resourceId':_0x442548['id']}})[_0xb944('0x29')](function(){return _0x6f2b6b;});})[_0xb944('0x29')](function(){_0x215673[_0xb944('0x1e')](0xcc)[_0xb944('0x1d')]();});}};}function handleEntityNotFound(_0x57c0b7,_0x5e5bff){return function(_0x1d46a4){if(!_0x1d46a4){_0x57c0b7[_0xb944('0x1c')](0x194);}return _0x1d46a4;};}function handleError(_0x275fec,_0x544c08){_0x544c08=_0x544c08||0x1f4;return function(_0x4f124f){logger[_0xb944('0x2d')](_0x4f124f[_0xb944('0x2e')]);if(_0x4f124f[_0xb944('0x2f')]){delete _0x4f124f[_0xb944('0x2f')];}_0x275fec[_0xb944('0x1e')](_0x544c08)['send'](_0x4f124f);};}exports[_0xb944('0x30')]=function(_0xa3745f,_0x8ea8bd){var _0x52ed76={},_0x193444={},_0x16baea={'count':0x0,'rows':[]};var _0x1ea5c8=_[_0xb944('0x31')](db[_0xb944('0x32')][_0xb944('0x33')],function(_0x345869){return{'name':_0x345869[_0xb944('0x34')],'type':_0x345869[_0xb944('0x35')][_0xb944('0x36')]};});_0x193444[_0xb944('0x37')]=_[_0xb944('0x31')](_0x1ea5c8,'name');_0x193444[_0xb944('0x38')]=_[_0xb944('0x39')](_0xa3745f[_0xb944('0x38')]);_0x193444['filters']=_['intersection'](_0x193444[_0xb944('0x37')],_0x193444[_0xb944('0x38')]);_0x52ed76[_0xb944('0x3a')]=_[_0xb944('0x3b')](_0x193444['model'],qs['fields'](_0xa3745f[_0xb944('0x38')][_0xb944('0x3c')]));_0x52ed76[_0xb944('0x3a')]=_0x52ed76[_0xb944('0x3a')][_0xb944('0x3d')]?_0x52ed76['attributes']:_0x193444[_0xb944('0x37')];if(!_0xa3745f['query'][_0xb944('0x3e')]('nolimit')){_0x52ed76[_0xb944('0x22')]=qs[_0xb944('0x22')](_0xa3745f[_0xb944('0x38')][_0xb944('0x22')]);_0x52ed76[_0xb944('0x20')]=qs[_0xb944('0x20')](_0xa3745f[_0xb944('0x38')]['offset']);}_0x52ed76[_0xb944('0x3f')]=qs[_0xb944('0x40')](_0xa3745f[_0xb944('0x38')][_0xb944('0x40')]);_0x52ed76[_0xb944('0x41')]=qs[_0xb944('0x42')](_[_0xb944('0x43')](_0xa3745f[_0xb944('0x38')],_0x193444[_0xb944('0x42')]),_0x1ea5c8);if(_0xa3745f[_0xb944('0x38')][_0xb944('0x44')]){_0x52ed76[_0xb944('0x41')]=_[_0xb944('0x45')](_0x52ed76[_0xb944('0x41')],{'$or':_[_0xb944('0x31')](_0x1ea5c8,function(_0x1720a0){if(_0x1720a0['type']!==_0xb944('0x46')){var _0x505be0={};_0x505be0[_0x1720a0[_0xb944('0x2f')]]={'$like':'%'+_0xa3745f[_0xb944('0x38')][_0xb944('0x44')]+'%'};return _0x505be0;}})});}_0x52ed76=_[_0xb944('0x45')]({},_0x52ed76,_0xa3745f[_0xb944('0x47')]);var _0x3809ee={'where':_0x52ed76['where']};return db[_0xb944('0x32')][_0xb944('0x23')](_0x3809ee)[_0xb944('0x29')](function(_0x1f258a){_0x16baea[_0xb944('0x23')]=_0x1f258a;if(_0xa3745f[_0xb944('0x38')][_0xb944('0x48')]){_0x52ed76[_0xb944('0x49')]=[{'all':!![]}];}return db[_0xb944('0x32')][_0xb944('0x4a')](_0x52ed76);})[_0xb944('0x29')](function(_0x4a4863){_0x16baea['rows']=_0x4a4863;return _0x16baea;})['then'](respondWithFilteredResult(_0x8ea8bd,_0x52ed76))[_0xb944('0x4b')](handleError(_0x8ea8bd,null));};exports[_0xb944('0x4c')]=function(_0x546eff,_0x5d001d){var _0x1e50f5={'raw':!![],'where':{'id':_0x546eff[_0xb944('0x4d')]['id']}},_0x30715f={};_0x30715f[_0xb944('0x37')]=_['keys'](db[_0xb944('0x32')]['rawAttributes']);_0x30715f[_0xb944('0x38')]=_['keys'](_0x546eff[_0xb944('0x38')]);_0x30715f[_0xb944('0x42')]=_[_0xb944('0x3b')](_0x30715f[_0xb944('0x37')],_0x30715f[_0xb944('0x38')]);_0x1e50f5[_0xb944('0x3a')]=_['intersection'](_0x30715f['model'],qs[_0xb944('0x3c')](_0x546eff[_0xb944('0x38')]['fields']));_0x1e50f5[_0xb944('0x3a')]=_0x1e50f5['attributes'][_0xb944('0x3d')]?_0x1e50f5[_0xb944('0x3a')]:_0x30715f['model'];if(_0x546eff[_0xb944('0x38')][_0xb944('0x48')]){_0x1e50f5[_0xb944('0x49')]=[{'all':!![]}];}_0x1e50f5=_[_0xb944('0x45')]({},_0x1e50f5,_0x546eff[_0xb944('0x47')]);return db['Interval'][_0xb944('0x4e')](_0x1e50f5)[_0xb944('0x29')](handleEntityNotFound(_0x5d001d,null))[_0xb944('0x29')](respondWithResult(_0x5d001d,null))[_0xb944('0x4b')](handleError(_0x5d001d,null));};exports[_0xb944('0x4f')]=function(_0x4cfc7c,_0xa4b911){return db[_0xb944('0x32')]['create'](_0x4cfc7c[_0xb944('0x50')],{})[_0xb944('0x29')](function(_0x313c1f){var _0x9ad63a=_0x4cfc7c[_0xb944('0x51')][_0xb944('0x52')]({'plain':!![]});if(!_0x9ad63a)throw new Error(_0xb944('0x53'));if(_0x9ad63a[_0xb944('0x54')]==='user'){var _0x5cfd64=_0x313c1f[_0xb944('0x52')]({'plain':!![]});var _0x4bc715=_0xb944('0x2a');return db[_0xb944('0x55')]['find']({'where':{'name':_0x4bc715,'userProfileId':_0x9ad63a[_0xb944('0x56')]},'raw':!![]})[_0xb944('0x29')](function(_0x54f60b){if(_0x54f60b&&_0x54f60b[_0xb944('0x57')]===0x0){return db[_0xb944('0x2b')][_0xb944('0x4f')]({'name':_0x5cfd64['name'],'resourceId':_0x5cfd64['id'],'type':_0x54f60b[_0xb944('0x2f')],'sectionId':_0x54f60b['id']},{})['then'](function(){return _0x313c1f;});}else{return _0x313c1f;}})['catch'](function(_0x3bb7dd){logger[_0xb944('0x2d')](_0xb944('0x58'),_0x3bb7dd);throw _0x3bb7dd;});}return _0x313c1f;})[_0xb944('0x29')](respondWithResult(_0xa4b911,0xc9))['catch'](handleError(_0xa4b911,null));};exports[_0xb944('0x59')]=function(_0x179f43,_0xf60503){if(_0x179f43[_0xb944('0x50')]['id']){delete _0x179f43[_0xb944('0x50')]['id'];}return db['Interval'][_0xb944('0x4e')]({'where':{'id':_0x179f43[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0xf60503,null))[_0xb944('0x29')](saveUpdates(_0x179f43['body'],null))[_0xb944('0x29')](respondWithResult(_0xf60503,null))[_0xb944('0x4b')](handleError(_0xf60503,null));};exports[_0xb944('0x2c')]=function(_0x1bb0be,_0x39bc08){return db[_0xb944('0x32')][_0xb944('0x4e')]({'where':{'id':_0x1bb0be[_0xb944('0x4d')]['id']}})['then'](handleEntityNotFound(_0x39bc08,null))[_0xb944('0x29')](removeEntity(_0x39bc08,null))[_0xb944('0x4b')](handleError(_0x39bc08,null));};exports[_0xb944('0x5a')]=function(_0x3405e6,_0x445c6d,_0x5c1bba){if(_0x3405e6[_0xb944('0x50')]['id']){delete _0x3405e6['body']['id'];}return db[_0xb944('0x32')][_0xb944('0x4e')]({'where':{'id':_0x3405e6[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0x445c6d,null))[_0xb944('0x29')](function(_0x5bfdf2){if(_0x5bfdf2){_0x3405e6[_0xb944('0x50')][_0xb944('0x5b')]=_0x5bfdf2['id'];return db[_0xb944('0x32')][_0xb944('0x4f')](_0x3405e6['body']);}})[_0xb944('0x29')](respondWithResult(_0x445c6d,null))['catch'](handleError(_0x445c6d,null));};exports[_0xb944('0x5c')]=function(_0x2014a9,_0x125f2f,_0x116b5e){var _0x1384e2={};var _0x11c9bc={};var _0x29b276;var _0x3927bb;return db[_0xb944('0x32')][_0xb944('0x5d')]({'where':{'id':_0x2014a9[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0x125f2f,null))[_0xb944('0x29')](function(_0x3fb3a3){if(_0x3fb3a3){_0x29b276=_0x3fb3a3;_0x11c9bc[_0xb944('0x37')]=_[_0xb944('0x39')](db['Interval']['rawAttributes']);_0x11c9bc[_0xb944('0x38')]=_[_0xb944('0x39')](_0x2014a9[_0xb944('0x38')]);_0x11c9bc[_0xb944('0x42')]=_[_0xb944('0x3b')](_0x11c9bc['model'],_0x11c9bc[_0xb944('0x38')]);_0x1384e2[_0xb944('0x3a')]=_[_0xb944('0x3b')](_0x11c9bc['model'],qs[_0xb944('0x3c')](_0x2014a9[_0xb944('0x38')]['fields']));_0x1384e2[_0xb944('0x3a')]=_0x1384e2['attributes'][_0xb944('0x3d')]?_0x1384e2[_0xb944('0x3a')]:_0x11c9bc[_0xb944('0x37')];_0x1384e2['order']=qs[_0xb944('0x40')](_0x2014a9[_0xb944('0x38')][_0xb944('0x40')]);_0x1384e2[_0xb944('0x41')]=qs['filters'](_['pick'](_0x2014a9[_0xb944('0x38')],_0x11c9bc[_0xb944('0x42')]));if(_0x2014a9[_0xb944('0x38')][_0xb944('0x44')]){_0x1384e2[_0xb944('0x41')]=_[_0xb944('0x45')](_0x1384e2['where'],{'$or':_[_0xb944('0x31')](_0x1384e2[_0xb944('0x3a')],function(_0xa7b8dd){var _0x412f07={};_0x412f07[_0xa7b8dd]={'$like':'%'+_0x2014a9[_0xb944('0x38')][_0xb944('0x44')]+'%'};return _0x412f07;})});}_0x1384e2=_[_0xb944('0x45')]({},_0x1384e2,_0x2014a9[_0xb944('0x47')]);return _0x29b276[_0xb944('0x5c')](_0x1384e2);}})[_0xb944('0x29')](function(_0x10d830){if(_0x10d830){_0x3927bb=_0x10d830[_0xb944('0x3d')];if(!_0x2014a9[_0xb944('0x38')][_0xb944('0x3e')](_0xb944('0x5e'))){_0x1384e2[_0xb944('0x22')]=qs['limit'](_0x2014a9[_0xb944('0x38')][_0xb944('0x22')]);_0x1384e2['offset']=qs['offset'](_0x2014a9['query'][_0xb944('0x20')]);}return _0x29b276['getIntervals'](_0x1384e2);}})[_0xb944('0x29')](function(_0x2f5e89){if(_0x2f5e89){return _0x2f5e89?{'count':_0x3927bb,'rows':_0x2f5e89}:null;}})[_0xb944('0x29')](respondWithResult(_0x125f2f,null))[_0xb944('0x4b')](handleError(_0x125f2f,null));};exports[_0xb944('0x5f')]=function(_0x104df6,_0xaea98b,_0x37a5e5){return db[_0xb944('0x32')][_0xb944('0x5d')]({'where':{'id':_0x104df6[_0xb944('0x4d')]['id']}})[_0xb944('0x29')](handleEntityNotFound(_0xaea98b,null))[_0xb944('0x29')](function(_0x14b7ed){if(_0x14b7ed){return db[_0xb944('0x60')][_0xb944('0x61')](function(_0x18bc87){return db[_0xb944('0x32')][_0xb944('0x2c')]({'where':{'IntervalId':_0x104df6['params']['id']},'transaction':_0x18bc87})['then'](function(_0x7b05f2){var _0x17fdb7=_['map'](_0x104df6[_0xb944('0x50')],function(_0x32b5b7){delete _0x32b5b7['id'];_0x32b5b7[_0xb944('0x5b')]=_0x104df6[_0xb944('0x4d')]['id'];return _0x32b5b7;});return db[_0xb944('0x32')][_0xb944('0x62')](_0x17fdb7,{'transaction':_0x18bc87});});})[_0xb944('0x29')](function(){return db[_0xb944('0x32')][_0xb944('0x4a')]({'where':{'IntervalId':_0x104df6[_0xb944('0x4d')]['id']}});});}})['then'](respondWithResult(_0xaea98b,null))['catch'](handleError(_0xaea98b,null));}; \ No newline at end of file +var _0xb523=['reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','sendStatus','name','send','index','map','Interval','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','getIntervals','findOne','keys','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','limit','count','set','apply'];(function(_0x3f9d42,_0x429c01){var _0x3a731d=function(_0x570a8e){while(--_0x570a8e){_0x3f9d42['push'](_0x3f9d42['shift']());}};_0x3a731d(++_0x429c01);}(_0xb523,0xf1));var _0x3b52=function(_0x18c521,_0x48f22c){_0x18c521=_0x18c521-0x0;var _0x5c2726=_0xb523[_0x18c521];return _0x5c2726;};'use strict';var emlformat=require(_0x3b52('0x0'));var rimraf=require(_0x3b52('0x1'));var zipdir=require(_0x3b52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b52('0x3'));var moment=require(_0x3b52('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b52('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3b52('0x6'));var csv=require(_0x3b52('0x7'));var ejs=require(_0x3b52('0x8'));var fs=require('fs');var fs_extra=require(_0x3b52('0x9'));var _=require(_0x3b52('0xa'));var squel=require('squel');var crypto=require(_0x3b52('0xb'));var jsforce=require(_0x3b52('0xc'));var deskjs=require(_0x3b52('0xd'));var toCsv=require(_0x3b52('0x7'));var querystring=require(_0x3b52('0xe'));var Papa=require(_0x3b52('0xf'));var Redis=require(_0x3b52('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b52('0x11'));var as=require(_0x3b52('0x12'));var hardwareService=require(_0x3b52('0x13'));var logger=require(_0x3b52('0x14'))(_0x3b52('0x15'));var utils=require(_0x3b52('0x16'));var config=require(_0x3b52('0x17'));var licenseUtil=require(_0x3b52('0x18'));var db=require(_0x3b52('0x19'))['db'];var extensions=require(_0x3b52('0x1a'));function respondWithStatusCode(_0x577025,_0x3b2157){_0x3b2157=_0x3b2157||0xcc;return function(_0x50560e){if(_0x50560e){return _0x577025['sendStatus'](_0x3b2157);}return _0x577025[_0x3b52('0x1b')](_0x3b2157)['end']();};}function respondWithResult(_0x21fc6f,_0x3cbcaa){_0x3cbcaa=_0x3cbcaa||0xc8;return function(_0x48c5b6){if(_0x48c5b6){return _0x21fc6f[_0x3b52('0x1b')](_0x3cbcaa)[_0x3b52('0x1c')](_0x48c5b6);}};}function respondWithFilteredResult(_0x5e6112,_0x2de2b1){return function(_0x38b7d5){if(_0x38b7d5){var _0x294c80=typeof _0x2de2b1[_0x3b52('0x1d')]===_0x3b52('0x1e')&&typeof _0x2de2b1[_0x3b52('0x1f')]===_0x3b52('0x1e');var _0x475f12=_0x38b7d5[_0x3b52('0x20')];var _0x44ff79=_0x294c80?0x0:_0x2de2b1[_0x3b52('0x1d')];var _0x268bd5=_0x294c80?_0x38b7d5[_0x3b52('0x20')]:_0x2de2b1['offset']+_0x2de2b1[_0x3b52('0x1f')];var _0x14ee38;if(_0x268bd5>=_0x475f12){_0x268bd5=_0x475f12;_0x14ee38=0xc8;}else{_0x14ee38=0xce;}_0x5e6112['status'](_0x14ee38);return _0x5e6112[_0x3b52('0x21')]('Content-Range',_0x44ff79+'-'+_0x268bd5+'/'+_0x475f12)[_0x3b52('0x1c')](_0x38b7d5);}return null;};}function patchUpdates(_0xa55c6c){return function(_0x2586da){try{jsonpatch[_0x3b52('0x22')](_0x2586da,_0xa55c6c,!![]);}catch(_0x33d023){return BPromise[_0x3b52('0x23')](_0x33d023);}return _0x2586da[_0x3b52('0x24')]();};}function saveUpdates(_0x5ef202,_0x2e9ac9){return function(_0x21c609){if(_0x21c609){return _0x21c609[_0x3b52('0x25')](_0x5ef202)[_0x3b52('0x26')](function(_0x377f6d){return _0x377f6d;});}return null;};}function removeEntity(_0x3ab73c,_0x4b4ff7){return function(_0x380111){if(_0x380111){return _0x380111[_0x3b52('0x27')]()[_0x3b52('0x26')](function(){var _0x1e1f75=_0x380111[_0x3b52('0x28')]({'plain':!![]});var _0x4f39f5=_0x3b52('0x29');return db[_0x3b52('0x2a')]['destroy']({'where':{'type':_0x4f39f5,'resourceId':_0x1e1f75['id']}})['then'](function(){return _0x380111;});})[_0x3b52('0x26')](function(){_0x3ab73c[_0x3b52('0x1b')](0xcc)[_0x3b52('0x2b')]();});}};}function handleEntityNotFound(_0x289654,_0x485305){return function(_0x17d113){if(!_0x17d113){_0x289654[_0x3b52('0x2c')](0x194);}return _0x17d113;};}function handleError(_0x3ebbb9,_0x1c970a){_0x1c970a=_0x1c970a||0x1f4;return function(_0x215326){logger['error'](_0x215326['stack']);if(_0x215326['name']){delete _0x215326[_0x3b52('0x2d')];}_0x3ebbb9['status'](_0x1c970a)[_0x3b52('0x2e')](_0x215326);};}exports[_0x3b52('0x2f')]=function(_0x1dd381,_0x2e4c96){var _0x34c490={},_0x4e462a={},_0x57446c={'count':0x0,'rows':[]};var _0x311846=_[_0x3b52('0x30')](db[_0x3b52('0x31')]['rawAttributes'],function(_0x210f7c){return{'name':_0x210f7c[_0x3b52('0x32')],'type':_0x210f7c[_0x3b52('0x33')]['key']};});_0x4e462a[_0x3b52('0x34')]=_[_0x3b52('0x30')](_0x311846,'name');_0x4e462a['query']=_['keys'](_0x1dd381[_0x3b52('0x35')]);_0x4e462a[_0x3b52('0x36')]=_[_0x3b52('0x37')](_0x4e462a[_0x3b52('0x34')],_0x4e462a[_0x3b52('0x35')]);_0x34c490[_0x3b52('0x38')]=_['intersection'](_0x4e462a[_0x3b52('0x34')],qs['fields'](_0x1dd381[_0x3b52('0x35')]['fields']));_0x34c490[_0x3b52('0x38')]=_0x34c490['attributes'][_0x3b52('0x39')]?_0x34c490[_0x3b52('0x38')]:_0x4e462a[_0x3b52('0x34')];if(!_0x1dd381[_0x3b52('0x35')][_0x3b52('0x3a')]('nolimit')){_0x34c490[_0x3b52('0x1f')]=qs['limit'](_0x1dd381['query'][_0x3b52('0x1f')]);_0x34c490[_0x3b52('0x1d')]=qs[_0x3b52('0x1d')](_0x1dd381[_0x3b52('0x35')][_0x3b52('0x1d')]);}_0x34c490['order']=qs[_0x3b52('0x3b')](_0x1dd381['query']['sort']);_0x34c490[_0x3b52('0x3c')]=qs['filters'](_[_0x3b52('0x3d')](_0x1dd381[_0x3b52('0x35')],_0x4e462a['filters']),_0x311846);if(_0x1dd381['query'][_0x3b52('0x3e')]){_0x34c490['where']=_[_0x3b52('0x3f')](_0x34c490['where'],{'$or':_['map'](_0x311846,function(_0x12f758){if(_0x12f758['type']!=='VIRTUAL'){var _0x41fc65={};_0x41fc65[_0x12f758['name']]={'$like':'%'+_0x1dd381['query'][_0x3b52('0x3e')]+'%'};return _0x41fc65;}})});}_0x34c490=_[_0x3b52('0x3f')]({},_0x34c490,_0x1dd381[_0x3b52('0x40')]);var _0x41fd92={'where':_0x34c490[_0x3b52('0x3c')]};return db[_0x3b52('0x31')][_0x3b52('0x20')](_0x41fd92)[_0x3b52('0x26')](function(_0x4db7f2){_0x57446c[_0x3b52('0x20')]=_0x4db7f2;if(_0x1dd381[_0x3b52('0x35')][_0x3b52('0x41')]){_0x34c490[_0x3b52('0x42')]=[{'all':!![]}];}return db['Interval'][_0x3b52('0x43')](_0x34c490);})[_0x3b52('0x26')](function(_0x26d604){_0x57446c[_0x3b52('0x44')]=_0x26d604;return _0x57446c;})[_0x3b52('0x26')](respondWithFilteredResult(_0x2e4c96,_0x34c490))[_0x3b52('0x45')](handleError(_0x2e4c96,null));};exports[_0x3b52('0x46')]=function(_0x34eda3,_0x3cdc7e){var _0x1ae8ac={'raw':!![],'where':{'id':_0x34eda3['params']['id']}},_0x3c4250={};_0x3c4250[_0x3b52('0x34')]=_['keys'](db['Interval'][_0x3b52('0x47')]);_0x3c4250[_0x3b52('0x35')]=_['keys'](_0x34eda3[_0x3b52('0x35')]);_0x3c4250[_0x3b52('0x36')]=_[_0x3b52('0x37')](_0x3c4250[_0x3b52('0x34')],_0x3c4250[_0x3b52('0x35')]);_0x1ae8ac[_0x3b52('0x38')]=_[_0x3b52('0x37')](_0x3c4250['model'],qs[_0x3b52('0x48')](_0x34eda3[_0x3b52('0x35')]['fields']));_0x1ae8ac[_0x3b52('0x38')]=_0x1ae8ac['attributes'][_0x3b52('0x39')]?_0x1ae8ac[_0x3b52('0x38')]:_0x3c4250[_0x3b52('0x34')];if(_0x34eda3[_0x3b52('0x35')]['includeAll']){_0x1ae8ac[_0x3b52('0x42')]=[{'all':!![]}];}_0x1ae8ac=_[_0x3b52('0x3f')]({},_0x1ae8ac,_0x34eda3[_0x3b52('0x40')]);return db['Interval']['find'](_0x1ae8ac)[_0x3b52('0x26')](handleEntityNotFound(_0x3cdc7e,null))['then'](respondWithResult(_0x3cdc7e,null))['catch'](handleError(_0x3cdc7e,null));};exports[_0x3b52('0x49')]=function(_0x5a0893,_0x500d4b){return db['Interval'][_0x3b52('0x49')](_0x5a0893['body'],{})[_0x3b52('0x26')](function(_0x10068c){var _0x5729a9=_0x5a0893[_0x3b52('0x4a')][_0x3b52('0x28')]({'plain':!![]});if(!_0x5729a9)throw new Error(_0x3b52('0x4b'));if(_0x5729a9['role']==='user'){var _0x49fc7d=_0x10068c[_0x3b52('0x28')]({'plain':!![]});var _0x2cbd10=_0x3b52('0x29');return db[_0x3b52('0x4c')][_0x3b52('0x4d')]({'where':{'name':_0x2cbd10,'userProfileId':_0x5729a9[_0x3b52('0x4e')]},'raw':!![]})[_0x3b52('0x26')](function(_0x5541c5){if(_0x5541c5&&_0x5541c5['autoAssociation']===0x0){return db['UserProfileResource'][_0x3b52('0x49')]({'name':_0x49fc7d[_0x3b52('0x2d')],'resourceId':_0x49fc7d['id'],'type':_0x5541c5[_0x3b52('0x2d')],'sectionId':_0x5541c5['id']},{})[_0x3b52('0x26')](function(){return _0x10068c;});}else{return _0x10068c;}})[_0x3b52('0x45')](function(_0x533446){logger[_0x3b52('0x4f')](_0x3b52('0x50'),_0x533446);throw _0x533446;});}return _0x10068c;})[_0x3b52('0x26')](respondWithResult(_0x500d4b,0xc9))[_0x3b52('0x45')](handleError(_0x500d4b,null));};exports[_0x3b52('0x25')]=function(_0x4c78d5,_0x99aed2){if(_0x4c78d5['body']['id']){delete _0x4c78d5[_0x3b52('0x51')]['id'];}return db[_0x3b52('0x31')][_0x3b52('0x4d')]({'where':{'id':_0x4c78d5[_0x3b52('0x52')]['id']}})['then'](handleEntityNotFound(_0x99aed2,null))['then'](saveUpdates(_0x4c78d5[_0x3b52('0x51')],null))[_0x3b52('0x26')](respondWithResult(_0x99aed2,null))[_0x3b52('0x45')](handleError(_0x99aed2,null));};exports['destroy']=function(_0x9ed0c8,_0x54b864){return db[_0x3b52('0x31')][_0x3b52('0x4d')]({'where':{'id':_0x9ed0c8[_0x3b52('0x52')]['id']}})[_0x3b52('0x26')](handleEntityNotFound(_0x54b864,null))[_0x3b52('0x26')](removeEntity(_0x54b864,null))[_0x3b52('0x45')](handleError(_0x54b864,null));};exports[_0x3b52('0x53')]=function(_0x3ae307,_0x5a5585,_0x1c7d70){if(_0x3ae307[_0x3b52('0x51')]['id']){delete _0x3ae307[_0x3b52('0x51')]['id'];}return db[_0x3b52('0x31')][_0x3b52('0x4d')]({'where':{'id':_0x3ae307[_0x3b52('0x52')]['id']}})[_0x3b52('0x26')](handleEntityNotFound(_0x5a5585,null))[_0x3b52('0x26')](function(_0x10158a){if(_0x10158a){_0x3ae307[_0x3b52('0x51')]['IntervalId']=_0x10158a['id'];return db[_0x3b52('0x31')][_0x3b52('0x49')](_0x3ae307[_0x3b52('0x51')]);}})[_0x3b52('0x26')](respondWithResult(_0x5a5585,null))['catch'](handleError(_0x5a5585,null));};exports[_0x3b52('0x54')]=function(_0x931028,_0x205a81,_0x34139e){var _0x10390a={};var _0xe737ea={};var _0x42eee5;var _0x2463ac;return db[_0x3b52('0x31')][_0x3b52('0x55')]({'where':{'id':_0x931028['params']['id']}})[_0x3b52('0x26')](handleEntityNotFound(_0x205a81,null))[_0x3b52('0x26')](function(_0x100eb7){if(_0x100eb7){_0x42eee5=_0x100eb7;_0xe737ea['model']=_[_0x3b52('0x56')](db[_0x3b52('0x31')]['rawAttributes']);_0xe737ea['query']=_[_0x3b52('0x56')](_0x931028[_0x3b52('0x35')]);_0xe737ea[_0x3b52('0x36')]=_[_0x3b52('0x37')](_0xe737ea[_0x3b52('0x34')],_0xe737ea[_0x3b52('0x35')]);_0x10390a[_0x3b52('0x38')]=_[_0x3b52('0x37')](_0xe737ea['model'],qs[_0x3b52('0x48')](_0x931028[_0x3b52('0x35')][_0x3b52('0x48')]));_0x10390a[_0x3b52('0x38')]=_0x10390a[_0x3b52('0x38')]['length']?_0x10390a[_0x3b52('0x38')]:_0xe737ea[_0x3b52('0x34')];_0x10390a['order']=qs[_0x3b52('0x3b')](_0x931028[_0x3b52('0x35')][_0x3b52('0x3b')]);_0x10390a[_0x3b52('0x3c')]=qs[_0x3b52('0x36')](_[_0x3b52('0x3d')](_0x931028[_0x3b52('0x35')],_0xe737ea[_0x3b52('0x36')]));if(_0x931028[_0x3b52('0x35')]['filter']){_0x10390a[_0x3b52('0x3c')]=_['merge'](_0x10390a['where'],{'$or':_['map'](_0x10390a[_0x3b52('0x38')],function(_0x16f53e){var _0x585368={};_0x585368[_0x16f53e]={'$like':'%'+_0x931028[_0x3b52('0x35')]['filter']+'%'};return _0x585368;})});}_0x10390a=_[_0x3b52('0x3f')]({},_0x10390a,_0x931028['options']);return _0x42eee5['getIntervals'](_0x10390a);}})[_0x3b52('0x26')](function(_0x42f970){if(_0x42f970){_0x2463ac=_0x42f970[_0x3b52('0x39')];if(!_0x931028[_0x3b52('0x35')][_0x3b52('0x3a')]('nolimit')){_0x10390a[_0x3b52('0x1f')]=qs[_0x3b52('0x1f')](_0x931028[_0x3b52('0x35')][_0x3b52('0x1f')]);_0x10390a['offset']=qs[_0x3b52('0x1d')](_0x931028[_0x3b52('0x35')]['offset']);}return _0x42eee5[_0x3b52('0x54')](_0x10390a);}})['then'](function(_0x3d68fc){if(_0x3d68fc){return _0x3d68fc?{'count':_0x2463ac,'rows':_0x3d68fc}:null;}})[_0x3b52('0x26')](respondWithResult(_0x205a81,null))[_0x3b52('0x45')](handleError(_0x205a81,null));};exports[_0x3b52('0x57')]=function(_0x1396b3,_0x21f98a,_0x462e5e){return db['Interval'][_0x3b52('0x55')]({'where':{'id':_0x1396b3[_0x3b52('0x52')]['id']}})[_0x3b52('0x26')](handleEntityNotFound(_0x21f98a,null))['then'](function(_0x1c6a8e){if(_0x1c6a8e){return db[_0x3b52('0x58')][_0x3b52('0x59')](function(_0x36b09f){return db[_0x3b52('0x31')]['destroy']({'where':{'IntervalId':_0x1396b3['params']['id']},'transaction':_0x36b09f})[_0x3b52('0x26')](function(_0x38d00f){var _0xce00d5=_[_0x3b52('0x30')](_0x1396b3[_0x3b52('0x51')],function(_0x40dc2c){delete _0x40dc2c['id'];_0x40dc2c[_0x3b52('0x5a')]=_0x1396b3[_0x3b52('0x52')]['id'];return _0x40dc2c;});return db[_0x3b52('0x31')][_0x3b52('0x5b')](_0xce00d5,{'transaction':_0x36b09f});});})[_0x3b52('0x26')](function(){return db[_0x3b52('0x31')][_0x3b52('0x43')]({'where':{'IntervalId':_0x1396b3[_0x3b52('0x52')]['id']}});});}})[_0x3b52('0x26')](respondWithResult(_0x21f98a,null))[_0x3b52('0x45')](handleError(_0x21f98a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 211b69f..ef6f857 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 _0x0505=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0xa81926,_0x38e368){var _0x8177ef=function(_0x2b3726){while(--_0x2b3726){_0xa81926['push'](_0xa81926['shift']());}};_0x8177ef(++_0x38e368);}(_0x0505,0xe7));var _0x5050=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0505[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5050('0x0'));var util=require('util');var logger=require(_0x5050('0x1'))(_0x5050('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5050('0x3'));var fs=require('fs');var path=require(_0x5050('0x4'));var rimraf=require(_0x5050('0x5'));var config=require(_0x5050('0x6'));var attributes=require(_0x5050('0x7'));var extensions=require(_0x5050('0x8'));module[_0x5050('0x9')]=function(_0x10023c,_0x23c986){return _0x10023c[_0x5050('0xa')](_0x5050('0xb'),attributes,{'tableName':_0x5050('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e63f6,_0x758511){extensions['rewrite'](_0x10023c,_0x3e63f6);},'afterBulkCreate':function(_0x175c2d,_0x5d755b,_0x496341){_0x496341();extensions['rewrite'](_0x10023c,_0x175c2d[0x0]);},'afterUpdate':function(_0xa931e4,_0x247d1f){extensions[_0x5050('0xd')](_0x10023c,_0xa931e4);},'afterDestroy':function(_0x4ae051,_0x295c73){extensions[_0x5050('0xd')](_0x10023c,_0x4ae051);}}});}; \ No newline at end of file +var _0x1199=['moment','bluebird','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0x1199,0x168));var _0x9119=function(_0x486398,_0x370d53){_0x486398=_0x486398-0x0;var _0x2d4bc5=_0x1199[_0x486398];return _0x2d4bc5;};'use strict';var _=require(_0x9119('0x0'));var util=require(_0x9119('0x1'));var logger=require(_0x9119('0x2'))(_0x9119('0x3'));var moment=require(_0x9119('0x4'));var BPromise=require(_0x9119('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9119('0x6'));var rimraf=require(_0x9119('0x7'));var config=require(_0x9119('0x8'));var attributes=require('./interval.attributes');var extensions=require(_0x9119('0x9'));module[_0x9119('0xa')]=function(_0x3e16df,_0x485e4a){return _0x3e16df[_0x9119('0xb')]('Interval',attributes,{'tableName':_0x9119('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c1dda,_0x266b6e){extensions[_0x9119('0xd')](_0x3e16df,_0x4c1dda);},'afterBulkCreate':function(_0x15e3fd,_0x45c668,_0x380458){_0x380458();extensions['rewrite'](_0x3e16df,_0x15e3fd[0x0]);},'afterUpdate':function(_0xf65bf,_0x395e59){extensions[_0x9119('0xd')](_0x3e16df,_0xf65bf);},'afterDestroy':function(_0x339186,_0x2ce0a6){extensions[_0x9119('0xd')](_0x3e16df,_0x339186);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 1bae978..484da8c 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(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5221f17..dc6cc88 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x4bc027,_0x433587){var _0x227241=function(_0x33ccc8){while(--_0x33ccc8){_0x4bc027['push'](_0x4bc027['shift']());}};_0x227241(++_0x433587);}(_0xadb5,0xad));var _0x5adb=function(_0x25c00a,_0x238dfd){_0x25c00a=_0x25c00a-0x0;var _0x5e452c=_0xadb5[_0x25c00a];return _0x5e452c;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index c563805..0524d6b 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 _0xd09c=['data','end','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','stringify','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','setEncoding','utf8'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd09c,0x16f));var _0xcd09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd09c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0xcd09('0x0'));var logger=require('../../config/logger')(_0xcd09('0x1'));var USERNAME=_0xcd09('0x2');var PASSWORD=_0xcd09('0x3');function openIssue(_0x5066b5,_0x336681){var _0x39bb17={'fields':{'project':{'key':_0x5066b5[_0xcd09('0x4')]||_0xcd09('0x5')},'summary':(_0x5066b5['summary']||_0xcd09('0x6'))+_0xcd09('0x7')+_0x5066b5['ip'],'description':_0x5066b5['description']||JSON[_0xcd09('0x8')](_0x5066b5),'issuetype':{'name':_0x5066b5['issuetype']||_0xcd09('0x9')}}};_0x39bb17[_0xcd09('0xa')][_0xcd09('0xb')]=_0x5066b5[_0xcd09('0xc')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0xd')]=_0x5066b5[_0xcd09('0xe')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0xf')]=_0x5066b5[_0xcd09('0x10')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x11')]=_0x5066b5['name'];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x12')]=_0x5066b5[_0xcd09('0x13')];_0x39bb17[_0xcd09('0xa')][_0xcd09('0x14')]=_0x5066b5['ip'];var _0x5381a2={'host':_0xcd09('0x15'),'port':0x1bb,'path':_0xcd09('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xcd09('0x17'),'Authorization':_0xcd09('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0xcd09('0x19')](_0xcd09('0x1a'))}};var _0x5bf858=JSON['stringify'](_0x39bb17);var _0x9ec693=https['request'](_0x5381a2,function(_0x1977d2){_0x1977d2[_0xcd09('0x1b')](_0xcd09('0x1c'));var _0x90f080='';_0x1977d2['on'](_0xcd09('0x1d'),function(_0x29976f){_0x90f080+=_0x29976f;});_0x1977d2['on'](_0xcd09('0x1e'),function(){if(_0x336681){return _0x336681[_0xcd09('0x1f')](_0x1977d2[_0xcd09('0x20')])['json'](JSON[_0xcd09('0x21')](_0x90f080));}});});_0x9ec693['on']('error',function(_0x5dea77){if(_0x336681){return _0x336681['status'](0x1f4)[_0xcd09('0x22')]({'errors':[{'message':_0xcd09('0x23'),'type':'api.jira'}]});}});_0x9ec693[_0xcd09('0x24')](_0x5bf858);_0x9ec693['end']();}exports[_0xcd09('0x25')]=openIssue;exports[_0xcd09('0x26')]=function(_0x103f6d,_0x221f27){_0x103f6d[_0xcd09('0x27')]['ip']=_0x103f6d[_0xcd09('0x28')][_0xcd09('0x29')]||_0x103f6d[_0xcd09('0x2a')][_0xcd09('0x2b')]||_0x103f6d['socket'][_0xcd09('0x2b')]||_0x103f6d['connection']['socket']['remoteAddress'];return openIssue(_0x103f6d[_0xcd09('0x27')],_0x221f27);}; \ No newline at end of file +var _0x6b72=['customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','utf8','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields'];(function(_0x32c97a,_0x29b6fc){var _0x5de34d=function(_0x97daf7){while(--_0x97daf7){_0x32c97a['push'](_0x32c97a['shift']());}};_0x5de34d(++_0x29b6fc);}(_0x6b72,0x1bc));var _0x26b7=function(_0x5b655b,_0x38fe25){_0x5b655b=_0x5b655b-0x0;var _0x5dc92d=_0x6b72[_0x5b655b];return _0x5dc92d;};'use strict';var BPromise=require(_0x26b7('0x0'));var https=require(_0x26b7('0x1'));var logger=require(_0x26b7('0x2'))(_0x26b7('0x3'));var USERNAME=_0x26b7('0x4');var PASSWORD=_0x26b7('0x5');function openIssue(_0x132f41,_0x213a1f){var _0xd98867={'fields':{'project':{'key':_0x132f41[_0x26b7('0x6')]||_0x26b7('0x7')},'summary':(_0x132f41[_0x26b7('0x8')]||_0x26b7('0x9'))+_0x26b7('0xa')+_0x132f41['ip'],'description':_0x132f41[_0x26b7('0xb')]||JSON[_0x26b7('0xc')](_0x132f41),'issuetype':{'name':_0x132f41[_0x26b7('0xd')]||_0x26b7('0xe')}}};_0xd98867[_0x26b7('0xf')][_0x26b7('0x10')]=_0x132f41[_0x26b7('0x11')];_0xd98867['fields'][_0x26b7('0x12')]=_0x132f41['oldToken'];_0xd98867['fields'][_0x26b7('0x13')]=_0x132f41[_0x26b7('0x14')];_0xd98867[_0x26b7('0xf')]['customfield_11503']=_0x132f41['name'];_0xd98867['fields'][_0x26b7('0x15')]=_0x132f41[_0x26b7('0x16')];_0xd98867[_0x26b7('0xf')]['customfield_10102']=_0x132f41['ip'];var _0x1373c3={'host':_0x26b7('0x17'),'port':0x1bb,'path':_0x26b7('0x18'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x26b7('0x19'),'Authorization':_0x26b7('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x26b7('0x1b'))}};var _0xf74d02=JSON[_0x26b7('0xc')](_0xd98867);var _0x54024d=https[_0x26b7('0x1c')](_0x1373c3,function(_0x439bff){_0x439bff['setEncoding'](_0x26b7('0x1d'));var _0x295645='';_0x439bff['on'](_0x26b7('0x1e'),function(_0x89b135){_0x295645+=_0x89b135;});_0x439bff['on'](_0x26b7('0x1f'),function(){if(_0x213a1f){return _0x213a1f[_0x26b7('0x20')](_0x439bff[_0x26b7('0x21')])[_0x26b7('0x22')](JSON[_0x26b7('0x23')](_0x295645));}});});_0x54024d['on'](_0x26b7('0x24'),function(_0x17ba51){if(_0x213a1f){return _0x213a1f[_0x26b7('0x20')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x26b7('0x25')}]});}});_0x54024d[_0x26b7('0x26')](_0xf74d02);_0x54024d[_0x26b7('0x1f')]();}exports[_0x26b7('0x27')]=openIssue;exports['send']=function(_0x39f2a1,_0x256eaa){_0x39f2a1[_0x26b7('0x28')]['ip']=_0x39f2a1[_0x26b7('0x29')][_0x26b7('0x2a')]||_0x39f2a1[_0x26b7('0x2b')][_0x26b7('0x2c')]||_0x39f2a1['socket'][_0x26b7('0x2c')]||_0x39f2a1[_0x26b7('0x2b')][_0x26b7('0x2d')][_0x26b7('0x2c')];return openIssue(_0x39f2a1['body'],_0x256eaa);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b49e325..410b8ea 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 _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x8ef611,_0x439e6c){var _0x54a581=function(_0xcda69f){while(--_0xcda69f){_0x8ef611['push'](_0x8ef611['shift']());}};_0x54a581(++_0x439e6c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0xcb91[_0x1bc0ae];return _0x501104;};'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')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xaa88=['/describe','isAuthenticated','describe','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xaa88,0x137));var _0x8aa8=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0xaa88[_0x4c70c4];return _0x437865;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var fs_extra=require(_0x8aa8('0x5'));var auth=require(_0x8aa8('0x6'));var interaction=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var controller=require(_0x8aa8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8aa8('0xa')]);router['get'](_0x8aa8('0xb'),auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0xe')]('/:id',auth[_0x8aa8('0xc')](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa8('0x11')]);router[_0x8aa8('0x12')](_0x8aa8('0x13'),auth[_0x8aa8('0xc')](),controller['update']);router[_0x8aa8('0x14')](_0x8aa8('0x13'),auth['isAuthenticated'](),controller[_0x8aa8('0x15')]);module[_0x8aa8('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5b5558b..8bdb793 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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x7b9af0,_0x4936e7){_0x7b9af0=_0x7b9af0-0x0;var _0x497e1e=_0x7a54[_0x7b9af0];return _0x497e1e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x265987,_0x3ef969){_0x265987=_0x265987-0x0;var _0x558965=_0x7a54[_0x265987];return _0x558965;};'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 cb63f7c..69b373d 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 _0x2caf=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x5c5d59,_0x2bd27b){var _0x49717f=function(_0x159bbd){while(--_0x159bbd){_0x5c5d59['push'](_0x5c5d59['shift']());}};_0x49717f(++_0x2bd27b);}(_0x2caf,0x6a));var _0xf2ca=function(_0x150d10,_0x242363){_0x150d10=_0x150d10-0x0;var _0x15e15a=_0x2caf[_0x150d10];return _0x15e15a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){_0x1767f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfcb0b,_0x1b3c01){return function(_0x214fa9){if(!_0x214fa9){_0xbfcb0b[_0xf2ca('0x25')](0x194);}return _0x214fa9;};}function handleError(_0x1255ba,_0x427a17){_0x427a17=_0x427a17||0x1f4;return function(_0x339e10){logger[_0xf2ca('0x26')](_0x339e10['stack']);if(_0x339e10[_0xf2ca('0x27')]){delete _0x339e10[_0xf2ca('0x27')];}_0x1255ba[_0xf2ca('0x18')](_0x427a17)[_0xf2ca('0x28')](_0x339e10);};}exports[_0xf2ca('0x29')]=function(_0x41fc04,_0x17707e){var _0xb0ae21={},_0x1b44fb={},_0x20a523={'count':0x0,'rows':[]};var _0xf92250=_[_0xf2ca('0x2a')](db[_0xf2ca('0x2b')][_0xf2ca('0x2c')],function(_0x2b0649){return{'name':_0x2b0649[_0xf2ca('0x2d')],'type':_0x2b0649[_0xf2ca('0x2e')][_0xf2ca('0x2f')]};});_0x1b44fb[_0xf2ca('0x30')]=_['map'](_0xf92250,_0xf2ca('0x27'));_0x1b44fb[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x41fc04[_0xf2ca('0x31')]);_0x1b44fb[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x1b44fb[_0xf2ca('0x30')],_0x1b44fb[_0xf2ca('0x31')]);_0xb0ae21[_0xf2ca('0x35')]=_['intersection'](_0x1b44fb[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x41fc04[_0xf2ca('0x31')]['fields']));_0xb0ae21[_0xf2ca('0x35')]=_0xb0ae21['attributes'][_0xf2ca('0x37')]?_0xb0ae21[_0xf2ca('0x35')]:_0x1b44fb[_0xf2ca('0x30')];if(!_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x38')]('nolimit')){_0xb0ae21['limit']=qs[_0xf2ca('0x1b')](_0x41fc04['query'][_0xf2ca('0x1b')]);_0xb0ae21[_0xf2ca('0x1a')]=qs[_0xf2ca('0x1a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x1a')]);}_0xb0ae21[_0xf2ca('0x39')]=qs[_0xf2ca('0x3a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3a')]);_0xb0ae21[_0xf2ca('0x3b')]=qs[_0xf2ca('0x33')](_[_0xf2ca('0x3c')](_0x41fc04[_0xf2ca('0x31')],_0x1b44fb[_0xf2ca('0x33')]),_0xf92250);if(_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]){_0xb0ae21['where']=_[_0xf2ca('0x3e')](_0xb0ae21[_0xf2ca('0x3b')],{'$or':_[_0xf2ca('0x2a')](_0xf92250,function(_0x148570){if(_0x148570['type']!==_0xf2ca('0x3f')){var _0x4b0e0e={};_0x4b0e0e[_0x148570[_0xf2ca('0x27')]]={'$like':'%'+_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]+'%'};return _0x4b0e0e;}})});}_0xb0ae21=_[_0xf2ca('0x3e')]({},_0xb0ae21,_0x41fc04[_0xf2ca('0x40')]);var _0x4fbaec={'where':_0xb0ae21[_0xf2ca('0x3b')]};return db[_0xf2ca('0x2b')]['count'](_0x4fbaec)[_0xf2ca('0x24')](function(_0x29ebce){_0x20a523[_0xf2ca('0x1c')]=_0x29ebce;if(_0x41fc04['query'][_0xf2ca('0x41')]){_0xb0ae21['include']=[{'all':!![]}];}return db[_0xf2ca('0x2b')][_0xf2ca('0x42')](_0xb0ae21);})[_0xf2ca('0x24')](function(_0x43b2c2){_0x20a523[_0xf2ca('0x43')]=_0x43b2c2;return _0x20a523;})[_0xf2ca('0x24')](respondWithFilteredResult(_0x17707e,_0xb0ae21))[_0xf2ca('0x44')](handleError(_0x17707e,null));};exports[_0xf2ca('0x45')]=function(_0x43b3c7,_0x128535){var _0x17de81={'raw':!![],'where':{'id':_0x43b3c7[_0xf2ca('0x46')]['id']}},_0x3360d9={};_0x3360d9[_0xf2ca('0x30')]=_[_0xf2ca('0x32')](db['JscriptyAnswerReport'][_0xf2ca('0x2c')]);_0x3360d9[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x43b3c7[_0xf2ca('0x31')]);_0x3360d9[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],_0x3360d9[_0xf2ca('0x31')]);_0x17de81[_0xf2ca('0x35')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x43b3c7[_0xf2ca('0x31')]['fields']));_0x17de81['attributes']=_0x17de81[_0xf2ca('0x35')][_0xf2ca('0x37')]?_0x17de81['attributes']:_0x3360d9[_0xf2ca('0x30')];if(_0x43b3c7['query'][_0xf2ca('0x41')]){_0x17de81[_0xf2ca('0x47')]=[{'all':!![]}];}_0x17de81=_[_0xf2ca('0x3e')]({},_0x17de81,_0x43b3c7['options']);return db[_0xf2ca('0x2b')][_0xf2ca('0x48')](_0x17de81)['then'](handleEntityNotFound(_0x128535,null))[_0xf2ca('0x24')](respondWithResult(_0x128535,null))[_0xf2ca('0x44')](handleError(_0x128535,null));};exports[_0xf2ca('0x49')]=function(_0x3e92cf,_0x4a6439){return db[_0xf2ca('0x2b')][_0xf2ca('0x49')](_0x3e92cf[_0xf2ca('0x4a')],{})['then'](respondWithResult(_0x4a6439,0xc9))['catch'](handleError(_0x4a6439,null));};exports[_0xf2ca('0x22')]=function(_0x2f7596,_0x1a65c6){if(_0x2f7596[_0xf2ca('0x4a')]['id']){delete _0x2f7596[_0xf2ca('0x4a')]['id'];}return db[_0xf2ca('0x2b')]['find']({'where':{'id':_0x2f7596['params']['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x1a65c6,null))[_0xf2ca('0x24')](saveUpdates(_0x2f7596['body'],null))[_0xf2ca('0x24')](respondWithResult(_0x1a65c6,null))['catch'](handleError(_0x1a65c6,null));};exports[_0xf2ca('0x23')]=function(_0x59bbb8,_0x26a483){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x59bbb8[_0xf2ca('0x46')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x26a483,null))['then'](removeEntity(_0x26a483,null))[_0xf2ca('0x44')](handleError(_0x26a483,null));};exports[_0xf2ca('0x4b')]=function(_0x2eb8d5,_0x14850c){return db[_0xf2ca('0x2b')][_0xf2ca('0x4b')]()['then'](respondWithResult(_0x14850c,null))[_0xf2ca('0x44')](handleError(_0x14850c,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(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x687b,0x14a));var _0xb687=function(_0x3428b3,_0x4396cc){_0x3428b3=_0x3428b3-0x0;var _0x4474ad=_0x687b[_0x3428b3];return _0x4474ad;};'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 dfa0ff3..72e6635 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 _0x4f19=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','util'];(function(_0x42e5f4,_0x227c39){var _0xe8c411=function(_0x22748d){while(--_0x22748d){_0x42e5f4['push'](_0x42e5f4['shift']());}};_0xe8c411(++_0x227c39);}(_0x4f19,0x1af));var _0x94f1=function(_0x4c6e4a,_0x100f5f){_0x4c6e4a=_0x4c6e4a-0x0;var _0x3a9ea9=_0x4f19[_0x4c6e4a];return _0x3a9ea9;};'use strict';var _=require('lodash');var util=require(_0x94f1('0x0'));var logger=require(_0x94f1('0x1'))(_0x94f1('0x2'));var moment=require(_0x94f1('0x3'));var BPromise=require(_0x94f1('0x4'));var rp=require(_0x94f1('0x5'));var fs=require('fs');var path=require(_0x94f1('0x6'));var rimraf=require(_0x94f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x94f1('0x8'));module['exports']=function(_0x13f515,_0x1a05ca){return _0x13f515[_0x94f1('0x9')](_0x94f1('0xa'),attributes,{'tableName':_0x94f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb1f4=['../../config/environment','./jscriptyAnswerReport.attributes','exports','report_jscripty_answers','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x59c5be,_0x16f949){var _0x4996aa=function(_0x3929ce){while(--_0x3929ce){_0x59c5be['push'](_0x59c5be['shift']());}};_0x4996aa(++_0x16f949);}(_0xb1f4,0x159));var _0x4b1f=function(_0x3e8e11,_0x6753dd){_0x3e8e11=_0x3e8e11-0x0;var _0x290f86=_0xb1f4[_0x3e8e11];return _0x290f86;};'use strict';var _=require(_0x4b1f('0x0'));var util=require(_0x4b1f('0x1'));var logger=require(_0x4b1f('0x2'))('api');var moment=require(_0x4b1f('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b1f('0x4'));var fs=require('fs');var path=require(_0x4b1f('0x5'));var rimraf=require(_0x4b1f('0x6'));var config=require(_0x4b1f('0x7'));var attributes=require(_0x4b1f('0x8'));module[_0x4b1f('0x9')]=function(_0xb193b0,_0xe356ea){return _0xb193b0['define']('JscriptyAnswerReport',attributes,{'tableName':_0x4b1f('0xa'),'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 bb49756..b5208bb 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 _0x2005=['JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x580238,_0x2adec2){var _0x3d5608=function(_0x281c35){while(--_0x281c35){_0x580238['push'](_0x580238['shift']());}};_0x3d5608(++_0x2adec2);}(_0x2005,0xfb));var _0x5200=function(_0x437e8a,_0x44dfba){_0x437e8a=_0x437e8a-0x0;var _0x5e9910=_0x2005[_0x437e8a];return _0x5e9910;};'use strict';var _=require('lodash');var util=require(_0x5200('0x0'));var moment=require(_0x5200('0x1'));var BPromise=require('bluebird');var rs=require(_0x5200('0x2'));var fs=require('fs');var Redis=require(_0x5200('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5200('0x4'));var logger=require(_0x5200('0x5'))('rpc');var config=require(_0x5200('0x6'));var jayson=require(_0x5200('0x7'));var client=jayson[_0x5200('0x8')][_0x5200('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a69d6,_0x572edb,_0x1932de){return new BPromise(function(_0x4ff5c2,_0x26990d){return client[_0x5200('0xa')](_0x4a69d6,_0x1932de)[_0x5200('0xb')](function(_0x44bd34){logger[_0x5200('0xc')](_0x5200('0xd'),_0x572edb,_0x5200('0xe'));logger[_0x5200('0xf')](_0x5200('0x10'),_0x572edb,'request\x20sent',JSON[_0x5200('0x11')](_0x44bd34));if(_0x44bd34['error']){if(_0x44bd34['error'][_0x5200('0x12')]===0x1f4){logger['error'](_0x5200('0xd'),_0x572edb,_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);return _0x26990d(_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);}logger['error'](_0x5200('0xd'),_0x572edb,_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);return _0x4ff5c2(_0x44bd34[_0x5200('0x13')][_0x5200('0x14')]);}else{logger[_0x5200('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x572edb,_0x5200('0xe'));_0x4ff5c2(_0x44bd34['result'][_0x5200('0x14')]);}})[_0x5200('0x15')](function(_0x3e6629){logger['error'](_0x5200('0xd'),_0x572edb,_0x3e6629);_0x26990d(_0x3e6629);});});} \ No newline at end of file +var _0x2c39=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xabf05f,_0x32993c){var _0x3161e5=function(_0x43e0ba){while(--_0x43e0ba){_0xabf05f['push'](_0xabf05f['shift']());}};_0x3161e5(++_0x32993c);}(_0x2c39,0x1b4));var _0x92c3=function(_0x45c0da,_0x4f9492){_0x45c0da=_0x45c0da-0x0;var _0x51efff=_0x2c39[_0x45c0da];return _0x51efff;};'use strict';var _=require(_0x92c3('0x0'));var util=require(_0x92c3('0x1'));var moment=require('moment');var BPromise=require(_0x92c3('0x2'));var rs=require(_0x92c3('0x3'));var fs=require('fs');var Redis=require(_0x92c3('0x4'));var db=require(_0x92c3('0x5'))['db'];var utils=require(_0x92c3('0x6'));var logger=require(_0x92c3('0x7'))('rpc');var config=require(_0x92c3('0x8'));var jayson=require(_0x92c3('0x9'));var client=jayson[_0x92c3('0xa')][_0x92c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25b13b,_0x3a5ea5,_0x54e698){return new BPromise(function(_0x31f269,_0x4712b3){return client[_0x92c3('0xc')](_0x25b13b,_0x54e698)[_0x92c3('0xd')](function(_0x5dd533){logger['info'](_0x92c3('0xe'),_0x3a5ea5,_0x92c3('0xf'));logger[_0x92c3('0x10')](_0x92c3('0x11'),_0x3a5ea5,_0x92c3('0xf'),JSON[_0x92c3('0x12')](_0x5dd533));if(_0x5dd533[_0x92c3('0x13')]){if(_0x5dd533[_0x92c3('0x13')]['code']===0x1f4){logger['error'](_0x92c3('0xe'),_0x3a5ea5,_0x5dd533[_0x92c3('0x13')][_0x92c3('0x14')]);return _0x4712b3(_0x5dd533['error'][_0x92c3('0x14')]);}logger[_0x92c3('0x13')](_0x92c3('0xe'),_0x3a5ea5,_0x5dd533[_0x92c3('0x13')][_0x92c3('0x14')]);return _0x31f269(_0x5dd533['error']['message']);}else{logger[_0x92c3('0x15')](_0x92c3('0xe'),_0x3a5ea5,_0x92c3('0xf'));_0x31f269(_0x5dd533[_0x92c3('0x16')][_0x92c3('0x14')]);}})[_0x92c3('0x17')](function(_0x1dc419){logger[_0x92c3('0x13')](_0x92c3('0xe'),_0x3a5ea5,_0x1dc419);_0x4712b3(_0x1dc419);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 729a236..9c7e743 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 _0x520c=['getAnswers','get','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers'];(function(_0x2425b3,_0x32ca53){var _0x2b9ebd=function(_0x526217){while(--_0x526217){_0x2425b3['push'](_0x2425b3['shift']());}};_0x2b9ebd(++_0x32ca53);}(_0x520c,0x9e));var _0xc520=function(_0x58a4ac,_0x43fd42){_0x58a4ac=_0x58a4ac-0x0;var _0x545810=_0x520c[_0x58a4ac];return _0x545810;};'use strict';var multer=require(_0xc520('0x0'));var util=require(_0xc520('0x1'));var path=require(_0xc520('0x2'));var timeout=require(_0xc520('0x3'));var express=require('express');var router=express[_0xc520('0x4')]();var fs_extra=require(_0xc520('0x5'));var auth=require(_0xc520('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc520('0x7'));var controller=require(_0xc520('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc520('0x9')]);router['get'](_0xc520('0xa'),auth[_0xc520('0xb')](),controller[_0xc520('0xc')]);router['get'](_0xc520('0xd'),auth[_0xc520('0xb')](),controller[_0xc520('0xe')]);router['get'](_0xc520('0xf'),auth[_0xc520('0xb')](),controller[_0xc520('0x10')]);router[_0xc520('0x11')](_0xc520('0x12'),auth[_0xc520('0xb')](),timeout(_0xc520('0x13')),controller['getSummary']);router[_0xc520('0x14')]('/',auth['isAuthenticated'](),controller[_0xc520('0x15')]);router[_0xc520('0x14')](_0xc520('0x16'),auth[_0xc520('0xb')](),controller[_0xc520('0x17')]);router[_0xc520('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xc520('0x19')]);router[_0xc520('0x1a')]('/:id',auth[_0xc520('0xb')](),controller[_0xc520('0x1b')]);module[_0xc520('0x1c')]=router; \ No newline at end of file +var _0x3bdf=['path','connect-timeout','express','Router','../../components/interaction/service','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','/:id/clone','put','update','destroy','exports','util'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x3bdf,0xe0));var _0xf3bd=function(_0x224b3e,_0x2d6c81){_0x224b3e=_0x224b3e-0x0;var _0x2c5655=_0x3bdf[_0x224b3e];return _0x2c5655;};'use strict';var multer=require('multer');var util=require(_0xf3bd('0x0'));var path=require(_0xf3bd('0x1'));var timeout=require(_0xf3bd('0x2'));var express=require(_0xf3bd('0x3'));var router=express[_0xf3bd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf3bd('0x5'));var config=require('../../config/environment');var controller=require(_0xf3bd('0x6'));router[_0xf3bd('0x7')]('/',auth['isAuthenticated'](),controller[_0xf3bd('0x8')]);router[_0xf3bd('0x7')](_0xf3bd('0x9'),auth[_0xf3bd('0xa')](),controller[_0xf3bd('0xb')]);router['get'](_0xf3bd('0xc'),auth[_0xf3bd('0xa')](),controller[_0xf3bd('0xd')]);router['get'](_0xf3bd('0xe'),auth[_0xf3bd('0xa')](),controller[_0xf3bd('0xf')]);router[_0xf3bd('0x7')](_0xf3bd('0x10'),auth[_0xf3bd('0xa')](),timeout('30s'),controller[_0xf3bd('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf3bd('0x12')]);router[_0xf3bd('0x13')](_0xf3bd('0x14'),auth[_0xf3bd('0xa')](),controller['clone']);router[_0xf3bd('0x15')]('/:id',auth[_0xf3bd('0xa')](),controller[_0xf3bd('0x16')]);router['delete']('/:id',auth[_0xf3bd('0xa')](),controller[_0xf3bd('0x17')]);module[_0xf3bd('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 8c00ad3..39f66fe 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 _0x7c12=['name','description','BOOLEAN','sequelize','lodash','util','STRING','long','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x2355dc,_0x4e56c6){var _0x92e239=function(_0x7d6872){while(--_0x7d6872){_0x2355dc['push'](_0x2355dc['shift']());}};_0x92e239(++_0x4e56c6);}(_0x7c12,0x8a));var _0x27c1=function(_0x2e76a7,_0x23871a){_0x2e76a7=_0x2e76a7-0x0;var _0x454cde=_0x7c12[_0x2e76a7];return _0x454cde;};'use strict';var Sequelize=require(_0x27c1('0x0'));var _=require(_0x27c1('0x1'));var util=require(_0x27c1('0x2'));module['exports']={'name':{'type':Sequelize[_0x27c1('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x27c1('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x27c1('0x4')),'set':function(_0x5e2be7){if(_['isObjectLike'](_0x5e2be7)){this['setDataValue']('formData',JSON[_0x27c1('0x5')](_0x5e2be7));}else if(_[_0x27c1('0x6')](_0x5e2be7)){this[_0x27c1('0x7')](_0x27c1('0x8'),_0x5e2be7);}else{this[_0x27c1('0x7')]('formData',util[_0x27c1('0x9')](_0x27c1('0xa'),this[_0x27c1('0xb')](_0x27c1('0xc'))||'',this[_0x27c1('0xb')](_0x27c1('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x27c1('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x27c1('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xcc7c=['util','exports','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','getDataValue','description','sequelize','lodash'];(function(_0x5acacb,_0x250ff0){var _0x5ee8eb=function(_0xd8dfea){while(--_0xd8dfea){_0x5acacb['push'](_0x5acacb['shift']());}};_0x5ee8eb(++_0x250ff0);}(_0xcc7c,0x7c));var _0xccc7=function(_0x32ffd3,_0x5538fa){_0x32ffd3=_0x32ffd3-0x0;var _0x5806ae=_0xcc7c[_0x32ffd3];return _0x5806ae;};'use strict';var Sequelize=require(_0xccc7('0x0'));var _=require(_0xccc7('0x1'));var util=require(_0xccc7('0x2'));module[_0xccc7('0x3')]={'name':{'type':Sequelize[_0xccc7('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xccc7('0x5')](_0xccc7('0x6')),'set':function(_0x3cff06){if(_[_0xccc7('0x7')](_0x3cff06)){this['setDataValue'](_0xccc7('0x8'),JSON[_0xccc7('0x9')](_0x3cff06));}else if(_[_0xccc7('0xa')](_0x3cff06)){this[_0xccc7('0xb')]('formData',_0x3cff06);}else{this[_0xccc7('0xb')](_0xccc7('0x8'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xccc7('0xc')]('name')||'',this[_0xccc7('0xc')](_0xccc7('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7b039ec..fa8d98b 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 _0x56c8=['order','sort','where','pick','filter','merge','VIRTUAL','rows','show','params','keys','includeAll','include','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','error','name','JscriptyProject','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x5ca99f,_0x5c9d05){var _0x2df281=function(_0x2fc456){while(--_0x2fc456){_0x5ca99f['push'](_0x5ca99f['shift']());}};_0x2df281(++_0x5c9d05);}(_0x56c8,0x12f));var _0x856c=function(_0x7e2da0,_0x7f32fc){_0x7e2da0=_0x7e2da0-0x0;var _0x1b472e=_0x56c8[_0x7e2da0];return _0x1b472e;};'use strict';var emlformat=require(_0x856c('0x0'));var rimraf=require(_0x856c('0x1'));var zipdir=require(_0x856c('0x2'));var jsonpatch=require(_0x856c('0x3'));var rp=require('request-promise');var moment=require(_0x856c('0x4'));var BPromise=require(_0x856c('0x5'));var Mustache=require(_0x856c('0x6'));var util=require(_0x856c('0x7'));var path=require(_0x856c('0x8'));var sox=require('sox');var csv=require(_0x856c('0x9'));var ejs=require(_0x856c('0xa'));var fs=require('fs');var fs_extra=require(_0x856c('0xb'));var _=require(_0x856c('0xc'));var squel=require(_0x856c('0xd'));var crypto=require(_0x856c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x856c('0x9'));var querystring=require(_0x856c('0xf'));var Papa=require(_0x856c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x856c('0x11'));var hardwareService=require(_0x856c('0x12'));var logger=require(_0x856c('0x13'))('api');var utils=require(_0x856c('0x14'));var config=require(_0x856c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x856c('0x16'))['db'];function respondWithStatusCode(_0x117c1a,_0x326656){_0x326656=_0x326656||0xcc;return function(_0x28c3d4){if(_0x28c3d4){return _0x117c1a[_0x856c('0x17')](_0x326656);}return _0x117c1a[_0x856c('0x18')](_0x326656)[_0x856c('0x19')]();};}function respondWithResult(_0xc4d331,_0x5e493f){_0x5e493f=_0x5e493f||0xc8;return function(_0x45213f){if(_0x45213f){return _0xc4d331['status'](_0x5e493f)[_0x856c('0x1a')](_0x45213f);}};}function respondWithFilteredResult(_0x44cf83,_0x1c372f){return function(_0x20021d){if(_0x20021d){var _0x6856e5=typeof _0x1c372f[_0x856c('0x1b')]===_0x856c('0x1c')&&typeof _0x1c372f[_0x856c('0x1d')]===_0x856c('0x1c');var _0x1dd26e=_0x20021d[_0x856c('0x1e')];var _0xf24755=_0x6856e5?0x0:_0x1c372f[_0x856c('0x1b')];var _0x417cd3=_0x6856e5?_0x20021d[_0x856c('0x1e')]:_0x1c372f[_0x856c('0x1b')]+_0x1c372f[_0x856c('0x1d')];var _0x4183ab;if(_0x417cd3>=_0x1dd26e){_0x417cd3=_0x1dd26e;_0x4183ab=0xc8;}else{_0x4183ab=0xce;}_0x44cf83[_0x856c('0x18')](_0x4183ab);return _0x44cf83[_0x856c('0x1f')](_0x856c('0x20'),_0xf24755+'-'+_0x417cd3+'/'+_0x1dd26e)[_0x856c('0x1a')](_0x20021d);}return null;};}function patchUpdates(_0x4c42e0){return function(_0x51ce3a){try{jsonpatch[_0x856c('0x21')](_0x51ce3a,_0x4c42e0,!![]);}catch(_0x277518){return BPromise[_0x856c('0x22')](_0x277518);}return _0x51ce3a['save']();};}function saveUpdates(_0x120bc2,_0x4be642){return function(_0x202357){if(_0x202357){return _0x202357[_0x856c('0x23')](_0x120bc2)[_0x856c('0x24')](function(_0x5c5a3e){return _0x5c5a3e;});}return null;};}function removeEntity(_0x443292,_0x3220f9){return function(_0x3984a7){if(_0x3984a7){return _0x3984a7[_0x856c('0x25')]()[_0x856c('0x24')](function(){var _0x3b2f35=_0x3984a7['get']({'plain':!![]});var _0x3a048d=_0x856c('0x26');return db[_0x856c('0x27')]['destroy']({'where':{'type':_0x3a048d,'resourceId':_0x3b2f35['id']}})[_0x856c('0x24')](function(){return _0x3984a7;});})['then'](function(){_0x443292[_0x856c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d38d4,_0x23f53d){return function(_0x4a8107){if(!_0x4a8107){_0x3d38d4[_0x856c('0x17')](0x194);}return _0x4a8107;};}function handleError(_0x514d6c,_0x1a0a48){_0x1a0a48=_0x1a0a48||0x1f4;return function(_0x384f5f){logger[_0x856c('0x28')](_0x384f5f['stack']);if(_0x384f5f[_0x856c('0x29')]){delete _0x384f5f[_0x856c('0x29')];}_0x514d6c[_0x856c('0x18')](_0x1a0a48)['send'](_0x384f5f);};}exports['index']=function(_0x3eaced,_0x2a809d){var _0x21a868={},_0x25cbab={},_0x39ab90={'count':0x0,'rows':[]};var _0x2e1e91=_['map'](db[_0x856c('0x2a')][_0x856c('0x2b')],function(_0x1dc382){return{'name':_0x1dc382[_0x856c('0x2c')],'type':_0x1dc382[_0x856c('0x2d')][_0x856c('0x2e')]};});_0x25cbab['model']=_[_0x856c('0x2f')](_0x2e1e91,_0x856c('0x29'));_0x25cbab[_0x856c('0x30')]=_['keys'](_0x3eaced[_0x856c('0x30')]);_0x25cbab[_0x856c('0x31')]=_['intersection'](_0x25cbab[_0x856c('0x32')],_0x25cbab[_0x856c('0x30')]);_0x21a868[_0x856c('0x33')]=_[_0x856c('0x34')](_0x25cbab[_0x856c('0x32')],qs['fields'](_0x3eaced[_0x856c('0x30')][_0x856c('0x35')]));_0x21a868[_0x856c('0x33')]=_0x21a868[_0x856c('0x33')][_0x856c('0x36')]?_0x21a868[_0x856c('0x33')]:_0x25cbab[_0x856c('0x32')];if(!_0x3eaced[_0x856c('0x30')][_0x856c('0x37')](_0x856c('0x38'))){_0x21a868[_0x856c('0x1d')]=qs[_0x856c('0x1d')](_0x3eaced['query']['limit']);_0x21a868[_0x856c('0x1b')]=qs['offset'](_0x3eaced[_0x856c('0x30')][_0x856c('0x1b')]);}_0x21a868[_0x856c('0x39')]=qs[_0x856c('0x3a')](_0x3eaced[_0x856c('0x30')]['sort']);_0x21a868[_0x856c('0x3b')]=qs[_0x856c('0x31')](_[_0x856c('0x3c')](_0x3eaced[_0x856c('0x30')],_0x25cbab[_0x856c('0x31')]),_0x2e1e91);if(_0x3eaced['query'][_0x856c('0x3d')]){_0x21a868[_0x856c('0x3b')]=_[_0x856c('0x3e')](_0x21a868[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x2e1e91,function(_0x54460e){if(_0x54460e['type']!==_0x856c('0x3f')){var _0x1a235f={};_0x1a235f[_0x54460e[_0x856c('0x29')]]={'$like':'%'+_0x3eaced['query'][_0x856c('0x3d')]+'%'};return _0x1a235f;}})});}_0x21a868=_[_0x856c('0x3e')]({},_0x21a868,_0x3eaced['options']);var _0x5be7c2={'where':_0x21a868[_0x856c('0x3b')]};return db[_0x856c('0x2a')][_0x856c('0x1e')](_0x5be7c2)[_0x856c('0x24')](function(_0x1fe404){_0x39ab90[_0x856c('0x1e')]=_0x1fe404;if(_0x3eaced[_0x856c('0x30')]['includeAll']){_0x21a868['include']=[{'all':!![]}];}return db[_0x856c('0x2a')]['findAll'](_0x21a868);})[_0x856c('0x24')](function(_0x29234d){_0x39ab90[_0x856c('0x40')]=_0x29234d;return _0x39ab90;})[_0x856c('0x24')](respondWithFilteredResult(_0x2a809d,_0x21a868))['catch'](handleError(_0x2a809d,null));};exports[_0x856c('0x41')]=function(_0x3af263,_0x4424c4){var _0x35380e={'raw':![],'where':{'id':_0x3af263[_0x856c('0x42')]['id']}},_0xef88f2={};_0xef88f2[_0x856c('0x32')]=_[_0x856c('0x43')](db['JscriptyProject'][_0x856c('0x2b')]);_0xef88f2[_0x856c('0x30')]=_[_0x856c('0x43')](_0x3af263['query']);_0xef88f2[_0x856c('0x31')]=_[_0x856c('0x34')](_0xef88f2[_0x856c('0x32')],_0xef88f2['query']);_0x35380e[_0x856c('0x33')]=_[_0x856c('0x34')](_0xef88f2['model'],qs[_0x856c('0x35')](_0x3af263[_0x856c('0x30')][_0x856c('0x35')]));_0x35380e[_0x856c('0x33')]=_0x35380e[_0x856c('0x33')][_0x856c('0x36')]?_0x35380e[_0x856c('0x33')]:_0xef88f2[_0x856c('0x32')];if(_0x3af263[_0x856c('0x30')][_0x856c('0x44')]){_0x35380e[_0x856c('0x45')]=[{'all':!![]}];}_0x35380e=_[_0x856c('0x3e')]({},_0x35380e,_0x3af263[_0x856c('0x46')]);return db['JscriptyProject'][_0x856c('0x47')](_0x35380e)[_0x856c('0x24')](handleEntityNotFound(_0x4424c4,null))[_0x856c('0x24')](respondWithResult(_0x4424c4,null))[_0x856c('0x48')](handleError(_0x4424c4,null));};exports[_0x856c('0x49')]=function(_0x24d009,_0x4d51de){return db[_0x856c('0x2a')][_0x856c('0x49')](_0x24d009[_0x856c('0x4a')],{})[_0x856c('0x24')](function(_0x54399f){var _0x29fd01=_0x24d009['user'][_0x856c('0x4b')]({'plain':!![]});if(!_0x29fd01)throw new Error(_0x856c('0x4c'));if(_0x29fd01['role']==='user'){var _0x30fa12=_0x54399f['get']({'plain':!![]});var _0x5b0d61=_0x856c('0x26');return db[_0x856c('0x4d')][_0x856c('0x47')]({'where':{'name':_0x5b0d61,'userProfileId':_0x29fd01[_0x856c('0x4e')]},'raw':!![]})[_0x856c('0x24')](function(_0x44201f){if(_0x44201f&&_0x44201f[_0x856c('0x4f')]===0x0){return db[_0x856c('0x27')][_0x856c('0x49')]({'name':_0x30fa12[_0x856c('0x29')],'resourceId':_0x30fa12['id'],'type':_0x44201f['name'],'sectionId':_0x44201f['id']},{})[_0x856c('0x24')](function(){return _0x54399f;});}else{return _0x54399f;}})[_0x856c('0x48')](function(_0x4b1955){logger[_0x856c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b1955);throw _0x4b1955;});}return _0x54399f;})[_0x856c('0x24')](respondWithResult(_0x4d51de,0xc9))['catch'](handleError(_0x4d51de,null));};exports[_0x856c('0x50')]=function(_0x40016c,_0x41ebce){var _0x36d7f8={'where':{'id':_0x40016c[_0x856c('0x42')]['id']}},_0xb4e351={};_0xb4e351['model']=_[_0x856c('0x43')](db[_0x856c('0x2a')][_0x856c('0x2b')]);_0x36d7f8[_0x856c('0x33')]=_[_0x856c('0x34')](_0xb4e351[_0x856c('0x32')],qs[_0x856c('0x35')](_0x40016c[_0x856c('0x30')][_0x856c('0x35')]));_0x36d7f8[_0x856c('0x33')]=_0x36d7f8[_0x856c('0x33')][_0x856c('0x36')]?_0x36d7f8[_0x856c('0x33')]:_0xb4e351['model'];if(_0x40016c[_0x856c('0x30')]['includeAll']){_0x36d7f8[_0x856c('0x45')]=[{'all':!![]}];}_0x36d7f8=_[_0x856c('0x3e')]({},_0x36d7f8,_0x40016c[_0x856c('0x46')]);return db['JscriptyProject'][_0x856c('0x47')](_0x36d7f8)['then'](handleEntityNotFound(_0x41ebce,null))['then'](function(_0x55bd3c){if(_0x55bd3c){var _0x2c57e9=_0x55bd3c[_0x856c('0x4b')]({'plain':!![]});_0x2c57e9=qs['omit'](_0x2c57e9,['id',_0x856c('0x51'),_0x856c('0x52')]);_0x40016c[_0x856c('0x4a')]=_[_0x856c('0x53')](_0x40016c[_0x856c('0x4a')],['id',_0x856c('0x51'),'updatedAt']);return db[_0x856c('0x2a')][_0x856c('0x49')](_[_0x856c('0x3e')](_0x2c57e9,_0x40016c[_0x856c('0x4a')]),{'include':_0x40016c[_0x856c('0x30')][_0x856c('0x44')]?[{'all':!![]}]:undefined})[_0x856c('0x24')](function(_0x5023a8){var _0x38f8b1=_0x40016c['user'][_0x856c('0x4b')]({'plain':!![]});if(!_0x38f8b1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38f8b1[_0x856c('0x54')]===_0x856c('0x55')){var _0x5a96da=_0x5023a8[_0x856c('0x4b')]({'plain':!![]});var _0x33b699=_0x856c('0x26');return db[_0x856c('0x4d')][_0x856c('0x47')]({'where':{'name':_0x33b699,'userProfileId':_0x38f8b1[_0x856c('0x4e')]},'raw':!![]})[_0x856c('0x24')](function(_0x2f11a9){if(_0x2f11a9&&_0x2f11a9['autoAssociation']===0x0){return db[_0x856c('0x27')][_0x856c('0x49')]({'name':_0x5a96da[_0x856c('0x29')],'resourceId':_0x5a96da['id'],'type':_0x2f11a9[_0x856c('0x29')],'sectionId':_0x2f11a9['id']},{})['then'](function(){return _0x5023a8;});}else{return _0x5023a8;}})[_0x856c('0x48')](function(_0x58c600){logger[_0x856c('0x28')](_0x856c('0x56'),_0x58c600);throw _0x58c600;});}return _0x5023a8;});}})[_0x856c('0x24')](respondWithResult(_0x41ebce,0xc9))['catch'](handleError(_0x41ebce,null));};exports[_0x856c('0x23')]=function(_0x262f18,_0x31ee81){if(_0x262f18[_0x856c('0x4a')]['id']){delete _0x262f18[_0x856c('0x4a')]['id'];}return db[_0x856c('0x2a')][_0x856c('0x47')]({'where':{'id':_0x262f18[_0x856c('0x42')]['id']}})[_0x856c('0x24')](handleEntityNotFound(_0x31ee81,null))[_0x856c('0x24')](saveUpdates(_0x262f18[_0x856c('0x4a')],null))[_0x856c('0x24')](respondWithResult(_0x31ee81,null))['catch'](handleError(_0x31ee81,null));};exports[_0x856c('0x25')]=function(_0x161fcf,_0x12fe47){return db[_0x856c('0x2a')][_0x856c('0x47')]({'where':{'id':_0x161fcf[_0x856c('0x42')]['id']}})['then'](handleEntityNotFound(_0x12fe47,null))[_0x856c('0x24')](removeEntity(_0x12fe47,null))[_0x856c('0x48')](handleError(_0x12fe47,null));};exports[_0x856c('0x57')]=function(_0x3bf8f9,_0x40eacb,_0x1b5231){var _0x3dbbf3={'raw':!![],'where':{}};var _0x55646e={};var _0x562424={'count':0x0,'rows':[]};return db[_0x856c('0x2a')][_0x856c('0x58')]({'where':{'id':_0x3bf8f9[_0x856c('0x42')]['id']}})[_0x856c('0x24')](handleEntityNotFound(_0x40eacb,null))[_0x856c('0x24')](function(_0x4104c0){if(_0x4104c0){_0x55646e['model']=_['keys'](db[_0x856c('0x59')][_0x856c('0x2b')]);_0x55646e['query']=_[_0x856c('0x43')](_0x3bf8f9[_0x856c('0x30')]);_0x55646e[_0x856c('0x31')]=_[_0x856c('0x34')](_0x55646e[_0x856c('0x32')],_0x55646e[_0x856c('0x30')]);_0x3dbbf3[_0x856c('0x33')]=_[_0x856c('0x34')](_0x55646e[_0x856c('0x32')],qs['fields'](_0x3bf8f9[_0x856c('0x30')]['fields']));_0x3dbbf3[_0x856c('0x33')]=_0x3dbbf3[_0x856c('0x33')][_0x856c('0x36')]?_0x3dbbf3[_0x856c('0x33')]:_0x55646e[_0x856c('0x32')];if(!_0x3bf8f9['query'][_0x856c('0x37')]('nolimit')){_0x3dbbf3['limit']=qs[_0x856c('0x1d')](_0x3bf8f9[_0x856c('0x30')]['limit']);_0x3dbbf3[_0x856c('0x1b')]=qs[_0x856c('0x1b')](_0x3bf8f9['query'][_0x856c('0x1b')]);}_0x3dbbf3[_0x856c('0x39')]=qs[_0x856c('0x3a')](_0x3bf8f9[_0x856c('0x30')][_0x856c('0x3a')]);_0x3dbbf3['where']=qs['filters'](_[_0x856c('0x3c')](_0x3bf8f9['query'],_0x55646e[_0x856c('0x31')]));_0x3dbbf3[_0x856c('0x3b')][_0x856c('0x5a')]=_0x4104c0['id'];if(_0x3bf8f9['query'][_0x856c('0x3d')]){_0x3dbbf3[_0x856c('0x3b')]=_[_0x856c('0x3e')](_0x3dbbf3[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x3dbbf3[_0x856c('0x33')],function(_0x10e328){var _0x557016={};_0x557016[_0x10e328]={'$like':'%'+_0x3bf8f9[_0x856c('0x30')][_0x856c('0x3d')]+'%'};return _0x557016;})});}_0x3dbbf3=_[_0x856c('0x3e')]({},_0x3dbbf3,_0x3bf8f9[_0x856c('0x46')]);return db[_0x856c('0x59')]['count']({'where':_0x3dbbf3[_0x856c('0x3b')]})[_0x856c('0x24')](function(_0x2e66b9){_0x562424[_0x856c('0x1e')]=_0x2e66b9;if(_0x3bf8f9[_0x856c('0x30')]['includeAll']){_0x3dbbf3[_0x856c('0x45')]=[{'all':!![]}];}return db[_0x856c('0x59')][_0x856c('0x5b')](_0x3dbbf3);})[_0x856c('0x24')](function(_0x1695ef){_0x562424[_0x856c('0x40')]=_0x1695ef;return _0x562424;});}})[_0x856c('0x24')](respondWithFilteredResult(_0x40eacb,_0x3dbbf3))[_0x856c('0x48')](handleError(_0x40eacb,null));};exports[_0x856c('0x5c')]=function(_0x4c2c9e,_0x199cca,_0x3734b8){var _0x481b69={'raw':!![],'where':{}};var _0x1f4171={};var _0x2c771b={'count':0x0,'rows':[]};return db[_0x856c('0x2a')][_0x856c('0x58')]({'where':{'id':_0x4c2c9e['params']['id']}})['then'](handleEntityNotFound(_0x199cca,null))[_0x856c('0x24')](function(_0x57b0d7){if(_0x57b0d7){_0x1f4171[_0x856c('0x32')]=_[_0x856c('0x43')](db[_0x856c('0x5d')][_0x856c('0x2b')]);_0x1f4171['query']=_[_0x856c('0x43')](_0x4c2c9e[_0x856c('0x30')]);_0x1f4171[_0x856c('0x31')]=_[_0x856c('0x34')](_0x1f4171[_0x856c('0x32')],_0x1f4171[_0x856c('0x30')]);_0x481b69[_0x856c('0x33')]=_[_0x856c('0x34')](_0x1f4171[_0x856c('0x32')],qs[_0x856c('0x35')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x35')]));_0x481b69[_0x856c('0x33')]=_0x481b69[_0x856c('0x33')]['length']?_0x481b69['attributes']:_0x1f4171[_0x856c('0x32')];if(!_0x4c2c9e['query']['hasOwnProperty'](_0x856c('0x38'))){_0x481b69[_0x856c('0x1d')]=qs[_0x856c('0x1d')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x1d')]);_0x481b69[_0x856c('0x1b')]=qs[_0x856c('0x1b')](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x1b')]);}_0x481b69[_0x856c('0x39')]=qs['sort'](_0x4c2c9e[_0x856c('0x30')][_0x856c('0x3a')]);_0x481b69[_0x856c('0x3b')]=qs[_0x856c('0x31')](_[_0x856c('0x3c')](_0x4c2c9e[_0x856c('0x30')],_0x1f4171['filters']));_0x481b69[_0x856c('0x3b')][_0x856c('0x5a')]=_0x57b0d7['id'];if(_0x4c2c9e[_0x856c('0x30')]['filter']){_0x481b69[_0x856c('0x3b')]=_['merge'](_0x481b69[_0x856c('0x3b')],{'$or':_[_0x856c('0x2f')](_0x481b69[_0x856c('0x33')],function(_0x5a6702){var _0xe8d36b={};_0xe8d36b[_0x5a6702]={'$like':'%'+_0x4c2c9e[_0x856c('0x30')][_0x856c('0x3d')]+'%'};return _0xe8d36b;})});}_0x481b69=_[_0x856c('0x3e')]({},_0x481b69,_0x4c2c9e[_0x856c('0x46')]);return db['JscriptyAnswerReport'][_0x856c('0x1e')]({'where':_0x481b69[_0x856c('0x3b')]})[_0x856c('0x24')](function(_0x5e6220){_0x2c771b['count']=_0x5e6220;if(_0x4c2c9e[_0x856c('0x30')][_0x856c('0x44')]){_0x481b69['include']=[{'all':!![]}];}return db[_0x856c('0x5d')]['findAll'](_0x481b69);})[_0x856c('0x24')](function(_0x17019d){_0x2c771b['rows']=_0x17019d;return _0x2c771b;});}})['then'](respondWithFilteredResult(_0x199cca,_0x481b69))[_0x856c('0x48')](handleError(_0x199cca,null));};function char(_0x473348){return _0x856c('0x5e')===typeof _0x473348?String[_0x856c('0x5f')][_0x856c('0x21')](null,arguments):_0x473348;}function needsEncapsulation(_0x39a270){return!!_0x39a270&&(_0x39a270[_0x856c('0x60')]()['indexOf'](char(0xd))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0xa))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0x2c))>=0x0||_0x39a270[_0x856c('0x60')]()[_0x856c('0x61')](char(0x22))>=0x0);}function encapsulate(_0x3ea9ed){var _0x3c0064=char(0x22),_0x42ded0='\x5c'+char(0x22),_0x1075ec=_0x3ea9ed[_0x856c('0x60')]()[_0x856c('0x62')](new RegExp(_0x3c0064,'g'),_0x42ded0);return _0x3c0064+_0x1075ec+_0x3c0064;}exports[_0x856c('0x63')]=function(_0x5f5cdd,_0x30ebf0,_0x4d48fa){var _0x288c25,_0x69500d;var _0x1a7e36={'where':{'ProjectId':_0x5f5cdd[_0x856c('0x42')]['id']}};if(_0x5f5cdd['query']['startTime']){_0x1a7e36[_0x856c('0x3b')][_0x856c('0x64')]=JSON[_0x856c('0x65')](_0x5f5cdd[_0x856c('0x30')][_0x856c('0x66')]);}return db['JscriptySessionReport'][_0x856c('0x5b')](_0x1a7e36)[_0x856c('0x24')](handleEntityNotFound(_0x30ebf0,null))[_0x856c('0x24')](function(_0x3ea25a){if(_0x3ea25a){_0x288c25=_0x3ea25a;return db[_0x856c('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x856c('0x2f')](_0x288c25,'id')},'ProjectId':_0x5f5cdd[_0x856c('0x42')]['id']},'order':'-createdAt'});}})[_0x856c('0x24')](handleEntityNotFound(_0x30ebf0,null))['then'](function(_0x1676f2){if(_0x1676f2){_0x69500d=_0x1676f2;var _0x35003a={};for(var _0x1ebf9c=0x0,_0x4b5284=_0x69500d[_0x856c('0x36')];_0x1ebf9c<_0x4b5284;_0x1ebf9c++){if(!_0x35003a[_0x856c('0x37')](_0x69500d[_0x1ebf9c][_0x856c('0x68')])){_0x35003a[_0x69500d[_0x1ebf9c][_0x856c('0x68')]]=needsEncapsulation(_0x69500d[_0x1ebf9c][_0x856c('0x69')])?encapsulate(_0x69500d[_0x1ebf9c][_0x856c('0x69')]):_0x69500d[_0x1ebf9c][_0x856c('0x69')];}}var _0x31bf62=[],_0x36d40e={};for(var _0x1ea340=0x0,_0x558ffc=_0x288c25[_0x856c('0x36')];_0x1ea340<_0x558ffc;_0x1ea340++){_0x36d40e={'ProjectId':_0x5f5cdd['params']['id'],'SessionId':_0x288c25[_0x1ea340]['id'],'StartTime':moment(_0x288c25[_0x1ea340][_0x856c('0x64')])[_0x856c('0x6a')](_0x856c('0x6b'))};for(var _0x28800c=0x0,_0xd895f4=_0x69500d[_0x856c('0x36')];_0x28800c<_0xd895f4;_0x28800c++){if(_0x69500d[_0x28800c][_0x856c('0x6c')]==_0x288c25[_0x1ea340]['id']&&_0x35003a[_0x856c('0x37')](_0x69500d[_0x28800c][_0x856c('0x68')])){_0x36d40e[_0x35003a[_0x69500d[_0x28800c][_0x856c('0x68')]]]=_0x69500d[_0x28800c][_0x856c('0x6d')];}}for(var _0x3bc1fb in _0x35003a){if(!_0x36d40e['hasOwnProperty'](_0x35003a[_0x3bc1fb])){_0x36d40e[_0x35003a[_0x3bc1fb]]=null;}}_0x31bf62['push'](_0x36d40e);}return _0x31bf62;}})[_0x856c('0x24')](function(_0x457b68){if(!_[_0x856c('0x6e')](_0x457b68)){var _0x5b6a4e=toCsv(_0x457b68);var _0x2669ac=Date[_0x856c('0x6f')]();fs[_0x856c('0x70')](util[_0x856c('0x6a')](_0x856c('0x71'),_0x5f5cdd[_0x856c('0x42')]['id'],_0x2669ac),_0x5b6a4e);_0x30ebf0[_0x856c('0x72')](_0x856c('0x73'),_0x856c('0x74')+util[_0x856c('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x5f5cdd[_0x856c('0x42')]['id'],_0x2669ac));_0x30ebf0[_0x856c('0x72')](_0x856c('0x75'),_0x856c('0x76'));return _0x30ebf0[_0x856c('0x77')](util[_0x856c('0x6a')](_0x856c('0x71'),_0x5f5cdd['params']['id'],_0x2669ac));}else{return _0x30ebf0[_0x856c('0x17')](0xcc);}})[_0x856c('0x48')](handleError(_0x30ebf0,null));}; \ No newline at end of file +var _0x80e4=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','user','role','Projects','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getSessions','findOne','JscriptySessionReport','hasOwnProperty','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','now'];(function(_0x330726,_0x2e2c1d){var _0x197123=function(_0x553c8b){while(--_0x553c8b){_0x330726['push'](_0x330726['shift']());}};_0x197123(++_0x2e2c1d);}(_0x80e4,0x103));var _0x480e=function(_0x172133,_0x10246b){_0x172133=_0x172133-0x0;var _0x2460e5=_0x80e4[_0x172133];return _0x2460e5;};'use strict';var emlformat=require(_0x480e('0x0'));var rimraf=require(_0x480e('0x1'));var zipdir=require(_0x480e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x480e('0x3'));var moment=require(_0x480e('0x4'));var BPromise=require(_0x480e('0x5'));var Mustache=require(_0x480e('0x6'));var util=require(_0x480e('0x7'));var path=require('path');var sox=require(_0x480e('0x8'));var csv=require(_0x480e('0x9'));var ejs=require(_0x480e('0xa'));var fs=require('fs');var fs_extra=require(_0x480e('0xb'));var _=require(_0x480e('0xc'));var squel=require(_0x480e('0xd'));var crypto=require(_0x480e('0xe'));var jsforce=require(_0x480e('0xf'));var deskjs=require(_0x480e('0x10'));var toCsv=require(_0x480e('0x9'));var querystring=require(_0x480e('0x11'));var Papa=require(_0x480e('0x12'));var Redis=require('ioredis');var authService=require(_0x480e('0x13'));var qs=require(_0x480e('0x14'));var as=require(_0x480e('0x15'));var hardwareService=require(_0x480e('0x16'));var logger=require(_0x480e('0x17'))(_0x480e('0x18'));var utils=require('../../config/utils');var config=require(_0x480e('0x19'));var licenseUtil=require(_0x480e('0x1a'));var db=require(_0x480e('0x1b'))['db'];function respondWithStatusCode(_0xbd69cf,_0x5ced0f){_0x5ced0f=_0x5ced0f||0xcc;return function(_0x388310){if(_0x388310){return _0xbd69cf[_0x480e('0x1c')](_0x5ced0f);}return _0xbd69cf[_0x480e('0x1d')](_0x5ced0f)[_0x480e('0x1e')]();};}function respondWithResult(_0x5af7c5,_0x6ddb08){_0x6ddb08=_0x6ddb08||0xc8;return function(_0x567bc6){if(_0x567bc6){return _0x5af7c5[_0x480e('0x1d')](_0x6ddb08)[_0x480e('0x1f')](_0x567bc6);}};}function respondWithFilteredResult(_0x45322c,_0x450def){return function(_0x5b91a2){if(_0x5b91a2){var _0x2d61d1=typeof _0x450def[_0x480e('0x20')]===_0x480e('0x21')&&typeof _0x450def[_0x480e('0x22')]===_0x480e('0x21');var _0x233b55=_0x5b91a2[_0x480e('0x23')];var _0x58275b=_0x2d61d1?0x0:_0x450def[_0x480e('0x20')];var _0x54f36b=_0x2d61d1?_0x5b91a2[_0x480e('0x23')]:_0x450def[_0x480e('0x20')]+_0x450def[_0x480e('0x22')];var _0xf1e54d;if(_0x54f36b>=_0x233b55){_0x54f36b=_0x233b55;_0xf1e54d=0xc8;}else{_0xf1e54d=0xce;}_0x45322c[_0x480e('0x1d')](_0xf1e54d);return _0x45322c[_0x480e('0x24')](_0x480e('0x25'),_0x58275b+'-'+_0x54f36b+'/'+_0x233b55)[_0x480e('0x1f')](_0x5b91a2);}return null;};}function patchUpdates(_0x3f1011){return function(_0xd7f410){try{jsonpatch['apply'](_0xd7f410,_0x3f1011,!![]);}catch(_0x2b9182){return BPromise[_0x480e('0x26')](_0x2b9182);}return _0xd7f410[_0x480e('0x27')]();};}function saveUpdates(_0x10f83a,_0x5699d5){return function(_0x286374){if(_0x286374){return _0x286374[_0x480e('0x28')](_0x10f83a)[_0x480e('0x29')](function(_0x1db609){return _0x1db609;});}return null;};}function removeEntity(_0x144672,_0xfcd7a7){return function(_0x942fed){if(_0x942fed){return _0x942fed[_0x480e('0x2a')]()['then'](function(){var _0x264386=_0x942fed[_0x480e('0x2b')]({'plain':!![]});var _0x5bf29c='Projects';return db[_0x480e('0x2c')][_0x480e('0x2a')]({'where':{'type':_0x5bf29c,'resourceId':_0x264386['id']}})['then'](function(){return _0x942fed;});})[_0x480e('0x29')](function(){_0x144672['status'](0xcc)[_0x480e('0x1e')]();});}};}function handleEntityNotFound(_0x4ec5c8,_0x1cdd4d){return function(_0x55ad03){if(!_0x55ad03){_0x4ec5c8[_0x480e('0x1c')](0x194);}return _0x55ad03;};}function handleError(_0x3bc0b0,_0x4c80e9){_0x4c80e9=_0x4c80e9||0x1f4;return function(_0x6f0315){logger['error'](_0x6f0315[_0x480e('0x2d')]);if(_0x6f0315[_0x480e('0x2e')]){delete _0x6f0315[_0x480e('0x2e')];}_0x3bc0b0[_0x480e('0x1d')](_0x4c80e9)[_0x480e('0x2f')](_0x6f0315);};}exports[_0x480e('0x30')]=function(_0x26e69c,_0x47a442){var _0x50730b={},_0x2f2142={},_0xc242aa={'count':0x0,'rows':[]};var _0x6b7ee8=_['map'](db[_0x480e('0x31')][_0x480e('0x32')],function(_0x6e949e){return{'name':_0x6e949e[_0x480e('0x33')],'type':_0x6e949e[_0x480e('0x34')][_0x480e('0x35')]};});_0x2f2142[_0x480e('0x36')]=_[_0x480e('0x37')](_0x6b7ee8,_0x480e('0x2e'));_0x2f2142[_0x480e('0x38')]=_[_0x480e('0x39')](_0x26e69c[_0x480e('0x38')]);_0x2f2142[_0x480e('0x3a')]=_[_0x480e('0x3b')](_0x2f2142['model'],_0x2f2142[_0x480e('0x38')]);_0x50730b[_0x480e('0x3c')]=_['intersection'](_0x2f2142[_0x480e('0x36')],qs[_0x480e('0x3d')](_0x26e69c[_0x480e('0x38')]['fields']));_0x50730b[_0x480e('0x3c')]=_0x50730b[_0x480e('0x3c')][_0x480e('0x3e')]?_0x50730b[_0x480e('0x3c')]:_0x2f2142[_0x480e('0x36')];if(!_0x26e69c[_0x480e('0x38')]['hasOwnProperty']('nolimit')){_0x50730b[_0x480e('0x22')]=qs[_0x480e('0x22')](_0x26e69c['query'][_0x480e('0x22')]);_0x50730b[_0x480e('0x20')]=qs[_0x480e('0x20')](_0x26e69c[_0x480e('0x38')][_0x480e('0x20')]);}_0x50730b['order']=qs[_0x480e('0x3f')](_0x26e69c['query'][_0x480e('0x3f')]);_0x50730b[_0x480e('0x40')]=qs[_0x480e('0x3a')](_[_0x480e('0x41')](_0x26e69c['query'],_0x2f2142['filters']),_0x6b7ee8);if(_0x26e69c[_0x480e('0x38')][_0x480e('0x42')]){_0x50730b[_0x480e('0x40')]=_[_0x480e('0x43')](_0x50730b[_0x480e('0x40')],{'$or':_[_0x480e('0x37')](_0x6b7ee8,function(_0x5d354b){if(_0x5d354b[_0x480e('0x34')]!==_0x480e('0x44')){var _0x504b05={};_0x504b05[_0x5d354b[_0x480e('0x2e')]]={'$like':'%'+_0x26e69c[_0x480e('0x38')][_0x480e('0x42')]+'%'};return _0x504b05;}})});}_0x50730b=_[_0x480e('0x43')]({},_0x50730b,_0x26e69c[_0x480e('0x45')]);var _0x1821ec={'where':_0x50730b[_0x480e('0x40')]};return db[_0x480e('0x31')][_0x480e('0x23')](_0x1821ec)[_0x480e('0x29')](function(_0x545cdf){_0xc242aa[_0x480e('0x23')]=_0x545cdf;if(_0x26e69c[_0x480e('0x38')][_0x480e('0x46')]){_0x50730b[_0x480e('0x47')]=[{'all':!![]}];}return db[_0x480e('0x31')][_0x480e('0x48')](_0x50730b);})[_0x480e('0x29')](function(_0x486d18){_0xc242aa[_0x480e('0x49')]=_0x486d18;return _0xc242aa;})[_0x480e('0x29')](respondWithFilteredResult(_0x47a442,_0x50730b))[_0x480e('0x4a')](handleError(_0x47a442,null));};exports['show']=function(_0x126222,_0x63fc6e){var _0x2ee124={'raw':![],'where':{'id':_0x126222[_0x480e('0x4b')]['id']}},_0x36fd6c={};_0x36fd6c[_0x480e('0x36')]=_['keys'](db[_0x480e('0x31')]['rawAttributes']);_0x36fd6c[_0x480e('0x38')]=_['keys'](_0x126222[_0x480e('0x38')]);_0x36fd6c['filters']=_[_0x480e('0x3b')](_0x36fd6c[_0x480e('0x36')],_0x36fd6c[_0x480e('0x38')]);_0x2ee124[_0x480e('0x3c')]=_[_0x480e('0x3b')](_0x36fd6c[_0x480e('0x36')],qs[_0x480e('0x3d')](_0x126222['query']['fields']));_0x2ee124[_0x480e('0x3c')]=_0x2ee124['attributes'][_0x480e('0x3e')]?_0x2ee124[_0x480e('0x3c')]:_0x36fd6c[_0x480e('0x36')];if(_0x126222[_0x480e('0x38')][_0x480e('0x46')]){_0x2ee124[_0x480e('0x47')]=[{'all':!![]}];}_0x2ee124=_[_0x480e('0x43')]({},_0x2ee124,_0x126222[_0x480e('0x45')]);return db[_0x480e('0x31')]['find'](_0x2ee124)['then'](handleEntityNotFound(_0x63fc6e,null))['then'](respondWithResult(_0x63fc6e,null))[_0x480e('0x4a')](handleError(_0x63fc6e,null));};exports[_0x480e('0x4c')]=function(_0x1f1411,_0x10e5ec){return db[_0x480e('0x31')]['create'](_0x1f1411[_0x480e('0x4d')],{})[_0x480e('0x29')](function(_0x15b02f){var _0x570f8b=_0x1f1411[_0x480e('0x4e')][_0x480e('0x2b')]({'plain':!![]});if(!_0x570f8b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x570f8b[_0x480e('0x4f')]==='user'){var _0x42c304=_0x15b02f[_0x480e('0x2b')]({'plain':!![]});var _0x24e1b3=_0x480e('0x50');return db[_0x480e('0x51')][_0x480e('0x52')]({'where':{'name':_0x24e1b3,'userProfileId':_0x570f8b['userProfileId']},'raw':!![]})[_0x480e('0x29')](function(_0x143e73){if(_0x143e73&&_0x143e73[_0x480e('0x53')]===0x0){return db['UserProfileResource'][_0x480e('0x4c')]({'name':_0x42c304['name'],'resourceId':_0x42c304['id'],'type':_0x143e73[_0x480e('0x2e')],'sectionId':_0x143e73['id']},{})[_0x480e('0x29')](function(){return _0x15b02f;});}else{return _0x15b02f;}})[_0x480e('0x4a')](function(_0x5a2c75){logger[_0x480e('0x54')](_0x480e('0x55'),_0x5a2c75);throw _0x5a2c75;});}return _0x15b02f;})[_0x480e('0x29')](respondWithResult(_0x10e5ec,0xc9))['catch'](handleError(_0x10e5ec,null));};exports[_0x480e('0x56')]=function(_0x5ab3a7,_0x41f401){var _0x25269b={'where':{'id':_0x5ab3a7[_0x480e('0x4b')]['id']}},_0x13bf4f={};_0x13bf4f[_0x480e('0x36')]=_[_0x480e('0x39')](db['JscriptyProject']['rawAttributes']);_0x25269b['attributes']=_['intersection'](_0x13bf4f['model'],qs['fields'](_0x5ab3a7[_0x480e('0x38')]['fields']));_0x25269b[_0x480e('0x3c')]=_0x25269b[_0x480e('0x3c')][_0x480e('0x3e')]?_0x25269b[_0x480e('0x3c')]:_0x13bf4f[_0x480e('0x36')];if(_0x5ab3a7[_0x480e('0x38')]['includeAll']){_0x25269b[_0x480e('0x47')]=[{'all':!![]}];}_0x25269b=_['merge']({},_0x25269b,_0x5ab3a7[_0x480e('0x45')]);return db[_0x480e('0x31')][_0x480e('0x52')](_0x25269b)['then'](handleEntityNotFound(_0x41f401,null))[_0x480e('0x29')](function(_0x2106d7){if(_0x2106d7){var _0x1ea2c9=_0x2106d7[_0x480e('0x2b')]({'plain':!![]});_0x1ea2c9=qs[_0x480e('0x57')](_0x1ea2c9,['id',_0x480e('0x58'),_0x480e('0x59')]);_0x5ab3a7[_0x480e('0x4d')]=_['omit'](_0x5ab3a7[_0x480e('0x4d')],['id',_0x480e('0x58'),_0x480e('0x59')]);return db[_0x480e('0x31')]['create'](_[_0x480e('0x43')](_0x1ea2c9,_0x5ab3a7[_0x480e('0x4d')]),{'include':_0x5ab3a7[_0x480e('0x38')][_0x480e('0x46')]?[{'all':!![]}]:undefined})[_0x480e('0x29')](function(_0x119455){var _0x2068ce=_0x5ab3a7[_0x480e('0x4e')]['get']({'plain':!![]});if(!_0x2068ce)throw new Error(_0x480e('0x5a'));if(_0x2068ce[_0x480e('0x4f')]===_0x480e('0x4e')){var _0x45d0a3=_0x119455[_0x480e('0x2b')]({'plain':!![]});var _0xa343e7=_0x480e('0x50');return db[_0x480e('0x51')]['find']({'where':{'name':_0xa343e7,'userProfileId':_0x2068ce[_0x480e('0x5b')]},'raw':!![]})[_0x480e('0x29')](function(_0x1037ff){if(_0x1037ff&&_0x1037ff[_0x480e('0x53')]===0x0){return db[_0x480e('0x2c')][_0x480e('0x4c')]({'name':_0x45d0a3[_0x480e('0x2e')],'resourceId':_0x45d0a3['id'],'type':_0x1037ff[_0x480e('0x2e')],'sectionId':_0x1037ff['id']},{})[_0x480e('0x29')](function(){return _0x119455;});}else{return _0x119455;}})['catch'](function(_0x3d5e02){logger[_0x480e('0x54')](_0x480e('0x55'),_0x3d5e02);throw _0x3d5e02;});}return _0x119455;});}})[_0x480e('0x29')](respondWithResult(_0x41f401,0xc9))[_0x480e('0x4a')](handleError(_0x41f401,null));};exports[_0x480e('0x28')]=function(_0x2d73b1,_0x3fd150){if(_0x2d73b1[_0x480e('0x4d')]['id']){delete _0x2d73b1[_0x480e('0x4d')]['id'];}return db[_0x480e('0x31')][_0x480e('0x52')]({'where':{'id':_0x2d73b1[_0x480e('0x4b')]['id']}})[_0x480e('0x29')](handleEntityNotFound(_0x3fd150,null))[_0x480e('0x29')](saveUpdates(_0x2d73b1['body'],null))[_0x480e('0x29')](respondWithResult(_0x3fd150,null))['catch'](handleError(_0x3fd150,null));};exports[_0x480e('0x2a')]=function(_0x3246c2,_0x343da9){return db[_0x480e('0x31')][_0x480e('0x52')]({'where':{'id':_0x3246c2[_0x480e('0x4b')]['id']}})[_0x480e('0x29')](handleEntityNotFound(_0x343da9,null))[_0x480e('0x29')](removeEntity(_0x343da9,null))['catch'](handleError(_0x343da9,null));};exports[_0x480e('0x5c')]=function(_0x51d40e,_0xa2ccca,_0xdea190){var _0x5aa95b={'raw':!![],'where':{}};var _0x18e240={};var _0x3879d1={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x480e('0x5d')]({'where':{'id':_0x51d40e[_0x480e('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa2ccca,null))['then'](function(_0x25fec0){if(_0x25fec0){_0x18e240[_0x480e('0x36')]=_[_0x480e('0x39')](db[_0x480e('0x5e')]['rawAttributes']);_0x18e240[_0x480e('0x38')]=_[_0x480e('0x39')](_0x51d40e[_0x480e('0x38')]);_0x18e240[_0x480e('0x3a')]=_[_0x480e('0x3b')](_0x18e240['model'],_0x18e240['query']);_0x5aa95b[_0x480e('0x3c')]=_[_0x480e('0x3b')](_0x18e240[_0x480e('0x36')],qs[_0x480e('0x3d')](_0x51d40e[_0x480e('0x38')][_0x480e('0x3d')]));_0x5aa95b[_0x480e('0x3c')]=_0x5aa95b[_0x480e('0x3c')][_0x480e('0x3e')]?_0x5aa95b[_0x480e('0x3c')]:_0x18e240[_0x480e('0x36')];if(!_0x51d40e[_0x480e('0x38')][_0x480e('0x5f')](_0x480e('0x60'))){_0x5aa95b['limit']=qs[_0x480e('0x22')](_0x51d40e[_0x480e('0x38')][_0x480e('0x22')]);_0x5aa95b[_0x480e('0x20')]=qs['offset'](_0x51d40e['query'][_0x480e('0x20')]);}_0x5aa95b['order']=qs['sort'](_0x51d40e[_0x480e('0x38')]['sort']);_0x5aa95b[_0x480e('0x40')]=qs[_0x480e('0x3a')](_[_0x480e('0x41')](_0x51d40e[_0x480e('0x38')],_0x18e240['filters']));_0x5aa95b[_0x480e('0x40')][_0x480e('0x61')]=_0x25fec0['id'];if(_0x51d40e[_0x480e('0x38')][_0x480e('0x42')]){_0x5aa95b['where']=_['merge'](_0x5aa95b[_0x480e('0x40')],{'$or':_[_0x480e('0x37')](_0x5aa95b[_0x480e('0x3c')],function(_0x43fe6a){var _0x3fa541={};_0x3fa541[_0x43fe6a]={'$like':'%'+_0x51d40e['query'][_0x480e('0x42')]+'%'};return _0x3fa541;})});}_0x5aa95b=_['merge']({},_0x5aa95b,_0x51d40e[_0x480e('0x45')]);return db[_0x480e('0x5e')][_0x480e('0x23')]({'where':_0x5aa95b[_0x480e('0x40')]})[_0x480e('0x29')](function(_0x1e8f93){_0x3879d1[_0x480e('0x23')]=_0x1e8f93;if(_0x51d40e['query'][_0x480e('0x46')]){_0x5aa95b[_0x480e('0x47')]=[{'all':!![]}];}return db[_0x480e('0x5e')][_0x480e('0x48')](_0x5aa95b);})[_0x480e('0x29')](function(_0x5b48c9){_0x3879d1[_0x480e('0x49')]=_0x5b48c9;return _0x3879d1;});}})[_0x480e('0x29')](respondWithFilteredResult(_0xa2ccca,_0x5aa95b))[_0x480e('0x4a')](handleError(_0xa2ccca,null));};exports[_0x480e('0x62')]=function(_0x31416e,_0x24d204,_0x39e28e){var _0x282dd2={'raw':!![],'where':{}};var _0x268c67={};var _0x19b2cb={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x480e('0x5d')]({'where':{'id':_0x31416e[_0x480e('0x4b')]['id']}})[_0x480e('0x29')](handleEntityNotFound(_0x24d204,null))['then'](function(_0x31e259){if(_0x31e259){_0x268c67[_0x480e('0x36')]=_[_0x480e('0x39')](db[_0x480e('0x63')][_0x480e('0x32')]);_0x268c67[_0x480e('0x38')]=_['keys'](_0x31416e[_0x480e('0x38')]);_0x268c67['filters']=_[_0x480e('0x3b')](_0x268c67[_0x480e('0x36')],_0x268c67[_0x480e('0x38')]);_0x282dd2[_0x480e('0x3c')]=_[_0x480e('0x3b')](_0x268c67['model'],qs[_0x480e('0x3d')](_0x31416e[_0x480e('0x38')][_0x480e('0x3d')]));_0x282dd2[_0x480e('0x3c')]=_0x282dd2['attributes'][_0x480e('0x3e')]?_0x282dd2[_0x480e('0x3c')]:_0x268c67[_0x480e('0x36')];if(!_0x31416e['query'][_0x480e('0x5f')](_0x480e('0x60'))){_0x282dd2[_0x480e('0x22')]=qs[_0x480e('0x22')](_0x31416e[_0x480e('0x38')][_0x480e('0x22')]);_0x282dd2[_0x480e('0x20')]=qs['offset'](_0x31416e['query']['offset']);}_0x282dd2[_0x480e('0x64')]=qs['sort'](_0x31416e[_0x480e('0x38')][_0x480e('0x3f')]);_0x282dd2[_0x480e('0x40')]=qs[_0x480e('0x3a')](_['pick'](_0x31416e[_0x480e('0x38')],_0x268c67[_0x480e('0x3a')]));_0x282dd2[_0x480e('0x40')][_0x480e('0x61')]=_0x31e259['id'];if(_0x31416e[_0x480e('0x38')][_0x480e('0x42')]){_0x282dd2[_0x480e('0x40')]=_[_0x480e('0x43')](_0x282dd2[_0x480e('0x40')],{'$or':_[_0x480e('0x37')](_0x282dd2[_0x480e('0x3c')],function(_0xc4189b){var _0x33aa9d={};_0x33aa9d[_0xc4189b]={'$like':'%'+_0x31416e[_0x480e('0x38')][_0x480e('0x42')]+'%'};return _0x33aa9d;})});}_0x282dd2=_[_0x480e('0x43')]({},_0x282dd2,_0x31416e['options']);return db['JscriptyAnswerReport'][_0x480e('0x23')]({'where':_0x282dd2[_0x480e('0x40')]})[_0x480e('0x29')](function(_0x2c7d5d){_0x19b2cb['count']=_0x2c7d5d;if(_0x31416e[_0x480e('0x38')][_0x480e('0x46')]){_0x282dd2['include']=[{'all':!![]}];}return db[_0x480e('0x63')]['findAll'](_0x282dd2);})[_0x480e('0x29')](function(_0x130705){_0x19b2cb[_0x480e('0x49')]=_0x130705;return _0x19b2cb;});}})[_0x480e('0x29')](respondWithFilteredResult(_0x24d204,_0x282dd2))[_0x480e('0x4a')](handleError(_0x24d204,null));};function char(_0x48da4b){return _0x480e('0x65')===typeof _0x48da4b?String[_0x480e('0x66')][_0x480e('0x67')](null,arguments):_0x48da4b;}function needsEncapsulation(_0x34b143){return!!_0x34b143&&(_0x34b143[_0x480e('0x68')]()[_0x480e('0x69')](char(0xd))>=0x0||_0x34b143[_0x480e('0x68')]()[_0x480e('0x69')](char(0xa))>=0x0||_0x34b143[_0x480e('0x68')]()[_0x480e('0x69')](char(0x2c))>=0x0||_0x34b143[_0x480e('0x68')]()[_0x480e('0x69')](char(0x22))>=0x0);}function encapsulate(_0x5124a5){var _0x369b9f=char(0x22),_0x8dac35='\x5c'+char(0x22),_0x2425c0=_0x5124a5['toString']()[_0x480e('0x6a')](new RegExp(_0x369b9f,'g'),_0x8dac35);return _0x369b9f+_0x2425c0+_0x369b9f;}exports[_0x480e('0x6b')]=function(_0x1f008d,_0x2e05ab,_0x255fa7){var _0x4edeb7,_0xef8f65;var _0x49d152={'where':{'ProjectId':_0x1f008d[_0x480e('0x4b')]['id']}};if(_0x1f008d[_0x480e('0x38')][_0x480e('0x6c')]){_0x49d152[_0x480e('0x40')]['starttime']=JSON[_0x480e('0x6d')](_0x1f008d[_0x480e('0x38')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x49d152)[_0x480e('0x29')](handleEntityNotFound(_0x2e05ab,null))[_0x480e('0x29')](function(_0x5df120){if(_0x5df120){_0x4edeb7=_0x5df120;return db[_0x480e('0x6e')][_0x480e('0x48')]({'where':{'SessionId':{'$in':_[_0x480e('0x37')](_0x4edeb7,'id')},'ProjectId':_0x1f008d[_0x480e('0x4b')]['id']},'order':_0x480e('0x6f')});}})['then'](handleEntityNotFound(_0x2e05ab,null))[_0x480e('0x29')](function(_0x53c269){if(_0x53c269){_0xef8f65=_0x53c269;var _0x47f551={};for(var _0x318d12=0x0,_0x13a7ee=_0xef8f65['length'];_0x318d12<_0x13a7ee;_0x318d12++){if(!_0x47f551[_0x480e('0x5f')](_0xef8f65[_0x318d12][_0x480e('0x70')])){_0x47f551[_0xef8f65[_0x318d12]['questionId']]=needsEncapsulation(_0xef8f65[_0x318d12][_0x480e('0x71')])?encapsulate(_0xef8f65[_0x318d12][_0x480e('0x71')]):_0xef8f65[_0x318d12][_0x480e('0x71')];}}var _0x1ff154=[],_0x1f0803={};for(var _0x1057fb=0x0,_0x5ad0f2=_0x4edeb7[_0x480e('0x3e')];_0x1057fb<_0x5ad0f2;_0x1057fb++){_0x1f0803={'ProjectId':_0x1f008d[_0x480e('0x4b')]['id'],'SessionId':_0x4edeb7[_0x1057fb]['id'],'StartTime':moment(_0x4edeb7[_0x1057fb][_0x480e('0x72')])[_0x480e('0x73')](_0x480e('0x74'))};for(var _0x55d797=0x0,_0x51ce91=_0xef8f65[_0x480e('0x3e')];_0x55d797<_0x51ce91;_0x55d797++){if(_0xef8f65[_0x55d797][_0x480e('0x75')]==_0x4edeb7[_0x1057fb]['id']&&_0x47f551[_0x480e('0x5f')](_0xef8f65[_0x55d797]['questionId'])){_0x1f0803[_0x47f551[_0xef8f65[_0x55d797][_0x480e('0x70')]]]=_0xef8f65[_0x55d797]['answer'];}}for(var _0x57bf77 in _0x47f551){if(!_0x1f0803['hasOwnProperty'](_0x47f551[_0x57bf77])){_0x1f0803[_0x47f551[_0x57bf77]]=null;}}_0x1ff154['push'](_0x1f0803);}return _0x1ff154;}})['then'](function(_0x2eef95){if(!_['isEmpty'](_0x2eef95)){var _0x259f33=toCsv(_0x2eef95);var _0x897cf3=Date[_0x480e('0x76')]();fs['writeFileSync'](util[_0x480e('0x73')](_0x480e('0x77'),_0x1f008d['params']['id'],_0x897cf3),_0x259f33);_0x2e05ab[_0x480e('0x78')](_0x480e('0x79'),_0x480e('0x7a')+util[_0x480e('0x73')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f008d[_0x480e('0x4b')]['id'],_0x897cf3));_0x2e05ab[_0x480e('0x78')](_0x480e('0x7b'),_0x480e('0x7c'));return _0x2e05ab[_0x480e('0x7d')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1f008d[_0x480e('0x4b')]['id'],_0x897cf3));}else{return _0x2e05ab['sendStatus'](0xcc);}})[_0x480e('0x4a')](handleError(_0x2e05ab,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4fd37cc..fee4224 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 _0xf3cc=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3fabe9,_0x17d2ab){var _0x2c3399=function(_0x568a71){while(--_0x568a71){_0x3fabe9['push'](_0x3fabe9['shift']());}};_0x2c3399(++_0x17d2ab);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x20dd9b,_0x3c0fb8){_0x20dd9b=_0x20dd9b-0x0;var _0x2de3b0=_0xf3cc[_0x20dd9b];return _0x2de3b0;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fs=require('fs');var path=require(_0xcf3c('0x6'));var rimraf=require('rimraf');var config=require(_0xcf3c('0x7'));var attributes=require(_0xcf3c('0x8'));module['exports']=function(_0x41f804,_0x2b5cae){return _0x41f804[_0xcf3c('0x9')](_0xcf3c('0xa'),attributes,{'tableName':_0xcf3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes'];(function(_0x2317ae,_0x150322){var _0x27624b=function(_0x123ef8){while(--_0x123ef8){_0x2317ae['push'](_0x2317ae['shift']());}};_0x27624b(++_0x150322);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3e62b0,_0x132831){_0x3e62b0=_0x3e62b0-0x0;var _0x19e398=_0x8ef6[_0x3e62b0];return _0x19e398;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 a2dd1f5..95f8cb9 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x2548d8,_0x80995b){var _0x1fe7c1=function(_0x4d5793){while(--_0x4d5793){_0x2548d8['push'](_0x2548d8['shift']());}};_0x1fe7c1(++_0x80995b);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3a0065,_0xd9823c){var _0x264f8a=function(_0x4bf81e){while(--_0x4bf81e){_0x3a0065['push'](_0x3a0065['shift']());}};_0x264f8a(++_0xd9823c);}(_0x70e0,0x17b));var _0x070e=function(_0x56f354,_0xad2325){_0x56f354=_0x56f354-0x0;var _0x17cf21=_0x70e0[_0x56f354];return _0x17cf21;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 11839b1..c78d260 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 _0x2cfc=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x2cfc,0x114));var _0xc2cf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2cfc[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xc2cf('0x0'));var path=require(_0xc2cf('0x1'));var timeout=require(_0xc2cf('0x2'));var express=require(_0xc2cf('0x3'));var router=express[_0xc2cf('0x4')]();var fs_extra=require(_0xc2cf('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc2cf('0x6'));var controller=require(_0xc2cf('0x7'));router[_0xc2cf('0x8')]('/',auth[_0xc2cf('0x9')](),controller[_0xc2cf('0xa')]);router[_0xc2cf('0x8')](_0xc2cf('0xb'),auth[_0xc2cf('0x9')](),controller[_0xc2cf('0xc')]);router[_0xc2cf('0x8')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller[_0xc2cf('0xe')]);router[_0xc2cf('0xf')]('/',auth[_0xc2cf('0x9')](),controller[_0xc2cf('0x10')]);router[_0xc2cf('0x11')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller[_0xc2cf('0x12')]);router[_0xc2cf('0x13')](_0xc2cf('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc2cf('0x14')]=router; \ No newline at end of file +var _0x6986=['exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x47bb6,_0x4f24ca){var _0x21ab44=function(_0x2e850d){while(--_0x2e850d){_0x47bb6['push'](_0x47bb6['shift']());}};_0x21ab44(++_0x4f24ca);}(_0x6986,0x65));var _0x6698=function(_0x421c56,_0x4efd00){_0x421c56=_0x421c56-0x0;var _0x49b244=_0x6986[_0x421c56];return _0x49b244;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require(_0x6698('0x1'));var timeout=require(_0x6698('0x2'));var express=require('express');var router=express[_0x6698('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6698('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6698('0x5'));var controller=require(_0x6698('0x6'));router[_0x6698('0x7')]('/',auth[_0x6698('0x8')](),controller[_0x6698('0x9')]);router[_0x6698('0x7')](_0x6698('0xa'),auth[_0x6698('0x8')](),controller[_0x6698('0xb')]);router[_0x6698('0x7')](_0x6698('0xc'),auth[_0x6698('0x8')](),controller[_0x6698('0xd')]);router[_0x6698('0xe')]('/',auth[_0x6698('0x8')](),controller['create']);router[_0x6698('0xf')](_0x6698('0xc'),auth[_0x6698('0x8')](),controller[_0x6698('0x10')]);router[_0x6698('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6698('0x12')]);module[_0x6698('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f65562d..f41e2c2 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x31f46c,_0x840164){_0x31f46c=_0x31f46c-0x0;var _0x3e7390=_0x7a54[_0x31f46c];return _0x3e7390;};'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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a54,0x106));var _0x47a5=function(_0x51ccb2,_0x2b8dac){_0x51ccb2=_0x51ccb2-0x0;var _0x7186c1=_0x7a54[_0x51ccb2];return _0x7186c1;};'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 b0ca270..db53ff9 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 _0xf209=['destroy','name','send','index','map','JscriptyQuestionReport','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','params','fields','include','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','save','update','then'];(function(_0x92a987,_0x4415b6){var _0x331f4c=function(_0x223e9d){while(--_0x223e9d){_0x92a987['push'](_0x92a987['shift']());}};_0x331f4c(++_0x4415b6);}(_0xf209,0xa7));var _0x9f20=function(_0x3b3750,_0x28f3b8){_0x3b3750=_0x3b3750-0x0;var _0x1b9e8b=_0xf209[_0x3b3750];return _0x1b9e8b;};'use strict';var emlformat=require(_0x9f20('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f20('0x1'));var rp=require(_0x9f20('0x2'));var moment=require(_0x9f20('0x3'));var BPromise=require(_0x9f20('0x4'));var Mustache=require('mustache');var util=require(_0x9f20('0x5'));var path=require('path');var sox=require(_0x9f20('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f20('0x7'));var _=require(_0x9f20('0x8'));var squel=require(_0x9f20('0x9'));var crypto=require(_0x9f20('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9f20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9f20('0xc'));var Papa=require('papaparse');var Redis=require(_0x9f20('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9f20('0xe'));var as=require(_0x9f20('0xf'));var hardwareService=require(_0x9f20('0x10'));var logger=require(_0x9f20('0x11'))(_0x9f20('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9f20('0x13'));var db=require(_0x9f20('0x14'))['db'];function respondWithStatusCode(_0x819e4e,_0x38139a){_0x38139a=_0x38139a||0xcc;return function(_0x19bc16){if(_0x19bc16){return _0x819e4e[_0x9f20('0x15')](_0x38139a);}return _0x819e4e['status'](_0x38139a)[_0x9f20('0x16')]();};}function respondWithResult(_0x4ef4fb,_0x3c0df8){_0x3c0df8=_0x3c0df8||0xc8;return function(_0x2106f2){if(_0x2106f2){return _0x4ef4fb[_0x9f20('0x17')](_0x3c0df8)[_0x9f20('0x18')](_0x2106f2);}};}function respondWithFilteredResult(_0x509b6d,_0x1883cc){return function(_0x28ae95){if(_0x28ae95){var _0x3581fe=typeof _0x1883cc[_0x9f20('0x19')]===_0x9f20('0x1a')&&typeof _0x1883cc['limit']===_0x9f20('0x1a');var _0x5ff65a=_0x28ae95['count'];var _0x2bc0c0=_0x3581fe?0x0:_0x1883cc[_0x9f20('0x19')];var _0x4f9465=_0x3581fe?_0x28ae95[_0x9f20('0x1b')]:_0x1883cc[_0x9f20('0x19')]+_0x1883cc[_0x9f20('0x1c')];var _0x4353a0;if(_0x4f9465>=_0x5ff65a){_0x4f9465=_0x5ff65a;_0x4353a0=0xc8;}else{_0x4353a0=0xce;}_0x509b6d[_0x9f20('0x17')](_0x4353a0);return _0x509b6d[_0x9f20('0x1d')]('Content-Range',_0x2bc0c0+'-'+_0x4f9465+'/'+_0x5ff65a)[_0x9f20('0x18')](_0x28ae95);}return null;};}function patchUpdates(_0x43f623){return function(_0x234f1f){try{jsonpatch[_0x9f20('0x1e')](_0x234f1f,_0x43f623,!![]);}catch(_0x5909f3){return BPromise['reject'](_0x5909f3);}return _0x234f1f[_0x9f20('0x1f')]();};}function saveUpdates(_0x381bd2,_0x523625){return function(_0x183b4a){if(_0x183b4a){return _0x183b4a[_0x9f20('0x20')](_0x381bd2)[_0x9f20('0x21')](function(_0x22181a){return _0x22181a;});}return null;};}function removeEntity(_0x131c3b,_0x4fa5f1){return function(_0x54b2a3){if(_0x54b2a3){return _0x54b2a3[_0x9f20('0x22')]()[_0x9f20('0x21')](function(){_0x131c3b['status'](0xcc)[_0x9f20('0x16')]();});}};}function handleEntityNotFound(_0x2badf8,_0x3269f9){return function(_0x2cb683){if(!_0x2cb683){_0x2badf8[_0x9f20('0x15')](0x194);}return _0x2cb683;};}function handleError(_0x4d4941,_0x213120){_0x213120=_0x213120||0x1f4;return function(_0xc3ba4){logger['error'](_0xc3ba4['stack']);if(_0xc3ba4[_0x9f20('0x23')]){delete _0xc3ba4[_0x9f20('0x23')];}_0x4d4941[_0x9f20('0x17')](_0x213120)[_0x9f20('0x24')](_0xc3ba4);};}exports[_0x9f20('0x25')]=function(_0x162279,_0x158ab6){var _0x4bff52={},_0x3ecf4b={},_0x117c01={'count':0x0,'rows':[]};var _0x87a9e2=_[_0x9f20('0x26')](db[_0x9f20('0x27')]['rawAttributes'],function(_0x48d8cb){return{'name':_0x48d8cb[_0x9f20('0x28')],'type':_0x48d8cb[_0x9f20('0x29')]['key']};});_0x3ecf4b['model']=_['map'](_0x87a9e2,_0x9f20('0x23'));_0x3ecf4b[_0x9f20('0x2a')]=_[_0x9f20('0x2b')](_0x162279[_0x9f20('0x2a')]);_0x3ecf4b[_0x9f20('0x2c')]=_[_0x9f20('0x2d')](_0x3ecf4b[_0x9f20('0x2e')],_0x3ecf4b[_0x9f20('0x2a')]);_0x4bff52[_0x9f20('0x2f')]=_[_0x9f20('0x2d')](_0x3ecf4b[_0x9f20('0x2e')],qs['fields'](_0x162279[_0x9f20('0x2a')]['fields']));_0x4bff52[_0x9f20('0x2f')]=_0x4bff52['attributes'][_0x9f20('0x30')]?_0x4bff52[_0x9f20('0x2f')]:_0x3ecf4b['model'];if(!_0x162279[_0x9f20('0x2a')][_0x9f20('0x31')]('nolimit')){_0x4bff52[_0x9f20('0x1c')]=qs[_0x9f20('0x1c')](_0x162279[_0x9f20('0x2a')]['limit']);_0x4bff52[_0x9f20('0x19')]=qs[_0x9f20('0x19')](_0x162279['query'][_0x9f20('0x19')]);}_0x4bff52['order']=qs['sort'](_0x162279[_0x9f20('0x2a')][_0x9f20('0x32')]);_0x4bff52['where']=qs[_0x9f20('0x2c')](_[_0x9f20('0x33')](_0x162279[_0x9f20('0x2a')],_0x3ecf4b[_0x9f20('0x2c')]),_0x87a9e2);if(_0x162279[_0x9f20('0x2a')][_0x9f20('0x34')]){_0x4bff52[_0x9f20('0x35')]=_[_0x9f20('0x36')](_0x4bff52['where'],{'$or':_['map'](_0x87a9e2,function(_0x3ccf16){if(_0x3ccf16[_0x9f20('0x29')]!==_0x9f20('0x37')){var _0x5257e6={};_0x5257e6[_0x3ccf16[_0x9f20('0x23')]]={'$like':'%'+_0x162279[_0x9f20('0x2a')][_0x9f20('0x34')]+'%'};return _0x5257e6;}})});}_0x4bff52=_[_0x9f20('0x36')]({},_0x4bff52,_0x162279[_0x9f20('0x38')]);var _0x43062d={'where':_0x4bff52[_0x9f20('0x35')]};return db[_0x9f20('0x27')][_0x9f20('0x1b')](_0x43062d)[_0x9f20('0x21')](function(_0x4e389e){_0x117c01[_0x9f20('0x1b')]=_0x4e389e;if(_0x162279[_0x9f20('0x2a')][_0x9f20('0x39')]){_0x4bff52['include']=[{'all':!![]}];}return db[_0x9f20('0x27')][_0x9f20('0x3a')](_0x4bff52);})['then'](function(_0x4e479a){_0x117c01['rows']=_0x4e479a;return _0x117c01;})[_0x9f20('0x21')](respondWithFilteredResult(_0x158ab6,_0x4bff52))[_0x9f20('0x3b')](handleError(_0x158ab6,null));};exports['show']=function(_0x3271c3,_0x15e238){var _0x3bf8dd={'raw':!![],'where':{'id':_0x3271c3[_0x9f20('0x3c')]['id']}},_0x11ec65={};_0x11ec65[_0x9f20('0x2e')]=_[_0x9f20('0x2b')](db[_0x9f20('0x27')]['rawAttributes']);_0x11ec65['query']=_[_0x9f20('0x2b')](_0x3271c3[_0x9f20('0x2a')]);_0x11ec65['filters']=_['intersection'](_0x11ec65['model'],_0x11ec65[_0x9f20('0x2a')]);_0x3bf8dd[_0x9f20('0x2f')]=_['intersection'](_0x11ec65[_0x9f20('0x2e')],qs[_0x9f20('0x3d')](_0x3271c3['query']['fields']));_0x3bf8dd[_0x9f20('0x2f')]=_0x3bf8dd[_0x9f20('0x2f')][_0x9f20('0x30')]?_0x3bf8dd[_0x9f20('0x2f')]:_0x11ec65[_0x9f20('0x2e')];if(_0x3271c3[_0x9f20('0x2a')]['includeAll']){_0x3bf8dd[_0x9f20('0x3e')]=[{'all':!![]}];}_0x3bf8dd=_[_0x9f20('0x36')]({},_0x3bf8dd,_0x3271c3['options']);return db[_0x9f20('0x27')]['find'](_0x3bf8dd)['then'](handleEntityNotFound(_0x15e238,null))[_0x9f20('0x21')](respondWithResult(_0x15e238,null))['catch'](handleError(_0x15e238,null));};exports[_0x9f20('0x3f')]=function(_0x4e45a2,_0x3d6702){return db[_0x9f20('0x27')]['create'](_0x4e45a2[_0x9f20('0x40')],{})[_0x9f20('0x21')](respondWithResult(_0x3d6702,0xc9))[_0x9f20('0x3b')](handleError(_0x3d6702,null));};exports[_0x9f20('0x20')]=function(_0x3220a2,_0x38babf){if(_0x3220a2[_0x9f20('0x40')]['id']){delete _0x3220a2[_0x9f20('0x40')]['id'];}return db[_0x9f20('0x27')][_0x9f20('0x41')]({'where':{'id':_0x3220a2['params']['id']}})[_0x9f20('0x21')](handleEntityNotFound(_0x38babf,null))[_0x9f20('0x21')](saveUpdates(_0x3220a2['body'],null))[_0x9f20('0x21')](respondWithResult(_0x38babf,null))[_0x9f20('0x3b')](handleError(_0x38babf,null));};exports[_0x9f20('0x22')]=function(_0x156625,_0x3ae684){return db['JscriptyQuestionReport'][_0x9f20('0x41')]({'where':{'id':_0x156625[_0x9f20('0x3c')]['id']}})[_0x9f20('0x21')](handleEntityNotFound(_0x3ae684,null))[_0x9f20('0x21')](removeEntity(_0x3ae684,null))[_0x9f20('0x3b')](handleError(_0x3ae684,null));};exports['describe']=function(_0x4de213,_0x5c96a5){return db['JscriptyQuestionReport'][_0x9f20('0x42')]()[_0x9f20('0x21')](respondWithResult(_0x5c96a5,null))[_0x9f20('0x3b')](handleError(_0x5c96a5,null));}; \ No newline at end of file +var _0x723f=['body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','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','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','pick','filter','where','merge','JscriptyQuestionReport','findAll','rows','show','params','keys','length','include','options','catch','create'];(function(_0x1f40f4,_0x1c2061){var _0x2494d6=function(_0x474b09){while(--_0x474b09){_0x1f40f4['push'](_0x1f40f4['shift']());}};_0x2494d6(++_0x1c2061);}(_0x723f,0x1bf));var _0xf723=function(_0x3f4d9a,_0x39a8ce){_0x3f4d9a=_0x3f4d9a-0x0;var _0xf5a24a=_0x723f[_0x3f4d9a];return _0xf5a24a;};'use strict';var emlformat=require(_0xf723('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf723('0x1'));var jsonpatch=require(_0xf723('0x2'));var rp=require(_0xf723('0x3'));var moment=require(_0xf723('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf723('0x5'));var sox=require(_0xf723('0x6'));var csv=require('to-csv');var ejs=require(_0xf723('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf723('0x8'));var squel=require(_0xf723('0x9'));var crypto=require('crypto');var jsforce=require(_0xf723('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf723('0xb'));var querystring=require(_0xf723('0xc'));var Papa=require(_0xf723('0xd'));var Redis=require(_0xf723('0xe'));var authService=require(_0xf723('0xf'));var qs=require(_0xf723('0x10'));var as=require(_0xf723('0x11'));var hardwareService=require(_0xf723('0x12'));var logger=require(_0xf723('0x13'))(_0xf723('0x14'));var utils=require(_0xf723('0x15'));var config=require(_0xf723('0x16'));var licenseUtil=require(_0xf723('0x17'));var db=require(_0xf723('0x18'))['db'];function respondWithStatusCode(_0x23df4e,_0x1d3f22){_0x1d3f22=_0x1d3f22||0xcc;return function(_0x4a6d0b){if(_0x4a6d0b){return _0x23df4e[_0xf723('0x19')](_0x1d3f22);}return _0x23df4e[_0xf723('0x1a')](_0x1d3f22)[_0xf723('0x1b')]();};}function respondWithResult(_0xd65ba5,_0x4c9fc6){_0x4c9fc6=_0x4c9fc6||0xc8;return function(_0x38cdc2){if(_0x38cdc2){return _0xd65ba5[_0xf723('0x1a')](_0x4c9fc6)[_0xf723('0x1c')](_0x38cdc2);}};}function respondWithFilteredResult(_0x4542a9,_0x1d5017){return function(_0x3638c1){if(_0x3638c1){var _0xe10367=typeof _0x1d5017['offset']==='undefined'&&typeof _0x1d5017[_0xf723('0x1d')]==='undefined';var _0x459e30=_0x3638c1[_0xf723('0x1e')];var _0x44873f=_0xe10367?0x0:_0x1d5017[_0xf723('0x1f')];var _0x14bb22=_0xe10367?_0x3638c1['count']:_0x1d5017[_0xf723('0x1f')]+_0x1d5017[_0xf723('0x1d')];var _0x126fd2;if(_0x14bb22>=_0x459e30){_0x14bb22=_0x459e30;_0x126fd2=0xc8;}else{_0x126fd2=0xce;}_0x4542a9[_0xf723('0x1a')](_0x126fd2);return _0x4542a9[_0xf723('0x20')](_0xf723('0x21'),_0x44873f+'-'+_0x14bb22+'/'+_0x459e30)['json'](_0x3638c1);}return null;};}function patchUpdates(_0x56688a){return function(_0x5ba1ab){try{jsonpatch['apply'](_0x5ba1ab,_0x56688a,!![]);}catch(_0x336737){return BPromise[_0xf723('0x22')](_0x336737);}return _0x5ba1ab[_0xf723('0x23')]();};}function saveUpdates(_0x5c83a1,_0x44af85){return function(_0x17e8fa){if(_0x17e8fa){return _0x17e8fa[_0xf723('0x24')](_0x5c83a1)['then'](function(_0x1db093){return _0x1db093;});}return null;};}function removeEntity(_0x3d09f2,_0x5e7a14){return function(_0x18da4d){if(_0x18da4d){return _0x18da4d[_0xf723('0x25')]()[_0xf723('0x26')](function(){_0x3d09f2[_0xf723('0x1a')](0xcc)[_0xf723('0x1b')]();});}};}function handleEntityNotFound(_0x2cd84e,_0x4713c3){return function(_0x5c2571){if(!_0x5c2571){_0x2cd84e['sendStatus'](0x194);}return _0x5c2571;};}function handleError(_0x46dcc7,_0x59245d){_0x59245d=_0x59245d||0x1f4;return function(_0xa38935){logger[_0xf723('0x27')](_0xa38935[_0xf723('0x28')]);if(_0xa38935[_0xf723('0x29')]){delete _0xa38935['name'];}_0x46dcc7[_0xf723('0x1a')](_0x59245d)[_0xf723('0x2a')](_0xa38935);};}exports[_0xf723('0x2b')]=function(_0x19fd30,_0x3a59a7){var _0x20ba14={},_0x133fb6={},_0x13c393={'count':0x0,'rows':[]};var _0x517b45=_['map'](db['JscriptyQuestionReport'][_0xf723('0x2c')],function(_0x48ef27){return{'name':_0x48ef27[_0xf723('0x2d')],'type':_0x48ef27[_0xf723('0x2e')][_0xf723('0x2f')]};});_0x133fb6[_0xf723('0x30')]=_[_0xf723('0x31')](_0x517b45,_0xf723('0x29'));_0x133fb6[_0xf723('0x32')]=_['keys'](_0x19fd30[_0xf723('0x32')]);_0x133fb6[_0xf723('0x33')]=_['intersection'](_0x133fb6[_0xf723('0x30')],_0x133fb6[_0xf723('0x32')]);_0x20ba14[_0xf723('0x34')]=_[_0xf723('0x35')](_0x133fb6['model'],qs['fields'](_0x19fd30[_0xf723('0x32')][_0xf723('0x36')]));_0x20ba14['attributes']=_0x20ba14[_0xf723('0x34')]['length']?_0x20ba14[_0xf723('0x34')]:_0x133fb6[_0xf723('0x30')];if(!_0x19fd30[_0xf723('0x32')]['hasOwnProperty'](_0xf723('0x37'))){_0x20ba14[_0xf723('0x1d')]=qs[_0xf723('0x1d')](_0x19fd30[_0xf723('0x32')][_0xf723('0x1d')]);_0x20ba14[_0xf723('0x1f')]=qs[_0xf723('0x1f')](_0x19fd30[_0xf723('0x32')]['offset']);}_0x20ba14['order']=qs['sort'](_0x19fd30[_0xf723('0x32')]['sort']);_0x20ba14['where']=qs['filters'](_[_0xf723('0x38')](_0x19fd30['query'],_0x133fb6[_0xf723('0x33')]),_0x517b45);if(_0x19fd30[_0xf723('0x32')][_0xf723('0x39')]){_0x20ba14[_0xf723('0x3a')]=_[_0xf723('0x3b')](_0x20ba14[_0xf723('0x3a')],{'$or':_[_0xf723('0x31')](_0x517b45,function(_0x22d949){if(_0x22d949[_0xf723('0x2e')]!=='VIRTUAL'){var _0x2da424={};_0x2da424[_0x22d949[_0xf723('0x29')]]={'$like':'%'+_0x19fd30[_0xf723('0x32')]['filter']+'%'};return _0x2da424;}})});}_0x20ba14=_[_0xf723('0x3b')]({},_0x20ba14,_0x19fd30['options']);var _0x3fd1be={'where':_0x20ba14[_0xf723('0x3a')]};return db[_0xf723('0x3c')][_0xf723('0x1e')](_0x3fd1be)[_0xf723('0x26')](function(_0x2a3174){_0x13c393[_0xf723('0x1e')]=_0x2a3174;if(_0x19fd30[_0xf723('0x32')]['includeAll']){_0x20ba14['include']=[{'all':!![]}];}return db[_0xf723('0x3c')][_0xf723('0x3d')](_0x20ba14);})[_0xf723('0x26')](function(_0x11b2f0){_0x13c393[_0xf723('0x3e')]=_0x11b2f0;return _0x13c393;})[_0xf723('0x26')](respondWithFilteredResult(_0x3a59a7,_0x20ba14))['catch'](handleError(_0x3a59a7,null));};exports[_0xf723('0x3f')]=function(_0xa7fe69,_0xa6fd04){var _0x97894={'raw':!![],'where':{'id':_0xa7fe69[_0xf723('0x40')]['id']}},_0x22019c={};_0x22019c[_0xf723('0x30')]=_['keys'](db[_0xf723('0x3c')][_0xf723('0x2c')]);_0x22019c['query']=_[_0xf723('0x41')](_0xa7fe69[_0xf723('0x32')]);_0x22019c[_0xf723('0x33')]=_[_0xf723('0x35')](_0x22019c[_0xf723('0x30')],_0x22019c[_0xf723('0x32')]);_0x97894['attributes']=_[_0xf723('0x35')](_0x22019c[_0xf723('0x30')],qs['fields'](_0xa7fe69[_0xf723('0x32')]['fields']));_0x97894[_0xf723('0x34')]=_0x97894['attributes'][_0xf723('0x42')]?_0x97894[_0xf723('0x34')]:_0x22019c[_0xf723('0x30')];if(_0xa7fe69[_0xf723('0x32')]['includeAll']){_0x97894[_0xf723('0x43')]=[{'all':!![]}];}_0x97894=_[_0xf723('0x3b')]({},_0x97894,_0xa7fe69[_0xf723('0x44')]);return db[_0xf723('0x3c')]['find'](_0x97894)[_0xf723('0x26')](handleEntityNotFound(_0xa6fd04,null))[_0xf723('0x26')](respondWithResult(_0xa6fd04,null))[_0xf723('0x45')](handleError(_0xa6fd04,null));};exports[_0xf723('0x46')]=function(_0x460bce,_0x397915){return db[_0xf723('0x3c')][_0xf723('0x46')](_0x460bce[_0xf723('0x47')],{})['then'](respondWithResult(_0x397915,0xc9))[_0xf723('0x45')](handleError(_0x397915,null));};exports[_0xf723('0x24')]=function(_0x1367d6,_0x3633ac){if(_0x1367d6[_0xf723('0x47')]['id']){delete _0x1367d6['body']['id'];}return db[_0xf723('0x3c')][_0xf723('0x48')]({'where':{'id':_0x1367d6[_0xf723('0x40')]['id']}})['then'](handleEntityNotFound(_0x3633ac,null))[_0xf723('0x26')](saveUpdates(_0x1367d6[_0xf723('0x47')],null))[_0xf723('0x26')](respondWithResult(_0x3633ac,null))[_0xf723('0x45')](handleError(_0x3633ac,null));};exports['destroy']=function(_0x3e8d4d,_0x40eba9){return db[_0xf723('0x3c')]['find']({'where':{'id':_0x3e8d4d[_0xf723('0x40')]['id']}})['then'](handleEntityNotFound(_0x40eba9,null))['then'](removeEntity(_0x40eba9,null))[_0xf723('0x45')](handleError(_0x40eba9,null));};exports[_0xf723('0x49')]=function(_0x412d13,_0x48ed65){return db[_0xf723('0x3c')][_0xf723('0x49')]()['then'](respondWithResult(_0x48ed65,null))['catch'](handleError(_0x48ed65,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0e9cbc4..397ec11 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 _0x9a8b=['path','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','api','bluebird'];(function(_0x4b47a4,_0x29547f){var _0x2012ef=function(_0x28b326){while(--_0x28b326){_0x4b47a4['push'](_0x4b47a4['shift']());}};_0x2012ef(++_0x29547f);}(_0x9a8b,0x7d));var _0xb9a8=function(_0x2248ed,_0x518879){_0x2248ed=_0x2248ed-0x0;var _0x4198f5=_0x9a8b[_0x2248ed];return _0x4198f5;};'use strict';var _=require(_0xb9a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb9a8('0x1'));var moment=require('moment');var BPromise=require(_0xb9a8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9a8('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb9a8('0x4'));module[_0xb9a8('0x5')]=function(_0x59f20d,_0xfae384){return _0x59f20d['define'](_0xb9a8('0x6'),attributes,{'tableName':_0xb9a8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08e4=['moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash','util','api'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x08e4,0x168));var _0x408e=function(_0x5cdaed,_0x306a85){_0x5cdaed=_0x5cdaed-0x0;var _0x5d8c01=_0x08e4[_0x5cdaed];return _0x5d8c01;};'use strict';var _=require(_0x408e('0x0'));var util=require(_0x408e('0x1'));var logger=require('../../config/logger')(_0x408e('0x2'));var moment=require(_0x408e('0x3'));var BPromise=require(_0x408e('0x4'));var rp=require(_0x408e('0x5'));var fs=require('fs');var path=require(_0x408e('0x6'));var rimraf=require('rimraf');var config=require(_0x408e('0x7'));var attributes=require(_0x408e('0x8'));module[_0x408e('0x9')]=function(_0x50d3bd,_0x4837af){return _0x50d3bd[_0x408e('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 05d55a2..f810fec 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 _0x7af9=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x49857a,_0x3f99d3){var _0x1df6c7=function(_0x556a60){while(--_0x556a60){_0x49857a['push'](_0x49857a['shift']());}};_0x1df6c7(++_0x3f99d3);}(_0x7af9,0x1e3));var _0x97af=function(_0x5a5104,_0x448fca){_0x5a5104=_0x5a5104-0x0;var _0x47ba61=_0x7af9[_0x5a5104];return _0x47ba61;};'use strict';var _=require(_0x97af('0x0'));var util=require(_0x97af('0x1'));var moment=require(_0x97af('0x2'));var BPromise=require(_0x97af('0x3'));var rs=require(_0x97af('0x4'));var fs=require('fs');var Redis=require(_0x97af('0x5'));var db=require(_0x97af('0x6'))['db'];var utils=require(_0x97af('0x7'));var logger=require(_0x97af('0x8'))(_0x97af('0x9'));var config=require(_0x97af('0xa'));var jayson=require(_0x97af('0xb'));var client=jayson[_0x97af('0xc')][_0x97af('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x260e50,_0x3123c8,_0x3ad145){return new BPromise(function(_0x4698f3,_0x55eb51){return client[_0x97af('0xe')](_0x260e50,_0x3ad145)[_0x97af('0xf')](function(_0x264389){logger['info'](_0x97af('0x10'),_0x3123c8,_0x97af('0x11'));logger['debug'](_0x97af('0x12'),_0x3123c8,_0x97af('0x11'),JSON[_0x97af('0x13')](_0x264389));if(_0x264389[_0x97af('0x14')]){if(_0x264389[_0x97af('0x14')][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x14')](_0x97af('0x10'),_0x3123c8,_0x264389[_0x97af('0x14')]['message']);return _0x55eb51(_0x264389[_0x97af('0x14')][_0x97af('0x16')]);}logger[_0x97af('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3123c8,_0x264389['error'][_0x97af('0x16')]);return _0x4698f3(_0x264389['error']['message']);}else{logger['info'](_0x97af('0x10'),_0x3123c8,'request\x20sent');_0x4698f3(_0x264389[_0x97af('0x17')][_0x97af('0x16')]);}})[_0x97af('0x18')](function(_0x4d76d8){logger['error'](_0x97af('0x10'),_0x3123c8,_0x4d76d8);_0x55eb51(_0x4d76d8);});});} \ No newline at end of file +var _0xfd7f=['moment','bluebird','../../config/utils','rpc','http','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x44c466,_0x426234){var _0x489c46=function(_0x4c548f){while(--_0x4c548f){_0x44c466['push'](_0x44c466['shift']());}};_0x489c46(++_0x426234);}(_0xfd7f,0x99));var _0xffd7=function(_0x1b0307,_0x4336b1){_0x1b0307=_0x1b0307-0x0;var _0x5c8d34=_0xfd7f[_0x1b0307];return _0x5c8d34;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffd7('0x0'));var BPromise=require(_0xffd7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xffd7('0x2'));var logger=require('../../config/logger')(_0xffd7('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xffd7('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x166fbe,_0x5363b0,_0x18987e){return new BPromise(function(_0x5aa2e0,_0x53e5ff){return client['request'](_0x166fbe,_0x18987e)[_0xffd7('0x5')](function(_0x344647){logger['info'](_0xffd7('0x6'),_0x5363b0,_0xffd7('0x7'));logger[_0xffd7('0x8')](_0xffd7('0x9'),_0x5363b0,_0xffd7('0x7'),JSON[_0xffd7('0xa')](_0x344647));if(_0x344647[_0xffd7('0xb')]){if(_0x344647[_0xffd7('0xb')][_0xffd7('0xc')]===0x1f4){logger[_0xffd7('0xb')](_0xffd7('0x6'),_0x5363b0,_0x344647['error'][_0xffd7('0xd')]);return _0x53e5ff(_0x344647[_0xffd7('0xb')][_0xffd7('0xd')]);}logger['error'](_0xffd7('0x6'),_0x5363b0,_0x344647[_0xffd7('0xb')][_0xffd7('0xd')]);return _0x5aa2e0(_0x344647[_0xffd7('0xb')][_0xffd7('0xd')]);}else{logger[_0xffd7('0xe')](_0xffd7('0x6'),_0x5363b0,_0xffd7('0x7'));_0x5aa2e0(_0x344647[_0xffd7('0xf')][_0xffd7('0xd')]);}})[_0xffd7('0x10')](function(_0x575659){logger[_0xffd7('0xb')](_0xffd7('0x6'),_0x5363b0,_0x575659);_0x53e5ff(_0x575659);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 2f45eb2..b9a6e64 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 _0x0209=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x7dbe94,_0x5a80a0){var _0xa43a01=function(_0x1505cf){while(--_0x1505cf){_0x7dbe94['push'](_0x7dbe94['shift']());}};_0xa43a01(++_0x5a80a0);}(_0x0209,0x126));var _0x9020=function(_0x2513a1,_0x1ffb95){_0x2513a1=_0x2513a1-0x0;var _0x36e5e7=_0x0209[_0x2513a1];return _0x36e5e7;};'use strict';var multer=require(_0x9020('0x0'));var util=require(_0x9020('0x1'));var path=require(_0x9020('0x2'));var timeout=require(_0x9020('0x3'));var express=require(_0x9020('0x4'));var router=express[_0x9020('0x5')]();var fs_extra=require(_0x9020('0x6'));var auth=require(_0x9020('0x7'));var interaction=require(_0x9020('0x8'));var config=require(_0x9020('0x9'));var controller=require(_0x9020('0xa'));router['get']('/',auth[_0x9020('0xb')](),controller[_0x9020('0xc')]);router[_0x9020('0xd')](_0x9020('0xe'),auth[_0x9020('0xb')](),controller[_0x9020('0xf')]);router[_0x9020('0xd')](_0x9020('0x10'),auth['isAuthenticated'](),controller[_0x9020('0x11')]);router[_0x9020('0xd')](_0x9020('0x12'),auth['isAuthenticated'](),controller['getQuestions']);router['post']('/',auth[_0x9020('0xb')](),controller[_0x9020('0x13')]);router[_0x9020('0x14')](_0x9020('0x10'),auth[_0x9020('0xb')](),controller[_0x9020('0x15')]);router['delete'](_0x9020('0x10'),auth[_0x9020('0xb')](),controller['destroy']);module[_0x9020('0x16')]=router; \ No newline at end of file +var _0x55f7=['/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','post','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x55f7,0x197));var _0x755f=function(_0x9da069,_0x228bee){_0x9da069=_0x9da069-0x0;var _0x25e4a0=_0x55f7[_0x9da069];return _0x25e4a0;};'use strict';var multer=require(_0x755f('0x0'));var util=require(_0x755f('0x1'));var path=require(_0x755f('0x2'));var timeout=require('connect-timeout');var express=require(_0x755f('0x3'));var router=express[_0x755f('0x4')]();var fs_extra=require(_0x755f('0x5'));var auth=require(_0x755f('0x6'));var interaction=require(_0x755f('0x7'));var config=require(_0x755f('0x8'));var controller=require(_0x755f('0x9'));router[_0x755f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x755f('0xa')](_0x755f('0xb'),auth['isAuthenticated'](),controller[_0x755f('0xc')]);router['get'](_0x755f('0xd'),auth[_0x755f('0xe')](),controller[_0x755f('0xf')]);router[_0x755f('0xa')](_0x755f('0x10'),auth[_0x755f('0xe')](),controller[_0x755f('0x11')]);router[_0x755f('0x12')]('/',auth[_0x755f('0xe')](),controller['create']);router[_0x755f('0x13')](_0x755f('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x755f('0x14')](_0x755f('0xd'),auth[_0x755f('0xe')](),controller[_0x755f('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index fbf7a4a..fbf92a1 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 _0x51d1=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x575cfb,_0x14344a){var _0x5d9759=function(_0x22715a){while(--_0x22715a){_0x575cfb['push'](_0x575cfb['shift']());}};_0x5d9759(++_0x14344a);}(_0x51d1,0x1d6));var _0x151d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x51d1[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x151d('0x0'));var Sequelize=require(_0x151d('0x1'));module[_0x151d('0x2')]={'starttime':{'type':Sequelize[_0x151d('0x3')],'set':function(_0x3e3bb0){this[_0x151d('0x4')](_0x151d('0x5'),_0x3e3bb0);this[_0x151d('0x4')](_0x151d('0x6'),moment()[_0x151d('0x7')](_0x151d('0x8')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x151d('0x9')]},'projectname':{'type':Sequelize[_0x151d('0x9')]},'queue':{'type':Sequelize[_0x151d('0x9')]},'uniqueid':{'type':Sequelize[_0x151d('0x9')]},'calleridname':{'type':Sequelize[_0x151d('0x9')]},'calleridnum':{'type':Sequelize[_0x151d('0x9')]},'completed':{'type':Sequelize[_0x151d('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x6d78=['DATE','STRING','moment','sequelize','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3f1f48,_0x42d69d){var _0x239bad=function(_0x38c6e9){while(--_0x38c6e9){_0x3f1f48['push'](_0x3f1f48['shift']());}};_0x239bad(++_0x42d69d);}(_0x6d78,0x1c9));var _0x86d7=function(_0x1bc9a2,_0x3ddf39){_0x1bc9a2=_0x1bc9a2-0x0;var _0x3f16e7=_0x6d78[_0x1bc9a2];return _0x3f16e7;};'use strict';var moment=require(_0x86d7('0x0'));var Sequelize=require(_0x86d7('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5c9ae2){this['setDataValue'](_0x86d7('0x2'),_0x5c9ae2);this['setDataValue'](_0x86d7('0x3'),moment()['format'](_0x86d7('0x4')));}},'endtime':{'type':Sequelize[_0x86d7('0x5')]},'membername':{'type':Sequelize[_0x86d7('0x6')]},'projectname':{'type':Sequelize[_0x86d7('0x6')]},'queue':{'type':Sequelize[_0x86d7('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x86d7('0x6')]},'calleridnum':{'type':Sequelize[_0x86d7('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 55c9602..46dc687 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 _0x7e6e=['fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','includeAll','eml-format','rimraf','zip-dir'];(function(_0x12803e,_0x56c117){var _0x4e87f8=function(_0x1da364){while(--_0x1da364){_0x12803e['push'](_0x12803e['shift']());}};_0x4e87f8(++_0x56c117);}(_0x7e6e,0xea));var _0xe7e6=function(_0x435b46,_0x152bc1){_0x435b46=_0x435b46-0x0;var _0x42972c=_0x7e6e[_0x435b46];return _0x42972c;};'use strict';var emlformat=require(_0xe7e6('0x0'));var rimraf=require(_0xe7e6('0x1'));var zipdir=require(_0xe7e6('0x2'));var jsonpatch=require(_0xe7e6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7e6('0x4'));var Mustache=require(_0xe7e6('0x5'));var util=require(_0xe7e6('0x6'));var path=require(_0xe7e6('0x7'));var sox=require(_0xe7e6('0x8'));var csv=require('to-csv');var ejs=require(_0xe7e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe7e6('0xa'));var crypto=require(_0xe7e6('0xb'));var jsforce=require(_0xe7e6('0xc'));var deskjs=require(_0xe7e6('0xd'));var toCsv=require(_0xe7e6('0xe'));var querystring=require(_0xe7e6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe7e6('0x10'));var hardwareService=require(_0xe7e6('0x11'));var logger=require(_0xe7e6('0x12'))(_0xe7e6('0x13'));var utils=require(_0xe7e6('0x14'));var config=require(_0xe7e6('0x15'));var licenseUtil=require(_0xe7e6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26ef2f,_0x46a955){_0x46a955=_0x46a955||0xcc;return function(_0x45b2e0){if(_0x45b2e0){return _0x26ef2f[_0xe7e6('0x17')](_0x46a955);}return _0x26ef2f[_0xe7e6('0x18')](_0x46a955)[_0xe7e6('0x19')]();};}function respondWithResult(_0x4ce0dd,_0xdbee6d){_0xdbee6d=_0xdbee6d||0xc8;return function(_0x55c82c){if(_0x55c82c){return _0x4ce0dd[_0xe7e6('0x18')](_0xdbee6d)[_0xe7e6('0x1a')](_0x55c82c);}};}function respondWithFilteredResult(_0x5c095a,_0x251085){return function(_0x3d3619){if(_0x3d3619){var _0x521db1=typeof _0x251085[_0xe7e6('0x1b')]==='undefined'&&typeof _0x251085[_0xe7e6('0x1c')]===_0xe7e6('0x1d');var _0x29d517=_0x3d3619[_0xe7e6('0x1e')];var _0x576b7d=_0x521db1?0x0:_0x251085[_0xe7e6('0x1b')];var _0x20a766=_0x521db1?_0x3d3619[_0xe7e6('0x1e')]:_0x251085['offset']+_0x251085['limit'];var _0x5ef49b;if(_0x20a766>=_0x29d517){_0x20a766=_0x29d517;_0x5ef49b=0xc8;}else{_0x5ef49b=0xce;}_0x5c095a[_0xe7e6('0x18')](_0x5ef49b);return _0x5c095a[_0xe7e6('0x1f')](_0xe7e6('0x20'),_0x576b7d+'-'+_0x20a766+'/'+_0x29d517)[_0xe7e6('0x1a')](_0x3d3619);}return null;};}function patchUpdates(_0x403565){return function(_0xc30736){try{jsonpatch['apply'](_0xc30736,_0x403565,!![]);}catch(_0x488014){return BPromise[_0xe7e6('0x21')](_0x488014);}return _0xc30736[_0xe7e6('0x22')]();};}function saveUpdates(_0x195636,_0x27a6ca){return function(_0x476030){if(_0x476030){return _0x476030['update'](_0x195636)[_0xe7e6('0x23')](function(_0x4fb06a){return _0x4fb06a;});}return null;};}function removeEntity(_0x4b564d,_0x4625c3){return function(_0x528451){if(_0x528451){return _0x528451['destroy']()['then'](function(){_0x4b564d[_0xe7e6('0x18')](0xcc)[_0xe7e6('0x19')]();});}};}function handleEntityNotFound(_0x34379c,_0x346148){return function(_0x4c49a3){if(!_0x4c49a3){_0x34379c[_0xe7e6('0x17')](0x194);}return _0x4c49a3;};}function handleError(_0x516c36,_0x2d17f4){_0x2d17f4=_0x2d17f4||0x1f4;return function(_0x3c6fb7){logger[_0xe7e6('0x24')](_0x3c6fb7[_0xe7e6('0x25')]);if(_0x3c6fb7['name']){delete _0x3c6fb7[_0xe7e6('0x26')];}_0x516c36[_0xe7e6('0x18')](_0x2d17f4)[_0xe7e6('0x27')](_0x3c6fb7);};}exports[_0xe7e6('0x28')]=function(_0x2a5023,_0x32015c){var _0x1c4005={},_0x3a4e8c={},_0x2eb8bb={'count':0x0,'rows':[]};var _0x18bbb4=_[_0xe7e6('0x29')](db[_0xe7e6('0x2a')][_0xe7e6('0x2b')],function(_0x20383e){return{'name':_0x20383e['fieldName'],'type':_0x20383e[_0xe7e6('0x2c')]['key']};});_0x3a4e8c[_0xe7e6('0x2d')]=_[_0xe7e6('0x29')](_0x18bbb4,_0xe7e6('0x26'));_0x3a4e8c[_0xe7e6('0x2e')]=_['keys'](_0x2a5023['query']);_0x3a4e8c[_0xe7e6('0x2f')]=_['intersection'](_0x3a4e8c[_0xe7e6('0x2d')],_0x3a4e8c['query']);_0x1c4005['attributes']=_[_0xe7e6('0x30')](_0x3a4e8c[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x2a5023[_0xe7e6('0x2e')]['fields']));_0x1c4005[_0xe7e6('0x32')]=_0x1c4005[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x1c4005[_0xe7e6('0x32')]:_0x3a4e8c['model'];if(!_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x34')](_0xe7e6('0x35'))){_0x1c4005[_0xe7e6('0x1c')]=qs['limit'](_0x2a5023['query'][_0xe7e6('0x1c')]);_0x1c4005[_0xe7e6('0x1b')]=qs['offset'](_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x1b')]);}_0x1c4005[_0xe7e6('0x36')]=qs[_0xe7e6('0x37')](_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x37')]);_0x1c4005[_0xe7e6('0x38')]=qs[_0xe7e6('0x2f')](_['pick'](_0x2a5023[_0xe7e6('0x2e')],_0x3a4e8c[_0xe7e6('0x2f')]),_0x18bbb4);if(_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x39')]){_0x1c4005['where']=_[_0xe7e6('0x3a')](_0x1c4005[_0xe7e6('0x38')],{'$or':_['map'](_0x18bbb4,function(_0x486d02){if(_0x486d02['type']!==_0xe7e6('0x3b')){var _0x58d053={};_0x58d053[_0x486d02[_0xe7e6('0x26')]]={'$like':'%'+_0x2a5023[_0xe7e6('0x2e')][_0xe7e6('0x39')]+'%'};return _0x58d053;}})});}_0x1c4005=_[_0xe7e6('0x3a')]({},_0x1c4005,_0x2a5023[_0xe7e6('0x3c')]);var _0x3cb747={'where':_0x1c4005[_0xe7e6('0x38')]};return db[_0xe7e6('0x2a')][_0xe7e6('0x1e')](_0x3cb747)[_0xe7e6('0x23')](function(_0x4a2aea){_0x2eb8bb[_0xe7e6('0x1e')]=_0x4a2aea;if(_0x2a5023[_0xe7e6('0x2e')]['includeAll']){_0x1c4005[_0xe7e6('0x3d')]=[{'all':!![]}];}return db[_0xe7e6('0x2a')][_0xe7e6('0x3e')](_0x1c4005);})['then'](function(_0x323ca8){_0x2eb8bb[_0xe7e6('0x3f')]=_0x323ca8;return _0x2eb8bb;})[_0xe7e6('0x23')](respondWithFilteredResult(_0x32015c,_0x1c4005))[_0xe7e6('0x40')](handleError(_0x32015c,null));};exports[_0xe7e6('0x41')]=function(_0x5923e5,_0x530502){var _0x47364b={'raw':!![],'where':{'id':_0x5923e5[_0xe7e6('0x42')]['id']}},_0x2bb6a6={};_0x2bb6a6[_0xe7e6('0x2d')]=_['keys'](db[_0xe7e6('0x2a')][_0xe7e6('0x2b')]);_0x2bb6a6[_0xe7e6('0x2e')]=_[_0xe7e6('0x43')](_0x5923e5[_0xe7e6('0x2e')]);_0x2bb6a6[_0xe7e6('0x2f')]=_[_0xe7e6('0x30')](_0x2bb6a6[_0xe7e6('0x2d')],_0x2bb6a6['query']);_0x47364b[_0xe7e6('0x32')]=_[_0xe7e6('0x30')](_0x2bb6a6[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x5923e5[_0xe7e6('0x2e')][_0xe7e6('0x31')]));_0x47364b['attributes']=_0x47364b[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x47364b[_0xe7e6('0x32')]:_0x2bb6a6[_0xe7e6('0x2d')];if(_0x5923e5[_0xe7e6('0x2e')]['includeAll']){_0x47364b[_0xe7e6('0x3d')]=[{'all':!![]}];}_0x47364b=_[_0xe7e6('0x3a')]({},_0x47364b,_0x5923e5[_0xe7e6('0x3c')]);return db[_0xe7e6('0x2a')][_0xe7e6('0x44')](_0x47364b)['then'](handleEntityNotFound(_0x530502,null))[_0xe7e6('0x23')](respondWithResult(_0x530502,null))[_0xe7e6('0x40')](handleError(_0x530502,null));};exports['create']=function(_0x251174,_0x3319d5){return db['JscriptySessionReport'][_0xe7e6('0x45')](_0x251174['body'],{})['then'](respondWithResult(_0x3319d5,0xc9))[_0xe7e6('0x40')](handleError(_0x3319d5,null));};exports['update']=function(_0x5194c6,_0x8aeb5d){if(_0x5194c6[_0xe7e6('0x46')]['id']){delete _0x5194c6[_0xe7e6('0x46')]['id'];}return db[_0xe7e6('0x2a')][_0xe7e6('0x44')]({'where':{'id':_0x5194c6['params']['id']}})[_0xe7e6('0x23')](handleEntityNotFound(_0x8aeb5d,null))['then'](saveUpdates(_0x5194c6[_0xe7e6('0x46')],null))['then'](respondWithResult(_0x8aeb5d,null))[_0xe7e6('0x40')](handleError(_0x8aeb5d,null));};exports[_0xe7e6('0x47')]=function(_0x349c52,_0x4be6a0){return db[_0xe7e6('0x2a')][_0xe7e6('0x44')]({'where':{'id':_0x349c52[_0xe7e6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4be6a0,null))['then'](removeEntity(_0x4be6a0,null))[_0xe7e6('0x40')](handleError(_0x4be6a0,null));};exports[_0xe7e6('0x48')]=function(_0x4a0d50,_0x31471a){return db[_0xe7e6('0x2a')][_0xe7e6('0x48')]()[_0xe7e6('0x23')](respondWithResult(_0x31471a,null))['catch'](handleError(_0x31471a,null));};exports[_0xe7e6('0x49')]=function(_0x479825,_0x1b7942,_0x277b20){var _0x1a708a={'raw':!![],'where':{}};var _0x538bf9={};var _0x4f259e={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xe7e6('0x4a')]({'where':{'id':_0x479825[_0xe7e6('0x42')]['id']}})[_0xe7e6('0x23')](handleEntityNotFound(_0x1b7942,null))[_0xe7e6('0x23')](function(_0x169671){if(_0x169671){_0x538bf9[_0xe7e6('0x2d')]=_[_0xe7e6('0x43')](db[_0xe7e6('0x4b')][_0xe7e6('0x2b')]);_0x538bf9['query']=_[_0xe7e6('0x43')](_0x479825['query']);_0x538bf9[_0xe7e6('0x2f')]=_[_0xe7e6('0x30')](_0x538bf9[_0xe7e6('0x2d')],_0x538bf9[_0xe7e6('0x2e')]);_0x1a708a[_0xe7e6('0x32')]=_[_0xe7e6('0x30')](_0x538bf9[_0xe7e6('0x2d')],qs[_0xe7e6('0x31')](_0x479825['query'][_0xe7e6('0x31')]));_0x1a708a[_0xe7e6('0x32')]=_0x1a708a[_0xe7e6('0x32')][_0xe7e6('0x33')]?_0x1a708a[_0xe7e6('0x32')]:_0x538bf9[_0xe7e6('0x2d')];if(!_0x479825[_0xe7e6('0x2e')]['hasOwnProperty'](_0xe7e6('0x35'))){_0x1a708a['limit']=qs['limit'](_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x1c')]);_0x1a708a[_0xe7e6('0x1b')]=qs[_0xe7e6('0x1b')](_0x479825[_0xe7e6('0x2e')]['offset']);}_0x1a708a[_0xe7e6('0x36')]=qs[_0xe7e6('0x37')](_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x37')]);_0x1a708a[_0xe7e6('0x38')]=qs['filters'](_[_0xe7e6('0x4c')](_0x479825[_0xe7e6('0x2e')],_0x538bf9['filters']));_0x1a708a[_0xe7e6('0x38')][_0xe7e6('0x4d')]=_0x169671['id'];if(_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x39')]){_0x1a708a[_0xe7e6('0x38')]=_['merge'](_0x1a708a[_0xe7e6('0x38')],{'$or':_[_0xe7e6('0x29')](_0x1a708a[_0xe7e6('0x32')],function(_0x43c8c0){var _0x4f5298={};_0x4f5298[_0x43c8c0]={'$like':'%'+_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x39')]+'%'};return _0x4f5298;})});}_0x1a708a=_[_0xe7e6('0x3a')]({},_0x1a708a,_0x479825[_0xe7e6('0x3c')]);return db[_0xe7e6('0x4b')][_0xe7e6('0x1e')]({'where':_0x1a708a[_0xe7e6('0x38')]})['then'](function(_0x5ac3e9){_0x4f259e[_0xe7e6('0x1e')]=_0x5ac3e9;if(_0x479825[_0xe7e6('0x2e')][_0xe7e6('0x4e')]){_0x1a708a['include']=[{'all':!![]}];}return db[_0xe7e6('0x4b')]['findAll'](_0x1a708a);})['then'](function(_0x3b738b){_0x4f259e['rows']=_0x3b738b;return _0x4f259e;});}})[_0xe7e6('0x23')](respondWithFilteredResult(_0x1b7942,_0x1a708a))[_0xe7e6('0x40')](handleError(_0x1b7942,null));}; \ No newline at end of file +var _0x0800=['error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy'];(function(_0x96c72,_0x581cfb){var _0x4868a6=function(_0x1185a8){while(--_0x1185a8){_0x96c72['push'](_0x96c72['shift']());}};_0x4868a6(++_0x581cfb);}(_0x0800,0x11c));var _0x0080=function(_0x1d0645,_0x480b38){_0x1d0645=_0x1d0645-0x0;var _0x46f0b3=_0x0800[_0x1d0645];return _0x46f0b3;};'use strict';var emlformat=require(_0x0080('0x0'));var rimraf=require(_0x0080('0x1'));var zipdir=require(_0x0080('0x2'));var jsonpatch=require(_0x0080('0x3'));var rp=require(_0x0080('0x4'));var moment=require(_0x0080('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0080('0x6'));var util=require(_0x0080('0x7'));var path=require(_0x0080('0x8'));var sox=require('sox');var csv=require(_0x0080('0x9'));var ejs=require(_0x0080('0xa'));var fs=require('fs');var fs_extra=require(_0x0080('0xb'));var _=require(_0x0080('0xc'));var squel=require(_0x0080('0xd'));var crypto=require(_0x0080('0xe'));var jsforce=require(_0x0080('0xf'));var deskjs=require(_0x0080('0x10'));var toCsv=require(_0x0080('0x9'));var querystring=require(_0x0080('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0080('0x12'));var qs=require(_0x0080('0x13'));var as=require(_0x0080('0x14'));var hardwareService=require(_0x0080('0x15'));var logger=require(_0x0080('0x16'))(_0x0080('0x17'));var utils=require(_0x0080('0x18'));var config=require(_0x0080('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0080('0x1a'))['db'];function respondWithStatusCode(_0x4f8983,_0x74bc1f){_0x74bc1f=_0x74bc1f||0xcc;return function(_0xbacdb2){if(_0xbacdb2){return _0x4f8983[_0x0080('0x1b')](_0x74bc1f);}return _0x4f8983[_0x0080('0x1c')](_0x74bc1f)[_0x0080('0x1d')]();};}function respondWithResult(_0x5ca565,_0x4246ea){_0x4246ea=_0x4246ea||0xc8;return function(_0x1f5124){if(_0x1f5124){return _0x5ca565[_0x0080('0x1c')](_0x4246ea)[_0x0080('0x1e')](_0x1f5124);}};}function respondWithFilteredResult(_0x5922c0,_0x518c45){return function(_0x4c8255){if(_0x4c8255){var _0x1c871f=typeof _0x518c45['offset']===_0x0080('0x1f')&&typeof _0x518c45[_0x0080('0x20')]===_0x0080('0x1f');var _0x16e47d=_0x4c8255[_0x0080('0x21')];var _0x4b04aa=_0x1c871f?0x0:_0x518c45['offset'];var _0x2ed275=_0x1c871f?_0x4c8255['count']:_0x518c45[_0x0080('0x22')]+_0x518c45['limit'];var _0x4d8ee6;if(_0x2ed275>=_0x16e47d){_0x2ed275=_0x16e47d;_0x4d8ee6=0xc8;}else{_0x4d8ee6=0xce;}_0x5922c0[_0x0080('0x1c')](_0x4d8ee6);return _0x5922c0['set']('Content-Range',_0x4b04aa+'-'+_0x2ed275+'/'+_0x16e47d)['json'](_0x4c8255);}return null;};}function patchUpdates(_0x267901){return function(_0x2f74dc){try{jsonpatch['apply'](_0x2f74dc,_0x267901,!![]);}catch(_0x159ce8){return BPromise[_0x0080('0x23')](_0x159ce8);}return _0x2f74dc[_0x0080('0x24')]();};}function saveUpdates(_0x542879,_0x736e59){return function(_0x47f7fd){if(_0x47f7fd){return _0x47f7fd[_0x0080('0x25')](_0x542879)[_0x0080('0x26')](function(_0x5722ea){return _0x5722ea;});}return null;};}function removeEntity(_0xe2c59,_0x2669a1){return function(_0xdd1da){if(_0xdd1da){return _0xdd1da[_0x0080('0x27')]()[_0x0080('0x26')](function(){_0xe2c59[_0x0080('0x1c')](0xcc)[_0x0080('0x1d')]();});}};}function handleEntityNotFound(_0x916d0f,_0x3a474b){return function(_0x2c913a){if(!_0x2c913a){_0x916d0f['sendStatus'](0x194);}return _0x2c913a;};}function handleError(_0x46c73f,_0x4714d0){_0x4714d0=_0x4714d0||0x1f4;return function(_0x1c9132){logger[_0x0080('0x28')](_0x1c9132['stack']);if(_0x1c9132[_0x0080('0x29')]){delete _0x1c9132[_0x0080('0x29')];}_0x46c73f[_0x0080('0x1c')](_0x4714d0)['send'](_0x1c9132);};}exports[_0x0080('0x2a')]=function(_0x421bbe,_0x339b8c){var _0x30916b={},_0x5dc131={},_0x1f6070={'count':0x0,'rows':[]};var _0x39aed2=_[_0x0080('0x2b')](db[_0x0080('0x2c')][_0x0080('0x2d')],function(_0x52aec3){return{'name':_0x52aec3[_0x0080('0x2e')],'type':_0x52aec3[_0x0080('0x2f')][_0x0080('0x30')]};});_0x5dc131[_0x0080('0x31')]=_[_0x0080('0x2b')](_0x39aed2,'name');_0x5dc131[_0x0080('0x32')]=_[_0x0080('0x33')](_0x421bbe['query']);_0x5dc131[_0x0080('0x34')]=_[_0x0080('0x35')](_0x5dc131[_0x0080('0x31')],_0x5dc131[_0x0080('0x32')]);_0x30916b[_0x0080('0x36')]=_[_0x0080('0x35')](_0x5dc131[_0x0080('0x31')],qs[_0x0080('0x37')](_0x421bbe[_0x0080('0x32')]['fields']));_0x30916b[_0x0080('0x36')]=_0x30916b[_0x0080('0x36')][_0x0080('0x38')]?_0x30916b[_0x0080('0x36')]:_0x5dc131[_0x0080('0x31')];if(!_0x421bbe[_0x0080('0x32')][_0x0080('0x39')](_0x0080('0x3a'))){_0x30916b[_0x0080('0x20')]=qs['limit'](_0x421bbe['query']['limit']);_0x30916b[_0x0080('0x22')]=qs[_0x0080('0x22')](_0x421bbe['query'][_0x0080('0x22')]);}_0x30916b[_0x0080('0x3b')]=qs[_0x0080('0x3c')](_0x421bbe['query'][_0x0080('0x3c')]);_0x30916b[_0x0080('0x3d')]=qs[_0x0080('0x34')](_['pick'](_0x421bbe[_0x0080('0x32')],_0x5dc131[_0x0080('0x34')]),_0x39aed2);if(_0x421bbe[_0x0080('0x32')][_0x0080('0x3e')]){_0x30916b[_0x0080('0x3d')]=_[_0x0080('0x3f')](_0x30916b['where'],{'$or':_[_0x0080('0x2b')](_0x39aed2,function(_0x25a298){if(_0x25a298[_0x0080('0x2f')]!==_0x0080('0x40')){var _0x472544={};_0x472544[_0x25a298[_0x0080('0x29')]]={'$like':'%'+_0x421bbe['query']['filter']+'%'};return _0x472544;}})});}_0x30916b=_[_0x0080('0x3f')]({},_0x30916b,_0x421bbe[_0x0080('0x41')]);var _0x5d16e4={'where':_0x30916b[_0x0080('0x3d')]};return db[_0x0080('0x2c')][_0x0080('0x21')](_0x5d16e4)[_0x0080('0x26')](function(_0x4bfe04){_0x1f6070['count']=_0x4bfe04;if(_0x421bbe[_0x0080('0x32')][_0x0080('0x42')]){_0x30916b[_0x0080('0x43')]=[{'all':!![]}];}return db[_0x0080('0x2c')][_0x0080('0x44')](_0x30916b);})[_0x0080('0x26')](function(_0x5dcbbe){_0x1f6070[_0x0080('0x45')]=_0x5dcbbe;return _0x1f6070;})['then'](respondWithFilteredResult(_0x339b8c,_0x30916b))[_0x0080('0x46')](handleError(_0x339b8c,null));};exports['show']=function(_0x5c8159,_0x47c3f7){var _0x39557d={'raw':!![],'where':{'id':_0x5c8159[_0x0080('0x47')]['id']}},_0x46f6c3={};_0x46f6c3[_0x0080('0x31')]=_[_0x0080('0x33')](db[_0x0080('0x2c')][_0x0080('0x2d')]);_0x46f6c3['query']=_['keys'](_0x5c8159[_0x0080('0x32')]);_0x46f6c3[_0x0080('0x34')]=_[_0x0080('0x35')](_0x46f6c3['model'],_0x46f6c3['query']);_0x39557d[_0x0080('0x36')]=_[_0x0080('0x35')](_0x46f6c3[_0x0080('0x31')],qs[_0x0080('0x37')](_0x5c8159[_0x0080('0x32')][_0x0080('0x37')]));_0x39557d[_0x0080('0x36')]=_0x39557d[_0x0080('0x36')][_0x0080('0x38')]?_0x39557d[_0x0080('0x36')]:_0x46f6c3[_0x0080('0x31')];if(_0x5c8159[_0x0080('0x32')][_0x0080('0x42')]){_0x39557d[_0x0080('0x43')]=[{'all':!![]}];}_0x39557d=_['merge']({},_0x39557d,_0x5c8159[_0x0080('0x41')]);return db['JscriptySessionReport'][_0x0080('0x48')](_0x39557d)['then'](handleEntityNotFound(_0x47c3f7,null))[_0x0080('0x26')](respondWithResult(_0x47c3f7,null))[_0x0080('0x46')](handleError(_0x47c3f7,null));};exports[_0x0080('0x49')]=function(_0x5c334e,_0x31bca9){return db[_0x0080('0x2c')][_0x0080('0x49')](_0x5c334e[_0x0080('0x4a')],{})[_0x0080('0x26')](respondWithResult(_0x31bca9,0xc9))[_0x0080('0x46')](handleError(_0x31bca9,null));};exports[_0x0080('0x25')]=function(_0x2184c2,_0x54fa68){if(_0x2184c2[_0x0080('0x4a')]['id']){delete _0x2184c2[_0x0080('0x4a')]['id'];}return db[_0x0080('0x2c')][_0x0080('0x48')]({'where':{'id':_0x2184c2[_0x0080('0x47')]['id']}})['then'](handleEntityNotFound(_0x54fa68,null))[_0x0080('0x26')](saveUpdates(_0x2184c2[_0x0080('0x4a')],null))['then'](respondWithResult(_0x54fa68,null))[_0x0080('0x46')](handleError(_0x54fa68,null));};exports[_0x0080('0x27')]=function(_0x25afca,_0x327517){return db['JscriptySessionReport']['find']({'where':{'id':_0x25afca[_0x0080('0x47')]['id']}})[_0x0080('0x26')](handleEntityNotFound(_0x327517,null))[_0x0080('0x26')](removeEntity(_0x327517,null))[_0x0080('0x46')](handleError(_0x327517,null));};exports[_0x0080('0x4b')]=function(_0x323532,_0x157ba5){return db[_0x0080('0x2c')][_0x0080('0x4b')]()[_0x0080('0x26')](respondWithResult(_0x157ba5,null))['catch'](handleError(_0x157ba5,null));};exports[_0x0080('0x4c')]=function(_0xd1cd26,_0x1d3a16,_0x1df019){var _0x18bda2={'raw':!![],'where':{}};var _0x4452ff={};var _0x2c2901={'count':0x0,'rows':[]};return db[_0x0080('0x2c')][_0x0080('0x4d')]({'where':{'id':_0xd1cd26['params']['id']}})[_0x0080('0x26')](handleEntityNotFound(_0x1d3a16,null))['then'](function(_0x19ad5d){if(_0x19ad5d){_0x4452ff[_0x0080('0x31')]=_[_0x0080('0x33')](db['JscriptyQuestionReport'][_0x0080('0x2d')]);_0x4452ff[_0x0080('0x32')]=_[_0x0080('0x33')](_0xd1cd26[_0x0080('0x32')]);_0x4452ff[_0x0080('0x34')]=_[_0x0080('0x35')](_0x4452ff['model'],_0x4452ff[_0x0080('0x32')]);_0x18bda2['attributes']=_[_0x0080('0x35')](_0x4452ff['model'],qs[_0x0080('0x37')](_0xd1cd26[_0x0080('0x32')][_0x0080('0x37')]));_0x18bda2['attributes']=_0x18bda2[_0x0080('0x36')][_0x0080('0x38')]?_0x18bda2[_0x0080('0x36')]:_0x4452ff['model'];if(!_0xd1cd26['query']['hasOwnProperty']('nolimit')){_0x18bda2['limit']=qs['limit'](_0xd1cd26[_0x0080('0x32')]['limit']);_0x18bda2['offset']=qs[_0x0080('0x22')](_0xd1cd26['query']['offset']);}_0x18bda2['order']=qs[_0x0080('0x3c')](_0xd1cd26[_0x0080('0x32')][_0x0080('0x3c')]);_0x18bda2[_0x0080('0x3d')]=qs[_0x0080('0x34')](_[_0x0080('0x4e')](_0xd1cd26['query'],_0x4452ff['filters']));_0x18bda2[_0x0080('0x3d')][_0x0080('0x4f')]=_0x19ad5d['id'];if(_0xd1cd26[_0x0080('0x32')]['filter']){_0x18bda2[_0x0080('0x3d')]=_['merge'](_0x18bda2['where'],{'$or':_[_0x0080('0x2b')](_0x18bda2[_0x0080('0x36')],function(_0x5652f3){var _0x1ed2b1={};_0x1ed2b1[_0x5652f3]={'$like':'%'+_0xd1cd26[_0x0080('0x32')]['filter']+'%'};return _0x1ed2b1;})});}_0x18bda2=_[_0x0080('0x3f')]({},_0x18bda2,_0xd1cd26[_0x0080('0x41')]);return db[_0x0080('0x50')]['count']({'where':_0x18bda2[_0x0080('0x3d')]})[_0x0080('0x26')](function(_0x54943c){_0x2c2901['count']=_0x54943c;if(_0xd1cd26[_0x0080('0x32')]['includeAll']){_0x18bda2['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0080('0x44')](_0x18bda2);})[_0x0080('0x26')](function(_0x3c09d1){_0x2c2901['rows']=_0x3c09d1;return _0x2c2901;});}})['then'](respondWithFilteredResult(_0x1d3a16,_0x18bda2))[_0x0080('0x46')](handleError(_0x1d3a16,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7db8826..2d9d1a2 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 _0x25fa=['path','./jscriptySessionReport.attributes','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x28ddfc,_0x3ea2c8){var _0x51b0d2=function(_0x5ae9db){while(--_0x5ae9db){_0x28ddfc['push'](_0x28ddfc['shift']());}};_0x51b0d2(++_0x3ea2c8);}(_0x25fa,0x109));var _0xa25f=function(_0x2cb485,_0x5629a6){_0x2cb485=_0x2cb485-0x0;var _0x413c00=_0x25fa[_0x2cb485];return _0x413c00;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['report_jscripty_sessions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x4f1957,_0x5bcbdf){var _0x47e845=function(_0x180876){while(--_0x180876){_0x4f1957['push'](_0x4f1957['shift']());}};_0x47e845(++_0x5bcbdf);}(_0x326f,0xd1));var _0xf326=function(_0x1bbf0c,_0x27fb89){_0x1bbf0c=_0x1bbf0c-0x0;var _0x4b20e8=_0x326f[_0x1bbf0c];return _0x4b20e8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index b1df9be..de3b00b 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 _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1352b3,_0x2e6cff){var _0x3b7bbe=function(_0x195c5d){while(--_0x195c5d){_0x1352b3['push'](_0x1352b3['shift']());}};_0x3b7bbe(++_0x2e6cff);}(_0x1883,0xab));var _0x3188=function(_0x4b4e03,_0xa6b616){_0x4b4e03=_0x4b4e03-0x0;var _0xd9f749=_0x1883[_0x4b4e03];return _0xd9f749;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file +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(_0x2a9852,_0x12f8e0){var _0x50edf3=function(_0x3b8cb6){while(--_0x3b8cb6){_0x2a9852['push'](_0x2a9852['shift']());}};_0x50edf3(++_0x12f8e0);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c1a3c,_0xca5ea7){_0x4c1a3c=_0x4c1a3c-0x0;var _0x444263=_0x2ef3[_0x4c1a3c];return _0x444263;};'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 diff --git a/server/api/license/index.js b/server/api/license/index.js index 27d5942..cd4f972 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 _0x5f13=['../../config/environment','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3de36b,_0x2d5f4a){var _0x22b951=function(_0x38143b){while(--_0x38143b){_0x3de36b['push'](_0x3de36b['shift']());}};_0x22b951(++_0x2d5f4a);}(_0x5f13,0xc8));var _0x35f1=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x5f13[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x35f1('0x0'));var util=require(_0x35f1('0x1'));var path=require('path');var timeout=require(_0x35f1('0x2'));var express=require(_0x35f1('0x3'));var router=express[_0x35f1('0x4')]();var fs_extra=require(_0x35f1('0x5'));var auth=require(_0x35f1('0x6'));var interaction=require(_0x35f1('0x7'));var config=require(_0x35f1('0x8'));var controller=require('./license.controller');router[_0x35f1('0x9')]('/',controller[_0x35f1('0xa')]);router[_0x35f1('0xb')]('/:id',auth[_0x35f1('0xc')](),controller[_0x35f1('0xd')]);router[_0x35f1('0x9')](_0x35f1('0xe'),auth[_0x35f1('0xc')](),controller[_0x35f1('0xf')]);module['exports']=router; \ No newline at end of file +var _0x771d=['update','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x537ec5,_0x380dc6){var _0x2667b4=function(_0x46d933){while(--_0x46d933){_0x537ec5['push'](_0x537ec5['shift']());}};_0x2667b4(++_0x380dc6);}(_0x771d,0xdb));var _0xd771=function(_0x36fae1,_0x3e23f7){_0x36fae1=_0x36fae1-0x0;var _0x4b6ce7=_0x771d[_0x36fae1];return _0x4b6ce7;};'use strict';var multer=require(_0xd771('0x0'));var util=require(_0xd771('0x1'));var path=require(_0xd771('0x2'));var timeout=require(_0xd771('0x3'));var express=require(_0xd771('0x4'));var router=express[_0xd771('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd771('0x6'));var interaction=require(_0xd771('0x7'));var config=require(_0xd771('0x8'));var controller=require(_0xd771('0x9'));router[_0xd771('0xa')]('/',controller[_0xd771('0xb')]);router[_0xd771('0xc')](_0xd771('0xd'),auth[_0xd771('0xe')](),controller[_0xd771('0xf')]);router[_0xd771('0xa')]('/download_log_file',auth['isAuthenticated'](),controller[_0xd771('0x10')]);module[_0xd771('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6c971b0..e282de6 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 _0x7867=['exports','TEXT','INTEGER','sequelize'];(function(_0x493057,_0x44d38b){var _0x3c8f43=function(_0x54d91a){while(--_0x54d91a){_0x493057['push'](_0x493057['shift']());}};_0x3c8f43(++_0x44d38b);}(_0x7867,0x1af));var _0x7786=function(_0x327583,_0x13cdee){_0x327583=_0x327583-0x0;var _0xd12a24=_0x7867[_0x327583];return _0xd12a24;};'use strict';var Sequelize=require(_0x7786('0x0'));module[_0x7786('0x1')]={'license':{'type':Sequelize[_0x7786('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x7786('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0359=['TEXT','STRING','INTEGER','sequelize'];(function(_0x404ad2,_0x42f399){var _0x34c9a2=function(_0x514172){while(--_0x514172){_0x404ad2['push'](_0x404ad2['shift']());}};_0x34c9a2(++_0x42f399);}(_0x0359,0xff));var _0x9035=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0359[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0x9035('0x0'));module['exports']={'license':{'type':Sequelize[_0x9035('0x1')]},'data1':{'type':Sequelize[_0x9035('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x9035('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 ce90e94..2f39d71 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 _0xa547=['path','sox','fs-extra','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','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','sendStatus','error','name','send','index','model','keys','License','query','filters','intersection','fields','attributes','length','merge','options','getLicense','body','find','get','checkLicense','key','catch','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xa547,0x152));var _0x7a54=function(_0x4723c9,_0x45640e){_0x4723c9=_0x4723c9-0x0;var _0x470544=_0xa547[_0x4723c9];return _0x470544;};'use strict';var emlformat=require(_0x7a54('0x0'));var rimraf=require(_0x7a54('0x1'));var zipdir=require(_0x7a54('0x2'));var jsonpatch=require(_0x7a54('0x3'));var rp=require('request-promise');var moment=require(_0x7a54('0x4'));var BPromise=require(_0x7a54('0x5'));var Mustache=require(_0x7a54('0x6'));var util=require('util');var path=require(_0x7a54('0x7'));var sox=require(_0x7a54('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a54('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7a54('0xa'));var jsforce=require(_0x7a54('0xb'));var deskjs=require(_0x7a54('0xc'));var toCsv=require(_0x7a54('0xd'));var querystring=require(_0x7a54('0xe'));var Papa=require(_0x7a54('0xf'));var Redis=require(_0x7a54('0x10'));var authService=require(_0x7a54('0x11'));var qs=require(_0x7a54('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a54('0x13'));var logger=require(_0x7a54('0x14'))(_0x7a54('0x15'));var utils=require(_0x7a54('0x16'));var config=require(_0x7a54('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a54('0x18'))['db'];function respondWithStatusCode(_0x36ba5b,_0x53bccd){_0x53bccd=_0x53bccd||0xcc;return function(_0x3a4d2b){if(_0x3a4d2b){return _0x36ba5b['sendStatus'](_0x53bccd);}return _0x36ba5b['status'](_0x53bccd)[_0x7a54('0x19')]();};}function respondWithResult(_0x1264be,_0x502b66){_0x502b66=_0x502b66||0xc8;return function(_0x256886){if(_0x256886){return _0x1264be[_0x7a54('0x1a')](_0x502b66)[_0x7a54('0x1b')](_0x256886);}};}function respondWithFilteredResult(_0x28e173,_0x59cd73){return function(_0x433ee3){if(_0x433ee3){var _0x350b22=typeof _0x59cd73['offset']===_0x7a54('0x1c')&&typeof _0x59cd73[_0x7a54('0x1d')]===_0x7a54('0x1c');var _0x197608=_0x433ee3[_0x7a54('0x1e')];var _0x24c064=_0x350b22?0x0:_0x59cd73[_0x7a54('0x1f')];var _0x590916=_0x350b22?_0x433ee3[_0x7a54('0x1e')]:_0x59cd73[_0x7a54('0x1f')]+_0x59cd73['limit'];var _0x5ec558;if(_0x590916>=_0x197608){_0x590916=_0x197608;_0x5ec558=0xc8;}else{_0x5ec558=0xce;}_0x28e173['status'](_0x5ec558);return _0x28e173[_0x7a54('0x20')](_0x7a54('0x21'),_0x24c064+'-'+_0x590916+'/'+_0x197608)[_0x7a54('0x1b')](_0x433ee3);}return null;};}function patchUpdates(_0x37f21f){return function(_0x14de39){try{jsonpatch[_0x7a54('0x22')](_0x14de39,_0x37f21f,!![]);}catch(_0x1eba9c){return BPromise['reject'](_0x1eba9c);}return _0x14de39['save']();};}function saveUpdates(_0x3f1c32,_0x3a2f77){return function(_0x41284c){if(_0x41284c){return _0x41284c[_0x7a54('0x23')](_0x3f1c32)[_0x7a54('0x24')](function(_0x316b85){return _0x316b85;});}return null;};}function removeEntity(_0x561a2f,_0x50c490){return function(_0x1d8987){if(_0x1d8987){return _0x1d8987['destroy']()[_0x7a54('0x24')](function(){_0x561a2f[_0x7a54('0x1a')](0xcc)[_0x7a54('0x19')]();});}};}function handleEntityNotFound(_0x2ab1f5,_0x451cd5){return function(_0x10f6be){if(!_0x10f6be){_0x2ab1f5[_0x7a54('0x25')](0x194);}return _0x10f6be;};}function handleError(_0x32e7c3,_0x327608){_0x327608=_0x327608||0x1f4;return function(_0x13a139){logger[_0x7a54('0x26')](_0x13a139['stack']);if(_0x13a139[_0x7a54('0x27')]){delete _0x13a139[_0x7a54('0x27')];}_0x32e7c3[_0x7a54('0x1a')](_0x327608)[_0x7a54('0x28')](_0x13a139);};}var utilLicense=require('../../config/license/util');exports[_0x7a54('0x29')]=function(_0x14fa55,_0x2bd114){var _0x267279={'raw':!![],'where':{'id':0x1}},_0x542efd={};_0x542efd[_0x7a54('0x2a')]=_[_0x7a54('0x2b')](db[_0x7a54('0x2c')]['rawAttributes']);_0x542efd['query']=_[_0x7a54('0x2b')](_0x14fa55[_0x7a54('0x2d')]);_0x542efd[_0x7a54('0x2e')]=_[_0x7a54('0x2f')](_0x542efd['model'],_0x542efd[_0x7a54('0x2d')]);_0x267279['attributes']=_['intersection'](_0x542efd[_0x7a54('0x2a')],qs[_0x7a54('0x30')](_0x14fa55['query'][_0x7a54('0x30')]));_0x267279[_0x7a54('0x31')]=_0x267279[_0x7a54('0x31')][_0x7a54('0x32')]?_0x267279[_0x7a54('0x31')]:_0x542efd[_0x7a54('0x2a')];_0x267279=_[_0x7a54('0x33')]({},_0x267279,_0x14fa55[_0x7a54('0x34')]);return utilLicense[_0x7a54('0x35')](_0x267279)[_0x7a54('0x24')](respondWithResult(_0x2bd114,null))['catch'](handleError(_0x2bd114,null));};exports[_0x7a54('0x23')]=function(_0xb65a99,_0x30137d){if(_0xb65a99[_0x7a54('0x36')]['id']){delete _0xb65a99[_0x7a54('0x36')]['id'];}return db[_0x7a54('0x2c')][_0x7a54('0x37')]({'where':{'id':_0xb65a99['params']['id']}})[_0x7a54('0x24')](handleEntityNotFound(_0x30137d,null))[_0x7a54('0x24')](function(_0x49972f){var _0x2250ab=_0x49972f[_0x7a54('0x38')]({'plain':!![]});return utilLicense[_0x7a54('0x39')](_0x2250ab,_0xb65a99[_0x7a54('0x36')][_0x7a54('0x3a')]);})['then'](function(_0x1b5c89){if(!_0x1b5c89['demo']){return saveUpdates(_0xb65a99[_0x7a54('0x36')],null);}return _0x1b5c89;})[_0x7a54('0x24')](respondWithResult(_0x30137d,null))[_0x7a54('0x3b')](handleError(_0x30137d,null));};exports[_0x7a54('0x3c')]=function(_0x841e21,_0x1be4de){var _0x2cd190='license-info.log';var _0x379183=path[_0x7a54('0x3d')](_0x7a54('0x3e'),_0x7a54('0x3f'),_0x7a54('0x40'),_0x2cd190);_0x1be4de[_0x7a54('0x41')](_0x7a54('0x42'),_0x7a54('0x43')+_0x2cd190);_0x1be4de['set']('Content-Type',_0x7a54('0x44'));_0x1be4de['download'](_0x379183);}; \ No newline at end of file +var _0x171a=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','count','set','apply','reject','update','then','destroy','error','stack','name','model','keys','rawAttributes','query','filters','attributes','intersection','fields','merge','options','getLicense','catch','body','get','checkLicense','demo','downloadLogFile','license-info.log','join','/var','log','xcally','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','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/license/hardware','../../config/logger','api'];(function(_0x10af80,_0x5c9c36){var _0x362586=function(_0x23b1b1){while(--_0x23b1b1){_0x10af80['push'](_0x10af80['shift']());}};_0x362586(++_0x5c9c36);}(_0x171a,0x1c4));var _0xa171=function(_0x362256,_0x4f8638){_0x362256=_0x362256-0x0;var _0xfa7997=_0x171a[_0x362256];return _0xfa7997;};'use strict';var emlformat=require(_0xa171('0x0'));var rimraf=require(_0xa171('0x1'));var zipdir=require(_0xa171('0x2'));var jsonpatch=require(_0xa171('0x3'));var rp=require('request-promise');var moment=require(_0xa171('0x4'));var BPromise=require(_0xa171('0x5'));var Mustache=require('mustache');var util=require(_0xa171('0x6'));var path=require(_0xa171('0x7'));var sox=require('sox');var csv=require(_0xa171('0x8'));var ejs=require(_0xa171('0x9'));var fs=require('fs');var fs_extra=require(_0xa171('0xa'));var _=require('lodash');var squel=require(_0xa171('0xb'));var crypto=require(_0xa171('0xc'));var jsforce=require(_0xa171('0xd'));var deskjs=require(_0xa171('0xe'));var toCsv=require(_0xa171('0x8'));var querystring=require(_0xa171('0xf'));var Papa=require(_0xa171('0x10'));var Redis=require(_0xa171('0x11'));var authService=require(_0xa171('0x12'));var qs=require(_0xa171('0x13'));var as=require(_0xa171('0x14'));var hardwareService=require(_0xa171('0x15'));var logger=require(_0xa171('0x16'))(_0xa171('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa171('0x18'));var db=require(_0xa171('0x19'))['db'];function respondWithStatusCode(_0x563246,_0x52b72b){_0x52b72b=_0x52b72b||0xcc;return function(_0x2fbdb4){if(_0x2fbdb4){return _0x563246[_0xa171('0x1a')](_0x52b72b);}return _0x563246[_0xa171('0x1b')](_0x52b72b)[_0xa171('0x1c')]();};}function respondWithResult(_0x2cdf35,_0xb2fcc2){_0xb2fcc2=_0xb2fcc2||0xc8;return function(_0x281a3b){if(_0x281a3b){return _0x2cdf35[_0xa171('0x1b')](_0xb2fcc2)[_0xa171('0x1d')](_0x281a3b);}};}function respondWithFilteredResult(_0x4cebd5,_0x44a902){return function(_0x51ffe3){if(_0x51ffe3){var _0x15c8ed=typeof _0x44a902['offset']==='undefined'&&typeof _0x44a902[_0xa171('0x1e')]==='undefined';var _0xd903fa=_0x51ffe3['count'];var _0x26bd75=_0x15c8ed?0x0:_0x44a902[_0xa171('0x1f')];var _0x3a561f=_0x15c8ed?_0x51ffe3[_0xa171('0x20')]:_0x44a902[_0xa171('0x1f')]+_0x44a902[_0xa171('0x1e')];var _0x781f50;if(_0x3a561f>=_0xd903fa){_0x3a561f=_0xd903fa;_0x781f50=0xc8;}else{_0x781f50=0xce;}_0x4cebd5[_0xa171('0x1b')](_0x781f50);return _0x4cebd5[_0xa171('0x21')]('Content-Range',_0x26bd75+'-'+_0x3a561f+'/'+_0xd903fa)[_0xa171('0x1d')](_0x51ffe3);}return null;};}function patchUpdates(_0x2aa458){return function(_0x27cab7){try{jsonpatch[_0xa171('0x22')](_0x27cab7,_0x2aa458,!![]);}catch(_0x29af50){return BPromise[_0xa171('0x23')](_0x29af50);}return _0x27cab7['save']();};}function saveUpdates(_0x1d6223,_0x10305a){return function(_0x40d5d3){if(_0x40d5d3){return _0x40d5d3[_0xa171('0x24')](_0x1d6223)[_0xa171('0x25')](function(_0x5a1491){return _0x5a1491;});}return null;};}function removeEntity(_0x2d0aea,_0x10713c){return function(_0x29283f){if(_0x29283f){return _0x29283f[_0xa171('0x26')]()[_0xa171('0x25')](function(){_0x2d0aea[_0xa171('0x1b')](0xcc)[_0xa171('0x1c')]();});}};}function handleEntityNotFound(_0x3998b2,_0xba8519){return function(_0x3ed01e){if(!_0x3ed01e){_0x3998b2[_0xa171('0x1a')](0x194);}return _0x3ed01e;};}function handleError(_0x521c99,_0xb84895){_0xb84895=_0xb84895||0x1f4;return function(_0x9b6a72){logger[_0xa171('0x27')](_0x9b6a72[_0xa171('0x28')]);if(_0x9b6a72['name']){delete _0x9b6a72[_0xa171('0x29')];}_0x521c99[_0xa171('0x1b')](_0xb84895)['send'](_0x9b6a72);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x1dbadb,_0x3e9560){var _0x2dc7b0={'raw':!![],'where':{'id':0x1}},_0x5c7df7={};_0x5c7df7[_0xa171('0x2a')]=_[_0xa171('0x2b')](db['License'][_0xa171('0x2c')]);_0x5c7df7['query']=_['keys'](_0x1dbadb[_0xa171('0x2d')]);_0x5c7df7[_0xa171('0x2e')]=_['intersection'](_0x5c7df7[_0xa171('0x2a')],_0x5c7df7['query']);_0x2dc7b0[_0xa171('0x2f')]=_[_0xa171('0x30')](_0x5c7df7[_0xa171('0x2a')],qs[_0xa171('0x31')](_0x1dbadb['query'][_0xa171('0x31')]));_0x2dc7b0['attributes']=_0x2dc7b0['attributes']['length']?_0x2dc7b0[_0xa171('0x2f')]:_0x5c7df7[_0xa171('0x2a')];_0x2dc7b0=_[_0xa171('0x32')]({},_0x2dc7b0,_0x1dbadb[_0xa171('0x33')]);return utilLicense[_0xa171('0x34')](_0x2dc7b0)['then'](respondWithResult(_0x3e9560,null))[_0xa171('0x35')](handleError(_0x3e9560,null));};exports['update']=function(_0x16eee7,_0x15ab93){if(_0x16eee7[_0xa171('0x36')]['id']){delete _0x16eee7[_0xa171('0x36')]['id'];}return db['License']['find']({'where':{'id':_0x16eee7['params']['id']}})[_0xa171('0x25')](handleEntityNotFound(_0x15ab93,null))[_0xa171('0x25')](function(_0x22cd33){var _0x150ea4=_0x22cd33[_0xa171('0x37')]({'plain':!![]});return utilLicense[_0xa171('0x38')](_0x150ea4,_0x16eee7['body']['key']);})[_0xa171('0x25')](function(_0x34c756){if(!_0x34c756[_0xa171('0x39')]){return saveUpdates(_0x16eee7['body'],null);}return _0x34c756;})[_0xa171('0x25')](respondWithResult(_0x15ab93,null))['catch'](handleError(_0x15ab93,null));};exports[_0xa171('0x3a')]=function(_0xc00001,_0x4e7f03){var _0x362b81=_0xa171('0x3b');var _0x3322fd=path[_0xa171('0x3c')](_0xa171('0x3d'),_0xa171('0x3e'),_0xa171('0x3f'),_0x362b81);_0x4e7f03['setHeader']('Content-disposition',_0xa171('0x40')+_0x362b81);_0x4e7f03[_0xa171('0x21')](_0xa171('0x41'),_0xa171('0x42'));_0x4e7f03[_0xa171('0x43')](_0x3322fd);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 546428b..2bccf71 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 _0x9656=['bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','License','util','../../config/logger','api','moment'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x9656,0x125));var _0x6965=function(_0x46c62c,_0x47602b){_0x46c62c=_0x46c62c-0x0;var _0x550977=_0x9656[_0x46c62c];return _0x550977;};'use strict';var _=require('lodash');var util=require(_0x6965('0x0'));var logger=require(_0x6965('0x1'))(_0x6965('0x2'));var moment=require(_0x6965('0x3'));var BPromise=require(_0x6965('0x4'));var rp=require(_0x6965('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6965('0x6'));var config=require(_0x6965('0x7'));var attributes=require(_0x6965('0x8'));module[_0x6965('0x9')]=function(_0x112642,_0x8d315a){return _0x112642['define'](_0x6965('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfffc=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x34dc5d,_0x351b12){var _0x3f5ab1=function(_0x35c52b){while(--_0x35c52b){_0x34dc5d['push'](_0x34dc5d['shift']());}};_0x3f5ab1(++_0x351b12);}(_0xfffc,0x1c6));var _0xcfff=function(_0x589e62,_0x31bef7){_0x589e62=_0x589e62-0x0;var _0x36f8d9=_0xfffc[_0x589e62];return _0x36f8d9;};'use strict';var _=require(_0xcfff('0x0'));var util=require(_0xcfff('0x1'));var logger=require(_0xcfff('0x2'))(_0xcfff('0x3'));var moment=require(_0xcfff('0x4'));var BPromise=require(_0xcfff('0x5'));var rp=require(_0xcfff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfff('0x7'));var config=require(_0xcfff('0x8'));var attributes=require(_0xcfff('0x9'));module[_0xcfff('0xa')]=function(_0x23ee4d,_0x415641){return _0x23ee4d[_0xcfff('0xb')](_0xcfff('0xc'),attributes,{'tableName':_0xcfff('0xd'),'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 5608525..126c8d4 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 _0x3e91=['stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s'];(function(_0x19ce38,_0x5c9cb8){var _0x27e1b6=function(_0xc0dfa){while(--_0xc0dfa){_0x19ce38['push'](_0x19ce38['shift']());}};_0x27e1b6(++_0x5c9cb8);}(_0x3e91,0xc7));var _0x13e9=function(_0x31210e,_0x1785ff){_0x31210e=_0x31210e-0x0;var _0x2167db=_0x3e91[_0x31210e];return _0x2167db;};'use strict';var _=require(_0x13e9('0x0'));var util=require(_0x13e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x13e9('0x2'));var fs=require('fs');var Redis=require(_0x13e9('0x3'));var db=require(_0x13e9('0x4'))['db'];var utils=require(_0x13e9('0x5'));var logger=require(_0x13e9('0x6'))(_0x13e9('0x7'));var config=require(_0x13e9('0x8'));var jayson=require(_0x13e9('0x9'));var client=jayson[_0x13e9('0xa')][_0x13e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x986cf7,_0x4a8222,_0x36bab7){return new BPromise(function(_0x1eadd6,_0x18e9c9){return client[_0x13e9('0xc')](_0x986cf7,_0x36bab7)[_0x13e9('0xd')](function(_0x511abe){logger['info'](_0x13e9('0xe'),_0x4a8222,_0x13e9('0xf'));logger['debug'](_0x13e9('0x10'),_0x4a8222,_0x13e9('0xf'),JSON[_0x13e9('0x11')](_0x511abe));if(_0x511abe[_0x13e9('0x12')]){if(_0x511abe[_0x13e9('0x12')][_0x13e9('0x13')]===0x1f4){logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x511abe[_0x13e9('0x12')]['message']);return _0x18e9c9(_0x511abe['error']['message']);}logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x511abe[_0x13e9('0x12')][_0x13e9('0x14')]);return _0x1eadd6(_0x511abe[_0x13e9('0x12')][_0x13e9('0x14')]);}else{logger[_0x13e9('0x15')]('License,\x20%s,\x20%s',_0x4a8222,'request\x20sent');_0x1eadd6(_0x511abe[_0x13e9('0x16')][_0x13e9('0x14')]);}})[_0x13e9('0x17')](function(_0x445149){logger[_0x13e9('0x12')](_0x13e9('0xe'),_0x4a8222,_0x445149);_0x18e9c9(_0x445149);});});} \ No newline at end of file +var _0xc366=['info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','error','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0xbdd5f0,_0x383fea){var _0x457f64=function(_0x10dd01){while(--_0x10dd01){_0xbdd5f0['push'](_0xbdd5f0['shift']());}};_0x457f64(++_0x383fea);}(_0xc366,0x195));var _0x6c36=function(_0x338ad7,_0x1b4ed0){_0x338ad7=_0x338ad7-0x0;var _0xb5e8b7=_0xc366[_0x338ad7];return _0xb5e8b7;};'use strict';var _=require(_0x6c36('0x0'));var util=require(_0x6c36('0x1'));var moment=require(_0x6c36('0x2'));var BPromise=require(_0x6c36('0x3'));var rs=require(_0x6c36('0x4'));var fs=require('fs');var Redis=require(_0x6c36('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c36('0x6'));var logger=require(_0x6c36('0x7'))(_0x6c36('0x8'));var config=require('../../config/environment');var jayson=require(_0x6c36('0x9'));var client=jayson[_0x6c36('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x150bd6,_0x403ca3,_0x571425){return new BPromise(function(_0x4994a3,_0x1e7503){return client[_0x6c36('0xb')](_0x150bd6,_0x571425)[_0x6c36('0xc')](function(_0x11f746){logger[_0x6c36('0xd')]('License,\x20%s,\x20%s',_0x403ca3,'request\x20sent');logger[_0x6c36('0xe')](_0x6c36('0xf'),_0x403ca3,_0x6c36('0x10'),JSON['stringify'](_0x11f746));if(_0x11f746[_0x6c36('0x11')]){if(_0x11f746[_0x6c36('0x11')]['code']===0x1f4){logger[_0x6c36('0x11')]('License,\x20%s,\x20%s',_0x403ca3,_0x11f746['error']['message']);return _0x1e7503(_0x11f746[_0x6c36('0x11')]['message']);}logger['error'](_0x6c36('0x12'),_0x403ca3,_0x11f746[_0x6c36('0x11')][_0x6c36('0x13')]);return _0x4994a3(_0x11f746[_0x6c36('0x11')]['message']);}else{logger[_0x6c36('0xd')](_0x6c36('0x12'),_0x403ca3,_0x6c36('0x10'));_0x4994a3(_0x11f746[_0x6c36('0x14')][_0x6c36('0x13')]);}})[_0x6c36('0x15')](function(_0x4ad3eb){logger[_0x6c36('0x11')](_0x6c36('0x12'),_0x403ca3,_0x4ad3eb);_0x1e7503(_0x4ad3eb);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d843ac1..6050a0d 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 _0xdef4=['getMessages','/:id/verify','verifySmtp','getAgents','/:id/canned_answers','addAnswer','post','create','/:id/in_servers','addImap','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','update','removeDispositions','delete','removeSmtp','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications'];(function(_0x36c14e,_0x262ade){var _0xb27b23=function(_0xe7ef0b){while(--_0xe7ef0b){_0x36c14e['push'](_0x36c14e['shift']());}};_0xb27b23(++_0x262ade);}(_0xdef4,0x1c7));var _0x4def=function(_0x37dc21,_0x2bae86){_0x37dc21=_0x37dc21-0x0;var _0x34dc9e=_0xdef4[_0x37dc21];return _0x34dc9e;};'use strict';var multer=require(_0x4def('0x0'));var util=require('util');var path=require(_0x4def('0x1'));var timeout=require(_0x4def('0x2'));var express=require('express');var router=express[_0x4def('0x3')]();var fs_extra=require(_0x4def('0x4'));var auth=require(_0x4def('0x5'));var interaction=require(_0x4def('0x6'));var config=require(_0x4def('0x7'));var controller=require(_0x4def('0x8'));router[_0x4def('0x9')]('/',auth[_0x4def('0xa')](),controller[_0x4def('0xb')]);router[_0x4def('0x9')](_0x4def('0xc'),auth[_0x4def('0xa')](),controller[_0x4def('0xd')]);router[_0x4def('0x9')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller[_0x4def('0xf')]);router[_0x4def('0x9')](_0x4def('0x10'),auth[_0x4def('0xa')](),controller[_0x4def('0x11')]);router[_0x4def('0x9')]('/:id/canned_answers',auth[_0x4def('0xa')](),controller[_0x4def('0x12')]);router['get']('/:id/in_servers',auth[_0x4def('0xa')](),controller[_0x4def('0x13')]);router[_0x4def('0x9')](_0x4def('0x14'),auth['isAuthenticated'](),controller[_0x4def('0x15')]);router[_0x4def('0x9')](_0x4def('0x16'),auth['isAuthenticated'](),controller[_0x4def('0x17')]);router[_0x4def('0x9')](_0x4def('0x18'),auth['isAuthenticated'](),controller['getApplications']);router['get']('/:id/messages',auth[_0x4def('0xa')](),controller[_0x4def('0x19')]);router[_0x4def('0x9')](_0x4def('0x1a'),auth[_0x4def('0xa')](),controller[_0x4def('0x1b')]);router[_0x4def('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x4def('0x1c')]);router['post'](_0x4def('0x10'),auth[_0x4def('0xa')](),controller['addDisposition']);router['post'](_0x4def('0x1d'),auth[_0x4def('0xa')](),controller[_0x4def('0x1e')]);router[_0x4def('0x1f')]('/',auth[_0x4def('0xa')](),controller[_0x4def('0x20')]);router['post'](_0x4def('0x21'),auth[_0x4def('0xa')](),controller[_0x4def('0x22')]);router['post'](_0x4def('0x14'),auth[_0x4def('0xa')](),controller[_0x4def('0x23')]);router[_0x4def('0x1f')](_0x4def('0x16'),auth[_0x4def('0xa')](),controller[_0x4def('0x24')]);router[_0x4def('0x1f')](_0x4def('0x18'),auth[_0x4def('0xa')](),controller[_0x4def('0x25')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x4def('0x26')]);router[_0x4def('0x1f')](_0x4def('0x27'),auth[_0x4def('0xa')](),controller[_0x4def('0x28')]);router[_0x4def('0x29')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller[_0x4def('0x2a')]);router['delete'](_0x4def('0x10'),auth[_0x4def('0xa')](),controller[_0x4def('0x2b')]);router['delete'](_0x4def('0x1d'),auth[_0x4def('0xa')](),controller['removeAnswers']);router[_0x4def('0x2c')](_0x4def('0x21'),auth[_0x4def('0xa')](),controller['removeImap']);router['delete'](_0x4def('0x14'),auth[_0x4def('0xa')](),controller[_0x4def('0x2d')]);router[_0x4def('0x2c')](_0x4def('0xe'),auth[_0x4def('0xa')](),controller['destroy']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x4def('0x2e')]);module[_0x4def('0x2f')]=router; \ No newline at end of file +var _0x9daf=['getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','addDisposition','post','addAnswer','/:id/in_servers','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeAnswers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions'];(function(_0x34959e,_0x16aee7){var _0x34f922=function(_0x5e1eac){while(--_0x5e1eac){_0x34959e['push'](_0x34959e['shift']());}};_0x34f922(++_0x16aee7);}(_0x9daf,0x1e1));var _0xf9da=function(_0x113566,_0x78c52a){_0x113566=_0x113566-0x0;var _0x359407=_0x9daf[_0x113566];return _0x359407;};'use strict';var multer=require('multer');var util=require(_0xf9da('0x0'));var path=require(_0xf9da('0x1'));var timeout=require(_0xf9da('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf9da('0x3'));var auth=require(_0xf9da('0x4'));var interaction=require(_0xf9da('0x5'));var config=require(_0xf9da('0x6'));var controller=require(_0xf9da('0x7'));router[_0xf9da('0x8')]('/',auth[_0xf9da('0x9')](),controller['index']);router[_0xf9da('0x8')](_0xf9da('0xa'),auth[_0xf9da('0x9')](),controller[_0xf9da('0xb')]);router[_0xf9da('0x8')](_0xf9da('0xc'),auth[_0xf9da('0x9')](),controller['show']);router[_0xf9da('0x8')](_0xf9da('0xd'),auth[_0xf9da('0x9')](),controller[_0xf9da('0xe')]);router['get'](_0xf9da('0xf'),auth['isAuthenticated'](),controller[_0xf9da('0x10')]);router[_0xf9da('0x8')]('/:id/in_servers',auth[_0xf9da('0x9')](),controller['getImap']);router[_0xf9da('0x8')](_0xf9da('0x11'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x12')]);router[_0xf9da('0x8')]('/:id/interactions',auth[_0xf9da('0x9')](),controller[_0xf9da('0x13')]);router[_0xf9da('0x8')](_0xf9da('0x14'),auth[_0xf9da('0x9')](),controller['getApplications']);router['get'](_0xf9da('0x15'),auth['isAuthenticated'](),controller[_0xf9da('0x16')]);router[_0xf9da('0x8')](_0xf9da('0x17'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x18')]);router[_0xf9da('0x8')]('/:id/users',auth[_0xf9da('0x9')](),controller[_0xf9da('0x19')]);router['post'](_0xf9da('0xd'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x1a')]);router[_0xf9da('0x1b')](_0xf9da('0xf'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x1c')]);router[_0xf9da('0x1b')]('/',auth[_0xf9da('0x9')](),controller['create']);router[_0xf9da('0x1b')](_0xf9da('0x1d'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x1e')]);router[_0xf9da('0x1b')](_0xf9da('0x11'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x1f')]);router[_0xf9da('0x1b')](_0xf9da('0x20'),auth['isAuthenticated'](),controller[_0xf9da('0x21')]);router['post'](_0xf9da('0x14'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x22')]);router[_0xf9da('0x1b')](_0xf9da('0x23'),auth['isAuthenticated'](),controller['send']);router['post']('/:id/users',auth[_0xf9da('0x9')](),controller[_0xf9da('0x24')]);router[_0xf9da('0x25')](_0xf9da('0xc'),auth[_0xf9da('0x9')](),controller['update']);router[_0xf9da('0x26')](_0xf9da('0xd'),auth[_0xf9da('0x9')](),controller['removeDispositions']);router[_0xf9da('0x26')](_0xf9da('0xf'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x27')]);router[_0xf9da('0x26')](_0xf9da('0x1d'),auth['isAuthenticated'](),controller[_0xf9da('0x28')]);router[_0xf9da('0x26')]('/:id/out_servers',auth[_0xf9da('0x9')](),controller[_0xf9da('0x29')]);router[_0xf9da('0x26')](_0xf9da('0xc'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x2a')]);router[_0xf9da('0x26')](_0xf9da('0x2b'),auth[_0xf9da('0x9')](),controller[_0xf9da('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 905b08c..fe578eb 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 _0xd24b=['getDataValue','setDataValue','exports','STRING','TEXT','BOOLEAN','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','ENUM','gmail','provider','custom'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd24b,0x102));var _0xbd24=function(_0x349b6b,_0x595aa7){_0x349b6b=_0x349b6b-0x0;var _0x4b7e57=_0xd24b[_0x349b6b];return _0x4b7e57;};'use strict';var Sequelize=require('sequelize');module[_0xbd24('0x0')]={'description':{'type':Sequelize[_0xbd24('0x1')]},'name':{'type':Sequelize[_0xbd24('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xbd24('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xbd24('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xbd24('0x2')]},'markAsUnread':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xbd24('0x4')](0x2)[_0xbd24('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbd24('0x2')],'defaultValue':function(){return _0xbd24('0x6');}},'notificationSound':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbd24('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'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['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbd24('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xbd24('0x3')],'defaultValue':![],'comment':_0xbd24('0x8'),'set':function(_0x2aadc6){if(!_0x2aadc6)this['setDataValue'](_0xbd24('0x9'),null);this['setDataValue']('mandatoryDisposition',_0x2aadc6);}},'provider':{'type':Sequelize[_0xbd24('0xa')](_0xbd24('0xb'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0xbd24('0xc')))return _0xbd24('0xd');return this[_0xbd24('0xe')](_0xbd24('0xc'));},'set':function(_0x4cd705){if(_0x4cd705===_0xbd24('0xd'))_0x4cd705=null;return this[_0xbd24('0xf')]('provider',_0x4cd705);}}}; \ No newline at end of file +var _0x6be7=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0xb84795,_0x199305){var _0x1ee336=function(_0x3c074e){while(--_0x3c074e){_0xb84795['push'](_0xb84795['shift']());}};_0x1ee336(++_0x199305);}(_0x6be7,0x124));var _0x76be=function(_0x3c0fb0,_0x383e6b){_0x3c0fb0=_0x3c0fb0-0x0;var _0x28c4b2=_0x6be7[_0x3c0fb0];return _0x28c4b2;};'use strict';var Sequelize=require(_0x76be('0x0'));module[_0x76be('0x1')]={'description':{'type':Sequelize[_0x76be('0x2')]},'name':{'type':Sequelize[_0x76be('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x76be('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x76be('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x76be('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x76be('0x4')]},'markAsUnread':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x76be('0x2')],'allowNull':![],'defaultValue':_0x76be('0x5')},'fontSize':{'type':Sequelize[_0x76be('0x6')](0x2)[_0x76be('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x76be('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x76be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x76be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x76be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x76be('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x76be('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x76be('0x3')],'defaultValue':![],'comment':_0x76be('0x9'),'set':function(_0xd49e8f){if(!_0xd49e8f)this[_0x76be('0xa')](_0x76be('0xb'),null);this[_0x76be('0xa')](_0x76be('0xc'),_0xd49e8f);}},'provider':{'type':Sequelize[_0x76be('0xd')](_0x76be('0xe'),'hotmail',_0x76be('0xf'),_0x76be('0x10')),'defaultValue':null,'get':function(){if(!this[_0x76be('0x11')]('provider'))return _0x76be('0x12');return this[_0x76be('0x11')]('provider');},'set':function(_0x5041f9){if(_0x5041f9===_0x76be('0x12'))_0x5041f9=null;return this['setDataValue'](_0x76be('0x13'),_0x5041f9);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 34c2f36..05de26e 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 _0xe132=['set','json','then','destroy','get','MailAccounts','stack','name','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','user','password','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','MailAccount','include','findAll','rows','show','params','MailServerOut','update','body','provider','custom','find','Mail\x20Account\x20not\x20found','describe','MailAccountId','create','getDispositions','findOne','Disposition','order','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','internal','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','Contacts','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','User','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','redis','defaults','localhost','register','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x455150,_0x274121){var _0x12ca9c=function(_0x47eb22){while(--_0x47eb22){_0x455150['push'](_0x455150['shift']());}};_0x12ca9c(++_0x274121);}(_0xe132,0x167));var _0x2e13=function(_0x3ed741,_0x7aa5b){_0x3ed741=_0x3ed741-0x0;var _0x1144ab=_0xe132[_0x3ed741];return _0x1144ab;};'use strict';var moment=require(_0x2e13('0x0'));var BPromise=require(_0x2e13('0x1'));var util=require(_0x2e13('0x2'));var path=require(_0x2e13('0x3'));var _=require(_0x2e13('0x4'));var juice=require(_0x2e13('0x5'));var Redis=require(_0x2e13('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2e13('0x7'));var config=require(_0x2e13('0x8'));var db=require('../../mysqldb')['db'];config[_0x2e13('0x9')]=_[_0x2e13('0xa')](config[_0x2e13('0x9')],{'host':_0x2e13('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e13('0x9')]));require('./mailAccount.socket')[_0x2e13('0xc')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2e13('0xd')][_0x2e13('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x26bf56,_0x5dd0d5,_0x386159,_0x3c8bc9){return new BPromise(function(_0x54596b,_0x1bd8cb){var _0x4f422f=_0x3c8bc9||client;return _0x4f422f[_0x2e13('0xf')](_0x26bf56,_0x386159)['then'](function(_0x318452){logger[_0x2e13('0x10')](_0x2e13('0x11'),_0x5dd0d5,_0x2e13('0x12'));logger[_0x2e13('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5dd0d5,_0x2e13('0x12'),JSON[_0x2e13('0x14')](_0x318452));if(_0x318452['error']){if(_0x318452[_0x2e13('0x15')][_0x2e13('0x16')]===0x1f4){logger['error'](_0x2e13('0x11'),_0x5dd0d5,_0x318452[_0x2e13('0x15')][_0x2e13('0x17')]);return _0x1bd8cb(_0x318452['error'][_0x2e13('0x17')]);}logger[_0x2e13('0x15')](_0x2e13('0x11'),_0x5dd0d5,_0x318452[_0x2e13('0x15')][_0x2e13('0x17')]);return _0x54596b(_0x318452[_0x2e13('0x15')]['message']);}else{logger[_0x2e13('0x10')](_0x2e13('0x11'),_0x5dd0d5,'request\x20sent');_0x54596b(_0x318452[_0x2e13('0x18')][_0x2e13('0x17')]);}})[_0x2e13('0x19')](function(_0x300192){logger[_0x2e13('0x15')](_0x2e13('0x11'),_0x5dd0d5,_0x300192);_0x1bd8cb(_0x300192);});});}function respondWithStatusCode(_0x38adbf,_0xe53f0d){_0xe53f0d=_0xe53f0d||0xcc;return function(_0xebbdfe){if(_0xebbdfe){return _0x38adbf[_0x2e13('0x1a')](_0xe53f0d);}return _0x38adbf[_0x2e13('0x1b')](_0xe53f0d)[_0x2e13('0x1c')]();};}function respondWithResult(_0x3c4482,_0x130b20){_0x130b20=_0x130b20||0xc8;return function(_0x3a2596){if(_0x3a2596){return _0x3c4482[_0x2e13('0x1b')](_0x130b20)['json'](_0x3a2596);}};}function respondWithFilteredResult(_0x4264c6,_0x5f5448){return function(_0x34e1ce){if(_0x34e1ce){var _0x213241=typeof _0x5f5448[_0x2e13('0x1d')]===_0x2e13('0x1e')&&typeof _0x5f5448['limit']==='undefined';var _0x5eac5b=_0x34e1ce[_0x2e13('0x1f')];var _0xa297df=_0x213241?0x0:_0x5f5448['offset'];var _0x2f0697=_0x213241?_0x34e1ce[_0x2e13('0x1f')]:_0x5f5448['offset']+_0x5f5448[_0x2e13('0x20')];var _0x247ee2;if(_0x2f0697>=_0x5eac5b){_0x2f0697=_0x5eac5b;_0x247ee2=0xc8;}else{_0x247ee2=0xce;}_0x4264c6[_0x2e13('0x1b')](_0x247ee2);return _0x4264c6[_0x2e13('0x21')]('Content-Range',_0xa297df+'-'+_0x2f0697+'/'+_0x5eac5b)[_0x2e13('0x22')](_0x34e1ce);}return null;};}function saveUpdates(_0x1f3d32){return function(_0x1ea08f){if(_0x1ea08f){return _0x1ea08f['update'](_0x1f3d32)[_0x2e13('0x23')](function(_0x42c0d3){return _0x42c0d3;});}return null;};}function removeEntity(_0x29e1ac){return function(_0x2022c3){if(_0x2022c3){return _0x2022c3[_0x2e13('0x24')]()[_0x2e13('0x23')](function(){var _0x3234bd=_0x2022c3[_0x2e13('0x25')]({'plain':!![]});var _0x5cb17c=_0x2e13('0x26');return db['UserProfileResource'][_0x2e13('0x24')]({'where':{'type':_0x5cb17c,'resourceId':_0x3234bd['id']}})[_0x2e13('0x23')](function(){return _0x2022c3;});})[_0x2e13('0x23')](function(){_0x29e1ac[_0x2e13('0x1b')](0xcc)[_0x2e13('0x1c')]();});}};}function handleEntityNotFound(_0x3846d8){return function(_0x1dc54e){if(!_0x1dc54e){_0x3846d8[_0x2e13('0x1a')](0x194);}return _0x1dc54e;};}function handleError(_0x2ba016,_0x5e6ac1){_0x5e6ac1=_0x5e6ac1||0x1f4;return function(_0x1e80cf){logger[_0x2e13('0x15')](_0x1e80cf[_0x2e13('0x27')]);if(_0x1e80cf[_0x2e13('0x28')]){delete _0x1e80cf[_0x2e13('0x28')];}_0x2ba016['status'](_0x5e6ac1)['send'](_0x1e80cf);};}function getImapHost(_0x5ecbf1){switch(_0x5ecbf1){case _0x2e13('0x29'):return _0x2e13('0x2a');case _0x2e13('0x2b'):return'imap.mail.yahoo.com';case _0x2e13('0x2c'):return _0x2e13('0x2d');case _0x2e13('0x2e'):return _0x2e13('0x2f');}throw new Error(_0x2e13('0x30'),_0x5ecbf1);}function getSmtpHost(_0x4a9125){switch(_0x4a9125){case'gmail':return _0x2e13('0x31');case'yahoo':return _0x2e13('0x32');case _0x2e13('0x2c'):return _0x2e13('0x33');case _0x2e13('0x2e'):return _0x2e13('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0x4a9125);}function getAuthenticationOptions(_0x3b2b24,_0x185b9c){var _0x52f261={};var _0x7129d0={};if(_0x3b2b24){_0x52f261['user']=_0x7129d0['user']=_0x185b9c['username'];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=_0x185b9c['password'];if(_0x185b9c[_0x2e13('0x36')]){_0x52f261['modernAuthentication']=_0x7129d0[_0x2e13('0x36')]=!![];_0x52f261[_0x2e13('0x37')]=_0x7129d0[_0x2e13('0x37')]=_0x185b9c[_0x2e13('0x37')];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=null;}else{_0x52f261[_0x2e13('0x37')]=_0x7129d0[_0x2e13('0x37')]=null;}_0x52f261['host']=getImapHost(_0x3b2b24);_0x52f261[_0x2e13('0x38')]=0x3e1;_0x7129d0[_0x2e13('0x39')]=getSmtpHost(_0x3b2b24);_0x7129d0[_0x2e13('0x38')]=0x24b;_0x7129d0[_0x2e13('0x3a')]=![];_0x52f261[_0x2e13('0x3b')]=_0x7129d0[_0x2e13('0x3b')]=null;}else{if(_0x185b9c[_0x2e13('0x3c')]){_0x52f261[_0x2e13('0x3d')]=_0x7129d0[_0x2e13('0x3d')]=_0x185b9c['username'];_0x52f261['password']=_0x7129d0[_0x2e13('0x35')]=_0x185b9c[_0x2e13('0x3e')];}else{_0x52f261[_0x2e13('0x3c')]=_0x7129d0['authentication']=![];_0x52f261['user']=_0x7129d0[_0x2e13('0x3d')]=null;_0x52f261['password']=_0x7129d0['pass']=null;}_0x52f261['host']=_0x185b9c[_0x2e13('0x3f')][_0x2e13('0x39')];_0x52f261['port']=_0x185b9c[_0x2e13('0x3f')][_0x2e13('0x38')];_0x7129d0[_0x2e13('0x39')]=_0x185b9c['Smtp'][_0x2e13('0x39')];_0x7129d0[_0x2e13('0x38')]=_0x185b9c[_0x2e13('0x40')][_0x2e13('0x38')];}return{'Imap':_0x52f261,'Smtp':_0x7129d0};}exports[_0x2e13('0x41')]=function(_0x556e41,_0x1e63a4){var _0x3b1fe4={'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db['MailServerOut'],'as':_0x2e13('0x40')},{'model':db[_0x2e13('0x43')],'as':_0x2e13('0x44')}]},_0x3a809f={},_0x53eeb6={'count':0x0,'rows':[]};var _0x4052bd=_['map'](db['MailAccount'][_0x2e13('0x45')],function(_0xd2f98a){return{'name':_0xd2f98a['fieldName'],'type':_0xd2f98a['type'][_0x2e13('0x46')]};});_0x3a809f[_0x2e13('0x47')]=_[_0x2e13('0x48')](_0x4052bd,_0x2e13('0x28'));_0x3a809f[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x556e41['query']);_0x3a809f[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x3a809f[_0x2e13('0x47')],_0x3a809f[_0x2e13('0x49')]);_0x3b1fe4[_0x2e13('0x4d')]=_['intersection'](_0x3a809f[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x3b1fe4['attributes']=_0x3b1fe4['attributes'][_0x2e13('0x4f')]?_0x3b1fe4[_0x2e13('0x4d')]:_0x3a809f[_0x2e13('0x47')];if(!_0x556e41[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x3b1fe4[_0x2e13('0x20')]=qs[_0x2e13('0x20')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x20')]);_0x3b1fe4[_0x2e13('0x1d')]=qs['offset'](_0x556e41[_0x2e13('0x49')][_0x2e13('0x1d')]);}_0x3b1fe4['order']=qs[_0x2e13('0x52')](_0x556e41[_0x2e13('0x49')][_0x2e13('0x52')]);_0x3b1fe4[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x556e41[_0x2e13('0x49')],_0x3a809f[_0x2e13('0x4b')]),_0x4052bd);if(_0x556e41[_0x2e13('0x49')]['filter']){_0x3b1fe4[_0x2e13('0x53')]=_['merge'](_0x3b1fe4[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x4052bd,function(_0x444b73){if(_0x444b73[_0x2e13('0x55')]!==_0x2e13('0x56')){var _0x2919f6={};_0x2919f6[_0x444b73['name']]={'$like':'%'+_0x556e41[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x2919f6;}})});}_0x3b1fe4=_[_0x2e13('0x58')]({},_0x3b1fe4,_0x556e41[_0x2e13('0x59')]);var _0x50215b={'where':_0x3b1fe4[_0x2e13('0x53')]};return db[_0x2e13('0x5a')][_0x2e13('0x1f')](_0x50215b)[_0x2e13('0x23')](function(_0x28ab3d){_0x53eeb6['count']=_0x28ab3d;if(_0x556e41[_0x2e13('0x49')]['includeAll']){_0x3b1fe4[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x5a')][_0x2e13('0x5c')](_0x3b1fe4);})[_0x2e13('0x23')](function(_0x4c5266){_0x53eeb6[_0x2e13('0x5d')]=_0x4c5266;return _0x53eeb6;})[_0x2e13('0x23')](respondWithFilteredResult(_0x1e63a4,_0x3b1fe4))[_0x2e13('0x19')](handleError(_0x1e63a4,null));};exports[_0x2e13('0x5e')]=function(_0x2cf8fe,_0x1121ec){var _0x23e141={'raw':![],'where':{'id':_0x2cf8fe[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db[_0x2e13('0x60')],'as':'Smtp'},{'model':db[_0x2e13('0x43')],'as':_0x2e13('0x44')}]},_0x4bdb79={};_0x4bdb79[_0x2e13('0x47')]=_['keys'](db['MailAccount'][_0x2e13('0x45')]);_0x4bdb79[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x2cf8fe[_0x2e13('0x49')]);_0x4bdb79[_0x2e13('0x4b')]=_['intersection'](_0x4bdb79[_0x2e13('0x47')],_0x4bdb79['query']);_0x23e141[_0x2e13('0x4d')]=_['intersection'](_0x4bdb79['model'],qs['fields'](_0x2cf8fe['query'][_0x2e13('0x4e')]));_0x23e141[_0x2e13('0x4d')]=_0x23e141['attributes'][_0x2e13('0x4f')]?_0x23e141[_0x2e13('0x4d')]:_0x4bdb79[_0x2e13('0x47')];if(_0x2cf8fe['query']['includeAll']){_0x23e141[_0x2e13('0x5b')]=[{'all':!![]}];}_0x23e141=_[_0x2e13('0x58')]({},_0x23e141,_0x2cf8fe['options']);return db[_0x2e13('0x5a')]['find'](_0x23e141)[_0x2e13('0x23')](handleEntityNotFound(_0x1121ec,null))[_0x2e13('0x23')](respondWithResult(_0x1121ec,null))['catch'](handleError(_0x1121ec,null));};exports[_0x2e13('0x61')]=function(_0x36d68a,_0x31e4fb){if(_0x36d68a['body']['id']){delete _0x36d68a[_0x2e13('0x62')]['id'];}var _0xad873=_0x36d68a['body'][_0x2e13('0x63')]===_0x2e13('0x64')?null:_0x36d68a[_0x2e13('0x62')][_0x2e13('0x63')];var _0x20ecda=_0x36d68a[_0x2e13('0x62')]['Imap']||{};var _0x5d18b9=_0x36d68a[_0x2e13('0x62')][_0x2e13('0x40')]||{};if(_0xad873){_0x20ecda[_0x2e13('0x39')]=getImapHost(_0xad873);_0x20ecda['port']=0x3e1;_0x5d18b9[_0x2e13('0x39')]=getSmtpHost(_0xad873);_0x5d18b9[_0x2e13('0x38')]=0x24b;_0x5d18b9[_0x2e13('0x3a')]=![];}if(_0x5d18b9[_0x2e13('0x36')]){_0x5d18b9[_0x2e13('0x3a')]=![];}else{_0x5d18b9[_0x2e13('0x37')]=null;}if(!_0x20ecda[_0x2e13('0x36')])_0x20ecda[_0x2e13('0x37')]=null;_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')]=_0x20ecda;_0x36d68a['body'][_0x2e13('0x40')]=_0x5d18b9;return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x36d68a[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x42')],'as':_0x2e13('0x3f')},{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40')},{'model':db[_0x2e13('0x43')],'as':'mandatoryDispositionPause'}]})[_0x2e13('0x23')](handleEntityNotFound(_0x31e4fb,null))[_0x2e13('0x23')](function(_0x383913){if(!_0x383913)throw new Error(_0x2e13('0x66'));if(_0x383913[_0x2e13('0x3b')])delete _0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')];return _0x383913;})['then'](saveUpdates(_0x36d68a[_0x2e13('0x62')],null))[_0x2e13('0x23')](function(_0x2f280b){if(!_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')])return _0x2f280b;return db[_0x2e13('0x42')][_0x2e13('0x61')](_0x36d68a[_0x2e13('0x62')][_0x2e13('0x3f')],{'where':{'MailAccountId':_0x2f280b['id']}})[_0x2e13('0x23')](function(){return _0x2f280b;});})['then'](function(_0xbf4eb){if(!_0x36d68a[_0x2e13('0x62')]['Smtp'])return _0xbf4eb;return db[_0x2e13('0x60')]['update'](_0x36d68a[_0x2e13('0x62')][_0x2e13('0x40')],{'where':{'MailAccountId':_0xbf4eb['id']}})[_0x2e13('0x23')](function(){return _0xbf4eb;});})[_0x2e13('0x23')](respondWithResult(_0x31e4fb,null))[_0x2e13('0x19')](handleError(_0x31e4fb,null));};exports[_0x2e13('0x67')]=function(_0x17522b,_0x4d73c3){return db['MailAccount']['describe']()[_0x2e13('0x23')](respondWithResult(_0x4d73c3,null))[_0x2e13('0x19')](handleError(_0x4d73c3,null));};exports['addDisposition']=function(_0x1f9c68,_0x32e2cd){if(_0x1f9c68[_0x2e13('0x62')]['id']){delete _0x1f9c68[_0x2e13('0x62')]['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x1f9c68['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x32e2cd,null))[_0x2e13('0x23')](function(_0x126dcc){if(_0x126dcc){_0x1f9c68[_0x2e13('0x62')][_0x2e13('0x68')]=_0x126dcc['id'];return db['Disposition'][_0x2e13('0x69')](_0x1f9c68[_0x2e13('0x62')]);}})[_0x2e13('0x23')](respondWithResult(_0x32e2cd,null))['catch'](handleError(_0x32e2cd,null));};exports[_0x2e13('0x6a')]=function(_0x3c421e,_0x3c3014){var _0x32a5b4={'raw':![],'where':{}};var _0x45500c={};var _0x99ea1d={'count':0x0,'rows':[]};return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x3c421e['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x3c3014,null))[_0x2e13('0x23')](function(_0x1c24c2){if(_0x1c24c2){_0x45500c[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x6c')]['rawAttributes']);_0x45500c[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x3c421e[_0x2e13('0x49')]);_0x45500c[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x45500c['model'],_0x45500c['query']);_0x32a5b4[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x45500c[_0x2e13('0x47')],qs['fields'](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x32a5b4[_0x2e13('0x4d')]=_0x32a5b4[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x32a5b4[_0x2e13('0x4d')]:_0x45500c[_0x2e13('0x47')];if(!_0x3c421e[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x32a5b4['limit']=qs[_0x2e13('0x20')](_0x3c421e['query'][_0x2e13('0x20')]);_0x32a5b4[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x1d')]);}_0x32a5b4[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x3c421e[_0x2e13('0x49')][_0x2e13('0x52')]);_0x32a5b4[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x3c421e[_0x2e13('0x49')],_0x45500c[_0x2e13('0x4b')]));_0x32a5b4['where'][_0x2e13('0x68')]=_0x1c24c2['id'];if(_0x3c421e[_0x2e13('0x49')][_0x2e13('0x57')]){_0x32a5b4[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x32a5b4[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x32a5b4['attributes'],function(_0x192b37){var _0x22e902={};_0x22e902[_0x192b37]={'$like':'%'+_0x3c421e[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x22e902;})});}_0x32a5b4=_[_0x2e13('0x58')]({},_0x32a5b4,_0x3c421e[_0x2e13('0x59')]);return db['Disposition'][_0x2e13('0x1f')]({'where':_0x32a5b4[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x516e47){_0x99ea1d[_0x2e13('0x1f')]=_0x516e47;if(_0x3c421e[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x32a5b4[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x6c')][_0x2e13('0x5c')](_0x32a5b4);})['then'](function(_0x4ca74f){_0x99ea1d[_0x2e13('0x5d')]=_0x4ca74f;return _0x99ea1d;});}})[_0x2e13('0x23')](respondWithFilteredResult(_0x3c3014,_0x32a5b4))[_0x2e13('0x19')](handleError(_0x3c3014,null));};exports['removeDispositions']=function(_0x36d6d0,_0x3fd59d){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x36d6d0[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x3fd59d,null))[_0x2e13('0x23')](function(_0x38d4ce){if(_0x38d4ce){return _0x38d4ce[_0x2e13('0x6f')](_0x36d6d0[_0x2e13('0x49')][_0x2e13('0x70')]);}})[_0x2e13('0x23')](respondWithStatusCode(_0x3fd59d,null))[_0x2e13('0x19')](handleError(_0x3fd59d,null));};exports['addAnswer']=function(_0x2db71c,_0x52e2d0){if(_0x2db71c['body']['id']){delete _0x2db71c[_0x2e13('0x62')]['id'];}return db[_0x2e13('0x5a')]['find']({'where':{'id':_0x2db71c[_0x2e13('0x5f')]['id']}})['then'](handleEntityNotFound(_0x52e2d0,null))[_0x2e13('0x23')](function(_0x36a5bc){if(_0x36a5bc){_0x2db71c['body'][_0x2e13('0x68')]=_0x36a5bc['id'];return db[_0x2e13('0x71')][_0x2e13('0x69')](_0x2db71c[_0x2e13('0x62')]);}})['then'](respondWithResult(_0x52e2d0,null))[_0x2e13('0x19')](handleError(_0x52e2d0,null));};exports[_0x2e13('0x72')]=function(_0x225cb3,_0x4474ba){var _0x55cf1d={'raw':![],'where':{}};var _0x3b3f91={};var _0x4c88c3={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x225cb3['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4474ba,null))[_0x2e13('0x23')](function(_0x13b5f4){if(_0x13b5f4){_0x3b3f91[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x71')][_0x2e13('0x45')]);_0x3b3f91['query']=_[_0x2e13('0x4a')](_0x225cb3[_0x2e13('0x49')]);_0x3b3f91['filters']=_[_0x2e13('0x4c')](_0x3b3f91[_0x2e13('0x47')],_0x3b3f91['query']);_0x55cf1d[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x3b3f91[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x55cf1d[_0x2e13('0x4d')]=_0x55cf1d['attributes']['length']?_0x55cf1d[_0x2e13('0x4d')]:_0x3b3f91[_0x2e13('0x47')];if(!_0x225cb3['query'][_0x2e13('0x50')](_0x2e13('0x51'))){_0x55cf1d[_0x2e13('0x20')]=qs['limit'](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x20')]);_0x55cf1d[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x225cb3[_0x2e13('0x49')]['offset']);}_0x55cf1d[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x225cb3[_0x2e13('0x49')][_0x2e13('0x52')]);_0x55cf1d[_0x2e13('0x53')]=qs['filters'](_[_0x2e13('0x54')](_0x225cb3['query'],_0x3b3f91[_0x2e13('0x4b')]));_0x55cf1d[_0x2e13('0x53')]['MailAccountId']=_0x13b5f4['id'];if(_0x225cb3[_0x2e13('0x49')][_0x2e13('0x57')]){_0x55cf1d[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x55cf1d[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x55cf1d[_0x2e13('0x4d')],function(_0x42ba79){var _0x25e3c1={};_0x25e3c1[_0x42ba79]={'$like':'%'+_0x225cb3['query']['filter']+'%'};return _0x25e3c1;})});}_0x55cf1d=_[_0x2e13('0x58')]({},_0x55cf1d,_0x225cb3['options']);return db['CannedAnswer']['count']({'where':_0x55cf1d[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x29c399){_0x4c88c3['count']=_0x29c399;if(_0x225cb3['query'][_0x2e13('0x6e')]){_0x55cf1d[_0x2e13('0x5b')]=[{'all':!![]}];}return db[_0x2e13('0x71')][_0x2e13('0x5c')](_0x55cf1d);})[_0x2e13('0x23')](function(_0x5109b0){_0x4c88c3['rows']=_0x5109b0;return _0x4c88c3;});}})[_0x2e13('0x23')](respondWithFilteredResult(_0x4474ba,_0x55cf1d))[_0x2e13('0x19')](handleError(_0x4474ba,null));};exports[_0x2e13('0x73')]=function(_0x4b6ed1,_0x268619){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x4b6ed1[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x268619,null))[_0x2e13('0x23')](function(_0x119d94){if(_0x119d94){return _0x119d94[_0x2e13('0x73')](_0x4b6ed1['query'][_0x2e13('0x70')]);}})[_0x2e13('0x23')](respondWithStatusCode(_0x268619,null))[_0x2e13('0x19')](handleError(_0x268619,null));};exports[_0x2e13('0x69')]=function(_0xcb7c65,_0x2d1d20){var _0x37ee27={'name':_0xcb7c65[_0x2e13('0x62')]['name'],'key':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x46')],'provider':_0xcb7c65['body'][_0x2e13('0x63')]==='custom'?null:_0xcb7c65['body'][_0x2e13('0x63')],'email':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x74')],'ListId':_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x75')],'active':!_[_0x2e13('0x76')](_0xcb7c65['body'][_0x2e13('0x77')])?_0xcb7c65[_0x2e13('0x62')][_0x2e13('0x77')]:!![],'description':_0xcb7c65[_0x2e13('0x62')]['description']||null};var _0x5c0096=getAuthenticationOptions(_0x37ee27[_0x2e13('0x63')],_0xcb7c65['body']);_0x37ee27[_0x2e13('0x3f')]=_0x5c0096[_0x2e13('0x3f')];_0x37ee27['Smtp']=_0x5c0096['Smtp'];return db[_0x2e13('0x5a')]['create'](_0x37ee27,{'include':[{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x2e13('0x23')](function(_0x3b1c57){var _0x153557=_0xcb7c65['user'][_0x2e13('0x25')]({'plain':!![]});if(!_0x153557)throw new Error(_0x2e13('0x78'));if(_0x153557[_0x2e13('0x79')]==='user'){var _0x5b7099=_0x3b1c57[_0x2e13('0x25')]({'plain':!![]});return db[_0x2e13('0x7a')]['find']({'where':{'name':_0x2e13('0x26'),'userProfileId':_0x153557[_0x2e13('0x7b')]},'raw':!![]})[_0x2e13('0x23')](function(_0x26a229){if(_0x26a229&&_0x26a229[_0x2e13('0x7c')]===0x0){return db[_0x2e13('0x7d')]['create']({'name':_0x5b7099[_0x2e13('0x28')],'resourceId':_0x5b7099['id'],'type':_0x26a229[_0x2e13('0x28')],'sectionId':_0x26a229['id']},{})[_0x2e13('0x23')](function(){return _0x3b1c57;});}else{return _0x3b1c57;}})['catch'](function(_0x835023){logger[_0x2e13('0x15')](_0x2e13('0x7e'),_0x835023);throw _0x835023;});}return _0x3b1c57;})['then'](respondWithResult(_0x2d1d20,0xc9))['catch'](handleError(_0x2d1d20,null));};exports[_0x2e13('0x7f')]=function(_0x51acc9,_0x2eeb72){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x51acc9[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x2eeb72,null))[_0x2e13('0x23')](function(_0x25fbff){if(_0x25fbff){return _0x25fbff[_0x2e13('0x7f')]();}return null;})[_0x2e13('0x23')](respondWithResult(_0x2eeb72,null))[_0x2e13('0x19')](handleError(_0x2eeb72,null));};exports[_0x2e13('0x80')]=function(_0x4223ab,_0x39e767){if(_0x4223ab[_0x2e13('0x62')]['id']){delete _0x4223ab['body']['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x4223ab['params']['id']}})['then'](handleEntityNotFound(_0x39e767,null))['then'](function(_0x36138){if(_0x36138){_0x4223ab[_0x2e13('0x62')][_0x2e13('0x68')]=_0x36138['id'];return db[_0x2e13('0x42')][_0x2e13('0x69')](_0x4223ab[_0x2e13('0x62')]);}})[_0x2e13('0x23')](respondWithResult(_0x39e767,null))['catch'](handleError(_0x39e767,null));};exports[_0x2e13('0x81')]=function(_0xce8f7c,_0x185d6a){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0xce8f7c['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x185d6a,null))['then'](function(_0x29aa83){if(_0x29aa83){return _0x29aa83[_0x2e13('0x82')](null);}return null;})[_0x2e13('0x23')](respondWithStatusCode(_0x185d6a,null))[_0x2e13('0x19')](handleError(_0x185d6a,null));};exports[_0x2e13('0x83')]=function(_0x11b464,_0x33c0b7){return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x11b464[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x33c0b7,null))[_0x2e13('0x23')](function(_0x2a1eb1){if(_0x2a1eb1){return _0x2a1eb1[_0x2e13('0x83')]();}return null;})[_0x2e13('0x23')](respondWithResult(_0x33c0b7,null))['catch'](handleError(_0x33c0b7,null));};exports[_0x2e13('0x84')]=function(_0x29f108,_0x6d9ce6){if(_0x29f108[_0x2e13('0x62')]['id']){delete _0x29f108['body']['id'];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x29f108[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x6d9ce6,null))['then'](function(_0x143883){if(_0x143883){_0x29f108['body'][_0x2e13('0x68')]=_0x143883['id'];return db[_0x2e13('0x60')][_0x2e13('0x69')](_0x29f108[_0x2e13('0x62')]);}})['then'](respondWithResult(_0x6d9ce6,null))['catch'](handleError(_0x6d9ce6,null));};exports[_0x2e13('0x85')]=function(_0x266479,_0x4aa92a){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x266479['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4aa92a,null))[_0x2e13('0x23')](function(_0x1ddfbc){if(_0x1ddfbc){return _0x1ddfbc[_0x2e13('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x4aa92a,null))[_0x2e13('0x19')](handleError(_0x4aa92a,null));};exports[_0x2e13('0x87')]=function(_0x454660,_0x4d1510){return db[_0x2e13('0x88')][_0x2e13('0x65')]({'where':{'id':_0x454660[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x4d1510,null))[_0x2e13('0x23')](function(_0x6a5c1f){if(_0x6a5c1f){return _0x6a5c1f[_0x2e13('0x87')](_0x454660[_0x2e13('0x62')]['ids'],_[_0x2e13('0x89')](_0x454660[_0x2e13('0x62')],['ids','id'])||{});}})[_0x2e13('0x23')](respondWithResult(_0x4d1510,null))[_0x2e13('0x19')](handleError(_0x4d1510,null));};exports[_0x2e13('0x8a')]=function(_0x3df66f,_0x2bd70d){var _0x44cc79={'raw':![],'where':{}};var _0x1b0c87={};var _0x1dd0a7={'count':0x0,'rows':[]};return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x3df66f[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x2bd70d,null))[_0x2e13('0x23')](function(_0x12ecee){if(_0x12ecee){_0x1b0c87[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db['MailInteraction'][_0x2e13('0x45')]);_0x1b0c87[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x3df66f[_0x2e13('0x49')]);_0x1b0c87['filters']=_[_0x2e13('0x4c')](_0x1b0c87[_0x2e13('0x47')],_0x1b0c87[_0x2e13('0x49')]);_0x44cc79[_0x2e13('0x4d')]=_['intersection'](_0x1b0c87['model'],qs[_0x2e13('0x4e')](_0x3df66f[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x44cc79[_0x2e13('0x4d')]=_0x44cc79['attributes'][_0x2e13('0x4f')]?_0x44cc79[_0x2e13('0x4d')]:_0x1b0c87[_0x2e13('0x47')];if(!_0x3df66f[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x44cc79['limit']=qs[_0x2e13('0x20')](_0x3df66f['query'][_0x2e13('0x20')]);_0x44cc79[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x3df66f[_0x2e13('0x49')]['offset']);}_0x44cc79[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x3df66f[_0x2e13('0x49')]['sort']);_0x44cc79['where']=qs['filters'](_[_0x2e13('0x54')](_0x3df66f[_0x2e13('0x49')],_0x1b0c87['filters']));_0x44cc79[_0x2e13('0x53')][_0x2e13('0x68')]=_0x12ecee['id'];if(_0x3df66f['query']['filter']){_0x44cc79[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0x44cc79[_0x2e13('0x53')],{'$or':_['map'](_0x44cc79['attributes'],function(_0x4406d7){var _0x2fa40d={};_0x2fa40d[_0x4406d7]={'$like':'%'+_0x3df66f['query'][_0x2e13('0x57')]+'%'};return _0x2fa40d;})});}_0x44cc79=_[_0x2e13('0x58')]({},_0x44cc79,_0x3df66f[_0x2e13('0x59')]);return db['MailInteraction']['count']({'where':_0x44cc79[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x108fac){_0x1dd0a7[_0x2e13('0x1f')]=_0x108fac;if(_0x3df66f[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x44cc79[_0x2e13('0x5b')]=[{'model':db[_0x2e13('0x8b')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x2e13('0x8c'),'attributes':['name','fullname',_0x2e13('0x8d')],'required':![]},{'model':db['Tag'],'as':_0x2e13('0x8e'),'attributes':['id',_0x2e13('0x28'),_0x2e13('0x8f')],'where':_0x3df66f[_0x2e13('0x49')][_0x2e13('0x90')]?{'id':_0x3df66f['query'][_0x2e13('0x90')]}:undefined,'required':_0x3df66f['query']['tag']?!![]:![]}];}return db['MailInteraction'][_0x2e13('0x5c')](_0x44cc79);})[_0x2e13('0x23')](function(_0x5c48bb){_0x1dd0a7[_0x2e13('0x5d')]=_0x5c48bb;return _0x1dd0a7;});}})['then'](respondWithFilteredResult(_0x2bd70d,_0x44cc79))[_0x2e13('0x19')](handleError(_0x2bd70d,null));};exports[_0x2e13('0x91')]=function addApplications(_0xd9c023,_0x1b5c13){var _0x5b7511=_0xd9c023[_0x2e13('0x5f')]['id'];var _0x3a6281=_0xd9c023[_0x2e13('0x62')];var _0x3e3209=0xc8;var _0x2cfa35=null;return db['sequelize'][_0x2e13('0x92')]({'isolationLevel':db[_0x2e13('0x93')][_0x2e13('0x94')][_0x2e13('0x95')][_0x2e13('0x96')]},function(_0x1b9e05){return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x5b7511},'transaction':_0x1b9e05})[_0x2e13('0x23')](function(_0x578f82){if(_0x578f82){return db['MailApplication'][_0x2e13('0x24')]({'where':{'MailAccountId':_0x5b7511},'transaction':_0x1b9e05})[_0x2e13('0x23')](function(){var _0xaf826e=_[_0x2e13('0x48')](_0x3a6281,function(_0x45adb2){_0x45adb2[_0x2e13('0x68')]=_0x5b7511;return _0x45adb2;});return db[_0x2e13('0x97')][_0x2e13('0x98')](_0xaf826e,{'transaction':_0x1b9e05});});}else{_0x3e3209=0x194;_0x2cfa35=[];}});})['then'](function(){if(_0x3e3209!==0x194){return db['MailApplication'][_0x2e13('0x99')]({'where':{'MailAccountId':_0x5b7511},'order':_0x2e13('0x9a')})[_0x2e13('0x23')](function(_0x2dfbc0){_0x2cfa35=_0x2dfbc0;});}})[_0x2e13('0x19')](function(_0xab33f9){_0x3e3209=0x1f4;logger[_0x2e13('0x15')](_0xab33f9['stack']);if(_0xab33f9['name']){delete _0xab33f9[_0x2e13('0x28')];}_0x2cfa35=_0xab33f9;})[_0x2e13('0x9b')](function(){if(_0x2cfa35===null){_0x1b5c13[_0x2e13('0x1a')](_0x3e3209);}else{if(_0x3e3209===0x1f4){_0x1b5c13[_0x2e13('0x1b')](_0x3e3209)[_0x2e13('0x9c')](_0x2cfa35);}else{_0x1b5c13[_0x2e13('0x1b')](_0x3e3209)['json'](_0x2cfa35);}}});};exports[_0x2e13('0x9d')]=function(_0x11296f,_0x510a32){var _0x1a1b1a={};var _0xba8460={};var _0xe7dc52;var _0x170f35;return db[_0x2e13('0x5a')]['findOne']({'where':{'id':_0x11296f[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x510a32,null))[_0x2e13('0x23')](function(_0x48f3ec){if(_0x48f3ec){_0xe7dc52=_0x48f3ec;_0xba8460[_0x2e13('0x47')]=_[_0x2e13('0x4a')](db[_0x2e13('0x97')]['rawAttributes']);_0xba8460[_0x2e13('0x49')]=_[_0x2e13('0x4a')](_0x11296f[_0x2e13('0x49')]);_0xba8460[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0xba8460[_0x2e13('0x47')],_0xba8460[_0x2e13('0x49')]);_0x1a1b1a[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0xba8460[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x4e')]));_0x1a1b1a[_0x2e13('0x4d')]=_0x1a1b1a[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x1a1b1a[_0x2e13('0x4d')]:_0xba8460[_0x2e13('0x47')];_0x1a1b1a[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x52')]);_0x1a1b1a[_0x2e13('0x53')]=qs['filters'](_['pick'](_0x11296f[_0x2e13('0x49')],_0xba8460['filters']));if(_0x11296f['query'][_0x2e13('0x57')]){_0x1a1b1a[_0x2e13('0x53')]=_['merge'](_0x1a1b1a['where'],{'$or':_[_0x2e13('0x48')](_0x1a1b1a[_0x2e13('0x4d')],function(_0xc2c17f){var _0x218c8c={};_0x218c8c[_0xc2c17f]={'$like':'%'+_0x11296f[_0x2e13('0x49')]['filter']+'%'};return _0x218c8c;})});}_0x1a1b1a=_[_0x2e13('0x58')]({},_0x1a1b1a,_0x11296f['options']);return _0xe7dc52[_0x2e13('0x9d')](_0x1a1b1a);}})[_0x2e13('0x23')](function(_0x52c18d){if(_0x52c18d){_0x170f35=_0x52c18d[_0x2e13('0x4f')];if(!_0x11296f[_0x2e13('0x49')][_0x2e13('0x50')](_0x2e13('0x51'))){_0x1a1b1a['limit']=qs[_0x2e13('0x20')](_0x11296f[_0x2e13('0x49')][_0x2e13('0x20')]);_0x1a1b1a[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x11296f['query']['offset']);}return _0xe7dc52[_0x2e13('0x9d')](_0x1a1b1a);}})['then'](function(_0x374fc7){if(_0x374fc7){return _0x374fc7?{'count':_0x170f35,'rows':_0x374fc7}:null;}})[_0x2e13('0x23')](respondWithResult(_0x510a32,null))['catch'](handleError(_0x510a32,null));};exports[_0x2e13('0x9e')]=function(_0x5bb1e2,_0x567af8){var _0x3dffdb={'raw':!![],'where':{}};var _0x5ee33a={};var _0x3ae822={'count':0x0,'rows':[]};return db['MailAccount'][_0x2e13('0x6b')]({'where':{'id':_0x5bb1e2[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x567af8,null))[_0x2e13('0x23')](function(_0x32ffa2){if(_0x32ffa2){_0x5ee33a['model']=_[_0x2e13('0x4a')](db['MailMessage'][_0x2e13('0x45')]);_0x5ee33a['query']=_[_0x2e13('0x4a')](_0x5bb1e2[_0x2e13('0x49')]);_0x5ee33a['filters']=_[_0x2e13('0x4c')](_0x5ee33a[_0x2e13('0x47')],_0x5ee33a['query']);_0x3dffdb[_0x2e13('0x4d')]=_[_0x2e13('0x4c')](_0x5ee33a[_0x2e13('0x47')],qs[_0x2e13('0x4e')](_0x5bb1e2[_0x2e13('0x49')]['fields']));_0x3dffdb[_0x2e13('0x4d')]=_0x3dffdb[_0x2e13('0x4d')][_0x2e13('0x4f')]?_0x3dffdb[_0x2e13('0x4d')]:_0x5ee33a[_0x2e13('0x47')];if(!_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x50')]('nolimit')){_0x3dffdb[_0x2e13('0x20')]=qs['limit'](_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x20')]);_0x3dffdb['offset']=qs[_0x2e13('0x1d')](_0x5bb1e2['query'][_0x2e13('0x1d')]);}_0x3dffdb[_0x2e13('0x6d')]=qs['sort'](_0x5bb1e2['query'][_0x2e13('0x52')]);_0x3dffdb[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_['pick'](_0x5bb1e2[_0x2e13('0x49')],_0x5ee33a['filters']));_0x3dffdb[_0x2e13('0x53')][_0x2e13('0x68')]=_0x32ffa2['id'];if(_0x5bb1e2['query'][_0x2e13('0x57')]){_0x3dffdb['where']=_[_0x2e13('0x58')](_0x3dffdb[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0x3dffdb[_0x2e13('0x4d')],function(_0x549640){var _0x1fcbe2={};_0x1fcbe2[_0x549640]={'$like':'%'+_0x5bb1e2[_0x2e13('0x49')]['filter']+'%'};return _0x1fcbe2;})});}if(_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x9f')]){var _0x2e1404=_0x5bb1e2[_0x2e13('0x49')]['$gte'][_0x2e13('0xa0')](',');var _0x3badf5={};_0x3badf5[_0x2e1404[0x0]]={'$gte':moment(_0x2e1404[0x1])[_0x2e13('0xa1')](_0x2e13('0xa2'))};_0x3dffdb[_0x2e13('0x53')]=_['merge'](_0x3dffdb[_0x2e13('0x53')],_0x3badf5);}_0x3dffdb=_[_0x2e13('0x58')]({},_0x3dffdb,_0x5bb1e2[_0x2e13('0x59')]);return db[_0x2e13('0xa3')][_0x2e13('0x1f')]({'where':_0x3dffdb[_0x2e13('0x53')]})[_0x2e13('0x23')](function(_0x186cbb){_0x3ae822[_0x2e13('0x1f')]=_0x186cbb;if(_0x5bb1e2[_0x2e13('0x49')][_0x2e13('0x6e')]){_0x3dffdb[_0x2e13('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0x2e13('0x5c')](_0x3dffdb);})['then'](function(_0x1b60ec){if(_0x5bb1e2[_0x2e13('0x49')]['inlineCss']===_0x2e13('0xa4')){for(var _0x3ae08a=0x0;_0x3ae08a<_0x1b60ec[_0x2e13('0x4f')];_0x3ae08a++){_0x1b60ec[_0x3ae08a][_0x2e13('0x62')]=juice(_0x1b60ec[_0x3ae08a]['body']);}}_0x3ae822[_0x2e13('0x5d')]=_0x1b60ec;return _0x3ae822;});}})['then'](respondWithFilteredResult(_0x567af8,_0x3dffdb))[_0x2e13('0x19')](handleError(_0x567af8,null));};exports[_0x2e13('0x9c')]=function(_0x5a40f0,_0x144338){var _0x3b5a1d,_0x9aee4={},_0x419ad4;if(_0x5a40f0[_0x2e13('0x62')]['to']){_0x419ad4=_0x5a40f0['body']['to'][_0x2e13('0xa0')](',')[0x0];}return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x5a40f0[_0x2e13('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x2e13('0xa5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x419ad4},'limit':0x1,'order':[[_0x2e13('0xa6'),_0x2e13('0xa7')]]}]},{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40'),'raw':!![],'include':[{'model':db[_0x2e13('0xa8')],'as':_0x2e13('0xa8'),'raw':!![]}]}]})[_0x2e13('0x23')](handleEntityNotFound(_0x144338,null))['then'](function(_0x4794cf){if(!_0x4794cf)return;_0x3b5a1d=_0x4794cf;if(!_0x4794cf['Smtp'])throw new Error(_0x2e13('0xa9'));if(_[_0x2e13('0x76')](_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')])){_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')]=util['format']('%s\x20<%s>',_0x4794cf[_0x2e13('0x28')],_0x4794cf[_0x2e13('0x74')]||_0x4794cf[_0x2e13('0x40')][_0x2e13('0x3d')]);}if(_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')]&&_0x5a40f0['body'][_0x2e13('0xab')][_0x2e13('0x4f')]){for(var _0x18310f=0x0;_0x18310f<_0x5a40f0['body'][_0x2e13('0xab')]['length'];_0x18310f+=0x1){_0x5a40f0['body'][_0x2e13('0xab')][_0x18310f]={'filename':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')][_0x18310f][_0x2e13('0x28')],'path':path[_0x2e13('0xac')](config[_0x2e13('0xad')],_0x2e13('0xae'),_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xab')][_0x18310f][_0x2e13('0xaf')])};}}var _0x4d4454=_0x4794cf[_0x2e13('0xb0')]();return respondWithRpcPromise(_0x2e13('0xb1'),'sendMail',{'account':_0x4d4454,'message':_0x5a40f0[_0x2e13('0x62')]});})['then'](function(_0xe742e5){if(!_0xe742e5)return;_0x9aee4=_0xe742e5;if(!_0x3b5a1d[_0x2e13('0xa5')])throw new Error('List\x20not\x20found');if(_0x3b5a1d[_0x2e13('0xa5')][_0x2e13('0xb2')][_0x2e13('0x4f')])return _0x3b5a1d[_0x2e13('0xa5')]['Contacts'][0x0];return db[_0x2e13('0x8b')]['create'](_[_0x2e13('0xa')](_0x5a40f0['body'],{'firstName':_0x5a40f0[_0x2e13('0x62')]['to'],'email':_0x5a40f0['body']['to'],'phone':_0x5a40f0[_0x2e13('0x62')]['to'],'ListId':_0x3b5a1d[_0x2e13('0x75')]}));})['then'](function(_0x37fee3){if(!_0x37fee3)return;var _0x274eb1={'UserId':_0x5a40f0[_0x2e13('0x3d')]['id'],'ContactId':_0x37fee3['id'],'MailAccountId':_0x3b5a1d['id'],'inReplyTo':_0x9aee4[_0x2e13('0xb3')],'to':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xaa')],'cc':_0x5a40f0[_0x2e13('0x62')]['cc'],'subject':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb4')],'attach':_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb5')],'firstMsgDirection':_0x2e13('0xb6'),'lastMsgAt':moment()[_0x2e13('0xa1')](_0x2e13('0xa2')),'lastMsgDirection':_0x2e13('0xb6'),'Messages':[_[_0x2e13('0x58')](_0x5a40f0[_0x2e13('0x62')],{'messageId':_0x9aee4['messageId'],'sentAt':moment()[_0x2e13('0xa1')](_0x2e13('0xa2')),'read':!![],'MailAccountId':_0x3b5a1d['id'],'UserId':_0x5a40f0[_0x2e13('0x3d')]['id'],'ContactId':_0x37fee3['id']})]};if(_0x5a40f0['body'][_0x2e13('0xb7')]){_0x274eb1=_[_0x2e13('0x58')](_0x274eb1,_0x5a40f0[_0x2e13('0x62')][_0x2e13('0xb7')]);}return db[_0x2e13('0x88')][_0x2e13('0x69')](_0x274eb1,{'include':[{'model':db['MailMessage'],'as':_0x2e13('0xb8')}]});})[_0x2e13('0x23')](respondWithResult(_0x144338,null))[_0x2e13('0x19')](handleError(_0x144338,null));};exports[_0x2e13('0xb9')]=function(_0x47be9b,_0x4f4db4){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x47be9b[_0x2e13('0x5f')]['id']},'include':[{'model':db[_0x2e13('0x60')],'as':_0x2e13('0x40'),'raw':!![],'include':[{'model':db[_0x2e13('0xa8')],'as':_0x2e13('0xa8'),'raw':!![]}]}]})[_0x2e13('0x23')](handleEntityNotFound(_0x4f4db4,null))[_0x2e13('0x23')](function(_0x584daf){if(!_0x584daf[_0x2e13('0x40')])return;var _0x10136a=_0x584daf['getSmtpOptions']();return respondWithRpcPromise(_0x2e13('0xba'),_0x2e13('0xb9'),{'account':_0x10136a});})[_0x2e13('0x23')](respondWithResult(_0x4f4db4,null))[_0x2e13('0x19')](handleError(_0x4f4db4,null));};exports[_0x2e13('0x24')]=function(_0x3f1aec,_0x49d8bb){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x3f1aec['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x49d8bb,null))[_0x2e13('0x23')](function(_0x1433ad){if(_0x1433ad&&_0x1433ad[_0x2e13('0x3b')]){throw new db[(_0x2e13('0xbb'))][(_0x2e13('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1433ad;})['then'](removeEntity(_0x49d8bb,null))[_0x2e13('0x19')](handleError(_0x49d8bb,null));};exports['addAgents']=function(_0x80cc25,_0x536c61){return db[_0x2e13('0x5a')][_0x2e13('0x65')]({'where':{'id':_0x80cc25[_0x2e13('0x5f')]['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x536c61,null))[_0x2e13('0x23')](function(_0x27cadd){if(_0x27cadd){return _0x27cadd[_0x2e13('0xbd')](_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')],_[_0x2e13('0x89')](_0x80cc25[_0x2e13('0x62')],[_0x2e13('0x70'),'id'])||{})[_0x2e13('0xbe')](function(_0x106761){for(var _0x305adc=0x0;_0x305adc<_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')]['length'];_0x305adc+=0x1){socket[_0x2e13('0xbf')]('userMailAccount:save',{'UserId':Number(_0x80cc25[_0x2e13('0x62')][_0x2e13('0x70')][_0x305adc]),'MailAccountId':Number(_0x80cc25[_0x2e13('0x5f')]['id'])});}return _0x106761;});}})[_0x2e13('0x23')](respondWithResult(_0x536c61,null))[_0x2e13('0x19')](handleError(_0x536c61,null));};exports['removeAgents']=function(_0x24a13f,_0x7bf4e6){return db[_0x2e13('0x5a')]['find']({'where':{'id':_0x24a13f[_0x2e13('0x5f')]['id']}})['then'](handleEntityNotFound(_0x7bf4e6,null))[_0x2e13('0x23')](function(_0x2fab51){if(_0x2fab51){return _0x2fab51[_0x2e13('0xc0')](_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')])['then'](function(){if(_[_0x2e13('0xc1')](_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')])){for(var _0xdfbb75=0x0;_0xdfbb75<_0x24a13f['query'][_0x2e13('0x70')]['length'];_0xdfbb75+=0x1){socket[_0x2e13('0xbf')](_0x2e13('0xc2'),{'UserId':Number(_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')][_0xdfbb75]),'MailAccountId':Number(_0x24a13f[_0x2e13('0x5f')]['id'])});}}else{socket[_0x2e13('0xbf')](_0x2e13('0xc2'),{'UserId':Number(_0x24a13f[_0x2e13('0x49')][_0x2e13('0x70')]),'MailAccountId':Number(_0x24a13f[_0x2e13('0x5f')]['id'])});}});}})[_0x2e13('0x23')](respondWithStatusCode(_0x7bf4e6,null))['catch'](handleError(_0x7bf4e6,null));};exports['getAgents']=function(_0x111ecd,_0x5694ba){var _0xfdf287={};var _0x54f099={};var _0x1d4eb0;var _0x3c4a2b;return db[_0x2e13('0x5a')][_0x2e13('0x6b')]({'where':{'id':_0x111ecd['params']['id']}})[_0x2e13('0x23')](handleEntityNotFound(_0x5694ba,null))[_0x2e13('0x23')](function(_0x19bb7c){if(_0x19bb7c){_0x1d4eb0=_0x19bb7c;_0x54f099['model']=_[_0x2e13('0x4a')](db[_0x2e13('0xc3')][_0x2e13('0x45')]);_0x54f099['query']=_[_0x2e13('0x4a')](_0x111ecd[_0x2e13('0x49')]);_0x54f099[_0x2e13('0x4b')]=_[_0x2e13('0x4c')](_0x54f099[_0x2e13('0x47')],_0x54f099['query']);_0xfdf287[_0x2e13('0x4d')]=_['intersection'](_0x54f099[_0x2e13('0x47')],qs['fields'](_0x111ecd[_0x2e13('0x49')]['fields']));_0xfdf287[_0x2e13('0x4d')]=_0xfdf287[_0x2e13('0x4d')]['length']?_0xfdf287[_0x2e13('0x4d')]:_0x54f099['model'];_0xfdf287[_0x2e13('0x6d')]=qs[_0x2e13('0x52')](_0x111ecd[_0x2e13('0x49')][_0x2e13('0x52')]);_0xfdf287[_0x2e13('0x53')]=qs[_0x2e13('0x4b')](_[_0x2e13('0x54')](_0x111ecd[_0x2e13('0x49')],_0x54f099['filters']));if(_0x111ecd[_0x2e13('0x49')]['filter']){_0xfdf287[_0x2e13('0x53')]=_[_0x2e13('0x58')](_0xfdf287[_0x2e13('0x53')],{'$or':_[_0x2e13('0x48')](_0xfdf287[_0x2e13('0x4d')],function(_0xd00cc){var _0x57a625={};_0x57a625[_0xd00cc]={'$like':'%'+_0x111ecd[_0x2e13('0x49')][_0x2e13('0x57')]+'%'};return _0x57a625;})});}_0xfdf287=_[_0x2e13('0x58')]({},_0xfdf287,_0x111ecd['options']);return _0x1d4eb0['getAgents'](_0xfdf287);}})[_0x2e13('0x23')](function(_0xafd8e1){if(_0xafd8e1){_0x3c4a2b=_0xafd8e1[_0x2e13('0x4f')];if(!_0x111ecd[_0x2e13('0x49')][_0x2e13('0x50')]('nolimit')){_0xfdf287[_0x2e13('0x20')]=qs[_0x2e13('0x20')](_0x111ecd['query'][_0x2e13('0x20')]);_0xfdf287[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x111ecd[_0x2e13('0x49')]['offset']);}return _0x1d4eb0['getAgents'](_0xfdf287);}})['then'](function(_0x14bd82){if(_0x14bd82){return _0x14bd82?{'count':_0x3c4a2b,'rows':_0x14bd82}:null;}})[_0x2e13('0x23')](respondWithResult(_0x5694ba,null))['catch'](handleError(_0x5694ba,null));}; \ No newline at end of file +var _0xe8f1=['userMailAccount:remove','getAgents','moment','bluebird','util','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','MailAccounts','UserProfileResource','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','service','authentication','Imap','Smtp','port','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','MailAccount','findAll','rows','show','params','length','merge','body','provider','secure','find','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','options','removeAnswers','key','custom','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','from','subject','attach','out','Interaction','Messages','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray'];(function(_0x554822,_0x33b3d2){var _0x3401a8=function(_0x4f6f22){while(--_0x4f6f22){_0x554822['push'](_0x554822['shift']());}};_0x3401a8(++_0x33b3d2);}(_0xe8f1,0x18c));var _0x1e8f=function(_0x468e9e,_0x5aa325){_0x468e9e=_0x468e9e-0x0;var _0x2d0d1b=_0xe8f1[_0x468e9e];return _0x2d0d1b;};'use strict';var moment=require(_0x1e8f('0x0'));var BPromise=require(_0x1e8f('0x1'));var util=require(_0x1e8f('0x2'));var path=require('path');var _=require('lodash');var juice=require(_0x1e8f('0x3'));var Redis=require('ioredis');var qs=require(_0x1e8f('0x4'));var logger=require(_0x1e8f('0x5'))(_0x1e8f('0x6'));var config=require(_0x1e8f('0x7'));var db=require(_0x1e8f('0x8'))['db'];config[_0x1e8f('0x9')]=_[_0x1e8f('0xa')](config['redis'],{'host':_0x1e8f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e8f('0x9')]));require('./mailAccount.socket')[_0x1e8f('0xc')](socket);var jayson=require(_0x1e8f('0xd'));var client=jayson['client'][_0x1e8f('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x3c1dab,_0x85d510,_0x17ef7,_0x5ec3b4){return new BPromise(function(_0x205495,_0x2fea27){var _0x4c4d13=_0x5ec3b4||client;return _0x4c4d13[_0x1e8f('0xf')](_0x3c1dab,_0x17ef7)['then'](function(_0x80e20e){logger[_0x1e8f('0x10')](_0x1e8f('0x11'),_0x85d510,_0x1e8f('0x12'));logger[_0x1e8f('0x13')](_0x1e8f('0x14'),_0x85d510,_0x1e8f('0x12'),JSON['stringify'](_0x80e20e));if(_0x80e20e[_0x1e8f('0x15')]){if(_0x80e20e[_0x1e8f('0x15')][_0x1e8f('0x16')]===0x1f4){logger[_0x1e8f('0x15')]('MailAccount,\x20%s,\x20%s',_0x85d510,_0x80e20e['error'][_0x1e8f('0x17')]);return _0x2fea27(_0x80e20e[_0x1e8f('0x15')][_0x1e8f('0x17')]);}logger[_0x1e8f('0x15')](_0x1e8f('0x11'),_0x85d510,_0x80e20e[_0x1e8f('0x15')]['message']);return _0x205495(_0x80e20e[_0x1e8f('0x15')][_0x1e8f('0x17')]);}else{logger[_0x1e8f('0x10')](_0x1e8f('0x11'),_0x85d510,'request\x20sent');_0x205495(_0x80e20e[_0x1e8f('0x18')]['message']);}})[_0x1e8f('0x19')](function(_0x3906e6){logger['error'](_0x1e8f('0x11'),_0x85d510,_0x3906e6);_0x2fea27(_0x3906e6);});});}function respondWithStatusCode(_0x3e8632,_0x70ff80){_0x70ff80=_0x70ff80||0xcc;return function(_0x4434b5){if(_0x4434b5){return _0x3e8632[_0x1e8f('0x1a')](_0x70ff80);}return _0x3e8632[_0x1e8f('0x1b')](_0x70ff80)[_0x1e8f('0x1c')]();};}function respondWithResult(_0x1b907f,_0x3c1e3c){_0x3c1e3c=_0x3c1e3c||0xc8;return function(_0xe8090e){if(_0xe8090e){return _0x1b907f[_0x1e8f('0x1b')](_0x3c1e3c)[_0x1e8f('0x1d')](_0xe8090e);}};}function respondWithFilteredResult(_0x1263be,_0x4966d3){return function(_0x1736ed){if(_0x1736ed){var _0x5629f6=typeof _0x4966d3[_0x1e8f('0x1e')]===_0x1e8f('0x1f')&&typeof _0x4966d3[_0x1e8f('0x20')]===_0x1e8f('0x1f');var _0x21a0e8=_0x1736ed['count'];var _0x4d4d28=_0x5629f6?0x0:_0x4966d3['offset'];var _0x11ee39=_0x5629f6?_0x1736ed[_0x1e8f('0x21')]:_0x4966d3['offset']+_0x4966d3[_0x1e8f('0x20')];var _0x2c9ccc;if(_0x11ee39>=_0x21a0e8){_0x11ee39=_0x21a0e8;_0x2c9ccc=0xc8;}else{_0x2c9ccc=0xce;}_0x1263be[_0x1e8f('0x1b')](_0x2c9ccc);return _0x1263be[_0x1e8f('0x22')](_0x1e8f('0x23'),_0x4d4d28+'-'+_0x11ee39+'/'+_0x21a0e8)[_0x1e8f('0x1d')](_0x1736ed);}return null;};}function saveUpdates(_0x3701c0){return function(_0x73ed5d){if(_0x73ed5d){return _0x73ed5d['update'](_0x3701c0)[_0x1e8f('0x24')](function(_0x38f7f4){return _0x38f7f4;});}return null;};}function removeEntity(_0x16a2dc){return function(_0x20c203){if(_0x20c203){return _0x20c203[_0x1e8f('0x25')]()[_0x1e8f('0x24')](function(){var _0x4c4a07=_0x20c203['get']({'plain':!![]});var _0x47820c=_0x1e8f('0x26');return db[_0x1e8f('0x27')][_0x1e8f('0x25')]({'where':{'type':_0x47820c,'resourceId':_0x4c4a07['id']}})[_0x1e8f('0x24')](function(){return _0x20c203;});})[_0x1e8f('0x24')](function(){_0x16a2dc[_0x1e8f('0x1b')](0xcc)[_0x1e8f('0x1c')]();});}};}function handleEntityNotFound(_0x1bc016){return function(_0x37ec88){if(!_0x37ec88){_0x1bc016[_0x1e8f('0x1a')](0x194);}return _0x37ec88;};}function handleError(_0x446c19,_0x9c944a){_0x9c944a=_0x9c944a||0x1f4;return function(_0x57e990){logger[_0x1e8f('0x15')](_0x57e990[_0x1e8f('0x28')]);if(_0x57e990['name']){delete _0x57e990[_0x1e8f('0x29')];}_0x446c19[_0x1e8f('0x1b')](_0x9c944a)['send'](_0x57e990);};}function getImapHost(_0x3e7e0b){switch(_0x3e7e0b){case _0x1e8f('0x2a'):return _0x1e8f('0x2b');case _0x1e8f('0x2c'):return _0x1e8f('0x2d');case'hotmail':return _0x1e8f('0x2e');case _0x1e8f('0x2f'):return _0x1e8f('0x30');}throw new Error(_0x1e8f('0x31'),_0x3e7e0b);}function getSmtpHost(_0x27ba04){switch(_0x27ba04){case'gmail':return _0x1e8f('0x32');case _0x1e8f('0x2c'):return _0x1e8f('0x33');case _0x1e8f('0x34'):return'smtp-mail.outlook.com';case _0x1e8f('0x2f'):return _0x1e8f('0x35');}throw new Error(_0x1e8f('0x31'),_0x27ba04);}function getAuthenticationOptions(_0x228cae,_0xe048c8){var _0x40d8aa={};var _0x54de21={};if(_0x228cae){_0x40d8aa[_0x1e8f('0x36')]=_0x54de21[_0x1e8f('0x36')]=_0xe048c8[_0x1e8f('0x37')];_0x40d8aa[_0x1e8f('0x38')]=_0x54de21[_0x1e8f('0x39')]=_0xe048c8[_0x1e8f('0x38')];if(_0xe048c8[_0x1e8f('0x3a')]){_0x40d8aa[_0x1e8f('0x3a')]=_0x54de21[_0x1e8f('0x3a')]=!![];_0x40d8aa[_0x1e8f('0x3b')]=_0x54de21[_0x1e8f('0x3b')]=_0xe048c8[_0x1e8f('0x3b')];_0x40d8aa['password']=_0x54de21['pass']=null;}else{_0x40d8aa[_0x1e8f('0x3b')]=_0x54de21[_0x1e8f('0x3b')]=null;}_0x40d8aa[_0x1e8f('0x3c')]=getImapHost(_0x228cae);_0x40d8aa['port']=0x3e1;_0x54de21['host']=getSmtpHost(_0x228cae);_0x54de21['port']=0x24b;_0x54de21['secure']=![];_0x40d8aa[_0x1e8f('0x3d')]=_0x54de21[_0x1e8f('0x3d')]=null;}else{if(_0xe048c8['authentication']){_0x40d8aa[_0x1e8f('0x36')]=_0x54de21[_0x1e8f('0x36')]=_0xe048c8[_0x1e8f('0x37')];_0x40d8aa[_0x1e8f('0x38')]=_0x54de21[_0x1e8f('0x39')]=_0xe048c8[_0x1e8f('0x38')];}else{_0x40d8aa['authentication']=_0x54de21[_0x1e8f('0x3e')]=![];_0x40d8aa[_0x1e8f('0x36')]=_0x54de21['user']=null;_0x40d8aa[_0x1e8f('0x38')]=_0x54de21['pass']=null;}_0x40d8aa[_0x1e8f('0x3c')]=_0xe048c8[_0x1e8f('0x3f')][_0x1e8f('0x3c')];_0x40d8aa['port']=_0xe048c8[_0x1e8f('0x3f')]['port'];_0x54de21['host']=_0xe048c8[_0x1e8f('0x40')][_0x1e8f('0x3c')];_0x54de21[_0x1e8f('0x41')]=_0xe048c8[_0x1e8f('0x40')][_0x1e8f('0x41')];}return{'Imap':_0x40d8aa,'Smtp':_0x54de21};}exports[_0x1e8f('0x42')]=function(_0x4639ef,_0x2c7e52){var _0x3c9201={'include':[{'model':db[_0x1e8f('0x43')],'as':_0x1e8f('0x3f')},{'model':db[_0x1e8f('0x44')],'as':_0x1e8f('0x40')},{'model':db[_0x1e8f('0x45')],'as':_0x1e8f('0x46')}]},_0x3565b7={},_0x2f4828={'count':0x0,'rows':[]};var _0x328c6c=_[_0x1e8f('0x47')](db['MailAccount'][_0x1e8f('0x48')],function(_0x1776b8){return{'name':_0x1776b8[_0x1e8f('0x49')],'type':_0x1776b8[_0x1e8f('0x4a')]['key']};});_0x3565b7[_0x1e8f('0x4b')]=_[_0x1e8f('0x47')](_0x328c6c,_0x1e8f('0x29'));_0x3565b7[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x4639ef[_0x1e8f('0x4c')]);_0x3565b7['filters']=_[_0x1e8f('0x4e')](_0x3565b7[_0x1e8f('0x4b')],_0x3565b7[_0x1e8f('0x4c')]);_0x3c9201[_0x1e8f('0x4f')]=_['intersection'](_0x3565b7[_0x1e8f('0x4b')],qs[_0x1e8f('0x50')](_0x4639ef['query']['fields']));_0x3c9201['attributes']=_0x3c9201['attributes']['length']?_0x3c9201['attributes']:_0x3565b7[_0x1e8f('0x4b')];if(!_0x4639ef['query'][_0x1e8f('0x51')](_0x1e8f('0x52'))){_0x3c9201[_0x1e8f('0x20')]=qs[_0x1e8f('0x20')](_0x4639ef[_0x1e8f('0x4c')][_0x1e8f('0x20')]);_0x3c9201[_0x1e8f('0x1e')]=qs[_0x1e8f('0x1e')](_0x4639ef[_0x1e8f('0x4c')][_0x1e8f('0x1e')]);}_0x3c9201[_0x1e8f('0x53')]=qs[_0x1e8f('0x54')](_0x4639ef[_0x1e8f('0x4c')][_0x1e8f('0x54')]);_0x3c9201[_0x1e8f('0x55')]=qs['filters'](_[_0x1e8f('0x56')](_0x4639ef['query'],_0x3565b7[_0x1e8f('0x57')]),_0x328c6c);if(_0x4639ef[_0x1e8f('0x4c')][_0x1e8f('0x58')]){_0x3c9201[_0x1e8f('0x55')]=_['merge'](_0x3c9201[_0x1e8f('0x55')],{'$or':_[_0x1e8f('0x47')](_0x328c6c,function(_0x3243c4){if(_0x3243c4['type']!==_0x1e8f('0x59')){var _0x56c446={};_0x56c446[_0x3243c4[_0x1e8f('0x29')]]={'$like':'%'+_0x4639ef[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0x56c446;}})});}_0x3c9201=_['merge']({},_0x3c9201,_0x4639ef['options']);var _0x5a97f8={'where':_0x3c9201[_0x1e8f('0x55')]};return db['MailAccount']['count'](_0x5a97f8)[_0x1e8f('0x24')](function(_0x1d06df){_0x2f4828[_0x1e8f('0x21')]=_0x1d06df;if(_0x4639ef['query'][_0x1e8f('0x5a')]){_0x3c9201[_0x1e8f('0x5b')]=[{'all':!![]}];}return db[_0x1e8f('0x5c')][_0x1e8f('0x5d')](_0x3c9201);})[_0x1e8f('0x24')](function(_0x4f27c4){_0x2f4828[_0x1e8f('0x5e')]=_0x4f27c4;return _0x2f4828;})[_0x1e8f('0x24')](respondWithFilteredResult(_0x2c7e52,_0x3c9201))['catch'](handleError(_0x2c7e52,null));};exports[_0x1e8f('0x5f')]=function(_0xc499b7,_0x421a7b){var _0x4a9fff={'raw':![],'where':{'id':_0xc499b7[_0x1e8f('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x1e8f('0x3f')},{'model':db[_0x1e8f('0x44')],'as':_0x1e8f('0x40')},{'model':db[_0x1e8f('0x45')],'as':_0x1e8f('0x46')}]},_0x269229={};_0x269229['model']=_[_0x1e8f('0x4d')](db[_0x1e8f('0x5c')][_0x1e8f('0x48')]);_0x269229[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0xc499b7['query']);_0x269229['filters']=_[_0x1e8f('0x4e')](_0x269229[_0x1e8f('0x4b')],_0x269229['query']);_0x4a9fff[_0x1e8f('0x4f')]=_[_0x1e8f('0x4e')](_0x269229[_0x1e8f('0x4b')],qs[_0x1e8f('0x50')](_0xc499b7[_0x1e8f('0x4c')][_0x1e8f('0x50')]));_0x4a9fff[_0x1e8f('0x4f')]=_0x4a9fff[_0x1e8f('0x4f')][_0x1e8f('0x61')]?_0x4a9fff[_0x1e8f('0x4f')]:_0x269229[_0x1e8f('0x4b')];if(_0xc499b7[_0x1e8f('0x4c')][_0x1e8f('0x5a')]){_0x4a9fff['include']=[{'all':!![]}];}_0x4a9fff=_[_0x1e8f('0x62')]({},_0x4a9fff,_0xc499b7['options']);return db[_0x1e8f('0x5c')]['find'](_0x4a9fff)['then'](handleEntityNotFound(_0x421a7b,null))[_0x1e8f('0x24')](respondWithResult(_0x421a7b,null))['catch'](handleError(_0x421a7b,null));};exports['update']=function(_0x19eb18,_0x53b4c4){if(_0x19eb18[_0x1e8f('0x63')]['id']){delete _0x19eb18[_0x1e8f('0x63')]['id'];}var _0x2bd957=_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x64')]==='custom'?null:_0x19eb18['body'][_0x1e8f('0x64')];var _0x409b1e=_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x3f')]||{};var _0x126af8=_0x19eb18[_0x1e8f('0x63')]['Smtp']||{};if(_0x2bd957){_0x409b1e['host']=getImapHost(_0x2bd957);_0x409b1e[_0x1e8f('0x41')]=0x3e1;_0x126af8[_0x1e8f('0x3c')]=getSmtpHost(_0x2bd957);_0x126af8[_0x1e8f('0x41')]=0x24b;_0x126af8['secure']=![];}if(_0x126af8[_0x1e8f('0x3a')]){_0x126af8[_0x1e8f('0x65')]=![];}else{_0x126af8[_0x1e8f('0x3b')]=null;}if(!_0x409b1e[_0x1e8f('0x3a')])_0x409b1e[_0x1e8f('0x3b')]=null;_0x19eb18['body'][_0x1e8f('0x3f')]=_0x409b1e;_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x40')]=_0x126af8;return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x19eb18[_0x1e8f('0x60')]['id']},'include':[{'model':db[_0x1e8f('0x43')],'as':_0x1e8f('0x3f')},{'model':db['MailServerOut'],'as':_0x1e8f('0x40')},{'model':db[_0x1e8f('0x45')],'as':_0x1e8f('0x46')}]})[_0x1e8f('0x24')](handleEntityNotFound(_0x53b4c4,null))['then'](function(_0x43554f){if(!_0x43554f)throw new Error(_0x1e8f('0x67'));if(_0x43554f[_0x1e8f('0x3d')])delete _0x19eb18[_0x1e8f('0x63')]['Imap'];return _0x43554f;})['then'](saveUpdates(_0x19eb18[_0x1e8f('0x63')],null))[_0x1e8f('0x24')](function(_0x5bca33){if(!_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x3f')])return _0x5bca33;return db[_0x1e8f('0x43')]['update'](_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x3f')],{'where':{'MailAccountId':_0x5bca33['id']}})[_0x1e8f('0x24')](function(){return _0x5bca33;});})[_0x1e8f('0x24')](function(_0x160bc7){if(!_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x40')])return _0x160bc7;return db[_0x1e8f('0x44')][_0x1e8f('0x68')](_0x19eb18[_0x1e8f('0x63')][_0x1e8f('0x40')],{'where':{'MailAccountId':_0x160bc7['id']}})[_0x1e8f('0x24')](function(){return _0x160bc7;});})['then'](respondWithResult(_0x53b4c4,null))[_0x1e8f('0x19')](handleError(_0x53b4c4,null));};exports[_0x1e8f('0x69')]=function(_0x746dc4,_0x5ca5a4){return db['MailAccount'][_0x1e8f('0x69')]()[_0x1e8f('0x24')](respondWithResult(_0x5ca5a4,null))[_0x1e8f('0x19')](handleError(_0x5ca5a4,null));};exports[_0x1e8f('0x6a')]=function(_0x8ff3a1,_0x46b8a5){if(_0x8ff3a1[_0x1e8f('0x63')]['id']){delete _0x8ff3a1['body']['id'];}return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x8ff3a1['params']['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x46b8a5,null))[_0x1e8f('0x24')](function(_0x2322ca){if(_0x2322ca){_0x8ff3a1[_0x1e8f('0x63')][_0x1e8f('0x6b')]=_0x2322ca['id'];return db[_0x1e8f('0x6c')][_0x1e8f('0x6d')](_0x8ff3a1[_0x1e8f('0x63')]);}})[_0x1e8f('0x24')](respondWithResult(_0x46b8a5,null))[_0x1e8f('0x19')](handleError(_0x46b8a5,null));};exports[_0x1e8f('0x6e')]=function(_0x11d1b9,_0x4a4170){var _0x35b442={'raw':![],'where':{}};var _0xdcc510={};var _0x1b9afe={'count':0x0,'rows':[]};return db['MailAccount'][_0x1e8f('0x6f')]({'where':{'id':_0x11d1b9[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x4a4170,null))[_0x1e8f('0x24')](function(_0x2f29f1){if(_0x2f29f1){_0xdcc510['model']=_[_0x1e8f('0x4d')](db['Disposition'][_0x1e8f('0x48')]);_0xdcc510[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x11d1b9[_0x1e8f('0x4c')]);_0xdcc510[_0x1e8f('0x57')]=_[_0x1e8f('0x4e')](_0xdcc510[_0x1e8f('0x4b')],_0xdcc510[_0x1e8f('0x4c')]);_0x35b442['attributes']=_[_0x1e8f('0x4e')](_0xdcc510['model'],qs[_0x1e8f('0x50')](_0x11d1b9[_0x1e8f('0x4c')][_0x1e8f('0x50')]));_0x35b442['attributes']=_0x35b442[_0x1e8f('0x4f')][_0x1e8f('0x61')]?_0x35b442[_0x1e8f('0x4f')]:_0xdcc510['model'];if(!_0x11d1b9[_0x1e8f('0x4c')][_0x1e8f('0x51')]('nolimit')){_0x35b442[_0x1e8f('0x20')]=qs[_0x1e8f('0x20')](_0x11d1b9['query'][_0x1e8f('0x20')]);_0x35b442[_0x1e8f('0x1e')]=qs['offset'](_0x11d1b9[_0x1e8f('0x4c')]['offset']);}_0x35b442[_0x1e8f('0x53')]=qs[_0x1e8f('0x54')](_0x11d1b9['query'][_0x1e8f('0x54')]);_0x35b442[_0x1e8f('0x55')]=qs[_0x1e8f('0x57')](_[_0x1e8f('0x56')](_0x11d1b9[_0x1e8f('0x4c')],_0xdcc510['filters']));_0x35b442[_0x1e8f('0x55')][_0x1e8f('0x6b')]=_0x2f29f1['id'];if(_0x11d1b9[_0x1e8f('0x4c')][_0x1e8f('0x58')]){_0x35b442[_0x1e8f('0x55')]=_['merge'](_0x35b442[_0x1e8f('0x55')],{'$or':_['map'](_0x35b442[_0x1e8f('0x4f')],function(_0x1ec954){var _0x3c3e39={};_0x3c3e39[_0x1ec954]={'$like':'%'+_0x11d1b9[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0x3c3e39;})});}_0x35b442=_[_0x1e8f('0x62')]({},_0x35b442,_0x11d1b9['options']);return db[_0x1e8f('0x6c')][_0x1e8f('0x21')]({'where':_0x35b442[_0x1e8f('0x55')]})[_0x1e8f('0x24')](function(_0x475e3a){_0x1b9afe['count']=_0x475e3a;if(_0x11d1b9[_0x1e8f('0x4c')][_0x1e8f('0x5a')]){_0x35b442[_0x1e8f('0x5b')]=[{'all':!![]}];}return db[_0x1e8f('0x6c')]['findAll'](_0x35b442);})[_0x1e8f('0x24')](function(_0x46cc59){_0x1b9afe[_0x1e8f('0x5e')]=_0x46cc59;return _0x1b9afe;});}})[_0x1e8f('0x24')](respondWithFilteredResult(_0x4a4170,_0x35b442))[_0x1e8f('0x19')](handleError(_0x4a4170,null));};exports[_0x1e8f('0x70')]=function(_0x257428,_0xa7be49){return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x257428[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0xa7be49,null))[_0x1e8f('0x24')](function(_0x89bd8b){if(_0x89bd8b){return _0x89bd8b['removeDispositions'](_0x257428[_0x1e8f('0x4c')][_0x1e8f('0x71')]);}})[_0x1e8f('0x24')](respondWithStatusCode(_0xa7be49,null))[_0x1e8f('0x19')](handleError(_0xa7be49,null));};exports[_0x1e8f('0x72')]=function(_0x5a5cd7,_0x1bf637){if(_0x5a5cd7[_0x1e8f('0x63')]['id']){delete _0x5a5cd7[_0x1e8f('0x63')]['id'];}return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x5a5cd7['params']['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x1bf637,null))[_0x1e8f('0x24')](function(_0x3eed3f){if(_0x3eed3f){_0x5a5cd7['body']['MailAccountId']=_0x3eed3f['id'];return db[_0x1e8f('0x73')][_0x1e8f('0x6d')](_0x5a5cd7[_0x1e8f('0x63')]);}})[_0x1e8f('0x24')](respondWithResult(_0x1bf637,null))['catch'](handleError(_0x1bf637,null));};exports['getAnswers']=function(_0xeeec7e,_0x5ad9ee){var _0x3fdadd={'raw':![],'where':{}};var _0x342b6a={};var _0x579918={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0xeeec7e[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x5ad9ee,null))[_0x1e8f('0x24')](function(_0x47bb38){if(_0x47bb38){_0x342b6a['model']=_[_0x1e8f('0x4d')](db[_0x1e8f('0x73')][_0x1e8f('0x48')]);_0x342b6a['query']=_['keys'](_0xeeec7e['query']);_0x342b6a[_0x1e8f('0x57')]=_['intersection'](_0x342b6a['model'],_0x342b6a[_0x1e8f('0x4c')]);_0x3fdadd[_0x1e8f('0x4f')]=_[_0x1e8f('0x4e')](_0x342b6a[_0x1e8f('0x4b')],qs[_0x1e8f('0x50')](_0xeeec7e['query'][_0x1e8f('0x50')]));_0x3fdadd['attributes']=_0x3fdadd[_0x1e8f('0x4f')][_0x1e8f('0x61')]?_0x3fdadd[_0x1e8f('0x4f')]:_0x342b6a['model'];if(!_0xeeec7e[_0x1e8f('0x4c')][_0x1e8f('0x51')]('nolimit')){_0x3fdadd[_0x1e8f('0x20')]=qs[_0x1e8f('0x20')](_0xeeec7e[_0x1e8f('0x4c')][_0x1e8f('0x20')]);_0x3fdadd[_0x1e8f('0x1e')]=qs[_0x1e8f('0x1e')](_0xeeec7e['query'][_0x1e8f('0x1e')]);}_0x3fdadd[_0x1e8f('0x53')]=qs[_0x1e8f('0x54')](_0xeeec7e[_0x1e8f('0x4c')]['sort']);_0x3fdadd[_0x1e8f('0x55')]=qs['filters'](_['pick'](_0xeeec7e[_0x1e8f('0x4c')],_0x342b6a[_0x1e8f('0x57')]));_0x3fdadd[_0x1e8f('0x55')][_0x1e8f('0x6b')]=_0x47bb38['id'];if(_0xeeec7e['query'][_0x1e8f('0x58')]){_0x3fdadd[_0x1e8f('0x55')]=_[_0x1e8f('0x62')](_0x3fdadd['where'],{'$or':_['map'](_0x3fdadd['attributes'],function(_0x176e3b){var _0x3e8b6b={};_0x3e8b6b[_0x176e3b]={'$like':'%'+_0xeeec7e['query'][_0x1e8f('0x58')]+'%'};return _0x3e8b6b;})});}_0x3fdadd=_[_0x1e8f('0x62')]({},_0x3fdadd,_0xeeec7e[_0x1e8f('0x74')]);return db[_0x1e8f('0x73')]['count']({'where':_0x3fdadd[_0x1e8f('0x55')]})['then'](function(_0x18e646){_0x579918['count']=_0x18e646;if(_0xeeec7e[_0x1e8f('0x4c')]['includeAll']){_0x3fdadd[_0x1e8f('0x5b')]=[{'all':!![]}];}return db[_0x1e8f('0x73')]['findAll'](_0x3fdadd);})[_0x1e8f('0x24')](function(_0x162a6f){_0x579918[_0x1e8f('0x5e')]=_0x162a6f;return _0x579918;});}})['then'](respondWithFilteredResult(_0x5ad9ee,_0x3fdadd))[_0x1e8f('0x19')](handleError(_0x5ad9ee,null));};exports[_0x1e8f('0x75')]=function(_0xb42c75,_0x1a6fb5){return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0xb42c75[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x1a6fb5,null))['then'](function(_0x31f0c4){if(_0x31f0c4){return _0x31f0c4[_0x1e8f('0x75')](_0xb42c75[_0x1e8f('0x4c')][_0x1e8f('0x71')]);}})[_0x1e8f('0x24')](respondWithStatusCode(_0x1a6fb5,null))[_0x1e8f('0x19')](handleError(_0x1a6fb5,null));};exports['create']=function(_0xf78769,_0x386550){var _0x371b45={'name':_0xf78769[_0x1e8f('0x63')]['name'],'key':_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x76')],'provider':_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x64')]===_0x1e8f('0x77')?null:_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x64')],'email':_0xf78769[_0x1e8f('0x63')]['email'],'ListId':_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x78')],'active':!_[_0x1e8f('0x79')](_0xf78769[_0x1e8f('0x63')]['active'])?_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x7a')]:!![],'description':_0xf78769[_0x1e8f('0x63')][_0x1e8f('0x7b')]||null};var _0x753cad=getAuthenticationOptions(_0x371b45[_0x1e8f('0x64')],_0xf78769[_0x1e8f('0x63')]);_0x371b45[_0x1e8f('0x3f')]=_0x753cad[_0x1e8f('0x3f')];_0x371b45[_0x1e8f('0x40')]=_0x753cad[_0x1e8f('0x40')];return db[_0x1e8f('0x5c')]['create'](_0x371b45,{'include':[{'model':db['MailServerOut'],'as':_0x1e8f('0x40')},{'model':db['MailServerIn'],'as':_0x1e8f('0x3f')}]})[_0x1e8f('0x24')](function(_0xb61f9e){var _0x4dff3c=_0xf78769['user'][_0x1e8f('0x7c')]({'plain':!![]});if(!_0x4dff3c)throw new Error(_0x1e8f('0x7d'));if(_0x4dff3c[_0x1e8f('0x7e')]===_0x1e8f('0x36')){var _0x24947f=_0xb61f9e['get']({'plain':!![]});return db[_0x1e8f('0x7f')][_0x1e8f('0x66')]({'where':{'name':'MailAccounts','userProfileId':_0x4dff3c[_0x1e8f('0x80')]},'raw':!![]})[_0x1e8f('0x24')](function(_0x2208e8){if(_0x2208e8&&_0x2208e8['autoAssociation']===0x0){return db[_0x1e8f('0x27')][_0x1e8f('0x6d')]({'name':_0x24947f[_0x1e8f('0x29')],'resourceId':_0x24947f['id'],'type':_0x2208e8[_0x1e8f('0x29')],'sectionId':_0x2208e8['id']},{})['then'](function(){return _0xb61f9e;});}else{return _0xb61f9e;}})[_0x1e8f('0x19')](function(_0x511244){logger[_0x1e8f('0x15')](_0x1e8f('0x81'),_0x511244);throw _0x511244;});}return _0xb61f9e;})[_0x1e8f('0x24')](respondWithResult(_0x386550,0xc9))[_0x1e8f('0x19')](handleError(_0x386550,null));};exports[_0x1e8f('0x82')]=function(_0x3093cd,_0x4c20c7){return db[_0x1e8f('0x5c')]['findOne']({'where':{'id':_0x3093cd[_0x1e8f('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c20c7,null))[_0x1e8f('0x24')](function(_0x4bc6e4){if(_0x4bc6e4){return _0x4bc6e4['getImap']();}return null;})[_0x1e8f('0x24')](respondWithResult(_0x4c20c7,null))[_0x1e8f('0x19')](handleError(_0x4c20c7,null));};exports['addImap']=function(_0xfe818d,_0x45f623){if(_0xfe818d[_0x1e8f('0x63')]['id']){delete _0xfe818d[_0x1e8f('0x63')]['id'];}return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0xfe818d[_0x1e8f('0x60')]['id']}})['then'](handleEntityNotFound(_0x45f623,null))[_0x1e8f('0x24')](function(_0x1d6ca4){if(_0x1d6ca4){_0xfe818d[_0x1e8f('0x63')][_0x1e8f('0x6b')]=_0x1d6ca4['id'];return db['MailServerIn']['create'](_0xfe818d[_0x1e8f('0x63')]);}})['then'](respondWithResult(_0x45f623,null))['catch'](handleError(_0x45f623,null));};exports[_0x1e8f('0x83')]=function(_0x8ea6bb,_0x3da95f){return db['MailAccount'][_0x1e8f('0x6f')]({'where':{'id':_0x8ea6bb['params']['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x3da95f,null))['then'](function(_0x59f931){if(_0x59f931){return _0x59f931[_0x1e8f('0x84')](null);}return null;})[_0x1e8f('0x24')](respondWithStatusCode(_0x3da95f,null))[_0x1e8f('0x19')](handleError(_0x3da95f,null));};exports[_0x1e8f('0x85')]=function(_0x2e8a9c,_0x2512f5){return db[_0x1e8f('0x5c')][_0x1e8f('0x6f')]({'where':{'id':_0x2e8a9c[_0x1e8f('0x60')]['id']}})['then'](handleEntityNotFound(_0x2512f5,null))[_0x1e8f('0x24')](function(_0x5ee47e){if(_0x5ee47e){return _0x5ee47e[_0x1e8f('0x85')]();}return null;})[_0x1e8f('0x24')](respondWithResult(_0x2512f5,null))[_0x1e8f('0x19')](handleError(_0x2512f5,null));};exports[_0x1e8f('0x86')]=function(_0x44e38b,_0x260e8e){if(_0x44e38b[_0x1e8f('0x63')]['id']){delete _0x44e38b[_0x1e8f('0x63')]['id'];}return db[_0x1e8f('0x5c')]['find']({'where':{'id':_0x44e38b[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x260e8e,null))[_0x1e8f('0x24')](function(_0x5c72af){if(_0x5c72af){_0x44e38b['body'][_0x1e8f('0x6b')]=_0x5c72af['id'];return db[_0x1e8f('0x44')][_0x1e8f('0x6d')](_0x44e38b[_0x1e8f('0x63')]);}})['then'](respondWithResult(_0x260e8e,null))['catch'](handleError(_0x260e8e,null));};exports['removeSmtp']=function(_0x41b6e2,_0x361ac2){return db['MailAccount']['findOne']({'where':{'id':_0x41b6e2[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x361ac2,null))[_0x1e8f('0x24')](function(_0x383b72){if(_0x383b72){return _0x383b72[_0x1e8f('0x87')](null);}return null;})[_0x1e8f('0x24')](respondWithStatusCode(_0x361ac2,null))[_0x1e8f('0x19')](handleError(_0x361ac2,null));};exports[_0x1e8f('0x88')]=function(_0x2bc114,_0x5a8bc1){return db['MailInteraction'][_0x1e8f('0x66')]({'where':{'id':_0x2bc114[_0x1e8f('0x60')]['id']}})['then'](handleEntityNotFound(_0x5a8bc1,null))[_0x1e8f('0x24')](function(_0x359055){if(_0x359055){return _0x359055[_0x1e8f('0x88')](_0x2bc114[_0x1e8f('0x63')]['ids'],_[_0x1e8f('0x89')](_0x2bc114['body'],[_0x1e8f('0x71'),'id'])||{});}})[_0x1e8f('0x24')](respondWithResult(_0x5a8bc1,null))['catch'](handleError(_0x5a8bc1,null));};exports[_0x1e8f('0x8a')]=function(_0x17e6ef,_0x328de4){var _0x587880={'raw':![],'where':{}};var _0x8b0383={};var _0x855333={'count':0x0,'rows':[]};return db[_0x1e8f('0x5c')][_0x1e8f('0x6f')]({'where':{'id':_0x17e6ef[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x328de4,null))[_0x1e8f('0x24')](function(_0x5acfc1){if(_0x5acfc1){_0x8b0383[_0x1e8f('0x4b')]=_[_0x1e8f('0x4d')](db[_0x1e8f('0x8b')]['rawAttributes']);_0x8b0383[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x17e6ef[_0x1e8f('0x4c')]);_0x8b0383[_0x1e8f('0x57')]=_[_0x1e8f('0x4e')](_0x8b0383['model'],_0x8b0383[_0x1e8f('0x4c')]);_0x587880[_0x1e8f('0x4f')]=_[_0x1e8f('0x4e')](_0x8b0383[_0x1e8f('0x4b')],qs[_0x1e8f('0x50')](_0x17e6ef['query'][_0x1e8f('0x50')]));_0x587880['attributes']=_0x587880[_0x1e8f('0x4f')][_0x1e8f('0x61')]?_0x587880[_0x1e8f('0x4f')]:_0x8b0383[_0x1e8f('0x4b')];if(!_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x51')]('nolimit')){_0x587880[_0x1e8f('0x20')]=qs[_0x1e8f('0x20')](_0x17e6ef[_0x1e8f('0x4c')]['limit']);_0x587880['offset']=qs[_0x1e8f('0x1e')](_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x1e')]);}_0x587880[_0x1e8f('0x53')]=qs['sort'](_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x54')]);_0x587880[_0x1e8f('0x55')]=qs['filters'](_[_0x1e8f('0x56')](_0x17e6ef[_0x1e8f('0x4c')],_0x8b0383['filters']));_0x587880[_0x1e8f('0x55')]['MailAccountId']=_0x5acfc1['id'];if(_0x17e6ef[_0x1e8f('0x4c')]['filter']){_0x587880[_0x1e8f('0x55')]=_[_0x1e8f('0x62')](_0x587880[_0x1e8f('0x55')],{'$or':_[_0x1e8f('0x47')](_0x587880[_0x1e8f('0x4f')],function(_0x614ef4){var _0xf21baf={};_0xf21baf[_0x614ef4]={'$like':'%'+_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0xf21baf;})});}_0x587880=_[_0x1e8f('0x62')]({},_0x587880,_0x17e6ef['options']);return db[_0x1e8f('0x8b')]['count']({'where':_0x587880['where']})['then'](function(_0x5ba7f6){_0x855333[_0x1e8f('0x21')]=_0x5ba7f6;if(_0x17e6ef[_0x1e8f('0x4c')]['includeAll']){_0x587880[_0x1e8f('0x5b')]=[{'model':db[_0x1e8f('0x8c')],'as':_0x1e8f('0x8d'),'required':![]},{'model':db[_0x1e8f('0x8e')],'as':_0x1e8f('0x8f'),'attributes':[_0x1e8f('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x1e8f('0x90')],'as':_0x1e8f('0x91'),'attributes':['id','name','color'],'where':_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x92')]?{'id':_0x17e6ef[_0x1e8f('0x4c')][_0x1e8f('0x92')]}:undefined,'required':_0x17e6ef[_0x1e8f('0x4c')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x1e8f('0x5d')](_0x587880);})[_0x1e8f('0x24')](function(_0x3dd5f4){_0x855333['rows']=_0x3dd5f4;return _0x855333;});}})[_0x1e8f('0x24')](respondWithFilteredResult(_0x328de4,_0x587880))['catch'](handleError(_0x328de4,null));};exports[_0x1e8f('0x93')]=function addApplications(_0x559ff1,_0x4b8396){var _0x482167=_0x559ff1[_0x1e8f('0x60')]['id'];var _0x140e0f=_0x559ff1[_0x1e8f('0x63')];var _0x3e7b79=0xc8;var _0x46195d=null;return db[_0x1e8f('0x94')][_0x1e8f('0x95')]({'isolationLevel':db[_0x1e8f('0x94')][_0x1e8f('0x96')][_0x1e8f('0x97')]['READ_COMMITTED']},function(_0x524112){return db[_0x1e8f('0x5c')][_0x1e8f('0x6f')]({'where':{'id':_0x482167},'transaction':_0x524112})[_0x1e8f('0x24')](function(_0x121626){if(_0x121626){return db[_0x1e8f('0x98')][_0x1e8f('0x25')]({'where':{'MailAccountId':_0x482167},'transaction':_0x524112})['then'](function(){var _0x753883=_['map'](_0x140e0f,function(_0x36e195){_0x36e195['MailAccountId']=_0x482167;return _0x36e195;});return db[_0x1e8f('0x98')]['bulkCreate'](_0x753883,{'transaction':_0x524112});});}else{_0x3e7b79=0x194;_0x46195d=[];}});})[_0x1e8f('0x24')](function(){if(_0x3e7b79!==0x194){return db[_0x1e8f('0x98')][_0x1e8f('0x99')]({'where':{'MailAccountId':_0x482167},'order':_0x1e8f('0x9a')})[_0x1e8f('0x24')](function(_0x336b56){_0x46195d=_0x336b56;});}})[_0x1e8f('0x19')](function(_0x7d379d){_0x3e7b79=0x1f4;logger['error'](_0x7d379d['stack']);if(_0x7d379d[_0x1e8f('0x29')]){delete _0x7d379d[_0x1e8f('0x29')];}_0x46195d=_0x7d379d;})[_0x1e8f('0x9b')](function(){if(_0x46195d===null){_0x4b8396[_0x1e8f('0x1a')](_0x3e7b79);}else{if(_0x3e7b79===0x1f4){_0x4b8396['status'](_0x3e7b79)[_0x1e8f('0x9c')](_0x46195d);}else{_0x4b8396['status'](_0x3e7b79)['json'](_0x46195d);}}});};exports['getApplications']=function(_0x253ad1,_0x34470a){var _0x378f4f={};var _0x4319e7={};var _0x548581;var _0x5d5828;return db['MailAccount'][_0x1e8f('0x6f')]({'where':{'id':_0x253ad1[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x34470a,null))[_0x1e8f('0x24')](function(_0x188cf5){if(_0x188cf5){_0x548581=_0x188cf5;_0x4319e7[_0x1e8f('0x4b')]=_['keys'](db[_0x1e8f('0x98')][_0x1e8f('0x48')]);_0x4319e7[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x253ad1[_0x1e8f('0x4c')]);_0x4319e7[_0x1e8f('0x57')]=_['intersection'](_0x4319e7['model'],_0x4319e7[_0x1e8f('0x4c')]);_0x378f4f[_0x1e8f('0x4f')]=_[_0x1e8f('0x4e')](_0x4319e7[_0x1e8f('0x4b')],qs['fields'](_0x253ad1[_0x1e8f('0x4c')][_0x1e8f('0x50')]));_0x378f4f[_0x1e8f('0x4f')]=_0x378f4f['attributes'][_0x1e8f('0x61')]?_0x378f4f[_0x1e8f('0x4f')]:_0x4319e7['model'];_0x378f4f['order']=qs[_0x1e8f('0x54')](_0x253ad1['query'][_0x1e8f('0x54')]);_0x378f4f[_0x1e8f('0x55')]=qs['filters'](_[_0x1e8f('0x56')](_0x253ad1[_0x1e8f('0x4c')],_0x4319e7[_0x1e8f('0x57')]));if(_0x253ad1[_0x1e8f('0x4c')][_0x1e8f('0x58')]){_0x378f4f[_0x1e8f('0x55')]=_[_0x1e8f('0x62')](_0x378f4f[_0x1e8f('0x55')],{'$or':_[_0x1e8f('0x47')](_0x378f4f[_0x1e8f('0x4f')],function(_0x53b4f3){var _0x46bb6d={};_0x46bb6d[_0x53b4f3]={'$like':'%'+_0x253ad1[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0x46bb6d;})});}_0x378f4f=_[_0x1e8f('0x62')]({},_0x378f4f,_0x253ad1[_0x1e8f('0x74')]);return _0x548581[_0x1e8f('0x9d')](_0x378f4f);}})[_0x1e8f('0x24')](function(_0x4fd0fc){if(_0x4fd0fc){_0x5d5828=_0x4fd0fc[_0x1e8f('0x61')];if(!_0x253ad1['query']['hasOwnProperty'](_0x1e8f('0x52'))){_0x378f4f[_0x1e8f('0x20')]=qs['limit'](_0x253ad1[_0x1e8f('0x4c')][_0x1e8f('0x20')]);_0x378f4f[_0x1e8f('0x1e')]=qs[_0x1e8f('0x1e')](_0x253ad1[_0x1e8f('0x4c')][_0x1e8f('0x1e')]);}return _0x548581[_0x1e8f('0x9d')](_0x378f4f);}})[_0x1e8f('0x24')](function(_0x2069c){if(_0x2069c){return _0x2069c?{'count':_0x5d5828,'rows':_0x2069c}:null;}})[_0x1e8f('0x24')](respondWithResult(_0x34470a,null))[_0x1e8f('0x19')](handleError(_0x34470a,null));};exports[_0x1e8f('0x9e')]=function(_0x4caa7e,_0x195c01){var _0x243a56={'raw':!![],'where':{}};var _0x2a5bd1={};var _0x3b3829={'count':0x0,'rows':[]};return db[_0x1e8f('0x5c')][_0x1e8f('0x6f')]({'where':{'id':_0x4caa7e['params']['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x195c01,null))[_0x1e8f('0x24')](function(_0x3c400d){if(_0x3c400d){_0x2a5bd1[_0x1e8f('0x4b')]=_[_0x1e8f('0x4d')](db['MailMessage'][_0x1e8f('0x48')]);_0x2a5bd1[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x4caa7e[_0x1e8f('0x4c')]);_0x2a5bd1['filters']=_[_0x1e8f('0x4e')](_0x2a5bd1[_0x1e8f('0x4b')],_0x2a5bd1[_0x1e8f('0x4c')]);_0x243a56[_0x1e8f('0x4f')]=_[_0x1e8f('0x4e')](_0x2a5bd1['model'],qs[_0x1e8f('0x50')](_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x50')]));_0x243a56[_0x1e8f('0x4f')]=_0x243a56[_0x1e8f('0x4f')]['length']?_0x243a56['attributes']:_0x2a5bd1[_0x1e8f('0x4b')];if(!_0x4caa7e['query'][_0x1e8f('0x51')]('nolimit')){_0x243a56['limit']=qs[_0x1e8f('0x20')](_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x20')]);_0x243a56[_0x1e8f('0x1e')]=qs[_0x1e8f('0x1e')](_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x1e')]);}_0x243a56[_0x1e8f('0x53')]=qs[_0x1e8f('0x54')](_0x4caa7e['query']['sort']);_0x243a56['where']=qs[_0x1e8f('0x57')](_[_0x1e8f('0x56')](_0x4caa7e['query'],_0x2a5bd1[_0x1e8f('0x57')]));_0x243a56[_0x1e8f('0x55')][_0x1e8f('0x6b')]=_0x3c400d['id'];if(_0x4caa7e['query'][_0x1e8f('0x58')]){_0x243a56['where']=_['merge'](_0x243a56['where'],{'$or':_[_0x1e8f('0x47')](_0x243a56[_0x1e8f('0x4f')],function(_0x53e0ed){var _0x3d9b23={};_0x3d9b23[_0x53e0ed]={'$like':'%'+_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0x3d9b23;})});}if(_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x9f')]){var _0xe08a10=_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x9f')][_0x1e8f('0xa0')](',');var _0x1e0f7c={};_0x1e0f7c[_0xe08a10[0x0]]={'$gte':moment(_0xe08a10[0x1])[_0x1e8f('0xa1')](_0x1e8f('0xa2'))};_0x243a56[_0x1e8f('0x55')]=_['merge'](_0x243a56['where'],_0x1e0f7c);}_0x243a56=_[_0x1e8f('0x62')]({},_0x243a56,_0x4caa7e[_0x1e8f('0x74')]);return db[_0x1e8f('0xa3')][_0x1e8f('0x21')]({'where':_0x243a56[_0x1e8f('0x55')]})['then'](function(_0x5f1bc4){_0x3b3829['count']=_0x5f1bc4;if(_0x4caa7e[_0x1e8f('0x4c')][_0x1e8f('0x5a')]){_0x243a56['include']=[{'all':!![]}];}return db[_0x1e8f('0xa3')][_0x1e8f('0x5d')](_0x243a56);})[_0x1e8f('0x24')](function(_0x3e007c){if(_0x4caa7e['query'][_0x1e8f('0xa4')]===_0x1e8f('0xa5')){for(var _0x3fabc9=0x0;_0x3fabc9<_0x3e007c[_0x1e8f('0x61')];_0x3fabc9++){_0x3e007c[_0x3fabc9][_0x1e8f('0x63')]=juice(_0x3e007c[_0x3fabc9][_0x1e8f('0x63')]);}}_0x3b3829[_0x1e8f('0x5e')]=_0x3e007c;return _0x3b3829;});}})['then'](respondWithFilteredResult(_0x195c01,_0x243a56))[_0x1e8f('0x19')](handleError(_0x195c01,null));};exports[_0x1e8f('0x9c')]=function(_0x281ad9,_0x44a45a){var _0x11e65d,_0x1d9f8c={},_0x406b65;if(_0x281ad9[_0x1e8f('0x63')]['to']){_0x406b65=_0x281ad9[_0x1e8f('0x63')]['to'][_0x1e8f('0xa0')](',')[0x0];}return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x281ad9['params']['id']},'include':[{'model':db[_0x1e8f('0xa6')],'as':_0x1e8f('0xa7'),'include':[{'model':db[_0x1e8f('0x8c')],'as':_0x1e8f('0xa8'),'where':{'email':_0x406b65},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x1e8f('0x44')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x1e8f('0xa9')],'as':'CloudProvider','raw':!![]}]}]})[_0x1e8f('0x24')](handleEntityNotFound(_0x44a45a,null))[_0x1e8f('0x24')](function(_0x12457d){if(!_0x12457d)return;_0x11e65d=_0x12457d;if(!_0x12457d['Smtp'])throw new Error(_0x1e8f('0xaa'));if(_[_0x1e8f('0x79')](_0x281ad9[_0x1e8f('0x63')]['from'])){_0x281ad9['body']['from']=util['format'](_0x1e8f('0xab'),_0x12457d['name'],_0x12457d['email']||_0x12457d[_0x1e8f('0x40')][_0x1e8f('0x36')]);}if(_0x281ad9[_0x1e8f('0x63')]['attachments']&&_0x281ad9['body'][_0x1e8f('0xac')]['length']){for(var _0x50f190=0x0;_0x50f190<_0x281ad9[_0x1e8f('0x63')][_0x1e8f('0xac')][_0x1e8f('0x61')];_0x50f190+=0x1){_0x281ad9[_0x1e8f('0x63')]['attachments'][_0x50f190]={'filename':_0x281ad9['body'][_0x1e8f('0xac')][_0x50f190][_0x1e8f('0x29')],'path':path[_0x1e8f('0xad')](config[_0x1e8f('0xae')],_0x1e8f('0xaf'),_0x281ad9[_0x1e8f('0x63')][_0x1e8f('0xac')][_0x50f190][_0x1e8f('0xb0')])};}}var _0x5b0667=_0x12457d[_0x1e8f('0xb1')]();return respondWithRpcPromise(_0x1e8f('0xb2'),_0x1e8f('0xb3'),{'account':_0x5b0667,'message':_0x281ad9[_0x1e8f('0x63')]});})[_0x1e8f('0x24')](function(_0x1880bf){if(!_0x1880bf)return;_0x1d9f8c=_0x1880bf;if(!_0x11e65d[_0x1e8f('0xa7')])throw new Error(_0x1e8f('0xb4'));if(_0x11e65d[_0x1e8f('0xa7')]['Contacts'][_0x1e8f('0x61')])return _0x11e65d[_0x1e8f('0xa7')][_0x1e8f('0xa8')][0x0];return db[_0x1e8f('0x8c')][_0x1e8f('0x6d')](_['defaults'](_0x281ad9[_0x1e8f('0x63')],{'firstName':_0x281ad9['body']['to'],'email':_0x281ad9[_0x1e8f('0x63')]['to'],'phone':_0x281ad9['body']['to'],'ListId':_0x11e65d[_0x1e8f('0x78')]}));})[_0x1e8f('0x24')](function(_0xdb8143){if(!_0xdb8143)return;var _0x492014={'UserId':_0x281ad9[_0x1e8f('0x36')]['id'],'ContactId':_0xdb8143['id'],'MailAccountId':_0x11e65d['id'],'inReplyTo':_0x1d9f8c[_0x1e8f('0xb5')],'to':_0x281ad9[_0x1e8f('0x63')][_0x1e8f('0xb6')],'cc':_0x281ad9[_0x1e8f('0x63')]['cc'],'subject':_0x281ad9[_0x1e8f('0x63')][_0x1e8f('0xb7')],'attach':_0x281ad9['body'][_0x1e8f('0xb8')],'firstMsgDirection':_0x1e8f('0xb9'),'lastMsgAt':moment()['format'](_0x1e8f('0xa2')),'lastMsgDirection':'out','Messages':[_[_0x1e8f('0x62')](_0x281ad9[_0x1e8f('0x63')],{'messageId':_0x1d9f8c[_0x1e8f('0xb5')],'sentAt':moment()[_0x1e8f('0xa1')](_0x1e8f('0xa2')),'read':!![],'MailAccountId':_0x11e65d['id'],'UserId':_0x281ad9[_0x1e8f('0x36')]['id'],'ContactId':_0xdb8143['id']})]};if(_0x281ad9['body']['Interaction']){_0x492014=_[_0x1e8f('0x62')](_0x492014,_0x281ad9[_0x1e8f('0x63')][_0x1e8f('0xba')]);}return db[_0x1e8f('0x8b')][_0x1e8f('0x6d')](_0x492014,{'include':[{'model':db['MailMessage'],'as':_0x1e8f('0xbb')}]});})[_0x1e8f('0x24')](respondWithResult(_0x44a45a,null))[_0x1e8f('0x19')](handleError(_0x44a45a,null));};exports['verifySmtp']=function(_0x536341,_0x4a9341){return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x536341[_0x1e8f('0x60')]['id']},'include':[{'model':db[_0x1e8f('0x44')],'as':_0x1e8f('0x40'),'raw':!![],'include':[{'model':db[_0x1e8f('0xa9')],'as':_0x1e8f('0xa9'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4a9341,null))['then'](function(_0x49f091){if(!_0x49f091[_0x1e8f('0x40')])return;var _0x692001=_0x49f091[_0x1e8f('0xb1')]();return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x692001});})['then'](respondWithResult(_0x4a9341,null))[_0x1e8f('0x19')](handleError(_0x4a9341,null));};exports[_0x1e8f('0x25')]=function(_0x428a5e,_0x1c39ac){return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x428a5e[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0x1c39ac,null))[_0x1e8f('0x24')](function(_0x27b1cf){if(_0x27b1cf&&_0x27b1cf[_0x1e8f('0x3d')]){throw new db['Sequelize'][(_0x1e8f('0xbc'))](_0x1e8f('0xbd'));}return _0x27b1cf;})[_0x1e8f('0x24')](removeEntity(_0x1c39ac,null))[_0x1e8f('0x19')](handleError(_0x1c39ac,null));};exports[_0x1e8f('0xbe')]=function(_0x2e150b,_0x2359cf){return db[_0x1e8f('0x5c')][_0x1e8f('0x66')]({'where':{'id':_0x2e150b['params']['id']}})['then'](handleEntityNotFound(_0x2359cf,null))['then'](function(_0x554ffe){if(_0x554ffe){return _0x554ffe['addAgents'](_0x2e150b[_0x1e8f('0x63')][_0x1e8f('0x71')],_[_0x1e8f('0x89')](_0x2e150b[_0x1e8f('0x63')],['ids','id'])||{})['spread'](function(_0x3e83cd){for(var _0x14f545=0x0;_0x14f545<_0x2e150b[_0x1e8f('0x63')][_0x1e8f('0x71')][_0x1e8f('0x61')];_0x14f545+=0x1){socket[_0x1e8f('0xbf')](_0x1e8f('0xc0'),{'UserId':Number(_0x2e150b['body'][_0x1e8f('0x71')][_0x14f545]),'MailAccountId':Number(_0x2e150b[_0x1e8f('0x60')]['id'])});}return _0x3e83cd;});}})['then'](respondWithResult(_0x2359cf,null))[_0x1e8f('0x19')](handleError(_0x2359cf,null));};exports[_0x1e8f('0xc1')]=function(_0x5f074b,_0xda31b){return db['MailAccount'][_0x1e8f('0x66')]({'where':{'id':_0x5f074b[_0x1e8f('0x60')]['id']}})[_0x1e8f('0x24')](handleEntityNotFound(_0xda31b,null))['then'](function(_0x533c58){if(_0x533c58){return _0x533c58['removeAgents'](_0x5f074b[_0x1e8f('0x4c')][_0x1e8f('0x71')])[_0x1e8f('0x24')](function(){if(_[_0x1e8f('0xc2')](_0x5f074b[_0x1e8f('0x4c')]['ids'])){for(var _0x396be5=0x0;_0x396be5<_0x5f074b[_0x1e8f('0x4c')][_0x1e8f('0x71')][_0x1e8f('0x61')];_0x396be5+=0x1){socket[_0x1e8f('0xbf')](_0x1e8f('0xc3'),{'UserId':Number(_0x5f074b['query']['ids'][_0x396be5]),'MailAccountId':Number(_0x5f074b['params']['id'])});}}else{socket[_0x1e8f('0xbf')](_0x1e8f('0xc3'),{'UserId':Number(_0x5f074b[_0x1e8f('0x4c')][_0x1e8f('0x71')]),'MailAccountId':Number(_0x5f074b[_0x1e8f('0x60')]['id'])});}});}})[_0x1e8f('0x24')](respondWithStatusCode(_0xda31b,null))[_0x1e8f('0x19')](handleError(_0xda31b,null));};exports[_0x1e8f('0xc4')]=function(_0x376f33,_0x2a467a){var _0x16ed88={};var _0x29b25e={};var _0x55d45d;var _0x372c9c;return db['MailAccount']['findOne']({'where':{'id':_0x376f33[_0x1e8f('0x60')]['id']}})['then'](handleEntityNotFound(_0x2a467a,null))[_0x1e8f('0x24')](function(_0x2aad5b){if(_0x2aad5b){_0x55d45d=_0x2aad5b;_0x29b25e[_0x1e8f('0x4b')]=_['keys'](db[_0x1e8f('0x8e')]['rawAttributes']);_0x29b25e[_0x1e8f('0x4c')]=_[_0x1e8f('0x4d')](_0x376f33[_0x1e8f('0x4c')]);_0x29b25e[_0x1e8f('0x57')]=_[_0x1e8f('0x4e')](_0x29b25e['model'],_0x29b25e[_0x1e8f('0x4c')]);_0x16ed88[_0x1e8f('0x4f')]=_['intersection'](_0x29b25e[_0x1e8f('0x4b')],qs[_0x1e8f('0x50')](_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x50')]));_0x16ed88[_0x1e8f('0x4f')]=_0x16ed88[_0x1e8f('0x4f')][_0x1e8f('0x61')]?_0x16ed88['attributes']:_0x29b25e['model'];_0x16ed88['order']=qs[_0x1e8f('0x54')](_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x54')]);_0x16ed88[_0x1e8f('0x55')]=qs[_0x1e8f('0x57')](_['pick'](_0x376f33[_0x1e8f('0x4c')],_0x29b25e[_0x1e8f('0x57')]));if(_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x58')]){_0x16ed88[_0x1e8f('0x55')]=_[_0x1e8f('0x62')](_0x16ed88['where'],{'$or':_[_0x1e8f('0x47')](_0x16ed88['attributes'],function(_0x199372){var _0x51c30b={};_0x51c30b[_0x199372]={'$like':'%'+_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x58')]+'%'};return _0x51c30b;})});}_0x16ed88=_[_0x1e8f('0x62')]({},_0x16ed88,_0x376f33['options']);return _0x55d45d[_0x1e8f('0xc4')](_0x16ed88);}})[_0x1e8f('0x24')](function(_0x3b5e62){if(_0x3b5e62){_0x372c9c=_0x3b5e62[_0x1e8f('0x61')];if(!_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x51')](_0x1e8f('0x52'))){_0x16ed88[_0x1e8f('0x20')]=qs['limit'](_0x376f33[_0x1e8f('0x4c')][_0x1e8f('0x20')]);_0x16ed88[_0x1e8f('0x1e')]=qs[_0x1e8f('0x1e')](_0x376f33['query'][_0x1e8f('0x1e')]);}return _0x55d45d['getAgents'](_0x16ed88);}})[_0x1e8f('0x24')](function(_0x53c9b3){if(_0x53c9b3){return _0x53c9b3?{'count':_0x372c9c,'rows':_0x53c9b3}:null;}})[_0x1e8f('0x24')](respondWithResult(_0x2a467a,null))['catch'](handleError(_0x2a467a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4f622e6..181d62b 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 _0xa647=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x42dc81,_0x2a960a){var _0x5349a4=function(_0xb566e1){while(--_0xb566e1){_0x42dc81['push'](_0x42dc81['shift']());}};_0x5349a4(++_0x2a960a);}(_0xa647,0x81));var _0x7a64=function(_0xa2320e,_0x4b5dc1){_0xa2320e=_0xa2320e-0x0;var _0x25f019=_0xa647[_0xa2320e];return _0x25f019;};'use strict';var EventEmitter=require(_0x7a64('0x0'));var MailAccount=require(_0x7a64('0x1'))['db'][_0x7a64('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x7a64('0x3')](0x0);var events={'afterCreate':_0x7a64('0x4'),'afterUpdate':_0x7a64('0x5'),'afterDestroy':_0x7a64('0x6')};function emitEvent(_0x30b8b7){return function(_0x1c7a04,_0x2e1029,_0x46b8b0){MailAccountEvents[_0x7a64('0x7')](_0x30b8b7+':'+_0x1c7a04['id'],_0x1c7a04);MailAccountEvents['emit'](_0x30b8b7,_0x1c7a04);_0x46b8b0(null);};}for(var e in events){if(events[_0x7a64('0x8')](e)){var event=events[e];MailAccount[_0x7a64('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xd798=['save','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x6a4437,_0x25b47f){var _0x8b9e47=function(_0x33403b){while(--_0x33403b){_0x6a4437['push'](_0x6a4437['shift']());}};_0x8b9e47(++_0x25b47f);}(_0xd798,0x77));var _0x8d79=function(_0x5bb392,_0x2be3bc){_0x5bb392=_0x5bb392-0x0;var _0x2bb8f1=_0xd798[_0x5bb392];return _0x2bb8f1;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x8d79('0x0')](0x0);var events={'afterCreate':_0x8d79('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x19cae2){return function(_0x87bc7,_0x15829a,_0x5dc45c){MailAccountEvents[_0x8d79('0x2')](_0x19cae2+':'+_0x87bc7['id'],_0x87bc7);MailAccountEvents[_0x8d79('0x2')](_0x19cae2,_0x87bc7);_0x5dc45c(null);};}for(var e in events){if(events[_0x8d79('0x3')](e)){var event=events[e];MailAccount[_0x8d79('0x4')](e,emitEvent(event));}}module[_0x8d79('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index a6f39ed..9d84a7e 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 _0x3c82=['host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','service'];(function(_0x62c0c2,_0x1fa155){var _0x4ffe7a=function(_0x3bee66){while(--_0x3bee66){_0x62c0c2['push'](_0x62c0c2['shift']());}};_0x4ffe7a(++_0x1fa155);}(_0x3c82,0x175));var _0x23c8=function(_0x321ce2,_0x5354ff){_0x321ce2=_0x321ce2-0x0;var _0x4dff12=_0x3c82[_0x321ce2];return _0x4dff12;};'use strict';var attributes=require(_0x23c8('0x0'));module[_0x23c8('0x1')]=function(_0x405909){return _0x405909[_0x23c8('0x2')](_0x23c8('0x3'),attributes,{'tableName':_0x23c8('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x20dba7=this;var _0x316727={'id':_0x20dba7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x20dba7[_0x23c8('0x5')]!=='custom'){_0x316727[_0x23c8('0x6')]=_0x20dba7[_0x23c8('0x5')];}else{_0x316727[_0x23c8('0x7')]=_0x20dba7['Smtp']['host'];_0x316727[_0x23c8('0x8')]=_0x20dba7[_0x23c8('0x9')][_0x23c8('0x8')];_0x316727[_0x23c8('0xa')]=_0x20dba7[_0x23c8('0x9')][_0x23c8('0xa')];}if(_0x20dba7[_0x23c8('0x9')][_0x23c8('0xb')]){if(_0x20dba7[_0x23c8('0x9')][_0x23c8('0xc')]){if(!_0x20dba7[_0x23c8('0x9')][_0x23c8('0xd')])throw new Error(_0x23c8('0xe'));_0x316727['auth']={'type':_0x23c8('0xf'),'user':_0x20dba7[_0x23c8('0x9')][_0x23c8('0x10')],'accessToken':_0x20dba7['Smtp']['CloudProvider'][_0x23c8('0x11')]};}else{_0x316727[_0x23c8('0x12')]={'user':_0x20dba7[_0x23c8('0x9')][_0x23c8('0x10')],'pass':_0x20dba7['Smtp'][_0x23c8('0x13')]};}}return _0x316727;}}});}; \ No newline at end of file +var _0x7dab=['secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','CloudProvider','data5','auth','user','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom','service','host','port','Smtp'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7dab,0xed));var _0xb7da=function(_0x2f25da,_0x4598be){_0x2f25da=_0x2f25da-0x0;var _0x45d56c=_0x7dab[_0x2f25da];return _0x45d56c;};'use strict';var attributes=require(_0xb7da('0x0'));module[_0xb7da('0x1')]=function(_0x50aac5){return _0x50aac5[_0xb7da('0x2')]('MailAccount',attributes,{'tableName':_0xb7da('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x8b78ef=this;var _0x3d0828={'id':_0x8b78ef['id'],'tls':{'rejectUnauthorized':![]}};if(_0x8b78ef[_0xb7da('0x4')]!==_0xb7da('0x5')){_0x3d0828[_0xb7da('0x6')]=_0x8b78ef[_0xb7da('0x4')];}else{_0x3d0828[_0xb7da('0x7')]=_0x8b78ef['Smtp'][_0xb7da('0x7')];_0x3d0828[_0xb7da('0x8')]=_0x8b78ef[_0xb7da('0x9')][_0xb7da('0x8')];_0x3d0828['secure']=_0x8b78ef[_0xb7da('0x9')][_0xb7da('0xa')];}if(_0x8b78ef[_0xb7da('0x9')][_0xb7da('0xb')]){if(_0x8b78ef[_0xb7da('0x9')][_0xb7da('0xc')]){if(!_0x8b78ef[_0xb7da('0x9')]['CloudProvider'])throw new Error(_0xb7da('0xd'));_0x3d0828['auth']={'type':'OAuth2','user':_0x8b78ef[_0xb7da('0x9')]['user'],'accessToken':_0x8b78ef['Smtp'][_0xb7da('0xe')][_0xb7da('0xf')]};}else{_0x3d0828[_0xb7da('0x10')]={'user':_0x8b78ef[_0xb7da('0x9')][_0xb7da('0x11')],'pass':_0x8b78ef['Smtp'][_0xb7da('0x12')]};}}return _0x3d0828;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3c046c5..26b3ab5 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 _0x1a85=['getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','create','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','Contact\x20not\x20found','update','attach','interaction','get','created','attachments','originCc','bcc','ChatWebsiteId','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','startRouting','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','findAll','options','where','attributes','map','include','model','GetMailAccount','ShowMailAccount','find','raw'];(function(_0x215e71,_0x317b13){var _0x3d8aae=function(_0x2573aa){while(--_0x2573aa){_0x215e71['push'](_0x215e71['shift']());}};_0x3d8aae(++_0x317b13);}(_0x1a85,0x178));var _0x51a8=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0x1a85[_0x722103];return _0x3e2435;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x51a8('0x0'));var rs=require(_0x51a8('0x1'));var Redis=require(_0x51a8('0x2'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x51a8('0x3'));var config=require(_0x51a8('0x4'));var jayson=require(_0x51a8('0x5'));var client=jayson['client'][_0x51a8('0x6')]({'port':0x232c});config['redis']=_[_0x51a8('0x7')](config['redis'],{'host':_0x51a8('0x8'),'port':0x18eb});var socket=require(_0x51a8('0x9'))(new Redis(config['redis']));require(_0x51a8('0xa'))['register'](socket);function respondWithRpcPromise(_0x56e1b4,_0x39e06a,_0x2f276b){return new BPromise(function(_0x1a476d,_0x45a3f4){return client[_0x51a8('0xb')](_0x56e1b4,_0x2f276b)[_0x51a8('0xc')](function(_0x3f93c7){logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,_0x51a8('0xf'));logger[_0x51a8('0x10')](_0x51a8('0x11'),_0x39e06a,_0x51a8('0xf'),JSON[_0x51a8('0x12')](_0x3f93c7));if(_0x3f93c7[_0x51a8('0x13')]){if(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x14')]===0x1f4){logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x45a3f4(_0x3f93c7['error'][_0x51a8('0x15')]);}logger['error'](_0x51a8('0xe'),_0x39e06a,_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);return _0x1a476d(_0x3f93c7[_0x51a8('0x13')][_0x51a8('0x15')]);}else{logger[_0x51a8('0xd')](_0x51a8('0xe'),_0x39e06a,'request\x20sent');_0x1a476d(_0x3f93c7[_0x51a8('0x16')][_0x51a8('0x15')]);}})[_0x51a8('0x17')](function(_0x23539e){logger[_0x51a8('0x13')](_0x51a8('0xe'),_0x39e06a,_0x23539e);_0x45a3f4(_0x23539e);});});}exports['GetMailAccount']=function(_0x1df8c2){var _0x3b7e7e=this;return new Promise(function(_0x2217ce,_0x2f2681){return db[_0x51a8('0x18')][_0x51a8('0x19')]({'raw':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x1df8c2[_0x51a8('0x1a')]?_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'limit':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['limit']||null:null,'include':_0x1df8c2['options']?_0x1df8c2[_0x51a8('0x1a')]['include']?_[_0x51a8('0x1d')](_0x1df8c2[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1f')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1f')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')],'include':_0x273ce2[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x273ce2[_0x51a8('0x1e')],function(_0x1a886f){return{'model':db[_0x1a886f[_0x51a8('0x1f')]],'as':_0x1a886f['as'],'attributes':_0x1a886f[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0xc')](function(_0x20c6b5){logger[_0x51a8('0xd')]('GetMailAccount',_0x1df8c2);logger[_0x51a8('0x10')]('GetMailAccount',_0x1df8c2,JSON[_0x51a8('0x12')](_0x20c6b5));_0x2217ce(_0x20c6b5);})[_0x51a8('0x17')](function(_0x143f46){logger[_0x51a8('0x13')](_0x51a8('0x20'),_0x143f46['message'],_0x1df8c2);_0x2f2681(_0x3b7e7e[_0x51a8('0x13')](0x1f4,_0x143f46['message']));});});};exports[_0x51a8('0x21')]=function(_0x24b39a){var _0x253a59=this;return new Promise(function(_0x4b19c8,_0x2080a1){return db['MailAccount'][_0x51a8('0x22')]({'raw':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x23')]===undefined?!![]:![]:!![],'where':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1b')]||null:null,'attributes':_0x24b39a['options']?_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1c')]||null:null,'include':_0x24b39a[_0x51a8('0x1a')]?_0x24b39a['options'][_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x24b39a[_0x51a8('0x1a')][_0x51a8('0x1e')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1d')](_0x41c020[_0x51a8('0x1e')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1f')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes'],'include':_0x4ec1db[_0x51a8('0x1e')]?_[_0x51a8('0x1d')](_0x4ec1db[_0x51a8('0x1e')],function(_0x1eef9d){return{'model':db[_0x1eef9d[_0x51a8('0x1f')]],'as':_0x1eef9d['as'],'attributes':_0x1eef9d[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e5566){if(_0x24b39a[_0x51a8('0x1a')]['smtp']===!![])_0x4e5566['setDataValue']('smtpOptions',_0x4e5566[_0x51a8('0x24')]());logger[_0x51a8('0xd')](_0x51a8('0x21'),_0x24b39a);logger['debug'](_0x51a8('0x21'),_0x24b39a,JSON[_0x51a8('0x12')](_0x4e5566));_0x4b19c8(_0x4e5566);})[_0x51a8('0x17')](function(_0x310ad2){logger['error'](_0x51a8('0x21'),_0x310ad2[_0x51a8('0x15')],_0x24b39a);_0x2080a1(_0x253a59[_0x51a8('0x13')](0x1f4,_0x310ad2['message']));});});};exports[_0x51a8('0x25')]=function(_0x51d7bd){var _0x2032c0=this;return new Promise(function(_0x1e637a,_0x2a98bd){var _0x37d50b={'body':_0x51d7bd['body'],'channel':_0x51a8('0x26')};var _0x3da2cf=_[_0x51a8('0x27')](_[_0x51a8('0x28')](db[_0x51a8('0x29')][_0x51a8('0x2a')]),[_0x51a8('0x2b'),_0x51a8('0x2c'),_0x51a8('0x2d'),'ListId']);var _0x22e6e6=![];if(_0x51d7bd[_0x51a8('0x2e')]['id']){delete _0x51d7bd['body']['id'];}if(_['isNil'](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x30')));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')])||_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')]===''){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x51a8('0x31')](_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x51a8('0x33')+_0x3da2cf));}if(!_[_0x51a8('0x34')](_0x3da2cf,_0x51d7bd['body'][_0x51a8('0x32')])){return _0x2a98bd(_0x2032c0['error'](0x1f4,_0x51a8('0x35')+_0x3da2cf));}var _0x3a33f3={};_0x3a33f3[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')]['from'];return db['MailAccount'][_0x51a8('0x22')]({'where':{'id':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x37')],'as':_0x51a8('0x38'),'include':[{'model':db[_0x51a8('0x29')],'as':'Contacts','where':_0x3a33f3,'limit':0x1,'order':[['updatedAt',_0x51a8('0x39')]]}]},{'model':db[_0x51a8('0x3a')],'as':_0x51a8('0x3b')},{'model':db[_0x51a8('0x3c')],'as':_0x51a8('0x3d'),'include':[{'model':db[_0x51a8('0x3e')],'as':_0x51a8('0x3e')}]}]})[_0x51a8('0xc')](function(_0x301578){if(_0x301578&&_0x301578['List']){var _0x5cb2cf=_0x301578['get']({'plain':!![]});_0x37d50b[_0x51a8('0x36')]=_[_0x51a8('0x3f')](_0x5cb2cf,[_0x51a8('0x3b'),'List']);_0x37d50b[_0x51a8('0x36')][_0x51a8('0x40')]=_0x301578['getSmtpOptions']();_0x37d50b[_0x51a8('0x41')]=_0x5cb2cf['Applications'];_0x37d50b['list']=_0x5cb2cf[_0x51a8('0x38')];_0x37d50b[_0x51a8('0x41')]=_[_0x51a8('0x42')](_0x37d50b['applications'],['priority'],[_0x51a8('0x43')]);if(_0x37d50b['account']&&_0x37d50b[_0x51a8('0x36')][_0x51a8('0x44')]){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x45')]({'id':0x0,'priority':_0x37d50b[_0x51a8('0x41')][_0x51a8('0x46')]+0x1,'app':_0x51a8('0x47'),'appdata':_0x51a8('0x44'),'interval':_0x51a8('0x48')});}if(_0x37d50b['account'][_0x51a8('0x3b')]){delete _0x37d50b[_0x51a8('0x36')][_0x51a8('0x3b')];}if(_0x37d50b[_0x51a8('0x36')]['List']){delete _0x37d50b[_0x51a8('0x36')]['List'];}if(_0x5cb2cf[_0x51a8('0x38')][_0x51a8('0x49')]['length']){return _0x5cb2cf['List'][_0x51a8('0x49')][0x0];}var _0x16f124=_[_0x51a8('0x7')](_0x51d7bd[_0x51a8('0x2e')],{'firstName':_0x51d7bd[_0x51a8('0x2e')]['from'],'ListId':_0x5cb2cf[_0x51a8('0x4a')]});_0x16f124[_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x32')]]=_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2f')];return db['CmContact'][_0x51a8('0x4b')](_0x16f124);}else{throw new Error(_0x51a8('0x4c'));}})[_0x51a8('0xc')](function(_0x3e43cc){_0x37d50b[_0x51a8('0x4d')]=_0x3e43cc;if(_0x3e43cc){if(!_0x51d7bd[_0x51a8('0x2e')]['message']['messageId']){_0x51d7bd['body']['message'][_0x51a8('0x4e')]=rs[_0x51a8('0x4f')]()+'\x20'+_0x51d7bd['body'][_0x51a8('0x15')]['from'];}var _0x41cc00={'ContactId':_0x3e43cc['id'],'MailAccountId':_0x51d7bd['account']['id'],'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['messageId'],'to':_0x51d7bd['body']['message'][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['attach'],'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x51a8('0x22')]({'where':{'closed':![],'MailAccountId':_0x51d7bd[_0x51a8('0x36')]['id']},'include':[{'model':db[_0x51a8('0x53')],'as':_0x51a8('0x54'),'attributes':[_0x51a8('0x4e')],'where':{'messageId':_0x51d7bd[_0x51a8('0x2e')]['message']['inReplyTo']}}]})[_0x51a8('0xc')](function(_0x53f25e){if(_0x53f25e){return[_0x53f25e,![]];}return db['MailInteraction']['create'](_0x41cc00)['then'](function(_0x483a5a){return[_0x483a5a,!![]];});});}else{throw new Error(_0x51a8('0x55'));}})['spread'](function(_0x1477af,_0x4772cd){if(_0x1477af){_0x22e6e6=_0x4772cd;if(!_0x4772cd){return _0x1477af[_0x51a8('0x56')]({'inReplyTo':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x4e')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'cc':_0x51d7bd[_0x51a8('0x2e')]['message']['cc'],'subject':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x50')],'attach':_0x1477af['attach']?_0x1477af['attach']:_0x51d7bd['body'][_0x51a8('0x15')][_0x51a8('0x57')],'substatus':null,'substatusAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgAt':moment()[_0x51a8('0x51')](_0x51a8('0x52')),'lastMsgDirection':'in'});}else{return _0x1477af;}}})[_0x51a8('0xc')](function(_0x418445){_0x37d50b[_0x51a8('0x58')]=_0x418445[_0x51a8('0x59')]({'plain':!![]});_0x37d50b[_0x51a8('0x58')][_0x51a8('0x5a')]=_0x22e6e6;return db[_0x51a8('0x53')]['create']({'body':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x2e')],'MailAccountId':_0x51d7bd['account']['id'],'MailInteractionId':_0x418445['id'],'direction':'in','ContactId':_0x37d50b[_0x51a8('0x4d')]['id'],'messageId':_0x51d7bd['body']['message']['messageId'],'from':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x2f')],'to':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['to'],'cc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['cc'],'subject':_0x51d7bd['body']['message']['subject'],'attach':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x57')],'Attachments':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5b')],'originTo':_0x51d7bd['body'][_0x51a8('0x15')]['originTo'],'originCc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5c')],'bcc':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5d')],'ChatWebsiteId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5e')]||null,'originChannel':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')]['originChannel']||'Email','ChatOfflineMessageId':_0x51d7bd[_0x51a8('0x2e')][_0x51a8('0x15')][_0x51a8('0x5f')]||null},{'include':[{'model':db[_0x51a8('0x60')],'as':'Attachments'}]});})[_0x51a8('0xc')](function(_0x4d418a){_0x37d50b[_0x51a8('0x15')]=_0x4d418a;if(_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]){return db[_0x51a8('0x62')][_0x51a8('0x22')]({'attributes':['id',_0x51a8('0x63')],'where':{'id':_0x37d50b[_0x51a8('0x58')][_0x51a8('0x61')]}})[_0x51a8('0xc')](function(_0x53fc80){if(_0x53fc80){_0x37d50b[_0x51a8('0x41')][_0x51a8('0x64')]({'id':0x0,'priority':0x0,'app':_0x51a8('0x65'),'appdata':_0x53fc80[_0x51a8('0x63')]+','+(_0x37d50b['account']['waitForTheAssignedAgent']||0xa),'interval':_0x51a8('0x48')});}return respondWithRpcPromise('Start','startRouting',_0x37d50b);});}return respondWithRpcPromise('Start',_0x51a8('0x66'),_0x37d50b);})['then'](function(_0x5c7aca){_0x1e637a(_0x5c7aca);})[_0x51a8('0x17')](function(_0x23f82a){_0x2a98bd(_0x2032c0[_0x51a8('0x13')](0x1f4,_0x23f82a['message']));});});}; \ No newline at end of file +var _0xc2c7=['defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','raw','options','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','DESC','MailApplication','Smtp','CloudProvider','get','omit','Applications','applications','orderBy','asc','autoclose','push','close','Contacts','length','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x258f44,_0x307b39){var _0x4cdafd=function(_0x36ffe8){while(--_0x36ffe8){_0x258f44['push'](_0x258f44['shift']());}};_0x4cdafd(++_0x307b39);}(_0xc2c7,0x134));var _0x7c2c=function(_0x36eab3,_0x1d97f2){_0x36eab3=_0x36eab3-0x0;var _0x70168d=_0xc2c7[_0x36eab3];return _0x70168d;};'use strict';var _=require('lodash');var moment=require(_0x7c2c('0x0'));var BPromise=require(_0x7c2c('0x1'));var rs=require(_0x7c2c('0x2'));var Redis=require(_0x7c2c('0x3'));var db=require(_0x7c2c('0x4'))['db'];var logger=require(_0x7c2c('0x5'))(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c2c('0x8')]({'port':0x232c});config[_0x7c2c('0x9')]=_[_0x7c2c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2c('0x9')]));require(_0x7c2c('0xb'))[_0x7c2c('0xc')](socket);function respondWithRpcPromise(_0x3b780b,_0x279cff,_0x57b107){return new BPromise(function(_0x3093d2,_0x307bec){return client[_0x7c2c('0xd')](_0x3b780b,_0x57b107)[_0x7c2c('0xe')](function(_0x2587ec){logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x279cff,_0x7c2c('0x11'));logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x279cff,_0x7c2c('0x11'),JSON[_0x7c2c('0x14')](_0x2587ec));if(_0x2587ec[_0x7c2c('0x15')]){if(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x16')]===0x1f4){logger[_0x7c2c('0x15')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x2587ec['error'][_0x7c2c('0x17')]);return _0x307bec(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x17')]);}logger['error'](_0x7c2c('0x10'),_0x279cff,_0x2587ec[_0x7c2c('0x15')]['message']);return _0x3093d2(_0x2587ec[_0x7c2c('0x15')]['message']);}else{logger[_0x7c2c('0xf')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x7c2c('0x11'));_0x3093d2(_0x2587ec[_0x7c2c('0x18')][_0x7c2c('0x17')]);}})[_0x7c2c('0x19')](function(_0x17df4a){logger[_0x7c2c('0x15')](_0x7c2c('0x10'),_0x279cff,_0x17df4a);_0x307bec(_0x17df4a);});});}exports[_0x7c2c('0x1a')]=function(_0x2d356e){var _0x39c5f3=this;return new Promise(function(_0x40eaef,_0x2381b4){return db['MailAccount'][_0x7c2c('0x1b')]({'raw':_0x2d356e['options']?_0x2d356e['options'][_0x7c2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1e')]||null:null,'attributes':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'limit':_0x2d356e['options']?_0x2d356e[_0x7c2c('0x1d')]['limit']||null:null,'include':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x2d356e[_0x7c2c('0x1d')]['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x22')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1f')],'include':_0x4d6ec7[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x4d6ec7[_0x7c2c('0x20')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x22')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes'],'include':_0xa8e145[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0xa8e145[_0x7c2c('0x20')],function(_0x22d03f){return{'model':db[_0x22d03f[_0x7c2c('0x22')]],'as':_0x22d03f['as'],'attributes':_0x22d03f[_0x7c2c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0x26f472){logger[_0x7c2c('0xf')]('GetMailAccount',_0x2d356e);logger[_0x7c2c('0x12')](_0x7c2c('0x1a'),_0x2d356e,JSON[_0x7c2c('0x14')](_0x26f472));_0x40eaef(_0x26f472);})[_0x7c2c('0x19')](function(_0x53ad23){logger[_0x7c2c('0x15')](_0x7c2c('0x1a'),_0x53ad23[_0x7c2c('0x17')],_0x2d356e);_0x2381b4(_0x39c5f3[_0x7c2c('0x15')](0x1f4,_0x53ad23[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x23')]=function(_0x463ef7){var _0x57af44=this;return new Promise(function(_0x1969f4,_0x1acf75){return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'raw':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['raw']===undefined?!![]:![]:!![],'where':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['where']||null:null,'attributes':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'include':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x20')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x22')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1f')],'include':_0x204968[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x204968[_0x7c2c('0x20')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x22')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1f')],'include':_0x3230a1['include']?_['map'](_0x3230a1[_0x7c2c('0x20')],function(_0x4acc5d){return{'model':db[_0x4acc5d['model']],'as':_0x4acc5d['as'],'attributes':_0x4acc5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0xc77f11){if(_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x26')]===!![])_0xc77f11[_0x7c2c('0x27')](_0x7c2c('0x28'),_0xc77f11[_0x7c2c('0x29')]());logger[_0x7c2c('0xf')](_0x7c2c('0x23'),_0x463ef7);logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x463ef7,JSON['stringify'](_0xc77f11));_0x1969f4(_0xc77f11);})['catch'](function(_0x3920b6){logger[_0x7c2c('0x15')](_0x7c2c('0x23'),_0x3920b6[_0x7c2c('0x17')],_0x463ef7);_0x1acf75(_0x57af44['error'](0x1f4,_0x3920b6[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x2a')]=function(_0x93e2a8){var _0x45fddf=this;return new Promise(function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'body':_0x93e2a8[_0x7c2c('0x2b')],'channel':_0x7c2c('0x2c')};var _0x4e1f79=_[_0x7c2c('0x2d')](_['keys'](db[_0x7c2c('0x2e')][_0x7c2c('0x2f')]),['createdAt',_0x7c2c('0x30'),'CompanyId',_0x7c2c('0x31')]);var _0x33b2be=![];if(_0x93e2a8[_0x7c2c('0x2b')]['id']){delete _0x93e2a8[_0x7c2c('0x2b')]['id'];}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')]['from'])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x32')));}if(_[_0x7c2c('0x33')](_0x93e2a8[_0x7c2c('0x2b')]['body'])||_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x2b')]===''){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x34')));}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}if(!_[_0x7c2c('0x36')](_0x4e1f79,_0x93e2a8[_0x7c2c('0x2b')]['mapKey'])){return _0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}var _0x51e3b7={};_0x51e3b7[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'where':{'id':_0x93e2a8[_0x7c2c('0x38')]['id']},'include':[{'model':db[_0x7c2c('0x39')],'as':_0x7c2c('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51e3b7,'limit':0x1,'order':[[_0x7c2c('0x30'),_0x7c2c('0x3b')]]}]},{'model':db[_0x7c2c('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7c2c('0x3d'),'include':[{'model':db[_0x7c2c('0x3e')],'as':_0x7c2c('0x3e')}]}]})[_0x7c2c('0xe')](function(_0x5f3de8){if(_0x5f3de8&&_0x5f3de8['List']){var _0x587667=_0x5f3de8[_0x7c2c('0x3f')]({'plain':!![]});_0x12c9cd[_0x7c2c('0x38')]=_[_0x7c2c('0x40')](_0x587667,[_0x7c2c('0x41'),_0x7c2c('0x3a')]);_0x12c9cd['account'][_0x7c2c('0x28')]=_0x5f3de8[_0x7c2c('0x29')]();_0x12c9cd['applications']=_0x587667[_0x7c2c('0x41')];_0x12c9cd['list']=_0x587667[_0x7c2c('0x3a')];_0x12c9cd[_0x7c2c('0x42')]=_[_0x7c2c('0x43')](_0x12c9cd['applications'],['priority'],[_0x7c2c('0x44')]);if(_0x12c9cd['account']&&_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x45')]){_0x12c9cd['applications'][_0x7c2c('0x46')]({'id':0x0,'priority':_0x12c9cd[_0x7c2c('0x42')]['length']+0x1,'app':_0x7c2c('0x47'),'appdata':_0x7c2c('0x45'),'interval':'*,*,*,*'});}if(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x41')]){delete _0x12c9cd[_0x7c2c('0x38')]['Applications'];}if(_0x12c9cd[_0x7c2c('0x38')]['List']){delete _0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x3a')];}if(_0x587667['List'][_0x7c2c('0x48')][_0x7c2c('0x49')]){return _0x587667[_0x7c2c('0x3a')][_0x7c2c('0x48')][0x0];}var _0x481b9e=_[_0x7c2c('0xa')](_0x93e2a8[_0x7c2c('0x2b')],{'firstName':_0x93e2a8['body'][_0x7c2c('0x37')],'ListId':_0x587667['ListId']});_0x481b9e[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x2e')]['create'](_0x481b9e);}else{throw new Error(_0x7c2c('0x4a'));}})[_0x7c2c('0xe')](function(_0x4c4661){_0x12c9cd['contact']=_0x4c4661;if(_0x4c4661){if(!_0x93e2a8['body'][_0x7c2c('0x17')]['messageId']){_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x4b')]=rs[_0x7c2c('0x4c')]()+'\x20'+_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x37')];}var _0x1ee34d={'ContactId':_0x4c4661['id'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'inReplyTo':_0x93e2a8[_0x7c2c('0x2b')]['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8[_0x7c2c('0x2b')]['message']['attach'],'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7c2c('0x25')]({'where':{'closed':![],'MailAccountId':_0x93e2a8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x7c2c('0x50'),'attributes':[_0x7c2c('0x4b')],'where':{'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x51')]}}]})[_0x7c2c('0xe')](function(_0x2d4459){if(_0x2d4459){return[_0x2d4459,![]];}return db[_0x7c2c('0x52')][_0x7c2c('0x53')](_0x1ee34d)[_0x7c2c('0xe')](function(_0xd01d59){return[_0xd01d59,!![]];});});}else{throw new Error(_0x7c2c('0x54'));}})[_0x7c2c('0x55')](function(_0x3d44f8,_0x559005){if(_0x3d44f8){_0x33b2be=_0x559005;if(!_0x559005){return _0x3d44f8[_0x7c2c('0x56')]({'inReplyTo':_0x93e2a8['body']['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['subject'],'attach':_0x3d44f8[_0x7c2c('0x57')]?_0x3d44f8[_0x7c2c('0x57')]:_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x57')],'substatus':null,'substatusAt':moment()[_0x7c2c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'});}else{return _0x3d44f8;}}})['then'](function(_0x39d319){_0x12c9cd[_0x7c2c('0x58')]=_0x39d319['get']({'plain':!![]});_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x59')]=_0x33b2be;return db['MailMessage']['create']({'body':_0x93e2a8[_0x7c2c('0x2b')]['body'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'MailInteractionId':_0x39d319['id'],'direction':'in','ContactId':_0x12c9cd['contact']['id'],'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['messageId'],'from':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x37')],'to':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['to'],'cc':_0x93e2a8['body'][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x57')],'Attachments':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5a')],'originTo':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5b')],'originCc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5c')],'bcc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5d')],'ChatWebsiteId':_0x93e2a8['body']['message'][_0x7c2c('0x5e')]||null,'originChannel':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['originChannel']||_0x7c2c('0x5f'),'ChatOfflineMessageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7c2c('0x60')],'as':_0x7c2c('0x61')}]});})[_0x7c2c('0xe')](function(_0x8f8b42){_0x12c9cd['message']=_0x8f8b42;if(_0x12c9cd[_0x7c2c('0x58')]['UserId']){return db[_0x7c2c('0x62')]['find']({'attributes':['id',_0x7c2c('0x63')],'where':{'id':_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x64')]}})[_0x7c2c('0xe')](function(_0x43eb9d){if(_0x43eb9d){_0x12c9cd[_0x7c2c('0x42')][_0x7c2c('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43eb9d[_0x7c2c('0x63')]+','+(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x66')]||0xa),'interval':_0x7c2c('0x67')});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);})['then'](function(_0x2d75b8){_0x18e288(_0x2d75b8);})[_0x7c2c('0x19')](function(_0x2391a7){_0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,_0x2391a7[_0x7c2c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index b63ba72..0065202 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 _0x9089=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x19f270,_0x8d9162){var _0x4a6130=function(_0x41d1a8){while(--_0x41d1a8){_0x19f270['push'](_0x19f270['shift']());}};_0x4a6130(++_0x8d9162);}(_0x9089,0xf6));var _0x9908=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x9089[_0x22bdd3];return _0x44d9d9;};'use strict';var MailAccountEvents=require(_0x9908('0x0'));var events=[_0x9908('0x1'),'remove',_0x9908('0x2')];function createListener(_0x5f0406,_0x4cbe52){return function(_0x11a266){_0x4cbe52[_0x9908('0x3')](_0x5f0406,_0x11a266);};}function removeListener(_0x13d80a,_0xfb5138){return function(){MailAccountEvents[_0x9908('0x4')](_0x13d80a,_0xfb5138);};}exports[_0x9908('0x5')]=function(_0x4a139c){for(var _0x36c8b4=0x0,_0x2bd694=events[_0x9908('0x6')];_0x36c8b4<_0x2bd694;_0x36c8b4++){var _0x523fae=events[_0x36c8b4];var _0x491630=createListener(_0x9908('0x7')+_0x523fae,_0x4a139c);MailAccountEvents['on'](_0x523fae,_0x491630);}}; \ No newline at end of file +var _0xf443=['./mailAccount.events','remove','update','emit','removeListener','register','length','mailAccount:'];(function(_0x2433e7,_0x3430a1){var _0x5a4919=function(_0x4bef63){while(--_0x4bef63){_0x2433e7['push'](_0x2433e7['shift']());}};_0x5a4919(++_0x3430a1);}(_0xf443,0x1c8));var _0x3f44=function(_0x49c30e,_0x40422c){_0x49c30e=_0x49c30e-0x0;var _0x155bf6=_0xf443[_0x49c30e];return _0x155bf6;};'use strict';var MailAccountEvents=require(_0x3f44('0x0'));var events=['save',_0x3f44('0x1'),_0x3f44('0x2')];function createListener(_0x4dd238,_0x21bf46){return function(_0x41c3d2){_0x21bf46[_0x3f44('0x3')](_0x4dd238,_0x41c3d2);};}function removeListener(_0x8ada15,_0x29d527){return function(){MailAccountEvents[_0x3f44('0x4')](_0x8ada15,_0x29d527);};}exports[_0x3f44('0x5')]=function(_0xbb2707){for(var _0x22d56a=0x0,_0x52c70d=events[_0x3f44('0x6')];_0x22d56a<_0x52c70d;_0x22d56a++){var _0x905c6d=events[_0x22d56a];var _0x5d8256=createListener(_0x3f44('0x7')+_0x905c6d,_0xbb2707);MailAccountEvents['on'](_0x905c6d,_0x5d8256);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5480751..9c3dd97 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 _0x7fdf=['multer','util','path','connect-timeout','express','Router','fs-extra','./mailApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports'];(function(_0x3a8cee,_0x2a3454){var _0x2ef4e3=function(_0x51798f){while(--_0x51798f){_0x3a8cee['push'](_0x3a8cee['shift']());}};_0x2ef4e3(++_0x2a3454);}(_0x7fdf,0x10e));var _0xf7fd=function(_0x54deb9,_0x53e74b){_0x54deb9=_0x54deb9-0x0;var _0x5da9aa=_0x7fdf[_0x54deb9];return _0x5da9aa;};'use strict';var multer=require(_0xf7fd('0x0'));var util=require(_0xf7fd('0x1'));var path=require(_0xf7fd('0x2'));var timeout=require(_0xf7fd('0x3'));var express=require(_0xf7fd('0x4'));var router=express[_0xf7fd('0x5')]();var fs_extra=require(_0xf7fd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf7fd('0x7'));router[_0xf7fd('0x8')](_0xf7fd('0x9'),auth[_0xf7fd('0xa')](),controller[_0xf7fd('0xb')]);router[_0xf7fd('0xc')](_0xf7fd('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf7fd('0x9'),auth[_0xf7fd('0xa')](),controller[_0xf7fd('0xd')]);module[_0xf7fd('0xe')]=router; \ No newline at end of file +var _0x2078=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','update','multer','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2078,0x1a2));var _0x8207=function(_0x2ad8ce,_0x44a5e7){_0x2ad8ce=_0x2ad8ce-0x0;var _0x507323=_0x2078[_0x2ad8ce];return _0x507323;};'use strict';var multer=require(_0x8207('0x0'));var util=require(_0x8207('0x1'));var path=require('path');var timeout=require(_0x8207('0x2'));var express=require('express');var router=express[_0x8207('0x3')]();var fs_extra=require(_0x8207('0x4'));var auth=require(_0x8207('0x5'));var interaction=require(_0x8207('0x6'));var config=require(_0x8207('0x7'));var controller=require(_0x8207('0x8'));router[_0x8207('0x9')](_0x8207('0xa'),auth[_0x8207('0xb')](),controller[_0x8207('0xc')]);router['put'](_0x8207('0xa'),auth[_0x8207('0xb')](),controller[_0x8207('0xd')]);router['delete'](_0x8207('0xa'),auth[_0x8207('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 934fd5c..e5ddec1 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 _0x18c8=['STRING','sequelize','exports','INTEGER'];(function(_0xe684c3,_0x454e64){var _0x3c14dd=function(_0x5da48b){while(--_0x5da48b){_0xe684c3['push'](_0xe684c3['shift']());}};_0x3c14dd(++_0x454e64);}(_0x18c8,0x129));var _0x818c=function(_0x372ab6,_0x1b9e57){_0x372ab6=_0x372ab6-0x0;var _0x14b88f=_0x18c8[_0x372ab6];return _0x14b88f;};'use strict';var Sequelize=require(_0x818c('0x0'));module[_0x818c('0x1')]={'priority':{'type':Sequelize[_0x818c('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x818c('0x3')]},'interval':{'type':Sequelize[_0x818c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5865=['STRING','sequelize','INTEGER'];(function(_0xea53cd,_0x49e9d2){var _0x163561=function(_0x2667aa){while(--_0x2667aa){_0xea53cd['push'](_0xea53cd['shift']());}};_0x163561(++_0x49e9d2);}(_0x5865,0x193));var _0x5586=function(_0x10eb44,_0x3c6d28){_0x10eb44=_0x10eb44-0x0;var _0xba7303=_0x5865[_0x10eb44];return _0xba7303;};'use strict';var Sequelize=require(_0x5586('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5586('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5586('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5586('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f0cba96..62c2f20 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3af21a,_0x41400d){var _0x31334b=function(_0x53b37a){while(--_0x53b37a){_0x3af21a['push'](_0x3af21a['shift']());}};_0x31334b(++_0x41400d);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xedd9,0xfc));var _0x9edd=function(_0x469f66,_0x2daba6){_0x469f66=_0x469f66-0x0;var _0x442f79=_0xedd9[_0x469f66];return _0x442f79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 707d4de..f27abc5 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 _0x1832=['path','rimraf','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x42ad3e,_0x3d9d3d){var _0x49a20e=function(_0x5324b6){while(--_0x5324b6){_0x42ad3e['push'](_0x42ad3e['shift']());}};_0x49a20e(++_0x3d9d3d);}(_0x1832,0x125));var _0x2183=function(_0x3c64e3,_0xa3c98){_0x3c64e3=_0x3c64e3-0x0;var _0x3e7e20=_0x1832[_0x3c64e3];return _0x3e7e20;};'use strict';var _=require(_0x2183('0x0'));var util=require(_0x2183('0x1'));var logger=require(_0x2183('0x2'))(_0x2183('0x3'));var moment=require(_0x2183('0x4'));var BPromise=require(_0x2183('0x5'));var rp=require(_0x2183('0x6'));var fs=require('fs');var path=require(_0x2183('0x7'));var rimraf=require(_0x2183('0x8'));var config=require('../../config/environment');var attributes=require(_0x2183('0x9'));module['exports']=function(_0x3fe72a,_0x26ca38){return _0x3fe72a[_0x2183('0xa')](_0x2183('0xb'),attributes,{'tableName':_0x2183('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2183('0xd'),'collate':_0x2183('0xe')});}; \ No newline at end of file +var _0xf0f4=['../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5d927b,_0x2d7eb8){var _0x5438d4=function(_0x353fe5){while(--_0x353fe5){_0x5d927b['push'](_0x5d927b['shift']());}};_0x5438d4(++_0x2d7eb8);}(_0xf0f4,0x13e));var _0x4f0f=function(_0x1e8a44,_0x595f07){_0x1e8a44=_0x1e8a44-0x0;var _0x585ad3=_0xf0f4[_0x1e8a44];return _0x585ad3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f0f('0x0'))(_0x4f0f('0x1'));var moment=require(_0x4f0f('0x2'));var BPromise=require(_0x4f0f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0f('0x4'));var rimraf=require(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var attributes=require(_0x4f0f('0x7'));module['exports']=function(_0x2d5722,_0x33ceef){return _0x2d5722[_0x4f0f('0x8')](_0x4f0f('0x9'),attributes,{'tableName':_0x4f0f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4f0f('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 764c3b8..5ae9697 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 _0x91f6=['request\x20sent','debug','error','message','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','MailApplication,\x20%s,\x20%s'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x91f6,0x1ae));var _0x691f=function(_0x251e03,_0x33ab0a){_0x251e03=_0x251e03-0x0;var _0x32683e=_0x91f6[_0x251e03];return _0x32683e;};'use strict';var _=require(_0x691f('0x0'));var util=require(_0x691f('0x1'));var moment=require(_0x691f('0x2'));var BPromise=require(_0x691f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x691f('0x4'));var db=require(_0x691f('0x5'))['db'];var utils=require(_0x691f('0x6'));var logger=require('../../config/logger')(_0x691f('0x7'));var config=require(_0x691f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x691f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9bfc9d,_0x12f8aa,_0x597dbb){return new BPromise(function(_0x1e85fe,_0x188379){return client['request'](_0x9bfc9d,_0x597dbb)[_0x691f('0xa')](function(_0x5f27eb){logger['info'](_0x691f('0xb'),_0x12f8aa,_0x691f('0xc'));logger[_0x691f('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x12f8aa,_0x691f('0xc'),JSON['stringify'](_0x5f27eb));if(_0x5f27eb[_0x691f('0xe')]){if(_0x5f27eb[_0x691f('0xe')]['code']===0x1f4){logger[_0x691f('0xe')](_0x691f('0xb'),_0x12f8aa,_0x5f27eb['error'][_0x691f('0xf')]);return _0x188379(_0x5f27eb['error'][_0x691f('0xf')]);}logger[_0x691f('0xe')](_0x691f('0xb'),_0x12f8aa,_0x5f27eb['error'][_0x691f('0xf')]);return _0x1e85fe(_0x5f27eb[_0x691f('0xe')][_0x691f('0xf')]);}else{logger['info'](_0x691f('0xb'),_0x12f8aa,'request\x20sent');_0x1e85fe(_0x5f27eb['result'][_0x691f('0xf')]);}})['catch'](function(_0x3b9242){logger['error']('MailApplication,\x20%s,\x20%s',_0x12f8aa,_0x3b9242);_0x188379(_0x3b9242);});});}exports[_0x691f('0x10')]=function(_0x392119){var _0x7abbbf=this;return new Promise(function(_0x1c9183,_0x35d648){return db[_0x691f('0x11')]['update'](_0x392119[_0x691f('0x12')],{'raw':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392119[_0x691f('0x13')]?_0x392119['options'][_0x691f('0x15')]||null:null,'attributes':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x16')]||null:null,'limit':_0x392119[_0x691f('0x13')]?_0x392119[_0x691f('0x13')][_0x691f('0x17')]||null:null})[_0x691f('0xa')](function(_0x483051){logger[_0x691f('0x18')]('UpdateMailApplication',_0x392119);logger['debug'](_0x691f('0x10'),_0x392119,JSON[_0x691f('0x19')](_0x483051));_0x1c9183(_0x483051);})['catch'](function(_0x38d028){logger[_0x691f('0xe')](_0x691f('0x10'),_0x38d028[_0x691f('0xf')],_0x392119);_0x35d648(_0x7abbbf['error'](0x1f4,_0x38d028[_0x691f('0xf')]));});});}; \ No newline at end of file +var _0x28e1=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','then','lodash','util','moment'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x28e1,0xcf));var _0x128e=function(_0x19eba9,_0xc0a946){_0x19eba9=_0x19eba9-0x0;var _0x20a59b=_0x28e1[_0x19eba9];return _0x20a59b;};'use strict';var _=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var moment=require(_0x128e('0x2'));var BPromise=require('bluebird');var rs=require(_0x128e('0x3'));var fs=require('fs');var Redis=require(_0x128e('0x4'));var db=require(_0x128e('0x5'))['db'];var utils=require(_0x128e('0x6'));var logger=require('../../config/logger')(_0x128e('0x7'));var config=require('../../config/environment');var jayson=require(_0x128e('0x8'));var client=jayson[_0x128e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x527bb1,_0x495357,_0x438d37){return new BPromise(function(_0x1a8c08,_0x51de99){return client[_0x128e('0xa')](_0x527bb1,_0x438d37)['then'](function(_0x2815ce){logger['info'](_0x128e('0xb'),_0x495357,_0x128e('0xc'));logger[_0x128e('0xd')](_0x128e('0xe'),_0x495357,_0x128e('0xc'),JSON[_0x128e('0xf')](_0x2815ce));if(_0x2815ce[_0x128e('0x10')]){if(_0x2815ce[_0x128e('0x10')][_0x128e('0x11')]===0x1f4){logger['error'](_0x128e('0xb'),_0x495357,_0x2815ce[_0x128e('0x10')][_0x128e('0x12')]);return _0x51de99(_0x2815ce['error'][_0x128e('0x12')]);}logger[_0x128e('0x10')]('MailApplication,\x20%s,\x20%s',_0x495357,_0x2815ce['error'][_0x128e('0x12')]);return _0x1a8c08(_0x2815ce[_0x128e('0x10')][_0x128e('0x12')]);}else{logger[_0x128e('0x13')](_0x128e('0xb'),_0x495357,_0x128e('0xc'));_0x1a8c08(_0x2815ce[_0x128e('0x14')][_0x128e('0x12')]);}})[_0x128e('0x15')](function(_0x2f5659){logger[_0x128e('0x10')]('MailApplication,\x20%s,\x20%s',_0x495357,_0x2f5659);_0x51de99(_0x2f5659);});});}exports[_0x128e('0x16')]=function(_0x330ea7){var _0x56ec26=this;return new Promise(function(_0x160869,_0x547d64){return db[_0x128e('0x17')][_0x128e('0x18')](_0x330ea7[_0x128e('0x19')],{'raw':_0x330ea7[_0x128e('0x1a')]?_0x330ea7['options'][_0x128e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x330ea7[_0x128e('0x1a')]?_0x330ea7[_0x128e('0x1a')]['where']||null:null,'attributes':_0x330ea7['options']?_0x330ea7[_0x128e('0x1a')][_0x128e('0x1c')]||null:null,'limit':_0x330ea7[_0x128e('0x1a')]?_0x330ea7[_0x128e('0x1a')]['limit']||null:null})[_0x128e('0x1d')](function(_0x5cd5e3){logger['info']('UpdateMailApplication',_0x330ea7);logger[_0x128e('0xd')](_0x128e('0x16'),_0x330ea7,JSON[_0x128e('0xf')](_0x5cd5e3));_0x160869(_0x5cd5e3);})['catch'](function(_0x56e6c0){logger[_0x128e('0x10')](_0x128e('0x16'),_0x56e6c0[_0x128e('0x12')],_0x330ea7);_0x547d64(_0x56ec26[_0x128e('0x10')](0x1f4,_0x56e6c0['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 850c39c..0fbed6a 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 _0x53ce=['exports','express','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','destroy','delete','removeTags'];(function(_0x500c3d,_0x17e169){var _0x418e4b=function(_0x1f5aa0){while(--_0x1f5aa0){_0x500c3d['push'](_0x500c3d['shift']());}};_0x418e4b(++_0x17e169);}(_0x53ce,0x139));var _0xe53c=function(_0x2efbc1,_0x3f9bc1){_0x2efbc1=_0x2efbc1-0x0;var _0x569b09=_0x53ce[_0x2efbc1];return _0x569b09;};'use strict';var express=require(_0xe53c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe53c('0x1'));var controller=require('./mailInteraction.controller');router[_0xe53c('0x2')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe53c('0x2')](_0xe53c('0x3'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x5')]);router['get'](_0xe53c('0x6'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x7')]);router[_0xe53c('0x2')](_0xe53c('0x8'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x9')]);router['get'](_0xe53c('0xa'),auth[_0xe53c('0x4')](),controller[_0xe53c('0xb')]);router['post']('/',auth[_0xe53c('0x4')](),controller[_0xe53c('0xc')]);router[_0xe53c('0xd')](_0xe53c('0x8'),auth[_0xe53c('0x4')](),controller[_0xe53c('0xe')]);router[_0xe53c('0xd')](_0xe53c('0xf'),auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')](_0xe53c('0x11'),'mailinteraction:addtags'),controller[_0xe53c('0x12')]);router[_0xe53c('0x13')](_0xe53c('0x6'),auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')](_0xe53c('0x11'),_0xe53c('0x14')),controller[_0xe53c('0x15')]);router['delete']('/:id',auth[_0xe53c('0x4')](),interaction[_0xe53c('0x10')]('mail','mailinteraction:destroy'),controller[_0xe53c('0x16')]);router[_0xe53c('0x17')](_0xe53c('0xf'),auth[_0xe53c('0x4')](),controller[_0xe53c('0x18')]);module[_0xe53c('0x19')]=router; \ No newline at end of file +var _0x5fe8=['tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags'];(function(_0x276764,_0x16d12f){var _0x43d916=function(_0x1579f7){while(--_0x1579f7){_0x276764['push'](_0x276764['shift']());}};_0x43d916(++_0x16d12f);}(_0x5fe8,0x8c));var _0x85fe=function(_0x4750ac,_0x4ad64b){_0x4750ac=_0x4750ac-0x0;var _0x67de85=_0x5fe8[_0x4750ac];return _0x67de85;};'use strict';var express=require(_0x85fe('0x0'));var router=express[_0x85fe('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x85fe('0x2'));var controller=require(_0x85fe('0x3'));router[_0x85fe('0x4')]('/',auth['isAuthenticated'](),controller[_0x85fe('0x5')]);router['get'](_0x85fe('0x6'),auth[_0x85fe('0x7')](),controller[_0x85fe('0x8')]);router[_0x85fe('0x4')](_0x85fe('0x9'),auth[_0x85fe('0x7')](),controller[_0x85fe('0xa')]);router[_0x85fe('0x4')](_0x85fe('0xb'),auth[_0x85fe('0x7')](),controller[_0x85fe('0xc')]);router[_0x85fe('0x4')](_0x85fe('0xd'),auth[_0x85fe('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x85fe('0xe')]('/:id/messages',auth[_0x85fe('0x7')](),controller['addMessage']);router[_0x85fe('0xe')](_0x85fe('0xf'),auth[_0x85fe('0x7')](),interaction[_0x85fe('0x10')](_0x85fe('0x11'),_0x85fe('0x12')),controller[_0x85fe('0x13')]);router['put'](_0x85fe('0x9'),auth[_0x85fe('0x7')](),interaction[_0x85fe('0x10')]('mail',_0x85fe('0x14')),controller[_0x85fe('0x15')]);router[_0x85fe('0x16')](_0x85fe('0x9'),auth[_0x85fe('0x7')](),interaction[_0x85fe('0x10')](_0x85fe('0x11'),'mailinteraction:destroy'),controller[_0x85fe('0x17')]);router[_0x85fe('0x16')](_0x85fe('0xf'),auth[_0x85fe('0x7')](),controller[_0x85fe('0x18')]);module[_0x85fe('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d0355d7..2910a64 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 _0x1377=['iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','sequelize'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0x1377,0x15d));var _0x7137=function(_0x4c1b18,_0x24f802){_0x4c1b18=_0x4c1b18-0x0;var _0x5d7566=_0x1377[_0x4c1b18];return _0x5d7566;};'use strict';var Sequelize=require(_0x7137('0x0'));var iconv=require(_0x7137('0x1'));module[_0x7137('0x2')]={'closed':{'type':Sequelize[_0x7137('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7137('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7137('0x5')]},'inReplyTo':{'type':Sequelize[_0x7137('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x7137('0x6'))},'subject':{'type':Sequelize[_0x7137('0x7')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x7137('0x4')]},'substatus':{'type':Sequelize[_0x7137('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7137('0x8')]('in',_0x7137('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7137('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7137('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7137('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb6a9=['TEXT','long','DATE','ENUM','sequelize','iconv','BOOLEAN','STRING'];(function(_0x524ce0,_0x3670b2){var _0x38299f=function(_0x513ef4){while(--_0x513ef4){_0x524ce0['push'](_0x524ce0['shift']());}};_0x38299f(++_0x3670b2);}(_0xb6a9,0xc4));var _0x9b6a=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb6a9[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x9b6a('0x0'));var iconv=require(_0x9b6a('0x1'));module['exports']={'closed':{'type':Sequelize[_0x9b6a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9b6a('0x3')]},'secondDisposition':{'type':Sequelize[_0x9b6a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9b6a('0x3')]},'note':{'type':Sequelize[_0x9b6a('0x3')]},'inReplyTo':{'type':Sequelize[_0x9b6a('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9b6a('0x4')](_0x9b6a('0x5'))},'subject':{'type':Sequelize[_0x9b6a('0x4')]()},'attach':{'type':Sequelize[_0x9b6a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9b6a('0x6')]},'substatus':{'type':Sequelize[_0x9b6a('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9b6a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9b6a('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x9b6a('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9b6a('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 f2e5518..b0b9bf0 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 _0xffdc=['headers','Bcc','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','update','then','end','error','stack','name','send','index','map','MailInteraction','rawAttributes','type','findAll','mail','query','user','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','create','body','destroy','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','options','inlineCss','rows','setTags','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','server','format','transcript-%d-%s.zip','attachments','push','Attachment','from','bcc','subject','createdAt','get','mkdirSync','each','Messages','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x456429,_0x424e77){var _0x1ab1e1=function(_0xa19de6){while(--_0xa19de6){_0x456429['push'](_0x456429['shift']());}};_0x1ab1e1(++_0x424e77);}(_0xffdc,0xf2));var _0xcffd=function(_0x3b4691,_0x297c4d){_0x3b4691=_0x3b4691-0x0;var _0x5d4691=_0xffdc[_0x3b4691];return _0x5d4691;};'use strict';var emlformat=require(_0xcffd('0x0'));var rimraf=require(_0xcffd('0x1'));var zipdir=require('zip-dir');var moment=require(_0xcffd('0x2'));var BPromise=require(_0xcffd('0x3'));var util=require(_0xcffd('0x4'));var path=require(_0xcffd('0x5'));var fs=require('fs');var _=require(_0xcffd('0x6'));var juice=require(_0xcffd('0x7'));var Redis=require(_0xcffd('0x8'));var interaction=require(_0xcffd('0x9'));var qs=require(_0xcffd('0xa'));var logger=require(_0xcffd('0xb'))(_0xcffd('0xc'));var config=require(_0xcffd('0xd'));var db=require(_0xcffd('0xe'))['db'];var htmlEntities=require(_0xcffd('0xf'));config[_0xcffd('0x10')]=_[_0xcffd('0x11')](config[_0xcffd('0x10')],{'host':_0xcffd('0x12'),'port':0x18eb});var socket=require(_0xcffd('0x13'))(new Redis(config[_0xcffd('0x10')]));require(_0xcffd('0x14'))[_0xcffd('0x15')](socket);function respondWithStatusCode(_0x6869c9,_0x299ba3){_0x299ba3=_0x299ba3||0xcc;return function(_0x3aeea7){if(_0x3aeea7){return _0x6869c9[_0xcffd('0x16')](_0x299ba3);}return _0x6869c9[_0xcffd('0x17')](_0x299ba3)['end']();};}function respondWithResult(_0xc40145,_0x232c2a){_0x232c2a=_0x232c2a||0xc8;return function(_0x16b542){if(_0x16b542){return _0xc40145[_0xcffd('0x17')](_0x232c2a)['json'](_0x16b542);}};}function respondWithFilteredResult(_0x1e9144,_0x3038f4){return function(_0xfcedc9){if(_0xfcedc9){var _0x396971=typeof _0x3038f4[_0xcffd('0x18')]===_0xcffd('0x19')&&typeof _0x3038f4['limit']===_0xcffd('0x19');var _0x4648b6=_0xfcedc9[_0xcffd('0x1a')];var _0x533c4d=_0x396971?0x0:_0x3038f4['offset'];var _0x21cd46=_0x396971?_0xfcedc9[_0xcffd('0x1a')]:_0x3038f4[_0xcffd('0x18')]+_0x3038f4[_0xcffd('0x1b')];var _0x1ba2dc;if(_0x21cd46>=_0x4648b6){_0x21cd46=_0x4648b6;_0x1ba2dc=0xc8;}else{_0x1ba2dc=0xce;}_0x1e9144[_0xcffd('0x17')](_0x1ba2dc);return _0x1e9144[_0xcffd('0x1c')](_0xcffd('0x1d'),_0x533c4d+'-'+_0x21cd46+'/'+_0x4648b6)['json'](_0xfcedc9);}return null;};}function saveUpdates(_0x4d406a){return function(_0xed911){if(_0xed911){return _0xed911[_0xcffd('0x1e')](_0x4d406a)[_0xcffd('0x1f')](function(_0x3323c5){return _0x3323c5;});}return null;};}function removeEntity(_0x4652ce){return function(_0x275ec7){if(_0x275ec7){return _0x275ec7['destroy']()[_0xcffd('0x1f')](function(){_0x4652ce[_0xcffd('0x17')](0xcc)[_0xcffd('0x20')]();});}};}function handleEntityNotFound(_0x48af39){return function(_0x58f5c9){if(!_0x58f5c9){_0x48af39[_0xcffd('0x16')](0x194);}return _0x58f5c9;};}function handleError(_0x239f3,_0x186836){_0x186836=_0x186836||0x1f4;return function(_0x49aafe){logger[_0xcffd('0x21')](_0x49aafe[_0xcffd('0x22')]);if(_0x49aafe['name']){delete _0x49aafe[_0xcffd('0x23')];}_0x239f3['status'](_0x186836)[_0xcffd('0x24')](_0x49aafe);};}exports[_0xcffd('0x25')]=function(_0x458735,_0x3bd986){var _0x28e474={};var _0x1c476e=_[_0xcffd('0x26')](db[_0xcffd('0x27')][_0xcffd('0x28')],function(_0x5eaea3){return{'name':_0x5eaea3['fieldName'],'type':_0x5eaea3[_0xcffd('0x29')]['key']};});_0x28e474=qs['getOptions'](_0x1c476e,_0x458735);return interaction[_0xcffd('0x2a')](_0xcffd('0x2b'),_0x458735[_0xcffd('0x2c')],_0x458735[_0xcffd('0x2d')],_0x28e474,_0x1c476e)[_0xcffd('0x1f')](respondWithFilteredResult(_0x3bd986,_0x28e474))['catch'](handleError(_0x3bd986,null));};exports[_0xcffd('0x2e')]=function(_0x349bb3,_0x5199bd){var _0x45ce4d={'raw':![],'where':{'id':_0x349bb3[_0xcffd('0x2f')]['id']}},_0x1799cd={};_0x1799cd[_0xcffd('0x30')]=_['keys'](db[_0xcffd('0x27')]['rawAttributes']);_0x1799cd[_0xcffd('0x2c')]=_[_0xcffd('0x31')](_0x349bb3[_0xcffd('0x2c')]);_0x1799cd[_0xcffd('0x32')]=_[_0xcffd('0x33')](_0x1799cd[_0xcffd('0x30')],_0x1799cd[_0xcffd('0x2c')]);_0x45ce4d['attributes']=_[_0xcffd('0x33')](_0x1799cd[_0xcffd('0x30')],qs[_0xcffd('0x34')](_0x349bb3['query']['fields']));_0x45ce4d[_0xcffd('0x35')]=_0x45ce4d[_0xcffd('0x35')][_0xcffd('0x36')]?_0x45ce4d[_0xcffd('0x35')]:_0x1799cd[_0xcffd('0x30')];if(_0x349bb3[_0xcffd('0x2c')][_0xcffd('0x37')]){_0x45ce4d[_0xcffd('0x38')]=[{'all':!![]}];}_0x45ce4d=_[_0xcffd('0x39')]({},_0x45ce4d,_0x349bb3['options']);return db['MailInteraction'][_0xcffd('0x3a')](_0x45ce4d)[_0xcffd('0x1f')](handleEntityNotFound(_0x5199bd,null))[_0xcffd('0x1f')](respondWithResult(_0x5199bd,null))[_0xcffd('0x3b')](handleError(_0x5199bd,null));};exports[_0xcffd('0x3c')]=function(_0x3b15c2,_0x302902){return db[_0xcffd('0x27')][_0xcffd('0x3c')](_0x3b15c2[_0xcffd('0x3d')],{})[_0xcffd('0x1f')](respondWithResult(_0x302902,0xc9))[_0xcffd('0x3b')](handleError(_0x302902,null));};exports['update']=function(_0xce38f9,_0x283dc5){if(_0xce38f9[_0xcffd('0x3d')]['id']){delete _0xce38f9[_0xcffd('0x3d')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0xce38f9[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x283dc5,null))[_0xcffd('0x1f')](saveUpdates(_0xce38f9[_0xcffd('0x3d')],null))[_0xcffd('0x1f')](respondWithResult(_0x283dc5,null))['catch'](handleError(_0x283dc5,null));};exports[_0xcffd('0x3e')]=function(_0x4a46b2,_0x38b479){return db['MailInteraction'][_0xcffd('0x3a')]({'where':{'id':_0x4a46b2[_0xcffd('0x2f')]['id']}})['then'](handleEntityNotFound(_0x38b479,null))[_0xcffd('0x1f')](removeEntity(_0x38b479,null))[_0xcffd('0x3b')](handleError(_0x38b479,null));};exports['describe']=function(_0x13b44b,_0x2fd9a2){return db[_0xcffd('0x27')]['describe']()[_0xcffd('0x1f')](respondWithResult(_0x2fd9a2,null))[_0xcffd('0x3b')](handleError(_0x2fd9a2,null));};exports[_0xcffd('0x3f')]=function(_0x2b42e5,_0x48ab00){return db[_0xcffd('0x40')][_0xcffd('0x3a')]({'where':{'id':_0x2b42e5['params']['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x48ab00,null))[_0xcffd('0x1f')](function(_0x32fc7b){if(_0x32fc7b){return _0x32fc7b[_0xcffd('0x3f')](_0x2b42e5[_0xcffd('0x3d')][_0xcffd('0x41')],_[_0xcffd('0x42')](_0x2b42e5[_0xcffd('0x3d')],[_0xcffd('0x41'),'id'])||{});}})[_0xcffd('0x1f')](respondWithResult(_0x48ab00,null))[_0xcffd('0x3b')](handleError(_0x48ab00,null));};exports[_0xcffd('0x43')]=function(_0x14a952,_0x131881){var _0x4a8ae4={'raw':![],'where':{}};var _0x2277f5={};var _0x17ce3d={'count':0x0,'rows':[]};return db['MailInteraction'][_0xcffd('0x44')]({'where':{'id':_0x14a952[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x131881,null))[_0xcffd('0x1f')](function(_0x1b1365){if(_0x1b1365){_0x2277f5[_0xcffd('0x30')]=_[_0xcffd('0x31')](db[_0xcffd('0x40')][_0xcffd('0x28')]);_0x2277f5[_0xcffd('0x2c')]=_[_0xcffd('0x31')](_0x14a952['query']);_0x2277f5[_0xcffd('0x32')]=_[_0xcffd('0x33')](_0x2277f5[_0xcffd('0x30')],_0x2277f5['query']);_0x4a8ae4['attributes']=_[_0xcffd('0x33')](_0x2277f5[_0xcffd('0x30')],qs[_0xcffd('0x34')](_0x14a952[_0xcffd('0x2c')][_0xcffd('0x34')]));_0x4a8ae4[_0xcffd('0x35')]=_0x4a8ae4[_0xcffd('0x35')][_0xcffd('0x36')]?_0x4a8ae4['attributes']:_0x2277f5[_0xcffd('0x30')];if(!_0x14a952['query'][_0xcffd('0x45')](_0xcffd('0x46'))){_0x4a8ae4['limit']=qs[_0xcffd('0x1b')](_0x14a952['query']['limit']);_0x4a8ae4['offset']=qs['offset'](_0x14a952[_0xcffd('0x2c')][_0xcffd('0x18')]);}_0x4a8ae4[_0xcffd('0x47')]=qs[_0xcffd('0x48')](_0x14a952['query']['sort']);_0x4a8ae4[_0xcffd('0x49')]=qs['filters'](_['pick'](_0x14a952[_0xcffd('0x2c')],_0x2277f5['filters']));_0x4a8ae4['where'][_0xcffd('0x4a')]=_0x1b1365['id'];if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4b')]){_0x4a8ae4[_0xcffd('0x49')]=_['merge'](_0x4a8ae4['where'],{'$or':_['map'](_0x4a8ae4[_0xcffd('0x35')],function(_0x2cc6c3){var _0x47a931={};_0x47a931[_0x2cc6c3]={'$like':'%'+_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4b')]+'%'};return _0x47a931;})});}if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4c')]){var _0x2d2a60=_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4c')][_0xcffd('0x4d')](',');var _0x53c66e={};_0x53c66e[_0x2d2a60[0x0]]={'$gte':moment(_0x2d2a60[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a8ae4[_0xcffd('0x49')]=_['merge'](_0x4a8ae4[_0xcffd('0x49')],_0x53c66e);}_0x4a8ae4=_['merge']({},_0x4a8ae4,_0x14a952[_0xcffd('0x4e')]);return db['MailMessage']['count']({'where':_0x4a8ae4[_0xcffd('0x49')]})[_0xcffd('0x1f')](function(_0x5cfd9b){_0x17ce3d[_0xcffd('0x1a')]=_0x5cfd9b;if(_0x14a952[_0xcffd('0x2c')]['includeAll']){_0x4a8ae4[_0xcffd('0x38')]=[{'all':!![]}];}return db[_0xcffd('0x40')][_0xcffd('0x2a')](_0x4a8ae4);})[_0xcffd('0x1f')](function(_0x59b7d3){if(_0x14a952[_0xcffd('0x2c')][_0xcffd('0x4f')]==='true'){for(var _0x577b91=0x0;_0x577b91<_0x59b7d3[_0xcffd('0x36')];_0x577b91++){_0x59b7d3[_0x577b91]['body']=juice(_0x59b7d3[_0x577b91][_0xcffd('0x3d')]);}}_0x17ce3d[_0xcffd('0x50')]=_0x59b7d3;return _0x17ce3d;});}})[_0xcffd('0x1f')](respondWithFilteredResult(_0x131881,_0x4a8ae4))[_0xcffd('0x3b')](handleError(_0x131881,null));};exports['addTags']=function(_0x468a70,_0x5b9210){return db['MailInteraction'][_0xcffd('0x3a')]({'where':{'id':_0x468a70[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0x5b9210,null))[_0xcffd('0x1f')](function(_0x431c15){if(_0x431c15){return _0x431c15[_0xcffd('0x51')](_0x468a70[_0xcffd('0x3d')][_0xcffd('0x41')],_['omit'](_0x468a70[_0xcffd('0x3d')],[_0xcffd('0x41'),'id'])||{})['spread'](function(){return db[_0xcffd('0x52')][_0xcffd('0x2a')]({'attributes':['id',_0xcffd('0x23'),'color'],'where':{'id':_0x468a70[_0xcffd('0x3d')][_0xcffd('0x41')]}});})['then'](function(_0x5d573a){socket[_0xcffd('0x53')](_0xcffd('0x54'),{'id':Number(_0x468a70[_0xcffd('0x2f')]['id']),'tags':_0x5d573a||[]});return{'id':Number(_0x468a70[_0xcffd('0x2f')]['id']),'tags':_0x5d573a||[]};});}})[_0xcffd('0x1f')](respondWithResult(_0x5b9210,null))['catch'](handleError(_0x5b9210,null));};exports[_0xcffd('0x55')]=function(_0x34b4be,_0xba121c){return db[_0xcffd('0x27')]['find']({'where':{'id':_0x34b4be[_0xcffd('0x2f')]['id']}})[_0xcffd('0x1f')](handleEntityNotFound(_0xba121c,null))[_0xcffd('0x1f')](function(_0x4368fb){if(_0x4368fb){return _0x4368fb[_0xcffd('0x55')](_0x34b4be[_0xcffd('0x2c')][_0xcffd('0x41')]);}})[_0xcffd('0x1f')](respondWithStatusCode(_0xba121c,null))[_0xcffd('0x3b')](handleError(_0xba121c,null));};exports[_0xcffd('0x56')]=function(_0x443a7d,_0x2a5c77){var _0x394e7b=moment()[_0xcffd('0x57')]()[_0xcffd('0x58')]();var _0x513d7e=path[_0xcffd('0x59')](config[_0xcffd('0x5a')],'server',_0xcffd('0x5b'),'tmp');var _0x490374=path[_0xcffd('0x59')](config['root'],_0xcffd('0x5c'),_0xcffd('0x5b'),'attachments');var _0xba8af4=path[_0xcffd('0x59')](_0x513d7e,_0x394e7b);var _0xc474ac=util[_0xcffd('0x5d')](_0xcffd('0x5e'),_0x443a7d['params']['id'],_0x394e7b);var _0x3eda9c=path[_0xcffd('0x59')](_0x513d7e,_0xc474ac);var _0x4aafee=[];if(_0x443a7d[_0xcffd('0x2c')][_0xcffd('0x5f')]){_0x4aafee[_0xcffd('0x60')]({'model':db[_0xcffd('0x61')],'as':'Attachments','raw':!![]});}var _0x2d1ae5=[{'model':db[_0xcffd('0x40')],'as':'Messages','attributes':['id',_0xcffd('0x3d'),_0xcffd('0x62'),'to','cc',_0xcffd('0x63'),_0xcffd('0x64'),_0xcffd('0x65')],'where':{'secret':![]},'order':qs[_0xcffd('0x48')]('id'),'include':_0x4aafee}];return db[_0xcffd('0x27')]['find']({'where':{'id':_0x443a7d[_0xcffd('0x2f')]['id']},'include':_0x2d1ae5})[_0xcffd('0x1f')](handleEntityNotFound(_0x2a5c77,null))[_0xcffd('0x1f')](function(_0x48774d){if(_0x48774d&&_0x48774d['Messages']){var _0xcb2913=_0x48774d[_0xcffd('0x66')]({'plain':!![]});fs[_0xcffd('0x67')](_0xba8af4);return BPromise[_0xcffd('0x68')](_0xcb2913[_0xcffd('0x69')],function(_0x53bae0,_0x255cb1){var _0x41676b={'from':_0x53bae0['from'],'to':_0x53bae0['to']||_0xcffd('0x6a'),'subject':_0x53bae0[_0xcffd('0x64')],'html':htmlEntities[_0xcffd('0x6b')](_0x53bae0[_0xcffd('0x3d')]),'headers':{'Date':moment(_0x53bae0[_0xcffd('0x65')])[_0xcffd('0x5d')](_0xcffd('0x6c'))},'attachments':[]};if(_0x53bae0['cc']){_0x41676b['headers']['Cc']=_0x53bae0['cc'];}if(_0x53bae0['bcc']){_0x41676b[_0xcffd('0x6d')][_0xcffd('0x6e')]=_0x53bae0[_0xcffd('0x63')];}return new BPromise(function(_0x248e5b,_0x4e20b1){if(_0x53bae0[_0xcffd('0x6f')]){for(var _0x12f197=0x0;_0x12f197<_0x53bae0[_0xcffd('0x6f')][_0xcffd('0x36')];_0x12f197++){var _0x447a47=_0x53bae0[_0xcffd('0x6f')][_0x12f197];var _0x51d378=path['join'](_0x490374,_0x447a47[_0xcffd('0x70')]);if(fs[_0xcffd('0x71')](_0x51d378)){_0x41676b[_0xcffd('0x5f')]['push']({'name':_0x447a47[_0xcffd('0x23')],'contentType':_0x447a47[_0xcffd('0x29')],'data':fs['readFileSync'](_0x51d378)});}}}emlformat[_0xcffd('0x72')](_0x41676b,function(_0x9d6794,_0x83970f){if(_0x9d6794)return _0x4e20b1(_0x9d6794);fs[_0xcffd('0x73')](path[_0xcffd('0x59')](_0xba8af4,util[_0xcffd('0x5d')](_0xcffd('0x74'),_0x255cb1)),_0x83970f);return _0x248e5b(_0x83970f);});});})[_0xcffd('0x1f')](function(){return new BPromise(function(_0x117865,_0x40acfc){zipdir(_0xba8af4,{'saveTo':_0x3eda9c},function(_0x3cb65d,_0xd8f236){if(_0x3cb65d)return _0x40acfc(_0x3cb65d);return _0x117865(_0xd8f236);});})['then'](function(){return new BPromise(function(_0x313666,_0x2c882f){rimraf(_0xba8af4,function(_0x2b590b){if(_0x2b590b)_0x2c882f(_0x2b590b);return _0x313666();});});})['then'](function(){return _0x2a5c77['download'](_0x3eda9c,_0xc474ac,function(_0x1fe907){if(!_0x1fe907)fs['unlinkSync'](_0x3eda9c);});});});}else{return _0x2a5c77[_0xcffd('0x16')](0xc8);}})[_0xcffd('0x3b')](handleError(_0x2a5c77,null));}; \ No newline at end of file +var _0xe5da=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','end','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','findAll','query','user','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','omit','ids','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','mkdirSync','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','path','juice','ioredis'];(function(_0x443fe6,_0xcc1e25){var _0x1dfbee=function(_0x4263a0){while(--_0x4263a0){_0x443fe6['push'](_0x443fe6['shift']());}};_0x1dfbee(++_0xcc1e25);}(_0xe5da,0x6c));var _0xae5d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe5da[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xae5d('0x0'));var rimraf=require(_0xae5d('0x1'));var zipdir=require(_0xae5d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xae5d('0x3'));var path=require(_0xae5d('0x4'));var fs=require('fs');var _=require('lodash');var juice=require(_0xae5d('0x5'));var Redis=require(_0xae5d('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xae5d('0x7'));var logger=require(_0xae5d('0x8'))(_0xae5d('0x9'));var config=require('../../config/environment');var db=require(_0xae5d('0xa'))['db'];var htmlEntities=require(_0xae5d('0xb'));config[_0xae5d('0xc')]=_[_0xae5d('0xd')](config[_0xae5d('0xc')],{'host':_0xae5d('0xe'),'port':0x18eb});var socket=require(_0xae5d('0xf'))(new Redis(config['redis']));require(_0xae5d('0x10'))[_0xae5d('0x11')](socket);function respondWithStatusCode(_0x164598,_0x39e188){_0x39e188=_0x39e188||0xcc;return function(_0x1100ab){if(_0x1100ab){return _0x164598[_0xae5d('0x12')](_0x39e188);}return _0x164598[_0xae5d('0x13')](_0x39e188)['end']();};}function respondWithResult(_0x59a005,_0x42b303){_0x42b303=_0x42b303||0xc8;return function(_0x2c3a9f){if(_0x2c3a9f){return _0x59a005[_0xae5d('0x13')](_0x42b303)[_0xae5d('0x14')](_0x2c3a9f);}};}function respondWithFilteredResult(_0x125eda,_0x358b5d){return function(_0x164c34){if(_0x164c34){var _0xbc9cf=typeof _0x358b5d[_0xae5d('0x15')]===_0xae5d('0x16')&&typeof _0x358b5d['limit']===_0xae5d('0x16');var _0x3cbc51=_0x164c34[_0xae5d('0x17')];var _0x20102d=_0xbc9cf?0x0:_0x358b5d[_0xae5d('0x15')];var _0xc12de4=_0xbc9cf?_0x164c34['count']:_0x358b5d[_0xae5d('0x15')]+_0x358b5d[_0xae5d('0x18')];var _0x28c06b;if(_0xc12de4>=_0x3cbc51){_0xc12de4=_0x3cbc51;_0x28c06b=0xc8;}else{_0x28c06b=0xce;}_0x125eda[_0xae5d('0x13')](_0x28c06b);return _0x125eda[_0xae5d('0x19')](_0xae5d('0x1a'),_0x20102d+'-'+_0xc12de4+'/'+_0x3cbc51)[_0xae5d('0x14')](_0x164c34);}return null;};}function saveUpdates(_0x104389){return function(_0x25e737){if(_0x25e737){return _0x25e737[_0xae5d('0x1b')](_0x104389)['then'](function(_0x39ce57){return _0x39ce57;});}return null;};}function removeEntity(_0xfc4520){return function(_0x763eb5){if(_0x763eb5){return _0x763eb5[_0xae5d('0x1c')]()[_0xae5d('0x1d')](function(){_0xfc4520[_0xae5d('0x13')](0xcc)[_0xae5d('0x1e')]();});}};}function handleEntityNotFound(_0xd38dc){return function(_0x22f4e7){if(!_0x22f4e7){_0xd38dc['sendStatus'](0x194);}return _0x22f4e7;};}function handleError(_0x390eca,_0x804eb9){_0x804eb9=_0x804eb9||0x1f4;return function(_0x265b80){logger[_0xae5d('0x1f')](_0x265b80[_0xae5d('0x20')]);if(_0x265b80[_0xae5d('0x21')]){delete _0x265b80[_0xae5d('0x21')];}_0x390eca[_0xae5d('0x13')](_0x804eb9)[_0xae5d('0x22')](_0x265b80);};}exports[_0xae5d('0x23')]=function(_0xdf1878,_0x1665ff){var _0x1a2639={};var _0x28b491=_[_0xae5d('0x24')](db[_0xae5d('0x25')][_0xae5d('0x26')],function(_0x183d8f){return{'name':_0x183d8f[_0xae5d('0x27')],'type':_0x183d8f[_0xae5d('0x28')]['key']};});_0x1a2639=qs['getOptions'](_0x28b491,_0xdf1878);return interaction[_0xae5d('0x29')]('mail',_0xdf1878[_0xae5d('0x2a')],_0xdf1878[_0xae5d('0x2b')],_0x1a2639,_0x28b491)[_0xae5d('0x1d')](respondWithFilteredResult(_0x1665ff,_0x1a2639))['catch'](handleError(_0x1665ff,null));};exports['show']=function(_0x42fc26,_0x30c460){var _0x1f2e66={'raw':![],'where':{'id':_0x42fc26[_0xae5d('0x2c')]['id']}},_0x3e1d30={};_0x3e1d30[_0xae5d('0x2d')]=_[_0xae5d('0x2e')](db[_0xae5d('0x25')][_0xae5d('0x26')]);_0x3e1d30['query']=_[_0xae5d('0x2e')](_0x42fc26[_0xae5d('0x2a')]);_0x3e1d30[_0xae5d('0x2f')]=_['intersection'](_0x3e1d30[_0xae5d('0x2d')],_0x3e1d30[_0xae5d('0x2a')]);_0x1f2e66[_0xae5d('0x30')]=_[_0xae5d('0x31')](_0x3e1d30[_0xae5d('0x2d')],qs[_0xae5d('0x32')](_0x42fc26[_0xae5d('0x2a')]['fields']));_0x1f2e66[_0xae5d('0x30')]=_0x1f2e66[_0xae5d('0x30')][_0xae5d('0x33')]?_0x1f2e66[_0xae5d('0x30')]:_0x3e1d30[_0xae5d('0x2d')];if(_0x42fc26[_0xae5d('0x2a')][_0xae5d('0x34')]){_0x1f2e66[_0xae5d('0x35')]=[{'all':!![]}];}_0x1f2e66=_[_0xae5d('0x36')]({},_0x1f2e66,_0x42fc26[_0xae5d('0x37')]);return db[_0xae5d('0x25')][_0xae5d('0x38')](_0x1f2e66)[_0xae5d('0x1d')](handleEntityNotFound(_0x30c460,null))[_0xae5d('0x1d')](respondWithResult(_0x30c460,null))[_0xae5d('0x39')](handleError(_0x30c460,null));};exports[_0xae5d('0x3a')]=function(_0x3028c3,_0x28b723){return db[_0xae5d('0x25')][_0xae5d('0x3a')](_0x3028c3[_0xae5d('0x3b')],{})[_0xae5d('0x1d')](respondWithResult(_0x28b723,0xc9))[_0xae5d('0x39')](handleError(_0x28b723,null));};exports[_0xae5d('0x1b')]=function(_0x56f863,_0x31eade){if(_0x56f863[_0xae5d('0x3b')]['id']){delete _0x56f863['body']['id'];}return db[_0xae5d('0x25')][_0xae5d('0x38')]({'where':{'id':_0x56f863[_0xae5d('0x2c')]['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x31eade,null))[_0xae5d('0x1d')](saveUpdates(_0x56f863[_0xae5d('0x3b')],null))[_0xae5d('0x1d')](respondWithResult(_0x31eade,null))['catch'](handleError(_0x31eade,null));};exports['destroy']=function(_0x3be962,_0x3fd703){return db[_0xae5d('0x25')][_0xae5d('0x38')]({'where':{'id':_0x3be962[_0xae5d('0x2c')]['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x3fd703,null))[_0xae5d('0x1d')](removeEntity(_0x3fd703,null))[_0xae5d('0x39')](handleError(_0x3fd703,null));};exports[_0xae5d('0x3c')]=function(_0x53ef79,_0x5f5773){return db[_0xae5d('0x25')][_0xae5d('0x3c')]()['then'](respondWithResult(_0x5f5773,null))[_0xae5d('0x39')](handleError(_0x5f5773,null));};exports[_0xae5d('0x3d')]=function(_0x1c7e54,_0x5537b9){return db['MailMessage'][_0xae5d('0x38')]({'where':{'id':_0x1c7e54['params']['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x5537b9,null))[_0xae5d('0x1d')](function(_0x1c9200){if(_0x1c9200){return _0x1c9200[_0xae5d('0x3d')](_0x1c7e54[_0xae5d('0x3b')]['ids'],_[_0xae5d('0x3e')](_0x1c7e54[_0xae5d('0x3b')],[_0xae5d('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x5537b9,null))['catch'](handleError(_0x5537b9,null));};exports['getMessages']=function(_0xb1ec6f,_0x374e54){var _0x22b23f={'raw':![],'where':{}};var _0x110ab6={};var _0x4f92fd={'count':0x0,'rows':[]};return db[_0xae5d('0x25')][_0xae5d('0x40')]({'where':{'id':_0xb1ec6f[_0xae5d('0x2c')]['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x374e54,null))[_0xae5d('0x1d')](function(_0x3493e4){if(_0x3493e4){_0x110ab6[_0xae5d('0x2d')]=_[_0xae5d('0x2e')](db[_0xae5d('0x41')][_0xae5d('0x26')]);_0x110ab6['query']=_[_0xae5d('0x2e')](_0xb1ec6f[_0xae5d('0x2a')]);_0x110ab6[_0xae5d('0x2f')]=_[_0xae5d('0x31')](_0x110ab6[_0xae5d('0x2d')],_0x110ab6[_0xae5d('0x2a')]);_0x22b23f['attributes']=_[_0xae5d('0x31')](_0x110ab6[_0xae5d('0x2d')],qs[_0xae5d('0x32')](_0xb1ec6f[_0xae5d('0x2a')]['fields']));_0x22b23f[_0xae5d('0x30')]=_0x22b23f[_0xae5d('0x30')][_0xae5d('0x33')]?_0x22b23f[_0xae5d('0x30')]:_0x110ab6[_0xae5d('0x2d')];if(!_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x42')](_0xae5d('0x43'))){_0x22b23f[_0xae5d('0x18')]=qs['limit'](_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x18')]);_0x22b23f[_0xae5d('0x15')]=qs[_0xae5d('0x15')](_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x15')]);}_0x22b23f[_0xae5d('0x44')]=qs[_0xae5d('0x45')](_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x45')]);_0x22b23f[_0xae5d('0x46')]=qs[_0xae5d('0x2f')](_[_0xae5d('0x47')](_0xb1ec6f[_0xae5d('0x2a')],_0x110ab6[_0xae5d('0x2f')]));_0x22b23f[_0xae5d('0x46')][_0xae5d('0x48')]=_0x3493e4['id'];if(_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x49')]){_0x22b23f[_0xae5d('0x46')]=_['merge'](_0x22b23f['where'],{'$or':_[_0xae5d('0x24')](_0x22b23f['attributes'],function(_0x3706a4){var _0x1e51b8={};_0x1e51b8[_0x3706a4]={'$like':'%'+_0xb1ec6f['query'][_0xae5d('0x49')]+'%'};return _0x1e51b8;})});}if(_0xb1ec6f[_0xae5d('0x2a')]['$gte']){var _0x160dbc=_0xb1ec6f['query'][_0xae5d('0x4a')][_0xae5d('0x4b')](',');var _0x2c66ff={};_0x2c66ff[_0x160dbc[0x0]]={'$gte':moment(_0x160dbc[0x1])['format'](_0xae5d('0x4c'))};_0x22b23f[_0xae5d('0x46')]=_[_0xae5d('0x36')](_0x22b23f[_0xae5d('0x46')],_0x2c66ff);}_0x22b23f=_['merge']({},_0x22b23f,_0xb1ec6f[_0xae5d('0x37')]);return db[_0xae5d('0x41')][_0xae5d('0x17')]({'where':_0x22b23f['where']})[_0xae5d('0x1d')](function(_0x4da0bb){_0x4f92fd[_0xae5d('0x17')]=_0x4da0bb;if(_0xb1ec6f[_0xae5d('0x2a')][_0xae5d('0x34')]){_0x22b23f['include']=[{'all':!![]}];}return db[_0xae5d('0x41')][_0xae5d('0x29')](_0x22b23f);})[_0xae5d('0x1d')](function(_0x3ef0ec){if(_0xb1ec6f[_0xae5d('0x2a')]['inlineCss']===_0xae5d('0x4d')){for(var _0x30b5c1=0x0;_0x30b5c1<_0x3ef0ec['length'];_0x30b5c1++){_0x3ef0ec[_0x30b5c1][_0xae5d('0x3b')]=juice(_0x3ef0ec[_0x30b5c1]['body']);}}_0x4f92fd[_0xae5d('0x4e')]=_0x3ef0ec;return _0x4f92fd;});}})['then'](respondWithFilteredResult(_0x374e54,_0x22b23f))[_0xae5d('0x39')](handleError(_0x374e54,null));};exports[_0xae5d('0x4f')]=function(_0x2473f8,_0x5597b9){return db[_0xae5d('0x25')][_0xae5d('0x38')]({'where':{'id':_0x2473f8[_0xae5d('0x2c')]['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x5597b9,null))[_0xae5d('0x1d')](function(_0x921042){if(_0x921042){return _0x921042[_0xae5d('0x50')](_0x2473f8['body'][_0xae5d('0x3f')],_[_0xae5d('0x3e')](_0x2473f8[_0xae5d('0x3b')],[_0xae5d('0x3f'),'id'])||{})[_0xae5d('0x51')](function(){return db['Tag'][_0xae5d('0x29')]({'attributes':['id',_0xae5d('0x21'),'color'],'where':{'id':_0x2473f8[_0xae5d('0x3b')][_0xae5d('0x3f')]}});})[_0xae5d('0x1d')](function(_0x45bf1c){socket[_0xae5d('0x52')](_0xae5d('0x53'),{'id':Number(_0x2473f8['params']['id']),'tags':_0x45bf1c||[]});return{'id':Number(_0x2473f8[_0xae5d('0x2c')]['id']),'tags':_0x45bf1c||[]};});}})['then'](respondWithResult(_0x5597b9,null))[_0xae5d('0x39')](handleError(_0x5597b9,null));};exports['removeTags']=function(_0x5c1a53,_0x4bb999){return db[_0xae5d('0x25')][_0xae5d('0x38')]({'where':{'id':_0x5c1a53[_0xae5d('0x2c')]['id']}})[_0xae5d('0x1d')](handleEntityNotFound(_0x4bb999,null))[_0xae5d('0x1d')](function(_0x1085f0){if(_0x1085f0){return _0x1085f0[_0xae5d('0x54')](_0x5c1a53['query'][_0xae5d('0x3f')]);}})[_0xae5d('0x1d')](respondWithStatusCode(_0x4bb999,null))[_0xae5d('0x39')](handleError(_0x4bb999,null));};exports[_0xae5d('0x55')]=function(_0x6a7ff4,_0x1f7424){var _0x4b8509=moment()[_0xae5d('0x56')]()[_0xae5d('0x57')]();var _0x21e435=path[_0xae5d('0x58')](config[_0xae5d('0x59')],_0xae5d('0x5a'),_0xae5d('0x5b'),_0xae5d('0x5c'));var _0x5cbd87=path['join'](config[_0xae5d('0x59')],_0xae5d('0x5a'),'files',_0xae5d('0x5d'));var _0x484e86=path[_0xae5d('0x58')](_0x21e435,_0x4b8509);var _0x32897f=util[_0xae5d('0x5e')](_0xae5d('0x5f'),_0x6a7ff4['params']['id'],_0x4b8509);var _0x5f30fa=path[_0xae5d('0x58')](_0x21e435,_0x32897f);var _0x17eae6=[];if(_0x6a7ff4[_0xae5d('0x2a')][_0xae5d('0x5d')]){_0x17eae6[_0xae5d('0x60')]({'model':db[_0xae5d('0x61')],'as':_0xae5d('0x62'),'raw':!![]});}var _0x384849=[{'model':db[_0xae5d('0x41')],'as':_0xae5d('0x63'),'attributes':['id',_0xae5d('0x3b'),_0xae5d('0x64'),'to','cc',_0xae5d('0x65'),_0xae5d('0x66'),'createdAt'],'where':{'secret':![]},'order':qs[_0xae5d('0x45')]('id'),'include':_0x17eae6}];return db[_0xae5d('0x25')][_0xae5d('0x38')]({'where':{'id':_0x6a7ff4[_0xae5d('0x2c')]['id']},'include':_0x384849})[_0xae5d('0x1d')](handleEntityNotFound(_0x1f7424,null))['then'](function(_0x2c0b71){if(_0x2c0b71&&_0x2c0b71['Messages']){var _0xb2cf7=_0x2c0b71['get']({'plain':!![]});fs[_0xae5d('0x67')](_0x484e86);return BPromise['each'](_0xb2cf7[_0xae5d('0x63')],function(_0x2aa8d4,_0x117724){var _0x4793d8={'from':_0x2aa8d4[_0xae5d('0x64')],'to':_0x2aa8d4['to']||'missing.recipient@your.company.com','subject':_0x2aa8d4[_0xae5d('0x66')],'html':htmlEntities[_0xae5d('0x68')](_0x2aa8d4['body']),'headers':{'Date':moment(_0x2aa8d4[_0xae5d('0x69')])[_0xae5d('0x5e')](_0xae5d('0x6a'))},'attachments':[]};if(_0x2aa8d4['cc']){_0x4793d8[_0xae5d('0x6b')]['Cc']=_0x2aa8d4['cc'];}if(_0x2aa8d4[_0xae5d('0x65')]){_0x4793d8[_0xae5d('0x6b')][_0xae5d('0x6c')]=_0x2aa8d4['bcc'];}return new BPromise(function(_0x42258b,_0x2eeba1){if(_0x2aa8d4[_0xae5d('0x62')]){for(var _0x5690dc=0x0;_0x5690dc<_0x2aa8d4[_0xae5d('0x62')][_0xae5d('0x33')];_0x5690dc++){var _0x1a527b=_0x2aa8d4['Attachments'][_0x5690dc];var _0x17bede=path[_0xae5d('0x58')](_0x5cbd87,_0x1a527b[_0xae5d('0x6d')]);if(fs[_0xae5d('0x6e')](_0x17bede)){_0x4793d8[_0xae5d('0x5d')][_0xae5d('0x60')]({'name':_0x1a527b['name'],'contentType':_0x1a527b[_0xae5d('0x28')],'data':fs[_0xae5d('0x6f')](_0x17bede)});}}}emlformat[_0xae5d('0x70')](_0x4793d8,function(_0x5d8b0b,_0x349f3e){if(_0x5d8b0b)return _0x2eeba1(_0x5d8b0b);fs['writeFileSync'](path[_0xae5d('0x58')](_0x484e86,util[_0xae5d('0x5e')](_0xae5d('0x71'),_0x117724)),_0x349f3e);return _0x42258b(_0x349f3e);});});})['then'](function(){return new BPromise(function(_0x2be659,_0x2681cd){zipdir(_0x484e86,{'saveTo':_0x5f30fa},function(_0x5e4ce9,_0x360e72){if(_0x5e4ce9)return _0x2681cd(_0x5e4ce9);return _0x2be659(_0x360e72);});})[_0xae5d('0x1d')](function(){return new BPromise(function(_0x118f65,_0x218839){rimraf(_0x484e86,function(_0x1dd26b){if(_0x1dd26b)_0x218839(_0x1dd26b);return _0x118f65();});});})[_0xae5d('0x1d')](function(){return _0x1f7424[_0xae5d('0x55')](_0x5f30fa,_0x32897f,function(_0x1c61ea){if(!_0x1c61ea)fs[_0xae5d('0x72')](_0x5f30fa);});});});}else{return _0x1f7424['sendStatus'](0xc8);}})[_0xae5d('0x39')](handleError(_0x1f7424,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a30727e..31f25bf 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 _0xfc63=['then','unreadMessages','length','catch','hasOwnProperty','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll'];(function(_0x4adb8a,_0x3d76de){var _0x13804c=function(_0x1886f7){while(--_0x1886f7){_0x4adb8a['push'](_0x4adb8a['shift']());}};_0x13804c(++_0x3d76de);}(_0xfc63,0x185));var _0x3fc6=function(_0x146a0b,_0x3e2164){_0x146a0b=_0x146a0b-0x0;var _0x2196b6=_0xfc63[_0x146a0b];return _0x2196b6;};'use strict';var EventEmitter=require(_0x3fc6('0x0'));var MailInteraction=require(_0x3fc6('0x1'))['db'][_0x3fc6('0x2')];var MailMessage=require(_0x3fc6('0x1'))['db'][_0x3fc6('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3fc6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fc6('0x5'),'afterDestroy':_0x3fc6('0x6')};function emitEvent(_0x2fdd6f){return function(_0x562df4,_0x4def29,_0x309b94){_0x562df4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2ff8a9){_0x562df4[_0x3fc6('0x7')](_0x3fc6('0x8'),_0x2ff8a9[_0x3fc6('0x9')](function(_0x456bd){return{'id':_0x456bd['id']};}));return MailMessage[_0x3fc6('0xa')]({'where':{'MailInteractionId':_0x562df4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3fc6('0xb')](function(_0x256d1e){_0x562df4[_0x3fc6('0x7')](_0x3fc6('0xc'),_0x256d1e[_0x3fc6('0xd')]);MailInteractionEvents['emit'](_0x2fdd6f+':'+_0x562df4['id'],_0x562df4);MailInteractionEvents['emit'](_0x2fdd6f,_0x562df4);_0x309b94(null);})[_0x3fc6('0xe')](_0x309b94(null));};}for(var e in events){if(events[_0x3fc6('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xc4f1=['then','setDataValue','Users','findAll','length','emit','hook','../../mysqldb','MailInteraction','MailMessage','remove','getUsers'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc4f1,0xf7));var _0x1c4f=function(_0x4743f8,_0x291e9c){_0x4743f8=_0x4743f8-0x0;var _0x5e9976=_0xc4f1[_0x4743f8];return _0x5e9976;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x1c4f('0x0'))['db'][_0x1c4f('0x1')];var MailMessage=require(_0x1c4f('0x0'))['db'][_0x1c4f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c4f('0x3')};function emitEvent(_0x5d0516){return function(_0x552685,_0x491f62,_0x31fc71){_0x552685[_0x1c4f('0x4')]({'attributes':['id'],'raw':!![]})[_0x1c4f('0x5')](function(_0x595dce){_0x552685[_0x1c4f('0x6')](_0x1c4f('0x7'),_0x595dce['map'](function(_0x232dd9){return{'id':_0x232dd9['id']};}));return MailMessage[_0x1c4f('0x8')]({'where':{'MailInteractionId':_0x552685['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c4f('0x5')](function(_0x153844){_0x552685[_0x1c4f('0x6')]('unreadMessages',_0x153844[_0x1c4f('0x9')]);MailInteractionEvents[_0x1c4f('0xa')](_0x5d0516+':'+_0x552685['id'],_0x552685);MailInteractionEvents[_0x1c4f('0xa')](_0x5d0516,_0x552685);_0x31fc71(null);})['catch'](_0x31fc71(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x1c4f('0xb')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0045c43..eec0150 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 _0x56ea=['api','moment','bluebird','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x31e4c1,_0x383bd2){var _0x537607=function(_0x54600e){while(--_0x54600e){_0x31e4c1['push'](_0x31e4c1['shift']());}};_0x537607(++_0x383bd2);}(_0x56ea,0x1da));var _0xa56e=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0x56ea[_0x26a906];return _0x495575;};'use strict';var _=require(_0xa56e('0x0'));var util=require(_0xa56e('0x1'));var logger=require('../../config/logger')(_0xa56e('0x2'));var moment=require(_0xa56e('0x3'));var BPromise=require(_0xa56e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa56e('0x5'));var attributes=require('./mailInteraction.attributes');module[_0xa56e('0x6')]=function(_0x3d54d8,_0x25b48e){return _0x3d54d8[_0xa56e('0x7')](_0xa56e('0x8'),attributes,{'tableName':_0xa56e('0x9'),'paranoid':![],'indexes':[{'name':_0xa56e('0xa'),'fields':[_0xa56e('0xb'),'to'],'type':_0xa56e('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5cd663,_0x37cc7e,_0x321991){if(_0x5cd663[_0xa56e('0xd')]){_0x5cd663[_0xa56e('0xe')]=moment()[_0xa56e('0xf')](_0xa56e('0x10'));}if(_0x5cd663[_0xa56e('0x11')]){_0x5cd663['closedAt']=moment()[_0xa56e('0xf')](_0xa56e('0x10'));}_0x321991(null,_0x37cc7e);},'beforeUpdate':function(_0x5e9984,_0x5c2c5a,_0x447196){if(_0x5e9984[_0xa56e('0x12')](_0xa56e('0xd'))){_0x5e9984[_0xa56e('0xe')]=_0x5e9984[_0xa56e('0xd')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x5e9984[_0xa56e('0x12')](_0xa56e('0x11'))){_0x5e9984[_0xa56e('0x13')]=moment()[_0xa56e('0xf')](_0xa56e('0x10'));_0x5e9984[_0xa56e('0xd')]=null;_0x5e9984['substatusAt']=null;}_0x447196(null,_0x5e9984);},'afterUpdate':function(_0x4dc7c4,_0x29bc5f,_0x2561a9){var _0x570f51=_0x3d54d8[_0xa56e('0x14')];var _0xfd88ea=_0x4dc7c4[_0xa56e('0x15')]({'plain':!![]});if(_0xfd88ea[_0xa56e('0x11')]){return _0x570f51[_0xa56e('0x16')][_0xa56e('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0xfd88ea['id']}})[_0xa56e('0x18')](function(){_0x2561a9();})[_0xa56e('0x19')](function(_0x228093){_0x2561a9(_0x228093);});}else{_0x2561a9();}}},'charset':_0xa56e('0x1a'),'collate':_0xa56e('0x1b')});}; \ No newline at end of file +var _0x1414=['mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define'];(function(_0x439944,_0x1f3226){var _0x4f395c=function(_0x5a2246){while(--_0x5a2246){_0x439944['push'](_0x439944['shift']());}};_0x4f395c(++_0x1f3226);}(_0x1414,0x1c5));var _0x4141=function(_0x23e4b5,_0x3b30a6){_0x23e4b5=_0x23e4b5-0x0;var _0x64799c=_0x1414[_0x23e4b5];return _0x64799c;};'use strict';var _=require(_0x4141('0x0'));var util=require(_0x4141('0x1'));var logger=require('../../config/logger')(_0x4141('0x2'));var moment=require(_0x4141('0x3'));var BPromise=require(_0x4141('0x4'));var rp=require(_0x4141('0x5'));var fs=require('fs');var path=require(_0x4141('0x6'));var rimraf=require('rimraf');var config=require(_0x4141('0x7'));var attributes=require(_0x4141('0x8'));module[_0x4141('0x9')]=function(_0xcd5200,_0x552c6c){return _0xcd5200[_0x4141('0xa')]('MailInteraction',attributes,{'tableName':_0x4141('0xb'),'paranoid':![],'indexes':[{'name':_0x4141('0xc'),'fields':[_0x4141('0xd'),'to'],'type':_0x4141('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdcb3ad,_0x28f0fb,_0xf20c6c){if(_0xdcb3ad[_0x4141('0xf')]){_0xdcb3ad[_0x4141('0x10')]=moment()[_0x4141('0x11')](_0x4141('0x12'));}if(_0xdcb3ad[_0x4141('0x13')]){_0xdcb3ad[_0x4141('0x14')]=moment()['format'](_0x4141('0x12'));}_0xf20c6c(null,_0x28f0fb);},'beforeUpdate':function(_0x272326,_0x8a0e0d,_0x244629){if(_0x272326[_0x4141('0x15')](_0x4141('0xf'))){_0x272326[_0x4141('0x10')]=_0x272326[_0x4141('0xf')]?moment()[_0x4141('0x11')](_0x4141('0x12')):null;}if(_0x272326[_0x4141('0x15')](_0x4141('0x13'))){_0x272326[_0x4141('0x14')]=moment()[_0x4141('0x11')](_0x4141('0x12'));_0x272326[_0x4141('0xf')]=null;_0x272326[_0x4141('0x10')]=null;}_0x244629(null,_0x272326);},'afterUpdate':function(_0x1710bd,_0x5216b7,_0x1b78cb){var _0x51da1a=_0xcd5200[_0x4141('0x16')];var _0x5ace17=_0x1710bd[_0x4141('0x17')]({'plain':!![]});if(_0x5ace17[_0x4141('0x13')]){return _0x51da1a[_0x4141('0x18')][_0x4141('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5ace17['id']}})[_0x4141('0x1a')](function(){_0x1b78cb();})[_0x4141('0x1b')](function(_0x2c2e23){_0x1b78cb(_0x2c2e23);});}else{_0x1b78cb();}}},'charset':'utf8mb4','collate':_0x4141('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f5b2a09..c85d8d0 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 _0x792a=['attributes','limit','then','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','where','addTags','ids','spread','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailInteraction','update','body','options'];(function(_0x50e4ac,_0x37ba99){var _0x5ae695=function(_0x131708){while(--_0x131708){_0x50e4ac['push'](_0x50e4ac['shift']());}};_0x5ae695(++_0x37ba99);}(_0x792a,0xe8));var _0xa792=function(_0x124acf,_0x112d18){_0x124acf=_0x124acf-0x0;var _0x251e0b=_0x792a[_0x124acf];return _0x251e0b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa792('0x0'));var BPromise=require(_0xa792('0x1'));var rs=require(_0xa792('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa792('0x3'))['db'];var utils=require(_0xa792('0x4'));var logger=require(_0xa792('0x5'))(_0xa792('0x6'));var config=require(_0xa792('0x7'));var jayson=require(_0xa792('0x8'));var client=jayson[_0xa792('0x9')][_0xa792('0xa')]({'port':0x232a});config[_0xa792('0xb')]=_[_0xa792('0xc')](config['redis'],{'host':_0xa792('0xd'),'port':0x18eb});var socket=require(_0xa792('0xe'))(new Redis(config[_0xa792('0xb')]));require(_0xa792('0xf'))[_0xa792('0x10')](socket);function respondWithRpcPromise(_0x3f321d,_0x5d815b,_0x37a66e){return new BPromise(function(_0xb81214,_0x207e97){return client[_0xa792('0x11')](_0x3f321d,_0x37a66e)['then'](function(_0x541d3b){logger[_0xa792('0x12')](_0xa792('0x13'),_0x5d815b,'request\x20sent');logger[_0xa792('0x14')](_0xa792('0x15'),_0x5d815b,_0xa792('0x16'),JSON[_0xa792('0x17')](_0x541d3b));if(_0x541d3b[_0xa792('0x18')]){if(_0x541d3b[_0xa792('0x18')][_0xa792('0x19')]===0x1f4){logger[_0xa792('0x18')]('MailInteraction,\x20%s,\x20%s',_0x5d815b,_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);return _0x207e97(_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);}logger[_0xa792('0x18')](_0xa792('0x13'),_0x5d815b,_0x541d3b[_0xa792('0x18')][_0xa792('0x1a')]);return _0xb81214(_0x541d3b['error'][_0xa792('0x1a')]);}else{logger[_0xa792('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5d815b,'request\x20sent');_0xb81214(_0x541d3b[_0xa792('0x1b')][_0xa792('0x1a')]);}})['catch'](function(_0x12370d){logger['error']('MailInteraction,\x20%s,\x20%s',_0x5d815b,_0x12370d);_0x207e97(_0x12370d);});});}exports['UpdateMailInteraction']=function(_0x16a32b){var _0x5c8510=this;return new Promise(function(_0x3a44ba,_0x2223c6){return db[_0xa792('0x1c')][_0xa792('0x1d')](_0x16a32b[_0xa792('0x1e')],{'raw':_0x16a32b['options']?_0x16a32b[_0xa792('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16a32b[_0xa792('0x1f')]?_0x16a32b[_0xa792('0x1f')]['where']||null:null,'attributes':_0x16a32b['options']?_0x16a32b[_0xa792('0x1f')][_0xa792('0x20')]||null:null,'limit':_0x16a32b[_0xa792('0x1f')]?_0x16a32b[_0xa792('0x1f')][_0xa792('0x21')]||null:null})[_0xa792('0x22')](function(_0x480bab){logger[_0xa792('0x12')](_0xa792('0x23'),_0x16a32b);logger[_0xa792('0x14')](_0xa792('0x23'),_0x16a32b,JSON['stringify'](_0x480bab));_0x3a44ba(_0x480bab);})[_0xa792('0x24')](function(_0x4bc06c){logger[_0xa792('0x18')]('UpdateMailInteraction',_0x4bc06c[_0xa792('0x1a')],_0x16a32b);_0x2223c6(_0x5c8510[_0xa792('0x18')](0x1f4,_0x4bc06c[_0xa792('0x1a')]));});});};exports[_0xa792('0x25')]=function(_0x2db814){return new Promise(function(_0x754d10,_0x42884c){return db['MailInteraction'][_0xa792('0x26')]({'where':_0x2db814['options']?_0x2db814[_0xa792('0x1f')][_0xa792('0x27')]||null:null})[_0xa792('0x22')](function(_0x6d761e){if(_0x6d761e){return _0x6d761e[_0xa792('0x28')](_0x2db814[_0xa792('0x1e')][_0xa792('0x29')],_['omit'](_0x2db814[_0xa792('0x1e')],[_0xa792('0x29'),'id'])||{});}})[_0xa792('0x2a')](function(_0x51f9c3){logger[_0xa792('0x12')]('AddTags',_0x2db814);logger[_0xa792('0x14')](_0xa792('0x2b'),_0x2db814,JSON[_0xa792('0x17')](_0x51f9c3));_0x754d10(_0x51f9c3);})[_0xa792('0x24')](function(_0x14d948){logger[_0xa792('0x18')](_0xa792('0x2b'),_0x14d948[_0xa792('0x1a')],_0x2db814);_0x42884c(_this[_0xa792('0x18')](0x1f4,_0x14d948[_0xa792('0x1a')]));});});}; \ No newline at end of file +var _0x315b=['ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body'];(function(_0x4a96e2,_0x1a7677){var _0x38424c=function(_0x1a1607){while(--_0x1a1607){_0x4a96e2['push'](_0x4a96e2['shift']());}};_0x38424c(++_0x1a7677);}(_0x315b,0xae));var _0xb315=function(_0x2975c7,_0x5dcc22){_0x2975c7=_0x2975c7-0x0;var _0x26a179=_0x315b[_0x2975c7];return _0x26a179;};'use strict';var _=require(_0xb315('0x0'));var util=require(_0xb315('0x1'));var moment=require(_0xb315('0x2'));var BPromise=require(_0xb315('0x3'));var rs=require(_0xb315('0x4'));var fs=require('fs');var Redis=require(_0xb315('0x5'));var db=require(_0xb315('0x6'))['db'];var utils=require(_0xb315('0x7'));var logger=require(_0xb315('0x8'))(_0xb315('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb315('0xa')][_0xb315('0xb')]({'port':0x232a});config[_0xb315('0xc')]=_['defaults'](config[_0xb315('0xc')],{'host':_0xb315('0xd'),'port':0x18eb});var socket=require(_0xb315('0xe'))(new Redis(config[_0xb315('0xc')]));require(_0xb315('0xf'))[_0xb315('0x10')](socket);function respondWithRpcPromise(_0x4df84a,_0x40ecb1,_0x4f39a5){return new BPromise(function(_0x327146,_0x37a9f4){return client[_0xb315('0x11')](_0x4df84a,_0x4f39a5)[_0xb315('0x12')](function(_0x51312d){logger[_0xb315('0x13')](_0xb315('0x14'),_0x40ecb1,_0xb315('0x15'));logger[_0xb315('0x16')](_0xb315('0x17'),_0x40ecb1,_0xb315('0x15'),JSON[_0xb315('0x18')](_0x51312d));if(_0x51312d['error']){if(_0x51312d[_0xb315('0x19')][_0xb315('0x1a')]===0x1f4){logger[_0xb315('0x19')](_0xb315('0x14'),_0x40ecb1,_0x51312d[_0xb315('0x19')][_0xb315('0x1b')]);return _0x37a9f4(_0x51312d[_0xb315('0x19')][_0xb315('0x1b')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x40ecb1,_0x51312d[_0xb315('0x19')][_0xb315('0x1b')]);return _0x327146(_0x51312d[_0xb315('0x19')][_0xb315('0x1b')]);}else{logger[_0xb315('0x13')](_0xb315('0x14'),_0x40ecb1,_0xb315('0x15'));_0x327146(_0x51312d['result']['message']);}})[_0xb315('0x1c')](function(_0x41a9b4){logger[_0xb315('0x19')](_0xb315('0x14'),_0x40ecb1,_0x41a9b4);_0x37a9f4(_0x41a9b4);});});}exports[_0xb315('0x1d')]=function(_0x6dac42){var _0x24d5cb=this;return new Promise(function(_0xa293e2,_0x1fa2f2){return db[_0xb315('0x1e')][_0xb315('0x1f')](_0x6dac42['body'],{'raw':_0x6dac42[_0xb315('0x20')]?_0x6dac42['options'][_0xb315('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6dac42[_0xb315('0x20')]?_0x6dac42['options'][_0xb315('0x22')]||null:null,'attributes':_0x6dac42[_0xb315('0x20')]?_0x6dac42['options'][_0xb315('0x23')]||null:null,'limit':_0x6dac42[_0xb315('0x20')]?_0x6dac42[_0xb315('0x20')][_0xb315('0x24')]||null:null})[_0xb315('0x12')](function(_0x597a2e){logger[_0xb315('0x13')](_0xb315('0x1d'),_0x6dac42);logger[_0xb315('0x16')](_0xb315('0x1d'),_0x6dac42,JSON[_0xb315('0x18')](_0x597a2e));_0xa293e2(_0x597a2e);})[_0xb315('0x1c')](function(_0x26a48a){logger['error'](_0xb315('0x1d'),_0x26a48a[_0xb315('0x1b')],_0x6dac42);_0x1fa2f2(_0x24d5cb['error'](0x1f4,_0x26a48a[_0xb315('0x1b')]));});});};exports[_0xb315('0x25')]=function(_0x48f096){return new Promise(function(_0x149f92,_0x4137ad){return db[_0xb315('0x1e')][_0xb315('0x26')]({'where':_0x48f096[_0xb315('0x20')]?_0x48f096[_0xb315('0x20')][_0xb315('0x22')]||null:null})[_0xb315('0x12')](function(_0x24dfe9){if(_0x24dfe9){return _0x24dfe9[_0xb315('0x27')](_0x48f096[_0xb315('0x28')][_0xb315('0x29')],_['omit'](_0x48f096['body'],[_0xb315('0x29'),'id'])||{});}})['spread'](function(_0x277c04){logger['info'](_0xb315('0x2a'),_0x48f096);logger[_0xb315('0x16')](_0xb315('0x2a'),_0x48f096,JSON['stringify'](_0x277c04));_0x149f92(_0x277c04);})['catch'](function(_0x26ee80){logger[_0xb315('0x19')]('AddTags',_0x26ee80[_0xb315('0x1b')],_0x48f096);_0x4137ad(_this['error'](0x1f4,_0x26ee80[_0xb315('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a93d781..8afde27 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 _0x176e=['emit','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x23d832,_0xdf291a){var _0x35c717=function(_0x3bff36){while(--_0x3bff36){_0x23d832['push'](_0x23d832['shift']());}};_0x35c717(++_0xdf291a);}(_0x176e,0xb7));var _0xe176=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x176e[_0x160c73];return _0xd9302;};'use strict';var MailInteractionEvents=require(_0xe176('0x0'));var events=['save',_0xe176('0x1'),_0xe176('0x2')];function createListener(_0x5113f4,_0x133264){return function(_0x16d8e7){_0x133264[_0xe176('0x3')](_0x5113f4,_0x16d8e7);};}function removeListener(_0x43fc6e,_0x52215d){return function(){MailInteractionEvents['removeListener'](_0x43fc6e,_0x52215d);};}exports['register']=function(_0x383e60){for(var _0x5b19db=0x0,_0x349629=events[_0xe176('0x4')];_0x5b19db<_0x349629;_0x5b19db++){var _0x25f113=events[_0x5b19db];var _0x57b1c1=createListener(_0xe176('0x5')+_0x25f113,_0x383e60);MailInteractionEvents['on'](_0x25f113,_0x57b1c1);}}; \ No newline at end of file +var _0x06e9=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x30c87d,_0x52c8f5){var _0x2f5649=function(_0xfa768b){while(--_0xfa768b){_0x30c87d['push'](_0x30c87d['shift']());}};_0x2f5649(++_0x52c8f5);}(_0x06e9,0x14c));var _0x906e=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x06e9[_0x288f5e];return _0x476cc9;};'use strict';var MailInteractionEvents=require(_0x906e('0x0'));var events=[_0x906e('0x1'),_0x906e('0x2'),'update'];function createListener(_0x10fb82,_0x3fcc1c){return function(_0x16a66e){_0x3fcc1c[_0x906e('0x3')](_0x10fb82,_0x16a66e);};}function removeListener(_0x5d361f,_0x181fb9){return function(){MailInteractionEvents[_0x906e('0x4')](_0x5d361f,_0x181fb9);};}exports[_0x906e('0x5')]=function(_0x5ed5cf){for(var _0x1efdcf=0x0,_0x126a59=events[_0x906e('0x6')];_0x1efdcf<_0x126a59;_0x1efdcf++){var _0x497580=events[_0x1efdcf];var _0x2b4afb=createListener(_0x906e('0x7')+_0x497580,_0x5ed5cf);MailInteractionEvents['on'](_0x497580,_0x2b4afb);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index cd955d1..68a4ddd 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 _0xf45e=['get','isAuthenticated','index','/describe','describe','/:id','show','download','post','tracked','mail','create','put','update','/:id/reject','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller'];(function(_0x1f08b6,_0x5f9107){var _0x3a9cbf=function(_0x53ae26){while(--_0x53ae26){_0x1f08b6['push'](_0x1f08b6['shift']());}};_0x3a9cbf(++_0x5f9107);}(_0xf45e,0x115));var _0xef45=function(_0x31c879,_0x30ee98){_0x31c879=_0x31c879-0x0;var _0xbfba3d=_0xf45e[_0x31c879];return _0xbfba3d;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var fs_extra=require(_0xef45('0x4'));var auth=require(_0xef45('0x5'));var interaction=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var controller=require(_0xef45('0x8'));router[_0xef45('0x9')]('/',auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0x9')](_0xef45('0xc'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0x9')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);router[_0xef45('0x9')]('/:id/download',auth[_0xef45('0xa')](),controller[_0xef45('0x10')]);router[_0xef45('0x11')]('/',auth[_0xef45('0xa')](),interaction[_0xef45('0x12')](_0xef45('0x13'),'mailmessage:create'),controller[_0xef45('0x14')]);router[_0xef45('0x15')](_0xef45('0xe'),auth[_0xef45('0xa')](),controller[_0xef45('0x16')]);router['put']('/:id/accept',auth[_0xef45('0xa')](),controller['accept']);router[_0xef45('0x15')](_0xef45('0x17'),auth[_0xef45('0xa')](),controller['reject']);router['delete'](_0xef45('0xe'),auth['isAuthenticated'](),controller[_0xef45('0x18')]);module[_0xef45('0x19')]=router; \ No newline at end of file +var _0xc686=['update','/:id/accept','accept','/:id/reject','reject','delete','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','download','mail','mailmessage:create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc686,0x148));var _0x6c68=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc686[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6c68('0x0'));var timeout=require('connect-timeout');var express=require(_0x6c68('0x1'));var router=express['Router']();var fs_extra=require(_0x6c68('0x2'));var auth=require(_0x6c68('0x3'));var interaction=require(_0x6c68('0x4'));var config=require(_0x6c68('0x5'));var controller=require(_0x6c68('0x6'));router[_0x6c68('0x7')]('/',auth[_0x6c68('0x8')](),controller[_0x6c68('0x9')]);router[_0x6c68('0x7')](_0x6c68('0xa'),auth[_0x6c68('0x8')](),controller[_0x6c68('0xb')]);router['get'](_0x6c68('0xc'),auth[_0x6c68('0x8')](),controller['show']);router[_0x6c68('0x7')]('/:id/download',auth[_0x6c68('0x8')](),controller[_0x6c68('0xd')]);router['post']('/',auth[_0x6c68('0x8')](),interaction['tracked'](_0x6c68('0xe'),_0x6c68('0xf')),controller['create']);router[_0x6c68('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6c68('0x11')]);router['put'](_0x6c68('0x12'),auth[_0x6c68('0x8')](),controller[_0x6c68('0x13')]);router['put'](_0x6c68('0x14'),auth[_0x6c68('0x8')](),controller[_0x6c68('0x15')]);router[_0x6c68('0x16')](_0x6c68('0xc'),auth['isAuthenticated'](),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 69887cf..a12bdc5 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 _0x6b57=['lodash','TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize'];(function(_0x1661bd,_0x119281){var _0x293c2f=function(_0x5b7f16){while(--_0x5b7f16){_0x1661bd['push'](_0x1661bd['shift']());}};_0x293c2f(++_0x119281);}(_0x6b57,0x17b));var _0x76b5=function(_0x543533,_0x5f2eee){_0x543533=_0x543533-0x0;var _0x295b79=_0x6b57[_0x543533];return _0x295b79;};'use strict';var Sequelize=require(_0x76b5('0x0'));var _=require(_0x76b5('0x1'));module['exports']={'body':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0x76b5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x76b5('0x5')]('in','out'),'defaultValue':_0x76b5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x76b5('0x7')](0x1fe)},'from':{'type':Sequelize[_0x76b5('0x7')]},'to':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x76b5('0x2')]},'sentAt':{'type':Sequelize[_0x76b5('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x76b5('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x76b5('0x8')]},'originTo':{'type':Sequelize[_0x76b5('0x2')](_0x76b5('0x3'))},'originCc':{'type':Sequelize[_0x76b5('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x76b5('0x9'),'Chat'),'defaultValue':_0x76b5('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0xc582=['out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT','long','BOOLEAN','ENUM'];(function(_0x39580c,_0x22425c){var _0x1a4cd8=function(_0x42ee09){while(--_0x42ee09){_0x39580c['push'](_0x39580c['shift']());}};_0x1a4cd8(++_0x22425c);}(_0xc582,0x96));var _0x2c58=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xc582[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0x2c58('0x0'));var _=require(_0x2c58('0x1'));module['exports']={'body':{'type':Sequelize[_0x2c58('0x2')](_0x2c58('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2c58('0x2')]('medium')},'read':{'type':Sequelize[_0x2c58('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c58('0x5')]('in','out'),'defaultValue':_0x2c58('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2c58('0x7')](0x1fe)},'from':{'type':Sequelize[_0x2c58('0x7')]},'to':{'type':Sequelize['TEXT'](_0x2c58('0x3'))},'cc':{'type':Sequelize[_0x2c58('0x2')](_0x2c58('0x3'))},'bcc':{'type':Sequelize[_0x2c58('0x2')](_0x2c58('0x3'))},'subject':{'type':Sequelize[_0x2c58('0x2')]},'sentAt':{'type':Sequelize[_0x2c58('0x8')]},'attach':{'type':Sequelize[_0x2c58('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2c58('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x2c58('0x3'))},'originCc':{'type':Sequelize[_0x2c58('0x2')](_0x2c58('0x3'))},'originChannel':{'type':Sequelize['ENUM'](_0x2c58('0xa'),_0x2c58('0xb')),'defaultValue':_0x2c58('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 24ac8bf..bf28d69 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 _0xc4fe=['update','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','root','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','format','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','internal','rejectmessage','download','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','map','MailMessage','rawAttributes','fieldName','type','key','keys','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','show','params','filters','includeAll','find'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xc4fe,0x19a));var _0xec4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec4f('0x0'));var moment=require(_0xec4f('0x1'));var BPromise=require(_0xec4f('0x2'));var util=require('util');var path=require(_0xec4f('0x3'));var fs=require('fs');var _=require(_0xec4f('0x4'));var Redis=require('ioredis');var htmlToText=require(_0xec4f('0x5'));var qs=require(_0xec4f('0x6'));var logger=require(_0xec4f('0x7'))(_0xec4f('0x8'));var interaction_log=require('../../config/logger')(_0xec4f('0x9'));var config=require(_0xec4f('0xa'));var db=require(_0xec4f('0xb'))['db'];config['redis']=_[_0xec4f('0xc')](config[_0xec4f('0xd')],{'host':_0xec4f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xec4f('0xf'));require(_0xec4f('0x10'))[_0xec4f('0x11')](socket);var jayson=require(_0xec4f('0x12'));var client=jayson[_0xec4f('0x13')][_0xec4f('0x14')]({'port':0x232c});var client9003=jayson[_0xec4f('0x13')][_0xec4f('0x14')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7999,_0x40a15c,_0x2ad179,_0xff18d2){return new BPromise(function(_0x2f2bf4,_0x4b1b1b){var _0x33bfa0=_0xff18d2||client;return _0x33bfa0['request'](_0x4c7999,_0x2ad179)[_0xec4f('0x15')](function(_0x886886){logger[_0xec4f('0x16')](_0xec4f('0x17'),_0x40a15c,_0xec4f('0x18'));logger[_0xec4f('0x19')](_0xec4f('0x1a'),_0x40a15c,_0xec4f('0x18'),JSON[_0xec4f('0x1b')](_0x886886));if(_0x886886[_0xec4f('0x1c')]){if(_0x886886[_0xec4f('0x1c')][_0xec4f('0x1d')]===0x1f4){logger[_0xec4f('0x1c')]('MailMessage,\x20%s,\x20%s',_0x40a15c,_0x886886[_0xec4f('0x1c')][_0xec4f('0x1e')]);return _0x4b1b1b(_0x886886['error']['message']);}logger[_0xec4f('0x1c')](_0xec4f('0x17'),_0x40a15c,_0x886886[_0xec4f('0x1c')][_0xec4f('0x1e')]);return _0x2f2bf4(_0x886886['error'][_0xec4f('0x1e')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40a15c,'request\x20sent');_0x2f2bf4(_0x886886[_0xec4f('0x1f')][_0xec4f('0x1e')]);}})[_0xec4f('0x20')](function(_0x169f03){logger[_0xec4f('0x1c')](_0xec4f('0x17'),_0x40a15c,_0x169f03);_0x4b1b1b(_0x169f03);});});}function respondWithResult(_0x15d2d9,_0x43a2a9){_0x43a2a9=_0x43a2a9||0xc8;return function(_0x309ceb){if(_0x309ceb){return _0x15d2d9[_0xec4f('0x21')](_0x43a2a9)[_0xec4f('0x22')](_0x309ceb);}};}function respondWithFilteredResult(_0xd048f5,_0x19085f){return function(_0x14b023){if(_0x14b023){var _0x25886f=typeof _0x19085f[_0xec4f('0x23')]===_0xec4f('0x24')&&typeof _0x19085f[_0xec4f('0x25')]===_0xec4f('0x24');var _0x442906=_0x14b023[_0xec4f('0x26')];var _0x32bbbd=_0x25886f?0x0:_0x19085f[_0xec4f('0x23')];var _0xd74b4d=_0x25886f?_0x14b023[_0xec4f('0x26')]:_0x19085f[_0xec4f('0x23')]+_0x19085f[_0xec4f('0x25')];var _0x1c94ef;if(_0xd74b4d>=_0x442906){_0xd74b4d=_0x442906;_0x1c94ef=0xc8;}else{_0x1c94ef=0xce;}_0xd048f5[_0xec4f('0x21')](_0x1c94ef);return _0xd048f5[_0xec4f('0x27')](_0xec4f('0x28'),_0x32bbbd+'-'+_0xd74b4d+'/'+_0x442906)['json'](_0x14b023);}return null;};}function saveUpdates(_0x216037){return function(_0x1ace77){if(_0x1ace77){return _0x1ace77['update'](_0x216037)[_0xec4f('0x15')](function(_0x165806){return _0x165806;});}return null;};}function removeEntity(_0x2536c3){return function(_0x34e314){if(_0x34e314){return _0x34e314[_0xec4f('0x29')]()[_0xec4f('0x15')](function(){_0x2536c3[_0xec4f('0x21')](0xcc)[_0xec4f('0x2a')]();});}};}function handleEntityNotFound(_0x827db7){return function(_0x296426){if(!_0x296426){_0x827db7[_0xec4f('0x2b')](0x194);}return _0x296426;};}function handleError(_0xb779b0,_0x1e7216){_0x1e7216=_0x1e7216||0x1f4;return function(_0x5c3974){logger[_0xec4f('0x1c')](_0x5c3974['stack']);if(_0x5c3974[_0xec4f('0x2c')]){delete _0x5c3974['name'];}_0xb779b0[_0xec4f('0x21')](_0x1e7216)['send'](_0x5c3974);};}exports['index']=function(_0x17b11e,_0x3f9404){var _0x1981b1={},_0x49bdfd={},_0x5d3816={'count':0x0,'rows':[]};var _0x5cc9c4=_[_0xec4f('0x2d')](db[_0xec4f('0x2e')][_0xec4f('0x2f')],function(_0x1c7aab){return{'name':_0x1c7aab[_0xec4f('0x30')],'type':_0x1c7aab[_0xec4f('0x31')][_0xec4f('0x32')]};});_0x49bdfd['model']=_[_0xec4f('0x2d')](_0x5cc9c4,_0xec4f('0x2c'));_0x49bdfd['query']=_[_0xec4f('0x33')](_0x17b11e['query']);_0x49bdfd['filters']=_[_0xec4f('0x34')](_0x49bdfd[_0xec4f('0x35')],_0x49bdfd[_0xec4f('0x36')]);_0x1981b1[_0xec4f('0x37')]=_[_0xec4f('0x34')](_0x49bdfd['model'],qs[_0xec4f('0x38')](_0x17b11e[_0xec4f('0x36')]['fields']));_0x1981b1[_0xec4f('0x37')]=_0x1981b1['attributes'][_0xec4f('0x39')]?_0x1981b1[_0xec4f('0x37')]:_0x49bdfd[_0xec4f('0x35')];if(!_0x17b11e[_0xec4f('0x36')]['hasOwnProperty'](_0xec4f('0x3a'))){_0x1981b1[_0xec4f('0x25')]=qs[_0xec4f('0x25')](_0x17b11e[_0xec4f('0x36')][_0xec4f('0x25')]);_0x1981b1[_0xec4f('0x23')]=qs['offset'](_0x17b11e[_0xec4f('0x36')][_0xec4f('0x23')]);}_0x1981b1[_0xec4f('0x3b')]=qs[_0xec4f('0x3c')](_0x17b11e['query'][_0xec4f('0x3c')]);_0x1981b1[_0xec4f('0x3d')]=qs['filters'](_[_0xec4f('0x3e')](_0x17b11e['query'],_0x49bdfd['filters']),_0x5cc9c4);if(_0x17b11e[_0xec4f('0x36')][_0xec4f('0x3f')]){_0x1981b1[_0xec4f('0x3d')]=_['merge'](_0x1981b1[_0xec4f('0x3d')],{'$or':_[_0xec4f('0x2d')](_0x5cc9c4,function(_0x10fe39){if(_0x10fe39['type']!=='VIRTUAL'){var _0x3125ad={};_0x3125ad[_0x10fe39[_0xec4f('0x2c')]]={'$like':'%'+_0x17b11e[_0xec4f('0x36')][_0xec4f('0x3f')]+'%'};return _0x3125ad;}})});}_0x1981b1=_[_0xec4f('0x40')]({},_0x1981b1,_0x17b11e['options']);var _0x90c519={'where':_0x1981b1['where']};return db[_0xec4f('0x2e')][_0xec4f('0x26')](_0x90c519)[_0xec4f('0x15')](function(_0x39acfb){_0x5d3816[_0xec4f('0x26')]=_0x39acfb;if(_0x17b11e[_0xec4f('0x36')]['includeAll']){_0x1981b1[_0xec4f('0x41')]=[{'all':!![]}];}return db[_0xec4f('0x2e')][_0xec4f('0x42')](_0x1981b1);})[_0xec4f('0x15')](function(_0x1261ff){_0x5d3816[_0xec4f('0x43')]=_0x1261ff;return _0x5d3816;})[_0xec4f('0x15')](respondWithFilteredResult(_0x3f9404,_0x1981b1))[_0xec4f('0x20')](handleError(_0x3f9404,null));};exports[_0xec4f('0x44')]=function(_0x39d5ae,_0x48dd04){var _0xfd9372={'raw':!![],'where':{'id':_0x39d5ae[_0xec4f('0x45')]['id']}},_0x239d75={};_0x239d75['model']=_[_0xec4f('0x33')](db[_0xec4f('0x2e')][_0xec4f('0x2f')]);_0x239d75['query']=_['keys'](_0x39d5ae[_0xec4f('0x36')]);_0x239d75[_0xec4f('0x46')]=_[_0xec4f('0x34')](_0x239d75[_0xec4f('0x35')],_0x239d75[_0xec4f('0x36')]);_0xfd9372[_0xec4f('0x37')]=_[_0xec4f('0x34')](_0x239d75[_0xec4f('0x35')],qs[_0xec4f('0x38')](_0x39d5ae[_0xec4f('0x36')][_0xec4f('0x38')]));_0xfd9372[_0xec4f('0x37')]=_0xfd9372[_0xec4f('0x37')]['length']?_0xfd9372[_0xec4f('0x37')]:_0x239d75[_0xec4f('0x35')];if(_0x39d5ae[_0xec4f('0x36')][_0xec4f('0x47')]){_0xfd9372[_0xec4f('0x41')]=[{'all':!![]}];}_0xfd9372=_[_0xec4f('0x40')]({},_0xfd9372,_0x39d5ae['options']);return db['MailMessage'][_0xec4f('0x48')](_0xfd9372)[_0xec4f('0x15')](handleEntityNotFound(_0x48dd04,null))[_0xec4f('0x15')](respondWithResult(_0x48dd04,null))[_0xec4f('0x20')](handleError(_0x48dd04,null));};exports[_0xec4f('0x49')]=function(_0x5ca7dd,_0x3a5c93){if(_0x5ca7dd['body']['id']){delete _0x5ca7dd[_0xec4f('0x4a')]['id'];}return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x5ca7dd[_0xec4f('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a5c93,null))['then'](saveUpdates(_0x5ca7dd['body'],null))[_0xec4f('0x15')](respondWithResult(_0x3a5c93,null))[_0xec4f('0x20')](handleError(_0x3a5c93,null));};exports[_0xec4f('0x29')]=function(_0x12e792,_0x3faad0){return db['MailMessage'][_0xec4f('0x48')]({'where':{'id':_0x12e792['params']['id']}})[_0xec4f('0x15')](handleEntityNotFound(_0x3faad0,null))[_0xec4f('0x15')](removeEntity(_0x3faad0,null))['catch'](handleError(_0x3faad0,null));};exports['describe']=function(_0x30e9a5,_0x3f57ab){return db['MailMessage'][_0xec4f('0x4b')]()[_0xec4f('0x15')](respondWithResult(_0x3f57ab,null))[_0xec4f('0x20')](handleError(_0x3f57ab,null));};exports[_0xec4f('0x4c')]=function(_0x578106,_0x14c948){return db[_0xec4f('0x2e')][_0xec4f('0x4c')](_0x578106[_0xec4f('0x4a')])[_0xec4f('0x15')](function(_0x57a002){if(_0x57a002){if(_0x57a002[_0xec4f('0x4d')]===_0xec4f('0x4e')&&!_0x57a002[_0xec4f('0x4f')]){var _0x44e41c,_0x1d2650,_0x4af05b;if(_0x578106[_0xec4f('0x4a')]['to']){_0x1d2650=_0x578106[_0xec4f('0x4a')]['to'][_0xec4f('0x50')](',')[0x0];}return db[_0xec4f('0x51')][_0xec4f('0x52')]({'where':{'id':_0x57a002[_0xec4f('0x53')]},'include':[{'model':db[_0xec4f('0x54')],'as':_0xec4f('0x55'),'include':[{'model':db[_0xec4f('0x56')],'as':'Contacts','where':{'email':_0x1d2650},'limit':0x1,'order':[['updatedAt',_0xec4f('0x57')]]}]},{'model':db[_0xec4f('0x58')],'as':_0xec4f('0x59'),'raw':!![],'include':[{'model':db[_0xec4f('0x5a')],'as':_0xec4f('0x5a'),'raw':!![]}]}]})[_0xec4f('0x15')](function(_0x19e23b){_0x44e41c=_0x19e23b;if(!_0x44e41c||!_0x44e41c['Smtp'])return;var _0x5e8ec4=_0x44e41c['getSmtpOptions']();if(_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')]&&_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0xec4f('0x39')]){for(var _0x14c2af=0x0;_0x14c2af<_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0xec4f('0x39')];_0x14c2af+=0x1){_0x578106[_0xec4f('0x4a')][_0xec4f('0x5b')][_0x14c2af]={'filename':_0x578106[_0xec4f('0x4a')]['attachments'][_0x14c2af]['name'],'path':path['join'](config[_0xec4f('0x5c')],_0xec4f('0x5d'),_0x578106[_0xec4f('0x4a')]['attachments'][_0x14c2af][_0xec4f('0x5e')])};}}_0x4af05b={'account':_0x5e8ec4,'message':_0x578106['body']};return;})['then'](function(){if(_0x44e41c['List']){if(_0x44e41c[_0xec4f('0x55')][_0xec4f('0x5f')][_0xec4f('0x39')]){return _0x44e41c['List']['Contacts'][0x0];}else{return db[_0xec4f('0x56')]['create'](_[_0xec4f('0xc')](_0x578106[_0xec4f('0x4a')],{'firstName':_0x578106['body']['to'],'email':_0x578106[_0xec4f('0x4a')]['to'],'phone':_0x578106[_0xec4f('0x4a')]['to'],'ListId':_0x44e41c[_0xec4f('0x60')]}));}}else{throw new Error(_0xec4f('0x61'));}})[_0xec4f('0x15')](function(){if(_0x4af05b){return respondWithRpcPromise(_0xec4f('0x62'),_0xec4f('0x63'),_0x4af05b,client9003)['then'](function(_0x26b3c4){return _0x57a002['update']({'read':!![],'messageId':_0x26b3c4['messageId'],'sentAt':moment()[_0xec4f('0x64')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xec4f('0x20')](function(_0x3ff99){logger[_0xec4f('0x1c')]('%s',JSON[_0xec4f('0x1b')](_0x3ff99));return _0x57a002;});}return _0x57a002;});}return _0x57a002;}})[_0xec4f('0x15')](respondWithResult(_0x14c948,0xc9))[_0xec4f('0x20')](handleError(_0x14c948,null));};exports['accept']=function(_0x555bb2,_0x563ed4){var _0x3e3274={'agent':{},'channel':_0xec4f('0x65')};if(_0x555bb2['body']['id']){delete _0x555bb2['body']['id'];}_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x66')]=!![];_0x555bb2[_0xec4f('0x4a')]['readAt']=moment()[_0xec4f('0x64')](_0xec4f('0x67'));_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')]=_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')]||_0x555bb2[_0xec4f('0x69')]['id'];_0x3e3274['agent']['id']=_0x555bb2[_0xec4f('0x4a')]['UserId'];return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x555bb2[_0xec4f('0x45')]['id'],'UserId':null}})[_0xec4f('0x15')](handleEntityNotFound(_0x563ed4,null))[_0xec4f('0x15')](saveUpdates(_0x555bb2[_0xec4f('0x4a')],null))[_0xec4f('0x15')](function(_0x36b460){if(_0x36b460){_0x3e3274['message']=_0x36b460[_0xec4f('0x6a')]({'plain':!![]});return db[_0xec4f('0x6b')][_0xec4f('0x48')]({'where':{'id':_0x36b460[_0xec4f('0x6c')]}});}return null;})[_0xec4f('0x15')](handleEntityNotFound(_0x563ed4,null))[_0xec4f('0x15')](function(_0x5f47e5){if(_0x5f47e5){return _0x5f47e5[_0xec4f('0x49')]({'UserId':_0x555bb2['body'][_0xec4f('0x68')],'read1stAt':_[_0xec4f('0x6d')](_0x5f47e5[_0xec4f('0x6e')])?moment()[_0xec4f('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x182c4c){if(_0x182c4c){_0x3e3274[_0xec4f('0x6f')]=_0x182c4c['get']({'plain':!![]});interaction_log[_0xec4f('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x555bb2[_0xec4f('0x69')]['id'],_0x555bb2[_0xec4f('0x69')][_0xec4f('0x2c')],_0x555bb2[_0xec4f('0x69')]['role'],_0x3e3274['interaction']['id'],_0x555bb2[_0xec4f('0x4a')]?JSON[_0xec4f('0x1b')](_0x555bb2[_0xec4f('0x4a')]):_0xec4f('0x70'));return respondWithRpcPromise('AcceptMessage',_0xec4f('0x71'),_0x3e3274);}return null;})[_0xec4f('0x15')](function(_0x4f7923){var _0x3b80d0=_0xec4f('0x72')+_0x4f7923[_0xec4f('0x1e')]['ContactId'];return db['sequelize'][_0xec4f('0x36')](_0x3b80d0,{'type':db[_0xec4f('0x73')][_0xec4f('0x74')][_0xec4f('0x75')],'raw':!![]})[_0xec4f('0x15')](function(_0x50d3f5){return _0x50d3f5;});})['then'](function(_0xbed707){if(_0xbed707){_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x76')]=_0xbed707[0x0];if(!_0x555bb2[_0xec4f('0x4a')][_0xec4f('0x68')])return;return db[_0xec4f('0x77')][_0xec4f('0x48')]({'where':{'id':_0x555bb2[_0xec4f('0x4a')]['UserId'],'role':_0xec4f('0x78')},'attributes':['id',_0xec4f('0x2c'),_0xec4f('0x79'),_0xec4f('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1da1ed){if(!_0x1da1ed)return null;_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x78')]=_0x1da1ed;return _0x3e3274;})[_0xec4f('0x15')](function(_0x5a5053){if(_0x5a5053){if(_0x555bb2['body'][_0xec4f('0x7b')]){_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x7c')]=util['format'](_0xec4f('0x7d'),_0x555bb2['user']['name']);_0x3e3274['message'][_0xec4f('0x7e')]=_0x3e3274[_0xec4f('0x7e')];_0x3e3274['message'][_0xec4f('0x7f')]=_0x3e3274[_0xec4f('0x7e')];_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x80')]='accept';_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x4a')]=htmlToText[_0xec4f('0x81')](_0x3e3274[_0xec4f('0x1e')][_0xec4f('0x4a')]);return respondWithRpcPromise(_0xec4f('0x82'),_0xec4f('0x82'),{'event':_0xec4f('0x83'),'message':_0x3e3274['message']},client9002)[_0xec4f('0x15')](function(){return _0x3e3274;});}return _0x3e3274;}return null;})['then'](respondWithResult(_0x563ed4,null))[_0xec4f('0x20')](handleError(_0x563ed4,null));};exports[_0xec4f('0x84')]=function(_0x444026,_0x2f3c3b){var _0x5f0045={'agent':{},'channel':_0xec4f('0x65')};if(_0x444026[_0xec4f('0x4a')]['id']){delete _0x444026[_0xec4f('0x4a')]['id'];}_0x444026['body'][_0xec4f('0x68')]=_0x444026['body'][_0xec4f('0x68')]||_0x444026[_0xec4f('0x69')]['id'];_0x5f0045[_0xec4f('0x78')]['id']=_0x444026[_0xec4f('0x4a')][_0xec4f('0x68')];return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x444026[_0xec4f('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2f3c3b,null))[_0xec4f('0x15')](function(_0x49578){if(_0x49578){_0x5f0045[_0xec4f('0x1e')]=_0x49578['get']({'plain':!![]});return db['MailInteraction'][_0xec4f('0x48')]({'where':{'id':_0x49578[_0xec4f('0x6c')]}});}return null;})[_0xec4f('0x15')](handleEntityNotFound(_0x2f3c3b,null))['then'](function(_0x4445e5){if(_0x4445e5){_0x5f0045['interaction']=_0x4445e5[_0xec4f('0x6a')]({'plain':!![]});interaction_log[_0xec4f('0x16')](_0xec4f('0x85'),_0x444026['user']['id'],_0x444026[_0xec4f('0x69')][_0xec4f('0x2c')],_0x444026[_0xec4f('0x69')][_0xec4f('0x86')],_0x5f0045[_0xec4f('0x6f')]['id'],_0x444026['body']?JSON[_0xec4f('0x1b')](_0x444026[_0xec4f('0x4a')]):'null');return respondWithRpcPromise(_0xec4f('0x87'),'rejectMessage',_0x5f0045);}return null;})[_0xec4f('0x15')](function(_0x1e11c0){var _0x5786f3=_0xec4f('0x72')+_0x1e11c0[_0xec4f('0x1e')][_0xec4f('0x88')];return db['sequelize'][_0xec4f('0x36')](_0x5786f3,{'type':db[_0xec4f('0x73')][_0xec4f('0x74')][_0xec4f('0x75')],'raw':!![]})[_0xec4f('0x15')](function(_0x8c2fce){return _0x8c2fce;});})[_0xec4f('0x15')](function(_0x2d4d6b){if(_0x2d4d6b){_0x5f0045[_0xec4f('0x1e')][_0xec4f('0x76')]=_0x2d4d6b[0x0];if(!_0x444026[_0xec4f('0x4a')][_0xec4f('0x68')])return;return db[_0xec4f('0x77')]['find']({'where':{'id':_0x444026[_0xec4f('0x4a')]['UserId'],'role':_0xec4f('0x78')},'attributes':['id',_0xec4f('0x2c'),'fullname','email',_0xec4f('0x89')],'raw':!![]});}return null;})['then'](function(_0x41afb9){if(!_0x41afb9)return null;_0x5f0045[_0xec4f('0x1e')][_0xec4f('0x78')]=_0x41afb9;return _0x5f0045;})[_0xec4f('0x15')](function(_0x26029e){if(_0x26029e){_0x26029e['message']['interface']=util[_0xec4f('0x64')](_0xec4f('0x7d'),_0x444026['user']['name']);_0x26029e[_0xec4f('0x1e')][_0xec4f('0x7e')]=_0x5f0045[_0xec4f('0x7e')];_0x26029e['message'][_0xec4f('0x7f')]=_0x5f0045[_0xec4f('0x7e')];_0x26029e['message']['event']=_0xec4f('0x84');_0x26029e[_0xec4f('0x1e')][_0xec4f('0x4a')]=htmlToText[_0xec4f('0x81')](_0x5f0045['message'][_0xec4f('0x4a')]);respondWithRpcPromise(_0xec4f('0x82'),'EventManager',{'event':_0xec4f('0x8a'),'message':_0x26029e[_0xec4f('0x1e')]},client9002);return _0x5f0045;}return null;})[_0xec4f('0x15')](respondWithResult(_0x2f3c3b,null))[_0xec4f('0x20')](handleError(_0x2f3c3b,null));};exports[_0xec4f('0x8b')]=function(_0x44512e,_0x55dab7){var _0x6f1169=moment()[_0xec4f('0x8c')]()[_0xec4f('0x8d')]();var _0xbfdacd=path[_0xec4f('0x8e')](config[_0xec4f('0x5c')],_0xec4f('0x8f'),_0xec4f('0x90'),_0xec4f('0x91'));var _0x110416=path[_0xec4f('0x8e')](config['root'],_0xec4f('0x8f'),_0xec4f('0x90'),_0xec4f('0x5b'));var _0x395221=util['format'](_0xec4f('0x92'),_0x6f1169);return db[_0xec4f('0x2e')][_0xec4f('0x48')]({'where':{'id':_0x44512e['params']['id']},'attributes':['id',_0xec4f('0x4a'),_0xec4f('0x93'),'to','cc',_0xec4f('0x94'),_0xec4f('0x95'),_0xec4f('0x96')],'include':_0x44512e[_0xec4f('0x36')][_0xec4f('0x5b')]?[{'model':db[_0xec4f('0x97')],'as':_0xec4f('0x98')}]:undefined})['then'](handleEntityNotFound(_0x55dab7,null))[_0xec4f('0x15')](function(_0x5bd6a4){if(_0x5bd6a4){var _0x79ee12=_0x5bd6a4;var _0x6a289b={'from':_0x79ee12[_0xec4f('0x93')],'to':_0x79ee12['to'],'subject':_0x79ee12[_0xec4f('0x95')],'html':htmlEntities['decode'](_0x79ee12[_0xec4f('0x4a')]),'headers':{'Date':moment(_0x79ee12[_0xec4f('0x96')])[_0xec4f('0x64')](_0xec4f('0x99'))},'attachments':[]};if(_0x5bd6a4['cc']){_0x6a289b['headers']['Cc']=_0x5bd6a4['cc'];}if(_0x5bd6a4[_0xec4f('0x94')]){_0x6a289b[_0xec4f('0x9a')][_0xec4f('0x9b')]=_0x5bd6a4['bcc'];}return new BPromise(function(_0x288fe1,_0x1cccde){if(_0x5bd6a4[_0xec4f('0x98')]){for(var _0x4863ba=0x0;_0x4863ba<_0x5bd6a4[_0xec4f('0x98')][_0xec4f('0x39')];_0x4863ba++){var _0x27fc87=_0x5bd6a4[_0xec4f('0x98')][_0x4863ba];var _0x227318=path[_0xec4f('0x8e')](_0x110416,_0x27fc87['basename']);if(fs[_0xec4f('0x9c')](_0x227318)){_0x6a289b['attachments'][_0xec4f('0x9d')]({'name':_0x27fc87[_0xec4f('0x2c')],'contentType':_0x27fc87[_0xec4f('0x31')],'data':fs[_0xec4f('0x9e')](_0x227318)});}}}emlformat[_0xec4f('0x9f')](_0x6a289b,function(_0x5cf50a,_0x4fb7e8){if(_0x5cf50a)return _0x1cccde(_0x5cf50a);fs['writeFileSync'](path['join'](_0xbfdacd,_0x395221),_0x4fb7e8);return _0x288fe1(_0x4fb7e8);});});}})['then'](function(_0x25d6e8){if(_0x25d6e8){return _0x55dab7[_0xec4f('0x8b')](path['join'](_0xbfdacd,_0x395221),_0x395221,function(_0x4f3161){if(!_0x4f3161)fs[_0xec4f('0xa0')](path[_0xec4f('0x8e')](_0xbfdacd,_0x395221));});}})['catch'](handleError(_0x55dab7,null));}; \ No newline at end of file +var _0xbeed=['read1stAt','interaction','[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','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','acceptmessage','RejectMessage','QueryTypes','reject','EventManager','rejectmessage','download','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','html-entities','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','update','destroy','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','show','params','body','find','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','Contacts','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','length','join','server/files/attachments','basename','List','CmContact','ListId','SendMail','messageId','format','stringify','accept','mail','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbeed,0xd1));var _0xdbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeed[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xdbee('0x0'));var moment=require(_0xdbee('0x1'));var BPromise=require('bluebird');var util=require(_0xdbee('0x2'));var path=require(_0xdbee('0x3'));var fs=require('fs');var _=require(_0xdbee('0x4'));var Redis=require(_0xdbee('0x5'));var htmlToText=require(_0xdbee('0x6'));var qs=require(_0xdbee('0x7'));var logger=require(_0xdbee('0x8'))(_0xdbee('0x9'));var interaction_log=require(_0xdbee('0x8'))(_0xdbee('0xa'));var config=require(_0xdbee('0xb'));var db=require(_0xdbee('0xc'))['db'];config[_0xdbee('0xd')]=_[_0xdbee('0xe')](config[_0xdbee('0xd')],{'host':_0xdbee('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0xdbee('0x10'));require(_0xdbee('0x11'))[_0xdbee('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdbee('0x13')][_0xdbee('0x14')]({'port':0x232c});var client9003=jayson[_0xdbee('0x13')][_0xdbee('0x14')]({'port':0x232b});var client9002=jayson[_0xdbee('0x13')][_0xdbee('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x354465,_0x7dfdd1,_0x2c4581,_0x46865b){return new BPromise(function(_0x59528b,_0x4eac2d){var _0x2128c6=_0x46865b||client;return _0x2128c6['request'](_0x354465,_0x2c4581)[_0xdbee('0x15')](function(_0x6108a8){logger[_0xdbee('0x16')](_0xdbee('0x17'),_0x7dfdd1,_0xdbee('0x18'));logger['debug'](_0xdbee('0x19'),_0x7dfdd1,_0xdbee('0x18'),JSON['stringify'](_0x6108a8));if(_0x6108a8[_0xdbee('0x1a')]){if(_0x6108a8[_0xdbee('0x1a')][_0xdbee('0x1b')]===0x1f4){logger[_0xdbee('0x1a')](_0xdbee('0x17'),_0x7dfdd1,_0x6108a8[_0xdbee('0x1a')][_0xdbee('0x1c')]);return _0x4eac2d(_0x6108a8['error'][_0xdbee('0x1c')]);}logger[_0xdbee('0x1a')]('MailMessage,\x20%s,\x20%s',_0x7dfdd1,_0x6108a8[_0xdbee('0x1a')][_0xdbee('0x1c')]);return _0x59528b(_0x6108a8['error'][_0xdbee('0x1c')]);}else{logger[_0xdbee('0x16')](_0xdbee('0x17'),_0x7dfdd1,_0xdbee('0x18'));_0x59528b(_0x6108a8[_0xdbee('0x1d')][_0xdbee('0x1c')]);}})[_0xdbee('0x1e')](function(_0x20dadd){logger[_0xdbee('0x1a')](_0xdbee('0x17'),_0x7dfdd1,_0x20dadd);_0x4eac2d(_0x20dadd);});});}function respondWithResult(_0x3434da,_0x5ad435){_0x5ad435=_0x5ad435||0xc8;return function(_0x95ccab){if(_0x95ccab){return _0x3434da['status'](_0x5ad435)[_0xdbee('0x1f')](_0x95ccab);}};}function respondWithFilteredResult(_0x40c61c,_0x3cbeb6){return function(_0x415146){if(_0x415146){var _0x346c2a=typeof _0x3cbeb6[_0xdbee('0x20')]===_0xdbee('0x21')&&typeof _0x3cbeb6['limit']==='undefined';var _0x3fdbf5=_0x415146['count'];var _0x59f973=_0x346c2a?0x0:_0x3cbeb6[_0xdbee('0x20')];var _0x461467=_0x346c2a?_0x415146[_0xdbee('0x22')]:_0x3cbeb6['offset']+_0x3cbeb6[_0xdbee('0x23')];var _0x1c5106;if(_0x461467>=_0x3fdbf5){_0x461467=_0x3fdbf5;_0x1c5106=0xc8;}else{_0x1c5106=0xce;}_0x40c61c[_0xdbee('0x24')](_0x1c5106);return _0x40c61c[_0xdbee('0x25')](_0xdbee('0x26'),_0x59f973+'-'+_0x461467+'/'+_0x3fdbf5)[_0xdbee('0x1f')](_0x415146);}return null;};}function saveUpdates(_0x17cc85){return function(_0x27026f){if(_0x27026f){return _0x27026f[_0xdbee('0x27')](_0x17cc85)[_0xdbee('0x15')](function(_0x20c1be){return _0x20c1be;});}return null;};}function removeEntity(_0x34ae4b){return function(_0xf28346){if(_0xf28346){return _0xf28346[_0xdbee('0x28')]()[_0xdbee('0x15')](function(){_0x34ae4b[_0xdbee('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d20a8){return function(_0x545f74){if(!_0x545f74){_0x4d20a8['sendStatus'](0x194);}return _0x545f74;};}function handleError(_0x54d794,_0x23b579){_0x23b579=_0x23b579||0x1f4;return function(_0x4df49b){logger[_0xdbee('0x1a')](_0x4df49b[_0xdbee('0x29')]);if(_0x4df49b[_0xdbee('0x2a')]){delete _0x4df49b['name'];}_0x54d794[_0xdbee('0x24')](_0x23b579)[_0xdbee('0x2b')](_0x4df49b);};}exports[_0xdbee('0x2c')]=function(_0x168977,_0x132ae5){var _0x5c17d7={},_0x1f5c23={},_0x50399b={'count':0x0,'rows':[]};var _0x3ce5b8=_['map'](db['MailMessage'][_0xdbee('0x2d')],function(_0x510186){return{'name':_0x510186['fieldName'],'type':_0x510186[_0xdbee('0x2e')]['key']};});_0x1f5c23[_0xdbee('0x2f')]=_[_0xdbee('0x30')](_0x3ce5b8,_0xdbee('0x2a'));_0x1f5c23[_0xdbee('0x31')]=_[_0xdbee('0x32')](_0x168977[_0xdbee('0x31')]);_0x1f5c23[_0xdbee('0x33')]=_[_0xdbee('0x34')](_0x1f5c23[_0xdbee('0x2f')],_0x1f5c23['query']);_0x5c17d7[_0xdbee('0x35')]=_[_0xdbee('0x34')](_0x1f5c23[_0xdbee('0x2f')],qs['fields'](_0x168977[_0xdbee('0x31')][_0xdbee('0x36')]));_0x5c17d7['attributes']=_0x5c17d7[_0xdbee('0x35')]['length']?_0x5c17d7[_0xdbee('0x35')]:_0x1f5c23[_0xdbee('0x2f')];if(!_0x168977[_0xdbee('0x31')][_0xdbee('0x37')](_0xdbee('0x38'))){_0x5c17d7['limit']=qs[_0xdbee('0x23')](_0x168977[_0xdbee('0x31')][_0xdbee('0x23')]);_0x5c17d7['offset']=qs['offset'](_0x168977[_0xdbee('0x31')][_0xdbee('0x20')]);}_0x5c17d7[_0xdbee('0x39')]=qs['sort'](_0x168977[_0xdbee('0x31')]['sort']);_0x5c17d7[_0xdbee('0x3a')]=qs[_0xdbee('0x33')](_['pick'](_0x168977['query'],_0x1f5c23['filters']),_0x3ce5b8);if(_0x168977[_0xdbee('0x31')][_0xdbee('0x3b')]){_0x5c17d7[_0xdbee('0x3a')]=_[_0xdbee('0x3c')](_0x5c17d7[_0xdbee('0x3a')],{'$or':_[_0xdbee('0x30')](_0x3ce5b8,function(_0x1b9845){if(_0x1b9845['type']!==_0xdbee('0x3d')){var _0x3b4018={};_0x3b4018[_0x1b9845[_0xdbee('0x2a')]]={'$like':'%'+_0x168977[_0xdbee('0x31')][_0xdbee('0x3b')]+'%'};return _0x3b4018;}})});}_0x5c17d7=_[_0xdbee('0x3c')]({},_0x5c17d7,_0x168977[_0xdbee('0x3e')]);var _0x4d39d7={'where':_0x5c17d7[_0xdbee('0x3a')]};return db[_0xdbee('0x3f')]['count'](_0x4d39d7)['then'](function(_0x90a484){_0x50399b[_0xdbee('0x22')]=_0x90a484;if(_0x168977[_0xdbee('0x31')][_0xdbee('0x40')]){_0x5c17d7[_0xdbee('0x41')]=[{'all':!![]}];}return db[_0xdbee('0x3f')]['findAll'](_0x5c17d7);})[_0xdbee('0x15')](function(_0x2dbeae){_0x50399b['rows']=_0x2dbeae;return _0x50399b;})[_0xdbee('0x15')](respondWithFilteredResult(_0x132ae5,_0x5c17d7))[_0xdbee('0x1e')](handleError(_0x132ae5,null));};exports[_0xdbee('0x42')]=function(_0xe79cd,_0xeb767a){var _0x254bbe={'raw':!![],'where':{'id':_0xe79cd[_0xdbee('0x43')]['id']}},_0x17bb3a={};_0x17bb3a['model']=_[_0xdbee('0x32')](db[_0xdbee('0x3f')]['rawAttributes']);_0x17bb3a[_0xdbee('0x31')]=_[_0xdbee('0x32')](_0xe79cd['query']);_0x17bb3a[_0xdbee('0x33')]=_[_0xdbee('0x34')](_0x17bb3a[_0xdbee('0x2f')],_0x17bb3a['query']);_0x254bbe['attributes']=_['intersection'](_0x17bb3a[_0xdbee('0x2f')],qs[_0xdbee('0x36')](_0xe79cd[_0xdbee('0x31')][_0xdbee('0x36')]));_0x254bbe['attributes']=_0x254bbe['attributes']['length']?_0x254bbe[_0xdbee('0x35')]:_0x17bb3a['model'];if(_0xe79cd[_0xdbee('0x31')][_0xdbee('0x40')]){_0x254bbe[_0xdbee('0x41')]=[{'all':!![]}];}_0x254bbe=_[_0xdbee('0x3c')]({},_0x254bbe,_0xe79cd['options']);return db['MailMessage']['find'](_0x254bbe)[_0xdbee('0x15')](handleEntityNotFound(_0xeb767a,null))[_0xdbee('0x15')](respondWithResult(_0xeb767a,null))[_0xdbee('0x1e')](handleError(_0xeb767a,null));};exports['update']=function(_0x2da089,_0x38c741){if(_0x2da089[_0xdbee('0x44')]['id']){delete _0x2da089[_0xdbee('0x44')]['id'];}return db[_0xdbee('0x3f')][_0xdbee('0x45')]({'where':{'id':_0x2da089[_0xdbee('0x43')]['id']}})['then'](handleEntityNotFound(_0x38c741,null))[_0xdbee('0x15')](saveUpdates(_0x2da089['body'],null))[_0xdbee('0x15')](respondWithResult(_0x38c741,null))[_0xdbee('0x1e')](handleError(_0x38c741,null));};exports[_0xdbee('0x28')]=function(_0x21ab0e,_0x9fd7bf){return db['MailMessage'][_0xdbee('0x45')]({'where':{'id':_0x21ab0e['params']['id']}})[_0xdbee('0x15')](handleEntityNotFound(_0x9fd7bf,null))[_0xdbee('0x15')](removeEntity(_0x9fd7bf,null))[_0xdbee('0x1e')](handleError(_0x9fd7bf,null));};exports[_0xdbee('0x46')]=function(_0x3c9792,_0x2167ac){return db[_0xdbee('0x3f')][_0xdbee('0x46')]()[_0xdbee('0x15')](respondWithResult(_0x2167ac,null))[_0xdbee('0x1e')](handleError(_0x2167ac,null));};exports['create']=function(_0x19707f,_0x599a9b){return db[_0xdbee('0x3f')][_0xdbee('0x47')](_0x19707f[_0xdbee('0x44')])['then'](function(_0x4f61ad){if(_0x4f61ad){if(_0x4f61ad[_0xdbee('0x48')]===_0xdbee('0x49')&&!_0x4f61ad[_0xdbee('0x4a')]){var _0x3878b0,_0xed2397,_0x45a69d;if(_0x19707f[_0xdbee('0x44')]['to']){_0xed2397=_0x19707f['body']['to'][_0xdbee('0x4b')](',')[0x0];}return db[_0xdbee('0x4c')][_0xdbee('0x4d')]({'where':{'id':_0x4f61ad[_0xdbee('0x4e')]},'include':[{'model':db[_0xdbee('0x4f')],'as':'List','include':[{'model':db['CmContact'],'as':_0xdbee('0x50'),'where':{'email':_0xed2397},'limit':0x1,'order':[['updatedAt',_0xdbee('0x51')]]}]},{'model':db[_0xdbee('0x52')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xdbee('0x53')],'as':_0xdbee('0x53'),'raw':!![]}]}]})[_0xdbee('0x15')](function(_0xb23242){_0x3878b0=_0xb23242;if(!_0x3878b0||!_0x3878b0[_0xdbee('0x54')])return;var _0x408cd3=_0x3878b0[_0xdbee('0x55')]();if(_0x19707f[_0xdbee('0x44')][_0xdbee('0x56')]&&_0x19707f[_0xdbee('0x44')]['attachments'][_0xdbee('0x57')]){for(var _0x58fdd7=0x0;_0x58fdd7<_0x19707f[_0xdbee('0x44')]['attachments'][_0xdbee('0x57')];_0x58fdd7+=0x1){_0x19707f[_0xdbee('0x44')][_0xdbee('0x56')][_0x58fdd7]={'filename':_0x19707f[_0xdbee('0x44')][_0xdbee('0x56')][_0x58fdd7][_0xdbee('0x2a')],'path':path[_0xdbee('0x58')](config['root'],_0xdbee('0x59'),_0x19707f[_0xdbee('0x44')][_0xdbee('0x56')][_0x58fdd7][_0xdbee('0x5a')])};}}_0x45a69d={'account':_0x408cd3,'message':_0x19707f[_0xdbee('0x44')]};return;})[_0xdbee('0x15')](function(){if(_0x3878b0[_0xdbee('0x5b')]){if(_0x3878b0[_0xdbee('0x5b')]['Contacts'][_0xdbee('0x57')]){return _0x3878b0['List'][_0xdbee('0x50')][0x0];}else{return db[_0xdbee('0x5c')][_0xdbee('0x47')](_[_0xdbee('0xe')](_0x19707f[_0xdbee('0x44')],{'firstName':_0x19707f[_0xdbee('0x44')]['to'],'email':_0x19707f[_0xdbee('0x44')]['to'],'phone':_0x19707f[_0xdbee('0x44')]['to'],'ListId':_0x3878b0[_0xdbee('0x5d')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xdbee('0x15')](function(){if(_0x45a69d){return respondWithRpcPromise(_0xdbee('0x5e'),'sendMail',_0x45a69d,client9003)[_0xdbee('0x15')](function(_0x22d7f9){return _0x4f61ad['update']({'read':!![],'messageId':_0x22d7f9[_0xdbee('0x5f')],'sentAt':moment()[_0xdbee('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdbee('0x1e')](function(_0x4811b4){logger['error']('%s',JSON[_0xdbee('0x61')](_0x4811b4));return _0x4f61ad;});}return _0x4f61ad;});}return _0x4f61ad;}})[_0xdbee('0x15')](respondWithResult(_0x599a9b,0xc9))[_0xdbee('0x1e')](handleError(_0x599a9b,null));};exports[_0xdbee('0x62')]=function(_0x4d547d,_0x3a5f3f){var _0x281b17={'agent':{},'channel':_0xdbee('0x63')};if(_0x4d547d[_0xdbee('0x44')]['id']){delete _0x4d547d[_0xdbee('0x44')]['id'];}_0x4d547d[_0xdbee('0x44')][_0xdbee('0x64')]=!![];_0x4d547d[_0xdbee('0x44')]['readAt']=moment()['format'](_0xdbee('0x65'));_0x4d547d[_0xdbee('0x44')][_0xdbee('0x66')]=_0x4d547d[_0xdbee('0x44')]['UserId']||_0x4d547d[_0xdbee('0x67')]['id'];_0x281b17[_0xdbee('0x68')]['id']=_0x4d547d['body']['UserId'];return db[_0xdbee('0x3f')][_0xdbee('0x45')]({'where':{'id':_0x4d547d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3a5f3f,null))[_0xdbee('0x15')](saveUpdates(_0x4d547d[_0xdbee('0x44')],null))[_0xdbee('0x15')](function(_0x483ca0){if(_0x483ca0){_0x281b17[_0xdbee('0x1c')]=_0x483ca0[_0xdbee('0x69')]({'plain':!![]});return db[_0xdbee('0x6a')][_0xdbee('0x45')]({'where':{'id':_0x483ca0[_0xdbee('0x6b')]}});}return null;})[_0xdbee('0x15')](handleEntityNotFound(_0x3a5f3f,null))[_0xdbee('0x15')](function(_0x419d70){if(_0x419d70){return _0x419d70['update']({'UserId':_0x4d547d['body']['UserId'],'read1stAt':_[_0xdbee('0x6c')](_0x419d70[_0xdbee('0x6d')])?moment()[_0xdbee('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdbee('0x15')](function(_0x4ad6d7){if(_0x4ad6d7){_0x281b17[_0xdbee('0x6e')]=_0x4ad6d7['get']({'plain':!![]});interaction_log['info'](_0xdbee('0x6f'),_0x4d547d[_0xdbee('0x67')]['id'],_0x4d547d[_0xdbee('0x67')][_0xdbee('0x2a')],_0x4d547d['user'][_0xdbee('0x70')],_0x281b17[_0xdbee('0x6e')]['id'],_0x4d547d[_0xdbee('0x44')]?JSON['stringify'](_0x4d547d[_0xdbee('0x44')]):_0xdbee('0x71'));return respondWithRpcPromise(_0xdbee('0x72'),_0xdbee('0x73'),_0x281b17);}return null;})['then'](function(_0x1b338d){var _0x5cbb39=_0xdbee('0x74')+_0x1b338d[_0xdbee('0x1c')][_0xdbee('0x75')];return db[_0xdbee('0x76')][_0xdbee('0x31')](_0x5cbb39,{'type':db['Sequelize']['QueryTypes'][_0xdbee('0x77')],'raw':!![]})['then'](function(_0x41f1b9){return _0x41f1b9;});})[_0xdbee('0x15')](function(_0x565019){if(_0x565019){_0x281b17[_0xdbee('0x1c')][_0xdbee('0x78')]=_0x565019[0x0];if(!_0x4d547d['body'][_0xdbee('0x66')])return;return db[_0xdbee('0x79')][_0xdbee('0x45')]({'where':{'id':_0x4d547d[_0xdbee('0x44')][_0xdbee('0x66')],'role':_0xdbee('0x68')},'attributes':['id',_0xdbee('0x2a'),_0xdbee('0x7a'),_0xdbee('0x7b'),_0xdbee('0x7c')],'raw':!![]});}return null;})[_0xdbee('0x15')](function(_0x5e5b84){if(!_0x5e5b84)return null;_0x281b17[_0xdbee('0x1c')][_0xdbee('0x68')]=_0x5e5b84;return _0x281b17;})[_0xdbee('0x15')](function(_0x284faf){if(_0x284faf){if(_0x4d547d[_0xdbee('0x44')][_0xdbee('0x7d')]){_0x281b17[_0xdbee('0x1c')][_0xdbee('0x7e')]=util[_0xdbee('0x60')](_0xdbee('0x7f'),_0x4d547d[_0xdbee('0x67')][_0xdbee('0x2a')]);_0x281b17['message'][_0xdbee('0x80')]=_0x281b17[_0xdbee('0x80')];_0x281b17[_0xdbee('0x1c')][_0xdbee('0x81')]=_0x281b17['channel'];_0x281b17[_0xdbee('0x1c')][_0xdbee('0x82')]=_0xdbee('0x62');_0x281b17[_0xdbee('0x1c')]['body']=htmlToText[_0xdbee('0x83')](_0x281b17['message'][_0xdbee('0x44')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xdbee('0x84'),'message':_0x281b17['message']},client9002)['then'](function(){return _0x281b17;});}return _0x281b17;}return null;})['then'](respondWithResult(_0x3a5f3f,null))[_0xdbee('0x1e')](handleError(_0x3a5f3f,null));};exports['reject']=function(_0x39f8ab,_0x4d779e){var _0x5f366a={'agent':{},'channel':_0xdbee('0x63')};if(_0x39f8ab[_0xdbee('0x44')]['id']){delete _0x39f8ab[_0xdbee('0x44')]['id'];}_0x39f8ab[_0xdbee('0x44')][_0xdbee('0x66')]=_0x39f8ab['body'][_0xdbee('0x66')]||_0x39f8ab[_0xdbee('0x67')]['id'];_0x5f366a[_0xdbee('0x68')]['id']=_0x39f8ab[_0xdbee('0x44')][_0xdbee('0x66')];return db['MailMessage']['find']({'where':{'id':_0x39f8ab['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4d779e,null))[_0xdbee('0x15')](function(_0x3df252){if(_0x3df252){_0x5f366a[_0xdbee('0x1c')]=_0x3df252['get']({'plain':!![]});return db[_0xdbee('0x6a')][_0xdbee('0x45')]({'where':{'id':_0x3df252[_0xdbee('0x6b')]}});}return null;})[_0xdbee('0x15')](handleEntityNotFound(_0x4d779e,null))[_0xdbee('0x15')](function(_0x2cfde7){if(_0x2cfde7){_0x5f366a[_0xdbee('0x6e')]=_0x2cfde7[_0xdbee('0x69')]({'plain':!![]});interaction_log[_0xdbee('0x16')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x39f8ab[_0xdbee('0x67')]['id'],_0x39f8ab['user']['name'],_0x39f8ab['user']['role'],_0x5f366a[_0xdbee('0x6e')]['id'],_0x39f8ab[_0xdbee('0x44')]?JSON[_0xdbee('0x61')](_0x39f8ab[_0xdbee('0x44')]):'null');return respondWithRpcPromise(_0xdbee('0x85'),'rejectMessage',_0x5f366a);}return null;})['then'](function(_0x1134d8){var _0x28931f=_0xdbee('0x74')+_0x1134d8[_0xdbee('0x1c')][_0xdbee('0x75')];return db['sequelize'][_0xdbee('0x31')](_0x28931f,{'type':db['Sequelize'][_0xdbee('0x86')][_0xdbee('0x77')],'raw':!![]})['then'](function(_0x3ca2fb){return _0x3ca2fb;});})['then'](function(_0x20708f){if(_0x20708f){_0x5f366a[_0xdbee('0x1c')][_0xdbee('0x78')]=_0x20708f[0x0];if(!_0x39f8ab[_0xdbee('0x44')][_0xdbee('0x66')])return;return db[_0xdbee('0x79')][_0xdbee('0x45')]({'where':{'id':_0x39f8ab[_0xdbee('0x44')][_0xdbee('0x66')],'role':_0xdbee('0x68')},'attributes':['id','name','fullname',_0xdbee('0x7b'),_0xdbee('0x7c')],'raw':!![]});}return null;})['then'](function(_0x5f1396){if(!_0x5f1396)return null;_0x5f366a[_0xdbee('0x1c')][_0xdbee('0x68')]=_0x5f1396;return _0x5f366a;})[_0xdbee('0x15')](function(_0x264e29){if(_0x264e29){_0x264e29[_0xdbee('0x1c')][_0xdbee('0x7e')]=util[_0xdbee('0x60')](_0xdbee('0x7f'),_0x39f8ab[_0xdbee('0x67')][_0xdbee('0x2a')]);_0x264e29[_0xdbee('0x1c')]['channel']=_0x5f366a['channel'];_0x264e29[_0xdbee('0x1c')][_0xdbee('0x81')]=_0x5f366a[_0xdbee('0x80')];_0x264e29['message'][_0xdbee('0x82')]=_0xdbee('0x87');_0x264e29[_0xdbee('0x1c')][_0xdbee('0x44')]=htmlToText[_0xdbee('0x83')](_0x5f366a[_0xdbee('0x1c')][_0xdbee('0x44')]);respondWithRpcPromise(_0xdbee('0x88'),_0xdbee('0x88'),{'event':_0xdbee('0x89'),'message':_0x264e29[_0xdbee('0x1c')]},client9002);return _0x5f366a;}return null;})[_0xdbee('0x15')](respondWithResult(_0x4d779e,null))[_0xdbee('0x1e')](handleError(_0x4d779e,null));};exports[_0xdbee('0x8a')]=function(_0x16d0e9,_0x529c91){var _0x27f2ee=moment()[_0xdbee('0x8b')]()[_0xdbee('0x8c')]();var _0x6f2de=path[_0xdbee('0x58')](config[_0xdbee('0x8d')],_0xdbee('0x8e'),_0xdbee('0x8f'),_0xdbee('0x90'));var _0xebb59b=path[_0xdbee('0x58')](config[_0xdbee('0x8d')],_0xdbee('0x8e'),_0xdbee('0x8f'),'attachments');var _0x3ac7db=util['format'](_0xdbee('0x91'),_0x27f2ee);return db[_0xdbee('0x3f')][_0xdbee('0x45')]({'where':{'id':_0x16d0e9['params']['id']},'attributes':['id',_0xdbee('0x44'),_0xdbee('0x92'),'to','cc',_0xdbee('0x93'),'subject',_0xdbee('0x94')],'include':_0x16d0e9[_0xdbee('0x31')][_0xdbee('0x56')]?[{'model':db[_0xdbee('0x95')],'as':_0xdbee('0x96')}]:undefined})['then'](handleEntityNotFound(_0x529c91,null))[_0xdbee('0x15')](function(_0x4c205e){if(_0x4c205e){var _0x2f7247=_0x4c205e;var _0x5a47b4={'from':_0x2f7247[_0xdbee('0x92')],'to':_0x2f7247['to'],'subject':_0x2f7247[_0xdbee('0x97')],'html':htmlEntities[_0xdbee('0x98')](_0x2f7247[_0xdbee('0x44')]),'headers':{'Date':moment(_0x2f7247['createdAt'])[_0xdbee('0x60')](_0xdbee('0x99'))},'attachments':[]};if(_0x4c205e['cc']){_0x5a47b4[_0xdbee('0x9a')]['Cc']=_0x4c205e['cc'];}if(_0x4c205e['bcc']){_0x5a47b4['headers'][_0xdbee('0x9b')]=_0x4c205e['bcc'];}return new BPromise(function(_0x19ce09,_0x520947){if(_0x4c205e[_0xdbee('0x96')]){for(var _0x64e24b=0x0;_0x64e24b<_0x4c205e['Attachments'][_0xdbee('0x57')];_0x64e24b++){var _0x193364=_0x4c205e[_0xdbee('0x96')][_0x64e24b];var _0x4eb787=path[_0xdbee('0x58')](_0xebb59b,_0x193364[_0xdbee('0x5a')]);if(fs[_0xdbee('0x9c')](_0x4eb787)){_0x5a47b4[_0xdbee('0x56')]['push']({'name':_0x193364[_0xdbee('0x2a')],'contentType':_0x193364[_0xdbee('0x2e')],'data':fs[_0xdbee('0x9d')](_0x4eb787)});}}}emlformat['build'](_0x5a47b4,function(_0x5aa430,_0x42f9ad){if(_0x5aa430)return _0x520947(_0x5aa430);fs['writeFileSync'](path[_0xdbee('0x58')](_0x6f2de,_0x3ac7db),_0x42f9ad);return _0x19ce09(_0x42f9ad);});});}})[_0xdbee('0x15')](function(_0x15e446){if(_0x15e446){return _0x529c91[_0xdbee('0x8a')](path[_0xdbee('0x58')](_0x6f2de,_0x3ac7db),_0x3ac7db,function(_0x24391e){if(!_0x24391e)fs[_0xdbee('0x9e')](path[_0xdbee('0x58')](_0x6f2de,_0x3ac7db));});}})[_0xdbee('0x1e')](handleError(_0x529c91,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fced165..0a1c6b4 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 _0xdf38=['MailMessage','setMaxListeners','save','remove','emit','events','../../mysqldb'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xdf38,0x1b7));var _0x8df3=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xdf38[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x8df3('0x0'));var MailMessage=require(_0x8df3('0x1'))['db'][_0x8df3('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8df3('0x3')](0x0);var events={'afterCreate':_0x8df3('0x4'),'afterUpdate':'update','afterDestroy':_0x8df3('0x5')};function emitEvent(_0x3dc8b7){return function(_0x596708,_0x32b67f,_0x13e90b){MailMessageEvents[_0x8df3('0x6')](_0x3dc8b7+':'+_0x596708['id'],_0x596708);MailMessageEvents[_0x8df3('0x6')](_0x3dc8b7,_0x596708);_0x13e90b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xa1cb=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xa1cb,0x159));var _0xba1c=function(_0xe5cac7,_0x6c2f84){_0xe5cac7=_0xe5cac7-0x0;var _0x50df20=_0xa1cb[_0xe5cac7];return _0x50df20;};'use strict';var EventEmitter=require(_0xba1c('0x0'));var MailMessage=require(_0xba1c('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xba1c('0x2')](0x0);var events={'afterCreate':_0xba1c('0x3'),'afterUpdate':_0xba1c('0x4'),'afterDestroy':_0xba1c('0x5')};function emitEvent(_0x36003d){return function(_0x53e5c5,_0x272b60,_0x19d79a){MailMessageEvents[_0xba1c('0x6')](_0x36003d+':'+_0x53e5c5['id'],_0x53e5c5);MailMessageEvents['emit'](_0x36003d,_0x53e5c5);_0x19d79a(null);};}for(var e in events){if(events[_0xba1c('0x7')](e)){var event=events[e];MailMessage[_0xba1c('0x8')](e,emitEvent(event));}}module[_0xba1c('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 954584c..4746cf9 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 _0xa0d4=['direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','exports','define','mail_messages','fti_mail_messages','plainBody','subject','body','fromString','get'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa0d4,0x85));var _0x4a0d=function(_0x36a17c,_0x1c2dbc){_0x36a17c=_0x36a17c-0x0;var _0x55e639=_0xa0d4[_0x36a17c];return _0x55e639;};'use strict';var _=require(_0x4a0d('0x0'));var util=require(_0x4a0d('0x1'));var logger=require(_0x4a0d('0x2'))('api');var moment=require(_0x4a0d('0x3'));var BPromise=require(_0x4a0d('0x4'));var rp=require('request-promise');var htmlToText=require(_0x4a0d('0x5'));var fs=require('fs');var path=require(_0x4a0d('0x6'));var rimraf=require(_0x4a0d('0x7'));var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x4a0d('0x8')]=function(_0x5bbbc9,_0x59a9bb){return _0x5bbbc9[_0x4a0d('0x9')]('MailMessage',attributes,{'tableName':_0x4a0d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x4a0d('0xb'),'fields':[_0x4a0d('0xc'),_0x4a0d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c2025,_0x2f2df1,_0x293474){if(_0x2c2025[_0x4a0d('0xe')]){_0x2c2025[_0x4a0d('0xc')]=htmlToText[_0x4a0d('0xf')](_0x2c2025['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x293474(null,_0x2f2df1);},'afterCreate':function(_0x412d54,_0x4b25d6,_0x127166){var _0x2be79e=_0x5bbbc9['models'];var _0x4672be=_0x412d54[_0x4a0d('0x10')]({'plain':!![]});if(_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()==='in'||_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()===_0x4a0d('0x13')&&!_0x4672be[_0x4a0d('0x14')]&&!_[_0x4a0d('0x15')](_0x4672be[_0x4a0d('0x16')])){_0x2be79e[_0x4a0d('0x17')][_0x4a0d('0x18')]({'where':{'id':_0x4672be[_0x4a0d('0x19')]}})['then'](function(_0x2ec5e2){if(_0x2ec5e2){_0x2ec5e2['update']({'lastMsgAt':_0x4672be['createdAt'],'lastMsgDirection':_0x4672be[_0x4a0d('0x11')][_0x4a0d('0x12')]()});}})[_0x4a0d('0x1a')](function(_0x200ed8){console[_0x4a0d('0x1b')](_0x200ed8);});}_0x127166();}},'charset':_0x4a0d('0x1c'),'collate':_0x4a0d('0x1d')});}; \ No newline at end of file +var _0x0a4a=['./mailMessage.attributes','exports','MailMessage','mail_messages','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','rimraf'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x0a4a,0x121));var _0xa0a4=function(_0x2f30f8,_0x39b7ee){_0x2f30f8=_0x2f30f8-0x0;var _0x37b8d4=_0x0a4a[_0x2f30f8];return _0x37b8d4;};'use strict';var _=require(_0xa0a4('0x0'));var util=require(_0xa0a4('0x1'));var logger=require(_0xa0a4('0x2'))('api');var moment=require(_0xa0a4('0x3'));var BPromise=require(_0xa0a4('0x4'));var rp=require(_0xa0a4('0x5'));var htmlToText=require(_0xa0a4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0a4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0a4('0x8'));module[_0xa0a4('0x9')]=function(_0x536dcc,_0x70e265){return _0x536dcc['define'](_0xa0a4('0xa'),attributes,{'tableName':_0xa0a4('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xa0a4('0xc'),'fields':[_0xa0a4('0xd'),_0xa0a4('0xe')],'type':_0xa0a4('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3754d8,_0x247bd4,_0x1125e1){if(_0x3754d8[_0xa0a4('0x10')]){_0x3754d8['plainBody']=htmlToText[_0xa0a4('0x11')](_0x3754d8[_0xa0a4('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1125e1(null,_0x247bd4);},'afterCreate':function(_0x496717,_0x143e63,_0x1d4ee5){var _0xf99848=_0x536dcc[_0xa0a4('0x12')];var _0x16d5ad=_0x496717[_0xa0a4('0x13')]({'plain':!![]});if(_0x16d5ad[_0xa0a4('0x14')][_0xa0a4('0x15')]()==='in'||_0x16d5ad[_0xa0a4('0x14')][_0xa0a4('0x15')]()===_0xa0a4('0x16')&&!_0x16d5ad[_0xa0a4('0x17')]&&!_[_0xa0a4('0x18')](_0x16d5ad['UserId'])){_0xf99848[_0xa0a4('0x19')]['findOne']({'where':{'id':_0x16d5ad[_0xa0a4('0x1a')]}})[_0xa0a4('0x1b')](function(_0x26fe3a){if(_0x26fe3a){_0x26fe3a[_0xa0a4('0x1c')]({'lastMsgAt':_0x16d5ad[_0xa0a4('0x1d')],'lastMsgDirection':_0x16d5ad[_0xa0a4('0x14')][_0xa0a4('0x15')]()});}})[_0xa0a4('0x1e')](function(_0xa34047){console[_0xa0a4('0x1f')](_0xa34047);});}_0x1d4ee5();}},'charset':_0xa0a4('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 5c5d619..ecf21b5 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 _0x0abf=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info'];(function(_0x593467,_0x14e615){var _0x67a71b=function(_0x32799e){while(--_0x32799e){_0x593467['push'](_0x593467['shift']());}};_0x67a71b(++_0x14e615);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});config[_0xf0ab('0xa')]=_['defaults'](config[_0xf0ab('0xa')],{'host':_0xf0ab('0xb'),'port':0x18eb});var socket=require(_0xf0ab('0xc'))(new Redis(config[_0xf0ab('0xa')]));require('./mailMessage.socket')[_0xf0ab('0xd')](socket);function respondWithRpcPromise(_0x4688d8,_0x1e7887,_0x4ab8e7){return new BPromise(function(_0x5d25a0,_0x30042c){return client['request'](_0x4688d8,_0x4ab8e7)[_0xf0ab('0xe')](function(_0x10a5a2){logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));logger[_0xf0ab('0x12')](_0xf0ab('0x13'),_0x1e7887,'request\x20sent',JSON[_0xf0ab('0x14')](_0x10a5a2));if(_0x10a5a2[_0xf0ab('0x15')]){if(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x16')]===0x1f4){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x30042c(_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);}logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x10a5a2[_0xf0ab('0x15')][_0xf0ab('0x17')]);return _0x5d25a0(_0x10a5a2[_0xf0ab('0x15')]['message']);}else{logger[_0xf0ab('0xf')](_0xf0ab('0x10'),_0x1e7887,_0xf0ab('0x11'));_0x5d25a0(_0x10a5a2[_0xf0ab('0x18')][_0xf0ab('0x17')]);}})[_0xf0ab('0x19')](function(_0x3a0edf){logger[_0xf0ab('0x15')](_0xf0ab('0x10'),_0x1e7887,_0x3a0edf);_0x30042c(_0x3a0edf);});});}exports[_0xf0ab('0x1a')]=function(_0x715579){var _0xdfcfb2=this;return new Promise(function(_0xf43bc4,_0x22a205){return db[_0xf0ab('0x1b')][_0xf0ab('0x1c')](_0x715579['body'],{'raw':_0x715579[_0xf0ab('0x1d')]?_0x715579[_0xf0ab('0x1d')][_0xf0ab('0x1e')]===undefined?!![]:![]:!![]})[_0xf0ab('0xe')](function(_0x3bf6a1){logger[_0xf0ab('0xf')](_0xf0ab('0x1a'),_0x715579);logger[_0xf0ab('0x12')](_0xf0ab('0x1a'),_0x715579,JSON[_0xf0ab('0x14')](_0x3bf6a1));_0xf43bc4(_0x3bf6a1);})[_0xf0ab('0x19')](function(_0x5645b2){logger['error']('CreateMailMessage',_0x5645b2[_0xf0ab('0x17')],_0x715579);_0x22a205(_0xdfcfb2['error'](0x1f4,_0x5645b2[_0xf0ab('0x17')]));});});}; \ No newline at end of file +var _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0x170f8b,_0x575b2c){var _0x51cef4=function(_0x17a607){while(--_0x17a607){_0x170f8b['push'](_0x170f8b['shift']());}};_0x51cef4(++_0x575b2c);}(_0x6343,0x168));var _0x3634=function(_0x52923e,_0x30caac){_0x52923e=_0x52923e-0x0;var _0x1e6fb2=_0x6343[_0x52923e];return _0x1e6fb2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 038baa4..0ed9afb 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 _0x13e9=['remove','update','removeListener','register','length','./mailMessage.events','save'];(function(_0x1428a5,_0x509abe){var _0x4b847a=function(_0x26132a){while(--_0x26132a){_0x1428a5['push'](_0x1428a5['shift']());}};_0x4b847a(++_0x509abe);}(_0x13e9,0xf3));var _0x913e=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x13e9[_0x334841];return _0x5beb4b;};'use strict';var MailMessageEvents=require(_0x913e('0x0'));var events=[_0x913e('0x1'),_0x913e('0x2'),_0x913e('0x3')];function createListener(_0x46bbbc,_0x657f2f){return function(_0x54a5dd){_0x657f2f['emit'](_0x46bbbc,_0x54a5dd);};}function removeListener(_0x3e7549,_0x19f4b2){return function(){MailMessageEvents[_0x913e('0x4')](_0x3e7549,_0x19f4b2);};}exports[_0x913e('0x5')]=function(_0x4535f9){for(var _0xaaeb06=0x0,_0xe659c1=events[_0x913e('0x6')];_0xaaeb06<_0xe659c1;_0xaaeb06++){var _0x29f2cf=events[_0xaaeb06];var _0x19ea3e=createListener('mailMessage:'+_0x29f2cf,_0x4535f9);MailMessageEvents['on'](_0x29f2cf,_0x19ea3e);}}; \ No newline at end of file +var _0xbc8f=['update','removeListener','length','mailMessage:','save','remove'];(function(_0x177803,_0x383358){var _0x55b3f8=function(_0x13bc67){while(--_0x13bc67){_0x177803['push'](_0x177803['shift']());}};_0x55b3f8(++_0x383358);}(_0xbc8f,0x154));var _0xfbc8=function(_0x50d8d0,_0x240df4){_0x50d8d0=_0x50d8d0-0x0;var _0x526b6b=_0xbc8f[_0x50d8d0];return _0x526b6b;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xfbc8('0x0'),_0xfbc8('0x1'),_0xfbc8('0x2')];function createListener(_0x5bb3c4,_0x227eb9){return function(_0x9b0650){_0x227eb9['emit'](_0x5bb3c4,_0x9b0650);};}function removeListener(_0x5525b5,_0x23b85a){return function(){MailMessageEvents[_0xfbc8('0x3')](_0x5525b5,_0x23b85a);};}exports['register']=function(_0x5079fe){for(var _0x23d40f=0x0,_0x5674a4=events[_0xfbc8('0x4')];_0x23d40f<_0x5674a4;_0x23d40f++){var _0x5d1cba=events[_0x23d40f];var _0x2241d7=createListener(_0xfbc8('0x5')+_0x5d1cba,_0x5079fe);MailMessageEvents['on'](_0x5d1cba,_0x2241d7);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index da97724..c3e1c98 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 _0x1198=['index','/describe','show','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x115581,_0x4e6fc6){var _0x1acaa4=function(_0x3b2788){while(--_0x3b2788){_0x115581['push'](_0x115581['shift']());}};_0x1acaa4(++_0x4e6fc6);}(_0x1198,0x148));var _0x8119=function(_0x51fc35,_0x34bb18){_0x51fc35=_0x51fc35-0x0;var _0x370154=_0x1198[_0x51fc35];return _0x370154;};'use strict';var multer=require(_0x8119('0x0'));var util=require(_0x8119('0x1'));var path=require(_0x8119('0x2'));var timeout=require(_0x8119('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8119('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8119('0x5'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0x8119('0x6')]('/',auth[_0x8119('0x7')](),controller[_0x8119('0x8')]);router[_0x8119('0x6')](_0x8119('0x9'),auth[_0x8119('0x7')](),controller['describe']);router[_0x8119('0x6')]('/:id',auth[_0x8119('0x7')](),controller[_0x8119('0xa')]);router[_0x8119('0x6')]('/:id/members',auth[_0x8119('0x7')](),controller[_0x8119('0xb')]);router[_0x8119('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x8119('0xc')]);router[_0x8119('0x6')](_0x8119('0xd'),auth[_0x8119('0x7')](),controller['getAgents']);router[_0x8119('0xe')]('/',auth[_0x8119('0x7')](),controller[_0x8119('0xf')]);router['post'](_0x8119('0x10'),auth[_0x8119('0x7')](),controller['addTeams']);router[_0x8119('0xe')](_0x8119('0xd'),auth[_0x8119('0x7')](),controller[_0x8119('0x11')]);router[_0x8119('0x12')]('/:id',auth[_0x8119('0x7')](),controller['update']);router[_0x8119('0x13')]('/:id',auth[_0x8119('0x7')](),controller[_0x8119('0x14')]);router[_0x8119('0x13')](_0x8119('0x10'),auth[_0x8119('0x7')](),controller[_0x8119('0x15')]);router['delete'](_0x8119('0xd'),auth['isAuthenticated'](),controller[_0x8119('0x16')]);module[_0x8119('0x17')]=router; \ No newline at end of file +var _0xbc14=['fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','create','post','/:id/teams','addTeams','addAgents','delete','destroy','removeTeams','/:id/users','removeAgents','multer','path','connect-timeout','Router'];(function(_0x40a0a4,_0x4269e1){var _0x115c37=function(_0x22bbf0){while(--_0x22bbf0){_0x40a0a4['push'](_0x40a0a4['shift']());}};_0x115c37(++_0x4269e1);}(_0xbc14,0x130));var _0x4bc1=function(_0x21a1a6,_0x1474bf){_0x21a1a6=_0x21a1a6-0x0;var _0x5cec0e=_0xbc14[_0x21a1a6];return _0x5cec0e;};'use strict';var multer=require(_0x4bc1('0x0'));var util=require('util');var path=require(_0x4bc1('0x1'));var timeout=require(_0x4bc1('0x2'));var express=require('express');var router=express[_0x4bc1('0x3')]();var fs_extra=require(_0x4bc1('0x4'));var auth=require(_0x4bc1('0x5'));var interaction=require(_0x4bc1('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4bc1('0x7')]);router[_0x4bc1('0x8')](_0x4bc1('0x9'),auth[_0x4bc1('0xa')](),controller[_0x4bc1('0xb')]);router[_0x4bc1('0x8')](_0x4bc1('0xc'),auth[_0x4bc1('0xa')](),controller[_0x4bc1('0xd')]);router['get'](_0x4bc1('0xe'),auth['isAuthenticated'](),controller[_0x4bc1('0xf')]);router[_0x4bc1('0x8')]('/:id/teams',auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x10')]);router[_0x4bc1('0x8')]('/:id/users',auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4bc1('0x12')]);router[_0x4bc1('0x13')](_0x4bc1('0x14'),auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x15')]);router['post']('/:id/users',auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x16')]);router['put'](_0x4bc1('0xc'),auth[_0x4bc1('0xa')](),controller['update']);router[_0x4bc1('0x17')](_0x4bc1('0xc'),auth['isAuthenticated'](),controller[_0x4bc1('0x18')]);router[_0x4bc1('0x17')](_0x4bc1('0x14'),auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x19')]);router[_0x4bc1('0x17')](_0x4bc1('0x1a'),auth[_0x4bc1('0xa')](),controller[_0x4bc1('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 5f84b8d..bb81a51 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 _0x3517=['INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3517,0x13b));var _0x7351=function(_0x5c40fb,_0x3ae75b){_0x5c40fb=_0x5c40fb-0x0;var _0x46266d=_0x3517[_0x5c40fb];return _0x46266d;};'use strict';var Sequelize=require(_0x7351('0x0'));module[_0x7351('0x1')]={'name':{'type':Sequelize[_0x7351('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7351('0x2')]},'timeout':{'type':Sequelize[_0x7351('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7351('0x4'),_0x7351('0x5'))}}; \ No newline at end of file +var _0x69f5=['sequelize','exports','STRING','rrmemory','beepall','roundrobin'];(function(_0x5cf5ca,_0x24b617){var _0x64b85a=function(_0x3943c1){while(--_0x3943c1){_0x5cf5ca['push'](_0x5cf5ca['shift']());}};_0x64b85a(++_0x24b617);}(_0x69f5,0x84));var _0x569f=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0x69f5[_0xdbd4f7];return _0x5c3f9d;};'use strict';var Sequelize=require(_0x569f('0x0'));module[_0x569f('0x1')]={'name':{'type':Sequelize[_0x569f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x569f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x569f('0x3'),_0x569f('0x4'),_0x569f('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9e5aafe..569012e 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 _0x1be9=['to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','MailQueue','includeAll','catch','show','params','length','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','MailQueues','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','order','MailQueueId','findAll','UserId','mailPause','updatedAt','%s/%s','SIP','Team','getTeams','ids','User','Agents','interface','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js'];(function(_0xf35bc1,_0x510803){var _0xa6b162=function(_0x1e5cc8){while(--_0x1e5cc8){_0xf35bc1['push'](_0xf35bc1['shift']());}};_0xa6b162(++_0x510803);}(_0x1be9,0x77));var _0x91be=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1be9[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x91be('0x0'));var rimraf=require(_0x91be('0x1'));var zipdir=require(_0x91be('0x2'));var jsonpatch=require(_0x91be('0x3'));var rp=require('request-promise');var moment=require(_0x91be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91be('0x5'));var util=require(_0x91be('0x6'));var path=require(_0x91be('0x7'));var sox=require(_0x91be('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91be('0x9'));var _=require(_0x91be('0xa'));var squel=require(_0x91be('0xb'));var crypto=require(_0x91be('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x91be('0xd'));var toCsv=require(_0x91be('0xe'));var querystring=require(_0x91be('0xf'));var Papa=require('papaparse');var Redis=require(_0x91be('0x10'));var authService=require(_0x91be('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91be('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x91be('0x13'));var config=require(_0x91be('0x14'));var licenseUtil=require(_0x91be('0x15'));var db=require(_0x91be('0x16'))['db'];config[_0x91be('0x17')]=_[_0x91be('0x18')](config[_0x91be('0x17')],{'host':_0x91be('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91be('0x17')]));require(_0x91be('0x1a'))[_0x91be('0x1b')](socket);function respondWithStatusCode(_0x27186d,_0x36a103){_0x36a103=_0x36a103||0xcc;return function(_0xb7849e){if(_0xb7849e){return _0x27186d[_0x91be('0x1c')](_0x36a103);}return _0x27186d[_0x91be('0x1d')](_0x36a103)[_0x91be('0x1e')]();};}function respondWithResult(_0x2af163,_0x40a37b){_0x40a37b=_0x40a37b||0xc8;return function(_0x55c517){if(_0x55c517){return _0x2af163['status'](_0x40a37b)['json'](_0x55c517);}};}function respondWithFilteredResult(_0x5ec52c,_0x3012c5){return function(_0x3230a2){if(_0x3230a2){var _0x4b47c5=typeof _0x3012c5[_0x91be('0x1f')]===_0x91be('0x20')&&typeof _0x3012c5[_0x91be('0x21')]==='undefined';var _0x16cc8f=_0x3230a2[_0x91be('0x22')];var _0x1a3592=_0x4b47c5?0x0:_0x3012c5[_0x91be('0x1f')];var _0x3f107a=_0x4b47c5?_0x3230a2[_0x91be('0x22')]:_0x3012c5[_0x91be('0x1f')]+_0x3012c5[_0x91be('0x21')];var _0x595c1b;if(_0x3f107a>=_0x16cc8f){_0x3f107a=_0x16cc8f;_0x595c1b=0xc8;}else{_0x595c1b=0xce;}_0x5ec52c[_0x91be('0x1d')](_0x595c1b);return _0x5ec52c[_0x91be('0x23')]('Content-Range',_0x1a3592+'-'+_0x3f107a+'/'+_0x16cc8f)[_0x91be('0x24')](_0x3230a2);}return null;};}function patchUpdates(_0x5a2d07){return function(_0x1fc15a){try{jsonpatch['apply'](_0x1fc15a,_0x5a2d07,!![]);}catch(_0x509d09){return BPromise['reject'](_0x509d09);}return _0x1fc15a[_0x91be('0x25')]();};}function saveUpdates(_0x7dbfd0,_0x1cca98){return function(_0x2b8e7b){if(_0x2b8e7b){return _0x2b8e7b[_0x91be('0x26')](_0x7dbfd0)[_0x91be('0x27')](function(_0x11c2c0){return _0x11c2c0;});}return null;};}function removeEntity(_0x49b4a1,_0x546bd5){return function(_0x531b8d){if(_0x531b8d){return _0x531b8d[_0x91be('0x28')]()[_0x91be('0x27')](function(){var _0x497c29=_0x531b8d['get']({'plain':!![]});var _0x251774='MailQueues';return db[_0x91be('0x29')][_0x91be('0x28')]({'where':{'type':_0x251774,'resourceId':_0x497c29['id']}})[_0x91be('0x27')](function(){return _0x531b8d;});})[_0x91be('0x27')](function(){_0x49b4a1[_0x91be('0x1d')](0xcc)[_0x91be('0x1e')]();});}};}function handleEntityNotFound(_0x44f091,_0x2a3b12){return function(_0x497a46){if(!_0x497a46){_0x44f091['sendStatus'](0x194);}return _0x497a46;};}function handleError(_0x2b806f,_0x5cd768){_0x5cd768=_0x5cd768||0x1f4;return function(_0x4ad7b1){logger[_0x91be('0x2a')](_0x4ad7b1[_0x91be('0x2b')]);if(_0x4ad7b1[_0x91be('0x2c')]){delete _0x4ad7b1[_0x91be('0x2c')];}_0x2b806f[_0x91be('0x1d')](_0x5cd768)[_0x91be('0x2d')](_0x4ad7b1);};}exports[_0x91be('0x2e')]=function(_0x235ae8,_0x3b1677){var _0x57b6f9={},_0x2ffe05={},_0x21ef6f={'count':0x0,'rows':[]};var _0x76ce4d=_[_0x91be('0x2f')](db['MailQueue'][_0x91be('0x30')],function(_0x45f2bc){return{'name':_0x45f2bc[_0x91be('0x31')],'type':_0x45f2bc[_0x91be('0x32')][_0x91be('0x33')]};});_0x2ffe05[_0x91be('0x34')]=_[_0x91be('0x2f')](_0x76ce4d,_0x91be('0x2c'));_0x2ffe05['query']=_[_0x91be('0x35')](_0x235ae8['query']);_0x2ffe05['filters']=_[_0x91be('0x36')](_0x2ffe05['model'],_0x2ffe05[_0x91be('0x37')]);_0x57b6f9[_0x91be('0x38')]=_[_0x91be('0x36')](_0x2ffe05['model'],qs[_0x91be('0x39')](_0x235ae8['query'][_0x91be('0x39')]));_0x57b6f9[_0x91be('0x38')]=_0x57b6f9['attributes']['length']?_0x57b6f9[_0x91be('0x38')]:_0x2ffe05[_0x91be('0x34')];if(!_0x235ae8[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x57b6f9[_0x91be('0x21')]=qs['limit'](_0x235ae8[_0x91be('0x37')][_0x91be('0x21')]);_0x57b6f9[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x235ae8['query'][_0x91be('0x1f')]);}_0x57b6f9['order']=qs[_0x91be('0x3c')](_0x235ae8[_0x91be('0x37')][_0x91be('0x3c')]);_0x57b6f9['where']=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x235ae8[_0x91be('0x37')],_0x2ffe05[_0x91be('0x3d')]),_0x76ce4d);if(_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]){_0x57b6f9['where']=_[_0x91be('0x40')](_0x57b6f9[_0x91be('0x41')],{'$or':_['map'](_0x76ce4d,function(_0x4af435){if(_0x4af435['type']!==_0x91be('0x42')){var _0x28f825={};_0x28f825[_0x4af435[_0x91be('0x2c')]]={'$like':'%'+_0x235ae8[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x28f825;}})});}_0x57b6f9=_['merge']({},_0x57b6f9,_0x235ae8[_0x91be('0x43')]);var _0x217899={'where':_0x57b6f9[_0x91be('0x41')]};return db[_0x91be('0x44')][_0x91be('0x22')](_0x217899)[_0x91be('0x27')](function(_0x4b8bca){_0x21ef6f[_0x91be('0x22')]=_0x4b8bca;if(_0x235ae8[_0x91be('0x37')][_0x91be('0x45')]){_0x57b6f9['include']=[{'all':!![]}];}return db[_0x91be('0x44')]['findAll'](_0x57b6f9);})[_0x91be('0x27')](function(_0x3d6033){_0x21ef6f['rows']=_0x3d6033;return _0x21ef6f;})[_0x91be('0x27')](respondWithFilteredResult(_0x3b1677,_0x57b6f9))[_0x91be('0x46')](handleError(_0x3b1677,null));};exports[_0x91be('0x47')]=function(_0x2b8f6f,_0x117245){var _0x2cb05b={'raw':!![],'where':{'id':_0x2b8f6f[_0x91be('0x48')]['id']}},_0xb59730={};_0xb59730[_0x91be('0x34')]=_['keys'](db[_0x91be('0x44')][_0x91be('0x30')]);_0xb59730['query']=_[_0x91be('0x35')](_0x2b8f6f[_0x91be('0x37')]);_0xb59730[_0x91be('0x3d')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],_0xb59730[_0x91be('0x37')]);_0x2cb05b[_0x91be('0x38')]=_[_0x91be('0x36')](_0xb59730[_0x91be('0x34')],qs[_0x91be('0x39')](_0x2b8f6f[_0x91be('0x37')][_0x91be('0x39')]));_0x2cb05b['attributes']=_0x2cb05b[_0x91be('0x38')][_0x91be('0x49')]?_0x2cb05b[_0x91be('0x38')]:_0xb59730[_0x91be('0x34')];if(_0x2b8f6f['query']['includeAll']){_0x2cb05b[_0x91be('0x4a')]=[{'all':!![]}];}_0x2cb05b=_[_0x91be('0x40')]({},_0x2cb05b,_0x2b8f6f['options']);return db[_0x91be('0x44')]['find'](_0x2cb05b)[_0x91be('0x27')](handleEntityNotFound(_0x117245,null))[_0x91be('0x27')](respondWithResult(_0x117245,null))[_0x91be('0x46')](handleError(_0x117245,null));};exports['create']=function(_0x5b0294,_0x4449d8){return db['MailQueue'][_0x91be('0x4b')](_0x5b0294['body'],{})[_0x91be('0x27')](function(_0x1a3517){var _0x156db0=_0x5b0294['user']['get']({'plain':!![]});if(!_0x156db0)throw new Error(_0x91be('0x4c'));if(_0x156db0['role']===_0x91be('0x4d')){var _0x44ac7f=_0x1a3517[_0x91be('0x4e')]({'plain':!![]});var _0x976646=_0x91be('0x4f');return db['UserProfileSection'][_0x91be('0x50')]({'where':{'name':_0x976646,'userProfileId':_0x156db0['userProfileId']},'raw':!![]})[_0x91be('0x27')](function(_0x298f94){if(_0x298f94&&_0x298f94['autoAssociation']===0x0){return db[_0x91be('0x29')]['create']({'name':_0x44ac7f[_0x91be('0x2c')],'resourceId':_0x44ac7f['id'],'type':_0x298f94[_0x91be('0x2c')],'sectionId':_0x298f94['id']},{})['then'](function(){return _0x1a3517;});}else{return _0x1a3517;}})['catch'](function(_0x14317b){logger[_0x91be('0x2a')](_0x91be('0x51'),_0x14317b);throw _0x14317b;});}return _0x1a3517;})['then'](respondWithResult(_0x4449d8,0xc9))['catch'](handleError(_0x4449d8,null));};exports[_0x91be('0x26')]=function(_0x2b37c7,_0x357729){if(_0x2b37c7[_0x91be('0x52')]['id']){delete _0x2b37c7[_0x91be('0x52')]['id'];}return db['MailQueue'][_0x91be('0x50')]({'where':{'id':_0x2b37c7[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x357729,null))[_0x91be('0x27')](saveUpdates(_0x2b37c7[_0x91be('0x52')],null))[_0x91be('0x27')](respondWithResult(_0x357729,null))['catch'](handleError(_0x357729,null));};exports[_0x91be('0x28')]=function(_0x53b92c,_0x22dc91){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x53b92c[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x22dc91,null))[_0x91be('0x27')](removeEntity(_0x22dc91,null))[_0x91be('0x46')](handleError(_0x22dc91,null));};exports['describe']=function(_0x46861c,_0x5ae784){return db[_0x91be('0x44')][_0x91be('0x53')]()['then'](respondWithResult(_0x5ae784,null))[_0x91be('0x46')](handleError(_0x5ae784,null));};exports['getMembers']=function(_0xe3de72,_0x590598,_0x11ab34){var _0x1f0bec={'raw':!![],'where':{}},_0xff3328={},_0x14ced5;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0xe3de72[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x590598,null))['then'](function(_0x3af7db){if(_0x3af7db){_0x14ced5=_0x3af7db[_0x91be('0x4e')]({'plain':!![]});_0xff3328[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x55')][_0x91be('0x30')]);_0xff3328[_0x91be('0x37')]=_[_0x91be('0x35')](_0xe3de72[_0x91be('0x37')]);_0xff3328['filters']=_[_0x91be('0x36')](_0xff3328[_0x91be('0x34')],_0xff3328['query']);_0x1f0bec[_0x91be('0x38')]=_['intersection'](_0xff3328[_0x91be('0x34')],qs['fields'](_0xe3de72[_0x91be('0x37')][_0x91be('0x39')]));_0x1f0bec[_0x91be('0x38')]=_0x1f0bec[_0x91be('0x38')][_0x91be('0x49')]?_0x1f0bec[_0x91be('0x38')]:_0xff3328[_0x91be('0x34')];if(!_0xe3de72['query']['hasOwnProperty'](_0x91be('0x3b'))){_0x1f0bec[_0x91be('0x21')]=qs[_0x91be('0x21')](_0xe3de72[_0x91be('0x37')]['limit']);_0x1f0bec['offset']=qs['offset'](_0xe3de72[_0x91be('0x37')][_0x91be('0x1f')]);}_0x1f0bec[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0xe3de72[_0x91be('0x37')]['sort']);_0x1f0bec[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0xe3de72[_0x91be('0x37')],_0xff3328[_0x91be('0x3d')]));_0x1f0bec[_0x91be('0x41')][_0x91be('0x57')]=_0x3af7db['id'];if(_0xe3de72['query'][_0x91be('0x3f')]){_0x1f0bec[_0x91be('0x41')]=_[_0x91be('0x40')](_0x1f0bec[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x1f0bec[_0x91be('0x38')],function(_0x317d8f){var _0x16a9dd={};_0x16a9dd[_0x317d8f]={'$like':'%'+_0xe3de72[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x16a9dd;})});}_0x1f0bec=_[_0x91be('0x40')]({},_0x1f0bec,_0xe3de72['options']);return db['UserMailQueue'][_0x91be('0x58')](_0x1f0bec);}})['then'](function(_0x2f549d){if(_0x2f549d){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x2f549d,_0x91be('0x59')),'role':'agent'},'attributes':['id','name',_0x91be('0x5a'),_0x91be('0x5b'),'createdAt']});}})[_0x91be('0x27')](function(_0x5f5de7){if(_0x5f5de7){return{'count':_0x5f5de7[_0x91be('0x22')],'rows':_['map'](_0x5f5de7['rows'],function(_0x3dbdc7){return{'membername':_0x3dbdc7[_0x91be('0x2c')],'UserId':_0x3dbdc7['id'],'queue_name':_0x14ced5[_0x91be('0x2c')],'MailQueueId':_0x14ced5['id'],'interface':util['format'](_0x91be('0x5c'),_0x91be('0x5d'),_0x3dbdc7[_0x91be('0x2c')]),'penalty':0x0,'paused':_0x3dbdc7['mailPause'],'createdAt':_0x3dbdc7['createdAt'],'updatedAt':_0x3dbdc7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x590598,_0x1f0bec))['catch'](handleError(_0x590598,null));};exports['getTeams']=function(_0x5300de,_0x4f9feb,_0x1ddf26){var _0x568f22={};var _0x5865ea={};var _0x5c95d5;var _0xf485df;return db[_0x91be('0x44')][_0x91be('0x54')]({'where':{'id':_0x5300de['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x4f9feb,null))[_0x91be('0x27')](function(_0x74bf7c){if(_0x74bf7c){_0x5c95d5=_0x74bf7c;_0x5865ea[_0x91be('0x34')]=_[_0x91be('0x35')](db[_0x91be('0x5e')][_0x91be('0x30')]);_0x5865ea[_0x91be('0x37')]=_[_0x91be('0x35')](_0x5300de[_0x91be('0x37')]);_0x5865ea['filters']=_[_0x91be('0x36')](_0x5865ea[_0x91be('0x34')],_0x5865ea['query']);_0x568f22[_0x91be('0x38')]=_['intersection'](_0x5865ea['model'],qs[_0x91be('0x39')](_0x5300de[_0x91be('0x37')][_0x91be('0x39')]));_0x568f22[_0x91be('0x38')]=_0x568f22[_0x91be('0x38')]['length']?_0x568f22[_0x91be('0x38')]:_0x5865ea[_0x91be('0x34')];_0x568f22[_0x91be('0x56')]=qs[_0x91be('0x3c')](_0x5300de[_0x91be('0x37')]['sort']);_0x568f22[_0x91be('0x41')]=qs[_0x91be('0x3d')](_[_0x91be('0x3e')](_0x5300de['query'],_0x5865ea['filters']));if(_0x5300de[_0x91be('0x37')][_0x91be('0x3f')]){_0x568f22[_0x91be('0x41')]=_[_0x91be('0x40')](_0x568f22[_0x91be('0x41')],{'$or':_['map'](_0x568f22[_0x91be('0x38')],function(_0x3357ef){var _0x593fdc={};_0x593fdc[_0x3357ef]={'$like':'%'+_0x5300de[_0x91be('0x37')]['filter']+'%'};return _0x593fdc;})});}_0x568f22=_[_0x91be('0x40')]({},_0x568f22,_0x5300de[_0x91be('0x43')]);return _0x5c95d5['getTeams'](_0x568f22);}})[_0x91be('0x27')](function(_0x56f7b7){if(_0x56f7b7){_0xf485df=_0x56f7b7['length'];if(!_0x5300de['query'][_0x91be('0x3a')](_0x91be('0x3b'))){_0x568f22[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x5300de[_0x91be('0x37')]['limit']);_0x568f22['offset']=qs[_0x91be('0x1f')](_0x5300de[_0x91be('0x37')][_0x91be('0x1f')]);}return _0x5c95d5[_0x91be('0x5f')](_0x568f22);}})[_0x91be('0x27')](function(_0x2422d0){if(_0x2422d0){return _0x2422d0?{'count':_0xf485df,'rows':_0x2422d0}:null;}})[_0x91be('0x27')](respondWithResult(_0x4f9feb,null))[_0x91be('0x46')](handleError(_0x4f9feb,null));};exports['addTeams']=function(_0x90ba66,_0x556e33,_0x4fe9f0){var _0x3518fd=_0x90ba66[_0x91be('0x52')][_0x91be('0x60')];return db[_0x91be('0x5e')][_0x91be('0x58')]({'where':{'id':_0x3518fd},'attributes':['id'],'include':[{'model':db[_0x91be('0x61')],'as':_0x91be('0x62'),'attributes':['id',_0x91be('0x2c'),'online','voicePause',_0x91be('0x63')],'raw':!![]}]})[_0x91be('0x27')](function(_0x464613){if(_0x464613){var _0x5afda5=_['flatMap'](_0x464613,function(_0x4434d9){var _0x3d90df=_0x4434d9[_0x91be('0x4e')]({'plain':!![]});return _0x3d90df[_0x91be('0x62')];});return db[_0x91be('0x44')]['find']({'where':{'id':_0x90ba66[_0x91be('0x48')]['id']}})[_0x91be('0x27')](function(_0x32b543){return db[_0x91be('0x64')]['transaction'](function(_0x45a464){return _0x32b543[_0x91be('0x65')](_0x3518fd,{'transaction':_0x45a464})['then'](function(){return BPromise[_0x91be('0x66')](_0x5afda5,function(_0x14b8b3){return db[_0x91be('0x55')][_0x91be('0x67')]({'where':{'UserId':_0x14b8b3['id'],'MailQueueId':_0x90ba66[_0x91be('0x48')]['id']},'transaction':_0x45a464});});})[_0x91be('0x27')](function(){_0x5afda5[_0x91be('0x68')](function(_0xf3743c){socket[_0x91be('0x69')](_0x91be('0x6a'),{'UserId':_0xf3743c['id'],'MailQueueId':_0x32b543['id']});});});});});}})[_0x91be('0x27')](respondWithStatusCode(_0x556e33,null))[_0x91be('0x46')](handleError(_0x556e33,null));};exports['removeTeams']=function(_0x75b30c,_0x4be595,_0x1fdde9){return db[_0x91be('0x5e')]['findAll']({'where':{'id':_0x75b30c[_0x91be('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4be595,null))[_0x91be('0x27')](function(_0x5b6c19){var _0x3b3e5b=_[_0x91be('0x2f')](_0x5b6c19,'id');var _0x50cc1e=[];var _0x17f601=[];var _0x2127cb=squel['select']();_0x2127cb[_0x91be('0x6b')](_0x91be('0x6c'))[_0x91be('0x6d')](_0x91be('0x6e'),'tq')[_0x91be('0x6f')](_0x91be('0x70'),'ut',_0x91be('0x71'))[_0x91be('0x41')](_0x91be('0x72'),_0x75b30c['params']['id']);for(var _0x254ca4=0x0;_0x254ca4<_0x5b6c19['length'];_0x254ca4+=0x1){let _0x41c9cf=_0x5b6c19[_0x254ca4];for(var _0x7e39c8=0x0;_0x7e39c8<_0x41c9cf[_0x91be('0x62')][_0x91be('0x49')];_0x7e39c8+=0x1){let _0x2d5f3a=_0x41c9cf[_0x91be('0x62')][_0x7e39c8];var _0x2239c1=_0x2127cb[_0x91be('0x73')]();_0x2239c1[_0x91be('0x41')](_0x91be('0x74'),_0x2d5f3a['id']);_0x17f601['push'](db[_0x91be('0x64')][_0x91be('0x37')](_0x2239c1[_0x91be('0x75')](),{'type':db[_0x91be('0x64')]['QueryTypes'][_0x91be('0x76')]})['then'](function(_0x19df8a){if(_0x19df8a['length']===0x1){return _0x2d5f3a['id'];}else{var _0x2f193a=_[_0x91be('0x77')](_[_0x91be('0x2f')](_0x19df8a,_0x91be('0x78')),function(_0x45eb6c){return _[_0x91be('0x79')](_0x3b3e5b,_0x45eb6c);});if(_0x2f193a){return _0x2d5f3a['id'];}}}));}}return BPromise[_0x91be('0x7a')](_0x17f601)['then'](function(_0x4a346f){_0x50cc1e=_(_0x50cc1e)[_0x91be('0x7b')](_0x4a346f)['compact']()[_0x91be('0x7c')]();return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x75b30c[_0x91be('0x48')]['id']}})['then'](function(_0x319b01){return db['sequelize']['transaction'](function(_0x58ca8a){return _0x319b01['removeTeams'](_0x75b30c[_0x91be('0x37')][_0x91be('0x60')],{'transaction':_0x58ca8a})[_0x91be('0x27')](function(){if(!_[_0x91be('0x7d')](_0x50cc1e)){return _0x319b01[_0x91be('0x7e')](_0x50cc1e,{'transaction':_0x58ca8a});}})[_0x91be('0x27')](function(){_0x50cc1e[_0x91be('0x68')](function(_0xa3bbfa){socket['emit'](_0x91be('0x7f'),{'UserId':_0xa3bbfa,'MailQueueId':_0x319b01['id']});});});});});});})[_0x91be('0x27')](respondWithStatusCode(_0x4be595,null))['catch'](handleError(_0x4be595,null));};exports[_0x91be('0x80')]=function(_0x49d6b4,_0x97d8f6,_0x259970){return db['MailQueue']['find']({'where':{'id':_0x49d6b4[_0x91be('0x48')]['id']}})['then'](handleEntityNotFound(_0x97d8f6,null))['then'](function(_0x1def2b){if(_0x1def2b){return _0x1def2b[_0x91be('0x80')](_0x49d6b4['body'][_0x91be('0x60')],_[_0x91be('0x81')](_0x49d6b4[_0x91be('0x52')],['ids','id'])||{})[_0x91be('0x82')](function(_0x41e907){for(var _0x40834f=0x0;_0x40834f<_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x91be('0x49')];_0x40834f+=0x1){socket['emit'](_0x91be('0x6a'),{'UserId':Number(_0x49d6b4[_0x91be('0x52')][_0x91be('0x60')][_0x40834f]),'MailQueueId':Number(_0x49d6b4[_0x91be('0x48')]['id'])});}return _0x41e907;});}})[_0x91be('0x27')](respondWithResult(_0x97d8f6,null))[_0x91be('0x46')](handleError(_0x97d8f6,null));};exports[_0x91be('0x7e')]=function(_0x4072be,_0xbac4fb,_0x260a2d){return db[_0x91be('0x44')][_0x91be('0x50')]({'where':{'id':_0x4072be[_0x91be('0x48')]['id']}})[_0x91be('0x27')](handleEntityNotFound(_0xbac4fb,null))[_0x91be('0x27')](function(_0x44dfc3){if(_0x44dfc3){return _0x44dfc3['removeAgents'](_0x4072be['query']['ids'])[_0x91be('0x27')](function(){if(_[_0x91be('0x83')](_0x4072be[_0x91be('0x37')][_0x91be('0x60')])){for(var _0x4a4f79=0x0;_0x4a4f79<_0x4072be[_0x91be('0x37')][_0x91be('0x60')][_0x91be('0x49')];_0x4a4f79+=0x1){socket['emit'](_0x91be('0x7f'),{'UserId':Number(_0x4072be['query']['ids'][_0x4a4f79]),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}}else{socket[_0x91be('0x69')]('userMailQueue:remove',{'UserId':Number(_0x4072be['query']['ids']),'MailQueueId':Number(_0x4072be[_0x91be('0x48')]['id'])});}});}})[_0x91be('0x27')](respondWithStatusCode(_0xbac4fb,null))[_0x91be('0x46')](handleError(_0xbac4fb,null));};exports['getAgents']=function(_0x496834,_0x3daafd,_0x4f05ea){var _0x339123={};var _0x519172={};var _0x3f22b4;var _0x3215ff;return db[_0x91be('0x44')]['findOne']({'where':{'id':_0x496834['params']['id']}})[_0x91be('0x27')](handleEntityNotFound(_0x3daafd,null))[_0x91be('0x27')](function(_0x1162d2){if(_0x1162d2){_0x3f22b4=_0x1162d2;_0x519172[_0x91be('0x34')]=_['keys'](db[_0x91be('0x61')][_0x91be('0x30')]);_0x519172[_0x91be('0x37')]=_[_0x91be('0x35')](_0x496834['query']);_0x519172['filters']=_['intersection'](_0x519172[_0x91be('0x34')],_0x519172[_0x91be('0x37')]);_0x339123[_0x91be('0x38')]=_[_0x91be('0x36')](_0x519172[_0x91be('0x34')],qs['fields'](_0x496834[_0x91be('0x37')]['fields']));_0x339123[_0x91be('0x38')]=_0x339123[_0x91be('0x38')][_0x91be('0x49')]?_0x339123[_0x91be('0x38')]:_0x519172[_0x91be('0x34')];_0x339123['order']=qs[_0x91be('0x3c')](_0x496834[_0x91be('0x37')][_0x91be('0x3c')]);_0x339123[_0x91be('0x41')]=qs['filters'](_[_0x91be('0x3e')](_0x496834[_0x91be('0x37')],_0x519172[_0x91be('0x3d')]));if(_0x496834[_0x91be('0x37')]['filter']){_0x339123[_0x91be('0x41')]=_[_0x91be('0x40')](_0x339123[_0x91be('0x41')],{'$or':_[_0x91be('0x2f')](_0x339123[_0x91be('0x38')],function(_0x1ac563){var _0x2ff8a0={};_0x2ff8a0[_0x1ac563]={'$like':'%'+_0x496834[_0x91be('0x37')][_0x91be('0x3f')]+'%'};return _0x2ff8a0;})});}_0x339123=_[_0x91be('0x40')]({},_0x339123,_0x496834['options']);return _0x3f22b4[_0x91be('0x84')](_0x339123);}})[_0x91be('0x27')](function(_0x5cbc20){if(_0x5cbc20){_0x3215ff=_0x5cbc20['length'];if(!_0x496834[_0x91be('0x37')][_0x91be('0x3a')](_0x91be('0x3b'))){_0x339123[_0x91be('0x21')]=qs[_0x91be('0x21')](_0x496834[_0x91be('0x37')][_0x91be('0x21')]);_0x339123[_0x91be('0x1f')]=qs[_0x91be('0x1f')](_0x496834[_0x91be('0x37')]['offset']);}return _0x3f22b4['getAgents'](_0x339123);}})[_0x91be('0x27')](function(_0x4a9826){if(_0x4a9826){return _0x4a9826?{'count':_0x3215ff,'rows':_0x4a9826}:null;}})[_0x91be('0x27')](respondWithResult(_0x3daafd,null))[_0x91be('0x46')](handleError(_0x3daafd,null));}; \ No newline at end of file +var _0xb9a0=['end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','nolimit','order','where','pick','filter','merge','options','MailQueue','includeAll','rows','catch','show','keys','intersection','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','sort','MailQueueId','findAll','User','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','forEach','emit','userMailQueue:save','removeTeams','Team','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status'];(function(_0x53753e,_0x5c46b2){var _0x1c0c62=function(_0x149915){while(--_0x149915){_0x53753e['push'](_0x53753e['shift']());}};_0x1c0c62(++_0x5c46b2);}(_0xb9a0,0x186));var _0x0b9a=function(_0x396ead,_0x2b4d16){_0x396ead=_0x396ead-0x0;var _0x4a55a1=_0xb9a0[_0x396ead];return _0x4a55a1;};'use strict';var emlformat=require(_0x0b9a('0x0'));var rimraf=require(_0x0b9a('0x1'));var zipdir=require(_0x0b9a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b9a('0x3'));var moment=require(_0x0b9a('0x4'));var BPromise=require(_0x0b9a('0x5'));var Mustache=require(_0x0b9a('0x6'));var util=require(_0x0b9a('0x7'));var path=require(_0x0b9a('0x8'));var sox=require(_0x0b9a('0x9'));var csv=require('to-csv');var ejs=require(_0x0b9a('0xa'));var fs=require('fs');var fs_extra=require(_0x0b9a('0xb'));var _=require(_0x0b9a('0xc'));var squel=require(_0x0b9a('0xd'));var crypto=require(_0x0b9a('0xe'));var jsforce=require(_0x0b9a('0xf'));var deskjs=require(_0x0b9a('0x10'));var toCsv=require(_0x0b9a('0x11'));var querystring=require(_0x0b9a('0x12'));var Papa=require(_0x0b9a('0x13'));var Redis=require(_0x0b9a('0x14'));var authService=require(_0x0b9a('0x15'));var qs=require(_0x0b9a('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0b9a('0x17'));var logger=require('../../config/logger')(_0x0b9a('0x18'));var utils=require('../../config/utils');var config=require(_0x0b9a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0b9a('0x1a')]=_[_0x0b9a('0x1b')](config[_0x0b9a('0x1a')],{'host':_0x0b9a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b9a('0x1a')]));require(_0x0b9a('0x1d'))[_0x0b9a('0x1e')](socket);function respondWithStatusCode(_0x31adef,_0x1de36d){_0x1de36d=_0x1de36d||0xcc;return function(_0xcdef1c){if(_0xcdef1c){return _0x31adef[_0x0b9a('0x1f')](_0x1de36d);}return _0x31adef[_0x0b9a('0x20')](_0x1de36d)[_0x0b9a('0x21')]();};}function respondWithResult(_0x17dda7,_0x1b8380){_0x1b8380=_0x1b8380||0xc8;return function(_0x4fef3f){if(_0x4fef3f){return _0x17dda7[_0x0b9a('0x20')](_0x1b8380)[_0x0b9a('0x22')](_0x4fef3f);}};}function respondWithFilteredResult(_0xcaa5d0,_0x5f102b){return function(_0x3fb823){if(_0x3fb823){var _0x5f0fd9=typeof _0x5f102b['offset']===_0x0b9a('0x23')&&typeof _0x5f102b[_0x0b9a('0x24')]===_0x0b9a('0x23');var _0x3a2268=_0x3fb823[_0x0b9a('0x25')];var _0x180bdb=_0x5f0fd9?0x0:_0x5f102b[_0x0b9a('0x26')];var _0x1a2cd5=_0x5f0fd9?_0x3fb823['count']:_0x5f102b['offset']+_0x5f102b[_0x0b9a('0x24')];var _0x53b526;if(_0x1a2cd5>=_0x3a2268){_0x1a2cd5=_0x3a2268;_0x53b526=0xc8;}else{_0x53b526=0xce;}_0xcaa5d0[_0x0b9a('0x20')](_0x53b526);return _0xcaa5d0[_0x0b9a('0x27')](_0x0b9a('0x28'),_0x180bdb+'-'+_0x1a2cd5+'/'+_0x3a2268)[_0x0b9a('0x22')](_0x3fb823);}return null;};}function patchUpdates(_0x362b65){return function(_0xdb6a0b){try{jsonpatch[_0x0b9a('0x29')](_0xdb6a0b,_0x362b65,!![]);}catch(_0x1ae8d5){return BPromise['reject'](_0x1ae8d5);}return _0xdb6a0b[_0x0b9a('0x2a')]();};}function saveUpdates(_0xa5dd9e,_0x2b37dd){return function(_0x1f29ac){if(_0x1f29ac){return _0x1f29ac[_0x0b9a('0x2b')](_0xa5dd9e)[_0x0b9a('0x2c')](function(_0x535e40){return _0x535e40;});}return null;};}function removeEntity(_0x13eb99,_0x538287){return function(_0x4964b9){if(_0x4964b9){return _0x4964b9[_0x0b9a('0x2d')]()['then'](function(){var _0x2cca68=_0x4964b9[_0x0b9a('0x2e')]({'plain':!![]});var _0xcfe793='MailQueues';return db[_0x0b9a('0x2f')][_0x0b9a('0x2d')]({'where':{'type':_0xcfe793,'resourceId':_0x2cca68['id']}})[_0x0b9a('0x2c')](function(){return _0x4964b9;});})[_0x0b9a('0x2c')](function(){_0x13eb99[_0x0b9a('0x20')](0xcc)[_0x0b9a('0x21')]();});}};}function handleEntityNotFound(_0x4bd629,_0x3bfe08){return function(_0x21ebae){if(!_0x21ebae){_0x4bd629[_0x0b9a('0x1f')](0x194);}return _0x21ebae;};}function handleError(_0x3eaa74,_0x2effcf){_0x2effcf=_0x2effcf||0x1f4;return function(_0x890d1d){logger['error'](_0x890d1d[_0x0b9a('0x30')]);if(_0x890d1d[_0x0b9a('0x31')]){delete _0x890d1d[_0x0b9a('0x31')];}_0x3eaa74['status'](_0x2effcf)['send'](_0x890d1d);};}exports[_0x0b9a('0x32')]=function(_0x494052,_0x316f96){var _0x4ca09c={},_0xf1e1ff={},_0x5cf4e3={'count':0x0,'rows':[]};var _0xe39e5c=_['map'](db['MailQueue'][_0x0b9a('0x33')],function(_0x330fd6){return{'name':_0x330fd6[_0x0b9a('0x34')],'type':_0x330fd6[_0x0b9a('0x35')][_0x0b9a('0x36')]};});_0xf1e1ff[_0x0b9a('0x37')]=_[_0x0b9a('0x38')](_0xe39e5c,'name');_0xf1e1ff[_0x0b9a('0x39')]=_['keys'](_0x494052['query']);_0xf1e1ff[_0x0b9a('0x3a')]=_['intersection'](_0xf1e1ff[_0x0b9a('0x37')],_0xf1e1ff[_0x0b9a('0x39')]);_0x4ca09c[_0x0b9a('0x3b')]=_['intersection'](_0xf1e1ff[_0x0b9a('0x37')],qs['fields'](_0x494052['query']['fields']));_0x4ca09c[_0x0b9a('0x3b')]=_0x4ca09c[_0x0b9a('0x3b')]['length']?_0x4ca09c[_0x0b9a('0x3b')]:_0xf1e1ff[_0x0b9a('0x37')];if(!_0x494052['query']['hasOwnProperty'](_0x0b9a('0x3c'))){_0x4ca09c[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x494052['query'][_0x0b9a('0x24')]);_0x4ca09c[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x494052[_0x0b9a('0x39')][_0x0b9a('0x26')]);}_0x4ca09c[_0x0b9a('0x3d')]=qs['sort'](_0x494052[_0x0b9a('0x39')]['sort']);_0x4ca09c[_0x0b9a('0x3e')]=qs['filters'](_[_0x0b9a('0x3f')](_0x494052['query'],_0xf1e1ff[_0x0b9a('0x3a')]),_0xe39e5c);if(_0x494052[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x4ca09c['where']=_[_0x0b9a('0x41')](_0x4ca09c[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0xe39e5c,function(_0xd4c6c){if(_0xd4c6c['type']!=='VIRTUAL'){var _0x365ac4={};_0x365ac4[_0xd4c6c['name']]={'$like':'%'+_0x494052[_0x0b9a('0x39')]['filter']+'%'};return _0x365ac4;}})});}_0x4ca09c=_[_0x0b9a('0x41')]({},_0x4ca09c,_0x494052[_0x0b9a('0x42')]);var _0x174e0d={'where':_0x4ca09c[_0x0b9a('0x3e')]};return db[_0x0b9a('0x43')][_0x0b9a('0x25')](_0x174e0d)[_0x0b9a('0x2c')](function(_0x420702){_0x5cf4e3['count']=_0x420702;if(_0x494052['query'][_0x0b9a('0x44')]){_0x4ca09c['include']=[{'all':!![]}];}return db[_0x0b9a('0x43')]['findAll'](_0x4ca09c);})[_0x0b9a('0x2c')](function(_0x47da96){_0x5cf4e3[_0x0b9a('0x45')]=_0x47da96;return _0x5cf4e3;})['then'](respondWithFilteredResult(_0x316f96,_0x4ca09c))[_0x0b9a('0x46')](handleError(_0x316f96,null));};exports[_0x0b9a('0x47')]=function(_0x5ac4c7,_0x3b3b2d){var _0x2a5295={'raw':!![],'where':{'id':_0x5ac4c7['params']['id']}},_0x3e6e97={};_0x3e6e97[_0x0b9a('0x37')]=_[_0x0b9a('0x48')](db[_0x0b9a('0x43')][_0x0b9a('0x33')]);_0x3e6e97[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x5ac4c7[_0x0b9a('0x39')]);_0x3e6e97[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x3e6e97[_0x0b9a('0x37')],_0x3e6e97['query']);_0x2a5295['attributes']=_[_0x0b9a('0x49')](_0x3e6e97[_0x0b9a('0x37')],qs['fields'](_0x5ac4c7['query'][_0x0b9a('0x4a')]));_0x2a5295[_0x0b9a('0x3b')]=_0x2a5295[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x2a5295['attributes']:_0x3e6e97[_0x0b9a('0x37')];if(_0x5ac4c7[_0x0b9a('0x39')][_0x0b9a('0x44')]){_0x2a5295['include']=[{'all':!![]}];}_0x2a5295=_[_0x0b9a('0x41')]({},_0x2a5295,_0x5ac4c7[_0x0b9a('0x42')]);return db['MailQueue'][_0x0b9a('0x4c')](_0x2a5295)[_0x0b9a('0x2c')](handleEntityNotFound(_0x3b3b2d,null))[_0x0b9a('0x2c')](respondWithResult(_0x3b3b2d,null))[_0x0b9a('0x46')](handleError(_0x3b3b2d,null));};exports[_0x0b9a('0x4d')]=function(_0x2cc5cf,_0x271b4b){return db['MailQueue'][_0x0b9a('0x4d')](_0x2cc5cf[_0x0b9a('0x4e')],{})[_0x0b9a('0x2c')](function(_0x2e5760){var _0xa6ecf2=_0x2cc5cf[_0x0b9a('0x4f')][_0x0b9a('0x2e')]({'plain':!![]});if(!_0xa6ecf2)throw new Error(_0x0b9a('0x50'));if(_0xa6ecf2[_0x0b9a('0x51')]===_0x0b9a('0x4f')){var _0x37de41=_0x2e5760[_0x0b9a('0x2e')]({'plain':!![]});var _0x38d6c7='MailQueues';return db['UserProfileSection']['find']({'where':{'name':_0x38d6c7,'userProfileId':_0xa6ecf2[_0x0b9a('0x52')]},'raw':!![]})[_0x0b9a('0x2c')](function(_0x59b7ac){if(_0x59b7ac&&_0x59b7ac[_0x0b9a('0x53')]===0x0){return db[_0x0b9a('0x2f')]['create']({'name':_0x37de41['name'],'resourceId':_0x37de41['id'],'type':_0x59b7ac[_0x0b9a('0x31')],'sectionId':_0x59b7ac['id']},{})[_0x0b9a('0x2c')](function(){return _0x2e5760;});}else{return _0x2e5760;}})[_0x0b9a('0x46')](function(_0xeec42a){logger[_0x0b9a('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xeec42a);throw _0xeec42a;});}return _0x2e5760;})[_0x0b9a('0x2c')](respondWithResult(_0x271b4b,0xc9))[_0x0b9a('0x46')](handleError(_0x271b4b,null));};exports['update']=function(_0x29ee0a,_0x545269){if(_0x29ee0a[_0x0b9a('0x4e')]['id']){delete _0x29ee0a['body']['id'];}return db[_0x0b9a('0x43')]['find']({'where':{'id':_0x29ee0a[_0x0b9a('0x55')]['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x545269,null))[_0x0b9a('0x2c')](saveUpdates(_0x29ee0a[_0x0b9a('0x4e')],null))[_0x0b9a('0x2c')](respondWithResult(_0x545269,null))[_0x0b9a('0x46')](handleError(_0x545269,null));};exports[_0x0b9a('0x2d')]=function(_0x2ad30a,_0x1640a4){return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x2ad30a[_0x0b9a('0x55')]['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x1640a4,null))['then'](removeEntity(_0x1640a4,null))['catch'](handleError(_0x1640a4,null));};exports[_0x0b9a('0x56')]=function(_0xcacdae,_0x260409){return db[_0x0b9a('0x43')][_0x0b9a('0x56')]()[_0x0b9a('0x2c')](respondWithResult(_0x260409,null))[_0x0b9a('0x46')](handleError(_0x260409,null));};exports[_0x0b9a('0x57')]=function(_0x505837,_0x42d9d3,_0x4f0504){var _0x5654a3={'raw':!![],'where':{}},_0x5e2266={},_0x590b29;return db[_0x0b9a('0x43')][_0x0b9a('0x58')]({'where':{'id':_0x505837['params']['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x42d9d3,null))[_0x0b9a('0x2c')](function(_0x2d282c){if(_0x2d282c){_0x590b29=_0x2d282c[_0x0b9a('0x2e')]({'plain':!![]});_0x5e2266[_0x0b9a('0x37')]=_['keys'](db[_0x0b9a('0x59')][_0x0b9a('0x33')]);_0x5e2266[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x505837[_0x0b9a('0x39')]);_0x5e2266[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x5e2266[_0x0b9a('0x37')],_0x5e2266[_0x0b9a('0x39')]);_0x5654a3[_0x0b9a('0x3b')]=_[_0x0b9a('0x49')](_0x5e2266[_0x0b9a('0x37')],qs['fields'](_0x505837['query'][_0x0b9a('0x4a')]));_0x5654a3[_0x0b9a('0x3b')]=_0x5654a3[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x5654a3[_0x0b9a('0x3b')]:_0x5e2266[_0x0b9a('0x37')];if(!_0x505837[_0x0b9a('0x39')][_0x0b9a('0x5a')]('nolimit')){_0x5654a3[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x505837[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x5654a3[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x505837['query'][_0x0b9a('0x26')]);}_0x5654a3['order']=qs['sort'](_0x505837['query'][_0x0b9a('0x5b')]);_0x5654a3['where']=qs['filters'](_[_0x0b9a('0x3f')](_0x505837[_0x0b9a('0x39')],_0x5e2266[_0x0b9a('0x3a')]));_0x5654a3['where'][_0x0b9a('0x5c')]=_0x2d282c['id'];if(_0x505837[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x5654a3[_0x0b9a('0x3e')]=_[_0x0b9a('0x41')](_0x5654a3[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0x5654a3[_0x0b9a('0x3b')],function(_0x505e38){var _0x221cd1={};_0x221cd1[_0x505e38]={'$like':'%'+_0x505837[_0x0b9a('0x39')][_0x0b9a('0x40')]+'%'};return _0x221cd1;})});}_0x5654a3=_[_0x0b9a('0x41')]({},_0x5654a3,_0x505837[_0x0b9a('0x42')]);return db[_0x0b9a('0x59')][_0x0b9a('0x5d')](_0x5654a3);}})[_0x0b9a('0x2c')](function(_0x22500c){if(_0x22500c){return db[_0x0b9a('0x5e')]['findAndCountAll']({'where':{'id':_[_0x0b9a('0x38')](_0x22500c,_0x0b9a('0x5f')),'role':_0x0b9a('0x60')},'attributes':['id',_0x0b9a('0x31'),_0x0b9a('0x61'),'updatedAt',_0x0b9a('0x62')]});}})['then'](function(_0x4f23fd){if(_0x4f23fd){return{'count':_0x4f23fd[_0x0b9a('0x25')],'rows':_[_0x0b9a('0x38')](_0x4f23fd['rows'],function(_0x4265c7){return{'membername':_0x4265c7[_0x0b9a('0x31')],'UserId':_0x4265c7['id'],'queue_name':_0x590b29[_0x0b9a('0x31')],'MailQueueId':_0x590b29['id'],'interface':util[_0x0b9a('0x63')](_0x0b9a('0x64'),_0x0b9a('0x65'),_0x4265c7[_0x0b9a('0x31')]),'penalty':0x0,'paused':_0x4265c7[_0x0b9a('0x61')],'createdAt':_0x4265c7[_0x0b9a('0x62')],'updatedAt':_0x4265c7[_0x0b9a('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x42d9d3,_0x5654a3))['catch'](handleError(_0x42d9d3,null));};exports[_0x0b9a('0x67')]=function(_0x4e8f1a,_0x36f96a,_0x52f9bf){var _0x37c94f={};var _0x122e4a={};var _0xce8c16;var _0x4d7d79;return db['MailQueue'][_0x0b9a('0x58')]({'where':{'id':_0x4e8f1a[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x36f96a,null))[_0x0b9a('0x2c')](function(_0xb5ae6e){if(_0xb5ae6e){_0xce8c16=_0xb5ae6e;_0x122e4a['model']=_[_0x0b9a('0x48')](db['Team'][_0x0b9a('0x33')]);_0x122e4a['query']=_[_0x0b9a('0x48')](_0x4e8f1a[_0x0b9a('0x39')]);_0x122e4a[_0x0b9a('0x3a')]=_[_0x0b9a('0x49')](_0x122e4a[_0x0b9a('0x37')],_0x122e4a[_0x0b9a('0x39')]);_0x37c94f['attributes']=_[_0x0b9a('0x49')](_0x122e4a[_0x0b9a('0x37')],qs[_0x0b9a('0x4a')](_0x4e8f1a['query']['fields']));_0x37c94f[_0x0b9a('0x3b')]=_0x37c94f[_0x0b9a('0x3b')][_0x0b9a('0x4b')]?_0x37c94f['attributes']:_0x122e4a[_0x0b9a('0x37')];_0x37c94f[_0x0b9a('0x3d')]=qs[_0x0b9a('0x5b')](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x5b')]);_0x37c94f[_0x0b9a('0x3e')]=qs[_0x0b9a('0x3a')](_[_0x0b9a('0x3f')](_0x4e8f1a[_0x0b9a('0x39')],_0x122e4a[_0x0b9a('0x3a')]));if(_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x37c94f[_0x0b9a('0x3e')]=_[_0x0b9a('0x41')](_0x37c94f[_0x0b9a('0x3e')],{'$or':_['map'](_0x37c94f[_0x0b9a('0x3b')],function(_0x52a0b2){var _0x2cc2b8={};_0x2cc2b8[_0x52a0b2]={'$like':'%'+_0x4e8f1a[_0x0b9a('0x39')]['filter']+'%'};return _0x2cc2b8;})});}_0x37c94f=_[_0x0b9a('0x41')]({},_0x37c94f,_0x4e8f1a['options']);return _0xce8c16[_0x0b9a('0x67')](_0x37c94f);}})[_0x0b9a('0x2c')](function(_0x340468){if(_0x340468){_0x4d7d79=_0x340468[_0x0b9a('0x4b')];if(!_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x5a')]('nolimit')){_0x37c94f[_0x0b9a('0x24')]=qs['limit'](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x37c94f[_0x0b9a('0x26')]=qs[_0x0b9a('0x26')](_0x4e8f1a[_0x0b9a('0x39')][_0x0b9a('0x26')]);}return _0xce8c16[_0x0b9a('0x67')](_0x37c94f);}})[_0x0b9a('0x2c')](function(_0x4d1936){if(_0x4d1936){return _0x4d1936?{'count':_0x4d7d79,'rows':_0x4d1936}:null;}})[_0x0b9a('0x2c')](respondWithResult(_0x36f96a,null))['catch'](handleError(_0x36f96a,null));};exports['addTeams']=function(_0x261b44,_0x485b02,_0xd71b96){var _0x2c03bc=_0x261b44[_0x0b9a('0x4e')][_0x0b9a('0x68')];return db['Team']['findAll']({'where':{'id':_0x2c03bc},'attributes':['id'],'include':[{'model':db[_0x0b9a('0x5e')],'as':_0x0b9a('0x69'),'attributes':['id',_0x0b9a('0x31'),_0x0b9a('0x6a'),_0x0b9a('0x6b'),'interface'],'raw':!![]}]})[_0x0b9a('0x2c')](function(_0x1c8305){if(_0x1c8305){var _0x4c4a98=_[_0x0b9a('0x6c')](_0x1c8305,function(_0x4b00e6){var _0x23885a=_0x4b00e6[_0x0b9a('0x2e')]({'plain':!![]});return _0x23885a[_0x0b9a('0x69')];});return db['MailQueue']['find']({'where':{'id':_0x261b44[_0x0b9a('0x55')]['id']}})['then'](function(_0x4abf43){return db[_0x0b9a('0x6d')][_0x0b9a('0x6e')](function(_0x41d03f){return _0x4abf43[_0x0b9a('0x6f')](_0x2c03bc,{'transaction':_0x41d03f})['then'](function(){return BPromise['each'](_0x4c4a98,function(_0x2c5096){return db[_0x0b9a('0x59')]['findOrCreate']({'where':{'UserId':_0x2c5096['id'],'MailQueueId':_0x261b44[_0x0b9a('0x55')]['id']},'transaction':_0x41d03f});});})[_0x0b9a('0x2c')](function(){_0x4c4a98[_0x0b9a('0x70')](function(_0x2996a8){socket[_0x0b9a('0x71')](_0x0b9a('0x72'),{'UserId':_0x2996a8['id'],'MailQueueId':_0x4abf43['id']});});});});});}})['then'](respondWithStatusCode(_0x485b02,null))[_0x0b9a('0x46')](handleError(_0x485b02,null));};exports[_0x0b9a('0x73')]=function(_0x109494,_0x52586d,_0x486961){return db[_0x0b9a('0x74')][_0x0b9a('0x5d')]({'where':{'id':_0x109494[_0x0b9a('0x39')][_0x0b9a('0x68')]},'attributes':['id'],'include':[{'model':db[_0x0b9a('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x52586d,null))[_0x0b9a('0x2c')](function(_0x4d1e7a){var _0x1b6609=_['map'](_0x4d1e7a,'id');var _0x30b4c7=[];var _0x1fde61=[];var _0x1a9b66=squel['select']();_0x1a9b66['field'](_0x0b9a('0x75'))[_0x0b9a('0x76')](_0x0b9a('0x77'),'tq')[_0x0b9a('0x78')](_0x0b9a('0x79'),'ut',_0x0b9a('0x7a'))[_0x0b9a('0x3e')](_0x0b9a('0x7b'),_0x109494[_0x0b9a('0x55')]['id']);for(var _0x451aad=0x0;_0x451aad<_0x4d1e7a[_0x0b9a('0x4b')];_0x451aad+=0x1){let _0x23b9d8=_0x4d1e7a[_0x451aad];for(var _0x1be50=0x0;_0x1be50<_0x23b9d8[_0x0b9a('0x69')][_0x0b9a('0x4b')];_0x1be50+=0x1){let _0x72535c=_0x23b9d8[_0x0b9a('0x69')][_0x1be50];var _0xe1ce37=_0x1a9b66['clone']();_0xe1ce37[_0x0b9a('0x3e')]('ut.UserId\x20=\x20?',_0x72535c['id']);_0x1fde61['push'](db[_0x0b9a('0x6d')][_0x0b9a('0x39')](_0xe1ce37[_0x0b9a('0x7c')](),{'type':db[_0x0b9a('0x6d')][_0x0b9a('0x7d')][_0x0b9a('0x7e')]})[_0x0b9a('0x2c')](function(_0x24ff88){if(_0x24ff88[_0x0b9a('0x4b')]===0x1){return _0x72535c['id'];}else{var _0x2cf263=_[_0x0b9a('0x7f')](_[_0x0b9a('0x38')](_0x24ff88,'TeamId'),function(_0x4eeacc){return _[_0x0b9a('0x80')](_0x1b6609,_0x4eeacc);});if(_0x2cf263){return _0x72535c['id'];}}}));}}return BPromise[_0x0b9a('0x81')](_0x1fde61)[_0x0b9a('0x2c')](function(_0x10fc0d){_0x30b4c7=_(_0x30b4c7)[_0x0b9a('0x82')](_0x10fc0d)[_0x0b9a('0x83')]()[_0x0b9a('0x84')]();return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x109494['params']['id']}})[_0x0b9a('0x2c')](function(_0x442d80){return db[_0x0b9a('0x6d')]['transaction'](function(_0x4cb737){return _0x442d80[_0x0b9a('0x73')](_0x109494[_0x0b9a('0x39')]['ids'],{'transaction':_0x4cb737})[_0x0b9a('0x2c')](function(){if(!_[_0x0b9a('0x85')](_0x30b4c7)){return _0x442d80[_0x0b9a('0x86')](_0x30b4c7,{'transaction':_0x4cb737});}})['then'](function(){_0x30b4c7[_0x0b9a('0x70')](function(_0x34e1ad){socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':_0x34e1ad,'MailQueueId':_0x442d80['id']});});});});});});})[_0x0b9a('0x2c')](respondWithStatusCode(_0x52586d,null))[_0x0b9a('0x46')](handleError(_0x52586d,null));};exports[_0x0b9a('0x88')]=function(_0x4c8b9c,_0x4d2b28,_0x1435cc){return db[_0x0b9a('0x43')][_0x0b9a('0x4c')]({'where':{'id':_0x4c8b9c['params']['id']}})[_0x0b9a('0x2c')](handleEntityNotFound(_0x4d2b28,null))[_0x0b9a('0x2c')](function(_0x1a9415){if(_0x1a9415){return _0x1a9415['addAgents'](_0x4c8b9c[_0x0b9a('0x4e')]['ids'],_[_0x0b9a('0x89')](_0x4c8b9c[_0x0b9a('0x4e')],[_0x0b9a('0x68'),'id'])||{})[_0x0b9a('0x8a')](function(_0x5f3ada){for(var _0x306b7a=0x0;_0x306b7a<_0x4c8b9c['body'][_0x0b9a('0x68')][_0x0b9a('0x4b')];_0x306b7a+=0x1){socket[_0x0b9a('0x71')](_0x0b9a('0x72'),{'UserId':Number(_0x4c8b9c[_0x0b9a('0x4e')][_0x0b9a('0x68')][_0x306b7a]),'MailQueueId':Number(_0x4c8b9c[_0x0b9a('0x55')]['id'])});}return _0x5f3ada;});}})[_0x0b9a('0x2c')](respondWithResult(_0x4d2b28,null))[_0x0b9a('0x46')](handleError(_0x4d2b28,null));};exports[_0x0b9a('0x86')]=function(_0xae102a,_0xc2e8f7,_0x42bd97){return db[_0x0b9a('0x43')]['find']({'where':{'id':_0xae102a[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0xc2e8f7,null))['then'](function(_0x2fb66e){if(_0x2fb66e){return _0x2fb66e['removeAgents'](_0xae102a[_0x0b9a('0x39')][_0x0b9a('0x68')])[_0x0b9a('0x2c')](function(){if(_[_0x0b9a('0x8b')](_0xae102a['query'][_0x0b9a('0x68')])){for(var _0x344755=0x0;_0x344755<_0xae102a[_0x0b9a('0x39')][_0x0b9a('0x68')][_0x0b9a('0x4b')];_0x344755+=0x1){socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':Number(_0xae102a[_0x0b9a('0x39')]['ids'][_0x344755]),'MailQueueId':Number(_0xae102a[_0x0b9a('0x55')]['id'])});}}else{socket[_0x0b9a('0x71')](_0x0b9a('0x87'),{'UserId':Number(_0xae102a['query']['ids']),'MailQueueId':Number(_0xae102a[_0x0b9a('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0xc2e8f7,null))[_0x0b9a('0x46')](handleError(_0xc2e8f7,null));};exports[_0x0b9a('0x8c')]=function(_0x3d0d88,_0x459c8c,_0x14e7bc){var _0x2c88ee={};var _0x2ac188={};var _0x3540b0;var _0x2c85ca;return db[_0x0b9a('0x43')]['findOne']({'where':{'id':_0x3d0d88[_0x0b9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x459c8c,null))['then'](function(_0xf36bfa){if(_0xf36bfa){_0x3540b0=_0xf36bfa;_0x2ac188[_0x0b9a('0x37')]=_[_0x0b9a('0x48')](db[_0x0b9a('0x5e')][_0x0b9a('0x33')]);_0x2ac188[_0x0b9a('0x39')]=_[_0x0b9a('0x48')](_0x3d0d88[_0x0b9a('0x39')]);_0x2ac188[_0x0b9a('0x3a')]=_['intersection'](_0x2ac188[_0x0b9a('0x37')],_0x2ac188[_0x0b9a('0x39')]);_0x2c88ee[_0x0b9a('0x3b')]=_['intersection'](_0x2ac188[_0x0b9a('0x37')],qs[_0x0b9a('0x4a')](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x4a')]));_0x2c88ee[_0x0b9a('0x3b')]=_0x2c88ee['attributes'][_0x0b9a('0x4b')]?_0x2c88ee[_0x0b9a('0x3b')]:_0x2ac188[_0x0b9a('0x37')];_0x2c88ee['order']=qs[_0x0b9a('0x5b')](_0x3d0d88[_0x0b9a('0x39')]['sort']);_0x2c88ee[_0x0b9a('0x3e')]=qs[_0x0b9a('0x3a')](_[_0x0b9a('0x3f')](_0x3d0d88[_0x0b9a('0x39')],_0x2ac188[_0x0b9a('0x3a')]));if(_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x40')]){_0x2c88ee['where']=_[_0x0b9a('0x41')](_0x2c88ee[_0x0b9a('0x3e')],{'$or':_[_0x0b9a('0x38')](_0x2c88ee['attributes'],function(_0x272532){var _0x73abf2={};_0x73abf2[_0x272532]={'$like':'%'+_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x40')]+'%'};return _0x73abf2;})});}_0x2c88ee=_[_0x0b9a('0x41')]({},_0x2c88ee,_0x3d0d88[_0x0b9a('0x42')]);return _0x3540b0[_0x0b9a('0x8c')](_0x2c88ee);}})[_0x0b9a('0x2c')](function(_0x308627){if(_0x308627){_0x2c85ca=_0x308627[_0x0b9a('0x4b')];if(!_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x5a')](_0x0b9a('0x3c'))){_0x2c88ee[_0x0b9a('0x24')]=qs[_0x0b9a('0x24')](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x24')]);_0x2c88ee['offset']=qs['offset'](_0x3d0d88[_0x0b9a('0x39')][_0x0b9a('0x26')]);}return _0x3540b0[_0x0b9a('0x8c')](_0x2c88ee);}})[_0x0b9a('0x2c')](function(_0x24a1d6){if(_0x24a1d6){return _0x24a1d6?{'count':_0x2c85ca,'rows':_0x24a1d6}:null;}})[_0x0b9a('0x2c')](respondWithResult(_0x459c8c,null))['catch'](handleError(_0x459c8c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 690b7d4..ad633e9 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 _0x8eca=['../../mysqldb','MailQueue','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4a30fe,_0x123221){var _0x5f01b8=function(_0x39da95){while(--_0x39da95){_0x4a30fe['push'](_0x4a30fe['shift']());}};_0x5f01b8(++_0x123221);}(_0x8eca,0x1af));var _0xa8ec=function(_0x497c47,_0x29ff53){_0x497c47=_0x497c47-0x0;var _0x23baf0=_0x8eca[_0x497c47];return _0x23baf0;};'use strict';var EventEmitter=require(_0xa8ec('0x0'));var MailQueue=require(_0xa8ec('0x1'))['db'][_0xa8ec('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8ec('0x3'),'afterUpdate':_0xa8ec('0x4'),'afterDestroy':_0xa8ec('0x5')};function emitEvent(_0x147052){return function(_0x10e837,_0x361553,_0x573510){MailQueueEvents[_0xa8ec('0x6')](_0x147052+':'+_0x10e837['id'],_0x10e837);MailQueueEvents['emit'](_0x147052,_0x10e837);_0x573510(null);};}for(var e in events){if(events[_0xa8ec('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xa8ec('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xf369=['MailQueue','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xf369,0x193));var _0x9f36=function(_0x1aae33,_0x110a80){_0x1aae33=_0x1aae33-0x0;var _0x2e91e9=_0xf369[_0x1aae33];return _0x2e91e9;};'use strict';var EventEmitter=require(_0x9f36('0x0'));var MailQueue=require(_0x9f36('0x1'))['db'][_0x9f36('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f36('0x3'),'afterDestroy':_0x9f36('0x4')};function emitEvent(_0x4162f3){return function(_0x4c8000,_0x39bdfd,_0x3f00a6){MailQueueEvents[_0x9f36('0x5')](_0x4162f3+':'+_0x4c8000['id'],_0x4c8000);MailQueueEvents['emit'](_0x4162f3,_0x4c8000);_0x3f00a6(null);};}for(var e in events){if(events[_0x9f36('0x6')](e)){var event=events[e];MailQueue[_0x9f36('0x7')](e,emitEvent(event));}}module[_0x9f36('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 efc6a61..fc6f96d 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 _0x27e1=['rimraf','./mailQueue.attributes','exports','MailQueue','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3bbf5c,_0x2fa0ad){var _0x36469e=function(_0x3ae259){while(--_0x3ae259){_0x3bbf5c['push'](_0x3bbf5c['shift']());}};_0x36469e(++_0x2fa0ad);}(_0x27e1,0x158));var _0x127e=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x27e1[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x127e('0x0'))(_0x127e('0x1'));var moment=require(_0x127e('0x2'));var BPromise=require(_0x127e('0x3'));var rp=require(_0x127e('0x4'));var fs=require('fs');var path=require(_0x127e('0x5'));var rimraf=require(_0x127e('0x6'));var config=require('../../config/environment');var attributes=require(_0x127e('0x7'));module[_0x127e('0x8')]=function(_0xfc84c1,_0x31fc26){return _0xfc84c1['define'](_0x127e('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018a=['request-promise','path','rimraf','define','MailQueue','util','../../config/logger','api','moment','bluebird'];(function(_0x38b4de,_0x3b2b10){var _0x54f3dc=function(_0xf82116){while(--_0xf82116){_0x38b4de['push'](_0x38b4de['shift']());}};_0x54f3dc(++_0x3b2b10);}(_0x018a,0x13b));var _0xa018=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0x018a[_0xbe6d5d];return _0x2cb584;};'use strict';var _=require('lodash');var util=require(_0xa018('0x0'));var logger=require(_0xa018('0x1'))(_0xa018('0x2'));var moment=require(_0xa018('0x3'));var BPromise=require(_0xa018('0x4'));var rp=require(_0xa018('0x5'));var fs=require('fs');var path=require(_0xa018('0x6'));var rimraf=require(_0xa018('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x597d0e,_0x53adc7){return _0x597d0e[_0xa018('0x8')](_0xa018('0x9'),attributes,{'tableName':'mail_queues','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 976c080..ff4fe7b 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 _0x41d2=['code','message','info','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./mailQueue.socket','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5082f6,_0x4fef6e){var _0x39dfa5=function(_0x50aac6){while(--_0x50aac6){_0x5082f6['push'](_0x5082f6['shift']());}};_0x39dfa5(++_0x4fef6e);}(_0x41d2,0x138));var _0x241d=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x41d2[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0x241d('0x0'));var util=require(_0x241d('0x1'));var moment=require(_0x241d('0x2'));var BPromise=require(_0x241d('0x3'));var rs=require(_0x241d('0x4'));var fs=require('fs');var Redis=require(_0x241d('0x5'));var db=require(_0x241d('0x6'))['db'];var utils=require(_0x241d('0x7'));var logger=require(_0x241d('0x8'))(_0x241d('0x9'));var config=require('../../config/environment');var jayson=require(_0x241d('0xa'));var client=jayson[_0x241d('0xb')][_0x241d('0xc')]({'port':0x232a});config['redis']=_[_0x241d('0xd')](config[_0x241d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x241d('0xf'))(new Redis(config[_0x241d('0xe')]));require(_0x241d('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d3da5,_0x37ba17,_0x2e943c){return new BPromise(function(_0xbae080,_0x60d8c9){return client[_0x241d('0x11')](_0x3d3da5,_0x2e943c)['then'](function(_0x16944f){logger['info'](_0x241d('0x12'),_0x37ba17,_0x241d('0x13'));logger[_0x241d('0x14')](_0x241d('0x15'),_0x37ba17,'request\x20sent',JSON[_0x241d('0x16')](_0x16944f));if(_0x16944f['error']){if(_0x16944f[_0x241d('0x17')][_0x241d('0x18')]===0x1f4){logger[_0x241d('0x17')](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0x60d8c9(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}logger['error'](_0x241d('0x12'),_0x37ba17,_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);return _0xbae080(_0x16944f[_0x241d('0x17')][_0x241d('0x19')]);}else{logger[_0x241d('0x1a')]('MailQueue,\x20%s,\x20%s',_0x37ba17,'request\x20sent');_0xbae080(_0x16944f[_0x241d('0x1b')][_0x241d('0x19')]);}})[_0x241d('0x1c')](function(_0xe34e86){logger[_0x241d('0x17')]('MailQueue,\x20%s,\x20%s',_0x37ba17,_0xe34e86);_0x60d8c9(_0xe34e86);});});}exports[_0x241d('0x1d')]=function(_0x421ce0){var _0x20f8d2=this;return new Promise(function(_0x3a7f50,_0x1e2274){return db['MailQueue'][_0x241d('0x1e')]({'raw':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x421ce0[_0x241d('0x1f')]?_0x421ce0[_0x241d('0x1f')][_0x241d('0x22')]||null:null,'limit':_0x421ce0[_0x241d('0x1f')]?_0x421ce0['options'][_0x241d('0x23')]||null:null,'include':_0x421ce0['options']?_0x421ce0[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x421ce0[_0x241d('0x1f')][_0x241d('0x25')],function(_0x314bd8){return{'model':db[_0x314bd8[_0x241d('0x26')]],'as':_0x314bd8['as'],'attributes':_0x314bd8[_0x241d('0x22')],'include':_0x314bd8[_0x241d('0x25')]?_[_0x241d('0x24')](_0x314bd8['include'],function(_0x3ec710){return{'model':db[_0x3ec710[_0x241d('0x26')]],'as':_0x3ec710['as'],'attributes':_0x3ec710['attributes'],'include':_0x3ec710['include']?_[_0x241d('0x24')](_0x3ec710[_0x241d('0x25')],function(_0x5d93df){return{'model':db[_0x5d93df[_0x241d('0x26')]],'as':_0x5d93df['as'],'attributes':_0x5d93df[_0x241d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0xe721a6){logger[_0x241d('0x1a')]('GetMailQueue',_0x421ce0);logger['debug'](_0x241d('0x1d'),_0x421ce0,JSON[_0x241d('0x16')](_0xe721a6));_0x3a7f50(_0xe721a6);})[_0x241d('0x1c')](function(_0x13180e){logger[_0x241d('0x17')](_0x241d('0x1d'),_0x13180e[_0x241d('0x19')],_0x421ce0);_0x1e2274(_0x20f8d2['error'](0x1f4,_0x13180e[_0x241d('0x19')]));});});};exports[_0x241d('0x28')]=function(_0x3957d4){var _0x1f6126=this;return new Promise(function(_0x5b1312,_0x201002){return db['MailQueue'][_0x241d('0x29')]({'raw':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x20')]===undefined?!![]:![]:!![],'where':_0x3957d4[_0x241d('0x1f')]?_0x3957d4[_0x241d('0x1f')][_0x241d('0x21')]||null:null,'attributes':_0x3957d4['options']?_0x3957d4['options'][_0x241d('0x22')]||null:null,'include':_0x3957d4['options']?_0x3957d4[_0x241d('0x1f')]['include']?_[_0x241d('0x24')](_0x3957d4[_0x241d('0x1f')][_0x241d('0x25')],function(_0x57ba0c){return{'model':db[_0x57ba0c['model']],'as':_0x57ba0c['as'],'attributes':_0x57ba0c[_0x241d('0x22')],'include':_0x57ba0c['include']?_['map'](_0x57ba0c['include'],function(_0x5cafd1){return{'model':db[_0x5cafd1[_0x241d('0x26')]],'as':_0x5cafd1['as'],'attributes':_0x5cafd1[_0x241d('0x22')],'include':_0x5cafd1[_0x241d('0x25')]?_[_0x241d('0x24')](_0x5cafd1[_0x241d('0x25')],function(_0x420bcf){return{'model':db[_0x420bcf['model']],'as':_0x420bcf['as'],'attributes':_0x420bcf['attributes']};}):[]};}):[]};}):[]:[]})[_0x241d('0x27')](function(_0x3846fa){logger[_0x241d('0x1a')]('ShowMailQueue',_0x3957d4);logger[_0x241d('0x14')](_0x241d('0x28'),_0x3957d4,JSON[_0x241d('0x16')](_0x3846fa));_0x5b1312(_0x3846fa);})[_0x241d('0x1c')](function(_0x2f6c59){logger[_0x241d('0x17')](_0x241d('0x28'),_0x2f6c59[_0x241d('0x19')],_0x3957d4);_0x201002(_0x1f6126[_0x241d('0x17')](0x1f4,_0x2f6c59['message']));});});}; \ No newline at end of file +var _0x4c90=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','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','where','attributes','include','map','model','then','debug','ShowMailQueue','find','lodash','util','moment'];(function(_0x2c34ba,_0x3a4eb6){var _0x420bc3=function(_0x4921bc){while(--_0x4921bc){_0x2c34ba['push'](_0x2c34ba['shift']());}};_0x420bc3(++_0x3a4eb6);}(_0x4c90,0x78));var _0x04c9=function(_0x3c7a65,_0x4c05c4){_0x3c7a65=_0x3c7a65-0x0;var _0xc48a10=_0x4c90[_0x3c7a65];return _0xc48a10;};'use strict';var _=require(_0x04c9('0x0'));var util=require(_0x04c9('0x1'));var moment=require(_0x04c9('0x2'));var BPromise=require(_0x04c9('0x3'));var rs=require(_0x04c9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04c9('0x5'))['db'];var utils=require(_0x04c9('0x6'));var logger=require('../../config/logger')(_0x04c9('0x7'));var config=require(_0x04c9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x04c9('0x9')][_0x04c9('0xa')]({'port':0x232a});config[_0x04c9('0xb')]=_[_0x04c9('0xc')](config[_0x04c9('0xb')],{'host':_0x04c9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04c9('0xb')]));require(_0x04c9('0xe'))[_0x04c9('0xf')](socket);function respondWithRpcPromise(_0x441190,_0x22c19a,_0x146dcb){return new BPromise(function(_0xcc426e,_0x5a3372){return client[_0x04c9('0x10')](_0x441190,_0x146dcb)['then'](function(_0x1d0923){logger['info']('MailQueue,\x20%s,\x20%s',_0x22c19a,_0x04c9('0x11'));logger['debug'](_0x04c9('0x12'),_0x22c19a,_0x04c9('0x11'),JSON[_0x04c9('0x13')](_0x1d0923));if(_0x1d0923[_0x04c9('0x14')]){if(_0x1d0923['error'][_0x04c9('0x15')]===0x1f4){logger[_0x04c9('0x14')](_0x04c9('0x16'),_0x22c19a,_0x1d0923['error'][_0x04c9('0x17')]);return _0x5a3372(_0x1d0923[_0x04c9('0x14')]['message']);}logger['error']('MailQueue,\x20%s,\x20%s',_0x22c19a,_0x1d0923[_0x04c9('0x14')][_0x04c9('0x17')]);return _0xcc426e(_0x1d0923[_0x04c9('0x14')][_0x04c9('0x17')]);}else{logger[_0x04c9('0x18')](_0x04c9('0x16'),_0x22c19a,_0x04c9('0x11'));_0xcc426e(_0x1d0923[_0x04c9('0x19')][_0x04c9('0x17')]);}})[_0x04c9('0x1a')](function(_0x7998d1){logger['error'](_0x04c9('0x16'),_0x22c19a,_0x7998d1);_0x5a3372(_0x7998d1);});});}exports[_0x04c9('0x1b')]=function(_0x13758c){var _0x1f9cfa=this;return new Promise(function(_0x158af0,_0xbaca97){return db[_0x04c9('0x1c')][_0x04c9('0x1d')]({'raw':_0x13758c[_0x04c9('0x1e')]?_0x13758c[_0x04c9('0x1e')][_0x04c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x13758c[_0x04c9('0x1e')]?_0x13758c[_0x04c9('0x1e')][_0x04c9('0x20')]||null:null,'attributes':_0x13758c[_0x04c9('0x1e')]?_0x13758c['options'][_0x04c9('0x21')]||null:null,'limit':_0x13758c[_0x04c9('0x1e')]?_0x13758c[_0x04c9('0x1e')]['limit']||null:null,'include':_0x13758c[_0x04c9('0x1e')]?_0x13758c['options'][_0x04c9('0x22')]?_[_0x04c9('0x23')](_0x13758c[_0x04c9('0x1e')][_0x04c9('0x22')],function(_0x11fc7d){return{'model':db[_0x11fc7d[_0x04c9('0x24')]],'as':_0x11fc7d['as'],'attributes':_0x11fc7d[_0x04c9('0x21')],'include':_0x11fc7d[_0x04c9('0x22')]?_[_0x04c9('0x23')](_0x11fc7d[_0x04c9('0x22')],function(_0x773f2a){return{'model':db[_0x773f2a[_0x04c9('0x24')]],'as':_0x773f2a['as'],'attributes':_0x773f2a[_0x04c9('0x21')],'include':_0x773f2a[_0x04c9('0x22')]?_[_0x04c9('0x23')](_0x773f2a['include'],function(_0x546ee0){return{'model':db[_0x546ee0[_0x04c9('0x24')]],'as':_0x546ee0['as'],'attributes':_0x546ee0[_0x04c9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x04c9('0x25')](function(_0x4f9a23){logger[_0x04c9('0x18')](_0x04c9('0x1b'),_0x13758c);logger[_0x04c9('0x26')]('GetMailQueue',_0x13758c,JSON['stringify'](_0x4f9a23));_0x158af0(_0x4f9a23);})['catch'](function(_0x341078){logger[_0x04c9('0x14')](_0x04c9('0x1b'),_0x341078[_0x04c9('0x17')],_0x13758c);_0xbaca97(_0x1f9cfa['error'](0x1f4,_0x341078[_0x04c9('0x17')]));});});};exports[_0x04c9('0x27')]=function(_0x552e39){var _0x24262a=this;return new Promise(function(_0x526a66,_0x1438fa){return db[_0x04c9('0x1c')][_0x04c9('0x28')]({'raw':_0x552e39['options']?_0x552e39[_0x04c9('0x1e')][_0x04c9('0x1f')]===undefined?!![]:![]:!![],'where':_0x552e39[_0x04c9('0x1e')]?_0x552e39[_0x04c9('0x1e')][_0x04c9('0x20')]||null:null,'attributes':_0x552e39[_0x04c9('0x1e')]?_0x552e39['options'][_0x04c9('0x21')]||null:null,'include':_0x552e39[_0x04c9('0x1e')]?_0x552e39[_0x04c9('0x1e')][_0x04c9('0x22')]?_['map'](_0x552e39['options'][_0x04c9('0x22')],function(_0x558bae){return{'model':db[_0x558bae[_0x04c9('0x24')]],'as':_0x558bae['as'],'attributes':_0x558bae['attributes'],'include':_0x558bae[_0x04c9('0x22')]?_['map'](_0x558bae[_0x04c9('0x22')],function(_0x429d85){return{'model':db[_0x429d85[_0x04c9('0x24')]],'as':_0x429d85['as'],'attributes':_0x429d85[_0x04c9('0x21')],'include':_0x429d85['include']?_[_0x04c9('0x23')](_0x429d85['include'],function(_0x2d3403){return{'model':db[_0x2d3403[_0x04c9('0x24')]],'as':_0x2d3403['as'],'attributes':_0x2d3403[_0x04c9('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52ee88){logger[_0x04c9('0x18')]('ShowMailQueue',_0x552e39);logger[_0x04c9('0x26')](_0x04c9('0x27'),_0x552e39,JSON[_0x04c9('0x13')](_0x52ee88));_0x526a66(_0x52ee88);})['catch'](function(_0x2e74c5){logger[_0x04c9('0x14')](_0x04c9('0x27'),_0x2e74c5[_0x04c9('0x17')],_0x552e39);_0x1438fa(_0x24262a['error'](0x1f4,_0x2e74c5[_0x04c9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0dae9bb..05dde38 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 _0x22c9=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x451563,_0x1d02c6){var _0x1bff88=function(_0x4bcb4b){while(--_0x4bcb4b){_0x451563['push'](_0x451563['shift']());}};_0x1bff88(++_0x1d02c6);}(_0x22c9,0x8b));var _0x922c=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0x22c9[_0x3eee78];return _0x53a5e5;};'use strict';var MailQueueEvents=require(_0x922c('0x0'));var events=[_0x922c('0x1'),_0x922c('0x2'),_0x922c('0x3')];function createListener(_0x4dd306,_0x57e307){return function(_0x3e8e9e){_0x57e307[_0x922c('0x4')](_0x4dd306,_0x3e8e9e);};}function removeListener(_0x457a22,_0xd8e5d){return function(){MailQueueEvents[_0x922c('0x5')](_0x457a22,_0xd8e5d);};}exports[_0x922c('0x6')]=function(_0x38356a){for(var _0x285dc2=0x0,_0x35451c=events[_0x922c('0x7')];_0x285dc2<_0x35451c;_0x285dc2++){var _0x395fc1=events[_0x285dc2];var _0xe8b783=createListener(_0x922c('0x8')+_0x395fc1,_0x38356a);MailQueueEvents['on'](_0x395fc1,_0xe8b783);}}; \ No newline at end of file +var _0xe206=['update','emit','removeListener','register','length','save','remove'];(function(_0x419b19,_0x2d68e8){var _0xb2d0c6=function(_0x50fec0){while(--_0x50fec0){_0x419b19['push'](_0x419b19['shift']());}};_0xb2d0c6(++_0x2d68e8);}(_0xe206,0x101));var _0x6e20=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xe206[_0x29db36];return _0x234e87;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x6e20('0x0'),_0x6e20('0x1'),_0x6e20('0x2')];function createListener(_0x44161a,_0x5de7ff){return function(_0x4ae79c){_0x5de7ff[_0x6e20('0x3')](_0x44161a,_0x4ae79c);};}function removeListener(_0x4083fe,_0x4c0282){return function(){MailQueueEvents[_0x6e20('0x4')](_0x4083fe,_0x4c0282);};}exports[_0x6e20('0x5')]=function(_0x4dd6ba){for(var _0x196f64=0x0,_0x28ae32=events[_0x6e20('0x6')];_0x196f64<_0x28ae32;_0x196f64++){var _0x31176c=events[_0x196f64];var _0x50e088=createListener('mailQueue:'+_0x31176c,_0x4dd6ba);MailQueueEvents['on'](_0x31176c,_0x50e088);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0ee4cf0..7bef5c7 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 _0xb5fb=['index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xb5fb,0x1ef));var _0xbb5f=function(_0x9c6c1c,_0x21ead9){_0x9c6c1c=_0x9c6c1c-0x0;var _0x594c42=_0xb5fb[_0x9c6c1c];return _0x594c42;};'use strict';var multer=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var path=require('path');var timeout=require(_0xbb5f('0x2'));var express=require(_0xbb5f('0x3'));var router=express[_0xbb5f('0x4')]();var fs_extra=require(_0xbb5f('0x5'));var auth=require(_0xbb5f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb5f('0x7'));var controller=require(_0xbb5f('0x8'));router[_0xbb5f('0x9')]('/',auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xb')]);router[_0xbb5f('0x9')](_0xbb5f('0xc'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xd')]);router['get'](_0xbb5f('0xe'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb5f('0x10')]);router[_0xbb5f('0x11')](_0xbb5f('0xe'),auth[_0xbb5f('0xa')](),controller[_0xbb5f('0x12')]);router[_0xbb5f('0x13')]('/:id',auth[_0xbb5f('0xa')](),controller[_0xbb5f('0x14')]);module[_0xbb5f('0x15')]=router; \ No newline at end of file +var _0xa603=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','delete','destroy','multer','util'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xa603,0x178));var _0x3a60=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa603[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x3a60('0x0'));var util=require(_0x3a60('0x1'));var path=require(_0x3a60('0x2'));var timeout=require(_0x3a60('0x3'));var express=require(_0x3a60('0x4'));var router=express['Router']();var fs_extra=require(_0x3a60('0x5'));var auth=require(_0x3a60('0x6'));var interaction=require(_0x3a60('0x7'));var config=require(_0x3a60('0x8'));var controller=require(_0x3a60('0x9'));router[_0x3a60('0xa')]('/',auth[_0x3a60('0xb')](),controller[_0x3a60('0xc')]);router[_0x3a60('0xa')](_0x3a60('0xd'),auth[_0x3a60('0xb')](),controller[_0x3a60('0xe')]);router[_0x3a60('0xa')]('/:id',auth[_0x3a60('0xb')](),controller[_0x3a60('0xf')]);router[_0x3a60('0x10')]('/',auth[_0x3a60('0xb')](),controller['create']);router[_0x3a60('0x11')](_0x3a60('0x12'),auth[_0x3a60('0xb')](),controller['update']);router[_0x3a60('0x13')](_0x3a60('0x12'),auth[_0x3a60('0xb')](),controller[_0x3a60('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index ad9459c..2797077 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 _0x5dbc=['moment','sequelize','exports','DATE','STRING'];(function(_0x419cea,_0x48a736){var _0x13a1c9=function(_0x55edfc){while(--_0x55edfc){_0x419cea['push'](_0x419cea['shift']());}};_0x13a1c9(++_0x48a736);}(_0x5dbc,0x181));var _0xc5db=function(_0x17488c,_0x18fe75){_0x17488c=_0x17488c-0x0;var _0x544ea7=_0x5dbc[_0x17488c];return _0x544ea7;};'use strict';var moment=require(_0xc5db('0x0'));var Sequelize=require(_0xc5db('0x1'));module[_0xc5db('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc5db('0x3')]},'leaveAt':{'type':Sequelize[_0xc5db('0x3')]},'acceptAt':{'type':Sequelize[_0xc5db('0x3')]},'exitAt':{'type':Sequelize[_0xc5db('0x3')]},'reason':{'type':Sequelize[_0xc5db('0x4')]}}; \ No newline at end of file +var _0x277c=['exports','STRING','DATE','moment'];(function(_0x2e3754,_0x430b9d){var _0x43f327=function(_0x238837){while(--_0x238837){_0x2e3754['push'](_0x2e3754['shift']());}};_0x43f327(++_0x430b9d);}(_0x277c,0x153));var _0xc277=function(_0x47820e,_0x29c785){_0x47820e=_0x47820e-0x0;var _0x1b7473=_0x277c[_0x47820e];return _0x1b7473;};'use strict';var moment=require(_0xc277('0x0'));var Sequelize=require('sequelize');module[_0xc277('0x1')]={'uniqueid':{'type':Sequelize[_0xc277('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc277('0x2')]},'joinAt':{'type':Sequelize[_0xc277('0x3')]},'leaveAt':{'type':Sequelize[_0xc277('0x3')]},'acceptAt':{'type':Sequelize[_0xc277('0x3')]},'exitAt':{'type':Sequelize[_0xc277('0x3')]},'reason':{'type':Sequelize[_0xc277('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 0bd9273..feaeb24 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 _0x4bd3=['reject','save','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','show','params','include','catch','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1ecff3,_0x292dff){var _0x5ce1bd=function(_0x1774c1){while(--_0x1774c1){_0x1ecff3['push'](_0x1ecff3['shift']());}};_0x5ce1bd(++_0x292dff);}(_0x4bd3,0x174));var _0x34bd=function(_0x5aa8ac,_0x37f6e8){_0x5aa8ac=_0x5aa8ac-0x0;var _0x4b382d=_0x4bd3[_0x5aa8ac];return _0x4b382d;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=typeof _0x4e3886[_0x34bd('0x18')]===_0x34bd('0x19')&&typeof _0x4e3886[_0x34bd('0x1a')]===_0x34bd('0x19');var _0xd39d72=_0x6638ed[_0x34bd('0x1b')];var _0x3b4bf8=_0x30b3f2?0x0:_0x4e3886[_0x34bd('0x18')];var _0x4b5ebb=_0x30b3f2?_0x6638ed['count']:_0x4e3886[_0x34bd('0x18')]+_0x4e3886[_0x34bd('0x1a')];var _0x265e70;if(_0x4b5ebb>=_0xd39d72){_0x4b5ebb=_0xd39d72;_0x265e70=0xc8;}else{_0x265e70=0xce;}_0x4d4955[_0x34bd('0x15')](_0x265e70);return _0x4d4955[_0x34bd('0x1c')](_0x34bd('0x1d'),_0x3b4bf8+'-'+_0x4b5ebb+'/'+_0xd39d72)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x3d5f76){return function(_0x130bd0){try{jsonpatch['apply'](_0x130bd0,_0x3d5f76,!![]);}catch(_0x15c0d1){return BPromise[_0x34bd('0x1e')](_0x15c0d1);}return _0x130bd0[_0x34bd('0x1f')]();};}function saveUpdates(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['update'](_0x14254b)['then'](function(_0x4edf84){return _0x4edf84;});}return null;};}function removeEntity(_0x3dafe8,_0x503a60){return function(_0x10fc4b){if(_0x10fc4b){return _0x10fc4b[_0x34bd('0x20')]()[_0x34bd('0x21')](function(){_0x3dafe8['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x14479a,_0x4f0dff){return function(_0x457006){if(!_0x457006){_0x14479a['sendStatus'](0x194);}return _0x457006;};}function handleError(_0x29bda8,_0xb256e8){_0xb256e8=_0xb256e8||0x1f4;return function(_0x264c94){logger[_0x34bd('0x22')](_0x264c94['stack']);if(_0x264c94[_0x34bd('0x23')]){delete _0x264c94[_0x34bd('0x23')];}_0x29bda8['status'](_0xb256e8)[_0x34bd('0x24')](_0x264c94);};}exports[_0x34bd('0x25')]=function(_0x16581f,_0x3f675c){var _0x26b8e7={},_0x4500c8={},_0x177d43={'count':0x0,'rows':[]};var _0x58b431=_[_0x34bd('0x26')](db[_0x34bd('0x27')]['rawAttributes'],function(_0x5d1662){return{'name':_0x5d1662[_0x34bd('0x28')],'type':_0x5d1662[_0x34bd('0x29')][_0x34bd('0x2a')]};});_0x4500c8['model']=_['map'](_0x58b431,_0x34bd('0x23'));_0x4500c8[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x16581f[_0x34bd('0x2b')]);_0x4500c8['filters']=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],_0x4500c8[_0x34bd('0x2b')]);_0x26b8e7[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],qs['fields'](_0x16581f[_0x34bd('0x2b')]['fields']));_0x26b8e7[_0x34bd('0x2f')]=_0x26b8e7[_0x34bd('0x2f')][_0x34bd('0x30')]?_0x26b8e7['attributes']:_0x4500c8[_0x34bd('0x2e')];if(!_0x16581f[_0x34bd('0x2b')]['hasOwnProperty'](_0x34bd('0x31'))){_0x26b8e7[_0x34bd('0x1a')]=qs[_0x34bd('0x1a')](_0x16581f['query'][_0x34bd('0x1a')]);_0x26b8e7[_0x34bd('0x18')]=qs['offset'](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x18')]);}_0x26b8e7[_0x34bd('0x32')]=qs[_0x34bd('0x33')](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x33')]);_0x26b8e7['where']=qs['filters'](_['pick'](_0x16581f[_0x34bd('0x2b')],_0x4500c8[_0x34bd('0x34')]),_0x58b431);if(_0x16581f['query']['filter']){_0x26b8e7[_0x34bd('0x35')]=_['merge'](_0x26b8e7['where'],{'$or':_[_0x34bd('0x26')](_0x58b431,function(_0xb5a456){if(_0xb5a456[_0x34bd('0x29')]!==_0x34bd('0x36')){var _0x2af1af={};_0x2af1af[_0xb5a456['name']]={'$like':'%'+_0x16581f['query'][_0x34bd('0x37')]+'%'};return _0x2af1af;}})});}_0x26b8e7=_['merge']({},_0x26b8e7,_0x16581f[_0x34bd('0x38')]);var _0x2c9b7a={'where':_0x26b8e7[_0x34bd('0x35')]};return db[_0x34bd('0x27')][_0x34bd('0x1b')](_0x2c9b7a)['then'](function(_0x282297){_0x177d43[_0x34bd('0x1b')]=_0x282297;if(_0x16581f[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x26b8e7['include']=[{'all':!![]}];}return db[_0x34bd('0x27')]['findAll'](_0x26b8e7);})[_0x34bd('0x21')](function(_0x560282){_0x177d43['rows']=_0x560282;return _0x177d43;})[_0x34bd('0x21')](respondWithFilteredResult(_0x3f675c,_0x26b8e7))['catch'](handleError(_0x3f675c,null));};exports[_0x34bd('0x3a')]=function(_0x3d3b96,_0x18e9f6){var _0x42a424={'raw':!![],'where':{'id':_0x3d3b96[_0x34bd('0x3b')]['id']}},_0x26d73e={};_0x26d73e[_0x34bd('0x2e')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x26d73e[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x3d3b96[_0x34bd('0x2b')]);_0x26d73e[_0x34bd('0x34')]=_['intersection'](_0x26d73e[_0x34bd('0x2e')],_0x26d73e[_0x34bd('0x2b')]);_0x42a424[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x26d73e[_0x34bd('0x2e')],qs['fields'](_0x3d3b96[_0x34bd('0x2b')]['fields']));_0x42a424['attributes']=_0x42a424[_0x34bd('0x2f')]['length']?_0x42a424[_0x34bd('0x2f')]:_0x26d73e[_0x34bd('0x2e')];if(_0x3d3b96[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x42a424[_0x34bd('0x3c')]=[{'all':!![]}];}_0x42a424=_['merge']({},_0x42a424,_0x3d3b96['options']);return db[_0x34bd('0x27')]['find'](_0x42a424)[_0x34bd('0x21')](handleEntityNotFound(_0x18e9f6,null))[_0x34bd('0x21')](respondWithResult(_0x18e9f6,null))[_0x34bd('0x3d')](handleError(_0x18e9f6,null));};exports['create']=function(_0x4ad00c,_0x4f96dd){return db['MailQueueReport'][_0x34bd('0x3e')](_0x4ad00c['body'],{})[_0x34bd('0x21')](respondWithResult(_0x4f96dd,0xc9))['catch'](handleError(_0x4f96dd,null));};exports[_0x34bd('0x3f')]=function(_0x1d01d7,_0x1fa341){if(_0x1d01d7[_0x34bd('0x40')]['id']){delete _0x1d01d7[_0x34bd('0x40')]['id'];}return db['MailQueueReport'][_0x34bd('0x41')]({'where':{'id':_0x1d01d7[_0x34bd('0x3b')]['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fa341,null))[_0x34bd('0x21')](saveUpdates(_0x1d01d7[_0x34bd('0x40')],null))['then'](respondWithResult(_0x1fa341,null))[_0x34bd('0x3d')](handleError(_0x1fa341,null));};exports[_0x34bd('0x20')]=function(_0x5bcce5,_0x1fc735){return db[_0x34bd('0x27')]['find']({'where':{'id':_0x5bcce5['params']['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fc735,null))['then'](removeEntity(_0x1fc735,null))['catch'](handleError(_0x1fc735,null));};exports[_0x34bd('0x42')]=function(_0x5df6a5,_0x556ce8){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x556ce8,null))[_0x34bd('0x3d')](handleError(_0x556ce8,null));}; \ No newline at end of file +var _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x13fb80,_0x5a3d39){var _0x3733e8=function(_0x5c5655){while(--_0x5c5655){_0x13fb80['push'](_0x13fb80['shift']());}};_0x3733e8(++_0x5a3d39);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4a3ee3,_0x304512){_0x4a3ee3=_0x4a3ee3-0x0;var _0x56d16d=_0x0b0e[_0x4a3ee3];return _0x56d16d;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['MailQueueReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['MailQueueReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['MailQueueReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 81c3099..eac3478 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 _0x7aee=['util','../../config/logger','api','moment','bluebird','path','rimraf','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x978971,_0x4ca3cb){var _0x48572f=function(_0x58fdd6){while(--_0x58fdd6){_0x978971['push'](_0x978971['shift']());}};_0x48572f(++_0x4ca3cb);}(_0x7aee,0x9c));var _0xe7ae=function(_0xa9fc1d,_0x2a25db){_0xa9fc1d=_0xa9fc1d-0x0;var _0x45485c=_0x7aee[_0xa9fc1d];return _0x45485c;};'use strict';var _=require('lodash');var util=require(_0xe7ae('0x0'));var logger=require(_0xe7ae('0x1'))(_0xe7ae('0x2'));var moment=require(_0xe7ae('0x3'));var BPromise=require(_0xe7ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ae('0x5'));var rimraf=require(_0xe7ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xe7ae('0x7'));module[_0xe7ae('0x8')]=function(_0x5a6fda,_0x26badb){return _0x5a6fda['define'](_0xe7ae('0x9'),attributes,{'tableName':_0xe7ae('0xa'),'paranoid':![],'indexes':[{'name':_0xe7ae('0xb'),'fields':[_0xe7ae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05eb=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid'];(function(_0x4c9d58,_0x1c83f0){var _0x3ad22d=function(_0xd95048){while(--_0xd95048){_0x4c9d58['push'](_0x4c9d58['shift']());}};_0x3ad22d(++_0x1c83f0);}(_0x05eb,0x1bc));var _0xb05e=function(_0x441bb1,_0x1eea34){_0x441bb1=_0x441bb1-0x0;var _0x5b03ff=_0x05eb[_0x441bb1];return _0x5b03ff;};'use strict';var _=require(_0xb05e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb05e('0x1'));var moment=require(_0xb05e('0x2'));var BPromise=require(_0xb05e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb05e('0x4'));var rimraf=require(_0xb05e('0x5'));var config=require(_0xb05e('0x6'));var attributes=require(_0xb05e('0x7'));module[_0xb05e('0x8')]=function(_0x5de4fd,_0x9bd4c){return _0x5de4fd[_0xb05e('0x9')]('MailQueueReport',attributes,{'tableName':_0xb05e('0xa'),'paranoid':![],'indexes':[{'name':_0xb05e('0xb'),'fields':[_0xb05e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3381c7d..1e63d5f 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(_0xaf52f9,_0x3608bc){var _0xd9e03e=function(_0xaf82d3){while(--_0xaf82d3){_0xaf52f9['push'](_0xaf52f9['shift']());}};_0xd9e03e(++_0x3608bc);}(_0xdb28,0x106));var _0x8db2=function(_0x5f44d1,_0x44abb2){_0x5f44d1=_0x5f44d1-0x0;var _0x1c6e32=_0xdb28[_0x5f44d1];return _0x1c6e32;};'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 _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x302a02,_0x34f365){var _0x2b1d2d=function(_0x5ea1fe){while(--_0x5ea1fe){_0x302a02['push'](_0x302a02['shift']());}};_0x2b1d2d(++_0x34f365);}(_0x326f,0xd1));var _0xf326=function(_0x4eb928,_0x1fad0d){_0x4eb928=_0x4eb928-0x0;var _0xd985d8=_0x326f[_0x4eb928];return _0xd985d8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 8dfb936..c67008e 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xb2602e,_0x1d888c){var _0x2263ca=function(_0x408c50){while(--_0x408c50){_0xb2602e['push'](_0xb2602e['shift']());}};_0x2263ca(++_0x1d888c);}(_0xe706,0xa3));var _0x6e70=function(_0xfaddc9,_0x5c9ad2){_0xfaddc9=_0xfaddc9-0x0;var _0x579846=_0xe706[_0xfaddc9];return _0x579846;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xa7c249,_0x599b5e){var _0x1a9b26=function(_0x2b8797){while(--_0x2b8797){_0xa7c249['push'](_0xa7c249['shift']());}};_0x1a9b26(++_0x599b5e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 6f71b5a..fe58c3c 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 _0x651e=['BOOLEAN','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x651e,0x1c0));var _0xe651=function(_0x280846,_0xdf7f97){_0x280846=_0x280846-0x0;var _0x11caa3=_0x651e[_0x280846];return _0x11caa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe651('0x0')]},'password':{'type':Sequelize[_0xe651('0x0')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe651('0x1')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe651('0x1')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe651('0x0')]},'modernAuthentication':{'type':Sequelize[_0xe651('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xbbb4=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x28592f,_0x424870){var _0x2d3e15=function(_0x410eb2){while(--_0x410eb2){_0x28592f['push'](_0x28592f['shift']());}};_0x2d3e15(++_0x424870);}(_0xbbb4,0xe0));var _0x4bbb=function(_0x40f64c,_0x19b59c){_0x40f64c=_0x40f64c-0x0;var _0x3ed3e5=_0xbbb4[_0x40f64c];return _0x3ed3e5;};'use strict';var Sequelize=require('sequelize');module[_0x4bbb('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4bbb('0x1')]},'authentication':{'type':Sequelize[_0x4bbb('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x4bbb('0x3')]},'tls':{'type':Sequelize[_0x4bbb('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4bbb('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x4bbb('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4bbb('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4bbb('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index a98926a..10326a1 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 _0x3a9b=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x2ab9c7,_0x3f5ef9){var _0x324c04=function(_0x46888f){while(--_0x46888f){_0x2ab9c7['push'](_0x2ab9c7['shift']());}};_0x324c04(++_0x3f5ef9);}(_0x3a9b,0x68));var _0xb3a9=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x3a9b[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xb3a9('0x0'));var util=require(_0xb3a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb3a9('0x2'));var BPromise=require(_0xb3a9('0x3'));var rp=require(_0xb3a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3a9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb3a9('0x6'));module[_0xb3a9('0x7')]=function(_0x53f318,_0x17f565){return _0x53f318[_0xb3a9('0x8')]('MailServerIn',attributes,{'tableName':_0xb3a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca10=['define','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x54f3cb,_0xca1fa1){var _0x231f27=function(_0x43941e){while(--_0x43941e){_0x54f3cb['push'](_0x54f3cb['shift']());}};_0x231f27(++_0xca1fa1);}(_0xca10,0x141));var _0x0ca1=function(_0xbb81d5,_0x52ffe0){_0xbb81d5=_0xbb81d5-0x0;var _0x1acacc=_0xca10[_0xbb81d5];return _0x1acacc;};'use strict';var _=require('lodash');var util=require(_0x0ca1('0x0'));var logger=require('../../config/logger')(_0x0ca1('0x1'));var moment=require(_0x0ca1('0x2'));var BPromise=require(_0x0ca1('0x3'));var rp=require(_0x0ca1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ca1('0x5'));var config=require(_0x0ca1('0x6'));var attributes=require(_0x0ca1('0x7'));module[_0x0ca1('0x8')]=function(_0x11d10a,_0x12639b){return _0x11d10a[_0x0ca1('0x9')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 915377f..dddbecc 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 _0x13f7=['error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x518bc4,_0x14e1b2){var _0x2aeed7=function(_0x1a4a88){while(--_0x1a4a88){_0x518bc4['push'](_0x518bc4['shift']());}};_0x2aeed7(++_0x14e1b2);}(_0x13f7,0x164));var _0x713f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13f7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x713f('0x0'));var util=require(_0x713f('0x1'));var moment=require(_0x713f('0x2'));var BPromise=require(_0x713f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x713f('0x5'));var logger=require(_0x713f('0x6'))(_0x713f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x713f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2571f6,_0x57616c,_0x4f7a31){return new BPromise(function(_0x2a47f5,_0x59874f){return client[_0x713f('0x9')](_0x2571f6,_0x4f7a31)[_0x713f('0xa')](function(_0x3f594c){logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');logger[_0x713f('0xd')](_0x713f('0xe'),_0x57616c,_0x713f('0xf'),JSON['stringify'](_0x3f594c));if(_0x3f594c[_0x713f('0x10')]){if(_0x3f594c[_0x713f('0x10')][_0x713f('0x11')]===0x1f4){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x59874f(_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);}logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x3f594c[_0x713f('0x10')][_0x713f('0x12')]);return _0x2a47f5(_0x3f594c[_0x713f('0x10')]['message']);}else{logger[_0x713f('0xb')](_0x713f('0xc'),_0x57616c,'request\x20sent');_0x2a47f5(_0x3f594c[_0x713f('0x13')][_0x713f('0x12')]);}})[_0x713f('0x14')](function(_0x332b29){logger[_0x713f('0x10')](_0x713f('0xc'),_0x57616c,_0x332b29);_0x59874f(_0x332b29);});});}exports[_0x713f('0x15')]=function(_0x5a4501){var _0x55e850=this;return new Promise(function(_0x1f88ba,_0x49792d){return db[_0x713f('0x16')][_0x713f('0x17')]({'raw':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a4501['options']?_0x5a4501[_0x713f('0x18')][_0x713f('0x19')]||null:null,'attributes':_0x5a4501['options']?_0x5a4501['options']['attributes']||null:null,'limit':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')]['limit']||null:null,'include':_0x5a4501[_0x713f('0x18')]?_0x5a4501[_0x713f('0x18')][_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x5a4501[_0x713f('0x18')][_0x713f('0x1a')],function(_0x314e0c){return{'model':db[_0x314e0c[_0x713f('0x1c')]],'as':_0x314e0c['as'],'attributes':_0x314e0c[_0x713f('0x1d')],'include':_0x314e0c[_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x314e0c[_0x713f('0x1a')],function(_0x232b31){return{'model':db[_0x232b31[_0x713f('0x1c')]],'as':_0x232b31['as'],'attributes':_0x232b31[_0x713f('0x1d')],'include':_0x232b31[_0x713f('0x1a')]?_[_0x713f('0x1b')](_0x232b31['include'],function(_0x222bbd){return{'model':db[_0x222bbd[_0x713f('0x1c')]],'as':_0x222bbd['as'],'attributes':_0x222bbd[_0x713f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x713f('0xa')](function(_0x3b4c74){logger[_0x713f('0xb')](_0x713f('0x15'),_0x5a4501);logger['debug'](_0x713f('0x15'),_0x5a4501,JSON[_0x713f('0x1e')](_0x3b4c74));_0x1f88ba(_0x3b4c74);})[_0x713f('0x14')](function(_0x3da68f){logger['error']('GetMailServerIn',_0x3da68f['message'],_0x5a4501);_0x49792d(_0x55e850[_0x713f('0x10')](0x1f4,_0x3da68f['message']));});});}; \ No newline at end of file +var _0xdb76=['debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x118432,_0x34d34f){var _0x5ad711=function(_0x220467){while(--_0x220467){_0x118432['push'](_0x118432['shift']());}};_0x5ad711(++_0x34d34f);}(_0xdb76,0x1be));var _0x6db7=function(_0x1d823c,_0x18f39b){_0x1d823c=_0x1d823c-0x0;var _0x4b89fe=_0xdb76[_0x1d823c];return _0x4b89fe;};'use strict';var _=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var moment=require(_0x6db7('0x2'));var BPromise=require(_0x6db7('0x3'));var rs=require(_0x6db7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6db7('0x5'))['db'];var utils=require(_0x6db7('0x6'));var logger=require(_0x6db7('0x7'))(_0x6db7('0x8'));var config=require('../../config/environment');var jayson=require(_0x6db7('0x9'));var client=jayson[_0x6db7('0xa')][_0x6db7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x417e71,_0x3b7b8a,_0x58f6e4){return new BPromise(function(_0x1c7f92,_0x3df405){return client['request'](_0x417e71,_0x58f6e4)[_0x6db7('0xc')](function(_0x40735e){logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));logger[_0x6db7('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3b7b8a,'request\x20sent',JSON[_0x6db7('0x11')](_0x40735e));if(_0x40735e[_0x6db7('0x12')]){if(_0x40735e['error'][_0x6db7('0x13')]===0x1f4){logger[_0x6db7('0x12')](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x3df405(_0x40735e[_0x6db7('0x12')]['message']);}logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);return _0x1c7f92(_0x40735e[_0x6db7('0x12')][_0x6db7('0x14')]);}else{logger[_0x6db7('0xd')](_0x6db7('0xe'),_0x3b7b8a,_0x6db7('0xf'));_0x1c7f92(_0x40735e[_0x6db7('0x15')][_0x6db7('0x14')]);}})[_0x6db7('0x16')](function(_0x3ba044){logger['error'](_0x6db7('0xe'),_0x3b7b8a,_0x3ba044);_0x3df405(_0x3ba044);});});}exports[_0x6db7('0x17')]=function(_0x331e92){var _0x53ea04=this;return new Promise(function(_0x37ffe3,_0x272bda){return db[_0x6db7('0x18')][_0x6db7('0x19')]({'raw':_0x331e92[_0x6db7('0x1a')]?_0x331e92[_0x6db7('0x1a')][_0x6db7('0x1b')]===undefined?!![]:![]:!![],'where':_0x331e92[_0x6db7('0x1a')]?_0x331e92['options'][_0x6db7('0x1c')]||null:null,'attributes':_0x331e92[_0x6db7('0x1a')]?_0x331e92[_0x6db7('0x1a')][_0x6db7('0x1d')]||null:null,'limit':_0x331e92[_0x6db7('0x1a')]?_0x331e92[_0x6db7('0x1a')]['limit']||null:null,'include':_0x331e92[_0x6db7('0x1a')]?_0x331e92[_0x6db7('0x1a')]['include']?_[_0x6db7('0x1e')](_0x331e92[_0x6db7('0x1a')][_0x6db7('0x1f')],function(_0x48e3af){return{'model':db[_0x48e3af[_0x6db7('0x20')]],'as':_0x48e3af['as'],'attributes':_0x48e3af[_0x6db7('0x1d')],'include':_0x48e3af['include']?_[_0x6db7('0x1e')](_0x48e3af[_0x6db7('0x1f')],function(_0x2d6fca){return{'model':db[_0x2d6fca['model']],'as':_0x2d6fca['as'],'attributes':_0x2d6fca['attributes'],'include':_0x2d6fca[_0x6db7('0x1f')]?_[_0x6db7('0x1e')](_0x2d6fca[_0x6db7('0x1f')],function(_0x4f28e9){return{'model':db[_0x4f28e9[_0x6db7('0x20')]],'as':_0x4f28e9['as'],'attributes':_0x4f28e9[_0x6db7('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47c090){logger[_0x6db7('0xd')](_0x6db7('0x17'),_0x331e92);logger[_0x6db7('0x10')](_0x6db7('0x17'),_0x331e92,JSON[_0x6db7('0x11')](_0x47c090));_0x37ffe3(_0x47c090);})[_0x6db7('0x16')](function(_0x4fb6dd){logger[_0x6db7('0x12')](_0x6db7('0x17'),_0x4fb6dd['message'],_0x331e92);_0x272bda(_0x53ea04[_0x6db7('0x12')](0x1f4,_0x4fb6dd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4b9f974..7a7ff12 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(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x36cb3b,_0x5b0dfa){_0x36cb3b=_0x36cb3b-0x0;var _0x42030b=_0x7a54[_0x36cb3b];return _0x42030b;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 30216e5..8c4bf3d 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 _0xefda=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x565e7f,_0x578a80){var _0xddc092=function(_0x1a4150){while(--_0x1a4150){_0x565e7f['push'](_0x565e7f['shift']());}};_0xddc092(++_0x578a80);}(_0xefda,0x96));var _0xaefd=function(_0x61c0b1,_0x4c07f3){_0x61c0b1=_0x61c0b1-0x0;var _0x5f2d2e=_0xefda[_0x61c0b1];return _0x5f2d2e;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xaefd('0x1')]},'user':{'type':Sequelize[_0xaefd('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaefd('0x2')]},'secure':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xaefd('0x1')]},'authentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd4f4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x20fdfc,_0xbc387d){var _0x5080ef=function(_0x163854){while(--_0x163854){_0x20fdfc['push'](_0x20fdfc['shift']());}};_0x5080ef(++_0xbc387d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x55f2cf,_0x495a00){_0x55f2cf=_0x55f2cf-0x0;var _0x132f82=_0xd4f4[_0x55f2cf];return _0x132f82;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'description':{'type':Sequelize[_0x4d4f('0x2')]},'host':{'type':Sequelize[_0x4d4f('0x2')]},'user':{'type':Sequelize[_0x4d4f('0x2')]},'pass':{'type':Sequelize[_0x4d4f('0x2')]},'port':{'type':Sequelize[_0x4d4f('0x3')]},'secure':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4d4f('0x2')]},'authentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index e56e4f6..8a2eade 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 _0x3587=['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','sendStatus','status','end','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','options','count','include','rows','catch','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv'];(function(_0x55c5ec,_0x4201a2){var _0x4bd315=function(_0x56b7f4){while(--_0x56b7f4){_0x55c5ec['push'](_0x55c5ec['shift']());}};_0x4bd315(++_0x4201a2);}(_0x3587,0x18f));var _0x7358=function(_0x38abee,_0x31a234){_0x38abee=_0x38abee-0x0;var _0x29a72f=_0x3587[_0x38abee];return _0x29a72f;};'use strict';var emlformat=require(_0x7358('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7358('0x1'));var jsonpatch=require(_0x7358('0x2'));var rp=require(_0x7358('0x3'));var moment=require(_0x7358('0x4'));var BPromise=require(_0x7358('0x5'));var Mustache=require(_0x7358('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7358('0x7'));var csv=require(_0x7358('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7358('0x9'));var squel=require(_0x7358('0xa'));var crypto=require(_0x7358('0xb'));var jsforce=require(_0x7358('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7358('0xd'));var Papa=require(_0x7358('0xe'));var Redis=require(_0x7358('0xf'));var authService=require(_0x7358('0x10'));var qs=require(_0x7358('0x11'));var as=require(_0x7358('0x12'));var hardwareService=require(_0x7358('0x13'));var logger=require(_0x7358('0x14'))(_0x7358('0x15'));var utils=require(_0x7358('0x16'));var config=require(_0x7358('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe81388,_0xba9984){_0xba9984=_0xba9984||0xcc;return function(_0x2d48e8){if(_0x2d48e8){return _0xe81388[_0x7358('0x18')](_0xba9984);}return _0xe81388[_0x7358('0x19')](_0xba9984)[_0x7358('0x1a')]();};}function respondWithResult(_0x3bbf43,_0xdae4b9){_0xdae4b9=_0xdae4b9||0xc8;return function(_0x506667){if(_0x506667){return _0x3bbf43[_0x7358('0x19')](_0xdae4b9)['json'](_0x506667);}};}function respondWithFilteredResult(_0x11a076,_0x5b8463){return function(_0x4ad6a7){if(_0x4ad6a7){var _0x51d5b1=typeof _0x5b8463[_0x7358('0x1b')]==='undefined'&&typeof _0x5b8463[_0x7358('0x1c')]==='undefined';var _0x2d20b3=_0x4ad6a7['count'];var _0xaf6513=_0x51d5b1?0x0:_0x5b8463[_0x7358('0x1b')];var _0x204659=_0x51d5b1?_0x4ad6a7['count']:_0x5b8463[_0x7358('0x1b')]+_0x5b8463[_0x7358('0x1c')];var _0x396c81;if(_0x204659>=_0x2d20b3){_0x204659=_0x2d20b3;_0x396c81=0xc8;}else{_0x396c81=0xce;}_0x11a076[_0x7358('0x19')](_0x396c81);return _0x11a076[_0x7358('0x1d')](_0x7358('0x1e'),_0xaf6513+'-'+_0x204659+'/'+_0x2d20b3)['json'](_0x4ad6a7);}return null;};}function patchUpdates(_0x30042b){return function(_0x340949){try{jsonpatch[_0x7358('0x1f')](_0x340949,_0x30042b,!![]);}catch(_0x52a9b3){return BPromise['reject'](_0x52a9b3);}return _0x340949['save']();};}function saveUpdates(_0x531ac9,_0x27651e){return function(_0x505200){if(_0x505200){return _0x505200[_0x7358('0x20')](_0x531ac9)[_0x7358('0x21')](function(_0x4808f3){return _0x4808f3;});}return null;};}function removeEntity(_0xb7e325,_0x705e9b){return function(_0x3ad173){if(_0x3ad173){return _0x3ad173[_0x7358('0x22')]()[_0x7358('0x21')](function(){_0xb7e325['status'](0xcc)[_0x7358('0x1a')]();});}};}function handleEntityNotFound(_0x5b46fa,_0x467b01){return function(_0x423cd6){if(!_0x423cd6){_0x5b46fa['sendStatus'](0x194);}return _0x423cd6;};}function handleError(_0x4df157,_0xec30e4){_0xec30e4=_0xec30e4||0x1f4;return function(_0xa2bf76){logger[_0x7358('0x23')](_0xa2bf76[_0x7358('0x24')]);if(_0xa2bf76['name']){delete _0xa2bf76[_0x7358('0x25')];}_0x4df157['status'](_0xec30e4)[_0x7358('0x26')](_0xa2bf76);};}exports[_0x7358('0x27')]=function(_0x3859c7,_0x12b5f3){var _0x15a4c6={},_0x3f8873={},_0x3e9295={'count':0x0,'rows':[]};var _0x3191bc=_[_0x7358('0x28')](db[_0x7358('0x29')][_0x7358('0x2a')],function(_0x3f1f74){return{'name':_0x3f1f74[_0x7358('0x2b')],'type':_0x3f1f74['type'][_0x7358('0x2c')]};});_0x3f8873[_0x7358('0x2d')]=_[_0x7358('0x28')](_0x3191bc,_0x7358('0x25'));_0x3f8873[_0x7358('0x2e')]=_[_0x7358('0x2f')](_0x3859c7[_0x7358('0x2e')]);_0x3f8873[_0x7358('0x30')]=_[_0x7358('0x31')](_0x3f8873['model'],_0x3f8873[_0x7358('0x2e')]);_0x15a4c6['attributes']=_['intersection'](_0x3f8873[_0x7358('0x2d')],qs['fields'](_0x3859c7['query'][_0x7358('0x32')]));_0x15a4c6[_0x7358('0x33')]=_0x15a4c6[_0x7358('0x33')][_0x7358('0x34')]?_0x15a4c6['attributes']:_0x3f8873[_0x7358('0x2d')];if(!_0x3859c7[_0x7358('0x2e')]['hasOwnProperty'](_0x7358('0x35'))){_0x15a4c6['limit']=qs[_0x7358('0x1c')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x1c')]);_0x15a4c6['offset']=qs[_0x7358('0x1b')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x1b')]);}_0x15a4c6['order']=qs[_0x7358('0x36')](_0x3859c7[_0x7358('0x2e')][_0x7358('0x36')]);_0x15a4c6[_0x7358('0x37')]=qs['filters'](_[_0x7358('0x38')](_0x3859c7[_0x7358('0x2e')],_0x3f8873[_0x7358('0x30')]),_0x3191bc);if(_0x3859c7[_0x7358('0x2e')][_0x7358('0x39')]){_0x15a4c6[_0x7358('0x37')]=_[_0x7358('0x3a')](_0x15a4c6[_0x7358('0x37')],{'$or':_[_0x7358('0x28')](_0x3191bc,function(_0x3262fb){if(_0x3262fb['type']!=='VIRTUAL'){var _0x2a76d8={};_0x2a76d8[_0x3262fb[_0x7358('0x25')]]={'$like':'%'+_0x3859c7[_0x7358('0x2e')][_0x7358('0x39')]+'%'};return _0x2a76d8;}})});}_0x15a4c6=_['merge']({},_0x15a4c6,_0x3859c7[_0x7358('0x3b')]);var _0x37c0d4={'where':_0x15a4c6[_0x7358('0x37')]};return db[_0x7358('0x29')][_0x7358('0x3c')](_0x37c0d4)['then'](function(_0x554d3f){_0x3e9295[_0x7358('0x3c')]=_0x554d3f;if(_0x3859c7[_0x7358('0x2e')]['includeAll']){_0x15a4c6[_0x7358('0x3d')]=[{'all':!![]}];}return db[_0x7358('0x29')]['findAll'](_0x15a4c6);})['then'](function(_0x280ba7){_0x3e9295[_0x7358('0x3e')]=_0x280ba7;return _0x3e9295;})[_0x7358('0x21')](respondWithFilteredResult(_0x12b5f3,_0x15a4c6))[_0x7358('0x3f')](handleError(_0x12b5f3,null));};exports['show']=function(_0x5172f7,_0x4e21d3){var _0x1d24ab={'raw':!![],'where':{'id':_0x5172f7['params']['id']}},_0x5b57ef={};_0x5b57ef[_0x7358('0x2d')]=_[_0x7358('0x2f')](db[_0x7358('0x29')][_0x7358('0x2a')]);_0x5b57ef[_0x7358('0x2e')]=_[_0x7358('0x2f')](_0x5172f7['query']);_0x5b57ef[_0x7358('0x30')]=_['intersection'](_0x5b57ef[_0x7358('0x2d')],_0x5b57ef[_0x7358('0x2e')]);_0x1d24ab[_0x7358('0x33')]=_[_0x7358('0x31')](_0x5b57ef[_0x7358('0x2d')],qs['fields'](_0x5172f7[_0x7358('0x2e')][_0x7358('0x32')]));_0x1d24ab[_0x7358('0x33')]=_0x1d24ab[_0x7358('0x33')][_0x7358('0x34')]?_0x1d24ab[_0x7358('0x33')]:_0x5b57ef['model'];if(_0x5172f7[_0x7358('0x2e')][_0x7358('0x40')]){_0x1d24ab[_0x7358('0x3d')]=[{'all':!![]}];}_0x1d24ab=_[_0x7358('0x3a')]({},_0x1d24ab,_0x5172f7[_0x7358('0x3b')]);return db['MailServerOut'][_0x7358('0x41')](_0x1d24ab)[_0x7358('0x21')](handleEntityNotFound(_0x4e21d3,null))[_0x7358('0x21')](respondWithResult(_0x4e21d3,null))[_0x7358('0x3f')](handleError(_0x4e21d3,null));};exports[_0x7358('0x42')]=function(_0x41597b,_0x2d532e){return db[_0x7358('0x29')][_0x7358('0x42')](_0x41597b[_0x7358('0x43')],{})['then'](respondWithResult(_0x2d532e,0xc9))[_0x7358('0x3f')](handleError(_0x2d532e,null));};exports[_0x7358('0x20')]=function(_0x3b7f79,_0x1fba35){if(_0x3b7f79[_0x7358('0x43')]['id']){delete _0x3b7f79[_0x7358('0x43')]['id'];}return db[_0x7358('0x29')]['find']({'where':{'id':_0x3b7f79['params']['id']}})['then'](handleEntityNotFound(_0x1fba35,null))['then'](saveUpdates(_0x3b7f79[_0x7358('0x43')],null))['then'](respondWithResult(_0x1fba35,null))[_0x7358('0x3f')](handleError(_0x1fba35,null));};exports[_0x7358('0x22')]=function(_0x4ae1ac,_0x53c5c8){return db[_0x7358('0x29')][_0x7358('0x41')]({'where':{'id':_0x4ae1ac['params']['id']}})[_0x7358('0x21')](handleEntityNotFound(_0x53c5c8,null))['then'](removeEntity(_0x53c5c8,null))['catch'](handleError(_0x53c5c8,null));}; \ No newline at end of file +var _0x8766=['keys','filters','model','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','then','destroy','error','stack','name','send','map','MailServerOut','type','key','query'];(function(_0x3f109a,_0x249aa9){var _0x2fc2cf=function(_0x1fb17f){while(--_0x1fb17f){_0x3f109a['push'](_0x3f109a['shift']());}};_0x2fc2cf(++_0x249aa9);}(_0x8766,0x17d));var _0x6876=function(_0x4a673b,_0xd7824){_0x4a673b=_0x4a673b-0x0;var _0x5e9f53=_0x8766[_0x4a673b];return _0x5e9f53;};'use strict';var emlformat=require(_0x6876('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6876('0x1'));var jsonpatch=require(_0x6876('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6876('0x3'));var Mustache=require(_0x6876('0x4'));var util=require(_0x6876('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6876('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6876('0x7'));var _=require(_0x6876('0x8'));var squel=require(_0x6876('0x9'));var crypto=require(_0x6876('0xa'));var jsforce=require(_0x6876('0xb'));var deskjs=require(_0x6876('0xc'));var toCsv=require(_0x6876('0x6'));var querystring=require('querystring');var Papa=require(_0x6876('0xd'));var Redis=require(_0x6876('0xe'));var authService=require(_0x6876('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6876('0x10'));var hardwareService=require(_0x6876('0x11'));var logger=require(_0x6876('0x12'))(_0x6876('0x13'));var utils=require(_0x6876('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6876('0x15'));var db=require(_0x6876('0x16'))['db'];function respondWithStatusCode(_0x429c0b,_0x2b8f0e){_0x2b8f0e=_0x2b8f0e||0xcc;return function(_0x220d43){if(_0x220d43){return _0x429c0b[_0x6876('0x17')](_0x2b8f0e);}return _0x429c0b['status'](_0x2b8f0e)[_0x6876('0x18')]();};}function respondWithResult(_0x53355,_0x444fb6){_0x444fb6=_0x444fb6||0xc8;return function(_0xf0605b){if(_0xf0605b){return _0x53355['status'](_0x444fb6)[_0x6876('0x19')](_0xf0605b);}};}function respondWithFilteredResult(_0xbdf210,_0x4b2baa){return function(_0x371ffd){if(_0x371ffd){var _0x517a64=typeof _0x4b2baa[_0x6876('0x1a')]===_0x6876('0x1b')&&typeof _0x4b2baa['limit']==='undefined';var _0x3d419a=_0x371ffd[_0x6876('0x1c')];var _0x4fea40=_0x517a64?0x0:_0x4b2baa[_0x6876('0x1a')];var _0x20fa31=_0x517a64?_0x371ffd[_0x6876('0x1c')]:_0x4b2baa[_0x6876('0x1a')]+_0x4b2baa[_0x6876('0x1d')];var _0x3b805a;if(_0x20fa31>=_0x3d419a){_0x20fa31=_0x3d419a;_0x3b805a=0xc8;}else{_0x3b805a=0xce;}_0xbdf210[_0x6876('0x1e')](_0x3b805a);return _0xbdf210[_0x6876('0x1f')]('Content-Range',_0x4fea40+'-'+_0x20fa31+'/'+_0x3d419a)[_0x6876('0x19')](_0x371ffd);}return null;};}function patchUpdates(_0x50f660){return function(_0x16301e){try{jsonpatch[_0x6876('0x20')](_0x16301e,_0x50f660,!![]);}catch(_0x2524b6){return BPromise[_0x6876('0x21')](_0x2524b6);}return _0x16301e['save']();};}function saveUpdates(_0x32c75a,_0x13dd20){return function(_0x32c8ca){if(_0x32c8ca){return _0x32c8ca['update'](_0x32c75a)[_0x6876('0x22')](function(_0x4ef95d){return _0x4ef95d;});}return null;};}function removeEntity(_0x4e9c20,_0x36ca91){return function(_0x24cb44){if(_0x24cb44){return _0x24cb44[_0x6876('0x23')]()[_0x6876('0x22')](function(){_0x4e9c20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x32e178,_0x287e2e){return function(_0x1456c0){if(!_0x1456c0){_0x32e178[_0x6876('0x17')](0x194);}return _0x1456c0;};}function handleError(_0x42a09e,_0x36b9a6){_0x36b9a6=_0x36b9a6||0x1f4;return function(_0x517833){logger[_0x6876('0x24')](_0x517833[_0x6876('0x25')]);if(_0x517833[_0x6876('0x26')]){delete _0x517833[_0x6876('0x26')];}_0x42a09e[_0x6876('0x1e')](_0x36b9a6)[_0x6876('0x27')](_0x517833);};}exports['index']=function(_0x4909a4,_0x1ae91a){var _0x5791ac={},_0x5df422={},_0xec8782={'count':0x0,'rows':[]};var _0x23d53f=_[_0x6876('0x28')](db[_0x6876('0x29')]['rawAttributes'],function(_0x14d7bb){return{'name':_0x14d7bb['fieldName'],'type':_0x14d7bb[_0x6876('0x2a')][_0x6876('0x2b')]};});_0x5df422['model']=_['map'](_0x23d53f,'name');_0x5df422[_0x6876('0x2c')]=_[_0x6876('0x2d')](_0x4909a4[_0x6876('0x2c')]);_0x5df422[_0x6876('0x2e')]=_['intersection'](_0x5df422[_0x6876('0x2f')],_0x5df422[_0x6876('0x2c')]);_0x5791ac['attributes']=_[_0x6876('0x30')](_0x5df422[_0x6876('0x2f')],qs['fields'](_0x4909a4[_0x6876('0x2c')]['fields']));_0x5791ac[_0x6876('0x31')]=_0x5791ac[_0x6876('0x31')][_0x6876('0x32')]?_0x5791ac[_0x6876('0x31')]:_0x5df422[_0x6876('0x2f')];if(!_0x4909a4['query'][_0x6876('0x33')](_0x6876('0x34'))){_0x5791ac['limit']=qs[_0x6876('0x1d')](_0x4909a4['query'][_0x6876('0x1d')]);_0x5791ac[_0x6876('0x1a')]=qs[_0x6876('0x1a')](_0x4909a4['query'][_0x6876('0x1a')]);}_0x5791ac['order']=qs['sort'](_0x4909a4[_0x6876('0x2c')][_0x6876('0x35')]);_0x5791ac['where']=qs[_0x6876('0x2e')](_[_0x6876('0x36')](_0x4909a4[_0x6876('0x2c')],_0x5df422['filters']),_0x23d53f);if(_0x4909a4[_0x6876('0x2c')]['filter']){_0x5791ac[_0x6876('0x37')]=_[_0x6876('0x38')](_0x5791ac[_0x6876('0x37')],{'$or':_[_0x6876('0x28')](_0x23d53f,function(_0x5ed832){if(_0x5ed832[_0x6876('0x2a')]!==_0x6876('0x39')){var _0x1ae75e={};_0x1ae75e[_0x5ed832[_0x6876('0x26')]]={'$like':'%'+_0x4909a4['query'][_0x6876('0x3a')]+'%'};return _0x1ae75e;}})});}_0x5791ac=_[_0x6876('0x38')]({},_0x5791ac,_0x4909a4[_0x6876('0x3b')]);var _0x4bf02b={'where':_0x5791ac[_0x6876('0x37')]};return db[_0x6876('0x29')][_0x6876('0x1c')](_0x4bf02b)[_0x6876('0x22')](function(_0x3f5865){_0xec8782[_0x6876('0x1c')]=_0x3f5865;if(_0x4909a4[_0x6876('0x2c')][_0x6876('0x3c')]){_0x5791ac[_0x6876('0x3d')]=[{'all':!![]}];}return db[_0x6876('0x29')][_0x6876('0x3e')](_0x5791ac);})[_0x6876('0x22')](function(_0x548401){_0xec8782[_0x6876('0x3f')]=_0x548401;return _0xec8782;})[_0x6876('0x22')](respondWithFilteredResult(_0x1ae91a,_0x5791ac))[_0x6876('0x40')](handleError(_0x1ae91a,null));};exports[_0x6876('0x41')]=function(_0x47cbde,_0x495554){var _0x4f0f2a={'raw':!![],'where':{'id':_0x47cbde[_0x6876('0x42')]['id']}},_0xc842f4={};_0xc842f4[_0x6876('0x2f')]=_[_0x6876('0x2d')](db['MailServerOut'][_0x6876('0x43')]);_0xc842f4[_0x6876('0x2c')]=_[_0x6876('0x2d')](_0x47cbde['query']);_0xc842f4[_0x6876('0x2e')]=_[_0x6876('0x30')](_0xc842f4[_0x6876('0x2f')],_0xc842f4['query']);_0x4f0f2a[_0x6876('0x31')]=_[_0x6876('0x30')](_0xc842f4[_0x6876('0x2f')],qs['fields'](_0x47cbde[_0x6876('0x2c')]['fields']));_0x4f0f2a['attributes']=_0x4f0f2a[_0x6876('0x31')][_0x6876('0x32')]?_0x4f0f2a['attributes']:_0xc842f4['model'];if(_0x47cbde[_0x6876('0x2c')]['includeAll']){_0x4f0f2a[_0x6876('0x3d')]=[{'all':!![]}];}_0x4f0f2a=_[_0x6876('0x38')]({},_0x4f0f2a,_0x47cbde[_0x6876('0x3b')]);return db['MailServerOut'][_0x6876('0x44')](_0x4f0f2a)['then'](handleEntityNotFound(_0x495554,null))[_0x6876('0x22')](respondWithResult(_0x495554,null))['catch'](handleError(_0x495554,null));};exports[_0x6876('0x45')]=function(_0x31d418,_0x2e56df){return db[_0x6876('0x29')][_0x6876('0x45')](_0x31d418[_0x6876('0x46')],{})['then'](respondWithResult(_0x2e56df,0xc9))[_0x6876('0x40')](handleError(_0x2e56df,null));};exports['update']=function(_0x42f132,_0x172f88){if(_0x42f132[_0x6876('0x46')]['id']){delete _0x42f132[_0x6876('0x46')]['id'];}return db[_0x6876('0x29')]['find']({'where':{'id':_0x42f132[_0x6876('0x42')]['id']}})[_0x6876('0x22')](handleEntityNotFound(_0x172f88,null))[_0x6876('0x22')](saveUpdates(_0x42f132['body'],null))[_0x6876('0x22')](respondWithResult(_0x172f88,null))[_0x6876('0x40')](handleError(_0x172f88,null));};exports[_0x6876('0x23')]=function(_0x3fc629,_0x1f2646){return db[_0x6876('0x29')][_0x6876('0x44')]({'where':{'id':_0x3fc629[_0x6876('0x42')]['id']}})[_0x6876('0x22')](handleEntityNotFound(_0x1f2646,null))[_0x6876('0x22')](removeEntity(_0x1f2646,null))[_0x6876('0x40')](handleError(_0x1f2646,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 19b5481..5e8a60a 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 _0x16f5=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment'];(function(_0x20dd22,_0x491e7a){var _0x302cf5=function(_0x16b88c){while(--_0x16b88c){_0x20dd22['push'](_0x20dd22['shift']());}};_0x302cf5(++_0x491e7a);}(_0x16f5,0x15c));var _0x516f=function(_0x7bdd91,_0x169181){_0x7bdd91=_0x7bdd91-0x0;var _0x358271=_0x16f5[_0x7bdd91];return _0x358271;};'use strict';var _=require('lodash');var util=require(_0x516f('0x0'));var logger=require(_0x516f('0x1'))(_0x516f('0x2'));var moment=require(_0x516f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x516f('0x4'));var config=require(_0x516f('0x5'));var attributes=require(_0x516f('0x6'));module[_0x516f('0x7')]=function(_0x40e794,_0x22b806){return _0x40e794[_0x516f('0x8')](_0x516f('0x9'),attributes,{'tableName':_0x516f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70a1=['request-promise','path','./mailServerOut.attributes','define','MailServerOut','lodash','util','api','bluebird'];(function(_0x2f6404,_0x454760){var _0x44f797=function(_0x286d80){while(--_0x286d80){_0x2f6404['push'](_0x2f6404['shift']());}};_0x44f797(++_0x454760);}(_0x70a1,0xd4));var _0x170a=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x70a1[_0x31b5a5];return _0x364cc9;};'use strict';var _=require(_0x170a('0x0'));var util=require(_0x170a('0x1'));var logger=require('../../config/logger')(_0x170a('0x2'));var moment=require('moment');var BPromise=require(_0x170a('0x3'));var rp=require(_0x170a('0x4'));var fs=require('fs');var path=require(_0x170a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x170a('0x6'));module['exports']=function(_0x568277,_0x13522a){return _0x568277[_0x170a('0x7')](_0x170a('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 662de92..adfd0a2 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x246cbe,_0x19305c){var _0x855b0=function(_0x2c8d0d){while(--_0x2c8d0d){_0x246cbe['push'](_0x246cbe['shift']());}};_0x855b0(++_0x19305c);}(_0xadb5,0xad));var _0x5adb=function(_0x501d40,_0x4156ef){_0x501d40=_0x501d40-0x0;var _0x3dc9ed=_0xadb5[_0x501d40];return _0x3dc9ed;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3e7096,_0x405f40){var _0x147dbd=function(_0x5f3918){while(--_0x5f3918){_0x3e7096['push'](_0x3e7096['shift']());}};_0x147dbd(++_0x405f40);}(_0x5f2f,0x73));var _0xf5f2=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x5f2f[_0x279755];return _0x138178;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9966cb3..e7986bb 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 _0xc5c2=['/:id','show','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','isAuthenticated','index','get','describe'];(function(_0x569ca0,_0x27c381){var _0x2632f8=function(_0x183fb5){while(--_0x183fb5){_0x569ca0['push'](_0x569ca0['shift']());}};_0x2632f8(++_0x27c381);}(_0xc5c2,0xcc));var _0x2c5c=function(_0x1849ee,_0x525832){_0x1849ee=_0x1849ee-0x0;var _0x70f29=_0xc5c2[_0x1849ee];return _0x70f29;};'use strict';var multer=require(_0x2c5c('0x0'));var util=require('util');var path=require(_0x2c5c('0x1'));var timeout=require(_0x2c5c('0x2'));var express=require(_0x2c5c('0x3'));var router=express[_0x2c5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2c5c('0x5'));var interaction=require(_0x2c5c('0x6'));var config=require('../../config/environment');var controller=require(_0x2c5c('0x7'));router['get']('/',auth[_0x2c5c('0x8')](),controller[_0x2c5c('0x9')]);router[_0x2c5c('0xa')]('/describe',auth[_0x2c5c('0x8')](),controller[_0x2c5c('0xb')]);router['get'](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller[_0x2c5c('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2c5c('0xe')]);router[_0x2c5c('0xf')](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller['update']);router[_0x2c5c('0x10')](_0x2c5c('0xc'),auth[_0x2c5c('0x8')](),controller['destroy']);module[_0x2c5c('0x11')]=router; \ No newline at end of file +var _0xece0=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0x1e642d,_0x2a77f6){var _0x188a34=function(_0x1f5027){while(--_0x1f5027){_0x1e642d['push'](_0x1e642d['shift']());}};_0x188a34(++_0x2a77f6);}(_0xece0,0x17d));var _0x0ece=function(_0x10a1d3,_0x1f70d3){_0x10a1d3=_0x10a1d3-0x0;var _0x33102f=_0xece0[_0x10a1d3];return _0x33102f;};'use strict';var multer=require(_0x0ece('0x0'));var util=require(_0x0ece('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ece('0x2'));var router=express[_0x0ece('0x3')]();var fs_extra=require(_0x0ece('0x4'));var auth=require(_0x0ece('0x5'));var interaction=require(_0x0ece('0x6'));var config=require(_0x0ece('0x7'));var controller=require(_0x0ece('0x8'));router[_0x0ece('0x9')]('/',auth[_0x0ece('0xa')](),controller['index']);router[_0x0ece('0x9')](_0x0ece('0xb'),auth[_0x0ece('0xa')](),controller['describe']);router[_0x0ece('0x9')](_0x0ece('0xc'),auth['isAuthenticated'](),controller[_0x0ece('0xd')]);router[_0x0ece('0xe')]('/',auth[_0x0ece('0xa')](),controller[_0x0ece('0xf')]);router[_0x0ece('0x10')](_0x0ece('0xc'),auth[_0x0ece('0xa')](),controller['update']);router[_0x0ece('0x11')](_0x0ece('0xc'),auth[_0x0ece('0xa')](),controller[_0x0ece('0x12')]);module[_0x0ece('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2b3aff5..42850b6 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 _0x1db9=['STRING','name','sequelize','exports'];(function(_0x56756e,_0x478df4){var _0x12cd24=function(_0xd2db9c){while(--_0xd2db9c){_0x56756e['push'](_0x56756e['shift']());}};_0x12cd24(++_0x478df4);}(_0x1db9,0x176));var _0x91db=function(_0x12dd8d,_0xe2cd59){_0x12dd8d=_0x12dd8d-0x0;var _0x545002=_0x1db9[_0x12dd8d];return _0x545002;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file +var _0x0af5=['STRING','name','exports'];(function(_0x3dd8dd,_0x369f8e){var _0x33e300=function(_0xf1a7db){while(--_0xf1a7db){_0x3dd8dd['push'](_0x3dd8dd['shift']());}};_0x33e300(++_0x369f8e);}(_0x0af5,0x158));var _0x50af=function(_0x38bf1b,_0x40f574){_0x38bf1b=_0x38bf1b-0x0;var _0xffd8a2=_0x0af5[_0x38bf1b];return _0xffd8a2;};'use strict';var Sequelize=require('sequelize');module[_0x50af('0x0')]={'name':{'type':Sequelize[_0x50af('0x1')],'unique':_0x50af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x50af('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f4ed121..5def0e2 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 _0xb8a9=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','keys','find','create','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x57ee31,_0xc815a){var _0x404381=function(_0x59da65){while(--_0x59da65){_0x57ee31['push'](_0x57ee31['shift']());}};_0x404381(++_0xc815a);}(_0xb8a9,0x77));var _0x9b8a=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0xb8a9[_0x1b6311];return _0x25aab6;};'use strict';var emlformat=require(_0x9b8a('0x0'));var rimraf=require(_0x9b8a('0x1'));var zipdir=require(_0x9b8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b8a('0x3'));var moment=require(_0x9b8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b8a('0x5'));var util=require('util');var path=require(_0x9b8a('0x6'));var sox=require(_0x9b8a('0x7'));var csv=require(_0x9b8a('0x8'));var ejs=require(_0x9b8a('0x9'));var fs=require('fs');var fs_extra=require(_0x9b8a('0xa'));var _=require(_0x9b8a('0xb'));var squel=require(_0x9b8a('0xc'));var crypto=require(_0x9b8a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9b8a('0xe'));var toCsv=require(_0x9b8a('0x8'));var querystring=require('querystring');var Papa=require(_0x9b8a('0xf'));var Redis=require('ioredis');var authService=require(_0x9b8a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b8a('0x11'));var logger=require(_0x9b8a('0x12'))(_0x9b8a('0x13'));var utils=require('../../config/utils');var config=require(_0x9b8a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b8a('0x15'))['db'];function respondWithStatusCode(_0x3defc9,_0x34d648){_0x34d648=_0x34d648||0xcc;return function(_0x2c2bf3){if(_0x2c2bf3){return _0x3defc9[_0x9b8a('0x16')](_0x34d648);}return _0x3defc9[_0x9b8a('0x17')](_0x34d648)[_0x9b8a('0x18')]();};}function respondWithResult(_0x48d2d6,_0x3c5452){_0x3c5452=_0x3c5452||0xc8;return function(_0x2a4637){if(_0x2a4637){return _0x48d2d6['status'](_0x3c5452)[_0x9b8a('0x19')](_0x2a4637);}};}function respondWithFilteredResult(_0x39008b,_0x48725a){return function(_0xc4fc7d){if(_0xc4fc7d){var _0x44be33=typeof _0x48725a[_0x9b8a('0x1a')]===_0x9b8a('0x1b')&&typeof _0x48725a[_0x9b8a('0x1c')]===_0x9b8a('0x1b');var _0x318d89=_0xc4fc7d[_0x9b8a('0x1d')];var _0x522a05=_0x44be33?0x0:_0x48725a[_0x9b8a('0x1a')];var _0x5ce01c=_0x44be33?_0xc4fc7d['count']:_0x48725a[_0x9b8a('0x1a')]+_0x48725a[_0x9b8a('0x1c')];var _0x202cf1;if(_0x5ce01c>=_0x318d89){_0x5ce01c=_0x318d89;_0x202cf1=0xc8;}else{_0x202cf1=0xce;}_0x39008b[_0x9b8a('0x17')](_0x202cf1);return _0x39008b['set'](_0x9b8a('0x1e'),_0x522a05+'-'+_0x5ce01c+'/'+_0x318d89)[_0x9b8a('0x19')](_0xc4fc7d);}return null;};}function patchUpdates(_0x297e4c){return function(_0x276614){try{jsonpatch[_0x9b8a('0x1f')](_0x276614,_0x297e4c,!![]);}catch(_0x1d7d87){return BPromise[_0x9b8a('0x20')](_0x1d7d87);}return _0x276614[_0x9b8a('0x21')]();};}function saveUpdates(_0x5e7856,_0x59529e){return function(_0x2adfd4){if(_0x2adfd4){return _0x2adfd4['update'](_0x5e7856)[_0x9b8a('0x22')](function(_0xc3475c){return _0xc3475c;});}return null;};}function removeEntity(_0x352aa3,_0x2d4c9a){return function(_0xbd7f4a){if(_0xbd7f4a){return _0xbd7f4a[_0x9b8a('0x23')]()[_0x9b8a('0x22')](function(){_0x352aa3[_0x9b8a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bef2d,_0x386aff){return function(_0x3ced29){if(!_0x3ced29){_0x3bef2d['sendStatus'](0x194);}return _0x3ced29;};}function handleError(_0x153fc4,_0x2e941e){_0x2e941e=_0x2e941e||0x1f4;return function(_0x5139a9){logger[_0x9b8a('0x24')](_0x5139a9[_0x9b8a('0x25')]);if(_0x5139a9[_0x9b8a('0x26')]){delete _0x5139a9[_0x9b8a('0x26')];}_0x153fc4['status'](_0x2e941e)[_0x9b8a('0x27')](_0x5139a9);};}exports[_0x9b8a('0x28')]=function(_0x3e5ea0,_0xcd84d2){var _0x407286={},_0x2c72e8={},_0x1d4f2b={'count':0x0,'rows':[]};var _0x22037c=_[_0x9b8a('0x29')](db[_0x9b8a('0x2a')][_0x9b8a('0x2b')],function(_0x18a8cf){return{'name':_0x18a8cf[_0x9b8a('0x2c')],'type':_0x18a8cf[_0x9b8a('0x2d')][_0x9b8a('0x2e')]};});_0x2c72e8['model']=_['map'](_0x22037c,_0x9b8a('0x26'));_0x2c72e8[_0x9b8a('0x2f')]=_['keys'](_0x3e5ea0[_0x9b8a('0x2f')]);_0x2c72e8[_0x9b8a('0x30')]=_['intersection'](_0x2c72e8[_0x9b8a('0x31')],_0x2c72e8['query']);_0x407286[_0x9b8a('0x32')]=_[_0x9b8a('0x33')](_0x2c72e8['model'],qs[_0x9b8a('0x34')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x34')]));_0x407286[_0x9b8a('0x32')]=_0x407286[_0x9b8a('0x32')]['length']?_0x407286[_0x9b8a('0x32')]:_0x2c72e8[_0x9b8a('0x31')];if(!_0x3e5ea0['query'][_0x9b8a('0x35')]('nolimit')){_0x407286['limit']=qs[_0x9b8a('0x1c')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x1c')]);_0x407286[_0x9b8a('0x1a')]=qs[_0x9b8a('0x1a')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x1a')]);}_0x407286['order']=qs[_0x9b8a('0x36')](_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x36')]);_0x407286[_0x9b8a('0x37')]=qs[_0x9b8a('0x30')](_[_0x9b8a('0x38')](_0x3e5ea0['query'],_0x2c72e8[_0x9b8a('0x30')]),_0x22037c);if(_0x3e5ea0[_0x9b8a('0x2f')]['filter']){_0x407286[_0x9b8a('0x37')]=_['merge'](_0x407286['where'],{'$or':_[_0x9b8a('0x29')](_0x22037c,function(_0x156c12){if(_0x156c12[_0x9b8a('0x2d')]!==_0x9b8a('0x39')){var _0x265fc6={};_0x265fc6[_0x156c12[_0x9b8a('0x26')]]={'$like':'%'+_0x3e5ea0[_0x9b8a('0x2f')][_0x9b8a('0x3a')]+'%'};return _0x265fc6;}})});}_0x407286=_[_0x9b8a('0x3b')]({},_0x407286,_0x3e5ea0[_0x9b8a('0x3c')]);var _0x281f9f={'where':_0x407286[_0x9b8a('0x37')]};return db[_0x9b8a('0x2a')][_0x9b8a('0x1d')](_0x281f9f)['then'](function(_0x2f2ff9){_0x1d4f2b[_0x9b8a('0x1d')]=_0x2f2ff9;if(_0x3e5ea0['query'][_0x9b8a('0x3d')]){_0x407286[_0x9b8a('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9b8a('0x3f')](_0x407286);})[_0x9b8a('0x22')](function(_0x455f6f){_0x1d4f2b['rows']=_0x455f6f;return _0x1d4f2b;})[_0x9b8a('0x22')](respondWithFilteredResult(_0xcd84d2,_0x407286))[_0x9b8a('0x40')](handleError(_0xcd84d2,null));};exports[_0x9b8a('0x41')]=function(_0x5acb1e,_0xe687c8){var _0xbc71f3={'raw':!![],'where':{'id':_0x5acb1e['params']['id']}},_0xeff6bb={};_0xeff6bb[_0x9b8a('0x31')]=_[_0x9b8a('0x42')](db[_0x9b8a('0x2a')][_0x9b8a('0x2b')]);_0xeff6bb[_0x9b8a('0x2f')]=_[_0x9b8a('0x42')](_0x5acb1e[_0x9b8a('0x2f')]);_0xeff6bb['filters']=_[_0x9b8a('0x33')](_0xeff6bb[_0x9b8a('0x31')],_0xeff6bb['query']);_0xbc71f3['attributes']=_[_0x9b8a('0x33')](_0xeff6bb[_0x9b8a('0x31')],qs[_0x9b8a('0x34')](_0x5acb1e[_0x9b8a('0x2f')][_0x9b8a('0x34')]));_0xbc71f3[_0x9b8a('0x32')]=_0xbc71f3['attributes']['length']?_0xbc71f3[_0x9b8a('0x32')]:_0xeff6bb['model'];if(_0x5acb1e[_0x9b8a('0x2f')][_0x9b8a('0x3d')]){_0xbc71f3[_0x9b8a('0x3e')]=[{'all':!![]}];}_0xbc71f3=_[_0x9b8a('0x3b')]({},_0xbc71f3,_0x5acb1e['options']);return db['MailSubstatus'][_0x9b8a('0x43')](_0xbc71f3)[_0x9b8a('0x22')](handleEntityNotFound(_0xe687c8,null))[_0x9b8a('0x22')](respondWithResult(_0xe687c8,null))[_0x9b8a('0x40')](handleError(_0xe687c8,null));};exports[_0x9b8a('0x44')]=function(_0x53afec,_0x51b5ae){return db[_0x9b8a('0x2a')][_0x9b8a('0x44')](_0x53afec['body'],{})['then'](respondWithResult(_0x51b5ae,0xc9))['catch'](handleError(_0x51b5ae,null));};exports[_0x9b8a('0x45')]=function(_0x25aafe,_0x516b4e){if(_0x25aafe[_0x9b8a('0x46')]['id']){delete _0x25aafe['body']['id'];}return db['MailSubstatus'][_0x9b8a('0x43')]({'where':{'id':_0x25aafe[_0x9b8a('0x47')]['id']}})['then'](handleEntityNotFound(_0x516b4e,null))[_0x9b8a('0x22')](saveUpdates(_0x25aafe['body'],null))[_0x9b8a('0x22')](respondWithResult(_0x516b4e,null))['catch'](handleError(_0x516b4e,null));};exports[_0x9b8a('0x23')]=function(_0x5f4072,_0x1e6109){return db[_0x9b8a('0x2a')]['find']({'where':{'id':_0x5f4072[_0x9b8a('0x47')]['id']}})[_0x9b8a('0x22')](handleEntityNotFound(_0x1e6109,null))[_0x9b8a('0x22')](removeEntity(_0x1e6109,null))[_0x9b8a('0x40')](handleError(_0x1e6109,null));};exports['describe']=function(_0x130795,_0x3f1320){return db[_0x9b8a('0x2a')]['describe']()[_0x9b8a('0x22')](respondWithResult(_0x3f1320,null))['catch'](handleError(_0x3f1320,null));}; \ No newline at end of file +var _0xf2d0=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3b2615,_0x4ffda1){var _0x22cbff=function(_0x211b24){while(--_0x211b24){_0x3b2615['push'](_0x3b2615['shift']());}};_0x22cbff(++_0x4ffda1);}(_0xf2d0,0x17d));var _0x0f2d=function(_0x5d68aa,_0x2c7725){_0x5d68aa=_0x5d68aa-0x0;var _0x451702=_0xf2d0[_0x5d68aa];return _0x451702;};'use strict';var emlformat=require(_0x0f2d('0x0'));var rimraf=require(_0x0f2d('0x1'));var zipdir=require(_0x0f2d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f2d('0x3'));var moment=require('moment');var BPromise=require(_0x0f2d('0x4'));var Mustache=require(_0x0f2d('0x5'));var util=require('util');var path=require(_0x0f2d('0x6'));var sox=require('sox');var csv=require(_0x0f2d('0x7'));var ejs=require(_0x0f2d('0x8'));var fs=require('fs');var fs_extra=require(_0x0f2d('0x9'));var _=require(_0x0f2d('0xa'));var squel=require(_0x0f2d('0xb'));var crypto=require(_0x0f2d('0xc'));var jsforce=require(_0x0f2d('0xd'));var deskjs=require(_0x0f2d('0xe'));var toCsv=require(_0x0f2d('0x7'));var querystring=require('querystring');var Papa=require(_0x0f2d('0xf'));var Redis=require('ioredis');var authService=require(_0x0f2d('0x10'));var qs=require(_0x0f2d('0x11'));var as=require(_0x0f2d('0x12'));var hardwareService=require(_0x0f2d('0x13'));var logger=require(_0x0f2d('0x14'))(_0x0f2d('0x15'));var utils=require(_0x0f2d('0x16'));var config=require(_0x0f2d('0x17'));var licenseUtil=require(_0x0f2d('0x18'));var db=require(_0x0f2d('0x19'))['db'];function respondWithStatusCode(_0x4d2f23,_0x482a54){_0x482a54=_0x482a54||0xcc;return function(_0x231f15){if(_0x231f15){return _0x4d2f23['sendStatus'](_0x482a54);}return _0x4d2f23[_0x0f2d('0x1a')](_0x482a54)[_0x0f2d('0x1b')]();};}function respondWithResult(_0x50ca68,_0x197435){_0x197435=_0x197435||0xc8;return function(_0x1a8a64){if(_0x1a8a64){return _0x50ca68[_0x0f2d('0x1a')](_0x197435)['json'](_0x1a8a64);}};}function respondWithFilteredResult(_0x298e95,_0x5db61b){return function(_0x12b532){if(_0x12b532){var _0xbe67f4=typeof _0x5db61b[_0x0f2d('0x1c')]===_0x0f2d('0x1d')&&typeof _0x5db61b[_0x0f2d('0x1e')]==='undefined';var _0x5a9985=_0x12b532[_0x0f2d('0x1f')];var _0x449389=_0xbe67f4?0x0:_0x5db61b[_0x0f2d('0x1c')];var _0x4d1d7a=_0xbe67f4?_0x12b532['count']:_0x5db61b[_0x0f2d('0x1c')]+_0x5db61b[_0x0f2d('0x1e')];var _0x42c681;if(_0x4d1d7a>=_0x5a9985){_0x4d1d7a=_0x5a9985;_0x42c681=0xc8;}else{_0x42c681=0xce;}_0x298e95[_0x0f2d('0x1a')](_0x42c681);return _0x298e95[_0x0f2d('0x20')](_0x0f2d('0x21'),_0x449389+'-'+_0x4d1d7a+'/'+_0x5a9985)[_0x0f2d('0x22')](_0x12b532);}return null;};}function patchUpdates(_0x22cdda){return function(_0x10a443){try{jsonpatch[_0x0f2d('0x23')](_0x10a443,_0x22cdda,!![]);}catch(_0x1c011c){return BPromise[_0x0f2d('0x24')](_0x1c011c);}return _0x10a443['save']();};}function saveUpdates(_0x3b9602,_0x4150dd){return function(_0x1c1c49){if(_0x1c1c49){return _0x1c1c49[_0x0f2d('0x25')](_0x3b9602)[_0x0f2d('0x26')](function(_0x201af1){return _0x201af1;});}return null;};}function removeEntity(_0x12e540,_0x37c98e){return function(_0x1255f3){if(_0x1255f3){return _0x1255f3[_0x0f2d('0x27')]()['then'](function(){_0x12e540['status'](0xcc)[_0x0f2d('0x1b')]();});}};}function handleEntityNotFound(_0xc5a775,_0x2c017f){return function(_0x4760ba){if(!_0x4760ba){_0xc5a775[_0x0f2d('0x28')](0x194);}return _0x4760ba;};}function handleError(_0x44c7a7,_0x420b4a){_0x420b4a=_0x420b4a||0x1f4;return function(_0x51708f){logger[_0x0f2d('0x29')](_0x51708f['stack']);if(_0x51708f[_0x0f2d('0x2a')]){delete _0x51708f[_0x0f2d('0x2a')];}_0x44c7a7['status'](_0x420b4a)[_0x0f2d('0x2b')](_0x51708f);};}exports[_0x0f2d('0x2c')]=function(_0x2be4f2,_0x317f14){var _0x1541f4={},_0xf81567={},_0x552430={'count':0x0,'rows':[]};var _0x4c1ea5=_[_0x0f2d('0x2d')](db[_0x0f2d('0x2e')][_0x0f2d('0x2f')],function(_0x46a4a1){return{'name':_0x46a4a1[_0x0f2d('0x30')],'type':_0x46a4a1['type'][_0x0f2d('0x31')]};});_0xf81567[_0x0f2d('0x32')]=_[_0x0f2d('0x2d')](_0x4c1ea5,'name');_0xf81567[_0x0f2d('0x33')]=_[_0x0f2d('0x34')](_0x2be4f2[_0x0f2d('0x33')]);_0xf81567[_0x0f2d('0x35')]=_[_0x0f2d('0x36')](_0xf81567[_0x0f2d('0x32')],_0xf81567[_0x0f2d('0x33')]);_0x1541f4['attributes']=_[_0x0f2d('0x36')](_0xf81567[_0x0f2d('0x32')],qs[_0x0f2d('0x37')](_0x2be4f2['query'][_0x0f2d('0x37')]));_0x1541f4['attributes']=_0x1541f4['attributes']['length']?_0x1541f4[_0x0f2d('0x38')]:_0xf81567[_0x0f2d('0x32')];if(!_0x2be4f2[_0x0f2d('0x33')]['hasOwnProperty'](_0x0f2d('0x39'))){_0x1541f4[_0x0f2d('0x1e')]=qs[_0x0f2d('0x1e')](_0x2be4f2[_0x0f2d('0x33')]['limit']);_0x1541f4['offset']=qs[_0x0f2d('0x1c')](_0x2be4f2[_0x0f2d('0x33')][_0x0f2d('0x1c')]);}_0x1541f4[_0x0f2d('0x3a')]=qs[_0x0f2d('0x3b')](_0x2be4f2[_0x0f2d('0x33')][_0x0f2d('0x3b')]);_0x1541f4[_0x0f2d('0x3c')]=qs[_0x0f2d('0x35')](_[_0x0f2d('0x3d')](_0x2be4f2['query'],_0xf81567['filters']),_0x4c1ea5);if(_0x2be4f2[_0x0f2d('0x33')][_0x0f2d('0x3e')]){_0x1541f4[_0x0f2d('0x3c')]=_[_0x0f2d('0x3f')](_0x1541f4[_0x0f2d('0x3c')],{'$or':_[_0x0f2d('0x2d')](_0x4c1ea5,function(_0x180504){if(_0x180504[_0x0f2d('0x40')]!=='VIRTUAL'){var _0x15034e={};_0x15034e[_0x180504[_0x0f2d('0x2a')]]={'$like':'%'+_0x2be4f2[_0x0f2d('0x33')][_0x0f2d('0x3e')]+'%'};return _0x15034e;}})});}_0x1541f4=_[_0x0f2d('0x3f')]({},_0x1541f4,_0x2be4f2[_0x0f2d('0x41')]);var _0x478cbd={'where':_0x1541f4['where']};return db[_0x0f2d('0x2e')]['count'](_0x478cbd)[_0x0f2d('0x26')](function(_0x190d31){_0x552430[_0x0f2d('0x1f')]=_0x190d31;if(_0x2be4f2['query'][_0x0f2d('0x42')]){_0x1541f4[_0x0f2d('0x43')]=[{'all':!![]}];}return db[_0x0f2d('0x2e')]['findAll'](_0x1541f4);})['then'](function(_0x316c76){_0x552430[_0x0f2d('0x44')]=_0x316c76;return _0x552430;})['then'](respondWithFilteredResult(_0x317f14,_0x1541f4))[_0x0f2d('0x45')](handleError(_0x317f14,null));};exports[_0x0f2d('0x46')]=function(_0x263629,_0x159478){var _0x104b37={'raw':!![],'where':{'id':_0x263629[_0x0f2d('0x47')]['id']}},_0x41c630={};_0x41c630[_0x0f2d('0x32')]=_[_0x0f2d('0x34')](db[_0x0f2d('0x2e')]['rawAttributes']);_0x41c630['query']=_[_0x0f2d('0x34')](_0x263629['query']);_0x41c630[_0x0f2d('0x35')]=_[_0x0f2d('0x36')](_0x41c630[_0x0f2d('0x32')],_0x41c630[_0x0f2d('0x33')]);_0x104b37['attributes']=_[_0x0f2d('0x36')](_0x41c630[_0x0f2d('0x32')],qs['fields'](_0x263629[_0x0f2d('0x33')]['fields']));_0x104b37[_0x0f2d('0x38')]=_0x104b37[_0x0f2d('0x38')][_0x0f2d('0x48')]?_0x104b37[_0x0f2d('0x38')]:_0x41c630[_0x0f2d('0x32')];if(_0x263629[_0x0f2d('0x33')][_0x0f2d('0x42')]){_0x104b37[_0x0f2d('0x43')]=[{'all':!![]}];}_0x104b37=_[_0x0f2d('0x3f')]({},_0x104b37,_0x263629[_0x0f2d('0x41')]);return db[_0x0f2d('0x2e')][_0x0f2d('0x49')](_0x104b37)['then'](handleEntityNotFound(_0x159478,null))[_0x0f2d('0x26')](respondWithResult(_0x159478,null))[_0x0f2d('0x45')](handleError(_0x159478,null));};exports['create']=function(_0x427d71,_0xd3b345){return db['MailSubstatus'][_0x0f2d('0x4a')](_0x427d71[_0x0f2d('0x4b')],{})['then'](respondWithResult(_0xd3b345,0xc9))[_0x0f2d('0x45')](handleError(_0xd3b345,null));};exports[_0x0f2d('0x25')]=function(_0x21047a,_0x5edf4c){if(_0x21047a[_0x0f2d('0x4b')]['id']){delete _0x21047a['body']['id'];}return db[_0x0f2d('0x2e')]['find']({'where':{'id':_0x21047a[_0x0f2d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5edf4c,null))['then'](saveUpdates(_0x21047a[_0x0f2d('0x4b')],null))['then'](respondWithResult(_0x5edf4c,null))[_0x0f2d('0x45')](handleError(_0x5edf4c,null));};exports[_0x0f2d('0x27')]=function(_0x55d72a,_0x2e8982){return db[_0x0f2d('0x2e')]['find']({'where':{'id':_0x55d72a[_0x0f2d('0x47')]['id']}})[_0x0f2d('0x26')](handleEntityNotFound(_0x2e8982,null))[_0x0f2d('0x26')](removeEntity(_0x2e8982,null))[_0x0f2d('0x45')](handleError(_0x2e8982,null));};exports['describe']=function(_0x56dbf1,_0x565fef){return db[_0x0f2d('0x2e')][_0x0f2d('0x4c')]()[_0x0f2d('0x26')](respondWithResult(_0x565fef,null))[_0x0f2d('0x45')](handleError(_0x565fef,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 445e25c..b685a2d 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 _0xc8dd=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0xd46d27,_0x17f557){var _0x188099=function(_0x229c25){while(--_0x229c25){_0xd46d27['push'](_0xd46d27['shift']());}};_0x188099(++_0x17f557);}(_0xc8dd,0x1e3));var _0xdc8d=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xc8dd[_0xe4d6c6];return _0x3a8935;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xdc8d('0x0'))['db'][_0xdc8d('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xdc8d('0x2')](0x0);var events={'afterUpdate':_0xdc8d('0x3')};function emitEvent(_0x85555f){return function(_0x3133b6,_0x27050b,_0x4a0b2f){MailSubstatusEvents[_0xdc8d('0x4')](_0x85555f+':'+_0x3133b6['id'],_0x3133b6);MailSubstatusEvents['emit'](_0x85555f,_0x3133b6);_0x4a0b2f(null);};}for(var e in events){if(events[_0xdc8d('0x5')](e)){var event=events[e];MailSubstatus[_0xdc8d('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xc99f=['../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x990c78,_0x129ea8){var _0x3464d5=function(_0x14982b){while(--_0x14982b){_0x990c78['push'](_0x990c78['shift']());}};_0x3464d5(++_0x129ea8);}(_0xc99f,0x150));var _0xfc99=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xc99f[_0x1d39f6];return _0x3dbd7a;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xfc99('0x0'))['db'][_0xfc99('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xfc99('0x2')](0x0);var events={'afterUpdate':_0xfc99('0x3')};function emitEvent(_0x4ff06d){return function(_0x27ceff,_0x430208,_0x2cb50e){MailSubstatusEvents['emit'](_0x4ff06d+':'+_0x27ceff['id'],_0x27ceff);MailSubstatusEvents[_0xfc99('0x4')](_0x4ff06d,_0x27ceff);_0x2cb50e(null);};}for(var e in events){if(events[_0xfc99('0x5')](e)){var event=events[e];MailSubstatus[_0xfc99('0x6')](e,emitEvent(event));}}module[_0xfc99('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 52f67c4..1b3cf8e 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 _0x9190=['Condition','update','name','mailSubstatus','./mailSubstatus.attributes','MailSubstatus','mail_substatuses'];(function(_0x34cc27,_0x124f42){var _0xfdbd4f=function(_0xd44b7f){while(--_0xd44b7f){_0x34cc27['push'](_0x34cc27['shift']());}};_0xfdbd4f(++_0x124f42);}(_0x9190,0x11c));var _0x0919=function(_0x195c5f,_0x5eafd8){_0x195c5f=_0x195c5f-0x0;var _0x4b5fc3=_0x9190[_0x195c5f];return _0x4b5fc3;};'use strict';var attributes=require(_0x0919('0x0'));module['exports']=function(_0x5e6946){var _0x5174a6=_0x5e6946['models'];return _0x5e6946['define'](_0x0919('0x1'),attributes,{'tableName':_0x0919('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2464f1,_0xa2af6c,_0x2188ba){return _0x5174a6[_0x0919('0x3')][_0x0919('0x4')]({'value':_0x2464f1[_0x0919('0x5')]},{'where':{'field':_0x0919('0x6'),'value':_0x2464f1['_previousDataValues'][_0x0919('0x5')]}})['then'](function(){_0x2188ba();})['catch'](function(_0x2c16cf){_0x2188ba(_0x2c16cf);});}}});}; \ No newline at end of file +var _0x7df7=['_previousDataValues','name','then','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x6f43ba,_0x2ebafd){var _0x57eba5=function(_0x26de80){while(--_0x26de80){_0x6f43ba['push'](_0x6f43ba['shift']());}};_0x57eba5(++_0x2ebafd);}(_0x7df7,0x1a5));var _0x77df=function(_0x4b06c6,_0x57bdf5){_0x4b06c6=_0x4b06c6-0x0;var _0x3a327a=_0x7df7[_0x4b06c6];return _0x3a327a;};'use strict';var attributes=require(_0x77df('0x0'));module[_0x77df('0x1')]=function(_0x3a371f){var _0xab26c6=_0x3a371f[_0x77df('0x2')];return _0x3a371f['define'](_0x77df('0x3'),attributes,{'tableName':_0x77df('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x35c0cf,_0x3f6a72,_0x52b876){return _0xab26c6[_0x77df('0x5')][_0x77df('0x6')]({'value':_0x35c0cf['name']},{'where':{'field':_0x77df('0x7'),'value':_0x35c0cf[_0x77df('0x8')][_0x77df('0x9')]}})[_0x77df('0xa')](function(){_0x52b876();})['catch'](function(_0x5bee76){_0x52b876(_0x5bee76);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b63b169..0cf78f7 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 _0xb312=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x1a074e,_0x33b8d0){var _0x3c0caf=function(_0xce9a5d){while(--_0xce9a5d){_0x1a074e['push'](_0x1a074e['shift']());}};_0x3c0caf(++_0x33b8d0);}(_0xb312,0x132));var _0x2b31=function(_0xf338ce,_0x1b00c5){_0xf338ce=_0xf338ce-0x0;var _0x29591f=_0xb312[_0xf338ce];return _0x29591f;};'use strict';var _=require(_0x2b31('0x0'));var util=require(_0x2b31('0x1'));var moment=require(_0x2b31('0x2'));var BPromise=require(_0x2b31('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b31('0x4'));var db=require(_0x2b31('0x5'))['db'];var utils=require(_0x2b31('0x6'));var logger=require(_0x2b31('0x7'))(_0x2b31('0x8'));var config=require(_0x2b31('0x9'));var jayson=require(_0x2b31('0xa'));var client=jayson[_0x2b31('0xb')][_0x2b31('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36afe7,_0x5c8c28,_0x8e8d1c){return new BPromise(function(_0x3a58b1,_0x466ea6){return client[_0x2b31('0xd')](_0x36afe7,_0x8e8d1c)['then'](function(_0x456268){logger[_0x2b31('0xe')](_0x2b31('0xf'),_0x5c8c28,'request\x20sent');logger[_0x2b31('0x10')](_0x2b31('0x11'),_0x5c8c28,'request\x20sent',JSON['stringify'](_0x456268));if(_0x456268[_0x2b31('0x12')]){if(_0x456268[_0x2b31('0x12')][_0x2b31('0x13')]===0x1f4){logger[_0x2b31('0x12')](_0x2b31('0xf'),_0x5c8c28,_0x456268['error'][_0x2b31('0x14')]);return _0x466ea6(_0x456268[_0x2b31('0x12')][_0x2b31('0x14')]);}logger[_0x2b31('0x12')](_0x2b31('0xf'),_0x5c8c28,_0x456268[_0x2b31('0x12')][_0x2b31('0x14')]);return _0x3a58b1(_0x456268[_0x2b31('0x12')]['message']);}else{logger['info'](_0x2b31('0xf'),_0x5c8c28,_0x2b31('0x15'));_0x3a58b1(_0x456268[_0x2b31('0x16')][_0x2b31('0x14')]);}})['catch'](function(_0x1208bd){logger['error'](_0x2b31('0xf'),_0x5c8c28,_0x1208bd);_0x466ea6(_0x1208bd);});});} \ No newline at end of file +var _0x4ae0=['bluebird','randomstring','ioredis','../../config/logger','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','moment'];(function(_0x412baf,_0x31ff60){var _0x24090d=function(_0x5cb316){while(--_0x5cb316){_0x412baf['push'](_0x412baf['shift']());}};_0x24090d(++_0x31ff60);}(_0x4ae0,0x152));var _0x04ae=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x4ae0[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x04ae('0x0'));var util=require('util');var moment=require(_0x04ae('0x1'));var BPromise=require(_0x04ae('0x2'));var rs=require(_0x04ae('0x3'));var fs=require('fs');var Redis=require(_0x04ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04ae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x04ae('0x6')][_0x04ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x8f78ed,_0x58748b,_0x244c78){return new BPromise(function(_0x2c15de,_0x5c118f){return client['request'](_0x8f78ed,_0x244c78)[_0x04ae('0x8')](function(_0x4fc89c){logger[_0x04ae('0x9')](_0x04ae('0xa'),_0x58748b,_0x04ae('0xb'));logger[_0x04ae('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x58748b,_0x04ae('0xb'),JSON['stringify'](_0x4fc89c));if(_0x4fc89c[_0x04ae('0xd')]){if(_0x4fc89c[_0x04ae('0xd')][_0x04ae('0xe')]===0x1f4){logger[_0x04ae('0xd')](_0x04ae('0xa'),_0x58748b,_0x4fc89c[_0x04ae('0xd')][_0x04ae('0xf')]);return _0x5c118f(_0x4fc89c[_0x04ae('0xd')][_0x04ae('0xf')]);}logger[_0x04ae('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x58748b,_0x4fc89c['error'][_0x04ae('0xf')]);return _0x2c15de(_0x4fc89c['error'][_0x04ae('0xf')]);}else{logger[_0x04ae('0x9')](_0x04ae('0xa'),_0x58748b,'request\x20sent');_0x2c15de(_0x4fc89c['result'][_0x04ae('0xf')]);}})[_0x04ae('0x10')](function(_0x35d446){logger[_0x04ae('0xd')](_0x04ae('0xa'),_0x58748b,_0x35d446);_0x5c118f(_0x35d446);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index fe974cc..0a7c4a2 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 _0x6018=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','index','isAuthenticated','describe','get','/:id','post'];(function(_0x27e83c,_0xe6fa23){var _0x20464c=function(_0x46b8ce){while(--_0x46b8ce){_0x27e83c['push'](_0x27e83c['shift']());}};_0x20464c(++_0xe6fa23);}(_0x6018,0x18d));var _0x8601=function(_0x1e46cf,_0x3be66f){_0x1e46cf=_0x1e46cf-0x0;var _0x212f5b=_0x6018[_0x1e46cf];return _0x212f5b;};'use strict';var multer=require(_0x8601('0x0'));var util=require(_0x8601('0x1'));var path=require(_0x8601('0x2'));var timeout=require(_0x8601('0x3'));var express=require(_0x8601('0x4'));var router=express[_0x8601('0x5')]();var fs_extra=require(_0x8601('0x6'));var auth=require(_0x8601('0x7'));var interaction=require(_0x8601('0x8'));var config=require(_0x8601('0x9'));var controller=require(_0x8601('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x8601('0xb')]);router['get']('/describe',auth[_0x8601('0xc')](),controller[_0x8601('0xd')]);router[_0x8601('0xe')](_0x8601('0xf'),auth[_0x8601('0xc')](),controller['show']);router[_0x8601('0x10')]('/',auth[_0x8601('0xc')](),controller[_0x8601('0x11')]);router[_0x8601('0x12')](_0x8601('0xf'),auth[_0x8601('0xc')](),controller[_0x8601('0x13')]);router[_0x8601('0x14')](_0x8601('0xf'),auth['isAuthenticated'](),controller[_0x8601('0x15')]);module[_0x8601('0x16')]=router; \ No newline at end of file +var _0x0541=['../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x340f82,_0x26ee78){var _0x766f92=function(_0x2d52fb){while(--_0x2d52fb){_0x340f82['push'](_0x340f82['shift']());}};_0x766f92(++_0x26ee78);}(_0x0541,0x1b2));var _0x1054=function(_0x2eeed4,_0x28dc98){_0x2eeed4=_0x2eeed4-0x0;var _0x56099d=_0x0541[_0x2eeed4];return _0x56099d;};'use strict';var multer=require(_0x1054('0x0'));var util=require('util');var path=require(_0x1054('0x1'));var timeout=require(_0x1054('0x2'));var express=require(_0x1054('0x3'));var router=express[_0x1054('0x4')]();var fs_extra=require(_0x1054('0x5'));var auth=require(_0x1054('0x6'));var interaction=require(_0x1054('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x1054('0x8')](),controller[_0x1054('0x9')]);router[_0x1054('0xa')](_0x1054('0xb'),auth['isAuthenticated'](),controller[_0x1054('0xc')]);router[_0x1054('0xa')](_0x1054('0xd'),auth[_0x1054('0x8')](),controller[_0x1054('0xe')]);router[_0x1054('0xf')]('/',auth[_0x1054('0x8')](),controller[_0x1054('0x10')]);router[_0x1054('0x11')](_0x1054('0xd'),auth[_0x1054('0x8')](),controller[_0x1054('0x12')]);router['delete'](_0x1054('0xd'),auth[_0x1054('0x8')](),controller[_0x1054('0x13')]);module[_0x1054('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5f8595b..fb458a2 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x463d63,_0xa69c74){var _0x5736c5=function(_0x1d80b9){while(--_0x1d80b9){_0x463d63['push'](_0x463d63['shift']());}};_0x5736c5(++_0xa69c74);}(_0xaa88,0x137));var _0x8aa8=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xaa88[_0x499210];return _0x2e153d;};'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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x416326,_0xd2abb0){var _0xa70bf5=function(_0x2a2d1b){while(--_0x2a2d1b){_0x416326['push'](_0x416326['shift']());}};_0xa70bf5(++_0xd2abb0);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 144c57c..394280d 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 _0xd90c=['moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','MailTransferReport','rawAttributes','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xd90c,0x1e1));var _0xcd90=function(_0x11c4b6,_0x572fdb){_0x11c4b6=_0x11c4b6-0x0;var _0x2cb405=_0xd90c[_0x11c4b6];return _0x2cb405;};'use strict';var emlformat=require(_0xcd90('0x0'));var rimraf=require(_0xcd90('0x1'));var zipdir=require(_0xcd90('0x2'));var jsonpatch=require(_0xcd90('0x3'));var rp=require(_0xcd90('0x4'));var moment=require(_0xcd90('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcd90('0x6'));var util=require(_0xcd90('0x7'));var path=require(_0xcd90('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd90('0x9'));var fs=require('fs');var fs_extra=require(_0xcd90('0xa'));var _=require(_0xcd90('0xb'));var squel=require(_0xcd90('0xc'));var crypto=require(_0xcd90('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xcd90('0xe'));var toCsv=require(_0xcd90('0xf'));var querystring=require('querystring');var Papa=require(_0xcd90('0x10'));var Redis=require(_0xcd90('0x11'));var authService=require(_0xcd90('0x12'));var qs=require(_0xcd90('0x13'));var as=require(_0xcd90('0x14'));var hardwareService=require(_0xcd90('0x15'));var logger=require(_0xcd90('0x16'))(_0xcd90('0x17'));var utils=require(_0xcd90('0x18'));var config=require(_0xcd90('0x19'));var licenseUtil=require(_0xcd90('0x1a'));var db=require(_0xcd90('0x1b'))['db'];function respondWithStatusCode(_0x14561b,_0x16e13f){_0x16e13f=_0x16e13f||0xcc;return function(_0x3cfae4){if(_0x3cfae4){return _0x14561b[_0xcd90('0x1c')](_0x16e13f);}return _0x14561b['status'](_0x16e13f)['end']();};}function respondWithResult(_0x43a741,_0x384704){_0x384704=_0x384704||0xc8;return function(_0x144c51){if(_0x144c51){return _0x43a741[_0xcd90('0x1d')](_0x384704)[_0xcd90('0x1e')](_0x144c51);}};}function respondWithFilteredResult(_0x5df443,_0x334544){return function(_0x5743fa){if(_0x5743fa){var _0x56380a=typeof _0x334544['offset']===_0xcd90('0x1f')&&typeof _0x334544['limit']==='undefined';var _0x4fdbc7=_0x5743fa[_0xcd90('0x20')];var _0x10aaa5=_0x56380a?0x0:_0x334544[_0xcd90('0x21')];var _0x51ca51=_0x56380a?_0x5743fa[_0xcd90('0x20')]:_0x334544[_0xcd90('0x21')]+_0x334544[_0xcd90('0x22')];var _0x240816;if(_0x51ca51>=_0x4fdbc7){_0x51ca51=_0x4fdbc7;_0x240816=0xc8;}else{_0x240816=0xce;}_0x5df443[_0xcd90('0x1d')](_0x240816);return _0x5df443[_0xcd90('0x23')](_0xcd90('0x24'),_0x10aaa5+'-'+_0x51ca51+'/'+_0x4fdbc7)[_0xcd90('0x1e')](_0x5743fa);}return null;};}function patchUpdates(_0x55a4f5){return function(_0x50174b){try{jsonpatch[_0xcd90('0x25')](_0x50174b,_0x55a4f5,!![]);}catch(_0xd0243d){return BPromise[_0xcd90('0x26')](_0xd0243d);}return _0x50174b[_0xcd90('0x27')]();};}function saveUpdates(_0x2d3a7f,_0x39e1ab){return function(_0x21d0fd){if(_0x21d0fd){return _0x21d0fd[_0xcd90('0x28')](_0x2d3a7f)[_0xcd90('0x29')](function(_0x295a87){return _0x295a87;});}return null;};}function removeEntity(_0x2544df,_0x1739a3){return function(_0x5652b1){if(_0x5652b1){return _0x5652b1[_0xcd90('0x2a')]()[_0xcd90('0x29')](function(){_0x2544df['status'](0xcc)[_0xcd90('0x2b')]();});}};}function handleEntityNotFound(_0x114bfe,_0x521bba){return function(_0x5c0f38){if(!_0x5c0f38){_0x114bfe[_0xcd90('0x1c')](0x194);}return _0x5c0f38;};}function handleError(_0x2972b6,_0x1477d3){_0x1477d3=_0x1477d3||0x1f4;return function(_0x39a5a1){logger[_0xcd90('0x2c')](_0x39a5a1[_0xcd90('0x2d')]);if(_0x39a5a1[_0xcd90('0x2e')]){delete _0x39a5a1[_0xcd90('0x2e')];}_0x2972b6['status'](_0x1477d3)[_0xcd90('0x2f')](_0x39a5a1);};}exports[_0xcd90('0x30')]=function(_0xeedad3,_0xbfdbfe){var _0x5d038a={},_0x57d320={},_0x264ab0={'count':0x0,'rows':[]};var _0x1573f8=_['map'](db[_0xcd90('0x31')][_0xcd90('0x32')],function(_0x2982b2){return{'name':_0x2982b2['fieldName'],'type':_0x2982b2[_0xcd90('0x33')][_0xcd90('0x34')]};});_0x57d320[_0xcd90('0x35')]=_[_0xcd90('0x36')](_0x1573f8,_0xcd90('0x2e'));_0x57d320[_0xcd90('0x37')]=_[_0xcd90('0x38')](_0xeedad3[_0xcd90('0x37')]);_0x57d320['filters']=_['intersection'](_0x57d320[_0xcd90('0x35')],_0x57d320[_0xcd90('0x37')]);_0x5d038a[_0xcd90('0x39')]=_[_0xcd90('0x3a')](_0x57d320[_0xcd90('0x35')],qs[_0xcd90('0x3b')](_0xeedad3[_0xcd90('0x37')]['fields']));_0x5d038a[_0xcd90('0x39')]=_0x5d038a[_0xcd90('0x39')][_0xcd90('0x3c')]?_0x5d038a['attributes']:_0x57d320['model'];if(!_0xeedad3['query'][_0xcd90('0x3d')]('nolimit')){_0x5d038a[_0xcd90('0x22')]=qs[_0xcd90('0x22')](_0xeedad3[_0xcd90('0x37')][_0xcd90('0x22')]);_0x5d038a['offset']=qs[_0xcd90('0x21')](_0xeedad3[_0xcd90('0x37')]['offset']);}_0x5d038a[_0xcd90('0x3e')]=qs[_0xcd90('0x3f')](_0xeedad3[_0xcd90('0x37')]['sort']);_0x5d038a[_0xcd90('0x40')]=qs[_0xcd90('0x41')](_[_0xcd90('0x42')](_0xeedad3['query'],_0x57d320[_0xcd90('0x41')]),_0x1573f8);if(_0xeedad3[_0xcd90('0x37')]['filter']){_0x5d038a[_0xcd90('0x40')]=_[_0xcd90('0x43')](_0x5d038a[_0xcd90('0x40')],{'$or':_[_0xcd90('0x36')](_0x1573f8,function(_0x5cf537){if(_0x5cf537[_0xcd90('0x33')]!==_0xcd90('0x44')){var _0x41b063={};_0x41b063[_0x5cf537[_0xcd90('0x2e')]]={'$like':'%'+_0xeedad3[_0xcd90('0x37')]['filter']+'%'};return _0x41b063;}})});}_0x5d038a=_[_0xcd90('0x43')]({},_0x5d038a,_0xeedad3[_0xcd90('0x45')]);var _0x51808a={'where':_0x5d038a[_0xcd90('0x40')]};return db['MailTransferReport'][_0xcd90('0x20')](_0x51808a)[_0xcd90('0x29')](function(_0x4c2a48){_0x264ab0['count']=_0x4c2a48;if(_0xeedad3[_0xcd90('0x37')][_0xcd90('0x46')]){_0x5d038a[_0xcd90('0x47')]=[{'all':!![]}];}return db[_0xcd90('0x31')][_0xcd90('0x48')](_0x5d038a);})[_0xcd90('0x29')](function(_0x598552){_0x264ab0[_0xcd90('0x49')]=_0x598552;return _0x264ab0;})[_0xcd90('0x29')](respondWithFilteredResult(_0xbfdbfe,_0x5d038a))['catch'](handleError(_0xbfdbfe,null));};exports[_0xcd90('0x4a')]=function(_0x52a5c7,_0x5ae021){var _0x125308={'raw':!![],'where':{'id':_0x52a5c7['params']['id']}},_0x439c06={};_0x439c06[_0xcd90('0x35')]=_[_0xcd90('0x38')](db[_0xcd90('0x31')][_0xcd90('0x32')]);_0x439c06[_0xcd90('0x37')]=_['keys'](_0x52a5c7[_0xcd90('0x37')]);_0x439c06['filters']=_[_0xcd90('0x3a')](_0x439c06[_0xcd90('0x35')],_0x439c06[_0xcd90('0x37')]);_0x125308[_0xcd90('0x39')]=_['intersection'](_0x439c06[_0xcd90('0x35')],qs[_0xcd90('0x3b')](_0x52a5c7[_0xcd90('0x37')][_0xcd90('0x3b')]));_0x125308[_0xcd90('0x39')]=_0x125308[_0xcd90('0x39')][_0xcd90('0x3c')]?_0x125308[_0xcd90('0x39')]:_0x439c06[_0xcd90('0x35')];if(_0x52a5c7[_0xcd90('0x37')][_0xcd90('0x46')]){_0x125308[_0xcd90('0x47')]=[{'all':!![]}];}_0x125308=_[_0xcd90('0x43')]({},_0x125308,_0x52a5c7[_0xcd90('0x45')]);return db[_0xcd90('0x31')][_0xcd90('0x4b')](_0x125308)['then'](handleEntityNotFound(_0x5ae021,null))[_0xcd90('0x29')](respondWithResult(_0x5ae021,null))['catch'](handleError(_0x5ae021,null));};exports[_0xcd90('0x4c')]=function(_0x41d124,_0x1b87f8){return db[_0xcd90('0x31')][_0xcd90('0x4c')](_0x41d124[_0xcd90('0x4d')],{})['then'](respondWithResult(_0x1b87f8,0xc9))['catch'](handleError(_0x1b87f8,null));};exports[_0xcd90('0x28')]=function(_0x14cac0,_0x2c287c){if(_0x14cac0[_0xcd90('0x4d')]['id']){delete _0x14cac0['body']['id'];}return db[_0xcd90('0x31')][_0xcd90('0x4b')]({'where':{'id':_0x14cac0['params']['id']}})['then'](handleEntityNotFound(_0x2c287c,null))[_0xcd90('0x29')](saveUpdates(_0x14cac0[_0xcd90('0x4d')],null))['then'](respondWithResult(_0x2c287c,null))[_0xcd90('0x4e')](handleError(_0x2c287c,null));};exports[_0xcd90('0x2a')]=function(_0x482472,_0x4da692){return db[_0xcd90('0x31')][_0xcd90('0x4b')]({'where':{'id':_0x482472[_0xcd90('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4da692,null))['then'](removeEntity(_0x4da692,null))[_0xcd90('0x4e')](handleError(_0x4da692,null));};exports['describe']=function(_0x36b64e,_0x2bec2f){return db[_0xcd90('0x31')][_0xcd90('0x50')]()['then'](respondWithResult(_0x2bec2f,null))[_0xcd90('0x4e')](handleError(_0x2bec2f,null));}; \ No newline at end of file +var _0x2c43=['stack','name','send','index','MailTransferReport','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','end','sendStatus','error'];(function(_0xcafee3,_0x3c1bc1){var _0x3c2b17=function(_0x12b45a){while(--_0x12b45a){_0xcafee3['push'](_0xcafee3['shift']());}};_0x3c2b17(++_0x3c1bc1);}(_0x2c43,0x19b));var _0x32c4=function(_0x45710d,_0x1c3ec8){_0x45710d=_0x45710d-0x0;var _0x3d38b9=_0x2c43[_0x45710d];return _0x3d38b9;};'use strict';var emlformat=require(_0x32c4('0x0'));var rimraf=require(_0x32c4('0x1'));var zipdir=require(_0x32c4('0x2'));var jsonpatch=require(_0x32c4('0x3'));var rp=require(_0x32c4('0x4'));var moment=require(_0x32c4('0x5'));var BPromise=require(_0x32c4('0x6'));var Mustache=require('mustache');var util=require(_0x32c4('0x7'));var path=require(_0x32c4('0x8'));var sox=require('sox');var csv=require(_0x32c4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32c4('0xa'));var _=require(_0x32c4('0xb'));var squel=require(_0x32c4('0xc'));var crypto=require(_0x32c4('0xd'));var jsforce=require(_0x32c4('0xe'));var deskjs=require(_0x32c4('0xf'));var toCsv=require(_0x32c4('0x9'));var querystring=require(_0x32c4('0x10'));var Papa=require(_0x32c4('0x11'));var Redis=require(_0x32c4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x32c4('0x13'));var as=require(_0x32c4('0x14'));var hardwareService=require(_0x32c4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x32c4('0x16'));var config=require(_0x32c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x32c4('0x18'))['db'];function respondWithStatusCode(_0x53a104,_0x456f4e){_0x456f4e=_0x456f4e||0xcc;return function(_0x3aff2d){if(_0x3aff2d){return _0x53a104['sendStatus'](_0x456f4e);}return _0x53a104['status'](_0x456f4e)['end']();};}function respondWithResult(_0x5e7e37,_0x20ba8d){_0x20ba8d=_0x20ba8d||0xc8;return function(_0x4e734d){if(_0x4e734d){return _0x5e7e37[_0x32c4('0x19')](_0x20ba8d)['json'](_0x4e734d);}};}function respondWithFilteredResult(_0x17c9c0,_0x51132a){return function(_0x436b8c){if(_0x436b8c){var _0x21bf63=typeof _0x51132a[_0x32c4('0x1a')]===_0x32c4('0x1b')&&typeof _0x51132a[_0x32c4('0x1c')]===_0x32c4('0x1b');var _0x26baff=_0x436b8c[_0x32c4('0x1d')];var _0x3478a5=_0x21bf63?0x0:_0x51132a[_0x32c4('0x1a')];var _0x29f139=_0x21bf63?_0x436b8c[_0x32c4('0x1d')]:_0x51132a[_0x32c4('0x1a')]+_0x51132a[_0x32c4('0x1c')];var _0x957ca0;if(_0x29f139>=_0x26baff){_0x29f139=_0x26baff;_0x957ca0=0xc8;}else{_0x957ca0=0xce;}_0x17c9c0[_0x32c4('0x19')](_0x957ca0);return _0x17c9c0[_0x32c4('0x1e')](_0x32c4('0x1f'),_0x3478a5+'-'+_0x29f139+'/'+_0x26baff)[_0x32c4('0x20')](_0x436b8c);}return null;};}function patchUpdates(_0x2a1068){return function(_0x3a565b){try{jsonpatch['apply'](_0x3a565b,_0x2a1068,!![]);}catch(_0x12354d){return BPromise[_0x32c4('0x21')](_0x12354d);}return _0x3a565b[_0x32c4('0x22')]();};}function saveUpdates(_0x163821,_0x1700ff){return function(_0x3b232c){if(_0x3b232c){return _0x3b232c['update'](_0x163821)[_0x32c4('0x23')](function(_0x36657d){return _0x36657d;});}return null;};}function removeEntity(_0x2a1c9c,_0x1936da){return function(_0x441e4c){if(_0x441e4c){return _0x441e4c['destroy']()[_0x32c4('0x23')](function(){_0x2a1c9c[_0x32c4('0x19')](0xcc)[_0x32c4('0x24')]();});}};}function handleEntityNotFound(_0x820d14,_0x4abe97){return function(_0x383222){if(!_0x383222){_0x820d14[_0x32c4('0x25')](0x194);}return _0x383222;};}function handleError(_0x2818b9,_0x5e767a){_0x5e767a=_0x5e767a||0x1f4;return function(_0x1d235a){logger[_0x32c4('0x26')](_0x1d235a[_0x32c4('0x27')]);if(_0x1d235a[_0x32c4('0x28')]){delete _0x1d235a[_0x32c4('0x28')];}_0x2818b9['status'](_0x5e767a)[_0x32c4('0x29')](_0x1d235a);};}exports[_0x32c4('0x2a')]=function(_0x2fc966,_0x28ca91){var _0xaa75db={},_0x1bdfcc={},_0x2c87e5={'count':0x0,'rows':[]};var _0x2ac0f5=_['map'](db[_0x32c4('0x2b')][_0x32c4('0x2c')],function(_0x2c539f){return{'name':_0x2c539f[_0x32c4('0x2d')],'type':_0x2c539f['type']['key']};});_0x1bdfcc[_0x32c4('0x2e')]=_[_0x32c4('0x2f')](_0x2ac0f5,_0x32c4('0x28'));_0x1bdfcc[_0x32c4('0x30')]=_[_0x32c4('0x31')](_0x2fc966[_0x32c4('0x30')]);_0x1bdfcc['filters']=_[_0x32c4('0x32')](_0x1bdfcc[_0x32c4('0x2e')],_0x1bdfcc[_0x32c4('0x30')]);_0xaa75db[_0x32c4('0x33')]=_[_0x32c4('0x32')](_0x1bdfcc[_0x32c4('0x2e')],qs['fields'](_0x2fc966[_0x32c4('0x30')]['fields']));_0xaa75db['attributes']=_0xaa75db['attributes']['length']?_0xaa75db[_0x32c4('0x33')]:_0x1bdfcc['model'];if(!_0x2fc966[_0x32c4('0x30')][_0x32c4('0x34')](_0x32c4('0x35'))){_0xaa75db[_0x32c4('0x1c')]=qs[_0x32c4('0x1c')](_0x2fc966[_0x32c4('0x30')][_0x32c4('0x1c')]);_0xaa75db['offset']=qs[_0x32c4('0x1a')](_0x2fc966['query'][_0x32c4('0x1a')]);}_0xaa75db[_0x32c4('0x36')]=qs[_0x32c4('0x37')](_0x2fc966['query'][_0x32c4('0x37')]);_0xaa75db[_0x32c4('0x38')]=qs[_0x32c4('0x39')](_[_0x32c4('0x3a')](_0x2fc966['query'],_0x1bdfcc['filters']),_0x2ac0f5);if(_0x2fc966[_0x32c4('0x30')][_0x32c4('0x3b')]){_0xaa75db['where']=_[_0x32c4('0x3c')](_0xaa75db['where'],{'$or':_[_0x32c4('0x2f')](_0x2ac0f5,function(_0x27c9ed){if(_0x27c9ed['type']!==_0x32c4('0x3d')){var _0x4f5330={};_0x4f5330[_0x27c9ed[_0x32c4('0x28')]]={'$like':'%'+_0x2fc966[_0x32c4('0x30')][_0x32c4('0x3b')]+'%'};return _0x4f5330;}})});}_0xaa75db=_[_0x32c4('0x3c')]({},_0xaa75db,_0x2fc966[_0x32c4('0x3e')]);var _0x22adca={'where':_0xaa75db[_0x32c4('0x38')]};return db['MailTransferReport'][_0x32c4('0x1d')](_0x22adca)[_0x32c4('0x23')](function(_0x5de2fd){_0x2c87e5['count']=_0x5de2fd;if(_0x2fc966[_0x32c4('0x30')][_0x32c4('0x3f')]){_0xaa75db[_0x32c4('0x40')]=[{'all':!![]}];}return db[_0x32c4('0x2b')]['findAll'](_0xaa75db);})[_0x32c4('0x23')](function(_0x33ee02){_0x2c87e5[_0x32c4('0x41')]=_0x33ee02;return _0x2c87e5;})[_0x32c4('0x23')](respondWithFilteredResult(_0x28ca91,_0xaa75db))[_0x32c4('0x42')](handleError(_0x28ca91,null));};exports[_0x32c4('0x43')]=function(_0x49d81c,_0x294092){var _0xc1930f={'raw':!![],'where':{'id':_0x49d81c[_0x32c4('0x44')]['id']}},_0x482584={};_0x482584[_0x32c4('0x2e')]=_[_0x32c4('0x31')](db[_0x32c4('0x2b')]['rawAttributes']);_0x482584[_0x32c4('0x30')]=_[_0x32c4('0x31')](_0x49d81c[_0x32c4('0x30')]);_0x482584[_0x32c4('0x39')]=_[_0x32c4('0x32')](_0x482584[_0x32c4('0x2e')],_0x482584[_0x32c4('0x30')]);_0xc1930f['attributes']=_['intersection'](_0x482584[_0x32c4('0x2e')],qs['fields'](_0x49d81c['query']['fields']));_0xc1930f[_0x32c4('0x33')]=_0xc1930f['attributes'][_0x32c4('0x45')]?_0xc1930f['attributes']:_0x482584[_0x32c4('0x2e')];if(_0x49d81c['query'][_0x32c4('0x3f')]){_0xc1930f[_0x32c4('0x40')]=[{'all':!![]}];}_0xc1930f=_[_0x32c4('0x3c')]({},_0xc1930f,_0x49d81c[_0x32c4('0x3e')]);return db[_0x32c4('0x2b')][_0x32c4('0x46')](_0xc1930f)[_0x32c4('0x23')](handleEntityNotFound(_0x294092,null))[_0x32c4('0x23')](respondWithResult(_0x294092,null))['catch'](handleError(_0x294092,null));};exports[_0x32c4('0x47')]=function(_0x2050e4,_0x2fa0de){return db[_0x32c4('0x2b')][_0x32c4('0x47')](_0x2050e4[_0x32c4('0x48')],{})['then'](respondWithResult(_0x2fa0de,0xc9))[_0x32c4('0x42')](handleError(_0x2fa0de,null));};exports[_0x32c4('0x49')]=function(_0x4d48d1,_0x3b693d){if(_0x4d48d1[_0x32c4('0x48')]['id']){delete _0x4d48d1[_0x32c4('0x48')]['id'];}return db[_0x32c4('0x2b')]['find']({'where':{'id':_0x4d48d1[_0x32c4('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b693d,null))['then'](saveUpdates(_0x4d48d1[_0x32c4('0x48')],null))[_0x32c4('0x23')](respondWithResult(_0x3b693d,null))[_0x32c4('0x42')](handleError(_0x3b693d,null));};exports['destroy']=function(_0x1de38e,_0x5984de){return db[_0x32c4('0x2b')][_0x32c4('0x46')]({'where':{'id':_0x1de38e[_0x32c4('0x44')]['id']}})[_0x32c4('0x23')](handleEntityNotFound(_0x5984de,null))[_0x32c4('0x23')](removeEntity(_0x5984de,null))['catch'](handleError(_0x5984de,null));};exports[_0x32c4('0x4a')]=function(_0xf933ef,_0x2370da){return db[_0x32c4('0x2b')][_0x32c4('0x4a')]()[_0x32c4('0x23')](respondWithResult(_0x2370da,null))[_0x32c4('0x42')](handleError(_0x2370da,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9818188..4d0e6f2 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 _0x2c46=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xbdd0a3,_0x5aec74){var _0x58f89a=function(_0xa13f71){while(--_0xa13f71){_0xbdd0a3['push'](_0xbdd0a3['shift']());}};_0x58f89a(++_0x5aec74);}(_0x2c46,0x6f));var _0x62c4=function(_0x873500,_0x3f8480){_0x873500=_0x873500-0x0;var _0x5eedcb=_0x2c46[_0x873500];return _0x5eedcb;};'use strict';var _=require('lodash');var util=require(_0x62c4('0x0'));var logger=require(_0x62c4('0x1'))(_0x62c4('0x2'));var moment=require(_0x62c4('0x3'));var BPromise=require(_0x62c4('0x4'));var rp=require(_0x62c4('0x5'));var fs=require('fs');var path=require(_0x62c4('0x6'));var rimraf=require(_0x62c4('0x7'));var config=require(_0x62c4('0x8'));var attributes=require(_0x62c4('0x9'));module[_0x62c4('0xa')]=function(_0x400057,_0x2a719e){return _0x400057[_0x62c4('0xb')](_0x62c4('0xc'),attributes,{'tableName':_0x62c4('0xd'),'paranoid':![],'indexes':[{'name':_0x62c4('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x535d=['exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x535d,0xe8));var _0xd535=function(_0x2a44d3,_0x27c980){_0x2a44d3=_0x2a44d3-0x0;var _0x25c4bc=_0x535d[_0x2a44d3];return _0x25c4bc;};'use strict';var _=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var logger=require('../../config/logger')(_0xd535('0x2'));var moment=require(_0xd535('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd535('0x4'));var rimraf=require(_0xd535('0x5'));var config=require(_0xd535('0x6'));var attributes=require(_0xd535('0x7'));module[_0xd535('0x8')]=function(_0xa9d48d,_0x4a25fa){return _0xa9d48d['define'](_0xd535('0x9'),attributes,{'tableName':_0xd535('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd535('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5239799..915626e 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 _0x4815=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4815,0xa9));var _0x5481=function(_0x124ab4,_0x2b3dec){_0x124ab4=_0x124ab4-0x0;var _0x3779b6=_0x4815[_0x124ab4];return _0x3779b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5481('0x0'));var BPromise=require(_0x5481('0x1'));var rs=require(_0x5481('0x2'));var fs=require('fs');var Redis=require(_0x5481('0x3'));var db=require(_0x5481('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5481('0x5'))(_0x5481('0x6'));var config=require('../../config/environment');var jayson=require(_0x5481('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x119e4b,_0x5e4650,_0x20cc30){return new BPromise(function(_0x4648e6,_0x41cd9b){return client[_0x5481('0x8')](_0x119e4b,_0x20cc30)[_0x5481('0x9')](function(_0x101c0b){logger[_0x5481('0xa')](_0x5481('0xb'),_0x5e4650,_0x5481('0xc'));logger['debug'](_0x5481('0xd'),_0x5e4650,_0x5481('0xc'),JSON['stringify'](_0x101c0b));if(_0x101c0b[_0x5481('0xe')]){if(_0x101c0b[_0x5481('0xe')][_0x5481('0xf')]===0x1f4){logger[_0x5481('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x5e4650,_0x101c0b[_0x5481('0xe')][_0x5481('0x10')]);return _0x41cd9b(_0x101c0b['error']['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5e4650,_0x101c0b['error']['message']);return _0x4648e6(_0x101c0b['error']['message']);}else{logger[_0x5481('0xa')](_0x5481('0xb'),_0x5e4650,_0x5481('0xc'));_0x4648e6(_0x101c0b[_0x5481('0x11')][_0x5481('0x10')]);}})[_0x5481('0x12')](function(_0x44f49e){logger[_0x5481('0xe')](_0x5481('0xb'),_0x5e4650,_0x44f49e);_0x41cd9b(_0x44f49e);});});} \ No newline at end of file +var _0x9388=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x379fff,_0x4c6b70){var _0x3cd70c=function(_0x50edbb){while(--_0x50edbb){_0x379fff['push'](_0x379fff['shift']());}};_0x3cd70c(++_0x4c6b70);}(_0x9388,0x1e8));var _0x8938=function(_0x5eaf1e,_0x13f2f2){_0x5eaf1e=_0x5eaf1e-0x0;var _0x16520f=_0x9388[_0x5eaf1e];return _0x16520f;};'use strict';var _=require(_0x8938('0x0'));var util=require(_0x8938('0x1'));var moment=require(_0x8938('0x2'));var BPromise=require(_0x8938('0x3'));var rs=require(_0x8938('0x4'));var fs=require('fs');var Redis=require(_0x8938('0x5'));var db=require(_0x8938('0x6'))['db'];var utils=require(_0x8938('0x7'));var logger=require(_0x8938('0x8'))(_0x8938('0x9'));var config=require('../../config/environment');var jayson=require(_0x8938('0xa'));var client=jayson[_0x8938('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb30b,_0x1c1d23,_0x4c8e24){return new BPromise(function(_0x12dcc9,_0x35a9a5){return client[_0x8938('0xc')](_0x5bb30b,_0x4c8e24)[_0x8938('0xd')](function(_0x2230e2){logger['info'](_0x8938('0xe'),_0x1c1d23,_0x8938('0xf'));logger[_0x8938('0x10')](_0x8938('0x11'),_0x1c1d23,_0x8938('0xf'),JSON[_0x8938('0x12')](_0x2230e2));if(_0x2230e2[_0x8938('0x13')]){if(_0x2230e2[_0x8938('0x13')][_0x8938('0x14')]===0x1f4){logger[_0x8938('0x13')](_0x8938('0xe'),_0x1c1d23,_0x2230e2[_0x8938('0x13')][_0x8938('0x15')]);return _0x35a9a5(_0x2230e2[_0x8938('0x13')][_0x8938('0x15')]);}logger[_0x8938('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x1c1d23,_0x2230e2['error']['message']);return _0x12dcc9(_0x2230e2['error'][_0x8938('0x15')]);}else{logger[_0x8938('0x16')]('MailTransferReport,\x20%s,\x20%s',_0x1c1d23,_0x8938('0xf'));_0x12dcc9(_0x2230e2[_0x8938('0x17')][_0x8938('0x15')]);}})['catch'](function(_0xa5f933){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x1c1d23,_0xa5f933);_0x35a9a5(_0xa5f933);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 0fc7115..9726725 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 _0x81fc=['fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated','get','describe','/:id','show','post','put','update','exports','multer','util','path','express','Router'];(function(_0x5177f5,_0x509b1f){var _0x712aba=function(_0x4514da){while(--_0x4514da){_0x5177f5['push'](_0x5177f5['shift']());}};_0x712aba(++_0x509b1f);}(_0x81fc,0x1f3));var _0xc81f=function(_0x1bf917,_0x49c9bd){_0x1bf917=_0x1bf917-0x0;var _0x4d80d4=_0x81fc[_0x1bf917];return _0x4d80d4;};'use strict';var multer=require(_0xc81f('0x0'));var util=require(_0xc81f('0x1'));var path=require(_0xc81f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc81f('0x3'));var router=express[_0xc81f('0x4')]();var fs_extra=require(_0xc81f('0x5'));var auth=require(_0xc81f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc81f('0x7'));var controller=require(_0xc81f('0x8'));router['get']('/',auth[_0xc81f('0x9')](),controller['index']);router[_0xc81f('0xa')]('/describe',auth[_0xc81f('0x9')](),controller[_0xc81f('0xb')]);router[_0xc81f('0xa')](_0xc81f('0xc'),auth[_0xc81f('0x9')](),controller[_0xc81f('0xd')]);router[_0xc81f('0xe')]('/',auth[_0xc81f('0x9')](),controller['create']);router[_0xc81f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc81f('0x10')]);router['delete'](_0xc81f('0xc'),auth[_0xc81f('0x9')](),controller['destroy']);module[_0xc81f('0x11')]=router; \ No newline at end of file +var _0x9379=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x9379,0x14b));var _0x9937=function(_0x37aab4,_0xb7cc1e){_0x37aab4=_0x37aab4-0x0;var _0x16949a=_0x9379[_0x37aab4];return _0x16949a;};'use strict';var multer=require(_0x9937('0x0'));var util=require(_0x9937('0x1'));var path=require('path');var timeout=require(_0x9937('0x2'));var express=require(_0x9937('0x3'));var router=express[_0x9937('0x4')]();var fs_extra=require(_0x9937('0x5'));var auth=require(_0x9937('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9937('0x7'));var controller=require(_0x9937('0x8'));router[_0x9937('0x9')]('/',auth[_0x9937('0xa')](),controller[_0x9937('0xb')]);router[_0x9937('0x9')](_0x9937('0xc'),auth[_0x9937('0xa')](),controller[_0x9937('0xd')]);router[_0x9937('0x9')](_0x9937('0xe'),auth[_0x9937('0xa')](),controller[_0x9937('0xf')]);router[_0x9937('0x10')]('/',auth[_0x9937('0xa')](),controller[_0x9937('0x11')]);router[_0x9937('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9937('0x13')]);router[_0x9937('0x14')](_0x9937('0xe'),auth[_0x9937('0xa')](),controller[_0x9937('0x15')]);module[_0x9937('0x16')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index d707d68..a33acfb 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 _0x73ad=['DATE','getDataValue','enterAt','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x73ad,0xa3));var _0xd73a=function(_0x5b230a,_0x6b9b6f){_0x5b230a=_0x5b230a-0x0;var _0x74827d=_0x73ad[_0x5b230a];return _0x74827d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd73a('0x0'));module[_0xd73a('0x1')]={'channel':{'type':Sequelize[_0xd73a('0x2')]},'membername':{'type':Sequelize[_0xd73a('0x2')]},'interface':{'type':Sequelize[_0xd73a('0x2')]},'type':{'type':Sequelize[_0xd73a('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xd73a('0x3')},'duration':{'type':Sequelize[_0xd73a('0x4')]},'enterAt':{'type':Sequelize[_0xd73a('0x5')]},'exitAt':{'type':Sequelize[_0xd73a('0x5')],'set':function(_0x50bd19){var _0x1c84d4=moment(_0x50bd19);var _0x6bd944=moment(this[_0xd73a('0x6')](_0xd73a('0x7')));var _0x3aad3b=_0x1c84d4['diff'](_0x6bd944,_0xd73a('0x8'));this['setDataValue'](_0xd73a('0x9'),_0x50bd19);this['setDataValue'](_0xd73a('0xa'),_0x3aad3b>=0x0?_0x3aad3b:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xd73a('0xb')},'data2':{'type':Sequelize[_0xd73a('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xd73a('0x2')],'comment':_0xd73a('0xc')},'data4':{'type':Sequelize[_0xd73a('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xd73a('0x2')],'comment':_0xd73a('0xd')},'role':{'type':Sequelize[_0xd73a('0x2')]},'internal':{'type':Sequelize[_0xd73a('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51d3=['exports','STRING','DEFAULT\x20PAUSE','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','sequelize'];(function(_0x41bc31,_0x402a02){var _0x4ada39=function(_0x31a0ef){while(--_0x31a0ef){_0x41bc31['push'](_0x41bc31['shift']());}};_0x4ada39(++_0x402a02);}(_0x51d3,0x8b));var _0x351d=function(_0x65924e,_0x4e2f0d){_0x65924e=_0x65924e-0x0;var _0x5e85b8=_0x51d3[_0x65924e];return _0x5e85b8;};'use strict';var Sequelize=require(_0x351d('0x0'));var moment=require('moment');module[_0x351d('0x1')]={'channel':{'type':Sequelize[_0x351d('0x2')]},'membername':{'type':Sequelize[_0x351d('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x351d('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x351d('0x4')]},'exitAt':{'type':Sequelize[_0x351d('0x4')],'set':function(_0x294978){var _0x1702fb=moment(_0x294978);var _0x12faa5=moment(this['getDataValue'](_0x351d('0x5')));var _0x38c77b=_0x1702fb[_0x351d('0x6')](_0x12faa5,_0x351d('0x7'));this[_0x351d('0x8')](_0x351d('0x9'),_0x294978);this[_0x351d('0x8')](_0x351d('0xa'),_0x38c77b>=0x0?_0x38c77b:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x351d('0x2')],'comment':_0x351d('0xb')},'data3':{'type':Sequelize[_0x351d('0x2')],'comment':_0x351d('0xc')},'data4':{'type':Sequelize[_0x351d('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x351d('0x2')],'comment':_0x351d('0xd')},'role':{'type':Sequelize[_0x351d('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x351d('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 912238c..8bf9576 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 _0x3e74=['show','params','options','find','catch','create','body','describe','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','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x2d1f46,_0x548bea){var _0x5a6f7d=function(_0x36878d){while(--_0x36878d){_0x2d1f46['push'](_0x2d1f46['shift']());}};_0x5a6f7d(++_0x548bea);}(_0x3e74,0x175));var _0x43e7=function(_0x27d127,_0x51aaac){_0x27d127=_0x27d127-0x0;var _0x26ad6a=_0x3e74[_0x27d127];return _0x26ad6a;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,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(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x34e8,0x12c));var _0x834e=function(_0x3d3115,_0x319b46){_0x3d3115=_0x3d3115-0x0;var _0x1daa16=_0x34e8[_0x3d3115];return _0x1daa16;};'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 b7cfeb0..a3c77a9 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 _0xc0bc=['moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','interface','util','api'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xc0bc,0x136));var _0xcc0b=function(_0x5138e8,_0x45665c){_0x5138e8=_0x5138e8-0x0;var _0x504191=_0xc0bc[_0x5138e8];return _0x504191;};'use strict';var _=require('lodash');var util=require(_0xcc0b('0x0'));var logger=require('../../config/logger')(_0xcc0b('0x1'));var moment=require(_0xcc0b('0x2'));var BPromise=require('bluebird');var rp=require(_0xcc0b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc0b('0x4'));var config=require(_0xcc0b('0x5'));var attributes=require(_0xcc0b('0x6'));module['exports']=function(_0x5972bb,_0x4efa37){return _0x5972bb[_0xcc0b('0x7')](_0xcc0b('0x8'),attributes,{'tableName':_0xcc0b('0x9'),'paranoid':![],'indexes':[{'name':_0xcc0b('0xa'),'fields':['membername',_0xcc0b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacc6=['api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0x239292,_0x4662d5){var _0x478273=function(_0x510a55){while(--_0x510a55){_0x239292['push'](_0x239292['shift']());}};_0x478273(++_0x4662d5);}(_0xacc6,0x11d));var _0x6acc=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xacc6[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var logger=require(_0x6acc('0x2'))(_0x6acc('0x3'));var moment=require(_0x6acc('0x4'));var BPromise=require(_0x6acc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6acc('0x6'));var rimraf=require(_0x6acc('0x7'));var config=require(_0x6acc('0x8'));var attributes=require(_0x6acc('0x9'));module[_0x6acc('0xa')]=function(_0x21cc28,_0x21ca1b){return _0x21cc28[_0x6acc('0xb')]('MemberReport',attributes,{'tableName':_0x6acc('0xc'),'paranoid':![],'indexes':[{'name':_0x6acc('0xd'),'fields':[_0x6acc('0xe'),_0x6acc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7d6e998..c4adf03 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 _0x0618=['include','map','then','CreateMemberReport','create','body','UpdateMemberReport','update','where','limit','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','MemberReport','options','raw','attributes','model'];(function(_0x52c297,_0x5f050a){var _0x1369ac=function(_0x20617f){while(--_0x20617f){_0x52c297['push'](_0x52c297['shift']());}};_0x1369ac(++_0x5f050a);}(_0x0618,0x1c6));var _0x8061=function(_0x5c08aa,_0x415156){_0x5c08aa=_0x5c08aa-0x0;var _0x5f5857=_0x0618[_0x5c08aa];return _0x5f5857;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var moment=require('moment');var BPromise=require(_0x8061('0x2'));var rs=require(_0x8061('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8061('0x4'));var logger=require(_0x8061('0x5'))(_0x8061('0x6'));var config=require(_0x8061('0x7'));var jayson=require(_0x8061('0x8'));var client=jayson[_0x8061('0x9')][_0x8061('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c161b,_0x2c5e9d,_0x3bb894){return new BPromise(function(_0x7bfd18,_0x483d55){return client[_0x8061('0xb')](_0x9c161b,_0x3bb894)['then'](function(_0x286122){logger[_0x8061('0xc')](_0x8061('0xd'),_0x2c5e9d,_0x8061('0xe'));logger[_0x8061('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2c5e9d,'request\x20sent',JSON[_0x8061('0x10')](_0x286122));if(_0x286122[_0x8061('0x11')]){if(_0x286122['error']['code']===0x1f4){logger[_0x8061('0x11')](_0x8061('0xd'),_0x2c5e9d,_0x286122[_0x8061('0x11')][_0x8061('0x12')]);return _0x483d55(_0x286122[_0x8061('0x11')][_0x8061('0x12')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x2c5e9d,_0x286122[_0x8061('0x11')][_0x8061('0x12')]);return _0x7bfd18(_0x286122[_0x8061('0x11')][_0x8061('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x2c5e9d,_0x8061('0xe'));_0x7bfd18(_0x286122[_0x8061('0x13')][_0x8061('0x12')]);}})[_0x8061('0x14')](function(_0x127435){logger[_0x8061('0x11')](_0x8061('0xd'),_0x2c5e9d,_0x127435);_0x483d55(_0x127435);});});}exports[_0x8061('0x15')]=function(_0x2b0eab){var _0x4096ba=this;return new Promise(function(_0x14230e,_0x20d231){return db[_0x8061('0x16')]['findAll']({'raw':_0x2b0eab['options']?_0x2b0eab[_0x8061('0x17')][_0x8061('0x18')]===undefined?!![]:![]:!![],'where':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab['options']['where']||null:null,'attributes':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab[_0x8061('0x17')][_0x8061('0x19')]||null:null,'limit':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab['options']['limit']||null:null,'include':_0x2b0eab[_0x8061('0x17')]?_0x2b0eab[_0x8061('0x17')]['include']?_['map'](_0x2b0eab[_0x8061('0x17')]['include'],function(_0x535cc9){return{'model':db[_0x535cc9[_0x8061('0x1a')]],'as':_0x535cc9['as'],'attributes':_0x535cc9[_0x8061('0x19')],'include':_0x535cc9['include']?_['map'](_0x535cc9[_0x8061('0x1b')],function(_0x3f2765){return{'model':db[_0x3f2765['model']],'as':_0x3f2765['as'],'attributes':_0x3f2765[_0x8061('0x19')],'include':_0x3f2765[_0x8061('0x1b')]?_[_0x8061('0x1c')](_0x3f2765[_0x8061('0x1b')],function(_0x5f0822){return{'model':db[_0x5f0822['model']],'as':_0x5f0822['as'],'attributes':_0x5f0822[_0x8061('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8061('0x1d')](function(_0x19f400){logger[_0x8061('0xc')](_0x8061('0x15'),_0x2b0eab);logger['debug']('GetMemberReport',_0x2b0eab,JSON['stringify'](_0x19f400));_0x14230e(_0x19f400);})['catch'](function(_0xfb9138){logger[_0x8061('0x11')](_0x8061('0x15'),_0xfb9138[_0x8061('0x12')],_0x2b0eab);_0x20d231(_0x4096ba[_0x8061('0x11')](0x1f4,_0xfb9138[_0x8061('0x12')]));});});};exports[_0x8061('0x1e')]=function(_0x15ed1d){var _0x42d5a7=this;return new Promise(function(_0x28c274,_0x50ac44){return db['MemberReport'][_0x8061('0x1f')](_0x15ed1d[_0x8061('0x20')],{'raw':_0x15ed1d[_0x8061('0x17')]?_0x15ed1d[_0x8061('0x17')][_0x8061('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x147db0){logger[_0x8061('0xc')]('CreateMemberReport',_0x15ed1d);logger['debug'](_0x8061('0x1e'),_0x15ed1d,JSON[_0x8061('0x10')](_0x147db0));_0x28c274(_0x147db0);})['catch'](function(_0x1637fd){logger[_0x8061('0x11')](_0x8061('0x1e'),_0x1637fd[_0x8061('0x12')],_0x15ed1d);_0x50ac44(_0x42d5a7[_0x8061('0x11')](0x1f4,_0x1637fd[_0x8061('0x12')]));});});};exports[_0x8061('0x21')]=function(_0x1e8f0d){var _0x25f250=this;return new Promise(function(_0x5293da,_0x4467e2){return db[_0x8061('0x16')][_0x8061('0x22')](_0x1e8f0d[_0x8061('0x20')],{'raw':_0x1e8f0d['options']?_0x1e8f0d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8f0d['options']?_0x1e8f0d['options'][_0x8061('0x23')]||null:null,'attributes':_0x1e8f0d['options']?_0x1e8f0d[_0x8061('0x17')][_0x8061('0x19')]||null:null,'limit':_0x1e8f0d[_0x8061('0x17')]?_0x1e8f0d[_0x8061('0x17')][_0x8061('0x24')]||null:null})['then'](function(_0x2dbb19){logger[_0x8061('0xc')](_0x8061('0x21'),_0x1e8f0d);logger[_0x8061('0xf')](_0x8061('0x21'),_0x1e8f0d,JSON[_0x8061('0x10')](_0x2dbb19));_0x5293da(_0x2dbb19);})[_0x8061('0x14')](function(_0x2479dd){logger[_0x8061('0x11')](_0x8061('0x21'),_0x2479dd[_0x8061('0x12')],_0x1e8f0d);_0x4467e2(_0x25f250[_0x8061('0x11')](0x1f4,_0x2479dd['message']));});});}; \ No newline at end of file +var _0xb923=['raw','where','attributes','model','include','map','stringify','create','CreateMemberReport','catch','UpdateMemberReport','update','body','limit','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','info','result','GetMemberReport','MemberReport','findAll','options'];(function(_0x45bd44,_0x4c37ab){var _0x4f8f37=function(_0x5a3a45){while(--_0x5a3a45){_0x45bd44['push'](_0x45bd44['shift']());}};_0x4f8f37(++_0x4c37ab);}(_0xb923,0xa2));var _0x3b92=function(_0xc3b992,_0x49e807){_0xc3b992=_0xc3b992-0x0;var _0x212dc0=_0xb923[_0xc3b992];return _0x212dc0;};'use strict';var _=require(_0x3b92('0x0'));var util=require(_0x3b92('0x1'));var moment=require(_0x3b92('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b92('0x3'));var fs=require('fs');var Redis=require(_0x3b92('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b92('0x5'));var config=require(_0x3b92('0x6'));var jayson=require(_0x3b92('0x7'));var client=jayson[_0x3b92('0x8')][_0x3b92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b490c,_0x6809d9,_0x48b468){return new BPromise(function(_0x511c10,_0x2aefa5){return client['request'](_0x2b490c,_0x48b468)[_0x3b92('0xa')](function(_0x43b28a){logger['info'](_0x3b92('0xb'),_0x6809d9,_0x3b92('0xc'));logger[_0x3b92('0xd')](_0x3b92('0xe'),_0x6809d9,_0x3b92('0xc'),JSON['stringify'](_0x43b28a));if(_0x43b28a[_0x3b92('0xf')]){if(_0x43b28a['error']['code']===0x1f4){logger[_0x3b92('0xf')](_0x3b92('0xb'),_0x6809d9,_0x43b28a[_0x3b92('0xf')][_0x3b92('0x10')]);return _0x2aefa5(_0x43b28a['error']['message']);}logger[_0x3b92('0xf')]('MemberReport,\x20%s,\x20%s',_0x6809d9,_0x43b28a['error'][_0x3b92('0x10')]);return _0x511c10(_0x43b28a[_0x3b92('0xf')][_0x3b92('0x10')]);}else{logger[_0x3b92('0x11')](_0x3b92('0xb'),_0x6809d9,'request\x20sent');_0x511c10(_0x43b28a[_0x3b92('0x12')][_0x3b92('0x10')]);}})['catch'](function(_0x4e6da7){logger[_0x3b92('0xf')](_0x3b92('0xb'),_0x6809d9,_0x4e6da7);_0x2aefa5(_0x4e6da7);});});}exports[_0x3b92('0x13')]=function(_0x1859b4){var _0x3d7f80=this;return new Promise(function(_0xc2cd15,_0x361754){return db[_0x3b92('0x14')][_0x3b92('0x15')]({'raw':_0x1859b4[_0x3b92('0x16')]?_0x1859b4[_0x3b92('0x16')][_0x3b92('0x17')]===undefined?!![]:![]:!![],'where':_0x1859b4[_0x3b92('0x16')]?_0x1859b4['options'][_0x3b92('0x18')]||null:null,'attributes':_0x1859b4[_0x3b92('0x16')]?_0x1859b4[_0x3b92('0x16')][_0x3b92('0x19')]||null:null,'limit':_0x1859b4[_0x3b92('0x16')]?_0x1859b4[_0x3b92('0x16')]['limit']||null:null,'include':_0x1859b4[_0x3b92('0x16')]?_0x1859b4[_0x3b92('0x16')]['include']?_['map'](_0x1859b4['options']['include'],function(_0x450f2e){return{'model':db[_0x450f2e[_0x3b92('0x1a')]],'as':_0x450f2e['as'],'attributes':_0x450f2e[_0x3b92('0x19')],'include':_0x450f2e[_0x3b92('0x1b')]?_[_0x3b92('0x1c')](_0x450f2e[_0x3b92('0x1b')],function(_0x427a90){return{'model':db[_0x427a90['model']],'as':_0x427a90['as'],'attributes':_0x427a90[_0x3b92('0x19')],'include':_0x427a90['include']?_[_0x3b92('0x1c')](_0x427a90['include'],function(_0x24a15f){return{'model':db[_0x24a15f[_0x3b92('0x1a')]],'as':_0x24a15f['as'],'attributes':_0x24a15f[_0x3b92('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3b92('0xa')](function(_0x42fc82){logger[_0x3b92('0x11')]('GetMemberReport',_0x1859b4);logger[_0x3b92('0xd')](_0x3b92('0x13'),_0x1859b4,JSON[_0x3b92('0x1d')](_0x42fc82));_0xc2cd15(_0x42fc82);})['catch'](function(_0x4ac7b4){logger[_0x3b92('0xf')](_0x3b92('0x13'),_0x4ac7b4['message'],_0x1859b4);_0x361754(_0x3d7f80['error'](0x1f4,_0x4ac7b4[_0x3b92('0x10')]));});});};exports['CreateMemberReport']=function(_0x2d8b2e){var _0x4e404c=this;return new Promise(function(_0x5b8e18,_0x4a3596){return db[_0x3b92('0x14')][_0x3b92('0x1e')](_0x2d8b2e['body'],{'raw':_0x2d8b2e[_0x3b92('0x16')]?_0x2d8b2e[_0x3b92('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x3b92('0xa')](function(_0x44e13){logger[_0x3b92('0x11')]('CreateMemberReport',_0x2d8b2e);logger['debug'](_0x3b92('0x1f'),_0x2d8b2e,JSON[_0x3b92('0x1d')](_0x44e13));_0x5b8e18(_0x44e13);})[_0x3b92('0x20')](function(_0x55f9ad){logger['error'](_0x3b92('0x1f'),_0x55f9ad['message'],_0x2d8b2e);_0x4a3596(_0x4e404c[_0x3b92('0xf')](0x1f4,_0x55f9ad[_0x3b92('0x10')]));});});};exports[_0x3b92('0x21')]=function(_0x3b31e6){var _0x336f73=this;return new Promise(function(_0x1ec1e2,_0x415492){return db['MemberReport'][_0x3b92('0x22')](_0x3b31e6[_0x3b92('0x23')],{'raw':_0x3b31e6[_0x3b92('0x16')]?_0x3b31e6['options'][_0x3b92('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b31e6[_0x3b92('0x16')]?_0x3b31e6[_0x3b92('0x16')][_0x3b92('0x18')]||null:null,'attributes':_0x3b31e6[_0x3b92('0x16')]?_0x3b31e6[_0x3b92('0x16')][_0x3b92('0x19')]||null:null,'limit':_0x3b31e6[_0x3b92('0x16')]?_0x3b31e6[_0x3b92('0x16')][_0x3b92('0x24')]||null:null})[_0x3b92('0xa')](function(_0x14fec7){logger[_0x3b92('0x11')](_0x3b92('0x21'),_0x3b31e6);logger[_0x3b92('0xd')](_0x3b92('0x21'),_0x3b31e6,JSON[_0x3b92('0x1d')](_0x14fec7));_0x1ec1e2(_0x14fec7);})[_0x3b92('0x20')](function(_0x36aeb7){logger[_0x3b92('0xf')](_0x3b92('0x21'),_0x36aeb7[_0x3b92('0x10')],_0x3b31e6);_0x415492(_0x336f73[_0x3b92('0xf')](0x1f4,_0x36aeb7[_0x3b92('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4b10da5..a16ba6f 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 _0x1e92=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x2cfd0b,_0x12c7b2){var _0x57906e=function(_0x3e2743){while(--_0x3e2743){_0x2cfd0b['push'](_0x2cfd0b['shift']());}};_0x57906e(++_0x12c7b2);}(_0x1e92,0x1df));var _0x21e9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1e92[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e9('0x2')]();var fs_extra=require(_0x21e9('0x3'));var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',controller[_0x21e9('0x9')]);module[_0x21e9('0xa')]=router; \ No newline at end of file +var _0x280b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','multer','util','connect-timeout'];(function(_0x1ebf72,_0x2323de){var _0x289112=function(_0x2b318f){while(--_0x2b318f){_0x1ebf72['push'](_0x1ebf72['shift']());}};_0x289112(++_0x2323de);}(_0x280b,0xce));var _0xb280=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x280b[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var path=require('path');var timeout=require(_0xb280('0x2'));var express=require(_0xb280('0x3'));var router=express[_0xb280('0x4')]();var fs_extra=require(_0xb280('0x5'));var auth=require(_0xb280('0x6'));var interaction=require(_0xb280('0x7'));var config=require(_0xb280('0x8'));var controller=require(_0xb280('0x9'));router[_0xb280('0xa')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 2a43648..b39da1e 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 _0x0ce1=['STRING','version','sequelize','exports'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x0ce1,0x15a));var _0x10ce=function(_0x137388,_0x225667){_0x137388=_0x137388-0x0;var _0x488841=_0x0ce1[_0x137388];return _0x488841;};'use strict';var Sequelize=require(_0x10ce('0x0'));module[_0x10ce('0x1')]={'version':{'type':Sequelize[_0x10ce('0x2')],'unique':_0x10ce('0x3')}}; \ No newline at end of file +var _0x3442=['STRING','version','sequelize'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x3442,0x10d));var _0x2344=function(_0x427b3d,_0x7ac0b3){_0x427b3d=_0x427b3d-0x0;var _0x2ce42f=_0x3442[_0x427b3d];return _0x2ce42f;};'use strict';var Sequelize=require(_0x2344('0x0'));module['exports']={'version':{'type':Sequelize[_0x2344('0x1')],'unique':_0x2344('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 34b1d56..7b931f6 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 _0xbc96=['zip-dir','fast-json-patch','moment','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','index','Migration','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','eml-format','rimraf'];(function(_0x53e1c1,_0x61b844){var _0x545702=function(_0x3948b3){while(--_0x3948b3){_0x53e1c1['push'](_0x53e1c1['shift']());}};_0x545702(++_0x61b844);}(_0xbc96,0xca));var _0x6bc9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbc96[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x6bc9('0x0'));var rimraf=require(_0x6bc9('0x1'));var zipdir=require(_0x6bc9('0x2'));var jsonpatch=require(_0x6bc9('0x3'));var rp=require('request-promise');var moment=require(_0x6bc9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6bc9('0x5'));var path=require(_0x6bc9('0x6'));var sox=require(_0x6bc9('0x7'));var csv=require('to-csv');var ejs=require(_0x6bc9('0x8'));var fs=require('fs');var fs_extra=require(_0x6bc9('0x9'));var _=require(_0x6bc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6bc9('0xb'));var deskjs=require(_0x6bc9('0xc'));var toCsv=require(_0x6bc9('0xd'));var querystring=require(_0x6bc9('0xe'));var Papa=require(_0x6bc9('0xf'));var Redis=require(_0x6bc9('0x10'));var authService=require(_0x6bc9('0x11'));var qs=require(_0x6bc9('0x12'));var as=require(_0x6bc9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bc9('0x14'))(_0x6bc9('0x15'));var utils=require(_0x6bc9('0x16'));var config=require(_0x6bc9('0x17'));var licenseUtil=require(_0x6bc9('0x18'));var db=require(_0x6bc9('0x19'))['db'];function respondWithStatusCode(_0x3b3373,_0x550551){_0x550551=_0x550551||0xcc;return function(_0xa5223f){if(_0xa5223f){return _0x3b3373[_0x6bc9('0x1a')](_0x550551);}return _0x3b3373[_0x6bc9('0x1b')](_0x550551)[_0x6bc9('0x1c')]();};}function respondWithResult(_0x9e2b6,_0x5a9327){_0x5a9327=_0x5a9327||0xc8;return function(_0x2105f7){if(_0x2105f7){return _0x9e2b6[_0x6bc9('0x1b')](_0x5a9327)[_0x6bc9('0x1d')](_0x2105f7);}};}function respondWithFilteredResult(_0x4698f0,_0x502dc8){return function(_0x51ad8c){if(_0x51ad8c){var _0x15a3b0=typeof _0x502dc8[_0x6bc9('0x1e')]===_0x6bc9('0x1f')&&typeof _0x502dc8['limit']===_0x6bc9('0x1f');var _0x2d23d6=_0x51ad8c[_0x6bc9('0x20')];var _0x2ca785=_0x15a3b0?0x0:_0x502dc8[_0x6bc9('0x1e')];var _0x9c56e7=_0x15a3b0?_0x51ad8c[_0x6bc9('0x20')]:_0x502dc8['offset']+_0x502dc8['limit'];var _0x32b0b7;if(_0x9c56e7>=_0x2d23d6){_0x9c56e7=_0x2d23d6;_0x32b0b7=0xc8;}else{_0x32b0b7=0xce;}_0x4698f0[_0x6bc9('0x1b')](_0x32b0b7);return _0x4698f0[_0x6bc9('0x21')]('Content-Range',_0x2ca785+'-'+_0x9c56e7+'/'+_0x2d23d6)[_0x6bc9('0x1d')](_0x51ad8c);}return null;};}function patchUpdates(_0x5c5302){return function(_0x297f95){try{jsonpatch[_0x6bc9('0x22')](_0x297f95,_0x5c5302,!![]);}catch(_0x1e97ea){return BPromise[_0x6bc9('0x23')](_0x1e97ea);}return _0x297f95[_0x6bc9('0x24')]();};}function saveUpdates(_0x2189bd,_0x28dbef){return function(_0x31fae5){if(_0x31fae5){return _0x31fae5[_0x6bc9('0x25')](_0x2189bd)[_0x6bc9('0x26')](function(_0x1f7350){return _0x1f7350;});}return null;};}function removeEntity(_0x52e8a1,_0x2492f6){return function(_0x5b6789){if(_0x5b6789){return _0x5b6789[_0x6bc9('0x27')]()[_0x6bc9('0x26')](function(){_0x52e8a1['status'](0xcc)[_0x6bc9('0x1c')]();});}};}function handleEntityNotFound(_0x1956e0,_0x418802){return function(_0x5ad3c5){if(!_0x5ad3c5){_0x1956e0[_0x6bc9('0x1a')](0x194);}return _0x5ad3c5;};}function handleError(_0x1e417a,_0x55a639){_0x55a639=_0x55a639||0x1f4;return function(_0x389b2b){logger['error'](_0x389b2b[_0x6bc9('0x28')]);if(_0x389b2b['name']){delete _0x389b2b[_0x6bc9('0x29')];}_0x1e417a[_0x6bc9('0x1b')](_0x55a639)['send'](_0x389b2b);};}exports[_0x6bc9('0x2a')]=function(_0x4e135b,_0x5193a7){var _0x1f0012={},_0x5c149d={},_0x6d84c5={'count':0x0,'rows':[]};var _0x1d5078=_['map'](db[_0x6bc9('0x2b')][_0x6bc9('0x2c')],function(_0x2a2044){return{'name':_0x2a2044[_0x6bc9('0x2d')],'type':_0x2a2044[_0x6bc9('0x2e')][_0x6bc9('0x2f')]};});_0x5c149d['model']=_['map'](_0x1d5078,_0x6bc9('0x29'));_0x5c149d['query']=_['keys'](_0x4e135b[_0x6bc9('0x30')]);_0x5c149d[_0x6bc9('0x31')]=_[_0x6bc9('0x32')](_0x5c149d['model'],_0x5c149d[_0x6bc9('0x30')]);_0x1f0012[_0x6bc9('0x33')]=_[_0x6bc9('0x32')](_0x5c149d['model'],qs[_0x6bc9('0x34')](_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x34')]));_0x1f0012[_0x6bc9('0x33')]=_0x1f0012[_0x6bc9('0x33')]['length']?_0x1f0012[_0x6bc9('0x33')]:_0x5c149d[_0x6bc9('0x35')];if(!_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x36')](_0x6bc9('0x37'))){_0x1f0012[_0x6bc9('0x38')]=qs[_0x6bc9('0x38')](_0x4e135b['query'][_0x6bc9('0x38')]);_0x1f0012[_0x6bc9('0x1e')]=qs[_0x6bc9('0x1e')](_0x4e135b['query']['offset']);}_0x1f0012[_0x6bc9('0x39')]=qs[_0x6bc9('0x3a')](_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x3a')]);_0x1f0012[_0x6bc9('0x3b')]=qs[_0x6bc9('0x31')](_[_0x6bc9('0x3c')](_0x4e135b['query'],_0x5c149d[_0x6bc9('0x31')]),_0x1d5078);if(_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x3d')]){_0x1f0012[_0x6bc9('0x3b')]=_[_0x6bc9('0x3e')](_0x1f0012[_0x6bc9('0x3b')],{'$or':_['map'](_0x1d5078,function(_0x3b6307){if(_0x3b6307[_0x6bc9('0x2e')]!=='VIRTUAL'){var _0x54f85c={};_0x54f85c[_0x3b6307[_0x6bc9('0x29')]]={'$like':'%'+_0x4e135b[_0x6bc9('0x30')]['filter']+'%'};return _0x54f85c;}})});}_0x1f0012=_['merge']({},_0x1f0012,_0x4e135b[_0x6bc9('0x3f')]);var _0x58efca={'where':_0x1f0012[_0x6bc9('0x3b')]};return db[_0x6bc9('0x2b')][_0x6bc9('0x20')](_0x58efca)['then'](function(_0x417444){_0x6d84c5[_0x6bc9('0x20')]=_0x417444;if(_0x4e135b[_0x6bc9('0x30')][_0x6bc9('0x40')]){_0x1f0012['include']=[{'all':!![]}];}return db[_0x6bc9('0x2b')][_0x6bc9('0x41')](_0x1f0012);})[_0x6bc9('0x26')](function(_0xfb6dde){_0x6d84c5[_0x6bc9('0x42')]=_0xfb6dde;return _0x6d84c5;})['then'](respondWithFilteredResult(_0x5193a7,_0x1f0012))[_0x6bc9('0x43')](handleError(_0x5193a7,null));}; \ No newline at end of file +var _0xabe1=['then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Migration','includeAll','findAll','rows','catch','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy'];(function(_0x4f263d,_0x5dd636){var _0x215103=function(_0x140433){while(--_0x140433){_0x4f263d['push'](_0x4f263d['shift']());}};_0x215103(++_0x5dd636);}(_0xabe1,0x147));var _0x1abe=function(_0x46de4d,_0x411100){_0x46de4d=_0x46de4d-0x0;var _0x474d08=_0xabe1[_0x46de4d];return _0x474d08;};'use strict';var emlformat=require(_0x1abe('0x0'));var rimraf=require(_0x1abe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1abe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1abe('0x3'));var util=require(_0x1abe('0x4'));var path=require(_0x1abe('0x5'));var sox=require('sox');var csv=require(_0x1abe('0x6'));var ejs=require(_0x1abe('0x7'));var fs=require('fs');var fs_extra=require(_0x1abe('0x8'));var _=require(_0x1abe('0x9'));var squel=require(_0x1abe('0xa'));var crypto=require(_0x1abe('0xb'));var jsforce=require(_0x1abe('0xc'));var deskjs=require(_0x1abe('0xd'));var toCsv=require(_0x1abe('0x6'));var querystring=require(_0x1abe('0xe'));var Papa=require(_0x1abe('0xf'));var Redis=require(_0x1abe('0x10'));var authService=require(_0x1abe('0x11'));var qs=require(_0x1abe('0x12'));var as=require(_0x1abe('0x13'));var hardwareService=require(_0x1abe('0x14'));var logger=require(_0x1abe('0x15'))(_0x1abe('0x16'));var utils=require(_0x1abe('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1abe('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c205,_0x563351){_0x563351=_0x563351||0xcc;return function(_0xf0c25c){if(_0xf0c25c){return _0x11c205[_0x1abe('0x19')](_0x563351);}return _0x11c205[_0x1abe('0x1a')](_0x563351)['end']();};}function respondWithResult(_0x22f754,_0x1fe865){_0x1fe865=_0x1fe865||0xc8;return function(_0x11e907){if(_0x11e907){return _0x22f754[_0x1abe('0x1a')](_0x1fe865)[_0x1abe('0x1b')](_0x11e907);}};}function respondWithFilteredResult(_0x2ea416,_0x38307e){return function(_0x1ba1b3){if(_0x1ba1b3){var _0x5edad3=typeof _0x38307e[_0x1abe('0x1c')]===_0x1abe('0x1d')&&typeof _0x38307e[_0x1abe('0x1e')]===_0x1abe('0x1d');var _0x19b159=_0x1ba1b3['count'];var _0x117cea=_0x5edad3?0x0:_0x38307e[_0x1abe('0x1c')];var _0x1edacb=_0x5edad3?_0x1ba1b3[_0x1abe('0x1f')]:_0x38307e[_0x1abe('0x1c')]+_0x38307e[_0x1abe('0x1e')];var _0x58fa1a;if(_0x1edacb>=_0x19b159){_0x1edacb=_0x19b159;_0x58fa1a=0xc8;}else{_0x58fa1a=0xce;}_0x2ea416[_0x1abe('0x1a')](_0x58fa1a);return _0x2ea416['set'](_0x1abe('0x20'),_0x117cea+'-'+_0x1edacb+'/'+_0x19b159)[_0x1abe('0x1b')](_0x1ba1b3);}return null;};}function patchUpdates(_0x571621){return function(_0x3f8a98){try{jsonpatch[_0x1abe('0x21')](_0x3f8a98,_0x571621,!![]);}catch(_0xf2b097){return BPromise[_0x1abe('0x22')](_0xf2b097);}return _0x3f8a98[_0x1abe('0x23')]();};}function saveUpdates(_0x2e2f1e,_0x1d3e8d){return function(_0x34e9a0){if(_0x34e9a0){return _0x34e9a0[_0x1abe('0x24')](_0x2e2f1e)['then'](function(_0x139e5e){return _0x139e5e;});}return null;};}function removeEntity(_0x13d98b,_0x38e86a){return function(_0x44fe16){if(_0x44fe16){return _0x44fe16[_0x1abe('0x25')]()[_0x1abe('0x26')](function(){_0x13d98b[_0x1abe('0x1a')](0xcc)[_0x1abe('0x27')]();});}};}function handleEntityNotFound(_0x19aff6,_0x1b8e6c){return function(_0x1a28d5){if(!_0x1a28d5){_0x19aff6[_0x1abe('0x19')](0x194);}return _0x1a28d5;};}function handleError(_0x20e3fa,_0xc7bef8){_0xc7bef8=_0xc7bef8||0x1f4;return function(_0x8f5fa5){logger[_0x1abe('0x28')](_0x8f5fa5[_0x1abe('0x29')]);if(_0x8f5fa5['name']){delete _0x8f5fa5[_0x1abe('0x2a')];}_0x20e3fa['status'](_0xc7bef8)[_0x1abe('0x2b')](_0x8f5fa5);};}exports[_0x1abe('0x2c')]=function(_0x5e1bbd,_0x1960f7){var _0x1ea4e6={},_0x445e37={},_0x43e347={'count':0x0,'rows':[]};var _0x41ed57=_['map'](db['Migration'][_0x1abe('0x2d')],function(_0x580133){return{'name':_0x580133[_0x1abe('0x2e')],'type':_0x580133[_0x1abe('0x2f')][_0x1abe('0x30')]};});_0x445e37['model']=_[_0x1abe('0x31')](_0x41ed57,'name');_0x445e37['query']=_[_0x1abe('0x32')](_0x5e1bbd[_0x1abe('0x33')]);_0x445e37[_0x1abe('0x34')]=_[_0x1abe('0x35')](_0x445e37[_0x1abe('0x36')],_0x445e37[_0x1abe('0x33')]);_0x1ea4e6[_0x1abe('0x37')]=_[_0x1abe('0x35')](_0x445e37['model'],qs[_0x1abe('0x38')](_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x38')]));_0x1ea4e6['attributes']=_0x1ea4e6[_0x1abe('0x37')][_0x1abe('0x39')]?_0x1ea4e6['attributes']:_0x445e37[_0x1abe('0x36')];if(!_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x3a')](_0x1abe('0x3b'))){_0x1ea4e6[_0x1abe('0x1e')]=qs[_0x1abe('0x1e')](_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x1e')]);_0x1ea4e6['offset']=qs[_0x1abe('0x1c')](_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x1c')]);}_0x1ea4e6[_0x1abe('0x3c')]=qs[_0x1abe('0x3d')](_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x3d')]);_0x1ea4e6[_0x1abe('0x3e')]=qs[_0x1abe('0x34')](_[_0x1abe('0x3f')](_0x5e1bbd[_0x1abe('0x33')],_0x445e37['filters']),_0x41ed57);if(_0x5e1bbd['query'][_0x1abe('0x40')]){_0x1ea4e6[_0x1abe('0x3e')]=_[_0x1abe('0x41')](_0x1ea4e6[_0x1abe('0x3e')],{'$or':_['map'](_0x41ed57,function(_0x80526d){if(_0x80526d[_0x1abe('0x2f')]!==_0x1abe('0x42')){var _0x488c34={};_0x488c34[_0x80526d[_0x1abe('0x2a')]]={'$like':'%'+_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x40')]+'%'};return _0x488c34;}})});}_0x1ea4e6=_[_0x1abe('0x41')]({},_0x1ea4e6,_0x5e1bbd[_0x1abe('0x43')]);var _0x21c491={'where':_0x1ea4e6['where']};return db[_0x1abe('0x44')][_0x1abe('0x1f')](_0x21c491)['then'](function(_0x329e0a){_0x43e347['count']=_0x329e0a;if(_0x5e1bbd[_0x1abe('0x33')][_0x1abe('0x45')]){_0x1ea4e6['include']=[{'all':!![]}];}return db[_0x1abe('0x44')][_0x1abe('0x46')](_0x1ea4e6);})[_0x1abe('0x26')](function(_0x402dc4){_0x43e347[_0x1abe('0x47')]=_0x402dc4;return _0x43e347;})[_0x1abe('0x26')](respondWithFilteredResult(_0x1960f7,_0x1ea4e6))[_0x1abe('0x48')](handleError(_0x1960f7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 764b316..ee76520 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 _0x031c=['moment','bluebird','path','rimraf','exports','lodash','util','../../config/logger'];(function(_0x3d4ade,_0x1b6ac1){var _0x422fed=function(_0x1bdba5){while(--_0x1bdba5){_0x3d4ade['push'](_0x3d4ade['shift']());}};_0x422fed(++_0x1b6ac1);}(_0x031c,0xcd));var _0xc031=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x031c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc031('0x0'));var util=require(_0xc031('0x1'));var logger=require(_0xc031('0x2'))('api');var moment=require(_0xc031('0x3'));var BPromise=require(_0xc031('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc031('0x5'));var rimraf=require(_0xc031('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0xc031('0x7')]=function(_0x30114a,_0x18ef6f){return _0x30114a['define']('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9dd=['Migration','migrations','lodash','util','api','bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x425ec8,_0x293ff){var _0x1cbf90=function(_0x1a1974){while(--_0x1a1974){_0x425ec8['push'](_0x425ec8['shift']());}};_0x1cbf90(++_0x293ff);}(_0xc9dd,0x13a));var _0xdc9d=function(_0x3fbc93,_0x4430e8){_0x3fbc93=_0x3fbc93-0x0;var _0x6b5f15=_0xc9dd[_0x3fbc93];return _0x6b5f15;};'use strict';var _=require(_0xdc9d('0x0'));var util=require(_0xdc9d('0x1'));var logger=require('../../config/logger')(_0xdc9d('0x2'));var moment=require('moment');var BPromise=require(_0xdc9d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc9d('0x4'));var rimraf=require(_0xdc9d('0x5'));var config=require(_0xdc9d('0x6'));var attributes=require(_0xdc9d('0x7'));module[_0xdc9d('0x8')]=function(_0x4fd55e,_0x56545a){return _0x4fd55e[_0xdc9d('0x9')](_0xdc9d('0xa'),attributes,{'tableName':_0xdc9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 8e59057..2abe9c6 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 _0x534d=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x359dea,_0x4b17ab){var _0x347148=function(_0x3c7dba){while(--_0x3c7dba){_0x359dea['push'](_0x359dea['shift']());}};_0x347148(++_0x4b17ab);}(_0x534d,0x79));var _0xd534=function(_0x4faeef,_0x189288){_0x4faeef=_0x4faeef-0x0;var _0x50c9c7=_0x534d[_0x4faeef];return _0x50c9c7;};'use strict';var _=require(_0xd534('0x0'));var util=require(_0xd534('0x1'));var moment=require(_0xd534('0x2'));var BPromise=require(_0xd534('0x3'));var rs=require(_0xd534('0x4'));var fs=require('fs');var Redis=require(_0xd534('0x5'));var db=require(_0xd534('0x6'))['db'];var utils=require(_0xd534('0x7'));var logger=require(_0xd534('0x8'))(_0xd534('0x9'));var config=require(_0xd534('0xa'));var jayson=require(_0xd534('0xb'));var client=jayson[_0xd534('0xc')][_0xd534('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1db778,_0x3c8772,_0x4419ee){return new BPromise(function(_0x1a00af,_0x2be8e1){return client['request'](_0x1db778,_0x4419ee)[_0xd534('0xe')](function(_0x37a2c8){logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,_0xd534('0x11'));logger['debug'](_0xd534('0x12'),_0x3c8772,_0xd534('0x11'),JSON[_0xd534('0x13')](_0x37a2c8));if(_0x37a2c8[_0xd534('0x14')]){if(_0x37a2c8[_0xd534('0x14')][_0xd534('0x15')]===0x1f4){logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8['error']['message']);return _0x2be8e1(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}logger[_0xd534('0x14')](_0xd534('0x10'),_0x3c8772,_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);return _0x1a00af(_0x37a2c8[_0xd534('0x14')][_0xd534('0x16')]);}else{logger[_0xd534('0xf')](_0xd534('0x10'),_0x3c8772,'request\x20sent');_0x1a00af(_0x37a2c8['result'][_0xd534('0x16')]);}})[_0xd534('0x17')](function(_0x398435){logger['error']('Migration,\x20%s,\x20%s',_0x3c8772,_0x398435);_0x2be8e1(_0x398435);});});} \ No newline at end of file +var _0x6d2e=['message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6d2e,0x97));var _0xe6d2=function(_0x4c2f30,_0xa91340){_0x4c2f30=_0x4c2f30-0x0;var _0xb8854d=_0x6d2e[_0x4c2f30];return _0xb8854d;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var moment=require(_0xe6d2('0x1'));var BPromise=require(_0xe6d2('0x2'));var rs=require(_0xe6d2('0x3'));var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6d2('0x7'));var client=jayson[_0xe6d2('0x8')][_0xe6d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d9c9f,_0x36d6ad,_0x53906e){return new BPromise(function(_0x2e227e,_0x2ce8cb){return client['request'](_0x4d9c9f,_0x53906e)[_0xe6d2('0xa')](function(_0xa7d0e1){logger['info'](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));logger['debug'](_0xe6d2('0xd'),_0x36d6ad,_0xe6d2('0xc'),JSON[_0xe6d2('0xe')](_0xa7d0e1));if(_0xa7d0e1[_0xe6d2('0xf')]){if(_0xa7d0e1['error'][_0xe6d2('0x10')]===0x1f4){logger[_0xe6d2('0xf')]('Migration,\x20%s,\x20%s',_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2ce8cb(_0xa7d0e1['error'][_0xe6d2('0x11')]);}logger[_0xe6d2('0xf')](_0xe6d2('0xb'),_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2e227e(_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);}else{logger[_0xe6d2('0x12')](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));_0x2e227e(_0xa7d0e1[_0xe6d2('0x13')][_0xe6d2('0x11')]);}})[_0xe6d2('0x14')](function(_0x2ad072){logger[_0xe6d2('0xf')]('Migration,\x20%s,\x20%s',_0x36d6ad,_0x2ad072);_0x2ce8cb(_0x2ad072);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 26738cf..1f2e247 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 _0x27de=['index','/:id','show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated'];(function(_0x70e30c,_0x243047){var _0x594a9d=function(_0x43a1f6){while(--_0x43a1f6){_0x70e30c['push'](_0x70e30c['shift']());}};_0x594a9d(++_0x243047);}(_0x27de,0x111));var _0xe27d=function(_0x4e518b,_0x3f51e4){_0x4e518b=_0x4e518b-0x0;var _0x257723=_0x27de[_0x4e518b];return _0x257723;};'use strict';var multer=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var path=require(_0xe27d('0x2'));var timeout=require(_0xe27d('0x3'));var express=require(_0xe27d('0x4'));var router=express[_0xe27d('0x5')]();var fs_extra=require(_0xe27d('0x6'));var auth=require(_0xe27d('0x7'));var interaction=require(_0xe27d('0x8'));var config=require('../../config/environment');var controller=require(_0xe27d('0x9'));router[_0xe27d('0xa')]('/',auth[_0xe27d('0xb')](),controller[_0xe27d('0xc')]);router[_0xe27d('0xa')](_0xe27d('0xd'),auth[_0xe27d('0xb')](),controller[_0xe27d('0xe')]);router['post']('/',auth[_0xe27d('0xb')](),controller[_0xe27d('0xf')]);router[_0xe27d('0x10')](_0xe27d('0xd'),auth[_0xe27d('0xb')](),controller[_0xe27d('0x11')]);router[_0xe27d('0x12')]('/:id',auth[_0xe27d('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xebc4=['isAuthenticated','get','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./network.controller'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xebc4,0xf9));var _0x4ebc=function(_0x2a9dcf,_0x4939b1){_0x2a9dcf=_0x2a9dcf-0x0;var _0x46560e=_0xebc4[_0x2a9dcf];return _0x46560e;};'use strict';var multer=require('multer');var util=require(_0x4ebc('0x0'));var path=require(_0x4ebc('0x1'));var timeout=require(_0x4ebc('0x2'));var express=require(_0x4ebc('0x3'));var router=express['Router']();var fs_extra=require(_0x4ebc('0x4'));var auth=require(_0x4ebc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4ebc('0x6'));router['get']('/',auth[_0x4ebc('0x7')](),controller['index']);router[_0x4ebc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4ebc('0x9')]('/',auth[_0x4ebc('0x7')](),controller[_0x4ebc('0xa')]);router[_0x4ebc('0xb')](_0x4ebc('0xc'),auth[_0x4ebc('0x7')](),controller[_0x4ebc('0xd')]);router[_0x4ebc('0xe')](_0x4ebc('0xc'),auth[_0x4ebc('0x7')](),controller['destroy']);module[_0x4ebc('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 4d4b872..6ecf573 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 _0x1327=['turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1327,0x17c));var _0x7132=function(_0x2f715a,_0x515c5c){_0x2f715a=_0x2f715a-0x0;var _0x2aed7b=_0x1327[_0x2f715a];return _0x2aed7b;};'use strict';var Sequelize=require(_0x7132('0x0'));module[_0x7132('0x1')]={'type':{'type':Sequelize[_0x7132('0x2')](_0x7132('0x3'),_0x7132('0x4'),'stun',_0x7132('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7132('0x6')]}}; \ No newline at end of file +var _0x5bdd=['ENUM','externip','stun','turn','STRING','exports'];(function(_0x8b7a73,_0x56aab2){var _0x280ac9=function(_0xca311){while(--_0xca311){_0x8b7a73['push'](_0x8b7a73['shift']());}};_0x280ac9(++_0x56aab2);}(_0x5bdd,0x95));var _0xd5bd=function(_0x479037,_0x35dd00){_0x479037=_0x479037-0x0;var _0x544fa7=_0x5bdd[_0x479037];return _0x544fa7;};'use strict';var Sequelize=require('sequelize');module[_0xd5bd('0x0')]={'type':{'type':Sequelize[_0xd5bd('0x1')]('localnet',_0xd5bd('0x2'),_0xd5bd('0x3'),_0xd5bd('0x4'))},'value':{'type':Sequelize[_0xd5bd('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7c13ee0..27b6e78 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 _0xbd0f=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','Network','includeAll','include','findAll','rows','keys','length','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','res_stun_monitor.so','TURN','root','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','chan_sip.so','update','STUN','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','end','sendStatus','stack','name','send'];(function(_0x4cc017,_0x43eecf){var _0x477041=function(_0x3a1fb7){while(--_0x3a1fb7){_0x4cc017['push'](_0x4cc017['shift']());}};_0x477041(++_0x43eecf);}(_0xbd0f,0x13a));var _0xfbd0=function(_0x16a6e2,_0x5279e3){_0x16a6e2=_0x16a6e2-0x0;var _0x2faa87=_0xbd0f[_0x16a6e2];return _0x2faa87;};'use strict';var util=require(_0xfbd0('0x0'));var path=require(_0xfbd0('0x1'));var ejs=require(_0xfbd0('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xfbd0('0x3'));var logger=require(_0xfbd0('0x4'))(_0xfbd0('0x5'));var config=require(_0xfbd0('0x6'));var db=require(_0xfbd0('0x7'))['db'];var jayson=require(_0xfbd0('0x8'));var client=jayson[_0xfbd0('0x9')][_0xfbd0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ab700,_0x3b14cb,_0x118615,_0x13a330){return new Promise(function(_0x54df2e,_0x555fa3){var _0x5722d3=_0x13a330||client;return _0x5722d3[_0xfbd0('0xb')](_0x1ab700,_0x118615)[_0xfbd0('0xc')](function(_0x1a5e7d){logger[_0xfbd0('0xd')](_0xfbd0('0xe'),_0x3b14cb,_0xfbd0('0xf'));logger[_0xfbd0('0x10')](_0xfbd0('0x11'),_0x3b14cb,_0xfbd0('0xf'),JSON[_0xfbd0('0x12')](_0x1a5e7d));if(_0x1a5e7d[_0xfbd0('0x13')]){if(_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x14')]===0x1f4){logger[_0xfbd0('0x13')]('Network,\x20%s,\x20%s',_0x3b14cb,_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);return _0x555fa3(_0x1a5e7d['error'][_0xfbd0('0x15')]);}logger['error'](_0xfbd0('0xe'),_0x3b14cb,_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);return _0x54df2e(_0x1a5e7d[_0xfbd0('0x13')][_0xfbd0('0x15')]);}else{logger['info'](_0xfbd0('0xe'),_0x3b14cb,_0xfbd0('0xf'));_0x54df2e(_0x1a5e7d[_0xfbd0('0x16')]['message']);}})[_0xfbd0('0x17')](function(_0x20497b){logger[_0xfbd0('0x13')](_0xfbd0('0xe'),_0x3b14cb,_0x20497b);_0x555fa3(_0x20497b);});});}function respondWithResult(_0x3538d5,_0x505324){_0x505324=_0x505324||0xc8;return function(_0x13cd7f){if(_0x13cd7f){return _0x3538d5[_0xfbd0('0x18')](_0x505324)[_0xfbd0('0x19')](_0x13cd7f);}};}function respondWithFilteredResult(_0x1f2c7,_0x212194){return function(_0x5c5f92){if(_0x5c5f92){var _0x57d84a=typeof _0x212194[_0xfbd0('0x1a')]==='undefined'&&typeof _0x212194['limit']===_0xfbd0('0x1b');var _0x2eaed0=_0x5c5f92[_0xfbd0('0x1c')];var _0x5c0a55=_0x57d84a?0x0:_0x212194[_0xfbd0('0x1a')];var _0x3b7da4=_0x57d84a?_0x5c5f92['count']:_0x212194[_0xfbd0('0x1a')]+_0x212194[_0xfbd0('0x1d')];var _0x1dbd4f;if(_0x3b7da4>=_0x2eaed0){_0x3b7da4=_0x2eaed0;_0x1dbd4f=0xc8;}else{_0x1dbd4f=0xce;}_0x1f2c7[_0xfbd0('0x18')](_0x1dbd4f);return _0x1f2c7[_0xfbd0('0x1e')](_0xfbd0('0x1f'),_0x5c0a55+'-'+_0x3b7da4+'/'+_0x2eaed0)[_0xfbd0('0x19')](_0x5c5f92);}return null;};}function saveUpdates(_0x457670){return function(_0x312d31){if(_0x312d31){return _0x312d31['update'](_0x457670)[_0xfbd0('0xc')](function(_0x4a26ca){return _0x4a26ca;});}return null;};}function removeEntity(_0x3f89c3){return function(_0x12fdc8){if(_0x12fdc8){return _0x12fdc8[_0xfbd0('0x20')]()[_0xfbd0('0xc')](function(){_0x3f89c3[_0xfbd0('0x18')](0xcc)[_0xfbd0('0x21')]();});}};}function handleEntityNotFound(_0x29aa9f){return function(_0x592975){if(!_0x592975){_0x29aa9f[_0xfbd0('0x22')](0x194);}return _0x592975;};}function handleError(_0x1a3d8,_0x466ce5){_0x466ce5=_0x466ce5||0x1f4;return function(_0x53db44){logger[_0xfbd0('0x13')](_0x53db44[_0xfbd0('0x23')]);if(_0x53db44[_0xfbd0('0x24')]){delete _0x53db44['name'];}_0x1a3d8[_0xfbd0('0x18')](_0x466ce5)[_0xfbd0('0x25')](_0x53db44);};}exports[_0xfbd0('0x26')]=function(_0x30628c,_0x276b5e){var _0x319441={},_0x2dc374={},_0x16a4ce={'count':0x0,'rows':[]};var _0x261d9f=_[_0xfbd0('0x27')](db['Network'][_0xfbd0('0x28')],function(_0x2713fc){return{'name':_0x2713fc[_0xfbd0('0x29')],'type':_0x2713fc[_0xfbd0('0x2a')][_0xfbd0('0x2b')]};});_0x2dc374[_0xfbd0('0x2c')]=_[_0xfbd0('0x27')](_0x261d9f,_0xfbd0('0x24'));_0x2dc374[_0xfbd0('0x2d')]=_['keys'](_0x30628c[_0xfbd0('0x2d')]);_0x2dc374[_0xfbd0('0x2e')]=_[_0xfbd0('0x2f')](_0x2dc374[_0xfbd0('0x2c')],_0x2dc374[_0xfbd0('0x2d')]);_0x319441['attributes']=_['intersection'](_0x2dc374[_0xfbd0('0x2c')],qs[_0xfbd0('0x30')](_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x30')]));_0x319441['attributes']=_0x319441[_0xfbd0('0x31')]['length']?_0x319441[_0xfbd0('0x31')]:_0x2dc374['model'];if(!_0x30628c['query']['hasOwnProperty']('nolimit')){_0x319441['limit']=qs[_0xfbd0('0x1d')](_0x30628c['query'][_0xfbd0('0x1d')]);_0x319441[_0xfbd0('0x1a')]=qs['offset'](_0x30628c[_0xfbd0('0x2d')]['offset']);}_0x319441[_0xfbd0('0x32')]=qs[_0xfbd0('0x33')](_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x33')]);_0x319441['where']=qs[_0xfbd0('0x2e')](_[_0xfbd0('0x34')](_0x30628c[_0xfbd0('0x2d')],_0x2dc374[_0xfbd0('0x2e')]),_0x261d9f);if(_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x35')]){_0x319441[_0xfbd0('0x36')]=_[_0xfbd0('0x37')](_0x319441[_0xfbd0('0x36')],{'$or':_['map'](_0x261d9f,function(_0x1394ab){if(_0x1394ab[_0xfbd0('0x2a')]!==_0xfbd0('0x38')){var _0x372571={};_0x372571[_0x1394ab[_0xfbd0('0x24')]]={'$like':'%'+_0x30628c['query'][_0xfbd0('0x35')]+'%'};return _0x372571;}})});}_0x319441=_[_0xfbd0('0x37')]({},_0x319441,_0x30628c['options']);var _0x3cf912={'where':_0x319441[_0xfbd0('0x36')]};return db[_0xfbd0('0x39')][_0xfbd0('0x1c')](_0x3cf912)[_0xfbd0('0xc')](function(_0x5f562d){_0x16a4ce[_0xfbd0('0x1c')]=_0x5f562d;if(_0x30628c[_0xfbd0('0x2d')][_0xfbd0('0x3a')]){_0x319441[_0xfbd0('0x3b')]=[{'all':!![]}];}return db[_0xfbd0('0x39')][_0xfbd0('0x3c')](_0x319441);})['then'](function(_0x239d51){_0x16a4ce[_0xfbd0('0x3d')]=_0x239d51;return _0x16a4ce;})[_0xfbd0('0xc')](respondWithFilteredResult(_0x276b5e,_0x319441))[_0xfbd0('0x17')](handleError(_0x276b5e,null));};exports['show']=function(_0x1f14ba,_0x347733){var _0x9967e1={'raw':!![],'where':{'id':_0x1f14ba['params']['id']}},_0x3be9b7={};_0x3be9b7[_0xfbd0('0x2c')]=_[_0xfbd0('0x3e')](db[_0xfbd0('0x39')][_0xfbd0('0x28')]);_0x3be9b7[_0xfbd0('0x2d')]=_[_0xfbd0('0x3e')](_0x1f14ba[_0xfbd0('0x2d')]);_0x3be9b7[_0xfbd0('0x2e')]=_[_0xfbd0('0x2f')](_0x3be9b7[_0xfbd0('0x2c')],_0x3be9b7[_0xfbd0('0x2d')]);_0x9967e1['attributes']=_['intersection'](_0x3be9b7[_0xfbd0('0x2c')],qs[_0xfbd0('0x30')](_0x1f14ba[_0xfbd0('0x2d')][_0xfbd0('0x30')]));_0x9967e1['attributes']=_0x9967e1[_0xfbd0('0x31')][_0xfbd0('0x3f')]?_0x9967e1[_0xfbd0('0x31')]:_0x3be9b7['model'];if(_0x1f14ba[_0xfbd0('0x2d')][_0xfbd0('0x3a')]){_0x9967e1[_0xfbd0('0x3b')]=[{'all':!![]}];}_0x9967e1=_['merge']({},_0x9967e1,_0x1f14ba['options']);return db[_0xfbd0('0x39')][_0xfbd0('0x40')](_0x9967e1)[_0xfbd0('0xc')](handleEntityNotFound(_0x347733,null))[_0xfbd0('0xc')](respondWithResult(_0x347733,null))['catch'](handleError(_0x347733,null));};exports[_0xfbd0('0x41')]=function(_0x45dacc,_0x25d3f1){var _0x38d15c;return db[_0xfbd0('0x39')][_0xfbd0('0x41')](_0x45dacc[_0xfbd0('0x42')],{'raw':!![]})[_0xfbd0('0xc')](function(_0x1fc740){_0x38d15c=_0x1fc740;return db[_0xfbd0('0x39')]['findAll']({'where':{'type':_0x45dacc['body'][_0xfbd0('0x2a')]},'raw':!![]});})['then'](function(_0x291ca8){if(_0x38d15c[_0xfbd0('0x2a')][_0xfbd0('0x43')]()=='STUN'){var _0x50a3f7=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x46')),_0xfbd0('0x47'));var _0x1c68c3=ejs[_0xfbd0('0x48')](_0x50a3f7,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/stun_xcally.conf',_0x1c68c3);return respondWithRpcPromise('Reload','create',{'module':_0xfbd0('0x4a')});}else if(_0x38d15c[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x2423dd=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],'server/files/templates/turn_multiple.ejs'),_0xfbd0('0x47'));var _0x98286d=ejs['render'](_0x2423dd,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x4d'),_0x98286d);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x41'),{'module':_0xfbd0('0x4a')});}else{var _0xbc8e83=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x9c1779=ejs['render'](_0xbc8e83,{'networks':_0x291ca8||[]});fs[_0xfbd0('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x45dacc[_0xfbd0('0x42')]['type']['toLowerCase']()),_0x9c1779);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x41'),{'module':_0xfbd0('0x50')});}})['then'](function(){return _0x38d15c;})[_0xfbd0('0xc')](respondWithResult(_0x25d3f1,0xc9))[_0xfbd0('0x17')](handleError(_0x25d3f1,null));};exports[_0xfbd0('0x51')]=function(_0x51d31b,_0x20e567){var _0x367859;return db[_0xfbd0('0x39')][_0xfbd0('0x40')]({'where':{'id':_0x51d31b['params']['id']}})[_0xfbd0('0xc')](handleEntityNotFound(_0x20e567,null))[_0xfbd0('0xc')](saveUpdates(_0x51d31b[_0xfbd0('0x42')],null))[_0xfbd0('0xc')](function(_0x43463d){if(_0x43463d){_0x367859=_0x43463d;return db[_0xfbd0('0x39')][_0xfbd0('0x3c')]({'where':{'type':_0x367859['type']},'raw':!![]});}return null;})[_0xfbd0('0xc')](function(_0x1c1a1b){if(_0x367859[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x52')){var _0x287566=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],'server/files/templates/stun_multiple.ejs'),_0xfbd0('0x47'));var _0x1fc8df=ejs[_0xfbd0('0x48')](_0x287566,{'networks':_0x1c1a1b||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x53'),_0x1fc8df);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x51'),{'module':_0xfbd0('0x4a')});}else if(_0x367859['type'][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x41b5e0=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],_0xfbd0('0x54')),_0xfbd0('0x47'));var _0x3f2b25=ejs[_0xfbd0('0x48')](_0x41b5e0,{'networks':_0x1c1a1b||[]});fs[_0xfbd0('0x49')](_0xfbd0('0x4d'),_0x3f2b25);return respondWithRpcPromise(_0xfbd0('0x4e'),_0xfbd0('0x51'),{'module':_0xfbd0('0x4a')});}else{var _0x332518=fs[_0xfbd0('0x44')](path[_0xfbd0('0x45')](config['root'],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x30a0cd=ejs['render'](_0x332518,{'networks':_0x1c1a1b||[]});fs['writeFileSync'](util[_0xfbd0('0x55')](_0xfbd0('0x56'),_0x51d31b['body'][_0xfbd0('0x2a')][_0xfbd0('0x57')]()),_0x30a0cd);return respondWithRpcPromise('Reload',_0xfbd0('0x51'),{'module':_0xfbd0('0x50')});}})['then'](function(_0x776257){if(_0x776257){return _0x367859;}return null;})['then'](respondWithResult(_0x20e567,null))['catch'](handleError(_0x20e567,null));};exports[_0xfbd0('0x20')]=function(_0x1378d1,_0x49020a){var _0x9dbcb2;return db[_0xfbd0('0x39')]['find']({'where':{'id':_0x1378d1['params']['id']}})[_0xfbd0('0xc')](function(_0x16f917){_0x9dbcb2=_0x16f917;return _0x16f917;})[_0xfbd0('0xc')](handleEntityNotFound(_0x49020a,null))[_0xfbd0('0xc')](removeEntity(_0x49020a,null))[_0xfbd0('0xc')](function(){if(_0x9dbcb2){return db['Network'][_0xfbd0('0x3c')]({'where':{'type':_0x9dbcb2[_0xfbd0('0x2a')]},'raw':!![]});}})[_0xfbd0('0xc')](function(_0x297c1a){if(_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x43')]()=='STUN'){var _0x407e8a=fs['readFileSync'](path[_0xfbd0('0x45')](config[_0xfbd0('0x4c')],_0xfbd0('0x46')),'utf8');var _0x5581a7=ejs[_0xfbd0('0x48')](_0x407e8a,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/stun_xcally.conf',_0x5581a7);return respondWithRpcPromise(_0xfbd0('0x4e'),'destroy',{'module':_0xfbd0('0x4a')});}else if(_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x43')]()==_0xfbd0('0x4b')){var _0x505762=fs[_0xfbd0('0x44')](path['join'](config[_0xfbd0('0x4c')],_0xfbd0('0x54')),_0xfbd0('0x47'));var _0x5e1e64=ejs[_0xfbd0('0x48')](_0x505762,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')]('/etc/asterisk/turn_xcally.conf',_0x5e1e64);return respondWithRpcPromise('Reload',_0xfbd0('0x20'),{'module':'res_stun_monitor.so'});}else{var _0x316aa6=fs[_0xfbd0('0x44')](path['join'](config[_0xfbd0('0x4c')],_0xfbd0('0x4f')),_0xfbd0('0x47'));var _0x4313e9=ejs['render'](_0x316aa6,{'networks':_0x297c1a||[]});fs[_0xfbd0('0x49')](util['format'](_0xfbd0('0x56'),_0x9dbcb2[_0xfbd0('0x2a')][_0xfbd0('0x57')]()),_0x4313e9);return respondWithRpcPromise('Reload',_0xfbd0('0x20'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x49020a,null));}; \ No newline at end of file +var _0xa7c6=['STUN','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','root','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','join','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','server/files/templates/turn_multiple.ejs','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s,\x20%s','error','code','Network,\x20%s,\x20%s','message','request\x20sent','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Network','rows','show','params','keys','find','create','body','findAll','toUpperCase'];(function(_0x47aff1,_0x505c41){var _0x264d2b=function(_0xae785f){while(--_0xae785f){_0x47aff1['push'](_0x47aff1['shift']());}};_0x264d2b(++_0x505c41);}(_0xa7c6,0x6b));var _0x6a7c=function(_0x211e38,_0x4491c4){_0x211e38=_0x211e38-0x0;var _0x3af407=_0xa7c6[_0x211e38];return _0x3af407;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x6a7c('0x0'));var fs=require('fs');var _=require(_0x6a7c('0x1'));var qs=require(_0x6a7c('0x2'));var logger=require(_0x6a7c('0x3'))(_0x6a7c('0x4'));var config=require(_0x6a7c('0x5'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6a7c('0x6'));var client=jayson[_0x6a7c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11a685,_0x3c898a,_0x4b8076,_0x5de8d6){return new Promise(function(_0x43e847,_0xd28998){var _0x40ddf=_0x5de8d6||client;return _0x40ddf[_0x6a7c('0x8')](_0x11a685,_0x4b8076)[_0x6a7c('0x9')](function(_0xf59e93){logger[_0x6a7c('0xa')]('Network,\x20%s,\x20%s',_0x3c898a,'request\x20sent');logger['debug'](_0x6a7c('0xb'),_0x3c898a,'request\x20sent',JSON['stringify'](_0xf59e93));if(_0xf59e93[_0x6a7c('0xc')]){if(_0xf59e93[_0x6a7c('0xc')][_0x6a7c('0xd')]===0x1f4){logger['error'](_0x6a7c('0xe'),_0x3c898a,_0xf59e93[_0x6a7c('0xc')][_0x6a7c('0xf')]);return _0xd28998(_0xf59e93[_0x6a7c('0xc')][_0x6a7c('0xf')]);}logger[_0x6a7c('0xc')](_0x6a7c('0xe'),_0x3c898a,_0xf59e93[_0x6a7c('0xc')][_0x6a7c('0xf')]);return _0x43e847(_0xf59e93['error'][_0x6a7c('0xf')]);}else{logger[_0x6a7c('0xa')]('Network,\x20%s,\x20%s',_0x3c898a,_0x6a7c('0x10'));_0x43e847(_0xf59e93['result'][_0x6a7c('0xf')]);}})[_0x6a7c('0x11')](function(_0x550016){logger[_0x6a7c('0xc')](_0x6a7c('0xe'),_0x3c898a,_0x550016);_0xd28998(_0x550016);});});}function respondWithResult(_0x57c483,_0xa8f22d){_0xa8f22d=_0xa8f22d||0xc8;return function(_0x1071d1){if(_0x1071d1){return _0x57c483[_0x6a7c('0x12')](_0xa8f22d)[_0x6a7c('0x13')](_0x1071d1);}};}function respondWithFilteredResult(_0x1fe4b3,_0x5cadbc){return function(_0x46e325){if(_0x46e325){var _0x1c17bb=typeof _0x5cadbc[_0x6a7c('0x14')]===_0x6a7c('0x15')&&typeof _0x5cadbc[_0x6a7c('0x16')]==='undefined';var _0x4d90b5=_0x46e325[_0x6a7c('0x17')];var _0x42ce3c=_0x1c17bb?0x0:_0x5cadbc['offset'];var _0x3a3c4f=_0x1c17bb?_0x46e325[_0x6a7c('0x17')]:_0x5cadbc[_0x6a7c('0x14')]+_0x5cadbc[_0x6a7c('0x16')];var _0x36961b;if(_0x3a3c4f>=_0x4d90b5){_0x3a3c4f=_0x4d90b5;_0x36961b=0xc8;}else{_0x36961b=0xce;}_0x1fe4b3['status'](_0x36961b);return _0x1fe4b3[_0x6a7c('0x18')](_0x6a7c('0x19'),_0x42ce3c+'-'+_0x3a3c4f+'/'+_0x4d90b5)[_0x6a7c('0x13')](_0x46e325);}return null;};}function saveUpdates(_0x180f5e){return function(_0x222857){if(_0x222857){return _0x222857[_0x6a7c('0x1a')](_0x180f5e)[_0x6a7c('0x9')](function(_0x1538f5){return _0x1538f5;});}return null;};}function removeEntity(_0x2caa8d){return function(_0x3ae327){if(_0x3ae327){return _0x3ae327['destroy']()[_0x6a7c('0x9')](function(){_0x2caa8d['status'](0xcc)[_0x6a7c('0x1b')]();});}};}function handleEntityNotFound(_0x3d6b8a){return function(_0x29dc32){if(!_0x29dc32){_0x3d6b8a[_0x6a7c('0x1c')](0x194);}return _0x29dc32;};}function handleError(_0x50c7e1,_0x42143a){_0x42143a=_0x42143a||0x1f4;return function(_0x15636e){logger[_0x6a7c('0xc')](_0x15636e[_0x6a7c('0x1d')]);if(_0x15636e['name']){delete _0x15636e['name'];}_0x50c7e1['status'](_0x42143a)[_0x6a7c('0x1e')](_0x15636e);};}exports[_0x6a7c('0x1f')]=function(_0x58920b,_0x2ef1d6){var _0x41553d={},_0x544ca9={},_0x1e21b2={'count':0x0,'rows':[]};var _0x313a62=_[_0x6a7c('0x20')](db['Network'][_0x6a7c('0x21')],function(_0x1e2ea2){return{'name':_0x1e2ea2[_0x6a7c('0x22')],'type':_0x1e2ea2[_0x6a7c('0x23')][_0x6a7c('0x24')]};});_0x544ca9['model']=_[_0x6a7c('0x20')](_0x313a62,_0x6a7c('0x25'));_0x544ca9[_0x6a7c('0x26')]=_['keys'](_0x58920b[_0x6a7c('0x26')]);_0x544ca9[_0x6a7c('0x27')]=_[_0x6a7c('0x28')](_0x544ca9[_0x6a7c('0x29')],_0x544ca9[_0x6a7c('0x26')]);_0x41553d[_0x6a7c('0x2a')]=_['intersection'](_0x544ca9[_0x6a7c('0x29')],qs[_0x6a7c('0x2b')](_0x58920b[_0x6a7c('0x26')][_0x6a7c('0x2b')]));_0x41553d[_0x6a7c('0x2a')]=_0x41553d[_0x6a7c('0x2a')][_0x6a7c('0x2c')]?_0x41553d[_0x6a7c('0x2a')]:_0x544ca9[_0x6a7c('0x29')];if(!_0x58920b['query'][_0x6a7c('0x2d')](_0x6a7c('0x2e'))){_0x41553d[_0x6a7c('0x16')]=qs[_0x6a7c('0x16')](_0x58920b['query']['limit']);_0x41553d[_0x6a7c('0x14')]=qs[_0x6a7c('0x14')](_0x58920b['query'][_0x6a7c('0x14')]);}_0x41553d[_0x6a7c('0x2f')]=qs[_0x6a7c('0x30')](_0x58920b['query'][_0x6a7c('0x30')]);_0x41553d[_0x6a7c('0x31')]=qs[_0x6a7c('0x27')](_[_0x6a7c('0x32')](_0x58920b['query'],_0x544ca9[_0x6a7c('0x27')]),_0x313a62);if(_0x58920b[_0x6a7c('0x26')]['filter']){_0x41553d[_0x6a7c('0x31')]=_[_0x6a7c('0x33')](_0x41553d[_0x6a7c('0x31')],{'$or':_[_0x6a7c('0x20')](_0x313a62,function(_0x13fbc0){if(_0x13fbc0[_0x6a7c('0x23')]!==_0x6a7c('0x34')){var _0x39d439={};_0x39d439[_0x13fbc0[_0x6a7c('0x25')]]={'$like':'%'+_0x58920b[_0x6a7c('0x26')][_0x6a7c('0x35')]+'%'};return _0x39d439;}})});}_0x41553d=_[_0x6a7c('0x33')]({},_0x41553d,_0x58920b[_0x6a7c('0x36')]);var _0x1bbd61={'where':_0x41553d[_0x6a7c('0x31')]};return db['Network']['count'](_0x1bbd61)[_0x6a7c('0x9')](function(_0x1659de){_0x1e21b2['count']=_0x1659de;if(_0x58920b[_0x6a7c('0x26')][_0x6a7c('0x37')]){_0x41553d[_0x6a7c('0x38')]=[{'all':!![]}];}return db[_0x6a7c('0x39')]['findAll'](_0x41553d);})[_0x6a7c('0x9')](function(_0x1f624a){_0x1e21b2[_0x6a7c('0x3a')]=_0x1f624a;return _0x1e21b2;})[_0x6a7c('0x9')](respondWithFilteredResult(_0x2ef1d6,_0x41553d))[_0x6a7c('0x11')](handleError(_0x2ef1d6,null));};exports[_0x6a7c('0x3b')]=function(_0x32ab0a,_0x2893b6){var _0x2837b7={'raw':!![],'where':{'id':_0x32ab0a[_0x6a7c('0x3c')]['id']}},_0x139671={};_0x139671['model']=_[_0x6a7c('0x3d')](db['Network'][_0x6a7c('0x21')]);_0x139671[_0x6a7c('0x26')]=_['keys'](_0x32ab0a[_0x6a7c('0x26')]);_0x139671[_0x6a7c('0x27')]=_['intersection'](_0x139671['model'],_0x139671[_0x6a7c('0x26')]);_0x2837b7[_0x6a7c('0x2a')]=_[_0x6a7c('0x28')](_0x139671[_0x6a7c('0x29')],qs[_0x6a7c('0x2b')](_0x32ab0a[_0x6a7c('0x26')][_0x6a7c('0x2b')]));_0x2837b7[_0x6a7c('0x2a')]=_0x2837b7[_0x6a7c('0x2a')][_0x6a7c('0x2c')]?_0x2837b7[_0x6a7c('0x2a')]:_0x139671['model'];if(_0x32ab0a[_0x6a7c('0x26')][_0x6a7c('0x37')]){_0x2837b7['include']=[{'all':!![]}];}_0x2837b7=_[_0x6a7c('0x33')]({},_0x2837b7,_0x32ab0a[_0x6a7c('0x36')]);return db['Network'][_0x6a7c('0x3e')](_0x2837b7)[_0x6a7c('0x9')](handleEntityNotFound(_0x2893b6,null))[_0x6a7c('0x9')](respondWithResult(_0x2893b6,null))['catch'](handleError(_0x2893b6,null));};exports[_0x6a7c('0x3f')]=function(_0x378187,_0x526543){var _0x29fd85;return db[_0x6a7c('0x39')][_0x6a7c('0x3f')](_0x378187[_0x6a7c('0x40')],{'raw':!![]})['then'](function(_0x30fe35){_0x29fd85=_0x30fe35;return db[_0x6a7c('0x39')][_0x6a7c('0x41')]({'where':{'type':_0x378187[_0x6a7c('0x40')][_0x6a7c('0x23')]},'raw':!![]});})['then'](function(_0x57166d){if(_0x29fd85['type'][_0x6a7c('0x42')]()==_0x6a7c('0x43')){var _0x73cd47=fs['readFileSync'](path['join'](config['root'],_0x6a7c('0x44')),_0x6a7c('0x45'));var _0x45816a=ejs[_0x6a7c('0x46')](_0x73cd47,{'networks':_0x57166d||[]});fs[_0x6a7c('0x47')](_0x6a7c('0x48'),_0x45816a);return respondWithRpcPromise(_0x6a7c('0x49'),_0x6a7c('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x29fd85[_0x6a7c('0x23')]['toUpperCase']()==_0x6a7c('0x4a')){var _0x1f754b=fs[_0x6a7c('0x4b')](path['join'](config[_0x6a7c('0x4c')],'server/files/templates/turn_multiple.ejs'),_0x6a7c('0x45'));var _0x222ecb=ejs[_0x6a7c('0x46')](_0x1f754b,{'networks':_0x57166d||[]});fs['writeFileSync'](_0x6a7c('0x4d'),_0x222ecb);return respondWithRpcPromise('Reload',_0x6a7c('0x3f'),{'module':_0x6a7c('0x4e')});}else{var _0x529b77=fs['readFileSync'](path[_0x6a7c('0x4f')](config[_0x6a7c('0x4c')],_0x6a7c('0x50')),_0x6a7c('0x45'));var _0x51aba5=ejs[_0x6a7c('0x46')](_0x529b77,{'networks':_0x57166d||[]});fs[_0x6a7c('0x47')](util[_0x6a7c('0x51')](_0x6a7c('0x52'),_0x378187[_0x6a7c('0x40')]['type'][_0x6a7c('0x53')]()),_0x51aba5);return respondWithRpcPromise(_0x6a7c('0x49'),_0x6a7c('0x3f'),{'module':_0x6a7c('0x54')});}})[_0x6a7c('0x9')](function(){return _0x29fd85;})['then'](respondWithResult(_0x526543,0xc9))[_0x6a7c('0x11')](handleError(_0x526543,null));};exports[_0x6a7c('0x1a')]=function(_0x20afbf,_0x80078e){var _0x46fdff;return db['Network'][_0x6a7c('0x3e')]({'where':{'id':_0x20afbf['params']['id']}})[_0x6a7c('0x9')](handleEntityNotFound(_0x80078e,null))[_0x6a7c('0x9')](saveUpdates(_0x20afbf[_0x6a7c('0x40')],null))[_0x6a7c('0x9')](function(_0x7bf308){if(_0x7bf308){_0x46fdff=_0x7bf308;return db[_0x6a7c('0x39')][_0x6a7c('0x41')]({'where':{'type':_0x46fdff[_0x6a7c('0x23')]},'raw':!![]});}return null;})[_0x6a7c('0x9')](function(_0x119c95){if(_0x46fdff[_0x6a7c('0x23')][_0x6a7c('0x42')]()=='STUN'){var _0x58515f=fs[_0x6a7c('0x4b')](path['join'](config[_0x6a7c('0x4c')],_0x6a7c('0x44')),_0x6a7c('0x45'));var _0x537ced=ejs[_0x6a7c('0x46')](_0x58515f,{'networks':_0x119c95||[]});fs[_0x6a7c('0x47')](_0x6a7c('0x48'),_0x537ced);return respondWithRpcPromise('Reload',_0x6a7c('0x1a'),{'module':_0x6a7c('0x4e')});}else if(_0x46fdff[_0x6a7c('0x23')]['toUpperCase']()=='TURN'){var _0xefe705=fs[_0x6a7c('0x4b')](path[_0x6a7c('0x4f')](config[_0x6a7c('0x4c')],'server/files/templates/turn_multiple.ejs'),_0x6a7c('0x45'));var _0xe30815=ejs[_0x6a7c('0x46')](_0xefe705,{'networks':_0x119c95||[]});fs[_0x6a7c('0x47')](_0x6a7c('0x4d'),_0xe30815);return respondWithRpcPromise(_0x6a7c('0x49'),_0x6a7c('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0xb88055=fs[_0x6a7c('0x4b')](path[_0x6a7c('0x4f')](config[_0x6a7c('0x4c')],'server/files/templates/network.ejs'),_0x6a7c('0x45'));var _0x3ad18f=ejs[_0x6a7c('0x46')](_0xb88055,{'networks':_0x119c95||[]});fs[_0x6a7c('0x47')](util[_0x6a7c('0x51')](_0x6a7c('0x52'),_0x20afbf[_0x6a7c('0x40')][_0x6a7c('0x23')][_0x6a7c('0x53')]()),_0x3ad18f);return respondWithRpcPromise(_0x6a7c('0x49'),_0x6a7c('0x1a'),{'module':_0x6a7c('0x54')});}})[_0x6a7c('0x9')](function(_0x55c582){if(_0x55c582){return _0x46fdff;}return null;})[_0x6a7c('0x9')](respondWithResult(_0x80078e,null))['catch'](handleError(_0x80078e,null));};exports['destroy']=function(_0x31e537,_0x4c80e2){var _0x343e64;return db[_0x6a7c('0x39')][_0x6a7c('0x3e')]({'where':{'id':_0x31e537[_0x6a7c('0x3c')]['id']}})[_0x6a7c('0x9')](function(_0x2653af){_0x343e64=_0x2653af;return _0x2653af;})['then'](handleEntityNotFound(_0x4c80e2,null))[_0x6a7c('0x9')](removeEntity(_0x4c80e2,null))['then'](function(){if(_0x343e64){return db[_0x6a7c('0x39')][_0x6a7c('0x41')]({'where':{'type':_0x343e64[_0x6a7c('0x23')]},'raw':!![]});}})[_0x6a7c('0x9')](function(_0xd0a0dd){if(_0x343e64[_0x6a7c('0x23')][_0x6a7c('0x42')]()=='STUN'){var _0x1a2eff=fs[_0x6a7c('0x4b')](path['join'](config[_0x6a7c('0x4c')],_0x6a7c('0x44')),'utf8');var _0x42a4ef=ejs[_0x6a7c('0x46')](_0x1a2eff,{'networks':_0xd0a0dd||[]});fs[_0x6a7c('0x47')](_0x6a7c('0x48'),_0x42a4ef);return respondWithRpcPromise(_0x6a7c('0x49'),_0x6a7c('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x343e64[_0x6a7c('0x23')][_0x6a7c('0x42')]()==_0x6a7c('0x4a')){var _0x16fe4a=fs['readFileSync'](path[_0x6a7c('0x4f')](config[_0x6a7c('0x4c')],_0x6a7c('0x56')),'utf8');var _0x21f329=ejs[_0x6a7c('0x46')](_0x16fe4a,{'networks':_0xd0a0dd||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x21f329);return respondWithRpcPromise('Reload',_0x6a7c('0x55'),{'module':_0x6a7c('0x4e')});}else{var _0x44a275=fs['readFileSync'](path[_0x6a7c('0x4f')](config[_0x6a7c('0x4c')],_0x6a7c('0x50')),_0x6a7c('0x45'));var _0x5691ac=ejs[_0x6a7c('0x46')](_0x44a275,{'networks':_0xd0a0dd||[]});fs['writeFileSync'](util[_0x6a7c('0x51')](_0x6a7c('0x52'),_0x343e64[_0x6a7c('0x23')][_0x6a7c('0x53')]()),_0x5691ac);return respondWithRpcPromise('Reload',_0x6a7c('0x55'),{'module':_0x6a7c('0x54')});}})['catch'](handleError(_0x4c80e2,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6de287e..4e56da9 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 _0x1752=['bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','api','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x1752,0xa5));var _0x2175=function(_0x192484,_0x3dd5b8){_0x192484=_0x192484-0x0;var _0x13bbaf=_0x1752[_0x192484];return _0x13bbaf;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9b=['rimraf','./network.attributes','Network','network','util','../../config/logger','moment','request-promise','path'];(function(_0x19e99c,_0x100aa1){var _0xf4381e=function(_0x6672b4){while(--_0x6672b4){_0x19e99c['push'](_0x19e99c['shift']());}};_0xf4381e(++_0x100aa1);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x35f95a,_0x40d951){_0x35f95a=_0x35f95a-0x0;var _0x547a7a=_0x9d9b[_0x35f95a];return _0x547a7a;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'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 1eb48a8..162c90f 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(_0x419cdb,_0x3e5687){var _0x1d4fca=function(_0x10bf21){while(--_0x10bf21){_0x419cdb['push'](_0x419cdb['shift']());}};_0x1d4fca(++_0x3e5687);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35e03d,_0xf916d6){var _0x12738d=function(_0x38bd4c){while(--_0x38bd4c){_0x35e03d['push'](_0x35e03d['shift']());}};_0x12738d(++_0xf916d6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index e8bb34a..02490d5 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 _0x7e07=['post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','get','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0x7e07,0x151));var _0x77e0=function(_0x5e45e0,_0x3e7ea5){_0x5e45e0=_0x5e45e0-0x0;var _0x2d4bb1=_0x7e07[_0x5e45e0];return _0x2d4bb1;};'use strict';var multer=require(_0x77e0('0x0'));var util=require(_0x77e0('0x1'));var path=require(_0x77e0('0x2'));var timeout=require(_0x77e0('0x3'));var express=require(_0x77e0('0x4'));var router=express[_0x77e0('0x5')]();var fs_extra=require(_0x77e0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x77e0('0x7'));var config=require(_0x77e0('0x8'));var controller=require(_0x77e0('0x9'));router['get']('/',auth[_0x77e0('0xa')](),controller['index']);router[_0x77e0('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x77e0('0xc')]);router[_0x77e0('0xb')](_0x77e0('0xd'),auth[_0x77e0('0xa')](),controller['show']);router[_0x77e0('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x77e0('0xe')]);router[_0x77e0('0xb')](_0x77e0('0xf'),auth['isAuthenticated'](),controller[_0x77e0('0x10')]);router[_0x77e0('0xb')](_0x77e0('0x11'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x12')]);router[_0x77e0('0xb')](_0x77e0('0x13'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x14')]);router[_0x77e0('0xb')](_0x77e0('0x15'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x16')]);router[_0x77e0('0x17')]('/',auth[_0x77e0('0xa')](),controller[_0x77e0('0x18')]);router[_0x77e0('0x17')]('/:id/dispositions',auth[_0x77e0('0xa')](),controller[_0x77e0('0x19')]);router[_0x77e0('0x17')](_0x77e0('0xf'),auth['isAuthenticated'](),controller[_0x77e0('0x1a')]);router[_0x77e0('0x17')](_0x77e0('0x1b'),controller[_0x77e0('0x1c')]);router[_0x77e0('0x17')](_0x77e0('0x11'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x1d')]);router[_0x77e0('0x17')]('/:id/users',auth[_0x77e0('0xa')](),controller['addAgents']);router[_0x77e0('0x17')](_0x77e0('0x1e'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x1f')]);router[_0x77e0('0x20')](_0x77e0('0xd'),auth['isAuthenticated'](),controller[_0x77e0('0x21')]);router[_0x77e0('0x22')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x77e0('0x22')](_0x77e0('0x23'),auth[_0x77e0('0xa')](),controller[_0x77e0('0x24')]);router[_0x77e0('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x77e0('0x25')]);router['delete'](_0x77e0('0x15'),auth['isAuthenticated'](),controller[_0x77e0('0x26')]);module[_0x77e0('0x27')]=router; \ No newline at end of file +var _0xf3f5=['getAgents','create','post','addDisposition','addAnswer','addApplications','/:id/send','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users'];(function(_0x29bb0a,_0x4a49e6){var _0x1725e4=function(_0xc984bd){while(--_0xc984bd){_0x29bb0a['push'](_0x29bb0a['shift']());}};_0x1725e4(++_0x4a49e6);}(_0xf3f5,0x7f));var _0x5f3f=function(_0x269e3f,_0x35992a){_0x269e3f=_0x269e3f-0x0;var _0x37144d=_0xf3f5[_0x269e3f];return _0x37144d;};'use strict';var multer=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var path=require(_0x5f3f('0x2'));var timeout=require(_0x5f3f('0x3'));var express=require(_0x5f3f('0x4'));var router=express[_0x5f3f('0x5')]();var fs_extra=require(_0x5f3f('0x6'));var auth=require(_0x5f3f('0x7'));var interaction=require(_0x5f3f('0x8'));var config=require('../../config/environment');var controller=require(_0x5f3f('0x9'));router[_0x5f3f('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5f3f('0xa')](_0x5f3f('0xb'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0xd')]);router[_0x5f3f('0xa')](_0x5f3f('0xe'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0xf')]);router[_0x5f3f('0xa')](_0x5f3f('0x10'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x11')]);router[_0x5f3f('0xa')](_0x5f3f('0x12'),auth['isAuthenticated'](),controller[_0x5f3f('0x13')]);router[_0x5f3f('0xa')](_0x5f3f('0x14'),auth['isAuthenticated'](),controller[_0x5f3f('0x15')]);router['get'](_0x5f3f('0x16'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x17')]);router[_0x5f3f('0xa')](_0x5f3f('0x18'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x19')]);router['post']('/',auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x1a')]);router[_0x5f3f('0x1b')](_0x5f3f('0x10'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x1c')]);router[_0x5f3f('0x1b')](_0x5f3f('0x12'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x1d')]);router[_0x5f3f('0x1b')]('/:id/notify',controller['notify']);router[_0x5f3f('0x1b')](_0x5f3f('0x14'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x1e')]);router['post'](_0x5f3f('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['post'](_0x5f3f('0x1f'),auth['isAuthenticated'](),controller['send']);router[_0x5f3f('0x20')](_0x5f3f('0xe'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x21')]);router[_0x5f3f('0x22')](_0x5f3f('0xe'),auth[_0x5f3f('0xc')](),controller['destroy']);router['delete'](_0x5f3f('0x10'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x23')]);router[_0x5f3f('0x22')](_0x5f3f('0x12'),auth[_0x5f3f('0xc')](),controller[_0x5f3f('0x24')]);router[_0x5f3f('0x22')](_0x5f3f('0x18'),auth[_0x5f3f('0xc')](),controller['removeAgents']);module[_0x5f3f('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 3bb1a2f..84bd946 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 _0x2a96=['STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0x2a96,0x11b));var _0x62a9=function(_0x6e6158,_0x534892){_0x6e6158=_0x6e6158-0x0;var _0x366ca4=_0x2a96[_0x6e6158];return _0x366ca4;};'use strict';var Sequelize=require(_0x62a9('0x0'));var rs=require(_0x62a9('0x1'));module[_0x62a9('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x62a9('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x62a9('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x62a9('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'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[_0x62a9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x62a9('0x3')]},'queueTransfer':{'type':Sequelize[_0x62a9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x62a9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x62a9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x62a9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x62a9('0x5')],'defaultValue':![],'comment':_0x62a9('0x8'),'set':function(_0x54c8f8){if(!_0x54c8f8)this[_0x62a9('0x9')]('mandatoryDispositionPauseId',null);this[_0x62a9('0x9')](_0x62a9('0xa'),_0x54c8f8);}}}; \ No newline at end of file +var _0x9d37=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x9d37,0x1ef));var _0x79d3=function(_0x569b09,_0x1cc10c){_0x569b09=_0x569b09-0x0;var _0x50295e=_0x9d37[_0x569b09];return _0x50295e;};'use strict';var Sequelize=require(_0x79d3('0x0'));var rs=require(_0x79d3('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x79d3('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x79d3('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x79d3('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x79d3('0x4')],'defaultValue':function(){return _0x79d3('0x5');}},'notificationSound':{'type':Sequelize[_0x79d3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x79d3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x79d3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x79d3('0x3')]},'queueTransfer':{'type':Sequelize[_0x79d3('0x6')],'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[_0x79d3('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x79d3('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x79d3('0x9'),'set':function(_0x459bdb){if(!_0x459bdb)this['setDataValue'](_0x79d3('0xa'),null);this['setDataValue'](_0x79d3('0xb'),_0x459bdb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 84ba71d..ac33a76 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 _0xbd60=['../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','result','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','startRouting','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','finally','sendStatus','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','addAgents','ids','omit','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x35d809,_0xd0cdda){var _0x122106=function(_0x30ed8b){while(--_0x30ed8b){_0x35d809['push'](_0x35d809['shift']());}};_0x122106(++_0xd0cdda);}(_0xbd60,0x162));var _0x0bd6=function(_0x5ab602,_0x5bb797){_0x5ab602=_0x5ab602-0x0;var _0x3b7a08=_0xbd60[_0x5ab602];return _0x3b7a08;};'use strict';var emlformat=require(_0x0bd6('0x0'));var rimraf=require(_0x0bd6('0x1'));var zipdir=require(_0x0bd6('0x2'));var jsonpatch=require(_0x0bd6('0x3'));var rp=require(_0x0bd6('0x4'));var moment=require(_0x0bd6('0x5'));var BPromise=require(_0x0bd6('0x6'));var Mustache=require(_0x0bd6('0x7'));var util=require('util');var path=require(_0x0bd6('0x8'));var sox=require(_0x0bd6('0x9'));var csv=require(_0x0bd6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0bd6('0xb'));var _=require(_0x0bd6('0xc'));var squel=require(_0x0bd6('0xd'));var crypto=require(_0x0bd6('0xe'));var jsforce=require(_0x0bd6('0xf'));var deskjs=require(_0x0bd6('0x10'));var toCsv=require(_0x0bd6('0xa'));var querystring=require(_0x0bd6('0x11'));var Papa=require(_0x0bd6('0x12'));var Redis=require('ioredis');var authService=require(_0x0bd6('0x13'));var qs=require(_0x0bd6('0x14'));var as=require(_0x0bd6('0x15'));var hardwareService=require(_0x0bd6('0x16'));var logger=require(_0x0bd6('0x17'))(_0x0bd6('0x18'));var utils=require(_0x0bd6('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0bd6('0x1a')],{'host':_0x0bd6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd6('0x1a')]));require(_0x0bd6('0x1c'))[_0x0bd6('0x1d')](socket);var jayson=require(_0x0bd6('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0bd6('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3883da,_0x4d2c18,_0x2f9927,_0x2fe790){return new BPromise(function(_0x2858e4,_0x558c78){var _0x1cd639=_0x2fe790||client;return _0x1cd639['request'](_0x3883da,_0x2f9927)[_0x0bd6('0x20')](function(_0x4f18e7){logger[_0x0bd6('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d2c18,_0x0bd6('0x22'));logger['debug'](_0x0bd6('0x23'),_0x4d2c18,_0x0bd6('0x22'),JSON[_0x0bd6('0x24')](_0x4f18e7));if(_0x4f18e7[_0x0bd6('0x25')]){if(_0x4f18e7[_0x0bd6('0x25')]['code']===0x1f4){logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x4f18e7['error']['message']);return _0x558c78(_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);}logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);return _0x2858e4(_0x4f18e7[_0x0bd6('0x25')][_0x0bd6('0x27')]);}else{logger['info'](_0x0bd6('0x26'),_0x4d2c18,_0x0bd6('0x22'));_0x2858e4(_0x4f18e7[_0x0bd6('0x28')][_0x0bd6('0x27')]);}})['catch'](function(_0x20636d){logger[_0x0bd6('0x25')](_0x0bd6('0x26'),_0x4d2c18,_0x20636d);_0x558c78(_0x20636d);});});}function respondWithStatusCode(_0x2d36ce,_0xbd685){_0xbd685=_0xbd685||0xcc;return function(_0x5e9e6c){if(_0x5e9e6c){return _0x2d36ce['sendStatus'](_0xbd685);}return _0x2d36ce[_0x0bd6('0x29')](_0xbd685)['end']();};}function respondWithResult(_0x53f564,_0x595ba6){_0x595ba6=_0x595ba6||0xc8;return function(_0x51b443){if(_0x51b443){return _0x53f564[_0x0bd6('0x29')](_0x595ba6)['json'](_0x51b443);}};}function respondWithFilteredResult(_0x4ac530,_0x140ee8){return function(_0x172633){if(_0x172633){var _0x13a0bd=typeof _0x140ee8[_0x0bd6('0x2a')]===_0x0bd6('0x2b')&&typeof _0x140ee8[_0x0bd6('0x2c')]===_0x0bd6('0x2b');var _0x352216=_0x172633[_0x0bd6('0x2d')];var _0x779fe7=_0x13a0bd?0x0:_0x140ee8['offset'];var _0x367786=_0x13a0bd?_0x172633[_0x0bd6('0x2d')]:_0x140ee8[_0x0bd6('0x2a')]+_0x140ee8[_0x0bd6('0x2c')];var _0x5f4619;if(_0x367786>=_0x352216){_0x367786=_0x352216;_0x5f4619=0xc8;}else{_0x5f4619=0xce;}_0x4ac530[_0x0bd6('0x29')](_0x5f4619);return _0x4ac530[_0x0bd6('0x2e')](_0x0bd6('0x2f'),_0x779fe7+'-'+_0x367786+'/'+_0x352216)[_0x0bd6('0x30')](_0x172633);}return null;};}function patchUpdates(_0x4643bc){return function(_0x594cfd){try{jsonpatch['apply'](_0x594cfd,_0x4643bc,!![]);}catch(_0x3d1cfc){return BPromise[_0x0bd6('0x31')](_0x3d1cfc);}return _0x594cfd['save']();};}function saveUpdates(_0x12d353,_0x369d82){return function(_0x2cd5a6){if(_0x2cd5a6){return _0x2cd5a6[_0x0bd6('0x32')](_0x12d353)[_0x0bd6('0x20')](function(_0x4473a6){return _0x4473a6;});}return null;};}function removeEntity(_0x32d99c,_0x82e881){return function(_0x1e99f3){if(_0x1e99f3){return _0x1e99f3[_0x0bd6('0x33')]()[_0x0bd6('0x20')](function(){var _0x2f3c83=_0x1e99f3['get']({'plain':!![]});var _0x3fe57a='OpenchannelAccounts';return db[_0x0bd6('0x34')][_0x0bd6('0x33')]({'where':{'type':_0x3fe57a,'resourceId':_0x2f3c83['id']}})[_0x0bd6('0x20')](function(){return _0x1e99f3;});})[_0x0bd6('0x20')](function(){_0x32d99c[_0x0bd6('0x29')](0xcc)[_0x0bd6('0x35')]();});}};}function handleEntityNotFound(_0x1725a9,_0x3a4c65){return function(_0x297ae6){if(!_0x297ae6){_0x1725a9['sendStatus'](0x194);}return _0x297ae6;};}function handleError(_0x221ddd,_0x4fb0bc){_0x4fb0bc=_0x4fb0bc||0x1f4;return function(_0xdf5a01){logger[_0x0bd6('0x25')](_0xdf5a01[_0x0bd6('0x36')]);if(_0xdf5a01[_0x0bd6('0x37')]){delete _0xdf5a01[_0x0bd6('0x37')];}_0x221ddd[_0x0bd6('0x29')](_0x4fb0bc)['send'](_0xdf5a01);};}exports[_0x0bd6('0x38')]=function(_0x229aa9,_0x1413bc){var _0x4ac298={'include':[{'model':db[_0x0bd6('0x39')],'as':_0x0bd6('0x3a')}]},_0x25fa42={},_0x5c3802={'count':0x0,'rows':[]};var _0x4511a5=_[_0x0bd6('0x3b')](db[_0x0bd6('0x3c')][_0x0bd6('0x3d')],function(_0x4c08a8){return{'name':_0x4c08a8[_0x0bd6('0x3e')],'type':_0x4c08a8[_0x0bd6('0x3f')]['key']};});_0x25fa42[_0x0bd6('0x40')]=_['map'](_0x4511a5,'name');_0x25fa42[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x229aa9['query']);_0x25fa42[_0x0bd6('0x43')]=_[_0x0bd6('0x44')](_0x25fa42[_0x0bd6('0x40')],_0x25fa42[_0x0bd6('0x41')]);_0x4ac298[_0x0bd6('0x45')]=_['intersection'](_0x25fa42['model'],qs['fields'](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x4ac298[_0x0bd6('0x45')]=_0x4ac298[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x4ac298[_0x0bd6('0x45')]:_0x25fa42[_0x0bd6('0x40')];if(!_0x229aa9[_0x0bd6('0x41')]['hasOwnProperty'](_0x0bd6('0x48'))){_0x4ac298[_0x0bd6('0x2c')]=qs[_0x0bd6('0x2c')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x4ac298[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}_0x4ac298[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x4ac298['where']=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x229aa9['query'],_0x25fa42[_0x0bd6('0x43')]),_0x4511a5);if(_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0x4ac298['where']=_[_0x0bd6('0x4d')](_0x4ac298[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x4511a5,function(_0x25b003){if(_0x25b003[_0x0bd6('0x3f')]!==_0x0bd6('0x4f')){var _0x3828bd={};_0x3828bd[_0x25b003['name']]={'$like':'%'+_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x3828bd;}})});}_0x4ac298=_[_0x0bd6('0x4d')]({},_0x4ac298,_0x229aa9['options']);var _0x19a033={'where':_0x4ac298[_0x0bd6('0x4e')]};return db[_0x0bd6('0x3c')]['count'](_0x19a033)[_0x0bd6('0x20')](function(_0x1519e5){_0x5c3802['count']=_0x1519e5;if(_0x229aa9[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x4ac298[_0x0bd6('0x51')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x0bd6('0x52')](_0x4ac298);})['then'](function(_0x512140){_0x5c3802[_0x0bd6('0x53')]=_0x512140;return _0x5c3802;})['then'](respondWithFilteredResult(_0x1413bc,_0x4ac298))['catch'](handleError(_0x1413bc,null));};exports[_0x0bd6('0x54')]=function(_0x285311,_0xb27c61){var _0x1a969d={'raw':![],'where':{'id':_0x285311[_0x0bd6('0x55')]['id']},'include':[{'model':db[_0x0bd6('0x39')],'as':'mandatoryDispositionPause'}]},_0x3d259b={};_0x3d259b[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0x3c')][_0x0bd6('0x3d')]);_0x3d259b[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x285311[_0x0bd6('0x41')]);_0x3d259b['filters']=_['intersection'](_0x3d259b[_0x0bd6('0x40')],_0x3d259b[_0x0bd6('0x41')]);_0x1a969d[_0x0bd6('0x45')]=_['intersection'](_0x3d259b[_0x0bd6('0x40')],qs['fields'](_0x285311[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x1a969d[_0x0bd6('0x45')]=_0x1a969d[_0x0bd6('0x45')]['length']?_0x1a969d[_0x0bd6('0x45')]:_0x3d259b['model'];if(_0x285311[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x1a969d[_0x0bd6('0x51')]=[{'all':!![]}];}_0x1a969d=_[_0x0bd6('0x4d')]({},_0x1a969d,_0x285311[_0x0bd6('0x56')]);return db[_0x0bd6('0x3c')][_0x0bd6('0x57')](_0x1a969d)[_0x0bd6('0x20')](handleEntityNotFound(_0xb27c61,null))[_0x0bd6('0x20')](respondWithResult(_0xb27c61,null))['catch'](handleError(_0xb27c61,null));};exports['create']=function(_0x56ac99,_0x426306){return db[_0x0bd6('0x3c')][_0x0bd6('0x58')](_0x56ac99[_0x0bd6('0x59')],{})[_0x0bd6('0x20')](function(_0x1d455d){var _0x294aa1=_0x56ac99['user'][_0x0bd6('0x5a')]({'plain':!![]});if(!_0x294aa1)throw new Error(_0x0bd6('0x5b'));if(_0x294aa1['role']===_0x0bd6('0x5c')){var _0x1d86e9=_0x1d455d[_0x0bd6('0x5a')]({'plain':!![]});var _0x2bbb7f=_0x0bd6('0x5d');return db[_0x0bd6('0x5e')][_0x0bd6('0x57')]({'where':{'name':_0x2bbb7f,'userProfileId':_0x294aa1[_0x0bd6('0x5f')]},'raw':!![]})[_0x0bd6('0x20')](function(_0x451368){if(_0x451368&&_0x451368[_0x0bd6('0x60')]===0x0){return db[_0x0bd6('0x34')][_0x0bd6('0x58')]({'name':_0x1d86e9[_0x0bd6('0x37')],'resourceId':_0x1d86e9['id'],'type':_0x451368[_0x0bd6('0x37')],'sectionId':_0x451368['id']},{})[_0x0bd6('0x20')](function(){return _0x1d455d;});}else{return _0x1d455d;}})[_0x0bd6('0x61')](function(_0x36e6d1){logger[_0x0bd6('0x25')](_0x0bd6('0x62'),_0x36e6d1);throw _0x36e6d1;});}return _0x1d455d;})[_0x0bd6('0x20')](respondWithResult(_0x426306,0xc9))[_0x0bd6('0x61')](handleError(_0x426306,null));};exports['update']=function(_0x24597b,_0x798dd1){if(_0x24597b[_0x0bd6('0x59')]['id']){delete _0x24597b[_0x0bd6('0x59')]['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x24597b[_0x0bd6('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x0bd6('0x3a')}]})[_0x0bd6('0x20')](handleEntityNotFound(_0x798dd1,null))[_0x0bd6('0x20')](saveUpdates(_0x24597b[_0x0bd6('0x59')],null))[_0x0bd6('0x20')](respondWithResult(_0x798dd1,null))[_0x0bd6('0x61')](handleError(_0x798dd1,null));};exports[_0x0bd6('0x33')]=function(_0x37c5c9,_0x15a25e){return db['OpenchannelAccount']['find']({'where':{'id':_0x37c5c9[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x15a25e,null))[_0x0bd6('0x20')](removeEntity(_0x15a25e,null))['catch'](handleError(_0x15a25e,null));};exports['describe']=function(_0x527d60,_0x2b7494){return db['OpenchannelAccount'][_0x0bd6('0x63')]()[_0x0bd6('0x20')](respondWithResult(_0x2b7494,null))[_0x0bd6('0x61')](handleError(_0x2b7494,null));};exports['addDisposition']=function(_0x528cb5,_0x3f9428,_0x42b08c){if(_0x528cb5[_0x0bd6('0x59')]['id']){delete _0x528cb5[_0x0bd6('0x59')]['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x528cb5[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f9428,null))[_0x0bd6('0x20')](function(_0x1c7276){if(_0x1c7276){_0x528cb5[_0x0bd6('0x59')][_0x0bd6('0x64')]=_0x1c7276['id'];return db[_0x0bd6('0x65')]['create'](_0x528cb5[_0x0bd6('0x59')]);}})[_0x0bd6('0x20')](respondWithResult(_0x3f9428,null))['catch'](handleError(_0x3f9428,null));};exports['getDispositions']=function(_0x2eb79e,_0x343c8e,_0x1922d5){var _0x10894e={'raw':![],'where':{}};var _0x4702e5={};var _0x330f6f={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x2eb79e[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0x343c8e,null))[_0x0bd6('0x20')](function(_0x26d695){if(_0x26d695){_0x4702e5[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db['Disposition']['rawAttributes']);_0x4702e5[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x2eb79e['query']);_0x4702e5['filters']=_[_0x0bd6('0x44')](_0x4702e5[_0x0bd6('0x40')],_0x4702e5[_0x0bd6('0x41')]);_0x10894e['attributes']=_[_0x0bd6('0x44')](_0x4702e5['model'],qs[_0x0bd6('0x46')](_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x10894e[_0x0bd6('0x45')]=_0x10894e[_0x0bd6('0x45')]['length']?_0x10894e[_0x0bd6('0x45')]:_0x4702e5['model'];if(!_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x67')]('nolimit')){_0x10894e['limit']=qs[_0x0bd6('0x2c')](_0x2eb79e[_0x0bd6('0x41')]['limit']);_0x10894e[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x2eb79e[_0x0bd6('0x41')]['offset']);}_0x10894e['order']=qs[_0x0bd6('0x4a')](_0x2eb79e[_0x0bd6('0x41')]['sort']);_0x10894e[_0x0bd6('0x4e')]=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x2eb79e['query'],_0x4702e5['filters']));_0x10894e[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0x26d695['id'];if(_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0x10894e['where']=_[_0x0bd6('0x4d')](_0x10894e[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x10894e[_0x0bd6('0x45')],function(_0xfab104){var _0x432241={};_0x432241[_0xfab104]={'$like':'%'+_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x432241;})});}_0x10894e=_[_0x0bd6('0x4d')]({},_0x10894e,_0x2eb79e[_0x0bd6('0x56')]);return db['Disposition'][_0x0bd6('0x2d')]({'where':_0x10894e[_0x0bd6('0x4e')]})[_0x0bd6('0x20')](function(_0xcb55e7){_0x330f6f[_0x0bd6('0x2d')]=_0xcb55e7;if(_0x2eb79e[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x10894e[_0x0bd6('0x51')]=[{'all':!![]}];}return db[_0x0bd6('0x65')][_0x0bd6('0x52')](_0x10894e);})[_0x0bd6('0x20')](function(_0xf48bc8){_0x330f6f[_0x0bd6('0x53')]=_0xf48bc8;return _0x330f6f;});}})['then'](respondWithFilteredResult(_0x343c8e,_0x10894e))[_0x0bd6('0x61')](handleError(_0x343c8e,null));};exports[_0x0bd6('0x68')]=function(_0x274396,_0x1a87ca,_0x6e970b){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x274396['params']['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x1a87ca,null))['then'](function(_0x28db88){if(_0x28db88){return _0x28db88['removeDispositions'](_0x274396[_0x0bd6('0x41')]['ids']);}})[_0x0bd6('0x20')](respondWithStatusCode(_0x1a87ca,null))['catch'](handleError(_0x1a87ca,null));};exports[_0x0bd6('0x69')]=function(_0xb38500,_0x5c0aa6,_0x3cef56){if(_0xb38500['body']['id']){delete _0xb38500['body']['id'];}return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0xb38500['params']['id']}})['then'](handleEntityNotFound(_0x5c0aa6,null))[_0x0bd6('0x20')](function(_0x154f4b){if(_0x154f4b){_0xb38500['body'][_0x0bd6('0x64')]=_0x154f4b['id'];return db[_0x0bd6('0x6a')][_0x0bd6('0x58')](_0xb38500[_0x0bd6('0x59')]);}})[_0x0bd6('0x20')](respondWithResult(_0x5c0aa6,null))['catch'](handleError(_0x5c0aa6,null));};exports[_0x0bd6('0x6b')]=function(_0x21614c,_0x2ef0c0,_0x261ae6){var _0xa5daea={'raw':![],'where':{}};var _0x1203c5={};var _0x3cf242={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x21614c[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x2ef0c0,null))[_0x0bd6('0x20')](function(_0xc758be){if(_0xc758be){_0x1203c5[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0x6a')][_0x0bd6('0x3d')]);_0x1203c5[_0x0bd6('0x41')]=_['keys'](_0x21614c[_0x0bd6('0x41')]);_0x1203c5[_0x0bd6('0x43')]=_['intersection'](_0x1203c5[_0x0bd6('0x40')],_0x1203c5[_0x0bd6('0x41')]);_0xa5daea[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x1203c5[_0x0bd6('0x40')],qs[_0x0bd6('0x46')](_0x21614c[_0x0bd6('0x41')]['fields']));_0xa5daea[_0x0bd6('0x45')]=_0xa5daea[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0xa5daea[_0x0bd6('0x45')]:_0x1203c5['model'];if(!_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0xa5daea[_0x0bd6('0x2c')]=qs[_0x0bd6('0x2c')](_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0xa5daea[_0x0bd6('0x2a')]=qs['offset'](_0x21614c['query'][_0x0bd6('0x2a')]);}_0xa5daea[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x21614c[_0x0bd6('0x41')]['sort']);_0xa5daea[_0x0bd6('0x4e')]=qs['filters'](_[_0x0bd6('0x4b')](_0x21614c[_0x0bd6('0x41')],_0x1203c5['filters']));_0xa5daea[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0xc758be['id'];if(_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x4c')]){_0xa5daea[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0xa5daea[_0x0bd6('0x4e')],{'$or':_['map'](_0xa5daea[_0x0bd6('0x45')],function(_0x2846c3){var _0x12d0d9={};_0x12d0d9[_0x2846c3]={'$like':'%'+_0x21614c[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x12d0d9;})});}_0xa5daea=_[_0x0bd6('0x4d')]({},_0xa5daea,_0x21614c[_0x0bd6('0x56')]);return db['CannedAnswer'][_0x0bd6('0x2d')]({'where':_0xa5daea[_0x0bd6('0x4e')]})['then'](function(_0x1eba18){_0x3cf242[_0x0bd6('0x2d')]=_0x1eba18;if(_0x21614c['query'][_0x0bd6('0x50')]){_0xa5daea['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x0bd6('0x52')](_0xa5daea);})[_0x0bd6('0x20')](function(_0x313388){_0x3cf242[_0x0bd6('0x53')]=_0x313388;return _0x3cf242;});}})[_0x0bd6('0x20')](respondWithFilteredResult(_0x2ef0c0,_0xa5daea))[_0x0bd6('0x61')](handleError(_0x2ef0c0,null));};exports[_0x0bd6('0x6c')]=function(_0x2003a3,_0x8eeb82,_0x4e91d2){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x2003a3[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x8eeb82,null))[_0x0bd6('0x20')](function(_0x13d0cb){if(_0x13d0cb){return _0x13d0cb['removeAnswers'](_0x2003a3[_0x0bd6('0x41')]['ids']);}})[_0x0bd6('0x20')](respondWithStatusCode(_0x8eeb82,null))[_0x0bd6('0x61')](handleError(_0x8eeb82,null));};exports[_0x0bd6('0x6d')]=function(_0x58a502,_0x1ad256,_0x2149dc){var _0x150de3={'body':_0x58a502[_0x0bd6('0x59')],'channel':_0x0bd6('0x6e')};var _0x11b86c=[];var _0x39bbfc=[];var _0x28c6b2={};var _0x5e639a=![];return db[_0x0bd6('0x6f')][_0x0bd6('0x63')]()['then'](function(_0x10190e){if(!_0x10190e){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x72'));}_0x11b86c=_[_0x0bd6('0x73')](_[_0x0bd6('0x42')](_0x10190e),[_0x0bd6('0x74'),'updatedAt']);_0x39bbfc=_[_0x0bd6('0x73')](_['keys'](_0x10190e),[_0x0bd6('0x74'),_0x0bd6('0x75'),_0x0bd6('0x76'),'ListId']);if(_0x58a502[_0x0bd6('0x59')]['id']){delete _0x58a502[_0x0bd6('0x59')]['id'];}if(_[_0x0bd6('0x77')](_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x79'));}if(_[_0x0bd6('0x77')](_0x58a502['body'][_0x0bd6('0x59')])||_0x58a502[_0x0bd6('0x59')]['body']===''){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7a'));}if(_[_0x0bd6('0x77')](_0x58a502[_0x0bd6('0x59')]['mapKey'])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7b')+_0x39bbfc);}if(!_['includes'](_0x39bbfc,_0x58a502['body'][_0x0bd6('0x7c')])){throw new db[(_0x0bd6('0x70'))][(_0x0bd6('0x71'))](_0x0bd6('0x7d')+_0x39bbfc);}_0x28c6b2[_0x58a502['body']['mapKey']]=_0x58a502[_0x0bd6('0x59')]['from'];})[_0x0bd6('0x20')](function(){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x58a502[_0x0bd6('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x0bd6('0x7e'),'include':[{'model':db[_0x0bd6('0x6f')],'as':_0x0bd6('0x7f'),'where':_0x28c6b2,'limit':0x1,'order':[[_0x0bd6('0x75'),_0x0bd6('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x0bd6('0x81')}]});})['then'](handleEntityNotFound(_0x1ad256,null))[_0x0bd6('0x20')](function(_0x207a11){if(_0x207a11&&_0x207a11[_0x0bd6('0x7e')]){_0x150de3[_0x0bd6('0x82')]=_0x207a11;_0x150de3[_0x0bd6('0x83')]=_0x207a11[_0x0bd6('0x81')];_0x150de3[_0x0bd6('0x84')]=_0x207a11['List'];_0x150de3[_0x0bd6('0x83')]=_[_0x0bd6('0x85')](_0x150de3[_0x0bd6('0x83')],['priority'],[_0x0bd6('0x86')]);if(_0x150de3['account']['Applications']){delete _0x150de3[_0x0bd6('0x82')][_0x0bd6('0x81')];}if(_0x150de3['account']['List']&&_0x150de3[_0x0bd6('0x82')]['List'][_0x0bd6('0x7f')]['length']){return _0x150de3[_0x0bd6('0x82')][_0x0bd6('0x7e')]['Contacts'][0x0];}var _0x1ad332=_[_0x0bd6('0x87')](_0x58a502['body'],{'firstName':_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')],'ListId':_0x207a11['ListId']});_0x1ad332[_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x7c')]]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x78')];return db[_0x0bd6('0x6f')][_0x0bd6('0x58')](_0x1ad332,{'fields':_0x11b86c,'raw':!![]});}})[_0x0bd6('0x20')](handleEntityNotFound(_0x1ad256,null))[_0x0bd6('0x20')](function(_0x1fad05){_0x150de3[_0x0bd6('0x88')]=_0x1fad05;if(_0x1fad05){var _0x150d3b={'ContactId':_0x1fad05['id'],'OpenchannelAccountId':_0x58a502[_0x0bd6('0x55')]['id'],'from':(_0x1fad05[_0x0bd6('0x89')]||'')+'\x20'+(_0x1fad05[_0x0bd6('0x8a')]||'')};var _0x28d97d={'OpenchannelAccountId':_0x58a502['params']['id'],'closed':![]};if(_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')]){_0x28d97d[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')];return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':_0x28d97d})['then'](function(_0x53ed6c){if(_0x53ed6c){return[_0x53ed6c,![]];}_0x150d3b[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8b')];_0x150d3b[_0x0bd6('0x8d')]=_0x58a502['body'][_0x0bd6('0x8d')];return db[_0x0bd6('0x8c')][_0x0bd6('0x58')](_0x150d3b)['then'](function(_0x35d2ec){return[_0x35d2ec,!![]];});});}else{_0x28d97d[_0x0bd6('0x8b')]=null;}_0x28d97d[_0x0bd6('0x8e')]=_0x1fad05['id'];return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':_0x28d97d})[_0x0bd6('0x20')](function(_0xef8730){if(_0xef8730){return[_0xef8730,![]];}return db[_0x0bd6('0x8c')][_0x0bd6('0x58')](_0x150d3b)[_0x0bd6('0x20')](function(_0xf9c54d){return[_0xf9c54d,!![]];});});}})['spread'](function(_0x51a40e,_0x19450c){if(_0x51a40e){_0x5e639a=_0x19450c;if(!_0x19450c){var _0x294d7e={'from':(_0x150de3['contact'][_0x0bd6('0x89')]||'')+'\x20'+(_0x150de3['contact']['lastName']||'')};if(_0x58a502[_0x0bd6('0x59')]['threadId']&&_0x58a502[_0x0bd6('0x59')]['messageId']&&_0x58a502['body'][_0x0bd6('0x8b')]!=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8f')]){_0x294d7e[_0x0bd6('0x8b')]=_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x8f')];}return _0x51a40e[_0x0bd6('0x32')](_0x294d7e);}else{return _0x51a40e;}}})[_0x0bd6('0x20')](function(_0x1e02f0){_0x150de3['interaction']=_0x1e02f0['get']({'plain':!![]});_0x150de3[_0x0bd6('0x90')][_0x0bd6('0x91')]=_0x5e639a;if(_0x150de3[_0x0bd6('0x90')]['created']){if(_0x150de3['account'][_0x0bd6('0x92')]){_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x93')]({'id':0x0,'priority':_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x47')]+0x1,'app':'close','appdata':_0x0bd6('0x94'),'interval':_0x0bd6('0x95')});}}return db[_0x0bd6('0x96')][_0x0bd6('0x58')]({'body':_0x58a502[_0x0bd6('0x59')][_0x0bd6('0x59')],'OpenchannelAccountId':_0x58a502['params']['id'],'OpenchannelInteractionId':_0x1e02f0['id'],'direction':'in','ContactId':_0x150de3[_0x0bd6('0x88')]['id'],'AttachmentId':_0x58a502['body'][_0x0bd6('0x97')]});})[_0x0bd6('0x20')](function(_0x4d3521){_0x150de3[_0x0bd6('0x27')]=_0x4d3521;if(_0x150de3[_0x0bd6('0x90')][_0x0bd6('0x98')]){return db[_0x0bd6('0x99')][_0x0bd6('0x57')]({'attributes':['id',_0x0bd6('0x37')],'where':{'id':_0x150de3['interaction'][_0x0bd6('0x98')]}})[_0x0bd6('0x20')](function(_0x2bdc98){if(_0x2bdc98){_0x150de3[_0x0bd6('0x83')][_0x0bd6('0x9a')]({'id':0x0,'priority':0x0,'app':_0x0bd6('0x9b'),'appdata':_0x2bdc98[_0x0bd6('0x37')]+','+(_0x150de3['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0bd6('0x95')});_0x150de3['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x0bd6('0x9c'),_0x150de3);});}return respondWithRpcPromise(_0x0bd6('0x9d'),_0x0bd6('0x9c'),_0x150de3);})['then'](function(_0x14956c){respondWithRpcPromise('EventManager',_0x0bd6('0x9e'),{'event':_0x0bd6('0x6d'),'message':_0x14956c},client9002);return _0x14956c;})[_0x0bd6('0x20')](respondWithResult(_0x1ad256,null))[_0x0bd6('0x61')](handleError(_0x1ad256,null));};exports[_0x0bd6('0x9f')]=function(_0x205f73,_0x7e40c6){var _0x50451b=_0x205f73[_0x0bd6('0x55')]['id'];var _0x527ea5=_0x205f73[_0x0bd6('0x59')];var _0x44029a=0xc8;var _0x502620=null;return db[_0x0bd6('0xa0')]['transaction']({'isolationLevel':db['sequelize'][_0x0bd6('0xa1')][_0x0bd6('0xa2')][_0x0bd6('0xa3')]},function(_0x458b01){return db[_0x0bd6('0x3c')]['findOne']({'where':{'id':_0x50451b},'transaction':_0x458b01})[_0x0bd6('0x20')](function(_0x32f465){if(_0x32f465){return db['OpenchannelApplication'][_0x0bd6('0x33')]({'where':{'OpenchannelAccountId':_0x50451b},'transaction':_0x458b01})['then'](function(){var _0x42269d=_[_0x0bd6('0x3b')](_0x527ea5,function(_0x446319){_0x446319['OpenchannelAccountId']=_0x50451b;return _0x446319;});return db[_0x0bd6('0xa4')]['bulkCreate'](_0x42269d,{'transaction':_0x458b01});});}else{_0x44029a=0x194;_0x502620=[];}});})[_0x0bd6('0x20')](function(){if(_0x44029a!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x50451b},'order':'priority'})[_0x0bd6('0x20')](function(_0x260572){_0x502620=_0x260572;});}})[_0x0bd6('0x61')](function(_0x3cf2cc){_0x44029a=0x1f4;logger[_0x0bd6('0x25')](_0x3cf2cc[_0x0bd6('0x36')]);if(_0x3cf2cc[_0x0bd6('0x37')]){delete _0x3cf2cc[_0x0bd6('0x37')];}_0x502620=_0x3cf2cc;})[_0x0bd6('0xa5')](function(){if(_0x502620===null){_0x7e40c6[_0x0bd6('0xa6')](_0x44029a);}else{if(_0x44029a===0x1f4){_0x7e40c6[_0x0bd6('0x29')](_0x44029a)[_0x0bd6('0xa7')](_0x502620);}else{_0x7e40c6['status'](_0x44029a)['json'](_0x502620);}}});};exports[_0x0bd6('0xa8')]=function(_0xde701f,_0xf4ea66,_0x366ce1){var _0x3c16ee={};var _0x243b0c={};var _0x565114;var _0x1dc506;return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0xde701f[_0x0bd6('0x55')]['id']}})['then'](handleEntityNotFound(_0xf4ea66,null))['then'](function(_0x4b3e5c){if(_0x4b3e5c){_0x565114=_0x4b3e5c;_0x243b0c[_0x0bd6('0x40')]=_[_0x0bd6('0x42')](db[_0x0bd6('0xa4')][_0x0bd6('0x3d')]);_0x243b0c['query']=_['keys'](_0xde701f[_0x0bd6('0x41')]);_0x243b0c[_0x0bd6('0x43')]=_[_0x0bd6('0x44')](_0x243b0c[_0x0bd6('0x40')],_0x243b0c[_0x0bd6('0x41')]);_0x3c16ee['attributes']=_[_0x0bd6('0x44')](_0x243b0c['model'],qs[_0x0bd6('0x46')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x3c16ee[_0x0bd6('0x45')]=_0x3c16ee['attributes'][_0x0bd6('0x47')]?_0x3c16ee[_0x0bd6('0x45')]:_0x243b0c[_0x0bd6('0x40')];_0x3c16ee[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x3c16ee['where']=qs[_0x0bd6('0x43')](_['pick'](_0xde701f[_0x0bd6('0x41')],_0x243b0c[_0x0bd6('0x43')]));if(_0xde701f['query'][_0x0bd6('0x4c')]){_0x3c16ee[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0x3c16ee[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x3c16ee['attributes'],function(_0x140494){var _0x11ec1d={};_0x11ec1d[_0x140494]={'$like':'%'+_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x4c')]+'%'};return _0x11ec1d;})});}_0x3c16ee=_[_0x0bd6('0x4d')]({},_0x3c16ee,_0xde701f['options']);return _0x565114['getApplications'](_0x3c16ee);}})[_0x0bd6('0x20')](function(_0x4da3ac){if(_0x4da3ac){_0x1dc506=_0x4da3ac[_0x0bd6('0x47')];if(!_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0x3c16ee['limit']=qs[_0x0bd6('0x2c')](_0xde701f[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x3c16ee[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0xde701f[_0x0bd6('0x41')]['offset']);}return _0x565114['getApplications'](_0x3c16ee);}})['then'](function(_0x204236){if(_0x204236){return _0x204236?{'count':_0x1dc506,'rows':_0x204236}:null;}})[_0x0bd6('0x20')](respondWithResult(_0xf4ea66,null))['catch'](handleError(_0xf4ea66,null));};exports[_0x0bd6('0xa9')]=function(_0x34a101,_0x287320,_0x47e5cf){var _0x5ddc15={'raw':![],'where':{}};var _0x365c78={};var _0x52afa2={'count':0x0,'rows':[]};return db[_0x0bd6('0x3c')]['findOne']({'where':{'id':_0x34a101[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x287320,null))['then'](function(_0x1e9e59){if(_0x1e9e59){_0x365c78['model']=_[_0x0bd6('0x42')](db[_0x0bd6('0x8c')][_0x0bd6('0x3d')]);_0x365c78[_0x0bd6('0x41')]=_[_0x0bd6('0x42')](_0x34a101[_0x0bd6('0x41')]);_0x365c78[_0x0bd6('0x43')]=_['intersection'](_0x365c78[_0x0bd6('0x40')],_0x365c78['query']);_0x5ddc15[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x365c78['model'],qs[_0x0bd6('0x46')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x46')]));_0x5ddc15[_0x0bd6('0x45')]=_0x5ddc15[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x5ddc15[_0x0bd6('0x45')]:_0x365c78[_0x0bd6('0x40')];if(!_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x67')](_0x0bd6('0x48'))){_0x5ddc15[_0x0bd6('0x2c')]=qs['limit'](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x5ddc15[_0x0bd6('0x2a')]=qs[_0x0bd6('0x2a')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}_0x5ddc15[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x4a')]);_0x5ddc15['where']=qs[_0x0bd6('0x43')](_[_0x0bd6('0x4b')](_0x34a101[_0x0bd6('0x41')],_0x365c78['filters']));_0x5ddc15[_0x0bd6('0x4e')][_0x0bd6('0x64')]=_0x1e9e59['id'];if(_0x34a101['query']['filter']){_0x5ddc15[_0x0bd6('0x4e')]=_['merge'](_0x5ddc15[_0x0bd6('0x4e')],{'$or':_['map'](_0x5ddc15[_0x0bd6('0x45')],function(_0xfe23ff){var _0x1a6350={};_0x1a6350[_0xfe23ff]={'$like':'%'+_0x34a101['query'][_0x0bd6('0x4c')]+'%'};return _0x1a6350;})});}_0x5ddc15=_[_0x0bd6('0x4d')]({},_0x5ddc15,_0x34a101[_0x0bd6('0x56')]);return db['OpenchannelInteraction'][_0x0bd6('0x2d')]({'where':_0x5ddc15['where']})[_0x0bd6('0x20')](function(_0x291036){_0x52afa2[_0x0bd6('0x2d')]=_0x291036;if(_0x34a101[_0x0bd6('0x41')][_0x0bd6('0x50')]){_0x5ddc15[_0x0bd6('0x51')]=[{'model':db[_0x0bd6('0x6f')],'as':_0x0bd6('0xaa'),'required':![]},{'model':db[_0x0bd6('0x99')],'as':_0x0bd6('0xab'),'attributes':['name',_0x0bd6('0xac'),'internal'],'required':![]},{'model':db[_0x0bd6('0xad')],'as':'Tags','attributes':['id',_0x0bd6('0x37'),'color'],'where':_0x34a101[_0x0bd6('0x41')]['tag']?{'id':_0x34a101[_0x0bd6('0x41')]['tag']}:undefined,'required':_0x34a101[_0x0bd6('0x41')]['tag']?!![]:![]}];}return db[_0x0bd6('0x8c')]['findAll'](_0x5ddc15);})[_0x0bd6('0x20')](function(_0x2c8598){_0x52afa2[_0x0bd6('0x53')]=_0x2c8598;return _0x52afa2;});}})['then'](respondWithFilteredResult(_0x287320,_0x5ddc15))['catch'](handleError(_0x287320,null));};exports['addAgents']=function(_0x2a5a4d,_0x26196a,_0x148a35){return db[_0x0bd6('0x3c')]['find']({'where':{'id':_0x2a5a4d['params']['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x26196a,null))['then'](function(_0x3ec2fa){if(_0x3ec2fa){return _0x3ec2fa[_0x0bd6('0xae')](_0x2a5a4d['body'][_0x0bd6('0xaf')],_[_0x0bd6('0xb0')](_0x2a5a4d['body'],[_0x0bd6('0xaf'),'id'])||{})[_0x0bd6('0xb1')](function(_0xb1610f){for(var _0x3ce75c=0x0;_0x3ce75c<_0x2a5a4d[_0x0bd6('0x59')][_0x0bd6('0xaf')][_0x0bd6('0x47')];_0x3ce75c+=0x1){socket[_0x0bd6('0xb2')](_0x0bd6('0xb3'),{'UserId':Number(_0x2a5a4d[_0x0bd6('0x59')][_0x0bd6('0xaf')][_0x3ce75c]),'OpenchannelAccountId':Number(_0x2a5a4d[_0x0bd6('0x55')]['id'])});}return _0xb1610f;});}})[_0x0bd6('0x20')](respondWithResult(_0x26196a,null))['catch'](handleError(_0x26196a,null));};exports[_0x0bd6('0xb4')]=function(_0x38cd6a,_0x404107,_0x4cda21){return db[_0x0bd6('0x3c')]['find']({'where':{'id':_0x38cd6a[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x404107,null))[_0x0bd6('0x20')](function(_0x2d4184){if(_0x2d4184){return _0x2d4184[_0x0bd6('0xb4')](_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')])[_0x0bd6('0x20')](function(){if(_['isArray'](_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')])){for(var _0x5a3824=0x0;_0x5a3824<_0x38cd6a[_0x0bd6('0x41')]['ids'][_0x0bd6('0x47')];_0x5a3824+=0x1){socket[_0x0bd6('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x38cd6a[_0x0bd6('0x41')]['ids'][_0x5a3824]),'OpenchannelAccountId':Number(_0x38cd6a['params']['id'])});}}else{socket['emit'](_0x0bd6('0xb5'),{'UserId':Number(_0x38cd6a[_0x0bd6('0x41')][_0x0bd6('0xaf')]),'OpenchannelAccountId':Number(_0x38cd6a[_0x0bd6('0x55')]['id'])});}});}})[_0x0bd6('0x20')](respondWithStatusCode(_0x404107,null))[_0x0bd6('0x61')](handleError(_0x404107,null));};exports[_0x0bd6('0xb6')]=function(_0x59c44c,_0x4c4267,_0x5e5bd3){var _0x12901a={};var _0x4877eb={};var _0x5de937;var _0xf9e492;return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x59c44c[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x4c4267,null))[_0x0bd6('0x20')](function(_0x361aac){if(_0x361aac){_0x5de937=_0x361aac;_0x4877eb[_0x0bd6('0x40')]=_['keys'](db[_0x0bd6('0x99')][_0x0bd6('0x3d')]);_0x4877eb[_0x0bd6('0x41')]=_['keys'](_0x59c44c[_0x0bd6('0x41')]);_0x4877eb[_0x0bd6('0x43')]=_['intersection'](_0x4877eb[_0x0bd6('0x40')],_0x4877eb[_0x0bd6('0x41')]);_0x12901a[_0x0bd6('0x45')]=_[_0x0bd6('0x44')](_0x4877eb[_0x0bd6('0x40')],qs['fields'](_0x59c44c[_0x0bd6('0x41')]['fields']));_0x12901a['attributes']=_0x12901a[_0x0bd6('0x45')][_0x0bd6('0x47')]?_0x12901a[_0x0bd6('0x45')]:_0x4877eb[_0x0bd6('0x40')];_0x12901a[_0x0bd6('0x49')]=qs[_0x0bd6('0x4a')](_0x59c44c['query'][_0x0bd6('0x4a')]);_0x12901a[_0x0bd6('0x4e')]=qs['filters'](_[_0x0bd6('0x4b')](_0x59c44c['query'],_0x4877eb[_0x0bd6('0x43')]));if(_0x59c44c['query'][_0x0bd6('0x4c')]){_0x12901a[_0x0bd6('0x4e')]=_[_0x0bd6('0x4d')](_0x12901a[_0x0bd6('0x4e')],{'$or':_[_0x0bd6('0x3b')](_0x12901a[_0x0bd6('0x45')],function(_0x578367){var _0x1093c4={};_0x1093c4[_0x578367]={'$like':'%'+_0x59c44c[_0x0bd6('0x41')]['filter']+'%'};return _0x1093c4;})});}_0x12901a=_['merge']({},_0x12901a,_0x59c44c[_0x0bd6('0x56')]);return _0x5de937[_0x0bd6('0xb6')](_0x12901a);}})[_0x0bd6('0x20')](function(_0x4ee44f){if(_0x4ee44f){_0xf9e492=_0x4ee44f[_0x0bd6('0x47')];if(!_0x59c44c[_0x0bd6('0x41')]['hasOwnProperty']('nolimit')){_0x12901a[_0x0bd6('0x2c')]=qs['limit'](_0x59c44c[_0x0bd6('0x41')][_0x0bd6('0x2c')]);_0x12901a['offset']=qs['offset'](_0x59c44c[_0x0bd6('0x41')][_0x0bd6('0x2a')]);}return _0x5de937[_0x0bd6('0xb6')](_0x12901a);}})[_0x0bd6('0x20')](function(_0x1eeba2){if(_0x1eeba2){return _0x1eeba2?{'count':_0xf9e492,'rows':_0x1eeba2}:null;}})[_0x0bd6('0x20')](respondWithResult(_0x4c4267,null))[_0x0bd6('0x61')](handleError(_0x4c4267,null));};exports[_0x0bd6('0xa7')]=function(_0x32f977,_0x5d23f7,_0xf6fa06){var _0x365dd4,_0x88d332,_0x44d9e4;if(_['isNil'](_0x32f977[_0x0bd6('0x59')]['body'])||_0x32f977['body']['body']===''){throw new db['Sequelize'][(_0x0bd6('0x71'))](_0x0bd6('0x7a'));}if(_[_0x0bd6('0x77')](_0x32f977[_0x0bd6('0x59')]['to'])){}_0x365dd4=_0x32f977[_0x0bd6('0x59')]['to'];return db[_0x0bd6('0x3c')][_0x0bd6('0x66')]({'where':{'id':_0x32f977[_0x0bd6('0x55')]['id']}})[_0x0bd6('0x20')](handleEntityNotFound(_0x5d23f7,null))['then'](function(_0x1a901d){if(_0x1a901d){return db[_0x0bd6('0x3c')][_0x0bd6('0x57')]({'where':{'id':_0x1a901d['id']},'include':[{'model':db[_0x0bd6('0xb7')],'as':_0x0bd6('0x7e'),'include':[{'model':db['CmContact'],'as':_0x0bd6('0x7f'),'where':{[_0x1a901d[_0x0bd6('0x7c')]]:_0x365dd4},'limit':0x1,'order':[[_0x0bd6('0x75'),_0x0bd6('0x80')]]}]}]})['then'](handleEntityNotFound(_0x5d23f7,null))[_0x0bd6('0x20')](function(_0x2d9737){if(_0x2d9737&&_0x2d9737[_0x0bd6('0x7e')]){_0x88d332=_0x2d9737[_0x0bd6('0x5a')]({'plain':!![]});if(_0x88d332[_0x0bd6('0x7e')]&&_0x88d332['List'][_0x0bd6('0x7f')][_0x0bd6('0x47')]){return _0x88d332['List'][_0x0bd6('0x7f')][0x0];}return db['CmContact'][_0x0bd6('0x58')](_['defaults'](_0x32f977[_0x0bd6('0x59')],{'firstName':_0x365dd4,[_0x2d9737[_0x0bd6('0x7c')]]:_0x365dd4,'phone':_0x365dd4,'ListId':_0x88d332[_0x0bd6('0xb8')]}));}})[_0x0bd6('0x20')](handleEntityNotFound(_0x5d23f7,null))[_0x0bd6('0x20')](function(_0x251a4b){if(_0x251a4b){_0x44d9e4=_0x251a4b;return db[_0x0bd6('0x8c')][_0x0bd6('0x57')]({'where':{'ContactId':_0x44d9e4['id'],'closed':![],'OpenchannelAccountId':_0x88d332['id']}})['then'](function(_0x1a55c7){if(_0x1a55c7){return[_0x1a55c7,![]];}return db[_0x0bd6('0x8c')][_0x0bd6('0x58')]({'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id'],'OpenchannelAccountId':_0x88d332['id'],'lastMsgDirection':_0x0bd6('0xb9'),'firstMsgDirection':_0x0bd6('0xb9'),'Messages':[_[_0x0bd6('0x4d')](_0x32f977[_0x0bd6('0x59')],{'read':![],'body':_0x32f977[_0x0bd6('0x59')]['body'],'OpenchannelAccountId':_0x88d332['id'],'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id']})]},{'include':[{'model':db[_0x0bd6('0x96')],'as':_0x0bd6('0xba')}]})[_0x0bd6('0x20')](function(_0x34a479){return[_0x34a479,!![]];});});}})[_0x0bd6('0xb1')](function(_0x15981c,_0xd9531a){if(_0xd9531a){return _0x15981c;}return db[_0x0bd6('0x96')][_0x0bd6('0x58')](_['merge'](_0x32f977[_0x0bd6('0x59')],{'read':![],'body':_0x32f977[_0x0bd6('0x59')][_0x0bd6('0x59')],'OpenchannelAccountId':_0x88d332['id'],'OpenchannelInteractionId':_0x15981c['id'],'UserId':_0x32f977[_0x0bd6('0x5c')]['id'],'ContactId':_0x44d9e4['id']}))[_0x0bd6('0x20')](function(_0x3762bb){_0x15981c['dataValues'][_0x0bd6('0xba')]=[];_0x15981c[_0x0bd6('0xbb')][_0x0bd6('0xba')][_0x0bd6('0x93')](_0x3762bb['dataValues']);return _0x15981c;});});}})[_0x0bd6('0x20')](respondWithResult(_0x5d23f7,null))[_0x0bd6('0x61')](handleError(_0x5d23f7,null));}; \ No newline at end of file +var _0x1801=['out','Messages','OpenchannelMessage','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','update','destroy','get','OpenchannelAccounts','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','addDisposition','OpenchannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','openchannel','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','List','account','applications','orderBy','priority','asc','Applications','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1801,0xc6));var _0x1180=function(_0x1478c4,_0x356182){_0x1478c4=_0x1478c4-0x0;var _0x2d4169=_0x1801[_0x1478c4];return _0x2d4169;};'use strict';var emlformat=require(_0x1180('0x0'));var rimraf=require(_0x1180('0x1'));var zipdir=require(_0x1180('0x2'));var jsonpatch=require(_0x1180('0x3'));var rp=require(_0x1180('0x4'));var moment=require(_0x1180('0x5'));var BPromise=require(_0x1180('0x6'));var Mustache=require(_0x1180('0x7'));var util=require(_0x1180('0x8'));var path=require(_0x1180('0x9'));var sox=require(_0x1180('0xa'));var csv=require(_0x1180('0xb'));var ejs=require(_0x1180('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1180('0xd'));var squel=require(_0x1180('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1180('0xf'));var toCsv=require(_0x1180('0xb'));var querystring=require(_0x1180('0x10'));var Papa=require(_0x1180('0x11'));var Redis=require(_0x1180('0x12'));var authService=require(_0x1180('0x13'));var qs=require(_0x1180('0x14'));var as=require(_0x1180('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1180('0x16'))(_0x1180('0x17'));var utils=require(_0x1180('0x18'));var config=require(_0x1180('0x19'));var licenseUtil=require(_0x1180('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1180('0x1b')](config[_0x1180('0x1c')],{'host':_0x1180('0x1d'),'port':0x18eb});var socket=require(_0x1180('0x1e'))(new Redis(config[_0x1180('0x1c')]));require(_0x1180('0x1f'))[_0x1180('0x20')](socket);var jayson=require(_0x1180('0x21'));var client=jayson[_0x1180('0x22')][_0x1180('0x23')]({'port':0x232c});var client9002=jayson[_0x1180('0x22')][_0x1180('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x12de8c,_0x5e263f,_0x56cd8b,_0x56b828){return new BPromise(function(_0x37c513,_0x5b8d60){var _0x22448f=_0x56b828||client;return _0x22448f['request'](_0x12de8c,_0x56cd8b)[_0x1180('0x24')](function(_0x2d4714){logger[_0x1180('0x25')](_0x1180('0x26'),_0x5e263f,_0x1180('0x27'));logger[_0x1180('0x28')](_0x1180('0x29'),_0x5e263f,_0x1180('0x27'),JSON[_0x1180('0x2a')](_0x2d4714));if(_0x2d4714[_0x1180('0x2b')]){if(_0x2d4714[_0x1180('0x2b')]['code']===0x1f4){logger[_0x1180('0x2b')](_0x1180('0x26'),_0x5e263f,_0x2d4714[_0x1180('0x2b')]['message']);return _0x5b8d60(_0x2d4714[_0x1180('0x2b')]['message']);}logger[_0x1180('0x2b')](_0x1180('0x26'),_0x5e263f,_0x2d4714[_0x1180('0x2b')][_0x1180('0x2c')]);return _0x37c513(_0x2d4714[_0x1180('0x2b')]['message']);}else{logger[_0x1180('0x25')](_0x1180('0x26'),_0x5e263f,_0x1180('0x27'));_0x37c513(_0x2d4714[_0x1180('0x2d')][_0x1180('0x2c')]);}})[_0x1180('0x2e')](function(_0x3586ff){logger[_0x1180('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e263f,_0x3586ff);_0x5b8d60(_0x3586ff);});});}function respondWithStatusCode(_0x3bdeee,_0x3f7348){_0x3f7348=_0x3f7348||0xcc;return function(_0x289013){if(_0x289013){return _0x3bdeee[_0x1180('0x2f')](_0x3f7348);}return _0x3bdeee[_0x1180('0x30')](_0x3f7348)['end']();};}function respondWithResult(_0x433eb8,_0x319426){_0x319426=_0x319426||0xc8;return function(_0x1309bb){if(_0x1309bb){return _0x433eb8[_0x1180('0x30')](_0x319426)['json'](_0x1309bb);}};}function respondWithFilteredResult(_0x349783,_0xbdec61){return function(_0x1917f5){if(_0x1917f5){var _0x9bec5f=typeof _0xbdec61[_0x1180('0x31')]===_0x1180('0x32')&&typeof _0xbdec61['limit']==='undefined';var _0x141908=_0x1917f5[_0x1180('0x33')];var _0x54836a=_0x9bec5f?0x0:_0xbdec61[_0x1180('0x31')];var _0x548d03=_0x9bec5f?_0x1917f5[_0x1180('0x33')]:_0xbdec61[_0x1180('0x31')]+_0xbdec61['limit'];var _0x4df16a;if(_0x548d03>=_0x141908){_0x548d03=_0x141908;_0x4df16a=0xc8;}else{_0x4df16a=0xce;}_0x349783[_0x1180('0x30')](_0x4df16a);return _0x349783[_0x1180('0x34')](_0x1180('0x35'),_0x54836a+'-'+_0x548d03+'/'+_0x141908)[_0x1180('0x36')](_0x1917f5);}return null;};}function patchUpdates(_0x20530b){return function(_0xa88840){try{jsonpatch[_0x1180('0x37')](_0xa88840,_0x20530b,!![]);}catch(_0x57875f){return BPromise['reject'](_0x57875f);}return _0xa88840[_0x1180('0x38')]();};}function saveUpdates(_0x16dde2,_0x82c94f){return function(_0x3f1053){if(_0x3f1053){return _0x3f1053[_0x1180('0x39')](_0x16dde2)['then'](function(_0x2cf6bc){return _0x2cf6bc;});}return null;};}function removeEntity(_0x8f2563,_0x490429){return function(_0xa2aff8){if(_0xa2aff8){return _0xa2aff8[_0x1180('0x3a')]()['then'](function(){var _0x2e1b6b=_0xa2aff8[_0x1180('0x3b')]({'plain':!![]});var _0xb1099b=_0x1180('0x3c');return db['UserProfileResource'][_0x1180('0x3a')]({'where':{'type':_0xb1099b,'resourceId':_0x2e1b6b['id']}})[_0x1180('0x24')](function(){return _0xa2aff8;});})['then'](function(){_0x8f2563[_0x1180('0x30')](0xcc)[_0x1180('0x3d')]();});}};}function handleEntityNotFound(_0xfdeca8,_0x5bb77e){return function(_0x4c1456){if(!_0x4c1456){_0xfdeca8[_0x1180('0x2f')](0x194);}return _0x4c1456;};}function handleError(_0x1d7762,_0x5cc735){_0x5cc735=_0x5cc735||0x1f4;return function(_0x1167cc){logger['error'](_0x1167cc[_0x1180('0x3e')]);if(_0x1167cc[_0x1180('0x3f')]){delete _0x1167cc[_0x1180('0x3f')];}_0x1d7762[_0x1180('0x30')](_0x5cc735)[_0x1180('0x40')](_0x1167cc);};}exports[_0x1180('0x41')]=function(_0x595936,_0x1e7856){var _0x34fcaa={'include':[{'model':db[_0x1180('0x42')],'as':_0x1180('0x43')}]},_0x998e7f={},_0x412d2b={'count':0x0,'rows':[]};var _0x531515=_[_0x1180('0x44')](db[_0x1180('0x45')]['rawAttributes'],function(_0x28033b){return{'name':_0x28033b['fieldName'],'type':_0x28033b[_0x1180('0x46')][_0x1180('0x47')]};});_0x998e7f[_0x1180('0x48')]=_[_0x1180('0x44')](_0x531515,_0x1180('0x3f'));_0x998e7f[_0x1180('0x49')]=_[_0x1180('0x4a')](_0x595936['query']);_0x998e7f[_0x1180('0x4b')]=_[_0x1180('0x4c')](_0x998e7f[_0x1180('0x48')],_0x998e7f['query']);_0x34fcaa[_0x1180('0x4d')]=_[_0x1180('0x4c')](_0x998e7f[_0x1180('0x48')],qs[_0x1180('0x4e')](_0x595936[_0x1180('0x49')][_0x1180('0x4e')]));_0x34fcaa[_0x1180('0x4d')]=_0x34fcaa[_0x1180('0x4d')][_0x1180('0x4f')]?_0x34fcaa[_0x1180('0x4d')]:_0x998e7f[_0x1180('0x48')];if(!_0x595936['query'][_0x1180('0x50')](_0x1180('0x51'))){_0x34fcaa[_0x1180('0x52')]=qs[_0x1180('0x52')](_0x595936[_0x1180('0x49')][_0x1180('0x52')]);_0x34fcaa['offset']=qs['offset'](_0x595936['query'][_0x1180('0x31')]);}_0x34fcaa[_0x1180('0x53')]=qs[_0x1180('0x54')](_0x595936['query']['sort']);_0x34fcaa['where']=qs[_0x1180('0x4b')](_[_0x1180('0x55')](_0x595936[_0x1180('0x49')],_0x998e7f['filters']),_0x531515);if(_0x595936[_0x1180('0x49')][_0x1180('0x56')]){_0x34fcaa[_0x1180('0x57')]=_[_0x1180('0x58')](_0x34fcaa['where'],{'$or':_['map'](_0x531515,function(_0x4ba899){if(_0x4ba899[_0x1180('0x46')]!==_0x1180('0x59')){var _0x3d702b={};_0x3d702b[_0x4ba899['name']]={'$like':'%'+_0x595936[_0x1180('0x49')][_0x1180('0x56')]+'%'};return _0x3d702b;}})});}_0x34fcaa=_[_0x1180('0x58')]({},_0x34fcaa,_0x595936[_0x1180('0x5a')]);var _0x1f6f97={'where':_0x34fcaa['where']};return db[_0x1180('0x45')][_0x1180('0x33')](_0x1f6f97)[_0x1180('0x24')](function(_0x37cb47){_0x412d2b[_0x1180('0x33')]=_0x37cb47;if(_0x595936[_0x1180('0x49')][_0x1180('0x5b')]){_0x34fcaa['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x1180('0x5c')](_0x34fcaa);})[_0x1180('0x24')](function(_0x49dc14){_0x412d2b[_0x1180('0x5d')]=_0x49dc14;return _0x412d2b;})['then'](respondWithFilteredResult(_0x1e7856,_0x34fcaa))['catch'](handleError(_0x1e7856,null));};exports[_0x1180('0x5e')]=function(_0x539b72,_0x44a1c2){var _0x53cfcd={'raw':![],'where':{'id':_0x539b72[_0x1180('0x5f')]['id']},'include':[{'model':db[_0x1180('0x42')],'as':'mandatoryDispositionPause'}]},_0x152dae={};_0x152dae[_0x1180('0x48')]=_['keys'](db[_0x1180('0x45')][_0x1180('0x60')]);_0x152dae[_0x1180('0x49')]=_[_0x1180('0x4a')](_0x539b72[_0x1180('0x49')]);_0x152dae[_0x1180('0x4b')]=_[_0x1180('0x4c')](_0x152dae['model'],_0x152dae[_0x1180('0x49')]);_0x53cfcd[_0x1180('0x4d')]=_[_0x1180('0x4c')](_0x152dae['model'],qs[_0x1180('0x4e')](_0x539b72[_0x1180('0x49')][_0x1180('0x4e')]));_0x53cfcd['attributes']=_0x53cfcd[_0x1180('0x4d')][_0x1180('0x4f')]?_0x53cfcd[_0x1180('0x4d')]:_0x152dae[_0x1180('0x48')];if(_0x539b72['query'][_0x1180('0x5b')]){_0x53cfcd[_0x1180('0x61')]=[{'all':!![]}];}_0x53cfcd=_[_0x1180('0x58')]({},_0x53cfcd,_0x539b72[_0x1180('0x5a')]);return db[_0x1180('0x45')][_0x1180('0x62')](_0x53cfcd)[_0x1180('0x24')](handleEntityNotFound(_0x44a1c2,null))[_0x1180('0x24')](respondWithResult(_0x44a1c2,null))[_0x1180('0x2e')](handleError(_0x44a1c2,null));};exports[_0x1180('0x63')]=function(_0x41a7ae,_0x28eb8a){return db[_0x1180('0x45')][_0x1180('0x63')](_0x41a7ae[_0x1180('0x64')],{})[_0x1180('0x24')](function(_0x1503aa){var _0x5c674f=_0x41a7ae[_0x1180('0x65')][_0x1180('0x3b')]({'plain':!![]});if(!_0x5c674f)throw new Error(_0x1180('0x66'));if(_0x5c674f[_0x1180('0x67')]===_0x1180('0x65')){var _0x5020cc=_0x1503aa[_0x1180('0x3b')]({'plain':!![]});var _0xe51fa=_0x1180('0x3c');return db[_0x1180('0x68')][_0x1180('0x62')]({'where':{'name':_0xe51fa,'userProfileId':_0x5c674f[_0x1180('0x69')]},'raw':!![]})[_0x1180('0x24')](function(_0x5773d7){if(_0x5773d7&&_0x5773d7['autoAssociation']===0x0){return db['UserProfileResource'][_0x1180('0x63')]({'name':_0x5020cc[_0x1180('0x3f')],'resourceId':_0x5020cc['id'],'type':_0x5773d7[_0x1180('0x3f')],'sectionId':_0x5773d7['id']},{})[_0x1180('0x24')](function(){return _0x1503aa;});}else{return _0x1503aa;}})['catch'](function(_0x55d3e1){logger[_0x1180('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55d3e1);throw _0x55d3e1;});}return _0x1503aa;})[_0x1180('0x24')](respondWithResult(_0x28eb8a,0xc9))['catch'](handleError(_0x28eb8a,null));};exports['update']=function(_0x15a453,_0x167917){if(_0x15a453['body']['id']){delete _0x15a453[_0x1180('0x64')]['id'];}return db['OpenchannelAccount'][_0x1180('0x62')]({'where':{'id':_0x15a453[_0x1180('0x5f')]['id']},'include':[{'model':db[_0x1180('0x42')],'as':_0x1180('0x43')}]})[_0x1180('0x24')](handleEntityNotFound(_0x167917,null))[_0x1180('0x24')](saveUpdates(_0x15a453[_0x1180('0x64')],null))[_0x1180('0x24')](respondWithResult(_0x167917,null))[_0x1180('0x2e')](handleError(_0x167917,null));};exports['destroy']=function(_0x191e4d,_0x1c7f52){return db[_0x1180('0x45')][_0x1180('0x62')]({'where':{'id':_0x191e4d['params']['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x1c7f52,null))['then'](removeEntity(_0x1c7f52,null))[_0x1180('0x2e')](handleError(_0x1c7f52,null));};exports[_0x1180('0x6a')]=function(_0x57f0a3,_0x193e5e){return db[_0x1180('0x45')][_0x1180('0x6a')]()[_0x1180('0x24')](respondWithResult(_0x193e5e,null))[_0x1180('0x2e')](handleError(_0x193e5e,null));};exports[_0x1180('0x6b')]=function(_0x239290,_0x369491,_0x131e40){if(_0x239290[_0x1180('0x64')]['id']){delete _0x239290[_0x1180('0x64')]['id'];}return db[_0x1180('0x45')]['find']({'where':{'id':_0x239290['params']['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x369491,null))[_0x1180('0x24')](function(_0xfc58eb){if(_0xfc58eb){_0x239290[_0x1180('0x64')][_0x1180('0x6c')]=_0xfc58eb['id'];return db['Disposition'][_0x1180('0x63')](_0x239290[_0x1180('0x64')]);}})[_0x1180('0x24')](respondWithResult(_0x369491,null))['catch'](handleError(_0x369491,null));};exports[_0x1180('0x6d')]=function(_0xe70cbd,_0x3544a8,_0x43dfc0){var _0x23462b={'raw':![],'where':{}};var _0x39a2cf={};var _0x9a43c7={'count':0x0,'rows':[]};return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0xe70cbd[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x3544a8,null))[_0x1180('0x24')](function(_0x2cbbb7){if(_0x2cbbb7){_0x39a2cf['model']=_['keys'](db['Disposition'][_0x1180('0x60')]);_0x39a2cf[_0x1180('0x49')]=_[_0x1180('0x4a')](_0xe70cbd[_0x1180('0x49')]);_0x39a2cf[_0x1180('0x4b')]=_['intersection'](_0x39a2cf[_0x1180('0x48')],_0x39a2cf['query']);_0x23462b['attributes']=_[_0x1180('0x4c')](_0x39a2cf['model'],qs[_0x1180('0x4e')](_0xe70cbd['query'][_0x1180('0x4e')]));_0x23462b[_0x1180('0x4d')]=_0x23462b[_0x1180('0x4d')][_0x1180('0x4f')]?_0x23462b[_0x1180('0x4d')]:_0x39a2cf['model'];if(!_0xe70cbd[_0x1180('0x49')]['hasOwnProperty'](_0x1180('0x51'))){_0x23462b[_0x1180('0x52')]=qs[_0x1180('0x52')](_0xe70cbd[_0x1180('0x49')][_0x1180('0x52')]);_0x23462b[_0x1180('0x31')]=qs[_0x1180('0x31')](_0xe70cbd[_0x1180('0x49')]['offset']);}_0x23462b[_0x1180('0x53')]=qs[_0x1180('0x54')](_0xe70cbd[_0x1180('0x49')]['sort']);_0x23462b[_0x1180('0x57')]=qs[_0x1180('0x4b')](_[_0x1180('0x55')](_0xe70cbd['query'],_0x39a2cf['filters']));_0x23462b[_0x1180('0x57')][_0x1180('0x6c')]=_0x2cbbb7['id'];if(_0xe70cbd[_0x1180('0x49')][_0x1180('0x56')]){_0x23462b[_0x1180('0x57')]=_[_0x1180('0x58')](_0x23462b[_0x1180('0x57')],{'$or':_[_0x1180('0x44')](_0x23462b[_0x1180('0x4d')],function(_0x42f42c){var _0x2dbb5c={};_0x2dbb5c[_0x42f42c]={'$like':'%'+_0xe70cbd[_0x1180('0x49')][_0x1180('0x56')]+'%'};return _0x2dbb5c;})});}_0x23462b=_['merge']({},_0x23462b,_0xe70cbd[_0x1180('0x5a')]);return db[_0x1180('0x6f')][_0x1180('0x33')]({'where':_0x23462b['where']})[_0x1180('0x24')](function(_0x312c3f){_0x9a43c7[_0x1180('0x33')]=_0x312c3f;if(_0xe70cbd['query']['includeAll']){_0x23462b[_0x1180('0x61')]=[{'all':!![]}];}return db['Disposition'][_0x1180('0x5c')](_0x23462b);})['then'](function(_0x201dbb){_0x9a43c7['rows']=_0x201dbb;return _0x9a43c7;});}})['then'](respondWithFilteredResult(_0x3544a8,_0x23462b))['catch'](handleError(_0x3544a8,null));};exports[_0x1180('0x70')]=function(_0x5cc431,_0x36715a,_0x41e522){return db['OpenchannelAccount'][_0x1180('0x62')]({'where':{'id':_0x5cc431[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x36715a,null))[_0x1180('0x24')](function(_0x3a3a0f){if(_0x3a3a0f){return _0x3a3a0f[_0x1180('0x70')](_0x5cc431[_0x1180('0x49')][_0x1180('0x71')]);}})[_0x1180('0x24')](respondWithStatusCode(_0x36715a,null))[_0x1180('0x2e')](handleError(_0x36715a,null));};exports[_0x1180('0x72')]=function(_0x5d8a88,_0x39d47e,_0x1aad25){if(_0x5d8a88[_0x1180('0x64')]['id']){delete _0x5d8a88['body']['id'];}return db[_0x1180('0x45')][_0x1180('0x62')]({'where':{'id':_0x5d8a88['params']['id']}})['then'](handleEntityNotFound(_0x39d47e,null))[_0x1180('0x24')](function(_0x1fdf71){if(_0x1fdf71){_0x5d8a88[_0x1180('0x64')][_0x1180('0x6c')]=_0x1fdf71['id'];return db['CannedAnswer']['create'](_0x5d8a88[_0x1180('0x64')]);}})['then'](respondWithResult(_0x39d47e,null))[_0x1180('0x2e')](handleError(_0x39d47e,null));};exports[_0x1180('0x73')]=function(_0x2123fb,_0x529273,_0xea3620){var _0x41eaa6={'raw':![],'where':{}};var _0x1c3e56={};var _0x5317c0={'count':0x0,'rows':[]};return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0x2123fb[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x529273,null))[_0x1180('0x24')](function(_0x135667){if(_0x135667){_0x1c3e56[_0x1180('0x48')]=_[_0x1180('0x4a')](db['CannedAnswer']['rawAttributes']);_0x1c3e56[_0x1180('0x49')]=_['keys'](_0x2123fb[_0x1180('0x49')]);_0x1c3e56[_0x1180('0x4b')]=_[_0x1180('0x4c')](_0x1c3e56['model'],_0x1c3e56['query']);_0x41eaa6[_0x1180('0x4d')]=_[_0x1180('0x4c')](_0x1c3e56['model'],qs['fields'](_0x2123fb[_0x1180('0x49')][_0x1180('0x4e')]));_0x41eaa6[_0x1180('0x4d')]=_0x41eaa6[_0x1180('0x4d')]['length']?_0x41eaa6['attributes']:_0x1c3e56[_0x1180('0x48')];if(!_0x2123fb['query'][_0x1180('0x50')]('nolimit')){_0x41eaa6[_0x1180('0x52')]=qs['limit'](_0x2123fb['query'][_0x1180('0x52')]);_0x41eaa6[_0x1180('0x31')]=qs[_0x1180('0x31')](_0x2123fb[_0x1180('0x49')][_0x1180('0x31')]);}_0x41eaa6[_0x1180('0x53')]=qs['sort'](_0x2123fb['query'][_0x1180('0x54')]);_0x41eaa6['where']=qs['filters'](_['pick'](_0x2123fb[_0x1180('0x49')],_0x1c3e56[_0x1180('0x4b')]));_0x41eaa6[_0x1180('0x57')]['OpenchannelAccountId']=_0x135667['id'];if(_0x2123fb['query'][_0x1180('0x56')]){_0x41eaa6[_0x1180('0x57')]=_[_0x1180('0x58')](_0x41eaa6[_0x1180('0x57')],{'$or':_[_0x1180('0x44')](_0x41eaa6[_0x1180('0x4d')],function(_0x42880d){var _0x18831f={};_0x18831f[_0x42880d]={'$like':'%'+_0x2123fb[_0x1180('0x49')][_0x1180('0x56')]+'%'};return _0x18831f;})});}_0x41eaa6=_[_0x1180('0x58')]({},_0x41eaa6,_0x2123fb[_0x1180('0x5a')]);return db[_0x1180('0x74')]['count']({'where':_0x41eaa6[_0x1180('0x57')]})[_0x1180('0x24')](function(_0x2e9d4d){_0x5317c0[_0x1180('0x33')]=_0x2e9d4d;if(_0x2123fb[_0x1180('0x49')][_0x1180('0x5b')]){_0x41eaa6[_0x1180('0x61')]=[{'all':!![]}];}return db[_0x1180('0x74')][_0x1180('0x5c')](_0x41eaa6);})[_0x1180('0x24')](function(_0x298e1b){_0x5317c0[_0x1180('0x5d')]=_0x298e1b;return _0x5317c0;});}})[_0x1180('0x24')](respondWithFilteredResult(_0x529273,_0x41eaa6))['catch'](handleError(_0x529273,null));};exports[_0x1180('0x75')]=function(_0x44b7f6,_0x129e95,_0x40e199){return db[_0x1180('0x45')][_0x1180('0x62')]({'where':{'id':_0x44b7f6[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x129e95,null))[_0x1180('0x24')](function(_0xcab93a){if(_0xcab93a){return _0xcab93a[_0x1180('0x75')](_0x44b7f6[_0x1180('0x49')][_0x1180('0x71')]);}})['then'](respondWithStatusCode(_0x129e95,null))[_0x1180('0x2e')](handleError(_0x129e95,null));};exports['notify']=function(_0x197812,_0x4613c9,_0x52bde5){var _0x643ebe={'body':_0x197812[_0x1180('0x64')],'channel':_0x1180('0x76')};var _0x10a93a=[];var _0x5d4f81=[];var _0x169b96={};var _0x4418c8=![];return db['CmContact'][_0x1180('0x6a')]()[_0x1180('0x24')](function(_0x56c9a2){if(!_0x56c9a2){throw new db[(_0x1180('0x77'))][(_0x1180('0x78'))]('no\x20available\x20attributes');}_0x10a93a=_[_0x1180('0x79')](_[_0x1180('0x4a')](_0x56c9a2),[_0x1180('0x7a'),_0x1180('0x7b')]);_0x5d4f81=_[_0x1180('0x79')](_[_0x1180('0x4a')](_0x56c9a2),[_0x1180('0x7a'),_0x1180('0x7b'),_0x1180('0x7c'),'ListId']);if(_0x197812[_0x1180('0x64')]['id']){delete _0x197812['body']['id'];}if(_[_0x1180('0x7d')](_0x197812[_0x1180('0x64')][_0x1180('0x7e')])){throw new db[(_0x1180('0x77'))][(_0x1180('0x78'))]('from\x20is\x20mandatory');}if(_[_0x1180('0x7d')](_0x197812[_0x1180('0x64')][_0x1180('0x64')])||_0x197812[_0x1180('0x64')][_0x1180('0x64')]===''){throw new db[(_0x1180('0x77'))][(_0x1180('0x78'))](_0x1180('0x7f'));}if(_[_0x1180('0x7d')](_0x197812[_0x1180('0x64')]['mapKey'])){throw new db[(_0x1180('0x77'))][(_0x1180('0x78'))](_0x1180('0x80')+_0x5d4f81);}if(!_[_0x1180('0x81')](_0x5d4f81,_0x197812[_0x1180('0x64')][_0x1180('0x82')])){throw new db[(_0x1180('0x77'))]['ValidationError'](_0x1180('0x83')+_0x5d4f81);}_0x169b96[_0x197812[_0x1180('0x64')][_0x1180('0x82')]]=_0x197812[_0x1180('0x64')][_0x1180('0x7e')];})[_0x1180('0x24')](function(){return db[_0x1180('0x45')][_0x1180('0x62')]({'where':{'id':_0x197812[_0x1180('0x5f')]['id']},'include':[{'model':db[_0x1180('0x84')],'as':'List','include':[{'model':db[_0x1180('0x85')],'as':_0x1180('0x86'),'where':_0x169b96,'limit':0x1,'order':[[_0x1180('0x7b'),_0x1180('0x87')]]}]},{'model':db[_0x1180('0x88')],'as':'Applications'}]});})[_0x1180('0x24')](handleEntityNotFound(_0x4613c9,null))['then'](function(_0xca57a7){if(_0xca57a7&&_0xca57a7[_0x1180('0x89')]){_0x643ebe[_0x1180('0x8a')]=_0xca57a7;_0x643ebe[_0x1180('0x8b')]=_0xca57a7['Applications'];_0x643ebe['list']=_0xca57a7[_0x1180('0x89')];_0x643ebe[_0x1180('0x8b')]=_[_0x1180('0x8c')](_0x643ebe[_0x1180('0x8b')],[_0x1180('0x8d')],[_0x1180('0x8e')]);if(_0x643ebe['account']['Applications']){delete _0x643ebe[_0x1180('0x8a')][_0x1180('0x8f')];}if(_0x643ebe[_0x1180('0x8a')]['List']&&_0x643ebe[_0x1180('0x8a')][_0x1180('0x89')][_0x1180('0x86')][_0x1180('0x4f')]){return _0x643ebe[_0x1180('0x8a')]['List']['Contacts'][0x0];}var _0x3cdb1a=_[_0x1180('0x1b')](_0x197812[_0x1180('0x64')],{'firstName':_0x197812[_0x1180('0x64')][_0x1180('0x7e')],'ListId':_0xca57a7[_0x1180('0x90')]});_0x3cdb1a[_0x197812[_0x1180('0x64')][_0x1180('0x82')]]=_0x197812[_0x1180('0x64')][_0x1180('0x7e')];return db['CmContact']['create'](_0x3cdb1a,{'fields':_0x10a93a,'raw':!![]});}})[_0x1180('0x24')](handleEntityNotFound(_0x4613c9,null))[_0x1180('0x24')](function(_0xdd020d){_0x643ebe[_0x1180('0x91')]=_0xdd020d;if(_0xdd020d){var _0x529b31={'ContactId':_0xdd020d['id'],'OpenchannelAccountId':_0x197812[_0x1180('0x5f')]['id'],'from':(_0xdd020d['firstName']||'')+'\x20'+(_0xdd020d[_0x1180('0x92')]||'')};var _0x447d86={'OpenchannelAccountId':_0x197812[_0x1180('0x5f')]['id'],'closed':![]};if(_0x197812[_0x1180('0x64')]['threadId']){_0x447d86['threadId']=_0x197812['body'][_0x1180('0x93')];return db[_0x1180('0x94')][_0x1180('0x62')]({'where':_0x447d86})[_0x1180('0x24')](function(_0x101bc6){if(_0x101bc6){return[_0x101bc6,![]];}_0x529b31['threadId']=_0x197812['body'][_0x1180('0x93')];_0x529b31[_0x1180('0x95')]=_0x197812[_0x1180('0x64')][_0x1180('0x95')];return db['OpenchannelInteraction'][_0x1180('0x63')](_0x529b31)[_0x1180('0x24')](function(_0x30258b){return[_0x30258b,!![]];});});}else{_0x447d86[_0x1180('0x93')]=null;}_0x447d86['ContactId']=_0xdd020d['id'];return db[_0x1180('0x94')]['find']({'where':_0x447d86})['then'](function(_0x3caa20){if(_0x3caa20){return[_0x3caa20,![]];}return db[_0x1180('0x94')][_0x1180('0x63')](_0x529b31)[_0x1180('0x24')](function(_0x3d18d4){return[_0x3d18d4,!![]];});});}})[_0x1180('0x96')](function(_0xc7581a,_0x4ecf5b){if(_0xc7581a){_0x4418c8=_0x4ecf5b;if(!_0x4ecf5b){var _0x382ff7={'from':(_0x643ebe[_0x1180('0x91')][_0x1180('0x97')]||'')+'\x20'+(_0x643ebe[_0x1180('0x91')][_0x1180('0x92')]||'')};if(_0x197812[_0x1180('0x64')][_0x1180('0x93')]&&_0x197812[_0x1180('0x64')]['messageId']&&_0x197812['body'][_0x1180('0x93')]!=_0x197812[_0x1180('0x64')][_0x1180('0x98')]){_0x382ff7[_0x1180('0x93')]=_0x197812[_0x1180('0x64')]['messageId'];}return _0xc7581a[_0x1180('0x39')](_0x382ff7);}else{return _0xc7581a;}}})[_0x1180('0x24')](function(_0x2ce442){_0x643ebe[_0x1180('0x99')]=_0x2ce442[_0x1180('0x3b')]({'plain':!![]});_0x643ebe[_0x1180('0x99')][_0x1180('0x9a')]=_0x4418c8;if(_0x643ebe['interaction']['created']){if(_0x643ebe['account'][_0x1180('0x9b')]){_0x643ebe[_0x1180('0x8b')][_0x1180('0x9c')]({'id':0x0,'priority':_0x643ebe[_0x1180('0x8b')]['length']+0x1,'app':_0x1180('0x9d'),'appdata':_0x1180('0x9e'),'interval':_0x1180('0x9f')});}}return db['OpenchannelMessage'][_0x1180('0x63')]({'body':_0x197812['body'][_0x1180('0x64')],'OpenchannelAccountId':_0x197812[_0x1180('0x5f')]['id'],'OpenchannelInteractionId':_0x2ce442['id'],'direction':'in','ContactId':_0x643ebe[_0x1180('0x91')]['id'],'AttachmentId':_0x197812[_0x1180('0x64')][_0x1180('0xa0')]});})[_0x1180('0x24')](function(_0x514dfa){_0x643ebe['message']=_0x514dfa;if(_0x643ebe[_0x1180('0x99')][_0x1180('0xa1')]){return db[_0x1180('0xa2')][_0x1180('0x62')]({'attributes':['id',_0x1180('0x3f')],'where':{'id':_0x643ebe[_0x1180('0x99')]['UserId']}})['then'](function(_0x353125){if(_0x353125){_0x643ebe[_0x1180('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1180('0xa3'),'appdata':_0x353125[_0x1180('0x3f')]+','+(_0x643ebe[_0x1180('0x8a')][_0x1180('0xa4')]||0xa),'interval':_0x1180('0x9f')});_0x643ebe['forcedOwnership']=![];}return respondWithRpcPromise(_0x1180('0xa5'),_0x1180('0xa6'),_0x643ebe);});}return respondWithRpcPromise(_0x1180('0xa5'),'startRouting',_0x643ebe);})[_0x1180('0x24')](function(_0x5b4e1c){respondWithRpcPromise(_0x1180('0xa7'),_0x1180('0xa7'),{'event':'notify','message':_0x5b4e1c},client9002);return _0x5b4e1c;})['then'](respondWithResult(_0x4613c9,null))['catch'](handleError(_0x4613c9,null));};exports[_0x1180('0xa8')]=function(_0x478d44,_0x33346b){var _0x4ffb1e=_0x478d44[_0x1180('0x5f')]['id'];var _0x9861=_0x478d44[_0x1180('0x64')];var _0x31bdd8=0xc8;var _0x4eabc2=null;return db[_0x1180('0xa9')][_0x1180('0xaa')]({'isolationLevel':db[_0x1180('0xa9')]['Transaction']['ISOLATION_LEVELS'][_0x1180('0xab')]},function(_0x1fe7a0){return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0x4ffb1e},'transaction':_0x1fe7a0})['then'](function(_0x133402){if(_0x133402){return db[_0x1180('0x88')][_0x1180('0x3a')]({'where':{'OpenchannelAccountId':_0x4ffb1e},'transaction':_0x1fe7a0})[_0x1180('0x24')](function(){var _0x38c273=_[_0x1180('0x44')](_0x9861,function(_0x3a3e40){_0x3a3e40['OpenchannelAccountId']=_0x4ffb1e;return _0x3a3e40;});return db['OpenchannelApplication'][_0x1180('0xac')](_0x38c273,{'transaction':_0x1fe7a0});});}else{_0x31bdd8=0x194;_0x4eabc2=[];}});})[_0x1180('0x24')](function(){if(_0x31bdd8!==0x194){return db['OpenchannelApplication'][_0x1180('0xad')]({'where':{'OpenchannelAccountId':_0x4ffb1e},'order':'priority'})['then'](function(_0x2ed9f6){_0x4eabc2=_0x2ed9f6;});}})[_0x1180('0x2e')](function(_0x789147){_0x31bdd8=0x1f4;logger['error'](_0x789147[_0x1180('0x3e')]);if(_0x789147[_0x1180('0x3f')]){delete _0x789147[_0x1180('0x3f')];}_0x4eabc2=_0x789147;})[_0x1180('0xae')](function(){if(_0x4eabc2===null){_0x33346b[_0x1180('0x2f')](_0x31bdd8);}else{if(_0x31bdd8===0x1f4){_0x33346b[_0x1180('0x30')](_0x31bdd8)[_0x1180('0x40')](_0x4eabc2);}else{_0x33346b[_0x1180('0x30')](_0x31bdd8)[_0x1180('0x36')](_0x4eabc2);}}});};exports[_0x1180('0xaf')]=function(_0x1be9cb,_0x37c116,_0x29b956){var _0x602969={};var _0x359a61={};var _0x1055a2;var _0x478387;return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0x1be9cb[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x37c116,null))['then'](function(_0x42a2e7){if(_0x42a2e7){_0x1055a2=_0x42a2e7;_0x359a61[_0x1180('0x48')]=_['keys'](db[_0x1180('0x88')][_0x1180('0x60')]);_0x359a61[_0x1180('0x49')]=_[_0x1180('0x4a')](_0x1be9cb['query']);_0x359a61[_0x1180('0x4b')]=_[_0x1180('0x4c')](_0x359a61[_0x1180('0x48')],_0x359a61['query']);_0x602969[_0x1180('0x4d')]=_['intersection'](_0x359a61[_0x1180('0x48')],qs['fields'](_0x1be9cb[_0x1180('0x49')][_0x1180('0x4e')]));_0x602969[_0x1180('0x4d')]=_0x602969[_0x1180('0x4d')][_0x1180('0x4f')]?_0x602969[_0x1180('0x4d')]:_0x359a61[_0x1180('0x48')];_0x602969[_0x1180('0x53')]=qs[_0x1180('0x54')](_0x1be9cb[_0x1180('0x49')][_0x1180('0x54')]);_0x602969[_0x1180('0x57')]=qs[_0x1180('0x4b')](_['pick'](_0x1be9cb[_0x1180('0x49')],_0x359a61[_0x1180('0x4b')]));if(_0x1be9cb['query'][_0x1180('0x56')]){_0x602969[_0x1180('0x57')]=_[_0x1180('0x58')](_0x602969[_0x1180('0x57')],{'$or':_[_0x1180('0x44')](_0x602969[_0x1180('0x4d')],function(_0x37b39f){var _0x583015={};_0x583015[_0x37b39f]={'$like':'%'+_0x1be9cb['query']['filter']+'%'};return _0x583015;})});}_0x602969=_[_0x1180('0x58')]({},_0x602969,_0x1be9cb[_0x1180('0x5a')]);return _0x1055a2[_0x1180('0xaf')](_0x602969);}})[_0x1180('0x24')](function(_0x71bb2c){if(_0x71bb2c){_0x478387=_0x71bb2c[_0x1180('0x4f')];if(!_0x1be9cb['query'][_0x1180('0x50')](_0x1180('0x51'))){_0x602969['limit']=qs[_0x1180('0x52')](_0x1be9cb[_0x1180('0x49')][_0x1180('0x52')]);_0x602969[_0x1180('0x31')]=qs[_0x1180('0x31')](_0x1be9cb['query'][_0x1180('0x31')]);}return _0x1055a2[_0x1180('0xaf')](_0x602969);}})[_0x1180('0x24')](function(_0x55c62c){if(_0x55c62c){return _0x55c62c?{'count':_0x478387,'rows':_0x55c62c}:null;}})['then'](respondWithResult(_0x37c116,null))['catch'](handleError(_0x37c116,null));};exports[_0x1180('0xb0')]=function(_0x5f2e66,_0x55940d,_0x5e4452){var _0x1aed7f={'raw':![],'where':{}};var _0x16b26b={};var _0x3ef022={'count':0x0,'rows':[]};return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0x5f2e66[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x55940d,null))['then'](function(_0x13561a){if(_0x13561a){_0x16b26b[_0x1180('0x48')]=_[_0x1180('0x4a')](db['OpenchannelInteraction']['rawAttributes']);_0x16b26b['query']=_[_0x1180('0x4a')](_0x5f2e66[_0x1180('0x49')]);_0x16b26b[_0x1180('0x4b')]=_[_0x1180('0x4c')](_0x16b26b['model'],_0x16b26b['query']);_0x1aed7f[_0x1180('0x4d')]=_[_0x1180('0x4c')](_0x16b26b['model'],qs['fields'](_0x5f2e66['query']['fields']));_0x1aed7f['attributes']=_0x1aed7f[_0x1180('0x4d')][_0x1180('0x4f')]?_0x1aed7f[_0x1180('0x4d')]:_0x16b26b[_0x1180('0x48')];if(!_0x5f2e66['query'][_0x1180('0x50')](_0x1180('0x51'))){_0x1aed7f[_0x1180('0x52')]=qs['limit'](_0x5f2e66[_0x1180('0x49')][_0x1180('0x52')]);_0x1aed7f[_0x1180('0x31')]=qs[_0x1180('0x31')](_0x5f2e66['query'][_0x1180('0x31')]);}_0x1aed7f['order']=qs[_0x1180('0x54')](_0x5f2e66[_0x1180('0x49')]['sort']);_0x1aed7f[_0x1180('0x57')]=qs[_0x1180('0x4b')](_[_0x1180('0x55')](_0x5f2e66[_0x1180('0x49')],_0x16b26b[_0x1180('0x4b')]));_0x1aed7f[_0x1180('0x57')]['OpenchannelAccountId']=_0x13561a['id'];if(_0x5f2e66[_0x1180('0x49')][_0x1180('0x56')]){_0x1aed7f[_0x1180('0x57')]=_[_0x1180('0x58')](_0x1aed7f[_0x1180('0x57')],{'$or':_[_0x1180('0x44')](_0x1aed7f[_0x1180('0x4d')],function(_0x372c83){var _0xe94a1b={};_0xe94a1b[_0x372c83]={'$like':'%'+_0x5f2e66[_0x1180('0x49')][_0x1180('0x56')]+'%'};return _0xe94a1b;})});}_0x1aed7f=_[_0x1180('0x58')]({},_0x1aed7f,_0x5f2e66[_0x1180('0x5a')]);return db['OpenchannelInteraction'][_0x1180('0x33')]({'where':_0x1aed7f['where']})[_0x1180('0x24')](function(_0x1ed35a){_0x3ef022[_0x1180('0x33')]=_0x1ed35a;if(_0x5f2e66[_0x1180('0x49')][_0x1180('0x5b')]){_0x1aed7f['include']=[{'model':db[_0x1180('0x85')],'as':_0x1180('0xb1'),'required':![]},{'model':db[_0x1180('0xa2')],'as':_0x1180('0xb2'),'attributes':[_0x1180('0x3f'),_0x1180('0xb3'),_0x1180('0xb4')],'required':![]},{'model':db['Tag'],'as':_0x1180('0xb5'),'attributes':['id',_0x1180('0x3f'),_0x1180('0xb6')],'where':_0x5f2e66[_0x1180('0x49')][_0x1180('0xb7')]?{'id':_0x5f2e66[_0x1180('0x49')][_0x1180('0xb7')]}:undefined,'required':_0x5f2e66[_0x1180('0x49')][_0x1180('0xb7')]?!![]:![]}];}return db[_0x1180('0x94')][_0x1180('0x5c')](_0x1aed7f);})[_0x1180('0x24')](function(_0x29b25a){_0x3ef022[_0x1180('0x5d')]=_0x29b25a;return _0x3ef022;});}})[_0x1180('0x24')](respondWithFilteredResult(_0x55940d,_0x1aed7f))[_0x1180('0x2e')](handleError(_0x55940d,null));};exports[_0x1180('0xb8')]=function(_0x500537,_0x1ef91b,_0x536ae9){return db[_0x1180('0x45')][_0x1180('0x62')]({'where':{'id':_0x500537[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x1ef91b,null))['then'](function(_0x49c6f8){if(_0x49c6f8){return _0x49c6f8[_0x1180('0xb8')](_0x500537[_0x1180('0x64')]['ids'],_[_0x1180('0xb9')](_0x500537[_0x1180('0x64')],['ids','id'])||{})[_0x1180('0x96')](function(_0x77a843){for(var _0x83dd04=0x0;_0x83dd04<_0x500537[_0x1180('0x64')][_0x1180('0x71')][_0x1180('0x4f')];_0x83dd04+=0x1){socket[_0x1180('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0x500537[_0x1180('0x64')][_0x1180('0x71')][_0x83dd04]),'OpenchannelAccountId':Number(_0x500537['params']['id'])});}return _0x77a843;});}})['then'](respondWithResult(_0x1ef91b,null))[_0x1180('0x2e')](handleError(_0x1ef91b,null));};exports[_0x1180('0xbb')]=function(_0xa064b9,_0x57cdc2,_0x4315cd){return db[_0x1180('0x45')]['find']({'where':{'id':_0xa064b9[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x57cdc2,null))[_0x1180('0x24')](function(_0x107b16){if(_0x107b16){return _0x107b16[_0x1180('0xbb')](_0xa064b9[_0x1180('0x49')][_0x1180('0x71')])[_0x1180('0x24')](function(){if(_[_0x1180('0xbc')](_0xa064b9[_0x1180('0x49')][_0x1180('0x71')])){for(var _0x37fada=0x0;_0x37fada<_0xa064b9[_0x1180('0x49')][_0x1180('0x71')][_0x1180('0x4f')];_0x37fada+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xa064b9[_0x1180('0x49')][_0x1180('0x71')][_0x37fada]),'OpenchannelAccountId':Number(_0xa064b9[_0x1180('0x5f')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0xa064b9[_0x1180('0x49')][_0x1180('0x71')]),'OpenchannelAccountId':Number(_0xa064b9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x57cdc2,null))[_0x1180('0x2e')](handleError(_0x57cdc2,null));};exports['getAgents']=function(_0x41b4b2,_0xee1d86,_0x24027d){var _0x3d2247={};var _0x460cee={};var _0xf9cb6c;var _0x22b96c;return db[_0x1180('0x45')]['findOne']({'where':{'id':_0x41b4b2[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0xee1d86,null))[_0x1180('0x24')](function(_0x267466){if(_0x267466){_0xf9cb6c=_0x267466;_0x460cee[_0x1180('0x48')]=_[_0x1180('0x4a')](db[_0x1180('0xa2')]['rawAttributes']);_0x460cee[_0x1180('0x49')]=_[_0x1180('0x4a')](_0x41b4b2[_0x1180('0x49')]);_0x460cee[_0x1180('0x4b')]=_['intersection'](_0x460cee['model'],_0x460cee[_0x1180('0x49')]);_0x3d2247[_0x1180('0x4d')]=_[_0x1180('0x4c')](_0x460cee[_0x1180('0x48')],qs[_0x1180('0x4e')](_0x41b4b2[_0x1180('0x49')][_0x1180('0x4e')]));_0x3d2247['attributes']=_0x3d2247[_0x1180('0x4d')][_0x1180('0x4f')]?_0x3d2247['attributes']:_0x460cee[_0x1180('0x48')];_0x3d2247[_0x1180('0x53')]=qs[_0x1180('0x54')](_0x41b4b2[_0x1180('0x49')][_0x1180('0x54')]);_0x3d2247[_0x1180('0x57')]=qs[_0x1180('0x4b')](_['pick'](_0x41b4b2[_0x1180('0x49')],_0x460cee['filters']));if(_0x41b4b2['query'][_0x1180('0x56')]){_0x3d2247[_0x1180('0x57')]=_[_0x1180('0x58')](_0x3d2247[_0x1180('0x57')],{'$or':_[_0x1180('0x44')](_0x3d2247[_0x1180('0x4d')],function(_0x59c9e0){var _0x4dcb5d={};_0x4dcb5d[_0x59c9e0]={'$like':'%'+_0x41b4b2[_0x1180('0x49')][_0x1180('0x56')]+'%'};return _0x4dcb5d;})});}_0x3d2247=_[_0x1180('0x58')]({},_0x3d2247,_0x41b4b2[_0x1180('0x5a')]);return _0xf9cb6c[_0x1180('0xbd')](_0x3d2247);}})[_0x1180('0x24')](function(_0x53cb57){if(_0x53cb57){_0x22b96c=_0x53cb57[_0x1180('0x4f')];if(!_0x41b4b2[_0x1180('0x49')]['hasOwnProperty'](_0x1180('0x51'))){_0x3d2247[_0x1180('0x52')]=qs['limit'](_0x41b4b2['query'][_0x1180('0x52')]);_0x3d2247[_0x1180('0x31')]=qs[_0x1180('0x31')](_0x41b4b2[_0x1180('0x49')][_0x1180('0x31')]);}return _0xf9cb6c['getAgents'](_0x3d2247);}})[_0x1180('0x24')](function(_0x30f83a){if(_0x30f83a){return _0x30f83a?{'count':_0x22b96c,'rows':_0x30f83a}:null;}})[_0x1180('0x24')](respondWithResult(_0xee1d86,null))[_0x1180('0x2e')](handleError(_0xee1d86,null));};exports['send']=function(_0x4c9a52,_0x4b213a,_0x3b3300){var _0x143878,_0x4e205b,_0x21bfef;if(_['isNil'](_0x4c9a52[_0x1180('0x64')][_0x1180('0x64')])||_0x4c9a52[_0x1180('0x64')][_0x1180('0x64')]===''){throw new db['Sequelize'][(_0x1180('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4c9a52[_0x1180('0x64')]['to'])){}_0x143878=_0x4c9a52['body']['to'];return db[_0x1180('0x45')][_0x1180('0x6e')]({'where':{'id':_0x4c9a52[_0x1180('0x5f')]['id']}})[_0x1180('0x24')](handleEntityNotFound(_0x4b213a,null))[_0x1180('0x24')](function(_0x4e1948){if(_0x4e1948){return db['OpenchannelAccount'][_0x1180('0x62')]({'where':{'id':_0x4e1948['id']},'include':[{'model':db[_0x1180('0x84')],'as':_0x1180('0x89'),'include':[{'model':db['CmContact'],'as':_0x1180('0x86'),'where':{[_0x4e1948['mapKey']]:_0x143878},'limit':0x1,'order':[['updatedAt',_0x1180('0x87')]]}]}]})['then'](handleEntityNotFound(_0x4b213a,null))[_0x1180('0x24')](function(_0x2f4588){if(_0x2f4588&&_0x2f4588[_0x1180('0x89')]){_0x4e205b=_0x2f4588[_0x1180('0x3b')]({'plain':!![]});if(_0x4e205b['List']&&_0x4e205b[_0x1180('0x89')][_0x1180('0x86')][_0x1180('0x4f')]){return _0x4e205b[_0x1180('0x89')][_0x1180('0x86')][0x0];}return db[_0x1180('0x85')][_0x1180('0x63')](_[_0x1180('0x1b')](_0x4c9a52['body'],{'firstName':_0x143878,[_0x2f4588[_0x1180('0x82')]]:_0x143878,'phone':_0x143878,'ListId':_0x4e205b[_0x1180('0x90')]}));}})[_0x1180('0x24')](handleEntityNotFound(_0x4b213a,null))[_0x1180('0x24')](function(_0x122b23){if(_0x122b23){_0x21bfef=_0x122b23;return db[_0x1180('0x94')][_0x1180('0x62')]({'where':{'ContactId':_0x21bfef['id'],'closed':![],'OpenchannelAccountId':_0x4e205b['id']}})[_0x1180('0x24')](function(_0x2031e9){if(_0x2031e9){return[_0x2031e9,![]];}return db[_0x1180('0x94')][_0x1180('0x63')]({'UserId':_0x4c9a52[_0x1180('0x65')]['id'],'ContactId':_0x21bfef['id'],'OpenchannelAccountId':_0x4e205b['id'],'lastMsgDirection':'out','firstMsgDirection':_0x1180('0xbe'),'Messages':[_[_0x1180('0x58')](_0x4c9a52[_0x1180('0x64')],{'read':![],'body':_0x4c9a52['body'][_0x1180('0x64')],'OpenchannelAccountId':_0x4e205b['id'],'UserId':_0x4c9a52[_0x1180('0x65')]['id'],'ContactId':_0x21bfef['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x1180('0xbf')}]})[_0x1180('0x24')](function(_0x2711f4){return[_0x2711f4,!![]];});});}})[_0x1180('0x96')](function(_0x1871be,_0xebfdbd){if(_0xebfdbd){return _0x1871be;}return db[_0x1180('0xc0')]['create'](_[_0x1180('0x58')](_0x4c9a52[_0x1180('0x64')],{'read':![],'body':_0x4c9a52['body']['body'],'OpenchannelAccountId':_0x4e205b['id'],'OpenchannelInteractionId':_0x1871be['id'],'UserId':_0x4c9a52[_0x1180('0x65')]['id'],'ContactId':_0x21bfef['id']}))['then'](function(_0x53beba){_0x1871be[_0x1180('0xc1')][_0x1180('0xbf')]=[];_0x1871be[_0x1180('0xc1')][_0x1180('0xbf')][_0x1180('0x9c')](_0x53beba[_0x1180('0xc1')]);return _0x1871be;});});}})[_0x1180('0x24')](respondWithResult(_0x4b213a,null))[_0x1180('0x2e')](handleError(_0x4b213a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4c6de54..f8a9474 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x2493e6,_0x34a638){var _0x574d85=function(_0x32a625){while(--_0x32a625){_0x2493e6['push'](_0x2493e6['shift']());}};_0x574d85(++_0x34a638);}(_0xe706,0xa3));var _0x6e70=function(_0x4cad64,_0x13a1d1){_0x4cad64=_0x4cad64-0x0;var _0x1ebb2d=_0xe706[_0x4cad64];return _0x1ebb2d;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4b3413,_0x58c416){var _0x3b01ba=function(_0xb25f43){while(--_0xb25f43){_0x4b3413['push'](_0x4b3413['shift']());}};_0x3b01ba(++_0x58c416);}(_0x9bde,0xe1));var _0xe9bd=function(_0x263f60,_0x45dfc9){_0x263f60=_0x263f60-0x0;var _0x31651a=_0x9bde[_0x263f60];return _0x31651a;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('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 8df9fe6..2ebf2a5 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(_0x43ee6a,_0x12594a){var _0x568c40=function(_0x261e13){while(--_0x261e13){_0x43ee6a['push'](_0x43ee6a['shift']());}};_0x568c40(++_0x12594a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x4c109b,_0x28d2d2){var _0x201d9=function(_0x33097e){while(--_0x33097e){_0x4c109b['push'](_0x4c109b['shift']());}};_0x201d9(++_0x28d2d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 2acd5d3..caa72fa 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 _0x7794=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','http','redis'];(function(_0x413d19,_0x1dd61e){var _0x4f3548=function(_0x296ee8){while(--_0x296ee8){_0x413d19['push'](_0x413d19['shift']());}};_0x4f3548(++_0x1dd61e);}(_0x7794,0x7b));var _0x4779=function(_0x2b02bd,_0x52d304){_0x2b02bd=_0x2b02bd-0x0;var _0x3208b3=_0x7794[_0x2b02bd];return _0x3208b3;};'use strict';var _=require('lodash');var util=require(_0x4779('0x0'));var moment=require(_0x4779('0x1'));var BPromise=require(_0x4779('0x2'));var rs=require(_0x4779('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4779('0x4'))['db'];var utils=require(_0x4779('0x5'));var logger=require('../../config/logger')(_0x4779('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4779('0x7')]({'port':0x232a});config[_0x4779('0x8')]=_['defaults'](config[_0x4779('0x8')],{'host':_0x4779('0x9'),'port':0x18eb});var socket=require(_0x4779('0xa'))(new Redis(config[_0x4779('0x8')]));require(_0x4779('0xb'))[_0x4779('0xc')](socket);function respondWithRpcPromise(_0x42e4c0,_0x5e4992,_0x42883e){return new BPromise(function(_0x33ebc7,_0x3a5f2d){return client[_0x4779('0xd')](_0x42e4c0,_0x42883e)[_0x4779('0xe')](function(_0x106081){logger[_0x4779('0xf')](_0x4779('0x10'),_0x5e4992,_0x4779('0x11'));logger[_0x4779('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e4992,'request\x20sent',JSON['stringify'](_0x106081));if(_0x106081[_0x4779('0x13')]){if(_0x106081[_0x4779('0x13')][_0x4779('0x14')]===0x1f4){logger[_0x4779('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4992,_0x106081[_0x4779('0x13')][_0x4779('0x15')]);return _0x3a5f2d(_0x106081['error']['message']);}logger[_0x4779('0x13')](_0x4779('0x10'),_0x5e4992,_0x106081[_0x4779('0x13')][_0x4779('0x15')]);return _0x33ebc7(_0x106081['error']['message']);}else{logger[_0x4779('0xf')](_0x4779('0x10'),_0x5e4992,_0x4779('0x11'));_0x33ebc7(_0x106081['result'][_0x4779('0x15')]);}})['catch'](function(_0x2b40f9){logger[_0x4779('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e4992,_0x2b40f9);_0x3a5f2d(_0x2b40f9);});});} \ No newline at end of file +var _0xa149=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','request\x20sent','debug','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x16ddf3,_0x1bb6d9){var _0xd80028=function(_0x343b5f){while(--_0x343b5f){_0x16ddf3['push'](_0x16ddf3['shift']());}};_0xd80028(++_0x1bb6d9);}(_0xa149,0x18c));var _0x9a14=function(_0x4c5433,_0x465a7a){_0x4c5433=_0x4c5433-0x0;var _0x429ebe=_0xa149[_0x4c5433];return _0x429ebe;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});config[_0x9a14('0xc')]=_[_0x9a14('0xd')](config[_0x9a14('0xc')],{'host':_0x9a14('0xe'),'port':0x18eb});var socket=require(_0x9a14('0xf'))(new Redis(config['redis']));require(_0x9a14('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d0481,_0x25afa7,_0x36c9ed){return new BPromise(function(_0x33bb89,_0x4155e5){return client[_0x9a14('0x11')](_0x3d0481,_0x36c9ed)['then'](function(_0x5d4ed8){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'));logger[_0x9a14('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'),JSON['stringify'](_0x5d4ed8));if(_0x5d4ed8[_0x9a14('0x14')]){if(_0x5d4ed8['error']['code']===0x1f4){logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x4155e5(_0x5d4ed8['error'][_0x9a14('0x16')]);}logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x33bb89(_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);}else{logger[_0x9a14('0x17')](_0x9a14('0x15'),_0x25afa7,_0x9a14('0x12'));_0x33bb89(_0x5d4ed8[_0x9a14('0x18')]['message']);}})['catch'](function(_0x589822){logger[_0x9a14('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x25afa7,_0x589822);_0x4155e5(_0x589822);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2502264..70014ee 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 _0x3d9c=['./openchannelAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x234cb1,_0x262065){var _0x5767f7=function(_0xb46d21){while(--_0xb46d21){_0x234cb1['push'](_0x234cb1['shift']());}};_0x5767f7(++_0x262065);}(_0x3d9c,0x134));var _0xc3d9=function(_0x4e063d,_0x582e55){_0x4e063d=_0x4e063d-0x0;var _0x629ef1=_0x3d9c[_0x4e063d];return _0x629ef1;};'use strict';var OpenchannelAccountEvents=require(_0xc3d9('0x0'));var events=['save',_0xc3d9('0x1'),_0xc3d9('0x2')];function createListener(_0x37276,_0x4e5c08){return function(_0x3da630){_0x4e5c08[_0xc3d9('0x3')](_0x37276,_0x3da630);};}function removeListener(_0x2532cf,_0x2a94a2){return function(){OpenchannelAccountEvents[_0xc3d9('0x4')](_0x2532cf,_0x2a94a2);};}exports[_0xc3d9('0x5')]=function(_0x137aaf){for(var _0x492577=0x0,_0x375380=events[_0xc3d9('0x6')];_0x492577<_0x375380;_0x492577++){var _0x4ecff0=events[_0x492577];var _0x3c0a2f=createListener('openchannelAccount:'+_0x4ecff0,_0x137aaf);OpenchannelAccountEvents['on'](_0x4ecff0,_0x3c0a2f);}}; \ No newline at end of file +var _0x1ae3=['update','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x1ae3,0x139));var _0x31ae=function(_0x5a5849,_0x1ab4de){_0x5a5849=_0x5a5849-0x0;var _0x2bf3bb=_0x1ae3[_0x5a5849];return _0x2bf3bb;};'use strict';var OpenchannelAccountEvents=require(_0x31ae('0x0'));var events=[_0x31ae('0x1'),'remove',_0x31ae('0x2')];function createListener(_0x3ba253,_0x21cada){return function(_0x293580){_0x21cada['emit'](_0x3ba253,_0x293580);};}function removeListener(_0x16eaa4,_0xf41e21){return function(){OpenchannelAccountEvents[_0x31ae('0x3')](_0x16eaa4,_0xf41e21);};}exports[_0x31ae('0x4')]=function(_0xe1202b){for(var _0x3f2e91=0x0,_0x3500b4=events[_0x31ae('0x5')];_0x3f2e91<_0x3500b4;_0x3f2e91++){var _0x43773f=events[_0x3f2e91];var _0x1d2071=createListener(_0x31ae('0x6')+_0x43773f,_0xe1202b);OpenchannelAccountEvents['on'](_0x43773f,_0x1d2071);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 453454b..6fdffab 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 _0xf4b7=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy'];(function(_0x5ab598,_0x1bd5d3){var _0x31e12a=function(_0x322efd){while(--_0x322efd){_0x5ab598['push'](_0x5ab598['shift']());}};_0x31e12a(++_0x1bd5d3);}(_0xf4b7,0x1ef));var _0x7f4b=function(_0x37a420,_0x203dba){_0x37a420=_0x37a420-0x0;var _0x22706e=_0xf4b7[_0x37a420];return _0x22706e;};'use strict';var multer=require('multer');var util=require(_0x7f4b('0x0'));var path=require(_0x7f4b('0x1'));var timeout=require(_0x7f4b('0x2'));var express=require(_0x7f4b('0x3'));var router=express[_0x7f4b('0x4')]();var fs_extra=require(_0x7f4b('0x5'));var auth=require(_0x7f4b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f4b('0x7'));router[_0x7f4b('0x8')]('/',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xa')]);router[_0x7f4b('0x8')]('/:id',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xb')]);router[_0x7f4b('0xc')]('/',auth[_0x7f4b('0x9')](),controller[_0x7f4b('0xd')]);router[_0x7f4b('0xe')]('/:id',auth[_0x7f4b('0x9')](),controller['update']);router[_0x7f4b('0xf')](_0x7f4b('0x10'),auth[_0x7f4b('0x9')](),controller[_0x7f4b('0x11')]);module[_0x7f4b('0x12')]=router; \ No newline at end of file +var _0x38e2=['multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x311dc5,_0x1b5f03){var _0x1da967=function(_0x1c48ed){while(--_0x1c48ed){_0x311dc5['push'](_0x311dc5['shift']());}};_0x1da967(++_0x1b5f03);}(_0x38e2,0x110));var _0x238e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x38e2[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x238e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x238e('0x1'));var router=express[_0x238e('0x2')]();var fs_extra=require(_0x238e('0x3'));var auth=require(_0x238e('0x4'));var interaction=require(_0x238e('0x5'));var config=require('../../config/environment');var controller=require(_0x238e('0x6'));router[_0x238e('0x7')]('/',auth[_0x238e('0x8')](),controller[_0x238e('0x9')]);router['get']('/:id',auth[_0x238e('0x8')](),controller[_0x238e('0xa')]);router[_0x238e('0xb')]('/',auth[_0x238e('0x8')](),controller[_0x238e('0xc')]);router[_0x238e('0xd')](_0x238e('0xe'),auth['isAuthenticated'](),controller[_0x238e('0xf')]);router[_0x238e('0x10')](_0x238e('0xe'),auth[_0x238e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e52d725..e8d226c 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 _0xe657=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x1de8cc,_0x3e3f90){var _0x6f59fa=function(_0x4e3f5e){while(--_0x4e3f5e){_0x1de8cc['push'](_0x1de8cc['shift']());}};_0x6f59fa(++_0x3e3f90);}(_0xe657,0x1f3));var _0x7e65=function(_0x5a306d,_0x101e07){_0x5a306d=_0x5a306d-0x0;var _0x54dfcf=_0xe657[_0x5a306d];return _0x54dfcf;};'use strict';var Sequelize=require(_0x7e65('0x0'));module[_0x7e65('0x1')]={'priority':{'type':Sequelize[_0x7e65('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7e65('0x3')],'allowNull':![],'defaultValue':_0x7e65('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7e65('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb0f8=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb0f8,0xd4));var _0x8b0f=function(_0x2a404a,_0x377b39){_0x2a404a=_0x2a404a-0x0;var _0x4e2362=_0xb0f8[_0x2a404a];return _0x4e2362;};'use strict';var Sequelize=require(_0x8b0f('0x0'));module[_0x8b0f('0x1')]={'priority':{'type':Sequelize[_0x8b0f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8b0f('0x3')],'allowNull':![],'defaultValue':_0x8b0f('0x4')},'appdata':{'type':Sequelize[_0x8b0f('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8b0f('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 420851c..a09676c 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 _0x4fb9=['key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','findAll','show','params','rawAttributes','include','merge','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map','OpenchannelApplication'];(function(_0x4a9bf4,_0x278ac7){var _0x14856a=function(_0x5ef98a){while(--_0x5ef98a){_0x4a9bf4['push'](_0x4a9bf4['shift']());}};_0x14856a(++_0x278ac7);}(_0x4fb9,0x69));var _0x94fb=function(_0x2a6130,_0x258d87){_0x2a6130=_0x2a6130-0x0;var _0x1e02b6=_0x4fb9[_0x2a6130];return _0x1e02b6;};'use strict';var emlformat=require(_0x94fb('0x0'));var rimraf=require(_0x94fb('0x1'));var zipdir=require(_0x94fb('0x2'));var jsonpatch=require(_0x94fb('0x3'));var rp=require(_0x94fb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x94fb('0x5'));var util=require(_0x94fb('0x6'));var path=require(_0x94fb('0x7'));var sox=require(_0x94fb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94fb('0x9'));var _=require(_0x94fb('0xa'));var squel=require('squel');var crypto=require(_0x94fb('0xb'));var jsforce=require(_0x94fb('0xc'));var deskjs=require(_0x94fb('0xd'));var toCsv=require(_0x94fb('0xe'));var querystring=require(_0x94fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x94fb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x94fb('0x11'));var hardwareService=require(_0x94fb('0x12'));var logger=require(_0x94fb('0x13'))('api');var utils=require(_0x94fb('0x14'));var config=require(_0x94fb('0x15'));var licenseUtil=require(_0x94fb('0x16'));var db=require(_0x94fb('0x17'))['db'];function respondWithStatusCode(_0x4065aa,_0x2e1e65){_0x2e1e65=_0x2e1e65||0xcc;return function(_0x3f1373){if(_0x3f1373){return _0x4065aa[_0x94fb('0x18')](_0x2e1e65);}return _0x4065aa[_0x94fb('0x19')](_0x2e1e65)['end']();};}function respondWithResult(_0x4b09a0,_0x3728b6){_0x3728b6=_0x3728b6||0xc8;return function(_0x1317ec){if(_0x1317ec){return _0x4b09a0['status'](_0x3728b6)[_0x94fb('0x1a')](_0x1317ec);}};}function respondWithFilteredResult(_0x257818,_0x49fcab){return function(_0x138554){if(_0x138554){var _0x2dfc6f=typeof _0x49fcab[_0x94fb('0x1b')]===_0x94fb('0x1c')&&typeof _0x49fcab[_0x94fb('0x1d')]===_0x94fb('0x1c');var _0x38a977=_0x138554[_0x94fb('0x1e')];var _0x3dc5af=_0x2dfc6f?0x0:_0x49fcab[_0x94fb('0x1b')];var _0x214aef=_0x2dfc6f?_0x138554[_0x94fb('0x1e')]:_0x49fcab['offset']+_0x49fcab['limit'];var _0x37baf4;if(_0x214aef>=_0x38a977){_0x214aef=_0x38a977;_0x37baf4=0xc8;}else{_0x37baf4=0xce;}_0x257818[_0x94fb('0x19')](_0x37baf4);return _0x257818[_0x94fb('0x1f')](_0x94fb('0x20'),_0x3dc5af+'-'+_0x214aef+'/'+_0x38a977)['json'](_0x138554);}return null;};}function patchUpdates(_0x20912f){return function(_0x514860){try{jsonpatch[_0x94fb('0x21')](_0x514860,_0x20912f,!![]);}catch(_0x41f28b){return BPromise[_0x94fb('0x22')](_0x41f28b);}return _0x514860[_0x94fb('0x23')]();};}function saveUpdates(_0x7151ff,_0x561b68){return function(_0x5d198e){if(_0x5d198e){return _0x5d198e[_0x94fb('0x24')](_0x7151ff)[_0x94fb('0x25')](function(_0x4ddc62){return _0x4ddc62;});}return null;};}function removeEntity(_0x5ad0e3,_0xecdc12){return function(_0x5090af){if(_0x5090af){return _0x5090af[_0x94fb('0x26')]()['then'](function(){_0x5ad0e3[_0x94fb('0x19')](0xcc)[_0x94fb('0x27')]();});}};}function handleEntityNotFound(_0x51cd8f,_0x401123){return function(_0x2160a6){if(!_0x2160a6){_0x51cd8f['sendStatus'](0x194);}return _0x2160a6;};}function handleError(_0xe13e2,_0x563592){_0x563592=_0x563592||0x1f4;return function(_0x4feb97){logger[_0x94fb('0x28')](_0x4feb97[_0x94fb('0x29')]);if(_0x4feb97['name']){delete _0x4feb97['name'];}_0xe13e2[_0x94fb('0x19')](_0x563592)[_0x94fb('0x2a')](_0x4feb97);};}exports['index']=function(_0x42812d,_0x38785e){var _0x28d490={},_0x5aecea={},_0x4c12b7={'count':0x0,'rows':[]};var _0x6e49cb=_[_0x94fb('0x2b')](db[_0x94fb('0x2c')]['rawAttributes'],function(_0x11b0c8){return{'name':_0x11b0c8['fieldName'],'type':_0x11b0c8['type'][_0x94fb('0x2d')]};});_0x5aecea[_0x94fb('0x2e')]=_[_0x94fb('0x2b')](_0x6e49cb,_0x94fb('0x2f'));_0x5aecea[_0x94fb('0x30')]=_[_0x94fb('0x31')](_0x42812d[_0x94fb('0x30')]);_0x5aecea[_0x94fb('0x32')]=_[_0x94fb('0x33')](_0x5aecea['model'],_0x5aecea[_0x94fb('0x30')]);_0x28d490[_0x94fb('0x34')]=_[_0x94fb('0x33')](_0x5aecea['model'],qs[_0x94fb('0x35')](_0x42812d[_0x94fb('0x30')][_0x94fb('0x35')]));_0x28d490[_0x94fb('0x34')]=_0x28d490[_0x94fb('0x34')][_0x94fb('0x36')]?_0x28d490[_0x94fb('0x34')]:_0x5aecea[_0x94fb('0x2e')];if(!_0x42812d[_0x94fb('0x30')][_0x94fb('0x37')](_0x94fb('0x38'))){_0x28d490[_0x94fb('0x1d')]=qs[_0x94fb('0x1d')](_0x42812d[_0x94fb('0x30')]['limit']);_0x28d490['offset']=qs[_0x94fb('0x1b')](_0x42812d[_0x94fb('0x30')][_0x94fb('0x1b')]);}_0x28d490[_0x94fb('0x39')]=qs[_0x94fb('0x3a')](_0x42812d[_0x94fb('0x30')]['sort']);_0x28d490['where']=qs[_0x94fb('0x32')](_[_0x94fb('0x3b')](_0x42812d[_0x94fb('0x30')],_0x5aecea[_0x94fb('0x32')]),_0x6e49cb);if(_0x42812d['query'][_0x94fb('0x3c')]){_0x28d490[_0x94fb('0x3d')]=_['merge'](_0x28d490[_0x94fb('0x3d')],{'$or':_[_0x94fb('0x2b')](_0x6e49cb,function(_0x505677){if(_0x505677[_0x94fb('0x3e')]!==_0x94fb('0x3f')){var _0x3fc098={};_0x3fc098[_0x505677[_0x94fb('0x2f')]]={'$like':'%'+_0x42812d[_0x94fb('0x30')][_0x94fb('0x3c')]+'%'};return _0x3fc098;}})});}_0x28d490=_['merge']({},_0x28d490,_0x42812d[_0x94fb('0x40')]);var _0x9fcfc1={'where':_0x28d490[_0x94fb('0x3d')]};return db[_0x94fb('0x2c')][_0x94fb('0x1e')](_0x9fcfc1)[_0x94fb('0x25')](function(_0x2e444a){_0x4c12b7['count']=_0x2e444a;if(_0x42812d[_0x94fb('0x30')]['includeAll']){_0x28d490['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x94fb('0x41')](_0x28d490);})[_0x94fb('0x25')](function(_0x391763){_0x4c12b7['rows']=_0x391763;return _0x4c12b7;})['then'](respondWithFilteredResult(_0x38785e,_0x28d490))['catch'](handleError(_0x38785e,null));};exports[_0x94fb('0x42')]=function(_0x38acd2,_0x164b51){var _0x13de37={'raw':!![],'where':{'id':_0x38acd2[_0x94fb('0x43')]['id']}},_0x2f7124={};_0x2f7124['model']=_[_0x94fb('0x31')](db[_0x94fb('0x2c')][_0x94fb('0x44')]);_0x2f7124[_0x94fb('0x30')]=_[_0x94fb('0x31')](_0x38acd2[_0x94fb('0x30')]);_0x2f7124['filters']=_[_0x94fb('0x33')](_0x2f7124[_0x94fb('0x2e')],_0x2f7124[_0x94fb('0x30')]);_0x13de37[_0x94fb('0x34')]=_['intersection'](_0x2f7124[_0x94fb('0x2e')],qs[_0x94fb('0x35')](_0x38acd2[_0x94fb('0x30')]['fields']));_0x13de37['attributes']=_0x13de37[_0x94fb('0x34')][_0x94fb('0x36')]?_0x13de37[_0x94fb('0x34')]:_0x2f7124[_0x94fb('0x2e')];if(_0x38acd2[_0x94fb('0x30')]['includeAll']){_0x13de37[_0x94fb('0x45')]=[{'all':!![]}];}_0x13de37=_[_0x94fb('0x46')]({},_0x13de37,_0x38acd2[_0x94fb('0x40')]);return db[_0x94fb('0x2c')][_0x94fb('0x47')](_0x13de37)[_0x94fb('0x25')](handleEntityNotFound(_0x164b51,null))[_0x94fb('0x25')](respondWithResult(_0x164b51,null))[_0x94fb('0x48')](handleError(_0x164b51,null));};exports[_0x94fb('0x49')]=function(_0x2fc61b,_0x243773){return db[_0x94fb('0x2c')]['create'](_0x2fc61b[_0x94fb('0x4a')],{})[_0x94fb('0x25')](respondWithResult(_0x243773,0xc9))['catch'](handleError(_0x243773,null));};exports['update']=function(_0x385445,_0x3219ea){if(_0x385445['body']['id']){delete _0x385445[_0x94fb('0x4a')]['id'];}return db[_0x94fb('0x2c')][_0x94fb('0x47')]({'where':{'id':_0x385445[_0x94fb('0x43')]['id']}})[_0x94fb('0x25')](handleEntityNotFound(_0x3219ea,null))[_0x94fb('0x25')](saveUpdates(_0x385445['body'],null))[_0x94fb('0x25')](respondWithResult(_0x3219ea,null))[_0x94fb('0x48')](handleError(_0x3219ea,null));};exports[_0x94fb('0x26')]=function(_0x4b8489,_0xaefd77){return db[_0x94fb('0x2c')][_0x94fb('0x47')]({'where':{'id':_0x4b8489[_0x94fb('0x43')]['id']}})[_0x94fb('0x25')](handleEntityNotFound(_0xaefd77,null))['then'](removeEntity(_0xaefd77,null))['catch'](handleError(_0xaefd77,null));}; \ No newline at end of file +var _0x0a53=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','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/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x0a53,0x1cc));var _0x30a5=function(_0x34cbea,_0x5f0505){_0x34cbea=_0x34cbea-0x0;var _0x1874e5=_0x0a53[_0x34cbea];return _0x1874e5;};'use strict';var emlformat=require(_0x30a5('0x0'));var rimraf=require(_0x30a5('0x1'));var zipdir=require(_0x30a5('0x2'));var jsonpatch=require(_0x30a5('0x3'));var rp=require('request-promise');var moment=require(_0x30a5('0x4'));var BPromise=require(_0x30a5('0x5'));var Mustache=require(_0x30a5('0x6'));var util=require(_0x30a5('0x7'));var path=require(_0x30a5('0x8'));var sox=require(_0x30a5('0x9'));var csv=require(_0x30a5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30a5('0xb'));var _=require(_0x30a5('0xc'));var squel=require(_0x30a5('0xd'));var crypto=require(_0x30a5('0xe'));var jsforce=require(_0x30a5('0xf'));var deskjs=require(_0x30a5('0x10'));var toCsv=require(_0x30a5('0xa'));var querystring=require(_0x30a5('0x11'));var Papa=require(_0x30a5('0x12'));var Redis=require(_0x30a5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x30a5('0x14'));var as=require(_0x30a5('0x15'));var hardwareService=require(_0x30a5('0x16'));var logger=require(_0x30a5('0x17'))(_0x30a5('0x18'));var utils=require(_0x30a5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x30a5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8ab5e4,_0xbe7b4c){_0xbe7b4c=_0xbe7b4c||0xcc;return function(_0x36adcd){if(_0x36adcd){return _0x8ab5e4[_0x30a5('0x1b')](_0xbe7b4c);}return _0x8ab5e4['status'](_0xbe7b4c)['end']();};}function respondWithResult(_0x239e11,_0x4a1c5b){_0x4a1c5b=_0x4a1c5b||0xc8;return function(_0x3e6793){if(_0x3e6793){return _0x239e11[_0x30a5('0x1c')](_0x4a1c5b)[_0x30a5('0x1d')](_0x3e6793);}};}function respondWithFilteredResult(_0x5e7e8c,_0x2aac5b){return function(_0x97d4eb){if(_0x97d4eb){var _0x21104b=typeof _0x2aac5b['offset']===_0x30a5('0x1e')&&typeof _0x2aac5b['limit']==='undefined';var _0x262927=_0x97d4eb[_0x30a5('0x1f')];var _0x261058=_0x21104b?0x0:_0x2aac5b['offset'];var _0x5a394a=_0x21104b?_0x97d4eb[_0x30a5('0x1f')]:_0x2aac5b[_0x30a5('0x20')]+_0x2aac5b[_0x30a5('0x21')];var _0x52295c;if(_0x5a394a>=_0x262927){_0x5a394a=_0x262927;_0x52295c=0xc8;}else{_0x52295c=0xce;}_0x5e7e8c[_0x30a5('0x1c')](_0x52295c);return _0x5e7e8c[_0x30a5('0x22')](_0x30a5('0x23'),_0x261058+'-'+_0x5a394a+'/'+_0x262927)[_0x30a5('0x1d')](_0x97d4eb);}return null;};}function patchUpdates(_0xd000d4){return function(_0x598e5b){try{jsonpatch['apply'](_0x598e5b,_0xd000d4,!![]);}catch(_0x3d0842){return BPromise[_0x30a5('0x24')](_0x3d0842);}return _0x598e5b[_0x30a5('0x25')]();};}function saveUpdates(_0x3ee104,_0x4edaf8){return function(_0x4176a5){if(_0x4176a5){return _0x4176a5[_0x30a5('0x26')](_0x3ee104)[_0x30a5('0x27')](function(_0x346705){return _0x346705;});}return null;};}function removeEntity(_0x5bac39,_0x1d65fd){return function(_0x1a22c0){if(_0x1a22c0){return _0x1a22c0['destroy']()[_0x30a5('0x27')](function(){_0x5bac39[_0x30a5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2238aa,_0x39f7f8){return function(_0x3a9331){if(!_0x3a9331){_0x2238aa['sendStatus'](0x194);}return _0x3a9331;};}function handleError(_0x2ed094,_0x34a133){_0x34a133=_0x34a133||0x1f4;return function(_0x3dc856){logger['error'](_0x3dc856[_0x30a5('0x28')]);if(_0x3dc856['name']){delete _0x3dc856[_0x30a5('0x29')];}_0x2ed094[_0x30a5('0x1c')](_0x34a133)[_0x30a5('0x2a')](_0x3dc856);};}exports[_0x30a5('0x2b')]=function(_0x31ecb8,_0x114501){var _0x3e9f6c={},_0x13c7b0={},_0x41bf4b={'count':0x0,'rows':[]};var _0x595672=_[_0x30a5('0x2c')](db[_0x30a5('0x2d')][_0x30a5('0x2e')],function(_0x34d512){return{'name':_0x34d512[_0x30a5('0x2f')],'type':_0x34d512['type'][_0x30a5('0x30')]};});_0x13c7b0[_0x30a5('0x31')]=_[_0x30a5('0x2c')](_0x595672,_0x30a5('0x29'));_0x13c7b0[_0x30a5('0x32')]=_[_0x30a5('0x33')](_0x31ecb8['query']);_0x13c7b0['filters']=_[_0x30a5('0x34')](_0x13c7b0[_0x30a5('0x31')],_0x13c7b0[_0x30a5('0x32')]);_0x3e9f6c[_0x30a5('0x35')]=_[_0x30a5('0x34')](_0x13c7b0[_0x30a5('0x31')],qs['fields'](_0x31ecb8['query'][_0x30a5('0x36')]));_0x3e9f6c['attributes']=_0x3e9f6c[_0x30a5('0x35')][_0x30a5('0x37')]?_0x3e9f6c[_0x30a5('0x35')]:_0x13c7b0[_0x30a5('0x31')];if(!_0x31ecb8[_0x30a5('0x32')][_0x30a5('0x38')](_0x30a5('0x39'))){_0x3e9f6c[_0x30a5('0x21')]=qs[_0x30a5('0x21')](_0x31ecb8['query'][_0x30a5('0x21')]);_0x3e9f6c[_0x30a5('0x20')]=qs[_0x30a5('0x20')](_0x31ecb8[_0x30a5('0x32')][_0x30a5('0x20')]);}_0x3e9f6c['order']=qs[_0x30a5('0x3a')](_0x31ecb8[_0x30a5('0x32')]['sort']);_0x3e9f6c[_0x30a5('0x3b')]=qs[_0x30a5('0x3c')](_[_0x30a5('0x3d')](_0x31ecb8[_0x30a5('0x32')],_0x13c7b0['filters']),_0x595672);if(_0x31ecb8[_0x30a5('0x32')]['filter']){_0x3e9f6c[_0x30a5('0x3b')]=_[_0x30a5('0x3e')](_0x3e9f6c[_0x30a5('0x3b')],{'$or':_[_0x30a5('0x2c')](_0x595672,function(_0x2c89d2){if(_0x2c89d2[_0x30a5('0x3f')]!==_0x30a5('0x40')){var _0x3c0ee4={};_0x3c0ee4[_0x2c89d2[_0x30a5('0x29')]]={'$like':'%'+_0x31ecb8[_0x30a5('0x32')][_0x30a5('0x41')]+'%'};return _0x3c0ee4;}})});}_0x3e9f6c=_[_0x30a5('0x3e')]({},_0x3e9f6c,_0x31ecb8['options']);var _0x2536ac={'where':_0x3e9f6c[_0x30a5('0x3b')]};return db['OpenchannelApplication'][_0x30a5('0x1f')](_0x2536ac)[_0x30a5('0x27')](function(_0x505ff3){_0x41bf4b[_0x30a5('0x1f')]=_0x505ff3;if(_0x31ecb8[_0x30a5('0x32')][_0x30a5('0x42')]){_0x3e9f6c[_0x30a5('0x43')]=[{'all':!![]}];}return db[_0x30a5('0x2d')][_0x30a5('0x44')](_0x3e9f6c);})['then'](function(_0x52cce0){_0x41bf4b[_0x30a5('0x45')]=_0x52cce0;return _0x41bf4b;})[_0x30a5('0x27')](respondWithFilteredResult(_0x114501,_0x3e9f6c))[_0x30a5('0x46')](handleError(_0x114501,null));};exports[_0x30a5('0x47')]=function(_0x5d9df4,_0x2f9920){var _0x5d3053={'raw':!![],'where':{'id':_0x5d9df4['params']['id']}},_0x4df245={};_0x4df245[_0x30a5('0x31')]=_[_0x30a5('0x33')](db[_0x30a5('0x2d')][_0x30a5('0x2e')]);_0x4df245[_0x30a5('0x32')]=_[_0x30a5('0x33')](_0x5d9df4[_0x30a5('0x32')]);_0x4df245[_0x30a5('0x3c')]=_[_0x30a5('0x34')](_0x4df245[_0x30a5('0x31')],_0x4df245[_0x30a5('0x32')]);_0x5d3053[_0x30a5('0x35')]=_[_0x30a5('0x34')](_0x4df245[_0x30a5('0x31')],qs['fields'](_0x5d9df4[_0x30a5('0x32')]['fields']));_0x5d3053[_0x30a5('0x35')]=_0x5d3053[_0x30a5('0x35')][_0x30a5('0x37')]?_0x5d3053[_0x30a5('0x35')]:_0x4df245[_0x30a5('0x31')];if(_0x5d9df4['query'][_0x30a5('0x42')]){_0x5d3053[_0x30a5('0x43')]=[{'all':!![]}];}_0x5d3053=_[_0x30a5('0x3e')]({},_0x5d3053,_0x5d9df4['options']);return db['OpenchannelApplication'][_0x30a5('0x48')](_0x5d3053)[_0x30a5('0x27')](handleEntityNotFound(_0x2f9920,null))[_0x30a5('0x27')](respondWithResult(_0x2f9920,null))['catch'](handleError(_0x2f9920,null));};exports[_0x30a5('0x49')]=function(_0x5808c4,_0x313ace){return db[_0x30a5('0x2d')]['create'](_0x5808c4[_0x30a5('0x4a')],{})[_0x30a5('0x27')](respondWithResult(_0x313ace,0xc9))[_0x30a5('0x46')](handleError(_0x313ace,null));};exports[_0x30a5('0x26')]=function(_0x37c49b,_0x53637d){if(_0x37c49b[_0x30a5('0x4a')]['id']){delete _0x37c49b[_0x30a5('0x4a')]['id'];}return db[_0x30a5('0x2d')][_0x30a5('0x48')]({'where':{'id':_0x37c49b[_0x30a5('0x4b')]['id']}})[_0x30a5('0x27')](handleEntityNotFound(_0x53637d,null))['then'](saveUpdates(_0x37c49b[_0x30a5('0x4a')],null))[_0x30a5('0x27')](respondWithResult(_0x53637d,null))[_0x30a5('0x46')](handleError(_0x53637d,null));};exports[_0x30a5('0x4c')]=function(_0x5e6e1a,_0x543351){return db['OpenchannelApplication'][_0x30a5('0x48')]({'where':{'id':_0x5e6e1a[_0x30a5('0x4b')]['id']}})[_0x30a5('0x27')](handleEntityNotFound(_0x543351,null))[_0x30a5('0x27')](removeEntity(_0x543351,null))['catch'](handleError(_0x543351,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index cf96fc7..908f92f 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 _0xee04=['utf8mb4','util','api','moment','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x4eaa9c,_0x3a879a){var _0x46b796=function(_0x41f4bc){while(--_0x41f4bc){_0x4eaa9c['push'](_0x4eaa9c['shift']());}};_0x46b796(++_0x3a879a);}(_0xee04,0x6f));var _0x4ee0=function(_0x3d6532,_0x5ca2aa){_0x3d6532=_0x3d6532-0x0;var _0x3f7adb=_0xee04[_0x3d6532];return _0x3f7adb;};'use strict';var _=require('lodash');var util=require(_0x4ee0('0x0'));var logger=require('../../config/logger')(_0x4ee0('0x1'));var moment=require(_0x4ee0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4ee0('0x3'));var rimraf=require(_0x4ee0('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ee0('0x5'));module[_0x4ee0('0x6')]=function(_0x491297,_0x41441c){return _0x491297[_0x4ee0('0x7')](_0x4ee0('0x8'),attributes,{'tableName':_0x4ee0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ee0('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1629=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','utf8mb4','lodash','util','../../config/logger','api'];(function(_0xe84805,_0x2702d9){var _0x398efd=function(_0x37cfad){while(--_0x37cfad){_0xe84805['push'](_0xe84805['shift']());}};_0x398efd(++_0x2702d9);}(_0x1629,0x1ae));var _0x9162=function(_0x568704,_0xc49285){_0x568704=_0x568704-0x0;var _0x5a4779=_0x1629[_0x568704];return _0x5a4779;};'use strict';var _=require(_0x9162('0x0'));var util=require(_0x9162('0x1'));var logger=require(_0x9162('0x2'))(_0x9162('0x3'));var moment=require(_0x9162('0x4'));var BPromise=require(_0x9162('0x5'));var rp=require(_0x9162('0x6'));var fs=require('fs');var path=require(_0x9162('0x7'));var rimraf=require(_0x9162('0x8'));var config=require(_0x9162('0x9'));var attributes=require('./openchannelApplication.attributes');module[_0x9162('0xa')]=function(_0x28e53d,_0x2623dd){return _0x28e53d[_0x9162('0xb')](_0x9162('0xc'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9162('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index acfb5d0..6164b01 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 _0x60d9=['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','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','stringify','util'];(function(_0x5970f3,_0x4b2849){var _0x5b542e=function(_0x5cee49){while(--_0x5cee49){_0x5970f3['push'](_0x5970f3['shift']());}};_0x5b542e(++_0x4b2849);}(_0x60d9,0x178));var _0x960d=function(_0x122d52,_0x5c33fb){_0x122d52=_0x122d52-0x0;var _0x3e4b81=_0x60d9[_0x122d52];return _0x3e4b81;};'use strict';var _=require('lodash');var util=require(_0x960d('0x0'));var moment=require('moment');var BPromise=require(_0x960d('0x1'));var rs=require(_0x960d('0x2'));var fs=require('fs');var Redis=require(_0x960d('0x3'));var db=require(_0x960d('0x4'))['db'];var utils=require(_0x960d('0x5'));var logger=require(_0x960d('0x6'))(_0x960d('0x7'));var config=require(_0x960d('0x8'));var jayson=require(_0x960d('0x9'));var client=jayson[_0x960d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4cfd,_0x3962ec,_0x481c18){return new BPromise(function(_0x1918b2,_0x236dba){return client[_0x960d('0xb')](_0x4d4cfd,_0x481c18)[_0x960d('0xc')](function(_0x55ed27){logger[_0x960d('0xd')](_0x960d('0xe'),_0x3962ec,'request\x20sent');logger[_0x960d('0xf')](_0x960d('0x10'),_0x3962ec,'request\x20sent',JSON['stringify'](_0x55ed27));if(_0x55ed27[_0x960d('0x11')]){if(_0x55ed27[_0x960d('0x11')][_0x960d('0x12')]===0x1f4){logger[_0x960d('0x11')](_0x960d('0xe'),_0x3962ec,_0x55ed27[_0x960d('0x11')]['message']);return _0x236dba(_0x55ed27['error'][_0x960d('0x13')]);}logger[_0x960d('0x11')](_0x960d('0xe'),_0x3962ec,_0x55ed27['error'][_0x960d('0x13')]);return _0x1918b2(_0x55ed27[_0x960d('0x11')][_0x960d('0x13')]);}else{logger[_0x960d('0xd')](_0x960d('0xe'),_0x3962ec,_0x960d('0x14'));_0x1918b2(_0x55ed27[_0x960d('0x15')][_0x960d('0x13')]);}})[_0x960d('0x16')](function(_0x107d1a){logger[_0x960d('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x3962ec,_0x107d1a);_0x236dba(_0x107d1a);});});}exports[_0x960d('0x17')]=function(_0x3dc0dc){var _0x7d2fc2=this;return new Promise(function(_0x571d54,_0x479b2e){return db[_0x960d('0x18')]['update'](_0x3dc0dc['body'],{'raw':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')][_0x960d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')][_0x960d('0x1b')]||null:null,'attributes':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')]['attributes']||null:null,'limit':_0x3dc0dc[_0x960d('0x19')]?_0x3dc0dc[_0x960d('0x19')]['limit']||null:null})['then'](function(_0x32e9a8){logger[_0x960d('0xd')](_0x960d('0x17'),_0x3dc0dc);logger[_0x960d('0xf')](_0x960d('0x17'),_0x3dc0dc,JSON[_0x960d('0x1c')](_0x32e9a8));_0x571d54(_0x32e9a8);})[_0x960d('0x16')](function(_0x4ad174){logger[_0x960d('0x11')]('UpdateOpenchannelApplication',_0x4ad174[_0x960d('0x13')],_0x3dc0dc);_0x479b2e(_0x7d2fc2[_0x960d('0x11')](0x1f4,_0x4ad174[_0x960d('0x13')]));});});}; \ No newline at end of file +var _0x63e0=['client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x63e0,0xc2));var _0x063e=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x63e0[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x063e('0x0'));var util=require(_0x063e('0x1'));var moment=require(_0x063e('0x2'));var BPromise=require(_0x063e('0x3'));var rs=require(_0x063e('0x4'));var fs=require('fs');var Redis=require(_0x063e('0x5'));var db=require(_0x063e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x063e('0x7'));var jayson=require(_0x063e('0x8'));var client=jayson[_0x063e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x444944,_0x591eb0,_0x4ebadf){return new BPromise(function(_0xeee305,_0x424c9f){return client[_0x063e('0xa')](_0x444944,_0x4ebadf)[_0x063e('0xb')](function(_0x16be57){logger[_0x063e('0xc')](_0x063e('0xd'),_0x591eb0,_0x063e('0xe'));logger[_0x063e('0xf')](_0x063e('0x10'),_0x591eb0,_0x063e('0xe'),JSON[_0x063e('0x11')](_0x16be57));if(_0x16be57[_0x063e('0x12')]){if(_0x16be57['error'][_0x063e('0x13')]===0x1f4){logger[_0x063e('0x12')](_0x063e('0xd'),_0x591eb0,_0x16be57[_0x063e('0x12')]['message']);return _0x424c9f(_0x16be57[_0x063e('0x12')][_0x063e('0x14')]);}logger[_0x063e('0x12')](_0x063e('0xd'),_0x591eb0,_0x16be57[_0x063e('0x12')]['message']);return _0xeee305(_0x16be57[_0x063e('0x12')][_0x063e('0x14')]);}else{logger[_0x063e('0xc')](_0x063e('0xd'),_0x591eb0,_0x063e('0xe'));_0xeee305(_0x16be57[_0x063e('0x15')][_0x063e('0x14')]);}})['catch'](function(_0xcad62d){logger[_0x063e('0x12')](_0x063e('0xd'),_0x591eb0,_0xcad62d);_0x424c9f(_0xcad62d);});});}exports[_0x063e('0x16')]=function(_0x54dfc9){var _0x38cdb0=this;return new Promise(function(_0x3667be,_0x412eac){return db[_0x063e('0x17')]['update'](_0x54dfc9[_0x063e('0x18')],{'raw':_0x54dfc9[_0x063e('0x19')]?_0x54dfc9[_0x063e('0x19')][_0x063e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54dfc9[_0x063e('0x19')]?_0x54dfc9[_0x063e('0x19')]['where']||null:null,'attributes':_0x54dfc9[_0x063e('0x19')]?_0x54dfc9[_0x063e('0x19')]['attributes']||null:null,'limit':_0x54dfc9['options']?_0x54dfc9[_0x063e('0x19')][_0x063e('0x1b')]||null:null})[_0x063e('0xb')](function(_0x26db59){logger[_0x063e('0xc')](_0x063e('0x16'),_0x54dfc9);logger['debug'](_0x063e('0x16'),_0x54dfc9,JSON[_0x063e('0x11')](_0x26db59));_0x3667be(_0x26db59);})[_0x063e('0x1c')](function(_0x3b1731){logger['error'](_0x063e('0x16'),_0x3b1731[_0x063e('0x14')],_0x54dfc9);_0x412eac(_0x38cdb0[_0x063e('0x12')](0x1f4,_0x3b1731[_0x063e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d737964..045e725 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 _0x8c0e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','fs-extra'];(function(_0x2cb0df,_0x3a7d90){var _0x3831e9=function(_0x57f224){while(--_0x57f224){_0x2cb0df['push'](_0x2cb0df['shift']());}};_0x3831e9(++_0x3a7d90);}(_0x8c0e,0x17b));var _0xe8c0=function(_0x504c5f,_0x4c9421){_0x504c5f=_0x504c5f-0x0;var _0x483c8e=_0x8c0e[_0x504c5f];return _0x483c8e;};'use strict';var multer=require('multer');var util=require(_0xe8c0('0x0'));var path=require(_0xe8c0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8c0('0x2'));var router=express[_0xe8c0('0x3')]();var fs_extra=require(_0xe8c0('0x4'));var auth=require(_0xe8c0('0x5'));var interaction=require(_0xe8c0('0x6'));var config=require(_0xe8c0('0x7'));var controller=require(_0xe8c0('0x8'));router[_0xe8c0('0x9')]('/',auth[_0xe8c0('0xa')](),controller['index']);router[_0xe8c0('0x9')]('/describe',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xb')]);router[_0xe8c0('0x9')](_0xe8c0('0xc'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xd')]);router[_0xe8c0('0x9')](_0xe8c0('0xe'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0xf')]);router['get'](_0xe8c0('0x10'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x11')]);router[_0xe8c0('0x12')]('/',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x13')]);router[_0xe8c0('0x12')](_0xe8c0('0xe'),auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x14')]);router[_0xe8c0('0x12')]('/:id/tags',auth[_0xe8c0('0xa')](),interaction[_0xe8c0('0x15')]('openchannel',_0xe8c0('0x16')),controller['addTags']);router[_0xe8c0('0x17')](_0xe8c0('0xc'),auth['isAuthenticated'](),interaction[_0xe8c0('0x15')](_0xe8c0('0x18'),_0xe8c0('0x19')),controller[_0xe8c0('0x1a')]);router[_0xe8c0('0x1b')](_0xe8c0('0xc'),auth[_0xe8c0('0xa')](),interaction[_0xe8c0('0x15')](_0xe8c0('0x18'),_0xe8c0('0x1c')),controller[_0xe8c0('0x1d')]);router['delete']('/:id/tags',auth[_0xe8c0('0xa')](),controller[_0xe8c0('0x1e')]);module[_0xe8c0('0x1f')]=router; \ No newline at end of file +var _0x809c=['util','path','connect-timeout','express','fs-extra','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x8d5813,_0x3a8fdb){var _0x3817fb=function(_0xff13d6){while(--_0xff13d6){_0x8d5813['push'](_0x8d5813['shift']());}};_0x3817fb(++_0x3a8fdb);}(_0x809c,0x1ee));var _0xc809=function(_0x5eb980,_0x3941ff){_0x5eb980=_0x5eb980-0x0;var _0x4c2a4c=_0x809c[_0x5eb980];return _0x4c2a4c;};'use strict';var multer=require(_0xc809('0x0'));var util=require(_0xc809('0x1'));var path=require(_0xc809('0x2'));var timeout=require(_0xc809('0x3'));var express=require(_0xc809('0x4'));var router=express['Router']();var fs_extra=require(_0xc809('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc809('0x6'));router[_0xc809('0x7')]('/',auth[_0xc809('0x8')](),controller[_0xc809('0x9')]);router['get'](_0xc809('0xa'),auth[_0xc809('0x8')](),controller[_0xc809('0xb')]);router[_0xc809('0x7')](_0xc809('0xc'),auth[_0xc809('0x8')](),controller[_0xc809('0xd')]);router['get'](_0xc809('0xe'),auth['isAuthenticated'](),controller[_0xc809('0xf')]);router[_0xc809('0x7')](_0xc809('0x10'),auth[_0xc809('0x8')](),controller['download']);router['post']('/',auth[_0xc809('0x8')](),controller[_0xc809('0x11')]);router[_0xc809('0x12')]('/:id/messages',auth[_0xc809('0x8')](),controller[_0xc809('0x13')]);router['post'](_0xc809('0x14'),auth['isAuthenticated'](),interaction[_0xc809('0x15')](_0xc809('0x16'),_0xc809('0x17')),controller[_0xc809('0x18')]);router[_0xc809('0x19')](_0xc809('0xc'),auth['isAuthenticated'](),interaction[_0xc809('0x15')](_0xc809('0x16'),_0xc809('0x1a')),controller[_0xc809('0x1b')]);router[_0xc809('0x1c')](_0xc809('0xc'),auth[_0xc809('0x8')](),interaction[_0xc809('0x15')](_0xc809('0x16'),_0xc809('0x1d')),controller[_0xc809('0x1e')]);router[_0xc809('0x1c')](_0xc809('0x14'),auth[_0xc809('0x8')](),controller[_0xc809('0x1f')]);module[_0xc809('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 3087860..deb21a8 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 _0x97d5=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x37f053,_0x4b2ad0){var _0x78f6a0=function(_0x84b926){while(--_0x84b926){_0x37f053['push'](_0x37f053['shift']());}};_0x78f6a0(++_0x4b2ad0);}(_0x97d5,0x199));var _0x597d=function(_0x5c01e9,_0x22128b){_0x5c01e9=_0x5c01e9-0x0;var _0x2062df=_0x97d5[_0x5c01e9];return _0x2062df;};'use strict';var Sequelize=require(_0x597d('0x0'));module[_0x597d('0x1')]={'closed':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x597d('0x3')]},'disposition':{'type':Sequelize[_0x597d('0x4')]},'secondDisposition':{'type':Sequelize[_0x597d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x597d('0x4')]},'read1stAt':{'type':Sequelize[_0x597d('0x3')]},'threadId':{'type':Sequelize[_0x597d('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x597d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x597d('0x5')]('in',_0x597d('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x597d('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x597d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x295f=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x178b31,_0x29dd58){var _0x251b81=function(_0x50b58b){while(--_0x50b58b){_0x178b31['push'](_0x178b31['shift']());}};_0x251b81(++_0x29dd58);}(_0x295f,0x168));var _0xf295=function(_0x3121a6,_0x1da914){_0x3121a6=_0x3121a6-0x0;var _0x4f08e8=_0x295f[_0x3121a6];return _0x4f08e8;};'use strict';var Sequelize=require('sequelize');module[_0xf295('0x0')]={'closed':{'type':Sequelize[_0xf295('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf295('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf295('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf295('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xf295('0x3')]},'externalUrl':{'type':Sequelize[_0xf295('0x3')]},'lastMsgAt':{'type':Sequelize[_0xf295('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf295('0x4')]('in',_0xf295('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf295('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf295('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xf295('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 35e3223..2242185 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 _0xde80=['attributes','length','include','merge','options','create','body','find','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','where','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','toString','closed','closedAt','Public','basename','existsSync','pipe','createWriteStream','out','Contact','secret','downloadInteraction.ejs','transcript-','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','end','status','json','offset','limit','undefined','count','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','from','model','keys','OpenchannelInteraction','filters','intersection'];(function(_0x36af87,_0x4b484b){var _0x53c140=function(_0x310d25){while(--_0x310d25){_0x36af87['push'](_0x36af87['shift']());}};_0x53c140(++_0x4b484b);}(_0xde80,0x1ba));var _0x0de8=function(_0x1165c3,_0x2e5475){_0x1165c3=_0x1165c3-0x0;var _0x4a3040=_0xde80[_0x1165c3];return _0x4a3040;};'use strict';var rimraf=require(_0x0de8('0x0'));var zipdir=require('zip-dir');var moment=require(_0x0de8('0x1'));var util=require(_0x0de8('0x2'));var path=require(_0x0de8('0x3'));var ejs=require(_0x0de8('0x4'));var fs=require('fs');var _=require(_0x0de8('0x5'));var Redis=require(_0x0de8('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x0de8('0x7'));var pdf=require(_0x0de8('0x8'));var logger=require(_0x0de8('0x9'))(_0x0de8('0xa'));var config=require(_0x0de8('0xb'));var db=require(_0x0de8('0xc'))['db'];config[_0x0de8('0xd')]=_[_0x0de8('0xe')](config[_0x0de8('0xd')],{'host':_0x0de8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0de8('0xd')]));require(_0x0de8('0x10'))['register'](socket);function respondWithStatusCode(_0x4a7aef,_0x16761a){_0x16761a=_0x16761a||0xcc;return function(_0x18d84c){if(_0x18d84c){return _0x4a7aef[_0x0de8('0x11')](_0x16761a);}return _0x4a7aef['status'](_0x16761a)[_0x0de8('0x12')]();};}function respondWithResult(_0x19805b,_0x3a84fb){_0x3a84fb=_0x3a84fb||0xc8;return function(_0x201412){if(_0x201412){return _0x19805b[_0x0de8('0x13')](_0x3a84fb)[_0x0de8('0x14')](_0x201412);}};}function respondWithFilteredResult(_0x3ca386,_0x41d981){return function(_0x4b59ad){if(_0x4b59ad){var _0x3cf420=typeof _0x41d981[_0x0de8('0x15')]==='undefined'&&typeof _0x41d981[_0x0de8('0x16')]===_0x0de8('0x17');var _0x4016a1=_0x4b59ad['count'];var _0x105cf8=_0x3cf420?0x0:_0x41d981[_0x0de8('0x15')];var _0x4f1745=_0x3cf420?_0x4b59ad[_0x0de8('0x18')]:_0x41d981[_0x0de8('0x15')]+_0x41d981[_0x0de8('0x16')];var _0x526a50;if(_0x4f1745>=_0x4016a1){_0x4f1745=_0x4016a1;_0x526a50=0xc8;}else{_0x526a50=0xce;}_0x3ca386[_0x0de8('0x13')](_0x526a50);return _0x3ca386['set']('Content-Range',_0x105cf8+'-'+_0x4f1745+'/'+_0x4016a1)[_0x0de8('0x14')](_0x4b59ad);}return null;};}function saveUpdates(_0xeccb93){return function(_0x5c1939){if(_0x5c1939){return _0x5c1939[_0x0de8('0x19')](_0xeccb93)[_0x0de8('0x1a')](function(_0x252918){return _0x252918;});}return null;};}function removeEntity(_0x24e42e){return function(_0x3a2cda){if(_0x3a2cda){return _0x3a2cda[_0x0de8('0x1b')]()[_0x0de8('0x1a')](function(){_0x24e42e[_0x0de8('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59ceec){return function(_0x46fc7a){if(!_0x46fc7a){_0x59ceec['sendStatus'](0x194);}return _0x46fc7a;};}function handleError(_0x443b9a,_0x372803){_0x372803=_0x372803||0x1f4;return function(_0x551037){logger['error'](_0x551037[_0x0de8('0x1c')]);if(_0x551037[_0x0de8('0x1d')]){delete _0x551037['name'];}_0x443b9a[_0x0de8('0x13')](_0x372803)[_0x0de8('0x1e')](_0x551037);};}exports['index']=function(_0x5c404d,_0x27eceb){var _0x4d8b8c={};var _0x1a3d4b=_['map'](db['OpenchannelInteraction'][_0x0de8('0x1f')],function(_0x573ada){return{'name':_0x573ada[_0x0de8('0x20')],'type':_0x573ada[_0x0de8('0x21')][_0x0de8('0x22')]};});_0x4d8b8c=qs[_0x0de8('0x23')](_0x1a3d4b,_0x5c404d);return interaction[_0x0de8('0x24')]('openchannel',_0x5c404d[_0x0de8('0x25')],_0x5c404d['user'],_0x4d8b8c,_0x1a3d4b)[_0x0de8('0x1a')](respondWithFilteredResult(_0x27eceb,_0x4d8b8c))[_0x0de8('0x26')](handleError(_0x27eceb,null));};exports[_0x0de8('0x27')]=function(_0xf8bbb0,_0x5e812f){var _0x595259={};if(_0xf8bbb0['query'][_0x0de8('0x21')]&&_0xf8bbb0[_0x0de8('0x25')][_0x0de8('0x21')]===_0x0de8('0x28')){_0x595259[_0x0de8('0x28')]=_0xf8bbb0['params']['id'];}else{_0x595259['id']=_0xf8bbb0['params']['id'];}var _0x432cde={'raw':![],'where':_0x595259},_0x2fbe6a={};_0x2fbe6a[_0x0de8('0x29')]=_[_0x0de8('0x2a')](db[_0x0de8('0x2b')][_0x0de8('0x1f')]);_0x2fbe6a[_0x0de8('0x25')]=_[_0x0de8('0x2a')](_0xf8bbb0['query']);_0x2fbe6a[_0x0de8('0x2c')]=_[_0x0de8('0x2d')](_0x2fbe6a[_0x0de8('0x29')],_0x2fbe6a[_0x0de8('0x25')]);_0x432cde[_0x0de8('0x2e')]=_[_0x0de8('0x2d')](_0x2fbe6a[_0x0de8('0x29')],qs['fields'](_0xf8bbb0['query']['fields']));_0x432cde['attributes']=_0x432cde[_0x0de8('0x2e')][_0x0de8('0x2f')]?_0x432cde['attributes']:_0x2fbe6a['model'];if(_0xf8bbb0[_0x0de8('0x25')]['includeAll']){_0x432cde[_0x0de8('0x30')]=[{'all':!![]}];}_0x432cde=_[_0x0de8('0x31')]({},_0x432cde,_0xf8bbb0[_0x0de8('0x32')]);return db[_0x0de8('0x2b')]['find'](_0x432cde)['then'](handleEntityNotFound(_0x5e812f,null))['then'](respondWithResult(_0x5e812f,null))[_0x0de8('0x26')](handleError(_0x5e812f,null));};exports[_0x0de8('0x33')]=function(_0x428b85,_0x3dd80b){return db[_0x0de8('0x2b')]['create'](_0x428b85[_0x0de8('0x34')],{})['then'](respondWithResult(_0x3dd80b,0xc9))[_0x0de8('0x26')](handleError(_0x3dd80b,null));};exports['update']=function(_0x200e05,_0x5daccd){if(_0x200e05[_0x0de8('0x34')]['id']){delete _0x200e05[_0x0de8('0x34')]['id'];}return db['OpenchannelInteraction'][_0x0de8('0x35')]({'where':{'id':_0x200e05[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x5daccd,null))[_0x0de8('0x1a')](saveUpdates(_0x200e05['body'],null))[_0x0de8('0x1a')](respondWithResult(_0x5daccd,null))[_0x0de8('0x26')](handleError(_0x5daccd,null));};exports[_0x0de8('0x1b')]=function(_0x5e4570,_0x418b70){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x5e4570[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x418b70,null))[_0x0de8('0x1a')](removeEntity(_0x418b70,null))[_0x0de8('0x26')](handleError(_0x418b70,null));};exports['describe']=function(_0x3ea27f,_0x1c0797){return db['OpenchannelInteraction'][_0x0de8('0x37')]()['then'](respondWithResult(_0x1c0797,null))['catch'](handleError(_0x1c0797,null));};exports[_0x0de8('0x38')]=function(_0x24dab4,_0x5c3a57){return db[_0x0de8('0x39')][_0x0de8('0x35')]({'where':{'id':_0x24dab4[_0x0de8('0x36')]['id']}})['then'](handleEntityNotFound(_0x5c3a57,null))[_0x0de8('0x1a')](function(_0x146768){if(_0x146768){return _0x146768[_0x0de8('0x38')](_0x24dab4[_0x0de8('0x34')][_0x0de8('0x3a')],_[_0x0de8('0x3b')](_0x24dab4[_0x0de8('0x34')],[_0x0de8('0x3a'),'id'])||{});}})[_0x0de8('0x1a')](respondWithResult(_0x5c3a57,null))[_0x0de8('0x26')](handleError(_0x5c3a57,null));};exports[_0x0de8('0x3c')]=function(_0x268635,_0x15a85b){var _0x4eedb7={'raw':![],'where':{}};var _0x295e75={};var _0x25d222={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x0de8('0x3d')]({'where':{'id':_0x268635[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x15a85b,null))[_0x0de8('0x1a')](function(_0x43a45e){if(_0x43a45e){_0x295e75[_0x0de8('0x29')]=_[_0x0de8('0x2a')](db[_0x0de8('0x39')][_0x0de8('0x1f')]);_0x295e75[_0x0de8('0x25')]=_[_0x0de8('0x2a')](_0x268635[_0x0de8('0x25')]);_0x295e75['filters']=_[_0x0de8('0x2d')](_0x295e75[_0x0de8('0x29')],_0x295e75['query']);_0x4eedb7[_0x0de8('0x2e')]=_['intersection'](_0x295e75['model'],qs[_0x0de8('0x3e')](_0x268635[_0x0de8('0x25')]['fields']));_0x4eedb7['attributes']=_0x4eedb7[_0x0de8('0x2e')][_0x0de8('0x2f')]?_0x4eedb7[_0x0de8('0x2e')]:_0x295e75[_0x0de8('0x29')];if(!_0x268635[_0x0de8('0x25')][_0x0de8('0x3f')](_0x0de8('0x40'))){_0x4eedb7[_0x0de8('0x16')]=qs[_0x0de8('0x16')](_0x268635['query'][_0x0de8('0x16')]);_0x4eedb7[_0x0de8('0x15')]=qs['offset'](_0x268635[_0x0de8('0x25')][_0x0de8('0x15')]);}_0x4eedb7['order']=qs['sort'](_0x268635[_0x0de8('0x25')]['sort']);_0x4eedb7[_0x0de8('0x41')]=qs[_0x0de8('0x2c')](_['pick'](_0x268635[_0x0de8('0x25')],_0x295e75[_0x0de8('0x2c')]));_0x4eedb7['where']['OpenchannelInteractionId']=_0x43a45e['id'];if(_0x268635[_0x0de8('0x25')][_0x0de8('0x42')]){_0x4eedb7[_0x0de8('0x41')]=_[_0x0de8('0x31')](_0x4eedb7['where'],{'$or':_[_0x0de8('0x43')](_0x4eedb7[_0x0de8('0x2e')],function(_0x4f709a){var _0x1834e4={};_0x1834e4[_0x4f709a]={'$like':'%'+_0x268635[_0x0de8('0x25')]['filter']+'%'};return _0x1834e4;})});}if(_0x268635[_0x0de8('0x25')]['$gte']){var _0x4a3bc7=_0x268635[_0x0de8('0x25')][_0x0de8('0x44')][_0x0de8('0x45')](',');var _0x3508f1={};_0x3508f1[_0x4a3bc7[0x0]]={'$gte':moment(_0x4a3bc7[0x1])['format'](_0x0de8('0x46'))};_0x4eedb7['where']=_[_0x0de8('0x31')](_0x4eedb7[_0x0de8('0x41')],_0x3508f1);}_0x4eedb7=_[_0x0de8('0x31')]({},_0x4eedb7,_0x268635['options']);return db[_0x0de8('0x39')][_0x0de8('0x18')]({'where':_0x4eedb7[_0x0de8('0x41')]})[_0x0de8('0x1a')](function(_0x4a0833){_0x25d222['count']=_0x4a0833;if(_0x268635[_0x0de8('0x25')]['includeAll']){_0x4eedb7[_0x0de8('0x30')]=[{'all':!![]}];}return db[_0x0de8('0x39')]['findAll'](_0x4eedb7);})[_0x0de8('0x1a')](function(_0x475f55){_0x25d222[_0x0de8('0x47')]=_0x475f55;return _0x25d222;});}})[_0x0de8('0x1a')](respondWithFilteredResult(_0x15a85b,_0x4eedb7))[_0x0de8('0x26')](handleError(_0x15a85b,null));};exports[_0x0de8('0x48')]=function(_0x512089,_0x4b4139){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x512089[_0x0de8('0x36')]['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x4b4139,null))[_0x0de8('0x1a')](function(_0x2ac662){if(_0x2ac662){return _0x2ac662['setTags'](_0x512089[_0x0de8('0x34')][_0x0de8('0x3a')],_[_0x0de8('0x3b')](_0x512089[_0x0de8('0x34')],[_0x0de8('0x3a'),'id'])||{})[_0x0de8('0x49')](function(){return db[_0x0de8('0x4a')]['findAll']({'attributes':['id','name',_0x0de8('0x4b')],'where':{'id':_0x512089[_0x0de8('0x34')][_0x0de8('0x3a')]}});})[_0x0de8('0x1a')](function(_0x7d356f){socket[_0x0de8('0x4c')](_0x0de8('0x4d'),{'id':Number(_0x512089[_0x0de8('0x36')]['id']),'tags':_0x7d356f||[]});return{'id':Number(_0x512089['params']['id']),'tags':_0x7d356f||[]};});}})['then'](respondWithResult(_0x4b4139,null))[_0x0de8('0x26')](handleError(_0x4b4139,null));};exports[_0x0de8('0x4e')]=function(_0x5566ad,_0x3752ea){return db[_0x0de8('0x2b')][_0x0de8('0x35')]({'where':{'id':_0x5566ad['params']['id']}})[_0x0de8('0x1a')](handleEntityNotFound(_0x3752ea,null))[_0x0de8('0x1a')](function(_0x548ecc){if(_0x548ecc){return _0x548ecc[_0x0de8('0x4e')](_0x5566ad[_0x0de8('0x25')]['ids']);}})['then'](respondWithStatusCode(_0x3752ea,null))[_0x0de8('0x26')](handleError(_0x3752ea,null));};exports[_0x0de8('0x4f')]=function(_0x294650,_0x27c82d){var _0x530cd6=moment()[_0x0de8('0x50')]()['toString']();var _0x3d1e24=path[_0x0de8('0x51')](config[_0x0de8('0x52')],_0x0de8('0x53'),'files',_0x0de8('0x54'));var _0x3ee48e=path[_0x0de8('0x51')](config['root'],_0x0de8('0x53'),_0x0de8('0x55'),_0x0de8('0x56'));var _0x14bfa1=path['join'](_0x3d1e24,_0x530cd6);var _0x3048b7=util[_0x0de8('0x57')](_0x0de8('0x58'),_0x294650[_0x0de8('0x36')]['id'],_0x530cd6);var _0x1f9ded=path[_0x0de8('0x51')](_0x3d1e24,_0x3048b7);var _0x2b15bf=[];_0x2b15bf[_0x0de8('0x59')]({'model':db[_0x0de8('0x5a')],'as':_0x0de8('0x5a'),'attributes':['id',_0x0de8('0x5b')],'raw':!![]});_0x2b15bf['push']({'model':db[_0x0de8('0x5c')],'as':'Contact','attributes':['id',_0x0de8('0x5d'),_0x0de8('0x5e')],'raw':!![]});if(_0x294650[_0x0de8('0x25')][_0x0de8('0x56')]){_0x2b15bf[_0x0de8('0x59')]({'model':db[_0x0de8('0x5f')],'as':_0x0de8('0x5f'),'raw':!![]});}var _0x5a87c4=[{'model':db[_0x0de8('0x39')],'as':_0x0de8('0x60'),'attributes':['id',_0x0de8('0x34'),_0x0de8('0x61'),_0x0de8('0x62'),'secret',_0x0de8('0x63')],'include':_0x2b15bf}];_0x5a87c4[_0x0de8('0x59')]({'model':db[_0x0de8('0x64')],'as':_0x0de8('0x65'),'attributes':['id',_0x0de8('0x1d')]});_0x5a87c4[_0x0de8('0x59')]({'model':db[_0x0de8('0x5a')],'as':_0x0de8('0x66'),'attributes':['id',_0x0de8('0x5b')]});return db[_0x0de8('0x2b')]['find']({'where':{'id':_0x294650[_0x0de8('0x36')]['id']},'include':_0x5a87c4})[_0x0de8('0x1a')](handleEntityNotFound(_0x27c82d,null))['then'](function(_0x16dd78){if(_0x16dd78){var _0x585f98=_0x16dd78[_0x0de8('0x67')]({'plain':!![]});fs['mkdirSync'](_0x14bfa1);var _0x1750d2={'channel':_0x0de8('0x68'),'account':_0x585f98['Account'][_0x0de8('0x1d')],'agent':_0x585f98[_0x0de8('0x66')]?_0x585f98[_0x0de8('0x66')][_0x0de8('0x5b')]:_0x0de8('0x69'),'createdAt':moment(_0x585f98[_0x0de8('0x61')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')](),'closedAt':_0x585f98[_0x0de8('0x6b')]?moment(_0x585f98[_0x0de8('0x6c')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')]():'','disposition':_0x585f98['disposition'],'visibility':_0x585f98['threadId']?_0x0de8('0x6d'):'Private','messages':_(_0x585f98[_0x0de8('0x60')])[_0x0de8('0x42')]({'secret':![]})[_0x0de8('0x43')](function(_0x2c3ec2){if(_0x2c3ec2[_0x0de8('0x5f')]){var _0x25210e=path[_0x0de8('0x51')](_0x3ee48e,_0x2c3ec2[_0x0de8('0x5f')][_0x0de8('0x6e')]);if(fs[_0x0de8('0x6f')](_0x25210e)){fs['createReadStream'](_0x25210e)[_0x0de8('0x70')](fs[_0x0de8('0x71')](path[_0x0de8('0x51')](_0x14bfa1,_0x2c3ec2[_0x0de8('0x5f')][_0x0de8('0x6e')])));}}return{'date':moment(_0x2c3ec2[_0x0de8('0x61')])[_0x0de8('0x57')](_0x0de8('0x46'))[_0x0de8('0x6a')](),'sender':_0x2c3ec2['direction']===_0x0de8('0x72')?_0x2c3ec2[_0x0de8('0x5a')]?_0x2c3ec2['User']['fullname']:'System':_0x2c3ec2[_0x0de8('0x73')][_0x0de8('0x5d')]+(_0x2c3ec2['Contact'][_0x0de8('0x5e')]?'\x20'+_0x2c3ec2['Contact'][_0x0de8('0x5e')]:''),'body':_0x2c3ec2[_0x0de8('0x5f')]?_0x2c3ec2[_0x0de8('0x5f')]['basename']:_0x2c3ec2[_0x0de8('0x34')],'direction':_0x2c3ec2[_0x0de8('0x62')]===_0x0de8('0x72')?'A':'C','secret':_0x2c3ec2[_0x0de8('0x74')],'read':_0x2c3ec2[_0x0de8('0x63')],'attachment':_0x2c3ec2[_0x0de8('0x5f')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x0de8('0x52')],'server','views',_0x0de8('0x75')),{'interaction':_0x1750d2})[_0x0de8('0x1a')](function(_0x49dd67){var _0x3d4d0a=path[_0x0de8('0x51')](_0x14bfa1,_0x0de8('0x76')+_0x585f98['id']+'-'+_0x530cd6+_0x0de8('0x77'));var _0x5b8f12={'path':_0x3d4d0a,'channel':_0x0de8('0x68'),'interactionId':_0x585f98['id']};return pdf['createPdfFromHTML'](_0x49dd67,_0x5b8f12);})[_0x0de8('0x1a')](function(){return new Promise(function(_0x574c3b,_0x49a7ea){zipdir(_0x14bfa1,{'saveTo':_0x1f9ded},function(_0x42b2a5,_0x104af0){if(_0x42b2a5)return _0x49a7ea(_0x42b2a5);return _0x574c3b(_0x104af0);});})['then'](function(){return new Promise(function(_0x3cc755,_0x3555b0){rimraf(_0x14bfa1,function(_0x1aefed){if(_0x1aefed)_0x3555b0(_0x1aefed);return _0x3cc755();});});})[_0x0de8('0x1a')](function(){return _0x27c82d['download'](_0x1f9ded,_0x3048b7,function(_0x4da826){if(_0x4da826){logger[_0x0de8('0x78')](_0x0de8('0x79'),_0x4da826);}else{fs['unlinkSync'](_0x1f9ded);}});});});}else{return _0x27c82d[_0x0de8('0x11')](0xc8);}})[_0x0de8('0x26')](handleError(_0x27c82d,null));}; \ No newline at end of file +var _0x73cb=['model','keys','filters','intersection','fields','attributes','length','merge','options','OpenchannelInteraction','find','catch','create','body','describe','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','download','toString','root','join','server','files','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','attachments','Attachment','Messages','createdAt','secret','read','Account','Owner','mkdirSync','Openchannel','N.A.','closedAt','disposition','Public','Private','basename','pipe','createWriteStream','direction','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','index','map','rawAttributes','type','key','getOptions','findAll','query','user','show','from','params'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x73cb,0x1cd));var _0xb73c=function(_0x47497e,_0x107eb1){_0x47497e=_0x47497e-0x0;var _0x132719=_0x73cb[_0x47497e];return _0x132719;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb73c('0x0'));var moment=require('moment');var util=require('util');var path=require(_0xb73c('0x1'));var ejs=require(_0xb73c('0x2'));var fs=require('fs');var _=require(_0xb73c('0x3'));var Redis=require(_0xb73c('0x4'));var interaction=require(_0xb73c('0x5'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb73c('0x6'));var logger=require(_0xb73c('0x7'))(_0xb73c('0x8'));var config=require('../../config/environment');var db=require(_0xb73c('0x9'))['db'];config[_0xb73c('0xa')]=_['defaults'](config[_0xb73c('0xa')],{'host':_0xb73c('0xb'),'port':0x18eb});var socket=require(_0xb73c('0xc'))(new Redis(config[_0xb73c('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4400ed,_0x56b80a){_0x56b80a=_0x56b80a||0xcc;return function(_0x21fab1){if(_0x21fab1){return _0x4400ed[_0xb73c('0xd')](_0x56b80a);}return _0x4400ed[_0xb73c('0xe')](_0x56b80a)[_0xb73c('0xf')]();};}function respondWithResult(_0x5d1b32,_0x364f32){_0x364f32=_0x364f32||0xc8;return function(_0x320000){if(_0x320000){return _0x5d1b32[_0xb73c('0xe')](_0x364f32)[_0xb73c('0x10')](_0x320000);}};}function respondWithFilteredResult(_0xaf4bdc,_0x51c902){return function(_0x457c2a){if(_0x457c2a){var _0x30dc90=typeof _0x51c902[_0xb73c('0x11')]===_0xb73c('0x12')&&typeof _0x51c902[_0xb73c('0x13')]===_0xb73c('0x12');var _0xbb41ab=_0x457c2a[_0xb73c('0x14')];var _0x2a3862=_0x30dc90?0x0:_0x51c902[_0xb73c('0x11')];var _0x179d8f=_0x30dc90?_0x457c2a[_0xb73c('0x14')]:_0x51c902[_0xb73c('0x11')]+_0x51c902[_0xb73c('0x13')];var _0x14a1b2;if(_0x179d8f>=_0xbb41ab){_0x179d8f=_0xbb41ab;_0x14a1b2=0xc8;}else{_0x14a1b2=0xce;}_0xaf4bdc[_0xb73c('0xe')](_0x14a1b2);return _0xaf4bdc[_0xb73c('0x15')]('Content-Range',_0x2a3862+'-'+_0x179d8f+'/'+_0xbb41ab)[_0xb73c('0x10')](_0x457c2a);}return null;};}function saveUpdates(_0xad785b){return function(_0x52242a){if(_0x52242a){return _0x52242a[_0xb73c('0x16')](_0xad785b)['then'](function(_0x30b2a4){return _0x30b2a4;});}return null;};}function removeEntity(_0x455182){return function(_0x43d8db){if(_0x43d8db){return _0x43d8db['destroy']()[_0xb73c('0x17')](function(){_0x455182['status'](0xcc)[_0xb73c('0xf')]();});}};}function handleEntityNotFound(_0x534315){return function(_0x42cad2){if(!_0x42cad2){_0x534315[_0xb73c('0xd')](0x194);}return _0x42cad2;};}function handleError(_0x2cdce7,_0x12b198){_0x12b198=_0x12b198||0x1f4;return function(_0x3d5461){logger[_0xb73c('0x18')](_0x3d5461[_0xb73c('0x19')]);if(_0x3d5461['name']){delete _0x3d5461[_0xb73c('0x1a')];}_0x2cdce7[_0xb73c('0xe')](_0x12b198)['send'](_0x3d5461);};}exports[_0xb73c('0x1b')]=function(_0x1def8c,_0x594744){var _0x122800={};var _0x392a46=_[_0xb73c('0x1c')](db['OpenchannelInteraction'][_0xb73c('0x1d')],function(_0x412fd9){return{'name':_0x412fd9['fieldName'],'type':_0x412fd9[_0xb73c('0x1e')][_0xb73c('0x1f')]};});_0x122800=qs[_0xb73c('0x20')](_0x392a46,_0x1def8c);return interaction[_0xb73c('0x21')]('openchannel',_0x1def8c[_0xb73c('0x22')],_0x1def8c[_0xb73c('0x23')],_0x122800,_0x392a46)[_0xb73c('0x17')](respondWithFilteredResult(_0x594744,_0x122800))['catch'](handleError(_0x594744,null));};exports[_0xb73c('0x24')]=function(_0x5efbe9,_0x12d70a){var _0x46ee7f={};if(_0x5efbe9[_0xb73c('0x22')][_0xb73c('0x1e')]&&_0x5efbe9[_0xb73c('0x22')][_0xb73c('0x1e')]===_0xb73c('0x25')){_0x46ee7f[_0xb73c('0x25')]=_0x5efbe9[_0xb73c('0x26')]['id'];}else{_0x46ee7f['id']=_0x5efbe9[_0xb73c('0x26')]['id'];}var _0x348620={'raw':![],'where':_0x46ee7f},_0x36b0a8={};_0x36b0a8[_0xb73c('0x27')]=_[_0xb73c('0x28')](db['OpenchannelInteraction'][_0xb73c('0x1d')]);_0x36b0a8[_0xb73c('0x22')]=_[_0xb73c('0x28')](_0x5efbe9[_0xb73c('0x22')]);_0x36b0a8[_0xb73c('0x29')]=_['intersection'](_0x36b0a8['model'],_0x36b0a8['query']);_0x348620['attributes']=_[_0xb73c('0x2a')](_0x36b0a8[_0xb73c('0x27')],qs['fields'](_0x5efbe9[_0xb73c('0x22')][_0xb73c('0x2b')]));_0x348620[_0xb73c('0x2c')]=_0x348620[_0xb73c('0x2c')][_0xb73c('0x2d')]?_0x348620[_0xb73c('0x2c')]:_0x36b0a8[_0xb73c('0x27')];if(_0x5efbe9[_0xb73c('0x22')]['includeAll']){_0x348620['include']=[{'all':!![]}];}_0x348620=_[_0xb73c('0x2e')]({},_0x348620,_0x5efbe9[_0xb73c('0x2f')]);return db[_0xb73c('0x30')][_0xb73c('0x31')](_0x348620)[_0xb73c('0x17')](handleEntityNotFound(_0x12d70a,null))[_0xb73c('0x17')](respondWithResult(_0x12d70a,null))[_0xb73c('0x32')](handleError(_0x12d70a,null));};exports[_0xb73c('0x33')]=function(_0xa790cf,_0x57accd){return db['OpenchannelInteraction'][_0xb73c('0x33')](_0xa790cf[_0xb73c('0x34')],{})['then'](respondWithResult(_0x57accd,0xc9))[_0xb73c('0x32')](handleError(_0x57accd,null));};exports[_0xb73c('0x16')]=function(_0x3cdd09,_0x394da8){if(_0x3cdd09[_0xb73c('0x34')]['id']){delete _0x3cdd09[_0xb73c('0x34')]['id'];}return db[_0xb73c('0x30')][_0xb73c('0x31')]({'where':{'id':_0x3cdd09[_0xb73c('0x26')]['id']}})['then'](handleEntityNotFound(_0x394da8,null))[_0xb73c('0x17')](saveUpdates(_0x3cdd09[_0xb73c('0x34')],null))['then'](respondWithResult(_0x394da8,null))[_0xb73c('0x32')](handleError(_0x394da8,null));};exports['destroy']=function(_0x32df01,_0x2d7d27){return db[_0xb73c('0x30')]['find']({'where':{'id':_0x32df01['params']['id']}})[_0xb73c('0x17')](handleEntityNotFound(_0x2d7d27,null))[_0xb73c('0x17')](removeEntity(_0x2d7d27,null))[_0xb73c('0x32')](handleError(_0x2d7d27,null));};exports[_0xb73c('0x35')]=function(_0x34da68,_0x5a78e6){return db[_0xb73c('0x30')]['describe']()[_0xb73c('0x17')](respondWithResult(_0x5a78e6,null))[_0xb73c('0x32')](handleError(_0x5a78e6,null));};exports[_0xb73c('0x36')]=function(_0x431cc9,_0x2c52cc){return db['OpenchannelMessage'][_0xb73c('0x31')]({'where':{'id':_0x431cc9[_0xb73c('0x26')]['id']}})['then'](handleEntityNotFound(_0x2c52cc,null))[_0xb73c('0x17')](function(_0x2b7053){if(_0x2b7053){return _0x2b7053[_0xb73c('0x36')](_0x431cc9[_0xb73c('0x34')]['ids'],_[_0xb73c('0x37')](_0x431cc9['body'],[_0xb73c('0x38'),'id'])||{});}})[_0xb73c('0x17')](respondWithResult(_0x2c52cc,null))[_0xb73c('0x32')](handleError(_0x2c52cc,null));};exports[_0xb73c('0x39')]=function(_0x223a2e,_0x1bbf48){var _0x283ada={'raw':![],'where':{}};var _0x13c862={};var _0x1a48d0={'count':0x0,'rows':[]};return db[_0xb73c('0x30')][_0xb73c('0x3a')]({'where':{'id':_0x223a2e[_0xb73c('0x26')]['id']}})[_0xb73c('0x17')](handleEntityNotFound(_0x1bbf48,null))[_0xb73c('0x17')](function(_0x5d2c0b){if(_0x5d2c0b){_0x13c862['model']=_[_0xb73c('0x28')](db[_0xb73c('0x3b')][_0xb73c('0x1d')]);_0x13c862['query']=_[_0xb73c('0x28')](_0x223a2e['query']);_0x13c862[_0xb73c('0x29')]=_['intersection'](_0x13c862[_0xb73c('0x27')],_0x13c862[_0xb73c('0x22')]);_0x283ada[_0xb73c('0x2c')]=_[_0xb73c('0x2a')](_0x13c862[_0xb73c('0x27')],qs[_0xb73c('0x2b')](_0x223a2e[_0xb73c('0x22')][_0xb73c('0x2b')]));_0x283ada[_0xb73c('0x2c')]=_0x283ada['attributes']['length']?_0x283ada[_0xb73c('0x2c')]:_0x13c862['model'];if(!_0x223a2e['query'][_0xb73c('0x3c')](_0xb73c('0x3d'))){_0x283ada['limit']=qs[_0xb73c('0x13')](_0x223a2e[_0xb73c('0x22')]['limit']);_0x283ada['offset']=qs[_0xb73c('0x11')](_0x223a2e[_0xb73c('0x22')][_0xb73c('0x11')]);}_0x283ada[_0xb73c('0x3e')]=qs[_0xb73c('0x3f')](_0x223a2e['query']['sort']);_0x283ada[_0xb73c('0x40')]=qs['filters'](_[_0xb73c('0x41')](_0x223a2e['query'],_0x13c862[_0xb73c('0x29')]));_0x283ada['where'][_0xb73c('0x42')]=_0x5d2c0b['id'];if(_0x223a2e[_0xb73c('0x22')][_0xb73c('0x43')]){_0x283ada[_0xb73c('0x40')]=_[_0xb73c('0x2e')](_0x283ada[_0xb73c('0x40')],{'$or':_['map'](_0x283ada[_0xb73c('0x2c')],function(_0x4cf163){var _0x18bbeb={};_0x18bbeb[_0x4cf163]={'$like':'%'+_0x223a2e[_0xb73c('0x22')]['filter']+'%'};return _0x18bbeb;})});}if(_0x223a2e[_0xb73c('0x22')][_0xb73c('0x44')]){var _0x54ba9a=_0x223a2e[_0xb73c('0x22')][_0xb73c('0x44')][_0xb73c('0x45')](',');var _0x5c7171={};_0x5c7171[_0x54ba9a[0x0]]={'$gte':moment(_0x54ba9a[0x1])['format'](_0xb73c('0x46'))};_0x283ada[_0xb73c('0x40')]=_[_0xb73c('0x2e')](_0x283ada[_0xb73c('0x40')],_0x5c7171);}_0x283ada=_[_0xb73c('0x2e')]({},_0x283ada,_0x223a2e[_0xb73c('0x2f')]);return db[_0xb73c('0x3b')][_0xb73c('0x14')]({'where':_0x283ada['where']})[_0xb73c('0x17')](function(_0x9c585f){_0x1a48d0[_0xb73c('0x14')]=_0x9c585f;if(_0x223a2e['query'][_0xb73c('0x47')]){_0x283ada[_0xb73c('0x48')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xb73c('0x21')](_0x283ada);})['then'](function(_0x20e9e0){_0x1a48d0['rows']=_0x20e9e0;return _0x1a48d0;});}})[_0xb73c('0x17')](respondWithFilteredResult(_0x1bbf48,_0x283ada))[_0xb73c('0x32')](handleError(_0x1bbf48,null));};exports[_0xb73c('0x49')]=function(_0x14f077,_0x4ddbd6){return db['OpenchannelInteraction'][_0xb73c('0x31')]({'where':{'id':_0x14f077['params']['id']}})[_0xb73c('0x17')](handleEntityNotFound(_0x4ddbd6,null))[_0xb73c('0x17')](function(_0x92501e){if(_0x92501e){return _0x92501e[_0xb73c('0x4a')](_0x14f077['body']['ids'],_[_0xb73c('0x37')](_0x14f077[_0xb73c('0x34')],[_0xb73c('0x38'),'id'])||{})[_0xb73c('0x4b')](function(){return db[_0xb73c('0x4c')]['findAll']({'attributes':['id',_0xb73c('0x1a'),_0xb73c('0x4d')],'where':{'id':_0x14f077[_0xb73c('0x34')][_0xb73c('0x38')]}});})[_0xb73c('0x17')](function(_0x25068d){socket[_0xb73c('0x4e')](_0xb73c('0x4f'),{'id':Number(_0x14f077[_0xb73c('0x26')]['id']),'tags':_0x25068d||[]});return{'id':Number(_0x14f077[_0xb73c('0x26')]['id']),'tags':_0x25068d||[]};});}})[_0xb73c('0x17')](respondWithResult(_0x4ddbd6,null))[_0xb73c('0x32')](handleError(_0x4ddbd6,null));};exports['removeTags']=function(_0x257f07,_0x2a40b1){return db[_0xb73c('0x30')][_0xb73c('0x31')]({'where':{'id':_0x257f07[_0xb73c('0x26')]['id']}})[_0xb73c('0x17')](handleEntityNotFound(_0x2a40b1,null))['then'](function(_0xd7824e){if(_0xd7824e){return _0xd7824e['removeTags'](_0x257f07[_0xb73c('0x22')][_0xb73c('0x38')]);}})[_0xb73c('0x17')](respondWithStatusCode(_0x2a40b1,null))['catch'](handleError(_0x2a40b1,null));};exports[_0xb73c('0x50')]=function(_0x434a41,_0x383f22){var _0x12e2dc=moment()['unix']()[_0xb73c('0x51')]();var _0xa24da8=path['join'](config[_0xb73c('0x52')],'server','files','tmp');var _0x4b273c=path[_0xb73c('0x53')](config[_0xb73c('0x52')],_0xb73c('0x54'),_0xb73c('0x55'),'attachments');var _0x1392c2=path['join'](_0xa24da8,_0x12e2dc);var _0x58cbe1=util[_0xb73c('0x56')](_0xb73c('0x57'),_0x434a41['params']['id'],_0x12e2dc);var _0x655966=path[_0xb73c('0x53')](_0xa24da8,_0x58cbe1);var _0x37cfaf=[];_0x37cfaf[_0xb73c('0x58')]({'model':db['User'],'as':_0xb73c('0x59'),'attributes':['id',_0xb73c('0x5a')],'raw':!![]});_0x37cfaf['push']({'model':db[_0xb73c('0x5b')],'as':_0xb73c('0x5c'),'attributes':['id','firstName',_0xb73c('0x5d')],'raw':!![]});if(_0x434a41['query'][_0xb73c('0x5e')]){_0x37cfaf[_0xb73c('0x58')]({'model':db[_0xb73c('0x5f')],'as':'Attachment','raw':!![]});}var _0x55497d=[{'model':db[_0xb73c('0x3b')],'as':_0xb73c('0x60'),'attributes':['id',_0xb73c('0x34'),_0xb73c('0x61'),'direction',_0xb73c('0x62'),_0xb73c('0x63')],'include':_0x37cfaf}];_0x55497d[_0xb73c('0x58')]({'model':db['OpenchannelAccount'],'as':_0xb73c('0x64'),'attributes':['id','name']});_0x55497d['push']({'model':db['User'],'as':_0xb73c('0x65'),'attributes':['id',_0xb73c('0x5a')]});return db[_0xb73c('0x30')]['find']({'where':{'id':_0x434a41[_0xb73c('0x26')]['id']},'include':_0x55497d})[_0xb73c('0x17')](handleEntityNotFound(_0x383f22,null))[_0xb73c('0x17')](function(_0x4a06b9){if(_0x4a06b9){var _0x4c6f0b=_0x4a06b9['get']({'plain':!![]});fs[_0xb73c('0x66')](_0x1392c2);var _0x1a5604={'channel':_0xb73c('0x67'),'account':_0x4c6f0b['Account'][_0xb73c('0x1a')],'agent':_0x4c6f0b['Owner']?_0x4c6f0b[_0xb73c('0x65')][_0xb73c('0x5a')]:_0xb73c('0x68'),'createdAt':moment(_0x4c6f0b[_0xb73c('0x61')])[_0xb73c('0x56')](_0xb73c('0x46'))['toString'](),'closedAt':_0x4c6f0b['closed']?moment(_0x4c6f0b[_0xb73c('0x69')])['format'](_0xb73c('0x46'))[_0xb73c('0x51')]():'','disposition':_0x4c6f0b[_0xb73c('0x6a')],'visibility':_0x4c6f0b['threadId']?_0xb73c('0x6b'):_0xb73c('0x6c'),'messages':_(_0x4c6f0b['Messages'])[_0xb73c('0x43')]({'secret':![]})[_0xb73c('0x1c')](function(_0x55c9d0){if(_0x55c9d0[_0xb73c('0x5f')]){var _0x1d4f3e=path[_0xb73c('0x53')](_0x4b273c,_0x55c9d0[_0xb73c('0x5f')][_0xb73c('0x6d')]);if(fs['existsSync'](_0x1d4f3e)){fs['createReadStream'](_0x1d4f3e)[_0xb73c('0x6e')](fs[_0xb73c('0x6f')](path['join'](_0x1392c2,_0x55c9d0[_0xb73c('0x5f')]['basename'])));}}return{'date':moment(_0x55c9d0[_0xb73c('0x61')])[_0xb73c('0x56')](_0xb73c('0x46'))['toString'](),'sender':_0x55c9d0[_0xb73c('0x70')]===_0xb73c('0x71')?_0x55c9d0[_0xb73c('0x59')]?_0x55c9d0[_0xb73c('0x59')][_0xb73c('0x5a')]:_0xb73c('0x72'):_0x55c9d0['Contact'][_0xb73c('0x73')]+(_0x55c9d0[_0xb73c('0x5c')][_0xb73c('0x5d')]?'\x20'+_0x55c9d0[_0xb73c('0x5c')]['lastName']:''),'body':_0x55c9d0[_0xb73c('0x5f')]?_0x55c9d0[_0xb73c('0x5f')]['basename']:_0x55c9d0['body'],'direction':_0x55c9d0['direction']==='out'?'A':'C','secret':_0x55c9d0[_0xb73c('0x62')],'read':_0x55c9d0['read'],'attachment':_0x55c9d0['Attachment']};})[_0xb73c('0x74')]()};return ejs[_0xb73c('0x75')](path[_0xb73c('0x53')](config[_0xb73c('0x52')],_0xb73c('0x54'),_0xb73c('0x76'),_0xb73c('0x77')),{'interaction':_0x1a5604})[_0xb73c('0x17')](function(_0x152484){var _0xb74c45=path[_0xb73c('0x53')](_0x1392c2,_0xb73c('0x78')+_0x4c6f0b['id']+'-'+_0x12e2dc+_0xb73c('0x79'));var _0x1521b9={'path':_0xb74c45,'channel':_0xb73c('0x67'),'interactionId':_0x4c6f0b['id']};return pdf[_0xb73c('0x7a')](_0x152484,_0x1521b9);})['then'](function(){return new Promise(function(_0x4414f9,_0x1b3b73){zipdir(_0x1392c2,{'saveTo':_0x655966},function(_0x404e04,_0x14b0be){if(_0x404e04)return _0x1b3b73(_0x404e04);return _0x4414f9(_0x14b0be);});})['then'](function(){return new Promise(function(_0x21979b,_0x2199b8){rimraf(_0x1392c2,function(_0xb6a6b5){if(_0xb6a6b5)_0x2199b8(_0xb6a6b5);return _0x21979b();});});})['then'](function(){return _0x383f22[_0xb73c('0x50')](_0x655966,_0x58cbe1,function(_0x526f63){if(_0x526f63){logger[_0xb73c('0x18')](_0xb73c('0x7b'),_0x526f63);}else{fs[_0xb73c('0x7c')](_0x655966);}});});});}else{return _0x383f22[_0xb73c('0xd')](0xc8);}})['catch'](handleError(_0x383f22,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e50f9f8..86211ad 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 _0x94fa=['OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','map','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb'];(function(_0x5a7871,_0x411044){var _0xb0b405=function(_0x57c0ec){while(--_0x57c0ec){_0x5a7871['push'](_0x5a7871['shift']());}};_0xb0b405(++_0x411044);}(_0x94fa,0x148));var _0xa94f=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x94fa[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0xa94f('0x0'));var OpenchannelInteraction=require(_0xa94f('0x1'))['db'][_0xa94f('0x2')];var OpenchannelMessage=require(_0xa94f('0x1'))['db'][_0xa94f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa94f('0x4'),'afterUpdate':_0xa94f('0x5'),'afterDestroy':_0xa94f('0x6')};function emitEvent(_0x2da3bf){return function(_0x342c4f,_0x5a3756,_0x344627){_0x342c4f[_0xa94f('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25cea2){_0x342c4f['setDataValue']('Users',_0x25cea2[_0xa94f('0x8')](function(_0x12a8e5){return{'id':_0x12a8e5['id']};}));return OpenchannelMessage[_0xa94f('0x9')]({'where':{'OpenchannelInteractionId':_0x342c4f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x45711c){_0x342c4f['setDataValue'](_0xa94f('0xa'),_0x45711c[_0xa94f('0xb')]);OpenchannelInteractionEvents['emit'](_0x2da3bf+':'+_0x342c4f['id'],_0x342c4f);OpenchannelInteractionEvents[_0xa94f('0xc')](_0x2da3bf,_0x342c4f);_0x344627(null);})['catch'](_0x344627(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xa94f('0xd')](e,emitEvent(event));}}module[_0xa94f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4e02=['map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x4e02,0x1a7));var _0x24e0=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x4e02[_0x412e27];return _0x53da42;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x24e0('0x0')];var OpenchannelMessage=require(_0x24e0('0x1'))['db'][_0x24e0('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x24e0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x24e0('0x4'),'afterDestroy':_0x24e0('0x5')};function emitEvent(_0x404fa4){return function(_0x56e211,_0x1c5ad2,_0x595820){_0x56e211[_0x24e0('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5d75e1){_0x56e211[_0x24e0('0x7')](_0x24e0('0x8'),_0x5d75e1[_0x24e0('0x9')](function(_0x1b27bd){return{'id':_0x1b27bd['id']};}));return OpenchannelMessage[_0x24e0('0xa')]({'where':{'OpenchannelInteractionId':_0x56e211['id'],'direction':'in','read':![]},'raw':!![]});})[_0x24e0('0xb')](function(_0x28cda3){_0x56e211[_0x24e0('0x7')]('unreadMessages',_0x28cda3[_0x24e0('0xc')]);OpenchannelInteractionEvents[_0x24e0('0xd')](_0x404fa4+':'+_0x56e211['id'],_0x56e211);OpenchannelInteractionEvents['emit'](_0x404fa4,_0x56e211);_0x595820(null);})[_0x24e0('0xe')](_0x595820(null));};}for(var e in events){if(events[_0x24e0('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x24e0('0x10')](e,emitEvent(event));}}module[_0x24e0('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 5cc70da..b290ad6 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 _0x66ab=['./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4c1c5f,_0x45cc6f){var _0x1e2986=function(_0xd2d69d){while(--_0xd2d69d){_0x4c1c5f['push'](_0x4c1c5f['shift']());}};_0x1e2986(++_0x45cc6f);}(_0x66ab,0x128));var _0xb66a=function(_0x1a349d,_0x4fb310){_0x1a349d=_0x1a349d-0x0;var _0x2445dd=_0x66ab[_0x1a349d];return _0x2445dd;};'use strict';var _=require(_0xb66a('0x0'));var util=require(_0xb66a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb66a('0x2'));var BPromise=require(_0xb66a('0x3'));var rp=require(_0xb66a('0x4'));var fs=require('fs');var path=require(_0xb66a('0x5'));var rimraf=require(_0xb66a('0x6'));var config=require(_0xb66a('0x7'));var attributes=require(_0xb66a('0x8'));module[_0xb66a('0x9')]=function(_0x515fad,_0x3c1712){return _0x515fad[_0xb66a('0xa')](_0xb66a('0xb'),attributes,{'tableName':_0xb66a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb66a('0xd'),'collate':_0xb66a('0xe'),'hooks':{'beforeUpdate':function(_0x4e200b,_0x167a1e,_0x3b646e){if(_0x4e200b['changed']('closed')){_0x4e200b[_0xb66a('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3b646e(null,_0x4e200b);}}});}; \ No newline at end of file +var _0xf2f7=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x1b6629,_0x4ae9cd){var _0x50cfba=function(_0x453014){while(--_0x453014){_0x1b6629['push'](_0x1b6629['shift']());}};_0x50cfba(++_0x4ae9cd);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x1fe79b,_0x3d510e){_0x1fe79b=_0x1fe79b-0x0;var _0x393861=_0xf2f7[_0x1fe79b];return _0x393861;};'use strict';var _=require(_0x7f2f('0x0'));var util=require('util');var logger=require(_0x7f2f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7f2f('0x2'));var rp=require(_0x7f2f('0x3'));var fs=require('fs');var path=require(_0x7f2f('0x4'));var rimraf=require(_0x7f2f('0x5'));var config=require(_0x7f2f('0x6'));var attributes=require(_0x7f2f('0x7'));module['exports']=function(_0x4b788c,_0x30c93c){return _0x4b788c[_0x7f2f('0x8')](_0x7f2f('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f2f('0xa'),'collate':_0x7f2f('0xb'),'hooks':{'beforeUpdate':function(_0x3cad14,_0x201483,_0x57aa99){if(_0x3cad14[_0x7f2f('0xc')]('closed')){_0x3cad14[_0x7f2f('0xd')]=moment()[_0x7f2f('0xe')](_0x7f2f('0xf'));}_0x57aa99(null,_0x3cad14);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e82c697..ea3624a 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 _0x445c=['rpc','http','redis','localhost','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','limit','then','stringify','catch','AddTagsToOpenchannelInteraction','where','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x445c,0xb5));var _0xc445=function(_0x1e54ed,_0x5e3116){_0x1e54ed=_0x1e54ed-0x0;var _0x917baa=_0x445c[_0x1e54ed];return _0x917baa;};'use strict';var _=require(_0xc445('0x0'));var util=require(_0xc445('0x1'));var moment=require(_0xc445('0x2'));var BPromise=require(_0xc445('0x3'));var rs=require(_0xc445('0x4'));var fs=require('fs');var Redis=require(_0xc445('0x5'));var db=require(_0xc445('0x6'))['db'];var utils=require(_0xc445('0x7'));var logger=require(_0xc445('0x8'))(_0xc445('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc445('0xa')]({'port':0x232a});config[_0xc445('0xb')]=_['defaults'](config[_0xc445('0xb')],{'host':_0xc445('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc445('0xd'))['register'](socket);function respondWithRpcPromise(_0x236ef2,_0x540b64,_0x5291ae){return new BPromise(function(_0x446df7,_0xcf5af){return client[_0xc445('0xe')](_0x236ef2,_0x5291ae)['then'](function(_0x545136){logger[_0xc445('0xf')](_0xc445('0x10'),_0x540b64,'request\x20sent');logger[_0xc445('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x540b64,_0xc445('0x12'),JSON['stringify'](_0x545136));if(_0x545136['error']){if(_0x545136[_0xc445('0x13')][_0xc445('0x14')]===0x1f4){logger[_0xc445('0x13')](_0xc445('0x10'),_0x540b64,_0x545136[_0xc445('0x13')]['message']);return _0xcf5af(_0x545136[_0xc445('0x13')][_0xc445('0x15')]);}logger['error'](_0xc445('0x10'),_0x540b64,_0x545136[_0xc445('0x13')][_0xc445('0x15')]);return _0x446df7(_0x545136[_0xc445('0x13')]['message']);}else{logger['info'](_0xc445('0x10'),_0x540b64,'request\x20sent');_0x446df7(_0x545136['result'][_0xc445('0x15')]);}})['catch'](function(_0x593920){logger[_0xc445('0x13')](_0xc445('0x10'),_0x540b64,_0x593920);_0xcf5af(_0x593920);});});}exports[_0xc445('0x16')]=function(_0x38defb){var _0x1d45a5=this;return new Promise(function(_0x257dc3,_0x22b25b){return db[_0xc445('0x17')][_0xc445('0x18')](_0x38defb['body'],{'raw':_0x38defb[_0xc445('0x19')]?_0x38defb['options'][_0xc445('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38defb['options']?_0x38defb[_0xc445('0x19')]['where']||null:null,'attributes':_0x38defb[_0xc445('0x19')]?_0x38defb[_0xc445('0x19')]['attributes']||null:null,'limit':_0x38defb[_0xc445('0x19')]?_0x38defb['options'][_0xc445('0x1b')]||null:null})[_0xc445('0x1c')](function(_0x222f68){logger[_0xc445('0xf')](_0xc445('0x16'),_0x38defb);logger['debug'](_0xc445('0x16'),_0x38defb,JSON[_0xc445('0x1d')](_0x222f68));_0x257dc3(_0x222f68);})[_0xc445('0x1e')](function(_0x5b470d){logger[_0xc445('0x13')]('UpdateOpenchannelInteraction',_0x5b470d['message'],_0x38defb);_0x22b25b(_0x1d45a5[_0xc445('0x13')](0x1f4,_0x5b470d['message']));});});};exports[_0xc445('0x1f')]=function(_0x5f53e4){return new Promise(function(_0x3d1063,_0x3de376){return db[_0xc445('0x17')]['find']({'where':_0x5f53e4[_0xc445('0x19')]?_0x5f53e4['options'][_0xc445('0x20')]||null:null})[_0xc445('0x1c')](function(_0x47998f){if(_0x47998f){return _0x47998f[_0xc445('0x21')](_0x5f53e4['body'][_0xc445('0x22')],_[_0xc445('0x23')](_0x5f53e4[_0xc445('0x24')],[_0xc445('0x22'),'id'])||{});}})['spread'](function(_0xea204){logger[_0xc445('0xf')]('AddTags',_0x5f53e4);logger['debug'](_0xc445('0x25'),_0x5f53e4,JSON[_0xc445('0x1d')](_0xea204));_0x3d1063(_0xea204);})[_0xc445('0x1e')](function(_0x55c934){logger[_0xc445('0x13')](_0xc445('0x25'),_0x55c934[_0xc445('0x15')],_0x5f53e4);_0x3de376(_this[_0xc445('0x13')](0x1f4,_0x55c934['message']));});});}; \ No newline at end of file +var _0x776a=['AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit'];(function(_0x40b74c,_0x205361){var _0x19facb=function(_0x23d10a){while(--_0x23d10a){_0x40b74c['push'](_0x40b74c['shift']());}};_0x19facb(++_0x205361);}(_0x776a,0x1df));var _0xa776=function(_0x152503,_0x3bfb12){_0x152503=_0x152503-0x0;var _0x71197=_0x776a[_0x152503];return _0x71197;};'use strict';var _=require(_0xa776('0x0'));var util=require(_0xa776('0x1'));var moment=require(_0xa776('0x2'));var BPromise=require(_0xa776('0x3'));var rs=require(_0xa776('0x4'));var fs=require('fs');var Redis=require(_0xa776('0x5'));var db=require(_0xa776('0x6'))['db'];var utils=require(_0xa776('0x7'));var logger=require(_0xa776('0x8'))('rpc');var config=require(_0xa776('0x9'));var jayson=require(_0xa776('0xa'));var client=jayson[_0xa776('0xb')]['http']({'port':0x232a});config[_0xa776('0xc')]=_[_0xa776('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa776('0xe'))(new Redis(config[_0xa776('0xc')]));require(_0xa776('0xf'))[_0xa776('0x10')](socket);function respondWithRpcPromise(_0x374465,_0x3bf655,_0x5116fc){return new BPromise(function(_0x1ff521,_0x3a912f){return client[_0xa776('0x11')](_0x374465,_0x5116fc)[_0xa776('0x12')](function(_0x2c8d8b){logger[_0xa776('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3bf655,'request\x20sent');logger[_0xa776('0x14')](_0xa776('0x15'),_0x3bf655,_0xa776('0x16'),JSON[_0xa776('0x17')](_0x2c8d8b));if(_0x2c8d8b[_0xa776('0x18')]){if(_0x2c8d8b[_0xa776('0x18')][_0xa776('0x19')]===0x1f4){logger['error'](_0xa776('0x1a'),_0x3bf655,_0x2c8d8b[_0xa776('0x18')][_0xa776('0x1b')]);return _0x3a912f(_0x2c8d8b[_0xa776('0x18')][_0xa776('0x1b')]);}logger[_0xa776('0x18')](_0xa776('0x1a'),_0x3bf655,_0x2c8d8b[_0xa776('0x18')][_0xa776('0x1b')]);return _0x1ff521(_0x2c8d8b['error'][_0xa776('0x1b')]);}else{logger[_0xa776('0x13')](_0xa776('0x1a'),_0x3bf655,_0xa776('0x16'));_0x1ff521(_0x2c8d8b['result'][_0xa776('0x1b')]);}})[_0xa776('0x1c')](function(_0x14d5d4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3bf655,_0x14d5d4);_0x3a912f(_0x14d5d4);});});}exports[_0xa776('0x1d')]=function(_0x5ecd59){var _0x23e2ba=this;return new Promise(function(_0x1d74c1,_0x282fe1){return db[_0xa776('0x1e')][_0xa776('0x1f')](_0x5ecd59[_0xa776('0x20')],{'raw':_0x5ecd59[_0xa776('0x21')]?_0x5ecd59[_0xa776('0x21')][_0xa776('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ecd59[_0xa776('0x21')]?_0x5ecd59[_0xa776('0x21')][_0xa776('0x23')]||null:null,'attributes':_0x5ecd59[_0xa776('0x21')]?_0x5ecd59[_0xa776('0x21')]['attributes']||null:null,'limit':_0x5ecd59[_0xa776('0x21')]?_0x5ecd59[_0xa776('0x21')][_0xa776('0x24')]||null:null})[_0xa776('0x12')](function(_0x555907){logger['info'](_0xa776('0x1d'),_0x5ecd59);logger[_0xa776('0x14')](_0xa776('0x1d'),_0x5ecd59,JSON['stringify'](_0x555907));_0x1d74c1(_0x555907);})['catch'](function(_0x172b93){logger['error'](_0xa776('0x1d'),_0x172b93[_0xa776('0x1b')],_0x5ecd59);_0x282fe1(_0x23e2ba[_0xa776('0x18')](0x1f4,_0x172b93['message']));});});};exports[_0xa776('0x25')]=function(_0x26b6ab){return new Promise(function(_0x566d08,_0x7eb9fb){return db[_0xa776('0x1e')][_0xa776('0x26')]({'where':_0x26b6ab[_0xa776('0x21')]?_0x26b6ab[_0xa776('0x21')][_0xa776('0x23')]||null:null})['then'](function(_0x248e6e){if(_0x248e6e){return _0x248e6e[_0xa776('0x27')](_0x26b6ab[_0xa776('0x20')][_0xa776('0x28')],_['omit'](_0x26b6ab[_0xa776('0x20')],['ids','id'])||{});}})[_0xa776('0x29')](function(_0x3db695){logger[_0xa776('0x13')](_0xa776('0x2a'),_0x26b6ab);logger[_0xa776('0x14')](_0xa776('0x2a'),_0x26b6ab,JSON[_0xa776('0x17')](_0x3db695));_0x566d08(_0x3db695);})[_0xa776('0x1c')](function(_0x12a637){logger[_0xa776('0x18')](_0xa776('0x2a'),_0x12a637[_0xa776('0x1b')],_0x26b6ab);_0x7eb9fb(_this[_0xa776('0x18')](0x1f4,_0x12a637[_0xa776('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3770e90..a36c060 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 _0x8ede=['update','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8ede,0x17d));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelInteractionEvents=require(_0xe8ed('0x0'));var events=[_0xe8ed('0x1'),_0xe8ed('0x2'),_0xe8ed('0x3')];function createListener(_0x2ce4b0,_0x2b85cd){return function(_0x336da3){_0x2b85cd[_0xe8ed('0x4')](_0x2ce4b0,_0x336da3);};}function removeListener(_0x1ae7fd,_0x3ade32){return function(){OpenchannelInteractionEvents[_0xe8ed('0x5')](_0x1ae7fd,_0x3ade32);};}exports[_0xe8ed('0x6')]=function(_0x3fee99){for(var _0x452c68=0x0,_0x2d4e5b=events['length'];_0x452c68<_0x2d4e5b;_0x452c68++){var _0x360ab1=events[_0x452c68];var _0x193b28=createListener(_0xe8ed('0x7')+_0x360ab1,_0x3fee99);OpenchannelInteractionEvents['on'](_0x360ab1,_0x193b28);}}; \ No newline at end of file +var _0x9de8=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9de8,0x6a));var _0x89de=function(_0x9a7b67,_0x293818){_0x9a7b67=_0x9a7b67-0x0;var _0x38f122=_0x9de8[_0x9a7b67];return _0x38f122;};'use strict';var OpenchannelInteractionEvents=require(_0x89de('0x0'));var events=[_0x89de('0x1'),_0x89de('0x2'),_0x89de('0x3')];function createListener(_0x1aa212,_0x31614c){return function(_0x2d03bd){_0x31614c[_0x89de('0x4')](_0x1aa212,_0x2d03bd);};}function removeListener(_0x393fd2,_0xe15351){return function(){OpenchannelInteractionEvents[_0x89de('0x5')](_0x393fd2,_0xe15351);};}exports[_0x89de('0x6')]=function(_0x47d3f1){for(var _0x4b03a9=0x0,_0x39b049=events[_0x89de('0x7')];_0x4b03a9<_0x39b049;_0x4b03a9++){var _0x4b9ba9=events[_0x4b03a9];var _0x4956b3=createListener(_0x89de('0x8')+_0x4b9ba9,_0x47d3f1);OpenchannelInteractionEvents['on'](_0x4b9ba9,_0x4956b3);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e9b8c8d..f515bff 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 _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(_0x40b54f,_0x6a7bb0){_0x40b54f=_0x40b54f-0x0;var _0x1d34a2=_0x70e0[_0x40b54f];return _0x1d34a2;};'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 +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x3a7670,_0x17fe59){var _0x19c3a5=function(_0x52e7b8){while(--_0x52e7b8){_0x3a7670['push'](_0x3a7670['shift']());}};_0x19c3a5(++_0x17fe59);}(_0xe706,0xa3));var _0x6e70=function(_0xe70f6c,_0x3b734d){_0xe70f6c=_0xe70f6c-0x0;var _0x29d959=_0xe706[_0xe70f6c];return _0x29d959;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 96de4a4..1093a62 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 _0x4c71=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2df8a5,_0x4927b1){var _0x4d4525=function(_0x9ee3bf){while(--_0x9ee3bf){_0x2df8a5['push'](_0x2df8a5['shift']());}};_0x4d4525(++_0x4927b1);}(_0x4c71,0x12b));var _0x14c7=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4c71[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x14c7('0x0'));module[_0x14c7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x14c7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x14c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x14c7('0x4')]('in',_0x14c7('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x14c7('0x6')]},'providerName':{'type':Sequelize[_0x14c7('0x7')]},'providerResponse':{'type':Sequelize[_0x14c7('0x8')]}}; \ No newline at end of file +var _0xc692=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x519140,_0x762c1e){var _0x2b9d3b=function(_0xfed490){while(--_0xfed490){_0x519140['push'](_0x519140['shift']());}};_0x2b9d3b(++_0x762c1e);}(_0xc692,0x15f));var _0x2c69=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xc692[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'body':{'type':Sequelize[_0x2c69('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2c69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c69('0x4')]('in',_0x2c69('0x5')),'defaultValue':_0x2c69('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2c69('0x6')]},'providerName':{'type':Sequelize[_0x2c69('0x7')]},'providerResponse':{'type':Sequelize[_0x2c69('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e2d0c97..b68c460 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 _0xd663=['then','info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','end','stack','name','send','index','OpenchannelMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include','find','create','body','destroy','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','contact','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http'];(function(_0x5ecee0,_0x1729dd){var _0x1f770f=function(_0x439b2f){while(--_0x439b2f){_0x5ecee0['push'](_0x5ecee0['shift']());}};_0x1f770f(++_0x1729dd);}(_0xd663,0xf0));var _0x3d66=function(_0x2e3200,_0x5506c3){_0x2e3200=_0x2e3200-0x0;var _0xa4cc1f=_0xd663[_0x2e3200];return _0xa4cc1f;};'use strict';var emlformat=require(_0x3d66('0x0'));var rimraf=require(_0x3d66('0x1'));var zipdir=require(_0x3d66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d66('0x3'));var moment=require(_0x3d66('0x4'));var BPromise=require(_0x3d66('0x5'));var Mustache=require('mustache');var util=require(_0x3d66('0x6'));var path=require(_0x3d66('0x7'));var sox=require(_0x3d66('0x8'));var csv=require('to-csv');var ejs=require(_0x3d66('0x9'));var fs=require('fs');var fs_extra=require(_0x3d66('0xa'));var _=require(_0x3d66('0xb'));var squel=require(_0x3d66('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d66('0xd'));var deskjs=require(_0x3d66('0xe'));var toCsv=require(_0x3d66('0xf'));var querystring=require(_0x3d66('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d66('0x11'));var authService=require(_0x3d66('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x13'));var hardwareService=require(_0x3d66('0x14'));var logger=require(_0x3d66('0x15'))(_0x3d66('0x16'));var utils=require(_0x3d66('0x17'));var config=require(_0x3d66('0x18'));var licenseUtil=require(_0x3d66('0x19'));var db=require(_0x3d66('0x1a'))['db'];config['redis']=_[_0x3d66('0x1b')](config[_0x3d66('0x1c')],{'host':_0x3d66('0x1d'),'port':0x18eb});var socket=require(_0x3d66('0x1e'))(new Redis(config[_0x3d66('0x1c')]));require(_0x3d66('0x1f'))[_0x3d66('0x20')](socket);var jayson=require(_0x3d66('0x21'));var client=jayson[_0x3d66('0x22')][_0x3d66('0x23')]({'port':0x232c});var client9002=jayson[_0x3d66('0x22')][_0x3d66('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2194d8,_0x5b2396,_0x2a16b8,_0x272ca5){return new BPromise(function(_0x166b15,_0x1e66e3){var _0x47d8eb=_0x272ca5||client;return _0x47d8eb['request'](_0x2194d8,_0x2a16b8)[_0x3d66('0x24')](function(_0x350528){logger[_0x3d66('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b2396,'request\x20sent');logger['debug'](_0x3d66('0x26'),_0x5b2396,_0x3d66('0x27'),JSON['stringify'](_0x350528));if(_0x350528[_0x3d66('0x28')]){if(_0x350528[_0x3d66('0x28')][_0x3d66('0x29')]===0x1f4){logger[_0x3d66('0x28')](_0x3d66('0x2a'),_0x5b2396,_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);return _0x1e66e3(_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);}logger[_0x3d66('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x5b2396,_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);return _0x166b15(_0x350528[_0x3d66('0x28')][_0x3d66('0x2b')]);}else{logger[_0x3d66('0x25')](_0x3d66('0x2a'),_0x5b2396,_0x3d66('0x27'));_0x166b15(_0x350528['result']['message']);}})[_0x3d66('0x2c')](function(_0x4ad0cd){logger[_0x3d66('0x28')](_0x3d66('0x2a'),_0x5b2396,_0x4ad0cd);_0x1e66e3(_0x4ad0cd);});});}function respondWithStatusCode(_0x480b3f,_0x449dfe){_0x449dfe=_0x449dfe||0xcc;return function(_0x45ccd8){if(_0x45ccd8){return _0x480b3f[_0x3d66('0x2d')](_0x449dfe);}return _0x480b3f[_0x3d66('0x2e')](_0x449dfe)['end']();};}function respondWithResult(_0x1a8eff,_0x57993f){_0x57993f=_0x57993f||0xc8;return function(_0x37e3bb){if(_0x37e3bb){return _0x1a8eff[_0x3d66('0x2e')](_0x57993f)[_0x3d66('0x2f')](_0x37e3bb);}};}function respondWithFilteredResult(_0x49759c,_0x3d350a){return function(_0x4b67a1){if(_0x4b67a1){var _0x218179=typeof _0x3d350a['offset']===_0x3d66('0x30')&&typeof _0x3d350a[_0x3d66('0x31')]===_0x3d66('0x30');var _0x3dea23=_0x4b67a1['count'];var _0x1b6d73=_0x218179?0x0:_0x3d350a['offset'];var _0x1e389a=_0x218179?_0x4b67a1['count']:_0x3d350a[_0x3d66('0x32')]+_0x3d350a['limit'];var _0x36af84;if(_0x1e389a>=_0x3dea23){_0x1e389a=_0x3dea23;_0x36af84=0xc8;}else{_0x36af84=0xce;}_0x49759c[_0x3d66('0x2e')](_0x36af84);return _0x49759c[_0x3d66('0x33')](_0x3d66('0x34'),_0x1b6d73+'-'+_0x1e389a+'/'+_0x3dea23)['json'](_0x4b67a1);}return null;};}function patchUpdates(_0xe394bb){return function(_0x462942){try{jsonpatch[_0x3d66('0x35')](_0x462942,_0xe394bb,!![]);}catch(_0x1a6f31){return BPromise[_0x3d66('0x36')](_0x1a6f31);}return _0x462942[_0x3d66('0x37')]();};}function saveUpdates(_0x3489d1,_0x10494d){return function(_0x1ce90c){if(_0x1ce90c){return _0x1ce90c['update'](_0x3489d1)['then'](function(_0x4306df){return _0x4306df;});}return null;};}function removeEntity(_0x23fc80,_0x338374){return function(_0x5b700b){if(_0x5b700b){return _0x5b700b['destroy']()[_0x3d66('0x24')](function(){_0x23fc80['status'](0xcc)[_0x3d66('0x38')]();});}};}function handleEntityNotFound(_0x17aa59,_0x29a83b){return function(_0x4a8a50){if(!_0x4a8a50){_0x17aa59[_0x3d66('0x2d')](0x194);}return _0x4a8a50;};}function handleError(_0x198e7b,_0x373e66){_0x373e66=_0x373e66||0x1f4;return function(_0x4d1db5){logger['error'](_0x4d1db5[_0x3d66('0x39')]);if(_0x4d1db5[_0x3d66('0x3a')]){delete _0x4d1db5[_0x3d66('0x3a')];}_0x198e7b['status'](_0x373e66)[_0x3d66('0x3b')](_0x4d1db5);};}exports[_0x3d66('0x3c')]=function(_0x457f3f,_0x19e874){var _0x2bdf3d={},_0x5f4122={},_0x5bca03={'count':0x0,'rows':[]};var _0x3587e3=_['map'](db[_0x3d66('0x3d')][_0x3d66('0x3e')],function(_0x156465){return{'name':_0x156465['fieldName'],'type':_0x156465[_0x3d66('0x3f')][_0x3d66('0x40')]};});_0x5f4122[_0x3d66('0x41')]=_[_0x3d66('0x42')](_0x3587e3,'name');_0x5f4122[_0x3d66('0x43')]=_[_0x3d66('0x44')](_0x457f3f['query']);_0x5f4122[_0x3d66('0x45')]=_[_0x3d66('0x46')](_0x5f4122[_0x3d66('0x41')],_0x5f4122[_0x3d66('0x43')]);_0x2bdf3d[_0x3d66('0x47')]=_[_0x3d66('0x46')](_0x5f4122[_0x3d66('0x41')],qs[_0x3d66('0x48')](_0x457f3f[_0x3d66('0x43')][_0x3d66('0x48')]));_0x2bdf3d[_0x3d66('0x47')]=_0x2bdf3d[_0x3d66('0x47')][_0x3d66('0x49')]?_0x2bdf3d[_0x3d66('0x47')]:_0x5f4122[_0x3d66('0x41')];if(!_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4a')](_0x3d66('0x4b'))){_0x2bdf3d[_0x3d66('0x31')]=qs[_0x3d66('0x31')](_0x457f3f['query'][_0x3d66('0x31')]);_0x2bdf3d['offset']=qs[_0x3d66('0x32')](_0x457f3f['query'][_0x3d66('0x32')]);}_0x2bdf3d['order']=qs[_0x3d66('0x4c')](_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4c')]);_0x2bdf3d['where']=qs['filters'](_[_0x3d66('0x4d')](_0x457f3f[_0x3d66('0x43')],_0x5f4122[_0x3d66('0x45')]),_0x3587e3);if(_0x457f3f[_0x3d66('0x43')][_0x3d66('0x4e')]){_0x2bdf3d['where']=_[_0x3d66('0x4f')](_0x2bdf3d[_0x3d66('0x50')],{'$or':_[_0x3d66('0x42')](_0x3587e3,function(_0x14b104){if(_0x14b104['type']!==_0x3d66('0x51')){var _0x448436={};_0x448436[_0x14b104[_0x3d66('0x3a')]]={'$like':'%'+_0x457f3f[_0x3d66('0x43')]['filter']+'%'};return _0x448436;}})});}_0x2bdf3d=_['merge']({},_0x2bdf3d,_0x457f3f[_0x3d66('0x52')]);var _0x3aa3a1={'where':_0x2bdf3d[_0x3d66('0x50')]};return db[_0x3d66('0x3d')]['count'](_0x3aa3a1)[_0x3d66('0x24')](function(_0x26b490){_0x5bca03[_0x3d66('0x53')]=_0x26b490;if(_0x457f3f[_0x3d66('0x43')][_0x3d66('0x54')]){_0x2bdf3d['include']=[{'all':!![]}];}return db[_0x3d66('0x3d')][_0x3d66('0x55')](_0x2bdf3d);})[_0x3d66('0x24')](function(_0x2a0d91){_0x5bca03[_0x3d66('0x56')]=_0x2a0d91;return _0x5bca03;})[_0x3d66('0x24')](respondWithFilteredResult(_0x19e874,_0x2bdf3d))[_0x3d66('0x2c')](handleError(_0x19e874,null));};exports[_0x3d66('0x57')]=function(_0x24c954,_0x196597){var _0x48c712={'raw':!![],'where':{'id':_0x24c954[_0x3d66('0x58')]['id']}},_0x549f59={};_0x549f59[_0x3d66('0x41')]=_[_0x3d66('0x44')](db['OpenchannelMessage'][_0x3d66('0x3e')]);_0x549f59['query']=_[_0x3d66('0x44')](_0x24c954[_0x3d66('0x43')]);_0x549f59[_0x3d66('0x45')]=_[_0x3d66('0x46')](_0x549f59[_0x3d66('0x41')],_0x549f59[_0x3d66('0x43')]);_0x48c712['attributes']=_['intersection'](_0x549f59[_0x3d66('0x41')],qs[_0x3d66('0x48')](_0x24c954[_0x3d66('0x43')][_0x3d66('0x48')]));_0x48c712[_0x3d66('0x47')]=_0x48c712[_0x3d66('0x47')][_0x3d66('0x49')]?_0x48c712[_0x3d66('0x47')]:_0x549f59[_0x3d66('0x41')];if(_0x24c954[_0x3d66('0x43')][_0x3d66('0x54')]){_0x48c712[_0x3d66('0x59')]=[{'all':!![]}];}_0x48c712=_[_0x3d66('0x4f')]({},_0x48c712,_0x24c954[_0x3d66('0x52')]);return db[_0x3d66('0x3d')][_0x3d66('0x5a')](_0x48c712)[_0x3d66('0x24')](handleEntityNotFound(_0x196597,null))[_0x3d66('0x24')](respondWithResult(_0x196597,null))['catch'](handleError(_0x196597,null));};exports[_0x3d66('0x5b')]=function(_0x53c347,_0x39c42e){return db[_0x3d66('0x3d')]['create'](_0x53c347['body'],{})[_0x3d66('0x24')](respondWithResult(_0x39c42e,0xc9))['catch'](handleError(_0x39c42e,null));};exports['update']=function(_0x56f458,_0x5c4384){if(_0x56f458['body']['id']){delete _0x56f458[_0x3d66('0x5c')]['id'];}return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x56f458[_0x3d66('0x58')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x5c4384,null))[_0x3d66('0x24')](saveUpdates(_0x56f458['body'],null))[_0x3d66('0x24')](respondWithResult(_0x5c4384,null))[_0x3d66('0x2c')](handleError(_0x5c4384,null));};exports[_0x3d66('0x5d')]=function(_0x5f0d88,_0x5e685c){return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x5f0d88[_0x3d66('0x58')]['id']}})[_0x3d66('0x24')](handleEntityNotFound(_0x5e685c,null))[_0x3d66('0x24')](removeEntity(_0x5e685c,null))[_0x3d66('0x2c')](handleError(_0x5e685c,null));};exports[_0x3d66('0x5e')]=function(_0x183b82,_0x1aa55c){return db[_0x3d66('0x3d')][_0x3d66('0x5e')]()[_0x3d66('0x24')](respondWithResult(_0x1aa55c,null))[_0x3d66('0x2c')](handleError(_0x1aa55c,null));};var interaction_log=require(_0x3d66('0x15'))('openchannel-interactions');exports[_0x3d66('0x5f')]=function(_0x2835a6,_0x55404b,_0x523d49){var _0x1c37e0={'agent':{},'channel':_0x3d66('0x60')};if(_0x2835a6['body']['id']){delete _0x2835a6[_0x3d66('0x5c')]['id'];}_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x61')]=!![];_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x62')]=moment()[_0x3d66('0x63')](_0x3d66('0x64'));_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')]=_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')]||_0x2835a6[_0x3d66('0x66')]['id'];_0x1c37e0[_0x3d66('0x67')]['id']=_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')];return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x2835a6['params']['id'],'UserId':null}})[_0x3d66('0x24')](handleEntityNotFound(_0x55404b,null))[_0x3d66('0x24')](saveUpdates(_0x2835a6[_0x3d66('0x5c')],null))[_0x3d66('0x24')](function(_0xd554c4){if(_0xd554c4){_0x1c37e0['message']=_0xd554c4[_0x3d66('0x68')]({'plain':!![]});return db[_0x3d66('0x69')][_0x3d66('0x5a')]({'where':{'id':_0xd554c4[_0x3d66('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x55404b,null))[_0x3d66('0x24')](function(_0xad48e1){if(_0xad48e1){return _0xad48e1[_0x3d66('0x6b')]({'UserId':_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')],'read1stAt':_[_0x3d66('0x6c')](_0xad48e1[_0x3d66('0x6d')])?moment()[_0x3d66('0x63')](_0x3d66('0x64')):undefined});}return null;})[_0x3d66('0x24')](function(_0x3802e7){if(_0x3802e7){_0x1c37e0[_0x3d66('0x6e')]=_0x3802e7[_0x3d66('0x68')]({'plain':!![]});interaction_log[_0x3d66('0x25')](_0x3d66('0x6f'),_0x2835a6[_0x3d66('0x66')]['id'],_0x2835a6[_0x3d66('0x66')]['name'],_0x2835a6['user'][_0x3d66('0x70')],_0x1c37e0[_0x3d66('0x6e')]['id'],_0x2835a6[_0x3d66('0x5c')]?JSON[_0x3d66('0x71')](_0x2835a6[_0x3d66('0x5c')]):_0x3d66('0x72'));return respondWithRpcPromise('AcceptMessage',_0x3d66('0x73'),_0x1c37e0);}return null;})[_0x3d66('0x24')](function(_0x56f3ac){var _0x49a612=_0x3d66('0x74')+_0x56f3ac[_0x3d66('0x2b')][_0x3d66('0x75')];return db[_0x3d66('0x76')]['query'](_0x49a612,{'type':db[_0x3d66('0x77')][_0x3d66('0x78')]['SELECT'],'raw':!![]})[_0x3d66('0x24')](function(_0x51b68f){return _0x51b68f;});})['then'](function(_0x4e92ae){if(_0x4e92ae){_0x1c37e0[_0x3d66('0x2b')]['contact']=_0x4e92ae[0x0];if(!_0x2835a6[_0x3d66('0x5c')]['UserId'])return;return db[_0x3d66('0x79')]['find']({'where':{'id':_0x2835a6[_0x3d66('0x5c')][_0x3d66('0x65')],'role':_0x3d66('0x67')},'attributes':['id',_0x3d66('0x3a'),_0x3d66('0x7a'),_0x3d66('0x7b'),_0x3d66('0x7c')],'raw':!![]});}return null;})[_0x3d66('0x24')](function(_0x536110){if(!_0x536110)return null;_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x67')]=_0x536110;return _0x1c37e0;})[_0x3d66('0x24')](function(_0x2e8bff){if(_0x2e8bff){if(_0x2835a6['body'][_0x3d66('0x7d')]){_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x7e')]=util[_0x3d66('0x63')]('SIP/%s',_0x2835a6[_0x3d66('0x66')][_0x3d66('0x3a')]);_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x7f')]=_0x1c37e0[_0x3d66('0x7f')];_0x1c37e0['message'][_0x3d66('0x80')]=_0x1c37e0[_0x3d66('0x7f')];_0x1c37e0[_0x3d66('0x2b')][_0x3d66('0x81')]=_0x3d66('0x5f');return respondWithRpcPromise(_0x3d66('0x82'),_0x3d66('0x82'),{'event':'acceptmessage','message':_0x1c37e0[_0x3d66('0x2b')]},client9002)[_0x3d66('0x24')](function(){return _0x1c37e0;});}return _0x1c37e0;}return null;})[_0x3d66('0x24')](respondWithResult(_0x55404b,null))[_0x3d66('0x2c')](handleError(_0x55404b,null));};var interaction_log=require('../../config/logger')(_0x3d66('0x83'));exports[_0x3d66('0x36')]=function(_0x48e8a7,_0x348e25,_0x223c4d){var _0x5abedc={'agent':{},'channel':_0x3d66('0x60')};if(_0x48e8a7['body']['id']){delete _0x48e8a7[_0x3d66('0x5c')]['id'];}_0x48e8a7['body'][_0x3d66('0x65')]=_0x48e8a7[_0x3d66('0x5c')][_0x3d66('0x65')]||_0x48e8a7['user']['id'];_0x5abedc[_0x3d66('0x67')]['id']=_0x48e8a7[_0x3d66('0x5c')]['UserId'];return db[_0x3d66('0x3d')][_0x3d66('0x5a')]({'where':{'id':_0x48e8a7[_0x3d66('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x348e25,null))[_0x3d66('0x24')](function(_0x3d1ce9){if(_0x3d1ce9){_0x5abedc['message']=_0x3d1ce9[_0x3d66('0x68')]({'plain':!![]});return db[_0x3d66('0x69')]['find']({'where':{'id':_0x3d1ce9[_0x3d66('0x6a')]}});}return null;})[_0x3d66('0x24')](handleEntityNotFound(_0x348e25,null))[_0x3d66('0x24')](function(_0xc52ce3){if(_0xc52ce3){_0x5abedc['interaction']=_0xc52ce3[_0x3d66('0x68')]({'plain':!![]});interaction_log['info'](_0x3d66('0x84'),_0x48e8a7[_0x3d66('0x66')]['id'],_0x48e8a7[_0x3d66('0x66')]['name'],_0x48e8a7[_0x3d66('0x66')][_0x3d66('0x70')],_0x5abedc['interaction']['id'],_0x48e8a7[_0x3d66('0x5c')]?JSON[_0x3d66('0x71')](_0x48e8a7[_0x3d66('0x5c')]):_0x3d66('0x72'));return respondWithRpcPromise('RejectMessage',_0x3d66('0x85'),_0x5abedc);}return null;})['then'](function(_0x3f7f58){var _0x1efba0=_0x3d66('0x74')+_0x3f7f58[_0x3d66('0x2b')]['ContactId'];return db[_0x3d66('0x76')][_0x3d66('0x43')](_0x1efba0,{'type':db[_0x3d66('0x77')][_0x3d66('0x78')][_0x3d66('0x86')],'raw':!![]})[_0x3d66('0x24')](function(_0x52ce50){return _0x52ce50;});})[_0x3d66('0x24')](function(_0x2dd6ca){if(_0x2dd6ca){_0x5abedc[_0x3d66('0x2b')][_0x3d66('0x87')]=_0x2dd6ca[0x0];if(!_0x48e8a7[_0x3d66('0x5c')][_0x3d66('0x65')])return;return db[_0x3d66('0x79')][_0x3d66('0x5a')]({'where':{'id':_0x48e8a7[_0x3d66('0x5c')]['UserId'],'role':'agent'},'attributes':['id',_0x3d66('0x3a'),_0x3d66('0x7a'),_0x3d66('0x7b'),'internal'],'raw':!![]});}return null;})[_0x3d66('0x24')](function(_0x382cc3){if(!_0x382cc3)return null;_0x5abedc[_0x3d66('0x2b')][_0x3d66('0x67')]=_0x382cc3;return _0x5abedc;})[_0x3d66('0x24')](function(_0xb25418){if(_0xb25418){_0xb25418[_0x3d66('0x2b')][_0x3d66('0x7e')]=util[_0x3d66('0x63')](_0x3d66('0x88'),_0x48e8a7['user'][_0x3d66('0x3a')]);_0xb25418['message'][_0x3d66('0x7f')]=_0x5abedc[_0x3d66('0x7f')];_0xb25418[_0x3d66('0x2b')][_0x3d66('0x80')]=_0x5abedc[_0x3d66('0x7f')];_0xb25418['message'][_0x3d66('0x81')]=_0x3d66('0x36');respondWithRpcPromise(_0x3d66('0x82'),'EventManager',{'event':_0x3d66('0x89'),'message':_0xb25418[_0x3d66('0x2b')]},client9002);return _0x5abedc;}return null;})[_0x3d66('0x24')](respondWithResult(_0x348e25,null))['catch'](handleError(_0x348e25,null));}; \ No newline at end of file +var _0x70ff=['intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','OpenchannelMessage','include','findAll','rows','show','params','fields','find','create','body','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','UserId','user','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','event','accept','EventManager','acceptmessage','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','channel','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','info','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelMessage,\x20%s,\x20%s','result','catch','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x33a70d,_0x580f17){var _0x5d0ee8=function(_0x1af7b3){while(--_0x1af7b3){_0x33a70d['push'](_0x33a70d['shift']());}};_0x5d0ee8(++_0x580f17);}(_0x70ff,0x1ce));var _0xf70f=function(_0x2a6bc,_0x761a07){_0x2a6bc=_0x2a6bc-0x0;var _0x288d3a=_0x70ff[_0x2a6bc];return _0x288d3a;};'use strict';var emlformat=require(_0xf70f('0x0'));var rimraf=require(_0xf70f('0x1'));var zipdir=require(_0xf70f('0x2'));var jsonpatch=require(_0xf70f('0x3'));var rp=require(_0xf70f('0x4'));var moment=require(_0xf70f('0x5'));var BPromise=require(_0xf70f('0x6'));var Mustache=require(_0xf70f('0x7'));var util=require(_0xf70f('0x8'));var path=require(_0xf70f('0x9'));var sox=require(_0xf70f('0xa'));var csv=require(_0xf70f('0xb'));var ejs=require(_0xf70f('0xc'));var fs=require('fs');var fs_extra=require(_0xf70f('0xd'));var _=require(_0xf70f('0xe'));var squel=require(_0xf70f('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf70f('0x10'));var toCsv=require(_0xf70f('0xb'));var querystring=require(_0xf70f('0x11'));var Papa=require(_0xf70f('0x12'));var Redis=require('ioredis');var authService=require(_0xf70f('0x13'));var qs=require(_0xf70f('0x14'));var as=require(_0xf70f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf70f('0x16'));var utils=require(_0xf70f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf70f('0x18')]=_['defaults'](config['redis'],{'host':_0xf70f('0x19'),'port':0x18eb});var socket=require(_0xf70f('0x1a'))(new Redis(config[_0xf70f('0x18')]));require(_0xf70f('0x1b'))[_0xf70f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf70f('0x1d')][_0xf70f('0x1e')]({'port':0x232c});var client9002=jayson[_0xf70f('0x1d')][_0xf70f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5e80b7,_0x15b1f8,_0x3bd63e,_0x27a1ff){return new BPromise(function(_0x59fd5c,_0x523a9c){var _0x51cd11=_0x27a1ff||client;return _0x51cd11[_0xf70f('0x1f')](_0x5e80b7,_0x3bd63e)['then'](function(_0x2791c6){logger[_0xf70f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x15b1f8,_0xf70f('0x21'));logger['debug'](_0xf70f('0x22'),_0x15b1f8,_0xf70f('0x21'),JSON[_0xf70f('0x23')](_0x2791c6));if(_0x2791c6[_0xf70f('0x24')]){if(_0x2791c6[_0xf70f('0x24')]['code']===0x1f4){logger[_0xf70f('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x15b1f8,_0x2791c6[_0xf70f('0x24')][_0xf70f('0x25')]);return _0x523a9c(_0x2791c6['error']['message']);}logger['error'](_0xf70f('0x26'),_0x15b1f8,_0x2791c6[_0xf70f('0x24')]['message']);return _0x59fd5c(_0x2791c6[_0xf70f('0x24')][_0xf70f('0x25')]);}else{logger[_0xf70f('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x15b1f8,'request\x20sent');_0x59fd5c(_0x2791c6[_0xf70f('0x27')]['message']);}})[_0xf70f('0x28')](function(_0x30e150){logger[_0xf70f('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x15b1f8,_0x30e150);_0x523a9c(_0x30e150);});});}function respondWithStatusCode(_0x2da785,_0x53e49a){_0x53e49a=_0x53e49a||0xcc;return function(_0x2407c9){if(_0x2407c9){return _0x2da785['sendStatus'](_0x53e49a);}return _0x2da785[_0xf70f('0x29')](_0x53e49a)['end']();};}function respondWithResult(_0x49f8c3,_0x9685ba){_0x9685ba=_0x9685ba||0xc8;return function(_0x98c516){if(_0x98c516){return _0x49f8c3['status'](_0x9685ba)['json'](_0x98c516);}};}function respondWithFilteredResult(_0x6bf5f,_0x1a9b51){return function(_0x1e7ae1){if(_0x1e7ae1){var _0x424bc8=typeof _0x1a9b51[_0xf70f('0x2a')]==='undefined'&&typeof _0x1a9b51['limit']===_0xf70f('0x2b');var _0xcff797=_0x1e7ae1[_0xf70f('0x2c')];var _0x143843=_0x424bc8?0x0:_0x1a9b51[_0xf70f('0x2a')];var _0x1e80af=_0x424bc8?_0x1e7ae1[_0xf70f('0x2c')]:_0x1a9b51['offset']+_0x1a9b51[_0xf70f('0x2d')];var _0x53b3df;if(_0x1e80af>=_0xcff797){_0x1e80af=_0xcff797;_0x53b3df=0xc8;}else{_0x53b3df=0xce;}_0x6bf5f[_0xf70f('0x29')](_0x53b3df);return _0x6bf5f[_0xf70f('0x2e')](_0xf70f('0x2f'),_0x143843+'-'+_0x1e80af+'/'+_0xcff797)[_0xf70f('0x30')](_0x1e7ae1);}return null;};}function patchUpdates(_0xd6a1fe){return function(_0x5a2719){try{jsonpatch[_0xf70f('0x31')](_0x5a2719,_0xd6a1fe,!![]);}catch(_0x52dce2){return BPromise[_0xf70f('0x32')](_0x52dce2);}return _0x5a2719[_0xf70f('0x33')]();};}function saveUpdates(_0x210067,_0x50a228){return function(_0x5c10dd){if(_0x5c10dd){return _0x5c10dd['update'](_0x210067)[_0xf70f('0x34')](function(_0x4d49ec){return _0x4d49ec;});}return null;};}function removeEntity(_0xc2cf1a,_0x35411d){return function(_0x360983){if(_0x360983){return _0x360983[_0xf70f('0x35')]()[_0xf70f('0x34')](function(){_0xc2cf1a[_0xf70f('0x29')](0xcc)[_0xf70f('0x36')]();});}};}function handleEntityNotFound(_0x201f73,_0x1c32ee){return function(_0x177747){if(!_0x177747){_0x201f73['sendStatus'](0x194);}return _0x177747;};}function handleError(_0x49a0b6,_0x26bfe8){_0x26bfe8=_0x26bfe8||0x1f4;return function(_0x50a042){logger[_0xf70f('0x24')](_0x50a042['stack']);if(_0x50a042[_0xf70f('0x37')]){delete _0x50a042[_0xf70f('0x37')];}_0x49a0b6['status'](_0x26bfe8)[_0xf70f('0x38')](_0x50a042);};}exports[_0xf70f('0x39')]=function(_0x32ad80,_0x34b9da){var _0x544ddd={},_0x3098e3={},_0x393a9c={'count':0x0,'rows':[]};var _0x15069d=_[_0xf70f('0x3a')](db['OpenchannelMessage'][_0xf70f('0x3b')],function(_0x28bd83){return{'name':_0x28bd83[_0xf70f('0x3c')],'type':_0x28bd83[_0xf70f('0x3d')][_0xf70f('0x3e')]};});_0x3098e3[_0xf70f('0x3f')]=_[_0xf70f('0x3a')](_0x15069d,_0xf70f('0x37'));_0x3098e3[_0xf70f('0x40')]=_[_0xf70f('0x41')](_0x32ad80[_0xf70f('0x40')]);_0x3098e3['filters']=_[_0xf70f('0x42')](_0x3098e3[_0xf70f('0x3f')],_0x3098e3['query']);_0x544ddd[_0xf70f('0x43')]=_[_0xf70f('0x42')](_0x3098e3[_0xf70f('0x3f')],qs['fields'](_0x32ad80[_0xf70f('0x40')]['fields']));_0x544ddd['attributes']=_0x544ddd[_0xf70f('0x43')]['length']?_0x544ddd[_0xf70f('0x43')]:_0x3098e3[_0xf70f('0x3f')];if(!_0x32ad80[_0xf70f('0x40')][_0xf70f('0x44')](_0xf70f('0x45'))){_0x544ddd[_0xf70f('0x2d')]=qs['limit'](_0x32ad80[_0xf70f('0x40')][_0xf70f('0x2d')]);_0x544ddd[_0xf70f('0x2a')]=qs[_0xf70f('0x2a')](_0x32ad80[_0xf70f('0x40')][_0xf70f('0x2a')]);}_0x544ddd[_0xf70f('0x46')]=qs[_0xf70f('0x47')](_0x32ad80['query'][_0xf70f('0x47')]);_0x544ddd['where']=qs['filters'](_[_0xf70f('0x48')](_0x32ad80[_0xf70f('0x40')],_0x3098e3[_0xf70f('0x49')]),_0x15069d);if(_0x32ad80[_0xf70f('0x40')][_0xf70f('0x4a')]){_0x544ddd['where']=_[_0xf70f('0x4b')](_0x544ddd['where'],{'$or':_[_0xf70f('0x3a')](_0x15069d,function(_0x343764){if(_0x343764[_0xf70f('0x3d')]!==_0xf70f('0x4c')){var _0x53dc23={};_0x53dc23[_0x343764[_0xf70f('0x37')]]={'$like':'%'+_0x32ad80[_0xf70f('0x40')][_0xf70f('0x4a')]+'%'};return _0x53dc23;}})});}_0x544ddd=_[_0xf70f('0x4b')]({},_0x544ddd,_0x32ad80[_0xf70f('0x4d')]);var _0x3f6fa1={'where':_0x544ddd[_0xf70f('0x4e')]};return db[_0xf70f('0x4f')][_0xf70f('0x2c')](_0x3f6fa1)[_0xf70f('0x34')](function(_0x4d9914){_0x393a9c[_0xf70f('0x2c')]=_0x4d9914;if(_0x32ad80['query']['includeAll']){_0x544ddd[_0xf70f('0x50')]=[{'all':!![]}];}return db[_0xf70f('0x4f')][_0xf70f('0x51')](_0x544ddd);})[_0xf70f('0x34')](function(_0x442ca9){_0x393a9c[_0xf70f('0x52')]=_0x442ca9;return _0x393a9c;})[_0xf70f('0x34')](respondWithFilteredResult(_0x34b9da,_0x544ddd))[_0xf70f('0x28')](handleError(_0x34b9da,null));};exports[_0xf70f('0x53')]=function(_0x7a6f63,_0x4c3ebd){var _0x44c692={'raw':!![],'where':{'id':_0x7a6f63[_0xf70f('0x54')]['id']}},_0x1a9a3b={};_0x1a9a3b[_0xf70f('0x3f')]=_[_0xf70f('0x41')](db[_0xf70f('0x4f')][_0xf70f('0x3b')]);_0x1a9a3b[_0xf70f('0x40')]=_[_0xf70f('0x41')](_0x7a6f63[_0xf70f('0x40')]);_0x1a9a3b[_0xf70f('0x49')]=_[_0xf70f('0x42')](_0x1a9a3b[_0xf70f('0x3f')],_0x1a9a3b[_0xf70f('0x40')]);_0x44c692[_0xf70f('0x43')]=_[_0xf70f('0x42')](_0x1a9a3b['model'],qs[_0xf70f('0x55')](_0x7a6f63['query'][_0xf70f('0x55')]));_0x44c692[_0xf70f('0x43')]=_0x44c692['attributes']['length']?_0x44c692[_0xf70f('0x43')]:_0x1a9a3b[_0xf70f('0x3f')];if(_0x7a6f63['query']['includeAll']){_0x44c692[_0xf70f('0x50')]=[{'all':!![]}];}_0x44c692=_[_0xf70f('0x4b')]({},_0x44c692,_0x7a6f63['options']);return db[_0xf70f('0x4f')][_0xf70f('0x56')](_0x44c692)['then'](handleEntityNotFound(_0x4c3ebd,null))['then'](respondWithResult(_0x4c3ebd,null))[_0xf70f('0x28')](handleError(_0x4c3ebd,null));};exports[_0xf70f('0x57')]=function(_0x3ac421,_0x30f808){return db[_0xf70f('0x4f')][_0xf70f('0x57')](_0x3ac421[_0xf70f('0x58')],{})['then'](respondWithResult(_0x30f808,0xc9))['catch'](handleError(_0x30f808,null));};exports['update']=function(_0x23381b,_0x1d5dad){if(_0x23381b[_0xf70f('0x58')]['id']){delete _0x23381b[_0xf70f('0x58')]['id'];}return db[_0xf70f('0x4f')][_0xf70f('0x56')]({'where':{'id':_0x23381b['params']['id']}})[_0xf70f('0x34')](handleEntityNotFound(_0x1d5dad,null))['then'](saveUpdates(_0x23381b[_0xf70f('0x58')],null))['then'](respondWithResult(_0x1d5dad,null))[_0xf70f('0x28')](handleError(_0x1d5dad,null));};exports[_0xf70f('0x35')]=function(_0xa30f53,_0x3052db){return db[_0xf70f('0x4f')][_0xf70f('0x56')]({'where':{'id':_0xa30f53[_0xf70f('0x54')]['id']}})[_0xf70f('0x34')](handleEntityNotFound(_0x3052db,null))[_0xf70f('0x34')](removeEntity(_0x3052db,null))[_0xf70f('0x28')](handleError(_0x3052db,null));};exports[_0xf70f('0x59')]=function(_0x1169d6,_0x1c0ac2){return db['OpenchannelMessage']['describe']()[_0xf70f('0x34')](respondWithResult(_0x1c0ac2,null))['catch'](handleError(_0x1c0ac2,null));};var interaction_log=require(_0xf70f('0x5a'))(_0xf70f('0x5b'));exports['accept']=function(_0x348b84,_0x31597f,_0x43225f){var _0x59f7f1={'agent':{},'channel':_0xf70f('0x5c')};if(_0x348b84[_0xf70f('0x58')]['id']){delete _0x348b84['body']['id'];}_0x348b84[_0xf70f('0x58')][_0xf70f('0x5d')]=!![];_0x348b84[_0xf70f('0x58')][_0xf70f('0x5e')]=moment()[_0xf70f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x348b84[_0xf70f('0x58')][_0xf70f('0x60')]=_0x348b84['body'][_0xf70f('0x60')]||_0x348b84[_0xf70f('0x61')]['id'];_0x59f7f1['agent']['id']=_0x348b84['body']['UserId'];return db[_0xf70f('0x4f')][_0xf70f('0x56')]({'where':{'id':_0x348b84['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31597f,null))[_0xf70f('0x34')](saveUpdates(_0x348b84['body'],null))[_0xf70f('0x34')](function(_0x2ba3a9){if(_0x2ba3a9){_0x59f7f1['message']=_0x2ba3a9[_0xf70f('0x62')]({'plain':!![]});return db[_0xf70f('0x63')][_0xf70f('0x56')]({'where':{'id':_0x2ba3a9['OpenchannelInteractionId']}});}return null;})[_0xf70f('0x34')](handleEntityNotFound(_0x31597f,null))[_0xf70f('0x34')](function(_0x42d12e){if(_0x42d12e){return _0x42d12e['update']({'UserId':_0x348b84[_0xf70f('0x58')][_0xf70f('0x60')],'read1stAt':_[_0xf70f('0x64')](_0x42d12e[_0xf70f('0x65')])?moment()[_0xf70f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf70f('0x34')](function(_0x3e01f3){if(_0x3e01f3){_0x59f7f1['interaction']=_0x3e01f3[_0xf70f('0x62')]({'plain':!![]});interaction_log[_0xf70f('0x20')](_0xf70f('0x66'),_0x348b84[_0xf70f('0x61')]['id'],_0x348b84[_0xf70f('0x61')][_0xf70f('0x37')],_0x348b84[_0xf70f('0x61')][_0xf70f('0x67')],_0x59f7f1['interaction']['id'],_0x348b84[_0xf70f('0x58')]?JSON[_0xf70f('0x23')](_0x348b84[_0xf70f('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0xf70f('0x68'),_0x59f7f1);}return null;})[_0xf70f('0x34')](function(_0x122a4b){var _0x46bad5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x122a4b['message']['ContactId'];return db[_0xf70f('0x69')][_0xf70f('0x40')](_0x46bad5,{'type':db[_0xf70f('0x6a')][_0xf70f('0x6b')][_0xf70f('0x6c')],'raw':!![]})[_0xf70f('0x34')](function(_0x2616f7){return _0x2616f7;});})[_0xf70f('0x34')](function(_0x5b1455){if(_0x5b1455){_0x59f7f1[_0xf70f('0x25')][_0xf70f('0x6d')]=_0x5b1455[0x0];if(!_0x348b84[_0xf70f('0x58')][_0xf70f('0x60')])return;return db[_0xf70f('0x6e')]['find']({'where':{'id':_0x348b84[_0xf70f('0x58')][_0xf70f('0x60')],'role':_0xf70f('0x6f')},'attributes':['id',_0xf70f('0x37'),'fullname',_0xf70f('0x70'),_0xf70f('0x71')],'raw':!![]});}return null;})['then'](function(_0x15f3c0){if(!_0x15f3c0)return null;_0x59f7f1['message'][_0xf70f('0x6f')]=_0x15f3c0;return _0x59f7f1;})[_0xf70f('0x34')](function(_0x4b147c){if(_0x4b147c){if(_0x348b84[_0xf70f('0x58')][_0xf70f('0x72')]){_0x59f7f1[_0xf70f('0x25')][_0xf70f('0x73')]=util['format'](_0xf70f('0x74'),_0x348b84[_0xf70f('0x61')][_0xf70f('0x37')]);_0x59f7f1[_0xf70f('0x25')]['channel']=_0x59f7f1['channel'];_0x59f7f1['message']['motionChannel']=_0x59f7f1['channel'];_0x59f7f1['message'][_0xf70f('0x75')]=_0xf70f('0x76');return respondWithRpcPromise(_0xf70f('0x77'),'EventManager',{'event':_0xf70f('0x78'),'message':_0x59f7f1[_0xf70f('0x25')]},client9002)[_0xf70f('0x34')](function(){return _0x59f7f1;});}return _0x59f7f1;}return null;})[_0xf70f('0x34')](respondWithResult(_0x31597f,null))[_0xf70f('0x28')](handleError(_0x31597f,null));};var interaction_log=require('../../config/logger')(_0xf70f('0x5b'));exports[_0xf70f('0x32')]=function(_0x2451c0,_0x2c27b1,_0xbf3680){var _0x5ad9b0={'agent':{},'channel':_0xf70f('0x5c')};if(_0x2451c0[_0xf70f('0x58')]['id']){delete _0x2451c0['body']['id'];}_0x2451c0[_0xf70f('0x58')][_0xf70f('0x60')]=_0x2451c0['body'][_0xf70f('0x60')]||_0x2451c0[_0xf70f('0x61')]['id'];_0x5ad9b0[_0xf70f('0x6f')]['id']=_0x2451c0[_0xf70f('0x58')][_0xf70f('0x60')];return db[_0xf70f('0x4f')]['find']({'where':{'id':_0x2451c0[_0xf70f('0x54')]['id'],'UserId':null}})[_0xf70f('0x34')](handleEntityNotFound(_0x2c27b1,null))['then'](function(_0x3a8f86){if(_0x3a8f86){_0x5ad9b0['message']=_0x3a8f86[_0xf70f('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf70f('0x56')]({'where':{'id':_0x3a8f86['OpenchannelInteractionId']}});}return null;})[_0xf70f('0x34')](handleEntityNotFound(_0x2c27b1,null))[_0xf70f('0x34')](function(_0x558b3c){if(_0x558b3c){_0x5ad9b0[_0xf70f('0x79')]=_0x558b3c[_0xf70f('0x62')]({'plain':!![]});interaction_log[_0xf70f('0x20')](_0xf70f('0x7a'),_0x2451c0[_0xf70f('0x61')]['id'],_0x2451c0['user'][_0xf70f('0x37')],_0x2451c0['user'][_0xf70f('0x67')],_0x5ad9b0[_0xf70f('0x79')]['id'],_0x2451c0['body']?JSON[_0xf70f('0x23')](_0x2451c0[_0xf70f('0x58')]):_0xf70f('0x7b'));return respondWithRpcPromise(_0xf70f('0x7c'),_0xf70f('0x7d'),_0x5ad9b0);}return null;})[_0xf70f('0x34')](function(_0x6dbab6){var _0x86d944=_0xf70f('0x7e')+_0x6dbab6['message'][_0xf70f('0x7f')];return db[_0xf70f('0x69')][_0xf70f('0x40')](_0x86d944,{'type':db[_0xf70f('0x6a')][_0xf70f('0x6b')][_0xf70f('0x6c')],'raw':!![]})[_0xf70f('0x34')](function(_0x33de50){return _0x33de50;});})[_0xf70f('0x34')](function(_0x446d10){if(_0x446d10){_0x5ad9b0[_0xf70f('0x25')][_0xf70f('0x6d')]=_0x446d10[0x0];if(!_0x2451c0[_0xf70f('0x58')][_0xf70f('0x60')])return;return db[_0xf70f('0x6e')][_0xf70f('0x56')]({'where':{'id':_0x2451c0['body']['UserId'],'role':_0xf70f('0x6f')},'attributes':['id',_0xf70f('0x37'),_0xf70f('0x80'),_0xf70f('0x70'),_0xf70f('0x71')],'raw':!![]});}return null;})[_0xf70f('0x34')](function(_0x3ad2bf){if(!_0x3ad2bf)return null;_0x5ad9b0[_0xf70f('0x25')][_0xf70f('0x6f')]=_0x3ad2bf;return _0x5ad9b0;})[_0xf70f('0x34')](function(_0x51c7b1){if(_0x51c7b1){_0x51c7b1[_0xf70f('0x25')]['interface']=util[_0xf70f('0x5f')](_0xf70f('0x74'),_0x2451c0[_0xf70f('0x61')][_0xf70f('0x37')]);_0x51c7b1[_0xf70f('0x25')][_0xf70f('0x81')]=_0x5ad9b0[_0xf70f('0x81')];_0x51c7b1['message'][_0xf70f('0x82')]=_0x5ad9b0[_0xf70f('0x81')];_0x51c7b1[_0xf70f('0x25')][_0xf70f('0x75')]='reject';respondWithRpcPromise(_0xf70f('0x77'),'EventManager',{'event':_0xf70f('0x83'),'message':_0x51c7b1[_0xf70f('0x25')]},client9002);return _0x5ad9b0;}return null;})[_0xf70f('0x34')](respondWithResult(_0x2c27b1,null))[_0xf70f('0x28')](handleError(_0x2c27b1,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b5ba092..e4c06f1 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 _0xc8fd=['../../mysqldb','OpenchannelMessage','save','remove','emit','hook'];(function(_0xe42f,_0x78b996){var _0x29bde2=function(_0x2eeeec){while(--_0x2eeeec){_0xe42f['push'](_0xe42f['shift']());}};_0x29bde2(++_0x78b996);}(_0xc8fd,0x162));var _0xdc8f=function(_0x15847f,_0x3973b5){_0x15847f=_0x15847f-0x0;var _0x414c2f=_0xc8fd[_0x15847f];return _0x414c2f;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdc8f('0x0'))['db'][_0xdc8f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc8f('0x2'),'afterUpdate':'update','afterDestroy':_0xdc8f('0x3')};function emitEvent(_0x1cf42a){return function(_0x106091,_0x3117eb,_0x5285ba){OpenchannelMessageEvents[_0xdc8f('0x4')](_0x1cf42a+':'+_0x106091['id'],_0x106091);OpenchannelMessageEvents[_0xdc8f('0x4')](_0x1cf42a,_0x106091);_0x5285ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xdc8f('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xcc7d=['hook','exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1ac9f1,_0x2de131){var _0x2924dc=function(_0x3b6c50){while(--_0x3b6c50){_0x1ac9f1['push'](_0x1ac9f1['shift']());}};_0x2924dc(++_0x2de131);}(_0xcc7d,0x7a));var _0xdcc7=function(_0x267d12,_0x57358a){_0x267d12=_0x267d12-0x0;var _0xa70361=_0xcc7d[_0x267d12];return _0xa70361;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdcc7('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdcc7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdcc7('0x2'),'afterDestroy':_0xdcc7('0x3')};function emitEvent(_0x167f2c){return function(_0x145e24,_0x58e264,_0x5c99bd){OpenchannelMessageEvents[_0xdcc7('0x4')](_0x167f2c+':'+_0x145e24['id'],_0x145e24);OpenchannelMessageEvents[_0xdcc7('0x4')](_0x167f2c,_0x145e24);_0x5c99bd(null);};}for(var e in events){if(events[_0xdcc7('0x5')](e)){var event=events[e];OpenchannelMessage[_0xdcc7('0x6')](e,emitEvent(event));}}module[_0xdcc7('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9aa4ca5..f46fa88 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 _0x88be=['replyUri','Interaction','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','body','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x1e0a70,_0x9f8a2d){var _0x4635ea=function(_0x5c511f){while(--_0x5c511f){_0x1e0a70['push'](_0x1e0a70['shift']());}};_0x4635ea(++_0x9f8a2d);}(_0x88be,0x1d3));var _0xe88b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x88be[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xe88b('0x0'));var logger=require(_0xe88b('0x1'))(_0xe88b('0x2'));var moment=require(_0xe88b('0x3'));var BPromise=require(_0xe88b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe88b('0x5'));var attributes=require(_0xe88b('0x6'));module[_0xe88b('0x7')]=function(_0x4c7e83,_0x5e8b47){return _0x4c7e83['define'](_0xe88b('0x8'),attributes,{'tableName':_0xe88b('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xe88b('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x236ba0,_0x2cb82c,_0x3b91cd){var _0x593c2=_0x4c7e83[_0xe88b('0xb')];var _0x1d7117=_0x236ba0[_0xe88b('0xc')]({'plain':!![]});if(_0x1d7117[_0xe88b('0xd')]['toLowerCase']()==='in'||_0x1d7117[_0xe88b('0xd')][_0xe88b('0xe')]()===_0xe88b('0xf')&&!_0x1d7117['secret']&&!_['isNil'](_0x1d7117[_0xe88b('0x10')])){_0x593c2[_0xe88b('0x11')][_0xe88b('0x12')]({'where':{'id':_0x1d7117[_0xe88b('0x13')]}})[_0xe88b('0x14')](function(_0x107b60){if(_0x107b60){_0x107b60[_0xe88b('0x15')]({'lastMsgAt':_0x1d7117[_0xe88b('0x16')],'lastMsgDirection':_0x1d7117['direction'][_0xe88b('0xe')]()});}})[_0xe88b('0x17')](function(_0x3c5db1){console[_0xe88b('0x18')](_0x3c5db1);});}if(_0x1d7117[_0xe88b('0xd')]===_0xe88b('0xf')&&!_0x1d7117[_0xe88b('0x19')]){var _0x2d83a0;_0x593c2[_0xe88b('0x1a')][_0xe88b('0x1b')]()[_0xe88b('0x14')](function(_0x2f410c){return _0x593c2[_0xe88b('0x1c')][_0xe88b('0x1d')]({'where':{'id':_0x1d7117[_0xe88b('0x1e')]},'include':[{'model':_0x593c2[_0xe88b('0x11')],'as':_0xe88b('0x1f'),'where':{'id':_0x1d7117[_0xe88b('0x13')]},'limit':0x1,'include':[{'model':_0x593c2[_0xe88b('0x1a')],'as':_0xe88b('0x20'),'attributes':_[_0xe88b('0x21')](_0x2f410c)}]}]});})[_0xe88b('0x14')](function(_0x20842f){_0x2d83a0=_0x20842f[_0xe88b('0xc')]({'plain':!![]});if(_0x2d83a0&&_0x2d83a0['replyUri']){logger[_0xe88b('0x22')](_0xe88b('0x23'),_0xe88b('0x24'),util[_0xe88b('0x25')](_0xe88b('0x26'),_0x1d7117['id'],_0x2d83a0[_0xe88b('0x27')]));if(_0x2d83a0[_0xe88b('0x1f')]&&_0x2d83a0[_0xe88b('0x1f')]['length']){_0x1d7117[_0xe88b('0x28')]=_['omit'](_0x2d83a0[_0xe88b('0x1f')][0x0],_0xe88b('0x20'));_0x1d7117[_0xe88b('0x20')]=_0x2d83a0[_0xe88b('0x1f')][0x0]['Contact'];}var _0x2cb82c={'method':'POST','uri':encodeURI(_0x2d83a0[_0xe88b('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2cb82c[_0xe88b('0x29')]){case'GET':_0x2cb82c['qs']=_0x1d7117;break;case'POST':_0x2cb82c[_0xe88b('0xa')]=_0x1d7117;break;}return rp(_0x2cb82c)[_0xe88b('0x14')](function(_0x472e94){logger[_0xe88b('0x22')](_0xe88b('0x23'),_0xe88b('0x24'),util[_0xe88b('0x25')](_0xe88b('0x2a'),_0x1d7117['id'],_0x2d83a0['replyUri']));if(_0x472e94[_0xe88b('0xa')][_0xe88b('0x2b')]&&_0x472e94['body'][_0xe88b('0x2b')]!=_0x1d7117[_0xe88b('0x28')][_0xe88b('0x2b')]){return _0x593c2[_0xe88b('0x11')][_0xe88b('0x15')]({'threadId':_0x472e94[_0xe88b('0xa')]['threadId']},{'where':{'id':_0x1d7117['Interaction']['id']}});}else{return;}})[_0xe88b('0x14')](function(){return _0x236ba0[_0xe88b('0x15')]({'read':!![]});})['catch'](function(_0x25d0c2){logger['error'](_0xe88b('0x23'),_0xe88b('0x24'),util['inspect'](_0x25d0c2,{'showHidden':![],'depth':null}));_0x3b91cd();});}else{_0x3b91cd();}})[_0xe88b('0x2c')](function(){_0x3b91cd();});}else{_0x3b91cd();}}},'charset':_0xe88b('0x2d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x50d4=['get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','threadId','Interaction','update','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','FULLTEXT'];(function(_0x324b14,_0x177956){var _0x5c3bb5=function(_0xa74a72){while(--_0xa74a72){_0x324b14['push'](_0x324b14['shift']());}};_0x5c3bb5(++_0x177956);}(_0x50d4,0x164));var _0x450d=function(_0x44426b,_0x1d3819){_0x44426b=_0x44426b-0x0;var _0x170754=_0x50d4[_0x44426b];return _0x170754;};'use strict';var _=require(_0x450d('0x0'));var util=require(_0x450d('0x1'));var logger=require(_0x450d('0x2'))(_0x450d('0x3'));var moment=require('moment');var BPromise=require(_0x450d('0x4'));var rp=require(_0x450d('0x5'));var fs=require('fs');var path=require(_0x450d('0x6'));var rimraf=require(_0x450d('0x7'));var config=require(_0x450d('0x8'));var attributes=require(_0x450d('0x9'));module[_0x450d('0xa')]=function(_0x11bef3,_0x2bfd9c){return _0x11bef3['define']('OpenchannelMessage',attributes,{'tableName':_0x450d('0xb'),'paranoid':![],'indexes':[{'name':_0x450d('0xc'),'fields':[_0x450d('0xd')],'type':_0x450d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22f024,_0x2c866a,_0x524d65){var _0x455dfb=_0x11bef3['models'];var _0x2078c0=_0x22f024[_0x450d('0xf')]({'plain':!![]});if(_0x2078c0['direction'][_0x450d('0x10')]()==='in'||_0x2078c0[_0x450d('0x11')][_0x450d('0x10')]()===_0x450d('0x12')&&!_0x2078c0[_0x450d('0x13')]&&!_[_0x450d('0x14')](_0x2078c0[_0x450d('0x15')])){_0x455dfb[_0x450d('0x16')]['findOne']({'where':{'id':_0x2078c0[_0x450d('0x17')]}})['then'](function(_0x9d18ee){if(_0x9d18ee){_0x9d18ee['update']({'lastMsgAt':_0x2078c0[_0x450d('0x18')],'lastMsgDirection':_0x2078c0[_0x450d('0x11')][_0x450d('0x10')]()});}})[_0x450d('0x19')](function(_0x526dce){console[_0x450d('0x1a')](_0x526dce);});}if(_0x2078c0[_0x450d('0x11')]===_0x450d('0x12')&&!_0x2078c0['secret']){var _0x2187ba;_0x455dfb[_0x450d('0x1b')][_0x450d('0x1c')]()[_0x450d('0x1d')](function(_0x3d69b2){return _0x455dfb[_0x450d('0x1e')][_0x450d('0x1f')]({'where':{'id':_0x2078c0[_0x450d('0x20')]},'include':[{'model':_0x455dfb[_0x450d('0x16')],'as':_0x450d('0x21'),'where':{'id':_0x2078c0[_0x450d('0x17')]},'limit':0x1,'include':[{'model':_0x455dfb[_0x450d('0x1b')],'as':_0x450d('0x22'),'attributes':_[_0x450d('0x23')](_0x3d69b2)}]}]});})[_0x450d('0x1d')](function(_0x260c87){_0x2187ba=_0x260c87[_0x450d('0xf')]({'plain':!![]});if(_0x2187ba&&_0x2187ba[_0x450d('0x24')]){logger[_0x450d('0x25')](_0x450d('0x26'),'afterCreate',util[_0x450d('0x27')](_0x450d('0x28'),_0x2078c0['id'],_0x2187ba['replyUri']));if(_0x2187ba['Interactions']&&_0x2187ba[_0x450d('0x21')][_0x450d('0x29')]){_0x2078c0['Interaction']=_[_0x450d('0x2a')](_0x2187ba['Interactions'][0x0],_0x450d('0x22'));_0x2078c0[_0x450d('0x22')]=_0x2187ba['Interactions'][0x0][_0x450d('0x22')];}var _0x2c866a={'method':_0x450d('0x2b'),'uri':encodeURI(_0x2187ba['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2c866a[_0x450d('0x2c')]){case'GET':_0x2c866a['qs']=_0x2078c0;break;case _0x450d('0x2b'):_0x2c866a['body']=_0x2078c0;break;}return rp(_0x2c866a)[_0x450d('0x1d')](function(_0x216950){logger[_0x450d('0x25')](_0x450d('0x26'),'afterCreate',util[_0x450d('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2078c0['id'],_0x2187ba[_0x450d('0x24')]));if(_0x216950[_0x450d('0xd')][_0x450d('0x2d')]&&_0x216950[_0x450d('0xd')]['threadId']!=_0x2078c0[_0x450d('0x2e')][_0x450d('0x2d')]){return _0x455dfb[_0x450d('0x16')][_0x450d('0x2f')]({'threadId':_0x216950['body']['threadId']},{'where':{'id':_0x2078c0['Interaction']['id']}});}else{return;}})[_0x450d('0x1d')](function(){return _0x22f024['update']({'read':!![]});})[_0x450d('0x19')](function(_0x38d51b){logger[_0x450d('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x450d('0x30'),util[_0x450d('0x31')](_0x38d51b,{'showHidden':![],'depth':null}));_0x524d65();});}else{_0x524d65();}})[_0x450d('0x32')](function(){_0x524d65();});}else{_0x524d65();}}},'charset':_0x450d('0x33'),'collate':_0x450d('0x34')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1854aee..d787b75 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3ffd8d,_0x2eb8d1){var _0x433d2c=function(_0x1fde10){while(--_0x1fde10){_0x3ffd8d['push'](_0x3ffd8d['shift']());}};_0x433d2c(++_0x2eb8d1);}(_0x7a54,0x106));var _0x47a5=function(_0x40b06b,_0x1c3454){_0x40b06b=_0x40b06b-0x0;var _0x12f460=_0x7a54[_0x40b06b];return _0x12f460;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x13652f,_0x5ebf97){var _0x942df0=function(_0x4cdef5){while(--_0x4cdef5){_0x13652f['push'](_0x13652f['shift']());}};_0x942df0(++_0x5ebf97);}(_0x2ef3,0xba));var _0x32ef=function(_0x3fdd0a,_0xa1e087){_0x3fdd0a=_0x3fdd0a-0x0;var _0x7c0549=_0x2ef3[_0x3fdd0a];return _0x7c0549;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 82eedd6..77e2bc5 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 _0x7e47=['remove','update','register','length','openchannelMessage:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e47,0x19d));var _0x77e4=function(_0x3d0702,_0x472c90){_0x3d0702=_0x3d0702-0x0;var _0x867831=_0x7e47[_0x3d0702];return _0x867831;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x77e4('0x0'),_0x77e4('0x1'),_0x77e4('0x2')];function createListener(_0x279015,_0x1e515e){return function(_0x5efc5b){_0x1e515e['emit'](_0x279015,_0x5efc5b);};}function removeListener(_0x4aa69c,_0x3d61bd){return function(){OpenchannelMessageEvents['removeListener'](_0x4aa69c,_0x3d61bd);};}exports[_0x77e4('0x3')]=function(_0x2f5da1){for(var _0x5dda95=0x0,_0x599cc4=events[_0x77e4('0x4')];_0x5dda95<_0x599cc4;_0x5dda95++){var _0x346f6c=events[_0x5dda95];var _0x1766fe=createListener(_0x77e4('0x5')+_0x346f6c,_0x2f5da1);OpenchannelMessageEvents['on'](_0x346f6c,_0x1766fe);}}; \ No newline at end of file +var _0xa7e6=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0xf75c37,_0x2fa1c7){var _0x568a1f=function(_0x2246b5){while(--_0x2246b5){_0xf75c37['push'](_0xf75c37['shift']());}};_0x568a1f(++_0x2fa1c7);}(_0xa7e6,0x74));var _0x6a7e=function(_0x374214,_0x262429){_0x374214=_0x374214-0x0;var _0x402719=_0xa7e6[_0x374214];return _0x402719;};'use strict';var OpenchannelMessageEvents=require(_0x6a7e('0x0'));var events=[_0x6a7e('0x1'),_0x6a7e('0x2'),_0x6a7e('0x3')];function createListener(_0x67fa72,_0x21c1de){return function(_0x4c809c){_0x21c1de[_0x6a7e('0x4')](_0x67fa72,_0x4c809c);};}function removeListener(_0x8787b5,_0x1ea310){return function(){OpenchannelMessageEvents[_0x6a7e('0x5')](_0x8787b5,_0x1ea310);};}exports[_0x6a7e('0x6')]=function(_0x599006){for(var _0x79df6f=0x0,_0x16249d=events[_0x6a7e('0x7')];_0x79df6f<_0x16249d;_0x79df6f++){var _0x342c96=events[_0x79df6f];var _0x45e92e=createListener(_0x6a7e('0x8')+_0x342c96,_0x599006);OpenchannelMessageEvents['on'](_0x342c96,_0x45e92e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e7cf4b2..f046376 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 _0x2e3b=['/:id/teams','post','/:id/users','addAgents','put','/:id','update','destroy','delete','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers'];(function(_0x596615,_0x2fe9c4){var _0xd5b877=function(_0x3e7258){while(--_0x3e7258){_0x596615['push'](_0x596615['shift']());}};_0xd5b877(++_0x2fe9c4);}(_0x2e3b,0x1ba));var _0xb2e3=function(_0x23078c,_0x45658b){_0x23078c=_0x23078c-0x0;var _0x6e95bc=_0x2e3b[_0x23078c];return _0x6e95bc;};'use strict';var multer=require(_0xb2e3('0x0'));var util=require(_0xb2e3('0x1'));var path=require('path');var timeout=require(_0xb2e3('0x2'));var express=require(_0xb2e3('0x3'));var router=express[_0xb2e3('0x4')]();var fs_extra=require(_0xb2e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2e3('0x6'));var config=require(_0xb2e3('0x7'));var controller=require(_0xb2e3('0x8'));router[_0xb2e3('0x9')]('/',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xb')]);router[_0xb2e3('0x9')](_0xb2e3('0xc'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xd')]);router[_0xb2e3('0x9')]('/:id',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0xe')]);router[_0xb2e3('0x9')](_0xb2e3('0xf'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x10')]);router[_0xb2e3('0x9')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xb2e3('0x12')]('/',auth[_0xb2e3('0xa')](),controller['create']);router[_0xb2e3('0x12')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['addTeams']);router[_0xb2e3('0x12')](_0xb2e3('0x13'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x14')]);router[_0xb2e3('0x15')](_0xb2e3('0x16'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x17')]);router['delete'](_0xb2e3('0x16'),auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x18')]);router[_0xb2e3('0x19')](_0xb2e3('0x11'),auth[_0xb2e3('0xa')](),controller['removeTeams']);router[_0xb2e3('0x19')]('/:id/users',auth[_0xb2e3('0xa')](),controller[_0xb2e3('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xd4b1=['addTeams','/:id/users','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','../../components/auth/service','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','create','post'];(function(_0x314f9f,_0x48227c){var _0x1b6484=function(_0xa3cab){while(--_0xa3cab){_0x314f9f['push'](_0x314f9f['shift']());}};_0x1b6484(++_0x48227c);}(_0xd4b1,0x17f));var _0x1d4b=function(_0x408cc5,_0x459ed9){_0x408cc5=_0x408cc5-0x0;var _0x28b5fe=_0xd4b1[_0x408cc5];return _0x28b5fe;};'use strict';var multer=require(_0x1d4b('0x0'));var util=require(_0x1d4b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1d4b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1d4b('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x1d4b('0x4')]('/',auth['isAuthenticated'](),controller[_0x1d4b('0x5')]);router['get'](_0x1d4b('0x6'),auth['isAuthenticated'](),controller[_0x1d4b('0x7')]);router[_0x1d4b('0x4')](_0x1d4b('0x8'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xa')]);router[_0x1d4b('0x4')](_0x1d4b('0xb'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xc')]);router[_0x1d4b('0x4')](_0x1d4b('0xd'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xe')]);router[_0x1d4b('0x4')]('/:id/users',auth[_0x1d4b('0x9')](),controller['getAgents']);router['post']('/',auth[_0x1d4b('0x9')](),controller[_0x1d4b('0xf')]);router[_0x1d4b('0x10')]('/:id/teams',auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x11')]);router['post'](_0x1d4b('0x12'),auth[_0x1d4b('0x9')](),controller['addAgents']);router[_0x1d4b('0x13')](_0x1d4b('0x8'),auth[_0x1d4b('0x9')](),controller['update']);router[_0x1d4b('0x14')](_0x1d4b('0x8'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x15')]);router[_0x1d4b('0x14')](_0x1d4b('0xd'),auth[_0x1d4b('0x9')](),controller[_0x1d4b('0x16')]);router[_0x1d4b('0x14')](_0x1d4b('0x12'),auth['isAuthenticated'](),controller[_0x1d4b('0x17')]);module[_0x1d4b('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 7318626..c7033db 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 _0x068e=['sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x41ba54,_0x5ce33e){var _0x4204d3=function(_0x5cc938){while(--_0x5cc938){_0x41ba54['push'](_0x41ba54['shift']());}};_0x4204d3(++_0x5ce33e);}(_0x068e,0x72));var _0xe068=function(_0x2d892d,_0x1a7264){_0x2d892d=_0x2d892d-0x0;var _0x569196=_0x068e[_0x2d892d];return _0x569196;};'use strict';var Sequelize=require(_0xe068('0x0'));module[_0xe068('0x1')]={'name':{'type':Sequelize[_0xe068('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe068('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe068('0x3')](_0xe068('0x4'),_0xe068('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xc1b8=['name','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2e571f,_0x4eeecf){var _0x49c7bd=function(_0x3dd6e4){while(--_0x3dd6e4){_0x2e571f['push'](_0x2e571f['shift']());}};_0x49c7bd(++_0x4eeecf);}(_0xc1b8,0xe6));var _0x8c1b=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc1b8[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x8c1b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8c1b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8c1b('0x2')]},'timeout':{'type':Sequelize[_0x8c1b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c1b('0x4')](_0x8c1b('0x5'),'beepall',_0x8c1b('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index c0bd2ae..33b1d68 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 _0xe5a9=['model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserOpenchannelQueue','nolimit','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','online','interface','flatMap','Agents','params','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key'];(function(_0x3406c1,_0x8d3121){var _0x3dd6df=function(_0x2ecb00){while(--_0x2ecb00){_0x3406c1['push'](_0x3406c1['shift']());}};_0x3dd6df(++_0x8d3121);}(_0xe5a9,0x16b));var _0x9e5a=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0xe5a9[_0x27097a];return _0x26378b;};'use strict';var emlformat=require(_0x9e5a('0x0'));var rimraf=require(_0x9e5a('0x1'));var zipdir=require(_0x9e5a('0x2'));var jsonpatch=require(_0x9e5a('0x3'));var rp=require(_0x9e5a('0x4'));var moment=require('moment');var BPromise=require(_0x9e5a('0x5'));var Mustache=require('mustache');var util=require(_0x9e5a('0x6'));var path=require(_0x9e5a('0x7'));var sox=require('sox');var csv=require(_0x9e5a('0x8'));var ejs=require(_0x9e5a('0x9'));var fs=require('fs');var fs_extra=require(_0x9e5a('0xa'));var _=require(_0x9e5a('0xb'));var squel=require(_0x9e5a('0xc'));var crypto=require(_0x9e5a('0xd'));var jsforce=require(_0x9e5a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9e5a('0x8'));var querystring=require('querystring');var Papa=require(_0x9e5a('0xf'));var Redis=require(_0x9e5a('0x10'));var authService=require(_0x9e5a('0x11'));var qs=require(_0x9e5a('0x12'));var as=require(_0x9e5a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e5a('0x14'))(_0x9e5a('0x15'));var utils=require(_0x9e5a('0x16'));var config=require(_0x9e5a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e5a('0x18'))['db'];config[_0x9e5a('0x19')]=_['defaults'](config[_0x9e5a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e5a('0x1a'))(new Redis(config[_0x9e5a('0x19')]));require('./openchannelQueue.socket')[_0x9e5a('0x1b')](socket);function respondWithStatusCode(_0x4265a2,_0xb6517){_0xb6517=_0xb6517||0xcc;return function(_0x3fef40){if(_0x3fef40){return _0x4265a2[_0x9e5a('0x1c')](_0xb6517);}return _0x4265a2['status'](_0xb6517)[_0x9e5a('0x1d')]();};}function respondWithResult(_0x308684,_0xe2eadc){_0xe2eadc=_0xe2eadc||0xc8;return function(_0x38c676){if(_0x38c676){return _0x308684[_0x9e5a('0x1e')](_0xe2eadc)[_0x9e5a('0x1f')](_0x38c676);}};}function respondWithFilteredResult(_0xc55663,_0x18535c){return function(_0x2549aa){if(_0x2549aa){var _0x48de03=typeof _0x18535c[_0x9e5a('0x20')]==='undefined'&&typeof _0x18535c[_0x9e5a('0x21')]==='undefined';var _0x3f8972=_0x2549aa[_0x9e5a('0x22')];var _0x4e023f=_0x48de03?0x0:_0x18535c[_0x9e5a('0x20')];var _0x3e8192=_0x48de03?_0x2549aa['count']:_0x18535c[_0x9e5a('0x20')]+_0x18535c['limit'];var _0x29a251;if(_0x3e8192>=_0x3f8972){_0x3e8192=_0x3f8972;_0x29a251=0xc8;}else{_0x29a251=0xce;}_0xc55663[_0x9e5a('0x1e')](_0x29a251);return _0xc55663['set'](_0x9e5a('0x23'),_0x4e023f+'-'+_0x3e8192+'/'+_0x3f8972)['json'](_0x2549aa);}return null;};}function patchUpdates(_0x10d1f1){return function(_0x60df8){try{jsonpatch[_0x9e5a('0x24')](_0x60df8,_0x10d1f1,!![]);}catch(_0x49a348){return BPromise['reject'](_0x49a348);}return _0x60df8[_0x9e5a('0x25')]();};}function saveUpdates(_0x3fcbd0,_0x4f86f1){return function(_0x30505b){if(_0x30505b){return _0x30505b[_0x9e5a('0x26')](_0x3fcbd0)['then'](function(_0x943cc4){return _0x943cc4;});}return null;};}function removeEntity(_0x6710cb,_0x130c4a){return function(_0x46d71a){if(_0x46d71a){return _0x46d71a[_0x9e5a('0x27')]()[_0x9e5a('0x28')](function(){var _0x3c68a1=_0x46d71a[_0x9e5a('0x29')]({'plain':!![]});var _0x460fe4=_0x9e5a('0x2a');return db[_0x9e5a('0x2b')][_0x9e5a('0x27')]({'where':{'type':_0x460fe4,'resourceId':_0x3c68a1['id']}})[_0x9e5a('0x28')](function(){return _0x46d71a;});})[_0x9e5a('0x28')](function(){_0x6710cb[_0x9e5a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd5f31,_0x381f4f){return function(_0x33fcc6){if(!_0x33fcc6){_0xfd5f31[_0x9e5a('0x1c')](0x194);}return _0x33fcc6;};}function handleError(_0x28dc8f,_0x27eda2){_0x27eda2=_0x27eda2||0x1f4;return function(_0x2e9deb){logger[_0x9e5a('0x2c')](_0x2e9deb[_0x9e5a('0x2d')]);if(_0x2e9deb[_0x9e5a('0x2e')]){delete _0x2e9deb['name'];}_0x28dc8f['status'](_0x27eda2)[_0x9e5a('0x2f')](_0x2e9deb);};}exports['index']=function(_0x376da9,_0x4315b2){var _0xdac539={},_0x25c669={},_0x510bc3={'count':0x0,'rows':[]};var _0x405d2c=_[_0x9e5a('0x30')](db[_0x9e5a('0x31')][_0x9e5a('0x32')],function(_0x1c1096){return{'name':_0x1c1096[_0x9e5a('0x33')],'type':_0x1c1096[_0x9e5a('0x34')][_0x9e5a('0x35')]};});_0x25c669[_0x9e5a('0x36')]=_[_0x9e5a('0x30')](_0x405d2c,_0x9e5a('0x2e'));_0x25c669[_0x9e5a('0x37')]=_[_0x9e5a('0x38')](_0x376da9[_0x9e5a('0x37')]);_0x25c669[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x25c669['model'],_0x25c669[_0x9e5a('0x37')]);_0xdac539[_0x9e5a('0x3b')]=_['intersection'](_0x25c669[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x376da9[_0x9e5a('0x37')]['fields']));_0xdac539[_0x9e5a('0x3b')]=_0xdac539[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0xdac539[_0x9e5a('0x3b')]:_0x25c669[_0x9e5a('0x36')];if(!_0x376da9['query']['hasOwnProperty']('nolimit')){_0xdac539['limit']=qs[_0x9e5a('0x21')](_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0xdac539[_0x9e5a('0x20')]=qs[_0x9e5a('0x20')](_0x376da9[_0x9e5a('0x37')]['offset']);}_0xdac539[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x3f')]);_0xdac539['where']=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x376da9['query'],_0x25c669['filters']),_0x405d2c);if(_0x376da9['query']['filter']){_0xdac539['where']=_[_0x9e5a('0x41')](_0xdac539['where'],{'$or':_['map'](_0x405d2c,function(_0x2c6beb){if(_0x2c6beb['type']!==_0x9e5a('0x42')){var _0x4bf81c={};_0x4bf81c[_0x2c6beb[_0x9e5a('0x2e')]]={'$like':'%'+_0x376da9[_0x9e5a('0x37')][_0x9e5a('0x43')]+'%'};return _0x4bf81c;}})});}_0xdac539=_[_0x9e5a('0x41')]({},_0xdac539,_0x376da9[_0x9e5a('0x44')]);var _0x1aa30f={'where':_0xdac539[_0x9e5a('0x45')]};return db[_0x9e5a('0x31')][_0x9e5a('0x22')](_0x1aa30f)[_0x9e5a('0x28')](function(_0x54ef76){_0x510bc3[_0x9e5a('0x22')]=_0x54ef76;if(_0x376da9[_0x9e5a('0x37')]['includeAll']){_0xdac539[_0x9e5a('0x46')]=[{'all':!![]}];}return db[_0x9e5a('0x31')][_0x9e5a('0x47')](_0xdac539);})[_0x9e5a('0x28')](function(_0x467e7f){_0x510bc3[_0x9e5a('0x48')]=_0x467e7f;return _0x510bc3;})[_0x9e5a('0x28')](respondWithFilteredResult(_0x4315b2,_0xdac539))[_0x9e5a('0x49')](handleError(_0x4315b2,null));};exports[_0x9e5a('0x4a')]=function(_0x53598f,_0x523081){var _0x55b005={'raw':!![],'where':{'id':_0x53598f['params']['id']}},_0x9c9dd0={};_0x9c9dd0[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x31')][_0x9e5a('0x32')]);_0x9c9dd0['query']=_['keys'](_0x53598f[_0x9e5a('0x37')]);_0x9c9dd0[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x9c9dd0['model'],_0x9c9dd0[_0x9e5a('0x37')]);_0x55b005['attributes']=_[_0x9e5a('0x3a')](_0x9c9dd0[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x53598f[_0x9e5a('0x37')][_0x9e5a('0x3c')]));_0x55b005['attributes']=_0x55b005[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x55b005['attributes']:_0x9c9dd0[_0x9e5a('0x36')];if(_0x53598f['query'][_0x9e5a('0x4b')]){_0x55b005[_0x9e5a('0x46')]=[{'all':!![]}];}_0x55b005=_[_0x9e5a('0x41')]({},_0x55b005,_0x53598f[_0x9e5a('0x44')]);return db[_0x9e5a('0x31')][_0x9e5a('0x4c')](_0x55b005)[_0x9e5a('0x28')](handleEntityNotFound(_0x523081,null))['then'](respondWithResult(_0x523081,null))[_0x9e5a('0x49')](handleError(_0x523081,null));};exports[_0x9e5a('0x4d')]=function(_0xe5227b,_0x1ddb09){return db[_0x9e5a('0x31')][_0x9e5a('0x4d')](_0xe5227b[_0x9e5a('0x4e')],{})[_0x9e5a('0x28')](function(_0x373250){var _0x328a32=_0xe5227b[_0x9e5a('0x4f')]['get']({'plain':!![]});if(!_0x328a32)throw new Error(_0x9e5a('0x50'));if(_0x328a32['role']===_0x9e5a('0x4f')){var _0x45e3d1=_0x373250[_0x9e5a('0x29')]({'plain':!![]});var _0x3f4997=_0x9e5a('0x2a');return db[_0x9e5a('0x51')][_0x9e5a('0x4c')]({'where':{'name':_0x3f4997,'userProfileId':_0x328a32[_0x9e5a('0x52')]},'raw':!![]})['then'](function(_0x44c155){if(_0x44c155&&_0x44c155[_0x9e5a('0x53')]===0x0){return db[_0x9e5a('0x2b')][_0x9e5a('0x4d')]({'name':_0x45e3d1[_0x9e5a('0x2e')],'resourceId':_0x45e3d1['id'],'type':_0x44c155[_0x9e5a('0x2e')],'sectionId':_0x44c155['id']},{})[_0x9e5a('0x28')](function(){return _0x373250;});}else{return _0x373250;}})['catch'](function(_0x23f306){logger[_0x9e5a('0x2c')](_0x9e5a('0x54'),_0x23f306);throw _0x23f306;});}return _0x373250;})[_0x9e5a('0x28')](respondWithResult(_0x1ddb09,0xc9))[_0x9e5a('0x49')](handleError(_0x1ddb09,null));};exports['update']=function(_0x3fb5f7,_0x4eeeee){if(_0x3fb5f7[_0x9e5a('0x4e')]['id']){delete _0x3fb5f7['body']['id'];}return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x3fb5f7['params']['id']}})['then'](handleEntityNotFound(_0x4eeeee,null))[_0x9e5a('0x28')](saveUpdates(_0x3fb5f7['body'],null))[_0x9e5a('0x28')](respondWithResult(_0x4eeeee,null))[_0x9e5a('0x49')](handleError(_0x4eeeee,null));};exports['destroy']=function(_0x136138,_0x487c79){return db['OpenchannelQueue'][_0x9e5a('0x4c')]({'where':{'id':_0x136138['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x487c79,null))[_0x9e5a('0x28')](removeEntity(_0x487c79,null))[_0x9e5a('0x49')](handleError(_0x487c79,null));};exports[_0x9e5a('0x55')]=function(_0x135def,_0x510706){return db['OpenchannelQueue'][_0x9e5a('0x55')]()['then'](respondWithResult(_0x510706,null))['catch'](handleError(_0x510706,null));};exports['getMembers']=function(_0x2a6314,_0x342b8b,_0x1bd11d){var _0x4c102c={'raw':!![],'where':{}},_0x3935fa={},_0x3c0517;return db[_0x9e5a('0x31')]['findOne']({'where':{'id':_0x2a6314['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x342b8b,null))[_0x9e5a('0x28')](function(_0x5b8ab9){if(_0x5b8ab9){_0x3c0517=_0x5b8ab9[_0x9e5a('0x29')]({'plain':!![]});_0x3935fa['model']=_['keys'](db[_0x9e5a('0x56')][_0x9e5a('0x32')]);_0x3935fa['query']=_[_0x9e5a('0x38')](_0x2a6314['query']);_0x3935fa[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x3935fa[_0x9e5a('0x36')],_0x3935fa[_0x9e5a('0x37')]);_0x4c102c[_0x9e5a('0x3b')]=_['intersection'](_0x3935fa['model'],qs[_0x9e5a('0x3c')](_0x2a6314['query']['fields']));_0x4c102c[_0x9e5a('0x3b')]=_0x4c102c[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x4c102c['attributes']:_0x3935fa['model'];if(!_0x2a6314[_0x9e5a('0x37')]['hasOwnProperty'](_0x9e5a('0x57'))){_0x4c102c[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x2a6314[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0x4c102c[_0x9e5a('0x20')]=qs[_0x9e5a('0x20')](_0x2a6314[_0x9e5a('0x37')]['offset']);}_0x4c102c[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x2a6314[_0x9e5a('0x37')]['sort']);_0x4c102c[_0x9e5a('0x45')]=qs['filters'](_[_0x9e5a('0x40')](_0x2a6314[_0x9e5a('0x37')],_0x3935fa['filters']));_0x4c102c[_0x9e5a('0x45')]['OpenchannelQueueId']=_0x5b8ab9['id'];if(_0x2a6314['query'][_0x9e5a('0x43')]){_0x4c102c['where']=_['merge'](_0x4c102c[_0x9e5a('0x45')],{'$or':_['map'](_0x4c102c[_0x9e5a('0x3b')],function(_0x40f065){var _0x4eaa62={};_0x4eaa62[_0x40f065]={'$like':'%'+_0x2a6314['query']['filter']+'%'};return _0x4eaa62;})});}_0x4c102c=_[_0x9e5a('0x41')]({},_0x4c102c,_0x2a6314[_0x9e5a('0x44')]);return db[_0x9e5a('0x56')]['findAll'](_0x4c102c);}})[_0x9e5a('0x28')](function(_0x4fcdec){if(_0x4fcdec){return db[_0x9e5a('0x58')][_0x9e5a('0x59')]({'where':{'id':_[_0x9e5a('0x30')](_0x4fcdec,_0x9e5a('0x5a')),'role':_0x9e5a('0x5b')},'attributes':['id',_0x9e5a('0x2e'),'openchannelPause',_0x9e5a('0x5c'),_0x9e5a('0x5d')]});}})[_0x9e5a('0x28')](function(_0xf3c29f){if(_0xf3c29f){return{'count':_0xf3c29f['count'],'rows':_[_0x9e5a('0x30')](_0xf3c29f[_0x9e5a('0x48')],function(_0x6365dd){return{'membername':_0x6365dd[_0x9e5a('0x2e')],'UserId':_0x6365dd['id'],'queue_name':_0x3c0517[_0x9e5a('0x2e')],'OpenchannelQueueId':_0x3c0517['id'],'interface':util[_0x9e5a('0x5e')](_0x9e5a('0x5f'),_0x9e5a('0x60'),_0x6365dd[_0x9e5a('0x2e')]),'penalty':0x0,'paused':_0x6365dd['openchannelPause'],'createdAt':_0x6365dd['createdAt'],'updatedAt':_0x6365dd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e5a('0x28')](respondWithFilteredResult(_0x342b8b,_0x4c102c))[_0x9e5a('0x49')](handleError(_0x342b8b,null));};exports[_0x9e5a('0x61')]=function(_0x9657d8,_0x1e37ff,_0x4036b7){var _0x84d16c={};var _0x54c5a9={};var _0x3a42f6;var _0x8e10ad;return db[_0x9e5a('0x31')][_0x9e5a('0x62')]({'where':{'id':_0x9657d8['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x1e37ff,null))[_0x9e5a('0x28')](function(_0x32950f){if(_0x32950f){_0x3a42f6=_0x32950f;_0x54c5a9[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x63')][_0x9e5a('0x32')]);_0x54c5a9['query']=_[_0x9e5a('0x38')](_0x9657d8[_0x9e5a('0x37')]);_0x54c5a9[_0x9e5a('0x39')]=_[_0x9e5a('0x3a')](_0x54c5a9[_0x9e5a('0x36')],_0x54c5a9['query']);_0x84d16c[_0x9e5a('0x3b')]=_[_0x9e5a('0x3a')](_0x54c5a9[_0x9e5a('0x36')],qs[_0x9e5a('0x3c')](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x3c')]));_0x84d16c[_0x9e5a('0x3b')]=_0x84d16c['attributes'][_0x9e5a('0x3d')]?_0x84d16c[_0x9e5a('0x3b')]:_0x54c5a9['model'];_0x84d16c[_0x9e5a('0x3e')]=qs[_0x9e5a('0x3f')](_0x9657d8['query']['sort']);_0x84d16c['where']=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x9657d8['query'],_0x54c5a9[_0x9e5a('0x39')]));if(_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x43')]){_0x84d16c[_0x9e5a('0x45')]=_[_0x9e5a('0x41')](_0x84d16c[_0x9e5a('0x45')],{'$or':_[_0x9e5a('0x30')](_0x84d16c[_0x9e5a('0x3b')],function(_0x20359e){var _0x5f2ad0={};_0x5f2ad0[_0x20359e]={'$like':'%'+_0x9657d8['query'][_0x9e5a('0x43')]+'%'};return _0x5f2ad0;})});}_0x84d16c=_[_0x9e5a('0x41')]({},_0x84d16c,_0x9657d8['options']);return _0x3a42f6['getTeams'](_0x84d16c);}})[_0x9e5a('0x28')](function(_0xa49063){if(_0xa49063){_0x8e10ad=_0xa49063[_0x9e5a('0x3d')];if(!_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x64')]('nolimit')){_0x84d16c[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x21')]);_0x84d16c[_0x9e5a('0x20')]=qs['offset'](_0x9657d8[_0x9e5a('0x37')][_0x9e5a('0x20')]);}return _0x3a42f6[_0x9e5a('0x61')](_0x84d16c);}})[_0x9e5a('0x28')](function(_0x5ca8c0){if(_0x5ca8c0){return _0x5ca8c0?{'count':_0x8e10ad,'rows':_0x5ca8c0}:null;}})['then'](respondWithResult(_0x1e37ff,null))[_0x9e5a('0x49')](handleError(_0x1e37ff,null));};exports[_0x9e5a('0x65')]=function(_0x4a2b79,_0x172889,_0x51d69f){var _0x2d3c07=_0x4a2b79[_0x9e5a('0x4e')][_0x9e5a('0x66')];return db[_0x9e5a('0x63')][_0x9e5a('0x47')]({'where':{'id':_0x2d3c07},'attributes':['id'],'include':[{'model':db[_0x9e5a('0x58')],'as':'Agents','attributes':['id',_0x9e5a('0x2e'),_0x9e5a('0x67'),'voicePause',_0x9e5a('0x68')],'raw':!![]}]})[_0x9e5a('0x28')](function(_0xa3bd4a){if(_0xa3bd4a){var _0xc72a92=_[_0x9e5a('0x69')](_0xa3bd4a,function(_0x5b7edf){var _0x43285f=_0x5b7edf[_0x9e5a('0x29')]({'plain':!![]});return _0x43285f[_0x9e5a('0x6a')];});return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x4a2b79[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](function(_0x37809d){return db[_0x9e5a('0x6c')][_0x9e5a('0x6d')](function(_0x10c340){return _0x37809d[_0x9e5a('0x65')](_0x2d3c07,{'transaction':_0x10c340})[_0x9e5a('0x28')](function(){return BPromise[_0x9e5a('0x6e')](_0xc72a92,function(_0x11ec59){return db[_0x9e5a('0x56')][_0x9e5a('0x6f')]({'where':{'UserId':_0x11ec59['id'],'OpenchannelQueueId':_0x4a2b79[_0x9e5a('0x6b')]['id']},'transaction':_0x10c340});});})[_0x9e5a('0x28')](function(){_0xc72a92[_0x9e5a('0x70')](function(_0x145f07){socket[_0x9e5a('0x71')](_0x9e5a('0x72'),{'UserId':_0x145f07['id'],'OpenchannelQueueId':_0x37809d['id']});});});});});}})[_0x9e5a('0x28')](respondWithStatusCode(_0x172889,null))[_0x9e5a('0x49')](handleError(_0x172889,null));};exports[_0x9e5a('0x73')]=function(_0x1e99dc,_0x32e132,_0x56e42a){return db[_0x9e5a('0x63')][_0x9e5a('0x47')]({'where':{'id':_0x1e99dc[_0x9e5a('0x37')][_0x9e5a('0x66')]},'attributes':['id'],'include':[{'model':db[_0x9e5a('0x58')],'as':_0x9e5a('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x9e5a('0x28')](handleEntityNotFound(_0x32e132,null))[_0x9e5a('0x28')](function(_0x53e32d){var _0x1a25d0=_[_0x9e5a('0x30')](_0x53e32d,'id');var _0x1f4821=[];var _0x1f917f=[];var _0x466cb2=squel['select']();_0x466cb2[_0x9e5a('0x74')](_0x9e5a('0x75'))[_0x9e5a('0x76')]('team_has_openchannel_queues','tq')[_0x9e5a('0x77')](_0x9e5a('0x78'),'ut',_0x9e5a('0x79'))[_0x9e5a('0x45')](_0x9e5a('0x7a'),_0x1e99dc[_0x9e5a('0x6b')]['id']);for(var _0x4bb190=0x0;_0x4bb190<_0x53e32d['length'];_0x4bb190+=0x1){let _0x2e0cc5=_0x53e32d[_0x4bb190];for(var _0x295a45=0x0;_0x295a45<_0x2e0cc5[_0x9e5a('0x6a')][_0x9e5a('0x3d')];_0x295a45+=0x1){let _0xd25570=_0x2e0cc5[_0x9e5a('0x6a')][_0x295a45];var _0x56bf07=_0x466cb2['clone']();_0x56bf07[_0x9e5a('0x45')](_0x9e5a('0x7b'),_0xd25570['id']);_0x1f917f[_0x9e5a('0x7c')](db[_0x9e5a('0x6c')]['query'](_0x56bf07['toString'](),{'type':db['sequelize'][_0x9e5a('0x7d')][_0x9e5a('0x7e')]})[_0x9e5a('0x28')](function(_0x2b08a1){if(_0x2b08a1[_0x9e5a('0x3d')]===0x1){return _0xd25570['id'];}else{var _0xf6f4d=_[_0x9e5a('0x7f')](_[_0x9e5a('0x30')](_0x2b08a1,_0x9e5a('0x80')),function(_0x148e5d){return _['includes'](_0x1a25d0,_0x148e5d);});if(_0xf6f4d){return _0xd25570['id'];}}}));}}return BPromise['all'](_0x1f917f)[_0x9e5a('0x28')](function(_0xca9c17){_0x1f4821=_(_0x1f4821)[_0x9e5a('0x81')](_0xca9c17)[_0x9e5a('0x82')]()[_0x9e5a('0x83')]();return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x1e99dc[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](function(_0x3f636a){return db[_0x9e5a('0x6c')][_0x9e5a('0x6d')](function(_0x53ab8d){return _0x3f636a[_0x9e5a('0x73')](_0x1e99dc[_0x9e5a('0x37')][_0x9e5a('0x66')],{'transaction':_0x53ab8d})['then'](function(){if(!_[_0x9e5a('0x84')](_0x1f4821)){return _0x3f636a['removeAgents'](_0x1f4821,{'transaction':_0x53ab8d});}})[_0x9e5a('0x28')](function(){_0x1f4821[_0x9e5a('0x70')](function(_0x4528d6){socket[_0x9e5a('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x4528d6,'OpenchannelQueueId':_0x3f636a['id']});});});});});});})[_0x9e5a('0x28')](respondWithStatusCode(_0x32e132,null))[_0x9e5a('0x49')](handleError(_0x32e132,null));};exports['addAgents']=function(_0x5a9785,_0x5478cf,_0x77a94){return db[_0x9e5a('0x31')]['find']({'where':{'id':_0x5a9785[_0x9e5a('0x6b')]['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x5478cf,null))['then'](function(_0x525437){if(_0x525437){return _0x525437['addAgents'](_0x5a9785['body'][_0x9e5a('0x66')],_[_0x9e5a('0x85')](_0x5a9785['body'],[_0x9e5a('0x66'),'id'])||{})[_0x9e5a('0x86')](function(_0x5ebf1f){for(var _0x1b9411=0x0;_0x1b9411<_0x5a9785[_0x9e5a('0x4e')][_0x9e5a('0x66')]['length'];_0x1b9411+=0x1){socket['emit'](_0x9e5a('0x72'),{'UserId':Number(_0x5a9785[_0x9e5a('0x4e')][_0x9e5a('0x66')][_0x1b9411]),'OpenchannelQueueId':Number(_0x5a9785[_0x9e5a('0x6b')]['id'])});}return _0x5ebf1f;});}})[_0x9e5a('0x28')](respondWithResult(_0x5478cf,null))[_0x9e5a('0x49')](handleError(_0x5478cf,null));};exports[_0x9e5a('0x87')]=function(_0x4f06ae,_0x31da4a,_0x15acd1){return db[_0x9e5a('0x31')][_0x9e5a('0x4c')]({'where':{'id':_0x4f06ae['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x31da4a,null))[_0x9e5a('0x28')](function(_0x2168e5){if(_0x2168e5){return _0x2168e5[_0x9e5a('0x87')](_0x4f06ae[_0x9e5a('0x37')]['ids'])['then'](function(){if(_[_0x9e5a('0x88')](_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')])){for(var _0xa1769=0x0;_0xa1769<_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')][_0x9e5a('0x3d')];_0xa1769+=0x1){socket[_0x9e5a('0x71')](_0x9e5a('0x89'),{'UserId':Number(_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')][_0xa1769]),'OpenchannelQueueId':Number(_0x4f06ae['params']['id'])});}}else{socket[_0x9e5a('0x71')](_0x9e5a('0x89'),{'UserId':Number(_0x4f06ae[_0x9e5a('0x37')][_0x9e5a('0x66')]),'OpenchannelQueueId':Number(_0x4f06ae[_0x9e5a('0x6b')]['id'])});}});}})[_0x9e5a('0x28')](respondWithStatusCode(_0x31da4a,null))['catch'](handleError(_0x31da4a,null));};exports[_0x9e5a('0x8a')]=function(_0x23b564,_0x170089,_0x2012ee){var _0x1e1e86={};var _0x249ef2={};var _0x15fa9f;var _0x4a36ae;return db[_0x9e5a('0x31')][_0x9e5a('0x62')]({'where':{'id':_0x23b564['params']['id']}})[_0x9e5a('0x28')](handleEntityNotFound(_0x170089,null))[_0x9e5a('0x28')](function(_0x253b4e){if(_0x253b4e){_0x15fa9f=_0x253b4e;_0x249ef2[_0x9e5a('0x36')]=_[_0x9e5a('0x38')](db[_0x9e5a('0x58')]['rawAttributes']);_0x249ef2[_0x9e5a('0x37')]=_[_0x9e5a('0x38')](_0x23b564[_0x9e5a('0x37')]);_0x249ef2['filters']=_[_0x9e5a('0x3a')](_0x249ef2[_0x9e5a('0x36')],_0x249ef2['query']);_0x1e1e86[_0x9e5a('0x3b')]=_[_0x9e5a('0x3a')](_0x249ef2['model'],qs[_0x9e5a('0x3c')](_0x23b564['query']['fields']));_0x1e1e86[_0x9e5a('0x3b')]=_0x1e1e86[_0x9e5a('0x3b')][_0x9e5a('0x3d')]?_0x1e1e86[_0x9e5a('0x3b')]:_0x249ef2[_0x9e5a('0x36')];_0x1e1e86['order']=qs[_0x9e5a('0x3f')](_0x23b564[_0x9e5a('0x37')]['sort']);_0x1e1e86[_0x9e5a('0x45')]=qs[_0x9e5a('0x39')](_[_0x9e5a('0x40')](_0x23b564[_0x9e5a('0x37')],_0x249ef2[_0x9e5a('0x39')]));if(_0x23b564[_0x9e5a('0x37')][_0x9e5a('0x43')]){_0x1e1e86['where']=_[_0x9e5a('0x41')](_0x1e1e86['where'],{'$or':_[_0x9e5a('0x30')](_0x1e1e86['attributes'],function(_0x1f6ef9){var _0x1d7203={};_0x1d7203[_0x1f6ef9]={'$like':'%'+_0x23b564['query']['filter']+'%'};return _0x1d7203;})});}_0x1e1e86=_[_0x9e5a('0x41')]({},_0x1e1e86,_0x23b564[_0x9e5a('0x44')]);return _0x15fa9f[_0x9e5a('0x8a')](_0x1e1e86);}})[_0x9e5a('0x28')](function(_0xb66903){if(_0xb66903){_0x4a36ae=_0xb66903[_0x9e5a('0x3d')];if(!_0x23b564[_0x9e5a('0x37')][_0x9e5a('0x64')]('nolimit')){_0x1e1e86[_0x9e5a('0x21')]=qs[_0x9e5a('0x21')](_0x23b564['query'][_0x9e5a('0x21')]);_0x1e1e86['offset']=qs['offset'](_0x23b564['query'][_0x9e5a('0x20')]);}return _0x15fa9f['getAgents'](_0x1e1e86);}})['then'](function(_0x3f3c9c){if(_0x3f3c9c){return _0x3f3c9c?{'count':_0x4a36ae,'rows':_0x3f3c9c}:null;}})['then'](respondWithResult(_0x170089,null))[_0x9e5a('0x49')](handleError(_0x170089,null));}; \ No newline at end of file +var _0x5e01=['autoAssociation','params','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','openchannelPause','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','findOrCreate','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','compact','transaction','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','name','filter','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5e01,0x1ea));var _0x15e0=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0x5e01[_0x335271];return _0xa9fff8;};'use strict';var emlformat=require(_0x15e0('0x0'));var rimraf=require(_0x15e0('0x1'));var zipdir=require(_0x15e0('0x2'));var jsonpatch=require(_0x15e0('0x3'));var rp=require(_0x15e0('0x4'));var moment=require(_0x15e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x15e0('0x6'));var util=require('util');var path=require(_0x15e0('0x7'));var sox=require(_0x15e0('0x8'));var csv=require(_0x15e0('0x9'));var ejs=require(_0x15e0('0xa'));var fs=require('fs');var fs_extra=require(_0x15e0('0xb'));var _=require('lodash');var squel=require(_0x15e0('0xc'));var crypto=require(_0x15e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x15e0('0xe'));var toCsv=require(_0x15e0('0x9'));var querystring=require(_0x15e0('0xf'));var Papa=require(_0x15e0('0x10'));var Redis=require(_0x15e0('0x11'));var authService=require(_0x15e0('0x12'));var qs=require(_0x15e0('0x13'));var as=require(_0x15e0('0x14'));var hardwareService=require(_0x15e0('0x15'));var logger=require(_0x15e0('0x16'))(_0x15e0('0x17'));var utils=require('../../config/utils');var config=require(_0x15e0('0x18'));var licenseUtil=require(_0x15e0('0x19'));var db=require(_0x15e0('0x1a'))['db'];config[_0x15e0('0x1b')]=_[_0x15e0('0x1c')](config[_0x15e0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x15e0('0x1d'))(new Redis(config[_0x15e0('0x1b')]));require('./openchannelQueue.socket')[_0x15e0('0x1e')](socket);function respondWithStatusCode(_0x2350ce,_0x48b581){_0x48b581=_0x48b581||0xcc;return function(_0x4976d2){if(_0x4976d2){return _0x2350ce[_0x15e0('0x1f')](_0x48b581);}return _0x2350ce[_0x15e0('0x20')](_0x48b581)[_0x15e0('0x21')]();};}function respondWithResult(_0x37b031,_0x1aecce){_0x1aecce=_0x1aecce||0xc8;return function(_0x1acb58){if(_0x1acb58){return _0x37b031[_0x15e0('0x20')](_0x1aecce)['json'](_0x1acb58);}};}function respondWithFilteredResult(_0x40d8a2,_0x500a27){return function(_0x58b997){if(_0x58b997){var _0xfd9480=typeof _0x500a27[_0x15e0('0x22')]===_0x15e0('0x23')&&typeof _0x500a27['limit']===_0x15e0('0x23');var _0x4be877=_0x58b997[_0x15e0('0x24')];var _0x411466=_0xfd9480?0x0:_0x500a27[_0x15e0('0x22')];var _0x42e56f=_0xfd9480?_0x58b997[_0x15e0('0x24')]:_0x500a27['offset']+_0x500a27[_0x15e0('0x25')];var _0x3d8cfe;if(_0x42e56f>=_0x4be877){_0x42e56f=_0x4be877;_0x3d8cfe=0xc8;}else{_0x3d8cfe=0xce;}_0x40d8a2[_0x15e0('0x20')](_0x3d8cfe);return _0x40d8a2['set']('Content-Range',_0x411466+'-'+_0x42e56f+'/'+_0x4be877)[_0x15e0('0x26')](_0x58b997);}return null;};}function patchUpdates(_0x3a0ad8){return function(_0x4200aa){try{jsonpatch[_0x15e0('0x27')](_0x4200aa,_0x3a0ad8,!![]);}catch(_0x13fff1){return BPromise[_0x15e0('0x28')](_0x13fff1);}return _0x4200aa['save']();};}function saveUpdates(_0x4d8b98,_0x3adc86){return function(_0x38d092){if(_0x38d092){return _0x38d092[_0x15e0('0x29')](_0x4d8b98)['then'](function(_0x1f6c2f){return _0x1f6c2f;});}return null;};}function removeEntity(_0x194b4c,_0x3b59ff){return function(_0x37aa3b){if(_0x37aa3b){return _0x37aa3b['destroy']()[_0x15e0('0x2a')](function(){var _0x13415d=_0x37aa3b[_0x15e0('0x2b')]({'plain':!![]});var _0x1581b4=_0x15e0('0x2c');return db[_0x15e0('0x2d')][_0x15e0('0x2e')]({'where':{'type':_0x1581b4,'resourceId':_0x13415d['id']}})['then'](function(){return _0x37aa3b;});})[_0x15e0('0x2a')](function(){_0x194b4c[_0x15e0('0x20')](0xcc)[_0x15e0('0x21')]();});}};}function handleEntityNotFound(_0x462ecd,_0x3cff5f){return function(_0x12e326){if(!_0x12e326){_0x462ecd[_0x15e0('0x1f')](0x194);}return _0x12e326;};}function handleError(_0x354a07,_0x405864){_0x405864=_0x405864||0x1f4;return function(_0x18b589){logger[_0x15e0('0x2f')](_0x18b589[_0x15e0('0x30')]);if(_0x18b589['name']){delete _0x18b589['name'];}_0x354a07[_0x15e0('0x20')](_0x405864)[_0x15e0('0x31')](_0x18b589);};}exports[_0x15e0('0x32')]=function(_0x15e582,_0xf5f771){var _0x22c41d={},_0x11666a={},_0x20d71d={'count':0x0,'rows':[]};var _0x194582=_[_0x15e0('0x33')](db[_0x15e0('0x34')][_0x15e0('0x35')],function(_0x543599){return{'name':_0x543599[_0x15e0('0x36')],'type':_0x543599[_0x15e0('0x37')][_0x15e0('0x38')]};});_0x11666a[_0x15e0('0x39')]=_[_0x15e0('0x33')](_0x194582,'name');_0x11666a['query']=_['keys'](_0x15e582[_0x15e0('0x3a')]);_0x11666a['filters']=_[_0x15e0('0x3b')](_0x11666a['model'],_0x11666a[_0x15e0('0x3a')]);_0x22c41d[_0x15e0('0x3c')]=_['intersection'](_0x11666a[_0x15e0('0x39')],qs[_0x15e0('0x3d')](_0x15e582[_0x15e0('0x3a')][_0x15e0('0x3d')]));_0x22c41d['attributes']=_0x22c41d[_0x15e0('0x3c')][_0x15e0('0x3e')]?_0x22c41d['attributes']:_0x11666a['model'];if(!_0x15e582['query'][_0x15e0('0x3f')](_0x15e0('0x40'))){_0x22c41d[_0x15e0('0x25')]=qs[_0x15e0('0x25')](_0x15e582[_0x15e0('0x3a')][_0x15e0('0x25')]);_0x22c41d['offset']=qs[_0x15e0('0x22')](_0x15e582['query'][_0x15e0('0x22')]);}_0x22c41d[_0x15e0('0x41')]=qs[_0x15e0('0x42')](_0x15e582[_0x15e0('0x3a')][_0x15e0('0x42')]);_0x22c41d[_0x15e0('0x43')]=qs[_0x15e0('0x44')](_[_0x15e0('0x45')](_0x15e582[_0x15e0('0x3a')],_0x11666a[_0x15e0('0x44')]),_0x194582);if(_0x15e582['query']['filter']){_0x22c41d[_0x15e0('0x43')]=_[_0x15e0('0x46')](_0x22c41d[_0x15e0('0x43')],{'$or':_[_0x15e0('0x33')](_0x194582,function(_0x3fc2b8){if(_0x3fc2b8[_0x15e0('0x37')]!==_0x15e0('0x47')){var _0x209674={};_0x209674[_0x3fc2b8[_0x15e0('0x48')]]={'$like':'%'+_0x15e582[_0x15e0('0x3a')][_0x15e0('0x49')]+'%'};return _0x209674;}})});}_0x22c41d=_[_0x15e0('0x46')]({},_0x22c41d,_0x15e582[_0x15e0('0x4a')]);var _0x5d216a={'where':_0x22c41d[_0x15e0('0x43')]};return db['OpenchannelQueue'][_0x15e0('0x24')](_0x5d216a)[_0x15e0('0x2a')](function(_0x4f45c4){_0x20d71d[_0x15e0('0x24')]=_0x4f45c4;if(_0x15e582[_0x15e0('0x3a')]['includeAll']){_0x22c41d[_0x15e0('0x4b')]=[{'all':!![]}];}return db[_0x15e0('0x34')][_0x15e0('0x4c')](_0x22c41d);})[_0x15e0('0x2a')](function(_0xf2f3dc){_0x20d71d[_0x15e0('0x4d')]=_0xf2f3dc;return _0x20d71d;})[_0x15e0('0x2a')](respondWithFilteredResult(_0xf5f771,_0x22c41d))[_0x15e0('0x4e')](handleError(_0xf5f771,null));};exports[_0x15e0('0x4f')]=function(_0xc8f385,_0x2c7e41){var _0x48b2fc={'raw':!![],'where':{'id':_0xc8f385['params']['id']}},_0x4ef912={};_0x4ef912[_0x15e0('0x39')]=_[_0x15e0('0x50')](db['OpenchannelQueue']['rawAttributes']);_0x4ef912['query']=_[_0x15e0('0x50')](_0xc8f385[_0x15e0('0x3a')]);_0x4ef912[_0x15e0('0x44')]=_[_0x15e0('0x3b')](_0x4ef912['model'],_0x4ef912[_0x15e0('0x3a')]);_0x48b2fc[_0x15e0('0x3c')]=_[_0x15e0('0x3b')](_0x4ef912['model'],qs[_0x15e0('0x3d')](_0xc8f385['query'][_0x15e0('0x3d')]));_0x48b2fc['attributes']=_0x48b2fc[_0x15e0('0x3c')][_0x15e0('0x3e')]?_0x48b2fc[_0x15e0('0x3c')]:_0x4ef912[_0x15e0('0x39')];if(_0xc8f385[_0x15e0('0x3a')][_0x15e0('0x51')]){_0x48b2fc['include']=[{'all':!![]}];}_0x48b2fc=_[_0x15e0('0x46')]({},_0x48b2fc,_0xc8f385[_0x15e0('0x4a')]);return db['OpenchannelQueue'][_0x15e0('0x52')](_0x48b2fc)[_0x15e0('0x2a')](handleEntityNotFound(_0x2c7e41,null))[_0x15e0('0x2a')](respondWithResult(_0x2c7e41,null))[_0x15e0('0x4e')](handleError(_0x2c7e41,null));};exports[_0x15e0('0x53')]=function(_0x4424d5,_0x4976ea){return db[_0x15e0('0x34')][_0x15e0('0x53')](_0x4424d5[_0x15e0('0x54')],{})[_0x15e0('0x2a')](function(_0x424e54){var _0x31e2ac=_0x4424d5[_0x15e0('0x55')][_0x15e0('0x2b')]({'plain':!![]});if(!_0x31e2ac)throw new Error(_0x15e0('0x56'));if(_0x31e2ac[_0x15e0('0x57')]==='user'){var _0x76e50c=_0x424e54[_0x15e0('0x2b')]({'plain':!![]});var _0x127c28=_0x15e0('0x2c');return db[_0x15e0('0x58')][_0x15e0('0x52')]({'where':{'name':_0x127c28,'userProfileId':_0x31e2ac[_0x15e0('0x59')]},'raw':!![]})[_0x15e0('0x2a')](function(_0x385a7f){if(_0x385a7f&&_0x385a7f[_0x15e0('0x5a')]===0x0){return db[_0x15e0('0x2d')][_0x15e0('0x53')]({'name':_0x76e50c['name'],'resourceId':_0x76e50c['id'],'type':_0x385a7f[_0x15e0('0x48')],'sectionId':_0x385a7f['id']},{})['then'](function(){return _0x424e54;});}else{return _0x424e54;}})[_0x15e0('0x4e')](function(_0x557165){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x557165);throw _0x557165;});}return _0x424e54;})[_0x15e0('0x2a')](respondWithResult(_0x4976ea,0xc9))[_0x15e0('0x4e')](handleError(_0x4976ea,null));};exports[_0x15e0('0x29')]=function(_0x2217dd,_0x448bbe){if(_0x2217dd[_0x15e0('0x54')]['id']){delete _0x2217dd[_0x15e0('0x54')]['id'];}return db[_0x15e0('0x34')]['find']({'where':{'id':_0x2217dd[_0x15e0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x448bbe,null))[_0x15e0('0x2a')](saveUpdates(_0x2217dd[_0x15e0('0x54')],null))[_0x15e0('0x2a')](respondWithResult(_0x448bbe,null))[_0x15e0('0x4e')](handleError(_0x448bbe,null));};exports['destroy']=function(_0x5af9a2,_0xf3ed43){return db['OpenchannelQueue']['find']({'where':{'id':_0x5af9a2['params']['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0xf3ed43,null))[_0x15e0('0x2a')](removeEntity(_0xf3ed43,null))[_0x15e0('0x4e')](handleError(_0xf3ed43,null));};exports[_0x15e0('0x5c')]=function(_0x4afd59,_0x1f406a){return db[_0x15e0('0x34')][_0x15e0('0x5c')]()['then'](respondWithResult(_0x1f406a,null))[_0x15e0('0x4e')](handleError(_0x1f406a,null));};exports[_0x15e0('0x5d')]=function(_0x5b7e5a,_0x308ca7,_0xbca83a){var _0xba8336={'raw':!![],'where':{}},_0x352f55={},_0x1d98c4;return db[_0x15e0('0x34')][_0x15e0('0x5e')]({'where':{'id':_0x5b7e5a[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0x308ca7,null))[_0x15e0('0x2a')](function(_0x1fdcfd){if(_0x1fdcfd){_0x1d98c4=_0x1fdcfd['get']({'plain':!![]});_0x352f55[_0x15e0('0x39')]=_['keys'](db[_0x15e0('0x5f')][_0x15e0('0x35')]);_0x352f55[_0x15e0('0x3a')]=_[_0x15e0('0x50')](_0x5b7e5a[_0x15e0('0x3a')]);_0x352f55[_0x15e0('0x44')]=_[_0x15e0('0x3b')](_0x352f55[_0x15e0('0x39')],_0x352f55['query']);_0xba8336[_0x15e0('0x3c')]=_[_0x15e0('0x3b')](_0x352f55[_0x15e0('0x39')],qs[_0x15e0('0x3d')](_0x5b7e5a[_0x15e0('0x3a')][_0x15e0('0x3d')]));_0xba8336[_0x15e0('0x3c')]=_0xba8336[_0x15e0('0x3c')][_0x15e0('0x3e')]?_0xba8336['attributes']:_0x352f55[_0x15e0('0x39')];if(!_0x5b7e5a[_0x15e0('0x3a')][_0x15e0('0x3f')]('nolimit')){_0xba8336[_0x15e0('0x25')]=qs[_0x15e0('0x25')](_0x5b7e5a[_0x15e0('0x3a')]['limit']);_0xba8336[_0x15e0('0x22')]=qs[_0x15e0('0x22')](_0x5b7e5a[_0x15e0('0x3a')][_0x15e0('0x22')]);}_0xba8336[_0x15e0('0x41')]=qs[_0x15e0('0x42')](_0x5b7e5a[_0x15e0('0x3a')]['sort']);_0xba8336[_0x15e0('0x43')]=qs[_0x15e0('0x44')](_[_0x15e0('0x45')](_0x5b7e5a['query'],_0x352f55[_0x15e0('0x44')]));_0xba8336['where'][_0x15e0('0x60')]=_0x1fdcfd['id'];if(_0x5b7e5a[_0x15e0('0x3a')]['filter']){_0xba8336[_0x15e0('0x43')]=_[_0x15e0('0x46')](_0xba8336['where'],{'$or':_[_0x15e0('0x33')](_0xba8336[_0x15e0('0x3c')],function(_0x360dd2){var _0x5181dc={};_0x5181dc[_0x360dd2]={'$like':'%'+_0x5b7e5a[_0x15e0('0x3a')][_0x15e0('0x49')]+'%'};return _0x5181dc;})});}_0xba8336=_[_0x15e0('0x46')]({},_0xba8336,_0x5b7e5a['options']);return db['UserOpenchannelQueue'][_0x15e0('0x4c')](_0xba8336);}})[_0x15e0('0x2a')](function(_0x284cb4){if(_0x284cb4){return db[_0x15e0('0x61')][_0x15e0('0x62')]({'where':{'id':_[_0x15e0('0x33')](_0x284cb4,'UserId'),'role':_0x15e0('0x63')},'attributes':['id','name','openchannelPause',_0x15e0('0x64'),_0x15e0('0x65')]});}})['then'](function(_0x28a89c){if(_0x28a89c){return{'count':_0x28a89c[_0x15e0('0x24')],'rows':_[_0x15e0('0x33')](_0x28a89c[_0x15e0('0x4d')],function(_0x96b6f6){return{'membername':_0x96b6f6['name'],'UserId':_0x96b6f6['id'],'queue_name':_0x1d98c4[_0x15e0('0x48')],'OpenchannelQueueId':_0x1d98c4['id'],'interface':util[_0x15e0('0x66')](_0x15e0('0x67'),'SIP',_0x96b6f6[_0x15e0('0x48')]),'penalty':0x0,'paused':_0x96b6f6[_0x15e0('0x68')],'createdAt':_0x96b6f6[_0x15e0('0x65')],'updatedAt':_0x96b6f6[_0x15e0('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x308ca7,_0xba8336))[_0x15e0('0x4e')](handleError(_0x308ca7,null));};exports[_0x15e0('0x69')]=function(_0x1a51f5,_0x4bd682,_0x635ae9){var _0x113660={};var _0x14cc1f={};var _0x10ef21;var _0x26d78b;return db[_0x15e0('0x34')][_0x15e0('0x5e')]({'where':{'id':_0x1a51f5[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0x4bd682,null))['then'](function(_0x19d0fe){if(_0x19d0fe){_0x10ef21=_0x19d0fe;_0x14cc1f[_0x15e0('0x39')]=_[_0x15e0('0x50')](db[_0x15e0('0x6a')][_0x15e0('0x35')]);_0x14cc1f['query']=_[_0x15e0('0x50')](_0x1a51f5[_0x15e0('0x3a')]);_0x14cc1f[_0x15e0('0x44')]=_[_0x15e0('0x3b')](_0x14cc1f[_0x15e0('0x39')],_0x14cc1f['query']);_0x113660[_0x15e0('0x3c')]=_[_0x15e0('0x3b')](_0x14cc1f[_0x15e0('0x39')],qs['fields'](_0x1a51f5['query'][_0x15e0('0x3d')]));_0x113660['attributes']=_0x113660[_0x15e0('0x3c')][_0x15e0('0x3e')]?_0x113660[_0x15e0('0x3c')]:_0x14cc1f['model'];_0x113660['order']=qs[_0x15e0('0x42')](_0x1a51f5['query']['sort']);_0x113660[_0x15e0('0x43')]=qs[_0x15e0('0x44')](_[_0x15e0('0x45')](_0x1a51f5['query'],_0x14cc1f[_0x15e0('0x44')]));if(_0x1a51f5[_0x15e0('0x3a')][_0x15e0('0x49')]){_0x113660['where']=_['merge'](_0x113660[_0x15e0('0x43')],{'$or':_[_0x15e0('0x33')](_0x113660[_0x15e0('0x3c')],function(_0xe8b365){var _0x57fd5d={};_0x57fd5d[_0xe8b365]={'$like':'%'+_0x1a51f5[_0x15e0('0x3a')][_0x15e0('0x49')]+'%'};return _0x57fd5d;})});}_0x113660=_['merge']({},_0x113660,_0x1a51f5[_0x15e0('0x4a')]);return _0x10ef21[_0x15e0('0x69')](_0x113660);}})[_0x15e0('0x2a')](function(_0x3589aa){if(_0x3589aa){_0x26d78b=_0x3589aa[_0x15e0('0x3e')];if(!_0x1a51f5[_0x15e0('0x3a')][_0x15e0('0x3f')](_0x15e0('0x40'))){_0x113660['limit']=qs[_0x15e0('0x25')](_0x1a51f5[_0x15e0('0x3a')][_0x15e0('0x25')]);_0x113660['offset']=qs[_0x15e0('0x22')](_0x1a51f5[_0x15e0('0x3a')]['offset']);}return _0x10ef21[_0x15e0('0x69')](_0x113660);}})[_0x15e0('0x2a')](function(_0x2fe6db){if(_0x2fe6db){return _0x2fe6db?{'count':_0x26d78b,'rows':_0x2fe6db}:null;}})['then'](respondWithResult(_0x4bd682,null))[_0x15e0('0x4e')](handleError(_0x4bd682,null));};exports['addTeams']=function(_0x5d1e44,_0x2a4941,_0x31ec0f){var _0x2a6b3f=_0x5d1e44[_0x15e0('0x54')][_0x15e0('0x6b')];return db['Team'][_0x15e0('0x4c')]({'where':{'id':_0x2a6b3f},'attributes':['id'],'include':[{'model':db[_0x15e0('0x61')],'as':'Agents','attributes':['id',_0x15e0('0x48'),_0x15e0('0x6c'),_0x15e0('0x6d'),_0x15e0('0x6e')],'raw':!![]}]})[_0x15e0('0x2a')](function(_0x174100){if(_0x174100){var _0x617295=_[_0x15e0('0x6f')](_0x174100,function(_0x2c8d02){var _0x5b78d3=_0x2c8d02[_0x15e0('0x2b')]({'plain':!![]});return _0x5b78d3[_0x15e0('0x70')];});return db[_0x15e0('0x34')][_0x15e0('0x52')]({'where':{'id':_0x5d1e44[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](function(_0x318054){return db[_0x15e0('0x71')]['transaction'](function(_0x376364){return _0x318054[_0x15e0('0x72')](_0x2a6b3f,{'transaction':_0x376364})[_0x15e0('0x2a')](function(){return BPromise['each'](_0x617295,function(_0x444f2c){return db[_0x15e0('0x5f')][_0x15e0('0x73')]({'where':{'UserId':_0x444f2c['id'],'OpenchannelQueueId':_0x5d1e44[_0x15e0('0x5b')]['id']},'transaction':_0x376364});});})[_0x15e0('0x2a')](function(){_0x617295['forEach'](function(_0x4ae8cf){socket[_0x15e0('0x74')]('userOpenchannelQueue:save',{'UserId':_0x4ae8cf['id'],'OpenchannelQueueId':_0x318054['id']});});});});});}})[_0x15e0('0x2a')](respondWithStatusCode(_0x2a4941,null))['catch'](handleError(_0x2a4941,null));};exports['removeTeams']=function(_0x5bd43f,_0x4e9c43,_0x5b7c28){return db['Team'][_0x15e0('0x4c')]({'where':{'id':_0x5bd43f[_0x15e0('0x3a')][_0x15e0('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x15e0('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x15e0('0x2a')](handleEntityNotFound(_0x4e9c43,null))[_0x15e0('0x2a')](function(_0x1306c1){var _0x3580e0=_[_0x15e0('0x33')](_0x1306c1,'id');var _0x179812=[];var _0x535d41=[];var _0x51904f=squel[_0x15e0('0x75')]();_0x51904f[_0x15e0('0x76')](_0x15e0('0x77'))[_0x15e0('0x78')](_0x15e0('0x79'),'tq')['join'](_0x15e0('0x7a'),'ut',_0x15e0('0x7b'))[_0x15e0('0x43')](_0x15e0('0x7c'),_0x5bd43f['params']['id']);for(var _0x10f405=0x0;_0x10f405<_0x1306c1[_0x15e0('0x3e')];_0x10f405+=0x1){let _0x3c5353=_0x1306c1[_0x10f405];for(var _0xd54cc6=0x0;_0xd54cc6<_0x3c5353[_0x15e0('0x70')]['length'];_0xd54cc6+=0x1){let _0x5d6dda=_0x3c5353['Agents'][_0xd54cc6];var _0x58db55=_0x51904f[_0x15e0('0x7d')]();_0x58db55[_0x15e0('0x43')](_0x15e0('0x7e'),_0x5d6dda['id']);_0x535d41[_0x15e0('0x7f')](db[_0x15e0('0x71')][_0x15e0('0x3a')](_0x58db55[_0x15e0('0x80')](),{'type':db[_0x15e0('0x71')][_0x15e0('0x81')]['SELECT']})[_0x15e0('0x2a')](function(_0x3ebed0){if(_0x3ebed0['length']===0x1){return _0x5d6dda['id'];}else{var _0x4f8b8a=_[_0x15e0('0x82')](_[_0x15e0('0x33')](_0x3ebed0,'TeamId'),function(_0x1f9ef3){return _['includes'](_0x3580e0,_0x1f9ef3);});if(_0x4f8b8a){return _0x5d6dda['id'];}}}));}}return BPromise[_0x15e0('0x83')](_0x535d41)[_0x15e0('0x2a')](function(_0x353468){_0x179812=_(_0x179812)['union'](_0x353468)[_0x15e0('0x84')]()['value']();return db['OpenchannelQueue']['find']({'where':{'id':_0x5bd43f[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](function(_0x344ab7){return db['sequelize'][_0x15e0('0x85')](function(_0x16e8c9){return _0x344ab7[_0x15e0('0x86')](_0x5bd43f['query'][_0x15e0('0x6b')],{'transaction':_0x16e8c9})['then'](function(){if(!_[_0x15e0('0x87')](_0x179812)){return _0x344ab7[_0x15e0('0x88')](_0x179812,{'transaction':_0x16e8c9});}})[_0x15e0('0x2a')](function(){_0x179812[_0x15e0('0x89')](function(_0x3db91a){socket[_0x15e0('0x74')](_0x15e0('0x8a'),{'UserId':_0x3db91a,'OpenchannelQueueId':_0x344ab7['id']});});});});});});})[_0x15e0('0x2a')](respondWithStatusCode(_0x4e9c43,null))[_0x15e0('0x4e')](handleError(_0x4e9c43,null));};exports[_0x15e0('0x8b')]=function(_0x2b47e6,_0x47e071,_0x16a3f4){return db[_0x15e0('0x34')][_0x15e0('0x52')]({'where':{'id':_0x2b47e6[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0x47e071,null))[_0x15e0('0x2a')](function(_0x30427b){if(_0x30427b){return _0x30427b[_0x15e0('0x8b')](_0x2b47e6[_0x15e0('0x54')][_0x15e0('0x6b')],_[_0x15e0('0x8c')](_0x2b47e6[_0x15e0('0x54')],[_0x15e0('0x6b'),'id'])||{})[_0x15e0('0x8d')](function(_0x49f309){for(var _0xf81206=0x0;_0xf81206<_0x2b47e6[_0x15e0('0x54')]['ids'][_0x15e0('0x3e')];_0xf81206+=0x1){socket[_0x15e0('0x74')](_0x15e0('0x8e'),{'UserId':Number(_0x2b47e6[_0x15e0('0x54')][_0x15e0('0x6b')][_0xf81206]),'OpenchannelQueueId':Number(_0x2b47e6['params']['id'])});}return _0x49f309;});}})[_0x15e0('0x2a')](respondWithResult(_0x47e071,null))[_0x15e0('0x4e')](handleError(_0x47e071,null));};exports[_0x15e0('0x88')]=function(_0x1e085e,_0x59e823,_0x277312){return db[_0x15e0('0x34')][_0x15e0('0x52')]({'where':{'id':_0x1e085e[_0x15e0('0x5b')]['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0x59e823,null))[_0x15e0('0x2a')](function(_0x3e16b4){if(_0x3e16b4){return _0x3e16b4[_0x15e0('0x88')](_0x1e085e['query'][_0x15e0('0x6b')])[_0x15e0('0x2a')](function(){if(_[_0x15e0('0x8f')](_0x1e085e[_0x15e0('0x3a')][_0x15e0('0x6b')])){for(var _0x14fd6f=0x0;_0x14fd6f<_0x1e085e['query'][_0x15e0('0x6b')][_0x15e0('0x3e')];_0x14fd6f+=0x1){socket[_0x15e0('0x74')](_0x15e0('0x8a'),{'UserId':Number(_0x1e085e['query'][_0x15e0('0x6b')][_0x14fd6f]),'OpenchannelQueueId':Number(_0x1e085e[_0x15e0('0x5b')]['id'])});}}else{socket[_0x15e0('0x74')](_0x15e0('0x8a'),{'UserId':Number(_0x1e085e['query'][_0x15e0('0x6b')]),'OpenchannelQueueId':Number(_0x1e085e[_0x15e0('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x59e823,null))[_0x15e0('0x4e')](handleError(_0x59e823,null));};exports[_0x15e0('0x90')]=function(_0x28f906,_0x4bcb73,_0x2c430f){var _0x251d5b={};var _0x4a7670={};var _0x7beb99;var _0x12c7f0;return db['OpenchannelQueue'][_0x15e0('0x5e')]({'where':{'id':_0x28f906['params']['id']}})[_0x15e0('0x2a')](handleEntityNotFound(_0x4bcb73,null))[_0x15e0('0x2a')](function(_0x20259c){if(_0x20259c){_0x7beb99=_0x20259c;_0x4a7670[_0x15e0('0x39')]=_['keys'](db[_0x15e0('0x61')][_0x15e0('0x35')]);_0x4a7670[_0x15e0('0x3a')]=_[_0x15e0('0x50')](_0x28f906[_0x15e0('0x3a')]);_0x4a7670[_0x15e0('0x44')]=_['intersection'](_0x4a7670['model'],_0x4a7670['query']);_0x251d5b['attributes']=_[_0x15e0('0x3b')](_0x4a7670[_0x15e0('0x39')],qs[_0x15e0('0x3d')](_0x28f906[_0x15e0('0x3a')][_0x15e0('0x3d')]));_0x251d5b[_0x15e0('0x3c')]=_0x251d5b['attributes']['length']?_0x251d5b[_0x15e0('0x3c')]:_0x4a7670['model'];_0x251d5b[_0x15e0('0x41')]=qs['sort'](_0x28f906[_0x15e0('0x3a')]['sort']);_0x251d5b['where']=qs[_0x15e0('0x44')](_['pick'](_0x28f906[_0x15e0('0x3a')],_0x4a7670[_0x15e0('0x44')]));if(_0x28f906['query'][_0x15e0('0x49')]){_0x251d5b['where']=_[_0x15e0('0x46')](_0x251d5b[_0x15e0('0x43')],{'$or':_['map'](_0x251d5b[_0x15e0('0x3c')],function(_0x4670af){var _0x5d4f39={};_0x5d4f39[_0x4670af]={'$like':'%'+_0x28f906[_0x15e0('0x3a')][_0x15e0('0x49')]+'%'};return _0x5d4f39;})});}_0x251d5b=_[_0x15e0('0x46')]({},_0x251d5b,_0x28f906[_0x15e0('0x4a')]);return _0x7beb99['getAgents'](_0x251d5b);}})[_0x15e0('0x2a')](function(_0x54d3f4){if(_0x54d3f4){_0x12c7f0=_0x54d3f4['length'];if(!_0x28f906['query']['hasOwnProperty'](_0x15e0('0x40'))){_0x251d5b[_0x15e0('0x25')]=qs[_0x15e0('0x25')](_0x28f906['query'][_0x15e0('0x25')]);_0x251d5b[_0x15e0('0x22')]=qs[_0x15e0('0x22')](_0x28f906['query'][_0x15e0('0x22')]);}return _0x7beb99['getAgents'](_0x251d5b);}})['then'](function(_0x18aa01){if(_0x18aa01){return _0x18aa01?{'count':_0x12c7f0,'rows':_0x18aa01}:null;}})[_0x15e0('0x2a')](respondWithResult(_0x4bcb73,null))['catch'](handleError(_0x4bcb73,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index db95b26..1da2e7b 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 _0xa4e8=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x35173b,_0x16711b){var _0x51cdf4=function(_0x144c21){while(--_0x144c21){_0x35173b['push'](_0x35173b['shift']());}};_0x51cdf4(++_0x16711b);}(_0xa4e8,0x99));var _0x8a4e=function(_0x5a2ff8,_0x58811d){_0x5a2ff8=_0x5a2ff8-0x0;var _0x55ebf8=_0xa4e8[_0x5a2ff8];return _0x55ebf8;};'use strict';var EventEmitter=require(_0x8a4e('0x0'));var OpenchannelQueue=require(_0x8a4e('0x1'))['db'][_0x8a4e('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8a4e('0x3')](0x0);var events={'afterCreate':_0x8a4e('0x4'),'afterUpdate':'update','afterDestroy':_0x8a4e('0x5')};function emitEvent(_0x29c726){return function(_0x36936f,_0x549088,_0x1883eb){OpenchannelQueueEvents[_0x8a4e('0x6')](_0x29c726+':'+_0x36936f['id'],_0x36936f);OpenchannelQueueEvents[_0x8a4e('0x6')](_0x29c726,_0x36936f);_0x1883eb(null);};}for(var e in events){if(events[_0x8a4e('0x7')](e)){var event=events[e];OpenchannelQueue[_0x8a4e('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x2209=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x15fa45,_0x132622){var _0x3e7413=function(_0xba8cb9){while(--_0xba8cb9){_0x15fa45['push'](_0x15fa45['shift']());}};_0x3e7413(++_0x132622);}(_0x2209,0xf9));var _0x9220=function(_0xfdcc53,_0x2b5d47){_0xfdcc53=_0xfdcc53-0x0;var _0x40a609=_0x2209[_0xfdcc53];return _0x40a609;};'use strict';var EventEmitter=require(_0x9220('0x0'));var OpenchannelQueue=require(_0x9220('0x1'))['db'][_0x9220('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9220('0x3')](0x0);var events={'afterCreate':_0x9220('0x4'),'afterUpdate':_0x9220('0x5'),'afterDestroy':_0x9220('0x6')};function emitEvent(_0x243ff5){return function(_0x1198a7,_0x1b6268,_0x287f58){OpenchannelQueueEvents[_0x9220('0x7')](_0x243ff5+':'+_0x1198a7['id'],_0x1198a7);OpenchannelQueueEvents[_0x9220('0x7')](_0x243ff5,_0x1198a7);_0x287f58(null);};}for(var e in events){if(events[_0x9220('0x8')](e)){var event=events[e];OpenchannelQueue[_0x9220('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 0d8af9e..dadb5ed 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 _0x6d5e=['OpenchannelQueue','openchannel_queues','lodash','util','api','request-promise','path','./openchannelQueue.attributes','exports','define'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0x6d5e,0x188));var _0xe6d5=function(_0x5222c1,_0x4ddc30){_0x5222c1=_0x5222c1-0x0;var _0x179ad7=_0x6d5e[_0x5222c1];return _0x179ad7;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require('../../config/logger')(_0xe6d5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe6d5('0x3'));var fs=require('fs');var path=require(_0xe6d5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6d5('0x5'));module[_0xe6d5('0x6')]=function(_0x174117,_0x37cf50){return _0x174117[_0xe6d5('0x7')](_0xe6d5('0x8'),attributes,{'tableName':_0xe6d5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26d2=['path','rimraf','../../config/environment','exports','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','bluebird','request-promise'];(function(_0x417e86,_0x254185){var _0x5b933f=function(_0x5a1aaf){while(--_0x5a1aaf){_0x417e86['push'](_0x417e86['shift']());}};_0x5b933f(++_0x254185);}(_0x26d2,0x10e));var _0x226d=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x26d2[_0x267d8d];return _0x11a98f;};'use strict';var _=require('lodash');var util=require(_0x226d('0x0'));var logger=require(_0x226d('0x1'))(_0x226d('0x2'));var moment=require('moment');var BPromise=require(_0x226d('0x3'));var rp=require(_0x226d('0x4'));var fs=require('fs');var path=require(_0x226d('0x5'));var rimraf=require(_0x226d('0x6'));var config=require(_0x226d('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x226d('0x8')]=function(_0x3784bb,_0xe1fa10){return _0x3784bb['define'](_0x226d('0x9'),attributes,{'tableName':_0x226d('0xa'),'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 0b58c55..0a2b191 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 _0x1a34=['OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','raw','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info'];(function(_0x2b8a3e,_0x50cf95){var _0x465954=function(_0x24346f){while(--_0x24346f){_0x2b8a3e['push'](_0x2b8a3e['shift']());}};_0x465954(++_0x50cf95);}(_0x1a34,0xed));var _0x41a3=function(_0x688be1,_0x30cf06){_0x688be1=_0x688be1-0x0;var _0xec304d=_0x1a34[_0x688be1];return _0xec304d;};'use strict';var _=require(_0x41a3('0x0'));var util=require(_0x41a3('0x1'));var moment=require(_0x41a3('0x2'));var BPromise=require(_0x41a3('0x3'));var rs=require(_0x41a3('0x4'));var fs=require('fs');var Redis=require(_0x41a3('0x5'));var db=require(_0x41a3('0x6'))['db'];var utils=require(_0x41a3('0x7'));var logger=require(_0x41a3('0x8'))('rpc');var config=require(_0x41a3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x41a3('0xa')][_0x41a3('0xb')]({'port':0x232a});config[_0x41a3('0xc')]=_[_0x41a3('0xd')](config[_0x41a3('0xc')],{'host':_0x41a3('0xe'),'port':0x18eb});var socket=require(_0x41a3('0xf'))(new Redis(config[_0x41a3('0xc')]));require(_0x41a3('0x10'))[_0x41a3('0x11')](socket);function respondWithRpcPromise(_0x3d4c36,_0x18e26b,_0x4e3985){return new BPromise(function(_0x423897,_0x3f53ba){return client[_0x41a3('0x12')](_0x3d4c36,_0x4e3985)[_0x41a3('0x13')](function(_0x172103){logger[_0x41a3('0x14')](_0x41a3('0x15'),_0x18e26b,'request\x20sent');logger[_0x41a3('0x16')](_0x41a3('0x17'),_0x18e26b,_0x41a3('0x18'),JSON[_0x41a3('0x19')](_0x172103));if(_0x172103['error']){if(_0x172103['error'][_0x41a3('0x1a')]===0x1f4){logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x172103[_0x41a3('0x1b')]['message']);return _0x3f53ba(_0x172103['error'][_0x41a3('0x1c')]);}logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x172103['error'][_0x41a3('0x1c')]);return _0x423897(_0x172103[_0x41a3('0x1b')][_0x41a3('0x1c')]);}else{logger[_0x41a3('0x14')](_0x41a3('0x15'),_0x18e26b,'request\x20sent');_0x423897(_0x172103['result'][_0x41a3('0x1c')]);}})[_0x41a3('0x1d')](function(_0x5f509e){logger[_0x41a3('0x1b')](_0x41a3('0x15'),_0x18e26b,_0x5f509e);_0x3f53ba(_0x5f509e);});});}exports['GetOpenchannelQueue']=function(_0x39e08b){var _0x124d97=this;return new Promise(function(_0x199f3f,_0xb38429){return db[_0x41a3('0x1e')][_0x41a3('0x1f')]({'raw':_0x39e08b['options']?_0x39e08b[_0x41a3('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x39e08b[_0x41a3('0x20')]?_0x39e08b['options'][_0x41a3('0x21')]||null:null,'attributes':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x22')]||null:null,'limit':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x23')]||null:null,'include':_0x39e08b[_0x41a3('0x20')]?_0x39e08b[_0x41a3('0x20')][_0x41a3('0x24')]?_[_0x41a3('0x25')](_0x39e08b[_0x41a3('0x20')]['include'],function(_0x461cdb){return{'model':db[_0x461cdb['model']],'as':_0x461cdb['as'],'attributes':_0x461cdb[_0x41a3('0x22')],'include':_0x461cdb['include']?_['map'](_0x461cdb['include'],function(_0x11b24f){return{'model':db[_0x11b24f['model']],'as':_0x11b24f['as'],'attributes':_0x11b24f['attributes'],'include':_0x11b24f[_0x41a3('0x24')]?_[_0x41a3('0x25')](_0x11b24f[_0x41a3('0x24')],function(_0x185415){return{'model':db[_0x185415[_0x41a3('0x26')]],'as':_0x185415['as'],'attributes':_0x185415[_0x41a3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41a3('0x13')](function(_0x385a06){logger['info'](_0x41a3('0x27'),_0x39e08b);logger['debug'](_0x41a3('0x27'),_0x39e08b,JSON[_0x41a3('0x19')](_0x385a06));_0x199f3f(_0x385a06);})[_0x41a3('0x1d')](function(_0x2a384f){logger['error'](_0x41a3('0x27'),_0x2a384f[_0x41a3('0x1c')],_0x39e08b);_0xb38429(_0x124d97[_0x41a3('0x1b')](0x1f4,_0x2a384f['message']));});});};exports['ShowOpenchannelQueue']=function(_0x295aa9){var _0x1b0a21=this;return new Promise(function(_0x181152,_0x1c7613){return db[_0x41a3('0x1e')][_0x41a3('0x28')]({'raw':_0x295aa9[_0x41a3('0x20')]?_0x295aa9['options'][_0x41a3('0x29')]===undefined?!![]:![]:!![],'where':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')]['where']||null:null,'attributes':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')][_0x41a3('0x22')]||null:null,'include':_0x295aa9[_0x41a3('0x20')]?_0x295aa9[_0x41a3('0x20')]['include']?_[_0x41a3('0x25')](_0x295aa9[_0x41a3('0x20')][_0x41a3('0x24')],function(_0x3ab11b){return{'model':db[_0x3ab11b[_0x41a3('0x26')]],'as':_0x3ab11b['as'],'attributes':_0x3ab11b[_0x41a3('0x22')],'include':_0x3ab11b[_0x41a3('0x24')]?_['map'](_0x3ab11b[_0x41a3('0x24')],function(_0x5b0292){return{'model':db[_0x5b0292[_0x41a3('0x26')]],'as':_0x5b0292['as'],'attributes':_0x5b0292['attributes'],'include':_0x5b0292['include']?_['map'](_0x5b0292['include'],function(_0x20f013){return{'model':db[_0x20f013[_0x41a3('0x26')]],'as':_0x20f013['as'],'attributes':_0x20f013[_0x41a3('0x22')]};}):[]};}):[]};}):[]:[]})[_0x41a3('0x13')](function(_0x7837c5){logger[_0x41a3('0x14')](_0x41a3('0x2a'),_0x295aa9);logger[_0x41a3('0x16')](_0x41a3('0x2a'),_0x295aa9,JSON['stringify'](_0x7837c5));_0x181152(_0x7837c5);})[_0x41a3('0x1d')](function(_0x2c65e4){logger[_0x41a3('0x1b')](_0x41a3('0x2a'),_0x2c65e4[_0x41a3('0x1c')],_0x295aa9);_0x1c7613(_0x1b0a21[_0x41a3('0x1b')](0x1f4,_0x2c65e4['message']));});});}; \ No newline at end of file +var _0xc9b8=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','model','ShowOpenchannelQueue','find','map','then','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','redis','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xc9b8,0x19f));var _0x8c9b=function(_0x5e599e,_0x1d61e2){_0x5e599e=_0x5e599e-0x0;var _0x241bbe=_0xc9b8[_0x5e599e];return _0x241bbe;};'use strict';var _=require(_0x8c9b('0x0'));var util=require(_0x8c9b('0x1'));var moment=require('moment');var BPromise=require(_0x8c9b('0x2'));var rs=require(_0x8c9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c9b('0x5'))(_0x8c9b('0x6'));var config=require(_0x8c9b('0x7'));var jayson=require(_0x8c9b('0x8'));var client=jayson[_0x8c9b('0x9')][_0x8c9b('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8c9b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8c9b('0xc')]));require(_0x8c9b('0xd'))[_0x8c9b('0xe')](socket);function respondWithRpcPromise(_0x4d8813,_0x5218e0,_0x50d7ea){return new BPromise(function(_0x12e343,_0x306285){return client[_0x8c9b('0xf')](_0x4d8813,_0x50d7ea)['then'](function(_0x2d7d95){logger['info'](_0x8c9b('0x10'),_0x5218e0,_0x8c9b('0x11'));logger[_0x8c9b('0x12')](_0x8c9b('0x13'),_0x5218e0,_0x8c9b('0x11'),JSON[_0x8c9b('0x14')](_0x2d7d95));if(_0x2d7d95[_0x8c9b('0x15')]){if(_0x2d7d95['error'][_0x8c9b('0x16')]===0x1f4){logger[_0x8c9b('0x15')](_0x8c9b('0x10'),_0x5218e0,_0x2d7d95[_0x8c9b('0x15')][_0x8c9b('0x17')]);return _0x306285(_0x2d7d95[_0x8c9b('0x15')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x5218e0,_0x2d7d95[_0x8c9b('0x15')]['message']);return _0x12e343(_0x2d7d95['error'][_0x8c9b('0x17')]);}else{logger[_0x8c9b('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x5218e0,_0x8c9b('0x11'));_0x12e343(_0x2d7d95[_0x8c9b('0x19')][_0x8c9b('0x17')]);}})[_0x8c9b('0x1a')](function(_0x5cd9c5){logger[_0x8c9b('0x15')](_0x8c9b('0x10'),_0x5218e0,_0x5cd9c5);_0x306285(_0x5cd9c5);});});}exports[_0x8c9b('0x1b')]=function(_0x298bb1){var _0x2a9117=this;return new Promise(function(_0x53a70d,_0x5bc99f){return db[_0x8c9b('0x1c')][_0x8c9b('0x1d')]({'raw':_0x298bb1['options']?_0x298bb1[_0x8c9b('0x1e')][_0x8c9b('0x1f')]===undefined?!![]:![]:!![],'where':_0x298bb1['options']?_0x298bb1['options'][_0x8c9b('0x20')]||null:null,'attributes':_0x298bb1[_0x8c9b('0x1e')]?_0x298bb1[_0x8c9b('0x1e')][_0x8c9b('0x21')]||null:null,'limit':_0x298bb1[_0x8c9b('0x1e')]?_0x298bb1[_0x8c9b('0x1e')]['limit']||null:null,'include':_0x298bb1[_0x8c9b('0x1e')]?_0x298bb1['options'][_0x8c9b('0x22')]?_['map'](_0x298bb1['options'][_0x8c9b('0x22')],function(_0x5ec177){return{'model':db[_0x5ec177[_0x8c9b('0x23')]],'as':_0x5ec177['as'],'attributes':_0x5ec177[_0x8c9b('0x21')],'include':_0x5ec177[_0x8c9b('0x22')]?_['map'](_0x5ec177[_0x8c9b('0x22')],function(_0x2a7c61){return{'model':db[_0x2a7c61[_0x8c9b('0x23')]],'as':_0x2a7c61['as'],'attributes':_0x2a7c61[_0x8c9b('0x21')],'include':_0x2a7c61[_0x8c9b('0x22')]?_['map'](_0x2a7c61[_0x8c9b('0x22')],function(_0x128d13){return{'model':db[_0x128d13[_0x8c9b('0x23')]],'as':_0x128d13['as'],'attributes':_0x128d13[_0x8c9b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f8986){logger['info'](_0x8c9b('0x1b'),_0x298bb1);logger['debug'](_0x8c9b('0x1b'),_0x298bb1,JSON[_0x8c9b('0x14')](_0x1f8986));_0x53a70d(_0x1f8986);})[_0x8c9b('0x1a')](function(_0x3817c5){logger[_0x8c9b('0x15')]('GetOpenchannelQueue',_0x3817c5[_0x8c9b('0x17')],_0x298bb1);_0x5bc99f(_0x2a9117[_0x8c9b('0x15')](0x1f4,_0x3817c5[_0x8c9b('0x17')]));});});};exports[_0x8c9b('0x24')]=function(_0x5849a0){var _0x5bdfca=this;return new Promise(function(_0x3e23ac,_0x30e5e1){return db['OpenchannelQueue'][_0x8c9b('0x25')]({'raw':_0x5849a0[_0x8c9b('0x1e')]?_0x5849a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5849a0[_0x8c9b('0x1e')]?_0x5849a0[_0x8c9b('0x1e')][_0x8c9b('0x20')]||null:null,'attributes':_0x5849a0[_0x8c9b('0x1e')]?_0x5849a0[_0x8c9b('0x1e')]['attributes']||null:null,'include':_0x5849a0[_0x8c9b('0x1e')]?_0x5849a0[_0x8c9b('0x1e')]['include']?_['map'](_0x5849a0['options'][_0x8c9b('0x22')],function(_0x4f9d0a){return{'model':db[_0x4f9d0a[_0x8c9b('0x23')]],'as':_0x4f9d0a['as'],'attributes':_0x4f9d0a['attributes'],'include':_0x4f9d0a[_0x8c9b('0x22')]?_[_0x8c9b('0x26')](_0x4f9d0a['include'],function(_0x5ba4a9){return{'model':db[_0x5ba4a9[_0x8c9b('0x23')]],'as':_0x5ba4a9['as'],'attributes':_0x5ba4a9[_0x8c9b('0x21')],'include':_0x5ba4a9['include']?_[_0x8c9b('0x26')](_0x5ba4a9[_0x8c9b('0x22')],function(_0x541f70){return{'model':db[_0x541f70[_0x8c9b('0x23')]],'as':_0x541f70['as'],'attributes':_0x541f70[_0x8c9b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8c9b('0x27')](function(_0x460381){logger[_0x8c9b('0x18')](_0x8c9b('0x24'),_0x5849a0);logger['debug'](_0x8c9b('0x24'),_0x5849a0,JSON[_0x8c9b('0x14')](_0x460381));_0x3e23ac(_0x460381);})[_0x8c9b('0x1a')](function(_0x34fb93){logger['error'](_0x8c9b('0x24'),_0x34fb93[_0x8c9b('0x17')],_0x5849a0);_0x30e5e1(_0x5bdfca[_0x8c9b('0x15')](0x1f4,_0x34fb93[_0x8c9b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 84dc2bc..42b14db 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 _0x1e0d=['update','emit','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0x5f1a89,_0x589c9f){var _0x2bd2e9=function(_0x40fb7d){while(--_0x40fb7d){_0x5f1a89['push'](_0x5f1a89['shift']());}};_0x2bd2e9(++_0x589c9f);}(_0x1e0d,0x1bd));var _0xd1e0=function(_0x2e7650,_0x460f5d){_0x2e7650=_0x2e7650-0x0;var _0xee003d=_0x1e0d[_0x2e7650];return _0xee003d;};'use strict';var OpenchannelQueueEvents=require(_0xd1e0('0x0'));var events=[_0xd1e0('0x1'),_0xd1e0('0x2'),_0xd1e0('0x3')];function createListener(_0x1c412c,_0x35665f){return function(_0x4d3718){_0x35665f[_0xd1e0('0x4')](_0x1c412c,_0x4d3718);};}function removeListener(_0x258c2b,_0x351716){return function(){OpenchannelQueueEvents[_0xd1e0('0x5')](_0x258c2b,_0x351716);};}exports[_0xd1e0('0x6')]=function(_0x2660d1){for(var _0x12e7a7=0x0,_0x1de0fe=events[_0xd1e0('0x7')];_0x12e7a7<_0x1de0fe;_0x12e7a7++){var _0x15edfb=events[_0x12e7a7];var _0x313991=createListener('openchannelQueue:'+_0x15edfb,_0x2660d1);OpenchannelQueueEvents['on'](_0x15edfb,_0x313991);}}; \ No newline at end of file +var _0x7631=['./openchannelQueue.events','remove','update','removeListener','register','length','openchannelQueue:'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7631,0x188));var _0x1763=function(_0x4d033d,_0x147076){_0x4d033d=_0x4d033d-0x0;var _0x136d72=_0x7631[_0x4d033d];return _0x136d72;};'use strict';var OpenchannelQueueEvents=require(_0x1763('0x0'));var events=['save',_0x1763('0x1'),_0x1763('0x2')];function createListener(_0x3a2647,_0x2eccfe){return function(_0x5e7d8d){_0x2eccfe['emit'](_0x3a2647,_0x5e7d8d);};}function removeListener(_0x2001ef,_0xd57ef){return function(){OpenchannelQueueEvents[_0x1763('0x3')](_0x2001ef,_0xd57ef);};}exports[_0x1763('0x4')]=function(_0x1f34d0){for(var _0x3c8642=0x0,_0x302528=events[_0x1763('0x5')];_0x3c8642<_0x302528;_0x3c8642++){var _0x1db7ee=events[_0x3c8642];var _0x863c3e=createListener(_0x1763('0x6')+_0x1db7ee,_0x1f34d0);OpenchannelQueueEvents['on'](_0x1db7ee,_0x863c3e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f0a7d1a..ceee143 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 _0x0519=['delete','destroy','exports','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x0519,0x192));var _0x9051=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x0519[_0x16337a];return _0x422365;};'use strict';var multer=require('multer');var util=require(_0x9051('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9051('0x1'));var router=express['Router']();var fs_extra=require(_0x9051('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9051('0x3'));var config=require(_0x9051('0x4'));var controller=require(_0x9051('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9051('0x6')]);router['get'](_0x9051('0x7'),auth['isAuthenticated'](),controller[_0x9051('0x8')]);router['get']('/:id',auth[_0x9051('0x9')](),controller[_0x9051('0xa')]);router[_0x9051('0xb')]('/',auth[_0x9051('0x9')](),controller[_0x9051('0xc')]);router[_0x9051('0xd')](_0x9051('0xe'),auth['isAuthenticated'](),controller[_0x9051('0xf')]);router[_0x9051('0x10')](_0x9051('0xe'),auth[_0x9051('0x9')](),controller[_0x9051('0x11')]);module[_0x9051('0x12')]=router; \ No newline at end of file +var _0x3deb=['get','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller'];(function(_0x59603e,_0x3aa57b){var _0x4afb96=function(_0x1b5496){while(--_0x1b5496){_0x59603e['push'](_0x59603e['shift']());}};_0x4afb96(++_0x3aa57b);}(_0x3deb,0x13c));var _0xb3de=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x3deb[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xb3de('0x0'));var util=require(_0xb3de('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb3de('0x2'));var router=express['Router']();var fs_extra=require(_0xb3de('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb3de('0x4'));var config=require(_0xb3de('0x5'));var controller=require(_0xb3de('0x6'));router[_0xb3de('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb3de('0x8'),auth[_0xb3de('0x9')](),controller[_0xb3de('0xa')]);router[_0xb3de('0x7')]('/:id',auth[_0xb3de('0x9')](),controller[_0xb3de('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb3de('0xc')]);router[_0xb3de('0xd')]('/:id',auth[_0xb3de('0x9')](),controller[_0xb3de('0xe')]);router[_0xb3de('0xf')](_0xb3de('0x10'),auth['isAuthenticated'](),controller[_0xb3de('0x11')]);module[_0xb3de('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 258c9aa..40eb820 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 _0x5cae=['STRING','DATE','moment','sequelize','exports'];(function(_0x6337d4,_0xe1bb81){var _0x4f3336=function(_0xba839a){while(--_0xba839a){_0x6337d4['push'](_0x6337d4['shift']());}};_0x4f3336(++_0xe1bb81);}(_0x5cae,0xb1));var _0xe5ca=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x5cae[_0x5a1a51];return _0x47edd7;};'use strict';var moment=require(_0xe5ca('0x0'));var Sequelize=require(_0xe5ca('0x1'));module[_0xe5ca('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xe5ca('0x3')]},'joinAt':{'type':Sequelize[_0xe5ca('0x4')]},'leaveAt':{'type':Sequelize[_0xe5ca('0x4')]},'acceptAt':{'type':Sequelize[_0xe5ca('0x4')]},'exitAt':{'type':Sequelize[_0xe5ca('0x4')]},'reason':{'type':Sequelize[_0xe5ca('0x3')]}}; \ No newline at end of file +var _0xba06=['exports','STRING','DATE','moment'];(function(_0x2989b0,_0x24dc6f){var _0x1aa7b5=function(_0x96cd73){while(--_0x96cd73){_0x2989b0['push'](_0x2989b0['shift']());}};_0x1aa7b5(++_0x24dc6f);}(_0xba06,0xcf));var _0x6ba0=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0xba06[_0x4e9d3c];return _0x2d0825;};'use strict';var moment=require(_0x6ba0('0x0'));var Sequelize=require('sequelize');module[_0x6ba0('0x1')]={'uniqueid':{'type':Sequelize[_0x6ba0('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6ba0('0x3')]},'leaveAt':{'type':Sequelize[_0x6ba0('0x3')]},'acceptAt':{'type':Sequelize[_0x6ba0('0x3')]},'exitAt':{'type':Sequelize[_0x6ba0('0x3')]},'reason':{'type':Sequelize[_0x6ba0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6ea9f07..a78a55a 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 _0x0041=['send','index','map','OpenchannelQueueReport','rawAttributes','type','key','keys','filters','query','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','show','options','find','create','body','catch','destroy','params','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name'];(function(_0xd18a0d,_0x4ea531){var _0x19197a=function(_0x3bb78a){while(--_0x3bb78a){_0xd18a0d['push'](_0xd18a0d['shift']());}};_0x19197a(++_0x4ea531);}(_0x0041,0xb8));var _0x1004=function(_0x4e6165,_0x1b1097){_0x4e6165=_0x4e6165-0x0;var _0x4280f8=_0x0041[_0x4e6165];return _0x4280f8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1004('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1004('0x1'));var moment=require(_0x1004('0x2'));var BPromise=require(_0x1004('0x3'));var Mustache=require(_0x1004('0x4'));var util=require(_0x1004('0x5'));var path=require(_0x1004('0x6'));var sox=require(_0x1004('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1004('0x8'));var _=require(_0x1004('0x9'));var squel=require('squel');var crypto=require(_0x1004('0xa'));var jsforce=require(_0x1004('0xb'));var deskjs=require(_0x1004('0xc'));var toCsv=require(_0x1004('0xd'));var querystring=require('querystring');var Papa=require(_0x1004('0xe'));var Redis=require(_0x1004('0xf'));var authService=require(_0x1004('0x10'));var qs=require(_0x1004('0x11'));var as=require(_0x1004('0x12'));var hardwareService=require(_0x1004('0x13'));var logger=require(_0x1004('0x14'))(_0x1004('0x15'));var utils=require(_0x1004('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1004('0x17'));var db=require(_0x1004('0x18'))['db'];function respondWithStatusCode(_0x372c1c,_0x4b337f){_0x4b337f=_0x4b337f||0xcc;return function(_0x3cc1fd){if(_0x3cc1fd){return _0x372c1c[_0x1004('0x19')](_0x4b337f);}return _0x372c1c[_0x1004('0x1a')](_0x4b337f)[_0x1004('0x1b')]();};}function respondWithResult(_0x34b06a,_0x122a56){_0x122a56=_0x122a56||0xc8;return function(_0x26d19e){if(_0x26d19e){return _0x34b06a[_0x1004('0x1a')](_0x122a56)[_0x1004('0x1c')](_0x26d19e);}};}function respondWithFilteredResult(_0x117a3c,_0x51d555){return function(_0x1b6659){if(_0x1b6659){var _0x3dbdb0=typeof _0x51d555[_0x1004('0x1d')]===_0x1004('0x1e')&&typeof _0x51d555['limit']===_0x1004('0x1e');var _0x4c98b5=_0x1b6659[_0x1004('0x1f')];var _0x597886=_0x3dbdb0?0x0:_0x51d555[_0x1004('0x1d')];var _0x328f6e=_0x3dbdb0?_0x1b6659[_0x1004('0x1f')]:_0x51d555['offset']+_0x51d555[_0x1004('0x20')];var _0x460f3;if(_0x328f6e>=_0x4c98b5){_0x328f6e=_0x4c98b5;_0x460f3=0xc8;}else{_0x460f3=0xce;}_0x117a3c[_0x1004('0x1a')](_0x460f3);return _0x117a3c[_0x1004('0x21')]('Content-Range',_0x597886+'-'+_0x328f6e+'/'+_0x4c98b5)[_0x1004('0x1c')](_0x1b6659);}return null;};}function patchUpdates(_0x2c0ca1){return function(_0x56f285){try{jsonpatch[_0x1004('0x22')](_0x56f285,_0x2c0ca1,!![]);}catch(_0x3e409c){return BPromise[_0x1004('0x23')](_0x3e409c);}return _0x56f285[_0x1004('0x24')]();};}function saveUpdates(_0x5b21f4,_0x12760b){return function(_0x47132e){if(_0x47132e){return _0x47132e[_0x1004('0x25')](_0x5b21f4)[_0x1004('0x26')](function(_0x302011){return _0x302011;});}return null;};}function removeEntity(_0x211153,_0x3f11ef){return function(_0x398567){if(_0x398567){return _0x398567['destroy']()[_0x1004('0x26')](function(){_0x211153[_0x1004('0x1a')](0xcc)[_0x1004('0x1b')]();});}};}function handleEntityNotFound(_0x58b58e,_0x17a6b1){return function(_0x194fe0){if(!_0x194fe0){_0x58b58e[_0x1004('0x19')](0x194);}return _0x194fe0;};}function handleError(_0x425617,_0x273809){_0x273809=_0x273809||0x1f4;return function(_0x1ad2b4){logger['error'](_0x1ad2b4[_0x1004('0x27')]);if(_0x1ad2b4[_0x1004('0x28')]){delete _0x1ad2b4[_0x1004('0x28')];}_0x425617[_0x1004('0x1a')](_0x273809)[_0x1004('0x29')](_0x1ad2b4);};}exports[_0x1004('0x2a')]=function(_0x56bdaa,_0x5db758){var _0x3cbd79={},_0x2487fd={},_0x57afbe={'count':0x0,'rows':[]};var _0x4284f6=_[_0x1004('0x2b')](db[_0x1004('0x2c')][_0x1004('0x2d')],function(_0x2bb76a){return{'name':_0x2bb76a['fieldName'],'type':_0x2bb76a[_0x1004('0x2e')][_0x1004('0x2f')]};});_0x2487fd['model']=_['map'](_0x4284f6,_0x1004('0x28'));_0x2487fd['query']=_[_0x1004('0x30')](_0x56bdaa['query']);_0x2487fd[_0x1004('0x31')]=_['intersection'](_0x2487fd['model'],_0x2487fd[_0x1004('0x32')]);_0x3cbd79[_0x1004('0x33')]=_[_0x1004('0x34')](_0x2487fd['model'],qs[_0x1004('0x35')](_0x56bdaa[_0x1004('0x32')][_0x1004('0x35')]));_0x3cbd79[_0x1004('0x33')]=_0x3cbd79[_0x1004('0x33')][_0x1004('0x36')]?_0x3cbd79[_0x1004('0x33')]:_0x2487fd[_0x1004('0x37')];if(!_0x56bdaa['query'][_0x1004('0x38')]('nolimit')){_0x3cbd79['limit']=qs[_0x1004('0x20')](_0x56bdaa[_0x1004('0x32')][_0x1004('0x20')]);_0x3cbd79[_0x1004('0x1d')]=qs[_0x1004('0x1d')](_0x56bdaa['query'][_0x1004('0x1d')]);}_0x3cbd79[_0x1004('0x39')]=qs[_0x1004('0x3a')](_0x56bdaa['query'][_0x1004('0x3a')]);_0x3cbd79[_0x1004('0x3b')]=qs[_0x1004('0x31')](_[_0x1004('0x3c')](_0x56bdaa[_0x1004('0x32')],_0x2487fd[_0x1004('0x31')]),_0x4284f6);if(_0x56bdaa[_0x1004('0x32')]['filter']){_0x3cbd79[_0x1004('0x3b')]=_['merge'](_0x3cbd79[_0x1004('0x3b')],{'$or':_[_0x1004('0x2b')](_0x4284f6,function(_0x309d27){if(_0x309d27[_0x1004('0x2e')]!=='VIRTUAL'){var _0x4bf247={};_0x4bf247[_0x309d27[_0x1004('0x28')]]={'$like':'%'+_0x56bdaa[_0x1004('0x32')]['filter']+'%'};return _0x4bf247;}})});}_0x3cbd79=_[_0x1004('0x3d')]({},_0x3cbd79,_0x56bdaa['options']);var _0x11367f={'where':_0x3cbd79['where']};return db[_0x1004('0x2c')][_0x1004('0x1f')](_0x11367f)[_0x1004('0x26')](function(_0x266d8e){_0x57afbe[_0x1004('0x1f')]=_0x266d8e;if(_0x56bdaa['query'][_0x1004('0x3e')]){_0x3cbd79[_0x1004('0x3f')]=[{'all':!![]}];}return db[_0x1004('0x2c')][_0x1004('0x40')](_0x3cbd79);})[_0x1004('0x26')](function(_0x2d1873){_0x57afbe[_0x1004('0x41')]=_0x2d1873;return _0x57afbe;})[_0x1004('0x26')](respondWithFilteredResult(_0x5db758,_0x3cbd79))['catch'](handleError(_0x5db758,null));};exports[_0x1004('0x42')]=function(_0xae1e3a,_0x2af6ce){var _0x10ea12={'raw':!![],'where':{'id':_0xae1e3a['params']['id']}},_0x20b32f={};_0x20b32f[_0x1004('0x37')]=_[_0x1004('0x30')](db[_0x1004('0x2c')][_0x1004('0x2d')]);_0x20b32f[_0x1004('0x32')]=_[_0x1004('0x30')](_0xae1e3a['query']);_0x20b32f[_0x1004('0x31')]=_[_0x1004('0x34')](_0x20b32f['model'],_0x20b32f[_0x1004('0x32')]);_0x10ea12['attributes']=_[_0x1004('0x34')](_0x20b32f['model'],qs[_0x1004('0x35')](_0xae1e3a[_0x1004('0x32')][_0x1004('0x35')]));_0x10ea12[_0x1004('0x33')]=_0x10ea12['attributes'][_0x1004('0x36')]?_0x10ea12[_0x1004('0x33')]:_0x20b32f[_0x1004('0x37')];if(_0xae1e3a[_0x1004('0x32')][_0x1004('0x3e')]){_0x10ea12[_0x1004('0x3f')]=[{'all':!![]}];}_0x10ea12=_[_0x1004('0x3d')]({},_0x10ea12,_0xae1e3a[_0x1004('0x43')]);return db[_0x1004('0x2c')][_0x1004('0x44')](_0x10ea12)['then'](handleEntityNotFound(_0x2af6ce,null))[_0x1004('0x26')](respondWithResult(_0x2af6ce,null))['catch'](handleError(_0x2af6ce,null));};exports[_0x1004('0x45')]=function(_0x11eb0f,_0x4ef402){return db[_0x1004('0x2c')]['create'](_0x11eb0f[_0x1004('0x46')],{})[_0x1004('0x26')](respondWithResult(_0x4ef402,0xc9))[_0x1004('0x47')](handleError(_0x4ef402,null));};exports['update']=function(_0x39f843,_0x4644d2){if(_0x39f843[_0x1004('0x46')]['id']){delete _0x39f843['body']['id'];}return db[_0x1004('0x2c')]['find']({'where':{'id':_0x39f843['params']['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x4644d2,null))[_0x1004('0x26')](saveUpdates(_0x39f843['body'],null))[_0x1004('0x26')](respondWithResult(_0x4644d2,null))[_0x1004('0x47')](handleError(_0x4644d2,null));};exports[_0x1004('0x48')]=function(_0x4d0b50,_0x22982b){return db[_0x1004('0x2c')][_0x1004('0x44')]({'where':{'id':_0x4d0b50[_0x1004('0x49')]['id']}})[_0x1004('0x26')](handleEntityNotFound(_0x22982b,null))[_0x1004('0x26')](removeEntity(_0x22982b,null))['catch'](handleError(_0x22982b,null));};exports[_0x1004('0x4a')]=function(_0x4e91c0,_0x899b4a){return db[_0x1004('0x2c')][_0x1004('0x4a')]()[_0x1004('0x26')](respondWithResult(_0x899b4a,null))['catch'](handleError(_0x899b4a,null));}; \ No newline at end of file +var _0x0462=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','stack','name','send','OpenchannelQueueReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0462,0x11f));var _0x2046=function(_0x40e9d9,_0x37e4a4){_0x40e9d9=_0x40e9d9-0x0;var _0x5628db=_0x0462[_0x40e9d9];return _0x5628db;};'use strict';var emlformat=require(_0x2046('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2046('0x1'));var jsonpatch=require(_0x2046('0x2'));var rp=require(_0x2046('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2046('0x4'));var util=require(_0x2046('0x5'));var path=require(_0x2046('0x6'));var sox=require(_0x2046('0x7'));var csv=require('to-csv');var ejs=require(_0x2046('0x8'));var fs=require('fs');var fs_extra=require(_0x2046('0x9'));var _=require(_0x2046('0xa'));var squel=require(_0x2046('0xb'));var crypto=require(_0x2046('0xc'));var jsforce=require(_0x2046('0xd'));var deskjs=require(_0x2046('0xe'));var toCsv=require(_0x2046('0xf'));var querystring=require(_0x2046('0x10'));var Papa=require(_0x2046('0x11'));var Redis=require(_0x2046('0x12'));var authService=require(_0x2046('0x13'));var qs=require(_0x2046('0x14'));var as=require(_0x2046('0x15'));var hardwareService=require(_0x2046('0x16'));var logger=require(_0x2046('0x17'))(_0x2046('0x18'));var utils=require(_0x2046('0x19'));var config=require(_0x2046('0x1a'));var licenseUtil=require(_0x2046('0x1b'));var db=require(_0x2046('0x1c'))['db'];function respondWithStatusCode(_0x5b19f9,_0x1601c3){_0x1601c3=_0x1601c3||0xcc;return function(_0x28405e){if(_0x28405e){return _0x5b19f9[_0x2046('0x1d')](_0x1601c3);}return _0x5b19f9[_0x2046('0x1e')](_0x1601c3)[_0x2046('0x1f')]();};}function respondWithResult(_0x2fb690,_0x4ff17c){_0x4ff17c=_0x4ff17c||0xc8;return function(_0x25a5b7){if(_0x25a5b7){return _0x2fb690[_0x2046('0x1e')](_0x4ff17c)[_0x2046('0x20')](_0x25a5b7);}};}function respondWithFilteredResult(_0x4c4db7,_0x25effc){return function(_0x594965){if(_0x594965){var _0x564b59=typeof _0x25effc[_0x2046('0x21')]===_0x2046('0x22')&&typeof _0x25effc[_0x2046('0x23')]===_0x2046('0x22');var _0x362af3=_0x594965['count'];var _0x2ac6b9=_0x564b59?0x0:_0x25effc['offset'];var _0x257b23=_0x564b59?_0x594965[_0x2046('0x24')]:_0x25effc[_0x2046('0x21')]+_0x25effc[_0x2046('0x23')];var _0x17b9b0;if(_0x257b23>=_0x362af3){_0x257b23=_0x362af3;_0x17b9b0=0xc8;}else{_0x17b9b0=0xce;}_0x4c4db7[_0x2046('0x1e')](_0x17b9b0);return _0x4c4db7['set'](_0x2046('0x25'),_0x2ac6b9+'-'+_0x257b23+'/'+_0x362af3)[_0x2046('0x20')](_0x594965);}return null;};}function patchUpdates(_0x149b42){return function(_0x53b2ff){try{jsonpatch[_0x2046('0x26')](_0x53b2ff,_0x149b42,!![]);}catch(_0xb57dec){return BPromise[_0x2046('0x27')](_0xb57dec);}return _0x53b2ff['save']();};}function saveUpdates(_0x27c0d1,_0x2c677b){return function(_0x4e3f6b){if(_0x4e3f6b){return _0x4e3f6b['update'](_0x27c0d1)[_0x2046('0x28')](function(_0x1d3665){return _0x1d3665;});}return null;};}function removeEntity(_0x47734f,_0x109960){return function(_0x12c1bb){if(_0x12c1bb){return _0x12c1bb[_0x2046('0x29')]()[_0x2046('0x28')](function(){_0x47734f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d74cb,_0x39c98d){return function(_0x246bdb){if(!_0x246bdb){_0x5d74cb[_0x2046('0x1d')](0x194);}return _0x246bdb;};}function handleError(_0x551cfe,_0x17ce62){_0x17ce62=_0x17ce62||0x1f4;return function(_0x585b0a){logger['error'](_0x585b0a[_0x2046('0x2a')]);if(_0x585b0a[_0x2046('0x2b')]){delete _0x585b0a[_0x2046('0x2b')];}_0x551cfe['status'](_0x17ce62)[_0x2046('0x2c')](_0x585b0a);};}exports['index']=function(_0x45d472,_0x732f46){var _0x53391a={},_0x2d99a3={},_0xacc21f={'count':0x0,'rows':[]};var _0x2ed067=_['map'](db[_0x2046('0x2d')][_0x2046('0x2e')],function(_0x2bfec7){return{'name':_0x2bfec7['fieldName'],'type':_0x2bfec7[_0x2046('0x2f')][_0x2046('0x30')]};});_0x2d99a3['model']=_['map'](_0x2ed067,_0x2046('0x2b'));_0x2d99a3[_0x2046('0x31')]=_[_0x2046('0x32')](_0x45d472[_0x2046('0x31')]);_0x2d99a3[_0x2046('0x33')]=_['intersection'](_0x2d99a3[_0x2046('0x34')],_0x2d99a3[_0x2046('0x31')]);_0x53391a[_0x2046('0x35')]=_[_0x2046('0x36')](_0x2d99a3['model'],qs[_0x2046('0x37')](_0x45d472['query'][_0x2046('0x37')]));_0x53391a['attributes']=_0x53391a[_0x2046('0x35')][_0x2046('0x38')]?_0x53391a[_0x2046('0x35')]:_0x2d99a3[_0x2046('0x34')];if(!_0x45d472['query'][_0x2046('0x39')](_0x2046('0x3a'))){_0x53391a[_0x2046('0x23')]=qs[_0x2046('0x23')](_0x45d472[_0x2046('0x31')][_0x2046('0x23')]);_0x53391a[_0x2046('0x21')]=qs['offset'](_0x45d472['query'][_0x2046('0x21')]);}_0x53391a['order']=qs[_0x2046('0x3b')](_0x45d472[_0x2046('0x31')][_0x2046('0x3b')]);_0x53391a['where']=qs[_0x2046('0x33')](_[_0x2046('0x3c')](_0x45d472[_0x2046('0x31')],_0x2d99a3[_0x2046('0x33')]),_0x2ed067);if(_0x45d472[_0x2046('0x31')][_0x2046('0x3d')]){_0x53391a[_0x2046('0x3e')]=_[_0x2046('0x3f')](_0x53391a[_0x2046('0x3e')],{'$or':_[_0x2046('0x40')](_0x2ed067,function(_0x5a3ee2){if(_0x5a3ee2['type']!=='VIRTUAL'){var _0x4563b7={};_0x4563b7[_0x5a3ee2[_0x2046('0x2b')]]={'$like':'%'+_0x45d472[_0x2046('0x31')][_0x2046('0x3d')]+'%'};return _0x4563b7;}})});}_0x53391a=_['merge']({},_0x53391a,_0x45d472[_0x2046('0x41')]);var _0x38e38a={'where':_0x53391a[_0x2046('0x3e')]};return db[_0x2046('0x2d')][_0x2046('0x24')](_0x38e38a)[_0x2046('0x28')](function(_0x1658a5){_0xacc21f[_0x2046('0x24')]=_0x1658a5;if(_0x45d472['query'][_0x2046('0x42')]){_0x53391a[_0x2046('0x43')]=[{'all':!![]}];}return db[_0x2046('0x2d')][_0x2046('0x44')](_0x53391a);})[_0x2046('0x28')](function(_0x5049ab){_0xacc21f['rows']=_0x5049ab;return _0xacc21f;})[_0x2046('0x28')](respondWithFilteredResult(_0x732f46,_0x53391a))[_0x2046('0x45')](handleError(_0x732f46,null));};exports[_0x2046('0x46')]=function(_0x5c77e9,_0x2e8efe){var _0x40ced2={'raw':!![],'where':{'id':_0x5c77e9[_0x2046('0x47')]['id']}},_0x4f9291={};_0x4f9291['model']=_['keys'](db['OpenchannelQueueReport'][_0x2046('0x2e')]);_0x4f9291[_0x2046('0x31')]=_[_0x2046('0x32')](_0x5c77e9['query']);_0x4f9291['filters']=_[_0x2046('0x36')](_0x4f9291[_0x2046('0x34')],_0x4f9291[_0x2046('0x31')]);_0x40ced2[_0x2046('0x35')]=_[_0x2046('0x36')](_0x4f9291[_0x2046('0x34')],qs[_0x2046('0x37')](_0x5c77e9[_0x2046('0x31')][_0x2046('0x37')]));_0x40ced2['attributes']=_0x40ced2[_0x2046('0x35')][_0x2046('0x38')]?_0x40ced2[_0x2046('0x35')]:_0x4f9291['model'];if(_0x5c77e9[_0x2046('0x31')][_0x2046('0x42')]){_0x40ced2[_0x2046('0x43')]=[{'all':!![]}];}_0x40ced2=_[_0x2046('0x3f')]({},_0x40ced2,_0x5c77e9[_0x2046('0x41')]);return db[_0x2046('0x2d')][_0x2046('0x48')](_0x40ced2)['then'](handleEntityNotFound(_0x2e8efe,null))[_0x2046('0x28')](respondWithResult(_0x2e8efe,null))['catch'](handleError(_0x2e8efe,null));};exports['create']=function(_0x2653ed,_0x6a5e41){return db[_0x2046('0x2d')]['create'](_0x2653ed['body'],{})[_0x2046('0x28')](respondWithResult(_0x6a5e41,0xc9))['catch'](handleError(_0x6a5e41,null));};exports['update']=function(_0x4753f1,_0x573e07){if(_0x4753f1[_0x2046('0x49')]['id']){delete _0x4753f1['body']['id'];}return db[_0x2046('0x2d')][_0x2046('0x48')]({'where':{'id':_0x4753f1[_0x2046('0x47')]['id']}})[_0x2046('0x28')](handleEntityNotFound(_0x573e07,null))['then'](saveUpdates(_0x4753f1[_0x2046('0x49')],null))['then'](respondWithResult(_0x573e07,null))[_0x2046('0x45')](handleError(_0x573e07,null));};exports[_0x2046('0x29')]=function(_0x53e8f8,_0x366c90){return db[_0x2046('0x2d')][_0x2046('0x48')]({'where':{'id':_0x53e8f8[_0x2046('0x47')]['id']}})[_0x2046('0x28')](handleEntityNotFound(_0x366c90,null))['then'](removeEntity(_0x366c90,null))[_0x2046('0x45')](handleError(_0x366c90,null));};exports[_0x2046('0x4a')]=function(_0x42ce0b,_0x29b9cd){return db[_0x2046('0x2d')][_0x2046('0x4a')]()[_0x2046('0x28')](respondWithResult(_0x29b9cd,null))['catch'](handleError(_0x29b9cd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index fadfddc..baabd9c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x1fdb81,_0x583d45){var _0x398d2b=function(_0x2012f3){while(--_0x2012f3){_0x1fdb81['push'](_0x1fdb81['shift']());}};_0x398d2b(++_0x583d45);}(_0x7a54,0x106));var _0x47a5=function(_0x3b4c3d,_0x2ce106){_0x3b4c3d=_0x3b4c3d-0x0;var _0x29a4a4=_0x7a54[_0x3b4c3d];return _0x29a4a4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x323241,_0x399da2){var _0x18cd8d=function(_0x286e54){while(--_0x286e54){_0x323241['push'](_0x323241['shift']());}};_0x18cd8d(++_0x399da2);}(_0x326f,0xd1));var _0xf326=function(_0x35e872,_0x1092cc){_0x35e872=_0x35e872-0x0;var _0x2a2da7=_0x326f[_0x35e872];return _0x2a2da7;};'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 2e97aac..9196cab 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 _0x14a0=['stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent'];(function(_0x14ea32,_0x262909){var _0x137bbb=function(_0x4a36ab){while(--_0x4a36ab){_0x14ea32['push'](_0x14ea32['shift']());}};_0x137bbb(++_0x262909);}(_0x14a0,0x8e));var _0x014a=function(_0x3efc9f,_0x259b99){_0x3efc9f=_0x3efc9f-0x0;var _0x42c8c4=_0x14a0[_0x3efc9f];return _0x42c8c4;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')](_0x12d339[_0x014a('0x18')],{'raw':_0x12d339[_0x014a('0x19')]?_0x12d339[_0x014a('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x014a('0xa')](function(_0x109a9c){logger[_0x014a('0x12')](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')](_0x014a('0x15'),_0x12d339,JSON[_0x014a('0xd')](_0x109a9c));_0x263b07(_0x109a9c);})[_0x014a('0x14')](function(_0x290b86){logger['error'](_0x014a('0x15'),_0x290b86['message'],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x290b86[_0x014a('0x11')]));});});};exports[_0x014a('0x1a')]=function(_0x36d52b){var _0x2b3c10=this;return new Promise(function(_0x113b12,_0x3fec9f){return db[_0x014a('0x16')][_0x014a('0x1b')](_0x36d52b['body'],{'raw':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options'][_0x014a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d52b[_0x014a('0x19')]?_0x36d52b['options']['where']||null:null,'attributes':_0x36d52b[_0x014a('0x19')]?_0x36d52b[_0x014a('0x19')][_0x014a('0x1d')]||null:null,'limit':_0x36d52b['options']?_0x36d52b[_0x014a('0x19')][_0x014a('0x1e')]||null:null})['then'](function(_0x31dc95){logger[_0x014a('0x12')]('UpdateOpenchannelQueueReport',_0x36d52b);logger['debug'](_0x014a('0x1a'),_0x36d52b,JSON[_0x014a('0xd')](_0x31dc95));_0x113b12(_0x31dc95);})[_0x014a('0x14')](function(_0x29fce5){logger['error'](_0x014a('0x1a'),_0x29fce5[_0x014a('0x11')],_0x36d52b);_0x3fec9f(_0x2b3c10[_0x014a('0xe')](0x1f4,_0x29fce5[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x2c83f9,_0xeb2f3e){var _0x2bb6ef=function(_0x1a1d61){while(--_0x1a1d61){_0x2c83f9['push'](_0x2c83f9['shift']());}};_0x2bb6ef(++_0xeb2f3e);}(_0x4f7b,0x13e));var _0xb4f7=function(_0xb9dc34,_0x211b91){_0xb9dc34=_0xb9dc34-0x0;var _0x46a81e=_0x4f7b[_0xb9dc34];return _0x46a81e;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b82b111..ab65238 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 _0xe2c2=['post','create','put','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2fa895,_0x44b2c3){var _0x2df77a=function(_0x149070){while(--_0x149070){_0x2fa895['push'](_0x2fa895['shift']());}};_0x2df77a(++_0x44b2c3);}(_0xe2c2,0x1f2));var _0x2e2c=function(_0x539fd4,_0x5aa50e){_0x539fd4=_0x539fd4-0x0;var _0x47423f=_0xe2c2[_0x539fd4];return _0x47423f;};'use strict';var multer=require(_0x2e2c('0x0'));var util=require(_0x2e2c('0x1'));var path=require(_0x2e2c('0x2'));var timeout=require(_0x2e2c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2e2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2e2c('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0x2e2c('0x6')]('/',auth[_0x2e2c('0x7')](),controller[_0x2e2c('0x8')]);router[_0x2e2c('0x6')](_0x2e2c('0x9'),auth[_0x2e2c('0x7')](),controller[_0x2e2c('0xa')]);router[_0x2e2c('0x6')](_0x2e2c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2e2c('0xc')]('/',auth[_0x2e2c('0x7')](),controller[_0x2e2c('0xd')]);router[_0x2e2c('0xe')](_0x2e2c('0xb'),auth[_0x2e2c('0x7')](),controller['update']);router[_0x2e2c('0xf')](_0x2e2c('0xb'),auth[_0x2e2c('0x7')](),controller[_0x2e2c('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe390=['/:id','create','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x2b13b9,_0x108496){var _0x79a60b=function(_0x1194e3){while(--_0x1194e3){_0x2b13b9['push'](_0x2b13b9['shift']());}};_0x79a60b(++_0x108496);}(_0xe390,0x15a));var _0x0e39=function(_0x3a851e,_0x578f2c){_0x3a851e=_0x3a851e-0x0;var _0x157ad4=_0xe390[_0x3a851e];return _0x157ad4;};'use strict';var multer=require(_0x0e39('0x0'));var util=require(_0x0e39('0x1'));var path=require(_0x0e39('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0e39('0x3')]();var fs_extra=require(_0x0e39('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e39('0x5'));var config=require('../../config/environment');var controller=require(_0x0e39('0x6'));router[_0x0e39('0x7')]('/',auth[_0x0e39('0x8')](),controller['index']);router[_0x0e39('0x7')](_0x0e39('0x9'),auth[_0x0e39('0x8')](),controller[_0x0e39('0xa')]);router['get'](_0x0e39('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0e39('0x8')](),controller[_0x0e39('0xc')]);router[_0x0e39('0xd')]('/:id',auth[_0x0e39('0x8')](),controller[_0x0e39('0xe')]);router['delete'](_0x0e39('0xb'),auth['isAuthenticated'](),controller[_0x0e39('0xf')]);module[_0x0e39('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 559afd3..699058d 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x40dec9,_0x1cc7a7){_0x40dec9=_0x40dec9-0x0;var _0x113613=_0x9bde[_0x40dec9];return _0x113613;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x1d619b,_0x80734e){var _0x578641=function(_0x37c945){while(--_0x37c945){_0x1d619b['push'](_0x1d619b['shift']());}};_0x578641(++_0x80734e);}(_0x70e0,0x17b));var _0x070e=function(_0x582a13,_0x4e9f8a){_0x582a13=_0x582a13-0x0;var _0x33a5e8=_0x70e0[_0x582a13];return _0x33a5e8;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index d18dc78..6234106 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 _0x01fa=['limit','undefined','count','set','apply','reject','save','then','end','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','length','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','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/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x01fa,0x1b1));var _0xa01f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x01fa[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0xa01f('0x0'));var rimraf=require(_0xa01f('0x1'));var zipdir=require(_0xa01f('0x2'));var jsonpatch=require(_0xa01f('0x3'));var rp=require(_0xa01f('0x4'));var moment=require('moment');var BPromise=require(_0xa01f('0x5'));var Mustache=require('mustache');var util=require(_0xa01f('0x6'));var path=require(_0xa01f('0x7'));var sox=require(_0xa01f('0x8'));var csv=require('to-csv');var ejs=require(_0xa01f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa01f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa01f('0xb'));var deskjs=require(_0xa01f('0xc'));var toCsv=require(_0xa01f('0xd'));var querystring=require(_0xa01f('0xe'));var Papa=require(_0xa01f('0xf'));var Redis=require('ioredis');var authService=require(_0xa01f('0x10'));var qs=require(_0xa01f('0x11'));var as=require(_0xa01f('0x12'));var hardwareService=require(_0xa01f('0x13'));var logger=require(_0xa01f('0x14'))(_0xa01f('0x15'));var utils=require(_0xa01f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa01f('0x17'));var db=require(_0xa01f('0x18'))['db'];function respondWithStatusCode(_0x292666,_0xaf5572){_0xaf5572=_0xaf5572||0xcc;return function(_0x5d8d52){if(_0x5d8d52){return _0x292666[_0xa01f('0x19')](_0xaf5572);}return _0x292666[_0xa01f('0x1a')](_0xaf5572)['end']();};}function respondWithResult(_0x4911ec,_0x2f5b28){_0x2f5b28=_0x2f5b28||0xc8;return function(_0x351ffd){if(_0x351ffd){return _0x4911ec[_0xa01f('0x1a')](_0x2f5b28)[_0xa01f('0x1b')](_0x351ffd);}};}function respondWithFilteredResult(_0x893f10,_0x2963b5){return function(_0x4d9314){if(_0x4d9314){var _0x4d142f=typeof _0x2963b5[_0xa01f('0x1c')]==='undefined'&&typeof _0x2963b5[_0xa01f('0x1d')]===_0xa01f('0x1e');var _0x3a32c2=_0x4d9314[_0xa01f('0x1f')];var _0xa9acdf=_0x4d142f?0x0:_0x2963b5[_0xa01f('0x1c')];var _0x293998=_0x4d142f?_0x4d9314[_0xa01f('0x1f')]:_0x2963b5[_0xa01f('0x1c')]+_0x2963b5['limit'];var _0x22572a;if(_0x293998>=_0x3a32c2){_0x293998=_0x3a32c2;_0x22572a=0xc8;}else{_0x22572a=0xce;}_0x893f10['status'](_0x22572a);return _0x893f10[_0xa01f('0x20')]('Content-Range',_0xa9acdf+'-'+_0x293998+'/'+_0x3a32c2)[_0xa01f('0x1b')](_0x4d9314);}return null;};}function patchUpdates(_0x172d2f){return function(_0x1b288a){try{jsonpatch[_0xa01f('0x21')](_0x1b288a,_0x172d2f,!![]);}catch(_0x368b46){return BPromise[_0xa01f('0x22')](_0x368b46);}return _0x1b288a[_0xa01f('0x23')]();};}function saveUpdates(_0x29b795,_0x5bbac8){return function(_0x14f85a){if(_0x14f85a){return _0x14f85a['update'](_0x29b795)[_0xa01f('0x24')](function(_0x29b0ca){return _0x29b0ca;});}return null;};}function removeEntity(_0x59d276,_0x4a8fa7){return function(_0x20efdf){if(_0x20efdf){return _0x20efdf['destroy']()[_0xa01f('0x24')](function(){_0x59d276[_0xa01f('0x1a')](0xcc)[_0xa01f('0x25')]();});}};}function handleEntityNotFound(_0x374b72,_0x5a3146){return function(_0x611092){if(!_0x611092){_0x374b72['sendStatus'](0x194);}return _0x611092;};}function handleError(_0xc9b422,_0x56d66a){_0x56d66a=_0x56d66a||0x1f4;return function(_0x3acf26){logger['error'](_0x3acf26[_0xa01f('0x26')]);if(_0x3acf26[_0xa01f('0x27')]){delete _0x3acf26[_0xa01f('0x27')];}_0xc9b422[_0xa01f('0x1a')](_0x56d66a)[_0xa01f('0x28')](_0x3acf26);};}exports[_0xa01f('0x29')]=function(_0x4b55a9,_0x5f544d){var _0x5ed9b3={},_0x319b0a={},_0x460dc6={'count':0x0,'rows':[]};var _0x529d0c=_[_0xa01f('0x2a')](db[_0xa01f('0x2b')][_0xa01f('0x2c')],function(_0x11858e){return{'name':_0x11858e[_0xa01f('0x2d')],'type':_0x11858e[_0xa01f('0x2e')][_0xa01f('0x2f')]};});_0x319b0a[_0xa01f('0x30')]=_[_0xa01f('0x2a')](_0x529d0c,'name');_0x319b0a[_0xa01f('0x31')]=_[_0xa01f('0x32')](_0x4b55a9[_0xa01f('0x31')]);_0x319b0a[_0xa01f('0x33')]=_[_0xa01f('0x34')](_0x319b0a['model'],_0x319b0a['query']);_0x5ed9b3[_0xa01f('0x35')]=_['intersection'](_0x319b0a[_0xa01f('0x30')],qs[_0xa01f('0x36')](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x36')]));_0x5ed9b3['attributes']=_0x5ed9b3[_0xa01f('0x35')]['length']?_0x5ed9b3[_0xa01f('0x35')]:_0x319b0a['model'];if(!_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x37')](_0xa01f('0x38'))){_0x5ed9b3[_0xa01f('0x1d')]=qs['limit'](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x1d')]);_0x5ed9b3['offset']=qs[_0xa01f('0x1c')](_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x1c')]);}_0x5ed9b3[_0xa01f('0x39')]=qs[_0xa01f('0x3a')](_0x4b55a9['query'][_0xa01f('0x3a')]);_0x5ed9b3[_0xa01f('0x3b')]=qs[_0xa01f('0x33')](_['pick'](_0x4b55a9[_0xa01f('0x31')],_0x319b0a[_0xa01f('0x33')]),_0x529d0c);if(_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x3c')]){_0x5ed9b3[_0xa01f('0x3b')]=_[_0xa01f('0x3d')](_0x5ed9b3[_0xa01f('0x3b')],{'$or':_['map'](_0x529d0c,function(_0x5cdbd6){if(_0x5cdbd6[_0xa01f('0x2e')]!==_0xa01f('0x3e')){var _0x5e11d1={};_0x5e11d1[_0x5cdbd6['name']]={'$like':'%'+_0x4b55a9[_0xa01f('0x31')][_0xa01f('0x3c')]+'%'};return _0x5e11d1;}})});}_0x5ed9b3=_[_0xa01f('0x3d')]({},_0x5ed9b3,_0x4b55a9['options']);var _0xe42843={'where':_0x5ed9b3[_0xa01f('0x3b')]};return db['OpenchannelTransferReport'][_0xa01f('0x1f')](_0xe42843)[_0xa01f('0x24')](function(_0x3bbd57){_0x460dc6['count']=_0x3bbd57;if(_0x4b55a9['query'][_0xa01f('0x3f')]){_0x5ed9b3[_0xa01f('0x40')]=[{'all':!![]}];}return db[_0xa01f('0x2b')][_0xa01f('0x41')](_0x5ed9b3);})[_0xa01f('0x24')](function(_0x29d83d){_0x460dc6['rows']=_0x29d83d;return _0x460dc6;})[_0xa01f('0x24')](respondWithFilteredResult(_0x5f544d,_0x5ed9b3))['catch'](handleError(_0x5f544d,null));};exports[_0xa01f('0x42')]=function(_0xbeb3b8,_0x14c71e){var _0x539635={'raw':!![],'where':{'id':_0xbeb3b8[_0xa01f('0x43')]['id']}},_0x20a391={};_0x20a391[_0xa01f('0x30')]=_[_0xa01f('0x32')](db[_0xa01f('0x2b')][_0xa01f('0x2c')]);_0x20a391[_0xa01f('0x31')]=_[_0xa01f('0x32')](_0xbeb3b8[_0xa01f('0x31')]);_0x20a391[_0xa01f('0x33')]=_[_0xa01f('0x34')](_0x20a391[_0xa01f('0x30')],_0x20a391['query']);_0x539635['attributes']=_['intersection'](_0x20a391[_0xa01f('0x30')],qs['fields'](_0xbeb3b8['query'][_0xa01f('0x36')]));_0x539635[_0xa01f('0x35')]=_0x539635[_0xa01f('0x35')][_0xa01f('0x44')]?_0x539635['attributes']:_0x20a391['model'];if(_0xbeb3b8['query'][_0xa01f('0x3f')]){_0x539635[_0xa01f('0x40')]=[{'all':!![]}];}_0x539635=_[_0xa01f('0x3d')]({},_0x539635,_0xbeb3b8[_0xa01f('0x45')]);return db['OpenchannelTransferReport'][_0xa01f('0x46')](_0x539635)[_0xa01f('0x24')](handleEntityNotFound(_0x14c71e,null))[_0xa01f('0x24')](respondWithResult(_0x14c71e,null))[_0xa01f('0x47')](handleError(_0x14c71e,null));};exports[_0xa01f('0x48')]=function(_0x32857c,_0x1fa775){return db[_0xa01f('0x2b')][_0xa01f('0x48')](_0x32857c[_0xa01f('0x49')],{})['then'](respondWithResult(_0x1fa775,0xc9))['catch'](handleError(_0x1fa775,null));};exports[_0xa01f('0x4a')]=function(_0x63bfa,_0x269820){if(_0x63bfa[_0xa01f('0x49')]['id']){delete _0x63bfa[_0xa01f('0x49')]['id'];}return db[_0xa01f('0x2b')][_0xa01f('0x46')]({'where':{'id':_0x63bfa[_0xa01f('0x43')]['id']}})[_0xa01f('0x24')](handleEntityNotFound(_0x269820,null))[_0xa01f('0x24')](saveUpdates(_0x63bfa[_0xa01f('0x49')],null))[_0xa01f('0x24')](respondWithResult(_0x269820,null))['catch'](handleError(_0x269820,null));};exports[_0xa01f('0x4b')]=function(_0x59a288,_0x3b117c){return db[_0xa01f('0x2b')][_0xa01f('0x46')]({'where':{'id':_0x59a288[_0xa01f('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b117c,null))[_0xa01f('0x24')](removeEntity(_0x3b117c,null))[_0xa01f('0x47')](handleError(_0x3b117c,null));};exports[_0xa01f('0x4c')]=function(_0x2d92a2,_0x164e5b){return db['OpenchannelTransferReport']['describe']()['then'](respondWithResult(_0x164e5b,null))[_0xa01f('0x47')](handleError(_0x164e5b,null));}; \ No newline at end of file +var _0x246f=['fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','query','filters','model','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','intersection','includeAll','find','create','body','describe','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','ejs'];(function(_0x2262a7,_0x48f417){var _0x4d8132=function(_0x433e30){while(--_0x433e30){_0x2262a7['push'](_0x2262a7['shift']());}};_0x4d8132(++_0x48f417);}(_0x246f,0x166));var _0xf246=function(_0xf818d6,_0x990be){_0xf818d6=_0xf818d6-0x0;var _0x59dffe=_0x246f[_0xf818d6];return _0x59dffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf246('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf246('0x1'));var rp=require(_0xf246('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf246('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf246('0x4'));var csv=require(_0xf246('0x5'));var ejs=require(_0xf246('0x6'));var fs=require('fs');var fs_extra=require(_0xf246('0x7'));var _=require(_0xf246('0x8'));var squel=require(_0xf246('0x9'));var crypto=require(_0xf246('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf246('0xb'));var toCsv=require(_0xf246('0x5'));var querystring=require(_0xf246('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf246('0xd'));var as=require(_0xf246('0xe'));var hardwareService=require(_0xf246('0xf'));var logger=require(_0xf246('0x10'))(_0xf246('0x11'));var utils=require('../../config/utils');var config=require(_0xf246('0x12'));var licenseUtil=require(_0xf246('0x13'));var db=require(_0xf246('0x14'))['db'];function respondWithStatusCode(_0x20a3a9,_0x5db1d9){_0x5db1d9=_0x5db1d9||0xcc;return function(_0xd1e9b0){if(_0xd1e9b0){return _0x20a3a9['sendStatus'](_0x5db1d9);}return _0x20a3a9[_0xf246('0x15')](_0x5db1d9)['end']();};}function respondWithResult(_0x15109f,_0x2b5145){_0x2b5145=_0x2b5145||0xc8;return function(_0x524e9b){if(_0x524e9b){return _0x15109f[_0xf246('0x15')](_0x2b5145)[_0xf246('0x16')](_0x524e9b);}};}function respondWithFilteredResult(_0x359b1b,_0x3714ec){return function(_0x59c4f0){if(_0x59c4f0){var _0x2deeda=typeof _0x3714ec['offset']===_0xf246('0x17')&&typeof _0x3714ec[_0xf246('0x18')]===_0xf246('0x17');var _0x4057e3=_0x59c4f0[_0xf246('0x19')];var _0x5066a2=_0x2deeda?0x0:_0x3714ec['offset'];var _0x4e9608=_0x2deeda?_0x59c4f0[_0xf246('0x19')]:_0x3714ec['offset']+_0x3714ec[_0xf246('0x18')];var _0x5d59c0;if(_0x4e9608>=_0x4057e3){_0x4e9608=_0x4057e3;_0x5d59c0=0xc8;}else{_0x5d59c0=0xce;}_0x359b1b[_0xf246('0x15')](_0x5d59c0);return _0x359b1b[_0xf246('0x1a')](_0xf246('0x1b'),_0x5066a2+'-'+_0x4e9608+'/'+_0x4057e3)[_0xf246('0x16')](_0x59c4f0);}return null;};}function patchUpdates(_0x43496a){return function(_0x423d28){try{jsonpatch[_0xf246('0x1c')](_0x423d28,_0x43496a,!![]);}catch(_0x532fa8){return BPromise[_0xf246('0x1d')](_0x532fa8);}return _0x423d28[_0xf246('0x1e')]();};}function saveUpdates(_0x4596d2,_0x3513bb){return function(_0x20bf5b){if(_0x20bf5b){return _0x20bf5b[_0xf246('0x1f')](_0x4596d2)[_0xf246('0x20')](function(_0x3e5f11){return _0x3e5f11;});}return null;};}function removeEntity(_0x4fea57,_0x3a346b){return function(_0x31df39){if(_0x31df39){return _0x31df39[_0xf246('0x21')]()[_0xf246('0x20')](function(){_0x4fea57[_0xf246('0x15')](0xcc)[_0xf246('0x22')]();});}};}function handleEntityNotFound(_0xdac926,_0x4c0fde){return function(_0x4ce10d){if(!_0x4ce10d){_0xdac926[_0xf246('0x23')](0x194);}return _0x4ce10d;};}function handleError(_0x47a5e5,_0x4bfdb1){_0x4bfdb1=_0x4bfdb1||0x1f4;return function(_0x5c6efb){logger[_0xf246('0x24')](_0x5c6efb['stack']);if(_0x5c6efb[_0xf246('0x25')]){delete _0x5c6efb[_0xf246('0x25')];}_0x47a5e5[_0xf246('0x15')](_0x4bfdb1)[_0xf246('0x26')](_0x5c6efb);};}exports[_0xf246('0x27')]=function(_0x430698,_0x22253d){var _0x126602={},_0x571255={},_0x212647={'count':0x0,'rows':[]};var _0x5f0855=_[_0xf246('0x28')](db[_0xf246('0x29')][_0xf246('0x2a')],function(_0x4b7cae){return{'name':_0x4b7cae[_0xf246('0x2b')],'type':_0x4b7cae[_0xf246('0x2c')]['key']};});_0x571255['model']=_[_0xf246('0x28')](_0x5f0855,_0xf246('0x25'));_0x571255[_0xf246('0x2d')]=_['keys'](_0x430698['query']);_0x571255[_0xf246('0x2e')]=_['intersection'](_0x571255[_0xf246('0x2f')],_0x571255[_0xf246('0x2d')]);_0x126602[_0xf246('0x30')]=_['intersection'](_0x571255['model'],qs['fields'](_0x430698[_0xf246('0x2d')][_0xf246('0x31')]));_0x126602[_0xf246('0x30')]=_0x126602[_0xf246('0x30')][_0xf246('0x32')]?_0x126602[_0xf246('0x30')]:_0x571255[_0xf246('0x2f')];if(!_0x430698[_0xf246('0x2d')][_0xf246('0x33')]('nolimit')){_0x126602['limit']=qs['limit'](_0x430698[_0xf246('0x2d')]['limit']);_0x126602[_0xf246('0x34')]=qs[_0xf246('0x34')](_0x430698[_0xf246('0x2d')][_0xf246('0x34')]);}_0x126602[_0xf246('0x35')]=qs[_0xf246('0x36')](_0x430698[_0xf246('0x2d')][_0xf246('0x36')]);_0x126602['where']=qs[_0xf246('0x2e')](_[_0xf246('0x37')](_0x430698['query'],_0x571255[_0xf246('0x2e')]),_0x5f0855);if(_0x430698[_0xf246('0x2d')][_0xf246('0x38')]){_0x126602[_0xf246('0x39')]=_[_0xf246('0x3a')](_0x126602['where'],{'$or':_[_0xf246('0x28')](_0x5f0855,function(_0x1e5c45){if(_0x1e5c45['type']!==_0xf246('0x3b')){var _0x3f2f61={};_0x3f2f61[_0x1e5c45[_0xf246('0x25')]]={'$like':'%'+_0x430698[_0xf246('0x2d')][_0xf246('0x38')]+'%'};return _0x3f2f61;}})});}_0x126602=_['merge']({},_0x126602,_0x430698[_0xf246('0x3c')]);var _0x3ff349={'where':_0x126602[_0xf246('0x39')]};return db['OpenchannelTransferReport']['count'](_0x3ff349)[_0xf246('0x20')](function(_0x5687eb){_0x212647[_0xf246('0x19')]=_0x5687eb;if(_0x430698[_0xf246('0x2d')]['includeAll']){_0x126602[_0xf246('0x3d')]=[{'all':!![]}];}return db[_0xf246('0x29')][_0xf246('0x3e')](_0x126602);})[_0xf246('0x20')](function(_0x1313f3){_0x212647[_0xf246('0x3f')]=_0x1313f3;return _0x212647;})[_0xf246('0x20')](respondWithFilteredResult(_0x22253d,_0x126602))[_0xf246('0x40')](handleError(_0x22253d,null));};exports['show']=function(_0x1f8052,_0x5af8a2){var _0x564010={'raw':!![],'where':{'id':_0x1f8052[_0xf246('0x41')]['id']}},_0x461220={};_0x461220[_0xf246('0x2f')]=_[_0xf246('0x42')](db[_0xf246('0x29')][_0xf246('0x2a')]);_0x461220[_0xf246('0x2d')]=_['keys'](_0x1f8052[_0xf246('0x2d')]);_0x461220[_0xf246('0x2e')]=_[_0xf246('0x43')](_0x461220[_0xf246('0x2f')],_0x461220['query']);_0x564010['attributes']=_[_0xf246('0x43')](_0x461220[_0xf246('0x2f')],qs[_0xf246('0x31')](_0x1f8052[_0xf246('0x2d')][_0xf246('0x31')]));_0x564010[_0xf246('0x30')]=_0x564010[_0xf246('0x30')][_0xf246('0x32')]?_0x564010[_0xf246('0x30')]:_0x461220[_0xf246('0x2f')];if(_0x1f8052['query'][_0xf246('0x44')]){_0x564010[_0xf246('0x3d')]=[{'all':!![]}];}_0x564010=_[_0xf246('0x3a')]({},_0x564010,_0x1f8052['options']);return db[_0xf246('0x29')][_0xf246('0x45')](_0x564010)[_0xf246('0x20')](handleEntityNotFound(_0x5af8a2,null))[_0xf246('0x20')](respondWithResult(_0x5af8a2,null))['catch'](handleError(_0x5af8a2,null));};exports[_0xf246('0x46')]=function(_0x52198a,_0x97ae15){return db[_0xf246('0x29')]['create'](_0x52198a['body'],{})[_0xf246('0x20')](respondWithResult(_0x97ae15,0xc9))[_0xf246('0x40')](handleError(_0x97ae15,null));};exports[_0xf246('0x1f')]=function(_0x4bd472,_0x2f5fa6){if(_0x4bd472[_0xf246('0x47')]['id']){delete _0x4bd472[_0xf246('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xf246('0x45')]({'where':{'id':_0x4bd472[_0xf246('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f5fa6,null))['then'](saveUpdates(_0x4bd472[_0xf246('0x47')],null))['then'](respondWithResult(_0x2f5fa6,null))[_0xf246('0x40')](handleError(_0x2f5fa6,null));};exports[_0xf246('0x21')]=function(_0x4c578e,_0x13b3d2){return db[_0xf246('0x29')][_0xf246('0x45')]({'where':{'id':_0x4c578e['params']['id']}})[_0xf246('0x20')](handleEntityNotFound(_0x13b3d2,null))[_0xf246('0x20')](removeEntity(_0x13b3d2,null))[_0xf246('0x40')](handleError(_0x13b3d2,null));};exports[_0xf246('0x48')]=function(_0x5c61f1,_0x1ccfb6){return db[_0xf246('0x29')]['describe']()['then'](respondWithResult(_0x1ccfb6,null))[_0xf246('0x40')](handleError(_0x1ccfb6,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 4349806..e08b687 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 _0x39d9=['path','rimraf','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39d9,0x146));var _0x939d=function(_0x3e2b04,_0x1f3d86){_0x3e2b04=_0x3e2b04-0x0;var _0x3cbf96=_0x39d9[_0x3e2b04];return _0x3cbf96;};'use strict';var _=require(_0x939d('0x0'));var util=require(_0x939d('0x1'));var logger=require('../../config/logger')(_0x939d('0x2'));var moment=require('moment');var BPromise=require(_0x939d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x939d('0x4'));var rimraf=require(_0x939d('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x939d('0x6')]=function(_0x5b43d4,_0x1860b1){return _0x5b43d4[_0x939d('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x939d('0x8'),'paranoid':![],'indexes':[{'name':_0x939d('0x9'),'fields':[_0x939d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07dc=['request-promise','path','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','moment'];(function(_0x5da6ab,_0x2f5805){var _0x1f60bd=function(_0x14d8bb){while(--_0x14d8bb){_0x5da6ab['push'](_0x5da6ab['shift']());}};_0x1f60bd(++_0x2f5805);}(_0x07dc,0x1d4));var _0xc07d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x07dc[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc07d('0x0'))('api');var moment=require(_0xc07d('0x1'));var BPromise=require('bluebird');var rp=require(_0xc07d('0x2'));var fs=require('fs');var path=require(_0xc07d('0x3'));var rimraf=require('rimraf');var config=require(_0xc07d('0x4'));var attributes=require(_0xc07d('0x5'));module['exports']=function(_0xe3bb35,_0x42e4fe){return _0xe3bb35[_0xc07d('0x6')](_0xc07d('0x7'),attributes,{'tableName':_0xc07d('0x8'),'paranoid':![],'indexes':[{'name':_0xc07d('0x9'),'fields':[_0xc07d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 975a6f6..411c1df 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 _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x172053,_0x379c7e){var _0x893bba=function(_0x4c13d5){while(--_0x4c13d5){_0x172053['push'](_0x172053['shift']());}};_0x893bba(++_0x379c7e);}(_0xf1e1,0x102));var _0x1f1e=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0xf1e1[_0x842858];return _0x46c2a2;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file +var _0x4f0d=['ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x7b61c,_0xcd60e7){var _0x11cfb1=function(_0x39fd7f){while(--_0x39fd7f){_0x7b61c['push'](_0x7b61c['shift']());}};_0x11cfb1(++_0xcd60e7);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x4f0d[_0xf55e73];return _0x116b99;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4f0('0x0'));var db=require(_0xd4f0('0x1'))['db'];var utils=require(_0xd4f0('0x2'));var logger=require('../../config/logger')(_0xd4f0('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16da18,_0x4dd938,_0x50e79f){return new BPromise(function(_0x19a779,_0x69309d){return client[_0xd4f0('0x5')](_0x16da18,_0x50e79f)[_0xd4f0('0x6')](function(_0x9b959f){logger['info'](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4dd938,_0xd4f0('0x8'),JSON[_0xd4f0('0x9')](_0x9b959f));if(_0x9b959f['error']){if(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xb')]===0x1f4){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')]['message']);return _0x69309d(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);return _0x19a779(_0x9b959f[_0xd4f0('0xa')][_0xd4f0('0xc')]);}else{logger[_0xd4f0('0xd')](_0xd4f0('0x7'),_0x4dd938,_0xd4f0('0x8'));_0x19a779(_0x9b959f[_0xd4f0('0xe')]['message']);}})['catch'](function(_0x169443){logger[_0xd4f0('0xa')](_0xd4f0('0x7'),_0x4dd938,_0x169443);_0x69309d(_0x169443);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index be4b091..22b4d89 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 _0x423c=['fs-extra','../../config/environment','./pause.controller','get','isAuthenticated','/:id','create','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x423c,0x91));var _0xc423=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x423c[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0xc423('0x0'));var util=require('util');var path=require(_0xc423('0x1'));var timeout=require(_0xc423('0x2'));var express=require(_0xc423('0x3'));var router=express[_0xc423('0x4')]();var fs_extra=require(_0xc423('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc423('0x6'));var controller=require(_0xc423('0x7'));router[_0xc423('0x8')]('/',auth[_0xc423('0x9')](),controller['index']);router[_0xc423('0x8')](_0xc423('0xa'),auth[_0xc423('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc423('0xb')]);router[_0xc423('0xc')]('/:id',auth[_0xc423('0x9')](),controller[_0xc423('0xd')]);router['delete'](_0xc423('0xa'),auth['isAuthenticated'](),controller[_0xc423('0xe')]);module['exports']=router; \ No newline at end of file +var _0x60c2=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','show','create'];(function(_0x42a0fe,_0x4c693c){var _0x391dff=function(_0x5063e6){while(--_0x5063e6){_0x42a0fe['push'](_0x42a0fe['shift']());}};_0x391dff(++_0x4c693c);}(_0x60c2,0xce));var _0x260c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60c2[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var fs_extra=require(_0x260c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x260c('0x6'));var config=require(_0x260c('0x7'));var controller=require(_0x260c('0x8'));router['get']('/',auth[_0x260c('0x9')](),controller[_0x260c('0xa')]);router[_0x260c('0xb')]('/:id',auth[_0x260c('0x9')](),controller[_0x260c('0xc')]);router['post']('/',auth[_0x260c('0x9')](),controller[_0x260c('0xd')]);router[_0x260c('0xe')](_0x260c('0xf'),auth['isAuthenticated'](),controller[_0x260c('0x10')]);router[_0x260c('0x11')](_0x260c('0xf'),auth[_0x260c('0x9')](),controller[_0x260c('0x12')]);module[_0x260c('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 73cdfba..2a20d5a 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 _0x6134=['name','STRING'];(function(_0x9704f1,_0x2bbd22){var _0x39ae13=function(_0x2deba7){while(--_0x2deba7){_0x9704f1['push'](_0x9704f1['shift']());}};_0x39ae13(++_0x2bbd22);}(_0x6134,0x195));var _0x4613=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6134[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4613('0x0')],'unique':_0x4613('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x4613('0x0')]}}; \ No newline at end of file +var _0x13a6=['sequelize','exports','STRING','name'];(function(_0xe966b3,_0x33dc7){var _0x3cf386=function(_0x53f7ea){while(--_0x53f7ea){_0xe966b3['push'](_0xe966b3['shift']());}};_0x3cf386(++_0x33dc7);}(_0x13a6,0x144));var _0x613a=function(_0x1d795a,_0x14eec0){_0x1d795a=_0x1d795a-0x0;var _0x576324=_0x13a6[_0x1d795a];return _0x576324;};'use strict';var Sequelize=require(_0x613a('0x0'));module[_0x613a('0x1')]={'name':{'type':Sequelize[_0x613a('0x2')],'unique':_0x613a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x613a('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index fb206a4..f3d2044 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 _0xa0ac=['Pauses','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','error','stack','name','send','index','Pause','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa0ac,0xac));var _0xca0a=function(_0x55fde2,_0xe9132f){_0x55fde2=_0x55fde2-0x0;var _0x1e7ae7=_0xa0ac[_0x55fde2];return _0x1e7ae7;};'use strict';var emlformat=require(_0xca0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca0a('0x2'));var moment=require(_0xca0a('0x3'));var BPromise=require(_0xca0a('0x4'));var Mustache=require(_0xca0a('0x5'));var util=require(_0xca0a('0x6'));var path=require(_0xca0a('0x7'));var sox=require(_0xca0a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca0a('0x9'));var _=require(_0xca0a('0xa'));var squel=require('squel');var crypto=require(_0xca0a('0xb'));var jsforce=require(_0xca0a('0xc'));var deskjs=require(_0xca0a('0xd'));var toCsv=require(_0xca0a('0xe'));var querystring=require(_0xca0a('0xf'));var Papa=require('papaparse');var Redis=require(_0xca0a('0x10'));var authService=require(_0xca0a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xca0a('0x12'));var hardwareService=require(_0xca0a('0x13'));var logger=require(_0xca0a('0x14'))(_0xca0a('0x15'));var utils=require('../../config/utils');var config=require(_0xca0a('0x16'));var licenseUtil=require(_0xca0a('0x17'));var db=require(_0xca0a('0x18'))['db'];function respondWithStatusCode(_0x58b42d,_0x4537d7){_0x4537d7=_0x4537d7||0xcc;return function(_0x4447ac){if(_0x4447ac){return _0x58b42d['sendStatus'](_0x4537d7);}return _0x58b42d[_0xca0a('0x19')](_0x4537d7)['end']();};}function respondWithResult(_0x2b2135,_0x33eca8){_0x33eca8=_0x33eca8||0xc8;return function(_0x525fe3){if(_0x525fe3){return _0x2b2135[_0xca0a('0x19')](_0x33eca8)[_0xca0a('0x1a')](_0x525fe3);}};}function respondWithFilteredResult(_0x5590fc,_0x26c15e){return function(_0x387576){if(_0x387576){var _0x16c5c4=typeof _0x26c15e[_0xca0a('0x1b')]===_0xca0a('0x1c')&&typeof _0x26c15e[_0xca0a('0x1d')]==='undefined';var _0x4d4b79=_0x387576['count'];var _0x21d0c8=_0x16c5c4?0x0:_0x26c15e['offset'];var _0x663531=_0x16c5c4?_0x387576[_0xca0a('0x1e')]:_0x26c15e[_0xca0a('0x1b')]+_0x26c15e['limit'];var _0x327578;if(_0x663531>=_0x4d4b79){_0x663531=_0x4d4b79;_0x327578=0xc8;}else{_0x327578=0xce;}_0x5590fc[_0xca0a('0x19')](_0x327578);return _0x5590fc[_0xca0a('0x1f')]('Content-Range',_0x21d0c8+'-'+_0x663531+'/'+_0x4d4b79)['json'](_0x387576);}return null;};}function patchUpdates(_0x5af7d4){return function(_0xe688d2){try{jsonpatch[_0xca0a('0x20')](_0xe688d2,_0x5af7d4,!![]);}catch(_0x3978c1){return BPromise['reject'](_0x3978c1);}return _0xe688d2[_0xca0a('0x21')]();};}function saveUpdates(_0x5c45e8,_0x5eeced){return function(_0x521ec3){if(_0x521ec3){return _0x521ec3['update'](_0x5c45e8)[_0xca0a('0x22')](function(_0x257640){return _0x257640;});}return null;};}function removeEntity(_0x54669b,_0x29986d){return function(_0x3bd94b){if(_0x3bd94b){return _0x3bd94b[_0xca0a('0x23')]()[_0xca0a('0x22')](function(){var _0x384ccc=_0x3bd94b['get']({'plain':!![]});var _0x1a5b02='Pauses';return db['UserProfileResource'][_0xca0a('0x23')]({'where':{'type':_0x1a5b02,'resourceId':_0x384ccc['id']}})[_0xca0a('0x22')](function(){return _0x3bd94b;});})[_0xca0a('0x22')](function(){_0x54669b[_0xca0a('0x19')](0xcc)[_0xca0a('0x24')]();});}};}function handleEntityNotFound(_0x4a9273,_0x4c56f9){return function(_0x2bc300){if(!_0x2bc300){_0x4a9273['sendStatus'](0x194);}return _0x2bc300;};}function handleError(_0x18872c,_0x3a2703){_0x3a2703=_0x3a2703||0x1f4;return function(_0x1f537d){logger[_0xca0a('0x25')](_0x1f537d[_0xca0a('0x26')]);if(_0x1f537d[_0xca0a('0x27')]){delete _0x1f537d[_0xca0a('0x27')];}_0x18872c[_0xca0a('0x19')](_0x3a2703)[_0xca0a('0x28')](_0x1f537d);};}exports[_0xca0a('0x29')]=function(_0x57be49,_0x26a1ef){var _0x2c65b9={},_0x425ca9={},_0x516ddc={'count':0x0,'rows':[]};var _0x11c5a6=_['map'](db[_0xca0a('0x2a')][_0xca0a('0x2b')],function(_0x44e606){return{'name':_0x44e606[_0xca0a('0x2c')],'type':_0x44e606['type'][_0xca0a('0x2d')]};});_0x425ca9[_0xca0a('0x2e')]=_['map'](_0x11c5a6,_0xca0a('0x27'));_0x425ca9['query']=_['keys'](_0x57be49[_0xca0a('0x2f')]);_0x425ca9[_0xca0a('0x30')]=_[_0xca0a('0x31')](_0x425ca9[_0xca0a('0x2e')],_0x425ca9['query']);_0x2c65b9[_0xca0a('0x32')]=_[_0xca0a('0x31')](_0x425ca9[_0xca0a('0x2e')],qs[_0xca0a('0x33')](_0x57be49['query']['fields']));_0x2c65b9[_0xca0a('0x32')]=_0x2c65b9[_0xca0a('0x32')][_0xca0a('0x34')]?_0x2c65b9[_0xca0a('0x32')]:_0x425ca9['model'];if(!_0x57be49[_0xca0a('0x2f')]['hasOwnProperty'](_0xca0a('0x35'))){_0x2c65b9[_0xca0a('0x1d')]=qs[_0xca0a('0x1d')](_0x57be49['query'][_0xca0a('0x1d')]);_0x2c65b9['offset']=qs[_0xca0a('0x1b')](_0x57be49[_0xca0a('0x2f')][_0xca0a('0x1b')]);}_0x2c65b9[_0xca0a('0x36')]=qs[_0xca0a('0x37')](_0x57be49['query']['sort']);_0x2c65b9[_0xca0a('0x38')]=qs['filters'](_[_0xca0a('0x39')](_0x57be49[_0xca0a('0x2f')],_0x425ca9[_0xca0a('0x30')]),_0x11c5a6);if(_0x57be49[_0xca0a('0x2f')][_0xca0a('0x3a')]){_0x2c65b9[_0xca0a('0x38')]=_[_0xca0a('0x3b')](_0x2c65b9[_0xca0a('0x38')],{'$or':_['map'](_0x11c5a6,function(_0x1b354a){if(_0x1b354a['type']!==_0xca0a('0x3c')){var _0x3b8eac={};_0x3b8eac[_0x1b354a[_0xca0a('0x27')]]={'$like':'%'+_0x57be49['query']['filter']+'%'};return _0x3b8eac;}})});}_0x2c65b9=_['merge']({},_0x2c65b9,_0x57be49[_0xca0a('0x3d')]);var _0x2243b5={'where':_0x2c65b9[_0xca0a('0x38')]};return db[_0xca0a('0x2a')]['count'](_0x2243b5)[_0xca0a('0x22')](function(_0x14ee69){_0x516ddc[_0xca0a('0x1e')]=_0x14ee69;if(_0x57be49[_0xca0a('0x2f')][_0xca0a('0x3e')]){_0x2c65b9[_0xca0a('0x3f')]=[{'all':!![]}];}return db[_0xca0a('0x2a')][_0xca0a('0x40')](_0x2c65b9);})['then'](function(_0x561c23){_0x516ddc[_0xca0a('0x41')]=_0x561c23;return _0x516ddc;})[_0xca0a('0x22')](respondWithFilteredResult(_0x26a1ef,_0x2c65b9))['catch'](handleError(_0x26a1ef,null));};exports[_0xca0a('0x42')]=function(_0x45b7e3,_0xc345dc){var _0x23c876={'raw':!![],'where':{'id':_0x45b7e3[_0xca0a('0x43')]['id']}},_0x3b736f={};_0x3b736f[_0xca0a('0x2e')]=_[_0xca0a('0x44')](db[_0xca0a('0x2a')][_0xca0a('0x2b')]);_0x3b736f['query']=_['keys'](_0x45b7e3['query']);_0x3b736f[_0xca0a('0x30')]=_[_0xca0a('0x31')](_0x3b736f[_0xca0a('0x2e')],_0x3b736f[_0xca0a('0x2f')]);_0x23c876['attributes']=_[_0xca0a('0x31')](_0x3b736f[_0xca0a('0x2e')],qs['fields'](_0x45b7e3[_0xca0a('0x2f')][_0xca0a('0x33')]));_0x23c876[_0xca0a('0x32')]=_0x23c876[_0xca0a('0x32')][_0xca0a('0x34')]?_0x23c876['attributes']:_0x3b736f[_0xca0a('0x2e')];if(_0x45b7e3['query']['includeAll']){_0x23c876[_0xca0a('0x3f')]=[{'all':!![]}];}_0x23c876=_[_0xca0a('0x3b')]({},_0x23c876,_0x45b7e3[_0xca0a('0x3d')]);return db[_0xca0a('0x2a')]['find'](_0x23c876)[_0xca0a('0x22')](handleEntityNotFound(_0xc345dc,null))['then'](respondWithResult(_0xc345dc,null))[_0xca0a('0x45')](handleError(_0xc345dc,null));};exports[_0xca0a('0x46')]=function(_0x5a35a5,_0x22f5f8){return db[_0xca0a('0x2a')][_0xca0a('0x46')](_0x5a35a5['body'],{})[_0xca0a('0x22')](function(_0xed4673){var _0x17ffc8=_0x5a35a5['user']['get']({'plain':!![]});if(!_0x17ffc8)throw new Error(_0xca0a('0x47'));if(_0x17ffc8[_0xca0a('0x48')]==='user'){var _0x4d651e=_0xed4673[_0xca0a('0x49')]({'plain':!![]});var _0xf3d2f4=_0xca0a('0x4a');return db[_0xca0a('0x4b')][_0xca0a('0x4c')]({'where':{'name':_0xf3d2f4,'userProfileId':_0x17ffc8['userProfileId']},'raw':!![]})[_0xca0a('0x22')](function(_0xd6cd89){if(_0xd6cd89&&_0xd6cd89[_0xca0a('0x4d')]===0x0){return db[_0xca0a('0x4e')][_0xca0a('0x46')]({'name':_0x4d651e['name'],'resourceId':_0x4d651e['id'],'type':_0xd6cd89[_0xca0a('0x27')],'sectionId':_0xd6cd89['id']},{})[_0xca0a('0x22')](function(){return _0xed4673;});}else{return _0xed4673;}})['catch'](function(_0x4a7dc9){logger[_0xca0a('0x25')](_0xca0a('0x4f'),_0x4a7dc9);throw _0x4a7dc9;});}return _0xed4673;})[_0xca0a('0x22')](respondWithResult(_0x22f5f8,0xc9))[_0xca0a('0x45')](handleError(_0x22f5f8,null));};exports[_0xca0a('0x50')]=function(_0x1649b1,_0x7ec12a){if(_0x1649b1['body']['id']){delete _0x1649b1[_0xca0a('0x51')]['id'];}return db[_0xca0a('0x2a')][_0xca0a('0x4c')]({'where':{'id':_0x1649b1['params']['id']}})[_0xca0a('0x22')](handleEntityNotFound(_0x7ec12a,null))[_0xca0a('0x22')](saveUpdates(_0x1649b1['body'],null))[_0xca0a('0x22')](respondWithResult(_0x7ec12a,null))[_0xca0a('0x45')](handleError(_0x7ec12a,null));};exports[_0xca0a('0x23')]=function(_0x170c78,_0x97f0b0){return db[_0xca0a('0x2a')][_0xca0a('0x4c')]({'where':{'id':_0x170c78['params']['id']}})[_0xca0a('0x22')](handleEntityNotFound(_0x97f0b0,null))[_0xca0a('0x22')](removeEntity(_0x97f0b0,null))[_0xca0a('0x45')](handleError(_0x97f0b0,null));}; \ No newline at end of file +var _0xf461=['filter','merge','VIRTUAL','options','Pause','includeAll','findAll','rows','catch','show','fields','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x2aae4d,_0x23330c){var _0x3c1e15=function(_0x43761d){while(--_0x43761d){_0x2aae4d['push'](_0x2aae4d['shift']());}};_0x3c1e15(++_0x23330c);}(_0xf461,0x11e));var _0x1f46=function(_0x1eaae9,_0x2b112c){_0x1eaae9=_0x1eaae9-0x0;var _0x53fc4d=_0xf461[_0x1eaae9];return _0x53fc4d;};'use strict';var emlformat=require(_0x1f46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f46('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1f46('0x2'));var moment=require(_0x1f46('0x3'));var BPromise=require(_0x1f46('0x4'));var Mustache=require(_0x1f46('0x5'));var util=require(_0x1f46('0x6'));var path=require(_0x1f46('0x7'));var sox=require(_0x1f46('0x8'));var csv=require(_0x1f46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f46('0xa'));var _=require('lodash');var squel=require(_0x1f46('0xb'));var crypto=require('crypto');var jsforce=require(_0x1f46('0xc'));var deskjs=require(_0x1f46('0xd'));var toCsv=require(_0x1f46('0x9'));var querystring=require(_0x1f46('0xe'));var Papa=require(_0x1f46('0xf'));var Redis=require(_0x1f46('0x10'));var authService=require(_0x1f46('0x11'));var qs=require(_0x1f46('0x12'));var as=require(_0x1f46('0x13'));var hardwareService=require(_0x1f46('0x14'));var logger=require(_0x1f46('0x15'))(_0x1f46('0x16'));var utils=require(_0x1f46('0x17'));var config=require(_0x1f46('0x18'));var licenseUtil=require(_0x1f46('0x19'));var db=require(_0x1f46('0x1a'))['db'];function respondWithStatusCode(_0xa41054,_0x2ed01f){_0x2ed01f=_0x2ed01f||0xcc;return function(_0x72336b){if(_0x72336b){return _0xa41054[_0x1f46('0x1b')](_0x2ed01f);}return _0xa41054['status'](_0x2ed01f)[_0x1f46('0x1c')]();};}function respondWithResult(_0x5d9198,_0x139c25){_0x139c25=_0x139c25||0xc8;return function(_0x2a2a2a){if(_0x2a2a2a){return _0x5d9198[_0x1f46('0x1d')](_0x139c25)[_0x1f46('0x1e')](_0x2a2a2a);}};}function respondWithFilteredResult(_0x380aa0,_0x24e46d){return function(_0x581bb4){if(_0x581bb4){var _0x47712c=typeof _0x24e46d[_0x1f46('0x1f')]===_0x1f46('0x20')&&typeof _0x24e46d['limit']===_0x1f46('0x20');var _0x345ab8=_0x581bb4[_0x1f46('0x21')];var _0x19e2f5=_0x47712c?0x0:_0x24e46d['offset'];var _0x13d7bb=_0x47712c?_0x581bb4[_0x1f46('0x21')]:_0x24e46d[_0x1f46('0x1f')]+_0x24e46d[_0x1f46('0x22')];var _0x32470b;if(_0x13d7bb>=_0x345ab8){_0x13d7bb=_0x345ab8;_0x32470b=0xc8;}else{_0x32470b=0xce;}_0x380aa0[_0x1f46('0x1d')](_0x32470b);return _0x380aa0[_0x1f46('0x23')]('Content-Range',_0x19e2f5+'-'+_0x13d7bb+'/'+_0x345ab8)['json'](_0x581bb4);}return null;};}function patchUpdates(_0x350ced){return function(_0x4ffad3){try{jsonpatch[_0x1f46('0x24')](_0x4ffad3,_0x350ced,!![]);}catch(_0x5dcb12){return BPromise[_0x1f46('0x25')](_0x5dcb12);}return _0x4ffad3[_0x1f46('0x26')]();};}function saveUpdates(_0x4f9bb8,_0x12eb7e){return function(_0x39de95){if(_0x39de95){return _0x39de95[_0x1f46('0x27')](_0x4f9bb8)[_0x1f46('0x28')](function(_0x57f95c){return _0x57f95c;});}return null;};}function removeEntity(_0x305546,_0x3f27d7){return function(_0x4d0b4d){if(_0x4d0b4d){return _0x4d0b4d[_0x1f46('0x29')]()[_0x1f46('0x28')](function(){var _0x5560cd=_0x4d0b4d['get']({'plain':!![]});var _0xf2fa8d=_0x1f46('0x2a');return db[_0x1f46('0x2b')][_0x1f46('0x29')]({'where':{'type':_0xf2fa8d,'resourceId':_0x5560cd['id']}})[_0x1f46('0x28')](function(){return _0x4d0b4d;});})[_0x1f46('0x28')](function(){_0x305546['status'](0xcc)[_0x1f46('0x1c')]();});}};}function handleEntityNotFound(_0xf9d1f,_0x2e3473){return function(_0x750d8c){if(!_0x750d8c){_0xf9d1f[_0x1f46('0x1b')](0x194);}return _0x750d8c;};}function handleError(_0x92800d,_0xfa8fd0){_0xfa8fd0=_0xfa8fd0||0x1f4;return function(_0x4e5856){logger[_0x1f46('0x2c')](_0x4e5856[_0x1f46('0x2d')]);if(_0x4e5856[_0x1f46('0x2e')]){delete _0x4e5856[_0x1f46('0x2e')];}_0x92800d['status'](_0xfa8fd0)[_0x1f46('0x2f')](_0x4e5856);};}exports[_0x1f46('0x30')]=function(_0x4f3f40,_0x4b2cbb){var _0x254a2f={},_0x55d9df={},_0x79df1d={'count':0x0,'rows':[]};var _0x27c875=_[_0x1f46('0x31')](db['Pause'][_0x1f46('0x32')],function(_0x13c4f2){return{'name':_0x13c4f2['fieldName'],'type':_0x13c4f2[_0x1f46('0x33')]['key']};});_0x55d9df[_0x1f46('0x34')]=_[_0x1f46('0x31')](_0x27c875,_0x1f46('0x2e'));_0x55d9df[_0x1f46('0x35')]=_[_0x1f46('0x36')](_0x4f3f40[_0x1f46('0x35')]);_0x55d9df['filters']=_[_0x1f46('0x37')](_0x55d9df[_0x1f46('0x34')],_0x55d9df['query']);_0x254a2f[_0x1f46('0x38')]=_[_0x1f46('0x37')](_0x55d9df['model'],qs['fields'](_0x4f3f40[_0x1f46('0x35')]['fields']));_0x254a2f[_0x1f46('0x38')]=_0x254a2f['attributes']['length']?_0x254a2f[_0x1f46('0x38')]:_0x55d9df[_0x1f46('0x34')];if(!_0x4f3f40[_0x1f46('0x35')][_0x1f46('0x39')](_0x1f46('0x3a'))){_0x254a2f[_0x1f46('0x22')]=qs[_0x1f46('0x22')](_0x4f3f40[_0x1f46('0x35')][_0x1f46('0x22')]);_0x254a2f[_0x1f46('0x1f')]=qs[_0x1f46('0x1f')](_0x4f3f40[_0x1f46('0x35')]['offset']);}_0x254a2f['order']=qs['sort'](_0x4f3f40['query'][_0x1f46('0x3b')]);_0x254a2f[_0x1f46('0x3c')]=qs['filters'](_['pick'](_0x4f3f40['query'],_0x55d9df[_0x1f46('0x3d')]),_0x27c875);if(_0x4f3f40['query'][_0x1f46('0x3e')]){_0x254a2f[_0x1f46('0x3c')]=_[_0x1f46('0x3f')](_0x254a2f['where'],{'$or':_['map'](_0x27c875,function(_0x2000f1){if(_0x2000f1[_0x1f46('0x33')]!==_0x1f46('0x40')){var _0x4cf254={};_0x4cf254[_0x2000f1[_0x1f46('0x2e')]]={'$like':'%'+_0x4f3f40['query'][_0x1f46('0x3e')]+'%'};return _0x4cf254;}})});}_0x254a2f=_['merge']({},_0x254a2f,_0x4f3f40[_0x1f46('0x41')]);var _0x2da842={'where':_0x254a2f[_0x1f46('0x3c')]};return db[_0x1f46('0x42')][_0x1f46('0x21')](_0x2da842)[_0x1f46('0x28')](function(_0x5b64db){_0x79df1d[_0x1f46('0x21')]=_0x5b64db;if(_0x4f3f40[_0x1f46('0x35')][_0x1f46('0x43')]){_0x254a2f['include']=[{'all':!![]}];}return db[_0x1f46('0x42')][_0x1f46('0x44')](_0x254a2f);})[_0x1f46('0x28')](function(_0x5de1a8){_0x79df1d[_0x1f46('0x45')]=_0x5de1a8;return _0x79df1d;})[_0x1f46('0x28')](respondWithFilteredResult(_0x4b2cbb,_0x254a2f))[_0x1f46('0x46')](handleError(_0x4b2cbb,null));};exports[_0x1f46('0x47')]=function(_0xd52803,_0x5af830){var _0x359d31={'raw':!![],'where':{'id':_0xd52803['params']['id']}},_0x4d3f9f={};_0x4d3f9f['model']=_[_0x1f46('0x36')](db['Pause'][_0x1f46('0x32')]);_0x4d3f9f['query']=_['keys'](_0xd52803[_0x1f46('0x35')]);_0x4d3f9f[_0x1f46('0x3d')]=_[_0x1f46('0x37')](_0x4d3f9f[_0x1f46('0x34')],_0x4d3f9f[_0x1f46('0x35')]);_0x359d31[_0x1f46('0x38')]=_[_0x1f46('0x37')](_0x4d3f9f['model'],qs[_0x1f46('0x48')](_0xd52803['query']['fields']));_0x359d31['attributes']=_0x359d31['attributes'][_0x1f46('0x49')]?_0x359d31[_0x1f46('0x38')]:_0x4d3f9f['model'];if(_0xd52803[_0x1f46('0x35')][_0x1f46('0x43')]){_0x359d31[_0x1f46('0x4a')]=[{'all':!![]}];}_0x359d31=_[_0x1f46('0x3f')]({},_0x359d31,_0xd52803[_0x1f46('0x41')]);return db[_0x1f46('0x42')][_0x1f46('0x4b')](_0x359d31)[_0x1f46('0x28')](handleEntityNotFound(_0x5af830,null))[_0x1f46('0x28')](respondWithResult(_0x5af830,null))[_0x1f46('0x46')](handleError(_0x5af830,null));};exports[_0x1f46('0x4c')]=function(_0x5a7654,_0x40c34e){return db[_0x1f46('0x42')]['create'](_0x5a7654[_0x1f46('0x4d')],{})[_0x1f46('0x28')](function(_0x13e579){var _0x5d845a=_0x5a7654[_0x1f46('0x4e')][_0x1f46('0x4f')]({'plain':!![]});if(!_0x5d845a)throw new Error(_0x1f46('0x50'));if(_0x5d845a[_0x1f46('0x51')]===_0x1f46('0x4e')){var _0x2d2a6b=_0x13e579[_0x1f46('0x4f')]({'plain':!![]});var _0x30049f=_0x1f46('0x2a');return db[_0x1f46('0x52')][_0x1f46('0x4b')]({'where':{'name':_0x30049f,'userProfileId':_0x5d845a[_0x1f46('0x53')]},'raw':!![]})[_0x1f46('0x28')](function(_0x32cf18){if(_0x32cf18&&_0x32cf18[_0x1f46('0x54')]===0x0){return db[_0x1f46('0x2b')][_0x1f46('0x4c')]({'name':_0x2d2a6b[_0x1f46('0x2e')],'resourceId':_0x2d2a6b['id'],'type':_0x32cf18[_0x1f46('0x2e')],'sectionId':_0x32cf18['id']},{})['then'](function(){return _0x13e579;});}else{return _0x13e579;}})[_0x1f46('0x46')](function(_0xaf3e88){logger[_0x1f46('0x2c')](_0x1f46('0x55'),_0xaf3e88);throw _0xaf3e88;});}return _0x13e579;})[_0x1f46('0x28')](respondWithResult(_0x40c34e,0xc9))[_0x1f46('0x46')](handleError(_0x40c34e,null));};exports[_0x1f46('0x27')]=function(_0x1d1a75,_0x53d970){if(_0x1d1a75['body']['id']){delete _0x1d1a75['body']['id'];}return db[_0x1f46('0x42')][_0x1f46('0x4b')]({'where':{'id':_0x1d1a75['params']['id']}})['then'](handleEntityNotFound(_0x53d970,null))[_0x1f46('0x28')](saveUpdates(_0x1d1a75['body'],null))[_0x1f46('0x28')](respondWithResult(_0x53d970,null))[_0x1f46('0x46')](handleError(_0x53d970,null));};exports['destroy']=function(_0x4e9f8a,_0x4b35b9){return db['Pause']['find']({'where':{'id':_0x4e9f8a[_0x1f46('0x56')]['id']}})[_0x1f46('0x28')](handleEntityNotFound(_0x4b35b9,null))[_0x1f46('0x28')](removeEntity(_0x4b35b9,null))[_0x1f46('0x46')](handleError(_0x4b35b9,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f2b3458..bac8f3a 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x16f7df,_0x66d40c){var _0x20020e=function(_0x2ddfc7){while(--_0x2ddfc7){_0x16f7df['push'](_0x16f7df['shift']());}};_0x20020e(++_0x66d40c);}(_0xe14b,0x93));var _0xbe14=function(_0x44c81f,_0xdb5984){_0x44c81f=_0x44c81f-0x0;var _0x1d7083=_0xe14b[_0x44c81f];return _0x1d7083;};'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 +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index b7b20f8..92ee629 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(_0x1b4da9,_0x21b725){var _0x3b3de9=function(_0x50e802){while(--_0x50e802){_0x1b4da9['push'](_0x1b4da9['shift']());}};_0x3b3de9(++_0x21b725);}(_0xb10b,0x12a));var _0xbb10=function(_0x38e47a,_0xc032eb){_0x38e47a=_0x38e47a-0x0;var _0x1b0649=_0xb10b[_0x38e47a];return _0x1b0649;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x52ea90,_0x4dedaf){var _0x14d239=function(_0x4b6eef){while(--_0x4b6eef){_0x52ea90['push'](_0x52ea90['shift']());}};_0x14d239(++_0x4dedaf);}(_0x7a54,0x106));var _0x47a5=function(_0x317ab4,_0x896565){_0x317ab4=_0x317ab4-0x0;var _0x5b3a5a=_0x7a54[_0x317ab4];return _0x5b3a5a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index b1a6315..99c47d5 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 _0xadb8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','join','root','server/files/plugins','originalname','%s-%s%s','extname','post','single','file','upload','webhookPost','update','delete','exports'];(function(_0x57ffe6,_0xee95cc){var _0x59698f=function(_0x102e2b){while(--_0x102e2b){_0x57ffe6['push'](_0x57ffe6['shift']());}};_0x59698f(++_0xee95cc);}(_0xadb8,0x1d0));var _0x8adb=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0xadb8[_0x28e71a];return _0x268fed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require(_0x8adb('0x7'));router['get']('/',auth[_0x8adb('0x8')](),controller[_0x8adb('0x9')]);router[_0x8adb('0xa')](_0x8adb('0xb'),controller[_0x8adb('0xc')]);router[_0x8adb('0xa')](_0x8adb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8adb('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa095e1,_0x628c45,_0x46c6fb){_0x46c6fb(null,path[_0x8adb('0xf')](config[_0x8adb('0x10')],_0x8adb('0x11')));},'filename':function(_0x2a6574,_0x2828f1,_0x2d6b55){_0x2828f1[_0x8adb('0x12')]=_0x2828f1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d6b55(null,util['format'](_0x8adb('0x13'),path['basename'](_0x2828f1[_0x8adb('0x12')],path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])),Date['now'](),path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])));}})});router[_0x8adb('0x15')]('/',upload[_0x8adb('0x16')](_0x8adb('0x17')),controller[_0x8adb('0x18')]);router['post'](_0x8adb('0xb'),controller[_0x8adb('0x19')]);router['put']('/:id',auth[_0x8adb('0x8')](),controller[_0x8adb('0x1a')]);router[_0x8adb('0x1b')](_0x8adb('0xd'),auth[_0x8adb('0x8')](),controller[_0x8adb('0x1b')]);module[_0x8adb('0x1c')]=router; \ No newline at end of file +var _0xb4e6=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','/webhook','webhookPost'];(function(_0x3ec68b,_0x379b17){var _0x4224fa=function(_0x26a6ca){while(--_0x26a6ca){_0x3ec68b['push'](_0x3ec68b['shift']());}};_0x4224fa(++_0x379b17);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xb4e6[_0x5a26f5];return _0x2e9ef7;};'use strict';var multer=require(_0x6b4e('0x0'));var util=require('util');var path=require(_0x6b4e('0x1'));var timeout=require(_0x6b4e('0x2'));var express=require(_0x6b4e('0x3'));var router=express[_0x6b4e('0x4')]();var fs_extra=require(_0x6b4e('0x5'));var auth=require(_0x6b4e('0x6'));var interaction=require(_0x6b4e('0x7'));var config=require('../../config/environment');var controller=require(_0x6b4e('0x8'));router[_0x6b4e('0x9')]('/',auth[_0x6b4e('0xa')](),controller['index']);router[_0x6b4e('0x9')]('/webhook',controller['webhookGet']);router[_0x6b4e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6b4e('0xb')]);router[_0x6b4e('0x9')](_0x6b4e('0xc'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0xd')]);var upload=multer({'storage':multer[_0x6b4e('0xe')]({'destination':function(_0x323487,_0x49c734,_0x39b4ec){_0x39b4ec(null,path[_0x6b4e('0xf')](config['root'],_0x6b4e('0x10')));},'filename':function(_0x9cd7da,_0x432399,_0x2b2ce0){_0x432399[_0x6b4e('0x11')]=_0x432399[_0x6b4e('0x11')][_0x6b4e('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b2ce0(null,util['format'](_0x6b4e('0x13'),path[_0x6b4e('0x14')](_0x432399['originalname'],path[_0x6b4e('0x15')](_0x432399['originalname'])),Date[_0x6b4e('0x16')](),path[_0x6b4e('0x15')](_0x432399[_0x6b4e('0x11')])));}})});router[_0x6b4e('0x17')]('/',upload[_0x6b4e('0x18')](_0x6b4e('0x19')),controller['upload']);router['post'](_0x6b4e('0x1a'),controller[_0x6b4e('0x1b')]);router[_0x6b4e('0x1c')](_0x6b4e('0x1d'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x1e')]);router[_0x6b4e('0x1f')](_0x6b4e('0x1d'),auth[_0x6b4e('0xa')](),controller[_0x6b4e('0x1f')]);module[_0x6b4e('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e7a453d..abf8387 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 _0xcf20=['script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html'];(function(_0x15feca,_0x24cfb6){var _0x42557a=function(_0xceca4f){while(--_0xceca4f){_0x15feca['push'](_0x15feca['shift']());}};_0x42557a(++_0x24cfb6);}(_0xcf20,0xd8));var _0x0cf2=function(_0x3e9b19,_0x3ea2e1){_0x3e9b19=_0x3e9b19-0x0;var _0x4c3c4e=_0xcf20[_0x3e9b19];return _0x4c3c4e;};'use strict';var Sequelize=require('sequelize');module[_0x0cf2('0x0')]={'name':{'type':Sequelize[_0x0cf2('0x1')]},'type':{'type':Sequelize[_0x0cf2('0x2')](_0x0cf2('0x3'),_0x0cf2('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x0cf2('0x1')],'comment':_0x0cf2('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x0cf2('0x2')](_0x0cf2('0x6'),_0x0cf2('0x7'),_0x0cf2('0x8'),_0x0cf2('0x9')),'defaultValue':_0x0cf2('0x8'),'comment':_0x0cf2('0xa')},'icon':{'type':Sequelize[_0x0cf2('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x0cf2('0x1')]},'scriptName':{'type':Sequelize[_0x0cf2('0x1')]},'scriptPath':{'type':Sequelize[_0x0cf2('0x1')]}}; \ No newline at end of file +var _0xcff8=['html','script','TEXT','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0x44ee77,_0x1bcfb3){var _0x4ccfa2=function(_0x135aba){while(--_0x135aba){_0x44ee77['push'](_0x44ee77['shift']());}};_0x4ccfa2(++_0x1bcfb3);}(_0xcff8,0x182));var _0x8cff=function(_0x396dd0,_0x72023c){_0x396dd0=_0x396dd0-0x0;var _0x288f63=_0xcff8[_0x396dd0];return _0x288f63;};'use strict';var Sequelize=require(_0x8cff('0x0'));module[_0x8cff('0x1')]={'name':{'type':Sequelize[_0x8cff('0x2')]},'type':{'type':Sequelize[_0x8cff('0x3')](_0x8cff('0x4'),_0x8cff('0x5'))},'description':{'type':Sequelize[_0x8cff('0x6')]},'version':{'type':Sequelize[_0x8cff('0x6')]},'path':{'type':Sequelize[_0x8cff('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8cff('0x7')},'sidebar':{'type':Sequelize[_0x8cff('0x3')](_0x8cff('0x8'),_0x8cff('0x9'),_0x8cff('0xa'),_0x8cff('0xb')),'defaultValue':_0x8cff('0xa'),'comment':_0x8cff('0xc')},'icon':{'type':Sequelize[_0x8cff('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x8cff('0x2')]},'scriptName':{'type':Sequelize[_0x8cff('0x2')]},'scriptPath':{'type':Sequelize[_0x8cff('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 86a5aba..8e40537 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 _0xf984=['Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','find','catch','download','params','join','format','%s.zip','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','extname','root','Plugin\x20upload\x20filepath:\x20%s'];(function(_0x3675d5,_0x36fca3){var _0x15c2b8=function(_0x5937d1){while(--_0x5937d1){_0x3675d5['push'](_0x3675d5['shift']());}};_0x15c2b8(++_0x36fca3);}(_0xf984,0x18b));var _0x4f98=function(_0x45e8e4,_0x56c8c1){_0x45e8e4=_0x45e8e4-0x0;var _0x4fcfb8=_0xf984[_0x45e8e4];return _0x4fcfb8;};'use strict';var emlformat=require(_0x4f98('0x0'));var rimraf=require(_0x4f98('0x1'));var zipdir=require(_0x4f98('0x2'));var jsonpatch=require(_0x4f98('0x3'));var rp=require('request-promise');var moment=require(_0x4f98('0x4'));var BPromise=require(_0x4f98('0x5'));var Mustache=require(_0x4f98('0x6'));var util=require('util');var path=require(_0x4f98('0x7'));var sox=require(_0x4f98('0x8'));var csv=require(_0x4f98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f98('0xa'));var _=require('lodash');var squel=require(_0x4f98('0xb'));var crypto=require(_0x4f98('0xc'));var jsforce=require(_0x4f98('0xd'));var deskjs=require(_0x4f98('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4f98('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x4f98('0x10'));var Redis=require(_0x4f98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4f98('0x12'));var as=require(_0x4f98('0x13'));var hardwareService=require(_0x4f98('0x14'));var logger=require(_0x4f98('0x15'))(_0x4f98('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f98('0x17'))['db'];config['redis']=_[_0x4f98('0x18')](config['redis'],{'host':_0x4f98('0x19'),'port':0x18eb});var socket=require(_0x4f98('0x1a'))(new Redis(config[_0x4f98('0x1b')]));require(_0x4f98('0x1c'))['register'](socket);function respondWithStatusCode(_0x2f21b8,_0x2e2af3){_0x2e2af3=_0x2e2af3||0xcc;return function(_0x42ad58){if(_0x42ad58){return _0x2f21b8[_0x4f98('0x1d')](_0x2e2af3);}return _0x2f21b8['status'](_0x2e2af3)['end']();};}function respondWithResult(_0x22ff18,_0x326e31){_0x326e31=_0x326e31||0xc8;return function(_0x118177){if(_0x118177){return _0x22ff18[_0x4f98('0x1e')](_0x326e31)[_0x4f98('0x1f')](_0x118177);}};}function respondWithFilteredResult(_0xbd34a8,_0x2ea22b){return function(_0x5ee0b3){if(_0x5ee0b3){var _0x16cc21=typeof _0x2ea22b[_0x4f98('0x20')]===_0x4f98('0x21')&&typeof _0x2ea22b['limit']===_0x4f98('0x21');var _0xe51a18=_0x5ee0b3[_0x4f98('0x22')];var _0x38e65c=_0x16cc21?0x0:_0x2ea22b['offset'];var _0x231b22=_0x16cc21?_0x5ee0b3[_0x4f98('0x22')]:_0x2ea22b['offset']+_0x2ea22b[_0x4f98('0x23')];var _0x5d02eb;if(_0x231b22>=_0xe51a18){_0x231b22=_0xe51a18;_0x5d02eb=0xc8;}else{_0x5d02eb=0xce;}_0xbd34a8[_0x4f98('0x1e')](_0x5d02eb);return _0xbd34a8[_0x4f98('0x24')](_0x4f98('0x25'),_0x38e65c+'-'+_0x231b22+'/'+_0xe51a18)[_0x4f98('0x1f')](_0x5ee0b3);}return null;};}function patchUpdates(_0xeebbfa){return function(_0x4448ea){try{jsonpatch[_0x4f98('0x26')](_0x4448ea,_0xeebbfa,!![]);}catch(_0x4694bd){return BPromise[_0x4f98('0x27')](_0x4694bd);}return _0x4448ea['save']();};}function saveUpdates(_0x53b328,_0x2d1556){return function(_0x77a209){if(_0x77a209){return _0x77a209[_0x4f98('0x28')](_0x53b328)['then'](function(_0x488915){return _0x488915;});}return null;};}function removeEntity(_0x58b09e,_0x23abc7){return function(_0x18b1ec){if(_0x18b1ec){return _0x18b1ec[_0x4f98('0x29')]()[_0x4f98('0x2a')](function(){var _0x5bbd70=_0x18b1ec[_0x4f98('0x2b')]({'plain':!![]});var _0xda3ec4=_0x4f98('0x2c');return db[_0x4f98('0x2d')][_0x4f98('0x29')]({'where':{'type':_0xda3ec4,'resourceId':_0x5bbd70['id']}})[_0x4f98('0x2a')](function(){return _0x18b1ec;});})[_0x4f98('0x2a')](function(){_0x58b09e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bdc7b,_0x4f08f0){return function(_0x41d433){if(!_0x41d433){_0x3bdc7b['sendStatus'](0x194);}return _0x41d433;};}function handleError(_0x4bc831,_0x5a6916){_0x5a6916=_0x5a6916||0x1f4;return function(_0x5ba062){logger[_0x4f98('0x2e')](_0x5ba062[_0x4f98('0x2f')]);if(_0x5ba062[_0x4f98('0x30')]){delete _0x5ba062['name'];}_0x4bc831[_0x4f98('0x1e')](_0x5a6916)[_0x4f98('0x31')](_0x5ba062);};}exports[_0x4f98('0x32')]=function(_0x5050f9,_0x97ff62){var _0xa0e075={},_0x14f79e={},_0x3d3c11={'count':0x0,'rows':[]};var _0x56905b=_[_0x4f98('0x33')](db[_0x4f98('0x34')][_0x4f98('0x35')],function(_0x3838ef){return{'name':_0x3838ef[_0x4f98('0x36')],'type':_0x3838ef[_0x4f98('0x37')][_0x4f98('0x38')]};});_0x14f79e[_0x4f98('0x39')]=_[_0x4f98('0x33')](_0x56905b,_0x4f98('0x30'));_0x14f79e[_0x4f98('0x3a')]=_[_0x4f98('0x3b')](_0x5050f9['query']);_0x14f79e[_0x4f98('0x3c')]=_[_0x4f98('0x3d')](_0x14f79e[_0x4f98('0x39')],_0x14f79e[_0x4f98('0x3a')]);_0xa0e075[_0x4f98('0x3e')]=_[_0x4f98('0x3d')](_0x14f79e[_0x4f98('0x39')],qs[_0x4f98('0x3f')](_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x3f')]));_0xa0e075[_0x4f98('0x3e')]=_0xa0e075[_0x4f98('0x3e')][_0x4f98('0x40')]?_0xa0e075[_0x4f98('0x3e')]:_0x14f79e[_0x4f98('0x39')];if(!_0x5050f9[_0x4f98('0x3a')]['hasOwnProperty'](_0x4f98('0x41'))){_0xa0e075[_0x4f98('0x23')]=qs[_0x4f98('0x23')](_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x23')]);_0xa0e075[_0x4f98('0x20')]=qs['offset'](_0x5050f9[_0x4f98('0x3a')]['offset']);}_0xa0e075[_0x4f98('0x42')]=qs[_0x4f98('0x43')](_0x5050f9['query']['sort']);_0xa0e075[_0x4f98('0x44')]=qs[_0x4f98('0x3c')](_[_0x4f98('0x45')](_0x5050f9[_0x4f98('0x3a')],_0x14f79e[_0x4f98('0x3c')]),_0x56905b);if(_0x5050f9[_0x4f98('0x3a')][_0x4f98('0x46')]){_0xa0e075[_0x4f98('0x44')]=_[_0x4f98('0x47')](_0xa0e075[_0x4f98('0x44')],{'$or':_[_0x4f98('0x33')](_0x56905b,function(_0xe9ce52){if(_0xe9ce52['type']!==_0x4f98('0x48')){var _0x398a64={};_0x398a64[_0xe9ce52['name']]={'$like':'%'+_0x5050f9['query'][_0x4f98('0x46')]+'%'};return _0x398a64;}})});}_0xa0e075=_[_0x4f98('0x47')]({},_0xa0e075,_0x5050f9[_0x4f98('0x49')]);var _0xe19c16={'where':_0xa0e075['where']};return db[_0x4f98('0x34')][_0x4f98('0x22')](_0xe19c16)['then'](function(_0x3170ba){_0x3d3c11[_0x4f98('0x22')]=_0x3170ba;if(_0x5050f9[_0x4f98('0x3a')]['includeAll']){_0xa0e075[_0x4f98('0x4a')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0xa0e075);})[_0x4f98('0x2a')](function(_0x3f0337){_0x3d3c11[_0x4f98('0x4b')]=_0x3f0337;return _0x3d3c11;})[_0x4f98('0x2a')](respondWithFilteredResult(_0x97ff62,_0xa0e075))['catch'](handleError(_0x97ff62,null));};exports[_0x4f98('0x4c')]=function(_0x17b36e,_0x252754){var _0x133043={'raw':!![],'where':{'id':_0x17b36e['params']['id']}},_0x535079={};_0x535079[_0x4f98('0x39')]=_[_0x4f98('0x3b')](db[_0x4f98('0x34')][_0x4f98('0x35')]);_0x535079[_0x4f98('0x3a')]=_[_0x4f98('0x3b')](_0x17b36e[_0x4f98('0x3a')]);_0x535079[_0x4f98('0x3c')]=_[_0x4f98('0x3d')](_0x535079['model'],_0x535079['query']);_0x133043['attributes']=_[_0x4f98('0x3d')](_0x535079['model'],qs[_0x4f98('0x3f')](_0x17b36e[_0x4f98('0x3a')][_0x4f98('0x3f')]));_0x133043[_0x4f98('0x3e')]=_0x133043[_0x4f98('0x3e')][_0x4f98('0x40')]?_0x133043[_0x4f98('0x3e')]:_0x535079[_0x4f98('0x39')];if(_0x17b36e[_0x4f98('0x3a')]['includeAll']){_0x133043['include']=[{'all':!![]}];}_0x133043=_[_0x4f98('0x47')]({},_0x133043,_0x17b36e['options']);return db['Plugin'][_0x4f98('0x4d')](_0x133043)[_0x4f98('0x2a')](handleEntityNotFound(_0x252754,null))['then'](respondWithResult(_0x252754,null))[_0x4f98('0x4e')](handleError(_0x252754,null));};exports[_0x4f98('0x4f')]=function(_0x578925,_0x38411f,_0x196fa2){return db[_0x4f98('0x34')][_0x4f98('0x4d')]({'where':{'id':_0x578925[_0x4f98('0x50')]['id']},'attributes':[_0x4f98('0x30'),_0x4f98('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x38411f,null))['then'](function(_0x40e46e){if(_0x40e46e){var _0x4859d7=path[_0x4f98('0x51')](config['root'],'server/files/plugins',util[_0x4f98('0x52')](_0x4f98('0x53'),path['basename'](_0x40e46e[_0x4f98('0x7')])));var _0x60449d=fs[_0x4f98('0x54')](_0x4859d7);var _0x5464a3=archiver('zip',{'zlib':{'level':0x9}});_0x5464a3['on'](_0x4f98('0x55'),function(_0x58bc0d){if(_0x58bc0d[_0x4f98('0x56')]===_0x4f98('0x57')){logger[_0x4f98('0x2e')](_0x58bc0d);}else{throw new db[(_0x4f98('0x58'))][(_0x4f98('0x59'))](_0x4f98('0x5a'));}});_0x5464a3['on']('error',function(_0x159ed6){throw new db[(_0x4f98('0x58'))]['Error'](_0x4f98('0x5a'));});_0x5464a3[_0x4f98('0x5b')](_0x60449d);_0x5464a3['glob']('**/*',{'cwd':path[_0x4f98('0x51')](config['root'],_0x4f98('0x5c'),path[_0x4f98('0x5d')](_0x40e46e[_0x4f98('0x7')])),'ignore':[path[_0x4f98('0x51')](path[_0x4f98('0x5e')](_0x40e46e[_0x4f98('0x7')]),_0x4f98('0x5f')),path[_0x4f98('0x51')](path[_0x4f98('0x5e')](_0x40e46e[_0x4f98('0x7')]),_0x4f98('0x60'))],'nodir':!![]})[_0x4f98('0x61')]();_0x60449d['on'](_0x4f98('0x62'),function(){if(!fs['existsSync'](_0x4859d7)){throw new db[(_0x4f98('0x58'))]['Error']('Plugin\x20not\x20found');}return _0x38411f['download'](_0x4859d7,util[_0x4f98('0x52')](_0x4f98('0x53'),path['basename'](_0x40e46e['path'])),function(_0xbf3673){if(_0xbf3673){throw new db[(_0x4f98('0x58'))]['Error'](_0x4f98('0x63'));}fs[_0x4f98('0x64')](_0x4859d7);logger[_0x4f98('0x65')](_0x4f98('0x66'));logger[_0x4f98('0x65')]('Temporary\x20file\x20removed');});});}return null;})[_0x4f98('0x4e')](handleError(_0x38411f,null));};exports[_0x4f98('0x67')]=function(_0x1973d9,_0x37d8c9,_0x19b611){var _0x367400=path[_0x4f98('0x5e')](_0x1973d9[_0x4f98('0x68')][_0x4f98('0x69')],path[_0x4f98('0x6a')](_0x1973d9[_0x4f98('0x68')]['filename']));var _0x226b6c=path[_0x4f98('0x51')](config[_0x4f98('0x6b')],'server/files/plugins',_0x1973d9[_0x4f98('0x68')]['filename']);var _0x96a37d=path['join'](config[_0x4f98('0x6b')],_0x4f98('0x5c'),_0x367400);logger[_0x4f98('0x65')](_0x4f98('0x6c'),_0x226b6c);logger[_0x4f98('0x65')](_0x4f98('0x6d'),_0x96a37d);try{fs['chmodSync'](_0x226b6c,parseInt(_0x4f98('0x6e'),0x8));extract(_0x226b6c,{'dir':_0x96a37d},function(_0x67a8a1){if(_0x67a8a1){logger['error'](_0x67a8a1);handleError(_0x67a8a1,!![]);};var _0x6fd5f1=fs[_0x4f98('0x6f')](_0x96a37d);if(_0x6fd5f1[_0x4f98('0x40')]>0x1){removeReferences(_0x226b6c,_0x96a37d);logger[_0x4f98('0x2e')](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}var _0x43bfcb=fs[_0x4f98('0x71')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0]));if(_0x43bfcb['isFile']()){removeReferences(_0x226b6c,_0x96a37d);logger['error'](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}if(_0x43bfcb['isDirectory']()){var _0x48c085=fs[_0x4f98('0x6f')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0]));if(_0x48c085[_0x4f98('0x40')]===0x0){removeReferences(_0x226b6c,_0x96a37d);logger[_0x4f98('0x2e')](_0x4f98('0x70'));return _0x19b611(new Error(_0x4f98('0x70')));}var _0x3ae95d=_0x48c085[_0x4f98('0x72')](function(_0x416e1d){return _0x416e1d===_0x4f98('0x73');});if(!_0x3ae95d){return _0x19b611(new Error(_0x4f98('0x74')));}var _0x3d0b53=fs[_0x4f98('0x75')](path[_0x4f98('0x51')](_0x96a37d,_0x6fd5f1[0x0],_0x4f98('0x73')));var _0x5cccca=JSON['parse'](_0x3d0b53);if(_0x4f98('0x21')==typeof _0x5cccca['name']){return _0x19b611(new Error(_0x4f98('0x76')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x37')]){return _0x19b611(new Error(_0x4f98('0x77')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x78')]){return _0x19b611(new Error(_0x4f98('0x79')));}if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')]){return _0x19b611(new Error(_0x4f98('0x7b')));}if(_0x5cccca[_0x4f98('0x37')]===_0x4f98('0x7c')){if(_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]){return _0x19b611(new Error(_0x4f98('0x7e')));}if(_0x4f98('0x21')==typeof _0x5cccca['parameters'][_0x4f98('0x7d')][_0x4f98('0x7f')]&&_0x4f98('0x21')==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')]){return _0x19b611(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5cccca[_0x4f98('0x37')]===_0x4f98('0x81')){if('undefined'==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x82')]){return _0x19b611(new Error(_0x4f98('0x83')));}if('undefined'==typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x84')]){return _0x19b611(new Error(_0x4f98('0x85')));}}else{return _0x19b611(new Error(_0x4f98('0x86')));}var _0x24bd81=_0x5cccca['name'];var _0x1ec12f=_0x5cccca['description'];var _0xbe7330=_0x5cccca[_0x4f98('0x37')];var _0x1f55cd=_0x5cccca['sidebar']?_0x5cccca[_0x4f98('0x87')]:_0x4f98('0x88');var _0x3d96e1=_0x5cccca[_0x4f98('0x89')]?_0x5cccca[_0x4f98('0x89')]:_0x4f98('0x8a');var _0x42b5c8='';var _0x20eab2='';var _0x47649b='';var _0x305eed='';var _0x2bdd4b=_0x5cccca['version'];if(_0xbe7330===_0x4f98('0x7c')){if('undefined'!=typeof _0x5cccca['parameters']['views'][_0x4f98('0x7f')]){var _0x33cca4=_0x5cccca['parameters']['views'][_0x4f98('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x33cca4)){_0x42b5c8=path[_0x4f98('0x51')]('plugins',_0x367400,_0x6fd5f1[0x0],_0x33cca4);}else{_0x42b5c8=_0x33cca4;}}else{logger[_0x4f98('0x65')](_0x4f98('0x8c'));}if('undefined'!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]['agent']){var _0x12a8d9=_0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x12a8d9)){_0x20eab2=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x12a8d9);}else{_0x20eab2=_0x12a8d9;}}else{logger[_0x4f98('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0xbe7330===_0x4f98('0x81')){_0x47649b=_0x5cccca[_0x4f98('0x7a')][_0x4f98('0x82')];_0x305eed=_0x5cccca['parameters']['scriptPath'];if(_0x4f98('0x21')!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')]){if('undefined'!=typeof _0x5cccca[_0x4f98('0x7a')]['views'][_0x4f98('0x7f')]){var _0x33cca4=_0x5cccca[_0x4f98('0x7a')]['views'][_0x4f98('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x33cca4)){_0x42b5c8=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x33cca4);}else{_0x42b5c8=_0x33cca4;}}if(_0x4f98('0x21')!=typeof _0x5cccca[_0x4f98('0x7a')][_0x4f98('0x7d')][_0x4f98('0x80')]){var _0x12a8d9=_0x5cccca['parameters'][_0x4f98('0x7d')][_0x4f98('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x4f98('0x8b')](_0x12a8d9)){_0x20eab2=path[_0x4f98('0x51')](_0x4f98('0x8d'),_0x367400,_0x6fd5f1[0x0],_0x12a8d9);}else{_0x20eab2=_0x12a8d9;}}}}var _0x14d3e3={'name':_0x24bd81,'description':_0x1ec12f,'path':path[_0x4f98('0x51')](_0x367400,_0x6fd5f1[0x0]),'type':_0xbe7330,'sidebar':_0x1f55cd,'icon':_0x3d96e1,'adminUrl':_0x42b5c8,'agentUrl':_0x20eab2,'scriptName':_0x47649b,'scriptPath':_0x305eed,'version':_0x2bdd4b};removeReferences(_0x226b6c,null);return db[_0x4f98('0x34')][_0x4f98('0x8e')](_0x14d3e3)[_0x4f98('0x2a')](function(_0x24be47){var _0x51984c={'role':_0x1973d9['body'][_0x4f98('0x8f')],'userProfileId':_0x1973d9[_0x4f98('0x90')][_0x4f98('0x91')]};if(!_0x51984c)throw new Error(_0x4f98('0x92'));if(_0x51984c[_0x4f98('0x8f')]===_0x4f98('0x93')){var _0x32c13f=_0x24be47[_0x4f98('0x2b')]({'plain':!![]});return db[_0x4f98('0x94')]['find']({'where':{'name':_0x4f98('0x2c'),'userProfileId':_0x51984c[_0x4f98('0x91')]},'raw':!![]})[_0x4f98('0x2a')](function(_0x21a54a){if(_0x21a54a&&_0x21a54a[_0x4f98('0x95')]===0x0){return db[_0x4f98('0x2d')]['create']({'name':_0x32c13f[_0x4f98('0x30')],'resourceId':_0x32c13f['id'],'type':_0x21a54a[_0x4f98('0x30')],'sectionId':_0x21a54a['id']},{})[_0x4f98('0x2a')](function(){return _0x24be47;});}else{return _0x24be47;}})['catch'](function(_0x37abfd){logger[_0x4f98('0x2e')](_0x4f98('0x96'),_0x37abfd);throw _0x37abfd;});}return _0x24be47;})[_0x4f98('0x2a')](respondWithResult(_0x37d8c9,null))[_0x4f98('0x4e')](handleError(_0x37d8c9,null));}});}catch(_0x2e3a6b){_0x37d8c9[_0x4f98('0x1e')](0x1f4)['send'](_0x2e3a6b);}};function removeReferences(_0x15d6b9,_0x1b6047){try{if(_0x15d6b9){fs[_0x4f98('0x64')](_0x15d6b9);logger[_0x4f98('0x65')](_0x4f98('0x97'));}if(_0x1b6047){rimraf(_0x1b6047,function(){});logger[_0x4f98('0x65')](_0x4f98('0x98'));}}catch(_0xd9e341){logger[_0x4f98('0x2e')](_0xd9e341);}}exports['update']=function(_0x527b32,_0x458ef2,_0x52bb45){return db[_0x4f98('0x34')][_0x4f98('0x4d')]({'where':{'id':_0x527b32['params']['id']}})['then'](handleEntityNotFound(_0x458ef2,null))[_0x4f98('0x2a')](saveUpdates(_0x527b32[_0x4f98('0x90')],null))[_0x4f98('0x2a')](respondWithResult(_0x458ef2,null))[_0x4f98('0x4e')](handleError(_0x458ef2,null));};exports[_0x4f98('0x99')]=function(_0x4912fa,_0x11062f,_0x4d9f06){return db[_0x4f98('0x34')]['find']({'where':{'id':_0x4912fa[_0x4f98('0x50')]['id']}})[_0x4f98('0x2a')](function(_0x501012){if(_0x501012){return _0x501012[_0x4f98('0x29')]();}})['then'](function(_0x5bea2f){rimraf(path['join'](config[_0x4f98('0x6b')],'server/files/plugins',path[_0x4f98('0x5d')](_0x5bea2f[_0x4f98('0x7')])),function(){});return _0x5bea2f;})[_0x4f98('0x2a')](handleEntityNotFound(_0x11062f,null))[_0x4f98('0x2a')](respondWithStatusCode(_0x11062f,null))[_0x4f98('0x4e')](handleError(_0x11062f,null));};exports[_0x4f98('0x9a')]=function(_0x1b8e31,_0x245838,_0xbca0a1){return BPromise[_0x4f98('0x9b')]()['then'](function(){if(!_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')]){throw new Error(_0x4f98('0x9c'));}if(!_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x53ba1c=_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9e')]?_0x1b8e31[_0x4f98('0x3a')]['hostname']+':'+_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')]:'http://localhost:'+_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9d')];var _0x5032fd=_0x1b8e31[_0x4f98('0x3a')]['json']?_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x1f')]:!![];var _0x58d773=_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x9f')]?_0x1b8e31[_0x4f98('0x3a')]['encoding']:null;var _0x32b399={'method':_0x1b8e31[_0x4f98('0xa0')],'uri':util['format'](_0x4f98('0xa1'),_0x53ba1c,_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')]),'json':_0x5032fd,'resolveWithFullResponse':!![],'encoding':_0x58d773,'qs':_0x1b8e31[_0x4f98('0x3a')]};if(_0x1b8e31['headers']){_0x32b399[_0x4f98('0xa2')]=_0x1b8e31[_0x4f98('0xa2')];if(_0x32b399[_0x4f98('0xa2')][_0x4f98('0xa3')]){delete _0x32b399[_0x4f98('0xa2')][_0x4f98('0xa3')];}}if(_0x32b399[_0x4f98('0xa2')]['content-type']){delete _0x32b399[_0x4f98('0xa2')][_0x4f98('0xa4')];}return rp(_0x32b399);})['then'](function(_0x24dcd9){if(_0x24dcd9){_0x245838['set'](_0x24dcd9[_0x4f98('0xa2')]);logger[_0x4f98('0x65')](_0x24dcd9[_0x4f98('0x90')]);if(_[_0x4f98('0xa5')](_0x1b8e31[_0x4f98('0x3a')][_0x4f98('0x7')],_0x4f98('0x4f'))&&_0x24dcd9[_0x4f98('0xa6')]==0x1f4){return _0x245838[_0x4f98('0x1d')](_0x24dcd9[_0x4f98('0xa6')]);}else{return _0x245838[_0x4f98('0x1e')](_0x24dcd9[_0x4f98('0xa6')])['send'](_0x24dcd9[_0x4f98('0x90')]);}}else{return _0x245838[_0x4f98('0x1d')](0xc8);}})[_0x4f98('0x4e')](handleError(_0x245838,null));};exports[_0x4f98('0xa7')]=function(_0x525548,_0x173b2b,_0x166b93){return BPromise[_0x4f98('0x9b')]()['then'](function(){if(!_0x525548['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x525548[_0x4f98('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x54da9c=_0x525548[_0x4f98('0x3a')][_0x4f98('0x9e')]?_0x525548[_0x4f98('0x3a')][_0x4f98('0x9e')]+':'+_0x525548['query'][_0x4f98('0x9d')]:'http://localhost:'+_0x525548[_0x4f98('0x3a')][_0x4f98('0x9d')];var _0x3b3bd7=_0x525548[_0x4f98('0x3a')][_0x4f98('0x1f')]?_0x525548['query']['json']:!![];var _0x1d427d=_0x525548[_0x4f98('0x3a')][_0x4f98('0x9f')]?_0x525548[_0x4f98('0x3a')][_0x4f98('0x9f')]:null;var _0x56400f={'method':_0x525548[_0x4f98('0xa0')],'uri':util[_0x4f98('0x52')](_0x4f98('0xa1'),_0x54da9c,_0x525548['query'][_0x4f98('0x7')]),'json':_0x3b3bd7,'resolveWithFullResponse':!![],'encoding':_0x1d427d,'body':_0x525548[_0x4f98('0x90')]};if(_0x525548[_0x4f98('0xa2')]){_0x56400f[_0x4f98('0xa2')]=_0x525548[_0x4f98('0xa2')];if(_0x56400f[_0x4f98('0xa2')][_0x4f98('0xa3')]){delete _0x56400f['headers'][_0x4f98('0xa3')];}}if(_0x56400f[_0x4f98('0xa2')]['content-type']){delete _0x56400f[_0x4f98('0xa2')][_0x4f98('0xa4')];}return rp(_0x56400f);})['then'](function(_0x210f47){if(_0x210f47){_0x173b2b[_0x4f98('0x24')](_0x210f47['headers']);logger[_0x4f98('0x65')](_0x210f47[_0x4f98('0x90')]);return _0x173b2b['status'](_0x210f47['statusCode'])[_0x4f98('0x31')](_0x210f47[_0x4f98('0x90')]);}else{return _0x173b2b[_0x4f98('0x1d')](0xc8);}})[_0x4f98('0x4e')](handleError(_0x173b2b,null));}; \ No newline at end of file +var _0x0c08=['get','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','body','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy'];(function(_0xb35529,_0xbd48c5){var _0x1d8c70=function(_0x64a4e){while(--_0x64a4e){_0xb35529['push'](_0xb35529['shift']());}};_0x1d8c70(++_0xbd48c5);}(_0x0c08,0x12d));var _0x80c0=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x0c08[_0x43e97d];return _0x424cd9;};'use strict';var emlformat=require(_0x80c0('0x0'));var rimraf=require(_0x80c0('0x1'));var zipdir=require(_0x80c0('0x2'));var jsonpatch=require(_0x80c0('0x3'));var rp=require('request-promise');var moment=require(_0x80c0('0x4'));var BPromise=require(_0x80c0('0x5'));var Mustache=require(_0x80c0('0x6'));var util=require('util');var path=require(_0x80c0('0x7'));var sox=require('sox');var csv=require(_0x80c0('0x8'));var ejs=require(_0x80c0('0x9'));var fs=require('fs');var fs_extra=require(_0x80c0('0xa'));var _=require(_0x80c0('0xb'));var squel=require(_0x80c0('0xc'));var crypto=require(_0x80c0('0xd'));var jsforce=require(_0x80c0('0xe'));var deskjs=require(_0x80c0('0xf'));var toCsv=require(_0x80c0('0x8'));var querystring=require(_0x80c0('0x10'));var Papa=require('papaparse');var extract=require(_0x80c0('0x11'));var rimraf=require(_0x80c0('0x1'));var archiver=require(_0x80c0('0x12'));var Redis=require(_0x80c0('0x13'));var authService=require(_0x80c0('0x14'));var qs=require(_0x80c0('0x15'));var as=require(_0x80c0('0x16'));var hardwareService=require(_0x80c0('0x17'));var logger=require(_0x80c0('0x18'))(_0x80c0('0x19'));var utils=require(_0x80c0('0x1a'));var config=require(_0x80c0('0x1b'));var licenseUtil=require(_0x80c0('0x1c'));var db=require(_0x80c0('0x1d'))['db'];config['redis']=_[_0x80c0('0x1e')](config[_0x80c0('0x1f')],{'host':_0x80c0('0x20'),'port':0x18eb});var socket=require(_0x80c0('0x21'))(new Redis(config[_0x80c0('0x1f')]));require(_0x80c0('0x22'))['register'](socket);function respondWithStatusCode(_0x5cafbb,_0x5997e8){_0x5997e8=_0x5997e8||0xcc;return function(_0x4d6125){if(_0x4d6125){return _0x5cafbb[_0x80c0('0x23')](_0x5997e8);}return _0x5cafbb['status'](_0x5997e8)[_0x80c0('0x24')]();};}function respondWithResult(_0x3c9ebc,_0xf90286){_0xf90286=_0xf90286||0xc8;return function(_0x1559ed){if(_0x1559ed){return _0x3c9ebc['status'](_0xf90286)[_0x80c0('0x25')](_0x1559ed);}};}function respondWithFilteredResult(_0x44b203,_0x212cb2){return function(_0x1658e4){if(_0x1658e4){var _0x4c528c=typeof _0x212cb2[_0x80c0('0x26')]===_0x80c0('0x27')&&typeof _0x212cb2['limit']===_0x80c0('0x27');var _0x3ba161=_0x1658e4[_0x80c0('0x28')];var _0x32e7b1=_0x4c528c?0x0:_0x212cb2[_0x80c0('0x26')];var _0x30e201=_0x4c528c?_0x1658e4[_0x80c0('0x28')]:_0x212cb2[_0x80c0('0x26')]+_0x212cb2['limit'];var _0x6d8435;if(_0x30e201>=_0x3ba161){_0x30e201=_0x3ba161;_0x6d8435=0xc8;}else{_0x6d8435=0xce;}_0x44b203[_0x80c0('0x29')](_0x6d8435);return _0x44b203[_0x80c0('0x2a')](_0x80c0('0x2b'),_0x32e7b1+'-'+_0x30e201+'/'+_0x3ba161)[_0x80c0('0x25')](_0x1658e4);}return null;};}function patchUpdates(_0x38dee1){return function(_0x1d6dde){try{jsonpatch[_0x80c0('0x2c')](_0x1d6dde,_0x38dee1,!![]);}catch(_0x4c1319){return BPromise[_0x80c0('0x2d')](_0x4c1319);}return _0x1d6dde['save']();};}function saveUpdates(_0x4751ab,_0x13da6f){return function(_0x48a9a5){if(_0x48a9a5){return _0x48a9a5[_0x80c0('0x2e')](_0x4751ab)[_0x80c0('0x2f')](function(_0x1a4d9a){return _0x1a4d9a;});}return null;};}function removeEntity(_0x28a24d,_0x29b389){return function(_0x36713a){if(_0x36713a){return _0x36713a[_0x80c0('0x30')]()[_0x80c0('0x2f')](function(){var _0x28289a=_0x36713a[_0x80c0('0x31')]({'plain':!![]});var _0x2fbad2=_0x80c0('0x32');return db[_0x80c0('0x33')]['destroy']({'where':{'type':_0x2fbad2,'resourceId':_0x28289a['id']}})[_0x80c0('0x2f')](function(){return _0x36713a;});})[_0x80c0('0x2f')](function(){_0x28a24d[_0x80c0('0x29')](0xcc)[_0x80c0('0x24')]();});}};}function handleEntityNotFound(_0x3a3b78,_0x4695cb){return function(_0x3e7d3f){if(!_0x3e7d3f){_0x3a3b78[_0x80c0('0x23')](0x194);}return _0x3e7d3f;};}function handleError(_0x10c979,_0x16e6d9){_0x16e6d9=_0x16e6d9||0x1f4;return function(_0x44b333){logger[_0x80c0('0x34')](_0x44b333[_0x80c0('0x35')]);if(_0x44b333[_0x80c0('0x36')]){delete _0x44b333[_0x80c0('0x36')];}_0x10c979[_0x80c0('0x29')](_0x16e6d9)['send'](_0x44b333);};}exports[_0x80c0('0x37')]=function(_0x39cb45,_0x538f0e){var _0x4b0c62={},_0x45ec76={},_0x118ef5={'count':0x0,'rows':[]};var _0x35b983=_[_0x80c0('0x38')](db[_0x80c0('0x39')][_0x80c0('0x3a')],function(_0x49444f){return{'name':_0x49444f['fieldName'],'type':_0x49444f[_0x80c0('0x3b')]['key']};});_0x45ec76[_0x80c0('0x3c')]=_[_0x80c0('0x38')](_0x35b983,'name');_0x45ec76[_0x80c0('0x3d')]=_[_0x80c0('0x3e')](_0x39cb45[_0x80c0('0x3d')]);_0x45ec76[_0x80c0('0x3f')]=_['intersection'](_0x45ec76['model'],_0x45ec76['query']);_0x4b0c62['attributes']=_[_0x80c0('0x40')](_0x45ec76[_0x80c0('0x3c')],qs[_0x80c0('0x41')](_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x41')]));_0x4b0c62[_0x80c0('0x42')]=_0x4b0c62[_0x80c0('0x42')][_0x80c0('0x43')]?_0x4b0c62[_0x80c0('0x42')]:_0x45ec76[_0x80c0('0x3c')];if(!_0x39cb45[_0x80c0('0x3d')]['hasOwnProperty'](_0x80c0('0x44'))){_0x4b0c62[_0x80c0('0x45')]=qs['limit'](_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x45')]);_0x4b0c62['offset']=qs[_0x80c0('0x26')](_0x39cb45['query'][_0x80c0('0x26')]);}_0x4b0c62[_0x80c0('0x46')]=qs[_0x80c0('0x47')](_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x47')]);_0x4b0c62['where']=qs[_0x80c0('0x3f')](_['pick'](_0x39cb45[_0x80c0('0x3d')],_0x45ec76[_0x80c0('0x3f')]),_0x35b983);if(_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x48')]){_0x4b0c62[_0x80c0('0x49')]=_['merge'](_0x4b0c62['where'],{'$or':_['map'](_0x35b983,function(_0x5b1955){if(_0x5b1955[_0x80c0('0x3b')]!==_0x80c0('0x4a')){var _0x21b460={};_0x21b460[_0x5b1955[_0x80c0('0x36')]]={'$like':'%'+_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x48')]+'%'};return _0x21b460;}})});}_0x4b0c62=_[_0x80c0('0x4b')]({},_0x4b0c62,_0x39cb45[_0x80c0('0x4c')]);var _0x29e2f6={'where':_0x4b0c62['where']};return db[_0x80c0('0x39')][_0x80c0('0x28')](_0x29e2f6)[_0x80c0('0x2f')](function(_0x30df91){_0x118ef5[_0x80c0('0x28')]=_0x30df91;if(_0x39cb45[_0x80c0('0x3d')][_0x80c0('0x4d')]){_0x4b0c62[_0x80c0('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x80c0('0x4f')](_0x4b0c62);})[_0x80c0('0x2f')](function(_0x5e8365){_0x118ef5[_0x80c0('0x50')]=_0x5e8365;return _0x118ef5;})[_0x80c0('0x2f')](respondWithFilteredResult(_0x538f0e,_0x4b0c62))[_0x80c0('0x51')](handleError(_0x538f0e,null));};exports['show']=function(_0x2bb408,_0x50dc66){var _0x5ca102={'raw':!![],'where':{'id':_0x2bb408[_0x80c0('0x52')]['id']}},_0x13c165={};_0x13c165[_0x80c0('0x3c')]=_[_0x80c0('0x3e')](db[_0x80c0('0x39')][_0x80c0('0x3a')]);_0x13c165[_0x80c0('0x3d')]=_['keys'](_0x2bb408[_0x80c0('0x3d')]);_0x13c165[_0x80c0('0x3f')]=_['intersection'](_0x13c165[_0x80c0('0x3c')],_0x13c165[_0x80c0('0x3d')]);_0x5ca102[_0x80c0('0x42')]=_['intersection'](_0x13c165[_0x80c0('0x3c')],qs[_0x80c0('0x41')](_0x2bb408[_0x80c0('0x3d')][_0x80c0('0x41')]));_0x5ca102[_0x80c0('0x42')]=_0x5ca102[_0x80c0('0x42')]['length']?_0x5ca102[_0x80c0('0x42')]:_0x13c165[_0x80c0('0x3c')];if(_0x2bb408['query'][_0x80c0('0x4d')]){_0x5ca102['include']=[{'all':!![]}];}_0x5ca102=_[_0x80c0('0x4b')]({},_0x5ca102,_0x2bb408['options']);return db[_0x80c0('0x39')][_0x80c0('0x53')](_0x5ca102)[_0x80c0('0x2f')](handleEntityNotFound(_0x50dc66,null))['then'](respondWithResult(_0x50dc66,null))[_0x80c0('0x51')](handleError(_0x50dc66,null));};exports[_0x80c0('0x54')]=function(_0x5141c1,_0xc80d91,_0x3eb603){return db['Plugin'][_0x80c0('0x53')]({'where':{'id':_0x5141c1[_0x80c0('0x52')]['id']},'attributes':['name',_0x80c0('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0xc80d91,null))[_0x80c0('0x2f')](function(_0x3ac7db){if(_0x3ac7db){var _0x2b5b27=path[_0x80c0('0x55')](config[_0x80c0('0x56')],_0x80c0('0x57'),util[_0x80c0('0x58')](_0x80c0('0x59'),path['basename'](_0x3ac7db[_0x80c0('0x7')])));var _0x54ae96=fs[_0x80c0('0x5a')](_0x2b5b27);var _0x1dfb44=archiver(_0x80c0('0x5b'),{'zlib':{'level':0x9}});_0x1dfb44['on']('warning',function(_0x14c308){if(_0x14c308[_0x80c0('0x5c')]===_0x80c0('0x5d')){logger['error'](_0x14c308);}else{throw new db[(_0x80c0('0x5e'))][(_0x80c0('0x5f'))](_0x80c0('0x60'));}});_0x1dfb44['on'](_0x80c0('0x34'),function(_0x10f66f){throw new db[(_0x80c0('0x5e'))]['Error'](_0x80c0('0x60'));});_0x1dfb44[_0x80c0('0x61')](_0x54ae96);_0x1dfb44[_0x80c0('0x62')](_0x80c0('0x63'),{'cwd':path[_0x80c0('0x55')](config[_0x80c0('0x56')],'server/files/plugins',path[_0x80c0('0x64')](_0x3ac7db[_0x80c0('0x7')])),'ignore':[path['join'](path[_0x80c0('0x65')](_0x3ac7db[_0x80c0('0x7')]),_0x80c0('0x66')),path['join'](path[_0x80c0('0x65')](_0x3ac7db['path']),_0x80c0('0x67'))],'nodir':!![]})[_0x80c0('0x68')]();_0x54ae96['on'](_0x80c0('0x69'),function(){if(!fs[_0x80c0('0x6a')](_0x2b5b27)){throw new db[(_0x80c0('0x5e'))][(_0x80c0('0x5f'))](_0x80c0('0x6b'));}return _0xc80d91['download'](_0x2b5b27,util[_0x80c0('0x58')]('%s.zip',path[_0x80c0('0x65')](_0x3ac7db[_0x80c0('0x7')])),function(_0x9b4ab2){if(_0x9b4ab2){throw new db[(_0x80c0('0x5e'))][(_0x80c0('0x5f'))](_0x80c0('0x6c'));}fs['unlinkSync'](_0x2b5b27);logger[_0x80c0('0x6d')](_0x80c0('0x6e'));logger[_0x80c0('0x6d')](_0x80c0('0x6f'));});});}return null;})['catch'](handleError(_0xc80d91,null));};exports[_0x80c0('0x70')]=function(_0x5c6b0e,_0x3499bd,_0x99ac3a){var _0x368fc0=path[_0x80c0('0x65')](_0x5c6b0e[_0x80c0('0x71')][_0x80c0('0x72')],path[_0x80c0('0x73')](_0x5c6b0e[_0x80c0('0x71')]['filename']));var _0x5a567f=path[_0x80c0('0x55')](config['root'],_0x80c0('0x57'),_0x5c6b0e['file'][_0x80c0('0x72')]);var _0x3394ec=path['join'](config[_0x80c0('0x56')],_0x80c0('0x57'),_0x368fc0);logger[_0x80c0('0x6d')](_0x80c0('0x74'),_0x5a567f);logger['info'](_0x80c0('0x75'),_0x3394ec);try{fs[_0x80c0('0x76')](_0x5a567f,parseInt(_0x80c0('0x77'),0x8));extract(_0x5a567f,{'dir':_0x3394ec},function(_0x247caa){if(_0x247caa){logger[_0x80c0('0x34')](_0x247caa);handleError(_0x247caa,!![]);};var _0x1a0b88=fs[_0x80c0('0x78')](_0x3394ec);if(_0x1a0b88[_0x80c0('0x43')]>0x1){removeReferences(_0x5a567f,_0x3394ec);logger['error']('Invalid\x20plugin\x20structure');return _0x99ac3a(new Error('Invalid\x20plugin\x20structure'));}var _0x8f49c0=fs[_0x80c0('0x79')](path[_0x80c0('0x55')](_0x3394ec,_0x1a0b88[0x0]));if(_0x8f49c0[_0x80c0('0x7a')]()){removeReferences(_0x5a567f,_0x3394ec);logger['error']('Invalid\x20plugin\x20structure');return _0x99ac3a(new Error(_0x80c0('0x7b')));}if(_0x8f49c0['isDirectory']()){var _0x912e55=fs[_0x80c0('0x78')](path[_0x80c0('0x55')](_0x3394ec,_0x1a0b88[0x0]));if(_0x912e55[_0x80c0('0x43')]===0x0){removeReferences(_0x5a567f,_0x3394ec);logger['error'](_0x80c0('0x7b'));return _0x99ac3a(new Error('Invalid\x20plugin\x20structure'));}var _0xe31ec2=_0x912e55[_0x80c0('0x7c')](function(_0x47f549){return _0x47f549==='manifest.json';});if(!_0xe31ec2){return _0x99ac3a(new Error('Plugin\x20manifest\x20missing'));}var _0x5977f2=fs['readFileSync'](path[_0x80c0('0x55')](_0x3394ec,_0x1a0b88[0x0],_0x80c0('0x7d')));var _0x5f107d=JSON[_0x80c0('0x7e')](_0x5977f2);if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x36')]){return _0x99ac3a(new Error(_0x80c0('0x7f')));}if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x3b')]){return _0x99ac3a(new Error(_0x80c0('0x80')));}if('undefined'==typeof _0x5f107d[_0x80c0('0x81')]){return _0x99ac3a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x82')]){return _0x99ac3a(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x5f107d[_0x80c0('0x3b')]===_0x80c0('0x83')){if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')]){return _0x99ac3a(new Error(_0x80c0('0x85')));}if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')][_0x80c0('0x86')]&&_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x82')]['views']['agent']){return _0x99ac3a(new Error(_0x80c0('0x87')));}}else if(_0x5f107d['type']==='script'){if('undefined'==typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x88')]){return _0x99ac3a(new Error(_0x80c0('0x89')));}if(_0x80c0('0x27')==typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x8a')]){return _0x99ac3a(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x99ac3a(new Error(_0x80c0('0x8b')));}var _0x4a1edc=_0x5f107d['name'];var _0x638f50=_0x5f107d[_0x80c0('0x8c')];var _0x5a9925=_0x5f107d[_0x80c0('0x3b')];var _0x4a8078=_0x5f107d[_0x80c0('0x8d')]?_0x5f107d[_0x80c0('0x8d')]:'always';var _0x36eb5e=_0x5f107d['icon']?_0x5f107d[_0x80c0('0x8e')]:_0x80c0('0x8f');var _0x40cb97='';var _0x8229cc='';var _0x3f766b='';var _0x5849ea='';var _0x512f64=_0x5f107d['version'];if(_0x5a9925===_0x80c0('0x83')){if(_0x80c0('0x27')!=typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')]['admin']){var _0x57e248=_0x5f107d[_0x80c0('0x82')]['views'][_0x80c0('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x80c0('0x90')](_0x57e248)){_0x40cb97=path[_0x80c0('0x55')](_0x80c0('0x91'),_0x368fc0,_0x1a0b88[0x0],_0x57e248);}else{_0x40cb97=_0x57e248;}}else{logger[_0x80c0('0x6d')](_0x80c0('0x92'));}if(_0x80c0('0x27')!=typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')][_0x80c0('0x93')]){var _0x4e32dc=_0x5f107d['parameters']['views'][_0x80c0('0x93')];if(!/^(f|ht)tps?:\/\//i['test'](_0x4e32dc)){_0x8229cc=path[_0x80c0('0x55')](_0x80c0('0x91'),_0x368fc0,_0x1a0b88[0x0],_0x4e32dc);}else{_0x8229cc=_0x4e32dc;}}else{logger[_0x80c0('0x6d')](_0x80c0('0x94'));}}else if(_0x5a9925===_0x80c0('0x95')){_0x3f766b=_0x5f107d['parameters'][_0x80c0('0x88')];_0x5849ea=_0x5f107d[_0x80c0('0x82')][_0x80c0('0x8a')];if(_0x80c0('0x27')!=typeof _0x5f107d[_0x80c0('0x82')]['views']){if(_0x80c0('0x27')!=typeof _0x5f107d['parameters'][_0x80c0('0x84')][_0x80c0('0x86')]){var _0x57e248=_0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')][_0x80c0('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x80c0('0x90')](_0x57e248)){_0x40cb97=path[_0x80c0('0x55')](_0x80c0('0x91'),_0x368fc0,_0x1a0b88[0x0],_0x57e248);}else{_0x40cb97=_0x57e248;}}if(_0x80c0('0x27')!=typeof _0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')][_0x80c0('0x93')]){var _0x4e32dc=_0x5f107d[_0x80c0('0x82')][_0x80c0('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x80c0('0x90')](_0x4e32dc)){_0x8229cc=path[_0x80c0('0x55')](_0x80c0('0x91'),_0x368fc0,_0x1a0b88[0x0],_0x4e32dc);}else{_0x8229cc=_0x4e32dc;}}}}var _0x1de4c8={'name':_0x4a1edc,'description':_0x638f50,'path':path['join'](_0x368fc0,_0x1a0b88[0x0]),'type':_0x5a9925,'sidebar':_0x4a8078,'icon':_0x36eb5e,'adminUrl':_0x40cb97,'agentUrl':_0x8229cc,'scriptName':_0x3f766b,'scriptPath':_0x5849ea,'version':_0x512f64};removeReferences(_0x5a567f,null);return db[_0x80c0('0x39')][_0x80c0('0x96')](_0x1de4c8)[_0x80c0('0x2f')](function(_0x510288){var _0x4ba62a={'role':_0x5c6b0e['body'][_0x80c0('0x97')],'userProfileId':_0x5c6b0e['body'][_0x80c0('0x98')]};if(!_0x4ba62a)throw new Error(_0x80c0('0x99'));if(_0x4ba62a['role']==='user'){var _0xe3898c=_0x510288[_0x80c0('0x31')]({'plain':!![]});return db[_0x80c0('0x9a')]['find']({'where':{'name':_0x80c0('0x32'),'userProfileId':_0x4ba62a[_0x80c0('0x98')]},'raw':!![]})[_0x80c0('0x2f')](function(_0x3102a7){if(_0x3102a7&&_0x3102a7['autoAssociation']===0x0){return db['UserProfileResource'][_0x80c0('0x96')]({'name':_0xe3898c[_0x80c0('0x36')],'resourceId':_0xe3898c['id'],'type':_0x3102a7[_0x80c0('0x36')],'sectionId':_0x3102a7['id']},{})[_0x80c0('0x2f')](function(){return _0x510288;});}else{return _0x510288;}})['catch'](function(_0x25d5c6){logger[_0x80c0('0x34')](_0x80c0('0x9b'),_0x25d5c6);throw _0x25d5c6;});}return _0x510288;})[_0x80c0('0x2f')](respondWithResult(_0x3499bd,null))[_0x80c0('0x51')](handleError(_0x3499bd,null));}});}catch(_0x5521c5){_0x3499bd['status'](0x1f4)[_0x80c0('0x9c')](_0x5521c5);}};function removeReferences(_0x20fd6e,_0x2f34a6){try{if(_0x20fd6e){fs[_0x80c0('0x9d')](_0x20fd6e);logger[_0x80c0('0x6d')]('Zip\x20archive\x20removed');}if(_0x2f34a6){rimraf(_0x2f34a6,function(){});logger[_0x80c0('0x6d')](_0x80c0('0x9e'));}}catch(_0xfd633e){logger[_0x80c0('0x34')](_0xfd633e);}}exports[_0x80c0('0x2e')]=function(_0x560511,_0x54cdc5,_0x436362){return db[_0x80c0('0x39')][_0x80c0('0x53')]({'where':{'id':_0x560511['params']['id']}})['then'](handleEntityNotFound(_0x54cdc5,null))['then'](saveUpdates(_0x560511['body'],null))[_0x80c0('0x2f')](respondWithResult(_0x54cdc5,null))[_0x80c0('0x51')](handleError(_0x54cdc5,null));};exports[_0x80c0('0x9f')]=function(_0xa554bc,_0x1c3863,_0x3f6c3b){return db['Plugin'][_0x80c0('0x53')]({'where':{'id':_0xa554bc[_0x80c0('0x52')]['id']}})['then'](function(_0x520ba5){if(_0x520ba5){return _0x520ba5[_0x80c0('0x30')]();}})[_0x80c0('0x2f')](function(_0x33da98){rimraf(path[_0x80c0('0x55')](config[_0x80c0('0x56')],_0x80c0('0x57'),path['dirname'](_0x33da98[_0x80c0('0x7')])),function(){});return _0x33da98;})[_0x80c0('0x2f')](handleEntityNotFound(_0x1c3863,null))['then'](respondWithStatusCode(_0x1c3863,null))['catch'](handleError(_0x1c3863,null));};exports[_0x80c0('0xa0')]=function(_0x2a8deb,_0x25ac7e,_0x5a5607){return BPromise[_0x80c0('0xa1')]()[_0x80c0('0x2f')](function(){if(!_0x2a8deb['query']['path']){throw new Error(_0x80c0('0xa2'));}if(!_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0xa3')]){throw new Error(_0x80c0('0xa4'));}var _0x54bfd2=_0x2a8deb[_0x80c0('0x3d')]['hostname']?_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0xa5')]+':'+_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0xa3')]:_0x80c0('0xa6')+_0x2a8deb['query'][_0x80c0('0xa3')];var _0x37a2a0=_0x2a8deb['query'][_0x80c0('0x25')]?_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0x25')]:!![];var _0x107ae4=_0x2a8deb['query']['encoding']?_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0xa7')]:null;var _0x559fc2={'method':_0x2a8deb[_0x80c0('0xa8')],'uri':util[_0x80c0('0x58')](_0x80c0('0xa9'),_0x54bfd2,_0x2a8deb[_0x80c0('0x3d')][_0x80c0('0x7')]),'json':_0x37a2a0,'resolveWithFullResponse':!![],'encoding':_0x107ae4,'qs':_0x2a8deb['query']};if(_0x2a8deb['headers']){_0x559fc2[_0x80c0('0xaa')]=_0x2a8deb[_0x80c0('0xaa')];if(_0x559fc2['headers'][_0x80c0('0xab')]){delete _0x559fc2[_0x80c0('0xaa')]['content-length'];}}if(_0x559fc2['headers']['content-type']){delete _0x559fc2['headers']['content-type'];}return rp(_0x559fc2);})[_0x80c0('0x2f')](function(_0x66415f){if(_0x66415f){_0x25ac7e[_0x80c0('0x2a')](_0x66415f[_0x80c0('0xaa')]);logger[_0x80c0('0x6d')](_0x66415f[_0x80c0('0xac')]);if(_['endsWith'](_0x2a8deb['query'][_0x80c0('0x7')],_0x80c0('0x54'))&&_0x66415f[_0x80c0('0xad')]==0x1f4){return _0x25ac7e[_0x80c0('0x23')](_0x66415f[_0x80c0('0xad')]);}else{return _0x25ac7e[_0x80c0('0x29')](_0x66415f[_0x80c0('0xad')])[_0x80c0('0x9c')](_0x66415f['body']);}}else{return _0x25ac7e[_0x80c0('0x23')](0xc8);}})[_0x80c0('0x51')](handleError(_0x25ac7e,null));};exports[_0x80c0('0xae')]=function(_0x57dc37,_0x4730d1,_0x475fef){return BPromise[_0x80c0('0xa1')]()['then'](function(){if(!_0x57dc37[_0x80c0('0x3d')][_0x80c0('0x7')]){throw new Error(_0x80c0('0xa2'));}if(!_0x57dc37[_0x80c0('0x3d')][_0x80c0('0xa3')]){throw new Error(_0x80c0('0xa4'));}var _0x55e5fc=_0x57dc37[_0x80c0('0x3d')]['hostname']?_0x57dc37[_0x80c0('0x3d')]['hostname']+':'+_0x57dc37[_0x80c0('0x3d')][_0x80c0('0xa3')]:'http://localhost:'+_0x57dc37['query'][_0x80c0('0xa3')];var _0x2a0533=_0x57dc37[_0x80c0('0x3d')]['json']?_0x57dc37[_0x80c0('0x3d')][_0x80c0('0x25')]:!![];var _0x5cadfd=_0x57dc37[_0x80c0('0x3d')]['encoding']?_0x57dc37[_0x80c0('0x3d')]['encoding']:null;var _0x159a34={'method':_0x57dc37['method'],'uri':util[_0x80c0('0x58')](_0x80c0('0xa9'),_0x55e5fc,_0x57dc37[_0x80c0('0x3d')]['path']),'json':_0x2a0533,'resolveWithFullResponse':!![],'encoding':_0x5cadfd,'body':_0x57dc37[_0x80c0('0xac')]};if(_0x57dc37[_0x80c0('0xaa')]){_0x159a34[_0x80c0('0xaa')]=_0x57dc37[_0x80c0('0xaa')];if(_0x159a34[_0x80c0('0xaa')]['content-length']){delete _0x159a34[_0x80c0('0xaa')][_0x80c0('0xab')];}}if(_0x159a34[_0x80c0('0xaa')]['content-type']){delete _0x159a34[_0x80c0('0xaa')]['content-type'];}return rp(_0x159a34);})[_0x80c0('0x2f')](function(_0x4b1708){if(_0x4b1708){_0x4730d1[_0x80c0('0x2a')](_0x4b1708[_0x80c0('0xaa')]);logger[_0x80c0('0x6d')](_0x4b1708[_0x80c0('0xac')]);return _0x4730d1[_0x80c0('0x29')](_0x4b1708[_0x80c0('0xad')])[_0x80c0('0x9c')](_0x4b1708['body']);}else{return _0x4730d1['sendStatus'](0xc8);}})[_0x80c0('0x51')](handleError(_0x4730d1,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 108d588..abe36a9 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 _0xbe2c=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x537d1c,_0x4b02e6){var _0x3397cc=function(_0xc32396){while(--_0xc32396){_0x537d1c['push'](_0x537d1c['shift']());}};_0x3397cc(++_0x4b02e6);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x2b2cfc,_0x45a09b){_0x2b2cfc=_0x2b2cfc-0x0;var _0x1a9dba=_0xbe2c[_0x2b2cfc];return _0x1a9dba;};'use strict';var EventEmitter=require(_0xcbe2('0x0'));var Plugin=require(_0xcbe2('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xcbe2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbe2('0x3'),'afterDestroy':_0xcbe2('0x4')};function emitEvent(_0x107914){return function(_0x42c28d,_0x3f9f67,_0x59afb2){PluginEvents[_0xcbe2('0x5')](_0x107914+':'+_0x42c28d['id'],_0x42c28d);PluginEvents[_0xcbe2('0x5')](_0x107914,_0x42c28d);_0x59afb2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xcbe2('0x6')](e,emitEvent(event));}}module[_0xcbe2('0x7')]=PluginEvents; \ No newline at end of file +var _0x78d3=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x4a534f,_0x1b8b22){var _0x7f42e3=function(_0xdaa5ea){while(--_0xdaa5ea){_0x4a534f['push'](_0x4a534f['shift']());}};_0x7f42e3(++_0x1b8b22);}(_0x78d3,0x73));var _0x378d=function(_0x54e81a,_0x4ba69d){_0x54e81a=_0x54e81a-0x0;var _0x937fe=_0x78d3[_0x54e81a];return _0x937fe;};'use strict';var EventEmitter=require(_0x378d('0x0'));var Plugin=require(_0x378d('0x1'))['db'][_0x378d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x378d('0x3')](0x0);var events={'afterCreate':_0x378d('0x4'),'afterUpdate':_0x378d('0x5'),'afterDestroy':_0x378d('0x6')};function emitEvent(_0x29273c){return function(_0x52f934,_0x32a62f,_0x23360d){PluginEvents[_0x378d('0x7')](_0x29273c+':'+_0x52f934['id'],_0x52f934);PluginEvents[_0x378d('0x7')](_0x29273c,_0x52f934);_0x23360d(null);};}for(var e in events){if(events[_0x378d('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3505d89..8b89916 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 _0x5719=['exports','define','Plugin','plugins','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x39afca,_0x147c8f){var _0x3febbf=function(_0x2439a2){while(--_0x2439a2){_0x39afca['push'](_0x39afca['shift']());}};_0x3febbf(++_0x147c8f);}(_0x5719,0x101));var _0x9571=function(_0x179634,_0x35406f){_0x179634=_0x179634-0x0;var _0x57245c=_0x5719[_0x179634];return _0x57245c;};'use strict';var _=require('lodash');var util=require(_0x9571('0x0'));var logger=require(_0x9571('0x1'))(_0x9571('0x2'));var moment=require(_0x9571('0x3'));var BPromise=require('bluebird');var rp=require(_0x9571('0x4'));var fs=require('fs');var path=require(_0x9571('0x5'));var rimraf=require('rimraf');var config=require(_0x9571('0x6'));var attributes=require('./plugin.attributes');module[_0x9571('0x7')]=function(_0x20dece,_0x26d9f9){return _0x20dece[_0x9571('0x8')](_0x9571('0x9'),attributes,{'tableName':_0x9571('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39c6=['moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','lodash','util','../../config/logger','api'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x39c6,0x175));var _0x639c=function(_0x41b7f2,_0x5df667){_0x41b7f2=_0x41b7f2-0x0;var _0x42d595=_0x39c6[_0x41b7f2];return _0x42d595;};'use strict';var _=require(_0x639c('0x0'));var util=require(_0x639c('0x1'));var logger=require(_0x639c('0x2'))(_0x639c('0x3'));var moment=require(_0x639c('0x4'));var BPromise=require('bluebird');var rp=require(_0x639c('0x5'));var fs=require('fs');var path=require(_0x639c('0x6'));var rimraf=require(_0x639c('0x7'));var config=require(_0x639c('0x8'));var attributes=require(_0x639c('0x9'));module[_0x639c('0xa')]=function(_0x21fd3b,_0x56da41){return _0x21fd3b[_0x639c('0xb')](_0x639c('0xc'),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 4136606..7ac7fdd 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 _0x4c29=['message','result','catch','CreatePlugin','body','options','util','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x141fe3,_0x1bad00){var _0x25aa10=function(_0x4d2082){while(--_0x4d2082){_0x141fe3['push'](_0x141fe3['shift']());}};_0x25aa10(++_0x1bad00);}(_0x4c29,0x9c));var _0x94c2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x4c29[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require(_0x94c2('0x0'));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(_0x94c2('0x1'));var logger=require(_0x94c2('0x2'))(_0x94c2('0x3'));var config=require(_0x94c2('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x94c2('0x5')]['http']({'port':0x232a});config[_0x94c2('0x6')]=_[_0x94c2('0x7')](config[_0x94c2('0x6')],{'host':_0x94c2('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c2('0x6')]));require('./plugin.socket')[_0x94c2('0x9')](socket);function respondWithRpcPromise(_0x47d5a9,_0x10c49e,_0xbcd3fb){return new BPromise(function(_0x44e52d,_0x5574ca){return client[_0x94c2('0xa')](_0x47d5a9,_0xbcd3fb)[_0x94c2('0xb')](function(_0x2545b7){logger[_0x94c2('0xc')](_0x94c2('0xd'),_0x10c49e,_0x94c2('0xe'));logger[_0x94c2('0xf')](_0x94c2('0x10'),_0x10c49e,_0x94c2('0xe'),JSON[_0x94c2('0x11')](_0x2545b7));if(_0x2545b7[_0x94c2('0x12')]){if(_0x2545b7[_0x94c2('0x12')]['code']===0x1f4){logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);return _0x5574ca(_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);}logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x2545b7[_0x94c2('0x12')][_0x94c2('0x13')]);return _0x44e52d(_0x2545b7['error'][_0x94c2('0x13')]);}else{logger[_0x94c2('0xc')](_0x94c2('0xd'),_0x10c49e,_0x94c2('0xe'));_0x44e52d(_0x2545b7[_0x94c2('0x14')][_0x94c2('0x13')]);}})[_0x94c2('0x15')](function(_0x55bc2d){logger[_0x94c2('0x12')](_0x94c2('0xd'),_0x10c49e,_0x55bc2d);_0x5574ca(_0x55bc2d);});});}exports[_0x94c2('0x16')]=function(_0x4ed30b){var _0x3c1df5=this;return new Promise(function(_0x5793e3,_0x18e8f0){return db['Plugin']['create'](_0x4ed30b[_0x94c2('0x17')],{'raw':_0x4ed30b[_0x94c2('0x18')]?_0x4ed30b['options']['raw']===undefined?!![]:![]:!![]})[_0x94c2('0xb')](function(_0x5124fe){logger[_0x94c2('0xc')](_0x94c2('0x16'),_0x4ed30b);logger[_0x94c2('0xf')]('CreatePlugin',_0x4ed30b,JSON[_0x94c2('0x11')](_0x5124fe));_0x5793e3(_0x5124fe);})[_0x94c2('0x15')](function(_0x239409){logger[_0x94c2('0x12')]('CreatePlugin',_0x239409[_0x94c2('0x13')],_0x4ed30b);_0x18e8f0(_0x3c1df5[_0x94c2('0x12')](0x1f4,_0x239409[_0x94c2('0x13')]));});});}; \ No newline at end of file +var _0x19fa=['redis','localhost','register','then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreatePlugin','body','options','raw','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x19fa,0x8e));var _0xa19f=function(_0x493cf6,_0x246edb){_0x493cf6=_0x493cf6-0x0;var _0xaf5f92=_0x19fa[_0x493cf6];return _0xaf5f92;};'use strict';var _=require(_0xa19f('0x0'));var util=require(_0xa19f('0x1'));var moment=require(_0xa19f('0x2'));var BPromise=require(_0xa19f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19f('0x4'));var db=require(_0xa19f('0x5'))['db'];var utils=require(_0xa19f('0x6'));var logger=require(_0xa19f('0x7'))(_0xa19f('0x8'));var config=require(_0xa19f('0x9'));var jayson=require(_0xa19f('0xa'));var client=jayson[_0xa19f('0xb')][_0xa19f('0xc')]({'port':0x232a});config[_0xa19f('0xd')]=_['defaults'](config[_0xa19f('0xd')],{'host':_0xa19f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./plugin.socket')[_0xa19f('0xf')](socket);function respondWithRpcPromise(_0x540c2f,_0x2823ee,_0x4223d2){return new BPromise(function(_0x3e7373,_0x2d574a){return client['request'](_0x540c2f,_0x4223d2)[_0xa19f('0x10')](function(_0x22f98a){logger['info'](_0xa19f('0x11'),_0x2823ee,'request\x20sent');logger[_0xa19f('0x12')](_0xa19f('0x13'),_0x2823ee,'request\x20sent',JSON['stringify'](_0x22f98a));if(_0x22f98a[_0xa19f('0x14')]){if(_0x22f98a['error'][_0xa19f('0x15')]===0x1f4){logger['error'](_0xa19f('0x11'),_0x2823ee,_0x22f98a[_0xa19f('0x14')]['message']);return _0x2d574a(_0x22f98a[_0xa19f('0x14')][_0xa19f('0x16')]);}logger[_0xa19f('0x14')]('Plugin,\x20%s,\x20%s',_0x2823ee,_0x22f98a['error']['message']);return _0x3e7373(_0x22f98a[_0xa19f('0x14')]['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x2823ee,'request\x20sent');_0x3e7373(_0x22f98a[_0xa19f('0x17')][_0xa19f('0x16')]);}})[_0xa19f('0x18')](function(_0x3c3f5f){logger[_0xa19f('0x14')](_0xa19f('0x11'),_0x2823ee,_0x3c3f5f);_0x2d574a(_0x3c3f5f);});});}exports[_0xa19f('0x19')]=function(_0x1f04b3){var _0x35f5ef=this;return new Promise(function(_0x4aeda8,_0x52ec78){return db['Plugin']['create'](_0x1f04b3[_0xa19f('0x1a')],{'raw':_0x1f04b3['options']?_0x1f04b3[_0xa19f('0x1b')][_0xa19f('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x15f83c){logger[_0xa19f('0x1d')]('CreatePlugin',_0x1f04b3);logger[_0xa19f('0x12')]('CreatePlugin',_0x1f04b3,JSON[_0xa19f('0x1e')](_0x15f83c));_0x4aeda8(_0x15f83c);})[_0xa19f('0x18')](function(_0x1c8ffd){logger[_0xa19f('0x14')](_0xa19f('0x19'),_0x1c8ffd[_0xa19f('0x16')],_0x1f04b3);_0x52ec78(_0x35f5ef['error'](0x1f4,_0x1c8ffd[_0xa19f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 31c6bfa..c8251df 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 _0x656a=['./plugin.events','save','update','emit','removeListener','register','length','plugin:'];(function(_0x289d4f,_0x2ef8f6){var _0x725a3e=function(_0x17fcac){while(--_0x17fcac){_0x289d4f['push'](_0x289d4f['shift']());}};_0x725a3e(++_0x2ef8f6);}(_0x656a,0x128));var _0xa656=function(_0x13ef4f,_0x268dae){_0x13ef4f=_0x13ef4f-0x0;var _0x568fa4=_0x656a[_0x13ef4f];return _0x568fa4;};'use strict';var PluginEvents=require(_0xa656('0x0'));var events=[_0xa656('0x1'),'remove',_0xa656('0x2')];function createListener(_0x1d0ad8,_0x716464){return function(_0x373911){_0x716464[_0xa656('0x3')](_0x1d0ad8,_0x373911);};}function removeListener(_0x13b9b4,_0x2f8a27){return function(){PluginEvents[_0xa656('0x4')](_0x13b9b4,_0x2f8a27);};}exports[_0xa656('0x5')]=function(_0x40db5d){for(var _0xa1da0b=0x0,_0x2f3df2=events[_0xa656('0x6')];_0xa1da0b<_0x2f3df2;_0xa1da0b++){var _0x3193f0=events[_0xa1da0b];var _0x2b2b7d=createListener(_0xa656('0x7')+_0x3193f0,_0x40db5d);PluginEvents['on'](_0x3193f0,_0x2b2b7d);}}; \ No newline at end of file +var _0x8d23=['emit','removeListener','register','length','remove','update'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x8d23,0x8e));var _0x38d2=function(_0x1d2345,_0x3138f4){_0x1d2345=_0x1d2345-0x0;var _0x207ec0=_0x8d23[_0x1d2345];return _0x207ec0;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x38d2('0x0'),_0x38d2('0x1')];function createListener(_0xa230fb,_0x273a9a){return function(_0x526e08){_0x273a9a[_0x38d2('0x2')](_0xa230fb,_0x526e08);};}function removeListener(_0x480910,_0x48e415){return function(){PluginEvents[_0x38d2('0x3')](_0x480910,_0x48e415);};}exports[_0x38d2('0x4')]=function(_0x4486aa){for(var _0x1f2de9=0x0,_0x189e32=events[_0x38d2('0x5')];_0x1f2de9<_0x189e32;_0x1f2de9++){var _0x1576dc=events[_0x1f2de9];var _0xec09bb=createListener('plugin:'+_0x1576dc,_0x4486aa);PluginEvents['on'](_0x1576dc,_0xec09bb);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4a8decb..d4280f3 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(_0x52f82e,_0x34509b){var _0x17818c=function(_0x4d94dc){while(--_0x4d94dc){_0x52f82e['push'](_0x52f82e['shift']());}};_0x17818c(++_0x34509b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0x3574a2,_0x4d20c0){var _0x3e7246=function(_0x3e78c5){while(--_0x3e78c5){_0x3574a2['push'](_0x3574a2['shift']());}};_0x3e7246(++_0x4d20c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 2f13c31..a594b7b 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 _0xbec5=['Unknown\x20id','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','restart','hasOwnProperty','params','destroy'];(function(_0x195d9e,_0x4fc668){var _0x18fde5=function(_0x51898d){while(--_0x51898d){_0x195d9e['push'](_0x195d9e['shift']());}};_0x18fde5(++_0x4fc668);}(_0xbec5,0xe5));var _0x5bec=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xbec5[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0x5bec('0x0'));var pm2=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var path=require(_0x5bec('0x3'));var exec=require(_0x5bec('0x4'))[_0x5bec('0x5')];var BPromise=require(_0x5bec('0x6'));function handleEntityNotFound(_0x4ee982,_0x1f8933){return function(_0x376cdb){if(!_0x376cdb){_0x4ee982[_0x5bec('0x7')](0x194);;}return _0x376cdb;};}function respondWithResult(_0x4aaac6,_0x3ed67a){_0x3ed67a=_0x3ed67a||0xc8;return function(_0x28a427){if(_0x28a427){return _0x4aaac6[_0x5bec('0x8')](_0x3ed67a)[_0x5bec('0x9')](_0x28a427);}return null;};}function handleError(_0x43d96e,_0x302aae){_0x302aae=_0x302aae||0x1f4;return function(_0x6406a1){logger[_0x5bec('0xa')](_0x6406a1['stack']);if(_0x6406a1[_0x5bec('0xb')]){delete _0x6406a1['name'];}_0x43d96e[_0x5bec('0x8')](_0x302aae)[_0x5bec('0xc')](_0x6406a1);};}function execChildProcess(){return new BPromise(function(_0x117162,_0x4a5482){exec(_0x5bec('0xd'),function(_0x18fa47,_0x16226b,_0x57ffc4){logger[_0x5bec('0xe')](_0x16226b);logger[_0x5bec('0xe')](_0x57ffc4);if(_0x18fa47){logger['error'](_0x18fa47);return _0x4a5482(_0x18fa47);}return _0x117162(_0x16226b);});});}exports[_0x5bec('0xf')]=function(_0xaa984d,_0x35393a){return pm2[_0x5bec('0x10')]()[_0x5bec('0x11')](function(_0xcd6d90){if(_0xcd6d90){var _0x24dcd6=_[_0x5bec('0x12')](_0xcd6d90,function(_0x259588){return _0x259588[_0x5bec('0xb')]===_0x5bec('0x13')||_0x259588[_0x5bec('0xb')]===_0x5bec('0x14');});return{'rows':_0x24dcd6,'count':_0x24dcd6['length']};}return null;})['then'](respondWithResult(_0x35393a,null))[_0x5bec('0x15')](handleError(_0x35393a,null));};exports[_0x5bec('0x16')]=function(_0x31ad9c,_0x1771e7){return pm2['describe'](_0x31ad9c['params']['id'])[_0x5bec('0x11')](respondWithResult(_0x1771e7,null))[_0x5bec('0x11')](handleEntityNotFound(_0x1771e7,null))['catch'](handleError(_0x1771e7,null));};exports[_0x5bec('0x17')]=function(_0xa7e223,_0x32a846){if(_0xa7e223[_0x5bec('0x18')]['name']&&_0xa7e223[_0x5bec('0x18')]['script']){var _0x191c0f=path[_0x5bec('0x19')](__dirname,_0x5bec('0x1a'),_0xa7e223[_0x5bec('0x18')][_0x5bec('0x1b')]);var _0x5e154e=process[_0x5bec('0x1c')]();process['chdir'](path[_0x5bec('0x1d')](_0x191c0f));return execChildProcess()[_0x5bec('0x11')](function(_0x5b2636){process[_0x5bec('0x1e')](_0x5e154e);return pm2[_0x5bec('0x1f')]({'name':_0xa7e223['body'][_0x5bec('0xb')],'script':_0x191c0f});})[_0x5bec('0x11')](function(_0x43d460){pm2[_0x5bec('0x20')]();return _0x43d460[0x0];})[_0x5bec('0x11')](respondWithResult(_0x32a846,0xc9))[_0x5bec('0x15')](handleError(_0x32a846,null));}else{return _0x32a846[_0x5bec('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x2961bd,_0x2cdd2f){if(_0x2961bd[_0x5bec('0x18')]['id']){delete _0x2961bd['body']['id'];}var _0x2b3b2c={'online':_0x5bec('0x21'),'stopped':'stop'};if(_0x2b3b2c[_0x5bec('0x22')](_0x2961bd[_0x5bec('0x18')]['status'])){return pm2[_0x2b3b2c[_0x2961bd['body'][_0x5bec('0x8')]]](_0x2961bd[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](respondWithResult(_0x2cdd2f,0xc8))[_0x5bec('0x15')](handleError(_0x2cdd2f,null));}else{return _0x2cdd2f[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':'Unknown\x20status'});}};exports[_0x5bec('0x24')]=function(_0x59b5b6,_0x45863b){if(_0x59b5b6[_0x5bec('0x18')]['id']){delete _0x59b5b6[_0x5bec('0x18')]['id'];}if(_0x59b5b6[_0x5bec('0x23')]['id']){return pm2['delete'](_0x59b5b6[_0x5bec('0x23')]['id'])[_0x5bec('0x11')](function(_0xfc7d41){pm2['dump']();return _0xfc7d41[0x0];})[_0x5bec('0x11')](respondWithResult(_0x45863b,null))['catch'](handleError(_0x45863b,null));}else{return _0x45863b[_0x5bec('0x8')](0x1f4)[_0x5bec('0xc')]({'message':_0x5bec('0x25')});}}; \ No newline at end of file +var _0xc6d8=['Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','path','exec','sendStatus','status','stack','name','send','npm\x20install','info','error','index','list','then','reject','length','show','describe','create','body','join','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch'];(function(_0x587ba2,_0x42eb40){var _0x50ec73=function(_0x2f32e3){while(--_0x2f32e3){_0x587ba2['push'](_0x587ba2['shift']());}};_0x50ec73(++_0x42eb40);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0xc6d8[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0x8c6d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8c6d('0x1'))('api');var path=require(_0x8c6d('0x2'));var exec=require('child_process')[_0x8c6d('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b6b04,_0x352b8c){return function(_0xdff6f){if(!_0xdff6f){_0x5b6b04[_0x8c6d('0x4')](0x194);;}return _0xdff6f;};}function respondWithResult(_0x4f5e8f,_0x3c265c){_0x3c265c=_0x3c265c||0xc8;return function(_0x2dbb52){if(_0x2dbb52){return _0x4f5e8f[_0x8c6d('0x5')](_0x3c265c)['json'](_0x2dbb52);}return null;};}function handleError(_0x1496ba,_0x75c49f){_0x75c49f=_0x75c49f||0x1f4;return function(_0x16d4b2){logger['error'](_0x16d4b2[_0x8c6d('0x6')]);if(_0x16d4b2[_0x8c6d('0x7')]){delete _0x16d4b2[_0x8c6d('0x7')];}_0x1496ba[_0x8c6d('0x5')](_0x75c49f)[_0x8c6d('0x8')](_0x16d4b2);};}function execChildProcess(){return new BPromise(function(_0x43a7ab,_0x60cd5c){exec(_0x8c6d('0x9'),function(_0x50af75,_0x36d6fb,_0x559d17){logger['info'](_0x36d6fb);logger[_0x8c6d('0xa')](_0x559d17);if(_0x50af75){logger[_0x8c6d('0xb')](_0x50af75);return _0x60cd5c(_0x50af75);}return _0x43a7ab(_0x36d6fb);});});}exports[_0x8c6d('0xc')]=function(_0x8ec2d4,_0x30ecfa){return pm2[_0x8c6d('0xd')]()[_0x8c6d('0xe')](function(_0x103699){if(_0x103699){var _0x14c1ee=_[_0x8c6d('0xf')](_0x103699,function(_0x4fb956){return _0x4fb956[_0x8c6d('0x7')]==='express'||_0x4fb956[_0x8c6d('0x7')]==='motion2';});return{'rows':_0x14c1ee,'count':_0x14c1ee[_0x8c6d('0x10')]};}return null;})[_0x8c6d('0xe')](respondWithResult(_0x30ecfa,null))['catch'](handleError(_0x30ecfa,null));};exports[_0x8c6d('0x11')]=function(_0x2b8a26,_0x51a5fa){return pm2[_0x8c6d('0x12')](_0x2b8a26['params']['id'])['then'](respondWithResult(_0x51a5fa,null))[_0x8c6d('0xe')](handleEntityNotFound(_0x51a5fa,null))['catch'](handleError(_0x51a5fa,null));};exports[_0x8c6d('0x13')]=function(_0x174a4f,_0x1d0f0a){if(_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')]&&_0x174a4f['body']['script']){var _0x550079=path[_0x8c6d('0x15')](__dirname,'../../files/plugins',_0x174a4f[_0x8c6d('0x14')]['script']);var _0x4c378b=process[_0x8c6d('0x16')]();process[_0x8c6d('0x17')](path['dirname'](_0x550079));return execChildProcess()['then'](function(_0x51bb08){process['chdir'](_0x4c378b);return pm2[_0x8c6d('0x18')]({'name':_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')],'script':_0x550079});})['then'](function(_0x41c904){pm2['dump']();return _0x41c904[0x0];})[_0x8c6d('0xe')](respondWithResult(_0x1d0f0a,0xc9))['catch'](handleError(_0x1d0f0a,null));}else{return _0x1d0f0a[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x19')});}};exports[_0x8c6d('0x1a')]=function(_0x1e6755,_0x3e3cd3){if(_0x1e6755[_0x8c6d('0x14')]['id']){delete _0x1e6755[_0x8c6d('0x14')]['id'];}var _0x3eab38={'online':'restart','stopped':'stop'};if(_0x3eab38[_0x8c6d('0x1b')](_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')])){return pm2[_0x3eab38[_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')]]](_0x1e6755[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](respondWithResult(_0x3e3cd3,0xc8))[_0x8c6d('0x1d')](handleError(_0x3e3cd3,null));}else{return _0x3e3cd3[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x1e')});}};exports[_0x8c6d('0x1f')]=function(_0x4e5203,_0x3af625){if(_0x4e5203[_0x8c6d('0x14')]['id']){delete _0x4e5203[_0x8c6d('0x14')]['id'];}if(_0x4e5203[_0x8c6d('0x1c')]['id']){return pm2[_0x8c6d('0x20')](_0x4e5203[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](function(_0x1857f9){pm2[_0x8c6d('0x21')]();return _0x1857f9[0x0];})['then'](respondWithResult(_0x3af625,null))[_0x8c6d('0x1d')](handleError(_0x3af625,null));}else{return _0x3af625['status'](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 47fe3e4..0eabcec 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 _0x8da7=['exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','/queues','getQueues'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x8da7,0xa1));var _0x78da=function(_0x29ad8e,_0x402b17){_0x29ad8e=_0x29ad8e-0x0;var _0x37e6e1=_0x8da7[_0x29ad8e];return _0x37e6e1;};'use strict';var express=require(_0x78da('0x0'));var router=express[_0x78da('0x1')]();var auth=require(_0x78da('0x2'));var controller=require(_0x78da('0x3'));router[_0x78da('0x4')](_0x78da('0x5'),auth[_0x78da('0x6')](),controller['getAgents']);router['get'](_0x78da('0x7'),auth['isAuthenticated'](),controller[_0x78da('0x8')]);module[_0x78da('0x9')]=router; \ No newline at end of file +var _0x675a=['getAgents','get','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','/agents','isAuthenticated'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x675a,0x118));var _0xa675=function(_0x2c29d8,_0x45a0c2){_0x2c29d8=_0x2c29d8-0x0;var _0x4b2743=_0x675a[_0x2c29d8];return _0x4b2743;};'use strict';var express=require(_0xa675('0x0'));var router=express[_0xa675('0x1')]();var auth=require(_0xa675('0x2'));var controller=require(_0xa675('0x3'));router['get'](_0xa675('0x4'),auth[_0xa675('0x5')](),controller[_0xa675('0x6')]);router[_0xa675('0x7')](_0xa675('0x8'),auth[_0xa675('0x5')](),controller[_0xa675('0x9')]);module[_0xa675('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index d556a01..fafda56 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 _0x5e2f=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','loggedInDb','talking','busy','find','merge','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','online','agents','User','Queue','findAll','QueueId','getChannels','toLowerCase','Invalid\x20channel','getAgents','query','pauseTypeFilter','pause','*pause','resolve','channel','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','rawAttributes','fieldName','key','agent','getOptions','raw','sequelize','literal','FIELD(id,','Pause','forEach','user','userProfileId','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','sortAgentsByStatus','getQueues','type','role','QueueCampaigns','all','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','set','json','stack','name','status','send','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','paused','voice','outbound','push','pTalking','originated','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x394c7e,_0xcb0750){var _0x32872f=function(_0x49aa7d){while(--_0x49aa7d){_0x394c7e['push'](_0x394c7e['shift']());}};_0x32872f(++_0xcb0750);}(_0x5e2f,0x1a5));var _0xf5e2=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0x5e2f[_0x4932a6];return _0x3b45b9;};'use strict';var util=require('util');var _=require(_0xf5e2('0x0'));var jayson=require(_0xf5e2('0x1'));var rta=require(_0xf5e2('0x2'));var qs=require(_0xf5e2('0x3'));var utils=require('../../config/utils');var logger=require(_0xf5e2('0x4'))('api');var db=require(_0xf5e2('0x5'))['db'];var amiClient=jayson[_0xf5e2('0x6')]['http']({'port':0x232a});var routingClient=jayson['client'][_0xf5e2('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x2b933c,_0x3fa85a){return function(_0x26b561){if(_0x26b561){var _0x22ca2a=typeof _0x3fa85a[_0xf5e2('0x8')]===_0xf5e2('0x9')&&typeof _0x3fa85a[_0xf5e2('0xa')]==='undefined';var _0x46a175=_0x26b561[_0xf5e2('0xb')];var _0x5fccb2=_0x22ca2a?0x0:_0x3fa85a[_0xf5e2('0x8')];var _0x512129=_0x22ca2a?_0x26b561[_0xf5e2('0xb')]:_0x3fa85a[_0xf5e2('0x8')]+_0x3fa85a['limit'];var _0xb15a5f;if(_0x512129>=_0x46a175){_0x512129=_0x46a175;_0xb15a5f=0xc8;}else{_0xb15a5f=0xce;}_0x2b933c['status'](_0xb15a5f);return _0x2b933c[_0xf5e2('0xc')]('Content-Range',_0x5fccb2+'-'+_0x512129+'/'+_0x46a175)[_0xf5e2('0xd')](_0x26b561);}return null;};}function handleError(_0x502147,_0x57fe4f){_0x57fe4f=_0x57fe4f||0x1f4;return function(_0x12e6c1){logger['error'](_0x12e6c1[_0xf5e2('0xe')]);if(_0x12e6c1[_0xf5e2('0xf')]){delete _0x12e6c1[_0xf5e2('0xf')];}_0x502147[_0xf5e2('0x10')](_0x57fe4f)[_0xf5e2('0x11')](_0x12e6c1);};}function getRealtimeQueues(_0x131598,_0x5412ef){return new Promise(function(_0x4b7bde,_0xfaa67c){var _0x179cbd=_0x5412ef==='voice'?amiClient:routingClient;return _0x179cbd[_0xf5e2('0x12')](_[_0xf5e2('0x13')](_0x5412ef)+_0xf5e2('0x14'),_0x131598)[_0xf5e2('0x15')](function(_0x520f90){if(_0x520f90[_0xf5e2('0x16')])throw new Error(util[_0xf5e2('0x17')](_0xf5e2('0x18'),_0x5412ef));return _0x4b7bde(_0x520f90[_0xf5e2('0x19')]);})[_0xf5e2('0x1a')](function(_0xa3612c){_0xfaa67c(_0xa3612c);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x107706,_0x52df97){return amiClient['request'](_0xf5e2('0x1b'),{})['then'](function(_0x31cd1c){if(_0x31cd1c[_0xf5e2('0x16')])throw new Error(_0xf5e2('0x1c'));return _0x107706(_0x31cd1c[_0xf5e2('0x19')]);})[_0xf5e2('0x1a')](function(_0xe66f7f){_0x52df97(_0xe66f7f);});});}function initializeQueues(_0x3f282f,_0x2f93f5,_0x433e8a,_0x185643){var _0x431c47=['loggedIn',_0xf5e2('0x1d'),_0xf5e2('0x1e'),'talking',_0xf5e2('0x1f')];if(_0x433e8a===_0xf5e2('0x20')&&_0x185643===_0xf5e2('0x21')){_0x431c47[_0xf5e2('0x22')](_0xf5e2('0x23'),_0xf5e2('0x24'),'message','dialActive','dialMethod',_0xf5e2('0x25'),_0xf5e2('0x26'),'startProgressive',_0xf5e2('0x27'),'erlangCallToSecond',_0xf5e2('0x28'),_0xf5e2('0x29'),'dialPredictiveInterval',_0xf5e2('0x2a'),_0xf5e2('0x2b'),_0xf5e2('0x2c'),'predictiveIntervalTotalCalls',_0xf5e2('0x2d'),_0xf5e2('0x2e'),_0xf5e2('0x2f'),'predictiveIntervalAvgHoldtime',_0xf5e2('0x30'));}return _0x3f282f[_0xf5e2('0x31')](function(_0x1ca678){var _0x5ef3b7=_0x1ca678['get']({'plain':!![]});_0x5ef3b7['agents']=[];_0x5ef3b7[_0xf5e2('0x1f')]=0x0;_0x5ef3b7[_0xf5e2('0x32')]=0x0;_0x5ef3b7['loggedIn']=0x0;_0x5ef3b7[_0xf5e2('0x1d')]=0x0;_0x5ef3b7['waiting']=0x0;if(_0x433e8a===_0xf5e2('0x20')){_0x5ef3b7[_0xf5e2('0x33')]=0x0;_0x5ef3b7[_0xf5e2('0x34')]=0x0;if(_0x185643===_0xf5e2('0x21')){_0x5ef3b7[_0xf5e2('0x23')]=0x0;_0x5ef3b7['originated']=0x0;}}var _0x484647=_[_0xf5e2('0x35')](_0x2f93f5,['id',_0x5ef3b7['id']]);if(_0x484647)_[_0xf5e2('0x36')](_0x5ef3b7,_[_0xf5e2('0x37')](_0x484647,_0x431c47));return _0x5ef3b7;});}function updateAgentVoiceStatus(_0x30749e,_0x390dc3,_0x58f8e3){var _0xf5c1eb=_[_0xf5e2('0x38')](_0x58f8e3,[_0xf5e2('0x39'),_0x390dc3['name']]);if(_0xf5c1eb[_0xf5e2('0x3a')]===0x0)return _0x30749e['busy']=!![];if(_[_0xf5e2('0x3b')](_0xf5c1eb,[_0xf5e2('0x3c'),_0x30749e[_0xf5e2('0x3d')][_0xf5e2('0x3e')]()]))return _0x30749e[_0xf5e2('0x33')]=!![];if(!_0x30749e['talking'])return _0x30749e[_0xf5e2('0x34')]=!![];}function getVoiceQueueAgents(_0x40fc9a,_0x3bff6d,_0x49b931,_0x402438){var _0xba3987=_['find'](_0x3bff6d,['id',_0x40fc9a['id']]);if(!_0xba3987)return _0x40fc9a;return _0xba3987[_0xf5e2('0x3f')]({'raw':!![]})['then'](function(_0xcb2acd){for(var _0x22e65f=0x0;_0x22e65f<_0xcb2acd[_0xf5e2('0x3a')];_0x22e65f++){var _0x243ac5=_[_0xf5e2('0x35')](_0x49b931,['id',_0xcb2acd[_0x22e65f]['UserId']]);if(!_0x243ac5){_0x243ac5={'id':_0xcb2acd[_0x22e65f][_0xf5e2('0x40')],'name':_0xcb2acd[_0x22e65f][_0xf5e2('0x40')],'accountcode':'','online':![]};}var _0x4bd338={'id':_0x243ac5['id'],'name':_0x243ac5['name'],'internal':_0x243ac5['accountcode'],'online':Boolean(_0x243ac5[_0xf5e2('0x41')]),'paused':Boolean(_0xcb2acd[_0x22e65f][_0xf5e2('0x1f')])};if(_0x243ac5['voiceStatus']===_0xf5e2('0x33'))updateAgentVoiceStatus(_0x4bd338,_0x40fc9a,_0x402438);if(_0x4bd338[_0xf5e2('0x41')])_0x40fc9a[_0xf5e2('0x32')]++;if(_0x4bd338[_0xf5e2('0x34')])_0x40fc9a[_0xf5e2('0x34')]++;if(_0x4bd338[_0xf5e2('0x1f')]&&!_0x4bd338[_0xf5e2('0x34')]&&!_0x4bd338[_0xf5e2('0x33')])_0x40fc9a[_0xf5e2('0x1f')]++;_0x40fc9a[_0xf5e2('0x42')][_0xf5e2('0x22')](_0x4bd338);}return _0x40fc9a;});}function getQueueAgents(_0x446750,_0x3109f0,_0x4533c2){var _0x486032=_0xf5e2('0x43')+_['startCase'](_0x4533c2)+_0xf5e2('0x44');var _0x4a70f4=_0x4533c2+'Pause';return db[_0x486032][_0xf5e2('0x45')]({'where':{[_[_0xf5e2('0x13')](_0x4533c2)+_0xf5e2('0x46')]:_0x446750['id']},'raw':!![]})['then'](function(_0xd567d1){for(var _0x43acce=0x0;_0x43acce<_0xd567d1[_0xf5e2('0x3a')];_0x43acce++){var _0x39c927=_['find'](_0x3109f0,['id',_0xd567d1[_0x43acce][_0xf5e2('0x40')]]);if(!_0x39c927){_0x39c927={'id':_0xd567d1[_0x43acce][_0xf5e2('0x40')],'name':_0xd567d1[_0x43acce]['UserId'],'online':![],['pauseField']:![]};}var _0x5b9183={'id':_0x39c927['id'],'name':_0x39c927[_0xf5e2('0xf')],'online':Boolean(_0x39c927['online']),'paused':Boolean(_0x39c927[_0x4a70f4])};if(_0x5b9183['online'])_0x446750[_0xf5e2('0x32')]++;_0x446750[_0xf5e2('0x42')]['push'](_0x5b9183);}return _0x446750;});}function validateChannel(_0x3de013){var _0x11c9f=utils[_0xf5e2('0x47')]();if(!_['includes'](_0x11c9f,_0x3de013[_0xf5e2('0x48')]()))throw new Error(_0xf5e2('0x49'));return _0x3de013[_0xf5e2('0x48')]();}exports[_0xf5e2('0x4a')]=function(_0x2ab2f8,_0x2d2614){var _0x36e48e={'count':0x0,'rows':[]};var _0x2f55dc={};var _0x5c7bb6;var _0x199060;var _0x590ffe;var _0x18ef6d;var _0x2e6f07=utils[_0xf5e2('0x47')]();var _0x11464b=_0x2ab2f8[_0xf5e2('0x4b')]['globalQueueFilter'];var _0x3a6bc2=_0x2ab2f8[_0xf5e2('0x4b')]['globalStatusFilter'];var _0xa84541=_0x2ab2f8['query'][_0xf5e2('0x4c')];var _0x18f413=_0x3a6bc2===_0xf5e2('0x4d')||_0x3a6bc2===_0xf5e2('0x4e')?!![]:![];var _0x500da6=[];var _0x2b41d5;Promise[_0xf5e2('0x4f')]()[_0xf5e2('0x15')](function(){if(_0x2ab2f8['query'][_0xf5e2('0x50')]){_0x5c7bb6=validateChannel(_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x50')]);}if(!_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x51')]||!_0x2ab2f8[_0xf5e2('0x4b')]['sort'][_0xf5e2('0x52')](_0xf5e2('0x53'))){_0x2ab2f8[_0xf5e2('0x4b')]['sort']=rta[_0xf5e2('0x54')](_0x2ab2f8['query'][_0xf5e2('0x51')]);return;}var _0x210767=rta[_0xf5e2('0x55')](_0x2ab2f8['query'][_0xf5e2('0x51')]);_0x2ab2f8[_0xf5e2('0x4b')][_0xf5e2('0x51')]=_0x210767[_0xf5e2('0x56')][_0xf5e2('0x57')](',');_0x199060=_0x210767[_0xf5e2('0x58')];})['then'](function(){if(!_0x11464b){return[];}return rta['getAgentIdsByQueues'](_0x11464b,_0x5c7bb6);})[_0xf5e2('0x15')](function(_0x4d3079){_0x500da6=_0x4d3079;return rta[_0xf5e2('0x59')]();})[_0xf5e2('0x15')](function(_0x2f6800){_0x18ef6d=_0x2f6800[_0xf5e2('0x5a')];if((!_0x3a6bc2||_0x18f413)&&!_0x199060){return _0x500da6;}if(_0x199060&&!_0x3a6bc2){return rta['getSortedAgentsIdsByStatus'](_0x18ef6d,_0x500da6,_0x199060);}else{return rta['getAgentIdsByStatus'](_0x18ef6d,_0x500da6,_0x3a6bc2);}})[_0xf5e2('0x15')](function(_0xe773f0){_0x500da6=_0xe773f0;var _0x99a2b5=![];if(_0x500da6[_0xf5e2('0x3a')]===0x0){if(_0x11464b||_0x3a6bc2){_0x99a2b5=!![];}if(_0x18f413){_0x99a2b5=![];}}if(_0x99a2b5){return _0x36e48e;}var _0x59cc0f=_[_0xf5e2('0x31')](db[_0xf5e2('0x43')][_0xf5e2('0x5b')],function(_0x4925ab){return{'name':_0x4925ab[_0xf5e2('0x5c')],'type':_0x4925ab['type'][_0xf5e2('0x5d')]};});_0x2ab2f8[_0xf5e2('0x4b')]['role']=_0xf5e2('0x5e');_0x2ab2f8['query'][_0xf5e2('0x41')]=!![];_0x2f55dc=qs[_0xf5e2('0x5f')](_0x59cc0f,_0x2ab2f8);_0x2f55dc[_0xf5e2('0x60')]=!![];var _0x4fbc8a=[];if(_0x500da6[_0xf5e2('0x3a')]>0x0){_0x4fbc8a[_0xf5e2('0x22')]({'id':{'$in':_0x500da6}});if(_0x199060&&!_0x3a6bc2){_0x2b41d5=[db[_0xf5e2('0x61')][_0xf5e2('0x62')](_0xf5e2('0x63')+_0x500da6+')')];_0x2f55dc[_0xf5e2('0x58')]=_0x2b41d5;}}if(_0x18f413){_0x2e6f07['forEach'](function(_0x43ca75){var _0x181a6b=!![];if(_0x3a6bc2===_0xf5e2('0x4e')&&_0x5c7bb6!==_0x43ca75){_0x181a6b=![];}_0x4fbc8a[_0xf5e2('0x22')]({[_0x43ca75+_0xf5e2('0x64')]:_0x181a6b});});if(_0xa84541){_0x4fbc8a['push']({'pauseType':_0xa84541});}}else if(_0x3a6bc2){_0x2e6f07[_0xf5e2('0x65')](function(_0x25355b){_0x4fbc8a['push']({[_0x25355b+_0xf5e2('0x64')]:![]});});}_0x2f55dc['where']=_[_0xf5e2('0x36')](_0x2f55dc['where'],{'$and':_0x4fbc8a});if(_0x2ab2f8[_0xf5e2('0x66')]['role']===_0xf5e2('0x66')){var _0x5bdd88={'params':{'id':_0x2ab2f8[_0xf5e2('0x66')][_0xf5e2('0x67')]},'query':{'section':'Agents','role':_0xf5e2('0x5e'),'online':!![],'raw':!![],'ids':_0x500da6,'customSorting':_0x2b41d5}};if(_0x18f413){_0x5bdd88[_0xf5e2('0x4b')][_0xf5e2('0x68')]=_0x4fbc8a;}_0x5bdd88[_0xf5e2('0x4b')]=Object[_0xf5e2('0x69')](_0x5bdd88[_0xf5e2('0x4b')],_0x2ab2f8['query']);delete _0x5bdd88[_0xf5e2('0x4b')]['id'];return db[_0xf5e2('0x6a')][_0xf5e2('0x6b')](_0x5bdd88);}return db[_0xf5e2('0x43')][_0xf5e2('0x6c')](_0x2f55dc);})[_0xf5e2('0x15')](function(_0x1a93f9){_0x36e48e[_0xf5e2('0xb')]=_0x1a93f9['count'];_0x590ffe=_0x1a93f9[_0xf5e2('0x5a')];return _0x590ffe[_0xf5e2('0x31')](function(_0x235c24){var _0x45fb79=_[_0xf5e2('0x35')](_0x18ef6d,['id',_0x235c24['id']]);if(_0x45fb79){var _0x1a8cd6=rta[_0xf5e2('0x6d')](_0x45fb79);_[_0xf5e2('0x36')](_0x235c24,_0x1a8cd6);}_0x235c24['globalStatus']=rta[_0xf5e2('0x6e')](_0x235c24);if(_0x235c24['globalStatus'][_0xf5e2('0x52')](_0xf5e2('0x4d'))){_0x2e6f07[_0xf5e2('0x65')](function(_0x18e7be){if(_0x235c24[_0x18e7be+_0xf5e2('0x64')]){_0x235c24[_0x18e7be+'Status']=_0xf5e2('0x4d');}});}return _0x235c24;});})[_0xf5e2('0x15')](function(_0x142150){if(!_0x199060||_0x2b41d5){return _0x142150;}return rta[_0xf5e2('0x6f')](_0x142150,_0x199060);})[_0xf5e2('0x15')](function(_0x46c4d1){_0x36e48e['rows']=_0x46c4d1;return _0x36e48e;})[_0xf5e2('0x15')](respondWithFilteredResult(_0x2d2614,_0x2f55dc))[_0xf5e2('0x1a')](handleError(_0x2d2614,null));};exports[_0xf5e2('0x70')]=function(_0x418899,_0x3d92cd){var _0x28e900={'count':0x0,'rows':[]},_0x4547ac={},_0x4ba9b3,_0x538742,_0x5ce153,_0x12848c,_0x46cf1c;Promise[_0xf5e2('0x4f')]()[_0xf5e2('0x15')](function(){if(_0x418899['query'][_0xf5e2('0x50')])_0x4ba9b3=validateChannel(_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x50')]);var _0x16c996=_[_0xf5e2('0x13')](_0x4ba9b3)+_0xf5e2('0x44');var _0x5115d2=_['map'](db[_0x16c996]['rawAttributes'],function(_0x3d039b){return{'name':_0x3d039b[_0xf5e2('0x5c')],'type':_0x3d039b[_0xf5e2('0x71')][_0xf5e2('0x5d')]};});_0x4547ac=qs['getOptions'](_0x5115d2,_0x418899);if(_0x418899[_0xf5e2('0x66')][_0xf5e2('0x72')]===_0xf5e2('0x66')){var _0x4733c3={'params':{'id':_0x418899[_0xf5e2('0x66')]['userProfileId']},'query':{'section':_0x4ba9b3===_0xf5e2('0x20')&&_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')]===_0xf5e2('0x21')?_0xf5e2('0x73'):_['startCase'](_0x4ba9b3)+_0xf5e2('0x14'),'type':_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')],'nolimit':!![],'sort':_0xf5e2('0xf'),'filter':_0x418899['query']['filter']}};return db[_0xf5e2('0x6a')][_0xf5e2('0x6b')](_0x4733c3);}return db[_0x16c996]['findAndCountAll'](_0x4547ac);})[_0xf5e2('0x15')](function(_0x3d9656){_0x28e900[_0xf5e2('0xb')]=_0x3d9656[_0xf5e2('0xb')];_0x538742=_0x3d9656['rows'];return getRealtimeQueues(_0x418899,_0x4ba9b3);})[_0xf5e2('0x15')](function(_0x54eafb){_0x12848c=_0x54eafb[_0xf5e2('0x5a')];return rta[_0xf5e2('0x59')]();})[_0xf5e2('0x15')](function(_0x2af02d){_0x5ce153=_0x2af02d[_0xf5e2('0x5a')];if(_0x4ba9b3!=_0xf5e2('0x20'))return;return getRealtimeVoiceQueueChannels();})[_0xf5e2('0x15')](function(_0x209a85){_0x46cf1c=_0x209a85?_0x209a85[_0xf5e2('0x5a')]:[];return initializeQueues(_0x538742,_0x12848c,_0x4ba9b3,_0x418899[_0xf5e2('0x4b')][_0xf5e2('0x71')]);})[_0xf5e2('0x15')](function(_0x41a2ca){var _0x54892e=_0x41a2ca[_0xf5e2('0x31')](function(_0x4886b6){if(_0x4ba9b3==='voice')return getVoiceQueueAgents(_0x4886b6,_0x538742,_0x5ce153,_0x46cf1c);else return getQueueAgents(_0x4886b6,_0x5ce153,_0x4ba9b3);});return Promise[_0xf5e2('0x74')](_0x54892e);})['then'](function(_0x2a55f4){_0x28e900[_0xf5e2('0x5a')]=_0x2a55f4;return _0x28e900;})[_0xf5e2('0x15')](respondWithFilteredResult(_0x3d92cd,_0x4547ac))['catch'](handleError(_0x3d92cd,null));}; \ No newline at end of file +var _0xd924=['dialMethod','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','busy','find','merge','pick','queue','some','connectedlinenum','internal','toString','then','length','UserId','accountcode','online','User','Pause','findAll','startCase','Invalid\x20channel','toLowerCase','getAgents','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','channel','query','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','rawAttributes','fieldName','type','key','role','getOptions','sequelize','FIELD(id,','order','forEach','where','user','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','getAgentStatus','Status','sortAgentsByStatus','getQueues','Queue','userProfileId','QueueCampaigns','filter','UserProfile','getRealtimeAgents','all','util','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','api','../../mysqldb','client','http','offset','limit','undefined','count','set','stack','name','status','send','voice','request','Queues','error','format','result','catch','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive'];(function(_0x4a0099,_0x5321ca){var _0x59b700=function(_0x403227){while(--_0x403227){_0x4a0099['push'](_0x4a0099['shift']());}};_0x59b700(++_0x5321ca);}(_0xd924,0x14e));var _0x4d92=function(_0x55b745,_0x36e0fa){_0x55b745=_0x55b745-0x0;var _0x1772a7=_0xd924[_0x55b745];return _0x1772a7;};'use strict';var util=require(_0x4d92('0x0'));var _=require(_0x4d92('0x1'));var jayson=require(_0x4d92('0x2'));var rta=require(_0x4d92('0x3'));var qs=require(_0x4d92('0x4'));var utils=require(_0x4d92('0x5'));var logger=require('../../config/logger')(_0x4d92('0x6'));var db=require(_0x4d92('0x7'))['db'];var amiClient=jayson[_0x4d92('0x8')]['http']({'port':0x232a});var routingClient=jayson[_0x4d92('0x8')][_0x4d92('0x9')]({'port':0x232c});function respondWithFilteredResult(_0x452b28,_0x3beb5d){return function(_0x33b89c){if(_0x33b89c){var _0x2f0903=typeof _0x3beb5d[_0x4d92('0xa')]==='undefined'&&typeof _0x3beb5d[_0x4d92('0xb')]===_0x4d92('0xc');var _0x363ec9=_0x33b89c[_0x4d92('0xd')];var _0x4391de=_0x2f0903?0x0:_0x3beb5d[_0x4d92('0xa')];var _0x476c7d=_0x2f0903?_0x33b89c['count']:_0x3beb5d[_0x4d92('0xa')]+_0x3beb5d[_0x4d92('0xb')];var _0x41c41d;if(_0x476c7d>=_0x363ec9){_0x476c7d=_0x363ec9;_0x41c41d=0xc8;}else{_0x41c41d=0xce;}_0x452b28['status'](_0x41c41d);return _0x452b28[_0x4d92('0xe')]('Content-Range',_0x4391de+'-'+_0x476c7d+'/'+_0x363ec9)['json'](_0x33b89c);}return null;};}function handleError(_0x2aa644,_0x532a51){_0x532a51=_0x532a51||0x1f4;return function(_0x242c71){logger['error'](_0x242c71[_0x4d92('0xf')]);if(_0x242c71[_0x4d92('0x10')]){delete _0x242c71[_0x4d92('0x10')];}_0x2aa644[_0x4d92('0x11')](_0x532a51)[_0x4d92('0x12')](_0x242c71);};}function getRealtimeQueues(_0x3fa894,_0x5f4c6c){return new Promise(function(_0x3064cb,_0x297a9){var _0x365b00=_0x5f4c6c===_0x4d92('0x13')?amiClient:routingClient;return _0x365b00[_0x4d92('0x14')](_['startCase'](_0x5f4c6c)+_0x4d92('0x15'),_0x3fa894)['then'](function(_0x5591b0){if(_0x5591b0[_0x4d92('0x16')])throw new Error(util[_0x4d92('0x17')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x5f4c6c));return _0x3064cb(_0x5591b0[_0x4d92('0x18')]);})[_0x4d92('0x19')](function(_0x5647f3){_0x297a9(_0x5647f3);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0xea5373,_0x329954){return amiClient[_0x4d92('0x14')]('VoiceQueuesChannels',{})['then'](function(_0x5e133d){if(_0x5e133d[_0x4d92('0x16')])throw new Error(_0x4d92('0x1a'));return _0xea5373(_0x5e133d[_0x4d92('0x18')]);})['catch'](function(_0x15357b){_0x329954(_0x15357b);});});}function initializeQueues(_0xd7b355,_0x4589a9,_0x52ace3,_0x3b7fff){var _0x541504=[_0x4d92('0x1b'),_0x4d92('0x1c'),_0x4d92('0x1d'),_0x4d92('0x1e'),_0x4d92('0x1f')];if(_0x52ace3===_0x4d92('0x13')&&_0x3b7fff===_0x4d92('0x20')){_0x541504[_0x4d92('0x21')](_0x4d92('0x22'),_0x4d92('0x23'),_0x4d92('0x24'),_0x4d92('0x25'),_0x4d92('0x26'),_0x4d92('0x27'),_0x4d92('0x28'),_0x4d92('0x29'),'erlangCalls',_0x4d92('0x2a'),_0x4d92('0x2b'),_0x4d92('0x2c'),_0x4d92('0x2d'),_0x4d92('0x2e'),'dialPredictiveIntervalMinThreshold',_0x4d92('0x2f'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x4d92('0x30'),_0x4d92('0x31'),_0x4d92('0x32'),_0x4d92('0x33'));}return _0xd7b355[_0x4d92('0x34')](function(_0x5a34f9){var _0x28ff58=_0x5a34f9[_0x4d92('0x35')]({'plain':!![]});_0x28ff58[_0x4d92('0x36')]=[];_0x28ff58[_0x4d92('0x1f')]=0x0;_0x28ff58[_0x4d92('0x37')]=0x0;_0x28ff58['loggedIn']=0x0;_0x28ff58[_0x4d92('0x1c')]=0x0;_0x28ff58[_0x4d92('0x1d')]=0x0;if(_0x52ace3==='voice'){_0x28ff58[_0x4d92('0x1e')]=0x0;_0x28ff58[_0x4d92('0x38')]=0x0;if(_0x3b7fff===_0x4d92('0x20')){_0x28ff58[_0x4d92('0x22')]=0x0;_0x28ff58[_0x4d92('0x23')]=0x0;}}var _0x5da826=_[_0x4d92('0x39')](_0x4589a9,['id',_0x28ff58['id']]);if(_0x5da826)_[_0x4d92('0x3a')](_0x28ff58,_[_0x4d92('0x3b')](_0x5da826,_0x541504));return _0x28ff58;});}function updateAgentVoiceStatus(_0x23e0fa,_0x106c19,_0x151516){var _0x16437c=_['filter'](_0x151516,[_0x4d92('0x3c'),_0x106c19[_0x4d92('0x10')]]);if(_0x16437c['length']===0x0)return _0x23e0fa['busy']=!![];if(_[_0x4d92('0x3d')](_0x16437c,[_0x4d92('0x3e'),_0x23e0fa[_0x4d92('0x3f')][_0x4d92('0x40')]()]))return _0x23e0fa[_0x4d92('0x1e')]=!![];if(!_0x23e0fa['talking'])return _0x23e0fa[_0x4d92('0x38')]=!![];}function getVoiceQueueAgents(_0x3e5633,_0x490603,_0x4f9980,_0x2c4f36){var _0x2ed641=_[_0x4d92('0x39')](_0x490603,['id',_0x3e5633['id']]);if(!_0x2ed641)return _0x3e5633;return _0x2ed641['getMembers']({'raw':!![]})[_0x4d92('0x41')](function(_0x2bdc91){for(var _0x2c4ba1=0x0;_0x2c4ba1<_0x2bdc91[_0x4d92('0x42')];_0x2c4ba1++){var _0x417998=_[_0x4d92('0x39')](_0x4f9980,['id',_0x2bdc91[_0x2c4ba1]['UserId']]);if(!_0x417998){_0x417998={'id':_0x2bdc91[_0x2c4ba1][_0x4d92('0x43')],'name':_0x2bdc91[_0x2c4ba1][_0x4d92('0x43')],'accountcode':'','online':![]};}var _0x453472={'id':_0x417998['id'],'name':_0x417998['name'],'internal':_0x417998[_0x4d92('0x44')],'online':Boolean(_0x417998[_0x4d92('0x45')]),'paused':Boolean(_0x2bdc91[_0x2c4ba1][_0x4d92('0x1f')])};if(_0x417998['voiceStatus']===_0x4d92('0x1e'))updateAgentVoiceStatus(_0x453472,_0x3e5633,_0x2c4f36);if(_0x453472['online'])_0x3e5633['loggedInDb']++;if(_0x453472[_0x4d92('0x38')])_0x3e5633[_0x4d92('0x38')]++;if(_0x453472[_0x4d92('0x1f')]&&!_0x453472[_0x4d92('0x38')]&&!_0x453472[_0x4d92('0x1e')])_0x3e5633[_0x4d92('0x1f')]++;_0x3e5633[_0x4d92('0x36')][_0x4d92('0x21')](_0x453472);}return _0x3e5633;});}function getQueueAgents(_0x101ea6,_0x1fd1e6,_0x5b5d63){var _0x186de7=_0x4d92('0x46')+_['startCase'](_0x5b5d63)+'Queue';var _0xf4feb9=_0x5b5d63+_0x4d92('0x47');return db[_0x186de7][_0x4d92('0x48')]({'where':{[_[_0x4d92('0x49')](_0x5b5d63)+'QueueId']:_0x101ea6['id']},'raw':!![]})[_0x4d92('0x41')](function(_0x41311c){for(var _0x20dc55=0x0;_0x20dc55<_0x41311c[_0x4d92('0x42')];_0x20dc55++){var _0x222d19=_[_0x4d92('0x39')](_0x1fd1e6,['id',_0x41311c[_0x20dc55]['UserId']]);if(!_0x222d19){_0x222d19={'id':_0x41311c[_0x20dc55][_0x4d92('0x43')],'name':_0x41311c[_0x20dc55][_0x4d92('0x43')],'online':![],['pauseField']:![]};}var _0x464360={'id':_0x222d19['id'],'name':_0x222d19[_0x4d92('0x10')],'online':Boolean(_0x222d19['online']),'paused':Boolean(_0x222d19[_0xf4feb9])};if(_0x464360[_0x4d92('0x45')])_0x101ea6['loggedInDb']++;_0x101ea6[_0x4d92('0x36')][_0x4d92('0x21')](_0x464360);}return _0x101ea6;});}function validateChannel(_0x1f046b){var _0x152019=utils['getChannels']();if(!_['includes'](_0x152019,_0x1f046b['toLowerCase']()))throw new Error(_0x4d92('0x4a'));return _0x1f046b[_0x4d92('0x4b')]();}exports[_0x4d92('0x4c')]=function(_0x521a18,_0x3e6262){var _0x29f1cc={'count':0x0,'rows':[]};var _0x58bed4={};var _0xd6bfb8;var _0x3072d9;var _0x2976dd;var _0x88a40c;var _0x124287=utils['getChannels']();var _0x3f0028=_0x521a18['query'][_0x4d92('0x4d')];var _0x541f59=_0x521a18['query'][_0x4d92('0x4e')];var _0x27e816=_0x521a18['query']['pauseTypeFilter'];var _0x55476c=_0x541f59===_0x4d92('0x4f')||_0x541f59===_0x4d92('0x50')?!![]:![];var _0x196dfa=[];var _0x5ecf2a;Promise[_0x4d92('0x51')]()[_0x4d92('0x41')](function(){if(_0x521a18['query'][_0x4d92('0x52')]){_0xd6bfb8=validateChannel(_0x521a18['query'][_0x4d92('0x52')]);}if(!_0x521a18[_0x4d92('0x53')][_0x4d92('0x54')]||!_0x521a18['query']['sort'][_0x4d92('0x55')](_0x4d92('0x56'))){_0x521a18[_0x4d92('0x53')][_0x4d92('0x54')]=rta[_0x4d92('0x57')](_0x521a18[_0x4d92('0x53')][_0x4d92('0x54')]);return;}var _0x2ebcbc=rta[_0x4d92('0x58')](_0x521a18[_0x4d92('0x53')]['sort']);_0x521a18[_0x4d92('0x53')][_0x4d92('0x54')]=_0x2ebcbc[_0x4d92('0x59')][_0x4d92('0x5a')](',');_0x3072d9=_0x2ebcbc['order'];})[_0x4d92('0x41')](function(){if(!_0x3f0028){return[];}return rta[_0x4d92('0x5b')](_0x3f0028,_0xd6bfb8);})[_0x4d92('0x41')](function(_0x400388){_0x196dfa=_0x400388;return rta['getRealtimeAgents']();})[_0x4d92('0x41')](function(_0x5b3f47){_0x88a40c=_0x5b3f47[_0x4d92('0x5c')];if((!_0x541f59||_0x55476c)&&!_0x3072d9){return _0x196dfa;}if(_0x3072d9&&!_0x541f59){return rta[_0x4d92('0x5d')](_0x88a40c,_0x196dfa,_0x3072d9);}else{return rta[_0x4d92('0x5e')](_0x88a40c,_0x196dfa,_0x541f59);}})[_0x4d92('0x41')](function(_0x3af994){_0x196dfa=_0x3af994;var _0x3bef5c=![];if(_0x196dfa[_0x4d92('0x42')]===0x0){if(_0x3f0028||_0x541f59){_0x3bef5c=!![];}if(_0x55476c){_0x3bef5c=![];}}if(_0x3bef5c){return _0x29f1cc;}var _0x24f580=_[_0x4d92('0x34')](db['User'][_0x4d92('0x5f')],function(_0x2712aa){return{'name':_0x2712aa[_0x4d92('0x60')],'type':_0x2712aa[_0x4d92('0x61')][_0x4d92('0x62')]};});_0x521a18[_0x4d92('0x53')][_0x4d92('0x63')]='agent';_0x521a18[_0x4d92('0x53')]['online']=!![];_0x58bed4=qs[_0x4d92('0x64')](_0x24f580,_0x521a18);_0x58bed4['raw']=!![];var _0x5b20e2=[];if(_0x196dfa[_0x4d92('0x42')]>0x0){_0x5b20e2[_0x4d92('0x21')]({'id':{'$in':_0x196dfa}});if(_0x3072d9&&!_0x541f59){_0x5ecf2a=[db[_0x4d92('0x65')]['literal'](_0x4d92('0x66')+_0x196dfa+')')];_0x58bed4[_0x4d92('0x67')]=_0x5ecf2a;}}if(_0x55476c){_0x124287[_0x4d92('0x68')](function(_0x14c144){var _0x3eb900=!![];if(_0x541f59===_0x4d92('0x50')&&_0xd6bfb8!==_0x14c144){_0x3eb900=![];}_0x5b20e2['push']({[_0x14c144+_0x4d92('0x47')]:_0x3eb900});});if(_0x27e816){_0x5b20e2['push']({'pauseType':_0x27e816});}}else if(_0x541f59){_0x124287['forEach'](function(_0x26f727){_0x5b20e2[_0x4d92('0x21')]({[_0x26f727+'Pause']:![]});});}_0x58bed4[_0x4d92('0x69')]=_[_0x4d92('0x3a')](_0x58bed4['where'],{'$and':_0x5b20e2});if(_0x521a18[_0x4d92('0x6a')]['role']===_0x4d92('0x6a')){var _0x13529c={'params':{'id':_0x521a18[_0x4d92('0x6a')]['userProfileId']},'query':{'section':_0x4d92('0x6b'),'role':'agent','online':!![],'raw':!![],'ids':_0x196dfa,'customSorting':_0x5ecf2a}};if(_0x55476c){_0x13529c[_0x4d92('0x53')][_0x4d92('0x6c')]=_0x5b20e2;}_0x13529c['query']=Object[_0x4d92('0x6d')](_0x13529c[_0x4d92('0x53')],_0x521a18[_0x4d92('0x53')]);delete _0x13529c[_0x4d92('0x53')]['id'];return db['UserProfile'][_0x4d92('0x6e')](_0x13529c);}return db['User'][_0x4d92('0x6f')](_0x58bed4);})['then'](function(_0x2ccb05){_0x29f1cc[_0x4d92('0xd')]=_0x2ccb05['count'];_0x2976dd=_0x2ccb05[_0x4d92('0x5c')];return _0x2976dd['map'](function(_0x2a2ff7){var _0x55beb5=_[_0x4d92('0x39')](_0x88a40c,['id',_0x2a2ff7['id']]);if(_0x55beb5){var _0x1cf384=rta[_0x4d92('0x70')](_0x55beb5);_['merge'](_0x2a2ff7,_0x1cf384);}_0x2a2ff7[_0x4d92('0x56')]=rta[_0x4d92('0x71')](_0x2a2ff7);if(_0x2a2ff7[_0x4d92('0x56')][_0x4d92('0x55')](_0x4d92('0x4f'))){_0x124287[_0x4d92('0x68')](function(_0x4549ec){if(_0x2a2ff7[_0x4549ec+_0x4d92('0x47')]){_0x2a2ff7[_0x4549ec+_0x4d92('0x72')]=_0x4d92('0x4f');}});}return _0x2a2ff7;});})['then'](function(_0x98083c){if(!_0x3072d9||_0x5ecf2a){return _0x98083c;}return rta[_0x4d92('0x73')](_0x98083c,_0x3072d9);})[_0x4d92('0x41')](function(_0x48364f){_0x29f1cc['rows']=_0x48364f;return _0x29f1cc;})[_0x4d92('0x41')](respondWithFilteredResult(_0x3e6262,_0x58bed4))[_0x4d92('0x19')](handleError(_0x3e6262,null));};exports[_0x4d92('0x74')]=function(_0x3f5ca8,_0x56b30a){var _0x1658b0={'count':0x0,'rows':[]},_0x2d3af0={},_0xcef98d,_0x50b885,_0x2c0cea,_0x29433d,_0x302f03;Promise['resolve']()[_0x4d92('0x41')](function(){if(_0x3f5ca8['query']['channel'])_0xcef98d=validateChannel(_0x3f5ca8['query'][_0x4d92('0x52')]);var _0x399793=_[_0x4d92('0x49')](_0xcef98d)+_0x4d92('0x75');var _0x5280a7=_['map'](db[_0x399793][_0x4d92('0x5f')],function(_0x208a37){return{'name':_0x208a37[_0x4d92('0x60')],'type':_0x208a37[_0x4d92('0x61')][_0x4d92('0x62')]};});_0x2d3af0=qs[_0x4d92('0x64')](_0x5280a7,_0x3f5ca8);if(_0x3f5ca8['user']['role']===_0x4d92('0x6a')){var _0x13fefe={'params':{'id':_0x3f5ca8[_0x4d92('0x6a')][_0x4d92('0x76')]},'query':{'section':_0xcef98d===_0x4d92('0x13')&&_0x3f5ca8[_0x4d92('0x53')][_0x4d92('0x61')]===_0x4d92('0x20')?_0x4d92('0x77'):_[_0x4d92('0x49')](_0xcef98d)+'Queues','type':_0x3f5ca8[_0x4d92('0x53')]['type'],'nolimit':!![],'sort':'name','filter':_0x3f5ca8[_0x4d92('0x53')][_0x4d92('0x78')]}};return db[_0x4d92('0x79')][_0x4d92('0x6e')](_0x13fefe);}return db[_0x399793][_0x4d92('0x6f')](_0x2d3af0);})[_0x4d92('0x41')](function(_0x50193e){_0x1658b0[_0x4d92('0xd')]=_0x50193e[_0x4d92('0xd')];_0x50b885=_0x50193e[_0x4d92('0x5c')];return getRealtimeQueues(_0x3f5ca8,_0xcef98d);})[_0x4d92('0x41')](function(_0x71bd4d){_0x29433d=_0x71bd4d[_0x4d92('0x5c')];return rta[_0x4d92('0x7a')]();})['then'](function(_0x309dbe){_0x2c0cea=_0x309dbe[_0x4d92('0x5c')];if(_0xcef98d!=_0x4d92('0x13'))return;return getRealtimeVoiceQueueChannels();})[_0x4d92('0x41')](function(_0x30b050){_0x302f03=_0x30b050?_0x30b050['rows']:[];return initializeQueues(_0x50b885,_0x29433d,_0xcef98d,_0x3f5ca8['query']['type']);})[_0x4d92('0x41')](function(_0x980207){var _0x5a59d6=_0x980207[_0x4d92('0x34')](function(_0x3cd584){if(_0xcef98d==='voice')return getVoiceQueueAgents(_0x3cd584,_0x50b885,_0x2c0cea,_0x302f03);else return getQueueAgents(_0x3cd584,_0x2c0cea,_0xcef98d);});return Promise[_0x4d92('0x7b')](_0x5a59d6);})['then'](function(_0x2a7892){_0x1658b0[_0x4d92('0x5c')]=_0x2a7892;return _0x1658b0;})[_0x4d92('0x41')](respondWithFilteredResult(_0x56b30a,_0x2d3af0))['catch'](handleError(_0x56b30a,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 82afe6a..dfdfe44 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x175a46,_0x467177){var _0x4050a7=function(_0x43d829){while(--_0x43d829){_0x175a46['push'](_0x175a46['shift']());}};_0x4050a7(++_0x467177);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x59881a,_0x5ef668){var _0x33a221=function(_0x396188){while(--_0x396188){_0x59881a['push'](_0x59881a['shift']());}};_0x33a221(++_0x5ef668);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ebd954c..756219f 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 _0xafca=['INTEGER','STRING','DATE','sequelize'];(function(_0x34d8ff,_0x532c9d){var _0x1f4ede=function(_0x3df129){while(--_0x3df129){_0x34d8ff['push'](_0x34d8ff['shift']());}};_0x1f4ede(++_0x532c9d);}(_0xafca,0x1ef));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaafc('0x0'));module['exports']={'state':{'type':Sequelize[_0xaafc('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xaafc('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaafc('0x3')]},'responsetime':{'type':Sequelize[_0xaafc('0x3')]},'ringtime':{'type':Sequelize[_0xaafc('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xaafc('0x2')]},'campaigntype':{'type':Sequelize[_0xaafc('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc0a4=['INTEGER','STRING','DATE','exports'];(function(_0x4787e8,_0x53425e){var _0x3076a8=function(_0x574503){while(--_0x574503){_0x4787e8['push'](_0x4787e8['shift']());}};_0x3076a8(++_0x53425e);}(_0xc0a4,0x147));var _0x4c0a=function(_0x1305cb,_0xe80caf){_0x1305cb=_0x1305cb-0x0;var _0x41f38a=_0xc0a4[_0x1305cb];return _0x41f38a;};'use strict';var Sequelize=require('sequelize');module[_0x4c0a('0x0')]={'state':{'type':Sequelize[_0x4c0a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4c0a('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x4c0a('0x2')]},'starttime':{'type':Sequelize[_0x4c0a('0x3')]},'responsetime':{'type':Sequelize[_0x4c0a('0x3')]},'ringtime':{'type':Sequelize[_0x4c0a('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4c0a('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4c0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ca0034f..26e534b 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 _0x9d21=['./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1d947d,_0x1ec5c3){var _0x497335=function(_0x306acf){while(--_0x306acf){_0x1d947d['push'](_0x1d947d['shift']());}};_0x497335(++_0x1ec5c3);}(_0x9d21,0x115));var _0x19d2=function(_0x479f17,_0x3ddb13){_0x479f17=_0x479f17-0x0;var _0xba4508=_0x9d21[_0x479f17];return _0xba4508;};'use strict';var _=require(_0x19d2('0x0'));var util=require(_0x19d2('0x1'));var logger=require(_0x19d2('0x2'))(_0x19d2('0x3'));var moment=require(_0x19d2('0x4'));var BPromise=require(_0x19d2('0x5'));var rp=require(_0x19d2('0x6'));var fs=require('fs');var path=require(_0x19d2('0x7'));var rimraf=require('rimraf');var config=require(_0x19d2('0x8'));var attributes=require(_0x19d2('0x9'));module[_0x19d2('0xa')]=function(_0x17742b,_0xd15d68){return _0x17742b['define'](_0x19d2('0xb'),attributes,{'tableName':_0x19d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x979e=['api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x979e,0xcf));var _0xe979=function(_0x44eb35,_0x1088cd){_0x44eb35=_0x44eb35-0x0;var _0x30c3d2=_0x979e[_0x44eb35];return _0x30c3d2;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var logger=require(_0xe979('0x2'))(_0xe979('0x3'));var moment=require(_0xe979('0x4'));var BPromise=require(_0xe979('0x5'));var rp=require(_0xe979('0x6'));var fs=require('fs');var path=require(_0xe979('0x7'));var rimraf=require('rimraf');var config=require(_0xe979('0x8'));var attributes=require(_0xe979('0x9'));module[_0xe979('0xa')]=function(_0x2e5d24,_0xcf96a2){return _0x2e5d24[_0xe979('0xb')](_0xe979('0xc'),attributes,{'tableName':_0xe979('0xd'),'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 39c34f7..b9193a4 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 _0x63aa=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','create','body','options','raw','then','CreateReportAgentPreview','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x221808,_0x4e6ee5){var _0x26c697=function(_0x18e6df){while(--_0x18e6df){_0x221808['push'](_0x221808['shift']());}};_0x26c697(++_0x4e6ee5);}(_0x63aa,0x1d8));var _0xa63a=function(_0x3507b5,_0x1ee543){_0x3507b5=_0x3507b5-0x0;var _0x2ab7f8=_0x63aa[_0x3507b5];return _0x2ab7f8;};'use strict';var _=require('lodash');var util=require(_0xa63a('0x0'));var moment=require(_0xa63a('0x1'));var BPromise=require(_0xa63a('0x2'));var rs=require(_0xa63a('0x3'));var fs=require('fs');var Redis=require(_0xa63a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa63a('0x5'));var logger=require(_0xa63a('0x6'))('rpc');var config=require(_0xa63a('0x7'));var jayson=require(_0xa63a('0x8'));var client=jayson['client'][_0xa63a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1aa712,_0x30498a,_0x597bc7){return new BPromise(function(_0xf4fb17,_0xf56564){return client[_0xa63a('0xa')](_0x1aa712,_0x597bc7)['then'](function(_0x80d8fe){logger[_0xa63a('0xb')](_0xa63a('0xc'),_0x30498a,'request\x20sent');logger[_0xa63a('0xd')](_0xa63a('0xe'),_0x30498a,_0xa63a('0xf'),JSON[_0xa63a('0x10')](_0x80d8fe));if(_0x80d8fe[_0xa63a('0x11')]){if(_0x80d8fe['error'][_0xa63a('0x12')]===0x1f4){logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x80d8fe[_0xa63a('0x11')][_0xa63a('0x13')]);return _0xf56564(_0x80d8fe['error']['message']);}logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x80d8fe[_0xa63a('0x11')]['message']);return _0xf4fb17(_0x80d8fe[_0xa63a('0x11')]['message']);}else{logger[_0xa63a('0xb')](_0xa63a('0xc'),_0x30498a,_0xa63a('0xf'));_0xf4fb17(_0x80d8fe['result'][_0xa63a('0x13')]);}})[_0xa63a('0x14')](function(_0x4c2d8b){logger[_0xa63a('0x11')](_0xa63a('0xc'),_0x30498a,_0x4c2d8b);_0xf56564(_0x4c2d8b);});});}exports['CreateReportAgentPreview']=function(_0x392f51){var _0x4c2672=this;return new Promise(function(_0x43140a,_0x33e975){return db['ReportAgentPreview'][_0xa63a('0x15')](_0x392f51[_0xa63a('0x16')],{'raw':_0x392f51[_0xa63a('0x17')]?_0x392f51[_0xa63a('0x17')][_0xa63a('0x18')]===undefined?!![]:![]:!![]})[_0xa63a('0x19')](function(_0x4fee9a){logger['info'](_0xa63a('0x1a'),_0x392f51);logger[_0xa63a('0xd')]('CreateReportAgentPreview',_0x392f51,JSON[_0xa63a('0x10')](_0x4fee9a));_0x43140a(_0x4fee9a);})['catch'](function(_0x3923dd){logger[_0xa63a('0x11')](_0xa63a('0x1a'),_0x3923dd[_0xa63a('0x13')],_0x392f51);_0x33e975(_0x4c2672[_0xa63a('0x11')](0x1f4,_0x3923dd[_0xa63a('0x13')]));});});}; \ No newline at end of file +var _0x99e2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x46c56c,_0x395ada){var _0x45e709=function(_0x1e20e3){while(--_0x1e20e3){_0x46c56c['push'](_0x46c56c['shift']());}};_0x45e709(++_0x395ada);}(_0x99e2,0x1ae));var _0x299e=function(_0x14e788,_0x5dfee2){_0x14e788=_0x14e788-0x0;var _0x3fd063=_0x99e2[_0x14e788];return _0x3fd063;};'use strict';var _=require(_0x299e('0x0'));var util=require(_0x299e('0x1'));var moment=require(_0x299e('0x2'));var BPromise=require(_0x299e('0x3'));var rs=require(_0x299e('0x4'));var fs=require('fs');var Redis=require(_0x299e('0x5'));var db=require(_0x299e('0x6'))['db'];var utils=require(_0x299e('0x7'));var logger=require(_0x299e('0x8'))(_0x299e('0x9'));var config=require('../../config/environment');var jayson=require(_0x299e('0xa'));var client=jayson['client'][_0x299e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa10382,_0xf439ef,_0x3ac5fe){return new BPromise(function(_0x1db850,_0x58d672){return client['request'](_0xa10382,_0x3ac5fe)[_0x299e('0xc')](function(_0x22bf2b){logger[_0x299e('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xf439ef,_0x299e('0xe'));logger[_0x299e('0xf')](_0x299e('0x10'),_0xf439ef,_0x299e('0xe'),JSON['stringify'](_0x22bf2b));if(_0x22bf2b[_0x299e('0x11')]){if(_0x22bf2b[_0x299e('0x11')][_0x299e('0x12')]===0x1f4){logger['error'](_0x299e('0x13'),_0xf439ef,_0x22bf2b['error']['message']);return _0x58d672(_0x22bf2b[_0x299e('0x11')][_0x299e('0x14')]);}logger[_0x299e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0xf439ef,_0x22bf2b[_0x299e('0x11')][_0x299e('0x14')]);return _0x1db850(_0x22bf2b[_0x299e('0x11')][_0x299e('0x14')]);}else{logger[_0x299e('0xd')](_0x299e('0x13'),_0xf439ef,_0x299e('0xe'));_0x1db850(_0x22bf2b[_0x299e('0x15')][_0x299e('0x14')]);}})['catch'](function(_0x2ee9c6){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xf439ef,_0x2ee9c6);_0x58d672(_0x2ee9c6);});});}exports[_0x299e('0x16')]=function(_0x5176b3){var _0xe080fc=this;return new Promise(function(_0x406c70,_0x2a7bec){return db[_0x299e('0x17')]['create'](_0x5176b3[_0x299e('0x18')],{'raw':_0x5176b3[_0x299e('0x19')]?_0x5176b3['options'][_0x299e('0x1a')]===undefined?!![]:![]:!![]})[_0x299e('0xc')](function(_0x4bd04d){logger['info'](_0x299e('0x16'),_0x5176b3);logger['debug']('CreateReportAgentPreview',_0x5176b3,JSON[_0x299e('0x1b')](_0x4bd04d));_0x406c70(_0x4bd04d);})[_0x299e('0x1c')](function(_0x335f1f){logger[_0x299e('0x11')](_0x299e('0x16'),_0x335f1f[_0x299e('0x14')],_0x5176b3);_0x2a7bec(_0xe080fc[_0x299e('0x11')](0x1f4,_0x335f1f[_0x299e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b053775..cf244ac 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 _0xe57d=['voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents','agents','put','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','util','path','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id'];(function(_0x2ad9c3,_0x26becd){var _0x292e46=function(_0x41104a){while(--_0x41104a){_0x2ad9c3['push'](_0x2ad9c3['shift']());}};_0x292e46(++_0x26becd);}(_0xe57d,0x160));var _0xde57=function(_0x4a15ff,_0x44c30d){_0x4a15ff=_0x4a15ff-0x0;var _0x26b619=_0xe57d[_0x4a15ff];return _0x26b619;};'use strict';var multer=require('multer');var util=require(_0xde57('0x0'));var path=require(_0xde57('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xde57('0x2'));var controller=require(_0xde57('0x3'));router[_0xde57('0x4')]('/voice/channels',auth[_0xde57('0x5')](),controller[_0xde57('0x6')]);router['get'](_0xde57('0x7'),auth[_0xde57('0x5')](),controller[_0xde57('0x8')]);router[_0xde57('0x4')](_0xde57('0x9'),auth[_0xde57('0x5')](),controller[_0xde57('0xa')]);router[_0xde57('0x4')](_0xde57('0xb'),auth[_0xde57('0x5')](),controller['voiceQueues']);router[_0xde57('0x4')](_0xde57('0xc'),auth[_0xde57('0x5')](),controller['chatQueues']);router[_0xde57('0x4')]('/mail/queues',auth[_0xde57('0x5')](),controller[_0xde57('0xd')]);router[_0xde57('0x4')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xde57('0xe')]);router['get'](_0xde57('0xf'),auth['isAuthenticated'](),controller[_0xde57('0x10')]);router[_0xde57('0x4')]('/sms/queues',auth['isAuthenticated'](),controller[_0xde57('0x11')]);router[_0xde57('0x4')](_0xde57('0x12'),auth['isAuthenticated'](),controller[_0xde57('0x13')]);router[_0xde57('0x4')](_0xde57('0x14'),auth[_0xde57('0x5')](),controller[_0xde57('0x15')]);router[_0xde57('0x4')](_0xde57('0x16'),auth['isAuthenticated'](),controller[_0xde57('0x17')]);router['get'](_0xde57('0x18'),auth[_0xde57('0x5')](),controller[_0xde57('0x19')]);router[_0xde57('0x4')](_0xde57('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xde57('0x4')](_0xde57('0x1b'),auth[_0xde57('0x5')](),controller[_0xde57('0x1c')]);router[_0xde57('0x4')](_0xde57('0x1d'),auth['isAuthenticated'](),controller[_0xde57('0x1e')]);router[_0xde57('0x4')](_0xde57('0x1f'),auth['isAuthenticated'](),controller[_0xde57('0x20')]);router['put'](_0xde57('0x1f'),auth['isAuthenticated'](),controller[_0xde57('0x21')]);router[_0xde57('0x4')](_0xde57('0x22'),auth['isAuthenticated'](),controller[_0xde57('0x23')]);router['get']('/outbound/channels',auth[_0xde57('0x5')](),controller[_0xde57('0x24')]);router['get'](_0xde57('0x25'),auth['isAuthenticated'](),controller[_0xde57('0x26')]);router[_0xde57('0x27')]('/agents/:id/capacity',auth[_0xde57('0x5')](),controller['agentCapacity']);router['get']('/telephones',auth[_0xde57('0x5')](),controller[_0xde57('0x28')]);router['get'](_0xde57('0x29'),auth[_0xde57('0x5')](),controller[_0xde57('0x2a')]);router['get'](_0xde57('0x2b'),auth['isAuthenticated'](),controller['campaigns']);router[_0xde57('0x4')](_0xde57('0x2c'),auth[_0xde57('0x5')](),controller['faxAccounts']);router[_0xde57('0x4')](_0xde57('0x2d'),auth[_0xde57('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0xde57('0x4')](_0xde57('0x2e'),auth[_0xde57('0x5')](),controller[_0xde57('0x2f')]);router[_0xde57('0x4')](_0xde57('0x30'),auth[_0xde57('0x5')](),controller[_0xde57('0x31')]);router[_0xde57('0x4')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xde57('0x32')]);router[_0xde57('0x4')]('/sms/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x33')]);router[_0xde57('0x4')]('/whatsapp/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x34')]);router[_0xde57('0x4')]('/fax/queues/waitinginteractions',auth[_0xde57('0x5')](),controller[_0xde57('0x35')]);router[_0xde57('0x36')](_0xde57('0x37'),auth[_0xde57('0x5')](),controller['queueNotify'](_0xde57('0x38')));router[_0xde57('0x4')](_0xde57('0x39'),auth['isAuthenticated'](),controller[_0xde57('0x3a')]);router[_0xde57('0x36')](_0xde57('0x3b'),auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x3d')));router[_0xde57('0x4')](_0xde57('0x3e'),auth[_0xde57('0x5')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x3f')));router[_0xde57('0x4')]('/fax/queues/:id',auth[_0xde57('0x5')](),controller[_0xde57('0x40')]);router[_0xde57('0x36')](_0xde57('0x41'),auth[_0xde57('0x5')](),controller[_0xde57('0x3c')](_0xde57('0x42')));router[_0xde57('0x4')](_0xde57('0x43'),auth[_0xde57('0x5')](),controller['showOpenchannelQueues']);router[_0xde57('0x36')](_0xde57('0x44'),auth['isAuthenticated'](),controller[_0xde57('0x3c')](_0xde57('0x45')));router[_0xde57('0x36')]('/whatsapp/queues/:id/notify',auth[_0xde57('0x5')](),controller['queueNotify']('whatsapp'));router[_0xde57('0x4')](_0xde57('0x46'),auth[_0xde57('0x5')](),controller[_0xde57('0x47')]);router[_0xde57('0x4')](_0xde57('0x48'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0xde57('0x36')]('/agents/:id/notify',auth[_0xde57('0x5')](),controller[_0xde57('0x49')]);module[_0xde57('0x4a')]=router; \ No newline at end of file +var _0x3902=['/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0xf41394,_0x5ed704){var _0x5d84a2=function(_0x11dd62){while(--_0x11dd62){_0xf41394['push'](_0xf41394['shift']());}};_0x5d84a2(++_0x5ed704);}(_0x3902,0x1ee));var _0x2390=function(_0x1c7394,_0x31f274){_0x1c7394=_0x1c7394-0x0;var _0x256abb=_0x3902[_0x1c7394];return _0x256abb;};'use strict';var multer=require('multer');var util=require(_0x2390('0x0'));var path=require(_0x2390('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2390('0x2'));var controller=require(_0x2390('0x3'));router[_0x2390('0x4')](_0x2390('0x5'),auth[_0x2390('0x6')](),controller[_0x2390('0x7')]);router[_0x2390('0x4')](_0x2390('0x8'),auth[_0x2390('0x6')](),controller[_0x2390('0x9')]);router[_0x2390('0x4')](_0x2390('0xa'),auth[_0x2390('0x6')](),controller[_0x2390('0xb')]);router['get']('/voice/queues',auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x2390('0xc'),auth[_0x2390('0x6')](),controller[_0x2390('0xd')]);router['get']('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x2390('0x4')]('/mail/accounts',auth[_0x2390('0x6')](),controller['mailAccounts']);router['get'](_0x2390('0xe'),auth[_0x2390('0x6')](),controller['openchannelQueues']);router[_0x2390('0x4')](_0x2390('0xf'),auth[_0x2390('0x6')](),controller[_0x2390('0x10')]);router[_0x2390('0x4')](_0x2390('0x11'),auth[_0x2390('0x6')](),controller['whatsappQueues']);router[_0x2390('0x4')](_0x2390('0x12'),auth[_0x2390('0x6')](),controller[_0x2390('0x13')]);router[_0x2390('0x4')](_0x2390('0x14'),auth[_0x2390('0x6')](),controller['voiceQueuesPreview']);router[_0x2390('0x4')](_0x2390('0x15'),auth['isAuthenticated'](),controller[_0x2390('0x16')]);router['get'](_0x2390('0x17'),auth[_0x2390('0x6')](),controller[_0x2390('0x18')]);router[_0x2390('0x4')](_0x2390('0x19'),auth[_0x2390('0x6')](),controller[_0x2390('0x1a')]);router[_0x2390('0x4')](_0x2390('0x1b'),auth[_0x2390('0x6')](),controller[_0x2390('0x1c')]);router[_0x2390('0x4')](_0x2390('0x1d'),auth[_0x2390('0x6')](),controller['showVoiceQueues']);router['put']('/voice/queues/:id',auth[_0x2390('0x6')](),controller[_0x2390('0x1e')]);router['get']('/outbound',auth[_0x2390('0x6')](),controller[_0x2390('0x1f')]);router[_0x2390('0x4')](_0x2390('0x20'),auth[_0x2390('0x6')](),controller['outboundChannels']);router['get'](_0x2390('0x21'),auth[_0x2390('0x6')](),controller[_0x2390('0x22')]);router[_0x2390('0x23')](_0x2390('0x24'),auth[_0x2390('0x6')](),controller[_0x2390('0x25')]);router['get']('/telephones',auth[_0x2390('0x6')](),controller[_0x2390('0x26')]);router[_0x2390('0x4')](_0x2390('0x27'),auth[_0x2390('0x6')](),controller[_0x2390('0x28')]);router['get'](_0x2390('0x29'),auth[_0x2390('0x6')](),controller[_0x2390('0x2a')]);router[_0x2390('0x4')](_0x2390('0x2b'),auth['isAuthenticated'](),controller[_0x2390('0x2c')]);router[_0x2390('0x4')](_0x2390('0x2d'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x2390('0x4')](_0x2390('0x2e'),auth[_0x2390('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x2390('0x4')](_0x2390('0x2f'),auth[_0x2390('0x6')](),controller[_0x2390('0x30')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x2390('0x6')](),controller[_0x2390('0x31')]);router[_0x2390('0x4')](_0x2390('0x32'),auth[_0x2390('0x6')](),controller[_0x2390('0x33')]);router[_0x2390('0x4')](_0x2390('0x34'),auth[_0x2390('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x2390('0x4')]('/fax/queues/waitinginteractions',auth[_0x2390('0x6')](),controller[_0x2390('0x35')]);router['post']('/mail/queues/:id/notify',auth[_0x2390('0x6')](),controller[_0x2390('0x36')](_0x2390('0x37')));router['get']('/mail/queues/:id',auth[_0x2390('0x6')](),controller[_0x2390('0x38')]);router[_0x2390('0x39')](_0x2390('0x3a'),auth[_0x2390('0x6')](),controller['queueNotify'](_0x2390('0x3b')));router[_0x2390('0x4')](_0x2390('0x3c'),auth[_0x2390('0x6')](),controller[_0x2390('0x3d')]);router[_0x2390('0x39')](_0x2390('0x3e'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router[_0x2390('0x4')](_0x2390('0x3f'),auth['isAuthenticated'](),controller[_0x2390('0x40')]);router[_0x2390('0x39')](_0x2390('0x41'),auth[_0x2390('0x6')](),controller[_0x2390('0x36')](_0x2390('0x42')));router[_0x2390('0x4')](_0x2390('0x43'),auth[_0x2390('0x6')](),controller[_0x2390('0x44')]);router[_0x2390('0x39')](_0x2390('0x45'),auth[_0x2390('0x6')](),controller['queueNotify'](_0x2390('0x46')));router[_0x2390('0x39')](_0x2390('0x47'),auth[_0x2390('0x6')](),controller[_0x2390('0x36')](_0x2390('0x48')));router[_0x2390('0x4')](_0x2390('0x49'),auth['isAuthenticated'](),controller[_0x2390('0x4a')]);router['get'](_0x2390('0x4b'),auth[_0x2390('0x6')](),controller[_0x2390('0x4c')]);router[_0x2390('0x39')]('/agents/:id/notify',auth[_0x2390('0x6')](),controller[_0x2390('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e2d1579..01ce552 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 _0xdbf5=['SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','Account','QueueId','TransferReport','create','agentNotify','Website','Agent\x20not\x20found','MessageId','Start','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','catch','status','json','stack','name','send','isNil','rows','find','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','interaction','user','MemberReport','findAll','INTERACTION','length','findOrCreate','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xa1f728,_0x5d4491){_0xa1f728=_0xa1f728-0x0;var _0x1d65d4=_0xdbf5[_0xa1f728];return _0x1d65d4;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5dbf('0x0'));var _=require('lodash');var util=require('util');var db=require(_0x5dbf('0x1'))['db'];var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));var jayson=require(_0x5dbf('0x4'));var amiClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232a});var mailClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232b});var routingClient=jayson[_0x5dbf('0x5')][_0x5dbf('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x209b7d,_0x88128e,_0x93e657){return new BPromise(function(_0x52b039,_0x134810){var _0x501cb1=_0x93e657?_0x93e657:amiClient;return _0x501cb1[_0x5dbf('0x7')](_0x209b7d,_0x88128e)[_0x5dbf('0x8')](function(_0x264007){if(_0x264007[_0x5dbf('0x9')]){if(_0x264007['error'][_0x5dbf('0xa')]===0x1f4){return _0x134810(_0x264007['error']['message']);}return _0x52b039(_0x264007[_0x5dbf('0x9')]['message']);}else{_0x52b039(_0x264007['result']);}})[_0x5dbf('0xb')](function(_0x490b38){_0x134810(_0x490b38);});});}function respondWithResult(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xc8;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0xc')](_0x2bb7ed)[_0x5dbf('0xd')](_0x1453a9);}return _0x182cec['sendStatus'](0x194);};}function handleError(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0x1f4;return function(_0x3480c8){logger['error'](_0x3480c8[_0x5dbf('0xe')]);if(_0x3480c8[_0x5dbf('0xf')]){delete _0x3480c8[_0x5dbf('0xf')];}_0x4803ca[_0x5dbf('0xc')](_0x2b4e1c)[_0x5dbf('0x10')](_0x3480c8);};}function findById(_0x472eb9){return function(_0x2d32cc){if(!_['isNil'](_0x472eb9)&&!_['isNil'](_0x2d32cc)&&!_[_0x5dbf('0x11')](_0x2d32cc[_0x5dbf('0x12')])){return _[_0x5dbf('0x13')](_0x2d32cc[_0x5dbf('0x12')],function(_0x20c2b0){return _0x20c2b0['id']==_0x472eb9;});}return null;};}exports['voiceChannels']=function(_0x11cd00,_0x4dd03c){return respondWithRpcPromise('VoiceChannels',_0x11cd00['query'])[_0x5dbf('0x8')](respondWithResult(_0x4dd03c,null))[_0x5dbf('0xb')](handleError(_0x4dd03c,null));};exports[_0x5dbf('0x14')]=function(_0x2ab57c,_0x1e3cce){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5dbf('0x15')](_0x2ab57c['query'],_0x2ab57c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x1e3cce,null))[_0x5dbf('0xb')](handleError(_0x1e3cce,null));};exports[_0x5dbf('0x17')]=function(_0x3b763c,_0x2f154e){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5dbf('0x15')](_0x3b763c[_0x5dbf('0x18')],_0x3b763c[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x2f154e,null))[_0x5dbf('0xb')](handleError(_0x2f154e,null));};exports[_0x5dbf('0x19')]=function(_0x290456,_0x20ab1b){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x290456[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x20ab1b,null))[_0x5dbf('0xb')](handleError(_0x20ab1b,null));};exports[_0x5dbf('0x1b')]=function(_0x407741,_0x729d8f){return respondWithRpcPromise(_0x5dbf('0x1a'),_0x407741[_0x5dbf('0x18')])[_0x5dbf('0x8')](findById(_0x407741[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x729d8f,null))[_0x5dbf('0xb')](handleError(_0x729d8f,null));};exports[_0x5dbf('0x1c')]=function(_0x21cd00,_0x5768b7){return respondWithRpcPromise(_0x5dbf('0x1d'),_[_0x5dbf('0x15')](_0x21cd00[_0x5dbf('0x1e')],_0x21cd00[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x5768b7,null))[_0x5dbf('0xb')](handleError(_0x5768b7,null));};exports[_0x5dbf('0x1f')]=function(_0x31d57a,_0x406ce6){return respondWithRpcPromise(_0x5dbf('0x20'),_[_0x5dbf('0x15')](_0x31d57a['query'],_0x31d57a['params']))[_0x5dbf('0x8')](respondWithResult(_0x406ce6,null))[_0x5dbf('0xb')](handleError(_0x406ce6,null));};exports[_0x5dbf('0x21')]=function(_0x3b73ad,_0x37cf25){return respondWithRpcPromise('VoiceQueuesChannels',_0x3b73ad['query'])[_0x5dbf('0x8')](respondWithResult(_0x37cf25,null))[_0x5dbf('0xb')](handleError(_0x37cf25,null));};exports['voiceQueuesChannel']=function(_0x3531a2,_0x2a0491){return respondWithRpcPromise(_0x5dbf('0x22'),_[_0x5dbf('0x15')](_0x3531a2[_0x5dbf('0x18')],_0x3531a2['params']))[_0x5dbf('0x8')](respondWithResult(_0x2a0491,null))[_0x5dbf('0xb')](handleError(_0x2a0491,null));};exports[_0x5dbf('0x23')]=function(_0x273577,_0x3a8196){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x5dbf('0x15')](_0x273577[_0x5dbf('0x18')],_0x273577[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x3a8196,null))['catch'](handleError(_0x3a8196,null));};exports[_0x5dbf('0x24')]=function(_0x1e9a4e,_0x302dda){return respondWithRpcPromise(_0x5dbf('0x25'),_[_0x5dbf('0x15')](_0x1e9a4e[_0x5dbf('0x18')],_0x1e9a4e[_0x5dbf('0x16')]))[_0x5dbf('0x8')](respondWithResult(_0x302dda,null))[_0x5dbf('0xb')](handleError(_0x302dda,null));};exports[_0x5dbf('0x26')]=function(_0x1ba835,_0x51c667){return respondWithRpcPromise(_0x5dbf('0x27'),_0x1ba835[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x51c667,null))['catch'](handleError(_0x51c667,null));};exports[_0x5dbf('0x28')]=function(_0x43954b,_0x2e4e67){return respondWithRpcPromise('OutboundChannels',_0x43954b[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x2e4e67,null))[_0x5dbf('0xb')](handleError(_0x2e4e67,null));};exports['agents']=function(_0x4527fb,_0x29a62d){var _0x2ac162;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb[_0x5dbf('0x18')])[_0x5dbf('0x8')](function(_0x321ae3){_0x2ac162=_0x321ae3;return respondWithRpcPromise(_0x5dbf('0x29'),_0x4527fb['query'],routingClient);})['then'](function(_0x57ee72){return _['merge']({},_0x57ee72,_0x2ac162);})[_0x5dbf('0x8')](respondWithResult(_0x29a62d,null))[_0x5dbf('0xb')](handleError(_0x29a62d,null));};exports['agentCapacity']=function(_0x3ef0eb,_0x229abf){if(_0x3ef0eb['body']&&_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]&&_0x3ef0eb[_0x5dbf('0x2b')]&&_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]){for(var _0x7c390d in _0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]){if(_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')]['hasOwnProperty'](_0x7c390d)){db[_0x5dbf('0x2c')][_0x5dbf('0x2d')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'exitAt':null,'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d]&&_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x5dbf('0x2f')]?{'$notIn':_0x3ef0eb['body'][_0x5dbf('0x2a')][_0x7c390d]}:{'$ne':null}}})[_0x5dbf('0x8')](function(_0x2d046b){var _0xcc1815=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x118ae6=0x0,_0x43f5e8=_0x2d046b[_0x5dbf('0x2f')];_0x118ae6<_0x43f5e8;_0x118ae6+=0x1){_0x2d046b[_0x118ae6]['updateAttributes']({'exitAt':_0xcc1815});}});for(var _0x2e241d=0x0;_0x2e241d<_0x3ef0eb['body']['interaction'][_0x7c390d]['length'];_0x2e241d+=0x1){db['MemberReport'][_0x5dbf('0x30')]({'where':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')]['name'],'type':_0x5dbf('0x2e'),'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')]['interaction'][_0x7c390d][_0x2e241d],'exitAt':null},'defaults':{'channel':_0x7c390d,'membername':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')],'interface':_['isNil'](_0x3ef0eb[_0x5dbf('0x2b')]['interface'])?util['format'](_0x5dbf('0x31'),_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0xf')]):_0x3ef0eb['user']['interface'],'type':_0x5dbf('0x2e'),'enterAt':moment()[_0x5dbf('0x32')](_0x5dbf('0x33')),'role':_0x5dbf('0x34'),'internal':_0x3ef0eb[_0x5dbf('0x2b')][_0x5dbf('0x35')],'uniqueid':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x2a')][_0x7c390d][_0x2e241d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3ef0eb[_0x5dbf('0x16')]['id'],'capacity':_0x3ef0eb[_0x5dbf('0x1e')][_0x5dbf('0x36')]},routingClient)[_0x5dbf('0x8')](respondWithResult(_0x229abf,null))[_0x5dbf('0xb')](handleError(_0x229abf,null));};exports[_0x5dbf('0x37')]=function(_0x328dc5,_0x59f825){return respondWithRpcPromise(_0x5dbf('0x38'),_0x328dc5['query'])[_0x5dbf('0x8')](respondWithResult(_0x59f825,null))[_0x5dbf('0xb')](handleError(_0x59f825,null));};exports[_0x5dbf('0x39')]=function(_0x770c54,_0x78ab84){return respondWithRpcPromise(_0x5dbf('0x3a'),_0x770c54[_0x5dbf('0x18')])['then'](respondWithResult(_0x78ab84,null))['catch'](handleError(_0x78ab84,null));};exports['campaigns']=function(_0x1e1876,_0xfdacc7){return respondWithRpcPromise(_0x5dbf('0x3b'),_0x1e1876['query'])['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0xb')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x3c')]=function(_0x344df5,_0x5d70cc){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x344df5['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5d70cc,null))[_0x5dbf('0xb')](handleError(_0x5d70cc,null));};exports[_0x5dbf('0x3e')]=function(_0x5da14b,_0x55fd51){return respondWithRpcPromise(_0x5dbf('0x3d'),_0x5da14b[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x5da14b[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0x55fd51,null))[_0x5dbf('0xb')](handleError(_0x55fd51,null));};exports[_0x5dbf('0x3f')]=function(_0x478cc1,_0x5485f3){return respondWithRpcPromise(_0x5dbf('0x40'),_0x478cc1[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x5485f3,null))[_0x5dbf('0xb')](handleError(_0x5485f3,null));};exports[_0x5dbf('0x41')]=function(_0x4711d5,_0x50a029){return respondWithRpcPromise(_0x5dbf('0x40'),_0x4711d5['query'],routingClient)['then'](findById(_0x4711d5['params']['id']))[_0x5dbf('0x8')](respondWithResult(_0x50a029,null))['catch'](handleError(_0x50a029,null));};exports[_0x5dbf('0x42')]=function(_0x275c1d,_0x1c60ac){return respondWithRpcPromise(_0x5dbf('0x43'),_0x275c1d[_0x5dbf('0x18')],mailClient)[_0x5dbf('0x8')](respondWithResult(_0x1c60ac,null))[_0x5dbf('0xb')](handleError(_0x1c60ac,null));};exports[_0x5dbf('0x44')]=function(_0x2c84d6,_0x1d91de){return respondWithRpcPromise(_0x5dbf('0x45'),_0x2c84d6[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1d91de,null))[_0x5dbf('0xb')](handleError(_0x1d91de,null));};exports[_0x5dbf('0x46')]=function(_0x53ab1a,_0x3fbc3d){return respondWithRpcPromise('OpenchannelQueues',_0x53ab1a[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x53ab1a[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3fbc3d,null))['catch'](handleError(_0x3fbc3d,null));};exports[_0x5dbf('0x47')]=function(_0x1ade34,_0x4362c6){return respondWithRpcPromise(_0x5dbf('0x48'),_0x1ade34[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x4362c6,null))['catch'](handleError(_0x4362c6,null));};exports[_0x5dbf('0x49')]=function(_0x3e5a96,_0x3b0465){return respondWithRpcPromise(_0x5dbf('0x48'),_0x3e5a96[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x3e5a96[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x3b0465,null))[_0x5dbf('0xb')](handleError(_0x3b0465,null));};exports[_0x5dbf('0x4a')]=function(_0x13c8ab,_0x2997a8){return respondWithRpcPromise('WhatsappQueues',_0x13c8ab['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x2997a8,null))[_0x5dbf('0xb')](handleError(_0x2997a8,null));};exports[_0x5dbf('0x4b')]=function(_0x110713,_0xc000ee){return respondWithRpcPromise(_0x5dbf('0x4c'),_0x110713[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](findById(_0x110713[_0x5dbf('0x16')]['id']))['then'](respondWithResult(_0xc000ee,null))['catch'](handleError(_0xc000ee,null));};exports['faxQueues']=function(_0x4f4aa3,_0x408b51){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x4f4aa3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x408b51,null))[_0x5dbf('0xb')](handleError(_0x408b51,null));};exports[_0x5dbf('0x4e')]=function(_0x5331ff,_0x5bb990){return respondWithRpcPromise(_0x5dbf('0x4d'),_0x5331ff[_0x5dbf('0x18')],routingClient)['then'](findById(_0x5331ff[_0x5dbf('0x16')]['id']))[_0x5dbf('0x8')](respondWithResult(_0x5bb990,null))[_0x5dbf('0xb')](handleError(_0x5bb990,null));};exports[_0x5dbf('0x4f')]=function(_0x569d9c,_0x431f08){return respondWithRpcPromise(_0x5dbf('0x50'),_0x569d9c[_0x5dbf('0x18')])[_0x5dbf('0x8')](respondWithResult(_0x431f08,null))[_0x5dbf('0xb')](handleError(_0x431f08,null));};exports['chatQueuesWaitingInteractions']=function(_0x42478c,_0x3fce29){return respondWithRpcPromise(_0x5dbf('0x51'),_0x42478c[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x3fce29,null))[_0x5dbf('0xb')](handleError(_0x3fce29,null));};exports['mailQueuesWaitingInteractions']=function(_0x2ba37f,_0x118e56){return respondWithRpcPromise(_0x5dbf('0x52'),_0x2ba37f['query'],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x118e56,null))[_0x5dbf('0xb')](handleError(_0x118e56,null));};exports[_0x5dbf('0x53')]=function(_0x1270f3,_0x50db0b){return respondWithRpcPromise(_0x5dbf('0x54'),_0x1270f3[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x50db0b,null))[_0x5dbf('0xb')](handleError(_0x50db0b,null));};exports[_0x5dbf('0x55')]=function(_0xf84095,_0x560d62){return respondWithRpcPromise(_0x5dbf('0x54'),_0xf84095[_0x5dbf('0x18')],routingClient)['then'](function(_0x30469c){if(_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')]!==undefined){var _0x3457de=_(_0x30469c[_0x5dbf('0x12')])[_0x5dbf('0x57')]([_0xf84095[_0x5dbf('0x18')][_0x5dbf('0x56')],_0xf84095[_0x5dbf('0x16')]['id']])[_0x5dbf('0x58')](_0x5dbf('0x59'))[_0x5dbf('0x5a')]()[_0x5dbf('0x5b')]();return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x37c1a3){return _0x3457de['indexOf'](_0x37c1a3[_0x5dbf('0x59')])>-0x1;});}else{return _0x30469c[_0x5dbf('0x12')][_0x5dbf('0x57')](function(_0x2e7115){return _0x2e7115['queue_id']===parseInt(_0xf84095[_0x5dbf('0x16')]['id']);});}})[_0x5dbf('0x8')](respondWithResult(_0x560d62,null))[_0x5dbf('0xb')](handleError(_0x560d62,null));};exports[_0x5dbf('0x5c')]=function(_0x1ccdae,_0x525930){return respondWithRpcPromise(_0x5dbf('0x5d'),_0x1ccdae[_0x5dbf('0x18')],routingClient)['then'](respondWithResult(_0x525930,null))['catch'](handleError(_0x525930,null));};exports[_0x5dbf('0x5e')]=function(_0x39c0a7,_0x1efe3f){return respondWithRpcPromise(_0x5dbf('0x5f'),_0x39c0a7[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x1efe3f,null))[_0x5dbf('0xb')](handleError(_0x1efe3f,null));};exports['faxQueuesWaitingInteractions']=function(_0x310078,_0x3b01c0){return respondWithRpcPromise(_0x5dbf('0x60'),_0x310078[_0x5dbf('0x18')],routingClient)[_0x5dbf('0x8')](respondWithResult(_0x3b01c0,null))[_0x5dbf('0xb')](handleError(_0x3b01c0,null));};exports['queueNotify']=function(_0x625875){return function(_0x2a0c11,_0x43ca42){var _0x2c5a6e,_0x255ab0;var _0x5a27d2=_[_0x5dbf('0x61')](_0x625875);var _0x550bd1=_0x625875==='chat'?'Website':'Account';return db[_0x5a27d2+_0x5dbf('0x62')][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x2a0c11[_0x5dbf('0x16')]['id']}})[_0x5dbf('0x8')](function(_0x4333db){if(_['isNil'](_0x4333db)){throw new Error(_0x5a27d2+'\x20Queue\x20not\x20found');}_0x2c5a6e=_0x4333db;return db[_0x5a27d2+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x2a0c11[_0x5dbf('0x1e')][_0x5dbf('0x65')]},'include':[{'model':db[_0x5a27d2+'Interaction'],'as':_0x5dbf('0x66')},{'model':db[_0x5a27d2+_0x550bd1],'as':'Account'}]});})[_0x5dbf('0x8')](function(_0x24d90a){if(_[_0x5dbf('0x11')](_0x24d90a)){throw new Error(_0x5a27d2+_0x5dbf('0x67'));}_0x255ab0=_0x24d90a;return _0x24d90a[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x22b520={'uniqueid':_0x625875+'.'+_0x255ab0['id']+'.'+_0x255ab0[_0x5dbf('0x66')]['id'],'FromUserId':_0x2a0c11[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69')};_0x22b520[_0x5a27d2+'MessageId']=_0x255ab0['id'];_0x22b520[_0x5a27d2+_0x5dbf('0x6a')]=_0x255ab0[_0x5dbf('0x66')]['id'];_0x22b520[_0x5dbf('0x6b')+_0x5a27d2+_0x550bd1+'Id']=_0x255ab0[_0x5dbf('0x6c')]['id'];_0x22b520['To'+_0x5a27d2+_0x5dbf('0x6d')]=_0x2c5a6e['id'];return db[_0x5a27d2+_0x5dbf('0x6e')][_0x5dbf('0x6f')](_0x22b520);})[_0x5dbf('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x625875,'interaction':_0x255ab0['Interaction'],'message':_0x255ab0,'account':_0x255ab0[_0x5dbf('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x69'),'appdata':_0x2c5a6e[_0x5dbf('0xf')]+','+(_0x255ab0['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x43ca42,null))[_0x5dbf('0xb')](handleError(_0x43ca42,null));};};exports[_0x5dbf('0x70')]=function(_0x4713b4,_0x12757d){var _0x13fcf5,_0x5ba5bb;if(_[_0x5dbf('0x11')](_0x4713b4[_0x5dbf('0x1e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x289cc1=_0x4713b4['body']['channel'];var _0x3a27c4=_[_0x5dbf('0x61')](_0x289cc1);var _0x3722b9=_0x289cc1==='chat'?_0x5dbf('0x71'):_0x5dbf('0x6c');return db['User'][_0x5dbf('0x63')]({'raw':!![],'where':{'id':_0x4713b4[_0x5dbf('0x16')]['id'],'role':_0x5dbf('0x34')}})[_0x5dbf('0x8')](function(_0x7957cb){if(_[_0x5dbf('0x11')](_0x7957cb)){throw new Error(_0x5dbf('0x72'));}_0x13fcf5=_0x7957cb;return db[_0x3a27c4+_0x5dbf('0x64')]['findOne']({'where':{'id':_0x4713b4['body']['messageId']},'include':[{'model':db[_0x3a27c4+_0x5dbf('0x66')],'as':_0x5dbf('0x66')},{'model':db[_0x3a27c4+_0x3722b9],'as':_0x5dbf('0x6c')}]});})[_0x5dbf('0x8')](function(_0x400d98){if(_[_0x5dbf('0x11')](_0x400d98)){throw new Error(_0x3a27c4+_0x5dbf('0x67'));}_0x5ba5bb=_0x400d98;return _0x400d98[_0x5dbf('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5dbf('0x8')](function(){var _0x990814={'uniqueid':_0x289cc1+'.'+_0x5ba5bb['id']+'.'+_0x5ba5bb['Interaction']['id'],'FromUserId':_0x4713b4[_0x5dbf('0x2b')]['id'],'type':_0x5dbf('0x69'),'ToUserId':_0x13fcf5['id']};_0x990814[_0x3a27c4+_0x5dbf('0x73')]=_0x5ba5bb['id'];_0x990814[_0x3a27c4+_0x5dbf('0x6a')]=_0x5ba5bb[_0x5dbf('0x66')]['id'];_0x990814[_0x5dbf('0x6b')+_0x3a27c4+_0x3722b9+'Id']=_0x5ba5bb[_0x5dbf('0x6c')]['id'];return db[_0x3a27c4+_0x5dbf('0x6e')]['create'](_0x990814);})['then'](function(){return respondWithRpcPromise(_0x5dbf('0x74'),{'channel':_0x289cc1,'interaction':_0x5ba5bb['Interaction'],'message':_0x5ba5bb,'account':_0x5ba5bb['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5dbf('0x34'),'appdata':_0x13fcf5['name']+','+(_0x5ba5bb['Account']['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x5dbf('0x8')](respondWithResult(_0x12757d,null))['catch'](handleError(_0x12757d,null));}; \ No newline at end of file +var _0x3eea=['whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','Account','QueueId','TransferReport','create','Start','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','then','error','code','message','catch','status','sendStatus','stack','name','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','Agents','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','format','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x39c549,_0x340d69){_0x39c549=_0x39c549-0x0;var _0x6ab579=_0x3eea[_0x39c549];return _0x6ab579;};'use strict';var BPromise=require(_0xa3ee('0x0'));var moment=require('moment');var _=require(_0xa3ee('0x1'));var util=require(_0xa3ee('0x2'));var db=require(_0xa3ee('0x3'))['db'];var logger=require(_0xa3ee('0x4'))(_0xa3ee('0x5'));var jayson=require(_0xa3ee('0x6'));var amiClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232a});var mailClient=jayson[_0xa3ee('0x7')][_0xa3ee('0x8')]({'port':0x232b});var routingClient=jayson[_0xa3ee('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x538bf9,_0x4183ee,_0x4e4588){return new BPromise(function(_0x37a3f0,_0x56f37b){var _0x1eeb5b=_0x4e4588?_0x4e4588:amiClient;return _0x1eeb5b['request'](_0x538bf9,_0x4183ee)[_0xa3ee('0x9')](function(_0x5ef236){if(_0x5ef236[_0xa3ee('0xa')]){if(_0x5ef236[_0xa3ee('0xa')][_0xa3ee('0xb')]===0x1f4){return _0x56f37b(_0x5ef236['error'][_0xa3ee('0xc')]);}return _0x37a3f0(_0x5ef236[_0xa3ee('0xa')]['message']);}else{_0x37a3f0(_0x5ef236['result']);}})[_0xa3ee('0xd')](function(_0x30e652){_0x56f37b(_0x30e652);});});}function respondWithResult(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xc8;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0xe')](_0x4363d1)['json'](_0x594c88);}return _0x403518[_0xa3ee('0xf')](0x194);};}function handleError(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0x1f4;return function(_0x150e20){logger['error'](_0x150e20[_0xa3ee('0x10')]);if(_0x150e20[_0xa3ee('0x11')]){delete _0x150e20['name'];}_0x20535f['status'](_0x2c34cf)['send'](_0x150e20);};}function findById(_0x40decb){return function(_0x7277cd){if(!_[_0xa3ee('0x12')](_0x40decb)&&!_[_0xa3ee('0x12')](_0x7277cd)&&!_['isNil'](_0x7277cd[_0xa3ee('0x13')])){return _[_0xa3ee('0x14')](_0x7277cd[_0xa3ee('0x13')],function(_0x299b1e){return _0x299b1e['id']==_0x40decb;});}return null;};}exports[_0xa3ee('0x15')]=function(_0x4aac0e,_0x377b9d){return respondWithRpcPromise(_0xa3ee('0x16'),_0x4aac0e[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x377b9d,null))[_0xa3ee('0xd')](handleError(_0x377b9d,null));};exports[_0xa3ee('0x18')]=function(_0x4f8c56,_0x3f5d70){return respondWithRpcPromise(_0xa3ee('0x19'),_['merge'](_0x4f8c56[_0xa3ee('0x17')],_0x4f8c56['params']))[_0xa3ee('0x9')](respondWithResult(_0x3f5d70,null))[_0xa3ee('0xd')](handleError(_0x3f5d70,null));};exports[_0xa3ee('0x1a')]=function(_0x1bd196,_0x60b899){return respondWithRpcPromise(_0xa3ee('0x1b'),_[_0xa3ee('0x1c')](_0x1bd196[_0xa3ee('0x17')],_0x1bd196[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x60b899,null))['catch'](handleError(_0x60b899,null));};exports[_0xa3ee('0x1e')]=function(_0x1dca29,_0x157071){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x1dca29[_0xa3ee('0x17')])['then'](respondWithResult(_0x157071,null))[_0xa3ee('0xd')](handleError(_0x157071,null));};exports[_0xa3ee('0x20')]=function(_0x146493,_0xd9a7f8){return respondWithRpcPromise(_0xa3ee('0x1f'),_0x146493[_0xa3ee('0x17')])[_0xa3ee('0x9')](findById(_0x146493[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0xd9a7f8,null))[_0xa3ee('0xd')](handleError(_0xd9a7f8,null));};exports['updateVoiceQueue']=function(_0x5ba571,_0x4abf49){return respondWithRpcPromise(_0xa3ee('0x21'),_['merge'](_0x5ba571[_0xa3ee('0x22')],_0x5ba571[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x4abf49,null))[_0xa3ee('0xd')](handleError(_0x4abf49,null));};exports[_0xa3ee('0x23')]=function(_0x14547d,_0x30ba4e){return respondWithRpcPromise(_0xa3ee('0x24'),_[_0xa3ee('0x1c')](_0x14547d[_0xa3ee('0x17')],_0x14547d['params']))[_0xa3ee('0x9')](respondWithResult(_0x30ba4e,null))['catch'](handleError(_0x30ba4e,null));};exports[_0xa3ee('0x25')]=function(_0x332d61,_0x496839){return respondWithRpcPromise(_0xa3ee('0x26'),_0x332d61['query'])[_0xa3ee('0x9')](respondWithResult(_0x496839,null))['catch'](handleError(_0x496839,null));};exports[_0xa3ee('0x27')]=function(_0x299099,_0x2f803c){return respondWithRpcPromise(_0xa3ee('0x28'),_[_0xa3ee('0x1c')](_0x299099['query'],_0x299099[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x2f803c,null))[_0xa3ee('0xd')](handleError(_0x2f803c,null));};exports['voiceQueuesChannelHangup']=function(_0x1599e4,_0x531f58){return respondWithRpcPromise(_0xa3ee('0x29'),_['merge'](_0x1599e4[_0xa3ee('0x17')],_0x1599e4['params']))[_0xa3ee('0x9')](respondWithResult(_0x531f58,null))[_0xa3ee('0xd')](handleError(_0x531f58,null));};exports[_0xa3ee('0x2a')]=function(_0x45be9b,_0x1717ba){return respondWithRpcPromise(_0xa3ee('0x2b'),_[_0xa3ee('0x1c')](_0x45be9b[_0xa3ee('0x17')],_0x45be9b[_0xa3ee('0x1d')]))[_0xa3ee('0x9')](respondWithResult(_0x1717ba,null))[_0xa3ee('0xd')](handleError(_0x1717ba,null));};exports[_0xa3ee('0x2c')]=function(_0x447efd,_0x595b55){return respondWithRpcPromise(_0xa3ee('0x2d'),_0x447efd[_0xa3ee('0x17')])[_0xa3ee('0x9')](respondWithResult(_0x595b55,null))[_0xa3ee('0xd')](handleError(_0x595b55,null));};exports['outboundChannels']=function(_0x257627,_0x11a721){return respondWithRpcPromise(_0xa3ee('0x2e'),_0x257627['query'])[_0xa3ee('0x9')](respondWithResult(_0x11a721,null))[_0xa3ee('0xd')](handleError(_0x11a721,null));};exports['agents']=function(_0x319c26,_0x3ecbe6){var _0x4ef99a;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')])[_0xa3ee('0x9')](function(_0x2c8873){_0x4ef99a=_0x2c8873;return respondWithRpcPromise(_0xa3ee('0x2f'),_0x319c26[_0xa3ee('0x17')],routingClient);})[_0xa3ee('0x9')](function(_0x3e0eec){return _[_0xa3ee('0x1c')]({},_0x3e0eec,_0x4ef99a);})[_0xa3ee('0x9')](respondWithResult(_0x3ecbe6,null))[_0xa3ee('0xd')](handleError(_0x3ecbe6,null));};exports['agentCapacity']=function(_0x5aa4b3,_0x548534){if(_0x5aa4b3[_0xa3ee('0x22')]&&_0x5aa4b3[_0xa3ee('0x22')]['interaction']&&_0x5aa4b3[_0xa3ee('0x30')]&&_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]){for(var _0x55f47f in _0x5aa4b3[_0xa3ee('0x22')]['interaction']){if(_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0xa3ee('0x32')](_0x55f47f)){db[_0xa3ee('0x33')][_0xa3ee('0x34')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'exitAt':null,'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]&&_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')]?{'$notIn':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f]}:{'$ne':null}}})[_0xa3ee('0x9')](function(_0x25e0fe){var _0x4594e1=moment()['format'](_0xa3ee('0x37'));for(var _0xdca412=0x0,_0x112e80=_0x25e0fe[_0xa3ee('0x36')];_0xdca412<_0x112e80;_0xdca412+=0x1){_0x25e0fe[_0xdca412]['updateAttributes']({'exitAt':_0x4594e1});}});for(var _0x30fcf1=0x0;_0x30fcf1<_0x5aa4b3['body'][_0xa3ee('0x31')][_0x55f47f][_0xa3ee('0x36')];_0x30fcf1+=0x1){db[_0xa3ee('0x33')][_0xa3ee('0x38')]({'where':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')],'type':_0xa3ee('0x35'),'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1],'exitAt':null},'defaults':{'channel':_0x55f47f,'membername':_0x5aa4b3[_0xa3ee('0x30')]['name'],'interface':_[_0xa3ee('0x12')](_0x5aa4b3['user']['interface'])?util[_0xa3ee('0x39')](_0xa3ee('0x3a'),_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x11')]):_0x5aa4b3[_0xa3ee('0x30')][_0xa3ee('0x3b')],'type':_0xa3ee('0x35'),'enterAt':moment()['format'](_0xa3ee('0x37')),'role':_0xa3ee('0x3c'),'internal':_0x5aa4b3['user'][_0xa3ee('0x3d')],'uniqueid':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x31')][_0x55f47f][_0x30fcf1]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5aa4b3['params']['id'],'capacity':_0x5aa4b3[_0xa3ee('0x22')][_0xa3ee('0x3e')]},routingClient)[_0xa3ee('0x9')](respondWithResult(_0x548534,null))[_0xa3ee('0xd')](handleError(_0x548534,null));};exports[_0xa3ee('0x3f')]=function(_0x57e654,_0x55678e){return respondWithRpcPromise(_0xa3ee('0x40'),_0x57e654[_0xa3ee('0x17')])['then'](respondWithResult(_0x55678e,null))[_0xa3ee('0xd')](handleError(_0x55678e,null));};exports[_0xa3ee('0x41')]=function(_0x13cd8b,_0x579ec8){return respondWithRpcPromise('Trunks',_0x13cd8b[_0xa3ee('0x17')])['then'](respondWithResult(_0x579ec8,null))[_0xa3ee('0xd')](handleError(_0x579ec8,null));};exports[_0xa3ee('0x42')]=function(_0x5b8e79,_0x4232e0){return respondWithRpcPromise(_0xa3ee('0x43'),_0x5b8e79[_0xa3ee('0x17')])['then'](respondWithResult(_0x4232e0,null))[_0xa3ee('0xd')](handleError(_0x4232e0,null));};exports[_0xa3ee('0x44')]=function(_0x594034,_0x1d832c){return respondWithRpcPromise(_0xa3ee('0x45'),_0x594034[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x1d832c,null))['catch'](handleError(_0x1d832c,null));};exports[_0xa3ee('0x46')]=function(_0x17ac07,_0x4a1a2f){return respondWithRpcPromise(_0xa3ee('0x45'),_0x17ac07[_0xa3ee('0x17')],routingClient)['then'](findById(_0x17ac07['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x4a1a2f,null))[_0xa3ee('0xd')](handleError(_0x4a1a2f,null));};exports[_0xa3ee('0x47')]=function(_0x52b824,_0x11fb6e){return respondWithRpcPromise(_0xa3ee('0x48'),_0x52b824[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x11fb6e,null))[_0xa3ee('0xd')](handleError(_0x11fb6e,null));};exports[_0xa3ee('0x49')]=function(_0x497be4,_0x10f508){return respondWithRpcPromise(_0xa3ee('0x48'),_0x497be4['query'],routingClient)[_0xa3ee('0x9')](findById(_0x497be4[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x10f508,null))[_0xa3ee('0xd')](handleError(_0x10f508,null));};exports[_0xa3ee('0x4a')]=function(_0x330778,_0x4a2255){return respondWithRpcPromise(_0xa3ee('0x4b'),_0x330778[_0xa3ee('0x17')],mailClient)[_0xa3ee('0x9')](respondWithResult(_0x4a2255,null))['catch'](handleError(_0x4a2255,null));};exports[_0xa3ee('0x4c')]=function(_0x13b81b,_0x519f10){return respondWithRpcPromise('OpenchannelQueues',_0x13b81b['query'],routingClient)['then'](respondWithResult(_0x519f10,null))[_0xa3ee('0xd')](handleError(_0x519f10,null));};exports[_0xa3ee('0x4d')]=function(_0x3adafb,_0x2f0424){return respondWithRpcPromise(_0xa3ee('0x4e'),_0x3adafb[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x3adafb['params']['id']))[_0xa3ee('0x9')](respondWithResult(_0x2f0424,null))[_0xa3ee('0xd')](handleError(_0x2f0424,null));};exports[_0xa3ee('0x4f')]=function(_0xaff641,_0x147024){return respondWithRpcPromise('SmsQueues',_0xaff641['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x147024,null))[_0xa3ee('0xd')](handleError(_0x147024,null));};exports[_0xa3ee('0x50')]=function(_0x24613d,_0x16aabe){return respondWithRpcPromise(_0xa3ee('0x51'),_0x24613d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x24613d[_0xa3ee('0x1d')]['id']))[_0xa3ee('0x9')](respondWithResult(_0x16aabe,null))[_0xa3ee('0xd')](handleError(_0x16aabe,null));};exports[_0xa3ee('0x52')]=function(_0x64f353,_0x224790){return respondWithRpcPromise(_0xa3ee('0x53'),_0x64f353['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x224790,null))['catch'](handleError(_0x224790,null));};exports['showWhatsappQueues']=function(_0x2b1c6e,_0x49daf9){return respondWithRpcPromise(_0xa3ee('0x53'),_0x2b1c6e[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](findById(_0x2b1c6e[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x49daf9,null))[_0xa3ee('0xd')](handleError(_0x49daf9,null));};exports[_0xa3ee('0x54')]=function(_0x179ae2,_0x370e3e){return respondWithRpcPromise('FaxQueues',_0x179ae2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x370e3e,null))['catch'](handleError(_0x370e3e,null));};exports[_0xa3ee('0x55')]=function(_0x52a066,_0x4f3aac){return respondWithRpcPromise(_0xa3ee('0x56'),_0x52a066['query'],routingClient)['then'](findById(_0x52a066[_0xa3ee('0x1d')]['id']))['then'](respondWithResult(_0x4f3aac,null))['catch'](handleError(_0x4f3aac,null));};exports[_0xa3ee('0x57')]=function(_0xf8689f,_0x538a9b){return respondWithRpcPromise('FaxAccounts',_0xf8689f['query'])[_0xa3ee('0x9')](respondWithResult(_0x538a9b,null))[_0xa3ee('0xd')](handleError(_0x538a9b,null));};exports[_0xa3ee('0x58')]=function(_0x7844ae,_0x389547){return respondWithRpcPromise(_0xa3ee('0x59'),_0x7844ae['query'],routingClient)['then'](respondWithResult(_0x389547,null))[_0xa3ee('0xd')](handleError(_0x389547,null));};exports[_0xa3ee('0x5a')]=function(_0x42a79e,_0x5675fb){return respondWithRpcPromise(_0xa3ee('0x5b'),_0x42a79e[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x5675fb,null))[_0xa3ee('0xd')](handleError(_0x5675fb,null));};exports[_0xa3ee('0x5c')]=function(_0x3be877,_0x2ad745){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x3be877['query'],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2ad745,null))[_0xa3ee('0xd')](handleError(_0x2ad745,null));};exports[_0xa3ee('0x5e')]=function(_0x37e1c2,_0xbfb429){return respondWithRpcPromise(_0xa3ee('0x5d'),_0x37e1c2[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](function(_0x448f14){if(_0x37e1c2['query']['type']!==undefined){var _0x228671=_(_0x448f14['rows'])[_0xa3ee('0x5f')]([_0x37e1c2[_0xa3ee('0x17')][_0xa3ee('0x60')],_0x37e1c2[_0xa3ee('0x1d')]['id']])['map'](_0xa3ee('0x61'))[_0xa3ee('0x62')]()[_0xa3ee('0x63')]();return _0x448f14[_0xa3ee('0x13')][_0xa3ee('0x5f')](function(_0x4e9473){return _0x228671[_0xa3ee('0x64')](_0x4e9473[_0xa3ee('0x61')])>-0x1;});}else{return _0x448f14[_0xa3ee('0x13')]['filter'](function(_0x3ca523){return _0x3ca523['queue_id']===parseInt(_0x37e1c2[_0xa3ee('0x1d')]['id']);});}})['then'](respondWithResult(_0xbfb429,null))[_0xa3ee('0xd')](handleError(_0xbfb429,null));};exports[_0xa3ee('0x65')]=function(_0x119c3d,_0x140ee0){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x119c3d[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x140ee0,null))['catch'](handleError(_0x140ee0,null));};exports[_0xa3ee('0x66')]=function(_0xa82482,_0x44b084){return respondWithRpcPromise(_0xa3ee('0x67'),_0xa82482[_0xa3ee('0x17')],routingClient)['then'](respondWithResult(_0x44b084,null))[_0xa3ee('0xd')](handleError(_0x44b084,null));};exports[_0xa3ee('0x68')]=function(_0x55a6b7,_0x2535ef){return respondWithRpcPromise(_0xa3ee('0x69'),_0x55a6b7[_0xa3ee('0x17')],routingClient)[_0xa3ee('0x9')](respondWithResult(_0x2535ef,null))[_0xa3ee('0xd')](handleError(_0x2535ef,null));};exports[_0xa3ee('0x6a')]=function(_0x31d3ca){return function(_0x329e32,_0x37bde3){var _0x25334c,_0x4f7ace;var _0x21fd56=_[_0xa3ee('0x6b')](_0x31d3ca);var _0x26a124=_0x31d3ca==='chat'?_0xa3ee('0x6c'):'Account';return db[_0x21fd56+_0xa3ee('0x6d')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x329e32['params']['id']}})[_0xa3ee('0x9')](function(_0x44f27b){if(_['isNil'](_0x44f27b)){throw new Error(_0x21fd56+_0xa3ee('0x6f'));}_0x25334c=_0x44f27b;return db[_0x21fd56+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x329e32[_0xa3ee('0x22')][_0xa3ee('0x71')]},'include':[{'model':db[_0x21fd56+_0xa3ee('0x72')],'as':'Interaction'},{'model':db[_0x21fd56+_0x26a124],'as':'Account'}]});})['then'](function(_0x27454a){if(_['isNil'](_0x27454a)){throw new Error(_0x21fd56+_0xa3ee('0x73'));}_0x4f7ace=_0x27454a;return _0x27454a[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x312ad8={'uniqueid':_0x31d3ca+'.'+_0x4f7ace['id']+'.'+_0x4f7ace[_0xa3ee('0x72')]['id'],'FromUserId':_0x329e32[_0xa3ee('0x30')]['id'],'type':_0xa3ee('0x75')};_0x312ad8[_0x21fd56+_0xa3ee('0x76')]=_0x4f7ace['id'];_0x312ad8[_0x21fd56+_0xa3ee('0x77')]=_0x4f7ace[_0xa3ee('0x72')]['id'];_0x312ad8[_0xa3ee('0x78')+_0x21fd56+_0x26a124+'Id']=_0x4f7ace[_0xa3ee('0x79')]['id'];_0x312ad8['To'+_0x21fd56+_0xa3ee('0x7a')]=_0x25334c['id'];return db[_0x21fd56+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x312ad8);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x31d3ca,'interaction':_0x4f7ace[_0xa3ee('0x72')],'message':_0x4f7ace,'account':_0x4f7ace[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x25334c[_0xa3ee('0x11')]+','+(_0x4f7ace[_0xa3ee('0x79')][_0xa3ee('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x37bde3,null))[_0xa3ee('0xd')](handleError(_0x37bde3,null));};};exports[_0xa3ee('0x7f')]=function(_0x591bfa,_0x5b53f1){var _0x24cbc9,_0x157436;if(_[_0xa3ee('0x12')](_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')])){throw new Error(_0xa3ee('0x81'));}var _0x18a74b=_0x591bfa[_0xa3ee('0x22')][_0xa3ee('0x80')];var _0x3e6657=_[_0xa3ee('0x6b')](_0x18a74b);var _0x3236b3=_0x18a74b===_0xa3ee('0x82')?'Website':_0xa3ee('0x79');return db[_0xa3ee('0x83')][_0xa3ee('0x6e')]({'raw':!![],'where':{'id':_0x591bfa[_0xa3ee('0x1d')]['id'],'role':_0xa3ee('0x3c')}})[_0xa3ee('0x9')](function(_0x4cc5e5){if(_['isNil'](_0x4cc5e5)){throw new Error(_0xa3ee('0x84'));}_0x24cbc9=_0x4cc5e5;return db[_0x3e6657+_0xa3ee('0x70')][_0xa3ee('0x6e')]({'where':{'id':_0x591bfa['body'][_0xa3ee('0x71')]},'include':[{'model':db[_0x3e6657+'Interaction'],'as':_0xa3ee('0x72')},{'model':db[_0x3e6657+_0x3236b3],'as':_0xa3ee('0x79')}]});})[_0xa3ee('0x9')](function(_0x10ec99){if(_[_0xa3ee('0x12')](_0x10ec99)){throw new Error(_0x3e6657+_0xa3ee('0x73'));}_0x157436=_0x10ec99;return _0x10ec99[_0xa3ee('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xa3ee('0x9')](function(){var _0x116de1={'uniqueid':_0x18a74b+'.'+_0x157436['id']+'.'+_0x157436[_0xa3ee('0x72')]['id'],'FromUserId':_0x591bfa['user']['id'],'type':'queue','ToUserId':_0x24cbc9['id']};_0x116de1[_0x3e6657+'MessageId']=_0x157436['id'];_0x116de1[_0x3e6657+_0xa3ee('0x77')]=_0x157436['Interaction']['id'];_0x116de1[_0xa3ee('0x78')+_0x3e6657+_0x3236b3+'Id']=_0x157436[_0xa3ee('0x79')]['id'];return db[_0x3e6657+_0xa3ee('0x7b')][_0xa3ee('0x7c')](_0x116de1);})[_0xa3ee('0x9')](function(){return respondWithRpcPromise(_0xa3ee('0x7d'),{'channel':_0x18a74b,'interaction':_0x157436[_0xa3ee('0x72')],'message':_0x157436,'account':_0x157436[_0xa3ee('0x79')],'applications':[{'id':0x0,'priority':0x1,'app':_0xa3ee('0x3c'),'appdata':_0x24cbc9['name']+','+(_0x157436['Account'][_0xa3ee('0x85')]||0x12c),'interval':_0xa3ee('0x86')}]},routingClient);})[_0xa3ee('0x9')](respondWithResult(_0x5b53f1,null))[_0xa3ee('0xd')](handleError(_0x5b53f1,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d41145c..1a7b368 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 _0xad6d=['delete','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','create','put','update'];(function(_0x4f5bdf,_0x11b1e2){var _0x2218d1=function(_0x15c84f){while(--_0x15c84f){_0x4f5bdf['push'](_0x4f5bdf['shift']());}};_0x2218d1(++_0x11b1e2);}(_0xad6d,0x78));var _0xdad6=function(_0x1ebeae,_0xbc413a){_0x1ebeae=_0x1ebeae-0x0;var _0x3a83c4=_0xad6d[_0x1ebeae];return _0x3a83c4;};'use strict';var multer=require('multer');var util=require(_0xdad6('0x0'));var path=require('path');var timeout=require(_0xdad6('0x1'));var express=require(_0xdad6('0x2'));var router=express[_0xdad6('0x3')]();var fs_extra=require(_0xdad6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdad6('0x5'));var config=require(_0xdad6('0x6'));var controller=require('./schedule.controller');router[_0xdad6('0x7')]('/',auth[_0xdad6('0x8')](),controller['index']);router[_0xdad6('0x7')](_0xdad6('0x9'),auth['isAuthenticated'](),controller[_0xdad6('0xa')]);router['get'](_0xdad6('0xb'),auth[_0xdad6('0x8')](),controller[_0xdad6('0xc')]);router['post']('/',auth[_0xdad6('0x8')](),controller[_0xdad6('0xd')]);router[_0xdad6('0xe')](_0xdad6('0x9'),auth[_0xdad6('0x8')](),controller[_0xdad6('0xf')]);router[_0xdad6('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19a8=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x19a8,0x172));var _0x819a=function(_0x149056,_0x1c26ef){_0x149056=_0x149056-0x0;var _0x1606cc=_0x19a8[_0x149056];return _0x1606cc;};'use strict';var multer=require(_0x819a('0x0'));var util=require(_0x819a('0x1'));var path=require(_0x819a('0x2'));var timeout=require(_0x819a('0x3'));var express=require('express');var router=express[_0x819a('0x4')]();var fs_extra=require(_0x819a('0x5'));var auth=require(_0x819a('0x6'));var interaction=require(_0x819a('0x7'));var config=require(_0x819a('0x8'));var controller=require('./schedule.controller');router[_0x819a('0x9')]('/',auth[_0x819a('0xa')](),controller[_0x819a('0xb')]);router[_0x819a('0x9')](_0x819a('0xc'),auth[_0x819a('0xa')](),controller[_0x819a('0xd')]);router[_0x819a('0x9')](_0x819a('0xe'),auth['isAuthenticated'](),controller[_0x819a('0xf')]);router[_0x819a('0x10')]('/',auth['isAuthenticated'](),controller[_0x819a('0x11')]);router[_0x819a('0x12')](_0x819a('0xc'),auth[_0x819a('0xa')](),controller['update']);router[_0x819a('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x819a('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 95ede65..c3fdd92 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 _0xd1cf=['default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','weeks','days','hours','csv','custom'];(function(_0xe40d82,_0x528005){var _0xe20444=function(_0x5b4f73){while(--_0x5b4f73){_0xe40d82['push'](_0xe40d82['shift']());}};_0xe20444(++_0x528005);}(_0xd1cf,0x1e2));var _0xfd1c=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0xd1cf[_0x1c0f3d];return _0x4d71a8;};'use strict';var Sequelize=require(_0xfd1c('0x0'));module[_0xfd1c('0x1')]={'name':{'type':Sequelize[_0xfd1c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xfd1c('0x2')]},'active':{'type':Sequelize[_0xfd1c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xfd1c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xfd1c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xfd1c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xfd1c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xfd1c('0x6')](_0xfd1c('0x7'),'quarters','months',_0xfd1c('0x8'),_0xfd1c('0x9'),_0xfd1c('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xfd1c('0x9')},'output':{'type':Sequelize['ENUM'](_0xfd1c('0xb'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xfd1c('0xb')},'type':{'type':Sequelize[_0xfd1c('0x6')](_0xfd1c('0xc'),_0xfd1c('0xd')),'allowNull':![],'defaultValue':_0xfd1c('0xc')},'sendMail':{'type':Sequelize[_0xfd1c('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xfd1c('0xe')]},'bcc':{'type':Sequelize[_0xfd1c('0xe')]},'sendIfEmpty':{'type':Sequelize[_0xfd1c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xef9d=['minutes','ENUM','csv','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','hours'];(function(_0x2afc7b,_0x33dda7){var _0x391ef4=function(_0x3d906d){while(--_0x3d906d){_0x2afc7b['push'](_0x2afc7b['shift']());}};_0x391ef4(++_0x33dda7);}(_0xef9d,0x1e7));var _0xdef9=function(_0x11da22,_0x5e0518){_0x11da22=_0x11da22-0x0;var _0x3fb326=_0xef9d[_0x11da22];return _0x3fb326;};'use strict';var Sequelize=require(_0xdef9('0x0'));module[_0xdef9('0x1')]={'name':{'type':Sequelize[_0xdef9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdef9('0x2')]},'active':{'type':Sequelize[_0xdef9('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdef9('0x2')],'allowNull':![],'defaultValue':_0xdef9('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xdef9('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdef9('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xdef9('0x7'),_0xdef9('0x8'),_0xdef9('0x9'),_0xdef9('0xa'),_0xdef9('0xb'),_0xdef9('0xc'),_0xdef9('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdef9('0xe')](_0xdef9('0xf'),'pdf',_0xdef9('0x10')),'allowNull':![],'defaultValue':_0xdef9('0xf')},'type':{'type':Sequelize['ENUM']('custom',_0xdef9('0x11')),'allowNull':![],'defaultValue':_0xdef9('0x12')},'sendMail':{'type':Sequelize[_0xdef9('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdef9('0x13')]},'bcc':{'type':Sequelize[_0xdef9('0x13')]},'sendIfEmpty':{'type':Sequelize[_0xdef9('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 f15c63e..f84d75d 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 _0x2882=['crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','index','Schedule','rawAttributes','fieldName','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel'];(function(_0xcd40a7,_0x58e78d){var _0x336808=function(_0x198feb){while(--_0x198feb){_0xcd40a7['push'](_0xcd40a7['shift']());}};_0x336808(++_0x58e78d);}(_0x2882,0xe6));var _0x2288=function(_0xde54f3,_0x3b3afa){_0xde54f3=_0xde54f3-0x0;var _0x465cc3=_0x2882[_0xde54f3];return _0x465cc3;};'use strict';var emlformat=require(_0x2288('0x0'));var rimraf=require(_0x2288('0x1'));var zipdir=require(_0x2288('0x2'));var jsonpatch=require(_0x2288('0x3'));var rp=require(_0x2288('0x4'));var moment=require(_0x2288('0x5'));var BPromise=require(_0x2288('0x6'));var Mustache=require('mustache');var util=require(_0x2288('0x7'));var path=require(_0x2288('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2288('0x9'));var fs=require('fs');var fs_extra=require(_0x2288('0xa'));var _=require(_0x2288('0xb'));var squel=require(_0x2288('0xc'));var crypto=require(_0x2288('0xd'));var jsforce=require(_0x2288('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2288('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2288('0x10'));var authService=require(_0x2288('0x11'));var qs=require(_0x2288('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2288('0x13'));var logger=require(_0x2288('0x14'))(_0x2288('0x15'));var utils=require(_0x2288('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2288('0x17'))['db'];function respondWithStatusCode(_0xe05ac6,_0x467be5){_0x467be5=_0x467be5||0xcc;return function(_0x2f50af){if(_0x2f50af){return _0xe05ac6[_0x2288('0x18')](_0x467be5);}return _0xe05ac6[_0x2288('0x19')](_0x467be5)[_0x2288('0x1a')]();};}function respondWithResult(_0x1076a2,_0x216856){_0x216856=_0x216856||0xc8;return function(_0x8c9a45){if(_0x8c9a45){return _0x1076a2['status'](_0x216856)[_0x2288('0x1b')](_0x8c9a45);}};}function respondWithFilteredResult(_0xa7adc8,_0x369970){return function(_0x25241f){if(_0x25241f){var _0x22747c=typeof _0x369970[_0x2288('0x1c')]===_0x2288('0x1d')&&typeof _0x369970[_0x2288('0x1e')]===_0x2288('0x1d');var _0x647e1a=_0x25241f[_0x2288('0x1f')];var _0x28da36=_0x22747c?0x0:_0x369970['offset'];var _0x2dd807=_0x22747c?_0x25241f[_0x2288('0x1f')]:_0x369970[_0x2288('0x1c')]+_0x369970[_0x2288('0x1e')];var _0x509b5e;if(_0x2dd807>=_0x647e1a){_0x2dd807=_0x647e1a;_0x509b5e=0xc8;}else{_0x509b5e=0xce;}_0xa7adc8[_0x2288('0x19')](_0x509b5e);return _0xa7adc8['set'](_0x2288('0x20'),_0x28da36+'-'+_0x2dd807+'/'+_0x647e1a)[_0x2288('0x1b')](_0x25241f);}return null;};}function patchUpdates(_0x20e49c){return function(_0x5c9421){try{jsonpatch[_0x2288('0x21')](_0x5c9421,_0x20e49c,!![]);}catch(_0x473668){return BPromise[_0x2288('0x22')](_0x473668);}return _0x5c9421[_0x2288('0x23')]();};}function saveUpdates(_0x50e0d7,_0x8d6faa){return function(_0x360d3f){if(_0x360d3f){return _0x360d3f[_0x2288('0x24')](_0x50e0d7)[_0x2288('0x25')](function(_0x5d84ea){return _0x5d84ea;});}return null;};}function removeEntity(_0xd73445,_0x25e60c){return function(_0x2317b1){if(_0x2317b1){return _0x2317b1[_0x2288('0x26')]()[_0x2288('0x25')](function(){var _0x3f549c=_0x2317b1[_0x2288('0x27')]({'plain':!![]});var _0x19d71c=_0x2288('0x28');return db[_0x2288('0x29')][_0x2288('0x26')]({'where':{'type':_0x19d71c,'resourceId':_0x3f549c['id']}})['then'](function(){return _0x2317b1;});})[_0x2288('0x25')](function(){_0xd73445[_0x2288('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b6163,_0x2c6ae4){return function(_0x9508a){if(!_0x9508a){_0x3b6163[_0x2288('0x18')](0x194);}return _0x9508a;};}function handleError(_0x2edf4d,_0x578d43){_0x578d43=_0x578d43||0x1f4;return function(_0x1c1407){logger[_0x2288('0x2a')](_0x1c1407[_0x2288('0x2b')]);if(_0x1c1407['name']){delete _0x1c1407[_0x2288('0x2c')];}_0x2edf4d[_0x2288('0x19')](_0x578d43)['send'](_0x1c1407);};}exports[_0x2288('0x2d')]=function(_0x13b675,_0x53a3d0){var _0x39015c={},_0x3d2648={},_0x25e9a2={'count':0x0,'rows':[]};var _0x36a093=_['map'](db[_0x2288('0x2e')][_0x2288('0x2f')],function(_0x5dedfe){return{'name':_0x5dedfe[_0x2288('0x30')],'type':_0x5dedfe['type']['key']};});_0x3d2648[_0x2288('0x31')]=_[_0x2288('0x32')](_0x36a093,_0x2288('0x2c'));_0x3d2648['query']=_[_0x2288('0x33')](_0x13b675[_0x2288('0x34')]);_0x3d2648[_0x2288('0x35')]=_[_0x2288('0x36')](_0x3d2648[_0x2288('0x31')],_0x3d2648[_0x2288('0x34')]);_0x39015c['attributes']=_[_0x2288('0x36')](_0x3d2648[_0x2288('0x31')],qs[_0x2288('0x37')](_0x13b675[_0x2288('0x34')][_0x2288('0x37')]));_0x39015c['attributes']=_0x39015c[_0x2288('0x38')][_0x2288('0x39')]?_0x39015c['attributes']:_0x3d2648[_0x2288('0x31')];if(!_0x13b675['query'][_0x2288('0x3a')](_0x2288('0x3b'))){_0x39015c[_0x2288('0x1e')]=qs[_0x2288('0x1e')](_0x13b675[_0x2288('0x34')][_0x2288('0x1e')]);_0x39015c[_0x2288('0x1c')]=qs[_0x2288('0x1c')](_0x13b675[_0x2288('0x34')][_0x2288('0x1c')]);}_0x39015c['order']=qs['sort'](_0x13b675[_0x2288('0x34')][_0x2288('0x3c')]);_0x39015c[_0x2288('0x3d')]=qs['filters'](_['pick'](_0x13b675['query'],_0x3d2648['filters']),_0x36a093);if(_0x13b675[_0x2288('0x34')][_0x2288('0x3e')]){_0x39015c[_0x2288('0x3d')]=_[_0x2288('0x3f')](_0x39015c[_0x2288('0x3d')],{'$or':_['map'](_0x36a093,function(_0x28a37f){if(_0x28a37f['type']!=='VIRTUAL'){var _0xb2812c={};_0xb2812c[_0x28a37f[_0x2288('0x2c')]]={'$like':'%'+_0x13b675[_0x2288('0x34')]['filter']+'%'};return _0xb2812c;}})});}_0x39015c=_['merge']({},_0x39015c,_0x13b675[_0x2288('0x40')]);var _0x3fb22c={'where':_0x39015c[_0x2288('0x3d')]};return db[_0x2288('0x2e')][_0x2288('0x1f')](_0x3fb22c)[_0x2288('0x25')](function(_0x5e674a){_0x25e9a2[_0x2288('0x1f')]=_0x5e674a;if(_0x13b675[_0x2288('0x34')][_0x2288('0x41')]){_0x39015c[_0x2288('0x42')]=[{'all':!![]}];}return db[_0x2288('0x2e')][_0x2288('0x43')](_0x39015c);})['then'](function(_0x55922e){_0x25e9a2[_0x2288('0x44')]=_0x55922e;return _0x25e9a2;})['then'](respondWithFilteredResult(_0x53a3d0,_0x39015c))[_0x2288('0x45')](handleError(_0x53a3d0,null));};exports[_0x2288('0x46')]=function(_0x5705f7,_0x15219e){var _0x546c8d={'raw':![],'where':{'id':_0x5705f7[_0x2288('0x47')]['id']}},_0x161bd9={};_0x161bd9[_0x2288('0x31')]=_[_0x2288('0x33')](db[_0x2288('0x2e')][_0x2288('0x2f')]);_0x161bd9[_0x2288('0x34')]=_[_0x2288('0x33')](_0x5705f7[_0x2288('0x34')]);_0x161bd9[_0x2288('0x35')]=_[_0x2288('0x36')](_0x161bd9[_0x2288('0x31')],_0x161bd9[_0x2288('0x34')]);_0x546c8d[_0x2288('0x38')]=_[_0x2288('0x36')](_0x161bd9[_0x2288('0x31')],qs[_0x2288('0x37')](_0x5705f7[_0x2288('0x34')][_0x2288('0x37')]));_0x546c8d[_0x2288('0x38')]=_0x546c8d['attributes'][_0x2288('0x39')]?_0x546c8d[_0x2288('0x38')]:_0x161bd9[_0x2288('0x31')];if(_0x5705f7[_0x2288('0x34')]['includeAll']){_0x546c8d[_0x2288('0x42')]=[{'all':!![]}];}_0x546c8d=_[_0x2288('0x3f')]({},_0x546c8d,_0x5705f7[_0x2288('0x40')]);return db[_0x2288('0x2e')][_0x2288('0x48')](_0x546c8d)['then'](handleEntityNotFound(_0x15219e,null))['then'](respondWithResult(_0x15219e,null))[_0x2288('0x45')](handleError(_0x15219e,null));};exports[_0x2288('0x49')]=function(_0x5eff46,_0x4698b3){return db[_0x2288('0x2e')][_0x2288('0x49')](_0x5eff46['body'],{})[_0x2288('0x25')](function(_0x24877a){var _0x2142c8=_0x5eff46[_0x2288('0x4a')]['get']({'plain':!![]});if(!_0x2142c8)throw new Error(_0x2288('0x4b'));if(_0x2142c8['role']==='user'){var _0x530691=_0x24877a[_0x2288('0x27')]({'plain':!![]});var _0x287255=_0x2288('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x287255,'userProfileId':_0x2142c8[_0x2288('0x4c')]},'raw':!![]})[_0x2288('0x25')](function(_0xdc6d16){if(_0xdc6d16&&_0xdc6d16['autoAssociation']===0x0){return db['UserProfileResource'][_0x2288('0x49')]({'name':_0x530691[_0x2288('0x2c')],'resourceId':_0x530691['id'],'type':_0xdc6d16['name'],'sectionId':_0xdc6d16['id']},{})[_0x2288('0x25')](function(){return _0x24877a;});}else{return _0x24877a;}})[_0x2288('0x45')](function(_0x3cd9b4){logger[_0x2288('0x2a')](_0x2288('0x4d'),_0x3cd9b4);throw _0x3cd9b4;});}return _0x24877a;})[_0x2288('0x25')](respondWithResult(_0x4698b3,0xc9))[_0x2288('0x45')](handleError(_0x4698b3,null));};exports[_0x2288('0x24')]=function(_0x5449be,_0x316893){if(_0x5449be[_0x2288('0x4e')]['id']){delete _0x5449be[_0x2288('0x4e')]['id'];}return db[_0x2288('0x2e')][_0x2288('0x48')]({'where':{'id':_0x5449be[_0x2288('0x47')]['id']}})[_0x2288('0x25')](handleEntityNotFound(_0x316893,null))[_0x2288('0x25')](saveUpdates(_0x5449be['body'],null))['then'](respondWithResult(_0x316893,null))['catch'](handleError(_0x316893,null));};exports[_0x2288('0x26')]=function(_0x241cdd,_0x5e330d){return db[_0x2288('0x2e')][_0x2288('0x48')]({'where':{'id':_0x241cdd[_0x2288('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e330d,null))[_0x2288('0x25')](removeEntity(_0x5e330d,null))[_0x2288('0x45')](handleError(_0x5e330d,null));};exports['run']=function(_0x1f51ad,_0x5aac11,_0x46fba2){var _0x1b2e98=require(_0x2288('0x4f'));return db[_0x2288('0x2e')]['find']({'where':{'id':_0x1f51ad[_0x2288('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5aac11,null))[_0x2288('0x25')](function(){_0x1b2e98[_0x2288('0x50')](_0x1f51ad[_0x2288('0x47')]['id']);})[_0x2288('0x25')](respondWithStatusCode(_0x5aac11,null))[_0x2288('0x45')](handleError(_0x5aac11,null));}; \ No newline at end of file +var _0x2676=['request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','stack','name','index','Schedule','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','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','params','run','eml-format','zip-dir','fast-json-patch'];(function(_0x58010e,_0x283c96){var _0x313a3e=function(_0x16abd6){while(--_0x16abd6){_0x58010e['push'](_0x58010e['shift']());}};_0x313a3e(++_0x283c96);}(_0x2676,0xb3));var _0x6267=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x2676[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x6267('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6267('0x1'));var jsonpatch=require(_0x6267('0x2'));var rp=require(_0x6267('0x3'));var moment=require(_0x6267('0x4'));var BPromise=require(_0x6267('0x5'));var Mustache=require('mustache');var util=require(_0x6267('0x6'));var path=require(_0x6267('0x7'));var sox=require(_0x6267('0x8'));var csv=require(_0x6267('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6267('0xa'));var _=require(_0x6267('0xb'));var squel=require(_0x6267('0xc'));var crypto=require(_0x6267('0xd'));var jsforce=require(_0x6267('0xe'));var deskjs=require(_0x6267('0xf'));var toCsv=require(_0x6267('0x9'));var querystring=require(_0x6267('0x10'));var Papa=require(_0x6267('0x11'));var Redis=require(_0x6267('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6267('0x13'));var as=require(_0x6267('0x14'));var hardwareService=require(_0x6267('0x15'));var logger=require(_0x6267('0x16'))(_0x6267('0x17'));var utils=require(_0x6267('0x18'));var config=require(_0x6267('0x19'));var licenseUtil=require(_0x6267('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x91f393,_0xebdb69){_0xebdb69=_0xebdb69||0xcc;return function(_0x2131cd){if(_0x2131cd){return _0x91f393['sendStatus'](_0xebdb69);}return _0x91f393[_0x6267('0x1b')](_0xebdb69)[_0x6267('0x1c')]();};}function respondWithResult(_0x57c167,_0x37f779){_0x37f779=_0x37f779||0xc8;return function(_0xc29b9a){if(_0xc29b9a){return _0x57c167[_0x6267('0x1b')](_0x37f779)[_0x6267('0x1d')](_0xc29b9a);}};}function respondWithFilteredResult(_0x254b25,_0x781056){return function(_0x196f88){if(_0x196f88){var _0x2317e3=typeof _0x781056['offset']==='undefined'&&typeof _0x781056['limit']===_0x6267('0x1e');var _0x39c244=_0x196f88[_0x6267('0x1f')];var _0x1fbc17=_0x2317e3?0x0:_0x781056[_0x6267('0x20')];var _0x255aa3=_0x2317e3?_0x196f88[_0x6267('0x1f')]:_0x781056[_0x6267('0x20')]+_0x781056['limit'];var _0x4634ee;if(_0x255aa3>=_0x39c244){_0x255aa3=_0x39c244;_0x4634ee=0xc8;}else{_0x4634ee=0xce;}_0x254b25[_0x6267('0x1b')](_0x4634ee);return _0x254b25[_0x6267('0x21')](_0x6267('0x22'),_0x1fbc17+'-'+_0x255aa3+'/'+_0x39c244)[_0x6267('0x1d')](_0x196f88);}return null;};}function patchUpdates(_0x17354a){return function(_0x927e8e){try{jsonpatch[_0x6267('0x23')](_0x927e8e,_0x17354a,!![]);}catch(_0x3ae4ea){return BPromise[_0x6267('0x24')](_0x3ae4ea);}return _0x927e8e[_0x6267('0x25')]();};}function saveUpdates(_0xb7bd10,_0x11990a){return function(_0x2dd56c){if(_0x2dd56c){return _0x2dd56c[_0x6267('0x26')](_0xb7bd10)[_0x6267('0x27')](function(_0x5c550e){return _0x5c550e;});}return null;};}function removeEntity(_0x3a75d0,_0x2bbe0f){return function(_0xf9c5d2){if(_0xf9c5d2){return _0xf9c5d2[_0x6267('0x28')]()[_0x6267('0x27')](function(){var _0xefd202=_0xf9c5d2[_0x6267('0x29')]({'plain':!![]});var _0x102be9=_0x6267('0x2a');return db[_0x6267('0x2b')][_0x6267('0x28')]({'where':{'type':_0x102be9,'resourceId':_0xefd202['id']}})[_0x6267('0x27')](function(){return _0xf9c5d2;});})['then'](function(){_0x3a75d0[_0x6267('0x1b')](0xcc)[_0x6267('0x1c')]();});}};}function handleEntityNotFound(_0x49aa97,_0xdcbb9b){return function(_0x2dceba){if(!_0x2dceba){_0x49aa97[_0x6267('0x2c')](0x194);}return _0x2dceba;};}function handleError(_0x1386bd,_0x7a2513){_0x7a2513=_0x7a2513||0x1f4;return function(_0x191976){logger[_0x6267('0x2d')](_0x191976[_0x6267('0x2e')]);if(_0x191976[_0x6267('0x2f')]){delete _0x191976[_0x6267('0x2f')];}_0x1386bd[_0x6267('0x1b')](_0x7a2513)['send'](_0x191976);};}exports[_0x6267('0x30')]=function(_0x50a5c7,_0x3f7f9a){var _0x3eec50={},_0x23cf40={},_0x17cf02={'count':0x0,'rows':[]};var _0x2fff9d=_['map'](db[_0x6267('0x31')][_0x6267('0x32')],function(_0x5b1c8b){return{'name':_0x5b1c8b[_0x6267('0x33')],'type':_0x5b1c8b[_0x6267('0x34')][_0x6267('0x35')]};});_0x23cf40[_0x6267('0x36')]=_['map'](_0x2fff9d,'name');_0x23cf40['query']=_[_0x6267('0x37')](_0x50a5c7['query']);_0x23cf40[_0x6267('0x38')]=_[_0x6267('0x39')](_0x23cf40['model'],_0x23cf40[_0x6267('0x3a')]);_0x3eec50['attributes']=_[_0x6267('0x39')](_0x23cf40['model'],qs['fields'](_0x50a5c7[_0x6267('0x3a')][_0x6267('0x3b')]));_0x3eec50[_0x6267('0x3c')]=_0x3eec50[_0x6267('0x3c')][_0x6267('0x3d')]?_0x3eec50[_0x6267('0x3c')]:_0x23cf40[_0x6267('0x36')];if(!_0x50a5c7[_0x6267('0x3a')][_0x6267('0x3e')](_0x6267('0x3f'))){_0x3eec50[_0x6267('0x40')]=qs['limit'](_0x50a5c7[_0x6267('0x3a')][_0x6267('0x40')]);_0x3eec50[_0x6267('0x20')]=qs['offset'](_0x50a5c7[_0x6267('0x3a')]['offset']);}_0x3eec50[_0x6267('0x41')]=qs[_0x6267('0x42')](_0x50a5c7['query']['sort']);_0x3eec50[_0x6267('0x43')]=qs[_0x6267('0x38')](_[_0x6267('0x44')](_0x50a5c7[_0x6267('0x3a')],_0x23cf40['filters']),_0x2fff9d);if(_0x50a5c7['query'][_0x6267('0x45')]){_0x3eec50[_0x6267('0x43')]=_[_0x6267('0x46')](_0x3eec50[_0x6267('0x43')],{'$or':_[_0x6267('0x47')](_0x2fff9d,function(_0x5118c0){if(_0x5118c0[_0x6267('0x34')]!==_0x6267('0x48')){var _0x16a348={};_0x16a348[_0x5118c0['name']]={'$like':'%'+_0x50a5c7[_0x6267('0x3a')][_0x6267('0x45')]+'%'};return _0x16a348;}})});}_0x3eec50=_[_0x6267('0x46')]({},_0x3eec50,_0x50a5c7[_0x6267('0x49')]);var _0x243856={'where':_0x3eec50[_0x6267('0x43')]};return db[_0x6267('0x31')][_0x6267('0x1f')](_0x243856)['then'](function(_0x5c0d2d){_0x17cf02[_0x6267('0x1f')]=_0x5c0d2d;if(_0x50a5c7[_0x6267('0x3a')]['includeAll']){_0x3eec50[_0x6267('0x4a')]=[{'all':!![]}];}return db[_0x6267('0x31')][_0x6267('0x4b')](_0x3eec50);})[_0x6267('0x27')](function(_0x3f3f88){_0x17cf02[_0x6267('0x4c')]=_0x3f3f88;return _0x17cf02;})['then'](respondWithFilteredResult(_0x3f7f9a,_0x3eec50))[_0x6267('0x4d')](handleError(_0x3f7f9a,null));};exports[_0x6267('0x4e')]=function(_0x4edda5,_0x30ff00){var _0x26b3c9={'raw':![],'where':{'id':_0x4edda5['params']['id']}},_0x2f2902={};_0x2f2902[_0x6267('0x36')]=_[_0x6267('0x37')](db['Schedule'][_0x6267('0x32')]);_0x2f2902[_0x6267('0x3a')]=_[_0x6267('0x37')](_0x4edda5[_0x6267('0x3a')]);_0x2f2902[_0x6267('0x38')]=_[_0x6267('0x39')](_0x2f2902[_0x6267('0x36')],_0x2f2902[_0x6267('0x3a')]);_0x26b3c9[_0x6267('0x3c')]=_[_0x6267('0x39')](_0x2f2902[_0x6267('0x36')],qs[_0x6267('0x3b')](_0x4edda5[_0x6267('0x3a')][_0x6267('0x3b')]));_0x26b3c9[_0x6267('0x3c')]=_0x26b3c9['attributes']['length']?_0x26b3c9[_0x6267('0x3c')]:_0x2f2902[_0x6267('0x36')];if(_0x4edda5['query'][_0x6267('0x4f')]){_0x26b3c9[_0x6267('0x4a')]=[{'all':!![]}];}_0x26b3c9=_[_0x6267('0x46')]({},_0x26b3c9,_0x4edda5[_0x6267('0x49')]);return db[_0x6267('0x31')][_0x6267('0x50')](_0x26b3c9)[_0x6267('0x27')](handleEntityNotFound(_0x30ff00,null))['then'](respondWithResult(_0x30ff00,null))[_0x6267('0x4d')](handleError(_0x30ff00,null));};exports[_0x6267('0x51')]=function(_0x395cdf,_0x15f1df){return db[_0x6267('0x31')]['create'](_0x395cdf[_0x6267('0x52')],{})[_0x6267('0x27')](function(_0x5e4e40){var _0x1f2e8a=_0x395cdf[_0x6267('0x53')][_0x6267('0x29')]({'plain':!![]});if(!_0x1f2e8a)throw new Error(_0x6267('0x54'));if(_0x1f2e8a[_0x6267('0x55')]===_0x6267('0x53')){var _0x3eb21d=_0x5e4e40[_0x6267('0x29')]({'plain':!![]});var _0x44bd85='Scheduler';return db[_0x6267('0x56')][_0x6267('0x50')]({'where':{'name':_0x44bd85,'userProfileId':_0x1f2e8a[_0x6267('0x57')]},'raw':!![]})['then'](function(_0x386e35){if(_0x386e35&&_0x386e35['autoAssociation']===0x0){return db[_0x6267('0x2b')][_0x6267('0x51')]({'name':_0x3eb21d['name'],'resourceId':_0x3eb21d['id'],'type':_0x386e35[_0x6267('0x2f')],'sectionId':_0x386e35['id']},{})['then'](function(){return _0x5e4e40;});}else{return _0x5e4e40;}})[_0x6267('0x4d')](function(_0x3d4913){logger['error'](_0x6267('0x58'),_0x3d4913);throw _0x3d4913;});}return _0x5e4e40;})[_0x6267('0x27')](respondWithResult(_0x15f1df,0xc9))['catch'](handleError(_0x15f1df,null));};exports[_0x6267('0x26')]=function(_0x2b194e,_0x8ceb92){if(_0x2b194e[_0x6267('0x52')]['id']){delete _0x2b194e[_0x6267('0x52')]['id'];}return db[_0x6267('0x31')][_0x6267('0x50')]({'where':{'id':_0x2b194e[_0x6267('0x59')]['id']}})[_0x6267('0x27')](handleEntityNotFound(_0x8ceb92,null))[_0x6267('0x27')](saveUpdates(_0x2b194e[_0x6267('0x52')],null))[_0x6267('0x27')](respondWithResult(_0x8ceb92,null))[_0x6267('0x4d')](handleError(_0x8ceb92,null));};exports[_0x6267('0x28')]=function(_0x4c69be,_0x8de641){return db[_0x6267('0x31')][_0x6267('0x50')]({'where':{'id':_0x4c69be[_0x6267('0x59')]['id']}})[_0x6267('0x27')](handleEntityNotFound(_0x8de641,null))[_0x6267('0x27')](removeEntity(_0x8de641,null))[_0x6267('0x4d')](handleError(_0x8de641,null));};exports['run']=function(_0x12e9e7,_0x47bffa,_0x5ae8e4){var _0x237561=require('../../config/schedule');return db[_0x6267('0x31')][_0x6267('0x50')]({'where':{'id':_0x12e9e7[_0x6267('0x59')]['id']},'raw':!![]})[_0x6267('0x27')](handleEntityNotFound(_0x47bffa,null))['then'](function(){_0x237561[_0x6267('0x5a')](_0x12e9e7[_0x6267('0x59')]['id']);})[_0x6267('0x27')](respondWithStatusCode(_0x47bffa,null))[_0x6267('0x4d')](handleError(_0x47bffa,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 78ab2ec..e781cd4 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 _0x6daf=['path','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa688c3,_0x5bd140){var _0x4e2f9c=function(_0x22cfa7){while(--_0x22cfa7){_0xa688c3['push'](_0xa688c3['shift']());}};_0x4e2f9c(++_0x5bd140);}(_0x6daf,0x16d));var _0xf6da=function(_0x32d822,_0xd63b5d){_0x32d822=_0x32d822-0x0;var _0x1db4d3=_0x6daf[_0x32d822];return _0x1db4d3;};'use strict';var _=require(_0xf6da('0x0'));var util=require(_0xf6da('0x1'));var logger=require(_0xf6da('0x2'))(_0xf6da('0x3'));var moment=require(_0xf6da('0x4'));var BPromise=require(_0xf6da('0x5'));var rp=require(_0xf6da('0x6'));var fs=require('fs');var path=require(_0xf6da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf6da('0x8'));module[_0xf6da('0x9')]=function(_0x7a0aed,_0x110a61){return _0x7a0aed[_0xf6da('0xa')](_0xf6da('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b9e=['util','../../config/logger','api','moment','bluebird','request-promise','./schedule.attributes','Schedule','lodash'];(function(_0x9a138c,_0x2607f8){var _0x3771a3=function(_0x22ebbb){while(--_0x22ebbb){_0x9a138c['push'](_0x9a138c['shift']());}};_0x3771a3(++_0x2607f8);}(_0x3b9e,0x170));var _0xe3b9=function(_0xb56647,_0x51680e){_0xb56647=_0xb56647-0x0;var _0x8e213c=_0x3b9e[_0xb56647];return _0x8e213c;};'use strict';var _=require(_0xe3b9('0x0'));var util=require(_0xe3b9('0x1'));var logger=require(_0xe3b9('0x2'))(_0xe3b9('0x3'));var moment=require(_0xe3b9('0x4'));var BPromise=require(_0xe3b9('0x5'));var rp=require(_0xe3b9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe3b9('0x7'));module['exports']=function(_0x2dcc36,_0x25ccb4){return _0x2dcc36['define'](_0xe3b9('0x8'),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 0337083..c0b9fbc 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 _0x901d=['Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','debug'];(function(_0x2c7279,_0xa810b7){var _0x39cd25=function(_0x45d011){while(--_0x45d011){_0x2c7279['push'](_0x2c7279['shift']());}};_0x39cd25(++_0xa810b7);}(_0x901d,0xfa));var _0xd901=function(_0x2fdd40,_0x1bb200){_0x2fdd40=_0x2fdd40-0x0;var _0x44e423=_0x901d[_0x2fdd40];return _0x44e423;};'use strict';var _=require('lodash');var util=require(_0xd901('0x0'));var moment=require(_0xd901('0x1'));var BPromise=require('bluebird');var rs=require(_0xd901('0x2'));var fs=require('fs');var Redis=require(_0xd901('0x3'));var db=require(_0xd901('0x4'))['db'];var utils=require(_0xd901('0x5'));var logger=require(_0xd901('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd901('0x7'));var client=jayson['client'][_0xd901('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e5591,_0x1698ba,_0x5653a8){return new BPromise(function(_0x3e90b7,_0x27b769){return client[_0xd901('0x9')](_0x5e5591,_0x5653a8)[_0xd901('0xa')](function(_0x17a419){logger[_0xd901('0xb')](_0xd901('0xc'),_0x1698ba,'request\x20sent');logger[_0xd901('0xd')](_0xd901('0xe'),_0x1698ba,_0xd901('0xf'),JSON[_0xd901('0x10')](_0x17a419));if(_0x17a419[_0xd901('0x11')]){if(_0x17a419[_0xd901('0x11')][_0xd901('0x12')]===0x1f4){logger[_0xd901('0x11')](_0xd901('0xc'),_0x1698ba,_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);return _0x27b769(_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);}logger[_0xd901('0x11')](_0xd901('0xc'),_0x1698ba,_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);return _0x3e90b7(_0x17a419[_0xd901('0x11')][_0xd901('0x13')]);}else{logger[_0xd901('0xb')]('Schedule,\x20%s,\x20%s',_0x1698ba,_0xd901('0xf'));_0x3e90b7(_0x17a419[_0xd901('0x14')]['message']);}})[_0xd901('0x15')](function(_0x5504c2){logger['error'](_0xd901('0xc'),_0x1698ba,_0x5504c2);_0x27b769(_0x5504c2);});});} \ No newline at end of file +var _0x8373=['debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent'];(function(_0x44da89,_0x4de7d0){var _0x5b7ad0=function(_0x4f646f){while(--_0x4f646f){_0x44da89['push'](_0x44da89['shift']());}};_0x5b7ad0(++_0x4de7d0);}(_0x8373,0x136));var _0x3837=function(_0x287b3a,_0x392aed){_0x287b3a=_0x287b3a-0x0;var _0x3489c3=_0x8373[_0x287b3a];return _0x3489c3;};'use strict';var _=require(_0x3837('0x0'));var util=require(_0x3837('0x1'));var moment=require('moment');var BPromise=require(_0x3837('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3837('0x3'));var logger=require(_0x3837('0x4'))(_0x3837('0x5'));var config=require('../../config/environment');var jayson=require(_0x3837('0x6'));var client=jayson[_0x3837('0x7')][_0x3837('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c6d5a,_0x1ce723,_0x2f4c42){return new BPromise(function(_0x4ef70d,_0xe1ac81){return client[_0x3837('0x9')](_0x5c6d5a,_0x2f4c42)['then'](function(_0x1eeb54){logger[_0x3837('0xa')](_0x3837('0xb'),_0x1ce723,_0x3837('0xc'));logger[_0x3837('0xd')](_0x3837('0xe'),_0x1ce723,_0x3837('0xc'),JSON['stringify'](_0x1eeb54));if(_0x1eeb54[_0x3837('0xf')]){if(_0x1eeb54[_0x3837('0xf')][_0x3837('0x10')]===0x1f4){logger[_0x3837('0xf')](_0x3837('0xb'),_0x1ce723,_0x1eeb54[_0x3837('0xf')][_0x3837('0x11')]);return _0xe1ac81(_0x1eeb54['error']['message']);}logger[_0x3837('0xf')](_0x3837('0xb'),_0x1ce723,_0x1eeb54[_0x3837('0xf')][_0x3837('0x11')]);return _0x4ef70d(_0x1eeb54[_0x3837('0xf')]['message']);}else{logger['info'](_0x3837('0xb'),_0x1ce723,_0x3837('0xc'));_0x4ef70d(_0x1eeb54['result'][_0x3837('0x11')]);}})[_0x3837('0x12')](function(_0x2786f6){logger['error'](_0x3837('0xb'),_0x1ce723,_0x2786f6);_0xe1ac81(_0x2786f6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b3c1968..060ee86 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 _0xd961=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','create','put','update'];(function(_0xa91beb,_0x555206){var _0x2c04f3=function(_0xfa0bfb){while(--_0xfa0bfb){_0xa91beb['push'](_0xa91beb['shift']());}};_0x2c04f3(++_0x555206);}(_0xd961,0x145));var _0x1d96=function(_0x1cb86d,_0x202738){_0x1cb86d=_0x1cb86d-0x0;var _0x4130c3=_0xd961[_0x1cb86d];return _0x4130c3;};'use strict';var multer=require(_0x1d96('0x0'));var util=require(_0x1d96('0x1'));var path=require(_0x1d96('0x2'));var timeout=require(_0x1d96('0x3'));var express=require(_0x1d96('0x4'));var router=express['Router']();var fs_extra=require(_0x1d96('0x5'));var auth=require(_0x1d96('0x6'));var interaction=require(_0x1d96('0x7'));var config=require(_0x1d96('0x8'));var controller=require('./screenRecording.controller');router[_0x1d96('0x9')]('/',auth[_0x1d96('0xa')](),controller[_0x1d96('0xb')]);router[_0x1d96('0x9')](_0x1d96('0xc'),auth[_0x1d96('0xa')](),controller['describe']);router[_0x1d96('0x9')](_0x1d96('0xd'),auth[_0x1d96('0xa')](),controller['show']);router['get'](_0x1d96('0xe'),auth[_0x1d96('0xa')](),controller[_0x1d96('0xf')]);router[_0x1d96('0x10')]('/',auth['isAuthenticated'](),controller[_0x1d96('0x11')]);router[_0x1d96('0x12')](_0x1d96('0xd'),auth['isAuthenticated'](),controller[_0x1d96('0x13')]);router[_0x1d96('0x14')](_0x1d96('0xd'),auth[_0x1d96('0xa')](),controller[_0x1d96('0x15')]);module[_0x1d96('0x16')]=router; \ No newline at end of file +var _0xcf8d=['express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','put','update','delete','destroy','multer','util'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xcf8d,0x1a0));var _0xdcf8=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xcf8d[_0x533e4e];return _0x1f14bb;};'use strict';var multer=require(_0xdcf8('0x0'));var util=require(_0xdcf8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdcf8('0x2'));var router=express[_0xdcf8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdcf8('0x4'));var config=require(_0xdcf8('0x5'));var controller=require(_0xdcf8('0x6'));router[_0xdcf8('0x7')]('/',auth[_0xdcf8('0x8')](),controller[_0xdcf8('0x9')]);router[_0xdcf8('0x7')](_0xdcf8('0xa'),auth[_0xdcf8('0x8')](),controller[_0xdcf8('0xb')]);router[_0xdcf8('0x7')](_0xdcf8('0xc'),auth[_0xdcf8('0x8')](),controller['show']);router[_0xdcf8('0x7')]('/:id/download',auth[_0xdcf8('0x8')](),controller[_0xdcf8('0xd')]);router[_0xdcf8('0xe')]('/',auth[_0xdcf8('0x8')](),controller['create']);router[_0xdcf8('0xf')](_0xdcf8('0xc'),auth[_0xdcf8('0x8')](),controller[_0xdcf8('0x10')]);router[_0xdcf8('0x11')](_0xdcf8('0xc'),auth['isAuthenticated'](),controller[_0xdcf8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7e60735..c268ef3 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 _0x2884=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','path','../../config/environment','exports','getDataValue','value','STRING','setDataValue','INTEGER','closedAt','duration','DATE','startedAt'];(function(_0x27733c,_0x5a22b5){var _0x580d35=function(_0x35b226){while(--_0x35b226){_0x27733c['push'](_0x27733c['shift']());}};_0x580d35(++_0x5a22b5);}(_0x2884,0x1eb));var _0x4288=function(_0x45bc3f,_0x234416){_0x45bc3f=_0x45bc3f-0x0;var _0x530329=_0x2884[_0x45bc3f];return _0x530329;};'use strict';var Sequelize=require(_0x4288('0x0'));var moment=require('moment');var path=require(_0x4288('0x1'));var config=require(_0x4288('0x2'));module[_0x4288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4288('0x4')](_0x4288('0x5'))?path['extname'](this['getDataValue'](_0x4288('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4288('0x6')]},'channel':{'type':Sequelize[_0x4288('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x526a07){var _0x3a930e=_0x526a07['replace'](/\\/g,'/');this[_0x4288('0x7')](_0x4288('0x5'),_0x3a930e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4288('0x8')],'set':function(_0x3c8d6e){this[_0x4288('0x7')]('startedAt',moment()['subtract'](_0x3c8d6e,'ms'));this[_0x4288('0x7')](_0x4288('0x9'),moment());this[_0x4288('0x7')](_0x4288('0xa'),_0x3c8d6e);}},'startedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0xc')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'closedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')]('closedAt'))[_0x4288('0xf')](_0x4288('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this['getDataValue'](_0x4288('0x10')))['format'](_0x4288('0xd'))[_0x4288('0xe')]();}},'updatedAt':{'type':Sequelize[_0x4288('0xb')],'get':function(){return moment(this[_0x4288('0x4')](_0x4288('0x11')))[_0x4288('0xf')](_0x4288('0xd'))[_0x4288('0xe')]();}}}; \ No newline at end of file +var _0xb4b6=['value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0xb4b6,0x7e));var _0x6b4b=function(_0xcc4c8e,_0x3d4ba3){_0xcc4c8e=_0xcc4c8e-0x0;var _0x2e4038=_0xb4b6[_0xcc4c8e];return _0x2e4038;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var config=require(_0x6b4b('0x2'));module[_0x6b4b('0x3')]={'format':{'type':Sequelize[_0x6b4b('0x4')],'get':function(){return this[_0x6b4b('0x5')](_0x6b4b('0x6'))?path[_0x6b4b('0x7')](this[_0x6b4b('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x6b4b('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6b4b('0x8')],'set':function(_0x25eef2){var _0x8b279d=_0x25eef2[_0x6b4b('0x9')](/\\/g,'/');this[_0x6b4b('0xa')]('value',_0x8b279d);}},'rating':{'type':Sequelize[_0x6b4b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x6b4b('0xb')],'set':function(_0x40b391){this[_0x6b4b('0xa')](_0x6b4b('0xc'),moment()[_0x6b4b('0xd')](_0x40b391,'ms'));this[_0x6b4b('0xa')](_0x6b4b('0xe'),moment());this['setDataValue'](_0x6b4b('0xf'),_0x40b391);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x6b4b('0x5')](_0x6b4b('0xc')))[_0x6b4b('0x10')](_0x6b4b('0x11'))[_0x6b4b('0x12')]();}},'closedAt':{'type':Sequelize[_0x6b4b('0x13')],'get':function(){return moment(this[_0x6b4b('0x5')]('closedAt'))[_0x6b4b('0x10')](_0x6b4b('0x11'))[_0x6b4b('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x6b4b('0x14')))[_0x6b4b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x6b4b('0x12')]();}},'updatedAt':{'type':Sequelize[_0x6b4b('0x13')],'get':function(){return moment(this[_0x6b4b('0x5')](_0x6b4b('0x15')))[_0x6b4b('0x10')](_0x6b4b('0x11'))[_0x6b4b('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index deaf88a..0a0f0fd 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 _0xbd50=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','update','duration','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','existsSync','decryptFile','recording','server/files/screen_recordings','ValidationError','filename','extname','download','unlink','message','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5d0bf5,_0x4bbbbd){var _0x547a18=function(_0x1171a9){while(--_0x1171a9){_0x5d0bf5['push'](_0x5d0bf5['shift']());}};_0x547a18(++_0x4bbbbd);}(_0xbd50,0x196));var _0x0bd5=function(_0x28a6ad,_0x351697){_0x28a6ad=_0x28a6ad-0x0;var _0xbb804=_0xbd50[_0x28a6ad];return _0xbb804;};'use strict';var emlformat=require(_0x0bd5('0x0'));var rimraf=require(_0x0bd5('0x1'));var zipdir=require(_0x0bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x3'));var moment=require(_0x0bd5('0x4'));var BPromise=require(_0x0bd5('0x5'));var Mustache=require(_0x0bd5('0x6'));var util=require(_0x0bd5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0bd5('0x8'));var fs=require('fs');var fs_extra=require(_0x0bd5('0x9'));var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0xd'));var querystring=require(_0x0bd5('0xe'));var Papa=require(_0x0bd5('0xf'));var Redis=require('ioredis');var authService=require(_0x0bd5('0x10'));var qs=require(_0x0bd5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x12'));var logger=require(_0x0bd5('0x13'))('api');var utils=require(_0x0bd5('0x14'));var config=require(_0x0bd5('0x15'));var licenseUtil=require(_0x0bd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7a0c,_0x23982f){_0x23982f=_0x23982f||0xcc;return function(_0x2f9588){if(_0x2f9588){return _0x2f7a0c[_0x0bd5('0x17')](_0x23982f);}return _0x2f7a0c[_0x0bd5('0x18')](_0x23982f)[_0x0bd5('0x19')]();};}function respondWithResult(_0x30765e,_0x1e961d){_0x1e961d=_0x1e961d||0xc8;return function(_0x4f485b){if(_0x4f485b){return _0x30765e[_0x0bd5('0x18')](_0x1e961d)[_0x0bd5('0x1a')](_0x4f485b);}};}function respondWithFilteredResult(_0x574315,_0x31349f){return function(_0x23ef4e){if(_0x23ef4e){var _0x3a34e4=typeof _0x31349f[_0x0bd5('0x1b')]==='undefined'&&typeof _0x31349f[_0x0bd5('0x1c')]===_0x0bd5('0x1d');var _0xa890be=_0x23ef4e[_0x0bd5('0x1e')];var _0x833c14=_0x3a34e4?0x0:_0x31349f[_0x0bd5('0x1b')];var _0xc58e12=_0x3a34e4?_0x23ef4e[_0x0bd5('0x1e')]:_0x31349f[_0x0bd5('0x1b')]+_0x31349f[_0x0bd5('0x1c')];var _0x27bc1e;if(_0xc58e12>=_0xa890be){_0xc58e12=_0xa890be;_0x27bc1e=0xc8;}else{_0x27bc1e=0xce;}_0x574315[_0x0bd5('0x18')](_0x27bc1e);return _0x574315[_0x0bd5('0x1f')](_0x0bd5('0x20'),_0x833c14+'-'+_0xc58e12+'/'+_0xa890be)['json'](_0x23ef4e);}return null;};}function patchUpdates(_0x5ba943){return function(_0x596b6a){try{jsonpatch['apply'](_0x596b6a,_0x5ba943,!![]);}catch(_0x47d74a){return BPromise[_0x0bd5('0x21')](_0x47d74a);}return _0x596b6a[_0x0bd5('0x22')]();};}function saveUpdates(_0x13ce46,_0x4a6910){return function(_0x6ee1a8){if(_0x6ee1a8){return _0x6ee1a8['update'](_0x13ce46)[_0x0bd5('0x23')](function(_0x3b235b){return _0x3b235b;});}return null;};}function removeEntity(_0x38c21d,_0x5a8139){return function(_0x5b6dde){if(_0x5b6dde){return _0x5b6dde['destroy']()['then'](function(){_0x38c21d[_0x0bd5('0x18')](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x184db3,_0x4fde84){return function(_0x42428c){if(!_0x42428c){_0x184db3['sendStatus'](0x194);}return _0x42428c;};}function handleError(_0x456e87,_0x3ffb08){_0x3ffb08=_0x3ffb08||0x1f4;return function(_0x18cec3){logger[_0x0bd5('0x24')](_0x18cec3[_0x0bd5('0x25')]);if(_0x18cec3[_0x0bd5('0x26')]){delete _0x18cec3[_0x0bd5('0x26')];}_0x456e87[_0x0bd5('0x18')](_0x3ffb08)[_0x0bd5('0x27')](_0x18cec3);};}exports[_0x0bd5('0x28')]=function(_0x15561b,_0xcbfc51){var _0x2e10ce={},_0x2704ee={},_0x5e5a33={'count':0x0,'rows':[]};var _0x461ae3=_[_0x0bd5('0x29')](db['ScreenRecording'][_0x0bd5('0x2a')],function(_0x8eccc9){return{'name':_0x8eccc9['fieldName'],'type':_0x8eccc9[_0x0bd5('0x2b')][_0x0bd5('0x2c')]};});_0x2704ee[_0x0bd5('0x2d')]=_[_0x0bd5('0x2e')](_['map'](_0x461ae3,_0x0bd5('0x26')),[_0x0bd5('0x2f')]);_0x2704ee[_0x0bd5('0x30')]=_[_0x0bd5('0x31')](_0x15561b[_0x0bd5('0x30')]);_0x2704ee[_0x0bd5('0x32')]=_['intersection'](_0x2704ee[_0x0bd5('0x2d')],_0x2704ee['query']);_0x2e10ce[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x2704ee[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x35')]));_0x2e10ce[_0x0bd5('0x33')]=_0x2e10ce[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x2e10ce[_0x0bd5('0x33')]:_0x2704ee[_0x0bd5('0x2d')];if(!_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x37')]('nolimit')){_0x2e10ce[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0x15561b['query']['limit']);_0x2e10ce[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x1b')]);}_0x2e10ce[_0x0bd5('0x38')]=qs[_0x0bd5('0x39')](_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x39')]);_0x2e10ce[_0x0bd5('0x3a')]=qs[_0x0bd5('0x32')](_[_0x0bd5('0x3b')](_0x15561b[_0x0bd5('0x30')],_0x2704ee[_0x0bd5('0x32')]),_0x461ae3);if(_0x15561b['query'][_0x0bd5('0x3c')]){_0x2e10ce['where']=_[_0x0bd5('0x3d')](_0x2e10ce[_0x0bd5('0x3a')],{'$or':_[_0x0bd5('0x29')](_0x461ae3,function(_0x1fcc49){if(_0x1fcc49[_0x0bd5('0x2b')]!==_0x0bd5('0x3e')){var _0x53a682={};_0x53a682[_0x1fcc49[_0x0bd5('0x26')]]={'$like':'%'+_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x3c')]+'%'};return _0x53a682;}})});}_0x2e10ce=_[_0x0bd5('0x3d')]({},_0x2e10ce,_0x15561b[_0x0bd5('0x3f')]);var _0x493089={'where':_0x2e10ce[_0x0bd5('0x3a')]};return db[_0x0bd5('0x40')][_0x0bd5('0x1e')](_0x493089)['then'](function(_0x177aa3){_0x5e5a33['count']=_0x177aa3;if(_0x15561b[_0x0bd5('0x30')][_0x0bd5('0x41')]){_0x2e10ce['include']=[{'all':!![]}];}return db[_0x0bd5('0x40')][_0x0bd5('0x42')](_0x2e10ce);})[_0x0bd5('0x23')](function(_0x3ec4b0){_0x5e5a33[_0x0bd5('0x43')]=_0x3ec4b0;return _0x5e5a33;})[_0x0bd5('0x23')](respondWithFilteredResult(_0xcbfc51,_0x2e10ce))[_0x0bd5('0x44')](handleError(_0xcbfc51,null));};exports['show']=function(_0x4d3ca5,_0x994f24){var _0x545b63={'raw':![],'where':{'id':_0x4d3ca5[_0x0bd5('0x45')]['id']}},_0x5dd42b={};_0x5dd42b[_0x0bd5('0x2d')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x5dd42b[_0x0bd5('0x30')]=_['keys'](_0x4d3ca5['query']);_0x5dd42b[_0x0bd5('0x32')]=_[_0x0bd5('0x34')](_0x5dd42b['model'],_0x5dd42b['query']);_0x545b63[_0x0bd5('0x33')]=_[_0x0bd5('0x34')](_0x5dd42b[_0x0bd5('0x2d')],qs[_0x0bd5('0x35')](_0x4d3ca5['query'][_0x0bd5('0x35')]));_0x545b63[_0x0bd5('0x33')]=_0x545b63[_0x0bd5('0x33')][_0x0bd5('0x36')]?_0x545b63[_0x0bd5('0x33')]:_0x5dd42b[_0x0bd5('0x2d')];if(_0x4d3ca5['query'][_0x0bd5('0x41')]){_0x545b63[_0x0bd5('0x46')]=[{'all':!![]}];}_0x545b63=_[_0x0bd5('0x3d')]({},_0x545b63,_0x4d3ca5['options']);return db[_0x0bd5('0x40')][_0x0bd5('0x47')](_0x545b63)[_0x0bd5('0x23')](handleEntityNotFound(_0x994f24,null))['then'](respondWithResult(_0x994f24,null))[_0x0bd5('0x44')](handleError(_0x994f24,null));};exports[_0x0bd5('0x48')]=function(_0x54cd78,_0x18c7c7){return db[_0x0bd5('0x40')]['create'](_0x54cd78[_0x0bd5('0x49')],{})[_0x0bd5('0x23')](respondWithResult(_0x18c7c7,0xc9))['catch'](handleError(_0x18c7c7,null));};exports[_0x0bd5('0x4a')]=function(_0x20960a,_0x146bdc){if(_0x20960a[_0x0bd5('0x49')]['id']){delete _0x20960a[_0x0bd5('0x49')]['id'];}delete _0x20960a['body'][_0x0bd5('0x4b')];delete _0x20960a[_0x0bd5('0x49')]['createdAt'];delete _0x20960a[_0x0bd5('0x49')]['closedAt'];delete _0x20960a[_0x0bd5('0x49')][_0x0bd5('0x4c')];return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x20960a['params']['id']}})[_0x0bd5('0x23')](handleEntityNotFound(_0x146bdc,null))['then'](saveUpdates(_0x20960a['body'],null))[_0x0bd5('0x23')](respondWithResult(_0x146bdc,null))[_0x0bd5('0x44')](handleError(_0x146bdc,null));};exports[_0x0bd5('0x4d')]=function(_0x4c9a79,_0x424187){return db['ScreenRecording'][_0x0bd5('0x4d')]()[_0x0bd5('0x23')](respondWithResult(_0x424187,null))[_0x0bd5('0x44')](handleError(_0x424187,null));};exports['download']=function(_0x512fe3,_0x4f0467,_0x122f84){var _0x21db5d=require(_0x0bd5('0x4e'));var _0x5b06c6=![];var _0x2b174a={};if(_0x512fe3[_0x0bd5('0x30')]['type']&&_0x512fe3[_0x0bd5('0x30')]['type']==='uniqueid'){_0x2b174a[_0x0bd5('0x4f')]=_0x512fe3[_0x0bd5('0x45')]['id'];}else{_0x2b174a['id']=_0x512fe3[_0x0bd5('0x45')]['id'];}return db[_0x0bd5('0x40')]['find']({'where':_0x2b174a,'attributes':['id',_0x0bd5('0x4c')],'raw':!![]})[_0x0bd5('0x23')](handleEntityNotFound(_0x4f0467,null))[_0x0bd5('0x23')](function(_0x5cf2f2){if(_0x5cf2f2){var _0x504e46=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],'server/files/screen_recordings',_0x5cf2f2['value']);var _0x2b11e8=util['format'](_0x0bd5('0x52'),_0x504e46);if(fs[_0x0bd5('0x53')](_0x2b11e8)){_0x5b06c6=!![];return _0x21db5d[_0x0bd5('0x54')](_0x2b11e8,_0x504e46,config['secrets'][_0x0bd5('0x55')])[_0x0bd5('0x23')](function(){return _0x5cf2f2;});}return _0x5cf2f2;}})[_0x0bd5('0x23')](function(_0x38aae5){if(_0x38aae5){var _0x5e93fa=path[_0x0bd5('0x50')](config[_0x0bd5('0x51')],_0x0bd5('0x56'),_0x38aae5[_0x0bd5('0x4c')]);if(!fs[_0x0bd5('0x53')](_0x5e93fa)){throw new db['Sequelize'][(_0x0bd5('0x57'))]('ScreenRecording\x20not\x20found');}if(_0x38aae5[_0x0bd5('0x58')]){return _0x4f0467['download'](_0x5e93fa,_0x38aae5['filename']+path[_0x0bd5('0x59')](_0x5e93fa),function(){if(_0x5b06c6){fs['unlink'](_0x5e93fa);}});}else{return _0x4f0467[_0x0bd5('0x5a')](_0x5e93fa,function(_0x3087de){if(_0x5b06c6){fs[_0x0bd5('0x5b')](_0x5e93fa);}});}}})['catch'](function(_0x4f7e86){if(_0x4f7e86[_0x0bd5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x4f0467[_0x0bd5('0x18')](0x194)[_0x0bd5('0x27')]('Not\x20found');}else{return handleError(_0x4f0467,null);}});};exports[_0x0bd5('0x5d')]=function(_0x5a38b1,_0x45ccf5){return db[_0x0bd5('0x40')][_0x0bd5('0x47')]({'where':{'id':_0x5a38b1[_0x0bd5('0x45')]['id']}})[_0x0bd5('0x23')](function(_0x467488){if(_[_0x0bd5('0x5e')](_0x467488)){throw new ReferenceError('Entity\x20not\x20found');}return _0x467488;})[_0x0bd5('0x23')](function(_0x1e5e7d){var _0x33c5eb=path['join'](config['root'],_0x0bd5('0x56'),_0x1e5e7d[_0x0bd5('0x4c')]);logger[_0x0bd5('0x5f')](_0x0bd5('0x60'),_0x33c5eb);if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs[_0x0bd5('0x63')](_0x33c5eb);}_0x33c5eb=_0x33c5eb+_0x0bd5('0x64');if(!_[_0x0bd5('0x5e')](_0x1e5e7d[_0x0bd5('0x4c')])&&fs[_0x0bd5('0x53')](_0x33c5eb)){logger[_0x0bd5('0x5f')](_0x0bd5('0x61')+_0x33c5eb+_0x0bd5('0x62'));fs['unlinkSync'](_0x33c5eb);}return _0x1e5e7d;})[_0x0bd5('0x23')](function(_0x32eaaf){if(!_0x32eaaf)throw new InternalError();return _0x32eaaf['destroy']();})[_0x0bd5('0x23')](function(){_0x45ccf5['status'](0xcc)[_0x0bd5('0x19')]();})[_0x0bd5('0x44')](handleError(_0x45ccf5,null));}; \ No newline at end of file +var _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x226af0,_0x498806){var _0x6cbde=function(_0x22a4e3){while(--_0x22a4e3){_0x226af0['push'](_0x226af0['shift']());}};_0x6cbde(++_0x498806);}(_0x98a8,0x12c));var _0x898a=function(_0x4fb127,_0x46e4ee){_0x4fb127=_0x4fb127-0x0;var _0x2941e9=_0x98a8[_0x4fb127];return _0x2941e9;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b1af96a..e2429ba 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 _0x4fac=['screen_recordings','interactionid','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x2761eb,_0x273dc7){var _0x4f8d90=function(_0x56df2d){while(--_0x56df2d){_0x2761eb['push'](_0x2761eb['shift']());}};_0x4f8d90(++_0x273dc7);}(_0x4fac,0x1ee));var _0xc4fa=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fac[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc4fa('0x0'));var util=require(_0xc4fa('0x1'));var logger=require(_0xc4fa('0x2'))('api');var moment=require(_0xc4fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc4fa('0x4'));var config=require(_0xc4fa('0x5'));var attributes=require(_0xc4fa('0x6'));module[_0xc4fa('0x7')]=function(_0x4d26f2,_0x2ff8fd){return _0x4d26f2[_0xc4fa('0x8')](_0xc4fa('0x9'),attributes,{'tableName':_0xc4fa('0xa'),'paranoid':![],'indexes':[{'name':_0xc4fa('0xb'),'fields':[_0xc4fa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa710=['define','ScreenRecording','interactionid','lodash','../../config/logger','request-promise','path','./screenRecording.attributes','exports'];(function(_0x307eb8,_0x24ac03){var _0x424443=function(_0x5901a9){while(--_0x5901a9){_0x307eb8['push'](_0x307eb8['shift']());}};_0x424443(++_0x24ac03);}(_0xa710,0x150));var _0x0a71=function(_0x2daedb,_0x3a2eb5){_0x2daedb=_0x2daedb-0x0;var _0x3e7747=_0xa710[_0x2daedb];return _0x3e7747;};'use strict';var _=require(_0x0a71('0x0'));var util=require('util');var logger=require(_0x0a71('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a71('0x2'));var fs=require('fs');var path=require(_0x0a71('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a71('0x4'));module[_0x0a71('0x5')]=function(_0x285bbf,_0x45b758){return _0x285bbf[_0x0a71('0x6')](_0x0a71('0x7'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0a71('0x8'),'fields':[_0x0a71('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3f97937..023c8b8 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 _0xeec3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x35e71e,_0xfecbe5){var _0x5cca33=function(_0x5ccf64){while(--_0x5ccf64){_0x35e71e['push'](_0x35e71e['shift']());}};_0x5cca33(++_0xfecbe5);}(_0xeec3,0x1db));var _0x3eec=function(_0x32b1c7,_0x379fc0){_0x32b1c7=_0x32b1c7-0x0;var _0x4c5e05=_0xeec3[_0x32b1c7];return _0x4c5e05;};'use strict';var _=require(_0x3eec('0x0'));var util=require(_0x3eec('0x1'));var moment=require(_0x3eec('0x2'));var BPromise=require(_0x3eec('0x3'));var rs=require(_0x3eec('0x4'));var fs=require('fs');var Redis=require(_0x3eec('0x5'));var db=require(_0x3eec('0x6'))['db'];var utils=require(_0x3eec('0x7'));var logger=require(_0x3eec('0x8'))('rpc');var config=require(_0x3eec('0x9'));var jayson=require(_0x3eec('0xa'));var client=jayson[_0x3eec('0xb')][_0x3eec('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23fa2b,_0x112063,_0x368253){return new BPromise(function(_0x25bf8b,_0x2627c3){return client[_0x3eec('0xd')](_0x23fa2b,_0x368253)[_0x3eec('0xe')](function(_0x31bcf3){logger[_0x3eec('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x112063,_0x3eec('0x10'));logger['debug'](_0x3eec('0x11'),_0x112063,_0x3eec('0x10'),JSON[_0x3eec('0x12')](_0x31bcf3));if(_0x31bcf3[_0x3eec('0x13')]){if(_0x31bcf3['error'][_0x3eec('0x14')]===0x1f4){logger['error'](_0x3eec('0x15'),_0x112063,_0x31bcf3[_0x3eec('0x13')]['message']);return _0x2627c3(_0x31bcf3[_0x3eec('0x13')]['message']);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x112063,_0x31bcf3[_0x3eec('0x13')][_0x3eec('0x16')]);return _0x25bf8b(_0x31bcf3['error'][_0x3eec('0x16')]);}else{logger['info'](_0x3eec('0x15'),_0x112063,_0x3eec('0x10'));_0x25bf8b(_0x31bcf3[_0x3eec('0x17')]['message']);}})['catch'](function(_0x2d853e){logger[_0x3eec('0x13')](_0x3eec('0x15'),_0x112063,_0x2d853e);_0x2627c3(_0x2d853e);});});} \ No newline at end of file +var _0x211a=['../../config/utils','../../config/logger','rpc','http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x264358,_0x55f75b){var _0x4125e0=function(_0x1b2839){while(--_0x1b2839){_0x264358['push'](_0x264358['shift']());}};_0x4125e0(++_0x55f75b);}(_0x211a,0x1f3));var _0xa211=function(_0x8a9d7e,_0x19a827){_0x8a9d7e=_0x8a9d7e-0x0;var _0x3fb9b7=_0x211a[_0x8a9d7e];return _0x3fb9b7;};'use strict';var _=require(_0xa211('0x0'));var util=require(_0xa211('0x1'));var moment=require('moment');var BPromise=require(_0xa211('0x2'));var rs=require(_0xa211('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa211('0x4'))['db'];var utils=require(_0xa211('0x5'));var logger=require(_0xa211('0x6'))(_0xa211('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa211('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x322a16,_0x12248e,_0x30c9d4){return new BPromise(function(_0xf0afa9,_0x187a85){return client['request'](_0x322a16,_0x30c9d4)['then'](function(_0x254b77){logger[_0xa211('0x9')](_0xa211('0xa'),_0x12248e,_0xa211('0xb'));logger['debug'](_0xa211('0xc'),_0x12248e,'request\x20sent',JSON[_0xa211('0xd')](_0x254b77));if(_0x254b77['error']){if(_0x254b77['error'][_0xa211('0xe')]===0x1f4){logger[_0xa211('0xf')](_0xa211('0xa'),_0x12248e,_0x254b77[_0xa211('0xf')][_0xa211('0x10')]);return _0x187a85(_0x254b77[_0xa211('0xf')][_0xa211('0x10')]);}logger[_0xa211('0xf')](_0xa211('0xa'),_0x12248e,_0x254b77[_0xa211('0xf')][_0xa211('0x10')]);return _0xf0afa9(_0x254b77['error'][_0xa211('0x10')]);}else{logger['info'](_0xa211('0xa'),_0x12248e,_0xa211('0xb'));_0xf0afa9(_0x254b77['result'][_0xa211('0x10')]);}})[_0xa211('0x11')](function(_0x539453){logger[_0xa211('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x12248e,_0x539453);_0x187a85(_0x539453);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 49ab4af..31fd012 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 _0x2975=['addLogo','format','file','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','put','isAuthenticated','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single'];(function(_0x24868f,_0x373433){var _0x401096=function(_0x1cd967){while(--_0x1cd967){_0x24868f['push'](_0x24868f['shift']());}};_0x401096(++_0x373433);}(_0x2975,0x1a5));var _0x5297=function(_0x184b2e,_0x1f9bbb){_0x184b2e=_0x184b2e-0x0;var _0x1686b0=_0x2975[_0x184b2e];return _0x1686b0;};'use strict';var multer=require('multer');var util=require(_0x5297('0x0'));var path=require(_0x5297('0x1'));var timeout=require(_0x5297('0x2'));var express=require(_0x5297('0x3'));var router=express[_0x5297('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5297('0x5'));var interaction=require(_0x5297('0x6'));var config=require(_0x5297('0x7'));var controller=require('./setting.controller');router[_0x5297('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5297('0x8')](_0x5297('0x9'),controller[_0x5297('0xa')]);router[_0x5297('0x8')](_0x5297('0xb'),controller['show']);router[_0x5297('0x8')](_0x5297('0xc'),controller[_0x5297('0xd')]);router[_0x5297('0x8')](_0x5297('0xe'),controller[_0x5297('0xf')]);router[_0x5297('0x8')]('/:id/gdpr',controller[_0x5297('0x10')]);router[_0x5297('0x8')]('/:id/preferred',controller[_0x5297('0x11')]);router['get'](_0x5297('0x12'),controller[_0x5297('0x13')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x15a0eb,_0x1e0ec5,_0x4a6cfa){_0x4a6cfa(null,path[_0x5297('0x15')](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0xfb7eaf,_0xb0ed14,_0x5d39a5){_0x5d39a5(null,util['format'](_0x5297('0x18'),_0x5297('0x19'),path[_0x5297('0x1a')](_0xb0ed14[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0xc'),upload[_0x5297('0x1d')]('file'),controller[_0x5297('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3833b6,_0xd76ab3,_0x39a239){_0x39a239(null,path['join'](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0x586452,_0x5e0d1f,_0xf51854){_0xf51854(null,util[_0x5297('0x1f')]('%s%s','logologin',path[_0x5297('0x1a')](_0x5e0d1f[_0x5297('0x1b')])));}})});router['post'](_0x5297('0xe'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller[_0x5297('0x21')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x220877,_0x4bf664,_0x3ac4bb){_0x3ac4bb(null,path['join'](config[_0x5297('0x16')],'server/files/images/logos/'));},'filename':function(_0xaf5b9f,_0x14e4e8,_0x483e32){_0x483e32(null,util[_0x5297('0x1f')]('%s%s',_0x5297('0x22'),path['extname'](_0x14e4e8[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0x23'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller[_0x5297('0x24')]);var upload=multer({'storage':multer[_0x5297('0x14')]({'destination':function(_0x2dd058,_0x121da2,_0x19c0fc){_0x19c0fc(null,path[_0x5297('0x15')](config[_0x5297('0x16')],_0x5297('0x17')));},'filename':function(_0x32c826,_0x313c9d,_0x53b9d3){_0x53b9d3(null,util[_0x5297('0x1f')](_0x5297('0x18'),_0x5297('0x25'),path['extname'](_0x313c9d[_0x5297('0x1b')])));}})});router[_0x5297('0x1c')](_0x5297('0x12'),upload[_0x5297('0x1d')](_0x5297('0x20')),controller['addFavicon']);router[_0x5297('0x26')]('/:id',auth[_0x5297('0x27')](),controller[_0x5297('0x28')]);module['exports']=router; \ No newline at end of file +var _0xb98d=['join','server/files/images/logos/','format','logo','originalname','post','single','file','addLogo','diskStorage','root','logologin','extname','addLogoLogin','%s%s','preferred','addPreferred','favicon','addFavicon','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb98d,0x9c));var _0xdb98=function(_0x2bacd1,_0x1efeed){_0x2bacd1=_0x2bacd1-0x0;var _0x5c93d9=_0xb98d[_0x2bacd1];return _0x5c93d9;};'use strict';var multer=require(_0xdb98('0x0'));var util=require(_0xdb98('0x1'));var path=require(_0xdb98('0x2'));var timeout=require(_0xdb98('0x3'));var express=require(_0xdb98('0x4'));var router=express['Router']();var fs_extra=require(_0xdb98('0x5'));var auth=require(_0xdb98('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb98('0x7'));var controller=require('./setting.controller');router[_0xdb98('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb98('0x9')]);router[_0xdb98('0x8')]('/now',controller[_0xdb98('0xa')]);router['get']('/:id',controller[_0xdb98('0xb')]);router[_0xdb98('0x8')](_0xdb98('0xc'),controller['getLogo']);router[_0xdb98('0x8')](_0xdb98('0xd'),controller[_0xdb98('0xe')]);router[_0xdb98('0x8')](_0xdb98('0xf'),controller[_0xdb98('0x10')]);router[_0xdb98('0x8')](_0xdb98('0x11'),controller['getPreferred']);router[_0xdb98('0x8')](_0xdb98('0x12'),controller[_0xdb98('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x14c811,_0x5354e8,_0x43c3bb){_0x43c3bb(null,path[_0xdb98('0x14')](config['root'],_0xdb98('0x15')));},'filename':function(_0x4ca58c,_0x2dd9fa,_0x3e9103){_0x3e9103(null,util[_0xdb98('0x16')]('%s%s',_0xdb98('0x17'),path['extname'](_0x2dd9fa[_0xdb98('0x18')])));}})});router[_0xdb98('0x19')]('/:id/logo',upload[_0xdb98('0x1a')](_0xdb98('0x1b')),controller[_0xdb98('0x1c')]);var upload=multer({'storage':multer[_0xdb98('0x1d')]({'destination':function(_0x4153d0,_0x3c57d2,_0xbf3917){_0xbf3917(null,path[_0xdb98('0x14')](config[_0xdb98('0x1e')],_0xdb98('0x15')));},'filename':function(_0x1e14a8,_0x2e4d4d,_0x10a73f){_0x10a73f(null,util[_0xdb98('0x16')]('%s%s',_0xdb98('0x1f'),path[_0xdb98('0x20')](_0x2e4d4d[_0xdb98('0x18')])));}})});router[_0xdb98('0x19')](_0xdb98('0xd'),upload[_0xdb98('0x1a')](_0xdb98('0x1b')),controller[_0xdb98('0x21')]);var upload=multer({'storage':multer[_0xdb98('0x1d')]({'destination':function(_0x370fe0,_0xbfeb6d,_0x19f5b3){_0x19f5b3(null,path[_0xdb98('0x14')](config[_0xdb98('0x1e')],_0xdb98('0x15')));},'filename':function(_0xab8bdd,_0x3c9c1e,_0x452023){_0x452023(null,util['format'](_0xdb98('0x22'),_0xdb98('0x23'),path['extname'](_0x3c9c1e['originalname'])));}})});router[_0xdb98('0x19')]('/:id/preferred',upload[_0xdb98('0x1a')]('file'),controller[_0xdb98('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x475ede,_0x4e69b4,_0x1bd986){_0x1bd986(null,path[_0xdb98('0x14')](config[_0xdb98('0x1e')],_0xdb98('0x15')));},'filename':function(_0x111aa1,_0x3384a1,_0x4b24d2){_0x4b24d2(null,util[_0xdb98('0x16')](_0xdb98('0x22'),_0xdb98('0x25'),path[_0xdb98('0x20')](_0x3384a1[_0xdb98('0x18')])));}})});router[_0xdb98('0x19')](_0xdb98('0x12'),upload[_0xdb98('0x1a')]('file'),controller[_0xdb98('0x26')]);router[_0xdb98('0x27')](_0xdb98('0x28'),auth[_0xdb98('0x29')](),controller[_0xdb98('0x2a')]);module[_0xdb98('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index aac9da3..2f0aeec 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x97385b,_0x1babc9){var _0x5712e9=function(_0x452426){while(--_0x452426){_0x97385b['push'](_0x97385b['shift']());}};_0x5712e9(++_0x1babc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4e01d6,_0x416ea4){var _0x5bd937=function(_0x8bdc00){while(--_0x8bdc00){_0x4e01d6['push'](_0x4e01d6['shift']());}};_0x5bd937(++_0x416ea4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index cf5ac02..aef3f94 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 _0x9bae=['now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','name','send','index','map','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','fields','find','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','default','addPreferred','preferred','getPreferred','Sequelize','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset'];(function(_0x3ac0fd,_0x2dfb0c){var _0x2670a9=function(_0x1bc374){while(--_0x1bc374){_0x3ac0fd['push'](_0x3ac0fd['shift']());}};_0x2670a9(++_0x2dfb0c);}(_0x9bae,0x7c));var _0xe9ba=function(_0x3377c2,_0x61a72c){_0x3377c2=_0x3377c2-0x0;var _0xdaa31=_0x9bae[_0x3377c2];return _0xdaa31;};'use strict';var emlformat=require(_0xe9ba('0x0'));var rimraf=require(_0xe9ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9ba('0x2'));var rp=require(_0xe9ba('0x3'));var moment=require(_0xe9ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe9ba('0x5'));var util=require(_0xe9ba('0x6'));var path=require(_0xe9ba('0x7'));var sox=require('sox');var csv=require(_0xe9ba('0x8'));var ejs=require(_0xe9ba('0x9'));var fs=require('fs');var fs_extra=require(_0xe9ba('0xa'));var _=require(_0xe9ba('0xb'));var squel=require(_0xe9ba('0xc'));var crypto=require(_0xe9ba('0xd'));var jsforce=require(_0xe9ba('0xe'));var deskjs=require(_0xe9ba('0xf'));var toCsv=require(_0xe9ba('0x8'));var querystring=require(_0xe9ba('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9ba('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9ba('0x12'));var as=require(_0xe9ba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9ba('0x14'))(_0xe9ba('0x15'));var utils=require(_0xe9ba('0x16'));var config=require(_0xe9ba('0x17'));var licenseUtil=require(_0xe9ba('0x18'));var db=require(_0xe9ba('0x19'))['db'];var jayson=require(_0xe9ba('0x1a'));var client=jayson[_0xe9ba('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ff854,_0x6edc7,_0x137af5,_0x1ea690){return new BPromise(function(_0x517bdd,_0x482dbc){var _0x34bae6=_0x1ea690||client;return _0x34bae6[_0xe9ba('0x1c')](_0x2ff854,_0x137af5)[_0xe9ba('0x1d')](function(_0x48247d){logger[_0xe9ba('0x1e')](_0xe9ba('0x1f'),_0x6edc7,_0xe9ba('0x20'));logger[_0xe9ba('0x21')](_0xe9ba('0x22'),_0x6edc7,_0xe9ba('0x20'),JSON[_0xe9ba('0x23')](_0x48247d));if(_0x48247d[_0xe9ba('0x24')]){if(_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x25')]===0x1f4){logger['error'](_0xe9ba('0x1f'),_0x6edc7,_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);return _0x482dbc(_0x48247d['error'][_0xe9ba('0x26')]);}logger['error']('Setting,\x20%s,\x20%s',_0x6edc7,_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);return _0x517bdd(_0x48247d[_0xe9ba('0x24')][_0xe9ba('0x26')]);}else{logger[_0xe9ba('0x1e')](_0xe9ba('0x1f'),_0x6edc7,_0xe9ba('0x20'));_0x517bdd(_0x48247d[_0xe9ba('0x27')][_0xe9ba('0x26')]);}})[_0xe9ba('0x28')](function(_0x36d65b){logger[_0xe9ba('0x24')]('Setting,\x20%s,\x20%s',_0x6edc7,_0x36d65b);_0x482dbc(_0x36d65b);});});}function respondWithStatusCode(_0x27fd40,_0xbe7e8c){_0xbe7e8c=_0xbe7e8c||0xcc;return function(_0x420051){if(_0x420051){return _0x27fd40[_0xe9ba('0x29')](_0xbe7e8c);}return _0x27fd40[_0xe9ba('0x2a')](_0xbe7e8c)[_0xe9ba('0x2b')]();};}function respondWithResult(_0x90b5a8,_0x1a1056){_0x1a1056=_0x1a1056||0xc8;return function(_0x5a60f1){if(_0x5a60f1){return _0x90b5a8[_0xe9ba('0x2a')](_0x1a1056)[_0xe9ba('0x2c')](_0x5a60f1);}};}function respondWithFilteredResult(_0x162fef,_0x3a775c){return function(_0xfcd2d1){if(_0xfcd2d1){var _0x4ec446=typeof _0x3a775c['offset']==='undefined'&&typeof _0x3a775c[_0xe9ba('0x2d')]===_0xe9ba('0x2e');var _0xa3d510=_0xfcd2d1[_0xe9ba('0x2f')];var _0x34d206=_0x4ec446?0x0:_0x3a775c['offset'];var _0x1247db=_0x4ec446?_0xfcd2d1[_0xe9ba('0x2f')]:_0x3a775c[_0xe9ba('0x30')]+_0x3a775c[_0xe9ba('0x2d')];var _0x4dcfd9;if(_0x1247db>=_0xa3d510){_0x1247db=_0xa3d510;_0x4dcfd9=0xc8;}else{_0x4dcfd9=0xce;}_0x162fef[_0xe9ba('0x2a')](_0x4dcfd9);return _0x162fef['set'](_0xe9ba('0x31'),_0x34d206+'-'+_0x1247db+'/'+_0xa3d510)[_0xe9ba('0x2c')](_0xfcd2d1);}return null;};}function patchUpdates(_0x354b80){return function(_0x26d057){try{jsonpatch[_0xe9ba('0x32')](_0x26d057,_0x354b80,!![]);}catch(_0x26d53a){return BPromise[_0xe9ba('0x33')](_0x26d53a);}return _0x26d057['save']();};}function saveUpdates(_0x4d3055,_0x163b41){return function(_0x57273b){if(_0x57273b){return _0x57273b[_0xe9ba('0x34')](_0x4d3055)['then'](function(_0x429738){return _0x429738;});}return null;};}function removeEntity(_0x11436f,_0x2a671e){return function(_0x58265e){if(_0x58265e){return _0x58265e['destroy']()[_0xe9ba('0x1d')](function(){_0x11436f[_0xe9ba('0x2a')](0xcc)[_0xe9ba('0x2b')]();});}};}function handleEntityNotFound(_0x5b285b,_0x3f11e3){return function(_0x1f16b8){if(!_0x1f16b8){_0x5b285b[_0xe9ba('0x29')](0x194);}return _0x1f16b8;};}function handleError(_0x41b32e,_0xa3e040){_0xa3e040=_0xa3e040||0x1f4;return function(_0x24bc78){logger['error'](_0x24bc78['stack']);if(_0x24bc78[_0xe9ba('0x35')]){delete _0x24bc78['name'];}_0x41b32e['status'](_0xa3e040)[_0xe9ba('0x36')](_0x24bc78);};}exports[_0xe9ba('0x37')]=function(_0x8f0a17,_0x5e44af){var _0x7d955e={},_0x4c8620={},_0x274424={'count':0x0,'rows':[]};var _0x3dfd3b=_[_0xe9ba('0x38')](db[_0xe9ba('0x39')][_0xe9ba('0x3a')],function(_0x1f6e2c){return{'name':_0x1f6e2c[_0xe9ba('0x3b')],'type':_0x1f6e2c[_0xe9ba('0x3c')]['key']};});_0x4c8620[_0xe9ba('0x3d')]=_['map'](_0x3dfd3b,_0xe9ba('0x35'));_0x4c8620[_0xe9ba('0x3e')]=_[_0xe9ba('0x3f')](_0x8f0a17['query']);_0x4c8620[_0xe9ba('0x40')]=_[_0xe9ba('0x41')](_0x4c8620[_0xe9ba('0x3d')],_0x4c8620['query']);_0x7d955e[_0xe9ba('0x42')]=_['intersection'](_0x4c8620[_0xe9ba('0x3d')],qs['fields'](_0x8f0a17[_0xe9ba('0x3e')]['fields']));_0x7d955e[_0xe9ba('0x42')]=_0x7d955e[_0xe9ba('0x42')][_0xe9ba('0x43')]?_0x7d955e['attributes']:_0x4c8620[_0xe9ba('0x3d')];if(!_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x44')](_0xe9ba('0x45'))){_0x7d955e[_0xe9ba('0x2d')]=qs['limit'](_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x2d')]);_0x7d955e[_0xe9ba('0x30')]=qs[_0xe9ba('0x30')](_0x8f0a17['query'][_0xe9ba('0x30')]);}_0x7d955e[_0xe9ba('0x46')]=qs[_0xe9ba('0x47')](_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x47')]);_0x7d955e[_0xe9ba('0x48')]=qs[_0xe9ba('0x40')](_[_0xe9ba('0x49')](_0x8f0a17[_0xe9ba('0x3e')],_0x4c8620[_0xe9ba('0x40')]),_0x3dfd3b);if(_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4a')]){_0x7d955e[_0xe9ba('0x48')]=_[_0xe9ba('0x4b')](_0x7d955e[_0xe9ba('0x48')],{'$or':_['map'](_0x3dfd3b,function(_0x37dd7b){if(_0x37dd7b[_0xe9ba('0x3c')]!==_0xe9ba('0x4c')){var _0x2a8467={};_0x2a8467[_0x37dd7b[_0xe9ba('0x35')]]={'$like':'%'+_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4a')]+'%'};return _0x2a8467;}})});}_0x7d955e=_[_0xe9ba('0x4b')]({},_0x7d955e,_0x8f0a17[_0xe9ba('0x4d')]);var _0x954dd2={'where':_0x7d955e[_0xe9ba('0x48')]};return db['Setting'][_0xe9ba('0x2f')](_0x954dd2)[_0xe9ba('0x1d')](function(_0x548b53){_0x274424[_0xe9ba('0x2f')]=_0x548b53;if(_0x8f0a17[_0xe9ba('0x3e')][_0xe9ba('0x4e')]){_0x7d955e[_0xe9ba('0x4f')]=[{'all':!![]}];}return db[_0xe9ba('0x39')][_0xe9ba('0x50')](_0x7d955e);})[_0xe9ba('0x1d')](function(_0x591558){_0x274424['rows']=_0x591558;return _0x274424;})[_0xe9ba('0x1d')](respondWithFilteredResult(_0x5e44af,_0x7d955e))[_0xe9ba('0x28')](handleError(_0x5e44af,null));};exports[_0xe9ba('0x51')]=function(_0x233c99,_0x486145){var _0x2d19da={'raw':![],'where':{'id':_0x233c99[_0xe9ba('0x52')]['id']}},_0x5b36d4={};_0x5b36d4['model']=_['keys'](db[_0xe9ba('0x39')][_0xe9ba('0x3a')]);_0x5b36d4[_0xe9ba('0x3e')]=_[_0xe9ba('0x3f')](_0x233c99['query']);_0x5b36d4['filters']=_[_0xe9ba('0x41')](_0x5b36d4['model'],_0x5b36d4[_0xe9ba('0x3e')]);_0x2d19da[_0xe9ba('0x42')]=_[_0xe9ba('0x41')](_0x5b36d4['model'],qs[_0xe9ba('0x53')](_0x233c99['query'][_0xe9ba('0x53')]));_0x2d19da['attributes']=_0x2d19da[_0xe9ba('0x42')]['length']?_0x2d19da['attributes']:_0x5b36d4[_0xe9ba('0x3d')];if(_0x233c99[_0xe9ba('0x3e')][_0xe9ba('0x4e')]){_0x2d19da[_0xe9ba('0x4f')]=[{'all':!![]}];}_0x2d19da=_[_0xe9ba('0x4b')]({},_0x2d19da,_0x233c99[_0xe9ba('0x4d')]);return db[_0xe9ba('0x39')][_0xe9ba('0x54')](_0x2d19da)['then'](handleEntityNotFound(_0x486145,null))['then'](respondWithResult(_0x486145,null))[_0xe9ba('0x28')](handleError(_0x486145,null));};exports[_0xe9ba('0x34')]=function(_0x2f40be,_0x13ddea){if(_0x2f40be[_0xe9ba('0x55')]['id']){delete _0x2f40be[_0xe9ba('0x55')]['id'];}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x2f40be[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x13ddea,null))[_0xe9ba('0x1d')](saveUpdates(_0x2f40be[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0x13ddea,null))['catch'](handleError(_0x13ddea,null));};exports[_0xe9ba('0x56')]=function(_0x3f844b,_0xeda45b,_0x2b60d9){if(_0x3f844b['file']&&_0x3f844b[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x3f844b[_0xe9ba('0x55')][_0xe9ba('0x59')]=_0x3f844b[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x3f844b[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0xeda45b,null))[_0xe9ba('0x1d')](saveUpdates(_0x3f844b[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0xeda45b,null))[_0xe9ba('0x28')](handleError(_0xeda45b,null));};exports['addLogoLogin']=function(_0x183925,_0x2c89bb,_0x21071c){if(_0x183925['file']&&_0x183925[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x183925[_0xe9ba('0x55')][_0xe9ba('0x5a')]=_0x183925[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db['Setting'][_0xe9ba('0x54')]({'where':{'id':_0x183925[_0xe9ba('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c89bb,null))[_0xe9ba('0x1d')](saveUpdates(_0x183925[_0xe9ba('0x55')],null))[_0xe9ba('0x1d')](respondWithResult(_0x2c89bb,null))[_0xe9ba('0x28')](handleError(_0x2c89bb,null));};var utilLicense=require('../../config/license/util');exports[_0xe9ba('0x5b')]=function(_0x20ead5,_0x52bd04,_0x1fa654){var _0x1989bf=_0xe9ba('0x5c');var _0x5688f2={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()[_0xe9ba('0x1d')](function(_0x4033cb){if(_0x4033cb){_0x5688f2=_0x4033cb;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x20ead5[_0xe9ba('0x52')]['id']},'attributes':['logo',_0xe9ba('0x5a'),'preferred',_0xe9ba('0x5e'),_0xe9ba('0x5f'),_0xe9ba('0x60'),'defaultPreferred',_0xe9ba('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x52bd04,null))[_0xe9ba('0x1d')](function(_0x249edc){if(_0x249edc){var _0x5a9031=_0x249edc['logo']&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config['root'],_0x1989bf,_[_0xe9ba('0x64')](_0x249edc[_0xe9ba('0x59')])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x1989bf,_[_0xe9ba('0x64')](_0x249edc[_0xe9ba('0x59')])):path[_0xe9ba('0x63')](config['root'],_0x1989bf,_['toLower'](_0xe9ba('0x66')));var _0x3298d7='default'+_[_0xe9ba('0x67')](_0xe9ba('0x59'));if(_0x249edc[_0x3298d7]||!_0x5688f2[_0xe9ba('0x68')]){_0x5a9031=path['join'](config['root'],_0x1989bf,_[_0xe9ba('0x64')](_0xe9ba('0x66')));}if(!fs[_0xe9ba('0x62')](_0x5a9031)){throw new db['Sequelize'][(_0xe9ba('0x69'))](_[_0xe9ba('0x67')](_0xe9ba('0x59'))+_0xe9ba('0x6a'));}return _0x52bd04[_0xe9ba('0x6b')](_0x5a9031);}})[_0xe9ba('0x28')](handleError(_0x52bd04,null));};var utilLicense=require(_0xe9ba('0x18'));exports['getLogoLogin']=function(_0x4a3209,_0x42bbbd,_0x21071a){var _0x393343=_0xe9ba('0x5c');var _0x19b887={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()[_0xe9ba('0x1d')](function(_0x29bc6f){if(_0x29bc6f){_0x19b887=_0x29bc6f;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x4a3209[_0xe9ba('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xe9ba('0x5e'),_0xe9ba('0x5f'),'defaultLoginLogo',_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})[_0xe9ba('0x1d')](handleEntityNotFound(_0x42bbbd,null))[_0xe9ba('0x1d')](function(_0x292a52){if(_0x292a52){var _0x108b12=_0x292a52[_0xe9ba('0x5a')]&&fs['existsSync'](path['join'](config[_0xe9ba('0x65')],_0x393343,_[_0xe9ba('0x64')](_0x292a52[_0xe9ba('0x5a')])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_['toLower'](_0x292a52['loginLogo'])):path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_['toLower'](_0xe9ba('0x6d')));var _0x2b3424=_0xe9ba('0x6e')+_[_0xe9ba('0x67')](_0xe9ba('0x5a'));if(_0x292a52[_0x2b3424]||!_0x19b887['custom']){_0x108b12=path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x393343,_[_0xe9ba('0x64')](_0xe9ba('0x6d')));}if(!fs['existsSync'](_0x108b12)){throw new db['Sequelize'][(_0xe9ba('0x69'))](_['upperFirst'](_0xe9ba('0x5a'))+_0xe9ba('0x6a'));}return _0x42bbbd['download'](_0x108b12);}})[_0xe9ba('0x28')](handleError(_0x42bbbd,null));};exports['gdpr']=function(_0x18fa63,_0x58c242){return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x18fa63[_0xe9ba('0x52')]['id']},'attributes':['securePassword']})[_0xe9ba('0x1d')](respondWithResult(_0x58c242,null))[_0xe9ba('0x28')](handleError(_0x58c242,null));};exports[_0xe9ba('0x6f')]=function(_0x528123,_0x44835b,_0x4c0c36){if(_0x528123[_0xe9ba('0x57')]&&_0x528123[_0xe9ba('0x57')][_0xe9ba('0x58')]){_0x528123[_0xe9ba('0x55')][_0xe9ba('0x70')]=_0x528123[_0xe9ba('0x57')][_0xe9ba('0x58')];}return db['Setting']['find']({'where':{'id':_0x528123['params']['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x44835b,null))[_0xe9ba('0x1d')](saveUpdates(_0x528123['body'],null))[_0xe9ba('0x1d')](respondWithResult(_0x44835b,null))[_0xe9ba('0x28')](handleError(_0x44835b,null));};var utilLicense=require(_0xe9ba('0x18'));exports[_0xe9ba('0x71')]=function(_0x568140,_0x3f67e4,_0x241f9a){var _0x314421=_0xe9ba('0x5c');var _0x274fb6={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()['then'](function(_0x2747b3){if(_0x2747b3){_0x274fb6=_0x2747b3;}return db[_0xe9ba('0x39')]['find']({'where':{'id':_0x568140[_0xe9ba('0x52')]['id']},'attributes':[_0xe9ba('0x59'),_0xe9ba('0x5a'),_0xe9ba('0x70'),_0xe9ba('0x5e'),_0xe9ba('0x5f'),'defaultLoginLogo',_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x3f67e4,null))[_0xe9ba('0x1d')](function(_0x23f75f){if(_0x23f75f){var _0x48dbce=_0x23f75f['preferred']&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_['toLower'](_0x23f75f['preferred'])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')](_0x23f75f[_0xe9ba('0x70')])):path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')]('default_preferred.png'));var _0x558072='default'+_[_0xe9ba('0x67')]('preferred');if(_0x23f75f[_0x558072]||!_0x274fb6[_0xe9ba('0x68')]||!_0x274fb6[_0xe9ba('0x70')]){_0x48dbce=path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x314421,_[_0xe9ba('0x64')]('default_preferred.png'));}if(!fs[_0xe9ba('0x62')](_0x48dbce)){throw new db[(_0xe9ba('0x72'))]['ValidationError'](_[_0xe9ba('0x67')](_0xe9ba('0x70'))+_0xe9ba('0x6a'));}return _0x3f67e4[_0xe9ba('0x6b')](_0x48dbce);}})[_0xe9ba('0x28')](handleError(_0x3f67e4,null));};exports[_0xe9ba('0x73')]=function(_0x5cda84,_0x46ae54,_0x370369){if(_0x5cda84[_0xe9ba('0x57')]&&_0x5cda84['file'][_0xe9ba('0x58')]){_0x5cda84[_0xe9ba('0x55')][_0xe9ba('0x5e')]=_0x5cda84[_0xe9ba('0x57')]['filename'];}return db[_0xe9ba('0x39')]['find']({'where':{'id':_0x5cda84[_0xe9ba('0x52')]['id']}})[_0xe9ba('0x1d')](handleEntityNotFound(_0x46ae54,null))[_0xe9ba('0x1d')](saveUpdates(_0x5cda84[_0xe9ba('0x55')],null))['then'](respondWithResult(_0x46ae54,null))[_0xe9ba('0x28')](handleError(_0x46ae54,null));};var utilLicense=require(_0xe9ba('0x18'));exports[_0xe9ba('0x74')]=function(_0x199af8,_0x57e695,_0x398cf0){var _0x38bb5c=_0xe9ba('0x5c');var _0x2f4d40={'custom':![]};return utilLicense[_0xe9ba('0x5d')]()['then'](function(_0x58f9ba){if(_0x58f9ba){_0x2f4d40=_0x58f9ba;}return db[_0xe9ba('0x39')][_0xe9ba('0x54')]({'where':{'id':_0x199af8[_0xe9ba('0x52')]['id']},'attributes':[_0xe9ba('0x59'),_0xe9ba('0x5a'),_0xe9ba('0x70'),_0xe9ba('0x5e'),_0xe9ba('0x5f'),_0xe9ba('0x60'),_0xe9ba('0x6c'),_0xe9ba('0x61')],'raw':!![]});})[_0xe9ba('0x1d')](handleEntityNotFound(_0x57e695,null))[_0xe9ba('0x1d')](function(_0x4b53dc){if(_0x4b53dc){var _0x15e403=_0x4b53dc[_0xe9ba('0x5e')]&&fs[_0xe9ba('0x62')](path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x38bb5c,_['toLower'](_0x4b53dc['favicon'])))?path[_0xe9ba('0x63')](config[_0xe9ba('0x65')],_0x38bb5c,_[_0xe9ba('0x64')](_0x4b53dc[_0xe9ba('0x5e')])):path['join'](config[_0xe9ba('0x65')],_0x38bb5c,_[_0xe9ba('0x64')]('default_favicon.ico'));var _0x2d6d94='default'+_[_0xe9ba('0x67')](_0xe9ba('0x5e'));if(_0x4b53dc[_0x2d6d94]||!_0x2f4d40[_0xe9ba('0x68')]){_0x15e403=path['join'](config['root'],_0x38bb5c,_[_0xe9ba('0x64')](_0xe9ba('0x75')));}if(!fs[_0xe9ba('0x62')](_0x15e403)){throw new db[(_0xe9ba('0x72'))][(_0xe9ba('0x69'))](_['upperFirst']('favicon')+'\x20not\x20found');}return _0x57e695[_0xe9ba('0x6b')](_0x15e403);}})[_0xe9ba('0x28')](handleError(_0x57e695,null));};exports[_0xe9ba('0x76')]=function(_0x1f64a1,_0x56cfc8){var _0x47de0c={'offset':moment()[_0xe9ba('0x77')]()};_0x47de0c[_0xe9ba('0x78')]=moment()[_0xe9ba('0x77')](_0x47de0c[_0xe9ba('0x30')])['format'](_0xe9ba('0x79'));return _0x56cfc8['status'](0xc8)[_0xe9ba('0x36')](_0x47de0c);}; \ No newline at end of file +var _0x5b7f=['defaultFavicon','default_preferred.png','getFavicon','defaultPreferred','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','index','Setting','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','addLogo','file','filename','addLogoLogin','server/files/images/logos','logo','loginLogo','defaultLogo','defaultLoginLogo','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','preferred','favicon','default_loginLogo.svg','download','gdpr','getPreferred'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5b7f,0x8c));var _0xf5b7=function(_0x110ee2,_0x32ee92){_0x110ee2=_0x110ee2-0x0;var _0x4a16a3=_0x5b7f[_0x110ee2];return _0x4a16a3;};'use strict';var emlformat=require(_0xf5b7('0x0'));var rimraf=require(_0xf5b7('0x1'));var zipdir=require(_0xf5b7('0x2'));var jsonpatch=require(_0xf5b7('0x3'));var rp=require(_0xf5b7('0x4'));var moment=require(_0xf5b7('0x5'));var BPromise=require(_0xf5b7('0x6'));var Mustache=require(_0xf5b7('0x7'));var util=require(_0xf5b7('0x8'));var path=require(_0xf5b7('0x9'));var sox=require(_0xf5b7('0xa'));var csv=require(_0xf5b7('0xb'));var ejs=require(_0xf5b7('0xc'));var fs=require('fs');var fs_extra=require(_0xf5b7('0xd'));var _=require(_0xf5b7('0xe'));var squel=require(_0xf5b7('0xf'));var crypto=require(_0xf5b7('0x10'));var jsforce=require(_0xf5b7('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf5b7('0x12'));var Redis=require(_0xf5b7('0x13'));var authService=require(_0xf5b7('0x14'));var qs=require(_0xf5b7('0x15'));var as=require(_0xf5b7('0x16'));var hardwareService=require(_0xf5b7('0x17'));var logger=require(_0xf5b7('0x18'))(_0xf5b7('0x19'));var utils=require(_0xf5b7('0x1a'));var config=require(_0xf5b7('0x1b'));var licenseUtil=require(_0xf5b7('0x1c'));var db=require(_0xf5b7('0x1d'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf5b7('0x1e')][_0xf5b7('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4841e3,_0x11a5a8,_0x83cc83,_0x5dfeb7){return new BPromise(function(_0x20cd2,_0x4f087e){var _0x4b18b5=_0x5dfeb7||client;return _0x4b18b5['request'](_0x4841e3,_0x83cc83)['then'](function(_0x231013){logger[_0xf5b7('0x20')](_0xf5b7('0x21'),_0x11a5a8,_0xf5b7('0x22'));logger[_0xf5b7('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x11a5a8,_0xf5b7('0x22'),JSON[_0xf5b7('0x24')](_0x231013));if(_0x231013[_0xf5b7('0x25')]){if(_0x231013[_0xf5b7('0x25')][_0xf5b7('0x26')]===0x1f4){logger[_0xf5b7('0x25')]('Setting,\x20%s,\x20%s',_0x11a5a8,_0x231013[_0xf5b7('0x25')][_0xf5b7('0x27')]);return _0x4f087e(_0x231013[_0xf5b7('0x25')][_0xf5b7('0x27')]);}logger[_0xf5b7('0x25')]('Setting,\x20%s,\x20%s',_0x11a5a8,_0x231013[_0xf5b7('0x25')][_0xf5b7('0x27')]);return _0x20cd2(_0x231013['error']['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x11a5a8,_0xf5b7('0x22'));_0x20cd2(_0x231013[_0xf5b7('0x28')][_0xf5b7('0x27')]);}})[_0xf5b7('0x29')](function(_0x2dc043){logger[_0xf5b7('0x25')](_0xf5b7('0x21'),_0x11a5a8,_0x2dc043);_0x4f087e(_0x2dc043);});});}function respondWithStatusCode(_0x445d22,_0x47dc6d){_0x47dc6d=_0x47dc6d||0xcc;return function(_0x348826){if(_0x348826){return _0x445d22[_0xf5b7('0x2a')](_0x47dc6d);}return _0x445d22[_0xf5b7('0x2b')](_0x47dc6d)['end']();};}function respondWithResult(_0x255c8c,_0x3f7258){_0x3f7258=_0x3f7258||0xc8;return function(_0x50af10){if(_0x50af10){return _0x255c8c[_0xf5b7('0x2b')](_0x3f7258)['json'](_0x50af10);}};}function respondWithFilteredResult(_0x450b70,_0x16046b){return function(_0x557ab5){if(_0x557ab5){var _0x40c2c4=typeof _0x16046b[_0xf5b7('0x2c')]===_0xf5b7('0x2d')&&typeof _0x16046b[_0xf5b7('0x2e')]==='undefined';var _0x3d6efc=_0x557ab5[_0xf5b7('0x2f')];var _0x574cf5=_0x40c2c4?0x0:_0x16046b[_0xf5b7('0x2c')];var _0x903891=_0x40c2c4?_0x557ab5[_0xf5b7('0x2f')]:_0x16046b[_0xf5b7('0x2c')]+_0x16046b[_0xf5b7('0x2e')];var _0x124045;if(_0x903891>=_0x3d6efc){_0x903891=_0x3d6efc;_0x124045=0xc8;}else{_0x124045=0xce;}_0x450b70[_0xf5b7('0x2b')](_0x124045);return _0x450b70[_0xf5b7('0x30')](_0xf5b7('0x31'),_0x574cf5+'-'+_0x903891+'/'+_0x3d6efc)[_0xf5b7('0x32')](_0x557ab5);}return null;};}function patchUpdates(_0x52ec8e){return function(_0x2e7375){try{jsonpatch[_0xf5b7('0x33')](_0x2e7375,_0x52ec8e,!![]);}catch(_0x1ac1b0){return BPromise[_0xf5b7('0x34')](_0x1ac1b0);}return _0x2e7375[_0xf5b7('0x35')]();};}function saveUpdates(_0x21ed70,_0x354066){return function(_0x4a93b0){if(_0x4a93b0){return _0x4a93b0[_0xf5b7('0x36')](_0x21ed70)[_0xf5b7('0x37')](function(_0x57e4aa){return _0x57e4aa;});}return null;};}function removeEntity(_0x19a674,_0x3b09f0){return function(_0x20099b){if(_0x20099b){return _0x20099b[_0xf5b7('0x38')]()[_0xf5b7('0x37')](function(){_0x19a674['status'](0xcc)[_0xf5b7('0x39')]();});}};}function handleEntityNotFound(_0x451004,_0x28ee80){return function(_0x2feff7){if(!_0x2feff7){_0x451004[_0xf5b7('0x2a')](0x194);}return _0x2feff7;};}function handleError(_0x41e146,_0x136d6c){_0x136d6c=_0x136d6c||0x1f4;return function(_0x5029e5){logger['error'](_0x5029e5['stack']);if(_0x5029e5[_0xf5b7('0x3a')]){delete _0x5029e5[_0xf5b7('0x3a')];}_0x41e146[_0xf5b7('0x2b')](_0x136d6c)[_0xf5b7('0x3b')](_0x5029e5);};}exports[_0xf5b7('0x3c')]=function(_0x22faec,_0x3f0c4d){var _0x27a9a6={},_0xce03c7={},_0x402888={'count':0x0,'rows':[]};var _0x4b609f=_['map'](db[_0xf5b7('0x3d')]['rawAttributes'],function(_0x4dd97c){return{'name':_0x4dd97c[_0xf5b7('0x3e')],'type':_0x4dd97c[_0xf5b7('0x3f')]['key']};});_0xce03c7[_0xf5b7('0x40')]=_[_0xf5b7('0x41')](_0x4b609f,_0xf5b7('0x3a'));_0xce03c7[_0xf5b7('0x42')]=_[_0xf5b7('0x43')](_0x22faec[_0xf5b7('0x42')]);_0xce03c7[_0xf5b7('0x44')]=_[_0xf5b7('0x45')](_0xce03c7[_0xf5b7('0x40')],_0xce03c7[_0xf5b7('0x42')]);_0x27a9a6[_0xf5b7('0x46')]=_[_0xf5b7('0x45')](_0xce03c7[_0xf5b7('0x40')],qs[_0xf5b7('0x47')](_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x47')]));_0x27a9a6[_0xf5b7('0x46')]=_0x27a9a6[_0xf5b7('0x46')][_0xf5b7('0x48')]?_0x27a9a6[_0xf5b7('0x46')]:_0xce03c7[_0xf5b7('0x40')];if(!_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x49')](_0xf5b7('0x4a'))){_0x27a9a6[_0xf5b7('0x2e')]=qs[_0xf5b7('0x2e')](_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x2e')]);_0x27a9a6[_0xf5b7('0x2c')]=qs[_0xf5b7('0x2c')](_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x2c')]);}_0x27a9a6[_0xf5b7('0x4b')]=qs[_0xf5b7('0x4c')](_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x4c')]);_0x27a9a6['where']=qs[_0xf5b7('0x44')](_[_0xf5b7('0x4d')](_0x22faec[_0xf5b7('0x42')],_0xce03c7[_0xf5b7('0x44')]),_0x4b609f);if(_0x22faec['query']['filter']){_0x27a9a6[_0xf5b7('0x4e')]=_[_0xf5b7('0x4f')](_0x27a9a6['where'],{'$or':_[_0xf5b7('0x41')](_0x4b609f,function(_0x2dc395){if(_0x2dc395[_0xf5b7('0x3f')]!==_0xf5b7('0x50')){var _0x660d3={};_0x660d3[_0x2dc395[_0xf5b7('0x3a')]]={'$like':'%'+_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x51')]+'%'};return _0x660d3;}})});}_0x27a9a6=_[_0xf5b7('0x4f')]({},_0x27a9a6,_0x22faec[_0xf5b7('0x52')]);var _0x3069b1={'where':_0x27a9a6[_0xf5b7('0x4e')]};return db[_0xf5b7('0x3d')][_0xf5b7('0x2f')](_0x3069b1)[_0xf5b7('0x37')](function(_0x10c940){_0x402888['count']=_0x10c940;if(_0x22faec[_0xf5b7('0x42')][_0xf5b7('0x53')]){_0x27a9a6[_0xf5b7('0x54')]=[{'all':!![]}];}return db[_0xf5b7('0x3d')][_0xf5b7('0x55')](_0x27a9a6);})[_0xf5b7('0x37')](function(_0x2c46c4){_0x402888[_0xf5b7('0x56')]=_0x2c46c4;return _0x402888;})[_0xf5b7('0x37')](respondWithFilteredResult(_0x3f0c4d,_0x27a9a6))[_0xf5b7('0x29')](handleError(_0x3f0c4d,null));};exports[_0xf5b7('0x57')]=function(_0x5872b7,_0x3e72d6){var _0xed7575={'raw':![],'where':{'id':_0x5872b7[_0xf5b7('0x58')]['id']}},_0x13ee66={};_0x13ee66[_0xf5b7('0x40')]=_[_0xf5b7('0x43')](db['Setting'][_0xf5b7('0x59')]);_0x13ee66[_0xf5b7('0x42')]=_[_0xf5b7('0x43')](_0x5872b7[_0xf5b7('0x42')]);_0x13ee66[_0xf5b7('0x44')]=_[_0xf5b7('0x45')](_0x13ee66[_0xf5b7('0x40')],_0x13ee66[_0xf5b7('0x42')]);_0xed7575['attributes']=_[_0xf5b7('0x45')](_0x13ee66[_0xf5b7('0x40')],qs[_0xf5b7('0x47')](_0x5872b7[_0xf5b7('0x42')]['fields']));_0xed7575['attributes']=_0xed7575['attributes'][_0xf5b7('0x48')]?_0xed7575[_0xf5b7('0x46')]:_0x13ee66[_0xf5b7('0x40')];if(_0x5872b7['query'][_0xf5b7('0x53')]){_0xed7575[_0xf5b7('0x54')]=[{'all':!![]}];}_0xed7575=_[_0xf5b7('0x4f')]({},_0xed7575,_0x5872b7['options']);return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')](_0xed7575)['then'](handleEntityNotFound(_0x3e72d6,null))[_0xf5b7('0x37')](respondWithResult(_0x3e72d6,null))[_0xf5b7('0x29')](handleError(_0x3e72d6,null));};exports[_0xf5b7('0x36')]=function(_0x486bee,_0x39fb9d){if(_0x486bee[_0xf5b7('0x5b')]['id']){delete _0x486bee[_0xf5b7('0x5b')]['id'];}return db[_0xf5b7('0x3d')]['find']({'where':{'id':_0x486bee['params']['id']}})['then'](handleEntityNotFound(_0x39fb9d,null))[_0xf5b7('0x37')](saveUpdates(_0x486bee[_0xf5b7('0x5b')],null))[_0xf5b7('0x37')](respondWithResult(_0x39fb9d,null))[_0xf5b7('0x29')](handleError(_0x39fb9d,null));};exports[_0xf5b7('0x5c')]=function(_0x4400ab,_0x5a7f86,_0x2c8487){if(_0x4400ab['file']&&_0x4400ab[_0xf5b7('0x5d')]['filename']){_0x4400ab['body']['logo']=_0x4400ab[_0xf5b7('0x5d')][_0xf5b7('0x5e')];}return db['Setting'][_0xf5b7('0x5a')]({'where':{'id':_0x4400ab['params']['id']}})[_0xf5b7('0x37')](handleEntityNotFound(_0x5a7f86,null))[_0xf5b7('0x37')](saveUpdates(_0x4400ab['body'],null))['then'](respondWithResult(_0x5a7f86,null))['catch'](handleError(_0x5a7f86,null));};exports[_0xf5b7('0x5f')]=function(_0x208ffc,_0x12033d,_0x237eef){if(_0x208ffc[_0xf5b7('0x5d')]&&_0x208ffc[_0xf5b7('0x5d')][_0xf5b7('0x5e')]){_0x208ffc[_0xf5b7('0x5b')]['loginLogo']=_0x208ffc[_0xf5b7('0x5d')]['filename'];}return db['Setting']['find']({'where':{'id':_0x208ffc[_0xf5b7('0x58')]['id']}})['then'](handleEntityNotFound(_0x12033d,null))[_0xf5b7('0x37')](saveUpdates(_0x208ffc[_0xf5b7('0x5b')],null))['then'](respondWithResult(_0x12033d,null))[_0xf5b7('0x29')](handleError(_0x12033d,null));};var utilLicense=require(_0xf5b7('0x1c'));exports['getLogo']=function(_0xa2eb8d,_0x333ac1,_0x22468e){var _0x1e4b01=_0xf5b7('0x60');var _0x25af8c={'custom':![]};return utilLicense['getLicense']()[_0xf5b7('0x37')](function(_0x5dafc9){if(_0x5dafc9){_0x25af8c=_0x5dafc9;}return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')]({'where':{'id':_0xa2eb8d['params']['id']},'attributes':[_0xf5b7('0x61'),_0xf5b7('0x62'),'preferred','favicon',_0xf5b7('0x63'),_0xf5b7('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xf5b7('0x37')](handleEntityNotFound(_0x333ac1,null))[_0xf5b7('0x37')](function(_0x5db682){if(_0x5db682){var _0x4a75d6=_0x5db682['logo']&&fs[_0xf5b7('0x65')](path['join'](config[_0xf5b7('0x66')],_0x1e4b01,_[_0xf5b7('0x67')](_0x5db682[_0xf5b7('0x61')])))?path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x1e4b01,_[_0xf5b7('0x67')](_0x5db682[_0xf5b7('0x61')])):path['join'](config[_0xf5b7('0x66')],_0x1e4b01,_['toLower'](_0xf5b7('0x69')));var _0x22266e=_0xf5b7('0x6a')+_[_0xf5b7('0x6b')](_0xf5b7('0x61'));if(_0x5db682[_0x22266e]||!_0x25af8c[_0xf5b7('0x6c')]){_0x4a75d6=path['join'](config[_0xf5b7('0x66')],_0x1e4b01,_[_0xf5b7('0x67')](_0xf5b7('0x69')));}if(!fs[_0xf5b7('0x65')](_0x4a75d6)){throw new db[(_0xf5b7('0x6d'))][(_0xf5b7('0x6e'))](_[_0xf5b7('0x6b')](_0xf5b7('0x61'))+_0xf5b7('0x6f'));}return _0x333ac1['download'](_0x4a75d6);}})[_0xf5b7('0x29')](handleError(_0x333ac1,null));};var utilLicense=require('../../config/license/util');exports[_0xf5b7('0x70')]=function(_0x55ebbe,_0x161f01,_0x1da192){var _0x295dc8='server/files/images/logos';var _0x71eeb8={'custom':![]};return utilLicense[_0xf5b7('0x71')]()[_0xf5b7('0x37')](function(_0x1984ae){if(_0x1984ae){_0x71eeb8=_0x1984ae;}return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')]({'where':{'id':_0x55ebbe[_0xf5b7('0x58')]['id']},'attributes':[_0xf5b7('0x61'),'loginLogo',_0xf5b7('0x72'),_0xf5b7('0x73'),_0xf5b7('0x63'),_0xf5b7('0x64'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xf5b7('0x37')](handleEntityNotFound(_0x161f01,null))[_0xf5b7('0x37')](function(_0x2c212f){if(_0x2c212f){var _0x5daf6d=_0x2c212f[_0xf5b7('0x62')]&&fs[_0xf5b7('0x65')](path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x295dc8,_[_0xf5b7('0x67')](_0x2c212f[_0xf5b7('0x62')])))?path['join'](config['root'],_0x295dc8,_[_0xf5b7('0x67')](_0x2c212f['loginLogo'])):path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x295dc8,_[_0xf5b7('0x67')](_0xf5b7('0x74')));var _0x5a5531=_0xf5b7('0x6a')+_[_0xf5b7('0x6b')]('loginLogo');if(_0x2c212f[_0x5a5531]||!_0x71eeb8[_0xf5b7('0x6c')]){_0x5daf6d=path[_0xf5b7('0x68')](config['root'],_0x295dc8,_['toLower'](_0xf5b7('0x74')));}if(!fs[_0xf5b7('0x65')](_0x5daf6d)){throw new db[(_0xf5b7('0x6d'))][(_0xf5b7('0x6e'))](_[_0xf5b7('0x6b')]('loginLogo')+_0xf5b7('0x6f'));}return _0x161f01[_0xf5b7('0x75')](_0x5daf6d);}})[_0xf5b7('0x29')](handleError(_0x161f01,null));};exports[_0xf5b7('0x76')]=function(_0x54c403,_0x5720f2){return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')]({'where':{'id':_0x54c403['params']['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x5720f2,null))[_0xf5b7('0x29')](handleError(_0x5720f2,null));};exports['addPreferred']=function(_0x2b8aa5,_0x3e80f5,_0x1a04eb){if(_0x2b8aa5[_0xf5b7('0x5d')]&&_0x2b8aa5[_0xf5b7('0x5d')][_0xf5b7('0x5e')]){_0x2b8aa5[_0xf5b7('0x5b')][_0xf5b7('0x72')]=_0x2b8aa5[_0xf5b7('0x5d')][_0xf5b7('0x5e')];}return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')]({'where':{'id':_0x2b8aa5[_0xf5b7('0x58')]['id']}})[_0xf5b7('0x37')](handleEntityNotFound(_0x3e80f5,null))[_0xf5b7('0x37')](saveUpdates(_0x2b8aa5[_0xf5b7('0x5b')],null))[_0xf5b7('0x37')](respondWithResult(_0x3e80f5,null))[_0xf5b7('0x29')](handleError(_0x3e80f5,null));};var utilLicense=require('../../config/license/util');exports[_0xf5b7('0x77')]=function(_0x57b701,_0x109f06,_0x5e3f1a){var _0xdac876=_0xf5b7('0x60');var _0x4358a9={'custom':![]};return utilLicense[_0xf5b7('0x71')]()[_0xf5b7('0x37')](function(_0x324156){if(_0x324156){_0x4358a9=_0x324156;}return db[_0xf5b7('0x3d')]['find']({'where':{'id':_0x57b701[_0xf5b7('0x58')]['id']},'attributes':[_0xf5b7('0x61'),_0xf5b7('0x62'),_0xf5b7('0x72'),'favicon',_0xf5b7('0x63'),_0xf5b7('0x64'),'defaultPreferred',_0xf5b7('0x78')],'raw':!![]});})[_0xf5b7('0x37')](handleEntityNotFound(_0x109f06,null))[_0xf5b7('0x37')](function(_0xed7f7e){if(_0xed7f7e){var _0x5e2fe2=_0xed7f7e[_0xf5b7('0x72')]&&fs['existsSync'](path['join'](config['root'],_0xdac876,_[_0xf5b7('0x67')](_0xed7f7e['preferred'])))?path[_0xf5b7('0x68')](config['root'],_0xdac876,_[_0xf5b7('0x67')](_0xed7f7e[_0xf5b7('0x72')])):path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0xdac876,_['toLower'](_0xf5b7('0x79')));var _0x490bc5=_0xf5b7('0x6a')+_['upperFirst'](_0xf5b7('0x72'));if(_0xed7f7e[_0x490bc5]||!_0x4358a9['custom']||!_0x4358a9[_0xf5b7('0x72')]){_0x5e2fe2=path['join'](config[_0xf5b7('0x66')],_0xdac876,_[_0xf5b7('0x67')](_0xf5b7('0x79')));}if(!fs[_0xf5b7('0x65')](_0x5e2fe2)){throw new db['Sequelize'][(_0xf5b7('0x6e'))](_[_0xf5b7('0x6b')](_0xf5b7('0x72'))+'\x20not\x20found');}return _0x109f06[_0xf5b7('0x75')](_0x5e2fe2);}})['catch'](handleError(_0x109f06,null));};exports['addFavicon']=function(_0x18c9f8,_0x43e0d2,_0x5610a0){if(_0x18c9f8[_0xf5b7('0x5d')]&&_0x18c9f8['file'][_0xf5b7('0x5e')]){_0x18c9f8[_0xf5b7('0x5b')][_0xf5b7('0x73')]=_0x18c9f8['file'][_0xf5b7('0x5e')];}return db[_0xf5b7('0x3d')][_0xf5b7('0x5a')]({'where':{'id':_0x18c9f8['params']['id']}})['then'](handleEntityNotFound(_0x43e0d2,null))[_0xf5b7('0x37')](saveUpdates(_0x18c9f8['body'],null))[_0xf5b7('0x37')](respondWithResult(_0x43e0d2,null))[_0xf5b7('0x29')](handleError(_0x43e0d2,null));};var utilLicense=require(_0xf5b7('0x1c'));exports[_0xf5b7('0x7a')]=function(_0x1ef348,_0x4b7d0d,_0x4d69a4){var _0x162a68='server/files/images/logos';var _0x57fe13={'custom':![]};return utilLicense[_0xf5b7('0x71')]()[_0xf5b7('0x37')](function(_0x56131f){if(_0x56131f){_0x57fe13=_0x56131f;}return db['Setting'][_0xf5b7('0x5a')]({'where':{'id':_0x1ef348[_0xf5b7('0x58')]['id']},'attributes':[_0xf5b7('0x61'),_0xf5b7('0x62'),_0xf5b7('0x72'),_0xf5b7('0x73'),'defaultLogo',_0xf5b7('0x64'),_0xf5b7('0x7b'),'defaultFavicon'],'raw':!![]});})[_0xf5b7('0x37')](handleEntityNotFound(_0x4b7d0d,null))['then'](function(_0x2303bd){if(_0x2303bd){var _0x59b695=_0x2303bd[_0xf5b7('0x73')]&&fs[_0xf5b7('0x65')](path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x162a68,_[_0xf5b7('0x67')](_0x2303bd[_0xf5b7('0x73')])))?path[_0xf5b7('0x68')](config['root'],_0x162a68,_['toLower'](_0x2303bd[_0xf5b7('0x73')])):path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x162a68,_[_0xf5b7('0x67')](_0xf5b7('0x7c')));var _0x305bf0=_0xf5b7('0x6a')+_[_0xf5b7('0x6b')](_0xf5b7('0x73'));if(_0x2303bd[_0x305bf0]||!_0x57fe13[_0xf5b7('0x6c')]){_0x59b695=path[_0xf5b7('0x68')](config[_0xf5b7('0x66')],_0x162a68,_[_0xf5b7('0x67')](_0xf5b7('0x7c')));}if(!fs['existsSync'](_0x59b695)){throw new db[(_0xf5b7('0x6d'))][(_0xf5b7('0x6e'))](_[_0xf5b7('0x6b')](_0xf5b7('0x73'))+_0xf5b7('0x6f'));}return _0x4b7d0d['download'](_0x59b695);}})[_0xf5b7('0x29')](handleError(_0x4b7d0d,null));};exports[_0xf5b7('0x7d')]=function(_0x388d3c,_0x4e75f8){var _0x4ead7d={'offset':moment()[_0xf5b7('0x7e')]()};_0x4ead7d[_0xf5b7('0x7f')]=moment()[_0xf5b7('0x7e')](_0x4ead7d[_0xf5b7('0x2c')])[_0xf5b7('0x80')](_0xf5b7('0x81'));return _0x4e75f8['status'](0xc8)[_0xf5b7('0x3b')](_0x4ead7d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 987086a..9ba6402 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x3e74,0x175));var _0x43e7=function(_0x35bbec,_0x3a0993){_0x35bbec=_0x35bbec-0x0;var _0x2ca27c=_0x3e74[_0x35bbec];return _0x2ca27c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x5e7b6c,_0x4916d0){var _0x3afdbd=function(_0x648ee6){while(--_0x648ee6){_0x5e7b6c['push'](_0x5e7b6c['shift']());}};_0x3afdbd(++_0x4916d0);}(_0x008c,0x188));var _0xc008=function(_0x226494,_0xc4b645){_0x226494=_0x226494-0x0;var _0x27b950=_0x008c[_0x226494];return _0x27b950;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 30ca0ab..4fc8fcf 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 _0xc0ea=['include','map','model','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','info','ShowSetting','Setting','find','options','raw','where','attributes'];(function(_0x2c96a0,_0x1dc72c){var _0x1eff2e=function(_0x3a80c7){while(--_0x3a80c7){_0x2c96a0['push'](_0x2c96a0['shift']());}};_0x1eff2e(++_0x1dc72c);}(_0xc0ea,0x1e1));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xac0e('0x0'));var util=require(_0xac0e('0x1'));var moment=require('moment');var BPromise=require(_0xac0e('0x2'));var rs=require(_0xac0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac0e('0x4'))['db'];var utils=require(_0xac0e('0x5'));var logger=require(_0xac0e('0x6'))(_0xac0e('0x7'));var config=require(_0xac0e('0x8'));var jayson=require(_0xac0e('0x9'));var client=jayson[_0xac0e('0xa')][_0xac0e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd4b6c,_0x1eef04,_0x26c70f){return new BPromise(function(_0x3ccb68,_0x2e74e2){return client[_0xac0e('0xc')](_0xbd4b6c,_0x26c70f)[_0xac0e('0xd')](function(_0x2c79f3){logger['info']('Setting,\x20%s,\x20%s',_0x1eef04,'request\x20sent');logger['debug'](_0xac0e('0xe'),_0x1eef04,_0xac0e('0xf'),JSON[_0xac0e('0x10')](_0x2c79f3));if(_0x2c79f3[_0xac0e('0x11')]){if(_0x2c79f3['error'][_0xac0e('0x12')]===0x1f4){logger['error'](_0xac0e('0x13'),_0x1eef04,_0x2c79f3[_0xac0e('0x11')]['message']);return _0x2e74e2(_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);}logger[_0xac0e('0x11')](_0xac0e('0x13'),_0x1eef04,_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);return _0x3ccb68(_0x2c79f3[_0xac0e('0x11')][_0xac0e('0x14')]);}else{logger[_0xac0e('0x15')](_0xac0e('0x13'),_0x1eef04,_0xac0e('0xf'));_0x3ccb68(_0x2c79f3['result'][_0xac0e('0x14')]);}})['catch'](function(_0x4b11ab){logger[_0xac0e('0x11')](_0xac0e('0x13'),_0x1eef04,_0x4b11ab);_0x2e74e2(_0x4b11ab);});});}exports[_0xac0e('0x16')]=function(_0x4740ee){var _0x583a75=this;return new Promise(function(_0x151476,_0x765a6c){return db[_0xac0e('0x17')][_0xac0e('0x18')]({'raw':_0x4740ee[_0xac0e('0x19')]?_0x4740ee['options'][_0xac0e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4740ee['options']?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1b')]||null:null,'attributes':_0x4740ee[_0xac0e('0x19')]?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1c')]||null:null,'include':_0x4740ee[_0xac0e('0x19')]?_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1d')]?_[_0xac0e('0x1e')](_0x4740ee[_0xac0e('0x19')][_0xac0e('0x1d')],function(_0x56ae6b){return{'model':db[_0x56ae6b[_0xac0e('0x1f')]],'as':_0x56ae6b['as'],'attributes':_0x56ae6b[_0xac0e('0x1c')],'include':_0x56ae6b[_0xac0e('0x1d')]?_[_0xac0e('0x1e')](_0x56ae6b[_0xac0e('0x1d')],function(_0x312e51){return{'model':db[_0x312e51['model']],'as':_0x312e51['as'],'attributes':_0x312e51[_0xac0e('0x1c')],'include':_0x312e51['include']?_[_0xac0e('0x1e')](_0x312e51['include'],function(_0x5c66bc){return{'model':db[_0x5c66bc[_0xac0e('0x1f')]],'as':_0x5c66bc['as'],'attributes':_0x5c66bc[_0xac0e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xac0e('0xd')](function(_0x2d0daf){logger[_0xac0e('0x15')]('ShowSetting',_0x4740ee);logger[_0xac0e('0x20')](_0xac0e('0x16'),_0x4740ee,JSON[_0xac0e('0x10')](_0x2d0daf));_0x151476(_0x2d0daf);})[_0xac0e('0x21')](function(_0x47f617){logger['error'](_0xac0e('0x16'),_0x47f617[_0xac0e('0x14')],_0x4740ee);_0x765a6c(_0x583a75[_0xac0e('0x11')](0x1f4,_0x47f617[_0xac0e('0x14')]));});});}; \ No newline at end of file +var _0x4562=['map','include','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSetting','Setting','options','raw','attributes'];(function(_0x36c086,_0x53cba9){var _0x58bacc=function(_0x528235){while(--_0x528235){_0x36c086['push'](_0x36c086['shift']());}};_0x58bacc(++_0x53cba9);}(_0x4562,0x108));var _0x2456=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4562[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2456('0x0'));var util=require(_0x2456('0x1'));var moment=require(_0x2456('0x2'));var BPromise=require('bluebird');var rs=require(_0x2456('0x3'));var fs=require('fs');var Redis=require(_0x2456('0x4'));var db=require(_0x2456('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2456('0x6'))(_0x2456('0x7'));var config=require(_0x2456('0x8'));var jayson=require(_0x2456('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ba3fc,_0x2f1a98,_0x3e5497){return new BPromise(function(_0x8ce710,_0x5fea3c){return client[_0x2456('0xa')](_0x1ba3fc,_0x3e5497)[_0x2456('0xb')](function(_0x52063f){logger[_0x2456('0xc')](_0x2456('0xd'),_0x2f1a98,_0x2456('0xe'));logger[_0x2456('0xf')](_0x2456('0x10'),_0x2f1a98,_0x2456('0xe'),JSON['stringify'](_0x52063f));if(_0x52063f['error']){if(_0x52063f[_0x2456('0x11')]['code']===0x1f4){logger[_0x2456('0x11')](_0x2456('0xd'),_0x2f1a98,_0x52063f[_0x2456('0x11')][_0x2456('0x12')]);return _0x5fea3c(_0x52063f[_0x2456('0x11')][_0x2456('0x12')]);}logger[_0x2456('0x11')](_0x2456('0xd'),_0x2f1a98,_0x52063f[_0x2456('0x11')]['message']);return _0x8ce710(_0x52063f[_0x2456('0x11')]['message']);}else{logger[_0x2456('0xc')](_0x2456('0xd'),_0x2f1a98,_0x2456('0xe'));_0x8ce710(_0x52063f[_0x2456('0x13')][_0x2456('0x12')]);}})[_0x2456('0x14')](function(_0x5ae6d7){logger[_0x2456('0x11')]('Setting,\x20%s,\x20%s',_0x2f1a98,_0x5ae6d7);_0x5fea3c(_0x5ae6d7);});});}exports[_0x2456('0x15')]=function(_0x43c26f){var _0x301c00=this;return new Promise(function(_0x2c841d,_0x126a1b){return db[_0x2456('0x16')]['find']({'raw':_0x43c26f[_0x2456('0x17')]?_0x43c26f[_0x2456('0x17')][_0x2456('0x18')]===undefined?!![]:![]:!![],'where':_0x43c26f[_0x2456('0x17')]?_0x43c26f[_0x2456('0x17')]['where']||null:null,'attributes':_0x43c26f[_0x2456('0x17')]?_0x43c26f[_0x2456('0x17')][_0x2456('0x19')]||null:null,'include':_0x43c26f[_0x2456('0x17')]?_0x43c26f[_0x2456('0x17')]['include']?_[_0x2456('0x1a')](_0x43c26f[_0x2456('0x17')]['include'],function(_0x3c66e4){return{'model':db[_0x3c66e4['model']],'as':_0x3c66e4['as'],'attributes':_0x3c66e4[_0x2456('0x19')],'include':_0x3c66e4[_0x2456('0x1b')]?_[_0x2456('0x1a')](_0x3c66e4[_0x2456('0x1b')],function(_0x1ad770){return{'model':db[_0x1ad770['model']],'as':_0x1ad770['as'],'attributes':_0x1ad770[_0x2456('0x19')],'include':_0x1ad770['include']?_[_0x2456('0x1a')](_0x1ad770[_0x2456('0x1b')],function(_0x529205){return{'model':db[_0x529205[_0x2456('0x1c')]],'as':_0x529205['as'],'attributes':_0x529205['attributes']};}):[]};}):[]};}):[]:[]})[_0x2456('0xb')](function(_0x2c9d5a){logger[_0x2456('0xc')](_0x2456('0x15'),_0x43c26f);logger['debug'](_0x2456('0x15'),_0x43c26f,JSON['stringify'](_0x2c9d5a));_0x2c841d(_0x2c9d5a);})[_0x2456('0x14')](function(_0x9e181d){logger[_0x2456('0x11')]('ShowSetting',_0x9e181d[_0x2456('0x12')],_0x43c26f);_0x126a1b(_0x301c00['error'](0x1f4,_0x9e181d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 15695ac..d57f639 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'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['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x48eddc,_0x5729b2){var _0xc8e91f=function(_0x1df926){while(--_0x1df926){_0x48eddc['push'](_0x48eddc['shift']());}};_0xc8e91f(++_0x5729b2);}(_0xe14b,0x93));var _0xbe14=function(_0x286348,_0x486aab){_0x286348=_0x286348-0x0;var _0x39f086=_0xe14b[_0x286348];return _0x39f086;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 35c918f..c37e027 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 _0x4902=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x14a1a4,_0x599092){var _0x3f6201=function(_0x4ca5c5){while(--_0x4ca5c5){_0x14a1a4['push'](_0x14a1a4['shift']());}};_0x3f6201(++_0x599092);}(_0x4902,0xa2));var _0x2490=function(_0x1edaf7,_0x186509){_0x1edaf7=_0x1edaf7-0x0;var _0x5270b8=_0x4902[_0x1edaf7];return _0x5270b8;};'use strict';var Sequelize=require(_0x2490('0x0'));var rs=require(_0x2490('0x1'));module[_0x2490('0x2')]={'name':{'type':Sequelize[_0x2490('0x3')],'unique':_0x2490('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x2490('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2490('0x3')],'defaultValue':function(){return rs[_0x2490('0x5')]();}},'phone':{'type':Sequelize[_0x2490('0x3')]},'type':{'type':Sequelize[_0x2490('0x6')](_0x2490('0x7'),_0x2490('0x8'),_0x2490('0x9'),_0x2490('0xa'),_0x2490('0xb'),_0x2490('0xc'),_0x2490('0xd'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x2490('0x3')]},'authId':{'type':Sequelize[_0x2490('0x3')]},'authToken':{'type':Sequelize[_0x2490('0x3')]},'smsMethod':{'type':Sequelize[_0x2490('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2490('0x3')]},'applicationId':{'type':Sequelize[_0x2490('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2490('0x3')]},'deliveryReport':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x2490('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2490('0xf')],'defaultValue':function(){return _0x2490('0x10');}},'notificationSound':{'type':Sequelize[_0x2490('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2490('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2490('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2490('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2490('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2490('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2490('0x13'),'set':function(_0x2574c1){if(!_0x2574c1)this[_0x2490('0x14')](_0x2490('0x15'),null);this[_0x2490('0x14')](_0x2490('0x16'),_0x2574c1);}}}; \ No newline at end of file +var _0x6c00=['BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','clicksend','plivo','infobip','intelepeer','TEXT'];(function(_0x30d9bf,_0x359bb6){var _0x2be61e=function(_0x3d5aab){while(--_0x3d5aab){_0x30d9bf['push'](_0x30d9bf['shift']());}};_0x2be61e(++_0x359bb6);}(_0x6c00,0x113));var _0x06c0=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x6c00[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x06c0('0x0'));var rs=require(_0x06c0('0x1'));module[_0x06c0('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x06c0('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x06c0('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x06c0('0x4')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x06c0('0x4')]},'type':{'type':Sequelize[_0x06c0('0x5')](_0x06c0('0x6'),_0x06c0('0x7'),'connectel',_0x06c0('0x8'),_0x06c0('0x9'),'clickatell','bandwidth','csc',_0x06c0('0xa'),_0x06c0('0xb'))},'accountSid':{'type':Sequelize[_0x06c0('0x4')]},'authId':{'type':Sequelize[_0x06c0('0x4')]},'authToken':{'type':Sequelize[_0x06c0('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x06c0('0x4')]},'password':{'type':Sequelize[_0x06c0('0x4')]},'apiKey':{'type':Sequelize[_0x06c0('0x4')]},'applicationId':{'type':Sequelize[_0x06c0('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x06c0('0x4')]},'notificationTemplate':{'type':Sequelize[_0x06c0('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x06c0('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x06c0('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x06c0('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x06c0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x06c0('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x06c0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x06c0('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x06c0('0xd')],'defaultValue':![],'comment':_0x06c0('0xf'),'set':function(_0x404330){if(!_0x404330)this['setDataValue'](_0x06c0('0x10'),null);this['setDataValue'](_0x06c0('0x11'),_0x404330);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f9b6503..7d7374b 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 _0x9ae4=['UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','getApplications','Contact','User','Owner','Tag','Tags','color','tag','List','out','SmsMessage','Messages','dataValues','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','received\x20delivery\x20report\x20from','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','get','SmsAccounts','end','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','Disposition','getDispositions','findOne','nolimit','SmsAccountId','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','sms','SmsApplication','Applications','applications','priority','account','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','mobile','twilio','from','Body','MessageSid','skebby','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','infobip','text','results','csc','segmentedMessage','clickatell','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','ListId','updatedAt','DESC','list','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','AttachmentId'];(function(_0x5e5dac,_0xd06afc){var _0xc846b3=function(_0x31d171){while(--_0x31d171){_0x5e5dac['push'](_0x5e5dac['shift']());}};_0xc846b3(++_0xd06afc);}(_0x9ae4,0x119));var _0x49ae=function(_0x28a3b8,_0x42072d){_0x28a3b8=_0x28a3b8-0x0;var _0x3fa09a=_0x9ae4[_0x28a3b8];return _0x3fa09a;};'use strict';var emlformat=require(_0x49ae('0x0'));var rimraf=require(_0x49ae('0x1'));var zipdir=require(_0x49ae('0x2'));var jsonpatch=require(_0x49ae('0x3'));var rp=require('request-promise');var moment=require(_0x49ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x49ae('0x5'));var sox=require('sox');var csv=require(_0x49ae('0x6'));var ejs=require(_0x49ae('0x7'));var fs=require('fs');var fs_extra=require(_0x49ae('0x8'));var _=require(_0x49ae('0x9'));var squel=require(_0x49ae('0xa'));var crypto=require(_0x49ae('0xb'));var jsforce=require(_0x49ae('0xc'));var deskjs=require(_0x49ae('0xd'));var toCsv=require(_0x49ae('0x6'));var querystring=require(_0x49ae('0xe'));var Papa=require(_0x49ae('0xf'));var Redis=require(_0x49ae('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49ae('0x11'));var as=require(_0x49ae('0x12'));var hardwareService=require(_0x49ae('0x13'));var logger=require('../../config/logger')(_0x49ae('0x14'));var utils=require(_0x49ae('0x15'));var config=require(_0x49ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x49ae('0x17'))['db'];config[_0x49ae('0x18')]=_[_0x49ae('0x19')](config[_0x49ae('0x18')],{'host':_0x49ae('0x1a'),'port':0x18eb});var socket=require(_0x49ae('0x1b'))(new Redis(config['redis']));require(_0x49ae('0x1c'))[_0x49ae('0x1d')](socket);var jayson=require(_0x49ae('0x1e'));var client=jayson[_0x49ae('0x1f')][_0x49ae('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e09d3,_0x576374,_0x114904,_0x471dd0){return new BPromise(function(_0x599e5c,_0x5e5966){var _0x5f11d4=_0x471dd0||client;return _0x5f11d4[_0x49ae('0x21')](_0x1e09d3,_0x114904)['then'](function(_0x1a5a81){logger[_0x49ae('0x22')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x49ae('0x23'));logger['debug'](_0x49ae('0x24'),_0x576374,_0x49ae('0x23'),JSON[_0x49ae('0x25')](_0x1a5a81));if(_0x1a5a81[_0x49ae('0x26')]){if(_0x1a5a81['error'][_0x49ae('0x27')]===0x1f4){logger['error'](_0x49ae('0x28'),_0x576374,_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);return _0x5e5966(_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x576374,_0x1a5a81[_0x49ae('0x26')]['message']);return _0x599e5c(_0x1a5a81[_0x49ae('0x26')][_0x49ae('0x29')]);}else{logger[_0x49ae('0x22')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x49ae('0x23'));_0x599e5c(_0x1a5a81[_0x49ae('0x2a')][_0x49ae('0x29')]);}})[_0x49ae('0x2b')](function(_0x2913ce){logger[_0x49ae('0x26')]('SmsAccount,\x20%s,\x20%s',_0x576374,_0x2913ce);_0x5e5966(_0x2913ce);});});}function respondWithStatusCode(_0x2969c8,_0x56182d){_0x56182d=_0x56182d||0xcc;return function(_0x5148e6){if(_0x5148e6){return _0x2969c8[_0x49ae('0x2c')](_0x56182d);}return _0x2969c8['status'](_0x56182d)['end']();};}function respondWithResult(_0x20e28d,_0x12e958){_0x12e958=_0x12e958||0xc8;return function(_0x5d1cb2){if(_0x5d1cb2){return _0x20e28d[_0x49ae('0x2d')](_0x12e958)[_0x49ae('0x2e')](_0x5d1cb2);}};}function respondWithFilteredResult(_0x53a19c,_0x3ad341){return function(_0x5a4477){if(_0x5a4477){var _0x504b65=typeof _0x3ad341[_0x49ae('0x2f')]===_0x49ae('0x30')&&typeof _0x3ad341['limit']===_0x49ae('0x30');var _0xf41e79=_0x5a4477['count'];var _0x3e6a26=_0x504b65?0x0:_0x3ad341['offset'];var _0x372bb5=_0x504b65?_0x5a4477[_0x49ae('0x31')]:_0x3ad341[_0x49ae('0x2f')]+_0x3ad341[_0x49ae('0x32')];var _0x24dcd5;if(_0x372bb5>=_0xf41e79){_0x372bb5=_0xf41e79;_0x24dcd5=0xc8;}else{_0x24dcd5=0xce;}_0x53a19c[_0x49ae('0x2d')](_0x24dcd5);return _0x53a19c[_0x49ae('0x33')]('Content-Range',_0x3e6a26+'-'+_0x372bb5+'/'+_0xf41e79)[_0x49ae('0x2e')](_0x5a4477);}return null;};}function patchUpdates(_0x1ba0fb){return function(_0x279ec8){try{jsonpatch['apply'](_0x279ec8,_0x1ba0fb,!![]);}catch(_0x57729e){return BPromise[_0x49ae('0x34')](_0x57729e);}return _0x279ec8[_0x49ae('0x35')]();};}function saveUpdates(_0x3919c0,_0x53f2f9){return function(_0x241083){if(_0x241083){return _0x241083[_0x49ae('0x36')](_0x3919c0)[_0x49ae('0x37')](function(_0x5ca60d){return _0x5ca60d;});}return null;};}function removeEntity(_0x10fde5,_0x2f4501){return function(_0x88efca){if(_0x88efca){return _0x88efca[_0x49ae('0x38')]()['then'](function(){var _0x148e24=_0x88efca[_0x49ae('0x39')]({'plain':!![]});var _0x32b369=_0x49ae('0x3a');return db['UserProfileResource'][_0x49ae('0x38')]({'where':{'type':_0x32b369,'resourceId':_0x148e24['id']}})[_0x49ae('0x37')](function(){return _0x88efca;});})[_0x49ae('0x37')](function(){_0x10fde5[_0x49ae('0x2d')](0xcc)[_0x49ae('0x3b')]();});}};}function handleEntityNotFound(_0x3c859f,_0x599ee4){return function(_0x2f0797){if(!_0x2f0797){_0x3c859f[_0x49ae('0x2c')](0x194);}return _0x2f0797;};}function handleError(_0x2bf808,_0x1d215d){_0x1d215d=_0x1d215d||0x1f4;return function(_0x3b3ab1){logger[_0x49ae('0x26')](_0x3b3ab1['stack']);if(_0x3b3ab1[_0x49ae('0x3c')]){delete _0x3b3ab1[_0x49ae('0x3c')];}_0x2bf808[_0x49ae('0x2d')](_0x1d215d)[_0x49ae('0x3d')](_0x3b3ab1);};}exports[_0x49ae('0x3e')]=function(_0x2a3e74,_0x464262){var _0x3e638f={'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]},_0x2dce96={},_0x278326={'count':0x0,'rows':[]};var _0x57c76f=_[_0x49ae('0x41')](db[_0x49ae('0x42')][_0x49ae('0x43')],function(_0x458243){return{'name':_0x458243[_0x49ae('0x44')],'type':_0x458243[_0x49ae('0x45')][_0x49ae('0x46')]};});_0x2dce96[_0x49ae('0x47')]=_[_0x49ae('0x41')](_0x57c76f,_0x49ae('0x3c'));_0x2dce96[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x2a3e74['query']);_0x2dce96[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x2dce96['model'],_0x2dce96['query']);_0x3e638f[_0x49ae('0x4c')]=_['intersection'](_0x2dce96[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x3e638f[_0x49ae('0x4c')]=_0x3e638f[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x3e638f[_0x49ae('0x4c')]:_0x2dce96[_0x49ae('0x47')];if(!_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x4f')]('nolimit')){_0x3e638f[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x32')]);_0x3e638f[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x3e638f[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x2a3e74['query']['sort']);_0x3e638f['where']=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x2a3e74['query'],_0x2dce96[_0x49ae('0x4a')]),_0x57c76f);if(_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x53')]){_0x3e638f[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x3e638f['where'],{'$or':_[_0x49ae('0x41')](_0x57c76f,function(_0x446443){if(_0x446443[_0x49ae('0x45')]!==_0x49ae('0x56')){var _0x48f0cb={};_0x48f0cb[_0x446443['name']]={'$like':'%'+_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x48f0cb;}})});}_0x3e638f=_[_0x49ae('0x55')]({},_0x3e638f,_0x2a3e74[_0x49ae('0x57')]);var _0x5751ea={'where':_0x3e638f['where']};return db[_0x49ae('0x42')]['count'](_0x5751ea)[_0x49ae('0x37')](function(_0x34a8b3){_0x278326[_0x49ae('0x31')]=_0x34a8b3;if(_0x2a3e74[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3e638f['include']=[{'all':!![]}];}return db['SmsAccount'][_0x49ae('0x59')](_0x3e638f);})[_0x49ae('0x37')](function(_0x10e700){_0x278326[_0x49ae('0x5a')]=_0x10e700;return _0x278326;})[_0x49ae('0x37')](respondWithFilteredResult(_0x464262,_0x3e638f))['catch'](handleError(_0x464262,null));};exports[_0x49ae('0x5b')]=function(_0x118f9d,_0x51e776){var _0x3acf24={'raw':![],'where':{'id':_0x118f9d[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]},_0x2360b3={};_0x2360b3[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x42')][_0x49ae('0x43')]);_0x2360b3[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x118f9d[_0x49ae('0x48')]);_0x2360b3[_0x49ae('0x4a')]=_['intersection'](_0x2360b3[_0x49ae('0x47')],_0x2360b3['query']);_0x3acf24[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x2360b3[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x118f9d['query']['fields']));_0x3acf24[_0x49ae('0x4c')]=_0x3acf24['attributes'][_0x49ae('0x4e')]?_0x3acf24[_0x49ae('0x4c')]:_0x2360b3[_0x49ae('0x47')];if(_0x118f9d[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3acf24[_0x49ae('0x5d')]=[{'all':!![]}];}_0x3acf24=_[_0x49ae('0x55')]({},_0x3acf24,_0x118f9d[_0x49ae('0x57')]);return db[_0x49ae('0x42')][_0x49ae('0x5e')](_0x3acf24)[_0x49ae('0x37')](handleEntityNotFound(_0x51e776,null))[_0x49ae('0x37')](respondWithResult(_0x51e776,null))[_0x49ae('0x2b')](handleError(_0x51e776,null));};exports[_0x49ae('0x5f')]=function(_0x56ec9f,_0xd50aa){return db[_0x49ae('0x42')]['create'](_0x56ec9f['body'],{})[_0x49ae('0x37')](function(_0x1e7209){var _0x2d8e84=_0x56ec9f[_0x49ae('0x60')][_0x49ae('0x39')]({'plain':!![]});if(!_0x2d8e84)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d8e84[_0x49ae('0x61')]===_0x49ae('0x60')){var _0x1288c8=_0x1e7209[_0x49ae('0x39')]({'plain':!![]});var _0x1718d8=_0x49ae('0x3a');return db[_0x49ae('0x62')]['find']({'where':{'name':_0x1718d8,'userProfileId':_0x2d8e84[_0x49ae('0x63')]},'raw':!![]})[_0x49ae('0x37')](function(_0x4da759){if(_0x4da759&&_0x4da759[_0x49ae('0x64')]===0x0){return db[_0x49ae('0x65')][_0x49ae('0x5f')]({'name':_0x1288c8[_0x49ae('0x3c')],'resourceId':_0x1288c8['id'],'type':_0x4da759[_0x49ae('0x3c')],'sectionId':_0x4da759['id']},{})[_0x49ae('0x37')](function(){return _0x1e7209;});}else{return _0x1e7209;}})[_0x49ae('0x2b')](function(_0x46a209){logger[_0x49ae('0x26')](_0x49ae('0x66'),_0x46a209);throw _0x46a209;});}return _0x1e7209;})[_0x49ae('0x37')](respondWithResult(_0xd50aa,0xc9))[_0x49ae('0x2b')](handleError(_0xd50aa,null));};exports[_0x49ae('0x36')]=function(_0x2a74eb,_0x3d1854){if(_0x2a74eb[_0x49ae('0x67')]['id']){delete _0x2a74eb['body']['id'];}return db['SmsAccount'][_0x49ae('0x5e')]({'where':{'id':_0x2a74eb[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x3f')],'as':_0x49ae('0x40')}]})[_0x49ae('0x37')](handleEntityNotFound(_0x3d1854,null))[_0x49ae('0x37')](saveUpdates(_0x2a74eb[_0x49ae('0x67')],null))[_0x49ae('0x37')](respondWithResult(_0x3d1854,null))[_0x49ae('0x2b')](handleError(_0x3d1854,null));};exports[_0x49ae('0x38')]=function(_0x511846,_0x537db1){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x511846[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x537db1,null))[_0x49ae('0x37')](removeEntity(_0x537db1,null))[_0x49ae('0x2b')](handleError(_0x537db1,null));};exports['describe']=function(_0x1710b0,_0x468149){return db[_0x49ae('0x42')]['describe']()['then'](respondWithResult(_0x468149,null))[_0x49ae('0x2b')](handleError(_0x468149,null));};exports[_0x49ae('0x68')]=function(_0x5d3f28,_0x3f2046,_0xbd7bb6){if(_0x5d3f28['body']['id']){delete _0x5d3f28[_0x49ae('0x67')]['id'];}return db[_0x49ae('0x42')]['find']({'where':{'id':_0x5d3f28[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x3f2046,null))[_0x49ae('0x37')](function(_0x263f06){if(_0x263f06){_0x5d3f28[_0x49ae('0x67')]['SmsAccountId']=_0x263f06['id'];return db[_0x49ae('0x69')][_0x49ae('0x5f')](_0x5d3f28['body']);}})[_0x49ae('0x37')](respondWithResult(_0x3f2046,null))[_0x49ae('0x2b')](handleError(_0x3f2046,null));};exports[_0x49ae('0x6a')]=function(_0x38d83a,_0x2e98f1,_0x1ba96b){var _0x3aaf52={'raw':![],'where':{}};var _0x34122d={};var _0x58d53c={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0x38d83a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x2e98f1,null))[_0x49ae('0x37')](function(_0x5e9e30){if(_0x5e9e30){_0x34122d[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x69')]['rawAttributes']);_0x34122d[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x38d83a[_0x49ae('0x48')]);_0x34122d[_0x49ae('0x4a')]=_['intersection'](_0x34122d[_0x49ae('0x47')],_0x34122d[_0x49ae('0x48')]);_0x3aaf52[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x34122d[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x38d83a[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x3aaf52[_0x49ae('0x4c')]=_0x3aaf52[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x3aaf52['attributes']:_0x34122d[_0x49ae('0x47')];if(!_0x38d83a[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x3aaf52[_0x49ae('0x32')]=qs['limit'](_0x38d83a['query']['limit']);_0x3aaf52[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x38d83a[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x3aaf52[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x38d83a[_0x49ae('0x48')]['sort']);_0x3aaf52[_0x49ae('0x54')]=qs['filters'](_[_0x49ae('0x52')](_0x38d83a[_0x49ae('0x48')],_0x34122d[_0x49ae('0x4a')]));_0x3aaf52[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x5e9e30['id'];if(_0x38d83a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x3aaf52[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x3aaf52['where'],{'$or':_[_0x49ae('0x41')](_0x3aaf52['attributes'],function(_0x47afe4){var _0x53b24d={};_0x53b24d[_0x47afe4]={'$like':'%'+_0x38d83a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x53b24d;})});}_0x3aaf52=_['merge']({},_0x3aaf52,_0x38d83a[_0x49ae('0x57')]);return db['Disposition'][_0x49ae('0x31')]({'where':_0x3aaf52[_0x49ae('0x54')]})[_0x49ae('0x37')](function(_0x21a683){_0x58d53c[_0x49ae('0x31')]=_0x21a683;if(_0x38d83a[_0x49ae('0x48')][_0x49ae('0x58')]){_0x3aaf52[_0x49ae('0x5d')]=[{'all':!![]}];}return db[_0x49ae('0x69')][_0x49ae('0x59')](_0x3aaf52);})[_0x49ae('0x37')](function(_0x43d199){_0x58d53c[_0x49ae('0x5a')]=_0x43d199;return _0x58d53c;});}})['then'](respondWithFilteredResult(_0x2e98f1,_0x3aaf52))[_0x49ae('0x2b')](handleError(_0x2e98f1,null));};exports[_0x49ae('0x6e')]=function(_0xde2340,_0x4150ed,_0x2de762){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0xde2340[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4150ed,null))[_0x49ae('0x37')](function(_0x441eff){if(_0x441eff){return _0x441eff[_0x49ae('0x6e')](_0xde2340[_0x49ae('0x48')]['ids']);}})[_0x49ae('0x37')](respondWithStatusCode(_0x4150ed,null))[_0x49ae('0x2b')](handleError(_0x4150ed,null));};exports[_0x49ae('0x6f')]=function(_0x2d02e2,_0x2865db,_0x344e95){if(_0x2d02e2[_0x49ae('0x67')]['id']){delete _0x2d02e2[_0x49ae('0x67')]['id'];}return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x2d02e2['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x2865db,null))[_0x49ae('0x37')](function(_0x449c92){if(_0x449c92){_0x2d02e2[_0x49ae('0x67')]['SmsAccountId']=_0x449c92['id'];return db['CannedAnswer'][_0x49ae('0x5f')](_0x2d02e2[_0x49ae('0x67')]);}})[_0x49ae('0x37')](respondWithResult(_0x2865db,null))['catch'](handleError(_0x2865db,null));};exports['getAnswers']=function(_0x311e8a,_0x144d70,_0x1389dd){var _0x4a535e={'raw':![],'where':{}};var _0x537021={};var _0x326ae4={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0x311e8a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x144d70,null))[_0x49ae('0x37')](function(_0x7a7593){if(_0x7a7593){_0x537021[_0x49ae('0x47')]=_[_0x49ae('0x49')](db[_0x49ae('0x70')][_0x49ae('0x43')]);_0x537021[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x311e8a['query']);_0x537021[_0x49ae('0x4a')]=_['intersection'](_0x537021[_0x49ae('0x47')],_0x537021['query']);_0x4a535e['attributes']=_[_0x49ae('0x4b')](_0x537021[_0x49ae('0x47')],qs[_0x49ae('0x4d')](_0x311e8a['query'][_0x49ae('0x4d')]));_0x4a535e[_0x49ae('0x4c')]=_0x4a535e[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x4a535e[_0x49ae('0x4c')]:_0x537021['model'];if(!_0x311e8a[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x4a535e['limit']=qs['limit'](_0x311e8a[_0x49ae('0x48')]['limit']);_0x4a535e['offset']=qs[_0x49ae('0x2f')](_0x311e8a[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x4a535e[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x311e8a[_0x49ae('0x48')][_0x49ae('0x51')]);_0x4a535e[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x311e8a[_0x49ae('0x48')],_0x537021[_0x49ae('0x4a')]));_0x4a535e[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x7a7593['id'];if(_0x311e8a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x4a535e[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x4a535e['where'],{'$or':_[_0x49ae('0x41')](_0x4a535e[_0x49ae('0x4c')],function(_0x27d115){var _0x2700da={};_0x2700da[_0x27d115]={'$like':'%'+_0x311e8a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x2700da;})});}_0x4a535e=_[_0x49ae('0x55')]({},_0x4a535e,_0x311e8a[_0x49ae('0x57')]);return db[_0x49ae('0x70')][_0x49ae('0x31')]({'where':_0x4a535e[_0x49ae('0x54')]})[_0x49ae('0x37')](function(_0x4af2d1){_0x326ae4[_0x49ae('0x31')]=_0x4af2d1;if(_0x311e8a['query'][_0x49ae('0x58')]){_0x4a535e['include']=[{'all':!![]}];}return db[_0x49ae('0x70')][_0x49ae('0x59')](_0x4a535e);})['then'](function(_0x28bcea){_0x326ae4['rows']=_0x28bcea;return _0x326ae4;});}})[_0x49ae('0x37')](respondWithFilteredResult(_0x144d70,_0x4a535e))[_0x49ae('0x2b')](handleError(_0x144d70,null));};exports[_0x49ae('0x71')]=function(_0x2966f2,_0x28b132,_0x2a8592){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x2966f2['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x28b132,null))[_0x49ae('0x37')](function(_0x1ad60a){if(_0x1ad60a){return _0x1ad60a[_0x49ae('0x71')](_0x2966f2[_0x49ae('0x48')][_0x49ae('0x72')]);}})[_0x49ae('0x37')](respondWithStatusCode(_0x28b132,null))['catch'](handleError(_0x28b132,null));};exports['notify']=function(_0x23b225,_0x14817f,_0x37690d){var _0x2211b8={'channel':_0x49ae('0x73')};var _0x4ea021=[];var _0x43ff96=[];var _0x3a83e5={};return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x23b225[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x74')],'as':_0x49ae('0x75')}]})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x21208b){_0x2211b8['account']=_0x21208b;_0x2211b8[_0x49ae('0x76')]=_['orderBy'](_0x21208b[_0x49ae('0x75')],[_0x49ae('0x77')],['asc']);if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x75')]){delete _0x2211b8['account']['Applications'];}return db[_0x49ae('0x79')][_0x49ae('0x7a')]();})[_0x49ae('0x37')](function(_0xfe8dd9){if(!_0xfe8dd9){throw new db[(_0x49ae('0x7b'))]['ValidationError'](_0x49ae('0x7c'));}_0x4ea021=_[_0x49ae('0x7d')](_['keys'](_0xfe8dd9),[_0x49ae('0x7e'),'updatedAt']);_0x43ff96=_[_0x49ae('0x7d')](_['keys'](_0xfe8dd9),['createdAt','updatedAt',_0x49ae('0x7f'),'ListId']);_0x2211b8['body']={'mapKey':_0x49ae('0x80')};if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x45')]){switch(_0x2211b8[_0x49ae('0x78')][_0x49ae('0x45')]){case _0x49ae('0x81'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225['body']['From'];_0x2211b8[_0x49ae('0x67')]['body']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x83')];_0x2211b8['body']['messageId']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x84')];break;case _0x49ae('0x85'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]='+'+_0x23b225['body']['sender'];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')]['text'];break;case'connectel':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')]['from'];_0x2211b8[_0x49ae('0x67')]['body']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x29')];break;case _0x49ae('0x86'):_0x2211b8['body']['from']=_0x23b225[_0x49ae('0x67')]['from'];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225['body'][_0x49ae('0x67')];_0x2211b8['body'][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x88')];break;case _0x49ae('0x89'):_0x2211b8[_0x49ae('0x67')]['from']=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8a')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8b')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8c')];break;case _0x49ae('0x8d'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]='+'+_0x23b225[_0x49ae('0x67')]['results'][0x0][_0x49ae('0x82')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')]['results'][0x0][_0x49ae('0x8e')];_0x2211b8['body'][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x8f')][0x0]['messageId'];break;case _0x49ae('0x90'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')]['originatingAddress'];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x91')]['message'];break;case _0x49ae('0x92'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225['body']['fromNumber'];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225['body'][_0x49ae('0x8e')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')]['replyMessageId'];break;case'bandwidth':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')][0x0][_0x49ae('0x29')]['id'];_0x2211b8['body'][_0x49ae('0x82')]=_0x23b225['body'][0x0]['message'][_0x49ae('0x82')];_0x2211b8['body'][_0x49ae('0x67')]=_0x23b225['body'][0x0][_0x49ae('0x29')][_0x49ae('0x8e')];break;case _0x49ae('0x93'):_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x82')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')]=_0x23b225[_0x49ae('0x67')][_0x49ae('0x29')];_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')]=_0x23b225[_0x49ae('0x67')]['refid'];break;}}if(_0x2211b8[_0x49ae('0x67')]['id']){delete _0x2211b8[_0x49ae('0x67')]['id'];}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))](_0x49ae('0x96'));}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')][_0x49ae('0x67')])||_0x2211b8['body'][_0x49ae('0x67')]===''){throw new db['Sequelize'][(_0x49ae('0x95'))](_0x49ae('0x97'));}if(_[_0x49ae('0x94')](_0x2211b8[_0x49ae('0x67')]['mapKey'])){throw new db[(_0x49ae('0x7b'))]['ValidationError'](_0x49ae('0x98')+_0x43ff96);}if(!_[_0x49ae('0x99')](_0x43ff96,_0x2211b8[_0x49ae('0x67')][_0x49ae('0x9a')])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43ff96);}_0x3a83e5[_0x2211b8['body'][_0x49ae('0x9a')]]=_0x2211b8[_0x49ae('0x67')]['from'];return db[_0x49ae('0x9b')]['find']({'where':{'id':_0x2211b8[_0x49ae('0x78')][_0x49ae('0x9c')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3a83e5,'limit':0x1,'order':[[_0x49ae('0x9d'),_0x49ae('0x9e')]]}]});})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x255dfb){if(_0x255dfb){_0x2211b8[_0x49ae('0x9f')]=_[_0x49ae('0xa0')](_0x255dfb,[_0x49ae('0xa1')]);if(_0x255dfb[_0x49ae('0xa1')]['length']){return _0x255dfb[_0x49ae('0xa1')][0x0];}var _0x2d2949=_['defaults'](_0x2211b8[_0x49ae('0x67')],{'firstName':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'ListId':_0x255dfb['id']});_0x2d2949[_0x2211b8[_0x49ae('0x67')][_0x49ae('0x9a')]]=_0x2211b8[_0x49ae('0x67')]['from'];return db[_0x49ae('0x79')][_0x49ae('0x5f')](_0x2d2949,{'fields':_0x4ea021,'raw':!![]});}})[_0x49ae('0x37')](handleEntityNotFound(_0x14817f,null))[_0x49ae('0x37')](function(_0x3a6626){if(_0x3a6626){_0x2211b8[_0x49ae('0xa2')]=_0x3a6626;var _0x417388={'ContactId':_0x3a6626['id'],'phone':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id']};var _0x52dad1={'ContactId':_0x3a6626['id'],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id'],'closed':![]};return db[_0x49ae('0xa3')][_0x49ae('0x5e')]({'where':_0x52dad1})[_0x49ae('0x37')](function(_0x19b6e0){if(_0x19b6e0){return[_0x19b6e0,![]];}return db[_0x49ae('0xa3')][_0x49ae('0x5f')](_0x417388)['then'](function(_0x38c481){return[_0x38c481,!![]];});});}})[_0x49ae('0xa4')](function(_0x3acf92,_0x3796aa){_0x2211b8[_0x49ae('0xa5')]=_0x3acf92['get']({'plain':!![]});_0x2211b8[_0x49ae('0xa5')][_0x49ae('0xa6')]=![];if(_0x3796aa){if(_0x2211b8[_0x49ae('0x78')][_0x49ae('0xa7')]){_0x2211b8[_0x49ae('0x76')][_0x49ae('0xa8')]({'id':0x0,'priority':_0x2211b8['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x49ae('0xa9')});}_0x2211b8['interaction']['created']=!![];}return db['SmsMessage'][_0x49ae('0x5f')]({'phone':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x82')],'messageId':_0x2211b8[_0x49ae('0x67')][_0x49ae('0x87')],'body':_0x2211b8[_0x49ae('0x67')]['body'],'SmsAccountId':_0x23b225[_0x49ae('0x5c')]['id'],'SmsInteractionId':_0x3acf92['id'],'direction':'in','ContactId':_0x3acf92['ContactId'],'AttachmentId':_0x2211b8[_0x49ae('0x67')][_0x49ae('0xaa')]});})[_0x49ae('0x37')](function(_0x47f6be){_0x2211b8[_0x49ae('0x29')]=_0x47f6be;if(_0x2211b8[_0x49ae('0xa5')][_0x49ae('0xab')]){return db['User'][_0x49ae('0x5e')]({'attributes':['id','name'],'where':{'id':_0x2211b8[_0x49ae('0xa5')]['UserId']}})['then'](function(_0x52cdc4){if(_0x52cdc4){_0x2211b8['applications'][_0x49ae('0xac')]({'id':0x0,'priority':0x0,'app':_0x49ae('0xad'),'appdata':_0x52cdc4[_0x49ae('0x3c')]+','+(_0x2211b8[_0x49ae('0x78')][_0x49ae('0xae')]||0xa),'interval':_0x49ae('0xa9')});}return respondWithRpcPromise('Start','startRouting',_0x2211b8);});}return respondWithRpcPromise(_0x49ae('0xaf'),_0x49ae('0xb0'),_0x2211b8);})[_0x49ae('0x37')](function(_0x584f2f){if(_0x584f2f){var _0x287d44=0xc8;var _0x3f2110=_0x49ae('0xb1');logger[_0x49ae('0x22')](_0x49ae('0x24'),_0x3f2110,_0x287d44,_0x49ae('0xb2'));logger[_0x49ae('0xb3')](_0x49ae('0xb4'),_0x3f2110,_0x287d44,_0x49ae('0xb2'),JSON[_0x49ae('0x25')](_0x584f2f));if(_0x2211b8['account'][_0x49ae('0x45')]===_0x49ae('0x81')){return _0x14817f[_0x49ae('0x2d')](_0x287d44)[_0x49ae('0x33')](_0x49ae('0xb5'),_0x49ae('0xb6'))[_0x49ae('0x3d')]('\x0a');}else{return _0x14817f[_0x49ae('0x2d')](_0x287d44)['json'](_0x584f2f);}}})[_0x49ae('0x2b')](handleError(_0x14817f,null));};exports[_0x49ae('0xb7')]=function(_0x5d9d8d,_0x62538a){var _0x31eb9a=_0x5d9d8d['params']['id'];var _0x1c2fa5=_0x5d9d8d['body'];var _0x4adb41=0xc8;var _0x222fd3=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x49ae('0xb8')][_0x49ae('0xb9')]},function(_0x4f3221){return db['SmsAccount'][_0x49ae('0x6b')]({'where':{'id':_0x31eb9a},'transaction':_0x4f3221})[_0x49ae('0x37')](function(_0x2284b4){if(_0x2284b4){return db[_0x49ae('0x74')][_0x49ae('0x38')]({'where':{'SmsAccountId':_0x31eb9a},'transaction':_0x4f3221})[_0x49ae('0x37')](function(){var _0x5d0bbb=_[_0x49ae('0x41')](_0x1c2fa5,function(_0x43db66){_0x43db66[_0x49ae('0x6d')]=_0x31eb9a;return _0x43db66;});return db['SmsApplication']['bulkCreate'](_0x5d0bbb,{'transaction':_0x4f3221});});}else{_0x4adb41=0x194;_0x222fd3=[];}});})[_0x49ae('0x37')](function(){if(_0x4adb41!==0x194){return db[_0x49ae('0x74')][_0x49ae('0xba')]({'where':{'SmsAccountId':_0x31eb9a},'order':_0x49ae('0x77')})[_0x49ae('0x37')](function(_0x235d63){_0x222fd3=_0x235d63;});}})['catch'](function(_0x2b7078){_0x4adb41=0x1f4;logger[_0x49ae('0x26')](_0x2b7078[_0x49ae('0xbb')]);if(_0x2b7078[_0x49ae('0x3c')]){delete _0x2b7078[_0x49ae('0x3c')];}_0x222fd3=_0x2b7078;})['finally'](function(){if(_0x222fd3===null){_0x62538a[_0x49ae('0x2c')](_0x4adb41);}else{if(_0x4adb41===0x1f4){_0x62538a[_0x49ae('0x2d')](_0x4adb41)[_0x49ae('0x3d')](_0x222fd3);}else{_0x62538a[_0x49ae('0x2d')](_0x4adb41)['json'](_0x222fd3);}}});};exports[_0x49ae('0xbc')]=function(_0x47491a,_0x137ea5,_0x325aab){var _0x587916={};var _0x5e654d={};var _0x432ed9;var _0x3d70c0;return db[_0x49ae('0x42')]['findOne']({'where':{'id':_0x47491a[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x137ea5,null))['then'](function(_0x9d068a){if(_0x9d068a){_0x432ed9=_0x9d068a;_0x5e654d['model']=_[_0x49ae('0x49')](db['SmsApplication'][_0x49ae('0x43')]);_0x5e654d[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0x47491a['query']);_0x5e654d[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x5e654d[_0x49ae('0x47')],_0x5e654d['query']);_0x587916[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x5e654d[_0x49ae('0x47')],qs['fields'](_0x47491a['query'][_0x49ae('0x4d')]));_0x587916['attributes']=_0x587916[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x587916['attributes']:_0x5e654d['model'];_0x587916['order']=qs[_0x49ae('0x51')](_0x47491a[_0x49ae('0x48')][_0x49ae('0x51')]);_0x587916[_0x49ae('0x54')]=qs['filters'](_['pick'](_0x47491a['query'],_0x5e654d['filters']));if(_0x47491a[_0x49ae('0x48')][_0x49ae('0x53')]){_0x587916[_0x49ae('0x54')]=_['merge'](_0x587916[_0x49ae('0x54')],{'$or':_[_0x49ae('0x41')](_0x587916['attributes'],function(_0x18218c){var _0x3217d6={};_0x3217d6[_0x18218c]={'$like':'%'+_0x47491a[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x3217d6;})});}_0x587916=_[_0x49ae('0x55')]({},_0x587916,_0x47491a[_0x49ae('0x57')]);return _0x432ed9['getApplications'](_0x587916);}})[_0x49ae('0x37')](function(_0x58c438){if(_0x58c438){_0x3d70c0=_0x58c438['length'];if(!_0x47491a[_0x49ae('0x48')]['hasOwnProperty'](_0x49ae('0x6c'))){_0x587916[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x47491a['query'][_0x49ae('0x32')]);_0x587916[_0x49ae('0x2f')]=qs['offset'](_0x47491a[_0x49ae('0x48')]['offset']);}return _0x432ed9[_0x49ae('0xbc')](_0x587916);}})[_0x49ae('0x37')](function(_0x403c5f){if(_0x403c5f){return _0x403c5f?{'count':_0x3d70c0,'rows':_0x403c5f}:null;}})[_0x49ae('0x37')](respondWithResult(_0x137ea5,null))['catch'](handleError(_0x137ea5,null));};exports['getInteractions']=function(_0xa991e6,_0x25ca3c,_0x5ceb2c){var _0x22ccb9={'raw':![],'where':{}};var _0x5e5873={};var _0x362553={'count':0x0,'rows':[]};return db[_0x49ae('0x42')][_0x49ae('0x6b')]({'where':{'id':_0xa991e6[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x25ca3c,null))[_0x49ae('0x37')](function(_0x59b3b7){if(_0x59b3b7){_0x5e5873[_0x49ae('0x47')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x5e5873[_0x49ae('0x48')]=_[_0x49ae('0x49')](_0xa991e6[_0x49ae('0x48')]);_0x5e5873['filters']=_[_0x49ae('0x4b')](_0x5e5873[_0x49ae('0x47')],_0x5e5873['query']);_0x22ccb9[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x5e5873['model'],qs[_0x49ae('0x4d')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x4d')]));_0x22ccb9[_0x49ae('0x4c')]=_0x22ccb9[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x22ccb9[_0x49ae('0x4c')]:_0x5e5873[_0x49ae('0x47')];if(!_0xa991e6[_0x49ae('0x48')][_0x49ae('0x4f')](_0x49ae('0x6c'))){_0x22ccb9[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x32')]);_0x22ccb9['offset']=qs[_0x49ae('0x2f')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x2f')]);}_0x22ccb9[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0xa991e6[_0x49ae('0x48')][_0x49ae('0x51')]);_0x22ccb9[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0xa991e6[_0x49ae('0x48')],_0x5e5873['filters']));_0x22ccb9[_0x49ae('0x54')][_0x49ae('0x6d')]=_0x59b3b7['id'];if(_0xa991e6[_0x49ae('0x48')][_0x49ae('0x53')]){_0x22ccb9[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x22ccb9[_0x49ae('0x54')],{'$or':_['map'](_0x22ccb9['attributes'],function(_0x3cf78c){var _0x487d37={};_0x487d37[_0x3cf78c]={'$like':'%'+_0xa991e6[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x487d37;})});}_0x22ccb9=_[_0x49ae('0x55')]({},_0x22ccb9,_0xa991e6[_0x49ae('0x57')]);return db[_0x49ae('0xa3')]['count']({'where':_0x22ccb9['where']})[_0x49ae('0x37')](function(_0x5ad6bd){_0x362553['count']=_0x5ad6bd;if(_0xa991e6['query'][_0x49ae('0x58')]){_0x22ccb9[_0x49ae('0x5d')]=[{'model':db['CmContact'],'as':_0x49ae('0xbd'),'required':![]},{'model':db[_0x49ae('0xbe')],'as':_0x49ae('0xbf'),'attributes':[_0x49ae('0x3c'),'fullname','internal'],'required':![]},{'model':db[_0x49ae('0xc0')],'as':_0x49ae('0xc1'),'attributes':['id','name',_0x49ae('0xc2')],'where':_0xa991e6['query'][_0x49ae('0xc3')]?{'id':_0xa991e6[_0x49ae('0x48')][_0x49ae('0xc3')]}:undefined,'required':_0xa991e6[_0x49ae('0x48')][_0x49ae('0xc3')]?!![]:![]}];}return db[_0x49ae('0xa3')][_0x49ae('0x59')](_0x22ccb9);})[_0x49ae('0x37')](function(_0xd13c1e){_0x362553[_0x49ae('0x5a')]=_0xd13c1e;return _0x362553;});}})[_0x49ae('0x37')](respondWithFilteredResult(_0x25ca3c,_0x22ccb9))[_0x49ae('0x2b')](handleError(_0x25ca3c,null));};exports[_0x49ae('0x3d')]=function(_0x54d37f,_0x1c6576,_0x2d1816){var _0x4b480a,_0x1cf184,_0x3df455;if(_[_0x49ae('0x94')](_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')])||_0x54d37f['body'][_0x49ae('0x67')]===''){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49ae('0x94')](_0x54d37f[_0x49ae('0x67')]['to'])){throw new db[(_0x49ae('0x7b'))][(_0x49ae('0x95'))]('to\x20is\x20mandatory');}_0x4b480a=_0x54d37f['body']['to'];return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x54d37f[_0x49ae('0x5c')]['id']},'include':[{'model':db[_0x49ae('0x9b')],'as':'List','include':[{'model':db[_0x49ae('0x79')],'as':_0x49ae('0xa1'),'where':{'mobile':_0x4b480a},'limit':0x1,'order':[[_0x49ae('0x9d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1c6576,null))[_0x49ae('0x37')](function(_0x477fc5){if(_0x477fc5&&_0x477fc5[_0x49ae('0xc4')]){_0x1cf184=_0x477fc5[_0x49ae('0x39')]({'plain':!![]});if(_0x1cf184['List']&&_0x1cf184[_0x49ae('0xc4')]['Contacts'][_0x49ae('0x4e')]){return _0x1cf184[_0x49ae('0xc4')][_0x49ae('0xa1')][0x0];}return db[_0x49ae('0x79')][_0x49ae('0x5f')](_[_0x49ae('0x19')](_0x54d37f['body'],{'firstName':_0x4b480a,'mobile':_0x4b480a,'phone':_0x4b480a,'ListId':_0x1cf184[_0x49ae('0x9c')]}));}})[_0x49ae('0x37')](handleEntityNotFound(_0x1c6576,null))[_0x49ae('0x37')](function(_0x2026fd){if(_0x2026fd){_0x3df455=_0x2026fd;return db[_0x49ae('0xa3')][_0x49ae('0x5e')]({'where':{'ContactId':_0x3df455['id'],'closed':![],'SmsAccountId':_0x1cf184['id']}})[_0x49ae('0x37')](function(_0x24baf1){if(_0x24baf1){return[_0x24baf1,![]];}return db['SmsInteraction'][_0x49ae('0x5f')]({'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id'],'SmsAccountId':_0x1cf184['id'],'phone':_0x4b480a,'firstMsgDirection':_0x49ae('0xc5'),'Messages':[_['merge'](_0x54d37f['body'],{'read':![],'body':_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')],'phone':_0x4b480a,'SmsAccountId':_0x1cf184['id'],'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id']})]},{'include':[{'model':db[_0x49ae('0xc6')],'as':_0x49ae('0xc7')}]})['then'](function(_0x3ad8e0){return[_0x3ad8e0,!![]];});});}})[_0x49ae('0xa4')](function(_0x4de417,_0x7204c9){if(_0x7204c9){return _0x4de417;}return db['SmsMessage'][_0x49ae('0x5f')](_[_0x49ae('0x55')](_0x54d37f['body'],{'read':![],'body':_0x54d37f[_0x49ae('0x67')][_0x49ae('0x67')],'phone':_0x4b480a,'SmsAccountId':_0x1cf184['id'],'SmsInteractionId':_0x4de417['id'],'UserId':_0x54d37f['user']['id'],'ContactId':_0x3df455['id']}))[_0x49ae('0x37')](function(_0x53530e){_0x4de417[_0x49ae('0xc8')][_0x49ae('0xc7')]=[];_0x4de417[_0x49ae('0xc8')][_0x49ae('0xc7')][_0x49ae('0xa8')](_0x53530e['dataValues']);return _0x4de417;});})['then'](respondWithResult(_0x1c6576,null))[_0x49ae('0x2b')](handleError(_0x1c6576,null));};exports[_0x49ae('0x2d')]=function(_0x2271b7,_0x3a8278,_0x4d4162){if(_0x2271b7[_0x49ae('0x67')]['id']){delete _0x2271b7[_0x49ae('0x67')]['id'];}var _0x5da73d,_0x299ec6,_0x3caaf8;return db[_0x49ae('0x42')]['find']({'where':{'id':_0x2271b7[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a8278,null))[_0x49ae('0x37')](function(_0x209ac9){if(_0x209ac9){_0x3caaf8=_0x209ac9;logger['debug'](_0x49ae('0x24'),_0x49ae('0x2d'),'received\x20delivery\x20report\x20from',_0x209ac9[_0x49ae('0x45')],util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));switch(_0x209ac9[_0x49ae('0x45')]){case _0x49ae('0x85'):if(_0x2271b7['body'][_0x49ae('0xca')]&&_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0xca')]}});}break;case _0x49ae('0xcb'):if(_0x2271b7[_0x49ae('0x67')][_0x49ae('0xcc')]&&_0x2271b7['body'][_0x49ae('0xcd')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0xcd')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x2271b7['body'][_0x49ae('0xcc')]}});}break;case _0x49ae('0x86'):if(_0x2271b7[_0x49ae('0x67')]['message_id']&&_0x2271b7['body'][_0x49ae('0xce')]){_0x299ec6=_0x2271b7[_0x49ae('0x67')]['status_code'];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')]['message_id']}});}break;case _0x49ae('0x8d'):var _0x77e358=_0x2271b7['body'][_0x49ae('0x8f')][0x0];if(_0x77e358['messageId']&&_0x77e358[_0x49ae('0x2d')][_0x49ae('0xcf')]===_0x49ae('0xd0')){_0x299ec6=_0x77e358[_0x49ae('0x2d')][_0x49ae('0xcf')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x77e358[_0x49ae('0x87')]}});}break;case _0x49ae('0x92'):if(_0x2271b7['body'][_0x49ae('0x87')]&&_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')]){_0x299ec6=_0x2271b7['body'][_0x49ae('0x2d')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0x87')]}});}break;case _0x49ae('0xd1'):if(_0x2271b7['body'][0x0]['message']['id']){_0x299ec6=_0x2271b7['body'][0x0][_0x49ae('0x45')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd2')]&&_0x2271b7[_0x49ae('0x67')]['status']){_0x299ec6=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x2d')];return db[_0x49ae('0xc6')][_0x49ae('0x5e')]({'where':{'messageId':_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd2')]}});}break;}}})[_0x49ae('0x37')](handleEntityNotFound(_0x3a8278,null))[_0x49ae('0x37')](function(_0x3b8ac6){if(_0x3b8ac6){_0x5da73d=_0x3b8ac6;switch(_0x3caaf8[_0x49ae('0x45')]){case'skebby':if(_0x299ec6===_0x49ae('0xd0')){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x85'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x299ec6==='1'){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x85'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x86'):if(!_0x2271b7[_0x49ae('0x67')][_0x49ae('0xd3')]&&_0x299ec6>=0xc8&&_0x299ec6<=0xce){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger['error'](_0x49ae('0x24'),'status',_0x49ae('0x86'),util['inspect'](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x8d'):var _0x43957f=_0x2271b7[_0x49ae('0x67')][_0x49ae('0x8f')][0x0];if(_0x43957f[_0x49ae('0x2d')][_0x49ae('0xcf')]==='DELIVERED'){return _0x5da73d['update']({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x8d'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;case _0x49ae('0x92'):if(_0x299ec6==_0x49ae('0xd4')||_0x299ec6==_0x49ae('0xd5')){return _0x5da73d['update']({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x92'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x299ec6==_0x49ae('0xd6')){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger['error'](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0xd1'),util[_0x49ae('0xc9')](_0x2271b7[_0x49ae('0x67')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x299ec6===_0x49ae('0xd7')||_0x299ec6==='ACCEPTD'){return _0x5da73d[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),'status',_0x49ae('0x93'),util[_0x49ae('0xc9')](_0x2271b7['body'],{'showHidden':![],'depth':null}));}break;}return _0x5da73d;}})[_0x49ae('0x37')](respondWithResult(_0x3a8278,null))['catch'](handleError(_0x3a8278,null));};exports['statusGet']=function(_0x1ff103,_0x48fd2f,_0x115d09){var _0x41d905,_0x252e19,_0x29a516;return db[_0x49ae('0x42')]['find']({'where':{'id':_0x1ff103[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x48fd2f,null))['then'](function(_0x10aa2f){if(_0x10aa2f){_0x29a516=_0x10aa2f;logger[_0x49ae('0xb3')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49ae('0x2d'),_0x49ae('0xd8'),_0x10aa2f[_0x49ae('0x45')],util[_0x49ae('0xc9')](_0x1ff103['query'],{'showHidden':![],'depth':null}));switch(_0x10aa2f[_0x49ae('0x45')]){case _0x49ae('0x90'):if(_0x1ff103[_0x49ae('0x48')][_0x49ae('0xd9')]&&_0x1ff103[_0x49ae('0x48')][_0x49ae('0xda')]){_0x252e19=_0x1ff103['query'][_0x49ae('0xda')];return db[_0x49ae('0xc6')]['find']({'where':{'messageId':_0x1ff103[_0x49ae('0x48')][_0x49ae('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x48fd2f,null))['then'](function(_0x184e88){if(_0x184e88){_0x41d905=_0x184e88;switch(_0x29a516[_0x49ae('0x45')]){case _0x49ae('0x90'):if(_0x252e19==='2'||_0x252e19==='6'){return _0x41d905[_0x49ae('0x36')]({'read':!![]});}else{logger[_0x49ae('0x26')](_0x49ae('0x24'),_0x49ae('0x2d'),_0x49ae('0x90'),util[_0x49ae('0xc9')](_0x1ff103[_0x49ae('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x41d905;}})[_0x49ae('0x37')](respondWithResult(_0x48fd2f,null))[_0x49ae('0x2b')](handleError(_0x48fd2f,null));};exports[_0x49ae('0xdb')]=function(_0x3b984a,_0x5893e8,_0x165eae){return db['SmsAccount'][_0x49ae('0x5e')]({'where':{'id':_0x3b984a['params']['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x5893e8,null))['then'](function(_0x59fa66){if(_0x59fa66){return _0x59fa66[_0x49ae('0xdb')](_0x3b984a[_0x49ae('0x67')][_0x49ae('0x72')],_[_0x49ae('0xa0')](_0x3b984a['body'],[_0x49ae('0x72'),'id'])||{})[_0x49ae('0xa4')](function(_0x29204d){for(var _0x1e8fa5=0x0;_0x1e8fa5<_0x3b984a[_0x49ae('0x67')]['ids'][_0x49ae('0x4e')];_0x1e8fa5+=0x1){socket['emit'](_0x49ae('0xdc'),{'UserId':Number(_0x3b984a[_0x49ae('0x67')][_0x49ae('0x72')][_0x1e8fa5]),'SmsAccountId':Number(_0x3b984a[_0x49ae('0x5c')]['id'])});}return _0x29204d;});}})['then'](respondWithResult(_0x5893e8,null))[_0x49ae('0x2b')](handleError(_0x5893e8,null));};exports[_0x49ae('0xdd')]=function(_0x448ec2,_0x25b848,_0x4b2403){return db[_0x49ae('0x42')][_0x49ae('0x5e')]({'where':{'id':_0x448ec2[_0x49ae('0x5c')]['id']}})[_0x49ae('0x37')](handleEntityNotFound(_0x25b848,null))[_0x49ae('0x37')](function(_0x9e1636){if(_0x9e1636){return _0x9e1636[_0x49ae('0xdd')](_0x448ec2['query'][_0x49ae('0x72')])[_0x49ae('0x37')](function(){if(_[_0x49ae('0xde')](_0x448ec2['query'][_0x49ae('0x72')])){for(var _0x188c1b=0x0;_0x188c1b<_0x448ec2['query'][_0x49ae('0x72')][_0x49ae('0x4e')];_0x188c1b+=0x1){socket['emit'](_0x49ae('0xdf'),{'UserId':Number(_0x448ec2[_0x49ae('0x48')][_0x49ae('0x72')][_0x188c1b]),'SmsAccountId':Number(_0x448ec2[_0x49ae('0x5c')]['id'])});}}else{socket[_0x49ae('0xe0')](_0x49ae('0xdf'),{'UserId':Number(_0x448ec2[_0x49ae('0x48')]['ids']),'SmsAccountId':Number(_0x448ec2[_0x49ae('0x5c')]['id'])});}});}})[_0x49ae('0x37')](respondWithStatusCode(_0x25b848,null))[_0x49ae('0x2b')](handleError(_0x25b848,null));};exports[_0x49ae('0xe1')]=function(_0x1904c9,_0x47208d,_0x2bdf78){var _0x383339={};var _0x3033be={};var _0x37d98a;var _0x10ad33;return db[_0x49ae('0x42')]['findOne']({'where':{'id':_0x1904c9[_0x49ae('0x5c')]['id']}})['then'](handleEntityNotFound(_0x47208d,null))[_0x49ae('0x37')](function(_0x5ed284){if(_0x5ed284){_0x37d98a=_0x5ed284;_0x3033be['model']=_[_0x49ae('0x49')](db[_0x49ae('0xbe')][_0x49ae('0x43')]);_0x3033be['query']=_['keys'](_0x1904c9[_0x49ae('0x48')]);_0x3033be[_0x49ae('0x4a')]=_[_0x49ae('0x4b')](_0x3033be[_0x49ae('0x47')],_0x3033be[_0x49ae('0x48')]);_0x383339[_0x49ae('0x4c')]=_[_0x49ae('0x4b')](_0x3033be[_0x49ae('0x47')],qs['fields'](_0x1904c9[_0x49ae('0x48')]['fields']));_0x383339[_0x49ae('0x4c')]=_0x383339[_0x49ae('0x4c')][_0x49ae('0x4e')]?_0x383339[_0x49ae('0x4c')]:_0x3033be[_0x49ae('0x47')];_0x383339[_0x49ae('0x50')]=qs[_0x49ae('0x51')](_0x1904c9['query']['sort']);_0x383339[_0x49ae('0x54')]=qs[_0x49ae('0x4a')](_[_0x49ae('0x52')](_0x1904c9[_0x49ae('0x48')],_0x3033be['filters']));if(_0x1904c9[_0x49ae('0x48')][_0x49ae('0x53')]){_0x383339[_0x49ae('0x54')]=_[_0x49ae('0x55')](_0x383339[_0x49ae('0x54')],{'$or':_['map'](_0x383339[_0x49ae('0x4c')],function(_0x7fdad3){var _0x9ab01a={};_0x9ab01a[_0x7fdad3]={'$like':'%'+_0x1904c9[_0x49ae('0x48')][_0x49ae('0x53')]+'%'};return _0x9ab01a;})});}_0x383339=_['merge']({},_0x383339,_0x1904c9[_0x49ae('0x57')]);return _0x37d98a[_0x49ae('0xe1')](_0x383339);}})[_0x49ae('0x37')](function(_0xbc8b9c){if(_0xbc8b9c){_0x10ad33=_0xbc8b9c[_0x49ae('0x4e')];if(!_0x1904c9[_0x49ae('0x48')][_0x49ae('0x4f')]('nolimit')){_0x383339[_0x49ae('0x32')]=qs[_0x49ae('0x32')](_0x1904c9[_0x49ae('0x48')]['limit']);_0x383339[_0x49ae('0x2f')]=qs[_0x49ae('0x2f')](_0x1904c9[_0x49ae('0x48')][_0x49ae('0x2f')]);}return _0x37d98a['getAgents'](_0x383339);}})[_0x49ae('0x37')](function(_0xfcbe47){if(_0xfcbe47){return _0xfcbe47?{'count':_0x10ad33,'rows':_0xfcbe47}:null;}})['then'](respondWithResult(_0x47208d,null))[_0x49ae('0x2b')](handleError(_0x47208d,null));}; \ No newline at end of file +var _0xa492=['CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','twilio','from','messageId','MessageSid','skebby','text','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','SmsInteraction','interaction','created','autoclose','applications','push','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','bandwidth','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','csc','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','length','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','count','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc'];(function(_0x38894d,_0x1883d8){var _0x5614fe=function(_0x181989){while(--_0x181989){_0x38894d['push'](_0x38894d['shift']());}};_0x5614fe(++_0x1883d8);}(_0xa492,0x69));var _0x2a49=function(_0x56d86f,_0xd57fb1){_0x56d86f=_0x56d86f-0x0;var _0x29e5be=_0xa492[_0x56d86f];return _0x29e5be;};'use strict';var emlformat=require(_0x2a49('0x0'));var rimraf=require(_0x2a49('0x1'));var zipdir=require(_0x2a49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a49('0x3'));var moment=require(_0x2a49('0x4'));var BPromise=require(_0x2a49('0x5'));var Mustache=require(_0x2a49('0x6'));var util=require('util');var path=require(_0x2a49('0x7'));var sox=require(_0x2a49('0x8'));var csv=require(_0x2a49('0x9'));var ejs=require(_0x2a49('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a49('0xb'));var squel=require(_0x2a49('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a49('0xd'));var deskjs=require(_0x2a49('0xe'));var toCsv=require(_0x2a49('0x9'));var querystring=require(_0x2a49('0xf'));var Papa=require(_0x2a49('0x10'));var Redis=require(_0x2a49('0x11'));var authService=require(_0x2a49('0x12'));var qs=require(_0x2a49('0x13'));var as=require(_0x2a49('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a49('0x15'));var utils=require('../../config/utils');var config=require(_0x2a49('0x16'));var licenseUtil=require(_0x2a49('0x17'));var db=require(_0x2a49('0x18'))['db'];config[_0x2a49('0x19')]=_[_0x2a49('0x1a')](config[_0x2a49('0x19')],{'host':_0x2a49('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x2a49('0x1c')](socket);var jayson=require(_0x2a49('0x1d'));var client=jayson[_0x2a49('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c19ac,_0x49d9b3,_0x454ff4,_0x37a3d9){return new BPromise(function(_0x5587e4,_0x426ca7){var _0x4dc085=_0x37a3d9||client;return _0x4dc085[_0x2a49('0x1f')](_0x3c19ac,_0x454ff4)[_0x2a49('0x20')](function(_0x28e682){logger[_0x2a49('0x21')](_0x2a49('0x22'),_0x49d9b3,_0x2a49('0x23'));logger[_0x2a49('0x24')](_0x2a49('0x25'),_0x49d9b3,_0x2a49('0x23'),JSON[_0x2a49('0x26')](_0x28e682));if(_0x28e682[_0x2a49('0x27')]){if(_0x28e682[_0x2a49('0x27')][_0x2a49('0x28')]===0x1f4){logger['error'](_0x2a49('0x22'),_0x49d9b3,_0x28e682[_0x2a49('0x27')][_0x2a49('0x29')]);return _0x426ca7(_0x28e682[_0x2a49('0x27')][_0x2a49('0x29')]);}logger[_0x2a49('0x27')](_0x2a49('0x22'),_0x49d9b3,_0x28e682['error'][_0x2a49('0x29')]);return _0x5587e4(_0x28e682['error'][_0x2a49('0x29')]);}else{logger[_0x2a49('0x21')](_0x2a49('0x22'),_0x49d9b3,_0x2a49('0x23'));_0x5587e4(_0x28e682[_0x2a49('0x2a')][_0x2a49('0x29')]);}})[_0x2a49('0x2b')](function(_0x538391){logger[_0x2a49('0x27')](_0x2a49('0x22'),_0x49d9b3,_0x538391);_0x426ca7(_0x538391);});});}function respondWithStatusCode(_0x33f661,_0x56a8c9){_0x56a8c9=_0x56a8c9||0xcc;return function(_0x1eaa25){if(_0x1eaa25){return _0x33f661[_0x2a49('0x2c')](_0x56a8c9);}return _0x33f661[_0x2a49('0x2d')](_0x56a8c9)['end']();};}function respondWithResult(_0x3c57de,_0x1f2fd3){_0x1f2fd3=_0x1f2fd3||0xc8;return function(_0x51b377){if(_0x51b377){return _0x3c57de[_0x2a49('0x2d')](_0x1f2fd3)[_0x2a49('0x2e')](_0x51b377);}};}function respondWithFilteredResult(_0x368a19,_0xb79042){return function(_0xca9aa8){if(_0xca9aa8){var _0x104929=typeof _0xb79042[_0x2a49('0x2f')]==='undefined'&&typeof _0xb79042[_0x2a49('0x30')]==='undefined';var _0x2befed=_0xca9aa8['count'];var _0x452985=_0x104929?0x0:_0xb79042['offset'];var _0x50c604=_0x104929?_0xca9aa8['count']:_0xb79042['offset']+_0xb79042['limit'];var _0x3d1dae;if(_0x50c604>=_0x2befed){_0x50c604=_0x2befed;_0x3d1dae=0xc8;}else{_0x3d1dae=0xce;}_0x368a19['status'](_0x3d1dae);return _0x368a19[_0x2a49('0x31')](_0x2a49('0x32'),_0x452985+'-'+_0x50c604+'/'+_0x2befed)[_0x2a49('0x2e')](_0xca9aa8);}return null;};}function patchUpdates(_0x3440e2){return function(_0x20d05a){try{jsonpatch[_0x2a49('0x33')](_0x20d05a,_0x3440e2,!![]);}catch(_0x416614){return BPromise[_0x2a49('0x34')](_0x416614);}return _0x20d05a[_0x2a49('0x35')]();};}function saveUpdates(_0x473e3e,_0x29b930){return function(_0x22552a){if(_0x22552a){return _0x22552a[_0x2a49('0x36')](_0x473e3e)['then'](function(_0x4196c3){return _0x4196c3;});}return null;};}function removeEntity(_0x437db1,_0x23a522){return function(_0x34edbe){if(_0x34edbe){return _0x34edbe[_0x2a49('0x37')]()[_0x2a49('0x20')](function(){var _0x3f0ad3=_0x34edbe[_0x2a49('0x38')]({'plain':!![]});var _0xd5cee5=_0x2a49('0x39');return db[_0x2a49('0x3a')][_0x2a49('0x37')]({'where':{'type':_0xd5cee5,'resourceId':_0x3f0ad3['id']}})[_0x2a49('0x20')](function(){return _0x34edbe;});})['then'](function(){_0x437db1[_0x2a49('0x2d')](0xcc)[_0x2a49('0x3b')]();});}};}function handleEntityNotFound(_0x5f2fdc,_0x54a5ce){return function(_0x32e15e){if(!_0x32e15e){_0x5f2fdc[_0x2a49('0x2c')](0x194);}return _0x32e15e;};}function handleError(_0x3ac392,_0x4fab61){_0x4fab61=_0x4fab61||0x1f4;return function(_0x21adf0){logger[_0x2a49('0x27')](_0x21adf0[_0x2a49('0x3c')]);if(_0x21adf0['name']){delete _0x21adf0['name'];}_0x3ac392[_0x2a49('0x2d')](_0x4fab61)[_0x2a49('0x3d')](_0x21adf0);};}exports[_0x2a49('0x3e')]=function(_0x2bbbe9,_0x537cfe){var _0x56ca2a={'include':[{'model':db[_0x2a49('0x3f')],'as':'mandatoryDispositionPause'}]},_0x1782a7={},_0x371466={'count':0x0,'rows':[]};var _0x542a51=_[_0x2a49('0x40')](db[_0x2a49('0x41')][_0x2a49('0x42')],function(_0x37ad3e){return{'name':_0x37ad3e[_0x2a49('0x43')],'type':_0x37ad3e[_0x2a49('0x44')][_0x2a49('0x45')]};});_0x1782a7[_0x2a49('0x46')]=_['map'](_0x542a51,_0x2a49('0x47'));_0x1782a7['query']=_[_0x2a49('0x48')](_0x2bbbe9[_0x2a49('0x49')]);_0x1782a7[_0x2a49('0x4a')]=_[_0x2a49('0x4b')](_0x1782a7[_0x2a49('0x46')],_0x1782a7['query']);_0x56ca2a[_0x2a49('0x4c')]=_['intersection'](_0x1782a7[_0x2a49('0x46')],qs[_0x2a49('0x4d')](_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x4d')]));_0x56ca2a[_0x2a49('0x4c')]=_0x56ca2a[_0x2a49('0x4c')]['length']?_0x56ca2a[_0x2a49('0x4c')]:_0x1782a7[_0x2a49('0x46')];if(!_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x4e')](_0x2a49('0x4f'))){_0x56ca2a['limit']=qs[_0x2a49('0x30')](_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x30')]);_0x56ca2a['offset']=qs[_0x2a49('0x2f')](_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x2f')]);}_0x56ca2a[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x51')]);_0x56ca2a[_0x2a49('0x52')]=qs[_0x2a49('0x4a')](_[_0x2a49('0x53')](_0x2bbbe9[_0x2a49('0x49')],_0x1782a7[_0x2a49('0x4a')]),_0x542a51);if(_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x54')]){_0x56ca2a['where']=_[_0x2a49('0x55')](_0x56ca2a[_0x2a49('0x52')],{'$or':_['map'](_0x542a51,function(_0x44c83f){if(_0x44c83f['type']!==_0x2a49('0x56')){var _0x2ab182={};_0x2ab182[_0x44c83f[_0x2a49('0x47')]]={'$like':'%'+_0x2bbbe9['query'][_0x2a49('0x54')]+'%'};return _0x2ab182;}})});}_0x56ca2a=_['merge']({},_0x56ca2a,_0x2bbbe9[_0x2a49('0x57')]);var _0x4aa28a={'where':_0x56ca2a[_0x2a49('0x52')]};return db[_0x2a49('0x41')]['count'](_0x4aa28a)['then'](function(_0xcd0d24){_0x371466['count']=_0xcd0d24;if(_0x2bbbe9[_0x2a49('0x49')][_0x2a49('0x58')]){_0x56ca2a[_0x2a49('0x59')]=[{'all':!![]}];}return db[_0x2a49('0x41')][_0x2a49('0x5a')](_0x56ca2a);})['then'](function(_0x5a09c8){_0x371466[_0x2a49('0x5b')]=_0x5a09c8;return _0x371466;})[_0x2a49('0x20')](respondWithFilteredResult(_0x537cfe,_0x56ca2a))['catch'](handleError(_0x537cfe,null));};exports[_0x2a49('0x5c')]=function(_0x136a18,_0x1e685b){var _0x51abdf={'raw':![],'where':{'id':_0x136a18[_0x2a49('0x5d')]['id']},'include':[{'model':db[_0x2a49('0x3f')],'as':_0x2a49('0x5e')}]},_0x44627f={};_0x44627f[_0x2a49('0x46')]=_[_0x2a49('0x48')](db['SmsAccount'][_0x2a49('0x42')]);_0x44627f[_0x2a49('0x49')]=_['keys'](_0x136a18['query']);_0x44627f[_0x2a49('0x4a')]=_['intersection'](_0x44627f['model'],_0x44627f[_0x2a49('0x49')]);_0x51abdf[_0x2a49('0x4c')]=_['intersection'](_0x44627f[_0x2a49('0x46')],qs[_0x2a49('0x4d')](_0x136a18['query']['fields']));_0x51abdf[_0x2a49('0x4c')]=_0x51abdf[_0x2a49('0x4c')][_0x2a49('0x5f')]?_0x51abdf[_0x2a49('0x4c')]:_0x44627f[_0x2a49('0x46')];if(_0x136a18[_0x2a49('0x49')][_0x2a49('0x58')]){_0x51abdf[_0x2a49('0x59')]=[{'all':!![]}];}_0x51abdf=_[_0x2a49('0x55')]({},_0x51abdf,_0x136a18['options']);return db['SmsAccount']['find'](_0x51abdf)[_0x2a49('0x20')](handleEntityNotFound(_0x1e685b,null))[_0x2a49('0x20')](respondWithResult(_0x1e685b,null))['catch'](handleError(_0x1e685b,null));};exports[_0x2a49('0x60')]=function(_0x48cec6,_0x508baa){return db[_0x2a49('0x41')][_0x2a49('0x60')](_0x48cec6['body'],{})[_0x2a49('0x20')](function(_0x380e16){var _0x13412c=_0x48cec6[_0x2a49('0x61')][_0x2a49('0x38')]({'plain':!![]});if(!_0x13412c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13412c[_0x2a49('0x62')]==='user'){var _0x42157e=_0x380e16[_0x2a49('0x38')]({'plain':!![]});var _0x30ab86=_0x2a49('0x39');return db[_0x2a49('0x63')][_0x2a49('0x64')]({'where':{'name':_0x30ab86,'userProfileId':_0x13412c[_0x2a49('0x65')]},'raw':!![]})[_0x2a49('0x20')](function(_0x3c1150){if(_0x3c1150&&_0x3c1150[_0x2a49('0x66')]===0x0){return db['UserProfileResource'][_0x2a49('0x60')]({'name':_0x42157e[_0x2a49('0x47')],'resourceId':_0x42157e['id'],'type':_0x3c1150[_0x2a49('0x47')],'sectionId':_0x3c1150['id']},{})[_0x2a49('0x20')](function(){return _0x380e16;});}else{return _0x380e16;}})[_0x2a49('0x2b')](function(_0x3872bd){logger['error'](_0x2a49('0x67'),_0x3872bd);throw _0x3872bd;});}return _0x380e16;})[_0x2a49('0x20')](respondWithResult(_0x508baa,0xc9))[_0x2a49('0x2b')](handleError(_0x508baa,null));};exports[_0x2a49('0x36')]=function(_0x1977b7,_0x921c51){if(_0x1977b7[_0x2a49('0x68')]['id']){delete _0x1977b7[_0x2a49('0x68')]['id'];}return db['SmsAccount'][_0x2a49('0x64')]({'where':{'id':_0x1977b7[_0x2a49('0x5d')]['id']},'include':[{'model':db[_0x2a49('0x3f')],'as':_0x2a49('0x5e')}]})[_0x2a49('0x20')](handleEntityNotFound(_0x921c51,null))['then'](saveUpdates(_0x1977b7['body'],null))[_0x2a49('0x20')](respondWithResult(_0x921c51,null))[_0x2a49('0x2b')](handleError(_0x921c51,null));};exports['destroy']=function(_0x266e6b,_0x242cf2){return db[_0x2a49('0x41')]['find']({'where':{'id':_0x266e6b[_0x2a49('0x5d')]['id']}})['then'](handleEntityNotFound(_0x242cf2,null))[_0x2a49('0x20')](removeEntity(_0x242cf2,null))['catch'](handleError(_0x242cf2,null));};exports[_0x2a49('0x69')]=function(_0x5ebdf9,_0x17061b){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x17061b,null))[_0x2a49('0x2b')](handleError(_0x17061b,null));};exports[_0x2a49('0x6a')]=function(_0x44faac,_0x48c4eb,_0x401fcf){if(_0x44faac[_0x2a49('0x68')]['id']){delete _0x44faac[_0x2a49('0x68')]['id'];}return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x44faac[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x48c4eb,null))['then'](function(_0x4908e1){if(_0x4908e1){_0x44faac['body'][_0x2a49('0x6b')]=_0x4908e1['id'];return db[_0x2a49('0x6c')]['create'](_0x44faac[_0x2a49('0x68')]);}})[_0x2a49('0x20')](respondWithResult(_0x48c4eb,null))[_0x2a49('0x2b')](handleError(_0x48c4eb,null));};exports[_0x2a49('0x6d')]=function(_0x31318a,_0x30daf3,_0x317a46){var _0x37517a={'raw':![],'where':{}};var _0x56eae6={};var _0x58b1d0={'count':0x0,'rows':[]};return db[_0x2a49('0x41')][_0x2a49('0x6e')]({'where':{'id':_0x31318a['params']['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x30daf3,null))[_0x2a49('0x20')](function(_0x3210fa){if(_0x3210fa){_0x56eae6['model']=_['keys'](db[_0x2a49('0x6c')][_0x2a49('0x42')]);_0x56eae6[_0x2a49('0x49')]=_[_0x2a49('0x48')](_0x31318a[_0x2a49('0x49')]);_0x56eae6[_0x2a49('0x4a')]=_[_0x2a49('0x4b')](_0x56eae6[_0x2a49('0x46')],_0x56eae6[_0x2a49('0x49')]);_0x37517a['attributes']=_[_0x2a49('0x4b')](_0x56eae6['model'],qs[_0x2a49('0x4d')](_0x31318a[_0x2a49('0x49')][_0x2a49('0x4d')]));_0x37517a[_0x2a49('0x4c')]=_0x37517a[_0x2a49('0x4c')]['length']?_0x37517a[_0x2a49('0x4c')]:_0x56eae6[_0x2a49('0x46')];if(!_0x31318a[_0x2a49('0x49')]['hasOwnProperty'](_0x2a49('0x4f'))){_0x37517a[_0x2a49('0x30')]=qs[_0x2a49('0x30')](_0x31318a[_0x2a49('0x49')][_0x2a49('0x30')]);_0x37517a[_0x2a49('0x2f')]=qs[_0x2a49('0x2f')](_0x31318a['query'][_0x2a49('0x2f')]);}_0x37517a[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x31318a[_0x2a49('0x49')][_0x2a49('0x51')]);_0x37517a[_0x2a49('0x52')]=qs[_0x2a49('0x4a')](_[_0x2a49('0x53')](_0x31318a[_0x2a49('0x49')],_0x56eae6['filters']));_0x37517a[_0x2a49('0x52')][_0x2a49('0x6b')]=_0x3210fa['id'];if(_0x31318a[_0x2a49('0x49')]['filter']){_0x37517a[_0x2a49('0x52')]=_[_0x2a49('0x55')](_0x37517a[_0x2a49('0x52')],{'$or':_[_0x2a49('0x40')](_0x37517a[_0x2a49('0x4c')],function(_0x35948c){var _0x27bd4b={};_0x27bd4b[_0x35948c]={'$like':'%'+_0x31318a[_0x2a49('0x49')]['filter']+'%'};return _0x27bd4b;})});}_0x37517a=_[_0x2a49('0x55')]({},_0x37517a,_0x31318a[_0x2a49('0x57')]);return db[_0x2a49('0x6c')]['count']({'where':_0x37517a['where']})['then'](function(_0x41b161){_0x58b1d0[_0x2a49('0x6f')]=_0x41b161;if(_0x31318a[_0x2a49('0x49')][_0x2a49('0x58')]){_0x37517a[_0x2a49('0x59')]=[{'all':!![]}];}return db[_0x2a49('0x6c')][_0x2a49('0x5a')](_0x37517a);})[_0x2a49('0x20')](function(_0x403808){_0x58b1d0['rows']=_0x403808;return _0x58b1d0;});}})[_0x2a49('0x20')](respondWithFilteredResult(_0x30daf3,_0x37517a))[_0x2a49('0x2b')](handleError(_0x30daf3,null));};exports[_0x2a49('0x70')]=function(_0x58a205,_0x1c87bc,_0x510e3b){return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x58a205[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x1c87bc,null))[_0x2a49('0x20')](function(_0x47fe0a){if(_0x47fe0a){return _0x47fe0a[_0x2a49('0x70')](_0x58a205[_0x2a49('0x49')][_0x2a49('0x71')]);}})[_0x2a49('0x20')](respondWithStatusCode(_0x1c87bc,null))[_0x2a49('0x2b')](handleError(_0x1c87bc,null));};exports[_0x2a49('0x72')]=function(_0x46447d,_0x1b6a57,_0x37300f){if(_0x46447d[_0x2a49('0x68')]['id']){delete _0x46447d[_0x2a49('0x68')]['id'];}return db['SmsAccount'][_0x2a49('0x64')]({'where':{'id':_0x46447d[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x1b6a57,null))[_0x2a49('0x20')](function(_0x5b5904){if(_0x5b5904){_0x46447d['body'][_0x2a49('0x6b')]=_0x5b5904['id'];return db['CannedAnswer'][_0x2a49('0x60')](_0x46447d[_0x2a49('0x68')]);}})[_0x2a49('0x20')](respondWithResult(_0x1b6a57,null))[_0x2a49('0x2b')](handleError(_0x1b6a57,null));};exports[_0x2a49('0x73')]=function(_0x24bdf6,_0x224ba9,_0x1ef316){var _0x1838f2={'raw':![],'where':{}};var _0x2ba344={};var _0x235023={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2a49('0x6e')]({'where':{'id':_0x24bdf6[_0x2a49('0x5d')]['id']}})['then'](handleEntityNotFound(_0x224ba9,null))['then'](function(_0x4be739){if(_0x4be739){_0x2ba344['model']=_[_0x2a49('0x48')](db[_0x2a49('0x74')][_0x2a49('0x42')]);_0x2ba344['query']=_[_0x2a49('0x48')](_0x24bdf6[_0x2a49('0x49')]);_0x2ba344[_0x2a49('0x4a')]=_[_0x2a49('0x4b')](_0x2ba344[_0x2a49('0x46')],_0x2ba344[_0x2a49('0x49')]);_0x1838f2[_0x2a49('0x4c')]=_[_0x2a49('0x4b')](_0x2ba344['model'],qs[_0x2a49('0x4d')](_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x4d')]));_0x1838f2[_0x2a49('0x4c')]=_0x1838f2[_0x2a49('0x4c')]['length']?_0x1838f2['attributes']:_0x2ba344[_0x2a49('0x46')];if(!_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x4e')]('nolimit')){_0x1838f2[_0x2a49('0x30')]=qs['limit'](_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x30')]);_0x1838f2[_0x2a49('0x2f')]=qs[_0x2a49('0x2f')](_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x2f')]);}_0x1838f2[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x51')]);_0x1838f2[_0x2a49('0x52')]=qs['filters'](_['pick'](_0x24bdf6[_0x2a49('0x49')],_0x2ba344[_0x2a49('0x4a')]));_0x1838f2[_0x2a49('0x52')][_0x2a49('0x6b')]=_0x4be739['id'];if(_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x54')]){_0x1838f2['where']=_[_0x2a49('0x55')](_0x1838f2[_0x2a49('0x52')],{'$or':_['map'](_0x1838f2['attributes'],function(_0x162044){var _0x1e478b={};_0x1e478b[_0x162044]={'$like':'%'+_0x24bdf6[_0x2a49('0x49')][_0x2a49('0x54')]+'%'};return _0x1e478b;})});}_0x1838f2=_[_0x2a49('0x55')]({},_0x1838f2,_0x24bdf6[_0x2a49('0x57')]);return db['CannedAnswer']['count']({'where':_0x1838f2[_0x2a49('0x52')]})['then'](function(_0x19895d){_0x235023[_0x2a49('0x6f')]=_0x19895d;if(_0x24bdf6['query'][_0x2a49('0x58')]){_0x1838f2['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x2a49('0x5a')](_0x1838f2);})[_0x2a49('0x20')](function(_0x36e004){_0x235023[_0x2a49('0x5b')]=_0x36e004;return _0x235023;});}})['then'](respondWithFilteredResult(_0x224ba9,_0x1838f2))[_0x2a49('0x2b')](handleError(_0x224ba9,null));};exports[_0x2a49('0x75')]=function(_0x3cfa58,_0x29bdf9,_0x4a6307){return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x3cfa58['params']['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x29bdf9,null))[_0x2a49('0x20')](function(_0x15e983){if(_0x15e983){return _0x15e983[_0x2a49('0x75')](_0x3cfa58['query'][_0x2a49('0x71')]);}})[_0x2a49('0x20')](respondWithStatusCode(_0x29bdf9,null))[_0x2a49('0x2b')](handleError(_0x29bdf9,null));};exports[_0x2a49('0x76')]=function(_0x24dd49,_0x288747,_0x156f5d){var _0x165d9a={'channel':_0x2a49('0x77')};var _0x723f82=[];var _0x4c1696=[];var _0x278cba={};return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x24dd49[_0x2a49('0x5d')]['id']},'include':[{'model':db[_0x2a49('0x78')],'as':_0x2a49('0x79')}]})[_0x2a49('0x20')](handleEntityNotFound(_0x288747,null))[_0x2a49('0x20')](function(_0x13ba8f){_0x165d9a[_0x2a49('0x7a')]=_0x13ba8f;_0x165d9a['applications']=_[_0x2a49('0x7b')](_0x13ba8f[_0x2a49('0x79')],[_0x2a49('0x7c')],[_0x2a49('0x7d')]);if(_0x165d9a[_0x2a49('0x7a')][_0x2a49('0x79')]){delete _0x165d9a[_0x2a49('0x7a')][_0x2a49('0x79')];}return db[_0x2a49('0x7e')][_0x2a49('0x69')]();})[_0x2a49('0x20')](function(_0x34ef90){if(!_0x34ef90){throw new db[(_0x2a49('0x7f'))]['ValidationError'](_0x2a49('0x80'));}_0x723f82=_['difference'](_[_0x2a49('0x48')](_0x34ef90),[_0x2a49('0x81'),_0x2a49('0x82')]);_0x4c1696=_[_0x2a49('0x83')](_[_0x2a49('0x48')](_0x34ef90),[_0x2a49('0x81'),_0x2a49('0x82'),_0x2a49('0x84'),'ListId']);_0x165d9a['body']={'mapKey':'mobile'};if(_0x165d9a[_0x2a49('0x7a')]['type']){switch(_0x165d9a[_0x2a49('0x7a')][_0x2a49('0x44')]){case _0x2a49('0x85'):_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')]=_0x24dd49['body']['From'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')]['Body'];_0x165d9a['body'][_0x2a49('0x87')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x88')];break;case _0x2a49('0x89'):_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')]='+'+_0x24dd49['body']['sender'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x8a')];break;case'connectel':_0x165d9a['body'][_0x2a49('0x86')]=_0x24dd49['body']['from'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')]['message'];break;case _0x2a49('0x8b'):_0x165d9a['body']['from']=_0x24dd49[_0x2a49('0x68')]['from'];_0x165d9a[_0x2a49('0x68')]['body']=_0x24dd49['body']['body'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x87')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x8c')];break;case _0x2a49('0x8d'):_0x165d9a[_0x2a49('0x68')]['from']=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x8e')];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x8f')];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x87')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x90')];break;case _0x2a49('0x91'):_0x165d9a[_0x2a49('0x68')]['from']='+'+_0x24dd49[_0x2a49('0x68')][_0x2a49('0x92')][0x0]['from'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x92')][0x0]['text'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x87')]=_0x24dd49[_0x2a49('0x68')]['results'][0x0][_0x2a49('0x87')];break;case'csc':_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x93')];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x94')][_0x2a49('0x29')];break;case _0x2a49('0x95'):_0x165d9a['body'][_0x2a49('0x86')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x96')];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49['body'][_0x2a49('0x8a')];_0x165d9a[_0x2a49('0x68')]['messageId']=_0x24dd49['body'][_0x2a49('0x97')];break;case'bandwidth':_0x165d9a[_0x2a49('0x68')][_0x2a49('0x87')]=_0x24dd49[_0x2a49('0x68')][0x0][_0x2a49('0x29')]['id'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')]=_0x24dd49[_0x2a49('0x68')][0x0][_0x2a49('0x29')]['from'];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49[_0x2a49('0x68')][0x0][_0x2a49('0x29')]['text'];break;case _0x2a49('0x98'):_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')]=_0x24dd49[_0x2a49('0x68')][_0x2a49('0x86')];_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]=_0x24dd49['body'][_0x2a49('0x29')];_0x165d9a[_0x2a49('0x68')]['messageId']=_0x24dd49[_0x2a49('0x68')]['refid'];break;}}if(_0x165d9a[_0x2a49('0x68')]['id']){delete _0x165d9a[_0x2a49('0x68')]['id'];}if(_[_0x2a49('0x99')](_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')])){throw new db[(_0x2a49('0x7f'))][(_0x2a49('0x9a'))](_0x2a49('0x9b'));}if(_[_0x2a49('0x99')](_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')])||_0x165d9a[_0x2a49('0x68')][_0x2a49('0x68')]===''){throw new db[(_0x2a49('0x7f'))][(_0x2a49('0x9a'))](_0x2a49('0x9c'));}if(_['isNil'](_0x165d9a[_0x2a49('0x68')][_0x2a49('0x9d')])){throw new db[(_0x2a49('0x7f'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4c1696);}if(!_[_0x2a49('0x9e')](_0x4c1696,_0x165d9a[_0x2a49('0x68')][_0x2a49('0x9d')])){throw new db[(_0x2a49('0x7f'))][(_0x2a49('0x9a'))](_0x2a49('0x9f')+_0x4c1696);}_0x278cba[_0x165d9a[_0x2a49('0x68')][_0x2a49('0x9d')]]=_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')];return db[_0x2a49('0xa0')][_0x2a49('0x64')]({'where':{'id':_0x165d9a[_0x2a49('0x7a')][_0x2a49('0xa1')]},'include':[{'model':db[_0x2a49('0x7e')],'as':_0x2a49('0xa2'),'where':_0x278cba,'limit':0x1,'order':[[_0x2a49('0x82'),_0x2a49('0xa3')]]}]});})[_0x2a49('0x20')](handleEntityNotFound(_0x288747,null))[_0x2a49('0x20')](function(_0xc17ec){if(_0xc17ec){_0x165d9a[_0x2a49('0xa4')]=_['omit'](_0xc17ec,[_0x2a49('0xa2')]);if(_0xc17ec[_0x2a49('0xa2')][_0x2a49('0x5f')]){return _0xc17ec[_0x2a49('0xa2')][0x0];}var _0x2b0df8=_[_0x2a49('0x1a')](_0x165d9a[_0x2a49('0x68')],{'firstName':_0x165d9a[_0x2a49('0x68')]['from'],'ListId':_0xc17ec['id']});_0x2b0df8[_0x165d9a['body']['mapKey']]=_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')];return db[_0x2a49('0x7e')][_0x2a49('0x60')](_0x2b0df8,{'fields':_0x723f82,'raw':!![]});}})[_0x2a49('0x20')](handleEntityNotFound(_0x288747,null))[_0x2a49('0x20')](function(_0x3141f8){if(_0x3141f8){_0x165d9a['contact']=_0x3141f8;var _0x186117={'ContactId':_0x3141f8['id'],'phone':_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')],'SmsAccountId':_0x24dd49[_0x2a49('0x5d')]['id']};var _0x4b0434={'ContactId':_0x3141f8['id'],'SmsAccountId':_0x24dd49['params']['id'],'closed':![]};return db[_0x2a49('0xa5')][_0x2a49('0x64')]({'where':_0x4b0434})[_0x2a49('0x20')](function(_0x240255){if(_0x240255){return[_0x240255,![]];}return db[_0x2a49('0xa5')][_0x2a49('0x60')](_0x186117)['then'](function(_0x507f27){return[_0x507f27,!![]];});});}})['spread'](function(_0x5b39c4,_0x15f8de){_0x165d9a[_0x2a49('0xa6')]=_0x5b39c4[_0x2a49('0x38')]({'plain':!![]});_0x165d9a[_0x2a49('0xa6')][_0x2a49('0xa7')]=![];if(_0x15f8de){if(_0x165d9a[_0x2a49('0x7a')][_0x2a49('0xa8')]){_0x165d9a[_0x2a49('0xa9')][_0x2a49('0xaa')]({'id':0x0,'priority':_0x165d9a['applications'][_0x2a49('0x5f')]+0x1,'app':'close','appdata':_0x2a49('0xab'),'interval':_0x2a49('0xac')});}_0x165d9a[_0x2a49('0xa6')][_0x2a49('0xa7')]=!![];}return db[_0x2a49('0xad')][_0x2a49('0x60')]({'phone':_0x165d9a[_0x2a49('0x68')][_0x2a49('0x86')],'messageId':_0x165d9a[_0x2a49('0x68')][_0x2a49('0x87')],'body':_0x165d9a['body'][_0x2a49('0x68')],'SmsAccountId':_0x24dd49[_0x2a49('0x5d')]['id'],'SmsInteractionId':_0x5b39c4['id'],'direction':'in','ContactId':_0x5b39c4['ContactId'],'AttachmentId':_0x165d9a[_0x2a49('0x68')][_0x2a49('0xae')]});})[_0x2a49('0x20')](function(_0x3e78eb){_0x165d9a[_0x2a49('0x29')]=_0x3e78eb;if(_0x165d9a[_0x2a49('0xa6')][_0x2a49('0xaf')]){return db[_0x2a49('0xb0')]['find']({'attributes':['id','name'],'where':{'id':_0x165d9a[_0x2a49('0xa6')][_0x2a49('0xaf')]}})[_0x2a49('0x20')](function(_0x29067e){if(_0x29067e){_0x165d9a[_0x2a49('0xa9')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2a49('0xb1'),'appdata':_0x29067e[_0x2a49('0x47')]+','+(_0x165d9a[_0x2a49('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2a49('0xb2'),_0x2a49('0xb3'),_0x165d9a);});}return respondWithRpcPromise(_0x2a49('0xb2'),_0x2a49('0xb3'),_0x165d9a);})['then'](function(_0x3b9b16){if(_0x3b9b16){var _0xc6422f=0xc8;var _0x505c27=_0x2a49('0xb4');logger[_0x2a49('0x21')](_0x2a49('0x25'),_0x505c27,_0xc6422f,_0x2a49('0xb5'));logger[_0x2a49('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x505c27,_0xc6422f,_0x2a49('0xb5'),JSON['stringify'](_0x3b9b16));if(_0x165d9a[_0x2a49('0x7a')][_0x2a49('0x44')]===_0x2a49('0x85')){return _0x288747[_0x2a49('0x2d')](_0xc6422f)[_0x2a49('0x31')](_0x2a49('0xb6'),'text/xml')[_0x2a49('0x3d')](_0x2a49('0xb7'));}else{return _0x288747[_0x2a49('0x2d')](_0xc6422f)[_0x2a49('0x2e')](_0x3b9b16);}}})[_0x2a49('0x2b')](handleError(_0x288747,null));};exports[_0x2a49('0xb8')]=function(_0x11ea18,_0x411de3){var _0x1ee337=_0x11ea18['params']['id'];var _0x58eca1=_0x11ea18[_0x2a49('0x68')];var _0x3128dd=0xc8;var _0x18b419=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2a49('0xb9')]['Transaction'][_0x2a49('0xba')][_0x2a49('0xbb')]},function(_0x3f319c){return db[_0x2a49('0x41')][_0x2a49('0x6e')]({'where':{'id':_0x1ee337},'transaction':_0x3f319c})[_0x2a49('0x20')](function(_0x36ea28){if(_0x36ea28){return db[_0x2a49('0x78')]['destroy']({'where':{'SmsAccountId':_0x1ee337},'transaction':_0x3f319c})[_0x2a49('0x20')](function(){var _0x57a292=_['map'](_0x58eca1,function(_0x577ea5){_0x577ea5[_0x2a49('0x6b')]=_0x1ee337;return _0x577ea5;});return db[_0x2a49('0x78')]['bulkCreate'](_0x57a292,{'transaction':_0x3f319c});});}else{_0x3128dd=0x194;_0x18b419=[];}});})['then'](function(){if(_0x3128dd!==0x194){return db[_0x2a49('0x78')][_0x2a49('0xbc')]({'where':{'SmsAccountId':_0x1ee337},'order':_0x2a49('0x7c')})[_0x2a49('0x20')](function(_0x36b02e){_0x18b419=_0x36b02e;});}})['catch'](function(_0x251a21){_0x3128dd=0x1f4;logger[_0x2a49('0x27')](_0x251a21['stack']);if(_0x251a21[_0x2a49('0x47')]){delete _0x251a21[_0x2a49('0x47')];}_0x18b419=_0x251a21;})['finally'](function(){if(_0x18b419===null){_0x411de3[_0x2a49('0x2c')](_0x3128dd);}else{if(_0x3128dd===0x1f4){_0x411de3[_0x2a49('0x2d')](_0x3128dd)['send'](_0x18b419);}else{_0x411de3[_0x2a49('0x2d')](_0x3128dd)[_0x2a49('0x2e')](_0x18b419);}}});};exports['getApplications']=function(_0x30bea3,_0x1e64b6,_0x58f7cf){var _0x31a508={};var _0x350036={};var _0x4790e3;var _0x504753;return db[_0x2a49('0x41')][_0x2a49('0x6e')]({'where':{'id':_0x30bea3[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x1e64b6,null))['then'](function(_0x3f7641){if(_0x3f7641){_0x4790e3=_0x3f7641;_0x350036['model']=_[_0x2a49('0x48')](db['SmsApplication'][_0x2a49('0x42')]);_0x350036[_0x2a49('0x49')]=_[_0x2a49('0x48')](_0x30bea3['query']);_0x350036[_0x2a49('0x4a')]=_[_0x2a49('0x4b')](_0x350036['model'],_0x350036[_0x2a49('0x49')]);_0x31a508[_0x2a49('0x4c')]=_['intersection'](_0x350036['model'],qs[_0x2a49('0x4d')](_0x30bea3[_0x2a49('0x49')][_0x2a49('0x4d')]));_0x31a508[_0x2a49('0x4c')]=_0x31a508['attributes'][_0x2a49('0x5f')]?_0x31a508[_0x2a49('0x4c')]:_0x350036[_0x2a49('0x46')];_0x31a508[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x30bea3[_0x2a49('0x49')][_0x2a49('0x51')]);_0x31a508[_0x2a49('0x52')]=qs[_0x2a49('0x4a')](_['pick'](_0x30bea3['query'],_0x350036[_0x2a49('0x4a')]));if(_0x30bea3[_0x2a49('0x49')][_0x2a49('0x54')]){_0x31a508[_0x2a49('0x52')]=_[_0x2a49('0x55')](_0x31a508['where'],{'$or':_['map'](_0x31a508[_0x2a49('0x4c')],function(_0x596e8c){var _0xc9b03e={};_0xc9b03e[_0x596e8c]={'$like':'%'+_0x30bea3['query'][_0x2a49('0x54')]+'%'};return _0xc9b03e;})});}_0x31a508=_['merge']({},_0x31a508,_0x30bea3[_0x2a49('0x57')]);return _0x4790e3[_0x2a49('0xbd')](_0x31a508);}})[_0x2a49('0x20')](function(_0x2fb150){if(_0x2fb150){_0x504753=_0x2fb150['length'];if(!_0x30bea3[_0x2a49('0x49')]['hasOwnProperty'](_0x2a49('0x4f'))){_0x31a508[_0x2a49('0x30')]=qs['limit'](_0x30bea3['query'][_0x2a49('0x30')]);_0x31a508[_0x2a49('0x2f')]=qs[_0x2a49('0x2f')](_0x30bea3[_0x2a49('0x49')][_0x2a49('0x2f')]);}return _0x4790e3[_0x2a49('0xbd')](_0x31a508);}})[_0x2a49('0x20')](function(_0x4d5a0f){if(_0x4d5a0f){return _0x4d5a0f?{'count':_0x504753,'rows':_0x4d5a0f}:null;}})[_0x2a49('0x20')](respondWithResult(_0x1e64b6,null))['catch'](handleError(_0x1e64b6,null));};exports[_0x2a49('0xbe')]=function(_0x2718eb,_0x23e14e,_0x5d83fd){var _0x24b273={'raw':![],'where':{}};var _0x2624fc={};var _0x52cf99={'count':0x0,'rows':[]};return db[_0x2a49('0x41')]['findOne']({'where':{'id':_0x2718eb[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x23e14e,null))[_0x2a49('0x20')](function(_0x3e218f){if(_0x3e218f){_0x2624fc[_0x2a49('0x46')]=_[_0x2a49('0x48')](db[_0x2a49('0xa5')][_0x2a49('0x42')]);_0x2624fc[_0x2a49('0x49')]=_[_0x2a49('0x48')](_0x2718eb[_0x2a49('0x49')]);_0x2624fc[_0x2a49('0x4a')]=_['intersection'](_0x2624fc['model'],_0x2624fc[_0x2a49('0x49')]);_0x24b273['attributes']=_['intersection'](_0x2624fc[_0x2a49('0x46')],qs[_0x2a49('0x4d')](_0x2718eb[_0x2a49('0x49')]['fields']));_0x24b273[_0x2a49('0x4c')]=_0x24b273[_0x2a49('0x4c')][_0x2a49('0x5f')]?_0x24b273[_0x2a49('0x4c')]:_0x2624fc[_0x2a49('0x46')];if(!_0x2718eb[_0x2a49('0x49')][_0x2a49('0x4e')](_0x2a49('0x4f'))){_0x24b273[_0x2a49('0x30')]=qs['limit'](_0x2718eb['query'][_0x2a49('0x30')]);_0x24b273[_0x2a49('0x2f')]=qs[_0x2a49('0x2f')](_0x2718eb['query'][_0x2a49('0x2f')]);}_0x24b273[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x2718eb[_0x2a49('0x49')]['sort']);_0x24b273[_0x2a49('0x52')]=qs[_0x2a49('0x4a')](_['pick'](_0x2718eb['query'],_0x2624fc['filters']));_0x24b273[_0x2a49('0x52')][_0x2a49('0x6b')]=_0x3e218f['id'];if(_0x2718eb['query'][_0x2a49('0x54')]){_0x24b273[_0x2a49('0x52')]=_['merge'](_0x24b273[_0x2a49('0x52')],{'$or':_[_0x2a49('0x40')](_0x24b273['attributes'],function(_0x579b27){var _0x42dce7={};_0x42dce7[_0x579b27]={'$like':'%'+_0x2718eb[_0x2a49('0x49')]['filter']+'%'};return _0x42dce7;})});}_0x24b273=_['merge']({},_0x24b273,_0x2718eb['options']);return db[_0x2a49('0xa5')][_0x2a49('0x6f')]({'where':_0x24b273[_0x2a49('0x52')]})['then'](function(_0x114ccc){_0x52cf99[_0x2a49('0x6f')]=_0x114ccc;if(_0x2718eb[_0x2a49('0x49')]['includeAll']){_0x24b273[_0x2a49('0x59')]=[{'model':db[_0x2a49('0x7e')],'as':_0x2a49('0xbf'),'required':![]},{'model':db[_0x2a49('0xb0')],'as':_0x2a49('0xc0'),'attributes':[_0x2a49('0x47'),_0x2a49('0xc1'),_0x2a49('0xc2')],'required':![]},{'model':db[_0x2a49('0xc3')],'as':_0x2a49('0xc4'),'attributes':['id',_0x2a49('0x47'),_0x2a49('0xc5')],'where':_0x2718eb[_0x2a49('0x49')][_0x2a49('0xc6')]?{'id':_0x2718eb['query'][_0x2a49('0xc6')]}:undefined,'required':_0x2718eb[_0x2a49('0x49')]['tag']?!![]:![]}];}return db[_0x2a49('0xa5')][_0x2a49('0x5a')](_0x24b273);})[_0x2a49('0x20')](function(_0x40ba6d){_0x52cf99[_0x2a49('0x5b')]=_0x40ba6d;return _0x52cf99;});}})[_0x2a49('0x20')](respondWithFilteredResult(_0x23e14e,_0x24b273))[_0x2a49('0x2b')](handleError(_0x23e14e,null));};exports[_0x2a49('0x3d')]=function(_0x58e3b0,_0x3a75c2,_0x5b2315){var _0x544082,_0xddd41e,_0xb109f8;if(_[_0x2a49('0x99')](_0x58e3b0[_0x2a49('0x68')][_0x2a49('0x68')])||_0x58e3b0['body']['body']===''){throw new db['Sequelize'][(_0x2a49('0x9a'))](_0x2a49('0x9c'));}if(_[_0x2a49('0x99')](_0x58e3b0[_0x2a49('0x68')]['to'])){throw new db[(_0x2a49('0x7f'))][(_0x2a49('0x9a'))](_0x2a49('0xc7'));}_0x544082=_0x58e3b0['body']['to'];return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x58e3b0[_0x2a49('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2a49('0x7e')],'as':'Contacts','where':{'mobile':_0x544082},'limit':0x1,'order':[['updatedAt',_0x2a49('0xa3')]]}]}]})[_0x2a49('0x20')](handleEntityNotFound(_0x3a75c2,null))['then'](function(_0x500aef){if(_0x500aef&&_0x500aef[_0x2a49('0xc8')]){_0xddd41e=_0x500aef['get']({'plain':!![]});if(_0xddd41e[_0x2a49('0xc8')]&&_0xddd41e[_0x2a49('0xc8')][_0x2a49('0xa2')][_0x2a49('0x5f')]){return _0xddd41e[_0x2a49('0xc8')][_0x2a49('0xa2')][0x0];}return db[_0x2a49('0x7e')][_0x2a49('0x60')](_['defaults'](_0x58e3b0['body'],{'firstName':_0x544082,'mobile':_0x544082,'phone':_0x544082,'ListId':_0xddd41e[_0x2a49('0xa1')]}));}})[_0x2a49('0x20')](handleEntityNotFound(_0x3a75c2,null))[_0x2a49('0x20')](function(_0x2dfc4c){if(_0x2dfc4c){_0xb109f8=_0x2dfc4c;return db[_0x2a49('0xa5')][_0x2a49('0x64')]({'where':{'ContactId':_0xb109f8['id'],'closed':![],'SmsAccountId':_0xddd41e['id']}})['then'](function(_0x206655){if(_0x206655){return[_0x206655,![]];}return db[_0x2a49('0xa5')][_0x2a49('0x60')]({'UserId':_0x58e3b0[_0x2a49('0x61')]['id'],'ContactId':_0xb109f8['id'],'SmsAccountId':_0xddd41e['id'],'phone':_0x544082,'firstMsgDirection':_0x2a49('0xc9'),'Messages':[_[_0x2a49('0x55')](_0x58e3b0[_0x2a49('0x68')],{'read':![],'body':_0x58e3b0[_0x2a49('0x68')][_0x2a49('0x68')],'phone':_0x544082,'SmsAccountId':_0xddd41e['id'],'UserId':_0x58e3b0[_0x2a49('0x61')]['id'],'ContactId':_0xb109f8['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x2a49('0xca')}]})[_0x2a49('0x20')](function(_0x4f0037){return[_0x4f0037,!![]];});});}})[_0x2a49('0xcb')](function(_0x1e0a09,_0x39368d){if(_0x39368d){return _0x1e0a09;}return db[_0x2a49('0xad')][_0x2a49('0x60')](_['merge'](_0x58e3b0[_0x2a49('0x68')],{'read':![],'body':_0x58e3b0[_0x2a49('0x68')]['body'],'phone':_0x544082,'SmsAccountId':_0xddd41e['id'],'SmsInteractionId':_0x1e0a09['id'],'UserId':_0x58e3b0[_0x2a49('0x61')]['id'],'ContactId':_0xb109f8['id']}))[_0x2a49('0x20')](function(_0x1e1fdc){_0x1e0a09[_0x2a49('0xcc')][_0x2a49('0xca')]=[];_0x1e0a09['dataValues'][_0x2a49('0xca')][_0x2a49('0xaa')](_0x1e1fdc[_0x2a49('0xcc')]);return _0x1e0a09;});})[_0x2a49('0x20')](respondWithResult(_0x3a75c2,null))[_0x2a49('0x2b')](handleError(_0x3a75c2,null));};exports[_0x2a49('0x2d')]=function(_0x30eed5,_0x41e839,_0x4fa055){if(_0x30eed5['body']['id']){delete _0x30eed5['body']['id'];}var _0x44622f,_0xdee89e,_0x516e79;return db[_0x2a49('0x41')]['find']({'where':{'id':_0x30eed5['params']['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x41e839,null))[_0x2a49('0x20')](function(_0x259fe7){if(_0x259fe7){_0x516e79=_0x259fe7;logger['debug'](_0x2a49('0x25'),_0x2a49('0x2d'),_0x2a49('0xcd'),_0x259fe7['type'],util[_0x2a49('0xce')](_0x30eed5['body'],{'showHidden':![],'depth':null}));switch(_0x259fe7[_0x2a49('0x44')]){case _0x2a49('0x89'):if(_0x30eed5[_0x2a49('0x68')][_0x2a49('0xcf')]&&_0x30eed5[_0x2a49('0x68')]['status']){_0xdee89e=_0x30eed5[_0x2a49('0x68')]['status'];return db['SmsMessage'][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5['body']['skebby_dispatch_id']}});}break;case _0x2a49('0xd0'):if(_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd1')]&&_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd2')]){_0xdee89e=_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd2')];return db[_0x2a49('0xad')][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd1')]}});}break;case _0x2a49('0x8b'):if(_0x30eed5[_0x2a49('0x68')][_0x2a49('0x8c')]&&_0x30eed5['body'][_0x2a49('0xd3')]){_0xdee89e=_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd3')];return db[_0x2a49('0xad')][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5['body'][_0x2a49('0x8c')]}});}break;case _0x2a49('0x91'):var _0x37a5e4=_0x30eed5[_0x2a49('0x68')][_0x2a49('0x92')][0x0];if(_0x37a5e4['messageId']&&_0x37a5e4[_0x2a49('0x2d')]['groupName']===_0x2a49('0xd4')){_0xdee89e=_0x37a5e4[_0x2a49('0x2d')][_0x2a49('0xd5')];return db['SmsMessage'][_0x2a49('0x64')]({'where':{'messageId':_0x37a5e4['messageId']}});}break;case _0x2a49('0x95'):if(_0x30eed5[_0x2a49('0x68')][_0x2a49('0x87')]&&_0x30eed5['body']['status']){_0xdee89e=_0x30eed5[_0x2a49('0x68')][_0x2a49('0x2d')];return db['SmsMessage'][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5[_0x2a49('0x68')][_0x2a49('0x87')]}});}break;case _0x2a49('0xd6'):if(_0x30eed5[_0x2a49('0x68')][0x0][_0x2a49('0x29')]['id']){_0xdee89e=_0x30eed5[_0x2a49('0x68')][0x0][_0x2a49('0x44')];return db[_0x2a49('0xad')][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5[_0x2a49('0x68')][0x0][_0x2a49('0x29')]['id']}});}break;case'intelepeer':if(_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd7')]&&_0x30eed5[_0x2a49('0x68')][_0x2a49('0x2d')]){_0xdee89e=_0x30eed5[_0x2a49('0x68')][_0x2a49('0x2d')];return db[_0x2a49('0xad')][_0x2a49('0x64')]({'where':{'messageId':_0x30eed5[_0x2a49('0x68')][_0x2a49('0xd7')]}});}break;}}})[_0x2a49('0x20')](handleEntityNotFound(_0x41e839,null))[_0x2a49('0x20')](function(_0xe2f731){if(_0xe2f731){_0x44622f=_0xe2f731;switch(_0x516e79[_0x2a49('0x44')]){case _0x2a49('0x89'):if(_0xdee89e==='DELIVERED'){return _0x44622f['update']({'read':!![]});}else{logger[_0x2a49('0x27')](_0x2a49('0x25'),_0x2a49('0x2d'),_0x2a49('0x89'),util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case _0x2a49('0xd0'):if(_0xdee89e==='1'){return _0x44622f[_0x2a49('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a49('0x2d'),_0x2a49('0x89'),util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case _0x2a49('0x8b'):if(!_0x30eed5[_0x2a49('0x68')]['error_code']&&_0xdee89e>=0xc8&&_0xdee89e<=0xce){return _0x44622f[_0x2a49('0x36')]({'read':!![]});}else{logger[_0x2a49('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a49('0x2d'),_0x2a49('0x8b'),util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case _0x2a49('0x91'):var _0x2c4a1f=_0x30eed5[_0x2a49('0x68')][_0x2a49('0x92')][0x0];if(_0x2c4a1f[_0x2a49('0x2d')][_0x2a49('0xd5')]===_0x2a49('0xd4')){return _0x44622f['update']({'read':!![]});}else{logger[_0x2a49('0x27')](_0x2a49('0x25'),_0x2a49('0x2d'),'infobip',util['inspect'](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case _0x2a49('0x95'):if(_0xdee89e==_0x2a49('0xd8')||_0xdee89e==_0x2a49('0xd9')){return _0x44622f[_0x2a49('0x36')]({'read':!![]});}else{logger['error'](_0x2a49('0x25'),_0x2a49('0x2d'),_0x2a49('0x95'),util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0xdee89e==_0x2a49('0xda')){return _0x44622f[_0x2a49('0x36')]({'read':!![]});}else{logger['error'](_0x2a49('0x25'),_0x2a49('0x2d'),'bandwidth',util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;case _0x2a49('0x98'):if(_0xdee89e===_0x2a49('0xdb')||_0xdee89e==='ACCEPTD'){return _0x44622f[_0x2a49('0x36')]({'read':!![]});}else{logger[_0x2a49('0x27')](_0x2a49('0x25'),_0x2a49('0x2d'),_0x2a49('0x98'),util[_0x2a49('0xce')](_0x30eed5[_0x2a49('0x68')],{'showHidden':![],'depth':null}));}break;}return _0x44622f;}})[_0x2a49('0x20')](respondWithResult(_0x41e839,null))['catch'](handleError(_0x41e839,null));};exports[_0x2a49('0xdc')]=function(_0x5fd025,_0x3a5a11,_0x1551e5){var _0x5c93c2,_0x1029fb,_0x527e25;return db[_0x2a49('0x41')]['find']({'where':{'id':_0x5fd025[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x3a5a11,null))['then'](function(_0x2ca011){if(_0x2ca011){_0x527e25=_0x2ca011;logger[_0x2a49('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a49('0x2d'),_0x2a49('0xcd'),_0x2ca011['type'],util[_0x2a49('0xce')](_0x5fd025[_0x2a49('0x49')],{'showHidden':![],'depth':null}));switch(_0x2ca011[_0x2a49('0x44')]){case _0x2a49('0xdd'):if(_0x5fd025[_0x2a49('0x49')]['message-id']&&_0x5fd025[_0x2a49('0x49')][_0x2a49('0xde')]){_0x1029fb=_0x5fd025[_0x2a49('0x49')]['state'];return db[_0x2a49('0xad')][_0x2a49('0x64')]({'where':{'messageId':_0x5fd025['query'][_0x2a49('0xdf')]}});}break;}}})[_0x2a49('0x20')](handleEntityNotFound(_0x3a5a11,null))[_0x2a49('0x20')](function(_0x50adc3){if(_0x50adc3){_0x5c93c2=_0x50adc3;switch(_0x527e25[_0x2a49('0x44')]){case _0x2a49('0xdd'):if(_0x1029fb==='2'||_0x1029fb==='6'){return _0x5c93c2[_0x2a49('0x36')]({'read':!![]});}else{logger[_0x2a49('0x27')](_0x2a49('0x25'),_0x2a49('0x2d'),'csc',util[_0x2a49('0xce')](_0x5fd025[_0x2a49('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x5c93c2;}})[_0x2a49('0x20')](respondWithResult(_0x3a5a11,null))[_0x2a49('0x2b')](handleError(_0x3a5a11,null));};exports['addAgents']=function(_0x4dd604,_0x5a36bc,_0x2cc957){return db[_0x2a49('0x41')][_0x2a49('0x64')]({'where':{'id':_0x4dd604[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x5a36bc,null))['then'](function(_0x3f782f){if(_0x3f782f){return _0x3f782f[_0x2a49('0xe0')](_0x4dd604[_0x2a49('0x68')]['ids'],_[_0x2a49('0xe1')](_0x4dd604[_0x2a49('0x68')],[_0x2a49('0x71'),'id'])||{})['spread'](function(_0xb77ffe){for(var _0x2f8fc2=0x0;_0x2f8fc2<_0x4dd604[_0x2a49('0x68')]['ids'][_0x2a49('0x5f')];_0x2f8fc2+=0x1){socket[_0x2a49('0xe2')](_0x2a49('0xe3'),{'UserId':Number(_0x4dd604['body']['ids'][_0x2f8fc2]),'SmsAccountId':Number(_0x4dd604[_0x2a49('0x5d')]['id'])});}return _0xb77ffe;});}})[_0x2a49('0x20')](respondWithResult(_0x5a36bc,null))[_0x2a49('0x2b')](handleError(_0x5a36bc,null));};exports[_0x2a49('0xe4')]=function(_0xfb0de3,_0x19ea37,_0x5db0ef){return db[_0x2a49('0x41')]['find']({'where':{'id':_0xfb0de3['params']['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x19ea37,null))['then'](function(_0x384fe5){if(_0x384fe5){return _0x384fe5[_0x2a49('0xe4')](_0xfb0de3[_0x2a49('0x49')][_0x2a49('0x71')])[_0x2a49('0x20')](function(){if(_['isArray'](_0xfb0de3[_0x2a49('0x49')]['ids'])){for(var _0x325772=0x0;_0x325772<_0xfb0de3[_0x2a49('0x49')][_0x2a49('0x71')][_0x2a49('0x5f')];_0x325772+=0x1){socket[_0x2a49('0xe2')](_0x2a49('0xe5'),{'UserId':Number(_0xfb0de3[_0x2a49('0x49')]['ids'][_0x325772]),'SmsAccountId':Number(_0xfb0de3[_0x2a49('0x5d')]['id'])});}}else{socket[_0x2a49('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0xfb0de3[_0x2a49('0x49')][_0x2a49('0x71')]),'SmsAccountId':Number(_0xfb0de3[_0x2a49('0x5d')]['id'])});}});}})[_0x2a49('0x20')](respondWithStatusCode(_0x19ea37,null))['catch'](handleError(_0x19ea37,null));};exports[_0x2a49('0xe6')]=function(_0x347bcb,_0x1efac4,_0xf96628){var _0x5effe2={};var _0xf454c6={};var _0xbe601d;var _0x4065a9;return db['SmsAccount'][_0x2a49('0x6e')]({'where':{'id':_0x347bcb[_0x2a49('0x5d')]['id']}})[_0x2a49('0x20')](handleEntityNotFound(_0x1efac4,null))['then'](function(_0x1e146d){if(_0x1e146d){_0xbe601d=_0x1e146d;_0xf454c6[_0x2a49('0x46')]=_['keys'](db['User'][_0x2a49('0x42')]);_0xf454c6[_0x2a49('0x49')]=_['keys'](_0x347bcb[_0x2a49('0x49')]);_0xf454c6[_0x2a49('0x4a')]=_[_0x2a49('0x4b')](_0xf454c6[_0x2a49('0x46')],_0xf454c6[_0x2a49('0x49')]);_0x5effe2[_0x2a49('0x4c')]=_[_0x2a49('0x4b')](_0xf454c6[_0x2a49('0x46')],qs[_0x2a49('0x4d')](_0x347bcb[_0x2a49('0x49')][_0x2a49('0x4d')]));_0x5effe2[_0x2a49('0x4c')]=_0x5effe2[_0x2a49('0x4c')][_0x2a49('0x5f')]?_0x5effe2[_0x2a49('0x4c')]:_0xf454c6[_0x2a49('0x46')];_0x5effe2[_0x2a49('0x50')]=qs[_0x2a49('0x51')](_0x347bcb['query']['sort']);_0x5effe2[_0x2a49('0x52')]=qs[_0x2a49('0x4a')](_[_0x2a49('0x53')](_0x347bcb[_0x2a49('0x49')],_0xf454c6[_0x2a49('0x4a')]));if(_0x347bcb[_0x2a49('0x49')][_0x2a49('0x54')]){_0x5effe2[_0x2a49('0x52')]=_[_0x2a49('0x55')](_0x5effe2['where'],{'$or':_[_0x2a49('0x40')](_0x5effe2[_0x2a49('0x4c')],function(_0x7a806c){var _0x6aa8b5={};_0x6aa8b5[_0x7a806c]={'$like':'%'+_0x347bcb['query'][_0x2a49('0x54')]+'%'};return _0x6aa8b5;})});}_0x5effe2=_[_0x2a49('0x55')]({},_0x5effe2,_0x347bcb[_0x2a49('0x57')]);return _0xbe601d[_0x2a49('0xe6')](_0x5effe2);}})[_0x2a49('0x20')](function(_0x3a232b){if(_0x3a232b){_0x4065a9=_0x3a232b['length'];if(!_0x347bcb['query'][_0x2a49('0x4e')](_0x2a49('0x4f'))){_0x5effe2[_0x2a49('0x30')]=qs[_0x2a49('0x30')](_0x347bcb[_0x2a49('0x49')][_0x2a49('0x30')]);_0x5effe2[_0x2a49('0x2f')]=qs['offset'](_0x347bcb[_0x2a49('0x49')][_0x2a49('0x2f')]);}return _0xbe601d[_0x2a49('0xe6')](_0x5effe2);}})[_0x2a49('0x20')](function(_0x2f61d5){if(_0x2f61d5){return _0x2f61d5?{'count':_0x4065a9,'rows':_0x2f61d5}:null;}})['then'](respondWithResult(_0x1efac4,null))[_0x2a49('0x2b')](handleError(_0x1efac4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index bbf70c4..39a8044 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 _0x4f14=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x2fd5d6,_0x215d57){var _0x46a46f=function(_0x398ee9){while(--_0x398ee9){_0x2fd5d6['push'](_0x2fd5d6['shift']());}};_0x46a46f(++_0x215d57);}(_0x4f14,0x1a7));var _0x44f1=function(_0x229c8b,_0x3fcef6){_0x229c8b=_0x229c8b-0x0;var _0x520a1b=_0x4f14[_0x229c8b];return _0x520a1b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x44f1('0x0'))['db'][_0x44f1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x44f1('0x2')](0x0);var events={'afterCreate':_0x44f1('0x3'),'afterUpdate':_0x44f1('0x4'),'afterDestroy':_0x44f1('0x5')};function emitEvent(_0xf442b2){return function(_0x2ef960,_0x2063b8,_0x315575){SmsAccountEvents['emit'](_0xf442b2+':'+_0x2ef960['id'],_0x2ef960);SmsAccountEvents['emit'](_0xf442b2,_0x2ef960);_0x315575(null);};}for(var e in events){if(events[_0x44f1('0x6')](e)){var event=events[e];SmsAccount[_0x44f1('0x7')](e,emitEvent(event));}}module[_0x44f1('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xff11=['events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x48e8b6,_0x1eb325){var _0x54b721=function(_0x3f99a4){while(--_0x3f99a4){_0x48e8b6['push'](_0x48e8b6['shift']());}};_0x54b721(++_0x1eb325);}(_0xff11,0x186));var _0x1ff1=function(_0x561c60,_0x22bc2e){_0x561c60=_0x561c60-0x0;var _0x3a73b4=_0xff11[_0x561c60];return _0x3a73b4;};'use strict';var EventEmitter=require(_0x1ff1('0x0'));var SmsAccount=require(_0x1ff1('0x1'))['db'][_0x1ff1('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x1ff1('0x3')](0x0);var events={'afterCreate':_0x1ff1('0x4'),'afterUpdate':_0x1ff1('0x5'),'afterDestroy':_0x1ff1('0x6')};function emitEvent(_0x312ef3){return function(_0x2aed8c,_0xad5de3,_0x2e1af6){SmsAccountEvents[_0x1ff1('0x7')](_0x312ef3+':'+_0x2aed8c['id'],_0x2aed8c);SmsAccountEvents[_0x1ff1('0x7')](_0x312ef3,_0x2aed8c);_0x2e1af6(null);};}for(var e in events){if(events[_0x1ff1('0x8')](e)){var event=events[e];SmsAccount[_0x1ff1('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2cfa5b4..8b9fb65 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 _0x53ac=['moment','bluebird','path','../../config/environment','./smsAccount.attributes','define','SmsAccount','util','../../config/logger','api'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53ac,0x16f));var _0xc53a=function(_0x1b269a,_0x15daf8){_0x1b269a=_0x1b269a-0x0;var _0x4efdd1=_0x53ac[_0x1b269a];return _0x4efdd1;};'use strict';var _=require('lodash');var util=require(_0xc53a('0x0'));var logger=require(_0xc53a('0x1'))(_0xc53a('0x2'));var moment=require(_0xc53a('0x3'));var BPromise=require(_0xc53a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53a('0x5'));var rimraf=require('rimraf');var config=require(_0xc53a('0x6'));var attributes=require(_0xc53a('0x7'));module['exports']=function(_0x49f1e0,_0x57d3af){return _0x49f1e0[_0xc53a('0x8')](_0xc53a('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d14=['sms_accounts','lodash','util','../../config/logger','bluebird','path','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x6d14,0x12d));var _0x46d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x46d1('0x0'));var util=require(_0x46d1('0x1'));var logger=require(_0x46d1('0x2'))('api');var moment=require('moment');var BPromise=require(_0x46d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46d1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x46d1('0x5'));module[_0x46d1('0x6')]=function(_0x42d987,_0x3b2c84){return _0x42d987[_0x46d1('0x7')](_0x46d1('0x8'),attributes,{'tableName':_0x46d1('0x9'),'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 206764d..7ea0a58 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 _0x77fe=['stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','options','raw','where','attributes','map','include','model','then','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./smsAccount.socket','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s'];(function(_0x59c20e,_0x272105){var _0x383b97=function(_0x3400cf){while(--_0x3400cf){_0x59c20e['push'](_0x59c20e['shift']());}};_0x383b97(++_0x272105);}(_0x77fe,0x1e1));var _0xe77f=function(_0x29aae5,_0x1c8a1c){_0x29aae5=_0x29aae5-0x0;var _0x297189=_0x77fe[_0x29aae5];return _0x297189;};'use strict';var _=require(_0xe77f('0x0'));var util=require('util');var moment=require(_0xe77f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe77f('0x2'))['db'];var utils=require(_0xe77f('0x3'));var logger=require(_0xe77f('0x4'))('rpc');var config=require(_0xe77f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe77f('0x6')]({'port':0x232a});config[_0xe77f('0x7')]=_[_0xe77f('0x8')](config['redis'],{'host':_0xe77f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe77f('0x7')]));require(_0xe77f('0xa'))['register'](socket);function respondWithRpcPromise(_0x5e8bba,_0x13efb7,_0x55be8d){return new BPromise(function(_0x290df3,_0x34b916){return client['request'](_0x5e8bba,_0x55be8d)['then'](function(_0x5f5df3){logger[_0xe77f('0xb')]('SmsAccount,\x20%s,\x20%s',_0x13efb7,_0xe77f('0xc'));logger[_0xe77f('0xd')](_0xe77f('0xe'),_0x13efb7,_0xe77f('0xc'),JSON[_0xe77f('0xf')](_0x5f5df3));if(_0x5f5df3[_0xe77f('0x10')]){if(_0x5f5df3[_0xe77f('0x10')][_0xe77f('0x11')]===0x1f4){logger[_0xe77f('0x10')]('SmsAccount,\x20%s,\x20%s',_0x13efb7,_0x5f5df3[_0xe77f('0x10')]['message']);return _0x34b916(_0x5f5df3[_0xe77f('0x10')]['message']);}logger[_0xe77f('0x10')](_0xe77f('0x12'),_0x13efb7,_0x5f5df3['error'][_0xe77f('0x13')]);return _0x290df3(_0x5f5df3[_0xe77f('0x10')][_0xe77f('0x13')]);}else{logger['info'](_0xe77f('0x12'),_0x13efb7,'request\x20sent');_0x290df3(_0x5f5df3[_0xe77f('0x14')][_0xe77f('0x13')]);}})[_0xe77f('0x15')](function(_0x1fb1a0){logger['error'](_0xe77f('0x12'),_0x13efb7,_0x1fb1a0);_0x34b916(_0x1fb1a0);});});}exports[_0xe77f('0x16')]=function(_0x1eb797){var _0x41cc5f=this;return new Promise(function(_0x580af1,_0x5e1fd7){return db['SmsAccount']['find']({'raw':_0x1eb797[_0xe77f('0x17')]?_0x1eb797['options'][_0xe77f('0x18')]===undefined?!![]:![]:!![],'where':_0x1eb797[_0xe77f('0x17')]?_0x1eb797[_0xe77f('0x17')][_0xe77f('0x19')]||null:null,'attributes':_0x1eb797[_0xe77f('0x17')]?_0x1eb797['options'][_0xe77f('0x1a')]||null:null,'include':_0x1eb797['options']?_0x1eb797[_0xe77f('0x17')]['include']?_[_0xe77f('0x1b')](_0x1eb797[_0xe77f('0x17')][_0xe77f('0x1c')],function(_0x3173f9){return{'model':db[_0x3173f9[_0xe77f('0x1d')]],'as':_0x3173f9['as'],'attributes':_0x3173f9[_0xe77f('0x1a')],'include':_0x3173f9[_0xe77f('0x1c')]?_[_0xe77f('0x1b')](_0x3173f9['include'],function(_0x34c203){return{'model':db[_0x34c203[_0xe77f('0x1d')]],'as':_0x34c203['as'],'attributes':_0x34c203['attributes'],'include':_0x34c203[_0xe77f('0x1c')]?_[_0xe77f('0x1b')](_0x34c203[_0xe77f('0x1c')],function(_0x32d065){return{'model':db[_0x32d065[_0xe77f('0x1d')]],'as':_0x32d065['as'],'attributes':_0x32d065[_0xe77f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe77f('0x1e')](function(_0x3abf38){logger[_0xe77f('0xb')]('ShowSmsAccount',_0x1eb797);logger[_0xe77f('0xd')](_0xe77f('0x16'),_0x1eb797,JSON[_0xe77f('0xf')](_0x3abf38));_0x580af1(_0x3abf38);})[_0xe77f('0x15')](function(_0xc2fd10){logger[_0xe77f('0x10')](_0xe77f('0x16'),_0xc2fd10[_0xe77f('0x13')],_0x1eb797);_0x5e1fd7(_0x41cc5f[_0xe77f('0x10')](0x1f4,_0xc2fd10['message']));});});}; \ No newline at end of file +var _0x7622=['redis','defaults','localhost','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','then','lodash','util','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x7622,0xc4));var _0x2762=function(_0x21ea7e,_0x5ec297){_0x21ea7e=_0x21ea7e-0x0;var _0xb9fe3=_0x7622[_0x21ea7e];return _0xb9fe3;};'use strict';var _=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2762('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2762('0x3'))('rpc');var config=require(_0x2762('0x4'));var jayson=require(_0x2762('0x5'));var client=jayson[_0x2762('0x6')][_0x2762('0x7')]({'port':0x232a});config[_0x2762('0x8')]=_[_0x2762('0x9')](config[_0x2762('0x8')],{'host':_0x2762('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2762('0xb'))[_0x2762('0xc')](socket);function respondWithRpcPromise(_0x302fed,_0xab9847,_0x206594){return new BPromise(function(_0x1e1fa5,_0x58af69){return client[_0x2762('0xd')](_0x302fed,_0x206594)['then'](function(_0x3737a9){logger[_0x2762('0xe')](_0x2762('0xf'),_0xab9847,_0x2762('0x10'));logger[_0x2762('0x11')](_0x2762('0x12'),_0xab9847,'request\x20sent',JSON[_0x2762('0x13')](_0x3737a9));if(_0x3737a9['error']){if(_0x3737a9[_0x2762('0x14')]['code']===0x1f4){logger['error'](_0x2762('0xf'),_0xab9847,_0x3737a9[_0x2762('0x14')]['message']);return _0x58af69(_0x3737a9['error']['message']);}logger['error'](_0x2762('0xf'),_0xab9847,_0x3737a9[_0x2762('0x14')][_0x2762('0x15')]);return _0x1e1fa5(_0x3737a9[_0x2762('0x14')][_0x2762('0x15')]);}else{logger[_0x2762('0xe')]('SmsAccount,\x20%s,\x20%s',_0xab9847,_0x2762('0x10'));_0x1e1fa5(_0x3737a9[_0x2762('0x16')][_0x2762('0x15')]);}})[_0x2762('0x17')](function(_0x5c9d9c){logger[_0x2762('0x14')]('SmsAccount,\x20%s,\x20%s',_0xab9847,_0x5c9d9c);_0x58af69(_0x5c9d9c);});});}exports[_0x2762('0x18')]=function(_0x673ee8){var _0x50ac7c=this;return new Promise(function(_0x154160,_0x212882){return db[_0x2762('0x19')]['find']({'raw':_0x673ee8[_0x2762('0x1a')]?_0x673ee8[_0x2762('0x1a')][_0x2762('0x1b')]===undefined?!![]:![]:!![],'where':_0x673ee8[_0x2762('0x1a')]?_0x673ee8[_0x2762('0x1a')][_0x2762('0x1c')]||null:null,'attributes':_0x673ee8[_0x2762('0x1a')]?_0x673ee8['options'][_0x2762('0x1d')]||null:null,'include':_0x673ee8[_0x2762('0x1a')]?_0x673ee8[_0x2762('0x1a')][_0x2762('0x1e')]?_[_0x2762('0x1f')](_0x673ee8[_0x2762('0x1a')][_0x2762('0x1e')],function(_0x45946d){return{'model':db[_0x45946d[_0x2762('0x20')]],'as':_0x45946d['as'],'attributes':_0x45946d[_0x2762('0x1d')],'include':_0x45946d[_0x2762('0x1e')]?_['map'](_0x45946d[_0x2762('0x1e')],function(_0x43a302){return{'model':db[_0x43a302[_0x2762('0x20')]],'as':_0x43a302['as'],'attributes':_0x43a302[_0x2762('0x1d')],'include':_0x43a302[_0x2762('0x1e')]?_[_0x2762('0x1f')](_0x43a302['include'],function(_0x625878){return{'model':db[_0x625878[_0x2762('0x20')]],'as':_0x625878['as'],'attributes':_0x625878[_0x2762('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2762('0x21')](function(_0x2e9126){logger[_0x2762('0xe')](_0x2762('0x18'),_0x673ee8);logger[_0x2762('0x11')]('ShowSmsAccount',_0x673ee8,JSON[_0x2762('0x13')](_0x2e9126));_0x154160(_0x2e9126);})[_0x2762('0x17')](function(_0x50a04c){logger[_0x2762('0x14')](_0x2762('0x18'),_0x50a04c['message'],_0x673ee8);_0x212882(_0x50ac7c[_0x2762('0x14')](0x1f4,_0x50a04c[_0x2762('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 618c9ee..393ba67 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 8132258..abedc3f 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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3d542c,_0x2098ae){var _0x4946de=function(_0x51171f){while(--_0x51171f){_0x3d542c['push'](_0x3d542c['shift']());}};_0x4946de(++_0x2098ae);}(_0x3e74,0x175));var _0x43e7=function(_0x4b164a,_0x21631c){_0x4b164a=_0x4b164a-0x0;var _0xc67168=_0x3e74[_0x4b164a];return _0xc67168;};'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 +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bce27,_0x468041){var _0x18747d=function(_0x1e2f93){while(--_0x1e2f93){_0x1bce27['push'](_0x1bce27['shift']());}};_0x18747d(++_0x468041);}(_0x34e8,0x12c));var _0x834e=function(_0x11a1bb,_0xed546d){_0x11a1bb=_0x11a1bb-0x0;var _0x940852=_0x34e8[_0x11a1bb];return _0x940852;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 233370c..512fecb 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 _0xd9d7=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd9d7,0x1a8));var _0x7d9d=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0xd9d7[_0x444e8b];return _0x35eb37;};'use strict';var Sequelize=require(_0x7d9d('0x0'));module[_0x7d9d('0x1')]={'priority':{'type':Sequelize[_0x7d9d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7d9d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7d9d('0x4')]()},'description':{'type':Sequelize[_0x7d9d('0x3')]},'interval':{'type':Sequelize[_0x7d9d('0x3')],'defaultValue':_0x7d9d('0x5')}}; \ No newline at end of file +var _0x564c=['exports','STRING','*,*,*,*'];(function(_0x29d981,_0x3365ef){var _0x11a7f2=function(_0xcf7c87){while(--_0xcf7c87){_0x29d981['push'](_0x29d981['shift']());}};_0x11a7f2(++_0x3365ef);}(_0x564c,0xc0));var _0xc564=function(_0x424c0f,_0x31a27d){_0x424c0f=_0x424c0f-0x0;var _0x265bf4=_0x564c[_0x424c0f];return _0x265bf4;};'use strict';var Sequelize=require('sequelize');module[_0xc564('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc564('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc564('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc564('0x2')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 75d7630..2014337 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 _0x85ae=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','map','SmsApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','keys','find','create','body','eml-format','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x78f3a8,_0x4d9551){var _0x48af0d=function(_0x243b35){while(--_0x243b35){_0x78f3a8['push'](_0x78f3a8['shift']());}};_0x48af0d(++_0x4d9551);}(_0x85ae,0x145));var _0xe85a=function(_0x426da1,_0x48cbb1){_0x426da1=_0x426da1-0x0;var _0x270fdb=_0x85ae[_0x426da1];return _0x270fdb;};'use strict';var emlformat=require(_0xe85a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe85a('0x1'));var Mustache=require(_0xe85a('0x2'));var util=require(_0xe85a('0x3'));var path=require('path');var sox=require(_0xe85a('0x4'));var csv=require(_0xe85a('0x5'));var ejs=require(_0xe85a('0x6'));var fs=require('fs');var fs_extra=require(_0xe85a('0x7'));var _=require(_0xe85a('0x8'));var squel=require(_0xe85a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe85a('0xa'));var toCsv=require('to-csv');var querystring=require(_0xe85a('0xb'));var Papa=require(_0xe85a('0xc'));var Redis=require(_0xe85a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe85a('0xe'));var as=require(_0xe85a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85a('0x10'))('api');var utils=require(_0xe85a('0x11'));var config=require(_0xe85a('0x12'));var licenseUtil=require(_0xe85a('0x13'));var db=require(_0xe85a('0x14'))['db'];function respondWithStatusCode(_0x56046b,_0x3220a6){_0x3220a6=_0x3220a6||0xcc;return function(_0x4508eb){if(_0x4508eb){return _0x56046b[_0xe85a('0x15')](_0x3220a6);}return _0x56046b[_0xe85a('0x16')](_0x3220a6)[_0xe85a('0x17')]();};}function respondWithResult(_0x5a4716,_0x411970){_0x411970=_0x411970||0xc8;return function(_0x509266){if(_0x509266){return _0x5a4716[_0xe85a('0x16')](_0x411970)[_0xe85a('0x18')](_0x509266);}};}function respondWithFilteredResult(_0x37a6a0,_0x257f06){return function(_0x21966e){if(_0x21966e){var _0x544735=typeof _0x257f06[_0xe85a('0x19')]===_0xe85a('0x1a')&&typeof _0x257f06['limit']===_0xe85a('0x1a');var _0x2121ec=_0x21966e[_0xe85a('0x1b')];var _0x262e28=_0x544735?0x0:_0x257f06[_0xe85a('0x19')];var _0x12fa20=_0x544735?_0x21966e['count']:_0x257f06[_0xe85a('0x19')]+_0x257f06[_0xe85a('0x1c')];var _0x50288f;if(_0x12fa20>=_0x2121ec){_0x12fa20=_0x2121ec;_0x50288f=0xc8;}else{_0x50288f=0xce;}_0x37a6a0['status'](_0x50288f);return _0x37a6a0[_0xe85a('0x1d')](_0xe85a('0x1e'),_0x262e28+'-'+_0x12fa20+'/'+_0x2121ec)[_0xe85a('0x18')](_0x21966e);}return null;};}function patchUpdates(_0x1cc104){return function(_0x9fc564){try{jsonpatch['apply'](_0x9fc564,_0x1cc104,!![]);}catch(_0x29d78a){return BPromise[_0xe85a('0x1f')](_0x29d78a);}return _0x9fc564[_0xe85a('0x20')]();};}function saveUpdates(_0x17dce3,_0x57fcae){return function(_0x3f74b6){if(_0x3f74b6){return _0x3f74b6[_0xe85a('0x21')](_0x17dce3)[_0xe85a('0x22')](function(_0x57205c){return _0x57205c;});}return null;};}function removeEntity(_0x195e9f,_0x11885c){return function(_0x33cce2){if(_0x33cce2){return _0x33cce2['destroy']()[_0xe85a('0x22')](function(){_0x195e9f[_0xe85a('0x16')](0xcc)[_0xe85a('0x17')]();});}};}function handleEntityNotFound(_0xd99534,_0x43bca6){return function(_0x208863){if(!_0x208863){_0xd99534['sendStatus'](0x194);}return _0x208863;};}function handleError(_0x57f061,_0x11f917){_0x11f917=_0x11f917||0x1f4;return function(_0x4874f3){logger[_0xe85a('0x23')](_0x4874f3['stack']);if(_0x4874f3[_0xe85a('0x24')]){delete _0x4874f3['name'];}_0x57f061['status'](_0x11f917)[_0xe85a('0x25')](_0x4874f3);};}exports['index']=function(_0xd911aa,_0x51fd2e){var _0x2514db={},_0x89500={},_0x2228cb={'count':0x0,'rows':[]};var _0x27138d=_[_0xe85a('0x26')](db[_0xe85a('0x27')][_0xe85a('0x28')],function(_0xe21baf){return{'name':_0xe21baf['fieldName'],'type':_0xe21baf[_0xe85a('0x29')][_0xe85a('0x2a')]};});_0x89500[_0xe85a('0x2b')]=_['map'](_0x27138d,_0xe85a('0x24'));_0x89500[_0xe85a('0x2c')]=_['keys'](_0xd911aa['query']);_0x89500[_0xe85a('0x2d')]=_[_0xe85a('0x2e')](_0x89500[_0xe85a('0x2b')],_0x89500[_0xe85a('0x2c')]);_0x2514db[_0xe85a('0x2f')]=_['intersection'](_0x89500[_0xe85a('0x2b')],qs[_0xe85a('0x30')](_0xd911aa[_0xe85a('0x2c')]['fields']));_0x2514db[_0xe85a('0x2f')]=_0x2514db[_0xe85a('0x2f')][_0xe85a('0x31')]?_0x2514db['attributes']:_0x89500['model'];if(!_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x32')]('nolimit')){_0x2514db['limit']=qs['limit'](_0xd911aa['query'][_0xe85a('0x1c')]);_0x2514db[_0xe85a('0x19')]=qs[_0xe85a('0x19')](_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x19')]);}_0x2514db[_0xe85a('0x33')]=qs['sort'](_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x34')]);_0x2514db[_0xe85a('0x35')]=qs[_0xe85a('0x2d')](_[_0xe85a('0x36')](_0xd911aa[_0xe85a('0x2c')],_0x89500['filters']),_0x27138d);if(_0xd911aa[_0xe85a('0x2c')]['filter']){_0x2514db[_0xe85a('0x35')]=_[_0xe85a('0x37')](_0x2514db[_0xe85a('0x35')],{'$or':_[_0xe85a('0x26')](_0x27138d,function(_0x337765){if(_0x337765[_0xe85a('0x29')]!=='VIRTUAL'){var _0x40aeab={};_0x40aeab[_0x337765['name']]={'$like':'%'+_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x38')]+'%'};return _0x40aeab;}})});}_0x2514db=_[_0xe85a('0x37')]({},_0x2514db,_0xd911aa[_0xe85a('0x39')]);var _0x47a6c1={'where':_0x2514db[_0xe85a('0x35')]};return db[_0xe85a('0x27')][_0xe85a('0x1b')](_0x47a6c1)['then'](function(_0x2782b5){_0x2228cb[_0xe85a('0x1b')]=_0x2782b5;if(_0xd911aa[_0xe85a('0x2c')][_0xe85a('0x3a')]){_0x2514db[_0xe85a('0x3b')]=[{'all':!![]}];}return db[_0xe85a('0x27')][_0xe85a('0x3c')](_0x2514db);})[_0xe85a('0x22')](function(_0x23f082){_0x2228cb[_0xe85a('0x3d')]=_0x23f082;return _0x2228cb;})['then'](respondWithFilteredResult(_0x51fd2e,_0x2514db))[_0xe85a('0x3e')](handleError(_0x51fd2e,null));};exports['show']=function(_0x254f72,_0x50c9c3){var _0x552a26={'raw':!![],'where':{'id':_0x254f72['params']['id']}},_0xc291e2={};_0xc291e2[_0xe85a('0x2b')]=_[_0xe85a('0x3f')](db[_0xe85a('0x27')]['rawAttributes']);_0xc291e2[_0xe85a('0x2c')]=_[_0xe85a('0x3f')](_0x254f72['query']);_0xc291e2[_0xe85a('0x2d')]=_[_0xe85a('0x2e')](_0xc291e2[_0xe85a('0x2b')],_0xc291e2[_0xe85a('0x2c')]);_0x552a26['attributes']=_[_0xe85a('0x2e')](_0xc291e2[_0xe85a('0x2b')],qs[_0xe85a('0x30')](_0x254f72[_0xe85a('0x2c')]['fields']));_0x552a26[_0xe85a('0x2f')]=_0x552a26['attributes'][_0xe85a('0x31')]?_0x552a26['attributes']:_0xc291e2[_0xe85a('0x2b')];if(_0x254f72['query']['includeAll']){_0x552a26['include']=[{'all':!![]}];}_0x552a26=_[_0xe85a('0x37')]({},_0x552a26,_0x254f72['options']);return db[_0xe85a('0x27')][_0xe85a('0x40')](_0x552a26)[_0xe85a('0x22')](handleEntityNotFound(_0x50c9c3,null))[_0xe85a('0x22')](respondWithResult(_0x50c9c3,null))[_0xe85a('0x3e')](handleError(_0x50c9c3,null));};exports[_0xe85a('0x41')]=function(_0x1e5d94,_0x1af361){return db[_0xe85a('0x27')]['create'](_0x1e5d94[_0xe85a('0x42')],{})[_0xe85a('0x22')](respondWithResult(_0x1af361,0xc9))[_0xe85a('0x3e')](handleError(_0x1af361,null));};exports['update']=function(_0x25a604,_0x3c6656){if(_0x25a604[_0xe85a('0x42')]['id']){delete _0x25a604[_0xe85a('0x42')]['id'];}return db[_0xe85a('0x27')]['find']({'where':{'id':_0x25a604['params']['id']}})[_0xe85a('0x22')](handleEntityNotFound(_0x3c6656,null))[_0xe85a('0x22')](saveUpdates(_0x25a604[_0xe85a('0x42')],null))[_0xe85a('0x22')](respondWithResult(_0x3c6656,null))['catch'](handleError(_0x3c6656,null));};exports['destroy']=function(_0x4fb5cd,_0x3258b5){return db[_0xe85a('0x27')][_0xe85a('0x40')]({'where':{'id':_0x4fb5cd['params']['id']}})[_0xe85a('0x22')](handleEntityNotFound(_0x3258b5,null))[_0xe85a('0x22')](removeEntity(_0x3258b5,null))[_0xe85a('0x3e')](handleError(_0x3258b5,null));}; \ No newline at end of file +var _0x69f9=['save','then','destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69f9,0xb4));var _0x969f=function(_0x5e2cf7,_0x2d4ff8){_0x5e2cf7=_0x5e2cf7-0x0;var _0x407902=_0x69f9[_0x5e2cf7];return _0x407902;};'use strict';var emlformat=require(_0x969f('0x0'));var rimraf=require(_0x969f('0x1'));var zipdir=require(_0x969f('0x2'));var jsonpatch=require(_0x969f('0x3'));var rp=require(_0x969f('0x4'));var moment=require(_0x969f('0x5'));var BPromise=require(_0x969f('0x6'));var Mustache=require(_0x969f('0x7'));var util=require(_0x969f('0x8'));var path=require('path');var sox=require(_0x969f('0x9'));var csv=require(_0x969f('0xa'));var ejs=require(_0x969f('0xb'));var fs=require('fs');var fs_extra=require(_0x969f('0xc'));var _=require('lodash');var squel=require(_0x969f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x969f('0xe'));var toCsv=require(_0x969f('0xa'));var querystring=require(_0x969f('0xf'));var Papa=require(_0x969f('0x10'));var Redis=require(_0x969f('0x11'));var authService=require(_0x969f('0x12'));var qs=require(_0x969f('0x13'));var as=require(_0x969f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x969f('0x15'));var config=require(_0x969f('0x16'));var licenseUtil=require(_0x969f('0x17'));var db=require(_0x969f('0x18'))['db'];function respondWithStatusCode(_0x5c2c2c,_0x3d4705){_0x3d4705=_0x3d4705||0xcc;return function(_0xcffdcd){if(_0xcffdcd){return _0x5c2c2c['sendStatus'](_0x3d4705);}return _0x5c2c2c[_0x969f('0x19')](_0x3d4705)[_0x969f('0x1a')]();};}function respondWithResult(_0xc6b4bd,_0x27a83f){_0x27a83f=_0x27a83f||0xc8;return function(_0x321cd1){if(_0x321cd1){return _0xc6b4bd[_0x969f('0x19')](_0x27a83f)[_0x969f('0x1b')](_0x321cd1);}};}function respondWithFilteredResult(_0x232641,_0x54ed2a){return function(_0x2eb3a8){if(_0x2eb3a8){var _0x12a6ef=typeof _0x54ed2a[_0x969f('0x1c')]===_0x969f('0x1d')&&typeof _0x54ed2a[_0x969f('0x1e')]===_0x969f('0x1d');var _0x4b57bc=_0x2eb3a8[_0x969f('0x1f')];var _0x487074=_0x12a6ef?0x0:_0x54ed2a[_0x969f('0x1c')];var _0x14c368=_0x12a6ef?_0x2eb3a8[_0x969f('0x1f')]:_0x54ed2a[_0x969f('0x1c')]+_0x54ed2a[_0x969f('0x1e')];var _0x492ce1;if(_0x14c368>=_0x4b57bc){_0x14c368=_0x4b57bc;_0x492ce1=0xc8;}else{_0x492ce1=0xce;}_0x232641[_0x969f('0x19')](_0x492ce1);return _0x232641['set']('Content-Range',_0x487074+'-'+_0x14c368+'/'+_0x4b57bc)['json'](_0x2eb3a8);}return null;};}function patchUpdates(_0x156316){return function(_0x332df5){try{jsonpatch['apply'](_0x332df5,_0x156316,!![]);}catch(_0x5a557c){return BPromise[_0x969f('0x20')](_0x5a557c);}return _0x332df5[_0x969f('0x21')]();};}function saveUpdates(_0x259e9a,_0x10a643){return function(_0x53dae9){if(_0x53dae9){return _0x53dae9['update'](_0x259e9a)[_0x969f('0x22')](function(_0x48e535){return _0x48e535;});}return null;};}function removeEntity(_0x33bc6f,_0x45f517){return function(_0x3cc5c0){if(_0x3cc5c0){return _0x3cc5c0[_0x969f('0x23')]()[_0x969f('0x22')](function(){_0x33bc6f[_0x969f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f8da,_0x5c1c8a){return function(_0x4c7bcf){if(!_0x4c7bcf){_0x54f8da[_0x969f('0x24')](0x194);}return _0x4c7bcf;};}function handleError(_0xc01555,_0x3f72b3){_0x3f72b3=_0x3f72b3||0x1f4;return function(_0x5987bb){logger[_0x969f('0x25')](_0x5987bb[_0x969f('0x26')]);if(_0x5987bb[_0x969f('0x27')]){delete _0x5987bb[_0x969f('0x27')];}_0xc01555[_0x969f('0x19')](_0x3f72b3)[_0x969f('0x28')](_0x5987bb);};}exports[_0x969f('0x29')]=function(_0x19bd63,_0xba34a6){var _0x87ae84={},_0x2e273f={},_0x4b0e67={'count':0x0,'rows':[]};var _0x33c331=_[_0x969f('0x2a')](db[_0x969f('0x2b')][_0x969f('0x2c')],function(_0x42a321){return{'name':_0x42a321[_0x969f('0x2d')],'type':_0x42a321[_0x969f('0x2e')]['key']};});_0x2e273f[_0x969f('0x2f')]=_[_0x969f('0x2a')](_0x33c331,_0x969f('0x27'));_0x2e273f[_0x969f('0x30')]=_['keys'](_0x19bd63[_0x969f('0x30')]);_0x2e273f[_0x969f('0x31')]=_[_0x969f('0x32')](_0x2e273f[_0x969f('0x2f')],_0x2e273f[_0x969f('0x30')]);_0x87ae84[_0x969f('0x33')]=_['intersection'](_0x2e273f[_0x969f('0x2f')],qs['fields'](_0x19bd63[_0x969f('0x30')][_0x969f('0x34')]));_0x87ae84[_0x969f('0x33')]=_0x87ae84[_0x969f('0x33')]['length']?_0x87ae84[_0x969f('0x33')]:_0x2e273f[_0x969f('0x2f')];if(!_0x19bd63[_0x969f('0x30')][_0x969f('0x35')](_0x969f('0x36'))){_0x87ae84[_0x969f('0x1e')]=qs[_0x969f('0x1e')](_0x19bd63[_0x969f('0x30')][_0x969f('0x1e')]);_0x87ae84[_0x969f('0x1c')]=qs[_0x969f('0x1c')](_0x19bd63[_0x969f('0x30')][_0x969f('0x1c')]);}_0x87ae84['order']=qs['sort'](_0x19bd63[_0x969f('0x30')][_0x969f('0x37')]);_0x87ae84['where']=qs['filters'](_[_0x969f('0x38')](_0x19bd63[_0x969f('0x30')],_0x2e273f[_0x969f('0x31')]),_0x33c331);if(_0x19bd63[_0x969f('0x30')]['filter']){_0x87ae84[_0x969f('0x39')]=_[_0x969f('0x3a')](_0x87ae84['where'],{'$or':_[_0x969f('0x2a')](_0x33c331,function(_0x33c51){if(_0x33c51[_0x969f('0x2e')]!==_0x969f('0x3b')){var _0x53ed82={};_0x53ed82[_0x33c51['name']]={'$like':'%'+_0x19bd63[_0x969f('0x30')]['filter']+'%'};return _0x53ed82;}})});}_0x87ae84=_[_0x969f('0x3a')]({},_0x87ae84,_0x19bd63[_0x969f('0x3c')]);var _0x4a7315={'where':_0x87ae84[_0x969f('0x39')]};return db['SmsApplication'][_0x969f('0x1f')](_0x4a7315)[_0x969f('0x22')](function(_0xd04faf){_0x4b0e67[_0x969f('0x1f')]=_0xd04faf;if(_0x19bd63[_0x969f('0x30')][_0x969f('0x3d')]){_0x87ae84[_0x969f('0x3e')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x87ae84);})[_0x969f('0x22')](function(_0x2323b9){_0x4b0e67[_0x969f('0x3f')]=_0x2323b9;return _0x4b0e67;})['then'](respondWithFilteredResult(_0xba34a6,_0x87ae84))[_0x969f('0x40')](handleError(_0xba34a6,null));};exports['show']=function(_0x21a9c7,_0x2df5cd){var _0x7b2655={'raw':!![],'where':{'id':_0x21a9c7[_0x969f('0x41')]['id']}},_0x1891c9={};_0x1891c9[_0x969f('0x2f')]=_['keys'](db[_0x969f('0x2b')]['rawAttributes']);_0x1891c9[_0x969f('0x30')]=_[_0x969f('0x42')](_0x21a9c7[_0x969f('0x30')]);_0x1891c9['filters']=_[_0x969f('0x32')](_0x1891c9['model'],_0x1891c9['query']);_0x7b2655['attributes']=_[_0x969f('0x32')](_0x1891c9[_0x969f('0x2f')],qs['fields'](_0x21a9c7[_0x969f('0x30')]['fields']));_0x7b2655[_0x969f('0x33')]=_0x7b2655['attributes']['length']?_0x7b2655[_0x969f('0x33')]:_0x1891c9[_0x969f('0x2f')];if(_0x21a9c7[_0x969f('0x30')][_0x969f('0x3d')]){_0x7b2655[_0x969f('0x3e')]=[{'all':!![]}];}_0x7b2655=_[_0x969f('0x3a')]({},_0x7b2655,_0x21a9c7['options']);return db[_0x969f('0x2b')][_0x969f('0x43')](_0x7b2655)[_0x969f('0x22')](handleEntityNotFound(_0x2df5cd,null))[_0x969f('0x22')](respondWithResult(_0x2df5cd,null))[_0x969f('0x40')](handleError(_0x2df5cd,null));};exports['create']=function(_0x4e5749,_0xb47c97){return db[_0x969f('0x2b')][_0x969f('0x44')](_0x4e5749[_0x969f('0x45')],{})[_0x969f('0x22')](respondWithResult(_0xb47c97,0xc9))[_0x969f('0x40')](handleError(_0xb47c97,null));};exports[_0x969f('0x46')]=function(_0x6574da,_0x38d864){if(_0x6574da[_0x969f('0x45')]['id']){delete _0x6574da[_0x969f('0x45')]['id'];}return db[_0x969f('0x2b')][_0x969f('0x43')]({'where':{'id':_0x6574da[_0x969f('0x41')]['id']}})[_0x969f('0x22')](handleEntityNotFound(_0x38d864,null))[_0x969f('0x22')](saveUpdates(_0x6574da['body'],null))['then'](respondWithResult(_0x38d864,null))[_0x969f('0x40')](handleError(_0x38d864,null));};exports[_0x969f('0x23')]=function(_0x509e21,_0x8abf98){return db[_0x969f('0x2b')][_0x969f('0x43')]({'where':{'id':_0x509e21['params']['id']}})['then'](handleEntityNotFound(_0x8abf98,null))[_0x969f('0x22')](removeEntity(_0x8abf98,null))[_0x969f('0x40')](handleError(_0x8abf98,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1adca9b..7ccc242 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 _0xedcb=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','define','sms_applications','utf8mb4','util'];(function(_0x5817e6,_0x44a2d0){var _0x51916a=function(_0x1a56e3){while(--_0x1a56e3){_0x5817e6['push'](_0x5817e6['shift']());}};_0x51916a(++_0x44a2d0);}(_0xedcb,0x1eb));var _0xbedc=function(_0x12da04,_0x57421e){_0x12da04=_0x12da04-0x0;var _0x4a022d=_0xedcb[_0x12da04];return _0x4a022d;};'use strict';var _=require('lodash');var util=require(_0xbedc('0x0'));var logger=require(_0xbedc('0x1'))(_0xbedc('0x2'));var moment=require(_0xbedc('0x3'));var BPromise=require(_0xbedc('0x4'));var rp=require(_0xbedc('0x5'));var fs=require('fs');var path=require(_0xbedc('0x6'));var rimraf=require('rimraf');var config=require(_0xbedc('0x7'));var attributes=require(_0xbedc('0x8'));module['exports']=function(_0x51fc15,_0x4f7f6c){return _0x51fc15[_0xbedc('0x9')]('SmsApplication',attributes,{'tableName':_0xbedc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbedc('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb33f=['exports','SmsApplication','sms_applications','utf8mb4','lodash','util','api','request-promise','./smsApplication.attributes'];(function(_0x105cd0,_0x3cebe8){var _0x2368cc=function(_0x41235e){while(--_0x41235e){_0x105cd0['push'](_0x105cd0['shift']());}};_0x2368cc(++_0x3cebe8);}(_0xb33f,0x1cf));var _0xfb33=function(_0x3da5ed,_0x4a0f3e){_0x3da5ed=_0x3da5ed-0x0;var _0x285cc4=_0xb33f[_0x3da5ed];return _0x285cc4;};'use strict';var _=require(_0xfb33('0x0'));var util=require(_0xfb33('0x1'));var logger=require('../../config/logger')(_0xfb33('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfb33('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb33('0x4'));module[_0xfb33('0x5')]=function(_0x163eef,_0x13f672){return _0x163eef['define'](_0xfb33('0x6'),attributes,{'tableName':_0xfb33('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb33('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 74d1e56..0b67017 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 _0x1c9a=['http','request','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x1c9a,0x98));var _0xa1c9=function(_0x60b024,_0x50f851){_0x60b024=_0x60b024-0x0;var _0x2929e6=_0x1c9a[_0x60b024];return _0x2929e6;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var moment=require(_0xa1c9('0x1'));var BPromise=require('bluebird');var rs=require(_0xa1c9('0x2'));var fs=require('fs');var Redis=require(_0xa1c9('0x3'));var db=require(_0xa1c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1c9('0x5'))(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var jayson=require(_0xa1c9('0x8'));var client=jayson['client'][_0xa1c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5448f2,_0x222624,_0x463c9c){return new BPromise(function(_0x3f07c2,_0x5059df){return client[_0xa1c9('0xa')](_0x5448f2,_0x463c9c)[_0xa1c9('0xb')](function(_0x24136d){logger[_0xa1c9('0xc')]('SmsApplication,\x20%s,\x20%s',_0x222624,_0xa1c9('0xd'));logger[_0xa1c9('0xe')](_0xa1c9('0xf'),_0x222624,_0xa1c9('0xd'),JSON[_0xa1c9('0x10')](_0x24136d));if(_0x24136d[_0xa1c9('0x11')]){if(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x5059df(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x222624,_0x24136d['error'][_0xa1c9('0x14')]);return _0x3f07c2(_0x24136d[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xc')](_0xa1c9('0x13'),_0x222624,_0xa1c9('0xd'));_0x3f07c2(_0x24136d[_0xa1c9('0x15')][_0xa1c9('0x14')]);}})[_0xa1c9('0x16')](function(_0x373f5d){logger['error'](_0xa1c9('0x13'),_0x222624,_0x373f5d);_0x5059df(_0x373f5d);});});} \ No newline at end of file +var _0x10ad=['code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10ad,0xf4));var _0xd10a=function(_0x1843f1,_0x175a27){_0x1843f1=_0x1843f1-0x0;var _0x341bb3=_0x10ad[_0x1843f1];return _0x341bb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd10a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10a('0x1'));var db=require(_0xd10a('0x2'))['db'];var utils=require(_0xd10a('0x3'));var logger=require(_0xd10a('0x4'))('rpc');var config=require(_0xd10a('0x5'));var jayson=require(_0xd10a('0x6'));var client=jayson[_0xd10a('0x7')][_0xd10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x429316,_0xdae354,_0x217329){return new BPromise(function(_0x194a4a,_0x5be3da){return client['request'](_0x429316,_0x217329)[_0xd10a('0x9')](function(_0x4d8613){logger[_0xd10a('0xa')](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));logger[_0xd10a('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xdae354,_0xd10a('0xc'),JSON[_0xd10a('0xe')](_0x4d8613));if(_0x4d8613[_0xd10a('0xf')]){if(_0x4d8613['error'][_0xd10a('0x10')]===0x1f4){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x5be3da(_0x4d8613[_0xd10a('0xf')]['message']);}logger['error'](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x194a4a(_0x4d8613[_0xd10a('0xf')]['message']);}else{logger['info'](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));_0x194a4a(_0x4d8613[_0xd10a('0x12')][_0xd10a('0x11')]);}})[_0xd10a('0x13')](function(_0x33bb89){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x33bb89);_0x5be3da(_0x33bb89);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 02271c1..913d1d4 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 _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x26ff28,_0xa51640){var _0x3631c2=function(_0x58269f){while(--_0x58269f){_0x26ff28['push'](_0x26ff28['shift']());}};_0x3631c2(++_0xa51640);}(_0x087b,0x11a));var _0xb087=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x087b[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file +var _0x9c00=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags'];(function(_0xdf059b,_0x198a6c){var _0x4a3c71=function(_0x381d46){while(--_0x381d46){_0xdf059b['push'](_0xdf059b['shift']());}};_0x4a3c71(++_0x198a6c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x188bcd,_0x52f234){_0x188bcd=_0x188bcd-0x0;var _0x3c4e5b=_0x9c00[_0x188bcd];return _0x3c4e5b;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x8')]('/:id',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router[_0x09c0('0x8')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x8')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x11')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0x12')]);router[_0x09c0('0x11')](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x11')](_0x09c0('0x14'),auth[_0x09c0('0xa')](),interaction[_0x09c0('0x15')](_0x09c0('0x16'),_0x09c0('0x17')),controller[_0x09c0('0x18')]);router[_0x09c0('0x19')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction['tracked']('sms',_0x09c0('0x1b')),controller[_0x09c0('0x1c')]);router[_0x09c0('0x1d')](_0x09c0('0x1a'),auth['isAuthenticated'](),interaction[_0x09c0('0x15')]('sms','smsinteraction:destroy'),controller[_0x09c0('0x1e')]);router['delete'](_0x09c0('0x14'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 8b7d619..b6eaa76 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 _0x126e=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x5a9438,_0x41f6ea){var _0x521a9d=function(_0x2acc17){while(--_0x2acc17){_0x5a9438['push'](_0x5a9438['shift']());}};_0x521a9d(++_0x41f6ea);}(_0x126e,0x108));var _0xe126=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x126e[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe126('0x0'));module[_0xe126('0x1')]={'closed':{'type':Sequelize[_0xe126('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe126('0x3')]},'disposition':{'type':Sequelize[_0xe126('0x4')]},'secondDisposition':{'type':Sequelize[_0xe126('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe126('0x4')]},'phone':{'type':Sequelize[_0xe126('0x4')]},'read1stAt':{'type':Sequelize[_0xe126('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe126('0x5')]('in',_0xe126('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe126('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe126('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe126('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xff2a=['moment','exports','DATE','STRING','out','ENUM','BOOLEAN'];(function(_0x4782eb,_0x1dafc9){var _0x9f1353=function(_0x1b74b4){while(--_0x1b74b4){_0x4782eb['push'](_0x4782eb['shift']());}};_0x9f1353(++_0x1dafc9);}(_0xff2a,0x93));var _0xaff2=function(_0x265468,_0xcf7439){_0x265468=_0x265468-0x0;var _0x37d555=_0xff2a[_0x265468];return _0x37d555;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xaff2('0x0'));module[_0xaff2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xaff2('0x2')]},'disposition':{'type':Sequelize[_0xaff2('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xaff2('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xaff2('0x3')]},'read1stAt':{'type':Sequelize[_0xaff2('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xaff2('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaff2('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xaff2('0x5')]('in',_0xaff2('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaff2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index eec99aa..63ee744 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 _0x5ecf=['send','map','SmsInteraction','rawAttributes','type','key','query','user','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','SmsMessage','omit','ids','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','secret','SmsAccount','mkdirSync','Sms','Account','Owner','N.A.','closed','closedAt','disposition','Messages','out','System','read','value','renderFile','server','views','downloadInteraction.ejs','createPdfFromHTML','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','then','error','stack','name'];(function(_0x304048,_0x260711){var _0x430079=function(_0x552a51){while(--_0x552a51){_0x304048['push'](_0x304048['shift']());}};_0x430079(++_0x260711);}(_0x5ecf,0x1c3));var _0xf5ec=function(_0x7a572e,_0x2b7c6b){_0x7a572e=_0x7a572e-0x0;var _0x4398b2=_0x5ecf[_0x7a572e];return _0x4398b2;};'use strict';var rimraf=require(_0xf5ec('0x0'));var zipdir=require(_0xf5ec('0x1'));var moment=require(_0xf5ec('0x2'));var BPromise=require(_0xf5ec('0x3'));var util=require(_0xf5ec('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5ec('0x5'));var Redis=require(_0xf5ec('0x6'));var interaction=require(_0xf5ec('0x7'));var qs=require(_0xf5ec('0x8'));var pdf=require(_0xf5ec('0x9'));var logger=require('../../config/logger')(_0xf5ec('0xa'));var config=require(_0xf5ec('0xb'));var db=require(_0xf5ec('0xc'))['db'];config[_0xf5ec('0xd')]=_[_0xf5ec('0xe')](config[_0xf5ec('0xd')],{'host':_0xf5ec('0xf'),'port':0x18eb});var socket=require(_0xf5ec('0x10'))(new Redis(config[_0xf5ec('0xd')]));require(_0xf5ec('0x11'))[_0xf5ec('0x12')](socket);function respondWithStatusCode(_0x86970a,_0x2c2040){_0x2c2040=_0x2c2040||0xcc;return function(_0xea4f59){if(_0xea4f59){return _0x86970a[_0xf5ec('0x13')](_0x2c2040);}return _0x86970a[_0xf5ec('0x14')](_0x2c2040)['end']();};}function respondWithResult(_0x171ff8,_0x583fd2){_0x583fd2=_0x583fd2||0xc8;return function(_0x2ec877){if(_0x2ec877){return _0x171ff8[_0xf5ec('0x14')](_0x583fd2)[_0xf5ec('0x15')](_0x2ec877);}};}function respondWithFilteredResult(_0x4e8c0d,_0x31420f){return function(_0x52f22a){if(_0x52f22a){var _0x2a0ea1=typeof _0x31420f[_0xf5ec('0x16')]===_0xf5ec('0x17')&&typeof _0x31420f[_0xf5ec('0x18')]===_0xf5ec('0x17');var _0x170e10=_0x52f22a[_0xf5ec('0x19')];var _0x3038af=_0x2a0ea1?0x0:_0x31420f[_0xf5ec('0x16')];var _0xb41302=_0x2a0ea1?_0x52f22a[_0xf5ec('0x19')]:_0x31420f['offset']+_0x31420f[_0xf5ec('0x18')];var _0x249955;if(_0xb41302>=_0x170e10){_0xb41302=_0x170e10;_0x249955=0xc8;}else{_0x249955=0xce;}_0x4e8c0d[_0xf5ec('0x14')](_0x249955);return _0x4e8c0d[_0xf5ec('0x1a')]('Content-Range',_0x3038af+'-'+_0xb41302+'/'+_0x170e10)[_0xf5ec('0x15')](_0x52f22a);}return null;};}function saveUpdates(_0x3f9fb9){return function(_0xb04df6){if(_0xb04df6){return _0xb04df6[_0xf5ec('0x1b')](_0x3f9fb9)['then'](function(_0x342c82){return _0x342c82;});}return null;};}function removeEntity(_0x5c2d53){return function(_0x1df909){if(_0x1df909){return _0x1df909[_0xf5ec('0x1c')]()[_0xf5ec('0x1d')](function(){_0x5c2d53[_0xf5ec('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x332f93){return function(_0x16a8aa){if(!_0x16a8aa){_0x332f93[_0xf5ec('0x13')](0x194);}return _0x16a8aa;};}function handleError(_0x4964df,_0x12a45e){_0x12a45e=_0x12a45e||0x1f4;return function(_0x19026e){logger[_0xf5ec('0x1e')](_0x19026e[_0xf5ec('0x1f')]);if(_0x19026e[_0xf5ec('0x20')]){delete _0x19026e['name'];}_0x4964df[_0xf5ec('0x14')](_0x12a45e)[_0xf5ec('0x21')](_0x19026e);};}exports['index']=function(_0x19b1fe,_0x18a35b){var _0x54e528={};var _0x1cd244=_[_0xf5ec('0x22')](db[_0xf5ec('0x23')][_0xf5ec('0x24')],function(_0x33b785){return{'name':_0x33b785['fieldName'],'type':_0x33b785[_0xf5ec('0x25')][_0xf5ec('0x26')]};});_0x54e528=qs['getOptions'](_0x1cd244,_0x19b1fe);return interaction['findAll']('sms',_0x19b1fe[_0xf5ec('0x27')],_0x19b1fe[_0xf5ec('0x28')],_0x54e528,_0x1cd244)[_0xf5ec('0x1d')](respondWithFilteredResult(_0x18a35b,_0x54e528))[_0xf5ec('0x29')](handleError(_0x18a35b,null));};exports[_0xf5ec('0x2a')]=function(_0x322370,_0x386585){var _0x46d6af={'raw':![],'where':{'id':_0x322370[_0xf5ec('0x2b')]['id']}},_0x15b1c2={};_0x15b1c2['model']=_[_0xf5ec('0x2c')](db['SmsInteraction']['rawAttributes']);_0x15b1c2[_0xf5ec('0x27')]=_['keys'](_0x322370['query']);_0x15b1c2[_0xf5ec('0x2d')]=_[_0xf5ec('0x2e')](_0x15b1c2[_0xf5ec('0x2f')],_0x15b1c2['query']);_0x46d6af[_0xf5ec('0x30')]=_[_0xf5ec('0x2e')](_0x15b1c2[_0xf5ec('0x2f')],qs[_0xf5ec('0x31')](_0x322370[_0xf5ec('0x27')][_0xf5ec('0x31')]));_0x46d6af[_0xf5ec('0x30')]=_0x46d6af['attributes'][_0xf5ec('0x32')]?_0x46d6af[_0xf5ec('0x30')]:_0x15b1c2[_0xf5ec('0x2f')];if(_0x322370[_0xf5ec('0x27')][_0xf5ec('0x33')]){_0x46d6af[_0xf5ec('0x34')]=[{'all':!![]}];}_0x46d6af=_[_0xf5ec('0x35')]({},_0x46d6af,_0x322370['options']);return db['SmsInteraction'][_0xf5ec('0x36')](_0x46d6af)[_0xf5ec('0x1d')](handleEntityNotFound(_0x386585,null))[_0xf5ec('0x1d')](respondWithResult(_0x386585,null))[_0xf5ec('0x29')](handleError(_0x386585,null));};exports[_0xf5ec('0x37')]=function(_0x17bfe1,_0x5ec680){return db['SmsInteraction']['create'](_0x17bfe1[_0xf5ec('0x38')],{})[_0xf5ec('0x1d')](respondWithResult(_0x5ec680,0xc9))[_0xf5ec('0x29')](handleError(_0x5ec680,null));};exports[_0xf5ec('0x1b')]=function(_0x3efd46,_0x1e709c){if(_0x3efd46[_0xf5ec('0x38')]['id']){delete _0x3efd46[_0xf5ec('0x38')]['id'];}return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x3efd46[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x1e709c,null))[_0xf5ec('0x1d')](saveUpdates(_0x3efd46[_0xf5ec('0x38')],null))[_0xf5ec('0x1d')](respondWithResult(_0x1e709c,null))[_0xf5ec('0x29')](handleError(_0x1e709c,null));};exports['destroy']=function(_0x230042,_0x739364){return db[_0xf5ec('0x23')]['find']({'where':{'id':_0x230042[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x739364,null))[_0xf5ec('0x1d')](removeEntity(_0x739364,null))[_0xf5ec('0x29')](handleError(_0x739364,null));};exports[_0xf5ec('0x39')]=function(_0x3ac89b,_0x1a7d0a){return db[_0xf5ec('0x23')][_0xf5ec('0x39')]()[_0xf5ec('0x1d')](respondWithResult(_0x1a7d0a,null))['catch'](handleError(_0x1a7d0a,null));};exports[_0xf5ec('0x3a')]=function(_0x198d92,_0x45fd36){return db[_0xf5ec('0x3b')][_0xf5ec('0x36')]({'where':{'id':_0x198d92[_0xf5ec('0x2b')]['id']}})['then'](handleEntityNotFound(_0x45fd36,null))[_0xf5ec('0x1d')](function(_0x22c0f0){if(_0x22c0f0){return _0x22c0f0[_0xf5ec('0x3a')](_0x198d92['body']['ids'],_[_0xf5ec('0x3c')](_0x198d92[_0xf5ec('0x38')],[_0xf5ec('0x3d'),'id'])||{});}})[_0xf5ec('0x1d')](respondWithResult(_0x45fd36,null))['catch'](handleError(_0x45fd36,null));};exports['getMessages']=function(_0x4cdc9a,_0xdb7e0){var _0x3847ab={'raw':![],'where':{}};var _0xc7b35d={};var _0x104f84={'count':0x0,'rows':[]};return db[_0xf5ec('0x23')][_0xf5ec('0x3e')]({'where':{'id':_0x4cdc9a[_0xf5ec('0x2b')]['id']}})['then'](handleEntityNotFound(_0xdb7e0,null))[_0xf5ec('0x1d')](function(_0x4879a4){if(_0x4879a4){_0xc7b35d[_0xf5ec('0x2f')]=_[_0xf5ec('0x2c')](db['SmsMessage'][_0xf5ec('0x24')]);_0xc7b35d[_0xf5ec('0x27')]=_[_0xf5ec('0x2c')](_0x4cdc9a['query']);_0xc7b35d['filters']=_[_0xf5ec('0x2e')](_0xc7b35d['model'],_0xc7b35d[_0xf5ec('0x27')]);_0x3847ab[_0xf5ec('0x30')]=_['intersection'](_0xc7b35d['model'],qs[_0xf5ec('0x31')](_0x4cdc9a[_0xf5ec('0x27')]['fields']));_0x3847ab[_0xf5ec('0x30')]=_0x3847ab[_0xf5ec('0x30')]['length']?_0x3847ab[_0xf5ec('0x30')]:_0xc7b35d[_0xf5ec('0x2f')];if(!_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x3f')](_0xf5ec('0x40'))){_0x3847ab['limit']=qs[_0xf5ec('0x18')](_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x18')]);_0x3847ab[_0xf5ec('0x16')]=qs[_0xf5ec('0x16')](_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x16')]);}_0x3847ab[_0xf5ec('0x41')]=qs[_0xf5ec('0x42')](_0x4cdc9a['query'][_0xf5ec('0x42')]);_0x3847ab[_0xf5ec('0x43')]=qs[_0xf5ec('0x2d')](_[_0xf5ec('0x44')](_0x4cdc9a[_0xf5ec('0x27')],_0xc7b35d[_0xf5ec('0x2d')]));_0x3847ab[_0xf5ec('0x43')][_0xf5ec('0x45')]=_0x4879a4['id'];if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x46')]){_0x3847ab[_0xf5ec('0x43')]=_[_0xf5ec('0x35')](_0x3847ab[_0xf5ec('0x43')],{'$or':_['map'](_0x3847ab['attributes'],function(_0x12f377){var _0x137bfd={};_0x137bfd[_0x12f377]={'$like':'%'+_0x4cdc9a['query'][_0xf5ec('0x46')]+'%'};return _0x137bfd;})});}if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x47')]){var _0x3e06d4=_0x4cdc9a[_0xf5ec('0x27')]['$gte']['split'](',');var _0x5e87c8={};_0x5e87c8[_0x3e06d4[0x0]]={'$gte':moment(_0x3e06d4[0x1])[_0xf5ec('0x48')](_0xf5ec('0x49'))};_0x3847ab[_0xf5ec('0x43')]=_[_0xf5ec('0x35')](_0x3847ab[_0xf5ec('0x43')],_0x5e87c8);}_0x3847ab=_[_0xf5ec('0x35')]({},_0x3847ab,_0x4cdc9a[_0xf5ec('0x4a')]);return db[_0xf5ec('0x3b')][_0xf5ec('0x19')]({'where':_0x3847ab[_0xf5ec('0x43')]})[_0xf5ec('0x1d')](function(_0x3b2440){_0x104f84[_0xf5ec('0x19')]=_0x3b2440;if(_0x4cdc9a[_0xf5ec('0x27')][_0xf5ec('0x33')]){_0x3847ab[_0xf5ec('0x34')]=[{'all':!![]}];}return db['SmsMessage'][_0xf5ec('0x4b')](_0x3847ab);})['then'](function(_0x3050fe){_0x104f84['rows']=_0x3050fe;return _0x104f84;});}})[_0xf5ec('0x1d')](respondWithFilteredResult(_0xdb7e0,_0x3847ab))[_0xf5ec('0x29')](handleError(_0xdb7e0,null));};exports[_0xf5ec('0x4c')]=function(_0x43cb4d,_0x4172d9){return db[_0xf5ec('0x23')][_0xf5ec('0x36')]({'where':{'id':_0x43cb4d[_0xf5ec('0x2b')]['id']}})[_0xf5ec('0x1d')](handleEntityNotFound(_0x4172d9,null))['then'](function(_0x582de3){if(_0x582de3){return _0x582de3[_0xf5ec('0x4d')](_0x43cb4d[_0xf5ec('0x38')][_0xf5ec('0x3d')],_[_0xf5ec('0x3c')](_0x43cb4d['body'],['ids','id'])||{})['spread'](function(){return db[_0xf5ec('0x4e')][_0xf5ec('0x4b')]({'attributes':['id',_0xf5ec('0x20'),_0xf5ec('0x4f')],'where':{'id':_0x43cb4d[_0xf5ec('0x38')][_0xf5ec('0x3d')]}});})[_0xf5ec('0x1d')](function(_0x527fc3){socket[_0xf5ec('0x50')](_0xf5ec('0x51'),{'id':Number(_0x43cb4d[_0xf5ec('0x2b')]['id']),'tags':_0x527fc3||[]});return{'id':Number(_0x43cb4d[_0xf5ec('0x2b')]['id']),'tags':_0x527fc3||[]};});}})['then'](respondWithResult(_0x4172d9,null))['catch'](handleError(_0x4172d9,null));};exports[_0xf5ec('0x52')]=function(_0x3242ea,_0x5e548b){return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x3242ea['params']['id']}})['then'](handleEntityNotFound(_0x5e548b,null))[_0xf5ec('0x1d')](function(_0x41ec43){if(_0x41ec43){return _0x41ec43[_0xf5ec('0x52')](_0x3242ea['query'][_0xf5ec('0x3d')]);}})['then'](respondWithStatusCode(_0x5e548b,null))[_0xf5ec('0x29')](handleError(_0x5e548b,null));};exports['download']=function(_0x36fb79,_0x33ebbc){var _0x1429c1=moment()[_0xf5ec('0x53')]()[_0xf5ec('0x54')]();var _0x28dbb6=path[_0xf5ec('0x55')](config['root'],'server',_0xf5ec('0x56'),_0xf5ec('0x57'));var _0x83321d=path[_0xf5ec('0x55')](_0x28dbb6,_0x1429c1);var _0x7b1e00=util['format'](_0xf5ec('0x58'),_0x36fb79[_0xf5ec('0x2b')]['id'],_0x1429c1);var _0x4d02c5=path[_0xf5ec('0x55')](_0x28dbb6,_0x7b1e00);var _0x55133d=[];_0x55133d[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5a')],'as':'User','attributes':['id',_0xf5ec('0x5b')],'raw':!![]});_0x55133d[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5c')],'as':_0xf5ec('0x5d'),'attributes':['id',_0xf5ec('0x5e'),_0xf5ec('0x5f')],'raw':!![]});var _0x2f6514=[{'model':db[_0xf5ec('0x3b')],'as':'Messages','attributes':['id',_0xf5ec('0x38'),_0xf5ec('0x60'),_0xf5ec('0x61'),_0xf5ec('0x62'),'read'],'include':_0x55133d}];_0x2f6514['push']({'model':db[_0xf5ec('0x63')],'as':'Account','attributes':['id','name']});_0x2f6514[_0xf5ec('0x59')]({'model':db[_0xf5ec('0x5a')],'as':'Owner','attributes':['id','fullname']});return db['SmsInteraction'][_0xf5ec('0x36')]({'where':{'id':_0x36fb79[_0xf5ec('0x2b')]['id']},'include':_0x2f6514})[_0xf5ec('0x1d')](handleEntityNotFound(_0x33ebbc,null))[_0xf5ec('0x1d')](function(_0x33d70d){if(_0x33d70d){var _0x1053eb=_0x33d70d['get']({'plain':!![]});fs[_0xf5ec('0x64')](_0x83321d);var _0x53bce0={'channel':_0xf5ec('0x65'),'account':_0x1053eb[_0xf5ec('0x66')][_0xf5ec('0x20')],'agent':_0x1053eb[_0xf5ec('0x67')]?_0x1053eb[_0xf5ec('0x67')][_0xf5ec('0x5b')]:_0xf5ec('0x68'),'createdAt':moment(_0x1053eb[_0xf5ec('0x60')])[_0xf5ec('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf5ec('0x54')](),'closedAt':_0x1053eb[_0xf5ec('0x69')]?moment(_0x1053eb[_0xf5ec('0x6a')])['format'](_0xf5ec('0x49'))[_0xf5ec('0x54')]():'','disposition':_0x1053eb[_0xf5ec('0x6b')],'messages':_(_0x1053eb[_0xf5ec('0x6c')])['filter']({'secret':![]})[_0xf5ec('0x22')](function(_0x9d4f02){return{'date':moment(_0x9d4f02[_0xf5ec('0x60')])['format'](_0xf5ec('0x49'))[_0xf5ec('0x54')](),'sender':_0x9d4f02[_0xf5ec('0x61')]===_0xf5ec('0x6d')?_0x9d4f02[_0xf5ec('0x5a')]?_0x9d4f02['User'][_0xf5ec('0x5b')]:_0xf5ec('0x6e'):_0x9d4f02['Contact'][_0xf5ec('0x5e')]+(_0x9d4f02['Contact'][_0xf5ec('0x5f')]?'\x20'+_0x9d4f02[_0xf5ec('0x5d')][_0xf5ec('0x5f')]:''),'body':_0x9d4f02[_0xf5ec('0x38')],'direction':_0x9d4f02[_0xf5ec('0x61')]===_0xf5ec('0x6d')?'A':'C','secret':_0x9d4f02['secret'],'read':_0x9d4f02[_0xf5ec('0x6f')]};})[_0xf5ec('0x70')]()};return ejs[_0xf5ec('0x71')](path[_0xf5ec('0x55')](config['root'],_0xf5ec('0x72'),_0xf5ec('0x73'),_0xf5ec('0x74')),{'interaction':_0x53bce0})[_0xf5ec('0x1d')](function(_0x1313dc){var _0x4c7655=path[_0xf5ec('0x55')](_0x83321d,'transcript-'+_0x1053eb['id']+'-'+_0x1429c1+'.pdf');var _0x302fa1={'path':_0x4c7655,'channel':'Sms','interactionId':_0x1053eb['id']};return pdf[_0xf5ec('0x75')](_0x1313dc,_0x302fa1);})[_0xf5ec('0x1d')](function(){return new BPromise(function(_0x5481bd,_0xbdb3da){zipdir(_0x83321d,{'saveTo':_0x4d02c5},function(_0x238073,_0x4b50dd){if(_0x238073)return _0xbdb3da(_0x238073);return _0x5481bd(_0x4b50dd);});})[_0xf5ec('0x1d')](function(){return new BPromise(function(_0x331f38,_0x3d414f){rimraf(_0x83321d,function(_0x3f2e13){if(_0x3f2e13)_0x3d414f(_0x3f2e13);return _0x331f38();});});})[_0xf5ec('0x1d')](function(){return _0x33ebbc[_0xf5ec('0x76')](_0x4d02c5,_0x7b1e00,function(_0x33b1be){if(_0x33b1be){console[_0xf5ec('0x77')]('err',_0x33b1be);}else{fs[_0xf5ec('0x78')](_0x4d02c5);}});});});}else{return _0x33ebbc[_0xf5ec('0x13')](0xc8);}})[_0xf5ec('0x29')](handleError(_0x33ebbc,null));}; \ No newline at end of file +var _0x2131=['path','ejs','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','map','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','catch','show','params','model','keys','SmsInteraction','intersection','attributes','fields','length','includeAll','include','options','find','create','update','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','filters','pick','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','root','files','tmp','join','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','fullname','N.A.','toString','closed','closedAt','disposition','out','System','value','renderFile','server','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util'];(function(_0x515e5b,_0xf03ea2){var _0x2fcce0=function(_0x106fba){while(--_0x106fba){_0x515e5b['push'](_0x515e5b['shift']());}};_0x2fcce0(++_0xf03ea2);}(_0x2131,0xee));var _0x1213=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x2131[_0x332c1b];return _0x21b49b;};'use strict';var rimraf=require(_0x1213('0x0'));var zipdir=require(_0x1213('0x1'));var moment=require('moment');var BPromise=require(_0x1213('0x2'));var util=require(_0x1213('0x3'));var path=require(_0x1213('0x4'));var ejs=require(_0x1213('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1213('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x1213('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x1213('0x8'));var config=require(_0x1213('0x9'));var db=require(_0x1213('0xa'))['db'];config['redis']=_[_0x1213('0xb')](config[_0x1213('0xc')],{'host':_0x1213('0xd'),'port':0x18eb});var socket=require(_0x1213('0xe'))(new Redis(config[_0x1213('0xc')]));require(_0x1213('0xf'))[_0x1213('0x10')](socket);function respondWithStatusCode(_0x2a7598,_0x9c24d7){_0x9c24d7=_0x9c24d7||0xcc;return function(_0x469ba8){if(_0x469ba8){return _0x2a7598[_0x1213('0x11')](_0x9c24d7);}return _0x2a7598[_0x1213('0x12')](_0x9c24d7)[_0x1213('0x13')]();};}function respondWithResult(_0x2383fe,_0x488f9b){_0x488f9b=_0x488f9b||0xc8;return function(_0x37e707){if(_0x37e707){return _0x2383fe[_0x1213('0x12')](_0x488f9b)['json'](_0x37e707);}};}function respondWithFilteredResult(_0x280a2e,_0x48d202){return function(_0x256fa8){if(_0x256fa8){var _0x1a1b04=typeof _0x48d202[_0x1213('0x14')]===_0x1213('0x15')&&typeof _0x48d202[_0x1213('0x16')]===_0x1213('0x15');var _0x14d7b7=_0x256fa8['count'];var _0x464dbe=_0x1a1b04?0x0:_0x48d202[_0x1213('0x14')];var _0x391b54=_0x1a1b04?_0x256fa8[_0x1213('0x17')]:_0x48d202[_0x1213('0x14')]+_0x48d202['limit'];var _0x2f30cf;if(_0x391b54>=_0x14d7b7){_0x391b54=_0x14d7b7;_0x2f30cf=0xc8;}else{_0x2f30cf=0xce;}_0x280a2e[_0x1213('0x12')](_0x2f30cf);return _0x280a2e[_0x1213('0x18')](_0x1213('0x19'),_0x464dbe+'-'+_0x391b54+'/'+_0x14d7b7)['json'](_0x256fa8);}return null;};}function saveUpdates(_0x1388ae){return function(_0x48aff5){if(_0x48aff5){return _0x48aff5['update'](_0x1388ae)[_0x1213('0x1a')](function(_0x3e4a0d){return _0x3e4a0d;});}return null;};}function removeEntity(_0x6d99c1){return function(_0x3618e1){if(_0x3618e1){return _0x3618e1['destroy']()['then'](function(){_0x6d99c1[_0x1213('0x12')](0xcc)[_0x1213('0x13')]();});}};}function handleEntityNotFound(_0x3e500a){return function(_0x416a17){if(!_0x416a17){_0x3e500a['sendStatus'](0x194);}return _0x416a17;};}function handleError(_0x46f7fe,_0x56fbce){_0x56fbce=_0x56fbce||0x1f4;return function(_0x45a0e6){logger[_0x1213('0x1b')](_0x45a0e6[_0x1213('0x1c')]);if(_0x45a0e6[_0x1213('0x1d')]){delete _0x45a0e6[_0x1213('0x1d')];}_0x46f7fe[_0x1213('0x12')](_0x56fbce)[_0x1213('0x1e')](_0x45a0e6);};}exports['index']=function(_0x48353a,_0x5b322d){var _0x165478={};var _0x4cf8a0=_[_0x1213('0x1f')](db['SmsInteraction'][_0x1213('0x20')],function(_0x3a6dfc){return{'name':_0x3a6dfc[_0x1213('0x21')],'type':_0x3a6dfc[_0x1213('0x22')]['key']};});_0x165478=qs[_0x1213('0x23')](_0x4cf8a0,_0x48353a);return interaction[_0x1213('0x24')](_0x1213('0x25'),_0x48353a[_0x1213('0x26')],_0x48353a[_0x1213('0x27')],_0x165478,_0x4cf8a0)['then'](respondWithFilteredResult(_0x5b322d,_0x165478))[_0x1213('0x28')](handleError(_0x5b322d,null));};exports[_0x1213('0x29')]=function(_0x57e77b,_0x36d792){var _0x1deb8a={'raw':![],'where':{'id':_0x57e77b[_0x1213('0x2a')]['id']}},_0x3b7ab3={};_0x3b7ab3[_0x1213('0x2b')]=_[_0x1213('0x2c')](db[_0x1213('0x2d')]['rawAttributes']);_0x3b7ab3['query']=_[_0x1213('0x2c')](_0x57e77b[_0x1213('0x26')]);_0x3b7ab3['filters']=_[_0x1213('0x2e')](_0x3b7ab3[_0x1213('0x2b')],_0x3b7ab3[_0x1213('0x26')]);_0x1deb8a[_0x1213('0x2f')]=_[_0x1213('0x2e')](_0x3b7ab3['model'],qs['fields'](_0x57e77b[_0x1213('0x26')][_0x1213('0x30')]));_0x1deb8a[_0x1213('0x2f')]=_0x1deb8a[_0x1213('0x2f')][_0x1213('0x31')]?_0x1deb8a[_0x1213('0x2f')]:_0x3b7ab3['model'];if(_0x57e77b[_0x1213('0x26')][_0x1213('0x32')]){_0x1deb8a[_0x1213('0x33')]=[{'all':!![]}];}_0x1deb8a=_['merge']({},_0x1deb8a,_0x57e77b[_0x1213('0x34')]);return db[_0x1213('0x2d')][_0x1213('0x35')](_0x1deb8a)[_0x1213('0x1a')](handleEntityNotFound(_0x36d792,null))['then'](respondWithResult(_0x36d792,null))[_0x1213('0x28')](handleError(_0x36d792,null));};exports[_0x1213('0x36')]=function(_0x3606d6,_0x143000){return db[_0x1213('0x2d')][_0x1213('0x36')](_0x3606d6['body'],{})[_0x1213('0x1a')](respondWithResult(_0x143000,0xc9))[_0x1213('0x28')](handleError(_0x143000,null));};exports[_0x1213('0x37')]=function(_0x587a35,_0x169541){if(_0x587a35[_0x1213('0x38')]['id']){delete _0x587a35[_0x1213('0x38')]['id'];}return db['SmsInteraction'][_0x1213('0x35')]({'where':{'id':_0x587a35['params']['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x169541,null))[_0x1213('0x1a')](saveUpdates(_0x587a35['body'],null))['then'](respondWithResult(_0x169541,null))[_0x1213('0x28')](handleError(_0x169541,null));};exports['destroy']=function(_0x3a1435,_0x56e7ad){return db[_0x1213('0x2d')][_0x1213('0x35')]({'where':{'id':_0x3a1435[_0x1213('0x2a')]['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x56e7ad,null))[_0x1213('0x1a')](removeEntity(_0x56e7ad,null))[_0x1213('0x28')](handleError(_0x56e7ad,null));};exports[_0x1213('0x39')]=function(_0x21686f,_0xc7097f){return db['SmsInteraction'][_0x1213('0x39')]()[_0x1213('0x1a')](respondWithResult(_0xc7097f,null))[_0x1213('0x28')](handleError(_0xc7097f,null));};exports[_0x1213('0x3a')]=function(_0x46ec29,_0x27297e){return db[_0x1213('0x3b')][_0x1213('0x35')]({'where':{'id':_0x46ec29['params']['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x27297e,null))['then'](function(_0x4d4589){if(_0x4d4589){return _0x4d4589[_0x1213('0x3a')](_0x46ec29['body'][_0x1213('0x3c')],_[_0x1213('0x3d')](_0x46ec29[_0x1213('0x38')],[_0x1213('0x3c'),'id'])||{});}})[_0x1213('0x1a')](respondWithResult(_0x27297e,null))[_0x1213('0x28')](handleError(_0x27297e,null));};exports[_0x1213('0x3e')]=function(_0x5c9756,_0x5aa6da){var _0xde97c2={'raw':![],'where':{}};var _0x3b8037={};var _0x53b7bb={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1213('0x3f')]({'where':{'id':_0x5c9756[_0x1213('0x2a')]['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x5aa6da,null))[_0x1213('0x1a')](function(_0x5e7c30){if(_0x5e7c30){_0x3b8037[_0x1213('0x2b')]=_['keys'](db['SmsMessage'][_0x1213('0x20')]);_0x3b8037['query']=_[_0x1213('0x2c')](_0x5c9756['query']);_0x3b8037['filters']=_[_0x1213('0x2e')](_0x3b8037[_0x1213('0x2b')],_0x3b8037['query']);_0xde97c2['attributes']=_[_0x1213('0x2e')](_0x3b8037[_0x1213('0x2b')],qs['fields'](_0x5c9756[_0x1213('0x26')][_0x1213('0x30')]));_0xde97c2[_0x1213('0x2f')]=_0xde97c2['attributes'][_0x1213('0x31')]?_0xde97c2['attributes']:_0x3b8037[_0x1213('0x2b')];if(!_0x5c9756['query'][_0x1213('0x40')](_0x1213('0x41'))){_0xde97c2['limit']=qs['limit'](_0x5c9756[_0x1213('0x26')]['limit']);_0xde97c2['offset']=qs[_0x1213('0x14')](_0x5c9756[_0x1213('0x26')][_0x1213('0x14')]);}_0xde97c2['order']=qs[_0x1213('0x42')](_0x5c9756[_0x1213('0x26')][_0x1213('0x42')]);_0xde97c2[_0x1213('0x43')]=qs[_0x1213('0x44')](_[_0x1213('0x45')](_0x5c9756[_0x1213('0x26')],_0x3b8037[_0x1213('0x44')]));_0xde97c2[_0x1213('0x43')][_0x1213('0x46')]=_0x5e7c30['id'];if(_0x5c9756[_0x1213('0x26')][_0x1213('0x47')]){_0xde97c2[_0x1213('0x43')]=_[_0x1213('0x48')](_0xde97c2[_0x1213('0x43')],{'$or':_[_0x1213('0x1f')](_0xde97c2[_0x1213('0x2f')],function(_0x36fd47){var _0x5e5ff6={};_0x5e5ff6[_0x36fd47]={'$like':'%'+_0x5c9756[_0x1213('0x26')][_0x1213('0x47')]+'%'};return _0x5e5ff6;})});}if(_0x5c9756['query'][_0x1213('0x49')]){var _0x11cda0=_0x5c9756[_0x1213('0x26')][_0x1213('0x49')][_0x1213('0x4a')](',');var _0x233b01={};_0x233b01[_0x11cda0[0x0]]={'$gte':moment(_0x11cda0[0x1])[_0x1213('0x4b')](_0x1213('0x4c'))};_0xde97c2[_0x1213('0x43')]=_[_0x1213('0x48')](_0xde97c2[_0x1213('0x43')],_0x233b01);}_0xde97c2=_[_0x1213('0x48')]({},_0xde97c2,_0x5c9756[_0x1213('0x34')]);return db['SmsMessage'][_0x1213('0x17')]({'where':_0xde97c2[_0x1213('0x43')]})[_0x1213('0x1a')](function(_0x240807){_0x53b7bb[_0x1213('0x17')]=_0x240807;if(_0x5c9756[_0x1213('0x26')][_0x1213('0x32')]){_0xde97c2[_0x1213('0x33')]=[{'all':!![]}];}return db[_0x1213('0x3b')][_0x1213('0x24')](_0xde97c2);})[_0x1213('0x1a')](function(_0x16f68d){_0x53b7bb[_0x1213('0x4d')]=_0x16f68d;return _0x53b7bb;});}})[_0x1213('0x1a')](respondWithFilteredResult(_0x5aa6da,_0xde97c2))[_0x1213('0x28')](handleError(_0x5aa6da,null));};exports[_0x1213('0x4e')]=function(_0x373859,_0x2982bf){return db[_0x1213('0x2d')][_0x1213('0x35')]({'where':{'id':_0x373859[_0x1213('0x2a')]['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x2982bf,null))['then'](function(_0x4965a7){if(_0x4965a7){return _0x4965a7[_0x1213('0x4f')](_0x373859['body']['ids'],_['omit'](_0x373859[_0x1213('0x38')],[_0x1213('0x3c'),'id'])||{})[_0x1213('0x50')](function(){return db['Tag'][_0x1213('0x24')]({'attributes':['id','name','color'],'where':{'id':_0x373859[_0x1213('0x38')][_0x1213('0x3c')]}});})['then'](function(_0x42335c){socket['emit'](_0x1213('0x51'),{'id':Number(_0x373859[_0x1213('0x2a')]['id']),'tags':_0x42335c||[]});return{'id':Number(_0x373859[_0x1213('0x2a')]['id']),'tags':_0x42335c||[]};});}})[_0x1213('0x1a')](respondWithResult(_0x2982bf,null))[_0x1213('0x28')](handleError(_0x2982bf,null));};exports[_0x1213('0x52')]=function(_0x52af50,_0x342d22){return db['SmsInteraction'][_0x1213('0x35')]({'where':{'id':_0x52af50[_0x1213('0x2a')]['id']}})[_0x1213('0x1a')](handleEntityNotFound(_0x342d22,null))[_0x1213('0x1a')](function(_0x49e491){if(_0x49e491){return _0x49e491[_0x1213('0x52')](_0x52af50[_0x1213('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x342d22,null))[_0x1213('0x28')](handleError(_0x342d22,null));};exports[_0x1213('0x53')]=function(_0xa70ae1,_0x18c378){var _0x160837=moment()['unix']()['toString']();var _0x1eca5c=path['join'](config[_0x1213('0x54')],'server',_0x1213('0x55'),_0x1213('0x56'));var _0xd10ba9=path[_0x1213('0x57')](_0x1eca5c,_0x160837);var _0x3817b7=util[_0x1213('0x4b')](_0x1213('0x58'),_0xa70ae1[_0x1213('0x2a')]['id'],_0x160837);var _0x5843db=path[_0x1213('0x57')](_0x1eca5c,_0x3817b7);var _0x1edda3=[];_0x1edda3[_0x1213('0x59')]({'model':db[_0x1213('0x5a')],'as':_0x1213('0x5a'),'attributes':['id','fullname'],'raw':!![]});_0x1edda3['push']({'model':db[_0x1213('0x5b')],'as':_0x1213('0x5c'),'attributes':['id','firstName',_0x1213('0x5d')],'raw':!![]});var _0x163ea7=[{'model':db[_0x1213('0x3b')],'as':_0x1213('0x5e'),'attributes':['id',_0x1213('0x38'),_0x1213('0x5f'),_0x1213('0x60'),_0x1213('0x61'),_0x1213('0x62')],'include':_0x1edda3}];_0x163ea7[_0x1213('0x59')]({'model':db[_0x1213('0x63')],'as':_0x1213('0x64'),'attributes':['id',_0x1213('0x1d')]});_0x163ea7['push']({'model':db['User'],'as':_0x1213('0x65'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x1213('0x35')]({'where':{'id':_0xa70ae1[_0x1213('0x2a')]['id']},'include':_0x163ea7})['then'](handleEntityNotFound(_0x18c378,null))['then'](function(_0x4158d1){if(_0x4158d1){var _0x3e2ec1=_0x4158d1[_0x1213('0x66')]({'plain':!![]});fs[_0x1213('0x67')](_0xd10ba9);var _0x53829e={'channel':_0x1213('0x68'),'account':_0x3e2ec1[_0x1213('0x64')][_0x1213('0x1d')],'agent':_0x3e2ec1[_0x1213('0x65')]?_0x3e2ec1['Owner'][_0x1213('0x69')]:_0x1213('0x6a'),'createdAt':moment(_0x3e2ec1[_0x1213('0x5f')])['format'](_0x1213('0x4c'))[_0x1213('0x6b')](),'closedAt':_0x3e2ec1[_0x1213('0x6c')]?moment(_0x3e2ec1[_0x1213('0x6d')])[_0x1213('0x4b')](_0x1213('0x4c'))['toString']():'','disposition':_0x3e2ec1[_0x1213('0x6e')],'messages':_(_0x3e2ec1['Messages'])['filter']({'secret':![]})[_0x1213('0x1f')](function(_0x4adca4){return{'date':moment(_0x4adca4[_0x1213('0x5f')])[_0x1213('0x4b')](_0x1213('0x4c'))[_0x1213('0x6b')](),'sender':_0x4adca4[_0x1213('0x60')]===_0x1213('0x6f')?_0x4adca4[_0x1213('0x5a')]?_0x4adca4['User'][_0x1213('0x69')]:_0x1213('0x70'):_0x4adca4[_0x1213('0x5c')]['firstName']+(_0x4adca4[_0x1213('0x5c')]['lastName']?'\x20'+_0x4adca4[_0x1213('0x5c')]['lastName']:''),'body':_0x4adca4[_0x1213('0x38')],'direction':_0x4adca4[_0x1213('0x60')]===_0x1213('0x6f')?'A':'C','secret':_0x4adca4[_0x1213('0x61')],'read':_0x4adca4[_0x1213('0x62')]};})[_0x1213('0x71')]()};return ejs[_0x1213('0x72')](path['join'](config['root'],_0x1213('0x73'),'views','downloadInteraction.ejs'),{'interaction':_0x53829e})[_0x1213('0x1a')](function(_0x3525fb){var _0x51add1=path[_0x1213('0x57')](_0xd10ba9,_0x1213('0x74')+_0x3e2ec1['id']+'-'+_0x160837+'.pdf');var _0x2d2140={'path':_0x51add1,'channel':'Sms','interactionId':_0x3e2ec1['id']};return pdf[_0x1213('0x75')](_0x3525fb,_0x2d2140);})[_0x1213('0x1a')](function(){return new BPromise(function(_0x33a227,_0x40147e){zipdir(_0xd10ba9,{'saveTo':_0x5843db},function(_0x2bbf15,_0x11cbf9){if(_0x2bbf15)return _0x40147e(_0x2bbf15);return _0x33a227(_0x11cbf9);});})[_0x1213('0x1a')](function(){return new BPromise(function(_0x24fea6,_0x29c142){rimraf(_0xd10ba9,function(_0x22e495){if(_0x22e495)_0x29c142(_0x22e495);return _0x24fea6();});});})[_0x1213('0x1a')](function(){return _0x18c378['download'](_0x5843db,_0x3817b7,function(_0x35abd5){if(_0x35abd5){console[_0x1213('0x76')](_0x1213('0x77'),_0x35abd5);}else{fs[_0x1213('0x78')](_0x5843db);}});});});}else{return _0x18c378[_0x1213('0x11')](0xc8);}})['catch'](handleError(_0x18c378,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fecb81a..5938684 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 _0x14a0=['hook','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','setDataValue','Users','findAll','length','emit','catch'];(function(_0x3b47d2,_0x4637a6){var _0x54c5be=function(_0x5de877){while(--_0x5de877){_0x3b47d2['push'](_0x3b47d2['shift']());}};_0x54c5be(++_0x4637a6);}(_0x14a0,0x8e));var _0x014a=function(_0x28cddc,_0x1be16d){_0x28cddc=_0x28cddc-0x0;var _0x5ce855=_0x14a0[_0x28cddc];return _0x5ce855;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x014a('0x0'))['db'][_0x014a('0x1')];var SmsMessage=require(_0x014a('0x0'))['db'][_0x014a('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x014a('0x3')](0x0);var events={'afterCreate':_0x014a('0x4'),'afterUpdate':_0x014a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57a522){return function(_0x1730a5,_0x12e8da,_0x38a22c){_0x1730a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b8ce){_0x1730a5[_0x014a('0x6')](_0x014a('0x7'),_0x11b8ce['map'](function(_0x5d3d7f){return{'id':_0x5d3d7f['id']};}));return SmsMessage[_0x014a('0x8')]({'where':{'SmsInteractionId':_0x1730a5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x490ea2){_0x1730a5['setDataValue']('unreadMessages',_0x490ea2[_0x014a('0x9')]);SmsInteractionEvents['emit'](_0x57a522+':'+_0x1730a5['id'],_0x1730a5);SmsInteractionEvents[_0x014a('0xa')](_0x57a522,_0x1730a5);_0x38a22c(null);})[_0x014a('0xb')](_0x38a22c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x014a('0xc')](e,emitEvent(event));}}module[_0x014a('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x0972=['save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x279821,_0x2c52b8){var _0x28fc2d=function(_0x20aa80){while(--_0x20aa80){_0x279821['push'](_0x279821['shift']());}};_0x28fc2d(++_0x2c52b8);}(_0x0972,0x64));var _0x2097=function(_0x27c7df,_0xa21fc0){_0x27c7df=_0x27c7df-0x0;var _0x19851a=_0x0972[_0x27c7df];return _0x19851a;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2097('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x2097('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2097('0x1')](0x0);var events={'afterCreate':_0x2097('0x2'),'afterUpdate':'update','afterDestroy':_0x2097('0x3')};function emitEvent(_0x431d1c){return function(_0xe6fbae,_0x1a7d26,_0x2f84d8){_0xe6fbae[_0x2097('0x4')]({'attributes':['id'],'raw':!![]})[_0x2097('0x5')](function(_0x59739f){_0xe6fbae[_0x2097('0x6')](_0x2097('0x7'),_0x59739f[_0x2097('0x8')](function(_0x1d94e2){return{'id':_0x1d94e2['id']};}));return SmsMessage[_0x2097('0x9')]({'where':{'SmsInteractionId':_0xe6fbae['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2e0024){_0xe6fbae[_0x2097('0x6')](_0x2097('0xa'),_0x2e0024[_0x2097('0xb')]);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c+':'+_0xe6fbae['id'],_0xe6fbae);SmsInteractionEvents[_0x2097('0xc')](_0x431d1c,_0xe6fbae);_0x2f84d8(null);})[_0x2097('0xd')](_0x2f84d8(null));};}for(var e in events){if(events[_0x2097('0xe')](e)){var event=events[e];SmsInteraction[_0x2097('0xf')](e,emitEvent(event));}}module[_0x2097('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 55def42..c2194e3 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 _0x0357=['rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x0357,0xbe));var _0x7035=function(_0x42658f,_0x16c9af){_0x42658f=_0x42658f-0x0;var _0x2ba697=_0x0357[_0x42658f];return _0x2ba697;};'use strict';var _=require(_0x7035('0x0'));var util=require(_0x7035('0x1'));var logger=require(_0x7035('0x2'))(_0x7035('0x3'));var moment=require(_0x7035('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7035('0x5'));var rimraf=require(_0x7035('0x6'));var config=require('../../config/environment');var attributes=require(_0x7035('0x7'));module[_0x7035('0x8')]=function(_0x16fa61,_0x4f22b1){return _0x16fa61['define'](_0x7035('0x9'),attributes,{'tableName':_0x7035('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x522690,_0x173746,_0x5f34da){if(_0x522690[_0x7035('0xb')]('closed')){_0x522690[_0x7035('0xc')]=moment()['format'](_0x7035('0xd'));}_0x5f34da(null,_0x522690);}}});}; \ No newline at end of file +var _0x3f69=['bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3f69,0xd9));var _0x93f6=function(_0x39e758,_0x454ce0){_0x39e758=_0x39e758-0x0;var _0x456464=_0x3f69[_0x39e758];return _0x456464;};'use strict';var _=require(_0x93f6('0x0'));var util=require('util');var logger=require(_0x93f6('0x1'))(_0x93f6('0x2'));var moment=require(_0x93f6('0x3'));var BPromise=require(_0x93f6('0x4'));var rp=require(_0x93f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93f6('0x6'));var config=require(_0x93f6('0x7'));var attributes=require(_0x93f6('0x8'));module[_0x93f6('0x9')]=function(_0xb51852,_0x3d534e){return _0xb51852[_0x93f6('0xa')](_0x93f6('0xb'),attributes,{'tableName':_0x93f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5cb85a,_0x516011,_0x38ccb6){if(_0x5cb85a[_0x93f6('0xd')]('closed')){_0x5cb85a[_0x93f6('0xe')]=moment()[_0x93f6('0xf')](_0x93f6('0x10'));}_0x38ccb6(null,_0x5cb85a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f589672..a1335d6 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 _0xc5b6=['SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','attributes','limit','debug','AddTagsToSmsInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info'];(function(_0x44e201,_0x2477f9){var _0xb720a9=function(_0x52c73f){while(--_0x52c73f){_0x44e201['push'](_0x44e201['shift']());}};_0xb720a9(++_0x2477f9);}(_0xc5b6,0xe8));var _0x6c5b=function(_0x11df96,_0x16c6bb){_0x11df96=_0x11df96-0x0;var _0x37b491=_0xc5b6[_0x11df96];return _0x37b491;};'use strict';var _=require(_0x6c5b('0x0'));var util=require(_0x6c5b('0x1'));var moment=require(_0x6c5b('0x2'));var BPromise=require(_0x6c5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))('rpc');var config=require(_0x6c5b('0x7'));var jayson=require(_0x6c5b('0x8'));var client=jayson[_0x6c5b('0x9')][_0x6c5b('0xa')]({'port':0x232a});config[_0x6c5b('0xb')]=_[_0x6c5b('0xc')](config[_0x6c5b('0xb')],{'host':_0x6c5b('0xd'),'port':0x18eb});var socket=require(_0x6c5b('0xe'))(new Redis(config[_0x6c5b('0xb')]));require(_0x6c5b('0xf'))[_0x6c5b('0x10')](socket);function respondWithRpcPromise(_0xf941d3,_0x304a52,_0x1d08aa){return new BPromise(function(_0x43c589,_0x4122a8){return client[_0x6c5b('0x11')](_0xf941d3,_0x1d08aa)[_0x6c5b('0x12')](function(_0x464aac){logger[_0x6c5b('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x304a52,'request\x20sent');logger['debug'](_0x6c5b('0x14'),_0x304a52,_0x6c5b('0x15'),JSON[_0x6c5b('0x16')](_0x464aac));if(_0x464aac[_0x6c5b('0x17')]){if(_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x18')]===0x1f4){logger[_0x6c5b('0x17')](_0x6c5b('0x19'),_0x304a52,_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x1a')]);return _0x4122a8(_0x464aac['error'][_0x6c5b('0x1a')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x304a52,_0x464aac[_0x6c5b('0x17')][_0x6c5b('0x1a')]);return _0x43c589(_0x464aac[_0x6c5b('0x17')]['message']);}else{logger['info'](_0x6c5b('0x19'),_0x304a52,'request\x20sent');_0x43c589(_0x464aac[_0x6c5b('0x1b')][_0x6c5b('0x1a')]);}})[_0x6c5b('0x1c')](function(_0x1d9e8d){logger[_0x6c5b('0x17')](_0x6c5b('0x19'),_0x304a52,_0x1d9e8d);_0x4122a8(_0x1d9e8d);});});}exports[_0x6c5b('0x1d')]=function(_0x5119e9){var _0x5ca2bf=this;return new Promise(function(_0x2ada59,_0x10ce4e){return db[_0x6c5b('0x1e')][_0x6c5b('0x1f')](_0x5119e9[_0x6c5b('0x20')],{'raw':_0x5119e9[_0x6c5b('0x21')]?_0x5119e9[_0x6c5b('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5119e9['options']?_0x5119e9[_0x6c5b('0x21')]['where']||null:null,'attributes':_0x5119e9['options']?_0x5119e9[_0x6c5b('0x21')][_0x6c5b('0x22')]||null:null,'limit':_0x5119e9[_0x6c5b('0x21')]?_0x5119e9[_0x6c5b('0x21')][_0x6c5b('0x23')]||null:null})[_0x6c5b('0x12')](function(_0x5804f8){logger[_0x6c5b('0x13')](_0x6c5b('0x1d'),_0x5119e9);logger[_0x6c5b('0x24')](_0x6c5b('0x1d'),_0x5119e9,JSON[_0x6c5b('0x16')](_0x5804f8));_0x2ada59(_0x5804f8);})[_0x6c5b('0x1c')](function(_0x2253ad){logger[_0x6c5b('0x17')](_0x6c5b('0x1d'),_0x2253ad['message'],_0x5119e9);_0x10ce4e(_0x5ca2bf[_0x6c5b('0x17')](0x1f4,_0x2253ad[_0x6c5b('0x1a')]));});});};exports[_0x6c5b('0x25')]=function(_0x206d04){return new Promise(function(_0x59bebc,_0x1c2453){return db[_0x6c5b('0x1e')]['find']({'where':_0x206d04['options']?_0x206d04['options']['where']||null:null})['then'](function(_0x13d627){if(_0x13d627){return _0x13d627[_0x6c5b('0x26')](_0x206d04[_0x6c5b('0x20')][_0x6c5b('0x27')],_[_0x6c5b('0x28')](_0x206d04[_0x6c5b('0x20')],['ids','id'])||{});}})['spread'](function(_0x568699){logger['info'](_0x6c5b('0x29'),_0x206d04);logger['debug'](_0x6c5b('0x29'),_0x206d04,JSON[_0x6c5b('0x16')](_0x568699));_0x59bebc(_0x568699);})[_0x6c5b('0x1c')](function(_0x21bd5b){logger[_0x6c5b('0x17')]('AddTags',_0x21bd5b[_0x6c5b('0x1a')],_0x206d04);_0x1c2453(_this[_0x6c5b('0x17')](0x1f4,_0x21bd5b[_0x6c5b('0x1a')]));});});}; \ No newline at end of file +var _0x378f=['client','redis','localhost','socket.io-emitter','request','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x22f924,_0x5201d2){var _0x4c6c70=function(_0x10d3b2){while(--_0x10d3b2){_0x22f924['push'](_0x22f924['shift']());}};_0x4c6c70(++_0x5201d2);}(_0x378f,0x92));var _0xf378=function(_0x19ddd9,_0x4351de){_0x19ddd9=_0x19ddd9-0x0;var _0x13ab97=_0x378f[_0x19ddd9];return _0x13ab97;};'use strict';var _=require(_0xf378('0x0'));var util=require('util');var moment=require(_0xf378('0x1'));var BPromise=require(_0xf378('0x2'));var rs=require(_0xf378('0x3'));var fs=require('fs');var Redis=require(_0xf378('0x4'));var db=require(_0xf378('0x5'))['db'];var utils=require(_0xf378('0x6'));var logger=require(_0xf378('0x7'))(_0xf378('0x8'));var config=require('../../config/environment');var jayson=require(_0xf378('0x9'));var client=jayson[_0xf378('0xa')]['http']({'port':0x232a});config[_0xf378('0xb')]=_['defaults'](config[_0xf378('0xb')],{'host':_0xf378('0xc'),'port':0x18eb});var socket=require(_0xf378('0xd'))(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x15d095,_0x446f78,_0x3e8792){return new BPromise(function(_0x191d7b,_0x4f673d){return client[_0xf378('0xe')](_0x15d095,_0x3e8792)['then'](function(_0x2360d6){logger[_0xf378('0xf')](_0xf378('0x10'),_0x446f78,'request\x20sent');logger[_0xf378('0x11')](_0xf378('0x12'),_0x446f78,_0xf378('0x13'),JSON[_0xf378('0x14')](_0x2360d6));if(_0x2360d6[_0xf378('0x15')]){if(_0x2360d6['error']['code']===0x1f4){logger[_0xf378('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x446f78,_0x2360d6[_0xf378('0x15')][_0xf378('0x16')]);return _0x4f673d(_0x2360d6['error']['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x446f78,_0x2360d6['error']['message']);return _0x191d7b(_0x2360d6[_0xf378('0x15')][_0xf378('0x16')]);}else{logger[_0xf378('0xf')]('SmsInteraction,\x20%s,\x20%s',_0x446f78,_0xf378('0x13'));_0x191d7b(_0x2360d6['result'][_0xf378('0x16')]);}})[_0xf378('0x17')](function(_0x122853){logger[_0xf378('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x446f78,_0x122853);_0x4f673d(_0x122853);});});}exports[_0xf378('0x18')]=function(_0x10ed07){var _0x172716=this;return new Promise(function(_0x3680fb,_0xe9ed0a){return db[_0xf378('0x19')][_0xf378('0x1a')](_0x10ed07['body'],{'raw':_0x10ed07['options']?_0x10ed07[_0xf378('0x1b')][_0xf378('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10ed07[_0xf378('0x1b')]?_0x10ed07[_0xf378('0x1b')][_0xf378('0x1d')]||null:null,'attributes':_0x10ed07['options']?_0x10ed07[_0xf378('0x1b')][_0xf378('0x1e')]||null:null,'limit':_0x10ed07[_0xf378('0x1b')]?_0x10ed07[_0xf378('0x1b')][_0xf378('0x1f')]||null:null})[_0xf378('0x20')](function(_0x3c827a){logger[_0xf378('0xf')](_0xf378('0x18'),_0x10ed07);logger['debug'](_0xf378('0x18'),_0x10ed07,JSON[_0xf378('0x14')](_0x3c827a));_0x3680fb(_0x3c827a);})[_0xf378('0x17')](function(_0x11c4e0){logger[_0xf378('0x15')]('UpdateSmsInteraction',_0x11c4e0['message'],_0x10ed07);_0xe9ed0a(_0x172716[_0xf378('0x15')](0x1f4,_0x11c4e0[_0xf378('0x16')]));});});};exports[_0xf378('0x21')]=function(_0x2e925c){return new Promise(function(_0x8533b0,_0x2fa8cd){return db[_0xf378('0x19')]['find']({'where':_0x2e925c[_0xf378('0x1b')]?_0x2e925c[_0xf378('0x1b')][_0xf378('0x1d')]||null:null})['then'](function(_0x365d52){if(_0x365d52){return _0x365d52['addTags'](_0x2e925c['body'][_0xf378('0x22')],_[_0xf378('0x23')](_0x2e925c[_0xf378('0x24')],[_0xf378('0x22'),'id'])||{});}})[_0xf378('0x25')](function(_0x16f8f1){logger['info'](_0xf378('0x26'),_0x2e925c);logger[_0xf378('0x11')](_0xf378('0x26'),_0x2e925c,JSON[_0xf378('0x14')](_0x16f8f1));_0x8533b0(_0x16f8f1);})[_0xf378('0x17')](function(_0x282388){logger[_0xf378('0x15')]('AddTags',_0x282388[_0xf378('0x16')],_0x2e925c);_0x2fa8cd(_this[_0xf378('0x15')](0x1f4,_0x282388[_0xf378('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index f197eb7..872ddee 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 _0x91bf=['./smsInteraction.events','save','remove','update','emit','removeListener','register','smsInteraction:'];(function(_0x555c17,_0x2e6c2a){var _0x15a073=function(_0x411a4f){while(--_0x411a4f){_0x555c17['push'](_0x555c17['shift']());}};_0x15a073(++_0x2e6c2a);}(_0x91bf,0x170));var _0xf91b=function(_0x20d578,_0x1a58c9){_0x20d578=_0x20d578-0x0;var _0x5c595c=_0x91bf[_0x20d578];return _0x5c595c;};'use strict';var SmsInteractionEvents=require(_0xf91b('0x0'));var events=[_0xf91b('0x1'),_0xf91b('0x2'),_0xf91b('0x3')];function createListener(_0x42bfca,_0x32acf7){return function(_0x52c1b2){_0x32acf7[_0xf91b('0x4')](_0x42bfca,_0x52c1b2);};}function removeListener(_0x170c00,_0x213f79){return function(){SmsInteractionEvents[_0xf91b('0x5')](_0x170c00,_0x213f79);};}exports[_0xf91b('0x6')]=function(_0x31478b){for(var _0x262d74=0x0,_0x5d3f68=events['length'];_0x262d74<_0x5d3f68;_0x262d74++){var _0x441a1c=events[_0x262d74];var _0x4f899a=createListener(_0xf91b('0x7')+_0x441a1c,_0x31478b);SmsInteractionEvents['on'](_0x441a1c,_0x4f899a);}}; \ No newline at end of file +var _0x0b55=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x58ab89,_0xf01b2d){var _0xb93c04=function(_0x29e1b2){while(--_0x29e1b2){_0x58ab89['push'](_0x58ab89['shift']());}};_0xb93c04(++_0xf01b2d);}(_0x0b55,0x182));var _0x50b5=function(_0x29603e,_0x4c10ee){_0x29603e=_0x29603e-0x0;var _0x5cbf1d=_0x0b55[_0x29603e];return _0x5cbf1d;};'use strict';var SmsInteractionEvents=require(_0x50b5('0x0'));var events=[_0x50b5('0x1'),_0x50b5('0x2'),_0x50b5('0x3')];function createListener(_0x5023c3,_0x5bb36b){return function(_0x2f2ca7){_0x5bb36b[_0x50b5('0x4')](_0x5023c3,_0x2f2ca7);};}function removeListener(_0x11ae68,_0x188ede){return function(){SmsInteractionEvents[_0x50b5('0x5')](_0x11ae68,_0x188ede);};}exports[_0x50b5('0x6')]=function(_0x19d840){for(var _0x1c9e42=0x0,_0x5cdd05=events[_0x50b5('0x7')];_0x1c9e42<_0x5cdd05;_0x1c9e42++){var _0x488a6b=events[_0x1c9e42];var _0x10cfcd=createListener(_0x50b5('0x8')+_0x488a6b,_0x19d840);SmsInteractionEvents['on'](_0x488a6b,_0x10cfcd);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5942d03..22ee56e 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 _0xdb9b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe','get','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xdb9b,0x72));var _0xbdb9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xdb9b[_0x4709c0];return _0x13348b;};'use strict';var multer=require('multer');var util=require(_0xbdb9('0x0'));var path=require(_0xbdb9('0x1'));var timeout=require(_0xbdb9('0x2'));var express=require(_0xbdb9('0x3'));var router=express[_0xbdb9('0x4')]();var fs_extra=require(_0xbdb9('0x5'));var auth=require(_0xbdb9('0x6'));var interaction=require(_0xbdb9('0x7'));var config=require(_0xbdb9('0x8'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xbdb9('0x9')](),controller['index']);router['get']('/describe',auth[_0xbdb9('0x9')](),controller[_0xbdb9('0xa')]);router[_0xbdb9('0xb')]('/:id',auth[_0xbdb9('0x9')](),controller[_0xbdb9('0xc')]);router[_0xbdb9('0xd')]('/',auth[_0xbdb9('0x9')](),interaction[_0xbdb9('0xe')](_0xbdb9('0xf'),_0xbdb9('0x10')),controller['create']);router[_0xbdb9('0xd')](_0xbdb9('0x11'),controller[_0xbdb9('0x12')]);router[_0xbdb9('0x13')](_0xbdb9('0x14'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x15')]);router[_0xbdb9('0x13')](_0xbdb9('0x16'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x17')]);router[_0xbdb9('0x13')](_0xbdb9('0x18'),auth['isAuthenticated'](),controller[_0xbdb9('0x19')]);router[_0xbdb9('0x1a')](_0xbdb9('0x14'),auth[_0xbdb9('0x9')](),controller[_0xbdb9('0x1b')]);module[_0xbdb9('0x1c')]=router; \ No newline at end of file +var _0x7903=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','delete','destroy'];(function(_0x189b21,_0x4c1465){var _0x2add98=function(_0x3bb76e){while(--_0x3bb76e){_0x189b21['push'](_0x189b21['shift']());}};_0x2add98(++_0x4c1465);}(_0x7903,0xe2));var _0x3790=function(_0x488329,_0x4f6288){_0x488329=_0x488329-0x0;var _0x565768=_0x7903[_0x488329];return _0x565768;};'use strict';var multer=require(_0x3790('0x0'));var util=require('util');var path=require(_0x3790('0x1'));var timeout=require(_0x3790('0x2'));var express=require(_0x3790('0x3'));var router=express[_0x3790('0x4')]();var fs_extra=require(_0x3790('0x5'));var auth=require(_0x3790('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3790('0x7')]('/describe',auth[_0x3790('0x8')](),controller['describe']);router[_0x3790('0x7')](_0x3790('0x9'),auth[_0x3790('0x8')](),controller[_0x3790('0xa')]);router[_0x3790('0xb')]('/',auth[_0x3790('0x8')](),interaction[_0x3790('0xc')](_0x3790('0xd'),_0x3790('0xe')),controller[_0x3790('0xf')]);router[_0x3790('0xb')](_0x3790('0x10'),controller[_0x3790('0x11')]);router[_0x3790('0x12')](_0x3790('0x9'),auth[_0x3790('0x8')](),controller[_0x3790('0x13')]);router[_0x3790('0x12')](_0x3790('0x14'),auth[_0x3790('0x8')](),controller['accept']);router[_0x3790('0x12')]('/:id/reject',auth['isAuthenticated'](),controller[_0x3790('0x15')]);router[_0x3790('0x16')](_0x3790('0x9'),auth[_0x3790('0x8')](),controller[_0x3790('0x17')]);module[_0x3790('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 273f9c4..3c2fa54 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 _0x0748=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x25e1b8,_0x29c86f){var _0xdd73c9=function(_0x535dd1){while(--_0x535dd1){_0x25e1b8['push'](_0x25e1b8['shift']());}};_0xdd73c9(++_0x29c86f);}(_0x0748,0xce));var _0x8074=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x0748[_0x361d3f];return _0x320229;};'use strict';var Sequelize=require(_0x8074('0x0'));module[_0x8074('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8074('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8074('0x3')]('in',_0x8074('0x4')),'defaultValue':_0x8074('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8074('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8074('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8074('0x5')]},'providerResponse':{'type':Sequelize[_0x8074('0x7')]}}; \ No newline at end of file +var _0xbacb=['medium','BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xbacb,0x1a6));var _0xbbac=function(_0x482837,_0x43fccc){_0x482837=_0x482837-0x0;var _0xce4813=_0xbacb[_0x482837];return _0xce4813;};'use strict';var Sequelize=require(_0xbbac('0x0'));module[_0xbbac('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbbac('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbbac('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbbac('0x4')]('in',_0xbbac('0x5')),'defaultValue':_0xbbac('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbbac('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbbac('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbbac('0x6')]},'providerResponse':{'type':Sequelize[_0xbbac('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 8965595..961c7d0 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 _0xa1d2=['UserId','user','agent','get','SmsInteractionId','isNil','format','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','User','fullname','internal','manual','SIP/%s','channel','motionChannel','reject','SmsInteraction','role','RejectMessage','sequelize','QueryTypes','SELECT','contact','interface','event','EventManager','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageUUID','messageId','indexOf','delivered','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','json','undefined','count','offset','limit','status','set','apply','destroy','end','name','send','map','SmsMessage','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','params','rawAttributes','keys','options','create','body','update','find','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397843,_0xa7173e){var _0x2ba028=function(_0x243ab4){while(--_0x243ab4){_0x397843['push'](_0x397843['shift']());}};_0x2ba028(++_0xa7173e);}(_0xa1d2,0x151));var _0x2a1d=function(_0x138b33,_0x23073b){_0x138b33=_0x138b33-0x0;var _0x475983=_0xa1d2[_0x138b33];return _0x475983;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a1d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a1d('0x1'));var rp=require(_0x2a1d('0x2'));var moment=require(_0x2a1d('0x3'));var BPromise=require(_0x2a1d('0x4'));var Mustache=require(_0x2a1d('0x5'));var util=require(_0x2a1d('0x6'));var path=require(_0x2a1d('0x7'));var sox=require(_0x2a1d('0x8'));var csv=require(_0x2a1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a1d('0xa'));var _=require(_0x2a1d('0xb'));var squel=require(_0x2a1d('0xc'));var crypto=require(_0x2a1d('0xd'));var jsforce=require(_0x2a1d('0xe'));var deskjs=require(_0x2a1d('0xf'));var toCsv=require(_0x2a1d('0x9'));var querystring=require(_0x2a1d('0x10'));var Papa=require(_0x2a1d('0x11'));var Redis=require(_0x2a1d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a1d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a1d('0x14'));var logger=require(_0x2a1d('0x15'))('api');var utils=require(_0x2a1d('0x16'));var config=require(_0x2a1d('0x17'));var licenseUtil=require(_0x2a1d('0x18'));var db=require('../../mysqldb')['db'];config[_0x2a1d('0x19')]=_['defaults'](config[_0x2a1d('0x19')],{'host':_0x2a1d('0x1a'),'port':0x18eb});var socket=require(_0x2a1d('0x1b'))(new Redis(config[_0x2a1d('0x19')]));require(_0x2a1d('0x1c'))[_0x2a1d('0x1d')](socket);var jayson=require(_0x2a1d('0x1e'));var client=jayson[_0x2a1d('0x1f')][_0x2a1d('0x20')]({'port':0x232c});var client9002=jayson[_0x2a1d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4630c4,_0x1cfb8b,_0x30a64b,_0x192585){return new BPromise(function(_0x3925e1,_0x12fa6d){var _0x229a21=_0x192585||client;return _0x229a21[_0x2a1d('0x21')](_0x4630c4,_0x30a64b)[_0x2a1d('0x22')](function(_0xb5d08d){logger['info'](_0x2a1d('0x23'),_0x1cfb8b,_0x2a1d('0x24'));logger[_0x2a1d('0x25')](_0x2a1d('0x26'),_0x1cfb8b,_0x2a1d('0x24'),JSON['stringify'](_0xb5d08d));if(_0xb5d08d[_0x2a1d('0x27')]){if(_0xb5d08d['error'][_0x2a1d('0x28')]===0x1f4){logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0xb5d08d[_0x2a1d('0x27')][_0x2a1d('0x29')]);return _0x12fa6d(_0xb5d08d['error']['message']);}logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0xb5d08d[_0x2a1d('0x27')][_0x2a1d('0x29')]);return _0x3925e1(_0xb5d08d[_0x2a1d('0x27')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1cfb8b,_0x2a1d('0x24'));_0x3925e1(_0xb5d08d['result']['message']);}})[_0x2a1d('0x2a')](function(_0x4f858d){logger[_0x2a1d('0x27')](_0x2a1d('0x23'),_0x1cfb8b,_0x4f858d);_0x12fa6d(_0x4f858d);});});}function respondWithStatusCode(_0x587d7b,_0x2a6055){_0x2a6055=_0x2a6055||0xcc;return function(_0x450bac){if(_0x450bac){return _0x587d7b[_0x2a1d('0x2b')](_0x2a6055);}return _0x587d7b['status'](_0x2a6055)['end']();};}function respondWithResult(_0x5e5716,_0x26b351){_0x26b351=_0x26b351||0xc8;return function(_0x2b57c9){if(_0x2b57c9){return _0x5e5716['status'](_0x26b351)[_0x2a1d('0x2c')](_0x2b57c9);}};}function respondWithFilteredResult(_0x511df0,_0x3d75ca){return function(_0x4a5ccd){if(_0x4a5ccd){var _0x3a00e2=typeof _0x3d75ca['offset']===_0x2a1d('0x2d')&&typeof _0x3d75ca['limit']==='undefined';var _0x47d6a6=_0x4a5ccd[_0x2a1d('0x2e')];var _0x58854b=_0x3a00e2?0x0:_0x3d75ca[_0x2a1d('0x2f')];var _0x3c972e=_0x3a00e2?_0x4a5ccd[_0x2a1d('0x2e')]:_0x3d75ca[_0x2a1d('0x2f')]+_0x3d75ca[_0x2a1d('0x30')];var _0x2abad0;if(_0x3c972e>=_0x47d6a6){_0x3c972e=_0x47d6a6;_0x2abad0=0xc8;}else{_0x2abad0=0xce;}_0x511df0[_0x2a1d('0x31')](_0x2abad0);return _0x511df0[_0x2a1d('0x32')]('Content-Range',_0x58854b+'-'+_0x3c972e+'/'+_0x47d6a6)['json'](_0x4a5ccd);}return null;};}function patchUpdates(_0x54031a){return function(_0x28937f){try{jsonpatch[_0x2a1d('0x33')](_0x28937f,_0x54031a,!![]);}catch(_0x4f6df7){return BPromise['reject'](_0x4f6df7);}return _0x28937f['save']();};}function saveUpdates(_0x1f01aa,_0xa43863){return function(_0x1486e6){if(_0x1486e6){return _0x1486e6['update'](_0x1f01aa)[_0x2a1d('0x22')](function(_0x240a0a){return _0x240a0a;});}return null;};}function removeEntity(_0xb8bd4e,_0x459636){return function(_0x192e48){if(_0x192e48){return _0x192e48[_0x2a1d('0x34')]()[_0x2a1d('0x22')](function(){_0xb8bd4e[_0x2a1d('0x31')](0xcc)[_0x2a1d('0x35')]();});}};}function handleEntityNotFound(_0x2eed5f,_0x4fb3ca){return function(_0x2a054e){if(!_0x2a054e){_0x2eed5f['sendStatus'](0x194);}return _0x2a054e;};}function handleError(_0x51d978,_0x5f1130){_0x5f1130=_0x5f1130||0x1f4;return function(_0xc43d4c){logger[_0x2a1d('0x27')](_0xc43d4c['stack']);if(_0xc43d4c['name']){delete _0xc43d4c[_0x2a1d('0x36')];}_0x51d978[_0x2a1d('0x31')](_0x5f1130)[_0x2a1d('0x37')](_0xc43d4c);};}exports['index']=function(_0x4e464a,_0x62be77){var _0x1c43a5={},_0x5d8f87={},_0x1a40ba={'count':0x0,'rows':[]};var _0x4a15c7=_[_0x2a1d('0x38')](db[_0x2a1d('0x39')]['rawAttributes'],function(_0x2ef779){return{'name':_0x2ef779[_0x2a1d('0x3a')],'type':_0x2ef779[_0x2a1d('0x3b')][_0x2a1d('0x3c')]};});_0x5d8f87['model']=_[_0x2a1d('0x38')](_0x4a15c7,_0x2a1d('0x36'));_0x5d8f87[_0x2a1d('0x3d')]=_['keys'](_0x4e464a[_0x2a1d('0x3d')]);_0x5d8f87[_0x2a1d('0x3e')]=_[_0x2a1d('0x3f')](_0x5d8f87[_0x2a1d('0x40')],_0x5d8f87[_0x2a1d('0x3d')]);_0x1c43a5[_0x2a1d('0x41')]=_['intersection'](_0x5d8f87[_0x2a1d('0x40')],qs[_0x2a1d('0x42')](_0x4e464a[_0x2a1d('0x3d')][_0x2a1d('0x42')]));_0x1c43a5[_0x2a1d('0x41')]=_0x1c43a5[_0x2a1d('0x41')][_0x2a1d('0x43')]?_0x1c43a5[_0x2a1d('0x41')]:_0x5d8f87['model'];if(!_0x4e464a[_0x2a1d('0x3d')]['hasOwnProperty'](_0x2a1d('0x44'))){_0x1c43a5['limit']=qs['limit'](_0x4e464a[_0x2a1d('0x3d')]['limit']);_0x1c43a5[_0x2a1d('0x2f')]=qs['offset'](_0x4e464a[_0x2a1d('0x3d')]['offset']);}_0x1c43a5[_0x2a1d('0x45')]=qs[_0x2a1d('0x46')](_0x4e464a['query']['sort']);_0x1c43a5['where']=qs[_0x2a1d('0x3e')](_[_0x2a1d('0x47')](_0x4e464a[_0x2a1d('0x3d')],_0x5d8f87['filters']),_0x4a15c7);if(_0x4e464a['query'][_0x2a1d('0x48')]){_0x1c43a5[_0x2a1d('0x49')]=_['merge'](_0x1c43a5[_0x2a1d('0x49')],{'$or':_[_0x2a1d('0x38')](_0x4a15c7,function(_0x11f017){if(_0x11f017[_0x2a1d('0x3b')]!==_0x2a1d('0x4a')){var _0x38b64f={};_0x38b64f[_0x11f017['name']]={'$like':'%'+_0x4e464a['query']['filter']+'%'};return _0x38b64f;}})});}_0x1c43a5=_[_0x2a1d('0x4b')]({},_0x1c43a5,_0x4e464a['options']);var _0x588ba0={'where':_0x1c43a5['where']};return db[_0x2a1d('0x39')][_0x2a1d('0x2e')](_0x588ba0)[_0x2a1d('0x22')](function(_0x166bb4){_0x1a40ba[_0x2a1d('0x2e')]=_0x166bb4;if(_0x4e464a[_0x2a1d('0x3d')][_0x2a1d('0x4c')]){_0x1c43a5[_0x2a1d('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0x2a1d('0x4e')](_0x1c43a5);})['then'](function(_0x5b1c52){_0x1a40ba[_0x2a1d('0x4f')]=_0x5b1c52;return _0x1a40ba;})[_0x2a1d('0x22')](respondWithFilteredResult(_0x62be77,_0x1c43a5))[_0x2a1d('0x2a')](handleError(_0x62be77,null));};exports['show']=function(_0x1a700a,_0x42a16a){var _0x2b6e20={'raw':!![],'where':{'id':_0x1a700a[_0x2a1d('0x50')]['id']}},_0x16ad4b={};_0x16ad4b[_0x2a1d('0x40')]=_['keys'](db[_0x2a1d('0x39')][_0x2a1d('0x51')]);_0x16ad4b['query']=_[_0x2a1d('0x52')](_0x1a700a[_0x2a1d('0x3d')]);_0x16ad4b['filters']=_['intersection'](_0x16ad4b[_0x2a1d('0x40')],_0x16ad4b[_0x2a1d('0x3d')]);_0x2b6e20[_0x2a1d('0x41')]=_['intersection'](_0x16ad4b[_0x2a1d('0x40')],qs[_0x2a1d('0x42')](_0x1a700a['query'][_0x2a1d('0x42')]));_0x2b6e20[_0x2a1d('0x41')]=_0x2b6e20[_0x2a1d('0x41')][_0x2a1d('0x43')]?_0x2b6e20[_0x2a1d('0x41')]:_0x16ad4b[_0x2a1d('0x40')];if(_0x1a700a[_0x2a1d('0x3d')][_0x2a1d('0x4c')]){_0x2b6e20[_0x2a1d('0x4d')]=[{'all':!![]}];}_0x2b6e20=_['merge']({},_0x2b6e20,_0x1a700a[_0x2a1d('0x53')]);return db[_0x2a1d('0x39')]['find'](_0x2b6e20)[_0x2a1d('0x22')](handleEntityNotFound(_0x42a16a,null))[_0x2a1d('0x22')](respondWithResult(_0x42a16a,null))[_0x2a1d('0x2a')](handleError(_0x42a16a,null));};exports[_0x2a1d('0x54')]=function(_0x1e486f,_0x15eaf7){return db['SmsMessage']['create'](_0x1e486f[_0x2a1d('0x55')],{})[_0x2a1d('0x22')](respondWithResult(_0x15eaf7,0xc9))['catch'](handleError(_0x15eaf7,null));};exports[_0x2a1d('0x56')]=function(_0x4a3f85,_0x3950b0){if(_0x4a3f85['body']['id']){delete _0x4a3f85[_0x2a1d('0x55')]['id'];}return db[_0x2a1d('0x39')][_0x2a1d('0x57')]({'where':{'id':_0x4a3f85['params']['id']}})[_0x2a1d('0x22')](handleEntityNotFound(_0x3950b0,null))['then'](saveUpdates(_0x4a3f85[_0x2a1d('0x55')],null))[_0x2a1d('0x22')](respondWithResult(_0x3950b0,null))[_0x2a1d('0x2a')](handleError(_0x3950b0,null));};exports[_0x2a1d('0x34')]=function(_0x389115,_0x1844e7){return db[_0x2a1d('0x39')]['find']({'where':{'id':_0x389115[_0x2a1d('0x50')]['id']}})[_0x2a1d('0x22')](handleEntityNotFound(_0x1844e7,null))[_0x2a1d('0x22')](removeEntity(_0x1844e7,null))[_0x2a1d('0x2a')](handleError(_0x1844e7,null));};exports[_0x2a1d('0x58')]=function(_0x36e446,_0x2b5f29){return db[_0x2a1d('0x39')]['describe']()[_0x2a1d('0x22')](respondWithResult(_0x2b5f29,null))['catch'](handleError(_0x2b5f29,null));};var interaction_log=require(_0x2a1d('0x15'))(_0x2a1d('0x59'));exports[_0x2a1d('0x5a')]=function(_0xd518a0,_0x26df56,_0x58a69e){var _0x553a99={'agent':{},'channel':_0x2a1d('0x5b')};if(_0xd518a0['body']['id']){delete _0xd518a0['body']['id'];}_0xd518a0['body'][_0x2a1d('0x5c')]=!![];_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5d')]=moment()['format'](_0x2a1d('0x5e'));_0xd518a0['body'][_0x2a1d('0x5f')]=_0xd518a0['body'][_0x2a1d('0x5f')]||_0xd518a0[_0x2a1d('0x60')]['id'];_0x553a99[_0x2a1d('0x61')]['id']=_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0xd518a0[_0x2a1d('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x26df56,null))[_0x2a1d('0x22')](saveUpdates(_0xd518a0[_0x2a1d('0x55')],null))['then'](function(_0x1dcb6c){if(_0x1dcb6c){_0x553a99[_0x2a1d('0x29')]=_0x1dcb6c[_0x2a1d('0x62')]({'plain':!![]});return db['SmsInteraction'][_0x2a1d('0x57')]({'where':{'id':_0x1dcb6c[_0x2a1d('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x26df56,null))['then'](function(_0x42bdaf){if(_0x42bdaf){return _0x42bdaf[_0x2a1d('0x56')]({'UserId':_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')],'read1stAt':_[_0x2a1d('0x64')](_0x42bdaf['read1stAt'])?moment()[_0x2a1d('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2a1d('0x22')](function(_0x567d0){if(_0x567d0){_0x553a99[_0x2a1d('0x66')]=_0x567d0[_0x2a1d('0x62')]({'plain':!![]});interaction_log[_0x2a1d('0x67')](_0x2a1d('0x68'),_0xd518a0['user']['id'],_0xd518a0['user'][_0x2a1d('0x36')],_0xd518a0[_0x2a1d('0x60')]['role'],_0x553a99[_0x2a1d('0x66')]['id'],_0xd518a0['body']?JSON[_0x2a1d('0x69')](_0xd518a0[_0x2a1d('0x55')]):_0x2a1d('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x2a1d('0x6b'),_0x553a99);}return null;})[_0x2a1d('0x22')](function(_0x19eedd){var _0xb2000d=_0x2a1d('0x6c')+_0x19eedd[_0x2a1d('0x29')][_0x2a1d('0x6d')];return db['sequelize'][_0x2a1d('0x3d')](_0xb2000d,{'type':db[_0x2a1d('0x6e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2a1d('0x22')](function(_0x2c2456){return _0x2c2456;});})[_0x2a1d('0x22')](function(_0xff1eb2){if(_0xff1eb2){_0x553a99['message']['contact']=_0xff1eb2[0x0];if(!_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')])return;return db[_0x2a1d('0x6f')]['find']({'where':{'id':_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x5f')],'role':_0x2a1d('0x61')},'attributes':['id',_0x2a1d('0x36'),_0x2a1d('0x70'),'email',_0x2a1d('0x71')],'raw':!![]});}return null;})[_0x2a1d('0x22')](function(_0x262a29){if(!_0x262a29)return null;_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x61')]=_0x262a29;return _0x553a99;})[_0x2a1d('0x22')](function(_0x29776f){if(_0x29776f){if(_0xd518a0[_0x2a1d('0x55')][_0x2a1d('0x72')]){_0x553a99[_0x2a1d('0x29')]['interface']=util[_0x2a1d('0x65')](_0x2a1d('0x73'),_0xd518a0['user'][_0x2a1d('0x36')]);_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x74')]=_0x553a99[_0x2a1d('0x74')];_0x553a99[_0x2a1d('0x29')][_0x2a1d('0x75')]=_0x553a99[_0x2a1d('0x74')];_0x553a99[_0x2a1d('0x29')]['event']=_0x2a1d('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x553a99[_0x2a1d('0x29')]},client9002)['then'](function(){return _0x553a99;});}return _0x553a99;}return null;})['then'](respondWithResult(_0x26df56,null))['catch'](handleError(_0x26df56,null));};var interaction_log=require(_0x2a1d('0x15'))(_0x2a1d('0x59'));exports[_0x2a1d('0x76')]=function(_0x461b0c,_0x1e2c0e,_0x231ba7){var _0x398e40={'agent':{},'channel':_0x2a1d('0x5b')};if(_0x461b0c[_0x2a1d('0x55')]['id']){delete _0x461b0c[_0x2a1d('0x55')]['id'];}_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')]=_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')]||_0x461b0c[_0x2a1d('0x60')]['id'];_0x398e40[_0x2a1d('0x61')]['id']=_0x461b0c['body'][_0x2a1d('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0x461b0c[_0x2a1d('0x50')]['id'],'UserId':null}})[_0x2a1d('0x22')](handleEntityNotFound(_0x1e2c0e,null))[_0x2a1d('0x22')](function(_0x44022d){if(_0x44022d){_0x398e40[_0x2a1d('0x29')]=_0x44022d['get']({'plain':!![]});return db[_0x2a1d('0x77')][_0x2a1d('0x57')]({'where':{'id':_0x44022d[_0x2a1d('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x1e2c0e,null))[_0x2a1d('0x22')](function(_0x48536d){if(_0x48536d){_0x398e40[_0x2a1d('0x66')]=_0x48536d[_0x2a1d('0x62')]({'plain':!![]});interaction_log[_0x2a1d('0x67')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x461b0c['user']['id'],_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x36')],_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x78')],_0x398e40[_0x2a1d('0x66')]['id'],_0x461b0c[_0x2a1d('0x55')]?JSON[_0x2a1d('0x69')](_0x461b0c[_0x2a1d('0x55')]):_0x2a1d('0x6a'));return respondWithRpcPromise(_0x2a1d('0x79'),'rejectMessage',_0x398e40);}return null;})['then'](function(_0x524619){var _0x171acf=_0x2a1d('0x6c')+_0x524619[_0x2a1d('0x29')][_0x2a1d('0x6d')];return db[_0x2a1d('0x7a')][_0x2a1d('0x3d')](_0x171acf,{'type':db[_0x2a1d('0x6e')][_0x2a1d('0x7b')][_0x2a1d('0x7c')],'raw':!![]})[_0x2a1d('0x22')](function(_0x4e8e4b){return _0x4e8e4b;});})[_0x2a1d('0x22')](function(_0x3669c2){if(_0x3669c2){_0x398e40[_0x2a1d('0x29')][_0x2a1d('0x7d')]=_0x3669c2[0x0];if(!_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')])return;return db[_0x2a1d('0x6f')][_0x2a1d('0x57')]({'where':{'id':_0x461b0c[_0x2a1d('0x55')][_0x2a1d('0x5f')],'role':'agent'},'attributes':['id','name',_0x2a1d('0x70'),'email',_0x2a1d('0x71')],'raw':!![]});}return null;})[_0x2a1d('0x22')](function(_0x597ef0){if(!_0x597ef0)return null;_0x398e40['message'][_0x2a1d('0x61')]=_0x597ef0;return _0x398e40;})[_0x2a1d('0x22')](function(_0x572bda){if(_0x572bda){_0x572bda[_0x2a1d('0x29')][_0x2a1d('0x7e')]=util[_0x2a1d('0x65')](_0x2a1d('0x73'),_0x461b0c[_0x2a1d('0x60')][_0x2a1d('0x36')]);_0x572bda['message'][_0x2a1d('0x74')]=_0x398e40['channel'];_0x572bda[_0x2a1d('0x29')]['motionChannel']=_0x398e40['channel'];_0x572bda['message'][_0x2a1d('0x7f')]='reject';respondWithRpcPromise(_0x2a1d('0x80'),_0x2a1d('0x80'),{'event':_0x2a1d('0x81'),'message':_0x572bda[_0x2a1d('0x29')]},client9002);return _0x398e40;}return null;})[_0x2a1d('0x22')](respondWithResult(_0x1e2c0e,null))['catch'](handleError(_0x1e2c0e,null));};exports[_0x2a1d('0x31')]=function(_0x3b86f6,_0xa41db2,_0x584fd9){if(_0x3b86f6[_0x2a1d('0x55')]['id']){delete _0x3b86f6[_0x2a1d('0x55')]['id'];}var _0xc33897;return db[_0x2a1d('0x39')][_0x2a1d('0x57')]({'where':{'id':_0x3b86f6['params']['id']}})['then'](handleEntityNotFound(_0xa41db2,null))['then'](function(_0xb0e757){if(_0xb0e757){_0xc33897=_0xb0e757;return db['SmsAccount'][_0x2a1d('0x57')]({'where':{'id':_0xb0e757[_0x2a1d('0x82')]}});}})[_0x2a1d('0x22')](handleEntityNotFound(_0xa41db2,null))['then'](function(_0xf06e3f){if(_0xf06e3f){logger[_0x2a1d('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),_0x2a1d('0x83'),_0xf06e3f['type'],util[_0x2a1d('0x84')](_0x3b86f6['body'],{'showHidden':![],'depth':null}));switch(_0xf06e3f['type']){case _0x2a1d('0x85'):if(_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x86')]&&_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x86')]===_0xc33897['messageId']){return _0xc33897[_0x2a1d('0x56')]({'read':!![]});}else{logger[_0x2a1d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),_0x2a1d('0x85'),util[_0x2a1d('0x84')](_0x3b86f6['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x87')]&&_0x3b86f6['body'][_0x2a1d('0x87')]===_0xc33897[_0x2a1d('0x88')]&&_[_0x2a1d('0x89')](['sent',_0x2a1d('0x8a')],_0x3b86f6[_0x2a1d('0x55')]['Status'])>=0x0){return _0xc33897['update']({'read':!![]});}else{logger[_0x2a1d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a1d('0x31'),'plivio',util[_0x2a1d('0x84')](_0x3b86f6[_0x2a1d('0x55')],{'showHidden':![],'depth':null}));}break;case _0x2a1d('0x8b'):var _0x47adad=_0x3b86f6[_0x2a1d('0x55')][_0x2a1d('0x8c')][0x0];if(_0x47adad[_0x2a1d('0x31')][_0x2a1d('0x8d')]===_0x2a1d('0x8e')){return _0xc33897[_0x2a1d('0x56')]({'read':!![]});}else{logger[_0x2a1d('0x27')](_0x2a1d('0x8f'),_0x2a1d('0x31'),_0x2a1d('0x8b'),util['inspect'](_0x3b86f6[_0x2a1d('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xc33897;}})[_0x2a1d('0x22')](respondWithResult(_0xa41db2,null))[_0x2a1d('0x2a')](handleError(_0xa41db2,null));}; \ No newline at end of file +var _0x8ed7=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','body','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','params','get','SmsInteraction','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','sms','RejectMessage','rejectMessage','fullname','rejectmessage','debug','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','DELIVERED','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x42fd08,_0x48b478){var _0x2b4ab6=function(_0x44b37c){while(--_0x44b37c){_0x42fd08['push'](_0x42fd08['shift']());}};_0x2b4ab6(++_0x48b478);}(_0x8ed7,0x8b));var _0x78ed=function(_0x5d191f,_0x2f8da3){_0x5d191f=_0x5d191f-0x0;var _0x7985ff=_0x8ed7[_0x5d191f];return _0x7985ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78ed('0x0'));var zipdir=require(_0x78ed('0x1'));var jsonpatch=require(_0x78ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78ed('0x3'));var Mustache=require(_0x78ed('0x4'));var util=require(_0x78ed('0x5'));var path=require(_0x78ed('0x6'));var sox=require(_0x78ed('0x7'));var csv=require(_0x78ed('0x8'));var ejs=require(_0x78ed('0x9'));var fs=require('fs');var fs_extra=require(_0x78ed('0xa'));var _=require(_0x78ed('0xb'));var squel=require('squel');var crypto=require(_0x78ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x78ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x78ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78ed('0xf'));var qs=require(_0x78ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78ed('0x11'));var logger=require(_0x78ed('0x12'))('api');var utils=require(_0x78ed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x78ed('0x14'));var db=require(_0x78ed('0x15'))['db'];config[_0x78ed('0x16')]=_[_0x78ed('0x17')](config[_0x78ed('0x16')],{'host':_0x78ed('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78ed('0x16')]));require('./smsMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x78ed('0x19')][_0x78ed('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2e9007,_0x195b7e,_0x250d59,_0x454a65){return new BPromise(function(_0x336ae1,_0x29048d){var _0x17d0d6=_0x454a65||client;return _0x17d0d6[_0x78ed('0x1b')](_0x2e9007,_0x250d59)[_0x78ed('0x1c')](function(_0x4b9797){logger[_0x78ed('0x1d')](_0x78ed('0x1e'),_0x195b7e,'request\x20sent');logger['debug'](_0x78ed('0x1f'),_0x195b7e,_0x78ed('0x20'),JSON[_0x78ed('0x21')](_0x4b9797));if(_0x4b9797[_0x78ed('0x22')]){if(_0x4b9797[_0x78ed('0x22')][_0x78ed('0x23')]===0x1f4){logger[_0x78ed('0x22')](_0x78ed('0x1e'),_0x195b7e,_0x4b9797[_0x78ed('0x22')][_0x78ed('0x24')]);return _0x29048d(_0x4b9797[_0x78ed('0x22')]['message']);}logger['error'](_0x78ed('0x1e'),_0x195b7e,_0x4b9797['error'][_0x78ed('0x24')]);return _0x336ae1(_0x4b9797['error'][_0x78ed('0x24')]);}else{logger['info'](_0x78ed('0x1e'),_0x195b7e,_0x78ed('0x20'));_0x336ae1(_0x4b9797[_0x78ed('0x25')]['message']);}})[_0x78ed('0x26')](function(_0x5a8b87){logger[_0x78ed('0x22')](_0x78ed('0x1e'),_0x195b7e,_0x5a8b87);_0x29048d(_0x5a8b87);});});}function respondWithStatusCode(_0x34fb0e,_0x59349a){_0x59349a=_0x59349a||0xcc;return function(_0x5abe1b){if(_0x5abe1b){return _0x34fb0e[_0x78ed('0x27')](_0x59349a);}return _0x34fb0e['status'](_0x59349a)[_0x78ed('0x28')]();};}function respondWithResult(_0x55c5ed,_0x12d5e1){_0x12d5e1=_0x12d5e1||0xc8;return function(_0x1433e1){if(_0x1433e1){return _0x55c5ed[_0x78ed('0x29')](_0x12d5e1)[_0x78ed('0x2a')](_0x1433e1);}};}function respondWithFilteredResult(_0xafc1cf,_0x624bb1){return function(_0x3cd100){if(_0x3cd100){var _0x312801=typeof _0x624bb1[_0x78ed('0x2b')]==='undefined'&&typeof _0x624bb1[_0x78ed('0x2c')]===_0x78ed('0x2d');var _0x2a66ce=_0x3cd100[_0x78ed('0x2e')];var _0x4af685=_0x312801?0x0:_0x624bb1['offset'];var _0x5da4d0=_0x312801?_0x3cd100['count']:_0x624bb1[_0x78ed('0x2b')]+_0x624bb1[_0x78ed('0x2c')];var _0x17883d;if(_0x5da4d0>=_0x2a66ce){_0x5da4d0=_0x2a66ce;_0x17883d=0xc8;}else{_0x17883d=0xce;}_0xafc1cf[_0x78ed('0x29')](_0x17883d);return _0xafc1cf[_0x78ed('0x2f')](_0x78ed('0x30'),_0x4af685+'-'+_0x5da4d0+'/'+_0x2a66ce)[_0x78ed('0x2a')](_0x3cd100);}return null;};}function patchUpdates(_0x550956){return function(_0x24c908){try{jsonpatch['apply'](_0x24c908,_0x550956,!![]);}catch(_0x210e9d){return BPromise[_0x78ed('0x31')](_0x210e9d);}return _0x24c908['save']();};}function saveUpdates(_0x13a9db,_0x179d1d){return function(_0x13c39c){if(_0x13c39c){return _0x13c39c[_0x78ed('0x32')](_0x13a9db)[_0x78ed('0x1c')](function(_0x19bd3b){return _0x19bd3b;});}return null;};}function removeEntity(_0x135a8f,_0x45831d){return function(_0x4da527){if(_0x4da527){return _0x4da527[_0x78ed('0x33')]()['then'](function(){_0x135a8f[_0x78ed('0x29')](0xcc)[_0x78ed('0x28')]();});}};}function handleEntityNotFound(_0x3b8e9c,_0x963ece){return function(_0x437852){if(!_0x437852){_0x3b8e9c[_0x78ed('0x27')](0x194);}return _0x437852;};}function handleError(_0x2031eb,_0x47f969){_0x47f969=_0x47f969||0x1f4;return function(_0x2ac50){logger[_0x78ed('0x22')](_0x2ac50[_0x78ed('0x34')]);if(_0x2ac50[_0x78ed('0x35')]){delete _0x2ac50[_0x78ed('0x35')];}_0x2031eb[_0x78ed('0x29')](_0x47f969)[_0x78ed('0x36')](_0x2ac50);};}exports[_0x78ed('0x37')]=function(_0x3ba9e8,_0x1b30f6){var _0x1e3ead={},_0x59d30a={},_0x4b1bef={'count':0x0,'rows':[]};var _0x23e51b=_['map'](db[_0x78ed('0x38')][_0x78ed('0x39')],function(_0x4edc9c){return{'name':_0x4edc9c[_0x78ed('0x3a')],'type':_0x4edc9c[_0x78ed('0x3b')][_0x78ed('0x3c')]};});_0x59d30a[_0x78ed('0x3d')]=_[_0x78ed('0x3e')](_0x23e51b,_0x78ed('0x35'));_0x59d30a['query']=_[_0x78ed('0x3f')](_0x3ba9e8[_0x78ed('0x40')]);_0x59d30a[_0x78ed('0x41')]=_[_0x78ed('0x42')](_0x59d30a['model'],_0x59d30a['query']);_0x1e3ead[_0x78ed('0x43')]=_[_0x78ed('0x42')](_0x59d30a['model'],qs[_0x78ed('0x44')](_0x3ba9e8[_0x78ed('0x40')]['fields']));_0x1e3ead['attributes']=_0x1e3ead[_0x78ed('0x43')][_0x78ed('0x45')]?_0x1e3ead[_0x78ed('0x43')]:_0x59d30a[_0x78ed('0x3d')];if(!_0x3ba9e8['query']['hasOwnProperty'](_0x78ed('0x46'))){_0x1e3ead[_0x78ed('0x2c')]=qs['limit'](_0x3ba9e8[_0x78ed('0x40')]['limit']);_0x1e3ead[_0x78ed('0x2b')]=qs[_0x78ed('0x2b')](_0x3ba9e8[_0x78ed('0x40')][_0x78ed('0x2b')]);}_0x1e3ead[_0x78ed('0x47')]=qs['sort'](_0x3ba9e8[_0x78ed('0x40')][_0x78ed('0x48')]);_0x1e3ead[_0x78ed('0x49')]=qs[_0x78ed('0x41')](_[_0x78ed('0x4a')](_0x3ba9e8['query'],_0x59d30a['filters']),_0x23e51b);if(_0x3ba9e8[_0x78ed('0x40')][_0x78ed('0x4b')]){_0x1e3ead[_0x78ed('0x49')]=_[_0x78ed('0x4c')](_0x1e3ead['where'],{'$or':_[_0x78ed('0x3e')](_0x23e51b,function(_0x16223d){if(_0x16223d[_0x78ed('0x3b')]!==_0x78ed('0x4d')){var _0x103eb1={};_0x103eb1[_0x16223d[_0x78ed('0x35')]]={'$like':'%'+_0x3ba9e8['query'][_0x78ed('0x4b')]+'%'};return _0x103eb1;}})});}_0x1e3ead=_['merge']({},_0x1e3ead,_0x3ba9e8[_0x78ed('0x4e')]);var _0x59b8f4={'where':_0x1e3ead[_0x78ed('0x49')]};return db[_0x78ed('0x38')][_0x78ed('0x2e')](_0x59b8f4)[_0x78ed('0x1c')](function(_0x329e1d){_0x4b1bef['count']=_0x329e1d;if(_0x3ba9e8['query'][_0x78ed('0x4f')]){_0x1e3ead[_0x78ed('0x50')]=[{'all':!![]}];}return db[_0x78ed('0x38')]['findAll'](_0x1e3ead);})[_0x78ed('0x1c')](function(_0x439883){_0x4b1bef[_0x78ed('0x51')]=_0x439883;return _0x4b1bef;})['then'](respondWithFilteredResult(_0x1b30f6,_0x1e3ead))['catch'](handleError(_0x1b30f6,null));};exports[_0x78ed('0x52')]=function(_0x4ae8f5,_0x1a79df){var _0xc7a4e1={'raw':!![],'where':{'id':_0x4ae8f5['params']['id']}},_0x4b0b36={};_0x4b0b36[_0x78ed('0x3d')]=_[_0x78ed('0x3f')](db[_0x78ed('0x38')][_0x78ed('0x39')]);_0x4b0b36[_0x78ed('0x40')]=_[_0x78ed('0x3f')](_0x4ae8f5[_0x78ed('0x40')]);_0x4b0b36[_0x78ed('0x41')]=_[_0x78ed('0x42')](_0x4b0b36[_0x78ed('0x3d')],_0x4b0b36[_0x78ed('0x40')]);_0xc7a4e1[_0x78ed('0x43')]=_[_0x78ed('0x42')](_0x4b0b36[_0x78ed('0x3d')],qs['fields'](_0x4ae8f5[_0x78ed('0x40')][_0x78ed('0x44')]));_0xc7a4e1['attributes']=_0xc7a4e1[_0x78ed('0x43')][_0x78ed('0x45')]?_0xc7a4e1[_0x78ed('0x43')]:_0x4b0b36[_0x78ed('0x3d')];if(_0x4ae8f5[_0x78ed('0x40')]['includeAll']){_0xc7a4e1[_0x78ed('0x50')]=[{'all':!![]}];}_0xc7a4e1=_['merge']({},_0xc7a4e1,_0x4ae8f5[_0x78ed('0x4e')]);return db[_0x78ed('0x38')][_0x78ed('0x53')](_0xc7a4e1)[_0x78ed('0x1c')](handleEntityNotFound(_0x1a79df,null))[_0x78ed('0x1c')](respondWithResult(_0x1a79df,null))[_0x78ed('0x26')](handleError(_0x1a79df,null));};exports['create']=function(_0x537938,_0x226598){return db['SmsMessage'][_0x78ed('0x54')](_0x537938[_0x78ed('0x55')],{})[_0x78ed('0x1c')](respondWithResult(_0x226598,0xc9))[_0x78ed('0x26')](handleError(_0x226598,null));};exports['update']=function(_0x2d8326,_0x8ce62a){if(_0x2d8326[_0x78ed('0x55')]['id']){delete _0x2d8326[_0x78ed('0x55')]['id'];}return db[_0x78ed('0x38')][_0x78ed('0x53')]({'where':{'id':_0x2d8326['params']['id']}})[_0x78ed('0x1c')](handleEntityNotFound(_0x8ce62a,null))[_0x78ed('0x1c')](saveUpdates(_0x2d8326['body'],null))[_0x78ed('0x1c')](respondWithResult(_0x8ce62a,null))[_0x78ed('0x26')](handleError(_0x8ce62a,null));};exports[_0x78ed('0x33')]=function(_0x567523,_0x10a410){return db['SmsMessage'][_0x78ed('0x53')]({'where':{'id':_0x567523['params']['id']}})['then'](handleEntityNotFound(_0x10a410,null))[_0x78ed('0x1c')](removeEntity(_0x10a410,null))[_0x78ed('0x26')](handleError(_0x10a410,null));};exports[_0x78ed('0x56')]=function(_0x32ec7b,_0x3e36d5){return db[_0x78ed('0x38')][_0x78ed('0x56')]()[_0x78ed('0x1c')](respondWithResult(_0x3e36d5,null))[_0x78ed('0x26')](handleError(_0x3e36d5,null));};var interaction_log=require(_0x78ed('0x12'))(_0x78ed('0x57'));exports[_0x78ed('0x58')]=function(_0x4ab8eb,_0x3f62b0,_0x2b44de){var _0x1095c7={'agent':{},'channel':'sms'};if(_0x4ab8eb['body']['id']){delete _0x4ab8eb[_0x78ed('0x55')]['id'];}_0x4ab8eb[_0x78ed('0x55')][_0x78ed('0x59')]=!![];_0x4ab8eb[_0x78ed('0x55')][_0x78ed('0x5a')]=moment()['format'](_0x78ed('0x5b'));_0x4ab8eb[_0x78ed('0x55')][_0x78ed('0x5c')]=_0x4ab8eb['body'][_0x78ed('0x5c')]||_0x4ab8eb[_0x78ed('0x5d')]['id'];_0x1095c7[_0x78ed('0x5e')]['id']=_0x4ab8eb[_0x78ed('0x55')][_0x78ed('0x5c')];return db[_0x78ed('0x38')][_0x78ed('0x53')]({'where':{'id':_0x4ab8eb[_0x78ed('0x5f')]['id'],'UserId':null}})[_0x78ed('0x1c')](handleEntityNotFound(_0x3f62b0,null))['then'](saveUpdates(_0x4ab8eb[_0x78ed('0x55')],null))[_0x78ed('0x1c')](function(_0x3fa09e){if(_0x3fa09e){_0x1095c7[_0x78ed('0x24')]=_0x3fa09e[_0x78ed('0x60')]({'plain':!![]});return db[_0x78ed('0x61')][_0x78ed('0x53')]({'where':{'id':_0x3fa09e['SmsInteractionId']}});}return null;})[_0x78ed('0x1c')](handleEntityNotFound(_0x3f62b0,null))[_0x78ed('0x1c')](function(_0x125ecd){if(_0x125ecd){return _0x125ecd['update']({'UserId':_0x4ab8eb[_0x78ed('0x55')][_0x78ed('0x5c')],'read1stAt':_[_0x78ed('0x62')](_0x125ecd[_0x78ed('0x63')])?moment()[_0x78ed('0x64')](_0x78ed('0x5b')):undefined});}return null;})[_0x78ed('0x1c')](function(_0x47d00c){if(_0x47d00c){_0x1095c7['interaction']=_0x47d00c[_0x78ed('0x60')]({'plain':!![]});interaction_log[_0x78ed('0x1d')](_0x78ed('0x65'),_0x4ab8eb['user']['id'],_0x4ab8eb[_0x78ed('0x5d')]['name'],_0x4ab8eb['user'][_0x78ed('0x66')],_0x1095c7[_0x78ed('0x67')]['id'],_0x4ab8eb['body']?JSON[_0x78ed('0x21')](_0x4ab8eb['body']):_0x78ed('0x68'));return respondWithRpcPromise('AcceptMessage',_0x78ed('0x69'),_0x1095c7);}return null;})[_0x78ed('0x1c')](function(_0x26729f){var _0x5bd44a=_0x78ed('0x6a')+_0x26729f[_0x78ed('0x24')]['ContactId'];return db[_0x78ed('0x6b')][_0x78ed('0x40')](_0x5bd44a,{'type':db[_0x78ed('0x6c')][_0x78ed('0x6d')][_0x78ed('0x6e')],'raw':!![]})[_0x78ed('0x1c')](function(_0x46e8cb){return _0x46e8cb;});})['then'](function(_0x238cd2){if(_0x238cd2){_0x1095c7[_0x78ed('0x24')][_0x78ed('0x6f')]=_0x238cd2[0x0];if(!_0x4ab8eb['body'][_0x78ed('0x5c')])return;return db[_0x78ed('0x70')][_0x78ed('0x53')]({'where':{'id':_0x4ab8eb['body'][_0x78ed('0x5c')],'role':_0x78ed('0x5e')},'attributes':['id',_0x78ed('0x35'),'fullname',_0x78ed('0x71'),_0x78ed('0x72')],'raw':!![]});}return null;})['then'](function(_0x307d2c){if(!_0x307d2c)return null;_0x1095c7[_0x78ed('0x24')][_0x78ed('0x5e')]=_0x307d2c;return _0x1095c7;})[_0x78ed('0x1c')](function(_0x5d1794){if(_0x5d1794){if(_0x4ab8eb['body'][_0x78ed('0x73')]){_0x1095c7[_0x78ed('0x24')][_0x78ed('0x74')]=util[_0x78ed('0x64')](_0x78ed('0x75'),_0x4ab8eb[_0x78ed('0x5d')][_0x78ed('0x35')]);_0x1095c7[_0x78ed('0x24')][_0x78ed('0x76')]=_0x1095c7['channel'];_0x1095c7['message'][_0x78ed('0x77')]=_0x1095c7[_0x78ed('0x76')];_0x1095c7[_0x78ed('0x24')][_0x78ed('0x78')]=_0x78ed('0x58');return respondWithRpcPromise(_0x78ed('0x79'),_0x78ed('0x79'),{'event':'acceptmessage','message':_0x1095c7[_0x78ed('0x24')]},client9002)[_0x78ed('0x1c')](function(){return _0x1095c7;});}return _0x1095c7;}return null;})[_0x78ed('0x1c')](respondWithResult(_0x3f62b0,null))[_0x78ed('0x26')](handleError(_0x3f62b0,null));};var interaction_log=require(_0x78ed('0x12'))('sms-interactions');exports['reject']=function(_0x19ee8d,_0x118d2b,_0x413d2c){var _0x4b8f41={'agent':{},'channel':_0x78ed('0x7a')};if(_0x19ee8d[_0x78ed('0x55')]['id']){delete _0x19ee8d[_0x78ed('0x55')]['id'];}_0x19ee8d[_0x78ed('0x55')][_0x78ed('0x5c')]=_0x19ee8d[_0x78ed('0x55')]['UserId']||_0x19ee8d[_0x78ed('0x5d')]['id'];_0x4b8f41[_0x78ed('0x5e')]['id']=_0x19ee8d[_0x78ed('0x55')]['UserId'];return db[_0x78ed('0x38')]['find']({'where':{'id':_0x19ee8d[_0x78ed('0x5f')]['id'],'UserId':null}})[_0x78ed('0x1c')](handleEntityNotFound(_0x118d2b,null))[_0x78ed('0x1c')](function(_0x28a197){if(_0x28a197){_0x4b8f41['message']=_0x28a197[_0x78ed('0x60')]({'plain':!![]});return db[_0x78ed('0x61')][_0x78ed('0x53')]({'where':{'id':_0x28a197['SmsInteractionId']}});}return null;})[_0x78ed('0x1c')](handleEntityNotFound(_0x118d2b,null))[_0x78ed('0x1c')](function(_0x398b51){if(_0x398b51){_0x4b8f41[_0x78ed('0x67')]=_0x398b51[_0x78ed('0x60')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x19ee8d[_0x78ed('0x5d')]['id'],_0x19ee8d[_0x78ed('0x5d')][_0x78ed('0x35')],_0x19ee8d[_0x78ed('0x5d')][_0x78ed('0x66')],_0x4b8f41[_0x78ed('0x67')]['id'],_0x19ee8d[_0x78ed('0x55')]?JSON[_0x78ed('0x21')](_0x19ee8d[_0x78ed('0x55')]):_0x78ed('0x68'));return respondWithRpcPromise(_0x78ed('0x7b'),_0x78ed('0x7c'),_0x4b8f41);}return null;})[_0x78ed('0x1c')](function(_0x520663){var _0x4819f3=_0x78ed('0x6a')+_0x520663[_0x78ed('0x24')]['ContactId'];return db[_0x78ed('0x6b')][_0x78ed('0x40')](_0x4819f3,{'type':db[_0x78ed('0x6c')][_0x78ed('0x6d')]['SELECT'],'raw':!![]})[_0x78ed('0x1c')](function(_0x294974){return _0x294974;});})[_0x78ed('0x1c')](function(_0x5a096f){if(_0x5a096f){_0x4b8f41['message'][_0x78ed('0x6f')]=_0x5a096f[0x0];if(!_0x19ee8d[_0x78ed('0x55')][_0x78ed('0x5c')])return;return db['User'][_0x78ed('0x53')]({'where':{'id':_0x19ee8d[_0x78ed('0x55')]['UserId'],'role':_0x78ed('0x5e')},'attributes':['id',_0x78ed('0x35'),_0x78ed('0x7d'),_0x78ed('0x71'),_0x78ed('0x72')],'raw':!![]});}return null;})[_0x78ed('0x1c')](function(_0x4e7c85){if(!_0x4e7c85)return null;_0x4b8f41[_0x78ed('0x24')][_0x78ed('0x5e')]=_0x4e7c85;return _0x4b8f41;})[_0x78ed('0x1c')](function(_0x2e9c9a){if(_0x2e9c9a){_0x2e9c9a['message']['interface']=util['format'](_0x78ed('0x75'),_0x19ee8d['user'][_0x78ed('0x35')]);_0x2e9c9a[_0x78ed('0x24')][_0x78ed('0x76')]=_0x4b8f41['channel'];_0x2e9c9a[_0x78ed('0x24')][_0x78ed('0x77')]=_0x4b8f41['channel'];_0x2e9c9a[_0x78ed('0x24')][_0x78ed('0x78')]=_0x78ed('0x31');respondWithRpcPromise('EventManager','EventManager',{'event':_0x78ed('0x7e'),'message':_0x2e9c9a[_0x78ed('0x24')]},client9002);return _0x4b8f41;}return null;})[_0x78ed('0x1c')](respondWithResult(_0x118d2b,null))[_0x78ed('0x26')](handleError(_0x118d2b,null));};exports['status']=function(_0xd32472,_0x4859a1,_0x5da3e1){if(_0xd32472[_0x78ed('0x55')]['id']){delete _0xd32472[_0x78ed('0x55')]['id'];}var _0x305e8b;return db[_0x78ed('0x38')]['find']({'where':{'id':_0xd32472[_0x78ed('0x5f')]['id']}})[_0x78ed('0x1c')](handleEntityNotFound(_0x4859a1,null))['then'](function(_0x4fba55){if(_0x4fba55){_0x305e8b=_0x4fba55;return db['SmsAccount'][_0x78ed('0x53')]({'where':{'id':_0x4fba55['SmsAccountId']}});}})[_0x78ed('0x1c')](handleEntityNotFound(_0x4859a1,null))[_0x78ed('0x1c')](function(_0x199174){if(_0x199174){logger[_0x78ed('0x7f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x78ed('0x29'),'received\x20delivery\x20report\x20from',_0x199174[_0x78ed('0x3b')],util[_0x78ed('0x80')](_0xd32472[_0x78ed('0x55')],{'showHidden':![],'depth':null}));switch(_0x199174[_0x78ed('0x3b')]){case _0x78ed('0x81'):if(_0xd32472['body'][_0x78ed('0x82')]&&_0xd32472[_0x78ed('0x55')][_0x78ed('0x82')]===_0x305e8b['messageId']){return _0x305e8b['update']({'read':!![]});}else{logger['error'](_0x78ed('0x83'),_0x78ed('0x29'),_0x78ed('0x81'),util[_0x78ed('0x80')](_0xd32472[_0x78ed('0x55')],{'showHidden':![],'depth':null}));}break;case _0x78ed('0x84'):if(_0xd32472['body'][_0x78ed('0x85')]&&_0xd32472['body'][_0x78ed('0x85')]===_0x305e8b[_0x78ed('0x86')]&&_[_0x78ed('0x87')]([_0x78ed('0x88'),_0x78ed('0x89')],_0xd32472[_0x78ed('0x55')][_0x78ed('0x8a')])>=0x0){return _0x305e8b[_0x78ed('0x32')]({'read':!![]});}else{logger[_0x78ed('0x22')](_0x78ed('0x83'),_0x78ed('0x29'),_0x78ed('0x8b'),util[_0x78ed('0x80')](_0xd32472[_0x78ed('0x55')],{'showHidden':![],'depth':null}));}break;case _0x78ed('0x8c'):var _0x5c1b67=_0xd32472['body'][_0x78ed('0x8d')][0x0];if(_0x5c1b67[_0x78ed('0x29')]['groupName']===_0x78ed('0x8e')){return _0x305e8b[_0x78ed('0x32')]({'read':!![]});}else{logger[_0x78ed('0x22')](_0x78ed('0x83'),'status',_0x78ed('0x8c'),util['inspect'](_0xd32472[_0x78ed('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x305e8b;}})[_0x78ed('0x1c')](respondWithResult(_0x4859a1,null))[_0x78ed('0x26')](handleError(_0x4859a1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d7a08f1..c1c9069 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 _0x95a6=['hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x13cb09,_0x2516f4){var _0x5a04af=function(_0x37e1f9){while(--_0x37e1f9){_0x13cb09['push'](_0x13cb09['shift']());}};_0x5a04af(++_0x2516f4);}(_0x95a6,0x1a9));var _0x695a=function(_0x335619,_0x2a0531){_0x335619=_0x335619-0x0;var _0x5f32bf=_0x95a6[_0x335619];return _0x5f32bf;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x695a('0x0'))['db'][_0x695a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x695a('0x2')](0x0);var events={'afterCreate':_0x695a('0x3'),'afterUpdate':_0x695a('0x4'),'afterDestroy':_0x695a('0x5')};function emitEvent(_0x2cfd26){return function(_0x5573e1,_0x144cb9,_0x4b22d2){SmsMessageEvents['emit'](_0x2cfd26+':'+_0x5573e1['id'],_0x5573e1);SmsMessageEvents[_0x695a('0x6')](_0x2cfd26,_0x5573e1);_0x4b22d2(null);};}for(var e in events){if(events[_0x695a('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x695a('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x8289=['emit','hasOwnProperty','exports','events','SmsMessage','save','update','remove'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x8289,0x1db));var _0x9828=function(_0x528e95,_0x3a2de6){_0x528e95=_0x528e95-0x0;var _0x22a509=_0x8289[_0x528e95];return _0x22a509;};'use strict';var EventEmitter=require(_0x9828('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x9828('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9828('0x2'),'afterUpdate':_0x9828('0x3'),'afterDestroy':_0x9828('0x4')};function emitEvent(_0x2fa85c){return function(_0x407b7c,_0x4b102a,_0x1069a1){SmsMessageEvents[_0x9828('0x5')](_0x2fa85c+':'+_0x407b7c['id'],_0x407b7c);SmsMessageEvents['emit'](_0x2fa85c,_0x407b7c);_0x1069a1(null);};}for(var e in events){if(events[_0x9828('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x9828('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 94712db..aa19d51 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 _0xf19a=['../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','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','phone','smsMethod','sender','login?username=','username','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','connectel','senderString','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','%s:%s','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','apiKey','createHash','md5','digest','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x41b425,_0x5ebf84){var _0x46ce98=function(_0x3eb769){while(--_0x3eb769){_0x41b425['push'](_0x41b425['shift']());}};_0x46ce98(++_0x5ebf84);}(_0xf19a,0x76));var _0xaf19=function(_0xb746a4,_0x355bdc){_0xb746a4=_0xb746a4-0x0;var _0x4b6a58=_0xf19a[_0xb746a4];return _0x4b6a58;};'use strict';var _=require(_0xaf19('0x0'));var util=require(_0xaf19('0x1'));var logger=require(_0xaf19('0x2'))('api');var moment=require(_0xaf19('0x3'));var BPromise=require(_0xaf19('0x4'));var rp=require(_0xaf19('0x5'));var fs=require('fs');var path=require(_0xaf19('0x6'));var rimraf=require(_0xaf19('0x7'));var config=require(_0xaf19('0x8'));var attributes=require(_0xaf19('0x9'));module['exports']=function(_0x57241c,_0x11fd18){return _0x57241c['define'](_0xaf19('0xa'),attributes,{'tableName':_0xaf19('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xaf19('0xc')]},{'name':_0xaf19('0xd'),'fields':[_0xaf19('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d2a13,_0x5cd12a,_0xec1268){var _0x338fc2=_0x57241c[_0xaf19('0xf')];var _0x2e8f8e=_0x4d2a13[_0xaf19('0x10')]({'plain':!![]});if(_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()==='in'||_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()===_0xaf19('0x13')&&!_0x2e8f8e[_0xaf19('0x14')]&&!_[_0xaf19('0x15')](_0x2e8f8e[_0xaf19('0x16')])&&!_[_0xaf19('0x15')](_0x2e8f8e['SmsInteractionId'])){_0x338fc2[_0xaf19('0x17')][_0xaf19('0x18')]({'where':{'id':_0x2e8f8e['SmsInteractionId']}})[_0xaf19('0x19')](function(_0x5b3cad){if(_0x5b3cad){_0x5b3cad[_0xaf19('0x1a')]({'lastMsgAt':_0x2e8f8e[_0xaf19('0x1b')],'lastMsgDirection':_0x2e8f8e[_0xaf19('0x11')][_0xaf19('0x12')]()});}})[_0xaf19('0x1c')](function(_0x194161){console[_0xaf19('0x1d')](_0x194161);});}if(_0x2e8f8e[_0xaf19('0x11')]===_0xaf19('0x13')&&!_0x2e8f8e[_0xaf19('0x14')]){var _0x19cd2f;_0x338fc2['SmsAccount'][_0xaf19('0x1e')]({'where':{'id':_0x2e8f8e[_0xaf19('0x1f')]},'raw':!![]})[_0xaf19('0x19')](function(_0x110ec3){_0x19cd2f=_0x110ec3;if(_0x19cd2f&&_0x19cd2f[_0xaf19('0x20')]){switch(_0x19cd2f[_0xaf19('0x20')]){case _0xaf19('0x21'):var _0x18814f=require(_0xaf19('0x21'));if(_0x19cd2f[_0xaf19('0x22')]&&_0x19cd2f[_0xaf19('0x23')]&&_0x19cd2f['phone']){var _0x3d3ac3=new _0x18814f(_0x19cd2f[_0xaf19('0x22')],_0x19cd2f[_0xaf19('0x23')]);_0x3d3ac3[_0xaf19('0x24')][_0xaf19('0x25')]({'body':_0x2e8f8e[_0xaf19('0xe')],'to':_0x2e8f8e['phone'],'from':_0x19cd2f['phone'],'statusCallback':_0x19cd2f['remote']+_0xaf19('0x26')+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f[_0xaf19('0x28')]})['then'](function(_0x3fcf66){if(_0x3fcf66[_0xaf19('0x29')]){return _0x4d2a13[_0xaf19('0x1a')]({'messageId':_0x3fcf66[_0xaf19('0x29')]});}})[_0xaf19('0x1c')](function(_0x1399e4){logger[_0xaf19('0x1d')](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x21'),util[_0xaf19('0x2b')](_0x1399e4,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x21'),_0xaf19('0x2d'));}break;case _0xaf19('0x2e'):var _0x4a44f2=_0xaf19('0x2f');if(_0x19cd2f['username']&&_0x19cd2f[_0xaf19('0x30')]){var _0x2a0f47={'recipient':[_0x2e8f8e[_0xaf19('0x31')]],'message':_0x2e8f8e[_0xaf19('0xe')],'message_type':_0x19cd2f['smsMethod']};if(_0x19cd2f[_0xaf19('0x32')]&&_0x19cd2f[_0xaf19('0x32')]!=='SI'){_0x2a0f47[_0xaf19('0x33')]=_0x19cd2f[_0xaf19('0x31')];}var _0x3dea34={'url':_0x4a44f2+_0xaf19('0x34')+_0x19cd2f[_0xaf19('0x35')]+_0xaf19('0x36')+_0x19cd2f[_0xaf19('0x30')],'method':'GET'};rp(_0x3dea34)['then'](function(_0x5a5bf2){var _0x2e9477=_0x5a5bf2[_0xaf19('0x37')](';');var _0x1a35b6={'user_key':_0x2e9477[0x0],'session_key':_0x2e9477[0x1]};_0x3dea34={'url':_0x4a44f2+_0xaf19('0x38'),'method':_0xaf19('0x39'),'headers':{'user_key':_0x1a35b6['user_key'],'Session_key':_0x1a35b6[_0xaf19('0x3a')]},'json':!![],'body':_0x2a0f47};return rp(_0x3dea34);})[_0xaf19('0x19')](function(_0x480cc9){if(_0x480cc9[_0xaf19('0x3b')]>=0x1){var _0x56ebb5={'messageId':_0x480cc9[_0xaf19('0x3c')]};if(_0x19cd2f[_0xaf19('0x32')]!=='GP'||!_0x19cd2f[_0xaf19('0x3d')]){_0x56ebb5['read']=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x56ebb5);}else{return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),'skebby',util['inspect'](_0x480cc9,{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x37bb50){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x2e'),util[_0xaf19('0x2b')](_0x37bb50,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xaf19('0x3e'):if(_0x19cd2f['authToken']){var _0x19847b={'recipient':_0x2e8f8e[_0xaf19('0x31')],'message':_0x2e8f8e[_0xaf19('0xe')],'sender':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')],'authorization':_0x19cd2f[_0xaf19('0x23')]};var _0x5cd12a={'method':_0xaf19('0x39'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x19847b,'json':!![]};rp(_0x5cd12a)[_0xaf19('0x19')](function(_0x5c7de9){var _0x36120c={'messageId':_0x5c7de9[_0xaf19('0x40')]};if(!_0x19cd2f['deliveryReport']){_0x36120c[_0xaf19('0x41')]=!![];}return _0x4d2a13['update'](_0x36120c);})[_0xaf19('0x1c')](function(_0x1cb7fd){logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x3e'),util[_0xaf19('0x2b')](_0x1cb7fd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x3e'),_0xaf19('0x42'));}break;case _0xaf19('0x43'):if(_0x19cd2f['username']&&_0x19cd2f[_0xaf19('0x30')]){var _0x19847b={'messages':[{'source':_0xaf19('0x44'),'to':_0x2e8f8e[_0xaf19('0x31')],'body':_0x2e8f8e[_0xaf19('0xe')],'from':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')]}]};var _0x5168ac=util['format']('%s:%s',_0x19cd2f['username'],_0x19cd2f[_0xaf19('0x30')]);var _0x5cd12a={'method':'POST','uri':_0xaf19('0x45'),'body':_0x19847b,'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)['then'](function(_0x83ebd7){if(_0x83ebd7['http_code']>=0xc8&&_0x83ebd7[_0xaf19('0x4a')]<=0xce){if(_0x83ebd7['data']&&_0x83ebd7['data'][_0xaf19('0x4b')]>0x0){var _0x5e9641=_[_0xaf19('0x4c')](_0x83ebd7['data'][_0xaf19('0x24')]);var _0x446d50={'messageId':_0x5e9641[_0xaf19('0x4d')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x446d50[_0xaf19('0x41')]=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x446d50);}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x4e'),util[_0xaf19('0x2b')](_0x83ebd7,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x4e'),util[_0xaf19('0x2b')](_0x83ebd7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x497ea2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x4e'),util['inspect'](_0x497ea2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x4e'),_0xaf19('0x4f'));}break;case'plivo':if(_0x19cd2f['authId']&&_0x19cd2f[_0xaf19('0x23')]){var _0x19847b={'dst':_0x2e8f8e[_0xaf19('0x31')],'text':_0x2e8f8e[_0xaf19('0xe')],'src':_0x19cd2f[_0xaf19('0x3f')]||_0x19cd2f[_0xaf19('0x31')],'url':_0x19cd2f['remote']+_0xaf19('0x26')+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f['token']};var _0x5168ac=util['format'](_0xaf19('0x50'),_0x19cd2f[_0xaf19('0x51')],_0x19cd2f['authToken']);var _0x5cd12a={'method':_0xaf19('0x39'),'uri':util[_0xaf19('0x46')](_0xaf19('0x52'),_0x19cd2f['authId']),'body':_0x19847b,'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)['then'](function(_0x4e7988){var _0x5ef6b0={'messageId':_0x4e7988[_0xaf19('0x53')][0x0]};return _0x4d2a13[_0xaf19('0x1a')](_0x5ef6b0);})['catch'](function(_0x28b44f){logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x54'),util[_0xaf19('0x2b')](_0x28b44f,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),'afterCreate',_0xaf19('0x54'),_0xaf19('0x55'));}break;case _0xaf19('0x56'):if(_0x19cd2f[_0xaf19('0x35')]&&_0x19cd2f['password']){if(_0x19cd2f[_0xaf19('0x57')]){var _0x115a69={'method':_0xaf19('0x39'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x58'),'body':{'username':_0x19cd2f[_0xaf19('0x35')],'password':_0x19cd2f[_0xaf19('0x30')]},'json':!![]};return rp(_0x115a69)[_0xaf19('0x19')](function(_0x345492){var _0x58a70b={'method':_0xaf19('0x39'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x59'),'body':{'messages':[{'from':_0x19cd2f[_0xaf19('0x31')],'destinations':[{'to':_0x2e8f8e['phone']}],'text':_0x2e8f8e['body'],'notifyUrl':_0x19cd2f[_0xaf19('0x5a')]+'/api/sms/messages/'+_0x2e8f8e['id']+_0xaf19('0x27')+_0x19cd2f['token'],'notifyContentType':'application/json','callbackData':_0x19cd2f[_0xaf19('0x31')]+';'+_0x2e8f8e[_0xaf19('0xe')]}]},'headers':{'Authorization':_0xaf19('0x5b')+_0x345492['token']},'json':!![]};return rp(_0x58a70b)['then'](function(_0x246670){if(_0x246670[_0xaf19('0x24')]){var _0x262501={'messageId':_0x246670['messages'][0x0][_0xaf19('0xc')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x262501[_0xaf19('0x41')]=!![];}return _0x4d2a13['update'](_0x262501);}else{return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x56'),util[_0xaf19('0x2b')](_0x246670,{'showHidden':![],'depth':null}));}});})[_0xaf19('0x1c')](function(_0x2308cb){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),util['inspect'](_0x2308cb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),_0xaf19('0x5c'));}}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x56'),_0xaf19('0x4f'));}break;case _0xaf19('0x5d'):var _0x5a6758=require(_0xaf19('0x5e'));if(_0x19cd2f['apiKey']){var _0x410810={};_0x410810[_0xaf19('0x5f')]=_0x19cd2f[_0xaf19('0x35')];_0x410810['phone']=_0x2e8f8e[_0xaf19('0x31')];_0x410810['sender']=_0x19cd2f[_0xaf19('0x31')];_0x410810[_0xaf19('0x60')]=_0x2e8f8e[_0xaf19('0xe')];_0x410810[_0xaf19('0x61')]=+new Date();var _0x13667d='';var _0x38755b='';var _0x306e69=Object[_0xaf19('0x62')](_0x410810);_0x306e69['sort']();for(var _0x329e9d=0x0;_0x329e9d<_0x306e69['length'];_0x329e9d++){if(_0x13667d!=''){_0x13667d+='&';}_0x13667d+=_0x306e69[_0x329e9d]+'='+encodeURIComponent(_0x410810[_0x306e69[_0x329e9d]]);_0x38755b+=_0x410810[_0x306e69[_0x329e9d]];}_0x38755b+=_0x19cd2f[_0xaf19('0x63')];_0x38755b=_0x5a6758[_0xaf19('0x64')](_0xaf19('0x65'))[_0xaf19('0x1a')](_0x38755b)[_0xaf19('0x66')]('hex');if(_0x13667d!==''){_0x13667d+='&';}_0x13667d+=_0xaf19('0x67')+_0x38755b;var _0x3dea34={'method':_0xaf19('0x68'),'uri':_0x19cd2f[_0xaf19('0x57')]+_0xaf19('0x69')+_0x13667d,'json':!![]};return rp(_0x3dea34)[_0xaf19('0x19')](function(_0x528541){var _0xa89ca6=Object[_0xaf19('0x62')](_0x528541);if(_0x528541[_0xa89ca6[0x0]][_0xaf19('0x1d')]&&parseInt(_0x528541[_0xa89ca6[0x0]][_0xaf19('0x1d')])===0x0){var _0x1f0357={'messageId':_0x528541[_0xa89ca6[0x0]][_0xaf19('0x6a')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x1f0357[_0xaf19('0x41')]=!![];}return _0x4d2a13[_0xaf19('0x1a')](_0x1f0357);}else{return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x5d'),util[_0xaf19('0x2b')](_0x528541[_0xaf19('0x1d')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x79cad9){return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x5d'),util[_0xaf19('0x2b')](_0x79cad9,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x5d'),_0xaf19('0x6b'));}break;case _0xaf19('0x6c'):if(_0x19cd2f['apiKey']){var _0x33f660={'method':'POST','uri':_0xaf19('0x6d'),'headers':{'Authorization':_0x19cd2f[_0xaf19('0x63')]},'body':{'content':_0x2e8f8e[_0xaf19('0xe')],'to':[_0x2e8f8e[_0xaf19('0x31')]],'from':_0x19cd2f[_0xaf19('0x31')],'binary':![],'clientMessageId':_0xaf19('0x6e'),'charset':_0xaf19('0x6f')},'json':!![]};rp(_0x33f660)[_0xaf19('0x19')](function(_0x289b89){if(!_0x289b89[_0xaf19('0x1d')]){var _0x70f975={'messageId':_0x289b89['messages'][0x0][_0xaf19('0x70')]};if(!_0x19cd2f[_0xaf19('0x3d')]){_0x70f975['read']=!![];}return _0x4d2a13['update'](_0x70f975);}else{return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x6c'),util[_0xaf19('0x2b')](_0x289b89[_0xaf19('0x1d')],{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x1b3619){return logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x6c'),util['inspect'](_0x1b3619,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),'clickatell',_0xaf19('0x6b'));}break;case _0xaf19('0x71'):if(_0x19cd2f[_0xaf19('0x35')]&&_0x19cd2f[_0xaf19('0x30')]){var _0x5168ac=util[_0xaf19('0x46')](_0xaf19('0x50'),_0x19cd2f[_0xaf19('0x35')],_0x19cd2f[_0xaf19('0x30')]);var _0x5cd12a={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x19cd2f[_0xaf19('0x72')]+_0xaf19('0x73'),'body':{'to':[_0x2e8f8e[_0xaf19('0x31')]],'text':_0x2e8f8e[_0xaf19('0xe')],'from':_0x19cd2f[_0xaf19('0x31')],'applicationId':_0x19cd2f[_0xaf19('0x74')]},'headers':{'Authorization':util[_0xaf19('0x46')](_0xaf19('0x47'),new Buffer(_0x5168ac)[_0xaf19('0x48')](_0xaf19('0x49')))},'json':!![]};rp(_0x5cd12a)[_0xaf19('0x19')](function(_0x9fd17d){if(_0x9fd17d['id']){var _0x26dcd8={'messageId':_0x9fd17d['id']};return _0x4d2a13[_0xaf19('0x1a')](_0x26dcd8);}else{logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),'bandwidth',util['inspect'](_0x9fd17d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x30bd79){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),'bandwidth',util[_0xaf19('0x2b')](_0x30bd79,{'showHidden':![],'depth':null}));});}else{logger[_0xaf19('0x1d')](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x71'),_0xaf19('0x4f'));}break;case _0xaf19('0x75'):if(_0x19cd2f[_0xaf19('0x63')]){var _0x2e4273={};var _0x3dea34={'method':'POST','uri':_0xaf19('0x76'),'headers':{'Authorization':_0xaf19('0x77')+_0x19cd2f[_0xaf19('0x63')],'Content-Type':_0xaf19('0x78')},'body':{'from':_0x19cd2f[_0xaf19('0x31')],'to':_0x2e8f8e[_0xaf19('0x31')],'text':_0x2e8f8e[_0xaf19('0xe')]},'json':!![]};return rp(_0x3dea34)[_0xaf19('0x19')](function(_0x4f300a){if(_0x4f300a['code']==0xca){_0x2e4273[_0xaf19('0x79')]=_0x4f300a;var _0x306a77={'method':_0xaf19('0x39'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xaf19('0x77')+_0x19cd2f[_0xaf19('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x2e4273['message'][_0xaf19('0x7a')]},'json':!![]};return rp(_0x306a77)[_0xaf19('0x19')](function(_0x2c0f17){_0x2e4273['status']=_0x2c0f17;var _0x113561={'messageId':_0x2e4273['message']['refid'],'read':!![]};return _0x4d2a13[_0xaf19('0x1a')](_0x113561);});}else{return logger['error'](_0xaf19('0x2a'),_0xaf19('0x2c'),_0xaf19('0x75'),util[_0xaf19('0x2b')](_0x4f300a,{'showHidden':![],'depth':null}));}})[_0xaf19('0x1c')](function(_0x4e16d8){return logger[_0xaf19('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x75'),util[_0xaf19('0x2b')](_0x4e16d8,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xaf19('0x2c'),_0xaf19('0x75'),_0xaf19('0x7b'));}break;}}})['finally'](function(){_0xec1268();});}else{_0xec1268();}}},'charset':_0xaf19('0x7c'),'collate':_0xaf19('0x7d')});}; \ No newline at end of file +var _0x4637=['../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','direction','isNil','SmsInteractionId','findOne','then','createdAt','catch','out','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','create','remote','/api/sms/messages/','/status?token=','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','POST','total_sent','internal_order_id','read','update','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','messages','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','token','application/json','IBSSO\x20','csc','crypto','apiKey','text','timestamp','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','clickatell','bandwidth','%s:%s','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x175cb1,_0x1d43e4){var _0x36134c=function(_0x47f11b){while(--_0x47f11b){_0x175cb1['push'](_0x175cb1['shift']());}};_0x36134c(++_0x1d43e4);}(_0x4637,0x71));var _0x7463=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4637[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x7463('0x0'));var util=require(_0x7463('0x1'));var logger=require('../../config/logger')(_0x7463('0x2'));var moment=require(_0x7463('0x3'));var BPromise=require(_0x7463('0x4'));var rp=require(_0x7463('0x5'));var fs=require('fs');var path=require(_0x7463('0x6'));var rimraf=require('rimraf');var config=require(_0x7463('0x7'));var attributes=require(_0x7463('0x8'));module[_0x7463('0x9')]=function(_0x219f78,_0x3d49c4){return _0x219f78[_0x7463('0xa')]('SmsMessage',attributes,{'tableName':_0x7463('0xb'),'paranoid':![],'indexes':[{'name':_0x7463('0xc'),'fields':['messageId']},{'name':_0x7463('0xd'),'fields':[_0x7463('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4157b1,_0xcaaa10,_0x512051){var _0x146c0e=_0x219f78[_0x7463('0xf')];var _0x214f1a=_0x4157b1[_0x7463('0x10')]({'plain':!![]});if(_0x214f1a['direction'][_0x7463('0x11')]()==='in'||_0x214f1a[_0x7463('0x12')]['toLowerCase']()==='out'&&!_0x214f1a['secret']&&!_[_0x7463('0x13')](_0x214f1a['UserId'])&&!_[_0x7463('0x13')](_0x214f1a[_0x7463('0x14')])){_0x146c0e['SmsInteraction'][_0x7463('0x15')]({'where':{'id':_0x214f1a['SmsInteractionId']}})[_0x7463('0x16')](function(_0x16b88e){if(_0x16b88e){_0x16b88e['update']({'lastMsgAt':_0x214f1a[_0x7463('0x17')],'lastMsgDirection':_0x214f1a[_0x7463('0x12')][_0x7463('0x11')]()});}})[_0x7463('0x18')](function(_0x4d547c){console['error'](_0x4d547c);});}if(_0x214f1a['direction']===_0x7463('0x19')&&!_0x214f1a[_0x7463('0x1a')]){var _0x1c17b2;_0x146c0e[_0x7463('0x1b')]['find']({'where':{'id':_0x214f1a[_0x7463('0x1c')]},'raw':!![]})[_0x7463('0x16')](function(_0x52ad50){_0x1c17b2=_0x52ad50;if(_0x1c17b2&&_0x1c17b2[_0x7463('0x1d')]){switch(_0x1c17b2[_0x7463('0x1d')]){case _0x7463('0x1e'):var _0x3630de=require(_0x7463('0x1e'));if(_0x1c17b2[_0x7463('0x1f')]&&_0x1c17b2['authToken']&&_0x1c17b2[_0x7463('0x20')]){var _0x4dd372=new _0x3630de(_0x1c17b2[_0x7463('0x1f')],_0x1c17b2[_0x7463('0x21')]);_0x4dd372['messages'][_0x7463('0x22')]({'body':_0x214f1a[_0x7463('0xe')],'to':_0x214f1a[_0x7463('0x20')],'from':_0x1c17b2[_0x7463('0x20')],'statusCallback':_0x1c17b2[_0x7463('0x23')]+_0x7463('0x24')+_0x214f1a['id']+_0x7463('0x25')+_0x1c17b2['token']})[_0x7463('0x16')](function(_0x4c9f70){if(_0x4c9f70[_0x7463('0x26')]){return _0x4157b1['update']({'messageId':_0x4c9f70['sid']});}})[_0x7463('0x18')](function(_0x5c9514){logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x1e'),util['inspect'](_0x5c9514,{'showHidden':![],'depth':null}));});}else{logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),'twilio',_0x7463('0x2a'));}break;case _0x7463('0x2b'):var _0x42c356=_0x7463('0x2c');if(_0x1c17b2[_0x7463('0x2d')]&&_0x1c17b2[_0x7463('0x2e')]){var _0x34e81={'recipient':[_0x214f1a[_0x7463('0x20')]],'message':_0x214f1a[_0x7463('0xe')],'message_type':_0x1c17b2['smsMethod']};if(_0x1c17b2['smsMethod']&&_0x1c17b2[_0x7463('0x2f')]!=='SI'){_0x34e81[_0x7463('0x30')]=_0x1c17b2['phone'];}var _0x5162b3={'url':_0x42c356+_0x7463('0x31')+_0x1c17b2[_0x7463('0x2d')]+_0x7463('0x32')+_0x1c17b2['password'],'method':_0x7463('0x33')};rp(_0x5162b3)[_0x7463('0x16')](function(_0x397abf){var _0x2cd3dd=_0x397abf['split'](';');var _0x4cb166={'user_key':_0x2cd3dd[0x0],'session_key':_0x2cd3dd[0x1]};_0x5162b3={'url':_0x42c356+_0x7463('0x34'),'method':_0x7463('0x35'),'headers':{'user_key':_0x4cb166['user_key'],'Session_key':_0x4cb166['session_key']},'json':!![],'body':_0x34e81};return rp(_0x5162b3);})['then'](function(_0x4cbb5c){if(_0x4cbb5c[_0x7463('0x36')]>=0x1){var _0x25533e={'messageId':_0x4cbb5c[_0x7463('0x37')]};if(_0x1c17b2[_0x7463('0x2f')]!=='GP'||!_0x1c17b2['deliveryReport']){_0x25533e[_0x7463('0x38')]=!![];}return _0x4157b1[_0x7463('0x39')](_0x25533e);}else{return logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x2b'),util[_0x7463('0x3a')](_0x4cbb5c,{'showHidden':![],'depth':null}));}})[_0x7463('0x18')](function(_0x26527e){return logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x2b'),util[_0x7463('0x3a')](_0x26527e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x2b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7463('0x3b'):if(_0x1c17b2[_0x7463('0x21')]){var _0x3f2f10={'recipient':_0x214f1a['phone'],'message':_0x214f1a[_0x7463('0xe')],'sender':_0x1c17b2[_0x7463('0x3c')]||_0x1c17b2[_0x7463('0x20')],'authorization':_0x1c17b2[_0x7463('0x21')]};var _0xcaaa10={'method':_0x7463('0x35'),'uri':_0x7463('0x3d'),'body':_0x3f2f10,'json':!![]};rp(_0xcaaa10)[_0x7463('0x16')](function(_0x455bdb){var _0x2e85c2={'messageId':_0x455bdb[_0x7463('0x3e')]};if(!_0x1c17b2[_0x7463('0x3f')]){_0x2e85c2[_0x7463('0x38')]=!![];}return _0x4157b1[_0x7463('0x39')](_0x2e85c2);})[_0x7463('0x18')](function(_0x2331c8){logger[_0x7463('0x27')](_0x7463('0x28'),'afterCreate',_0x7463('0x3b'),util['inspect'](_0x2331c8,{'showHidden':![],'depth':null}));});}else{logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x3b'),_0x7463('0x40'));}break;case'clicksend':if(_0x1c17b2[_0x7463('0x2d')]&&_0x1c17b2[_0x7463('0x2e')]){var _0x3f2f10={'messages':[{'source':_0x7463('0x41'),'to':_0x214f1a['phone'],'body':_0x214f1a[_0x7463('0xe')],'from':_0x1c17b2[_0x7463('0x3c')]||_0x1c17b2['phone']}]};var _0x10185e=util[_0x7463('0x42')]('%s:%s',_0x1c17b2[_0x7463('0x2d')],_0x1c17b2[_0x7463('0x2e')]);var _0xcaaa10={'method':_0x7463('0x35'),'uri':_0x7463('0x43'),'body':_0x3f2f10,'headers':{'Authorization':util[_0x7463('0x42')](_0x7463('0x44'),new Buffer(_0x10185e)[_0x7463('0x45')]('base64'))},'json':!![]};rp(_0xcaaa10)[_0x7463('0x16')](function(_0x3ba1c9){if(_0x3ba1c9['http_code']>=0xc8&&_0x3ba1c9[_0x7463('0x46')]<=0xce){if(_0x3ba1c9[_0x7463('0x47')]&&_0x3ba1c9[_0x7463('0x47')][_0x7463('0x48')]>0x0){var _0x66ab25=_[_0x7463('0x49')](_0x3ba1c9[_0x7463('0x47')][_0x7463('0x4a')]);var _0x1ba932={'messageId':_0x66ab25['message_id']};if(!_0x1c17b2[_0x7463('0x3f')]){_0x1ba932['read']=!![];}return _0x4157b1[_0x7463('0x39')](_0x1ba932);}else{logger['error'](_0x7463('0x28'),'afterCreate','clickSend',util[_0x7463('0x3a')](_0x3ba1c9,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x4b'),util[_0x7463('0x3a')](_0x3ba1c9,{'showHidden':![],'depth':null}));}})[_0x7463('0x18')](function(_0x46e583){logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x4b'),util[_0x7463('0x3a')](_0x46e583,{'showHidden':![],'depth':null}));});}else{logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x4b'),_0x7463('0x4c'));}break;case _0x7463('0x4d'):if(_0x1c17b2[_0x7463('0x4e')]&&_0x1c17b2[_0x7463('0x21')]){var _0x3f2f10={'dst':_0x214f1a['phone'],'text':_0x214f1a[_0x7463('0xe')],'src':_0x1c17b2[_0x7463('0x3c')]||_0x1c17b2[_0x7463('0x20')],'url':_0x1c17b2[_0x7463('0x23')]+'/api/sms/messages/'+_0x214f1a['id']+_0x7463('0x25')+_0x1c17b2['token']};var _0x10185e=util[_0x7463('0x42')]('%s:%s',_0x1c17b2[_0x7463('0x4e')],_0x1c17b2['authToken']);var _0xcaaa10={'method':_0x7463('0x35'),'uri':util[_0x7463('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x1c17b2[_0x7463('0x4e')]),'body':_0x3f2f10,'headers':{'Authorization':util[_0x7463('0x42')](_0x7463('0x44'),new Buffer(_0x10185e)['toString'](_0x7463('0x4f')))},'json':!![]};rp(_0xcaaa10)[_0x7463('0x16')](function(_0x304a00){var _0x341287={'messageId':_0x304a00[_0x7463('0x50')][0x0]};return _0x4157b1[_0x7463('0x39')](_0x341287);})[_0x7463('0x18')](function(_0x247ba6){logger[_0x7463('0x27')](_0x7463('0x28'),'afterCreate',_0x7463('0x4d'),util['inspect'](_0x247ba6,{'showHidden':![],'depth':null}));});}else{logger[_0x7463('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7463('0x4d'),_0x7463('0x51'));}break;case _0x7463('0x52'):if(_0x1c17b2['username']&&_0x1c17b2[_0x7463('0x2e')]){if(_0x1c17b2[_0x7463('0x53')]){var _0x2ccd89={'method':_0x7463('0x35'),'uri':_0x1c17b2[_0x7463('0x53')]+'/auth/1/session','body':{'username':_0x1c17b2[_0x7463('0x2d')],'password':_0x1c17b2[_0x7463('0x2e')]},'json':!![]};return rp(_0x2ccd89)[_0x7463('0x16')](function(_0xca0f90){var _0x577675={'method':_0x7463('0x35'),'uri':_0x1c17b2[_0x7463('0x53')]+_0x7463('0x54'),'body':{'messages':[{'from':_0x1c17b2[_0x7463('0x20')],'destinations':[{'to':_0x214f1a[_0x7463('0x20')]}],'text':_0x214f1a[_0x7463('0xe')],'notifyUrl':_0x1c17b2[_0x7463('0x23')]+'/api/sms/messages/'+_0x214f1a['id']+_0x7463('0x25')+_0x1c17b2[_0x7463('0x55')],'notifyContentType':_0x7463('0x56'),'callbackData':_0x1c17b2[_0x7463('0x20')]+';'+_0x214f1a['body']}]},'headers':{'Authorization':_0x7463('0x57')+_0xca0f90[_0x7463('0x55')]},'json':!![]};return rp(_0x577675)[_0x7463('0x16')](function(_0x5e65bd){if(_0x5e65bd['messages']){var _0x59f7e1={'messageId':_0x5e65bd[_0x7463('0x4a')][0x0][_0x7463('0xc')]};if(!_0x1c17b2[_0x7463('0x3f')]){_0x59f7e1[_0x7463('0x38')]=!![];}return _0x4157b1['update'](_0x59f7e1);}else{return logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x52'),util[_0x7463('0x3a')](_0x5e65bd,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5b557e){return logger[_0x7463('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7463('0x52'),util[_0x7463('0x3a')](_0x5b557e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x7463('0x28'),'afterCreate','infobip',_0x7463('0x4c'));}break;case _0x7463('0x58'):var _0x5f1d47=require(_0x7463('0x59'));if(_0x1c17b2[_0x7463('0x5a')]){var _0x525c57={};_0x525c57['login']=_0x1c17b2[_0x7463('0x2d')];_0x525c57['phone']=_0x214f1a[_0x7463('0x20')];_0x525c57[_0x7463('0x30')]=_0x1c17b2[_0x7463('0x20')];_0x525c57[_0x7463('0x5b')]=_0x214f1a[_0x7463('0xe')];_0x525c57[_0x7463('0x5c')]=+new Date();var _0x1eaf0d='';var _0x1fea72='';var _0x68e0cc=Object['keys'](_0x525c57);_0x68e0cc['sort']();for(var _0x3a5751=0x0;_0x3a5751<_0x68e0cc[_0x7463('0x5d')];_0x3a5751++){if(_0x1eaf0d!=''){_0x1eaf0d+='&';}_0x1eaf0d+=_0x68e0cc[_0x3a5751]+'='+encodeURIComponent(_0x525c57[_0x68e0cc[_0x3a5751]]);_0x1fea72+=_0x525c57[_0x68e0cc[_0x3a5751]];}_0x1fea72+=_0x1c17b2[_0x7463('0x5a')];_0x1fea72=_0x5f1d47[_0x7463('0x5e')](_0x7463('0x5f'))['update'](_0x1fea72)[_0x7463('0x60')](_0x7463('0x61'));if(_0x1eaf0d!==''){_0x1eaf0d+='&';}_0x1eaf0d+=_0x7463('0x62')+_0x1fea72;var _0x5162b3={'method':_0x7463('0x33'),'uri':_0x1c17b2[_0x7463('0x53')]+_0x7463('0x63')+_0x1eaf0d,'json':!![]};return rp(_0x5162b3)[_0x7463('0x16')](function(_0x27d169){var _0x32b765=Object['keys'](_0x27d169);if(_0x27d169[_0x32b765[0x0]]['error']&&parseInt(_0x27d169[_0x32b765[0x0]][_0x7463('0x27')])===0x0){var _0xe50c67={'messageId':_0x27d169[_0x32b765[0x0]]['id_sms']};if(!_0x1c17b2['deliveryReport']){_0xe50c67[_0x7463('0x38')]=!![];}return _0x4157b1[_0x7463('0x39')](_0xe50c67);}else{return logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x58'),util[_0x7463('0x3a')](_0x27d169[_0x7463('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x519431){return logger[_0x7463('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7463('0x29'),'csc',util['inspect'](_0x519431,{'showHidden':![],'depth':null}));});}else{logger[_0x7463('0x27')](_0x7463('0x28'),'afterCreate',_0x7463('0x58'),_0x7463('0x64'));}break;case'clickatell':if(_0x1c17b2[_0x7463('0x5a')]){var _0x4a8947={'method':_0x7463('0x35'),'uri':_0x7463('0x65'),'headers':{'Authorization':_0x1c17b2['apiKey']},'body':{'content':_0x214f1a[_0x7463('0xe')],'to':[_0x214f1a[_0x7463('0x20')]],'from':_0x1c17b2[_0x7463('0x20')],'binary':![],'clientMessageId':_0x7463('0x66'),'charset':_0x7463('0x67')},'json':!![]};rp(_0x4a8947)[_0x7463('0x16')](function(_0x12fc25){if(!_0x12fc25[_0x7463('0x27')]){var _0x5ac93f={'messageId':_0x12fc25[_0x7463('0x4a')][0x0]['apiMessageId']};if(!_0x1c17b2[_0x7463('0x3f')]){_0x5ac93f[_0x7463('0x38')]=!![];}return _0x4157b1[_0x7463('0x39')](_0x5ac93f);}else{return logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x68'),util[_0x7463('0x3a')](_0x12fc25[_0x7463('0x27')],{'showHidden':![],'depth':null}));}})[_0x7463('0x18')](function(_0x12af90){return logger[_0x7463('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7463('0x29'),'clickatell',util[_0x7463('0x3a')](_0x12af90,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x68'),_0x7463('0x64'));}break;case _0x7463('0x69'):if(_0x1c17b2[_0x7463('0x2d')]&&_0x1c17b2[_0x7463('0x2e')]){var _0x10185e=util[_0x7463('0x42')](_0x7463('0x6a'),_0x1c17b2[_0x7463('0x2d')],_0x1c17b2[_0x7463('0x2e')]);var _0xcaaa10={'method':_0x7463('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1c17b2[_0x7463('0x6b')]+'/messages','body':{'to':[_0x214f1a[_0x7463('0x20')]],'text':_0x214f1a[_0x7463('0xe')],'from':_0x1c17b2[_0x7463('0x20')],'applicationId':_0x1c17b2[_0x7463('0x6c')]},'headers':{'Authorization':util[_0x7463('0x42')](_0x7463('0x44'),new Buffer(_0x10185e)[_0x7463('0x45')]('base64'))},'json':!![]};rp(_0xcaaa10)[_0x7463('0x16')](function(_0x1b7f46){if(_0x1b7f46['id']){var _0x3c39eb={'messageId':_0x1b7f46['id']};return _0x4157b1[_0x7463('0x39')](_0x3c39eb);}else{logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x69'),util[_0x7463('0x3a')](_0x1b7f46,{'showHidden':![],'depth':null}));}})[_0x7463('0x18')](function(_0x29e599){logger[_0x7463('0x27')](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x69'),util[_0x7463('0x3a')](_0x29e599,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7463('0x28'),'afterCreate',_0x7463('0x69'),_0x7463('0x4c'));}break;case _0x7463('0x6d'):if(_0x1c17b2['apiKey']){var _0x23e28a={};var _0x5162b3={'method':_0x7463('0x35'),'uri':_0x7463('0x6e'),'headers':{'Authorization':_0x7463('0x6f')+_0x1c17b2[_0x7463('0x5a')],'Content-Type':_0x7463('0x56')},'body':{'from':_0x1c17b2[_0x7463('0x20')],'to':_0x214f1a['phone'],'text':_0x214f1a['body']},'json':!![]};return rp(_0x5162b3)[_0x7463('0x16')](function(_0x23f00a){if(_0x23f00a['code']==0xca){_0x23e28a[_0x7463('0x70')]=_0x23f00a;var _0x299521={'method':'POST','uri':_0x7463('0x71'),'headers':{'Authorization':_0x7463('0x6f')+_0x1c17b2[_0x7463('0x5a')],'Content-Type':'application/json'},'body':{'refid':_0x23e28a['message'][_0x7463('0x72')]},'json':!![]};return rp(_0x299521)['then'](function(_0x2235b6){_0x23e28a[_0x7463('0x73')]=_0x2235b6;var _0x2df322={'messageId':_0x23e28a[_0x7463('0x70')][_0x7463('0x72')],'read':!![]};return _0x4157b1['update'](_0x2df322);});}else{return logger['error'](_0x7463('0x28'),_0x7463('0x29'),_0x7463('0x6d'),util[_0x7463('0x3a')](_0x23f00a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x302a96){return logger[_0x7463('0x27')](_0x7463('0x28'),'afterCreate','intelepeer',util[_0x7463('0x3a')](_0x302a96,{'showHidden':![],'depth':null}));});}else{return logger[_0x7463('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7463('0x29'),_0x7463('0x6d'),_0x7463('0x74'));}break;}}})[_0x7463('0x75')](function(){_0x512051();});}else{_0x512051();}}},'charset':_0x7463('0x76'),'collate':_0x7463('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 9648f1b..327ac93 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 _0x5b21=['error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsMessage.socket','register','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x21163b,_0x30996b){var _0x4bb3a2=function(_0x357b2f){while(--_0x357b2f){_0x21163b['push'](_0x21163b['shift']());}};_0x4bb3a2(++_0x30996b);}(_0x5b21,0x125));var _0x15b2=function(_0xd4f0af,_0x4bb3af){_0xd4f0af=_0xd4f0af-0x0;var _0x32f6fb=_0x5b21[_0xd4f0af];return _0x32f6fb;};'use strict';var _=require(_0x15b2('0x0'));var util=require(_0x15b2('0x1'));var moment=require(_0x15b2('0x2'));var BPromise=require(_0x15b2('0x3'));var rs=require(_0x15b2('0x4'));var fs=require('fs');var Redis=require(_0x15b2('0x5'));var db=require(_0x15b2('0x6'))['db'];var utils=require(_0x15b2('0x7'));var logger=require(_0x15b2('0x8'))(_0x15b2('0x9'));var config=require(_0x15b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x15b2('0xb')]['http']({'port':0x232a});config[_0x15b2('0xc')]=_[_0x15b2('0xd')](config[_0x15b2('0xc')],{'host':_0x15b2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15b2('0xc')]));require(_0x15b2('0xf'))[_0x15b2('0x10')](socket);function respondWithRpcPromise(_0x12b6d3,_0x2b49d6,_0x2ba4fe){return new BPromise(function(_0x30e241,_0x4e3c41){return client['request'](_0x12b6d3,_0x2ba4fe)[_0x15b2('0x11')](function(_0x44f88f){logger[_0x15b2('0x12')]('SmsMessage,\x20%s,\x20%s',_0x2b49d6,_0x15b2('0x13'));logger['debug'](_0x15b2('0x14'),_0x2b49d6,'request\x20sent',JSON[_0x15b2('0x15')](_0x44f88f));if(_0x44f88f[_0x15b2('0x16')]){if(_0x44f88f[_0x15b2('0x16')][_0x15b2('0x17')]===0x1f4){logger[_0x15b2('0x16')](_0x15b2('0x18'),_0x2b49d6,_0x44f88f[_0x15b2('0x16')]['message']);return _0x4e3c41(_0x44f88f['error'][_0x15b2('0x19')]);}logger[_0x15b2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x2b49d6,_0x44f88f[_0x15b2('0x16')][_0x15b2('0x19')]);return _0x30e241(_0x44f88f[_0x15b2('0x16')][_0x15b2('0x19')]);}else{logger[_0x15b2('0x12')](_0x15b2('0x18'),_0x2b49d6,'request\x20sent');_0x30e241(_0x44f88f[_0x15b2('0x1a')]['message']);}})[_0x15b2('0x1b')](function(_0x6be998){logger[_0x15b2('0x16')](_0x15b2('0x18'),_0x2b49d6,_0x6be998);_0x4e3c41(_0x6be998);});});}exports['CreateSmsMessage']=function(_0x77f4e5){var _0x3797e2=this;return new Promise(function(_0x3fc9df,_0x36c133){return db[_0x15b2('0x1c')][_0x15b2('0x1d')](_0x77f4e5[_0x15b2('0x1e')],{'raw':_0x77f4e5[_0x15b2('0x1f')]?_0x77f4e5['options'][_0x15b2('0x20')]===undefined?!![]:![]:!![]})[_0x15b2('0x11')](function(_0x1700f4){logger['info'](_0x15b2('0x21'),_0x77f4e5);logger[_0x15b2('0x22')]('CreateSmsMessage',_0x77f4e5,JSON['stringify'](_0x1700f4));_0x3fc9df(_0x1700f4);})[_0x15b2('0x1b')](function(_0x2869b5){logger['error']('CreateSmsMessage',_0x2869b5['message'],_0x77f4e5);_0x36c133(_0x3797e2[_0x15b2('0x16')](0x1f4,_0x2869b5[_0x15b2('0x19')]));});});}; \ No newline at end of file +var _0xa74f=['message','result','catch','CreateSmsMessage','body','options','raw','debug','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd468,_0x285a43){var _0x3852c4=function(_0x36b275){while(--_0x36b275){_0x3dd468['push'](_0x3dd468['shift']());}};_0x3852c4(++_0x285a43);}(_0xa74f,0x1c8));var _0xfa74=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xa74f[_0x5d8631];return _0x34c15e;};'use strict';var _=require(_0xfa74('0x0'));var util=require('util');var moment=require(_0xfa74('0x1'));var BPromise=require(_0xfa74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa74('0x4'));var logger=require(_0xfa74('0x5'))('rpc');var config=require(_0xfa74('0x6'));var jayson=require(_0xfa74('0x7'));var client=jayson[_0xfa74('0x8')][_0xfa74('0x9')]({'port':0x232a});config['redis']=_[_0xfa74('0xa')](config[_0xfa74('0xb')],{'host':_0xfa74('0xc'),'port':0x18eb});var socket=require(_0xfa74('0xd'))(new Redis(config[_0xfa74('0xb')]));require(_0xfa74('0xe'))[_0xfa74('0xf')](socket);function respondWithRpcPromise(_0x18bcbf,_0x330cda,_0x497f2c){return new BPromise(function(_0x2145e4,_0x5f5a57){return client['request'](_0x18bcbf,_0x497f2c)[_0xfa74('0x10')](function(_0x25c476){logger[_0xfa74('0x11')](_0xfa74('0x12'),_0x330cda,_0xfa74('0x13'));logger['debug'](_0xfa74('0x14'),_0x330cda,'request\x20sent',JSON[_0xfa74('0x15')](_0x25c476));if(_0x25c476[_0xfa74('0x16')]){if(_0x25c476['error'][_0xfa74('0x17')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x330cda,_0x25c476[_0xfa74('0x16')]['message']);return _0x5f5a57(_0x25c476[_0xfa74('0x16')][_0xfa74('0x18')]);}logger[_0xfa74('0x16')](_0xfa74('0x12'),_0x330cda,_0x25c476['error'][_0xfa74('0x18')]);return _0x2145e4(_0x25c476['error']['message']);}else{logger[_0xfa74('0x11')](_0xfa74('0x12'),_0x330cda,_0xfa74('0x13'));_0x2145e4(_0x25c476[_0xfa74('0x19')][_0xfa74('0x18')]);}})[_0xfa74('0x1a')](function(_0x2e20de){logger[_0xfa74('0x16')](_0xfa74('0x12'),_0x330cda,_0x2e20de);_0x5f5a57(_0x2e20de);});});}exports[_0xfa74('0x1b')]=function(_0x49e617){var _0xe9fa74=this;return new Promise(function(_0x5e26c9,_0x6305c4){return db['SmsMessage']['create'](_0x49e617[_0xfa74('0x1c')],{'raw':_0x49e617[_0xfa74('0x1d')]?_0x49e617['options'][_0xfa74('0x1e')]===undefined?!![]:![]:!![]})[_0xfa74('0x10')](function(_0x349b47){logger[_0xfa74('0x11')](_0xfa74('0x1b'),_0x49e617);logger[_0xfa74('0x1f')](_0xfa74('0x1b'),_0x49e617,JSON[_0xfa74('0x15')](_0x349b47));_0x5e26c9(_0x349b47);})[_0xfa74('0x1a')](function(_0xe5c86d){logger[_0xfa74('0x16')]('CreateSmsMessage',_0xe5c86d[_0xfa74('0x18')],_0x49e617);_0x6305c4(_0xe9fa74[_0xfa74('0x16')](0x1f4,_0xe5c86d['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 19182b3..d04b7e4 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 _0xf155=['save','remove','emit','removeListener','register','length','smsMessage:'];(function(_0x22f8be,_0xce6014){var _0x13389a=function(_0x2d1fdf){while(--_0x2d1fdf){_0x22f8be['push'](_0x22f8be['shift']());}};_0x13389a(++_0xce6014);}(_0xf155,0x111));var _0x5f15=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0xf155[_0xe7d561];return _0x4c27f0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x5f15('0x0'),_0x5f15('0x1'),'update'];function createListener(_0x398804,_0x3ec44b){return function(_0x18179d){_0x3ec44b[_0x5f15('0x2')](_0x398804,_0x18179d);};}function removeListener(_0x57e1dd,_0x4a9006){return function(){SmsMessageEvents[_0x5f15('0x3')](_0x57e1dd,_0x4a9006);};}exports[_0x5f15('0x4')]=function(_0x45cf97){for(var _0x3018cf=0x0,_0x40b100=events[_0x5f15('0x5')];_0x3018cf<_0x40b100;_0x3018cf++){var _0xd142e9=events[_0x3018cf];var _0x1ed121=createListener(_0x5f15('0x6')+_0xd142e9,_0x45cf97);SmsMessageEvents['on'](_0xd142e9,_0x1ed121);}}; \ No newline at end of file +var _0x37c1=['update','emit','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x37c1,0x1ad));var _0x137c=function(_0x3225fc,_0x20dfd9){_0x3225fc=_0x3225fc-0x0;var _0x5bfe37=_0x37c1[_0x3225fc];return _0x5bfe37;};'use strict';var SmsMessageEvents=require(_0x137c('0x0'));var events=[_0x137c('0x1'),_0x137c('0x2'),_0x137c('0x3')];function createListener(_0x5466f0,_0x39570e){return function(_0x5d2b84){_0x39570e[_0x137c('0x4')](_0x5466f0,_0x5d2b84);};}function removeListener(_0x3caa51,_0x3adab8){return function(){SmsMessageEvents['removeListener'](_0x3caa51,_0x3adab8);};}exports[_0x137c('0x5')]=function(_0x10ad3f){for(var _0x568787=0x0,_0x3715ec=events[_0x137c('0x6')];_0x568787<_0x3715ec;_0x568787++){var _0xb02bc3=events[_0x568787];var _0x111dfb=createListener(_0x137c('0x7')+_0xb02bc3,_0x10ad3f);SmsMessageEvents['on'](_0xb02bc3,_0x111dfb);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b9193e6..e9747bd 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 _0xd60d=['put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xd60d,0xff));var _0xdd60=function(_0x18361a,_0x8a987b){_0x18361a=_0x18361a-0x0;var _0x41ac69=_0xd60d[_0x18361a];return _0x41ac69;};'use strict';var multer=require(_0xdd60('0x0'));var util=require(_0xdd60('0x1'));var path=require('path');var timeout=require(_0xdd60('0x2'));var express=require('express');var router=express[_0xdd60('0x3')]();var fs_extra=require(_0xdd60('0x4'));var auth=require(_0xdd60('0x5'));var interaction=require(_0xdd60('0x6'));var config=require(_0xdd60('0x7'));var controller=require('./smsQueue.controller');router[_0xdd60('0x8')]('/',auth[_0xdd60('0x9')](),controller[_0xdd60('0xa')]);router[_0xdd60('0x8')](_0xdd60('0xb'),auth[_0xdd60('0x9')](),controller[_0xdd60('0xc')]);router['get'](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0xe')]);router[_0xdd60('0x8')](_0xdd60('0xf'),auth['isAuthenticated'](),controller[_0xdd60('0x10')]);router[_0xdd60('0x8')](_0xdd60('0x11'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x12')]);router[_0xdd60('0x8')]('/:id/users',auth[_0xdd60('0x9')](),controller['getAgents']);router[_0xdd60('0x13')]('/',auth[_0xdd60('0x9')](),controller[_0xdd60('0x14')]);router[_0xdd60('0x13')](_0xdd60('0x11'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x15')]);router[_0xdd60('0x13')](_0xdd60('0x16'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x17')]);router[_0xdd60('0x18')](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x19')]);router[_0xdd60('0x1a')](_0xdd60('0xd'),auth[_0xdd60('0x9')](),controller[_0xdd60('0x1b')]);router[_0xdd60('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdd60('0x1c')]);router[_0xdd60('0x1a')]('/:id/users',auth[_0xdd60('0x9')](),controller[_0xdd60('0x1d')]);module[_0xdd60('0x1e')]=router; \ No newline at end of file +var _0xb83f=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','get','describe','/:id','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb83f,0x18c));var _0xfb83=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xb83f[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xfb83('0x0'));var util=require(_0xfb83('0x1'));var path=require(_0xfb83('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb83('0x3'));var router=express[_0xfb83('0x4')]();var fs_extra=require(_0xfb83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb83('0x6'));var config=require(_0xfb83('0x7'));var controller=require(_0xfb83('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb83('0x9')]);router[_0xfb83('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xfb83('0xb')]);router[_0xfb83('0xa')](_0xfb83('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfb83('0xa')](_0xfb83('0xd'),auth[_0xfb83('0xe')](),controller[_0xfb83('0xf')]);router[_0xfb83('0xa')](_0xfb83('0x10'),auth[_0xfb83('0xe')](),controller[_0xfb83('0x11')]);router[_0xfb83('0xa')](_0xfb83('0x12'),auth[_0xfb83('0xe')](),controller[_0xfb83('0x13')]);router[_0xfb83('0x14')]('/',auth[_0xfb83('0xe')](),controller[_0xfb83('0x15')]);router[_0xfb83('0x14')]('/:id/teams',auth[_0xfb83('0xe')](),controller[_0xfb83('0x16')]);router['post'](_0xfb83('0x12'),auth[_0xfb83('0xe')](),controller['addAgents']);router[_0xfb83('0x17')](_0xfb83('0xc'),auth[_0xfb83('0xe')](),controller[_0xfb83('0x18')]);router[_0xfb83('0x19')](_0xfb83('0xc'),auth[_0xfb83('0xe')](),controller[_0xfb83('0x1a')]);router[_0xfb83('0x19')](_0xfb83('0x10'),auth['isAuthenticated'](),controller[_0xfb83('0x1b')]);router[_0xfb83('0x19')](_0xfb83('0x12'),auth['isAuthenticated'](),controller[_0xfb83('0x1c')]);module[_0xfb83('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d9257b5..5366c45 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 _0x1e2c=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x2778b2,_0x2aaeba){var _0x1b77bc=function(_0x3bca8f){while(--_0x3bca8f){_0x2778b2['push'](_0x2778b2['shift']());}};_0x1b77bc(++_0x2aaeba);}(_0x1e2c,0xd0));var _0xc1e2=function(_0xd8acea,_0x58cf28){_0xd8acea=_0xd8acea-0x0;var _0x2eb579=_0x1e2c[_0xd8acea];return _0x2eb579;};'use strict';var Sequelize=require(_0xc1e2('0x0'));module[_0xc1e2('0x1')]={'name':{'type':Sequelize[_0xc1e2('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc1e2('0x2')]},'timeout':{'type':Sequelize[_0xc1e2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1e2('0x4')](_0xc1e2('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xa4e0=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1dc3bb,_0x31af09){var _0x17af1f=function(_0x5cf46e){while(--_0x5cf46e){_0x1dc3bb['push'](_0x1dc3bb['shift']());}};_0x17af1f(++_0x31af09);}(_0xa4e0,0x14f));var _0x0a4e=function(_0x5ed3c4,_0x259c9e){_0x5ed3c4=_0x5ed3c4-0x0;var _0x4c819b=_0xa4e0[_0x5ed3c4];return _0x4c819b;};'use strict';var Sequelize=require(_0x0a4e('0x0'));module[_0x0a4e('0x1')]={'name':{'type':Sequelize[_0x0a4e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0a4e('0x2')]},'timeout':{'type':Sequelize[_0x0a4e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0a4e('0x4')](_0x0a4e('0x5'),_0x0a4e('0x6'),_0x0a4e('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b7fea04..8a29f3f 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 _0x4547=['QueryTypes','SELECT','TeamId','includes','all','transaction','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','emit','userSmsQueue:save','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','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','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','offset','undefined','count','limit','status','set','Content-Range','json','update','destroy','then','get','SmsQueues','end','stack','name','send','index','SmsQueue','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','pick','SmsQueueId','findAll','UserId','smsPause','updatedAt','createdAt','format','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','each','UserSmsQueue','findOrCreate','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0x1278c4,_0x5c2d2d){var _0x365887=function(_0x316fc4){while(--_0x316fc4){_0x1278c4['push'](_0x1278c4['shift']());}};_0x365887(++_0x5c2d2d);}(_0x4547,0x11b));var _0x7454=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x4547[_0xb3b452];return _0x238983;};'use strict';var emlformat=require(_0x7454('0x0'));var rimraf=require(_0x7454('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7454('0x2'));var rp=require(_0x7454('0x3'));var moment=require('moment');var BPromise=require(_0x7454('0x4'));var Mustache=require(_0x7454('0x5'));var util=require(_0x7454('0x6'));var path=require(_0x7454('0x7'));var sox=require(_0x7454('0x8'));var csv=require(_0x7454('0x9'));var ejs=require(_0x7454('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7454('0xb'));var squel=require('squel');var crypto=require(_0x7454('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7454('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7454('0xe'));var Papa=require(_0x7454('0xf'));var Redis=require('ioredis');var authService=require(_0x7454('0x10'));var qs=require(_0x7454('0x11'));var as=require(_0x7454('0x12'));var hardwareService=require(_0x7454('0x13'));var logger=require(_0x7454('0x14'))(_0x7454('0x15'));var utils=require('../../config/utils');var config=require(_0x7454('0x16'));var licenseUtil=require(_0x7454('0x17'));var db=require(_0x7454('0x18'))['db'];config['redis']=_['defaults'](config[_0x7454('0x19')],{'host':_0x7454('0x1a'),'port':0x18eb});var socket=require(_0x7454('0x1b'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x4d575f,_0x51fd5b){_0x51fd5b=_0x51fd5b||0xcc;return function(_0x2896c0){if(_0x2896c0){return _0x4d575f[_0x7454('0x1c')](_0x51fd5b);}return _0x4d575f['status'](_0x51fd5b)['end']();};}function respondWithResult(_0x22d4c7,_0x2186a9){_0x2186a9=_0x2186a9||0xc8;return function(_0x13a8fb){if(_0x13a8fb){return _0x22d4c7['status'](_0x2186a9)['json'](_0x13a8fb);}};}function respondWithFilteredResult(_0x4396f7,_0x1ff00b){return function(_0x2df42e){if(_0x2df42e){var _0x1ca614=typeof _0x1ff00b[_0x7454('0x1d')]===_0x7454('0x1e')&&typeof _0x1ff00b['limit']===_0x7454('0x1e');var _0x56d3ba=_0x2df42e[_0x7454('0x1f')];var _0x2ddb7f=_0x1ca614?0x0:_0x1ff00b['offset'];var _0x2df7b5=_0x1ca614?_0x2df42e[_0x7454('0x1f')]:_0x1ff00b[_0x7454('0x1d')]+_0x1ff00b[_0x7454('0x20')];var _0x2640fb;if(_0x2df7b5>=_0x56d3ba){_0x2df7b5=_0x56d3ba;_0x2640fb=0xc8;}else{_0x2640fb=0xce;}_0x4396f7[_0x7454('0x21')](_0x2640fb);return _0x4396f7[_0x7454('0x22')](_0x7454('0x23'),_0x2ddb7f+'-'+_0x2df7b5+'/'+_0x56d3ba)[_0x7454('0x24')](_0x2df42e);}return null;};}function patchUpdates(_0x1aaa17){return function(_0x1f3c4d){try{jsonpatch['apply'](_0x1f3c4d,_0x1aaa17,!![]);}catch(_0x5a121f){return BPromise['reject'](_0x5a121f);}return _0x1f3c4d['save']();};}function saveUpdates(_0x5366ff,_0x2c51f2){return function(_0x344adf){if(_0x344adf){return _0x344adf[_0x7454('0x25')](_0x5366ff)['then'](function(_0xc0ef45){return _0xc0ef45;});}return null;};}function removeEntity(_0x29526a,_0x13563f){return function(_0x1a1d11){if(_0x1a1d11){return _0x1a1d11[_0x7454('0x26')]()[_0x7454('0x27')](function(){var _0x2bfe84=_0x1a1d11[_0x7454('0x28')]({'plain':!![]});var _0x2d9f59=_0x7454('0x29');return db['UserProfileResource'][_0x7454('0x26')]({'where':{'type':_0x2d9f59,'resourceId':_0x2bfe84['id']}})[_0x7454('0x27')](function(){return _0x1a1d11;});})[_0x7454('0x27')](function(){_0x29526a[_0x7454('0x21')](0xcc)[_0x7454('0x2a')]();});}};}function handleEntityNotFound(_0x47603e,_0x14c525){return function(_0x107dd8){if(!_0x107dd8){_0x47603e['sendStatus'](0x194);}return _0x107dd8;};}function handleError(_0x505a2d,_0x405915){_0x405915=_0x405915||0x1f4;return function(_0x4ae613){logger['error'](_0x4ae613[_0x7454('0x2b')]);if(_0x4ae613[_0x7454('0x2c')]){delete _0x4ae613[_0x7454('0x2c')];}_0x505a2d[_0x7454('0x21')](_0x405915)[_0x7454('0x2d')](_0x4ae613);};}exports[_0x7454('0x2e')]=function(_0x1304e8,_0xc6d9f2){var _0x234a30={},_0x1031d8={},_0x644efd={'count':0x0,'rows':[]};var _0x4cfd57=_['map'](db[_0x7454('0x2f')]['rawAttributes'],function(_0x3009e1){return{'name':_0x3009e1[_0x7454('0x30')],'type':_0x3009e1['type'][_0x7454('0x31')]};});_0x1031d8['model']=_[_0x7454('0x32')](_0x4cfd57,_0x7454('0x2c'));_0x1031d8['query']=_[_0x7454('0x33')](_0x1304e8[_0x7454('0x34')]);_0x1031d8[_0x7454('0x35')]=_[_0x7454('0x36')](_0x1031d8[_0x7454('0x37')],_0x1031d8[_0x7454('0x34')]);_0x234a30[_0x7454('0x38')]=_[_0x7454('0x36')](_0x1031d8[_0x7454('0x37')],qs[_0x7454('0x39')](_0x1304e8[_0x7454('0x34')][_0x7454('0x39')]));_0x234a30['attributes']=_0x234a30[_0x7454('0x38')][_0x7454('0x3a')]?_0x234a30[_0x7454('0x38')]:_0x1031d8[_0x7454('0x37')];if(!_0x1304e8[_0x7454('0x34')][_0x7454('0x3b')](_0x7454('0x3c'))){_0x234a30[_0x7454('0x20')]=qs[_0x7454('0x20')](_0x1304e8[_0x7454('0x34')][_0x7454('0x20')]);_0x234a30[_0x7454('0x1d')]=qs['offset'](_0x1304e8['query'][_0x7454('0x1d')]);}_0x234a30['order']=qs[_0x7454('0x3d')](_0x1304e8['query'][_0x7454('0x3d')]);_0x234a30['where']=qs[_0x7454('0x35')](_['pick'](_0x1304e8['query'],_0x1031d8[_0x7454('0x35')]),_0x4cfd57);if(_0x1304e8[_0x7454('0x34')][_0x7454('0x3e')]){_0x234a30['where']=_[_0x7454('0x3f')](_0x234a30[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x4cfd57,function(_0x25e79e){if(_0x25e79e['type']!==_0x7454('0x41')){var _0x47e98a={};_0x47e98a[_0x25e79e[_0x7454('0x2c')]]={'$like':'%'+_0x1304e8[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x47e98a;}})});}_0x234a30=_[_0x7454('0x3f')]({},_0x234a30,_0x1304e8[_0x7454('0x42')]);var _0x5117c5={'where':_0x234a30[_0x7454('0x40')]};return db['SmsQueue']['count'](_0x5117c5)['then'](function(_0x28e852){_0x644efd[_0x7454('0x1f')]=_0x28e852;if(_0x1304e8[_0x7454('0x34')]['includeAll']){_0x234a30[_0x7454('0x43')]=[{'all':!![]}];}return db[_0x7454('0x2f')]['findAll'](_0x234a30);})['then'](function(_0x38165f){_0x644efd[_0x7454('0x44')]=_0x38165f;return _0x644efd;})[_0x7454('0x27')](respondWithFilteredResult(_0xc6d9f2,_0x234a30))[_0x7454('0x45')](handleError(_0xc6d9f2,null));};exports[_0x7454('0x46')]=function(_0x46b676,_0x58e96d){var _0xdd661e={'raw':!![],'where':{'id':_0x46b676[_0x7454('0x47')]['id']}},_0x22ceac={};_0x22ceac[_0x7454('0x37')]=_[_0x7454('0x33')](db['SmsQueue'][_0x7454('0x48')]);_0x22ceac[_0x7454('0x34')]=_[_0x7454('0x33')](_0x46b676['query']);_0x22ceac[_0x7454('0x35')]=_[_0x7454('0x36')](_0x22ceac[_0x7454('0x37')],_0x22ceac[_0x7454('0x34')]);_0xdd661e[_0x7454('0x38')]=_[_0x7454('0x36')](_0x22ceac['model'],qs[_0x7454('0x39')](_0x46b676[_0x7454('0x34')][_0x7454('0x39')]));_0xdd661e[_0x7454('0x38')]=_0xdd661e['attributes'][_0x7454('0x3a')]?_0xdd661e[_0x7454('0x38')]:_0x22ceac['model'];if(_0x46b676['query']['includeAll']){_0xdd661e[_0x7454('0x43')]=[{'all':!![]}];}_0xdd661e=_[_0x7454('0x3f')]({},_0xdd661e,_0x46b676[_0x7454('0x42')]);return db[_0x7454('0x2f')][_0x7454('0x49')](_0xdd661e)[_0x7454('0x27')](handleEntityNotFound(_0x58e96d,null))[_0x7454('0x27')](respondWithResult(_0x58e96d,null))[_0x7454('0x45')](handleError(_0x58e96d,null));};exports[_0x7454('0x4a')]=function(_0xcfe6c1,_0x4dc4d1){return db[_0x7454('0x2f')]['create'](_0xcfe6c1[_0x7454('0x4b')],{})[_0x7454('0x27')](function(_0x159927){var _0x240f1d=_0xcfe6c1[_0x7454('0x4c')]['get']({'plain':!![]});if(!_0x240f1d)throw new Error(_0x7454('0x4d'));if(_0x240f1d[_0x7454('0x4e')]===_0x7454('0x4c')){var _0x141b3f=_0x159927[_0x7454('0x28')]({'plain':!![]});var _0x1ca0e3=_0x7454('0x29');return db[_0x7454('0x4f')][_0x7454('0x49')]({'where':{'name':_0x1ca0e3,'userProfileId':_0x240f1d[_0x7454('0x50')]},'raw':!![]})[_0x7454('0x27')](function(_0x5ab838){if(_0x5ab838&&_0x5ab838[_0x7454('0x51')]===0x0){return db[_0x7454('0x52')]['create']({'name':_0x141b3f[_0x7454('0x2c')],'resourceId':_0x141b3f['id'],'type':_0x5ab838['name'],'sectionId':_0x5ab838['id']},{})['then'](function(){return _0x159927;});}else{return _0x159927;}})[_0x7454('0x45')](function(_0x155bdc){logger[_0x7454('0x53')](_0x7454('0x54'),_0x155bdc);throw _0x155bdc;});}return _0x159927;})['then'](respondWithResult(_0x4dc4d1,0xc9))[_0x7454('0x45')](handleError(_0x4dc4d1,null));};exports['update']=function(_0x5d967f,_0x40b571){if(_0x5d967f[_0x7454('0x4b')]['id']){delete _0x5d967f['body']['id'];}return db[_0x7454('0x2f')]['find']({'where':{'id':_0x5d967f[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x40b571,null))[_0x7454('0x27')](saveUpdates(_0x5d967f[_0x7454('0x4b')],null))[_0x7454('0x27')](respondWithResult(_0x40b571,null))[_0x7454('0x45')](handleError(_0x40b571,null));};exports[_0x7454('0x26')]=function(_0x41ebdc,_0x1b2035){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x41ebdc[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b2035,null))['then'](removeEntity(_0x1b2035,null))[_0x7454('0x45')](handleError(_0x1b2035,null));};exports[_0x7454('0x55')]=function(_0x4ebb8e,_0x3f7c5f){return db[_0x7454('0x2f')][_0x7454('0x55')]()[_0x7454('0x27')](respondWithResult(_0x3f7c5f,null))['catch'](handleError(_0x3f7c5f,null));};exports[_0x7454('0x56')]=function(_0x31e6e9,_0x10c79d,_0x1aae8a){var _0x19181f={'raw':!![],'where':{}},_0x3ecd4c={},_0x23e2a9;return db[_0x7454('0x2f')][_0x7454('0x57')]({'where':{'id':_0x31e6e9['params']['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x10c79d,null))['then'](function(_0x5505d9){if(_0x5505d9){_0x23e2a9=_0x5505d9[_0x7454('0x28')]({'plain':!![]});_0x3ecd4c[_0x7454('0x37')]=_['keys'](db['UserSmsQueue'][_0x7454('0x48')]);_0x3ecd4c[_0x7454('0x34')]=_['keys'](_0x31e6e9[_0x7454('0x34')]);_0x3ecd4c['filters']=_['intersection'](_0x3ecd4c[_0x7454('0x37')],_0x3ecd4c['query']);_0x19181f[_0x7454('0x38')]=_[_0x7454('0x36')](_0x3ecd4c[_0x7454('0x37')],qs[_0x7454('0x39')](_0x31e6e9[_0x7454('0x34')][_0x7454('0x39')]));_0x19181f['attributes']=_0x19181f[_0x7454('0x38')][_0x7454('0x3a')]?_0x19181f[_0x7454('0x38')]:_0x3ecd4c[_0x7454('0x37')];if(!_0x31e6e9[_0x7454('0x34')]['hasOwnProperty'](_0x7454('0x3c'))){_0x19181f['limit']=qs[_0x7454('0x20')](_0x31e6e9[_0x7454('0x34')]['limit']);_0x19181f[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x31e6e9[_0x7454('0x34')]['offset']);}_0x19181f[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x31e6e9[_0x7454('0x34')]['sort']);_0x19181f[_0x7454('0x40')]=qs[_0x7454('0x35')](_[_0x7454('0x59')](_0x31e6e9[_0x7454('0x34')],_0x3ecd4c['filters']));_0x19181f[_0x7454('0x40')][_0x7454('0x5a')]=_0x5505d9['id'];if(_0x31e6e9[_0x7454('0x34')][_0x7454('0x3e')]){_0x19181f[_0x7454('0x40')]=_[_0x7454('0x3f')](_0x19181f[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x19181f[_0x7454('0x38')],function(_0x19ecc1){var _0x4719bc={};_0x4719bc[_0x19ecc1]={'$like':'%'+_0x31e6e9[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x4719bc;})});}_0x19181f=_[_0x7454('0x3f')]({},_0x19181f,_0x31e6e9[_0x7454('0x42')]);return db['UserSmsQueue'][_0x7454('0x5b')](_0x19181f);}})['then'](function(_0x3f879d){if(_0x3f879d){return db['User']['findAndCountAll']({'where':{'id':_[_0x7454('0x32')](_0x3f879d,_0x7454('0x5c')),'role':'agent'},'attributes':['id',_0x7454('0x2c'),_0x7454('0x5d'),_0x7454('0x5e'),_0x7454('0x5f')]});}})[_0x7454('0x27')](function(_0x597ab4){if(_0x597ab4){return{'count':_0x597ab4['count'],'rows':_[_0x7454('0x32')](_0x597ab4['rows'],function(_0x3d17df){return{'membername':_0x3d17df[_0x7454('0x2c')],'UserId':_0x3d17df['id'],'queue_name':_0x23e2a9[_0x7454('0x2c')],'SmsQueueId':_0x23e2a9['id'],'interface':util[_0x7454('0x60')]('%s/%s','SIP',_0x3d17df[_0x7454('0x2c')]),'penalty':0x0,'paused':_0x3d17df['smsPause'],'createdAt':_0x3d17df[_0x7454('0x5f')],'updatedAt':_0x3d17df[_0x7454('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7454('0x27')](respondWithFilteredResult(_0x10c79d,_0x19181f))[_0x7454('0x45')](handleError(_0x10c79d,null));};exports[_0x7454('0x61')]=function(_0x518282,_0x20db14,_0x26ef3d){var _0x5df5d6={};var _0x2921d5={};var _0x1c0b27;var _0x3dda26;return db['SmsQueue'][_0x7454('0x57')]({'where':{'id':_0x518282[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x20db14,null))[_0x7454('0x27')](function(_0x4bef3b){if(_0x4bef3b){_0x1c0b27=_0x4bef3b;_0x2921d5['model']=_[_0x7454('0x33')](db[_0x7454('0x62')][_0x7454('0x48')]);_0x2921d5[_0x7454('0x34')]=_['keys'](_0x518282[_0x7454('0x34')]);_0x2921d5['filters']=_[_0x7454('0x36')](_0x2921d5[_0x7454('0x37')],_0x2921d5['query']);_0x5df5d6['attributes']=_[_0x7454('0x36')](_0x2921d5['model'],qs['fields'](_0x518282['query'][_0x7454('0x39')]));_0x5df5d6[_0x7454('0x38')]=_0x5df5d6[_0x7454('0x38')][_0x7454('0x3a')]?_0x5df5d6['attributes']:_0x2921d5[_0x7454('0x37')];_0x5df5d6[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x518282['query'][_0x7454('0x3d')]);_0x5df5d6['where']=qs[_0x7454('0x35')](_['pick'](_0x518282[_0x7454('0x34')],_0x2921d5[_0x7454('0x35')]));if(_0x518282[_0x7454('0x34')][_0x7454('0x3e')]){_0x5df5d6['where']=_['merge'](_0x5df5d6[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x5df5d6[_0x7454('0x38')],function(_0x13a547){var _0x46dffe={};_0x46dffe[_0x13a547]={'$like':'%'+_0x518282['query'][_0x7454('0x3e')]+'%'};return _0x46dffe;})});}_0x5df5d6=_[_0x7454('0x3f')]({},_0x5df5d6,_0x518282[_0x7454('0x42')]);return _0x1c0b27[_0x7454('0x61')](_0x5df5d6);}})[_0x7454('0x27')](function(_0x3dfced){if(_0x3dfced){_0x3dda26=_0x3dfced[_0x7454('0x3a')];if(!_0x518282['query'][_0x7454('0x3b')](_0x7454('0x3c'))){_0x5df5d6[_0x7454('0x20')]=qs[_0x7454('0x20')](_0x518282[_0x7454('0x34')]['limit']);_0x5df5d6[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x518282[_0x7454('0x34')][_0x7454('0x1d')]);}return _0x1c0b27[_0x7454('0x61')](_0x5df5d6);}})[_0x7454('0x27')](function(_0x1c9707){if(_0x1c9707){return _0x1c9707?{'count':_0x3dda26,'rows':_0x1c9707}:null;}})['then'](respondWithResult(_0x20db14,null))[_0x7454('0x45')](handleError(_0x20db14,null));};exports[_0x7454('0x63')]=function(_0x5c5183,_0x335971,_0x471aaf){var _0x4af6a0=_0x5c5183[_0x7454('0x4b')]['ids'];return db[_0x7454('0x62')][_0x7454('0x5b')]({'where':{'id':_0x4af6a0},'attributes':['id'],'include':[{'model':db[_0x7454('0x64')],'as':_0x7454('0x65'),'attributes':['id',_0x7454('0x2c'),_0x7454('0x66'),_0x7454('0x67'),'interface'],'raw':!![]}]})[_0x7454('0x27')](function(_0x1af3c7){if(_0x1af3c7){var _0x33a196=_[_0x7454('0x68')](_0x1af3c7,function(_0x8910aa){var _0x2f68e6=_0x8910aa[_0x7454('0x28')]({'plain':!![]});return _0x2f68e6[_0x7454('0x65')];});return db['SmsQueue']['find']({'where':{'id':_0x5c5183[_0x7454('0x47')]['id']}})[_0x7454('0x27')](function(_0x494488){return db[_0x7454('0x69')]['transaction'](function(_0xbfda60){return _0x494488[_0x7454('0x63')](_0x4af6a0,{'transaction':_0xbfda60})[_0x7454('0x27')](function(){return BPromise[_0x7454('0x6a')](_0x33a196,function(_0x33150d){return db[_0x7454('0x6b')][_0x7454('0x6c')]({'where':{'UserId':_0x33150d['id'],'SmsQueueId':_0x5c5183['params']['id']},'transaction':_0xbfda60});});})[_0x7454('0x27')](function(){_0x33a196['forEach'](function(_0x56a861){socket['emit']('userSmsQueue:save',{'UserId':_0x56a861['id'],'SmsQueueId':_0x494488['id']});});});});});}})[_0x7454('0x27')](respondWithStatusCode(_0x335971,null))['catch'](handleError(_0x335971,null));};exports[_0x7454('0x6d')]=function(_0x16214d,_0xe986e5,_0x385e14){return db[_0x7454('0x62')]['findAll']({'where':{'id':_0x16214d['query'][_0x7454('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x7454('0x64')],'as':_0x7454('0x65'),'attributes':['id'],'raw':!![]}]})[_0x7454('0x27')](handleEntityNotFound(_0xe986e5,null))['then'](function(_0x18682e){var _0x99abf0=_[_0x7454('0x32')](_0x18682e,'id');var _0x154eb2=[];var _0x38284c=[];var _0x202422=squel[_0x7454('0x6f')]();_0x202422['field'](_0x7454('0x70'))[_0x7454('0x71')]('team_has_sms_queues','tq')[_0x7454('0x72')](_0x7454('0x73'),'ut',_0x7454('0x74'))[_0x7454('0x40')](_0x7454('0x75'),_0x16214d[_0x7454('0x47')]['id']);for(var _0x21a6b2=0x0;_0x21a6b2<_0x18682e[_0x7454('0x3a')];_0x21a6b2+=0x1){let _0x252d8b=_0x18682e[_0x21a6b2];for(var _0x544616=0x0;_0x544616<_0x252d8b[_0x7454('0x65')]['length'];_0x544616+=0x1){let _0x3a8d6d=_0x252d8b[_0x7454('0x65')][_0x544616];var _0x57e083=_0x202422['clone']();_0x57e083[_0x7454('0x40')](_0x7454('0x76'),_0x3a8d6d['id']);_0x38284c['push'](db[_0x7454('0x69')][_0x7454('0x34')](_0x57e083['toString'](),{'type':db[_0x7454('0x69')][_0x7454('0x77')][_0x7454('0x78')]})['then'](function(_0x26b358){if(_0x26b358[_0x7454('0x3a')]===0x1){return _0x3a8d6d['id'];}else{var _0x4d1a52=_['every'](_[_0x7454('0x32')](_0x26b358,_0x7454('0x79')),function(_0xefa7e3){return _[_0x7454('0x7a')](_0x99abf0,_0xefa7e3);});if(_0x4d1a52){return _0x3a8d6d['id'];}}}));}}return BPromise[_0x7454('0x7b')](_0x38284c)[_0x7454('0x27')](function(_0x13e212){_0x154eb2=_(_0x154eb2)['union'](_0x13e212)['compact']()['value']();return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x16214d[_0x7454('0x47')]['id']}})['then'](function(_0x2d8d36){return db[_0x7454('0x69')][_0x7454('0x7c')](function(_0x5dcb19){return _0x2d8d36[_0x7454('0x6d')](_0x16214d[_0x7454('0x34')][_0x7454('0x6e')],{'transaction':_0x5dcb19})['then'](function(){if(!_['isEmpty'](_0x154eb2)){return _0x2d8d36[_0x7454('0x7d')](_0x154eb2,{'transaction':_0x5dcb19});}})[_0x7454('0x27')](function(){_0x154eb2[_0x7454('0x7e')](function(_0x11edd5){socket['emit'](_0x7454('0x7f'),{'UserId':_0x11edd5,'SmsQueueId':_0x2d8d36['id']});});});});});});})[_0x7454('0x27')](respondWithStatusCode(_0xe986e5,null))['catch'](handleError(_0xe986e5,null));};exports[_0x7454('0x80')]=function(_0x77a111,_0x2b9e8a,_0x1a9613){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x77a111[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x2b9e8a,null))['then'](function(_0xa9f500){if(_0xa9f500){return _0xa9f500[_0x7454('0x80')](_0x77a111['body'][_0x7454('0x6e')],_[_0x7454('0x81')](_0x77a111[_0x7454('0x4b')],[_0x7454('0x6e'),'id'])||{})[_0x7454('0x82')](function(_0x5ec04a){for(var _0x4561e1=0x0;_0x4561e1<_0x77a111[_0x7454('0x4b')][_0x7454('0x6e')][_0x7454('0x3a')];_0x4561e1+=0x1){socket[_0x7454('0x83')](_0x7454('0x84'),{'UserId':Number(_0x77a111[_0x7454('0x4b')][_0x7454('0x6e')][_0x4561e1]),'SmsQueueId':Number(_0x77a111[_0x7454('0x47')]['id'])});}return _0x5ec04a;});}})[_0x7454('0x27')](respondWithResult(_0x2b9e8a,null))[_0x7454('0x45')](handleError(_0x2b9e8a,null));};exports[_0x7454('0x7d')]=function(_0x12f983,_0x535065,_0x6ad9a6){return db[_0x7454('0x2f')][_0x7454('0x49')]({'where':{'id':_0x12f983[_0x7454('0x47')]['id']}})['then'](handleEntityNotFound(_0x535065,null))[_0x7454('0x27')](function(_0x27a39e){if(_0x27a39e){return _0x27a39e[_0x7454('0x7d')](_0x12f983[_0x7454('0x34')][_0x7454('0x6e')])['then'](function(){if(_['isArray'](_0x12f983[_0x7454('0x34')][_0x7454('0x6e')])){for(var _0x133040=0x0;_0x133040<_0x12f983[_0x7454('0x34')][_0x7454('0x6e')][_0x7454('0x3a')];_0x133040+=0x1){socket[_0x7454('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x12f983['query'][_0x7454('0x6e')][_0x133040]),'SmsQueueId':Number(_0x12f983[_0x7454('0x47')]['id'])});}}else{socket[_0x7454('0x83')]('userSmsQueue:remove',{'UserId':Number(_0x12f983[_0x7454('0x34')][_0x7454('0x6e')]),'SmsQueueId':Number(_0x12f983[_0x7454('0x47')]['id'])});}});}})[_0x7454('0x27')](respondWithStatusCode(_0x535065,null))[_0x7454('0x45')](handleError(_0x535065,null));};exports['getAgents']=function(_0x3f5f5d,_0x4b244c,_0x55a7ad){var _0x299bc1={};var _0x193ae4={};var _0x165b53;var _0x30012e;return db[_0x7454('0x2f')]['findOne']({'where':{'id':_0x3f5f5d[_0x7454('0x47')]['id']}})[_0x7454('0x27')](handleEntityNotFound(_0x4b244c,null))[_0x7454('0x27')](function(_0x144f71){if(_0x144f71){_0x165b53=_0x144f71;_0x193ae4[_0x7454('0x37')]=_['keys'](db[_0x7454('0x64')][_0x7454('0x48')]);_0x193ae4[_0x7454('0x34')]=_[_0x7454('0x33')](_0x3f5f5d[_0x7454('0x34')]);_0x193ae4[_0x7454('0x35')]=_[_0x7454('0x36')](_0x193ae4[_0x7454('0x37')],_0x193ae4[_0x7454('0x34')]);_0x299bc1[_0x7454('0x38')]=_[_0x7454('0x36')](_0x193ae4[_0x7454('0x37')],qs[_0x7454('0x39')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x39')]));_0x299bc1[_0x7454('0x38')]=_0x299bc1[_0x7454('0x38')][_0x7454('0x3a')]?_0x299bc1['attributes']:_0x193ae4[_0x7454('0x37')];_0x299bc1[_0x7454('0x58')]=qs[_0x7454('0x3d')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x3d')]);_0x299bc1[_0x7454('0x40')]=qs[_0x7454('0x35')](_[_0x7454('0x59')](_0x3f5f5d[_0x7454('0x34')],_0x193ae4[_0x7454('0x35')]));if(_0x3f5f5d['query']['filter']){_0x299bc1['where']=_[_0x7454('0x3f')](_0x299bc1[_0x7454('0x40')],{'$or':_[_0x7454('0x32')](_0x299bc1[_0x7454('0x38')],function(_0x452eac){var _0x2dc40a={};_0x2dc40a[_0x452eac]={'$like':'%'+_0x3f5f5d[_0x7454('0x34')][_0x7454('0x3e')]+'%'};return _0x2dc40a;})});}_0x299bc1=_[_0x7454('0x3f')]({},_0x299bc1,_0x3f5f5d[_0x7454('0x42')]);return _0x165b53[_0x7454('0x85')](_0x299bc1);}})['then'](function(_0x4e7c8a){if(_0x4e7c8a){_0x30012e=_0x4e7c8a[_0x7454('0x3a')];if(!_0x3f5f5d['query'][_0x7454('0x3b')](_0x7454('0x3c'))){_0x299bc1['limit']=qs[_0x7454('0x20')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x20')]);_0x299bc1[_0x7454('0x1d')]=qs[_0x7454('0x1d')](_0x3f5f5d[_0x7454('0x34')][_0x7454('0x1d')]);}return _0x165b53[_0x7454('0x85')](_0x299bc1);}})[_0x7454('0x27')](function(_0x2074bb){if(_0x2074bb){return _0x2074bb?{'count':_0x30012e,'rows':_0x2074bb}:null;}})[_0x7454('0x27')](respondWithResult(_0x4b244c,null))[_0x7454('0x45')](handleError(_0x4b244c,null));}; \ No newline at end of file +var _0xfaf6=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserSmsQueue','order','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','smsPause','findOne','nolimit','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','SmsQueue','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','filters','intersection','find','create','body'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xfaf6,0xcd));var _0x6faf=function(_0x1d39c9,_0x5836f8){_0x1d39c9=_0x1d39c9-0x0;var _0x3f8e13=_0xfaf6[_0x1d39c9];return _0x3f8e13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6faf('0x0'));var zipdir=require(_0x6faf('0x1'));var jsonpatch=require(_0x6faf('0x2'));var rp=require(_0x6faf('0x3'));var moment=require(_0x6faf('0x4'));var BPromise=require(_0x6faf('0x5'));var Mustache=require('mustache');var util=require(_0x6faf('0x6'));var path=require(_0x6faf('0x7'));var sox=require(_0x6faf('0x8'));var csv=require(_0x6faf('0x9'));var ejs=require(_0x6faf('0xa'));var fs=require('fs');var fs_extra=require(_0x6faf('0xb'));var _=require('lodash');var squel=require(_0x6faf('0xc'));var crypto=require(_0x6faf('0xd'));var jsforce=require(_0x6faf('0xe'));var deskjs=require(_0x6faf('0xf'));var toCsv=require(_0x6faf('0x9'));var querystring=require('querystring');var Papa=require(_0x6faf('0x10'));var Redis=require(_0x6faf('0x11'));var authService=require(_0x6faf('0x12'));var qs=require(_0x6faf('0x13'));var as=require(_0x6faf('0x14'));var hardwareService=require(_0x6faf('0x15'));var logger=require(_0x6faf('0x16'))(_0x6faf('0x17'));var utils=require('../../config/utils');var config=require(_0x6faf('0x18'));var licenseUtil=require(_0x6faf('0x19'));var db=require('../../mysqldb')['db'];config[_0x6faf('0x1a')]=_[_0x6faf('0x1b')](config[_0x6faf('0x1a')],{'host':_0x6faf('0x1c'),'port':0x18eb});var socket=require(_0x6faf('0x1d'))(new Redis(config[_0x6faf('0x1a')]));require(_0x6faf('0x1e'))[_0x6faf('0x1f')](socket);function respondWithStatusCode(_0x590b5b,_0x609fdb){_0x609fdb=_0x609fdb||0xcc;return function(_0x4a3d2f){if(_0x4a3d2f){return _0x590b5b[_0x6faf('0x20')](_0x609fdb);}return _0x590b5b[_0x6faf('0x21')](_0x609fdb)[_0x6faf('0x22')]();};}function respondWithResult(_0x4b9da7,_0xa3bc13){_0xa3bc13=_0xa3bc13||0xc8;return function(_0x17b913){if(_0x17b913){return _0x4b9da7[_0x6faf('0x21')](_0xa3bc13)['json'](_0x17b913);}};}function respondWithFilteredResult(_0x53847f,_0x44ad81){return function(_0x1cd6f7){if(_0x1cd6f7){var _0x5f3ae0=typeof _0x44ad81[_0x6faf('0x23')]===_0x6faf('0x24')&&typeof _0x44ad81[_0x6faf('0x25')]==='undefined';var _0x362a83=_0x1cd6f7[_0x6faf('0x26')];var _0x4cfc20=_0x5f3ae0?0x0:_0x44ad81[_0x6faf('0x23')];var _0x3f97ab=_0x5f3ae0?_0x1cd6f7[_0x6faf('0x26')]:_0x44ad81[_0x6faf('0x23')]+_0x44ad81[_0x6faf('0x25')];var _0x190052;if(_0x3f97ab>=_0x362a83){_0x3f97ab=_0x362a83;_0x190052=0xc8;}else{_0x190052=0xce;}_0x53847f['status'](_0x190052);return _0x53847f[_0x6faf('0x27')]('Content-Range',_0x4cfc20+'-'+_0x3f97ab+'/'+_0x362a83)[_0x6faf('0x28')](_0x1cd6f7);}return null;};}function patchUpdates(_0x36049b){return function(_0x3a748e){try{jsonpatch[_0x6faf('0x29')](_0x3a748e,_0x36049b,!![]);}catch(_0x33cd18){return BPromise[_0x6faf('0x2a')](_0x33cd18);}return _0x3a748e[_0x6faf('0x2b')]();};}function saveUpdates(_0x3b8965,_0x250d3f){return function(_0x3ec991){if(_0x3ec991){return _0x3ec991[_0x6faf('0x2c')](_0x3b8965)[_0x6faf('0x2d')](function(_0x1134b8){return _0x1134b8;});}return null;};}function removeEntity(_0x5b960c,_0x214597){return function(_0x10beec){if(_0x10beec){return _0x10beec[_0x6faf('0x2e')]()[_0x6faf('0x2d')](function(){var _0x3df59c=_0x10beec[_0x6faf('0x2f')]({'plain':!![]});var _0xdd3c43=_0x6faf('0x30');return db[_0x6faf('0x31')][_0x6faf('0x2e')]({'where':{'type':_0xdd3c43,'resourceId':_0x3df59c['id']}})['then'](function(){return _0x10beec;});})[_0x6faf('0x2d')](function(){_0x5b960c[_0x6faf('0x21')](0xcc)[_0x6faf('0x22')]();});}};}function handleEntityNotFound(_0x173f65,_0x57fc54){return function(_0x2e4788){if(!_0x2e4788){_0x173f65[_0x6faf('0x20')](0x194);}return _0x2e4788;};}function handleError(_0x64633a,_0x477446){_0x477446=_0x477446||0x1f4;return function(_0x116e7e){logger[_0x6faf('0x32')](_0x116e7e[_0x6faf('0x33')]);if(_0x116e7e[_0x6faf('0x34')]){delete _0x116e7e[_0x6faf('0x34')];}_0x64633a[_0x6faf('0x21')](_0x477446)[_0x6faf('0x35')](_0x116e7e);};}exports['index']=function(_0x5bb7eb,_0x31f6a9){var _0x58b9bf={},_0x1c00f={},_0x371c26={'count':0x0,'rows':[]};var _0x129e6e=_['map'](db[_0x6faf('0x36')][_0x6faf('0x37')],function(_0xc53581){return{'name':_0xc53581['fieldName'],'type':_0xc53581[_0x6faf('0x38')][_0x6faf('0x39')]};});_0x1c00f[_0x6faf('0x3a')]=_[_0x6faf('0x3b')](_0x129e6e,_0x6faf('0x34'));_0x1c00f[_0x6faf('0x3c')]=_[_0x6faf('0x3d')](_0x5bb7eb['query']);_0x1c00f['filters']=_['intersection'](_0x1c00f['model'],_0x1c00f[_0x6faf('0x3c')]);_0x58b9bf[_0x6faf('0x3e')]=_['intersection'](_0x1c00f[_0x6faf('0x3a')],qs[_0x6faf('0x3f')](_0x5bb7eb[_0x6faf('0x3c')][_0x6faf('0x3f')]));_0x58b9bf[_0x6faf('0x3e')]=_0x58b9bf[_0x6faf('0x3e')][_0x6faf('0x40')]?_0x58b9bf['attributes']:_0x1c00f[_0x6faf('0x3a')];if(!_0x5bb7eb[_0x6faf('0x3c')][_0x6faf('0x41')]('nolimit')){_0x58b9bf[_0x6faf('0x25')]=qs[_0x6faf('0x25')](_0x5bb7eb[_0x6faf('0x3c')]['limit']);_0x58b9bf[_0x6faf('0x23')]=qs[_0x6faf('0x23')](_0x5bb7eb[_0x6faf('0x3c')][_0x6faf('0x23')]);}_0x58b9bf['order']=qs[_0x6faf('0x42')](_0x5bb7eb[_0x6faf('0x3c')][_0x6faf('0x42')]);_0x58b9bf[_0x6faf('0x43')]=qs['filters'](_[_0x6faf('0x44')](_0x5bb7eb[_0x6faf('0x3c')],_0x1c00f['filters']),_0x129e6e);if(_0x5bb7eb['query']['filter']){_0x58b9bf[_0x6faf('0x43')]=_[_0x6faf('0x45')](_0x58b9bf[_0x6faf('0x43')],{'$or':_[_0x6faf('0x3b')](_0x129e6e,function(_0x304755){if(_0x304755[_0x6faf('0x38')]!==_0x6faf('0x46')){var _0x34385e={};_0x34385e[_0x304755[_0x6faf('0x34')]]={'$like':'%'+_0x5bb7eb[_0x6faf('0x3c')][_0x6faf('0x47')]+'%'};return _0x34385e;}})});}_0x58b9bf=_['merge']({},_0x58b9bf,_0x5bb7eb['options']);var _0x988c44={'where':_0x58b9bf[_0x6faf('0x43')]};return db['SmsQueue'][_0x6faf('0x26')](_0x988c44)[_0x6faf('0x2d')](function(_0x208f01){_0x371c26[_0x6faf('0x26')]=_0x208f01;if(_0x5bb7eb['query'][_0x6faf('0x48')]){_0x58b9bf[_0x6faf('0x49')]=[{'all':!![]}];}return db[_0x6faf('0x36')][_0x6faf('0x4a')](_0x58b9bf);})[_0x6faf('0x2d')](function(_0x43faa7){_0x371c26['rows']=_0x43faa7;return _0x371c26;})['then'](respondWithFilteredResult(_0x31f6a9,_0x58b9bf))[_0x6faf('0x4b')](handleError(_0x31f6a9,null));};exports[_0x6faf('0x4c')]=function(_0x4467f9,_0x58075d){var _0x42bb97={'raw':!![],'where':{'id':_0x4467f9[_0x6faf('0x4d')]['id']}},_0x5ac08c={};_0x5ac08c['model']=_[_0x6faf('0x3d')](db[_0x6faf('0x36')][_0x6faf('0x37')]);_0x5ac08c[_0x6faf('0x3c')]=_[_0x6faf('0x3d')](_0x4467f9[_0x6faf('0x3c')]);_0x5ac08c[_0x6faf('0x4e')]=_[_0x6faf('0x4f')](_0x5ac08c[_0x6faf('0x3a')],_0x5ac08c['query']);_0x42bb97[_0x6faf('0x3e')]=_[_0x6faf('0x4f')](_0x5ac08c[_0x6faf('0x3a')],qs['fields'](_0x4467f9[_0x6faf('0x3c')]['fields']));_0x42bb97['attributes']=_0x42bb97[_0x6faf('0x3e')][_0x6faf('0x40')]?_0x42bb97[_0x6faf('0x3e')]:_0x5ac08c[_0x6faf('0x3a')];if(_0x4467f9['query'][_0x6faf('0x48')]){_0x42bb97[_0x6faf('0x49')]=[{'all':!![]}];}_0x42bb97=_[_0x6faf('0x45')]({},_0x42bb97,_0x4467f9['options']);return db[_0x6faf('0x36')][_0x6faf('0x50')](_0x42bb97)[_0x6faf('0x2d')](handleEntityNotFound(_0x58075d,null))[_0x6faf('0x2d')](respondWithResult(_0x58075d,null))[_0x6faf('0x4b')](handleError(_0x58075d,null));};exports['create']=function(_0x1c4aa1,_0xa08daa){return db[_0x6faf('0x36')][_0x6faf('0x51')](_0x1c4aa1[_0x6faf('0x52')],{})['then'](function(_0x232138){var _0x248de1=_0x1c4aa1[_0x6faf('0x53')][_0x6faf('0x2f')]({'plain':!![]});if(!_0x248de1)throw new Error(_0x6faf('0x54'));if(_0x248de1['role']===_0x6faf('0x53')){var _0x47dbfa=_0x232138[_0x6faf('0x2f')]({'plain':!![]});var _0x29c07e=_0x6faf('0x30');return db[_0x6faf('0x55')][_0x6faf('0x50')]({'where':{'name':_0x29c07e,'userProfileId':_0x248de1[_0x6faf('0x56')]},'raw':!![]})[_0x6faf('0x2d')](function(_0x55be48){if(_0x55be48&&_0x55be48['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x47dbfa[_0x6faf('0x34')],'resourceId':_0x47dbfa['id'],'type':_0x55be48[_0x6faf('0x34')],'sectionId':_0x55be48['id']},{})[_0x6faf('0x2d')](function(){return _0x232138;});}else{return _0x232138;}})['catch'](function(_0x483ba3){logger[_0x6faf('0x32')](_0x6faf('0x57'),_0x483ba3);throw _0x483ba3;});}return _0x232138;})['then'](respondWithResult(_0xa08daa,0xc9))[_0x6faf('0x4b')](handleError(_0xa08daa,null));};exports['update']=function(_0x396f59,_0x400359){if(_0x396f59[_0x6faf('0x52')]['id']){delete _0x396f59[_0x6faf('0x52')]['id'];}return db[_0x6faf('0x36')][_0x6faf('0x50')]({'where':{'id':_0x396f59[_0x6faf('0x4d')]['id']}})[_0x6faf('0x2d')](handleEntityNotFound(_0x400359,null))[_0x6faf('0x2d')](saveUpdates(_0x396f59['body'],null))[_0x6faf('0x2d')](respondWithResult(_0x400359,null))['catch'](handleError(_0x400359,null));};exports[_0x6faf('0x2e')]=function(_0x4b837e,_0x59def9){return db[_0x6faf('0x36')][_0x6faf('0x50')]({'where':{'id':_0x4b837e[_0x6faf('0x4d')]['id']}})[_0x6faf('0x2d')](handleEntityNotFound(_0x59def9,null))[_0x6faf('0x2d')](removeEntity(_0x59def9,null))[_0x6faf('0x4b')](handleError(_0x59def9,null));};exports['describe']=function(_0x1218ae,_0xb03255){return db[_0x6faf('0x36')][_0x6faf('0x58')]()[_0x6faf('0x2d')](respondWithResult(_0xb03255,null))[_0x6faf('0x4b')](handleError(_0xb03255,null));};exports['getMembers']=function(_0xc7e61,_0x14b3b1,_0xbe83a7){var _0x185077={'raw':!![],'where':{}},_0x297183={},_0x38c198;return db['SmsQueue']['findOne']({'where':{'id':_0xc7e61[_0x6faf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14b3b1,null))['then'](function(_0x2a5507){if(_0x2a5507){_0x38c198=_0x2a5507[_0x6faf('0x2f')]({'plain':!![]});_0x297183[_0x6faf('0x3a')]=_[_0x6faf('0x3d')](db[_0x6faf('0x59')][_0x6faf('0x37')]);_0x297183['query']=_['keys'](_0xc7e61[_0x6faf('0x3c')]);_0x297183[_0x6faf('0x4e')]=_['intersection'](_0x297183[_0x6faf('0x3a')],_0x297183[_0x6faf('0x3c')]);_0x185077[_0x6faf('0x3e')]=_[_0x6faf('0x4f')](_0x297183[_0x6faf('0x3a')],qs['fields'](_0xc7e61[_0x6faf('0x3c')][_0x6faf('0x3f')]));_0x185077[_0x6faf('0x3e')]=_0x185077['attributes'][_0x6faf('0x40')]?_0x185077['attributes']:_0x297183[_0x6faf('0x3a')];if(!_0xc7e61[_0x6faf('0x3c')][_0x6faf('0x41')]('nolimit')){_0x185077['limit']=qs[_0x6faf('0x25')](_0xc7e61[_0x6faf('0x3c')]['limit']);_0x185077['offset']=qs['offset'](_0xc7e61['query'][_0x6faf('0x23')]);}_0x185077[_0x6faf('0x5a')]=qs[_0x6faf('0x42')](_0xc7e61['query'][_0x6faf('0x42')]);_0x185077[_0x6faf('0x43')]=qs[_0x6faf('0x4e')](_[_0x6faf('0x44')](_0xc7e61[_0x6faf('0x3c')],_0x297183[_0x6faf('0x4e')]));_0x185077[_0x6faf('0x43')]['SmsQueueId']=_0x2a5507['id'];if(_0xc7e61[_0x6faf('0x3c')]['filter']){_0x185077[_0x6faf('0x43')]=_[_0x6faf('0x45')](_0x185077[_0x6faf('0x43')],{'$or':_['map'](_0x185077['attributes'],function(_0xa0702d){var _0x59f464={};_0x59f464[_0xa0702d]={'$like':'%'+_0xc7e61['query']['filter']+'%'};return _0x59f464;})});}_0x185077=_[_0x6faf('0x45')]({},_0x185077,_0xc7e61[_0x6faf('0x5b')]);return db['UserSmsQueue'][_0x6faf('0x4a')](_0x185077);}})[_0x6faf('0x2d')](function(_0x5bf0ae){if(_0x5bf0ae){return db[_0x6faf('0x5c')][_0x6faf('0x5d')]({'where':{'id':_['map'](_0x5bf0ae,_0x6faf('0x5e')),'role':_0x6faf('0x5f')},'attributes':['id',_0x6faf('0x34'),'smsPause',_0x6faf('0x60'),_0x6faf('0x61')]});}})[_0x6faf('0x2d')](function(_0x27192b){if(_0x27192b){return{'count':_0x27192b[_0x6faf('0x26')],'rows':_[_0x6faf('0x3b')](_0x27192b['rows'],function(_0x436506){return{'membername':_0x436506['name'],'UserId':_0x436506['id'],'queue_name':_0x38c198[_0x6faf('0x34')],'SmsQueueId':_0x38c198['id'],'interface':util['format'](_0x6faf('0x62'),_0x6faf('0x63'),_0x436506['name']),'penalty':0x0,'paused':_0x436506[_0x6faf('0x64')],'createdAt':_0x436506[_0x6faf('0x61')],'updatedAt':_0x436506[_0x6faf('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6faf('0x2d')](respondWithFilteredResult(_0x14b3b1,_0x185077))[_0x6faf('0x4b')](handleError(_0x14b3b1,null));};exports['getTeams']=function(_0x5ae0d7,_0x495143,_0x3a6cf8){var _0xb65f6b={};var _0x3d5908={};var _0x817f1a;var _0x51ffd7;return db[_0x6faf('0x36')][_0x6faf('0x65')]({'where':{'id':_0x5ae0d7[_0x6faf('0x4d')]['id']}})[_0x6faf('0x2d')](handleEntityNotFound(_0x495143,null))['then'](function(_0xe44899){if(_0xe44899){_0x817f1a=_0xe44899;_0x3d5908['model']=_[_0x6faf('0x3d')](db['Team'][_0x6faf('0x37')]);_0x3d5908['query']=_[_0x6faf('0x3d')](_0x5ae0d7[_0x6faf('0x3c')]);_0x3d5908[_0x6faf('0x4e')]=_[_0x6faf('0x4f')](_0x3d5908[_0x6faf('0x3a')],_0x3d5908[_0x6faf('0x3c')]);_0xb65f6b[_0x6faf('0x3e')]=_['intersection'](_0x3d5908[_0x6faf('0x3a')],qs[_0x6faf('0x3f')](_0x5ae0d7['query'][_0x6faf('0x3f')]));_0xb65f6b[_0x6faf('0x3e')]=_0xb65f6b['attributes'][_0x6faf('0x40')]?_0xb65f6b[_0x6faf('0x3e')]:_0x3d5908['model'];_0xb65f6b[_0x6faf('0x5a')]=qs[_0x6faf('0x42')](_0x5ae0d7[_0x6faf('0x3c')][_0x6faf('0x42')]);_0xb65f6b[_0x6faf('0x43')]=qs[_0x6faf('0x4e')](_[_0x6faf('0x44')](_0x5ae0d7[_0x6faf('0x3c')],_0x3d5908[_0x6faf('0x4e')]));if(_0x5ae0d7[_0x6faf('0x3c')][_0x6faf('0x47')]){_0xb65f6b['where']=_[_0x6faf('0x45')](_0xb65f6b[_0x6faf('0x43')],{'$or':_[_0x6faf('0x3b')](_0xb65f6b[_0x6faf('0x3e')],function(_0x598074){var _0x3506ef={};_0x3506ef[_0x598074]={'$like':'%'+_0x5ae0d7['query'][_0x6faf('0x47')]+'%'};return _0x3506ef;})});}_0xb65f6b=_[_0x6faf('0x45')]({},_0xb65f6b,_0x5ae0d7[_0x6faf('0x5b')]);return _0x817f1a['getTeams'](_0xb65f6b);}})[_0x6faf('0x2d')](function(_0x58a108){if(_0x58a108){_0x51ffd7=_0x58a108[_0x6faf('0x40')];if(!_0x5ae0d7[_0x6faf('0x3c')][_0x6faf('0x41')](_0x6faf('0x66'))){_0xb65f6b[_0x6faf('0x25')]=qs[_0x6faf('0x25')](_0x5ae0d7[_0x6faf('0x3c')][_0x6faf('0x25')]);_0xb65f6b[_0x6faf('0x23')]=qs[_0x6faf('0x23')](_0x5ae0d7[_0x6faf('0x3c')]['offset']);}return _0x817f1a[_0x6faf('0x67')](_0xb65f6b);}})[_0x6faf('0x2d')](function(_0x447384){if(_0x447384){return _0x447384?{'count':_0x51ffd7,'rows':_0x447384}:null;}})[_0x6faf('0x2d')](respondWithResult(_0x495143,null))[_0x6faf('0x4b')](handleError(_0x495143,null));};exports[_0x6faf('0x68')]=function(_0x552136,_0x26bcc3,_0x4cc7cd){var _0x17ce4c=_0x552136[_0x6faf('0x52')][_0x6faf('0x69')];return db[_0x6faf('0x6a')][_0x6faf('0x4a')]({'where':{'id':_0x17ce4c},'attributes':['id'],'include':[{'model':db[_0x6faf('0x5c')],'as':_0x6faf('0x6b'),'attributes':['id',_0x6faf('0x34'),_0x6faf('0x6c'),_0x6faf('0x6d'),_0x6faf('0x6e')],'raw':!![]}]})[_0x6faf('0x2d')](function(_0x2c106e){if(_0x2c106e){var _0x2aead2=_[_0x6faf('0x6f')](_0x2c106e,function(_0xb97d1a){var _0xbf71b6=_0xb97d1a['get']({'plain':!![]});return _0xbf71b6['Agents'];});return db['SmsQueue'][_0x6faf('0x50')]({'where':{'id':_0x552136['params']['id']}})[_0x6faf('0x2d')](function(_0xc093e6){return db[_0x6faf('0x70')]['transaction'](function(_0x143f21){return _0xc093e6[_0x6faf('0x68')](_0x17ce4c,{'transaction':_0x143f21})[_0x6faf('0x2d')](function(){return BPromise[_0x6faf('0x71')](_0x2aead2,function(_0x309257){return db[_0x6faf('0x59')]['findOrCreate']({'where':{'UserId':_0x309257['id'],'SmsQueueId':_0x552136[_0x6faf('0x4d')]['id']},'transaction':_0x143f21});});})[_0x6faf('0x2d')](function(){_0x2aead2[_0x6faf('0x72')](function(_0x4e9e25){socket['emit'](_0x6faf('0x73'),{'UserId':_0x4e9e25['id'],'SmsQueueId':_0xc093e6['id']});});});});});}})[_0x6faf('0x2d')](respondWithStatusCode(_0x26bcc3,null))[_0x6faf('0x4b')](handleError(_0x26bcc3,null));};exports[_0x6faf('0x74')]=function(_0x39b27e,_0x3da993,_0x141cb0){return db[_0x6faf('0x6a')][_0x6faf('0x4a')]({'where':{'id':_0x39b27e[_0x6faf('0x3c')][_0x6faf('0x69')]},'attributes':['id'],'include':[{'model':db[_0x6faf('0x5c')],'as':_0x6faf('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x6faf('0x2d')](handleEntityNotFound(_0x3da993,null))[_0x6faf('0x2d')](function(_0x472f39){var _0x787fe3=_[_0x6faf('0x3b')](_0x472f39,'id');var _0xe42a80=[];var _0x4ae87a=[];var _0x277db1=squel[_0x6faf('0x75')]();_0x277db1[_0x6faf('0x76')](_0x6faf('0x77'))['from'](_0x6faf('0x78'),'tq')['join'](_0x6faf('0x79'),'ut',_0x6faf('0x7a'))['where']('SmsQueueId\x20=\x20?',_0x39b27e[_0x6faf('0x4d')]['id']);for(var _0x14ff05=0x0;_0x14ff05<_0x472f39['length'];_0x14ff05+=0x1){let _0x38d6cd=_0x472f39[_0x14ff05];for(var _0x3ead64=0x0;_0x3ead64<_0x38d6cd['Agents']['length'];_0x3ead64+=0x1){let _0x32d7b4=_0x38d6cd[_0x6faf('0x6b')][_0x3ead64];var _0x9d8f13=_0x277db1['clone']();_0x9d8f13['where'](_0x6faf('0x7b'),_0x32d7b4['id']);_0x4ae87a[_0x6faf('0x7c')](db['sequelize'][_0x6faf('0x3c')](_0x9d8f13[_0x6faf('0x7d')](),{'type':db['sequelize'][_0x6faf('0x7e')][_0x6faf('0x7f')]})['then'](function(_0x34ca2a){if(_0x34ca2a['length']===0x1){return _0x32d7b4['id'];}else{var _0x4d243f=_[_0x6faf('0x80')](_[_0x6faf('0x3b')](_0x34ca2a,_0x6faf('0x81')),function(_0x1991e3){return _[_0x6faf('0x82')](_0x787fe3,_0x1991e3);});if(_0x4d243f){return _0x32d7b4['id'];}}}));}}return BPromise[_0x6faf('0x83')](_0x4ae87a)[_0x6faf('0x2d')](function(_0x4e131d){_0xe42a80=_(_0xe42a80)[_0x6faf('0x84')](_0x4e131d)[_0x6faf('0x85')]()[_0x6faf('0x86')]();return db[_0x6faf('0x36')]['find']({'where':{'id':_0x39b27e[_0x6faf('0x4d')]['id']}})[_0x6faf('0x2d')](function(_0x3c5953){return db[_0x6faf('0x70')][_0x6faf('0x87')](function(_0x436a2d){return _0x3c5953[_0x6faf('0x74')](_0x39b27e[_0x6faf('0x3c')][_0x6faf('0x69')],{'transaction':_0x436a2d})[_0x6faf('0x2d')](function(){if(!_['isEmpty'](_0xe42a80)){return _0x3c5953[_0x6faf('0x88')](_0xe42a80,{'transaction':_0x436a2d});}})[_0x6faf('0x2d')](function(){_0xe42a80['forEach'](function(_0x5de405){socket['emit'](_0x6faf('0x89'),{'UserId':_0x5de405,'SmsQueueId':_0x3c5953['id']});});});});});});})[_0x6faf('0x2d')](respondWithStatusCode(_0x3da993,null))[_0x6faf('0x4b')](handleError(_0x3da993,null));};exports['addAgents']=function(_0x148215,_0x2f1dbe,_0x284253){return db['SmsQueue'][_0x6faf('0x50')]({'where':{'id':_0x148215[_0x6faf('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f1dbe,null))[_0x6faf('0x2d')](function(_0xd2736){if(_0xd2736){return _0xd2736[_0x6faf('0x8a')](_0x148215[_0x6faf('0x52')]['ids'],_[_0x6faf('0x8b')](_0x148215['body'],[_0x6faf('0x69'),'id'])||{})[_0x6faf('0x8c')](function(_0x342d31){for(var _0x3a329e=0x0;_0x3a329e<_0x148215[_0x6faf('0x52')][_0x6faf('0x69')][_0x6faf('0x40')];_0x3a329e+=0x1){socket[_0x6faf('0x8d')]('userSmsQueue:save',{'UserId':Number(_0x148215[_0x6faf('0x52')][_0x6faf('0x69')][_0x3a329e]),'SmsQueueId':Number(_0x148215[_0x6faf('0x4d')]['id'])});}return _0x342d31;});}})['then'](respondWithResult(_0x2f1dbe,null))[_0x6faf('0x4b')](handleError(_0x2f1dbe,null));};exports[_0x6faf('0x88')]=function(_0x329c64,_0x5b5e94,_0x7b4db6){return db['SmsQueue'][_0x6faf('0x50')]({'where':{'id':_0x329c64['params']['id']}})[_0x6faf('0x2d')](handleEntityNotFound(_0x5b5e94,null))[_0x6faf('0x2d')](function(_0x49b7fe){if(_0x49b7fe){return _0x49b7fe[_0x6faf('0x88')](_0x329c64[_0x6faf('0x3c')][_0x6faf('0x69')])[_0x6faf('0x2d')](function(){if(_[_0x6faf('0x8e')](_0x329c64['query'][_0x6faf('0x69')])){for(var _0x3b9f65=0x0;_0x3b9f65<_0x329c64[_0x6faf('0x3c')][_0x6faf('0x69')]['length'];_0x3b9f65+=0x1){socket[_0x6faf('0x8d')](_0x6faf('0x89'),{'UserId':Number(_0x329c64[_0x6faf('0x3c')][_0x6faf('0x69')][_0x3b9f65]),'SmsQueueId':Number(_0x329c64[_0x6faf('0x4d')]['id'])});}}else{socket['emit'](_0x6faf('0x89'),{'UserId':Number(_0x329c64['query'][_0x6faf('0x69')]),'SmsQueueId':Number(_0x329c64['params']['id'])});}});}})[_0x6faf('0x2d')](respondWithStatusCode(_0x5b5e94,null))['catch'](handleError(_0x5b5e94,null));};exports[_0x6faf('0x8f')]=function(_0x420f62,_0x212439,_0x3541f3){var _0x42c6fd={};var _0x9e8906={};var _0xd90f15;var _0x5c7aea;return db[_0x6faf('0x36')][_0x6faf('0x65')]({'where':{'id':_0x420f62[_0x6faf('0x4d')]['id']}})[_0x6faf('0x2d')](handleEntityNotFound(_0x212439,null))[_0x6faf('0x2d')](function(_0x365e6d){if(_0x365e6d){_0xd90f15=_0x365e6d;_0x9e8906[_0x6faf('0x3a')]=_['keys'](db['User']['rawAttributes']);_0x9e8906[_0x6faf('0x3c')]=_[_0x6faf('0x3d')](_0x420f62[_0x6faf('0x3c')]);_0x9e8906['filters']=_[_0x6faf('0x4f')](_0x9e8906['model'],_0x9e8906[_0x6faf('0x3c')]);_0x42c6fd[_0x6faf('0x3e')]=_[_0x6faf('0x4f')](_0x9e8906[_0x6faf('0x3a')],qs['fields'](_0x420f62[_0x6faf('0x3c')][_0x6faf('0x3f')]));_0x42c6fd[_0x6faf('0x3e')]=_0x42c6fd['attributes'][_0x6faf('0x40')]?_0x42c6fd[_0x6faf('0x3e')]:_0x9e8906['model'];_0x42c6fd[_0x6faf('0x5a')]=qs[_0x6faf('0x42')](_0x420f62[_0x6faf('0x3c')][_0x6faf('0x42')]);_0x42c6fd[_0x6faf('0x43')]=qs[_0x6faf('0x4e')](_[_0x6faf('0x44')](_0x420f62[_0x6faf('0x3c')],_0x9e8906[_0x6faf('0x4e')]));if(_0x420f62[_0x6faf('0x3c')][_0x6faf('0x47')]){_0x42c6fd[_0x6faf('0x43')]=_[_0x6faf('0x45')](_0x42c6fd['where'],{'$or':_['map'](_0x42c6fd[_0x6faf('0x3e')],function(_0x530f48){var _0x34f4ef={};_0x34f4ef[_0x530f48]={'$like':'%'+_0x420f62[_0x6faf('0x3c')][_0x6faf('0x47')]+'%'};return _0x34f4ef;})});}_0x42c6fd=_[_0x6faf('0x45')]({},_0x42c6fd,_0x420f62[_0x6faf('0x5b')]);return _0xd90f15[_0x6faf('0x8f')](_0x42c6fd);}})[_0x6faf('0x2d')](function(_0xd3bf0e){if(_0xd3bf0e){_0x5c7aea=_0xd3bf0e[_0x6faf('0x40')];if(!_0x420f62[_0x6faf('0x3c')][_0x6faf('0x41')](_0x6faf('0x66'))){_0x42c6fd['limit']=qs[_0x6faf('0x25')](_0x420f62[_0x6faf('0x3c')][_0x6faf('0x25')]);_0x42c6fd[_0x6faf('0x23')]=qs[_0x6faf('0x23')](_0x420f62[_0x6faf('0x3c')][_0x6faf('0x23')]);}return _0xd90f15[_0x6faf('0x8f')](_0x42c6fd);}})[_0x6faf('0x2d')](function(_0x13cafb){if(_0x13cafb){return _0x13cafb?{'count':_0x5c7aea,'rows':_0x13cafb}:null;}})[_0x6faf('0x2d')](respondWithResult(_0x212439,null))[_0x6faf('0x4b')](handleError(_0x212439,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 93ab731..bc714a1 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 _0x7643=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x7643,0x1b3));var _0x3764=function(_0x374785,_0x4f71b8){_0x374785=_0x374785-0x0;var _0x572c40=_0x7643[_0x374785];return _0x572c40;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x3764('0x0'))['db'][_0x3764('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3764('0x2')](0x0);var events={'afterCreate':_0x3764('0x3'),'afterUpdate':_0x3764('0x4'),'afterDestroy':_0x3764('0x5')};function emitEvent(_0x3128d7){return function(_0x2cd80a,_0x53573e,_0x4d8257){SmsQueueEvents[_0x3764('0x6')](_0x3128d7+':'+_0x2cd80a['id'],_0x2cd80a);SmsQueueEvents['emit'](_0x3128d7,_0x2cd80a);_0x4d8257(null);};}for(var e in events){if(events[_0x3764('0x7')](e)){var event=events[e];SmsQueue[_0x3764('0x8')](e,emitEvent(event));}}module[_0x3764('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x769a=['update','remove','emit','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save'];(function(_0xd97ecc,_0x5d6a2f){var _0xa70368=function(_0x480cee){while(--_0x480cee){_0xd97ecc['push'](_0xd97ecc['shift']());}};_0xa70368(++_0x5d6a2f);}(_0x769a,0x199));var _0xa769=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0x769a[_0x414655];return _0x237884;};'use strict';var EventEmitter=require(_0xa769('0x0'));var SmsQueue=require(_0xa769('0x1'))['db'][_0xa769('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa769('0x3')](0x0);var events={'afterCreate':_0xa769('0x4'),'afterUpdate':_0xa769('0x5'),'afterDestroy':_0xa769('0x6')};function emitEvent(_0xc42200){return function(_0x4a38e6,_0x5c703f,_0x2a8124){SmsQueueEvents[_0xa769('0x7')](_0xc42200+':'+_0x4a38e6['id'],_0x4a38e6);SmsQueueEvents['emit'](_0xc42200,_0x4a38e6);_0x2a8124(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xa769('0x8')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8cb2912..9522661 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 _0x7b23=['request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','moment','bluebird'];(function(_0x3ee168,_0x28dbad){var _0x2d50a6=function(_0x55e812){while(--_0x55e812){_0x3ee168['push'](_0x3ee168['shift']());}};_0x2d50a6(++_0x28dbad);}(_0x7b23,0x104));var _0x37b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7b23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x37b2('0x0'));var util=require(_0x37b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37b2('0x2'));var BPromise=require(_0x37b2('0x3'));var rp=require(_0x37b2('0x4'));var fs=require('fs');var path=require(_0x37b2('0x5'));var rimraf=require(_0x37b2('0x6'));var config=require(_0x37b2('0x7'));var attributes=require('./smsQueue.attributes');module[_0x37b2('0x8')]=function(_0x232379,_0x1e9e35){return _0x232379[_0x37b2('0x9')](_0x37b2('0xa'),attributes,{'tableName':_0x37b2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeaa6=['rimraf','./smsQueue.attributes','define','SmsQueue','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0xcdc568,_0x153b6b){var _0x2c750d=function(_0x577f8a){while(--_0x577f8a){_0xcdc568['push'](_0xcdc568['shift']());}};_0x2c750d(++_0x153b6b);}(_0xeaa6,0xcc));var _0x6eaa=function(_0x308584,_0x25e443){_0x308584=_0x308584-0x0;var _0x57060f=_0xeaa6[_0x308584];return _0x57060f;};'use strict';var _=require(_0x6eaa('0x0'));var util=require(_0x6eaa('0x1'));var logger=require(_0x6eaa('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6eaa('0x3'));var rp=require(_0x6eaa('0x4'));var fs=require('fs');var path=require(_0x6eaa('0x5'));var rimraf=require(_0x6eaa('0x6'));var config=require('../../config/environment');var attributes=require(_0x6eaa('0x7'));module['exports']=function(_0x2aa7e1,_0x5d597f){return _0x2aa7e1[_0x6eaa('0x8')](_0x6eaa('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 0a31cb8..e5002ee 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 _0xa974=['map','model','attributes','debug','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','include'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0xa974,0x13e));var _0x4a97=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xa974[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x4a97('0x0'));var util=require('util');var moment=require(_0x4a97('0x1'));var BPromise=require(_0x4a97('0x2'));var rs=require(_0x4a97('0x3'));var fs=require('fs');var Redis=require(_0x4a97('0x4'));var db=require(_0x4a97('0x5'))['db'];var utils=require(_0x4a97('0x6'));var logger=require('../../config/logger')(_0x4a97('0x7'));var config=require(_0x4a97('0x8'));var jayson=require(_0x4a97('0x9'));var client=jayson[_0x4a97('0xa')]['http']({'port':0x232a});config[_0x4a97('0xb')]=_[_0x4a97('0xc')](config[_0x4a97('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a97('0xd'))(new Redis(config[_0x4a97('0xb')]));require(_0x4a97('0xe'))['register'](socket);function respondWithRpcPromise(_0xe6ba77,_0x2c9357,_0x48cbdf){return new BPromise(function(_0x37551e,_0x10a7bd){return client[_0x4a97('0xf')](_0xe6ba77,_0x48cbdf)[_0x4a97('0x10')](function(_0x5157df){logger[_0x4a97('0x11')](_0x4a97('0x12'),_0x2c9357,_0x4a97('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2c9357,_0x4a97('0x13'),JSON[_0x4a97('0x14')](_0x5157df));if(_0x5157df['error']){if(_0x5157df[_0x4a97('0x15')][_0x4a97('0x16')]===0x1f4){logger[_0x4a97('0x15')](_0x4a97('0x12'),_0x2c9357,_0x5157df[_0x4a97('0x15')][_0x4a97('0x17')]);return _0x10a7bd(_0x5157df['error'][_0x4a97('0x17')]);}logger[_0x4a97('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2c9357,_0x5157df['error'][_0x4a97('0x17')]);return _0x37551e(_0x5157df[_0x4a97('0x15')][_0x4a97('0x17')]);}else{logger[_0x4a97('0x11')](_0x4a97('0x12'),_0x2c9357,'request\x20sent');_0x37551e(_0x5157df[_0x4a97('0x18')][_0x4a97('0x17')]);}})[_0x4a97('0x19')](function(_0x258062){logger['error'](_0x4a97('0x12'),_0x2c9357,_0x258062);_0x10a7bd(_0x258062);});});}exports[_0x4a97('0x1a')]=function(_0x52660e){var _0x1fa306=this;return new Promise(function(_0x27aec6,_0x38bd39){return db[_0x4a97('0x1b')][_0x4a97('0x1c')]({'raw':_0x52660e[_0x4a97('0x1d')]?_0x52660e['options'][_0x4a97('0x1e')]===undefined?!![]:![]:!![],'where':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')][_0x4a97('0x1f')]||null:null,'attributes':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')]['attributes']||null:null,'limit':_0x52660e[_0x4a97('0x1d')]?_0x52660e[_0x4a97('0x1d')]['limit']||null:null,'include':_0x52660e['options']?_0x52660e['options'][_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x52660e[_0x4a97('0x1d')][_0x4a97('0x20')],function(_0x8b11da){return{'model':db[_0x8b11da[_0x4a97('0x22')]],'as':_0x8b11da['as'],'attributes':_0x8b11da[_0x4a97('0x23')],'include':_0x8b11da[_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x8b11da[_0x4a97('0x20')],function(_0x309d0c){return{'model':db[_0x309d0c[_0x4a97('0x22')]],'as':_0x309d0c['as'],'attributes':_0x309d0c['attributes'],'include':_0x309d0c['include']?_[_0x4a97('0x21')](_0x309d0c[_0x4a97('0x20')],function(_0x471e85){return{'model':db[_0x471e85[_0x4a97('0x22')]],'as':_0x471e85['as'],'attributes':_0x471e85[_0x4a97('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4a97('0x10')](function(_0x1cdf18){logger['info']('GetSmsQueue',_0x52660e);logger[_0x4a97('0x24')](_0x4a97('0x1a'),_0x52660e,JSON['stringify'](_0x1cdf18));_0x27aec6(_0x1cdf18);})[_0x4a97('0x19')](function(_0xeb882d){logger['error'](_0x4a97('0x1a'),_0xeb882d[_0x4a97('0x17')],_0x52660e);_0x38bd39(_0x1fa306[_0x4a97('0x15')](0x1f4,_0xeb882d[_0x4a97('0x17')]));});});};exports[_0x4a97('0x25')]=function(_0x11cb42){var _0x5f275e=this;return new Promise(function(_0x2e088c,_0x1d66a9){return db['SmsQueue'][_0x4a97('0x26')]({'raw':_0x11cb42['options']?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x1e')]===undefined?!![]:![]:!![],'where':_0x11cb42[_0x4a97('0x1d')]?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x1f')]||null:null,'attributes':_0x11cb42['options']?_0x11cb42[_0x4a97('0x1d')][_0x4a97('0x23')]||null:null,'include':_0x11cb42[_0x4a97('0x1d')]?_0x11cb42['options'][_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x11cb42['options'][_0x4a97('0x20')],function(_0x70740f){return{'model':db[_0x70740f['model']],'as':_0x70740f['as'],'attributes':_0x70740f[_0x4a97('0x23')],'include':_0x70740f[_0x4a97('0x20')]?_['map'](_0x70740f[_0x4a97('0x20')],function(_0x223333){return{'model':db[_0x223333['model']],'as':_0x223333['as'],'attributes':_0x223333[_0x4a97('0x23')],'include':_0x223333[_0x4a97('0x20')]?_[_0x4a97('0x21')](_0x223333[_0x4a97('0x20')],function(_0x42afd5){return{'model':db[_0x42afd5[_0x4a97('0x22')]],'as':_0x42afd5['as'],'attributes':_0x42afd5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58e184){logger[_0x4a97('0x11')]('ShowSmsQueue',_0x11cb42);logger[_0x4a97('0x24')]('ShowSmsQueue',_0x11cb42,JSON[_0x4a97('0x14')](_0x58e184));_0x2e088c(_0x58e184);})[_0x4a97('0x19')](function(_0x400dbf){logger[_0x4a97('0x15')](_0x4a97('0x25'),_0x400dbf[_0x4a97('0x17')],_0x11cb42);_0x1d66a9(_0x5f275e[_0x4a97('0x15')](0x1f4,_0x400dbf['message']));});});}; \ No newline at end of file +var _0xea03=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','map','model','find','ShowSmsQueue','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3dd2be,_0x29d74f){var _0x4415d0=function(_0x169119){while(--_0x169119){_0x3dd2be['push'](_0x3dd2be['shift']());}};_0x4415d0(++_0x29d74f);}(_0xea03,0x6d));var _0x3ea0=function(_0x2f0f90,_0x411945){_0x2f0f90=_0x2f0f90-0x0;var _0x3da03a=_0xea03[_0x2f0f90];return _0x3da03a;};'use strict';var _=require('lodash');var util=require(_0x3ea0('0x0'));var moment=require(_0x3ea0('0x1'));var BPromise=require(_0x3ea0('0x2'));var rs=require(_0x3ea0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ea0('0x4'))['db'];var utils=require(_0x3ea0('0x5'));var logger=require(_0x3ea0('0x6'))('rpc');var config=require(_0x3ea0('0x7'));var jayson=require(_0x3ea0('0x8'));var client=jayson['client'][_0x3ea0('0x9')]({'port':0x232a});config[_0x3ea0('0xa')]=_[_0x3ea0('0xb')](config[_0x3ea0('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ea0('0xa')]));require(_0x3ea0('0xc'))[_0x3ea0('0xd')](socket);function respondWithRpcPromise(_0x1f9fa6,_0x1d0bf9,_0x364d28){return new BPromise(function(_0x378645,_0x39081f){return client[_0x3ea0('0xe')](_0x1f9fa6,_0x364d28)[_0x3ea0('0xf')](function(_0x406c81){logger[_0x3ea0('0x10')](_0x3ea0('0x11'),_0x1d0bf9,_0x3ea0('0x12'));logger[_0x3ea0('0x13')](_0x3ea0('0x14'),_0x1d0bf9,_0x3ea0('0x12'),JSON[_0x3ea0('0x15')](_0x406c81));if(_0x406c81[_0x3ea0('0x16')]){if(_0x406c81[_0x3ea0('0x16')]['code']===0x1f4){logger[_0x3ea0('0x16')](_0x3ea0('0x11'),_0x1d0bf9,_0x406c81[_0x3ea0('0x16')]['message']);return _0x39081f(_0x406c81[_0x3ea0('0x16')]['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1d0bf9,_0x406c81[_0x3ea0('0x16')]['message']);return _0x378645(_0x406c81[_0x3ea0('0x16')][_0x3ea0('0x17')]);}else{logger['info'](_0x3ea0('0x11'),_0x1d0bf9,'request\x20sent');_0x378645(_0x406c81[_0x3ea0('0x18')][_0x3ea0('0x17')]);}})[_0x3ea0('0x19')](function(_0x4bcd17){logger[_0x3ea0('0x16')](_0x3ea0('0x11'),_0x1d0bf9,_0x4bcd17);_0x39081f(_0x4bcd17);});});}exports[_0x3ea0('0x1a')]=function(_0x1c6afd){var _0x4db365=this;return new Promise(function(_0x4b4aa5,_0x40fd9e){return db[_0x3ea0('0x1b')][_0x3ea0('0x1c')]({'raw':_0x1c6afd['options']?_0x1c6afd[_0x3ea0('0x1d')][_0x3ea0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c6afd[_0x3ea0('0x1d')]?_0x1c6afd['options'][_0x3ea0('0x1f')]||null:null,'attributes':_0x1c6afd['options']?_0x1c6afd[_0x3ea0('0x1d')][_0x3ea0('0x20')]||null:null,'limit':_0x1c6afd[_0x3ea0('0x1d')]?_0x1c6afd['options']['limit']||null:null,'include':_0x1c6afd[_0x3ea0('0x1d')]?_0x1c6afd[_0x3ea0('0x1d')][_0x3ea0('0x21')]?_[_0x3ea0('0x22')](_0x1c6afd['options']['include'],function(_0xb08b60){return{'model':db[_0xb08b60['model']],'as':_0xb08b60['as'],'attributes':_0xb08b60['attributes'],'include':_0xb08b60[_0x3ea0('0x21')]?_[_0x3ea0('0x22')](_0xb08b60['include'],function(_0x40c632){return{'model':db[_0x40c632[_0x3ea0('0x23')]],'as':_0x40c632['as'],'attributes':_0x40c632[_0x3ea0('0x20')],'include':_0x40c632['include']?_[_0x3ea0('0x22')](_0x40c632[_0x3ea0('0x21')],function(_0x38f398){return{'model':db[_0x38f398[_0x3ea0('0x23')]],'as':_0x38f398['as'],'attributes':_0x38f398[_0x3ea0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ea0('0xf')](function(_0x3de3a9){logger[_0x3ea0('0x10')](_0x3ea0('0x1a'),_0x1c6afd);logger[_0x3ea0('0x13')](_0x3ea0('0x1a'),_0x1c6afd,JSON[_0x3ea0('0x15')](_0x3de3a9));_0x4b4aa5(_0x3de3a9);})[_0x3ea0('0x19')](function(_0x2cba81){logger['error'](_0x3ea0('0x1a'),_0x2cba81[_0x3ea0('0x17')],_0x1c6afd);_0x40fd9e(_0x4db365[_0x3ea0('0x16')](0x1f4,_0x2cba81['message']));});});};exports['ShowSmsQueue']=function(_0x1d177c){var _0x484449=this;return new Promise(function(_0x321eb8,_0x316270){return db['SmsQueue'][_0x3ea0('0x24')]({'raw':_0x1d177c[_0x3ea0('0x1d')]?_0x1d177c[_0x3ea0('0x1d')][_0x3ea0('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d177c['options']?_0x1d177c[_0x3ea0('0x1d')]['where']||null:null,'attributes':_0x1d177c['options']?_0x1d177c['options'][_0x3ea0('0x20')]||null:null,'include':_0x1d177c[_0x3ea0('0x1d')]?_0x1d177c[_0x3ea0('0x1d')][_0x3ea0('0x21')]?_[_0x3ea0('0x22')](_0x1d177c['options'][_0x3ea0('0x21')],function(_0x532945){return{'model':db[_0x532945[_0x3ea0('0x23')]],'as':_0x532945['as'],'attributes':_0x532945['attributes'],'include':_0x532945['include']?_['map'](_0x532945[_0x3ea0('0x21')],function(_0x5c632b){return{'model':db[_0x5c632b[_0x3ea0('0x23')]],'as':_0x5c632b['as'],'attributes':_0x5c632b[_0x3ea0('0x20')],'include':_0x5c632b['include']?_['map'](_0x5c632b[_0x3ea0('0x21')],function(_0x1e6bd6){return{'model':db[_0x1e6bd6[_0x3ea0('0x23')]],'as':_0x1e6bd6['as'],'attributes':_0x1e6bd6[_0x3ea0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3ea0('0xf')](function(_0x3b1145){logger[_0x3ea0('0x10')](_0x3ea0('0x25'),_0x1d177c);logger[_0x3ea0('0x13')](_0x3ea0('0x25'),_0x1d177c,JSON[_0x3ea0('0x15')](_0x3b1145));_0x321eb8(_0x3b1145);})[_0x3ea0('0x19')](function(_0x516b81){logger[_0x3ea0('0x16')](_0x3ea0('0x25'),_0x516b81['message'],_0x1d177c);_0x316270(_0x484449[_0x3ea0('0x16')](0x1f4,_0x516b81[_0x3ea0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e5a2170..bd68fe3 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 _0xd613=['removeListener','register','length','smsQueue:','./smsQueue.events','remove','update'];(function(_0x4b9861,_0x405bc6){var _0x5188c1=function(_0x5c3600){while(--_0x5c3600){_0x4b9861['push'](_0x4b9861['shift']());}};_0x5188c1(++_0x405bc6);}(_0xd613,0x1af));var _0x3d61=function(_0x429806,_0x9471b7){_0x429806=_0x429806-0x0;var _0x4a056d=_0xd613[_0x429806];return _0x4a056d;};'use strict';var SmsQueueEvents=require(_0x3d61('0x0'));var events=['save',_0x3d61('0x1'),_0x3d61('0x2')];function createListener(_0x3653e2,_0x3bcd7e){return function(_0x5d5cdd){_0x3bcd7e['emit'](_0x3653e2,_0x5d5cdd);};}function removeListener(_0x553176,_0x1172be){return function(){SmsQueueEvents[_0x3d61('0x3')](_0x553176,_0x1172be);};}exports[_0x3d61('0x4')]=function(_0x3d31e6){for(var _0x4b8489=0x0,_0x1a57fd=events[_0x3d61('0x5')];_0x4b8489<_0x1a57fd;_0x4b8489++){var _0x435f2a=events[_0x4b8489];var _0x2914e6=createListener(_0x3d61('0x6')+_0x435f2a,_0x3d31e6);SmsQueueEvents['on'](_0x435f2a,_0x2914e6);}}; \ No newline at end of file +var _0xa3d9=['removeListener','smsQueue:','save','remove','emit'];(function(_0x56af79,_0x1175dd){var _0x1d09aa=function(_0x2cc015){while(--_0x2cc015){_0x56af79['push'](_0x56af79['shift']());}};_0x1d09aa(++_0x1175dd);}(_0xa3d9,0x6b));var _0x9a3d=function(_0x436366,_0x4e627d){_0x436366=_0x436366-0x0;var _0x2c3b6e=_0xa3d9[_0x436366];return _0x2c3b6e;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x9a3d('0x0'),_0x9a3d('0x1'),'update'];function createListener(_0x3a5dd5,_0x470b65){return function(_0x2e22f6){_0x470b65[_0x9a3d('0x2')](_0x3a5dd5,_0x2e22f6);};}function removeListener(_0x2459aa,_0x6ba964){return function(){SmsQueueEvents[_0x9a3d('0x3')](_0x2459aa,_0x6ba964);};}exports['register']=function(_0xfeda77){for(var _0x439050=0x0,_0x2d46eb=events['length'];_0x439050<_0x2d46eb;_0x439050++){var _0x59a639=events[_0x439050];var _0x4b3158=createListener(_0x9a3d('0x4')+_0x59a639,_0xfeda77);SmsQueueEvents['on'](_0x59a639,_0x4b3158);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e056e9f..a505521 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 _0x315c=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4eeacc,_0x59eb9d){var _0x54c266=function(_0x5466ae){while(--_0x5466ae){_0x4eeacc['push'](_0x4eeacc['shift']());}};_0x54c266(++_0x59eb9d);}(_0x315c,0xe1));var _0xc315=function(_0x52119a,_0xa099cc){_0x52119a=_0x52119a-0x0;var _0xde2a5c=_0x315c[_0x52119a];return _0xde2a5c;};'use strict';var multer=require(_0xc315('0x0'));var util=require(_0xc315('0x1'));var path=require('path');var timeout=require(_0xc315('0x2'));var express=require('express');var router=express[_0xc315('0x3')]();var fs_extra=require(_0xc315('0x4'));var auth=require(_0xc315('0x5'));var interaction=require(_0xc315('0x6'));var config=require(_0xc315('0x7'));var controller=require(_0xc315('0x8'));router[_0xc315('0x9')]('/',auth[_0xc315('0xa')](),controller[_0xc315('0xb')]);router[_0xc315('0x9')](_0xc315('0xc'),auth[_0xc315('0xa')](),controller[_0xc315('0xd')]);router[_0xc315('0x9')](_0xc315('0xe'),auth['isAuthenticated'](),controller[_0xc315('0xf')]);router[_0xc315('0x10')]('/',auth[_0xc315('0xa')](),controller['create']);router[_0xc315('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc315('0x12')]);router[_0xc315('0x13')]('/:id',auth[_0xc315('0xa')](),controller['destroy']);module[_0xc315('0x14')]=router; \ No newline at end of file +var _0x49c4=['/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x3f1c2b,_0xc288d6){var _0xd5e7be=function(_0x1575e7){while(--_0x1575e7){_0x3f1c2b['push'](_0x3f1c2b['shift']());}};_0xd5e7be(++_0xc288d6);}(_0x49c4,0x9b));var _0x449c=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x49c4[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0x449c('0x0'));var util=require('util');var path=require(_0x449c('0x1'));var timeout=require(_0x449c('0x2'));var express=require(_0x449c('0x3'));var router=express[_0x449c('0x4')]();var fs_extra=require(_0x449c('0x5'));var auth=require(_0x449c('0x6'));var interaction=require(_0x449c('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x449c('0x8')]('/',auth[_0x449c('0x9')](),controller[_0x449c('0xa')]);router[_0x449c('0x8')](_0x449c('0xb'),auth[_0x449c('0x9')](),controller[_0x449c('0xc')]);router[_0x449c('0x8')](_0x449c('0xd'),auth[_0x449c('0x9')](),controller[_0x449c('0xe')]);router[_0x449c('0xf')]('/',auth[_0x449c('0x9')](),controller[_0x449c('0x10')]);router[_0x449c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x449c('0x12')]);router[_0x449c('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x449c('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 acefb19..24c19da 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 _0xd4f4=['moment','STRING','DATE'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xd4f4,0x1bc));var _0x4d4f=function(_0x1c3c75,_0x178112){_0x1c3c75=_0x1c3c75-0x0;var _0x1433ee=_0xd4f4[_0x1c3c75];return _0x1433ee;};'use strict';var moment=require(_0x4d4f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4d4f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x4d4f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4d4f('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb3f3=['sequelize','STRING','DATE'];(function(_0xcd0e3c,_0x50ac64){var _0x333329=function(_0x59d4f1){while(--_0x59d4f1){_0xcd0e3c['push'](_0xcd0e3c['shift']());}};_0x333329(++_0x50ac64);}(_0xb3f3,0xcf));var _0x3b3f=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0xb3f3[_0x2136a6];return _0x55b948;};'use strict';var moment=require('moment');var Sequelize=require(_0x3b3f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3b3f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3b3f('0x1')]},'joinAt':{'type':Sequelize[_0x3b3f('0x2')]},'leaveAt':{'type':Sequelize[_0x3b3f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3b3f('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index c7c4c3d..5b13631 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 _0x98a4=['sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','map','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','SmsQueueReport','include','findAll','catch','show','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xcaf756,_0x3fc049){var _0x378827=function(_0x42f799){while(--_0x42f799){_0xcaf756['push'](_0xcaf756['shift']());}};_0x378827(++_0x3fc049);}(_0x98a4,0x1b2));var _0x498a=function(_0x137f05,_0x9f575e){_0x137f05=_0x137f05-0x0;var _0x2c728e=_0x98a4[_0x137f05];return _0x2c728e;};'use strict';var emlformat=require(_0x498a('0x0'));var rimraf=require(_0x498a('0x1'));var zipdir=require(_0x498a('0x2'));var jsonpatch=require(_0x498a('0x3'));var rp=require(_0x498a('0x4'));var moment=require(_0x498a('0x5'));var BPromise=require(_0x498a('0x6'));var Mustache=require(_0x498a('0x7'));var util=require('util');var path=require(_0x498a('0x8'));var sox=require(_0x498a('0x9'));var csv=require(_0x498a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x498a('0xb'));var _=require(_0x498a('0xc'));var squel=require(_0x498a('0xd'));var crypto=require(_0x498a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x498a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x498a('0x10'));var Papa=require(_0x498a('0x11'));var Redis=require(_0x498a('0x12'));var authService=require(_0x498a('0x13'));var qs=require(_0x498a('0x14'));var as=require(_0x498a('0x15'));var hardwareService=require(_0x498a('0x16'));var logger=require(_0x498a('0x17'))(_0x498a('0x18'));var utils=require(_0x498a('0x19'));var config=require(_0x498a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x498a('0x1b'))['db'];function respondWithStatusCode(_0x1e633a,_0x136902){_0x136902=_0x136902||0xcc;return function(_0x469d61){if(_0x469d61){return _0x1e633a[_0x498a('0x1c')](_0x136902);}return _0x1e633a['status'](_0x136902)['end']();};}function respondWithResult(_0x36269d,_0xce9c18){_0xce9c18=_0xce9c18||0xc8;return function(_0x6e1913){if(_0x6e1913){return _0x36269d[_0x498a('0x1d')](_0xce9c18)[_0x498a('0x1e')](_0x6e1913);}};}function respondWithFilteredResult(_0x54f68b,_0x50cc83){return function(_0x47dc89){if(_0x47dc89){var _0x32a90c=typeof _0x50cc83[_0x498a('0x1f')]===_0x498a('0x20')&&typeof _0x50cc83[_0x498a('0x21')]===_0x498a('0x20');var _0x5d1ca4=_0x47dc89[_0x498a('0x22')];var _0x29f6f8=_0x32a90c?0x0:_0x50cc83[_0x498a('0x1f')];var _0x2e8e97=_0x32a90c?_0x47dc89[_0x498a('0x22')]:_0x50cc83[_0x498a('0x1f')]+_0x50cc83[_0x498a('0x21')];var _0x410110;if(_0x2e8e97>=_0x5d1ca4){_0x2e8e97=_0x5d1ca4;_0x410110=0xc8;}else{_0x410110=0xce;}_0x54f68b[_0x498a('0x1d')](_0x410110);return _0x54f68b[_0x498a('0x23')](_0x498a('0x24'),_0x29f6f8+'-'+_0x2e8e97+'/'+_0x5d1ca4)[_0x498a('0x1e')](_0x47dc89);}return null;};}function patchUpdates(_0x551920){return function(_0x413e25){try{jsonpatch[_0x498a('0x25')](_0x413e25,_0x551920,!![]);}catch(_0x1e8de0){return BPromise[_0x498a('0x26')](_0x1e8de0);}return _0x413e25[_0x498a('0x27')]();};}function saveUpdates(_0x20f736,_0x56b125){return function(_0x5d8678){if(_0x5d8678){return _0x5d8678[_0x498a('0x28')](_0x20f736)[_0x498a('0x29')](function(_0x4e7776){return _0x4e7776;});}return null;};}function removeEntity(_0x19c770,_0x5c6df2){return function(_0x2c05d8){if(_0x2c05d8){return _0x2c05d8[_0x498a('0x2a')]()[_0x498a('0x29')](function(){_0x19c770[_0x498a('0x1d')](0xcc)[_0x498a('0x2b')]();});}};}function handleEntityNotFound(_0x9a9c8e,_0x41dde3){return function(_0x3397ee){if(!_0x3397ee){_0x9a9c8e[_0x498a('0x1c')](0x194);}return _0x3397ee;};}function handleError(_0x301f56,_0x235a48){_0x235a48=_0x235a48||0x1f4;return function(_0x211b61){logger['error'](_0x211b61['stack']);if(_0x211b61[_0x498a('0x2c')]){delete _0x211b61[_0x498a('0x2c')];}_0x301f56[_0x498a('0x1d')](_0x235a48)['send'](_0x211b61);};}exports['index']=function(_0x3f3393,_0xd79d40){var _0x59cd93={},_0x3d4fa3={},_0xb99a12={'count':0x0,'rows':[]};var _0xed5201=_[_0x498a('0x2d')](db['SmsQueueReport'][_0x498a('0x2e')],function(_0x5f1727){return{'name':_0x5f1727['fieldName'],'type':_0x5f1727['type'][_0x498a('0x2f')]};});_0x3d4fa3[_0x498a('0x30')]=_[_0x498a('0x2d')](_0xed5201,_0x498a('0x2c'));_0x3d4fa3['query']=_[_0x498a('0x31')](_0x3f3393[_0x498a('0x32')]);_0x3d4fa3[_0x498a('0x33')]=_['intersection'](_0x3d4fa3[_0x498a('0x30')],_0x3d4fa3['query']);_0x59cd93[_0x498a('0x34')]=_[_0x498a('0x35')](_0x3d4fa3[_0x498a('0x30')],qs[_0x498a('0x36')](_0x3f3393['query'][_0x498a('0x36')]));_0x59cd93['attributes']=_0x59cd93[_0x498a('0x34')][_0x498a('0x37')]?_0x59cd93[_0x498a('0x34')]:_0x3d4fa3[_0x498a('0x30')];if(!_0x3f3393[_0x498a('0x32')][_0x498a('0x38')](_0x498a('0x39'))){_0x59cd93[_0x498a('0x21')]=qs[_0x498a('0x21')](_0x3f3393[_0x498a('0x32')][_0x498a('0x21')]);_0x59cd93[_0x498a('0x1f')]=qs[_0x498a('0x1f')](_0x3f3393[_0x498a('0x32')][_0x498a('0x1f')]);}_0x59cd93[_0x498a('0x3a')]=qs[_0x498a('0x3b')](_0x3f3393[_0x498a('0x32')][_0x498a('0x3b')]);_0x59cd93[_0x498a('0x3c')]=qs[_0x498a('0x33')](_[_0x498a('0x3d')](_0x3f3393[_0x498a('0x32')],_0x3d4fa3[_0x498a('0x33')]),_0xed5201);if(_0x3f3393[_0x498a('0x32')][_0x498a('0x3e')]){_0x59cd93[_0x498a('0x3c')]=_['merge'](_0x59cd93[_0x498a('0x3c')],{'$or':_[_0x498a('0x2d')](_0xed5201,function(_0x49c2fd){if(_0x49c2fd[_0x498a('0x3f')]!=='VIRTUAL'){var _0x266afb={};_0x266afb[_0x49c2fd[_0x498a('0x2c')]]={'$like':'%'+_0x3f3393[_0x498a('0x32')][_0x498a('0x3e')]+'%'};return _0x266afb;}})});}_0x59cd93=_[_0x498a('0x40')]({},_0x59cd93,_0x3f3393['options']);var _0x13e383={'where':_0x59cd93[_0x498a('0x3c')]};return db[_0x498a('0x41')]['count'](_0x13e383)[_0x498a('0x29')](function(_0x13673a){_0xb99a12['count']=_0x13673a;if(_0x3f3393[_0x498a('0x32')]['includeAll']){_0x59cd93[_0x498a('0x42')]=[{'all':!![]}];}return db[_0x498a('0x41')][_0x498a('0x43')](_0x59cd93);})['then'](function(_0x44430c){_0xb99a12['rows']=_0x44430c;return _0xb99a12;})[_0x498a('0x29')](respondWithFilteredResult(_0xd79d40,_0x59cd93))[_0x498a('0x44')](handleError(_0xd79d40,null));};exports[_0x498a('0x45')]=function(_0x2c44f8,_0x44d003){var _0x5be773={'raw':!![],'where':{'id':_0x2c44f8[_0x498a('0x46')]['id']}},_0x46e011={};_0x46e011[_0x498a('0x30')]=_[_0x498a('0x31')](db[_0x498a('0x41')][_0x498a('0x2e')]);_0x46e011[_0x498a('0x32')]=_[_0x498a('0x31')](_0x2c44f8[_0x498a('0x32')]);_0x46e011[_0x498a('0x33')]=_[_0x498a('0x35')](_0x46e011[_0x498a('0x30')],_0x46e011[_0x498a('0x32')]);_0x5be773['attributes']=_[_0x498a('0x35')](_0x46e011[_0x498a('0x30')],qs[_0x498a('0x36')](_0x2c44f8[_0x498a('0x32')]['fields']));_0x5be773['attributes']=_0x5be773[_0x498a('0x34')][_0x498a('0x37')]?_0x5be773[_0x498a('0x34')]:_0x46e011['model'];if(_0x2c44f8[_0x498a('0x32')][_0x498a('0x47')]){_0x5be773[_0x498a('0x42')]=[{'all':!![]}];}_0x5be773=_[_0x498a('0x40')]({},_0x5be773,_0x2c44f8[_0x498a('0x48')]);return db[_0x498a('0x41')][_0x498a('0x49')](_0x5be773)[_0x498a('0x29')](handleEntityNotFound(_0x44d003,null))[_0x498a('0x29')](respondWithResult(_0x44d003,null))[_0x498a('0x44')](handleError(_0x44d003,null));};exports[_0x498a('0x4a')]=function(_0xb5e0f5,_0x1bad29){return db[_0x498a('0x41')][_0x498a('0x4a')](_0xb5e0f5['body'],{})['then'](respondWithResult(_0x1bad29,0xc9))[_0x498a('0x44')](handleError(_0x1bad29,null));};exports[_0x498a('0x28')]=function(_0x247baa,_0xfa35fe){if(_0x247baa['body']['id']){delete _0x247baa[_0x498a('0x4b')]['id'];}return db[_0x498a('0x41')][_0x498a('0x49')]({'where':{'id':_0x247baa[_0x498a('0x46')]['id']}})[_0x498a('0x29')](handleEntityNotFound(_0xfa35fe,null))[_0x498a('0x29')](saveUpdates(_0x247baa['body'],null))[_0x498a('0x29')](respondWithResult(_0xfa35fe,null))['catch'](handleError(_0xfa35fe,null));};exports[_0x498a('0x2a')]=function(_0x49944a,_0x550cc1){return db[_0x498a('0x41')][_0x498a('0x49')]({'where':{'id':_0x49944a['params']['id']}})[_0x498a('0x29')](handleEntityNotFound(_0x550cc1,null))[_0x498a('0x29')](removeEntity(_0x550cc1,null))[_0x498a('0x44')](handleError(_0x550cc1,null));};exports[_0x498a('0x4c')]=function(_0x510e2f,_0x190097){return db['SmsQueueReport']['describe']()[_0x498a('0x29')](respondWithResult(_0x190097,null))['catch'](handleError(_0x190097,null));}; \ No newline at end of file +var _0x4dd4=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','name','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','SmsQueueReport','rawAttributes','find','create','body','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x3573d7,_0x228649){var _0x43a51b=function(_0x154727){while(--_0x154727){_0x3573d7['push'](_0x3573d7['shift']());}};_0x43a51b(++_0x228649);}(_0x4dd4,0xd9));var _0x44dd=function(_0x4e7a44,_0x3c3f5e){_0x4e7a44=_0x4e7a44-0x0;var _0x328515=_0x4dd4[_0x4e7a44];return _0x328515;};'use strict';var emlformat=require(_0x44dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44dd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x44dd('0x2'));var moment=require('moment');var BPromise=require(_0x44dd('0x3'));var Mustache=require(_0x44dd('0x4'));var util=require(_0x44dd('0x5'));var path=require(_0x44dd('0x6'));var sox=require(_0x44dd('0x7'));var csv=require('to-csv');var ejs=require(_0x44dd('0x8'));var fs=require('fs');var fs_extra=require(_0x44dd('0x9'));var _=require(_0x44dd('0xa'));var squel=require(_0x44dd('0xb'));var crypto=require('crypto');var jsforce=require(_0x44dd('0xc'));var deskjs=require(_0x44dd('0xd'));var toCsv=require(_0x44dd('0xe'));var querystring=require(_0x44dd('0xf'));var Papa=require(_0x44dd('0x10'));var Redis=require(_0x44dd('0x11'));var authService=require(_0x44dd('0x12'));var qs=require(_0x44dd('0x13'));var as=require(_0x44dd('0x14'));var hardwareService=require(_0x44dd('0x15'));var logger=require(_0x44dd('0x16'))('api');var utils=require(_0x44dd('0x17'));var config=require(_0x44dd('0x18'));var licenseUtil=require(_0x44dd('0x19'));var db=require(_0x44dd('0x1a'))['db'];function respondWithStatusCode(_0x14e775,_0x3d3283){_0x3d3283=_0x3d3283||0xcc;return function(_0x5a279d){if(_0x5a279d){return _0x14e775[_0x44dd('0x1b')](_0x3d3283);}return _0x14e775['status'](_0x3d3283)[_0x44dd('0x1c')]();};}function respondWithResult(_0x2dec2f,_0x46fac8){_0x46fac8=_0x46fac8||0xc8;return function(_0x14439f){if(_0x14439f){return _0x2dec2f[_0x44dd('0x1d')](_0x46fac8)[_0x44dd('0x1e')](_0x14439f);}};}function respondWithFilteredResult(_0x2bdc91,_0x3cbb3f){return function(_0x2d5ee9){if(_0x2d5ee9){var _0x508268=typeof _0x3cbb3f[_0x44dd('0x1f')]===_0x44dd('0x20')&&typeof _0x3cbb3f[_0x44dd('0x21')]===_0x44dd('0x20');var _0x31b258=_0x2d5ee9['count'];var _0x6df1fe=_0x508268?0x0:_0x3cbb3f[_0x44dd('0x1f')];var _0x3ec7d6=_0x508268?_0x2d5ee9['count']:_0x3cbb3f['offset']+_0x3cbb3f[_0x44dd('0x21')];var _0x1f558b;if(_0x3ec7d6>=_0x31b258){_0x3ec7d6=_0x31b258;_0x1f558b=0xc8;}else{_0x1f558b=0xce;}_0x2bdc91[_0x44dd('0x1d')](_0x1f558b);return _0x2bdc91[_0x44dd('0x22')](_0x44dd('0x23'),_0x6df1fe+'-'+_0x3ec7d6+'/'+_0x31b258)[_0x44dd('0x1e')](_0x2d5ee9);}return null;};}function patchUpdates(_0x17de41){return function(_0x2e0ec1){try{jsonpatch['apply'](_0x2e0ec1,_0x17de41,!![]);}catch(_0x20d918){return BPromise[_0x44dd('0x24')](_0x20d918);}return _0x2e0ec1[_0x44dd('0x25')]();};}function saveUpdates(_0x3c3647,_0x2027ec){return function(_0x32be94){if(_0x32be94){return _0x32be94[_0x44dd('0x26')](_0x3c3647)[_0x44dd('0x27')](function(_0x3c05fd){return _0x3c05fd;});}return null;};}function removeEntity(_0x23cfd0,_0x5be802){return function(_0x3ebc3b){if(_0x3ebc3b){return _0x3ebc3b[_0x44dd('0x28')]()['then'](function(){_0x23cfd0['status'](0xcc)[_0x44dd('0x1c')]();});}};}function handleEntityNotFound(_0x4bb0c7,_0x2cea7b){return function(_0x36b4c6){if(!_0x36b4c6){_0x4bb0c7['sendStatus'](0x194);}return _0x36b4c6;};}function handleError(_0x2cabb2,_0xa7671e){_0xa7671e=_0xa7671e||0x1f4;return function(_0x2a19c4){logger[_0x44dd('0x29')](_0x2a19c4['stack']);if(_0x2a19c4[_0x44dd('0x2a')]){delete _0x2a19c4[_0x44dd('0x2a')];}_0x2cabb2[_0x44dd('0x1d')](_0xa7671e)['send'](_0x2a19c4);};}exports['index']=function(_0xe0869a,_0x3537e1){var _0x1ea01e={},_0x30181f={},_0x5a7640={'count':0x0,'rows':[]};var _0x3d14e2=_[_0x44dd('0x2b')](db['SmsQueueReport']['rawAttributes'],function(_0x42a778){return{'name':_0x42a778[_0x44dd('0x2c')],'type':_0x42a778[_0x44dd('0x2d')][_0x44dd('0x2e')]};});_0x30181f['model']=_[_0x44dd('0x2b')](_0x3d14e2,_0x44dd('0x2a'));_0x30181f['query']=_['keys'](_0xe0869a[_0x44dd('0x2f')]);_0x30181f[_0x44dd('0x30')]=_[_0x44dd('0x31')](_0x30181f[_0x44dd('0x32')],_0x30181f[_0x44dd('0x2f')]);_0x1ea01e[_0x44dd('0x33')]=_[_0x44dd('0x31')](_0x30181f[_0x44dd('0x32')],qs[_0x44dd('0x34')](_0xe0869a[_0x44dd('0x2f')][_0x44dd('0x34')]));_0x1ea01e['attributes']=_0x1ea01e[_0x44dd('0x33')][_0x44dd('0x35')]?_0x1ea01e[_0x44dd('0x33')]:_0x30181f[_0x44dd('0x32')];if(!_0xe0869a[_0x44dd('0x2f')][_0x44dd('0x36')](_0x44dd('0x37'))){_0x1ea01e['limit']=qs[_0x44dd('0x21')](_0xe0869a[_0x44dd('0x2f')][_0x44dd('0x21')]);_0x1ea01e['offset']=qs[_0x44dd('0x1f')](_0xe0869a[_0x44dd('0x2f')]['offset']);}_0x1ea01e['order']=qs[_0x44dd('0x38')](_0xe0869a['query'][_0x44dd('0x38')]);_0x1ea01e['where']=qs[_0x44dd('0x30')](_[_0x44dd('0x39')](_0xe0869a[_0x44dd('0x2f')],_0x30181f['filters']),_0x3d14e2);if(_0xe0869a['query'][_0x44dd('0x3a')]){_0x1ea01e[_0x44dd('0x3b')]=_['merge'](_0x1ea01e[_0x44dd('0x3b')],{'$or':_[_0x44dd('0x2b')](_0x3d14e2,function(_0x1dcc0b){if(_0x1dcc0b[_0x44dd('0x2d')]!==_0x44dd('0x3c')){var _0x1d9918={};_0x1d9918[_0x1dcc0b[_0x44dd('0x2a')]]={'$like':'%'+_0xe0869a[_0x44dd('0x2f')][_0x44dd('0x3a')]+'%'};return _0x1d9918;}})});}_0x1ea01e=_[_0x44dd('0x3d')]({},_0x1ea01e,_0xe0869a[_0x44dd('0x3e')]);var _0x2eccad={'where':_0x1ea01e[_0x44dd('0x3b')]};return db['SmsQueueReport']['count'](_0x2eccad)['then'](function(_0x286c56){_0x5a7640[_0x44dd('0x3f')]=_0x286c56;if(_0xe0869a[_0x44dd('0x2f')][_0x44dd('0x40')]){_0x1ea01e[_0x44dd('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x44dd('0x42')](_0x1ea01e);})[_0x44dd('0x27')](function(_0x5f3252){_0x5a7640[_0x44dd('0x43')]=_0x5f3252;return _0x5a7640;})['then'](respondWithFilteredResult(_0x3537e1,_0x1ea01e))[_0x44dd('0x44')](handleError(_0x3537e1,null));};exports[_0x44dd('0x45')]=function(_0x3e239b,_0x50f8ab){var _0xa6c852={'raw':!![],'where':{'id':_0x3e239b[_0x44dd('0x46')]['id']}},_0x556e7f={};_0x556e7f[_0x44dd('0x32')]=_[_0x44dd('0x47')](db[_0x44dd('0x48')][_0x44dd('0x49')]);_0x556e7f['query']=_[_0x44dd('0x47')](_0x3e239b[_0x44dd('0x2f')]);_0x556e7f[_0x44dd('0x30')]=_[_0x44dd('0x31')](_0x556e7f[_0x44dd('0x32')],_0x556e7f[_0x44dd('0x2f')]);_0xa6c852[_0x44dd('0x33')]=_[_0x44dd('0x31')](_0x556e7f['model'],qs[_0x44dd('0x34')](_0x3e239b[_0x44dd('0x2f')][_0x44dd('0x34')]));_0xa6c852['attributes']=_0xa6c852[_0x44dd('0x33')][_0x44dd('0x35')]?_0xa6c852[_0x44dd('0x33')]:_0x556e7f[_0x44dd('0x32')];if(_0x3e239b['query'][_0x44dd('0x40')]){_0xa6c852[_0x44dd('0x41')]=[{'all':!![]}];}_0xa6c852=_[_0x44dd('0x3d')]({},_0xa6c852,_0x3e239b[_0x44dd('0x3e')]);return db[_0x44dd('0x48')][_0x44dd('0x4a')](_0xa6c852)['then'](handleEntityNotFound(_0x50f8ab,null))['then'](respondWithResult(_0x50f8ab,null))[_0x44dd('0x44')](handleError(_0x50f8ab,null));};exports['create']=function(_0x348f21,_0x5e6886){return db['SmsQueueReport'][_0x44dd('0x4b')](_0x348f21[_0x44dd('0x4c')],{})['then'](respondWithResult(_0x5e6886,0xc9))[_0x44dd('0x44')](handleError(_0x5e6886,null));};exports[_0x44dd('0x26')]=function(_0x5b9c70,_0x3e1fdb){if(_0x5b9c70['body']['id']){delete _0x5b9c70[_0x44dd('0x4c')]['id'];}return db[_0x44dd('0x48')][_0x44dd('0x4a')]({'where':{'id':_0x5b9c70['params']['id']}})[_0x44dd('0x27')](handleEntityNotFound(_0x3e1fdb,null))['then'](saveUpdates(_0x5b9c70[_0x44dd('0x4c')],null))['then'](respondWithResult(_0x3e1fdb,null))[_0x44dd('0x44')](handleError(_0x3e1fdb,null));};exports[_0x44dd('0x28')]=function(_0x49e7a0,_0x527826){return db[_0x44dd('0x48')][_0x44dd('0x4a')]({'where':{'id':_0x49e7a0[_0x44dd('0x46')]['id']}})['then'](handleEntityNotFound(_0x527826,null))[_0x44dd('0x27')](removeEntity(_0x527826,null))[_0x44dd('0x44')](handleError(_0x527826,null));};exports[_0x44dd('0x4d')]=function(_0x20e0bb,_0x25642e){return db[_0x44dd('0x48')][_0x44dd('0x4d')]()[_0x44dd('0x27')](respondWithResult(_0x25642e,null))[_0x44dd('0x44')](handleError(_0x25642e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4a193fa..bf68d73 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(_0x5e62ac,_0x38fa2a){var _0x4dcd4a=function(_0x344a7c){while(--_0x344a7c){_0x5e62ac['push'](_0x5e62ac['shift']());}};_0x4dcd4a(++_0x38fa2a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xcb91[_0x58afd5];return _0x3e503b;};'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(_0x2fc284,_0x5d271c){var _0x221234=function(_0x39fb00){while(--_0x39fb00){_0x2fc284['push'](_0x2fc284['shift']());}};_0x221234(++_0x5d271c);}(_0xe706,0xa3));var _0x6e70=function(_0x3ee8b1,_0x375088){_0x3ee8b1=_0x3ee8b1-0x0;var _0x53aa77=_0xe706[_0x3ee8b1];return _0x53aa77;};'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 63d6afb..f3b6079 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 _0xd44f=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x277079,_0x511204){var _0x205a0b=function(_0x4f7df8){while(--_0x4f7df8){_0x277079['push'](_0x277079['shift']());}};_0x205a0b(++_0x511204);}(_0xd44f,0x163));var _0xfd44=function(_0x5e2128,_0xe2107e){_0x5e2128=_0x5e2128-0x0;var _0x2bbc88=_0xd44f[_0x5e2128];return _0x2bbc88;};'use strict';var _=require(_0xfd44('0x0'));var util=require(_0xfd44('0x1'));var moment=require(_0xfd44('0x2'));var BPromise=require(_0xfd44('0x3'));var rs=require(_0xfd44('0x4'));var fs=require('fs');var Redis=require(_0xfd44('0x5'));var db=require(_0xfd44('0x6'))['db'];var utils=require(_0xfd44('0x7'));var logger=require(_0xfd44('0x8'))(_0xfd44('0x9'));var config=require('../../config/environment');var jayson=require(_0xfd44('0xa'));var client=jayson[_0xfd44('0xb')][_0xfd44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x353bb8,_0x55dc74,_0x1aa234){return new BPromise(function(_0x34b301,_0x25ceef){return client[_0xfd44('0xd')](_0x353bb8,_0x1aa234)[_0xfd44('0xe')](function(_0x5ce8f5){logger[_0xfd44('0xf')](_0xfd44('0x10'),_0x55dc74,_0xfd44('0x11'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x55dc74,'request\x20sent',JSON[_0xfd44('0x12')](_0x5ce8f5));if(_0x5ce8f5[_0xfd44('0x13')]){if(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x14')]===0x1f4){logger[_0xfd44('0x13')](_0xfd44('0x10'),_0x55dc74,_0x5ce8f5[_0xfd44('0x13')]['message']);return _0x25ceef(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);}logger[_0xfd44('0x13')](_0xfd44('0x10'),_0x55dc74,_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);return _0x34b301(_0x5ce8f5[_0xfd44('0x13')][_0xfd44('0x15')]);}else{logger['info'](_0xfd44('0x10'),_0x55dc74,_0xfd44('0x11'));_0x34b301(_0x5ce8f5['result'][_0xfd44('0x15')]);}})['catch'](function(_0x260a1a){logger[_0xfd44('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x55dc74,_0x260a1a);_0x25ceef(_0x260a1a);});});}exports[_0xfd44('0x16')]=function(_0x15812c){var _0x14e772=this;return new Promise(function(_0x26a7d1,_0x145516){return db[_0xfd44('0x17')][_0xfd44('0x18')](_0x15812c[_0xfd44('0x19')],{'raw':_0x15812c[_0xfd44('0x1a')]?_0x15812c['options'][_0xfd44('0x1b')]===undefined?!![]:![]:!![]})[_0xfd44('0xe')](function(_0x2e7e68){logger[_0xfd44('0xf')](_0xfd44('0x16'),_0x15812c);logger[_0xfd44('0x1c')](_0xfd44('0x16'),_0x15812c,JSON[_0xfd44('0x12')](_0x2e7e68));_0x26a7d1(_0x2e7e68);})['catch'](function(_0x4e0426){logger[_0xfd44('0x13')](_0xfd44('0x16'),_0x4e0426['message'],_0x15812c);_0x145516(_0x14e772[_0xfd44('0x13')](0x1f4,_0x4e0426[_0xfd44('0x15')]));});});};exports[_0xfd44('0x1d')]=function(_0x4c537f){var _0x5c0690=this;return new Promise(function(_0x6c9b12,_0x3abbff){return db['SmsQueueReport'][_0xfd44('0x1e')](_0x4c537f[_0xfd44('0x19')],{'raw':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')][_0xfd44('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')]['where']||null:null,'attributes':_0x4c537f['options']?_0x4c537f[_0xfd44('0x1a')]['attributes']||null:null,'limit':_0x4c537f[_0xfd44('0x1a')]?_0x4c537f[_0xfd44('0x1a')][_0xfd44('0x1f')]||null:null})[_0xfd44('0xe')](function(_0x93f931){logger[_0xfd44('0xf')](_0xfd44('0x1d'),_0x4c537f);logger[_0xfd44('0x1c')]('UpdateSmsQueueReport',_0x4c537f,JSON[_0xfd44('0x12')](_0x93f931));_0x6c9b12(_0x93f931);})[_0xfd44('0x20')](function(_0x1b65ca){logger[_0xfd44('0x13')]('UpdateSmsQueueReport',_0x1b65ca[_0xfd44('0x15')],_0x4c537f);_0x3abbff(_0x5c0690['error'](0x1f4,_0x1b65ca[_0xfd44('0x15')]));});});}; \ No newline at end of file +var _0xb141=['jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x49f8c4,_0xfaa8d4){var _0x1c60b3=function(_0x3bf9db){while(--_0x3bf9db){_0x49f8c4['push'](_0x49f8c4['shift']());}};_0x1c60b3(++_0xfaa8d4);}(_0xb141,0xf9));var _0x1b14=function(_0x1f0efb,_0x4556f9){_0x1f0efb=_0x1f0efb-0x0;var _0x374d15=_0xb141[_0x1f0efb];return _0x374d15;};'use strict';var _=require(_0x1b14('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1b14('0x1'));var rs=require(_0x1b14('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b14('0x3'))['db'];var utils=require(_0x1b14('0x4'));var logger=require('../../config/logger')(_0x1b14('0x5'));var config=require(_0x1b14('0x6'));var jayson=require(_0x1b14('0x7'));var client=jayson['client'][_0x1b14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12062c,_0x3bba13,_0x581a73){return new BPromise(function(_0x28afec,_0x27d44f){return client[_0x1b14('0x9')](_0x12062c,_0x581a73)[_0x1b14('0xa')](function(_0x34b20a){logger[_0x1b14('0xb')](_0x1b14('0xc'),_0x3bba13,_0x1b14('0xd'));logger[_0x1b14('0xe')](_0x1b14('0xf'),_0x3bba13,_0x1b14('0xd'),JSON[_0x1b14('0x10')](_0x34b20a));if(_0x34b20a[_0x1b14('0x11')]){if(_0x34b20a[_0x1b14('0x11')][_0x1b14('0x12')]===0x1f4){logger[_0x1b14('0x11')](_0x1b14('0xc'),_0x3bba13,_0x34b20a['error'][_0x1b14('0x13')]);return _0x27d44f(_0x34b20a[_0x1b14('0x11')]['message']);}logger[_0x1b14('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3bba13,_0x34b20a['error'][_0x1b14('0x13')]);return _0x28afec(_0x34b20a[_0x1b14('0x11')][_0x1b14('0x13')]);}else{logger[_0x1b14('0xb')](_0x1b14('0xc'),_0x3bba13,_0x1b14('0xd'));_0x28afec(_0x34b20a['result']['message']);}})['catch'](function(_0x1330a5){logger[_0x1b14('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x3bba13,_0x1330a5);_0x27d44f(_0x1330a5);});});}exports[_0x1b14('0x14')]=function(_0x3b0e48){var _0x147e7f=this;return new Promise(function(_0x48d108,_0x3bb4b6){return db[_0x1b14('0x15')][_0x1b14('0x16')](_0x3b0e48[_0x1b14('0x17')],{'raw':_0x3b0e48[_0x1b14('0x18')]?_0x3b0e48['options'][_0x1b14('0x19')]===undefined?!![]:![]:!![]})[_0x1b14('0xa')](function(_0x2c8d8b){logger[_0x1b14('0xb')]('CreateSmsQueueReport',_0x3b0e48);logger[_0x1b14('0xe')](_0x1b14('0x14'),_0x3b0e48,JSON[_0x1b14('0x10')](_0x2c8d8b));_0x48d108(_0x2c8d8b);})[_0x1b14('0x1a')](function(_0x11b61d){logger[_0x1b14('0x11')](_0x1b14('0x14'),_0x11b61d[_0x1b14('0x13')],_0x3b0e48);_0x3bb4b6(_0x147e7f[_0x1b14('0x11')](0x1f4,_0x11b61d[_0x1b14('0x13')]));});});};exports[_0x1b14('0x1b')]=function(_0x4215d7){var _0x1dc867=this;return new Promise(function(_0x2ace65,_0x414e29){return db['SmsQueueReport'][_0x1b14('0x1c')](_0x4215d7[_0x1b14('0x17')],{'raw':_0x4215d7[_0x1b14('0x18')]?_0x4215d7[_0x1b14('0x18')][_0x1b14('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4215d7['options']?_0x4215d7[_0x1b14('0x18')][_0x1b14('0x1d')]||null:null,'attributes':_0x4215d7[_0x1b14('0x18')]?_0x4215d7[_0x1b14('0x18')][_0x1b14('0x1e')]||null:null,'limit':_0x4215d7['options']?_0x4215d7[_0x1b14('0x18')][_0x1b14('0x1f')]||null:null})['then'](function(_0x86f8d7){logger[_0x1b14('0xb')](_0x1b14('0x1b'),_0x4215d7);logger['debug']('UpdateSmsQueueReport',_0x4215d7,JSON[_0x1b14('0x10')](_0x86f8d7));_0x2ace65(_0x86f8d7);})[_0x1b14('0x1a')](function(_0x4ff080){logger[_0x1b14('0x11')](_0x1b14('0x1b'),_0x4ff080['message'],_0x4215d7);_0x414e29(_0x1dc867[_0x1b14('0x11')](0x1f4,_0x4ff080[_0x1b14('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8c851b7..dbafcdc 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 _0xa1f6=['util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x57278d,_0x2660c4){var _0x4ca698=function(_0x7a9701){while(--_0x7a9701){_0x57278d['push'](_0x57278d['shift']());}};_0x4ca698(++_0x2660c4);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xa1f6[_0x47e93d];return _0xe86c46;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();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('./smsTransferReport.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0xd')]('/',auth[_0x6a1f('0x7')](),controller['create']);router[_0x6a1f('0xe')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xf')]);router['delete'](_0x6a1f('0xb'),auth['isAuthenticated'](),controller[_0x6a1f('0x10')]);module[_0x6a1f('0x11')]=router; \ No newline at end of file +var _0x8ece=['describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0x385f7b,_0x4761d3){var _0x534f59=function(_0x39073c){while(--_0x39073c){_0x385f7b['push'](_0x385f7b['shift']());}};_0x534f59(++_0x4761d3);}(_0x8ece,0x195));var _0xe8ec=function(_0x4fd905,_0x529ac1){_0x4fd905=_0x4fd905-0x0;var _0x2d3204=_0x8ece[_0x4fd905];return _0x2d3204;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require(_0xe8ec('0x2'));var timeout=require(_0xe8ec('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe8ec('0x4'));var auth=require(_0xe8ec('0x5'));var interaction=require(_0xe8ec('0x6'));var config=require(_0xe8ec('0x7'));var controller=require(_0xe8ec('0x8'));router['get']('/',auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xa')]);router[_0xe8ec('0xb')](_0xe8ec('0xc'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0xd')]);router[_0xe8ec('0xb')]('/:id',auth[_0xe8ec('0x9')](),controller['show']);router[_0xe8ec('0xe')]('/',auth['isAuthenticated'](),controller[_0xe8ec('0xf')]);router[_0xe8ec('0x10')](_0xe8ec('0x11'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x12')]);router[_0xe8ec('0x13')](_0xe8ec('0x11'),auth[_0xe8ec('0x9')](),controller[_0xe8ec('0x14')]);module[_0xe8ec('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d848d57..2582be3 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5ae6d9,_0x3b8022){_0x5ae6d9=_0x5ae6d9-0x0;var _0x3a240f=_0xb43b[_0x5ae6d9];return _0x3a240f;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x3b2c47,_0x1157a9){var _0x2af12f=function(_0x8b1865){while(--_0x8b1865){_0x3b2c47['push'](_0x3b2c47['shift']());}};_0x2af12f(++_0x1157a9);}(_0xe706,0xa3));var _0x6e70=function(_0x38cbdf,_0x4eb95f){_0x38cbdf=_0x38cbdf-0x0;var _0x20ebce=_0xe706[_0x38cbdf];return _0x20ebce;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ea983ad..89d2183 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 _0x801f=['stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x367ffd,_0x23cc3d){var _0x26f467=function(_0x460c8f){while(--_0x460c8f){_0x367ffd['push'](_0x367ffd['shift']());}};_0x26f467(++_0x23cc3d);}(_0x801f,0x1ee));var _0xf801=function(_0x3f18ba,_0x38da0e){_0x3f18ba=_0x3f18ba-0x0;var _0x1d3b77=_0x801f[_0x3f18ba];return _0x1d3b77;};'use strict';var emlformat=require(_0xf801('0x0'));var rimraf=require(_0xf801('0x1'));var zipdir=require(_0xf801('0x2'));var jsonpatch=require(_0xf801('0x3'));var rp=require(_0xf801('0x4'));var moment=require(_0xf801('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf801('0x6'));var path=require('path');var sox=require(_0xf801('0x7'));var csv=require(_0xf801('0x8'));var ejs=require(_0xf801('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf801('0xa'));var crypto=require('crypto');var jsforce=require(_0xf801('0xb'));var deskjs=require(_0xf801('0xc'));var toCsv=require(_0xf801('0x8'));var querystring=require('querystring');var Papa=require(_0xf801('0xd'));var Redis=require(_0xf801('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf801('0xf'));var as=require(_0xf801('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf801('0x11'))(_0xf801('0x12'));var utils=require(_0xf801('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf801('0x14'));var db=require(_0xf801('0x15'))['db'];function respondWithStatusCode(_0x35c661,_0x121f94){_0x121f94=_0x121f94||0xcc;return function(_0x2d0dfc){if(_0x2d0dfc){return _0x35c661[_0xf801('0x16')](_0x121f94);}return _0x35c661[_0xf801('0x17')](_0x121f94)[_0xf801('0x18')]();};}function respondWithResult(_0x5666e1,_0x2a6d93){_0x2a6d93=_0x2a6d93||0xc8;return function(_0x29f7de){if(_0x29f7de){return _0x5666e1['status'](_0x2a6d93)[_0xf801('0x19')](_0x29f7de);}};}function respondWithFilteredResult(_0x1805f5,_0x24a085){return function(_0x56272e){if(_0x56272e){var _0x39cdfc=typeof _0x24a085[_0xf801('0x1a')]===_0xf801('0x1b')&&typeof _0x24a085['limit']===_0xf801('0x1b');var _0x541c2f=_0x56272e[_0xf801('0x1c')];var _0x249b85=_0x39cdfc?0x0:_0x24a085[_0xf801('0x1a')];var _0xeb1c37=_0x39cdfc?_0x56272e[_0xf801('0x1c')]:_0x24a085[_0xf801('0x1a')]+_0x24a085[_0xf801('0x1d')];var _0xccd0d3;if(_0xeb1c37>=_0x541c2f){_0xeb1c37=_0x541c2f;_0xccd0d3=0xc8;}else{_0xccd0d3=0xce;}_0x1805f5[_0xf801('0x17')](_0xccd0d3);return _0x1805f5[_0xf801('0x1e')](_0xf801('0x1f'),_0x249b85+'-'+_0xeb1c37+'/'+_0x541c2f)['json'](_0x56272e);}return null;};}function patchUpdates(_0x3d48f6){return function(_0xf62212){try{jsonpatch[_0xf801('0x20')](_0xf62212,_0x3d48f6,!![]);}catch(_0x5b6439){return BPromise['reject'](_0x5b6439);}return _0xf62212[_0xf801('0x21')]();};}function saveUpdates(_0x37b1cd,_0x1a8802){return function(_0x5641ff){if(_0x5641ff){return _0x5641ff[_0xf801('0x22')](_0x37b1cd)[_0xf801('0x23')](function(_0x586da0){return _0x586da0;});}return null;};}function removeEntity(_0x5b4a42,_0x30b35a){return function(_0x3ff030){if(_0x3ff030){return _0x3ff030[_0xf801('0x24')]()[_0xf801('0x23')](function(){_0x5b4a42[_0xf801('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f0f8b,_0xb0565b){return function(_0x5a67d0){if(!_0x5a67d0){_0x9f0f8b[_0xf801('0x16')](0x194);}return _0x5a67d0;};}function handleError(_0x6ae70a,_0x370778){_0x370778=_0x370778||0x1f4;return function(_0x4333b7){logger[_0xf801('0x25')](_0x4333b7[_0xf801('0x26')]);if(_0x4333b7[_0xf801('0x27')]){delete _0x4333b7[_0xf801('0x27')];}_0x6ae70a[_0xf801('0x17')](_0x370778)[_0xf801('0x28')](_0x4333b7);};}exports[_0xf801('0x29')]=function(_0x5846ea,_0x31ddeb){var _0x3f0d70={},_0x56ff51={},_0x2d5b96={'count':0x0,'rows':[]};var _0x4358df=_[_0xf801('0x2a')](db[_0xf801('0x2b')]['rawAttributes'],function(_0x383480){return{'name':_0x383480[_0xf801('0x2c')],'type':_0x383480[_0xf801('0x2d')][_0xf801('0x2e')]};});_0x56ff51[_0xf801('0x2f')]=_[_0xf801('0x2a')](_0x4358df,_0xf801('0x27'));_0x56ff51[_0xf801('0x30')]=_[_0xf801('0x31')](_0x5846ea[_0xf801('0x30')]);_0x56ff51['filters']=_[_0xf801('0x32')](_0x56ff51[_0xf801('0x2f')],_0x56ff51[_0xf801('0x30')]);_0x3f0d70['attributes']=_[_0xf801('0x32')](_0x56ff51[_0xf801('0x2f')],qs[_0xf801('0x33')](_0x5846ea[_0xf801('0x30')]['fields']));_0x3f0d70[_0xf801('0x34')]=_0x3f0d70[_0xf801('0x34')]['length']?_0x3f0d70[_0xf801('0x34')]:_0x56ff51['model'];if(!_0x5846ea[_0xf801('0x30')][_0xf801('0x35')](_0xf801('0x36'))){_0x3f0d70[_0xf801('0x1d')]=qs[_0xf801('0x1d')](_0x5846ea[_0xf801('0x30')][_0xf801('0x1d')]);_0x3f0d70['offset']=qs[_0xf801('0x1a')](_0x5846ea[_0xf801('0x30')][_0xf801('0x1a')]);}_0x3f0d70[_0xf801('0x37')]=qs[_0xf801('0x38')](_0x5846ea[_0xf801('0x30')][_0xf801('0x38')]);_0x3f0d70['where']=qs[_0xf801('0x39')](_[_0xf801('0x3a')](_0x5846ea['query'],_0x56ff51[_0xf801('0x39')]),_0x4358df);if(_0x5846ea[_0xf801('0x30')][_0xf801('0x3b')]){_0x3f0d70[_0xf801('0x3c')]=_[_0xf801('0x3d')](_0x3f0d70[_0xf801('0x3c')],{'$or':_[_0xf801('0x2a')](_0x4358df,function(_0xad4cb3){if(_0xad4cb3['type']!==_0xf801('0x3e')){var _0x256856={};_0x256856[_0xad4cb3[_0xf801('0x27')]]={'$like':'%'+_0x5846ea[_0xf801('0x30')][_0xf801('0x3b')]+'%'};return _0x256856;}})});}_0x3f0d70=_['merge']({},_0x3f0d70,_0x5846ea[_0xf801('0x3f')]);var _0x4b1f87={'where':_0x3f0d70[_0xf801('0x3c')]};return db[_0xf801('0x2b')]['count'](_0x4b1f87)[_0xf801('0x23')](function(_0x806741){_0x2d5b96[_0xf801('0x1c')]=_0x806741;if(_0x5846ea['query'][_0xf801('0x40')]){_0x3f0d70[_0xf801('0x41')]=[{'all':!![]}];}return db[_0xf801('0x2b')][_0xf801('0x42')](_0x3f0d70);})[_0xf801('0x23')](function(_0x128697){_0x2d5b96[_0xf801('0x43')]=_0x128697;return _0x2d5b96;})['then'](respondWithFilteredResult(_0x31ddeb,_0x3f0d70))[_0xf801('0x44')](handleError(_0x31ddeb,null));};exports[_0xf801('0x45')]=function(_0x4ae44b,_0x4c931b){var _0x544b8b={'raw':!![],'where':{'id':_0x4ae44b[_0xf801('0x46')]['id']}},_0x5d0a16={};_0x5d0a16['model']=_[_0xf801('0x31')](db[_0xf801('0x2b')]['rawAttributes']);_0x5d0a16[_0xf801('0x30')]=_['keys'](_0x4ae44b[_0xf801('0x30')]);_0x5d0a16[_0xf801('0x39')]=_['intersection'](_0x5d0a16[_0xf801('0x2f')],_0x5d0a16['query']);_0x544b8b[_0xf801('0x34')]=_['intersection'](_0x5d0a16[_0xf801('0x2f')],qs['fields'](_0x4ae44b[_0xf801('0x30')][_0xf801('0x33')]));_0x544b8b[_0xf801('0x34')]=_0x544b8b[_0xf801('0x34')][_0xf801('0x47')]?_0x544b8b[_0xf801('0x34')]:_0x5d0a16[_0xf801('0x2f')];if(_0x4ae44b[_0xf801('0x30')][_0xf801('0x40')]){_0x544b8b[_0xf801('0x41')]=[{'all':!![]}];}_0x544b8b=_[_0xf801('0x3d')]({},_0x544b8b,_0x4ae44b[_0xf801('0x3f')]);return db[_0xf801('0x2b')][_0xf801('0x48')](_0x544b8b)[_0xf801('0x23')](handleEntityNotFound(_0x4c931b,null))[_0xf801('0x23')](respondWithResult(_0x4c931b,null))[_0xf801('0x44')](handleError(_0x4c931b,null));};exports[_0xf801('0x49')]=function(_0x42a3b6,_0x55ead8){return db['SmsTransferReport'][_0xf801('0x49')](_0x42a3b6[_0xf801('0x4a')],{})[_0xf801('0x23')](respondWithResult(_0x55ead8,0xc9))[_0xf801('0x44')](handleError(_0x55ead8,null));};exports[_0xf801('0x22')]=function(_0x413d01,_0x2ab0f4){if(_0x413d01[_0xf801('0x4a')]['id']){delete _0x413d01[_0xf801('0x4a')]['id'];}return db[_0xf801('0x2b')][_0xf801('0x48')]({'where':{'id':_0x413d01[_0xf801('0x46')]['id']}})[_0xf801('0x23')](handleEntityNotFound(_0x2ab0f4,null))[_0xf801('0x23')](saveUpdates(_0x413d01[_0xf801('0x4a')],null))[_0xf801('0x23')](respondWithResult(_0x2ab0f4,null))['catch'](handleError(_0x2ab0f4,null));};exports[_0xf801('0x24')]=function(_0x447394,_0x232988){return db[_0xf801('0x2b')]['find']({'where':{'id':_0x447394['params']['id']}})[_0xf801('0x23')](handleEntityNotFound(_0x232988,null))[_0xf801('0x23')](removeEntity(_0x232988,null))['catch'](handleError(_0x232988,null));};exports['describe']=function(_0x10b287,_0x451b22){return db[_0xf801('0x2b')][_0xf801('0x4b')]()[_0xf801('0x23')](respondWithResult(_0x451b22,null))[_0xf801('0x44')](handleError(_0x451b22,null));}; \ No newline at end of file +var _0x3e0c=['show','params','includeAll','merge','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','send','index','SmsTransferReport','rawAttributes','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','findAll','rows','catch'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x3e0c,0x19a));var _0xc3e0=function(_0x532850,_0x3a100a){_0x532850=_0x532850-0x0;var _0x4ea53f=_0x3e0c[_0x532850];return _0x4ea53f;};'use strict';var emlformat=require(_0xc3e0('0x0'));var rimraf=require(_0xc3e0('0x1'));var zipdir=require(_0xc3e0('0x2'));var jsonpatch=require(_0xc3e0('0x3'));var rp=require(_0xc3e0('0x4'));var moment=require(_0xc3e0('0x5'));var BPromise=require(_0xc3e0('0x6'));var Mustache=require(_0xc3e0('0x7'));var util=require(_0xc3e0('0x8'));var path=require('path');var sox=require(_0xc3e0('0x9'));var csv=require(_0xc3e0('0xa'));var ejs=require(_0xc3e0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3e0('0xc'));var squel=require(_0xc3e0('0xd'));var crypto=require(_0xc3e0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3e0('0x10'));var Papa=require(_0xc3e0('0x11'));var Redis=require(_0xc3e0('0x12'));var authService=require(_0xc3e0('0x13'));var qs=require(_0xc3e0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e0('0x15'));var logger=require(_0xc3e0('0x16'))(_0xc3e0('0x17'));var utils=require(_0xc3e0('0x18'));var config=require(_0xc3e0('0x19'));var licenseUtil=require(_0xc3e0('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493652,_0x54aabc){_0x54aabc=_0x54aabc||0xcc;return function(_0x286a40){if(_0x286a40){return _0x493652[_0xc3e0('0x1b')](_0x54aabc);}return _0x493652[_0xc3e0('0x1c')](_0x54aabc)[_0xc3e0('0x1d')]();};}function respondWithResult(_0x38e64f,_0x18bb19){_0x18bb19=_0x18bb19||0xc8;return function(_0x3e1f4e){if(_0x3e1f4e){return _0x38e64f['status'](_0x18bb19)['json'](_0x3e1f4e);}};}function respondWithFilteredResult(_0x1923df,_0x38e9f0){return function(_0xd41a2e){if(_0xd41a2e){var _0x226210=typeof _0x38e9f0[_0xc3e0('0x1e')]==='undefined'&&typeof _0x38e9f0['limit']===_0xc3e0('0x1f');var _0x39fa5f=_0xd41a2e[_0xc3e0('0x20')];var _0x53325f=_0x226210?0x0:_0x38e9f0[_0xc3e0('0x1e')];var _0x5c35ee=_0x226210?_0xd41a2e['count']:_0x38e9f0[_0xc3e0('0x1e')]+_0x38e9f0[_0xc3e0('0x21')];var _0x51409b;if(_0x5c35ee>=_0x39fa5f){_0x5c35ee=_0x39fa5f;_0x51409b=0xc8;}else{_0x51409b=0xce;}_0x1923df[_0xc3e0('0x1c')](_0x51409b);return _0x1923df[_0xc3e0('0x22')](_0xc3e0('0x23'),_0x53325f+'-'+_0x5c35ee+'/'+_0x39fa5f)[_0xc3e0('0x24')](_0xd41a2e);}return null;};}function patchUpdates(_0x356890){return function(_0x57af67){try{jsonpatch[_0xc3e0('0x25')](_0x57af67,_0x356890,!![]);}catch(_0x1f8ad5){return BPromise[_0xc3e0('0x26')](_0x1f8ad5);}return _0x57af67[_0xc3e0('0x27')]();};}function saveUpdates(_0x325d57,_0x33f24f){return function(_0x41d639){if(_0x41d639){return _0x41d639[_0xc3e0('0x28')](_0x325d57)[_0xc3e0('0x29')](function(_0xcfd4f4){return _0xcfd4f4;});}return null;};}function removeEntity(_0x2c0d0a,_0x4d917a){return function(_0x27272c){if(_0x27272c){return _0x27272c['destroy']()[_0xc3e0('0x29')](function(){_0x2c0d0a[_0xc3e0('0x1c')](0xcc)[_0xc3e0('0x1d')]();});}};}function handleEntityNotFound(_0x1d3bcf,_0x2a376c){return function(_0xf59c38){if(!_0xf59c38){_0x1d3bcf[_0xc3e0('0x1b')](0x194);}return _0xf59c38;};}function handleError(_0x31d370,_0x2e666f){_0x2e666f=_0x2e666f||0x1f4;return function(_0x30a2d8){logger[_0xc3e0('0x2a')](_0x30a2d8['stack']);if(_0x30a2d8['name']){delete _0x30a2d8['name'];}_0x31d370[_0xc3e0('0x1c')](_0x2e666f)[_0xc3e0('0x2b')](_0x30a2d8);};}exports[_0xc3e0('0x2c')]=function(_0x496e3a,_0x3620c5){var _0x33ba7a={},_0x1b2bcf={},_0x41ba74={'count':0x0,'rows':[]};var _0x9f74d3=_['map'](db[_0xc3e0('0x2d')][_0xc3e0('0x2e')],function(_0x1877df){return{'name':_0x1877df[_0xc3e0('0x2f')],'type':_0x1877df[_0xc3e0('0x30')]['key']};});_0x1b2bcf[_0xc3e0('0x31')]=_[_0xc3e0('0x32')](_0x9f74d3,_0xc3e0('0x33'));_0x1b2bcf[_0xc3e0('0x34')]=_[_0xc3e0('0x35')](_0x496e3a[_0xc3e0('0x34')]);_0x1b2bcf['filters']=_[_0xc3e0('0x36')](_0x1b2bcf[_0xc3e0('0x31')],_0x1b2bcf['query']);_0x33ba7a[_0xc3e0('0x37')]=_[_0xc3e0('0x36')](_0x1b2bcf[_0xc3e0('0x31')],qs[_0xc3e0('0x38')](_0x496e3a[_0xc3e0('0x34')][_0xc3e0('0x38')]));_0x33ba7a[_0xc3e0('0x37')]=_0x33ba7a[_0xc3e0('0x37')][_0xc3e0('0x39')]?_0x33ba7a[_0xc3e0('0x37')]:_0x1b2bcf[_0xc3e0('0x31')];if(!_0x496e3a['query'][_0xc3e0('0x3a')](_0xc3e0('0x3b'))){_0x33ba7a[_0xc3e0('0x21')]=qs[_0xc3e0('0x21')](_0x496e3a[_0xc3e0('0x34')]['limit']);_0x33ba7a['offset']=qs[_0xc3e0('0x1e')](_0x496e3a[_0xc3e0('0x34')]['offset']);}_0x33ba7a[_0xc3e0('0x3c')]=qs[_0xc3e0('0x3d')](_0x496e3a['query'][_0xc3e0('0x3d')]);_0x33ba7a[_0xc3e0('0x3e')]=qs[_0xc3e0('0x3f')](_[_0xc3e0('0x40')](_0x496e3a[_0xc3e0('0x34')],_0x1b2bcf[_0xc3e0('0x3f')]),_0x9f74d3);if(_0x496e3a[_0xc3e0('0x34')]['filter']){_0x33ba7a[_0xc3e0('0x3e')]=_['merge'](_0x33ba7a[_0xc3e0('0x3e')],{'$or':_[_0xc3e0('0x32')](_0x9f74d3,function(_0x514d65){if(_0x514d65[_0xc3e0('0x30')]!==_0xc3e0('0x41')){var _0xd1a84a={};_0xd1a84a[_0x514d65[_0xc3e0('0x33')]]={'$like':'%'+_0x496e3a['query'][_0xc3e0('0x42')]+'%'};return _0xd1a84a;}})});}_0x33ba7a=_['merge']({},_0x33ba7a,_0x496e3a['options']);var _0x3c86f4={'where':_0x33ba7a[_0xc3e0('0x3e')]};return db['SmsTransferReport'][_0xc3e0('0x20')](_0x3c86f4)[_0xc3e0('0x29')](function(_0x437b91){_0x41ba74[_0xc3e0('0x20')]=_0x437b91;if(_0x496e3a[_0xc3e0('0x34')]['includeAll']){_0x33ba7a['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0xc3e0('0x43')](_0x33ba7a);})[_0xc3e0('0x29')](function(_0x533828){_0x41ba74[_0xc3e0('0x44')]=_0x533828;return _0x41ba74;})[_0xc3e0('0x29')](respondWithFilteredResult(_0x3620c5,_0x33ba7a))[_0xc3e0('0x45')](handleError(_0x3620c5,null));};exports[_0xc3e0('0x46')]=function(_0x50f85c,_0x12695c){var _0xa5840e={'raw':!![],'where':{'id':_0x50f85c[_0xc3e0('0x47')]['id']}},_0x18b1cb={};_0x18b1cb[_0xc3e0('0x31')]=_[_0xc3e0('0x35')](db['SmsTransferReport']['rawAttributes']);_0x18b1cb['query']=_[_0xc3e0('0x35')](_0x50f85c['query']);_0x18b1cb[_0xc3e0('0x3f')]=_[_0xc3e0('0x36')](_0x18b1cb[_0xc3e0('0x31')],_0x18b1cb[_0xc3e0('0x34')]);_0xa5840e['attributes']=_[_0xc3e0('0x36')](_0x18b1cb['model'],qs[_0xc3e0('0x38')](_0x50f85c[_0xc3e0('0x34')][_0xc3e0('0x38')]));_0xa5840e[_0xc3e0('0x37')]=_0xa5840e[_0xc3e0('0x37')][_0xc3e0('0x39')]?_0xa5840e['attributes']:_0x18b1cb[_0xc3e0('0x31')];if(_0x50f85c[_0xc3e0('0x34')][_0xc3e0('0x48')]){_0xa5840e['include']=[{'all':!![]}];}_0xa5840e=_[_0xc3e0('0x49')]({},_0xa5840e,_0x50f85c[_0xc3e0('0x4a')]);return db[_0xc3e0('0x2d')][_0xc3e0('0x4b')](_0xa5840e)[_0xc3e0('0x29')](handleEntityNotFound(_0x12695c,null))['then'](respondWithResult(_0x12695c,null))[_0xc3e0('0x45')](handleError(_0x12695c,null));};exports[_0xc3e0('0x4c')]=function(_0x41c805,_0x127368){return db['SmsTransferReport']['create'](_0x41c805['body'],{})[_0xc3e0('0x29')](respondWithResult(_0x127368,0xc9))[_0xc3e0('0x45')](handleError(_0x127368,null));};exports[_0xc3e0('0x28')]=function(_0x2f1794,_0xa4aab2){if(_0x2f1794['body']['id']){delete _0x2f1794[_0xc3e0('0x4d')]['id'];}return db[_0xc3e0('0x2d')][_0xc3e0('0x4b')]({'where':{'id':_0x2f1794[_0xc3e0('0x47')]['id']}})[_0xc3e0('0x29')](handleEntityNotFound(_0xa4aab2,null))[_0xc3e0('0x29')](saveUpdates(_0x2f1794['body'],null))[_0xc3e0('0x29')](respondWithResult(_0xa4aab2,null))[_0xc3e0('0x45')](handleError(_0xa4aab2,null));};exports[_0xc3e0('0x4e')]=function(_0x17b6a1,_0x34ae19){return db[_0xc3e0('0x2d')][_0xc3e0('0x4b')]({'where':{'id':_0x17b6a1['params']['id']}})[_0xc3e0('0x29')](handleEntityNotFound(_0x34ae19,null))[_0xc3e0('0x29')](removeEntity(_0x34ae19,null))[_0xc3e0('0x45')](handleError(_0x34ae19,null));};exports[_0xc3e0('0x4f')]=function(_0x4e72de,_0x1cb11c){return db[_0xc3e0('0x2d')][_0xc3e0('0x4f')]()[_0xc3e0('0x29')](respondWithResult(_0x1cb11c,null))[_0xc3e0('0x45')](handleError(_0x1cb11c,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0b86f82..e02318d 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 _0x668b=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_sms_transfer'];(function(_0x38a43a,_0x19fabf){var _0x49ca46=function(_0x150238){while(--_0x150238){_0x38a43a['push'](_0x38a43a['shift']());}};_0x49ca46(++_0x19fabf);}(_0x668b,0x8d));var _0xb668=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x668b[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require(_0xb668('0x2'))(_0xb668('0x3'));var moment=require(_0xb668('0x4'));var BPromise=require(_0xb668('0x5'));var rp=require(_0xb668('0x6'));var fs=require('fs');var path=require(_0xb668('0x7'));var rimraf=require(_0xb668('0x8'));var config=require(_0xb668('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0xb668('0xa')]=function(_0x145564,_0x551fc3){return _0x145564[_0xb668('0xb')]('SmsTransferReport',attributes,{'tableName':_0xb668('0xc'),'paranoid':![],'indexes':[{'name':_0xb668('0xd'),'fields':[_0xb668('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf150=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','uniqueid','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf150,0x196));var _0x0f15=function(_0x9f4261,_0x18adea){_0x9f4261=_0x9f4261-0x0;var _0x4175b4=_0xf150[_0x9f4261];return _0x4175b4;};'use strict';var _=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var logger=require(_0x0f15('0x2'))(_0x0f15('0x3'));var moment=require(_0x0f15('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f15('0x5'));var rimraf=require(_0x0f15('0x6'));var config=require(_0x0f15('0x7'));var attributes=require(_0x0f15('0x8'));module['exports']=function(_0xd88f20,_0x437b6f){return _0xd88f20['define'](_0x0f15('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x0f15('0xa'),'fields':[_0x0f15('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6cc8848..94edad2 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 _0x861a=['stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x13f808,_0x3a7d80){var _0x2e79ab=function(_0x49e621){while(--_0x49e621){_0x13f808['push'](_0x13f808['shift']());}};_0x2e79ab(++_0x3a7d80);}(_0x861a,0x194));var _0xa861=function(_0x5eea9d,_0x44d620){_0x5eea9d=_0x5eea9d-0x0;var _0xb568f2=_0x861a[_0x5eea9d];return _0xb568f2;};'use strict';var _=require(_0xa861('0x0'));var util=require('util');var moment=require(_0xa861('0x1'));var BPromise=require(_0xa861('0x2'));var rs=require(_0xa861('0x3'));var fs=require('fs');var Redis=require(_0xa861('0x4'));var db=require(_0xa861('0x5'))['db'];var utils=require(_0xa861('0x6'));var logger=require('../../config/logger')(_0xa861('0x7'));var config=require(_0xa861('0x8'));var jayson=require(_0xa861('0x9'));var client=jayson[_0xa861('0xa')][_0xa861('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6cb,_0x2c9016,_0x410918){return new BPromise(function(_0x46e2ce,_0x300ab7){return client[_0xa861('0xc')](_0x5bc6cb,_0x410918)[_0xa861('0xd')](function(_0x24e3ad){logger[_0xa861('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x2c9016,'request\x20sent');logger[_0xa861('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c9016,'request\x20sent',JSON[_0xa861('0x10')](_0x24e3ad));if(_0x24e3ad[_0xa861('0x11')]){if(_0x24e3ad[_0xa861('0x11')]['code']===0x1f4){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);return _0x300ab7(_0x24e3ad[_0xa861('0x11')]['message']);}logger['error'](_0xa861('0x12'),_0x2c9016,_0x24e3ad['error']['message']);return _0x46e2ce(_0x24e3ad[_0xa861('0x11')][_0xa861('0x13')]);}else{logger[_0xa861('0xe')](_0xa861('0x12'),_0x2c9016,'request\x20sent');_0x46e2ce(_0x24e3ad[_0xa861('0x14')]['message']);}})['catch'](function(_0x5503fd){logger[_0xa861('0x11')](_0xa861('0x12'),_0x2c9016,_0x5503fd);_0x300ab7(_0x5503fd);});});} \ No newline at end of file +var _0xbe22=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0xbe22,0x1c1));var _0x2be2=function(_0x554e96,_0x2eea80){_0x554e96=_0x554e96-0x0;var _0x449d9c=_0xbe22[_0x554e96];return _0x449d9c;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2be2('0x2'));var fs=require('fs');var Redis=require(_0x2be2('0x3'));var db=require(_0x2be2('0x4'))['db'];var utils=require(_0x2be2('0x5'));var logger=require(_0x2be2('0x6'))(_0x2be2('0x7'));var config=require(_0x2be2('0x8'));var jayson=require(_0x2be2('0x9'));var client=jayson[_0x2be2('0xa')][_0x2be2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59740c,_0x1fd9fc,_0x27e1a9){return new BPromise(function(_0x12d9b4,_0x4855fa){return client[_0x2be2('0xc')](_0x59740c,_0x27e1a9)[_0x2be2('0xd')](function(_0x1d20f1){logger[_0x2be2('0xe')](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));logger[_0x2be2('0x11')](_0x2be2('0x12'),_0x1fd9fc,'request\x20sent',JSON[_0x2be2('0x13')](_0x1d20f1));if(_0x1d20f1[_0x2be2('0x14')]){if(_0x1d20f1['error'][_0x2be2('0x15')]===0x1f4){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1['error'][_0x2be2('0x16')]);return _0x4855fa(_0x1d20f1[_0x2be2('0x14')]['message']);}logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x1d20f1[_0x2be2('0x14')]['message']);return _0x12d9b4(_0x1d20f1[_0x2be2('0x14')][_0x2be2('0x16')]);}else{logger['info'](_0x2be2('0xf'),_0x1fd9fc,_0x2be2('0x10'));_0x12d9b4(_0x1d20f1['result'][_0x2be2('0x16')]);}})['catch'](function(_0x435664){logger[_0x2be2('0x14')](_0x2be2('0xf'),_0x1fd9fc,_0x435664);_0x4855fa(_0x435664);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 694d6b2..0de2de5 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 _0x6a88=['delete','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','single','create','put','update'];(function(_0x50ac7a,_0x184d00){var _0x506154=function(_0x55d5cc){while(--_0x55d5cc){_0x50ac7a['push'](_0x50ac7a['shift']());}};_0x506154(++_0x184d00);}(_0x6a88,0xe1));var _0x86a8=function(_0x54a687,_0x4ce189){_0x54a687=_0x54a687-0x0;var _0x4b5083=_0x6a88[_0x54a687];return _0x4b5083;};'use strict';var multer=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var path=require(_0x86a8('0x2'));var timeout=require(_0x86a8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x86a8('0x5'));var config=require('../../config/environment');var controller=require(_0x86a8('0x6'));router[_0x86a8('0x7')]('/',auth['isAuthenticated'](),controller[_0x86a8('0x8')]);router[_0x86a8('0x7')](_0x86a8('0x9'),auth[_0x86a8('0xa')](),controller[_0x86a8('0xb')]);router['get'](_0x86a8('0xc'),auth[_0x86a8('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x86a8('0xd')]({'destination':function(_0x420071,_0x1bad3c,_0x2c6439){_0x2c6439(null,path[_0x86a8('0xe')](config[_0x86a8('0xf')],_0x86a8('0x10')));},'filename':function(_0x26411b,_0x26dc76,_0x358b44){_0x26dc76['originalname']=_0x26dc76[_0x86a8('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x358b44(null,util[_0x86a8('0x12')](_0x86a8('0x13'),path[_0x86a8('0x14')](_0x26dc76[_0x86a8('0x11')],path['extname'](_0x26dc76['originalname'])),Date['now'](),path[_0x86a8('0x15')](_0x26dc76[_0x86a8('0x11')])));}})});router[_0x86a8('0x16')]('/',upload[_0x86a8('0x17')]('file'),controller[_0x86a8('0x18')]);router[_0x86a8('0x19')](_0x86a8('0x9'),auth[_0x86a8('0xa')](),controller[_0x86a8('0x1a')]);router[_0x86a8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x86a8('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x345a=['server/files/sounds/original/','originalname','format','basename','extname','now','single','file','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage','root'];(function(_0x35de6f,_0x42689b){var _0x478c89=function(_0x39015f){while(--_0x39015f){_0x35de6f['push'](_0x35de6f['shift']());}};_0x478c89(++_0x42689b);}(_0x345a,0xba));var _0xa345=function(_0x5eb21b,_0x43da7c){_0x5eb21b=_0x5eb21b-0x0;var _0x36b304=_0x345a[_0x5eb21b];return _0x36b304;};'use strict';var multer=require(_0xa345('0x0'));var util=require(_0xa345('0x1'));var path=require(_0xa345('0x2'));var timeout=require(_0xa345('0x3'));var express=require('express');var router=express[_0xa345('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa345('0x5'));var interaction=require(_0xa345('0x6'));var config=require(_0xa345('0x7'));var controller=require(_0xa345('0x8'));router['get']('/',auth[_0xa345('0x9')](),controller[_0xa345('0xa')]);router[_0xa345('0xb')](_0xa345('0xc'),auth['isAuthenticated'](),controller[_0xa345('0xd')]);router[_0xa345('0xb')](_0xa345('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xa345('0xf')]({'destination':function(_0x5a9e22,_0x46646d,_0x4c2647){_0x4c2647(null,path['join'](config[_0xa345('0x10')],_0xa345('0x11')));},'filename':function(_0x45c5ee,_0x1a26f6,_0x56e6a9){_0x1a26f6[_0xa345('0x12')]=_0x1a26f6[_0xa345('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56e6a9(null,util[_0xa345('0x13')]('%s-%s%s',path[_0xa345('0x14')](_0x1a26f6['originalname'],path[_0xa345('0x15')](_0x1a26f6[_0xa345('0x12')])),Date[_0xa345('0x16')](),path[_0xa345('0x15')](_0x1a26f6[_0xa345('0x12')])));}})});router['post']('/',upload[_0xa345('0x17')](_0xa345('0x18')),controller['create']);router[_0xa345('0x19')](_0xa345('0xc'),auth[_0xa345('0x9')](),controller[_0xa345('0x1a')]);router[_0xa345('0x1b')](_0xa345('0xc'),auth['isAuthenticated'](),controller['delete']);module[_0xa345('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 66b6d5a..e073b44 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 _0x367f=['name','FLOAT','BIGINT','INTEGER','sequelize','STRING'];(function(_0x22789a,_0x4a1c8c){var _0xede88=function(_0x49243f){while(--_0x49243f){_0x22789a['push'](_0x22789a['shift']());}};_0xede88(++_0x4a1c8c);}(_0x367f,0xee));var _0xf367=function(_0xd32b5e,_0x3d7a78){_0xd32b5e=_0xd32b5e-0x0;var _0x417084=_0x367f[_0xd32b5e];return _0x417084;};'use strict';var Sequelize=require(_0xf367('0x0'));module['exports']={'name':{'type':Sequelize[_0xf367('0x1')],'unique':_0xf367('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf367('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xf367('0x1')]},'original_format':{'type':Sequelize[_0xf367('0x1')]},'original_duration':{'type':Sequelize[_0xf367('0x3')]},'original_sampleCount':{'type':Sequelize[_0xf367('0x4')]},'original_channelCount':{'type':Sequelize[_0xf367('0x5')]},'original_bitRate':{'type':Sequelize[_0xf367('0x4')]},'original_sampleRate':{'type':Sequelize[_0xf367('0x5')]},'converted_format':{'type':Sequelize[_0xf367('0x1')]},'converted_duration':{'type':Sequelize[_0xf367('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xf367('0x4')]},'converted_channelCount':{'type':Sequelize[_0xf367('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf367('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x611e=['STRING','FLOAT','INTEGER','BIGINT','sequelize','exports'];(function(_0x3232ed,_0x3160f1){var _0x47756b=function(_0x5e7b13){while(--_0x5e7b13){_0x3232ed['push'](_0x3232ed['shift']());}};_0x47756b(++_0x3160f1);}(_0x611e,0xa6));var _0xe611=function(_0x209459,_0x4b088b){_0x209459=_0x209459-0x0;var _0x3a8736=_0x611e[_0x209459];return _0x3a8736;};'use strict';var Sequelize=require(_0xe611('0x0'));module[_0xe611('0x1')]={'name':{'type':Sequelize[_0xe611('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xe611('0x2')]},'display_name':{'type':Sequelize[_0xe611('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xe611('0x2')]},'original_format':{'type':Sequelize[_0xe611('0x2')]},'original_duration':{'type':Sequelize[_0xe611('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xe611('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xe611('0x5')]},'converted_channelCount':{'type':Sequelize[_0xe611('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xe611('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 64b7357..a3f92e8 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 _0x6178=['util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','save_name','converted_format','existsSync','Sound\x20not\x20found','download','root','server/files/sounds/converted','%s.%s','format','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','join','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','end','chmodSync','create','body','userProfileId','role','user','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x183912,_0x3ed50a){var _0x1a6376=function(_0x1fd167){while(--_0x1fd167){_0x183912['push'](_0x183912['shift']());}};_0x1a6376(++_0x3ed50a);}(_0x6178,0xed));var _0x8617=function(_0x35f7d1,_0x39d318){_0x35f7d1=_0x35f7d1-0x0;var _0x53ac5f=_0x6178[_0x35f7d1];return _0x53ac5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8617('0x0'));var zipdir=require(_0x8617('0x1'));var jsonpatch=require(_0x8617('0x2'));var rp=require(_0x8617('0x3'));var moment=require(_0x8617('0x4'));var BPromise=require(_0x8617('0x5'));var Mustache=require(_0x8617('0x6'));var util=require(_0x8617('0x7'));var path=require(_0x8617('0x8'));var sox=require(_0x8617('0x9'));var csv=require(_0x8617('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8617('0xb'));var squel=require('squel');var crypto=require(_0x8617('0xc'));var jsforce=require(_0x8617('0xd'));var deskjs=require(_0x8617('0xe'));var toCsv=require(_0x8617('0xa'));var querystring=require(_0x8617('0xf'));var Papa=require('papaparse');var Redis=require(_0x8617('0x10'));var authService=require(_0x8617('0x11'));var qs=require(_0x8617('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8617('0x13'));var logger=require(_0x8617('0x14'))('api');var utils=require(_0x8617('0x15'));var config=require(_0x8617('0x16'));var licenseUtil=require(_0x8617('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34438c,_0x36beac){_0x36beac=_0x36beac||0xcc;return function(_0x1507a2){if(_0x1507a2){return _0x34438c[_0x8617('0x18')](_0x36beac);}return _0x34438c['status'](_0x36beac)['end']();};}function respondWithResult(_0x1059bc,_0x593090){_0x593090=_0x593090||0xc8;return function(_0x39c67f){if(_0x39c67f){return _0x1059bc[_0x8617('0x19')](_0x593090)[_0x8617('0x1a')](_0x39c67f);}};}function respondWithFilteredResult(_0x2f4c53,_0x48dc57){return function(_0x11482b){if(_0x11482b){var _0x55a4c1=typeof _0x48dc57[_0x8617('0x1b')]==='undefined'&&typeof _0x48dc57[_0x8617('0x1c')]===_0x8617('0x1d');var _0x517c8f=_0x11482b[_0x8617('0x1e')];var _0xde380a=_0x55a4c1?0x0:_0x48dc57['offset'];var _0x146679=_0x55a4c1?_0x11482b[_0x8617('0x1e')]:_0x48dc57['offset']+_0x48dc57[_0x8617('0x1c')];var _0x41094d;if(_0x146679>=_0x517c8f){_0x146679=_0x517c8f;_0x41094d=0xc8;}else{_0x41094d=0xce;}_0x2f4c53['status'](_0x41094d);return _0x2f4c53[_0x8617('0x1f')](_0x8617('0x20'),_0xde380a+'-'+_0x146679+'/'+_0x517c8f)[_0x8617('0x1a')](_0x11482b);}return null;};}function patchUpdates(_0x3a976d){return function(_0x4df454){try{jsonpatch['apply'](_0x4df454,_0x3a976d,!![]);}catch(_0x357d88){return BPromise[_0x8617('0x21')](_0x357d88);}return _0x4df454[_0x8617('0x22')]();};}function saveUpdates(_0x10230e,_0x5d5943){return function(_0x4eb711){if(_0x4eb711){return _0x4eb711[_0x8617('0x23')](_0x10230e)[_0x8617('0x24')](function(_0x4b1b1e){return _0x4b1b1e;});}return null;};}function removeEntity(_0x2e1315,_0x3da23a){return function(_0x46f1e6){if(_0x46f1e6){return _0x46f1e6[_0x8617('0x25')]()['then'](function(){var _0x3e2868=_0x46f1e6[_0x8617('0x26')]({'plain':!![]});var _0x2e5d8d='Sounds';return db[_0x8617('0x27')][_0x8617('0x25')]({'where':{'type':_0x2e5d8d,'resourceId':_0x3e2868['id']}})[_0x8617('0x24')](function(){return _0x46f1e6;});})['then'](function(){_0x2e1315[_0x8617('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1262df,_0xd4adde){return function(_0x5d100c){if(!_0x5d100c){_0x1262df[_0x8617('0x18')](0x194);}return _0x5d100c;};}function handleError(_0x2c7371,_0x2168bc){_0x2168bc=_0x2168bc||0x1f4;return function(_0xd2520d){logger[_0x8617('0x28')](_0xd2520d[_0x8617('0x29')]);if(_0xd2520d[_0x8617('0x2a')]){delete _0xd2520d[_0x8617('0x2a')];}_0x2c7371['status'](_0x2168bc)[_0x8617('0x2b')](_0xd2520d);};}exports[_0x8617('0x2c')]=function(_0x3d83c7,_0x3596ad){var _0x3bd1be={},_0x345cc5={},_0x330892={'count':0x0,'rows':[]};var _0x2dd635=_[_0x8617('0x2d')](db[_0x8617('0x2e')][_0x8617('0x2f')],function(_0x58abf0){return{'name':_0x58abf0['fieldName'],'type':_0x58abf0[_0x8617('0x30')][_0x8617('0x31')]};});_0x345cc5[_0x8617('0x32')]=_[_0x8617('0x2d')](_0x2dd635,'name');_0x345cc5[_0x8617('0x33')]=_[_0x8617('0x34')](_0x3d83c7[_0x8617('0x33')]);_0x345cc5[_0x8617('0x35')]=_['intersection'](_0x345cc5[_0x8617('0x32')],_0x345cc5[_0x8617('0x33')]);_0x3bd1be['attributes']=_[_0x8617('0x36')](_0x345cc5[_0x8617('0x32')],qs['fields'](_0x3d83c7[_0x8617('0x33')]['fields']));_0x3bd1be[_0x8617('0x37')]=_0x3bd1be['attributes'][_0x8617('0x38')]?_0x3bd1be[_0x8617('0x37')]:_0x345cc5['model'];if(!_0x3d83c7[_0x8617('0x33')][_0x8617('0x39')]('nolimit')){_0x3bd1be[_0x8617('0x1c')]=qs['limit'](_0x3d83c7[_0x8617('0x33')][_0x8617('0x1c')]);_0x3bd1be[_0x8617('0x1b')]=qs[_0x8617('0x1b')](_0x3d83c7[_0x8617('0x33')][_0x8617('0x1b')]);}_0x3bd1be['order']=qs[_0x8617('0x3a')](_0x3d83c7[_0x8617('0x33')]['sort']);_0x3bd1be[_0x8617('0x3b')]=qs[_0x8617('0x35')](_['pick'](_0x3d83c7[_0x8617('0x33')],_0x345cc5['filters']),_0x2dd635);if(_0x3d83c7[_0x8617('0x33')][_0x8617('0x3c')]){_0x3bd1be['where']=_[_0x8617('0x3d')](_0x3bd1be[_0x8617('0x3b')],{'$or':_[_0x8617('0x2d')](_0x2dd635,function(_0x491f94){if(_0x491f94['type']!==_0x8617('0x3e')){var _0x2fb6f1={};_0x2fb6f1[_0x491f94['name']]={'$like':'%'+_0x3d83c7[_0x8617('0x33')]['filter']+'%'};return _0x2fb6f1;}})});}_0x3bd1be=_['merge']({},_0x3bd1be,_0x3d83c7[_0x8617('0x3f')]);var _0xabe723={'where':_0x3bd1be['where']};return db[_0x8617('0x2e')]['count'](_0xabe723)['then'](function(_0x3f57a2){_0x330892[_0x8617('0x1e')]=_0x3f57a2;if(_0x3d83c7[_0x8617('0x33')][_0x8617('0x40')]){_0x3bd1be[_0x8617('0x41')]=[{'all':!![]}];}return db[_0x8617('0x2e')][_0x8617('0x42')](_0x3bd1be);})[_0x8617('0x24')](function(_0x48c1b4){_0x330892[_0x8617('0x43')]=_0x48c1b4;return _0x330892;})[_0x8617('0x24')](respondWithFilteredResult(_0x3596ad,_0x3bd1be))[_0x8617('0x44')](handleError(_0x3596ad,null));};exports[_0x8617('0x45')]=function(_0x3884f1,_0x3ce671){var _0xcce458={'raw':!![],'where':{'id':_0x3884f1[_0x8617('0x46')]['id']}},_0x1d048d={};_0x1d048d[_0x8617('0x32')]=_[_0x8617('0x34')](db[_0x8617('0x2e')][_0x8617('0x2f')]);_0x1d048d[_0x8617('0x33')]=_[_0x8617('0x34')](_0x3884f1[_0x8617('0x33')]);_0x1d048d[_0x8617('0x35')]=_[_0x8617('0x36')](_0x1d048d[_0x8617('0x32')],_0x1d048d['query']);_0xcce458[_0x8617('0x37')]=_['intersection'](_0x1d048d[_0x8617('0x32')],qs[_0x8617('0x47')](_0x3884f1['query'][_0x8617('0x47')]));_0xcce458[_0x8617('0x37')]=_0xcce458['attributes'][_0x8617('0x38')]?_0xcce458[_0x8617('0x37')]:_0x1d048d[_0x8617('0x32')];if(_0x3884f1[_0x8617('0x33')]['includeAll']){_0xcce458[_0x8617('0x41')]=[{'all':!![]}];}_0xcce458=_[_0x8617('0x3d')]({},_0xcce458,_0x3884f1[_0x8617('0x3f')]);return db[_0x8617('0x2e')][_0x8617('0x48')](_0xcce458)['then'](handleEntityNotFound(_0x3ce671,null))['then'](respondWithResult(_0x3ce671,null))[_0x8617('0x44')](handleError(_0x3ce671,null));};exports['download']=function(_0x129b96,_0x48f0d7,_0x39b47b){return db[_0x8617('0x2e')][_0x8617('0x48')]({'where':{'id':_0x129b96[_0x8617('0x46')]['id']},'attributes':['name',_0x8617('0x49'),_0x8617('0x4a')],'raw':!![]})[_0x8617('0x24')](handleEntityNotFound(_0x48f0d7,null))['then'](function(_0x6d05aa){if(_0x6d05aa){if(!fs[_0x8617('0x4b')](path['join'](config['root'],'server/files/sounds/converted',_0x6d05aa['save_name']+'.'+_0x6d05aa[_0x8617('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0x8617('0x4c'));}return _0x48f0d7[_0x8617('0x4d')](path['join'](config[_0x8617('0x4e')],_0x8617('0x4f'),util['format'](_0x8617('0x50'),_0x6d05aa[_0x8617('0x49')],_0x6d05aa[_0x8617('0x4a')])),util[_0x8617('0x51')](_0x8617('0x50'),_0x6d05aa[_0x8617('0x2a')],_0x6d05aa[_0x8617('0x4a')]));}return null;})[_0x8617('0x44')](handleError(_0x48f0d7,null));};exports['create']=function(_0x49507f,_0x1fcb03,_0xee4b75){var _0x1f44e4={'name':path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')])),'save_name':path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')])),'original_format':path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x54')])[_0x8617('0x57')](0x1),'converted_format':_0x8617('0x58')};var _0x543052=path['join'](config[_0x8617('0x4e')],_0x8617('0x59'),_0x49507f[_0x8617('0x53')][_0x8617('0x56')]);var _0x303342=path[_0x8617('0x5a')](config[_0x8617('0x4e')],_0x8617('0x4f'),util[_0x8617('0x51')](_0x8617('0x50'),path[_0x8617('0x52')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')],path[_0x8617('0x55')](_0x49507f[_0x8617('0x53')][_0x8617('0x56')])),_0x1f44e4['converted_format']));logger[_0x8617('0x5b')](_0x8617('0x5c'),_0x543052);logger[_0x8617('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0x303342);try{fs['chmodSync'](_0x543052,parseInt(_0x8617('0x5d'),0x8));var _0x1bb09d=sox[_0x8617('0x5e')](_0x543052,_0x303342,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1bb09d['on'](_0x8617('0x28'),function(_0x19e452){fs[_0x8617('0x5f')](_0x543052);_0x1fcb03[_0x8617('0x19')](0x1f4)[_0x8617('0x2b')](_0x19e452);});_0x1bb09d['on'](_0x8617('0x60'),function(_0xab0877){_0x1f44e4[_0x8617('0x61')]=isNaN(_0xab0877[_0x8617('0x62')])?null:_0xab0877[_0x8617('0x62')]*0x3e8;_0x1f44e4[_0x8617('0x63')]=isNaN(_0xab0877['sampleCount'])?null:_0xab0877[_0x8617('0x64')];_0x1f44e4[_0x8617('0x65')]=isNaN(_0xab0877['channelCount'])?null:_0xab0877[_0x8617('0x66')];_0x1f44e4['original_bitRate']=isNaN(_0xab0877[_0x8617('0x67')])?null:_0xab0877[_0x8617('0x67')];_0x1f44e4['original_sampleRate']=isNaN(_0xab0877[_0x8617('0x68')])?null:_0xab0877[_0x8617('0x68')];});_0x1bb09d['on'](_0x8617('0x69'),function(_0x52afb5){_0x1f44e4[_0x8617('0x6a')]=isNaN(_0x52afb5[_0x8617('0x62')])?null:_0x52afb5[_0x8617('0x62')]*0x3e8;_0x1f44e4[_0x8617('0x6b')]=isNaN(_0x52afb5['sampleCount'])?null:_0x52afb5['sampleCount'];_0x1f44e4[_0x8617('0x6c')]=isNaN(_0x52afb5['channelCount'])?null:_0x52afb5['channelCount'];_0x1f44e4[_0x8617('0x6d')]=isNaN(_0x52afb5[_0x8617('0x67')])?null:_0x52afb5[_0x8617('0x67')];_0x1f44e4[_0x8617('0x6e')]=isNaN(_0x52afb5[_0x8617('0x68')])?null:_0x52afb5[_0x8617('0x68')];});_0x1bb09d['on'](_0x8617('0x6f'),function(){fs[_0x8617('0x70')](_0x303342,parseInt(_0x8617('0x5d'),0x8));return db['Sound'][_0x8617('0x71')](_0x1f44e4)[_0x8617('0x24')](function(_0x5c42c3){var _0x15626c={'role':_0x49507f[_0x8617('0x72')]['role'],'userProfileId':_0x49507f[_0x8617('0x72')][_0x8617('0x73')]};if(!_0x15626c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15626c[_0x8617('0x74')]===_0x8617('0x75')){var _0x341ef0=_0x5c42c3[_0x8617('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x8617('0x48')]({'where':{'name':_0x8617('0x76'),'userProfileId':_0x15626c[_0x8617('0x73')]},'raw':!![]})[_0x8617('0x24')](function(_0x45dc0d){if(_0x45dc0d&&_0x45dc0d['autoAssociation']===0x0){return db[_0x8617('0x27')]['create']({'name':_0x341ef0[_0x8617('0x2a')],'resourceId':_0x341ef0['id'],'type':_0x45dc0d['name'],'sectionId':_0x45dc0d['id']},{})[_0x8617('0x24')](function(){return _0x5c42c3;});}else{return _0x5c42c3;}})[_0x8617('0x44')](function(_0x1232cc){logger[_0x8617('0x28')](_0x8617('0x77'),_0x1232cc);throw _0x1232cc;});}return _0x5c42c3;})[_0x8617('0x24')](respondWithResult(_0x1fcb03,null))[_0x8617('0x44')](handleError(_0x1fcb03,null));});_0x1bb09d['start']();}catch(_0x1e4c29){_0x1fcb03[_0x8617('0x19')](0x1f4)['send'](_0x1e4c29);}};exports['update']=function(_0x17eb9a,_0x364c22,_0x507fc2){return db[_0x8617('0x2e')]['find']({'where':{'id':_0x17eb9a[_0x8617('0x46')]['id']}})['then'](handleEntityNotFound(_0x364c22,null))['then'](saveUpdates(_['pick'](_0x17eb9a['body'],['name','description']),null))[_0x8617('0x24')](respondWithResult(_0x364c22,null))['catch'](handleError(_0x364c22,null));};exports[_0x8617('0x78')]=function(_0x5825f2,_0x3607c8,_0x2ff23e){return db['Sound']['find']({'where':{'id':_0x5825f2['params']['id']}})[_0x8617('0x24')](function(_0x2a17db){if(_0x2a17db){return _0x2a17db['destroy']();}})['then'](function(_0x4448f4){var _0x216b1f=path['join'](config['root'],_0x8617('0x59'),util['format'](_0x8617('0x50'),_0x4448f4[_0x8617('0x49')],_0x4448f4[_0x8617('0x79')]));var _0x24ccc9=path['join'](config[_0x8617('0x4e')],'server/files/sounds/converted',util[_0x8617('0x51')](_0x8617('0x50'),_0x4448f4[_0x8617('0x49')],_0x4448f4[_0x8617('0x4a')]));fs['unlinkSync'](_0x216b1f);fs['unlinkSync'](_0x24ccc9);return _0x4448f4;})[_0x8617('0x24')](function(_0x501ab7){if(_0x501ab7){return _0x3607c8[_0x8617('0x19')](0xcc)['end']();}})[_0x8617('0x24')](handleEntityNotFound(_0x3607c8,null))[_0x8617('0x44')](handleError(_0x3607c8,null));}; \ No newline at end of file +var _0x7635=['user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','then','get','name','map','Sound','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','download','find','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','ValidationError','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','send','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x57303c,_0x249ded){var _0x45d104=function(_0x534bae){while(--_0x534bae){_0x57303c['push'](_0x57303c['shift']());}};_0x45d104(++_0x249ded);}(_0x7635,0xf9));var _0x5763=function(_0x5d9830,_0x1d20ba){_0x5d9830=_0x5d9830-0x0;var _0x1aa0e5=_0x7635[_0x5d9830];return _0x1aa0e5;};'use strict';var emlformat=require(_0x5763('0x0'));var rimraf=require(_0x5763('0x1'));var zipdir=require(_0x5763('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5763('0x3'));var moment=require('moment');var BPromise=require(_0x5763('0x4'));var Mustache=require(_0x5763('0x5'));var util=require(_0x5763('0x6'));var path=require('path');var sox=require(_0x5763('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5763('0x8'));var _=require(_0x5763('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5763('0xa'));var deskjs=require(_0x5763('0xb'));var toCsv=require(_0x5763('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5763('0xd'));var authService=require(_0x5763('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5763('0xf'));var logger=require(_0x5763('0x10'))(_0x5763('0x11'));var utils=require(_0x5763('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x5763('0x13'));var db=require(_0x5763('0x14'))['db'];function respondWithStatusCode(_0x3af00d,_0x24cf52){_0x24cf52=_0x24cf52||0xcc;return function(_0x67eded){if(_0x67eded){return _0x3af00d[_0x5763('0x15')](_0x24cf52);}return _0x3af00d[_0x5763('0x16')](_0x24cf52)[_0x5763('0x17')]();};}function respondWithResult(_0x1cf924,_0x29100a){_0x29100a=_0x29100a||0xc8;return function(_0x34cf3){if(_0x34cf3){return _0x1cf924[_0x5763('0x16')](_0x29100a)['json'](_0x34cf3);}};}function respondWithFilteredResult(_0x4d03a6,_0x156c50){return function(_0xd4c5fc){if(_0xd4c5fc){var _0x4a39e7=typeof _0x156c50[_0x5763('0x18')]===_0x5763('0x19')&&typeof _0x156c50[_0x5763('0x1a')]===_0x5763('0x19');var _0x5315d0=_0xd4c5fc['count'];var _0x4a8b26=_0x4a39e7?0x0:_0x156c50[_0x5763('0x18')];var _0x1a5b62=_0x4a39e7?_0xd4c5fc[_0x5763('0x1b')]:_0x156c50[_0x5763('0x18')]+_0x156c50['limit'];var _0x57de39;if(_0x1a5b62>=_0x5315d0){_0x1a5b62=_0x5315d0;_0x57de39=0xc8;}else{_0x57de39=0xce;}_0x4d03a6['status'](_0x57de39);return _0x4d03a6['set'](_0x5763('0x1c'),_0x4a8b26+'-'+_0x1a5b62+'/'+_0x5315d0)[_0x5763('0x1d')](_0xd4c5fc);}return null;};}function patchUpdates(_0x581094){return function(_0x3fb496){try{jsonpatch[_0x5763('0x1e')](_0x3fb496,_0x581094,!![]);}catch(_0x12d1cc){return BPromise['reject'](_0x12d1cc);}return _0x3fb496[_0x5763('0x1f')]();};}function saveUpdates(_0x3f39eb,_0xa2d36a){return function(_0x3a98c7){if(_0x3a98c7){return _0x3a98c7[_0x5763('0x20')](_0x3f39eb)['then'](function(_0x564dd9){return _0x564dd9;});}return null;};}function removeEntity(_0x342f02,_0xb3f6e6){return function(_0x2c504b){if(_0x2c504b){return _0x2c504b[_0x5763('0x21')]()[_0x5763('0x22')](function(){var _0xee87a0=_0x2c504b[_0x5763('0x23')]({'plain':!![]});var _0x5f4ffd='Sounds';return db['UserProfileResource']['destroy']({'where':{'type':_0x5f4ffd,'resourceId':_0xee87a0['id']}})['then'](function(){return _0x2c504b;});})[_0x5763('0x22')](function(){_0x342f02[_0x5763('0x16')](0xcc)[_0x5763('0x17')]();});}};}function handleEntityNotFound(_0x30f402,_0x350433){return function(_0x5a2319){if(!_0x5a2319){_0x30f402['sendStatus'](0x194);}return _0x5a2319;};}function handleError(_0x1fa159,_0x4cf489){_0x4cf489=_0x4cf489||0x1f4;return function(_0x4d36ef){logger['error'](_0x4d36ef['stack']);if(_0x4d36ef[_0x5763('0x24')]){delete _0x4d36ef[_0x5763('0x24')];}_0x1fa159['status'](_0x4cf489)['send'](_0x4d36ef);};}exports['index']=function(_0x53743d,_0x46a002){var _0x349db8={},_0x24c973={},_0x1d53de={'count':0x0,'rows':[]};var _0x4a6f82=_[_0x5763('0x25')](db[_0x5763('0x26')][_0x5763('0x27')],function(_0x63e046){return{'name':_0x63e046['fieldName'],'type':_0x63e046[_0x5763('0x28')][_0x5763('0x29')]};});_0x24c973[_0x5763('0x2a')]=_[_0x5763('0x25')](_0x4a6f82,_0x5763('0x24'));_0x24c973[_0x5763('0x2b')]=_['keys'](_0x53743d['query']);_0x24c973['filters']=_[_0x5763('0x2c')](_0x24c973[_0x5763('0x2a')],_0x24c973[_0x5763('0x2b')]);_0x349db8[_0x5763('0x2d')]=_[_0x5763('0x2c')](_0x24c973[_0x5763('0x2a')],qs[_0x5763('0x2e')](_0x53743d['query'][_0x5763('0x2e')]));_0x349db8[_0x5763('0x2d')]=_0x349db8[_0x5763('0x2d')][_0x5763('0x2f')]?_0x349db8[_0x5763('0x2d')]:_0x24c973['model'];if(!_0x53743d[_0x5763('0x2b')][_0x5763('0x30')]('nolimit')){_0x349db8[_0x5763('0x1a')]=qs[_0x5763('0x1a')](_0x53743d[_0x5763('0x2b')]['limit']);_0x349db8[_0x5763('0x18')]=qs[_0x5763('0x18')](_0x53743d[_0x5763('0x2b')][_0x5763('0x18')]);}_0x349db8[_0x5763('0x31')]=qs[_0x5763('0x32')](_0x53743d[_0x5763('0x2b')][_0x5763('0x32')]);_0x349db8[_0x5763('0x33')]=qs[_0x5763('0x34')](_[_0x5763('0x35')](_0x53743d[_0x5763('0x2b')],_0x24c973[_0x5763('0x34')]),_0x4a6f82);if(_0x53743d[_0x5763('0x2b')][_0x5763('0x36')]){_0x349db8[_0x5763('0x33')]=_[_0x5763('0x37')](_0x349db8[_0x5763('0x33')],{'$or':_[_0x5763('0x25')](_0x4a6f82,function(_0x1fc7a3){if(_0x1fc7a3[_0x5763('0x28')]!=='VIRTUAL'){var _0x57cd2e={};_0x57cd2e[_0x1fc7a3[_0x5763('0x24')]]={'$like':'%'+_0x53743d[_0x5763('0x2b')]['filter']+'%'};return _0x57cd2e;}})});}_0x349db8=_[_0x5763('0x37')]({},_0x349db8,_0x53743d[_0x5763('0x38')]);var _0x41a2c6={'where':_0x349db8[_0x5763('0x33')]};return db['Sound'][_0x5763('0x1b')](_0x41a2c6)[_0x5763('0x22')](function(_0x418c90){_0x1d53de['count']=_0x418c90;if(_0x53743d[_0x5763('0x2b')][_0x5763('0x39')]){_0x349db8[_0x5763('0x3a')]=[{'all':!![]}];}return db[_0x5763('0x26')][_0x5763('0x3b')](_0x349db8);})[_0x5763('0x22')](function(_0x13eb1f){_0x1d53de[_0x5763('0x3c')]=_0x13eb1f;return _0x1d53de;})[_0x5763('0x22')](respondWithFilteredResult(_0x46a002,_0x349db8))[_0x5763('0x3d')](handleError(_0x46a002,null));};exports['show']=function(_0x32a23a,_0x1df800){var _0x1b2c8f={'raw':!![],'where':{'id':_0x32a23a[_0x5763('0x3e')]['id']}},_0x4b9c29={};_0x4b9c29['model']=_['keys'](db[_0x5763('0x26')][_0x5763('0x27')]);_0x4b9c29[_0x5763('0x2b')]=_[_0x5763('0x3f')](_0x32a23a[_0x5763('0x2b')]);_0x4b9c29[_0x5763('0x34')]=_['intersection'](_0x4b9c29[_0x5763('0x2a')],_0x4b9c29['query']);_0x1b2c8f['attributes']=_[_0x5763('0x2c')](_0x4b9c29[_0x5763('0x2a')],qs[_0x5763('0x2e')](_0x32a23a[_0x5763('0x2b')][_0x5763('0x2e')]));_0x1b2c8f[_0x5763('0x2d')]=_0x1b2c8f[_0x5763('0x2d')][_0x5763('0x2f')]?_0x1b2c8f[_0x5763('0x2d')]:_0x4b9c29[_0x5763('0x2a')];if(_0x32a23a[_0x5763('0x2b')][_0x5763('0x39')]){_0x1b2c8f[_0x5763('0x3a')]=[{'all':!![]}];}_0x1b2c8f=_[_0x5763('0x37')]({},_0x1b2c8f,_0x32a23a[_0x5763('0x38')]);return db[_0x5763('0x26')]['find'](_0x1b2c8f)['then'](handleEntityNotFound(_0x1df800,null))[_0x5763('0x22')](respondWithResult(_0x1df800,null))[_0x5763('0x3d')](handleError(_0x1df800,null));};exports[_0x5763('0x40')]=function(_0x51d366,_0x8ec27a,_0x4d6d4f){return db['Sound'][_0x5763('0x41')]({'where':{'id':_0x51d366['params']['id']},'attributes':[_0x5763('0x24'),'save_name',_0x5763('0x42')],'raw':!![]})[_0x5763('0x22')](handleEntityNotFound(_0x8ec27a,null))[_0x5763('0x22')](function(_0x40e24){if(_0x40e24){if(!fs[_0x5763('0x43')](path[_0x5763('0x44')](config[_0x5763('0x45')],_0x5763('0x46'),_0x40e24[_0x5763('0x47')]+'.'+_0x40e24[_0x5763('0x42')]))){throw new db['Sequelize'][(_0x5763('0x48'))]('Sound\x20not\x20found');}return _0x8ec27a[_0x5763('0x40')](path[_0x5763('0x44')](config['root'],'server/files/sounds/converted',util[_0x5763('0x49')](_0x5763('0x4a'),_0x40e24[_0x5763('0x47')],_0x40e24[_0x5763('0x42')])),util[_0x5763('0x49')](_0x5763('0x4a'),_0x40e24[_0x5763('0x24')],_0x40e24[_0x5763('0x42')]));}return null;})['catch'](handleError(_0x8ec27a,null));};exports[_0x5763('0x4b')]=function(_0x44d987,_0x5f21d5,_0x50471e){var _0x15b788={'name':path[_0x5763('0x4c')](_0x44d987[_0x5763('0x4d')][_0x5763('0x4e')],path[_0x5763('0x4f')](_0x44d987['file'][_0x5763('0x4e')])),'save_name':path[_0x5763('0x4c')](_0x44d987[_0x5763('0x4d')][_0x5763('0x50')],path[_0x5763('0x4f')](_0x44d987['file']['filename'])),'original_format':path['extname'](_0x44d987[_0x5763('0x4d')][_0x5763('0x4e')])[_0x5763('0x51')](0x1),'converted_format':'wav'};var _0x1ddf3a=path['join'](config[_0x5763('0x45')],_0x5763('0x52'),_0x44d987[_0x5763('0x4d')]['filename']);var _0x4396bf=path[_0x5763('0x44')](config[_0x5763('0x45')],_0x5763('0x46'),util['format'](_0x5763('0x4a'),path['basename'](_0x44d987[_0x5763('0x4d')][_0x5763('0x50')],path[_0x5763('0x4f')](_0x44d987[_0x5763('0x4d')]['filename'])),_0x15b788['converted_format']));logger[_0x5763('0x53')](_0x5763('0x54'),_0x1ddf3a);logger[_0x5763('0x53')](_0x5763('0x55'),_0x4396bf);try{fs[_0x5763('0x56')](_0x1ddf3a,parseInt(_0x5763('0x57'),0x8));var _0x46084c=sox[_0x5763('0x58')](_0x1ddf3a,_0x4396bf,{'sampleRate':0x1f40,'format':_0x5763('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x46084c['on'](_0x5763('0x5a'),function(_0x2111f0){fs[_0x5763('0x5b')](_0x1ddf3a);_0x5f21d5[_0x5763('0x16')](0x1f4)[_0x5763('0x5c')](_0x2111f0);});_0x46084c['on']('src',function(_0x259013){_0x15b788[_0x5763('0x5d')]=isNaN(_0x259013[_0x5763('0x5e')])?null:_0x259013[_0x5763('0x5e')]*0x3e8;_0x15b788['original_sampleCount']=isNaN(_0x259013['sampleCount'])?null:_0x259013[_0x5763('0x5f')];_0x15b788[_0x5763('0x60')]=isNaN(_0x259013[_0x5763('0x61')])?null:_0x259013[_0x5763('0x61')];_0x15b788[_0x5763('0x62')]=isNaN(_0x259013[_0x5763('0x63')])?null:_0x259013[_0x5763('0x63')];_0x15b788[_0x5763('0x64')]=isNaN(_0x259013[_0x5763('0x65')])?null:_0x259013[_0x5763('0x65')];});_0x46084c['on']('dest',function(_0x1f8784){_0x15b788[_0x5763('0x66')]=isNaN(_0x1f8784[_0x5763('0x5e')])?null:_0x1f8784[_0x5763('0x5e')]*0x3e8;_0x15b788[_0x5763('0x67')]=isNaN(_0x1f8784['sampleCount'])?null:_0x1f8784[_0x5763('0x5f')];_0x15b788[_0x5763('0x68')]=isNaN(_0x1f8784[_0x5763('0x61')])?null:_0x1f8784[_0x5763('0x61')];_0x15b788[_0x5763('0x69')]=isNaN(_0x1f8784[_0x5763('0x63')])?null:_0x1f8784[_0x5763('0x63')];_0x15b788[_0x5763('0x6a')]=isNaN(_0x1f8784['sampleRate'])?null:_0x1f8784[_0x5763('0x65')];});_0x46084c['on']('end',function(){fs[_0x5763('0x56')](_0x4396bf,parseInt('0777',0x8));return db[_0x5763('0x26')][_0x5763('0x4b')](_0x15b788)[_0x5763('0x22')](function(_0x1760e3){var _0x2c4154={'role':_0x44d987['body'][_0x5763('0x6b')],'userProfileId':_0x44d987[_0x5763('0x6c')][_0x5763('0x6d')]};if(!_0x2c4154)throw new Error(_0x5763('0x6e'));if(_0x2c4154[_0x5763('0x6b')]===_0x5763('0x6f')){var _0x190c58=_0x1760e3[_0x5763('0x23')]({'plain':!![]});return db[_0x5763('0x70')]['find']({'where':{'name':_0x5763('0x71'),'userProfileId':_0x2c4154['userProfileId']},'raw':!![]})[_0x5763('0x22')](function(_0x232efe){if(_0x232efe&&_0x232efe[_0x5763('0x72')]===0x0){return db['UserProfileResource'][_0x5763('0x4b')]({'name':_0x190c58[_0x5763('0x24')],'resourceId':_0x190c58['id'],'type':_0x232efe[_0x5763('0x24')],'sectionId':_0x232efe['id']},{})['then'](function(){return _0x1760e3;});}else{return _0x1760e3;}})['catch'](function(_0x37be9e){logger[_0x5763('0x5a')](_0x5763('0x73'),_0x37be9e);throw _0x37be9e;});}return _0x1760e3;})[_0x5763('0x22')](respondWithResult(_0x5f21d5,null))['catch'](handleError(_0x5f21d5,null));});_0x46084c[_0x5763('0x74')]();}catch(_0x27b358){_0x5f21d5[_0x5763('0x16')](0x1f4)[_0x5763('0x5c')](_0x27b358);}};exports['update']=function(_0x2bacd3,_0x465c1f,_0x793288){return db['Sound'][_0x5763('0x41')]({'where':{'id':_0x2bacd3[_0x5763('0x3e')]['id']}})[_0x5763('0x22')](handleEntityNotFound(_0x465c1f,null))[_0x5763('0x22')](saveUpdates(_['pick'](_0x2bacd3[_0x5763('0x6c')],[_0x5763('0x24'),_0x5763('0x75')]),null))['then'](respondWithResult(_0x465c1f,null))[_0x5763('0x3d')](handleError(_0x465c1f,null));};exports[_0x5763('0x76')]=function(_0x593482,_0x281620,_0x8202d3){return db[_0x5763('0x26')][_0x5763('0x41')]({'where':{'id':_0x593482[_0x5763('0x3e')]['id']}})[_0x5763('0x22')](function(_0x44cbaf){if(_0x44cbaf){return _0x44cbaf[_0x5763('0x21')]();}})[_0x5763('0x22')](function(_0x256f18){var _0x20e862=path[_0x5763('0x44')](config[_0x5763('0x45')],_0x5763('0x52'),util[_0x5763('0x49')](_0x5763('0x4a'),_0x256f18[_0x5763('0x47')],_0x256f18[_0x5763('0x77')]));var _0xe4bf5c=path['join'](config[_0x5763('0x45')],_0x5763('0x46'),util[_0x5763('0x49')](_0x5763('0x4a'),_0x256f18['save_name'],_0x256f18['converted_format']));fs['unlinkSync'](_0x20e862);fs[_0x5763('0x5b')](_0xe4bf5c);return _0x256f18;})[_0x5763('0x22')](function(_0xf8b1d0){if(_0xf8b1d0){return _0x281620[_0x5763('0x16')](0xcc)[_0x5763('0x17')]();}})[_0x5763('0x22')](handleEntityNotFound(_0x281620,null))['catch'](handleError(_0x281620,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 788a23d..c6aef39 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 _0x5700=['../../config/environment','exports','define','tools_sounds','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x5700,0x9d));var _0x0570=function(_0x3e30aa,_0x1be53b){_0x3e30aa=_0x3e30aa-0x0;var _0x212ec8=_0x5700[_0x3e30aa];return _0x212ec8;};'use strict';var _=require(_0x0570('0x0'));var util=require('util');var logger=require(_0x0570('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0570('0x2'));var rp=require(_0x0570('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0570('0x4'));var config=require(_0x0570('0x5'));var attributes=require('./sound.attributes');module[_0x0570('0x6')]=function(_0x6671d,_0x15e292){return _0x6671d[_0x0570('0x7')]('Sound',attributes,{'tableName':_0x0570('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb674=['exports','define','Sound','lodash','util','bluebird','request-promise','path'];(function(_0x2d5dcd,_0x550287){var _0x53076d=function(_0xcfc43a){while(--_0xcfc43a){_0x2d5dcd['push'](_0x2d5dcd['shift']());}};_0x53076d(++_0x550287);}(_0xb674,0x1d3));var _0x4b67=function(_0x96c265,_0x269a5e){_0x96c265=_0x96c265-0x0;var _0x24a383=_0xb674[_0x96c265];return _0x24a383;};'use strict';var _=require(_0x4b67('0x0'));var util=require(_0x4b67('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4b67('0x2'));var rp=require(_0x4b67('0x3'));var fs=require('fs');var path=require(_0x4b67('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x4b67('0x5')]=function(_0x5924d7,_0x1990c2){return _0x5924d7[_0x4b67('0x6')](_0x4b67('0x7'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index c32293d..f3688a7 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 _0x04b6=['then','request\x20sent','error','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','Sound','options','attributes','include','map','model','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x1250c9,_0x4034c2){var _0x6fbaa=function(_0x368ea0){while(--_0x368ea0){_0x1250c9['push'](_0x1250c9['shift']());}};_0x6fbaa(++_0x4034c2);}(_0x04b6,0x162));var _0x604b=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x04b6[_0x1f99a0];return _0x1e0849;};'use strict';var _=require('lodash');var util=require(_0x604b('0x0'));var moment=require(_0x604b('0x1'));var BPromise=require('bluebird');var rs=require(_0x604b('0x2'));var fs=require('fs');var Redis=require(_0x604b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x604b('0x4'));var logger=require(_0x604b('0x5'))(_0x604b('0x6'));var config=require(_0x604b('0x7'));var jayson=require(_0x604b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16aae2,_0x457437,_0x67eb6e){return new BPromise(function(_0x340c2c,_0x315365){return client[_0x604b('0x9')](_0x16aae2,_0x67eb6e)[_0x604b('0xa')](function(_0x3121d0){logger['info']('Sound,\x20%s,\x20%s',_0x457437,_0x604b('0xb'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x457437,_0x604b('0xb'),JSON['stringify'](_0x3121d0));if(_0x3121d0[_0x604b('0xc')]){if(_0x3121d0[_0x604b('0xc')]['code']===0x1f4){logger[_0x604b('0xc')](_0x604b('0xd'),_0x457437,_0x3121d0['error'][_0x604b('0xe')]);return _0x315365(_0x3121d0[_0x604b('0xc')]['message']);}logger[_0x604b('0xc')]('Sound,\x20%s,\x20%s',_0x457437,_0x3121d0['error'][_0x604b('0xe')]);return _0x340c2c(_0x3121d0[_0x604b('0xc')]['message']);}else{logger[_0x604b('0xf')](_0x604b('0xd'),_0x457437,_0x604b('0xb'));_0x340c2c(_0x3121d0[_0x604b('0x10')][_0x604b('0xe')]);}})[_0x604b('0x11')](function(_0xb615de){logger['error'](_0x604b('0xd'),_0x457437,_0xb615de);_0x315365(_0xb615de);});});}exports[_0x604b('0x12')]=function(_0x2d1651){var _0x16b67f=this;return new Promise(function(_0x185e68,_0x164df2){return db[_0x604b('0x13')]['find']({'raw':_0x2d1651['options']?_0x2d1651['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d1651['options']?_0x2d1651[_0x604b('0x14')]['where']||null:null,'attributes':_0x2d1651[_0x604b('0x14')]?_0x2d1651[_0x604b('0x14')][_0x604b('0x15')]||null:null,'include':_0x2d1651[_0x604b('0x14')]?_0x2d1651[_0x604b('0x14')][_0x604b('0x16')]?_[_0x604b('0x17')](_0x2d1651[_0x604b('0x14')]['include'],function(_0x488257){return{'model':db[_0x488257[_0x604b('0x18')]],'as':_0x488257['as'],'attributes':_0x488257[_0x604b('0x15')],'include':_0x488257['include']?_[_0x604b('0x17')](_0x488257['include'],function(_0x248acd){return{'model':db[_0x248acd[_0x604b('0x18')]],'as':_0x248acd['as'],'attributes':_0x248acd['attributes'],'include':_0x248acd['include']?_[_0x604b('0x17')](_0x248acd['include'],function(_0x57d66d){return{'model':db[_0x57d66d['model']],'as':_0x57d66d['as'],'attributes':_0x57d66d['attributes']};}):[]};}):[]};}):[]:[]})[_0x604b('0xa')](function(_0x450242){logger[_0x604b('0xf')]('ShowSound',_0x2d1651);logger[_0x604b('0x19')](_0x604b('0x12'),_0x2d1651,JSON['stringify'](_0x450242));_0x185e68(_0x450242);})[_0x604b('0x11')](function(_0x18bb50){logger[_0x604b('0xc')](_0x604b('0x12'),_0x18bb50[_0x604b('0xe')],_0x2d1651);_0x164df2(_0x16b67f[_0x604b('0xc')](0x1f4,_0x18bb50[_0x604b('0xe')]));});});}; \ No newline at end of file +var _0x702f=['options','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSound','Sound','find'];(function(_0x576f83,_0x3ed865){var _0x1cab7e=function(_0x452078){while(--_0x452078){_0x576f83['push'](_0x576f83['shift']());}};_0x1cab7e(++_0x3ed865);}(_0x702f,0x85));var _0xf702=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x702f[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xf702('0x0'));var moment=require(_0xf702('0x1'));var BPromise=require(_0xf702('0x2'));var rs=require(_0xf702('0x3'));var fs=require('fs');var Redis=require(_0xf702('0x4'));var db=require(_0xf702('0x5'))['db'];var utils=require(_0xf702('0x6'));var logger=require('../../config/logger')(_0xf702('0x7'));var config=require('../../config/environment');var jayson=require(_0xf702('0x8'));var client=jayson[_0xf702('0x9')][_0xf702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20a113,_0x36bb11,_0x2b2430){return new BPromise(function(_0x3384b3,_0x63f278){return client[_0xf702('0xb')](_0x20a113,_0x2b2430)[_0xf702('0xc')](function(_0x24b12f){logger['info'](_0xf702('0xd'),_0x36bb11,_0xf702('0xe'));logger[_0xf702('0xf')](_0xf702('0x10'),_0x36bb11,_0xf702('0xe'),JSON[_0xf702('0x11')](_0x24b12f));if(_0x24b12f[_0xf702('0x12')]){if(_0x24b12f['error'][_0xf702('0x13')]===0x1f4){logger['error'](_0xf702('0xd'),_0x36bb11,_0x24b12f[_0xf702('0x12')][_0xf702('0x14')]);return _0x63f278(_0x24b12f[_0xf702('0x12')][_0xf702('0x14')]);}logger[_0xf702('0x12')](_0xf702('0xd'),_0x36bb11,_0x24b12f[_0xf702('0x12')][_0xf702('0x14')]);return _0x3384b3(_0x24b12f['error'][_0xf702('0x14')]);}else{logger[_0xf702('0x15')](_0xf702('0xd'),_0x36bb11,_0xf702('0xe'));_0x3384b3(_0x24b12f[_0xf702('0x16')][_0xf702('0x14')]);}})[_0xf702('0x17')](function(_0x29586e){logger[_0xf702('0x12')](_0xf702('0xd'),_0x36bb11,_0x29586e);_0x63f278(_0x29586e);});});}exports[_0xf702('0x18')]=function(_0x30ea2f){var _0x967867=this;return new Promise(function(_0x286cdd,_0x3d9e34){return db[_0xf702('0x19')][_0xf702('0x1a')]({'raw':_0x30ea2f['options']?_0x30ea2f[_0xf702('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x30ea2f[_0xf702('0x1b')]?_0x30ea2f[_0xf702('0x1b')]['where']||null:null,'attributes':_0x30ea2f['options']?_0x30ea2f[_0xf702('0x1b')][_0xf702('0x1c')]||null:null,'include':_0x30ea2f[_0xf702('0x1b')]?_0x30ea2f[_0xf702('0x1b')][_0xf702('0x1d')]?_[_0xf702('0x1e')](_0x30ea2f['options'][_0xf702('0x1d')],function(_0x12dab2){return{'model':db[_0x12dab2['model']],'as':_0x12dab2['as'],'attributes':_0x12dab2[_0xf702('0x1c')],'include':_0x12dab2[_0xf702('0x1d')]?_[_0xf702('0x1e')](_0x12dab2[_0xf702('0x1d')],function(_0x54a34c){return{'model':db[_0x54a34c[_0xf702('0x1f')]],'as':_0x54a34c['as'],'attributes':_0x54a34c[_0xf702('0x1c')],'include':_0x54a34c['include']?_[_0xf702('0x1e')](_0x54a34c[_0xf702('0x1d')],function(_0x28d97c){return{'model':db[_0x28d97c['model']],'as':_0x28d97c['as'],'attributes':_0x28d97c['attributes']};}):[]};}):[]};}):[]:[]})[_0xf702('0xc')](function(_0x13ae9b){logger[_0xf702('0x15')](_0xf702('0x18'),_0x30ea2f);logger[_0xf702('0xf')](_0xf702('0x18'),_0x30ea2f,JSON['stringify'](_0x13ae9b));_0x286cdd(_0x13ae9b);})[_0xf702('0x17')](function(_0x4e3af9){logger[_0xf702('0x12')](_0xf702('0x18'),_0x4e3af9[_0xf702('0x14')],_0x30ea2f);_0x3d9e34(_0x967867[_0xf702('0x12')](0x1f4,_0x4e3af9[_0xf702('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1f0e2cd..f7a2c14 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x43ffa9,_0x408818){var _0x19a91b=function(_0xd6025c){while(--_0xd6025c){_0x43ffa9['push'](_0x43ffa9['shift']());}};_0x19a91b(++_0x408818);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x5eb8[_0x1762b4];return _0x29beda;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x57dd90,_0x58ddc4){var _0x34abca=function(_0x166d60){while(--_0x166d60){_0x57dd90['push'](_0x57dd90['shift']());}};_0x34abca(++_0x58ddc4);}(_0xda3f,0xec));var _0xfda3=function(_0x56543e,_0x7fb94f){_0x56543e=_0x56543e-0x0;var _0x1f5487=_0xda3f[_0x56543e];return _0x1f5487;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 37fb50e..2cebea5 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 _0xa211=['TEXT','sequelize','exports','STRING','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa211,0xec));var _0x1a21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa211[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x1a21('0x0'));module[_0x1a21('0x1')]={'uniqueid':{'type':Sequelize[_0x1a21('0x2')]},'body':{'type':Sequelize['TEXT'](_0x1a21('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x1a21('0x4')]}}; \ No newline at end of file +var _0xec0c=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0xa9fdc4,_0x3a59db){var _0x3874da=function(_0x2f64ae){while(--_0x2f64ae){_0xa9fdc4['push'](_0xa9fdc4['shift']());}};_0x3874da(++_0x3a59db);}(_0xec0c,0x7f));var _0xcec0=function(_0x5cc8d0,_0x1bfedf){_0x5cc8d0=_0x5cc8d0-0x0;var _0x11beb9=_0xec0c[_0x5cc8d0];return _0x11beb9;};'use strict';var Sequelize=require(_0xcec0('0x0'));module[_0xcec0('0x1')]={'uniqueid':{'type':Sequelize[_0xcec0('0x2')]},'body':{'type':Sequelize[_0xcec0('0x3')](_0xcec0('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xcec0('0x5')]('in',_0xcec0('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xcec0('0x2')]},'providerResponse':{'type':Sequelize[_0xcec0('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6d08706..6a507cc 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 _0xf300=['../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareMessage','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x23fbf8,_0x1953d3){var _0x12b407=function(_0x36eb7e){while(--_0x36eb7e){_0x23fbf8['push'](_0x23fbf8['shift']());}};_0x12b407(++_0x1953d3);}(_0xf300,0xc6));var _0x0f30=function(_0x38fb0d,_0x52b5db){_0x38fb0d=_0x38fb0d-0x0;var _0x30a5d6=_0xf300[_0x38fb0d];return _0x30a5d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f30('0x0'));var jsonpatch=require(_0x0f30('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f30('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f30('0x3'));var sox=require(_0x0f30('0x4'));var csv=require(_0x0f30('0x5'));var ejs=require(_0x0f30('0x6'));var fs=require('fs');var fs_extra=require(_0x0f30('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f30('0x8'));var jsforce=require(_0x0f30('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x0f30('0x5'));var querystring=require(_0x0f30('0xa'));var Papa=require(_0x0f30('0xb'));var Redis=require(_0x0f30('0xc'));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(_0x0f30('0xd'))(_0x0f30('0xe'));var utils=require(_0x0f30('0xf'));var config=require(_0x0f30('0x10'));var licenseUtil=require(_0x0f30('0x11'));var db=require(_0x0f30('0x12'))['db'];function respondWithStatusCode(_0xd92bdb,_0x4c9ca0){_0x4c9ca0=_0x4c9ca0||0xcc;return function(_0x4f3b97){if(_0x4f3b97){return _0xd92bdb['sendStatus'](_0x4c9ca0);}return _0xd92bdb[_0x0f30('0x13')](_0x4c9ca0)[_0x0f30('0x14')]();};}function respondWithResult(_0x45b5f4,_0x5b379d){_0x5b379d=_0x5b379d||0xc8;return function(_0xb35fae){if(_0xb35fae){return _0x45b5f4['status'](_0x5b379d)[_0x0f30('0x15')](_0xb35fae);}};}function respondWithFilteredResult(_0x56203c,_0x2aea33){return function(_0x17657c){if(_0x17657c){var _0x552d20=typeof _0x2aea33['offset']==='undefined'&&typeof _0x2aea33[_0x0f30('0x16')]===_0x0f30('0x17');var _0x1d89f5=_0x17657c[_0x0f30('0x18')];var _0x3b10b9=_0x552d20?0x0:_0x2aea33[_0x0f30('0x19')];var _0x24bc69=_0x552d20?_0x17657c[_0x0f30('0x18')]:_0x2aea33['offset']+_0x2aea33[_0x0f30('0x16')];var _0x221483;if(_0x24bc69>=_0x1d89f5){_0x24bc69=_0x1d89f5;_0x221483=0xc8;}else{_0x221483=0xce;}_0x56203c[_0x0f30('0x13')](_0x221483);return _0x56203c['set'](_0x0f30('0x1a'),_0x3b10b9+'-'+_0x24bc69+'/'+_0x1d89f5)['json'](_0x17657c);}return null;};}function patchUpdates(_0x1b750f){return function(_0x45abab){try{jsonpatch[_0x0f30('0x1b')](_0x45abab,_0x1b750f,!![]);}catch(_0xb6b397){return BPromise[_0x0f30('0x1c')](_0xb6b397);}return _0x45abab[_0x0f30('0x1d')]();};}function saveUpdates(_0x202b5a,_0x192744){return function(_0x242873){if(_0x242873){return _0x242873[_0x0f30('0x1e')](_0x202b5a)[_0x0f30('0x1f')](function(_0xd0e52e){return _0xd0e52e;});}return null;};}function removeEntity(_0x23ff04,_0x56623a){return function(_0x5dd65a){if(_0x5dd65a){return _0x5dd65a[_0x0f30('0x20')]()['then'](function(){_0x23ff04[_0x0f30('0x13')](0xcc)[_0x0f30('0x14')]();});}};}function handleEntityNotFound(_0x539b15,_0x542276){return function(_0x4c36ab){if(!_0x4c36ab){_0x539b15[_0x0f30('0x21')](0x194);}return _0x4c36ab;};}function handleError(_0x48f9b9,_0x42fd86){_0x42fd86=_0x42fd86||0x1f4;return function(_0x50f37e){logger[_0x0f30('0x22')](_0x50f37e[_0x0f30('0x23')]);if(_0x50f37e[_0x0f30('0x24')]){delete _0x50f37e[_0x0f30('0x24')];}_0x48f9b9[_0x0f30('0x13')](_0x42fd86)[_0x0f30('0x25')](_0x50f37e);};}exports[_0x0f30('0x26')]=function(_0x2bc919,_0x18c34e){var _0x5ba84d={},_0x2263fe={},_0x58a6c5={'count':0x0,'rows':[]};var _0x54e286=_[_0x0f30('0x27')](db['SquareMessage'][_0x0f30('0x28')],function(_0x540b10){return{'name':_0x540b10[_0x0f30('0x29')],'type':_0x540b10[_0x0f30('0x2a')]['key']};});_0x2263fe[_0x0f30('0x2b')]=_['map'](_0x54e286,_0x0f30('0x24'));_0x2263fe['query']=_['keys'](_0x2bc919[_0x0f30('0x2c')]);_0x2263fe[_0x0f30('0x2d')]=_[_0x0f30('0x2e')](_0x2263fe[_0x0f30('0x2b')],_0x2263fe[_0x0f30('0x2c')]);_0x5ba84d[_0x0f30('0x2f')]=_['intersection'](_0x2263fe[_0x0f30('0x2b')],qs['fields'](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x30')]));_0x5ba84d[_0x0f30('0x2f')]=_0x5ba84d['attributes'][_0x0f30('0x31')]?_0x5ba84d[_0x0f30('0x2f')]:_0x2263fe[_0x0f30('0x2b')];if(!_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x32')](_0x0f30('0x33'))){_0x5ba84d[_0x0f30('0x16')]=qs[_0x0f30('0x16')](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x16')]);_0x5ba84d['offset']=qs[_0x0f30('0x19')](_0x2bc919['query'][_0x0f30('0x19')]);}_0x5ba84d[_0x0f30('0x34')]=qs[_0x0f30('0x35')](_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x35')]);_0x5ba84d['where']=qs['filters'](_[_0x0f30('0x36')](_0x2bc919['query'],_0x2263fe[_0x0f30('0x2d')]),_0x54e286);if(_0x2bc919[_0x0f30('0x2c')][_0x0f30('0x37')]){_0x5ba84d[_0x0f30('0x38')]=_[_0x0f30('0x39')](_0x5ba84d[_0x0f30('0x38')],{'$or':_['map'](_0x54e286,function(_0x779ded){if(_0x779ded[_0x0f30('0x2a')]!==_0x0f30('0x3a')){var _0x35a292={};_0x35a292[_0x779ded[_0x0f30('0x24')]]={'$like':'%'+_0x2bc919['query']['filter']+'%'};return _0x35a292;}})});}_0x5ba84d=_[_0x0f30('0x39')]({},_0x5ba84d,_0x2bc919[_0x0f30('0x3b')]);var _0x58353c={'where':_0x5ba84d[_0x0f30('0x38')]};return db[_0x0f30('0x3c')]['count'](_0x58353c)[_0x0f30('0x1f')](function(_0x5253a3){_0x58a6c5['count']=_0x5253a3;if(_0x2bc919[_0x0f30('0x2c')]['includeAll']){_0x5ba84d[_0x0f30('0x3d')]=[{'all':!![]}];}return db[_0x0f30('0x3c')][_0x0f30('0x3e')](_0x5ba84d);})[_0x0f30('0x1f')](function(_0x450c8e){_0x58a6c5[_0x0f30('0x3f')]=_0x450c8e;return _0x58a6c5;})[_0x0f30('0x1f')](respondWithFilteredResult(_0x18c34e,_0x5ba84d))['catch'](handleError(_0x18c34e,null));};exports[_0x0f30('0x40')]=function(_0x20952c,_0x430987){var _0x5c7e53={'raw':!![],'where':{'id':_0x20952c[_0x0f30('0x41')]['id']}},_0x2f58d4={};_0x2f58d4[_0x0f30('0x2b')]=_[_0x0f30('0x42')](db[_0x0f30('0x3c')][_0x0f30('0x28')]);_0x2f58d4[_0x0f30('0x2c')]=_['keys'](_0x20952c[_0x0f30('0x2c')]);_0x2f58d4['filters']=_[_0x0f30('0x2e')](_0x2f58d4[_0x0f30('0x2b')],_0x2f58d4[_0x0f30('0x2c')]);_0x5c7e53[_0x0f30('0x2f')]=_[_0x0f30('0x2e')](_0x2f58d4[_0x0f30('0x2b')],qs[_0x0f30('0x30')](_0x20952c[_0x0f30('0x2c')][_0x0f30('0x30')]));_0x5c7e53[_0x0f30('0x2f')]=_0x5c7e53['attributes'][_0x0f30('0x31')]?_0x5c7e53['attributes']:_0x2f58d4[_0x0f30('0x2b')];if(_0x20952c[_0x0f30('0x2c')][_0x0f30('0x43')]){_0x5c7e53[_0x0f30('0x3d')]=[{'all':!![]}];}_0x5c7e53=_[_0x0f30('0x39')]({},_0x5c7e53,_0x20952c[_0x0f30('0x3b')]);return db[_0x0f30('0x3c')][_0x0f30('0x44')](_0x5c7e53)[_0x0f30('0x1f')](handleEntityNotFound(_0x430987,null))[_0x0f30('0x1f')](respondWithResult(_0x430987,null))['catch'](handleError(_0x430987,null));};exports['create']=function(_0xbfe5c4,_0x30bcdc){return db[_0x0f30('0x3c')][_0x0f30('0x45')](_0xbfe5c4[_0x0f30('0x46')],{})[_0x0f30('0x1f')](respondWithResult(_0x30bcdc,0xc9))[_0x0f30('0x47')](handleError(_0x30bcdc,null));};exports[_0x0f30('0x1e')]=function(_0x5110bf,_0x3c4279){if(_0x5110bf[_0x0f30('0x46')]['id']){delete _0x5110bf[_0x0f30('0x46')]['id'];}return db[_0x0f30('0x3c')][_0x0f30('0x44')]({'where':{'id':_0x5110bf[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0x3c4279,null))[_0x0f30('0x1f')](saveUpdates(_0x5110bf[_0x0f30('0x46')],null))['then'](respondWithResult(_0x3c4279,null))[_0x0f30('0x47')](handleError(_0x3c4279,null));};exports['destroy']=function(_0x15d193,_0xa49a8c){return db[_0x0f30('0x3c')]['find']({'where':{'id':_0x15d193[_0x0f30('0x41')]['id']}})[_0x0f30('0x1f')](handleEntityNotFound(_0xa49a8c,null))[_0x0f30('0x1f')](removeEntity(_0xa49a8c,null))[_0x0f30('0x47')](handleError(_0xa49a8c,null));}; \ No newline at end of file +var _0x1956=['stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','filters','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error'];(function(_0x18d0ec,_0x494303){var _0xcc9a8e=function(_0x31e58b){while(--_0x31e58b){_0x18d0ec['push'](_0x18d0ec['shift']());}};_0xcc9a8e(++_0x494303);}(_0x1956,0x15c));var _0x6195=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x1956[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require(_0x6195('0x0'));var rimraf=require(_0x6195('0x1'));var zipdir=require(_0x6195('0x2'));var jsonpatch=require(_0x6195('0x3'));var rp=require(_0x6195('0x4'));var moment=require(_0x6195('0x5'));var BPromise=require(_0x6195('0x6'));var Mustache=require('mustache');var util=require(_0x6195('0x7'));var path=require(_0x6195('0x8'));var sox=require(_0x6195('0x9'));var csv=require(_0x6195('0xa'));var ejs=require(_0x6195('0xb'));var fs=require('fs');var fs_extra=require(_0x6195('0xc'));var _=require(_0x6195('0xd'));var squel=require(_0x6195('0xe'));var crypto=require(_0x6195('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6195('0x10'));var toCsv=require(_0x6195('0xa'));var querystring=require(_0x6195('0x11'));var Papa=require(_0x6195('0x12'));var Redis=require(_0x6195('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6195('0x14'));var as=require(_0x6195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6195('0x16'))(_0x6195('0x17'));var utils=require(_0x6195('0x18'));var config=require(_0x6195('0x19'));var licenseUtil=require(_0x6195('0x1a'));var db=require(_0x6195('0x1b'))['db'];function respondWithStatusCode(_0x1282f5,_0x96b635){_0x96b635=_0x96b635||0xcc;return function(_0x51b975){if(_0x51b975){return _0x1282f5[_0x6195('0x1c')](_0x96b635);}return _0x1282f5[_0x6195('0x1d')](_0x96b635)['end']();};}function respondWithResult(_0x29c5e0,_0x431b3d){_0x431b3d=_0x431b3d||0xc8;return function(_0x5320f7){if(_0x5320f7){return _0x29c5e0[_0x6195('0x1d')](_0x431b3d)[_0x6195('0x1e')](_0x5320f7);}};}function respondWithFilteredResult(_0x1af54a,_0x397370){return function(_0x6653b7){if(_0x6653b7){var _0x1a555f=typeof _0x397370[_0x6195('0x1f')]===_0x6195('0x20')&&typeof _0x397370['limit']==='undefined';var _0x21bf76=_0x6653b7[_0x6195('0x21')];var _0x6174a3=_0x1a555f?0x0:_0x397370[_0x6195('0x1f')];var _0x3b42a0=_0x1a555f?_0x6653b7['count']:_0x397370[_0x6195('0x1f')]+_0x397370['limit'];var _0x40134d;if(_0x3b42a0>=_0x21bf76){_0x3b42a0=_0x21bf76;_0x40134d=0xc8;}else{_0x40134d=0xce;}_0x1af54a[_0x6195('0x1d')](_0x40134d);return _0x1af54a[_0x6195('0x22')](_0x6195('0x23'),_0x6174a3+'-'+_0x3b42a0+'/'+_0x21bf76)[_0x6195('0x1e')](_0x6653b7);}return null;};}function patchUpdates(_0x4e9673){return function(_0x4cadf3){try{jsonpatch['apply'](_0x4cadf3,_0x4e9673,!![]);}catch(_0x5595e0){return BPromise[_0x6195('0x24')](_0x5595e0);}return _0x4cadf3[_0x6195('0x25')]();};}function saveUpdates(_0xc1e5d9,_0x4f2d43){return function(_0x5bed95){if(_0x5bed95){return _0x5bed95[_0x6195('0x26')](_0xc1e5d9)['then'](function(_0x4181f3){return _0x4181f3;});}return null;};}function removeEntity(_0x11cc46,_0x184080){return function(_0x5dbe2c){if(_0x5dbe2c){return _0x5dbe2c[_0x6195('0x27')]()[_0x6195('0x28')](function(){_0x11cc46[_0x6195('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b83dc,_0x5d3859){return function(_0x449360){if(!_0x449360){_0x5b83dc[_0x6195('0x1c')](0x194);}return _0x449360;};}function handleError(_0x320de9,_0x2aa569){_0x2aa569=_0x2aa569||0x1f4;return function(_0x283829){logger[_0x6195('0x29')](_0x283829[_0x6195('0x2a')]);if(_0x283829[_0x6195('0x2b')]){delete _0x283829[_0x6195('0x2b')];}_0x320de9[_0x6195('0x1d')](_0x2aa569)['send'](_0x283829);};}exports[_0x6195('0x2c')]=function(_0x5af2af,_0x126409){var _0x47563b={},_0x418144={},_0x3688d6={'count':0x0,'rows':[]};var _0x1402b9=_[_0x6195('0x2d')](db[_0x6195('0x2e')][_0x6195('0x2f')],function(_0x217ac1){return{'name':_0x217ac1[_0x6195('0x30')],'type':_0x217ac1[_0x6195('0x31')]['key']};});_0x418144[_0x6195('0x32')]=_[_0x6195('0x2d')](_0x1402b9,_0x6195('0x2b'));_0x418144[_0x6195('0x33')]=_['keys'](_0x5af2af[_0x6195('0x33')]);_0x418144['filters']=_[_0x6195('0x34')](_0x418144[_0x6195('0x32')],_0x418144['query']);_0x47563b[_0x6195('0x35')]=_[_0x6195('0x34')](_0x418144['model'],qs[_0x6195('0x36')](_0x5af2af[_0x6195('0x33')][_0x6195('0x36')]));_0x47563b[_0x6195('0x35')]=_0x47563b[_0x6195('0x35')][_0x6195('0x37')]?_0x47563b[_0x6195('0x35')]:_0x418144[_0x6195('0x32')];if(!_0x5af2af[_0x6195('0x33')]['hasOwnProperty'](_0x6195('0x38'))){_0x47563b[_0x6195('0x39')]=qs[_0x6195('0x39')](_0x5af2af['query'][_0x6195('0x39')]);_0x47563b[_0x6195('0x1f')]=qs[_0x6195('0x1f')](_0x5af2af[_0x6195('0x33')]['offset']);}_0x47563b[_0x6195('0x3a')]=qs[_0x6195('0x3b')](_0x5af2af[_0x6195('0x33')][_0x6195('0x3b')]);_0x47563b['where']=qs['filters'](_[_0x6195('0x3c')](_0x5af2af[_0x6195('0x33')],_0x418144['filters']),_0x1402b9);if(_0x5af2af[_0x6195('0x33')][_0x6195('0x3d')]){_0x47563b['where']=_[_0x6195('0x3e')](_0x47563b[_0x6195('0x3f')],{'$or':_[_0x6195('0x2d')](_0x1402b9,function(_0x1840e5){if(_0x1840e5[_0x6195('0x31')]!==_0x6195('0x40')){var _0x9d8efb={};_0x9d8efb[_0x1840e5[_0x6195('0x2b')]]={'$like':'%'+_0x5af2af['query'][_0x6195('0x3d')]+'%'};return _0x9d8efb;}})});}_0x47563b=_[_0x6195('0x3e')]({},_0x47563b,_0x5af2af[_0x6195('0x41')]);var _0x5e7b6b={'where':_0x47563b[_0x6195('0x3f')]};return db[_0x6195('0x2e')][_0x6195('0x21')](_0x5e7b6b)[_0x6195('0x28')](function(_0x39cb9b){_0x3688d6['count']=_0x39cb9b;if(_0x5af2af[_0x6195('0x33')][_0x6195('0x42')]){_0x47563b[_0x6195('0x43')]=[{'all':!![]}];}return db[_0x6195('0x2e')][_0x6195('0x44')](_0x47563b);})[_0x6195('0x28')](function(_0x353a65){_0x3688d6[_0x6195('0x45')]=_0x353a65;return _0x3688d6;})[_0x6195('0x28')](respondWithFilteredResult(_0x126409,_0x47563b))[_0x6195('0x46')](handleError(_0x126409,null));};exports[_0x6195('0x47')]=function(_0x51b4f3,_0x2dc47b){var _0x2f7895={'raw':!![],'where':{'id':_0x51b4f3[_0x6195('0x48')]['id']}},_0x45a188={};_0x45a188[_0x6195('0x32')]=_['keys'](db[_0x6195('0x2e')][_0x6195('0x2f')]);_0x45a188[_0x6195('0x33')]=_[_0x6195('0x49')](_0x51b4f3[_0x6195('0x33')]);_0x45a188[_0x6195('0x4a')]=_[_0x6195('0x34')](_0x45a188[_0x6195('0x32')],_0x45a188['query']);_0x2f7895[_0x6195('0x35')]=_[_0x6195('0x34')](_0x45a188[_0x6195('0x32')],qs[_0x6195('0x36')](_0x51b4f3[_0x6195('0x33')][_0x6195('0x36')]));_0x2f7895['attributes']=_0x2f7895[_0x6195('0x35')][_0x6195('0x37')]?_0x2f7895[_0x6195('0x35')]:_0x45a188[_0x6195('0x32')];if(_0x51b4f3[_0x6195('0x33')][_0x6195('0x42')]){_0x2f7895[_0x6195('0x43')]=[{'all':!![]}];}_0x2f7895=_['merge']({},_0x2f7895,_0x51b4f3[_0x6195('0x41')]);return db[_0x6195('0x2e')][_0x6195('0x4b')](_0x2f7895)[_0x6195('0x28')](handleEntityNotFound(_0x2dc47b,null))['then'](respondWithResult(_0x2dc47b,null))['catch'](handleError(_0x2dc47b,null));};exports[_0x6195('0x4c')]=function(_0x4a43f9,_0x2182fc){return db[_0x6195('0x2e')][_0x6195('0x4c')](_0x4a43f9[_0x6195('0x4d')],{})['then'](respondWithResult(_0x2182fc,0xc9))[_0x6195('0x46')](handleError(_0x2182fc,null));};exports[_0x6195('0x26')]=function(_0x3feac1,_0x1ea3e7){if(_0x3feac1['body']['id']){delete _0x3feac1[_0x6195('0x4d')]['id'];}return db[_0x6195('0x2e')]['find']({'where':{'id':_0x3feac1['params']['id']}})[_0x6195('0x28')](handleEntityNotFound(_0x1ea3e7,null))['then'](saveUpdates(_0x3feac1[_0x6195('0x4d')],null))[_0x6195('0x28')](respondWithResult(_0x1ea3e7,null))['catch'](handleError(_0x1ea3e7,null));};exports['destroy']=function(_0x589bad,_0x2f7e29){return db[_0x6195('0x2e')][_0x6195('0x4b')]({'where':{'id':_0x589bad['params']['id']}})[_0x6195('0x28')](handleEntityNotFound(_0x2f7e29,null))[_0x6195('0x28')](removeEntity(_0x2f7e29,null))['catch'](handleError(_0x2f7e29,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f481141..291aa09 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 _0x6d35=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages'];(function(_0x3cf150,_0x178cb5){var _0x931f8b=function(_0x40a693){while(--_0x40a693){_0x3cf150['push'](_0x3cf150['shift']());}};_0x931f8b(++_0x178cb5);}(_0x6d35,0xa5));var _0x56d3=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x6d35[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x56d3('0x0'));var util=require(_0x56d3('0x1'));var logger=require('../../config/logger')(_0x56d3('0x2'));var moment=require(_0x56d3('0x3'));var BPromise=require('bluebird');var rp=require(_0x56d3('0x4'));var fs=require('fs');var path=require(_0x56d3('0x5'));var rimraf=require(_0x56d3('0x6'));var config=require(_0x56d3('0x7'));var attributes=require(_0x56d3('0x8'));module['exports']=function(_0x49805f,_0x3b9b3a){return _0x49805f['define'](_0x56d3('0x9'),attributes,{'tableName':_0x56d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa89d=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x39a5f3,_0x2d783a){var _0x2c42c2=function(_0x7051e){while(--_0x7051e){_0x39a5f3['push'](_0x39a5f3['shift']());}};_0x2c42c2(++_0x2d783a);}(_0xa89d,0x78));var _0xda89=function(_0x26bc1f,_0xca1d90){_0x26bc1f=_0x26bc1f-0x0;var _0x332a38=_0xa89d[_0x26bc1f];return _0x332a38;};'use strict';var _=require(_0xda89('0x0'));var util=require(_0xda89('0x1'));var logger=require(_0xda89('0x2'))(_0xda89('0x3'));var moment=require(_0xda89('0x4'));var BPromise=require(_0xda89('0x5'));var rp=require(_0xda89('0x6'));var fs=require('fs');var path=require(_0xda89('0x7'));var rimraf=require(_0xda89('0x8'));var config=require(_0xda89('0x9'));var attributes=require(_0xda89('0xa'));module[_0xda89('0xb')]=function(_0x54c07d,_0x16d4d7){return _0x54c07d[_0xda89('0xc')](_0xda89('0xd'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 621c9d5..b62012b 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 _0xbfea=['SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','stringify','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','SquareMessage,\x20%s,\x20%s'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xbfea,0x73));var _0xabfe=function(_0x21f9d6,_0x310fd4){_0x21f9d6=_0x21f9d6-0x0;var _0xd0e11c=_0xbfea[_0x21f9d6];return _0xd0e11c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xabfe('0x0'));var BPromise=require('bluebird');var rs=require(_0xabfe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabfe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xabfe('0x3'))(_0xabfe('0x4'));var config=require('../../config/environment');var jayson=require(_0xabfe('0x5'));var client=jayson[_0xabfe('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2788ca,_0x27925a,_0x3ae972){return new BPromise(function(_0x40a8d9,_0x49cbe9){return client[_0xabfe('0x7')](_0x2788ca,_0x3ae972)[_0xabfe('0x8')](function(_0x518b27){logger['info'](_0xabfe('0x9'),_0x27925a,'request\x20sent');logger['debug'](_0xabfe('0xa'),_0x27925a,'request\x20sent',JSON['stringify'](_0x518b27));if(_0x518b27['error']){if(_0x518b27[_0xabfe('0xb')][_0xabfe('0xc')]===0x1f4){logger[_0xabfe('0xb')](_0xabfe('0x9'),_0x27925a,_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);return _0x49cbe9(_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);}logger[_0xabfe('0xb')]('SquareMessage,\x20%s,\x20%s',_0x27925a,_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);return _0x40a8d9(_0x518b27[_0xabfe('0xb')][_0xabfe('0xd')]);}else{logger[_0xabfe('0xe')](_0xabfe('0x9'),_0x27925a,_0xabfe('0xf'));_0x40a8d9(_0x518b27[_0xabfe('0x10')][_0xabfe('0xd')]);}})[_0xabfe('0x11')](function(_0x288c58){logger[_0xabfe('0xb')](_0xabfe('0x9'),_0x27925a,_0x288c58);_0x49cbe9(_0x288c58);});});}exports['CreateSquareMessage']=function(_0xe34e8a){var _0x4ef1be=this;return new Promise(function(_0x5115e7,_0x1c16cb){return db[_0xabfe('0x12')]['create'](_0xe34e8a[_0xabfe('0x13')],{'raw':_0xe34e8a[_0xabfe('0x14')]?_0xe34e8a[_0xabfe('0x14')][_0xabfe('0x15')]===undefined?!![]:![]:!![]})[_0xabfe('0x8')](function(_0x5d6a94){logger[_0xabfe('0xe')](_0xabfe('0x16'),_0xe34e8a);logger[_0xabfe('0x17')](_0xabfe('0x16'),_0xe34e8a,JSON[_0xabfe('0x18')](_0x5d6a94));_0x5115e7(_0x5d6a94);})[_0xabfe('0x11')](function(_0x1eeefe){logger[_0xabfe('0xb')](_0xabfe('0x16'),_0x1eeefe['message'],_0xe34e8a);_0x1c16cb(_0x4ef1be[_0xabfe('0xb')](0x1f4,_0x1eeefe[_0xabfe('0xd')]));});});}; \ No newline at end of file +var _0x12a9=['then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','SquareMessage','create','body','options','raw','CreateSquareMessage','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x327dfe,_0x40e0e){var _0xfa20e6=function(_0x183511){while(--_0x183511){_0x327dfe['push'](_0x327dfe['shift']());}};_0xfa20e6(++_0x40e0e);}(_0x12a9,0x1d4));var _0x912a=function(_0x3491a4,_0x5ec02d){_0x3491a4=_0x3491a4-0x0;var _0x33fcb8=_0x12a9[_0x3491a4];return _0x33fcb8;};'use strict';var _=require(_0x912a('0x0'));var util=require(_0x912a('0x1'));var moment=require(_0x912a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x912a('0x3'));var db=require(_0x912a('0x4'))['db'];var utils=require(_0x912a('0x5'));var logger=require(_0x912a('0x6'))(_0x912a('0x7'));var config=require(_0x912a('0x8'));var jayson=require(_0x912a('0x9'));var client=jayson['client'][_0x912a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230d03,_0x55de68,_0xea2179){return new BPromise(function(_0x4d5e0e,_0x160536){return client[_0x912a('0xb')](_0x230d03,_0xea2179)[_0x912a('0xc')](function(_0x4fb38c){logger[_0x912a('0xd')](_0x912a('0xe'),_0x55de68,'request\x20sent');logger[_0x912a('0xf')](_0x912a('0x10'),_0x55de68,'request\x20sent',JSON['stringify'](_0x4fb38c));if(_0x4fb38c['error']){if(_0x4fb38c[_0x912a('0x11')][_0x912a('0x12')]===0x1f4){logger[_0x912a('0x11')](_0x912a('0xe'),_0x55de68,_0x4fb38c[_0x912a('0x11')][_0x912a('0x13')]);return _0x160536(_0x4fb38c[_0x912a('0x11')]['message']);}logger[_0x912a('0x11')]('SquareMessage,\x20%s,\x20%s',_0x55de68,_0x4fb38c['error'][_0x912a('0x13')]);return _0x4d5e0e(_0x4fb38c[_0x912a('0x11')][_0x912a('0x13')]);}else{logger[_0x912a('0xd')]('SquareMessage,\x20%s,\x20%s',_0x55de68,_0x912a('0x14'));_0x4d5e0e(_0x4fb38c[_0x912a('0x15')][_0x912a('0x13')]);}})['catch'](function(_0x108812){logger[_0x912a('0x11')](_0x912a('0xe'),_0x55de68,_0x108812);_0x160536(_0x108812);});});}exports['CreateSquareMessage']=function(_0x1d1f8c){var _0x3c343b=this;return new Promise(function(_0x1c0f97,_0x3e324e){return db[_0x912a('0x16')][_0x912a('0x17')](_0x1d1f8c[_0x912a('0x18')],{'raw':_0x1d1f8c['options']?_0x1d1f8c[_0x912a('0x19')][_0x912a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5c1475){logger[_0x912a('0xd')](_0x912a('0x1b'),_0x1d1f8c);logger[_0x912a('0xf')](_0x912a('0x1b'),_0x1d1f8c,JSON[_0x912a('0x1c')](_0x5c1475));_0x1c0f97(_0x5c1475);})[_0x912a('0x1d')](function(_0x1538b6){logger[_0x912a('0x11')]('CreateSquareMessage',_0x1538b6[_0x912a('0x13')],_0x1d1f8c);_0x3e324e(_0x3c343b[_0x912a('0x11')](0x1f4,_0x1538b6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index f86c8e2..6ffb967 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 _0x15c5=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','post','create','put','/:id','update','delete','destroy'];(function(_0x192a08,_0x2ca8d8){var _0x1e962f=function(_0x3ce828){while(--_0x3ce828){_0x192a08['push'](_0x192a08['shift']());}};_0x1e962f(++_0x2ca8d8);}(_0x15c5,0x127));var _0x515c=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x15c5[_0x2675da];return _0x5e6153;};'use strict';var multer=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x515c('0x2'));var router=express[_0x515c('0x3')]();var fs_extra=require(_0x515c('0x4'));var auth=require(_0x515c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x515c('0x6'));var controller=require(_0x515c('0x7'));router[_0x515c('0x8')]('/',auth[_0x515c('0x9')](),controller[_0x515c('0xa')]);router['get']('/:id',auth[_0x515c('0x9')](),controller[_0x515c('0xb')]);router['get'](_0x515c('0xc'),auth[_0x515c('0x9')](),timeout('15s'),controller['test']);router[_0x515c('0xd')]('/',auth[_0x515c('0x9')](),controller[_0x515c('0xe')]);router[_0x515c('0xf')](_0x515c('0x10'),auth[_0x515c('0x9')](),controller[_0x515c('0x11')]);router[_0x515c('0x12')]('/:id',auth[_0x515c('0x9')](),controller[_0x515c('0x13')]);module[_0x515c('0x14')]=router; \ No newline at end of file +var _0xeda7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','15s','test','post','create','put','/:id','update','delete','multer','util'];(function(_0x536e5a,_0x32b912){var _0x4c7d63=function(_0x4e29d2){while(--_0x4e29d2){_0x536e5a['push'](_0x536e5a['shift']());}};_0x4c7d63(++_0x32b912);}(_0xeda7,0x1cc));var _0x7eda=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xeda7[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var path=require(_0x7eda('0x2'));var timeout=require(_0x7eda('0x3'));var express=require(_0x7eda('0x4'));var router=express[_0x7eda('0x5')]();var fs_extra=require(_0x7eda('0x6'));var auth=require(_0x7eda('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7eda('0x8'));var controller=require(_0x7eda('0x9'));router[_0x7eda('0xa')]('/',auth[_0x7eda('0xb')](),controller[_0x7eda('0xc')]);router['get']('/:id',auth[_0x7eda('0xb')](),controller[_0x7eda('0xd')]);router[_0x7eda('0xa')]('/:id/test',auth[_0x7eda('0xb')](),timeout(_0x7eda('0xe')),controller[_0x7eda('0xf')]);router[_0x7eda('0x10')]('/',auth[_0x7eda('0xb')](),controller[_0x7eda('0x11')]);router[_0x7eda('0x12')](_0x7eda('0x13'),auth['isAuthenticated'](),controller[_0x7eda('0x14')]);router[_0x7eda('0x15')](_0x7eda('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f20e6d9..c326573 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 _0x72c6=['STRING','name','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x72c6,0x92));var _0x672c=function(_0x2a442d,_0x15849b){_0x2a442d=_0x2a442d-0x0;var _0x439ede=_0x72c6[_0x2a442d];return _0x439ede;};'use strict';var Sequelize=require(_0x672c('0x0'));module[_0x672c('0x1')]={'name':{'type':Sequelize[_0x672c('0x2')],'unique':_0x672c('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x672c('0x2')]},'description':{'type':Sequelize[_0x672c('0x2')]}}; \ No newline at end of file +var _0x9508=['name','STRING','sequelize','exports'];(function(_0x420fc9,_0x1a6ba5){var _0x4984b8=function(_0x3a4819){while(--_0x3a4819){_0x420fc9['push'](_0x420fc9['shift']());}};_0x4984b8(++_0x1a6ba5);}(_0x9508,0x1ce));var _0x8950=function(_0xe8433c,_0x2a91fe){_0xe8433c=_0xe8433c-0x0;var _0x53ddd6=_0x9508[_0xe8433c];return _0x53ddd6;};'use strict';var Sequelize=require(_0x8950('0x0'));module[_0x8950('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8950('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8950('0x3')]},'description':{'type':Sequelize[_0x8950('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index cad1416..d5d2b48 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 _0xaf34=['filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','options','include','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','UserProfileSection','userProfileId','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','keys'];(function(_0x50d326,_0x1fc7e2){var _0x10f473=function(_0x2588fd){while(--_0x2588fd){_0x50d326['push'](_0x50d326['shift']());}};_0x10f473(++_0x1fc7e2);}(_0xaf34,0x11a));var _0x4af3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xaf34[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x4af3('0x0'));var rimraf=require(_0x4af3('0x1'));var zipdir=require(_0x4af3('0x2'));var jsonpatch=require(_0x4af3('0x3'));var rp=require(_0x4af3('0x4'));var moment=require(_0x4af3('0x5'));var BPromise=require(_0x4af3('0x6'));var Mustache=require(_0x4af3('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4af3('0x8'));var ejs=require(_0x4af3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4af3('0xa'));var squel=require(_0x4af3('0xb'));var crypto=require(_0x4af3('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4af3('0xd'));var Papa=require(_0x4af3('0xe'));var Redis=require('ioredis');var authService=require(_0x4af3('0xf'));var qs=require(_0x4af3('0x10'));var as=require(_0x4af3('0x11'));var hardwareService=require(_0x4af3('0x12'));var logger=require(_0x4af3('0x13'))(_0x4af3('0x14'));var utils=require(_0x4af3('0x15'));var config=require(_0x4af3('0x16'));var licenseUtil=require(_0x4af3('0x17'));var db=require(_0x4af3('0x18'))['db'];function respondWithStatusCode(_0x535e02,_0x540360){_0x540360=_0x540360||0xcc;return function(_0x55e1c8){if(_0x55e1c8){return _0x535e02[_0x4af3('0x19')](_0x540360);}return _0x535e02[_0x4af3('0x1a')](_0x540360)[_0x4af3('0x1b')]();};}function respondWithResult(_0x21e417,_0x2bf213){_0x2bf213=_0x2bf213||0xc8;return function(_0x351dea){if(_0x351dea){return _0x21e417[_0x4af3('0x1a')](_0x2bf213)['json'](_0x351dea);}};}function respondWithFilteredResult(_0xcdd21d,_0x5e3f70){return function(_0x28534a){if(_0x28534a){var _0x127440=typeof _0x5e3f70[_0x4af3('0x1c')]===_0x4af3('0x1d')&&typeof _0x5e3f70['limit']==='undefined';var _0x12cd24=_0x28534a[_0x4af3('0x1e')];var _0x3a970f=_0x127440?0x0:_0x5e3f70[_0x4af3('0x1c')];var _0x12b676=_0x127440?_0x28534a[_0x4af3('0x1e')]:_0x5e3f70[_0x4af3('0x1c')]+_0x5e3f70[_0x4af3('0x1f')];var _0xe0d622;if(_0x12b676>=_0x12cd24){_0x12b676=_0x12cd24;_0xe0d622=0xc8;}else{_0xe0d622=0xce;}_0xcdd21d[_0x4af3('0x1a')](_0xe0d622);return _0xcdd21d['set'](_0x4af3('0x20'),_0x3a970f+'-'+_0x12b676+'/'+_0x12cd24)[_0x4af3('0x21')](_0x28534a);}return null;};}function patchUpdates(_0x346194){return function(_0x39eeb0){try{jsonpatch['apply'](_0x39eeb0,_0x346194,!![]);}catch(_0x56b69a){return BPromise[_0x4af3('0x22')](_0x56b69a);}return _0x39eeb0[_0x4af3('0x23')]();};}function saveUpdates(_0x1e5714,_0x1d4e8f){return function(_0x4d3edc){if(_0x4d3edc){return _0x4d3edc['update'](_0x1e5714)[_0x4af3('0x24')](function(_0x45fbd9){return _0x45fbd9;});}return null;};}function removeEntity(_0x1d1269,_0x1f0efd){return function(_0x9cb93b){if(_0x9cb93b){return _0x9cb93b[_0x4af3('0x25')]()[_0x4af3('0x24')](function(){var _0x4a9745=_0x9cb93b[_0x4af3('0x26')]({'plain':!![]});var _0x13bbb9=_0x4af3('0x27');return db[_0x4af3('0x28')][_0x4af3('0x25')]({'where':{'type':_0x13bbb9,'resourceId':_0x4a9745['id']}})[_0x4af3('0x24')](function(){return _0x9cb93b;});})[_0x4af3('0x24')](function(){_0x1d1269['status'](0xcc)[_0x4af3('0x1b')]();});}};}function handleEntityNotFound(_0x36bac6,_0x4dfb3c){return function(_0x1511ef){if(!_0x1511ef){_0x36bac6['sendStatus'](0x194);}return _0x1511ef;};}function handleError(_0x567faf,_0x2dd793){_0x2dd793=_0x2dd793||0x1f4;return function(_0x5b5628){logger[_0x4af3('0x29')](_0x5b5628[_0x4af3('0x2a')]);if(_0x5b5628['name']){delete _0x5b5628[_0x4af3('0x2b')];}_0x567faf['status'](_0x2dd793)[_0x4af3('0x2c')](_0x5b5628);};}exports[_0x4af3('0x2d')]=function(_0x4a34d7,_0x516470){var _0x1490b6={},_0x3b70c2={},_0x411aaf={'count':0x0,'rows':[]};var _0x3a0d46=_[_0x4af3('0x2e')](db[_0x4af3('0x2f')]['rawAttributes'],function(_0xc88bc2){return{'name':_0xc88bc2[_0x4af3('0x30')],'type':_0xc88bc2[_0x4af3('0x31')][_0x4af3('0x32')]};});_0x3b70c2[_0x4af3('0x33')]=_['map'](_0x3a0d46,_0x4af3('0x2b'));_0x3b70c2[_0x4af3('0x34')]=_[_0x4af3('0x35')](_0x4a34d7['query']);_0x3b70c2[_0x4af3('0x36')]=_[_0x4af3('0x37')](_0x3b70c2[_0x4af3('0x33')],_0x3b70c2['query']);_0x1490b6['attributes']=_['intersection'](_0x3b70c2[_0x4af3('0x33')],qs['fields'](_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x38')]));_0x1490b6['attributes']=_0x1490b6['attributes']['length']?_0x1490b6[_0x4af3('0x39')]:_0x3b70c2['model'];if(!_0x4a34d7[_0x4af3('0x34')]['hasOwnProperty']('nolimit')){_0x1490b6[_0x4af3('0x1f')]=qs[_0x4af3('0x1f')](_0x4a34d7[_0x4af3('0x34')]['limit']);_0x1490b6['offset']=qs['offset'](_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x1c')]);}_0x1490b6[_0x4af3('0x3a')]=qs[_0x4af3('0x3b')](_0x4a34d7[_0x4af3('0x34')]['sort']);_0x1490b6['where']=qs[_0x4af3('0x36')](_[_0x4af3('0x3c')](_0x4a34d7[_0x4af3('0x34')],_0x3b70c2[_0x4af3('0x36')]),_0x3a0d46);if(_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x3d')]){_0x1490b6[_0x4af3('0x3e')]=_[_0x4af3('0x3f')](_0x1490b6[_0x4af3('0x3e')],{'$or':_['map'](_0x3a0d46,function(_0x270243){if(_0x270243[_0x4af3('0x31')]!=='VIRTUAL'){var _0x4ab792={};_0x4ab792[_0x270243[_0x4af3('0x2b')]]={'$like':'%'+_0x4a34d7[_0x4af3('0x34')][_0x4af3('0x3d')]+'%'};return _0x4ab792;}})});}_0x1490b6=_[_0x4af3('0x3f')]({},_0x1490b6,_0x4a34d7[_0x4af3('0x40')]);var _0x297144={'where':_0x1490b6[_0x4af3('0x3e')]};return db[_0x4af3('0x2f')][_0x4af3('0x1e')](_0x297144)[_0x4af3('0x24')](function(_0x50fc3c){_0x411aaf[_0x4af3('0x1e')]=_0x50fc3c;if(_0x4a34d7[_0x4af3('0x34')]['includeAll']){_0x1490b6[_0x4af3('0x41')]=[{'all':!![]}];}return db[_0x4af3('0x2f')]['findAll'](_0x1490b6);})[_0x4af3('0x24')](function(_0x72d8a4){_0x411aaf['rows']=_0x72d8a4;return _0x411aaf;})['then'](respondWithFilteredResult(_0x516470,_0x1490b6))[_0x4af3('0x42')](handleError(_0x516470,null));};exports[_0x4af3('0x43')]=function(_0x51d099,_0x474944){var _0x4ecd09={'raw':!![],'where':{'id':_0x51d099[_0x4af3('0x44')]['id']}},_0x59594f={};_0x59594f[_0x4af3('0x33')]=_[_0x4af3('0x35')](db[_0x4af3('0x2f')][_0x4af3('0x45')]);_0x59594f['query']=_[_0x4af3('0x35')](_0x51d099['query']);_0x59594f[_0x4af3('0x36')]=_[_0x4af3('0x37')](_0x59594f[_0x4af3('0x33')],_0x59594f[_0x4af3('0x34')]);_0x4ecd09[_0x4af3('0x39')]=_[_0x4af3('0x37')](_0x59594f[_0x4af3('0x33')],qs[_0x4af3('0x38')](_0x51d099[_0x4af3('0x34')]['fields']));_0x4ecd09['attributes']=_0x4ecd09[_0x4af3('0x39')][_0x4af3('0x46')]?_0x4ecd09['attributes']:_0x59594f[_0x4af3('0x33')];if(_0x51d099['query'][_0x4af3('0x47')]){_0x4ecd09[_0x4af3('0x41')]=[{'all':!![]}];}_0x4ecd09=_['merge']({},_0x4ecd09,_0x51d099[_0x4af3('0x40')]);return db['SquareOdbc'][_0x4af3('0x48')](_0x4ecd09)[_0x4af3('0x24')](handleEntityNotFound(_0x474944,null))[_0x4af3('0x24')](respondWithResult(_0x474944,null))['catch'](handleError(_0x474944,null));};exports[_0x4af3('0x49')]=function(_0x35fb3a,_0x3d79b2){return db['SquareOdbc']['create'](_0x35fb3a[_0x4af3('0x4a')],{})[_0x4af3('0x24')](function(_0x10c22f){var _0x545a82=_0x35fb3a[_0x4af3('0x4b')]['get']({'plain':!![]});if(!_0x545a82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x545a82['role']===_0x4af3('0x4b')){var _0x2ab345=_0x10c22f['get']({'plain':!![]});var _0x327505=_0x4af3('0x27');return db[_0x4af3('0x4c')][_0x4af3('0x48')]({'where':{'name':_0x327505,'userProfileId':_0x545a82[_0x4af3('0x4d')]},'raw':!![]})[_0x4af3('0x24')](function(_0x5bcd5b){if(_0x5bcd5b&&_0x5bcd5b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2ab345[_0x4af3('0x2b')],'resourceId':_0x2ab345['id'],'type':_0x5bcd5b['name'],'sectionId':_0x5bcd5b['id']},{})[_0x4af3('0x24')](function(){return _0x10c22f;});}else{return _0x10c22f;}})[_0x4af3('0x42')](function(_0x524903){logger[_0x4af3('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x524903);throw _0x524903;});}return _0x10c22f;})[_0x4af3('0x24')](respondWithResult(_0x3d79b2,0xc9))['catch'](handleError(_0x3d79b2,null));};exports[_0x4af3('0x4e')]=function(_0x5dfd5f,_0x359cbf){if(_0x5dfd5f[_0x4af3('0x4a')]['id']){delete _0x5dfd5f[_0x4af3('0x4a')]['id'];}return db[_0x4af3('0x2f')][_0x4af3('0x48')]({'where':{'id':_0x5dfd5f[_0x4af3('0x44')]['id']}})[_0x4af3('0x24')](handleEntityNotFound(_0x359cbf,null))[_0x4af3('0x24')](saveUpdates(_0x5dfd5f[_0x4af3('0x4a')],null))[_0x4af3('0x24')](respondWithResult(_0x359cbf,null))[_0x4af3('0x42')](handleError(_0x359cbf,null));};exports['destroy']=function(_0x3d3a6b,_0x43dd3e){return db[_0x4af3('0x2f')][_0x4af3('0x48')]({'where':{'id':_0x3d3a6b[_0x4af3('0x44')]['id']}})[_0x4af3('0x24')](handleEntityNotFound(_0x43dd3e,null))['then'](removeEntity(_0x43dd3e,null))[_0x4af3('0x42')](handleError(_0x43dd3e,null));};exports[_0x4af3('0x4f')]=function(_0x5ea305,_0x2f3ced,_0x3d29f6){var _0x58b280;return db['SquareOdbc'][_0x4af3('0x48')]({'where':{'id':_0x5ea305[_0x4af3('0x44')]['id']},'attributes':['id',_0x4af3('0x50')]})[_0x4af3('0x24')](handleEntityNotFound(_0x2f3ced,null))['then'](function(_0x18780e){if(_0x18780e){var _0x5c1fa8=require(_0x4af3('0x51'))();_0x5c1fa8[_0x4af3('0x52')](_0x18780e[_0x4af3('0x50')]);_0x5c1fa8[_0x4af3('0x53')]();return _0x18780e;}})['then'](respondWithResult(_0x2f3ced,null))[_0x4af3('0x42')](handleError(_0x2f3ced,null));}; \ No newline at end of file +var _0xc1c2=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','options','includeAll','SquareOdbc','findAll','rows','catch','show','params','create','body','get','role','user','ODBC','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xc1c2,0x1bd));var _0x2c1c=function(_0x40cd79,_0x2f6e96){_0x40cd79=_0x40cd79-0x0;var _0x1a5e87=_0xc1c2[_0x40cd79];return _0x1a5e87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c1c('0x0'));var zipdir=require(_0x2c1c('0x1'));var jsonpatch=require(_0x2c1c('0x2'));var rp=require(_0x2c1c('0x3'));var moment=require('moment');var BPromise=require(_0x2c1c('0x4'));var Mustache=require(_0x2c1c('0x5'));var util=require(_0x2c1c('0x6'));var path=require(_0x2c1c('0x7'));var sox=require(_0x2c1c('0x8'));var csv=require(_0x2c1c('0x9'));var ejs=require(_0x2c1c('0xa'));var fs=require('fs');var fs_extra=require(_0x2c1c('0xb'));var _=require(_0x2c1c('0xc'));var squel=require(_0x2c1c('0xd'));var crypto=require(_0x2c1c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2c1c('0xf'));var Papa=require(_0x2c1c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2c1c('0x11'));var as=require(_0x2c1c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c1c('0x13'))(_0x2c1c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c1c('0x15'));var db=require(_0x2c1c('0x16'))['db'];function respondWithStatusCode(_0x44405b,_0x3a424c){_0x3a424c=_0x3a424c||0xcc;return function(_0x4bf207){if(_0x4bf207){return _0x44405b[_0x2c1c('0x17')](_0x3a424c);}return _0x44405b['status'](_0x3a424c)['end']();};}function respondWithResult(_0x41b4c8,_0x2216da){_0x2216da=_0x2216da||0xc8;return function(_0x151910){if(_0x151910){return _0x41b4c8['status'](_0x2216da)[_0x2c1c('0x18')](_0x151910);}};}function respondWithFilteredResult(_0x42910c,_0x555d19){return function(_0x51d855){if(_0x51d855){var _0x5b2512=typeof _0x555d19[_0x2c1c('0x19')]===_0x2c1c('0x1a')&&typeof _0x555d19[_0x2c1c('0x1b')]==='undefined';var _0x38dc4d=_0x51d855['count'];var _0x2fac55=_0x5b2512?0x0:_0x555d19[_0x2c1c('0x19')];var _0x133336=_0x5b2512?_0x51d855[_0x2c1c('0x1c')]:_0x555d19[_0x2c1c('0x19')]+_0x555d19[_0x2c1c('0x1b')];var _0x47e03a;if(_0x133336>=_0x38dc4d){_0x133336=_0x38dc4d;_0x47e03a=0xc8;}else{_0x47e03a=0xce;}_0x42910c[_0x2c1c('0x1d')](_0x47e03a);return _0x42910c[_0x2c1c('0x1e')](_0x2c1c('0x1f'),_0x2fac55+'-'+_0x133336+'/'+_0x38dc4d)['json'](_0x51d855);}return null;};}function patchUpdates(_0x3391f4){return function(_0x7815b){try{jsonpatch[_0x2c1c('0x20')](_0x7815b,_0x3391f4,!![]);}catch(_0x1331f0){return BPromise[_0x2c1c('0x21')](_0x1331f0);}return _0x7815b[_0x2c1c('0x22')]();};}function saveUpdates(_0x15e35c,_0x6810bd){return function(_0x24954d){if(_0x24954d){return _0x24954d[_0x2c1c('0x23')](_0x15e35c)[_0x2c1c('0x24')](function(_0x2071d8){return _0x2071d8;});}return null;};}function removeEntity(_0x3e6e30,_0x9392a6){return function(_0x5758e5){if(_0x5758e5){return _0x5758e5['destroy']()['then'](function(){var _0xef5451=_0x5758e5['get']({'plain':!![]});var _0x3002c8='ODBC';return db[_0x2c1c('0x25')][_0x2c1c('0x26')]({'where':{'type':_0x3002c8,'resourceId':_0xef5451['id']}})[_0x2c1c('0x24')](function(){return _0x5758e5;});})['then'](function(){_0x3e6e30[_0x2c1c('0x1d')](0xcc)[_0x2c1c('0x27')]();});}};}function handleEntityNotFound(_0x3849f8,_0x49ed6f){return function(_0x5fac03){if(!_0x5fac03){_0x3849f8[_0x2c1c('0x17')](0x194);}return _0x5fac03;};}function handleError(_0x5b24dc,_0x5f23e5){_0x5f23e5=_0x5f23e5||0x1f4;return function(_0x9e5a8e){logger[_0x2c1c('0x28')](_0x9e5a8e[_0x2c1c('0x29')]);if(_0x9e5a8e[_0x2c1c('0x2a')]){delete _0x9e5a8e[_0x2c1c('0x2a')];}_0x5b24dc['status'](_0x5f23e5)[_0x2c1c('0x2b')](_0x9e5a8e);};}exports[_0x2c1c('0x2c')]=function(_0x2dcdf8,_0xb25ced){var _0x4cfd92={},_0x1821e5={},_0x25b5d7={'count':0x0,'rows':[]};var _0x1d2c7d=_[_0x2c1c('0x2d')](db['SquareOdbc'][_0x2c1c('0x2e')],function(_0x320f67){return{'name':_0x320f67[_0x2c1c('0x2f')],'type':_0x320f67['type'][_0x2c1c('0x30')]};});_0x1821e5[_0x2c1c('0x31')]=_['map'](_0x1d2c7d,_0x2c1c('0x2a'));_0x1821e5['query']=_[_0x2c1c('0x32')](_0x2dcdf8[_0x2c1c('0x33')]);_0x1821e5[_0x2c1c('0x34')]=_['intersection'](_0x1821e5[_0x2c1c('0x31')],_0x1821e5[_0x2c1c('0x33')]);_0x4cfd92[_0x2c1c('0x35')]=_[_0x2c1c('0x36')](_0x1821e5[_0x2c1c('0x31')],qs['fields'](_0x2dcdf8[_0x2c1c('0x33')][_0x2c1c('0x37')]));_0x4cfd92[_0x2c1c('0x35')]=_0x4cfd92[_0x2c1c('0x35')][_0x2c1c('0x38')]?_0x4cfd92['attributes']:_0x1821e5[_0x2c1c('0x31')];if(!_0x2dcdf8['query'][_0x2c1c('0x39')](_0x2c1c('0x3a'))){_0x4cfd92['limit']=qs['limit'](_0x2dcdf8[_0x2c1c('0x33')][_0x2c1c('0x1b')]);_0x4cfd92[_0x2c1c('0x19')]=qs[_0x2c1c('0x19')](_0x2dcdf8[_0x2c1c('0x33')]['offset']);}_0x4cfd92[_0x2c1c('0x3b')]=qs[_0x2c1c('0x3c')](_0x2dcdf8[_0x2c1c('0x33')][_0x2c1c('0x3c')]);_0x4cfd92['where']=qs['filters'](_[_0x2c1c('0x3d')](_0x2dcdf8[_0x2c1c('0x33')],_0x1821e5[_0x2c1c('0x34')]),_0x1d2c7d);if(_0x2dcdf8[_0x2c1c('0x33')]['filter']){_0x4cfd92[_0x2c1c('0x3e')]=_['merge'](_0x4cfd92[_0x2c1c('0x3e')],{'$or':_['map'](_0x1d2c7d,function(_0x5cd4c4){if(_0x5cd4c4[_0x2c1c('0x3f')]!==_0x2c1c('0x40')){var _0x48fd96={};_0x48fd96[_0x5cd4c4['name']]={'$like':'%'+_0x2dcdf8['query']['filter']+'%'};return _0x48fd96;}})});}_0x4cfd92=_['merge']({},_0x4cfd92,_0x2dcdf8[_0x2c1c('0x41')]);var _0x5b84a6={'where':_0x4cfd92[_0x2c1c('0x3e')]};return db['SquareOdbc'][_0x2c1c('0x1c')](_0x5b84a6)[_0x2c1c('0x24')](function(_0x3c9331){_0x25b5d7['count']=_0x3c9331;if(_0x2dcdf8['query'][_0x2c1c('0x42')]){_0x4cfd92['include']=[{'all':!![]}];}return db[_0x2c1c('0x43')][_0x2c1c('0x44')](_0x4cfd92);})[_0x2c1c('0x24')](function(_0x802f7b){_0x25b5d7[_0x2c1c('0x45')]=_0x802f7b;return _0x25b5d7;})[_0x2c1c('0x24')](respondWithFilteredResult(_0xb25ced,_0x4cfd92))[_0x2c1c('0x46')](handleError(_0xb25ced,null));};exports[_0x2c1c('0x47')]=function(_0x5c621c,_0x1f0c21){var _0x12b3fd={'raw':!![],'where':{'id':_0x5c621c[_0x2c1c('0x48')]['id']}},_0x28e46e={};_0x28e46e[_0x2c1c('0x31')]=_[_0x2c1c('0x32')](db[_0x2c1c('0x43')]['rawAttributes']);_0x28e46e[_0x2c1c('0x33')]=_['keys'](_0x5c621c[_0x2c1c('0x33')]);_0x28e46e[_0x2c1c('0x34')]=_[_0x2c1c('0x36')](_0x28e46e[_0x2c1c('0x31')],_0x28e46e[_0x2c1c('0x33')]);_0x12b3fd['attributes']=_[_0x2c1c('0x36')](_0x28e46e[_0x2c1c('0x31')],qs['fields'](_0x5c621c[_0x2c1c('0x33')]['fields']));_0x12b3fd[_0x2c1c('0x35')]=_0x12b3fd['attributes'][_0x2c1c('0x38')]?_0x12b3fd[_0x2c1c('0x35')]:_0x28e46e[_0x2c1c('0x31')];if(_0x5c621c[_0x2c1c('0x33')][_0x2c1c('0x42')]){_0x12b3fd['include']=[{'all':!![]}];}_0x12b3fd=_['merge']({},_0x12b3fd,_0x5c621c['options']);return db['SquareOdbc']['find'](_0x12b3fd)[_0x2c1c('0x24')](handleEntityNotFound(_0x1f0c21,null))[_0x2c1c('0x24')](respondWithResult(_0x1f0c21,null))['catch'](handleError(_0x1f0c21,null));};exports['create']=function(_0x5340b0,_0x1c7f47){return db[_0x2c1c('0x43')][_0x2c1c('0x49')](_0x5340b0[_0x2c1c('0x4a')],{})[_0x2c1c('0x24')](function(_0xbf4450){var _0x45fd42=_0x5340b0['user'][_0x2c1c('0x4b')]({'plain':!![]});if(!_0x45fd42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45fd42[_0x2c1c('0x4c')]===_0x2c1c('0x4d')){var _0x13c0b5=_0xbf4450[_0x2c1c('0x4b')]({'plain':!![]});var _0x4721a5=_0x2c1c('0x4e');return db[_0x2c1c('0x4f')][_0x2c1c('0x50')]({'where':{'name':_0x4721a5,'userProfileId':_0x45fd42[_0x2c1c('0x51')]},'raw':!![]})[_0x2c1c('0x24')](function(_0x32e6d6){if(_0x32e6d6&&_0x32e6d6[_0x2c1c('0x52')]===0x0){return db[_0x2c1c('0x25')]['create']({'name':_0x13c0b5[_0x2c1c('0x2a')],'resourceId':_0x13c0b5['id'],'type':_0x32e6d6[_0x2c1c('0x2a')],'sectionId':_0x32e6d6['id']},{})[_0x2c1c('0x24')](function(){return _0xbf4450;});}else{return _0xbf4450;}})[_0x2c1c('0x46')](function(_0x44ed0b){logger[_0x2c1c('0x28')](_0x2c1c('0x53'),_0x44ed0b);throw _0x44ed0b;});}return _0xbf4450;})[_0x2c1c('0x24')](respondWithResult(_0x1c7f47,0xc9))['catch'](handleError(_0x1c7f47,null));};exports[_0x2c1c('0x23')]=function(_0x2584a6,_0xe53820){if(_0x2584a6[_0x2c1c('0x4a')]['id']){delete _0x2584a6[_0x2c1c('0x4a')]['id'];}return db[_0x2c1c('0x43')][_0x2c1c('0x50')]({'where':{'id':_0x2584a6[_0x2c1c('0x48')]['id']}})[_0x2c1c('0x24')](handleEntityNotFound(_0xe53820,null))[_0x2c1c('0x24')](saveUpdates(_0x2584a6[_0x2c1c('0x4a')],null))[_0x2c1c('0x24')](respondWithResult(_0xe53820,null))[_0x2c1c('0x46')](handleError(_0xe53820,null));};exports[_0x2c1c('0x26')]=function(_0x484b7b,_0x519c57){return db[_0x2c1c('0x43')][_0x2c1c('0x50')]({'where':{'id':_0x484b7b[_0x2c1c('0x48')]['id']}})[_0x2c1c('0x24')](handleEntityNotFound(_0x519c57,null))['then'](removeEntity(_0x519c57,null))[_0x2c1c('0x46')](handleError(_0x519c57,null));};exports[_0x2c1c('0x54')]=function(_0x57c898,_0x4f3b21,_0x5a1b78){var _0x4cf91e;return db[_0x2c1c('0x43')][_0x2c1c('0x50')]({'where':{'id':_0x57c898[_0x2c1c('0x48')]['id']},'attributes':['id','dsn']})[_0x2c1c('0x24')](handleEntityNotFound(_0x4f3b21,null))[_0x2c1c('0x24')](function(_0x357e81){if(_0x357e81){var _0x5eaffb=require(_0x2c1c('0x55'))();_0x5eaffb[_0x2c1c('0x56')](_0x357e81['dsn']);_0x5eaffb[_0x2c1c('0x57')]();return _0x357e81;}})['then'](respondWithResult(_0x4f3b21,null))[_0x2c1c('0x46')](handleError(_0x4f3b21,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index eff99ee..dae73a3 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 _0xc1b4=['./squareOdbc.attributes','square_odbc','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc1b4,0x10a));var _0x4c1b=function(_0x4aff5c,_0xfe07b9){_0x4aff5c=_0x4aff5c-0x0;var _0x281964=_0xc1b4[_0x4aff5c];return _0x281964;};'use strict';var _=require(_0x4c1b('0x0'));var util=require(_0x4c1b('0x1'));var logger=require('../../config/logger')(_0x4c1b('0x2'));var moment=require(_0x4c1b('0x3'));var BPromise=require(_0x4c1b('0x4'));var rp=require(_0x4c1b('0x5'));var fs=require('fs');var path=require(_0x4c1b('0x6'));var rimraf=require(_0x4c1b('0x7'));var config=require(_0x4c1b('0x8'));var attributes=require(_0x4c1b('0x9'));module['exports']=function(_0x31a6f1,_0x2389ea){return _0x31a6f1['define']('SquareOdbc',attributes,{'tableName':_0x4c1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4fb=['exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','request-promise','rimraf','./squareOdbc.attributes'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0xc4fb,0x1ce));var _0xbc4f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc4fb[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var logger=require(_0xbc4f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc4f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc4f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbc4f('0x5'));module[_0xbc4f('0x6')]=function(_0x4ba17e,_0x6ef591){return _0x4ba17e['define'](_0xbc4f('0x7'),attributes,{'tableName':_0xbc4f('0x8'),'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 c2ca526..fd9fe0d 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 _0x72d4=['request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','include','map','model','attributes','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x5c29b3,_0x47b390){var _0x71e471=function(_0x1f2e8b){while(--_0x1f2e8b){_0x5c29b3['push'](_0x5c29b3['shift']());}};_0x71e471(++_0x47b390);}(_0x72d4,0x76));var _0x472d=function(_0x3cd764,_0x21c54b){_0x3cd764=_0x3cd764-0x0;var _0x3bb668=_0x72d4[_0x3cd764];return _0x3bb668;};'use strict';var _=require(_0x472d('0x0'));var util=require(_0x472d('0x1'));var moment=require(_0x472d('0x2'));var BPromise=require('bluebird');var rs=require(_0x472d('0x3'));var fs=require('fs');var Redis=require(_0x472d('0x4'));var db=require(_0x472d('0x5'))['db'];var utils=require(_0x472d('0x6'));var logger=require(_0x472d('0x7'))(_0x472d('0x8'));var config=require('../../config/environment');var jayson=require(_0x472d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7ac942,_0x2cb0b1,_0x27a2c3){return new BPromise(function(_0x5ae6ed,_0x548f93){return client[_0x472d('0xa')](_0x7ac942,_0x27a2c3)[_0x472d('0xb')](function(_0x375803){logger[_0x472d('0xc')](_0x472d('0xd'),_0x2cb0b1,_0x472d('0xe'));logger[_0x472d('0xf')](_0x472d('0x10'),_0x2cb0b1,'request\x20sent',JSON[_0x472d('0x11')](_0x375803));if(_0x375803[_0x472d('0x12')]){if(_0x375803[_0x472d('0x12')][_0x472d('0x13')]===0x1f4){logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x375803['error'][_0x472d('0x14')]);return _0x548f93(_0x375803[_0x472d('0x12')][_0x472d('0x14')]);}logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x375803[_0x472d('0x12')][_0x472d('0x14')]);return _0x5ae6ed(_0x375803[_0x472d('0x12')][_0x472d('0x14')]);}else{logger[_0x472d('0xc')](_0x472d('0xd'),_0x2cb0b1,'request\x20sent');_0x5ae6ed(_0x375803[_0x472d('0x15')][_0x472d('0x14')]);}})['catch'](function(_0x157781){logger[_0x472d('0x12')](_0x472d('0xd'),_0x2cb0b1,_0x157781);_0x548f93(_0x157781);});});}exports[_0x472d('0x16')]=function(_0x3662b8){var _0x2fc4f6=this;return new Promise(function(_0x5d467e,_0x2a8c45){return db[_0x472d('0x17')][_0x472d('0x18')]({'raw':_0x3662b8[_0x472d('0x19')]?_0x3662b8[_0x472d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3662b8['options']?_0x3662b8[_0x472d('0x19')][_0x472d('0x1a')]||null:null,'attributes':_0x3662b8[_0x472d('0x19')]?_0x3662b8['options']['attributes']||null:null,'include':_0x3662b8[_0x472d('0x19')]?_0x3662b8[_0x472d('0x19')][_0x472d('0x1b')]?_[_0x472d('0x1c')](_0x3662b8[_0x472d('0x19')][_0x472d('0x1b')],function(_0x269270){return{'model':db[_0x269270[_0x472d('0x1d')]],'as':_0x269270['as'],'attributes':_0x269270[_0x472d('0x1e')],'include':_0x269270[_0x472d('0x1b')]?_[_0x472d('0x1c')](_0x269270[_0x472d('0x1b')],function(_0x181a1d){return{'model':db[_0x181a1d[_0x472d('0x1d')]],'as':_0x181a1d['as'],'attributes':_0x181a1d['attributes'],'include':_0x181a1d['include']?_[_0x472d('0x1c')](_0x181a1d[_0x472d('0x1b')],function(_0x14a5f3){return{'model':db[_0x14a5f3['model']],'as':_0x14a5f3['as'],'attributes':_0x14a5f3[_0x472d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x472d('0xb')](function(_0x25cce2){logger['info'](_0x472d('0x16'),_0x3662b8);logger[_0x472d('0xf')](_0x472d('0x16'),_0x3662b8,JSON[_0x472d('0x11')](_0x25cce2));_0x5d467e(_0x25cce2);})[_0x472d('0x1f')](function(_0x50cfb0){logger[_0x472d('0x12')](_0x472d('0x16'),_0x50cfb0['message'],_0x3662b8);_0x2a8c45(_0x2fc4f6[_0x472d('0x12')](0x1f4,_0x50cfb0[_0x472d('0x14')]));});});}; \ No newline at end of file +var _0x0678=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model'];(function(_0x302d8e,_0x284c8a){var _0xe0ce3b=function(_0x2d2537){while(--_0x2d2537){_0x302d8e['push'](_0x302d8e['shift']());}};_0xe0ce3b(++_0x284c8a);}(_0x0678,0xa6));var _0x8067=function(_0x4b8abf,_0x2ca0b7){_0x4b8abf=_0x4b8abf-0x0;var _0x5b5168=_0x0678[_0x4b8abf];return _0x5b5168;};'use strict';var _=require(_0x8067('0x0'));var util=require('util');var moment=require(_0x8067('0x1'));var BPromise=require(_0x8067('0x2'));var rs=require(_0x8067('0x3'));var fs=require('fs');var Redis=require(_0x8067('0x4'));var db=require(_0x8067('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8067('0x6'))('rpc');var config=require(_0x8067('0x7'));var jayson=require(_0x8067('0x8'));var client=jayson['client'][_0x8067('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10937e,_0x4a1b50,_0x4d1e89){return new BPromise(function(_0x3f4463,_0x2713a1){return client[_0x8067('0xa')](_0x10937e,_0x4d1e89)[_0x8067('0xb')](function(_0x4fa49a){logger[_0x8067('0xc')](_0x8067('0xd'),_0x4a1b50,_0x8067('0xe'));logger[_0x8067('0xf')](_0x8067('0x10'),_0x4a1b50,'request\x20sent',JSON[_0x8067('0x11')](_0x4fa49a));if(_0x4fa49a[_0x8067('0x12')]){if(_0x4fa49a[_0x8067('0x12')][_0x8067('0x13')]===0x1f4){logger[_0x8067('0x12')](_0x8067('0xd'),_0x4a1b50,_0x4fa49a[_0x8067('0x12')][_0x8067('0x14')]);return _0x2713a1(_0x4fa49a[_0x8067('0x12')][_0x8067('0x14')]);}logger[_0x8067('0x12')](_0x8067('0xd'),_0x4a1b50,_0x4fa49a[_0x8067('0x12')][_0x8067('0x14')]);return _0x3f4463(_0x4fa49a[_0x8067('0x12')][_0x8067('0x14')]);}else{logger[_0x8067('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x4a1b50,_0x8067('0xe'));_0x3f4463(_0x4fa49a[_0x8067('0x15')][_0x8067('0x14')]);}})['catch'](function(_0x2984c7){logger[_0x8067('0x12')](_0x8067('0xd'),_0x4a1b50,_0x2984c7);_0x2713a1(_0x2984c7);});});}exports[_0x8067('0x16')]=function(_0x4c738f){var _0x30d2a3=this;return new Promise(function(_0x217bc1,_0x4d8ce8){return db[_0x8067('0x17')][_0x8067('0x18')]({'raw':_0x4c738f['options']?_0x4c738f[_0x8067('0x19')][_0x8067('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c738f[_0x8067('0x19')]?_0x4c738f['options'][_0x8067('0x1b')]||null:null,'attributes':_0x4c738f[_0x8067('0x19')]?_0x4c738f[_0x8067('0x19')][_0x8067('0x1c')]||null:null,'include':_0x4c738f[_0x8067('0x19')]?_0x4c738f[_0x8067('0x19')][_0x8067('0x1d')]?_[_0x8067('0x1e')](_0x4c738f[_0x8067('0x19')][_0x8067('0x1d')],function(_0x35b048){return{'model':db[_0x35b048[_0x8067('0x1f')]],'as':_0x35b048['as'],'attributes':_0x35b048[_0x8067('0x1c')],'include':_0x35b048['include']?_[_0x8067('0x1e')](_0x35b048[_0x8067('0x1d')],function(_0x19a7dd){return{'model':db[_0x19a7dd[_0x8067('0x1f')]],'as':_0x19a7dd['as'],'attributes':_0x19a7dd[_0x8067('0x1c')],'include':_0x19a7dd['include']?_[_0x8067('0x1e')](_0x19a7dd[_0x8067('0x1d')],function(_0x1b03d0){return{'model':db[_0x1b03d0[_0x8067('0x1f')]],'as':_0x1b03d0['as'],'attributes':_0x1b03d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8067('0xb')](function(_0x3c4195){logger['info'](_0x8067('0x16'),_0x4c738f);logger[_0x8067('0xf')]('ShowSquareOdbc',_0x4c738f,JSON['stringify'](_0x3c4195));_0x217bc1(_0x3c4195);})[_0x8067('0x20')](function(_0x5d81f2){logger[_0x8067('0x12')](_0x8067('0x16'),_0x5d81f2[_0x8067('0x14')],_0x4c738f);_0x4d8ce8(_0x30d2a3['error'](0x1f4,_0x5d81f2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 65e9a07..f7243a0 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 _0xe896=['get','/:id/users','create','put','/:id','update','delete','removeUsers','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe896,0x15f));var _0x6e89=function(_0x25a04e,_0x435456){_0x25a04e=_0x25a04e-0x0;var _0x195480=_0xe896[_0x25a04e];return _0x195480;};'use strict';var multer=require(_0x6e89('0x0'));var util=require(_0x6e89('0x1'));var path=require(_0x6e89('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e89('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e89('0x4'));var interaction=require(_0x6e89('0x5'));var config=require(_0x6e89('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x6e89('0x7')](),controller['index']);router['get']('/:id',auth[_0x6e89('0x7')](),controller[_0x6e89('0x8')]);router[_0x6e89('0x9')](_0x6e89('0xa'),auth[_0x6e89('0x7')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x6e89('0xb')]);router['post']('/:id/users',auth[_0x6e89('0x7')](),controller['addUsers']);router[_0x6e89('0xc')](_0x6e89('0xd'),auth[_0x6e89('0x7')](),controller[_0x6e89('0xe')]);router[_0x6e89('0xf')](_0x6e89('0xd'),auth[_0x6e89('0x7')](),controller['destroy']);router[_0x6e89('0xf')](_0x6e89('0xa'),auth[_0x6e89('0x7')](),controller[_0x6e89('0x10')]);module[_0x6e89('0x11')]=router; \ No newline at end of file +var _0xfd49=['put','/:id','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./squareProject.controller','isAuthenticated','index','get','show','/:id/users','getUsers','post','addUsers'];(function(_0x15e51c,_0x1eff92){var _0x16e2a4=function(_0x5b1d57){while(--_0x5b1d57){_0x15e51c['push'](_0x15e51c['shift']());}};_0x16e2a4(++_0x1eff92);}(_0xfd49,0x91));var _0x9fd4=function(_0x4d372a,_0x3cd10c){_0x4d372a=_0x4d372a-0x0;var _0x4c649c=_0xfd49[_0x4d372a];return _0x4c649c;};'use strict';var multer=require(_0x9fd4('0x0'));var util=require(_0x9fd4('0x1'));var path=require(_0x9fd4('0x2'));var timeout=require(_0x9fd4('0x3'));var express=require(_0x9fd4('0x4'));var router=express[_0x9fd4('0x5')]();var fs_extra=require(_0x9fd4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9fd4('0x7'));router['get']('/',auth[_0x9fd4('0x8')](),controller[_0x9fd4('0x9')]);router[_0x9fd4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9fd4('0xb')]);router[_0x9fd4('0xa')](_0x9fd4('0xc'),auth[_0x9fd4('0x8')](),controller[_0x9fd4('0xd')]);router['post']('/',auth[_0x9fd4('0x8')](),controller['create']);router[_0x9fd4('0xe')](_0x9fd4('0xc'),auth[_0x9fd4('0x8')](),controller[_0x9fd4('0xf')]);router[_0x9fd4('0x10')](_0x9fd4('0x11'),auth['isAuthenticated'](),controller[_0x9fd4('0x12')]);router[_0x9fd4('0x13')](_0x9fd4('0x11'),auth[_0x9fd4('0x8')](),controller[_0x9fd4('0x14')]);router[_0x9fd4('0x13')]('/:id/users',auth[_0x9fd4('0x8')](),controller[_0x9fd4('0x15')]);module[_0x9fd4('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f24be83..cf6d768 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 _0xff22=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','sequelize','exports','STRING'];(function(_0x1cb84c,_0x576b00){var _0x1ff4ed=function(_0x27e6b4){while(--_0x27e6b4){_0x1cb84c['push'](_0x1cb84c['shift']());}};_0x1ff4ed(++_0x576b00);}(_0xff22,0x135));var _0x2ff2=function(_0x1860f6,_0x4ac372){_0x1860f6=_0x1860f6-0x0;var _0x47ce74=_0xff22[_0x1860f6];return _0x47ce74;};'use strict';var Sequelize=require(_0x2ff2('0x0'));module[_0x2ff2('0x1')]={'name':{'type':Sequelize[_0x2ff2('0x2')],'unique':_0x2ff2('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2ff2('0x2')]},'notes':{'type':Sequelize[_0x2ff2('0x4')]},'preproduction':{'type':Sequelize[_0x2ff2('0x5')](_0x2ff2('0x6')),'get':function(){if(this[_0x2ff2('0x7')](_0x2ff2('0x8'))){return this[_0x2ff2('0x7')](_0x2ff2('0x8'))[_0x2ff2('0x9')](_0x2ff2('0xa'));}}},'production':{'type':Sequelize[_0x2ff2('0x5')](_0x2ff2('0x6')),'get':function(){if(this[_0x2ff2('0x7')](_0x2ff2('0xb'))){return this[_0x2ff2('0x7')](_0x2ff2('0xb'))[_0x2ff2('0x9')](_0x2ff2('0xa'));}}},'savedAt':{'type':Sequelize[_0x2ff2('0xc')]},'publishedAt':{'type':Sequelize[_0x2ff2('0xc')]}}; \ No newline at end of file +var _0x48f5=['BLOB','long','getDataValue','preproduction','production','toString','utf8','DATE','sequelize','exports','STRING','name'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x48f5,0x68));var _0x548f=function(_0x506f1c,_0x459028){_0x506f1c=_0x506f1c-0x0;var _0x4ed523=_0x48f5[_0x506f1c];return _0x4ed523;};'use strict';var Sequelize=require(_0x548f('0x0'));module[_0x548f('0x1')]={'name':{'type':Sequelize[_0x548f('0x2')],'unique':_0x548f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x548f('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x548f('0x4')](_0x548f('0x5')),'get':function(){if(this[_0x548f('0x6')]('preproduction')){return this[_0x548f('0x6')](_0x548f('0x7'))['toString']('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0x548f('0x8'))){return this['getDataValue']('production')[_0x548f('0x9')](_0x548f('0xa'));}}},'savedAt':{'type':Sequelize[_0x548f('0xb')]},'publishedAt':{'type':Sequelize[_0x548f('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 64e4c74..380a89e 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 _0x7096=['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','production','addUsers','omit','removeUsers','isArray','ids','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','then','publish','agi','stringify','sendStatus','error','stack','name','send','index','map','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','SquareProject','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x197af7,_0x346019){var _0x3b1979=function(_0x1ab1c3){while(--_0x1ab1c3){_0x197af7['push'](_0x197af7['shift']());}};_0x3b1979(++_0x346019);}(_0x7096,0x10c));var _0x6709=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7096[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var Redis=require(_0x6709('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x6709('0x1'))('api');var config=require(_0x6709('0x2'));var db=require(_0x6709('0x3'))['db'];config[_0x6709('0x4')]=_[_0x6709('0x5')](config[_0x6709('0x4')],{'host':_0x6709('0x6'),'port':0x18eb});var socket=require(_0x6709('0x7'))(new Redis(config[_0x6709('0x4')]));require(_0x6709('0x8'))[_0x6709('0x9')](socket);function respondWithStatusCode(_0x11ad23,_0x985814){_0x985814=_0x985814||0xcc;return function(_0x30147f){if(_0x30147f){return _0x11ad23['sendStatus'](_0x985814);}return _0x11ad23['status'](_0x985814)[_0x6709('0xa')]();};}function respondWithResult(_0x2d8c0b,_0xbcb47){_0xbcb47=_0xbcb47||0xc8;return function(_0x1aa476){if(_0x1aa476){return _0x2d8c0b[_0x6709('0xb')](_0xbcb47)[_0x6709('0xc')](_0x1aa476);}};}function respondWithFilteredResult(_0x5de1fa,_0x5b9f26){return function(_0x329aa9){if(_0x329aa9){var _0x262261=typeof _0x5b9f26[_0x6709('0xd')]===_0x6709('0xe')&&typeof _0x5b9f26[_0x6709('0xf')]===_0x6709('0xe');var _0x1d56a5=_0x329aa9[_0x6709('0x10')];var _0x5a8ebb=_0x262261?0x0:_0x5b9f26[_0x6709('0xd')];var _0xf59b6e=_0x262261?_0x329aa9[_0x6709('0x10')]:_0x5b9f26[_0x6709('0xd')]+_0x5b9f26['limit'];var _0xc728aa;if(_0xf59b6e>=_0x1d56a5){_0xf59b6e=_0x1d56a5;_0xc728aa=0xc8;}else{_0xc728aa=0xce;}_0x5de1fa['status'](_0xc728aa);return _0x5de1fa[_0x6709('0x11')]('Content-Range',_0x5a8ebb+'-'+_0xf59b6e+'/'+_0x1d56a5)[_0x6709('0xc')](_0x329aa9);}return null;};}function saveUpdates(_0x28866a){return function(_0x95c0c2){if(_0x95c0c2){return _0x95c0c2[_0x6709('0x12')](_0x28866a)['then'](function(_0x52e342){return _0x52e342;});}return null;};}function removeEntity(_0x5c4f94){return function(_0x3fa5b1){if(_0x3fa5b1){return _0x3fa5b1[_0x6709('0x13')]()['then'](function(){var _0x9c1fd8=_0x3fa5b1[_0x6709('0x14')]({'plain':!![]});var _0xf1a70d='SquareProjects';return db[_0x6709('0x15')][_0x6709('0x13')]({'where':{'type':_0xf1a70d,'resourceId':_0x9c1fd8['id']}})[_0x6709('0x16')](function(){return _0x3fa5b1;});})[_0x6709('0x16')](function(){var _0x5485d7=new Redis(config[_0x6709('0x4')]);_0x5485d7[_0x6709('0x17')](_0x6709('0x18'),JSON[_0x6709('0x19')]({'id':_0x3fa5b1['id'],'deleted':!![]}));})[_0x6709('0x16')](function(){_0x5c4f94[_0x6709('0xb')](0xcc)[_0x6709('0xa')]();});}};}function handleEntityNotFound(_0x17763d){return function(_0x386224){if(!_0x386224){_0x17763d[_0x6709('0x1a')](0x194);}return _0x386224;};}function handleError(_0x2f3415,_0xa36371){_0xa36371=_0xa36371||0x1f4;return function(_0x5cf48b){logger[_0x6709('0x1b')](_0x5cf48b[_0x6709('0x1c')]);if(_0x5cf48b[_0x6709('0x1d')]){delete _0x5cf48b['name'];}_0x2f3415[_0x6709('0xb')](_0xa36371)[_0x6709('0x1e')](_0x5cf48b);};}exports[_0x6709('0x1f')]=function(_0x44b465,_0x588e00){var _0x241428={},_0x3076fe={},_0x50f7d6={'count':0x0,'rows':[]};var _0x585073=_[_0x6709('0x20')](db['SquareProject'][_0x6709('0x21')],function(_0x2499a2){return{'name':_0x2499a2['fieldName'],'type':_0x2499a2[_0x6709('0x22')]['key']};});_0x3076fe[_0x6709('0x23')]=_[_0x6709('0x20')](_0x585073,'name');_0x3076fe[_0x6709('0x24')]=_['keys'](_0x44b465[_0x6709('0x24')]);_0x3076fe[_0x6709('0x25')]=_['intersection'](_0x3076fe[_0x6709('0x23')],_0x3076fe['query']);_0x241428[_0x6709('0x26')]=_[_0x6709('0x27')](_0x3076fe['model'],qs['fields'](_0x44b465[_0x6709('0x24')][_0x6709('0x28')]));_0x241428[_0x6709('0x26')]=_0x241428[_0x6709('0x26')][_0x6709('0x29')]?_0x241428[_0x6709('0x26')]:_0x3076fe[_0x6709('0x23')];if(!_0x44b465[_0x6709('0x24')][_0x6709('0x2a')]('nolimit')){_0x241428[_0x6709('0xf')]=qs[_0x6709('0xf')](_0x44b465[_0x6709('0x24')][_0x6709('0xf')]);_0x241428['offset']=qs[_0x6709('0xd')](_0x44b465[_0x6709('0x24')][_0x6709('0xd')]);}_0x241428[_0x6709('0x2b')]=qs['sort'](_0x44b465[_0x6709('0x24')][_0x6709('0x2c')]);_0x241428['where']=qs[_0x6709('0x25')](_[_0x6709('0x2d')](_0x44b465['query'],_0x3076fe[_0x6709('0x25')]),_0x585073);if(_0x44b465[_0x6709('0x24')][_0x6709('0x2e')]){_0x241428[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x241428[_0x6709('0x2f')],{'$or':_[_0x6709('0x20')](_0x585073,function(_0x4bfed4){if(_0x4bfed4[_0x6709('0x22')]!==_0x6709('0x31')){var _0x4fad54={};_0x4fad54[_0x4bfed4[_0x6709('0x1d')]]={'$like':'%'+_0x44b465[_0x6709('0x24')][_0x6709('0x2e')]+'%'};return _0x4fad54;}})});}_0x241428=_[_0x6709('0x30')]({},_0x241428,_0x44b465[_0x6709('0x32')]);var _0x1c12bb={'where':_0x241428['where']};return db[_0x6709('0x33')]['count'](_0x1c12bb)[_0x6709('0x16')](function(_0xbb7a64){_0x50f7d6[_0x6709('0x10')]=_0xbb7a64;if(_0x44b465['query'][_0x6709('0x34')]){_0x241428[_0x6709('0x35')]=[{'all':!![]}];}return db[_0x6709('0x33')][_0x6709('0x36')](_0x241428);})[_0x6709('0x16')](function(_0x1030ee){_0x50f7d6[_0x6709('0x37')]=_0x1030ee;return _0x50f7d6;})['then'](respondWithFilteredResult(_0x588e00,_0x241428))[_0x6709('0x38')](handleError(_0x588e00,null));};exports[_0x6709('0x39')]=function(_0x50fbcd,_0x31d2a6){var _0xe80008={'raw':![],'where':{'id':_0x50fbcd[_0x6709('0x3a')]['id']}},_0x15b18f={};_0x15b18f['model']=_['keys'](db[_0x6709('0x33')][_0x6709('0x21')]);_0x15b18f[_0x6709('0x24')]=_[_0x6709('0x3b')](_0x50fbcd['query']);_0x15b18f['filters']=_['intersection'](_0x15b18f[_0x6709('0x23')],_0x15b18f[_0x6709('0x24')]);_0xe80008['attributes']=_[_0x6709('0x27')](_0x15b18f[_0x6709('0x23')],qs['fields'](_0x50fbcd['query'][_0x6709('0x28')]));_0xe80008[_0x6709('0x26')]=_0xe80008[_0x6709('0x26')][_0x6709('0x29')]?_0xe80008[_0x6709('0x26')]:_0x15b18f['model'];if(_0x50fbcd[_0x6709('0x24')]['includeAll']){_0xe80008[_0x6709('0x35')]=[{'all':!![]}];}_0xe80008=_[_0x6709('0x30')]({},_0xe80008,_0x50fbcd[_0x6709('0x32')]);return db['SquareProject'][_0x6709('0x3c')](_0xe80008)['then'](handleEntityNotFound(_0x31d2a6,null))['then'](respondWithResult(_0x31d2a6,null))[_0x6709('0x38')](handleError(_0x31d2a6,null));};exports[_0x6709('0x3d')]=function(_0x14fcb6,_0x7e38b9){return db[_0x6709('0x33')][_0x6709('0x3d')](_0x14fcb6[_0x6709('0x3e')],{})[_0x6709('0x16')](function(_0x123793){var _0xe999aa=_0x14fcb6[_0x6709('0x3f')][_0x6709('0x14')]({'plain':!![]});if(!_0xe999aa)throw new Error(_0x6709('0x40'));if(_0xe999aa[_0x6709('0x41')]===_0x6709('0x3f')){var _0x4f82a0=_0x123793[_0x6709('0x14')]({'plain':!![]});var _0x4d841a='SquareProjects';return db[_0x6709('0x42')][_0x6709('0x3c')]({'where':{'name':_0x4d841a,'userProfileId':_0xe999aa[_0x6709('0x43')]},'raw':!![]})[_0x6709('0x16')](function(_0x22363b){if(_0x22363b&&_0x22363b[_0x6709('0x44')]===0x0){return db[_0x6709('0x15')][_0x6709('0x3d')]({'name':_0x4f82a0['name'],'resourceId':_0x4f82a0['id'],'type':_0x22363b[_0x6709('0x1d')],'sectionId':_0x22363b['id']},{})[_0x6709('0x16')](function(){return _0x123793;});}else{return _0x123793;}})[_0x6709('0x38')](function(_0x214fbb){logger['error'](_0x6709('0x45'),_0x214fbb);throw _0x214fbb;});}return _0x123793;})['then'](respondWithResult(_0x7e38b9,0xc9))[_0x6709('0x38')](handleError(_0x7e38b9,null));};exports[_0x6709('0x12')]=function(_0x2a563b,_0xb257b5){if(_0x2a563b[_0x6709('0x3e')]['id']){delete _0x2a563b['body']['id'];}return db[_0x6709('0x33')][_0x6709('0x3c')]({'where':{'id':_0x2a563b[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0xb257b5,null))[_0x6709('0x16')](saveUpdates(_0x2a563b['body'],null))['then'](function(_0x447aa5){if(!_0x447aa5)return;var _0x4b5eca=_0x447aa5['get']({'plain':!![]});return _0x4b5eca;})[_0x6709('0x16')](function(_0x437910){var _0x1bf824=new Redis(config[_0x6709('0x4')]);_0x1bf824[_0x6709('0x17')](_0x6709('0x18'),JSON[_0x6709('0x19')](_[_0x6709('0x2d')](_0x437910,['id',_0x6709('0x1d'),_0x6709('0x46')])));return _0x437910;})[_0x6709('0x16')](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x13')]=function(_0x8c2616,_0x5ea29f){return db['SquareProject'][_0x6709('0x3c')]({'where':{'id':_0x8c2616[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x5ea29f,null))[_0x6709('0x16')](removeEntity(_0x5ea29f,null))['catch'](handleError(_0x5ea29f,null));};exports[_0x6709('0x47')]=function(_0x492bca,_0x1f838d){return db[_0x6709('0x33')][_0x6709('0x3c')]({'where':{'id':_0x492bca[_0x6709('0x3a')]['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x1f838d,null))['then'](function(_0x49d3c6){if(_0x49d3c6){return _0x49d3c6[_0x6709('0x47')](_0x492bca[_0x6709('0x3e')]['ids'],_[_0x6709('0x48')](_0x492bca[_0x6709('0x3e')],['ids','id'])||{});}})[_0x6709('0x16')](respondWithResult(_0x1f838d,null))[_0x6709('0x38')](handleError(_0x1f838d,null));};exports[_0x6709('0x49')]=function(_0x24c451,_0x4f596e){return db['SquareProject'][_0x6709('0x3c')]({'where':{'id':_0x24c451['params']['id']}})[_0x6709('0x16')](handleEntityNotFound(_0x4f596e,null))[_0x6709('0x16')](function(_0x3c3df7){if(_0x3c3df7){return _0x3c3df7['removeUsers'](_0x24c451[_0x6709('0x24')]['ids'])['then'](function(){if(_[_0x6709('0x4a')](_0x24c451['query'][_0x6709('0x4b')])){for(var _0x5cf7c0=0x0;_0x5cf7c0<_0x24c451[_0x6709('0x24')][_0x6709('0x4b')][_0x6709('0x29')];_0x5cf7c0+=0x1){socket[_0x6709('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x24c451[_0x6709('0x24')][_0x6709('0x4b')][_0x5cf7c0]),'SquareProjectId':Number(_0x24c451[_0x6709('0x3a')]['id'])});}}else{socket[_0x6709('0x4c')](_0x6709('0x4d'),{'UserId':Number(_0x24c451[_0x6709('0x24')][_0x6709('0x4b')]),'SquareProjectId':Number(_0x24c451['params']['id'])});}});}})[_0x6709('0x16')](respondWithStatusCode(_0x4f596e,null))[_0x6709('0x38')](handleError(_0x4f596e,null));};exports[_0x6709('0x4e')]=function(_0x145508,_0x3f4dae){var _0x304268={};var _0xea95f6={};var _0x250bcd;var _0x36b514;return db['SquareProject'][_0x6709('0x4f')]({'where':{'id':_0x145508[_0x6709('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3f4dae,null))[_0x6709('0x16')](function(_0x18b4fa){if(_0x18b4fa){_0x250bcd=_0x18b4fa;_0xea95f6[_0x6709('0x23')]=_[_0x6709('0x3b')](db[_0x6709('0x50')][_0x6709('0x21')]);_0xea95f6[_0x6709('0x24')]=_[_0x6709('0x3b')](_0x145508[_0x6709('0x24')]);_0xea95f6['filters']=_[_0x6709('0x27')](_0xea95f6[_0x6709('0x23')],_0xea95f6[_0x6709('0x24')]);_0x304268[_0x6709('0x26')]=_[_0x6709('0x27')](_0xea95f6[_0x6709('0x23')],qs[_0x6709('0x28')](_0x145508[_0x6709('0x24')][_0x6709('0x28')]));_0x304268[_0x6709('0x26')]=_0x304268[_0x6709('0x26')]['length']?_0x304268[_0x6709('0x26')]:_0xea95f6['model'];_0x304268['order']=qs[_0x6709('0x2c')](_0x145508[_0x6709('0x24')][_0x6709('0x2c')]);_0x304268[_0x6709('0x2f')]=qs[_0x6709('0x25')](_[_0x6709('0x2d')](_0x145508[_0x6709('0x24')],_0xea95f6['filters']));if(_0x145508['query'][_0x6709('0x2e')]){_0x304268['where']=_[_0x6709('0x30')](_0x304268['where'],{'$or':_[_0x6709('0x20')](_0x304268[_0x6709('0x26')],function(_0x59d3d1){var _0x5c4277={};_0x5c4277[_0x59d3d1]={'$like':'%'+_0x145508['query'][_0x6709('0x2e')]+'%'};return _0x5c4277;})});}_0x304268=_[_0x6709('0x30')]({},_0x304268,_0x145508[_0x6709('0x32')]);return _0x250bcd[_0x6709('0x4e')](_0x304268);}})[_0x6709('0x16')](function(_0x193d67){if(_0x193d67){_0x36b514=_0x193d67[_0x6709('0x29')];if(!_0x145508[_0x6709('0x24')][_0x6709('0x2a')](_0x6709('0x51'))){_0x304268[_0x6709('0xf')]=qs[_0x6709('0xf')](_0x145508[_0x6709('0x24')]['limit']);_0x304268[_0x6709('0xd')]=qs[_0x6709('0xd')](_0x145508[_0x6709('0x24')][_0x6709('0xd')]);}return _0x250bcd['getUsers'](_0x304268);}})['then'](function(_0x18fe97){if(_0x18fe97){return _0x18fe97?{'count':_0x36b514,'rows':_0x18fe97}:null;}})['then'](respondWithResult(_0x3f4dae,null))['catch'](handleError(_0x3f4dae,null));}; \ No newline at end of file +var _0xd943=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','pick','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','UserProfileResource','publish','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys'];(function(_0x69618f,_0x2bd428){var _0x49df9a=function(_0x48a2b2){while(--_0x48a2b2){_0x69618f['push'](_0x69618f['shift']());}};_0x49df9a(++_0x2bd428);}(_0xd943,0x15d));var _0x3d94=function(_0x38d2dc,_0x5cf7b6){_0x38d2dc=_0x38d2dc-0x0;var _0x2726ec=_0xd943[_0x38d2dc];return _0x2726ec;};'use strict';var _=require(_0x3d94('0x0'));var Redis=require(_0x3d94('0x1'));var qs=require(_0x3d94('0x2'));var logger=require(_0x3d94('0x3'))('api');var config=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];config[_0x3d94('0x6')]=_[_0x3d94('0x7')](config[_0x3d94('0x6')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d94('0x6')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x4d29e7,_0x20f4d1){_0x20f4d1=_0x20f4d1||0xcc;return function(_0x35d36a){if(_0x35d36a){return _0x4d29e7['sendStatus'](_0x20f4d1);}return _0x4d29e7['status'](_0x20f4d1)[_0x3d94('0x8')]();};}function respondWithResult(_0x27e381,_0x1cc58c){_0x1cc58c=_0x1cc58c||0xc8;return function(_0x5908a7){if(_0x5908a7){return _0x27e381[_0x3d94('0x9')](_0x1cc58c)['json'](_0x5908a7);}};}function respondWithFilteredResult(_0x39e2fa,_0x301536){return function(_0x5f5041){if(_0x5f5041){var _0x1897de=typeof _0x301536[_0x3d94('0xa')]===_0x3d94('0xb')&&typeof _0x301536[_0x3d94('0xc')]===_0x3d94('0xb');var _0x548b89=_0x5f5041[_0x3d94('0xd')];var _0x2e9af0=_0x1897de?0x0:_0x301536[_0x3d94('0xa')];var _0x4c167c=_0x1897de?_0x5f5041[_0x3d94('0xd')]:_0x301536[_0x3d94('0xa')]+_0x301536[_0x3d94('0xc')];var _0x5d9366;if(_0x4c167c>=_0x548b89){_0x4c167c=_0x548b89;_0x5d9366=0xc8;}else{_0x5d9366=0xce;}_0x39e2fa[_0x3d94('0x9')](_0x5d9366);return _0x39e2fa[_0x3d94('0xe')](_0x3d94('0xf'),_0x2e9af0+'-'+_0x4c167c+'/'+_0x548b89)[_0x3d94('0x10')](_0x5f5041);}return null;};}function saveUpdates(_0xaf939a){return function(_0xd8efaa){if(_0xd8efaa){return _0xd8efaa[_0x3d94('0x11')](_0xaf939a)[_0x3d94('0x12')](function(_0x540658){return _0x540658;});}return null;};}function removeEntity(_0x22676a){return function(_0x1a9315){if(_0x1a9315){return _0x1a9315[_0x3d94('0x13')]()[_0x3d94('0x12')](function(){var _0x4afc92=_0x1a9315[_0x3d94('0x14')]({'plain':!![]});var _0xef8b3='SquareProjects';return db[_0x3d94('0x15')]['destroy']({'where':{'type':_0xef8b3,'resourceId':_0x4afc92['id']}})[_0x3d94('0x12')](function(){return _0x1a9315;});})[_0x3d94('0x12')](function(){var _0x16a6d0=new Redis(config[_0x3d94('0x6')]);_0x16a6d0[_0x3d94('0x16')]('agi',JSON['stringify']({'id':_0x1a9315['id'],'deleted':!![]}));})[_0x3d94('0x12')](function(){_0x22676a[_0x3d94('0x9')](0xcc)[_0x3d94('0x8')]();});}};}function handleEntityNotFound(_0x4edee4){return function(_0x30af25){if(!_0x30af25){_0x4edee4[_0x3d94('0x17')](0x194);}return _0x30af25;};}function handleError(_0x123adc,_0x384f76){_0x384f76=_0x384f76||0x1f4;return function(_0x395133){logger[_0x3d94('0x18')](_0x395133[_0x3d94('0x19')]);if(_0x395133[_0x3d94('0x1a')]){delete _0x395133[_0x3d94('0x1a')];}_0x123adc[_0x3d94('0x9')](_0x384f76)[_0x3d94('0x1b')](_0x395133);};}exports[_0x3d94('0x1c')]=function(_0x292976,_0x3496c3){var _0x2945d2={},_0x5b3b31={},_0x123183={'count':0x0,'rows':[]};var _0x558fd2=_[_0x3d94('0x1d')](db[_0x3d94('0x1e')][_0x3d94('0x1f')],function(_0x439173){return{'name':_0x439173[_0x3d94('0x20')],'type':_0x439173[_0x3d94('0x21')][_0x3d94('0x22')]};});_0x5b3b31['model']=_['map'](_0x558fd2,_0x3d94('0x1a'));_0x5b3b31['query']=_['keys'](_0x292976[_0x3d94('0x23')]);_0x5b3b31['filters']=_[_0x3d94('0x24')](_0x5b3b31[_0x3d94('0x25')],_0x5b3b31[_0x3d94('0x23')]);_0x2945d2['attributes']=_[_0x3d94('0x24')](_0x5b3b31['model'],qs[_0x3d94('0x26')](_0x292976['query'][_0x3d94('0x26')]));_0x2945d2[_0x3d94('0x27')]=_0x2945d2[_0x3d94('0x27')][_0x3d94('0x28')]?_0x2945d2['attributes']:_0x5b3b31[_0x3d94('0x25')];if(!_0x292976['query'][_0x3d94('0x29')](_0x3d94('0x2a'))){_0x2945d2['limit']=qs['limit'](_0x292976[_0x3d94('0x23')][_0x3d94('0xc')]);_0x2945d2[_0x3d94('0xa')]=qs['offset'](_0x292976[_0x3d94('0x23')][_0x3d94('0xa')]);}_0x2945d2['order']=qs[_0x3d94('0x2b')](_0x292976[_0x3d94('0x23')][_0x3d94('0x2b')]);_0x2945d2[_0x3d94('0x2c')]=qs[_0x3d94('0x2d')](_['pick'](_0x292976[_0x3d94('0x23')],_0x5b3b31[_0x3d94('0x2d')]),_0x558fd2);if(_0x292976[_0x3d94('0x23')][_0x3d94('0x2e')]){_0x2945d2[_0x3d94('0x2c')]=_[_0x3d94('0x2f')](_0x2945d2['where'],{'$or':_['map'](_0x558fd2,function(_0xfe58eb){if(_0xfe58eb[_0x3d94('0x21')]!==_0x3d94('0x30')){var _0x438ba3={};_0x438ba3[_0xfe58eb[_0x3d94('0x1a')]]={'$like':'%'+_0x292976[_0x3d94('0x23')][_0x3d94('0x2e')]+'%'};return _0x438ba3;}})});}_0x2945d2=_[_0x3d94('0x2f')]({},_0x2945d2,_0x292976[_0x3d94('0x31')]);var _0x2235f9={'where':_0x2945d2['where']};return db[_0x3d94('0x1e')][_0x3d94('0xd')](_0x2235f9)[_0x3d94('0x12')](function(_0xcc289a){_0x123183['count']=_0xcc289a;if(_0x292976[_0x3d94('0x23')][_0x3d94('0x32')]){_0x2945d2[_0x3d94('0x33')]=[{'all':!![]}];}return db[_0x3d94('0x1e')][_0x3d94('0x34')](_0x2945d2);})['then'](function(_0x217e5e){_0x123183[_0x3d94('0x35')]=_0x217e5e;return _0x123183;})[_0x3d94('0x12')](respondWithFilteredResult(_0x3496c3,_0x2945d2))['catch'](handleError(_0x3496c3,null));};exports['show']=function(_0x4d8a8f,_0x47905e){var _0x3b3550={'raw':![],'where':{'id':_0x4d8a8f[_0x3d94('0x36')]['id']}},_0x22f52c={};_0x22f52c[_0x3d94('0x25')]=_[_0x3d94('0x37')](db[_0x3d94('0x1e')][_0x3d94('0x1f')]);_0x22f52c['query']=_['keys'](_0x4d8a8f[_0x3d94('0x23')]);_0x22f52c[_0x3d94('0x2d')]=_['intersection'](_0x22f52c[_0x3d94('0x25')],_0x22f52c['query']);_0x3b3550[_0x3d94('0x27')]=_[_0x3d94('0x24')](_0x22f52c[_0x3d94('0x25')],qs[_0x3d94('0x26')](_0x4d8a8f[_0x3d94('0x23')]['fields']));_0x3b3550[_0x3d94('0x27')]=_0x3b3550[_0x3d94('0x27')][_0x3d94('0x28')]?_0x3b3550['attributes']:_0x22f52c[_0x3d94('0x25')];if(_0x4d8a8f['query']['includeAll']){_0x3b3550[_0x3d94('0x33')]=[{'all':!![]}];}_0x3b3550=_[_0x3d94('0x2f')]({},_0x3b3550,_0x4d8a8f[_0x3d94('0x31')]);return db[_0x3d94('0x1e')]['find'](_0x3b3550)[_0x3d94('0x12')](handleEntityNotFound(_0x47905e,null))['then'](respondWithResult(_0x47905e,null))[_0x3d94('0x38')](handleError(_0x47905e,null));};exports[_0x3d94('0x39')]=function(_0x35c911,_0x15c8e7){return db[_0x3d94('0x1e')][_0x3d94('0x39')](_0x35c911[_0x3d94('0x3a')],{})['then'](function(_0x10a377){var _0x19dabb=_0x35c911['user']['get']({'plain':!![]});if(!_0x19dabb)throw new Error(_0x3d94('0x3b'));if(_0x19dabb[_0x3d94('0x3c')]==='user'){var _0x3c8571=_0x10a377[_0x3d94('0x14')]({'plain':!![]});var _0x16d505=_0x3d94('0x3d');return db[_0x3d94('0x3e')][_0x3d94('0x3f')]({'where':{'name':_0x16d505,'userProfileId':_0x19dabb[_0x3d94('0x40')]},'raw':!![]})[_0x3d94('0x12')](function(_0x60279f){if(_0x60279f&&_0x60279f[_0x3d94('0x41')]===0x0){return db[_0x3d94('0x15')][_0x3d94('0x39')]({'name':_0x3c8571[_0x3d94('0x1a')],'resourceId':_0x3c8571['id'],'type':_0x60279f[_0x3d94('0x1a')],'sectionId':_0x60279f['id']},{})[_0x3d94('0x12')](function(){return _0x10a377;});}else{return _0x10a377;}})['catch'](function(_0x44df82){logger[_0x3d94('0x18')](_0x3d94('0x42'),_0x44df82);throw _0x44df82;});}return _0x10a377;})[_0x3d94('0x12')](respondWithResult(_0x15c8e7,0xc9))[_0x3d94('0x38')](handleError(_0x15c8e7,null));};exports[_0x3d94('0x11')]=function(_0x129783,_0x33db0a){if(_0x129783[_0x3d94('0x3a')]['id']){delete _0x129783['body']['id'];}return db[_0x3d94('0x1e')]['find']({'where':{'id':_0x129783[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x33db0a,null))['then'](saveUpdates(_0x129783[_0x3d94('0x3a')],null))['then'](function(_0x567751){if(!_0x567751)return;var _0x335247=_0x567751['get']({'plain':!![]});return _0x335247;})[_0x3d94('0x12')](function(_0x132e0b){var _0x5b6061=new Redis(config[_0x3d94('0x6')]);_0x5b6061['publish']('agi',JSON[_0x3d94('0x43')](_[_0x3d94('0x44')](_0x132e0b,['id',_0x3d94('0x1a'),_0x3d94('0x45')])));return _0x132e0b;})[_0x3d94('0x12')](respondWithResult(_0x33db0a,null))[_0x3d94('0x38')](handleError(_0x33db0a,null));};exports[_0x3d94('0x13')]=function(_0x2b1168,_0xae892){return db['SquareProject'][_0x3d94('0x3f')]({'where':{'id':_0x2b1168[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0xae892,null))[_0x3d94('0x12')](removeEntity(_0xae892,null))[_0x3d94('0x38')](handleError(_0xae892,null));};exports[_0x3d94('0x46')]=function(_0x39e9db,_0x126894){return db[_0x3d94('0x1e')][_0x3d94('0x3f')]({'where':{'id':_0x39e9db[_0x3d94('0x36')]['id']}})['then'](handleEntityNotFound(_0x126894,null))[_0x3d94('0x12')](function(_0x55580d){if(_0x55580d){return _0x55580d[_0x3d94('0x46')](_0x39e9db[_0x3d94('0x3a')][_0x3d94('0x47')],_[_0x3d94('0x48')](_0x39e9db[_0x3d94('0x3a')],[_0x3d94('0x47'),'id'])||{});}})[_0x3d94('0x12')](respondWithResult(_0x126894,null))[_0x3d94('0x38')](handleError(_0x126894,null));};exports[_0x3d94('0x49')]=function(_0x5da38c,_0x519ada){return db[_0x3d94('0x1e')]['find']({'where':{'id':_0x5da38c[_0x3d94('0x36')]['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x519ada,null))['then'](function(_0x211f0e){if(_0x211f0e){return _0x211f0e[_0x3d94('0x49')](_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')])[_0x3d94('0x12')](function(){if(_[_0x3d94('0x4a')](_0x5da38c[_0x3d94('0x23')]['ids'])){for(var _0x22dbf9=0x0;_0x22dbf9<_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')]['length'];_0x22dbf9+=0x1){socket[_0x3d94('0x4b')](_0x3d94('0x4c'),{'UserId':Number(_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')][_0x22dbf9]),'SquareProjectId':Number(_0x5da38c['params']['id'])});}}else{socket['emit'](_0x3d94('0x4c'),{'UserId':Number(_0x5da38c[_0x3d94('0x23')][_0x3d94('0x47')]),'SquareProjectId':Number(_0x5da38c[_0x3d94('0x36')]['id'])});}});}})['then'](respondWithStatusCode(_0x519ada,null))[_0x3d94('0x38')](handleError(_0x519ada,null));};exports[_0x3d94('0x4d')]=function(_0x49bfb0,_0x5ba865){var _0x250c87={};var _0x336e36={};var _0x4eee2b;var _0x3135f3;return db[_0x3d94('0x1e')][_0x3d94('0x4e')]({'where':{'id':_0x49bfb0['params']['id']}})[_0x3d94('0x12')](handleEntityNotFound(_0x5ba865,null))[_0x3d94('0x12')](function(_0x5c7aac){if(_0x5c7aac){_0x4eee2b=_0x5c7aac;_0x336e36['model']=_['keys'](db[_0x3d94('0x4f')][_0x3d94('0x1f')]);_0x336e36[_0x3d94('0x23')]=_[_0x3d94('0x37')](_0x49bfb0[_0x3d94('0x23')]);_0x336e36['filters']=_[_0x3d94('0x24')](_0x336e36[_0x3d94('0x25')],_0x336e36[_0x3d94('0x23')]);_0x250c87[_0x3d94('0x27')]=_[_0x3d94('0x24')](_0x336e36[_0x3d94('0x25')],qs['fields'](_0x49bfb0[_0x3d94('0x23')]['fields']));_0x250c87[_0x3d94('0x27')]=_0x250c87[_0x3d94('0x27')][_0x3d94('0x28')]?_0x250c87[_0x3d94('0x27')]:_0x336e36[_0x3d94('0x25')];_0x250c87[_0x3d94('0x50')]=qs['sort'](_0x49bfb0['query'][_0x3d94('0x2b')]);_0x250c87['where']=qs['filters'](_['pick'](_0x49bfb0[_0x3d94('0x23')],_0x336e36[_0x3d94('0x2d')]));if(_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x2e')]){_0x250c87[_0x3d94('0x2c')]=_[_0x3d94('0x2f')](_0x250c87[_0x3d94('0x2c')],{'$or':_[_0x3d94('0x1d')](_0x250c87['attributes'],function(_0x22917e){var _0x5e55a4={};_0x5e55a4[_0x22917e]={'$like':'%'+_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x2e')]+'%'};return _0x5e55a4;})});}_0x250c87=_[_0x3d94('0x2f')]({},_0x250c87,_0x49bfb0['options']);return _0x4eee2b['getUsers'](_0x250c87);}})['then'](function(_0x426ef5){if(_0x426ef5){_0x3135f3=_0x426ef5[_0x3d94('0x28')];if(!_0x49bfb0[_0x3d94('0x23')][_0x3d94('0x29')](_0x3d94('0x2a'))){_0x250c87['limit']=qs['limit'](_0x49bfb0[_0x3d94('0x23')][_0x3d94('0xc')]);_0x250c87[_0x3d94('0xa')]=qs['offset'](_0x49bfb0[_0x3d94('0x23')]['offset']);}return _0x4eee2b[_0x3d94('0x4d')](_0x250c87);}})[_0x3d94('0x12')](function(_0x15adf7){if(_0x15adf7){return _0x15adf7?{'count':_0x3135f3,'rows':_0x15adf7}:null;}})[_0x3d94('0x12')](respondWithResult(_0x5ba865,null))[_0x3d94('0x38')](handleError(_0x5ba865,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index da97cb8..9f3c498 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 _0xc47d=['hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x417574,_0x1b434e){var _0x55c056=function(_0x350283){while(--_0x350283){_0x417574['push'](_0x417574['shift']());}};_0x55c056(++_0x1b434e);}(_0xc47d,0x100));var _0xdc47=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xc47d[_0x21aec3];return _0x288bbc;};'use strict';var EventEmitter=require(_0xdc47('0x0'));var SquareProject=require(_0xdc47('0x1'))['db'][_0xdc47('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xdc47('0x3')](0x0);var events={'afterCreate':_0xdc47('0x4'),'afterUpdate':_0xdc47('0x5'),'afterDestroy':_0xdc47('0x6')};function emitEvent(_0x44e6cf){return function(_0x38abca,_0x177f18,_0xbfcdd7){SquareProjectEvents[_0xdc47('0x7')](_0x44e6cf+':'+_0x38abca['id'],_0x38abca);SquareProjectEvents[_0xdc47('0x7')](_0x44e6cf,_0x38abca);_0xbfcdd7(null);};}for(var e in events){if(events[_0xdc47('0x8')](e)){var event=events[e];SquareProject[_0xdc47('0x9')](e,emitEvent(event));}}module[_0xdc47('0xa')]=SquareProjectEvents; \ No newline at end of file +var _0x62b8=['SquareProject','setMaxListeners','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x37d59b,_0x421a04){var _0x49b827=function(_0x57fb5d){while(--_0x57fb5d){_0x37d59b['push'](_0x37d59b['shift']());}};_0x49b827(++_0x421a04);}(_0x62b8,0x16e));var _0x862b=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x62b8[_0x14fad0];return _0x5c665f;};'use strict';var EventEmitter=require(_0x862b('0x0'));var SquareProject=require(_0x862b('0x1'))['db'][_0x862b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x862b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x862b('0x4')};function emitEvent(_0x699e39){return function(_0x55f9fe,_0x3e59b3,_0x114bd1){SquareProjectEvents[_0x862b('0x5')](_0x699e39+':'+_0x55f9fe['id'],_0x55f9fe);SquareProjectEvents[_0x862b('0x5')](_0x699e39,_0x55f9fe);_0x114bd1(null);};}for(var e in events){if(events[_0x862b('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x862b('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0344c65..2279c53 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 _0xcf98=['format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','define','SquareProject','square_projects','changed'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0xcf98,0x1c5));var _0x8cf9=function(_0x7a31b0,_0x3fcc7f){_0x7a31b0=_0x7a31b0-0x0;var _0x2fde01=_0xcf98[_0x7a31b0];return _0x2fde01;};'use strict';var _=require(_0x8cf9('0x0'));var util=require(_0x8cf9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cf9('0x2'));var BPromise=require(_0x8cf9('0x3'));var rp=require(_0x8cf9('0x4'));var fs=require('fs');var path=require(_0x8cf9('0x5'));var rimraf=require(_0x8cf9('0x6'));var config=require('../../config/environment');var attributes=require(_0x8cf9('0x7'));module['exports']=function(_0x473e76,_0x54b0d5){return _0x473e76[_0x8cf9('0x8')](_0x8cf9('0x9'),attributes,{'tableName':_0x8cf9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b44c3,_0x5a168a,_0x57f8f7){if(_0x3b44c3[_0x8cf9('0xb')]('preproduction')){_0x3b44c3['savedAt']=moment()[_0x8cf9('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3b44c3[_0x8cf9('0xb')](_0x8cf9('0xd'))){_0x3b44c3['publishedAt']=moment()[_0x8cf9('0xc')](_0x8cf9('0xe'));}_0x57f8f7(null,_0x3b44c3);}}});}; \ No newline at end of file +var _0x8fe9=['SquareProject','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x25d5e9,_0x340fda){var _0xa351e2=function(_0x14bc4a){while(--_0x14bc4a){_0x25d5e9['push'](_0x25d5e9['shift']());}};_0xa351e2(++_0x340fda);}(_0x8fe9,0x181));var _0x98fe=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x8fe9[_0x594e11];return _0x5418ad;};'use strict';var _=require(_0x98fe('0x0'));var util=require('util');var logger=require(_0x98fe('0x1'))(_0x98fe('0x2'));var moment=require(_0x98fe('0x3'));var BPromise=require(_0x98fe('0x4'));var rp=require(_0x98fe('0x5'));var fs=require('fs');var path=require(_0x98fe('0x6'));var rimraf=require(_0x98fe('0x7'));var config=require(_0x98fe('0x8'));var attributes=require(_0x98fe('0x9'));module[_0x98fe('0xa')]=function(_0x465341,_0x5755de){return _0x465341['define'](_0x98fe('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40a989,_0x153b4a,_0x3b97f0){if(_0x40a989[_0x98fe('0xc')]('preproduction')){_0x40a989[_0x98fe('0xd')]=moment()['format'](_0x98fe('0xe'));}if(_0x40a989['changed'](_0x98fe('0xf'))){_0x40a989[_0x98fe('0x10')]=moment()[_0x98fe('0x11')](_0x98fe('0xe'));}_0x3b97f0(null,_0x40a989);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2b3537d..a0d5bea 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 _0x4b5d=['info','debug','stringify','error','message','find','ShowSquareProject','catch','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','map','include','model','then'];(function(_0x386422,_0x261b43){var _0x3a73f3=function(_0x3de190){while(--_0x3de190){_0x386422['push'](_0x386422['shift']());}};_0x3a73f3(++_0x261b43);}(_0x4b5d,0x1d9));var _0xd4b5=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x4b5d[_0x4bb145];return _0x4db596;};'use strict';var _=require(_0xd4b5('0x0'));var Redis=require(_0xd4b5('0x1'));var db=require(_0xd4b5('0x2'))['db'];var logger=require(_0xd4b5('0x3'))(_0xd4b5('0x4'));var config=require(_0xd4b5('0x5'));config[_0xd4b5('0x6')]=_[_0xd4b5('0x7')](config[_0xd4b5('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xd4b5('0x8'))(new Redis(config[_0xd4b5('0x6')]));require(_0xd4b5('0x9'))[_0xd4b5('0xa')](socket);exports[_0xd4b5('0xb')]=function(_0x5937e7){var _0x21ba1f=this;return new Promise(function(_0x4195d9,_0x3184d6){return db[_0xd4b5('0xc')][_0xd4b5('0xd')]({'raw':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0xf')]===undefined?!![]:![]:!![],'where':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x10')]||null:null,'attributes':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x11')]||null:null,'limit':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x12')]||null:null,'include':_0x5937e7[_0xd4b5('0xe')]?_0x5937e7['options']['include']?_[_0xd4b5('0x13')](_0x5937e7[_0xd4b5('0xe')][_0xd4b5('0x14')],function(_0x2e49b2){return{'model':db[_0x2e49b2['model']],'as':_0x2e49b2['as'],'attributes':_0x2e49b2[_0xd4b5('0x11')],'include':_0x2e49b2['include']?_['map'](_0x2e49b2[_0xd4b5('0x14')],function(_0x5c4dd4){return{'model':db[_0x5c4dd4[_0xd4b5('0x15')]],'as':_0x5c4dd4['as'],'attributes':_0x5c4dd4[_0xd4b5('0x11')],'include':_0x5c4dd4[_0xd4b5('0x14')]?_['map'](_0x5c4dd4[_0xd4b5('0x14')],function(_0x27d718){return{'model':db[_0x27d718[_0xd4b5('0x15')]],'as':_0x27d718['as'],'attributes':_0x27d718[_0xd4b5('0x11')]};}):[]};}):[]};}):[]:[]})[_0xd4b5('0x16')](function(_0x67d886){logger[_0xd4b5('0x17')](_0xd4b5('0xb'),_0x5937e7);logger[_0xd4b5('0x18')](_0xd4b5('0xb'),_0x5937e7,JSON[_0xd4b5('0x19')](_0x67d886));_0x4195d9(_0x67d886);})['catch'](function(_0x4baa54){logger[_0xd4b5('0x1a')](_0xd4b5('0xb'),_0x4baa54[_0xd4b5('0x1b')],_0x5937e7);_0x3184d6(_0x21ba1f[_0xd4b5('0x1a')](0x1f4,_0x4baa54[_0xd4b5('0x1b')]));});});};exports['ShowSquareProject']=function(_0x53af7a){var _0x558c04=this;return new Promise(function(_0x454dea,_0x3b269f){return db[_0xd4b5('0xc')][_0xd4b5('0x1c')]({'raw':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0xf')]===undefined?!![]:![]:!![],'where':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x10')]||null:null,'attributes':_0x53af7a[_0xd4b5('0xe')]?_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x11')]||null:null,'include':_0x53af7a['options']?_0x53af7a['options'][_0xd4b5('0x14')]?_[_0xd4b5('0x13')](_0x53af7a[_0xd4b5('0xe')][_0xd4b5('0x14')],function(_0x29fa1a){return{'model':db[_0x29fa1a['model']],'as':_0x29fa1a['as'],'attributes':_0x29fa1a[_0xd4b5('0x11')],'include':_0x29fa1a['include']?_[_0xd4b5('0x13')](_0x29fa1a[_0xd4b5('0x14')],function(_0x5e2630){return{'model':db[_0x5e2630[_0xd4b5('0x15')]],'as':_0x5e2630['as'],'attributes':_0x5e2630[_0xd4b5('0x11')],'include':_0x5e2630['include']?_[_0xd4b5('0x13')](_0x5e2630[_0xd4b5('0x14')],function(_0x1eef15){return{'model':db[_0x1eef15[_0xd4b5('0x15')]],'as':_0x1eef15['as'],'attributes':_0x1eef15['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4b5('0x16')](function(_0x33f642){logger['info'](_0xd4b5('0x1d'),_0x53af7a);logger['debug'](_0xd4b5('0x1d'),_0x53af7a,JSON[_0xd4b5('0x19')](_0x33f642));_0x454dea(_0x33f642);})[_0xd4b5('0x1e')](function(_0x2d6dd9){logger[_0xd4b5('0x1a')](_0xd4b5('0x1d'),_0x2d6dd9[_0xd4b5('0x1b')],_0x53af7a);_0x3b269f(_0x558c04[_0xd4b5('0x1a')](0x1f4,_0x2d6dd9[_0xd4b5('0x1b')]));});});}; \ No newline at end of file +var _0x3239=['attributes','limit','map','include','model','then','info','debug','stringify','error','message','ShowSquareProject','catch','lodash','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x3239,0x7d));var _0x9323=function(_0x176362,_0xc54a7f){_0x176362=_0x176362-0x0;var _0x352765=_0x3239[_0x176362];return _0x352765;};'use strict';var _=require(_0x9323('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x9323('0x1'))(_0x9323('0x2'));var config=require(_0x9323('0x3'));config[_0x9323('0x4')]=_[_0x9323('0x5')](config[_0x9323('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x9323('0x6'))(new Redis(config[_0x9323('0x4')]));require(_0x9323('0x7'))[_0x9323('0x8')](socket);exports[_0x9323('0x9')]=function(_0x20087b){var _0x50c5f3=this;return new Promise(function(_0x270d1d,_0x3f61db){return db[_0x9323('0xa')][_0x9323('0xb')]({'raw':_0x20087b[_0x9323('0xc')]?_0x20087b[_0x9323('0xc')][_0x9323('0xd')]===undefined?!![]:![]:!![],'where':_0x20087b['options']?_0x20087b[_0x9323('0xc')][_0x9323('0xe')]||null:null,'attributes':_0x20087b[_0x9323('0xc')]?_0x20087b[_0x9323('0xc')][_0x9323('0xf')]||null:null,'limit':_0x20087b[_0x9323('0xc')]?_0x20087b[_0x9323('0xc')][_0x9323('0x10')]||null:null,'include':_0x20087b['options']?_0x20087b[_0x9323('0xc')]['include']?_[_0x9323('0x11')](_0x20087b[_0x9323('0xc')][_0x9323('0x12')],function(_0x349774){return{'model':db[_0x349774[_0x9323('0x13')]],'as':_0x349774['as'],'attributes':_0x349774['attributes'],'include':_0x349774[_0x9323('0x12')]?_['map'](_0x349774['include'],function(_0x31c0fb){return{'model':db[_0x31c0fb[_0x9323('0x13')]],'as':_0x31c0fb['as'],'attributes':_0x31c0fb[_0x9323('0xf')],'include':_0x31c0fb[_0x9323('0x12')]?_[_0x9323('0x11')](_0x31c0fb['include'],function(_0x346018){return{'model':db[_0x346018[_0x9323('0x13')]],'as':_0x346018['as'],'attributes':_0x346018[_0x9323('0xf')]};}):[]};}):[]};}):[]:[]})[_0x9323('0x14')](function(_0x3f2dea){logger[_0x9323('0x15')]('GetSquareProjects',_0x20087b);logger[_0x9323('0x16')](_0x9323('0x9'),_0x20087b,JSON[_0x9323('0x17')](_0x3f2dea));_0x270d1d(_0x3f2dea);})['catch'](function(_0x37d10d){logger[_0x9323('0x18')]('GetSquareProjects',_0x37d10d[_0x9323('0x19')],_0x20087b);_0x3f61db(_0x50c5f3['error'](0x1f4,_0x37d10d[_0x9323('0x19')]));});});};exports[_0x9323('0x1a')]=function(_0x2b7000){var _0x3a37e0=this;return new Promise(function(_0x54b8af,_0x2594c1){return db[_0x9323('0xa')]['find']({'raw':_0x2b7000[_0x9323('0xc')]?_0x2b7000[_0x9323('0xc')][_0x9323('0xd')]===undefined?!![]:![]:!![],'where':_0x2b7000['options']?_0x2b7000[_0x9323('0xc')][_0x9323('0xe')]||null:null,'attributes':_0x2b7000[_0x9323('0xc')]?_0x2b7000[_0x9323('0xc')][_0x9323('0xf')]||null:null,'include':_0x2b7000[_0x9323('0xc')]?_0x2b7000[_0x9323('0xc')][_0x9323('0x12')]?_[_0x9323('0x11')](_0x2b7000[_0x9323('0xc')][_0x9323('0x12')],function(_0x5a0d48){return{'model':db[_0x5a0d48[_0x9323('0x13')]],'as':_0x5a0d48['as'],'attributes':_0x5a0d48[_0x9323('0xf')],'include':_0x5a0d48[_0x9323('0x12')]?_['map'](_0x5a0d48[_0x9323('0x12')],function(_0x5a49b1){return{'model':db[_0x5a49b1['model']],'as':_0x5a49b1['as'],'attributes':_0x5a49b1['attributes'],'include':_0x5a49b1[_0x9323('0x12')]?_[_0x9323('0x11')](_0x5a49b1[_0x9323('0x12')],function(_0x4ef7cc){return{'model':db[_0x4ef7cc[_0x9323('0x13')]],'as':_0x4ef7cc['as'],'attributes':_0x4ef7cc[_0x9323('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1dcb80){logger['info']('ShowSquareProject',_0x2b7000);logger[_0x9323('0x16')](_0x9323('0x1a'),_0x2b7000,JSON[_0x9323('0x17')](_0x1dcb80));_0x54b8af(_0x1dcb80);})[_0x9323('0x1b')](function(_0xf7c4e4){logger[_0x9323('0x18')](_0x9323('0x1a'),_0xf7c4e4['message'],_0x2b7000);_0x2594c1(_0x3a37e0[_0x9323('0x18')](0x1f4,_0xf7c4e4[_0x9323('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0a7a62e..f8dacdb 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 _0xb1d0=['removeListener','register','length','squareProject:','remove'];(function(_0x482238,_0x35a004){var _0x37287c=function(_0x37db7d){while(--_0x37db7d){_0x482238['push'](_0x482238['shift']());}};_0x37287c(++_0x35a004);}(_0xb1d0,0x167));var _0x0b1d=function(_0x2931e6,_0x4b79a2){_0x2931e6=_0x2931e6-0x0;var _0x1b1208=_0xb1d0[_0x2931e6];return _0x1b1208;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x0b1d('0x0'),'update'];function createListener(_0xcd2c02,_0x436156){return function(_0x45aa8b){_0x436156['emit'](_0xcd2c02,_0x45aa8b);};}function removeListener(_0x292a76,_0x4c9792){return function(){SquareProjectEvents[_0x0b1d('0x1')](_0x292a76,_0x4c9792);};}exports[_0x0b1d('0x2')]=function(_0x35cdb2){for(var _0x48c758=0x0,_0x203af4=events[_0x0b1d('0x3')];_0x48c758<_0x203af4;_0x48c758++){var _0x3ef7f4=events[_0x48c758];var _0x4ca534=createListener(_0x0b1d('0x4')+_0x3ef7f4,_0x35cdb2);SquareProjectEvents['on'](_0x3ef7f4,_0x4ca534);}}; \ No newline at end of file +var _0xf77f=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x290e55,_0x16e72c){var _0x682dba=function(_0x125c17){while(--_0x125c17){_0x290e55['push'](_0x290e55['shift']());}};_0x682dba(++_0x16e72c);}(_0xf77f,0x1d0));var _0xff77=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xf77f[_0x152121];return _0x592a85;};'use strict';var SquareProjectEvents=require(_0xff77('0x0'));var events=[_0xff77('0x1'),_0xff77('0x2'),_0xff77('0x3')];function createListener(_0x3d57dd,_0x47c9e0){return function(_0x328b49){_0x47c9e0[_0xff77('0x4')](_0x3d57dd,_0x328b49);};}function removeListener(_0x239355,_0x3644e8){return function(){SquareProjectEvents[_0xff77('0x5')](_0x239355,_0x3644e8);};}exports[_0xff77('0x6')]=function(_0x5948f2){for(var _0x4000bb=0x0,_0xad924=events[_0xff77('0x7')];_0x4000bb<_0xad924;_0x4000bb++){var _0xc53c0f=events[_0x4000bb];var _0x4077da=createListener(_0xff77('0x8')+_0xc53c0f,_0x5948f2);SquareProjectEvents['on'](_0xc53c0f,_0x4077da);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e7fed1f..acd5f95 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(_0x281263,_0x5f20aa){var _0x3cbc91=function(_0x3f67e8){while(--_0x3f67e8){_0x281263['push'](_0x281263['shift']());}};_0x3cbc91(++_0x5f20aa);}(_0x814b,0x1a2));var _0xb814=function(_0x24a654,_0x2ca441){_0x24a654=_0x24a654-0x0;var _0x458651=_0x814b[_0x24a654];return _0x458651;};'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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x2a9efd,_0x46b3a6){var _0x551323=function(_0x35e206){while(--_0x35e206){_0x2a9efd['push'](_0x2a9efd['shift']());}};_0x551323(++_0x46b3a6);}(_0x1261,0x144));var _0x1126=function(_0x5bf992,_0x533b26){_0x5bf992=_0x5bf992-0x0;var _0x288176=_0x1261[_0x5bf992];return _0x288176;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b152746..67b151c 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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x3fdd14,_0x1cd210){var _0x101823=function(_0x1a6e8e){while(--_0x1a6e8e){_0x3fdd14['push'](_0x3fdd14['shift']());}};_0x101823(++_0x1cd210);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0xf2ca[_0x43a6cd];return _0x5acb36;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x3aedc3,_0x5aa449){var _0x48400e=function(_0x184f0d){while(--_0x184f0d){_0x3aedc3['push'](_0x3aedc3['shift']());}};_0x48400e(++_0x5aa449);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd46e('0x2')]},'calleridname':{'type':Sequelize[_0xd46e('0x2')]},'context':{'type':Sequelize[_0xd46e('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd46e('0x2')]},'accountcode':{'type':Sequelize[_0xd46e('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd46e('0x2')]},'saveName':{'type':Sequelize[_0xd46e('0x2')]},'filename':{'type':Sequelize[_0xd46e('0x2')]},'savePath':{'type':Sequelize[_0xd46e('0x2')]},'format':{'type':Sequelize[_0xd46e('0x3')],'get':function(){var _0x855f24='';var _0x437ea0=this[_0xd46e('0x4')](_0xd46e('0x5'));if(_0x437ea0){_0x855f24=_0x437ea0[_0xd46e('0x6')](_0x437ea0[_0xd46e('0x7')]('.'));}return _0x855f24;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6932f2a..20ad922 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 _0x0c2d=['body','find','params','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','send','fieldName','type','key','model','map','name','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','findAll','rows','catch','show','rawAttributes','intersection','length','include','create'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x0c2d,0x1ef));var _0xd0c2=function(_0x1cad89,_0x18c165){_0x1cad89=_0x1cad89-0x0;var _0xdc44b6=_0x0c2d[_0x1cad89];return _0xdc44b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0c2('0x0'));var jsonpatch=require(_0xd0c2('0x1'));var rp=require(_0xd0c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd0c2('0x3'));var util=require(_0xd0c2('0x4'));var path=require('path');var sox=require(_0xd0c2('0x5'));var csv=require(_0xd0c2('0x6'));var ejs=require(_0xd0c2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0c2('0x8'));var squel=require('squel');var crypto=require(_0xd0c2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd0c2('0xa'));var toCsv=require(_0xd0c2('0x6'));var querystring=require(_0xd0c2('0xb'));var Papa=require(_0xd0c2('0xc'));var Redis=require(_0xd0c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd0c2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0c2('0xf'));var logger=require(_0xd0c2('0x10'))(_0xd0c2('0x11'));var utils=require(_0xd0c2('0x12'));var config=require(_0xd0c2('0x13'));var licenseUtil=require(_0xd0c2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ab737,_0x375929){_0x375929=_0x375929||0xcc;return function(_0x2e9ec3){if(_0x2e9ec3){return _0x1ab737[_0xd0c2('0x15')](_0x375929);}return _0x1ab737[_0xd0c2('0x16')](_0x375929)[_0xd0c2('0x17')]();};}function respondWithResult(_0x46e260,_0x476b52){_0x476b52=_0x476b52||0xc8;return function(_0x572ceb){if(_0x572ceb){return _0x46e260[_0xd0c2('0x16')](_0x476b52)['json'](_0x572ceb);}};}function respondWithFilteredResult(_0x2b33f1,_0x30de42){return function(_0x2d23e2){if(_0x2d23e2){var _0x3c754b=typeof _0x30de42['offset']===_0xd0c2('0x18')&&typeof _0x30de42[_0xd0c2('0x19')]===_0xd0c2('0x18');var _0x3ae8eb=_0x2d23e2[_0xd0c2('0x1a')];var _0x25079e=_0x3c754b?0x0:_0x30de42[_0xd0c2('0x1b')];var _0x39f6c7=_0x3c754b?_0x2d23e2[_0xd0c2('0x1a')]:_0x30de42[_0xd0c2('0x1b')]+_0x30de42['limit'];var _0x14fde4;if(_0x39f6c7>=_0x3ae8eb){_0x39f6c7=_0x3ae8eb;_0x14fde4=0xc8;}else{_0x14fde4=0xce;}_0x2b33f1['status'](_0x14fde4);return _0x2b33f1[_0xd0c2('0x1c')](_0xd0c2('0x1d'),_0x25079e+'-'+_0x39f6c7+'/'+_0x3ae8eb)[_0xd0c2('0x1e')](_0x2d23e2);}return null;};}function patchUpdates(_0x478a02){return function(_0x45a87b){try{jsonpatch['apply'](_0x45a87b,_0x478a02,!![]);}catch(_0x423b85){return BPromise[_0xd0c2('0x1f')](_0x423b85);}return _0x45a87b[_0xd0c2('0x20')]();};}function saveUpdates(_0x418302,_0x4b367d){return function(_0x1604b5){if(_0x1604b5){return _0x1604b5[_0xd0c2('0x21')](_0x418302)[_0xd0c2('0x22')](function(_0x1a31c0){return _0x1a31c0;});}return null;};}function removeEntity(_0x5a57a3,_0x528c61){return function(_0x33d38b){if(_0x33d38b){return _0x33d38b[_0xd0c2('0x23')]()[_0xd0c2('0x22')](function(){_0x5a57a3['status'](0xcc)[_0xd0c2('0x17')]();});}};}function handleEntityNotFound(_0x410cfa,_0x351a1a){return function(_0x36800f){if(!_0x36800f){_0x410cfa[_0xd0c2('0x15')](0x194);}return _0x36800f;};}function handleError(_0x8abab6,_0x468265){_0x468265=_0x468265||0x1f4;return function(_0x31e72a){logger[_0xd0c2('0x24')](_0x31e72a[_0xd0c2('0x25')]);if(_0x31e72a['name']){delete _0x31e72a['name'];}_0x8abab6['status'](_0x468265)[_0xd0c2('0x26')](_0x31e72a);};}exports['index']=function(_0x54a3c4,_0x1a89c4){var _0x1d7781={},_0x63785f={},_0x543dc5={'count':0x0,'rows':[]};var _0x28e34b=_['map'](db['SquareRecording']['rawAttributes'],function(_0x446dea){return{'name':_0x446dea[_0xd0c2('0x27')],'type':_0x446dea[_0xd0c2('0x28')][_0xd0c2('0x29')]};});_0x63785f[_0xd0c2('0x2a')]=_[_0xd0c2('0x2b')](_0x28e34b,_0xd0c2('0x2c'));_0x63785f[_0xd0c2('0x2d')]=_[_0xd0c2('0x2e')](_0x54a3c4[_0xd0c2('0x2d')]);_0x63785f['filters']=_['intersection'](_0x63785f[_0xd0c2('0x2a')],_0x63785f['query']);_0x1d7781['attributes']=_['intersection'](_0x63785f[_0xd0c2('0x2a')],qs['fields'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x2f')]));_0x1d7781[_0xd0c2('0x30')]=_0x1d7781[_0xd0c2('0x30')]['length']?_0x1d7781[_0xd0c2('0x30')]:_0x63785f[_0xd0c2('0x2a')];if(!_0x54a3c4[_0xd0c2('0x2d')]['hasOwnProperty']('nolimit')){_0x1d7781['limit']=qs['limit'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x19')]);_0x1d7781[_0xd0c2('0x1b')]=qs['offset'](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x1b')]);}_0x1d7781[_0xd0c2('0x31')]=qs[_0xd0c2('0x32')](_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x32')]);_0x1d7781[_0xd0c2('0x33')]=qs[_0xd0c2('0x34')](_[_0xd0c2('0x35')](_0x54a3c4[_0xd0c2('0x2d')],_0x63785f['filters']),_0x28e34b);if(_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x36')]){_0x1d7781[_0xd0c2('0x33')]=_[_0xd0c2('0x37')](_0x1d7781[_0xd0c2('0x33')],{'$or':_[_0xd0c2('0x2b')](_0x28e34b,function(_0x1f6f99){if(_0x1f6f99[_0xd0c2('0x28')]!==_0xd0c2('0x38')){var _0x37795c={};_0x37795c[_0x1f6f99[_0xd0c2('0x2c')]]={'$like':'%'+_0x54a3c4[_0xd0c2('0x2d')]['filter']+'%'};return _0x37795c;}})});}_0x1d7781=_[_0xd0c2('0x37')]({},_0x1d7781,_0x54a3c4[_0xd0c2('0x39')]);var _0x52d29d={'where':_0x1d7781[_0xd0c2('0x33')]};return db[_0xd0c2('0x3a')][_0xd0c2('0x1a')](_0x52d29d)[_0xd0c2('0x22')](function(_0x27de33){_0x543dc5[_0xd0c2('0x1a')]=_0x27de33;if(_0x54a3c4[_0xd0c2('0x2d')][_0xd0c2('0x3b')]){_0x1d7781['include']=[{'all':!![]}];}return db[_0xd0c2('0x3a')][_0xd0c2('0x3c')](_0x1d7781);})[_0xd0c2('0x22')](function(_0x263326){_0x543dc5[_0xd0c2('0x3d')]=_0x263326;return _0x543dc5;})[_0xd0c2('0x22')](respondWithFilteredResult(_0x1a89c4,_0x1d7781))[_0xd0c2('0x3e')](handleError(_0x1a89c4,null));};exports[_0xd0c2('0x3f')]=function(_0x3a9d9b,_0x42d842){var _0x551a88={'raw':!![],'where':{'id':_0x3a9d9b['params']['id']}},_0x57cf89={};_0x57cf89['model']=_[_0xd0c2('0x2e')](db[_0xd0c2('0x3a')][_0xd0c2('0x40')]);_0x57cf89['query']=_['keys'](_0x3a9d9b[_0xd0c2('0x2d')]);_0x57cf89[_0xd0c2('0x34')]=_[_0xd0c2('0x41')](_0x57cf89[_0xd0c2('0x2a')],_0x57cf89['query']);_0x551a88[_0xd0c2('0x30')]=_[_0xd0c2('0x41')](_0x57cf89['model'],qs[_0xd0c2('0x2f')](_0x3a9d9b['query']['fields']));_0x551a88[_0xd0c2('0x30')]=_0x551a88['attributes'][_0xd0c2('0x42')]?_0x551a88[_0xd0c2('0x30')]:_0x57cf89[_0xd0c2('0x2a')];if(_0x3a9d9b[_0xd0c2('0x2d')][_0xd0c2('0x3b')]){_0x551a88[_0xd0c2('0x43')]=[{'all':!![]}];}_0x551a88=_[_0xd0c2('0x37')]({},_0x551a88,_0x3a9d9b[_0xd0c2('0x39')]);return db[_0xd0c2('0x3a')]['find'](_0x551a88)[_0xd0c2('0x22')](handleEntityNotFound(_0x42d842,null))['then'](respondWithResult(_0x42d842,null))['catch'](handleError(_0x42d842,null));};exports[_0xd0c2('0x44')]=function(_0x113110,_0x34ec03){return db[_0xd0c2('0x3a')]['create'](_0x113110[_0xd0c2('0x45')],{})[_0xd0c2('0x22')](respondWithResult(_0x34ec03,0xc9))[_0xd0c2('0x3e')](handleError(_0x34ec03,null));};exports[_0xd0c2('0x21')]=function(_0x4a0f9c,_0x50d871){if(_0x4a0f9c[_0xd0c2('0x45')]['id']){delete _0x4a0f9c['body']['id'];}return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':{'id':_0x4a0f9c[_0xd0c2('0x47')]['id']}})[_0xd0c2('0x22')](handleEntityNotFound(_0x50d871,null))[_0xd0c2('0x22')](saveUpdates(_0x4a0f9c[_0xd0c2('0x45')],null))[_0xd0c2('0x22')](respondWithResult(_0x50d871,null))[_0xd0c2('0x3e')](handleError(_0x50d871,null));};exports[_0xd0c2('0x48')]=function(_0x51ebeb,_0x4dd56b,_0x1d26e8){var _0x488382=require(_0xd0c2('0x49'));var _0x44fca0=![];var _0x3acd99={};if(_0x51ebeb[_0xd0c2('0x2d')][_0xd0c2('0x28')]&&_0x51ebeb['query'][_0xd0c2('0x28')]==='uniqueid'){_0x3acd99[_0xd0c2('0x4a')]=_0x51ebeb[_0xd0c2('0x47')]['id'];}else{_0x3acd99['id']=_0x51ebeb[_0xd0c2('0x47')]['id'];}return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':_0x3acd99,'attributes':['id',_0xd0c2('0x4b'),_0xd0c2('0x4c')],'raw':!![]})[_0xd0c2('0x22')](handleEntityNotFound(_0x4dd56b,null))[_0xd0c2('0x22')](function(_0x33b7bb){if(_0x33b7bb){var _0x24c1e3=_0x33b7bb[_0xd0c2('0x4b')];var _0x3ed628=util['format']('%s.cypher',_0x24c1e3);if(fs[_0xd0c2('0x4d')](_0x3ed628)){_0x44fca0=!![];return _0x488382[_0xd0c2('0x4e')](_0x3ed628,_0x24c1e3,config[_0xd0c2('0x4f')][_0xd0c2('0x50')])[_0xd0c2('0x22')](function(){return _0x33b7bb;});}return _0x33b7bb;}})[_0xd0c2('0x22')](function(_0x2b7ad9){if(_0x2b7ad9){var _0x5d7401=_0x2b7ad9[_0xd0c2('0x4b')];if(!fs['existsSync'](_0x5d7401)){throw new db[(_0xd0c2('0x51'))][(_0xd0c2('0x52'))](_0xd0c2('0x53'));}if(_0x2b7ad9[_0xd0c2('0x4c')]){return _0x4dd56b[_0xd0c2('0x48')](_0x5d7401,_0x2b7ad9[_0xd0c2('0x4c')]+path[_0xd0c2('0x54')](_0x5d7401),function(){if(_0x44fca0){fs[_0xd0c2('0x55')](_0x5d7401);}});}else{return _0x4dd56b[_0xd0c2('0x48')](_0x5d7401,function(_0x4bd349){if(_0x44fca0){fs['unlink'](_0x5d7401);}});}}})[_0xd0c2('0x3e')](function(_0x12dce6){if(_0x12dce6['message']==='SquareRecording\x20not\x20found'){_0x4dd56b[_0xd0c2('0x16')](0x194)[_0xd0c2('0x26')](_0xd0c2('0x56'));}else{return handleError(_0x4dd56b,null);}});};exports['destroy']=function(_0x5e2942,_0x5b3c97){return db[_0xd0c2('0x3a')][_0xd0c2('0x46')]({'where':{'id':_0x5e2942[_0xd0c2('0x47')]['id']}})[_0xd0c2('0x22')](function(_0x3e34d4){if(_[_0xd0c2('0x57')](_0x3e34d4)){throw new ReferenceError(_0xd0c2('0x58'));}return _0x3e34d4;})['then'](function(_0x509fe3){var _0x361274=_0x509fe3[_0xd0c2('0x4b')];logger['info'](_0xd0c2('0x59'),_0x361274);if(!_[_0xd0c2('0x57')](_0x509fe3['savePath'])&&fs[_0xd0c2('0x4d')](_0x361274)){logger['info'](_0xd0c2('0x5a')+_0x361274+_0xd0c2('0x5b'));fs['unlinkSync'](_0x361274);}_0x361274=_0x361274+_0xd0c2('0x5c');if(!_[_0xd0c2('0x57')](_0x509fe3[_0xd0c2('0x4b')])&&fs[_0xd0c2('0x4d')](_0x361274)){logger['info'](_0xd0c2('0x5a')+_0x361274+_0xd0c2('0x5b'));fs[_0xd0c2('0x5d')](_0x361274);}return _0x509fe3;})[_0xd0c2('0x22')](function(_0x1665ff){if(!_0x1665ff)throw new InternalError();return _0x1665ff['destroy']();})[_0xd0c2('0x22')](function(){_0x5b3c97['status'](0xcc)[_0xd0c2('0x17')]();})[_0xd0c2('0x3e')](handleError(_0x5b3c97,null));}; \ No newline at end of file +var _0x4ad5=['extname','unlink','message','send','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','end','stack','index','map','SquareRecording','rawAttributes','fieldName','type','key','name','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','params','model','length','find','create','body','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download'];(function(_0x275ae6,_0x51d1cb){var _0x4e6bd3=function(_0x507fea){while(--_0x507fea){_0x275ae6['push'](_0x275ae6['shift']());}};_0x4e6bd3(++_0x51d1cb);}(_0x4ad5,0x6c));var _0x54ad=function(_0x5ddc18,_0x4762b8){_0x5ddc18=_0x5ddc18-0x0;var _0x3fbecc=_0x4ad5[_0x5ddc18];return _0x3fbecc;};'use strict';var emlformat=require(_0x54ad('0x0'));var rimraf=require(_0x54ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x54ad('0x2'));var rp=require('request-promise');var moment=require(_0x54ad('0x3'));var BPromise=require(_0x54ad('0x4'));var Mustache=require(_0x54ad('0x5'));var util=require(_0x54ad('0x6'));var path=require('path');var sox=require(_0x54ad('0x7'));var csv=require('to-csv');var ejs=require(_0x54ad('0x8'));var fs=require('fs');var fs_extra=require(_0x54ad('0x9'));var _=require(_0x54ad('0xa'));var squel=require('squel');var crypto=require(_0x54ad('0xb'));var jsforce=require(_0x54ad('0xc'));var deskjs=require(_0x54ad('0xd'));var toCsv=require(_0x54ad('0xe'));var querystring=require(_0x54ad('0xf'));var Papa=require('papaparse');var Redis=require(_0x54ad('0x10'));var authService=require(_0x54ad('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x54ad('0x12'));var hardwareService=require(_0x54ad('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x54ad('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f083e,_0x285851){_0x285851=_0x285851||0xcc;return function(_0x6b12d1){if(_0x6b12d1){return _0x5f083e[_0x54ad('0x15')](_0x285851);}return _0x5f083e[_0x54ad('0x16')](_0x285851)['end']();};}function respondWithResult(_0x59a570,_0xa6f8ab){_0xa6f8ab=_0xa6f8ab||0xc8;return function(_0x5c7123){if(_0x5c7123){return _0x59a570[_0x54ad('0x16')](_0xa6f8ab)[_0x54ad('0x17')](_0x5c7123);}};}function respondWithFilteredResult(_0x32b25e,_0x3f7454){return function(_0x56c1ca){if(_0x56c1ca){var _0x1fe57e=typeof _0x3f7454[_0x54ad('0x18')]==='undefined'&&typeof _0x3f7454[_0x54ad('0x19')]===_0x54ad('0x1a');var _0x519d48=_0x56c1ca['count'];var _0x2eb18c=_0x1fe57e?0x0:_0x3f7454[_0x54ad('0x18')];var _0x6bf863=_0x1fe57e?_0x56c1ca['count']:_0x3f7454[_0x54ad('0x18')]+_0x3f7454['limit'];var _0x1034f7;if(_0x6bf863>=_0x519d48){_0x6bf863=_0x519d48;_0x1034f7=0xc8;}else{_0x1034f7=0xce;}_0x32b25e[_0x54ad('0x16')](_0x1034f7);return _0x32b25e[_0x54ad('0x1b')](_0x54ad('0x1c'),_0x2eb18c+'-'+_0x6bf863+'/'+_0x519d48)['json'](_0x56c1ca);}return null;};}function patchUpdates(_0x3b108e){return function(_0x3d7303){try{jsonpatch[_0x54ad('0x1d')](_0x3d7303,_0x3b108e,!![]);}catch(_0x95dff1){return BPromise[_0x54ad('0x1e')](_0x95dff1);}return _0x3d7303['save']();};}function saveUpdates(_0xa5d4d6,_0x5237ee){return function(_0x10ca36){if(_0x10ca36){return _0x10ca36[_0x54ad('0x1f')](_0xa5d4d6)[_0x54ad('0x20')](function(_0x184677){return _0x184677;});}return null;};}function removeEntity(_0x2f899a,_0x47599e){return function(_0x1d443b){if(_0x1d443b){return _0x1d443b[_0x54ad('0x21')]()[_0x54ad('0x20')](function(){_0x2f899a['status'](0xcc)[_0x54ad('0x22')]();});}};}function handleEntityNotFound(_0x49b7fa,_0x5d746c){return function(_0x1fcbb1){if(!_0x1fcbb1){_0x49b7fa['sendStatus'](0x194);}return _0x1fcbb1;};}function handleError(_0x3e1398,_0x4f15c3){_0x4f15c3=_0x4f15c3||0x1f4;return function(_0x5ae427){logger['error'](_0x5ae427[_0x54ad('0x23')]);if(_0x5ae427['name']){delete _0x5ae427['name'];}_0x3e1398['status'](_0x4f15c3)['send'](_0x5ae427);};}exports[_0x54ad('0x24')]=function(_0x2696e1,_0x231037){var _0x232afe={},_0x5c8eed={},_0x2eff70={'count':0x0,'rows':[]};var _0x311c7e=_[_0x54ad('0x25')](db[_0x54ad('0x26')][_0x54ad('0x27')],function(_0x125b33){return{'name':_0x125b33[_0x54ad('0x28')],'type':_0x125b33[_0x54ad('0x29')][_0x54ad('0x2a')]};});_0x5c8eed['model']=_[_0x54ad('0x25')](_0x311c7e,_0x54ad('0x2b'));_0x5c8eed[_0x54ad('0x2c')]=_[_0x54ad('0x2d')](_0x2696e1[_0x54ad('0x2c')]);_0x5c8eed['filters']=_['intersection'](_0x5c8eed['model'],_0x5c8eed[_0x54ad('0x2c')]);_0x232afe[_0x54ad('0x2e')]=_[_0x54ad('0x2f')](_0x5c8eed['model'],qs[_0x54ad('0x30')](_0x2696e1[_0x54ad('0x2c')][_0x54ad('0x30')]));_0x232afe[_0x54ad('0x2e')]=_0x232afe[_0x54ad('0x2e')]['length']?_0x232afe[_0x54ad('0x2e')]:_0x5c8eed['model'];if(!_0x2696e1['query'][_0x54ad('0x31')](_0x54ad('0x32'))){_0x232afe[_0x54ad('0x19')]=qs[_0x54ad('0x19')](_0x2696e1[_0x54ad('0x2c')]['limit']);_0x232afe[_0x54ad('0x18')]=qs[_0x54ad('0x18')](_0x2696e1[_0x54ad('0x2c')]['offset']);}_0x232afe[_0x54ad('0x33')]=qs['sort'](_0x2696e1[_0x54ad('0x2c')][_0x54ad('0x34')]);_0x232afe[_0x54ad('0x35')]=qs['filters'](_[_0x54ad('0x36')](_0x2696e1[_0x54ad('0x2c')],_0x5c8eed[_0x54ad('0x37')]),_0x311c7e);if(_0x2696e1['query']['filter']){_0x232afe[_0x54ad('0x35')]=_[_0x54ad('0x38')](_0x232afe[_0x54ad('0x35')],{'$or':_[_0x54ad('0x25')](_0x311c7e,function(_0x3e2036){if(_0x3e2036[_0x54ad('0x29')]!==_0x54ad('0x39')){var _0x983fc5={};_0x983fc5[_0x3e2036[_0x54ad('0x2b')]]={'$like':'%'+_0x2696e1['query'][_0x54ad('0x3a')]+'%'};return _0x983fc5;}})});}_0x232afe=_[_0x54ad('0x38')]({},_0x232afe,_0x2696e1[_0x54ad('0x3b')]);var _0x4bda4f={'where':_0x232afe[_0x54ad('0x35')]};return db[_0x54ad('0x26')][_0x54ad('0x3c')](_0x4bda4f)['then'](function(_0x47b0f1){_0x2eff70['count']=_0x47b0f1;if(_0x2696e1['query'][_0x54ad('0x3d')]){_0x232afe[_0x54ad('0x3e')]=[{'all':!![]}];}return db[_0x54ad('0x26')][_0x54ad('0x3f')](_0x232afe);})[_0x54ad('0x20')](function(_0x32c289){_0x2eff70[_0x54ad('0x40')]=_0x32c289;return _0x2eff70;})[_0x54ad('0x20')](respondWithFilteredResult(_0x231037,_0x232afe))[_0x54ad('0x41')](handleError(_0x231037,null));};exports['show']=function(_0x2800dc,_0x5509d4){var _0x12ac86={'raw':!![],'where':{'id':_0x2800dc[_0x54ad('0x42')]['id']}},_0x20259b={};_0x20259b[_0x54ad('0x43')]=_[_0x54ad('0x2d')](db['SquareRecording'][_0x54ad('0x27')]);_0x20259b[_0x54ad('0x2c')]=_['keys'](_0x2800dc[_0x54ad('0x2c')]);_0x20259b[_0x54ad('0x37')]=_[_0x54ad('0x2f')](_0x20259b[_0x54ad('0x43')],_0x20259b['query']);_0x12ac86[_0x54ad('0x2e')]=_[_0x54ad('0x2f')](_0x20259b[_0x54ad('0x43')],qs[_0x54ad('0x30')](_0x2800dc[_0x54ad('0x2c')][_0x54ad('0x30')]));_0x12ac86[_0x54ad('0x2e')]=_0x12ac86[_0x54ad('0x2e')][_0x54ad('0x44')]?_0x12ac86['attributes']:_0x20259b[_0x54ad('0x43')];if(_0x2800dc[_0x54ad('0x2c')][_0x54ad('0x3d')]){_0x12ac86[_0x54ad('0x3e')]=[{'all':!![]}];}_0x12ac86=_['merge']({},_0x12ac86,_0x2800dc[_0x54ad('0x3b')]);return db[_0x54ad('0x26')][_0x54ad('0x45')](_0x12ac86)['then'](handleEntityNotFound(_0x5509d4,null))[_0x54ad('0x20')](respondWithResult(_0x5509d4,null))[_0x54ad('0x41')](handleError(_0x5509d4,null));};exports[_0x54ad('0x46')]=function(_0x1603b8,_0x2fe0c4){return db[_0x54ad('0x26')]['create'](_0x1603b8[_0x54ad('0x47')],{})[_0x54ad('0x20')](respondWithResult(_0x2fe0c4,0xc9))['catch'](handleError(_0x2fe0c4,null));};exports['update']=function(_0x5d6096,_0xfe6a97){if(_0x5d6096[_0x54ad('0x47')]['id']){delete _0x5d6096[_0x54ad('0x47')]['id'];}return db['SquareRecording'][_0x54ad('0x45')]({'where':{'id':_0x5d6096['params']['id']}})[_0x54ad('0x20')](handleEntityNotFound(_0xfe6a97,null))['then'](saveUpdates(_0x5d6096[_0x54ad('0x47')],null))[_0x54ad('0x20')](respondWithResult(_0xfe6a97,null))[_0x54ad('0x41')](handleError(_0xfe6a97,null));};exports['download']=function(_0x3cc964,_0x1208b0,_0x347054){var _0x3e37af=require(_0x54ad('0x48'));var _0x35cf57=![];var _0x12a953={};if(_0x3cc964['query'][_0x54ad('0x29')]&&_0x3cc964[_0x54ad('0x2c')][_0x54ad('0x29')]===_0x54ad('0x49')){_0x12a953[_0x54ad('0x49')]=_0x3cc964[_0x54ad('0x42')]['id'];}else{_0x12a953['id']=_0x3cc964[_0x54ad('0x42')]['id'];}return db[_0x54ad('0x26')][_0x54ad('0x45')]({'where':_0x12a953,'attributes':['id',_0x54ad('0x4a'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x1208b0,null))[_0x54ad('0x20')](function(_0x4fd535){if(_0x4fd535){var _0x1d74a5=_0x4fd535[_0x54ad('0x4a')];var _0x2224ec=util[_0x54ad('0x4b')](_0x54ad('0x4c'),_0x1d74a5);if(fs[_0x54ad('0x4d')](_0x2224ec)){_0x35cf57=!![];return _0x3e37af['decryptFile'](_0x2224ec,_0x1d74a5,config[_0x54ad('0x4e')]['recording'])[_0x54ad('0x20')](function(){return _0x4fd535;});}return _0x4fd535;}})[_0x54ad('0x20')](function(_0x50636e){if(_0x50636e){var _0x1c4972=_0x50636e[_0x54ad('0x4a')];if(!fs[_0x54ad('0x4d')](_0x1c4972)){throw new db[(_0x54ad('0x4f'))][(_0x54ad('0x50'))](_0x54ad('0x51'));}if(_0x50636e[_0x54ad('0x52')]){return _0x1208b0[_0x54ad('0x53')](_0x1c4972,_0x50636e[_0x54ad('0x52')]+path[_0x54ad('0x54')](_0x1c4972),function(){if(_0x35cf57){fs['unlink'](_0x1c4972);}});}else{return _0x1208b0[_0x54ad('0x53')](_0x1c4972,function(_0x27667b){if(_0x35cf57){fs[_0x54ad('0x55')](_0x1c4972);}});}}})['catch'](function(_0x43c5ae){if(_0x43c5ae[_0x54ad('0x56')]===_0x54ad('0x51')){_0x1208b0[_0x54ad('0x16')](0x194)[_0x54ad('0x57')]('Not\x20found');}else{return handleError(_0x1208b0,null);}});};exports['destroy']=function(_0x78234c,_0x8c9ecb){return db[_0x54ad('0x26')][_0x54ad('0x45')]({'where':{'id':_0x78234c[_0x54ad('0x42')]['id']}})['then'](function(_0x48958b){if(_[_0x54ad('0x58')](_0x48958b)){throw new ReferenceError(_0x54ad('0x59'));}return _0x48958b;})[_0x54ad('0x20')](function(_0x348b8b){var _0x48ec9a=_0x348b8b['savePath'];logger[_0x54ad('0x5a')](_0x54ad('0x5b'),_0x48ec9a);if(!_['isNil'](_0x348b8b[_0x54ad('0x4a')])&&fs['existsSync'](_0x48ec9a)){logger[_0x54ad('0x5a')]('File:\x20\x22'+_0x48ec9a+_0x54ad('0x5c'));fs[_0x54ad('0x5d')](_0x48ec9a);}_0x48ec9a=_0x48ec9a+_0x54ad('0x5e');if(!_[_0x54ad('0x58')](_0x348b8b['savePath'])&&fs['existsSync'](_0x48ec9a)){logger['info'](_0x54ad('0x5f')+_0x48ec9a+_0x54ad('0x5c'));fs[_0x54ad('0x5d')](_0x48ec9a);}return _0x348b8b;})['then'](function(_0x5e8033){if(!_0x5e8033)throw new InternalError();return _0x5e8033[_0x54ad('0x21')]();})['then'](function(){_0x8c9ecb[_0x54ad('0x16')](0xcc)[_0x54ad('0x22')]();})[_0x54ad('0x41')](handleError(_0x8c9ecb,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3f623e7..6b2031d 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 _0x4bd3=['exports','define','SquareRecording','lodash','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x3ea1cd,_0xa47190){var _0x41bd69=function(_0x143db5){while(--_0x143db5){_0x3ea1cd['push'](_0x3ea1cd['shift']());}};_0x41bd69(++_0xa47190);}(_0x4bd3,0x174));var _0x34bd=function(_0x2b63ed,_0x15c4f1){_0x2b63ed=_0x2b63ed-0x0;var _0x47acb2=_0x4bd3[_0x2b63ed];return _0x47acb2;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./squareRecording.attributes');module[_0x34bd('0x6')]=function(_0x2a15a2,_0x5c2a7a){return _0x2a15a2[_0x34bd('0x7')](_0x34bd('0x8'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8969=['bluebird','request-promise','path','rimraf','./squareRecording.attributes','define','SquareRecording','lodash','../../config/logger','api','moment'];(function(_0x3f95c4,_0xfe7a1){var _0x3425d7=function(_0x1d2703){while(--_0x1d2703){_0x3f95c4['push'](_0x3f95c4['shift']());}};_0x3425d7(++_0xfe7a1);}(_0x8969,0x130));var _0x9896=function(_0x1b2f16,_0x2ff9b1){_0x1b2f16=_0x1b2f16-0x0;var _0x3c8968=_0x8969[_0x1b2f16];return _0x3c8968;};'use strict';var _=require(_0x9896('0x0'));var util=require('util');var logger=require(_0x9896('0x1'))(_0x9896('0x2'));var moment=require(_0x9896('0x3'));var BPromise=require(_0x9896('0x4'));var rp=require(_0x9896('0x5'));var fs=require('fs');var path=require(_0x9896('0x6'));var rimraf=require(_0x9896('0x7'));var config=require('../../config/environment');var attributes=require(_0x9896('0x8'));module['exports']=function(_0x4d1a83,_0xd26a8b){return _0x4d1a83[_0x9896('0x9')](_0x9896('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 145392e..e4d70e8 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 _0xb2b6=['raw','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x33469,_0xddbd64){var _0x2a8dbe=function(_0x4dfef1){while(--_0x4dfef1){_0x33469['push'](_0x33469['shift']());}};_0x2a8dbe(++_0xddbd64);}(_0xb2b6,0xeb));var _0x6b2b=function(_0xfe1621,_0x517769){_0xfe1621=_0xfe1621-0x0;var _0x3dbe30=_0xb2b6[_0xfe1621];return _0x3dbe30;};'use strict';var _=require('lodash');var util=require(_0x6b2b('0x0'));var moment=require(_0x6b2b('0x1'));var BPromise=require(_0x6b2b('0x2'));var rs=require(_0x6b2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b2b('0x4'));var logger=require(_0x6b2b('0x5'))('rpc');var config=require(_0x6b2b('0x6'));var jayson=require(_0x6b2b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26a1b0,_0x3cf394,_0x339683){return new BPromise(function(_0x44f21c,_0x3f8e36){return client[_0x6b2b('0x8')](_0x26a1b0,_0x339683)[_0x6b2b('0x9')](function(_0x11aa3b){logger[_0x6b2b('0xa')]('SquareRecording,\x20%s,\x20%s',_0x3cf394,'request\x20sent');logger[_0x6b2b('0xb')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3cf394,_0x6b2b('0xc'),JSON[_0x6b2b('0xd')](_0x11aa3b));if(_0x11aa3b[_0x6b2b('0xe')]){if(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0xf')]===0x1f4){logger[_0x6b2b('0xe')](_0x6b2b('0x10'),_0x3cf394,_0x11aa3b[_0x6b2b('0xe')]['message']);return _0x3f8e36(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0x11')]);}logger['error'](_0x6b2b('0x10'),_0x3cf394,_0x11aa3b['error'][_0x6b2b('0x11')]);return _0x44f21c(_0x11aa3b[_0x6b2b('0xe')][_0x6b2b('0x11')]);}else{logger[_0x6b2b('0xa')](_0x6b2b('0x10'),_0x3cf394,_0x6b2b('0xc'));_0x44f21c(_0x11aa3b[_0x6b2b('0x12')][_0x6b2b('0x11')]);}})[_0x6b2b('0x13')](function(_0x58ef1d){logger[_0x6b2b('0xe')](_0x6b2b('0x10'),_0x3cf394,_0x58ef1d);_0x3f8e36(_0x58ef1d);});});}exports[_0x6b2b('0x14')]=function(_0x78827c){var _0x4fc33c=this;return new Promise(function(_0x5f4606,_0x6c5bb7){return db[_0x6b2b('0x15')][_0x6b2b('0x16')](_0x78827c[_0x6b2b('0x17')],{'raw':_0x78827c['options']?_0x78827c[_0x6b2b('0x18')][_0x6b2b('0x19')]===undefined?!![]:![]:!![]})[_0x6b2b('0x9')](function(_0x384f6d){logger[_0x6b2b('0xa')](_0x6b2b('0x14'),_0x78827c);logger['debug'](_0x6b2b('0x14'),_0x78827c,JSON['stringify'](_0x384f6d));_0x5f4606(_0x384f6d);})[_0x6b2b('0x13')](function(_0x28a9a6){logger[_0x6b2b('0xe')]('CreateSquareRecording',_0x28a9a6[_0x6b2b('0x11')],_0x78827c);_0x6c5bb7(_0x4fc33c['error'](0x1f4,_0x28a9a6[_0x6b2b('0x11')]));});});}; \ No newline at end of file +var _0xc6a0=['result','catch','CreateSquareRecording','SquareRecording','create','options','then','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc6a0,0x70));var _0x0c6a=function(_0x37f5fa,_0x234aea){_0x37f5fa=_0x37f5fa-0x0;var _0x40441d=_0xc6a0[_0x37f5fa];return _0x40441d;};'use strict';var _=require(_0x0c6a('0x0'));var util=require(_0x0c6a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0c6a('0x2'));var fs=require('fs');var Redis=require(_0x0c6a('0x3'));var db=require(_0x0c6a('0x4'))['db'];var utils=require(_0x0c6a('0x5'));var logger=require(_0x0c6a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0c6a('0x7')][_0x0c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c5c9a,_0x278872,_0x522860){return new BPromise(function(_0x24c6a0,_0x4a8e33){return client[_0x0c6a('0x9')](_0x5c5c9a,_0x522860)['then'](function(_0x33a382){logger[_0x0c6a('0xa')]('SquareRecording,\x20%s,\x20%s',_0x278872,_0x0c6a('0xb'));logger['debug'](_0x0c6a('0xc'),_0x278872,_0x0c6a('0xb'),JSON[_0x0c6a('0xd')](_0x33a382));if(_0x33a382['error']){if(_0x33a382[_0x0c6a('0xe')][_0x0c6a('0xf')]===0x1f4){logger[_0x0c6a('0xe')](_0x0c6a('0x10'),_0x278872,_0x33a382[_0x0c6a('0xe')][_0x0c6a('0x11')]);return _0x4a8e33(_0x33a382[_0x0c6a('0xe')][_0x0c6a('0x11')]);}logger[_0x0c6a('0xe')]('SquareRecording,\x20%s,\x20%s',_0x278872,_0x33a382['error'][_0x0c6a('0x11')]);return _0x24c6a0(_0x33a382['error'][_0x0c6a('0x11')]);}else{logger['info'](_0x0c6a('0x10'),_0x278872,'request\x20sent');_0x24c6a0(_0x33a382[_0x0c6a('0x12')][_0x0c6a('0x11')]);}})[_0x0c6a('0x13')](function(_0x437450){logger[_0x0c6a('0xe')](_0x0c6a('0x10'),_0x278872,_0x437450);_0x4a8e33(_0x437450);});});}exports[_0x0c6a('0x14')]=function(_0x78fd26){var _0x2a84b6=this;return new Promise(function(_0x375241,_0x2bda58){return db[_0x0c6a('0x15')][_0x0c6a('0x16')](_0x78fd26['body'],{'raw':_0x78fd26['options']?_0x78fd26[_0x0c6a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x0c6a('0x18')](function(_0x2e3a55){logger[_0x0c6a('0xa')](_0x0c6a('0x14'),_0x78fd26);logger[_0x0c6a('0x19')](_0x0c6a('0x14'),_0x78fd26,JSON['stringify'](_0x2e3a55));_0x375241(_0x2e3a55);})['catch'](function(_0x5898e8){logger[_0x0c6a('0xe')]('CreateSquareRecording',_0x5898e8[_0x0c6a('0x11')],_0x78fd26);_0x2bda58(_0x2a84b6[_0x0c6a('0xe')](0x1f4,_0x5898e8[_0x0c6a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 609714b..9cfebdb 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5f5497,_0x50803a){var _0x10e943=function(_0x2f5faa){while(--_0x2f5faa){_0x5f5497['push'](_0x5f5497['shift']());}};_0x10e943(++_0x50803a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index d99f08d..e42ec0d 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 _0xe32a=['BOOLEAN','exports','STRING','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe32a,0x125));var _0xae32=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe32a[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0xae32('0x0')]={'network':{'type':Sequelize[_0xae32('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xae32('0x1')]},'channel':{'type':Sequelize[_0xae32('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xae32('0x1')]},'uniqueid':{'type':Sequelize[_0xae32('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xae32('0x1')]},'calleridname':{'type':Sequelize[_0xae32('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xae32('0x1')]},'callington':{'type':Sequelize[_0xae32('0x1')]},'callingtns':{'type':Sequelize[_0xae32('0x1')]},'dnid':{'type':Sequelize[_0xae32('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xae32('0x1')]},'accountcode':{'type':Sequelize[_0xae32('0x1')]},'threadid':{'type':Sequelize[_0xae32('0x1')]},'project_name':{'type':Sequelize[_0xae32('0x1')]},'joinAt':{'type':Sequelize[_0xae32('0x2')]},'leaveAt':{'type':Sequelize[_0xae32('0x2')]},'bot':{'type':Sequelize[_0xae32('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xde05=['DATE','sequelize','exports','STRING'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xde05,0xe5));var _0x5de0=function(_0x48457e,_0x5cdad4){_0x48457e=_0x48457e-0x0;var _0x3edbb8=_0xde05[_0x48457e];return _0x3edbb8;};'use strict';var Sequelize=require(_0x5de0('0x0'));module[_0x5de0('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x5de0('0x2')]},'request':{'type':Sequelize[_0x5de0('0x2')]},'channel':{'type':Sequelize[_0x5de0('0x2')]},'language':{'type':Sequelize[_0x5de0('0x2')]},'type':{'type':Sequelize[_0x5de0('0x2')]},'uniqueid':{'type':Sequelize[_0x5de0('0x2')]},'version':{'type':Sequelize[_0x5de0('0x2')]},'callerid':{'type':Sequelize[_0x5de0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x5de0('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x5de0('0x2')]},'rdnis':{'type':Sequelize[_0x5de0('0x2')]},'context':{'type':Sequelize[_0x5de0('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5de0('0x2')]},'enhanced':{'type':Sequelize[_0x5de0('0x2')]},'accountcode':{'type':Sequelize[_0x5de0('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5de0('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 542841a..6bd76ec 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 _0xaa61=['model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SquareReport','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key'];(function(_0x1ba9b6,_0x24db56){var _0x44fbd2=function(_0x37f5a0){while(--_0x37f5a0){_0x1ba9b6['push'](_0x1ba9b6['shift']());}};_0x44fbd2(++_0x24db56);}(_0xaa61,0x106));var _0x1aa6=function(_0x2674bb,_0xba2d50){_0x2674bb=_0x2674bb-0x0;var _0x458718=_0xaa61[_0x2674bb];return _0x458718;};'use strict';var emlformat=require(_0x1aa6('0x0'));var rimraf=require(_0x1aa6('0x1'));var zipdir=require(_0x1aa6('0x2'));var jsonpatch=require(_0x1aa6('0x3'));var rp=require('request-promise');var moment=require(_0x1aa6('0x4'));var BPromise=require(_0x1aa6('0x5'));var Mustache=require(_0x1aa6('0x6'));var util=require(_0x1aa6('0x7'));var path=require('path');var sox=require(_0x1aa6('0x8'));var csv=require(_0x1aa6('0x9'));var ejs=require(_0x1aa6('0xa'));var fs=require('fs');var fs_extra=require(_0x1aa6('0xb'));var _=require(_0x1aa6('0xc'));var squel=require(_0x1aa6('0xd'));var crypto=require(_0x1aa6('0xe'));var jsforce=require(_0x1aa6('0xf'));var deskjs=require(_0x1aa6('0x10'));var toCsv=require(_0x1aa6('0x9'));var querystring=require(_0x1aa6('0x11'));var Papa=require(_0x1aa6('0x12'));var Redis=require(_0x1aa6('0x13'));var authService=require(_0x1aa6('0x14'));var qs=require(_0x1aa6('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1aa6('0x16'));var logger=require(_0x1aa6('0x17'))(_0x1aa6('0x18'));var utils=require(_0x1aa6('0x19'));var config=require(_0x1aa6('0x1a'));var licenseUtil=require(_0x1aa6('0x1b'));var db=require(_0x1aa6('0x1c'))['db'];function respondWithStatusCode(_0x243613,_0x8b7627){_0x8b7627=_0x8b7627||0xcc;return function(_0x418411){if(_0x418411){return _0x243613['sendStatus'](_0x8b7627);}return _0x243613['status'](_0x8b7627)[_0x1aa6('0x1d')]();};}function respondWithResult(_0x2d2880,_0x520a66){_0x520a66=_0x520a66||0xc8;return function(_0x9698ed){if(_0x9698ed){return _0x2d2880[_0x1aa6('0x1e')](_0x520a66)[_0x1aa6('0x1f')](_0x9698ed);}};}function respondWithFilteredResult(_0x5b917c,_0x856e09){return function(_0x6d7868){if(_0x6d7868){var _0x4ab997=typeof _0x856e09[_0x1aa6('0x20')]==='undefined'&&typeof _0x856e09[_0x1aa6('0x21')]===_0x1aa6('0x22');var _0x467c34=_0x6d7868[_0x1aa6('0x23')];var _0x25669a=_0x4ab997?0x0:_0x856e09[_0x1aa6('0x20')];var _0x3ec5ed=_0x4ab997?_0x6d7868[_0x1aa6('0x23')]:_0x856e09[_0x1aa6('0x20')]+_0x856e09[_0x1aa6('0x21')];var _0x3d8e42;if(_0x3ec5ed>=_0x467c34){_0x3ec5ed=_0x467c34;_0x3d8e42=0xc8;}else{_0x3d8e42=0xce;}_0x5b917c[_0x1aa6('0x1e')](_0x3d8e42);return _0x5b917c[_0x1aa6('0x24')](_0x1aa6('0x25'),_0x25669a+'-'+_0x3ec5ed+'/'+_0x467c34)[_0x1aa6('0x1f')](_0x6d7868);}return null;};}function patchUpdates(_0x455481){return function(_0x13ed46){try{jsonpatch[_0x1aa6('0x26')](_0x13ed46,_0x455481,!![]);}catch(_0x5ab23c){return BPromise[_0x1aa6('0x27')](_0x5ab23c);}return _0x13ed46['save']();};}function saveUpdates(_0x53f978,_0x424cb7){return function(_0x5aefa4){if(_0x5aefa4){return _0x5aefa4['update'](_0x53f978)['then'](function(_0x32555d){return _0x32555d;});}return null;};}function removeEntity(_0x4c4e14,_0x487ba7){return function(_0x1437f3){if(_0x1437f3){return _0x1437f3[_0x1aa6('0x28')]()[_0x1aa6('0x29')](function(){_0x4c4e14['status'](0xcc)[_0x1aa6('0x1d')]();});}};}function handleEntityNotFound(_0x44e0a9,_0x107536){return function(_0x4baeaf){if(!_0x4baeaf){_0x44e0a9['sendStatus'](0x194);}return _0x4baeaf;};}function handleError(_0x390c31,_0x3b6fd8){_0x3b6fd8=_0x3b6fd8||0x1f4;return function(_0x30812c){logger['error'](_0x30812c[_0x1aa6('0x2a')]);if(_0x30812c[_0x1aa6('0x2b')]){delete _0x30812c[_0x1aa6('0x2b')];}_0x390c31['status'](_0x3b6fd8)[_0x1aa6('0x2c')](_0x30812c);};}exports[_0x1aa6('0x2d')]=function(_0x934c1e,_0x26c54f){var _0x676ae0={},_0x3267e6={},_0x39efc3={'count':0x0,'rows':[]};var _0x5ad98e=_['map'](db['SquareReport'][_0x1aa6('0x2e')],function(_0x3aebec){return{'name':_0x3aebec[_0x1aa6('0x2f')],'type':_0x3aebec[_0x1aa6('0x30')][_0x1aa6('0x31')]};});_0x3267e6[_0x1aa6('0x32')]=_[_0x1aa6('0x33')](_0x5ad98e,_0x1aa6('0x2b'));_0x3267e6['query']=_[_0x1aa6('0x34')](_0x934c1e[_0x1aa6('0x35')]);_0x3267e6[_0x1aa6('0x36')]=_[_0x1aa6('0x37')](_0x3267e6['model'],_0x3267e6[_0x1aa6('0x35')]);_0x676ae0[_0x1aa6('0x38')]=_['intersection'](_0x3267e6[_0x1aa6('0x32')],qs[_0x1aa6('0x39')](_0x934c1e[_0x1aa6('0x35')]['fields']));_0x676ae0[_0x1aa6('0x38')]=_0x676ae0[_0x1aa6('0x38')]['length']?_0x676ae0[_0x1aa6('0x38')]:_0x3267e6[_0x1aa6('0x32')];if(!_0x934c1e['query'][_0x1aa6('0x3a')](_0x1aa6('0x3b'))){_0x676ae0[_0x1aa6('0x21')]=qs[_0x1aa6('0x21')](_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x21')]);_0x676ae0[_0x1aa6('0x20')]=qs['offset'](_0x934c1e[_0x1aa6('0x35')]['offset']);}_0x676ae0[_0x1aa6('0x3c')]=qs[_0x1aa6('0x3d')](_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x3d')]);_0x676ae0[_0x1aa6('0x3e')]=qs[_0x1aa6('0x36')](_[_0x1aa6('0x3f')](_0x934c1e['query'],_0x3267e6['filters']),_0x5ad98e);if(_0x934c1e['query'][_0x1aa6('0x40')]){_0x676ae0[_0x1aa6('0x3e')]=_[_0x1aa6('0x41')](_0x676ae0[_0x1aa6('0x3e')],{'$or':_[_0x1aa6('0x33')](_0x5ad98e,function(_0x5c7b87){if(_0x5c7b87[_0x1aa6('0x30')]!==_0x1aa6('0x42')){var _0x328641={};_0x328641[_0x5c7b87['name']]={'$like':'%'+_0x934c1e['query'][_0x1aa6('0x40')]+'%'};return _0x328641;}})});}_0x676ae0=_['merge']({},_0x676ae0,_0x934c1e['options']);var _0x2957ad={'where':_0x676ae0[_0x1aa6('0x3e')]};return db[_0x1aa6('0x43')][_0x1aa6('0x23')](_0x2957ad)[_0x1aa6('0x29')](function(_0x31f50f){_0x39efc3[_0x1aa6('0x23')]=_0x31f50f;if(_0x934c1e[_0x1aa6('0x35')][_0x1aa6('0x44')]){_0x676ae0[_0x1aa6('0x45')]=[{'all':!![]}];}return db[_0x1aa6('0x43')][_0x1aa6('0x46')](_0x676ae0);})[_0x1aa6('0x29')](function(_0x4d47a7){_0x39efc3['rows']=_0x4d47a7;return _0x39efc3;})['then'](respondWithFilteredResult(_0x26c54f,_0x676ae0))[_0x1aa6('0x47')](handleError(_0x26c54f,null));};exports[_0x1aa6('0x48')]=function(_0x14ddb5,_0xf3072d){var _0x467a8c={'raw':!![],'where':{'id':_0x14ddb5[_0x1aa6('0x49')]['id']}},_0x15d208={};_0x15d208[_0x1aa6('0x32')]=_[_0x1aa6('0x34')](db['SquareReport'][_0x1aa6('0x2e')]);_0x15d208[_0x1aa6('0x35')]=_[_0x1aa6('0x34')](_0x14ddb5[_0x1aa6('0x35')]);_0x15d208['filters']=_[_0x1aa6('0x37')](_0x15d208[_0x1aa6('0x32')],_0x15d208[_0x1aa6('0x35')]);_0x467a8c[_0x1aa6('0x38')]=_[_0x1aa6('0x37')](_0x15d208['model'],qs[_0x1aa6('0x39')](_0x14ddb5[_0x1aa6('0x35')]['fields']));_0x467a8c[_0x1aa6('0x38')]=_0x467a8c['attributes']['length']?_0x467a8c[_0x1aa6('0x38')]:_0x15d208['model'];if(_0x14ddb5['query'][_0x1aa6('0x44')]){_0x467a8c[_0x1aa6('0x45')]=[{'all':!![]}];}_0x467a8c=_[_0x1aa6('0x41')]({},_0x467a8c,_0x14ddb5['options']);return db[_0x1aa6('0x43')]['find'](_0x467a8c)[_0x1aa6('0x29')](handleEntityNotFound(_0xf3072d,null))[_0x1aa6('0x29')](respondWithResult(_0xf3072d,null))['catch'](handleError(_0xf3072d,null));};exports[_0x1aa6('0x4a')]=function(_0x2d2869,_0x282bf0){return db[_0x1aa6('0x43')][_0x1aa6('0x4a')](_0x2d2869[_0x1aa6('0x4b')],{})[_0x1aa6('0x29')](respondWithResult(_0x282bf0,0xc9))['catch'](handleError(_0x282bf0,null));};exports['update']=function(_0x2d1e20,_0x59ad75){if(_0x2d1e20[_0x1aa6('0x4b')]['id']){delete _0x2d1e20[_0x1aa6('0x4b')]['id'];}return db['SquareReport'][_0x1aa6('0x4c')]({'where':{'id':_0x2d1e20[_0x1aa6('0x49')]['id']}})[_0x1aa6('0x29')](handleEntityNotFound(_0x59ad75,null))[_0x1aa6('0x29')](saveUpdates(_0x2d1e20[_0x1aa6('0x4b')],null))['then'](respondWithResult(_0x59ad75,null))[_0x1aa6('0x47')](handleError(_0x59ad75,null));};exports[_0x1aa6('0x28')]=function(_0xd44fa7,_0x27d26e){return db[_0x1aa6('0x43')][_0x1aa6('0x4c')]({'where':{'id':_0xd44fa7[_0x1aa6('0x49')]['id']}})[_0x1aa6('0x29')](handleEntityNotFound(_0x27d26e,null))[_0x1aa6('0x29')](removeEntity(_0x27d26e,null))[_0x1aa6('0x47')](handleError(_0x27d26e,null));};exports[_0x1aa6('0x4d')]=function(_0x4e83eb,_0x585ffd){return db['SquareReport']['describe']()[_0x1aa6('0x29')](respondWithResult(_0x585ffd,null))[_0x1aa6('0x47')](handleError(_0x585ffd,null));}; \ No newline at end of file +var _0xca4c=['save','update','then','destroy','end','error','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','reject'];(function(_0x14915a,_0x222f6b){var _0x2f683c=function(_0x28e694){while(--_0x28e694){_0x14915a['push'](_0x14915a['shift']());}};_0x2f683c(++_0x222f6b);}(_0xca4c,0xf7));var _0xcca4=function(_0x2aac7a,_0x14ec04){_0x2aac7a=_0x2aac7a-0x0;var _0x491766=_0xca4c[_0x2aac7a];return _0x491766;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcca4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcca4('0x1'));var moment=require(_0xcca4('0x2'));var BPromise=require(_0xcca4('0x3'));var Mustache=require(_0xcca4('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcca4('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcca4('0x6'));var squel=require(_0xcca4('0x7'));var crypto=require(_0xcca4('0x8'));var jsforce=require(_0xcca4('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcca4('0xa'));var Redis=require(_0xcca4('0xb'));var authService=require(_0xcca4('0xc'));var qs=require(_0xcca4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcca4('0xe'));var logger=require(_0xcca4('0xf'))(_0xcca4('0x10'));var utils=require(_0xcca4('0x11'));var config=require(_0xcca4('0x12'));var licenseUtil=require(_0xcca4('0x13'));var db=require(_0xcca4('0x14'))['db'];function respondWithStatusCode(_0x3ee954,_0x5f3d0f){_0x5f3d0f=_0x5f3d0f||0xcc;return function(_0x25744a){if(_0x25744a){return _0x3ee954[_0xcca4('0x15')](_0x5f3d0f);}return _0x3ee954['status'](_0x5f3d0f)['end']();};}function respondWithResult(_0x4edb70,_0x3bc1b9){_0x3bc1b9=_0x3bc1b9||0xc8;return function(_0x72b4b9){if(_0x72b4b9){return _0x4edb70[_0xcca4('0x16')](_0x3bc1b9)[_0xcca4('0x17')](_0x72b4b9);}};}function respondWithFilteredResult(_0x43737c,_0x482148){return function(_0x34b17b){if(_0x34b17b){var _0x5a0dfa=typeof _0x482148[_0xcca4('0x18')]==='undefined'&&typeof _0x482148[_0xcca4('0x19')]===_0xcca4('0x1a');var _0x477335=_0x34b17b[_0xcca4('0x1b')];var _0x4bae2f=_0x5a0dfa?0x0:_0x482148['offset'];var _0x255103=_0x5a0dfa?_0x34b17b[_0xcca4('0x1b')]:_0x482148['offset']+_0x482148[_0xcca4('0x19')];var _0x2f39f2;if(_0x255103>=_0x477335){_0x255103=_0x477335;_0x2f39f2=0xc8;}else{_0x2f39f2=0xce;}_0x43737c[_0xcca4('0x16')](_0x2f39f2);return _0x43737c['set']('Content-Range',_0x4bae2f+'-'+_0x255103+'/'+_0x477335)[_0xcca4('0x17')](_0x34b17b);}return null;};}function patchUpdates(_0x2e4a99){return function(_0x5b20c9){try{jsonpatch['apply'](_0x5b20c9,_0x2e4a99,!![]);}catch(_0x40deca){return BPromise[_0xcca4('0x1c')](_0x40deca);}return _0x5b20c9[_0xcca4('0x1d')]();};}function saveUpdates(_0x442c9e,_0x59b0e6){return function(_0x37905e){if(_0x37905e){return _0x37905e[_0xcca4('0x1e')](_0x442c9e)[_0xcca4('0x1f')](function(_0x3d0b4a){return _0x3d0b4a;});}return null;};}function removeEntity(_0x4eae83,_0x59351e){return function(_0xa76162){if(_0xa76162){return _0xa76162[_0xcca4('0x20')]()[_0xcca4('0x1f')](function(){_0x4eae83[_0xcca4('0x16')](0xcc)[_0xcca4('0x21')]();});}};}function handleEntityNotFound(_0x282ec5,_0x3943e9){return function(_0x879048){if(!_0x879048){_0x282ec5[_0xcca4('0x15')](0x194);}return _0x879048;};}function handleError(_0x58262f,_0x30743b){_0x30743b=_0x30743b||0x1f4;return function(_0x151130){logger[_0xcca4('0x22')](_0x151130[_0xcca4('0x23')]);if(_0x151130[_0xcca4('0x24')]){delete _0x151130[_0xcca4('0x24')];}_0x58262f['status'](_0x30743b)[_0xcca4('0x25')](_0x151130);};}exports[_0xcca4('0x26')]=function(_0x3852d7,_0x303ed8){var _0x3846a8={},_0x22456f={},_0x2569dd={'count':0x0,'rows':[]};var _0x559423=_[_0xcca4('0x27')](db[_0xcca4('0x28')]['rawAttributes'],function(_0x47e7dd){return{'name':_0x47e7dd[_0xcca4('0x29')],'type':_0x47e7dd[_0xcca4('0x2a')][_0xcca4('0x2b')]};});_0x22456f[_0xcca4('0x2c')]=_['map'](_0x559423,_0xcca4('0x24'));_0x22456f[_0xcca4('0x2d')]=_[_0xcca4('0x2e')](_0x3852d7['query']);_0x22456f[_0xcca4('0x2f')]=_[_0xcca4('0x30')](_0x22456f[_0xcca4('0x2c')],_0x22456f[_0xcca4('0x2d')]);_0x3846a8[_0xcca4('0x31')]=_[_0xcca4('0x30')](_0x22456f[_0xcca4('0x2c')],qs[_0xcca4('0x32')](_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x32')]));_0x3846a8['attributes']=_0x3846a8[_0xcca4('0x31')][_0xcca4('0x33')]?_0x3846a8[_0xcca4('0x31')]:_0x22456f['model'];if(!_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x34')]('nolimit')){_0x3846a8[_0xcca4('0x19')]=qs[_0xcca4('0x19')](_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x19')]);_0x3846a8[_0xcca4('0x18')]=qs[_0xcca4('0x18')](_0x3852d7['query'][_0xcca4('0x18')]);}_0x3846a8['order']=qs[_0xcca4('0x35')](_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x35')]);_0x3846a8[_0xcca4('0x36')]=qs[_0xcca4('0x2f')](_['pick'](_0x3852d7[_0xcca4('0x2d')],_0x22456f['filters']),_0x559423);if(_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x37')]){_0x3846a8[_0xcca4('0x36')]=_['merge'](_0x3846a8[_0xcca4('0x36')],{'$or':_[_0xcca4('0x27')](_0x559423,function(_0x500a87){if(_0x500a87[_0xcca4('0x2a')]!=='VIRTUAL'){var _0x317d86={};_0x317d86[_0x500a87[_0xcca4('0x24')]]={'$like':'%'+_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x37')]+'%'};return _0x317d86;}})});}_0x3846a8=_[_0xcca4('0x38')]({},_0x3846a8,_0x3852d7[_0xcca4('0x39')]);var _0x34fca8={'where':_0x3846a8['where']};return db[_0xcca4('0x28')][_0xcca4('0x1b')](_0x34fca8)[_0xcca4('0x1f')](function(_0x37ef32){_0x2569dd[_0xcca4('0x1b')]=_0x37ef32;if(_0x3852d7[_0xcca4('0x2d')][_0xcca4('0x3a')]){_0x3846a8[_0xcca4('0x3b')]=[{'all':!![]}];}return db[_0xcca4('0x28')][_0xcca4('0x3c')](_0x3846a8);})[_0xcca4('0x1f')](function(_0x3bcc8d){_0x2569dd[_0xcca4('0x3d')]=_0x3bcc8d;return _0x2569dd;})[_0xcca4('0x1f')](respondWithFilteredResult(_0x303ed8,_0x3846a8))[_0xcca4('0x3e')](handleError(_0x303ed8,null));};exports[_0xcca4('0x3f')]=function(_0x15e2e2,_0x207806){var _0x4fb886={'raw':!![],'where':{'id':_0x15e2e2[_0xcca4('0x40')]['id']}},_0x1d5ef4={};_0x1d5ef4[_0xcca4('0x2c')]=_[_0xcca4('0x2e')](db['SquareReport']['rawAttributes']);_0x1d5ef4[_0xcca4('0x2d')]=_['keys'](_0x15e2e2[_0xcca4('0x2d')]);_0x1d5ef4[_0xcca4('0x2f')]=_[_0xcca4('0x30')](_0x1d5ef4[_0xcca4('0x2c')],_0x1d5ef4['query']);_0x4fb886[_0xcca4('0x31')]=_[_0xcca4('0x30')](_0x1d5ef4[_0xcca4('0x2c')],qs['fields'](_0x15e2e2[_0xcca4('0x2d')][_0xcca4('0x32')]));_0x4fb886[_0xcca4('0x31')]=_0x4fb886[_0xcca4('0x31')]['length']?_0x4fb886[_0xcca4('0x31')]:_0x1d5ef4[_0xcca4('0x2c')];if(_0x15e2e2[_0xcca4('0x2d')][_0xcca4('0x3a')]){_0x4fb886[_0xcca4('0x3b')]=[{'all':!![]}];}_0x4fb886=_['merge']({},_0x4fb886,_0x15e2e2['options']);return db['SquareReport'][_0xcca4('0x41')](_0x4fb886)[_0xcca4('0x1f')](handleEntityNotFound(_0x207806,null))[_0xcca4('0x1f')](respondWithResult(_0x207806,null))['catch'](handleError(_0x207806,null));};exports[_0xcca4('0x42')]=function(_0xe0d26b,_0x5e13a6){return db[_0xcca4('0x28')][_0xcca4('0x42')](_0xe0d26b[_0xcca4('0x43')],{})[_0xcca4('0x1f')](respondWithResult(_0x5e13a6,0xc9))[_0xcca4('0x3e')](handleError(_0x5e13a6,null));};exports[_0xcca4('0x1e')]=function(_0x3ca92c,_0x268ab9){if(_0x3ca92c[_0xcca4('0x43')]['id']){delete _0x3ca92c['body']['id'];}return db[_0xcca4('0x28')]['find']({'where':{'id':_0x3ca92c[_0xcca4('0x40')]['id']}})[_0xcca4('0x1f')](handleEntityNotFound(_0x268ab9,null))[_0xcca4('0x1f')](saveUpdates(_0x3ca92c[_0xcca4('0x43')],null))['then'](respondWithResult(_0x268ab9,null))[_0xcca4('0x3e')](handleError(_0x268ab9,null));};exports[_0xcca4('0x20')]=function(_0x20b85b,_0xe0443c){return db[_0xcca4('0x28')][_0xcca4('0x41')]({'where':{'id':_0x20b85b[_0xcca4('0x40')]['id']}})['then'](handleEntityNotFound(_0xe0443c,null))[_0xcca4('0x1f')](removeEntity(_0xe0443c,null))[_0xcca4('0x3e')](handleError(_0xe0443c,null));};exports[_0xcca4('0x44')]=function(_0x464718,_0x3e2369){return db[_0xcca4('0x28')][_0xcca4('0x44')]()[_0xcca4('0x1f')](respondWithResult(_0x3e2369,null))[_0xcca4('0x3e')](handleError(_0x3e2369,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 5f4f647..41f43fd 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 _0x53be=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger'];(function(_0x53f1de,_0x37d8d3){var _0x2fa505=function(_0x220b34){while(--_0x220b34){_0x53f1de['push'](_0x53f1de['shift']());}};_0x2fa505(++_0x37d8d3);}(_0x53be,0x1b8));var _0xe53b=function(_0x47248d,_0x21ad75){_0x47248d=_0x47248d-0x0;var _0xd69b6d=_0x53be[_0x47248d];return _0xd69b6d;};'use strict';var _=require(_0xe53b('0x0'));var util=require('util');var logger=require(_0xe53b('0x1'))(_0xe53b('0x2'));var moment=require(_0xe53b('0x3'));var BPromise=require(_0xe53b('0x4'));var rp=require(_0xe53b('0x5'));var fs=require('fs');var path=require(_0xe53b('0x6'));var rimraf=require(_0xe53b('0x7'));var config=require(_0xe53b('0x8'));var attributes=require('./squareReport.attributes');module[_0xe53b('0x9')]=function(_0x10bbc0,_0x4267bc){return _0x10bbc0[_0xe53b('0xa')](_0xe53b('0xb'),attributes,{'tableName':_0xe53b('0xc'),'paranoid':![],'indexes':[{'name':_0xe53b('0xd'),'fields':[_0xe53b('0xe'),_0xe53b('0xf')]},{'name':_0xe53b('0x10'),'fields':[_0xe53b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b02=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x5af779,_0x59fd66){var _0xc90b90=function(_0x3a1155){while(--_0x3a1155){_0x5af779['push'](_0x5af779['shift']());}};_0xc90b90(++_0x59fd66);}(_0x2b02,0xc0));var _0x22b0=function(_0x59198e,_0x3c0420){_0x59198e=_0x59198e-0x0;var _0x58954d=_0x2b02[_0x59198e];return _0x58954d;};'use strict';var _=require(_0x22b0('0x0'));var util=require(_0x22b0('0x1'));var logger=require(_0x22b0('0x2'))('api');var moment=require(_0x22b0('0x3'));var BPromise=require(_0x22b0('0x4'));var rp=require(_0x22b0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22b0('0x6'));var config=require(_0x22b0('0x7'));var attributes=require(_0x22b0('0x8'));module[_0x22b0('0x9')]=function(_0x11510,_0x553cd9){return _0x11510[_0x22b0('0xa')](_0x22b0('0xb'),attributes,{'tableName':_0x22b0('0xc'),'paranoid':![],'indexes':[{'name':_0x22b0('0xd'),'fields':[_0x22b0('0xe'),_0x22b0('0xf')]},{'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 7882112..6f152c0 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 _0xd775=['result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x43d6a8,_0x5c6bef){var _0x4d1ffe=function(_0x51f0bf){while(--_0x51f0bf){_0x43d6a8['push'](_0x43d6a8['shift']());}};_0x4d1ffe(++_0x5c6bef);}(_0xd775,0x18e));var _0x5d77=function(_0x2254b8,_0x5d2384){_0x2254b8=_0x2254b8-0x0;var _0xc7514e=_0xd775[_0x2254b8];return _0xc7514e;};'use strict';var _=require(_0x5d77('0x0'));var util=require(_0x5d77('0x1'));var moment=require(_0x5d77('0x2'));var BPromise=require(_0x5d77('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d77('0x4'));var db=require(_0x5d77('0x5'))['db'];var utils=require(_0x5d77('0x6'));var logger=require(_0x5d77('0x7'))(_0x5d77('0x8'));var config=require(_0x5d77('0x9'));var jayson=require(_0x5d77('0xa'));var client=jayson[_0x5d77('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4eeb,_0x25fe83,_0xe41cc8){return new BPromise(function(_0x3df699,_0x4f2a00){return client['request'](_0x3c4eeb,_0xe41cc8)[_0x5d77('0xc')](function(_0x30fdfd){logger[_0x5d77('0xd')](_0x5d77('0xe'),_0x25fe83,'request\x20sent');logger[_0x5d77('0xf')](_0x5d77('0x10'),_0x25fe83,'request\x20sent',JSON[_0x5d77('0x11')](_0x30fdfd));if(_0x30fdfd[_0x5d77('0x12')]){if(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x13')]===0x1f4){logger[_0x5d77('0x12')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);return _0x4f2a00(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);}logger[_0x5d77('0x12')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);return _0x3df699(_0x30fdfd[_0x5d77('0x12')][_0x5d77('0x14')]);}else{logger[_0x5d77('0xd')]('SquareReport,\x20%s,\x20%s',_0x25fe83,_0x5d77('0x15'));_0x3df699(_0x30fdfd[_0x5d77('0x16')][_0x5d77('0x14')]);}})[_0x5d77('0x17')](function(_0x70c377){logger[_0x5d77('0x12')](_0x5d77('0xe'),_0x25fe83,_0x70c377);_0x4f2a00(_0x70c377);});});}exports[_0x5d77('0x18')]=function(_0x2c1f6b){var _0x27588f=this;return new Promise(function(_0x4c953d,_0x535fb9){return db[_0x5d77('0x19')][_0x5d77('0x1a')](_0x2c1f6b[_0x5d77('0x1b')],{'raw':_0x2c1f6b[_0x5d77('0x1c')]?_0x2c1f6b[_0x5d77('0x1c')][_0x5d77('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x285c5f){logger[_0x5d77('0xd')](_0x5d77('0x18'),_0x2c1f6b);logger[_0x5d77('0xf')](_0x5d77('0x18'),_0x2c1f6b,JSON[_0x5d77('0x11')](_0x285c5f));_0x4c953d(_0x285c5f);})[_0x5d77('0x17')](function(_0x4b7e24){logger['error'](_0x5d77('0x18'),_0x4b7e24[_0x5d77('0x14')],_0x2c1f6b);_0x535fb9(_0x27588f[_0x5d77('0x12')](0x1f4,_0x4b7e24[_0x5d77('0x14')]));});});};exports[_0x5d77('0x1e')]=function(_0x228f6d){var _0x4df3bd=this;return new Promise(function(_0x48b75e,_0x45b8a3){return db[_0x5d77('0x19')][_0x5d77('0x1f')](_0x228f6d[_0x5d77('0x1b')],{'raw':_0x228f6d['options']?_0x228f6d[_0x5d77('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d['options'][_0x5d77('0x20')]||null:null,'attributes':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d[_0x5d77('0x1c')][_0x5d77('0x21')]||null:null,'limit':_0x228f6d[_0x5d77('0x1c')]?_0x228f6d['options'][_0x5d77('0x22')]||null:null})['then'](function(_0x242b4c){logger['info']('UpdateSquareReport',_0x228f6d);logger[_0x5d77('0xf')]('UpdateSquareReport',_0x228f6d,JSON[_0x5d77('0x11')](_0x242b4c));_0x48b75e(_0x242b4c);})['catch'](function(_0x3aaa5e){logger['error'](_0x5d77('0x1e'),_0x3aaa5e['message'],_0x228f6d);_0x45b8a3(_0x4df3bd['error'](0x1f4,_0x3aaa5e[_0x5d77('0x14')]));});});}; \ No newline at end of file +var _0xa82a=['rpc','../../config/environment','jayson/promise','client','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareReport','create','body','options','CreateSquareReport','UpdateSquareReport','update','raw','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x5158b3,_0x389178){var _0x4c8a0e=function(_0x5f5043){while(--_0x5f5043){_0x5158b3['push'](_0x5158b3['shift']());}};_0x4c8a0e(++_0x389178);}(_0xa82a,0x1da));var _0xaa82=function(_0x458282,_0xf8fca1){_0x458282=_0x458282-0x0;var _0x4d86f5=_0xa82a[_0x458282];return _0x4d86f5;};'use strict';var _=require(_0xaa82('0x0'));var util=require(_0xaa82('0x1'));var moment=require('moment');var BPromise=require(_0xaa82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa82('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa82('0x4'));var logger=require(_0xaa82('0x5'))(_0xaa82('0x6'));var config=require(_0xaa82('0x7'));var jayson=require(_0xaa82('0x8'));var client=jayson[_0xaa82('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bcc68,_0x5de143,_0x20890a){return new BPromise(function(_0x1ac370,_0x19fcb1){return client['request'](_0x3bcc68,_0x20890a)[_0xaa82('0xa')](function(_0x29ae51){logger['info'](_0xaa82('0xb'),_0x5de143,_0xaa82('0xc'));logger[_0xaa82('0xd')](_0xaa82('0xe'),_0x5de143,'request\x20sent',JSON[_0xaa82('0xf')](_0x29ae51));if(_0x29ae51['error']){if(_0x29ae51[_0xaa82('0x10')][_0xaa82('0x11')]===0x1f4){logger[_0xaa82('0x10')](_0xaa82('0xb'),_0x5de143,_0x29ae51['error'][_0xaa82('0x12')]);return _0x19fcb1(_0x29ae51['error'][_0xaa82('0x12')]);}logger['error'](_0xaa82('0xb'),_0x5de143,_0x29ae51['error']['message']);return _0x1ac370(_0x29ae51['error'][_0xaa82('0x12')]);}else{logger[_0xaa82('0x13')](_0xaa82('0xb'),_0x5de143,'request\x20sent');_0x1ac370(_0x29ae51[_0xaa82('0x14')][_0xaa82('0x12')]);}})[_0xaa82('0x15')](function(_0x59354b){logger[_0xaa82('0x10')](_0xaa82('0xb'),_0x5de143,_0x59354b);_0x19fcb1(_0x59354b);});});}exports['CreateSquareReport']=function(_0x4a3d0c){var _0x2173c2=this;return new Promise(function(_0x1b4864,_0x279e47){return db[_0xaa82('0x16')][_0xaa82('0x17')](_0x4a3d0c[_0xaa82('0x18')],{'raw':_0x4a3d0c[_0xaa82('0x19')]?_0x4a3d0c[_0xaa82('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaa82('0xa')](function(_0x3b95ae){logger[_0xaa82('0x13')](_0xaa82('0x1a'),_0x4a3d0c);logger[_0xaa82('0xd')](_0xaa82('0x1a'),_0x4a3d0c,JSON['stringify'](_0x3b95ae));_0x1b4864(_0x3b95ae);})[_0xaa82('0x15')](function(_0x261e5c){logger[_0xaa82('0x10')](_0xaa82('0x1a'),_0x261e5c['message'],_0x4a3d0c);_0x279e47(_0x2173c2[_0xaa82('0x10')](0x1f4,_0x261e5c[_0xaa82('0x12')]));});});};exports[_0xaa82('0x1b')]=function(_0x129efe){var _0x15b352=this;return new Promise(function(_0x904d7b,_0x37305d){return db[_0xaa82('0x16')][_0xaa82('0x1c')](_0x129efe['body'],{'raw':_0x129efe['options']?_0x129efe[_0xaa82('0x19')][_0xaa82('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129efe['options']?_0x129efe[_0xaa82('0x19')]['where']||null:null,'attributes':_0x129efe[_0xaa82('0x19')]?_0x129efe[_0xaa82('0x19')][_0xaa82('0x1e')]||null:null,'limit':_0x129efe[_0xaa82('0x19')]?_0x129efe[_0xaa82('0x19')][_0xaa82('0x1f')]||null:null})[_0xaa82('0xa')](function(_0x2d92ef){logger[_0xaa82('0x13')]('UpdateSquareReport',_0x129efe);logger[_0xaa82('0xd')]('UpdateSquareReport',_0x129efe,JSON['stringify'](_0x2d92ef));_0x904d7b(_0x2d92ef);})[_0xaa82('0x15')](function(_0xa1713f){logger[_0xaa82('0x10')](_0xaa82('0x1b'),_0xa1713f['message'],_0x129efe);_0x37305d(_0x15b352['error'](0x1f4,_0xa1713f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 2eb5b6b..f5b0df9 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 _0x9f5d=['post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','get','show'];(function(_0x50c35f,_0x25bcd3){var _0x1d9627=function(_0x3d0007){while(--_0x3d0007){_0x50c35f['push'](_0x50c35f['shift']());}};_0x1d9627(++_0x25bcd3);}(_0x9f5d,0x1a6));var _0xd9f5=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x9f5d[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd9f5('0x0'));var express=require(_0xd9f5('0x1'));var router=express['Router']();var fs_extra=require(_0xd9f5('0x2'));var auth=require(_0xd9f5('0x3'));var interaction=require(_0xd9f5('0x4'));var config=require(_0xd9f5('0x5'));var controller=require('./squareReportDetail.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd9f5('0x6'),auth[_0xd9f5('0x7')](),controller['describe']);router[_0xd9f5('0x8')]('/:id',auth[_0xd9f5('0x7')](),controller[_0xd9f5('0x9')]);router[_0xd9f5('0xa')]('/',auth['isAuthenticated'](),controller[_0xd9f5('0xb')]);router[_0xd9f5('0xc')](_0xd9f5('0xd'),auth[_0xd9f5('0x7')](),controller[_0xd9f5('0xe')]);router[_0xd9f5('0xf')](_0xd9f5('0xd'),auth[_0xd9f5('0x7')](),controller[_0xd9f5('0x10')]);module[_0xd9f5('0x11')]=router; \ No newline at end of file +var _0x997e=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post'];(function(_0x49f94b,_0x3574a8){var _0xb5d760=function(_0x2b627d){while(--_0x2b627d){_0x49f94b['push'](_0x49f94b['shift']());}};_0xb5d760(++_0x3574a8);}(_0x997e,0x159));var _0xe997=function(_0x867a42,_0x5093df){_0x867a42=_0x867a42-0x0;var _0x1c2543=_0x997e[_0x867a42];return _0x1c2543;};'use strict';var multer=require(_0xe997('0x0'));var util=require(_0xe997('0x1'));var path=require(_0xe997('0x2'));var timeout=require(_0xe997('0x3'));var express=require(_0xe997('0x4'));var router=express['Router']();var fs_extra=require(_0xe997('0x5'));var auth=require(_0xe997('0x6'));var interaction=require(_0xe997('0x7'));var config=require(_0xe997('0x8'));var controller=require('./squareReportDetail.controller');router[_0xe997('0x9')]('/',auth[_0xe997('0xa')](),controller['index']);router[_0xe997('0x9')](_0xe997('0xb'),auth[_0xe997('0xa')](),controller[_0xe997('0xc')]);router[_0xe997('0x9')]('/:id',auth[_0xe997('0xa')](),controller[_0xe997('0xd')]);router[_0xe997('0xe')]('/',auth[_0xe997('0xa')](),controller['create']);router[_0xe997('0xf')](_0xe997('0x10'),auth[_0xe997('0xa')](),controller[_0xe997('0x11')]);router[_0xe997('0x12')]('/:id',auth[_0xe997('0xa')](),controller['destroy']);module[_0xe997('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 0513fb4..69beafe 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 _0x891b=['TEXT','STRING'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x891b,0x177));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb891('0x0')]},'node':{'type':Sequelize[_0xb891('0x0')]},'application':{'type':Sequelize[_0xb891('0x0')]},'data':{'type':Sequelize[_0xb891('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xb891('0x0')]}}; \ No newline at end of file +var _0x7893=['STRING','TEXT','exports'];(function(_0x16480b,_0x390f4e){var _0x5b7375=function(_0xfd00bb){while(--_0xfd00bb){_0x16480b['push'](_0x16480b['shift']());}};_0x5b7375(++_0x390f4e);}(_0x7893,0x92));var _0x3789=function(_0x3e3e38,_0x27563){_0x3e3e38=_0x3e3e38-0x0;var _0x72c6fb=_0x7893[_0x3e3e38];return _0x72c6fb;};'use strict';var Sequelize=require('sequelize');module[_0x3789('0x0')]={'uniqueid':{'type':Sequelize[_0x3789('0x1')]},'node':{'type':Sequelize[_0x3789('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x3789('0x2')]},'project_name':{'type':Sequelize[_0x3789('0x1')]},'callerid':{'type':Sequelize[_0x3789('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 40b9870..9c1fb7c 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 _0xf27b=['filters','pick','filter','merge','type','SquareDetailsReport','include','findAll','rows','then','catch','show','rawAttributes','fields','includeAll','options','find','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','key','query','keys','model','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xf27b,0x18b));var _0xbf27=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xf27b[_0x30faec];return _0x29484f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf27('0x0'));var zipdir=require(_0xbf27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf27('0x2'));var moment=require(_0xbf27('0x3'));var BPromise=require(_0xbf27('0x4'));var Mustache=require('mustache');var util=require(_0xbf27('0x5'));var path=require(_0xbf27('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf27('0x7'));var fs=require('fs');var fs_extra=require(_0xbf27('0x8'));var _=require('lodash');var squel=require(_0xbf27('0x9'));var crypto=require(_0xbf27('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xbf27('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf27('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbf27('0xd'));var as=require(_0xbf27('0xe'));var hardwareService=require(_0xbf27('0xf'));var logger=require(_0xbf27('0x10'))(_0xbf27('0x11'));var utils=require(_0xbf27('0x12'));var config=require(_0xbf27('0x13'));var licenseUtil=require(_0xbf27('0x14'));var db=require(_0xbf27('0x15'))['db'];function respondWithStatusCode(_0x395dd4,_0x48ba3e){_0x48ba3e=_0x48ba3e||0xcc;return function(_0x3d88fd){if(_0x3d88fd){return _0x395dd4[_0xbf27('0x16')](_0x48ba3e);}return _0x395dd4['status'](_0x48ba3e)['end']();};}function respondWithResult(_0x17da3f,_0x485c21){_0x485c21=_0x485c21||0xc8;return function(_0x3cf114){if(_0x3cf114){return _0x17da3f[_0xbf27('0x17')](_0x485c21)[_0xbf27('0x18')](_0x3cf114);}};}function respondWithFilteredResult(_0x48477f,_0x1f66aa){return function(_0xaace8c){if(_0xaace8c){var _0x5e8f43=typeof _0x1f66aa['offset']===_0xbf27('0x19')&&typeof _0x1f66aa[_0xbf27('0x1a')]==='undefined';var _0x2c1d8e=_0xaace8c[_0xbf27('0x1b')];var _0x5deec0=_0x5e8f43?0x0:_0x1f66aa[_0xbf27('0x1c')];var _0x316587=_0x5e8f43?_0xaace8c[_0xbf27('0x1b')]:_0x1f66aa['offset']+_0x1f66aa[_0xbf27('0x1a')];var _0x47abb6;if(_0x316587>=_0x2c1d8e){_0x316587=_0x2c1d8e;_0x47abb6=0xc8;}else{_0x47abb6=0xce;}_0x48477f[_0xbf27('0x17')](_0x47abb6);return _0x48477f[_0xbf27('0x1d')]('Content-Range',_0x5deec0+'-'+_0x316587+'/'+_0x2c1d8e)[_0xbf27('0x18')](_0xaace8c);}return null;};}function patchUpdates(_0x180c33){return function(_0xaeb85){try{jsonpatch[_0xbf27('0x1e')](_0xaeb85,_0x180c33,!![]);}catch(_0x4c7f1f){return BPromise[_0xbf27('0x1f')](_0x4c7f1f);}return _0xaeb85[_0xbf27('0x20')]();};}function saveUpdates(_0x523a75,_0x4db08f){return function(_0x1f4119){if(_0x1f4119){return _0x1f4119[_0xbf27('0x21')](_0x523a75)['then'](function(_0x1b67b7){return _0x1b67b7;});}return null;};}function removeEntity(_0x40bd2d,_0x1fcb6c){return function(_0x51b80f){if(_0x51b80f){return _0x51b80f[_0xbf27('0x22')]()['then'](function(){_0x40bd2d[_0xbf27('0x17')](0xcc)[_0xbf27('0x23')]();});}};}function handleEntityNotFound(_0xdd43b,_0x2b3ddb){return function(_0x2fe0d2){if(!_0x2fe0d2){_0xdd43b['sendStatus'](0x194);}return _0x2fe0d2;};}function handleError(_0x461b46,_0xf90c27){_0xf90c27=_0xf90c27||0x1f4;return function(_0x502d0e){logger[_0xbf27('0x24')](_0x502d0e[_0xbf27('0x25')]);if(_0x502d0e[_0xbf27('0x26')]){delete _0x502d0e[_0xbf27('0x26')];}_0x461b46['status'](_0xf90c27)[_0xbf27('0x27')](_0x502d0e);};}exports[_0xbf27('0x28')]=function(_0x3b096f,_0x284560){var _0x4e2093={},_0x32eea4={},_0x54328e={'count':0x0,'rows':[]};var _0x405036=_[_0xbf27('0x29')](db['SquareDetailsReport']['rawAttributes'],function(_0x2d5518){return{'name':_0x2d5518[_0xbf27('0x2a')],'type':_0x2d5518['type'][_0xbf27('0x2b')]};});_0x32eea4['model']=_[_0xbf27('0x29')](_0x405036,_0xbf27('0x26'));_0x32eea4[_0xbf27('0x2c')]=_[_0xbf27('0x2d')](_0x3b096f['query']);_0x32eea4['filters']=_['intersection'](_0x32eea4[_0xbf27('0x2e')],_0x32eea4[_0xbf27('0x2c')]);_0x4e2093['attributes']=_[_0xbf27('0x2f')](_0x32eea4['model'],qs['fields'](_0x3b096f['query']['fields']));_0x4e2093['attributes']=_0x4e2093[_0xbf27('0x30')][_0xbf27('0x31')]?_0x4e2093[_0xbf27('0x30')]:_0x32eea4[_0xbf27('0x2e')];if(!_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x32')](_0xbf27('0x33'))){_0x4e2093['limit']=qs['limit'](_0x3b096f['query']['limit']);_0x4e2093[_0xbf27('0x1c')]=qs[_0xbf27('0x1c')](_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x1c')]);}_0x4e2093[_0xbf27('0x34')]=qs[_0xbf27('0x35')](_0x3b096f[_0xbf27('0x2c')]['sort']);_0x4e2093[_0xbf27('0x36')]=qs[_0xbf27('0x37')](_[_0xbf27('0x38')](_0x3b096f[_0xbf27('0x2c')],_0x32eea4['filters']),_0x405036);if(_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x39')]){_0x4e2093[_0xbf27('0x36')]=_[_0xbf27('0x3a')](_0x4e2093[_0xbf27('0x36')],{'$or':_[_0xbf27('0x29')](_0x405036,function(_0x58e2ab){if(_0x58e2ab[_0xbf27('0x3b')]!=='VIRTUAL'){var _0x2308ff={};_0x2308ff[_0x58e2ab['name']]={'$like':'%'+_0x3b096f[_0xbf27('0x2c')][_0xbf27('0x39')]+'%'};return _0x2308ff;}})});}_0x4e2093=_[_0xbf27('0x3a')]({},_0x4e2093,_0x3b096f['options']);var _0x3360cc={'where':_0x4e2093[_0xbf27('0x36')]};return db[_0xbf27('0x3c')][_0xbf27('0x1b')](_0x3360cc)['then'](function(_0x1800f1){_0x54328e[_0xbf27('0x1b')]=_0x1800f1;if(_0x3b096f[_0xbf27('0x2c')]['includeAll']){_0x4e2093[_0xbf27('0x3d')]=[{'all':!![]}];}return db[_0xbf27('0x3c')][_0xbf27('0x3e')](_0x4e2093);})['then'](function(_0x69f025){_0x54328e[_0xbf27('0x3f')]=_0x69f025;return _0x54328e;})[_0xbf27('0x40')](respondWithFilteredResult(_0x284560,_0x4e2093))[_0xbf27('0x41')](handleError(_0x284560,null));};exports[_0xbf27('0x42')]=function(_0x4a4460,_0x5f1957){var _0x5645a6={'raw':!![],'where':{'id':_0x4a4460['params']['id']}},_0x5195a7={};_0x5195a7['model']=_['keys'](db[_0xbf27('0x3c')][_0xbf27('0x43')]);_0x5195a7['query']=_[_0xbf27('0x2d')](_0x4a4460[_0xbf27('0x2c')]);_0x5195a7[_0xbf27('0x37')]=_[_0xbf27('0x2f')](_0x5195a7[_0xbf27('0x2e')],_0x5195a7[_0xbf27('0x2c')]);_0x5645a6[_0xbf27('0x30')]=_['intersection'](_0x5195a7[_0xbf27('0x2e')],qs[_0xbf27('0x44')](_0x4a4460['query'][_0xbf27('0x44')]));_0x5645a6[_0xbf27('0x30')]=_0x5645a6[_0xbf27('0x30')][_0xbf27('0x31')]?_0x5645a6[_0xbf27('0x30')]:_0x5195a7[_0xbf27('0x2e')];if(_0x4a4460['query'][_0xbf27('0x45')]){_0x5645a6[_0xbf27('0x3d')]=[{'all':!![]}];}_0x5645a6=_[_0xbf27('0x3a')]({},_0x5645a6,_0x4a4460[_0xbf27('0x46')]);return db[_0xbf27('0x3c')][_0xbf27('0x47')](_0x5645a6)[_0xbf27('0x40')](handleEntityNotFound(_0x5f1957,null))[_0xbf27('0x40')](respondWithResult(_0x5f1957,null))[_0xbf27('0x41')](handleError(_0x5f1957,null));};exports['create']=function(_0x347869,_0x397ae3){return db[_0xbf27('0x3c')]['create'](_0x347869[_0xbf27('0x48')],{})[_0xbf27('0x40')](respondWithResult(_0x397ae3,0xc9))[_0xbf27('0x41')](handleError(_0x397ae3,null));};exports[_0xbf27('0x21')]=function(_0x4f1e0a,_0xc8fb15){if(_0x4f1e0a[_0xbf27('0x48')]['id']){delete _0x4f1e0a[_0xbf27('0x48')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x4f1e0a[_0xbf27('0x49')]['id']}})[_0xbf27('0x40')](handleEntityNotFound(_0xc8fb15,null))[_0xbf27('0x40')](saveUpdates(_0x4f1e0a[_0xbf27('0x48')],null))['then'](respondWithResult(_0xc8fb15,null))[_0xbf27('0x41')](handleError(_0xc8fb15,null));};exports[_0xbf27('0x22')]=function(_0x2b7816,_0x280895){return db[_0xbf27('0x3c')][_0xbf27('0x47')]({'where':{'id':_0x2b7816[_0xbf27('0x49')]['id']}})['then'](handleEntityNotFound(_0x280895,null))[_0xbf27('0x40')](removeEntity(_0x280895,null))[_0xbf27('0x41')](handleError(_0x280895,null));};exports[_0xbf27('0x4a')]=function(_0x179540,_0x5b2f34){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x5b2f34,null))[_0xbf27('0x41')](handleError(_0x5b2f34,null));}; \ No newline at end of file +var _0x4aec=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','findAll','rows','catch','params','intersection','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1d102c,_0x1bbef1){var _0x45b606=function(_0x571877){while(--_0x571877){_0x1d102c['push'](_0x1d102c['shift']());}};_0x45b606(++_0x1bbef1);}(_0x4aec,0xc6));var _0xc4ae=function(_0x522619,_0x54f584){_0x522619=_0x522619-0x0;var _0x252aa4=_0x4aec[_0x522619];return _0x252aa4;};'use strict';var emlformat=require(_0xc4ae('0x0'));var rimraf=require(_0xc4ae('0x1'));var zipdir=require(_0xc4ae('0x2'));var jsonpatch=require(_0xc4ae('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc4ae('0x4'));var path=require('path');var sox=require(_0xc4ae('0x5'));var csv=require('to-csv');var ejs=require(_0xc4ae('0x6'));var fs=require('fs');var fs_extra=require(_0xc4ae('0x7'));var _=require(_0xc4ae('0x8'));var squel=require(_0xc4ae('0x9'));var crypto=require(_0xc4ae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc4ae('0xb'));var toCsv=require(_0xc4ae('0xc'));var querystring=require(_0xc4ae('0xd'));var Papa=require('papaparse');var Redis=require(_0xc4ae('0xe'));var authService=require(_0xc4ae('0xf'));var qs=require(_0xc4ae('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4ae('0x11'));var logger=require('../../config/logger')(_0xc4ae('0x12'));var utils=require(_0xc4ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc4ae('0x14'));var db=require(_0xc4ae('0x15'))['db'];function respondWithStatusCode(_0x5c90d9,_0x4fb657){_0x4fb657=_0x4fb657||0xcc;return function(_0xde1eee){if(_0xde1eee){return _0x5c90d9[_0xc4ae('0x16')](_0x4fb657);}return _0x5c90d9['status'](_0x4fb657)[_0xc4ae('0x17')]();};}function respondWithResult(_0x10108a,_0x5a0cc6){_0x5a0cc6=_0x5a0cc6||0xc8;return function(_0x3e8f20){if(_0x3e8f20){return _0x10108a[_0xc4ae('0x18')](_0x5a0cc6)[_0xc4ae('0x19')](_0x3e8f20);}};}function respondWithFilteredResult(_0x569b3c,_0x4fb991){return function(_0xb88173){if(_0xb88173){var _0x10a0af=typeof _0x4fb991[_0xc4ae('0x1a')]===_0xc4ae('0x1b')&&typeof _0x4fb991[_0xc4ae('0x1c')]===_0xc4ae('0x1b');var _0x5ecf6f=_0xb88173[_0xc4ae('0x1d')];var _0x30166c=_0x10a0af?0x0:_0x4fb991[_0xc4ae('0x1a')];var _0x2792b9=_0x10a0af?_0xb88173['count']:_0x4fb991['offset']+_0x4fb991[_0xc4ae('0x1c')];var _0x5b8f32;if(_0x2792b9>=_0x5ecf6f){_0x2792b9=_0x5ecf6f;_0x5b8f32=0xc8;}else{_0x5b8f32=0xce;}_0x569b3c['status'](_0x5b8f32);return _0x569b3c[_0xc4ae('0x1e')](_0xc4ae('0x1f'),_0x30166c+'-'+_0x2792b9+'/'+_0x5ecf6f)['json'](_0xb88173);}return null;};}function patchUpdates(_0x1de74c){return function(_0x47c25d){try{jsonpatch[_0xc4ae('0x20')](_0x47c25d,_0x1de74c,!![]);}catch(_0x3e662b){return BPromise[_0xc4ae('0x21')](_0x3e662b);}return _0x47c25d[_0xc4ae('0x22')]();};}function saveUpdates(_0x1c9cf7,_0x2ab8e4){return function(_0x1a1c82){if(_0x1a1c82){return _0x1a1c82[_0xc4ae('0x23')](_0x1c9cf7)[_0xc4ae('0x24')](function(_0x45fec9){return _0x45fec9;});}return null;};}function removeEntity(_0x106f17,_0x3c68fd){return function(_0x432525){if(_0x432525){return _0x432525[_0xc4ae('0x25')]()[_0xc4ae('0x24')](function(){_0x106f17['status'](0xcc)[_0xc4ae('0x17')]();});}};}function handleEntityNotFound(_0x3e72c6,_0x57fb1f){return function(_0x3934a7){if(!_0x3934a7){_0x3e72c6[_0xc4ae('0x16')](0x194);}return _0x3934a7;};}function handleError(_0x1c4234,_0x13e973){_0x13e973=_0x13e973||0x1f4;return function(_0x24fdf4){logger['error'](_0x24fdf4[_0xc4ae('0x26')]);if(_0x24fdf4['name']){delete _0x24fdf4[_0xc4ae('0x27')];}_0x1c4234[_0xc4ae('0x18')](_0x13e973)[_0xc4ae('0x28')](_0x24fdf4);};}exports[_0xc4ae('0x29')]=function(_0x2a5416,_0x4cad5e){var _0x2febcd={},_0x10ee91={},_0x496b9c={'count':0x0,'rows':[]};var _0xa3bc98=_['map'](db[_0xc4ae('0x2a')][_0xc4ae('0x2b')],function(_0x4710e4){return{'name':_0x4710e4[_0xc4ae('0x2c')],'type':_0x4710e4[_0xc4ae('0x2d')]['key']};});_0x10ee91[_0xc4ae('0x2e')]=_[_0xc4ae('0x2f')](_0xa3bc98,_0xc4ae('0x27'));_0x10ee91['query']=_[_0xc4ae('0x30')](_0x2a5416[_0xc4ae('0x31')]);_0x10ee91[_0xc4ae('0x32')]=_['intersection'](_0x10ee91[_0xc4ae('0x2e')],_0x10ee91[_0xc4ae('0x31')]);_0x2febcd[_0xc4ae('0x33')]=_['intersection'](_0x10ee91[_0xc4ae('0x2e')],qs[_0xc4ae('0x34')](_0x2a5416[_0xc4ae('0x31')][_0xc4ae('0x34')]));_0x2febcd[_0xc4ae('0x33')]=_0x2febcd[_0xc4ae('0x33')][_0xc4ae('0x35')]?_0x2febcd['attributes']:_0x10ee91[_0xc4ae('0x2e')];if(!_0x2a5416[_0xc4ae('0x31')][_0xc4ae('0x36')](_0xc4ae('0x37'))){_0x2febcd[_0xc4ae('0x1c')]=qs[_0xc4ae('0x1c')](_0x2a5416['query'][_0xc4ae('0x1c')]);_0x2febcd['offset']=qs[_0xc4ae('0x1a')](_0x2a5416['query'][_0xc4ae('0x1a')]);}_0x2febcd['order']=qs[_0xc4ae('0x38')](_0x2a5416[_0xc4ae('0x31')]['sort']);_0x2febcd['where']=qs[_0xc4ae('0x32')](_[_0xc4ae('0x39')](_0x2a5416[_0xc4ae('0x31')],_0x10ee91[_0xc4ae('0x32')]),_0xa3bc98);if(_0x2a5416[_0xc4ae('0x31')][_0xc4ae('0x3a')]){_0x2febcd[_0xc4ae('0x3b')]=_['merge'](_0x2febcd[_0xc4ae('0x3b')],{'$or':_[_0xc4ae('0x2f')](_0xa3bc98,function(_0x434c24){if(_0x434c24[_0xc4ae('0x2d')]!==_0xc4ae('0x3c')){var _0x351483={};_0x351483[_0x434c24[_0xc4ae('0x27')]]={'$like':'%'+_0x2a5416['query'][_0xc4ae('0x3a')]+'%'};return _0x351483;}})});}_0x2febcd=_['merge']({},_0x2febcd,_0x2a5416[_0xc4ae('0x3d')]);var _0x311c92={'where':_0x2febcd[_0xc4ae('0x3b')]};return db[_0xc4ae('0x2a')][_0xc4ae('0x1d')](_0x311c92)[_0xc4ae('0x24')](function(_0x2492ef){_0x496b9c['count']=_0x2492ef;if(_0x2a5416[_0xc4ae('0x31')]['includeAll']){_0x2febcd['include']=[{'all':!![]}];}return db[_0xc4ae('0x2a')][_0xc4ae('0x3e')](_0x2febcd);})[_0xc4ae('0x24')](function(_0x3675ab){_0x496b9c[_0xc4ae('0x3f')]=_0x3675ab;return _0x496b9c;})[_0xc4ae('0x24')](respondWithFilteredResult(_0x4cad5e,_0x2febcd))[_0xc4ae('0x40')](handleError(_0x4cad5e,null));};exports['show']=function(_0x32e8f2,_0x515072){var _0x55e77f={'raw':!![],'where':{'id':_0x32e8f2[_0xc4ae('0x41')]['id']}},_0x550029={};_0x550029['model']=_[_0xc4ae('0x30')](db['SquareDetailsReport'][_0xc4ae('0x2b')]);_0x550029['query']=_[_0xc4ae('0x30')](_0x32e8f2[_0xc4ae('0x31')]);_0x550029[_0xc4ae('0x32')]=_[_0xc4ae('0x42')](_0x550029[_0xc4ae('0x2e')],_0x550029[_0xc4ae('0x31')]);_0x55e77f[_0xc4ae('0x33')]=_[_0xc4ae('0x42')](_0x550029['model'],qs[_0xc4ae('0x34')](_0x32e8f2[_0xc4ae('0x31')][_0xc4ae('0x34')]));_0x55e77f[_0xc4ae('0x33')]=_0x55e77f[_0xc4ae('0x33')][_0xc4ae('0x35')]?_0x55e77f[_0xc4ae('0x33')]:_0x550029[_0xc4ae('0x2e')];if(_0x32e8f2[_0xc4ae('0x31')]['includeAll']){_0x55e77f['include']=[{'all':!![]}];}_0x55e77f=_[_0xc4ae('0x43')]({},_0x55e77f,_0x32e8f2[_0xc4ae('0x3d')]);return db[_0xc4ae('0x2a')][_0xc4ae('0x44')](_0x55e77f)['then'](handleEntityNotFound(_0x515072,null))[_0xc4ae('0x24')](respondWithResult(_0x515072,null))[_0xc4ae('0x40')](handleError(_0x515072,null));};exports['create']=function(_0x33c95e,_0x118761){return db[_0xc4ae('0x2a')][_0xc4ae('0x45')](_0x33c95e[_0xc4ae('0x46')],{})['then'](respondWithResult(_0x118761,0xc9))[_0xc4ae('0x40')](handleError(_0x118761,null));};exports[_0xc4ae('0x23')]=function(_0x22bc53,_0x55be1a){if(_0x22bc53[_0xc4ae('0x46')]['id']){delete _0x22bc53[_0xc4ae('0x46')]['id'];}return db[_0xc4ae('0x2a')][_0xc4ae('0x44')]({'where':{'id':_0x22bc53['params']['id']}})[_0xc4ae('0x24')](handleEntityNotFound(_0x55be1a,null))[_0xc4ae('0x24')](saveUpdates(_0x22bc53[_0xc4ae('0x46')],null))[_0xc4ae('0x24')](respondWithResult(_0x55be1a,null))[_0xc4ae('0x40')](handleError(_0x55be1a,null));};exports[_0xc4ae('0x25')]=function(_0x15a3cd,_0x3416ae){return db[_0xc4ae('0x2a')][_0xc4ae('0x44')]({'where':{'id':_0x15a3cd[_0xc4ae('0x41')]['id']}})[_0xc4ae('0x24')](handleEntityNotFound(_0x3416ae,null))[_0xc4ae('0x24')](removeEntity(_0x3416ae,null))[_0xc4ae('0x40')](handleError(_0x3416ae,null));};exports[_0xc4ae('0x47')]=function(_0x3bfeea,_0x50624b){return db[_0xc4ae('0x2a')][_0xc4ae('0x47')]()['then'](respondWithResult(_0x50624b,null))['catch'](handleError(_0x50624b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 35d207d..ee6c78c 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 _0x08a2=['request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x175f6f,_0x1a4a05){var _0x1aa501=function(_0x2e4488){while(--_0x2e4488){_0x175f6f['push'](_0x175f6f['shift']());}};_0x1aa501(++_0x1a4a05);}(_0x08a2,0x181));var _0x208a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x08a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x208a('0x0'));var util=require(_0x208a('0x1'));var logger=require(_0x208a('0x2'))(_0x208a('0x3'));var moment=require('moment');var BPromise=require(_0x208a('0x4'));var rp=require(_0x208a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x208a('0x6'));module['exports']=function(_0xc90e6b,_0x3c1b95){return _0xc90e6b[_0x208a('0x7')](_0x208a('0x8'),attributes,{'tableName':_0x208a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62f9=['request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','define','report_square_details','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa1f7d7,_0x5e2227){var _0x113647=function(_0x133294){while(--_0x133294){_0xa1f7d7['push'](_0xa1f7d7['shift']());}};_0x113647(++_0x5e2227);}(_0x62f9,0xc6));var _0x962f=function(_0x55daf2,_0x1b48de){_0x55daf2=_0x55daf2-0x0;var _0x1c8500=_0x62f9[_0x55daf2];return _0x1c8500;};'use strict';var _=require(_0x962f('0x0'));var util=require(_0x962f('0x1'));var logger=require(_0x962f('0x2'))(_0x962f('0x3'));var moment=require(_0x962f('0x4'));var BPromise=require(_0x962f('0x5'));var rp=require(_0x962f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x962f('0x7'));var config=require(_0x962f('0x8'));var attributes=require(_0x962f('0x9'));module['exports']=function(_0x1c0216,_0x51f21a){return _0x1c0216[_0x962f('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x962f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 06154f4..0e13794 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 _0x4e81=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x54e61b,_0x5b88bd){var _0x143454=function(_0x554c8f){while(--_0x554c8f){_0x54e61b['push'](_0x54e61b['shift']());}};_0x143454(++_0x5b88bd);}(_0x4e81,0x1bc));var _0x14e8=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x4e81[_0x115d5b];return _0x6cfc50;};'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')]('SquareDetailsReport,\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')](_0x10dc8b[_0x14e8('0x18')],{'raw':_0x10dc8b[_0x14e8('0x19')]?_0x10dc8b['options'][_0x14e8('0x1a')]===undefined?!![]:![]:!![]})[_0x14e8('0xa')](function(_0x2abfec){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger['debug'](_0x14e8('0x15'),_0x10dc8b,JSON[_0x14e8('0xf')](_0x2abfec));_0x5a38c1(_0x2abfec);})[_0x14e8('0x14')](function(_0x117b00){logger[_0x14e8('0x10')]('CreateSquareDetailsReport',_0x117b00[_0x14e8('0x13')],_0x10dc8b);_0x328c5a(_0x462259['error'](0x1f4,_0x117b00[_0x14e8('0x13')]));});});}; \ No newline at end of file +var _0x2f3a=['request\x20sent','debug','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x43c261,_0x344bef){var _0x3ee801=function(_0x5850fc){while(--_0x5850fc){_0x43c261['push'](_0x43c261['shift']());}};_0x3ee801(++_0x344bef);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x4ac106,_0x194ce5){_0x4ac106=_0x4ac106-0x0;var _0x319160=_0x2f3a[_0x4ac106];return _0x319160;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});}exports[_0xa2f3('0x14')]=function(_0x2db0d2){var _0x1c5c62=this;return new Promise(function(_0x205578,_0x23309e){return db[_0xa2f3('0x15')][_0xa2f3('0x16')](_0x2db0d2['body'],{'raw':_0x2db0d2[_0xa2f3('0x17')]?_0x2db0d2[_0xa2f3('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2f74a0){logger['info'](_0xa2f3('0x14'),_0x2db0d2);logger[_0xa2f3('0xe')]('CreateSquareDetailsReport',_0x2db0d2,JSON[_0xa2f3('0xf')](_0x2f74a0));_0x205578(_0x2f74a0);})[_0xa2f3('0x13')](function(_0x14d989){logger[_0xa2f3('0x10')](_0xa2f3('0x14'),_0x14d989[_0xa2f3('0x12')],_0x2db0d2);_0x23309e(_0x1c5c62[_0xa2f3('0x10')](0x1f4,_0x14d989[_0xa2f3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b0b708a..ae5c0a4 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 _0x07a1=['/process/:pid/kill','killProcess','./system.controller','get','index'];(function(_0x299144,_0x461ddc){var _0x2f5bf2=function(_0x11a45f){while(--_0x11a45f){_0x299144['push'](_0x299144['shift']());}};_0x2f5bf2(++_0x461ddc);}(_0x07a1,0x7f));var _0x107a=function(_0x3edefe,_0x156f53){_0x3edefe=_0x3edefe-0x0;var _0x3a2e9c=_0x07a1[_0x3edefe];return _0x3a2e9c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x107a('0x0'));router[_0x107a('0x1')]('/',auth['isAuthenticated'](),controller[_0x107a('0x2')]);router[_0x107a('0x1')](_0x107a('0x3'),auth['isAuthenticated'](),controller[_0x107a('0x4')]);module['exports']=router; \ No newline at end of file +var _0x8700=['isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x14dad5,_0x11bade){var _0x99903a=function(_0x196f23){while(--_0x196f23){_0x14dad5['push'](_0x14dad5['shift']());}};_0x99903a(++_0x11bade);}(_0x8700,0x112));var _0x0870=function(_0x56d036,_0x475943){_0x56d036=_0x56d036-0x0;var _0x3e776d=_0x8700[_0x56d036];return _0x3e776d;};'use strict';var express=require(_0x0870('0x0'));var router=express[_0x0870('0x1')]();var auth=require(_0x0870('0x2'));var controller=require(_0x0870('0x3'));router[_0x0870('0x4')]('/',auth[_0x0870('0x5')](),controller['index']);router['get'](_0x0870('0x6'),auth[_0x0870('0x5')](),controller[_0x0870('0x7')]);module[_0x0870('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index aeab7e4..06f0aab 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 _0x7f35=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill'];(function(_0x47c4fa,_0xbd8e89){var _0x31b52f=function(_0x331106){while(--_0x331106){_0x47c4fa['push'](_0x47c4fa['shift']());}};_0x31b52f(++_0xbd8e89);}(_0x7f35,0x8f));var _0x57f3=function(_0x5340b2,_0x4797f6){_0x5340b2=_0x5340b2-0x0;var _0x2af045=_0x7f35[_0x5340b2];return _0x2af045;};'use strict';var info=require(_0x57f3('0x0'));var exec=require('child_process')[_0x57f3('0x1')];var logger=require(_0x57f3('0x2'))(_0x57f3('0x3'));var util=require(_0x57f3('0x4'));var BPromise=require('bluebird');var _=require(_0x57f3('0x5'));function handleError(_0x1ab9ec,_0x3e6094,_0x3d7954){_0x3e6094=_0x3e6094||0x1f4;return function(_0x3ef9bb){logger['error'](_0x57f3('0x6'),_0x3d7954,_0x3e6094,util[_0x57f3('0x7')](_0x3ef9bb,{'showHidden':![],'depth':null}));delete _0x3ef9bb[_0x57f3('0x8')];_0x1ab9ec[_0x57f3('0x9')](_0x3e6094)[_0x57f3('0xa')](_0x3ef9bb);};}exports[_0x57f3('0xb')]=function(_0x5488e0,_0x1062c6){return info['getAllData']()[_0x57f3('0xc')](function(_0x12e5fd){return _0x1062c6[_0x57f3('0x9')](0xc8)[_0x57f3('0xd')](_0x12e5fd);})['catch'](function(_0x251f3c){return _0x1062c6[_0x57f3('0x9')](0x1f4)['json'](_0x251f3c);});};exports[_0x57f3('0xe')]=function(_0x105269,_0x387e7e){var _0x2fd7d5=[_0x57f3('0xf')];return new BPromise(function(_0x40ad2b,_0xab97ba){return exec(util[_0x57f3('0x10')](_0x57f3('0x11'),_0x105269['params'][_0x57f3('0x12')]),function(_0x3f2030,_0x1146f9,_0x47e037){if(_0x3f2030){return _0xab97ba(_0x3f2030);}return _0x40ad2b(_0x1146f9);});})[_0x57f3('0xc')](function(_0x301102){var _0xaf7ebc=![];var _0x5734f0=_0x301102[_0x57f3('0x13')](/\n/);for(var _0x184a8f=0x0,_0x324e21=_0x2fd7d5[_0x57f3('0x14')];_0x184a8f<_0x324e21,_0xaf7ebc===![];_0x184a8f+=0x1){if(_0x301102[_0x57f3('0x15')](_0x2fd7d5[_0x184a8f])>=0x0){_0xaf7ebc=!![];}}if(!_0xaf7ebc){throw new Error(util['format'](_0x57f3('0x16'),_0x105269[_0x57f3('0x17')][_0x57f3('0x12')]));}process[_0x57f3('0x18')](_0x105269['params'][_0x57f3('0x12')],_0x57f3('0x19'));return _0x387e7e[_0x57f3('0x9')](0xc8)[_0x57f3('0xd')]({'message':util[_0x57f3('0x10')](_0x57f3('0x1a'),_0x105269[_0x57f3('0x17')][_0x57f3('0x12')])});})[_0x57f3('0x1b')](handleError(_0x387e7e,null,_0x57f3('0xe')));}; \ No newline at end of file +var _0xefe9=['params','systeminformation','exec','api','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xefe9,0x83));var _0x9efe=function(_0x488fa6,_0x567d40){_0x488fa6=_0x488fa6-0x0;var _0x2d3045=_0xefe9[_0x488fa6];return _0x2d3045;};'use strict';var info=require(_0x9efe('0x0'));var exec=require('child_process')[_0x9efe('0x1')];var logger=require('../../config/logger')(_0x9efe('0x2'));var util=require(_0x9efe('0x3'));var BPromise=require('bluebird');var _=require(_0x9efe('0x4'));function handleError(_0x51b705,_0x13af43,_0x215663){_0x13af43=_0x13af43||0x1f4;return function(_0x159b4e){logger[_0x9efe('0x5')](_0x9efe('0x6'),_0x215663,_0x13af43,util[_0x9efe('0x7')](_0x159b4e,{'showHidden':![],'depth':null}));delete _0x159b4e[_0x9efe('0x8')];_0x51b705['status'](_0x13af43)[_0x9efe('0x9')](_0x159b4e);};}exports[_0x9efe('0xa')]=function(_0x25e36e,_0x1b3801){return info[_0x9efe('0xb')]()[_0x9efe('0xc')](function(_0x1d3a65){return _0x1b3801[_0x9efe('0xd')](0xc8)[_0x9efe('0xe')](_0x1d3a65);})[_0x9efe('0xf')](function(_0x512054){return _0x1b3801[_0x9efe('0xd')](0x1f4)[_0x9efe('0xe')](_0x512054);});};exports['killProcess']=function(_0x5e3473,_0x5336b5){var _0x2a7dad=[_0x9efe('0x10')];return new BPromise(function(_0x249453,_0x2b2a75){return exec(util[_0x9efe('0x11')](_0x9efe('0x12'),_0x5e3473['params'][_0x9efe('0x13')]),function(_0x54df74,_0x199594,_0x2e78f8){if(_0x54df74){return _0x2b2a75(_0x54df74);}return _0x249453(_0x199594);});})[_0x9efe('0xc')](function(_0x577595){var _0x46d54b=![];var _0x31e30b=_0x577595[_0x9efe('0x14')](/\n/);for(var _0x10ea32=0x0,_0x529357=_0x2a7dad['length'];_0x10ea32<_0x529357,_0x46d54b===![];_0x10ea32+=0x1){if(_0x577595[_0x9efe('0x15')](_0x2a7dad[_0x10ea32])>=0x0){_0x46d54b=!![];}}if(!_0x46d54b){throw new Error(util[_0x9efe('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5e3473['params'][_0x9efe('0x13')]));}process[_0x9efe('0x16')](_0x5e3473['params']['pid'],_0x9efe('0x17'));return _0x5336b5[_0x9efe('0xd')](0xc8)[_0x9efe('0xe')]({'message':util[_0x9efe('0x11')](_0x9efe('0x18'),_0x5e3473[_0x9efe('0x19')][_0x9efe('0x13')])});})[_0x9efe('0xf')](handleError(_0x5336b5,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 5a7184a..56d9409 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 _0x3f4b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1f9464,_0x1aa0a7){var _0x4ab479=function(_0x15c485){while(--_0x15c485){_0x1f9464['push'](_0x1f9464['shift']());}};_0x4ab479(++_0x1aa0a7);}(_0x3f4b,0x1c4));var _0xb3f4=function(_0x5b6999,_0x2ceebb){_0x5b6999=_0x5b6999-0x0;var _0x9fe2bb=_0x3f4b[_0x5b6999];return _0x9fe2bb;};'use strict';var multer=require(_0xb3f4('0x0'));var util=require(_0xb3f4('0x1'));var path=require(_0xb3f4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb3f4('0x3'));var router=express[_0xb3f4('0x4')]();var fs_extra=require(_0xb3f4('0x5'));var auth=require(_0xb3f4('0x6'));var interaction=require(_0xb3f4('0x7'));var config=require(_0xb3f4('0x8'));var controller=require('./tag.controller');router[_0xb3f4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb3f4('0x9')](_0xb3f4('0xa'),auth[_0xb3f4('0xb')](),controller[_0xb3f4('0xc')]);router[_0xb3f4('0xd')]('/',auth[_0xb3f4('0xb')](),controller['create']);router[_0xb3f4('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb3f4('0xf')]);router[_0xb3f4('0x10')](_0xb3f4('0xa'),auth[_0xb3f4('0xb')](),controller[_0xb3f4('0x11')]);module[_0xb3f4('0x12')]=router; \ No newline at end of file +var _0x287f=['get','isAuthenticated','index','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x287f,0xc7));var _0xf287=function(_0x43448d,_0x4f82e8){_0x43448d=_0x43448d-0x0;var _0x3e5844=_0x287f[_0x43448d];return _0x3e5844;};'use strict';var multer=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var path=require(_0xf287('0x2'));var timeout=require(_0xf287('0x3'));var express=require(_0xf287('0x4'));var router=express[_0xf287('0x5')]();var fs_extra=require(_0xf287('0x6'));var auth=require(_0xf287('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf287('0x8'));var controller=require(_0xf287('0x9'));router[_0xf287('0xa')]('/',auth[_0xf287('0xb')](),controller[_0xf287('0xc')]);router['get']('/:id',auth[_0xf287('0xb')](),controller[_0xf287('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf287('0xe'),auth[_0xf287('0xb')](),controller[_0xf287('0xf')]);router[_0xf287('0x10')](_0xf287('0xe'),auth[_0xf287('0xb')](),controller[_0xf287('0x11')]);module[_0xf287('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9070b91..930336a 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 _0x0c71=['name','STRING','#0091EA','exports'];(function(_0x22bda9,_0x4637b7){var _0x43af19=function(_0x5f07bc){while(--_0x5f07bc){_0x22bda9['push'](_0x22bda9['shift']());}};_0x43af19(++_0x4637b7);}(_0x0c71,0xfb));var _0x10c7=function(_0x3ffa92,_0x144ac0){_0x3ffa92=_0x3ffa92-0x0;var _0x344612=_0x0c71[_0x3ffa92];return _0x344612;};'use strict';var Sequelize=require('sequelize');module[_0x10c7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x10c7('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x10c7('0x2')],'defaultValue':_0x10c7('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb84e=['STRING','name','exports'];(function(_0xe3fa84,_0x5350e1){var _0xcd29fe=function(_0x2bcc60){while(--_0x2bcc60){_0xe3fa84['push'](_0xe3fa84['shift']());}};_0xcd29fe(++_0x5350e1);}(_0xb84e,0xbf));var _0xeb84=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0xb84e[_0x50a004];return _0x5e9992;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'name':{'type':Sequelize[_0xeb84('0x1')],'unique':_0xeb84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeb84('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 92ee9cd..1a7108b 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 _0xb469=['to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x140808,_0x2921b0){var _0x446482=function(_0x162c5a){while(--_0x162c5a){_0x140808['push'](_0x140808['shift']());}};_0x446482(++_0x2921b0);}(_0xb469,0x13b));var _0x9b46=function(_0x15f121,_0x4bb20b){_0x15f121=_0x15f121-0x0;var _0x36275b=_0xb469[_0x15f121];return _0x36275b;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){var _0x31ca63=_0x2b6f72[_0x9b46('0x21')]({'plain':!![]});var _0x319930=_0x9b46('0x22');return db[_0x9b46('0x23')][_0x9b46('0x24')]({'where':{'type':_0x319930,'resourceId':_0x31ca63['id']}})['then'](function(){return _0x2b6f72;});})[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x268821,_0x2468be){return function(_0x2a79a5){if(!_0x2a79a5){_0x268821[_0x9b46('0x15')](0x194);}return _0x2a79a5;};}function handleError(_0x50fb4a,_0x3bf5b9){_0x3bf5b9=_0x3bf5b9||0x1f4;return function(_0xee519e){logger[_0x9b46('0x25')](_0xee519e[_0x9b46('0x26')]);if(_0xee519e[_0x9b46('0x27')]){delete _0xee519e[_0x9b46('0x27')];}_0x50fb4a[_0x9b46('0x16')](_0x3bf5b9)[_0x9b46('0x28')](_0xee519e);};}exports[_0x9b46('0x29')]=function(_0x20090a,_0x2e1c51){var _0x5ab8b7={},_0x1f722d={},_0x27f326={'count':0x0,'rows':[]};var _0x807f2=_[_0x9b46('0x2a')](db[_0x9b46('0x2b')][_0x9b46('0x2c')],function(_0xbf8bc5){return{'name':_0xbf8bc5[_0x9b46('0x2d')],'type':_0xbf8bc5[_0x9b46('0x2e')][_0x9b46('0x2f')]};});_0x1f722d[_0x9b46('0x30')]=_['map'](_0x807f2,_0x9b46('0x27'));_0x1f722d['query']=_[_0x9b46('0x31')](_0x20090a[_0x9b46('0x32')]);_0x1f722d[_0x9b46('0x33')]=_['intersection'](_0x1f722d[_0x9b46('0x30')],_0x1f722d[_0x9b46('0x32')]);_0x5ab8b7[_0x9b46('0x34')]=_[_0x9b46('0x35')](_0x1f722d[_0x9b46('0x30')],qs['fields'](_0x20090a['query'][_0x9b46('0x36')]));_0x5ab8b7[_0x9b46('0x34')]=_0x5ab8b7[_0x9b46('0x34')][_0x9b46('0x37')]?_0x5ab8b7['attributes']:_0x1f722d[_0x9b46('0x30')];if(!_0x20090a['query'][_0x9b46('0x38')](_0x9b46('0x39'))){_0x5ab8b7[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0x20090a['query'][_0x9b46('0x1b')]);_0x5ab8b7['offset']=qs[_0x9b46('0x3a')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3a')]);}_0x5ab8b7[_0x9b46('0x3b')]=qs[_0x9b46('0x3c')](_0x20090a[_0x9b46('0x32')][_0x9b46('0x3c')]);_0x5ab8b7[_0x9b46('0x3d')]=qs[_0x9b46('0x33')](_[_0x9b46('0x3e')](_0x20090a[_0x9b46('0x32')],_0x1f722d['filters']),_0x807f2);if(_0x20090a[_0x9b46('0x32')]['filter']){_0x5ab8b7[_0x9b46('0x3d')]=_[_0x9b46('0x3f')](_0x5ab8b7['where'],{'$or':_[_0x9b46('0x2a')](_0x807f2,function(_0x4f953e){if(_0x4f953e[_0x9b46('0x2e')]!=='VIRTUAL'){var _0x443226={};_0x443226[_0x4f953e[_0x9b46('0x27')]]={'$like':'%'+_0x20090a[_0x9b46('0x32')][_0x9b46('0x40')]+'%'};return _0x443226;}})});}_0x5ab8b7=_[_0x9b46('0x3f')]({},_0x5ab8b7,_0x20090a['options']);var _0x4e268c={'where':_0x5ab8b7[_0x9b46('0x3d')]};return db['Tag']['count'](_0x4e268c)['then'](function(_0x4e1911){_0x27f326[_0x9b46('0x1a')]=_0x4e1911;if(_0x20090a['query'][_0x9b46('0x41')]){_0x5ab8b7['include']=[{'all':!![]}];}return db[_0x9b46('0x2b')][_0x9b46('0x42')](_0x5ab8b7);})[_0x9b46('0x20')](function(_0xa14b){_0x27f326[_0x9b46('0x43')]=_0xa14b;return _0x27f326;})[_0x9b46('0x20')](respondWithFilteredResult(_0x2e1c51,_0x5ab8b7))[_0x9b46('0x44')](handleError(_0x2e1c51,null));};exports[_0x9b46('0x45')]=function(_0x148d86,_0x5602a9){var _0x447302={'raw':!![],'where':{'id':_0x148d86[_0x9b46('0x46')]['id']}},_0xe7d0fc={};_0xe7d0fc[_0x9b46('0x30')]=_[_0x9b46('0x31')](db[_0x9b46('0x2b')][_0x9b46('0x2c')]);_0xe7d0fc[_0x9b46('0x32')]=_[_0x9b46('0x31')](_0x148d86[_0x9b46('0x32')]);_0xe7d0fc[_0x9b46('0x33')]=_[_0x9b46('0x35')](_0xe7d0fc[_0x9b46('0x30')],_0xe7d0fc[_0x9b46('0x32')]);_0x447302['attributes']=_['intersection'](_0xe7d0fc[_0x9b46('0x30')],qs[_0x9b46('0x36')](_0x148d86[_0x9b46('0x32')]['fields']));_0x447302['attributes']=_0x447302[_0x9b46('0x34')][_0x9b46('0x37')]?_0x447302[_0x9b46('0x34')]:_0xe7d0fc[_0x9b46('0x30')];if(_0x148d86[_0x9b46('0x32')][_0x9b46('0x41')]){_0x447302['include']=[{'all':!![]}];}_0x447302=_[_0x9b46('0x3f')]({},_0x447302,_0x148d86[_0x9b46('0x47')]);return db[_0x9b46('0x2b')]['find'](_0x447302)[_0x9b46('0x20')](handleEntityNotFound(_0x5602a9,null))['then'](respondWithResult(_0x5602a9,null))[_0x9b46('0x44')](handleError(_0x5602a9,null));};exports[_0x9b46('0x48')]=function(_0x16e6d8,_0x566bad){return db[_0x9b46('0x2b')][_0x9b46('0x48')](_0x16e6d8[_0x9b46('0x49')],{})[_0x9b46('0x20')](function(_0x3d4c13){var _0x373ffd=_0x16e6d8['user'][_0x9b46('0x21')]({'plain':!![]});if(!_0x373ffd)throw new Error(_0x9b46('0x4a'));if(_0x373ffd[_0x9b46('0x4b')]===_0x9b46('0x4c')){var _0x362311=_0x3d4c13[_0x9b46('0x21')]({'plain':!![]});var _0x4a1df0=_0x9b46('0x22');return db['UserProfileSection'][_0x9b46('0x4d')]({'where':{'name':_0x4a1df0,'userProfileId':_0x373ffd[_0x9b46('0x4e')]},'raw':!![]})[_0x9b46('0x20')](function(_0x33d9ac){if(_0x33d9ac&&_0x33d9ac[_0x9b46('0x4f')]===0x0){return db['UserProfileResource'][_0x9b46('0x48')]({'name':_0x362311[_0x9b46('0x27')],'resourceId':_0x362311['id'],'type':_0x33d9ac[_0x9b46('0x27')],'sectionId':_0x33d9ac['id']},{})[_0x9b46('0x20')](function(){return _0x3d4c13;});}else{return _0x3d4c13;}})[_0x9b46('0x44')](function(_0x14080e){logger[_0x9b46('0x25')](_0x9b46('0x50'),_0x14080e);throw _0x14080e;});}return _0x3d4c13;})[_0x9b46('0x20')](respondWithResult(_0x566bad,0xc9))[_0x9b46('0x44')](handleError(_0x566bad,null));};exports[_0x9b46('0x1f')]=function(_0x4d473f,_0x551a64){if(_0x4d473f['body']['id']){delete _0x4d473f[_0x9b46('0x49')]['id'];}return db['Tag'][_0x9b46('0x4d')]({'where':{'id':_0x4d473f['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x551a64,null))['then'](saveUpdates(_0x4d473f[_0x9b46('0x49')],null))[_0x9b46('0x20')](respondWithResult(_0x551a64,null))[_0x9b46('0x44')](handleError(_0x551a64,null));};exports[_0x9b46('0x24')]=function(_0x35f71d,_0x5bcaad){return db[_0x9b46('0x2b')][_0x9b46('0x4d')]({'where':{'id':_0x35f71d[_0x9b46('0x46')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x5bcaad,null))[_0x9b46('0x20')](removeEntity(_0x5bcaad,null))['catch'](handleError(_0x5bcaad,null));}; \ No newline at end of file +var _0xb4e6=['findAll','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Tag','includeAll','include'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xb4e6[_0x3b4b1d];return _0x488c36;};'use strict';var emlformat=require(_0x6b4e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4e('0x1'));var jsonpatch=require(_0x6b4e('0x2'));var rp=require(_0x6b4e('0x3'));var moment=require(_0x6b4e('0x4'));var BPromise=require(_0x6b4e('0x5'));var Mustache=require(_0x6b4e('0x6'));var util=require(_0x6b4e('0x7'));var path=require('path');var sox=require(_0x6b4e('0x8'));var csv=require(_0x6b4e('0x9'));var ejs=require(_0x6b4e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b4e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b4e('0xd'));var Papa=require(_0x6b4e('0xe'));var Redis=require(_0x6b4e('0xf'));var authService=require(_0x6b4e('0x10'));var qs=require(_0x6b4e('0x11'));var as=require(_0x6b4e('0x12'));var hardwareService=require(_0x6b4e('0x13'));var logger=require('../../config/logger')(_0x6b4e('0x14'));var utils=require(_0x6b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4e('0x16'));var db=require(_0x6b4e('0x17'))['db'];function respondWithStatusCode(_0x432399,_0x2b2ce0){_0x2b2ce0=_0x2b2ce0||0xcc;return function(_0x9f8f6c){if(_0x9f8f6c){return _0x432399[_0x6b4e('0x18')](_0x2b2ce0);}return _0x432399[_0x6b4e('0x19')](_0x2b2ce0)['end']();};}function respondWithResult(_0x36f8a5,_0x29bdee){_0x29bdee=_0x29bdee||0xc8;return function(_0x4788cf){if(_0x4788cf){return _0x36f8a5[_0x6b4e('0x19')](_0x29bdee)['json'](_0x4788cf);}};}function respondWithFilteredResult(_0x355f10,_0x2195c1){return function(_0x3ba513){if(_0x3ba513){var _0x42e265=typeof _0x2195c1[_0x6b4e('0x1a')]===_0x6b4e('0x1b')&&typeof _0x2195c1['limit']==='undefined';var _0x67496d=_0x3ba513[_0x6b4e('0x1c')];var _0x10d2b1=_0x42e265?0x0:_0x2195c1[_0x6b4e('0x1a')];var _0x101d0a=_0x42e265?_0x3ba513[_0x6b4e('0x1c')]:_0x2195c1[_0x6b4e('0x1a')]+_0x2195c1[_0x6b4e('0x1d')];var _0x35aee1;if(_0x101d0a>=_0x67496d){_0x101d0a=_0x67496d;_0x35aee1=0xc8;}else{_0x35aee1=0xce;}_0x355f10[_0x6b4e('0x19')](_0x35aee1);return _0x355f10[_0x6b4e('0x1e')]('Content-Range',_0x10d2b1+'-'+_0x101d0a+'/'+_0x67496d)[_0x6b4e('0x1f')](_0x3ba513);}return null;};}function patchUpdates(_0x248fea){return function(_0x31fb9d){try{jsonpatch[_0x6b4e('0x20')](_0x31fb9d,_0x248fea,!![]);}catch(_0x5e5dcd){return BPromise[_0x6b4e('0x21')](_0x5e5dcd);}return _0x31fb9d['save']();};}function saveUpdates(_0x2503a5,_0x163dea){return function(_0x165a99){if(_0x165a99){return _0x165a99[_0x6b4e('0x22')](_0x2503a5)[_0x6b4e('0x23')](function(_0x346566){return _0x346566;});}return null;};}function removeEntity(_0x3e636f,_0x5c33be){return function(_0x2e36db){if(_0x2e36db){return _0x2e36db['destroy']()[_0x6b4e('0x23')](function(){var _0x884b7e=_0x2e36db[_0x6b4e('0x24')]({'plain':!![]});var _0xdba4fe='Tags';return db[_0x6b4e('0x25')][_0x6b4e('0x26')]({'where':{'type':_0xdba4fe,'resourceId':_0x884b7e['id']}})['then'](function(){return _0x2e36db;});})[_0x6b4e('0x23')](function(){_0x3e636f[_0x6b4e('0x19')](0xcc)[_0x6b4e('0x27')]();});}};}function handleEntityNotFound(_0x44b399,_0x5bfe9e){return function(_0x2d42be){if(!_0x2d42be){_0x44b399[_0x6b4e('0x18')](0x194);}return _0x2d42be;};}function handleError(_0x57650d,_0x130c21){_0x130c21=_0x130c21||0x1f4;return function(_0x453beb){logger[_0x6b4e('0x28')](_0x453beb[_0x6b4e('0x29')]);if(_0x453beb['name']){delete _0x453beb[_0x6b4e('0x2a')];}_0x57650d[_0x6b4e('0x19')](_0x130c21)['send'](_0x453beb);};}exports[_0x6b4e('0x2b')]=function(_0x3f9868,_0x37b636){var _0x53c242={},_0x5c2200={},_0x11156e={'count':0x0,'rows':[]};var _0x2e6414=_[_0x6b4e('0x2c')](db['Tag'][_0x6b4e('0x2d')],function(_0x421177){return{'name':_0x421177[_0x6b4e('0x2e')],'type':_0x421177['type']['key']};});_0x5c2200[_0x6b4e('0x2f')]=_['map'](_0x2e6414,_0x6b4e('0x2a'));_0x5c2200[_0x6b4e('0x30')]=_['keys'](_0x3f9868[_0x6b4e('0x30')]);_0x5c2200[_0x6b4e('0x31')]=_[_0x6b4e('0x32')](_0x5c2200[_0x6b4e('0x2f')],_0x5c2200['query']);_0x53c242['attributes']=_[_0x6b4e('0x32')](_0x5c2200[_0x6b4e('0x2f')],qs[_0x6b4e('0x33')](_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x33')]));_0x53c242[_0x6b4e('0x34')]=_0x53c242[_0x6b4e('0x34')][_0x6b4e('0x35')]?_0x53c242[_0x6b4e('0x34')]:_0x5c2200[_0x6b4e('0x2f')];if(!_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x36')](_0x6b4e('0x37'))){_0x53c242['limit']=qs[_0x6b4e('0x1d')](_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x1d')]);_0x53c242['offset']=qs[_0x6b4e('0x1a')](_0x3f9868['query'][_0x6b4e('0x1a')]);}_0x53c242[_0x6b4e('0x38')]=qs[_0x6b4e('0x39')](_0x3f9868['query']['sort']);_0x53c242[_0x6b4e('0x3a')]=qs[_0x6b4e('0x31')](_['pick'](_0x3f9868['query'],_0x5c2200[_0x6b4e('0x31')]),_0x2e6414);if(_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x3b')]){_0x53c242[_0x6b4e('0x3a')]=_[_0x6b4e('0x3c')](_0x53c242[_0x6b4e('0x3a')],{'$or':_[_0x6b4e('0x2c')](_0x2e6414,function(_0xc3f4e4){if(_0xc3f4e4[_0x6b4e('0x3d')]!==_0x6b4e('0x3e')){var _0x1f2c38={};_0x1f2c38[_0xc3f4e4['name']]={'$like':'%'+_0x3f9868[_0x6b4e('0x30')][_0x6b4e('0x3b')]+'%'};return _0x1f2c38;}})});}_0x53c242=_['merge']({},_0x53c242,_0x3f9868[_0x6b4e('0x3f')]);var _0x29353b={'where':_0x53c242[_0x6b4e('0x3a')]};return db[_0x6b4e('0x40')][_0x6b4e('0x1c')](_0x29353b)['then'](function(_0x4e545c){_0x11156e[_0x6b4e('0x1c')]=_0x4e545c;if(_0x3f9868['query'][_0x6b4e('0x41')]){_0x53c242[_0x6b4e('0x42')]=[{'all':!![]}];}return db['Tag'][_0x6b4e('0x43')](_0x53c242);})['then'](function(_0x3dec0f){_0x11156e['rows']=_0x3dec0f;return _0x11156e;})[_0x6b4e('0x23')](respondWithFilteredResult(_0x37b636,_0x53c242))[_0x6b4e('0x44')](handleError(_0x37b636,null));};exports[_0x6b4e('0x45')]=function(_0x30401b,_0x555be1){var _0x17185e={'raw':!![],'where':{'id':_0x30401b[_0x6b4e('0x46')]['id']}},_0x244a9f={};_0x244a9f['model']=_[_0x6b4e('0x47')](db[_0x6b4e('0x40')][_0x6b4e('0x2d')]);_0x244a9f[_0x6b4e('0x30')]=_[_0x6b4e('0x47')](_0x30401b[_0x6b4e('0x30')]);_0x244a9f[_0x6b4e('0x31')]=_[_0x6b4e('0x32')](_0x244a9f[_0x6b4e('0x2f')],_0x244a9f['query']);_0x17185e[_0x6b4e('0x34')]=_[_0x6b4e('0x32')](_0x244a9f[_0x6b4e('0x2f')],qs[_0x6b4e('0x33')](_0x30401b[_0x6b4e('0x30')]['fields']));_0x17185e[_0x6b4e('0x34')]=_0x17185e['attributes'][_0x6b4e('0x35')]?_0x17185e[_0x6b4e('0x34')]:_0x244a9f[_0x6b4e('0x2f')];if(_0x30401b[_0x6b4e('0x30')]['includeAll']){_0x17185e[_0x6b4e('0x42')]=[{'all':!![]}];}_0x17185e=_[_0x6b4e('0x3c')]({},_0x17185e,_0x30401b[_0x6b4e('0x3f')]);return db['Tag'][_0x6b4e('0x48')](_0x17185e)[_0x6b4e('0x23')](handleEntityNotFound(_0x555be1,null))[_0x6b4e('0x23')](respondWithResult(_0x555be1,null))[_0x6b4e('0x44')](handleError(_0x555be1,null));};exports[_0x6b4e('0x49')]=function(_0x33c797,_0x289dfa){return db[_0x6b4e('0x40')][_0x6b4e('0x49')](_0x33c797[_0x6b4e('0x4a')],{})['then'](function(_0x2106fb){var _0x1527f1=_0x33c797[_0x6b4e('0x4b')]['get']({'plain':!![]});if(!_0x1527f1)throw new Error(_0x6b4e('0x4c'));if(_0x1527f1[_0x6b4e('0x4d')]===_0x6b4e('0x4b')){var _0x738ee5=_0x2106fb[_0x6b4e('0x24')]({'plain':!![]});var _0x104c2a=_0x6b4e('0x4e');return db[_0x6b4e('0x4f')][_0x6b4e('0x48')]({'where':{'name':_0x104c2a,'userProfileId':_0x1527f1[_0x6b4e('0x50')]},'raw':!![]})[_0x6b4e('0x23')](function(_0x49f81a){if(_0x49f81a&&_0x49f81a['autoAssociation']===0x0){return db[_0x6b4e('0x25')][_0x6b4e('0x49')]({'name':_0x738ee5[_0x6b4e('0x2a')],'resourceId':_0x738ee5['id'],'type':_0x49f81a[_0x6b4e('0x2a')],'sectionId':_0x49f81a['id']},{})['then'](function(){return _0x2106fb;});}else{return _0x2106fb;}})[_0x6b4e('0x44')](function(_0x31071f){logger[_0x6b4e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31071f);throw _0x31071f;});}return _0x2106fb;})[_0x6b4e('0x23')](respondWithResult(_0x289dfa,0xc9))[_0x6b4e('0x44')](handleError(_0x289dfa,null));};exports[_0x6b4e('0x22')]=function(_0x282c4d,_0x3ce7b8){if(_0x282c4d['body']['id']){delete _0x282c4d[_0x6b4e('0x4a')]['id'];}return db['Tag'][_0x6b4e('0x48')]({'where':{'id':_0x282c4d[_0x6b4e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ce7b8,null))[_0x6b4e('0x23')](saveUpdates(_0x282c4d['body'],null))[_0x6b4e('0x23')](respondWithResult(_0x3ce7b8,null))[_0x6b4e('0x44')](handleError(_0x3ce7b8,null));};exports[_0x6b4e('0x26')]=function(_0x3bd916,_0x11b868){return db['Tag'][_0x6b4e('0x48')]({'where':{'id':_0x3bd916[_0x6b4e('0x46')]['id']}})[_0x6b4e('0x23')](handleEntityNotFound(_0x11b868,null))['then'](removeEntity(_0x11b868,null))['catch'](handleError(_0x11b868,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fe9b282..50106c7 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 _0xa575=['path','rimraf','../../config/environment','./tag.attributes','Tag','tools_tags','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa575,0x150));var _0x5a57=function(_0x34c276,_0x5bb256){_0x34c276=_0x34c276-0x0;var _0x6cec06=_0xa575[_0x34c276];return _0x6cec06;};'use strict';var _=require(_0x5a57('0x0'));var util=require('util');var logger=require(_0x5a57('0x1'))(_0x5a57('0x2'));var moment=require('moment');var BPromise=require(_0x5a57('0x3'));var rp=require(_0x5a57('0x4'));var fs=require('fs');var path=require(_0x5a57('0x5'));var rimraf=require(_0x5a57('0x6'));var config=require(_0x5a57('0x7'));var attributes=require(_0x5a57('0x8'));module['exports']=function(_0x11a1c6,_0xf9690b){return _0x11a1c6['define'](_0x5a57('0x9'),attributes,{'tableName':_0x5a57('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2617=['tools_tags','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./tag.attributes','exports','Tag'];(function(_0x3ee9b1,_0xbc78c7){var _0x583028=function(_0x20f6da){while(--_0x20f6da){_0x3ee9b1['push'](_0x3ee9b1['shift']());}};_0x583028(++_0xbc78c7);}(_0x2617,0x175));var _0x7261=function(_0x13e758,_0x231d3c){_0x13e758=_0x13e758-0x0;var _0x55df43=_0x2617[_0x13e758];return _0x55df43;};'use strict';var _=require(_0x7261('0x0'));var util=require('util');var logger=require(_0x7261('0x1'))(_0x7261('0x2'));var moment=require(_0x7261('0x3'));var BPromise=require(_0x7261('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7261('0x5'));var rimraf=require(_0x7261('0x6'));var config=require(_0x7261('0x7'));var attributes=require(_0x7261('0x8'));module[_0x7261('0x9')]=function(_0xd9f836,_0x6f8c17){return _0xd9f836['define'](_0x7261('0xa'),attributes,{'tableName':_0x7261('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 c0f2d03..47396f2 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 _0x495e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x40c5f7,_0x1752a7){var _0x132694=function(_0x37b03b){while(--_0x37b03b){_0x40c5f7['push'](_0x40c5f7['shift']());}};_0x132694(++_0x1752a7);}(_0x495e,0xfb));var _0xe495=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x495e[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});} \ No newline at end of file +var _0x3140=['jayson/promise','client','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2d145c,_0x2e9c93){var _0x4382c6=function(_0x172729){while(--_0x172729){_0x2d145c['push'](_0x2d145c['shift']());}};_0x4382c6(++_0x2e9c93);}(_0x3140,0xaf));var _0x0314=function(_0x5c2c72,_0x22cf09){_0x5c2c72=_0x5c2c72-0x0;var _0x11c44c=_0x3140[_0x5c2c72];return _0x11c44c;};'use strict';var _=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var moment=require(_0x0314('0x2'));var BPromise=require(_0x0314('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0314('0x4'))['db'];var utils=require(_0x0314('0x5'));var logger=require(_0x0314('0x6'))(_0x0314('0x7'));var config=require(_0x0314('0x8'));var jayson=require(_0x0314('0x9'));var client=jayson[_0x0314('0xa')][_0x0314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11ee94,_0x44762d,_0x176944){return new BPromise(function(_0x495b27,_0x26031f){return client[_0x0314('0xc')](_0x11ee94,_0x176944)['then'](function(_0x5e9bca){logger[_0x0314('0xd')]('Tag,\x20%s,\x20%s',_0x44762d,_0x0314('0xe'));logger[_0x0314('0xf')](_0x0314('0x10'),_0x44762d,_0x0314('0xe'),JSON[_0x0314('0x11')](_0x5e9bca));if(_0x5e9bca[_0x0314('0x12')]){if(_0x5e9bca['error'][_0x0314('0x13')]===0x1f4){logger[_0x0314('0x12')](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x26031f(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}logger['error'](_0x0314('0x14'),_0x44762d,_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);return _0x495b27(_0x5e9bca[_0x0314('0x12')][_0x0314('0x15')]);}else{logger[_0x0314('0xd')](_0x0314('0x14'),_0x44762d,_0x0314('0xe'));_0x495b27(_0x5e9bca['result'][_0x0314('0x15')]);}})[_0x0314('0x16')](function(_0x1f23c6){logger['error'](_0x0314('0x14'),_0x44762d,_0x1f23c6);_0x26031f(_0x1f23c6);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a18b20b..46530a2 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_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/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 3b404e4..beb9af8 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 _0x757a=['exports','STRING'];(function(_0x1efa26,_0x431db3){var _0x16a0b4=function(_0x8a0359){while(--_0x8a0359){_0x1efa26['push'](_0x1efa26['shift']());}};_0x16a0b4(++_0x431db3);}(_0x757a,0xde));var _0xa757=function(_0x4ed8eb,_0x4fa5d3){_0x4ed8eb=_0x4ed8eb-0x0;var _0x3ff638=_0x757a[_0x4ed8eb];return _0x3ff638;};'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 +var _0x0713=['STRING','name'];(function(_0x2f98d4,_0x533fd7){var _0xf199dc=function(_0x4efa7f){while(--_0x4efa7f){_0x2f98d4['push'](_0x2f98d4['shift']());}};_0xf199dc(++_0x533fd7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index db49589..a07d4de 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 _0xf5cf=['end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','Team','includeAll','include','findAll','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','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','UserVoiceQueue','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','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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','toLowerCase','pick','options','get','capitalize','addQueues','isValidChannel','Unknown\x20channel','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','defaults','TeamVoiceQueue','penalty','User','Queue','Queue:save','online','UserVoiceQueueRt','upsert','isNil','SIP/%s','interface','all','TeamVoicePrefix','removeAgents','emit','Queue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register'];(function(_0x286e78,_0x2458b5){var _0x4448c1=function(_0x1f8574){while(--_0x1f8574){_0x286e78['push'](_0x286e78['shift']());}};_0x4448c1(++_0x2458b5);}(_0xf5cf,0x11c));var _0xff5c=function(_0x2635dd,_0x5317f6){_0x2635dd=_0x2635dd-0x0;var _0x575c04=_0xf5cf[_0x2635dd];return _0x575c04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff5c('0x0'));var zipdir=require(_0xff5c('0x1'));var jsonpatch=require(_0xff5c('0x2'));var rp=require(_0xff5c('0x3'));var moment=require('moment');var BPromise=require(_0xff5c('0x4'));var Mustache=require(_0xff5c('0x5'));var util=require('util');var path=require(_0xff5c('0x6'));var sox=require(_0xff5c('0x7'));var csv=require('to-csv');var ejs=require(_0xff5c('0x8'));var fs=require('fs');var fs_extra=require(_0xff5c('0x9'));var _=require(_0xff5c('0xa'));var squel=require('squel');var crypto=require(_0xff5c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xff5c('0xc'));var toCsv=require(_0xff5c('0xd'));var querystring=require(_0xff5c('0xe'));var Papa=require(_0xff5c('0xf'));var Redis=require(_0xff5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff5c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff5c('0x12'));var logger=require(_0xff5c('0x13'))(_0xff5c('0x14'));var utils=require(_0xff5c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff5c('0x16'))['db'];config[_0xff5c('0x17')]=_['defaults'](config[_0xff5c('0x17')],{'host':_0xff5c('0x18'),'port':0x18eb});var socket=require(_0xff5c('0x19'))(new Redis(config[_0xff5c('0x17')]));require(_0xff5c('0x1a'))[_0xff5c('0x1b')](socket);function respondWithStatusCode(_0x459346,_0x5d5f67){_0x5d5f67=_0x5d5f67||0xcc;return function(_0x4f2bcf){if(_0x4f2bcf){return _0x459346['sendStatus'](_0x5d5f67);}return _0x459346['status'](_0x5d5f67)[_0xff5c('0x1c')]();};}function respondWithResult(_0x530bc9,_0x4b10c6){_0x4b10c6=_0x4b10c6||0xc8;return function(_0x17bc74){if(_0x17bc74){return _0x530bc9[_0xff5c('0x1d')](_0x4b10c6)[_0xff5c('0x1e')](_0x17bc74);}};}function respondWithFilteredResult(_0x19e9ad,_0x187c6d){return function(_0x367e09){if(_0x367e09){var _0x46d2a6=typeof _0x187c6d[_0xff5c('0x1f')]===_0xff5c('0x20')&&typeof _0x187c6d[_0xff5c('0x21')]===_0xff5c('0x20');var _0x59af22=_0x367e09[_0xff5c('0x22')];var _0x1a3d0c=_0x46d2a6?0x0:_0x187c6d['offset'];var _0x1806dd=_0x46d2a6?_0x367e09[_0xff5c('0x22')]:_0x187c6d[_0xff5c('0x1f')]+_0x187c6d[_0xff5c('0x21')];var _0x3cea96;if(_0x1806dd>=_0x59af22){_0x1806dd=_0x59af22;_0x3cea96=0xc8;}else{_0x3cea96=0xce;}_0x19e9ad['status'](_0x3cea96);return _0x19e9ad[_0xff5c('0x23')](_0xff5c('0x24'),_0x1a3d0c+'-'+_0x1806dd+'/'+_0x59af22)[_0xff5c('0x1e')](_0x367e09);}return null;};}function patchUpdates(_0x17d2a1){return function(_0x103cdb){try{jsonpatch[_0xff5c('0x25')](_0x103cdb,_0x17d2a1,!![]);}catch(_0x202410){return BPromise[_0xff5c('0x26')](_0x202410);}return _0x103cdb[_0xff5c('0x27')]();};}function saveUpdates(_0x399d66,_0x1cd8ab){return function(_0x514f3d){if(_0x514f3d){return _0x514f3d[_0xff5c('0x28')](_0x399d66)[_0xff5c('0x29')](function(_0x56df34){return _0x56df34;});}return null;};}function handleEntityNotFound(_0x3ad571,_0x1605bf){return function(_0x137ed6){if(!_0x137ed6){_0x3ad571[_0xff5c('0x2a')](0x194);}return _0x137ed6;};}function handleError(_0xdf658,_0x213da8){_0x213da8=_0x213da8||0x1f4;return function(_0x2c96d5){logger['error'](_0x2c96d5[_0xff5c('0x2b')]);if(_0x2c96d5['name']){delete _0x2c96d5['name'];}_0xdf658[_0xff5c('0x1d')](_0x213da8)[_0xff5c('0x2c')](_0x2c96d5);};}exports['index']=function(_0x18f3d5,_0x40b42e){var _0x107263={},_0x51a3c2={},_0x221eb5={'count':0x0,'rows':[]};var _0x40d8bf=_[_0xff5c('0x2d')](db['Team'][_0xff5c('0x2e')],function(_0x5375ec){return{'name':_0x5375ec[_0xff5c('0x2f')],'type':_0x5375ec['type'][_0xff5c('0x30')]};});_0x51a3c2[_0xff5c('0x31')]=_[_0xff5c('0x2d')](_0x40d8bf,_0xff5c('0x32'));_0x51a3c2[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x18f3d5[_0xff5c('0x33')]);_0x51a3c2[_0xff5c('0x35')]=_['intersection'](_0x51a3c2[_0xff5c('0x31')],_0x51a3c2[_0xff5c('0x33')]);_0x107263[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x51a3c2[_0xff5c('0x31')],qs['fields'](_0x18f3d5['query'][_0xff5c('0x38')]));_0x107263[_0xff5c('0x36')]=_0x107263[_0xff5c('0x36')][_0xff5c('0x39')]?_0x107263[_0xff5c('0x36')]:_0x51a3c2[_0xff5c('0x31')];if(!_0x18f3d5[_0xff5c('0x33')]['hasOwnProperty'](_0xff5c('0x3a'))){_0x107263[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x18f3d5['query']['limit']);_0x107263[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x18f3d5[_0xff5c('0x33')]['offset']);}_0x107263[_0xff5c('0x3b')]=qs[_0xff5c('0x3c')](_0x18f3d5[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x107263[_0xff5c('0x3d')]=qs[_0xff5c('0x35')](_['pick'](_0x18f3d5[_0xff5c('0x33')],_0x51a3c2[_0xff5c('0x35')]),_0x40d8bf);if(_0x18f3d5['query'][_0xff5c('0x3e')]){_0x107263[_0xff5c('0x3d')]=_['merge'](_0x107263[_0xff5c('0x3d')],{'$or':_['map'](_0x40d8bf,function(_0x1e70b2){if(_0x1e70b2[_0xff5c('0x3f')]!==_0xff5c('0x40')){var _0x1f9519={};_0x1f9519[_0x1e70b2[_0xff5c('0x32')]]={'$like':'%'+_0x18f3d5['query'][_0xff5c('0x3e')]+'%'};return _0x1f9519;}})});}_0x107263=_[_0xff5c('0x41')]({},_0x107263,_0x18f3d5['options']);var _0x229449={'where':_0x107263[_0xff5c('0x3d')]};return db[_0xff5c('0x42')]['count'](_0x229449)['then'](function(_0x5bda89){_0x221eb5[_0xff5c('0x22')]=_0x5bda89;if(_0x18f3d5['query'][_0xff5c('0x43')]){_0x107263[_0xff5c('0x44')]=[{'all':!![]}];}return db['Team'][_0xff5c('0x45')](_0x107263);})[_0xff5c('0x29')](function(_0x5f4e24){_0x221eb5['rows']=_0x5f4e24;return _0x221eb5;})[_0xff5c('0x29')](respondWithFilteredResult(_0x40b42e,_0x107263))[_0xff5c('0x46')](handleError(_0x40b42e,null));};exports[_0xff5c('0x47')]=function(_0x3e6b17,_0x383749){var _0x463fc0={'raw':![],'where':{'id':_0x3e6b17[_0xff5c('0x48')]['id']}},_0x24effd={};_0x24effd[_0xff5c('0x31')]=_[_0xff5c('0x34')](db['Team'][_0xff5c('0x2e')]);_0x24effd[_0xff5c('0x33')]=_['keys'](_0x3e6b17['query']);_0x24effd[_0xff5c('0x35')]=_[_0xff5c('0x37')](_0x24effd[_0xff5c('0x31')],_0x24effd[_0xff5c('0x33')]);_0x463fc0[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x24effd['model'],qs[_0xff5c('0x38')](_0x3e6b17[_0xff5c('0x33')][_0xff5c('0x38')]));_0x463fc0['attributes']=_0x463fc0[_0xff5c('0x36')][_0xff5c('0x39')]?_0x463fc0[_0xff5c('0x36')]:_0x24effd['model'];if(_0x3e6b17[_0xff5c('0x33')][_0xff5c('0x43')]){_0x463fc0[_0xff5c('0x44')]=[{'all':!![]}];}_0x463fc0=_[_0xff5c('0x41')]({},_0x463fc0,_0x3e6b17['options']);return db[_0xff5c('0x42')]['find'](_0x463fc0)[_0xff5c('0x29')](handleEntityNotFound(_0x383749,null))[_0xff5c('0x29')](respondWithResult(_0x383749,null))[_0xff5c('0x46')](handleError(_0x383749,null));};exports[_0xff5c('0x49')]=function(_0x1e8e55,_0x447712){return db[_0xff5c('0x42')]['create'](_0x1e8e55[_0xff5c('0x4a')],{})['then'](function(_0xa0d36b){var _0xbdc384=_0x1e8e55['user']['get']({'plain':!![]});if(!_0xbdc384)throw new Error(_0xff5c('0x4b'));if(_0xbdc384['role']===_0xff5c('0x4c')){var _0x3ec6da=_0xa0d36b['get']({'plain':!![]});var _0x5f5aba=_0xff5c('0x4d');return db[_0xff5c('0x4e')][_0xff5c('0x4f')]({'where':{'name':_0x5f5aba,'userProfileId':_0xbdc384['userProfileId']},'raw':!![]})[_0xff5c('0x29')](function(_0x1c80a3){if(_0x1c80a3&&_0x1c80a3[_0xff5c('0x50')]===0x0){return db[_0xff5c('0x51')][_0xff5c('0x49')]({'name':_0x3ec6da[_0xff5c('0x32')],'resourceId':_0x3ec6da['id'],'type':_0x1c80a3[_0xff5c('0x32')],'sectionId':_0x1c80a3['id']},{})[_0xff5c('0x29')](function(){return _0xa0d36b;});}else{return _0xa0d36b;}})[_0xff5c('0x46')](function(_0x37e211){logger[_0xff5c('0x52')](_0xff5c('0x53'),_0x37e211);throw _0x37e211;});}return _0xa0d36b;})['then'](respondWithResult(_0x447712,0xc9))[_0xff5c('0x46')](handleError(_0x447712,null));};exports[_0xff5c('0x28')]=function(_0x3bde89,_0x10db2f){if(_0x3bde89[_0xff5c('0x4a')]['id']){delete _0x3bde89['body']['id'];}return db[_0xff5c('0x42')][_0xff5c('0x4f')]({'where':{'id':_0x3bde89[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x10db2f,null))[_0xff5c('0x29')](saveUpdates(_0x3bde89[_0xff5c('0x4a')],null))['then'](respondWithResult(_0x10db2f,null))[_0xff5c('0x46')](handleError(_0x10db2f,null));};exports[_0xff5c('0x54')]=function(_0x442465,_0x5045e5){var _0x6e61f4=_0x442465[_0xff5c('0x48')]['id'];var _0x50c36a=[];return db[_0xff5c('0x55')][_0xff5c('0x56')](function(_0x42d00f){var _0x36b136=_0xff5c('0x57')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x36b136,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f})['then'](function(_0x534130){_0x50c36a=_['map'](_0x534130,function(_0x2e5093){return Number(_0x2e5093[_0xff5c('0x5b')]);});})[_0xff5c('0x29')](function(){var _0x585ff5=_0xff5c('0x5c')+_0x6e61f4;return db['sequelize']['query'](_0x585ff5,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x1e3f9f){var _0x125b5d=_['map'](_0x1e3f9f,function(_0x2d6efc){return Number(_0x2d6efc['VoiceQueueId']);});return db[_0xff5c('0x5d')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'VoiceQueueId':{'$in':_0x125b5d}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x580d64='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x6e61f4;return db[_0xff5c('0x55')]['query'](_0x580d64,{'type':db[_0xff5c('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x42d00f});})['then'](function(_0x6126fb){var _0x5864e8=_[_0xff5c('0x2d')](_0x6126fb,function(_0x4fefc7){return Number(_0x4fefc7[_0xff5c('0x5e')]);});return db[_0xff5c('0x5f')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'MailQueueId':{'$in':_0x5864e8}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x1f4b1e=_0xff5c('0x60')+_0x6e61f4;return db['sequelize']['query'](_0x1f4b1e,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x18ffc9){var _0x383674=_['map'](_0x18ffc9,function(_0x545225){return Number(_0x545225[_0xff5c('0x61')]);});return db[_0xff5c('0x62')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'SmsQueueId':{'$in':_0x383674}},'transaction':_0x42d00f});})['then'](function(){var _0x21afcb=_0xff5c('0x63')+_0x6e61f4;return db['sequelize'][_0xff5c('0x33')](_0x21afcb,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x36d630){var _0x58d2fd=_[_0xff5c('0x2d')](_0x36d630,function(_0x180909){return Number(_0x180909[_0xff5c('0x64')]);});return db[_0xff5c('0x65')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'ChatQueueId':{'$in':_0x58d2fd}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x5470c9=_0xff5c('0x66')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x5470c9,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x5c5ad6){var _0x4513cc=_[_0xff5c('0x2d')](_0x5c5ad6,function(_0x58824a){return Number(_0x58824a[_0xff5c('0x67')]);});return db[_0xff5c('0x68')]['destroy']({'where':{'UserId':{'$in':_0x50c36a},'FaxQueueId':{'$in':_0x4513cc}},'transaction':_0x42d00f});})['then'](function(){var _0x1b5d84=_0xff5c('0x69')+_0x6e61f4;return db[_0xff5c('0x55')][_0xff5c('0x33')](_0x1b5d84,{'type':db[_0xff5c('0x58')][_0xff5c('0x59')]['SELECT'],'raw':!![],'transaction':_0x42d00f});})[_0xff5c('0x29')](function(_0x3a3250){var _0x18c5d8=_[_0xff5c('0x2d')](_0x3a3250,function(_0xc04be3){return Number(_0xc04be3['OpenchannelQueueId']);});return db[_0xff5c('0x6a')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'OpenchannelQueueId':{'$in':_0x18c5d8}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){var _0x201c83=_0xff5c('0x6b')+_0x6e61f4;return db[_0xff5c('0x55')]['query'](_0x201c83,{'type':db['Sequelize'][_0xff5c('0x59')][_0xff5c('0x5a')],'raw':!![],'transaction':_0x42d00f});})['then'](function(_0x571964){var _0x2e5284=_['map'](_0x571964,function(_0x189520){return Number(_0x189520[_0xff5c('0x6c')]);});return db['UserWhatsappQueue'][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'WhatsappQueueId':{'$in':_0x2e5284}},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){return db['TeamVoicePrefix'][_0xff5c('0x4f')]({'where':{'TeamId':_0x6e61f4}});})[_0xff5c('0x29')](function(_0x40fd39){if(_0x40fd39===null){return;}return db[_0xff5c('0x6d')][_0xff5c('0x54')]({'where':{'UserId':{'$in':_0x50c36a},'VoicePrefixId':_0x40fd39[_0xff5c('0x6e')]},'transaction':_0x42d00f});})[_0xff5c('0x29')](function(){return db[_0xff5c('0x42')][_0xff5c('0x54')]({'where':{'id':_0x6e61f4},'cascade':!![],'transaction':_0x42d00f});})['then'](function(_0x12c047){if(_0x12c047===0x0){_0x5045e5[_0xff5c('0x2a')](0x194);}else{return db[_0xff5c('0x51')][_0xff5c('0x54')]({'where':{'type':_0xff5c('0x4d'),'resourceId':_0x6e61f4},'cascade':!![],'transaction':_0x42d00f})[_0xff5c('0x29')](function(){_0x5045e5['status'](0xcc)[_0xff5c('0x1c')]();});}})[_0xff5c('0x46')](function(_0xe4a2a1){_0x5045e5[_0xff5c('0x1d')](0x1f4)[_0xff5c('0x2c')](_0xe4a2a1);});});};exports[_0xff5c('0x6f')]=function(_0x5a23c2,_0x44ae4c,_0x3d437a){return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x5a23c2[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x44ae4c,null))[_0xff5c('0x29')](function(_0x4ee16c){if(!_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x71')]||!utils['isValidChannel'](_0x5a23c2[_0xff5c('0x33')]['channel'])){throw new db[(_0xff5c('0x58'))][(_0xff5c('0x72'))]('Unknown\x20channel');}var _0x5b3141={};var _0x4aa4a0={};_0x4aa4a0['model']=_[_0xff5c('0x34')](db[_['capitalize'](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x71')][_0xff5c('0x73')]())+'Queue'][_0xff5c('0x2e')]);_0x4aa4a0[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x5a23c2[_0xff5c('0x33')]);_0x4aa4a0['filters']=_[_0xff5c('0x37')](_0x4aa4a0['model'],_0x4aa4a0[_0xff5c('0x33')]);_0x5b3141[_0xff5c('0x36')]=_[_0xff5c('0x37')](_0x4aa4a0['model'],qs[_0xff5c('0x38')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x38')]));_0x5b3141[_0xff5c('0x36')]=_0x5b3141[_0xff5c('0x36')][_0xff5c('0x39')]?_0x5b3141['attributes']:_0x4aa4a0[_0xff5c('0x31')];_0x5b3141[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x21')]);_0x5b3141[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x1f')]);_0x5b3141[_0xff5c('0x3b')]=qs['sort'](_0x5a23c2[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x5b3141['where']=qs['filters'](_[_0xff5c('0x74')](_0x5a23c2['query'],_0x4aa4a0['filters']));_0x5b3141=_[_0xff5c('0x41')]({},_0x5b3141,_0x5a23c2[_0xff5c('0x75')]);return _0x4ee16c[_0xff5c('0x76')+_[_0xff5c('0x77')](_0x5a23c2['query']['channel']['toLowerCase']())+'Queues'](_0x5b3141);})[_0xff5c('0x29')](respondWithResult(_0x44ae4c,null))['catch'](handleError(_0x44ae4c,null));};exports[_0xff5c('0x78')]=function(_0x2957f6,_0x58b2c4,_0x114b41){return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x2957f6[_0xff5c('0x48')]['id']}})[_0xff5c('0x29')](function(_0x46b2dd){if(_0x46b2dd){if(!_0x2957f6['body'][_0xff5c('0x71')]||!utils[_0xff5c('0x79')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x71')])){throw new db[(_0xff5c('0x58'))][(_0xff5c('0x72'))](_0xff5c('0x7a'));}return _0x46b2dd[_0xff5c('0x7b')+_[_0xff5c('0x77')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x71')][_0xff5c('0x73')]())+_0xff5c('0x7c')](_0x2957f6[_0xff5c('0x4a')][_0xff5c('0x7d')]);}return null;})['then'](handleEntityNotFound(_0x58b2c4,null))[_0xff5c('0x29')](respondWithStatusCode(_0x58b2c4,null))[_0xff5c('0x46')](handleError(_0x58b2c4,null));};exports[_0xff5c('0x7e')]=function(_0x2286ac,_0x4ca3e3,_0x5c2343){return db['Team'][_0xff5c('0x70')]({'where':{'id':_0x2286ac['params']['id']}})[_0xff5c('0x29')](function(_0x434f32){if(_0x434f32){if(!_0x2286ac[_0xff5c('0x33')][_0xff5c('0x71')]||!utils[_0xff5c('0x79')](_0x2286ac[_0xff5c('0x33')]['channel'])){throw new db['Sequelize'][(_0xff5c('0x72'))](_0xff5c('0x7a'));}return _0x434f32[_0xff5c('0x7f')+_['capitalize'](_0x2286ac['query'][_0xff5c('0x71')][_0xff5c('0x73')]())+_0xff5c('0x7c')](_0x2286ac['query'][_0xff5c('0x7d')]);}return null;})[_0xff5c('0x29')](handleEntityNotFound(_0x4ca3e3,null))[_0xff5c('0x29')](respondWithStatusCode(_0x4ca3e3,null))[_0xff5c('0x46')](handleError(_0x4ca3e3,null));};exports[_0xff5c('0x80')]=function(_0x310bf4,_0xf584cd){var _0x296b95=_[_0xff5c('0x81')](_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')])?_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')]:[_0x310bf4[_0xff5c('0x4a')][_0xff5c('0x7d')]];var _0x302922=_0x310bf4[_0xff5c('0x48')]['id'];return db[_0xff5c('0x42')]['find']({'where':{'id':_0x302922}})[_0xff5c('0x29')](handleEntityNotFound(_0xf584cd,null))['then'](function(_0x5e6c23){if(_0x5e6c23){var _0x5ad9a5=[_0xff5c('0x82'),_0xff5c('0x83'),_0xff5c('0x84'),_0xff5c('0x85'),_0xff5c('0x86'),_0xff5c('0x87'),_0xff5c('0x88')];return db['sequelize'][_0xff5c('0x56')](function(_0x2f8d2e){var _0x276962=_[_0xff5c('0x2d')](_0x5ad9a5,function(_0x32e71a){var _0x14d3d8={'attributes':['id','name']};if(_0x32e71a===_0xff5c('0x82')){_0x14d3d8['through']={'attributes':['penalty']};}return _0x5e6c23[_0xff5c('0x76')+_0x32e71a+_0xff5c('0x7c')](_0x14d3d8)[_0xff5c('0x29')](function(_0x234c66){var _0x45f998=_['map'](_0x234c66,function(_0x3e33e7){var _0x3a40e9=_[_0xff5c('0x2d')](_0x296b95,function(_0x358345){var _0x28a5f4={'where':{'UserId':_0x358345,[_0x32e71a+'QueueId']:_0x3e33e7['id']},'transaction':_0x2f8d2e};if(_0x32e71a===_0xff5c('0x82')){_0x28a5f4[_0xff5c('0x89')]={'penalty':_0x3e33e7[_0xff5c('0x8a')][_0xff5c('0x8b')]};}return db[_0xff5c('0x8c')+_0x32e71a+_0xff5c('0x8d')]['findOrCreate'](_0x28a5f4)[_0xff5c('0x29')](function(){socket['emit'](_0xff5c('0x4c')+_0x32e71a+_0xff5c('0x8e'),{'UserId':_0x358345,[_0x32e71a+'QueueId']:_0x3e33e7['id']});if(_0x32e71a!=='Voice'){return;}return db[_0xff5c('0x8c')][_0xff5c('0x45')]({'where':{'id':_0x296b95,'online':0x1},'attributes':['id',_0xff5c('0x32'),_0xff5c('0x8f'),'voicePause','interface'],'raw':!![]})[_0xff5c('0x29')](function(_0x4fedf6){var _0x1f2200=_['map'](_0x4fedf6,function(_0x2850bb){return db[_0xff5c('0x90')][_0xff5c('0x91')]({'membername':_0x2850bb[_0xff5c('0x32')],'UserId':_0x2850bb['id'],'queue_name':_0x3e33e7[_0xff5c('0x32')],'VoiceQueueId':_0x3e33e7['id'],'interface':_[_0xff5c('0x92')](_0x2850bb['interface'])?util['format'](_0xff5c('0x93'),_0x2850bb['name']):_0x2850bb[_0xff5c('0x94')],'paused':_0x2850bb['voicePause']||![],'penalty':_0x3e33e7[_0xff5c('0x8a')][_0xff5c('0x8b')]},{'transaction':_0x2f8d2e});});return Promise[_0xff5c('0x95')](_0x1f2200);});});});return Promise[_0xff5c('0x95')](_0x3a40e9);});return Promise[_0xff5c('0x95')](_0x45f998);})[_0xff5c('0x29')](function(){return db[_0xff5c('0x96')][_0xff5c('0x70')]({'where':{'teamId':_0x302922}})[_0xff5c('0x29')](function(_0x244410){if(_0x244410){var _0x4ab2a7=_[_0xff5c('0x2d')](_0x296b95,function(_0xbfdff6){db[_0xff5c('0x6d')]['upsert']({'UserId':_0xbfdff6,'VoicePrefixId':_0x244410[_0xff5c('0x6e')]});});return Promise[_0xff5c('0x95')](_0x4ab2a7);}});});});return Promise['all'](_0x276962)[_0xff5c('0x29')](function(){return _0x5e6c23[_0xff5c('0x80')](_0x296b95,{'transaction':_0x2f8d2e})['spread'](function(_0x1e59d7){return _0x1e59d7;});});});}})[_0xff5c('0x29')](respondWithResult(_0xf584cd,null))['catch'](handleError(_0xf584cd,null));};exports[_0xff5c('0x97')]=function(_0x2f7ed2,_0x6d81eb){var _0x308de8=_[_0xff5c('0x81')](_0x2f7ed2[_0xff5c('0x33')]['ids'])?_0x2f7ed2['query'][_0xff5c('0x7d')]:[_0x2f7ed2[_0xff5c('0x33')][_0xff5c('0x7d')]];var _0x29dafe=_0x2f7ed2[_0xff5c('0x48')]['id'];return db[_0xff5c('0x42')][_0xff5c('0x4f')]({'where':{'id':_0x29dafe}})[_0xff5c('0x29')](handleEntityNotFound(_0x6d81eb,null))[_0xff5c('0x29')](function(_0x5997cd){if(_0x5997cd){var _0xf571c9=['Voice',_0xff5c('0x83'),_0xff5c('0x84'),_0xff5c('0x85'),_0xff5c('0x86'),_0xff5c('0x87'),_0xff5c('0x88')];return db[_0xff5c('0x55')][_0xff5c('0x56')](function(_0x507359){var _0x11d8cb=_[_0xff5c('0x2d')](_0xf571c9,function(_0x5c950d){var _0x588c79={'attributes':['id',_0xff5c('0x32')]};return _0x5997cd['get'+_0x5c950d+_0xff5c('0x7c')](_0x588c79)[_0xff5c('0x29')](function(_0x2289c1){var _0x3994ae=_[_0xff5c('0x2d')](_0x2289c1,function(_0x522b8e){return _0x522b8e[_0xff5c('0x97')](_0x308de8,{'transaction':_0x507359})[_0xff5c('0x29')](function(){var _0x2d5542=_['map'](_0x308de8,function(_0x5e33e1){socket[_0xff5c('0x98')](_0xff5c('0x4c')+_0x5c950d+_0xff5c('0x99'),{'UserId':Number(_0x5e33e1),[_0x5c950d+'QueueId']:_0x522b8e['id']});if(_0x5c950d!=='Voice'){return;}return db[_0xff5c('0x90')][_0xff5c('0x54')]({'where':{'VoiceQueueId':_0x522b8e['id'],'UserId':_0x5e33e1},'transaction':_0x507359});});return Promise['all'](_0x2d5542);});});return Promise[_0xff5c('0x95')](_0x3994ae);});});return Promise[_0xff5c('0x95')](_0x11d8cb)[_0xff5c('0x29')](function(){return _0x5997cd[_0xff5c('0x97')](_0x308de8,{'transaction':_0x507359});})[_0xff5c('0x29')](function(){return db[_0xff5c('0x96')][_0xff5c('0x70')]({'where':{'teamId':_0x29dafe}})[_0xff5c('0x29')](function(_0x4ad934){if(_0x4ad934){var _0x4b6445=_[_0xff5c('0x2d')](_0x308de8,function(_0x20c92e){db[_0xff5c('0x6d')]['destroy']({'where':{'UserId':_0x20c92e,'VoicePrefixId':_0x4ad934[_0xff5c('0x6e')]}});});return Promise[_0xff5c('0x95')](_0x4b6445);}});});});}})[_0xff5c('0x29')](respondWithStatusCode(_0x6d81eb,null))[_0xff5c('0x46')](handleError(_0x6d81eb,null));};exports[_0xff5c('0x9a')]=function(_0x274fdc,_0x1d29e5,_0x435206){var _0x3565b7={};var _0x51e83b={};var _0xc032f2;var _0x2d08d6;return db[_0xff5c('0x42')][_0xff5c('0x70')]({'where':{'id':_0x274fdc['params']['id']}})[_0xff5c('0x29')](handleEntityNotFound(_0x1d29e5,null))[_0xff5c('0x29')](function(_0x91dd14){if(_0x91dd14){_0xc032f2=_0x91dd14;_0x51e83b[_0xff5c('0x31')]=_[_0xff5c('0x34')](db[_0xff5c('0x8c')][_0xff5c('0x2e')]);_0x51e83b[_0xff5c('0x33')]=_[_0xff5c('0x34')](_0x274fdc['query']);_0x51e83b[_0xff5c('0x35')]=_['intersection'](_0x51e83b[_0xff5c('0x31')],_0x51e83b[_0xff5c('0x33')]);_0x3565b7['attributes']=_['intersection'](_0x51e83b[_0xff5c('0x31')],qs[_0xff5c('0x38')](_0x274fdc['query'][_0xff5c('0x38')]));_0x3565b7[_0xff5c('0x36')]=_0x3565b7['attributes'][_0xff5c('0x39')]?_0x3565b7[_0xff5c('0x36')]:_0x51e83b[_0xff5c('0x31')];_0x3565b7['order']=qs[_0xff5c('0x3c')](_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3c')]);_0x3565b7[_0xff5c('0x3d')]=qs[_0xff5c('0x35')](_[_0xff5c('0x74')](_0x274fdc[_0xff5c('0x33')],_0x51e83b[_0xff5c('0x35')]));if(_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3e')]){_0x3565b7[_0xff5c('0x3d')]=_[_0xff5c('0x41')](_0x3565b7[_0xff5c('0x3d')],{'$or':_[_0xff5c('0x2d')](_0x3565b7['attributes'],function(_0x328334){var _0x236328={};_0x236328[_0x328334]={'$like':'%'+_0x274fdc[_0xff5c('0x33')][_0xff5c('0x3e')]+'%'};return _0x236328;})});}_0x3565b7=_[_0xff5c('0x41')]({},_0x3565b7,_0x274fdc['options']);return _0xc032f2['getAgents'](_0x3565b7);}})[_0xff5c('0x29')](function(_0x1b2b7d){if(_0x1b2b7d){_0x2d08d6=_0x1b2b7d[_0xff5c('0x39')];if(!_0x274fdc[_0xff5c('0x33')][_0xff5c('0x9b')](_0xff5c('0x3a'))){_0x3565b7[_0xff5c('0x21')]=qs[_0xff5c('0x21')](_0x274fdc[_0xff5c('0x33')]['limit']);_0x3565b7[_0xff5c('0x1f')]=qs[_0xff5c('0x1f')](_0x274fdc[_0xff5c('0x33')][_0xff5c('0x1f')]);}return _0xc032f2['getAgents'](_0x3565b7);}})[_0xff5c('0x29')](function(_0x1207f7){if(_0x1207f7){return _0x1207f7?{'count':_0x2d08d6,'rows':_0x1207f7}:null;}})[_0xff5c('0x29')](respondWithResult(_0x1d29e5,null))[_0xff5c('0x46')](handleError(_0x1d29e5,null));}; \ No newline at end of file +var _0x9629=['save','update','then','name','send','index','rawAttributes','fieldName','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','Team','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','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','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','channel','ValidationError','Unknown\x20channel','keys','capitalize','Queue','toLowerCase','Queues','addQueues','findOne','isValidChannel','removeQueues','ids','addAgents','isArray','Chat','Mail','Sms','Fax','Openchannel','through','penalty','Voice','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','upsert','isNil','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject'];(function(_0x30bc55,_0x86c98f){var _0x58d155=function(_0x451e81){while(--_0x451e81){_0x30bc55['push'](_0x30bc55['shift']());}};_0x58d155(++_0x86c98f);}(_0x9629,0x71));var _0x9962=function(_0x5e29a4,_0x20b60e){_0x5e29a4=_0x5e29a4-0x0;var _0x47f669=_0x9629[_0x5e29a4];return _0x47f669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9962('0x0'));var zipdir=require(_0x9962('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9962('0x2'));var moment=require('moment');var BPromise=require(_0x9962('0x3'));var Mustache=require('mustache');var util=require(_0x9962('0x4'));var path=require(_0x9962('0x5'));var sox=require(_0x9962('0x6'));var csv=require(_0x9962('0x7'));var ejs=require(_0x9962('0x8'));var fs=require('fs');var fs_extra=require(_0x9962('0x9'));var _=require('lodash');var squel=require(_0x9962('0xa'));var crypto=require(_0x9962('0xb'));var jsforce=require(_0x9962('0xc'));var deskjs=require(_0x9962('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9962('0xe'));var Papa=require('papaparse');var Redis=require(_0x9962('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9962('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9962('0x11'))(_0x9962('0x12'));var utils=require('../../config/utils');var config=require(_0x9962('0x13'));var licenseUtil=require(_0x9962('0x14'));var db=require('../../mysqldb')['db'];config[_0x9962('0x15')]=_[_0x9962('0x16')](config[_0x9962('0x15')],{'host':_0x9962('0x17'),'port':0x18eb});var socket=require(_0x9962('0x18'))(new Redis(config[_0x9962('0x15')]));require('./team.socket')[_0x9962('0x19')](socket);function respondWithStatusCode(_0x55f405,_0x216c8e){_0x216c8e=_0x216c8e||0xcc;return function(_0x4941b1){if(_0x4941b1){return _0x55f405[_0x9962('0x1a')](_0x216c8e);}return _0x55f405['status'](_0x216c8e)[_0x9962('0x1b')]();};}function respondWithResult(_0x220c2d,_0x5a2217){_0x5a2217=_0x5a2217||0xc8;return function(_0x12759f){if(_0x12759f){return _0x220c2d[_0x9962('0x1c')](_0x5a2217)[_0x9962('0x1d')](_0x12759f);}};}function respondWithFilteredResult(_0x556364,_0x3afcb0){return function(_0x4d43ff){if(_0x4d43ff){var _0x4eff98=typeof _0x3afcb0[_0x9962('0x1e')]===_0x9962('0x1f')&&typeof _0x3afcb0['limit']===_0x9962('0x1f');var _0x475964=_0x4d43ff[_0x9962('0x20')];var _0x534271=_0x4eff98?0x0:_0x3afcb0[_0x9962('0x1e')];var _0x58b779=_0x4eff98?_0x4d43ff[_0x9962('0x20')]:_0x3afcb0[_0x9962('0x1e')]+_0x3afcb0[_0x9962('0x21')];var _0x5aea11;if(_0x58b779>=_0x475964){_0x58b779=_0x475964;_0x5aea11=0xc8;}else{_0x5aea11=0xce;}_0x556364['status'](_0x5aea11);return _0x556364['set'](_0x9962('0x22'),_0x534271+'-'+_0x58b779+'/'+_0x475964)[_0x9962('0x1d')](_0x4d43ff);}return null;};}function patchUpdates(_0x1e240c){return function(_0x4e5e93){try{jsonpatch['apply'](_0x4e5e93,_0x1e240c,!![]);}catch(_0x3478c1){return BPromise[_0x9962('0x23')](_0x3478c1);}return _0x4e5e93[_0x9962('0x24')]();};}function saveUpdates(_0x45c446,_0x38d95a){return function(_0x33c8fd){if(_0x33c8fd){return _0x33c8fd[_0x9962('0x25')](_0x45c446)[_0x9962('0x26')](function(_0x55ae1e){return _0x55ae1e;});}return null;};}function handleEntityNotFound(_0x4cb6e6,_0x224a4a){return function(_0x4b98c5){if(!_0x4b98c5){_0x4cb6e6[_0x9962('0x1a')](0x194);}return _0x4b98c5;};}function handleError(_0x508e1e,_0x1d6734){_0x1d6734=_0x1d6734||0x1f4;return function(_0x512872){logger['error'](_0x512872['stack']);if(_0x512872[_0x9962('0x27')]){delete _0x512872[_0x9962('0x27')];}_0x508e1e[_0x9962('0x1c')](_0x1d6734)[_0x9962('0x28')](_0x512872);};}exports[_0x9962('0x29')]=function(_0x494ac3,_0x2a3ef0){var _0x38e986={},_0xcb5e87={},_0x243003={'count':0x0,'rows':[]};var _0x4107b1=_['map'](db['Team'][_0x9962('0x2a')],function(_0x9be9d5){return{'name':_0x9be9d5[_0x9962('0x2b')],'type':_0x9be9d5['type']['key']};});_0xcb5e87['model']=_[_0x9962('0x2c')](_0x4107b1,_0x9962('0x27'));_0xcb5e87[_0x9962('0x2d')]=_['keys'](_0x494ac3[_0x9962('0x2d')]);_0xcb5e87[_0x9962('0x2e')]=_[_0x9962('0x2f')](_0xcb5e87[_0x9962('0x30')],_0xcb5e87[_0x9962('0x2d')]);_0x38e986[_0x9962('0x31')]=_['intersection'](_0xcb5e87[_0x9962('0x30')],qs['fields'](_0x494ac3[_0x9962('0x2d')][_0x9962('0x32')]));_0x38e986[_0x9962('0x31')]=_0x38e986[_0x9962('0x31')][_0x9962('0x33')]?_0x38e986[_0x9962('0x31')]:_0xcb5e87[_0x9962('0x30')];if(!_0x494ac3[_0x9962('0x2d')][_0x9962('0x34')](_0x9962('0x35'))){_0x38e986[_0x9962('0x21')]=qs['limit'](_0x494ac3[_0x9962('0x2d')]['limit']);_0x38e986[_0x9962('0x1e')]=qs[_0x9962('0x1e')](_0x494ac3[_0x9962('0x2d')][_0x9962('0x1e')]);}_0x38e986[_0x9962('0x36')]=qs[_0x9962('0x37')](_0x494ac3[_0x9962('0x2d')][_0x9962('0x37')]);_0x38e986['where']=qs['filters'](_[_0x9962('0x38')](_0x494ac3[_0x9962('0x2d')],_0xcb5e87[_0x9962('0x2e')]),_0x4107b1);if(_0x494ac3[_0x9962('0x2d')]['filter']){_0x38e986[_0x9962('0x39')]=_['merge'](_0x38e986['where'],{'$or':_[_0x9962('0x2c')](_0x4107b1,function(_0x299b16){if(_0x299b16[_0x9962('0x3a')]!==_0x9962('0x3b')){var _0x3f5f12={};_0x3f5f12[_0x299b16[_0x9962('0x27')]]={'$like':'%'+_0x494ac3[_0x9962('0x2d')][_0x9962('0x3c')]+'%'};return _0x3f5f12;}})});}_0x38e986=_[_0x9962('0x3d')]({},_0x38e986,_0x494ac3['options']);var _0xf49537={'where':_0x38e986['where']};return db['Team'][_0x9962('0x20')](_0xf49537)[_0x9962('0x26')](function(_0x2cf408){_0x243003[_0x9962('0x20')]=_0x2cf408;if(_0x494ac3[_0x9962('0x2d')][_0x9962('0x3e')]){_0x38e986[_0x9962('0x3f')]=[{'all':!![]}];}return db['Team'][_0x9962('0x40')](_0x38e986);})[_0x9962('0x26')](function(_0x447037){_0x243003[_0x9962('0x41')]=_0x447037;return _0x243003;})['then'](respondWithFilteredResult(_0x2a3ef0,_0x38e986))[_0x9962('0x42')](handleError(_0x2a3ef0,null));};exports[_0x9962('0x43')]=function(_0x2d54fe,_0x87d1c9){var _0x38782b={'raw':![],'where':{'id':_0x2d54fe[_0x9962('0x44')]['id']}},_0x41dbad={};_0x41dbad[_0x9962('0x30')]=_['keys'](db[_0x9962('0x45')]['rawAttributes']);_0x41dbad[_0x9962('0x2d')]=_['keys'](_0x2d54fe[_0x9962('0x2d')]);_0x41dbad[_0x9962('0x2e')]=_[_0x9962('0x2f')](_0x41dbad[_0x9962('0x30')],_0x41dbad[_0x9962('0x2d')]);_0x38782b[_0x9962('0x31')]=_[_0x9962('0x2f')](_0x41dbad[_0x9962('0x30')],qs[_0x9962('0x32')](_0x2d54fe[_0x9962('0x2d')][_0x9962('0x32')]));_0x38782b[_0x9962('0x31')]=_0x38782b['attributes']['length']?_0x38782b['attributes']:_0x41dbad[_0x9962('0x30')];if(_0x2d54fe[_0x9962('0x2d')][_0x9962('0x3e')]){_0x38782b['include']=[{'all':!![]}];}_0x38782b=_['merge']({},_0x38782b,_0x2d54fe[_0x9962('0x46')]);return db[_0x9962('0x45')][_0x9962('0x47')](_0x38782b)[_0x9962('0x26')](handleEntityNotFound(_0x87d1c9,null))[_0x9962('0x26')](respondWithResult(_0x87d1c9,null))[_0x9962('0x42')](handleError(_0x87d1c9,null));};exports[_0x9962('0x48')]=function(_0x139312,_0x4f24a4){return db[_0x9962('0x45')][_0x9962('0x48')](_0x139312['body'],{})[_0x9962('0x26')](function(_0xef71a){var _0x421ed3=_0x139312[_0x9962('0x49')]['get']({'plain':!![]});if(!_0x421ed3)throw new Error(_0x9962('0x4a'));if(_0x421ed3[_0x9962('0x4b')]===_0x9962('0x49')){var _0x11a1f2=_0xef71a[_0x9962('0x4c')]({'plain':!![]});var _0x16c6cb=_0x9962('0x4d');return db['UserProfileSection'][_0x9962('0x47')]({'where':{'name':_0x16c6cb,'userProfileId':_0x421ed3['userProfileId']},'raw':!![]})[_0x9962('0x26')](function(_0x755ef0){if(_0x755ef0&&_0x755ef0[_0x9962('0x4e')]===0x0){return db[_0x9962('0x4f')]['create']({'name':_0x11a1f2['name'],'resourceId':_0x11a1f2['id'],'type':_0x755ef0['name'],'sectionId':_0x755ef0['id']},{})[_0x9962('0x26')](function(){return _0xef71a;});}else{return _0xef71a;}})[_0x9962('0x42')](function(_0x44f54b){logger['error'](_0x9962('0x50'),_0x44f54b);throw _0x44f54b;});}return _0xef71a;})['then'](respondWithResult(_0x4f24a4,0xc9))[_0x9962('0x42')](handleError(_0x4f24a4,null));};exports['update']=function(_0x15960c,_0x113934){if(_0x15960c[_0x9962('0x51')]['id']){delete _0x15960c[_0x9962('0x51')]['id'];}return db[_0x9962('0x45')][_0x9962('0x47')]({'where':{'id':_0x15960c['params']['id']}})[_0x9962('0x26')](handleEntityNotFound(_0x113934,null))['then'](saveUpdates(_0x15960c[_0x9962('0x51')],null))[_0x9962('0x26')](respondWithResult(_0x113934,null))['catch'](handleError(_0x113934,null));};exports['destroy']=function(_0x1b5198,_0x2c7225){var _0x268455=_0x1b5198[_0x9962('0x44')]['id'];var _0x4092d6=[];return db[_0x9962('0x52')][_0x9962('0x53')](function(_0x507950){var _0x2f17c1=_0x9962('0x54')+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0x2f17c1,{'type':db[_0x9962('0x55')][_0x9962('0x56')][_0x9962('0x57')],'raw':!![],'transaction':_0x507950})[_0x9962('0x26')](function(_0x4f9eae){_0x4092d6=_[_0x9962('0x2c')](_0x4f9eae,function(_0x4ceb86){return Number(_0x4ceb86[_0x9962('0x58')]);});})['then'](function(){var _0x49d169=_0x9962('0x59')+_0x268455;return db['sequelize'][_0x9962('0x2d')](_0x49d169,{'type':db[_0x9962('0x55')][_0x9962('0x56')][_0x9962('0x57')],'raw':!![],'transaction':_0x507950});})[_0x9962('0x26')](function(_0x580840){var _0x3c69a0=_[_0x9962('0x2c')](_0x580840,function(_0x48c72c){return Number(_0x48c72c['VoiceQueueId']);});return db[_0x9962('0x5a')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'VoiceQueueId':{'$in':_0x3c69a0}},'transaction':_0x507950});})[_0x9962('0x26')](function(){var _0x14725b=_0x9962('0x5c')+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0x14725b,{'type':db[_0x9962('0x55')][_0x9962('0x56')]['SELECT'],'raw':!![],'transaction':_0x507950});})['then'](function(_0x4a6563){var _0x44bba8=_[_0x9962('0x2c')](_0x4a6563,function(_0x2b7aed){return Number(_0x2b7aed[_0x9962('0x5d')]);});return db[_0x9962('0x5e')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'MailQueueId':{'$in':_0x44bba8}},'transaction':_0x507950});})[_0x9962('0x26')](function(){var _0x1d1b10=_0x9962('0x5f')+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0x1d1b10,{'type':db['Sequelize']['QueryTypes'][_0x9962('0x57')],'raw':!![],'transaction':_0x507950});})['then'](function(_0x2e5cfb){var _0x5a22ce=_[_0x9962('0x2c')](_0x2e5cfb,function(_0x1eea80){return Number(_0x1eea80[_0x9962('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x4092d6},'SmsQueueId':{'$in':_0x5a22ce}},'transaction':_0x507950});})['then'](function(){var _0x571ad1='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x268455;return db['sequelize'][_0x9962('0x2d')](_0x571ad1,{'type':db['Sequelize']['QueryTypes'][_0x9962('0x57')],'raw':!![],'transaction':_0x507950});})[_0x9962('0x26')](function(_0x3a7099){var _0x51bb22=_[_0x9962('0x2c')](_0x3a7099,function(_0x1fa049){return Number(_0x1fa049[_0x9962('0x61')]);});return db[_0x9962('0x62')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'ChatQueueId':{'$in':_0x51bb22}},'transaction':_0x507950});})[_0x9962('0x26')](function(){var _0xf0fa78='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0xf0fa78,{'type':db[_0x9962('0x55')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x507950});})[_0x9962('0x26')](function(_0x3977de){var _0x19724f=_['map'](_0x3977de,function(_0x4d7f81){return Number(_0x4d7f81[_0x9962('0x63')]);});return db[_0x9962('0x64')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'FaxQueueId':{'$in':_0x19724f}},'transaction':_0x507950});})['then'](function(){var _0x25a2f0='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0x25a2f0,{'type':db[_0x9962('0x55')][_0x9962('0x56')][_0x9962('0x57')],'raw':!![],'transaction':_0x507950});})['then'](function(_0x403dd4){var _0x357e61=_[_0x9962('0x2c')](_0x403dd4,function(_0x11d0c3){return Number(_0x11d0c3[_0x9962('0x65')]);});return db['UserOpenchannelQueue'][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'OpenchannelQueueId':{'$in':_0x357e61}},'transaction':_0x507950});})[_0x9962('0x26')](function(){var _0x2ae1bb='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x268455;return db[_0x9962('0x52')][_0x9962('0x2d')](_0x2ae1bb,{'type':db['Sequelize'][_0x9962('0x56')][_0x9962('0x57')],'raw':!![],'transaction':_0x507950});})[_0x9962('0x26')](function(_0x2d752c){var _0x5780c3=_[_0x9962('0x2c')](_0x2d752c,function(_0x274646){return Number(_0x274646[_0x9962('0x66')]);});return db[_0x9962('0x67')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'WhatsappQueueId':{'$in':_0x5780c3}},'transaction':_0x507950});})[_0x9962('0x26')](function(){return db['TeamVoicePrefix'][_0x9962('0x47')]({'where':{'TeamId':_0x268455}});})['then'](function(_0x13720f){if(_0x13720f===null){return;}return db[_0x9962('0x68')][_0x9962('0x5b')]({'where':{'UserId':{'$in':_0x4092d6},'VoicePrefixId':_0x13720f[_0x9962('0x69')]},'transaction':_0x507950});})[_0x9962('0x26')](function(){return db[_0x9962('0x45')]['destroy']({'where':{'id':_0x268455},'cascade':!![],'transaction':_0x507950});})[_0x9962('0x26')](function(_0x35a9da){if(_0x35a9da===0x0){_0x2c7225[_0x9962('0x1a')](0x194);}else{return db[_0x9962('0x4f')]['destroy']({'where':{'type':'Teams','resourceId':_0x268455},'cascade':!![],'transaction':_0x507950})[_0x9962('0x26')](function(){_0x2c7225[_0x9962('0x1c')](0xcc)['end']();});}})[_0x9962('0x42')](function(_0x1ac3ba){_0x2c7225[_0x9962('0x1c')](0x1f4)[_0x9962('0x28')](_0x1ac3ba);});});};exports['getQueues']=function(_0x48b668,_0x4cff5b,_0xc2c50d){return db[_0x9962('0x45')]['findOne']({'where':{'id':_0x48b668[_0x9962('0x44')]['id']}})[_0x9962('0x26')](handleEntityNotFound(_0x4cff5b,null))[_0x9962('0x26')](function(_0x425938){if(!_0x48b668[_0x9962('0x2d')][_0x9962('0x6a')]||!utils['isValidChannel'](_0x48b668[_0x9962('0x2d')]['channel'])){throw new db[(_0x9962('0x55'))][(_0x9962('0x6b'))](_0x9962('0x6c'));}var _0x5d81cd={};var _0xc8b39b={};_0xc8b39b[_0x9962('0x30')]=_[_0x9962('0x6d')](db[_[_0x9962('0x6e')](_0x48b668[_0x9962('0x2d')]['channel']['toLowerCase']())+_0x9962('0x6f')]['rawAttributes']);_0xc8b39b[_0x9962('0x2d')]=_[_0x9962('0x6d')](_0x48b668[_0x9962('0x2d')]);_0xc8b39b[_0x9962('0x2e')]=_['intersection'](_0xc8b39b[_0x9962('0x30')],_0xc8b39b['query']);_0x5d81cd[_0x9962('0x31')]=_['intersection'](_0xc8b39b[_0x9962('0x30')],qs[_0x9962('0x32')](_0x48b668[_0x9962('0x2d')]['fields']));_0x5d81cd[_0x9962('0x31')]=_0x5d81cd[_0x9962('0x31')][_0x9962('0x33')]?_0x5d81cd['attributes']:_0xc8b39b[_0x9962('0x30')];_0x5d81cd['limit']=qs[_0x9962('0x21')](_0x48b668[_0x9962('0x2d')][_0x9962('0x21')]);_0x5d81cd['offset']=qs['offset'](_0x48b668[_0x9962('0x2d')][_0x9962('0x1e')]);_0x5d81cd[_0x9962('0x36')]=qs[_0x9962('0x37')](_0x48b668[_0x9962('0x2d')][_0x9962('0x37')]);_0x5d81cd[_0x9962('0x39')]=qs[_0x9962('0x2e')](_[_0x9962('0x38')](_0x48b668['query'],_0xc8b39b[_0x9962('0x2e')]));_0x5d81cd=_['merge']({},_0x5d81cd,_0x48b668[_0x9962('0x46')]);return _0x425938['get'+_[_0x9962('0x6e')](_0x48b668['query'][_0x9962('0x6a')][_0x9962('0x70')]())+_0x9962('0x71')](_0x5d81cd);})['then'](respondWithResult(_0x4cff5b,null))[_0x9962('0x42')](handleError(_0x4cff5b,null));};exports[_0x9962('0x72')]=function(_0x54ff12,_0x2a256c,_0x57d929){return db[_0x9962('0x45')][_0x9962('0x73')]({'where':{'id':_0x54ff12[_0x9962('0x44')]['id']}})[_0x9962('0x26')](function(_0x4f2860){if(_0x4f2860){if(!_0x54ff12[_0x9962('0x51')][_0x9962('0x6a')]||!utils[_0x9962('0x74')](_0x54ff12[_0x9962('0x51')][_0x9962('0x6a')])){throw new db[(_0x9962('0x55'))]['ValidationError'](_0x9962('0x6c'));}return _0x4f2860['add'+_[_0x9962('0x6e')](_0x54ff12['body'][_0x9962('0x6a')]['toLowerCase']())+_0x9962('0x71')](_0x54ff12[_0x9962('0x51')]['ids']);}return null;})[_0x9962('0x26')](handleEntityNotFound(_0x2a256c,null))[_0x9962('0x26')](respondWithStatusCode(_0x2a256c,null))[_0x9962('0x42')](handleError(_0x2a256c,null));};exports[_0x9962('0x75')]=function(_0x597457,_0x2dfbff,_0x33703e){return db[_0x9962('0x45')][_0x9962('0x73')]({'where':{'id':_0x597457[_0x9962('0x44')]['id']}})[_0x9962('0x26')](function(_0x312bb2){if(_0x312bb2){if(!_0x597457[_0x9962('0x2d')][_0x9962('0x6a')]||!utils['isValidChannel'](_0x597457['query']['channel'])){throw new db[(_0x9962('0x55'))]['ValidationError'](_0x9962('0x6c'));}return _0x312bb2['remove'+_['capitalize'](_0x597457['query'][_0x9962('0x6a')]['toLowerCase']())+'Queues'](_0x597457['query'][_0x9962('0x76')]);}return null;})[_0x9962('0x26')](handleEntityNotFound(_0x2dfbff,null))['then'](respondWithStatusCode(_0x2dfbff,null))[_0x9962('0x42')](handleError(_0x2dfbff,null));};exports[_0x9962('0x77')]=function(_0xb9188b,_0x139648){var _0x1fc298=_[_0x9962('0x78')](_0xb9188b[_0x9962('0x51')]['ids'])?_0xb9188b[_0x9962('0x51')]['ids']:[_0xb9188b[_0x9962('0x51')][_0x9962('0x76')]];var _0x2dc1ef=_0xb9188b[_0x9962('0x44')]['id'];return db[_0x9962('0x45')][_0x9962('0x47')]({'where':{'id':_0x2dc1ef}})['then'](handleEntityNotFound(_0x139648,null))[_0x9962('0x26')](function(_0x315cf3){if(_0x315cf3){var _0x18825f=['Voice',_0x9962('0x79'),_0x9962('0x7a'),_0x9962('0x7b'),_0x9962('0x7c'),_0x9962('0x7d'),'Whatsapp'];return db[_0x9962('0x52')]['transaction'](function(_0x4d0693){var _0x3f5ad7=_[_0x9962('0x2c')](_0x18825f,function(_0x46e6b8){var _0x2fae87={'attributes':['id',_0x9962('0x27')]};if(_0x46e6b8==='Voice'){_0x2fae87[_0x9962('0x7e')]={'attributes':[_0x9962('0x7f')]};}return _0x315cf3[_0x9962('0x4c')+_0x46e6b8+'Queues'](_0x2fae87)['then'](function(_0x1b5a9b){var _0x4f670c=_['map'](_0x1b5a9b,function(_0x25dd64){var _0x175591=_['map'](_0x1fc298,function(_0x300dec){var _0x1db5b3={'where':{'UserId':_0x300dec,[_0x46e6b8+'QueueId']:_0x25dd64['id']},'transaction':_0x4d0693};if(_0x46e6b8===_0x9962('0x80')){_0x1db5b3[_0x9962('0x16')]={'penalty':_0x25dd64[_0x9962('0x81')][_0x9962('0x7f')]};}return db[_0x9962('0x82')+_0x46e6b8+_0x9962('0x6f')][_0x9962('0x83')](_0x1db5b3)['then'](function(){socket[_0x9962('0x84')](_0x9962('0x49')+_0x46e6b8+_0x9962('0x85'),{'UserId':_0x300dec,[_0x46e6b8+_0x9962('0x86')]:_0x25dd64['id']});if(_0x46e6b8!==_0x9962('0x80')){return;}return db[_0x9962('0x82')][_0x9962('0x40')]({'where':{'id':_0x1fc298,'online':0x1},'attributes':['id','name',_0x9962('0x87'),_0x9962('0x88'),_0x9962('0x89')],'raw':!![]})[_0x9962('0x26')](function(_0x573d53){var _0x213322=_['map'](_0x573d53,function(_0x1f3e05){return db['UserVoiceQueueRt'][_0x9962('0x8a')]({'membername':_0x1f3e05['name'],'UserId':_0x1f3e05['id'],'queue_name':_0x25dd64['name'],'VoiceQueueId':_0x25dd64['id'],'interface':_[_0x9962('0x8b')](_0x1f3e05['interface'])?util['format'](_0x9962('0x8c'),_0x1f3e05['name']):_0x1f3e05[_0x9962('0x89')],'paused':_0x1f3e05[_0x9962('0x88')]||![],'penalty':_0x25dd64[_0x9962('0x81')][_0x9962('0x7f')]},{'transaction':_0x4d0693});});return Promise[_0x9962('0x8d')](_0x213322);});});});return Promise[_0x9962('0x8d')](_0x175591);});return Promise['all'](_0x4f670c);})[_0x9962('0x26')](function(){return db[_0x9962('0x8e')]['findOne']({'where':{'teamId':_0x2dc1ef}})[_0x9962('0x26')](function(_0xd9d9e0){if(_0xd9d9e0){var _0x2ed440=_['map'](_0x1fc298,function(_0xefdbc8){db[_0x9962('0x68')][_0x9962('0x8a')]({'UserId':_0xefdbc8,'VoicePrefixId':_0xd9d9e0[_0x9962('0x69')]});});return Promise[_0x9962('0x8d')](_0x2ed440);}});});});return Promise[_0x9962('0x8d')](_0x3f5ad7)['then'](function(){return _0x315cf3[_0x9962('0x77')](_0x1fc298,{'transaction':_0x4d0693})[_0x9962('0x8f')](function(_0x4f6723){return _0x4f6723;});});});}})[_0x9962('0x26')](respondWithResult(_0x139648,null))['catch'](handleError(_0x139648,null));};exports[_0x9962('0x90')]=function(_0x94389a,_0x29bb07){var _0x56aea3=_[_0x9962('0x78')](_0x94389a['query'][_0x9962('0x76')])?_0x94389a['query'][_0x9962('0x76')]:[_0x94389a[_0x9962('0x2d')][_0x9962('0x76')]];var _0x553490=_0x94389a[_0x9962('0x44')]['id'];return db[_0x9962('0x45')][_0x9962('0x47')]({'where':{'id':_0x553490}})[_0x9962('0x26')](handleEntityNotFound(_0x29bb07,null))['then'](function(_0x347516){if(_0x347516){var _0x25a560=['Voice',_0x9962('0x79'),_0x9962('0x7a'),'Sms',_0x9962('0x7c'),_0x9962('0x7d'),_0x9962('0x91')];return db[_0x9962('0x52')][_0x9962('0x53')](function(_0x1b0f2f){var _0x546a7d=_['map'](_0x25a560,function(_0x3c6373){var _0xb2c57={'attributes':['id',_0x9962('0x27')]};return _0x347516[_0x9962('0x4c')+_0x3c6373+'Queues'](_0xb2c57)[_0x9962('0x26')](function(_0x75b135){var _0x33ddb2=_['map'](_0x75b135,function(_0x20a562){return _0x20a562[_0x9962('0x90')](_0x56aea3,{'transaction':_0x1b0f2f})[_0x9962('0x26')](function(){var _0x40027b=_[_0x9962('0x2c')](_0x56aea3,function(_0x46c0ed){socket['emit']('user'+_0x3c6373+_0x9962('0x92'),{'UserId':Number(_0x46c0ed),[_0x3c6373+_0x9962('0x86')]:_0x20a562['id']});if(_0x3c6373!==_0x9962('0x80')){return;}return db[_0x9962('0x93')]['destroy']({'where':{'VoiceQueueId':_0x20a562['id'],'UserId':_0x46c0ed},'transaction':_0x1b0f2f});});return Promise[_0x9962('0x8d')](_0x40027b);});});return Promise['all'](_0x33ddb2);});});return Promise[_0x9962('0x8d')](_0x546a7d)[_0x9962('0x26')](function(){return _0x347516[_0x9962('0x90')](_0x56aea3,{'transaction':_0x1b0f2f});})[_0x9962('0x26')](function(){return db['TeamVoicePrefix'][_0x9962('0x73')]({'where':{'teamId':_0x553490}})[_0x9962('0x26')](function(_0x596aa2){if(_0x596aa2){var _0x567743=_[_0x9962('0x2c')](_0x56aea3,function(_0xce30bd){db[_0x9962('0x68')][_0x9962('0x5b')]({'where':{'UserId':_0xce30bd,'VoicePrefixId':_0x596aa2[_0x9962('0x69')]}});});return Promise['all'](_0x567743);}});});});}})['then'](respondWithStatusCode(_0x29bb07,null))[_0x9962('0x42')](handleError(_0x29bb07,null));};exports[_0x9962('0x94')]=function(_0x2eeea2,_0x1e2458,_0x5b8769){var _0x2d204f={};var _0xb28922={};var _0x193a4a;var _0x43b0fc;return db[_0x9962('0x45')][_0x9962('0x73')]({'where':{'id':_0x2eeea2[_0x9962('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e2458,null))['then'](function(_0x30c63c){if(_0x30c63c){_0x193a4a=_0x30c63c;_0xb28922[_0x9962('0x30')]=_['keys'](db[_0x9962('0x82')][_0x9962('0x2a')]);_0xb28922[_0x9962('0x2d')]=_[_0x9962('0x6d')](_0x2eeea2[_0x9962('0x2d')]);_0xb28922['filters']=_[_0x9962('0x2f')](_0xb28922['model'],_0xb28922[_0x9962('0x2d')]);_0x2d204f[_0x9962('0x31')]=_[_0x9962('0x2f')](_0xb28922[_0x9962('0x30')],qs[_0x9962('0x32')](_0x2eeea2[_0x9962('0x2d')]['fields']));_0x2d204f[_0x9962('0x31')]=_0x2d204f[_0x9962('0x31')]['length']?_0x2d204f['attributes']:_0xb28922['model'];_0x2d204f['order']=qs['sort'](_0x2eeea2[_0x9962('0x2d')][_0x9962('0x37')]);_0x2d204f['where']=qs['filters'](_['pick'](_0x2eeea2[_0x9962('0x2d')],_0xb28922[_0x9962('0x2e')]));if(_0x2eeea2[_0x9962('0x2d')][_0x9962('0x3c')]){_0x2d204f['where']=_[_0x9962('0x3d')](_0x2d204f[_0x9962('0x39')],{'$or':_[_0x9962('0x2c')](_0x2d204f['attributes'],function(_0x375153){var _0x519eae={};_0x519eae[_0x375153]={'$like':'%'+_0x2eeea2[_0x9962('0x2d')][_0x9962('0x3c')]+'%'};return _0x519eae;})});}_0x2d204f=_[_0x9962('0x3d')]({},_0x2d204f,_0x2eeea2[_0x9962('0x46')]);return _0x193a4a[_0x9962('0x94')](_0x2d204f);}})[_0x9962('0x26')](function(_0x364278){if(_0x364278){_0x43b0fc=_0x364278[_0x9962('0x33')];if(!_0x2eeea2['query'][_0x9962('0x34')](_0x9962('0x35'))){_0x2d204f[_0x9962('0x21')]=qs['limit'](_0x2eeea2[_0x9962('0x2d')][_0x9962('0x21')]);_0x2d204f[_0x9962('0x1e')]=qs[_0x9962('0x1e')](_0x2eeea2[_0x9962('0x2d')][_0x9962('0x1e')]);}return _0x193a4a[_0x9962('0x94')](_0x2d204f);}})[_0x9962('0x26')](function(_0x48e74f){if(_0x48e74f){return _0x48e74f?{'count':_0x43b0fc,'rows':_0x48e74f}:null;}})[_0x9962('0x26')](respondWithResult(_0x1e2458,null))[_0x9962('0x42')](handleError(_0x1e2458,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 899799b..d96d91c 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 _0x0011=['Team','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x59e78d,_0x112ae3){var _0x2d7f80=function(_0x222f0f){while(--_0x222f0f){_0x59e78d['push'](_0x59e78d['shift']());}};_0x2d7f80(++_0x112ae3);}(_0x0011,0x10c));var _0x1001=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0011[_0x160c73];return _0xd9302;};'use strict';var EventEmitter=require(_0x1001('0x0'));var Team=require(_0x1001('0x1'))['db'][_0x1001('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x1001('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1001('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5be5a4){return function(_0x134378,_0x55f4b5,_0x142de6){TeamEvents[_0x1001('0x5')](_0x5be5a4+':'+_0x134378['id'],_0x134378);TeamEvents[_0x1001('0x5')](_0x5be5a4,_0x134378);_0x142de6(null);};}for(var e in events){if(events[_0x1001('0x6')](e)){var event=events[e];Team[_0x1001('0x7')](e,emitEvent(event));}}module[_0x1001('0x8')]=TeamEvents; \ No newline at end of file +var _0x8140=['save','update','remove','emit','exports','events','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8140,0x16a));var _0x0814=function(_0xa871b3,_0x15c9c5){_0xa871b3=_0xa871b3-0x0;var _0x5e42ce=_0x8140[_0xa871b3];return _0x5e42ce;};'use strict';var EventEmitter=require(_0x0814('0x0'));var Team=require('../../mysqldb')['db'][_0x0814('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0814('0x2'),'afterUpdate':_0x0814('0x3'),'afterDestroy':_0x0814('0x4')};function emitEvent(_0x1a9843){return function(_0x4752b6,_0x42ba50,_0x4ac8c9){TeamEvents[_0x0814('0x5')](_0x1a9843+':'+_0x4752b6['id'],_0x4752b6);TeamEvents['emit'](_0x1a9843,_0x4752b6);_0x4ac8c9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0814('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 93ca811..ee8225c 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 _0x7095=['./team.attributes','get','Queues','map','setDataValue','catch','Team','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x7095,0xdf));var _0x5709=function(_0x36876b,_0x1645e7){_0x36876b=_0x36876b-0x0;var _0x114691=_0x7095[_0x36876b];return _0x114691;};'use strict';var _=require(_0x5709('0x0'));var attributes=require(_0x5709('0x1'));function getQueuesByChannel(_0x5951eb,_0x4d4384){var _0x346766=_0x5709('0x2')+_0x4d4384+_0x5709('0x3');return _0x5951eb[_0x346766]()['then'](function(_0x166532){return _[_0x5709('0x4')](_0x166532,function(_0x39defa){_0x39defa[_0x5709('0x5')]('channel',_0x4d4384);return _0x39defa;});})[_0x5709('0x6')](function(_0x20707b){throw _0x20707b;});}module['exports']=function(_0xa22921){return _0xa22921['define'](_0x5709('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x57fcfd=this;var _0xbbf22e=['Chat',_0x5709('0x8'),_0x5709('0x9'),_0x5709('0xa'),_0x5709('0xb'),_0x5709('0xc'),_0x5709('0xd')];return Promise[_0x5709('0xe')]()['then'](function(){var _0x14512a=_['map'](_0xbbf22e,function(_0x952a68){return getQueuesByChannel(_0x57fcfd,_0x952a68);});return Promise[_0x5709('0xf')](_0x14512a);})[_0x5709('0x6')](function(_0x1859a3){throw _0x1859a3;});}}});}; \ No newline at end of file +var _0x37b3=['Chat','Fax','Mail','Openchannel','Sms','Whatsapp','./team.attributes','get','Queues','then','map','catch','exports','Team','teams'];(function(_0x15d700,_0x1e0998){var _0x252c7a=function(_0x5ea9b1){while(--_0x5ea9b1){_0x15d700['push'](_0x15d700['shift']());}};_0x252c7a(++_0x1e0998);}(_0x37b3,0x15f));var _0x337b=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x37b3[_0x2179f1];return _0x176ec9;};'use strict';var _=require('lodash');var attributes=require(_0x337b('0x0'));function getQueuesByChannel(_0x1a1d36,_0x3b2478){var _0x3b326c=_0x337b('0x1')+_0x3b2478+_0x337b('0x2');return _0x1a1d36[_0x3b326c]()[_0x337b('0x3')](function(_0x3aa4af){return _[_0x337b('0x4')](_0x3aa4af,function(_0xd649e6){_0xd649e6['setDataValue']('channel',_0x3b2478);return _0xd649e6;});})[_0x337b('0x5')](function(_0x150419){throw _0x150419;});}module[_0x337b('0x6')]=function(_0x131a40){return _0x131a40['define'](_0x337b('0x7'),attributes,{'tableName':_0x337b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x34e30f=this;var _0x55bcc4=[_0x337b('0x9'),_0x337b('0xa'),_0x337b('0xb'),_0x337b('0xc'),_0x337b('0xd'),'Voice',_0x337b('0xe')];return Promise['resolve']()[_0x337b('0x3')](function(){var _0x225e28=_[_0x337b('0x4')](_0x55bcc4,function(_0x10b383){return getQueuesByChannel(_0x34e30f,_0x10b383);});return Promise['all'](_0x225e28);})[_0x337b('0x5')](function(_0x2651f9){throw _0x2651f9;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index a9e9846..71440d0 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 _0x2551=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x54ca91,_0x1f01cb){var _0x4e400e=function(_0x5b4be2){while(--_0x5b4be2){_0x54ca91['push'](_0x54ca91['shift']());}};_0x4e400e(++_0x1f01cb);}(_0x2551,0x9d));var _0x1255=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x2551[_0xa4f636];return _0x37e02a;};'use strict';var _=require(_0x1255('0x0'));var util=require(_0x1255('0x1'));var moment=require('moment');var BPromise=require(_0x1255('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1255('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1255('0x4'));var logger=require(_0x1255('0x5'))('rpc');var config=require(_0x1255('0x6'));var jayson=require(_0x1255('0x7'));var client=jayson[_0x1255('0x8')][_0x1255('0x9')]({'port':0x232a});config['redis']=_[_0x1255('0xa')](config[_0x1255('0xb')],{'host':_0x1255('0xc'),'port':0x18eb});var socket=require(_0x1255('0xd'))(new Redis(config[_0x1255('0xb')]));require(_0x1255('0xe'))[_0x1255('0xf')](socket);function respondWithRpcPromise(_0xaa05a8,_0x45e72b,_0x5b9dee){return new BPromise(function(_0x5bb635,_0x18037e){return client[_0x1255('0x10')](_0xaa05a8,_0x5b9dee)['then'](function(_0x3b05ed){logger['info'](_0x1255('0x11'),_0x45e72b,_0x1255('0x12'));logger[_0x1255('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x45e72b,_0x1255('0x12'),JSON[_0x1255('0x14')](_0x3b05ed));if(_0x3b05ed['error']){if(_0x3b05ed[_0x1255('0x15')][_0x1255('0x16')]===0x1f4){logger[_0x1255('0x15')](_0x1255('0x11'),_0x45e72b,_0x3b05ed[_0x1255('0x15')]['message']);return _0x18037e(_0x3b05ed[_0x1255('0x15')][_0x1255('0x17')]);}logger[_0x1255('0x15')](_0x1255('0x11'),_0x45e72b,_0x3b05ed['error'][_0x1255('0x17')]);return _0x5bb635(_0x3b05ed[_0x1255('0x15')][_0x1255('0x17')]);}else{logger[_0x1255('0x18')](_0x1255('0x11'),_0x45e72b,_0x1255('0x12'));_0x5bb635(_0x3b05ed[_0x1255('0x19')][_0x1255('0x17')]);}})[_0x1255('0x1a')](function(_0x160a77){logger['error']('Team,\x20%s,\x20%s',_0x45e72b,_0x160a77);_0x18037e(_0x160a77);});});} \ No newline at end of file +var _0x05b6=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0xfadbb0,_0x2986f5){var _0x4d7a6d=function(_0x216ac3){while(--_0x216ac3){_0xfadbb0['push'](_0xfadbb0['shift']());}};_0x4d7a6d(++_0x2986f5);}(_0x05b6,0x112));var _0x605b=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x05b6[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x605b('0x0'));var util=require(_0x605b('0x1'));var moment=require(_0x605b('0x2'));var BPromise=require(_0x605b('0x3'));var rs=require(_0x605b('0x4'));var fs=require('fs');var Redis=require(_0x605b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x605b('0x6'));var logger=require(_0x605b('0x7'))(_0x605b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x605b('0x9')][_0x605b('0xa')]({'port':0x232a});config[_0x605b('0xb')]=_['defaults'](config[_0x605b('0xb')],{'host':_0x605b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x605b('0xb')]));require('./team.socket')[_0x605b('0xd')](socket);function respondWithRpcPromise(_0x435a55,_0x449417,_0x119af3){return new BPromise(function(_0x112c49,_0x580a2e){return client['request'](_0x435a55,_0x119af3)[_0x605b('0xe')](function(_0x4c4f4f){logger[_0x605b('0xf')](_0x605b('0x10'),_0x449417,_0x605b('0x11'));logger[_0x605b('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x449417,_0x605b('0x11'),JSON[_0x605b('0x13')](_0x4c4f4f));if(_0x4c4f4f[_0x605b('0x14')]){if(_0x4c4f4f[_0x605b('0x14')][_0x605b('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x449417,_0x4c4f4f[_0x605b('0x14')][_0x605b('0x16')]);return _0x580a2e(_0x4c4f4f[_0x605b('0x14')][_0x605b('0x16')]);}logger[_0x605b('0x14')]('Team,\x20%s,\x20%s',_0x449417,_0x4c4f4f[_0x605b('0x14')][_0x605b('0x16')]);return _0x112c49(_0x4c4f4f[_0x605b('0x14')]['message']);}else{logger[_0x605b('0xf')](_0x605b('0x10'),_0x449417,_0x605b('0x11'));_0x112c49(_0x4c4f4f[_0x605b('0x17')]['message']);}})[_0x605b('0x18')](function(_0x4d6ba9){logger[_0x605b('0x14')](_0x605b('0x10'),_0x449417,_0x4d6ba9);_0x580a2e(_0x4d6ba9);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 1a18753..f8d8b20 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 _0xa988=['./team.events','save','remove','update','emit','removeListener','register','length','team:'];(function(_0x338b40,_0x199519){var _0x47e249=function(_0x26d703){while(--_0x26d703){_0x338b40['push'](_0x338b40['shift']());}};_0x47e249(++_0x199519);}(_0xa988,0x1a7));var _0x8a98=function(_0x2b4d02,_0x54d4f9){_0x2b4d02=_0x2b4d02-0x0;var _0x19a9c2=_0xa988[_0x2b4d02];return _0x19a9c2;};'use strict';var TeamEvents=require(_0x8a98('0x0'));var events=[_0x8a98('0x1'),_0x8a98('0x2'),_0x8a98('0x3')];function createListener(_0x301da0,_0x59970e){return function(_0x14901a){_0x59970e[_0x8a98('0x4')](_0x301da0,_0x14901a);};}function removeListener(_0x1380fa,_0x12efcf){return function(){TeamEvents[_0x8a98('0x5')](_0x1380fa,_0x12efcf);};}exports[_0x8a98('0x6')]=function(_0x3eb5cf){for(var _0x3fcd06=0x0,_0x4ef481=events[_0x8a98('0x7')];_0x3fcd06<_0x4ef481;_0x3fcd06++){var _0x336f5f=events[_0x3fcd06];var _0x5f3abf=createListener(_0x8a98('0x8')+_0x336f5f,_0x3eb5cf);TeamEvents['on'](_0x336f5f,_0x5f3abf);}}; \ No newline at end of file +var _0xec53=['team:','remove','emit','removeListener','register'];(function(_0x3256fa,_0x5b614d){var _0x23be9d=function(_0x514cb2){while(--_0x514cb2){_0x3256fa['push'](_0x3256fa['shift']());}};_0x23be9d(++_0x5b614d);}(_0xec53,0x1e6));var _0x3ec5=function(_0xbcf269,_0x45e444){_0xbcf269=_0xbcf269-0x0;var _0x255efd=_0xec53[_0xbcf269];return _0x255efd;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3ec5('0x0'),'update'];function createListener(_0x1df5b8,_0x440e6f){return function(_0x5f0dd5){_0x440e6f[_0x3ec5('0x1')](_0x1df5b8,_0x5f0dd5);};}function removeListener(_0x45da39,_0x4ecbe4){return function(){TeamEvents[_0x3ec5('0x2')](_0x45da39,_0x4ecbe4);};}exports[_0x3ec5('0x3')]=function(_0x53abe3){for(var _0x4c4448=0x0,_0x5013bd=events['length'];_0x4c4448<_0x5013bd;_0x4c4448++){var _0x577d64=events[_0x4c4448];var _0x16e56a=createListener(_0x3ec5('0x4')+_0x577d64,_0x53abe3);TeamEvents['on'](_0x577d64,_0x16e56a);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 76d2d6a..e8823e6 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 _0x91ff=['INTEGER'];(function(_0x372a58,_0x2cb91d){var _0x68a7dc=function(_0x412b38){while(--_0x412b38){_0x372a58['push'](_0x372a58['shift']());}};_0x68a7dc(++_0x2cb91d);}(_0x91ff,0x15b));var _0xf91f=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x91ff[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xf91f('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4058=['sequelize','exports','INTEGER'];(function(_0x5f1483,_0x1a3362){var _0x402149=function(_0x30ba68){while(--_0x30ba68){_0x5f1483['push'](_0x5f1483['shift']());}};_0x402149(++_0x1a3362);}(_0x4058,0x129));var _0x8405=function(_0x4947f0,_0x138314){_0x4947f0=_0x4947f0-0x0;var _0x11ad58=_0x4058[_0x4947f0];return _0x11ad58;};'use strict';var Sequelize=require(_0x8405('0x0'));module[_0x8405('0x1')]={'TeamId':{'type':Sequelize[_0x8405('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8405('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index d56f66d..4a7ea1b 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger','api'];(function(_0x522302,_0x6cf3d1){var _0x1248b7=function(_0xa5e55){while(--_0xa5e55){_0x522302['push'](_0x522302['shift']());}};_0x1248b7(++_0x6cf3d1);}(_0x1339,0x1ed));var _0x9133=function(_0x2dbbc7,_0x1df3c5){_0x2dbbc7=_0x2dbbc7-0x0;var _0x427cca=_0x1339[_0x2dbbc7];return _0x427cca;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e34=['../../config/logger','api','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x588852,_0x220867){var _0x2e9324=function(_0x5d2b8a){while(--_0x5d2b8a){_0x588852['push'](_0x588852['shift']());}};_0x2e9324(++_0x220867);}(_0x4e34,0x19e));var _0x44e3=function(_0x29c9c8,_0x458494){_0x29c9c8=_0x29c9c8-0x0;var _0x1f1340=_0x4e34[_0x29c9c8];return _0x1f1340;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x44e3('0x0'))(_0x44e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x44e3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44e3('0x3'));var config=require(_0x44e3('0x4'));var attributes=require(_0x44e3('0x5'));module['exports']=function(_0x50805a,_0x162bd9){return _0x50805a[_0x44e3('0x6')](_0x44e3('0x7'),attributes,{'tableName':_0x44e3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7df082f..5b043a1 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3461c8,_0x2a904f){var _0x411111=function(_0x591ad1){while(--_0x591ad1){_0x3461c8['push'](_0x3461c8['shift']());}};_0x411111(++_0x2a904f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x3838a4,_0x2ae1e6){var _0x3c56b4=function(_0x4cbf64){while(--_0x4cbf64){_0x3838a4['push'](_0x3838a4['shift']());}};_0x3c56b4(++_0x2ae1e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 890359f..53ac03f 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 _0x885f=['INTEGER','exports'];(function(_0x37df3f,_0x75c9b6){var _0x2313fe=function(_0x3199a9){while(--_0x3199a9){_0x37df3f['push'](_0x37df3f['shift']());}};_0x2313fe(++_0x75c9b6);}(_0x885f,0x18d));var _0xf885=function(_0x5f23d9,_0x431d9a){_0x5f23d9=_0x5f23d9-0x0;var _0x68fb9e=_0x885f[_0x5f23d9];return _0x68fb9e;};'use strict';var Sequelize=require('sequelize');module[_0xf885('0x0')]={'penalty':{'type':Sequelize[_0xf885('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd3cd=['exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3cd,0x188));var _0xdd3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3cd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xdd3c('0x0')]={'penalty':{'type':Sequelize[_0xdd3c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 76e858f..dd9d9b3 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 _0xbe02=['exports','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe02,0x146));var _0x2be0=function(_0x312cf0,_0x2f25d2){_0x312cf0=_0x312cf0-0x0;var _0x7d0db8=_0xbe02[_0x312cf0];return _0x7d0db8;};'use strict';var _=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var logger=require(_0x2be0('0x2'))(_0x2be0('0x3'));var moment=require('moment');var BPromise=require(_0x2be0('0x4'));var rp=require(_0x2be0('0x5'));var fs=require('fs');var path=require(_0x2be0('0x6'));var rimraf=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var attributes=require(_0x2be0('0x9'));module[_0x2be0('0xa')]=function(_0x474a35,_0x39a2ca){return _0x474a35['define']('TeamVoiceQueue',attributes,{'tableName':_0x2be0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd84b=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','util'];(function(_0x173cf3,_0x3c8cab){var _0x55f3ba=function(_0x3ec66b){while(--_0x3ec66b){_0x173cf3['push'](_0x173cf3['shift']());}};_0x55f3ba(++_0x3c8cab);}(_0xd84b,0x177));var _0xbd84=function(_0x281e96,_0x4f5943){_0x281e96=_0x281e96-0x0;var _0x2bdab8=_0xd84b[_0x281e96];return _0x2bdab8;};'use strict';var _=require('lodash');var util=require(_0xbd84('0x0'));var logger=require(_0xbd84('0x1'))(_0xbd84('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd84('0x3'));var fs=require('fs');var path=require(_0xbd84('0x4'));var rimraf=require(_0xbd84('0x5'));var config=require(_0xbd84('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x394af9,_0x11dbbc){return _0x394af9[_0xbd84('0x7')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 fbb900c..3d169c1 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 _0x42a1=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x17c8ae,_0x1f0ab1){var _0x5a42c1=function(_0x2752a0){while(--_0x2752a0){_0x17c8ae['push'](_0x17c8ae['shift']());}};_0x5a42c1(++_0x1f0ab1);}(_0x42a1,0x155));var _0x142a=function(_0x38f737,_0x54f685){_0x38f737=_0x38f737-0x0;var _0x7afda3=_0x42a1[_0x38f737];return _0x7afda3;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var moment=require(_0x142a('0x2'));var BPromise=require(_0x142a('0x3'));var rs=require(_0x142a('0x4'));var fs=require('fs');var Redis=require(_0x142a('0x5'));var db=require(_0x142a('0x6'))['db'];var utils=require(_0x142a('0x7'));var logger=require(_0x142a('0x8'))('rpc');var config=require(_0x142a('0x9'));var jayson=require(_0x142a('0xa'));var client=jayson[_0x142a('0xb')][_0x142a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x201ba1,_0x54ef0b,_0x3acedc){return new BPromise(function(_0x4f56f0,_0x2318ca){return client[_0x142a('0xd')](_0x201ba1,_0x3acedc)[_0x142a('0xe')](function(_0x62124e){logger[_0x142a('0xf')](_0x142a('0x10'),_0x54ef0b,'request\x20sent');logger['debug'](_0x142a('0x11'),_0x54ef0b,_0x142a('0x12'),JSON[_0x142a('0x13')](_0x62124e));if(_0x62124e[_0x142a('0x14')]){if(_0x62124e['error']['code']===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x54ef0b,_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);return _0x2318ca(_0x62124e[_0x142a('0x14')]['message']);}logger[_0x142a('0x14')](_0x142a('0x10'),_0x54ef0b,_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);return _0x4f56f0(_0x62124e[_0x142a('0x14')][_0x142a('0x15')]);}else{logger[_0x142a('0xf')](_0x142a('0x10'),_0x54ef0b,'request\x20sent');_0x4f56f0(_0x62124e[_0x142a('0x16')]['message']);}})[_0x142a('0x17')](function(_0x2741be){logger[_0x142a('0x14')](_0x142a('0x10'),_0x54ef0b,_0x2741be);_0x2318ca(_0x2741be);});});} \ No newline at end of file +var _0x038d=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','info','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','moment','bluebird'];(function(_0x426ab4,_0x3aa799){var _0x290c07=function(_0x41ffe4){while(--_0x41ffe4){_0x426ab4['push'](_0x426ab4['shift']());}};_0x290c07(++_0x3aa799);}(_0x038d,0xae));var _0xd038=function(_0x4d477a,_0x1b3ab8){_0x4d477a=_0x4d477a-0x0;var _0xfec158=_0x038d[_0x4d477a];return _0xfec158;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd038('0x0'));var BPromise=require(_0xd038('0x1'));var rs=require(_0xd038('0x2'));var fs=require('fs');var Redis=require(_0xd038('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd038('0x4'))(_0xd038('0x5'));var config=require(_0xd038('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x457b2f,_0x1f2511,_0x5d4b85){return new BPromise(function(_0x61a8fb,_0xd847cf){return client['request'](_0x457b2f,_0x5d4b85)[_0xd038('0x7')](function(_0x23703d){logger[_0xd038('0x8')](_0xd038('0x9'),_0x1f2511,'request\x20sent');logger['debug'](_0xd038('0xa'),_0x1f2511,_0xd038('0xb'),JSON['stringify'](_0x23703d));if(_0x23703d[_0xd038('0xc')]){if(_0x23703d[_0xd038('0xc')][_0xd038('0xd')]===0x1f4){logger['error'](_0xd038('0x9'),_0x1f2511,_0x23703d[_0xd038('0xc')][_0xd038('0xe')]);return _0xd847cf(_0x23703d['error'][_0xd038('0xe')]);}logger[_0xd038('0xc')](_0xd038('0x9'),_0x1f2511,_0x23703d['error']['message']);return _0x61a8fb(_0x23703d['error'][_0xd038('0xe')]);}else{logger[_0xd038('0x8')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f2511,_0xd038('0xb'));_0x61a8fb(_0x23703d['result']['message']);}})[_0xd038('0xf')](function(_0x4ff355){logger[_0xd038('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f2511,_0x4ff355);_0xd847cf(_0x4ff355);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4ec1c36..74f63b4 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 _0xf4c9=['../../components/interaction/service','./template.controller','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0xd321df,_0x13ed85){var _0x4d8cf1=function(_0xff3c72){while(--_0xff3c72){_0xd321df['push'](_0xd321df['shift']());}};_0x4d8cf1(++_0x13ed85);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xf4c9[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var path=require(_0x9f4c('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f4c('0x3'));var router=express['Router']();var fs_extra=require(_0x9f4c('0x4'));var auth=require(_0x9f4c('0x5'));var interaction=require(_0x9f4c('0x6'));var config=require('../../config/environment');var controller=require(_0x9f4c('0x7'));router['get']('/',auth[_0x9f4c('0x8')](),controller['index']);router['get']('/:id',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0x9')]);router[_0x9f4c('0xa')]('/',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0xb')]);router[_0x9f4c('0xc')]('/:id',auth[_0x9f4c('0x8')](),controller[_0x9f4c('0xd')]);router[_0x9f4c('0xe')](_0x9f4c('0xf'),auth[_0x9f4c('0x8')](),controller[_0x9f4c('0x10')]);module[_0x9f4c('0x11')]=router; \ No newline at end of file +var _0x7e74=['index','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7e74,0xbd));var _0x47e7=function(_0x5eaa4d,_0xa552bd){_0x5eaa4d=_0x5eaa4d-0x0;var _0x1a6079=_0x7e74[_0x5eaa4d];return _0x1a6079;};'use strict';var multer=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var timeout=require(_0x47e7('0x2'));var express=require(_0x47e7('0x3'));var router=express[_0x47e7('0x4')]();var fs_extra=require(_0x47e7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x47e7('0x6'));var config=require(_0x47e7('0x7'));var controller=require(_0x47e7('0x8'));router[_0x47e7('0x9')]('/',auth[_0x47e7('0xa')](),controller[_0x47e7('0xb')]);router[_0x47e7('0x9')]('/:id',auth[_0x47e7('0xa')](),controller['show']);router[_0x47e7('0xc')]('/',auth[_0x47e7('0xa')](),controller[_0x47e7('0xd')]);router[_0x47e7('0xe')](_0x47e7('0xf'),auth[_0x47e7('0xa')](),controller[_0x47e7('0x10')]);router[_0x47e7('0x11')](_0x47e7('0xf'),auth[_0x47e7('0xa')](),controller[_0x47e7('0x12')]);module[_0x47e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2647e13..3906d3e 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 _0x6cac=['exports','STRING','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6cac,0x105));var _0xc6ca=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6cac[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0xc6ca('0x0')]={'name':{'type':Sequelize[_0xc6ca('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xc6ca('0x2')]}}; \ No newline at end of file +var _0xbd64=['TEXT','exports','STRING'];(function(_0xf746ac,_0x146b0f){var _0x3a2369=function(_0x367445){while(--_0x367445){_0xf746ac['push'](_0xf746ac['shift']());}};_0x3a2369(++_0x146b0f);}(_0xbd64,0x1d8));var _0x4bd6=function(_0x16164c,_0x4c777d){_0x16164c=_0x16164c-0x0;var _0x340256=_0xbd64[_0x16164c];return _0x340256;};'use strict';var Sequelize=require('sequelize');module[_0x4bd6('0x0')]={'name':{'type':Sequelize[_0x4bd6('0x1')]},'description':{'type':Sequelize[_0x4bd6('0x1')]},'html':{'type':Sequelize[_0x4bd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d641d00..eced253 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 _0x8512=['includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Templates','then','sendStatus','stack','name','send','map','Template','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x8512,0xbc));var _0x2851=function(_0x57169e,_0x1e711d){_0x57169e=_0x57169e-0x0;var _0xbfd65f=_0x8512[_0x57169e];return _0xbfd65f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2851('0x0'));var zipdir=require(_0x2851('0x1'));var jsonpatch=require(_0x2851('0x2'));var rp=require(_0x2851('0x3'));var moment=require(_0x2851('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2851('0x5'));var util=require(_0x2851('0x6'));var path=require('path');var sox=require(_0x2851('0x7'));var csv=require(_0x2851('0x8'));var ejs=require(_0x2851('0x9'));var fs=require('fs');var fs_extra=require(_0x2851('0xa'));var _=require(_0x2851('0xb'));var squel=require(_0x2851('0xc'));var crypto=require(_0x2851('0xd'));var jsforce=require(_0x2851('0xe'));var deskjs=require(_0x2851('0xf'));var toCsv=require(_0x2851('0x8'));var querystring=require(_0x2851('0x10'));var Papa=require('papaparse');var Redis=require(_0x2851('0x11'));var authService=require(_0x2851('0x12'));var qs=require(_0x2851('0x13'));var as=require(_0x2851('0x14'));var hardwareService=require(_0x2851('0x15'));var logger=require(_0x2851('0x16'))('api');var utils=require(_0x2851('0x17'));var config=require(_0x2851('0x18'));var licenseUtil=require(_0x2851('0x19'));var db=require(_0x2851('0x1a'))['db'];function respondWithStatusCode(_0x1c54be,_0x431fe2){_0x431fe2=_0x431fe2||0xcc;return function(_0x3e135e){if(_0x3e135e){return _0x1c54be['sendStatus'](_0x431fe2);}return _0x1c54be['status'](_0x431fe2)[_0x2851('0x1b')]();};}function respondWithResult(_0x212744,_0x3d58ee){_0x3d58ee=_0x3d58ee||0xc8;return function(_0x4893e1){if(_0x4893e1){return _0x212744[_0x2851('0x1c')](_0x3d58ee)['json'](_0x4893e1);}};}function respondWithFilteredResult(_0x100f8c,_0x39d02f){return function(_0x7aaf1d){if(_0x7aaf1d){var _0x1a535a=typeof _0x39d02f[_0x2851('0x1d')]==='undefined'&&typeof _0x39d02f[_0x2851('0x1e')]==='undefined';var _0x126c6e=_0x7aaf1d[_0x2851('0x1f')];var _0x5275ff=_0x1a535a?0x0:_0x39d02f[_0x2851('0x1d')];var _0x38cd6d=_0x1a535a?_0x7aaf1d[_0x2851('0x1f')]:_0x39d02f[_0x2851('0x1d')]+_0x39d02f[_0x2851('0x1e')];var _0x1ea5a8;if(_0x38cd6d>=_0x126c6e){_0x38cd6d=_0x126c6e;_0x1ea5a8=0xc8;}else{_0x1ea5a8=0xce;}_0x100f8c[_0x2851('0x1c')](_0x1ea5a8);return _0x100f8c[_0x2851('0x20')](_0x2851('0x21'),_0x5275ff+'-'+_0x38cd6d+'/'+_0x126c6e)[_0x2851('0x22')](_0x7aaf1d);}return null;};}function patchUpdates(_0x56c5f0){return function(_0x1baa04){try{jsonpatch[_0x2851('0x23')](_0x1baa04,_0x56c5f0,!![]);}catch(_0xd0524b){return BPromise[_0x2851('0x24')](_0xd0524b);}return _0x1baa04[_0x2851('0x25')]();};}function saveUpdates(_0x1426a4,_0x343857){return function(_0x352ce0){if(_0x352ce0){return _0x352ce0[_0x2851('0x26')](_0x1426a4)['then'](function(_0x5350b3){return _0x5350b3;});}return null;};}function removeEntity(_0x2548eb,_0x16f588){return function(_0x16a4d8){if(_0x16a4d8){return _0x16a4d8[_0x2851('0x27')]()['then'](function(){var _0x340845=_0x16a4d8[_0x2851('0x28')]({'plain':!![]});var _0x3a3f7a=_0x2851('0x29');return db['UserProfileResource'][_0x2851('0x27')]({'where':{'type':_0x3a3f7a,'resourceId':_0x340845['id']}})[_0x2851('0x2a')](function(){return _0x16a4d8;});})[_0x2851('0x2a')](function(){_0x2548eb[_0x2851('0x1c')](0xcc)[_0x2851('0x1b')]();});}};}function handleEntityNotFound(_0x2d2334,_0x2e0e28){return function(_0x2bd165){if(!_0x2bd165){_0x2d2334[_0x2851('0x2b')](0x194);}return _0x2bd165;};}function handleError(_0x2abd35,_0x10f6b2){_0x10f6b2=_0x10f6b2||0x1f4;return function(_0xe58b71){logger['error'](_0xe58b71[_0x2851('0x2c')]);if(_0xe58b71[_0x2851('0x2d')]){delete _0xe58b71['name'];}_0x2abd35[_0x2851('0x1c')](_0x10f6b2)[_0x2851('0x2e')](_0xe58b71);};}exports['index']=function(_0x4c84ba,_0x540e33){var _0x53845c={},_0x41550d={},_0x34c3ec={'count':0x0,'rows':[]};var _0x3dc1d2=_[_0x2851('0x2f')](db[_0x2851('0x30')][_0x2851('0x31')],function(_0x502fcd){return{'name':_0x502fcd[_0x2851('0x32')],'type':_0x502fcd['type'][_0x2851('0x33')]};});_0x41550d[_0x2851('0x34')]=_['map'](_0x3dc1d2,_0x2851('0x2d'));_0x41550d['query']=_[_0x2851('0x35')](_0x4c84ba['query']);_0x41550d[_0x2851('0x36')]=_[_0x2851('0x37')](_0x41550d[_0x2851('0x34')],_0x41550d['query']);_0x53845c[_0x2851('0x38')]=_[_0x2851('0x37')](_0x41550d[_0x2851('0x34')],qs[_0x2851('0x39')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x39')]));_0x53845c['attributes']=_0x53845c['attributes'][_0x2851('0x3b')]?_0x53845c[_0x2851('0x38')]:_0x41550d['model'];if(!_0x4c84ba[_0x2851('0x3a')][_0x2851('0x3c')](_0x2851('0x3d'))){_0x53845c[_0x2851('0x1e')]=qs[_0x2851('0x1e')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x1e')]);_0x53845c[_0x2851('0x1d')]=qs['offset'](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x1d')]);}_0x53845c[_0x2851('0x3e')]=qs[_0x2851('0x3f')](_0x4c84ba[_0x2851('0x3a')][_0x2851('0x3f')]);_0x53845c['where']=qs[_0x2851('0x36')](_['pick'](_0x4c84ba[_0x2851('0x3a')],_0x41550d[_0x2851('0x36')]),_0x3dc1d2);if(_0x4c84ba['query'][_0x2851('0x40')]){_0x53845c[_0x2851('0x41')]=_['merge'](_0x53845c[_0x2851('0x41')],{'$or':_[_0x2851('0x2f')](_0x3dc1d2,function(_0x30250c){if(_0x30250c[_0x2851('0x42')]!==_0x2851('0x43')){var _0x37d5f8={};_0x37d5f8[_0x30250c[_0x2851('0x2d')]]={'$like':'%'+_0x4c84ba[_0x2851('0x3a')]['filter']+'%'};return _0x37d5f8;}})});}_0x53845c=_[_0x2851('0x44')]({},_0x53845c,_0x4c84ba[_0x2851('0x45')]);var _0x14dc71={'where':_0x53845c[_0x2851('0x41')]};return db[_0x2851('0x30')][_0x2851('0x1f')](_0x14dc71)[_0x2851('0x2a')](function(_0x1751e5){_0x34c3ec[_0x2851('0x1f')]=_0x1751e5;if(_0x4c84ba[_0x2851('0x3a')][_0x2851('0x46')]){_0x53845c['include']=[{'all':!![]}];}return db[_0x2851('0x30')][_0x2851('0x47')](_0x53845c);})[_0x2851('0x2a')](function(_0xee82ea){_0x34c3ec['rows']=_0xee82ea;return _0x34c3ec;})[_0x2851('0x2a')](respondWithFilteredResult(_0x540e33,_0x53845c))[_0x2851('0x48')](handleError(_0x540e33,null));};exports[_0x2851('0x49')]=function(_0x4130fa,_0x478e80){var _0x11574a={'raw':!![],'where':{'id':_0x4130fa[_0x2851('0x4a')]['id']}},_0x43af27={};_0x43af27['model']=_[_0x2851('0x35')](db[_0x2851('0x30')]['rawAttributes']);_0x43af27[_0x2851('0x3a')]=_[_0x2851('0x35')](_0x4130fa[_0x2851('0x3a')]);_0x43af27[_0x2851('0x36')]=_[_0x2851('0x37')](_0x43af27[_0x2851('0x34')],_0x43af27[_0x2851('0x3a')]);_0x11574a[_0x2851('0x38')]=_['intersection'](_0x43af27['model'],qs[_0x2851('0x39')](_0x4130fa[_0x2851('0x3a')][_0x2851('0x39')]));_0x11574a[_0x2851('0x38')]=_0x11574a[_0x2851('0x38')][_0x2851('0x3b')]?_0x11574a[_0x2851('0x38')]:_0x43af27[_0x2851('0x34')];if(_0x4130fa[_0x2851('0x3a')][_0x2851('0x46')]){_0x11574a[_0x2851('0x4b')]=[{'all':!![]}];}_0x11574a=_[_0x2851('0x44')]({},_0x11574a,_0x4130fa[_0x2851('0x45')]);return db[_0x2851('0x30')][_0x2851('0x4c')](_0x11574a)[_0x2851('0x2a')](handleEntityNotFound(_0x478e80,null))[_0x2851('0x2a')](respondWithResult(_0x478e80,null))[_0x2851('0x48')](handleError(_0x478e80,null));};exports[_0x2851('0x4d')]=function(_0x1ca281,_0xfa5571){return db[_0x2851('0x30')][_0x2851('0x4d')](_0x1ca281[_0x2851('0x4e')],{})['then'](function(_0x2f423e){var _0x64577f=_0x1ca281[_0x2851('0x4f')][_0x2851('0x28')]({'plain':!![]});if(!_0x64577f)throw new Error(_0x2851('0x50'));if(_0x64577f[_0x2851('0x51')]===_0x2851('0x4f')){var _0x545e17=_0x2f423e[_0x2851('0x28')]({'plain':!![]});var _0x3dd58c=_0x2851('0x29');return db['UserProfileSection'][_0x2851('0x4c')]({'where':{'name':_0x3dd58c,'userProfileId':_0x64577f[_0x2851('0x52')]},'raw':!![]})['then'](function(_0x1c3702){if(_0x1c3702&&_0x1c3702[_0x2851('0x53')]===0x0){return db[_0x2851('0x54')][_0x2851('0x4d')]({'name':_0x545e17[_0x2851('0x2d')],'resourceId':_0x545e17['id'],'type':_0x1c3702[_0x2851('0x2d')],'sectionId':_0x1c3702['id']},{})[_0x2851('0x2a')](function(){return _0x2f423e;});}else{return _0x2f423e;}})['catch'](function(_0x73738d){logger[_0x2851('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x73738d);throw _0x73738d;});}return _0x2f423e;})['then'](respondWithResult(_0xfa5571,0xc9))[_0x2851('0x48')](handleError(_0xfa5571,null));};exports[_0x2851('0x26')]=function(_0x260fd0,_0x4421dd){if(_0x260fd0[_0x2851('0x4e')]['id']){delete _0x260fd0['body']['id'];}return db[_0x2851('0x30')][_0x2851('0x4c')]({'where':{'id':_0x260fd0['params']['id']}})['then'](handleEntityNotFound(_0x4421dd,null))[_0x2851('0x2a')](saveUpdates(_0x260fd0[_0x2851('0x4e')],null))['then'](respondWithResult(_0x4421dd,null))[_0x2851('0x48')](handleError(_0x4421dd,null));};exports['destroy']=function(_0x10db8e,_0x35c2b1){return db[_0x2851('0x30')]['find']({'where':{'id':_0x10db8e[_0x2851('0x4a')]['id']}})[_0x2851('0x2a')](handleEntityNotFound(_0x35c2b1,null))[_0x2851('0x2a')](removeEntity(_0x35c2b1,null))[_0x2851('0x48')](handleError(_0x35c2b1,null));}; \ No newline at end of file +var _0x4c11=['api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','name','send','map','Template','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','params','rawAttributes','length','find','catch','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x38065b,_0x39133c){var _0x3cb11a=function(_0x4b8f7c){while(--_0x4b8f7c){_0x38065b['push'](_0x38065b['shift']());}};_0x3cb11a(++_0x39133c);}(_0x4c11,0x89));var _0x14c1=function(_0x1237b5,_0x4786ad){_0x1237b5=_0x1237b5-0x0;var _0x5a2b68=_0x4c11[_0x1237b5];return _0x5a2b68;};'use strict';var emlformat=require(_0x14c1('0x0'));var rimraf=require(_0x14c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c1('0x2'));var rp=require('request-promise');var moment=require(_0x14c1('0x3'));var BPromise=require(_0x14c1('0x4'));var Mustache=require(_0x14c1('0x5'));var util=require(_0x14c1('0x6'));var path=require(_0x14c1('0x7'));var sox=require(_0x14c1('0x8'));var csv=require(_0x14c1('0x9'));var ejs=require(_0x14c1('0xa'));var fs=require('fs');var fs_extra=require(_0x14c1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x14c1('0xc'));var jsforce=require(_0x14c1('0xd'));var deskjs=require(_0x14c1('0xe'));var toCsv=require(_0x14c1('0x9'));var querystring=require(_0x14c1('0xf'));var Papa=require('papaparse');var Redis=require(_0x14c1('0x10'));var authService=require(_0x14c1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x14c1('0x12'));var hardwareService=require(_0x14c1('0x13'));var logger=require(_0x14c1('0x14'))(_0x14c1('0x15'));var utils=require(_0x14c1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14c1('0x17'))['db'];function respondWithStatusCode(_0x3a2327,_0x487ab1){_0x487ab1=_0x487ab1||0xcc;return function(_0x4efed4){if(_0x4efed4){return _0x3a2327[_0x14c1('0x18')](_0x487ab1);}return _0x3a2327[_0x14c1('0x19')](_0x487ab1)[_0x14c1('0x1a')]();};}function respondWithResult(_0x137450,_0x1adaa9){_0x1adaa9=_0x1adaa9||0xc8;return function(_0x4755eb){if(_0x4755eb){return _0x137450[_0x14c1('0x19')](_0x1adaa9)['json'](_0x4755eb);}};}function respondWithFilteredResult(_0x586701,_0x1a25b0){return function(_0x2fe428){if(_0x2fe428){var _0x107cf2=typeof _0x1a25b0['offset']===_0x14c1('0x1b')&&typeof _0x1a25b0[_0x14c1('0x1c')]===_0x14c1('0x1b');var _0x24d582=_0x2fe428[_0x14c1('0x1d')];var _0xa90a57=_0x107cf2?0x0:_0x1a25b0[_0x14c1('0x1e')];var _0x10bf07=_0x107cf2?_0x2fe428[_0x14c1('0x1d')]:_0x1a25b0[_0x14c1('0x1e')]+_0x1a25b0[_0x14c1('0x1c')];var _0x28bb18;if(_0x10bf07>=_0x24d582){_0x10bf07=_0x24d582;_0x28bb18=0xc8;}else{_0x28bb18=0xce;}_0x586701[_0x14c1('0x19')](_0x28bb18);return _0x586701[_0x14c1('0x1f')](_0x14c1('0x20'),_0xa90a57+'-'+_0x10bf07+'/'+_0x24d582)[_0x14c1('0x21')](_0x2fe428);}return null;};}function patchUpdates(_0x2c6cb1){return function(_0x1e8c23){try{jsonpatch[_0x14c1('0x22')](_0x1e8c23,_0x2c6cb1,!![]);}catch(_0x35a908){return BPromise[_0x14c1('0x23')](_0x35a908);}return _0x1e8c23[_0x14c1('0x24')]();};}function saveUpdates(_0x540436,_0x56c159){return function(_0x2f7f8e){if(_0x2f7f8e){return _0x2f7f8e[_0x14c1('0x25')](_0x540436)[_0x14c1('0x26')](function(_0x3b8fb6){return _0x3b8fb6;});}return null;};}function removeEntity(_0x5216fd,_0x940690){return function(_0x44a94f){if(_0x44a94f){return _0x44a94f[_0x14c1('0x27')]()['then'](function(){var _0x4ea63e=_0x44a94f[_0x14c1('0x28')]({'plain':!![]});var _0x90bdba=_0x14c1('0x29');return db[_0x14c1('0x2a')][_0x14c1('0x27')]({'where':{'type':_0x90bdba,'resourceId':_0x4ea63e['id']}})['then'](function(){return _0x44a94f;});})[_0x14c1('0x26')](function(){_0x5216fd[_0x14c1('0x19')](0xcc)[_0x14c1('0x1a')]();});}};}function handleEntityNotFound(_0x328ffd,_0x49b55d){return function(_0x5913d1){if(!_0x5913d1){_0x328ffd['sendStatus'](0x194);}return _0x5913d1;};}function handleError(_0x5ab95f,_0x5540c0){_0x5540c0=_0x5540c0||0x1f4;return function(_0x301a28){logger[_0x14c1('0x2b')](_0x301a28['stack']);if(_0x301a28['name']){delete _0x301a28[_0x14c1('0x2c')];}_0x5ab95f['status'](_0x5540c0)[_0x14c1('0x2d')](_0x301a28);};}exports['index']=function(_0x4a913a,_0x10adac){var _0x3fbd1b={},_0xa4f1ec={},_0x2b1c0e={'count':0x0,'rows':[]};var _0xc4d457=_[_0x14c1('0x2e')](db[_0x14c1('0x2f')]['rawAttributes'],function(_0x266750){return{'name':_0x266750[_0x14c1('0x30')],'type':_0x266750[_0x14c1('0x31')]['key']};});_0xa4f1ec['model']=_[_0x14c1('0x2e')](_0xc4d457,_0x14c1('0x2c'));_0xa4f1ec[_0x14c1('0x32')]=_[_0x14c1('0x33')](_0x4a913a[_0x14c1('0x32')]);_0xa4f1ec[_0x14c1('0x34')]=_[_0x14c1('0x35')](_0xa4f1ec[_0x14c1('0x36')],_0xa4f1ec[_0x14c1('0x32')]);_0x3fbd1b[_0x14c1('0x37')]=_['intersection'](_0xa4f1ec[_0x14c1('0x36')],qs[_0x14c1('0x38')](_0x4a913a['query'][_0x14c1('0x38')]));_0x3fbd1b[_0x14c1('0x37')]=_0x3fbd1b[_0x14c1('0x37')]['length']?_0x3fbd1b['attributes']:_0xa4f1ec[_0x14c1('0x36')];if(!_0x4a913a[_0x14c1('0x32')]['hasOwnProperty'](_0x14c1('0x39'))){_0x3fbd1b[_0x14c1('0x1c')]=qs[_0x14c1('0x1c')](_0x4a913a['query'][_0x14c1('0x1c')]);_0x3fbd1b[_0x14c1('0x1e')]=qs['offset'](_0x4a913a[_0x14c1('0x32')][_0x14c1('0x1e')]);}_0x3fbd1b[_0x14c1('0x3a')]=qs[_0x14c1('0x3b')](_0x4a913a[_0x14c1('0x32')][_0x14c1('0x3b')]);_0x3fbd1b[_0x14c1('0x3c')]=qs[_0x14c1('0x34')](_[_0x14c1('0x3d')](_0x4a913a[_0x14c1('0x32')],_0xa4f1ec[_0x14c1('0x34')]),_0xc4d457);if(_0x4a913a[_0x14c1('0x32')]['filter']){_0x3fbd1b['where']=_[_0x14c1('0x3e')](_0x3fbd1b[_0x14c1('0x3c')],{'$or':_[_0x14c1('0x2e')](_0xc4d457,function(_0x45f1a5){if(_0x45f1a5[_0x14c1('0x31')]!==_0x14c1('0x3f')){var _0x1ab935={};_0x1ab935[_0x45f1a5[_0x14c1('0x2c')]]={'$like':'%'+_0x4a913a[_0x14c1('0x32')][_0x14c1('0x40')]+'%'};return _0x1ab935;}})});}_0x3fbd1b=_[_0x14c1('0x3e')]({},_0x3fbd1b,_0x4a913a[_0x14c1('0x41')]);var _0x16e0f7={'where':_0x3fbd1b[_0x14c1('0x3c')]};return db[_0x14c1('0x2f')][_0x14c1('0x1d')](_0x16e0f7)['then'](function(_0x4613d8){_0x2b1c0e[_0x14c1('0x1d')]=_0x4613d8;if(_0x4a913a[_0x14c1('0x32')]['includeAll']){_0x3fbd1b[_0x14c1('0x42')]=[{'all':!![]}];}return db[_0x14c1('0x2f')]['findAll'](_0x3fbd1b);})[_0x14c1('0x26')](function(_0x10c6f4){_0x2b1c0e['rows']=_0x10c6f4;return _0x2b1c0e;})[_0x14c1('0x26')](respondWithFilteredResult(_0x10adac,_0x3fbd1b))['catch'](handleError(_0x10adac,null));};exports['show']=function(_0x34a9f0,_0x5909e8){var _0x533690={'raw':!![],'where':{'id':_0x34a9f0[_0x14c1('0x43')]['id']}},_0xf4be59={};_0xf4be59[_0x14c1('0x36')]=_[_0x14c1('0x33')](db[_0x14c1('0x2f')][_0x14c1('0x44')]);_0xf4be59[_0x14c1('0x32')]=_['keys'](_0x34a9f0['query']);_0xf4be59['filters']=_[_0x14c1('0x35')](_0xf4be59['model'],_0xf4be59[_0x14c1('0x32')]);_0x533690[_0x14c1('0x37')]=_[_0x14c1('0x35')](_0xf4be59[_0x14c1('0x36')],qs[_0x14c1('0x38')](_0x34a9f0[_0x14c1('0x32')][_0x14c1('0x38')]));_0x533690['attributes']=_0x533690[_0x14c1('0x37')][_0x14c1('0x45')]?_0x533690[_0x14c1('0x37')]:_0xf4be59[_0x14c1('0x36')];if(_0x34a9f0[_0x14c1('0x32')]['includeAll']){_0x533690[_0x14c1('0x42')]=[{'all':!![]}];}_0x533690=_[_0x14c1('0x3e')]({},_0x533690,_0x34a9f0['options']);return db[_0x14c1('0x2f')][_0x14c1('0x46')](_0x533690)[_0x14c1('0x26')](handleEntityNotFound(_0x5909e8,null))[_0x14c1('0x26')](respondWithResult(_0x5909e8,null))[_0x14c1('0x47')](handleError(_0x5909e8,null));};exports['create']=function(_0x3305c7,_0x583182){return db[_0x14c1('0x2f')][_0x14c1('0x48')](_0x3305c7['body'],{})['then'](function(_0x50673d){var _0x2106b7=_0x3305c7[_0x14c1('0x49')][_0x14c1('0x28')]({'plain':!![]});if(!_0x2106b7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2106b7[_0x14c1('0x4a')]==='user'){var _0x125c62=_0x50673d[_0x14c1('0x28')]({'plain':!![]});var _0x3bd116='Templates';return db['UserProfileSection'][_0x14c1('0x46')]({'where':{'name':_0x3bd116,'userProfileId':_0x2106b7[_0x14c1('0x4b')]},'raw':!![]})[_0x14c1('0x26')](function(_0x563be4){if(_0x563be4&&_0x563be4[_0x14c1('0x4c')]===0x0){return db[_0x14c1('0x2a')][_0x14c1('0x48')]({'name':_0x125c62['name'],'resourceId':_0x125c62['id'],'type':_0x563be4[_0x14c1('0x2c')],'sectionId':_0x563be4['id']},{})[_0x14c1('0x26')](function(){return _0x50673d;});}else{return _0x50673d;}})[_0x14c1('0x47')](function(_0x30287d){logger[_0x14c1('0x2b')](_0x14c1('0x4d'),_0x30287d);throw _0x30287d;});}return _0x50673d;})[_0x14c1('0x26')](respondWithResult(_0x583182,0xc9))[_0x14c1('0x47')](handleError(_0x583182,null));};exports['update']=function(_0x28e71b,_0x419204){if(_0x28e71b['body']['id']){delete _0x28e71b[_0x14c1('0x4e')]['id'];}return db['Template'][_0x14c1('0x46')]({'where':{'id':_0x28e71b[_0x14c1('0x43')]['id']}})[_0x14c1('0x26')](handleEntityNotFound(_0x419204,null))[_0x14c1('0x26')](saveUpdates(_0x28e71b[_0x14c1('0x4e')],null))[_0x14c1('0x26')](respondWithResult(_0x419204,null))[_0x14c1('0x47')](handleError(_0x419204,null));};exports[_0x14c1('0x27')]=function(_0x92cc16,_0x188172){return db['Template'][_0x14c1('0x46')]({'where':{'id':_0x92cc16[_0x14c1('0x43')]['id']}})[_0x14c1('0x26')](handleEntityNotFound(_0x188172,null))[_0x14c1('0x26')](removeEntity(_0x188172,null))['catch'](handleError(_0x188172,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e7cc80d..c245f73 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 _0x9552=['moment','bluebird','request-promise','path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x9552,0xc4));var _0x2955=function(_0x5892e3,_0x41d768){_0x5892e3=_0x5892e3-0x0;var _0x2706cd=_0x9552[_0x5892e3];return _0x2706cd;};'use strict';var _=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2955('0x2'));var BPromise=require(_0x2955('0x3'));var rp=require(_0x2955('0x4'));var fs=require('fs');var path=require(_0x2955('0x5'));var rimraf=require('rimraf');var config=require(_0x2955('0x6'));var attributes=require(_0x2955('0x7'));module['exports']=function(_0x1c9ca6,_0x4a46b0){return _0x1c9ca6[_0x2955('0x8')](_0x2955('0x9'),attributes,{'tableName':_0x2955('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a7e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a7e,0xc0));var _0xe1a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1a7('0x0'));var util=require(_0xe1a7('0x1'));var logger=require(_0xe1a7('0x2'))(_0xe1a7('0x3'));var moment=require(_0xe1a7('0x4'));var BPromise=require(_0xe1a7('0x5'));var rp=require(_0xe1a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe1a7('0x7'));var config=require(_0xe1a7('0x8'));var attributes=require(_0xe1a7('0x9'));module[_0xe1a7('0xa')]=function(_0x4b17c2,_0x45319b){return _0x4b17c2['define'](_0xe1a7('0xb'),attributes,{'tableName':_0xe1a7('0xc'),'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 6f51ffb..ede4007 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 _0x49bf=['message','info','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x39642a,_0xf1650e){var _0x2ac68b=function(_0x30bb86){while(--_0x30bb86){_0x39642a['push'](_0x39642a['shift']());}};_0x2ac68b(++_0xf1650e);}(_0x49bf,0x126));var _0xf49b=function(_0x44671c,_0x2a7436){_0x44671c=_0x44671c-0x0;var _0x5a61bc=_0x49bf[_0x44671c];return _0x5a61bc;};'use strict';var _=require(_0xf49b('0x0'));var util=require(_0xf49b('0x1'));var moment=require(_0xf49b('0x2'));var BPromise=require(_0xf49b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf49b('0x4'));var db=require(_0xf49b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf49b('0x6'))(_0xf49b('0x7'));var config=require(_0xf49b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf49b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f1da,_0x3dd582,_0x5e25ff){return new BPromise(function(_0x1963ed,_0x1d5737){return client['request'](_0x10f1da,_0x5e25ff)['then'](function(_0x467e5b){logger['info'](_0xf49b('0xa'),_0x3dd582,'request\x20sent');logger[_0xf49b('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x3dd582,_0xf49b('0xc'),JSON[_0xf49b('0xd')](_0x467e5b));if(_0x467e5b[_0xf49b('0xe')]){if(_0x467e5b[_0xf49b('0xe')][_0xf49b('0xf')]===0x1f4){logger[_0xf49b('0xe')]('Template,\x20%s,\x20%s',_0x3dd582,_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);return _0x1d5737(_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);}logger[_0xf49b('0xe')](_0xf49b('0xa'),_0x3dd582,_0x467e5b[_0xf49b('0xe')]['message']);return _0x1963ed(_0x467e5b[_0xf49b('0xe')][_0xf49b('0x10')]);}else{logger[_0xf49b('0x11')](_0xf49b('0xa'),_0x3dd582,'request\x20sent');_0x1963ed(_0x467e5b[_0xf49b('0x12')][_0xf49b('0x10')]);}})[_0xf49b('0x13')](function(_0x179a6d){logger[_0xf49b('0xe')](_0xf49b('0xa'),_0x3dd582,_0x179a6d);_0x1d5737(_0x179a6d);});});}exports[_0xf49b('0x14')]=function(_0x85c7f8){var _0x40152e=this;return new Promise(function(_0x59b31b,_0x48c269){return db[_0xf49b('0x15')][_0xf49b('0x16')]({'raw':_0x85c7f8['options']?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x18')]===undefined?!![]:![]:!![],'where':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x19')]||null:null,'attributes':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x1a')]||null:null,'limit':_0x85c7f8['options']?_0x85c7f8[_0xf49b('0x17')]['limit']||null:null,'include':_0x85c7f8[_0xf49b('0x17')]?_0x85c7f8[_0xf49b('0x17')][_0xf49b('0x1b')]?_[_0xf49b('0x1c')](_0x85c7f8[_0xf49b('0x17')]['include'],function(_0x11f184){return{'model':db[_0x11f184['model']],'as':_0x11f184['as'],'attributes':_0x11f184[_0xf49b('0x1a')],'include':_0x11f184[_0xf49b('0x1b')]?_[_0xf49b('0x1c')](_0x11f184['include'],function(_0x41a214){return{'model':db[_0x41a214['model']],'as':_0x41a214['as'],'attributes':_0x41a214[_0xf49b('0x1a')],'include':_0x41a214['include']?_[_0xf49b('0x1c')](_0x41a214['include'],function(_0x18e59b){return{'model':db[_0x18e59b[_0xf49b('0x1d')]],'as':_0x18e59b['as'],'attributes':_0x18e59b[_0xf49b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf49b('0x1e')](function(_0x5a22cb){logger[_0xf49b('0x11')](_0xf49b('0x14'),_0x85c7f8);logger[_0xf49b('0xb')](_0xf49b('0x14'),_0x85c7f8,JSON[_0xf49b('0xd')](_0x5a22cb));_0x59b31b(_0x5a22cb);})[_0xf49b('0x13')](function(_0x41f71d){logger[_0xf49b('0xe')](_0xf49b('0x14'),_0x41f71d[_0xf49b('0x10')],_0x85c7f8);_0x48c269(_0x40152e[_0xf49b('0xe')](0x1f4,_0x41f71d[_0xf49b('0x10')]));});});}; \ No newline at end of file +var _0xb5d5=['stringify','error','code','message','info','result','catch','Template','findAll','options','raw','where','limit','include','model','attributes','map','GetTemplate','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s'];(function(_0x2f14f1,_0x28306e){var _0x5bb933=function(_0x4db4e0){while(--_0x4db4e0){_0x2f14f1['push'](_0x2f14f1['shift']());}};_0x5bb933(++_0x28306e);}(_0xb5d5,0x1c0));var _0x5b5d=function(_0x3351b7,_0x5d203f){_0x3351b7=_0x3351b7-0x0;var _0x294669=_0xb5d5[_0x3351b7];return _0x294669;};'use strict';var _=require('lodash');var util=require(_0x5b5d('0x0'));var moment=require('moment');var BPromise=require(_0x5b5d('0x1'));var rs=require(_0x5b5d('0x2'));var fs=require('fs');var Redis=require(_0x5b5d('0x3'));var db=require(_0x5b5d('0x4'))['db'];var utils=require(_0x5b5d('0x5'));var logger=require(_0x5b5d('0x6'))(_0x5b5d('0x7'));var config=require(_0x5b5d('0x8'));var jayson=require(_0x5b5d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34a891,_0x53a339,_0x34ce00){return new BPromise(function(_0x2f592f,_0x261ebe){return client['request'](_0x34a891,_0x34ce00)[_0x5b5d('0xa')](function(_0xfe6325){logger['info'](_0x5b5d('0xb'),_0x53a339,_0x5b5d('0xc'));logger['debug'](_0x5b5d('0xd'),_0x53a339,_0x5b5d('0xc'),JSON[_0x5b5d('0xe')](_0xfe6325));if(_0xfe6325[_0x5b5d('0xf')]){if(_0xfe6325[_0x5b5d('0xf')][_0x5b5d('0x10')]===0x1f4){logger[_0x5b5d('0xf')](_0x5b5d('0xb'),_0x53a339,_0xfe6325['error'][_0x5b5d('0x11')]);return _0x261ebe(_0xfe6325[_0x5b5d('0xf')][_0x5b5d('0x11')]);}logger[_0x5b5d('0xf')](_0x5b5d('0xb'),_0x53a339,_0xfe6325['error']['message']);return _0x2f592f(_0xfe6325[_0x5b5d('0xf')][_0x5b5d('0x11')]);}else{logger[_0x5b5d('0x12')](_0x5b5d('0xb'),_0x53a339,_0x5b5d('0xc'));_0x2f592f(_0xfe6325[_0x5b5d('0x13')][_0x5b5d('0x11')]);}})[_0x5b5d('0x14')](function(_0x63e205){logger[_0x5b5d('0xf')](_0x5b5d('0xb'),_0x53a339,_0x63e205);_0x261ebe(_0x63e205);});});}exports['GetTemplate']=function(_0x2e2c47){var _0x56b449=this;return new Promise(function(_0x38276f,_0x34d95c){return db[_0x5b5d('0x15')][_0x5b5d('0x16')]({'raw':_0x2e2c47[_0x5b5d('0x17')]?_0x2e2c47[_0x5b5d('0x17')][_0x5b5d('0x18')]===undefined?!![]:![]:!![],'where':_0x2e2c47['options']?_0x2e2c47[_0x5b5d('0x17')][_0x5b5d('0x19')]||null:null,'attributes':_0x2e2c47[_0x5b5d('0x17')]?_0x2e2c47[_0x5b5d('0x17')]['attributes']||null:null,'limit':_0x2e2c47[_0x5b5d('0x17')]?_0x2e2c47[_0x5b5d('0x17')][_0x5b5d('0x1a')]||null:null,'include':_0x2e2c47[_0x5b5d('0x17')]?_0x2e2c47['options'][_0x5b5d('0x1b')]?_['map'](_0x2e2c47[_0x5b5d('0x17')][_0x5b5d('0x1b')],function(_0x26e47b){return{'model':db[_0x26e47b[_0x5b5d('0x1c')]],'as':_0x26e47b['as'],'attributes':_0x26e47b[_0x5b5d('0x1d')],'include':_0x26e47b[_0x5b5d('0x1b')]?_[_0x5b5d('0x1e')](_0x26e47b[_0x5b5d('0x1b')],function(_0x223816){return{'model':db[_0x223816['model']],'as':_0x223816['as'],'attributes':_0x223816['attributes'],'include':_0x223816[_0x5b5d('0x1b')]?_[_0x5b5d('0x1e')](_0x223816[_0x5b5d('0x1b')],function(_0x413795){return{'model':db[_0x413795[_0x5b5d('0x1c')]],'as':_0x413795['as'],'attributes':_0x413795[_0x5b5d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x272587){logger[_0x5b5d('0x12')](_0x5b5d('0x1f'),_0x2e2c47);logger[_0x5b5d('0x20')](_0x5b5d('0x1f'),_0x2e2c47,JSON[_0x5b5d('0xe')](_0x272587));_0x38276f(_0x272587);})[_0x5b5d('0x14')](function(_0x504ec3){logger[_0x5b5d('0xf')](_0x5b5d('0x1f'),_0x504ec3[_0x5b5d('0x11')],_0x2e2c47);_0x34d95c(_0x56b449[_0x5b5d('0xf')](0x1f4,_0x504ec3[_0x5b5d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e06a58b..d08bc2d 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 _0x1373=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAction','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','isAuthenticated','index','/:id','show','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1373,0x1e1));var _0x3137=function(_0x46d354,_0x45fea4){_0x46d354=_0x46d354-0x0;var _0x2c6550=_0x1373[_0x46d354];return _0x2c6550;};'use strict';var multer=require(_0x3137('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3137('0x1'));var express=require(_0x3137('0x2'));var router=express[_0x3137('0x3')]();var fs_extra=require(_0x3137('0x4'));var auth=require(_0x3137('0x5'));var interaction=require(_0x3137('0x6'));var config=require('../../config/environment');var controller=require(_0x3137('0x7'));router['get']('/',auth[_0x3137('0x8')](),controller[_0x3137('0x9')]);router['get'](_0x3137('0xa'),auth['isAuthenticated'](),controller[_0x3137('0xb')]);router[_0x3137('0xc')]('/:id/all_conditions',auth[_0x3137('0x8')](),controller['getAllConditions']);router[_0x3137('0xc')](_0x3137('0xd'),auth[_0x3137('0x8')](),controller[_0x3137('0xe')]);router[_0x3137('0xc')](_0x3137('0xf'),auth[_0x3137('0x8')](),controller[_0x3137('0x10')]);router[_0x3137('0x11')]('/',auth[_0x3137('0x8')](),controller[_0x3137('0x12')]);router[_0x3137('0x11')](_0x3137('0x13'),auth[_0x3137('0x8')](),controller[_0x3137('0x14')]);router[_0x3137('0x11')](_0x3137('0xd'),auth[_0x3137('0x8')](),controller['addAnyCondition']);router[_0x3137('0x11')](_0x3137('0xf'),auth['isAuthenticated'](),controller[_0x3137('0x15')]);router[_0x3137('0x16')](_0x3137('0xa'),auth[_0x3137('0x8')](),controller[_0x3137('0x17')]);router[_0x3137('0x18')]('/:id',auth[_0x3137('0x8')](),controller[_0x3137('0x19')]);module['exports']=router; \ No newline at end of file +var _0x6b74=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/all_conditions'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x6b74,0xcc));var _0x46b7=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0x6b74[_0x5bfb78];return _0x4efd00;};'use strict';var multer=require(_0x46b7('0x0'));var util=require(_0x46b7('0x1'));var path=require('path');var timeout=require(_0x46b7('0x2'));var express=require(_0x46b7('0x3'));var router=express['Router']();var fs_extra=require(_0x46b7('0x4'));var auth=require(_0x46b7('0x5'));var interaction=require(_0x46b7('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x46b7('0x7')]('/',auth[_0x46b7('0x8')](),controller['index']);router[_0x46b7('0x7')](_0x46b7('0x9'),auth['isAuthenticated'](),controller[_0x46b7('0xa')]);router[_0x46b7('0x7')](_0x46b7('0xb'),auth[_0x46b7('0x8')](),controller['getAllConditions']);router[_0x46b7('0x7')](_0x46b7('0xc'),auth[_0x46b7('0x8')](),controller[_0x46b7('0xd')]);router[_0x46b7('0x7')](_0x46b7('0xe'),auth[_0x46b7('0x8')](),controller[_0x46b7('0xf')]);router[_0x46b7('0x10')]('/',auth[_0x46b7('0x8')](),controller['create']);router[_0x46b7('0x10')](_0x46b7('0xb'),auth[_0x46b7('0x8')](),controller[_0x46b7('0x11')]);router[_0x46b7('0x10')]('/:id/any_conditions',auth[_0x46b7('0x8')](),controller['addAnyCondition']);router[_0x46b7('0x10')](_0x46b7('0xe'),auth[_0x46b7('0x8')](),controller[_0x46b7('0x12')]);router[_0x46b7('0x13')]('/:id',auth[_0x46b7('0x8')](),controller[_0x46b7('0x14')]);router[_0x46b7('0x15')](_0x46b7('0x9'),auth[_0x46b7('0x8')](),controller[_0x46b7('0x16')]);module[_0x46b7('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e618aa8..ffd0e81 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 _0x04f7=['sequelize','STRING','BOOLEAN'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x04f7,0x1f2));var _0x704f=function(_0x2f5b57,_0x2e3cb1){_0x2f5b57=_0x2f5b57-0x0;var _0x137628=_0x04f7[_0x2f5b57];return _0x137628;};'use strict';var Sequelize=require(_0x704f('0x0'));module['exports']={'name':{'type':Sequelize[_0x704f('0x1')]},'channel':{'type':Sequelize[_0x704f('0x1')]},'description':{'type':Sequelize[_0x704f('0x1')]},'status':{'type':Sequelize[_0x704f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0400=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3eb017,_0x145f85){var _0x54f041=function(_0x1a65bf){while(--_0x1a65bf){_0x3eb017['push'](_0x3eb017['shift']());}};_0x54f041(++_0x145f85);}(_0x0400,0x1b8));var _0x0040=function(_0x47cd19,_0x32c8b6){_0x47cd19=_0x47cd19-0x0;var _0x13f174=_0x0400[_0x47cd19];return _0x13f174;};'use strict';var Sequelize=require(_0x0040('0x0'));module[_0x0040('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0040('0x2')]},'status':{'type':Sequelize[_0x0040('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 0cc0761..80a0d93 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 _0xa9e0=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','Trigger','include','findAll','rows','catch','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','body','params','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','getActions','Action','zip-dir','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','Triggers','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x352d55,_0x43aa7c){var _0x5743bb=function(_0x5ddfbb){while(--_0x5ddfbb){_0x352d55['push'](_0x352d55['shift']());}};_0x5743bb(++_0x43aa7c);}(_0xa9e0,0xe2));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0a9e('0x0'));var jsonpatch=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0a9e('0x4'));var ejs=require(_0x0a9e('0x5'));var fs=require('fs');var fs_extra=require(_0x0a9e('0x6'));var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require(_0x0a9e('0x9'));var jsforce=require(_0x0a9e('0xa'));var deskjs=require(_0x0a9e('0xb'));var toCsv=require(_0x0a9e('0x4'));var querystring=require(_0x0a9e('0xc'));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(_0x0a9e('0x13'))(_0x0a9e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x15'));var db=require(_0x0a9e('0x16'))['db'];function respondWithStatusCode(_0x490ae7,_0x28b2a5){_0x28b2a5=_0x28b2a5||0xcc;return function(_0x387f0a){if(_0x387f0a){return _0x490ae7[_0x0a9e('0x17')](_0x28b2a5);}return _0x490ae7[_0x0a9e('0x18')](_0x28b2a5)[_0x0a9e('0x19')]();};}function respondWithResult(_0x4e445f,_0xe956ee){_0xe956ee=_0xe956ee||0xc8;return function(_0x9515f4){if(_0x9515f4){return _0x4e445f[_0x0a9e('0x18')](_0xe956ee)[_0x0a9e('0x1a')](_0x9515f4);}};}function respondWithFilteredResult(_0x187b51,_0x3bb8ca){return function(_0x8860a4){if(_0x8860a4){var _0x2366f2=typeof _0x3bb8ca['offset']===_0x0a9e('0x1b')&&typeof _0x3bb8ca[_0x0a9e('0x1c')]===_0x0a9e('0x1b');var _0x10aff7=_0x8860a4[_0x0a9e('0x1d')];var _0x386727=_0x2366f2?0x0:_0x3bb8ca['offset'];var _0x37a046=_0x2366f2?_0x8860a4[_0x0a9e('0x1d')]:_0x3bb8ca[_0x0a9e('0x1e')]+_0x3bb8ca[_0x0a9e('0x1c')];var _0x28c391;if(_0x37a046>=_0x10aff7){_0x37a046=_0x10aff7;_0x28c391=0xc8;}else{_0x28c391=0xce;}_0x187b51[_0x0a9e('0x18')](_0x28c391);return _0x187b51[_0x0a9e('0x1f')]('Content-Range',_0x386727+'-'+_0x37a046+'/'+_0x10aff7)[_0x0a9e('0x1a')](_0x8860a4);}return null;};}function patchUpdates(_0x39d2cb){return function(_0x18ba46){try{jsonpatch[_0x0a9e('0x20')](_0x18ba46,_0x39d2cb,!![]);}catch(_0x19e3f5){return BPromise[_0x0a9e('0x21')](_0x19e3f5);}return _0x18ba46[_0x0a9e('0x22')]();};}function saveUpdates(_0x3af648,_0x37e5ca){return function(_0x838073){if(_0x838073){return _0x838073[_0x0a9e('0x23')](_0x3af648)[_0x0a9e('0x24')](function(_0xaf83f8){return _0xaf83f8;});}return null;};}function removeEntity(_0x100210,_0xe54240){return function(_0x23ca21){if(_0x23ca21){return _0x23ca21['destroy']()['then'](function(){var _0x1bd0ca=_0x23ca21[_0x0a9e('0x25')]({'plain':!![]});var _0x1fcf80=_0x0a9e('0x26');return db['UserProfileResource'][_0x0a9e('0x27')]({'where':{'type':_0x1fcf80,'resourceId':_0x1bd0ca['id']}})[_0x0a9e('0x24')](function(){return _0x23ca21;});})['then'](function(){_0x100210[_0x0a9e('0x18')](0xcc)[_0x0a9e('0x19')]();});}};}function handleEntityNotFound(_0x513383,_0x1c4875){return function(_0x52ffed){if(!_0x52ffed){_0x513383[_0x0a9e('0x17')](0x194);}return _0x52ffed;};}function handleError(_0x12a812,_0x51eaa3){_0x51eaa3=_0x51eaa3||0x1f4;return function(_0x59a053){logger[_0x0a9e('0x28')](_0x59a053['stack']);if(_0x59a053[_0x0a9e('0x29')]){delete _0x59a053[_0x0a9e('0x29')];}_0x12a812[_0x0a9e('0x18')](_0x51eaa3)[_0x0a9e('0x2a')](_0x59a053);};}exports[_0x0a9e('0x2b')]=function(_0x4ab1c9,_0x254025){var _0x3d2e72={},_0x42ea01={},_0x1db049={'count':0x0,'rows':[]};var _0x5a2fec=_[_0x0a9e('0x2c')](db['Trigger'][_0x0a9e('0x2d')],function(_0x593e75){return{'name':_0x593e75[_0x0a9e('0x2e')],'type':_0x593e75[_0x0a9e('0x2f')][_0x0a9e('0x30')]};});_0x42ea01[_0x0a9e('0x31')]=_['map'](_0x5a2fec,_0x0a9e('0x29'));_0x42ea01[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4ab1c9['query']);_0x42ea01['filters']=_[_0x0a9e('0x34')](_0x42ea01['model'],_0x42ea01['query']);_0x3d2e72[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x42ea01['model'],qs[_0x0a9e('0x36')](_0x4ab1c9[_0x0a9e('0x32')]['fields']));_0x3d2e72[_0x0a9e('0x35')]=_0x3d2e72[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3d2e72['attributes']:_0x42ea01[_0x0a9e('0x31')];if(!_0x4ab1c9['query'][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x3d2e72['limit']=qs[_0x0a9e('0x1c')](_0x4ab1c9[_0x0a9e('0x32')]['limit']);_0x3d2e72[_0x0a9e('0x1e')]=qs['offset'](_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x1e')]);}_0x3d2e72[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x3b')]);_0x3d2e72['where']=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x4ab1c9[_0x0a9e('0x32')],_0x42ea01[_0x0a9e('0x3c')]),_0x5a2fec);if(_0x4ab1c9[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3d2e72['where']=_[_0x0a9e('0x3f')](_0x3d2e72[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x5a2fec,function(_0x4c713e){if(_0x4c713e[_0x0a9e('0x2f')]!==_0x0a9e('0x41')){var _0x53e804={};_0x53e804[_0x4c713e['name']]={'$like':'%'+_0x4ab1c9[_0x0a9e('0x32')]['filter']+'%'};return _0x53e804;}})});}_0x3d2e72=_[_0x0a9e('0x3f')]({},_0x3d2e72,_0x4ab1c9[_0x0a9e('0x42')]);var _0x1a1407={'where':_0x3d2e72[_0x0a9e('0x40')]};return db[_0x0a9e('0x43')][_0x0a9e('0x1d')](_0x1a1407)[_0x0a9e('0x24')](function(_0x48f44e){_0x1db049[_0x0a9e('0x1d')]=_0x48f44e;if(_0x4ab1c9[_0x0a9e('0x32')]['includeAll']){_0x3d2e72[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x43')][_0x0a9e('0x45')](_0x3d2e72);})[_0x0a9e('0x24')](function(_0x23e57c){_0x1db049[_0x0a9e('0x46')]=_0x23e57c;return _0x1db049;})[_0x0a9e('0x24')](respondWithFilteredResult(_0x254025,_0x3d2e72))[_0x0a9e('0x47')](handleError(_0x254025,null));};exports[_0x0a9e('0x48')]=function(_0x5ecdb0,_0x4db2c6){var _0x4d0b96={'raw':![],'where':{'id':_0x5ecdb0['params']['id']}},_0x388e68={};_0x388e68[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db['Trigger'][_0x0a9e('0x2d')]);_0x388e68['query']=_[_0x0a9e('0x33')](_0x5ecdb0[_0x0a9e('0x32')]);_0x388e68['filters']=_['intersection'](_0x388e68[_0x0a9e('0x31')],_0x388e68[_0x0a9e('0x32')]);_0x4d0b96[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x388e68['model'],qs[_0x0a9e('0x36')](_0x5ecdb0[_0x0a9e('0x32')][_0x0a9e('0x36')]));_0x4d0b96[_0x0a9e('0x35')]=_0x4d0b96[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x4d0b96[_0x0a9e('0x35')]:_0x388e68[_0x0a9e('0x31')];if(_0x5ecdb0['query'][_0x0a9e('0x49')]){_0x4d0b96[_0x0a9e('0x44')]=[{'all':!![]}];}_0x4d0b96=_[_0x0a9e('0x3f')]({},_0x4d0b96,_0x5ecdb0[_0x0a9e('0x42')]);return db[_0x0a9e('0x43')][_0x0a9e('0x4a')](_0x4d0b96)['then'](handleEntityNotFound(_0x4db2c6,null))[_0x0a9e('0x24')](respondWithResult(_0x4db2c6,null))[_0x0a9e('0x47')](handleError(_0x4db2c6,null));};exports[_0x0a9e('0x4b')]=function(_0x33f27d,_0xbdffcb){return db[_0x0a9e('0x43')][_0x0a9e('0x4b')](_0x33f27d['body'],{})['then'](function(_0x5c6cfc){var _0x45da17=_0x33f27d[_0x0a9e('0x4c')][_0x0a9e('0x25')]({'plain':!![]});if(!_0x45da17)throw new Error(_0x0a9e('0x4d'));if(_0x45da17['role']===_0x0a9e('0x4c')){var _0x38aafe=_0x5c6cfc[_0x0a9e('0x25')]({'plain':!![]});var _0x5d6dee=_0x0a9e('0x26');return db['UserProfileSection'][_0x0a9e('0x4a')]({'where':{'name':_0x5d6dee,'userProfileId':_0x45da17[_0x0a9e('0x4e')]},'raw':!![]})[_0x0a9e('0x24')](function(_0x63d01b){if(_0x63d01b&&_0x63d01b['autoAssociation']===0x0){return db[_0x0a9e('0x4f')][_0x0a9e('0x4b')]({'name':_0x38aafe[_0x0a9e('0x29')],'resourceId':_0x38aafe['id'],'type':_0x63d01b[_0x0a9e('0x29')],'sectionId':_0x63d01b['id']},{})[_0x0a9e('0x24')](function(){return _0x5c6cfc;});}else{return _0x5c6cfc;}})[_0x0a9e('0x47')](function(_0x3439ef){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3439ef);throw _0x3439ef;});}return _0x5c6cfc;})[_0x0a9e('0x24')](respondWithResult(_0xbdffcb,0xc9))[_0x0a9e('0x47')](handleError(_0xbdffcb,null));};exports[_0x0a9e('0x23')]=function(_0xe27fdd,_0xb74f36){if(_0xe27fdd[_0x0a9e('0x50')]['id']){delete _0xe27fdd[_0x0a9e('0x50')]['id'];}return db['Trigger'][_0x0a9e('0x4a')]({'where':{'id':_0xe27fdd['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0xb74f36,null))[_0x0a9e('0x24')](saveUpdates(_0xe27fdd[_0x0a9e('0x50')],null))[_0x0a9e('0x24')](respondWithResult(_0xb74f36,null))[_0x0a9e('0x47')](handleError(_0xb74f36,null));};exports[_0x0a9e('0x27')]=function(_0x3e71e0,_0x3d27bf){return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x3e71e0[_0x0a9e('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d27bf,null))[_0x0a9e('0x24')](removeEntity(_0x3d27bf,null))[_0x0a9e('0x47')](handleError(_0x3d27bf,null));};exports['addAllCondition']=function(_0x47819d,_0x2af00c,_0x139ad6){if(_0x47819d[_0x0a9e('0x50')]['id']){delete _0x47819d[_0x0a9e('0x50')]['id'];}return db['Trigger'][_0x0a9e('0x4a')]({'where':{'id':_0x47819d[_0x0a9e('0x51')]['id']}})['then'](handleEntityNotFound(_0x2af00c,null))[_0x0a9e('0x24')](function(_0x434c23){if(_0x434c23){_0x47819d[_0x0a9e('0x50')][_0x0a9e('0x52')]=_0x434c23['id'];return db['Condition'][_0x0a9e('0x4b')](_0x47819d[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x2af00c,null))[_0x0a9e('0x47')](handleError(_0x2af00c,null));};exports[_0x0a9e('0x53')]=function(_0x25b672,_0x2757d6,_0x18438b){if(_0x25b672['body']['id']){delete _0x25b672[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x25b672['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x2757d6,null))[_0x0a9e('0x24')](function(_0x1d2aed){if(_0x1d2aed){_0x25b672[_0x0a9e('0x50')][_0x0a9e('0x54')]=_0x1d2aed['id'];return db[_0x0a9e('0x55')][_0x0a9e('0x4b')](_0x25b672[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x2757d6,null))[_0x0a9e('0x47')](handleError(_0x2757d6,null));};exports[_0x0a9e('0x56')]=function(_0x5610a6,_0x4c5221,_0x22cca4){var _0x224991={};var _0x394dc3={};var _0x5944f6;var _0x415567;return db[_0x0a9e('0x43')][_0x0a9e('0x57')]({'where':{'id':_0x5610a6[_0x0a9e('0x51')]['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x4c5221,null))[_0x0a9e('0x24')](function(_0x2c49d2){if(_0x2c49d2){_0x5944f6=_0x2c49d2;_0x394dc3[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2d')]);_0x394dc3[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x5610a6[_0x0a9e('0x32')]);_0x394dc3['filters']=_[_0x0a9e('0x34')](_0x394dc3['model'],_0x394dc3['query']);_0x224991[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x394dc3[_0x0a9e('0x31')],qs['fields'](_0x5610a6[_0x0a9e('0x32')]['fields']));_0x224991[_0x0a9e('0x35')]=_0x224991[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x224991[_0x0a9e('0x35')]:_0x394dc3['model'];_0x224991[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x5610a6[_0x0a9e('0x32')]['sort']);_0x224991['where']=qs['filters'](_[_0x0a9e('0x3d')](_0x5610a6['query'],_0x394dc3['filters']));if(_0x5610a6[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x224991[_0x0a9e('0x40')]=_[_0x0a9e('0x3f')](_0x224991['where'],{'$or':_[_0x0a9e('0x2c')](_0x224991[_0x0a9e('0x35')],function(_0x35e071){var _0x11e4be={};_0x11e4be[_0x35e071]={'$like':'%'+_0x5610a6['query'][_0x0a9e('0x3e')]+'%'};return _0x11e4be;})});}_0x224991=_[_0x0a9e('0x3f')]({},_0x224991,_0x5610a6[_0x0a9e('0x42')]);return _0x5944f6['getAllConditions'](_0x224991);}})[_0x0a9e('0x24')](function(_0x1f87d7){if(_0x1f87d7){_0x415567=_0x1f87d7['length'];if(!_0x5610a6['query'][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x224991[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5610a6[_0x0a9e('0x32')][_0x0a9e('0x1c')]);_0x224991[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x5610a6['query'][_0x0a9e('0x1e')]);}return _0x5944f6['getAllConditions'](_0x224991);}})['then'](function(_0x4f3215){if(_0x4f3215){return _0x4f3215?{'count':_0x415567,'rows':_0x4f3215}:null;}})[_0x0a9e('0x24')](respondWithResult(_0x4c5221,null))[_0x0a9e('0x47')](handleError(_0x4c5221,null));};exports['getAnyConditions']=function(_0x59f28d,_0x628a36,_0x52af4e){var _0x3972df={};var _0x57a8c4={};var _0x4035d5;var _0x380352;return db['Trigger'][_0x0a9e('0x57')]({'where':{'id':_0x59f28d['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x628a36,null))[_0x0a9e('0x24')](function(_0x2d298a){if(_0x2d298a){_0x4035d5=_0x2d298a;_0x57a8c4[_0x0a9e('0x31')]=_[_0x0a9e('0x33')](db[_0x0a9e('0x55')][_0x0a9e('0x2d')]);_0x57a8c4[_0x0a9e('0x32')]=_['keys'](_0x59f28d[_0x0a9e('0x32')]);_0x57a8c4[_0x0a9e('0x3c')]=_['intersection'](_0x57a8c4[_0x0a9e('0x31')],_0x57a8c4['query']);_0x3972df[_0x0a9e('0x35')]=_[_0x0a9e('0x34')](_0x57a8c4[_0x0a9e('0x31')],qs[_0x0a9e('0x36')](_0x59f28d['query']['fields']));_0x3972df[_0x0a9e('0x35')]=_0x3972df[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3972df[_0x0a9e('0x35')]:_0x57a8c4[_0x0a9e('0x31')];_0x3972df[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x3b')]);_0x3972df['where']=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x59f28d[_0x0a9e('0x32')],_0x57a8c4[_0x0a9e('0x3c')]));if(_0x59f28d[_0x0a9e('0x32')]['filter']){_0x3972df[_0x0a9e('0x40')]=_['merge'](_0x3972df[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x3972df[_0x0a9e('0x35')],function(_0x2afafc){var _0x771ea7={};_0x771ea7[_0x2afafc]={'$like':'%'+_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x3e')]+'%'};return _0x771ea7;})});}_0x3972df=_[_0x0a9e('0x3f')]({},_0x3972df,_0x59f28d[_0x0a9e('0x42')]);return _0x4035d5[_0x0a9e('0x58')](_0x3972df);}})['then'](function(_0x2bad95){if(_0x2bad95){_0x380352=_0x2bad95[_0x0a9e('0x37')];if(!_0x59f28d[_0x0a9e('0x32')]['hasOwnProperty'](_0x0a9e('0x39'))){_0x3972df[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x1c')]);_0x3972df[_0x0a9e('0x1e')]=qs[_0x0a9e('0x1e')](_0x59f28d[_0x0a9e('0x32')][_0x0a9e('0x1e')]);}return _0x4035d5['getAnyConditions'](_0x3972df);}})[_0x0a9e('0x24')](function(_0x3be807){if(_0x3be807){return _0x3be807?{'count':_0x380352,'rows':_0x3be807}:null;}})['then'](respondWithResult(_0x628a36,null))[_0x0a9e('0x47')](handleError(_0x628a36,null));};exports['addAction']=function(_0x2ac7ae,_0x35be11,_0x480472){if(_0x2ac7ae[_0x0a9e('0x50')]['id']){delete _0x2ac7ae[_0x0a9e('0x50')]['id'];}return db[_0x0a9e('0x43')][_0x0a9e('0x4a')]({'where':{'id':_0x2ac7ae[_0x0a9e('0x51')]['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x35be11,null))[_0x0a9e('0x24')](function(_0x1f9732){if(_0x1f9732){_0x2ac7ae[_0x0a9e('0x50')][_0x0a9e('0x59')]=_0x1f9732['id'];return db['Action'][_0x0a9e('0x4b')](_0x2ac7ae[_0x0a9e('0x50')]);}})['then'](respondWithResult(_0x35be11,null))['catch'](handleError(_0x35be11,null));};exports[_0x0a9e('0x5a')]=function(_0x4e1688,_0x3a2c7d,_0x59b5ec){var _0x3c0eef={};var _0x2cd781={};var _0x467c2f;var _0x2aa344;return db[_0x0a9e('0x43')]['findOne']({'where':{'id':_0x4e1688['params']['id']}})[_0x0a9e('0x24')](handleEntityNotFound(_0x3a2c7d,null))[_0x0a9e('0x24')](function(_0x8d2193){if(_0x8d2193){_0x467c2f=_0x8d2193;_0x2cd781['model']=_['keys'](db[_0x0a9e('0x5b')][_0x0a9e('0x2d')]);_0x2cd781[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x4e1688[_0x0a9e('0x32')]);_0x2cd781[_0x0a9e('0x3c')]=_[_0x0a9e('0x34')](_0x2cd781[_0x0a9e('0x31')],_0x2cd781[_0x0a9e('0x32')]);_0x3c0eef['attributes']=_['intersection'](_0x2cd781[_0x0a9e('0x31')],qs['fields'](_0x4e1688['query'][_0x0a9e('0x36')]));_0x3c0eef[_0x0a9e('0x35')]=_0x3c0eef[_0x0a9e('0x35')][_0x0a9e('0x37')]?_0x3c0eef[_0x0a9e('0x35')]:_0x2cd781[_0x0a9e('0x31')];_0x3c0eef['order']=qs[_0x0a9e('0x3b')](_0x4e1688['query'][_0x0a9e('0x3b')]);_0x3c0eef[_0x0a9e('0x40')]=qs[_0x0a9e('0x3c')](_[_0x0a9e('0x3d')](_0x4e1688[_0x0a9e('0x32')],_0x2cd781[_0x0a9e('0x3c')]));if(_0x4e1688[_0x0a9e('0x32')][_0x0a9e('0x3e')]){_0x3c0eef['where']=_['merge'](_0x3c0eef[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2c')](_0x3c0eef[_0x0a9e('0x35')],function(_0x17e3b7){var _0x36ac80={};_0x36ac80[_0x17e3b7]={'$like':'%'+_0x4e1688['query'][_0x0a9e('0x3e')]+'%'};return _0x36ac80;})});}_0x3c0eef=_[_0x0a9e('0x3f')]({},_0x3c0eef,_0x4e1688['options']);return _0x467c2f[_0x0a9e('0x5a')](_0x3c0eef);}})['then'](function(_0x3b2294){if(_0x3b2294){_0x2aa344=_0x3b2294['length'];if(!_0x4e1688[_0x0a9e('0x32')][_0x0a9e('0x38')](_0x0a9e('0x39'))){_0x3c0eef[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x4e1688[_0x0a9e('0x32')]['limit']);_0x3c0eef[_0x0a9e('0x1e')]=qs['offset'](_0x4e1688['query'][_0x0a9e('0x1e')]);}return _0x467c2f[_0x0a9e('0x5a')](_0x3c0eef);}})[_0x0a9e('0x24')](function(_0x54a1b0){if(_0x54a1b0){return _0x54a1b0?{'count':_0x2aa344,'rows':_0x54a1b0}:null;}})[_0x0a9e('0x24')](respondWithResult(_0x3a2c7d,null))[_0x0a9e('0x47')](handleError(_0x3a2c7d,null));}; \ No newline at end of file +var _0x9127=['index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','Trigger','includeAll','include','findAll','catch','options','find','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','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','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','end','json','offset','limit','undefined','count','status','Content-Range','reject','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name'];(function(_0xf45231,_0x4b18ff){var _0x5cc87e=function(_0x335f51){while(--_0x335f51){_0xf45231['push'](_0xf45231['shift']());}};_0x5cc87e(++_0x4b18ff);}(_0x9127,0x157));var _0x7912=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9127[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require(_0x7912('0x0'));var rimraf=require(_0x7912('0x1'));var zipdir=require(_0x7912('0x2'));var jsonpatch=require(_0x7912('0x3'));var rp=require(_0x7912('0x4'));var moment=require(_0x7912('0x5'));var BPromise=require(_0x7912('0x6'));var Mustache=require(_0x7912('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7912('0x8'));var csv=require(_0x7912('0x9'));var ejs=require(_0x7912('0xa'));var fs=require('fs');var fs_extra=require(_0x7912('0xb'));var _=require(_0x7912('0xc'));var squel=require('squel');var crypto=require(_0x7912('0xd'));var jsforce=require(_0x7912('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7912('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7912('0xf'));var authService=require(_0x7912('0x10'));var qs=require(_0x7912('0x11'));var as=require(_0x7912('0x12'));var hardwareService=require(_0x7912('0x13'));var logger=require(_0x7912('0x14'))(_0x7912('0x15'));var utils=require(_0x7912('0x16'));var config=require(_0x7912('0x17'));var licenseUtil=require(_0x7912('0x18'));var db=require(_0x7912('0x19'))['db'];function respondWithStatusCode(_0x25eaeb,_0xbee06a){_0xbee06a=_0xbee06a||0xcc;return function(_0xc08e16){if(_0xc08e16){return _0x25eaeb[_0x7912('0x1a')](_0xbee06a);}return _0x25eaeb['status'](_0xbee06a)[_0x7912('0x1b')]();};}function respondWithResult(_0x118359,_0x5cfd69){_0x5cfd69=_0x5cfd69||0xc8;return function(_0x1edc22){if(_0x1edc22){return _0x118359['status'](_0x5cfd69)[_0x7912('0x1c')](_0x1edc22);}};}function respondWithFilteredResult(_0x3a83ed,_0x5331ab){return function(_0x3ac417){if(_0x3ac417){var _0x2c58bc=typeof _0x5331ab[_0x7912('0x1d')]==='undefined'&&typeof _0x5331ab[_0x7912('0x1e')]===_0x7912('0x1f');var _0x59eec2=_0x3ac417['count'];var _0x3e1ced=_0x2c58bc?0x0:_0x5331ab[_0x7912('0x1d')];var _0x4e6bd1=_0x2c58bc?_0x3ac417[_0x7912('0x20')]:_0x5331ab[_0x7912('0x1d')]+_0x5331ab[_0x7912('0x1e')];var _0x504b53;if(_0x4e6bd1>=_0x59eec2){_0x4e6bd1=_0x59eec2;_0x504b53=0xc8;}else{_0x504b53=0xce;}_0x3a83ed[_0x7912('0x21')](_0x504b53);return _0x3a83ed['set'](_0x7912('0x22'),_0x3e1ced+'-'+_0x4e6bd1+'/'+_0x59eec2)[_0x7912('0x1c')](_0x3ac417);}return null;};}function patchUpdates(_0x1e9b0d){return function(_0x291fc1){try{jsonpatch['apply'](_0x291fc1,_0x1e9b0d,!![]);}catch(_0x263503){return BPromise[_0x7912('0x23')](_0x263503);}return _0x291fc1[_0x7912('0x24')]();};}function saveUpdates(_0x548b21,_0x13be3a){return function(_0x2022d6){if(_0x2022d6){return _0x2022d6[_0x7912('0x25')](_0x548b21)[_0x7912('0x26')](function(_0x491cd5){return _0x491cd5;});}return null;};}function removeEntity(_0x10c1d6,_0x2129cd){return function(_0x5a0e65){if(_0x5a0e65){return _0x5a0e65[_0x7912('0x27')]()[_0x7912('0x26')](function(){var _0x12a460=_0x5a0e65[_0x7912('0x28')]({'plain':!![]});var _0x5cb5e2=_0x7912('0x29');return db[_0x7912('0x2a')]['destroy']({'where':{'type':_0x5cb5e2,'resourceId':_0x12a460['id']}})[_0x7912('0x26')](function(){return _0x5a0e65;});})[_0x7912('0x26')](function(){_0x10c1d6['status'](0xcc)[_0x7912('0x1b')]();});}};}function handleEntityNotFound(_0x1f2428,_0x3e3037){return function(_0x51d467){if(!_0x51d467){_0x1f2428[_0x7912('0x1a')](0x194);}return _0x51d467;};}function handleError(_0x501505,_0x3a7aac){_0x3a7aac=_0x3a7aac||0x1f4;return function(_0x126403){logger['error'](_0x126403[_0x7912('0x2b')]);if(_0x126403[_0x7912('0x2c')]){delete _0x126403[_0x7912('0x2c')];}_0x501505[_0x7912('0x21')](_0x3a7aac)['send'](_0x126403);};}exports[_0x7912('0x2d')]=function(_0x2d84af,_0x53f99f){var _0x2d49a0={},_0x2e9d57={},_0x5a38f0={'count':0x0,'rows':[]};var _0x191a64=_['map'](db['Trigger'][_0x7912('0x2e')],function(_0x2b65ad){return{'name':_0x2b65ad[_0x7912('0x2f')],'type':_0x2b65ad['type'][_0x7912('0x30')]};});_0x2e9d57[_0x7912('0x31')]=_[_0x7912('0x32')](_0x191a64,'name');_0x2e9d57[_0x7912('0x33')]=_[_0x7912('0x34')](_0x2d84af['query']);_0x2e9d57[_0x7912('0x35')]=_[_0x7912('0x36')](_0x2e9d57[_0x7912('0x31')],_0x2e9d57[_0x7912('0x33')]);_0x2d49a0[_0x7912('0x37')]=_['intersection'](_0x2e9d57[_0x7912('0x31')],qs[_0x7912('0x38')](_0x2d84af[_0x7912('0x33')][_0x7912('0x38')]));_0x2d49a0[_0x7912('0x37')]=_0x2d49a0['attributes'][_0x7912('0x39')]?_0x2d49a0[_0x7912('0x37')]:_0x2e9d57[_0x7912('0x31')];if(!_0x2d84af[_0x7912('0x33')][_0x7912('0x3a')](_0x7912('0x3b'))){_0x2d49a0[_0x7912('0x1e')]=qs['limit'](_0x2d84af[_0x7912('0x33')][_0x7912('0x1e')]);_0x2d49a0[_0x7912('0x1d')]=qs[_0x7912('0x1d')](_0x2d84af[_0x7912('0x33')]['offset']);}_0x2d49a0[_0x7912('0x3c')]=qs[_0x7912('0x3d')](_0x2d84af[_0x7912('0x33')][_0x7912('0x3d')]);_0x2d49a0[_0x7912('0x3e')]=qs[_0x7912('0x35')](_[_0x7912('0x3f')](_0x2d84af['query'],_0x2e9d57[_0x7912('0x35')]),_0x191a64);if(_0x2d84af[_0x7912('0x33')][_0x7912('0x40')]){_0x2d49a0[_0x7912('0x3e')]=_[_0x7912('0x41')](_0x2d49a0['where'],{'$or':_['map'](_0x191a64,function(_0x129262){if(_0x129262[_0x7912('0x42')]!==_0x7912('0x43')){var _0x1c1b4c={};_0x1c1b4c[_0x129262[_0x7912('0x2c')]]={'$like':'%'+_0x2d84af[_0x7912('0x33')][_0x7912('0x40')]+'%'};return _0x1c1b4c;}})});}_0x2d49a0=_['merge']({},_0x2d49a0,_0x2d84af['options']);var _0x342eca={'where':_0x2d49a0[_0x7912('0x3e')]};return db[_0x7912('0x44')][_0x7912('0x20')](_0x342eca)['then'](function(_0x2864a9){_0x5a38f0[_0x7912('0x20')]=_0x2864a9;if(_0x2d84af[_0x7912('0x33')][_0x7912('0x45')]){_0x2d49a0[_0x7912('0x46')]=[{'all':!![]}];}return db[_0x7912('0x44')][_0x7912('0x47')](_0x2d49a0);})[_0x7912('0x26')](function(_0x1e89d2){_0x5a38f0['rows']=_0x1e89d2;return _0x5a38f0;})[_0x7912('0x26')](respondWithFilteredResult(_0x53f99f,_0x2d49a0))[_0x7912('0x48')](handleError(_0x53f99f,null));};exports['show']=function(_0x54a409,_0x2bcbc0){var _0x483c72={'raw':![],'where':{'id':_0x54a409['params']['id']}},_0xce96d7={};_0xce96d7[_0x7912('0x31')]=_[_0x7912('0x34')](db['Trigger'][_0x7912('0x2e')]);_0xce96d7[_0x7912('0x33')]=_['keys'](_0x54a409['query']);_0xce96d7[_0x7912('0x35')]=_[_0x7912('0x36')](_0xce96d7[_0x7912('0x31')],_0xce96d7[_0x7912('0x33')]);_0x483c72[_0x7912('0x37')]=_['intersection'](_0xce96d7[_0x7912('0x31')],qs[_0x7912('0x38')](_0x54a409['query'][_0x7912('0x38')]));_0x483c72[_0x7912('0x37')]=_0x483c72[_0x7912('0x37')][_0x7912('0x39')]?_0x483c72[_0x7912('0x37')]:_0xce96d7[_0x7912('0x31')];if(_0x54a409['query']['includeAll']){_0x483c72['include']=[{'all':!![]}];}_0x483c72=_[_0x7912('0x41')]({},_0x483c72,_0x54a409[_0x7912('0x49')]);return db[_0x7912('0x44')][_0x7912('0x4a')](_0x483c72)['then'](handleEntityNotFound(_0x2bcbc0,null))[_0x7912('0x26')](respondWithResult(_0x2bcbc0,null))[_0x7912('0x48')](handleError(_0x2bcbc0,null));};exports[_0x7912('0x4b')]=function(_0x5ecf52,_0x3d5d2f){return db[_0x7912('0x44')]['create'](_0x5ecf52['body'],{})[_0x7912('0x26')](function(_0x3fb9b6){var _0x39934b=_0x5ecf52[_0x7912('0x4c')][_0x7912('0x28')]({'plain':!![]});if(!_0x39934b)throw new Error(_0x7912('0x4d'));if(_0x39934b[_0x7912('0x4e')]===_0x7912('0x4c')){var _0x111113=_0x3fb9b6['get']({'plain':!![]});var _0x2d1c19=_0x7912('0x29');return db[_0x7912('0x4f')][_0x7912('0x4a')]({'where':{'name':_0x2d1c19,'userProfileId':_0x39934b[_0x7912('0x50')]},'raw':!![]})['then'](function(_0x261a6a){if(_0x261a6a&&_0x261a6a[_0x7912('0x51')]===0x0){return db[_0x7912('0x2a')][_0x7912('0x4b')]({'name':_0x111113[_0x7912('0x2c')],'resourceId':_0x111113['id'],'type':_0x261a6a[_0x7912('0x2c')],'sectionId':_0x261a6a['id']},{})['then'](function(){return _0x3fb9b6;});}else{return _0x3fb9b6;}})[_0x7912('0x48')](function(_0x5d9b51){logger[_0x7912('0x52')](_0x7912('0x53'),_0x5d9b51);throw _0x5d9b51;});}return _0x3fb9b6;})[_0x7912('0x26')](respondWithResult(_0x3d5d2f,0xc9))['catch'](handleError(_0x3d5d2f,null));};exports['update']=function(_0x533237,_0x38288f){if(_0x533237[_0x7912('0x54')]['id']){delete _0x533237[_0x7912('0x54')]['id'];}return db[_0x7912('0x44')]['find']({'where':{'id':_0x533237[_0x7912('0x55')]['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x38288f,null))['then'](saveUpdates(_0x533237[_0x7912('0x54')],null))['then'](respondWithResult(_0x38288f,null))['catch'](handleError(_0x38288f,null));};exports['destroy']=function(_0x55d5c9,_0x2fd628){return db['Trigger']['find']({'where':{'id':_0x55d5c9['params']['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x2fd628,null))[_0x7912('0x26')](removeEntity(_0x2fd628,null))[_0x7912('0x48')](handleError(_0x2fd628,null));};exports[_0x7912('0x56')]=function(_0x384da7,_0x348a1e,_0x14b35d){if(_0x384da7[_0x7912('0x54')]['id']){delete _0x384da7[_0x7912('0x54')]['id'];}return db[_0x7912('0x44')][_0x7912('0x4a')]({'where':{'id':_0x384da7[_0x7912('0x55')]['id']}})['then'](handleEntityNotFound(_0x348a1e,null))['then'](function(_0xbec05c){if(_0xbec05c){_0x384da7['body'][_0x7912('0x57')]=_0xbec05c['id'];return db[_0x7912('0x58')][_0x7912('0x4b')](_0x384da7['body']);}})[_0x7912('0x26')](respondWithResult(_0x348a1e,null))['catch'](handleError(_0x348a1e,null));};exports[_0x7912('0x59')]=function(_0x53c5a5,_0x67cc3c,_0x59db37){if(_0x53c5a5[_0x7912('0x54')]['id']){delete _0x53c5a5[_0x7912('0x54')]['id'];}return db[_0x7912('0x44')][_0x7912('0x4a')]({'where':{'id':_0x53c5a5[_0x7912('0x55')]['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x67cc3c,null))[_0x7912('0x26')](function(_0xa417df){if(_0xa417df){_0x53c5a5['body'][_0x7912('0x5a')]=_0xa417df['id'];return db[_0x7912('0x58')][_0x7912('0x4b')](_0x53c5a5[_0x7912('0x54')]);}})[_0x7912('0x26')](respondWithResult(_0x67cc3c,null))['catch'](handleError(_0x67cc3c,null));};exports[_0x7912('0x5b')]=function(_0x4d4d2d,_0x20f22d,_0x3046b3){var _0x4c40a5={};var _0x1a2e0b={};var _0x125eff;var _0x3baeb1;return db[_0x7912('0x44')]['findOne']({'where':{'id':_0x4d4d2d[_0x7912('0x55')]['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x20f22d,null))[_0x7912('0x26')](function(_0x3fd16b){if(_0x3fd16b){_0x125eff=_0x3fd16b;_0x1a2e0b[_0x7912('0x31')]=_[_0x7912('0x34')](db['Condition'][_0x7912('0x2e')]);_0x1a2e0b[_0x7912('0x33')]=_['keys'](_0x4d4d2d[_0x7912('0x33')]);_0x1a2e0b[_0x7912('0x35')]=_[_0x7912('0x36')](_0x1a2e0b[_0x7912('0x31')],_0x1a2e0b['query']);_0x4c40a5[_0x7912('0x37')]=_[_0x7912('0x36')](_0x1a2e0b['model'],qs['fields'](_0x4d4d2d[_0x7912('0x33')]['fields']));_0x4c40a5[_0x7912('0x37')]=_0x4c40a5[_0x7912('0x37')][_0x7912('0x39')]?_0x4c40a5['attributes']:_0x1a2e0b[_0x7912('0x31')];_0x4c40a5[_0x7912('0x3c')]=qs[_0x7912('0x3d')](_0x4d4d2d[_0x7912('0x33')][_0x7912('0x3d')]);_0x4c40a5[_0x7912('0x3e')]=qs[_0x7912('0x35')](_['pick'](_0x4d4d2d[_0x7912('0x33')],_0x1a2e0b['filters']));if(_0x4d4d2d[_0x7912('0x33')]['filter']){_0x4c40a5[_0x7912('0x3e')]=_[_0x7912('0x41')](_0x4c40a5['where'],{'$or':_[_0x7912('0x32')](_0x4c40a5[_0x7912('0x37')],function(_0x318865){var _0x16a553={};_0x16a553[_0x318865]={'$like':'%'+_0x4d4d2d['query']['filter']+'%'};return _0x16a553;})});}_0x4c40a5=_['merge']({},_0x4c40a5,_0x4d4d2d['options']);return _0x125eff[_0x7912('0x5b')](_0x4c40a5);}})['then'](function(_0x1729b3){if(_0x1729b3){_0x3baeb1=_0x1729b3[_0x7912('0x39')];if(!_0x4d4d2d[_0x7912('0x33')]['hasOwnProperty'](_0x7912('0x3b'))){_0x4c40a5['limit']=qs[_0x7912('0x1e')](_0x4d4d2d[_0x7912('0x33')][_0x7912('0x1e')]);_0x4c40a5[_0x7912('0x1d')]=qs[_0x7912('0x1d')](_0x4d4d2d[_0x7912('0x33')]['offset']);}return _0x125eff[_0x7912('0x5b')](_0x4c40a5);}})['then'](function(_0x414a23){if(_0x414a23){return _0x414a23?{'count':_0x3baeb1,'rows':_0x414a23}:null;}})[_0x7912('0x26')](respondWithResult(_0x20f22d,null))[_0x7912('0x48')](handleError(_0x20f22d,null));};exports[_0x7912('0x5c')]=function(_0x53a4db,_0x2a6ac3,_0x463dcc){var _0x541af1={};var _0x5098dd={};var _0x551a3d;var _0x27eac0;return db[_0x7912('0x44')][_0x7912('0x5d')]({'where':{'id':_0x53a4db[_0x7912('0x55')]['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x2a6ac3,null))[_0x7912('0x26')](function(_0x4cf16a){if(_0x4cf16a){_0x551a3d=_0x4cf16a;_0x5098dd[_0x7912('0x31')]=_[_0x7912('0x34')](db[_0x7912('0x58')]['rawAttributes']);_0x5098dd['query']=_[_0x7912('0x34')](_0x53a4db[_0x7912('0x33')]);_0x5098dd[_0x7912('0x35')]=_[_0x7912('0x36')](_0x5098dd['model'],_0x5098dd[_0x7912('0x33')]);_0x541af1[_0x7912('0x37')]=_[_0x7912('0x36')](_0x5098dd[_0x7912('0x31')],qs['fields'](_0x53a4db[_0x7912('0x33')][_0x7912('0x38')]));_0x541af1[_0x7912('0x37')]=_0x541af1[_0x7912('0x37')][_0x7912('0x39')]?_0x541af1[_0x7912('0x37')]:_0x5098dd[_0x7912('0x31')];_0x541af1[_0x7912('0x3c')]=qs['sort'](_0x53a4db['query'][_0x7912('0x3d')]);_0x541af1['where']=qs[_0x7912('0x35')](_[_0x7912('0x3f')](_0x53a4db[_0x7912('0x33')],_0x5098dd[_0x7912('0x35')]));if(_0x53a4db[_0x7912('0x33')][_0x7912('0x40')]){_0x541af1[_0x7912('0x3e')]=_['merge'](_0x541af1[_0x7912('0x3e')],{'$or':_['map'](_0x541af1[_0x7912('0x37')],function(_0xc1251c){var _0x47d396={};_0x47d396[_0xc1251c]={'$like':'%'+_0x53a4db[_0x7912('0x33')][_0x7912('0x40')]+'%'};return _0x47d396;})});}_0x541af1=_[_0x7912('0x41')]({},_0x541af1,_0x53a4db[_0x7912('0x49')]);return _0x551a3d[_0x7912('0x5c')](_0x541af1);}})[_0x7912('0x26')](function(_0x10f4c9){if(_0x10f4c9){_0x27eac0=_0x10f4c9['length'];if(!_0x53a4db[_0x7912('0x33')][_0x7912('0x3a')](_0x7912('0x3b'))){_0x541af1[_0x7912('0x1e')]=qs[_0x7912('0x1e')](_0x53a4db[_0x7912('0x33')]['limit']);_0x541af1[_0x7912('0x1d')]=qs[_0x7912('0x1d')](_0x53a4db['query']['offset']);}return _0x551a3d[_0x7912('0x5c')](_0x541af1);}})[_0x7912('0x26')](function(_0x191c59){if(_0x191c59){return _0x191c59?{'count':_0x27eac0,'rows':_0x191c59}:null;}})[_0x7912('0x26')](respondWithResult(_0x2a6ac3,null))['catch'](handleError(_0x2a6ac3,null));};exports['addAction']=function(_0xe471a2,_0x3033c3,_0x37cd95){if(_0xe471a2[_0x7912('0x54')]['id']){delete _0xe471a2[_0x7912('0x54')]['id'];}return db['Trigger'][_0x7912('0x4a')]({'where':{'id':_0xe471a2['params']['id']}})['then'](handleEntityNotFound(_0x3033c3,null))[_0x7912('0x26')](function(_0x3863f7){if(_0x3863f7){_0xe471a2[_0x7912('0x54')][_0x7912('0x5e')]=_0x3863f7['id'];return db[_0x7912('0x5f')][_0x7912('0x4b')](_0xe471a2[_0x7912('0x54')]);}})[_0x7912('0x26')](respondWithResult(_0x3033c3,null))[_0x7912('0x48')](handleError(_0x3033c3,null));};exports[_0x7912('0x60')]=function(_0x5ec02d,_0x41c4d4,_0x251c3f){var _0x1b3aaf={};var _0x122657={};var _0x56e9fb;var _0x4aa2d4;return db['Trigger'][_0x7912('0x5d')]({'where':{'id':_0x5ec02d[_0x7912('0x55')]['id']}})[_0x7912('0x26')](handleEntityNotFound(_0x41c4d4,null))[_0x7912('0x26')](function(_0x4a395c){if(_0x4a395c){_0x56e9fb=_0x4a395c;_0x122657[_0x7912('0x31')]=_[_0x7912('0x34')](db[_0x7912('0x5f')]['rawAttributes']);_0x122657[_0x7912('0x33')]=_['keys'](_0x5ec02d[_0x7912('0x33')]);_0x122657[_0x7912('0x35')]=_[_0x7912('0x36')](_0x122657[_0x7912('0x31')],_0x122657[_0x7912('0x33')]);_0x1b3aaf[_0x7912('0x37')]=_['intersection'](_0x122657[_0x7912('0x31')],qs[_0x7912('0x38')](_0x5ec02d[_0x7912('0x33')][_0x7912('0x38')]));_0x1b3aaf[_0x7912('0x37')]=_0x1b3aaf[_0x7912('0x37')][_0x7912('0x39')]?_0x1b3aaf[_0x7912('0x37')]:_0x122657[_0x7912('0x31')];_0x1b3aaf[_0x7912('0x3c')]=qs[_0x7912('0x3d')](_0x5ec02d[_0x7912('0x33')][_0x7912('0x3d')]);_0x1b3aaf['where']=qs['filters'](_[_0x7912('0x3f')](_0x5ec02d['query'],_0x122657['filters']));if(_0x5ec02d[_0x7912('0x33')][_0x7912('0x40')]){_0x1b3aaf[_0x7912('0x3e')]=_['merge'](_0x1b3aaf[_0x7912('0x3e')],{'$or':_['map'](_0x1b3aaf[_0x7912('0x37')],function(_0x3c9981){var _0x412375={};_0x412375[_0x3c9981]={'$like':'%'+_0x5ec02d[_0x7912('0x33')][_0x7912('0x40')]+'%'};return _0x412375;})});}_0x1b3aaf=_[_0x7912('0x41')]({},_0x1b3aaf,_0x5ec02d[_0x7912('0x49')]);return _0x56e9fb[_0x7912('0x60')](_0x1b3aaf);}})[_0x7912('0x26')](function(_0x11ccde){if(_0x11ccde){_0x4aa2d4=_0x11ccde['length'];if(!_0x5ec02d[_0x7912('0x33')]['hasOwnProperty'](_0x7912('0x3b'))){_0x1b3aaf[_0x7912('0x1e')]=qs[_0x7912('0x1e')](_0x5ec02d[_0x7912('0x33')][_0x7912('0x1e')]);_0x1b3aaf[_0x7912('0x1d')]=qs[_0x7912('0x1d')](_0x5ec02d[_0x7912('0x33')][_0x7912('0x1d')]);}return _0x56e9fb[_0x7912('0x60')](_0x1b3aaf);}})['then'](function(_0x58369d){if(_0x58369d){return _0x58369d?{'count':_0x4aa2d4,'rows':_0x58369d}:null;}})[_0x7912('0x26')](respondWithResult(_0x41c4d4,null))['catch'](handleError(_0x41c4d4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 1ed1e01..d91405d 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 _0xa9b1=['bluebird','request-promise','path','exports','define','Trigger','tools_triggers','../../config/logger','api','moment'];(function(_0x45a069,_0x19d0b5){var _0x58c780=function(_0x2c9187){while(--_0x2c9187){_0x45a069['push'](_0x45a069['shift']());}};_0x58c780(++_0x19d0b5);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1a9b('0x0'))(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var BPromise=require(_0x1a9b('0x3'));var rp=require(_0x1a9b('0x4'));var fs=require('fs');var path=require(_0x1a9b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x1a9b('0x6')]=function(_0x15861d,_0x1a78b6){return _0x15861d[_0x1a9b('0x7')](_0x1a9b('0x8'),attributes,{'tableName':_0x1a9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce50=['rimraf','exports','define','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x2e8dec,_0x1f7f60){var _0x54b607=function(_0x19e7d8){while(--_0x19e7d8){_0x2e8dec['push'](_0x2e8dec['shift']());}};_0x54b607(++_0x1f7f60);}(_0xce50,0x1d8));var _0x0ce5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xce50[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var logger=require(_0x0ce5('0x1'))(_0x0ce5('0x2'));var moment=require(_0x0ce5('0x3'));var BPromise=require(_0x0ce5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ce5('0x5'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x0ce5('0x6')]=function(_0x42fadd,_0x69892c){return _0x42fadd[_0x0ce5('0x7')]('Trigger',attributes,{'tableName':_0x0ce5('0x8'),'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 550c09a..9726f6b 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 _0x9b96=['options','raw','limit','include','map','model','attributes','stringify','ShowTrigger','Trigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0x9b96,0x9e));var _0x69b9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9b96[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x69b9('0x0'));var util=require(_0x69b9('0x1'));var moment=require(_0x69b9('0x2'));var BPromise=require(_0x69b9('0x3'));var rs=require(_0x69b9('0x4'));var fs=require('fs');var Redis=require(_0x69b9('0x5'));var db=require(_0x69b9('0x6'))['db'];var utils=require(_0x69b9('0x7'));var logger=require(_0x69b9('0x8'))(_0x69b9('0x9'));var config=require(_0x69b9('0xa'));var jayson=require(_0x69b9('0xb'));var client=jayson[_0x69b9('0xc')][_0x69b9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2f5f3d,_0x13382a,_0x2a9549){return new BPromise(function(_0x4411b9,_0x43fe8c){return client[_0x69b9('0xe')](_0x2f5f3d,_0x2a9549)[_0x69b9('0xf')](function(_0x1f889f){logger[_0x69b9('0x10')]('Trigger,\x20%s,\x20%s',_0x13382a,'request\x20sent');logger[_0x69b9('0x11')](_0x69b9('0x12'),_0x13382a,_0x69b9('0x13'),JSON['stringify'](_0x1f889f));if(_0x1f889f[_0x69b9('0x14')]){if(_0x1f889f['error'][_0x69b9('0x15')]===0x1f4){logger[_0x69b9('0x14')](_0x69b9('0x16'),_0x13382a,_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);return _0x43fe8c(_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x13382a,_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);return _0x4411b9(_0x1f889f[_0x69b9('0x14')][_0x69b9('0x17')]);}else{logger['info'](_0x69b9('0x16'),_0x13382a,_0x69b9('0x13'));_0x4411b9(_0x1f889f[_0x69b9('0x18')][_0x69b9('0x17')]);}})[_0x69b9('0x19')](function(_0xfb3c93){logger[_0x69b9('0x14')](_0x69b9('0x16'),_0x13382a,_0xfb3c93);_0x43fe8c(_0xfb3c93);});});}exports[_0x69b9('0x1a')]=function(_0x4f35c9){var _0x540c98=this;return new Promise(function(_0x43a9f6,_0x5f1843){return db['Trigger']['findAll']({'raw':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9['options'][_0x69b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9[_0x69b9('0x1b')]['where']||null:null,'attributes':_0x4f35c9['options']?_0x4f35c9['options']['attributes']||null:null,'limit':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9[_0x69b9('0x1b')][_0x69b9('0x1d')]||null:null,'include':_0x4f35c9[_0x69b9('0x1b')]?_0x4f35c9['options'][_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x4f35c9[_0x69b9('0x1b')]['include'],function(_0x3bb394){return{'model':db[_0x3bb394[_0x69b9('0x20')]],'as':_0x3bb394['as'],'attributes':_0x3bb394['attributes'],'include':_0x3bb394[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x3bb394[_0x69b9('0x1e')],function(_0x2fb521){return{'model':db[_0x2fb521[_0x69b9('0x20')]],'as':_0x2fb521['as'],'attributes':_0x2fb521['attributes'],'include':_0x2fb521[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x2fb521['include'],function(_0x154eef){return{'model':db[_0x154eef[_0x69b9('0x20')]],'as':_0x154eef['as'],'attributes':_0x154eef[_0x69b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x69b9('0xf')](function(_0x350979){logger[_0x69b9('0x10')](_0x69b9('0x1a'),_0x4f35c9);logger['debug'](_0x69b9('0x1a'),_0x4f35c9,JSON[_0x69b9('0x22')](_0x350979));_0x43a9f6(_0x350979);})[_0x69b9('0x19')](function(_0x4c397e){logger[_0x69b9('0x14')]('GetTrigger',_0x4c397e[_0x69b9('0x17')],_0x4f35c9);_0x5f1843(_0x540c98[_0x69b9('0x14')](0x1f4,_0x4c397e['message']));});});};exports[_0x69b9('0x23')]=function(_0x2f66b5){var _0x1f1f97=this;return new Promise(function(_0x4e7bc7,_0x12305c){return db[_0x69b9('0x24')]['find']({'raw':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5['options'][_0x69b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5[_0x69b9('0x1b')]['where']||null:null,'attributes':_0x2f66b5['options']?_0x2f66b5['options'][_0x69b9('0x21')]||null:null,'include':_0x2f66b5[_0x69b9('0x1b')]?_0x2f66b5['options'][_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x2f66b5[_0x69b9('0x1b')][_0x69b9('0x1e')],function(_0x226218){return{'model':db[_0x226218[_0x69b9('0x20')]],'as':_0x226218['as'],'attributes':_0x226218['attributes'],'include':_0x226218[_0x69b9('0x1e')]?_[_0x69b9('0x1f')](_0x226218['include'],function(_0x47c787){return{'model':db[_0x47c787[_0x69b9('0x20')]],'as':_0x47c787['as'],'attributes':_0x47c787[_0x69b9('0x21')],'include':_0x47c787[_0x69b9('0x1e')]?_['map'](_0x47c787['include'],function(_0x11709f){return{'model':db[_0x11709f[_0x69b9('0x20')]],'as':_0x11709f['as'],'attributes':_0x11709f[_0x69b9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x69b9('0xf')](function(_0x4963e4){logger[_0x69b9('0x10')]('ShowTrigger',_0x2f66b5);logger[_0x69b9('0x11')](_0x69b9('0x23'),_0x2f66b5,JSON['stringify'](_0x4963e4));_0x4e7bc7(_0x4963e4);})[_0x69b9('0x19')](function(_0x146554){logger['error'](_0x69b9('0x23'),_0x146554[_0x69b9('0x17')],_0x2f66b5);_0x12305c(_0x1f1f97[_0x69b9('0x14')](0x1f4,_0x146554[_0x69b9('0x17')]));});});}; \ No newline at end of file +var _0xf58c=['info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','ShowTrigger','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf58c,0x134));var _0xcf58=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0xf58c[_0x406696];return _0x10e35c;};'use strict';var _=require(_0xcf58('0x0'));var util=require(_0xcf58('0x1'));var moment=require(_0xcf58('0x2'));var BPromise=require(_0xcf58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf58('0x4'))['db'];var utils=require(_0xcf58('0x5'));var logger=require(_0xcf58('0x6'))(_0xcf58('0x7'));var config=require(_0xcf58('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcf58('0x9')][_0xcf58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x264dc5,_0x4fe809,_0x47ef03){return new BPromise(function(_0x36382b,_0x1bb1e9){return client['request'](_0x264dc5,_0x47ef03)[_0xcf58('0xb')](function(_0x4b0d13){logger[_0xcf58('0xc')](_0xcf58('0xd'),_0x4fe809,'request\x20sent');logger[_0xcf58('0xe')](_0xcf58('0xf'),_0x4fe809,_0xcf58('0x10'),JSON[_0xcf58('0x11')](_0x4b0d13));if(_0x4b0d13['error']){if(_0x4b0d13['error'][_0xcf58('0x12')]===0x1f4){logger['error'](_0xcf58('0xd'),_0x4fe809,_0x4b0d13[_0xcf58('0x13')][_0xcf58('0x14')]);return _0x1bb1e9(_0x4b0d13[_0xcf58('0x13')][_0xcf58('0x14')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x4fe809,_0x4b0d13['error'][_0xcf58('0x14')]);return _0x36382b(_0x4b0d13[_0xcf58('0x13')][_0xcf58('0x14')]);}else{logger[_0xcf58('0xc')](_0xcf58('0xd'),_0x4fe809,_0xcf58('0x10'));_0x36382b(_0x4b0d13['result'][_0xcf58('0x14')]);}})[_0xcf58('0x15')](function(_0xe512a9){logger[_0xcf58('0x13')]('Trigger,\x20%s,\x20%s',_0x4fe809,_0xe512a9);_0x1bb1e9(_0xe512a9);});});}exports[_0xcf58('0x16')]=function(_0x4d0950){var _0x56fcee=this;return new Promise(function(_0x5e4d95,_0x7de80f){return db[_0xcf58('0x17')]['findAll']({'raw':_0x4d0950[_0xcf58('0x18')]?_0x4d0950[_0xcf58('0x18')][_0xcf58('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0950['options']?_0x4d0950[_0xcf58('0x18')][_0xcf58('0x1a')]||null:null,'attributes':_0x4d0950[_0xcf58('0x18')]?_0x4d0950[_0xcf58('0x18')][_0xcf58('0x1b')]||null:null,'limit':_0x4d0950['options']?_0x4d0950[_0xcf58('0x18')]['limit']||null:null,'include':_0x4d0950[_0xcf58('0x18')]?_0x4d0950['options'][_0xcf58('0x1c')]?_[_0xcf58('0x1d')](_0x4d0950[_0xcf58('0x18')][_0xcf58('0x1c')],function(_0x8f58c8){return{'model':db[_0x8f58c8[_0xcf58('0x1e')]],'as':_0x8f58c8['as'],'attributes':_0x8f58c8[_0xcf58('0x1b')],'include':_0x8f58c8[_0xcf58('0x1c')]?_[_0xcf58('0x1d')](_0x8f58c8[_0xcf58('0x1c')],function(_0x4c0bd7){return{'model':db[_0x4c0bd7[_0xcf58('0x1e')]],'as':_0x4c0bd7['as'],'attributes':_0x4c0bd7[_0xcf58('0x1b')],'include':_0x4c0bd7[_0xcf58('0x1c')]?_[_0xcf58('0x1d')](_0x4c0bd7[_0xcf58('0x1c')],function(_0x7200fe){return{'model':db[_0x7200fe['model']],'as':_0x7200fe['as'],'attributes':_0x7200fe['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf58('0xb')](function(_0x52ba5c){logger['info']('GetTrigger',_0x4d0950);logger[_0xcf58('0xe')]('GetTrigger',_0x4d0950,JSON[_0xcf58('0x11')](_0x52ba5c));_0x5e4d95(_0x52ba5c);})[_0xcf58('0x15')](function(_0x1395e6){logger[_0xcf58('0x13')]('GetTrigger',_0x1395e6[_0xcf58('0x14')],_0x4d0950);_0x7de80f(_0x56fcee['error'](0x1f4,_0x1395e6[_0xcf58('0x14')]));});});};exports[_0xcf58('0x1f')]=function(_0x13964f){var _0x3c9cb6=this;return new Promise(function(_0x3af761,_0x5f0b23){return db[_0xcf58('0x17')]['find']({'raw':_0x13964f[_0xcf58('0x18')]?_0x13964f['options'][_0xcf58('0x19')]===undefined?!![]:![]:!![],'where':_0x13964f['options']?_0x13964f[_0xcf58('0x18')][_0xcf58('0x1a')]||null:null,'attributes':_0x13964f[_0xcf58('0x18')]?_0x13964f['options'][_0xcf58('0x1b')]||null:null,'include':_0x13964f[_0xcf58('0x18')]?_0x13964f[_0xcf58('0x18')][_0xcf58('0x1c')]?_['map'](_0x13964f[_0xcf58('0x18')][_0xcf58('0x1c')],function(_0x1bfc8e){return{'model':db[_0x1bfc8e[_0xcf58('0x1e')]],'as':_0x1bfc8e['as'],'attributes':_0x1bfc8e['attributes'],'include':_0x1bfc8e[_0xcf58('0x1c')]?_['map'](_0x1bfc8e['include'],function(_0x18581e){return{'model':db[_0x18581e['model']],'as':_0x18581e['as'],'attributes':_0x18581e[_0xcf58('0x1b')],'include':_0x18581e[_0xcf58('0x1c')]?_[_0xcf58('0x1d')](_0x18581e['include'],function(_0x4bc2a4){return{'model':db[_0x4bc2a4[_0xcf58('0x1e')]],'as':_0x4bc2a4['as'],'attributes':_0x4bc2a4[_0xcf58('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcf58('0xb')](function(_0x592552){logger['info'](_0xcf58('0x1f'),_0x13964f);logger['debug'](_0xcf58('0x1f'),_0x13964f,JSON[_0xcf58('0x11')](_0x592552));_0x3af761(_0x592552);})[_0xcf58('0x15')](function(_0x549085){logger[_0xcf58('0x13')]('ShowTrigger',_0x549085[_0xcf58('0x14')],_0x13964f);_0x5f0b23(_0x3c9cb6[_0xcf58('0x13')](0x1f4,_0x549085[_0xcf58('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index f9b0e48..bf7d326 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 _0xb006=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x58e32c,_0x309781){var _0x481e60=function(_0x5326ab){while(--_0x5326ab){_0x58e32c['push'](_0x58e32c['shift']());}};_0x481e60(++_0x309781);}(_0xb006,0x184));var _0x6b00=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0xb006[_0x14af87];return _0x4ff770;};'use strict';var multer=require(_0x6b00('0x0'));var util=require('util');var path=require(_0x6b00('0x1'));var timeout=require(_0x6b00('0x2'));var express=require(_0x6b00('0x3'));var router=express['Router']();var fs_extra=require(_0x6b00('0x4'));var auth=require(_0x6b00('0x5'));var interaction=require(_0x6b00('0x6'));var config=require(_0x6b00('0x7'));var controller=require('./trunk.controller');router[_0x6b00('0x8')]('/',auth[_0x6b00('0x9')](),controller[_0x6b00('0xa')]);router[_0x6b00('0x8')](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller['show']);router[_0x6b00('0xc')]('/:id/clone',auth[_0x6b00('0x9')](),controller['clone']);router[_0x6b00('0xc')]('/',auth[_0x6b00('0x9')](),controller[_0x6b00('0xd')]);router['put'](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller[_0x6b00('0xe')]);router[_0x6b00('0xf')](_0x6b00('0xb'),auth[_0x6b00('0x9')](),controller[_0x6b00('0x10')]);module[_0x6b00('0x11')]=router; \ No newline at end of file +var _0x754d=['/:id','post','/:id/clone','create','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1ff6b4,_0x56296e){var _0x57f725=function(_0x3467ce){while(--_0x3467ce){_0x1ff6b4['push'](_0x1ff6b4['shift']());}};_0x57f725(++_0x56296e);}(_0x754d,0xd3));var _0xd754=function(_0x210f26,_0x8ba116){_0x210f26=_0x210f26-0x0;var _0x18839f=_0x754d[_0x210f26];return _0x18839f;};'use strict';var multer=require(_0xd754('0x0'));var util=require('util');var path=require(_0xd754('0x1'));var timeout=require(_0xd754('0x2'));var express=require('express');var router=express[_0xd754('0x3')]();var fs_extra=require(_0xd754('0x4'));var auth=require(_0xd754('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd754('0x6'));var controller=require('./trunk.controller');router[_0xd754('0x7')]('/',auth[_0xd754('0x8')](),controller[_0xd754('0x9')]);router[_0xd754('0x7')](_0xd754('0xa'),auth[_0xd754('0x8')](),controller['show']);router[_0xd754('0xb')](_0xd754('0xc'),auth['isAuthenticated'](),controller['clone']);router[_0xd754('0xb')]('/',auth[_0xd754('0x8')](),controller[_0xd754('0xd')]);router['put'](_0xd754('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd754('0xe')](_0xd754('0xa'),auth['isAuthenticated'](),controller[_0xd754('0xf')]);module[_0xd754('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index cfc09f6..1dcad5d 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 _0xda8a=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\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','refuse','originate','uac','uas','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xda8a,0x17b));var _0xada8=function(_0x3b8021,_0x1c9435){_0x3b8021=_0x3b8021-0x0;var _0x285028=_0xda8a[_0x3b8021];return _0x285028;};'use strict';var Sequelize=require('sequelize');module[_0xada8('0x0')]={'name':{'type':Sequelize[_0xada8('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x3'),_0xada8('0x4'),_0xada8('0x5')),'allowNull':![],'defaultValue':_0xada8('0x3')},'context':{'type':Sequelize[_0xada8('0x1')],'allowNull':![],'defaultValue':_0xada8('0x6')},'callingpres':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x7'),_0xada8('0x8'),'ALLOWED_FAILED_SCREEN',_0xada8('0x9'),_0xada8('0xa'),_0xada8('0xb'),'PROHIB_FAILED_SCREEN',_0xada8('0xc'))},'deny':{'type':Sequelize[_0xada8('0x1')]},'permit':{'type':Sequelize[_0xada8('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xada8('0x1')]},'remotesecret':{'type':Sequelize[_0xada8('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5376bc){this[_0xada8('0xd')](_0xada8('0xe'),_0x5376bc?_0x5376bc[_0xada8('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xada8('0xe'))?this[_0xada8('0x10')]('transport')[_0xada8('0x11')](','):null;},'comment':_0xada8('0x12')},'dtmfmode':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x13'),_0xada8('0x14'),_0xada8('0x15'),_0xada8('0x16'),_0xada8('0x17')),'defaultValue':_0xada8('0x13')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat',_0xada8('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xada8('0x1')]},'directmediadeny':{'type':Sequelize[_0xada8('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x144a2a){this[_0xada8('0xd')](_0xada8('0x1a'),_0x144a2a?_0x144a2a[_0xada8('0xf')](','):null);},'get':function(){return this[_0xada8('0x10')](_0xada8('0x1a'))?this[_0xada8('0x10')](_0xada8('0x1a'))[_0xada8('0x11')](','):null;},'comment':_0xada8('0x1b')},'callgroup':{'type':Sequelize[_0xada8('0x1')]},'namedcallgroup':{'type':Sequelize[_0xada8('0x1')]},'pickupgroup':{'type':Sequelize[_0xada8('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xada8('0x1')]},'language':{'type':Sequelize[_0xada8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xada8('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2329f6){this[_0xada8('0xd')](_0xada8('0x1c'),_0x2329f6?_0x2329f6[_0xada8('0xf')](';'):_0xada8('0x1d'));},'get':function(){return this[_0xada8('0x10')]('allow')?this[_0xada8('0x10')]('allow')['split'](';'):null;},'comment':_0xada8('0x1e')},'autoframing':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'insecure':{'type':Sequelize[_0xada8('0x1')],'defaultValue':_0xada8('0x1f'),'set':function(_0x11fa11){this[_0xada8('0xd')](_0xada8('0x20'),_0x11fa11?_0x11fa11[_0xada8('0xf')](','):null);},'get':function(){return this[_0xada8('0x10')]('insecure')?this[_0xada8('0x10')](_0xada8('0x20'))['split'](','):null;},'comment':_0xada8('0x21')},'trustrpid':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xada8('0x19'),'no',_0xada8('0x22'))},'promiscredir':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0xada8('0x23')](0xb)},'setvar':{'type':Sequelize[_0xada8('0x1')]},'callerid':{'type':Sequelize[_0xada8('0x1')],'defaultValue':_0xada8('0x24')},'amaflags':{'type':Sequelize[_0xada8('0x1')]},'callcounter':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':_0xada8('0x19')},'busylevel':{'type':Sequelize[_0xada8('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xada8('0x1')]},'template':{'type':Sequelize[_0xada8('0x1')]},'videosupport':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no',_0xada8('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xada8('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'mailbox':{'type':Sequelize[_0xada8('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xada8('0x26'),_0xada8('0x27'))},'session_expires':{'type':Sequelize[_0xada8('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x28'),_0xada8('0x29')),'defaultValue':_0xada8('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xada8('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xada8('0x1')]},'port':{'type':Sequelize[_0xada8('0x23')](0x5)},'qualify':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':_0xada8('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xada8('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xada8('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xada8('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xada8('0x1')]},'callbackextension':{'type':Sequelize[_0xada8('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xada8('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xada8('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xada8('0x1')]},'contactdeny':{'type':Sequelize[_0xada8('0x1')]},'contactacl':{'type':Sequelize[_0xada8('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xada8('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xada8('0x23')](0xb)},'encryption':{'type':Sequelize[_0xada8('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','fingerprint',_0xada8('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xada8('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xada8('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xada8('0x1')]},'dtlscapath':{'type':Sequelize[_0xada8('0x1')]},'dtlssetup':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x2b'),_0xada8('0x2c'),_0xada8('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xada8('0x1')]},'usereqphone':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xada8('0x1')]},'recordofffeature':{'type':Sequelize[_0xada8('0x1')]},'call_limit':{'type':Sequelize[_0xada8('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xada8('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xada8('0x1')]},'mohsuggest':{'type':Sequelize[_0xada8('0x1')]},'parkinglot':{'type':Sequelize[_0xada8('0x1')]},'description':{'type':Sequelize[_0xada8('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xada8('0x2e')},'canreinvite':{'type':Sequelize[_0xada8('0x2')](_0xada8('0x19'),'no','nonat',_0xada8('0x18'),_0xada8('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xada8('0x1')]},'otherFields':{'type':Sequelize[_0xada8('0x1')]},'active':{'type':Sequelize[_0xada8('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xada8('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc5d7=['rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x4077e9,_0x479afc){var _0x3673b8=function(_0x331eb3){while(--_0x331eb3){_0x4077e9['push'](_0x4077e9['shift']());}};_0x3673b8(++_0x479afc);}(_0xc5d7,0x185));var _0x7c5d=function(_0x15c147,_0x4a3398){_0x15c147=_0x15c147-0x0;var _0x3acb04=_0xc5d7[_0x15c147];return _0x3acb04;};'use strict';var Sequelize=require(_0x7c5d('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c5d('0x1')],'allowNull':![],'unique':_0x7c5d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7c5d('0x3'),_0x7c5d('0x4'),_0x7c5d('0x5')),'allowNull':![],'defaultValue':_0x7c5d('0x3')},'context':{'type':Sequelize[_0x7c5d('0x1')],'allowNull':![],'defaultValue':_0x7c5d('0x6')},'callingpres':{'type':Sequelize[_0x7c5d('0x7')]('ALLOWED_NOT_SCREENED',_0x7c5d('0x8'),'ALLOWED_FAILED_SCREEN',_0x7c5d('0x9'),_0x7c5d('0xa'),'PROHIB_PASSED_SCREEN',_0x7c5d('0xb'),_0x7c5d('0xc'))},'deny':{'type':Sequelize[_0x7c5d('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x7c5d('0x1')]},'md5secret':{'type':Sequelize[_0x7c5d('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':_0x7c5d('0xd'),'set':function(_0x1c553c){this['setDataValue']('transport',_0x1c553c?_0x1c553c[_0x7c5d('0xe')](','):null);},'get':function(){return this[_0x7c5d('0xf')](_0x7c5d('0x10'))?this[_0x7c5d('0xf')](_0x7c5d('0x10'))[_0x7c5d('0x11')](','):null;},'comment':_0x7c5d('0x12')},'dtmfmode':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x13'),_0x7c5d('0x14'),_0x7c5d('0x15'),_0x7c5d('0x16'),_0x7c5d('0x17')),'defaultValue':_0x7c5d('0x13')},'directmedia':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no',_0x7c5d('0x19'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':_0x7c5d('0x1a'),'set':function(_0x1fd9d4){this[_0x7c5d('0x1b')]('nat',_0x1fd9d4?_0x1fd9d4[_0x7c5d('0xe')](','):null);},'get':function(){return this[_0x7c5d('0xf')](_0x7c5d('0x1c'))?this[_0x7c5d('0xf')]('nat')[_0x7c5d('0x11')](','):null;},'comment':_0x7c5d('0x1d')},'callgroup':{'type':Sequelize[_0x7c5d('0x1')]},'namedcallgroup':{'type':Sequelize[_0x7c5d('0x1')]},'pickupgroup':{'type':Sequelize[_0x7c5d('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7c5d('0x1')]},'language':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7c5d('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x7c5d('0x1e')},'allow':{'type':Sequelize[_0x7c5d('0x1')],'allowNull':![],'defaultValue':_0x7c5d('0x1f'),'set':function(_0x388915){this[_0x7c5d('0x1b')](_0x7c5d('0x20'),_0x388915?_0x388915[_0x7c5d('0xe')](';'):_0x7c5d('0x1f'));},'get':function(){return this['getDataValue'](_0x7c5d('0x20'))?this['getDataValue'](_0x7c5d('0x20'))['split'](';'):null;},'comment':_0x7c5d('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x7c5d('0x18'),'no')},'insecure':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':'port,invite','set':function(_0x45cd8a){this[_0x7c5d('0x1b')](_0x7c5d('0x22'),_0x45cd8a?_0x45cd8a[_0x7c5d('0xe')](','):null);},'get':function(){return this[_0x7c5d('0xf')](_0x7c5d('0x22'))?this[_0x7c5d('0xf')]('insecure')[_0x7c5d('0x11')](','):null;},'comment':_0x7c5d('0x23')},'trustrpid':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x7c5d('0x24'))},'promiscredir':{'type':Sequelize[_0x7c5d('0x7')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x7c5d('0x18'),'no')},'accountcode':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':_0x7c5d('0x26')},'amaflags':{'type':Sequelize[_0x7c5d('0x1')]},'callcounter':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':_0x7c5d('0x18')},'busylevel':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7c5d('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x7c5d('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7c5d('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x7c5d('0x1')]},'template':{'type':Sequelize[_0x7c5d('0x1')]},'videosupport':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no',_0x7c5d('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no')},'mailbox':{'type':Sequelize[_0x7c5d('0x1')]},'session_timers':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x28'),_0x7c5d('0x29'),_0x7c5d('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x7c5d('0x7')]('uac',_0x7c5d('0x2b')),'defaultValue':_0x7c5d('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x7c5d('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7c5d('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7c5d('0x25')](0x5)},'qualify':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x7c5d('0x1')]},'defaultuser':{'type':Sequelize[_0x7c5d('0x1')]},'rtptimeout':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7c5d('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'timerb':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x7c5d('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x7c5d('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7c5d('0x1')]},'maxforwards':{'type':Sequelize[_0x7c5d('0x25')](0xb)},'encryption':{'type':Sequelize[_0x7c5d('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no')},'force_avp':{'type':Sequelize[_0x7c5d('0x7')]('yes','no')},'icesupport':{'type':Sequelize[_0x7c5d('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no','fingerprint',_0x7c5d('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x7c5d('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7c5d('0x1')]},'dtlscapath':{'type':Sequelize[_0x7c5d('0x1')]},'dtlssetup':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x2d'),_0x7c5d('0x2e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7c5d('0x1')]},'usereqphone':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7c5d('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x7c5d('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no')},'vmexten':{'type':Sequelize[_0x7c5d('0x1')]},'mohinterpret':{'type':Sequelize[_0x7c5d('0x1')]},'mohsuggest':{'type':Sequelize[_0x7c5d('0x1')]},'parkinglot':{'type':Sequelize[_0x7c5d('0x1')]},'description':{'type':Sequelize[_0x7c5d('0x1')]},'host':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':_0x7c5d('0x2f')},'canreinvite':{'type':Sequelize[_0x7c5d('0x7')](_0x7c5d('0x18'),'no',_0x7c5d('0x19'),_0x7c5d('0x30'),_0x7c5d('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7c5d('0x1')]},'otherFields':{'type':Sequelize[_0x7c5d('0x1')]},'active':{'type':Sequelize[_0x7c5d('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7c5d('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index a191cd2..2ff074b 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','clone','find','get','createdAt','body','omit','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','update','utf8','server/files/templates/registry.ejs','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','order'];(function(_0x285b20,_0x16d411){var _0x2451b0=function(_0x387194){while(--_0x387194){_0x285b20['push'](_0x285b20['shift']());}};_0x2451b0(++_0x16d411);}(_0x6aa7,0x178));var _0x76aa=function(_0x19e57f,_0x400ae9){_0x19e57f=_0x19e57f-0x0;var _0x5046a1=_0x6aa7[_0x19e57f];return _0x5046a1;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x76aa('0x19'));var client=jayson['client'][_0x76aa('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12dde0,_0x3f8f6b,_0x8e44ed,_0x10432c){return new BPromise(function(_0x4e309f,_0x5f5b59){var _0x2b3b4f=_0x10432c||client;return _0x2b3b4f['request'](_0x12dde0,_0x8e44ed)[_0x76aa('0x1b')](function(_0x319bf1){logger['info'](_0x76aa('0x1c'),_0x3f8f6b,'request\x20sent');logger[_0x76aa('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3f8f6b,_0x76aa('0x1e'),JSON[_0x76aa('0x1f')](_0x319bf1));if(_0x319bf1[_0x76aa('0x20')]){if(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x21')]===0x1f4){logger[_0x76aa('0x20')]('Trunk,\x20%s,\x20%s',_0x3f8f6b,_0x319bf1['error'][_0x76aa('0x22')]);return _0x5f5b59(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);return _0x4e309f(_0x319bf1[_0x76aa('0x20')][_0x76aa('0x22')]);}else{logger['info'](_0x76aa('0x1c'),_0x3f8f6b,_0x76aa('0x1e'));_0x4e309f(_0x319bf1[_0x76aa('0x23')]['message']);}})[_0x76aa('0x24')](function(_0x189cb6){logger[_0x76aa('0x20')](_0x76aa('0x1c'),_0x3f8f6b,_0x189cb6);_0x5f5b59(_0x189cb6);});});}function respondWithStatusCode(_0x29c50c,_0xc1044c){_0xc1044c=_0xc1044c||0xcc;return function(_0x3cd039){if(_0x3cd039){return _0x29c50c[_0x76aa('0x25')](_0xc1044c);}return _0x29c50c[_0x76aa('0x26')](_0xc1044c)[_0x76aa('0x27')]();};}function respondWithResult(_0x37f1ab,_0x26b75e){_0x26b75e=_0x26b75e||0xc8;return function(_0x3599a9){if(_0x3599a9){return _0x37f1ab['status'](_0x26b75e)[_0x76aa('0x28')](_0x3599a9);}};}function respondWithFilteredResult(_0x1d6d15,_0x25c614){return function(_0x2e7ab4){if(_0x2e7ab4){var _0xa1e6=typeof _0x25c614[_0x76aa('0x29')]===_0x76aa('0x2a')&&typeof _0x25c614[_0x76aa('0x2b')]===_0x76aa('0x2a');var _0x1bdc3d=_0x2e7ab4['count'];var _0x3fcb7f=_0xa1e6?0x0:_0x25c614['offset'];var _0x994550=_0xa1e6?_0x2e7ab4[_0x76aa('0x2c')]:_0x25c614[_0x76aa('0x29')]+_0x25c614[_0x76aa('0x2b')];var _0x1eecd9;if(_0x994550>=_0x1bdc3d){_0x994550=_0x1bdc3d;_0x1eecd9=0xc8;}else{_0x1eecd9=0xce;}_0x1d6d15[_0x76aa('0x26')](_0x1eecd9);return _0x1d6d15[_0x76aa('0x2d')](_0x76aa('0x2e'),_0x3fcb7f+'-'+_0x994550+'/'+_0x1bdc3d)[_0x76aa('0x28')](_0x2e7ab4);}return null;};}function patchUpdates(_0x3ea05a){return function(_0x5edcd8){try{jsonpatch[_0x76aa('0x2f')](_0x5edcd8,_0x3ea05a,!![]);}catch(_0x5532c7){return BPromise[_0x76aa('0x30')](_0x5532c7);}return _0x5edcd8[_0x76aa('0x31')]();};}function saveUpdates(_0x458ac3,_0x38ecd1){return function(_0x35a705){if(_0x35a705){return _0x35a705['update'](_0x458ac3)[_0x76aa('0x1b')](function(_0x25a11f){return _0x25a11f;});}return null;};}function removeEntity(_0x5a0f72,_0x2ee338){return function(_0x58d860){if(_0x58d860){return _0x58d860[_0x76aa('0x32')]()['then'](function(){var _0x8479a3=_0x58d860['get']({'plain':!![]});var _0x58f135=_0x76aa('0x33');return db[_0x76aa('0x34')][_0x76aa('0x32')]({'where':{'type':_0x58f135,'resourceId':_0x8479a3['id']}})[_0x76aa('0x1b')](function(){return _0x58d860;});})['then'](function(){_0x5a0f72['status'](0xcc)[_0x76aa('0x27')]();});}};}function handleEntityNotFound(_0x1c7b6f,_0x58127c){return function(_0x23e2fd){if(!_0x23e2fd){_0x1c7b6f[_0x76aa('0x25')](0x194);}return _0x23e2fd;};}function handleError(_0x5b57d8,_0x9ce5f4){_0x9ce5f4=_0x9ce5f4||0x1f4;return function(_0x5c77f1){logger['error'](_0x5c77f1[_0x76aa('0x35')]);if(_0x5c77f1[_0x76aa('0x36')]){delete _0x5c77f1[_0x76aa('0x36')];}_0x5b57d8[_0x76aa('0x26')](_0x9ce5f4)['send'](_0x5c77f1);};}exports[_0x76aa('0x37')]=function(_0x1c22f7,_0x2eea79){var _0x4e131a={},_0x113770={},_0x1638db={'count':0x0,'rows':[]};var _0x2f7726=_[_0x76aa('0x38')](db[_0x76aa('0x39')][_0x76aa('0x3a')],function(_0x878903){return{'name':_0x878903[_0x76aa('0x3b')],'type':_0x878903[_0x76aa('0x3c')]['key']};});_0x113770[_0x76aa('0x3d')]=_[_0x76aa('0x38')](_0x2f7726,_0x76aa('0x36'));_0x113770[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x1c22f7[_0x76aa('0x3e')]);_0x113770['filters']=_['intersection'](_0x113770[_0x76aa('0x3d')],_0x113770[_0x76aa('0x3e')]);_0x4e131a[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x113770['model'],qs[_0x76aa('0x42')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x4e131a[_0x76aa('0x40')]=_0x4e131a[_0x76aa('0x40')]['length']?_0x4e131a[_0x76aa('0x40')]:_0x113770['model'];if(!_0x1c22f7[_0x76aa('0x3e')]['hasOwnProperty']('nolimit')){_0x4e131a['limit']=qs[_0x76aa('0x2b')](_0x1c22f7['query']['limit']);_0x4e131a['offset']=qs[_0x76aa('0x29')](_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x29')]);}_0x4e131a[_0x76aa('0x43')]=qs[_0x76aa('0x44')](_0x1c22f7['query'][_0x76aa('0x44')]);_0x4e131a[_0x76aa('0x45')]=qs[_0x76aa('0x46')](_[_0x76aa('0x47')](_0x1c22f7[_0x76aa('0x3e')],_0x113770['filters']),_0x2f7726);if(_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]){_0x4e131a['where']=_[_0x76aa('0x49')](_0x4e131a['where'],{'$or':_[_0x76aa('0x38')](_0x2f7726,function(_0x24ea05){if(_0x24ea05[_0x76aa('0x3c')]!==_0x76aa('0x4a')){var _0x2d0bc4={};_0x2d0bc4[_0x24ea05[_0x76aa('0x36')]]={'$like':'%'+_0x1c22f7[_0x76aa('0x3e')][_0x76aa('0x48')]+'%'};return _0x2d0bc4;}})});}_0x4e131a=_[_0x76aa('0x49')]({},_0x4e131a,_0x1c22f7[_0x76aa('0x4b')]);var _0x5e4967={'where':_0x4e131a[_0x76aa('0x45')]};return db['Trunk'][_0x76aa('0x2c')](_0x5e4967)[_0x76aa('0x1b')](function(_0x5e95f5){_0x1638db[_0x76aa('0x2c')]=_0x5e95f5;if(_0x1c22f7['query']['includeAll']){_0x4e131a[_0x76aa('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x76aa('0x4d')](_0x4e131a);})[_0x76aa('0x1b')](function(_0x4315b3){_0x1638db[_0x76aa('0x4e')]=_0x4315b3;return _0x1638db;})[_0x76aa('0x1b')](respondWithFilteredResult(_0x2eea79,_0x4e131a))[_0x76aa('0x24')](handleError(_0x2eea79,null));};exports['show']=function(_0x564546,_0x2fcf8f){var _0x1eafb2={'raw':![],'where':{'id':_0x564546[_0x76aa('0x4f')]['id']}},_0x1708d4={};_0x1708d4[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x1708d4[_0x76aa('0x3e')]=_[_0x76aa('0x3f')](_0x564546['query']);_0x1708d4[_0x76aa('0x46')]=_['intersection'](_0x1708d4[_0x76aa('0x3d')],_0x1708d4['query']);_0x1eafb2[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x1708d4[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x564546[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x1eafb2[_0x76aa('0x40')]=_0x1eafb2['attributes'][_0x76aa('0x50')]?_0x1eafb2['attributes']:_0x1708d4[_0x76aa('0x3d')];if(_0x564546[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x1eafb2[_0x76aa('0x4c')]=[{'all':!![]}];}_0x1eafb2=_[_0x76aa('0x49')]({},_0x1eafb2,_0x564546[_0x76aa('0x4b')]);return db[_0x76aa('0x39')]['find'](_0x1eafb2)[_0x76aa('0x1b')](handleEntityNotFound(_0x2fcf8f,null))[_0x76aa('0x1b')](respondWithResult(_0x2fcf8f,null))[_0x76aa('0x24')](handleError(_0x2fcf8f,null));};exports[_0x76aa('0x52')]=function(_0x5c742c,_0xb9401b){var _0x163440={'where':{'id':_0x5c742c[_0x76aa('0x4f')]['id']}},_0x8dc601={};_0x8dc601[_0x76aa('0x3d')]=_[_0x76aa('0x3f')](db['Trunk'][_0x76aa('0x3a')]);_0x163440[_0x76aa('0x40')]=_[_0x76aa('0x41')](_0x8dc601[_0x76aa('0x3d')],qs[_0x76aa('0x42')](_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x42')]));_0x163440['attributes']=_0x163440['attributes'][_0x76aa('0x50')]?_0x163440[_0x76aa('0x40')]:_0x8dc601['model'];if(_0x5c742c[_0x76aa('0x3e')][_0x76aa('0x51')]){_0x163440['include']=[{'all':!![]}];}_0x163440=_[_0x76aa('0x49')]({},_0x163440,_0x5c742c[_0x76aa('0x4b')]);return db[_0x76aa('0x39')][_0x76aa('0x53')](_0x163440)[_0x76aa('0x1b')](handleEntityNotFound(_0xb9401b,null))[_0x76aa('0x1b')](function(_0x3376ec){if(_0x3376ec){var _0x30573a=_0x3376ec[_0x76aa('0x54')]({'plain':!![]});_0x30573a=qs['omit'](_0x30573a,['id',_0x76aa('0x55'),'updatedAt']);_0x5c742c[_0x76aa('0x56')]=_[_0x76aa('0x57')](_0x5c742c[_0x76aa('0x56')],['id',_0x76aa('0x55'),_0x76aa('0x58')]);return db[_0x76aa('0x39')][_0x76aa('0x59')](_[_0x76aa('0x49')](_0x30573a,_0x5c742c[_0x76aa('0x56')]),{'include':_0x5c742c['query'][_0x76aa('0x51')]?[{'all':!![]}]:undefined})[_0x76aa('0x1b')](function(_0x5c542b){var _0xe5957d=_0x5c742c[_0x76aa('0x5a')][_0x76aa('0x54')]({'plain':!![]});if(!_0xe5957d)throw new Error(_0x76aa('0x5b'));if(_0xe5957d[_0x76aa('0x5c')]==='user'){var _0x364d05=_0x5c542b['get']({'plain':!![]});var _0x35bd2b=_0x76aa('0x33');return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':_0x35bd2b,'userProfileId':_0xe5957d[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x2bfb46){if(_0x2bfb46&&_0x2bfb46['autoAssociation']===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x364d05['name'],'resourceId':_0x364d05['id'],'type':_0x2bfb46['name'],'sectionId':_0x2bfb46['id']},{})[_0x76aa('0x1b')](function(){return _0x5c542b;});}else{return _0x5c542b;}})[_0x76aa('0x24')](function(_0x5295a7){logger[_0x76aa('0x20')](_0x76aa('0x5f'),_0x5295a7);throw _0x5295a7;});}return _0x5c542b;});}})[_0x76aa('0x1b')](respondWithResult(_0xb9401b,0xc9))['catch'](handleError(_0xb9401b,null));};exports[_0x76aa('0x59')]=function(_0x47f733,_0xf31e1f,_0x1178e5){var _0x2315cf;return db[_0x76aa('0x39')]['create'](_0x47f733['body'],{'raw':!![]})[_0x76aa('0x1b')](function(_0x4dfeb3){_0x2315cf=_0x4dfeb3;return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x43a2af){var _0x2dd320=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x63')),'utf8');var _0x7d02e7=fs[_0x76aa('0x60')](path[_0x76aa('0x61')](config[_0x76aa('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x557c11=ejs[_0x76aa('0x64')](_0x2dd320,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x65'),_0x557c11);if(_0x2315cf[_0x76aa('0x66')]){var _0x38faff=ejs[_0x76aa('0x64')](_0x7d02e7,{'trunks':_0x43a2af||[]});fs['writeFileSync'](_0x76aa('0x67'),_0x38faff);}})['then'](function(){return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x59'),{'module':_0x76aa('0x69')});})[_0x76aa('0x1b')](function(){var _0x1037fb=_0x47f733['user'][_0x76aa('0x54')]({'plain':!![]});if(!_0x1037fb)throw new Error(_0x76aa('0x5b'));if(_0x1037fb[_0x76aa('0x5c')]===_0x76aa('0x5a')){var _0x32c1de=_0x2315cf[_0x76aa('0x54')]({'plain':!![]});return db[_0x76aa('0x5d')][_0x76aa('0x53')]({'where':{'name':'Trunks','userProfileId':_0x1037fb[_0x76aa('0x5e')]},'raw':!![]})[_0x76aa('0x1b')](function(_0x48136a){if(_0x48136a&&_0x48136a[_0x76aa('0x6a')]===0x0){return db[_0x76aa('0x34')][_0x76aa('0x59')]({'name':_0x32c1de[_0x76aa('0x36')],'resourceId':_0x32c1de['id'],'type':_0x48136a[_0x76aa('0x36')],'sectionId':_0x48136a['id']},{})[_0x76aa('0x1b')](function(){return _0x2315cf;});}else{return _0x2315cf;}})[_0x76aa('0x24')](function(_0x5dc923){logger[_0x76aa('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dc923);throw _0x5dc923;});}return _0x2315cf;})['then'](respondWithResult(_0xf31e1f,0xc9))[_0x76aa('0x24')](handleError(_0xf31e1f,null));};exports[_0x76aa('0x6b')]=function(_0x5d8947,_0x5d1de1,_0x36da4d){var _0x14b5a2;return db[_0x76aa('0x39')]['find']({'where':{'id':_0x5d8947['params']['id']}})[_0x76aa('0x1b')](handleEntityNotFound(_0x5d1de1,null))[_0x76aa('0x1b')](saveUpdates(_0x5d8947[_0x76aa('0x56')],null))['then'](function(_0xb70589){if(_0xb70589){_0x14b5a2=_0xb70589;return db['Trunk'][_0x76aa('0x4d')]({'raw':!![]});}})[_0x76aa('0x1b')](function(_0x383290){if(_0x383290){var _0x325ffa=fs[_0x76aa('0x60')](path['join'](config['root'],_0x76aa('0x63')),_0x76aa('0x6c'));var _0x19ebb7=fs['readFileSync'](path[_0x76aa('0x61')](config[_0x76aa('0x62')],_0x76aa('0x6d')),_0x76aa('0x6c'));var _0x303b78=ejs['render'](_0x325ffa,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x303b78);var _0x213f7f=ejs[_0x76aa('0x64')](_0x19ebb7,{'trunks':_0x383290||[]});fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x213f7f);return respondWithRpcPromise(_0x76aa('0x68'),_0x76aa('0x6b'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x547411){if(_0x547411){return _0x14b5a2;}})['then'](respondWithResult(_0x5d1de1,null))['catch'](handleError(_0x5d1de1,null));};exports[_0x76aa('0x32')]=function(_0x22f44f,_0x52c5be,_0x5c2c91){var _0x4f01e9;return db[_0x76aa('0x39')][_0x76aa('0x53')]({'where':{'id':_0x22f44f[_0x76aa('0x4f')]['id']}})['then'](handleEntityNotFound(_0x52c5be,null))['then'](removeEntity(_0x52c5be,null))[_0x76aa('0x1b')](function(){return db[_0x76aa('0x39')][_0x76aa('0x4d')]({'raw':!![]});})[_0x76aa('0x1b')](function(_0x354c7b){var _0x55e526=fs['readFileSync'](path[_0x76aa('0x61')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x4673e6=fs[_0x76aa('0x60')](path['join'](config[_0x76aa('0x62')],_0x76aa('0x6d')),'utf8');var _0x22063f=ejs[_0x76aa('0x64')](_0x55e526,{'trunks':_0x354c7b});var _0x11d91f=ejs[_0x76aa('0x64')](_0x4673e6,{'trunks':_0x354c7b});fs[_0x76aa('0x6e')](_0x76aa('0x65'),_0x22063f);fs[_0x76aa('0x6e')](_0x76aa('0x67'),_0x11d91f);return respondWithRpcPromise(_0x76aa('0x68'),'destroy',{'module':_0x76aa('0x69')});})[_0x76aa('0x24')](handleError(_0x52c5be,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1ceedc,_0x17e4c9){_0x1ceedc=_0x1ceedc-0x0;var _0xfef10d=_0xe5b3[_0x1ceedc];return _0xfef10d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 41c38c6..62ac447 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 _0x542a=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./trunk.attributes'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x542a,0x162));var _0xa542=function(_0x506df8,_0x3498da){_0x506df8=_0x506df8-0x0;var _0x54aa08=_0x542a[_0x506df8];return _0x54aa08;};'use strict';var _=require(_0xa542('0x0'));var util=require(_0xa542('0x1'));var logger=require(_0xa542('0x2'))(_0xa542('0x3'));var moment=require(_0xa542('0x4'));var BPromise=require(_0xa542('0x5'));var rp=require(_0xa542('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa542('0x7'));var config=require('../../config/environment');var attributes=require(_0xa542('0x8'));module['exports']=function(_0x111b54,_0x324118){return _0x111b54['define'](_0xa542('0x9'),attributes,{'tableName':_0xa542('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6919=['./trunk.attributes','exports','define','tools_trunks','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6919,0x148));var _0x9691=function(_0x398d85,_0x2465d7){_0x398d85=_0x398d85-0x0;var _0x33c2bb=_0x6919[_0x398d85];return _0x33c2bb;};'use strict';var _=require(_0x9691('0x0'));var util=require(_0x9691('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9691('0x2'));var BPromise=require(_0x9691('0x3'));var rp=require(_0x9691('0x4'));var fs=require('fs');var path=require(_0x9691('0x5'));var rimraf=require(_0x9691('0x6'));var config=require(_0x9691('0x7'));var attributes=require(_0x9691('0x8'));module[_0x9691('0x9')]=function(_0x5cf674,_0x12b75a){return _0x5cf674[_0x9691('0xa')]('Trunk',attributes,{'tableName':_0x9691('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 88a289d..4bb7a54 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 _0x0218=['limit','include','map','model','then','debug','stringify','ShowTrunk','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','findAll','raw','options','where','attributes'];(function(_0x25c4b5,_0x1fc4bd){var _0x3ce832=function(_0x338a7d){while(--_0x338a7d){_0x25c4b5['push'](_0x25c4b5['shift']());}};_0x3ce832(++_0x1fc4bd);}(_0x0218,0xe7));var _0x8021=function(_0xe8554f,_0x4d11de){_0xe8554f=_0xe8554f-0x0;var _0x45c795=_0x0218[_0xe8554f];return _0x45c795;};'use strict';var _=require(_0x8021('0x0'));var util=require(_0x8021('0x1'));var moment=require(_0x8021('0x2'));var BPromise=require('bluebird');var rs=require(_0x8021('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8021('0x4'))['db'];var utils=require(_0x8021('0x5'));var logger=require(_0x8021('0x6'))(_0x8021('0x7'));var config=require(_0x8021('0x8'));var jayson=require(_0x8021('0x9'));var client=jayson[_0x8021('0xa')][_0x8021('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdf2d6,_0x21efcd,_0x43d4c9){return new BPromise(function(_0x4755f0,_0x46e194){return client['request'](_0xdf2d6,_0x43d4c9)['then'](function(_0x3e3b6e){logger[_0x8021('0xc')](_0x8021('0xd'),_0x21efcd,_0x8021('0xe'));logger['debug'](_0x8021('0xf'),_0x21efcd,'request\x20sent',JSON['stringify'](_0x3e3b6e));if(_0x3e3b6e['error']){if(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x11')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x21efcd,_0x3e3b6e['error'][_0x8021('0x12')]);return _0x46e194(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x12')]);}logger[_0x8021('0x10')](_0x8021('0xd'),_0x21efcd,_0x3e3b6e['error'][_0x8021('0x12')]);return _0x4755f0(_0x3e3b6e[_0x8021('0x10')][_0x8021('0x12')]);}else{logger[_0x8021('0xc')](_0x8021('0xd'),_0x21efcd,_0x8021('0xe'));_0x4755f0(_0x3e3b6e[_0x8021('0x13')]['message']);}})[_0x8021('0x14')](function(_0xcf539b){logger[_0x8021('0x10')](_0x8021('0xd'),_0x21efcd,_0xcf539b);_0x46e194(_0xcf539b);});});}exports[_0x8021('0x15')]=function(_0x8dbbdc){var _0x528418=this;return new Promise(function(_0x33cdab,_0x43d814){return db[_0x8021('0x16')][_0x8021('0x17')]({'raw':_0x8dbbdc['options']?_0x8dbbdc['options'][_0x8021('0x18')]===undefined?!![]:![]:!![],'where':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1a')]||null:null,'attributes':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1b')]||null:null,'limit':_0x8dbbdc[_0x8021('0x19')]?_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1c')]||null:null,'include':_0x8dbbdc['options']?_0x8dbbdc[_0x8021('0x19')]['include']?_['map'](_0x8dbbdc[_0x8021('0x19')][_0x8021('0x1d')],function(_0x38250e){return{'model':db[_0x38250e['model']],'as':_0x38250e['as'],'attributes':_0x38250e[_0x8021('0x1b')],'include':_0x38250e[_0x8021('0x1d')]?_[_0x8021('0x1e')](_0x38250e[_0x8021('0x1d')],function(_0x468b0d){return{'model':db[_0x468b0d[_0x8021('0x1f')]],'as':_0x468b0d['as'],'attributes':_0x468b0d['attributes'],'include':_0x468b0d[_0x8021('0x1d')]?_[_0x8021('0x1e')](_0x468b0d[_0x8021('0x1d')],function(_0xff2397){return{'model':db[_0xff2397[_0x8021('0x1f')]],'as':_0xff2397['as'],'attributes':_0xff2397[_0x8021('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8021('0x20')](function(_0x4ee308){logger[_0x8021('0xc')](_0x8021('0x15'),_0x8dbbdc);logger[_0x8021('0x21')](_0x8021('0x15'),_0x8dbbdc,JSON[_0x8021('0x22')](_0x4ee308));_0x33cdab(_0x4ee308);})[_0x8021('0x14')](function(_0x239623){logger[_0x8021('0x10')](_0x8021('0x15'),_0x239623[_0x8021('0x12')],_0x8dbbdc);_0x43d814(_0x528418[_0x8021('0x10')](0x1f4,_0x239623[_0x8021('0x12')]));});});};exports[_0x8021('0x23')]=function(_0xb07aea){var _0x5671fc=this;return new Promise(function(_0x40125a,_0x18951e){return db[_0x8021('0x16')][_0x8021('0x24')]({'raw':_0xb07aea[_0x8021('0x19')]?_0xb07aea['options']['raw']===undefined?!![]:![]:!![],'where':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1a')]||null:null,'attributes':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1b')]||null:null,'include':_0xb07aea[_0x8021('0x19')]?_0xb07aea[_0x8021('0x19')][_0x8021('0x1d')]?_[_0x8021('0x1e')](_0xb07aea[_0x8021('0x19')]['include'],function(_0x201551){return{'model':db[_0x201551[_0x8021('0x1f')]],'as':_0x201551['as'],'attributes':_0x201551[_0x8021('0x1b')],'include':_0x201551[_0x8021('0x1d')]?_['map'](_0x201551[_0x8021('0x1d')],function(_0xeedc1){return{'model':db[_0xeedc1[_0x8021('0x1f')]],'as':_0xeedc1['as'],'attributes':_0xeedc1[_0x8021('0x1b')],'include':_0xeedc1[_0x8021('0x1d')]?_['map'](_0xeedc1[_0x8021('0x1d')],function(_0x5a4c92){return{'model':db[_0x5a4c92['model']],'as':_0x5a4c92['as'],'attributes':_0x5a4c92[_0x8021('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8021('0x20')](function(_0x473ff6){logger['info'](_0x8021('0x23'),_0xb07aea);logger[_0x8021('0x21')](_0x8021('0x23'),_0xb07aea,JSON[_0x8021('0x22')](_0x473ff6));_0x40125a(_0x473ff6);})[_0x8021('0x14')](function(_0x1c4edf){logger[_0x8021('0x10')](_0x8021('0x23'),_0x1c4edf[_0x8021('0x12')],_0xb07aea);_0x18951e(_0x5671fc[_0x8021('0x10')](0x1f4,_0x1c4edf[_0x8021('0x12')]));});});}; \ No newline at end of file +var _0xc795=['map','model','find','where','ShowTrunk','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','http','request','then','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include'];(function(_0x32e6ce,_0x171dba){var _0x3a7853=function(_0x16fdb8){while(--_0x16fdb8){_0x32e6ce['push'](_0x32e6ce['shift']());}};_0x3a7853(++_0x171dba);}(_0xc795,0x1a5));var _0x5c79=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc795[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x5c79('0x0'));var util=require(_0x5c79('0x1'));var moment=require(_0x5c79('0x2'));var BPromise=require(_0x5c79('0x3'));var rs=require(_0x5c79('0x4'));var fs=require('fs');var Redis=require(_0x5c79('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c79('0x6'));var config=require(_0x5c79('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x576377,_0x3911c3,_0x871d04){return new BPromise(function(_0x3bde84,_0x1514cd){return client[_0x5c79('0x9')](_0x576377,_0x871d04)[_0x5c79('0xa')](function(_0x538a1a){logger['info']('Trunk,\x20%s,\x20%s',_0x3911c3,_0x5c79('0xb'));logger[_0x5c79('0xc')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3911c3,_0x5c79('0xb'),JSON[_0x5c79('0xd')](_0x538a1a));if(_0x538a1a[_0x5c79('0xe')]){if(_0x538a1a['error']['code']===0x1f4){logger[_0x5c79('0xe')](_0x5c79('0xf'),_0x3911c3,_0x538a1a[_0x5c79('0xe')][_0x5c79('0x10')]);return _0x1514cd(_0x538a1a[_0x5c79('0xe')]['message']);}logger[_0x5c79('0xe')](_0x5c79('0xf'),_0x3911c3,_0x538a1a['error'][_0x5c79('0x10')]);return _0x3bde84(_0x538a1a['error'][_0x5c79('0x10')]);}else{logger[_0x5c79('0x11')](_0x5c79('0xf'),_0x3911c3,_0x5c79('0xb'));_0x3bde84(_0x538a1a[_0x5c79('0x12')][_0x5c79('0x10')]);}})[_0x5c79('0x13')](function(_0x58122f){logger[_0x5c79('0xe')](_0x5c79('0xf'),_0x3911c3,_0x58122f);_0x1514cd(_0x58122f);});});}exports[_0x5c79('0x14')]=function(_0x13113e){var _0x3f1ee1=this;return new Promise(function(_0x5f239d,_0x2a114c){return db[_0x5c79('0x15')]['findAll']({'raw':_0x13113e[_0x5c79('0x16')]?_0x13113e[_0x5c79('0x16')][_0x5c79('0x17')]===undefined?!![]:![]:!![],'where':_0x13113e[_0x5c79('0x16')]?_0x13113e[_0x5c79('0x16')]['where']||null:null,'attributes':_0x13113e[_0x5c79('0x16')]?_0x13113e[_0x5c79('0x16')][_0x5c79('0x18')]||null:null,'limit':_0x13113e[_0x5c79('0x16')]?_0x13113e['options'][_0x5c79('0x19')]||null:null,'include':_0x13113e[_0x5c79('0x16')]?_0x13113e[_0x5c79('0x16')][_0x5c79('0x1a')]?_[_0x5c79('0x1b')](_0x13113e[_0x5c79('0x16')][_0x5c79('0x1a')],function(_0x50031d){return{'model':db[_0x50031d['model']],'as':_0x50031d['as'],'attributes':_0x50031d[_0x5c79('0x18')],'include':_0x50031d[_0x5c79('0x1a')]?_[_0x5c79('0x1b')](_0x50031d[_0x5c79('0x1a')],function(_0x40d79a){return{'model':db[_0x40d79a[_0x5c79('0x1c')]],'as':_0x40d79a['as'],'attributes':_0x40d79a[_0x5c79('0x18')],'include':_0x40d79a['include']?_['map'](_0x40d79a[_0x5c79('0x1a')],function(_0x381b87){return{'model':db[_0x381b87[_0x5c79('0x1c')]],'as':_0x381b87['as'],'attributes':_0x381b87[_0x5c79('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352817){logger[_0x5c79('0x11')](_0x5c79('0x14'),_0x13113e);logger[_0x5c79('0xc')](_0x5c79('0x14'),_0x13113e,JSON[_0x5c79('0xd')](_0x352817));_0x5f239d(_0x352817);})[_0x5c79('0x13')](function(_0x4f989e){logger['error'](_0x5c79('0x14'),_0x4f989e['message'],_0x13113e);_0x2a114c(_0x3f1ee1[_0x5c79('0xe')](0x1f4,_0x4f989e[_0x5c79('0x10')]));});});};exports['ShowTrunk']=function(_0x345b13){var _0x236ec0=this;return new Promise(function(_0x4d1ed6,_0x373a94){return db[_0x5c79('0x15')][_0x5c79('0x1d')]({'raw':_0x345b13[_0x5c79('0x16')]?_0x345b13[_0x5c79('0x16')][_0x5c79('0x17')]===undefined?!![]:![]:!![],'where':_0x345b13['options']?_0x345b13[_0x5c79('0x16')][_0x5c79('0x1e')]||null:null,'attributes':_0x345b13[_0x5c79('0x16')]?_0x345b13['options'][_0x5c79('0x18')]||null:null,'include':_0x345b13['options']?_0x345b13[_0x5c79('0x16')][_0x5c79('0x1a')]?_[_0x5c79('0x1b')](_0x345b13[_0x5c79('0x16')][_0x5c79('0x1a')],function(_0xf1746){return{'model':db[_0xf1746['model']],'as':_0xf1746['as'],'attributes':_0xf1746[_0x5c79('0x18')],'include':_0xf1746[_0x5c79('0x1a')]?_['map'](_0xf1746['include'],function(_0x18fad0){return{'model':db[_0x18fad0['model']],'as':_0x18fad0['as'],'attributes':_0x18fad0[_0x5c79('0x18')],'include':_0x18fad0[_0x5c79('0x1a')]?_[_0x5c79('0x1b')](_0x18fad0['include'],function(_0x9a19c7){return{'model':db[_0x9a19c7[_0x5c79('0x1c')]],'as':_0x9a19c7['as'],'attributes':_0x9a19c7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c79('0xa')](function(_0x3df2d1){logger[_0x5c79('0x11')]('ShowTrunk',_0x345b13);logger[_0x5c79('0xc')](_0x5c79('0x1f'),_0x345b13,JSON[_0x5c79('0xd')](_0x3df2d1));_0x4d1ed6(_0x3df2d1);})['catch'](function(_0x3d34a6){logger[_0x5c79('0xe')](_0x5c79('0x1f'),_0x3d34a6[_0x5c79('0x10')],_0x345b13);_0x373a94(_0x236ec0['error'](0x1f4,_0x3d34a6['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a3fcace..85a38c9 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 _0x2a4b=['/:id','isAuthenticated','update','exports','express','Router'];(function(_0x20a57e,_0x3fa17a){var _0x1dc70e=function(_0xfac388){while(--_0xfac388){_0x20a57e['push'](_0x20a57e['shift']());}};_0x1dc70e(++_0x3fa17a);}(_0x2a4b,0x94));var _0xb2a4=function(_0x3e12d9,_0x499f5b){_0x3e12d9=_0x3e12d9-0x0;var _0x114fc5=_0x2a4b[_0x3e12d9];return _0x114fc5;};'use strict';var express=require(_0xb2a4('0x0'));var router=express[_0xb2a4('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router['put'](_0xb2a4('0x2'),auth[_0xb2a4('0x3')](),controller[_0xb2a4('0x4')]);module[_0xb2a4('0x5')]=router; \ No newline at end of file +var _0x4a70=['../../components/auth/service','put','isAuthenticated','update','exports','express','Router'];(function(_0x2ca794,_0x3e0030){var _0x27b67b=function(_0x40f96b){while(--_0x40f96b){_0x2ca794['push'](_0x2ca794['shift']());}};_0x27b67b(++_0x3e0030);}(_0x4a70,0x15c));var _0x04a7=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x4a70[_0x1f99a0];return _0x1e0849;};'use strict';var express=require(_0x04a7('0x0'));var router=express[_0x04a7('0x1')]();var auth=require(_0x04a7('0x2'));var controller=require('./user-setting.controller');router[_0x04a7('0x3')]('/:id',auth[_0x04a7('0x4')](),controller[_0x04a7('0x5')]);module[_0x04a7('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 9f80340..2911183 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 _0x21c4=['UserId','warning','info','debug','ENUM','BOOLEAN','TEXT','INTEGER'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x21c4,0xd9));var _0x421c=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x21c4[_0x478c8a];return _0x3b6b3e;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x421c('0x0'),_0x421c('0x1'),_0x421c('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x421c('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x421c('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x421c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x421c('0x6')],'unique':_0x421c('0x7')}}; \ No newline at end of file +var _0xedba=['warning','info','debug','exports','ENUM','TEXT','DATE','INTEGER','UserId','error'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xedba,0x6d));var _0xaedb=function(_0x169e28,_0x351183){_0x169e28=_0x169e28-0x0;var _0x32ac67=_0xedba[_0x169e28];return _0x32ac67;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xaedb('0x0'),_0xaedb('0x1'),_0xaedb('0x2'),_0xaedb('0x3')];module[_0xaedb('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xaedb('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaedb('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xaedb('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xaedb('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xaedb('0x8')],'unique':_0xaedb('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 e118579..574fb3e 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 _0x4156=['then','error','stack','name','user','role','params','Invalid\x20user\x20setting\x20id','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','update'];(function(_0x4a0576,_0x3b4a53){var _0x3044fe=function(_0x3bd182){while(--_0x3bd182){_0x4a0576['push'](_0x4a0576['shift']());}};_0x3044fe(++_0x3b4a53);}(_0x4156,0xf1));var _0x6415=function(_0x5312ea,_0x37705c){_0x5312ea=_0x5312ea-0x0;var _0x3f5e70=_0x4156[_0x5312ea];return _0x3f5e70;};'use strict';var _=require(_0x6415('0x0'));var Redis=require(_0x6415('0x1'));var logger=require(_0x6415('0x2'))(_0x6415('0x3'));var config=require(_0x6415('0x4'));var db=require('../../mysqldb')['db'];var socket=require(_0x6415('0x5'))(new Redis(config[_0x6415('0x6')]));require(_0x6415('0x7'))[_0x6415('0x8')](socket);config[_0x6415('0x6')]=_[_0x6415('0x9')](config[_0x6415('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x24cb0,_0x47ec13){_0x47ec13=_0x47ec13||0xc8;return function(_0x4045ec){if(_0x4045ec){return _0x24cb0[_0x6415('0xa')](_0x47ec13)['json'](_0x4045ec);}};}function saveUpdates(_0x919b59){return function(_0x224e7b){if(_0x224e7b){return _0x224e7b[_0x6415('0xb')](_0x919b59)[_0x6415('0xc')](function(_0x4c70b4){return _0x4c70b4;});}return null;};}function handleEntityNotFound(_0x10b49c){return function(_0x5abdf6){if(!_0x5abdf6){_0x10b49c['sendStatus'](0x194);}return _0x5abdf6;};}function handleError(_0x277766,_0x153336){_0x153336=_0x153336||0x1f4;return function(_0x2ff916){logger[_0x6415('0xd')](_0x2ff916[_0x6415('0xe')]);if(_0x2ff916[_0x6415('0xf')]){delete _0x2ff916[_0x6415('0xf')];}_0x277766['status'](_0x153336)['send'](_0x2ff916);};}exports[_0x6415('0xb')]=function(_0x49d6b7,_0x2a4d5c){if(_0x49d6b7[_0x6415('0x10')][_0x6415('0x11')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x49d6b7[_0x6415('0x12')]['id'])))throw new Error(_0x6415('0x13'));return db['UserSetting'][_0x6415('0x14')]({'where':{'id':_0x49d6b7[_0x6415('0x12')]['id']}})['then'](handleEntityNotFound(_0x2a4d5c,null))['then'](saveUpdates(_0x49d6b7[_0x6415('0x15')],null))[_0x6415('0xc')](respondWithResult(_0x2a4d5c,null))[_0x6415('0x16')](handleError(_0x2a4d5c,null));}; \ No newline at end of file +var _0x7ee1=['then','sendStatus','error','stack','name','send','update','role','admin','Unauthorized','params','UserSetting','find','body','catch','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','defaults','redis','localhost','status'];(function(_0x4635e5,_0x5590a9){var _0x5a187b=function(_0x4e4f0c){while(--_0x4e4f0c){_0x4635e5['push'](_0x4635e5['shift']());}};_0x5a187b(++_0x5590a9);}(_0x7ee1,0xab));var _0x17ee=function(_0x2eaeec,_0x377c1b){_0x2eaeec=_0x2eaeec-0x0;var _0x134134=_0x7ee1[_0x2eaeec];return _0x134134;};'use strict';var _=require(_0x17ee('0x0'));var Redis=require('ioredis');var logger=require(_0x17ee('0x1'))(_0x17ee('0x2'));var config=require(_0x17ee('0x3'));var db=require(_0x17ee('0x4'))['db'];var socket=require(_0x17ee('0x5'))(new Redis(config['redis']));require(_0x17ee('0x6'))['register'](socket);config['redis']=_[_0x17ee('0x7')](config[_0x17ee('0x8')],{'host':_0x17ee('0x9'),'port':0x18eb});function respondWithResult(_0x3e6b4c,_0x28cc37){_0x28cc37=_0x28cc37||0xc8;return function(_0x59b876){if(_0x59b876){return _0x3e6b4c[_0x17ee('0xa')](_0x28cc37)['json'](_0x59b876);}};}function saveUpdates(_0x274eb5){return function(_0x45fe06){if(_0x45fe06){return _0x45fe06['update'](_0x274eb5)[_0x17ee('0xb')](function(_0x36d73a){return _0x36d73a;});}return null;};}function handleEntityNotFound(_0xa9902e){return function(_0x3c879d){if(!_0x3c879d){_0xa9902e[_0x17ee('0xc')](0x194);}return _0x3c879d;};}function handleError(_0x352d60,_0xac3906){_0xac3906=_0xac3906||0x1f4;return function(_0xcb2375){logger[_0x17ee('0xd')](_0xcb2375[_0x17ee('0xe')]);if(_0xcb2375[_0x17ee('0xf')]){delete _0xcb2375[_0x17ee('0xf')];}_0x352d60['status'](_0xac3906)[_0x17ee('0x10')](_0xcb2375);};}exports[_0x17ee('0x11')]=function(_0x4bdbdf,_0x1b3857){if(_0x4bdbdf['user'][_0x17ee('0x12')]!==_0x17ee('0x13'))throw new Error(_0x17ee('0x14'));if(isNaN(Number(_0x4bdbdf[_0x17ee('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x17ee('0x16')][_0x17ee('0x17')]({'where':{'id':_0x4bdbdf[_0x17ee('0x15')]['id']}})['then'](handleEntityNotFound(_0x1b3857,null))[_0x17ee('0xb')](saveUpdates(_0x4bdbdf[_0x17ee('0x18')],null))[_0x17ee('0xb')](respondWithResult(_0x1b3857,null))[_0x17ee('0x19')](handleError(_0x1b3857,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 771af94..adeaf08 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 _0x7b11=['emit','hook','events','../../mysqldb','UserSetting','setMaxListeners','save','remove'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7b11,0x6a));var _0x17b1=function(_0x3c165d,_0xcbcca0){_0x3c165d=_0x3c165d-0x0;var _0x2ed713=_0x7b11[_0x3c165d];return _0x2ed713;};'use strict';var EventEmitter=require(_0x17b1('0x0'));var UserSetting=require(_0x17b1('0x1'))['db'][_0x17b1('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x17b1('0x3')](0x0);var events={'afterCreate':_0x17b1('0x4'),'afterUpdate':'update','afterDestroy':_0x17b1('0x5')};function emitEvent(_0xf23e35){return function(_0x3f5511,_0x5a13e9,_0x519e97){UserSettingEvents[_0x17b1('0x6')](_0xf23e35+':'+_0x3f5511['id'],_0x3f5511);UserSettingEvents[_0x17b1('0x6')](_0xf23e35,_0x3f5511);_0x519e97(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x17b1('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x6d69=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x6d69,0x7c));var _0x96d6=function(_0x333253,_0x31f200){_0x333253=_0x333253-0x0;var _0x56587e=_0x6d69[_0x333253];return _0x56587e;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x96d6('0x0'))['db'][_0x96d6('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x96d6('0x2')](0x0);var events={'afterCreate':_0x96d6('0x3'),'afterUpdate':'update','afterDestroy':_0x96d6('0x4')};function emitEvent(_0x3a7d54){return function(_0x5e8f56,_0x347a1c,_0x3814e2){UserSettingEvents[_0x96d6('0x5')](_0x3a7d54+':'+_0x5e8f56['id'],_0x5e8f56);UserSettingEvents[_0x96d6('0x5')](_0x3a7d54,_0x5e8f56);_0x3814e2(null);};}for(var e in events){if(events[_0x96d6('0x6')](e)){var event=events[e];UserSetting[_0x96d6('0x7')](e,emitEvent(event));}}module[_0x96d6('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 2b4ca48..e9b32d7 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 _0x9f4d=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x2147a3,_0x41b93b){var _0xfc6cd1=function(_0x25fc4b){while(--_0x25fc4b){_0x2147a3['push'](_0x2147a3['shift']());}};_0xfc6cd1(++_0x41b93b);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x51172d,_0x200cf2){_0x51172d=_0x51172d-0x0;var _0x52064d=_0x9f4d[_0x51172d];return _0x52064d;};'use strict';var attributes=require(_0xd9f4('0x0'));module[_0xd9f4('0x1')]=function(_0x34f803){return _0x34f803[_0xd9f4('0x2')](_0xd9f4('0x3'),attributes,{'tableName':_0xd9f4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x36dc75){if(!_0x36dc75[_0xd9f4('0x5')])_0x36dc75[_0xd9f4('0x6')]=null;else if(_0x36dc75['clientSideLoggingEnabledSince']===null)_0x36dc75[_0xd9f4('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xa477=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x196dc5,_0x50be9d){var _0x56458e=function(_0x5bd98b){while(--_0x5bd98b){_0x196dc5['push'](_0x196dc5['shift']());}};_0x56458e(++_0x50be9d);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var attributes=require(_0x7a47('0x0'));module[_0x7a47('0x1')]=function(_0x576699){return _0x576699[_0x7a47('0x2')](_0x7a47('0x3'),attributes,{'tableName':_0x7a47('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x19697b){if(!_0x19697b[_0x7a47('0x5')])_0x19697b[_0x7a47('0x6')]=null;else if(_0x19697b[_0x7a47('0x6')]===null)_0x19697b['clientSideLoggingEnabledSince']=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 3aefd61..c6b041c 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 _0x3de4=['user-setting:update','emit','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','update'];(function(_0xb02a51,_0x4fefca){var _0xfdc48f=function(_0x21ffb3){while(--_0x21ffb3){_0xb02a51['push'](_0xb02a51['shift']());}};_0xfdc48f(++_0x4fefca);}(_0x3de4,0x101));var _0x43de=function(_0x4c5ead,_0xaec00e){_0x4c5ead=_0x4c5ead-0x0;var _0x378177=_0x3de4[_0x4c5ead];return _0x378177;};'use strict';var UserSettingEvents=require(_0x43de('0x0'));var events=[_0x43de('0x1'),'remove',_0x43de('0x2')];function createListener(_0x331e9e,_0x1bae03){return function(_0x118898){_0x1bae03['emit'](_0x331e9e,_0x118898);if(_0x331e9e===_0x43de('0x3')){_0x1bae03[_0x43de('0x4')](_0x43de('0x5')+_0x118898[_0x43de('0x6')],_0x118898);}};}exports[_0x43de('0x7')]=function(_0x289e2b){for(var _0x5b337c=0x0,_0x8f9e06=events[_0x43de('0x8')];_0x5b337c<_0x8f9e06;_0x5b337c++){var _0x1764d8=events[_0x5b337c];var _0x51b448=createListener(_0x43de('0x9')+_0x1764d8,_0x289e2b);UserSettingEvents['on'](_0x1764d8,_0x51b448);}}; \ No newline at end of file +var _0xd5d2=['user-setting:update','register','length','./user-setting.events','save','remove','update','emit'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd5d2,0x19b));var _0x2d5d=function(_0x15fa45,_0x132622){_0x15fa45=_0x15fa45-0x0;var _0x3e7413=_0xd5d2[_0x15fa45];return _0x3e7413;};'use strict';var UserSettingEvents=require(_0x2d5d('0x0'));var events=[_0x2d5d('0x1'),_0x2d5d('0x2'),_0x2d5d('0x3')];function createListener(_0x48b44b,_0x5996cd){return function(_0x2557f7){_0x5996cd[_0x2d5d('0x4')](_0x48b44b,_0x2557f7);if(_0x48b44b===_0x2d5d('0x5')){_0x5996cd[_0x2d5d('0x4')]('user-setting:update:user-'+_0x2557f7['UserId'],_0x2557f7);}};}exports[_0x2d5d('0x6')]=function(_0x29c380){for(var _0x3b8b81=0x0,_0x508447=events[_0x2d5d('0x7')];_0x3b8b81<_0x508447;_0x3b8b81++){var _0x5299c3=events[_0x3b8b81];var _0x49dfa8=createListener('user-setting:'+_0x5299c3,_0x29c380);UserSettingEvents['on'](_0x5299c3,_0x49dfa8);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index cfedd39..57ce57f 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 _0x9377=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','create','bulkCreate','addQueues','diskStorage','join','root','format','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/teams','addTeams','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','/:id','update','put','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','/:id/sms_accounts','removeSmsAccounts','removeApiKey','multer','util','connect-timeout','express'];(function(_0x193f0d,_0x8b9309){var _0x36f9c0=function(_0xcb7224){while(--_0xcb7224){_0x193f0d['push'](_0x193f0d['shift']());}};_0x36f9c0(++_0x8b9309);}(_0x9377,0xda));var _0x7937=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9377[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x7937('0x0'));var util=require(_0x7937('0x1'));var path=require('path');var timeout=require(_0x7937('0x2'));var express=require(_0x7937('0x3'));var router=express[_0x7937('0x4')]();var fs_extra=require(_0x7937('0x5'));var auth=require(_0x7937('0x6'));var interaction=require(_0x7937('0x7'));var config=require(_0x7937('0x8'));var controller=require(_0x7937('0x9'));router[_0x7937('0xa')]('/',auth['isAuthenticated'](),controller[_0x7937('0xb')]);router[_0x7937('0xa')](_0x7937('0xc'),auth[_0x7937('0xd')](),controller[_0x7937('0xe')]);router['get'](_0x7937('0xf'),auth[_0x7937('0xd')](),controller[_0x7937('0x10')]);router['get'](_0x7937('0x11'),auth[_0x7937('0xd')](),controller[_0x7937('0x12')]);router[_0x7937('0xa')]('/:id',auth[_0x7937('0xd')](),controller['show']);router['get']('/:id/avatar',controller['getAvatar']);router['get']('/:id/open_tabs',auth[_0x7937('0xd')](),controller['getOpenTabs']);router['get'](_0x7937('0x13'),auth['isAuthenticated'](),controller[_0x7937('0x14')]);router['get'](_0x7937('0x15'),auth[_0x7937('0xd')](),controller[_0x7937('0x16')]);router[_0x7937('0xa')]('/:id/queues_rt',auth[_0x7937('0xd')](),controller[_0x7937('0x17')]);router[_0x7937('0xa')](_0x7937('0x18'),auth[_0x7937('0xd')](),controller[_0x7937('0x19')]);router[_0x7937('0xa')](_0x7937('0x1a'),auth[_0x7937('0xd')](),controller[_0x7937('0x1b')]);router['get'](_0x7937('0x1c'),auth[_0x7937('0xd')](),controller['getScreenRecordings']);router[_0x7937('0xa')](_0x7937('0x1d'),auth[_0x7937('0xd')](),controller['getChatInteractions']);router[_0x7937('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x7937('0x1e')]);router['get'](_0x7937('0x1f'),auth[_0x7937('0xd')](),controller[_0x7937('0x20')]);router[_0x7937('0xa')]('/:id/sms/interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x21')]);router[_0x7937('0xa')](_0x7937('0x22'),auth['isAuthenticated'](),controller[_0x7937('0x23')]);router['get']('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x7937('0x24')]);router['get']('/:id/teams',auth[_0x7937('0xd')](),controller[_0x7937('0x25')]);router['get'](_0x7937('0x26'),auth[_0x7937('0xd')](),controller['getLists']);router[_0x7937('0xa')](_0x7937('0x27'),auth[_0x7937('0xd')](),controller[_0x7937('0x28')]);router[_0x7937('0xa')](_0x7937('0x29'),auth[_0x7937('0xd')](),controller[_0x7937('0x2a')]);router['get'](_0x7937('0x2b'),auth['isAuthenticated'](),controller[_0x7937('0x2c')]);router[_0x7937('0xa')]('/:id/mail_accounts',auth[_0x7937('0xd')](),controller['getMailAccounts']);router[_0x7937('0xa')](_0x7937('0x2d'),auth[_0x7937('0xd')](),controller['getOpenchannelAccounts']);router[_0x7937('0xa')]('/:id/sms_accounts',auth[_0x7937('0xd')](),controller[_0x7937('0x2e')]);router[_0x7937('0xa')](_0x7937('0x2f'),auth['isAuthenticated'](),controller[_0x7937('0x30')]);router[_0x7937('0xa')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller['getWhatsappAccounts']);router[_0x7937('0xa')](_0x7937('0x32'),auth[_0x7937('0xd')](),controller[_0x7937('0x33')]);router['get'](_0x7937('0x34'),auth['isAuthenticated'](),controller[_0x7937('0x35')]);router[_0x7937('0xa')]('/:id/api_key',auth[_0x7937('0xd')](),controller[_0x7937('0x36')]);router[_0x7937('0x37')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router['post']('/',auth[_0x7937('0xd')](),controller[_0x7937('0x38')]);router[_0x7937('0x37')]('/create_many',auth[_0x7937('0xd')](),controller[_0x7937('0x39')]);router[_0x7937('0x37')]('/:id/queues',auth[_0x7937('0xd')](),controller[_0x7937('0x3a')]);var upload=multer({'storage':multer[_0x7937('0x3b')]({'destination':function(_0x25e23a,_0x45dbe1,_0x8dc93d){_0x8dc93d(null,path[_0x7937('0x3c')](config[_0x7937('0x3d')],'server/files/images/'));},'filename':function(_0x52e96d,_0x5ae3cd,_0x753979){_0x753979(null,util[_0x7937('0x3e')]('%s-%s',Date['now'](),_0x5ae3cd[_0x7937('0x3f')]));}})});router[_0x7937('0x37')](_0x7937('0x40'),upload[_0x7937('0x41')]('file'),controller[_0x7937('0x42')]);router[_0x7937('0x37')](_0x7937('0x43'),auth[_0x7937('0xd')](),controller['login']);router[_0x7937('0x37')](_0x7937('0x44'),auth['isAuthenticated'](),controller[_0x7937('0x45')]);router[_0x7937('0x37')](_0x7937('0x46'),auth['isAuthenticated'](),controller['pause']);router[_0x7937('0x37')](_0x7937('0x47'),auth[_0x7937('0xd')](),controller['unpause']);router[_0x7937('0x37')](_0x7937('0x48'),auth['isAuthenticated'](),controller[_0x7937('0x49')]);router[_0x7937('0x37')]('/:id/chat_interactions',auth[_0x7937('0xd')](),controller['addChatInteractions']);router['post'](_0x7937('0x4a'),auth[_0x7937('0xd')](),controller[_0x7937('0x4b')]);router['post'](_0x7937('0x4c'),auth[_0x7937('0xd')](),controller[_0x7937('0x4d')]);router[_0x7937('0x37')](_0x7937('0x4e'),auth[_0x7937('0xd')](),controller[_0x7937('0x4f')]);router[_0x7937('0x37')](_0x7937('0x50'),auth[_0x7937('0xd')](),controller[_0x7937('0x51')]);router[_0x7937('0x37')](_0x7937('0x52'),auth[_0x7937('0xd')](),controller[_0x7937('0x53')]);router[_0x7937('0x37')](_0x7937('0x2b'),auth[_0x7937('0xd')](),controller[_0x7937('0x54')]);router['post'](_0x7937('0x55'),auth['isAuthenticated'](),controller[_0x7937('0x56')]);router['post'](_0x7937('0x2d'),auth[_0x7937('0xd')](),controller[_0x7937('0x57')]);router[_0x7937('0x37')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['addSmsAccounts']);router['post'](_0x7937('0x2f'),auth[_0x7937('0xd')](),controller[_0x7937('0x58')]);router[_0x7937('0x37')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller[_0x7937('0x59')]);router[_0x7937('0x37')]('/:id/square_projects',auth[_0x7937('0xd')](),controller[_0x7937('0x5a')]);router[_0x7937('0x37')](_0x7937('0x5b'),auth['isAuthenticated'](),controller[_0x7937('0x5c')]);router['put'](_0x7937('0x5d'),auth[_0x7937('0xd')](),controller[_0x7937('0x5e')]);router[_0x7937('0x5f')]('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router[_0x7937('0x60')](_0x7937('0x15'),auth[_0x7937('0xd')](),controller[_0x7937('0x61')]);router[_0x7937('0x60')](_0x7937('0x48'),auth[_0x7937('0xd')](),controller[_0x7937('0x62')]);router[_0x7937('0x60')](_0x7937('0x5d'),auth['isAuthenticated'](),controller[_0x7937('0x63')]);router[_0x7937('0x60')]('/:id/chat_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x64')]);router[_0x7937('0x60')](_0x7937('0x4a'),auth[_0x7937('0xd')](),controller['removeMailInteractions']);router[_0x7937('0x60')](_0x7937('0x4c'),auth[_0x7937('0xd')](),controller[_0x7937('0x65')]);router[_0x7937('0x60')]('/:id/sms_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x66')]);router[_0x7937('0x60')](_0x7937('0x50'),auth[_0x7937('0xd')](),controller[_0x7937('0x67')]);router[_0x7937('0x60')]('/:id/whatsapp_interactions',auth[_0x7937('0xd')](),controller[_0x7937('0x68')]);router[_0x7937('0x60')](_0x7937('0x2b'),auth['isAuthenticated'](),controller[_0x7937('0x69')]);router[_0x7937('0x60')]('/:id/mail_accounts',auth[_0x7937('0xd')](),controller[_0x7937('0x6a')]);router[_0x7937('0x60')](_0x7937('0x2d'),auth['isAuthenticated'](),controller[_0x7937('0x6b')]);router[_0x7937('0x60')](_0x7937('0x6c'),auth[_0x7937('0xd')](),controller[_0x7937('0x6d')]);router['delete'](_0x7937('0x2f'),auth[_0x7937('0xd')](),controller['removeChatWebsites']);router[_0x7937('0x60')](_0x7937('0x31'),auth[_0x7937('0xd')](),controller['removeWhatsappAccounts']);router[_0x7937('0x60')](_0x7937('0x32'),auth[_0x7937('0xd')](),controller['removeSquareProjects']);router[_0x7937('0x60')](_0x7937('0x5b'),auth[_0x7937('0xd')](),controller[_0x7937('0x6e')]);module['exports']=router; \ No newline at end of file +var _0xd05d=['/:id','update','changePassword','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getFaxAccounts','getMailAccounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','create','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','originalname','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put'];(function(_0x545bcd,_0x343e09){var _0x25f876=function(_0x3a0e4d){while(--_0x3a0e4d){_0x545bcd['push'](_0x545bcd['shift']());}};_0x25f876(++_0x343e09);}(_0xd05d,0x8f));var _0xdd05=function(_0x847c62,_0xf701f5){_0x847c62=_0x847c62-0x0;var _0x79a926=_0xd05d[_0x847c62];return _0x79a926;};'use strict';var multer=require(_0xdd05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd05('0x1'));var express=require(_0xdd05('0x2'));var router=express['Router']();var fs_extra=require(_0xdd05('0x3'));var auth=require(_0xdd05('0x4'));var interaction=require(_0xdd05('0x5'));var config=require(_0xdd05('0x6'));var controller=require('./user.controller');router[_0xdd05('0x7')]('/',auth[_0xdd05('0x8')](),controller[_0xdd05('0x9')]);router['get'](_0xdd05('0xa'),auth[_0xdd05('0x8')](),controller[_0xdd05('0xb')]);router['get'](_0xdd05('0xc'),auth[_0xdd05('0x8')](),controller[_0xdd05('0xd')]);router[_0xdd05('0x7')](_0xdd05('0xe'),auth[_0xdd05('0x8')](),controller['getPresence']);router['get']('/:id',auth[_0xdd05('0x8')](),controller[_0xdd05('0xf')]);router[_0xdd05('0x7')](_0xdd05('0x10'),controller['getAvatar']);router[_0xdd05('0x7')](_0xdd05('0x11'),auth['isAuthenticated'](),controller[_0xdd05('0x12')]);router['get'](_0xdd05('0x13'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x14')]);router[_0xdd05('0x7')]('/:id/queues',auth['isAuthenticated'](),controller[_0xdd05('0x15')]);router[_0xdd05('0x7')](_0xdd05('0x16'),auth[_0xdd05('0x8')](),controller['getVoiceQueuesRt']);router['get'](_0xdd05('0x17'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x18')]);router['get'](_0xdd05('0x19'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x1a')]);router[_0xdd05('0x7')](_0xdd05('0x1b'),auth[_0xdd05('0x8')](),controller['getScreenRecordings']);router[_0xdd05('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xdd05('0x1c')]);router['get'](_0xdd05('0x1d'),auth[_0xdd05('0x8')](),controller['getOpenchannelInteractions']);router[_0xdd05('0x7')](_0xdd05('0x1e'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x1f')]);router[_0xdd05('0x7')](_0xdd05('0x20'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x21')]);router[_0xdd05('0x7')](_0xdd05('0x22'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x23')]);router[_0xdd05('0x7')]('/:id/whatsapp/interactions',auth[_0xdd05('0x8')](),controller['getWhatsappInteractions']);router[_0xdd05('0x7')](_0xdd05('0x24'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x25')]);router[_0xdd05('0x7')]('/:id/lists',auth['isAuthenticated'](),controller[_0xdd05('0x26')]);router[_0xdd05('0x7')](_0xdd05('0x27'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x28')]);router[_0xdd05('0x7')]('/:id/prefixes',auth[_0xdd05('0x8')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0xdd05('0x8')](),controller[_0xdd05('0x29')]);router[_0xdd05('0x7')]('/:id/mail_accounts',auth[_0xdd05('0x8')](),controller[_0xdd05('0x2a')]);router[_0xdd05('0x7')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xdd05('0x7')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xdd05('0x2b')]);router[_0xdd05('0x7')]('/:id/chat_websites',auth[_0xdd05('0x8')](),controller[_0xdd05('0x2c')]);router[_0xdd05('0x7')](_0xdd05('0x2d'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x2e')]);router['get'](_0xdd05('0x2f'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x30')]);router[_0xdd05('0x7')](_0xdd05('0x31'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x32')]);router[_0xdd05('0x7')](_0xdd05('0x33'),auth[_0xdd05('0x8')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0xdd05('0x8')](),controller[_0xdd05('0x34')]);router[_0xdd05('0x35')]('/',auth[_0xdd05('0x8')](),controller[_0xdd05('0x36')]);router[_0xdd05('0x35')]('/create_many',auth[_0xdd05('0x8')](),controller[_0xdd05('0x37')]);router[_0xdd05('0x35')](_0xdd05('0x38'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x39')]);var upload=multer({'storage':multer[_0xdd05('0x3a')]({'destination':function(_0x519a94,_0x55cae2,_0x21c080){_0x21c080(null,path[_0xdd05('0x3b')](config[_0xdd05('0x3c')],_0xdd05('0x3d')));},'filename':function(_0x3ee8a6,_0x3079b4,_0x15de16){_0x15de16(null,util[_0xdd05('0x3e')]('%s-%s',Date['now'](),_0x3079b4[_0xdd05('0x3f')]));}})});router[_0xdd05('0x35')](_0xdd05('0x10'),upload[_0xdd05('0x40')](_0xdd05('0x41')),controller['addAvatar']);router[_0xdd05('0x35')](_0xdd05('0x42'),auth['isAuthenticated'](),controller['login']);router[_0xdd05('0x35')](_0xdd05('0x43'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x44')]);router[_0xdd05('0x35')](_0xdd05('0x45'),auth['isAuthenticated'](),controller[_0xdd05('0x46')]);router[_0xdd05('0x35')](_0xdd05('0x47'),auth['isAuthenticated'](),controller[_0xdd05('0x48')]);router['post']('/:id/teams',auth[_0xdd05('0x8')](),controller[_0xdd05('0x49')]);router[_0xdd05('0x35')]('/:id/chat_interactions',auth[_0xdd05('0x8')](),controller[_0xdd05('0x4a')]);router[_0xdd05('0x35')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xdd05('0x4b')]);router['post'](_0xdd05('0x4c'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x4d')]);router['post']('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xdd05('0x4e')]);router[_0xdd05('0x35')]('/:id/openchannel_interactions',auth[_0xdd05('0x8')](),controller[_0xdd05('0x4f')]);router['post'](_0xdd05('0x50'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x51')]);router['post'](_0xdd05('0x52'),auth['isAuthenticated'](),controller[_0xdd05('0x53')]);router[_0xdd05('0x35')](_0xdd05('0x54'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x55')]);router[_0xdd05('0x35')](_0xdd05('0x56'),auth['isAuthenticated'](),controller[_0xdd05('0x57')]);router['post'](_0xdd05('0x58'),auth[_0xdd05('0x8')](),controller['addSmsAccounts']);router[_0xdd05('0x35')](_0xdd05('0x59'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x5a')]);router[_0xdd05('0x35')]('/:id/whatsapp_accounts',auth[_0xdd05('0x8')](),controller[_0xdd05('0x5b')]);router['post'](_0xdd05('0x2f'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x5c')]);router[_0xdd05('0x35')](_0xdd05('0x33'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x5d')]);router[_0xdd05('0x5e')](_0xdd05('0x5f'),auth['isAuthenticated'](),controller[_0xdd05('0x60')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0xdd05('0x61')]);router[_0xdd05('0x62')](_0xdd05('0x38'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x63')]);router['delete']('/:id/teams',auth[_0xdd05('0x8')](),controller[_0xdd05('0x64')]);router[_0xdd05('0x62')](_0xdd05('0x5f'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x65')]);router[_0xdd05('0x62')](_0xdd05('0x66'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x67')]);router[_0xdd05('0x62')](_0xdd05('0x68'),auth['isAuthenticated'](),controller[_0xdd05('0x69')]);router['delete'](_0xdd05('0x4c'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x6a')]);router[_0xdd05('0x62')](_0xdd05('0x6b'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x6c')]);router[_0xdd05('0x62')]('/:id/openchannel_interactions',auth[_0xdd05('0x8')](),controller[_0xdd05('0x6d')]);router['delete'](_0xdd05('0x50'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x6e')]);router[_0xdd05('0x62')](_0xdd05('0x52'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x6f')]);router[_0xdd05('0x62')](_0xdd05('0x54'),auth['isAuthenticated'](),controller[_0xdd05('0x70')]);router['delete'](_0xdd05('0x56'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xdd05('0x62')](_0xdd05('0x58'),auth['isAuthenticated'](),controller[_0xdd05('0x71')]);router[_0xdd05('0x62')]('/:id/chat_websites',auth[_0xdd05('0x8')](),controller[_0xdd05('0x72')]);router['delete']('/:id/whatsapp_accounts',auth[_0xdd05('0x8')](),controller[_0xdd05('0x73')]);router[_0xdd05('0x62')](_0xdd05('0x2f'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x74')]);router['delete'](_0xdd05('0x33'),auth[_0xdd05('0x8')](),controller[_0xdd05('0x75')]);module[_0xdd05('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index cda2218..7566aff 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 _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','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','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x2894dd,_0x32ac13){var _0x4504c4=function(_0x21d79b){while(--_0x21d79b){_0x2894dd['push'](_0x2894dd['shift']());}};_0x4504c4(++_0x32ac13);}(_0x34e8,0x12c));var _0x834e=function(_0x1da067,_0x4b16a4){_0x1da067=_0x1da067-0x0;var _0xc003a=_0x34e8[_0x1da067];return _0xc003a;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 429e1af..917bcc4 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 _0x4213=['MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','device','PAUSE','LOGININPAUSE','bulkCreate','concat','resolve','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','unpause','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','removeAgent','VoicePrefixId','getLists','getAgents','getVoiceQueues','values','send','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','firstName','lastName','Contact','dialActive','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','isEmpty','teams','queues','inbound','flatten','lower','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','SELECT','select','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','../../config/logger','../../config/utils','../../config/license/util','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','then','emit','userNotification:recalc:','get','role','admin','Users','user','Agents','agent','Telephones','ignore','value','find','name','UserProfileResource','stack','index','User','rawAttributes','fieldName','type','key','filter','password','salt','where','count','query','includeAll','include','userSetting','includes','attributes','push','findAll','rows','true','length','chat','dataValues','fax','mail','openchannel','show','params','model','differenceBy','keys','filters','intersection','fields','UserSetting','merge','options','openTabs','sms','whatsapp','all','update','body','describe','addContacts','omit','ids','internal','Setting','securePassword','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)','QueryTypes','from','voicemail','mailbox','fullname','permissions','101','102','103','110','104','105','106','107','108','109','100','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','map','telephone','userProfileId','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','toLowerCase','Queues','spread','QueueId','capitalize','voice','VoiceQueue','format','SIP/%s','penalty','UserVoiceQueueRt','remove','Queue:remove','userpic','file','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','CHAT','createdAt','FAX','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','order','sort','pick','getContacts','hasOwnProperty','CmList','List','Tag','Tags','tag','getQueues','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','connection','remoteAddress','socket','destroy','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','upsert'];(function(_0x5e34a4,_0x2e63ed){var _0x8d41d7=function(_0x45c61b){while(--_0x45c61b){_0x5e34a4['push'](_0x5e34a4['shift']());}};_0x8d41d7(++_0x2e63ed);}(_0x4213,0xa3));var _0x3421=function(_0x44e2e1,_0x1035d9){_0x44e2e1=_0x44e2e1-0x0;var _0x33d0ce=_0x4213[_0x44e2e1];return _0x33d0ce;};'use strict';var moment=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var fs=require('fs');var _=require(_0x3421('0x3'));var squel=require(_0x3421('0x4'));var jayson=require(_0x3421('0x5'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var logger=require(_0x3421('0x6'))('api');var utils=require(_0x3421('0x7'));var config=require('../../config/environment');var licenseUtil=require(_0x3421('0x8'));var APIBadRequestError=require(_0x3421('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x3421('0x9'))[_0x3421('0xa')];var APIHandleError=require(_0x3421('0x9'))[_0x3421('0xb')];var db=require(_0x3421('0xc'))['db'];var socket=require(_0x3421('0xd'))(new Redis(config['redis']));require(_0x3421('0xe'))[_0x3421('0xf')](socket);config[_0x3421('0x10')]=_[_0x3421('0x11')](config[_0x3421('0x10')],{'host':_0x3421('0x12'),'port':0x18eb});var amiClient=jayson[_0x3421('0x13')][_0x3421('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x47bd30,_0x47e769,_0x15f6f5,_0x7d3000){return new Promise(function(_0x594244,_0x12731e){var _0x2be6e4=_0x7d3000||amiClient;return _0x2be6e4[_0x3421('0x15')](_0x47bd30,_0x15f6f5)['then'](function(_0x59d96d){logger[_0x3421('0x16')](_0x3421('0x17'),_0x47e769,_0x3421('0x18'));logger[_0x3421('0x19')](_0x3421('0x1a'),_0x47e769,_0x3421('0x18'),JSON[_0x3421('0x1b')](_0x59d96d));if(_0x59d96d['error']){if(_0x59d96d['error'][_0x3421('0x1c')]===0x1f4){logger[_0x3421('0x1d')](_0x3421('0x17'),_0x47e769,_0x59d96d[_0x3421('0x1d')][_0x3421('0x1e')]);return _0x12731e(_0x59d96d['error'][_0x3421('0x1e')]);}logger[_0x3421('0x1d')](_0x3421('0x17'),_0x47e769,_0x59d96d[_0x3421('0x1d')][_0x3421('0x1e')]);return _0x594244(_0x59d96d[_0x3421('0x1d')]['message']);}else{logger[_0x3421('0x16')](_0x3421('0x17'),_0x47e769,_0x3421('0x18'));_0x594244(_0x59d96d['result'][_0x3421('0x1e')]);}})[_0x3421('0x1f')](function(_0x228d82){logger[_0x3421('0x1d')](_0x3421('0x17'),_0x47e769,_0x228d82);_0x12731e(_0x228d82);});});}function respondWithStatusCode(_0x2e3874,_0x44b5c2){_0x44b5c2=_0x44b5c2||0xcc;return function(_0x17b768){if(_0x17b768){return _0x2e3874[_0x3421('0x20')](_0x44b5c2);}return _0x2e3874[_0x3421('0x21')](_0x44b5c2)[_0x3421('0x22')]();};}function respondWithResult(_0x241ebf,_0x25ba7e){_0x25ba7e=_0x25ba7e||0xc8;return function(_0x44bf57){if(_0x44bf57){return _0x241ebf['status'](_0x25ba7e)[_0x3421('0x23')](_0x44bf57);}};}function respondWithFilteredResult(_0x39b882,_0x12cffd){return function(_0x11f9db){if(_0x11f9db){var _0x2b25eb=typeof _0x12cffd[_0x3421('0x24')]===_0x3421('0x25')&&typeof _0x12cffd[_0x3421('0x26')]===_0x3421('0x25');var _0x3db627=_0x11f9db['count'];var _0x2a0031=_0x2b25eb?0x0:_0x12cffd['offset'];var _0x597284=_0x2b25eb?_0x11f9db['count']:_0x12cffd['offset']+_0x12cffd[_0x3421('0x26')];var _0x1e4e68;if(_0x597284>=_0x3db627){_0x597284=_0x3db627;_0x1e4e68=0xc8;}else{_0x1e4e68=0xce;}_0x39b882['status'](_0x1e4e68);return _0x39b882[_0x3421('0x27')](_0x3421('0x28'),_0x2a0031+'-'+_0x597284+'/'+_0x3db627)['json'](_0x11f9db);}return null;};}function saveUpdates(_0x337afd){return function(_0x2270ac){if(_0x2270ac){return _0x2270ac['update'](_0x337afd)[_0x3421('0x29')](function(_0x1ca943){socket[_0x3421('0x2a')](_0x3421('0x2b')+_0x1ca943['id'],{});return _0x1ca943;});}return null;};}function removeEntity(_0x5cbdae){return function(_0x182112){if(_0x182112){return _0x182112['destroy']()[_0x3421('0x29')](function(){var _0x6e11d1=_0x182112[_0x3421('0x2c')]({'plain':!![]});if(_0x6e11d1[_0x3421('0x2d')]===_0x3421('0x2e'))return;var _0x57e23f=[{'name':_0x3421('0x2f'),'value':_0x3421('0x30'),'ignore':!![]},{'name':_0x3421('0x31'),'value':_0x3421('0x32'),'ignore':![]},{'name':_0x3421('0x33'),'value':'telephone','ignore':![]}];var _0x5e979c=_(_0x57e23f)['filter'](_0x3421('0x34'))['map'](_0x3421('0x35'))['value']();if(_['includes'](_0x5e979c,_0x6e11d1[_0x3421('0x2d')])){return;}var _0x5df560=_[_0x3421('0x36')](_0x57e23f,['value',_0x6e11d1[_0x3421('0x2d')]])[_0x3421('0x37')];return db[_0x3421('0x38')]['destroy']({'where':{'type':_0x5df560,'resourceId':_0x6e11d1['id']}})[_0x3421('0x29')](function(){return _0x182112;});})['then'](function(){_0x5cbdae[_0x3421('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16bcea){return function(_0x53d94c){if(!_0x53d94c){_0x16bcea[_0x3421('0x20')](0x194);}return _0x53d94c;};}function handleError(_0x12cbac,_0x2809a3){_0x2809a3=_0x2809a3||0x1f4;return function(_0x102829){logger[_0x3421('0x1d')](_0x102829[_0x3421('0x39')]);if(_0x102829['name']){delete _0x102829['name'];}_0x12cbac[_0x3421('0x21')](_0x2809a3)['send'](_0x102829);};}exports[_0x3421('0x3a')]=function(_0x32cafc,_0x18151f){var _0x3088f5={},_0x49c8f8={'count':0x0,'rows':[]};var _0x3efac9=_(db[_0x3421('0x3b')][_0x3421('0x3c')])['map'](function(_0x4246a9){return{'name':_0x4246a9[_0x3421('0x3d')],'type':_0x4246a9[_0x3421('0x3e')][_0x3421('0x3f')]};})[_0x3421('0x40')](function(_0x1829c5){return!_['includes']([_0x3421('0x41'),_0x3421('0x42')],_0x1829c5[_0x3421('0x37')]);})[_0x3421('0x35')]();_0x3088f5=qs['getOptions'](_0x3efac9,_0x32cafc);var _0xa94230={'where':_0x3088f5[_0x3421('0x43')]};return db[_0x3421('0x3b')][_0x3421('0x44')](_0xa94230)[_0x3421('0x29')](function(_0x4864b7){_0x49c8f8[_0x3421('0x44')]=_0x4864b7;if(_0x32cafc[_0x3421('0x45')][_0x3421('0x46')]){_0x3088f5[_0x3421('0x47')]=[{'all':!![]}];}if(_0x32cafc[_0x3421('0x45')][_0x3421('0x48')]==='true'){_0x3088f5['include']=[{'model':db['UserSetting'],'as':_0x3421('0x48')}];}if(!_[_0x3421('0x49')](_0x3088f5[_0x3421('0x4a')],'id')){_0x3088f5[_0x3421('0x4a')][_0x3421('0x4b')]('id');}return db[_0x3421('0x3b')][_0x3421('0x4c')](_0x3088f5);})['then'](function(_0x51d21f){_0x49c8f8[_0x3421('0x4d')]=_0x51d21f;if(_0x32cafc[_0x3421('0x45')]['openTabs']===_0x3421('0x4e')){var _0x5ce859=[];for(var _0x502313=0x0;_0x502313<_0x49c8f8[_0x3421('0x4d')][_0x3421('0x4f')];_0x502313++){_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs('sms',_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs(_0x3421('0x52'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x49c8f8['rows'][_0x502313][_0x3421('0x51')]));_0x5ce859[_0x3421('0x4b')](get_open_tabs(_0x3421('0x54'),_0x49c8f8[_0x3421('0x4d')][_0x502313][_0x3421('0x51')]));_0x5ce859['push'](get_open_tabs('whatsapp',_0x49c8f8['rows'][_0x502313][_0x3421('0x51')]));}return Promise['all'](_0x5ce859)[_0x3421('0x29')](function(){return _0x49c8f8;});}else{return _0x49c8f8;}})['then'](respondWithFilteredResult(_0x18151f,_0x3088f5))[_0x3421('0x1f')](handleError(_0x18151f,null));};exports[_0x3421('0x55')]=function(_0x55db46,_0x3cff71){var _0x755cc5={'raw':![],'where':{'id':_0x55db46[_0x3421('0x56')]['id']}},_0x80b492={};_0x80b492[_0x3421('0x57')]=_[_0x3421('0x58')](_[_0x3421('0x59')](db[_0x3421('0x3b')][_0x3421('0x3c')]),[_0x3421('0x41'),_0x3421('0x42')]);_0x80b492[_0x3421('0x45')]=_['keys'](_0x55db46[_0x3421('0x45')]);_0x80b492[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x80b492[_0x3421('0x57')],_0x80b492['query']);_0x755cc5['attributes']=_['intersection'](_0x80b492[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x55db46['query'][_0x3421('0x5c')]));_0x755cc5[_0x3421('0x4a')]=_0x755cc5['attributes'][_0x3421('0x4f')]?_0x755cc5['attributes']:_0x80b492[_0x3421('0x57')];if(_0x55db46[_0x3421('0x45')][_0x3421('0x46')]){_0x755cc5[_0x3421('0x47')]=[{'all':!![]}];}if(_0x55db46[_0x3421('0x45')][_0x3421('0x48')]==='true'){_0x755cc5[_0x3421('0x47')]=[{'model':db[_0x3421('0x5d')],'as':'userSetting'}];}_0x755cc5=_[_0x3421('0x5e')]({},_0x755cc5,_0x55db46[_0x3421('0x5f')]);if(!_[_0x3421('0x49')](_0x755cc5[_0x3421('0x4a')],'id')){_0x755cc5[_0x3421('0x4a')]['push']('id');}return db[_0x3421('0x3b')][_0x3421('0x36')](_0x755cc5)[_0x3421('0x29')](handleEntityNotFound(_0x3cff71,null))[_0x3421('0x29')](function(_0x2b178d){var _0x17d246=[];values=_0x2b178d;if(_0x55db46[_0x3421('0x45')][_0x3421('0x60')]==='true'){_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x61'),_0x2b178d[_0x3421('0x51')]));_0x17d246['push'](get_open_tabs(_0x3421('0x54'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x62'),_0x2b178d[_0x3421('0x51')]));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x52'),_0x2b178d['dataValues']));_0x17d246[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x2b178d[_0x3421('0x51')]));return Promise[_0x3421('0x63')](_0x17d246);}else{return values;}})[_0x3421('0x29')](function(){return values;})[_0x3421('0x29')](respondWithResult(_0x3cff71,null))[_0x3421('0x1f')](handleError(_0x3cff71,null));};exports[_0x3421('0x64')]=function(_0x22cd19,_0x2a62f3){if(_0x22cd19[_0x3421('0x65')]['id']){delete _0x22cd19[_0x3421('0x65')]['id'];}delete _0x22cd19[_0x3421('0x65')][_0x3421('0x2d')];return db['User'][_0x3421('0x36')]({'where':{'id':_0x22cd19['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2a62f3,null))['then'](saveUpdates(_0x22cd19[_0x3421('0x65')],null))['then'](respondWithResult(_0x2a62f3,null))[_0x3421('0x1f')](handleError(_0x2a62f3,null));};exports[_0x3421('0x66')]=function(_0x33602d,_0x5b0070){return db[_0x3421('0x3b')][_0x3421('0x66')]()['then'](respondWithResult(_0x5b0070,null))[_0x3421('0x1f')](handleError(_0x5b0070,null));};exports[_0x3421('0x67')]=function(_0x5bfeea,_0x362f82){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x5bfeea[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x362f82,null))[_0x3421('0x29')](function(_0x5e2a30){if(_0x5e2a30){return _0x5e2a30[_0x3421('0x67')](_0x5bfeea[_0x3421('0x65')]['ids'],_[_0x3421('0x68')](_0x5bfeea[_0x3421('0x65')],[_0x3421('0x69'),'id'])||{});}})[_0x3421('0x29')](respondWithResult(_0x362f82,null))['catch'](handleError(_0x362f82,null));};function validateUser(_0x11d834){return new Promise(function(_0x25e208,_0x23b5a3){if(_0x11d834[_0x3421('0x6a')])return _0x25e208(_0x11d834);return db[_0x3421('0x6b')]['findById'](0x1)[_0x3421('0x29')](function(_0x305dd2){if(_0x305dd2[_0x3421('0x6c')])authService[_0x3421('0x6d')](_0x11d834[_0x3421('0x41')]);db[_0x3421('0x3b')][_0x3421('0x6e')](_0x3421('0x6a'))['then'](function(_0x2a1cb5){if(_[_0x3421('0x6f')](_0x2a1cb5)){_0x11d834[_0x3421('0x6a')]=_0x305dd2[_0x3421('0x70')]||0x1;return;}if(_['isNil'](_0x305dd2[_0x3421('0x70')])||_0x305dd2[_0x3421('0x70')]===_0x2a1cb5){_0x11d834[_0x3421('0x6a')]=_0x2a1cb5+0x1;return;}if(_0x305dd2['min_internal']>_0x2a1cb5){_0x11d834['internal']=_0x305dd2[_0x3421('0x70')];return;}return db[_0x3421('0x71')]['query'](_0x3421('0x72'),{'type':db[_0x3421('0x71')][_0x3421('0x73')]['SELECT']})['then'](function(_0x3b359c){if(_0x3b359c&&_0x3b359c[_0x3421('0x4f')]){for(var _0x220ea9=0x0,_0x17f98d=_0x3b359c[_0x3421('0x4f')];_0x220ea9<_0x17f98d&&_['isNil'](_0x11d834['internal']);_0x220ea9++){if(_0x305dd2['min_internal']<=_0x3b359c[_0x220ea9]['from']){_0x11d834[_0x3421('0x6a')]=_0x3b359c[_0x220ea9][_0x3421('0x74')];}else if(_0x305dd2[_0x3421('0x70')]>_0x3b359c[_0x220ea9]['from']&&_0x305dd2['min_internal']<=_0x3b359c[_0x220ea9]['to']){_0x11d834['internal']=_0x305dd2[_0x3421('0x70')];}}}if(_[_0x3421('0x6f')](_0x11d834[_0x3421('0x6a')])){_0x11d834[_0x3421('0x6a')]=_0x2a1cb5+0x1;}return _0x25e208(_0x11d834);});});})['catch'](function(_0x59d182){_0x23b5a3(_0x59d182);});});}function updateUser(_0x225a62){return new Promise(function(_0x3a14d5,_0x383dd6){try{if(_0x225a62[_0x3421('0x75')]){_0x225a62[_0x3421('0x76')]=_0x225a62[_0x3421('0x6a')];_0x225a62['VoiceMail']={'mailbox':_0x225a62[_0x3421('0x6a')],'password':_0x225a62[_0x3421('0x41')],'fullname':_0x225a62[_0x3421('0x77')],'email':_0x225a62['email']};}if(_0x225a62['role']==='agent'){if(!_0x225a62[_0x3421('0x78')])_0x225a62[_0x3421('0x78')]=[_0x3421('0x79'),_0x3421('0x7a'),_0x3421('0x7b'),'113',_0x3421('0x7c'),_0x3421('0x7d'),_0x3421('0x7e'),_0x3421('0x7f'),_0x3421('0x80'),_0x3421('0x81'),_0x3421('0x82'),_0x3421('0x83'),'111',_0x3421('0x84'),'115'];}_0x3a14d5(_0x225a62);}catch(_0x41d240){_0x383dd6(_0x41d240);}});}exports[_0x3421('0x85')]=function(_0x1d039f,_0xfb38f6){if(_0x1d039f[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x32'))throw new Error(_0x3421('0x86'));if(_0x1d039f[_0x3421('0x65')][_0x3421('0x2d')]===_0x3421('0x30')&&_0x1d039f['user'][_0x3421('0x2d')]!==_0x3421('0x2e')){throw new Error(_0x3421('0x87'));}if(_0x1d039f[_0x3421('0x65')]['role']==='admin'&&_0x1d039f[_0x3421('0x30')][_0x3421('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x3421('0x88')]([_0x1d039f[_0x3421('0x65')]])[_0x3421('0x29')](function(){return validateUser(_0x1d039f[_0x3421('0x65')]);})['then'](function(_0x215d5e){return updateUser(_0x215d5e)[_0x3421('0x29')](function(_0x19c51f){if(_0x19c51f[_0x3421('0x2d')]==='admin'){_0x19c51f[_0x3421('0x89')]=_0x1d039f['user'][_0x3421('0x89')];delete _0x19c51f['userProfileId'];}return _0x19c51f;});})[_0x3421('0x29')](function(_0x4c3ffa){return db[_0x3421('0x3b')][_0x3421('0x85')](_0x4c3ffa,{'include':[{'model':db[_0x3421('0x8a')],'as':_0x3421('0x8a')}]});})[_0x3421('0x29')](function(_0x1c9d50){if(_0x1d039f[_0x3421('0x65')]['role']==='user')return _0x1c9d50;if(_0x1d039f['user'][_0x3421('0x2d')]!==_0x3421('0x30'))return _0x1c9d50;return db[_0x3421('0x8b')][_0x3421('0x36')]({'where':{'name':_0x1c9d50[_0x3421('0x2d')]===_0x3421('0x32')?_0x3421('0x31'):'Telephones','userProfileId':_0x1d039f['user']['userProfileId']},'raw':!![]})[_0x3421('0x29')](function(_0x369b87){if(!_0x369b87||_0x369b87['autoAssociation']!=0x0)return _0x1c9d50;return db[_0x3421('0x38')][_0x3421('0x85')]({'name':_0x1c9d50[_0x3421('0x37')],'resourceId':_0x1c9d50['id'],'type':_0x369b87['name'],'sectionId':_0x369b87['id']},{})[_0x3421('0x29')](function(){return _0x1c9d50;});})[_0x3421('0x1f')](function(_0xee9019){logger[_0x3421('0x1d')](_0x3421('0x8c'),_0xee9019);throw _0xee9019;});})[_0x3421('0x29')](respondWithResult(_0xfb38f6,0xc9))[_0x3421('0x1f')](handleError(_0xfb38f6,null));};exports['bulkCreate']=function(_0x2279e8,_0x18bfff){var _0x22cd4f=_0x2279e8['body'];var _0x303ada=[];if(_0x2279e8[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x32'))throw new Error(_0x3421('0x86'));if(_[_0x3421('0x8d')](_0x22cd4f,[_0x3421('0x2d'),_0x3421('0x30')])&&_0x2279e8[_0x3421('0x30')]['role']!=='admin'){throw new Error(_0x3421('0x87'));}if(_[_0x3421('0x8d')](_0x22cd4f,[_0x3421('0x2d'),_0x3421('0x2e')])&&_0x2279e8[_0x3421('0x30')]['role']!==_0x3421('0x2e')){throw new Error(_0x3421('0x8e'));}return licenseUtil[_0x3421('0x88')](_0x22cd4f)[_0x3421('0x29')](function(){return validateUser(_0x22cd4f[0x0]);})[_0x3421('0x29')](function(){for(var _0x520bf0=0x1;_0x520bf0<_0x22cd4f[_0x3421('0x4f')];_0x520bf0++){var _0x27f246=_0x22cd4f[_0x520bf0-0x1][_0x3421('0x6a')];if(!_0x22cd4f[_0x520bf0][_0x3421('0x6a')])_0x22cd4f[_0x520bf0][_0x3421('0x6a')]=_0x27f246+0x1;_0x303ada[_0x3421('0x4b')](validateUser(_0x22cd4f[_0x520bf0]));}return Promise[_0x3421('0x63')](_0x303ada);})[_0x3421('0x29')](function(){_0x303ada=[];for(var _0x5268a8=0x0;_0x5268a8<_0x22cd4f[_0x3421('0x4f')];_0x5268a8++){_0x303ada[_0x3421('0x4b')](updateUser(_0x22cd4f[_0x5268a8]));}return Promise['all'](_0x303ada);})['then'](function(){_0x303ada=_0x22cd4f[_0x3421('0x8f')](function(_0x514caa){return db[_0x3421('0x3b')][_0x3421('0x85')](_0x514caa,{'include':[{'model':db[_0x3421('0x8a')],'as':_0x3421('0x8a')}]})[_0x3421('0x29')](function(_0xc49cc8){_0x514caa['id']=_0xc49cc8['id'];return _0x514caa;});});return Promise[_0x3421('0x63')](_0x303ada);})[_0x3421('0x29')](function(_0x2a7089){if(_0x2279e8[_0x3421('0x65')]['role']===_0x3421('0x30'))return _0x2a7089;if(_0x2279e8['user'][_0x3421('0x2d')]!==_0x3421('0x30'))return _0x2a7089;var _0x20dd42=_[_0x3421('0x8d')](_0x2a7089,function(_0x491400){return _0x491400[_0x3421('0x2d')]===_0x3421('0x32')||_0x491400['role']===_0x3421('0x90');});if(!_0x20dd42)return _0x2a7089;return db[_0x3421('0x8b')][_0x3421('0x4c')]({'where':{'name':{'$or':[_0x3421('0x31'),_0x3421('0x33')]},'userProfileId':_0x2279e8[_0x3421('0x30')][_0x3421('0x91')]},'raw':!![]})[_0x3421('0x29')](function(_0x288a59){if(_['isEmpty'](_0x288a59)||!_['some'](_0x288a59,[_0x3421('0x92'),0x0]))return _0x2a7089;_0x303ada=[];var _0x1a060a=_(_0x288a59)[_0x3421('0x8f')](function(_0x58f9fe){if(_0x58f9fe[_0x3421('0x92')]===0x1)return;return _0x58f9fe[_0x3421('0x37')]==='Agents'?_0x3421('0x32'):'telephone';})[_0x3421('0x93')]()['value']();for(var _0x5c631e=0x0;_0x5c631e<_0x2a7089[_0x3421('0x4f')];_0x5c631e++){if(!_[_0x3421('0x49')](_0x1a060a,_0x2a7089[_0x5c631e][_0x3421('0x2d')]))return;var _0x279296=_0x2a7089[_0x5c631e]['role']===_0x3421('0x32')?_0x3421('0x31'):_0x3421('0x33');_0x303ada['push'](db['UserProfileResource'][_0x3421('0x85')]({'name':_0x2a7089[_0x5c631e]['name'],'resourceId':_0x2a7089[_0x5c631e]['id'],'type':_0x279296,'sectionId':_[_0x3421('0x36')](_0x288a59,[_0x3421('0x37'),_0x279296])['id']},{}));}return Promise['all'](_0x303ada);});})[_0x3421('0x29')](respondWithResult(_0x18bfff,0xc9))[_0x3421('0x1f')](handleError(_0x18bfff,null));};exports[_0x3421('0x94')]=function(_0x8ff8a2,_0x3dcf15){if(_0x8ff8a2['body']['id']){delete _0x8ff8a2['body']['id'];}return db['User'][_0x3421('0x36')]({'where':{'id':_0x8ff8a2['params']['id']}})[_0x3421('0x29')](function(_0x51ba2a){if(!_0x51ba2a)return null;if(_0x51ba2a['id']===_0x8ff8a2['user']['id']){if(!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')]||!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x99'));}if(!_0x51ba2a[_0x3421('0x9a')](_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')])){throw new db[(_0x3421('0x97'))]['ValidationError'](_0x3421('0x9b'));}if(_0x8ff8a2[_0x3421('0x65')][_0x3421('0x95')]===_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x9c'));}}else if(_0x8ff8a2[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x2e')){if(!_0x8ff8a2['body'][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x8ff8a2[_0x3421('0x30')][_0x3421('0x2d')]===_0x3421('0x30')){if(!_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')]){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x51ba2a[_0x3421('0x2d')]!==_0x3421('0x32')){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0x86'));}}else{throw new db[(_0x3421('0x97'))]['ValidationError']('Unauthorized');}return _0x51ba2a;})[_0x3421('0x29')](handleEntityNotFound(_0x3dcf15,null))[_0x3421('0x29')](function(_0x432ac7){return db[_0x3421('0x6b')][_0x3421('0x9d')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x3421('0x9e')]})['then'](function(_0xf18489){if(_0xf18489['securePassword'])authService[_0x3421('0x6d')](_0x8ff8a2['body'][_0x3421('0x96')]);if(!_0xf18489[_0x3421('0x9f')]||!_0x432ac7[_0x3421('0xa0')])return _0x432ac7;authService[_0x3421('0xa1')](_0x8ff8a2[_0x3421('0x65')][_0x3421('0x96')],_0x432ac7[_0x3421('0xa0')],_0xf18489[_0x3421('0x9e')]);return _0x432ac7;})[_0x3421('0x29')](saveUpdates({'password':_0x8ff8a2['body']['newPassword'],'passwordResetAt':_0x8ff8a2[_0x3421('0x30')]['id']==_0x8ff8a2[_0x3421('0x56')]['id']?moment():null,'previousPasswords':authService[_0x3421('0xa2')](_0x8ff8a2['body'][_0x3421('0x96')],_0x432ac7['previousPasswords'])},null));})[_0x3421('0x29')](respondWithResult(_0x3dcf15,null))[_0x3421('0x1f')](handleError(_0x3dcf15,null));};exports[_0x3421('0xa3')]=function(_0x47f6bc,_0xf38a12){var _0x3e9661=_0x47f6bc[_0x3421('0x65')][_0x3421('0xa4')];return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x47f6bc['params']['id']},'attributes':['id',_0x3421('0x37'),'role',_0x3421('0xa5'),_0x3421('0xa6'),_0x3421('0xa7'),_0x3421('0xa8')]})[_0x3421('0x29')](handleEntityNotFound(_0xf38a12,null))[_0x3421('0x29')](function(_0x300bb8){if(_0x300bb8){if(!utils[_0x3421('0xa9')](_0x3e9661)){throw new db['Sequelize'][(_0x3421('0x98'))](_0x3421('0xaa'));}return _0x300bb8['add'+_['capitalize'](_0x3e9661[_0x3421('0xab')]())+_0x3421('0xac')](_0x47f6bc[_0x3421('0x65')]['ids'],{'penalty':_0x47f6bc[_0x3421('0x65')]['penalty']||0x0})[_0x3421('0xad')](function(_0x298b4c){for(var _0x13c556=0x0;_0x13c556<_0x47f6bc[_0x3421('0x65')][_0x3421('0x69')][_0x3421('0x4f')];_0x13c556+=0x1){var _0x1397c6={'UserId':Number(_0x47f6bc[_0x3421('0x56')]['id'])};_0x1397c6[_['capitalize'](_0x3e9661['toLowerCase']())+_0x3421('0xae')]=Number(_0x47f6bc[_0x3421('0x65')][_0x3421('0x69')][_0x13c556]);socket['emit'](_0x3421('0x30')+_[_0x3421('0xaf')](_0x3e9661[_0x3421('0xab')]())+'Queue:save',_0x1397c6);}return _0x298b4c;})[_0x3421('0x29')](function(){if(_0x3e9661===_0x3421('0xb0')){return db[_0x3421('0xb1')]['findAll']({'where':{'id':_0x47f6bc[_0x3421('0x65')]['ids']||[]},'raw':!![],'attributes':['id',_0x3421('0x37')]});}})[_0x3421('0x29')](function(_0x24a846){var _0x82c418=_0x300bb8[_0x3421('0x2c')]({'plain':!![]});var _0x1d2716=[];if(_0x3e9661===_0x3421('0xb0')&&_0x82c418['role']===_0x3421('0x32')&&_0x82c418[_0x3421('0xa5')]){for(let _0x4c3980=0x0;_0x4c3980<_0x24a846['length'];_0x4c3980+=0x1){_0x1d2716[_0x3421('0x4b')]({'membername':_0x82c418[_0x3421('0x37')],'UserId':_0x82c418['id'],'queue_name':_0x24a846[_0x4c3980][_0x3421('0x37')],'VoiceQueueId':_0x24a846[_0x4c3980]['id'],'interface':_[_0x3421('0x6f')](_0x82c418[_0x3421('0xa8')])?util[_0x3421('0xb2')](_0x3421('0xb3'),_0x82c418[_0x3421('0x37')]):_0x82c418[_0x3421('0xa8')],'paused':_0x82c418[_0x3421('0xa7')]||![],'penalty':_0x47f6bc[_0x3421('0x65')][_0x3421('0xb4')]||0x0});}return Promise['all'](_0x1d2716[_0x3421('0x8f')](function(_0x2449c0){return db[_0x3421('0xb5')]['upsert'](_0x2449c0);}));}return _0x300bb8;});}})[_0x3421('0x29')](respondWithStatusCode(_0xf38a12,null))[_0x3421('0x1f')](handleError(_0xf38a12,null));};exports['removeQueues']=function(_0x202416,_0x26b3ee){var _0x2f82c1,_0x40eb5c;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x202416['params']['id']},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d')]})[_0x3421('0x29')](handleEntityNotFound(_0x26b3ee,null))['then'](function(_0x850584){if(_0x850584){_0x2f82c1=_0x850584;if(!_0x202416[_0x3421('0x45')]['channel']||!utils[_0x3421('0xa9')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')])){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xaa'));}return _0x850584[_0x3421('0xb6')+_[_0x3421('0xaf')](_0x202416['query']['channel']['toLowerCase']())+_0x3421('0xac')](_0x202416[_0x3421('0x45')][_0x3421('0x69')]);}})['then'](function(_0x3800fa){if(_['isArray'](_0x202416[_0x3421('0x45')][_0x3421('0x69')])){for(var _0x4d295c=0x0;_0x4d295c<_0x202416[_0x3421('0x45')][_0x3421('0x69')][_0x3421('0x4f')];_0x4d295c+=0x1){_0x40eb5c={'UserId':Number(_0x202416[_0x3421('0x56')]['id'])};_0x40eb5c[_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xae')]=Number(_0x202416[_0x3421('0x45')]['ids'][_0x4d295c]);socket[_0x3421('0x2a')](_0x3421('0x30')+_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xb7'),_0x40eb5c);}}else{_0x40eb5c={'UserId':Number(_0x202416[_0x3421('0x56')]['id'])};_0x40eb5c[_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')][_0x3421('0xa4')][_0x3421('0xab')]())+_0x3421('0xae')]=Number(_0x202416['query'][_0x3421('0x69')]);socket['emit'](_0x3421('0x30')+_[_0x3421('0xaf')](_0x202416[_0x3421('0x45')]['channel'][_0x3421('0xab')]())+_0x3421('0xb7'),_0x40eb5c);}return _0x3800fa;})[_0x3421('0x29')](function(){if(_0x202416[_0x3421('0x45')]['channel']===_0x3421('0xb0')){return db[_0x3421('0xb5')]['destroy']({'where':{'UserId':_0x202416['params']['id'],'VoiceQueueId':_0x202416['query'][_0x3421('0x69')]},'individualHooks':!![]})[_0x3421('0x29')](function(){return _0x2f82c1;});}return _0x2f82c1;})[_0x3421('0x29')](respondWithStatusCode(_0x26b3ee,null))[_0x3421('0x1f')](handleError(_0x26b3ee,null));};exports['addAvatar']=function(_0xa0be8f,_0x549f74){_0xa0be8f[_0x3421('0x65')][_0x3421('0xb8')]=_0xa0be8f[_0x3421('0xb9')]['filename'];return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0xa0be8f['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x549f74,null))[_0x3421('0x29')](saveUpdates(_0xa0be8f[_0x3421('0x65')],null))[_0x3421('0x29')](respondWithResult(_0x549f74,null))[_0x3421('0x1f')](handleError(_0x549f74,null));};exports['getAvatar']=function(_0x99f8f4,_0x4447f0){var _0x15fe37=path[_0x3421('0xba')](config[_0x3421('0xbb')],_0x3421('0xbc'));return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x99f8f4['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x3421('0x29')](handleEntityNotFound(_0x4447f0,null))[_0x3421('0x29')](function(_0xc63b91){if(_0xc63b91){if(_[_0x3421('0x6f')](_0xc63b91[_0x3421('0xb8')])){return _0x4447f0[_0x3421('0xbd')](_0x15fe37);}else{if(!fs[_0x3421('0xbe')](path[_0x3421('0xba')](config[_0x3421('0xbb')],_0x3421('0xbf'),_0xc63b91[_0x3421('0xb8')]))){return _0x4447f0[_0x3421('0xbd')](_0x15fe37);}return _0x4447f0[_0x3421('0xbd')](path[_0x3421('0xba')](config['root'],'server/files/images/',_0xc63b91[_0x3421('0xb8')]));}}})[_0x3421('0x1f')](handleError(_0x4447f0,null));};exports[_0x3421('0xc0')]=function(_0x36b677,_0x543275){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x36b677['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x543275,null))[_0x3421('0x29')](function(_0x141693){var _0x25f983=[];values=_0x141693[_0x3421('0x51')];_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x50'),_0x141693['dataValues']));_0x25f983['push'](get_open_tabs(_0x3421('0x61'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x54'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x62'),_0x141693[_0x3421('0x51')]));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x52'),_0x141693['dataValues']));_0x25f983[_0x3421('0x4b')](get_open_tabs(_0x3421('0x53'),_0x141693[_0x3421('0x51')]));return Promise[_0x3421('0x63')](_0x25f983);})['then'](function(_0x3c2076){if(_0x3c2076){var _0x2df1fd=_[_0x3421('0x8f')](values['ChatOpenTabs'],function(_0x2eb0cd){return{'channel':_0x3421('0xc1'),'id':_0x2eb0cd['id'],'createdAt':_0x2eb0cd[_0x3421('0xc2')]};});var _0x1f8eed=_[_0x3421('0x8f')](values['FaxOpenTabs'],function(_0x506ebd){return{'channel':_0x3421('0xc3'),'id':_0x506ebd['id'],'createdAt':_0x506ebd[_0x3421('0xc2')]};});var _0x3392d1=_[_0x3421('0x8f')](values['OpenchannelOpenTabs'],function(_0x448b64){return{'channel':_0x3421('0xc4'),'id':_0x448b64['id'],'createdAt':_0x448b64[_0x3421('0xc2')]};});var _0x536ccb=_[_0x3421('0x8f')](values['MailOpenTabs'],function(_0x1f1a24){return{'channel':_0x3421('0xc5'),'id':_0x1f1a24['id'],'createdAt':_0x1f1a24['createdAt']};});var _0xf6dd94=_[_0x3421('0x8f')](values[_0x3421('0xc6')],function(_0x160e83){return{'channel':_0x3421('0xc7'),'id':_0x160e83['id'],'createdAt':_0x160e83['createdAt']};});var _0x48f193=_['map'](values[_0x3421('0xc8')],function(_0x149774){return{'channel':_0x3421('0xc9'),'id':_0x149774['id'],'createdAt':_0x149774[_0x3421('0xc2')]};});var _0x4df5b6=_['concat'](_0x2df1fd,_0x1f8eed,_0x3392d1,_0x536ccb,_0xf6dd94,_0x48f193);var _0x43e05a={'count':_0x4df5b6[_0x3421('0x4f')],'rows':_0x4df5b6};return _0x43e05a;}else return null;})[_0x3421('0x29')](respondWithResult(_0x543275,null))[_0x3421('0x1f')](handleError(_0x543275,null));};exports['getContacts']=function(_0x5d7eb9,_0x1da942){var _0x2029bb={};var _0x4f7012={};var _0x5d42b2;var _0x5b5ec3;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x5d7eb9['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x1da942,null))[_0x3421('0x29')](function(_0x41990){if(_0x41990){_0x5d42b2=_0x41990;_0x4f7012[_0x3421('0x57')]=_[_0x3421('0x59')](db['CmContact']['rawAttributes']);_0x4f7012[_0x3421('0x45')]=_[_0x3421('0x59')](_0x5d7eb9['query']);_0x4f7012[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x4f7012['model'],_0x4f7012[_0x3421('0x45')]);_0x2029bb[_0x3421('0x4a')]=_['intersection'](_0x4f7012[_0x3421('0x57')],qs['fields'](_0x5d7eb9[_0x3421('0x45')][_0x3421('0x5c')]));_0x2029bb[_0x3421('0x4a')]=_0x2029bb[_0x3421('0x4a')][_0x3421('0x4f')]?_0x2029bb['attributes']:_0x4f7012[_0x3421('0x57')];_0x2029bb[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x5d7eb9[_0x3421('0x45')][_0x3421('0xcb')]);_0x2029bb[_0x3421('0x43')]=qs['filters'](_[_0x3421('0xcc')](_0x5d7eb9[_0x3421('0x45')],_0x4f7012[_0x3421('0x5a')]));if(_0x5d7eb9[_0x3421('0x45')]['filter']){_0x2029bb[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x2029bb[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2029bb[_0x3421('0x4a')],function(_0x759b01){var _0xb504d6={};_0xb504d6[_0x759b01]={'$like':'%'+_0x5d7eb9['query'][_0x3421('0x40')]+'%'};return _0xb504d6;})});}_0x2029bb=_[_0x3421('0x5e')]({},_0x2029bb,_0x5d7eb9[_0x3421('0x5f')]);return _0x5d42b2[_0x3421('0xcd')](_0x2029bb);}})['then'](function(_0x23b3be){if(_0x23b3be){_0x5b5ec3=_0x23b3be[_0x3421('0x4f')];if(_0x5d7eb9[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0x46'))){_0x2029bb[_0x3421('0x47')]=[{'model':db[_0x3421('0xcf')],'as':_0x3421('0xd0'),'required':![]},{'model':db[_0x3421('0xd1')],'as':_0x3421('0xd2'),'attributes':['id',_0x3421('0x37'),'color'],'where':_0x5d7eb9['query'][_0x3421('0xd3')]?{'id':_0x5d7eb9[_0x3421('0x45')][_0x3421('0xd3')]}:undefined,'required':_0x5d7eb9['query'][_0x3421('0xd3')]?!![]:![]}];}if(!_0x5d7eb9[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x2029bb[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x5d7eb9['query']['limit']);_0x2029bb[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x5d7eb9[_0x3421('0x45')][_0x3421('0x24')]);}return _0x5d42b2[_0x3421('0xcd')](_0x2029bb);}})[_0x3421('0x29')](function(_0x23e05d){if(_0x23e05d){return _0x23e05d?{'count':_0x5b5ec3,'rows':_0x23e05d}:null;}})[_0x3421('0x29')](respondWithResult(_0x1da942,null))[_0x3421('0x1f')](handleError(_0x1da942,null));};exports[_0x3421('0xd4')]=function(_0x3fd247,_0x55db5d){var _0x1a6ddd;var _0x2e7601={};var _0x23728d;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x3fd247['params']['id']},'attributes':['id',_0x3421('0x37'),'role']})[_0x3421('0x29')](handleEntityNotFound(_0x55db5d,null))[_0x3421('0x29')](function(_0xb750f9){if(!utils[_0x3421('0xa9')](_0x3fd247['query'][_0x3421('0xa4')])){throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))]('Unknown\x20channel');}_0x1a6ddd=_0xb750f9;var _0x1f4181={};_0x1f4181['model']=_[_0x3421('0x59')](db[_[_0x3421('0xaf')](_0x3fd247['query']['channel'])+_0x3421('0xd5')]['rawAttributes']);_0x1f4181['query']=_[_0x3421('0x59')](_0x3fd247[_0x3421('0x45')]);_0x1f4181[_0x3421('0x5a')]=_['intersection'](_0x1f4181[_0x3421('0x57')],_0x1f4181[_0x3421('0x45')]);_0x2e7601['attributes']=_[_0x3421('0x5b')](_0x1f4181[_0x3421('0x57')],qs['fields'](_0x3fd247[_0x3421('0x45')][_0x3421('0x5c')]));_0x2e7601['attributes']=_0x2e7601['attributes']['length']?_0x2e7601[_0x3421('0x4a')]:_0x1f4181[_0x3421('0x57')];_0x2e7601[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x3fd247[_0x3421('0x45')][_0x3421('0xcb')]);_0x2e7601[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x3fd247['query'],_0x1f4181[_0x3421('0x5a')]));if(_0x3fd247[_0x3421('0x45')][_0x3421('0x40')]){_0x2e7601[_0x3421('0x43')]=_['merge'](_0x2e7601[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2e7601['attributes'],function(_0x321f39){var _0x2cb77c={};_0x2cb77c[_0x321f39]={'$like':'%'+_0x3fd247['query'][_0x3421('0x40')]+'%'};return _0x2cb77c;})});}_0x2e7601=_[_0x3421('0x5e')]({},_0x2e7601,_0x3fd247['options']);switch(_0x1a6ddd[_0x3421('0x2d')]){case _0x3421('0x2e'):return db[_[_0x3421('0xaf')](_0x3fd247['query'][_0x3421('0xa4')])+'Queue'][_0x3421('0x4c')](_0x2e7601);case _0x3421('0x30'):case'agent':return _0x1a6ddd[_0x3421('0x2c')+_['capitalize'](_0x3fd247[_0x3421('0x45')][_0x3421('0xa4')])+'Queues'](_0x2e7601);default:throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xd6'));}})[_0x3421('0x29')](function(_0x6ee685){_0x23728d=_0x6ee685[_0x3421('0x4f')];if(!_0x3fd247[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x2e7601[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x3fd247[_0x3421('0x45')][_0x3421('0x26')]);_0x2e7601[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x3fd247[_0x3421('0x45')][_0x3421('0x24')]);}switch(_0x1a6ddd['role']){case _0x3421('0x2e'):return db[_['capitalize'](_0x3fd247[_0x3421('0x45')]['channel'])+_0x3421('0xd5')][_0x3421('0x4c')](_0x2e7601);case _0x3421('0x30'):case _0x3421('0x32'):return _0x1a6ddd[_0x3421('0x2c')+_[_0x3421('0xaf')](_0x3fd247[_0x3421('0x45')]['channel'])+_0x3421('0xac')](_0x2e7601);}})[_0x3421('0x29')](function(_0x1e5337){return{'count':_0x23728d,'rows':_0x1e5337};})[_0x3421('0x29')](respondWithResult(_0x55db5d,null))['catch'](handleError(_0x55db5d,null));};exports[_0x3421('0xd8')]=function(_0x4ffb90,_0x3e45fd){var _0x1d5c97={};var _0x3e9a9b={};var _0x19f109;var _0x400ed7;return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x4ffb90[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x3e45fd,null))[_0x3421('0x29')](function(_0x185132){if(_0x185132){_0x19f109=_0x185132;_0x3e9a9b[_0x3421('0x57')]=_[_0x3421('0x59')](db['UserVoiceQueueRt'][_0x3421('0x3c')]);_0x3e9a9b[_0x3421('0x45')]=_[_0x3421('0x59')](_0x4ffb90[_0x3421('0x45')]);_0x3e9a9b['filters']=_['intersection'](_0x3e9a9b[_0x3421('0x57')],_0x3e9a9b[_0x3421('0x45')]);_0x1d5c97['attributes']=_[_0x3421('0x5b')](_0x3e9a9b[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x5c')]));_0x1d5c97[_0x3421('0x4a')]=_0x1d5c97[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1d5c97[_0x3421('0x4a')]:_0x3e9a9b['model'];_0x1d5c97[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x4ffb90[_0x3421('0x45')]['sort']);_0x1d5c97[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x4ffb90[_0x3421('0x45')],_0x3e9a9b['filters']));if(_0x4ffb90[_0x3421('0x45')][_0x3421('0x40')]){_0x1d5c97[_0x3421('0x43')]=_['merge'](_0x1d5c97[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x1d5c97[_0x3421('0x4a')],function(_0x37969f){var _0x88aeb2={};_0x88aeb2[_0x37969f]={'$like':'%'+_0x4ffb90['query'][_0x3421('0x40')]+'%'};return _0x88aeb2;})});}_0x1d5c97=_[_0x3421('0x5e')]({},_0x1d5c97,_0x4ffb90[_0x3421('0x5f')]);return _0x19f109[_0x3421('0xd8')](_0x1d5c97);}})['then'](function(_0x4a4272){if(_0x4a4272){_0x400ed7=_0x4a4272[_0x3421('0x4f')];if(!_0x4ffb90[_0x3421('0x45')]['hasOwnProperty'](_0x3421('0xd7'))){_0x1d5c97['limit']=qs[_0x3421('0x26')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x26')]);_0x1d5c97[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x4ffb90[_0x3421('0x45')][_0x3421('0x24')]);}return _0x19f109[_0x3421('0xd8')](_0x1d5c97);}})['then'](function(_0xe5ef24){if(_0xe5ef24){return _0xe5ef24?{'count':_0x400ed7,'rows':_0xe5ef24}:null;}})[_0x3421('0x29')](respondWithResult(_0x3e45fd,null))[_0x3421('0x1f')](handleError(_0x3e45fd,null));};exports[_0x3421('0xd9')]=function(_0x2f3403,_0x2ae580){var _0x2cf7ec={};var _0x1adcb4={};var _0x7cb2c8;var _0x3e0100;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x2f3403[_0x3421('0x56')]['id']}})['then'](handleEntityNotFound(_0x2ae580,null))[_0x3421('0x29')](function(_0x361d61){if(_0x361d61){_0x7cb2c8=_0x361d61;_0x1adcb4[_0x3421('0x57')]=_['keys'](db['ChatGroup'][_0x3421('0x3c')]);_0x1adcb4[_0x3421('0x45')]=_[_0x3421('0x59')](_0x2f3403[_0x3421('0x45')]);_0x1adcb4[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x1adcb4[_0x3421('0x57')],_0x1adcb4[_0x3421('0x45')]);_0x2cf7ec[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x1adcb4[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x2f3403[_0x3421('0x45')][_0x3421('0x5c')]));_0x2cf7ec[_0x3421('0x4a')]=_0x2cf7ec[_0x3421('0x4a')][_0x3421('0x4f')]?_0x2cf7ec['attributes']:_0x1adcb4[_0x3421('0x57')];_0x2cf7ec[_0x3421('0xca')]=qs['sort'](_0x2f3403[_0x3421('0x45')][_0x3421('0xcb')]);_0x2cf7ec['where']=qs['filters'](_[_0x3421('0xcc')](_0x2f3403[_0x3421('0x45')],_0x1adcb4['filters']));if(_0x2f3403[_0x3421('0x45')]['filter']){_0x2cf7ec[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x2cf7ec[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2cf7ec[_0x3421('0x4a')],function(_0xf33dfc){var _0x44fca8={};_0x44fca8[_0xf33dfc]={'$like':'%'+_0x2f3403['query'][_0x3421('0x40')]+'%'};return _0x44fca8;})});}_0x2cf7ec=_[_0x3421('0x5e')]({},_0x2cf7ec,_0x2f3403[_0x3421('0x5f')]);return _0x7cb2c8[_0x3421('0xd9')](_0x2cf7ec);}})[_0x3421('0x29')](function(_0x584163){if(_0x584163){_0x3e0100=_0x584163[_0x3421('0x4f')];if(!_0x2f3403['query'][_0x3421('0xce')](_0x3421('0xd7'))){_0x2cf7ec[_0x3421('0x26')]=qs['limit'](_0x2f3403[_0x3421('0x45')][_0x3421('0x26')]);_0x2cf7ec[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x2f3403[_0x3421('0x45')][_0x3421('0x24')]);}return _0x7cb2c8['getGroups'](_0x2cf7ec);}})[_0x3421('0x29')](function(_0x132345){if(_0x132345){return _0x132345?{'count':_0x3e0100,'rows':_0x132345}:null;}})[_0x3421('0x29')](respondWithResult(_0x2ae580,null))[_0x3421('0x1f')](handleError(_0x2ae580,null));};exports[_0x3421('0xda')]=function(_0x425b8d,_0x28b4b7){var _0x24fcf5={'raw':!![],'where':{}};var _0x4836de={};var _0x294981={'count':0x0,'rows':[]};return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x425b8d['params']['id']}})['then'](handleEntityNotFound(_0x28b4b7,null))[_0x3421('0x29')](function(_0x3af1eb){if(_0x3af1eb){_0x4836de[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xdb')][_0x3421('0x3c')]);_0x4836de[_0x3421('0x45')]=_[_0x3421('0x59')](_0x425b8d[_0x3421('0x45')]);_0x4836de[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x4836de[_0x3421('0x57')],_0x4836de[_0x3421('0x45')]);_0x24fcf5[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x4836de[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x425b8d[_0x3421('0x45')][_0x3421('0x5c')]));_0x24fcf5[_0x3421('0x4a')]=_0x24fcf5[_0x3421('0x4a')][_0x3421('0x4f')]?_0x24fcf5[_0x3421('0x4a')]:_0x4836de[_0x3421('0x57')];if(!_0x425b8d[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x24fcf5['limit']=qs[_0x3421('0x26')](_0x425b8d[_0x3421('0x45')]['limit']);_0x24fcf5[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x425b8d['query'][_0x3421('0x24')]);}_0x24fcf5[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x425b8d[_0x3421('0x45')][_0x3421('0xcb')]);_0x24fcf5[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x425b8d[_0x3421('0x45')],_0x4836de[_0x3421('0x5a')]));_0x24fcf5['where'][_0x3421('0xdc')]=_0x3af1eb['id'];if(_0x425b8d[_0x3421('0x45')]['filter']){_0x24fcf5[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x24fcf5['where'],{'$or':_[_0x3421('0x8f')](_0x24fcf5[_0x3421('0x4a')],function(_0x974094){var _0x955bcd={};_0x955bcd[_0x974094]={'$like':'%'+_0x425b8d[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x955bcd;})});}_0x24fcf5=_[_0x3421('0x5e')]({},_0x24fcf5,_0x425b8d['options']);return db[_0x3421('0xdb')][_0x3421('0x44')]({'where':_0x24fcf5[_0x3421('0x43')]})[_0x3421('0x29')](function(_0x213ebd){_0x294981['count']=_0x213ebd;if(_0x425b8d['query'][_0x3421('0x46')]){_0x24fcf5[_0x3421('0x47')]=[{'all':!![]}];}return db[_0x3421('0xdb')]['findAll'](_0x24fcf5);})[_0x3421('0x29')](function(_0x23d16d){_0x294981[_0x3421('0x4d')]=_0x23d16d;return _0x294981;});}})['then'](respondWithFilteredResult(_0x28b4b7,_0x24fcf5))[_0x3421('0x1f')](handleError(_0x28b4b7,null));};exports[_0x3421('0xdd')]=function(_0x36f447,_0x396314){var _0x41b537={'raw':!![],'where':{}};var _0x3198f8={};var _0x3a9560={'count':0x0,'rows':[]};return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x36f447['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x396314,null))[_0x3421('0x29')](function(_0x3c0496){if(_0x3c0496){_0x3198f8['model']=_[_0x3421('0x59')](db[_0x3421('0xde')][_0x3421('0x3c')]);_0x3198f8['query']=_[_0x3421('0x59')](_0x36f447['query']);_0x3198f8['filters']=_[_0x3421('0x5b')](_0x3198f8['model'],_0x3198f8[_0x3421('0x45')]);_0x41b537[_0x3421('0x4a')]=_['intersection'](_0x3198f8[_0x3421('0x57')],qs['fields'](_0x36f447[_0x3421('0x45')][_0x3421('0x5c')]));_0x41b537[_0x3421('0x4a')]=_0x41b537[_0x3421('0x4a')][_0x3421('0x4f')]?_0x41b537[_0x3421('0x4a')]:_0x3198f8[_0x3421('0x57')];if(!_0x36f447[_0x3421('0x45')]['hasOwnProperty'](_0x3421('0xd7'))){_0x41b537[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x36f447['query'][_0x3421('0x26')]);_0x41b537[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x36f447['query'][_0x3421('0x24')]);}_0x41b537[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x36f447[_0x3421('0x45')][_0x3421('0xcb')]);_0x41b537[_0x3421('0x43')]=qs['filters'](_['pick'](_0x36f447[_0x3421('0x45')],_0x3198f8[_0x3421('0x5a')]));_0x41b537['where'][_0x3421('0xdc')]=_0x3c0496['id'];if(_0x36f447[_0x3421('0x45')][_0x3421('0x40')]){_0x41b537['where']=_[_0x3421('0x5e')](_0x41b537[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x41b537[_0x3421('0x4a')],function(_0x3e0c11){var _0x5933b3={};_0x5933b3[_0x3e0c11]={'$like':'%'+_0x36f447[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x5933b3;})});}_0x41b537=_['merge']({},_0x41b537,_0x36f447[_0x3421('0x5f')]);return db[_0x3421('0xde')][_0x3421('0x44')]({'where':_0x41b537[_0x3421('0x43')]})['then'](function(_0x5dc48b){_0x3a9560[_0x3421('0x44')]=_0x5dc48b;if(_0x36f447['query'][_0x3421('0x46')]){_0x41b537[_0x3421('0x47')]=[{'all':!![]}];}return db['ScreenRecording'][_0x3421('0x4c')](_0x41b537);})[_0x3421('0x29')](function(_0x343134){_0x3a9560[_0x3421('0x4d')]=_0x343134;return _0x3a9560;});}})[_0x3421('0x29')](respondWithFilteredResult(_0x396314,_0x41b537))[_0x3421('0x1f')](handleError(_0x396314,null));};exports[_0x3421('0xdf')]=function(_0x3648b9,_0x251175){var _0x2c3d7b={};var _0x36f864={};var _0x4ed888;var _0x1b0c8b;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x3648b9[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x251175,null))[_0x3421('0x29')](function(_0x4091de){if(_0x4091de){_0x4ed888=_0x4091de;_0x36f864[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe0')]['rawAttributes']);_0x36f864[_0x3421('0x45')]=_[_0x3421('0x59')](_0x3648b9[_0x3421('0x45')]);_0x36f864[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x36f864['model'],_0x36f864[_0x3421('0x45')]);_0x2c3d7b[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x36f864[_0x3421('0x57')],qs['fields'](_0x3648b9[_0x3421('0x45')][_0x3421('0x5c')]));_0x2c3d7b[_0x3421('0x4a')]=_0x2c3d7b['attributes'][_0x3421('0x4f')]?_0x2c3d7b[_0x3421('0x4a')]:_0x36f864[_0x3421('0x57')];_0x2c3d7b['order']=qs['sort'](_0x3648b9[_0x3421('0x45')][_0x3421('0xcb')]);_0x2c3d7b[_0x3421('0x43')]=qs['filters'](_['pick'](_0x3648b9[_0x3421('0x45')],_0x36f864[_0x3421('0x5a')]));if(_0x3648b9[_0x3421('0x45')][_0x3421('0x40')]){_0x2c3d7b['where']=_['merge'](_0x2c3d7b[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x2c3d7b[_0x3421('0x4a')],function(_0x43c347){var _0x3453bf={};_0x3453bf[_0x43c347]={'$like':'%'+_0x3648b9['query'][_0x3421('0x40')]+'%'};return _0x3453bf;})});}_0x2c3d7b=_[_0x3421('0x5e')]({},_0x2c3d7b,_0x3648b9['options']);return _0x4ed888[_0x3421('0xdf')](_0x2c3d7b);}})[_0x3421('0x29')](function(_0xff9808){if(_0xff9808){_0x1b0c8b=_0xff9808[_0x3421('0x4f')];if(!_0x3648b9['query'][_0x3421('0xce')](_0x3421('0xd7'))){_0x2c3d7b[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x3648b9['query'][_0x3421('0x26')]);_0x2c3d7b[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x3648b9[_0x3421('0x45')][_0x3421('0x24')]);}return _0x4ed888[_0x3421('0xdf')](_0x2c3d7b);}})[_0x3421('0x29')](function(_0x5665bc){if(_0x5665bc){return _0x5665bc?{'count':_0x1b0c8b,'rows':_0x5665bc}:null;}})[_0x3421('0x29')](respondWithResult(_0x251175,null))[_0x3421('0x1f')](handleError(_0x251175,null));};exports[_0x3421('0xe1')]=function(_0x589252,_0x17a45){var _0x333edf={};var _0x1c2340={};var _0x278fbc;var _0x221a45;return db[_0x3421('0x3b')]['findOne']({'where':{'id':_0x589252[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x17a45,null))[_0x3421('0x29')](function(_0x525c3b){if(_0x525c3b){_0x278fbc=_0x525c3b;_0x1c2340[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe2')][_0x3421('0x3c')]);_0x1c2340[_0x3421('0x45')]=_['keys'](_0x589252[_0x3421('0x45')]);_0x1c2340[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x1c2340[_0x3421('0x57')],_0x1c2340[_0x3421('0x45')]);_0x333edf[_0x3421('0x4a')]=_['intersection'](_0x1c2340[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x589252['query'][_0x3421('0x5c')]));_0x333edf[_0x3421('0x4a')]=_0x333edf[_0x3421('0x4a')][_0x3421('0x4f')]?_0x333edf[_0x3421('0x4a')]:_0x1c2340[_0x3421('0x57')];_0x333edf[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x589252[_0x3421('0x45')]['sort']);_0x333edf[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x589252[_0x3421('0x45')],_0x1c2340['filters']));if(_0x589252['query'][_0x3421('0x40')]){_0x333edf['where']=_[_0x3421('0x5e')](_0x333edf[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x333edf[_0x3421('0x4a')],function(_0x65c5a){var _0x3bed3f={};_0x3bed3f[_0x65c5a]={'$like':'%'+_0x589252['query']['filter']+'%'};return _0x3bed3f;})});}_0x333edf=_[_0x3421('0x5e')]({},_0x333edf,_0x589252[_0x3421('0x5f')]);return _0x278fbc[_0x3421('0xe1')](_0x333edf);}})[_0x3421('0x29')](function(_0x406edc){if(_0x406edc){_0x221a45=_0x406edc['length'];if(!_0x589252['query'][_0x3421('0xce')]('nolimit')){_0x333edf[_0x3421('0x26')]=qs['limit'](_0x589252[_0x3421('0x45')][_0x3421('0x26')]);_0x333edf[_0x3421('0x24')]=qs[_0x3421('0x24')](_0x589252['query']['offset']);}return _0x278fbc[_0x3421('0xe1')](_0x333edf);}})[_0x3421('0x29')](function(_0x450520){if(_0x450520){return _0x450520?{'count':_0x221a45,'rows':_0x450520}:null;}})[_0x3421('0x29')](respondWithResult(_0x17a45,null))[_0x3421('0x1f')](handleError(_0x17a45,null));};exports[_0x3421('0xe3')]=function(_0x13aaa8,_0x32ec38){var _0x263e8a={'raw':!![],'where':{}};var _0x88455f={};var _0x10240a={'count':0x0,'rows':[]};return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x13aaa8['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x32ec38,null))[_0x3421('0x29')](function(_0xd0b831){if(_0xd0b831){_0x88455f[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe4')][_0x3421('0x3c')]);_0x88455f[_0x3421('0x45')]=_['keys'](_0x13aaa8['query']);_0x88455f['filters']=_[_0x3421('0x5b')](_0x88455f[_0x3421('0x57')],_0x88455f[_0x3421('0x45')]);_0x263e8a[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x88455f['model'],qs[_0x3421('0x5c')](_0x13aaa8[_0x3421('0x45')]['fields']));_0x263e8a['attributes']=_0x263e8a[_0x3421('0x4a')][_0x3421('0x4f')]?_0x263e8a['attributes']:_0x88455f[_0x3421('0x57')];if(!_0x13aaa8['query']['hasOwnProperty'](_0x3421('0xd7'))){_0x263e8a[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x13aaa8['query']['limit']);_0x263e8a[_0x3421('0x24')]=qs['offset'](_0x13aaa8['query'][_0x3421('0x24')]);}_0x263e8a['order']=qs[_0x3421('0xcb')](_0x13aaa8[_0x3421('0x45')][_0x3421('0xcb')]);_0x263e8a[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x13aaa8[_0x3421('0x45')],_0x88455f['filters']));_0x263e8a[_0x3421('0x43')][_0x3421('0xdc')]=_0xd0b831['id'];if(_0x13aaa8[_0x3421('0x45')][_0x3421('0x40')]){_0x263e8a[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x263e8a[_0x3421('0x43')],{'$or':_['map'](_0x263e8a[_0x3421('0x4a')],function(_0x34e2d2){var _0x1ba99b={};_0x1ba99b[_0x34e2d2]={'$like':'%'+_0x13aaa8[_0x3421('0x45')]['filter']+'%'};return _0x1ba99b;})});}_0x263e8a=_[_0x3421('0x5e')]({},_0x263e8a,_0x13aaa8[_0x3421('0x5f')]);return db[_0x3421('0xe4')][_0x3421('0x44')]({'where':_0x263e8a[_0x3421('0x43')]})[_0x3421('0x29')](function(_0x455fe9){_0x10240a[_0x3421('0x44')]=_0x455fe9;if(_0x13aaa8[_0x3421('0x45')][_0x3421('0x46')]){_0x263e8a[_0x3421('0x47')]=[{'all':!![]}];}return db['MailInteraction'][_0x3421('0x4c')](_0x263e8a);})[_0x3421('0x29')](function(_0x59bfc5){_0x10240a[_0x3421('0x4d')]=_0x59bfc5;return _0x10240a;});}})[_0x3421('0x29')](respondWithFilteredResult(_0x32ec38,_0x263e8a))[_0x3421('0x1f')](handleError(_0x32ec38,null));};exports[_0x3421('0xe5')]=function(_0x1115c2,_0x2f40d3){var _0x43897e={};var _0x2f85b3={};var _0x9433a4;var _0x56c74c;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x1115c2[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2f40d3,null))[_0x3421('0x29')](function(_0xc5ffc2){if(_0xc5ffc2){_0x9433a4=_0xc5ffc2;_0x2f85b3[_0x3421('0x57')]=_['keys'](db[_0x3421('0xe6')][_0x3421('0x3c')]);_0x2f85b3[_0x3421('0x45')]=_[_0x3421('0x59')](_0x1115c2['query']);_0x2f85b3[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x2f85b3[_0x3421('0x57')],_0x2f85b3['query']);_0x43897e[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x2f85b3[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x1115c2[_0x3421('0x45')][_0x3421('0x5c')]));_0x43897e[_0x3421('0x4a')]=_0x43897e[_0x3421('0x4a')][_0x3421('0x4f')]?_0x43897e['attributes']:_0x2f85b3[_0x3421('0x57')];_0x43897e[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x1115c2[_0x3421('0x45')][_0x3421('0xcb')]);_0x43897e[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x1115c2[_0x3421('0x45')],_0x2f85b3[_0x3421('0x5a')]));if(_0x1115c2[_0x3421('0x45')]['filter']){_0x43897e[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x43897e[_0x3421('0x43')],{'$or':_['map'](_0x43897e[_0x3421('0x4a')],function(_0xed5d92){var _0x2935f4={};_0x2935f4[_0xed5d92]={'$like':'%'+_0x1115c2['query'][_0x3421('0x40')]+'%'};return _0x2935f4;})});}_0x43897e=_['merge']({},_0x43897e,_0x1115c2[_0x3421('0x5f')]);return _0x9433a4[_0x3421('0xe5')](_0x43897e);}})[_0x3421('0x29')](function(_0x149851){if(_0x149851){_0x56c74c=_0x149851[_0x3421('0x4f')];if(!_0x1115c2[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x43897e['limit']=qs[_0x3421('0x26')](_0x1115c2[_0x3421('0x45')]['limit']);_0x43897e[_0x3421('0x24')]=qs['offset'](_0x1115c2[_0x3421('0x45')][_0x3421('0x24')]);}return _0x9433a4[_0x3421('0xe5')](_0x43897e);}})[_0x3421('0x29')](function(_0x5796f4){if(_0x5796f4){return _0x5796f4?{'count':_0x56c74c,'rows':_0x5796f4}:null;}})[_0x3421('0x29')](respondWithResult(_0x2f40d3,null))[_0x3421('0x1f')](handleError(_0x2f40d3,null));};exports['getFaxInteractions']=function(_0x597c04,_0x51d10d){var _0x441562={};var _0x130905={};var _0x15da32;var _0x2b02d9;return db['User'][_0x3421('0x9d')]({'where':{'id':_0x597c04[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x51d10d,null))['then'](function(_0x106c64){if(_0x106c64){_0x15da32=_0x106c64;_0x130905[_0x3421('0x57')]=_[_0x3421('0x59')](db[_0x3421('0xe7')]['rawAttributes']);_0x130905[_0x3421('0x45')]=_[_0x3421('0x59')](_0x597c04[_0x3421('0x45')]);_0x130905['filters']=_['intersection'](_0x130905['model'],_0x130905[_0x3421('0x45')]);_0x441562[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x130905[_0x3421('0x57')],qs['fields'](_0x597c04[_0x3421('0x45')][_0x3421('0x5c')]));_0x441562[_0x3421('0x4a')]=_0x441562[_0x3421('0x4a')][_0x3421('0x4f')]?_0x441562['attributes']:_0x130905[_0x3421('0x57')];_0x441562[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x597c04[_0x3421('0x45')][_0x3421('0xcb')]);_0x441562[_0x3421('0x43')]=qs['filters'](_[_0x3421('0xcc')](_0x597c04[_0x3421('0x45')],_0x130905[_0x3421('0x5a')]));if(_0x597c04[_0x3421('0x45')]['filter']){_0x441562[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x441562[_0x3421('0x43')],{'$or':_['map'](_0x441562[_0x3421('0x4a')],function(_0x2f61d6){var _0x3d74e9={};_0x3d74e9[_0x2f61d6]={'$like':'%'+_0x597c04[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x3d74e9;})});}_0x441562=_[_0x3421('0x5e')]({},_0x441562,_0x597c04[_0x3421('0x5f')]);return _0x15da32[_0x3421('0xe8')](_0x441562);}})[_0x3421('0x29')](function(_0x31bba3){if(_0x31bba3){_0x2b02d9=_0x31bba3['length'];if(!_0x597c04[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x441562[_0x3421('0x26')]=qs[_0x3421('0x26')](_0x597c04[_0x3421('0x45')][_0x3421('0x26')]);_0x441562[_0x3421('0x24')]=qs['offset'](_0x597c04[_0x3421('0x45')][_0x3421('0x24')]);}return _0x15da32[_0x3421('0xe8')](_0x441562);}})[_0x3421('0x29')](function(_0x24efe9){if(_0x24efe9){return _0x24efe9?{'count':_0x2b02d9,'rows':_0x24efe9}:null;}})['then'](respondWithResult(_0x51d10d,null))[_0x3421('0x1f')](handleError(_0x51d10d,null));};exports[_0x3421('0xe9')]=function(_0x33b53c,_0x132ca2){var _0x1d14dc={};var _0x263cc1={};var _0x3a3c62;var _0x2475be;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x33b53c['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x132ca2,null))[_0x3421('0x29')](function(_0x5ba499){if(_0x5ba499){_0x3a3c62=_0x5ba499;_0x263cc1[_0x3421('0x57')]=_['keys'](db[_0x3421('0xea')][_0x3421('0x3c')]);_0x263cc1[_0x3421('0x45')]=_[_0x3421('0x59')](_0x33b53c[_0x3421('0x45')]);_0x263cc1[_0x3421('0x5a')]=_['intersection'](_0x263cc1[_0x3421('0x57')],_0x263cc1[_0x3421('0x45')]);_0x1d14dc[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x263cc1[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x33b53c[_0x3421('0x45')][_0x3421('0x5c')]));_0x1d14dc[_0x3421('0x4a')]=_0x1d14dc[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1d14dc[_0x3421('0x4a')]:_0x263cc1[_0x3421('0x57')];_0x1d14dc[_0x3421('0xca')]=qs['sort'](_0x33b53c[_0x3421('0x45')][_0x3421('0xcb')]);_0x1d14dc['where']=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x33b53c[_0x3421('0x45')],_0x263cc1['filters']));if(_0x33b53c[_0x3421('0x45')][_0x3421('0x40')]){_0x1d14dc[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x1d14dc[_0x3421('0x43')],{'$or':_['map'](_0x1d14dc[_0x3421('0x4a')],function(_0x2d8418){var _0x2a896c={};_0x2a896c[_0x2d8418]={'$like':'%'+_0x33b53c['query'][_0x3421('0x40')]+'%'};return _0x2a896c;})});}_0x1d14dc=_[_0x3421('0x5e')]({},_0x1d14dc,_0x33b53c['options']);return _0x3a3c62[_0x3421('0xe9')](_0x1d14dc);}})[_0x3421('0x29')](function(_0x5e3620){if(_0x5e3620){_0x2475be=_0x5e3620[_0x3421('0x4f')];if(!_0x33b53c[_0x3421('0x45')][_0x3421('0xce')]('nolimit')){_0x1d14dc['limit']=qs[_0x3421('0x26')](_0x33b53c[_0x3421('0x45')][_0x3421('0x26')]);_0x1d14dc[_0x3421('0x24')]=qs['offset'](_0x33b53c[_0x3421('0x45')][_0x3421('0x24')]);}return _0x3a3c62[_0x3421('0xe9')](_0x1d14dc);}})[_0x3421('0x29')](function(_0x27dafe){if(_0x27dafe){return _0x27dafe?{'count':_0x2475be,'rows':_0x27dafe}:null;}})[_0x3421('0x29')](respondWithResult(_0x132ca2,null))['catch'](handleError(_0x132ca2,null));};exports[_0x3421('0xeb')]=function(_0x43ab9a,_0x137553,_0x1f2e0f){var _0x134669;var _0x50f651;var _0x37cb92;var _0xb7e827=!_[_0x3421('0x6f')](_0x43ab9a[_0x3421('0x56')]['id'])?_0x43ab9a[_0x3421('0x56')]['id']:!_[_0x3421('0x6f')](_0x43ab9a[_0x3421('0x30')]['id'])?_0x43ab9a[_0x3421('0x30')]['id']:null;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0xb7e827,'role':{'$or':[_0x3421('0x2e'),_0x3421('0x30'),_0x3421('0x32')]}},'attributes':['id',_0x3421('0x37'),_0x3421('0xec'),'mobile',_0x3421('0x2d'),_0x3421('0x6a'),_0x3421('0xa6')]})[_0x3421('0x29')](function(_0x43d25e){if(_0x43d25e){if(_0x43d25e['role']===_0x3421('0x32')){_0x134669=_0x43d25e;if(_0x43ab9a['body'][_0x3421('0xa8')]){_0x37cb92=util[_0x3421('0xb2')](_0x3421('0xed'),_0x134669[_0x43ab9a['body'][_0x3421('0xa8')]]);}else if(_0x43ab9a['body'][_0x3421('0xee')]){_0x37cb92=util[_0x3421('0xb2')](_0x3421('0xb3'),_0x43ab9a[_0x3421('0x65')][_0x3421('0xee')]);}else{_0x37cb92=util[_0x3421('0xb2')]('SIP/%s',_0x134669['name']);}socket['to'](util['format']('user:%s',_0x134669['name']))[_0x3421('0x2a')]('user:forcelogout',{'user':{'id':_0x134669['id'],'name':_0x134669[_0x3421('0x37')]},'ip':_0x43ab9a[_0x3421('0xef')][_0x3421('0xf0')]||_0x43ab9a[_0x3421('0xf1')][_0x3421('0xf2')]||_0x43ab9a['socket'][_0x3421('0xf2')]||_0x43ab9a[_0x3421('0xf1')][_0x3421('0xf3')]['remoteAddress']});return db[_0x3421('0xb5')][_0x3421('0xf4')]({'where':{'membername':_0x134669[_0x3421('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x3421('0x97'))][(_0x3421('0x98'))](_0x3421('0xf5'));}})[_0x3421('0x29')](function(){if(_0x134669){return _0x134669['getVoiceQueues']({'raw':!![]});}})[_0x3421('0x29')](function(_0x315271){if(_0x134669){if(_0x315271){_0x50f651=_0x315271;if(_0x50f651[_0x3421('0x4f')]){var _0x545aae=_0x50f651[_0x3421('0x8f')](function(_0x58d700){var _0x168fe7={'membername':_0x134669[_0x3421('0x37')],'UserId':_0x134669['id'],'queue_name':_0x58d700[_0x3421('0x37')],'VoiceQueueId':_0x58d700['id'],'interface':_0x37cb92,'paused':_0x134669[_0x3421('0xa6')]||![],'penalty':_0x58d700[_0x3421('0xf6')]||0x0};return db[_0x3421('0xb5')][_0x3421('0xf7')](_0x168fe7);});return Promise[_0x3421('0x63')](_0x545aae);}}}})[_0x3421('0x29')](function(){if(_0x134669){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x134669['name'],'exitAt':null}});}})[_0x3421('0x29')](function(_0x3bc59d){if(_0x134669){var _0xd624a=[];_0x3bc59d['forEach'](function(_0x346b5d){_0xd624a[_0x3421('0x4b')](_0x346b5d[_0x3421('0x64')]({'exitAt':moment()['format'](_0x3421('0xf9'))}));});return Promise['all'](_0xd624a);}})[_0x3421('0x29')](function(){if(_0x134669){var _0x3a4721=[];var _0x5ec79b=[];var _0x47967b=utils['getChannels']();var _0x8b8437={'membername':_0x134669['name'],'interface':_0x37cb92,'enterAt':moment()[_0x3421('0xb2')](_0x3421('0xf9')),'role':_0x134669[_0x3421('0x2d')],'internal':_0x134669[_0x3421('0x6a')]};_0x47967b[_0x3421('0xfa')](function(_0x3f7f09){_0x3a4721[_0x3421('0x4b')](_['merge']({'channel':_0x3f7f09,'type':'LOGIN','data1':_0x43ab9a[_0x3421('0x65')][_0x3421('0xfb')],'data2':_0x37cb92},_0x8b8437));if(_0x134669['loginInPause']){_0x5ec79b['push'](_[_0x3421('0x5e')]({'channel':_0x3f7f09,'type':_0x3421('0xfc'),'data1':_0x3421('0xfd')},_0x8b8437));}});return db[_0x3421('0xf8')][_0x3421('0xfe')](_0x3a4721[_0x3421('0xff')](_0x5ec79b),{'individualHooks':!![]});}})[_0x3421('0x29')](function(){if(_0x134669){return _0x134669[_0x3421('0x64')]({'online':!![],'lastLoginAt':moment()[_0x3421('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x134669[_0x3421('0xa6')]||![],'mailPause':_0x134669[_0x3421('0xa6')]||![],'chatPause':_0x134669[_0x3421('0xa6')]||![],'faxPause':_0x134669[_0x3421('0xa6')]||![],'smsPause':_0x134669[_0x3421('0xa6')]||![],'openchannelPause':_0x134669[_0x3421('0xa6')]||![],'whatsappPause':_0x134669[_0x3421('0xa6')]||![],'pauseType':_0x134669['loginInPause']?'LOGININPAUSE':null,'interface':_0x37cb92,'lastPauseAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))});}})[_0x3421('0x29')](function(_0x23985c){if(_0x43ab9a['isMiddleware']){return _0x1f2e0f();}else{return Promise[_0x3421('0x100')](_0x23985c)[_0x3421('0x29')](respondWithResult(_0x137553,null));}})['catch'](handleError(_0x137553,null));};exports['logout']=function(_0x58d613,_0x1f2018){var _0x445482;return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x58d613[_0x3421('0x56')]['id'],'role':_0x3421('0x32')},'attributes':['id','name','role']})[_0x3421('0x29')](handleEntityNotFound(_0x1f2018,null))[_0x3421('0x29')](function(_0xb8e37c){if(_0xb8e37c){_0x445482=_0xb8e37c;return db[_0x3421('0xb5')]['destroy']({'where':{'membername':_0x445482[_0x3421('0x37')]},'individualHooks':!![]});}})[_0x3421('0x29')](function(){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x445482['name'],'exitAt':null}});})[_0x3421('0x29')](function(_0x240db9){var _0x17fc8b=[];_0x240db9[_0x3421('0xfa')](function(_0x5c475c){_0x17fc8b['push'](_0x5c475c['update']({'exitAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))}));});return Promise[_0x3421('0x63')](_0x17fc8b);})[_0x3421('0x29')](function(){return _0x445482[_0x3421('0x64')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3421('0x29')](respondWithResult(_0x1f2018,null))['catch'](handleError(_0x1f2018,null));};exports[_0x3421('0x101')]=function(_0x3fbaf7,_0x305b37){var _0x2ba0b6;return db[_0x3421('0xb5')][_0x3421('0x64')]({'paused':0x1},{'where':{'UserId':_0x3fbaf7[_0x3421('0x56')]['id']},'individualHooks':!![]})[_0x3421('0x29')](function(){return db[_0x3421('0x3b')][_0x3421('0x36')]({'where':{'id':_0x3fbaf7[_0x3421('0x56')]['id'],'role':'agent'},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d'),_0x3421('0x6a'),'interface',_0x3421('0xa5')]});})['then'](handleEntityNotFound(_0x305b37,null))[_0x3421('0x29')](function(_0x6263c9){if(_0x6263c9){_0x2ba0b6=_0x6263c9;return respondWithRpcPromise(_0x3421('0x102'),_0x3421('0x101'),{'id':_0x2ba0b6['id'],'name':_0x2ba0b6[_0x3421('0x37')],'pause':!![]});}})['then'](function(){if(_0x2ba0b6){return db[_0x3421('0xf8')][_0x3421('0x4c')]({'where':{'membername':_0x2ba0b6[_0x3421('0x37')],'type':_0x3421('0xfc'),'exitAt':null}});}})[_0x3421('0x29')](function(_0x41af65){if(_0x41af65['length']){var _0x450b2e=moment()[_0x3421('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x340d4c=0x0,_0x1cc8b1=_0x41af65[_0x3421('0x4f')];_0x340d4c<_0x1cc8b1;_0x340d4c++){_0x41af65[_0x340d4c][_0x3421('0x103')]({'exitAt':_0x450b2e});}}})[_0x3421('0x29')](function(){var _0x3aa613=[];var _0x58f705=utils[_0x3421('0x104')]();_0x58f705[_0x3421('0xfa')](function(_0x1e809e){_0x3aa613[_0x3421('0x4b')]({'channel':_0x1e809e,'membername':_0x2ba0b6[_0x3421('0x37')],'interface':_['isNil'](_0x2ba0b6[_0x3421('0xa8')])?util['format'](_0x3421('0xb3'),_0x2ba0b6['name']):_0x2ba0b6[_0x3421('0xa8')],'type':_0x3421('0xfc'),'enterAt':moment()['format'](_0x3421('0xf9')),'data1':_0x3fbaf7[_0x3421('0x65')][_0x3421('0x3e')]||_0x3421('0x105'),'role':_0x2ba0b6[_0x3421('0x2d')],'internal':_0x2ba0b6[_0x3421('0x6a')]});});return db[_0x3421('0xf8')][_0x3421('0xfe')](_0x3aa613,{'individualHooks':!![]});})[_0x3421('0x29')](function(){return _0x2ba0b6[_0x3421('0x64')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3fbaf7[_0x3421('0x65')][_0x3421('0x3e')]||_0x3421('0x105'),'lastPauseAt':moment()[_0x3421('0xb2')](_0x3421('0xf9'))});})[_0x3421('0x29')](respondWithResult(_0x305b37,null))[_0x3421('0x1f')](handleError(_0x305b37,null));};exports['unpause']=function(_0x2704db,_0xc506c9){if(_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]&&!utils['isValidChannel'](_0x2704db[_0x3421('0x65')][_0x3421('0xa4')])){throw new APIBadRequestError(util['format'](_0x3421('0x106'),_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]));}return db[_0x3421('0x3b')]['find']({'where':{'id':_0x2704db[_0x3421('0x56')]['id']},'attributes':['id',_0x3421('0x37'),_0x3421('0x2d'),'internal','interface',_0x3421('0xa5'),_0x3421('0xa7'),_0x3421('0x107'),_0x3421('0x108'),_0x3421('0x109'),_0x3421('0x10a'),_0x3421('0x10b'),_0x3421('0x10c'),_0x3421('0x10d'),_0x3421('0x10e')]})[_0x3421('0x29')](function(_0x5d3142){if(!_0x5d3142){throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x2704db[_0x3421('0x56')]['id']));}return _0x5d3142[_0x3421('0x110')](_0x2704db[_0x3421('0x65')][_0x3421('0xa4')]);})[_0x3421('0x29')](respondWithResult(_0xc506c9,null))[_0x3421('0x1f')](APIHandleError(_0xc506c9));};exports[_0x3421('0x111')]=function(_0x40bb88,_0x3606ad){var _0x3058b0={};var _0x3727cc={};var _0x2180d5;var _0x4341c8;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x40bb88[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x3606ad,null))[_0x3421('0x29')](function(_0x26ebf9){if(_0x26ebf9){_0x2180d5=_0x26ebf9;_0x3727cc['model']=_[_0x3421('0x59')](db[_0x3421('0x112')][_0x3421('0x3c')]);_0x3727cc[_0x3421('0x45')]=_['keys'](_0x40bb88[_0x3421('0x45')]);_0x3727cc[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x3727cc[_0x3421('0x57')],_0x3727cc[_0x3421('0x45')]);_0x3058b0[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x3727cc['model'],qs[_0x3421('0x5c')](_0x40bb88[_0x3421('0x45')][_0x3421('0x5c')]));_0x3058b0['attributes']=_0x3058b0[_0x3421('0x4a')][_0x3421('0x4f')]?_0x3058b0[_0x3421('0x4a')]:_0x3727cc[_0x3421('0x57')];_0x3058b0[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x40bb88[_0x3421('0x45')][_0x3421('0xcb')]);_0x3058b0[_0x3421('0x43')]=qs[_0x3421('0x5a')](_[_0x3421('0xcc')](_0x40bb88['query'],_0x3727cc[_0x3421('0x5a')]));if(_0x40bb88[_0x3421('0x45')][_0x3421('0x40')]){_0x3058b0[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x3058b0[_0x3421('0x43')],{'$or':_[_0x3421('0x8f')](_0x3058b0[_0x3421('0x4a')],function(_0x5d3bb8){var _0x1c268d={};_0x1c268d[_0x5d3bb8]={'$like':'%'+_0x40bb88[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x1c268d;})});}_0x3058b0=_[_0x3421('0x5e')]({},_0x3058b0,_0x40bb88[_0x3421('0x5f')]);return _0x2180d5['getTeams'](_0x3058b0);}})['then'](function(_0x40a458){if(_0x40a458){_0x4341c8=_0x40a458[_0x3421('0x4f')];if(!_0x40bb88[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x3058b0['limit']=qs[_0x3421('0x26')](_0x40bb88[_0x3421('0x45')][_0x3421('0x26')]);_0x3058b0['offset']=qs[_0x3421('0x24')](_0x40bb88[_0x3421('0x45')][_0x3421('0x24')]);}return _0x2180d5[_0x3421('0x111')](_0x3058b0);}})[_0x3421('0x29')](function(_0x283ab1){if(_0x283ab1){return _0x283ab1?{'count':_0x4341c8,'rows':_0x283ab1}:null;}})[_0x3421('0x29')](respondWithResult(_0x3606ad,null))[_0x3421('0x1f')](handleError(_0x3606ad,null));};exports['addTeams']=function(_0x28b0d5,_0x20d2ee){var _0x1d2808=_0x28b0d5['params']['id'];var _0x204a00=_0x28b0d5[_0x3421('0x65')]?_0x28b0d5['body']['ids']:null;var _0x181c3c=[];return Promise[_0x3421('0x100')]()[_0x3421('0x29')](function(){if(!_0x204a00)throw new APIBadRequestError(_0x3421('0x113'));})['then'](function(){return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x1d2808}});})['then'](function(_0x2a82eb){if(!_0x2a82eb)throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x28b0d5[_0x3421('0x56')]['id']));return db['sequelize'][_0x3421('0x114')](function(_0x3c8d93){return _0x2a82eb[_0x3421('0x115')](_0x204a00,{'transaction':_0x3c8d93})[_0x3421('0x29')](function(){return db[_0x3421('0x112')][_0x3421('0x4c')]({'where':{'id':{'$in':_0x204a00}}});})[_0x3421('0x29')](function(_0x36498e){var _0x487a43=_['map'](_0x36498e,function(_0x28db20){return _0x28db20[_0x3421('0x116')]();});return Promise[_0x3421('0x63')](_0x487a43);})[_0x3421('0x29')](function(_0x2dd716){_0x181c3c=_[_0x3421('0x117')](_0x2dd716);var _0x2cd1ce=_['map'](_0x181c3c,function(_0x208248){return _0x208248[_0x3421('0x118')](_0x2a82eb['id'],{'transaction':_0x3c8d93});});return Promise[_0x3421('0x63')](_0x2cd1ce);})[_0x3421('0x29')](function(){if(!_0x2a82eb[_0x3421('0xa5')])return;var _0x40421c=_[_0x3421('0x40')](_0x181c3c,function(_0x5b6b46){return _0x5b6b46[_0x3421('0x119')]('channel')===_0x3421('0x11a');});var _0x3dab51=_[_0x3421('0x8f')](_0x40421c,function(_0x3f7381){return db['UserVoiceQueueRt'][_0x3421('0xf7')]({'membername':_0x2a82eb[_0x3421('0x37')],'UserId':_0x2a82eb['id'],'queue_name':_0x3f7381[_0x3421('0x37')],'VoiceQueueId':_0x3f7381['id'],'interface':_[_0x3421('0x6f')](_0x2a82eb['interface'])?util[_0x3421('0xb2')](_0x3421('0xb3'),_0x2a82eb[_0x3421('0x37')]):_0x2a82eb['interface'],'paused':_0x2a82eb[_0x3421('0xa7')]||![],'penalty':_0x2a82eb[_0x3421('0xb4')]},{'transaction':_0x3c8d93});});return Promise['all'](_0x3dab51);})[_0x3421('0x29')](function(){return db[_0x3421('0x11b')][_0x3421('0x4c')]({'where':{'teamId':{'$in':_0x204a00}}});})[_0x3421('0x29')](function(_0x21694c){var _0x139020=_['map'](_0x21694c,function(_0x476eb0){return db[_0x3421('0x11c')]['create']({'UserId':_0x2a82eb['id'],'VoicePrefixId':_0x476eb0['VoicePrefixId']},{'transaction':_0x3c8d93});});return Promise[_0x3421('0x63')](_0x139020);});});})['then'](function(){for(var _0x122abc=0x0;_0x122abc<_0x181c3c['length'];_0x122abc++){var _0x5ee7f6=_0x181c3c[_0x122abc][_0x3421('0x119')](_0x3421('0xa4'));var _0x4e5e0f=_0x5ee7f6+'QueueId';socket[_0x3421('0x2a')](_0x3421('0x30')+_0x5ee7f6+'Queue:save',{'UserId':_0x1d2808,['queueField']:_0x181c3c[_0x122abc]['id']});}})[_0x3421('0x29')](respondWithStatusCode(_0x20d2ee,null))[_0x3421('0x1f')](APIHandleError(_0x20d2ee));};exports['removeTeams']=function(_0x2c6687,_0x59e30a){var _0x37285c=_0x2c6687['params']['id'];var _0x2c661d=null;if(_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]){_0x2c661d=_[_0x3421('0x11d')](_0x2c6687[_0x3421('0x45')]['ids'])?_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]:[_0x2c6687[_0x3421('0x45')][_0x3421('0x69')]];}var _0x4f64b1=[];return Promise[_0x3421('0x100')]()['then'](function(){if(!_0x2c661d)throw new APIBadRequestError(_0x3421('0x11e'));})[_0x3421('0x29')](function(){return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x37285c}});})[_0x3421('0x29')](function(_0x1f39a7){if(!_0x1f39a7)throw new APINotFoundError(util[_0x3421('0xb2')](_0x3421('0x10f'),_0x2c6687['params']['id']));return db[_0x3421('0x71')][_0x3421('0x114')](function(_0x300548){return _0x1f39a7[_0x3421('0x11f')](_0x2c661d,{'transaction':_0x300548})[_0x3421('0x29')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2c661d}}});})['then'](function(_0x107ecb){var _0xaa3fc8=_[_0x3421('0x8f')](_0x107ecb,function(_0x4d31ff){return _0x4d31ff['getAssociatedQueues']();});return Promise['all'](_0xaa3fc8);})[_0x3421('0x29')](function(_0x2df606){_0x4f64b1=_[_0x3421('0x117')](_0x2df606);var _0x455271=_['map'](_0x4f64b1,function(_0x5b517c){return _0x5b517c[_0x3421('0x120')](_0x1f39a7['id'],{'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x455271);})[_0x3421('0x29')](function(){if(!_0x1f39a7['online'])return;var _0x1c43d2=_['filter'](_0x4f64b1,function(_0x3cf737){return _0x3cf737['getDataValue']('channel')===_0x3421('0x11a');});var _0x5d112d=_['map'](_0x1c43d2,function(_0x5253ae){return db['UserVoiceQueueRt'][_0x3421('0xf4')]({'where':{'VoiceQueueId':_0x5253ae['id'],'UserId':_0x1f39a7['id']},'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x5d112d);})['then'](function(){return db[_0x3421('0x11b')][_0x3421('0x4c')]({'where':{'teamId':{'$in':_0x2c661d}}});})[_0x3421('0x29')](function(_0x187f05){var _0x216168=_[_0x3421('0x8f')](_0x187f05,function(_0x157142){return db[_0x3421('0x11c')][_0x3421('0xf4')]({'where':{'UserId':_0x1f39a7['id'],'VoicePrefixId':_0x157142[_0x3421('0x121')]}},{'transaction':_0x300548});});return Promise[_0x3421('0x63')](_0x216168);});});})[_0x3421('0x29')](function(){for(var _0x138a77=0x0;_0x138a77<_0x4f64b1[_0x3421('0x4f')];_0x138a77++){var _0xaca304=_0x4f64b1[_0x138a77][_0x3421('0x119')](_0x3421('0xa4'));var _0x154cc8=_0xaca304+_0x3421('0xae');socket[_0x3421('0x2a')](_0x3421('0x30')+_0xaca304+_0x3421('0xb7'),{'UserId':_0x37285c,['queueField']:_0x4f64b1[_0x138a77]['id']});}})[_0x3421('0x29')](respondWithStatusCode(_0x59e30a,null))['catch'](APIHandleError(_0x59e30a));};exports[_0x3421('0x122')]=function(_0x2395ee,_0x155902){var _0x54abcd={};var _0x186fe9={};var _0x4baf70;var _0x22d474;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x2395ee[_0x3421('0x56')]['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x155902,null))[_0x3421('0x29')](function(_0x29107d){if(_0x29107d){_0x4baf70=_0x29107d;_0x186fe9[_0x3421('0x57')]=_['keys'](db[_0x3421('0xcf')][_0x3421('0x3c')]);_0x186fe9['query']=_[_0x3421('0x59')](_0x2395ee[_0x3421('0x45')]);_0x186fe9[_0x3421('0x5a')]=_[_0x3421('0x5b')](_0x186fe9[_0x3421('0x57')],_0x186fe9[_0x3421('0x45')]);_0x54abcd[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x186fe9[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x2395ee['query'][_0x3421('0x5c')]));_0x54abcd[_0x3421('0x4a')]=_0x54abcd[_0x3421('0x4a')][_0x3421('0x4f')]?_0x54abcd[_0x3421('0x4a')]:_0x186fe9['model'];_0x54abcd[_0x3421('0xca')]=qs[_0x3421('0xcb')](_0x2395ee[_0x3421('0x45')][_0x3421('0xcb')]);_0x54abcd[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x2395ee[_0x3421('0x45')],_0x186fe9[_0x3421('0x5a')]));if(_0x2395ee[_0x3421('0x45')][_0x3421('0x40')]){_0x54abcd['where']=_['merge'](_0x54abcd['where'],{'$or':_[_0x3421('0x8f')](_0x54abcd[_0x3421('0x4a')],function(_0x5f4d14){var _0x212a50={};_0x212a50[_0x5f4d14]={'$like':'%'+_0x2395ee[_0x3421('0x45')]['filter']+'%'};return _0x212a50;})});}_0x54abcd=_[_0x3421('0x5e')]({},_0x54abcd,_0x2395ee[_0x3421('0x5f')]);return _0x4baf70['getLists'](_0x54abcd);}})['then'](function(_0x640b87){if(_0x640b87){_0x22d474=_0x640b87[_0x3421('0x4f')];if(!_0x2395ee[_0x3421('0x45')][_0x3421('0xce')](_0x3421('0xd7'))){_0x54abcd[_0x3421('0x26')]=qs['limit'](_0x2395ee[_0x3421('0x45')][_0x3421('0x26')]);_0x54abcd['offset']=qs['offset'](_0x2395ee['query'][_0x3421('0x24')]);}return _0x4baf70['getLists'](_0x54abcd);}})[_0x3421('0x29')](function(_0x401d7a){if(_0x401d7a){return _0x401d7a?{'count':_0x22d474,'rows':_0x401d7a}:null;}})[_0x3421('0x29')](respondWithResult(_0x155902,null))[_0x3421('0x1f')](handleError(_0x155902,null));};exports[_0x3421('0x123')]=function(_0x31f592,_0x2a2ee9){var _0x1ac4ea={};var _0x3d982f={};var _0x2873b8;return db[_0x3421('0x3b')][_0x3421('0x9d')]({'where':{'id':_0x31f592['params']['id']}})[_0x3421('0x29')](handleEntityNotFound(_0x2a2ee9,null))[_0x3421('0x29')](function(_0x5a910b){if(_0x5a910b){_0x2873b8=_0x5a910b;_0x3d982f['model']=_['keys'](db[_0x3421('0x3b')][_0x3421('0x3c')]);_0x3d982f['query']=_[_0x3421('0x59')](_0x31f592[_0x3421('0x45')]);_0x3d982f[_0x3421('0x5a')]=_['intersection'](_0x3d982f['model'],_0x3d982f[_0x3421('0x45')]);_0x1ac4ea[_0x3421('0x4a')]=_[_0x3421('0x5b')](_0x3d982f[_0x3421('0x57')],qs[_0x3421('0x5c')](_0x31f592['query'][_0x3421('0x5c')]));_0x1ac4ea[_0x3421('0x4a')]=_0x1ac4ea[_0x3421('0x4a')][_0x3421('0x4f')]?_0x1ac4ea[_0x3421('0x4a')]:_0x3d982f[_0x3421('0x57')];_0x1ac4ea['order']=qs[_0x3421('0xcb')](_0x31f592[_0x3421('0x45')][_0x3421('0xcb')]);_0x1ac4ea[_0x3421('0x43')]=qs[_0x3421('0x5a')](_['pick'](_0x31f592[_0x3421('0x45')],_0x3d982f[_0x3421('0x5a')]));if(_0x31f592[_0x3421('0x45')][_0x3421('0x40')]){_0x1ac4ea[_0x3421('0x43')]=_[_0x3421('0x5e')](_0x1ac4ea['where'],{'$or':_[_0x3421('0x8f')](_0x1ac4ea[_0x3421('0x4a')],function(_0x45df52){var _0x4eb67a={};_0x4eb67a[_0x45df52]={'$like':'%'+_0x31f592[_0x3421('0x45')][_0x3421('0x40')]+'%'};return _0x4eb67a;})});}_0x1ac4ea[_0x3421('0x57')]=db[_0x3421('0x3b')];_0x1ac4ea['as']=_0x3421('0x31');_0x1ac4ea=_[_0x3421('0x5e')]({},_0x1ac4ea,_0x31f592['options']);return _0x2873b8[_0x3421('0x124')]({'include':[_0x1ac4ea]});}})['then'](function(_0x14280e){if(_0x14280e){var _0x25b780={},_0x2a36d8=[];for(var _0x566067=0x0;_0x566067<_0x14280e[_0x3421('0x4f')];_0x566067+=0x1){for(var _0x4e5f6e=0x0,_0x80ba5a;_0x4e5f6e<_0x14280e[_0x566067][_0x3421('0x31')][_0x3421('0x4f')];_0x4e5f6e+=0x1){_0x80ba5a=_0x14280e[_0x566067][_0x3421('0x31')][_0x4e5f6e][_0x3421('0x2c')]({'plain':!![]});_0x25b780[_0x80ba5a['id']]=_0x80ba5a;}}_0x25b780=_[_0x3421('0x125')](_0x25b780);for(var _0x3d194f=qs[_0x3421('0x24')](_0x31f592[_0x3421('0x45')][_0x3421('0x24')]);_0x3d194f<_0x25b780['length']&&_0x2a36d8[_0x3421('0x4f')]=_0x5a9036){_0x2a4154=_0x5a9036;_0xcd3f0a=0xc8;}else{_0xcd3f0a=0xce;}_0x29b8b8[_0x2651('0x1b')](_0xcd3f0a);return _0x29b8b8[_0x2651('0x22')](_0x2651('0x23'),_0x3280e7+'-'+_0x2a4154+'/'+_0x5a9036)['json'](_0x4be7a0);}return null;};}function saveUpdates(_0x2f8e94){return function(_0x1d3c58){if(_0x1d3c58){return _0x1d3c58[_0x2651('0x24')](_0x2f8e94)['then'](function(_0x1befc9){socket[_0x2651('0x25')]('userNotification:recalc:'+_0x1befc9['id'],{});return _0x1befc9;});}return null;};}function removeEntity(_0x57f6f1){return function(_0x303884){if(_0x303884){return _0x303884[_0x2651('0x26')]()[_0x2651('0x10')](function(){var _0x2793c6=_0x303884['get']({'plain':!![]});if(_0x2793c6[_0x2651('0x27')]===_0x2651('0x28'))return;var _0x33ff8e=[{'name':'Users','value':_0x2651('0x29'),'ignore':!![]},{'name':'Agents','value':_0x2651('0x2a'),'ignore':![]},{'name':_0x2651('0x2b'),'value':'telephone','ignore':![]}];var _0x2e5553=_(_0x33ff8e)['filter']('ignore')[_0x2651('0x2c')](_0x2651('0x2d'))['value']();if(_['includes'](_0x2e5553,_0x2793c6[_0x2651('0x27')])){return;}var _0x6d4f77=_[_0x2651('0x2e')](_0x33ff8e,[_0x2651('0x2d'),_0x2793c6[_0x2651('0x27')]])[_0x2651('0x2f')];return db[_0x2651('0x30')][_0x2651('0x26')]({'where':{'type':_0x6d4f77,'resourceId':_0x2793c6['id']}})['then'](function(){return _0x303884;});})[_0x2651('0x10')](function(){_0x57f6f1['status'](0xcc)[_0x2651('0x1c')]();});}};}function handleEntityNotFound(_0x536120){return function(_0x46bda1){if(!_0x46bda1){_0x536120[_0x2651('0x1a')](0x194);}return _0x46bda1;};}function handleError(_0x26ec4b,_0x25c7ed){_0x25c7ed=_0x25c7ed||0x1f4;return function(_0x54fe07){logger[_0x2651('0x16')](_0x54fe07[_0x2651('0x31')]);if(_0x54fe07[_0x2651('0x2f')]){delete _0x54fe07[_0x2651('0x2f')];}_0x26ec4b['status'](_0x25c7ed)[_0x2651('0x32')](_0x54fe07);};}exports[_0x2651('0x33')]=function(_0x4e2712,_0x5f3de0){var _0x29cccf={},_0x19b3f1={'count':0x0,'rows':[]};var _0x48636c=_(db[_0x2651('0x34')]['rawAttributes'])[_0x2651('0x2c')](function(_0x976b8e){return{'name':_0x976b8e[_0x2651('0x35')],'type':_0x976b8e['type'][_0x2651('0x36')]};})[_0x2651('0x37')](function(_0x155303){return!_[_0x2651('0x38')]([_0x2651('0x39'),_0x2651('0x3a')],_0x155303[_0x2651('0x2f')]);})[_0x2651('0x2d')]();_0x29cccf=qs[_0x2651('0x3b')](_0x48636c,_0x4e2712);var _0x772fa4={'where':_0x29cccf['where']};return db[_0x2651('0x34')][_0x2651('0x20')](_0x772fa4)['then'](function(_0x5a9524){_0x19b3f1[_0x2651('0x20')]=_0x5a9524;if(_0x4e2712[_0x2651('0x3c')][_0x2651('0x3d')]){_0x29cccf['include']=[{'all':!![]}];}if(_0x4e2712['query'][_0x2651('0x3e')]===_0x2651('0x3f')){_0x29cccf[_0x2651('0x40')]=[{'model':db[_0x2651('0x41')],'as':_0x2651('0x3e')}];}if(!_['includes'](_0x29cccf[_0x2651('0x42')],'id')){_0x29cccf[_0x2651('0x42')][_0x2651('0x43')]('id');}return db[_0x2651('0x34')][_0x2651('0x44')](_0x29cccf);})[_0x2651('0x10')](function(_0x28b46c){_0x19b3f1[_0x2651('0x45')]=_0x28b46c;if(_0x4e2712['query'][_0x2651('0x46')]===_0x2651('0x3f')){var _0x20c1cb=[];for(var _0x51a575=0x0;_0x51a575<_0x19b3f1['rows']['length'];_0x51a575++){_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x47'),_0x19b3f1['rows'][_0x51a575]['dataValues']));_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x48'),_0x19b3f1[_0x2651('0x45')][_0x51a575][_0x2651('0x49')]));_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x4a'),_0x19b3f1[_0x2651('0x45')][_0x51a575][_0x2651('0x49')]));_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x4b'),_0x19b3f1[_0x2651('0x45')][_0x51a575]['dataValues']));_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x4c'),_0x19b3f1[_0x2651('0x45')][_0x51a575][_0x2651('0x49')]));_0x20c1cb[_0x2651('0x43')](get_open_tabs(_0x2651('0x4d'),_0x19b3f1['rows'][_0x51a575][_0x2651('0x49')]));}return Promise['all'](_0x20c1cb)[_0x2651('0x10')](function(){return _0x19b3f1;});}else{return _0x19b3f1;}})[_0x2651('0x10')](respondWithFilteredResult(_0x5f3de0,_0x29cccf))[_0x2651('0x19')](handleError(_0x5f3de0,null));};exports['show']=function(_0x3a2de1,_0x1c04ae){var _0x3cf2f4={'raw':![],'where':{'id':_0x3a2de1[_0x2651('0x4e')]['id']}},_0x50849c={};_0x50849c[_0x2651('0x4f')]=_['differenceBy'](_[_0x2651('0x50')](db['User']['rawAttributes']),[_0x2651('0x39'),_0x2651('0x3a')]);_0x50849c['query']=_[_0x2651('0x50')](_0x3a2de1[_0x2651('0x3c')]);_0x50849c['filters']=_[_0x2651('0x51')](_0x50849c[_0x2651('0x4f')],_0x50849c['query']);_0x3cf2f4[_0x2651('0x42')]=_['intersection'](_0x50849c[_0x2651('0x4f')],qs[_0x2651('0x52')](_0x3a2de1[_0x2651('0x3c')]['fields']));_0x3cf2f4[_0x2651('0x42')]=_0x3cf2f4['attributes'][_0x2651('0x53')]?_0x3cf2f4['attributes']:_0x50849c['model'];if(_0x3a2de1['query'][_0x2651('0x3d')]){_0x3cf2f4[_0x2651('0x40')]=[{'all':!![]}];}if(_0x3a2de1[_0x2651('0x3c')][_0x2651('0x3e')]===_0x2651('0x3f')){_0x3cf2f4[_0x2651('0x40')]=[{'model':db[_0x2651('0x41')],'as':_0x2651('0x3e')}];}_0x3cf2f4=_[_0x2651('0x54')]({},_0x3cf2f4,_0x3a2de1[_0x2651('0x55')]);if(!_['includes'](_0x3cf2f4['attributes'],'id')){_0x3cf2f4['attributes'][_0x2651('0x43')]('id');}return db['User'][_0x2651('0x2e')](_0x3cf2f4)[_0x2651('0x10')](handleEntityNotFound(_0x1c04ae,null))[_0x2651('0x10')](function(_0x1cff11){var _0x24f668=[];values=_0x1cff11;if(_0x3a2de1[_0x2651('0x3c')][_0x2651('0x46')]==='true'){_0x24f668[_0x2651('0x43')](get_open_tabs(_0x2651('0x47'),_0x1cff11[_0x2651('0x49')]));_0x24f668[_0x2651('0x43')](get_open_tabs('sms',_0x1cff11[_0x2651('0x49')]));_0x24f668['push'](get_open_tabs(_0x2651('0x4c'),_0x1cff11[_0x2651('0x49')]));_0x24f668[_0x2651('0x43')](get_open_tabs(_0x2651('0x4d'),_0x1cff11[_0x2651('0x49')]));_0x24f668[_0x2651('0x43')](get_open_tabs(_0x2651('0x4a'),_0x1cff11[_0x2651('0x49')]));_0x24f668[_0x2651('0x43')](get_open_tabs('mail',_0x1cff11[_0x2651('0x49')]));return Promise['all'](_0x24f668);}else{return values;}})['then'](function(){return values;})[_0x2651('0x10')](respondWithResult(_0x1c04ae,null))[_0x2651('0x19')](handleError(_0x1c04ae,null));};exports[_0x2651('0x24')]=function(_0xfb5677,_0x315eab){if(_0xfb5677[_0x2651('0x56')]['id']){delete _0xfb5677[_0x2651('0x56')]['id'];}delete _0xfb5677[_0x2651('0x56')][_0x2651('0x27')];return db[_0x2651('0x34')][_0x2651('0x2e')]({'where':{'id':_0xfb5677['params']['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x315eab,null))[_0x2651('0x10')](saveUpdates(_0xfb5677['body'],null))[_0x2651('0x10')](respondWithResult(_0x315eab,null))[_0x2651('0x19')](handleError(_0x315eab,null));};exports['describe']=function(_0x54ebc7,_0x2b1231){return db['User'][_0x2651('0x57')]()[_0x2651('0x10')](respondWithResult(_0x2b1231,null))[_0x2651('0x19')](handleError(_0x2b1231,null));};exports[_0x2651('0x58')]=function(_0x30058f,_0x48c9f3){return db[_0x2651('0x34')]['find']({'where':{'id':_0x30058f[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x48c9f3,null))[_0x2651('0x10')](function(_0x1bc435){if(_0x1bc435){return _0x1bc435[_0x2651('0x58')](_0x30058f[_0x2651('0x56')][_0x2651('0x59')],_[_0x2651('0x5a')](_0x30058f[_0x2651('0x56')],[_0x2651('0x59'),'id'])||{});}})[_0x2651('0x10')](respondWithResult(_0x48c9f3,null))[_0x2651('0x19')](handleError(_0x48c9f3,null));};function validateUser(_0x5129c8){return new Promise(function(_0x1ceaf9,_0x342b9b){if(_0x5129c8['internal'])return _0x1ceaf9(_0x5129c8);return db[_0x2651('0x5b')]['findById'](0x1)[_0x2651('0x10')](function(_0xcd9ffa){if(_0xcd9ffa['securePassword'])authService[_0x2651('0x5c')](_0x5129c8[_0x2651('0x39')]);db[_0x2651('0x34')][_0x2651('0x5d')](_0x2651('0x5e'))[_0x2651('0x10')](function(_0x31af7d){if(_[_0x2651('0x5f')](_0x31af7d)){_0x5129c8['internal']=_0xcd9ffa[_0x2651('0x60')]||0x1;return;}if(_['isNil'](_0xcd9ffa[_0x2651('0x60')])||_0xcd9ffa['min_internal']===_0x31af7d){_0x5129c8[_0x2651('0x5e')]=_0x31af7d+0x1;return;}if(_0xcd9ffa[_0x2651('0x60')]>_0x31af7d){_0x5129c8[_0x2651('0x5e')]=_0xcd9ffa[_0x2651('0x60')];return;}return db[_0x2651('0x61')][_0x2651('0x3c')](_0x2651('0x62'),{'type':db[_0x2651('0x61')][_0x2651('0x63')][_0x2651('0x64')]})['then'](function(_0xfd8ff9){if(_0xfd8ff9&&_0xfd8ff9[_0x2651('0x53')]){for(var _0x18fb5b=0x0,_0x567afe=_0xfd8ff9[_0x2651('0x53')];_0x18fb5b<_0x567afe&&_['isNil'](_0x5129c8['internal']);_0x18fb5b++){if(_0xcd9ffa[_0x2651('0x60')]<=_0xfd8ff9[_0x18fb5b][_0x2651('0x65')]){_0x5129c8[_0x2651('0x5e')]=_0xfd8ff9[_0x18fb5b][_0x2651('0x65')];}else if(_0xcd9ffa[_0x2651('0x60')]>_0xfd8ff9[_0x18fb5b][_0x2651('0x65')]&&_0xcd9ffa[_0x2651('0x60')]<=_0xfd8ff9[_0x18fb5b]['to']){_0x5129c8['internal']=_0xcd9ffa[_0x2651('0x60')];}}}if(_['isNil'](_0x5129c8[_0x2651('0x5e')])){_0x5129c8[_0x2651('0x5e')]=_0x31af7d+0x1;}return _0x1ceaf9(_0x5129c8);});});})['catch'](function(_0x30f0ec){_0x342b9b(_0x30f0ec);});});}function updateUser(_0x54fdec){return new Promise(function(_0x97b54,_0x178ce3){try{if(_0x54fdec[_0x2651('0x66')]){_0x54fdec[_0x2651('0x67')]=_0x54fdec[_0x2651('0x5e')];_0x54fdec['VoiceMail']={'mailbox':_0x54fdec['internal'],'password':_0x54fdec[_0x2651('0x39')],'fullname':_0x54fdec['fullname'],'email':_0x54fdec[_0x2651('0x68')]};}if(_0x54fdec['role']===_0x2651('0x2a')){if(!_0x54fdec['permissions'])_0x54fdec['permissions']=[_0x2651('0x69'),'102',_0x2651('0x6a'),'113','110','104',_0x2651('0x6b'),_0x2651('0x6c'),_0x2651('0x6d'),_0x2651('0x6e'),_0x2651('0x6f'),_0x2651('0x70'),_0x2651('0x71'),_0x2651('0x72'),_0x2651('0x73')];}_0x97b54(_0x54fdec);}catch(_0x5514ec){_0x178ce3(_0x5514ec);}});}exports[_0x2651('0x74')]=function(_0x2bf848,_0x579b7a){if(_0x2bf848[_0x2651('0x29')][_0x2651('0x27')]===_0x2651('0x2a'))throw new Error('Unauthorized');if(_0x2bf848[_0x2651('0x56')][_0x2651('0x27')]==='user'&&_0x2bf848[_0x2651('0x29')][_0x2651('0x27')]!==_0x2651('0x28')){throw new Error(_0x2651('0x75'));}if(_0x2bf848['body']['role']===_0x2651('0x28')&&_0x2bf848[_0x2651('0x29')][_0x2651('0x27')]!==_0x2651('0x28')){throw new Error(_0x2651('0x76'));}return licenseUtil[_0x2651('0x77')]([_0x2bf848[_0x2651('0x56')]])[_0x2651('0x10')](function(){return validateUser(_0x2bf848[_0x2651('0x56')]);})['then'](function(_0x86be3e){return updateUser(_0x86be3e)['then'](function(_0x14ee15){if(_0x14ee15[_0x2651('0x27')]===_0x2651('0x28')){_0x14ee15[_0x2651('0x78')]=_0x2bf848[_0x2651('0x29')][_0x2651('0x78')];delete _0x14ee15[_0x2651('0x79')];}return _0x14ee15;});})[_0x2651('0x10')](function(_0x2e0bf1){return db['User'][_0x2651('0x74')](_0x2e0bf1,{'include':[{'model':db['VoiceMail'],'as':_0x2651('0x7a')}]});})[_0x2651('0x10')](function(_0x4371dc){if(_0x2bf848['body']['role']==='user')return _0x4371dc;if(_0x2bf848[_0x2651('0x29')][_0x2651('0x27')]!==_0x2651('0x29'))return _0x4371dc;return db[_0x2651('0x7b')][_0x2651('0x2e')]({'where':{'name':_0x4371dc[_0x2651('0x27')]===_0x2651('0x2a')?_0x2651('0x7c'):_0x2651('0x2b'),'userProfileId':_0x2bf848[_0x2651('0x29')][_0x2651('0x79')]},'raw':!![]})[_0x2651('0x10')](function(_0x390d4a){if(!_0x390d4a||_0x390d4a['autoAssociation']!=0x0)return _0x4371dc;return db[_0x2651('0x30')][_0x2651('0x74')]({'name':_0x4371dc[_0x2651('0x2f')],'resourceId':_0x4371dc['id'],'type':_0x390d4a['name'],'sectionId':_0x390d4a['id']},{})[_0x2651('0x10')](function(){return _0x4371dc;});})[_0x2651('0x19')](function(_0x87bca0){logger[_0x2651('0x16')](_0x2651('0x7d'),_0x87bca0);throw _0x87bca0;});})[_0x2651('0x10')](respondWithResult(_0x579b7a,0xc9))[_0x2651('0x19')](handleError(_0x579b7a,null));};exports[_0x2651('0x7e')]=function(_0x5acf9d,_0x3ca4f9){var _0x232229=_0x5acf9d[_0x2651('0x56')];var _0x3ba280=[];if(_0x5acf9d[_0x2651('0x29')][_0x2651('0x27')]===_0x2651('0x2a'))throw new Error(_0x2651('0x7f'));if(_[_0x2651('0x80')](_0x232229,[_0x2651('0x27'),'user'])&&_0x5acf9d[_0x2651('0x29')][_0x2651('0x27')]!==_0x2651('0x28')){throw new Error(_0x2651('0x75'));}if(_['some'](_0x232229,[_0x2651('0x27'),_0x2651('0x28')])&&_0x5acf9d['user']['role']!=='admin'){throw new Error(_0x2651('0x81'));}return licenseUtil['checkUserLimits'](_0x232229)[_0x2651('0x10')](function(){return validateUser(_0x232229[0x0]);})[_0x2651('0x10')](function(){for(var _0x2e112f=0x1;_0x2e112f<_0x232229['length'];_0x2e112f++){var _0x2196a4=_0x232229[_0x2e112f-0x1][_0x2651('0x5e')];if(!_0x232229[_0x2e112f][_0x2651('0x5e')])_0x232229[_0x2e112f][_0x2651('0x5e')]=_0x2196a4+0x1;_0x3ba280['push'](validateUser(_0x232229[_0x2e112f]));}return Promise['all'](_0x3ba280);})[_0x2651('0x10')](function(){_0x3ba280=[];for(var _0x39e00a=0x0;_0x39e00a<_0x232229[_0x2651('0x53')];_0x39e00a++){_0x3ba280[_0x2651('0x43')](updateUser(_0x232229[_0x39e00a]));}return Promise[_0x2651('0x82')](_0x3ba280);})[_0x2651('0x10')](function(){_0x3ba280=_0x232229[_0x2651('0x2c')](function(_0x31a80a){return db['User']['create'](_0x31a80a,{'include':[{'model':db[_0x2651('0x7a')],'as':'VoiceMail'}]})[_0x2651('0x10')](function(_0x3e1cd7){_0x31a80a['id']=_0x3e1cd7['id'];return _0x31a80a;});});return Promise[_0x2651('0x82')](_0x3ba280);})[_0x2651('0x10')](function(_0xfb89b1){if(_0x5acf9d[_0x2651('0x56')][_0x2651('0x27')]===_0x2651('0x29'))return _0xfb89b1;if(_0x5acf9d[_0x2651('0x29')][_0x2651('0x27')]!=='user')return _0xfb89b1;var _0x19c41f=_[_0x2651('0x80')](_0xfb89b1,function(_0x5aa8ef){return _0x5aa8ef[_0x2651('0x27')]===_0x2651('0x2a')||_0x5aa8ef[_0x2651('0x27')]===_0x2651('0x83');});if(!_0x19c41f)return _0xfb89b1;return db[_0x2651('0x7b')][_0x2651('0x44')]({'where':{'name':{'$or':['Agents',_0x2651('0x2b')]},'userProfileId':_0x5acf9d[_0x2651('0x29')][_0x2651('0x79')]},'raw':!![]})[_0x2651('0x10')](function(_0x33141a){if(_[_0x2651('0x84')](_0x33141a)||!_[_0x2651('0x80')](_0x33141a,[_0x2651('0x85'),0x0]))return _0xfb89b1;_0x3ba280=[];var _0x19a2e4=_(_0x33141a)[_0x2651('0x2c')](function(_0x2c7541){if(_0x2c7541[_0x2651('0x85')]===0x1)return;return _0x2c7541[_0x2651('0x2f')]===_0x2651('0x7c')?_0x2651('0x2a'):'telephone';})[_0x2651('0x86')]()[_0x2651('0x2d')]();for(var _0x1eaa92=0x0;_0x1eaa92<_0xfb89b1[_0x2651('0x53')];_0x1eaa92++){if(!_[_0x2651('0x38')](_0x19a2e4,_0xfb89b1[_0x1eaa92]['role']))return;var _0x4bebaf=_0xfb89b1[_0x1eaa92][_0x2651('0x27')]===_0x2651('0x2a')?'Agents':_0x2651('0x2b');_0x3ba280[_0x2651('0x43')](db[_0x2651('0x30')][_0x2651('0x74')]({'name':_0xfb89b1[_0x1eaa92][_0x2651('0x2f')],'resourceId':_0xfb89b1[_0x1eaa92]['id'],'type':_0x4bebaf,'sectionId':_[_0x2651('0x2e')](_0x33141a,['name',_0x4bebaf])['id']},{}));}return Promise[_0x2651('0x82')](_0x3ba280);});})['then'](respondWithResult(_0x3ca4f9,0xc9))[_0x2651('0x19')](handleError(_0x3ca4f9,null));};exports[_0x2651('0x87')]=function(_0x3e64a1,_0x353d4c){if(_0x3e64a1[_0x2651('0x56')]['id']){delete _0x3e64a1[_0x2651('0x56')]['id'];}return db[_0x2651('0x34')][_0x2651('0x2e')]({'where':{'id':_0x3e64a1[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](function(_0x18789b){if(!_0x18789b)return null;if(_0x18789b['id']===_0x3e64a1[_0x2651('0x29')]['id']){if(!_0x3e64a1[_0x2651('0x56')]['oldPassword']||!_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')]){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x18789b['authenticate'](_0x3e64a1[_0x2651('0x56')][_0x2651('0x8b')])){throw new db['Sequelize'][(_0x2651('0x8a'))](_0x2651('0x8c'));}if(_0x3e64a1[_0x2651('0x56')][_0x2651('0x8b')]===_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')]){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))](_0x2651('0x8d'));}}else if(_0x3e64a1[_0x2651('0x29')]['role']===_0x2651('0x28')){if(!_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')]){throw new db['Sequelize'][(_0x2651('0x8a'))](_0x2651('0x8e'));}}else if(_0x3e64a1[_0x2651('0x29')][_0x2651('0x27')]===_0x2651('0x29')){if(!_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')]){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))](_0x2651('0x8e'));}if(_0x18789b['role']!=='agent'){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))](_0x2651('0x7f'));}}else{throw new db[(_0x2651('0x89'))]['ValidationError'](_0x2651('0x7f'));}return _0x18789b;})['then'](handleEntityNotFound(_0x353d4c,null))[_0x2651('0x10')](function(_0x3d9801){return db[_0x2651('0x5b')]['findOne']({'attributes':['id',_0x2651('0x8f'),_0x2651('0x90'),'passwordHistoryLimit']})['then'](function(_0x4f91dd){if(_0x4f91dd[_0x2651('0x8f')])authService[_0x2651('0x5c')](_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')]);if(!_0x4f91dd[_0x2651('0x90')]||!_0x3d9801[_0x2651('0x91')])return _0x3d9801;authService[_0x2651('0x92')](_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')],_0x3d9801[_0x2651('0x91')],_0x4f91dd['passwordHistoryLimit']);return _0x3d9801;})[_0x2651('0x10')](saveUpdates({'password':_0x3e64a1[_0x2651('0x56')]['newPassword'],'passwordResetAt':_0x3e64a1['user']['id']==_0x3e64a1['params']['id']?moment():null,'previousPasswords':authService[_0x2651('0x93')](_0x3e64a1[_0x2651('0x56')][_0x2651('0x88')],_0x3d9801[_0x2651('0x91')])},null));})[_0x2651('0x10')](respondWithResult(_0x353d4c,null))[_0x2651('0x19')](handleError(_0x353d4c,null));};exports['addQueues']=function(_0x4633d7,_0x187ba9){var _0x19dd3c=_0x4633d7[_0x2651('0x56')][_0x2651('0x94')];return db[_0x2651('0x34')][_0x2651('0x2e')]({'where':{'id':_0x4633d7[_0x2651('0x4e')]['id']},'attributes':['id',_0x2651('0x2f'),_0x2651('0x27'),_0x2651('0x95'),_0x2651('0x96'),_0x2651('0x97'),_0x2651('0x98')]})[_0x2651('0x10')](handleEntityNotFound(_0x187ba9,null))['then'](function(_0x5adc56){if(_0x5adc56){if(!utils[_0x2651('0x99')](_0x19dd3c)){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))]('Unknown\x20channel');}return _0x5adc56[_0x2651('0x9a')+_[_0x2651('0x9b')](_0x19dd3c[_0x2651('0x9c')]())+_0x2651('0x9d')](_0x4633d7[_0x2651('0x56')][_0x2651('0x59')],{'penalty':_0x4633d7['body'][_0x2651('0x9e')]||0x0})[_0x2651('0x9f')](function(_0x230bf5){for(var _0x537358=0x0;_0x537358<_0x4633d7['body'][_0x2651('0x59')][_0x2651('0x53')];_0x537358+=0x1){var _0x35020e={'UserId':Number(_0x4633d7[_0x2651('0x4e')]['id'])};_0x35020e[_[_0x2651('0x9b')](_0x19dd3c['toLowerCase']())+_0x2651('0xa0')]=Number(_0x4633d7[_0x2651('0x56')][_0x2651('0x59')][_0x537358]);socket[_0x2651('0x25')](_0x2651('0x29')+_[_0x2651('0x9b')](_0x19dd3c[_0x2651('0x9c')]())+_0x2651('0xa1'),_0x35020e);}return _0x230bf5;})[_0x2651('0x10')](function(){if(_0x19dd3c===_0x2651('0xa2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x4633d7['body']['ids']||[]},'raw':!![],'attributes':['id',_0x2651('0x2f')]});}})[_0x2651('0x10')](function(_0x3c2d0b){var _0x1d39e0=_0x5adc56[_0x2651('0xa3')]({'plain':!![]});var _0x54667e=[];if(_0x19dd3c==='voice'&&_0x1d39e0['role']===_0x2651('0x2a')&&_0x1d39e0[_0x2651('0x95')]){for(let _0xfd4b9a=0x0;_0xfd4b9a<_0x3c2d0b[_0x2651('0x53')];_0xfd4b9a+=0x1){_0x54667e['push']({'membername':_0x1d39e0[_0x2651('0x2f')],'UserId':_0x1d39e0['id'],'queue_name':_0x3c2d0b[_0xfd4b9a][_0x2651('0x2f')],'VoiceQueueId':_0x3c2d0b[_0xfd4b9a]['id'],'interface':_['isNil'](_0x1d39e0[_0x2651('0x98')])?util[_0x2651('0xa4')](_0x2651('0xa5'),_0x1d39e0[_0x2651('0x2f')]):_0x1d39e0[_0x2651('0x98')],'paused':_0x1d39e0[_0x2651('0x97')]||![],'penalty':_0x4633d7[_0x2651('0x56')][_0x2651('0x9e')]||0x0});}return Promise[_0x2651('0x82')](_0x54667e[_0x2651('0x2c')](function(_0x150698){return db[_0x2651('0xa6')]['upsert'](_0x150698);}));}return _0x5adc56;});}})[_0x2651('0x10')](respondWithStatusCode(_0x187ba9,null))[_0x2651('0x19')](handleError(_0x187ba9,null));};exports[_0x2651('0xa7')]=function(_0xdeab4d,_0x6f9714){var _0x10e521,_0x1392ce;return db[_0x2651('0x34')]['find']({'where':{'id':_0xdeab4d['params']['id']},'attributes':['id','name','role']})[_0x2651('0x10')](handleEntityNotFound(_0x6f9714,null))[_0x2651('0x10')](function(_0xc783ee){if(_0xc783ee){_0x10e521=_0xc783ee;if(!_0xdeab4d['query'][_0x2651('0x94')]||!utils[_0x2651('0x99')](_0xdeab4d[_0x2651('0x3c')][_0x2651('0x94')])){throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))](_0x2651('0xa8'));}return _0xc783ee[_0x2651('0xa9')+_[_0x2651('0x9b')](_0xdeab4d[_0x2651('0x3c')]['channel'][_0x2651('0x9c')]())+_0x2651('0x9d')](_0xdeab4d['query'][_0x2651('0x59')]);}})['then'](function(_0x1486dc){if(_[_0x2651('0xaa')](_0xdeab4d['query'][_0x2651('0x59')])){for(var _0x5eb20c=0x0;_0x5eb20c<_0xdeab4d[_0x2651('0x3c')][_0x2651('0x59')][_0x2651('0x53')];_0x5eb20c+=0x1){_0x1392ce={'UserId':Number(_0xdeab4d[_0x2651('0x4e')]['id'])};_0x1392ce[_[_0x2651('0x9b')](_0xdeab4d[_0x2651('0x3c')][_0x2651('0x94')][_0x2651('0x9c')]())+_0x2651('0xa0')]=Number(_0xdeab4d['query']['ids'][_0x5eb20c]);socket[_0x2651('0x25')](_0x2651('0x29')+_[_0x2651('0x9b')](_0xdeab4d['query'][_0x2651('0x94')][_0x2651('0x9c')]())+_0x2651('0xab'),_0x1392ce);}}else{_0x1392ce={'UserId':Number(_0xdeab4d['params']['id'])};_0x1392ce[_[_0x2651('0x9b')](_0xdeab4d['query'][_0x2651('0x94')]['toLowerCase']())+'QueueId']=Number(_0xdeab4d[_0x2651('0x3c')][_0x2651('0x59')]);socket[_0x2651('0x25')](_0x2651('0x29')+_[_0x2651('0x9b')](_0xdeab4d[_0x2651('0x3c')][_0x2651('0x94')][_0x2651('0x9c')]())+_0x2651('0xab'),_0x1392ce);}return _0x1486dc;})[_0x2651('0x10')](function(){if(_0xdeab4d[_0x2651('0x3c')][_0x2651('0x94')]===_0x2651('0xa2')){return db[_0x2651('0xa6')][_0x2651('0x26')]({'where':{'UserId':_0xdeab4d[_0x2651('0x4e')]['id'],'VoiceQueueId':_0xdeab4d[_0x2651('0x3c')][_0x2651('0x59')]},'individualHooks':!![]})['then'](function(){return _0x10e521;});}return _0x10e521;})[_0x2651('0x10')](respondWithStatusCode(_0x6f9714,null))['catch'](handleError(_0x6f9714,null));};exports[_0x2651('0xac')]=function(_0x35fbce,_0x3e9762){_0x35fbce[_0x2651('0x56')][_0x2651('0xad')]=_0x35fbce[_0x2651('0xae')][_0x2651('0xaf')];return db[_0x2651('0x34')]['find']({'where':{'id':_0x35fbce['params']['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x3e9762,null))[_0x2651('0x10')](saveUpdates(_0x35fbce['body'],null))[_0x2651('0x10')](respondWithResult(_0x3e9762,null))[_0x2651('0x19')](handleError(_0x3e9762,null));};exports['getAvatar']=function(_0x566bde,_0x1b84e7){var _0x2ea8cc=path[_0x2651('0xb0')](config[_0x2651('0xb1')],_0x2651('0xb2'));return db['User'][_0x2651('0x2e')]({'where':{'id':_0x566bde['params']['id']},'attributes':['id',_0x2651('0xad')],'raw':!![]})[_0x2651('0x10')](handleEntityNotFound(_0x1b84e7,null))[_0x2651('0x10')](function(_0x107fe1){if(_0x107fe1){if(_['isNil'](_0x107fe1[_0x2651('0xad')])){return _0x1b84e7[_0x2651('0xb3')](_0x2ea8cc);}else{if(!fs[_0x2651('0xb4')](path[_0x2651('0xb0')](config[_0x2651('0xb1')],_0x2651('0xb5'),_0x107fe1[_0x2651('0xad')]))){return _0x1b84e7[_0x2651('0xb3')](_0x2ea8cc);}return _0x1b84e7[_0x2651('0xb3')](path[_0x2651('0xb0')](config[_0x2651('0xb1')],_0x2651('0xb5'),_0x107fe1['userpic']));}}})[_0x2651('0x19')](handleError(_0x1b84e7,null));};exports[_0x2651('0xb6')]=function(_0x572aca,_0x29cdf1){return db['User']['find']({'where':{'id':_0x572aca[_0x2651('0x4e')]['id']},'attributes':['id']})[_0x2651('0x10')](handleEntityNotFound(_0x29cdf1,null))[_0x2651('0x10')](function(_0x693333){var _0x258272=[];values=_0x693333[_0x2651('0x49')];_0x258272[_0x2651('0x43')](get_open_tabs('chat',_0x693333['dataValues']));_0x258272[_0x2651('0x43')](get_open_tabs(_0x2651('0x48'),_0x693333[_0x2651('0x49')]));_0x258272[_0x2651('0x43')](get_open_tabs('openchannel',_0x693333['dataValues']));_0x258272[_0x2651('0x43')](get_open_tabs(_0x2651('0x4d'),_0x693333[_0x2651('0x49')]));_0x258272['push'](get_open_tabs(_0x2651('0x4a'),_0x693333[_0x2651('0x49')]));_0x258272[_0x2651('0x43')](get_open_tabs(_0x2651('0x4b'),_0x693333[_0x2651('0x49')]));return Promise[_0x2651('0x82')](_0x258272);})['then'](function(_0x509467){if(_0x509467){var _0x1c9dfd=_[_0x2651('0x2c')](values[_0x2651('0xb7')],function(_0x23eaa5){return{'channel':_0x2651('0xb8'),'id':_0x23eaa5['id'],'createdAt':_0x23eaa5[_0x2651('0xb9')]};});var _0x498588=_[_0x2651('0x2c')](values[_0x2651('0xba')],function(_0x410701){return{'channel':_0x2651('0xbb'),'id':_0x410701['id'],'createdAt':_0x410701['createdAt']};});var _0x69d25e=_[_0x2651('0x2c')](values[_0x2651('0xbc')],function(_0x588deb){return{'channel':'OPENCHANNEL','id':_0x588deb['id'],'createdAt':_0x588deb['createdAt']};});var _0x18a544=_['map'](values['MailOpenTabs'],function(_0x3a10f8){return{'channel':_0x2651('0xbd'),'id':_0x3a10f8['id'],'createdAt':_0x3a10f8[_0x2651('0xb9')]};});var _0x1feea0=_[_0x2651('0x2c')](values[_0x2651('0xbe')],function(_0x1b4c01){return{'channel':_0x2651('0xbf'),'id':_0x1b4c01['id'],'createdAt':_0x1b4c01[_0x2651('0xb9')]};});var _0x51e488=_['map'](values[_0x2651('0xc0')],function(_0x2af043){return{'channel':_0x2651('0xc1'),'id':_0x2af043['id'],'createdAt':_0x2af043[_0x2651('0xb9')]};});var _0x59d17c=_[_0x2651('0xc2')](_0x1c9dfd,_0x498588,_0x69d25e,_0x18a544,_0x1feea0,_0x51e488);var _0x2a4ca0={'count':_0x59d17c['length'],'rows':_0x59d17c};return _0x2a4ca0;}else return null;})['then'](respondWithResult(_0x29cdf1,null))[_0x2651('0x19')](handleError(_0x29cdf1,null));};exports[_0x2651('0xc3')]=function(_0x57ff7a,_0x1457ee){var _0x2076e7={};var _0x219282={};var _0x5a09cd;var _0x362608;return db[_0x2651('0x34')]['findOne']({'where':{'id':_0x57ff7a['params']['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x1457ee,null))['then'](function(_0x15fe3a){if(_0x15fe3a){_0x5a09cd=_0x15fe3a;_0x219282[_0x2651('0x4f')]=_['keys'](db[_0x2651('0xc4')]['rawAttributes']);_0x219282[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x57ff7a[_0x2651('0x3c')]);_0x219282['filters']=_[_0x2651('0x51')](_0x219282['model'],_0x219282[_0x2651('0x3c')]);_0x2076e7['attributes']=_[_0x2651('0x51')](_0x219282[_0x2651('0x4f')],qs[_0x2651('0x52')](_0x57ff7a[_0x2651('0x3c')][_0x2651('0x52')]));_0x2076e7[_0x2651('0x42')]=_0x2076e7[_0x2651('0x42')][_0x2651('0x53')]?_0x2076e7[_0x2651('0x42')]:_0x219282[_0x2651('0x4f')];_0x2076e7[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x57ff7a[_0x2651('0x3c')][_0x2651('0xc6')]);_0x2076e7[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x57ff7a['query'],_0x219282['filters']));if(_0x57ff7a[_0x2651('0x3c')][_0x2651('0x37')]){_0x2076e7['where']=_[_0x2651('0x54')](_0x2076e7['where'],{'$or':_['map'](_0x2076e7[_0x2651('0x42')],function(_0x38246b){var _0x37c420={};_0x37c420[_0x38246b]={'$like':'%'+_0x57ff7a[_0x2651('0x3c')][_0x2651('0x37')]+'%'};return _0x37c420;})});}_0x2076e7=_[_0x2651('0x54')]({},_0x2076e7,_0x57ff7a[_0x2651('0x55')]);return _0x5a09cd[_0x2651('0xc3')](_0x2076e7);}})['then'](function(_0x5ef4c6){if(_0x5ef4c6){_0x362608=_0x5ef4c6[_0x2651('0x53')];if(_0x57ff7a[_0x2651('0x3c')][_0x2651('0xca')](_0x2651('0x3d'))){_0x2076e7['include']=[{'model':db[_0x2651('0xcb')],'as':_0x2651('0xcc'),'required':![]},{'model':db[_0x2651('0xcd')],'as':_0x2651('0xce'),'attributes':['id',_0x2651('0x2f'),_0x2651('0xcf')],'where':_0x57ff7a['query']['tag']?{'id':_0x57ff7a[_0x2651('0x3c')][_0x2651('0xd0')]}:undefined,'required':_0x57ff7a[_0x2651('0x3c')][_0x2651('0xd0')]?!![]:![]}];}if(!_0x57ff7a[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0x2076e7[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x57ff7a[_0x2651('0x3c')][_0x2651('0x21')]);_0x2076e7['offset']=qs[_0x2651('0x1e')](_0x57ff7a[_0x2651('0x3c')]['offset']);}return _0x5a09cd[_0x2651('0xc3')](_0x2076e7);}})[_0x2651('0x10')](function(_0x30aa3c){if(_0x30aa3c){return _0x30aa3c?{'count':_0x362608,'rows':_0x30aa3c}:null;}})[_0x2651('0x10')](respondWithResult(_0x1457ee,null))[_0x2651('0x19')](handleError(_0x1457ee,null));};exports[_0x2651('0xd1')]=function(_0x47b340,_0x857e48){var _0x432ba1;var _0xab74f4={};var _0x1386b8;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x47b340[_0x2651('0x4e')]['id']},'attributes':['id',_0x2651('0x2f'),_0x2651('0x27')]})[_0x2651('0x10')](handleEntityNotFound(_0x857e48,null))['then'](function(_0x28b906){if(!utils[_0x2651('0x99')](_0x47b340[_0x2651('0x3c')][_0x2651('0x94')])){throw new db['Sequelize'][(_0x2651('0x8a'))](_0x2651('0xa8'));}_0x432ba1=_0x28b906;var _0x4b91b6={};_0x4b91b6['model']=_[_0x2651('0x50')](db[_[_0x2651('0x9b')](_0x47b340[_0x2651('0x3c')][_0x2651('0x94')])+'Queue']['rawAttributes']);_0x4b91b6['query']=_[_0x2651('0x50')](_0x47b340[_0x2651('0x3c')]);_0x4b91b6['filters']=_[_0x2651('0x51')](_0x4b91b6[_0x2651('0x4f')],_0x4b91b6[_0x2651('0x3c')]);_0xab74f4[_0x2651('0x42')]=_['intersection'](_0x4b91b6[_0x2651('0x4f')],qs[_0x2651('0x52')](_0x47b340[_0x2651('0x3c')][_0x2651('0x52')]));_0xab74f4[_0x2651('0x42')]=_0xab74f4[_0x2651('0x42')][_0x2651('0x53')]?_0xab74f4[_0x2651('0x42')]:_0x4b91b6[_0x2651('0x4f')];_0xab74f4[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x47b340[_0x2651('0x3c')][_0x2651('0xc6')]);_0xab74f4[_0x2651('0xc7')]=qs['filters'](_[_0x2651('0xc9')](_0x47b340[_0x2651('0x3c')],_0x4b91b6[_0x2651('0xc8')]));if(_0x47b340['query'][_0x2651('0x37')]){_0xab74f4[_0x2651('0xc7')]=_[_0x2651('0x54')](_0xab74f4[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0xab74f4[_0x2651('0x42')],function(_0x2e60af){var _0x545db7={};_0x545db7[_0x2e60af]={'$like':'%'+_0x47b340['query'][_0x2651('0x37')]+'%'};return _0x545db7;})});}_0xab74f4=_[_0x2651('0x54')]({},_0xab74f4,_0x47b340[_0x2651('0x55')]);switch(_0x432ba1['role']){case _0x2651('0x28'):return db[_[_0x2651('0x9b')](_0x47b340[_0x2651('0x3c')][_0x2651('0x94')])+_0x2651('0xd3')][_0x2651('0x44')](_0xab74f4);case _0x2651('0x29'):case _0x2651('0x2a'):return _0x432ba1['get'+_[_0x2651('0x9b')](_0x47b340[_0x2651('0x3c')][_0x2651('0x94')])+_0x2651('0x9d')](_0xab74f4);default:throw new db['Sequelize'][(_0x2651('0x8a'))](_0x2651('0xd4'));}})[_0x2651('0x10')](function(_0x105487){_0x1386b8=_0x105487[_0x2651('0x53')];if(!_0x47b340[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0xab74f4[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x47b340[_0x2651('0x3c')][_0x2651('0x21')]);_0xab74f4[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x47b340[_0x2651('0x3c')][_0x2651('0x1e')]);}switch(_0x432ba1['role']){case _0x2651('0x28'):return db[_[_0x2651('0x9b')](_0x47b340[_0x2651('0x3c')][_0x2651('0x94')])+'Queue'][_0x2651('0x44')](_0xab74f4);case'user':case _0x2651('0x2a'):return _0x432ba1[_0x2651('0xa3')+_['capitalize'](_0x47b340['query'][_0x2651('0x94')])+_0x2651('0x9d')](_0xab74f4);}})[_0x2651('0x10')](function(_0x5ee172){return{'count':_0x1386b8,'rows':_0x5ee172};})[_0x2651('0x10')](respondWithResult(_0x857e48,null))[_0x2651('0x19')](handleError(_0x857e48,null));};exports[_0x2651('0xd5')]=function(_0x1184cd,_0x2b3f09){var _0x1b4ecf={};var _0x45523f={};var _0x2cb0eb;var _0x1f2512;return db['User'][_0x2651('0xd2')]({'where':{'id':_0x1184cd[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x2b3f09,null))[_0x2651('0x10')](function(_0x480c2b){if(_0x480c2b){_0x2cb0eb=_0x480c2b;_0x45523f[_0x2651('0x4f')]=_['keys'](db[_0x2651('0xa6')][_0x2651('0xd6')]);_0x45523f['query']=_['keys'](_0x1184cd['query']);_0x45523f[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x45523f[_0x2651('0x4f')],_0x45523f[_0x2651('0x3c')]);_0x1b4ecf[_0x2651('0x42')]=_[_0x2651('0x51')](_0x45523f[_0x2651('0x4f')],qs[_0x2651('0x52')](_0x1184cd[_0x2651('0x3c')][_0x2651('0x52')]));_0x1b4ecf[_0x2651('0x42')]=_0x1b4ecf[_0x2651('0x42')][_0x2651('0x53')]?_0x1b4ecf[_0x2651('0x42')]:_0x45523f[_0x2651('0x4f')];_0x1b4ecf[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x1184cd[_0x2651('0x3c')]['sort']);_0x1b4ecf[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_['pick'](_0x1184cd[_0x2651('0x3c')],_0x45523f[_0x2651('0xc8')]));if(_0x1184cd[_0x2651('0x3c')]['filter']){_0x1b4ecf['where']=_[_0x2651('0x54')](_0x1b4ecf[_0x2651('0xc7')],{'$or':_['map'](_0x1b4ecf[_0x2651('0x42')],function(_0x3b82ba){var _0x33477b={};_0x33477b[_0x3b82ba]={'$like':'%'+_0x1184cd[_0x2651('0x3c')][_0x2651('0x37')]+'%'};return _0x33477b;})});}_0x1b4ecf=_[_0x2651('0x54')]({},_0x1b4ecf,_0x1184cd[_0x2651('0x55')]);return _0x2cb0eb[_0x2651('0xd5')](_0x1b4ecf);}})[_0x2651('0x10')](function(_0x42db62){if(_0x42db62){_0x1f2512=_0x42db62[_0x2651('0x53')];if(!_0x1184cd[_0x2651('0x3c')]['hasOwnProperty'](_0x2651('0xd7'))){_0x1b4ecf[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x1184cd[_0x2651('0x3c')][_0x2651('0x21')]);_0x1b4ecf[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x1184cd[_0x2651('0x3c')][_0x2651('0x1e')]);}return _0x2cb0eb[_0x2651('0xd5')](_0x1b4ecf);}})['then'](function(_0x5a175a){if(_0x5a175a){return _0x5a175a?{'count':_0x1f2512,'rows':_0x5a175a}:null;}})['then'](respondWithResult(_0x2b3f09,null))['catch'](handleError(_0x2b3f09,null));};exports[_0x2651('0xd8')]=function(_0x1d9c03,_0x343486){var _0xe32756={};var _0x2b799d={};var _0x5dd275;var _0x57601e;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x1d9c03[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x343486,null))[_0x2651('0x10')](function(_0x2d9f98){if(_0x2d9f98){_0x5dd275=_0x2d9f98;_0x2b799d[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0xd9')][_0x2651('0xd6')]);_0x2b799d[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x1d9c03['query']);_0x2b799d[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x2b799d[_0x2651('0x4f')],_0x2b799d[_0x2651('0x3c')]);_0xe32756['attributes']=_[_0x2651('0x51')](_0x2b799d['model'],qs[_0x2651('0x52')](_0x1d9c03[_0x2651('0x3c')][_0x2651('0x52')]));_0xe32756['attributes']=_0xe32756[_0x2651('0x42')]['length']?_0xe32756[_0x2651('0x42')]:_0x2b799d['model'];_0xe32756['order']=qs[_0x2651('0xc6')](_0x1d9c03[_0x2651('0x3c')][_0x2651('0xc6')]);_0xe32756['where']=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x1d9c03['query'],_0x2b799d['filters']));if(_0x1d9c03[_0x2651('0x3c')]['filter']){_0xe32756[_0x2651('0xc7')]=_[_0x2651('0x54')](_0xe32756[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0xe32756['attributes'],function(_0x2a790d){var _0x10eb3f={};_0x10eb3f[_0x2a790d]={'$like':'%'+_0x1d9c03[_0x2651('0x3c')]['filter']+'%'};return _0x10eb3f;})});}_0xe32756=_[_0x2651('0x54')]({},_0xe32756,_0x1d9c03[_0x2651('0x55')]);return _0x5dd275[_0x2651('0xd8')](_0xe32756);}})[_0x2651('0x10')](function(_0x3343e1){if(_0x3343e1){_0x57601e=_0x3343e1[_0x2651('0x53')];if(!_0x1d9c03[_0x2651('0x3c')]['hasOwnProperty']('nolimit')){_0xe32756[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x1d9c03[_0x2651('0x3c')][_0x2651('0x21')]);_0xe32756[_0x2651('0x1e')]=qs['offset'](_0x1d9c03[_0x2651('0x3c')][_0x2651('0x1e')]);}return _0x5dd275[_0x2651('0xd8')](_0xe32756);}})[_0x2651('0x10')](function(_0x28eef3){if(_0x28eef3){return _0x28eef3?{'count':_0x57601e,'rows':_0x28eef3}:null;}})[_0x2651('0x10')](respondWithResult(_0x343486,null))[_0x2651('0x19')](handleError(_0x343486,null));};exports[_0x2651('0xda')]=function(_0x48ab77,_0x416ae9){var _0x5ed5d6={'raw':!![],'where':{}};var _0x2b53ec={};var _0x2ed1b2={'count':0x0,'rows':[]};return db[_0x2651('0x34')]['findOne']({'where':{'id':_0x48ab77[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x416ae9,null))[_0x2651('0x10')](function(_0x36e976){if(_0x36e976){_0x2b53ec[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0xdb')]['rawAttributes']);_0x2b53ec[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x48ab77[_0x2651('0x3c')]);_0x2b53ec[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x2b53ec[_0x2651('0x4f')],_0x2b53ec[_0x2651('0x3c')]);_0x5ed5d6[_0x2651('0x42')]=_['intersection'](_0x2b53ec[_0x2651('0x4f')],qs['fields'](_0x48ab77[_0x2651('0x3c')][_0x2651('0x52')]));_0x5ed5d6[_0x2651('0x42')]=_0x5ed5d6['attributes']['length']?_0x5ed5d6['attributes']:_0x2b53ec[_0x2651('0x4f')];if(!_0x48ab77[_0x2651('0x3c')][_0x2651('0xca')](_0x2651('0xd7'))){_0x5ed5d6[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x48ab77[_0x2651('0x3c')][_0x2651('0x21')]);_0x5ed5d6[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x48ab77[_0x2651('0x3c')][_0x2651('0x1e')]);}_0x5ed5d6[_0x2651('0xc5')]=qs['sort'](_0x48ab77['query']['sort']);_0x5ed5d6[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x48ab77[_0x2651('0x3c')],_0x2b53ec[_0x2651('0xc8')]));_0x5ed5d6[_0x2651('0xc7')]['UserId']=_0x36e976['id'];if(_0x48ab77['query'][_0x2651('0x37')]){_0x5ed5d6[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x5ed5d6[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0x5ed5d6['attributes'],function(_0x5ae3b8){var _0x43d35e={};_0x43d35e[_0x5ae3b8]={'$like':'%'+_0x48ab77[_0x2651('0x3c')]['filter']+'%'};return _0x43d35e;})});}_0x5ed5d6=_[_0x2651('0x54')]({},_0x5ed5d6,_0x48ab77[_0x2651('0x55')]);return db['VoiceRecording'][_0x2651('0x20')]({'where':_0x5ed5d6[_0x2651('0xc7')]})[_0x2651('0x10')](function(_0x1a21f9){_0x2ed1b2[_0x2651('0x20')]=_0x1a21f9;if(_0x48ab77['query'][_0x2651('0x3d')]){_0x5ed5d6[_0x2651('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2651('0x44')](_0x5ed5d6);})[_0x2651('0x10')](function(_0x336eff){_0x2ed1b2['rows']=_0x336eff;return _0x2ed1b2;});}})['then'](respondWithFilteredResult(_0x416ae9,_0x5ed5d6))[_0x2651('0x19')](handleError(_0x416ae9,null));};exports[_0x2651('0xdc')]=function(_0x4b432a,_0x11fafe){var _0x1b982b={'raw':!![],'where':{}};var _0x787cb5={};var _0x102b82={'count':0x0,'rows':[]};return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x4b432a[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x11fafe,null))[_0x2651('0x10')](function(_0x166439){if(_0x166439){_0x787cb5[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0xdd')]['rawAttributes']);_0x787cb5[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x4b432a['query']);_0x787cb5['filters']=_[_0x2651('0x51')](_0x787cb5['model'],_0x787cb5['query']);_0x1b982b[_0x2651('0x42')]=_[_0x2651('0x51')](_0x787cb5[_0x2651('0x4f')],qs['fields'](_0x4b432a[_0x2651('0x3c')][_0x2651('0x52')]));_0x1b982b[_0x2651('0x42')]=_0x1b982b[_0x2651('0x42')][_0x2651('0x53')]?_0x1b982b[_0x2651('0x42')]:_0x787cb5[_0x2651('0x4f')];if(!_0x4b432a[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0x1b982b['limit']=qs['limit'](_0x4b432a[_0x2651('0x3c')][_0x2651('0x21')]);_0x1b982b[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x4b432a['query'][_0x2651('0x1e')]);}_0x1b982b['order']=qs[_0x2651('0xc6')](_0x4b432a[_0x2651('0x3c')]['sort']);_0x1b982b[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_['pick'](_0x4b432a[_0x2651('0x3c')],_0x787cb5[_0x2651('0xc8')]));_0x1b982b[_0x2651('0xc7')][_0x2651('0xde')]=_0x166439['id'];if(_0x4b432a['query'][_0x2651('0x37')]){_0x1b982b[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x1b982b[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0x1b982b[_0x2651('0x42')],function(_0x1238e4){var _0x522ec1={};_0x522ec1[_0x1238e4]={'$like':'%'+_0x4b432a[_0x2651('0x3c')][_0x2651('0x37')]+'%'};return _0x522ec1;})});}_0x1b982b=_[_0x2651('0x54')]({},_0x1b982b,_0x4b432a[_0x2651('0x55')]);return db[_0x2651('0xdd')][_0x2651('0x20')]({'where':_0x1b982b['where']})['then'](function(_0x21f404){_0x102b82['count']=_0x21f404;if(_0x4b432a[_0x2651('0x3c')]['includeAll']){_0x1b982b[_0x2651('0x40')]=[{'all':!![]}];}return db[_0x2651('0xdd')][_0x2651('0x44')](_0x1b982b);})[_0x2651('0x10')](function(_0x41cad2){_0x102b82['rows']=_0x41cad2;return _0x102b82;});}})[_0x2651('0x10')](respondWithFilteredResult(_0x11fafe,_0x1b982b))[_0x2651('0x19')](handleError(_0x11fafe,null));};exports[_0x2651('0xdf')]=function(_0x50037a,_0x11ba84){var _0x9c60d6={};var _0x2f85fe={};var _0x352f59;var _0x267270;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x50037a[_0x2651('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11ba84,null))[_0x2651('0x10')](function(_0x5266ef){if(_0x5266ef){_0x352f59=_0x5266ef;_0x2f85fe[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0xe0')]['rawAttributes']);_0x2f85fe[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x50037a[_0x2651('0x3c')]);_0x2f85fe[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x2f85fe['model'],_0x2f85fe[_0x2651('0x3c')]);_0x9c60d6[_0x2651('0x42')]=_[_0x2651('0x51')](_0x2f85fe[_0x2651('0x4f')],qs['fields'](_0x50037a[_0x2651('0x3c')][_0x2651('0x52')]));_0x9c60d6[_0x2651('0x42')]=_0x9c60d6[_0x2651('0x42')]['length']?_0x9c60d6[_0x2651('0x42')]:_0x2f85fe['model'];_0x9c60d6['order']=qs[_0x2651('0xc6')](_0x50037a[_0x2651('0x3c')][_0x2651('0xc6')]);_0x9c60d6[_0x2651('0xc7')]=qs['filters'](_[_0x2651('0xc9')](_0x50037a['query'],_0x2f85fe[_0x2651('0xc8')]));if(_0x50037a[_0x2651('0x3c')][_0x2651('0x37')]){_0x9c60d6[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x9c60d6['where'],{'$or':_[_0x2651('0x2c')](_0x9c60d6[_0x2651('0x42')],function(_0xc900e0){var _0x44236b={};_0x44236b[_0xc900e0]={'$like':'%'+_0x50037a['query'][_0x2651('0x37')]+'%'};return _0x44236b;})});}_0x9c60d6=_['merge']({},_0x9c60d6,_0x50037a[_0x2651('0x55')]);return _0x352f59['getChatInteractions'](_0x9c60d6);}})['then'](function(_0x8726a8){if(_0x8726a8){_0x267270=_0x8726a8['length'];if(!_0x50037a[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0x9c60d6[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x50037a['query']['limit']);_0x9c60d6['offset']=qs[_0x2651('0x1e')](_0x50037a[_0x2651('0x3c')][_0x2651('0x1e')]);}return _0x352f59[_0x2651('0xdf')](_0x9c60d6);}})[_0x2651('0x10')](function(_0x2bec8d){if(_0x2bec8d){return _0x2bec8d?{'count':_0x267270,'rows':_0x2bec8d}:null;}})['then'](respondWithResult(_0x11ba84,null))['catch'](handleError(_0x11ba84,null));};exports[_0x2651('0xe1')]=function(_0x4264cd,_0x1b45cb){var _0x4cd473={};var _0x385c99={};var _0x4a71fb;var _0x1c6f1c;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x4264cd[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x1b45cb,null))[_0x2651('0x10')](function(_0x5e094e){if(_0x5e094e){_0x4a71fb=_0x5e094e;_0x385c99[_0x2651('0x4f')]=_['keys'](db[_0x2651('0xe2')]['rawAttributes']);_0x385c99[_0x2651('0x3c')]=_['keys'](_0x4264cd[_0x2651('0x3c')]);_0x385c99[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x385c99[_0x2651('0x4f')],_0x385c99[_0x2651('0x3c')]);_0x4cd473[_0x2651('0x42')]=_[_0x2651('0x51')](_0x385c99[_0x2651('0x4f')],qs['fields'](_0x4264cd[_0x2651('0x3c')]['fields']));_0x4cd473['attributes']=_0x4cd473['attributes'][_0x2651('0x53')]?_0x4cd473[_0x2651('0x42')]:_0x385c99['model'];_0x4cd473[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x4264cd[_0x2651('0x3c')][_0x2651('0xc6')]);_0x4cd473['where']=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x4264cd['query'],_0x385c99[_0x2651('0xc8')]));if(_0x4264cd[_0x2651('0x3c')][_0x2651('0x37')]){_0x4cd473[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x4cd473[_0x2651('0xc7')],{'$or':_['map'](_0x4cd473[_0x2651('0x42')],function(_0x58763e){var _0xdea186={};_0xdea186[_0x58763e]={'$like':'%'+_0x4264cd['query']['filter']+'%'};return _0xdea186;})});}_0x4cd473=_[_0x2651('0x54')]({},_0x4cd473,_0x4264cd[_0x2651('0x55')]);return _0x4a71fb[_0x2651('0xe1')](_0x4cd473);}})[_0x2651('0x10')](function(_0x4bca68){if(_0x4bca68){_0x1c6f1c=_0x4bca68[_0x2651('0x53')];if(!_0x4264cd['query'][_0x2651('0xca')](_0x2651('0xd7'))){_0x4cd473[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x4264cd[_0x2651('0x3c')][_0x2651('0x21')]);_0x4cd473[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x4264cd['query'][_0x2651('0x1e')]);}return _0x4a71fb[_0x2651('0xe1')](_0x4cd473);}})[_0x2651('0x10')](function(_0xfd225d){if(_0xfd225d){return _0xfd225d?{'count':_0x1c6f1c,'rows':_0xfd225d}:null;}})[_0x2651('0x10')](respondWithResult(_0x1b45cb,null))[_0x2651('0x19')](handleError(_0x1b45cb,null));};exports[_0x2651('0xe3')]=function(_0xb27669,_0x5384d6){var _0x2948dd={'raw':!![],'where':{}};var _0x1f9e55={};var _0x10e67a={'count':0x0,'rows':[]};return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0xb27669[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x5384d6,null))['then'](function(_0x1b89cf){if(_0x1b89cf){_0x1f9e55['model']=_[_0x2651('0x50')](db[_0x2651('0xe4')]['rawAttributes']);_0x1f9e55['query']=_[_0x2651('0x50')](_0xb27669[_0x2651('0x3c')]);_0x1f9e55['filters']=_[_0x2651('0x51')](_0x1f9e55[_0x2651('0x4f')],_0x1f9e55[_0x2651('0x3c')]);_0x2948dd[_0x2651('0x42')]=_[_0x2651('0x51')](_0x1f9e55[_0x2651('0x4f')],qs['fields'](_0xb27669[_0x2651('0x3c')][_0x2651('0x52')]));_0x2948dd[_0x2651('0x42')]=_0x2948dd[_0x2651('0x42')][_0x2651('0x53')]?_0x2948dd[_0x2651('0x42')]:_0x1f9e55['model'];if(!_0xb27669[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0x2948dd[_0x2651('0x21')]=qs[_0x2651('0x21')](_0xb27669['query'][_0x2651('0x21')]);_0x2948dd['offset']=qs[_0x2651('0x1e')](_0xb27669[_0x2651('0x3c')][_0x2651('0x1e')]);}_0x2948dd[_0x2651('0xc5')]=qs['sort'](_0xb27669[_0x2651('0x3c')][_0x2651('0xc6')]);_0x2948dd['where']=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0xb27669['query'],_0x1f9e55[_0x2651('0xc8')]));_0x2948dd[_0x2651('0xc7')][_0x2651('0xde')]=_0x1b89cf['id'];if(_0xb27669[_0x2651('0x3c')][_0x2651('0x37')]){_0x2948dd[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x2948dd[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0x2948dd[_0x2651('0x42')],function(_0x2d7eb9){var _0x6c4025={};_0x6c4025[_0x2d7eb9]={'$like':'%'+_0xb27669[_0x2651('0x3c')]['filter']+'%'};return _0x6c4025;})});}_0x2948dd=_[_0x2651('0x54')]({},_0x2948dd,_0xb27669[_0x2651('0x55')]);return db[_0x2651('0xe4')][_0x2651('0x20')]({'where':_0x2948dd[_0x2651('0xc7')]})[_0x2651('0x10')](function(_0x21a6a3){_0x10e67a[_0x2651('0x20')]=_0x21a6a3;if(_0xb27669['query'][_0x2651('0x3d')]){_0x2948dd[_0x2651('0x40')]=[{'all':!![]}];}return db['MailInteraction'][_0x2651('0x44')](_0x2948dd);})[_0x2651('0x10')](function(_0x254b17){_0x10e67a[_0x2651('0x45')]=_0x254b17;return _0x10e67a;});}})[_0x2651('0x10')](respondWithFilteredResult(_0x5384d6,_0x2948dd))['catch'](handleError(_0x5384d6,null));};exports[_0x2651('0xe5')]=function(_0x5b2f24,_0x168d9d){var _0x79b4d5={};var _0x3bee89={};var _0x5a1a93;var _0x36c585;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x5b2f24['params']['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x168d9d,null))[_0x2651('0x10')](function(_0x205600){if(_0x205600){_0x5a1a93=_0x205600;_0x3bee89[_0x2651('0x4f')]=_['keys'](db['SmsInteraction'][_0x2651('0xd6')]);_0x3bee89[_0x2651('0x3c')]=_['keys'](_0x5b2f24[_0x2651('0x3c')]);_0x3bee89[_0x2651('0xc8')]=_['intersection'](_0x3bee89[_0x2651('0x4f')],_0x3bee89[_0x2651('0x3c')]);_0x79b4d5[_0x2651('0x42')]=_[_0x2651('0x51')](_0x3bee89[_0x2651('0x4f')],qs['fields'](_0x5b2f24[_0x2651('0x3c')][_0x2651('0x52')]));_0x79b4d5[_0x2651('0x42')]=_0x79b4d5[_0x2651('0x42')][_0x2651('0x53')]?_0x79b4d5[_0x2651('0x42')]:_0x3bee89[_0x2651('0x4f')];_0x79b4d5[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x5b2f24[_0x2651('0x3c')][_0x2651('0xc6')]);_0x79b4d5['where']=qs['filters'](_['pick'](_0x5b2f24[_0x2651('0x3c')],_0x3bee89[_0x2651('0xc8')]));if(_0x5b2f24[_0x2651('0x3c')][_0x2651('0x37')]){_0x79b4d5[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x79b4d5[_0x2651('0xc7')],{'$or':_['map'](_0x79b4d5['attributes'],function(_0x4526e8){var _0x4b924d={};_0x4b924d[_0x4526e8]={'$like':'%'+_0x5b2f24[_0x2651('0x3c')][_0x2651('0x37')]+'%'};return _0x4b924d;})});}_0x79b4d5=_[_0x2651('0x54')]({},_0x79b4d5,_0x5b2f24[_0x2651('0x55')]);return _0x5a1a93[_0x2651('0xe5')](_0x79b4d5);}})[_0x2651('0x10')](function(_0x305109){if(_0x305109){_0x36c585=_0x305109[_0x2651('0x53')];if(!_0x5b2f24['query']['hasOwnProperty'](_0x2651('0xd7'))){_0x79b4d5['limit']=qs[_0x2651('0x21')](_0x5b2f24[_0x2651('0x3c')][_0x2651('0x21')]);_0x79b4d5[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x5b2f24[_0x2651('0x3c')][_0x2651('0x1e')]);}return _0x5a1a93[_0x2651('0xe5')](_0x79b4d5);}})['then'](function(_0x2882db){if(_0x2882db){return _0x2882db?{'count':_0x36c585,'rows':_0x2882db}:null;}})[_0x2651('0x10')](respondWithResult(_0x168d9d,null))[_0x2651('0x19')](handleError(_0x168d9d,null));};exports[_0x2651('0xe6')]=function(_0x4df6b0,_0x3b746f){var _0xba5989={};var _0x4986a0={};var _0x1e2e62;var _0x125fd8;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x4df6b0[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x3b746f,null))[_0x2651('0x10')](function(_0x56c35e){if(_0x56c35e){_0x1e2e62=_0x56c35e;_0x4986a0[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0xe7')][_0x2651('0xd6')]);_0x4986a0[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x4df6b0['query']);_0x4986a0['filters']=_[_0x2651('0x51')](_0x4986a0['model'],_0x4986a0['query']);_0xba5989[_0x2651('0x42')]=_['intersection'](_0x4986a0['model'],qs[_0x2651('0x52')](_0x4df6b0[_0x2651('0x3c')]['fields']));_0xba5989['attributes']=_0xba5989[_0x2651('0x42')]['length']?_0xba5989[_0x2651('0x42')]:_0x4986a0['model'];_0xba5989[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x4df6b0[_0x2651('0x3c')][_0x2651('0xc6')]);_0xba5989[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x4df6b0['query'],_0x4986a0[_0x2651('0xc8')]));if(_0x4df6b0[_0x2651('0x3c')][_0x2651('0x37')]){_0xba5989[_0x2651('0xc7')]=_[_0x2651('0x54')](_0xba5989[_0x2651('0xc7')],{'$or':_['map'](_0xba5989[_0x2651('0x42')],function(_0x492248){var _0x1d5178={};_0x1d5178[_0x492248]={'$like':'%'+_0x4df6b0['query'][_0x2651('0x37')]+'%'};return _0x1d5178;})});}_0xba5989=_[_0x2651('0x54')]({},_0xba5989,_0x4df6b0[_0x2651('0x55')]);return _0x1e2e62[_0x2651('0xe6')](_0xba5989);}})[_0x2651('0x10')](function(_0x577446){if(_0x577446){_0x125fd8=_0x577446[_0x2651('0x53')];if(!_0x4df6b0[_0x2651('0x3c')][_0x2651('0xca')](_0x2651('0xd7'))){_0xba5989[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x4df6b0['query']['limit']);_0xba5989[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x4df6b0['query'][_0x2651('0x1e')]);}return _0x1e2e62['getFaxInteractions'](_0xba5989);}})['then'](function(_0x5bc179){if(_0x5bc179){return _0x5bc179?{'count':_0x125fd8,'rows':_0x5bc179}:null;}})[_0x2651('0x10')](respondWithResult(_0x3b746f,null))[_0x2651('0x19')](handleError(_0x3b746f,null));};exports[_0x2651('0xe8')]=function(_0x246bd1,_0x250646){var _0x4dc5b6={};var _0x1f3a30={};var _0x3620c5;var _0x4992d2;return db['User'][_0x2651('0xd2')]({'where':{'id':_0x246bd1[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x250646,null))[_0x2651('0x10')](function(_0x2cfbeb){if(_0x2cfbeb){_0x3620c5=_0x2cfbeb;_0x1f3a30['model']=_[_0x2651('0x50')](db[_0x2651('0xe9')][_0x2651('0xd6')]);_0x1f3a30[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x246bd1[_0x2651('0x3c')]);_0x1f3a30[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x1f3a30[_0x2651('0x4f')],_0x1f3a30[_0x2651('0x3c')]);_0x4dc5b6[_0x2651('0x42')]=_[_0x2651('0x51')](_0x1f3a30[_0x2651('0x4f')],qs['fields'](_0x246bd1[_0x2651('0x3c')][_0x2651('0x52')]));_0x4dc5b6[_0x2651('0x42')]=_0x4dc5b6[_0x2651('0x42')][_0x2651('0x53')]?_0x4dc5b6[_0x2651('0x42')]:_0x1f3a30[_0x2651('0x4f')];_0x4dc5b6[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x246bd1[_0x2651('0x3c')][_0x2651('0xc6')]);_0x4dc5b6['where']=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x246bd1[_0x2651('0x3c')],_0x1f3a30[_0x2651('0xc8')]));if(_0x246bd1['query'][_0x2651('0x37')]){_0x4dc5b6[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x4dc5b6[_0x2651('0xc7')],{'$or':_['map'](_0x4dc5b6['attributes'],function(_0x5675a1){var _0x3a1b52={};_0x3a1b52[_0x5675a1]={'$like':'%'+_0x246bd1[_0x2651('0x3c')]['filter']+'%'};return _0x3a1b52;})});}_0x4dc5b6=_[_0x2651('0x54')]({},_0x4dc5b6,_0x246bd1['options']);return _0x3620c5[_0x2651('0xe8')](_0x4dc5b6);}})['then'](function(_0x7b5d54){if(_0x7b5d54){_0x4992d2=_0x7b5d54['length'];if(!_0x246bd1[_0x2651('0x3c')][_0x2651('0xca')](_0x2651('0xd7'))){_0x4dc5b6['limit']=qs[_0x2651('0x21')](_0x246bd1[_0x2651('0x3c')][_0x2651('0x21')]);_0x4dc5b6[_0x2651('0x1e')]=qs['offset'](_0x246bd1[_0x2651('0x3c')]['offset']);}return _0x3620c5[_0x2651('0xe8')](_0x4dc5b6);}})[_0x2651('0x10')](function(_0x500c17){if(_0x500c17){return _0x500c17?{'count':_0x4992d2,'rows':_0x500c17}:null;}})[_0x2651('0x10')](respondWithResult(_0x250646,null))[_0x2651('0x19')](handleError(_0x250646,null));};exports[_0x2651('0xea')]=function(_0x391168,_0x11a07b,_0x47d335){var _0xd41d59;var _0x5b092b;var _0x53a529;var _0x4627a9=!_[_0x2651('0x5f')](_0x391168[_0x2651('0x4e')]['id'])?_0x391168[_0x2651('0x4e')]['id']:!_[_0x2651('0x5f')](_0x391168['user']['id'])?_0x391168[_0x2651('0x29')]['id']:null;return db['User'][_0x2651('0x2e')]({'where':{'id':_0x4627a9,'role':{'$or':[_0x2651('0x28'),_0x2651('0x29'),_0x2651('0x2a')]}},'attributes':['id',_0x2651('0x2f'),'phone','mobile',_0x2651('0x27'),_0x2651('0x5e'),_0x2651('0x96')]})[_0x2651('0x10')](function(_0xa1e760){if(_0xa1e760){if(_0xa1e760[_0x2651('0x27')]===_0x2651('0x2a')){_0xd41d59=_0xa1e760;if(_0x391168[_0x2651('0x56')][_0x2651('0x98')]){_0x53a529=util[_0x2651('0xa4')](_0x2651('0xeb'),_0xd41d59[_0x391168[_0x2651('0x56')][_0x2651('0x98')]]);}else if(_0x391168[_0x2651('0x56')]['intrf']){_0x53a529=util[_0x2651('0xa4')](_0x2651('0xa5'),_0x391168[_0x2651('0x56')][_0x2651('0xec')]);}else{_0x53a529=util[_0x2651('0xa4')](_0x2651('0xa5'),_0xd41d59[_0x2651('0x2f')]);}socket['to'](util['format']('user:%s',_0xd41d59[_0x2651('0x2f')]))[_0x2651('0x25')](_0x2651('0xed'),{'user':{'id':_0xd41d59['id'],'name':_0xd41d59['name']},'ip':_0x391168[_0x2651('0xee')]['x-forwarded-for']||_0x391168[_0x2651('0xef')][_0x2651('0xf0')]||_0x391168[_0x2651('0xf1')][_0x2651('0xf0')]||_0x391168[_0x2651('0xef')]['socket'][_0x2651('0xf0')]});return db[_0x2651('0xa6')][_0x2651('0x26')]({'where':{'membername':_0xd41d59[_0x2651('0x2f')]},'individualHooks':!![]});}}else{throw new db[(_0x2651('0x89'))][(_0x2651('0x8a'))](_0x2651('0xf2'));}})[_0x2651('0x10')](function(){if(_0xd41d59){return _0xd41d59[_0x2651('0xf3')]({'raw':!![]});}})['then'](function(_0x2f9174){if(_0xd41d59){if(_0x2f9174){_0x5b092b=_0x2f9174;if(_0x5b092b['length']){var _0x28104b=_0x5b092b[_0x2651('0x2c')](function(_0xce0657){var _0x5d62a1={'membername':_0xd41d59[_0x2651('0x2f')],'UserId':_0xd41d59['id'],'queue_name':_0xce0657[_0x2651('0x2f')],'VoiceQueueId':_0xce0657['id'],'interface':_0x53a529,'paused':_0xd41d59[_0x2651('0x96')]||![],'penalty':_0xce0657[_0x2651('0xf4')]||0x0};return db[_0x2651('0xa6')][_0x2651('0xf5')](_0x5d62a1);});return Promise[_0x2651('0x82')](_0x28104b);}}}})[_0x2651('0x10')](function(){if(_0xd41d59){return db[_0x2651('0xf6')][_0x2651('0x44')]({'where':{'membername':_0xd41d59[_0x2651('0x2f')],'exitAt':null}});}})[_0x2651('0x10')](function(_0x18c886){if(_0xd41d59){var _0x196b11=[];_0x18c886[_0x2651('0xf7')](function(_0x19cdc0){_0x196b11[_0x2651('0x43')](_0x19cdc0['update']({'exitAt':moment()[_0x2651('0xa4')](_0x2651('0xf8'))}));});return Promise[_0x2651('0x82')](_0x196b11);}})[_0x2651('0x10')](function(){if(_0xd41d59){var _0x422eef=[];var _0x3ff537=[];var _0x1a84f2=utils['getChannels']();var _0x98dd49={'membername':_0xd41d59['name'],'interface':_0x53a529,'enterAt':moment()[_0x2651('0xa4')](_0x2651('0xf8')),'role':_0xd41d59[_0x2651('0x27')],'internal':_0xd41d59[_0x2651('0x5e')]};_0x1a84f2['forEach'](function(_0x3b9987){_0x422eef[_0x2651('0x43')](_[_0x2651('0x54')]({'channel':_0x3b9987,'type':'LOGIN','data1':_0x391168[_0x2651('0x56')][_0x2651('0xf9')],'data2':_0x53a529},_0x98dd49));if(_0xd41d59['loginInPause']){_0x3ff537['push'](_[_0x2651('0x54')]({'channel':_0x3b9987,'type':_0x2651('0xfa'),'data1':_0x2651('0xfb')},_0x98dd49));}});return db['MemberReport']['bulkCreate'](_0x422eef[_0x2651('0xc2')](_0x3ff537),{'individualHooks':!![]});}})[_0x2651('0x10')](function(){if(_0xd41d59){return _0xd41d59[_0x2651('0x24')]({'online':!![],'lastLoginAt':moment()[_0x2651('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xd41d59[_0x2651('0x96')]||![],'mailPause':_0xd41d59[_0x2651('0x96')]||![],'chatPause':_0xd41d59['loginInPause']||![],'faxPause':_0xd41d59[_0x2651('0x96')]||![],'smsPause':_0xd41d59[_0x2651('0x96')]||![],'openchannelPause':_0xd41d59[_0x2651('0x96')]||![],'whatsappPause':_0xd41d59[_0x2651('0x96')]||![],'pauseType':_0xd41d59['loginInPause']?_0x2651('0xfb'):null,'interface':_0x53a529,'lastPauseAt':moment()[_0x2651('0xa4')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x3f86c4){if(_0x391168['isMiddleware']){return _0x47d335();}else{return Promise[_0x2651('0xfc')](_0x3f86c4)[_0x2651('0x10')](respondWithResult(_0x11a07b,null));}})[_0x2651('0x19')](handleError(_0x11a07b,null));};exports['logout']=function(_0xf85fee,_0x384b53){var _0x43e3b2;return db[_0x2651('0x34')][_0x2651('0x2e')]({'where':{'id':_0xf85fee[_0x2651('0x4e')]['id'],'role':_0x2651('0x2a')},'attributes':['id','name',_0x2651('0x27')]})[_0x2651('0x10')](handleEntityNotFound(_0x384b53,null))[_0x2651('0x10')](function(_0x59aa22){if(_0x59aa22){_0x43e3b2=_0x59aa22;return db[_0x2651('0xa6')][_0x2651('0x26')]({'where':{'membername':_0x43e3b2[_0x2651('0x2f')]},'individualHooks':!![]});}})[_0x2651('0x10')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x43e3b2[_0x2651('0x2f')],'exitAt':null}});})[_0x2651('0x10')](function(_0x585f97){var _0x177b90=[];_0x585f97[_0x2651('0xf7')](function(_0x53861f){_0x177b90[_0x2651('0x43')](_0x53861f[_0x2651('0x24')]({'exitAt':moment()['format'](_0x2651('0xf8'))}));});return Promise[_0x2651('0x82')](_0x177b90);})[_0x2651('0x10')](function(){return _0x43e3b2[_0x2651('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2651('0x10')](respondWithResult(_0x384b53,null))[_0x2651('0x19')](handleError(_0x384b53,null));};exports[_0x2651('0xfd')]=function(_0x3e4d35,_0x2b9027){var _0x5e3408;return db[_0x2651('0xa6')]['update']({'paused':0x1},{'where':{'UserId':_0x3e4d35[_0x2651('0x4e')]['id']},'individualHooks':!![]})[_0x2651('0x10')](function(){return db[_0x2651('0x34')]['find']({'where':{'id':_0x3e4d35['params']['id'],'role':'agent'},'attributes':['id',_0x2651('0x2f'),_0x2651('0x27'),_0x2651('0x5e'),_0x2651('0x98'),_0x2651('0x95')]});})[_0x2651('0x10')](handleEntityNotFound(_0x2b9027,null))[_0x2651('0x10')](function(_0x4c53bb){if(_0x4c53bb){_0x5e3408=_0x4c53bb;return respondWithRpcPromise(_0x2651('0xfe'),_0x2651('0xfd'),{'id':_0x5e3408['id'],'name':_0x5e3408['name'],'pause':!![]});}})[_0x2651('0x10')](function(){if(_0x5e3408){return db[_0x2651('0xf6')][_0x2651('0x44')]({'where':{'membername':_0x5e3408['name'],'type':_0x2651('0xfa'),'exitAt':null}});}})[_0x2651('0x10')](function(_0x3adc74){if(_0x3adc74[_0x2651('0x53')]){var _0x114ace=moment()[_0x2651('0xa4')](_0x2651('0xf8'));for(var _0x2e6513=0x0,_0x997a37=_0x3adc74[_0x2651('0x53')];_0x2e6513<_0x997a37;_0x2e6513++){_0x3adc74[_0x2e6513][_0x2651('0xff')]({'exitAt':_0x114ace});}}})[_0x2651('0x10')](function(){var _0x4eb622=[];var _0x49286b=utils[_0x2651('0x100')]();_0x49286b['forEach'](function(_0x4a76cf){_0x4eb622[_0x2651('0x43')]({'channel':_0x4a76cf,'membername':_0x5e3408[_0x2651('0x2f')],'interface':_[_0x2651('0x5f')](_0x5e3408['interface'])?util[_0x2651('0xa4')](_0x2651('0xa5'),_0x5e3408['name']):_0x5e3408[_0x2651('0x98')],'type':_0x2651('0xfa'),'enterAt':moment()[_0x2651('0xa4')](_0x2651('0xf8')),'data1':_0x3e4d35[_0x2651('0x56')][_0x2651('0x101')]||_0x2651('0x102'),'role':_0x5e3408['role'],'internal':_0x5e3408[_0x2651('0x5e')]});});return db[_0x2651('0xf6')][_0x2651('0x7e')](_0x4eb622,{'individualHooks':!![]});})['then'](function(){return _0x5e3408['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3e4d35[_0x2651('0x56')]['type']||_0x2651('0x102'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2651('0x10')](respondWithResult(_0x2b9027,null))[_0x2651('0x19')](handleError(_0x2b9027,null));};exports[_0x2651('0x103')]=function(_0x49545e,_0x21934c){if(_0x49545e[_0x2651('0x56')][_0x2651('0x94')]&&!utils[_0x2651('0x99')](_0x49545e[_0x2651('0x56')][_0x2651('0x94')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x49545e[_0x2651('0x56')]['channel']));}return db[_0x2651('0x34')][_0x2651('0x2e')]({'where':{'id':_0x49545e[_0x2651('0x4e')]['id']},'attributes':['id',_0x2651('0x2f'),'role',_0x2651('0x5e'),'interface',_0x2651('0x95'),_0x2651('0x97'),_0x2651('0x104'),'chatPause',_0x2651('0x105'),'openchannelPause','smsPause',_0x2651('0x106'),'pauseType',_0x2651('0x107')]})[_0x2651('0x10')](function(_0xc3b524){if(!_0xc3b524){throw new APINotFoundError(util[_0x2651('0xa4')](_0x2651('0x108'),_0x49545e[_0x2651('0x4e')]['id']));}return _0xc3b524['unpause'](_0x49545e[_0x2651('0x56')][_0x2651('0x94')]);})[_0x2651('0x10')](respondWithResult(_0x21934c,null))[_0x2651('0x19')](APIHandleError(_0x21934c));};exports[_0x2651('0x109')]=function(_0x285002,_0x18cd5f){var _0xb23bf7={};var _0x14d7ba={};var _0x48ad36;var _0x25c42a;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x285002[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x18cd5f,null))[_0x2651('0x10')](function(_0x209a45){if(_0x209a45){_0x48ad36=_0x209a45;_0x14d7ba[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0x10a')][_0x2651('0xd6')]);_0x14d7ba[_0x2651('0x3c')]=_['keys'](_0x285002['query']);_0x14d7ba[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x14d7ba[_0x2651('0x4f')],_0x14d7ba[_0x2651('0x3c')]);_0xb23bf7[_0x2651('0x42')]=_[_0x2651('0x51')](_0x14d7ba[_0x2651('0x4f')],qs['fields'](_0x285002[_0x2651('0x3c')]['fields']));_0xb23bf7[_0x2651('0x42')]=_0xb23bf7[_0x2651('0x42')][_0x2651('0x53')]?_0xb23bf7[_0x2651('0x42')]:_0x14d7ba[_0x2651('0x4f')];_0xb23bf7[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x285002[_0x2651('0x3c')][_0x2651('0xc6')]);_0xb23bf7[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_['pick'](_0x285002['query'],_0x14d7ba[_0x2651('0xc8')]));if(_0x285002[_0x2651('0x3c')][_0x2651('0x37')]){_0xb23bf7[_0x2651('0xc7')]=_[_0x2651('0x54')](_0xb23bf7[_0x2651('0xc7')],{'$or':_['map'](_0xb23bf7['attributes'],function(_0x166dc6){var _0x3db146={};_0x3db146[_0x166dc6]={'$like':'%'+_0x285002['query'][_0x2651('0x37')]+'%'};return _0x3db146;})});}_0xb23bf7=_[_0x2651('0x54')]({},_0xb23bf7,_0x285002['options']);return _0x48ad36[_0x2651('0x109')](_0xb23bf7);}})[_0x2651('0x10')](function(_0x1c39dd){if(_0x1c39dd){_0x25c42a=_0x1c39dd[_0x2651('0x53')];if(!_0x285002[_0x2651('0x3c')]['hasOwnProperty'](_0x2651('0xd7'))){_0xb23bf7[_0x2651('0x21')]=qs['limit'](_0x285002[_0x2651('0x3c')][_0x2651('0x21')]);_0xb23bf7[_0x2651('0x1e')]=qs[_0x2651('0x1e')](_0x285002['query'][_0x2651('0x1e')]);}return _0x48ad36[_0x2651('0x109')](_0xb23bf7);}})['then'](function(_0x1f8d84){if(_0x1f8d84){return _0x1f8d84?{'count':_0x25c42a,'rows':_0x1f8d84}:null;}})['then'](respondWithResult(_0x18cd5f,null))[_0x2651('0x19')](handleError(_0x18cd5f,null));};exports[_0x2651('0x10b')]=function(_0x209920,_0x4562e3){var _0x13c5fb=_0x209920[_0x2651('0x4e')]['id'];var _0x57421f=_0x209920[_0x2651('0x56')]?_0x209920['body'][_0x2651('0x59')]:null;var _0x39ec3c=[];return Promise[_0x2651('0xfc')]()[_0x2651('0x10')](function(){if(!_0x57421f)throw new APIBadRequestError(_0x2651('0x10c'));})['then'](function(){return db[_0x2651('0x34')]['findOne']({'where':{'id':_0x13c5fb}});})[_0x2651('0x10')](function(_0x2aad57){if(!_0x2aad57)throw new APINotFoundError(util[_0x2651('0xa4')](_0x2651('0x108'),_0x209920['params']['id']));return db[_0x2651('0x61')][_0x2651('0x10d')](function(_0x40b02c){return _0x2aad57[_0x2651('0x10b')](_0x57421f,{'transaction':_0x40b02c})[_0x2651('0x10')](function(){return db[_0x2651('0x10a')][_0x2651('0x44')]({'where':{'id':{'$in':_0x57421f}}});})[_0x2651('0x10')](function(_0x11fc24){var _0x318749=_['map'](_0x11fc24,function(_0x477333){return _0x477333[_0x2651('0x10e')]();});return Promise[_0x2651('0x82')](_0x318749);})['then'](function(_0x1d5888){_0x39ec3c=_[_0x2651('0x10f')](_0x1d5888);var _0x2d3e77=_[_0x2651('0x2c')](_0x39ec3c,function(_0x30731d){return _0x30731d['addAgent'](_0x2aad57['id'],{'transaction':_0x40b02c});});return Promise[_0x2651('0x82')](_0x2d3e77);})[_0x2651('0x10')](function(){if(!_0x2aad57[_0x2651('0x95')])return;var _0x3cd00d=_['filter'](_0x39ec3c,function(_0x46dac6){return _0x46dac6[_0x2651('0x110')](_0x2651('0x94'))===_0x2651('0x111');});var _0x4759c8=_[_0x2651('0x2c')](_0x3cd00d,function(_0x5bb359){return db['UserVoiceQueueRt'][_0x2651('0xf5')]({'membername':_0x2aad57['name'],'UserId':_0x2aad57['id'],'queue_name':_0x5bb359['name'],'VoiceQueueId':_0x5bb359['id'],'interface':_[_0x2651('0x5f')](_0x2aad57[_0x2651('0x98')])?util[_0x2651('0xa4')](_0x2651('0xa5'),_0x2aad57[_0x2651('0x2f')]):_0x2aad57['interface'],'paused':_0x2aad57['voicePause']||![],'penalty':_0x2aad57[_0x2651('0x9e')]},{'transaction':_0x40b02c});});return Promise['all'](_0x4759c8);})[_0x2651('0x10')](function(){return db[_0x2651('0x112')][_0x2651('0x44')]({'where':{'teamId':{'$in':_0x57421f}}});})[_0x2651('0x10')](function(_0x41deac){var _0x48d3f3=_[_0x2651('0x2c')](_0x41deac,function(_0x4b49ac){return db[_0x2651('0x113')][_0x2651('0x74')]({'UserId':_0x2aad57['id'],'VoicePrefixId':_0x4b49ac[_0x2651('0x114')]},{'transaction':_0x40b02c});});return Promise['all'](_0x48d3f3);});});})[_0x2651('0x10')](function(){for(var _0x1236cd=0x0;_0x1236cd<_0x39ec3c[_0x2651('0x53')];_0x1236cd++){var _0x3bd6d4=_0x39ec3c[_0x1236cd]['getDataValue'](_0x2651('0x94'));var _0x589a04=_0x3bd6d4+_0x2651('0xa0');socket[_0x2651('0x25')](_0x2651('0x29')+_0x3bd6d4+'Queue:save',{'UserId':_0x13c5fb,['queueField']:_0x39ec3c[_0x1236cd]['id']});}})[_0x2651('0x10')](respondWithStatusCode(_0x4562e3,null))['catch'](APIHandleError(_0x4562e3));};exports[_0x2651('0x115')]=function(_0x4e3ebd,_0x34881f){var _0x50b4e9=_0x4e3ebd['params']['id'];var _0x1e6079=null;if(_0x4e3ebd[_0x2651('0x3c')][_0x2651('0x59')]){_0x1e6079=_[_0x2651('0xaa')](_0x4e3ebd[_0x2651('0x3c')][_0x2651('0x59')])?_0x4e3ebd['query'][_0x2651('0x59')]:[_0x4e3ebd[_0x2651('0x3c')][_0x2651('0x59')]];}var _0x3357a4=[];return Promise[_0x2651('0xfc')]()['then'](function(){if(!_0x1e6079)throw new APIBadRequestError(_0x2651('0x116'));})[_0x2651('0x10')](function(){return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x50b4e9}});})[_0x2651('0x10')](function(_0x5b770e){if(!_0x5b770e)throw new APINotFoundError(util[_0x2651('0xa4')](_0x2651('0x108'),_0x4e3ebd[_0x2651('0x4e')]['id']));return db['sequelize']['transaction'](function(_0x4a5427){return _0x5b770e[_0x2651('0x115')](_0x1e6079,{'transaction':_0x4a5427})[_0x2651('0x10')](function(){return db[_0x2651('0x10a')][_0x2651('0x44')]({'where':{'id':{'$in':_0x1e6079}}});})['then'](function(_0x1107f0){var _0x4affed=_['map'](_0x1107f0,function(_0x6261b4){return _0x6261b4[_0x2651('0x10e')]();});return Promise['all'](_0x4affed);})['then'](function(_0x365e63){_0x3357a4=_[_0x2651('0x10f')](_0x365e63);var _0x4081d4=_['map'](_0x3357a4,function(_0x5504bb){return _0x5504bb['removeAgent'](_0x5b770e['id'],{'transaction':_0x4a5427});});return Promise[_0x2651('0x82')](_0x4081d4);})[_0x2651('0x10')](function(){if(!_0x5b770e[_0x2651('0x95')])return;var _0x55836d=_[_0x2651('0x37')](_0x3357a4,function(_0x4a991e){return _0x4a991e[_0x2651('0x110')](_0x2651('0x94'))===_0x2651('0x111');});var _0x4d613c=_['map'](_0x55836d,function(_0x38d180){return db[_0x2651('0xa6')][_0x2651('0x26')]({'where':{'VoiceQueueId':_0x38d180['id'],'UserId':_0x5b770e['id']},'transaction':_0x4a5427});});return Promise[_0x2651('0x82')](_0x4d613c);})[_0x2651('0x10')](function(){return db[_0x2651('0x112')]['findAll']({'where':{'teamId':{'$in':_0x1e6079}}});})[_0x2651('0x10')](function(_0x2542e1){var _0x51ed80=_[_0x2651('0x2c')](_0x2542e1,function(_0x2867a0){return db[_0x2651('0x113')][_0x2651('0x26')]({'where':{'UserId':_0x5b770e['id'],'VoicePrefixId':_0x2867a0[_0x2651('0x114')]}},{'transaction':_0x4a5427});});return Promise[_0x2651('0x82')](_0x51ed80);});});})[_0x2651('0x10')](function(){for(var _0x28424e=0x0;_0x28424e<_0x3357a4[_0x2651('0x53')];_0x28424e++){var _0x55adf7=_0x3357a4[_0x28424e][_0x2651('0x110')]('channel');var _0x30372d=_0x55adf7+_0x2651('0xa0');socket['emit']('user'+_0x55adf7+_0x2651('0xab'),{'UserId':_0x50b4e9,['queueField']:_0x3357a4[_0x28424e]['id']});}})[_0x2651('0x10')](respondWithStatusCode(_0x34881f,null))[_0x2651('0x19')](APIHandleError(_0x34881f));};exports[_0x2651('0x117')]=function(_0x46cc2e,_0xa2018d){var _0x154c81={};var _0x52ca98={};var _0x1f6f27;var _0x201943;return db[_0x2651('0x34')]['findOne']({'where':{'id':_0x46cc2e[_0x2651('0x4e')]['id']}})[_0x2651('0x10')](handleEntityNotFound(_0xa2018d,null))['then'](function(_0x7faa15){if(_0x7faa15){_0x1f6f27=_0x7faa15;_0x52ca98[_0x2651('0x4f')]=_['keys'](db['CmList']['rawAttributes']);_0x52ca98['query']=_['keys'](_0x46cc2e[_0x2651('0x3c')]);_0x52ca98[_0x2651('0xc8')]=_[_0x2651('0x51')](_0x52ca98['model'],_0x52ca98[_0x2651('0x3c')]);_0x154c81[_0x2651('0x42')]=_[_0x2651('0x51')](_0x52ca98['model'],qs[_0x2651('0x52')](_0x46cc2e[_0x2651('0x3c')]['fields']));_0x154c81['attributes']=_0x154c81[_0x2651('0x42')]['length']?_0x154c81[_0x2651('0x42')]:_0x52ca98[_0x2651('0x4f')];_0x154c81[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x46cc2e[_0x2651('0x3c')][_0x2651('0xc6')]);_0x154c81['where']=qs[_0x2651('0xc8')](_['pick'](_0x46cc2e[_0x2651('0x3c')],_0x52ca98['filters']));if(_0x46cc2e[_0x2651('0x3c')][_0x2651('0x37')]){_0x154c81[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x154c81[_0x2651('0xc7')],{'$or':_[_0x2651('0x2c')](_0x154c81[_0x2651('0x42')],function(_0x2412d9){var _0x28941c={};_0x28941c[_0x2412d9]={'$like':'%'+_0x46cc2e[_0x2651('0x3c')]['filter']+'%'};return _0x28941c;})});}_0x154c81=_['merge']({},_0x154c81,_0x46cc2e[_0x2651('0x55')]);return _0x1f6f27['getLists'](_0x154c81);}})['then'](function(_0x3f0ece){if(_0x3f0ece){_0x201943=_0x3f0ece[_0x2651('0x53')];if(!_0x46cc2e[_0x2651('0x3c')][_0x2651('0xca')]('nolimit')){_0x154c81[_0x2651('0x21')]=qs[_0x2651('0x21')](_0x46cc2e[_0x2651('0x3c')]['limit']);_0x154c81['offset']=qs[_0x2651('0x1e')](_0x46cc2e['query'][_0x2651('0x1e')]);}return _0x1f6f27['getLists'](_0x154c81);}})[_0x2651('0x10')](function(_0x5f3655){if(_0x5f3655){return _0x5f3655?{'count':_0x201943,'rows':_0x5f3655}:null;}})[_0x2651('0x10')](respondWithResult(_0xa2018d,null))[_0x2651('0x19')](handleError(_0xa2018d,null));};exports['getAgents']=function(_0x24b05f,_0x3f8b4a){var _0x1c142c={};var _0x15babe={};var _0x470a68;return db[_0x2651('0x34')][_0x2651('0xd2')]({'where':{'id':_0x24b05f['params']['id']}})[_0x2651('0x10')](handleEntityNotFound(_0x3f8b4a,null))[_0x2651('0x10')](function(_0x19ca04){if(_0x19ca04){_0x470a68=_0x19ca04;_0x15babe[_0x2651('0x4f')]=_[_0x2651('0x50')](db[_0x2651('0x34')][_0x2651('0xd6')]);_0x15babe[_0x2651('0x3c')]=_[_0x2651('0x50')](_0x24b05f[_0x2651('0x3c')]);_0x15babe[_0x2651('0xc8')]=_['intersection'](_0x15babe[_0x2651('0x4f')],_0x15babe[_0x2651('0x3c')]);_0x1c142c['attributes']=_[_0x2651('0x51')](_0x15babe[_0x2651('0x4f')],qs[_0x2651('0x52')](_0x24b05f[_0x2651('0x3c')]['fields']));_0x1c142c[_0x2651('0x42')]=_0x1c142c[_0x2651('0x42')][_0x2651('0x53')]?_0x1c142c[_0x2651('0x42')]:_0x15babe[_0x2651('0x4f')];_0x1c142c[_0x2651('0xc5')]=qs[_0x2651('0xc6')](_0x24b05f['query'][_0x2651('0xc6')]);_0x1c142c[_0x2651('0xc7')]=qs[_0x2651('0xc8')](_[_0x2651('0xc9')](_0x24b05f['query'],_0x15babe[_0x2651('0xc8')]));if(_0x24b05f[_0x2651('0x3c')][_0x2651('0x37')]){_0x1c142c[_0x2651('0xc7')]=_[_0x2651('0x54')](_0x1c142c[_0x2651('0xc7')],{'$or':_['map'](_0x1c142c[_0x2651('0x42')],function(_0x3a13ca){var _0x29414f={};_0x29414f[_0x3a13ca]={'$like':'%'+_0x24b05f[_0x2651('0x3c')][_0x2651('0x37')]+'%'};return _0x29414f;})});}_0x1c142c[_0x2651('0x4f')]=db[_0x2651('0x34')];_0x1c142c['as']=_0x2651('0x7c');_0x1c142c=_[_0x2651('0x54')]({},_0x1c142c,_0x24b05f[_0x2651('0x55')]);return _0x470a68[_0x2651('0xf3')]({'include':[_0x1c142c]});}})[_0x2651('0x10')](function(_0x33b1a4){if(_0x33b1a4){var _0x404e2c={},_0x251a68=[];for(var _0x32c0fc=0x0;_0x32c0fc<_0x33b1a4[_0x2651('0x53')];_0x32c0fc+=0x1){for(var _0x531175=0x0,_0x45466f;_0x531175<_0x33b1a4[_0x32c0fc]['Agents'][_0x2651('0x53')];_0x531175+=0x1){_0x45466f=_0x33b1a4[_0x32c0fc][_0x2651('0x7c')][_0x531175]['get']({'plain':!![]});_0x404e2c[_0x45466f['id']]=_0x45466f;}}_0x404e2c=_[_0x2651('0x118')](_0x404e2c);for(var _0x120823=qs[_0x2651('0x1e')](_0x24b05f[_0x2651('0x3c')][_0x2651('0x1e')]);_0x120823<_0x404e2c[_0x2651('0x53')]&&_0x251a68[_0x2651('0x53')]=_0x4de74b[_0x2225('0x4a')]){throw new Error(_0x2225('0x4b'));}})[_0x2225('0x17')](function(){if(_0x36408a){return db[_0x2225('0x4c')]['destroy']({'where':{'membername':_0x36408a[_0x2225('0x23')]},'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x36408a){return _0x36408a[_0x2225('0x4d')]({'raw':!![]});}})[_0x2225('0x17')](function(_0x473f6b){if(_0x36408a){if(_0x473f6b){var _0x142fc1=[];_0x1b0b54=_0x473f6b;if(_0x1b0b54[_0x2225('0x2a')]){for(var _0x3acafd=0x0;_0x3acafd<_0x1b0b54[_0x2225('0x2a')];_0x3acafd++){_0x142fc1[_0x2225('0x2f')](db[_0x2225('0x4c')][_0x2225('0x4e')]({'membername':_0x36408a[_0x2225('0x23')],'UserId':_0x36408a['id'],'queue_name':_0x1b0b54[_0x3acafd]['name'],'VoiceQueueId':_0x1b0b54[_0x3acafd]['id'],'interface':_0x3af9e2,'paused':_0x36408a[_0x2225('0x48')]||![],'penalty':_0x1b0b54[_0x3acafd][_0x2225('0x4f')]||0x0}));}return BPromise[_0x2225('0x46')](_0x142fc1);}}}})[_0x2225('0x17')](function(){if(_0x36408a){return db[_0x2225('0x28')][_0x2225('0xf')]({'where':{'membername':_0x36408a[_0x2225('0x23')],'exitAt':null}});}})[_0x2225('0x17')](function(_0x24ae80){if(_0x36408a){if(_0x24ae80&&_0x24ae80[_0x2225('0x2a')]){var _0xf45869=[];_0x24ae80['forEach'](function(_0x2f5bc7){_0xf45869[_0x2225('0x2f')](_0x2f5bc7['update']({'exitAt':moment()[_0x2225('0x2b')](_0x2225('0x2c'))}));});return BPromise[_0x2225('0x46')](_0xf45869);}}})[_0x2225('0x17')](function(){if(_0x36408a){var _0x1c25fe=[];var _0x416ec7=[];var _0x5bda34=utils['getChannels']();var _0x42aff7={'membername':_0x36408a['name'],'interface':_0x3af9e2,'enterAt':moment()[_0x2225('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x36408a[_0x2225('0x24')],'internal':_0x36408a[_0x2225('0x25')]};_0x5bda34[_0x2225('0x2e')](function(_0x48bef0){_0x1c25fe[_0x2225('0x2f')](_[_0x2225('0x50')]({'channel':_0x48bef0,'type':'LOGIN','data1':_0x2225('0x51'),'data2':_0x3af9e2},_0x42aff7));if(_0x36408a[_0x2225('0x48')]){_0x416ec7['push'](_[_0x2225('0x50')]({'channel':_0x48bef0,'type':_0x2225('0x29'),'data1':'LOGININPAUSE'},_0x42aff7));}});return db[_0x2225('0x28')][_0x2225('0x35')](_0x1c25fe[_0x2225('0x52')](_0x416ec7),{'individualHooks':!![]});}})[_0x2225('0x17')](function(){if(_0x36408a){return _0x36408a['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x36408a['loginInPause']||![],'mailPause':_0x36408a[_0x2225('0x48')]||![],'chatPause':_0x36408a[_0x2225('0x48')]||![],'faxPause':_0x36408a['loginInPause']||![],'smsPause':_0x36408a[_0x2225('0x48')]||![],'openchannelPause':_0x36408a[_0x2225('0x48')]||![],'pauseType':_0x36408a[_0x2225('0x48')]?_0x2225('0x53'):null,'lastPauseAt':moment()[_0x2225('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3af9e2});}})[_0x2225('0x17')](function(_0x3df2a3){_0x100ff3(_0x3df2a3);})[_0x2225('0x21')](function(_0xad8f55){_0x42bdd5(_0x30150e['error'](0x1f4,_0xad8f55[_0x2225('0x1b')]));});});}; \ No newline at end of file +var _0xe504=['User','options','raw','where','limit','map','include','model','attributes','then','info','GetUser','catch','error','message','ShowUser','debug','stringify','PauseUser','find','name','internal','interface','UserVoiceQueueRt','MemberReport','findAll','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','forEach','push','PAUSE','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','update','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','params','unpause','system','LogoutUser','findOne','destroy','length','all','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','util','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','./user.socket'];(function(_0x3910cc,_0x5b3fc9){var _0x510a1f=function(_0x4a4980){while(--_0x4a4980){_0x3910cc['push'](_0x3910cc['shift']());}};_0x510a1f(++_0x5b3fc9);}(_0xe504,0x140));var _0x4e50=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe504[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x4e50('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0x4e50('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e50('0x2'));var config=require('../../config/environment');config[_0x4e50('0x3')]=_[_0x4e50('0x4')](config[_0x4e50('0x3')],{'host':_0x4e50('0x5'),'port':0x18eb});var socket=require(_0x4e50('0x6'))(new Redis(config[_0x4e50('0x3')]));require(_0x4e50('0x7'))['register'](socket);exports['GetUser']=function(_0x1f3706){var _0x7f303a=this;return new Promise(function(_0x2f26ff,_0x549696){return db[_0x4e50('0x8')]['findAll']({'raw':_0x1f3706['options']?_0x1f3706[_0x4e50('0x9')][_0x4e50('0xa')]===undefined?!![]:![]:!![],'where':_0x1f3706[_0x4e50('0x9')]?_0x1f3706[_0x4e50('0x9')][_0x4e50('0xb')]||null:null,'attributes':_0x1f3706['options']?_0x1f3706['options']['attributes']||null:null,'limit':_0x1f3706['options']?_0x1f3706[_0x4e50('0x9')][_0x4e50('0xc')]||null:null,'include':_0x1f3706[_0x4e50('0x9')]?_0x1f3706[_0x4e50('0x9')]['include']?_[_0x4e50('0xd')](_0x1f3706[_0x4e50('0x9')][_0x4e50('0xe')],function(_0x407ff7){return{'model':db[_0x407ff7[_0x4e50('0xf')]],'as':_0x407ff7['as'],'attributes':_0x407ff7[_0x4e50('0x10')],'include':_0x407ff7[_0x4e50('0xe')]?_['map'](_0x407ff7[_0x4e50('0xe')],function(_0x44249d){return{'model':db[_0x44249d[_0x4e50('0xf')]],'as':_0x44249d['as'],'attributes':_0x44249d[_0x4e50('0x10')],'include':_0x44249d[_0x4e50('0xe')]?_['map'](_0x44249d[_0x4e50('0xe')],function(_0xe79207){return{'model':db[_0xe79207[_0x4e50('0xf')]],'as':_0xe79207['as'],'attributes':_0xe79207[_0x4e50('0x10')]};}):[]};}):[]};}):[]:[]})[_0x4e50('0x11')](function(_0x18e23d){logger[_0x4e50('0x12')](_0x4e50('0x13'),_0x1f3706);logger['debug'](_0x4e50('0x13'),_0x1f3706,JSON['stringify'](_0x18e23d));_0x2f26ff(_0x18e23d);})[_0x4e50('0x14')](function(_0x408d8e){logger[_0x4e50('0x15')](_0x4e50('0x13'),_0x408d8e[_0x4e50('0x16')],_0x1f3706);_0x549696(_0x7f303a['error'](0x1f4,_0x408d8e['message']));});});};exports[_0x4e50('0x17')]=function(_0xfcd4ae){var _0x26a615=this;return new Promise(function(_0x17b027,_0x5e3d25){return db[_0x4e50('0x8')]['find']({'raw':_0xfcd4ae['options']?_0xfcd4ae[_0x4e50('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0xfcd4ae[_0x4e50('0x9')]?_0xfcd4ae[_0x4e50('0x9')][_0x4e50('0xb')]||null:null,'attributes':_0xfcd4ae[_0x4e50('0x9')]?_0xfcd4ae[_0x4e50('0x9')]['attributes']||null:null,'include':_0xfcd4ae['options']?_0xfcd4ae[_0x4e50('0x9')][_0x4e50('0xe')]?_[_0x4e50('0xd')](_0xfcd4ae[_0x4e50('0x9')][_0x4e50('0xe')],function(_0x528692){return{'model':db[_0x528692['model']],'as':_0x528692['as'],'attributes':_0x528692[_0x4e50('0x10')],'include':_0x528692[_0x4e50('0xe')]?_['map'](_0x528692['include'],function(_0xe1f2f9){return{'model':db[_0xe1f2f9['model']],'as':_0xe1f2f9['as'],'attributes':_0xe1f2f9[_0x4e50('0x10')],'include':_0xe1f2f9[_0x4e50('0xe')]?_[_0x4e50('0xd')](_0xe1f2f9[_0x4e50('0xe')],function(_0x36482b){return{'model':db[_0x36482b[_0x4e50('0xf')]],'as':_0x36482b['as'],'attributes':_0x36482b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e50('0x11')](function(_0x24a6d6){logger[_0x4e50('0x12')](_0x4e50('0x17'),_0xfcd4ae);logger[_0x4e50('0x18')](_0x4e50('0x17'),_0xfcd4ae,JSON[_0x4e50('0x19')](_0x24a6d6));_0x17b027(_0x24a6d6);})['catch'](function(_0x3d2d83){logger[_0x4e50('0x15')](_0x4e50('0x17'),_0x3d2d83[_0x4e50('0x16')],_0xfcd4ae);_0x5e3d25(_0x26a615[_0x4e50('0x15')](0x1f4,_0x3d2d83[_0x4e50('0x16')]));});});};exports[_0x4e50('0x1a')]=function(_0x3da037){var _0xb9d7f8=this;return new Promise(function(_0x27a7e6,_0x1c5463){var _0x4e4ecc;return db[_0x4e50('0x8')][_0x4e50('0x1b')]({'where':_0x3da037['options']['where']||{},'attributes':['id',_0x4e50('0x1c'),'role',_0x4e50('0x1d'),_0x4e50('0x1e')]})[_0x4e50('0x11')](function(_0x555593){if(_0x555593){_0x4e4ecc=_0x555593;return db[_0x4e50('0x1f')]['update']({'paused':0x1},{'where':{'UserId':_0x4e4ecc['id']},'individualHooks':!![]});}})['then'](function(){if(_0x4e4ecc){return db[_0x4e50('0x20')][_0x4e50('0x21')]({'where':{'membername':_0x4e4ecc[_0x4e50('0x1c')],'type':'PAUSE','exitAt':null}});}})[_0x4e50('0x11')](function(_0x4d8282){if(_0x4e4ecc){if(_0x4d8282&&_0x4d8282['length']){var _0x370489=moment()[_0x4e50('0x22')](_0x4e50('0x23'));for(var _0x5cb05b=0x0,_0x4ffcc5=_0x4d8282['length'];_0x5cb05b<_0x4ffcc5;_0x5cb05b++){_0x4d8282[_0x5cb05b][_0x4e50('0x24')]({'exitAt':_0x370489});}}}})[_0x4e50('0x11')](function(){if(_0x4e4ecc){var _0x4bb31c=[];var _0x270e07=utils['getChannels']();_0x270e07[_0x4e50('0x25')](function(_0x40004b){_0x4bb31c[_0x4e50('0x26')]({'channel':_0x40004b,'membername':_0x4e4ecc[_0x4e50('0x1c')],'interface':_['isNil'](_0x4e4ecc['interface'])?util[_0x4e50('0x22')]('SIP/%s',_0x4e4ecc[_0x4e50('0x1c')]):_0x4e4ecc[_0x4e50('0x1e')],'type':_0x4e50('0x27'),'enterAt':moment()['format'](_0x4e50('0x23')),'data1':_0x3da037[_0x4e50('0x28')][_0x4e50('0x29')]||_0x4e50('0x2a'),'role':_0x4e4ecc[_0x4e50('0x2b')],'internal':_0x4e4ecc[_0x4e50('0x1d')],'uniqueid':_0x3da037[_0x4e50('0x28')][_0x4e50('0x2c')]||null});});return db[_0x4e50('0x20')][_0x4e50('0x2d')](_0x4bb31c,{'individualHooks':!![]});}})[_0x4e50('0x11')](function(){if(_0x4e4ecc){return _0x4e4ecc[_0x4e50('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3da037[_0x4e50('0x28')]['type']||_0x4e50('0x2a'),'lastPauseAt':moment()[_0x4e50('0x22')](_0x4e50('0x23'))});}})[_0x4e50('0x11')](function(_0x14a848){_0x27a7e6(_0x14a848);})[_0x4e50('0x14')](function(_0x22906a){_0x1c5463(_0xb9d7f8[_0x4e50('0x15')](0x1f4,_0x22906a[_0x4e50('0x16')]));});});};exports[_0x4e50('0x2f')]=function(_0x172e86){var _0x203e61=this;return new Promise(function(_0x5826f,_0x429bd5){if(_0x172e86[_0x4e50('0x28')][_0x4e50('0x30')]&&!utils[_0x4e50('0x31')](_0x172e86[_0x4e50('0x28')][_0x4e50('0x30')])){throw new Error(util[_0x4e50('0x22')](_0x4e50('0x32'),_0x172e86['body']['channel']));}return db[_0x4e50('0x8')]['findOne']({'where':_0x172e86[_0x4e50('0x9')][_0x4e50('0xb')]||{},'attributes':['id',_0x4e50('0x1c'),_0x4e50('0x2b'),_0x4e50('0x1d'),_0x4e50('0x1e'),_0x4e50('0x33'),_0x4e50('0x34'),_0x4e50('0x35'),_0x4e50('0x36'),_0x4e50('0x37'),_0x4e50('0x38'),'smsPause','whatsappPause',_0x4e50('0x39'),_0x4e50('0x3a')]})[_0x4e50('0x11')](function(_0x5e034e){if(!_0x5e034e){throw new Error(util[_0x4e50('0x22')]('User\x20with\x20id\x20%s\x20not\x20found',_0x172e86[_0x4e50('0x3b')]['id']));}return _0x5e034e[_0x4e50('0x3c')](_0x172e86['body'][_0x4e50('0x30')],_0x4e50('0x3d'));})['then'](function(_0x578588){_0x5826f(_0x578588);})[_0x4e50('0x14')](function(_0x294223){_0x429bd5(_0x203e61['error'](0x1f4,_0x294223['message']));});});};exports[_0x4e50('0x3e')]=function(_0x3ba6f5){var _0x3234b3=this;return new Promise(function(_0x1b5030,_0x31fbd7){var _0x4d6a33;return db[_0x4e50('0x8')][_0x4e50('0x3f')]({'where':_0x3ba6f5['options'][_0x4e50('0xb')]||{},'attributes':['id',_0x4e50('0x1c')]})[_0x4e50('0x11')](function(_0x4cf16a){if(_0x4cf16a){_0x4d6a33=_0x4cf16a;return db['UserVoiceQueueRt'][_0x4e50('0x40')]({'where':{'membername':_0x4d6a33[_0x4e50('0x1c')]},'individualHooks':!![]});}})[_0x4e50('0x11')](function(){if(_0x4d6a33){return db[_0x4e50('0x20')][_0x4e50('0x21')]({'where':{'membername':_0x4d6a33[_0x4e50('0x1c')],'exitAt':null}});}})['then'](function(_0x75c08d){if(_0x4d6a33){if(_0x75c08d&&_0x75c08d[_0x4e50('0x41')]){var _0x34822d=[];_0x75c08d['forEach'](function(_0x16b1f0){_0x34822d['push'](_0x16b1f0[_0x4e50('0x2e')]({'exitAt':moment()[_0x4e50('0x22')](_0x4e50('0x23'))}));});return BPromise[_0x4e50('0x42')](_0x34822d);}}})[_0x4e50('0x11')](function(){if(_0x4d6a33){return _0x4d6a33[_0x4e50('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x4e50('0x11')](function(_0x1dc258){_0x1b5030(_0x1dc258);})['catch'](function(_0x9a462){_0x31fbd7(_0x3234b3[_0x4e50('0x15')](0x1f4,_0x9a462['message']));});});};exports[_0x4e50('0x43')]=function(_0x33643e){var _0xe94a6d=this;return new Promise(function(_0x4d7aac,_0x17196f){var _0x4a2182;var _0x5b4bfa;var _0x538da6;var _0x3ec0d7;return db[_0x4e50('0x8')][_0x4e50('0x3f')]({'where':_0x33643e[_0x4e50('0x9')][_0x4e50('0xb')]||{},'attributes':['id',_0x4e50('0x1c'),_0x4e50('0x2b'),_0x4e50('0x44'),'phone',_0x4e50('0x1d'),_0x4e50('0x45'),'interface']})['then'](function(_0x3474ef){if(_0x3474ef){_0x4a2182=_0x3474ef;_0x3ec0d7=_0x33643e[_0x4e50('0x28')][_0x4e50('0x1e')]?_0x33643e[_0x4e50('0x28')][_0x4e50('0x1e')]:util['format']('SIP/%s',_0x4a2182['name']);return db[_0x4e50('0x8')][_0x4e50('0x46')]({'where':{'role':_0x4e50('0x47'),'online':!![],'id':{'$ne':_0x4a2182['id']}}});}})['then'](function(_0x37a7e7){if(_0x37a7e7){_0x538da6=_0x37a7e7;return require(_0x4e50('0x48'))[_0x4e50('0x49')]();}})[_0x4e50('0x11')](function(_0x854f3b){if(_0x854f3b&&_0x854f3b['agents']&&_0x538da6>=_0x854f3b['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x4e50('0x11')](function(){if(_0x4a2182){return db[_0x4e50('0x1f')][_0x4e50('0x40')]({'where':{'membername':_0x4a2182[_0x4e50('0x1c')]},'individualHooks':!![]});}})['then'](function(){if(_0x4a2182){return _0x4a2182['getVoiceQueues']({'raw':!![]});}})[_0x4e50('0x11')](function(_0x27d47f){if(_0x4a2182){if(_0x27d47f){var _0x3b6d36=[];_0x5b4bfa=_0x27d47f;if(_0x5b4bfa[_0x4e50('0x41')]){for(var _0x93889f=0x0;_0x93889f<_0x5b4bfa[_0x4e50('0x41')];_0x93889f++){_0x3b6d36[_0x4e50('0x26')](db[_0x4e50('0x1f')][_0x4e50('0x4a')]({'membername':_0x4a2182['name'],'UserId':_0x4a2182['id'],'queue_name':_0x5b4bfa[_0x93889f][_0x4e50('0x1c')],'VoiceQueueId':_0x5b4bfa[_0x93889f]['id'],'interface':_0x3ec0d7,'paused':_0x4a2182[_0x4e50('0x45')]||![],'penalty':_0x5b4bfa[_0x93889f][_0x4e50('0x4b')]||0x0}));}return BPromise[_0x4e50('0x42')](_0x3b6d36);}}}})['then'](function(){if(_0x4a2182){return db[_0x4e50('0x20')][_0x4e50('0x21')]({'where':{'membername':_0x4a2182[_0x4e50('0x1c')],'exitAt':null}});}})[_0x4e50('0x11')](function(_0x47d509){if(_0x4a2182){if(_0x47d509&&_0x47d509[_0x4e50('0x41')]){var _0x93553=[];_0x47d509[_0x4e50('0x25')](function(_0x507695){_0x93553[_0x4e50('0x26')](_0x507695[_0x4e50('0x2e')]({'exitAt':moment()[_0x4e50('0x22')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x93553);}}})['then'](function(){if(_0x4a2182){var _0x35848c=[];var _0x281edf=[];var _0x2cf27b=utils[_0x4e50('0x4c')]();var _0x212e99={'membername':_0x4a2182[_0x4e50('0x1c')],'interface':_0x3ec0d7,'enterAt':moment()['format'](_0x4e50('0x23')),'role':_0x4a2182[_0x4e50('0x2b')],'internal':_0x4a2182[_0x4e50('0x1d')]};_0x2cf27b[_0x4e50('0x25')](function(_0x2ca734){_0x35848c[_0x4e50('0x26')](_[_0x4e50('0x4d')]({'channel':_0x2ca734,'type':_0x4e50('0x4e'),'data1':_0x4e50('0x4f'),'data2':_0x3ec0d7},_0x212e99));if(_0x4a2182['loginInPause']){_0x281edf[_0x4e50('0x26')](_[_0x4e50('0x4d')]({'channel':_0x2ca734,'type':_0x4e50('0x27'),'data1':_0x4e50('0x50')},_0x212e99));}});return db[_0x4e50('0x20')]['bulkCreate'](_0x35848c[_0x4e50('0x51')](_0x281edf),{'individualHooks':!![]});}})[_0x4e50('0x11')](function(){if(_0x4a2182){return _0x4a2182[_0x4e50('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x4e50('0x22')](_0x4e50('0x23')),'voicePause':_0x4a2182[_0x4e50('0x45')]||![],'mailPause':_0x4a2182[_0x4e50('0x45')]||![],'chatPause':_0x4a2182['loginInPause']||![],'faxPause':_0x4a2182[_0x4e50('0x45')]||![],'smsPause':_0x4a2182['loginInPause']||![],'openchannelPause':_0x4a2182[_0x4e50('0x45')]||![],'pauseType':_0x4a2182[_0x4e50('0x45')]?_0x4e50('0x50'):null,'lastPauseAt':moment()['format'](_0x4e50('0x23')),'interface':_0x3ec0d7});}})[_0x4e50('0x11')](function(_0x24a244){_0x4d7aac(_0x24a244);})[_0x4e50('0x14')](function(_0x20e501){_0x17196f(_0xe94a6d['error'](0x1f4,_0x20e501['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b7ea79f..4939165 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 _0x0dae=['save','remove','update','removeListener','register','length','user:'];(function(_0x15fa50,_0x32c57f){var _0x9e62da=function(_0x139cee){while(--_0x139cee){_0x15fa50['push'](_0x15fa50['shift']());}};_0x9e62da(++_0x32c57f);}(_0x0dae,0x165));var _0xe0da=function(_0xcad9e7,_0x255d6f){_0xcad9e7=_0xcad9e7-0x0;var _0x170a86=_0x0dae[_0xcad9e7];return _0x170a86;};'use strict';var UserEvents=require('./user.events');var events=[_0xe0da('0x0'),_0xe0da('0x1'),_0xe0da('0x2')];function createListener(_0x37173b,_0x2ddffe){return function(_0x5e3582){_0x2ddffe['emit'](_0x37173b,_0x5e3582);};}function removeListener(_0x5294ab,_0x3bad40){return function(){UserEvents[_0xe0da('0x3')](_0x5294ab,_0x3bad40);};}exports[_0xe0da('0x4')]=function(_0x3e1aae){for(var _0x52a54d=0x0,_0x2aa143=events[_0xe0da('0x5')];_0x52a54d<_0x2aa143;_0x52a54d++){var _0x589dc9=events[_0x52a54d];var _0x38f45a=createListener(_0xe0da('0x6')+_0x589dc9,_0x3e1aae);UserEvents['on'](_0x589dc9,_0x38f45a);}}; \ No newline at end of file +var _0xed01=['register','length','save','remove','update','removeListener'];(function(_0x1c02f6,_0x4c1130){var _0xd2fbe3=function(_0x34a758){while(--_0x34a758){_0x1c02f6['push'](_0x1c02f6['shift']());}};_0xd2fbe3(++_0x4c1130);}(_0xed01,0x158));var _0x1ed0=function(_0x51916e,_0x1c627e){_0x51916e=_0x51916e-0x0;var _0x450daf=_0xed01[_0x51916e];return _0x450daf;};'use strict';var UserEvents=require('./user.events');var events=[_0x1ed0('0x0'),_0x1ed0('0x1'),_0x1ed0('0x2')];function createListener(_0x415f9f,_0x3afbcd){return function(_0x58a925){_0x3afbcd['emit'](_0x415f9f,_0x58a925);};}function removeListener(_0x2bb486,_0x2a5bec){return function(){UserEvents[_0x1ed0('0x3')](_0x2bb486,_0x2a5bec);};}exports[_0x1ed0('0x4')]=function(_0x12c8d7){for(var _0x3272c2=0x0,_0x321685=events[_0x1ed0('0x5')];_0x3272c2<_0x321685;_0x3272c2++){var _0x1c515c=events[_0x3272c2];var _0x4bd246=createListener('user:'+_0x1c515c,_0x12c8d7);UserEvents['on'](_0x1c515c,_0x4bd246);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 471e196..6e551be 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ce591,_0x2075ec){var _0x18121b=function(_0x1288bc){while(--_0x1288bc){_0x2ce591['push'](_0x2ce591['shift']());}};_0x18121b(++_0x2075ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x253cb0,_0x1bdd2d){var _0x7be9d6=function(_0x2ffe4c){while(--_0x2ffe4c){_0x253cb0['push'](_0x253cb0['shift']());}};_0x7be9d6(++_0x1bdd2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ea4de98..c5e7498 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 _0x4f03=['INTEGER','sequelize'];(function(_0xa9cbd6,_0x4acd4c){var _0x1c9d61=function(_0x2b2879){while(--_0x2b2879){_0xa9cbd6['push'](_0xa9cbd6['shift']());}};_0x1c9d61(++_0x4acd4c);}(_0x4f03,0x17b));var _0x34f0=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x4f03[_0x4776cc];return _0x427bda;};'use strict';var Sequelize=require(_0x34f0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x34f0('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8fda=['INTEGER'];(function(_0x4c43d0,_0x18f21b){var _0x403852=function(_0x34cac4){while(--_0x34cac4){_0x4c43d0['push'](_0x4c43d0['shift']());}};_0x403852(++_0x18f21b);}(_0x8fda,0x1eb));var _0xa8fd=function(_0x261a3d,_0x5925a9){_0x261a3d=_0x261a3d-0x0;var _0xdef77b=_0x8fda[_0x261a3d];return _0xdef77b;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xa8fd('0x0')],'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 50822a6..0fa642a 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 _0x319a=['define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x29b9a8,_0x1b05d5){var _0xea829d=function(_0x42f4f8){while(--_0x42f4f8){_0x29b9a8['push'](_0x29b9a8['shift']());}};_0xea829d(++_0x1b05d5);}(_0x319a,0x7b));var _0xa319=function(_0x1d8a49,_0x1291b9){_0x1d8a49=_0x1d8a49-0x0;var _0xd313c1=_0x319a[_0x1d8a49];return _0xd313c1;};'use strict';var _=require(_0xa319('0x0'));var util=require(_0xa319('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa319('0x2'));var BPromise=require(_0xa319('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa319('0x4'));var attributes=require(_0xa319('0x5'));module[_0xa319('0x6')]=function(_0x2d111e,_0x496857){return _0x2d111e[_0xa319('0x7')](_0xa319('0x8'),attributes,{'tableName':_0xa319('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3dd=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','lodash','util'];(function(_0x245d65,_0xe6ae06){var _0xd651af=function(_0xc48dfc){while(--_0xc48dfc){_0x245d65['push'](_0x245d65['shift']());}};_0xd651af(++_0xe6ae06);}(_0xc3dd,0x8e));var _0xdc3d=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xc3dd[_0x4b26b5];return _0x4dec71;};'use strict';var _=require(_0xdc3d('0x0'));var util=require(_0xdc3d('0x1'));var logger=require(_0xdc3d('0x2'))(_0xdc3d('0x3'));var moment=require(_0xdc3d('0x4'));var BPromise=require(_0xdc3d('0x5'));var rp=require(_0xdc3d('0x6'));var fs=require('fs');var path=require(_0xdc3d('0x7'));var rimraf=require('rimraf');var config=require(_0xdc3d('0x8'));var attributes=require(_0xdc3d('0x9'));module[_0xdc3d('0xa')]=function(_0x10f48f,_0x40dd68){return _0x10f48f['define'](_0xdc3d('0xb'),attributes,{'tableName':'user_has_chat_queues','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 06b04cf..b7ab751 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 _0xe775=['stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x58ce75,_0x107ebe){var _0x3d1211=function(_0x2945d3){while(--_0x2945d3){_0x58ce75['push'](_0x58ce75['shift']());}};_0x3d1211(++_0x107ebe);}(_0xe775,0x10d));var _0x5e77=function(_0x54c9dd,_0x233a86){_0x54c9dd=_0x54c9dd-0x0;var _0x855156=_0xe775[_0x54c9dd];return _0x855156;};'use strict';var _=require(_0x5e77('0x0'));var util=require(_0x5e77('0x1'));var moment=require(_0x5e77('0x2'));var BPromise=require(_0x5e77('0x3'));var rs=require(_0x5e77('0x4'));var fs=require('fs');var Redis=require(_0x5e77('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e77('0x6'))(_0x5e77('0x7'));var config=require(_0x5e77('0x8'));var jayson=require(_0x5e77('0x9'));var client=jayson['client'][_0x5e77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x532d34,_0x262529,_0x2f6118){return new BPromise(function(_0x1acb0a,_0x57476c){return client[_0x5e77('0xb')](_0x532d34,_0x2f6118)[_0x5e77('0xc')](function(_0x5d4b85){logger['info'](_0x5e77('0xd'),_0x262529,_0x5e77('0xe'));logger[_0x5e77('0xf')](_0x5e77('0x10'),_0x262529,_0x5e77('0xe'),JSON[_0x5e77('0x11')](_0x5d4b85));if(_0x5d4b85[_0x5e77('0x12')]){if(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x13')]===0x1f4){logger[_0x5e77('0x12')](_0x5e77('0xd'),_0x262529,_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);return _0x57476c(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);}logger[_0x5e77('0x12')](_0x5e77('0xd'),_0x262529,_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);return _0x1acb0a(_0x5d4b85[_0x5e77('0x12')][_0x5e77('0x14')]);}else{logger[_0x5e77('0x15')](_0x5e77('0xd'),_0x262529,_0x5e77('0xe'));_0x1acb0a(_0x5d4b85['result']['message']);}})['catch'](function(_0x322220){logger['error'](_0x5e77('0xd'),_0x262529,_0x322220);_0x57476c(_0x322220);});});} \ No newline at end of file +var _0x1d71=['code','UserChatQueue,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x4edcf8,_0x27c91b){var _0x3c3c65=function(_0xa3df4b){while(--_0xa3df4b){_0x4edcf8['push'](_0x4edcf8['shift']());}};_0x3c3c65(++_0x27c91b);}(_0x1d71,0x11c));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d7('0x0'));var util=require('util');var moment=require(_0x11d7('0x1'));var BPromise=require(_0x11d7('0x2'));var rs=require(_0x11d7('0x3'));var fs=require('fs');var Redis=require(_0x11d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x11d7('0x5'));var logger=require(_0x11d7('0x6'))(_0x11d7('0x7'));var config=require(_0x11d7('0x8'));var jayson=require(_0x11d7('0x9'));var client=jayson[_0x11d7('0xa')][_0x11d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42901a,_0x2714da,_0x4ff523){return new BPromise(function(_0x54f7f5,_0x463768){return client['request'](_0x42901a,_0x4ff523)[_0x11d7('0xc')](function(_0x40f02a){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2714da,_0x11d7('0xd'));logger['debug'](_0x11d7('0xe'),_0x2714da,_0x11d7('0xd'),JSON['stringify'](_0x40f02a));if(_0x40f02a[_0x11d7('0xf')]){if(_0x40f02a[_0x11d7('0xf')][_0x11d7('0x10')]===0x1f4){logger['error'](_0x11d7('0x11'),_0x2714da,_0x40f02a['error'][_0x11d7('0x12')]);return _0x463768(_0x40f02a['error'][_0x11d7('0x12')]);}logger[_0x11d7('0xf')](_0x11d7('0x11'),_0x2714da,_0x40f02a['error'][_0x11d7('0x12')]);return _0x54f7f5(_0x40f02a['error']['message']);}else{logger[_0x11d7('0x13')](_0x11d7('0x11'),_0x2714da,_0x11d7('0xd'));_0x54f7f5(_0x40f02a['result'][_0x11d7('0x12')]);}})['catch'](function(_0x328daa){logger[_0x11d7('0xf')](_0x11d7('0x11'),_0x2714da,_0x328daa);_0x463768(_0x328daa);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d70994a..ab4e5e4 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x55adee,_0x4d9108){var _0x5f0455=function(_0x216c59){while(--_0x216c59){_0x55adee['push'](_0x55adee['shift']());}};_0x5f0455(++_0x4d9108);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x428380,_0x19372a){var _0x298f8a=function(_0x2a60e3){while(--_0x2a60e3){_0x428380['push'](_0x428380['shift']());}};_0x298f8a(++_0x19372a);}(_0xe706,0xa3));var _0x6e70=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0xe706[_0x4ca6a4];return _0x120555;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 95d4c6c..e253bb8 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 _0x95ae=['INTEGER','STRING','sequelize','exports'];(function(_0x350b76,_0x3e804b){var _0x3a9adb=function(_0x1f16b5){while(--_0x1f16b5){_0x350b76['push'](_0x350b76['shift']());}};_0x3a9adb(++_0x3e804b);}(_0x95ae,0x152));var _0xe95a=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x95ae[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require(_0xe95a('0x0'));module[_0xe95a('0x1')]={'penalty':{'type':Sequelize[_0xe95a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe95a('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe95a('0x3')]}}; \ No newline at end of file +var _0x0feb=['sequelize','exports','INTEGER'];(function(_0x4e9de3,_0x108fc8){var _0x42132b=function(_0x8b4fef){while(--_0x8b4fef){_0x4e9de3['push'](_0x4e9de3['shift']());}};_0x42132b(++_0x108fc8);}(_0x0feb,0x141));var _0xb0fe=function(_0x38cc94,_0x5756e9){_0x38cc94=_0x38cc94-0x0;var _0x4ac45c=_0x0feb[_0x38cc94];return _0x4ac45c;};'use strict';var Sequelize=require(_0xb0fe('0x0'));module[_0xb0fe('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb0fe('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e84d463..4682d7d 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 _0xff67=['rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xff67,0x1e7));var _0x7ff6=function(_0x6ce73,_0x4b9160){_0x6ce73=_0x6ce73-0x0;var _0x23a31b=_0xff67[_0x6ce73];return _0x23a31b;};'use strict';var _=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var logger=require(_0x7ff6('0x2'))(_0x7ff6('0x3'));var moment=require(_0x7ff6('0x4'));var BPromise=require(_0x7ff6('0x5'));var rp=require(_0x7ff6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ff6('0x7'));var config=require(_0x7ff6('0x8'));var attributes=require(_0x7ff6('0x9'));module['exports']=function(_0x182106,_0x2a3a5a){return _0x182106[_0x7ff6('0xa')](_0x7ff6('0xb'),attributes,{'tableName':_0x7ff6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74fe=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./userFaxQueue.attributes','define'];(function(_0x2bb198,_0x16c4bc){var _0x2af343=function(_0x58fedd){while(--_0x58fedd){_0x2bb198['push'](_0x2bb198['shift']());}};_0x2af343(++_0x16c4bc);}(_0x74fe,0x178));var _0xe74f=function(_0x5b9280,_0x240763){_0x5b9280=_0x5b9280-0x0;var _0xef44a3=_0x74fe[_0x5b9280];return _0xef44a3;};'use strict';var _=require(_0xe74f('0x0'));var util=require(_0xe74f('0x1'));var logger=require(_0xe74f('0x2'))('api');var moment=require(_0xe74f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe74f('0x4'));var fs=require('fs');var path=require(_0xe74f('0x5'));var rimraf=require(_0xe74f('0x6'));var config=require('../../config/environment');var attributes=require(_0xe74f('0x7'));module['exports']=function(_0x3f02cc,_0x3e2935){return _0x3f02cc[_0xe74f('0x8')](_0xe74f('0x9'),attributes,{'tableName':_0xe74f('0xa'),'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 3641477..4d5e6b9 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 _0xd374=['jayson/promise','client','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x196b6e,_0x3c94b2){var _0x4e3630=function(_0x33ec3c){while(--_0x33ec3c){_0x196b6e['push'](_0x196b6e['shift']());}};_0x4e3630(++_0x3c94b2);}(_0xd374,0x14d));var _0x4d37=function(_0xca7135,_0xa058f5){_0xca7135=_0xca7135-0x0;var _0x2747dd=_0xd374[_0xca7135];return _0x2747dd;};'use strict';var _=require('lodash');var util=require(_0x4d37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d37('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d37('0x2'))['db'];var utils=require(_0x4d37('0x3'));var logger=require(_0x4d37('0x4'))(_0x4d37('0x5'));var config=require(_0x4d37('0x6'));var jayson=require(_0x4d37('0x7'));var client=jayson[_0x4d37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3874a8,_0x1d3b7d,_0x22bd66){return new BPromise(function(_0x2dff04,_0x62d21d){return client['request'](_0x3874a8,_0x22bd66)[_0x4d37('0x9')](function(_0x3d537f){logger[_0x4d37('0xa')]('UserFaxQueue,\x20%s,\x20%s',_0x1d3b7d,_0x4d37('0xb'));logger[_0x4d37('0xc')](_0x4d37('0xd'),_0x1d3b7d,_0x4d37('0xb'),JSON[_0x4d37('0xe')](_0x3d537f));if(_0x3d537f[_0x4d37('0xf')]){if(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x10')]===0x1f4){logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);return _0x62d21d(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);}logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);return _0x2dff04(_0x3d537f[_0x4d37('0xf')][_0x4d37('0x12')]);}else{logger[_0x4d37('0xa')](_0x4d37('0x11'),_0x1d3b7d,'request\x20sent');_0x2dff04(_0x3d537f[_0x4d37('0x13')][_0x4d37('0x12')]);}})['catch'](function(_0x468d01){logger[_0x4d37('0xf')](_0x4d37('0x11'),_0x1d3b7d,_0x468d01);_0x62d21d(_0x468d01);});});} \ No newline at end of file +var _0xcb7b=['stringify','error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x41f3f5,_0x4efe8f){var _0x1a0ed8=function(_0x1eaf46){while(--_0x1eaf46){_0x41f3f5['push'](_0x41f3f5['shift']());}};_0x1a0ed8(++_0x4efe8f);}(_0xcb7b,0xdf));var _0xbcb7=function(_0x48c45b,_0x592d0c){_0x48c45b=_0x48c45b-0x0;var _0x1b7a6e=_0xcb7b[_0x48c45b];return _0x1b7a6e;};'use strict';var _=require(_0xbcb7('0x0'));var util=require(_0xbcb7('0x1'));var moment=require(_0xbcb7('0x2'));var BPromise=require(_0xbcb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcb7('0x4'))['db'];var utils=require(_0xbcb7('0x5'));var logger=require(_0xbcb7('0x6'))(_0xbcb7('0x7'));var config=require(_0xbcb7('0x8'));var jayson=require(_0xbcb7('0x9'));var client=jayson[_0xbcb7('0xa')][_0xbcb7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31fde4,_0x2214f2,_0x5d5af2){return new BPromise(function(_0x3bf8e5,_0x488ea3){return client[_0xbcb7('0xc')](_0x31fde4,_0x5d5af2)[_0xbcb7('0xd')](function(_0x5e2a28){logger['info'](_0xbcb7('0xe'),_0x2214f2,'request\x20sent');logger[_0xbcb7('0xf')](_0xbcb7('0x10'),_0x2214f2,'request\x20sent',JSON[_0xbcb7('0x11')](_0x5e2a28));if(_0x5e2a28['error']){if(_0x5e2a28[_0xbcb7('0x12')][_0xbcb7('0x13')]===0x1f4){logger[_0xbcb7('0x12')](_0xbcb7('0xe'),_0x2214f2,_0x5e2a28['error'][_0xbcb7('0x14')]);return _0x488ea3(_0x5e2a28[_0xbcb7('0x12')]['message']);}logger[_0xbcb7('0x12')](_0xbcb7('0xe'),_0x2214f2,_0x5e2a28[_0xbcb7('0x12')][_0xbcb7('0x14')]);return _0x3bf8e5(_0x5e2a28[_0xbcb7('0x12')][_0xbcb7('0x14')]);}else{logger[_0xbcb7('0x15')](_0xbcb7('0xe'),_0x2214f2,_0xbcb7('0x16'));_0x3bf8e5(_0x5e2a28[_0xbcb7('0x17')][_0xbcb7('0x14')]);}})['catch'](function(_0x2dc5ea){logger[_0xbcb7('0x12')](_0xbcb7('0xe'),_0x2214f2,_0x2dc5ea);_0x488ea3(_0x2dc5ea);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 762a5f2..061d174 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(_0x1d652a,_0x1613be){var _0x16c18b=function(_0x13fb15){while(--_0x13fb15){_0x1d652a['push'](_0x1d652a['shift']());}};_0x16c18b(++_0x1613be);}(_0xe706,0xa3));var _0x6e70=function(_0x352713,_0x737610){_0x352713=_0x352713-0x0;var _0x46a4ea=_0xe706[_0x352713];return _0x46a4ea;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1ac3b8,_0x44e80a){var _0x3e05ef=function(_0x167885){while(--_0x167885){_0x1ac3b8['push'](_0x1ac3b8['shift']());}};_0x3e05ef(++_0x44e80a);}(_0x70e0,0x17b));var _0x070e=function(_0x4db71d,_0x2eeb2c){_0x4db71d=_0x4db71d-0x0;var _0x5bf7b5=_0x70e0[_0x4db71d];return _0x5bf7b5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 68683b4..56cc33c 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 _0x31dc=['sequelize','exports','INTEGER'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x31dc,0xc3));var _0xc31d=function(_0x13bfc5,_0x35b5b0){_0x13bfc5=_0x13bfc5-0x0;var _0x24d68d=_0x31dc[_0x13bfc5];return _0x24d68d;};'use strict';var Sequelize=require(_0xc31d('0x0'));module[_0xc31d('0x1')]={'penalty':{'type':Sequelize[_0xc31d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02d8=['INTEGER'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x02d8,0x11f));var _0x802d=function(_0x197abd,_0x1a5aee){_0x197abd=_0x197abd-0x0;var _0x54e9d7=_0x02d8[_0x197abd];return _0x54e9d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x802d('0x0')],'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 534979a..574d14a 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 _0xe4f9=['../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0xe5cf60,_0x35ee32){var _0x3c1f42=function(_0x577c00){while(--_0x577c00){_0xe5cf60['push'](_0xe5cf60['shift']());}};_0x3c1f42(++_0x35ee32);}(_0xe4f9,0xe2));var _0x9e4f=function(_0x55b22f,_0x5b22d4){_0x55b22f=_0x55b22f-0x0;var _0x6eb279=_0xe4f9[_0x55b22f];return _0x6eb279;};'use strict';var _=require(_0x9e4f('0x0'));var util=require(_0x9e4f('0x1'));var logger=require(_0x9e4f('0x2'))(_0x9e4f('0x3'));var moment=require(_0x9e4f('0x4'));var BPromise=require(_0x9e4f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4f('0x6'));var rimraf=require(_0x9e4f('0x7'));var config=require(_0x9e4f('0x8'));var attributes=require(_0x9e4f('0x9'));module[_0x9e4f('0xa')]=function(_0x32f6e0,_0x42f0b3){return _0x32f6e0[_0x9e4f('0xb')]('UserMailQueue',attributes,{'tableName':_0x9e4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6c1=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb6c1,0xcc));var _0x1b6c=function(_0x3b024c,_0x3a70bd){_0x3b024c=_0x3b024c-0x0;var _0x410e1f=_0xb6c1[_0x3b024c];return _0x410e1f;};'use strict';var _=require(_0x1b6c('0x0'));var util=require(_0x1b6c('0x1'));var logger=require(_0x1b6c('0x2'))(_0x1b6c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1b6c('0x4'));var fs=require('fs');var path=require(_0x1b6c('0x5'));var rimraf=require(_0x1b6c('0x6'));var config=require(_0x1b6c('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x1b6c('0x8')]=function(_0xcb27dd,_0x13ac8b){return _0xcb27dd[_0x1b6c('0x9')](_0x1b6c('0xa'),attributes,{'tableName':_0x1b6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index c4334c6..8658ffa 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7217,0x19e));var _0x7721=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7217[_0x13ea00];return _0x1f7347;};'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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x18e411,_0x1239af){var _0x374a67=function(_0x3ad685){while(--_0x3ad685){_0x18e411['push'](_0x18e411['shift']());}};_0x374a67(++_0x1239af);}(_0x34e8,0x12c));var _0x834e=function(_0x90815e,_0x4d5619){_0x90815e=_0x90815e-0x0;var _0x506ba4=_0x34e8[_0x90815e];return _0x506ba4;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index fb3fd87..bf99729 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 _0xf8c3=['util','path','Router','fs-extra','../../components/auth/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf8c3,0xa9));var _0x3f8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f8c('0x0'));var util=require(_0x3f8c('0x1'));var path=require(_0x3f8c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f8c('0x3')]();var fs_extra=require(_0x3f8c('0x4'));var auth=require(_0x3f8c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3f8c('0x6'));router['post']('/',auth[_0x3f8c('0x7')](),controller[_0x3f8c('0x8')]);module[_0x3f8c('0x9')]=router; \ No newline at end of file +var _0xfa2c=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','post','isAuthenticated','exports'];(function(_0x1d476f,_0x63d2e7){var _0x463e2c=function(_0x21ffd2){while(--_0x21ffd2){_0x1d476f['push'](_0x1d476f['shift']());}};_0x463e2c(++_0x63d2e7);}(_0xfa2c,0xfa));var _0xcfa2=function(_0x1827ef,_0x4b531f){_0x1827ef=_0x1827ef-0x0;var _0x1b8e39=_0xfa2c[_0x1827ef];return _0x1b8e39;};'use strict';var multer=require('multer');var util=require(_0xcfa2('0x0'));var path=require(_0xcfa2('0x1'));var timeout=require('connect-timeout');var express=require(_0xcfa2('0x2'));var router=express[_0xcfa2('0x3')]();var fs_extra=require(_0xcfa2('0x4'));var auth=require(_0xcfa2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfa2('0x6'));var controller=require('./userNotification.controller');router[_0xcfa2('0x7')]('/',auth[_0xcfa2('0x8')](),controller['sendUserNotification']);module[_0xcfa2('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index d3b517d..b6a8984 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 _0x0e03=['STRING','sequelize','TEXT'];(function(_0x15ec35,_0x5b9972){var _0x937cce=function(_0x59326b){while(--_0x59326b){_0x15ec35['push'](_0x15ec35['shift']());}};_0x937cce(++_0x5b9972);}(_0x0e03,0x1bd));var _0x30e0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x0e03[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0x30e0('0x0'));module['exports']={'body':{'type':Sequelize[_0x30e0('0x1')]},'senderName':{'type':Sequelize[_0x30e0('0x2')]},'recipientsId':{'type':Sequelize[_0x30e0('0x1')]},'recipientsDescription':{'type':Sequelize[_0x30e0('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xf18a=['STRING','sequelize','TEXT'];(function(_0x4593c8,_0x4c9259){var _0x3a3839=function(_0x4b1963){while(--_0x4b1963){_0x4593c8['push'](_0x4593c8['shift']());}};_0x3a3839(++_0x4c9259);}(_0xf18a,0x1bd));var _0xaf18=function(_0x22288b,_0x3155bf){_0x22288b=_0x22288b-0x0;var _0x25179e=_0xf18a[_0x22288b];return _0x25179e;};'use strict';var Sequelize=require(_0xaf18('0x0'));module['exports']={'body':{'type':Sequelize[_0xaf18('0x1')]},'senderName':{'type':Sequelize[_0xaf18('0x2')]},'recipientsId':{'type':Sequelize[_0xaf18('0x1')]},'recipientsDescription':{'type':Sequelize[_0xaf18('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 27d585c..56dad6a 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 _0x088c=['rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','hasOwnProperty','body','TemplateId','ValidationError','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','toLowerCase','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','html','view','startCase','model','User','union','includes','replace','queue','Queue','ids','flatten','getAgents','map','eml-format'];(function(_0x75b352,_0xcf29c9){var _0x4b08dc=function(_0x4e0232){while(--_0x4e0232){_0x75b352['push'](_0x75b352['shift']());}};_0x4b08dc(++_0xcf29c9);}(_0x088c,0x11f));var _0xc088=function(_0x3c45d8,_0x5a303e){_0x3c45d8=_0x3c45d8-0x0;var _0x1b8213=_0x088c[_0x3c45d8];return _0x1b8213;};'use strict';var emlformat=require(_0xc088('0x0'));var rimraf=require(_0xc088('0x1'));var zipdir=require(_0xc088('0x2'));var jsonpatch=require(_0xc088('0x3'));var rp=require(_0xc088('0x4'));var moment=require(_0xc088('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc088('0x6'));var sox=require('sox');var csv=require(_0xc088('0x7'));var ejs=require(_0xc088('0x8'));var fs=require('fs');var fs_extra=require(_0xc088('0x9'));var _=require(_0xc088('0xa'));var squel=require(_0xc088('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc088('0xc'));var toCsv=require(_0xc088('0x7'));var querystring=require('querystring');var Papa=require(_0xc088('0xd'));var Redis=require(_0xc088('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc088('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc088('0x10'))('api');var utils=require(_0xc088('0x11'));var config=require(_0xc088('0x12'));var licenseUtil=require(_0xc088('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc088('0x14')](config[_0xc088('0x15')],{'host':_0xc088('0x16'),'port':0x18eb});var socket=require(_0xc088('0x17'))(new Redis(config[_0xc088('0x15')]));require('./userNotification.socket')[_0xc088('0x18')](socket);function respondWithStatusCode(_0x37396d,_0x5164cd){_0x5164cd=_0x5164cd||0xcc;return function(_0x4a2934){if(_0x4a2934){return _0x37396d[_0xc088('0x19')](_0x5164cd);}return _0x37396d[_0xc088('0x1a')](_0x5164cd)[_0xc088('0x1b')]();};}function respondWithResult(_0x133e92,_0x1cd9dd){_0x1cd9dd=_0x1cd9dd||0xc8;return function(_0x56f9e7){if(_0x56f9e7){return _0x133e92['status'](_0x1cd9dd)['json'](_0x56f9e7);}};}function respondWithFilteredResult(_0x5d6497,_0x3e8b30){return function(_0x2006ad){if(_0x2006ad){var _0x5791f0=typeof _0x3e8b30[_0xc088('0x1c')]===_0xc088('0x1d')&&typeof _0x3e8b30[_0xc088('0x1e')]===_0xc088('0x1d');var _0xd7f5b2=_0x2006ad[_0xc088('0x1f')];var _0x4c64de=_0x5791f0?0x0:_0x3e8b30[_0xc088('0x1c')];var _0x58a9f8=_0x5791f0?_0x2006ad[_0xc088('0x1f')]:_0x3e8b30['offset']+_0x3e8b30[_0xc088('0x1e')];var _0x241294;if(_0x58a9f8>=_0xd7f5b2){_0x58a9f8=_0xd7f5b2;_0x241294=0xc8;}else{_0x241294=0xce;}_0x5d6497[_0xc088('0x1a')](_0x241294);return _0x5d6497[_0xc088('0x20')](_0xc088('0x21'),_0x4c64de+'-'+_0x58a9f8+'/'+_0xd7f5b2)[_0xc088('0x22')](_0x2006ad);}return null;};}function patchUpdates(_0x1b71f2){return function(_0xe9fd50){try{jsonpatch[_0xc088('0x23')](_0xe9fd50,_0x1b71f2,!![]);}catch(_0x527128){return BPromise[_0xc088('0x24')](_0x527128);}return _0xe9fd50[_0xc088('0x25')]();};}function saveUpdates(_0x4ec896,_0x424365){return function(_0x4ebec7){if(_0x4ebec7){return _0x4ebec7[_0xc088('0x26')](_0x4ec896)[_0xc088('0x27')](function(_0x50ddff){return _0x50ddff;});}return null;};}function removeEntity(_0x1100f2,_0x3376cd){return function(_0x496661){if(_0x496661){return _0x496661[_0xc088('0x28')]()[_0xc088('0x27')](function(){_0x1100f2[_0xc088('0x1a')](0xcc)[_0xc088('0x1b')]();});}};}function handleEntityNotFound(_0x2718a1,_0x3e306e){return function(_0x103b81){if(!_0x103b81){_0x2718a1[_0xc088('0x19')](0x194);}return _0x103b81;};}function handleError(_0x1616a6,_0x2dec3b){_0x2dec3b=_0x2dec3b||0x1f4;return function(_0x102ae0){logger['error'](_0x102ae0['stack']);if(_0x102ae0[_0xc088('0x29')]){delete _0x102ae0[_0xc088('0x29')];}_0x1616a6['status'](_0x2dec3b)[_0xc088('0x2a')](_0x102ae0);};}exports['sendUserNotification']=function(_0x3e99cc,_0x5a0248,_0x957805){if(!_0x3e99cc['body'][_0xc088('0x2b')]('text')&&!_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')](_0xc088('0x2d'))){throw new db['Sequelize'][(_0xc088('0x2e'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')](_0xc088('0x2d'))&&!_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2b')]('view')){throw new db['Sequelize']['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x3e99cc['body']['hasOwnProperty'](_0xc088('0x2f'))){throw new db[(_0xc088('0x30'))]['ValidationError'](_0xc088('0x31'));}else{try{var _0xfacbc7=JSON[_0xc088('0x32')](_0x3e99cc[_0xc088('0x2c')][_0xc088('0x2f')]);}catch(_0x96a020){logger[_0xc088('0x33')](_0x96a020);throw new db['Sequelize']['ValidationError'](_0xc088('0x34'));}var _0x548d50=[_0xc088('0x35'),_0xc088('0x36'),_0xc088('0x37'),_0xc088('0x38'),_0xc088('0x39'),_0xc088('0x3a'),_0xc088('0x3b'),_0xc088('0x3c'),_0xc088('0x3d')];if(_['some'](_0xfacbc7,function(_0x2baa72){return!_['includes'](_0x548d50,_0x2baa72['model'][_0xc088('0x3e')]());})){throw new db['Sequelize'][(_0xc088('0x2e'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x13dc3f={};_0x13dc3f[_0xc088('0x3f')]=_0x3e99cc[_0xc088('0x2c')]['hasOwnProperty'](_0xc088('0x3f'))?_0x3e99cc[_0xc088('0x2c')][_0xc088('0x3f')]:_0x3e99cc[_0xc088('0x3d')][_0xc088('0x40')];_0x13dc3f['recipientsDescription']=_[_0xc088('0x41')](_0x3e99cc[_0xc088('0x2c')][_0xc088('0x42')])?null:_0x3e99cc['body'][_0xc088('0x42')];_0x13dc3f[_0xc088('0x43')]=_0x3e99cc[_0xc088('0x2c')]['beep']||![];_0x13dc3f[_0xc088('0x44')]=_0x3e99cc[_0xc088('0x3d')]['id'];return getContent(_0x3e99cc[_0xc088('0x2c')])[_0xc088('0x27')](function(_0x1f630f){_0x13dc3f['body']=_0x1f630f;return getRecipients(_0xfacbc7);})[_0xc088('0x27')](function(_0x556eda){_0x13dc3f[_0xc088('0x45')]=_[_0xc088('0x46')](_0x556eda)[_0xc088('0x47')](',');return db['sequelize']['transaction'](function(_0x4546e1){return db[_0xc088('0x48')][_0xc088('0x49')](_0x13dc3f,{'raw':!![],'transaction':_0x4546e1})[_0xc088('0x27')](function(_0x545ca7){var _0x37ee66={'sender':_0x13dc3f['senderName'],'description':_0x13dc3f[_0xc088('0x42')],'content':_0x13dc3f[_0xc088('0x2c')],'beep':_0x13dc3f[_0xc088('0x43')]};_0x556eda[_0xc088('0x4a')](function(_0x28a330){_0x37ee66[_0xc088('0x4b')]=_0x28a330;socket[_0xc088('0x4c')](_0xc088('0x4d'),_0x37ee66);});return _0x545ca7;});});})[_0xc088('0x27')](respondWithResult(_0x5a0248,0xc9))[_0xc088('0x4e')](handleError(_0x5a0248,null));};function getContent(_0x5ad53a){return new BPromise(function(_0x587a90,_0x123f70){if(_0x5ad53a[_0xc088('0x4f')]){_0x587a90(_0x5ad53a[_0xc088('0x4f')]);return;}return db[_0xc088('0x50')][_0xc088('0x51')]({'attributes':[_0xc088('0x52')],'where':{'id':_0x5ad53a[_0xc088('0x2d')]},'raw':!![]})[_0xc088('0x27')](function(_0x4d85ff){if(!_0x4d85ff)throw new db[(_0xc088('0x30'))][(_0xc088('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xf4b031=Mustache['render'](_0x4d85ff[_0xc088('0x52')],_0x5ad53a[_0xc088('0x53')]);_0x587a90(_0xf4b031);})['catch'](function(_0xc9b0b1){_0x123f70(_0xc9b0b1);});});}function getRecipients(_0x29c945){return new BPromise(function(_0x4b0a7f,_0x149e66){var _0x2760a0=[];var _0x5d2103=[];_0x29c945[_0xc088('0x4a')](function(_0x2bced7){var _0x2336a2=_[_0xc088('0x54')](_0x2bced7[_0xc088('0x55')][_0xc088('0x3e')]());if(_0x2336a2===_0xc088('0x56')){_0x2760a0=_[_0xc088('0x57')](_0x2760a0,_0x2bced7['ids']);}else{if(_[_0xc088('0x58')](_0x2336a2,'queue'))_0x2336a2=_0x2336a2[_0xc088('0x59')](_0xc088('0x5a'),_0xc088('0x5b'));_0x2bced7[_0xc088('0x5c')][_0xc088('0x4a')](function(_0x332954){_0x5d2103['push'](getAgents(_0x2336a2,_0x332954));});}});return BPromise['all'](_0x5d2103)[_0xc088('0x27')](function(_0x2b36d5){_0x2760a0=_[_0xc088('0x57')](_0x2760a0,_[_0xc088('0x5d')](_0x2b36d5));_0x4b0a7f(_0x2760a0);})[_0xc088('0x4e')](function(_0x35f9de){_0x149e66(_0x35f9de);});});}function getAgents(_0x3886d7,_0x5ac89c){return new BPromise(function(_0x5750aa,_0x247bbf){return db[_0x3886d7]['findOne']({'where':{'id':_0x5ac89c}})[_0xc088('0x27')](function(_0x4138ce){return _0x4138ce[_0xc088('0x5e')]({'attributes':['id'],'raw':!![]})[_0xc088('0x27')](function(_0x16a52d){var _0x3c46c6=_[_0xc088('0x5f')](_0x16a52d,'id');_0x5750aa(_0x3c46c6);});})['catch'](function(_0x218016){_0x247bbf(_0x218016);});});} \ No newline at end of file +var _0x3fad=['UserNotification','create','recipient','userNotification:send','catch','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','forEach','User','ids','queue','push','all','union','flatten','findOne','map','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','parse','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','senderName','fullname','recipientsDescription','beep','recipientsId','join'];(function(_0x5e1048,_0x5dd984){var _0x37aac1=function(_0x35bdf9){while(--_0x35bdf9){_0x5e1048['push'](_0x5e1048['shift']());}};_0x37aac1(++_0x5dd984);}(_0x3fad,0x123));var _0xd3fa=function(_0x4c9890,_0x462102){_0x4c9890=_0x4c9890-0x0;var _0x4248d9=_0x3fad[_0x4c9890];return _0x4248d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3fa('0x0'));var zipdir=require(_0xd3fa('0x1'));var jsonpatch=require(_0xd3fa('0x2'));var rp=require(_0xd3fa('0x3'));var moment=require(_0xd3fa('0x4'));var BPromise=require(_0xd3fa('0x5'));var Mustache=require(_0xd3fa('0x6'));var util=require(_0xd3fa('0x7'));var path=require('path');var sox=require(_0xd3fa('0x8'));var csv=require(_0xd3fa('0x9'));var ejs=require(_0xd3fa('0xa'));var fs=require('fs');var fs_extra=require(_0xd3fa('0xb'));var _=require(_0xd3fa('0xc'));var squel=require(_0xd3fa('0xd'));var crypto=require(_0xd3fa('0xe'));var jsforce=require(_0xd3fa('0xf'));var deskjs=require(_0xd3fa('0x10'));var toCsv=require(_0xd3fa('0x9'));var querystring=require(_0xd3fa('0x11'));var Papa=require(_0xd3fa('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd3fa('0x13'));var as=require(_0xd3fa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3fa('0x15'))(_0xd3fa('0x16'));var utils=require('../../config/utils');var config=require(_0xd3fa('0x17'));var licenseUtil=require(_0xd3fa('0x18'));var db=require(_0xd3fa('0x19'))['db'];config[_0xd3fa('0x1a')]=_[_0xd3fa('0x1b')](config[_0xd3fa('0x1a')],{'host':_0xd3fa('0x1c'),'port':0x18eb});var socket=require(_0xd3fa('0x1d'))(new Redis(config[_0xd3fa('0x1a')]));require(_0xd3fa('0x1e'))['register'](socket);function respondWithStatusCode(_0x3fadbe,_0xa9a41a){_0xa9a41a=_0xa9a41a||0xcc;return function(_0x57d5af){if(_0x57d5af){return _0x3fadbe['sendStatus'](_0xa9a41a);}return _0x3fadbe['status'](_0xa9a41a)[_0xd3fa('0x1f')]();};}function respondWithResult(_0x43bc96,_0x5b5b73){_0x5b5b73=_0x5b5b73||0xc8;return function(_0x322688){if(_0x322688){return _0x43bc96['status'](_0x5b5b73)[_0xd3fa('0x20')](_0x322688);}};}function respondWithFilteredResult(_0x396383,_0x565114){return function(_0x5ad882){if(_0x5ad882){var _0x5001c4=typeof _0x565114[_0xd3fa('0x21')]===_0xd3fa('0x22')&&typeof _0x565114[_0xd3fa('0x23')]===_0xd3fa('0x22');var _0x2ebb08=_0x5ad882[_0xd3fa('0x24')];var _0x245439=_0x5001c4?0x0:_0x565114[_0xd3fa('0x21')];var _0x87bd58=_0x5001c4?_0x5ad882[_0xd3fa('0x24')]:_0x565114[_0xd3fa('0x21')]+_0x565114[_0xd3fa('0x23')];var _0x23d897;if(_0x87bd58>=_0x2ebb08){_0x87bd58=_0x2ebb08;_0x23d897=0xc8;}else{_0x23d897=0xce;}_0x396383[_0xd3fa('0x25')](_0x23d897);return _0x396383[_0xd3fa('0x26')](_0xd3fa('0x27'),_0x245439+'-'+_0x87bd58+'/'+_0x2ebb08)['json'](_0x5ad882);}return null;};}function patchUpdates(_0x5594a9){return function(_0x42f07a){try{jsonpatch['apply'](_0x42f07a,_0x5594a9,!![]);}catch(_0x3d3b5d){return BPromise[_0xd3fa('0x28')](_0x3d3b5d);}return _0x42f07a[_0xd3fa('0x29')]();};}function saveUpdates(_0x42d925,_0x372016){return function(_0x11e69f){if(_0x11e69f){return _0x11e69f[_0xd3fa('0x2a')](_0x42d925)[_0xd3fa('0x2b')](function(_0x23a446){return _0x23a446;});}return null;};}function removeEntity(_0x2dc0c2,_0x3aec48){return function(_0x2a8c3a){if(_0x2a8c3a){return _0x2a8c3a[_0xd3fa('0x2c')]()['then'](function(){_0x2dc0c2[_0xd3fa('0x25')](0xcc)[_0xd3fa('0x1f')]();});}};}function handleEntityNotFound(_0x327405,_0x3d8ac9){return function(_0x232b26){if(!_0x232b26){_0x327405['sendStatus'](0x194);}return _0x232b26;};}function handleError(_0x2e55cc,_0x5ac00f){_0x5ac00f=_0x5ac00f||0x1f4;return function(_0x319443){logger[_0xd3fa('0x2d')](_0x319443[_0xd3fa('0x2e')]);if(_0x319443['name']){delete _0x319443[_0xd3fa('0x2f')];}_0x2e55cc[_0xd3fa('0x25')](_0x5ac00f)[_0xd3fa('0x30')](_0x319443);};}exports['sendUserNotification']=function(_0x1c9f09,_0x38c968,_0x69f435){if(!_0x1c9f09[_0xd3fa('0x31')]['hasOwnProperty'](_0xd3fa('0x32'))&&!_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x33')](_0xd3fa('0x34'))){throw new db[(_0xd3fa('0x35'))][(_0xd3fa('0x36'))](_0xd3fa('0x37'));}else{if(_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x33')](_0xd3fa('0x34'))&&!_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x33')]('view')){throw new db[(_0xd3fa('0x35'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x1c9f09[_0xd3fa('0x31')]['hasOwnProperty'](_0xd3fa('0x38'))){throw new db[(_0xd3fa('0x35'))][(_0xd3fa('0x36'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x43f82c=JSON[_0xd3fa('0x39')](_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x38')]);}catch(_0x38f7b0){logger[_0xd3fa('0x2d')](_0x38f7b0);throw new db[(_0xd3fa('0x35'))][(_0xd3fa('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x4ee009=[_0xd3fa('0x3a'),'faxqueue','mailqueue',_0xd3fa('0x3b'),_0xd3fa('0x3c'),_0xd3fa('0x3d'),_0xd3fa('0x3e'),_0xd3fa('0x3f'),_0xd3fa('0x40')];if(_['some'](_0x43f82c,function(_0x532e48){return!_['includes'](_0x4ee009,_0x532e48[_0xd3fa('0x41')][_0xd3fa('0x42')]());})){throw new db[(_0xd3fa('0x35'))][(_0xd3fa('0x36'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3d8ba3={};_0x3d8ba3[_0xd3fa('0x43')]=_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x33')](_0xd3fa('0x43'))?_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x43')]:_0x1c9f09[_0xd3fa('0x40')][_0xd3fa('0x44')];_0x3d8ba3['recipientsDescription']=_['isEmpty'](_0x1c9f09[_0xd3fa('0x31')]['recipientsDescription'])?null:_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x45')];_0x3d8ba3['beep']=_0x1c9f09[_0xd3fa('0x31')][_0xd3fa('0x46')]||![];_0x3d8ba3['SenderId']=_0x1c9f09['user']['id'];return getContent(_0x1c9f09[_0xd3fa('0x31')])['then'](function(_0x2525c0){_0x3d8ba3[_0xd3fa('0x31')]=_0x2525c0;return getRecipients(_0x43f82c);})[_0xd3fa('0x2b')](function(_0x2e2f07){_0x3d8ba3[_0xd3fa('0x47')]=_['sortBy'](_0x2e2f07)[_0xd3fa('0x48')](',');return db['sequelize']['transaction'](function(_0x411c1d){return db[_0xd3fa('0x49')][_0xd3fa('0x4a')](_0x3d8ba3,{'raw':!![],'transaction':_0x411c1d})['then'](function(_0x152b58){var _0x431deb={'sender':_0x3d8ba3[_0xd3fa('0x43')],'description':_0x3d8ba3[_0xd3fa('0x45')],'content':_0x3d8ba3['body'],'beep':_0x3d8ba3[_0xd3fa('0x46')]};_0x2e2f07['forEach'](function(_0x331928){_0x431deb[_0xd3fa('0x4b')]=_0x331928;socket['emit'](_0xd3fa('0x4c'),_0x431deb);});return _0x152b58;});});})['then'](respondWithResult(_0x38c968,0xc9))[_0xd3fa('0x4d')](handleError(_0x38c968,null));};function getContent(_0x38a903){return new BPromise(function(_0x2ee0f6,_0x416165){if(_0x38a903[_0xd3fa('0x32')]){_0x2ee0f6(_0x38a903[_0xd3fa('0x32')]);return;}return db['Template']['findOne']({'attributes':[_0xd3fa('0x4e')],'where':{'id':_0x38a903[_0xd3fa('0x34')]},'raw':!![]})[_0xd3fa('0x2b')](function(_0x8ae414){if(!_0x8ae414)throw new db['Sequelize'][(_0xd3fa('0x36'))](_0xd3fa('0x4f'));var _0x362794=Mustache['render'](_0x8ae414[_0xd3fa('0x4e')],_0x38a903[_0xd3fa('0x50')]);_0x2ee0f6(_0x362794);})['catch'](function(_0x42329a){_0x416165(_0x42329a);});});}function getRecipients(_0x9cd750){return new BPromise(function(_0x34b9c6,_0x2ff670){var _0x1c4f85=[];var _0x2fc6f=[];_0x9cd750[_0xd3fa('0x51')](function(_0x310d76){var _0x2fd7a8=_['startCase'](_0x310d76[_0xd3fa('0x41')][_0xd3fa('0x42')]());if(_0x2fd7a8===_0xd3fa('0x52')){_0x1c4f85=_['union'](_0x1c4f85,_0x310d76[_0xd3fa('0x53')]);}else{if(_['includes'](_0x2fd7a8,_0xd3fa('0x54')))_0x2fd7a8=_0x2fd7a8['replace']('queue','Queue');_0x310d76[_0xd3fa('0x53')][_0xd3fa('0x51')](function(_0x2a2c81){_0x2fc6f[_0xd3fa('0x55')](getAgents(_0x2fd7a8,_0x2a2c81));});}});return BPromise[_0xd3fa('0x56')](_0x2fc6f)[_0xd3fa('0x2b')](function(_0x167440){_0x1c4f85=_[_0xd3fa('0x57')](_0x1c4f85,_[_0xd3fa('0x58')](_0x167440));_0x34b9c6(_0x1c4f85);})[_0xd3fa('0x4d')](function(_0x543fb9){_0x2ff670(_0x543fb9);});});}function getAgents(_0xbdfcc4,_0x487ac7){return new BPromise(function(_0x502b1e,_0xe1910){return db[_0xbdfcc4][_0xd3fa('0x59')]({'where':{'id':_0x487ac7}})[_0xd3fa('0x2b')](function(_0x182738){return _0x182738['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x30fa7f){var _0x256e5c=_[_0xd3fa('0x5a')](_0x30fa7f,'id');_0x502b1e(_0x256e5c);});})['catch'](function(_0x1c67e4){_0xe1910(_0x1c67e4);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7aa9c45..773f153 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 _0x738b=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f9d83,_0xfbc7e7){var _0x112d5f=function(_0x513735){while(--_0x513735){_0x2f9d83['push'](_0x2f9d83['shift']());}};_0x112d5f(++_0xfbc7e7);}(_0x738b,0x19e));var _0xb738=function(_0x37ca3b,_0x116dad){_0x37ca3b=_0x37ca3b-0x0;var _0x5c2cf1=_0x738b[_0x37ca3b];return _0x5c2cf1;};'use strict';var EventEmitter=require(_0xb738('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb738('0x1')](0x0);var events={'afterCreate':_0xb738('0x2'),'afterUpdate':_0xb738('0x3'),'afterDestroy':_0xb738('0x4')};function emitEvent(_0x5527a6){return function(_0x50fda2,_0x3cfdaa,_0x131bc4){UserNotificationEvents[_0xb738('0x5')](_0x5527a6+':'+_0x50fda2['id'],_0x50fda2);UserNotificationEvents[_0xb738('0x5')](_0x5527a6,_0x50fda2);_0x131bc4(null);};}for(var e in events){if(events[_0xb738('0x6')](e)){var event=events[e];UserNotification[_0xb738('0x7')](e,emitEvent(event));}}module[_0xb738('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x3e4b=['UserNotification','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x84cc6c,_0x3d0495){var _0x139006=function(_0x53e0f6){while(--_0x53e0f6){_0x84cc6c['push'](_0x84cc6c['shift']());}};_0x139006(++_0x3d0495);}(_0x3e4b,0x10c));var _0xb3e4=function(_0x28d9ad,_0x3af957){_0x28d9ad=_0x28d9ad-0x0;var _0x47fb23=_0x3e4b[_0x28d9ad];return _0x47fb23;};'use strict';var EventEmitter=require(_0xb3e4('0x0'));var UserNotification=require(_0xb3e4('0x1'))['db'][_0xb3e4('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb3e4('0x3')](0x0);var events={'afterCreate':_0xb3e4('0x4'),'afterUpdate':_0xb3e4('0x5'),'afterDestroy':_0xb3e4('0x6')};function emitEvent(_0x122e53){return function(_0x5ce3f5,_0x38e90e,_0x4b583f){UserNotificationEvents['emit'](_0x122e53+':'+_0x5ce3f5['id'],_0x5ce3f5);UserNotificationEvents[_0xb3e4('0x7')](_0x122e53,_0x5ce3f5);_0x4b583f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xb3e4('0x8')](e,emitEvent(event));}}module[_0xb3e4('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ab6314a..de68559 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 _0xb0d3=['util','api','moment','bluebird','request-promise','path','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x491ec9,_0x48658f){var _0x1edaee=function(_0x107107){while(--_0x107107){_0x491ec9['push'](_0x491ec9['shift']());}};_0x1edaee(++_0x48658f);}(_0xb0d3,0x137));var _0x3b0d=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0xb0d3[_0x20ae13];return _0x533fd5;};'use strict';var _=require(_0x3b0d('0x0'));var util=require(_0x3b0d('0x1'));var logger=require('../../config/logger')(_0x3b0d('0x2'));var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var rp=require(_0x3b0d('0x5'));var fs=require('fs');var path=require(_0x3b0d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x3b0d('0x7')]=function(_0x12ef6f,_0x1738e2){return _0x12ef6f['define'](_0x3b0d('0x8'),attributes,{'tableName':_0x3b0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b0d('0xa'),'collate':_0x3b0d('0xb')});}; \ No newline at end of file +var _0xfbcb=['define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports'];(function(_0x5d3276,_0xd38063){var _0x3562f5=function(_0x5c5594){while(--_0x5c5594){_0x5d3276['push'](_0x5d3276['shift']());}};_0x3562f5(++_0xd38063);}(_0xfbcb,0x93));var _0xbfbc=function(_0x3b67cd,_0x325527){_0x3b67cd=_0x3b67cd-0x0;var _0x1ac6ec=_0xfbcb[_0x3b67cd];return _0x1ac6ec;};'use strict';var _=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var logger=require(_0xbfbc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbfbc('0x3'));var fs=require('fs');var path=require(_0xbfbc('0x4'));var rimraf=require(_0xbfbc('0x5'));var config=require(_0xbfbc('0x6'));var attributes=require(_0xbfbc('0x7'));module[_0xbfbc('0x8')]=function(_0x2b280d,_0x3536e5){return _0x2b280d[_0xbfbc('0x9')]('UserNotification',attributes,{'tableName':_0xbfbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfbc('0xb'),'collate':_0xbfbc('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e43ac08..b75d82b 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 _0x2c06=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s','message','error','result','catch','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2c06,0x143));var _0x62c0=function(_0x1a77b3,_0x506cf5){_0x1a77b3=_0x1a77b3-0x0;var _0x556fc2=_0x2c06[_0x1a77b3];return _0x556fc2;};'use strict';var _=require(_0x62c0('0x0'));var util=require(_0x62c0('0x1'));var moment=require(_0x62c0('0x2'));var BPromise=require(_0x62c0('0x3'));var rs=require(_0x62c0('0x4'));var fs=require('fs');var Redis=require(_0x62c0('0x5'));var db=require(_0x62c0('0x6'))['db'];var utils=require(_0x62c0('0x7'));var logger=require('../../config/logger')(_0x62c0('0x8'));var config=require(_0x62c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x62c0('0xa')][_0x62c0('0xb')]({'port':0x232a});config[_0x62c0('0xc')]=_[_0x62c0('0xd')](config[_0x62c0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x62c0('0xe'))(new Redis(config['redis']));require(_0x62c0('0xf'))['register'](socket);function respondWithRpcPromise(_0x251d9d,_0x4df72a,_0x1c4553){return new BPromise(function(_0x550a7b,_0x38705d){return client[_0x62c0('0x10')](_0x251d9d,_0x1c4553)[_0x62c0('0x11')](function(_0x33b1c2){logger[_0x62c0('0x12')]('UserNotification,\x20%s,\x20%s',_0x4df72a,'request\x20sent');logger[_0x62c0('0x13')](_0x62c0('0x14'),_0x4df72a,_0x62c0('0x15'),JSON['stringify'](_0x33b1c2));if(_0x33b1c2['error']){if(_0x33b1c2['error']['code']===0x1f4){logger['error'](_0x62c0('0x16'),_0x4df72a,_0x33b1c2['error'][_0x62c0('0x17')]);return _0x38705d(_0x33b1c2['error'][_0x62c0('0x17')]);}logger[_0x62c0('0x18')]('UserNotification,\x20%s,\x20%s',_0x4df72a,_0x33b1c2[_0x62c0('0x18')][_0x62c0('0x17')]);return _0x550a7b(_0x33b1c2[_0x62c0('0x18')]['message']);}else{logger[_0x62c0('0x12')](_0x62c0('0x16'),_0x4df72a,'request\x20sent');_0x550a7b(_0x33b1c2[_0x62c0('0x19')][_0x62c0('0x17')]);}})[_0x62c0('0x1a')](function(_0x50abbf){logger[_0x62c0('0x18')](_0x62c0('0x16'),_0x4df72a,_0x50abbf);_0x38705d(_0x50abbf);});});} \ No newline at end of file +var _0x616b=['register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','jayson/promise','client','http','defaults','redis','./userNotification.socket'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x616b,0x68));var _0xb616=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0x616b[_0x4ac424];return _0xe1b890;};'use strict';var _=require(_0xb616('0x0'));var util=require(_0xb616('0x1'));var moment=require(_0xb616('0x2'));var BPromise=require(_0xb616('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb616('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb616('0x5'));var client=jayson[_0xb616('0x6')][_0xb616('0x7')]({'port':0x232a});config['redis']=_[_0xb616('0x8')](config[_0xb616('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb616('0x9')]));require(_0xb616('0xa'))[_0xb616('0xb')](socket);function respondWithRpcPromise(_0x2a7225,_0x1a52d2,_0x409502){return new BPromise(function(_0x293cfa,_0x4a0070){return client['request'](_0x2a7225,_0x409502)[_0xb616('0xc')](function(_0x568720){logger['info'](_0xb616('0xd'),_0x1a52d2,_0xb616('0xe'));logger[_0xb616('0xf')](_0xb616('0x10'),_0x1a52d2,'request\x20sent',JSON[_0xb616('0x11')](_0x568720));if(_0x568720[_0xb616('0x12')]){if(_0x568720[_0xb616('0x12')][_0xb616('0x13')]===0x1f4){logger[_0xb616('0x12')](_0xb616('0xd'),_0x1a52d2,_0x568720['error']['message']);return _0x4a0070(_0x568720[_0xb616('0x12')][_0xb616('0x14')]);}logger[_0xb616('0x12')](_0xb616('0xd'),_0x1a52d2,_0x568720[_0xb616('0x12')][_0xb616('0x14')]);return _0x293cfa(_0x568720['error']['message']);}else{logger['info'](_0xb616('0xd'),_0x1a52d2,'request\x20sent');_0x293cfa(_0x568720[_0xb616('0x15')]['message']);}})[_0xb616('0x16')](function(_0x2f5489){logger['error']('UserNotification,\x20%s,\x20%s',_0x1a52d2,_0x2f5489);_0x4a0070(_0x2f5489);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 788722b..4189438 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 _0x27c5=['./userNotification.events','save','remove','removeListener','length','userNotification:'];(function(_0xb6c101,_0x5bd93d){var _0x163d78=function(_0xf77b12){while(--_0xf77b12){_0xb6c101['push'](_0xb6c101['shift']());}};_0x163d78(++_0x5bd93d);}(_0x27c5,0x1f2));var _0x527c=function(_0x533bf7,_0x29485b){_0x533bf7=_0x533bf7-0x0;var _0x9e4c57=_0x27c5[_0x533bf7];return _0x9e4c57;};'use strict';var UserNotificationEvents=require(_0x527c('0x0'));var events=[_0x527c('0x1'),_0x527c('0x2'),'update'];function createListener(_0x5bf719,_0x472f62){return function(_0x1a1cb4){_0x472f62['emit'](_0x5bf719,_0x1a1cb4);};}function removeListener(_0x4300c2,_0x5074a2){return function(){UserNotificationEvents[_0x527c('0x3')](_0x4300c2,_0x5074a2);};}exports['register']=function(_0x3f5e94){for(var _0xb698b6=0x0,_0x495361=events[_0x527c('0x4')];_0xb698b6<_0x495361;_0xb698b6++){var _0x322261=events[_0xb698b6];var _0x3f0934=createListener(_0x527c('0x5')+_0x322261,_0x3f5e94);UserNotificationEvents['on'](_0x322261,_0x3f0934);}}; \ No newline at end of file +var _0x4f71=['save','update','removeListener','length','userNotification:','./userNotification.events'];(function(_0x5f2a46,_0x3fd5ee){var _0x551bc6=function(_0xb22adc){while(--_0xb22adc){_0x5f2a46['push'](_0x5f2a46['shift']());}};_0x551bc6(++_0x3fd5ee);}(_0x4f71,0x185));var _0x14f7=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x4f71[_0x173d7e];return _0x2220d6;};'use strict';var UserNotificationEvents=require(_0x14f7('0x0'));var events=[_0x14f7('0x1'),'remove',_0x14f7('0x2')];function createListener(_0x37a956,_0x101ff7){return function(_0x4d6f10){_0x101ff7['emit'](_0x37a956,_0x4d6f10);};}function removeListener(_0x27da3a,_0x33eea4){return function(){UserNotificationEvents[_0x14f7('0x3')](_0x27da3a,_0x33eea4);};}exports['register']=function(_0x531f4c){for(var _0x412ad7=0x0,_0x5d4cd9=events[_0x14f7('0x4')];_0x412ad7<_0x5d4cd9;_0x412ad7++){var _0x45bdf7=events[_0x412ad7];var _0x52705d=createListener(_0x14f7('0x5')+_0x45bdf7,_0x531f4c);UserNotificationEvents['on'](_0x45bdf7,_0x52705d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 156652a..1679b34 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x4ed30a,_0x3beecb){var _0x3a0c38=function(_0x3a37c9){while(--_0x3a37c9){_0x4ed30a['push'](_0x4ed30a['shift']());}};_0x3a0c38(++_0x3beecb);}(_0xedd9,0xfc));var _0x9edd=function(_0x37ee7a,_0x3e93fa){_0x37ee7a=_0x37ee7a-0x0;var _0x46ee5b=_0xedd9[_0x37ee7a];return _0x46ee5b;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d5c4a,_0x2d5858){var _0x3fdc68=function(_0x404ecc){while(--_0x404ecc){_0x5d5c4a['push'](_0x5d5c4a['shift']());}};_0x3fdc68(++_0x2d5858);}(_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 3ed89ea..c7cf8b9 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 _0xa002=['exports','INTEGER','sequelize'];(function(_0x2aff46,_0x6eac77){var _0x492ced=function(_0x13b3ea){while(--_0x13b3ea){_0x2aff46['push'](_0x2aff46['shift']());}};_0x492ced(++_0x6eac77);}(_0xa002,0x17c));var _0x2a00=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa002[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2a00('0x0'));module[_0x2a00('0x1')]={'penalty':{'type':Sequelize[_0x2a00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09b1=['INTEGER','sequelize'];(function(_0x55ceed,_0x23f3c8){var _0x607c76=function(_0x3db762){while(--_0x3db762){_0x55ceed['push'](_0x55ceed['shift']());}};_0x607c76(++_0x23f3c8);}(_0x09b1,0x167));var _0x109b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x09b1[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x109b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x109b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index bb4f262..3851737 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 _0x7c97=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x444435,_0x529006){var _0x583ad3=function(_0x95ef86){while(--_0x95ef86){_0x444435['push'](_0x444435['shift']());}};_0x583ad3(++_0x529006);}(_0x7c97,0x1ca));var _0x77c9=function(_0x3aa11f,_0x5382c6){_0x3aa11f=_0x3aa11f-0x0;var _0x53ab29=_0x7c97[_0x3aa11f];return _0x53ab29;};'use strict';var _=require(_0x77c9('0x0'));var util=require(_0x77c9('0x1'));var logger=require(_0x77c9('0x2'))(_0x77c9('0x3'));var moment=require(_0x77c9('0x4'));var BPromise=require(_0x77c9('0x5'));var rp=require(_0x77c9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x77c9('0x7'));var attributes=require(_0x77c9('0x8'));module[_0x77c9('0x9')]=function(_0x1a5ff9,_0x363980){return _0x1a5ff9[_0x77c9('0xa')](_0x77c9('0xb'),attributes,{'tableName':_0x77c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbea5=['user_has_openchannel_queues','lodash','util','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xbea5,0x91));var _0x5bea=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xbea5[_0x567bcb];return _0x4eebc2;};'use strict';var _=require(_0x5bea('0x0'));var util=require(_0x5bea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5bea('0x2'));var BPromise=require(_0x5bea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bea('0x4'));var rimraf=require(_0x5bea('0x5'));var config=require(_0x5bea('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x3abd88,_0x5b4d0b){return _0x3abd88[_0x5bea('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0x5bea('0x8'),'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 3fb7219..2039c99 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 _0xb9d6=['request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5ca23d,_0x5d7e9e){var _0x552791=function(_0x4a2c4e){while(--_0x4a2c4e){_0x5ca23d['push'](_0x5ca23d['shift']());}};_0x552791(++_0x5d7e9e);}(_0xb9d6,0x144));var _0x6b9d=function(_0x471c7b,_0x489243){_0x471c7b=_0x471c7b-0x0;var _0x48f9b8=_0xb9d6[_0x471c7b];return _0x48f9b8;};'use strict';var _=require(_0x6b9d('0x0'));var util=require(_0x6b9d('0x1'));var moment=require(_0x6b9d('0x2'));var BPromise=require(_0x6b9d('0x3'));var rs=require(_0x6b9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b9d('0x5'))['db'];var utils=require(_0x6b9d('0x6'));var logger=require(_0x6b9d('0x7'))(_0x6b9d('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b9d('0x9'));var client=jayson[_0x6b9d('0xa')][_0x6b9d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x334a4b,_0x164d57,_0x337694){return new BPromise(function(_0x4500bf,_0x3c8ab){return client[_0x6b9d('0xc')](_0x334a4b,_0x337694)[_0x6b9d('0xd')](function(_0x461e6e){logger[_0x6b9d('0xe')](_0x6b9d('0xf'),_0x164d57,'request\x20sent');logger[_0x6b9d('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x164d57,_0x6b9d('0x11'),JSON[_0x6b9d('0x12')](_0x461e6e));if(_0x461e6e['error']){if(_0x461e6e['error'][_0x6b9d('0x13')]===0x1f4){logger[_0x6b9d('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x164d57,_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);return _0x3c8ab(_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);}logger[_0x6b9d('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x164d57,_0x461e6e[_0x6b9d('0x14')]['message']);return _0x4500bf(_0x461e6e[_0x6b9d('0x14')][_0x6b9d('0x15')]);}else{logger['info'](_0x6b9d('0xf'),_0x164d57,_0x6b9d('0x11'));_0x4500bf(_0x461e6e[_0x6b9d('0x16')][_0x6b9d('0x15')]);}})[_0x6b9d('0x17')](function(_0x4f291a){logger[_0x6b9d('0x14')](_0x6b9d('0xf'),_0x164d57,_0x4f291a);_0x3c8ab(_0x4f291a);});});} \ No newline at end of file +var _0x2ffc=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x2ffc,0xa0));var _0xc2ff=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x2ffc[_0x55d58f];return _0x1ad6e6;};'use strict';var _=require(_0xc2ff('0x0'));var util=require(_0xc2ff('0x1'));var moment=require(_0xc2ff('0x2'));var BPromise=require(_0xc2ff('0x3'));var rs=require(_0xc2ff('0x4'));var fs=require('fs');var Redis=require(_0xc2ff('0x5'));var db=require(_0xc2ff('0x6'))['db'];var utils=require(_0xc2ff('0x7'));var logger=require('../../config/logger')(_0xc2ff('0x8'));var config=require('../../config/environment');var jayson=require(_0xc2ff('0x9'));var client=jayson[_0xc2ff('0xa')][_0xc2ff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x583963,_0x2b6047,_0x36097a){return new BPromise(function(_0x5d273b,_0x5bf499){return client['request'](_0x583963,_0x36097a)[_0xc2ff('0xc')](function(_0x3b9346){logger[_0xc2ff('0xd')](_0xc2ff('0xe'),_0x2b6047,_0xc2ff('0xf'));logger['debug'](_0xc2ff('0x10'),_0x2b6047,_0xc2ff('0xf'),JSON[_0xc2ff('0x11')](_0x3b9346));if(_0x3b9346[_0xc2ff('0x12')]){if(_0x3b9346[_0xc2ff('0x12')][_0xc2ff('0x13')]===0x1f4){logger[_0xc2ff('0x12')](_0xc2ff('0xe'),_0x2b6047,_0x3b9346['error'][_0xc2ff('0x14')]);return _0x5bf499(_0x3b9346['error'][_0xc2ff('0x14')]);}logger[_0xc2ff('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2b6047,_0x3b9346[_0xc2ff('0x12')][_0xc2ff('0x14')]);return _0x5d273b(_0x3b9346[_0xc2ff('0x12')][_0xc2ff('0x14')]);}else{logger[_0xc2ff('0xd')](_0xc2ff('0xe'),_0x2b6047,_0xc2ff('0xf'));_0x5d273b(_0x3b9346[_0xc2ff('0x15')]['message']);}})[_0xc2ff('0x16')](function(_0x469224){logger[_0xc2ff('0x12')](_0xc2ff('0xe'),_0x2b6047,_0x469224);_0x5bf499(_0x469224);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 40ba83f..b8c472f 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 _0xe408=['/:id/clone','addSections','/:id/resources','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','post'];(function(_0x44d1d7,_0x2bbc3b){var _0x4951c8=function(_0x44e26d){while(--_0x44e26d){_0x44d1d7['push'](_0x44d1d7['shift']());}};_0x4951c8(++_0x2bbc3b);}(_0xe408,0x19d));var _0x8e40=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0xe408[_0x396466];return _0x5e9ab4;};'use strict';var multer=require(_0x8e40('0x0'));var util=require(_0x8e40('0x1'));var path=require(_0x8e40('0x2'));var timeout=require(_0x8e40('0x3'));var express=require('express');var router=express[_0x8e40('0x4')]();var fs_extra=require(_0x8e40('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8e40('0x6'));var config=require(_0x8e40('0x7'));var controller=require(_0x8e40('0x8'));router['get']('/',auth[_0x8e40('0x9')](),controller[_0x8e40('0xa')]);router[_0x8e40('0xb')](_0x8e40('0xc'),auth[_0x8e40('0x9')](),controller[_0x8e40('0xd')]);router[_0x8e40('0xb')](_0x8e40('0xe'),auth[_0x8e40('0x9')](),controller[_0x8e40('0xf')]);router[_0x8e40('0xb')](_0x8e40('0x10'),auth['isAuthenticated'](),controller[_0x8e40('0x11')]);router[_0x8e40('0xb')]('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0x8e40('0x12')]('/',auth[_0x8e40('0x9')](),controller['create']);router[_0x8e40('0x12')](_0x8e40('0x13'),auth[_0x8e40('0x9')](),controller['clone']);router[_0x8e40('0x12')](_0x8e40('0x10'),auth[_0x8e40('0x9')](),controller[_0x8e40('0x14')]);router[_0x8e40('0x12')](_0x8e40('0x15'),auth[_0x8e40('0x9')](),controller['addResources']);router['put'](_0x8e40('0xe'),auth['isAuthenticated'](),controller[_0x8e40('0x16')]);router[_0x8e40('0x17')](_0x8e40('0xe'),auth['isAuthenticated'](),controller[_0x8e40('0x18')]);router[_0x8e40('0x17')](_0x8e40('0x10'),auth[_0x8e40('0x9')](),controller[_0x8e40('0x19')]);router['delete'](_0x8e40('0x15'),auth['isAuthenticated'](),controller['removeResources']);module[_0x8e40('0x1a')]=router; \ No newline at end of file +var _0x2448=['./userProfile.controller','get','index','isAuthenticated','describe','/:id','show','getSections','/:id/resources','post','create','/:id/clone','clone','addResources','put','destroy','delete','/:id/sections','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router'];(function(_0x5e146f,_0x5c04f9){var _0x44ce4d=function(_0xb4744f){while(--_0xb4744f){_0x5e146f['push'](_0x5e146f['shift']());}};_0x44ce4d(++_0x5c04f9);}(_0x2448,0x167));var _0x8244=function(_0x3362a9,_0x987616){_0x3362a9=_0x3362a9-0x0;var _0x32a591=_0x2448[_0x3362a9];return _0x32a591;};'use strict';var multer=require(_0x8244('0x0'));var util=require(_0x8244('0x1'));var path=require(_0x8244('0x2'));var timeout=require(_0x8244('0x3'));var express=require('express');var router=express[_0x8244('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(_0x8244('0x5'));router[_0x8244('0x6')]('/',auth['isAuthenticated'](),controller[_0x8244('0x7')]);router[_0x8244('0x6')]('/describe',auth[_0x8244('0x8')](),controller[_0x8244('0x9')]);router[_0x8244('0x6')](_0x8244('0xa'),auth[_0x8244('0x8')](),controller[_0x8244('0xb')]);router[_0x8244('0x6')]('/:id/sections',auth[_0x8244('0x8')](),controller[_0x8244('0xc')]);router[_0x8244('0x6')](_0x8244('0xd'),auth[_0x8244('0x8')](),controller['getResources']);router[_0x8244('0xe')]('/',auth[_0x8244('0x8')](),controller[_0x8244('0xf')]);router['post'](_0x8244('0x10'),auth['isAuthenticated'](),controller[_0x8244('0x11')]);router[_0x8244('0xe')]('/:id/sections',auth[_0x8244('0x8')](),controller['addSections']);router[_0x8244('0xe')](_0x8244('0xd'),auth[_0x8244('0x8')](),controller[_0x8244('0x12')]);router[_0x8244('0x13')](_0x8244('0xa'),auth[_0x8244('0x8')](),controller['update']);router['delete'](_0x8244('0xa'),auth[_0x8244('0x8')](),controller[_0x8244('0x14')]);router[_0x8244('0x15')](_0x8244('0x16'),auth[_0x8244('0x8')](),controller[_0x8244('0x17')]);router[_0x8244('0x15')](_0x8244('0xd'),auth[_0x8244('0x8')](),controller[_0x8244('0x18')]);module[_0x8244('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7eeca1b..f52511f 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 _0x947b=['BOOLEAN','sequelize','exports','STRING','name','crudPermissions','join','getDataValue','split'];(function(_0x180dc6,_0x4f9508){var _0x4a56e3=function(_0x1fe62e){while(--_0x1fe62e){_0x180dc6['push'](_0x180dc6['shift']());}};_0x4a56e3(++_0x4f9508);}(_0x947b,0xc7));var _0xb947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x947b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb947('0x0'));module[_0xb947('0x1')]={'name':{'type':Sequelize[_0xb947('0x2')],'allowNull':![],'unique':_0xb947('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x441422){this['setDataValue'](_0xb947('0x4'),_0x441422?_0x441422[_0xb947('0x5')](''):[]);},'get':function(){return this[_0xb947('0x6')](_0xb947('0x4'))?this[_0xb947('0x6')](_0xb947('0x4'))[_0xb947('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb947('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xb947('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb947('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b61=['setDataValue','crudPermissions','getDataValue','BOOLEAN','exports','STRING'];(function(_0x3ecbe0,_0x3e89ae){var _0x5ac858=function(_0x1856de){while(--_0x1856de){_0x3ecbe0['push'](_0x3ecbe0['shift']());}};_0x5ac858(++_0x3e89ae);}(_0x7b61,0x154));var _0x17b6=function(_0x461e00,_0x5d2b8f){_0x461e00=_0x461e00-0x0;var _0x4dbe74=_0x7b61[_0x461e00];return _0x4dbe74;};'use strict';var Sequelize=require('sequelize');module[_0x17b6('0x0')]={'name':{'type':Sequelize[_0x17b6('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3d46c2){this[_0x17b6('0x2')](_0x17b6('0x3'),_0x3d46c2?_0x3d46c2['join'](''):[]);},'get':function(){return this[_0x17b6('0x4')]('crudPermissions')?this['getDataValue'](_0x17b6('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x17b6('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c0f7760..d1f4060 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 _0xbcae=['fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','clone','get','createdAt','crudPermissions','body','omit','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','userProfileId','Resources','UserProfileResource','destroy','describe','push','ids','getSections','findAll','includes','isEmpty','sectionId','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xbcae,0xa9));var _0xebca=function(_0x1b1efc,_0x434a8b){_0x1b1efc=_0x1b1efc-0x0;var _0x53fed4=_0xbcae[_0x1b1efc];return _0x53fed4;};'use strict';var emlformat=require(_0xebca('0x0'));var rimraf=require(_0xebca('0x1'));var zipdir=require(_0xebca('0x2'));var jsonpatch=require(_0xebca('0x3'));var rp=require(_0xebca('0x4'));var moment=require(_0xebca('0x5'));var BPromise=require(_0xebca('0x6'));var Mustache=require(_0xebca('0x7'));var util=require(_0xebca('0x8'));var path=require(_0xebca('0x9'));var sox=require('sox');var csv=require(_0xebca('0xa'));var ejs=require(_0xebca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xebca('0xc'));var squel=require(_0xebca('0xd'));var crypto=require(_0xebca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xebca('0xf'));var toCsv=require(_0xebca('0xa'));var querystring=require(_0xebca('0x10'));var Papa=require(_0xebca('0x11'));var Redis=require(_0xebca('0x12'));var authService=require(_0xebca('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xebca('0x14'))(_0xebca('0x15'));var utils=require(_0xebca('0x16'));var config=require(_0xebca('0x17'));var licenseUtil=require(_0xebca('0x18'));var db=require('../../mysqldb')['db'];config[_0xebca('0x19')]=_[_0xebca('0x1a')](config[_0xebca('0x19')],{'host':_0xebca('0x1b'),'port':0x18eb});var socket=require(_0xebca('0x1c'))(new Redis(config[_0xebca('0x19')]));require(_0xebca('0x1d'))[_0xebca('0x1e')](socket);function respondWithStatusCode(_0x4df669,_0x5481f9){_0x5481f9=_0x5481f9||0xcc;return function(_0x224f4b){if(_0x224f4b){return _0x4df669['sendStatus'](_0x5481f9);}return _0x4df669[_0xebca('0x1f')](_0x5481f9)[_0xebca('0x20')]();};}function respondWithResult(_0x438d73,_0x2ff752){_0x2ff752=_0x2ff752||0xc8;return function(_0x4c8760){if(_0x4c8760){return _0x438d73[_0xebca('0x1f')](_0x2ff752)[_0xebca('0x21')](_0x4c8760);}};}function respondWithFilteredResult(_0xa4a29f,_0x31d44b){return function(_0x500855){if(_0x500855){var _0x3ee019=typeof _0x31d44b[_0xebca('0x22')]===_0xebca('0x23')&&typeof _0x31d44b['limit']===_0xebca('0x23');var _0x93e7b9=_0x500855['count'];var _0x2c0546=_0x3ee019?0x0:_0x31d44b[_0xebca('0x22')];var _0x37b271=_0x3ee019?_0x500855[_0xebca('0x24')]:_0x31d44b[_0xebca('0x22')]+_0x31d44b[_0xebca('0x25')];var _0x186096;if(_0x37b271>=_0x93e7b9){_0x37b271=_0x93e7b9;_0x186096=0xc8;}else{_0x186096=0xce;}_0xa4a29f[_0xebca('0x1f')](_0x186096);return _0xa4a29f[_0xebca('0x26')](_0xebca('0x27'),_0x2c0546+'-'+_0x37b271+'/'+_0x93e7b9)[_0xebca('0x21')](_0x500855);}return null;};}function patchUpdates(_0x451ed3){return function(_0x46613b){try{jsonpatch[_0xebca('0x28')](_0x46613b,_0x451ed3,!![]);}catch(_0x5a4de4){return BPromise[_0xebca('0x29')](_0x5a4de4);}return _0x46613b[_0xebca('0x2a')]();};}function saveUpdates(_0x398d39,_0x534ce0){return function(_0x570fe6){if(_0x570fe6){return _0x570fe6[_0xebca('0x2b')](_0x398d39)[_0xebca('0x2c')](function(_0x555a9a){return _0x555a9a;});}return null;};}function removeEntity(_0xf340fe,_0x163478){return function(_0x38088b){if(_0x38088b){return _0x38088b['destroy']()[_0xebca('0x2c')](function(){_0xf340fe[_0xebca('0x1f')](0xcc)[_0xebca('0x20')]();});}};}function handleEntityNotFound(_0x2234af,_0x46d79c){return function(_0x1652e4){if(!_0x1652e4){_0x2234af[_0xebca('0x2d')](0x194);}return _0x1652e4;};}function handleError(_0x27fc75,_0x20fd04){_0x20fd04=_0x20fd04||0x1f4;return function(_0x98b94a){logger[_0xebca('0x2e')](_0x98b94a[_0xebca('0x2f')]);if(_0x98b94a[_0xebca('0x30')]){delete _0x98b94a[_0xebca('0x30')];}_0x27fc75[_0xebca('0x1f')](_0x20fd04)[_0xebca('0x31')](_0x98b94a);};}exports[_0xebca('0x32')]=function(_0x3aff0b,_0x14eb42){var _0x166112={},_0x217398={},_0x2a62a4={'count':0x0,'rows':[]};var _0x1aeac4=_[_0xebca('0x33')](db[_0xebca('0x34')][_0xebca('0x35')],function(_0x4a6449){return{'name':_0x4a6449[_0xebca('0x36')],'type':_0x4a6449[_0xebca('0x37')][_0xebca('0x38')]};});_0x217398['model']=_['map'](_0x1aeac4,_0xebca('0x30'));_0x217398[_0xebca('0x39')]=_[_0xebca('0x3a')](_0x3aff0b[_0xebca('0x39')]);_0x217398[_0xebca('0x3b')]=_[_0xebca('0x3c')](_0x217398[_0xebca('0x3d')],_0x217398[_0xebca('0x39')]);_0x166112[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x217398['model'],qs[_0xebca('0x3f')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x3f')]));_0x166112[_0xebca('0x3e')]=_0x166112['attributes'][_0xebca('0x40')]?_0x166112[_0xebca('0x3e')]:_0x217398[_0xebca('0x3d')];if(!_0x3aff0b[_0xebca('0x39')][_0xebca('0x41')](_0xebca('0x42'))){_0x166112[_0xebca('0x25')]=qs[_0xebca('0x25')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x25')]);_0x166112[_0xebca('0x22')]=qs[_0xebca('0x22')](_0x3aff0b[_0xebca('0x39')][_0xebca('0x22')]);}_0x166112[_0xebca('0x43')]=qs['sort'](_0x3aff0b[_0xebca('0x39')]['sort']);_0x166112[_0xebca('0x44')]=qs[_0xebca('0x3b')](_['pick'](_0x3aff0b[_0xebca('0x39')],_0x217398[_0xebca('0x3b')]),_0x1aeac4);if(_0x3aff0b['query'][_0xebca('0x45')]){_0x166112[_0xebca('0x44')]=_[_0xebca('0x46')](_0x166112['where'],{'$or':_[_0xebca('0x33')](_0x1aeac4,function(_0x3d8eeb){if(_0x3d8eeb[_0xebca('0x37')]!==_0xebca('0x47')){var _0x5bdc23={};_0x5bdc23[_0x3d8eeb[_0xebca('0x30')]]={'$like':'%'+_0x3aff0b[_0xebca('0x39')][_0xebca('0x45')]+'%'};return _0x5bdc23;}})});}_0x166112=_[_0xebca('0x46')]({},_0x166112,_0x3aff0b[_0xebca('0x48')]);var _0x175544={'where':_0x166112['where']};return db[_0xebca('0x34')][_0xebca('0x24')](_0x175544)[_0xebca('0x2c')](function(_0x4de99e){_0x2a62a4[_0xebca('0x24')]=_0x4de99e;if(_0x3aff0b[_0xebca('0x39')][_0xebca('0x49')]){_0x166112['include']=[{'all':!![]}];}return db[_0xebca('0x34')]['findAll'](_0x166112);})[_0xebca('0x2c')](function(_0x3a2575){_0x2a62a4[_0xebca('0x4a')]=_0x3a2575;return _0x2a62a4;})[_0xebca('0x2c')](respondWithFilteredResult(_0x14eb42,_0x166112))[_0xebca('0x4b')](handleError(_0x14eb42,null));};exports[_0xebca('0x4c')]=function(_0x41562c,_0x365e0c){var _0x1abab0={'raw':![],'where':{'id':_0x41562c[_0xebca('0x4d')]['id']}},_0x310076={};_0x310076[_0xebca('0x3d')]=_[_0xebca('0x3a')](db[_0xebca('0x34')][_0xebca('0x35')]);_0x310076['query']=_[_0xebca('0x3a')](_0x41562c[_0xebca('0x39')]);_0x310076[_0xebca('0x3b')]=_[_0xebca('0x3c')](_0x310076['model'],_0x310076['query']);_0x1abab0[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x310076['model'],qs['fields'](_0x41562c[_0xebca('0x39')][_0xebca('0x3f')]));_0x1abab0[_0xebca('0x3e')]=_0x1abab0['attributes']['length']?_0x1abab0['attributes']:_0x310076[_0xebca('0x3d')];if(_0x41562c['query'][_0xebca('0x49')]){_0x1abab0[_0xebca('0x4e')]=[{'all':!![]}];}_0x1abab0=_['merge']({},_0x1abab0,_0x41562c[_0xebca('0x48')]);return db[_0xebca('0x34')][_0xebca('0x4f')](_0x1abab0)[_0xebca('0x2c')](handleEntityNotFound(_0x365e0c,null))['then'](respondWithResult(_0x365e0c,null))[_0xebca('0x4b')](handleError(_0x365e0c,null));};exports['create']=function(_0x4497b7,_0x7aa50c){return db['UserProfile'][_0xebca('0x50')](_0x4497b7['body'],{})[_0xebca('0x2c')](respondWithResult(_0x7aa50c,0xc9))[_0xebca('0x4b')](handleError(_0x7aa50c,null));};exports[_0xebca('0x51')]=function(_0x171fc1,_0x29a479){var _0xfe4565={'where':{'id':_0x171fc1[_0xebca('0x4d')]['id']}},_0x57ec7a={};_0x57ec7a[_0xebca('0x3d')]=_[_0xebca('0x3a')](db['UserProfile'][_0xebca('0x35')]);_0xfe4565[_0xebca('0x3e')]=_[_0xebca('0x3c')](_0x57ec7a[_0xebca('0x3d')],qs['fields'](_0x171fc1['query'][_0xebca('0x3f')]));_0xfe4565['attributes']=_0xfe4565[_0xebca('0x3e')][_0xebca('0x40')]?_0xfe4565[_0xebca('0x3e')]:_0x57ec7a[_0xebca('0x3d')];if(_0x171fc1['query'][_0xebca('0x49')]){_0xfe4565[_0xebca('0x4e')]=[{'all':!![]}];}_0xfe4565=_[_0xebca('0x46')]({},_0xfe4565,_0x171fc1[_0xebca('0x48')]);return db[_0xebca('0x34')]['find'](_0xfe4565)[_0xebca('0x2c')](handleEntityNotFound(_0x29a479,null))['then'](function(_0x3a4a11){if(_0x3a4a11){var _0x34d30e=_0x3a4a11[_0xebca('0x52')]({'plain':!![]});_0x34d30e=qs['omit'](_0x34d30e,['id',_0xebca('0x53'),'updatedAt',_0xebca('0x54')]);_0x171fc1[_0xebca('0x55')]=_[_0xebca('0x56')](_0x171fc1[_0xebca('0x55')],['id','createdAt',_0xebca('0x57')]);return db[_0xebca('0x58')][_0xebca('0x59')](function(_0x31d8c2){return db[_0xebca('0x34')][_0xebca('0x50')](_[_0xebca('0x46')](_0x34d30e,_0x171fc1[_0xebca('0x55')]),{'include':_0x171fc1[_0xebca('0x39')][_0xebca('0x49')]?[{'all':!![]}]:undefined,'transaction':_0x31d8c2})[_0xebca('0x2c')](function(_0x13a1ee){var _0x48a16a=_0x13a1ee[_0xebca('0x52')]({'plain':!![]});return db[_0xebca('0x5a')]['findAll']({'where':{'userProfileId':_0x171fc1[_0xebca('0x4d')]['id']},'raw':!![]})[_0xebca('0x2c')](function(_0x3f5566){if(_0x3f5566){return BPromise[_0xebca('0x5b')](_0x3f5566,function(_0x1a0041){return new BPromise(function(_0xf9f4be,_0xff679){if(_0x1a0041['autoAssociation']===null||_0x1a0041[_0xebca('0x5c')]===0x1)_0xf9f4be(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x1a0041['id']},'raw':!![]})['then'](function(_0x2658f6){var _0x308184=_[_0xebca('0x33')](_0x2658f6,function(_0x5da519){return qs[_0xebca('0x56')](_0x5da519,['id','createdAt',_0xebca('0x57'),'sectionId']);});_0xf9f4be(_0x308184);})[_0xebca('0x4b')](function(_0x5947af){_0xff679(_0x5947af);});})[_0xebca('0x2c')](function(_0x14b9cc){var _0x5cb46e=qs[_0xebca('0x56')](_0x1a0041,['id',_0xebca('0x53'),_0xebca('0x57')]);_0x5cb46e[_0xebca('0x5d')]=_0x48a16a['id'];if(_0x14b9cc)_0x5cb46e[_0xebca('0x5e')]=_0x14b9cc;return _0x5cb46e;})['then'](function(_0x5e2517){return db[_0xebca('0x5a')][_0xebca('0x50')](_0x5e2517,{'include':[{'model':db[_0xebca('0x5f')],'as':_0xebca('0x5e')}],'raw':!![],'transaction':_0x31d8c2});});})['then'](function(){return _0x48a16a;});}});});});}})[_0xebca('0x2c')](respondWithResult(_0x29a479,0xc9))[_0xebca('0x4b')](handleError(_0x29a479,null));};exports[_0xebca('0x2b')]=function(_0x55e9b4,_0x52094e){if(_0x55e9b4['body']['id']){delete _0x55e9b4[_0xebca('0x55')]['id'];}return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x55e9b4['params']['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x52094e,null))[_0xebca('0x2c')](saveUpdates(_0x55e9b4[_0xebca('0x55')],null))['then'](respondWithResult(_0x52094e,null))[_0xebca('0x4b')](handleError(_0x52094e,null));};exports[_0xebca('0x60')]=function(_0x512a40,_0x23c74e){return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x512a40[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x23c74e,null))[_0xebca('0x2c')](removeEntity(_0x23c74e,null))['catch'](handleError(_0x23c74e,null));};exports['describe']=function(_0xceabfc,_0x5845ec){return db[_0xebca('0x34')][_0xebca('0x61')]()['then'](respondWithResult(_0x5845ec,null))[_0xebca('0x4b')](handleError(_0x5845ec,null));};exports['addSections']=function(_0x418a33,_0x4c4d8f){var _0xd0065c=_0x418a33[_0xebca('0x55')];return db['UserProfile'][_0xebca('0x4f')]({'where':{'id':_0x418a33[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x4c4d8f,null))[_0xebca('0x2c')](function(_0xe9ba34){if(_0xe9ba34){return db['sequelize'][_0xebca('0x59')](function(_0xe2b90e){return db['UserProfileSection'][_0xebca('0x60')]({'where':{'userProfileId':_0x418a33['params']['id'],'sectionId':_['map'](_0xd0065c,function(_0x200b0a){return _0x200b0a['sectionId'];})},'transaction':_0xe2b90e})[_0xebca('0x2c')](function(){var _0x4bb71d=_[_0xebca('0x33')](_0xd0065c,function(_0x54e318){_0x54e318[_0xebca('0x5d')]=_0x418a33[_0xebca('0x4d')]['id'];return _0x54e318;});var _0x5fdf10=[];return BPromise[_0xebca('0x5b')](_0x4bb71d,function(_0x285b22){return db[_0xebca('0x5a')][_0xebca('0x50')](_0x285b22,{'include':[{'model':db['UserProfileResource'],'as':_0xebca('0x5e')}],'raw':!![],'transaction':_0xe2b90e})[_0xebca('0x2c')](function(_0x54476c){_0x5fdf10[_0xebca('0x62')](_0x54476c['get']({'plain':!![]}));});})[_0xebca('0x2c')](function(){return _0x5fdf10;});});});}})[_0xebca('0x2c')](function(_0x390f5c){return _0x390f5c;})[_0xebca('0x2c')](respondWithResult(_0x4c4d8f,null))[_0xebca('0x4b')](handleError(_0x4c4d8f,null));};exports['removeSections']=function(_0x59facb,_0x52eb12){var _0x16b836;return db[_0xebca('0x34')]['find']({'where':{'id':_0x59facb['params']['id']},'attributes':['id',_0xebca('0x30')]})[_0xebca('0x2c')](handleEntityNotFound(_0x52eb12,null))[_0xebca('0x2c')](function(_0x2c6746){if(_0x2c6746){_0x16b836=_0x2c6746;return db[_0xebca('0x5a')]['destroy']({'where':{'userProfileId':_0x59facb[_0xebca('0x4d')]['id'],'sectionId':_0x59facb[_0xebca('0x39')][_0xebca('0x63')]}});}})[_0xebca('0x2c')](function(){return _0x16b836;})['then'](respondWithStatusCode(_0x52eb12,null))[_0xebca('0x4b')](handleError(_0x52eb12,null));};exports[_0xebca('0x64')]=function(_0x4cfa91,_0x5250cd){var _0x8d2348=[];var _0x270844=[];return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x4cfa91[_0xebca('0x4d')]['id']},'raw':!![]})[_0xebca('0x2c')](function(_0xf38de1){_0x8d2348=_[_0xebca('0x45')](_0xf38de1,function(_0x3e19ac){return _0x3e19ac['enabled']===0x1||_[_0xebca('0x66')]([0x3eb,0x709],_0x3e19ac['sectionId']);});if(!_[_0xebca('0x67')](_0x8d2348)){return _[_0xebca('0x33')](_0x8d2348,function(_0x4c0c7e){return _0x4c0c7e[_0xebca('0x68')];});}else{return;}})['then'](function(_0x37ffe5){if(_0x37ffe5)_0x270844=_0x37ffe5;if(_[_0xebca('0x66')](_0x270844,0x64)){var _0x1fb3c0=_[_0xebca('0x4f')](_0x8d2348,{'sectionId':0x64});return hasDefaultDashboard(_0x1fb3c0)['then'](function(_0x55729a){return _[_0xebca('0x33')](_0x8d2348,function(_0x451481){if(_0x451481['sectionId']===0x64){_0x451481[_0xebca('0x69')]=_0x55729a;}return _0x451481;});});}else{return;}})['then'](function(_0x5ca582){if(_0x5ca582)_0x8d2348=_0x5ca582;if(_[_0xebca('0x66')](_0x270844,0x3eb)){var _0x3c78ab=_['find'](_0x8d2348,{'sectionId':0x3eb});return getCustomDashboards(_0x3c78ab)[_0xebca('0x2c')](function(_0x4ec46b){return _[_0xebca('0x33')](_0x8d2348,function(_0x53db4c){if(_0x3c78ab[_0xebca('0x6a')]){if(_0x53db4c[_0xebca('0x68')]===0x3eb){_0x53db4c[_0xebca('0x69')]=_0x4ec46b;}}else{if(_0x53db4c[_0xebca('0x68')]===0x64){_0x53db4c[_0xebca('0x69')]=_0x4ec46b;}}return _0x53db4c;});});}else{return;}})[_0xebca('0x2c')](function(_0x3becda){if(_0x3becda)_0x8d2348=_0x3becda;if(_[_0xebca('0x66')](_0x270844,0x709)){var _0x2f180f=_[_0xebca('0x4f')](_0x8d2348,{'sectionId':0x709});return getPlugins(_0x2f180f)[_0xebca('0x2c')](function(_0x3b5e64){if(_0x2f180f[_0xebca('0x6a')]){return _['map'](_0x8d2348,function(_0x5811ff){if(_0x5811ff[_0xebca('0x68')]===0x709){_0x5811ff[_0xebca('0x69')]=_0x3b5e64;}return _0x5811ff;});}else{var _0x2a22c8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3b5e64};var _0x38012e=_[_0xebca('0x33')](_0x8d2348);_0x38012e[_0xebca('0x62')](_0x2a22c8);return _0x38012e;}});}else{return;}})[_0xebca('0x2c')](function(_0x218204){if(_0x218204)_0x8d2348=_0x218204;return _['filter'](_0x8d2348,['enabled',0x1]);})[_0xebca('0x2c')](respondWithResult(_0x5250cd,null))[_0xebca('0x4b')](handleError(_0x5250cd,null));};function hasDefaultDashboard(_0x13e357){var _0x5ba89a=[0x65];return new BPromise(function(_0x4c36b0,_0x50cb9c){try{if(_0x13e357[_0xebca('0x5c')]){_0x4c36b0(_0x5ba89a);}else{return db[_0xebca('0x5f')][_0xebca('0x6b')]({'where':{'sectionId':_0x13e357['id']},'raw':!![]})['then'](function(_0x2dec45){_0x2dec45?_0x4c36b0(_0x5ba89a):_0x4c36b0();});}}catch(_0x5d38c6){_0x50cb9c(_0x5d38c6);}});}function getCustomDashboards(_0x2483cf){var _0x38cfc7=[];return new BPromise(function(_0x173ee9,_0x9fca9e){try{if(_0x2483cf['autoAssociation']){return db[_0xebca('0x6c')]['findAll']({'raw':!![]})[_0xebca('0x2c')](function(_0x1601d2){_0x1601d2['forEach'](function(_0x330496){_0x38cfc7[_0xebca('0x62')](_0x330496['id']+0x1869f);});_0x173ee9(_0x38cfc7);});}else{return db[_0xebca('0x5f')][_0xebca('0x65')]({'where':{'sectionId':_0x2483cf['id']},'raw':!![]})[_0xebca('0x2c')](function(_0x6055f4){_0x6055f4[_0xebca('0x6d')](function(_0x19102d){_0x38cfc7[_0xebca('0x62')](_0x19102d[_0xebca('0x6e')]+0x1869f);});_0x173ee9(_0x38cfc7);});}}catch(_0x4bced8){_0x9fca9e(_0x4bced8);}});}function getPlugins(_0x2753d0){var _0x3a9b1a=[];return new BPromise(function(_0x473f6e,_0x22ce9f){try{if(_0x2753d0['autoAssociation']){return db['Plugin'][_0xebca('0x65')]({'raw':!![]})[_0xebca('0x2c')](function(_0x1c294d){_0x1c294d[_0xebca('0x6d')](function(_0x45bfeb){_0x3a9b1a[_0xebca('0x62')](_0x45bfeb['id']+0x15b38);});_0x473f6e(_0x3a9b1a);});}else{return db['UserProfileResource'][_0xebca('0x65')]({'where':{'sectionId':_0x2753d0['id']},'raw':!![]})['then'](function(_0x5b0a3f){_0x5b0a3f['forEach'](function(_0x50e73f){_0x3a9b1a['push'](_0x50e73f['resourceId']+0x15b38);});_0x473f6e(_0x3a9b1a);});}}catch(_0x1ff1c4){_0x22ce9f(_0x1ff1c4);}});}exports[_0xebca('0x6f')]=function(_0x13549e,_0x392548){return db['UserProfile'][_0xebca('0x4f')]({'where':{'id':_0x13549e[_0xebca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x392548,null))[_0xebca('0x2c')](function(_0x233277){if(_0x233277){return db[_0xebca('0x58')][_0xebca('0x59')](function(_0x5deb12){return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x13549e[_0xebca('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0xebca('0x2c')](function(_0x15f219){if(_0x15f219){return db['UserProfileSection'][_0xebca('0x60')]({'where':{'userProfileId':_0x13549e[_0xebca('0x4d')]['id'],'id':_[_0xebca('0x33')](_0x15f219,function(_0x42b9f7){return _0x42b9f7['id'];})},'transaction':_0x5deb12});}})['then'](function(_0x5dbd74){var _0x4ad141=_['map'](_0x13549e[_0xebca('0x55')],function(_0x3bae4a){_0x3bae4a[_0xebca('0x5d')]=_0x13549e[_0xebca('0x4d')]['id'];return _0x3bae4a;});return db[_0xebca('0x5a')]['bulkCreate'](_0x4ad141,{'raw':!![],'transaction':_0x5deb12});})[_0xebca('0x2c')](function(_0x3562c7){var _0x4d5f9a=_[_0xebca('0x45')](_[_0xebca('0x33')](_0x3562c7,function(_0x38664b){return _0x38664b[_0xebca('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x4d5f9a){return db[_0xebca('0x5a')][_0xebca('0x65')]({'where':{'userProfileId':_0x13549e['params']['id'],'sectionId':_[_0xebca('0x33')](_0x4d5f9a,function(_0x1aa9ed){return _0x1aa9ed[_0xebca('0x68')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xebca('0x2c')](function(_0x28638f){var _0x464ca5=_['map'](_0x13549e['body'],function(_0x427773){_0x427773[_0xebca('0x5d')]=_0x13549e[_0xebca('0x4d')]['id'];return _0x427773;});return db[_0xebca('0x5f')]['bulkCreate'](_0x464ca5,{'raw':!![],'transaction':_0x5deb12});});}})[_0xebca('0x4b')](handleError(_0x392548,null));});}})[_0xebca('0x2c')](function(_0x48b536){var _0xd34351=_['map'](_0x48b536,function(_0x2af181){return _0x2af181[_0xebca('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x392548,null))[_0xebca('0x4b')](handleError(_0x392548,null));};exports[_0xebca('0x70')]=function(_0x2333f2,_0x5e14cb,_0x5dd3aa){return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x2333f2[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](handleEntityNotFound(_0x5e14cb,null))['then'](function(_0x14d411){if(_0x14d411){return _0x14d411[_0xebca('0x70')](_0x2333f2[_0xebca('0x39')][_0xebca('0x63')]);}})[_0xebca('0x2c')](respondWithStatusCode(_0x5e14cb,null))[_0xebca('0x4b')](handleError(_0x5e14cb,null));};exports[_0xebca('0x71')]=function(_0x211073,_0x49e5a6){var _0x44defa={};if(!_0x211073['query'][_0xebca('0x72')])throw new Error(_0xebca('0x73'));if(!_0x211073[_0xebca('0x39')][_0xebca('0x41')](_0xebca('0x42'))){_0x44defa['limit']=qs[_0xebca('0x25')](_0x211073['query'][_0xebca('0x25')]);_0x44defa[_0xebca('0x22')]=qs[_0xebca('0x22')](_0x211073[_0xebca('0x39')][_0xebca('0x22')]);}return db[_0xebca('0x34')][_0xebca('0x4f')]({'where':{'id':_0x211073[_0xebca('0x4d')]['id']}})[_0xebca('0x2c')](function(_0x354fad){if(!_0x354fad)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x211073['params']['id']);return db[_0xebca('0x34')][_0xebca('0x71')](_0x211073);})[_0xebca('0x2c')](respondWithFilteredResult(_0x49e5a6,_0x44defa))[_0xebca('0x4b')](handleError(_0x49e5a6,null));}; \ No newline at end of file +var _0x0a93=['mustache','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userProfile.socket','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','UserProfile','rows','catch','params','includeAll','options','find','create','clone','get','omit','createdAt','updatedAt','body','sequelize','transaction','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','push','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0a93,0x6a));var _0x30a9=function(_0x342574,_0x4cbff8){_0x342574=_0x342574-0x0;var _0x41181f=_0x0a93[_0x342574];return _0x41181f;};'use strict';var emlformat=require(_0x30a9('0x0'));var rimraf=require(_0x30a9('0x1'));var zipdir=require(_0x30a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30a9('0x3'));var moment=require(_0x30a9('0x4'));var BPromise=require(_0x30a9('0x5'));var Mustache=require(_0x30a9('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30a9('0x7'));var _=require(_0x30a9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x30a9('0x9'));var deskjs=require(_0x30a9('0xa'));var toCsv=require(_0x30a9('0xb'));var querystring=require('querystring');var Papa=require(_0x30a9('0xc'));var Redis=require(_0x30a9('0xd'));var authService=require(_0x30a9('0xe'));var qs=require(_0x30a9('0xf'));var as=require(_0x30a9('0x10'));var hardwareService=require(_0x30a9('0x11'));var logger=require(_0x30a9('0x12'))(_0x30a9('0x13'));var utils=require(_0x30a9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x30a9('0x15'));var db=require(_0x30a9('0x16'))['db'];config[_0x30a9('0x17')]=_[_0x30a9('0x18')](config['redis'],{'host':_0x30a9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x30a9('0x17')]));require(_0x30a9('0x1a'))['register'](socket);function respondWithStatusCode(_0x58a4f3,_0x44fdd4){_0x44fdd4=_0x44fdd4||0xcc;return function(_0x3d96ee){if(_0x3d96ee){return _0x58a4f3['sendStatus'](_0x44fdd4);}return _0x58a4f3[_0x30a9('0x1b')](_0x44fdd4)[_0x30a9('0x1c')]();};}function respondWithResult(_0x3c50d1,_0x17fec2){_0x17fec2=_0x17fec2||0xc8;return function(_0x39cee7){if(_0x39cee7){return _0x3c50d1[_0x30a9('0x1b')](_0x17fec2)['json'](_0x39cee7);}};}function respondWithFilteredResult(_0x22521d,_0x2be156){return function(_0x1a3c7a){if(_0x1a3c7a){var _0x145868=typeof _0x2be156[_0x30a9('0x1d')]===_0x30a9('0x1e')&&typeof _0x2be156[_0x30a9('0x1f')]===_0x30a9('0x1e');var _0x1c412c=_0x1a3c7a[_0x30a9('0x20')];var _0x5129cc=_0x145868?0x0:_0x2be156[_0x30a9('0x1d')];var _0x57605=_0x145868?_0x1a3c7a[_0x30a9('0x20')]:_0x2be156[_0x30a9('0x1d')]+_0x2be156['limit'];var _0x510594;if(_0x57605>=_0x1c412c){_0x57605=_0x1c412c;_0x510594=0xc8;}else{_0x510594=0xce;}_0x22521d[_0x30a9('0x1b')](_0x510594);return _0x22521d[_0x30a9('0x21')]('Content-Range',_0x5129cc+'-'+_0x57605+'/'+_0x1c412c)[_0x30a9('0x22')](_0x1a3c7a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x58d8b7){try{jsonpatch[_0x30a9('0x23')](_0x58d8b7,_0x4c92e8,!![]);}catch(_0x5a6e49){return BPromise[_0x30a9('0x24')](_0x5a6e49);}return _0x58d8b7[_0x30a9('0x25')]();};}function saveUpdates(_0x4e9bca,_0x25eb85){return function(_0x54e545){if(_0x54e545){return _0x54e545[_0x30a9('0x26')](_0x4e9bca)[_0x30a9('0x27')](function(_0x20b2c7){return _0x20b2c7;});}return null;};}function removeEntity(_0x609046,_0x405744){return function(_0x45cfc3){if(_0x45cfc3){return _0x45cfc3[_0x30a9('0x28')]()['then'](function(){_0x609046[_0x30a9('0x1b')](0xcc)[_0x30a9('0x1c')]();});}};}function handleEntityNotFound(_0x1bf9a3,_0x31c411){return function(_0x9d7e73){if(!_0x9d7e73){_0x1bf9a3[_0x30a9('0x29')](0x194);}return _0x9d7e73;};}function handleError(_0x41956c,_0xddd59b){_0xddd59b=_0xddd59b||0x1f4;return function(_0x294aa8){logger[_0x30a9('0x2a')](_0x294aa8['stack']);if(_0x294aa8[_0x30a9('0x2b')]){delete _0x294aa8['name'];}_0x41956c[_0x30a9('0x1b')](_0xddd59b)[_0x30a9('0x2c')](_0x294aa8);};}exports[_0x30a9('0x2d')]=function(_0x1eed14,_0x1259db){var _0xdf878e={},_0x2f9a5c={},_0x44e4d9={'count':0x0,'rows':[]};var _0x15f6ea=_[_0x30a9('0x2e')](db['UserProfile'][_0x30a9('0x2f')],function(_0x52c5cc){return{'name':_0x52c5cc[_0x30a9('0x30')],'type':_0x52c5cc[_0x30a9('0x31')][_0x30a9('0x32')]};});_0x2f9a5c['model']=_[_0x30a9('0x2e')](_0x15f6ea,_0x30a9('0x2b'));_0x2f9a5c[_0x30a9('0x33')]=_[_0x30a9('0x34')](_0x1eed14['query']);_0x2f9a5c[_0x30a9('0x35')]=_['intersection'](_0x2f9a5c['model'],_0x2f9a5c[_0x30a9('0x33')]);_0xdf878e['attributes']=_[_0x30a9('0x36')](_0x2f9a5c[_0x30a9('0x37')],qs[_0x30a9('0x38')](_0x1eed14['query'][_0x30a9('0x38')]));_0xdf878e[_0x30a9('0x39')]=_0xdf878e[_0x30a9('0x39')][_0x30a9('0x3a')]?_0xdf878e['attributes']:_0x2f9a5c[_0x30a9('0x37')];if(!_0x1eed14[_0x30a9('0x33')]['hasOwnProperty'](_0x30a9('0x3b'))){_0xdf878e[_0x30a9('0x1f')]=qs[_0x30a9('0x1f')](_0x1eed14['query'][_0x30a9('0x1f')]);_0xdf878e['offset']=qs[_0x30a9('0x1d')](_0x1eed14[_0x30a9('0x33')][_0x30a9('0x1d')]);}_0xdf878e[_0x30a9('0x3c')]=qs[_0x30a9('0x3d')](_0x1eed14['query'][_0x30a9('0x3d')]);_0xdf878e[_0x30a9('0x3e')]=qs['filters'](_[_0x30a9('0x3f')](_0x1eed14[_0x30a9('0x33')],_0x2f9a5c[_0x30a9('0x35')]),_0x15f6ea);if(_0x1eed14[_0x30a9('0x33')][_0x30a9('0x40')]){_0xdf878e['where']=_[_0x30a9('0x41')](_0xdf878e[_0x30a9('0x3e')],{'$or':_['map'](_0x15f6ea,function(_0x20aab6){if(_0x20aab6['type']!=='VIRTUAL'){var _0x204879={};_0x204879[_0x20aab6[_0x30a9('0x2b')]]={'$like':'%'+_0x1eed14[_0x30a9('0x33')]['filter']+'%'};return _0x204879;}})});}_0xdf878e=_[_0x30a9('0x41')]({},_0xdf878e,_0x1eed14['options']);var _0x252a85={'where':_0xdf878e[_0x30a9('0x3e')]};return db['UserProfile'][_0x30a9('0x20')](_0x252a85)[_0x30a9('0x27')](function(_0x144946){_0x44e4d9[_0x30a9('0x20')]=_0x144946;if(_0x1eed14[_0x30a9('0x33')]['includeAll']){_0xdf878e[_0x30a9('0x42')]=[{'all':!![]}];}return db[_0x30a9('0x43')]['findAll'](_0xdf878e);})[_0x30a9('0x27')](function(_0x210085){_0x44e4d9[_0x30a9('0x44')]=_0x210085;return _0x44e4d9;})[_0x30a9('0x27')](respondWithFilteredResult(_0x1259db,_0xdf878e))[_0x30a9('0x45')](handleError(_0x1259db,null));};exports['show']=function(_0x4c1f4a,_0x35a173){var _0x5d68f9={'raw':![],'where':{'id':_0x4c1f4a[_0x30a9('0x46')]['id']}},_0x1dad07={};_0x1dad07[_0x30a9('0x37')]=_[_0x30a9('0x34')](db[_0x30a9('0x43')][_0x30a9('0x2f')]);_0x1dad07[_0x30a9('0x33')]=_[_0x30a9('0x34')](_0x4c1f4a[_0x30a9('0x33')]);_0x1dad07[_0x30a9('0x35')]=_[_0x30a9('0x36')](_0x1dad07[_0x30a9('0x37')],_0x1dad07[_0x30a9('0x33')]);_0x5d68f9[_0x30a9('0x39')]=_[_0x30a9('0x36')](_0x1dad07['model'],qs[_0x30a9('0x38')](_0x4c1f4a[_0x30a9('0x33')][_0x30a9('0x38')]));_0x5d68f9['attributes']=_0x5d68f9[_0x30a9('0x39')][_0x30a9('0x3a')]?_0x5d68f9[_0x30a9('0x39')]:_0x1dad07[_0x30a9('0x37')];if(_0x4c1f4a['query'][_0x30a9('0x47')]){_0x5d68f9[_0x30a9('0x42')]=[{'all':!![]}];}_0x5d68f9=_['merge']({},_0x5d68f9,_0x4c1f4a[_0x30a9('0x48')]);return db[_0x30a9('0x43')][_0x30a9('0x49')](_0x5d68f9)[_0x30a9('0x27')](handleEntityNotFound(_0x35a173,null))[_0x30a9('0x27')](respondWithResult(_0x35a173,null))['catch'](handleError(_0x35a173,null));};exports['create']=function(_0x2d902b,_0x3fa36c){return db['UserProfile'][_0x30a9('0x4a')](_0x2d902b['body'],{})[_0x30a9('0x27')](respondWithResult(_0x3fa36c,0xc9))[_0x30a9('0x45')](handleError(_0x3fa36c,null));};exports[_0x30a9('0x4b')]=function(_0x594133,_0x4ce93e){var _0x16a3c9={'where':{'id':_0x594133[_0x30a9('0x46')]['id']}},_0x27c6bc={};_0x27c6bc[_0x30a9('0x37')]=_[_0x30a9('0x34')](db[_0x30a9('0x43')][_0x30a9('0x2f')]);_0x16a3c9[_0x30a9('0x39')]=_['intersection'](_0x27c6bc['model'],qs[_0x30a9('0x38')](_0x594133['query'][_0x30a9('0x38')]));_0x16a3c9['attributes']=_0x16a3c9['attributes']['length']?_0x16a3c9[_0x30a9('0x39')]:_0x27c6bc[_0x30a9('0x37')];if(_0x594133[_0x30a9('0x33')][_0x30a9('0x47')]){_0x16a3c9[_0x30a9('0x42')]=[{'all':!![]}];}_0x16a3c9=_['merge']({},_0x16a3c9,_0x594133[_0x30a9('0x48')]);return db[_0x30a9('0x43')][_0x30a9('0x49')](_0x16a3c9)[_0x30a9('0x27')](handleEntityNotFound(_0x4ce93e,null))[_0x30a9('0x27')](function(_0x2dd276){if(_0x2dd276){var _0xfbfbfb=_0x2dd276[_0x30a9('0x4c')]({'plain':!![]});_0xfbfbfb=qs[_0x30a9('0x4d')](_0xfbfbfb,['id',_0x30a9('0x4e'),_0x30a9('0x4f'),'crudPermissions']);_0x594133[_0x30a9('0x50')]=_['omit'](_0x594133[_0x30a9('0x50')],['id',_0x30a9('0x4e'),_0x30a9('0x4f')]);return db[_0x30a9('0x51')][_0x30a9('0x52')](function(_0x535344){return db[_0x30a9('0x43')][_0x30a9('0x4a')](_['merge'](_0xfbfbfb,_0x594133[_0x30a9('0x50')]),{'include':_0x594133[_0x30a9('0x33')][_0x30a9('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x535344})[_0x30a9('0x27')](function(_0x401397){var _0x114a63=_0x401397[_0x30a9('0x4c')]({'plain':!![]});return db[_0x30a9('0x53')][_0x30a9('0x54')]({'where':{'userProfileId':_0x594133[_0x30a9('0x46')]['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x3685fb){if(_0x3685fb){return BPromise['each'](_0x3685fb,function(_0x5d37cc){return new BPromise(function(_0x5176cd,_0x13c66f){if(_0x5d37cc[_0x30a9('0x55')]===null||_0x5d37cc[_0x30a9('0x55')]===0x1)_0x5176cd(null);return db[_0x30a9('0x56')][_0x30a9('0x54')]({'where':{'sectionId':_0x5d37cc['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x533dce){var _0x5da981=_[_0x30a9('0x2e')](_0x533dce,function(_0x24b858){return qs[_0x30a9('0x4d')](_0x24b858,['id',_0x30a9('0x4e'),_0x30a9('0x4f'),_0x30a9('0x57')]);});_0x5176cd(_0x5da981);})[_0x30a9('0x45')](function(_0x137aca){_0x13c66f(_0x137aca);});})[_0x30a9('0x27')](function(_0x1d3baa){var _0x677746=qs[_0x30a9('0x4d')](_0x5d37cc,['id','createdAt',_0x30a9('0x4f')]);_0x677746[_0x30a9('0x58')]=_0x114a63['id'];if(_0x1d3baa)_0x677746['Resources']=_0x1d3baa;return _0x677746;})[_0x30a9('0x27')](function(_0x2e97d4){return db[_0x30a9('0x53')][_0x30a9('0x4a')](_0x2e97d4,{'include':[{'model':db['UserProfileResource'],'as':_0x30a9('0x59')}],'raw':!![],'transaction':_0x535344});});})[_0x30a9('0x27')](function(){return _0x114a63;});}});});});}})[_0x30a9('0x27')](respondWithResult(_0x4ce93e,0xc9))['catch'](handleError(_0x4ce93e,null));};exports['update']=function(_0xdf8e3f,_0x3ce04a){if(_0xdf8e3f['body']['id']){delete _0xdf8e3f[_0x30a9('0x50')]['id'];}return db['UserProfile'][_0x30a9('0x49')]({'where':{'id':_0xdf8e3f[_0x30a9('0x46')]['id']}})[_0x30a9('0x27')](handleEntityNotFound(_0x3ce04a,null))[_0x30a9('0x27')](saveUpdates(_0xdf8e3f[_0x30a9('0x50')],null))['then'](respondWithResult(_0x3ce04a,null))[_0x30a9('0x45')](handleError(_0x3ce04a,null));};exports[_0x30a9('0x28')]=function(_0x359b30,_0xb96f7b){return db[_0x30a9('0x43')][_0x30a9('0x49')]({'where':{'id':_0x359b30[_0x30a9('0x46')]['id']}})['then'](handleEntityNotFound(_0xb96f7b,null))[_0x30a9('0x27')](removeEntity(_0xb96f7b,null))['catch'](handleError(_0xb96f7b,null));};exports[_0x30a9('0x5a')]=function(_0x59e9d5,_0x377c9b){return db[_0x30a9('0x43')]['describe']()[_0x30a9('0x27')](respondWithResult(_0x377c9b,null))[_0x30a9('0x45')](handleError(_0x377c9b,null));};exports[_0x30a9('0x5b')]=function(_0x58533d,_0x5d837a){var _0x1e69fc=_0x58533d[_0x30a9('0x50')];return db['UserProfile'][_0x30a9('0x49')]({'where':{'id':_0x58533d[_0x30a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d837a,null))[_0x30a9('0x27')](function(_0x434bd7){if(_0x434bd7){return db[_0x30a9('0x51')][_0x30a9('0x52')](function(_0x9a3315){return db[_0x30a9('0x53')]['destroy']({'where':{'userProfileId':_0x58533d[_0x30a9('0x46')]['id'],'sectionId':_['map'](_0x1e69fc,function(_0x5a375d){return _0x5a375d[_0x30a9('0x57')];})},'transaction':_0x9a3315})[_0x30a9('0x27')](function(){var _0x248d1e=_[_0x30a9('0x2e')](_0x1e69fc,function(_0x2a4aef){_0x2a4aef[_0x30a9('0x58')]=_0x58533d[_0x30a9('0x46')]['id'];return _0x2a4aef;});var _0xd4fb3b=[];return BPromise[_0x30a9('0x5c')](_0x248d1e,function(_0x54cbf5){return db[_0x30a9('0x53')]['create'](_0x54cbf5,{'include':[{'model':db[_0x30a9('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x9a3315})['then'](function(_0x5ab892){_0xd4fb3b[_0x30a9('0x5d')](_0x5ab892[_0x30a9('0x4c')]({'plain':!![]}));});})[_0x30a9('0x27')](function(){return _0xd4fb3b;});});});}})[_0x30a9('0x27')](function(_0x5c4577){return _0x5c4577;})[_0x30a9('0x27')](respondWithResult(_0x5d837a,null))['catch'](handleError(_0x5d837a,null));};exports['removeSections']=function(_0x233669,_0x2a3525){var _0x12b59b;return db[_0x30a9('0x43')][_0x30a9('0x49')]({'where':{'id':_0x233669['params']['id']},'attributes':['id',_0x30a9('0x2b')]})[_0x30a9('0x27')](handleEntityNotFound(_0x2a3525,null))[_0x30a9('0x27')](function(_0x50f8af){if(_0x50f8af){_0x12b59b=_0x50f8af;return db[_0x30a9('0x53')][_0x30a9('0x28')]({'where':{'userProfileId':_0x233669[_0x30a9('0x46')]['id'],'sectionId':_0x233669[_0x30a9('0x33')][_0x30a9('0x5e')]}});}})[_0x30a9('0x27')](function(){return _0x12b59b;})[_0x30a9('0x27')](respondWithStatusCode(_0x2a3525,null))[_0x30a9('0x45')](handleError(_0x2a3525,null));};exports[_0x30a9('0x5f')]=function(_0x19ee01,_0x5ce48e){var _0x3c2785=[];var _0x153a84=[];return db[_0x30a9('0x53')]['findAll']({'where':{'userProfileId':_0x19ee01[_0x30a9('0x46')]['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x487f14){_0x3c2785=_[_0x30a9('0x40')](_0x487f14,function(_0xdd2b21){return _0xdd2b21[_0x30a9('0x60')]===0x1||_['includes']([0x3eb,0x709],_0xdd2b21[_0x30a9('0x57')]);});if(!_[_0x30a9('0x61')](_0x3c2785)){return _[_0x30a9('0x2e')](_0x3c2785,function(_0x29c4f2){return _0x29c4f2[_0x30a9('0x57')];});}else{return;}})[_0x30a9('0x27')](function(_0x2ca9d7){if(_0x2ca9d7)_0x153a84=_0x2ca9d7;if(_['includes'](_0x153a84,0x64)){var _0x4e2511=_['find'](_0x3c2785,{'sectionId':0x64});return hasDefaultDashboard(_0x4e2511)[_0x30a9('0x27')](function(_0x4212ef){return _[_0x30a9('0x2e')](_0x3c2785,function(_0x3cca5c){if(_0x3cca5c[_0x30a9('0x57')]===0x64){_0x3cca5c['subsections']=_0x4212ef;}return _0x3cca5c;});});}else{return;}})[_0x30a9('0x27')](function(_0x414194){if(_0x414194)_0x3c2785=_0x414194;if(_[_0x30a9('0x62')](_0x153a84,0x3eb)){var _0x12f5d3=_[_0x30a9('0x49')](_0x3c2785,{'sectionId':0x3eb});return getCustomDashboards(_0x12f5d3)[_0x30a9('0x27')](function(_0x2e3acc){return _[_0x30a9('0x2e')](_0x3c2785,function(_0x3adabc){if(_0x12f5d3[_0x30a9('0x60')]){if(_0x3adabc[_0x30a9('0x57')]===0x3eb){_0x3adabc[_0x30a9('0x63')]=_0x2e3acc;}}else{if(_0x3adabc[_0x30a9('0x57')]===0x64){_0x3adabc[_0x30a9('0x63')]=_0x2e3acc;}}return _0x3adabc;});});}else{return;}})[_0x30a9('0x27')](function(_0x43d165){if(_0x43d165)_0x3c2785=_0x43d165;if(_[_0x30a9('0x62')](_0x153a84,0x709)){var _0x3546d0=_[_0x30a9('0x49')](_0x3c2785,{'sectionId':0x709});return getPlugins(_0x3546d0)[_0x30a9('0x27')](function(_0x43ddff){if(_0x3546d0[_0x30a9('0x60')]){return _[_0x30a9('0x2e')](_0x3c2785,function(_0x4f6015){if(_0x4f6015[_0x30a9('0x57')]===0x709){_0x4f6015[_0x30a9('0x63')]=_0x43ddff;}return _0x4f6015;});}else{var _0x128b6c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x43ddff};var _0x27acd4=_[_0x30a9('0x2e')](_0x3c2785);_0x27acd4['push'](_0x128b6c);return _0x27acd4;}});}else{return;}})[_0x30a9('0x27')](function(_0x21220c){if(_0x21220c)_0x3c2785=_0x21220c;return _['filter'](_0x3c2785,[_0x30a9('0x60'),0x1]);})[_0x30a9('0x27')](respondWithResult(_0x5ce48e,null))['catch'](handleError(_0x5ce48e,null));};function hasDefaultDashboard(_0x844555){var _0x51edf8=[0x65];return new BPromise(function(_0x13fd01,_0x4f5c83){try{if(_0x844555['autoAssociation']){_0x13fd01(_0x51edf8);}else{return db[_0x30a9('0x56')][_0x30a9('0x64')]({'where':{'sectionId':_0x844555['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x1cdfd0){_0x1cdfd0?_0x13fd01(_0x51edf8):_0x13fd01();});}}catch(_0x5deb65){_0x4f5c83(_0x5deb65);}});}function getCustomDashboards(_0x1ae55f){var _0x3b76ef=[];return new BPromise(function(_0x47c12d,_0x2a2ce4){try{if(_0x1ae55f[_0x30a9('0x55')]){return db[_0x30a9('0x65')][_0x30a9('0x54')]({'raw':!![]})[_0x30a9('0x27')](function(_0x3e291f){_0x3e291f[_0x30a9('0x66')](function(_0x11fe92){_0x3b76ef[_0x30a9('0x5d')](_0x11fe92['id']+0x1869f);});_0x47c12d(_0x3b76ef);});}else{return db['UserProfileResource'][_0x30a9('0x54')]({'where':{'sectionId':_0x1ae55f['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x1282fd){_0x1282fd[_0x30a9('0x66')](function(_0x449700){_0x3b76ef[_0x30a9('0x5d')](_0x449700[_0x30a9('0x67')]+0x1869f);});_0x47c12d(_0x3b76ef);});}}catch(_0x2ee971){_0x2a2ce4(_0x2ee971);}});}function getPlugins(_0x40a6ba){var _0xc41f03=[];return new BPromise(function(_0x26aedf,_0x1bca6c){try{if(_0x40a6ba['autoAssociation']){return db['Plugin'][_0x30a9('0x54')]({'raw':!![]})[_0x30a9('0x27')](function(_0x2cd102){_0x2cd102[_0x30a9('0x66')](function(_0x4b10cf){_0xc41f03[_0x30a9('0x5d')](_0x4b10cf['id']+0x15b38);});_0x26aedf(_0xc41f03);});}else{return db[_0x30a9('0x56')][_0x30a9('0x54')]({'where':{'sectionId':_0x40a6ba['id']},'raw':!![]})[_0x30a9('0x27')](function(_0x231fae){_0x231fae[_0x30a9('0x66')](function(_0x5b45fb){_0xc41f03[_0x30a9('0x5d')](_0x5b45fb[_0x30a9('0x67')]+0x15b38);});_0x26aedf(_0xc41f03);});}}catch(_0x426259){_0x1bca6c(_0x426259);}});}exports[_0x30a9('0x68')]=function(_0x2ec0ac,_0x675390){return db[_0x30a9('0x43')]['find']({'where':{'id':_0x2ec0ac[_0x30a9('0x46')]['id']}})[_0x30a9('0x27')](handleEntityNotFound(_0x675390,null))[_0x30a9('0x27')](function(_0x3b5d6c){if(_0x3b5d6c){return db[_0x30a9('0x51')][_0x30a9('0x52')](function(_0x3e358c){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2ec0ac['params']['id']},'attributes':['id'],'raw':!![]})[_0x30a9('0x27')](function(_0x1e145d){if(_0x1e145d){return db[_0x30a9('0x53')][_0x30a9('0x28')]({'where':{'userProfileId':_0x2ec0ac[_0x30a9('0x46')]['id'],'id':_['map'](_0x1e145d,function(_0xd5f06d){return _0xd5f06d['id'];})},'transaction':_0x3e358c});}})[_0x30a9('0x27')](function(_0x20b3b1){var _0x2f4084=_[_0x30a9('0x2e')](_0x2ec0ac[_0x30a9('0x50')],function(_0xaf2b2e){_0xaf2b2e[_0x30a9('0x58')]=_0x2ec0ac['params']['id'];return _0xaf2b2e;});return db[_0x30a9('0x53')][_0x30a9('0x69')](_0x2f4084,{'raw':!![],'transaction':_0x3e358c});})[_0x30a9('0x27')](function(_0x5a7ec1){var _0x512666=_[_0x30a9('0x40')](_['map'](_0x5a7ec1,function(_0x4861b5){return _0x4861b5[_0x30a9('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x512666){return db['UserProfileSection'][_0x30a9('0x54')]({'where':{'userProfileId':_0x2ec0ac[_0x30a9('0x46')]['id'],'sectionId':_['map'](_0x512666,function(_0x3856a0){return _0x3856a0[_0x30a9('0x57')];})},'attributes':['id',_0x30a9('0x57')],'raw':!![]})[_0x30a9('0x27')](function(_0x5c3204){var _0x4e8562=_[_0x30a9('0x2e')](_0x2ec0ac['body'],function(_0x48dec8){_0x48dec8[_0x30a9('0x58')]=_0x2ec0ac['params']['id'];return _0x48dec8;});return db[_0x30a9('0x56')]['bulkCreate'](_0x4e8562,{'raw':!![],'transaction':_0x3e358c});});}})[_0x30a9('0x45')](handleError(_0x675390,null));});}})[_0x30a9('0x27')](function(_0x27f640){var _0x2056b7=_[_0x30a9('0x2e')](_0x27f640,function(_0xfd8051){return _0xfd8051['get']({'plain':!![]});});})['then'](respondWithResult(_0x675390,null))[_0x30a9('0x45')](handleError(_0x675390,null));};exports['removeResources']=function(_0x1f07f3,_0x33dd6f,_0x3242d6){return db[_0x30a9('0x43')][_0x30a9('0x49')]({'where':{'id':_0x1f07f3['params']['id']}})[_0x30a9('0x27')](handleEntityNotFound(_0x33dd6f,null))['then'](function(_0x25f0a0){if(_0x25f0a0){return _0x25f0a0[_0x30a9('0x6a')](_0x1f07f3[_0x30a9('0x33')]['ids']);}})[_0x30a9('0x27')](respondWithStatusCode(_0x33dd6f,null))['catch'](handleError(_0x33dd6f,null));};exports[_0x30a9('0x6b')]=function(_0x5c8b72,_0x2b3907){var _0x4abdff={};if(!_0x5c8b72[_0x30a9('0x33')][_0x30a9('0x6c')])throw new Error(_0x30a9('0x6d'));if(!_0x5c8b72[_0x30a9('0x33')][_0x30a9('0x6e')](_0x30a9('0x3b'))){_0x4abdff[_0x30a9('0x1f')]=qs[_0x30a9('0x1f')](_0x5c8b72['query'][_0x30a9('0x1f')]);_0x4abdff[_0x30a9('0x1d')]=qs[_0x30a9('0x1d')](_0x5c8b72[_0x30a9('0x33')]['offset']);}return db[_0x30a9('0x43')][_0x30a9('0x49')]({'where':{'id':_0x5c8b72[_0x30a9('0x46')]['id']}})[_0x30a9('0x27')](function(_0x3d6cb1){if(!_0x3d6cb1)throw new Error(_0x30a9('0x6f')+_0x5c8b72[_0x30a9('0x46')]['id']);return db[_0x30a9('0x43')][_0x30a9('0x6b')](_0x5c8b72);})[_0x30a9('0x27')](respondWithFilteredResult(_0x2b3907,_0x4abdff))[_0x30a9('0x45')](handleError(_0x2b3907,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6c99388..b1023dd 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 _0x77a9=['hasOwnProperty','events','UserProfile','save','update','remove','emit'];(function(_0x5aeeec,_0x4286da){var _0x4fe257=function(_0x4a4f53){while(--_0x4a4f53){_0x5aeeec['push'](_0x5aeeec['shift']());}};_0x4fe257(++_0x4286da);}(_0x77a9,0x19e));var _0x977a=function(_0x13f0e1,_0xd6af){_0x13f0e1=_0x13f0e1-0x0;var _0x589f26=_0x77a9[_0x13f0e1];return _0x589f26;};'use strict';var EventEmitter=require(_0x977a('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x977a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x977a('0x2'),'afterUpdate':_0x977a('0x3'),'afterDestroy':_0x977a('0x4')};function emitEvent(_0x368664){return function(_0x520cd7,_0x318fc8,_0xb755){UserProfileEvents[_0x977a('0x5')](_0x368664+':'+_0x520cd7['id'],_0x520cd7);UserProfileEvents[_0x977a('0x5')](_0x368664,_0x520cd7);_0xb755(null);};}for(var e in events){if(events[_0x977a('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0xd781('0x0'));var UserProfile=require(_0xd781('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){UserProfileEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);UserProfileEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f410a2f..98717b2 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 _0x92ae=['toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','type','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','pauses','sounds','Sound','tags','Tag','templates','Template','Trigger','Trunk','variables','plugins','Plugin','extractedreports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','select','ui.','user_has_','where','query','OpenTabs','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','rawAttributes','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','DefaultReports','reportId','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','include','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','findAll','then','associatedResources','value','model','map','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','resourceId'];(function(_0x4b8ab1,_0x563850){var _0x2abd65=function(_0x5cc08d){while(--_0x5cc08d){_0x4b8ab1['push'](_0x4b8ab1['shift']());}};_0x2abd65(++_0x563850);}(_0x92ae,0x16a));var _0xe92a=function(_0x2ef107,_0x31f797){_0x2ef107=_0x2ef107-0x0;var _0x45b2db=_0x92ae[_0x2ef107];return _0x45b2db;};'use strict';var _=require(_0xe92a('0x0'));var attributes=require(_0xe92a('0x1'));var qs=require(_0xe92a('0x2'));var squel=require('squel');module[_0xe92a('0x3')]=function(_0xc618c0){var _0x2a3800=_0xc618c0['models'];function _0x322870(_0xdbb474,_0x5c0034){return new Promise(function(_0x3a794f,_0xf31220){if(!_0x5c0034)return _0x3a794f(null);var _0x52dbb5=_0x5c0034['filter']?{[_0x5c0034[_0xe92a('0x4')][_0xe92a('0x5')]]:_0x5c0034[_0xe92a('0x4')]['value']}:undefined;return _0x2a3800[_0xdbb474][_0xe92a('0x6')]({'where':_0x52dbb5,'raw':!![]})[_0xe92a('0x7')](function(_0x9f9b4f){_0x5c0034[_0xe92a('0x8')]=_['map'](_0x9f9b4f,'id');_0x3a794f(_0x5c0034);})['catch'](function(_0x13adf4){_0xf31220(_0x13adf4);});});}function _0x101460(_0x28272e,_0x430f9a){return new Promise(function(_0x37e2ba,_0x282e04){var _0x4d542d=_0x28272e[_0xe92a('0x4')]?{[_0x28272e[_0xe92a('0x4')][_0xe92a('0x5')]]:_0x28272e[_0xe92a('0x4')][_0xe92a('0x9')]}:undefined;return _0x2a3800[_0x28272e[_0xe92a('0xa')]][_0xe92a('0x6')]({'where':_0x4d542d,'raw':!![]})[_0xe92a('0x7')](function(_0x43054f){_0x430f9a[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x43054f,function(_0x40d3f5){return _0x40d3f5[_0xe92a('0xc')];});_0x37e2ba(_0x430f9a);})[_0xe92a('0xd')](function(_0x2808ff){_0x282e04(_0x2808ff);});});}function _0x572bc7(_0x1aec5b,_0x44e1c7,_0x46f529){if(!_0x44e1c7)return Promise[_0xe92a('0xe')](null);return new Promise(function(_0xde06e5,_0x4c7c11){return _0x2a3800[_0xe92a('0xf')][_0xe92a('0x6')]({'where':{'sectionId':_0x44e1c7['id']},'raw':!![]})[_0xe92a('0x7')](function(_0x40b837){if(_0x1aec5b[_0xe92a('0x5')]&&_0x1aec5b[_0xe92a('0x5')]!=='id'){_0x44e1c7[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x40b837,function(_0x146388){return _0x146388[_0x1aec5b[_0xe92a('0x5')]];});}else{if(_0x46f529===_0xe92a('0x10')){_0x44e1c7[_0xe92a('0x8')]=_[_0xe92a('0xb')](_0x40b837,function(_0x19a0e3){return{'id':_0x19a0e3[_0xe92a('0x11')],'type':_0x19a0e3['type']};});}else{_0x44e1c7['associatedResources']=_[_0xe92a('0xb')](_0x40b837,function(_0x508876){return _0x508876[_0xe92a('0x11')];});}}_0xde06e5(_0x44e1c7);})['catch'](function(_0x1df170){_0x4c7c11(_0x1df170);});});}function _0x4c072e(_0x5946e4,_0x4764e0){var _0x309204={'parentSections':[]};switch(_0x5946e4[_0xe92a('0x12')]()){case _0xe92a('0x13'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x15');break;case'odbc':_0x309204[_0xe92a('0x14')]=_0xe92a('0x16');break;case _0xe92a('0x17'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x18');_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x1a'),'field':_0xe92a('0xc'),'foreignKey':'projectName'}];break;case _0xe92a('0x1b'):_0x309204['childModel']='JscriptyProject';break;case _0xe92a('0x1c'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x1d');_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0xe92a('0x1f'):_0x309204['childModel']=_0xe92a('0x20');break;case _0xe92a('0x21'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x22');break;case _0xe92a('0x23'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x24');break;case _0xe92a('0x25'):_0x309204['childModel']=_0xe92a('0x26');break;case'chatwebsites':_0x309204[_0xe92a('0x14')]=_0xe92a('0x27');break;case _0xe92a('0x28'):_0x309204[_0xe92a('0x14')]='FaxQueue';break;case _0xe92a('0x29'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x2a');break;case _0xe92a('0x2b'):case _0xe92a('0x2c'):case _0xe92a('0x2d'):_0x309204['childModel']=_0xe92a('0x2e');break;case _0xe92a('0x2f'):_0x309204[_0xe92a('0x14')]='VoiceContext';break;case'voicemails':_0x309204['childModel']=_0xe92a('0x30');break;case _0xe92a('0x31'):_0x309204[_0xe92a('0x14')]='VoiceRecording';_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x32'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x33'),'model':'User','filter':{'field':_0xe92a('0x34'),'value':[_0xe92a('0x35')]}},{'name':_0xe92a('0x36'),'field':'name','foreignKey':_0xe92a('0x33'),'model':_0xe92a('0x37'),'filter':{'field':'role','value':[_0xe92a('0x38')]}},{'name':_0xe92a('0x39'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x3a'),'model':'VoiceQueue','filter':{'field':_0xe92a('0x3b'),'value':[_0xe92a('0x3c')]}},{'name':_0xe92a('0x3d'),'field':_0xe92a('0xc'),'foreignKey':_0xe92a('0x3a'),'model':_0xe92a('0x3e'),'filter':{'field':'type','value':[_0xe92a('0x3f')]}}];break;case _0xe92a('0x40'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x41');break;case _0xe92a('0x42'):_0x309204['childModel']='VoiceChanSpy';break;case _0xe92a('0x43'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x44');break;case _0xe92a('0x45'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x46');break;case _0xe92a('0x47'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x48');break;case'mailaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x49');break;case _0xe92a('0x4a'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x4b');break;case'openchannelqueues':_0x309204[_0xe92a('0x14')]=_0xe92a('0x4c');break;case _0xe92a('0x4d'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x4e');break;case _0xe92a('0x4f'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x50');break;case _0xe92a('0x51'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x52');break;case _0xe92a('0x53'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x54');break;case _0xe92a('0x55'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x56');break;case'teams':_0x309204['childModel']=_0xe92a('0x57');break;case'voicequeues':case'queuecampaigns':_0x309204[_0xe92a('0x14')]=_0xe92a('0x3e');if(_0x4764e0){_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x39')},{'name':_0xe92a('0x3d')}];}break;case _0xe92a('0x58'):case _0xe92a('0x59'):case _0xe92a('0x5a'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x37');if(_0x4764e0){_0x309204[_0xe92a('0x19')]=[{'name':_0xe92a('0x5b'),'filter':{'field':_0xe92a('0x34'),'value':[_0xe92a('0x5c'),_0xe92a('0x5d')]},'ignore':!![]},{'name':_0xe92a('0x32')},{'name':_0xe92a('0x36')}];}break;case _0xe92a('0x5e'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x5f');break;case _0xe92a('0x60'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x61');break;case _0xe92a('0x62'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x63');break;case'sugarcrmaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x64');break;case'deskaccounts':_0x309204[_0xe92a('0x14')]=_0xe92a('0x65');break;case _0xe92a('0x66'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x67');break;case _0xe92a('0x68'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x37');break;case'cannedanswers':_0x309204[_0xe92a('0x14')]=_0xe92a('0x69');break;case _0xe92a('0x6a'):_0x309204['childModel']=_0xe92a('0x6b');break;case _0xe92a('0x6c'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x6d');break;case'intervals':_0x309204[_0xe92a('0x14')]='Interval';break;case _0xe92a('0x6e'):_0x309204['childModel']='Pause';break;case'scheduler':_0x309204[_0xe92a('0x14')]='Schedule';break;case _0xe92a('0x6f'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x70');break;case _0xe92a('0x71'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x72');break;case _0xe92a('0x73'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x74');break;case'triggers':_0x309204[_0xe92a('0x14')]=_0xe92a('0x75');break;case'trunks':_0x309204[_0xe92a('0x14')]=_0xe92a('0x76');break;case _0xe92a('0x77'):_0x309204[_0xe92a('0x14')]='Variable';break;case _0xe92a('0x78'):_0x309204['childModel']=_0xe92a('0x79');break;case _0xe92a('0x7a'):_0x309204[_0xe92a('0x14')]='AnalyticExtractedReport';_0x309204[_0xe92a('0x19')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xe92a('0x7b'):_0x309204[_0xe92a('0x14')]=_0xe92a('0x7c');break;}return _0x309204;}function _0x52b730(_0x43519d,_0x5c2ca2){var _0x13d238=_0x43519d[_0xe92a('0x7d')](0x0)[_0xe92a('0x7e')]()+_0x43519d[_0xe92a('0x7f')](0x1);var _0x10c5a2={'type':_0x2a3800[_0xe92a('0x80')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x1b6c21,_0x262904){var _0x36a09f=squel[_0xe92a('0x81')]()[_0xe92a('0x5')](_0xe92a('0x82')+_0x13d238+'InteractionId','id')[_0xe92a('0x5')]('ui.createdAt')['from'](_0xe92a('0x83')+_0x43519d+'_interactions','ui')[_0xe92a('0x84')]('ui.UserId\x20=\x20?',_0x5c2ca2['id']);return _0x2a3800['sequelize'][_0xe92a('0x85')](_0x36a09f['toString'](),_0x10c5a2)[_0xe92a('0x7')](function(_0x1c1f12){_0x5c2ca2[_0x13d238+_0xe92a('0x86')]=_0x1c1f12;_0x1b6c21(_0x1c1f12);})['catch'](function(_0x33f5c4){_0x262904(_0x33f5c4);});});}return _0xc618c0['define']('UserProfile',attributes,{'tableName':_0xe92a('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x396d66){var _0x2d4a50={'raw':_0x396d66['query'][_0xe92a('0x88')],'where':{}};var _0x149226={};var _0x22012c={'count':0x0,'rows':[]};var _0x33a293=_0x396d66['query'][_0xe92a('0x89')];var _0x571b0c=_0x396d66[_0xe92a('0x85')][_0xe92a('0x8a')]||![];var _0x5e0014=_0x4c072e(_0x33a293,_0x571b0c);if(!_0x5e0014[_0xe92a('0x14')])throw new Error(_0xe92a('0x8b')+_0x33a293+'\x27');var _0x5610a8=[{'name':_0x33a293}];if(!_[_0xe92a('0x8c')](_0x5e0014[_0xe92a('0x19')]))_0x5610a8=_0x5e0014[_0xe92a('0x19')];var _0x3bf9c1=[];for(var _0x4a1025=0x0;_0x4a1025<_0x5610a8[_0xe92a('0x8d')];_0x4a1025++){_0x3bf9c1[_0xe92a('0x8e')](_0x2a3800[_0xe92a('0x8f')][_0xe92a('0x90')]({'where':{'userProfileId':_0x396d66[_0xe92a('0x91')]['id'],'name':_0x5610a8[_0x4a1025][_0xe92a('0xc')]},'raw':!![]}));}return Promise[_0xe92a('0x92')](_0x3bf9c1)[_0xe92a('0x7')](function(_0x1188fd){var _0x5f1c18=_[_0xe92a('0x4')](_0x1188fd,function(_0x1768e6){return _0x1768e6?_0x1768e6:undefined;});var _0x4c8c37=_[_0xe92a('0x4')](_0x5610a8,[_0xe92a('0x93'),!![]]);var _0x561613=_[_0xe92a('0x8c')](_0x5f1c18)&&_['isEmpty'](_0x4c8c37)?null:_['union'](_0x4c8c37,_0x5f1c18);if(!_0x561613)return null;var _0x5bd1f9=[];for(var _0x2182cc=0x0;_0x2182cc<_0x561613[_0xe92a('0x8d')];_0x2182cc++){var _0x49b368=_[_0xe92a('0x90')](_0x5610a8,function(_0x59c392){return _0x561613[_0x2182cc]?_0x59c392[_0xe92a('0xc')]===_0x561613[_0x2182cc][_0xe92a('0xc')]:null;});if(_0x49b368){if(_0x561613[_0x2182cc][_0xe92a('0x93')]){_0x5bd1f9[_0xe92a('0x8e')](_0x322870(_0x5e0014[_0xe92a('0x14')],_0x561613[_0x2182cc]));}else{if(!_0x561613[_0x2182cc][_0xe92a('0x94')]){_0x5bd1f9[_0xe92a('0x8e')](_0x572bc7(_0x49b368,_0x561613[_0x2182cc],_0x5e0014[_0xe92a('0x14')]));}else{if(_0x49b368['model']){_0x5bd1f9[_0xe92a('0x8e')](_0x101460(_0x49b368,_0x561613[_0x2182cc]));}}}}}return Promise['all'](_0x5bd1f9);})[_0xe92a('0x7')](function(_0x308a8f){var _0x48ba65=_0x308a8f;var _0x5a9e45=null;if(_0x48ba65){_0x5a9e45=_0x48ba65[_0xe92a('0x8d')]===0x1?_0x48ba65[0x0]:null;}if(!_0x5a9e45&&!_0x48ba65)return _0x22012c;var _0x1bab3a=_0x2a3800[_0x5e0014['childModel']][_0xe92a('0x95')];_0x149226[_0xe92a('0xa')]=_['keys'](_0x1bab3a);_0x149226[_0xe92a('0x85')]=_['keys'](_0x396d66[_0xe92a('0x85')]);_0x149226['filters']=_[_0xe92a('0x96')](_0x149226[_0xe92a('0xa')],_0x149226[_0xe92a('0x85')]);_0x2d4a50[_0xe92a('0x97')]=_[_0xe92a('0x96')](_0x149226[_0xe92a('0xa')],qs['fields'](_0x396d66['query'][_0xe92a('0x98')]));_0x2d4a50[_0xe92a('0x97')]=_0x2d4a50['attributes'][_0xe92a('0x8d')]?_0x2d4a50[_0xe92a('0x97')]:_0x149226[_0xe92a('0xa')];if(!_0x396d66[_0xe92a('0x85')][_0xe92a('0x99')](_0xe92a('0x9a'))){_0x2d4a50['limit']=qs[_0xe92a('0x9b')](_0x396d66[_0xe92a('0x85')]['limit']);_0x2d4a50[_0xe92a('0x9c')]=qs[_0xe92a('0x9c')](_0x396d66[_0xe92a('0x85')][_0xe92a('0x9c')]);}_0x2d4a50['order']=qs[_0xe92a('0x9d')](_0x396d66[_0xe92a('0x85')][_0xe92a('0x9d')]);_0x2d4a50[_0xe92a('0x84')]=qs[_0xe92a('0x9e')](_[_0xe92a('0x9f')](_0x396d66[_0xe92a('0x85')],_0x149226[_0xe92a('0x9e')]));if(_0x396d66[_0xe92a('0x85')][_0xe92a('0x4')]){_0x2d4a50[_0xe92a('0x84')]=_[_0xe92a('0xa0')](_0x2d4a50[_0xe92a('0x84')],{'$or':_['map'](_0x1bab3a,function(_0x1c9e80){if(_0x1c9e80['type'][_0xe92a('0xa1')]!==_0xe92a('0xa2')){var _0xd3792b={};_0xd3792b[_0x1c9e80[_0xe92a('0x5')]]={'$like':'%'+_0x396d66[_0xe92a('0x85')][_0xe92a('0x4')]+'%'};return _0xd3792b;}})});}var _0x36c355=[];var _0x360c21=null;var _0x1b0632={};if(_0x5a9e45){_0x360c21=_[_0xe92a('0x90')](_0x5610a8,[_0xe92a('0xc'),_0x5a9e45[_0xe92a('0xc')]]);if(_0x360c21[_0xe92a('0x5')]){_0x1b0632={};if(_0x5e0014['childModel']===_0xe92a('0x10')){_0x1b0632[_0x360c21['foreignKey']]=_[_0xe92a('0xb')](_0x5a9e45['associatedResources'],'id');}else{_0x1b0632[_0x360c21[_0xe92a('0xa3')]]=_0x5a9e45[_0xe92a('0x8')];}_0x36c355['push'](_0x1b0632);}else{_0x2d4a50[_0xe92a('0x84')]['id']=_0x5a9e45[_0xe92a('0x8')];}}else{for(var _0x1d6cee=0x0;_0x1d6cee<_0x48ba65[_0xe92a('0x8d')];_0x1d6cee++){_0x360c21=_['find'](_0x5610a8,[_0xe92a('0xc'),_0x48ba65[_0x1d6cee][_0xe92a('0xc')]]);if(_0x360c21['field']){_0x1b0632={};_0x1b0632[_0x360c21['foreignKey']]=_0x48ba65[_0x1d6cee]['associatedResources'];_0x36c355['push'](_0x1b0632);}else{if(!_0x2d4a50[_0xe92a('0x84')]['id'])_0x2d4a50[_0xe92a('0x84')]['id']=[];_0x48ba65[_0x1d6cee]['associatedResources'][_0xe92a('0xa4')](function(_0x2995a5){_0x2d4a50[_0xe92a('0x84')]['id'][_0xe92a('0x8e')](_0x2995a5);});}}}if(!_[_0xe92a('0x8c')](_0x36c355)){_0x2d4a50['where']=_[_0xe92a('0xa0')](_0x2d4a50[_0xe92a('0x84')],{'$and':{'$or':_0x36c355}});}_0x2d4a50=_['merge']({},_0x2d4a50,_0x396d66[_0xe92a('0xa5')]);if(_0x5a9e45&&!_0x5a9e45[_0xe92a('0x94')]&&_0x5e0014[_0xe92a('0x14')]===_0xe92a('0x10')){if(_0x396d66['query'][_0xe92a('0xa6')]){_0x2d4a50['include']=[{'all':!![]}];}return _0x2a3800[_0x5e0014['childModel']]['findAll'](_0x2d4a50)[_0xe92a('0x7')](function(_0x2c09bd){var _0x300506=[];_0x2c09bd[_0xe92a('0xa4')](function(_0x34ed33){var _0x5c6fc6;switch(_0x34ed33[_0xe92a('0xa7')]){case _0xe92a('0xa8'):_0x5c6fc6=_[_0xe92a('0x90')](_0x5a9e45[_0xe92a('0x8')],function(_0x7993d2){return _0x7993d2['id']===_0x34ed33['reportId']&&_0x7993d2[_0xe92a('0x3b')]===_0xe92a('0xa9');});break;case'custom':_0x5c6fc6=_[_0xe92a('0x90')](_0x5a9e45[_0xe92a('0x8')],function(_0x4eb725){return _0x4eb725['id']===_0x34ed33[_0xe92a('0xaa')]&&_0x4eb725[_0xe92a('0x3b')]===_0xe92a('0xab');});break;}if(_0x5c6fc6)_0x300506[_0xe92a('0x8e')](_0x34ed33);});_0x22012c[_0xe92a('0xac')]=_0x300506[_0xe92a('0x8d')];_0x22012c[_0xe92a('0xad')]=_0x300506;return _0x22012c;});}else{if(!_[_0xe92a('0x8c')](_0x396d66['query']['ids'])){_0x2d4a50[_0xe92a('0x84')]['id']=_0x2d4a50[_0xe92a('0x84')]['id']?_[_0xe92a('0x96')](_0x2d4a50[_0xe92a('0x84')]['id'],_0x396d66[_0xe92a('0x85')][_0xe92a('0xae')]):_0x396d66[_0xe92a('0x85')]['ids'];if(_0x396d66[_0xe92a('0x85')][_0xe92a('0xaf')]){_0x2d4a50[_0xe92a('0xb0')]=_0x396d66[_0xe92a('0x85')][_0xe92a('0xaf')];}}if(_0x396d66['query'][_0xe92a('0xb1')]){_0x2d4a50[_0xe92a('0x84')]=_['merge'](_0x2d4a50[_0xe92a('0x84')],{'$and':_0x396d66['query'][_0xe92a('0xb1')]});}return _0x2a3800[_0x5e0014[_0xe92a('0x14')]][_0xe92a('0xac')]({'where':_0x2d4a50[_0xe92a('0x84')]})[_0xe92a('0x7')](function(_0x4a6ef5){_0x22012c['count']=_0x4a6ef5;if(_0x396d66['query'][_0xe92a('0xa6')]){if(_0x5e0014['childModel']===_0xe92a('0x1d')){_0x2d4a50[_0xe92a('0xb2')]=[{'model':_0x2a3800['Tag'],'as':'Tags','attributes':['id','name',_0xe92a('0xb3')],'required':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]?!![]:![]},{'model':_0x2a3800[_0xe92a('0x72')],'as':_0xe92a('0xb5'),'attributes':['id','name',_0xe92a('0xb3')],'through':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]?{'attributes':[],'where':{'TagId':_0x396d66[_0xe92a('0x85')][_0xe92a('0xb4')]||undefined}}:{},'required':_0x396d66['query']['tag']?!![]:![]}];}else{_0x2d4a50[_0xe92a('0xb2')]=[{'all':!![]}];}}return _0x2a3800[_0x5e0014[_0xe92a('0x14')]]['findAll'](_0x2d4a50);})[_0xe92a('0x7')](function(_0x3b25ac){_0x22012c['rows']=_0x3b25ac;if(_0x33a293==='Agents'&&_0x396d66[_0xe92a('0x85')][_0xe92a('0xb6')]===_0xe92a('0xb7')){var _0x519883=[];for(var _0x515879=0x0;_0x515879<_0x22012c[_0xe92a('0xad')][_0xe92a('0x8d')];_0x515879++){_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xb8'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xba'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbb'),_0x22012c[_0xe92a('0xad')][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbc'),_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883['push'](_0x52b730('openchannel',_0x22012c['rows'][_0x515879][_0xe92a('0xb9')]));_0x519883[_0xe92a('0x8e')](_0x52b730(_0xe92a('0xbd'),_0x22012c[_0xe92a('0xad')][_0x515879]['dataValues']));}return Promise[_0xe92a('0x92')](_0x519883)[_0xe92a('0x7')](function(){return _0x22012c;});}return _0x22012c;});}});}}});}; \ No newline at end of file +var _0x2812=['SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','sounds','Sound','Tag','templates','Template','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','define','UserProfile','user_profiles','raw','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','params','all','union','length','find','ignore','autoAssociation','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','merge','VIRTUAL','foreignKey','forEach','include','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','map','model','associatedResources','name','catch','resolve','resourceId','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections'];(function(_0x49f47b,_0x1000ad){var _0x5e488e=function(_0x2c3e51){while(--_0x2c3e51){_0x49f47b['push'](_0x49f47b['shift']());}};_0x5e488e(++_0x1000ad);}(_0x2812,0x15e));var _0x2281=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0x2812[_0x156a0d];return _0x98a9ba;};'use strict';var _=require(_0x2281('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0x2281('0x1'));var squel=require('squel');module[_0x2281('0x2')]=function(_0x5302fd){var _0x6d8c05=_0x5302fd[_0x2281('0x3')];function _0xcf0bf3(_0x301c15,_0x5aff43){return new Promise(function(_0x421d20,_0x44c641){if(!_0x5aff43)return _0x421d20(null);var _0x20a13d=_0x5aff43['filter']?{[_0x5aff43[_0x2281('0x4')][_0x2281('0x5')]]:_0x5aff43['filter'][_0x2281('0x6')]}:undefined;return _0x6d8c05[_0x301c15][_0x2281('0x7')]({'where':_0x20a13d,'raw':!![]})[_0x2281('0x8')](function(_0x1dbded){_0x5aff43['associatedResources']=_[_0x2281('0x9')](_0x1dbded,'id');_0x421d20(_0x5aff43);})['catch'](function(_0x439d94){_0x44c641(_0x439d94);});});}function _0x31d1ba(_0x5bfeeb,_0x3e4eab){return new Promise(function(_0x16b94f,_0x53d92a){var _0x5d2762=_0x5bfeeb[_0x2281('0x4')]?{[_0x5bfeeb['filter']['field']]:_0x5bfeeb['filter'][_0x2281('0x6')]}:undefined;return _0x6d8c05[_0x5bfeeb[_0x2281('0xa')]][_0x2281('0x7')]({'where':_0x5d2762,'raw':!![]})[_0x2281('0x8')](function(_0x494bc8){_0x3e4eab[_0x2281('0xb')]=_[_0x2281('0x9')](_0x494bc8,function(_0x59a944){return _0x59a944[_0x2281('0xc')];});_0x16b94f(_0x3e4eab);})[_0x2281('0xd')](function(_0x3b12fd){_0x53d92a(_0x3b12fd);});});}function _0x58d580(_0x20282a,_0x5d1abd,_0x375a3e){if(!_0x5d1abd)return Promise[_0x2281('0xe')](null);return new Promise(function(_0x337704,_0x3cbc15){return _0x6d8c05['UserProfileResource'][_0x2281('0x7')]({'where':{'sectionId':_0x5d1abd['id']},'raw':!![]})[_0x2281('0x8')](function(_0x51632b){if(_0x20282a[_0x2281('0x5')]&&_0x20282a[_0x2281('0x5')]!=='id'){_0x5d1abd['associatedResources']=_[_0x2281('0x9')](_0x51632b,function(_0x52f37d){return _0x52f37d[_0x20282a[_0x2281('0x5')]];});}else{if(_0x375a3e==='AnalyticExtractedReport'){_0x5d1abd[_0x2281('0xb')]=_[_0x2281('0x9')](_0x51632b,function(_0x392194){return{'id':_0x392194['resourceId'],'type':_0x392194['type']};});}else{_0x5d1abd['associatedResources']=_['map'](_0x51632b,function(_0x41dd72){return _0x41dd72[_0x2281('0xf')];});}}_0x337704(_0x5d1abd);})[_0x2281('0xd')](function(_0x963c80){_0x3cbc15(_0x963c80);});});}function _0x20d9a2(_0x32bac4,_0x2f02cf){var _0x101312={'parentSections':[]};switch(_0x32bac4[_0x2281('0x10')]()){case _0x2281('0x11'):_0x101312[_0x2281('0x12')]='SquareProject';break;case _0x2281('0x13'):_0x101312[_0x2281('0x12')]=_0x2281('0x14');break;case _0x2281('0x15'):_0x101312[_0x2281('0x12')]=_0x2281('0x16');_0x101312[_0x2281('0x17')]=[{'name':_0x2281('0x18'),'field':_0x2281('0xc'),'foreignKey':_0x2281('0x19')}];break;case _0x2281('0x1a'):_0x101312[_0x2281('0x12')]=_0x2281('0x1b');break;case _0x2281('0x1c'):_0x101312['childModel']=_0x2281('0x1d');_0x101312[_0x2281('0x17')]=[{'name':'Lists','field':'id','foreignKey':_0x2281('0x1e')}];break;case _0x2281('0x1f'):_0x101312[_0x2281('0x12')]=_0x2281('0x20');break;case'companies':_0x101312[_0x2281('0x12')]=_0x2281('0x21');break;case _0x2281('0x22'):_0x101312[_0x2281('0x12')]='CmCustomField';break;case _0x2281('0x23'):_0x101312[_0x2281('0x12')]='ChatQueue';break;case'chatwebsites':_0x101312['childModel']=_0x2281('0x24');break;case _0x2281('0x25'):_0x101312[_0x2281('0x12')]='FaxQueue';break;case _0x2281('0x26'):_0x101312['childModel']=_0x2281('0x27');break;case _0x2281('0x28'):case _0x2281('0x29'):case'outboundroutes':_0x101312[_0x2281('0x12')]=_0x2281('0x2a');break;case _0x2281('0x2b'):_0x101312[_0x2281('0x12')]=_0x2281('0x2c');break;case _0x2281('0x2d'):_0x101312[_0x2281('0x12')]=_0x2281('0x2e');break;case _0x2281('0x2f'):_0x101312[_0x2281('0x12')]=_0x2281('0x30');_0x101312['parentSections']=[{'name':_0x2281('0x31'),'field':_0x2281('0xc'),'foreignKey':_0x2281('0x32'),'model':_0x2281('0x33'),'filter':{'field':_0x2281('0x34'),'value':['agent']}},{'name':_0x2281('0x35'),'field':_0x2281('0xc'),'foreignKey':_0x2281('0x32'),'model':_0x2281('0x33'),'filter':{'field':_0x2281('0x34'),'value':['telephone']}},{'name':_0x2281('0x36'),'field':_0x2281('0xc'),'foreignKey':_0x2281('0x37'),'model':_0x2281('0x38'),'filter':{'field':_0x2281('0x39'),'value':['inbound']}},{'name':_0x2281('0x3a'),'field':_0x2281('0xc'),'foreignKey':_0x2281('0x37'),'model':_0x2281('0x38'),'filter':{'field':_0x2281('0x39'),'value':[_0x2281('0x3b')]}}];break;case'musiconholds':_0x101312[_0x2281('0x12')]=_0x2281('0x3c');break;case'chanspies':_0x101312[_0x2281('0x12')]=_0x2281('0x3d');break;case _0x2281('0x3e'):_0x101312[_0x2281('0x12')]=_0x2281('0x3f');break;case'ivrcampaigns':_0x101312[_0x2281('0x12')]=_0x2281('0x40');break;case _0x2281('0x41'):_0x101312['childModel']='MailQueue';break;case _0x2281('0x42'):_0x101312['childModel']=_0x2281('0x43');break;case _0x2281('0x44'):_0x101312['childModel']='MailSubstatus';break;case _0x2281('0x45'):_0x101312['childModel']='OpenchannelQueue';break;case _0x2281('0x46'):_0x101312[_0x2281('0x12')]=_0x2281('0x47');break;case _0x2281('0x48'):_0x101312[_0x2281('0x12')]=_0x2281('0x49');break;case'smsaccounts':_0x101312[_0x2281('0x12')]='SmsAccount';break;case _0x2281('0x4a'):_0x101312[_0x2281('0x12')]='WhatsappQueue';break;case _0x2281('0x4b'):_0x101312[_0x2281('0x12')]=_0x2281('0x4c');break;case _0x2281('0x4d'):_0x101312[_0x2281('0x12')]='Team';break;case _0x2281('0x4e'):case _0x2281('0x4f'):_0x101312[_0x2281('0x12')]=_0x2281('0x38');if(_0x2f02cf){_0x101312[_0x2281('0x17')]=[{'name':_0x2281('0x36')},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case'telephones':_0x101312[_0x2281('0x12')]=_0x2281('0x33');if(_0x2f02cf){_0x101312[_0x2281('0x17')]=[{'name':_0x2281('0x50'),'filter':{'field':_0x2281('0x34'),'value':[_0x2281('0x51'),'user']},'ignore':!![]},{'name':_0x2281('0x31')},{'name':'Telephones'}];}break;case _0x2281('0x52'):_0x101312['childModel']=_0x2281('0x53');break;case _0x2281('0x54'):_0x101312[_0x2281('0x12')]=_0x2281('0x55');break;case _0x2281('0x56'):_0x101312['childModel']=_0x2281('0x57');break;case _0x2281('0x58'):_0x101312[_0x2281('0x12')]=_0x2281('0x59');break;case _0x2281('0x5a'):_0x101312[_0x2281('0x12')]=_0x2281('0x5b');break;case'zohoaccounts':_0x101312[_0x2281('0x12')]=_0x2281('0x5c');break;case'vtigeraccounts':_0x101312[_0x2281('0x12')]=_0x2281('0x33');break;case _0x2281('0x5d'):_0x101312['childModel']=_0x2281('0x5e');break;case _0x2281('0x5f'):_0x101312[_0x2281('0x12')]=_0x2281('0x60');break;case _0x2281('0x61'):_0x101312[_0x2281('0x12')]=_0x2281('0x62');break;case _0x2281('0x63'):_0x101312[_0x2281('0x12')]=_0x2281('0x64');break;case _0x2281('0x65'):_0x101312[_0x2281('0x12')]='Pause';break;case _0x2281('0x66'):_0x101312['childModel']='Schedule';break;case _0x2281('0x67'):_0x101312[_0x2281('0x12')]=_0x2281('0x68');break;case'tags':_0x101312[_0x2281('0x12')]=_0x2281('0x69');break;case _0x2281('0x6a'):_0x101312[_0x2281('0x12')]=_0x2281('0x6b');break;case'triggers':_0x101312[_0x2281('0x12')]=_0x2281('0x6c');break;case _0x2281('0x6d'):_0x101312[_0x2281('0x12')]=_0x2281('0x6e');break;case'variables':_0x101312[_0x2281('0x12')]='Variable';break;case _0x2281('0x6f'):_0x101312[_0x2281('0x12')]=_0x2281('0x70');break;case _0x2281('0x71'):_0x101312['childModel']=_0x2281('0x72');_0x101312[_0x2281('0x17')]=[{'name':_0x2281('0x73'),'field':'id','foreignKey':_0x2281('0x74')}];break;case _0x2281('0x75'):_0x101312['childModel']=_0x2281('0x76');break;}return _0x101312;}function _0x4203cd(_0x2239aa,_0x205810){var _0x1db0d2=_0x2239aa['charAt'](0x0)[_0x2281('0x77')]()+_0x2239aa[_0x2281('0x78')](0x1);var _0x2e7121={'type':_0x6d8c05['Sequelize']['QueryTypes'][_0x2281('0x79')],'raw':!![]};return new Promise(function(_0x48ce5d,_0x2e032b){var _0x3ea849=squel[_0x2281('0x7a')]()[_0x2281('0x5')](_0x2281('0x7b')+_0x1db0d2+_0x2281('0x7c'),'id')[_0x2281('0x5')](_0x2281('0x7d'))[_0x2281('0x7e')](_0x2281('0x7f')+_0x2239aa+_0x2281('0x80'),'ui')[_0x2281('0x81')](_0x2281('0x82'),_0x205810['id']);return _0x6d8c05['sequelize']['query'](_0x3ea849[_0x2281('0x83')](),_0x2e7121)[_0x2281('0x8')](function(_0x44d76d){_0x205810[_0x1db0d2+'OpenTabs']=_0x44d76d;_0x48ce5d(_0x44d76d);})[_0x2281('0xd')](function(_0x9b1971){_0x2e032b(_0x9b1971);});});}return _0x5302fd[_0x2281('0x84')](_0x2281('0x85'),attributes,{'tableName':_0x2281('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3c89ab){var _0x405c41={'raw':_0x3c89ab['query'][_0x2281('0x87')],'where':{}};var _0x4d0121={};var _0x27a1c6={'count':0x0,'rows':[]};var _0x400c5c=_0x3c89ab[_0x2281('0x88')][_0x2281('0x89')];var _0x47d3f0=_0x3c89ab[_0x2281('0x88')][_0x2281('0x8a')]||![];var _0x3b0fc5=_0x20d9a2(_0x400c5c,_0x47d3f0);if(!_0x3b0fc5[_0x2281('0x12')])throw new Error(_0x2281('0x8b')+_0x400c5c+'\x27');var _0x2e8e9b=[{'name':_0x400c5c}];if(!_[_0x2281('0x8c')](_0x3b0fc5['parentSections']))_0x2e8e9b=_0x3b0fc5['parentSections'];var _0xb23b5a=[];for(var _0x4cc542=0x0;_0x4cc542<_0x2e8e9b['length'];_0x4cc542++){_0xb23b5a[_0x2281('0x8d')](_0x6d8c05['UserProfileSection']['find']({'where':{'userProfileId':_0x3c89ab[_0x2281('0x8e')]['id'],'name':_0x2e8e9b[_0x4cc542]['name']},'raw':!![]}));}return Promise[_0x2281('0x8f')](_0xb23b5a)[_0x2281('0x8')](function(_0x304931){var _0x10c1b8=_[_0x2281('0x4')](_0x304931,function(_0x373396){return _0x373396?_0x373396:undefined;});var _0x4aeff9=_[_0x2281('0x4')](_0x2e8e9b,['ignore',!![]]);var _0x1b4516=_[_0x2281('0x8c')](_0x10c1b8)&&_[_0x2281('0x8c')](_0x4aeff9)?null:_[_0x2281('0x90')](_0x4aeff9,_0x10c1b8);if(!_0x1b4516)return null;var _0x37ca5b=[];for(var _0x389583=0x0;_0x389583<_0x1b4516[_0x2281('0x91')];_0x389583++){var _0x50fe4e=_[_0x2281('0x92')](_0x2e8e9b,function(_0x2e3062){return _0x1b4516[_0x389583]?_0x2e3062[_0x2281('0xc')]===_0x1b4516[_0x389583][_0x2281('0xc')]:null;});if(_0x50fe4e){if(_0x1b4516[_0x389583][_0x2281('0x93')]){_0x37ca5b[_0x2281('0x8d')](_0xcf0bf3(_0x3b0fc5[_0x2281('0x12')],_0x1b4516[_0x389583]));}else{if(!_0x1b4516[_0x389583][_0x2281('0x94')]){_0x37ca5b[_0x2281('0x8d')](_0x58d580(_0x50fe4e,_0x1b4516[_0x389583],_0x3b0fc5[_0x2281('0x12')]));}else{if(_0x50fe4e[_0x2281('0xa')]){_0x37ca5b['push'](_0x31d1ba(_0x50fe4e,_0x1b4516[_0x389583]));}}}}}return Promise['all'](_0x37ca5b);})[_0x2281('0x8')](function(_0x268c42){var _0x5bfd9a=_0x268c42;var _0x25ae1b=null;if(_0x5bfd9a){_0x25ae1b=_0x5bfd9a['length']===0x1?_0x5bfd9a[0x0]:null;}if(!_0x25ae1b&&!_0x5bfd9a)return _0x27a1c6;var _0x4dbd61=_0x6d8c05[_0x3b0fc5[_0x2281('0x12')]]['rawAttributes'];_0x4d0121['model']=_['keys'](_0x4dbd61);_0x4d0121[_0x2281('0x88')]=_[_0x2281('0x95')](_0x3c89ab[_0x2281('0x88')]);_0x4d0121[_0x2281('0x96')]=_[_0x2281('0x97')](_0x4d0121['model'],_0x4d0121[_0x2281('0x88')]);_0x405c41['attributes']=_['intersection'](_0x4d0121[_0x2281('0xa')],qs['fields'](_0x3c89ab[_0x2281('0x88')][_0x2281('0x98')]));_0x405c41[_0x2281('0x99')]=_0x405c41['attributes'][_0x2281('0x91')]?_0x405c41[_0x2281('0x99')]:_0x4d0121['model'];if(!_0x3c89ab[_0x2281('0x88')][_0x2281('0x9a')](_0x2281('0x9b'))){_0x405c41[_0x2281('0x9c')]=qs[_0x2281('0x9c')](_0x3c89ab['query']['limit']);_0x405c41['offset']=qs['offset'](_0x3c89ab[_0x2281('0x88')]['offset']);}_0x405c41[_0x2281('0x9d')]=qs[_0x2281('0x9e')](_0x3c89ab[_0x2281('0x88')][_0x2281('0x9e')]);_0x405c41[_0x2281('0x81')]=qs[_0x2281('0x96')](_['pick'](_0x3c89ab[_0x2281('0x88')],_0x4d0121[_0x2281('0x96')]));if(_0x3c89ab[_0x2281('0x88')]['filter']){_0x405c41[_0x2281('0x81')]=_[_0x2281('0x9f')](_0x405c41[_0x2281('0x81')],{'$or':_['map'](_0x4dbd61,function(_0xeed4eb){if(_0xeed4eb['type']['key']!==_0x2281('0xa0')){var _0x26f41d={};_0x26f41d[_0xeed4eb[_0x2281('0x5')]]={'$like':'%'+_0x3c89ab[_0x2281('0x88')]['filter']+'%'};return _0x26f41d;}})});}var _0x280746=[];var _0x429b25=null;var _0x3affc5={};if(_0x25ae1b){_0x429b25=_[_0x2281('0x92')](_0x2e8e9b,[_0x2281('0xc'),_0x25ae1b[_0x2281('0xc')]]);if(_0x429b25[_0x2281('0x5')]){_0x3affc5={};if(_0x3b0fc5[_0x2281('0x12')]==='AnalyticExtractedReport'){_0x3affc5[_0x429b25[_0x2281('0xa1')]]=_[_0x2281('0x9')](_0x25ae1b[_0x2281('0xb')],'id');}else{_0x3affc5[_0x429b25[_0x2281('0xa1')]]=_0x25ae1b['associatedResources'];}_0x280746[_0x2281('0x8d')](_0x3affc5);}else{_0x405c41['where']['id']=_0x25ae1b['associatedResources'];}}else{for(var _0x40a6c9=0x0;_0x40a6c9<_0x5bfd9a[_0x2281('0x91')];_0x40a6c9++){_0x429b25=_[_0x2281('0x92')](_0x2e8e9b,['name',_0x5bfd9a[_0x40a6c9][_0x2281('0xc')]]);if(_0x429b25[_0x2281('0x5')]){_0x3affc5={};_0x3affc5[_0x429b25[_0x2281('0xa1')]]=_0x5bfd9a[_0x40a6c9][_0x2281('0xb')];_0x280746[_0x2281('0x8d')](_0x3affc5);}else{if(!_0x405c41['where']['id'])_0x405c41[_0x2281('0x81')]['id']=[];_0x5bfd9a[_0x40a6c9]['associatedResources'][_0x2281('0xa2')](function(_0x5590c8){_0x405c41[_0x2281('0x81')]['id'][_0x2281('0x8d')](_0x5590c8);});}}}if(!_[_0x2281('0x8c')](_0x280746)){_0x405c41['where']=_['merge'](_0x405c41['where'],{'$and':{'$or':_0x280746}});}_0x405c41=_[_0x2281('0x9f')]({},_0x405c41,_0x3c89ab['options']);if(_0x25ae1b&&!_0x25ae1b['autoAssociation']&&_0x3b0fc5[_0x2281('0x12')]==='AnalyticExtractedReport'){if(_0x3c89ab[_0x2281('0x88')]['includeAll']){_0x405c41[_0x2281('0xa3')]=[{'all':!![]}];}return _0x6d8c05[_0x3b0fc5[_0x2281('0x12')]][_0x2281('0x7')](_0x405c41)[_0x2281('0x8')](function(_0x46d081){var _0x10012f=[];_0x46d081[_0x2281('0xa2')](function(_0x190b73){var _0x171d8d;switch(_0x190b73[_0x2281('0xa4')]){case'default':_0x171d8d=_[_0x2281('0x92')](_0x25ae1b[_0x2281('0xb')],function(_0x357982){return _0x357982['id']===_0x190b73[_0x2281('0x74')]&&_0x357982['type']===_0x2281('0xa5');});break;case _0x2281('0xa6'):_0x171d8d=_['find'](_0x25ae1b[_0x2281('0xb')],function(_0x3ff39b){return _0x3ff39b['id']===_0x190b73[_0x2281('0x74')]&&_0x3ff39b[_0x2281('0x39')]===_0x2281('0xa7');});break;}if(_0x171d8d)_0x10012f[_0x2281('0x8d')](_0x190b73);});_0x27a1c6[_0x2281('0xa8')]=_0x10012f['length'];_0x27a1c6[_0x2281('0xa9')]=_0x10012f;return _0x27a1c6;});}else{if(!_[_0x2281('0x8c')](_0x3c89ab[_0x2281('0x88')][_0x2281('0xaa')])){_0x405c41[_0x2281('0x81')]['id']=_0x405c41[_0x2281('0x81')]['id']?_[_0x2281('0x97')](_0x405c41[_0x2281('0x81')]['id'],_0x3c89ab['query'][_0x2281('0xaa')]):_0x3c89ab[_0x2281('0x88')][_0x2281('0xaa')];if(_0x3c89ab['query'][_0x2281('0xab')]){_0x405c41[_0x2281('0x9d')]=_0x3c89ab[_0x2281('0x88')][_0x2281('0xab')];}}if(_0x3c89ab[_0x2281('0x88')][_0x2281('0xac')]){_0x405c41[_0x2281('0x81')]=_['merge'](_0x405c41[_0x2281('0x81')],{'$and':_0x3c89ab['query'][_0x2281('0xac')]});}return _0x6d8c05[_0x3b0fc5[_0x2281('0x12')]][_0x2281('0xa8')]({'where':_0x405c41[_0x2281('0x81')]})[_0x2281('0x8')](function(_0x3e9a84){_0x27a1c6[_0x2281('0xa8')]=_0x3e9a84;if(_0x3c89ab[_0x2281('0x88')][_0x2281('0xad')]){if(_0x3b0fc5[_0x2281('0x12')]==='CmContact'){_0x405c41[_0x2281('0xa3')]=[{'model':_0x6d8c05[_0x2281('0x69')],'as':_0x2281('0xae'),'attributes':['id',_0x2281('0xc'),_0x2281('0xaf')],'required':_0x3c89ab[_0x2281('0x88')][_0x2281('0xb0')]?!![]:![]},{'model':_0x6d8c05['Tag'],'as':_0x2281('0xb1'),'attributes':['id',_0x2281('0xc'),'color'],'through':_0x3c89ab['query']['tag']?{'attributes':[],'where':{'TagId':_0x3c89ab[_0x2281('0x88')]['tag']||undefined}}:{},'required':_0x3c89ab[_0x2281('0x88')][_0x2281('0xb0')]?!![]:![]}];}else{_0x405c41[_0x2281('0xa3')]=[{'all':!![]}];}}return _0x6d8c05[_0x3b0fc5[_0x2281('0x12')]]['findAll'](_0x405c41);})[_0x2281('0x8')](function(_0x502dc2){_0x27a1c6[_0x2281('0xa9')]=_0x502dc2;if(_0x400c5c===_0x2281('0x31')&&_0x3c89ab[_0x2281('0x88')][_0x2281('0xb2')]===_0x2281('0xb3')){var _0x5ca583=[];for(var _0x2df5d2=0x0;_0x2df5d2<_0x27a1c6[_0x2281('0xa9')][_0x2281('0x91')];_0x2df5d2++){_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xb4'),_0x27a1c6[_0x2281('0xa9')][_0x2df5d2][_0x2281('0xb5')]));_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xb6'),_0x27a1c6[_0x2281('0xa9')][_0x2df5d2]['dataValues']));_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xb7'),_0x27a1c6[_0x2281('0xa9')][_0x2df5d2][_0x2281('0xb5')]));_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xb8'),_0x27a1c6[_0x2281('0xa9')][_0x2df5d2][_0x2281('0xb5')]));_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xb9'),_0x27a1c6['rows'][_0x2df5d2][_0x2281('0xb5')]));_0x5ca583[_0x2281('0x8d')](_0x4203cd(_0x2281('0xba'),_0x27a1c6['rows'][_0x2df5d2][_0x2281('0xb5')]));}return Promise[_0x2281('0x8f')](_0x5ca583)[_0x2281('0x8')](function(){return _0x27a1c6;});}return _0x27a1c6;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 677bb87..0269362 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 _0x176c=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0xc9cbe4,_0x33416e){var _0x3ade3e=function(_0x269378){while(--_0x269378){_0xc9cbe4['push'](_0xc9cbe4['shift']());}};_0x3ade3e(++_0x33416e);}(_0x176c,0x134));var _0xc176=function(_0x51bc7f,_0x4410b7){_0x51bc7f=_0x51bc7f-0x0;var _0x38e034=_0x176c[_0x51bc7f];return _0x38e034;};'use strict';var _=require(_0xc176('0x0'));var util=require(_0xc176('0x1'));var moment=require(_0xc176('0x2'));var BPromise=require(_0xc176('0x3'));var rs=require(_0xc176('0x4'));var fs=require('fs');var Redis=require(_0xc176('0x5'));var db=require(_0xc176('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc176('0x7'))(_0xc176('0x8'));var config=require('../../config/environment');var jayson=require(_0xc176('0x9'));var client=jayson[_0xc176('0xa')][_0xc176('0xb')]({'port':0x232a});config['redis']=_[_0xc176('0xc')](config[_0xc176('0xd')],{'host':_0xc176('0xe'),'port':0x18eb});var socket=require(_0xc176('0xf'))(new Redis(config[_0xc176('0xd')]));require('./userProfile.socket')[_0xc176('0x10')](socket);function respondWithRpcPromise(_0x1486c9,_0x2f95eb,_0x48186c){return new BPromise(function(_0x3e7997,_0x208607){return client[_0xc176('0x11')](_0x1486c9,_0x48186c)[_0xc176('0x12')](function(_0x420bf8){logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));logger['debug'](_0xc176('0x16'),_0x2f95eb,_0xc176('0x15'),JSON[_0xc176('0x17')](_0x420bf8));if(_0x420bf8[_0xc176('0x18')]){if(_0x420bf8[_0xc176('0x18')]['code']===0x1f4){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8[_0xc176('0x18')]['message']);return _0x208607(_0x420bf8[_0xc176('0x18')]['message']);}logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x420bf8['error'][_0xc176('0x19')]);return _0x3e7997(_0x420bf8[_0xc176('0x18')][_0xc176('0x19')]);}else{logger[_0xc176('0x13')](_0xc176('0x14'),_0x2f95eb,_0xc176('0x15'));_0x3e7997(_0x420bf8['result'][_0xc176('0x19')]);}})['catch'](function(_0x20228b){logger[_0xc176('0x18')](_0xc176('0x14'),_0x2f95eb,_0x20228b);_0x208607(_0x20228b);});});} \ No newline at end of file +var _0x5324=['UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x310eb9,_0x1aed15){var _0x28915c=function(_0x457fd6){while(--_0x457fd6){_0x310eb9['push'](_0x310eb9['shift']());}};_0x28915c(++_0x1aed15);}(_0x5324,0x154));var _0x4532=function(_0xeae11a,_0x94e239){_0xeae11a=_0xeae11a-0x0;var _0x45c252=_0x5324[_0xeae11a];return _0x45c252;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var moment=require(_0x4532('0x2'));var BPromise=require(_0x4532('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4532('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4532('0x5'));var logger=require(_0x4532('0x6'))(_0x4532('0x7'));var config=require(_0x4532('0x8'));var jayson=require(_0x4532('0x9'));var client=jayson[_0x4532('0xa')][_0x4532('0xb')]({'port':0x232a});config[_0x4532('0xc')]=_['defaults'](config[_0x4532('0xc')],{'host':_0x4532('0xd'),'port':0x18eb});var socket=require(_0x4532('0xe'))(new Redis(config[_0x4532('0xc')]));require(_0x4532('0xf'))[_0x4532('0x10')](socket);function respondWithRpcPromise(_0x342da6,_0x2f1b8c,_0x23ad90){return new BPromise(function(_0x3f9647,_0x314e97){return client[_0x4532('0x11')](_0x342da6,_0x23ad90)['then'](function(_0x511ac6){logger[_0x4532('0x12')]('UserProfile,\x20%s,\x20%s',_0x2f1b8c,_0x4532('0x13'));logger[_0x4532('0x14')](_0x4532('0x15'),_0x2f1b8c,_0x4532('0x13'),JSON['stringify'](_0x511ac6));if(_0x511ac6[_0x4532('0x16')]){if(_0x511ac6[_0x4532('0x16')][_0x4532('0x17')]===0x1f4){logger[_0x4532('0x16')](_0x4532('0x18'),_0x2f1b8c,_0x511ac6['error']['message']);return _0x314e97(_0x511ac6['error'][_0x4532('0x19')]);}logger[_0x4532('0x16')](_0x4532('0x18'),_0x2f1b8c,_0x511ac6[_0x4532('0x16')][_0x4532('0x19')]);return _0x3f9647(_0x511ac6[_0x4532('0x16')][_0x4532('0x19')]);}else{logger[_0x4532('0x12')](_0x4532('0x18'),_0x2f1b8c,'request\x20sent');_0x3f9647(_0x511ac6[_0x4532('0x1a')][_0x4532('0x19')]);}})[_0x4532('0x1b')](function(_0x530ce0){logger[_0x4532('0x16')](_0x4532('0x18'),_0x2f1b8c,_0x530ce0);_0x314e97(_0x530ce0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e937e1a..46d9bd0 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 _0x91a6=['remove','update','removeListener','register','userProfile:','./userProfile.events'];(function(_0xf5bbc2,_0x49e6c5){var _0x3d9a7b=function(_0x2c5e32){while(--_0x2c5e32){_0xf5bbc2['push'](_0xf5bbc2['shift']());}};_0x3d9a7b(++_0x49e6c5);}(_0x91a6,0x137));var _0x691a=function(_0x442023,_0x3230a0){_0x442023=_0x442023-0x0;var _0x2ed554=_0x91a6[_0x442023];return _0x2ed554;};'use strict';var UserProfileEvents=require(_0x691a('0x0'));var events=['save',_0x691a('0x1'),_0x691a('0x2')];function createListener(_0x2a924d,_0x586ebb){return function(_0x3f51a8){_0x586ebb['emit'](_0x2a924d,_0x3f51a8);};}function removeListener(_0x576bfe,_0x54f666){return function(){UserProfileEvents[_0x691a('0x3')](_0x576bfe,_0x54f666);};}exports[_0x691a('0x4')]=function(_0x18b039){for(var _0x58e8b9=0x0,_0x1535e2=events['length'];_0x58e8b9<_0x1535e2;_0x58e8b9++){var _0x3fc4e6=events[_0x58e8b9];var _0x46fec1=createListener(_0x691a('0x5')+_0x3fc4e6,_0x18b039);UserProfileEvents['on'](_0x3fc4e6,_0x46fec1);}}; \ No newline at end of file +var _0x134a=['length','userProfile:','remove','emit','removeListener'];(function(_0x58db4e,_0x439d8d){var _0x40139a=function(_0x34cae4){while(--_0x34cae4){_0x58db4e['push'](_0x58db4e['shift']());}};_0x40139a(++_0x439d8d);}(_0x134a,0x16f));var _0xa134=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x134a[_0x20a584];return _0x4b41a8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xa134('0x0'),'update'];function createListener(_0x1f2899,_0x3b96e4){return function(_0x5374da){_0x3b96e4[_0xa134('0x1')](_0x1f2899,_0x5374da);};}function removeListener(_0x358d0e,_0x2e3108){return function(){UserProfileEvents[_0xa134('0x2')](_0x358d0e,_0x2e3108);};}exports['register']=function(_0x49ea7f){for(var _0x233c94=0x0,_0x44a006=events[_0xa134('0x3')];_0x233c94<_0x44a006;_0x233c94++){var _0x18af0f=events[_0x233c94];var _0x3ebd14=createListener(_0xa134('0x4')+_0x18af0f,_0x49ea7f);UserProfileEvents['on'](_0x18af0f,_0x3ebd14);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index dfc163e..9a73602 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 _0x93b5=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router'];(function(_0x43cb87,_0x432cb3){var _0x9258ac=function(_0xe4f10c){while(--_0xe4f10c){_0x43cb87['push'](_0x43cb87['shift']());}};_0x9258ac(++_0x432cb3);}(_0x93b5,0x178));var _0x593b=function(_0x28d94c,_0xf00efc){_0x28d94c=_0x28d94c-0x0;var _0x28a247=_0x93b5[_0x28d94c];return _0x28a247;};'use strict';var multer=require(_0x593b('0x0'));var util=require(_0x593b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x593b('0x2'));var router=express[_0x593b('0x3')]();var fs_extra=require(_0x593b('0x4'));var auth=require(_0x593b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x593b('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x593b('0x7')](),controller[_0x593b('0x8')]);router[_0x593b('0x9')](_0x593b('0xa'),auth[_0x593b('0x7')](),controller['describe']);router['get'](_0x593b('0xb'),auth['isAuthenticated'](),controller[_0x593b('0xc')]);router[_0x593b('0xd')]('/',auth[_0x593b('0x7')](),controller[_0x593b('0xe')]);router[_0x593b('0xf')]('/:id',auth[_0x593b('0x7')](),controller['update']);router[_0x593b('0x10')](_0x593b('0xb'),auth['isAuthenticated'](),controller[_0x593b('0x11')]);module[_0x593b('0x12')]=router; \ No newline at end of file +var _0xcb70=['./userProfileResource.controller','get','isAuthenticated','index','describe','post','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0xcb70,0x187));var _0x0cb7=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcb70[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0x0cb7('0x0'));var util=require('util');var path=require(_0x0cb7('0x1'));var timeout=require(_0x0cb7('0x2'));var express=require(_0x0cb7('0x3'));var router=express[_0x0cb7('0x4')]();var fs_extra=require(_0x0cb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0cb7('0x6'));var config=require(_0x0cb7('0x7'));var controller=require(_0x0cb7('0x8'));router[_0x0cb7('0x9')]('/',auth[_0x0cb7('0xa')](),controller[_0x0cb7('0xb')]);router[_0x0cb7('0x9')]('/describe',auth[_0x0cb7('0xa')](),controller[_0x0cb7('0xc')]);router['get']('/:id',auth[_0x0cb7('0xa')](),controller['show']);router[_0x0cb7('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0cb7('0xe')](_0x0cb7('0xf'),auth[_0x0cb7('0xa')](),controller[_0x0cb7('0x10')]);router['delete'](_0x0cb7('0xf'),auth['isAuthenticated'](),controller[_0x0cb7('0x11')]);module[_0x0cb7('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7c3c910..0891b4d 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 _0x4da2=['sequelize','exports','STRING','INTEGER'];(function(_0x3cd9e4,_0x5d8877){var _0x577565=function(_0x214155){while(--_0x214155){_0x3cd9e4['push'](_0x3cd9e4['shift']());}};_0x577565(++_0x5d8877);}(_0x4da2,0x110));var _0x24da=function(_0x1304a2,_0x55068a){_0x1304a2=_0x1304a2-0x0;var _0x1ec731=_0x4da2[_0x1304a2];return _0x1ec731;};'use strict';var Sequelize=require(_0x24da('0x0'));module[_0x24da('0x1')]={'name':{'type':Sequelize[_0x24da('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x24da('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x24da('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6210=['sequelize','exports','STRING'];(function(_0x59ca95,_0xae88f5){var _0xb71b80=function(_0x5d018b){while(--_0x5d018b){_0x59ca95['push'](_0x59ca95['shift']());}};_0xb71b80(++_0xae88f5);}(_0x6210,0x1d4));var _0x0621=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x6210[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require(_0x0621('0x0'));module[_0x0621('0x1')]={'name':{'type':Sequelize[_0x0621('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x0621('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 9f20435..89d0210 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 _0x7096=['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','UserProfileResource','find','catch','create','body','describe','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','offset','undefined','count','set'];(function(_0x8abfd8,_0x3d1f70){var _0x290976=function(_0x5e34c4){while(--_0x5e34c4){_0x8abfd8['push'](_0x8abfd8['shift']());}};_0x290976(++_0x3d1f70);}(_0x7096,0x10c));var _0x6709=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7096[_0x134c2e];return _0x2825db;};'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['UserProfileResource'][_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['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['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['UserProfileResource'][_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['UserProfileResource']['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['UserProfileResource'][_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));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file +var _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','UserProfileResource','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x39a177,_0x4b56f6){var _0x48e98d=function(_0x44b61a){while(--_0x44b61a){_0x39a177['push'](_0x39a177['shift']());}};_0x48e98d(++_0x4b56f6);}(_0xd943,0x15d));var _0x3d94=function(_0x26dc7f,_0x35547c){_0x26dc7f=_0x26dc7f-0x0;var _0x1c3d28=_0xd943[_0x26dc7f];return _0x1c3d28;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['UserProfileResource']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 74a033a..9cc4691 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 _0xa18c=['user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','moment','bluebird','request-promise','rimraf','./userProfileResource.attributes'];(function(_0x4f64b9,_0x4d0e57){var _0x1cf549=function(_0x45c1ea){while(--_0x45c1ea){_0x4f64b9['push'](_0x4f64b9['shift']());}};_0x1cf549(++_0x4d0e57);}(_0xa18c,0x1f3));var _0xca18=function(_0x4d3a31,_0x18c868){_0x4d3a31=_0x4d3a31-0x0;var _0x665019=_0xa18c[_0x4d3a31];return _0x665019;};'use strict';var _=require('lodash');var util=require(_0xca18('0x0'));var logger=require(_0xca18('0x1'))('api');var moment=require(_0xca18('0x2'));var BPromise=require(_0xca18('0x3'));var rp=require(_0xca18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca18('0x5'));var config=require('../../config/environment');var attributes=require(_0xca18('0x6'));module['exports']=function(_0x316f66,_0x2ab201){return _0x316f66['define']('UserProfileResource',attributes,{'tableName':_0xca18('0x7'),'paranoid':![],'indexes':[{'name':_0xca18('0x8'),'fields':[_0xca18('0x9'),_0xca18('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff8a=['lodash','../../config/logger','api','moment','request-promise','exports','define','user_profile_has_resources','compositeIndex','sectionId'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xff8a,0x172));var _0xaff8=function(_0x59146d,_0x10b58e){_0x59146d=_0x59146d-0x0;var _0x592260=_0xff8a[_0x59146d];return _0x592260;};'use strict';var _=require(_0xaff8('0x0'));var util=require('util');var logger=require(_0xaff8('0x1'))(_0xaff8('0x2'));var moment=require(_0xaff8('0x3'));var BPromise=require('bluebird');var rp=require(_0xaff8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xaff8('0x5')]=function(_0x43d551,_0x130efb){return _0x43d551[_0xaff8('0x6')]('UserProfileResource',attributes,{'tableName':_0xaff8('0x7'),'paranoid':![],'indexes':[{'name':_0xaff8('0x8'),'fields':['resourceId',_0xaff8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8f7cbe1..e3a1baa 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 _0x0335=['request\x20sent','stringify','error','code','message','catch','lodash','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x4515dd,_0x436dad){var _0x3d49b5=function(_0x19fe92){while(--_0x19fe92){_0x4515dd['push'](_0x4515dd['shift']());}};_0x3d49b5(++_0x436dad);}(_0x0335,0x1c8));var _0x5033=function(_0x52193c,_0x16ab99){_0x52193c=_0x52193c-0x0;var _0x293ef1=_0x0335[_0x52193c];return _0x293ef1;};'use strict';var _=require(_0x5033('0x0'));var util=require('util');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(_0x5033('0x1'));var logger=require('../../config/logger')(_0x5033('0x2'));var config=require(_0x5033('0x3'));var jayson=require(_0x5033('0x4'));var client=jayson[_0x5033('0x5')][_0x5033('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d09ac,_0x4e8e3c,_0x521409){return new BPromise(function(_0x595bcd,_0x4654fb){return client[_0x5033('0x7')](_0x5d09ac,_0x521409)['then'](function(_0x9cffa5){logger[_0x5033('0x8')](_0x5033('0x9'),_0x4e8e3c,'request\x20sent');logger[_0x5033('0xa')](_0x5033('0xb'),_0x4e8e3c,_0x5033('0xc'),JSON[_0x5033('0xd')](_0x9cffa5));if(_0x9cffa5['error']){if(_0x9cffa5[_0x5033('0xe')][_0x5033('0xf')]===0x1f4){logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);return _0x4654fb(_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);}logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);return _0x595bcd(_0x9cffa5[_0x5033('0xe')][_0x5033('0x10')]);}else{logger['info']('UserProfileResource,\x20%s,\x20%s',_0x4e8e3c,_0x5033('0xc'));_0x595bcd(_0x9cffa5['result'][_0x5033('0x10')]);}})[_0x5033('0x11')](function(_0xa75f58){logger[_0x5033('0xe')](_0x5033('0x9'),_0x4e8e3c,_0xa75f58);_0x4654fb(_0xa75f58);});});} \ No newline at end of file +var _0x686b=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x4a7fe7,_0x5b3daf){var _0x2aabb7=function(_0x35ce2b){while(--_0x35ce2b){_0x4a7fe7['push'](_0x4a7fe7['shift']());}};_0x2aabb7(++_0x5b3daf);}(_0x686b,0xc8));var _0xb686=function(_0x118b91,_0xd7ab5){_0x118b91=_0x118b91-0x0;var _0x4e8498=_0x686b[_0x118b91];return _0x4e8498;};'use strict';var _=require(_0xb686('0x0'));var util=require(_0xb686('0x1'));var moment=require(_0xb686('0x2'));var BPromise=require('bluebird');var rs=require(_0xb686('0x3'));var fs=require('fs');var Redis=require(_0xb686('0x4'));var db=require(_0xb686('0x5'))['db'];var utils=require(_0xb686('0x6'));var logger=require('../../config/logger')(_0xb686('0x7'));var config=require(_0xb686('0x8'));var jayson=require(_0xb686('0x9'));var client=jayson[_0xb686('0xa')][_0xb686('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22ec29,_0x58cc0e,_0x154e0e){return new BPromise(function(_0x29529c,_0x3c13c5){return client[_0xb686('0xc')](_0x22ec29,_0x154e0e)['then'](function(_0x3f4070){logger[_0xb686('0xd')](_0xb686('0xe'),_0x58cc0e,_0xb686('0xf'));logger[_0xb686('0x10')](_0xb686('0x11'),_0x58cc0e,_0xb686('0xf'),JSON[_0xb686('0x12')](_0x3f4070));if(_0x3f4070[_0xb686('0x13')]){if(_0x3f4070[_0xb686('0x13')][_0xb686('0x14')]===0x1f4){logger[_0xb686('0x13')](_0xb686('0xe'),_0x58cc0e,_0x3f4070[_0xb686('0x13')]['message']);return _0x3c13c5(_0x3f4070[_0xb686('0x13')]['message']);}logger[_0xb686('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x58cc0e,_0x3f4070[_0xb686('0x13')]['message']);return _0x29529c(_0x3f4070[_0xb686('0x13')][_0xb686('0x15')]);}else{logger[_0xb686('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x58cc0e,_0xb686('0xf'));_0x29529c(_0x3f4070[_0xb686('0x16')][_0xb686('0x15')]);}})[_0xb686('0x17')](function(_0x3d6763){logger[_0xb686('0x13')](_0xb686('0xe'),_0x58cc0e,_0x3d6763);_0x3c13c5(_0x3d6763);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 50e342c..9618b51 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 _0x55c5=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','isAuthenticated','get','/describe','describe','/:id','update','delete','destroy'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x55c5,0xc3));var _0x555c=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x55c5[_0x2deac4];return _0x1c0bda;};'use strict';var multer=require(_0x555c('0x0'));var util=require(_0x555c('0x1'));var path=require('path');var timeout=require(_0x555c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x555c('0x3'));var auth=require(_0x555c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x555c('0x5'));var controller=require(_0x555c('0x6'));router['get']('/',auth[_0x555c('0x7')](),controller['index']);router[_0x555c('0x8')](_0x555c('0x9'),auth[_0x555c('0x7')](),controller[_0x555c('0xa')]);router['get'](_0x555c('0xb'),auth[_0x555c('0x7')](),controller['show']);router['post']('/',auth[_0x555c('0x7')](),controller['create']);router['put']('/:id',auth[_0x555c('0x7')](),controller[_0x555c('0xc')]);router[_0x555c('0xd')](_0x555c('0xb'),auth[_0x555c('0x7')](),controller[_0x555c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xb523=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x45b100,_0x29a4b1){var _0x1b41f8=function(_0x5a48b4){while(--_0x5a48b4){_0x45b100['push'](_0x45b100['shift']());}};_0x1b41f8(++_0x29a4b1);}(_0xb523,0x186));var _0x3b52=function(_0xe96fc4,_0x4e04d5){_0xe96fc4=_0xe96fc4-0x0;var _0x5b65c5=_0xb523[_0xe96fc4];return _0x5b65c5;};'use strict';var multer=require('multer');var util=require(_0x3b52('0x0'));var path=require(_0x3b52('0x1'));var timeout=require(_0x3b52('0x2'));var express=require(_0x3b52('0x3'));var router=express[_0x3b52('0x4')]();var fs_extra=require(_0x3b52('0x5'));var auth=require(_0x3b52('0x6'));var interaction=require(_0x3b52('0x7'));var config=require(_0x3b52('0x8'));var controller=require(_0x3b52('0x9'));router[_0x3b52('0xa')]('/',auth[_0x3b52('0xb')](),controller['index']);router[_0x3b52('0xa')](_0x3b52('0xc'),auth[_0x3b52('0xb')](),controller[_0x3b52('0xd')]);router[_0x3b52('0xa')](_0x3b52('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x3b52('0xf')]('/',auth[_0x3b52('0xb')](),controller[_0x3b52('0x10')]);router[_0x3b52('0x11')](_0x3b52('0xe'),auth[_0x3b52('0xb')](),controller[_0x3b52('0x12')]);router[_0x3b52('0x13')](_0x3b52('0xe'),auth['isAuthenticated'](),controller[_0x3b52('0x14')]);module[_0x3b52('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5753ac8..7f405fa 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 _0x4e81=['join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x4e81,0x1bc));var _0x14e8=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x4e81[_0x4d35f3];return _0x382fea;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'name':{'type':Sequelize[_0x14e8('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x14e8('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x14e8('0x2')],'set':function(_0x224121){this[_0x14e8('0x4')](_0x14e8('0x5'),_0x224121?_0x224121[_0x14e8('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x14e8('0x7')](_0x14e8('0x5'))[_0x14e8('0x8')](''):[];}}}; \ No newline at end of file +var _0xeb3b=['sequelize','exports','STRING','INTEGER','setDataValue','join','getDataValue','crudPermissions','split'];(function(_0x2a537d,_0x3f7c58){var _0xf3db87=function(_0x4e3a9e){while(--_0x4e3a9e){_0x2a537d['push'](_0x2a537d['shift']());}};_0xf3db87(++_0x3f7c58);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xeb3b[_0x4551f6];return _0x581dc2;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbeb3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbeb3('0x2')],'set':function(_0x5b0e3b){this[_0xbeb3('0x4')]('crudPermissions',_0x5b0e3b?_0x5b0e3b[_0xbeb3('0x5')](''):[]);},'get':function(){return this[_0xbeb3('0x6')](_0xbeb3('0x7'))?this[_0xbeb3('0x6')](_0xbeb3('0x7'))[_0xbeb3('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1ad304f..3d2e0fe 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 _0xecc8=['create','body','catch','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','show','params','find'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xecc8,0x1d3));var _0x8ecc=function(_0x3bdd9d,_0x3094eb){_0x3bdd9d=_0x3bdd9d-0x0;var _0x4ce3ae=_0xecc8[_0x3bdd9d];return _0x4ce3ae;};'use strict';var emlformat=require(_0x8ecc('0x0'));var rimraf=require(_0x8ecc('0x1'));var zipdir=require(_0x8ecc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ecc('0x3'));var moment=require(_0x8ecc('0x4'));var BPromise=require(_0x8ecc('0x5'));var Mustache=require('mustache');var util=require(_0x8ecc('0x6'));var path=require(_0x8ecc('0x7'));var sox=require(_0x8ecc('0x8'));var csv=require('to-csv');var ejs=require(_0x8ecc('0x9'));var fs=require('fs');var fs_extra=require(_0x8ecc('0xa'));var _=require(_0x8ecc('0xb'));var squel=require('squel');var crypto=require(_0x8ecc('0xc'));var jsforce=require(_0x8ecc('0xd'));var deskjs=require(_0x8ecc('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ecc('0xf'));var Redis=require(_0x8ecc('0x10'));var authService=require(_0x8ecc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ecc('0x12'));var hardwareService=require(_0x8ecc('0x13'));var logger=require(_0x8ecc('0x14'))(_0x8ecc('0x15'));var utils=require(_0x8ecc('0x16'));var config=require(_0x8ecc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ecc('0x18'))['db'];function respondWithStatusCode(_0x558f62,_0x49cee9){_0x49cee9=_0x49cee9||0xcc;return function(_0x238615){if(_0x238615){return _0x558f62[_0x8ecc('0x19')](_0x49cee9);}return _0x558f62[_0x8ecc('0x1a')](_0x49cee9)[_0x8ecc('0x1b')]();};}function respondWithResult(_0x547bf1,_0xafb41f){_0xafb41f=_0xafb41f||0xc8;return function(_0x4f700e){if(_0x4f700e){return _0x547bf1[_0x8ecc('0x1a')](_0xafb41f)[_0x8ecc('0x1c')](_0x4f700e);}};}function respondWithFilteredResult(_0x7a02af,_0x38fbb2){return function(_0x587024){if(_0x587024){var _0x130f55=typeof _0x38fbb2[_0x8ecc('0x1d')]===_0x8ecc('0x1e')&&typeof _0x38fbb2[_0x8ecc('0x1f')]===_0x8ecc('0x1e');var _0x44875b=_0x587024[_0x8ecc('0x20')];var _0x3eed85=_0x130f55?0x0:_0x38fbb2['offset'];var _0x540a79=_0x130f55?_0x587024[_0x8ecc('0x20')]:_0x38fbb2[_0x8ecc('0x1d')]+_0x38fbb2[_0x8ecc('0x1f')];var _0x16021f;if(_0x540a79>=_0x44875b){_0x540a79=_0x44875b;_0x16021f=0xc8;}else{_0x16021f=0xce;}_0x7a02af[_0x8ecc('0x1a')](_0x16021f);return _0x7a02af[_0x8ecc('0x21')](_0x8ecc('0x22'),_0x3eed85+'-'+_0x540a79+'/'+_0x44875b)[_0x8ecc('0x1c')](_0x587024);}return null;};}function patchUpdates(_0x114fd1){return function(_0x20f549){try{jsonpatch[_0x8ecc('0x23')](_0x20f549,_0x114fd1,!![]);}catch(_0x56af60){return BPromise[_0x8ecc('0x24')](_0x56af60);}return _0x20f549[_0x8ecc('0x25')]();};}function saveUpdates(_0xc54df1,_0x2ebdec){return function(_0x48d954){if(_0x48d954){return _0x48d954['update'](_0xc54df1)[_0x8ecc('0x26')](function(_0xaddd9d){return _0xaddd9d;});}return null;};}function removeEntity(_0x235646,_0x3a740f){return function(_0x4b566b){if(_0x4b566b){return _0x4b566b[_0x8ecc('0x27')]()[_0x8ecc('0x26')](function(){_0x235646['status'](0xcc)[_0x8ecc('0x1b')]();});}};}function handleEntityNotFound(_0x1f3a6f,_0x118ce6){return function(_0xec08a0){if(!_0xec08a0){_0x1f3a6f['sendStatus'](0x194);}return _0xec08a0;};}function handleError(_0x2d3625,_0x1d3bcc){_0x1d3bcc=_0x1d3bcc||0x1f4;return function(_0x2fe380){logger['error'](_0x2fe380[_0x8ecc('0x28')]);if(_0x2fe380[_0x8ecc('0x29')]){delete _0x2fe380['name'];}_0x2d3625[_0x8ecc('0x1a')](_0x1d3bcc)[_0x8ecc('0x2a')](_0x2fe380);};}exports[_0x8ecc('0x2b')]=function(_0x497918,_0x11000e){var _0x36a128={},_0x3503e8={},_0x498bfe={'count':0x0,'rows':[]};var _0x345e95=_[_0x8ecc('0x2c')](db['UserProfileSection'][_0x8ecc('0x2d')],function(_0x2a0048){return{'name':_0x2a0048[_0x8ecc('0x2e')],'type':_0x2a0048['type'][_0x8ecc('0x2f')]};});_0x3503e8['model']=_[_0x8ecc('0x2c')](_0x345e95,_0x8ecc('0x29'));_0x3503e8[_0x8ecc('0x30')]=_[_0x8ecc('0x31')](_0x497918['query']);_0x3503e8['filters']=_[_0x8ecc('0x32')](_0x3503e8[_0x8ecc('0x33')],_0x3503e8['query']);_0x36a128[_0x8ecc('0x34')]=_[_0x8ecc('0x32')](_0x3503e8[_0x8ecc('0x33')],qs[_0x8ecc('0x35')](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x35')]));_0x36a128[_0x8ecc('0x34')]=_0x36a128['attributes'][_0x8ecc('0x36')]?_0x36a128[_0x8ecc('0x34')]:_0x3503e8[_0x8ecc('0x33')];if(!_0x497918[_0x8ecc('0x30')]['hasOwnProperty'](_0x8ecc('0x37'))){_0x36a128[_0x8ecc('0x1f')]=qs['limit'](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x1f')]);_0x36a128[_0x8ecc('0x1d')]=qs[_0x8ecc('0x1d')](_0x497918[_0x8ecc('0x30')][_0x8ecc('0x1d')]);}_0x36a128['order']=qs[_0x8ecc('0x38')](_0x497918[_0x8ecc('0x30')]['sort']);_0x36a128[_0x8ecc('0x39')]=qs[_0x8ecc('0x3a')](_[_0x8ecc('0x3b')](_0x497918[_0x8ecc('0x30')],_0x3503e8[_0x8ecc('0x3a')]),_0x345e95);if(_0x497918[_0x8ecc('0x30')][_0x8ecc('0x3c')]){_0x36a128['where']=_[_0x8ecc('0x3d')](_0x36a128[_0x8ecc('0x39')],{'$or':_[_0x8ecc('0x2c')](_0x345e95,function(_0x4ae9b9){if(_0x4ae9b9['type']!==_0x8ecc('0x3e')){var _0x5bcfa3={};_0x5bcfa3[_0x4ae9b9[_0x8ecc('0x29')]]={'$like':'%'+_0x497918[_0x8ecc('0x30')][_0x8ecc('0x3c')]+'%'};return _0x5bcfa3;}})});}_0x36a128=_[_0x8ecc('0x3d')]({},_0x36a128,_0x497918[_0x8ecc('0x3f')]);var _0xa39ae6={'where':_0x36a128[_0x8ecc('0x39')]};return db[_0x8ecc('0x40')][_0x8ecc('0x20')](_0xa39ae6)[_0x8ecc('0x26')](function(_0x2d4cc0){_0x498bfe[_0x8ecc('0x20')]=_0x2d4cc0;if(_0x497918['query'][_0x8ecc('0x41')]){_0x36a128[_0x8ecc('0x42')]=[{'all':!![]}];}return db[_0x8ecc('0x40')][_0x8ecc('0x43')](_0x36a128);})['then'](function(_0x3d69ee){_0x498bfe[_0x8ecc('0x44')]=_0x3d69ee;return _0x498bfe;})[_0x8ecc('0x26')](respondWithFilteredResult(_0x11000e,_0x36a128))['catch'](handleError(_0x11000e,null));};exports[_0x8ecc('0x45')]=function(_0x5310af,_0x37f40f){var _0x467539={'raw':![],'where':{'id':_0x5310af[_0x8ecc('0x46')]['id']}},_0x468712={};_0x468712['model']=_[_0x8ecc('0x31')](db[_0x8ecc('0x40')][_0x8ecc('0x2d')]);_0x468712[_0x8ecc('0x30')]=_[_0x8ecc('0x31')](_0x5310af['query']);_0x468712[_0x8ecc('0x3a')]=_[_0x8ecc('0x32')](_0x468712[_0x8ecc('0x33')],_0x468712[_0x8ecc('0x30')]);_0x467539['attributes']=_[_0x8ecc('0x32')](_0x468712[_0x8ecc('0x33')],qs['fields'](_0x5310af['query'][_0x8ecc('0x35')]));_0x467539[_0x8ecc('0x34')]=_0x467539[_0x8ecc('0x34')][_0x8ecc('0x36')]?_0x467539[_0x8ecc('0x34')]:_0x468712['model'];if(_0x5310af[_0x8ecc('0x30')][_0x8ecc('0x41')]){_0x467539['include']=[{'all':!![]}];}_0x467539=_[_0x8ecc('0x3d')]({},_0x467539,_0x5310af[_0x8ecc('0x3f')]);return db['UserProfileSection'][_0x8ecc('0x47')](_0x467539)[_0x8ecc('0x26')](handleEntityNotFound(_0x37f40f,null))[_0x8ecc('0x26')](respondWithResult(_0x37f40f,null))['catch'](handleError(_0x37f40f,null));};exports[_0x8ecc('0x48')]=function(_0x3fd113,_0x49a910){return db['UserProfileSection']['create'](_0x3fd113[_0x8ecc('0x49')],{})[_0x8ecc('0x26')](respondWithResult(_0x49a910,0xc9))[_0x8ecc('0x4a')](handleError(_0x49a910,null));};exports[_0x8ecc('0x4b')]=function(_0x5393f1,_0x4eadd1){if(_0x5393f1[_0x8ecc('0x49')]['id']){delete _0x5393f1['body']['id'];}return db[_0x8ecc('0x40')][_0x8ecc('0x47')]({'where':{'id':_0x5393f1[_0x8ecc('0x46')]['id']}})[_0x8ecc('0x26')](handleEntityNotFound(_0x4eadd1,null))[_0x8ecc('0x26')](saveUpdates(_0x5393f1['body'],null))[_0x8ecc('0x26')](respondWithResult(_0x4eadd1,null))[_0x8ecc('0x4a')](handleError(_0x4eadd1,null));};exports[_0x8ecc('0x27')]=function(_0x732917,_0x4cc83d){return db[_0x8ecc('0x40')][_0x8ecc('0x47')]({'where':{'id':_0x732917['params']['id']}})['then'](handleEntityNotFound(_0x4cc83d,null))['then'](removeEntity(_0x4cc83d,null))['catch'](handleError(_0x4cc83d,null));};exports[_0x8ecc('0x4c')]=function(_0x838bf2,_0x6db289){return db[_0x8ecc('0x40')][_0x8ecc('0x4c')]()[_0x8ecc('0x26')](respondWithResult(_0x6db289,null))[_0x8ecc('0x4a')](handleError(_0x6db289,null));}; \ No newline at end of file +var _0xda71=['fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','show','keys','find','catch','create','body','params','describe','eml-format','zip-dir'];(function(_0x2e17f0,_0xacc452){var _0x16b4e7=function(_0x4ca85a){while(--_0x4ca85a){_0x2e17f0['push'](_0x2e17f0['shift']());}};_0x16b4e7(++_0xacc452);}(_0xda71,0x16b));var _0x1da7=function(_0x545496,_0x175f48){_0x545496=_0x545496-0x0;var _0x20a7f5=_0xda71[_0x545496];return _0x20a7f5;};'use strict';var emlformat=require(_0x1da7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1da7('0x1'));var jsonpatch=require(_0x1da7('0x2'));var rp=require(_0x1da7('0x3'));var moment=require('moment');var BPromise=require(_0x1da7('0x4'));var Mustache=require('mustache');var util=require(_0x1da7('0x5'));var path=require(_0x1da7('0x6'));var sox=require(_0x1da7('0x7'));var csv=require(_0x1da7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1da7('0x9'));var crypto=require(_0x1da7('0xa'));var jsforce=require(_0x1da7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1da7('0x8'));var querystring=require(_0x1da7('0xc'));var Papa=require('papaparse');var Redis=require(_0x1da7('0xd'));var authService=require(_0x1da7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1da7('0xf'));var hardwareService=require(_0x1da7('0x10'));var logger=require(_0x1da7('0x11'))(_0x1da7('0x12'));var utils=require('../../config/utils');var config=require(_0x1da7('0x13'));var licenseUtil=require(_0x1da7('0x14'));var db=require(_0x1da7('0x15'))['db'];function respondWithStatusCode(_0x15278d,_0x31e5ad){_0x31e5ad=_0x31e5ad||0xcc;return function(_0x25828d){if(_0x25828d){return _0x15278d[_0x1da7('0x16')](_0x31e5ad);}return _0x15278d[_0x1da7('0x17')](_0x31e5ad)[_0x1da7('0x18')]();};}function respondWithResult(_0x596b81,_0x529ea1){_0x529ea1=_0x529ea1||0xc8;return function(_0x5399c0){if(_0x5399c0){return _0x596b81['status'](_0x529ea1)[_0x1da7('0x19')](_0x5399c0);}};}function respondWithFilteredResult(_0x596e2c,_0x2f1ed0){return function(_0x3e4cbf){if(_0x3e4cbf){var _0x2502a5=typeof _0x2f1ed0[_0x1da7('0x1a')]==='undefined'&&typeof _0x2f1ed0['limit']===_0x1da7('0x1b');var _0xf6b659=_0x3e4cbf['count'];var _0x2b7c98=_0x2502a5?0x0:_0x2f1ed0[_0x1da7('0x1a')];var _0x1d8e50=_0x2502a5?_0x3e4cbf['count']:_0x2f1ed0[_0x1da7('0x1a')]+_0x2f1ed0[_0x1da7('0x1c')];var _0x5cea64;if(_0x1d8e50>=_0xf6b659){_0x1d8e50=_0xf6b659;_0x5cea64=0xc8;}else{_0x5cea64=0xce;}_0x596e2c[_0x1da7('0x17')](_0x5cea64);return _0x596e2c[_0x1da7('0x1d')](_0x1da7('0x1e'),_0x2b7c98+'-'+_0x1d8e50+'/'+_0xf6b659)[_0x1da7('0x19')](_0x3e4cbf);}return null;};}function patchUpdates(_0x59ed6a){return function(_0x126869){try{jsonpatch[_0x1da7('0x1f')](_0x126869,_0x59ed6a,!![]);}catch(_0x483bdb){return BPromise['reject'](_0x483bdb);}return _0x126869[_0x1da7('0x20')]();};}function saveUpdates(_0x1770d2,_0x23ceb8){return function(_0xd2a41b){if(_0xd2a41b){return _0xd2a41b[_0x1da7('0x21')](_0x1770d2)[_0x1da7('0x22')](function(_0x4c77f4){return _0x4c77f4;});}return null;};}function removeEntity(_0x2fa0c8,_0x9e5105){return function(_0x98feb2){if(_0x98feb2){return _0x98feb2[_0x1da7('0x23')]()[_0x1da7('0x22')](function(){_0x2fa0c8[_0x1da7('0x17')](0xcc)[_0x1da7('0x18')]();});}};}function handleEntityNotFound(_0x53eed0,_0x4da058){return function(_0x448e5e){if(!_0x448e5e){_0x53eed0[_0x1da7('0x16')](0x194);}return _0x448e5e;};}function handleError(_0x22ac1c,_0x3f6475){_0x3f6475=_0x3f6475||0x1f4;return function(_0x559695){logger[_0x1da7('0x24')](_0x559695[_0x1da7('0x25')]);if(_0x559695['name']){delete _0x559695[_0x1da7('0x26')];}_0x22ac1c[_0x1da7('0x17')](_0x3f6475)[_0x1da7('0x27')](_0x559695);};}exports[_0x1da7('0x28')]=function(_0x23f585,_0x357e38){var _0x16c374={},_0x3521f8={},_0x2051e2={'count':0x0,'rows':[]};var _0x31a8db=_[_0x1da7('0x29')](db[_0x1da7('0x2a')][_0x1da7('0x2b')],function(_0x2513a7){return{'name':_0x2513a7[_0x1da7('0x2c')],'type':_0x2513a7[_0x1da7('0x2d')]['key']};});_0x3521f8['model']=_[_0x1da7('0x29')](_0x31a8db,_0x1da7('0x26'));_0x3521f8[_0x1da7('0x2e')]=_['keys'](_0x23f585[_0x1da7('0x2e')]);_0x3521f8[_0x1da7('0x2f')]=_['intersection'](_0x3521f8[_0x1da7('0x30')],_0x3521f8[_0x1da7('0x2e')]);_0x16c374[_0x1da7('0x31')]=_[_0x1da7('0x32')](_0x3521f8[_0x1da7('0x30')],qs['fields'](_0x23f585['query'][_0x1da7('0x33')]));_0x16c374['attributes']=_0x16c374[_0x1da7('0x31')][_0x1da7('0x34')]?_0x16c374[_0x1da7('0x31')]:_0x3521f8[_0x1da7('0x30')];if(!_0x23f585[_0x1da7('0x2e')][_0x1da7('0x35')]('nolimit')){_0x16c374[_0x1da7('0x1c')]=qs[_0x1da7('0x1c')](_0x23f585[_0x1da7('0x2e')][_0x1da7('0x1c')]);_0x16c374[_0x1da7('0x1a')]=qs[_0x1da7('0x1a')](_0x23f585['query']['offset']);}_0x16c374[_0x1da7('0x36')]=qs[_0x1da7('0x37')](_0x23f585[_0x1da7('0x2e')]['sort']);_0x16c374[_0x1da7('0x38')]=qs[_0x1da7('0x2f')](_[_0x1da7('0x39')](_0x23f585[_0x1da7('0x2e')],_0x3521f8[_0x1da7('0x2f')]),_0x31a8db);if(_0x23f585[_0x1da7('0x2e')][_0x1da7('0x3a')]){_0x16c374[_0x1da7('0x38')]=_[_0x1da7('0x3b')](_0x16c374[_0x1da7('0x38')],{'$or':_[_0x1da7('0x29')](_0x31a8db,function(_0x5b4ed2){if(_0x5b4ed2['type']!=='VIRTUAL'){var _0xcfe312={};_0xcfe312[_0x5b4ed2[_0x1da7('0x26')]]={'$like':'%'+_0x23f585[_0x1da7('0x2e')][_0x1da7('0x3a')]+'%'};return _0xcfe312;}})});}_0x16c374=_[_0x1da7('0x3b')]({},_0x16c374,_0x23f585[_0x1da7('0x3c')]);var _0x1db21a={'where':_0x16c374[_0x1da7('0x38')]};return db[_0x1da7('0x2a')][_0x1da7('0x3d')](_0x1db21a)[_0x1da7('0x22')](function(_0xabca22){_0x2051e2['count']=_0xabca22;if(_0x23f585[_0x1da7('0x2e')]['includeAll']){_0x16c374[_0x1da7('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1da7('0x3f')](_0x16c374);})[_0x1da7('0x22')](function(_0x54ee77){_0x2051e2[_0x1da7('0x40')]=_0x54ee77;return _0x2051e2;})[_0x1da7('0x22')](respondWithFilteredResult(_0x357e38,_0x16c374))['catch'](handleError(_0x357e38,null));};exports[_0x1da7('0x41')]=function(_0x4c8422,_0x198c85){var _0x143a2a={'raw':![],'where':{'id':_0x4c8422['params']['id']}},_0x5cc90f={};_0x5cc90f[_0x1da7('0x30')]=_['keys'](db['UserProfileSection'][_0x1da7('0x2b')]);_0x5cc90f[_0x1da7('0x2e')]=_[_0x1da7('0x42')](_0x4c8422['query']);_0x5cc90f[_0x1da7('0x2f')]=_[_0x1da7('0x32')](_0x5cc90f[_0x1da7('0x30')],_0x5cc90f['query']);_0x143a2a[_0x1da7('0x31')]=_[_0x1da7('0x32')](_0x5cc90f['model'],qs[_0x1da7('0x33')](_0x4c8422[_0x1da7('0x2e')][_0x1da7('0x33')]));_0x143a2a[_0x1da7('0x31')]=_0x143a2a[_0x1da7('0x31')][_0x1da7('0x34')]?_0x143a2a[_0x1da7('0x31')]:_0x5cc90f[_0x1da7('0x30')];if(_0x4c8422[_0x1da7('0x2e')]['includeAll']){_0x143a2a[_0x1da7('0x3e')]=[{'all':!![]}];}_0x143a2a=_[_0x1da7('0x3b')]({},_0x143a2a,_0x4c8422[_0x1da7('0x3c')]);return db[_0x1da7('0x2a')][_0x1da7('0x43')](_0x143a2a)['then'](handleEntityNotFound(_0x198c85,null))[_0x1da7('0x22')](respondWithResult(_0x198c85,null))[_0x1da7('0x44')](handleError(_0x198c85,null));};exports[_0x1da7('0x45')]=function(_0x2e618c,_0x398ff5){return db[_0x1da7('0x2a')][_0x1da7('0x45')](_0x2e618c[_0x1da7('0x46')],{})[_0x1da7('0x22')](respondWithResult(_0x398ff5,0xc9))[_0x1da7('0x44')](handleError(_0x398ff5,null));};exports[_0x1da7('0x21')]=function(_0x47cbab,_0x11e30f){if(_0x47cbab['body']['id']){delete _0x47cbab[_0x1da7('0x46')]['id'];}return db[_0x1da7('0x2a')][_0x1da7('0x43')]({'where':{'id':_0x47cbab[_0x1da7('0x47')]['id']}})['then'](handleEntityNotFound(_0x11e30f,null))[_0x1da7('0x22')](saveUpdates(_0x47cbab[_0x1da7('0x46')],null))[_0x1da7('0x22')](respondWithResult(_0x11e30f,null))[_0x1da7('0x44')](handleError(_0x11e30f,null));};exports[_0x1da7('0x23')]=function(_0x26a61c,_0xe79e3f){return db[_0x1da7('0x2a')][_0x1da7('0x43')]({'where':{'id':_0x26a61c[_0x1da7('0x47')]['id']}})[_0x1da7('0x22')](handleEntityNotFound(_0xe79e3f,null))[_0x1da7('0x22')](removeEntity(_0xe79e3f,null))[_0x1da7('0x44')](handleError(_0xe79e3f,null));};exports[_0x1da7('0x48')]=function(_0x5537a6,_0x37aa48){return db[_0x1da7('0x2a')]['describe']()[_0x1da7('0x22')](respondWithResult(_0x37aa48,null))[_0x1da7('0x44')](handleError(_0x37aa48,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 03acd92..9cef2a0 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 _0x68a9=['../../config/logger','api','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util'];(function(_0x932f2c,_0x236d8c){var _0x5652be=function(_0x4b2944){while(--_0x4b2944){_0x932f2c['push'](_0x932f2c['shift']());}};_0x5652be(++_0x236d8c);}(_0x68a9,0x106));var _0x968a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x68a9[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x968a('0x0'));var util=require(_0x968a('0x1'));var logger=require(_0x968a('0x2'))(_0x968a('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('rimraf');var config=require(_0x968a('0x4'));var attributes=require(_0x968a('0x5'));module[_0x968a('0x6')]=function(_0x1d2b24,_0x4e7307){return _0x1d2b24['define'](_0x968a('0x7'),attributes,{'tableName':_0x968a('0x8'),'paranoid':![],'indexes':[{'name':_0x968a('0x9'),'fields':['sectionId',_0x968a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7794=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x44dec5,_0x4a52d8){var _0x462428=function(_0x5b7952){while(--_0x5b7952){_0x44dec5['push'](_0x44dec5['shift']());}};_0x462428(++_0x4a52d8);}(_0x7794,0xbf));var _0x4779=function(_0x3b266d,_0x2b9222){_0x3b266d=_0x3b266d-0x0;var _0x5f3dbb=_0x7794[_0x3b266d];return _0x5f3dbb;};'use strict';var _=require(_0x4779('0x0'));var util=require(_0x4779('0x1'));var logger=require(_0x4779('0x2'))(_0x4779('0x3'));var moment=require(_0x4779('0x4'));var BPromise=require(_0x4779('0x5'));var rp=require(_0x4779('0x6'));var fs=require('fs');var path=require(_0x4779('0x7'));var rimraf=require(_0x4779('0x8'));var config=require(_0x4779('0x9'));var attributes=require(_0x4779('0xa'));module[_0x4779('0xb')]=function(_0x237cfc,_0x55c82a){return _0x237cfc[_0x4779('0xc')]('UserProfileSection',attributes,{'tableName':_0x4779('0xd'),'paranoid':![],'indexes':[{'name':_0x4779('0xe'),'fields':[_0x4779('0xf'),_0x4779('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9595faf..5096913 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 _0xde5f=['request','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x45507e,_0x296ae3){var _0x33860a=function(_0x12ea55){while(--_0x12ea55){_0x45507e['push'](_0x45507e['shift']());}};_0x33860a(++_0x296ae3);}(_0xde5f,0x1df));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var util=require('util');var moment=require(_0xfde5('0x1'));var BPromise=require(_0xfde5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfde5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfde5('0x4'))('rpc');var config=require(_0xfde5('0x5'));var jayson=require(_0xfde5('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52b300,_0x30171e,_0x2e5cee){return new BPromise(function(_0x7cf2ed,_0x465fb9){return client[_0xfde5('0x7')](_0x52b300,_0x2e5cee)[_0xfde5('0x8')](function(_0x553297){logger['info'](_0xfde5('0x9'),_0x30171e,'request\x20sent');logger['debug'](_0xfde5('0xa'),_0x30171e,_0xfde5('0xb'),JSON[_0xfde5('0xc')](_0x553297));if(_0x553297[_0xfde5('0xd')]){if(_0x553297[_0xfde5('0xd')]['code']===0x1f4){logger['error'](_0xfde5('0x9'),_0x30171e,_0x553297['error'][_0xfde5('0xe')]);return _0x465fb9(_0x553297[_0xfde5('0xd')]['message']);}logger[_0xfde5('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x30171e,_0x553297[_0xfde5('0xd')][_0xfde5('0xe')]);return _0x7cf2ed(_0x553297['error'][_0xfde5('0xe')]);}else{logger[_0xfde5('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x30171e,'request\x20sent');_0x7cf2ed(_0x553297[_0xfde5('0x10')][_0xfde5('0xe')]);}})[_0xfde5('0x11')](function(_0x32b204){logger[_0xfde5('0xd')](_0xfde5('0x9'),_0x30171e,_0x32b204);_0x465fb9(_0x32b204);});});} \ No newline at end of file +var _0xa265=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa265,0x18b));var _0x5a26=function(_0x5c6b98,_0x23ed87){_0x5c6b98=_0x5c6b98-0x0;var _0x325be8=_0xa265[_0x5c6b98];return _0x325be8;};'use strict';var _=require(_0x5a26('0x0'));var util=require(_0x5a26('0x1'));var moment=require(_0x5a26('0x2'));var BPromise=require(_0x5a26('0x3'));var rs=require(_0x5a26('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a26('0x5'))['db'];var utils=require(_0x5a26('0x6'));var logger=require('../../config/logger')(_0x5a26('0x7'));var config=require(_0x5a26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a26('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x364503,_0x181270,_0x53843c){return new BPromise(function(_0x26236f,_0x1a220c){return client[_0x5a26('0xa')](_0x364503,_0x53843c)[_0x5a26('0xb')](function(_0x32af4c){logger[_0x5a26('0xc')](_0x5a26('0xd'),_0x181270,_0x5a26('0xe'));logger[_0x5a26('0xf')](_0x5a26('0x10'),_0x181270,'request\x20sent',JSON['stringify'](_0x32af4c));if(_0x32af4c[_0x5a26('0x11')]){if(_0x32af4c[_0x5a26('0x11')]['code']===0x1f4){logger[_0x5a26('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x181270,_0x32af4c[_0x5a26('0x11')]['message']);return _0x1a220c(_0x32af4c['error']['message']);}logger[_0x5a26('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x181270,_0x32af4c['error']['message']);return _0x26236f(_0x32af4c[_0x5a26('0x11')][_0x5a26('0x12')]);}else{logger['info'](_0x5a26('0xd'),_0x181270,_0x5a26('0xe'));_0x26236f(_0x32af4c['result']['message']);}})[_0x5a26('0x13')](function(_0xfed1b1){logger['error'](_0x5a26('0xd'),_0x181270,_0xfed1b1);_0x1a220c(_0xfed1b1);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index bbdf23b..1db793f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57b221,_0xd1f651){var _0x3dc429=function(_0x41cee6){while(--_0x41cee6){_0x57b221['push'](_0x57b221['shift']());}};_0x3dc429(++_0xd1f651);}(_0xe706,0xa3));var _0x6e70=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0xe706[_0x400b6c];return _0x4c4e3e;};'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(_0x480455,_0x449bb4){var _0x9105e4=function(_0xd6fdcd){while(--_0xd6fdcd){_0x480455['push'](_0x480455['shift']());}};_0x9105e4(++_0x449bb4);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index e956340..b53c945 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 _0xac1d=['INTEGER','sequelize','exports'];(function(_0x25c4e2,_0x4c4805){var _0x59cafe=function(_0x47f29b){while(--_0x47f29b){_0x25c4e2['push'](_0x25c4e2['shift']());}};_0x59cafe(++_0x4c4805);}(_0xac1d,0xfd));var _0xdac1=function(_0x2716bc,_0x6865f9){_0x2716bc=_0x2716bc-0x0;var _0x4785fd=_0xac1d[_0x2716bc];return _0x4785fd;};'use strict';var Sequelize=require(_0xdac1('0x0'));module[_0xdac1('0x1')]={'penalty':{'type':Sequelize[_0xdac1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x004d=['INTEGER','sequelize','exports'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x004d,0x124));var _0xd004=function(_0x146143,_0x87c4b5){_0x146143=_0x146143-0x0;var _0x488d70=_0x004d[_0x146143];return _0x488d70;};'use strict';var Sequelize=require(_0xd004('0x0'));module[_0xd004('0x1')]={'penalty':{'type':Sequelize[_0xd004('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0d314c0..1d91d2f 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0xc0213d,_0x4a3b1d){var _0x1a93c4=function(_0xc683f3){while(--_0xc683f3){_0xc0213d['push'](_0xc0213d['shift']());}};_0x1a93c4(++_0x4a3b1d);}(_0x2675,0x75));var _0x5267=function(_0x2f01bb,_0x26386a){_0x2f01bb=_0x2f01bb-0x0;var _0x2b7635=_0x2675[_0x2f01bb];return _0x2b7635;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd481=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xd481,0x1e4));var _0x1d48=function(_0x57e92f,_0x18ad40){_0x57e92f=_0x57e92f-0x0;var _0x3b2e43=_0xd481[_0x57e92f];return _0x3b2e43;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var logger=require(_0x1d48('0x1'))(_0x1d48('0x2'));var moment=require('moment');var BPromise=require(_0x1d48('0x3'));var rp=require(_0x1d48('0x4'));var fs=require('fs');var path=require(_0x1d48('0x5'));var rimraf=require('rimraf');var config=require(_0x1d48('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x1d48('0x7')]=function(_0x2a4830,_0x5a0c28){return _0x2a4830[_0x1d48('0x8')](_0x1d48('0x9'),attributes,{'tableName':_0x1d48('0xa'),'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 5b8d57e..6912046 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 _0xf453=['jayson/promise','client','http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0xf453,0x15e));var _0x3f45=function(_0x3b0397,_0x3d3688){_0x3b0397=_0x3b0397-0x0;var _0x568809=_0xf453[_0x3b0397];return _0x568809;};'use strict';var _=require('lodash');var util=require(_0x3f45('0x0'));var moment=require(_0x3f45('0x1'));var BPromise=require(_0x3f45('0x2'));var rs=require(_0x3f45('0x3'));var fs=require('fs');var Redis=require(_0x3f45('0x4'));var db=require(_0x3f45('0x5'))['db'];var utils=require(_0x3f45('0x6'));var logger=require(_0x3f45('0x7'))(_0x3f45('0x8'));var config=require(_0x3f45('0x9'));var jayson=require(_0x3f45('0xa'));var client=jayson[_0x3f45('0xb')][_0x3f45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22eb75,_0x196737,_0x3a0ebb){return new BPromise(function(_0xfdd5c0,_0x35111b){return client['request'](_0x22eb75,_0x3a0ebb)[_0x3f45('0xd')](function(_0x26910c){logger[_0x3f45('0xe')](_0x3f45('0xf'),_0x196737,_0x3f45('0x10'));logger[_0x3f45('0x11')](_0x3f45('0x12'),_0x196737,_0x3f45('0x10'),JSON[_0x3f45('0x13')](_0x26910c));if(_0x26910c[_0x3f45('0x14')]){if(_0x26910c[_0x3f45('0x14')]['code']===0x1f4){logger['error'](_0x3f45('0xf'),_0x196737,_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);return _0x35111b(_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);}logger[_0x3f45('0x14')](_0x3f45('0xf'),_0x196737,_0x26910c[_0x3f45('0x14')][_0x3f45('0x15')]);return _0xfdd5c0(_0x26910c[_0x3f45('0x14')]['message']);}else{logger['info'](_0x3f45('0xf'),_0x196737,_0x3f45('0x10'));_0xfdd5c0(_0x26910c[_0x3f45('0x16')]['message']);}})[_0x3f45('0x17')](function(_0x4aafc8){logger[_0x3f45('0x14')](_0x3f45('0xf'),_0x196737,_0x4aafc8);_0x35111b(_0x4aafc8);});});} \ No newline at end of file +var _0x695b=['randomstring','ioredis','../../config/utils','rpc','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','bluebird'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x695b,0x10c));var _0xb695=function(_0x15b276,_0x13b140){_0x15b276=_0x15b276-0x0;var _0x46f7cc=_0x695b[_0x15b276];return _0x46f7cc;};'use strict';var _=require(_0xb695('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb695('0x1'));var rs=require(_0xb695('0x2'));var fs=require('fs');var Redis=require(_0xb695('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb695('0x4'));var logger=require('../../config/logger')(_0xb695('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb695('0x6')][_0xb695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x145cd7,_0x571ccb,_0x5a7398){return new BPromise(function(_0x148712,_0x24cb02){return client['request'](_0x145cd7,_0x5a7398)[_0xb695('0x8')](function(_0x42b783){logger['info'](_0xb695('0x9'),_0x571ccb,_0xb695('0xa'));logger[_0xb695('0xb')](_0xb695('0xc'),_0x571ccb,_0xb695('0xa'),JSON[_0xb695('0xd')](_0x42b783));if(_0x42b783[_0xb695('0xe')]){if(_0x42b783[_0xb695('0xe')]['code']===0x1f4){logger['error'](_0xb695('0x9'),_0x571ccb,_0x42b783[_0xb695('0xe')]['message']);return _0x24cb02(_0x42b783[_0xb695('0xe')]['message']);}logger[_0xb695('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x571ccb,_0x42b783[_0xb695('0xe')][_0xb695('0xf')]);return _0x148712(_0x42b783[_0xb695('0xe')]['message']);}else{logger[_0xb695('0x10')](_0xb695('0x9'),_0x571ccb,'request\x20sent');_0x148712(_0x42b783['result'][_0xb695('0xf')]);}})[_0xb695('0x11')](function(_0x12a21f){logger[_0xb695('0xe')](_0xb695('0x9'),_0x571ccb,_0x12a21f);_0x24cb02(_0x12a21f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 083d72e..ac444e5 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 _0x9231=['exports','INTEGER','sequelize'];(function(_0x34bcd6,_0x561fd2){var _0x52358c=function(_0x2a556f){while(--_0x2a556f){_0x34bcd6['push'](_0x34bcd6['shift']());}};_0x52358c(++_0x561fd2);}(_0x9231,0xb0));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1923('0x0'));module[_0x1923('0x1')]={'UserId':{'type':Sequelize[_0x1923('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1923('0x2')]}}; \ No newline at end of file +var _0x950c=['exports','INTEGER','sequelize'];(function(_0x522560,_0x5939bb){var _0x1f1691=function(_0x3f8b17){while(--_0x3f8b17){_0x522560['push'](_0x522560['shift']());}};_0x1f1691(++_0x5939bb);}(_0x950c,0x143));var _0xc950=function(_0x30694d,_0x42c3ce){_0x30694d=_0x30694d-0x0;var _0x5f2351=_0x950c[_0x30694d];return _0x5f2351;};'use strict';var Sequelize=require(_0xc950('0x0'));module[_0xc950('0x1')]={'UserId':{'type':Sequelize[_0xc950('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xc950('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 9b85f68..77a4549 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(_0x5d4044,_0x580583){var _0x24b2aa=function(_0xf902b0){while(--_0xf902b0){_0x5d4044['push'](_0x5d4044['shift']());}};_0x24b2aa(++_0x580583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x11305d,_0x36ccf2){var _0x5ef296=function(_0x1d8800){while(--_0x1d8800){_0x11305d['push'](_0x11305d['shift']());}};_0x5ef296(++_0x36ccf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 f535d27..b42b321 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x8caffa,_0x4563bf){var _0xa53cd2=function(_0x51127d){while(--_0x51127d){_0x8caffa['push'](_0x8caffa['shift']());}};_0xa53cd2(++_0x4563bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xcb91[_0x2af053];return _0x4b4001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x49c3b9,_0x1e3272){var _0x5981c1=function(_0x265191){while(--_0x265191){_0x49c3b9['push'](_0x49c3b9['shift']());}};_0x5981c1(++_0x1e3272);}(_0x70e0,0x17b));var _0x070e=function(_0x309461,_0x32350f){_0x309461=_0x309461-0x0;var _0x36bd82=_0x70e0[_0x309461];return _0x36bd82;};'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 64bd260..783cdda 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 _0xde79=['sequelize'];(function(_0xef4214,_0x5a5bdf){var _0x20f448=function(_0x296e2c){while(--_0x296e2c){_0xef4214['push'](_0xef4214['shift']());}};_0x20f448(++_0x5a5bdf);}(_0xde79,0x10d));var _0x9de7=function(_0x4f62eb,_0x24418f){_0x4f62eb=_0x4f62eb-0x0;var _0x86bf70=_0xde79[_0x4f62eb];return _0x86bf70;};'use strict';var Sequelize=require(_0x9de7('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x976e=['exports'];(function(_0x2442a8,_0x3e0d90){var _0x105340=function(_0x1fd248){while(--_0x1fd248){_0x2442a8['push'](_0x2442a8['shift']());}};_0x105340(++_0x3e0d90);}(_0x976e,0x1a7));var _0xe976=function(_0x4c9915,_0x406b1a){_0x4c9915=_0x4c9915-0x0;var _0x473218=_0x976e[_0x4c9915];return _0x473218;};'use strict';var Sequelize=require('sequelize');module[_0xe976('0x0')]={'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 2efd29a..41255f6 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 _0x7e63=['define','UserVoiceQueue','user_has_voice_queues','util','api','bluebird','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x26f96a,_0x13636a){var _0x2b3b20=function(_0x170d5f){while(--_0x170d5f){_0x26f96a['push'](_0x26f96a['shift']());}};_0x2b3b20(++_0x13636a);}(_0x7e63,0x9c));var _0x37e6=function(_0x340c7b,_0x3b229e){_0x340c7b=_0x340c7b-0x0;var _0x8f8a3b=_0x7e63[_0x340c7b];return _0x8f8a3b;};'use strict';var _=require('lodash');var util=require(_0x37e6('0x0'));var logger=require('../../config/logger')(_0x37e6('0x1'));var moment=require('moment');var BPromise=require(_0x37e6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37e6('0x3'));var attributes=require(_0x37e6('0x4'));module[_0x37e6('0x5')]=function(_0x49b07c,_0x16c91c){return _0x49b07c[_0x37e6('0x6')](_0x37e6('0x7'),attributes,{'tableName':_0x37e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90e7=['moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x3d39b1,_0x180c7c){var _0x81ccf3=function(_0x391fb3){while(--_0x391fb3){_0x3d39b1['push'](_0x3d39b1['shift']());}};_0x81ccf3(++_0x180c7c);}(_0x90e7,0x75));var _0x790e=function(_0x1e5aac,_0x132857){_0x1e5aac=_0x1e5aac-0x0;var _0x18ffec=_0x90e7[_0x1e5aac];return _0x18ffec;};'use strict';var _=require(_0x790e('0x0'));var util=require(_0x790e('0x1'));var logger=require(_0x790e('0x2'))('api');var moment=require(_0x790e('0x3'));var BPromise=require(_0x790e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x790e('0x5'));var rimraf=require(_0x790e('0x6'));var config=require(_0x790e('0x7'));var attributes=require(_0x790e('0x8'));module[_0x790e('0x9')]=function(_0x42fde5,_0x6e095b){return _0x42fde5[_0x790e('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x790e('0xb'),'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 ca0f038..a7b499b 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 _0x8242=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4dc0c8,_0x48d51f){var _0x26bf81=function(_0x1093f6){while(--_0x1093f6){_0x4dc0c8['push'](_0x4dc0c8['shift']());}};_0x26bf81(++_0x48d51f);}(_0x8242,0x147));var _0x2824=function(_0x27d47d,_0x40d84c){_0x27d47d=_0x27d47d-0x0;var _0x12561d=_0x8242[_0x27d47d];return _0x12561d;};'use strict';var _=require(_0x2824('0x0'));var util=require(_0x2824('0x1'));var moment=require(_0x2824('0x2'));var BPromise=require(_0x2824('0x3'));var rs=require(_0x2824('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2824('0x5'))['db'];var utils=require(_0x2824('0x6'));var logger=require('../../config/logger')(_0x2824('0x7'));var config=require(_0x2824('0x8'));var jayson=require(_0x2824('0x9'));var client=jayson[_0x2824('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x100b55,_0x3910b8,_0x344ca9){return new BPromise(function(_0xe35a60,_0x20d483){return client['request'](_0x100b55,_0x344ca9)[_0x2824('0xb')](function(_0x15ed9f){logger[_0x2824('0xc')](_0x2824('0xd'),_0x3910b8,'request\x20sent');logger[_0x2824('0xe')](_0x2824('0xf'),_0x3910b8,_0x2824('0x10'),JSON[_0x2824('0x11')](_0x15ed9f));if(_0x15ed9f[_0x2824('0x12')]){if(_0x15ed9f[_0x2824('0x12')][_0x2824('0x13')]===0x1f4){logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x15ed9f['error'][_0x2824('0x14')]);return _0x20d483(_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);}logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);return _0xe35a60(_0x15ed9f[_0x2824('0x12')][_0x2824('0x14')]);}else{logger[_0x2824('0xc')](_0x2824('0xd'),_0x3910b8,_0x2824('0x10'));_0xe35a60(_0x15ed9f['result'][_0x2824('0x14')]);}})[_0x2824('0x15')](function(_0x4facee){logger[_0x2824('0x12')](_0x2824('0xd'),_0x3910b8,_0x4facee);_0x20d483(_0x4facee);});});} \ No newline at end of file +var _0xe0b4=['lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x245ff8,_0x2e81f8){var _0x5a4faa=function(_0x26af9e){while(--_0x26af9e){_0x245ff8['push'](_0x245ff8['shift']());}};_0x5a4faa(++_0x2e81f8);}(_0xe0b4,0x1a2));var _0x4e0b=function(_0x55b170,_0x4de763){_0x55b170=_0x55b170-0x0;var _0x11ac38=_0xe0b4[_0x55b170];return _0x11ac38;};'use strict';var _=require(_0x4e0b('0x0'));var util=require('util');var moment=require(_0x4e0b('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e0b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4e0b('0x3'));var logger=require(_0x4e0b('0x4'))(_0x4e0b('0x5'));var config=require(_0x4e0b('0x6'));var jayson=require(_0x4e0b('0x7'));var client=jayson[_0x4e0b('0x8')][_0x4e0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x400c10,_0x3d8fc3,_0xefac5b){return new BPromise(function(_0x1f09a8,_0x5d9b8d){return client[_0x4e0b('0xa')](_0x400c10,_0xefac5b)[_0x4e0b('0xb')](function(_0x12ce44){logger[_0x4e0b('0xc')](_0x4e0b('0xd'),_0x3d8fc3,_0x4e0b('0xe'));logger[_0x4e0b('0xf')](_0x4e0b('0x10'),_0x3d8fc3,'request\x20sent',JSON[_0x4e0b('0x11')](_0x12ce44));if(_0x12ce44[_0x4e0b('0x12')]){if(_0x12ce44[_0x4e0b('0x12')][_0x4e0b('0x13')]===0x1f4){logger[_0x4e0b('0x12')](_0x4e0b('0xd'),_0x3d8fc3,_0x12ce44['error'][_0x4e0b('0x14')]);return _0x5d9b8d(_0x12ce44['error'][_0x4e0b('0x14')]);}logger[_0x4e0b('0x12')](_0x4e0b('0xd'),_0x3d8fc3,_0x12ce44['error'][_0x4e0b('0x14')]);return _0x1f09a8(_0x12ce44[_0x4e0b('0x12')][_0x4e0b('0x14')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3d8fc3,_0x4e0b('0xe'));_0x1f09a8(_0x12ce44['result'][_0x4e0b('0x14')]);}})[_0x4e0b('0x15')](function(_0x5b0f2b){logger[_0x4e0b('0x12')](_0x4e0b('0xd'),_0x3d8fc3,_0x5b0f2b);_0x5d9b8d(_0x5b0f2b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 05059d5..9462696 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x105c5a,_0x6286cb){var _0x5d0999=function(_0x420458){while(--_0x420458){_0x105c5a['push'](_0x105c5a['shift']());}};_0x5d0999(++_0x6286cb);}(_0xe706,0xa3));var _0x6e70=function(_0x31d03c,_0x158cef){_0x31d03c=_0x31d03c-0x0;var _0x420e61=_0xe706[_0x31d03c];return _0x420e61;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3560b2,_0x1fa80a){var _0x4f459c=function(_0x31561c){while(--_0x31561c){_0x3560b2['push'](_0x3560b2['shift']());}};_0x4f459c(++_0x1fa80a);}(_0xe706,0xa3));var _0x6e70=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xe706[_0x17c483];return _0x112bdb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 0065e23..fb5ff50 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 _0xa027=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2f3fcf,_0x2e18a5){var _0x21bb1e=function(_0x8ced9){while(--_0x8ced9){_0x2f3fcf['push'](_0x2f3fcf['shift']());}};_0x21bb1e(++_0x2e18a5);}(_0xa027,0x1dd));var _0x7a02=function(_0x11ec98,_0x3495c1){_0x11ec98=_0x11ec98-0x0;var _0x5ae891=_0xa027[_0x11ec98];return _0x5ae891;};'use strict';var Sequelize=require(_0x7a02('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7a02('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x7a02('0x2')},'membername':{'type':Sequelize[_0x7a02('0x3')],'allowNull':![],'comment':_0x7a02('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7a02('0x3')],'allowNull':![],'unique':_0x7a02('0x4'),'comment':_0x7a02('0x2')},'VoiceQueueId':{'type':Sequelize[_0x7a02('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7a02('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x7a02('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xb77c=['exports','INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x293659,_0x2eda58){var _0x4257c9=function(_0x4622c1){while(--_0x4622c1){_0x293659['push'](_0x293659['shift']());}};_0x4257c9(++_0x2eda58);}(_0xb77c,0x89));var _0xcb77=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb77c[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0xcb77('0x0'));module[_0xcb77('0x1')]={'uniqueid':{'type':Sequelize[_0xcb77('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xcb77('0x3')],'allowNull':![],'comment':_0xcb77('0x4')},'UserId':{'type':Sequelize[_0xcb77('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcb77('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcb77('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0xcb77('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xcb77('0x4')},'paused':{'type':Sequelize[_0xcb77('0x2')](0xb),'defaultValue':0x0,'comment':_0xcb77('0x4')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 57767d2..68bffad 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 _0x82be=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x14ccc9,_0x286523){var _0x33358b=function(_0x2d0bb8){while(--_0x2d0bb8){_0x14ccc9['push'](_0x14ccc9['shift']());}};_0x33358b(++_0x286523);}(_0x82be,0x156));var _0xe82b=function(_0x4cbe14,_0x9972b3){_0x4cbe14=_0x4cbe14-0x0;var _0x22cf00=_0x82be[_0x4cbe14];return _0x22cf00;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xe82b('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe82b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe82b('0x2'),'afterDestroy':_0xe82b('0x3')};function emitEvent(_0x1367b1){return function(_0x5ece62,_0x5b0680,_0x5d4fb4){UserVoiceQueueRtEvents[_0xe82b('0x4')](_0x1367b1+':'+_0x5ece62['id'],_0x5ece62);UserVoiceQueueRtEvents[_0xe82b('0x4')](_0x1367b1,_0x5ece62);_0x5d4fb4(null);};}for(var e in events){if(events[_0xe82b('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xe82b('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc2f9=['exports','events','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x51de6e,_0x3a3de1){var _0x100339=function(_0x4f93f0){while(--_0x4f93f0){_0x51de6e['push'](_0x51de6e['shift']());}};_0x100339(++_0x3a3de1);}(_0xc2f9,0x1c3));var _0x9c2f=function(_0x2507fb,_0x8a56f3){_0x2507fb=_0x2507fb-0x0;var _0x1cea60=_0xc2f9[_0x2507fb];return _0x1cea60;};'use strict';var EventEmitter=require(_0x9c2f('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x9c2f('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9c2f('0x2')](0x0);var events={'afterCreate':_0x9c2f('0x3'),'afterUpdate':'update','afterDestroy':_0x9c2f('0x4')};function emitEvent(_0x41e45a){return function(_0x3cf1e8,_0x215b09,_0x3465b0){UserVoiceQueueRtEvents[_0x9c2f('0x5')](_0x41e45a+':'+_0x3cf1e8['id'],_0x3cf1e8);UserVoiceQueueRtEvents['emit'](_0x41e45a,_0x3cf1e8);_0x3465b0(null);};}for(var e in events){if(events[_0x9c2f('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x9c2f('0x7')](e,emitEvent(event));}}module[_0x9c2f('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 99fdeeb..110223e 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 _0xe752=['request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0xe752,0x1e5));var _0x2e75=function(_0x4e797b,_0x146e30){_0x4e797b=_0x4e797b-0x0;var _0x2fddf3=_0xe752[_0x4e797b];return _0x2fddf3;};'use strict';var _=require(_0x2e75('0x0'));var util=require('util');var logger=require(_0x2e75('0x1'))(_0x2e75('0x2'));var moment=require(_0x2e75('0x3'));var BPromise=require(_0x2e75('0x4'));var rp=require(_0x2e75('0x5'));var fs=require('fs');var path=require(_0x2e75('0x6'));var rimraf=require(_0x2e75('0x7'));var config=require(_0x2e75('0x8'));var attributes=require(_0x2e75('0x9'));module[_0x2e75('0xa')]=function(_0x463986,_0x4f406a){return _0x463986[_0x2e75('0xb')](_0x2e75('0xc'),attributes,{'tableName':_0x2e75('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8671=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x266b6c,_0x572095){var _0xcd1dbe=function(_0x388795){while(--_0x388795){_0x266b6c['push'](_0x266b6c['shift']());}};_0xcd1dbe(++_0x572095);}(_0x8671,0x90));var _0x1867=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x8671[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x1867('0x0'));var util=require(_0x1867('0x1'));var logger=require(_0x1867('0x2'))(_0x1867('0x3'));var moment=require(_0x1867('0x4'));var BPromise=require(_0x1867('0x5'));var rp=require(_0x1867('0x6'));var fs=require('fs');var path=require(_0x1867('0x7'));var rimraf=require(_0x1867('0x8'));var config=require(_0x1867('0x9'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x1867('0xa')]=function(_0x3c5fff,_0x1be8b6){return _0x3c5fff[_0x1867('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0x1867('0xc'),'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 6c74103..e3454d2 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 _0x0307=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x30d719,_0x22729b){var _0x21358e=function(_0x9c8042){while(--_0x9c8042){_0x30d719['push'](_0x30d719['shift']());}};_0x21358e(++_0x22729b);}(_0x0307,0x129));var _0x7030=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x0307[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x7030('0x0'));var util=require(_0x7030('0x1'));var moment=require(_0x7030('0x2'));var BPromise=require(_0x7030('0x3'));var rs=require(_0x7030('0x4'));var fs=require('fs');var Redis=require(_0x7030('0x5'));var db=require(_0x7030('0x6'))['db'];var utils=require(_0x7030('0x7'));var logger=require('../../config/logger')(_0x7030('0x8'));var config=require(_0x7030('0x9'));var jayson=require(_0x7030('0xa'));var client=jayson[_0x7030('0xb')][_0x7030('0xc')]({'port':0x232a});config['redis']=_[_0x7030('0xd')](config[_0x7030('0xe')],{'host':_0x7030('0xf'),'port':0x18eb});var socket=require(_0x7030('0x10'))(new Redis(config[_0x7030('0xe')]));require(_0x7030('0x11'))[_0x7030('0x12')](socket);function respondWithRpcPromise(_0x23472a,_0x219d4b,_0x329c2e){return new BPromise(function(_0x26902b,_0x19c636){return client['request'](_0x23472a,_0x329c2e)[_0x7030('0x13')](function(_0x3d5e78){logger[_0x7030('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x219d4b,_0x7030('0x15'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x219d4b,_0x7030('0x15'),JSON[_0x7030('0x16')](_0x3d5e78));if(_0x3d5e78[_0x7030('0x17')]){if(_0x3d5e78[_0x7030('0x17')][_0x7030('0x18')]===0x1f4){logger[_0x7030('0x17')](_0x7030('0x19'),_0x219d4b,_0x3d5e78[_0x7030('0x17')]['message']);return _0x19c636(_0x3d5e78[_0x7030('0x17')][_0x7030('0x1a')]);}logger[_0x7030('0x17')](_0x7030('0x19'),_0x219d4b,_0x3d5e78['error'][_0x7030('0x1a')]);return _0x26902b(_0x3d5e78['error'][_0x7030('0x1a')]);}else{logger[_0x7030('0x14')](_0x7030('0x19'),_0x219d4b,_0x7030('0x15'));_0x26902b(_0x3d5e78[_0x7030('0x1b')][_0x7030('0x1a')]);}})[_0x7030('0x1c')](function(_0x3d13e7){logger['error'](_0x7030('0x19'),_0x219d4b,_0x3d13e7);_0x19c636(_0x3d13e7);});});}exports[_0x7030('0x1d')]=function(_0x66a481){var _0x12728c=this;return new Promise(function(_0x42d385,_0x50fb9f){return db[_0x7030('0x1e')]['findAll']({'raw':_0x66a481['options']?_0x66a481['options'][_0x7030('0x1f')]===undefined?!![]:![]:!![],'where':_0x66a481[_0x7030('0x20')]?_0x66a481[_0x7030('0x20')][_0x7030('0x21')]||null:null,'attributes':[[db[_0x7030('0x22')]['fn'](_0x7030('0x23'),db['sequelize']['fn']('IF',db[_0x7030('0x22')]['literal'](_0x7030('0x24')))),_0x7030('0x25')]]})[_0x7030('0x13')](function(_0x331b9d){logger[_0x7030('0x14')]('GetVoiceQueueRtPauses',_0x66a481);logger[_0x7030('0x26')](_0x7030('0x1d'),_0x66a481,JSON[_0x7030('0x16')](_0x331b9d));_0x42d385(_0x331b9d);})[_0x7030('0x1c')](function(_0x267d03){logger[_0x7030('0x17')]('GetVoiceQueueRtPauses',_0x267d03[_0x7030('0x1a')],_0x66a481);_0x50fb9f(_0x12728c[_0x7030('0x17')](0x1f4,_0x267d03[_0x7030('0x1a')]));});});}; \ No newline at end of file +var _0x054e=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request'];(function(_0x24e9f8,_0x1b0073){var _0x5f0d3d=function(_0x23011a){while(--_0x23011a){_0x24e9f8['push'](_0x24e9f8['shift']());}};_0x5f0d3d(++_0x1b0073);}(_0x054e,0xd3));var _0xe054=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x054e[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xe054('0x0'));var util=require(_0xe054('0x1'));var moment=require(_0xe054('0x2'));var BPromise=require(_0xe054('0x3'));var rs=require(_0xe054('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe054('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe054('0x6'));var client=jayson['client'][_0xe054('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xe054('0x8')],{'host':_0xe054('0x9'),'port':0x18eb});var socket=require(_0xe054('0xa'))(new Redis(config[_0xe054('0x8')]));require(_0xe054('0xb'))['register'](socket);function respondWithRpcPromise(_0x3f1bd5,_0x202dfb,_0x226e8e){return new BPromise(function(_0x2e9fcb,_0x15557a){return client[_0xe054('0xc')](_0x3f1bd5,_0x226e8e)['then'](function(_0x4e9324){logger['info'](_0xe054('0xd'),_0x202dfb,_0xe054('0xe'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x202dfb,_0xe054('0xe'),JSON[_0xe054('0xf')](_0x4e9324));if(_0x4e9324[_0xe054('0x10')]){if(_0x4e9324[_0xe054('0x10')][_0xe054('0x11')]===0x1f4){logger[_0xe054('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x202dfb,_0x4e9324[_0xe054('0x10')]['message']);return _0x15557a(_0x4e9324[_0xe054('0x10')]['message']);}logger[_0xe054('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x202dfb,_0x4e9324[_0xe054('0x10')][_0xe054('0x12')]);return _0x2e9fcb(_0x4e9324[_0xe054('0x10')][_0xe054('0x12')]);}else{logger[_0xe054('0x13')](_0xe054('0xd'),_0x202dfb,_0xe054('0xe'));_0x2e9fcb(_0x4e9324[_0xe054('0x14')][_0xe054('0x12')]);}})['catch'](function(_0x1ebcb1){logger[_0xe054('0x10')](_0xe054('0xd'),_0x202dfb,_0x1ebcb1);_0x15557a(_0x1ebcb1);});});}exports[_0xe054('0x15')]=function(_0x507416){var _0x424327=this;return new Promise(function(_0x2d34db,_0x1d9192){return db[_0xe054('0x16')][_0xe054('0x17')]({'raw':_0x507416[_0xe054('0x18')]?_0x507416[_0xe054('0x18')][_0xe054('0x19')]===undefined?!![]:![]:!![],'where':_0x507416[_0xe054('0x18')]?_0x507416[_0xe054('0x18')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xe054('0x1a'),db[_0xe054('0x1b')]['fn']('IF',db[_0xe054('0x1b')][_0xe054('0x1c')]('`paused`\x20=\x201,\x201,\x20null'))),_0xe054('0x1d')]]})[_0xe054('0x1e')](function(_0x469d82){logger[_0xe054('0x13')](_0xe054('0x15'),_0x507416);logger[_0xe054('0x1f')]('GetVoiceQueueRtPauses',_0x507416,JSON['stringify'](_0x469d82));_0x2d34db(_0x469d82);})['catch'](function(_0xc21a3d){logger[_0xe054('0x10')](_0xe054('0x15'),_0xc21a3d[_0xe054('0x12')],_0x507416);_0x1d9192(_0x424327[_0xe054('0x10')](0x1f4,_0xc21a3d['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ddffe9a..1e7e401 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 _0xafc4=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x3da612,_0x332456){var _0x1a9d1d=function(_0x5ca0d0){while(--_0x5ca0d0){_0x3da612['push'](_0x3da612['shift']());}};_0x1a9d1d(++_0x332456);}(_0xafc4,0x69));var _0x4afc=function(_0x72e9e8,_0x1758fe){_0x72e9e8=_0x72e9e8-0x0;var _0x2b6157=_0xafc4[_0x72e9e8];return _0x2b6157;};'use strict';var UserVoiceQueueRtEvents=require(_0x4afc('0x0'));var events=['save',_0x4afc('0x1'),'update'];function createListener(_0x10aede,_0x11789f){return function(_0x20e443){_0x11789f[_0x4afc('0x2')](_0x10aede,_0x20e443);};}function removeListener(_0x4d9dbd,_0x49f417){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4d9dbd,_0x49f417);};}exports[_0x4afc('0x3')]=function(_0x471d45){for(var _0x16953b=0x0,_0x1bb281=events[_0x4afc('0x4')];_0x16953b<_0x1bb281;_0x16953b++){var _0xaf053d=events[_0x16953b];var _0x5e1e29=createListener(_0x4afc('0x5')+_0xaf053d,_0x471d45);UserVoiceQueueRtEvents['on'](_0xaf053d,_0x5e1e29);}}; \ No newline at end of file +var _0xb138=['update','removeListener','length','./userVoiceQueueRt.events','save','remove'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xb138,0x1dd));var _0x8b13=function(_0x730f5b,_0x44b24f){_0x730f5b=_0x730f5b-0x0;var _0x2e07a5=_0xb138[_0x730f5b];return _0x2e07a5;};'use strict';var UserVoiceQueueRtEvents=require(_0x8b13('0x0'));var events=[_0x8b13('0x1'),_0x8b13('0x2'),_0x8b13('0x3')];function createListener(_0xadad70,_0x185752){return function(_0x20c65c){_0x185752['emit'](_0xadad70,_0x20c65c);};}function removeListener(_0x4411a0,_0x241acb){return function(){UserVoiceQueueRtEvents[_0x8b13('0x4')](_0x4411a0,_0x241acb);};}exports['register']=function(_0xd19a0f){for(var _0x13f7bd=0x0,_0x5d51b1=events[_0x8b13('0x5')];_0x13f7bd<_0x5d51b1;_0x13f7bd++){var _0x33d1a7=events[_0x13f7bd];var _0x22e157=createListener('userVoiceQueueRt:'+_0x33d1a7,_0xd19a0f);UserVoiceQueueRtEvents['on'](_0x33d1a7,_0x22e157);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index bb13c8d..eb7c0e2 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3651cc,_0x56f14f){var _0x470f8e=function(_0x501e4b){while(--_0x501e4b){_0x3651cc['push'](_0x3651cc['shift']());}};_0x470f8e(++_0x56f14f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a89cd,_0x58e05d){var _0x3f9b28=function(_0x1d2899){while(--_0x1d2899){_0x2a89cd['push'](_0x2a89cd['shift']());}};_0x3f9b28(++_0x58e05d);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 7efee9a..94fab66 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 _0xb2f4=['exports','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x41e3e5,_0x441240){_0x41e3e5=_0x41e3e5-0x0;var _0x4b5b5c=_0xb2f4[_0x41e3e5];return _0x4b5b5c;};'use strict';var Sequelize=require(_0x4b2f('0x0'));module[_0x4b2f('0x1')]={'penalty':{'type':Sequelize[_0x4b2f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4bc8=['sequelize'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x4bc8,0xb1));var _0x84bc=function(_0x269698,_0x56edec){_0x269698=_0x269698-0x0;var _0x48cd0a=_0x4bc8[_0x269698];return _0x48cd0a;};'use strict';var Sequelize=require(_0x84bc('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 813b3ad..d93f884 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 _0x2806=['user_has_whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x2806,0x15d));var _0x6280=function(_0x1c3c53,_0x299fb4){_0x1c3c53=_0x1c3c53-0x0;var _0x5263cf=_0x2806[_0x1c3c53];return _0x5263cf;};'use strict';var _=require(_0x6280('0x0'));var util=require(_0x6280('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6280('0x2'));var BPromise=require(_0x6280('0x3'));var rp=require(_0x6280('0x4'));var fs=require('fs');var path=require(_0x6280('0x5'));var rimraf=require(_0x6280('0x6'));var config=require('../../config/environment');var attributes=require(_0x6280('0x7'));module[_0x6280('0x8')]=function(_0x4c9eca,_0x186360){return _0x4c9eca[_0x6280('0x9')](_0x6280('0xa'),attributes,{'tableName':_0x6280('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b0f=['user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x9b0f,0x187));var _0xf9b0=function(_0x3f7e8b,_0x7291d1){_0x3f7e8b=_0x3f7e8b-0x0;var _0x4eb892=_0x9b0f[_0x3f7e8b];return _0x4eb892;};'use strict';var _=require(_0xf9b0('0x0'));var util=require(_0xf9b0('0x1'));var logger=require(_0xf9b0('0x2'))(_0xf9b0('0x3'));var moment=require(_0xf9b0('0x4'));var BPromise=require('bluebird');var rp=require(_0xf9b0('0x5'));var fs=require('fs');var path=require(_0xf9b0('0x6'));var rimraf=require(_0xf9b0('0x7'));var config=require(_0xf9b0('0x8'));var attributes=require(_0xf9b0('0x9'));module[_0xf9b0('0xa')]=function(_0x152f95,_0x2c45f7){return _0x152f95['define'](_0xf9b0('0xb'),attributes,{'tableName':_0xf9b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 159ab3d..9f333fb 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 _0x16fd=['http','request','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x15896a,_0x926834){var _0x1094b8=function(_0x3cf061){while(--_0x3cf061){_0x15896a['push'](_0x15896a['shift']());}};_0x1094b8(++_0x926834);}(_0x16fd,0x12a));var _0xd16f=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x16fd[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0xd16f('0x0'));var util=require('util');var moment=require(_0xd16f('0x1'));var BPromise=require(_0xd16f('0x2'));var rs=require(_0xd16f('0x3'));var fs=require('fs');var Redis=require(_0xd16f('0x4'));var db=require(_0xd16f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd16f('0x6'))('rpc');var config=require(_0xd16f('0x7'));var jayson=require(_0xd16f('0x8'));var client=jayson[_0xd16f('0x9')][_0xd16f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7142c2,_0x29b133,_0x103da8){return new BPromise(function(_0x816eeb,_0x25bf54){return client[_0xd16f('0xb')](_0x7142c2,_0x103da8)['then'](function(_0x58663d){logger[_0xd16f('0xc')](_0xd16f('0xd'),_0x29b133,'request\x20sent');logger[_0xd16f('0xe')](_0xd16f('0xf'),_0x29b133,'request\x20sent',JSON[_0xd16f('0x10')](_0x58663d));if(_0x58663d[_0xd16f('0x11')]){if(_0x58663d[_0xd16f('0x11')]['code']===0x1f4){logger['error'](_0xd16f('0xd'),_0x29b133,_0x58663d[_0xd16f('0x11')]['message']);return _0x25bf54(_0x58663d[_0xd16f('0x11')][_0xd16f('0x12')]);}logger[_0xd16f('0x11')](_0xd16f('0xd'),_0x29b133,_0x58663d[_0xd16f('0x11')]['message']);return _0x816eeb(_0x58663d['error'][_0xd16f('0x12')]);}else{logger['info'](_0xd16f('0xd'),_0x29b133,_0xd16f('0x13'));_0x816eeb(_0x58663d[_0xd16f('0x14')]['message']);}})[_0xd16f('0x15')](function(_0x302423){logger[_0xd16f('0x11')](_0xd16f('0xd'),_0x29b133,_0x302423);_0x25bf54(_0x302423);});});} \ No newline at end of file +var _0xa39f=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s'];(function(_0x10ff12,_0x4d9db5){var _0x5c4a7d=function(_0x4792c6){while(--_0x4792c6){_0x10ff12['push'](_0x10ff12['shift']());}};_0x5c4a7d(++_0x4d9db5);}(_0xa39f,0x152));var _0xfa39=function(_0x3cfe76,_0x1d9d61){_0x3cfe76=_0x3cfe76-0x0;var _0x1f6f12=_0xa39f[_0x3cfe76];return _0x1f6f12;};'use strict';var _=require(_0xfa39('0x0'));var util=require(_0xfa39('0x1'));var moment=require(_0xfa39('0x2'));var BPromise=require(_0xfa39('0x3'));var rs=require(_0xfa39('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa39('0x5'))['db'];var utils=require(_0xfa39('0x6'));var logger=require('../../config/logger')(_0xfa39('0x7'));var config=require(_0xfa39('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11e58c,_0x1768a9,_0x3086d7){return new BPromise(function(_0x24532b,_0x199cd7){return client[_0xfa39('0xa')](_0x11e58c,_0x3086d7)[_0xfa39('0xb')](function(_0x5e69bd){logger[_0xfa39('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1768a9,_0xfa39('0xd'));logger['debug'](_0xfa39('0xe'),_0x1768a9,_0xfa39('0xd'),JSON[_0xfa39('0xf')](_0x5e69bd));if(_0x5e69bd[_0xfa39('0x10')]){if(_0x5e69bd[_0xfa39('0x10')][_0xfa39('0x11')]===0x1f4){logger[_0xfa39('0x10')](_0xfa39('0x12'),_0x1768a9,_0x5e69bd['error'][_0xfa39('0x13')]);return _0x199cd7(_0x5e69bd[_0xfa39('0x10')][_0xfa39('0x13')]);}logger['error'](_0xfa39('0x12'),_0x1768a9,_0x5e69bd[_0xfa39('0x10')][_0xfa39('0x13')]);return _0x24532b(_0x5e69bd[_0xfa39('0x10')][_0xfa39('0x13')]);}else{logger[_0xfa39('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1768a9,_0xfa39('0xd'));_0x24532b(_0x5e69bd[_0xfa39('0x14')][_0xfa39('0x13')]);}})['catch'](function(_0x4a47fb){logger['error'](_0xfa39('0x12'),_0x1768a9,_0x4a47fb);_0x199cd7(_0x4a47fb);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 5dae479..81de116 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 _0xe2cc=['get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller'];(function(_0x207c72,_0x142ea1){var _0x2ba9a7=function(_0x1b27a9){while(--_0x1b27a9){_0x207c72['push'](_0x207c72['shift']());}};_0x2ba9a7(++_0x142ea1);}(_0xe2cc,0x69));var _0xce2c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe2cc[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xce2c('0x2'));var router=express[_0xce2c('0x3')]();var fs_extra=require(_0xce2c('0x4'));var auth=require(_0xce2c('0x5'));var interaction=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var controller=require(_0xce2c('0x8'));router[_0xce2c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xce2c('0x9')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xc')]);router[_0xce2c('0xd')]('/',auth[_0xce2c('0xb')](),controller['create']);router[_0xce2c('0xe')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0xf')]);router[_0xce2c('0x10')](_0xce2c('0xa'),auth[_0xce2c('0xb')](),controller[_0xce2c('0x11')]);module[_0xce2c('0x12')]=router; \ No newline at end of file +var _0x32ff=['./variable.controller','get','isAuthenticated','show','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33d134,_0x37d4e7){var _0x30115e=function(_0xc0560a){while(--_0xc0560a){_0x33d134['push'](_0x33d134['shift']());}};_0x30115e(++_0x37d4e7);}(_0x32ff,0xc7));var _0xf32f=function(_0x29e302,_0x55ecb2){_0x29e302=_0x29e302-0x0;var _0x37bb71=_0x32ff[_0x29e302];return _0x37bb71;};'use strict';var multer=require(_0xf32f('0x0'));var util=require(_0xf32f('0x1'));var path=require(_0xf32f('0x2'));var timeout=require(_0xf32f('0x3'));var express=require(_0xf32f('0x4'));var router=express[_0xf32f('0x5')]();var fs_extra=require(_0xf32f('0x6'));var auth=require(_0xf32f('0x7'));var interaction=require(_0xf32f('0x8'));var config=require(_0xf32f('0x9'));var controller=require(_0xf32f('0xa'));router[_0xf32f('0xb')]('/',auth[_0xf32f('0xc')](),controller['index']);router[_0xf32f('0xb')]('/:id',auth[_0xf32f('0xc')](),controller[_0xf32f('0xd')]);router[_0xf32f('0xe')]('/',auth[_0xf32f('0xc')](),controller[_0xf32f('0xf')]);router[_0xf32f('0x10')](_0xf32f('0x11'),auth[_0xf32f('0xc')](),controller['update']);router['delete'](_0xf32f('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xf32f('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 6e5ccbb..84ce1f0 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 _0x9d8c=['sequelize','STRING','name'];(function(_0x24fca1,_0x41eef3){var _0x25da57=function(_0x31a460){while(--_0x31a460){_0x24fca1['push'](_0x24fca1['shift']());}};_0x25da57(++_0x41eef3);}(_0x9d8c,0x162));var _0xc9d8=function(_0x54854d,_0x51d4f4){_0x54854d=_0x54854d-0x0;var _0x37a908=_0x9d8c[_0x54854d];return _0x37a908;};'use strict';var Sequelize=require(_0xc9d8('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9d8('0x1')],'unique':_0xc9d8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc9d8('0x1')]}}; \ No newline at end of file +var _0xa366=['sequelize','STRING','name'];(function(_0x1786e0,_0x19dc8c){var _0x4a6229=function(_0x151bdd){while(--_0x151bdd){_0x1786e0['push'](_0x1786e0['shift']());}};_0x4a6229(++_0x19dc8c);}(_0xa366,0x1e0));var _0x6a36=function(_0x3b5538,_0x2cdc1a){_0x3b5538=_0x3b5538-0x0;var _0xe6981b=_0xa366[_0x3b5538];return _0xe6981b;};'use strict';var Sequelize=require(_0x6a36('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a36('0x1')],'unique':_0x6a36('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a36('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0a8c4bb..7b8bb6b 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 _0xaa33=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find'];(function(_0x334e45,_0x41f016){var _0x25ddb0=function(_0x2718d1){while(--_0x2718d1){_0x334e45['push'](_0x334e45['shift']());}};_0x25ddb0(++_0x41f016);}(_0xaa33,0x151));var _0x3aa3=function(_0x46aaa9,_0x31bdfc){_0x46aaa9=_0x46aaa9-0x0;var _0x369d38=_0xaa33[_0x46aaa9];return _0x369d38;};'use strict';var emlformat=require(_0x3aa3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3aa3('0x1'));var rp=require(_0x3aa3('0x2'));var moment=require(_0x3aa3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3aa3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3aa3('0x5'));var ejs=require(_0x3aa3('0x6'));var fs=require('fs');var fs_extra=require(_0x3aa3('0x7'));var _=require(_0x3aa3('0x8'));var squel=require(_0x3aa3('0x9'));var crypto=require(_0x3aa3('0xa'));var jsforce=require(_0x3aa3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3aa3('0x5'));var querystring=require('querystring');var Papa=require(_0x3aa3('0xc'));var Redis=require(_0x3aa3('0xd'));var authService=require(_0x3aa3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3aa3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aa3('0x10'))(_0x3aa3('0x11'));var utils=require(_0x3aa3('0x12'));var config=require(_0x3aa3('0x13'));var licenseUtil=require(_0x3aa3('0x14'));var db=require(_0x3aa3('0x15'))['db'];function respondWithStatusCode(_0x40e36b,_0x4380d3){_0x4380d3=_0x4380d3||0xcc;return function(_0x4d6cf0){if(_0x4d6cf0){return _0x40e36b[_0x3aa3('0x16')](_0x4380d3);}return _0x40e36b['status'](_0x4380d3)[_0x3aa3('0x17')]();};}function respondWithResult(_0x3be2c0,_0x29a5b1){_0x29a5b1=_0x29a5b1||0xc8;return function(_0x5f380f){if(_0x5f380f){return _0x3be2c0[_0x3aa3('0x18')](_0x29a5b1)['json'](_0x5f380f);}};}function respondWithFilteredResult(_0x13a5af,_0x207326){return function(_0x2c2f92){if(_0x2c2f92){var _0x1a5e2e=typeof _0x207326[_0x3aa3('0x19')]===_0x3aa3('0x1a')&&typeof _0x207326[_0x3aa3('0x1b')]===_0x3aa3('0x1a');var _0x1dfa31=_0x2c2f92[_0x3aa3('0x1c')];var _0x387214=_0x1a5e2e?0x0:_0x207326['offset'];var _0x1c2f09=_0x1a5e2e?_0x2c2f92[_0x3aa3('0x1c')]:_0x207326[_0x3aa3('0x19')]+_0x207326[_0x3aa3('0x1b')];var _0x2824f8;if(_0x1c2f09>=_0x1dfa31){_0x1c2f09=_0x1dfa31;_0x2824f8=0xc8;}else{_0x2824f8=0xce;}_0x13a5af[_0x3aa3('0x18')](_0x2824f8);return _0x13a5af[_0x3aa3('0x1d')](_0x3aa3('0x1e'),_0x387214+'-'+_0x1c2f09+'/'+_0x1dfa31)['json'](_0x2c2f92);}return null;};}function patchUpdates(_0x4be357){return function(_0x526289){try{jsonpatch[_0x3aa3('0x1f')](_0x526289,_0x4be357,!![]);}catch(_0x5c13a9){return BPromise[_0x3aa3('0x20')](_0x5c13a9);}return _0x526289[_0x3aa3('0x21')]();};}function saveUpdates(_0x30dac7,_0x4329a6){return function(_0x2b95b8){if(_0x2b95b8){return _0x2b95b8[_0x3aa3('0x22')](_0x30dac7)['then'](function(_0x2204fe){return _0x2204fe;});}return null;};}function removeEntity(_0x55c379,_0x55cdf9){return function(_0x11c2da){if(_0x11c2da){return _0x11c2da[_0x3aa3('0x23')]()[_0x3aa3('0x24')](function(){var _0x2232a9=_0x11c2da[_0x3aa3('0x25')]({'plain':!![]});var _0x51da56=_0x3aa3('0x26');return db[_0x3aa3('0x27')]['destroy']({'where':{'type':_0x51da56,'resourceId':_0x2232a9['id']}})[_0x3aa3('0x24')](function(){return _0x11c2da;});})['then'](function(){_0x55c379[_0x3aa3('0x18')](0xcc)[_0x3aa3('0x17')]();});}};}function handleEntityNotFound(_0x4743c7,_0x31d5a7){return function(_0x53dd6d){if(!_0x53dd6d){_0x4743c7['sendStatus'](0x194);}return _0x53dd6d;};}function handleError(_0x5f5d3a,_0x84ed9e){_0x84ed9e=_0x84ed9e||0x1f4;return function(_0x21a119){logger[_0x3aa3('0x28')](_0x21a119[_0x3aa3('0x29')]);if(_0x21a119[_0x3aa3('0x2a')]){delete _0x21a119['name'];}_0x5f5d3a[_0x3aa3('0x18')](_0x84ed9e)[_0x3aa3('0x2b')](_0x21a119);};}exports[_0x3aa3('0x2c')]=function(_0x5eafaf,_0x32eeb9){var _0x247080={},_0x324e27={},_0x2a05af={'count':0x0,'rows':[]};var _0x319202=_[_0x3aa3('0x2d')](db[_0x3aa3('0x2e')][_0x3aa3('0x2f')],function(_0x5a9206){return{'name':_0x5a9206['fieldName'],'type':_0x5a9206[_0x3aa3('0x30')][_0x3aa3('0x31')]};});_0x324e27[_0x3aa3('0x32')]=_[_0x3aa3('0x2d')](_0x319202,'name');_0x324e27[_0x3aa3('0x33')]=_[_0x3aa3('0x34')](_0x5eafaf[_0x3aa3('0x33')]);_0x324e27['filters']=_[_0x3aa3('0x35')](_0x324e27['model'],_0x324e27[_0x3aa3('0x33')]);_0x247080[_0x3aa3('0x36')]=_[_0x3aa3('0x35')](_0x324e27['model'],qs['fields'](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x37')]));_0x247080[_0x3aa3('0x36')]=_0x247080[_0x3aa3('0x36')]['length']?_0x247080[_0x3aa3('0x36')]:_0x324e27[_0x3aa3('0x32')];if(!_0x5eafaf[_0x3aa3('0x33')]['hasOwnProperty'](_0x3aa3('0x38'))){_0x247080['limit']=qs[_0x3aa3('0x1b')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x1b')]);_0x247080[_0x3aa3('0x19')]=qs[_0x3aa3('0x19')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x19')]);}_0x247080[_0x3aa3('0x39')]=qs[_0x3aa3('0x3a')](_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x3a')]);_0x247080[_0x3aa3('0x3b')]=qs[_0x3aa3('0x3c')](_[_0x3aa3('0x3d')](_0x5eafaf[_0x3aa3('0x33')],_0x324e27[_0x3aa3('0x3c')]),_0x319202);if(_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x3e')]){_0x247080[_0x3aa3('0x3b')]=_[_0x3aa3('0x3f')](_0x247080[_0x3aa3('0x3b')],{'$or':_[_0x3aa3('0x2d')](_0x319202,function(_0x2e7400){if(_0x2e7400[_0x3aa3('0x30')]!=='VIRTUAL'){var _0x4f1f8f={};_0x4f1f8f[_0x2e7400[_0x3aa3('0x2a')]]={'$like':'%'+_0x5eafaf[_0x3aa3('0x33')]['filter']+'%'};return _0x4f1f8f;}})});}_0x247080=_[_0x3aa3('0x3f')]({},_0x247080,_0x5eafaf[_0x3aa3('0x40')]);var _0x46279e={'where':_0x247080[_0x3aa3('0x3b')]};return db[_0x3aa3('0x2e')]['count'](_0x46279e)[_0x3aa3('0x24')](function(_0x1096fe){_0x2a05af['count']=_0x1096fe;if(_0x5eafaf[_0x3aa3('0x33')][_0x3aa3('0x41')]){_0x247080[_0x3aa3('0x42')]=[{'all':!![]}];}return db[_0x3aa3('0x2e')][_0x3aa3('0x43')](_0x247080);})[_0x3aa3('0x24')](function(_0x27949a){_0x2a05af[_0x3aa3('0x44')]=_0x27949a;return _0x2a05af;})[_0x3aa3('0x24')](respondWithFilteredResult(_0x32eeb9,_0x247080))[_0x3aa3('0x45')](handleError(_0x32eeb9,null));};exports['show']=function(_0x208735,_0x5924b5){var _0x396c0d={'raw':!![],'where':{'id':_0x208735[_0x3aa3('0x46')]['id']}},_0x297a09={};_0x297a09[_0x3aa3('0x32')]=_[_0x3aa3('0x34')](db[_0x3aa3('0x2e')]['rawAttributes']);_0x297a09[_0x3aa3('0x33')]=_['keys'](_0x208735[_0x3aa3('0x33')]);_0x297a09[_0x3aa3('0x3c')]=_['intersection'](_0x297a09['model'],_0x297a09[_0x3aa3('0x33')]);_0x396c0d[_0x3aa3('0x36')]=_[_0x3aa3('0x35')](_0x297a09['model'],qs[_0x3aa3('0x37')](_0x208735[_0x3aa3('0x33')][_0x3aa3('0x37')]));_0x396c0d[_0x3aa3('0x36')]=_0x396c0d[_0x3aa3('0x36')][_0x3aa3('0x47')]?_0x396c0d['attributes']:_0x297a09[_0x3aa3('0x32')];if(_0x208735[_0x3aa3('0x33')]['includeAll']){_0x396c0d[_0x3aa3('0x42')]=[{'all':!![]}];}_0x396c0d=_['merge']({},_0x396c0d,_0x208735[_0x3aa3('0x40')]);return db[_0x3aa3('0x2e')][_0x3aa3('0x48')](_0x396c0d)[_0x3aa3('0x24')](handleEntityNotFound(_0x5924b5,null))[_0x3aa3('0x24')](respondWithResult(_0x5924b5,null))[_0x3aa3('0x45')](handleError(_0x5924b5,null));};exports[_0x3aa3('0x49')]=function(_0x75d1ed,_0x13add2){return db['Variable'][_0x3aa3('0x49')](_0x75d1ed['body'],{})[_0x3aa3('0x24')](function(_0x55a0e0){var _0x159d68=_0x75d1ed[_0x3aa3('0x4a')][_0x3aa3('0x25')]({'plain':!![]});if(!_0x159d68)throw new Error(_0x3aa3('0x4b'));if(_0x159d68[_0x3aa3('0x4c')]===_0x3aa3('0x4a')){var _0x55a4ef=_0x55a0e0[_0x3aa3('0x25')]({'plain':!![]});var _0x371236=_0x3aa3('0x26');return db[_0x3aa3('0x4d')][_0x3aa3('0x48')]({'where':{'name':_0x371236,'userProfileId':_0x159d68[_0x3aa3('0x4e')]},'raw':!![]})['then'](function(_0x1c3087){if(_0x1c3087&&_0x1c3087[_0x3aa3('0x4f')]===0x0){return db[_0x3aa3('0x27')][_0x3aa3('0x49')]({'name':_0x55a4ef[_0x3aa3('0x2a')],'resourceId':_0x55a4ef['id'],'type':_0x1c3087[_0x3aa3('0x2a')],'sectionId':_0x1c3087['id']},{})['then'](function(){return _0x55a0e0;});}else{return _0x55a0e0;}})[_0x3aa3('0x45')](function(_0x528830){logger[_0x3aa3('0x28')](_0x3aa3('0x50'),_0x528830);throw _0x528830;});}return _0x55a0e0;})[_0x3aa3('0x24')](respondWithResult(_0x13add2,0xc9))[_0x3aa3('0x45')](handleError(_0x13add2,null));};exports[_0x3aa3('0x22')]=function(_0x23912d,_0x50121d){if(_0x23912d[_0x3aa3('0x51')]['id']){delete _0x23912d['body']['id'];}return db[_0x3aa3('0x2e')]['find']({'where':{'id':_0x23912d[_0x3aa3('0x46')]['id']}})[_0x3aa3('0x24')](handleEntityNotFound(_0x50121d,null))[_0x3aa3('0x24')](saveUpdates(_0x23912d[_0x3aa3('0x51')],null))[_0x3aa3('0x24')](respondWithResult(_0x50121d,null))['catch'](handleError(_0x50121d,null));};exports[_0x3aa3('0x23')]=function(_0x3f4aa9,_0x5e2f0e){return db[_0x3aa3('0x2e')][_0x3aa3('0x48')]({'where':{'id':_0x3f4aa9['params']['id']}})[_0x3aa3('0x24')](handleEntityNotFound(_0x5e2f0e,null))['then'](removeEntity(_0x5e2f0e,null))['catch'](handleError(_0x5e2f0e,null));}; \ No newline at end of file +var _0x8e1b=['querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','get','Variables','error','name','send','Variable','rawAttributes','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x43f7ed,_0x527b08){var _0x24c9de=function(_0x4c215f){while(--_0x4c215f){_0x43f7ed['push'](_0x43f7ed['shift']());}};_0x24c9de(++_0x527b08);}(_0x8e1b,0x90));var _0xb8e1=function(_0x4bdd13,_0x645ddb){_0x4bdd13=_0x4bdd13-0x0;var _0x3ca85e=_0x8e1b[_0x4bdd13];return _0x3ca85e;};'use strict';var emlformat=require(_0xb8e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8e1('0x1'));var jsonpatch=require(_0xb8e1('0x2'));var rp=require('request-promise');var moment=require(_0xb8e1('0x3'));var BPromise=require(_0xb8e1('0x4'));var Mustache=require('mustache');var util=require(_0xb8e1('0x5'));var path=require(_0xb8e1('0x6'));var sox=require('sox');var csv=require(_0xb8e1('0x7'));var ejs=require(_0xb8e1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8e1('0x9'));var squel=require(_0xb8e1('0xa'));var crypto=require(_0xb8e1('0xb'));var jsforce=require(_0xb8e1('0xc'));var deskjs=require(_0xb8e1('0xd'));var toCsv=require(_0xb8e1('0x7'));var querystring=require(_0xb8e1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb8e1('0xf'));var qs=require(_0xb8e1('0x10'));var as=require(_0xb8e1('0x11'));var hardwareService=require(_0xb8e1('0x12'));var logger=require(_0xb8e1('0x13'))(_0xb8e1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb8e1('0x15'));var db=require(_0xb8e1('0x16'))['db'];function respondWithStatusCode(_0x400e5e,_0x325c43){_0x325c43=_0x325c43||0xcc;return function(_0x196633){if(_0x196633){return _0x400e5e[_0xb8e1('0x17')](_0x325c43);}return _0x400e5e[_0xb8e1('0x18')](_0x325c43)[_0xb8e1('0x19')]();};}function respondWithResult(_0x3ee0de,_0xcc72ce){_0xcc72ce=_0xcc72ce||0xc8;return function(_0x250396){if(_0x250396){return _0x3ee0de['status'](_0xcc72ce)[_0xb8e1('0x1a')](_0x250396);}};}function respondWithFilteredResult(_0x3e2bb5,_0xd7376f){return function(_0x1a01d8){if(_0x1a01d8){var _0x4a8854=typeof _0xd7376f['offset']===_0xb8e1('0x1b')&&typeof _0xd7376f[_0xb8e1('0x1c')]===_0xb8e1('0x1b');var _0x3f7a8d=_0x1a01d8['count'];var _0x168d5f=_0x4a8854?0x0:_0xd7376f[_0xb8e1('0x1d')];var _0x481aa7=_0x4a8854?_0x1a01d8[_0xb8e1('0x1e')]:_0xd7376f[_0xb8e1('0x1d')]+_0xd7376f[_0xb8e1('0x1c')];var _0x1ff7eb;if(_0x481aa7>=_0x3f7a8d){_0x481aa7=_0x3f7a8d;_0x1ff7eb=0xc8;}else{_0x1ff7eb=0xce;}_0x3e2bb5[_0xb8e1('0x18')](_0x1ff7eb);return _0x3e2bb5[_0xb8e1('0x1f')](_0xb8e1('0x20'),_0x168d5f+'-'+_0x481aa7+'/'+_0x3f7a8d)['json'](_0x1a01d8);}return null;};}function patchUpdates(_0x1a0222){return function(_0xa8f25){try{jsonpatch[_0xb8e1('0x21')](_0xa8f25,_0x1a0222,!![]);}catch(_0x535a9e){return BPromise['reject'](_0x535a9e);}return _0xa8f25[_0xb8e1('0x22')]();};}function saveUpdates(_0x578b58,_0x1f30d4){return function(_0x573046){if(_0x573046){return _0x573046['update'](_0x578b58)[_0xb8e1('0x23')](function(_0x1e67ba){return _0x1e67ba;});}return null;};}function removeEntity(_0x53067e,_0x242ae5){return function(_0x401ee6){if(_0x401ee6){return _0x401ee6[_0xb8e1('0x24')]()[_0xb8e1('0x23')](function(){var _0x4054c8=_0x401ee6[_0xb8e1('0x25')]({'plain':!![]});var _0x5ac997=_0xb8e1('0x26');return db['UserProfileResource'][_0xb8e1('0x24')]({'where':{'type':_0x5ac997,'resourceId':_0x4054c8['id']}})[_0xb8e1('0x23')](function(){return _0x401ee6;});})[_0xb8e1('0x23')](function(){_0x53067e[_0xb8e1('0x18')](0xcc)[_0xb8e1('0x19')]();});}};}function handleEntityNotFound(_0x3062ca,_0x24cee2){return function(_0x491241){if(!_0x491241){_0x3062ca[_0xb8e1('0x17')](0x194);}return _0x491241;};}function handleError(_0x6578f8,_0x2d0b33){_0x2d0b33=_0x2d0b33||0x1f4;return function(_0x414aec){logger[_0xb8e1('0x27')](_0x414aec['stack']);if(_0x414aec[_0xb8e1('0x28')]){delete _0x414aec['name'];}_0x6578f8[_0xb8e1('0x18')](_0x2d0b33)[_0xb8e1('0x29')](_0x414aec);};}exports['index']=function(_0x53c85d,_0x31175c){var _0x9b7374={},_0x15168d={},_0x14ccf1={'count':0x0,'rows':[]};var _0x18c03c=_['map'](db[_0xb8e1('0x2a')][_0xb8e1('0x2b')],function(_0x377f24){return{'name':_0x377f24['fieldName'],'type':_0x377f24['type'][_0xb8e1('0x2c')]};});_0x15168d['model']=_[_0xb8e1('0x2d')](_0x18c03c,_0xb8e1('0x28'));_0x15168d[_0xb8e1('0x2e')]=_[_0xb8e1('0x2f')](_0x53c85d['query']);_0x15168d['filters']=_[_0xb8e1('0x30')](_0x15168d[_0xb8e1('0x31')],_0x15168d['query']);_0x9b7374[_0xb8e1('0x32')]=_[_0xb8e1('0x30')](_0x15168d[_0xb8e1('0x31')],qs[_0xb8e1('0x33')](_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x33')]));_0x9b7374[_0xb8e1('0x32')]=_0x9b7374[_0xb8e1('0x32')][_0xb8e1('0x34')]?_0x9b7374[_0xb8e1('0x32')]:_0x15168d[_0xb8e1('0x31')];if(!_0x53c85d['query'][_0xb8e1('0x35')](_0xb8e1('0x36'))){_0x9b7374[_0xb8e1('0x1c')]=qs[_0xb8e1('0x1c')](_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x1c')]);_0x9b7374['offset']=qs[_0xb8e1('0x1d')](_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x1d')]);}_0x9b7374[_0xb8e1('0x37')]=qs[_0xb8e1('0x38')](_0x53c85d[_0xb8e1('0x2e')]['sort']);_0x9b7374[_0xb8e1('0x39')]=qs[_0xb8e1('0x3a')](_[_0xb8e1('0x3b')](_0x53c85d['query'],_0x15168d[_0xb8e1('0x3a')]),_0x18c03c);if(_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x3c')]){_0x9b7374[_0xb8e1('0x39')]=_[_0xb8e1('0x3d')](_0x9b7374['where'],{'$or':_['map'](_0x18c03c,function(_0x4b617d){if(_0x4b617d[_0xb8e1('0x3e')]!==_0xb8e1('0x3f')){var _0x5ba653={};_0x5ba653[_0x4b617d['name']]={'$like':'%'+_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x3c')]+'%'};return _0x5ba653;}})});}_0x9b7374=_[_0xb8e1('0x3d')]({},_0x9b7374,_0x53c85d[_0xb8e1('0x40')]);var _0x59c761={'where':_0x9b7374[_0xb8e1('0x39')]};return db['Variable'][_0xb8e1('0x1e')](_0x59c761)[_0xb8e1('0x23')](function(_0x117f78){_0x14ccf1['count']=_0x117f78;if(_0x53c85d[_0xb8e1('0x2e')][_0xb8e1('0x41')]){_0x9b7374[_0xb8e1('0x42')]=[{'all':!![]}];}return db[_0xb8e1('0x2a')]['findAll'](_0x9b7374);})[_0xb8e1('0x23')](function(_0x31b3a9){_0x14ccf1[_0xb8e1('0x43')]=_0x31b3a9;return _0x14ccf1;})['then'](respondWithFilteredResult(_0x31175c,_0x9b7374))[_0xb8e1('0x44')](handleError(_0x31175c,null));};exports['show']=function(_0x3ac593,_0x5bc71e){var _0x29f70c={'raw':!![],'where':{'id':_0x3ac593['params']['id']}},_0x22094c={};_0x22094c['model']=_[_0xb8e1('0x2f')](db[_0xb8e1('0x2a')]['rawAttributes']);_0x22094c[_0xb8e1('0x2e')]=_[_0xb8e1('0x2f')](_0x3ac593[_0xb8e1('0x2e')]);_0x22094c[_0xb8e1('0x3a')]=_[_0xb8e1('0x30')](_0x22094c['model'],_0x22094c['query']);_0x29f70c['attributes']=_[_0xb8e1('0x30')](_0x22094c[_0xb8e1('0x31')],qs[_0xb8e1('0x33')](_0x3ac593['query'][_0xb8e1('0x33')]));_0x29f70c[_0xb8e1('0x32')]=_0x29f70c[_0xb8e1('0x32')][_0xb8e1('0x34')]?_0x29f70c[_0xb8e1('0x32')]:_0x22094c[_0xb8e1('0x31')];if(_0x3ac593[_0xb8e1('0x2e')]['includeAll']){_0x29f70c[_0xb8e1('0x42')]=[{'all':!![]}];}_0x29f70c=_[_0xb8e1('0x3d')]({},_0x29f70c,_0x3ac593['options']);return db['Variable'][_0xb8e1('0x45')](_0x29f70c)[_0xb8e1('0x23')](handleEntityNotFound(_0x5bc71e,null))[_0xb8e1('0x23')](respondWithResult(_0x5bc71e,null))['catch'](handleError(_0x5bc71e,null));};exports[_0xb8e1('0x46')]=function(_0x3c7322,_0xa1468c){return db[_0xb8e1('0x2a')]['create'](_0x3c7322['body'],{})['then'](function(_0x5f32e8){var _0x47df76=_0x3c7322[_0xb8e1('0x47')][_0xb8e1('0x25')]({'plain':!![]});if(!_0x47df76)throw new Error(_0xb8e1('0x48'));if(_0x47df76[_0xb8e1('0x49')]==='user'){var _0x1b9165=_0x5f32e8[_0xb8e1('0x25')]({'plain':!![]});var _0x219408=_0xb8e1('0x26');return db[_0xb8e1('0x4a')][_0xb8e1('0x45')]({'where':{'name':_0x219408,'userProfileId':_0x47df76[_0xb8e1('0x4b')]},'raw':!![]})[_0xb8e1('0x23')](function(_0x457644){if(_0x457644&&_0x457644['autoAssociation']===0x0){return db['UserProfileResource'][_0xb8e1('0x46')]({'name':_0x1b9165[_0xb8e1('0x28')],'resourceId':_0x1b9165['id'],'type':_0x457644[_0xb8e1('0x28')],'sectionId':_0x457644['id']},{})[_0xb8e1('0x23')](function(){return _0x5f32e8;});}else{return _0x5f32e8;}})[_0xb8e1('0x44')](function(_0x154ac5){logger[_0xb8e1('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x154ac5);throw _0x154ac5;});}return _0x5f32e8;})[_0xb8e1('0x23')](respondWithResult(_0xa1468c,0xc9))[_0xb8e1('0x44')](handleError(_0xa1468c,null));};exports[_0xb8e1('0x4c')]=function(_0x268c57,_0x4d0236){if(_0x268c57[_0xb8e1('0x4d')]['id']){delete _0x268c57[_0xb8e1('0x4d')]['id'];}return db[_0xb8e1('0x2a')][_0xb8e1('0x45')]({'where':{'id':_0x268c57[_0xb8e1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d0236,null))[_0xb8e1('0x23')](saveUpdates(_0x268c57[_0xb8e1('0x4d')],null))[_0xb8e1('0x23')](respondWithResult(_0x4d0236,null))[_0xb8e1('0x44')](handleError(_0x4d0236,null));};exports[_0xb8e1('0x24')]=function(_0x5aaa63,_0x330801){return db['Variable'][_0xb8e1('0x45')]({'where':{'id':_0x5aaa63[_0xb8e1('0x4e')]['id']}})[_0xb8e1('0x23')](handleEntityNotFound(_0x330801,null))[_0xb8e1('0x23')](removeEntity(_0x330801,null))[_0xb8e1('0x44')](handleError(_0x330801,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0cf1a3d..c2b8737 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 _0x7bd7=['exports','define','Variable','tools_variables','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./variable.attributes'];(function(_0x2c4ac7,_0x448e8c){var _0x5e0b27=function(_0x223edc){while(--_0x223edc){_0x2c4ac7['push'](_0x2c4ac7['shift']());}};_0x5e0b27(++_0x448e8c);}(_0x7bd7,0x7d));var _0x77bd=function(_0x22b788,_0x476d0e){_0x22b788=_0x22b788-0x0;var _0x171d02=_0x7bd7[_0x22b788];return _0x171d02;};'use strict';var _=require('lodash');var util=require(_0x77bd('0x0'));var logger=require(_0x77bd('0x1'))(_0x77bd('0x2'));var moment=require('moment');var BPromise=require(_0x77bd('0x3'));var rp=require(_0x77bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x77bd('0x5'));var attributes=require(_0x77bd('0x6'));module[_0x77bd('0x7')]=function(_0xee565b,_0x47bda6){return _0xee565b[_0x77bd('0x8')](_0x77bd('0x9'),attributes,{'tableName':_0x77bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9be8=['exports','Variable','lodash','../../config/logger','moment','request-promise','path','rimraf','./variable.attributes'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x9be8,0x16a));var _0x89be=function(_0x111692,_0x19f8a9){_0x111692=_0x111692-0x0;var _0x11836f=_0x9be8[_0x111692];return _0x11836f;};'use strict';var _=require(_0x89be('0x0'));var util=require('util');var logger=require(_0x89be('0x1'))('api');var moment=require(_0x89be('0x2'));var BPromise=require('bluebird');var rp=require(_0x89be('0x3'));var fs=require('fs');var path=require(_0x89be('0x4'));var rimraf=require(_0x89be('0x5'));var config=require('../../config/environment');var attributes=require(_0x89be('0x6'));module[_0x89be('0x7')]=function(_0x10b979,_0x45669f){return _0x10b979['define'](_0x89be('0x8'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 59b1822..8630eaa 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(_0x2f036c,_0x136898){var _0x496781=function(_0x11ffaf){while(--_0x11ffaf){_0x2f036c['push'](_0x2f036c['shift']());}};_0x496781(++_0x136898);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3601f2,_0x34af7a){_0x3601f2=_0x3601f2-0x0;var _0xb360a3=_0x7fbe[_0x3601f2];return _0xb360a3;};'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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x5a6e7b,_0x3dabdc){var _0x5bef75=function(_0x2fa93b){while(--_0x2fa93b){_0x5a6e7b['push'](_0x5a6e7b['shift']());}};_0x5bef75(++_0x3dabdc);}(_0x55ca,0x126));var _0xa55c=function(_0x3a3a6a,_0x5eb6a9){_0x3a3a6a=_0x3a3a6a-0x0;var _0xa89294=_0x55ca[_0x3a3a6a];return _0xa89294;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 2702b08..f937f4e 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 _0x0305=['/pull','pull','restart','/migrations','express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x56bb91,_0x57108e){var _0x302fc0=function(_0x144c88){while(--_0x144c88){_0x56bb91['push'](_0x56bb91['shift']());}};_0x302fc0(++_0x57108e);}(_0x0305,0x146));var _0x5030=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x0305[_0x1d558c];return _0x15767d;};'use strict';var express=require(_0x5030('0x0'));var router=express[_0x5030('0x1')]();var auth=require(_0x5030('0x2'));var controller=require('./version.controller');router[_0x5030('0x3')]('/',controller[_0x5030('0x4')]);router[_0x5030('0x3')](_0x5030('0x5'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller['fetch']);router[_0x5030('0x3')](_0x5030('0x8'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller[_0x5030('0x9')]);router[_0x5030('0x3')](_0x5030('0xa'),auth[_0x5030('0x6')](),auth[_0x5030('0x7')](),controller[_0x5030('0xb')]);router['get']('/restart',auth[_0x5030('0x6')](),controller[_0x5030('0xc')]);router['get'](_0x5030('0xd'),controller['migrations']);module['exports']=router; \ No newline at end of file +var _0x7639=['exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','restart','/migrations','migrations'];(function(_0x311ae7,_0x14a755){var _0x409b7d=function(_0x4b45c6){while(--_0x4b45c6){_0x311ae7['push'](_0x311ae7['shift']());}};_0x409b7d(++_0x14a755);}(_0x7639,0x89));var _0x9763=function(_0x3364cc,_0x3ab3fe){_0x3364cc=_0x3364cc-0x0;var _0x59053c=_0x7639[_0x3364cc];return _0x59053c;};'use strict';var express=require('express');var router=express[_0x9763('0x0')]();var auth=require(_0x9763('0x1'));var controller=require(_0x9763('0x2'));router[_0x9763('0x3')]('/',controller[_0x9763('0x4')]);router['get'](_0x9763('0x5'),auth[_0x9763('0x6')](),auth['canUpdate'](),controller[_0x9763('0x7')]);router[_0x9763('0x3')](_0x9763('0x8'),auth[_0x9763('0x6')](),auth[_0x9763('0x9')](),controller[_0x9763('0xa')]);router[_0x9763('0x3')](_0x9763('0xb'),auth[_0x9763('0x6')](),auth[_0x9763('0x9')](),controller[_0x9763('0xc')]);router[_0x9763('0x3')]('/restart',auth[_0x9763('0x6')](),controller[_0x9763('0xd')]);router[_0x9763('0x3')](_0x9763('0xe'),controller[_0x9763('0xf')]);module[_0x9763('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 033e4fb..a28a981 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 _0x8752=['root','server','migrations','length','replace','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','query','tags','latest','exports','2.0.0','status','json','fetch','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join'];(function(_0x117eff,_0x60754e){var _0x2d3f43=function(_0x2cd12a){while(--_0x2cd12a){_0x117eff['push'](_0x117eff['shift']());}};_0x2d3f43(++_0x60754e);}(_0x8752,0x7b));var _0x2875=function(_0x209846,_0xa89356){_0x209846=_0x209846-0x0;var _0x38c236=_0x8752[_0x209846];return _0x38c236;};'use strict';var Umzug=require(_0x2875('0x0'));var path=require(_0x2875('0x1'));var fs=require('fs');var _=require(_0x2875('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x2875('0x3'));var exec=require(_0x2875('0x4'))[_0x2875('0x5')];var db=require(_0x2875('0x6'))['db'];var config=require(_0x2875('0x7'));var pm2=require(_0x2875('0x8'));var logger=require(_0x2875('0x9'))(_0x2875('0xa'));var git=require(_0x2875('0xb'))(config['root']);exports[_0x2875('0xc')]=function(_0x55bf20,_0x2f2d99){var _0x354156={'current':module['exports'][_0x2875('0xd')],'phonebar':0x2};if(_0x55bf20['query']&&_0x55bf20[_0x2875('0xe')]['latest']){return git['fetch']()[_0x2875('0xf')](function(_0x570a9d,_0xb49cb){_0x354156[_0x2875('0x10')]=(_0x570a9d?module[_0x2875('0x11')]['version']:_0xb49cb[_0x2875('0x10')])||_0x2875('0x12');return _0x2f2d99['status'](0xc8)['json'](_0x354156);});}else{return _0x2f2d99[_0x2875('0x13')](0xc8)[_0x2875('0x14')](_0x354156);}};exports[_0x2875('0x15')]=function(_0x55e093,_0x48168a){return git[_0x2875('0x15')](['origin',_0x2875('0x16')],function(_0xb2158f){if(_0xb2158f){logger[_0x2875('0x17')](_0xb2158f);return _0x48168a[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0xb2158f);}logger[_0x2875('0x18')](_0x2875('0x19'));return _0x48168a['status'](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x1a')});});};exports['reset']=function(_0x17f472,_0x25e6a8){return git[_0x2875('0x1b')]([_0x2875('0x1c'),'FETCH_HEAD'],function(_0x5c29ca){if(_0x5c29ca){logger[_0x2875('0x17')](_0x5c29ca);return _0x25e6a8[_0x2875('0x13')](0x1f4)['json'](_0x5c29ca);}logger[_0x2875('0x18')](_0x2875('0x1d'));return _0x25e6a8[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':'git\x20reset\x20--hard'});});};exports[_0x2875('0x1e')]=function(_0x52c607,_0xca6ad7){exec('npm\x20install\x20--production',function(_0x23ac82,_0x264e70,_0x17f62c){logger[_0x2875('0x18')](_0x264e70);logger[_0x2875('0x18')](_0x17f62c);if(_0x23ac82){logger[_0x2875('0x17')](_0x23ac82);return _0xca6ad7[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0x23ac82);}return _0xca6ad7[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x264e70});});};exports[_0x2875('0x1f')]=function(_0x21bcc3,_0x5eaa37){return pm2['restart'](_0x2875('0x20'))[_0x2875('0x21')](function(_0x30da24){logger[_0x2875('0x18')](_0x2875('0x22'),_0x30da24);return _0x5eaa37['status'](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x23')});})[_0x2875('0x24')](function(_0x808c72){logger[_0x2875('0x17')](_0x808c72);return _0x5eaa37['status'](0x1f4)[_0x2875('0x14')](_0x808c72);});};exports['migrations']=function(_0x39e04f,_0x3baa8e){var _0x21cfb5=fs[_0x2875('0x25')](path[_0x2875('0x26')](config[_0x2875('0x27')],_0x2875('0x28'),_0x2875('0x29')));var _0x3a30de=[];for(var _0x361463=0x0;_0x361463<_0x21cfb5[_0x2875('0x2a')];_0x361463++){var _0x122036=_0x21cfb5[_0x361463][_0x2875('0x2b')]('.js','');if(compareVersions(module[_0x2875('0x11')][_0x2875('0xd')],_0x122036)===-0x1){_0x3a30de['push'](_0x122036);}}if(_0x3a30de[_0x2875('0x2a')]){var _0x2b34b9=_0x3a30de[_0x2875('0x2c')](compareVersions);var _0x5cfdcc=new Umzug({'storage':_0x2875('0x2d'),'storageOptions':{'model':db[_0x2875('0x2e')],'modelName':_0x2875('0x2e'),'columnName':_0x2875('0xd')},'migrations':{'params':[db[_0x2875('0x2d')][_0x2875('0x2f')](),db[_0x2875('0x2d')][_0x2875('0x30')],function(){throw new Error(_0x2875('0x31'));}],'path':path[_0x2875('0x26')](config[_0x2875('0x27')],_0x2875('0x28'),_0x2875('0x29')),'pattern':/\.js$/}});_0x5cfdcc['up']({'migrations':_['map'](_0x2b34b9,function(_0x3f7bc4){return _0x3f7bc4+'.js';})})[_0x2875('0x21')](function(){return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x32')+module['exports']['version']+'\x20to\x20'+_[_0x2875('0x33')](_0x2b34b9),'migrations':_[_0x2875('0x26')](_0x2b34b9)});})[_0x2875('0x24')](function(_0x42a1a9){if(_0x42a1a9 instanceof db[_0x2875('0x2d')][_0x2875('0x34')]){return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3baa8e[_0x2875('0x13')](0x1f4)[_0x2875('0x14')](_0x42a1a9);}});}else{return _0x3baa8e[_0x2875('0x13')](0xc8)[_0x2875('0x14')]({'output':_0x2875('0x35')});}}; \ No newline at end of file +var _0x1f80=['sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','version','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','migrations','join','server','replace','.js'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0x1f80,0x1e1));var _0x01f8=function(_0x37d4f2,_0x160d5b){_0x37d4f2=_0x37d4f2-0x0;var _0x572e89=_0x1f80[_0x37d4f2];return _0x572e89;};'use strict';var Umzug=require('umzug');var path=require(_0x01f8('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x01f8('0x1'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x01f8('0x2'))[_0x01f8('0x3')];var db=require(_0x01f8('0x4'))['db'];var config=require('../../config/environment');var pm2=require(_0x01f8('0x5'));var logger=require(_0x01f8('0x6'))(_0x01f8('0x7'));var git=require(_0x01f8('0x8'))(config[_0x01f8('0x9')]);exports[_0x01f8('0xa')]=function(_0x5c5e86,_0x1def14){var _0x35f355={'current':module[_0x01f8('0xb')]['version'],'phonebar':0x2};if(_0x5c5e86['query']&&_0x5c5e86[_0x01f8('0xc')][_0x01f8('0xd')]){return git[_0x01f8('0xe')]()['tags'](function(_0x1fdbd7,_0x447a38){_0x35f355[_0x01f8('0xd')]=(_0x1fdbd7?module[_0x01f8('0xb')][_0x01f8('0xf')]:_0x447a38[_0x01f8('0xd')])||'2.0.0';return _0x1def14[_0x01f8('0x10')](0xc8)['json'](_0x35f355);});}else{return _0x1def14[_0x01f8('0x10')](0xc8)[_0x01f8('0x11')](_0x35f355);}};exports[_0x01f8('0xe')]=function(_0x1eccf8,_0x171f73){return git['fetch'](['origin',_0x01f8('0x12')],function(_0x5a0d1d){if(_0x5a0d1d){logger[_0x01f8('0x13')](_0x5a0d1d);return _0x171f73[_0x01f8('0x10')](0x1f4)[_0x01f8('0x11')](_0x5a0d1d);}logger[_0x01f8('0x14')](_0x01f8('0x15'));return _0x171f73[_0x01f8('0x10')](0xc8)[_0x01f8('0x11')]({'output':_0x01f8('0x16')});});};exports[_0x01f8('0x17')]=function(_0xedf545,_0x33d8eb){return git['reset']([_0x01f8('0x18'),_0x01f8('0x19')],function(_0x59a775){if(_0x59a775){logger[_0x01f8('0x13')](_0x59a775);return _0x33d8eb['status'](0x1f4)[_0x01f8('0x11')](_0x59a775);}logger[_0x01f8('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x33d8eb[_0x01f8('0x10')](0xc8)['json']({'output':_0x01f8('0x1a')});});};exports[_0x01f8('0x1b')]=function(_0x3f1aa9,_0x47000d){exec(_0x01f8('0x1c'),function(_0x117a6d,_0x67877c,_0x4e98b6){logger[_0x01f8('0x14')](_0x67877c);logger['info'](_0x4e98b6);if(_0x117a6d){logger[_0x01f8('0x13')](_0x117a6d);return _0x47000d[_0x01f8('0x10')](0x1f4)[_0x01f8('0x11')](_0x117a6d);}return _0x47000d['status'](0xc8)['json']({'output':_0x67877c});});};exports[_0x01f8('0x1d')]=function(_0x2f130b,_0x33b2e0){return pm2[_0x01f8('0x1d')]('motion2')[_0x01f8('0x1e')](function(_0x1f850f){logger[_0x01f8('0x14')]('pm2\x20restart\x20motion\x20%s',_0x1f850f);return _0x33b2e0['status'](0xc8)[_0x01f8('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x53ca06){logger['error'](_0x53ca06);return _0x33b2e0[_0x01f8('0x10')](0x1f4)[_0x01f8('0x11')](_0x53ca06);});};exports[_0x01f8('0x1f')]=function(_0xbde4db,_0x2a090e){var _0x167064=fs['readdirSync'](path[_0x01f8('0x20')](config[_0x01f8('0x9')],_0x01f8('0x21'),_0x01f8('0x1f')));var _0x571ec3=[];for(var _0x51fe61=0x0;_0x51fe61<_0x167064['length'];_0x51fe61++){var _0x4fdc63=_0x167064[_0x51fe61][_0x01f8('0x22')](_0x01f8('0x23'),'');if(compareVersions(module['exports'][_0x01f8('0xf')],_0x4fdc63)===-0x1){_0x571ec3['push'](_0x4fdc63);}}if(_0x571ec3['length']){var _0x15c5b7=_0x571ec3[_0x01f8('0x24')](compareVersions);var _0x20ed74=new Umzug({'storage':_0x01f8('0x25'),'storageOptions':{'model':db[_0x01f8('0x26')],'modelName':_0x01f8('0x26'),'columnName':_0x01f8('0xf')},'migrations':{'params':[db[_0x01f8('0x25')][_0x01f8('0x27')](),db['sequelize'][_0x01f8('0x28')],function(){throw new Error(_0x01f8('0x29'));}],'path':path[_0x01f8('0x20')](config['root'],'server',_0x01f8('0x1f')),'pattern':/\.js$/}});_0x20ed74['up']({'migrations':_['map'](_0x15c5b7,function(_0x305402){return _0x305402+_0x01f8('0x23');})})[_0x01f8('0x1e')](function(){return _0x2a090e['status'](0xc8)['json']({'output':_0x01f8('0x2a')+module['exports'][_0x01f8('0xf')]+_0x01f8('0x2b')+_['last'](_0x15c5b7),'migrations':_[_0x01f8('0x20')](_0x15c5b7)});})[_0x01f8('0x2c')](function(_0x181970){if(_0x181970 instanceof db[_0x01f8('0x25')][_0x01f8('0x2d')]){return _0x2a090e[_0x01f8('0x10')](0xc8)[_0x01f8('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2a090e['status'](0x1f4)[_0x01f8('0x11')](_0x181970);}});}else{return _0x2a090e[_0x01f8('0x10')](0xc8)['json']({'output':_0x01f8('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 108230d..e7c4995 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 _0xd8fd=['put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3f73bb,_0x5254a2){var _0x2dcc50=function(_0x467cd5){while(--_0x467cd5){_0x3f73bb['push'](_0x3f73bb['shift']());}};_0x2dcc50(++_0x5254a2);}(_0xd8fd,0x16c));var _0xdd8f=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xd8fd[_0x35af23];return _0x340506;};'use strict';var multer=require(_0xdd8f('0x0'));var util=require(_0xdd8f('0x1'));var path=require('path');var timeout=require(_0xdd8f('0x2'));var express=require(_0xdd8f('0x3'));var router=express[_0xdd8f('0x4')]();var fs_extra=require(_0xdd8f('0x5'));var auth=require(_0xdd8f('0x6'));var interaction=require(_0xdd8f('0x7'));var config=require(_0xdd8f('0x8'));var controller=require(_0xdd8f('0x9'));router[_0xdd8f('0xa')]('/',auth[_0xdd8f('0xb')](),controller['index']);router[_0xdd8f('0xa')](_0xdd8f('0xc'),auth['isAuthenticated'](),controller[_0xdd8f('0xd')]);router[_0xdd8f('0xa')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller[_0xdd8f('0xf')]);router['post']('/',auth[_0xdd8f('0xb')](),controller['create']);router[_0xdd8f('0x10')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller['update']);router[_0xdd8f('0x11')](_0xdd8f('0xe'),auth[_0xdd8f('0xb')](),controller[_0xdd8f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb449=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x622933,_0x223217){var _0xd7ff71=function(_0x49d246){while(--_0x49d246){_0x622933['push'](_0x622933['shift']());}};_0xd7ff71(++_0x223217);}(_0xb449,0xf3));var _0x9b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb449[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9b44('0x0'));var util=require(_0x9b44('0x1'));var path=require(_0x9b44('0x2'));var timeout=require(_0x9b44('0x3'));var express=require('express');var router=express[_0x9b44('0x4')]();var fs_extra=require(_0x9b44('0x5'));var auth=require(_0x9b44('0x6'));var interaction=require(_0x9b44('0x7'));var config=require(_0x9b44('0x8'));var controller=require(_0x9b44('0x9'));router[_0x9b44('0xa')]('/',auth[_0x9b44('0xb')](),controller[_0x9b44('0xc')]);router[_0x9b44('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9b44('0xd'),auth['isAuthenticated'](),controller[_0x9b44('0xe')]);router[_0x9b44('0xf')]('/',auth[_0x9b44('0xb')](),controller[_0x9b44('0x10')]);router[_0x9b44('0x11')]('/:id',auth[_0x9b44('0xb')](),controller[_0x9b44('0x12')]);router[_0x9b44('0x13')](_0x9b44('0xd'),auth[_0x9b44('0xb')](),controller[_0x9b44('0x14')]);module[_0x9b44('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 24a639a..76a27c9 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 _0x94e6=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94e6,0x194));var _0x694e=function(_0x8e7c55,_0x5870d1){_0x8e7c55=_0x8e7c55-0x0;var _0x2f4e2b=_0x94e6[_0x8e7c55];return _0x2f4e2b;};'use strict';var Sequelize=require(_0x694e('0x0'));module['exports']={'type':{'type':Sequelize[_0x694e('0x1')]},'uniqueid':{'type':Sequelize[_0x694e('0x1')]},'calleridnum':{'type':Sequelize[_0x694e('0x1')]},'calleridname':{'type':Sequelize[_0x694e('0x1')]},'queue':{'type':Sequelize[_0x694e('0x1')]},'interface':{'type':Sequelize[_0x694e('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x694e('0x2')]},'agentconnectAt':{'type':Sequelize[_0x694e('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x694e('0x2')]},'holdtime':{'type':Sequelize[_0x694e('0x3')]},'agentcomplete':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x694e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x694e('0x1')]},'channel':{'type':Sequelize[_0x694e('0x1')]},'channelstate':{'type':Sequelize[_0x694e('0x3')]},'channelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x694e('0x1')]},'language':{'type':Sequelize[_0x694e('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x694e('0x1')]},'exten':{'type':Sequelize[_0x694e('0x1')]},'priority':{'type':Sequelize[_0x694e('0x1')]},'destchannel':{'type':Sequelize[_0x694e('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x694e('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x694e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x694e('0x1')]},'destlanguage':{'type':Sequelize[_0x694e('0x1')]},'destaccountcode':{'type':Sequelize[_0x694e('0x1')]},'destcontext':{'type':Sequelize[_0x694e('0x1')]},'destexten':{'type':Sequelize[_0x694e('0x1')]},'destpriority':{'type':Sequelize[_0x694e('0x1')]},'destuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x694e('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x694e('0x1')]},'transfer':{'type':Sequelize[_0x694e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x694e('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x694e('0x1')]},'transferuniqueid':{'type':Sequelize[_0x694e('0x1')]},'agententerreason':{'type':Sequelize[_0x694e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc7da=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x3a92db,_0x5192bf){var _0x339c8f=function(_0x172b2f){while(--_0x172b2f){_0x3a92db['push'](_0x3a92db['shift']());}};_0x339c8f(++_0x5192bf);}(_0xc7da,0xf2));var _0xac7d=function(_0x5c18d,_0x3a37dc){_0x5c18d=_0x5c18d-0x0;var _0x5e4672=_0xc7da[_0x5c18d];return _0x5e4672;};'use strict';var Sequelize=require(_0xac7d('0x0'));module[_0xac7d('0x1')]={'type':{'type':Sequelize[_0xac7d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac7d('0x2')]},'calleridname':{'type':Sequelize[_0xac7d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xac7d('0x2')]},'membername':{'type':Sequelize[_0xac7d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xac7d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xac7d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xac7d('0x3')]},'agentdumpAt':{'type':Sequelize[_0xac7d('0x3')]},'holdtime':{'type':Sequelize[_0xac7d('0x4')]},'agentcomplete':{'type':Sequelize[_0xac7d('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xac7d('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xac7d('0x4')]},'agentacw':{'type':Sequelize[_0xac7d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xac7d('0x4')]},'reason':{'type':Sequelize[_0xac7d('0x2')]},'lastevent':{'type':Sequelize[_0xac7d('0x2')]},'channel':{'type':Sequelize[_0xac7d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xac7d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xac7d('0x2')]},'connectedlinename':{'type':Sequelize[_0xac7d('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac7d('0x2')]},'context':{'type':Sequelize[_0xac7d('0x2')]},'exten':{'type':Sequelize[_0xac7d('0x2')]},'priority':{'type':Sequelize[_0xac7d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xac7d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xac7d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xac7d('0x2')]},'destcalleridname':{'type':Sequelize[_0xac7d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xac7d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xac7d('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xac7d('0x2')]},'destexten':{'type':Sequelize[_0xac7d('0x2')]},'destpriority':{'type':Sequelize[_0xac7d('0x2')]},'destuniqueid':{'type':Sequelize[_0xac7d('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xac7d('0x2')]},'transfer':{'type':Sequelize[_0xac7d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xac7d('0x2')],'comment':_0xac7d('0x6')},'transferexten':{'type':Sequelize[_0xac7d('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac7d('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 86e44f9..e56db76 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(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 882f322..a44a0f3 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 _0x5a5a=['moment','bluebird','path','rimraf','../../config/environment','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x11304d,_0x4352b5){var _0x4475f2=function(_0x4c78f8){while(--_0x4c78f8){_0x11304d['push'](_0x11304d['shift']());}};_0x4475f2(++_0x4352b5);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x518392,_0x25ac70){_0x518392=_0x518392-0x0;var _0x344e59=_0x5a5a[_0x518392];return _0x344e59;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var logger=require(_0xa5a5('0x1'))(_0xa5a5('0x2'));var moment=require(_0xa5a5('0x3'));var BPromise=require(_0xa5a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a5('0x5'));var rimraf=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x43943d,_0x1fe96d){return _0x43943d['define'](_0xa5a5('0x8'),attributes,{'tableName':_0xa5a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a5('0xa'),_0xa5a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a8=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','util'];(function(_0x200184,_0x50134a){var _0x18a4ca=function(_0x1c7c71){while(--_0x1c7c71){_0x200184['push'](_0x200184['shift']());}};_0x18a4ca(++_0x50134a);}(_0xc3a8,0xe8));var _0x8c3a=function(_0xc298fe,_0x53be01){_0xc298fe=_0xc298fe-0x0;var _0x2096d3=_0xc3a8[_0xc298fe];return _0x2096d3;};'use strict';var _=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var logger=require(_0x8c3a('0x2'))('api');var moment=require(_0x8c3a('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c3a('0x4'));var fs=require('fs');var path=require(_0x8c3a('0x5'));var rimraf=require(_0x8c3a('0x6'));var config=require(_0x8c3a('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x8c3a('0x8')]=function(_0x2477f9,_0x18a92a){return _0x2477f9[_0x8c3a('0x9')](_0x8c3a('0xa'),attributes,{'tableName':_0x8c3a('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x8c3a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index edb62f1..1953a8a 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 _0xf8f8=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30de5b,_0x49babb){var _0x532561=function(_0x179f1a){while(--_0x179f1a){_0x30de5b['push'](_0x30de5b['shift']());}};_0x532561(++_0x49babb);}(_0xf8f8,0x1b1));var _0x8f8f=function(_0x483cb8,_0x2ff5ba){_0x483cb8=_0x483cb8-0x0;var _0x4f8a19=_0xf8f8[_0x483cb8];return _0x4f8a19;};'use strict';var _=require(_0x8f8f('0x0'));var util=require(_0x8f8f('0x1'));var moment=require(_0x8f8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f8f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8f8f('0x4'))(_0x8f8f('0x5'));var config=require(_0x8f8f('0x6'));var jayson=require(_0x8f8f('0x7'));var client=jayson[_0x8f8f('0x8')][_0x8f8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eb204,_0x2fd9c1,_0x4d0733){return new BPromise(function(_0x424fe2,_0x588abc){return client['request'](_0x2eb204,_0x4d0733)[_0x8f8f('0xa')](function(_0x1e0f99){logger[_0x8f8f('0xb')](_0x8f8f('0xc'),_0x2fd9c1,_0x8f8f('0xd'));logger[_0x8f8f('0xe')](_0x8f8f('0xf'),_0x2fd9c1,_0x8f8f('0xd'),JSON[_0x8f8f('0x10')](_0x1e0f99));if(_0x1e0f99[_0x8f8f('0x11')]){if(_0x1e0f99[_0x8f8f('0x11')][_0x8f8f('0x12')]===0x1f4){logger['error'](_0x8f8f('0xc'),_0x2fd9c1,_0x1e0f99['error'][_0x8f8f('0x13')]);return _0x588abc(_0x1e0f99['error'][_0x8f8f('0x13')]);}logger[_0x8f8f('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fd9c1,_0x1e0f99[_0x8f8f('0x11')][_0x8f8f('0x13')]);return _0x424fe2(_0x1e0f99[_0x8f8f('0x11')]['message']);}else{logger[_0x8f8f('0xb')](_0x8f8f('0xc'),_0x2fd9c1,'request\x20sent');_0x424fe2(_0x1e0f99[_0x8f8f('0x14')][_0x8f8f('0x13')]);}})['catch'](function(_0xc71572){logger['error'](_0x8f8f('0xc'),_0x2fd9c1,_0xc71572);_0x588abc(_0xc71572);});});}exports[_0x8f8f('0x15')]=function(_0x19bd39){var _0x300994=this;return new Promise(function(_0x5daf23,_0x454ef6){return db[_0x8f8f('0x16')][_0x8f8f('0x17')](_0x19bd39[_0x8f8f('0x18')],{'raw':_0x19bd39[_0x8f8f('0x19')]?_0x19bd39['options'][_0x8f8f('0x1a')]===undefined?!![]:![]:!![]})[_0x8f8f('0xa')](function(_0x1c994d){logger[_0x8f8f('0xb')](_0x8f8f('0x15'),_0x19bd39);logger[_0x8f8f('0xe')](_0x8f8f('0x15'),_0x19bd39,JSON[_0x8f8f('0x10')](_0x1c994d));_0x5daf23(_0x1c994d);})[_0x8f8f('0x1b')](function(_0x47ce1c){logger[_0x8f8f('0x11')]('CreateVoiceAgentReport',_0x47ce1c[_0x8f8f('0x13')],_0x19bd39);_0x454ef6(_0x300994['error'](0x1f4,_0x47ce1c[_0x8f8f('0x13')]));});});};exports[_0x8f8f('0x1c')]=function(_0x3c2962){var _0xabcc3d=this;return new Promise(function(_0x151489,_0x2451a0){return db[_0x8f8f('0x16')][_0x8f8f('0x1d')](_0x3c2962[_0x8f8f('0x18')],{'raw':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962[_0x8f8f('0x19')][_0x8f8f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c2962['options']?_0x3c2962[_0x8f8f('0x19')][_0x8f8f('0x1e')]||null:null,'attributes':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962[_0x8f8f('0x19')]['attributes']||null:null,'limit':_0x3c2962[_0x8f8f('0x19')]?_0x3c2962['options'][_0x8f8f('0x1f')]||null:null})[_0x8f8f('0xa')](function(_0x504613){logger[_0x8f8f('0xb')](_0x8f8f('0x1c'),_0x3c2962);logger['debug'](_0x8f8f('0x1c'),_0x3c2962,JSON[_0x8f8f('0x10')](_0x504613));_0x151489(_0x504613);})[_0x8f8f('0x1b')](function(_0x141202){logger[_0x8f8f('0x11')](_0x8f8f('0x1c'),_0x141202['message'],_0x3c2962);_0x2451a0(_0xabcc3d['error'](0x1f4,_0x141202[_0x8f8f('0x13')]));});});}; \ No newline at end of file +var _0xab1d=['catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','then','UpdateVoiceAgentReport','raw','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x52c702,_0x541811){var _0x10a9aa=function(_0x8a9de2){while(--_0x8a9de2){_0x52c702['push'](_0x52c702['shift']());}};_0x10a9aa(++_0x541811);}(_0xab1d,0x1da));var _0xdab1=function(_0x424fdc,_0x5e508d){_0x424fdc=_0x424fdc-0x0;var _0x1c366d=_0xab1d[_0x424fdc];return _0x1c366d;};'use strict';var _=require('lodash');var util=require(_0xdab1('0x0'));var moment=require(_0xdab1('0x1'));var BPromise=require(_0xdab1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdab1('0x3'));var db=require(_0xdab1('0x4'))['db'];var utils=require(_0xdab1('0x5'));var logger=require(_0xdab1('0x6'))(_0xdab1('0x7'));var config=require(_0xdab1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdab1('0x9')][_0xdab1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x872fa,_0x346391,_0x50e47e){return new BPromise(function(_0x125c59,_0x2f4c63){return client[_0xdab1('0xb')](_0x872fa,_0x50e47e)['then'](function(_0x2e0d3d){logger[_0xdab1('0xc')](_0xdab1('0xd'),_0x346391,_0xdab1('0xe'));logger[_0xdab1('0xf')](_0xdab1('0x10'),_0x346391,'request\x20sent',JSON[_0xdab1('0x11')](_0x2e0d3d));if(_0x2e0d3d[_0xdab1('0x12')]){if(_0x2e0d3d['error']['code']===0x1f4){logger[_0xdab1('0x12')](_0xdab1('0xd'),_0x346391,_0x2e0d3d[_0xdab1('0x12')][_0xdab1('0x13')]);return _0x2f4c63(_0x2e0d3d['error']['message']);}logger[_0xdab1('0x12')](_0xdab1('0xd'),_0x346391,_0x2e0d3d[_0xdab1('0x12')][_0xdab1('0x13')]);return _0x125c59(_0x2e0d3d[_0xdab1('0x12')][_0xdab1('0x13')]);}else{logger[_0xdab1('0xc')](_0xdab1('0xd'),_0x346391,_0xdab1('0xe'));_0x125c59(_0x2e0d3d[_0xdab1('0x14')][_0xdab1('0x13')]);}})[_0xdab1('0x15')](function(_0xd47389){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x346391,_0xd47389);_0x2f4c63(_0xd47389);});});}exports[_0xdab1('0x16')]=function(_0x146037){var _0x16ae6f=this;return new Promise(function(_0x16e39d,_0x20e8f1){return db[_0xdab1('0x17')][_0xdab1('0x18')](_0x146037[_0xdab1('0x19')],{'raw':_0x146037[_0xdab1('0x1a')]?_0x146037[_0xdab1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xdab1('0x1b')](function(_0x25a07c){logger[_0xdab1('0xc')](_0xdab1('0x16'),_0x146037);logger['debug'](_0xdab1('0x16'),_0x146037,JSON[_0xdab1('0x11')](_0x25a07c));_0x16e39d(_0x25a07c);})['catch'](function(_0x3647e8){logger[_0xdab1('0x12')](_0xdab1('0x16'),_0x3647e8[_0xdab1('0x13')],_0x146037);_0x20e8f1(_0x16ae6f[_0xdab1('0x12')](0x1f4,_0x3647e8[_0xdab1('0x13')]));});});};exports[_0xdab1('0x1c')]=function(_0x485cca){var _0x18f1ad=this;return new Promise(function(_0x154351,_0x41a708){return db[_0xdab1('0x17')]['update'](_0x485cca[_0xdab1('0x19')],{'raw':_0x485cca['options']?_0x485cca[_0xdab1('0x1a')][_0xdab1('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x485cca[_0xdab1('0x1a')]?_0x485cca['options'][_0xdab1('0x1e')]||null:null,'attributes':_0x485cca['options']?_0x485cca[_0xdab1('0x1a')][_0xdab1('0x1f')]||null:null,'limit':_0x485cca[_0xdab1('0x1a')]?_0x485cca[_0xdab1('0x1a')][_0xdab1('0x20')]||null:null})[_0xdab1('0x1b')](function(_0x281f96){logger[_0xdab1('0xc')](_0xdab1('0x1c'),_0x485cca);logger[_0xdab1('0xf')](_0xdab1('0x1c'),_0x485cca,JSON[_0xdab1('0x11')](_0x281f96));_0x154351(_0x281f96);})[_0xdab1('0x15')](function(_0xb4f08a){logger[_0xdab1('0x12')](_0xdab1('0x1c'),_0xb4f08a[_0xdab1('0x13')],_0x485cca);_0x41a708(_0x18f1ad[_0xdab1('0x12')](0x1f4,_0xb4f08a[_0xdab1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 003c17b..89dfc05 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 _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x1ab15b,_0x8d1762){var _0xa4d038=function(_0x323679){while(--_0x323679){_0x1ab15b['push'](_0x1ab15b['shift']());}};_0xa4d038(++_0x8d1762);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x5a3b09,_0x24a4a3){_0x5a3b09=_0x5a3b09-0x0;var _0x46298a=_0xd0bb[_0x5a3b09];return _0x46298a;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('0x12')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0x885a,0x180));var _0xa885=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x885a[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0xf')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x12')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller['update']);router[_0xa885('0x13')](_0xa885('0xd'),auth[_0xa885('0x10')](),controller[_0xa885('0x14')]);module[_0xa885('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6f7762a..545c553 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 _0x5bd4=['outbound-fax','STRING','DATE','INTEGER','sequelize','exports','inbound','outbound','inbound-fax'];(function(_0x12bdac,_0x435c03){var _0x3a4e49=function(_0xf8865d){while(--_0xf8865d){_0x12bdac['push'](_0x12bdac['shift']());}};_0x3a4e49(++_0x435c03);}(_0x5bd4,0x163));var _0x45bd=function(_0x28765a,_0x5241c0){_0x28765a=_0x28765a-0x0;var _0x399b2c=_0x5bd4[_0x28765a];return _0x399b2c;};'use strict';var Sequelize=require(_0x45bd('0x0'));module[_0x45bd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x45bd('0x2'),'internal',_0x45bd('0x3'),_0x45bd('0x4'),_0x45bd('0x5'),'dialer')},'tag':{'type':Sequelize[_0x45bd('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x45bd('0x6')]},'destination':{'type':Sequelize[_0x45bd('0x6')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x45bd('0x6')]},'channel':{'type':Sequelize[_0x45bd('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x45bd('0x7')]},'systemanswertime':{'type':Sequelize[_0x45bd('0x7')]},'answertime':{'type':Sequelize[_0x45bd('0x7')]},'endtime':{'type':Sequelize[_0x45bd('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x45bd('0x8')]},'mohtime':{'type':Sequelize[_0x45bd('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x45bd('0x6')]},'amaflags':{'type':Sequelize[_0x45bd('0x6')]},'userfield':{'type':Sequelize[_0x45bd('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x45bd('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x45bd('0x6')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x45bd('0x8')]},'sipcallid':{'type':Sequelize[_0x45bd('0x6')]}}; \ No newline at end of file +var _0xc900=['ENUM','inbound','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','STRING'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0xc900,0xb3));var _0x0c90=function(_0x8bd38f,_0x5e9afc){_0x8bd38f=_0x8bd38f-0x0;var _0x583f61=_0xc900[_0x8bd38f];return _0x583f61;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0c90('0x0')]},'type':{'type':Sequelize[_0x0c90('0x1')](_0x0c90('0x2'),'internal',_0x0c90('0x3'),_0x0c90('0x4'),'outbound-fax',_0x0c90('0x5'))},'tag':{'type':Sequelize[_0x0c90('0x0')]},'accountcode':{'type':Sequelize[_0x0c90('0x0')]},'source':{'type':Sequelize[_0x0c90('0x0')]},'destination':{'type':Sequelize[_0x0c90('0x0')]},'destinationcontext':{'type':Sequelize[_0x0c90('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0c90('0x0')]},'destinationchannel':{'type':Sequelize[_0x0c90('0x0')]},'lastapplication':{'type':Sequelize[_0x0c90('0x0')]},'lastdata':{'type':Sequelize[_0x0c90('0x6')]},'starttime':{'type':Sequelize[_0x0c90('0x7')]},'systemanswertime':{'type':Sequelize[_0x0c90('0x7')]},'answertime':{'type':Sequelize[_0x0c90('0x7')]},'endtime':{'type':Sequelize[_0x0c90('0x7')]},'duration':{'type':Sequelize[_0x0c90('0x8')]},'billableseconds':{'type':Sequelize[_0x0c90('0x8')]},'mohtime':{'type':Sequelize[_0x0c90('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0c90('0x0')]},'amaflags':{'type':Sequelize[_0x0c90('0x0')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x0c90('0x0')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x0c90('0x0')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x0c90('0x0')]},'routeid':{'type':Sequelize[_0x0c90('0x8')]},'sipcallid':{'type':Sequelize[_0x0c90('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index dac6883..9c210e0 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 _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x575b98,_0x3e312c){var _0x51ad93=function(_0x565956){while(--_0x565956){_0x575b98['push'](_0x575b98['shift']());}};_0x51ad93(++_0x3e312c);}(_0x0b0e,0x187));var _0xe0b0=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0x0b0e[_0xf33afd];return _0x5f432a;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x2c0091,_0x1b9567){_0x2c0091=_0x2c0091-0x0;var _0x33fb4f=_0x2032[_0x2c0091];return _0x33fb4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7387a36..27e8108 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 _0xcb64=['../../config/environment','exports','define','VoiceCallReport','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f4223,_0x5540a8){var _0x546de7=function(_0x201fdf){while(--_0x201fdf){_0x2f4223['push'](_0x2f4223['shift']());}};_0x546de7(++_0x5540a8);}(_0xcb64,0x179));var _0x4cb6=function(_0x403908,_0xa870c9){_0x403908=_0x403908-0x0;var _0x4a630b=_0xcb64[_0x403908];return _0x4a630b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4cb6('0x0'))(_0x4cb6('0x1'));var moment=require(_0x4cb6('0x2'));var BPromise=require(_0x4cb6('0x3'));var rp=require(_0x4cb6('0x4'));var fs=require('fs');var path=require(_0x4cb6('0x5'));var rimraf=require(_0x4cb6('0x6'));var config=require(_0x4cb6('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x4cb6('0x8')]=function(_0x146086,_0x196a6c){return _0x146086[_0x4cb6('0x9')](_0x4cb6('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x4cb6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4449=['lodash','../../config/logger','moment','bluebird','path','./voiceCallReport.attributes','define','report_call','uniqueid'];(function(_0x257297,_0x3f62b9){var _0x3a454e=function(_0x8d9c58){while(--_0x8d9c58){_0x257297['push'](_0x257297['shift']());}};_0x3a454e(++_0x3f62b9);}(_0x4449,0x1c2));var _0x9444=function(_0x1c658a,_0xfac721){_0x1c658a=_0x1c658a-0x0;var _0x424736=_0x4449[_0x1c658a];return _0x424736;};'use strict';var _=require(_0x9444('0x0'));var util=require('util');var logger=require(_0x9444('0x1'))('api');var moment=require(_0x9444('0x2'));var BPromise=require(_0x9444('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9444('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9444('0x5'));module['exports']=function(_0x448a4a,_0x5d1422){return _0x448a4a[_0x9444('0x6')]('VoiceCallReport',attributes,{'tableName':_0x9444('0x7'),'paranoid':![],'indexes':[{'fields':[_0x9444('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ca40b0b..175eac8 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 _0x0497=['UpdateVoiceCallReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','include','model','stringify','CreateVoiceCallReport','create','body'];(function(_0x23883f,_0x4d5e01){var _0x318173=function(_0x246987){while(--_0x246987){_0x23883f['push'](_0x23883f['shift']());}};_0x318173(++_0x4d5e01);}(_0x0497,0x1af));var _0x7049=function(_0x139db3,_0x22a5bf){_0x139db3=_0x139db3-0x0;var _0xde6ed7=_0x0497[_0x139db3];return _0xde6ed7;};'use strict';var _=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7049('0x2'));var fs=require('fs');var Redis=require(_0x7049('0x3'));var db=require(_0x7049('0x4'))['db'];var utils=require(_0x7049('0x5'));var logger=require(_0x7049('0x6'))(_0x7049('0x7'));var config=require(_0x7049('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7049('0x9')][_0x7049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x69b6ca,_0x1f14b4,_0x400311){return new BPromise(function(_0x4727a2,_0x46c9f9){return client[_0x7049('0xb')](_0x69b6ca,_0x400311)[_0x7049('0xc')](function(_0xa454ee){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x1f14b4,_0x7049('0xd'));logger[_0x7049('0xe')](_0x7049('0xf'),_0x1f14b4,_0x7049('0xd'),JSON['stringify'](_0xa454ee));if(_0xa454ee['error']){if(_0xa454ee[_0x7049('0x10')]['code']===0x1f4){logger['error'](_0x7049('0x11'),_0x1f14b4,_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);return _0x46c9f9(_0xa454ee['error'][_0x7049('0x12')]);}logger[_0x7049('0x10')](_0x7049('0x11'),_0x1f14b4,_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);return _0x4727a2(_0xa454ee[_0x7049('0x10')][_0x7049('0x12')]);}else{logger[_0x7049('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1f14b4,_0x7049('0xd'));_0x4727a2(_0xa454ee[_0x7049('0x14')]['message']);}})[_0x7049('0x15')](function(_0x3e4068){logger[_0x7049('0x10')](_0x7049('0x11'),_0x1f14b4,_0x3e4068);_0x46c9f9(_0x3e4068);});});}exports[_0x7049('0x16')]=function(_0x1aaf9e){var _0x58a562=this;return new Promise(function(_0x473622,_0xd4116f){return db[_0x7049('0x17')][_0x7049('0x18')]({'raw':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1a')]===undefined?!![]:![]:!![],'where':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1b')]||null:null,'attributes':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e['options'][_0x7049('0x1c')]||null:null,'limit':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e[_0x7049('0x19')][_0x7049('0x1d')]||null:null,'include':_0x1aaf9e[_0x7049('0x19')]?_0x1aaf9e['options']['include']?_[_0x7049('0x1e')](_0x1aaf9e['options']['include'],function(_0x635ab1){return{'model':db[_0x635ab1['model']],'as':_0x635ab1['as'],'attributes':_0x635ab1[_0x7049('0x1c')],'include':_0x635ab1[_0x7049('0x1f')]?_['map'](_0x635ab1[_0x7049('0x1f')],function(_0x5e8077){return{'model':db[_0x5e8077['model']],'as':_0x5e8077['as'],'attributes':_0x5e8077[_0x7049('0x1c')],'include':_0x5e8077[_0x7049('0x1f')]?_['map'](_0x5e8077[_0x7049('0x1f')],function(_0x4a95d4){return{'model':db[_0x4a95d4[_0x7049('0x20')]],'as':_0x4a95d4['as'],'attributes':_0x4a95d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7049('0xc')](function(_0x2a886f){logger[_0x7049('0x13')](_0x7049('0x16'),_0x1aaf9e);logger[_0x7049('0xe')](_0x7049('0x16'),_0x1aaf9e,JSON[_0x7049('0x21')](_0x2a886f));_0x473622(_0x2a886f);})[_0x7049('0x15')](function(_0x4a123f){logger[_0x7049('0x10')]('GetVoiceCallReport',_0x4a123f['message'],_0x1aaf9e);_0xd4116f(_0x58a562['error'](0x1f4,_0x4a123f['message']));});});};exports[_0x7049('0x22')]=function(_0x24f97){var _0x1178ca=this;return new Promise(function(_0x2777f0,_0x2d8521){return db['VoiceCallReport'][_0x7049('0x23')](_0x24f97[_0x7049('0x24')],{'raw':_0x24f97[_0x7049('0x19')]?_0x24f97[_0x7049('0x19')][_0x7049('0x1a')]===undefined?!![]:![]:!![]})[_0x7049('0xc')](function(_0x434eaf){logger[_0x7049('0x13')]('CreateVoiceCallReport',_0x24f97);logger[_0x7049('0xe')](_0x7049('0x22'),_0x24f97,JSON[_0x7049('0x21')](_0x434eaf));_0x2777f0(_0x434eaf);})[_0x7049('0x15')](function(_0x125ed1){logger[_0x7049('0x10')]('CreateVoiceCallReport',_0x125ed1[_0x7049('0x12')],_0x24f97);_0x2d8521(_0x1178ca[_0x7049('0x10')](0x1f4,_0x125ed1[_0x7049('0x12')]));});});};exports[_0x7049('0x25')]=function(_0x49d981){var _0x25e173=this;return new Promise(function(_0x2643b6,_0x5c5f7b){return db[_0x7049('0x17')][_0x7049('0x26')](_0x49d981['body'],{'raw':_0x49d981[_0x7049('0x19')]?_0x49d981[_0x7049('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49d981['options']?_0x49d981[_0x7049('0x19')][_0x7049('0x1b')]||null:null,'attributes':_0x49d981['options']?_0x49d981[_0x7049('0x19')]['attributes']||null:null,'limit':_0x49d981['options']?_0x49d981[_0x7049('0x19')][_0x7049('0x1d')]||null:null})[_0x7049('0xc')](function(_0x2d6c28){logger[_0x7049('0x13')](_0x7049('0x25'),_0x49d981);logger[_0x7049('0xe')](_0x7049('0x25'),_0x49d981,JSON[_0x7049('0x21')](_0x2d6c28));_0x2643b6(_0x2d6c28);})[_0x7049('0x15')](function(_0x891225){logger[_0x7049('0x10')](_0x7049('0x25'),_0x891225[_0x7049('0x12')],_0x49d981);_0x5c5f7b(_0x25e173['error'](0x1f4,_0x891225[_0x7049('0x12')]));});});}; \ No newline at end of file +var _0x3123=['code','message','result','GetVoiceCallReport','options','raw','limit','include','map','attributes','model','catch','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e03a6,_0xf0349){var _0x295b64=function(_0x1ad0a5){while(--_0x1ad0a5){_0x1e03a6['push'](_0x1e03a6['shift']());}};_0x295b64(++_0xf0349);}(_0x3123,0x1f3));var _0x3312=function(_0x4267a7,_0x40173b){_0x4267a7=_0x4267a7-0x0;var _0xb30092=_0x3123[_0x4267a7];return _0xb30092;};'use strict';var _=require(_0x3312('0x0'));var util=require(_0x3312('0x1'));var moment=require('moment');var BPromise=require(_0x3312('0x2'));var rs=require(_0x3312('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3312('0x4'))['db'];var utils=require(_0x3312('0x5'));var logger=require(_0x3312('0x6'))(_0x3312('0x7'));var config=require(_0x3312('0x8'));var jayson=require(_0x3312('0x9'));var client=jayson[_0x3312('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11211f,_0x5e033c,_0x22b78d){return new BPromise(function(_0x537d5d,_0x485e83){return client['request'](_0x11211f,_0x22b78d)[_0x3312('0xb')](function(_0x72edac){logger[_0x3312('0xc')](_0x3312('0xd'),_0x5e033c,_0x3312('0xe'));logger[_0x3312('0xf')](_0x3312('0x10'),_0x5e033c,_0x3312('0xe'),JSON[_0x3312('0x11')](_0x72edac));if(_0x72edac[_0x3312('0x12')]){if(_0x72edac[_0x3312('0x12')][_0x3312('0x13')]===0x1f4){logger[_0x3312('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5e033c,_0x72edac[_0x3312('0x12')]['message']);return _0x485e83(_0x72edac['error'][_0x3312('0x14')]);}logger[_0x3312('0x12')](_0x3312('0xd'),_0x5e033c,_0x72edac[_0x3312('0x12')][_0x3312('0x14')]);return _0x537d5d(_0x72edac['error']['message']);}else{logger[_0x3312('0xc')](_0x3312('0xd'),_0x5e033c,_0x3312('0xe'));_0x537d5d(_0x72edac[_0x3312('0x15')][_0x3312('0x14')]);}})['catch'](function(_0x4ae4a2){logger[_0x3312('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x5e033c,_0x4ae4a2);_0x485e83(_0x4ae4a2);});});}exports[_0x3312('0x16')]=function(_0x55579b){var _0x3412c0=this;return new Promise(function(_0x2bbd1d,_0x121cca){return db['VoiceCallReport']['findAll']({'raw':_0x55579b[_0x3312('0x17')]?_0x55579b[_0x3312('0x17')][_0x3312('0x18')]===undefined?!![]:![]:!![],'where':_0x55579b[_0x3312('0x17')]?_0x55579b[_0x3312('0x17')]['where']||null:null,'attributes':_0x55579b[_0x3312('0x17')]?_0x55579b['options']['attributes']||null:null,'limit':_0x55579b[_0x3312('0x17')]?_0x55579b[_0x3312('0x17')][_0x3312('0x19')]||null:null,'include':_0x55579b['options']?_0x55579b[_0x3312('0x17')][_0x3312('0x1a')]?_[_0x3312('0x1b')](_0x55579b['options'][_0x3312('0x1a')],function(_0x158f68){return{'model':db[_0x158f68['model']],'as':_0x158f68['as'],'attributes':_0x158f68[_0x3312('0x1c')],'include':_0x158f68['include']?_['map'](_0x158f68['include'],function(_0xeebca){return{'model':db[_0xeebca[_0x3312('0x1d')]],'as':_0xeebca['as'],'attributes':_0xeebca[_0x3312('0x1c')],'include':_0xeebca[_0x3312('0x1a')]?_[_0x3312('0x1b')](_0xeebca['include'],function(_0x237e8e){return{'model':db[_0x237e8e[_0x3312('0x1d')]],'as':_0x237e8e['as'],'attributes':_0x237e8e[_0x3312('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3312('0xb')](function(_0x5ed50b){logger[_0x3312('0xc')](_0x3312('0x16'),_0x55579b);logger['debug'](_0x3312('0x16'),_0x55579b,JSON[_0x3312('0x11')](_0x5ed50b));_0x2bbd1d(_0x5ed50b);})[_0x3312('0x1e')](function(_0x1ab67e){logger[_0x3312('0x12')](_0x3312('0x16'),_0x1ab67e[_0x3312('0x14')],_0x55579b);_0x121cca(_0x3412c0[_0x3312('0x12')](0x1f4,_0x1ab67e[_0x3312('0x14')]));});});};exports[_0x3312('0x1f')]=function(_0x2d83f8){var _0x4730c0=this;return new Promise(function(_0x198c7d,_0x2c28fe){return db[_0x3312('0x20')][_0x3312('0x21')](_0x2d83f8[_0x3312('0x22')],{'raw':_0x2d83f8['options']?_0x2d83f8[_0x3312('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x172566){logger[_0x3312('0xc')](_0x3312('0x1f'),_0x2d83f8);logger[_0x3312('0xf')](_0x3312('0x1f'),_0x2d83f8,JSON[_0x3312('0x11')](_0x172566));_0x198c7d(_0x172566);})[_0x3312('0x1e')](function(_0x8dfdfc){logger[_0x3312('0x12')](_0x3312('0x1f'),_0x8dfdfc['message'],_0x2d83f8);_0x2c28fe(_0x4730c0[_0x3312('0x12')](0x1f4,_0x8dfdfc['message']));});});};exports[_0x3312('0x23')]=function(_0x6c7d38){var _0x426b09=this;return new Promise(function(_0x414f40,_0x277274){return db['VoiceCallReport'][_0x3312('0x24')](_0x6c7d38[_0x3312('0x22')],{'raw':_0x6c7d38['options']?_0x6c7d38[_0x3312('0x17')][_0x3312('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6c7d38['options']?_0x6c7d38[_0x3312('0x17')]['where']||null:null,'attributes':_0x6c7d38[_0x3312('0x17')]?_0x6c7d38[_0x3312('0x17')][_0x3312('0x1c')]||null:null,'limit':_0x6c7d38['options']?_0x6c7d38[_0x3312('0x17')][_0x3312('0x19')]||null:null})['then'](function(_0x3c5b05){logger[_0x3312('0xc')](_0x3312('0x23'),_0x6c7d38);logger[_0x3312('0xf')](_0x3312('0x23'),_0x6c7d38,JSON['stringify'](_0x3c5b05));_0x414f40(_0x3c5b05);})[_0x3312('0x1e')](function(_0x359fb0){logger['error'](_0x3312('0x23'),_0x359fb0[_0x3312('0x14')],_0x6c7d38);_0x277274(_0x426b09[_0x3312('0x12')](0x1f4,_0x359fb0[_0x3312('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 03ec6b9..5a37202 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 _0x27f0=['update','delete','exports','multer','util','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0x27f0,0x137));var _0x027f=function(_0x4a94cf,_0x4756c1){_0x4a94cf=_0x4a94cf-0x0;var _0x41bcf4=_0x27f0[_0x4a94cf];return _0x41bcf4;};'use strict';var multer=require(_0x027f('0x0'));var util=require(_0x027f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x027f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x027f('0x3'));var config=require('../../config/environment');var controller=require(_0x027f('0x4'));router[_0x027f('0x5')]('/',auth['isAuthenticated'](),controller[_0x027f('0x6')]);router['get'](_0x027f('0x7'),auth[_0x027f('0x8')](),controller[_0x027f('0x9')]);router['post']('/',auth[_0x027f('0x8')](),controller[_0x027f('0xa')]);router['put']('/:id',auth[_0x027f('0x8')](),controller[_0x027f('0xb')]);router[_0x027f('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x027f('0xd')]=router; \ No newline at end of file +var _0xc960=['show','post','create','put','update','delete','isAuthenticated','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id'];(function(_0x1ed8c7,_0x498766){var _0x40e193=function(_0x1880d3){while(--_0x1880d3){_0x1ed8c7['push'](_0x1ed8c7['shift']());}};_0x40e193(++_0x498766);}(_0xc960,0x8d));var _0x0c96=function(_0x3c657e,_0x24ff4d){_0x3c657e=_0x3c657e-0x0;var _0x89d7c2=_0xc960[_0x3c657e];return _0x89d7c2;};'use strict';var multer=require(_0x0c96('0x0'));var util=require('util');var path=require(_0x0c96('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c96('0x2'));var router=express[_0x0c96('0x3')]();var fs_extra=require(_0x0c96('0x4'));var auth=require(_0x0c96('0x5'));var interaction=require(_0x0c96('0x6'));var config=require(_0x0c96('0x7'));var controller=require(_0x0c96('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0c96('0x9')](_0x0c96('0xa'),auth['isAuthenticated'](),controller[_0x0c96('0xb')]);router[_0x0c96('0xc')]('/',auth['isAuthenticated'](),controller[_0x0c96('0xd')]);router[_0x0c96('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0c96('0xf')]);router[_0x0c96('0x10')](_0x0c96('0xa'),auth[_0x0c96('0x11')](),controller[_0x0c96('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c70a057..9512e76 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 _0x830d=['name','options','getDataValue','split','BOOLEAN','STRING','sequelize','exports'];(function(_0x61ca0c,_0x555ec8){var _0x5e6bcf=function(_0x4873f4){while(--_0x4873f4){_0x61ca0c['push'](_0x61ca0c['shift']());}};_0x5e6bcf(++_0x555ec8);}(_0x830d,0x1a6));var _0xd830=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x830d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd830('0x0'));module[_0xd830('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xd830('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3e6be9){this['setDataValue'](_0xd830('0x3'),_0x3e6be9?_0x3e6be9['join'](''):[]);},'get':function(){return this[_0xd830('0x4')](_0xd830('0x3'))?this[_0xd830('0x4')](_0xd830('0x3'))[_0xd830('0x5')](''):[];}},'auth':{'type':Sequelize[_0xd830('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0xd830('0x7')]},'record':{'type':Sequelize[_0xd830('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd830('0x7')]},'description':{'type':Sequelize[_0xd830('0x7')]}}; \ No newline at end of file +var _0x3f0e=['exports','STRING','name','options','join','getDataValue','BOOLEAN','sequelize'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3f0e,0x1cf));var _0xe3f0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3f0e[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xe3f0('0x0'));module[_0xe3f0('0x1')]={'name':{'type':Sequelize[_0xe3f0('0x2')]},'prefix':{'type':Sequelize[_0xe3f0('0x2')],'unique':_0xe3f0('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xe3f0('0x2')],'set':function(_0x417b10){this['setDataValue'](_0xe3f0('0x4'),_0x417b10?_0x417b10[_0xe3f0('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xe3f0('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0xe3f0('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xe3f0('0x2')]},'record':{'type':Sequelize[_0xe3f0('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe3f0('0x2')]},'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 423c01d..64a464d 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 _0x4b6c=['params','fields','include','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','ChanSpies','end','error','name','map','VoiceChanSpy','fieldName','type','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x1f574f,_0xf4a4c6){var _0x5ce3e5=function(_0x2b77f5){while(--_0x2b77f5){_0x1f574f['push'](_0x1f574f['shift']());}};_0x5ce3e5(++_0xf4a4c6);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc4b6('0x0'));var rimraf=require(_0xc4b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4b6('0x2'));var rp=require(_0xc4b6('0x3'));var moment=require(_0xc4b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc4b6('0x5'));var util=require(_0xc4b6('0x6'));var path=require(_0xc4b6('0x7'));var sox=require('sox');var csv=require(_0xc4b6('0x8'));var ejs=require(_0xc4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4b6('0xa'));var _=require(_0xc4b6('0xb'));var squel=require('squel');var crypto=require(_0xc4b6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4b6('0x8'));var querystring=require(_0xc4b6('0xd'));var Papa=require(_0xc4b6('0xe'));var Redis=require(_0xc4b6('0xf'));var authService=require(_0xc4b6('0x10'));var qs=require(_0xc4b6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b6('0x12'));var logger=require(_0xc4b6('0x13'))('api');var utils=require(_0xc4b6('0x14'));var config=require(_0xc4b6('0x15'));var licenseUtil=require(_0xc4b6('0x16'));var db=require(_0xc4b6('0x17'))['db'];function respondWithStatusCode(_0x286a5a,_0xd6208e){_0xd6208e=_0xd6208e||0xcc;return function(_0xf2a30e){if(_0xf2a30e){return _0x286a5a[_0xc4b6('0x18')](_0xd6208e);}return _0x286a5a[_0xc4b6('0x19')](_0xd6208e)['end']();};}function respondWithResult(_0x21ee35,_0x2b7aab){_0x2b7aab=_0x2b7aab||0xc8;return function(_0x5d9008){if(_0x5d9008){return _0x21ee35[_0xc4b6('0x19')](_0x2b7aab)['json'](_0x5d9008);}};}function respondWithFilteredResult(_0x41be8d,_0x408652){return function(_0x20c517){if(_0x20c517){var _0x23144b=typeof _0x408652['offset']==='undefined'&&typeof _0x408652[_0xc4b6('0x1a')]===_0xc4b6('0x1b');var _0x403f94=_0x20c517[_0xc4b6('0x1c')];var _0x220dfd=_0x23144b?0x0:_0x408652[_0xc4b6('0x1d')];var _0x471bf8=_0x23144b?_0x20c517[_0xc4b6('0x1c')]:_0x408652[_0xc4b6('0x1d')]+_0x408652[_0xc4b6('0x1a')];var _0x5c1f92;if(_0x471bf8>=_0x403f94){_0x471bf8=_0x403f94;_0x5c1f92=0xc8;}else{_0x5c1f92=0xce;}_0x41be8d[_0xc4b6('0x19')](_0x5c1f92);return _0x41be8d['set'](_0xc4b6('0x1e'),_0x220dfd+'-'+_0x471bf8+'/'+_0x403f94)[_0xc4b6('0x1f')](_0x20c517);}return null;};}function patchUpdates(_0x44618b){return function(_0x15a3de){try{jsonpatch[_0xc4b6('0x20')](_0x15a3de,_0x44618b,!![]);}catch(_0x2f207d){return BPromise[_0xc4b6('0x21')](_0x2f207d);}return _0x15a3de[_0xc4b6('0x22')]();};}function saveUpdates(_0x51090f,_0x8fcdde){return function(_0x41fedf){if(_0x41fedf){return _0x41fedf[_0xc4b6('0x23')](_0x51090f)[_0xc4b6('0x24')](function(_0x24592a){return _0x24592a;});}return null;};}function removeEntity(_0x214801,_0x2c2d35){return function(_0x81b146){if(_0x81b146){return _0x81b146[_0xc4b6('0x25')]()['then'](function(){var _0x5a6eff=_0x81b146['get']({'plain':!![]});var _0x392b0f=_0xc4b6('0x26');return db['UserProfileResource'][_0xc4b6('0x25')]({'where':{'type':_0x392b0f,'resourceId':_0x5a6eff['id']}})[_0xc4b6('0x24')](function(){return _0x81b146;});})['then'](function(){_0x214801[_0xc4b6('0x19')](0xcc)[_0xc4b6('0x27')]();});}};}function handleEntityNotFound(_0x1ce21c,_0x3340f3){return function(_0x1ee8d3){if(!_0x1ee8d3){_0x1ce21c[_0xc4b6('0x18')](0x194);}return _0x1ee8d3;};}function handleError(_0x1a1432,_0x391f5b){_0x391f5b=_0x391f5b||0x1f4;return function(_0x31a9de){logger[_0xc4b6('0x28')](_0x31a9de['stack']);if(_0x31a9de[_0xc4b6('0x29')]){delete _0x31a9de[_0xc4b6('0x29')];}_0x1a1432[_0xc4b6('0x19')](_0x391f5b)['send'](_0x31a9de);};}exports['index']=function(_0x1fbdc0,_0x4ef594){var _0x3ec5c1={},_0x1bf9a6={},_0x1e8135={'count':0x0,'rows':[]};var _0x5b5298=_[_0xc4b6('0x2a')](db[_0xc4b6('0x2b')]['rawAttributes'],function(_0x403b43){return{'name':_0x403b43[_0xc4b6('0x2c')],'type':_0x403b43[_0xc4b6('0x2d')]['key']};});_0x1bf9a6['model']=_[_0xc4b6('0x2a')](_0x5b5298,_0xc4b6('0x29'));_0x1bf9a6['query']=_[_0xc4b6('0x2e')](_0x1fbdc0['query']);_0x1bf9a6[_0xc4b6('0x2f')]=_[_0xc4b6('0x30')](_0x1bf9a6[_0xc4b6('0x31')],_0x1bf9a6[_0xc4b6('0x32')]);_0x3ec5c1[_0xc4b6('0x33')]=_[_0xc4b6('0x30')](_0x1bf9a6[_0xc4b6('0x31')],qs['fields'](_0x1fbdc0['query']['fields']));_0x3ec5c1[_0xc4b6('0x33')]=_0x3ec5c1[_0xc4b6('0x33')][_0xc4b6('0x34')]?_0x3ec5c1[_0xc4b6('0x33')]:_0x1bf9a6['model'];if(!_0x1fbdc0['query'][_0xc4b6('0x35')](_0xc4b6('0x36'))){_0x3ec5c1[_0xc4b6('0x1a')]=qs[_0xc4b6('0x1a')](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x1a')]);_0x3ec5c1[_0xc4b6('0x1d')]=qs['offset'](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x1d')]);}_0x3ec5c1['order']=qs[_0xc4b6('0x37')](_0x1fbdc0[_0xc4b6('0x32')][_0xc4b6('0x37')]);_0x3ec5c1[_0xc4b6('0x38')]=qs[_0xc4b6('0x2f')](_[_0xc4b6('0x39')](_0x1fbdc0[_0xc4b6('0x32')],_0x1bf9a6[_0xc4b6('0x2f')]),_0x5b5298);if(_0x1fbdc0[_0xc4b6('0x32')]['filter']){_0x3ec5c1[_0xc4b6('0x38')]=_['merge'](_0x3ec5c1[_0xc4b6('0x38')],{'$or':_[_0xc4b6('0x2a')](_0x5b5298,function(_0x3c975b){if(_0x3c975b['type']!==_0xc4b6('0x3a')){var _0x4594e5={};_0x4594e5[_0x3c975b[_0xc4b6('0x29')]]={'$like':'%'+_0x1fbdc0[_0xc4b6('0x32')]['filter']+'%'};return _0x4594e5;}})});}_0x3ec5c1=_['merge']({},_0x3ec5c1,_0x1fbdc0[_0xc4b6('0x3b')]);var _0x379656={'where':_0x3ec5c1[_0xc4b6('0x38')]};return db[_0xc4b6('0x2b')][_0xc4b6('0x1c')](_0x379656)['then'](function(_0x3ec107){_0x1e8135['count']=_0x3ec107;if(_0x1fbdc0['query'][_0xc4b6('0x3c')]){_0x3ec5c1['include']=[{'all':!![]}];}return db[_0xc4b6('0x2b')][_0xc4b6('0x3d')](_0x3ec5c1);})[_0xc4b6('0x24')](function(_0x555acf){_0x1e8135[_0xc4b6('0x3e')]=_0x555acf;return _0x1e8135;})[_0xc4b6('0x24')](respondWithFilteredResult(_0x4ef594,_0x3ec5c1))[_0xc4b6('0x3f')](handleError(_0x4ef594,null));};exports[_0xc4b6('0x40')]=function(_0x26b362,_0x4265f4){var _0x5584af={'raw':![],'where':{'id':_0x26b362[_0xc4b6('0x41')]['id']}},_0x5aaea2={};_0x5aaea2[_0xc4b6('0x31')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x5aaea2[_0xc4b6('0x32')]=_[_0xc4b6('0x2e')](_0x26b362[_0xc4b6('0x32')]);_0x5aaea2[_0xc4b6('0x2f')]=_[_0xc4b6('0x30')](_0x5aaea2[_0xc4b6('0x31')],_0x5aaea2[_0xc4b6('0x32')]);_0x5584af['attributes']=_[_0xc4b6('0x30')](_0x5aaea2[_0xc4b6('0x31')],qs[_0xc4b6('0x42')](_0x26b362[_0xc4b6('0x32')][_0xc4b6('0x42')]));_0x5584af[_0xc4b6('0x33')]=_0x5584af[_0xc4b6('0x33')]['length']?_0x5584af['attributes']:_0x5aaea2[_0xc4b6('0x31')];if(_0x26b362[_0xc4b6('0x32')][_0xc4b6('0x3c')]){_0x5584af[_0xc4b6('0x43')]=[{'all':!![]}];}_0x5584af=_['merge']({},_0x5584af,_0x26b362[_0xc4b6('0x3b')]);return db[_0xc4b6('0x2b')][_0xc4b6('0x44')](_0x5584af)[_0xc4b6('0x24')](handleEntityNotFound(_0x4265f4,null))['then'](respondWithResult(_0x4265f4,null))[_0xc4b6('0x3f')](handleError(_0x4265f4,null));};exports['create']=function(_0x1b66b5,_0x2f272f){return db['VoiceChanSpy'][_0xc4b6('0x45')](_0x1b66b5['body'],{})[_0xc4b6('0x24')](function(_0x1cd03f){var _0x28d6f6=_0x1b66b5[_0xc4b6('0x46')][_0xc4b6('0x47')]({'plain':!![]});if(!_0x28d6f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28d6f6[_0xc4b6('0x48')]===_0xc4b6('0x46')){var _0x444b8b=_0x1cd03f[_0xc4b6('0x47')]({'plain':!![]});var _0x3e94df=_0xc4b6('0x26');return db[_0xc4b6('0x49')][_0xc4b6('0x44')]({'where':{'name':_0x3e94df,'userProfileId':_0x28d6f6[_0xc4b6('0x4a')]},'raw':!![]})['then'](function(_0x273c58){if(_0x273c58&&_0x273c58[_0xc4b6('0x4b')]===0x0){return db[_0xc4b6('0x4c')][_0xc4b6('0x45')]({'name':_0x444b8b[_0xc4b6('0x29')],'resourceId':_0x444b8b['id'],'type':_0x273c58[_0xc4b6('0x29')],'sectionId':_0x273c58['id']},{})[_0xc4b6('0x24')](function(){return _0x1cd03f;});}else{return _0x1cd03f;}})[_0xc4b6('0x3f')](function(_0x56d6d7){logger['error'](_0xc4b6('0x4d'),_0x56d6d7);throw _0x56d6d7;});}return _0x1cd03f;})[_0xc4b6('0x24')](respondWithResult(_0x2f272f,0xc9))['catch'](handleError(_0x2f272f,null));};exports[_0xc4b6('0x23')]=function(_0x290cd4,_0xed498b){if(_0x290cd4[_0xc4b6('0x4e')]['id']){delete _0x290cd4[_0xc4b6('0x4e')]['id'];}return db['VoiceChanSpy'][_0xc4b6('0x44')]({'where':{'id':_0x290cd4[_0xc4b6('0x41')]['id']}})['then'](handleEntityNotFound(_0xed498b,null))[_0xc4b6('0x24')](saveUpdates(_0x290cd4[_0xc4b6('0x4e')],null))['then'](respondWithResult(_0xed498b,null))['catch'](handleError(_0xed498b,null));};exports[_0xc4b6('0x25')]=function(_0x5a04f7,_0x4d0bd3){return db[_0xc4b6('0x2b')][_0xc4b6('0x44')]({'where':{'id':_0x5a04f7['params']['id']}})[_0xc4b6('0x24')](handleEntityNotFound(_0x4d0bd3,null))[_0xc4b6('0x24')](removeEntity(_0x4d0bd3,null))['catch'](handleError(_0x4d0bd3,null));}; \ No newline at end of file +var _0x639a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset','undefined','count','set','Content-Range','apply','then','ChanSpies','UserProfileResource','destroy','sendStatus','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','key','keys','filters','model','query','attributes','fields','length','nolimit','limit','order','sort','where','merge','type','filter','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x2079ae,_0x3a65f6){var _0x1655b7=function(_0x491b31){while(--_0x491b31){_0x2079ae['push'](_0x2079ae['shift']());}};_0x1655b7(++_0x3a65f6);}(_0x639a,0xec));var _0xa639=function(_0x54c08f,_0x2eb354){_0x54c08f=_0x54c08f-0x0;var _0x2db736=_0x639a[_0x54c08f];return _0x2db736;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa639('0x0'));var zipdir=require(_0xa639('0x1'));var jsonpatch=require(_0xa639('0x2'));var rp=require(_0xa639('0x3'));var moment=require(_0xa639('0x4'));var BPromise=require(_0xa639('0x5'));var Mustache=require('mustache');var util=require(_0xa639('0x6'));var path=require(_0xa639('0x7'));var sox=require(_0xa639('0x8'));var csv=require('to-csv');var ejs=require(_0xa639('0x9'));var fs=require('fs');var fs_extra=require(_0xa639('0xa'));var _=require(_0xa639('0xb'));var squel=require(_0xa639('0xc'));var crypto=require('crypto');var jsforce=require(_0xa639('0xd'));var deskjs=require(_0xa639('0xe'));var toCsv=require(_0xa639('0xf'));var querystring=require(_0xa639('0x10'));var Papa=require(_0xa639('0x11'));var Redis=require(_0xa639('0x12'));var authService=require(_0xa639('0x13'));var qs=require(_0xa639('0x14'));var as=require(_0xa639('0x15'));var hardwareService=require(_0xa639('0x16'));var logger=require(_0xa639('0x17'))(_0xa639('0x18'));var utils=require(_0xa639('0x19'));var config=require(_0xa639('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba862,_0x2bf30f){_0x2bf30f=_0x2bf30f||0xcc;return function(_0xbd7aec){if(_0xbd7aec){return _0x5ba862['sendStatus'](_0x2bf30f);}return _0x5ba862['status'](_0x2bf30f)[_0xa639('0x1b')]();};}function respondWithResult(_0x1bdc46,_0x4d4b66){_0x4d4b66=_0x4d4b66||0xc8;return function(_0x1df5dd){if(_0x1df5dd){return _0x1bdc46[_0xa639('0x1c')](_0x4d4b66)[_0xa639('0x1d')](_0x1df5dd);}};}function respondWithFilteredResult(_0x49e770,_0xb15138){return function(_0x24f1a9){if(_0x24f1a9){var _0x96a92f=typeof _0xb15138[_0xa639('0x1e')]===_0xa639('0x1f')&&typeof _0xb15138['limit']===_0xa639('0x1f');var _0x4c6311=_0x24f1a9[_0xa639('0x20')];var _0x2e23a9=_0x96a92f?0x0:_0xb15138[_0xa639('0x1e')];var _0x229545=_0x96a92f?_0x24f1a9[_0xa639('0x20')]:_0xb15138['offset']+_0xb15138['limit'];var _0x2a36df;if(_0x229545>=_0x4c6311){_0x229545=_0x4c6311;_0x2a36df=0xc8;}else{_0x2a36df=0xce;}_0x49e770[_0xa639('0x1c')](_0x2a36df);return _0x49e770[_0xa639('0x21')](_0xa639('0x22'),_0x2e23a9+'-'+_0x229545+'/'+_0x4c6311)[_0xa639('0x1d')](_0x24f1a9);}return null;};}function patchUpdates(_0x52500b){return function(_0x5a939f){try{jsonpatch[_0xa639('0x23')](_0x5a939f,_0x52500b,!![]);}catch(_0x5d732c){return BPromise['reject'](_0x5d732c);}return _0x5a939f['save']();};}function saveUpdates(_0x43f85f,_0x28a11c){return function(_0x13592d){if(_0x13592d){return _0x13592d['update'](_0x43f85f)[_0xa639('0x24')](function(_0x562d03){return _0x562d03;});}return null;};}function removeEntity(_0xe89eb9,_0x351a33){return function(_0x55189d){if(_0x55189d){return _0x55189d['destroy']()['then'](function(){var _0x2aeae7=_0x55189d['get']({'plain':!![]});var _0x42b5d8=_0xa639('0x25');return db[_0xa639('0x26')][_0xa639('0x27')]({'where':{'type':_0x42b5d8,'resourceId':_0x2aeae7['id']}})['then'](function(){return _0x55189d;});})[_0xa639('0x24')](function(){_0xe89eb9[_0xa639('0x1c')](0xcc)[_0xa639('0x1b')]();});}};}function handleEntityNotFound(_0x9187a1,_0x3a5dcb){return function(_0x398055){if(!_0x398055){_0x9187a1[_0xa639('0x28')](0x194);}return _0x398055;};}function handleError(_0x48ed86,_0x46caf2){_0x46caf2=_0x46caf2||0x1f4;return function(_0x3cda24){logger['error'](_0x3cda24[_0xa639('0x29')]);if(_0x3cda24[_0xa639('0x2a')]){delete _0x3cda24[_0xa639('0x2a')];}_0x48ed86[_0xa639('0x1c')](_0x46caf2)[_0xa639('0x2b')](_0x3cda24);};}exports['index']=function(_0xd3b825,_0x3e249c){var _0x4e1fc8={},_0x390229={},_0x252b62={'count':0x0,'rows':[]};var _0x39abe7=_[_0xa639('0x2c')](db[_0xa639('0x2d')][_0xa639('0x2e')],function(_0x160d88){return{'name':_0x160d88[_0xa639('0x2f')],'type':_0x160d88['type'][_0xa639('0x30')]};});_0x390229['model']=_[_0xa639('0x2c')](_0x39abe7,_0xa639('0x2a'));_0x390229['query']=_[_0xa639('0x31')](_0xd3b825['query']);_0x390229[_0xa639('0x32')]=_['intersection'](_0x390229[_0xa639('0x33')],_0x390229[_0xa639('0x34')]);_0x4e1fc8[_0xa639('0x35')]=_['intersection'](_0x390229[_0xa639('0x33')],qs[_0xa639('0x36')](_0xd3b825[_0xa639('0x34')][_0xa639('0x36')]));_0x4e1fc8[_0xa639('0x35')]=_0x4e1fc8[_0xa639('0x35')][_0xa639('0x37')]?_0x4e1fc8[_0xa639('0x35')]:_0x390229['model'];if(!_0xd3b825[_0xa639('0x34')]['hasOwnProperty'](_0xa639('0x38'))){_0x4e1fc8[_0xa639('0x39')]=qs['limit'](_0xd3b825[_0xa639('0x34')][_0xa639('0x39')]);_0x4e1fc8[_0xa639('0x1e')]=qs['offset'](_0xd3b825['query'][_0xa639('0x1e')]);}_0x4e1fc8[_0xa639('0x3a')]=qs['sort'](_0xd3b825['query'][_0xa639('0x3b')]);_0x4e1fc8[_0xa639('0x3c')]=qs['filters'](_['pick'](_0xd3b825['query'],_0x390229['filters']),_0x39abe7);if(_0xd3b825[_0xa639('0x34')]['filter']){_0x4e1fc8[_0xa639('0x3c')]=_[_0xa639('0x3d')](_0x4e1fc8[_0xa639('0x3c')],{'$or':_['map'](_0x39abe7,function(_0x4dda49){if(_0x4dda49[_0xa639('0x3e')]!=='VIRTUAL'){var _0x378c5a={};_0x378c5a[_0x4dda49[_0xa639('0x2a')]]={'$like':'%'+_0xd3b825[_0xa639('0x34')][_0xa639('0x3f')]+'%'};return _0x378c5a;}})});}_0x4e1fc8=_[_0xa639('0x3d')]({},_0x4e1fc8,_0xd3b825['options']);var _0x2fd6d3={'where':_0x4e1fc8[_0xa639('0x3c')]};return db[_0xa639('0x2d')][_0xa639('0x20')](_0x2fd6d3)[_0xa639('0x24')](function(_0x4ab7e2){_0x252b62['count']=_0x4ab7e2;if(_0xd3b825[_0xa639('0x34')][_0xa639('0x40')]){_0x4e1fc8['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa639('0x41')](_0x4e1fc8);})[_0xa639('0x24')](function(_0x32805c){_0x252b62[_0xa639('0x42')]=_0x32805c;return _0x252b62;})[_0xa639('0x24')](respondWithFilteredResult(_0x3e249c,_0x4e1fc8))[_0xa639('0x43')](handleError(_0x3e249c,null));};exports[_0xa639('0x44')]=function(_0x288401,_0x3b72c3){var _0x4c93ee={'raw':![],'where':{'id':_0x288401[_0xa639('0x45')]['id']}},_0x1e4f3a={};_0x1e4f3a[_0xa639('0x33')]=_[_0xa639('0x31')](db[_0xa639('0x2d')][_0xa639('0x2e')]);_0x1e4f3a[_0xa639('0x34')]=_['keys'](_0x288401[_0xa639('0x34')]);_0x1e4f3a[_0xa639('0x32')]=_[_0xa639('0x46')](_0x1e4f3a['model'],_0x1e4f3a['query']);_0x4c93ee['attributes']=_[_0xa639('0x46')](_0x1e4f3a['model'],qs[_0xa639('0x36')](_0x288401[_0xa639('0x34')][_0xa639('0x36')]));_0x4c93ee[_0xa639('0x35')]=_0x4c93ee[_0xa639('0x35')][_0xa639('0x37')]?_0x4c93ee[_0xa639('0x35')]:_0x1e4f3a[_0xa639('0x33')];if(_0x288401[_0xa639('0x34')][_0xa639('0x40')]){_0x4c93ee[_0xa639('0x47')]=[{'all':!![]}];}_0x4c93ee=_[_0xa639('0x3d')]({},_0x4c93ee,_0x288401['options']);return db[_0xa639('0x2d')][_0xa639('0x48')](_0x4c93ee)[_0xa639('0x24')](handleEntityNotFound(_0x3b72c3,null))[_0xa639('0x24')](respondWithResult(_0x3b72c3,null))[_0xa639('0x43')](handleError(_0x3b72c3,null));};exports[_0xa639('0x49')]=function(_0x5b3be2,_0x1532ac){return db['VoiceChanSpy'][_0xa639('0x49')](_0x5b3be2[_0xa639('0x4a')],{})['then'](function(_0x46dbd9){var _0x4e3ac9=_0x5b3be2[_0xa639('0x4b')][_0xa639('0x4c')]({'plain':!![]});if(!_0x4e3ac9)throw new Error(_0xa639('0x4d'));if(_0x4e3ac9[_0xa639('0x4e')]===_0xa639('0x4b')){var _0x4dde6c=_0x46dbd9['get']({'plain':!![]});var _0x3d0fef='ChanSpies';return db[_0xa639('0x4f')][_0xa639('0x48')]({'where':{'name':_0x3d0fef,'userProfileId':_0x4e3ac9[_0xa639('0x50')]},'raw':!![]})['then'](function(_0x3e1a96){if(_0x3e1a96&&_0x3e1a96[_0xa639('0x51')]===0x0){return db[_0xa639('0x26')]['create']({'name':_0x4dde6c[_0xa639('0x2a')],'resourceId':_0x4dde6c['id'],'type':_0x3e1a96[_0xa639('0x2a')],'sectionId':_0x3e1a96['id']},{})['then'](function(){return _0x46dbd9;});}else{return _0x46dbd9;}})[_0xa639('0x43')](function(_0x14457c){logger[_0xa639('0x52')](_0xa639('0x53'),_0x14457c);throw _0x14457c;});}return _0x46dbd9;})[_0xa639('0x24')](respondWithResult(_0x1532ac,0xc9))[_0xa639('0x43')](handleError(_0x1532ac,null));};exports[_0xa639('0x54')]=function(_0x24b37e,_0x37e7b2){if(_0x24b37e['body']['id']){delete _0x24b37e[_0xa639('0x4a')]['id'];}return db[_0xa639('0x2d')][_0xa639('0x48')]({'where':{'id':_0x24b37e['params']['id']}})[_0xa639('0x24')](handleEntityNotFound(_0x37e7b2,null))[_0xa639('0x24')](saveUpdates(_0x24b37e[_0xa639('0x4a')],null))[_0xa639('0x24')](respondWithResult(_0x37e7b2,null))['catch'](handleError(_0x37e7b2,null));};exports[_0xa639('0x27')]=function(_0x46a393,_0x599af5){return db[_0xa639('0x2d')]['find']({'where':{'id':_0x46a393[_0xa639('0x45')]['id']}})[_0xa639('0x24')](handleEntityNotFound(_0x599af5,null))['then'](removeEntity(_0x599af5,null))['catch'](handleError(_0x599af5,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 99be694..8e45790 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 _0xa8a6=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record'];(function(_0xe81457,_0xf64918){var _0x346607=function(_0xea90b1){while(--_0xea90b1){_0xe81457['push'](_0xe81457['shift']());}};_0x346607(++_0xf64918);}(_0xa8a6,0xd5));var _0x6a8a=function(_0x1f4ff3,_0x48e8e5){_0x1f4ff3=_0x1f4ff3-0x0;var _0x4d017f=_0xa8a6[_0x1f4ff3];return _0x4d017f;};'use strict';var _=require(_0x6a8a('0x0'));var util=require(_0x6a8a('0x1'));var BPromise=require(_0x6a8a('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3fc6a8,_0x47dc1d,_0x4ddc25){var _0x469ca1=0x1;var _0x16a9f8=[];var _0x19bf40={'context':_0x47dc1d[_0x6a8a('0x3')]||_0x6a8a('0x4'),'exten':util[_0x6a8a('0x5')](_0x6a8a('0x6'),_0x3fc6a8[_0x6a8a('0x7')],_0x4ddc25),'type':_0x6a8a('0x8'),'isApp':![],'ChanSpyId':_0x3fc6a8['id'],'UserId':_0x47dc1d['id']};_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0xb'),'appdata':util[_0x6a8a('0x5')](_0x6a8a('0xc'),_0x6a8a('0xd')),'priority':_0x469ca1++},_0x19bf40));if(_0x3fc6a8[_0x6a8a('0xe')]){_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0xf'),'appdata':util[_0x6a8a('0x5')](_0x6a8a('0x10'),_0x3fc6a8[_0x6a8a('0x11')]),'priority':_0x469ca1++},_0x19bf40));}if(_0x3fc6a8['auth']){_0x16a9f8[_0x6a8a('0x9')](_['merge']({'app':'Authenticate','appdata':_0x3fc6a8[_0x6a8a('0x12')],'priority':_0x469ca1++},_0x19bf40));}_0x16a9f8['push'](_[_0x6a8a('0xa')]({'app':'ChanSpy','appdata':util['format'](_0x6a8a('0x13'),_0x47dc1d['name'],_0x3fc6a8['options']?_0x3fc6a8[_0x6a8a('0x14')][_0x6a8a('0x15')](''):''),'priority':_0x469ca1++},_0x19bf40));if(_0x3fc6a8[_0x6a8a('0xe')]){_0x16a9f8[_0x6a8a('0x9')](_[_0x6a8a('0xa')]({'app':_0x6a8a('0x16'),'priority':_0x469ca1++},_0x19bf40));}return _0x16a9f8;};var getChanSpyApplications=function(_0x32c976,_0x5a40e2){var _0xcccaf6=[];for(var _0x5dcb22=0x0,_0x40fb42=0x1;_0x5dcb22<_0x5a40e2[_0x6a8a('0x17')];_0x5dcb22++,_0x40fb42=0x1){_0xcccaf6=_0xcccaf6[_0x6a8a('0x18')](getUserApplications(_0x32c976,_0x5a40e2[_0x5dcb22],_0x5a40e2[_0x5dcb22][_0x6a8a('0x19')]));if(_0x5a40e2[_0x5dcb22][_0x6a8a('0x19')]!=_0x5a40e2[_0x5dcb22][_0x6a8a('0x1a')]){_0xcccaf6=_0xcccaf6[_0x6a8a('0x18')](getUserApplications(_0x32c976,_0x5a40e2[_0x5dcb22],_0x5a40e2[_0x5dcb22][_0x6a8a('0x1a')]));}}return _0xcccaf6;};var getChanSpyPromise=function(_0x2b4b21,_0x55de2e){return new BPromise(function(_0x5ec39e,_0x109231){return _0x2b4b21[_0x6a8a('0x1b')]['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x6a8a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x6a8a('0x1d')](function(_0x20c0d0){if(_0x20c0d0){return _0x5ec39e(getChanSpyApplications(_0x55de2e,_0x20c0d0));}return _0x5ec39e([]);})[_0x6a8a('0x1e')](function(_0x410318){_0x109231(_0x410318);});});};module[_0x6a8a('0x1f')]=function(_0x56deb0,_0x469235){var _0x413c90=_0x56deb0[_0x6a8a('0x20')];return _0x56deb0[_0x6a8a('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x6a8a('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x478334,_0x5cab07,_0x1663b9){return getChanSpyPromise(_0x413c90,_0x478334)['then'](function(_0x2a5749){if(_0x2a5749&&_0x2a5749[_0x6a8a('0x17')]){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x24')](_0x2a5749);}})[_0x6a8a('0x1d')](function(){_0x1663b9();})[_0x6a8a('0x1e')](function(_0x4c7dd2){_0x1663b9(_0x4c7dd2);});},'afterUpdate':function(_0x14a724,_0x18832a,_0x2725b7){return _0x413c90[_0x6a8a('0x23')]['destroy']({'where':{'ChanSpyId':_0x14a724['id']}})[_0x6a8a('0x1d')](function(){return getChanSpyPromise(_0x413c90,_0x14a724);})[_0x6a8a('0x1d')](function(_0x25a7b9){if(_0x25a7b9&&_0x25a7b9['length']){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x24')](_0x25a7b9);}})[_0x6a8a('0x1d')](function(){_0x2725b7();})[_0x6a8a('0x1e')](function(_0x341c01){_0x2725b7(_0x341c01);});},'afterDestroy':function(_0xf8b2f8,_0x3764f6,_0x207b90){return _0x413c90[_0x6a8a('0x23')][_0x6a8a('0x25')]({'where':{'ChanSpyId':_0xf8b2f8['id']}})[_0x6a8a('0x1d')](function(){_0x207b90();})[_0x6a8a('0x1e')](function(_0x18ed22){_0x207b90(_0x18ed22);});}}});}; \ No newline at end of file +var _0xe646=['voice_chanspy','then','bulkCreate','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','recordingFormat','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','catch','exports','models','define'];(function(_0x488c02,_0x556605){var _0x3cad29=function(_0x3b3146){while(--_0x3b3146){_0x488c02['push'](_0x488c02['shift']());}};_0x3cad29(++_0x556605);}(_0xe646,0x191));var _0x6e64=function(_0x24f7ce,_0x51322a){_0x24f7ce=_0x24f7ce-0x0;var _0x3e910d=_0xe646[_0x24f7ce];return _0x3e910d;};'use strict';var _=require(_0x6e64('0x0'));var util=require('util');var BPromise=require(_0x6e64('0x1'));var attributes=require(_0x6e64('0x2'));var getUserApplications=function(_0x45e6a0,_0x4ec8f6,_0x28eb7f){var _0x59be75=0x1;var _0x106a71=[];var _0x132728={'context':_0x4ec8f6[_0x6e64('0x3')]||_0x6e64('0x4'),'exten':util['format']('%s%s',_0x45e6a0[_0x6e64('0x5')],_0x28eb7f),'type':_0x6e64('0x6'),'isApp':![],'ChanSpyId':_0x45e6a0['id'],'UserId':_0x4ec8f6['id']};_0x106a71[_0x6e64('0x7')](_[_0x6e64('0x8')]({'app':_0x6e64('0x9'),'appdata':util[_0x6e64('0xa')](_0x6e64('0xb'),_0x6e64('0xc')),'priority':_0x59be75++},_0x132728));if(_0x45e6a0[_0x6e64('0xd')]){_0x106a71[_0x6e64('0x7')](_[_0x6e64('0x8')]({'app':'MixMonitor','appdata':util[_0x6e64('0xa')]('${UNIQUEID}.%s,a',_0x45e6a0[_0x6e64('0xe')]),'priority':_0x59be75++},_0x132728));}if(_0x45e6a0['auth']){_0x106a71[_0x6e64('0x7')](_[_0x6e64('0x8')]({'app':_0x6e64('0xf'),'appdata':_0x45e6a0['password'],'priority':_0x59be75++},_0x132728));}_0x106a71[_0x6e64('0x7')](_[_0x6e64('0x8')]({'app':'ChanSpy','appdata':util[_0x6e64('0xa')](_0x6e64('0x10'),_0x4ec8f6[_0x6e64('0x11')],_0x45e6a0[_0x6e64('0x12')]?_0x45e6a0[_0x6e64('0x12')][_0x6e64('0x13')](''):''),'priority':_0x59be75++},_0x132728));if(_0x45e6a0['record']){_0x106a71[_0x6e64('0x7')](_[_0x6e64('0x8')]({'app':_0x6e64('0x14'),'priority':_0x59be75++},_0x132728));}return _0x106a71;};var getChanSpyApplications=function(_0x3aa268,_0x49b1b1){var _0x717f1b=[];for(var _0x202f6c=0x0,_0x1fd357=0x1;_0x202f6c<_0x49b1b1[_0x6e64('0x15')];_0x202f6c++,_0x1fd357=0x1){_0x717f1b=_0x717f1b['concat'](getUserApplications(_0x3aa268,_0x49b1b1[_0x202f6c],_0x49b1b1[_0x202f6c][_0x6e64('0x16')]));if(_0x49b1b1[_0x202f6c]['internal']!=_0x49b1b1[_0x202f6c][_0x6e64('0x11')]){_0x717f1b=_0x717f1b[_0x6e64('0x17')](getUserApplications(_0x3aa268,_0x49b1b1[_0x202f6c],_0x49b1b1[_0x202f6c][_0x6e64('0x11')]));}}return _0x717f1b;};var getChanSpyPromise=function(_0x48a6d6,_0x400adf){return new BPromise(function(_0x452a05,_0x10c2c9){return _0x48a6d6[_0x6e64('0x18')][_0x6e64('0x19')]({'attributes':['id',_0x6e64('0x11'),'internal'],'where':{'role':_0x6e64('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x174743){if(_0x174743){return _0x452a05(getChanSpyApplications(_0x400adf,_0x174743));}return _0x452a05([]);})[_0x6e64('0x1b')](function(_0x4b5107){_0x10c2c9(_0x4b5107);});});};module[_0x6e64('0x1c')]=function(_0x3226b5,_0x2e67f6){var _0x313fa1=_0x3226b5[_0x6e64('0x1d')];return _0x3226b5[_0x6e64('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x6e64('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e87e4,_0x2094fe,_0x2e42f6){return getChanSpyPromise(_0x313fa1,_0x5e87e4)[_0x6e64('0x20')](function(_0x2e2889){if(_0x2e2889&&_0x2e2889[_0x6e64('0x15')]){return _0x313fa1['VoiceExtension'][_0x6e64('0x21')](_0x2e2889);}})[_0x6e64('0x20')](function(){_0x2e42f6();})[_0x6e64('0x1b')](function(_0x556b7a){_0x2e42f6(_0x556b7a);});},'afterUpdate':function(_0xaac5ba,_0x16ed55,_0x189d34){return _0x313fa1['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xaac5ba['id']}})['then'](function(){return getChanSpyPromise(_0x313fa1,_0xaac5ba);})[_0x6e64('0x20')](function(_0x423789){if(_0x423789&&_0x423789[_0x6e64('0x15')]){return _0x313fa1[_0x6e64('0x22')][_0x6e64('0x21')](_0x423789);}})[_0x6e64('0x20')](function(){_0x189d34();})[_0x6e64('0x1b')](function(_0x1ced2d){_0x189d34(_0x1ced2d);});},'afterDestroy':function(_0x1d150a,_0x4a57ce,_0x3404e8){return _0x313fa1[_0x6e64('0x22')][_0x6e64('0x23')]({'where':{'ChanSpyId':_0x1d150a['id']}})[_0x6e64('0x20')](function(){_0x3404e8();})[_0x6e64('0x1b')](function(_0x1e7115){_0x3404e8(_0x1e7115);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 235d379..15d771c 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 _0x765e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x765e,0x131));var _0xe765=function(_0xca1007,_0x320874){_0xca1007=_0xca1007-0x0;var _0x2e871e=_0x765e[_0xca1007];return _0x2e871e;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x562bd3,_0x1f567d){var _0x3d5347=function(_0x5d9063){while(--_0x5d9063){_0x562bd3['push'](_0x562bd3['shift']());}};_0x3d5347(++_0x1f567d);}(_0x878f,0x173));var _0xf878=function(_0x48d642,_0x179383){_0x48d642=_0x48d642-0x0;var _0x1aca0e=_0x878f[_0x48d642];return _0x1aca0e;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5be6a6a..f8769b6 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 _0xd0b2=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x4b5c41,_0x1e8c22){var _0x45df0d=function(_0x25ebb6){while(--_0x25ebb6){_0x4b5c41['push'](_0x4b5c41['shift']());}};_0x45df0d(++_0x1e8c22);}(_0xd0b2,0x1a0));var _0x2d0b=function(_0xcbb5c0,_0x48ea1a){_0xcbb5c0=_0xcbb5c0-0x0;var _0x24f193=_0xd0b2[_0xcbb5c0];return _0x24f193;};'use strict';var multer=require(_0x2d0b('0x0'));var util=require(_0x2d0b('0x1'));var path=require(_0x2d0b('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d0b('0x3'));var router=express[_0x2d0b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d0b('0x6'));var controller=require(_0x2d0b('0x7'));router[_0x2d0b('0x8')]('/',auth[_0x2d0b('0x9')](),controller[_0x2d0b('0xa')]);router[_0x2d0b('0x8')](_0x2d0b('0xb'),auth['isAuthenticated'](),controller[_0x2d0b('0xc')]);router[_0x2d0b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d0b('0xe')](_0x2d0b('0xb'),auth[_0x2d0b('0x9')](),controller['update']);router['delete'](_0x2d0b('0xb'),auth[_0x2d0b('0x9')](),controller[_0x2d0b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x84d2=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x591080,_0x51c610){var _0x21c172=function(_0x2a688e){while(--_0x2a688e){_0x591080['push'](_0x591080['shift']());}};_0x21c172(++_0x51c610);}(_0x84d2,0xcf));var _0x284d=function(_0x3ad619,_0x121015){_0x3ad619=_0x3ad619-0x0;var _0x3a6a69=_0x84d2[_0x3ad619];return _0x3a6a69;};'use strict';var multer=require(_0x284d('0x0'));var util=require(_0x284d('0x1'));var path=require(_0x284d('0x2'));var timeout=require('connect-timeout');var express=require(_0x284d('0x3'));var router=express[_0x284d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x284d('0x5'));var interaction=require(_0x284d('0x6'));var config=require(_0x284d('0x7'));var controller=require(_0x284d('0x8'));router['get']('/',auth[_0x284d('0x9')](),controller[_0x284d('0xa')]);router[_0x284d('0xb')](_0x284d('0xc'),auth[_0x284d('0x9')](),controller[_0x284d('0xd')]);router[_0x284d('0xe')]('/',auth[_0x284d('0x9')](),controller[_0x284d('0xf')]);router[_0x284d('0x10')]('/:id',auth[_0x284d('0x9')](),controller[_0x284d('0x11')]);router[_0x284d('0x12')](_0x284d('0xc'),auth[_0x284d('0x9')](),controller[_0x284d('0x13')]);module[_0x284d('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index b74e360..6e69916 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 _0x2a3a=['sequelize','STRING','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a3a,0x14a));var _0xa2a3=function(_0x48cde1,_0x530178){_0x48cde1=_0x48cde1-0x0;var _0x2d623f=_0x2a3a[_0x48cde1];return _0x2d623f;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module['exports']={'name':{'type':Sequelize[_0xa2a3('0x1')],'unique':_0xa2a3('0x2')},'description':{'type':Sequelize[_0xa2a3('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe909=['STRING','name','exports'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0xe909,0x1df));var _0x9e90=function(_0x401204,_0x53e4de){_0x401204=_0x401204-0x0;var _0x337b84=_0xe909[_0x401204];return _0x337b84;};'use strict';var Sequelize=require('sequelize');module[_0x9e90('0x0')]={'name':{'type':Sequelize[_0x9e90('0x1')],'unique':_0x9e90('0x2')},'description':{'type':Sequelize[_0x9e90('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 347acf4..7ea4a2a 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 _0xaedd=['key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','readFileSync','root','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','render','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','set','json','apply','update','then','destroy','get','Contexts','stack','name','send','VoiceContext','rawAttributes','fieldName','type'];(function(_0x5eed5a,_0x24b098){var _0x268827=function(_0x425e03){while(--_0x425e03){_0x5eed5a['push'](_0x5eed5a['shift']());}};_0x268827(++_0x24b098);}(_0xaedd,0x93));var _0xdaed=function(_0x30c750,_0x4e5eb8){_0x30c750=_0x30c750-0x0;var _0x3d3584=_0xaedd[_0x30c750];return _0x3d3584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdaed('0x0'));var zipdir=require(_0xdaed('0x1'));var jsonpatch=require(_0xdaed('0x2'));var rp=require(_0xdaed('0x3'));var moment=require(_0xdaed('0x4'));var BPromise=require(_0xdaed('0x5'));var Mustache=require(_0xdaed('0x6'));var util=require('util');var path=require(_0xdaed('0x7'));var sox=require(_0xdaed('0x8'));var csv=require(_0xdaed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdaed('0xa'));var _=require(_0xdaed('0xb'));var squel=require(_0xdaed('0xc'));var crypto=require(_0xdaed('0xd'));var jsforce=require(_0xdaed('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdaed('0xf'));var Papa=require(_0xdaed('0x10'));var Redis=require('ioredis');var authService=require(_0xdaed('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdaed('0x12'));var hardwareService=require(_0xdaed('0x13'));var logger=require(_0xdaed('0x14'))(_0xdaed('0x15'));var utils=require(_0xdaed('0x16'));var config=require(_0xdaed('0x17'));var licenseUtil=require(_0xdaed('0x18'));var db=require(_0xdaed('0x19'))['db'];var jayson=require(_0xdaed('0x1a'));var client=jayson[_0xdaed('0x1b')][_0xdaed('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x312c85,_0x29e9c8,_0x2e8818,_0x565aee){return new BPromise(function(_0x262bdb,_0x9d7cae){var _0x18c36c=_0x565aee||client;return _0x18c36c['request'](_0x312c85,_0x2e8818)['then'](function(_0x4d2bc1){logger[_0xdaed('0x1d')](_0xdaed('0x1e'),_0x29e9c8,_0xdaed('0x1f'));logger['debug'](_0xdaed('0x20'),_0x29e9c8,_0xdaed('0x1f'),JSON[_0xdaed('0x21')](_0x4d2bc1));if(_0x4d2bc1[_0xdaed('0x22')]){if(_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x23')]===0x1f4){logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x4d2bc1[_0xdaed('0x22')]['message']);return _0x9d7cae(_0x4d2bc1[_0xdaed('0x22')]['message']);}logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x24')]);return _0x262bdb(_0x4d2bc1[_0xdaed('0x22')][_0xdaed('0x24')]);}else{logger[_0xdaed('0x1d')](_0xdaed('0x1e'),_0x29e9c8,_0xdaed('0x1f'));_0x262bdb(_0x4d2bc1[_0xdaed('0x25')][_0xdaed('0x24')]);}})[_0xdaed('0x26')](function(_0x8ab571){logger[_0xdaed('0x22')](_0xdaed('0x1e'),_0x29e9c8,_0x8ab571);_0x9d7cae(_0x8ab571);});});}function respondWithStatusCode(_0x401b97,_0x290b30){_0x290b30=_0x290b30||0xcc;return function(_0x669783){if(_0x669783){return _0x401b97[_0xdaed('0x27')](_0x290b30);}return _0x401b97['status'](_0x290b30)[_0xdaed('0x28')]();};}function respondWithResult(_0x5f421f,_0x5b06ce){_0x5b06ce=_0x5b06ce||0xc8;return function(_0x395448){if(_0x395448){return _0x5f421f['status'](_0x5b06ce)['json'](_0x395448);}};}function respondWithFilteredResult(_0x4d5f79,_0x1fe5ea){return function(_0x1e2eda){if(_0x1e2eda){var _0xeb9af2=typeof _0x1fe5ea[_0xdaed('0x29')]==='undefined'&&typeof _0x1fe5ea[_0xdaed('0x2a')]===_0xdaed('0x2b');var _0x1f593c=_0x1e2eda[_0xdaed('0x2c')];var _0x30d203=_0xeb9af2?0x0:_0x1fe5ea[_0xdaed('0x29')];var _0x405a11=_0xeb9af2?_0x1e2eda[_0xdaed('0x2c')]:_0x1fe5ea[_0xdaed('0x29')]+_0x1fe5ea[_0xdaed('0x2a')];var _0x12b58a;if(_0x405a11>=_0x1f593c){_0x405a11=_0x1f593c;_0x12b58a=0xc8;}else{_0x12b58a=0xce;}_0x4d5f79[_0xdaed('0x2d')](_0x12b58a);return _0x4d5f79[_0xdaed('0x2e')]('Content-Range',_0x30d203+'-'+_0x405a11+'/'+_0x1f593c)[_0xdaed('0x2f')](_0x1e2eda);}return null;};}function patchUpdates(_0x57a654){return function(_0x49c9a5){try{jsonpatch[_0xdaed('0x30')](_0x49c9a5,_0x57a654,!![]);}catch(_0x48868f){return BPromise['reject'](_0x48868f);}return _0x49c9a5['save']();};}function saveUpdates(_0x237f40,_0x23ff82){return function(_0x534dad){if(_0x534dad){return _0x534dad[_0xdaed('0x31')](_0x237f40)[_0xdaed('0x32')](function(_0xf03707){return _0xf03707;});}return null;};}function removeEntity(_0x4b3430,_0x2431af){return function(_0x3e9cb2){if(_0x3e9cb2){return _0x3e9cb2[_0xdaed('0x33')]()[_0xdaed('0x32')](function(){var _0x2e34a2=_0x3e9cb2[_0xdaed('0x34')]({'plain':!![]});var _0x736ccb=_0xdaed('0x35');return db['UserProfileResource'][_0xdaed('0x33')]({'where':{'type':_0x736ccb,'resourceId':_0x2e34a2['id']}})[_0xdaed('0x32')](function(){return _0x3e9cb2;});})['then'](function(){_0x4b3430[_0xdaed('0x2d')](0xcc)[_0xdaed('0x28')]();});}};}function handleEntityNotFound(_0x1f0084,_0x254427){return function(_0x26ba21){if(!_0x26ba21){_0x1f0084[_0xdaed('0x27')](0x194);}return _0x26ba21;};}function handleError(_0x59dd98,_0x57e928){_0x57e928=_0x57e928||0x1f4;return function(_0x12b9b7){logger['error'](_0x12b9b7[_0xdaed('0x36')]);if(_0x12b9b7[_0xdaed('0x37')]){delete _0x12b9b7[_0xdaed('0x37')];}_0x59dd98['status'](_0x57e928)[_0xdaed('0x38')](_0x12b9b7);};}exports['index']=function(_0x3bc4bf,_0x15388c){var _0x2482b3={},_0x19e137={},_0x4c39ca={'count':0x0,'rows':[]};var _0x32148c=_['map'](db[_0xdaed('0x39')][_0xdaed('0x3a')],function(_0xac05e8){return{'name':_0xac05e8[_0xdaed('0x3b')],'type':_0xac05e8[_0xdaed('0x3c')][_0xdaed('0x3d')]};});_0x19e137['model']=_['map'](_0x32148c,_0xdaed('0x37'));_0x19e137[_0xdaed('0x3e')]=_[_0xdaed('0x3f')](_0x3bc4bf[_0xdaed('0x3e')]);_0x19e137[_0xdaed('0x40')]=_[_0xdaed('0x41')](_0x19e137['model'],_0x19e137[_0xdaed('0x3e')]);_0x2482b3['attributes']=_[_0xdaed('0x41')](_0x19e137[_0xdaed('0x42')],qs['fields'](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x43')]));_0x2482b3[_0xdaed('0x44')]=_0x2482b3[_0xdaed('0x44')]['length']?_0x2482b3[_0xdaed('0x44')]:_0x19e137[_0xdaed('0x42')];if(!_0x3bc4bf[_0xdaed('0x3e')]['hasOwnProperty'](_0xdaed('0x45'))){_0x2482b3[_0xdaed('0x2a')]=qs['limit'](_0x3bc4bf[_0xdaed('0x3e')]['limit']);_0x2482b3[_0xdaed('0x29')]=qs[_0xdaed('0x29')](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x29')]);}_0x2482b3[_0xdaed('0x46')]=qs[_0xdaed('0x47')](_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x47')]);_0x2482b3[_0xdaed('0x48')]=qs[_0xdaed('0x40')](_[_0xdaed('0x49')](_0x3bc4bf[_0xdaed('0x3e')],_0x19e137['filters']),_0x32148c);if(_0x3bc4bf['query'][_0xdaed('0x4a')]){_0x2482b3['where']=_['merge'](_0x2482b3[_0xdaed('0x48')],{'$or':_[_0xdaed('0x4b')](_0x32148c,function(_0x13b25a){if(_0x13b25a[_0xdaed('0x3c')]!==_0xdaed('0x4c')){var _0x2446f0={};_0x2446f0[_0x13b25a['name']]={'$like':'%'+_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x4a')]+'%'};return _0x2446f0;}})});}_0x2482b3=_[_0xdaed('0x4d')]({},_0x2482b3,_0x3bc4bf[_0xdaed('0x4e')]);var _0x2ffa3e={'where':_0x2482b3[_0xdaed('0x48')]};return db[_0xdaed('0x39')][_0xdaed('0x2c')](_0x2ffa3e)[_0xdaed('0x32')](function(_0x209f63){_0x4c39ca[_0xdaed('0x2c')]=_0x209f63;if(_0x3bc4bf[_0xdaed('0x3e')][_0xdaed('0x4f')]){_0x2482b3[_0xdaed('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0xdaed('0x51')](_0x2482b3);})[_0xdaed('0x32')](function(_0x179b81){_0x4c39ca[_0xdaed('0x52')]=_0x179b81;return _0x4c39ca;})['then'](respondWithFilteredResult(_0x15388c,_0x2482b3))[_0xdaed('0x26')](handleError(_0x15388c,null));};exports['show']=function(_0x24283b,_0x25dd24){var _0x5190fc={'raw':![],'where':{'id':_0x24283b[_0xdaed('0x53')]['id']}},_0x231549={};_0x231549[_0xdaed('0x42')]=_[_0xdaed('0x3f')](db[_0xdaed('0x39')][_0xdaed('0x3a')]);_0x231549[_0xdaed('0x3e')]=_[_0xdaed('0x3f')](_0x24283b[_0xdaed('0x3e')]);_0x231549[_0xdaed('0x40')]=_['intersection'](_0x231549['model'],_0x231549[_0xdaed('0x3e')]);_0x5190fc[_0xdaed('0x44')]=_[_0xdaed('0x41')](_0x231549['model'],qs['fields'](_0x24283b['query']['fields']));_0x5190fc[_0xdaed('0x44')]=_0x5190fc[_0xdaed('0x44')]['length']?_0x5190fc[_0xdaed('0x44')]:_0x231549[_0xdaed('0x42')];if(_0x24283b[_0xdaed('0x3e')][_0xdaed('0x4f')]){_0x5190fc[_0xdaed('0x50')]=[{'all':!![]}];}_0x5190fc=_[_0xdaed('0x4d')]({},_0x5190fc,_0x24283b[_0xdaed('0x4e')]);return db[_0xdaed('0x39')][_0xdaed('0x54')](_0x5190fc)['then'](handleEntityNotFound(_0x25dd24,null))['then'](respondWithResult(_0x25dd24,null))[_0xdaed('0x26')](handleError(_0x25dd24,null));};exports['create']=function(_0x5cb0ce,_0x3372d4,_0x25b8b9){var _0x51a05e;return db[_0xdaed('0x39')][_0xdaed('0x55')](_0x5cb0ce['body'],{'raw':!![]})[_0xdaed('0x32')](function(_0x254e25){_0x51a05e=_0x254e25;return db['VoiceContext'][_0xdaed('0x51')]({'raw':!![]});})[_0xdaed('0x32')](function(_0x430e99){var _0x6eff42=fs[_0xdaed('0x56')](path['join'](config[_0xdaed('0x57')],_0xdaed('0x58')),_0xdaed('0x59'));var _0x33437a=ejs['render'](_0x6eff42,{'contexts':_0x430e99||[]});fs[_0xdaed('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x33437a);})[_0xdaed('0x32')](function(){return respondWithRpcPromise(_0xdaed('0x5b'),_0xdaed('0x55'),{'module':_0xdaed('0x5c')});})[_0xdaed('0x32')](function(){var _0x3b7bfa=_0x5cb0ce['user']['get']({'plain':!![]});if(!_0x3b7bfa)throw new Error(_0xdaed('0x5d'));if(_0x3b7bfa[_0xdaed('0x5e')]==='user'){var _0x2717ad=_0x51a05e['get']({'plain':!![]});return db[_0xdaed('0x5f')][_0xdaed('0x54')]({'where':{'name':_0xdaed('0x35'),'userProfileId':_0x3b7bfa[_0xdaed('0x60')]},'raw':!![]})[_0xdaed('0x32')](function(_0x5e56b0){if(_0x5e56b0&&_0x5e56b0[_0xdaed('0x61')]===0x0){return db[_0xdaed('0x62')][_0xdaed('0x55')]({'name':_0x2717ad['name'],'resourceId':_0x2717ad['id'],'type':_0x5e56b0[_0xdaed('0x37')],'sectionId':_0x5e56b0['id']},{})[_0xdaed('0x32')](function(){return _0x51a05e;});}else{return _0x51a05e;}})['catch'](function(_0x23230b){logger[_0xdaed('0x22')](_0xdaed('0x63'),_0x23230b);throw _0x23230b;});}return _0x51a05e;})['then'](respondWithResult(_0x3372d4,0xc9))['catch'](handleError(_0x3372d4,null));};exports[_0xdaed('0x31')]=function(_0x509a2a,_0x558d54,_0x1274b7){var _0x22be0a;return db['VoiceContext'][_0xdaed('0x54')]({'where':{'id':_0x509a2a[_0xdaed('0x53')]['id']}})[_0xdaed('0x32')](handleEntityNotFound(_0x558d54,null))[_0xdaed('0x32')](saveUpdates(_0x509a2a[_0xdaed('0x64')],null))['then'](function(_0x22a727){if(_0x22a727){_0x22be0a=_0x22a727;return db['VoiceContext'][_0xdaed('0x51')]({'raw':!![]});}})['then'](function(_0x3cb080){var _0x357b29=fs[_0xdaed('0x56')](path[_0xdaed('0x65')](config['root'],_0xdaed('0x58')),_0xdaed('0x59'));var _0x201a6d=ejs[_0xdaed('0x66')](_0x357b29,{'contexts':_0x3cb080||[]});fs['writeFileSync'](_0xdaed('0x67'),_0x201a6d);})['then'](function(){return respondWithRpcPromise(_0xdaed('0x5b'),_0xdaed('0x31'),{'module':'chan_sip.so'});})[_0xdaed('0x32')](function(){return _0x22be0a;})[_0xdaed('0x32')](respondWithResult(_0x558d54,null))['catch'](handleError(_0x558d54,null));};exports[_0xdaed('0x33')]=function(_0x3d6bcf,_0x4aa86a,_0x1efd5c){var _0x347aa2;return db['VoiceContext']['find']({'where':{'id':_0x3d6bcf[_0xdaed('0x53')]['id']}})['then'](handleEntityNotFound(_0x4aa86a,null))[_0xdaed('0x32')](removeEntity(_0x4aa86a,null))[_0xdaed('0x32')](function(){return db[_0xdaed('0x39')][_0xdaed('0x51')]({'raw':!![]});})[_0xdaed('0x32')](function(_0x5dfa12){var _0x1299eb=fs['readFileSync'](path[_0xdaed('0x65')](config[_0xdaed('0x57')],_0xdaed('0x58')),'utf8');var _0x41892b=ejs[_0xdaed('0x66')](_0x1299eb,{'contexts':_0x5dfa12});fs[_0xdaed('0x5a')](_0xdaed('0x67'),_0x41892b);return respondWithRpcPromise('Reload',_0xdaed('0x33'),{'module':'chan_sip.so'});})[_0xdaed('0x26')](handleError(_0x4aa86a,null));}; \ No newline at end of file +var _0xa34e=['writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','render','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','then','get','Contexts','UserProfileResource','sendStatus','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','keys','includeAll','find','readFileSync','join','root','utf8'];(function(_0x315c8a,_0x3551e1){var _0x4f617d=function(_0x254bb7){while(--_0x254bb7){_0x315c8a['push'](_0x315c8a['shift']());}};_0x4f617d(++_0x3551e1);}(_0xa34e,0x19e));var _0xea34=function(_0x15da5f,_0x3fce0e){_0x15da5f=_0x15da5f-0x0;var _0x1992f1=_0xa34e[_0x15da5f];return _0x1992f1;};'use strict';var emlformat=require(_0xea34('0x0'));var rimraf=require(_0xea34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea34('0x2'));var rp=require(_0xea34('0x3'));var moment=require(_0xea34('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xea34('0x5'));var csv=require(_0xea34('0x6'));var ejs=require(_0xea34('0x7'));var fs=require('fs');var fs_extra=require(_0xea34('0x8'));var _=require(_0xea34('0x9'));var squel=require(_0xea34('0xa'));var crypto=require(_0xea34('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xea34('0xc'));var toCsv=require('to-csv');var querystring=require(_0xea34('0xd'));var Papa=require(_0xea34('0xe'));var Redis=require(_0xea34('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea34('0x10'));var hardwareService=require(_0xea34('0x11'));var logger=require(_0xea34('0x12'))(_0xea34('0x13'));var utils=require('../../config/utils');var config=require(_0xea34('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xea34('0x15'));var client=jayson[_0xea34('0x16')][_0xea34('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xfd7f30,_0x44f9da,_0x5bcad6,_0x2fba47){return new BPromise(function(_0x57e1d7,_0x31e320){var _0x2d0a44=_0x2fba47||client;return _0x2d0a44[_0xea34('0x18')](_0xfd7f30,_0x5bcad6)['then'](function(_0x462c23){logger[_0xea34('0x19')]('VoiceContext,\x20%s,\x20%s',_0x44f9da,_0xea34('0x1a'));logger[_0xea34('0x1b')](_0xea34('0x1c'),_0x44f9da,'request\x20sent',JSON[_0xea34('0x1d')](_0x462c23));if(_0x462c23['error']){if(_0x462c23[_0xea34('0x1e')][_0xea34('0x1f')]===0x1f4){logger[_0xea34('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x44f9da,_0x462c23[_0xea34('0x1e')][_0xea34('0x20')]);return _0x31e320(_0x462c23[_0xea34('0x1e')][_0xea34('0x20')]);}logger['error'](_0xea34('0x21'),_0x44f9da,_0x462c23[_0xea34('0x1e')][_0xea34('0x20')]);return _0x57e1d7(_0x462c23[_0xea34('0x1e')]['message']);}else{logger[_0xea34('0x19')](_0xea34('0x21'),_0x44f9da,_0xea34('0x1a'));_0x57e1d7(_0x462c23[_0xea34('0x22')]['message']);}})[_0xea34('0x23')](function(_0x261d55){logger[_0xea34('0x1e')](_0xea34('0x21'),_0x44f9da,_0x261d55);_0x31e320(_0x261d55);});});}function respondWithStatusCode(_0x409b90,_0xb1ad45){_0xb1ad45=_0xb1ad45||0xcc;return function(_0x223547){if(_0x223547){return _0x409b90['sendStatus'](_0xb1ad45);}return _0x409b90[_0xea34('0x24')](_0xb1ad45)[_0xea34('0x25')]();};}function respondWithResult(_0x141577,_0xb5bf97){_0xb5bf97=_0xb5bf97||0xc8;return function(_0x4656f3){if(_0x4656f3){return _0x141577['status'](_0xb5bf97)[_0xea34('0x26')](_0x4656f3);}};}function respondWithFilteredResult(_0x549118,_0x71cb02){return function(_0x2dde30){if(_0x2dde30){var _0x29e4d0=typeof _0x71cb02[_0xea34('0x27')]===_0xea34('0x28')&&typeof _0x71cb02['limit']==='undefined';var _0x56b8a3=_0x2dde30[_0xea34('0x29')];var _0xda6f5c=_0x29e4d0?0x0:_0x71cb02[_0xea34('0x27')];var _0x2baa2e=_0x29e4d0?_0x2dde30[_0xea34('0x29')]:_0x71cb02[_0xea34('0x27')]+_0x71cb02['limit'];var _0x41db90;if(_0x2baa2e>=_0x56b8a3){_0x2baa2e=_0x56b8a3;_0x41db90=0xc8;}else{_0x41db90=0xce;}_0x549118['status'](_0x41db90);return _0x549118['set'](_0xea34('0x2a'),_0xda6f5c+'-'+_0x2baa2e+'/'+_0x56b8a3)[_0xea34('0x26')](_0x2dde30);}return null;};}function patchUpdates(_0x2d875f){return function(_0x4c0888){try{jsonpatch[_0xea34('0x2b')](_0x4c0888,_0x2d875f,!![]);}catch(_0x34cc91){return BPromise['reject'](_0x34cc91);}return _0x4c0888[_0xea34('0x2c')]();};}function saveUpdates(_0xb3417d,_0x5a3c08){return function(_0x3d497c){if(_0x3d497c){return _0x3d497c[_0xea34('0x2d')](_0xb3417d)['then'](function(_0x48e642){return _0x48e642;});}return null;};}function removeEntity(_0x28c9aa,_0x3f1097){return function(_0x123ae4){if(_0x123ae4){return _0x123ae4[_0xea34('0x2e')]()[_0xea34('0x2f')](function(){var _0x2f2cb3=_0x123ae4[_0xea34('0x30')]({'plain':!![]});var _0x4d6ba5=_0xea34('0x31');return db[_0xea34('0x32')][_0xea34('0x2e')]({'where':{'type':_0x4d6ba5,'resourceId':_0x2f2cb3['id']}})[_0xea34('0x2f')](function(){return _0x123ae4;});})[_0xea34('0x2f')](function(){_0x28c9aa[_0xea34('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea4b4,_0x22bd4a){return function(_0x476b35){if(!_0x476b35){_0x1ea4b4[_0xea34('0x33')](0x194);}return _0x476b35;};}function handleError(_0x4d0a4b,_0x9ed34e){_0x9ed34e=_0x9ed34e||0x1f4;return function(_0x4e2a50){logger['error'](_0x4e2a50['stack']);if(_0x4e2a50[_0xea34('0x34')]){delete _0x4e2a50[_0xea34('0x34')];}_0x4d0a4b[_0xea34('0x24')](_0x9ed34e)[_0xea34('0x35')](_0x4e2a50);};}exports[_0xea34('0x36')]=function(_0x4433ad,_0x23410f){var _0x87e209={},_0x50216a={},_0x55833d={'count':0x0,'rows':[]};var _0x53c6ca=_[_0xea34('0x37')](db[_0xea34('0x38')][_0xea34('0x39')],function(_0x53c739){return{'name':_0x53c739[_0xea34('0x3a')],'type':_0x53c739['type'][_0xea34('0x3b')]};});_0x50216a[_0xea34('0x3c')]=_[_0xea34('0x37')](_0x53c6ca,_0xea34('0x34'));_0x50216a['query']=_['keys'](_0x4433ad['query']);_0x50216a[_0xea34('0x3d')]=_['intersection'](_0x50216a['model'],_0x50216a['query']);_0x87e209['attributes']=_[_0xea34('0x3e')](_0x50216a[_0xea34('0x3c')],qs[_0xea34('0x3f')](_0x4433ad[_0xea34('0x40')][_0xea34('0x3f')]));_0x87e209[_0xea34('0x41')]=_0x87e209[_0xea34('0x41')][_0xea34('0x42')]?_0x87e209[_0xea34('0x41')]:_0x50216a[_0xea34('0x3c')];if(!_0x4433ad[_0xea34('0x40')][_0xea34('0x43')](_0xea34('0x44'))){_0x87e209[_0xea34('0x45')]=qs[_0xea34('0x45')](_0x4433ad['query'][_0xea34('0x45')]);_0x87e209[_0xea34('0x27')]=qs[_0xea34('0x27')](_0x4433ad['query']['offset']);}_0x87e209['order']=qs[_0xea34('0x46')](_0x4433ad['query'][_0xea34('0x46')]);_0x87e209['where']=qs[_0xea34('0x3d')](_['pick'](_0x4433ad[_0xea34('0x40')],_0x50216a[_0xea34('0x3d')]),_0x53c6ca);if(_0x4433ad[_0xea34('0x40')][_0xea34('0x47')]){_0x87e209[_0xea34('0x48')]=_[_0xea34('0x49')](_0x87e209[_0xea34('0x48')],{'$or':_[_0xea34('0x37')](_0x53c6ca,function(_0x6d455d){if(_0x6d455d['type']!==_0xea34('0x4a')){var _0x28a58e={};_0x28a58e[_0x6d455d[_0xea34('0x34')]]={'$like':'%'+_0x4433ad[_0xea34('0x40')][_0xea34('0x47')]+'%'};return _0x28a58e;}})});}_0x87e209=_['merge']({},_0x87e209,_0x4433ad[_0xea34('0x4b')]);var _0x4650ca={'where':_0x87e209[_0xea34('0x48')]};return db[_0xea34('0x38')][_0xea34('0x29')](_0x4650ca)[_0xea34('0x2f')](function(_0x26ea97){_0x55833d[_0xea34('0x29')]=_0x26ea97;if(_0x4433ad[_0xea34('0x40')]['includeAll']){_0x87e209[_0xea34('0x4c')]=[{'all':!![]}];}return db[_0xea34('0x38')][_0xea34('0x4d')](_0x87e209);})['then'](function(_0x5b3df0){_0x55833d[_0xea34('0x4e')]=_0x5b3df0;return _0x55833d;})[_0xea34('0x2f')](respondWithFilteredResult(_0x23410f,_0x87e209))[_0xea34('0x23')](handleError(_0x23410f,null));};exports['show']=function(_0x3f179f,_0xc08f9c){var _0x2248c7={'raw':![],'where':{'id':_0x3f179f['params']['id']}},_0x24211d={};_0x24211d[_0xea34('0x3c')]=_[_0xea34('0x4f')](db[_0xea34('0x38')][_0xea34('0x39')]);_0x24211d[_0xea34('0x40')]=_[_0xea34('0x4f')](_0x3f179f['query']);_0x24211d[_0xea34('0x3d')]=_[_0xea34('0x3e')](_0x24211d[_0xea34('0x3c')],_0x24211d[_0xea34('0x40')]);_0x2248c7[_0xea34('0x41')]=_[_0xea34('0x3e')](_0x24211d[_0xea34('0x3c')],qs[_0xea34('0x3f')](_0x3f179f[_0xea34('0x40')][_0xea34('0x3f')]));_0x2248c7['attributes']=_0x2248c7[_0xea34('0x41')][_0xea34('0x42')]?_0x2248c7['attributes']:_0x24211d[_0xea34('0x3c')];if(_0x3f179f[_0xea34('0x40')][_0xea34('0x50')]){_0x2248c7[_0xea34('0x4c')]=[{'all':!![]}];}_0x2248c7=_[_0xea34('0x49')]({},_0x2248c7,_0x3f179f['options']);return db[_0xea34('0x38')][_0xea34('0x51')](_0x2248c7)[_0xea34('0x2f')](handleEntityNotFound(_0xc08f9c,null))['then'](respondWithResult(_0xc08f9c,null))[_0xea34('0x23')](handleError(_0xc08f9c,null));};exports['create']=function(_0x9e410e,_0x541c95,_0x39b563){var _0x1a93f0;return db[_0xea34('0x38')]['create'](_0x9e410e['body'],{'raw':!![]})[_0xea34('0x2f')](function(_0x5abadf){_0x1a93f0=_0x5abadf;return db[_0xea34('0x38')]['findAll']({'raw':!![]});})[_0xea34('0x2f')](function(_0x429e16){var _0xc98a60=fs[_0xea34('0x52')](path[_0xea34('0x53')](config[_0xea34('0x54')],'server/files/templates/context.ejs'),_0xea34('0x55'));var _0x4a1bc9=ejs['render'](_0xc98a60,{'contexts':_0x429e16||[]});fs[_0xea34('0x56')](_0xea34('0x57'),_0x4a1bc9);})['then'](function(){return respondWithRpcPromise(_0xea34('0x58'),'create',{'module':_0xea34('0x59')});})[_0xea34('0x2f')](function(){var _0x242b5a=_0x9e410e['user'][_0xea34('0x30')]({'plain':!![]});if(!_0x242b5a)throw new Error(_0xea34('0x5a'));if(_0x242b5a[_0xea34('0x5b')]===_0xea34('0x5c')){var _0x1138ca=_0x1a93f0[_0xea34('0x30')]({'plain':!![]});return db[_0xea34('0x5d')][_0xea34('0x51')]({'where':{'name':_0xea34('0x31'),'userProfileId':_0x242b5a['userProfileId']},'raw':!![]})[_0xea34('0x2f')](function(_0x295259){if(_0x295259&&_0x295259[_0xea34('0x5e')]===0x0){return db[_0xea34('0x32')][_0xea34('0x5f')]({'name':_0x1138ca[_0xea34('0x34')],'resourceId':_0x1138ca['id'],'type':_0x295259[_0xea34('0x34')],'sectionId':_0x295259['id']},{})[_0xea34('0x2f')](function(){return _0x1a93f0;});}else{return _0x1a93f0;}})[_0xea34('0x23')](function(_0x4b48c2){logger[_0xea34('0x1e')](_0xea34('0x60'),_0x4b48c2);throw _0x4b48c2;});}return _0x1a93f0;})[_0xea34('0x2f')](respondWithResult(_0x541c95,0xc9))[_0xea34('0x23')](handleError(_0x541c95,null));};exports[_0xea34('0x2d')]=function(_0x5a805b,_0x525c73,_0x517919){var _0x493f82;return db[_0xea34('0x38')][_0xea34('0x51')]({'where':{'id':_0x5a805b[_0xea34('0x61')]['id']}})[_0xea34('0x2f')](handleEntityNotFound(_0x525c73,null))[_0xea34('0x2f')](saveUpdates(_0x5a805b[_0xea34('0x62')],null))[_0xea34('0x2f')](function(_0x3f24ff){if(_0x3f24ff){_0x493f82=_0x3f24ff;return db[_0xea34('0x38')][_0xea34('0x4d')]({'raw':!![]});}})['then'](function(_0x316841){var _0x519b6d=fs['readFileSync'](path[_0xea34('0x53')](config[_0xea34('0x54')],'server/files/templates/context.ejs'),_0xea34('0x55'));var _0xa0f391=ejs['render'](_0x519b6d,{'contexts':_0x316841||[]});fs[_0xea34('0x56')](_0xea34('0x57'),_0xa0f391);})[_0xea34('0x2f')](function(){return respondWithRpcPromise(_0xea34('0x58'),_0xea34('0x2d'),{'module':_0xea34('0x59')});})['then'](function(){return _0x493f82;})[_0xea34('0x2f')](respondWithResult(_0x525c73,null))[_0xea34('0x23')](handleError(_0x525c73,null));};exports[_0xea34('0x2e')]=function(_0x2fb50e,_0x10adeb,_0x54d4cf){var _0x209a23;return db[_0xea34('0x38')]['find']({'where':{'id':_0x2fb50e[_0xea34('0x61')]['id']}})[_0xea34('0x2f')](handleEntityNotFound(_0x10adeb,null))['then'](removeEntity(_0x10adeb,null))[_0xea34('0x2f')](function(){return db[_0xea34('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x2f83dd){var _0x1b2834=fs[_0xea34('0x52')](path[_0xea34('0x53')](config['root'],'server/files/templates/context.ejs'),_0xea34('0x55'));var _0x1ebc9e=ejs[_0xea34('0x63')](_0x1b2834,{'contexts':_0x2f83dd});fs[_0xea34('0x56')](_0xea34('0x57'),_0x1ebc9e);return respondWithRpcPromise(_0xea34('0x58'),_0xea34('0x2e'),{'module':_0xea34('0x59')});})[_0xea34('0x23')](handleError(_0x10adeb,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 029f800..7333498 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 _0xfa16=['./voiceContext.attributes','define','VoiceContext','voice_contexts','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44e2ab,_0x27f72c){var _0x4a0849=function(_0x490b69){while(--_0x490b69){_0x44e2ab['push'](_0x44e2ab['shift']());}};_0x4a0849(++_0x27f72c);}(_0xfa16,0x12d));var _0x6fa1=function(_0x12ef58,_0x56813c){_0x12ef58=_0x12ef58-0x0;var _0x7c9db0=_0xfa16[_0x12ef58];return _0x7c9db0;};'use strict';var _=require('lodash');var util=require(_0x6fa1('0x0'));var logger=require('../../config/logger')(_0x6fa1('0x1'));var moment=require(_0x6fa1('0x2'));var BPromise=require(_0x6fa1('0x3'));var rp=require(_0x6fa1('0x4'));var fs=require('fs');var path=require(_0x6fa1('0x5'));var rimraf=require(_0x6fa1('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fa1('0x7'));module['exports']=function(_0x34b8aa,_0xcbb5b3){return _0x34b8aa[_0x6fa1('0x8')](_0x6fa1('0x9'),attributes,{'tableName':_0x6fa1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d5=['rimraf','../../config/environment','./voiceContext.attributes','define','voice_contexts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x16d5,0xe9));var _0x516d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x516d('0x0'));var util=require(_0x516d('0x1'));var logger=require('../../config/logger')(_0x516d('0x2'));var moment=require(_0x516d('0x3'));var BPromise=require(_0x516d('0x4'));var rp=require(_0x516d('0x5'));var fs=require('fs');var path=require(_0x516d('0x6'));var rimraf=require(_0x516d('0x7'));var config=require(_0x516d('0x8'));var attributes=require(_0x516d('0x9'));module['exports']=function(_0x389dfc,_0x11a6b4){return _0x389dfc[_0x516d('0xa')]('VoiceContext',attributes,{'tableName':_0x516d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 050b76f..53dab36 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 _0x7184=['error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e206b,_0x42548b){var _0x2755cc=function(_0x518f34){while(--_0x518f34){_0x2e206b['push'](_0x2e206b['shift']());}};_0x2755cc(++_0x42548b);}(_0x7184,0xd5));var _0x4718=function(_0x1f5048,_0x35594a){_0x1f5048=_0x1f5048-0x0;var _0x4f17fd=_0x7184[_0x1f5048];return _0x4f17fd;};'use strict';var _=require(_0x4718('0x0'));var util=require(_0x4718('0x1'));var moment=require('moment');var BPromise=require(_0x4718('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4718('0x3'));var db=require(_0x4718('0x4'))['db'];var utils=require(_0x4718('0x5'));var logger=require(_0x4718('0x6'))(_0x4718('0x7'));var config=require('../../config/environment');var jayson=require(_0x4718('0x8'));var client=jayson[_0x4718('0x9')][_0x4718('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594c73,_0x5bf1ea,_0x4b808b){return new BPromise(function(_0x22f6ab,_0x40e5a9){return client['request'](_0x594c73,_0x4b808b)[_0x4718('0xb')](function(_0x9c2ebe){logger[_0x4718('0xc')](_0x4718('0xd'),_0x5bf1ea,_0x4718('0xe'));logger[_0x4718('0xf')](_0x4718('0x10'),_0x5bf1ea,'request\x20sent',JSON[_0x4718('0x11')](_0x9c2ebe));if(_0x9c2ebe[_0x4718('0x12')]){if(_0x9c2ebe[_0x4718('0x12')]['code']===0x1f4){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')]['message']);return _0x40e5a9(_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);}logger[_0x4718('0x12')]('VoiceContext,\x20%s,\x20%s',_0x5bf1ea,_0x9c2ebe[_0x4718('0x12')][_0x4718('0x13')]);return _0x22f6ab(_0x9c2ebe['error'][_0x4718('0x13')]);}else{logger[_0x4718('0xc')]('VoiceContext,\x20%s,\x20%s',_0x5bf1ea,_0x4718('0xe'));_0x22f6ab(_0x9c2ebe['result'][_0x4718('0x13')]);}})[_0x4718('0x14')](function(_0x3f25d5){logger['error'](_0x4718('0xd'),_0x5bf1ea,_0x3f25d5);_0x40e5a9(_0x3f25d5);});});} \ No newline at end of file +var _0x6f24=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x291f8b,_0x3a761f){var _0xac740e=function(_0x37289e){while(--_0x37289e){_0x291f8b['push'](_0x291f8b['shift']());}};_0xac740e(++_0x3a761f);}(_0x6f24,0x76));var _0x46f2=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x6f24[_0x934425];return _0x31d596;};'use strict';var _=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var moment=require('moment');var BPromise=require(_0x46f2('0x2'));var rs=require(_0x46f2('0x3'));var fs=require('fs');var Redis=require(_0x46f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46f2('0x5'));var logger=require('../../config/logger')(_0x46f2('0x6'));var config=require(_0x46f2('0x7'));var jayson=require(_0x46f2('0x8'));var client=jayson[_0x46f2('0x9')][_0x46f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51d8b6,_0x12d539,_0xd8ec3d){return new BPromise(function(_0x246924,_0x5082c5){return client[_0x46f2('0xb')](_0x51d8b6,_0xd8ec3d)[_0x46f2('0xc')](function(_0x364fc8){logger[_0x46f2('0xd')]('VoiceContext,\x20%s,\x20%s',_0x12d539,'request\x20sent');logger[_0x46f2('0xe')](_0x46f2('0xf'),_0x12d539,_0x46f2('0x10'),JSON[_0x46f2('0x11')](_0x364fc8));if(_0x364fc8['error']){if(_0x364fc8[_0x46f2('0x12')][_0x46f2('0x13')]===0x1f4){logger[_0x46f2('0x12')](_0x46f2('0x14'),_0x12d539,_0x364fc8['error'][_0x46f2('0x15')]);return _0x5082c5(_0x364fc8[_0x46f2('0x12')][_0x46f2('0x15')]);}logger[_0x46f2('0x12')](_0x46f2('0x14'),_0x12d539,_0x364fc8[_0x46f2('0x12')][_0x46f2('0x15')]);return _0x246924(_0x364fc8[_0x46f2('0x12')][_0x46f2('0x15')]);}else{logger[_0x46f2('0xd')](_0x46f2('0x14'),_0x12d539,_0x46f2('0x10'));_0x246924(_0x364fc8[_0x46f2('0x16')][_0x46f2('0x15')]);}})[_0x46f2('0x17')](function(_0x4125db){logger[_0x46f2('0x12')](_0x46f2('0x14'),_0x12d539,_0x4125db);_0x5082c5(_0x4125db);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index e81621a..98adc74 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 _0xad95=['multer','util','path','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','describe','create','put','update','/:id','destroy','exports'];(function(_0x515a76,_0x145b39){var _0x4ea72b=function(_0x3684ad){while(--_0x3684ad){_0x515a76['push'](_0x515a76['shift']());}};_0x4ea72b(++_0x145b39);}(_0xad95,0x70));var _0x5ad9=function(_0x235a64,_0x3f61b6){_0x235a64=_0x235a64-0x0;var _0x212cc0=_0xad95[_0x235a64];return _0x212cc0;};'use strict';var multer=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var path=require(_0x5ad9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5ad9('0x3')]();var fs_extra=require(_0x5ad9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ad9('0x5'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5ad9('0x6')](_0x5ad9('0x7'),auth[_0x5ad9('0x8')](),controller[_0x5ad9('0x9')]);router[_0x5ad9('0x6')]('/:id',auth[_0x5ad9('0x8')](),controller['show']);router['post']('/',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xa')]);router[_0x5ad9('0xb')]('/:id',auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xc')]);router['delete'](_0x5ad9('0xd'),auth[_0x5ad9('0x8')](),controller[_0x5ad9('0xe')]);module[_0x5ad9('0xf')]=router; \ No newline at end of file +var _0x1e1a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1e1a,0x86));var _0xa1e1=function(_0x31bde6,_0x2f8709){_0x31bde6=_0x31bde6-0x0;var _0x23a0d3=_0x1e1a[_0x31bde6];return _0x23a0d3;};'use strict';var multer=require(_0xa1e1('0x0'));var util=require(_0xa1e1('0x1'));var path=require(_0xa1e1('0x2'));var timeout=require(_0xa1e1('0x3'));var express=require('express');var router=express[_0xa1e1('0x4')]();var fs_extra=require(_0xa1e1('0x5'));var auth=require(_0xa1e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1e1('0x7'));var controller=require('./voiceDialReport.controller');router[_0xa1e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xa1e1('0x9')]);router['get'](_0xa1e1('0xa'),auth[_0xa1e1('0xb')](),controller[_0xa1e1('0xc')]);router[_0xa1e1('0x8')](_0xa1e1('0xd'),auth[_0xa1e1('0xb')](),controller[_0xa1e1('0xe')]);router[_0xa1e1('0xf')]('/',auth[_0xa1e1('0xb')](),controller[_0xa1e1('0x10')]);router[_0xa1e1('0x11')](_0xa1e1('0xd'),auth[_0xa1e1('0xb')](),controller[_0xa1e1('0x12')]);router[_0xa1e1('0x13')](_0xa1e1('0xd'),auth[_0xa1e1('0xb')](),controller[_0xa1e1('0x14')]);module[_0xa1e1('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0c2e764..63ef365 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 _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x4115b4,_0x121c42){var _0x28a416=function(_0x20219b){while(--_0x20219b){_0x4115b4['push'](_0x4115b4['shift']());}};_0x28a416(++_0x121c42);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x24ca[_0x3792e6];return _0x441e44;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x5d6f53,_0x7c7514){var _0x50d4b1=function(_0x542420){while(--_0x542420){_0x5d6f53['push'](_0x5d6f53['shift']());}};_0x50d4b1(++_0x7c7514);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f7708d3..88f26c5 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 _0x2b87=['catch','show','params','keys','options','find','create','body','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/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows'];(function(_0x3b5632,_0x3a0a3b){var _0x23a64e=function(_0x4ca252){while(--_0x4ca252){_0x3b5632['push'](_0x3b5632['shift']());}};_0x23a64e(++_0x3a0a3b);}(_0x2b87,0x18f));var _0x72b8=function(_0x28fb62,_0x4c3548){_0x28fb62=_0x28fb62-0x0;var _0x1f7e81=_0x2b87[_0x28fb62];return _0x1f7e81;};'use strict';var emlformat=require(_0x72b8('0x0'));var rimraf=require(_0x72b8('0x1'));var zipdir=require(_0x72b8('0x2'));var jsonpatch=require(_0x72b8('0x3'));var rp=require(_0x72b8('0x4'));var moment=require(_0x72b8('0x5'));var BPromise=require(_0x72b8('0x6'));var Mustache=require('mustache');var util=require(_0x72b8('0x7'));var path=require(_0x72b8('0x8'));var sox=require('sox');var csv=require(_0x72b8('0x9'));var ejs=require(_0x72b8('0xa'));var fs=require('fs');var fs_extra=require(_0x72b8('0xb'));var _=require(_0x72b8('0xc'));var squel=require(_0x72b8('0xd'));var crypto=require(_0x72b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72b8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x72b8('0x10'));var Redis=require(_0x72b8('0x11'));var authService=require(_0x72b8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72b8('0x13'));var hardwareService=require(_0x72b8('0x14'));var logger=require('../../config/logger')(_0x72b8('0x15'));var utils=require(_0x72b8('0x16'));var config=require(_0x72b8('0x17'));var licenseUtil=require(_0x72b8('0x18'));var db=require(_0x72b8('0x19'))['db'];function respondWithStatusCode(_0x3b7f91,_0x55cb32){_0x55cb32=_0x55cb32||0xcc;return function(_0x1c0881){if(_0x1c0881){return _0x3b7f91[_0x72b8('0x1a')](_0x55cb32);}return _0x3b7f91['status'](_0x55cb32)[_0x72b8('0x1b')]();};}function respondWithResult(_0x2c9650,_0x2be0d7){_0x2be0d7=_0x2be0d7||0xc8;return function(_0x4e6c94){if(_0x4e6c94){return _0x2c9650[_0x72b8('0x1c')](_0x2be0d7)[_0x72b8('0x1d')](_0x4e6c94);}};}function respondWithFilteredResult(_0x3def83,_0x13e2f7){return function(_0x1b497c){if(_0x1b497c){var _0x4435e1=typeof _0x13e2f7[_0x72b8('0x1e')]===_0x72b8('0x1f')&&typeof _0x13e2f7['limit']===_0x72b8('0x1f');var _0x50e21d=_0x1b497c[_0x72b8('0x20')];var _0x8c91a4=_0x4435e1?0x0:_0x13e2f7[_0x72b8('0x1e')];var _0x1c14d1=_0x4435e1?_0x1b497c['count']:_0x13e2f7[_0x72b8('0x1e')]+_0x13e2f7[_0x72b8('0x21')];var _0x588df2;if(_0x1c14d1>=_0x50e21d){_0x1c14d1=_0x50e21d;_0x588df2=0xc8;}else{_0x588df2=0xce;}_0x3def83[_0x72b8('0x1c')](_0x588df2);return _0x3def83['set'](_0x72b8('0x22'),_0x8c91a4+'-'+_0x1c14d1+'/'+_0x50e21d)['json'](_0x1b497c);}return null;};}function patchUpdates(_0x38fd15){return function(_0x2b911e){try{jsonpatch[_0x72b8('0x23')](_0x2b911e,_0x38fd15,!![]);}catch(_0x153e74){return BPromise[_0x72b8('0x24')](_0x153e74);}return _0x2b911e[_0x72b8('0x25')]();};}function saveUpdates(_0x4438e5,_0x31f077){return function(_0x314bef){if(_0x314bef){return _0x314bef[_0x72b8('0x26')](_0x4438e5)['then'](function(_0x36f5c0){return _0x36f5c0;});}return null;};}function removeEntity(_0x2a7f7e,_0x18ad7d){return function(_0x589209){if(_0x589209){return _0x589209['destroy']()[_0x72b8('0x27')](function(){_0x2a7f7e[_0x72b8('0x1c')](0xcc)[_0x72b8('0x1b')]();});}};}function handleEntityNotFound(_0x1520b4,_0x3df34c){return function(_0x604f14){if(!_0x604f14){_0x1520b4[_0x72b8('0x1a')](0x194);}return _0x604f14;};}function handleError(_0x274fbf,_0x8ff206){_0x8ff206=_0x8ff206||0x1f4;return function(_0x8abf0b){logger['error'](_0x8abf0b[_0x72b8('0x28')]);if(_0x8abf0b[_0x72b8('0x29')]){delete _0x8abf0b[_0x72b8('0x29')];}_0x274fbf[_0x72b8('0x1c')](_0x8ff206)[_0x72b8('0x2a')](_0x8abf0b);};}exports[_0x72b8('0x2b')]=function(_0x3bac0b,_0x4e1d0b){var _0x1bcdfb={},_0x367d2c={},_0x4cf6c8={'count':0x0,'rows':[]};var _0x23f31=_[_0x72b8('0x2c')](db[_0x72b8('0x2d')][_0x72b8('0x2e')],function(_0x487dc7){return{'name':_0x487dc7[_0x72b8('0x2f')],'type':_0x487dc7[_0x72b8('0x30')][_0x72b8('0x31')]};});_0x367d2c[_0x72b8('0x32')]=_[_0x72b8('0x2c')](_0x23f31,'name');_0x367d2c[_0x72b8('0x33')]=_['keys'](_0x3bac0b[_0x72b8('0x33')]);_0x367d2c[_0x72b8('0x34')]=_[_0x72b8('0x35')](_0x367d2c['model'],_0x367d2c[_0x72b8('0x33')]);_0x1bcdfb[_0x72b8('0x36')]=_['intersection'](_0x367d2c[_0x72b8('0x32')],qs[_0x72b8('0x37')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x37')]));_0x1bcdfb['attributes']=_0x1bcdfb[_0x72b8('0x36')][_0x72b8('0x38')]?_0x1bcdfb[_0x72b8('0x36')]:_0x367d2c['model'];if(!_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x39')](_0x72b8('0x3a'))){_0x1bcdfb[_0x72b8('0x21')]=qs[_0x72b8('0x21')](_0x3bac0b['query']['limit']);_0x1bcdfb[_0x72b8('0x1e')]=qs[_0x72b8('0x1e')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x1e')]);}_0x1bcdfb[_0x72b8('0x3b')]=qs[_0x72b8('0x3c')](_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x3c')]);_0x1bcdfb[_0x72b8('0x3d')]=qs[_0x72b8('0x34')](_[_0x72b8('0x3e')](_0x3bac0b['query'],_0x367d2c[_0x72b8('0x34')]),_0x23f31);if(_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x3f')]){_0x1bcdfb[_0x72b8('0x3d')]=_['merge'](_0x1bcdfb[_0x72b8('0x3d')],{'$or':_[_0x72b8('0x2c')](_0x23f31,function(_0x588a3a){if(_0x588a3a[_0x72b8('0x30')]!==_0x72b8('0x40')){var _0x28b2e8={};_0x28b2e8[_0x588a3a[_0x72b8('0x29')]]={'$like':'%'+_0x3bac0b['query'][_0x72b8('0x3f')]+'%'};return _0x28b2e8;}})});}_0x1bcdfb=_[_0x72b8('0x41')]({},_0x1bcdfb,_0x3bac0b['options']);var _0x1b4793={'where':_0x1bcdfb['where']};return db[_0x72b8('0x2d')][_0x72b8('0x20')](_0x1b4793)[_0x72b8('0x27')](function(_0x2a0ebc){_0x4cf6c8[_0x72b8('0x20')]=_0x2a0ebc;if(_0x3bac0b[_0x72b8('0x33')][_0x72b8('0x42')]){_0x1bcdfb[_0x72b8('0x43')]=[{'all':!![]}];}return db[_0x72b8('0x2d')]['findAll'](_0x1bcdfb);})['then'](function(_0x3d128c){_0x4cf6c8[_0x72b8('0x44')]=_0x3d128c;return _0x4cf6c8;})[_0x72b8('0x27')](respondWithFilteredResult(_0x4e1d0b,_0x1bcdfb))[_0x72b8('0x45')](handleError(_0x4e1d0b,null));};exports[_0x72b8('0x46')]=function(_0x3be04b,_0x5e1fbf){var _0x4b3637={'raw':!![],'where':{'id':_0x3be04b[_0x72b8('0x47')]['id']}},_0x41c257={};_0x41c257['model']=_[_0x72b8('0x48')](db['VoiceDialReport'][_0x72b8('0x2e')]);_0x41c257[_0x72b8('0x33')]=_[_0x72b8('0x48')](_0x3be04b[_0x72b8('0x33')]);_0x41c257[_0x72b8('0x34')]=_[_0x72b8('0x35')](_0x41c257[_0x72b8('0x32')],_0x41c257['query']);_0x4b3637['attributes']=_[_0x72b8('0x35')](_0x41c257[_0x72b8('0x32')],qs[_0x72b8('0x37')](_0x3be04b[_0x72b8('0x33')]['fields']));_0x4b3637[_0x72b8('0x36')]=_0x4b3637[_0x72b8('0x36')]['length']?_0x4b3637[_0x72b8('0x36')]:_0x41c257[_0x72b8('0x32')];if(_0x3be04b[_0x72b8('0x33')][_0x72b8('0x42')]){_0x4b3637[_0x72b8('0x43')]=[{'all':!![]}];}_0x4b3637=_[_0x72b8('0x41')]({},_0x4b3637,_0x3be04b[_0x72b8('0x49')]);return db[_0x72b8('0x2d')][_0x72b8('0x4a')](_0x4b3637)['then'](handleEntityNotFound(_0x5e1fbf,null))[_0x72b8('0x27')](respondWithResult(_0x5e1fbf,null))[_0x72b8('0x45')](handleError(_0x5e1fbf,null));};exports[_0x72b8('0x4b')]=function(_0x5436d7,_0x4f9149){return db[_0x72b8('0x2d')]['create'](_0x5436d7[_0x72b8('0x4c')],{})[_0x72b8('0x27')](respondWithResult(_0x4f9149,0xc9))[_0x72b8('0x45')](handleError(_0x4f9149,null));};exports[_0x72b8('0x26')]=function(_0x20ebe4,_0x3439ba){if(_0x20ebe4[_0x72b8('0x4c')]['id']){delete _0x20ebe4[_0x72b8('0x4c')]['id'];}return db[_0x72b8('0x2d')][_0x72b8('0x4a')]({'where':{'id':_0x20ebe4[_0x72b8('0x47')]['id']}})[_0x72b8('0x27')](handleEntityNotFound(_0x3439ba,null))[_0x72b8('0x27')](saveUpdates(_0x20ebe4[_0x72b8('0x4c')],null))[_0x72b8('0x27')](respondWithResult(_0x3439ba,null))[_0x72b8('0x45')](handleError(_0x3439ba,null));};exports['destroy']=function(_0x2111cd,_0x477578){return db['VoiceDialReport']['find']({'where':{'id':_0x2111cd['params']['id']}})[_0x72b8('0x27')](handleEntityNotFound(_0x477578,null))['then'](removeEntity(_0x477578,null))['catch'](handleError(_0x477578,null));};exports[_0x72b8('0x4d')]=function(_0x4461b0,_0x447d30){return db['VoiceDialReport']['describe']()[_0x72b8('0x27')](respondWithResult(_0x447d30,null))[_0x72b8('0x45')](handleError(_0x447d30,null));}; \ No newline at end of file +var _0x90f3=['fast-json-patch','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x2ddf26,_0x226182){var _0x24c484=function(_0xd3f3a5){while(--_0xd3f3a5){_0x2ddf26['push'](_0x2ddf26['shift']());}};_0x24c484(++_0x226182);}(_0x90f3,0x16f));var _0x390f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x90f3[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x390f('0x0'));var rimraf=require(_0x390f('0x1'));var zipdir=require(_0x390f('0x2'));var jsonpatch=require(_0x390f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x390f('0x4'));var util=require(_0x390f('0x5'));var path=require('path');var sox=require(_0x390f('0x6'));var csv=require('to-csv');var ejs=require(_0x390f('0x7'));var fs=require('fs');var fs_extra=require(_0x390f('0x8'));var _=require(_0x390f('0x9'));var squel=require('squel');var crypto=require(_0x390f('0xa'));var jsforce=require(_0x390f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x390f('0xc'));var querystring=require(_0x390f('0xd'));var Papa=require(_0x390f('0xe'));var Redis=require(_0x390f('0xf'));var authService=require(_0x390f('0x10'));var qs=require(_0x390f('0x11'));var as=require(_0x390f('0x12'));var hardwareService=require(_0x390f('0x13'));var logger=require(_0x390f('0x14'))(_0x390f('0x15'));var utils=require('../../config/utils');var config=require(_0x390f('0x16'));var licenseUtil=require(_0x390f('0x17'));var db=require(_0x390f('0x18'))['db'];function respondWithStatusCode(_0x15f421,_0x76517e){_0x76517e=_0x76517e||0xcc;return function(_0xa8071a){if(_0xa8071a){return _0x15f421[_0x390f('0x19')](_0x76517e);}return _0x15f421['status'](_0x76517e)['end']();};}function respondWithResult(_0xd6cadd,_0x596a45){_0x596a45=_0x596a45||0xc8;return function(_0x51efe9){if(_0x51efe9){return _0xd6cadd[_0x390f('0x1a')](_0x596a45)['json'](_0x51efe9);}};}function respondWithFilteredResult(_0x39fd31,_0x2331d1){return function(_0xc59f74){if(_0xc59f74){var _0x26176c=typeof _0x2331d1[_0x390f('0x1b')]===_0x390f('0x1c')&&typeof _0x2331d1['limit']==='undefined';var _0x12b998=_0xc59f74['count'];var _0x280be2=_0x26176c?0x0:_0x2331d1['offset'];var _0x1d01a6=_0x26176c?_0xc59f74[_0x390f('0x1d')]:_0x2331d1['offset']+_0x2331d1[_0x390f('0x1e')];var _0x4b0799;if(_0x1d01a6>=_0x12b998){_0x1d01a6=_0x12b998;_0x4b0799=0xc8;}else{_0x4b0799=0xce;}_0x39fd31[_0x390f('0x1a')](_0x4b0799);return _0x39fd31['set'](_0x390f('0x1f'),_0x280be2+'-'+_0x1d01a6+'/'+_0x12b998)[_0x390f('0x20')](_0xc59f74);}return null;};}function patchUpdates(_0x36cc6d){return function(_0x156755){try{jsonpatch[_0x390f('0x21')](_0x156755,_0x36cc6d,!![]);}catch(_0x3ef1f4){return BPromise['reject'](_0x3ef1f4);}return _0x156755[_0x390f('0x22')]();};}function saveUpdates(_0x46546a,_0x5215ee){return function(_0x2a2eeb){if(_0x2a2eeb){return _0x2a2eeb[_0x390f('0x23')](_0x46546a)[_0x390f('0x24')](function(_0xfeb16d){return _0xfeb16d;});}return null;};}function removeEntity(_0x1f46cd,_0x4591d3){return function(_0x426303){if(_0x426303){return _0x426303[_0x390f('0x25')]()[_0x390f('0x24')](function(){_0x1f46cd[_0x390f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4775,_0x1cdeb3){return function(_0x4c9019){if(!_0x4c9019){_0x3f4775[_0x390f('0x19')](0x194);}return _0x4c9019;};}function handleError(_0x44983f,_0x1d5f52){_0x1d5f52=_0x1d5f52||0x1f4;return function(_0x103e0b){logger[_0x390f('0x26')](_0x103e0b[_0x390f('0x27')]);if(_0x103e0b[_0x390f('0x28')]){delete _0x103e0b[_0x390f('0x28')];}_0x44983f[_0x390f('0x1a')](_0x1d5f52)[_0x390f('0x29')](_0x103e0b);};}exports[_0x390f('0x2a')]=function(_0x460a5b,_0x5a7af2){var _0x524b4b={},_0x4f3130={},_0x1f9876={'count':0x0,'rows':[]};var _0x287444=_['map'](db[_0x390f('0x2b')]['rawAttributes'],function(_0x40649e){return{'name':_0x40649e['fieldName'],'type':_0x40649e[_0x390f('0x2c')][_0x390f('0x2d')]};});_0x4f3130[_0x390f('0x2e')]=_[_0x390f('0x2f')](_0x287444,_0x390f('0x28'));_0x4f3130[_0x390f('0x30')]=_[_0x390f('0x31')](_0x460a5b[_0x390f('0x30')]);_0x4f3130[_0x390f('0x32')]=_['intersection'](_0x4f3130[_0x390f('0x2e')],_0x4f3130[_0x390f('0x30')]);_0x524b4b[_0x390f('0x33')]=_[_0x390f('0x34')](_0x4f3130[_0x390f('0x2e')],qs['fields'](_0x460a5b[_0x390f('0x30')][_0x390f('0x35')]));_0x524b4b[_0x390f('0x33')]=_0x524b4b[_0x390f('0x33')][_0x390f('0x36')]?_0x524b4b[_0x390f('0x33')]:_0x4f3130[_0x390f('0x2e')];if(!_0x460a5b[_0x390f('0x30')]['hasOwnProperty'](_0x390f('0x37'))){_0x524b4b['limit']=qs['limit'](_0x460a5b['query'][_0x390f('0x1e')]);_0x524b4b['offset']=qs[_0x390f('0x1b')](_0x460a5b[_0x390f('0x30')][_0x390f('0x1b')]);}_0x524b4b[_0x390f('0x38')]=qs[_0x390f('0x39')](_0x460a5b[_0x390f('0x30')]['sort']);_0x524b4b['where']=qs[_0x390f('0x32')](_['pick'](_0x460a5b[_0x390f('0x30')],_0x4f3130[_0x390f('0x32')]),_0x287444);if(_0x460a5b[_0x390f('0x30')][_0x390f('0x3a')]){_0x524b4b['where']=_[_0x390f('0x3b')](_0x524b4b[_0x390f('0x3c')],{'$or':_[_0x390f('0x2f')](_0x287444,function(_0x3081d2){if(_0x3081d2[_0x390f('0x2c')]!==_0x390f('0x3d')){var _0x23e84e={};_0x23e84e[_0x3081d2[_0x390f('0x28')]]={'$like':'%'+_0x460a5b['query'][_0x390f('0x3a')]+'%'};return _0x23e84e;}})});}_0x524b4b=_[_0x390f('0x3b')]({},_0x524b4b,_0x460a5b[_0x390f('0x3e')]);var _0x3e8046={'where':_0x524b4b[_0x390f('0x3c')]};return db[_0x390f('0x2b')]['count'](_0x3e8046)[_0x390f('0x24')](function(_0x15bc0a){_0x1f9876[_0x390f('0x1d')]=_0x15bc0a;if(_0x460a5b['query'][_0x390f('0x3f')]){_0x524b4b[_0x390f('0x40')]=[{'all':!![]}];}return db[_0x390f('0x2b')]['findAll'](_0x524b4b);})[_0x390f('0x24')](function(_0x5e7a1c){_0x1f9876[_0x390f('0x41')]=_0x5e7a1c;return _0x1f9876;})[_0x390f('0x24')](respondWithFilteredResult(_0x5a7af2,_0x524b4b))['catch'](handleError(_0x5a7af2,null));};exports[_0x390f('0x42')]=function(_0xfab477,_0x38cc38){var _0x59f55d={'raw':!![],'where':{'id':_0xfab477[_0x390f('0x43')]['id']}},_0x237d45={};_0x237d45[_0x390f('0x2e')]=_['keys'](db[_0x390f('0x2b')][_0x390f('0x44')]);_0x237d45[_0x390f('0x30')]=_['keys'](_0xfab477[_0x390f('0x30')]);_0x237d45[_0x390f('0x32')]=_[_0x390f('0x34')](_0x237d45[_0x390f('0x2e')],_0x237d45['query']);_0x59f55d[_0x390f('0x33')]=_['intersection'](_0x237d45[_0x390f('0x2e')],qs[_0x390f('0x35')](_0xfab477[_0x390f('0x30')][_0x390f('0x35')]));_0x59f55d[_0x390f('0x33')]=_0x59f55d[_0x390f('0x33')][_0x390f('0x36')]?_0x59f55d[_0x390f('0x33')]:_0x237d45[_0x390f('0x2e')];if(_0xfab477['query']['includeAll']){_0x59f55d[_0x390f('0x40')]=[{'all':!![]}];}_0x59f55d=_['merge']({},_0x59f55d,_0xfab477['options']);return db[_0x390f('0x2b')]['find'](_0x59f55d)[_0x390f('0x24')](handleEntityNotFound(_0x38cc38,null))[_0x390f('0x24')](respondWithResult(_0x38cc38,null))[_0x390f('0x45')](handleError(_0x38cc38,null));};exports[_0x390f('0x46')]=function(_0x3aa070,_0x5f527e){return db[_0x390f('0x2b')][_0x390f('0x46')](_0x3aa070[_0x390f('0x47')],{})[_0x390f('0x24')](respondWithResult(_0x5f527e,0xc9))[_0x390f('0x45')](handleError(_0x5f527e,null));};exports[_0x390f('0x23')]=function(_0x5a02bc,_0x378ff5){if(_0x5a02bc[_0x390f('0x47')]['id']){delete _0x5a02bc['body']['id'];}return db[_0x390f('0x2b')][_0x390f('0x48')]({'where':{'id':_0x5a02bc[_0x390f('0x43')]['id']}})[_0x390f('0x24')](handleEntityNotFound(_0x378ff5,null))['then'](saveUpdates(_0x5a02bc[_0x390f('0x47')],null))['then'](respondWithResult(_0x378ff5,null))[_0x390f('0x45')](handleError(_0x378ff5,null));};exports['destroy']=function(_0x1f9c77,_0x78126){return db[_0x390f('0x2b')][_0x390f('0x48')]({'where':{'id':_0x1f9c77[_0x390f('0x43')]['id']}})[_0x390f('0x24')](handleEntityNotFound(_0x78126,null))['then'](removeEntity(_0x78126,null))[_0x390f('0x45')](handleError(_0x78126,null));};exports['describe']=function(_0x29a538,_0x346f51){return db[_0x390f('0x2b')][_0x390f('0x49')]()[_0x390f('0x24')](respondWithResult(_0x346f51,null))[_0x390f('0x45')](handleError(_0x346f51,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 905ac29..0b94886 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 _0x62dd=['moment','request-promise','path','rimraf','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x317db3,_0xef2070){var _0x593f60=function(_0x519672){while(--_0x519672){_0x317db3['push'](_0x317db3['shift']());}};_0x593f60(++_0xef2070);}(_0x62dd,0x6c));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd62d('0x0'));var util=require(_0xd62d('0x1'));var logger=require(_0xd62d('0x2'))(_0xd62d('0x3'));var moment=require(_0xd62d('0x4'));var BPromise=require('bluebird');var rp=require(_0xd62d('0x5'));var fs=require('fs');var path=require(_0xd62d('0x6'));var rimraf=require(_0xd62d('0x7'));var config=require(_0xd62d('0x8'));var attributes=require('./voiceDialReport.attributes');module[_0xd62d('0x9')]=function(_0x5326fa,_0x11adaf){return _0x5326fa[_0xd62d('0xa')](_0xd62d('0xb'),attributes,{'tableName':_0xd62d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd62d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19a5=['./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x262f47,_0x300945){var _0x557f7c=function(_0x8988d0){while(--_0x8988d0){_0x262f47['push'](_0x262f47['shift']());}};_0x557f7c(++_0x300945);}(_0x19a5,0x1cc));var _0x519a=function(_0x580bbb,_0x41f7ab){_0x580bbb=_0x580bbb-0x0;var _0x2922f6=_0x19a5[_0x580bbb];return _0x2922f6;};'use strict';var _=require(_0x519a('0x0'));var util=require(_0x519a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x519a('0x2'));var BPromise=require(_0x519a('0x3'));var rp=require(_0x519a('0x4'));var fs=require('fs');var path=require(_0x519a('0x5'));var rimraf=require(_0x519a('0x6'));var config=require(_0x519a('0x7'));var attributes=require(_0x519a('0x8'));module[_0x519a('0x9')]=function(_0x1fe543,_0x501568){return _0x1fe543[_0x519a('0xa')](_0x519a('0xb'),attributes,{'tableName':'report_dial','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 be5af6c..aebc59c 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 _0xa05d=['jayson/promise','client','http','request','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','debug','stringify','UpdateVoiceDialReport','update','where','attributes','limit','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x36f797,_0x351603){var _0x44ba30=function(_0x32eb10){while(--_0x32eb10){_0x36f797['push'](_0x36f797['shift']());}};_0x44ba30(++_0x351603);}(_0xa05d,0x1e2));var _0xda05=function(_0x60b6fe,_0x49603b){_0x60b6fe=_0x60b6fe-0x0;var _0xdc9604=_0xa05d[_0x60b6fe];return _0xdc9604;};'use strict';var _=require('lodash');var util=require(_0xda05('0x0'));var moment=require(_0xda05('0x1'));var BPromise=require(_0xda05('0x2'));var rs=require(_0xda05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda05('0x4'))['db'];var utils=require(_0xda05('0x5'));var logger=require(_0xda05('0x6'))(_0xda05('0x7'));var config=require('../../config/environment');var jayson=require(_0xda05('0x8'));var client=jayson[_0xda05('0x9')][_0xda05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c218,_0x3a197b,_0x4e3843){return new BPromise(function(_0x29a671,_0x5e65f2){return client[_0xda05('0xb')](_0x13c218,_0x4e3843)['then'](function(_0x41badf){logger[_0xda05('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0xda05('0xd'));logger['debug'](_0xda05('0xe'),_0x3a197b,_0xda05('0xd'),JSON['stringify'](_0x41badf));if(_0x41badf[_0xda05('0xf')]){if(_0x41badf[_0xda05('0xf')][_0xda05('0x10')]===0x1f4){logger[_0xda05('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);return _0x5e65f2(_0x41badf[_0xda05('0xf')]['message']);}logger[_0xda05('0xf')](_0xda05('0x12'),_0x3a197b,_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);return _0x29a671(_0x41badf[_0xda05('0xf')][_0xda05('0x11')]);}else{logger[_0xda05('0xc')](_0xda05('0x12'),_0x3a197b,'request\x20sent');_0x29a671(_0x41badf[_0xda05('0x13')][_0xda05('0x11')]);}})['catch'](function(_0x1bb466){logger[_0xda05('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3a197b,_0x1bb466);_0x5e65f2(_0x1bb466);});});}exports[_0xda05('0x14')]=function(_0x48fcdd){var _0x5a3b1e=this;return new Promise(function(_0x16badf,_0x4ba54d){return db[_0xda05('0x15')][_0xda05('0x16')](_0x48fcdd[_0xda05('0x17')],{'raw':_0x48fcdd[_0xda05('0x18')]?_0x48fcdd[_0xda05('0x18')][_0xda05('0x19')]===undefined?!![]:![]:!![]})[_0xda05('0x1a')](function(_0x56789a){logger[_0xda05('0xc')](_0xda05('0x14'),_0x48fcdd);logger[_0xda05('0x1b')](_0xda05('0x14'),_0x48fcdd,JSON[_0xda05('0x1c')](_0x56789a));_0x16badf(_0x56789a);})['catch'](function(_0x1b80d1){logger[_0xda05('0xf')](_0xda05('0x14'),_0x1b80d1[_0xda05('0x11')],_0x48fcdd);_0x4ba54d(_0x5a3b1e[_0xda05('0xf')](0x1f4,_0x1b80d1[_0xda05('0x11')]));});});};exports[_0xda05('0x1d')]=function(_0x428838){var _0xe20480=this;return new Promise(function(_0x2f9159,_0x1c10b3){return db[_0xda05('0x15')][_0xda05('0x1e')](_0x428838[_0xda05('0x17')],{'raw':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x1f')]||null:null,'attributes':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x20')]||null:null,'limit':_0x428838[_0xda05('0x18')]?_0x428838[_0xda05('0x18')][_0xda05('0x21')]||null:null})['then'](function(_0x114467){logger[_0xda05('0xc')]('UpdateVoiceDialReport',_0x428838);logger[_0xda05('0x1b')](_0xda05('0x1d'),_0x428838,JSON['stringify'](_0x114467));_0x2f9159(_0x114467);})[_0xda05('0x22')](function(_0x48f4d9){logger[_0xda05('0xf')](_0xda05('0x1d'),_0x48f4d9[_0xda05('0x11')],_0x428838);_0x1c10b3(_0xe20480[_0xda05('0xf')](0x1f4,_0x48f4d9[_0xda05('0x11')]));});});}; \ No newline at end of file +var _0x0ff2=['result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2a7ca2,_0x3aa628){var _0xc13d26=function(_0xe2806d){while(--_0xe2806d){_0x2a7ca2['push'](_0x2a7ca2['shift']());}};_0xc13d26(++_0x3aa628);}(_0x0ff2,0x87));var _0x20ff=function(_0x57c57e,_0x144734){_0x57c57e=_0x57c57e-0x0;var _0x4b72c8=_0x0ff2[_0x57c57e];return _0x4b72c8;};'use strict';var _=require(_0x20ff('0x0'));var util=require('util');var moment=require(_0x20ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x20ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x20ff('0x4'))(_0x20ff('0x5'));var config=require(_0x20ff('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x20ff('0x7')][_0x20ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27ab74,_0x270dcd,_0x21e8ec){return new BPromise(function(_0x55957a,_0xe29340){return client[_0x20ff('0x9')](_0x27ab74,_0x21e8ec)[_0x20ff('0xa')](function(_0x1cc40c){logger['info'](_0x20ff('0xb'),_0x270dcd,_0x20ff('0xc'));logger[_0x20ff('0xd')](_0x20ff('0xe'),_0x270dcd,_0x20ff('0xc'),JSON[_0x20ff('0xf')](_0x1cc40c));if(_0x1cc40c[_0x20ff('0x10')]){if(_0x1cc40c[_0x20ff('0x10')][_0x20ff('0x11')]===0x1f4){logger[_0x20ff('0x10')](_0x20ff('0xb'),_0x270dcd,_0x1cc40c[_0x20ff('0x10')][_0x20ff('0x12')]);return _0xe29340(_0x1cc40c[_0x20ff('0x10')][_0x20ff('0x12')]);}logger[_0x20ff('0x10')](_0x20ff('0xb'),_0x270dcd,_0x1cc40c[_0x20ff('0x10')][_0x20ff('0x12')]);return _0x55957a(_0x1cc40c['error'][_0x20ff('0x12')]);}else{logger[_0x20ff('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x270dcd,_0x20ff('0xc'));_0x55957a(_0x1cc40c[_0x20ff('0x14')]['message']);}})[_0x20ff('0x15')](function(_0x1c794c){logger[_0x20ff('0x10')](_0x20ff('0xb'),_0x270dcd,_0x1c794c);_0xe29340(_0x1c794c);});});}exports[_0x20ff('0x16')]=function(_0x2e3fde){var _0x173612=this;return new Promise(function(_0x512bc8,_0xd5a4c3){return db[_0x20ff('0x17')]['create'](_0x2e3fde[_0x20ff('0x18')],{'raw':_0x2e3fde[_0x20ff('0x19')]?_0x2e3fde[_0x20ff('0x19')][_0x20ff('0x1a')]===undefined?!![]:![]:!![]})[_0x20ff('0xa')](function(_0x1ed798){logger[_0x20ff('0x13')](_0x20ff('0x16'),_0x2e3fde);logger['debug'](_0x20ff('0x16'),_0x2e3fde,JSON['stringify'](_0x1ed798));_0x512bc8(_0x1ed798);})[_0x20ff('0x15')](function(_0x1b582b){logger[_0x20ff('0x10')]('CreateVoiceDialReport',_0x1b582b[_0x20ff('0x12')],_0x2e3fde);_0xd5a4c3(_0x173612[_0x20ff('0x10')](0x1f4,_0x1b582b[_0x20ff('0x12')]));});});};exports[_0x20ff('0x1b')]=function(_0x5c4d7d){var _0x27aa45=this;return new Promise(function(_0x3a7bb2,_0x4c64ed){return db[_0x20ff('0x17')][_0x20ff('0x1c')](_0x5c4d7d[_0x20ff('0x18')],{'raw':_0x5c4d7d[_0x20ff('0x19')]?_0x5c4d7d['options'][_0x20ff('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c4d7d[_0x20ff('0x19')]?_0x5c4d7d[_0x20ff('0x19')]['where']||null:null,'attributes':_0x5c4d7d[_0x20ff('0x19')]?_0x5c4d7d[_0x20ff('0x19')][_0x20ff('0x1d')]||null:null,'limit':_0x5c4d7d['options']?_0x5c4d7d[_0x20ff('0x19')][_0x20ff('0x1e')]||null:null})[_0x20ff('0xa')](function(_0x17b8af){logger[_0x20ff('0x13')](_0x20ff('0x1b'),_0x5c4d7d);logger[_0x20ff('0xd')](_0x20ff('0x1b'),_0x5c4d7d,JSON['stringify'](_0x17b8af));_0x3a7bb2(_0x17b8af);})[_0x20ff('0x15')](function(_0x37b60a){logger['error'](_0x20ff('0x1b'),_0x37b60a['message'],_0x5c4d7d);_0x4c64ed(_0x27aa45[_0x20ff('0x10')](0x1f4,_0x37b60a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 09b9c1e..3dbe972 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 _0x90ec=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','show','create','post','/:id/applications','addApplications','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x310ee0,_0x1c5d46){var _0x2aae43=function(_0x15dabd){while(--_0x15dabd){_0x310ee0['push'](_0x310ee0['shift']());}};_0x2aae43(++_0x1c5d46);}(_0x90ec,0x1de));var _0xc90e=function(_0x16a2fc,_0x3de2f6){_0x16a2fc=_0x16a2fc-0x0;var _0x19ec71=_0x90ec[_0x16a2fc];return _0x19ec71;};'use strict';var multer=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var path=require(_0xc90e('0x2'));var timeout=require(_0xc90e('0x3'));var express=require('express');var router=express[_0xc90e('0x4')]();var fs_extra=require(_0xc90e('0x5'));var auth=require(_0xc90e('0x6'));var interaction=require(_0xc90e('0x7'));var config=require(_0xc90e('0x8'));var controller=require(_0xc90e('0x9'));router['get']('/',auth[_0xc90e('0xa')](),controller[_0xc90e('0xb')]);router['get']('/:id',auth[_0xc90e('0xa')](),controller[_0xc90e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc90e('0xd')]);router[_0xc90e('0xe')](_0xc90e('0xf'),auth[_0xc90e('0xa')](),controller[_0xc90e('0x10')]);router[_0xc90e('0x11')](_0xc90e('0x12'),auth[_0xc90e('0xa')](),controller[_0xc90e('0x13')]);router[_0xc90e('0x14')](_0xc90e('0x12'),auth[_0xc90e('0xa')](),controller['destroy']);module[_0xc90e('0x15')]=router; \ No newline at end of file +var _0xc412=['exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','destroy'];(function(_0x373595,_0x18c512){var _0x5ae0ff=function(_0x40a21a){while(--_0x40a21a){_0x373595['push'](_0x373595['shift']());}};_0x5ae0ff(++_0x18c512);}(_0xc412,0x79));var _0x2c41=function(_0x17a5f4,_0x3920d){_0x17a5f4=_0x17a5f4-0x0;var _0x5c27ff=_0xc412[_0x17a5f4];return _0x5c27ff;};'use strict';var multer=require('multer');var util=require(_0x2c41('0x0'));var path=require(_0x2c41('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2c41('0x2')]();var fs_extra=require(_0x2c41('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2c41('0x4'));var config=require(_0x2c41('0x5'));var controller=require(_0x2c41('0x6'));router[_0x2c41('0x7')]('/',auth[_0x2c41('0x8')](),controller[_0x2c41('0x9')]);router[_0x2c41('0x7')](_0x2c41('0xa'),auth[_0x2c41('0x8')](),controller[_0x2c41('0xb')]);router[_0x2c41('0xc')]('/',auth[_0x2c41('0x8')](),controller[_0x2c41('0xd')]);router['post'](_0x2c41('0xe'),auth['isAuthenticated'](),controller[_0x2c41('0xf')]);router[_0x2c41('0x10')](_0x2c41('0xa'),auth[_0x2c41('0x8')](),controller[_0x2c41('0x11')]);router['delete'](_0x2c41('0xa'),auth['isAuthenticated'](),controller[_0x2c41('0x12')]);module[_0x2c41('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 25b80f6..e0cd6e2 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 _0x0b81=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','compositeIndex','STRING','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b81,0x91));var _0x10b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b81[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x10b8('0x0'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x10b8('0x0')},'tag':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x10b8('0x1')],'allowNull':![],'defaultValue':_0x10b8('0x2')},'appdata':{'type':Sequelize[_0x10b8('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x10b8('0x3'),_0x10b8('0x4'),_0x10b8('0x5'),_0x10b8('0x6'),_0x10b8('0x7'),_0x10b8('0x8'),_0x10b8('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x10b8('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x10b8('0xa')},'IntervalId':{'type':Sequelize[_0x10b8('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x10b8('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x10b8('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x10b8('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x10b8('0xb')]},'recordingFormat':{'type':Sequelize[_0x10b8('0x1')],'defaultValue':_0x10b8('0xd')},'answer':{'type':Sequelize[_0x10b8('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x10b8('0xe')],'get':function(_0x29084a){return this[_0x10b8('0xf')](_0x10b8('0x10'));}},'alias':{'type':Sequelize[_0x10b8('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x519d=['exten','sequelize','exports','STRING','compositeIndex','inbound','outbound','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue'];(function(_0x437e3a,_0x49527b){var _0x619f93=function(_0x3eff2a){while(--_0x3eff2a){_0x437e3a['push'](_0x437e3a['shift']());}};_0x619f93(++_0x49527b);}(_0x519d,0x1b4));var _0xd519=function(_0x2388b1,_0x337850){_0x2388b1=_0x2388b1-0x0;var _0x4187cc=_0x519d[_0x2388b1];return _0x4187cc;};'use strict';var Sequelize=require(_0xd519('0x0'));module[_0xd519('0x1')]={'context':{'type':Sequelize[_0xd519('0x2')],'allowNull':![],'unique':_0xd519('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xd519('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd519('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd519('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xd519('0x4'),_0xd519('0x5'),'internal','inbound-fax',_0xd519('0x6'),'system',_0xd519('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0xd519('0x2')]},'interval':{'type':Sequelize[_0xd519('0x2')],'allowNull':![],'defaultValue':_0xd519('0x8')},'IntervalId':{'type':Sequelize[_0xd519('0x9')]},'isApp':{'type':Sequelize[_0xd519('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xd519('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd519('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd519('0x9')]},'recordingFormat':{'type':Sequelize[_0xd519('0x2')],'defaultValue':_0xd519('0xb')},'answer':{'type':Sequelize[_0xd519('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd519('0xc')],'get':function(_0x3d438c){return this[_0xd519('0xd')](_0xd519('0xe'));}},'alias':{'type':Sequelize[_0xd519('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 5f4c590..7b7e945 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 _0x2411=['Content-Range','destroy','get','OutboundRoutes','InternalRoutes','internal','filter','map','includes','type','find','value','then','error','name','send','index','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','VoiceExtension','rows','catch','show','params','body','outbound','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InboundRoutes','inbound','userProfileId','autoAssociation','update','pick','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x413db7,_0x4d51c5){var _0x3cb526=function(_0xdfee5d){while(--_0xdfee5d){_0x413db7['push'](_0x413db7['shift']());}};_0x3cb526(++_0x4d51c5);}(_0x2411,0x158));var _0x1241=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x2411[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x1241('0x0'));var Redis=require(_0x1241('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x1241('0x2'))['db'];config[_0x1241('0x3')]=_[_0x1241('0x4')](config[_0x1241('0x3')],{'host':_0x1241('0x5'),'port':0x18eb});var socket=require(_0x1241('0x6'))(new Redis(config[_0x1241('0x3')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x3b104e,_0x3ed8f9){_0x3ed8f9=_0x3ed8f9||0xcc;return function(_0x3dcb2e){if(_0x3dcb2e){return _0x3b104e[_0x1241('0x7')](_0x3ed8f9);}return _0x3b104e[_0x1241('0x8')](_0x3ed8f9)[_0x1241('0x9')]();};}function respondWithResult(_0x3fa96f,_0xcf6e05){_0xcf6e05=_0xcf6e05||0xc8;return function(_0x17ae9e){if(_0x17ae9e){return _0x3fa96f['status'](_0xcf6e05)[_0x1241('0xa')](_0x17ae9e);}};}function respondWithFilteredResult(_0x4e7077,_0x2fc6a5){return function(_0x43c11d){if(_0x43c11d){var _0x4deb16=typeof _0x2fc6a5[_0x1241('0xb')]===_0x1241('0xc')&&typeof _0x2fc6a5[_0x1241('0xd')]===_0x1241('0xc');var _0x2ee959=_0x43c11d['count'];var _0xf419d=_0x4deb16?0x0:_0x2fc6a5['offset'];var _0x18e4dc=_0x4deb16?_0x43c11d[_0x1241('0xe')]:_0x2fc6a5['offset']+_0x2fc6a5['limit'];var _0xc1b507;if(_0x18e4dc>=_0x2ee959){_0x18e4dc=_0x2ee959;_0xc1b507=0xc8;}else{_0xc1b507=0xce;}_0x4e7077[_0x1241('0x8')](_0xc1b507);return _0x4e7077[_0x1241('0xf')](_0x1241('0x10'),_0xf419d+'-'+_0x18e4dc+'/'+_0x2ee959)[_0x1241('0xa')](_0x43c11d);}return null;};}function removeEntity(_0x2e7ddb){return function(_0x179b72){if(_0x179b72){return _0x179b72[_0x1241('0x11')]()['then'](function(){var _0x26c59e=_0x179b72[_0x1241('0x12')]({'plain':!![]});var _0x54719a=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x1241('0x13'),'value':'outbound','ignore':![]},{'name':_0x1241('0x14'),'value':_0x1241('0x15'),'ignore':![]}];var _0x146b24=_(_0x54719a)[_0x1241('0x16')]('ignore')[_0x1241('0x17')]('value')['value']();if(_[_0x1241('0x18')](_0x146b24,_0x26c59e[_0x1241('0x19')])){return;}var _0x4a43a6=_[_0x1241('0x1a')](_0x54719a,[_0x1241('0x1b'),_0x26c59e[_0x1241('0x19')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x4a43a6,'resourceId':_0x26c59e['id']}})['then'](function(){return _0x179b72;});})[_0x1241('0x1c')](function(){_0x2e7ddb[_0x1241('0x8')](0xcc)[_0x1241('0x9')]();});}};}function handleEntityNotFound(_0x1e48da){return function(_0x1e6d53){if(!_0x1e6d53){_0x1e48da['sendStatus'](0x194);}return _0x1e6d53;};}function handleError(_0x134799,_0x4a98a8){_0x4a98a8=_0x4a98a8||0x1f4;return function(_0x3ff713){logger[_0x1241('0x1d')](_0x3ff713['stack']);if(_0x3ff713[_0x1241('0x1e')]){delete _0x3ff713[_0x1241('0x1e')];}_0x134799['status'](_0x4a98a8)[_0x1241('0x1f')](_0x3ff713);};}exports[_0x1241('0x20')]=function(_0x3891a7,_0x36e77e){var _0x1e7a47={},_0x5af266={},_0x420a8b={'count':0x0,'rows':[]};var _0x57eba6=_[_0x1241('0x17')](db['VoiceExtension'][_0x1241('0x21')],function(_0x1394e1){return{'name':_0x1394e1['fieldName'],'type':_0x1394e1[_0x1241('0x19')][_0x1241('0x22')]};});_0x5af266[_0x1241('0x23')]=_[_0x1241('0x17')](_0x57eba6,_0x1241('0x1e'));_0x5af266['query']=_[_0x1241('0x24')](_0x3891a7[_0x1241('0x25')]);_0x5af266[_0x1241('0x26')]=_[_0x1241('0x27')](_0x5af266[_0x1241('0x23')],_0x5af266['query']);_0x1e7a47[_0x1241('0x28')]=_[_0x1241('0x27')](_0x5af266[_0x1241('0x23')],qs[_0x1241('0x29')](_0x3891a7[_0x1241('0x25')][_0x1241('0x29')]));_0x1e7a47[_0x1241('0x28')]=_0x1e7a47[_0x1241('0x28')][_0x1241('0x2a')]?_0x1e7a47[_0x1241('0x28')]:_0x5af266[_0x1241('0x23')];if(!_0x3891a7['query'][_0x1241('0x2b')](_0x1241('0x2c'))){_0x1e7a47[_0x1241('0xd')]=qs[_0x1241('0xd')](_0x3891a7['query'][_0x1241('0xd')]);_0x1e7a47[_0x1241('0xb')]=qs['offset'](_0x3891a7[_0x1241('0x25')]['offset']);}_0x1e7a47[_0x1241('0x2d')]=qs[_0x1241('0x2e')](_0x3891a7[_0x1241('0x25')][_0x1241('0x2e')]);_0x1e7a47[_0x1241('0x2f')]=qs[_0x1241('0x26')](_['pick'](_0x3891a7[_0x1241('0x25')],_0x5af266['filters']),_0x57eba6);if(_0x3891a7[_0x1241('0x25')][_0x1241('0x16')]){_0x1e7a47['where']=_[_0x1241('0x30')](_0x1e7a47[_0x1241('0x2f')],{'$or':_[_0x1241('0x17')](_0x57eba6,function(_0x470638){if(_0x470638[_0x1241('0x19')]!==_0x1241('0x31')){var _0x415ef6={};_0x415ef6[_0x470638[_0x1241('0x1e')]]={'$like':'%'+_0x3891a7[_0x1241('0x25')]['filter']+'%'};return _0x415ef6;}})});}_0x1e7a47=_[_0x1241('0x30')]({},_0x1e7a47,_0x3891a7[_0x1241('0x32')]);var _0x2a63a5={'where':_0x1e7a47['where']};return db['VoiceExtension'][_0x1241('0xe')](_0x2a63a5)[_0x1241('0x1c')](function(_0x2c598f){_0x420a8b[_0x1241('0xe')]=_0x2c598f;if(_0x3891a7[_0x1241('0x25')][_0x1241('0x33')]){_0x1e7a47[_0x1241('0x34')]=[{'all':!![]}];}return db[_0x1241('0x35')]['findAll'](_0x1e7a47);})[_0x1241('0x1c')](function(_0x2bb290){_0x420a8b[_0x1241('0x36')]=_0x2bb290;return _0x420a8b;})['then'](respondWithFilteredResult(_0x36e77e,_0x1e7a47))[_0x1241('0x37')](handleError(_0x36e77e,null));};exports[_0x1241('0x38')]=function(_0xc5456,_0x554889){var _0x931635={'raw':![],'where':{'id':_0xc5456[_0x1241('0x39')]['id']}},_0x1f4bd0={};_0x1f4bd0['model']=_['keys'](db['VoiceExtension'][_0x1241('0x21')]);_0x1f4bd0[_0x1241('0x25')]=_[_0x1241('0x24')](_0xc5456[_0x1241('0x25')]);_0x1f4bd0[_0x1241('0x26')]=_['intersection'](_0x1f4bd0[_0x1241('0x23')],_0x1f4bd0[_0x1241('0x25')]);_0x931635['attributes']=_['intersection'](_0x1f4bd0[_0x1241('0x23')],qs['fields'](_0xc5456[_0x1241('0x25')][_0x1241('0x29')]));_0x931635[_0x1241('0x28')]=_0x931635[_0x1241('0x28')][_0x1241('0x2a')]?_0x931635['attributes']:_0x1f4bd0[_0x1241('0x23')];if(_0xc5456[_0x1241('0x25')][_0x1241('0x33')]){_0x931635['include']=[{'all':!![]}];}_0x931635=_['merge']({},_0x931635,_0xc5456[_0x1241('0x32')]);return db[_0x1241('0x35')][_0x1241('0x1a')](_0x931635)[_0x1241('0x1c')](handleEntityNotFound(_0x554889,null))[_0x1241('0x1c')](respondWithResult(_0x554889,null))[_0x1241('0x37')](handleError(_0x554889,null));};exports['destroy']=function(_0x276117,_0x4710b2){return db[_0x1241('0x35')]['find']({'where':{'id':_0x276117[_0x1241('0x39')]['id']}})['then'](handleEntityNotFound(_0x4710b2,null))[_0x1241('0x1c')](removeEntity(_0x4710b2,null))[_0x1241('0x37')](handleError(_0x4710b2,null));};exports['create']=function(_0x5540ec,_0x5aef02){if(_0x5540ec[_0x1241('0x3a')][_0x1241('0x19')]===_0x1241('0x3b')&&!_[_0x1241('0x3c')](_0x5540ec[_0x1241('0x3a')][_0x1241('0x3d')],'_')){_0x5540ec[_0x1241('0x3a')]['exten']='_'[_0x1241('0x3e')](_0x5540ec[_0x1241('0x3a')][_0x1241('0x3d')]);}return db[_0x1241('0x35')][_0x1241('0x3f')](_0x5540ec[_0x1241('0x3a')],{'raw':![]})[_0x1241('0x1c')](function(_0x4c1006){var _0x342232=_0x5540ec['user'][_0x1241('0x12')]({'plain':!![]});if(!_0x342232)throw new Error(_0x1241('0x40'));if(_0x342232['role']===_0x1241('0x41')){var _0x174ab9=_0x4c1006[_0x1241('0x12')]({'plain':!![]});var _0x595bb6=[{'name':_0x1241('0x42'),'value':_0x1241('0x43')},{'name':_0x1241('0x13'),'value':'outbound'},{'name':_0x1241('0x14'),'value':_0x1241('0x15')}];var _0x1489b1=_[_0x1241('0x1a')](_0x595bb6,[_0x1241('0x1b'),_0x174ab9[_0x1241('0x19')]])[_0x1241('0x1e')];return db['UserProfileSection'][_0x1241('0x1a')]({'where':{'name':_0x1489b1,'userProfileId':_0x342232[_0x1241('0x44')]},'raw':!![]})[_0x1241('0x1c')](function(_0x39a112){if(_0x39a112&&_0x39a112[_0x1241('0x45')]===0x0){return db['UserProfileResource'][_0x1241('0x3f')]({'name':_0x174ab9[_0x1241('0x1e')],'resourceId':_0x174ab9['id'],'type':_0x39a112[_0x1241('0x1e')],'sectionId':_0x39a112['id']},{})[_0x1241('0x1c')](function(){return _0x4c1006;});}else{return _0x4c1006;}})['catch'](function(_0x17c076){logger[_0x1241('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17c076);throw _0x17c076;});}return _0x4c1006;})[_0x1241('0x1c')](respondWithResult(_0x5aef02,0xc9))[_0x1241('0x37')](handleError(_0x5aef02,null));};exports['update']=function(_0x2dafdf,_0x319953){if(_0x2dafdf[_0x1241('0x3a')]['id']){delete _0x2dafdf['body']['id'];}return db[_0x1241('0x35')][_0x1241('0x1a')]({'where':{'id':_0x2dafdf[_0x1241('0x39')]['id']}})[_0x1241('0x1c')](handleEntityNotFound(_0x319953,null))[_0x1241('0x1c')](function(_0x1fb819){if(_0x1fb819){return db['VoiceExtension'][_0x1241('0x46')](_[_0x1241('0x47')](_0x2dafdf[_0x1241('0x3a')],[_0x1241('0x3d'),_0x1241('0x48'),_0x1241('0x49'),_0x1241('0x4a'),'cutdigits',_0x1241('0x4b'),_0x1241('0x4c')]),{'where':{'context':_0x1fb819[_0x1241('0x48')],'exten':_0x1fb819[_0x1241('0x3d')]},'individualHooks':!![]})[_0x1241('0x1c')](function(_0x2dd9f7){return _0x2dd9f7;});}return null;})[_0x1241('0x1c')](respondWithStatusCode(_0x319953,null))['catch'](handleError(_0x319953,null));};exports[_0x1241('0x4d')]=function(_0xf5a8a8,_0x16e5f8){var _0x52a883=_0xf5a8a8[_0x1241('0x39')]['id'];var _0x5ac430=_0xf5a8a8[_0x1241('0x3a')];var _0x343704=0xc8;var _0x313365=null;return db[_0x1241('0x4e')][_0x1241('0x4f')]({'isolationLevel':db[_0x1241('0x4e')][_0x1241('0x50')]['ISOLATION_LEVELS'][_0x1241('0x51')]},function(_0x3ecef7){return db[_0x1241('0x35')][_0x1241('0x52')]({'where':{'id':_0x52a883},'transaction':_0x3ecef7})[_0x1241('0x1c')](function(_0x224b58){if(_0x224b58){return db[_0x1241('0x35')][_0x1241('0x11')]({'where':{'VoiceExtensionId':_0x52a883},'transaction':_0x3ecef7})[_0x1241('0x1c')](function(){var _0x3c00cf=_[_0x1241('0x17')](_0x5ac430,function(_0x180500){_0x180500[_0x1241('0x53')]=_0x52a883;_0x180500['isApp']=!![];return _0x180500;});return _0x224b58[_0x1241('0x54')](_0x3c00cf);})['then'](function(_0x40b458){return db[_0x1241('0x35')][_0x1241('0x55')](_0x40b458,{'transaction':_0x3ecef7});});}else{_0x343704=0x194;_0x313365=[];}});})[_0x1241('0x1c')](function(){if(_0x343704!==0x194){return db[_0x1241('0x35')][_0x1241('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x52a883},'order':_0x1241('0x57')})[_0x1241('0x1c')](function(_0x4e4253){_0x313365=_0x4e4253;});}})['catch'](function(_0x4b5e0a){_0x343704=0x1f4;logger[_0x1241('0x1d')](_0x4b5e0a[_0x1241('0x58')]);if(_0x4b5e0a[_0x1241('0x1e')]){delete _0x4b5e0a[_0x1241('0x1e')];}_0x313365=_0x4b5e0a;})[_0x1241('0x59')](function(){if(_0x313365===null){_0x16e5f8[_0x1241('0x7')](_0x343704);}else{if(_0x343704===0x1f4){_0x16e5f8['status'](_0x343704)['send'](_0x313365);}else{_0x16e5f8[_0x1241('0x8')](_0x343704)['json'](_0x313365);}}});}; \ No newline at end of file +var _0xa4ef=['body','exten','concat','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','finally','json','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','value','type','find','name','stack','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','map','options','VoiceExtension','includeAll','findAll','rows','catch','params','include','startsWith'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_0xa4ef,0x12b));var _0xfa4e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xa4ef[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var Redis=require(_0xfa4e('0x0'));var qs=require(_0xfa4e('0x1'));var logger=require('../../config/logger')(_0xfa4e('0x2'));var config=require(_0xfa4e('0x3'));var db=require(_0xfa4e('0x4'))['db'];config[_0xfa4e('0x5')]=_[_0xfa4e('0x6')](config[_0xfa4e('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa4e('0x7'))(new Redis(config[_0xfa4e('0x5')]));require('./voiceExtension.socket')[_0xfa4e('0x8')](socket);function respondWithStatusCode(_0x4f3038,_0x21794c){_0x21794c=_0x21794c||0xcc;return function(_0x3b982f){if(_0x3b982f){return _0x4f3038[_0xfa4e('0x9')](_0x21794c);}return _0x4f3038['status'](_0x21794c)[_0xfa4e('0xa')]();};}function respondWithResult(_0x2b2054,_0x1e88c0){_0x1e88c0=_0x1e88c0||0xc8;return function(_0x1855e9){if(_0x1855e9){return _0x2b2054[_0xfa4e('0xb')](_0x1e88c0)['json'](_0x1855e9);}};}function respondWithFilteredResult(_0x617f88,_0x4cfc8f){return function(_0x908cb4){if(_0x908cb4){var _0x51bf61=typeof _0x4cfc8f['offset']===_0xfa4e('0xc')&&typeof _0x4cfc8f[_0xfa4e('0xd')]==='undefined';var _0x191276=_0x908cb4[_0xfa4e('0xe')];var _0x40cf09=_0x51bf61?0x0:_0x4cfc8f[_0xfa4e('0xf')];var _0x553d1e=_0x51bf61?_0x908cb4[_0xfa4e('0xe')]:_0x4cfc8f[_0xfa4e('0xf')]+_0x4cfc8f[_0xfa4e('0xd')];var _0x4a48f1;if(_0x553d1e>=_0x191276){_0x553d1e=_0x191276;_0x4a48f1=0xc8;}else{_0x4a48f1=0xce;}_0x617f88[_0xfa4e('0xb')](_0x4a48f1);return _0x617f88[_0xfa4e('0x10')](_0xfa4e('0x11'),_0x40cf09+'-'+_0x553d1e+'/'+_0x191276)['json'](_0x908cb4);}return null;};}function removeEntity(_0xcb7ecc){return function(_0x6ba25a){if(_0x6ba25a){return _0x6ba25a[_0xfa4e('0x12')]()[_0xfa4e('0x13')](function(){var _0x5d5119=_0x6ba25a['get']({'plain':!![]});var _0x19128c=[{'name':_0xfa4e('0x14'),'value':_0xfa4e('0x15'),'ignore':![]},{'name':_0xfa4e('0x16'),'value':_0xfa4e('0x17'),'ignore':![]},{'name':_0xfa4e('0x18'),'value':_0xfa4e('0x19'),'ignore':![]}];var _0x5954e3=_(_0x19128c)['filter']('ignore')['map'](_0xfa4e('0x1a'))[_0xfa4e('0x1a')]();if(_['includes'](_0x5954e3,_0x5d5119[_0xfa4e('0x1b')])){return;}var _0x4fe7c0=_[_0xfa4e('0x1c')](_0x19128c,['value',_0x5d5119[_0xfa4e('0x1b')]])[_0xfa4e('0x1d')];return db['UserProfileResource']['destroy']({'where':{'type':_0x4fe7c0,'resourceId':_0x5d5119['id']}})[_0xfa4e('0x13')](function(){return _0x6ba25a;});})[_0xfa4e('0x13')](function(){_0xcb7ecc[_0xfa4e('0xb')](0xcc)[_0xfa4e('0xa')]();});}};}function handleEntityNotFound(_0x44e8f3){return function(_0xf8e318){if(!_0xf8e318){_0x44e8f3[_0xfa4e('0x9')](0x194);}return _0xf8e318;};}function handleError(_0x4172b6,_0x35d244){_0x35d244=_0x35d244||0x1f4;return function(_0xdfc574){logger['error'](_0xdfc574[_0xfa4e('0x1e')]);if(_0xdfc574[_0xfa4e('0x1d')]){delete _0xdfc574[_0xfa4e('0x1d')];}_0x4172b6[_0xfa4e('0xb')](_0x35d244)[_0xfa4e('0x1f')](_0xdfc574);};}exports[_0xfa4e('0x20')]=function(_0x53d4c1,_0x26a885){var _0x5429d1={},_0x36bed6={},_0x155ef2={'count':0x0,'rows':[]};var _0x227c2d=_['map'](db['VoiceExtension'][_0xfa4e('0x21')],function(_0x36c3b3){return{'name':_0x36c3b3[_0xfa4e('0x22')],'type':_0x36c3b3[_0xfa4e('0x1b')][_0xfa4e('0x23')]};});_0x36bed6['model']=_['map'](_0x227c2d,_0xfa4e('0x1d'));_0x36bed6[_0xfa4e('0x24')]=_[_0xfa4e('0x25')](_0x53d4c1[_0xfa4e('0x24')]);_0x36bed6[_0xfa4e('0x26')]=_[_0xfa4e('0x27')](_0x36bed6[_0xfa4e('0x28')],_0x36bed6[_0xfa4e('0x24')]);_0x5429d1[_0xfa4e('0x29')]=_[_0xfa4e('0x27')](_0x36bed6[_0xfa4e('0x28')],qs[_0xfa4e('0x2a')](_0x53d4c1[_0xfa4e('0x24')][_0xfa4e('0x2a')]));_0x5429d1[_0xfa4e('0x29')]=_0x5429d1[_0xfa4e('0x29')][_0xfa4e('0x2b')]?_0x5429d1[_0xfa4e('0x29')]:_0x36bed6[_0xfa4e('0x28')];if(!_0x53d4c1['query']['hasOwnProperty'](_0xfa4e('0x2c'))){_0x5429d1[_0xfa4e('0xd')]=qs[_0xfa4e('0xd')](_0x53d4c1[_0xfa4e('0x24')][_0xfa4e('0xd')]);_0x5429d1['offset']=qs[_0xfa4e('0xf')](_0x53d4c1['query'][_0xfa4e('0xf')]);}_0x5429d1[_0xfa4e('0x2d')]=qs[_0xfa4e('0x2e')](_0x53d4c1[_0xfa4e('0x24')]['sort']);_0x5429d1['where']=qs['filters'](_[_0xfa4e('0x2f')](_0x53d4c1[_0xfa4e('0x24')],_0x36bed6[_0xfa4e('0x26')]),_0x227c2d);if(_0x53d4c1[_0xfa4e('0x24')][_0xfa4e('0x30')]){_0x5429d1[_0xfa4e('0x31')]=_[_0xfa4e('0x32')](_0x5429d1[_0xfa4e('0x31')],{'$or':_[_0xfa4e('0x33')](_0x227c2d,function(_0x8c6af7){if(_0x8c6af7[_0xfa4e('0x1b')]!=='VIRTUAL'){var _0x78f031={};_0x78f031[_0x8c6af7['name']]={'$like':'%'+_0x53d4c1[_0xfa4e('0x24')][_0xfa4e('0x30')]+'%'};return _0x78f031;}})});}_0x5429d1=_[_0xfa4e('0x32')]({},_0x5429d1,_0x53d4c1[_0xfa4e('0x34')]);var _0x4b64c3={'where':_0x5429d1[_0xfa4e('0x31')]};return db[_0xfa4e('0x35')][_0xfa4e('0xe')](_0x4b64c3)[_0xfa4e('0x13')](function(_0x43b877){_0x155ef2[_0xfa4e('0xe')]=_0x43b877;if(_0x53d4c1[_0xfa4e('0x24')][_0xfa4e('0x36')]){_0x5429d1['include']=[{'all':!![]}];}return db[_0xfa4e('0x35')][_0xfa4e('0x37')](_0x5429d1);})[_0xfa4e('0x13')](function(_0x2510cf){_0x155ef2[_0xfa4e('0x38')]=_0x2510cf;return _0x155ef2;})['then'](respondWithFilteredResult(_0x26a885,_0x5429d1))[_0xfa4e('0x39')](handleError(_0x26a885,null));};exports['show']=function(_0x8ad6e7,_0x22eba9){var _0x48b8a8={'raw':![],'where':{'id':_0x8ad6e7[_0xfa4e('0x3a')]['id']}},_0x3ae001={};_0x3ae001[_0xfa4e('0x28')]=_[_0xfa4e('0x25')](db[_0xfa4e('0x35')][_0xfa4e('0x21')]);_0x3ae001['query']=_[_0xfa4e('0x25')](_0x8ad6e7[_0xfa4e('0x24')]);_0x3ae001[_0xfa4e('0x26')]=_[_0xfa4e('0x27')](_0x3ae001[_0xfa4e('0x28')],_0x3ae001[_0xfa4e('0x24')]);_0x48b8a8[_0xfa4e('0x29')]=_[_0xfa4e('0x27')](_0x3ae001[_0xfa4e('0x28')],qs[_0xfa4e('0x2a')](_0x8ad6e7[_0xfa4e('0x24')][_0xfa4e('0x2a')]));_0x48b8a8[_0xfa4e('0x29')]=_0x48b8a8[_0xfa4e('0x29')]['length']?_0x48b8a8[_0xfa4e('0x29')]:_0x3ae001[_0xfa4e('0x28')];if(_0x8ad6e7[_0xfa4e('0x24')][_0xfa4e('0x36')]){_0x48b8a8[_0xfa4e('0x3b')]=[{'all':!![]}];}_0x48b8a8=_[_0xfa4e('0x32')]({},_0x48b8a8,_0x8ad6e7[_0xfa4e('0x34')]);return db[_0xfa4e('0x35')]['find'](_0x48b8a8)[_0xfa4e('0x13')](handleEntityNotFound(_0x22eba9,null))[_0xfa4e('0x13')](respondWithResult(_0x22eba9,null))[_0xfa4e('0x39')](handleError(_0x22eba9,null));};exports[_0xfa4e('0x12')]=function(_0x3089c0,_0x526405){return db[_0xfa4e('0x35')]['find']({'where':{'id':_0x3089c0[_0xfa4e('0x3a')]['id']}})[_0xfa4e('0x13')](handleEntityNotFound(_0x526405,null))[_0xfa4e('0x13')](removeEntity(_0x526405,null))[_0xfa4e('0x39')](handleError(_0x526405,null));};exports['create']=function(_0x38a1a2,_0x45de31){if(_0x38a1a2['body'][_0xfa4e('0x1b')]===_0xfa4e('0x17')&&!_[_0xfa4e('0x3c')](_0x38a1a2[_0xfa4e('0x3d')][_0xfa4e('0x3e')],'_')){_0x38a1a2[_0xfa4e('0x3d')][_0xfa4e('0x3e')]='_'[_0xfa4e('0x3f')](_0x38a1a2['body']['exten']);}return db[_0xfa4e('0x35')][_0xfa4e('0x40')](_0x38a1a2['body'],{'raw':![]})['then'](function(_0x19e861){var _0x34da59=_0x38a1a2[_0xfa4e('0x41')][_0xfa4e('0x42')]({'plain':!![]});if(!_0x34da59)throw new Error(_0xfa4e('0x43'));if(_0x34da59[_0xfa4e('0x44')]===_0xfa4e('0x41')){var _0x19819=_0x19e861[_0xfa4e('0x42')]({'plain':!![]});var _0xfd58=[{'name':_0xfa4e('0x14'),'value':'inbound'},{'name':_0xfa4e('0x16'),'value':_0xfa4e('0x17')},{'name':'InternalRoutes','value':_0xfa4e('0x19')}];var _0x1fbd0e=_[_0xfa4e('0x1c')](_0xfd58,[_0xfa4e('0x1a'),_0x19819[_0xfa4e('0x1b')]])['name'];return db[_0xfa4e('0x45')]['find']({'where':{'name':_0x1fbd0e,'userProfileId':_0x34da59['userProfileId']},'raw':!![]})[_0xfa4e('0x13')](function(_0x55a98c){if(_0x55a98c&&_0x55a98c[_0xfa4e('0x46')]===0x0){return db[_0xfa4e('0x47')][_0xfa4e('0x40')]({'name':_0x19819[_0xfa4e('0x1d')],'resourceId':_0x19819['id'],'type':_0x55a98c[_0xfa4e('0x1d')],'sectionId':_0x55a98c['id']},{})[_0xfa4e('0x13')](function(){return _0x19e861;});}else{return _0x19e861;}})[_0xfa4e('0x39')](function(_0x5309c6){logger[_0xfa4e('0x48')](_0xfa4e('0x49'),_0x5309c6);throw _0x5309c6;});}return _0x19e861;})[_0xfa4e('0x13')](respondWithResult(_0x45de31,0xc9))[_0xfa4e('0x39')](handleError(_0x45de31,null));};exports[_0xfa4e('0x4a')]=function(_0x5622f1,_0x9c3e8f){if(_0x5622f1['body']['id']){delete _0x5622f1['body']['id'];}return db[_0xfa4e('0x35')][_0xfa4e('0x1c')]({'where':{'id':_0x5622f1['params']['id']}})['then'](handleEntityNotFound(_0x9c3e8f,null))[_0xfa4e('0x13')](function(_0x103946){if(_0x103946){return db[_0xfa4e('0x35')][_0xfa4e('0x4a')](_[_0xfa4e('0x2f')](_0x5622f1[_0xfa4e('0x3d')],[_0xfa4e('0x3e'),_0xfa4e('0x4b'),'description',_0xfa4e('0x4c'),'cutdigits',_0xfa4e('0x4d'),_0xfa4e('0x4e')]),{'where':{'context':_0x103946[_0xfa4e('0x4b')],'exten':_0x103946[_0xfa4e('0x3e')]},'individualHooks':!![]})[_0xfa4e('0x13')](function(_0x58fd04){return _0x58fd04;});}return null;})[_0xfa4e('0x13')](respondWithStatusCode(_0x9c3e8f,null))['catch'](handleError(_0x9c3e8f,null));};exports[_0xfa4e('0x4f')]=function(_0x55a43f,_0x2179fe){var _0x5c761e=_0x55a43f[_0xfa4e('0x3a')]['id'];var _0x2457bc=_0x55a43f['body'];var _0x354e90=0xc8;var _0x3e7012=null;return db['sequelize'][_0xfa4e('0x50')]({'isolationLevel':db['sequelize'][_0xfa4e('0x51')][_0xfa4e('0x52')]['READ_COMMITTED']},function(_0x7cfda0){return db[_0xfa4e('0x35')][_0xfa4e('0x53')]({'where':{'id':_0x5c761e},'transaction':_0x7cfda0})[_0xfa4e('0x13')](function(_0x3d016c){if(_0x3d016c){return db[_0xfa4e('0x35')]['destroy']({'where':{'VoiceExtensionId':_0x5c761e},'transaction':_0x7cfda0})[_0xfa4e('0x13')](function(){var _0x1b39bf=_[_0xfa4e('0x33')](_0x2457bc,function(_0x5019aa){_0x5019aa[_0xfa4e('0x54')]=_0x5c761e;_0x5019aa[_0xfa4e('0x55')]=!![];return _0x5019aa;});return _0x3d016c[_0xfa4e('0x56')](_0x1b39bf);})[_0xfa4e('0x13')](function(_0x96992e){return db[_0xfa4e('0x35')][_0xfa4e('0x57')](_0x96992e,{'transaction':_0x7cfda0});});}else{_0x354e90=0x194;_0x3e7012=[];}});})[_0xfa4e('0x13')](function(){if(_0x354e90!==0x194){return db[_0xfa4e('0x35')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5c761e},'order':'cast(priority\x20as\x20unsigned)'})[_0xfa4e('0x13')](function(_0x214b46){_0x3e7012=_0x214b46;});}})['catch'](function(_0x20b675){_0x354e90=0x1f4;logger[_0xfa4e('0x48')](_0x20b675[_0xfa4e('0x1e')]);if(_0x20b675[_0xfa4e('0x1d')]){delete _0x20b675[_0xfa4e('0x1d')];}_0x3e7012=_0x20b675;})[_0xfa4e('0x58')](function(){if(_0x3e7012===null){_0x2179fe[_0xfa4e('0x9')](_0x354e90);}else{if(_0x354e90===0x1f4){_0x2179fe[_0xfa4e('0xb')](_0x354e90)[_0xfa4e('0x1f')](_0x3e7012);}else{_0x2179fe[_0xfa4e('0xb')](_0x354e90)[_0xfa4e('0x59')](_0x3e7012);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ebc9775..ac5a0a0 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 _0x3e6c=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension'];(function(_0x17ee38,_0x5bdff4){var _0x439a4e=function(_0x2c6e2b){while(--_0x2c6e2b){_0x17ee38['push'](_0x17ee38['shift']());}};_0x439a4e(++_0x5bdff4);}(_0x3e6c,0x1ad));var _0xc3e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e6c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc3e6('0x0'));var VoiceExtension=require(_0xc3e6('0x1'))['db'][_0xc3e6('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3e6('0x3'),'afterUpdate':_0xc3e6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36ef4a){return function(_0x5d250f,_0x2e294e,_0x590740){VoiceExtensionEvents['emit'](_0x36ef4a+':'+_0x5d250f['id'],_0x5d250f);VoiceExtensionEvents[_0xc3e6('0x5')](_0x36ef4a,_0x5d250f);_0x590740(null);};}for(var e in events){if(events[_0xc3e6('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xc3e6('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x497e=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2d761e,_0x29832c){var _0x291add=function(_0x15de59){while(--_0x15de59){_0x2d761e['push'](_0x2d761e['shift']());}};_0x291add(++_0x29832c);}(_0x497e,0xb0));var _0xe497=function(_0x38b711,_0xf3473d){_0x38b711=_0x38b711-0x0;var _0x49b9e9=_0x497e[_0x38b711];return _0x49b9e9;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xe497('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xe497('0x1')](0x0);var events={'afterCreate':_0xe497('0x2'),'afterUpdate':_0xe497('0x3'),'afterDestroy':'remove'};function emitEvent(_0x38197b){return function(_0x4a69fd,_0x24345a,_0x5b8cc9){VoiceExtensionEvents[_0xe497('0x4')](_0x38197b+':'+_0x4a69fd['id'],_0x4a69fd);VoiceExtensionEvents[_0xe497('0x4')](_0x38197b,_0x4a69fd);_0x5b8cc9(null);};}for(var e in events){if(events[_0xe497('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xe497('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 322a273..7ebb1f9 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 _0x993f=['replace','join','isEmpty','findAll','interval','IntervalId','then','*,*,*,*','map','filter','toLowerCase','tag','CDR(tag)=','intervals','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x993f,0x129));var _0xf993=function(_0x4652ec,_0x2e9e0e){_0x4652ec=_0x4652ec-0x0;var _0x3467bd=_0x993f[_0x4652ec];return _0x3467bd;};'use strict';var _=require(_0xf993('0x0'));var attributes=require(_0xf993('0x1'));module[_0xf993('0x2')]=function(_0x15faa9){var _0x4dee67=_0x15faa9[_0xf993('0x3')];function _0x28c80d(_0x5797f2){var _0x29789c=0x2;var _0xd9d594=[{'type':_0x5797f2[_0xf993('0x4')],'app':_0xf993('0x5'),'appdata':_0xf993('0x6')+_0x5797f2[_0xf993('0x4')],'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':_0x5797f2[_0xf993('0x9')]?_0xf993('0x5'):_0xf993('0xa'),'appdata':_0x5797f2['alias']?_0xf993('0xb')+_0x5797f2[_0xf993('0x9')]:'No\x20alias\x20set','context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']}];if(_0x5797f2[_0xf993('0x4')]===_0xf993('0xc')){_0xd9d594['push']({'type':_0xf993('0xc'),'app':'Set','appdata':_0xf993('0xd')+_0x5797f2['id'],'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2['exten'],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']});}_0xd9d594[_0xf993('0xe')]({'type':_0x5797f2['type'],'app':_0xf993('0x5'),'appdata':_0xf993('0xf'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2['exten'],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':_0xf993('0x5'),'appdata':_0xf993('0x10'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']},{'type':_0x5797f2[_0xf993('0x4')],'app':'Set','appdata':_0xf993('0x11'),'context':_0x5797f2[_0xf993('0x7')],'exten':_0x5797f2[_0xf993('0x8')],'priority':_0x29789c++,'VoiceExtensionId':_0x5797f2['id']});return _0xd9d594;}function _0x577adb(_0x51ecc5){var _0x5d69e1=0x2;var _0x10a30f=[{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x13'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0x51ecc5[_0xf993('0x9')]?_0xf993('0x5'):_0xf993('0xa'),'appdata':_0x51ecc5[_0xf993('0x9')]?_0xf993('0xb')+_0x51ecc5[_0xf993('0x9')]:_0xf993('0x14'),'context':_0x51ecc5['context'],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x15')+(_0x51ecc5['cutdigits']?_0xf993('0x16')+_0x51ecc5[_0xf993('0x17')]+'}':_0xf993('0x18')),'context':_0x51ecc5['context'],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':'outbound','app':_0xf993('0x5'),'appdata':_0xf993('0xd')+_0x51ecc5['id'],'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'ExecIf','appdata':_0xf993('0x19')+(_0x5d69e1+0x2)+_0xf993('0x1a')+(_0x5d69e1+0x1)+')','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'Set','appdata':_0x51ecc5['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x51ecc5['cutdigits']+'}':_0xf993('0x1b'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':'Set','appdata':_0xf993('0x10'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x11'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x1c')+_0x51ecc5['id'],'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5['exten'],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']}];if(_0x51ecc5[_0xf993('0x1d')](_0xf993('0x1e'))&&_0x51ecc5['recordingFormat']!==_0xf993('0x1f')){_0x10a30f[_0xf993('0xe')]({'type':_0xf993('0x12'),'app':_0xf993('0x5'),'appdata':_0xf993('0x20'),'context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']},{'type':'outbound','app':_0xf993('0x5'),'appdata':_0xf993('0x21')+_0x51ecc5[_0xf993('0x1e')]||'wav','context':_0x51ecc5[_0xf993('0x7')],'exten':_0x51ecc5[_0xf993('0x8')],'priority':_0x5d69e1++,'VoiceExtensionId':_0x51ecc5['id']});}return _0x10a30f;}function _0x3c621f(_0x3126ac,_0x3322c3){var _0x3894cd=[{'name':_0xf993('0x22'),'param':0x0},{'name':_0xf993('0x23'),'param':0x1},{'name':_0xf993('0x24'),'param':0x2},{'name':_0xf993('0x25'),'param':0x3}];var _0x5915e7={};var _0x2dea5d=_0x3322c3[_0xf993('0x26')](',');var _0x49a932=[];for(var _0x37970f=0x0;_0x37970f<_0x3894cd[_0xf993('0x27')];_0x37970f++){switch(_0x3894cd[_0x37970f][_0xf993('0x28')]){case _0xf993('0x22'):_0x5915e7[_0xf993('0x22')]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]]['split']('/')[0x1];_0x5915e7['phone']=_0x2dea5d[_0x3894cd[_0x37970f]['param']][_0xf993('0x26')]('/')[0x2];_0x5915e7[_0xf993('0x2a')]=_0x5915e7[_0xf993('0x2b')]?_0x5915e7[_0xf993('0x2b')]['split']('$')[0x0]:undefined;_0x5915e7[_0xf993('0x2b')]=_0x3126ac[_0xf993('0x17')]?(_0x5915e7[_0xf993('0x2a')]||'')+'${EXTEN:'+_0x3126ac[_0xf993('0x17')]+'}':(_0x5915e7[_0xf993('0x2a')]||'')+_0xf993('0x18');_0x49a932[_0x3894cd[_0x37970f][_0xf993('0x29')]]=[_0xf993('0x2c'),_0x5915e7[_0xf993('0x22')],_0x5915e7[_0xf993('0x2b')]]['join']('/');break;case _0xf993('0x24'):_0x5915e7[_0xf993('0x24')]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]];if(_0x3126ac['recordingFormat']!==_0xf993('0x1f')){if(_0x5915e7[_0xf993('0x24')][_0xf993('0x2d')](_0xf993('0x2e'))<0x0){_0x5915e7[_0xf993('0x24')]+=_0xf993('0x2e');}}else{_0x5915e7[_0xf993('0x24')]=_0x5915e7[_0xf993('0x24')][_0xf993('0x2f')](_0xf993('0x2e'),'');}_0x49a932[_0x3894cd[_0x37970f][_0xf993('0x29')]]=_0x5915e7[_0xf993('0x24')];break;default:_0x49a932[_0x3894cd[_0x37970f]['param']]=_0x2dea5d[_0x3894cd[_0x37970f][_0xf993('0x29')]];}}return _0x49a932[_0xf993('0x30')](',');}function _0x38582d(_0x551d62,_0x2bec69,_0xb1475a){return new Promise(function(_0x5279ef,_0x42d01c){var _0x2be9f8=[];if(_[_0xf993('0x31')](_0x2bec69))return _0x5279ef(_0x2be9f8);_0x4dee67['Interval'][_0xf993('0x32')]({'attributes':['id',_0xf993('0x33'),_0xf993('0x34')],'raw':!![]})[_0xf993('0x35')](function(_0x421774){for(var _0x2219f4=0x0,_0x272d24=0x0;_0x2219f4<_0x2bec69['length'];_0x2219f4++,_0x272d24=0x0){var _0x35d768=_0x2bec69[_0x2219f4];var _0x3f78e1=[];var _0x1ef4bd=[];delete _0x35d768['id'];if(_0x35d768[_0xf993('0x33')]!==_0xf993('0x36')){_0x35d768['intervals']=[_0x35d768[_0xf993('0x33')]];}else{_0x35d768['intervals']=_0x35d768[_0xf993('0x34')]?_[_0xf993('0x37')](_[_0xf993('0x38')](_0x421774,{'IntervalId':_0x35d768[_0xf993('0x34')]}),_0xf993('0x33')):[];}_0x35d768[_0xf993('0x7')]=_0x551d62[_0xf993('0x7')];_0x35d768['exten']=_0x551d62[_0xf993('0x8')];if(_0x35d768[_0xf993('0x4')])_0x35d768[_0xf993('0x4')]=_0x35d768[_0xf993('0x4')][_0xf993('0x39')]();if(_0x551d62['type']===_0xf993('0x12')){if(_0x35d768[_0xf993('0x1d')](_0xf993('0x3a'))&&_0x35d768['tag']&&_0x35d768['tag']!=='--'){_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')]['toLowerCase'](),'app':_0xf993('0x5'),'appdata':_0xf993('0x3b')+_0x35d768[_0xf993('0x3a')],'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x35d768[_0xf993('0x3d')]?_0xf993('0x3e')+_0x35d768['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}else{if(_0x35d768[_0xf993('0x1d')](_0xf993('0x3f'))){if([_0xf993('0x40'),_0xf993('0x41')][_0xf993('0x42')](_0x35d768['app'][_0xf993('0x39')]())&&_0x35d768[_0xf993('0x43')]!==_0xf993('0x44')){if(_0x35d768[_0xf993('0x3f')]){_0x3f78e1[_0xf993('0xe')]({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x45'),'appdata':_0xf993('0x46'),'context':_0x551d62['context'],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});_0x3f78e1['push']({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x5'),'appdata':_0xf993('0x47'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}else{_0x3f78e1['push']({'type':_0x35d768['type'][_0xf993('0x39')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x551d62['context'],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')]['length']+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});_0x3f78e1['push']({'type':_0x35d768[_0xf993('0x4')][_0xf993('0x39')](),'app':_0xf993('0x5'),'appdata':_0xf993('0x48'),'context':_0x551d62[_0xf993('0x7')],'exten':_0x551d62[_0xf993('0x8')],'priority':_0x35d768[_0xf993('0x3c')][_0xf993('0x27')]+_0xb1475a+_0x272d24++,'VoiceExtensionId':_0x551d62['id']});}}}}for(var _0x43336c=0x0;_0x43336c<_0x35d768[_0xf993('0x3c')][_0xf993('0x27')];_0x43336c++){var _0x4c3325=_0xb1475a+_0x35d768[_0xf993('0x3c')][_0xf993('0x27')];var _0x1fe12e=_0x43336c===_0x35d768[_0xf993('0x3c')]['length']-0x1?_0xb1475a+_0x3f78e1[_0xf993('0x27')]+_0x1ef4bd[_0xf993('0x27')]+0x2:_0xb1475a+_0x43336c+0x1;_0x3f78e1[_0xf993('0x49')](_0x43336c,0x0,{'type':_0x551d62['type'],'app':_0xf993('0x4a'),'appdata':_0x35d768['intervals'][_0x43336c]+'?'+_0x551d62[_0xf993('0x7')]+_0xf993('0x4b')+_0x4c3325+':'+_0x551d62[_0xf993('0x7')]+',${EXTEN},'+_0x1fe12e,'exten':_0x551d62[_0xf993('0x8')],'context':_0x551d62[_0xf993('0x7')],'priority':_0xb1475a+_0x43336c,'VoiceExtensionId':_0x551d62['id']});}if(_0x35d768['appType']==='outboundDial')_0x35d768[_0xf993('0x4c')]=_0x3c621f(_0x551d62,_0x35d768[_0xf993('0x4c')]);_0x35d768[_0xf993('0x4d')]=_0x3f78e1[_0xf993('0x27')]?_[_0xf993('0x4e')](_0x3f78e1)[_0xf993('0x4d')]+0x1:_0xb1475a;_0x2be9f8=_[_0xf993('0x4f')](_0x2be9f8,_0x3f78e1,[_0x35d768],_0x1ef4bd);_0xb1475a=_[_0xf993('0x4e')](_0x2be9f8)[_0xf993('0x4d')]+0x1;}return _0x5279ef(_0x2be9f8);})[_0xf993('0x50')](function(_0x4831a4){_0x42d01c(_0x4831a4);});});}return _0x15faa9[_0xf993('0x51')](_0xf993('0x52'),attributes,{'tableName':_0xf993('0x53'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2f8116){var _0x318a2f=this[_0xf993('0x54')]({'plain':!![]});var _0x2a96dd=_0x318a2f[_0xf993('0x4')]===_0xf993('0x12')?_0x577adb(_0x318a2f):_0x28c80d(_0x318a2f);return _0x38582d(_0x318a2f,_0x2f8116,_[_0xf993('0x4e')](_0x2a96dd)[_0xf993('0x4d')]+0x1)[_0xf993('0x35')](function(_0x24046d){var _0x256955=_[_0xf993('0x4f')](_0x2a96dd,_0x24046d);_0x256955[_0xf993('0xe')]({'type':_0x318a2f['type'],'app':_0xf993('0x55'),'exten':_0x318a2f[_0xf993('0x8')],'context':_0x318a2f['context'],'priority':_[_0xf993('0x4e')](_0x256955)[_0xf993('0x4d')]+0x1,'VoiceExtensionId':_0x318a2f['id']});return _0x256955;});}}});}; \ No newline at end of file +var _0x4d61=['catch','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','NoOp','CDR(routeAlias)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','url','split','length','param','prefix','phone','${EXTEN:','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','includes','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','last','priority'];(function(_0x160dce,_0x321c50){var _0x50865a=function(_0x354d10){while(--_0x354d10){_0x160dce['push'](_0x160dce['shift']());}};_0x50865a(++_0x321c50);}(_0x4d61,0x147));var _0x14d6=function(_0x325d36,_0x7c6b84){_0x325d36=_0x325d36-0x0;var _0x27193e=_0x4d61[_0x325d36];return _0x27193e;};'use strict';var _=require(_0x14d6('0x0'));var attributes=require(_0x14d6('0x1'));module[_0x14d6('0x2')]=function(_0x24999b){var _0x128a58=_0x24999b[_0x14d6('0x3')];function _0x1f4d14(_0x455bd7){var _0x2950b7=0x2;var _0x5da268=[{'type':_0x455bd7[_0x14d6('0x4')],'app':_0x14d6('0x5'),'appdata':_0x14d6('0x6')+_0x455bd7[_0x14d6('0x4')],'context':_0x455bd7[_0x14d6('0x7')],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']},{'type':_0x455bd7[_0x14d6('0x4')],'app':_0x455bd7['alias']?_0x14d6('0x5'):'NoOp','appdata':_0x455bd7[_0x14d6('0x9')]?'CDR(routeAlias)='+_0x455bd7[_0x14d6('0x9')]:_0x14d6('0xa'),'context':_0x455bd7['context'],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']}];if(_0x455bd7[_0x14d6('0x4')]===_0x14d6('0xb')){_0x5da268[_0x14d6('0xc')]({'type':_0x14d6('0xb'),'app':_0x14d6('0x5'),'appdata':_0x14d6('0xd')+_0x455bd7['id'],'context':_0x455bd7[_0x14d6('0x7')],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']});}_0x5da268[_0x14d6('0xc')]({'type':_0x455bd7[_0x14d6('0x4')],'app':'Set','appdata':_0x14d6('0xe'),'context':_0x455bd7[_0x14d6('0x7')],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']},{'type':_0x455bd7[_0x14d6('0x4')],'app':_0x14d6('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x455bd7[_0x14d6('0x7')],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']},{'type':_0x455bd7[_0x14d6('0x4')],'app':_0x14d6('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x455bd7[_0x14d6('0x7')],'exten':_0x455bd7[_0x14d6('0x8')],'priority':_0x2950b7++,'VoiceExtensionId':_0x455bd7['id']});return _0x5da268;}function _0x19464f(_0x5cfc1d){var _0x463487=0x2;var _0x31cc63=[{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':_0x14d6('0x10'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x5cfc1d[_0x14d6('0x9')]?_0x14d6('0x5'):_0x14d6('0x11'),'appdata':_0x5cfc1d['alias']?_0x14d6('0x12')+_0x5cfc1d[_0x14d6('0x9')]:_0x14d6('0xa'),'context':_0x5cfc1d['context'],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':'Set','appdata':'CDR(destination)='+(_0x5cfc1d[_0x14d6('0x13')]?'${EXTEN:'+_0x5cfc1d['cutdigits']+'}':_0x14d6('0x14')),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':_0x14d6('0xd')+_0x5cfc1d['id'],'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d['exten'],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x15'),'appdata':_0x14d6('0x16')+(_0x463487+0x2)+'):Goto('+(_0x463487+0x1)+')','context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':_0x5cfc1d[_0x14d6('0x13')]?_0x14d6('0x17')+_0x5cfc1d[_0x14d6('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':_0x14d6('0xe'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':'outbound','app':'Set','appdata':_0x14d6('0x18'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':'Set','appdata':_0x14d6('0x19'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':'outboundrouteid='+_0x5cfc1d['id'],'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d['exten'],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']}];if(_0x5cfc1d[_0x14d6('0x1a')](_0x14d6('0x1b'))&&_0x5cfc1d[_0x14d6('0x1b')]!==_0x14d6('0x1c')){_0x31cc63[_0x14d6('0xc')]({'type':_0x14d6('0xf'),'app':'Set','appdata':_0x14d6('0x1d'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']},{'type':_0x14d6('0xf'),'app':_0x14d6('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5cfc1d[_0x14d6('0x1b')]||_0x14d6('0x1e'),'context':_0x5cfc1d[_0x14d6('0x7')],'exten':_0x5cfc1d[_0x14d6('0x8')],'priority':_0x463487++,'VoiceExtensionId':_0x5cfc1d['id']});}return _0x31cc63;}function _0x216070(_0x27c52d,_0x174670){var _0x9f9c15=[{'name':_0x14d6('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x14d6('0x20'),'param':0x3}];var _0x54f3ea={};var _0xbeefa3=_0x174670[_0x14d6('0x21')](',');var _0x4b104e=[];for(var _0x47eaa8=0x0;_0x47eaa8<_0x9f9c15[_0x14d6('0x22')];_0x47eaa8++){switch(_0x9f9c15[_0x47eaa8]['name']){case _0x14d6('0x1f'):_0x54f3ea[_0x14d6('0x1f')]=_0xbeefa3[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]][_0x14d6('0x21')]('/')[0x1];_0x54f3ea['phone']=_0xbeefa3[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]][_0x14d6('0x21')]('/')[0x2];_0x54f3ea[_0x14d6('0x24')]=_0x54f3ea[_0x14d6('0x25')]?_0x54f3ea['phone'][_0x14d6('0x21')]('$')[0x0]:undefined;_0x54f3ea['phone']=_0x27c52d['cutdigits']?(_0x54f3ea[_0x14d6('0x24')]||'')+_0x14d6('0x26')+_0x27c52d[_0x14d6('0x13')]+'}':(_0x54f3ea[_0x14d6('0x24')]||'')+_0x14d6('0x14');_0x4b104e[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]]=[_0x14d6('0x27'),_0x54f3ea[_0x14d6('0x1f')],_0x54f3ea[_0x14d6('0x25')]][_0x14d6('0x28')]('/');break;case _0x14d6('0x29'):_0x54f3ea[_0x14d6('0x29')]=_0xbeefa3[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]];if(_0x27c52d[_0x14d6('0x1b')]!==_0x14d6('0x1c')){if(_0x54f3ea[_0x14d6('0x29')][_0x14d6('0x2a')](_0x14d6('0x2b'))<0x0){_0x54f3ea[_0x14d6('0x29')]+=_0x14d6('0x2b');}}else{_0x54f3ea[_0x14d6('0x29')]=_0x54f3ea[_0x14d6('0x29')][_0x14d6('0x2c')](_0x14d6('0x2b'),'');}_0x4b104e[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]]=_0x54f3ea[_0x14d6('0x29')];break;default:_0x4b104e[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]]=_0xbeefa3[_0x9f9c15[_0x47eaa8][_0x14d6('0x23')]];}}return _0x4b104e[_0x14d6('0x28')](',');}function _0x39b796(_0x35c6f0,_0x4f7bce,_0x4e7a4b){return new Promise(function(_0x5328c2,_0x18c3bf){var _0x344224=[];if(_[_0x14d6('0x2d')](_0x4f7bce))return _0x5328c2(_0x344224);_0x128a58['Interval']['findAll']({'attributes':['id',_0x14d6('0x2e'),'IntervalId'],'raw':!![]})[_0x14d6('0x2f')](function(_0x4720aa){for(var _0x3b4263=0x0,_0x40c1d3=0x0;_0x3b4263<_0x4f7bce[_0x14d6('0x22')];_0x3b4263++,_0x40c1d3=0x0){var _0x23dd77=_0x4f7bce[_0x3b4263];var _0x5012af=[];var _0x181f83=[];delete _0x23dd77['id'];if(_0x23dd77[_0x14d6('0x2e')]!==_0x14d6('0x30')){_0x23dd77[_0x14d6('0x31')]=[_0x23dd77[_0x14d6('0x2e')]];}else{_0x23dd77[_0x14d6('0x31')]=_0x23dd77[_0x14d6('0x32')]?_['map'](_[_0x14d6('0x33')](_0x4720aa,{'IntervalId':_0x23dd77[_0x14d6('0x32')]}),_0x14d6('0x2e')):[];}_0x23dd77[_0x14d6('0x7')]=_0x35c6f0['context'];_0x23dd77[_0x14d6('0x8')]=_0x35c6f0[_0x14d6('0x8')];if(_0x23dd77[_0x14d6('0x4')])_0x23dd77[_0x14d6('0x4')]=_0x23dd77[_0x14d6('0x4')][_0x14d6('0x34')]();if(_0x35c6f0[_0x14d6('0x4')]==='outbound'){if(_0x23dd77[_0x14d6('0x1a')](_0x14d6('0x35'))&&_0x23dd77[_0x14d6('0x35')]&&_0x23dd77[_0x14d6('0x35')]!=='--'){_0x5012af[_0x14d6('0xc')]({'type':_0x23dd77['type'][_0x14d6('0x34')](),'app':_0x14d6('0x5'),'appdata':_0x14d6('0x36')+_0x23dd77['tag'],'context':_0x35c6f0[_0x14d6('0x7')],'exten':_0x35c6f0[_0x14d6('0x8')],'priority':_0x23dd77[_0x14d6('0x31')]['length']+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});}_0x5012af['push']({'type':_0x23dd77['type'][_0x14d6('0x34')](),'app':_0x14d6('0x15'),'appdata':_0x14d6('0x37')+(_0x23dd77['callerID']?'Set(CALLERID(all)='+_0x23dd77[_0x14d6('0x38')]+')':_0x14d6('0x39')),'context':_0x35c6f0[_0x14d6('0x7')],'exten':_0x35c6f0[_0x14d6('0x8')],'priority':_0x23dd77[_0x14d6('0x31')][_0x14d6('0x22')]+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});}else{if(_0x23dd77[_0x14d6('0x1a')]('answer')){if([_0x14d6('0x3a'),'playback'][_0x14d6('0x3b')](_0x23dd77['app']['toLowerCase']())&&_0x23dd77['appType']!==_0x14d6('0x3c')){if(_0x23dd77[_0x14d6('0x3d')]){_0x5012af[_0x14d6('0xc')]({'type':_0x23dd77[_0x14d6('0x4')]['toLowerCase'](),'app':_0x14d6('0x15'),'appdata':_0x14d6('0x3e'),'context':_0x35c6f0[_0x14d6('0x7')],'exten':_0x35c6f0[_0x14d6('0x8')],'priority':_0x23dd77[_0x14d6('0x31')]['length']+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});_0x5012af[_0x14d6('0xc')]({'type':_0x23dd77['type'][_0x14d6('0x34')](),'app':_0x14d6('0x5'),'appdata':_0x14d6('0x3f'),'context':_0x35c6f0['context'],'exten':_0x35c6f0[_0x14d6('0x8')],'priority':_0x23dd77[_0x14d6('0x31')][_0x14d6('0x22')]+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});}else{_0x5012af[_0x14d6('0xc')]({'type':_0x23dd77[_0x14d6('0x4')][_0x14d6('0x34')](),'app':_0x14d6('0x15'),'appdata':_0x14d6('0x40'),'context':_0x35c6f0['context'],'exten':_0x35c6f0[_0x14d6('0x8')],'priority':_0x23dd77[_0x14d6('0x31')]['length']+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});_0x5012af[_0x14d6('0xc')]({'type':_0x23dd77[_0x14d6('0x4')][_0x14d6('0x34')](),'app':_0x14d6('0x5'),'appdata':_0x14d6('0x41'),'context':_0x35c6f0['context'],'exten':_0x35c6f0['exten'],'priority':_0x23dd77[_0x14d6('0x31')][_0x14d6('0x22')]+_0x4e7a4b+_0x40c1d3++,'VoiceExtensionId':_0x35c6f0['id']});}}}}for(var _0x20555d=0x0;_0x20555d<_0x23dd77[_0x14d6('0x31')][_0x14d6('0x22')];_0x20555d++){var _0x43bcf3=_0x4e7a4b+_0x23dd77[_0x14d6('0x31')][_0x14d6('0x22')];var _0x1cf02a=_0x20555d===_0x23dd77['intervals'][_0x14d6('0x22')]-0x1?_0x4e7a4b+_0x5012af['length']+_0x181f83[_0x14d6('0x22')]+0x2:_0x4e7a4b+_0x20555d+0x1;_0x5012af['splice'](_0x20555d,0x0,{'type':_0x35c6f0[_0x14d6('0x4')],'app':_0x14d6('0x42'),'appdata':_0x23dd77['intervals'][_0x20555d]+'?'+_0x35c6f0[_0x14d6('0x7')]+',${EXTEN},'+_0x43bcf3+':'+_0x35c6f0[_0x14d6('0x7')]+_0x14d6('0x43')+_0x1cf02a,'exten':_0x35c6f0[_0x14d6('0x8')],'context':_0x35c6f0[_0x14d6('0x7')],'priority':_0x4e7a4b+_0x20555d,'VoiceExtensionId':_0x35c6f0['id']});}if(_0x23dd77[_0x14d6('0x44')]===_0x14d6('0x45'))_0x23dd77[_0x14d6('0x46')]=_0x216070(_0x35c6f0,_0x23dd77[_0x14d6('0x46')]);_0x23dd77['priority']=_0x5012af[_0x14d6('0x22')]?_[_0x14d6('0x47')](_0x5012af)[_0x14d6('0x48')]+0x1:_0x4e7a4b;_0x344224=_['concat'](_0x344224,_0x5012af,[_0x23dd77],_0x181f83);_0x4e7a4b=_[_0x14d6('0x47')](_0x344224)['priority']+0x1;}return _0x5328c2(_0x344224);})[_0x14d6('0x49')](function(_0x1cedb9){_0x18c3bf(_0x1cedb9);});});}return _0x24999b[_0x14d6('0x4a')](_0x14d6('0x4b'),attributes,{'tableName':_0x14d6('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x351135){var _0x5f5044=this[_0x14d6('0x4d')]({'plain':!![]});var _0x403420=_0x5f5044[_0x14d6('0x4')]===_0x14d6('0xf')?_0x19464f(_0x5f5044):_0x1f4d14(_0x5f5044);return _0x39b796(_0x5f5044,_0x351135,_[_0x14d6('0x47')](_0x403420)[_0x14d6('0x48')]+0x1)[_0x14d6('0x2f')](function(_0x27375c){var _0x47b823=_[_0x14d6('0x4e')](_0x403420,_0x27375c);_0x47b823[_0x14d6('0xc')]({'type':_0x5f5044[_0x14d6('0x4')],'app':_0x14d6('0x4f'),'exten':_0x5f5044['exten'],'context':_0x5f5044[_0x14d6('0x7')],'priority':_['last'](_0x47b823)[_0x14d6('0x48')]+0x1,'VoiceExtensionId':_0x5f5044['id']});return _0x47b823;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 630e852..fa0fd73 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 _0x9120=['debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceExtension','findAll','raw','options','where','attributes','include','model','GetVoiceExtension','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent'];(function(_0x3144b3,_0x45f961){var _0x2517a9=function(_0x15af07){while(--_0x15af07){_0x3144b3['push'](_0x3144b3['shift']());}};_0x2517a9(++_0x45f961);}(_0x9120,0x1b3));var _0x0912=function(_0x1b6a84,_0x5d43e0){_0x1b6a84=_0x1b6a84-0x0;var _0x181fed=_0x9120[_0x1b6a84];return _0x181fed;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require(_0x0912('0x2'));var BPromise=require(_0x0912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0912('0x4'))['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))(_0x0912('0x7'));var config=require(_0x0912('0x8'));var jayson=require(_0x0912('0x9'));var client=jayson['client'][_0x0912('0xa')]({'port':0x232a});config[_0x0912('0xb')]=_[_0x0912('0xc')](config['redis'],{'host':_0x0912('0xd'),'port':0x18eb});var socket=require(_0x0912('0xe'))(new Redis(config[_0x0912('0xb')]));require(_0x0912('0xf'))[_0x0912('0x10')](socket);function respondWithRpcPromise(_0x5468d4,_0x1aa7d2,_0x6581e6){return new BPromise(function(_0x1141a5,_0x32af1a){return client['request'](_0x5468d4,_0x6581e6)[_0x0912('0x11')](function(_0x50448d){logger[_0x0912('0x12')](_0x0912('0x13'),_0x1aa7d2,_0x0912('0x14'));logger[_0x0912('0x15')](_0x0912('0x16'),_0x1aa7d2,_0x0912('0x14'),JSON[_0x0912('0x17')](_0x50448d));if(_0x50448d[_0x0912('0x18')]){if(_0x50448d[_0x0912('0x18')][_0x0912('0x19')]===0x1f4){logger[_0x0912('0x18')](_0x0912('0x13'),_0x1aa7d2,_0x50448d[_0x0912('0x18')][_0x0912('0x1a')]);return _0x32af1a(_0x50448d[_0x0912('0x18')]['message']);}logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x50448d['error'][_0x0912('0x1a')]);return _0x1141a5(_0x50448d['error'][_0x0912('0x1a')]);}else{logger['info'](_0x0912('0x13'),_0x1aa7d2,'request\x20sent');_0x1141a5(_0x50448d[_0x0912('0x1b')]['message']);}})[_0x0912('0x1c')](function(_0x56e6e2){logger['error'](_0x0912('0x13'),_0x1aa7d2,_0x56e6e2);_0x32af1a(_0x56e6e2);});});}exports['GetVoiceExtension']=function(_0x2ddcb7){var _0x1da565=this;return new Promise(function(_0x4b1e07,_0x106008){return db[_0x0912('0x1d')][_0x0912('0x1e')]({'raw':_0x2ddcb7['options']?_0x2ddcb7['options'][_0x0912('0x1f')]===undefined?!![]:![]:!![],'where':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x21')]||null:null,'attributes':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x22')]||null:null,'limit':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')]['limit']||null:null,'include':_0x2ddcb7[_0x0912('0x20')]?_0x2ddcb7[_0x0912('0x20')][_0x0912('0x23')]?_['map'](_0x2ddcb7['options'][_0x0912('0x23')],function(_0x53d673){return{'model':db[_0x53d673['model']],'as':_0x53d673['as'],'attributes':_0x53d673[_0x0912('0x22')],'include':_0x53d673[_0x0912('0x23')]?_['map'](_0x53d673[_0x0912('0x23')],function(_0x305831){return{'model':db[_0x305831[_0x0912('0x24')]],'as':_0x305831['as'],'attributes':_0x305831[_0x0912('0x22')],'include':_0x305831[_0x0912('0x23')]?_['map'](_0x305831[_0x0912('0x23')],function(_0x1d6c87){return{'model':db[_0x1d6c87['model']],'as':_0x1d6c87['as'],'attributes':_0x1d6c87[_0x0912('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0912('0x11')](function(_0x2ce714){logger['info'](_0x0912('0x25'),_0x2ddcb7);logger[_0x0912('0x15')](_0x0912('0x25'),_0x2ddcb7,JSON[_0x0912('0x17')](_0x2ce714));_0x4b1e07(_0x2ce714);})['catch'](function(_0x448fa3){logger[_0x0912('0x18')](_0x0912('0x25'),_0x448fa3[_0x0912('0x1a')],_0x2ddcb7);_0x106008(_0x1da565[_0x0912('0x18')](0x1f4,_0x448fa3[_0x0912('0x1a')]));});});}; \ No newline at end of file +var _0x02ca=['options','raw','attributes','include','map','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll'];(function(_0x289a1b,_0x226faa){var _0x568f82=function(_0x371a48){while(--_0x371a48){_0x289a1b['push'](_0x289a1b['shift']());}};_0x568f82(++_0x226faa);}(_0x02ca,0x97));var _0xa02c=function(_0x2fa9d8,_0x23c7ae){_0x2fa9d8=_0x2fa9d8-0x0;var _0x5cab9e=_0x02ca[_0x2fa9d8];return _0x5cab9e;};'use strict';var _=require(_0xa02c('0x0'));var util=require('util');var moment=require(_0xa02c('0x1'));var BPromise=require(_0xa02c('0x2'));var rs=require(_0xa02c('0x3'));var fs=require('fs');var Redis=require(_0xa02c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa02c('0x5'));var logger=require(_0xa02c('0x6'))(_0xa02c('0x7'));var config=require(_0xa02c('0x8'));var jayson=require(_0xa02c('0x9'));var client=jayson[_0xa02c('0xa')][_0xa02c('0xb')]({'port':0x232a});config[_0xa02c('0xc')]=_[_0xa02c('0xd')](config[_0xa02c('0xc')],{'host':_0xa02c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa02c('0xc')]));require(_0xa02c('0xf'))[_0xa02c('0x10')](socket);function respondWithRpcPromise(_0x30e1aa,_0x14ffc2,_0x565373){return new BPromise(function(_0x5c553f,_0x50df17){return client['request'](_0x30e1aa,_0x565373)[_0xa02c('0x11')](function(_0x14c96f){logger[_0xa02c('0x12')](_0xa02c('0x13'),_0x14ffc2,'request\x20sent');logger[_0xa02c('0x14')](_0xa02c('0x15'),_0x14ffc2,_0xa02c('0x16'),JSON[_0xa02c('0x17')](_0x14c96f));if(_0x14c96f['error']){if(_0x14c96f[_0xa02c('0x18')][_0xa02c('0x19')]===0x1f4){logger[_0xa02c('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x50df17(_0x14c96f['error'][_0xa02c('0x1a')]);}logger[_0xa02c('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x5c553f(_0x14c96f[_0xa02c('0x18')]['message']);}else{logger[_0xa02c('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,'request\x20sent');_0x5c553f(_0x14c96f['result'][_0xa02c('0x1a')]);}})[_0xa02c('0x1b')](function(_0x16ac46){logger['error'](_0xa02c('0x13'),_0x14ffc2,_0x16ac46);_0x50df17(_0x16ac46);});});}exports['GetVoiceExtension']=function(_0x3311d2){var _0x12ff75=this;return new Promise(function(_0x38c479,_0x476777){return db['VoiceExtension'][_0xa02c('0x1c')]({'raw':_0x3311d2['options']?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2['options']['where']||null:null,'attributes':_0x3311d2['options']?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x1f')]||null:null,'limit':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2['options']['limit']||null:null,'include':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x20')]?_[_0xa02c('0x21')](_0x3311d2[_0xa02c('0x1d')]['include'],function(_0x4de358){return{'model':db[_0x4de358[_0xa02c('0x22')]],'as':_0x4de358['as'],'attributes':_0x4de358[_0xa02c('0x1f')],'include':_0x4de358[_0xa02c('0x20')]?_[_0xa02c('0x21')](_0x4de358[_0xa02c('0x20')],function(_0x3f4e0d){return{'model':db[_0x3f4e0d[_0xa02c('0x22')]],'as':_0x3f4e0d['as'],'attributes':_0x3f4e0d[_0xa02c('0x1f')],'include':_0x3f4e0d['include']?_[_0xa02c('0x21')](_0x3f4e0d[_0xa02c('0x20')],function(_0x31b520){return{'model':db[_0x31b520[_0xa02c('0x22')]],'as':_0x31b520['as'],'attributes':_0x31b520[_0xa02c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa02c('0x11')](function(_0x19f1c9){logger[_0xa02c('0x12')](_0xa02c('0x23'),_0x3311d2);logger['debug'](_0xa02c('0x23'),_0x3311d2,JSON[_0xa02c('0x17')](_0x19f1c9));_0x38c479(_0x19f1c9);})[_0xa02c('0x1b')](function(_0x4de1ac){logger['error'](_0xa02c('0x23'),_0x4de1ac[_0xa02c('0x1a')],_0x3311d2);_0x476777(_0x12ff75[_0xa02c('0x18')](0x1f4,_0x4de1ac[_0xa02c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 814caaf..d0ab04a 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x2f396d,_0x453314){var _0x20ac04=function(_0x1d5e27){while(--_0x1d5e27){_0x2f396d['push'](_0x2f396d['shift']());}};_0x20ac04(++_0x453314);}(_0xabce,0x103));var _0xeabc=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xabce[_0x411add];return _0x238242;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x933190,_0x6d6251){var _0x121fa8=function(_0x174fe7){while(--_0x174fe7){_0x933190['push'](_0x933190['shift']());}};_0x121fa8(++_0x6d6251);}(_0x0295,0x1f0));var _0x5029=function(_0x20c757,_0xf1f53b){_0x20c757=_0x20c757-0x0;var _0x2720f3=_0x0295[_0x20c757];return _0x2720f3;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 77dbb59..eae5795 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 _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x232715,_0x4bd63e){_0x232715=_0x232715-0x0;var _0x1e6090=_0x8ace[_0x232715];return _0x1e6090;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file +var _0x583c=['fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show','getMessages','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0xee588,_0x368239){var _0x58dd1a=function(_0x3fd2b1){while(--_0x3fd2b1){_0xee588['push'](_0xee588['shift']());}};_0x58dd1a(++_0x368239);}(_0x583c,0x12b));var _0xc583=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x583c[_0x1e500e];return _0x10dc5e;};'use strict';var multer=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var path=require(_0xc583('0x2'));var timeout=require(_0xc583('0x3'));var express=require('express');var router=express[_0xc583('0x4')]();var fs_extra=require(_0xc583('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc583('0x6'));var controller=require(_0xc583('0x7'));router['get']('/',auth[_0xc583('0x8')](),controller[_0xc583('0x9')]);router[_0xc583('0xa')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0xc')]);router[_0xc583('0xa')]('/:id/messages',auth[_0xc583('0x8')](),controller[_0xc583('0xd')]);router[_0xc583('0xe')]('/',auth[_0xc583('0x8')](),controller[_0xc583('0xf')]);router['put'](_0xc583('0xb'),auth[_0xc583('0x8')](),controller['update']);router[_0xc583('0x10')](_0xc583('0xb'),auth['isAuthenticated'](),controller[_0xc583('0x11')]);module[_0xc583('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ab93c3c..50cb6a9 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 _0x9903=['exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20'];(function(_0x56fd9f,_0x68e47f){var _0x267160=function(_0x2b9aab){while(--_0x2b9aab){_0x56fd9f['push'](_0x56fd9f['shift']());}};_0x267160(++_0x68e47f);}(_0x9903,0x11d));var _0x3990=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9903[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3990('0x0')]={'customer_id':{'type':Sequelize[_0x3990('0x1')]},'context':{'type':Sequelize[_0x3990('0x1')],'defaultValue':_0x3990('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x3990('0x1')],'defaultValue':'','allowNull':![],'unique':_0x3990('0x3')},'password':{'type':Sequelize[_0x3990('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3990('0x1')],'validate':{'isEmail':!![]},'set':function(_0x308955){this[_0x3990('0x4')]('email',typeof _0x308955===_0x3990('0x5')&&_0x308955['trim']()?_0x308955[_0x3990('0x6')]():null);}},'pager':{'type':Sequelize[_0x3990('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3990('0x1')]},'callback':{'type':Sequelize[_0x3990('0x1')]},'review':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3990('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3990('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3990('0x7')](_0x3990('0x8'),'no'),'defaultValue':_0x3990('0x8'),'allowNull':![]},'stamp':{'type':_0x3990('0xa')},'emailsubject':{'type':Sequelize[_0x3990('0x1')]},'emailbody':{'type':Sequelize[_0x3990('0x1')]},'maxsecs':{'type':Sequelize[_0x3990('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3990('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3990('0xc')](_0x3990('0xd'))+_0x3990('0xe')+this[_0x3990('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x6afc=['mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','string','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x6afc,0x111));var _0xc6af=function(_0x2034c6,_0x30c939){_0x2034c6=_0x2034c6-0x0;var _0x52bad0=_0x6afc[_0x2034c6];return _0x52bad0;};'use strict';var Sequelize=require(_0xc6af('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xc6af('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xc6af('0x2'),'unique':_0xc6af('0x3')},'mailbox':{'type':Sequelize[_0xc6af('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc6af('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xc6af('0x1')]},'email':{'type':Sequelize[_0xc6af('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3fc553){this[_0xc6af('0x4')]('email',typeof _0x3fc553===_0xc6af('0x5')&&_0x3fc553['trim']()?_0x3fc553['trim']():null);}},'pager':{'type':Sequelize[_0xc6af('0x1')]},'tz':{'type':Sequelize[_0xc6af('0x1')],'defaultValue':_0xc6af('0x6')},'attach':{'type':Sequelize[_0xc6af('0x7')]('yes','no'),'defaultValue':_0xc6af('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':_0xc6af('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc6af('0x1')]},'callback':{'type':Sequelize[_0xc6af('0x1')]},'review':{'type':Sequelize['ENUM'](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc6af('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':_0xc6af('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc6af('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc6af('0x7')](_0xc6af('0x8'),'no'),'defaultValue':_0xc6af('0x8'),'allowNull':![]},'stamp':{'type':_0xc6af('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc6af('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc6af('0xc')](_0xc6af('0xd'))+_0xc6af('0xe')+this['getDataValue'](_0xc6af('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ec80585..d891516 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 _0xefda=['sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','mailbox','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3d829d,_0x5af899){var _0x318701=function(_0x30e7cd){while(--_0x30e7cd){_0x3d829d['push'](_0x3d829d['shift']());}};_0x318701(++_0x5af899);}(_0xefda,0x96));var _0xaefd=function(_0x2dd2f1,_0x299119){_0x2dd2f1=_0x2dd2f1-0x0;var _0xcd378f=_0xefda[_0x2dd2f1];return _0xcd378f;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){var _0x1a05eb=_0x4cd9b2['get']({'plain':!![]});var _0x435413=_0xaefd('0x28');return db[_0xaefd('0x29')][_0xaefd('0x27')]({'where':{'type':_0x435413,'resourceId':_0x1a05eb['id']}})[_0xaefd('0x26')](function(){return _0x4cd9b2;});})['then'](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x810bf,_0x16f10f){return function(_0x5470bd){if(!_0x5470bd){_0x810bf[_0xaefd('0x18')](0x194);}return _0x5470bd;};}function handleError(_0x2a8fa8,_0x521839){_0x521839=_0x521839||0x1f4;return function(_0xbeb1b8){logger[_0xaefd('0x2a')](_0xbeb1b8[_0xaefd('0x2b')]);if(_0xbeb1b8['name']){delete _0xbeb1b8[_0xaefd('0x2c')];}_0x2a8fa8['status'](_0x521839)[_0xaefd('0x2d')](_0xbeb1b8);};}exports['index']=function(_0x4a1acb,_0x1d89c4){var _0x1b470c={},_0x4a032d={},_0x578378={'count':0x0,'rows':[]};var _0x4ee0c1=_[_0xaefd('0x2e')](db[_0xaefd('0x2f')]['rawAttributes'],function(_0x5503d0){return{'name':_0x5503d0[_0xaefd('0x30')],'type':_0x5503d0[_0xaefd('0x31')][_0xaefd('0x32')]};});_0x4a032d[_0xaefd('0x33')]=_['map'](_0x4ee0c1,_0xaefd('0x2c'));_0x4a032d[_0xaefd('0x34')]=_[_0xaefd('0x35')](_0x4a1acb[_0xaefd('0x34')]);_0x4a032d[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],_0x4a032d[_0xaefd('0x34')]);_0x1b470c[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x39')]));_0x1b470c[_0xaefd('0x38')]=_0x1b470c[_0xaefd('0x38')]['length']?_0x1b470c[_0xaefd('0x38')]:_0x4a032d[_0xaefd('0x33')];if(!_0x4a1acb[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x1b470c['limit']=qs[_0xaefd('0x1d')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1d')]);_0x1b470c[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1b')]);}_0x1b470c[_0xaefd('0x3b')]=qs[_0xaefd('0x3c')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x1b470c[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x4a1acb['query'],_0x4a032d[_0xaefd('0x36')]),_0x4ee0c1);if(_0x4a1acb['query'][_0xaefd('0x3f')]){_0x1b470c[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x1b470c[_0xaefd('0x3d')],{'$or':_[_0xaefd('0x2e')](_0x4ee0c1,function(_0x3c9331){if(_0x3c9331[_0xaefd('0x31')]!==_0xaefd('0x41')){var _0x3c7022={};_0x3c7022[_0x3c9331[_0xaefd('0x2c')]]={'$like':'%'+_0x4a1acb['query'][_0xaefd('0x3f')]+'%'};return _0x3c7022;}})});}_0x1b470c=_[_0xaefd('0x40')]({},_0x1b470c,_0x4a1acb['options']);var _0x427f00={'where':_0x1b470c[_0xaefd('0x3d')]};return db[_0xaefd('0x2f')]['count'](_0x427f00)['then'](function(_0x43b6a6){_0x578378[_0xaefd('0x1e')]=_0x43b6a6;if(_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x42')]){_0x1b470c[_0xaefd('0x43')]=[{'all':!![]}];}return db[_0xaefd('0x2f')][_0xaefd('0x44')](_0x1b470c);})[_0xaefd('0x26')](function(_0x48a7af){_0x578378[_0xaefd('0x45')]=_0x48a7af;return _0x578378;})[_0xaefd('0x26')](respondWithFilteredResult(_0x1d89c4,_0x1b470c))[_0xaefd('0x46')](handleError(_0x1d89c4,null));};exports[_0xaefd('0x47')]=function(_0x20d5fd,_0x197f3f){var _0x3633ec={'raw':!![],'where':{'id':_0x20d5fd['params']['id']}},_0x1f4a15={};_0x1f4a15['model']=_[_0xaefd('0x35')](db[_0xaefd('0x2f')]['rawAttributes']);_0x1f4a15['query']=_[_0xaefd('0x35')](_0x20d5fd[_0xaefd('0x34')]);_0x1f4a15[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],_0x1f4a15[_0xaefd('0x34')]);_0x3633ec[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],qs['fields'](_0x20d5fd[_0xaefd('0x34')][_0xaefd('0x39')]));_0x3633ec[_0xaefd('0x38')]=_0x3633ec[_0xaefd('0x38')][_0xaefd('0x48')]?_0x3633ec[_0xaefd('0x38')]:_0x1f4a15[_0xaefd('0x33')];if(_0x20d5fd['query'][_0xaefd('0x42')]){_0x3633ec['include']=[{'all':!![]}];}_0x3633ec=_[_0xaefd('0x40')]({},_0x3633ec,_0x20d5fd[_0xaefd('0x49')]);return db[_0xaefd('0x2f')][_0xaefd('0x4a')](_0x3633ec)['then'](handleEntityNotFound(_0x197f3f,null))['then'](respondWithResult(_0x197f3f,null))[_0xaefd('0x46')](handleError(_0x197f3f,null));};exports[_0xaefd('0x4b')]=function(_0x179b8b,_0x4eeb56){return db[_0xaefd('0x2f')][_0xaefd('0x4b')](_0x179b8b['body'],{})[_0xaefd('0x26')](function(_0xf2783d){var _0x3c6a3e=_0x179b8b[_0xaefd('0x4c')][_0xaefd('0x4d')]({'plain':!![]});if(!_0x3c6a3e)throw new Error(_0xaefd('0x4e'));if(_0x3c6a3e[_0xaefd('0x4f')]===_0xaefd('0x4c')){var _0x4dc674=_0xf2783d['get']({'plain':!![]});var _0x1406b8=_0xaefd('0x28');return db['UserProfileSection'][_0xaefd('0x4a')]({'where':{'name':_0x1406b8,'userProfileId':_0x3c6a3e['userProfileId']},'raw':!![]})[_0xaefd('0x26')](function(_0x47296d){if(_0x47296d&&_0x47296d[_0xaefd('0x50')]===0x0){return db[_0xaefd('0x29')][_0xaefd('0x4b')]({'name':_0x4dc674[_0xaefd('0x2c')],'resourceId':_0x4dc674['id'],'type':_0x47296d['name'],'sectionId':_0x47296d['id']},{})['then'](function(){return _0xf2783d;});}else{return _0xf2783d;}})[_0xaefd('0x46')](function(_0x338823){logger['error'](_0xaefd('0x51'),_0x338823);throw _0x338823;});}return _0xf2783d;})[_0xaefd('0x26')](respondWithResult(_0x4eeb56,0xc9))[_0xaefd('0x46')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x25')]=function(_0x4a883b,_0x583caa){if(_0x4a883b[_0xaefd('0x52')]['id']){delete _0x4a883b[_0xaefd('0x52')]['id'];}return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x4a883b[_0xaefd('0x53')]['id']}})['then'](handleEntityNotFound(_0x583caa,null))[_0xaefd('0x26')](saveUpdates(_0x4a883b[_0xaefd('0x52')],null))['then'](respondWithResult(_0x583caa,null))[_0xaefd('0x46')](handleError(_0x583caa,null));};exports[_0xaefd('0x27')]=function(_0x5f2925,_0x108e35){return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x5f2925['params']['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x108e35,null))[_0xaefd('0x26')](removeEntity(_0x108e35,null))['catch'](handleError(_0x108e35,null));};exports[_0xaefd('0x54')]=function(_0x21b65c,_0x14b472,_0x2dd1ee){return db['VoiceMail']['findOne']({'where':{'id':_0x21b65c[_0xaefd('0x53')]['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x14b472,null))[_0xaefd('0x26')](function(_0x3e1673){var _0x4189c4;var _0x8ab9e7={},_0x314660={};_0x314660[_0xaefd('0x33')]=_[_0xaefd('0x35')](db[_0xaefd('0x55')]['rawAttributes']);_0x314660['query']=_[_0xaefd('0x35')](_0x21b65c[_0xaefd('0x34')]);_0x314660[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x314660['model'],_0x314660[_0xaefd('0x34')]);_0x8ab9e7[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x314660[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x39')]));_0x8ab9e7[_0xaefd('0x38')]=_0x8ab9e7['attributes'][_0xaefd('0x48')]?_0x8ab9e7[_0xaefd('0x38')]:_0x314660[_0xaefd('0x33')];if(!_0x21b65c[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x8ab9e7['limit']=qs[_0xaefd('0x1d')](_0x21b65c[_0xaefd('0x34')]['limit']);_0x8ab9e7['offset']=qs[_0xaefd('0x1b')](_0x21b65c['query']['offset']);}_0x8ab9e7['order']=qs[_0xaefd('0x3c')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x8ab9e7[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x21b65c['query'],_0x314660['filters']));if(_0x21b65c['query']['filter']){_0x8ab9e7[_0xaefd('0x3d')]=_['merge'](_0x8ab9e7[_0xaefd('0x3d')],{'$or':_['map'](_0x8ab9e7[_0xaefd('0x38')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3f')]+'%'};return _0x416241;})});}_0x8ab9e7[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x8ab9e7['where'],{'mailboxuser':_0x3e1673[_0xaefd('0x56')]});_0x8ab9e7=_[_0xaefd('0x40')]({},_0x8ab9e7,_0x21b65c[_0xaefd('0x49')]);return db[_0xaefd('0x55')]['findAndCountAll'](_0x8ab9e7)[_0xaefd('0x26')](respondWithFilteredResult(_0x14b472,_0x8ab9e7));})['catch'](handleError(_0x14b472,null));}; \ No newline at end of file +var _0xed3c=['body','getMessages','findOne','order','sort','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','autoAssociation'];(function(_0x2904ad,_0x25177c){var _0x1e15eb=function(_0x4a7ce1){while(--_0x4a7ce1){_0x2904ad['push'](_0x2904ad['shift']());}};_0x1e15eb(++_0x25177c);}(_0xed3c,0x1a6));var _0xced3=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0xed3c[_0x329905];return _0x3aa42;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];function respondWithStatusCode(_0x42d879,_0x3b2ac4){_0x3b2ac4=_0x3b2ac4||0xcc;return function(_0x457caf){if(_0x457caf){return _0x42d879[_0xced3('0x16')](_0x3b2ac4);}return _0x42d879[_0xced3('0x17')](_0x3b2ac4)['end']();};}function respondWithResult(_0x65bb58,_0x5e186e){_0x5e186e=_0x5e186e||0xc8;return function(_0xf2db6f){if(_0xf2db6f){return _0x65bb58[_0xced3('0x17')](_0x5e186e)[_0xced3('0x18')](_0xf2db6f);}};}function respondWithFilteredResult(_0x39e4aa,_0x4dd4c3){return function(_0x146a21){if(_0x146a21){var _0x322c2d=typeof _0x4dd4c3['offset']===_0xced3('0x19')&&typeof _0x4dd4c3[_0xced3('0x1a')]===_0xced3('0x19');var _0x17f611=_0x146a21['count'];var _0x4569af=_0x322c2d?0x0:_0x4dd4c3['offset'];var _0x353580=_0x322c2d?_0x146a21[_0xced3('0x1b')]:_0x4dd4c3[_0xced3('0x1c')]+_0x4dd4c3[_0xced3('0x1a')];var _0x44143f;if(_0x353580>=_0x17f611){_0x353580=_0x17f611;_0x44143f=0xc8;}else{_0x44143f=0xce;}_0x39e4aa[_0xced3('0x17')](_0x44143f);return _0x39e4aa[_0xced3('0x1d')](_0xced3('0x1e'),_0x4569af+'-'+_0x353580+'/'+_0x17f611)[_0xced3('0x18')](_0x146a21);}return null;};}function patchUpdates(_0x17c011){return function(_0x2008f2){try{jsonpatch['apply'](_0x2008f2,_0x17c011,!![]);}catch(_0x5b8b1f){return BPromise['reject'](_0x5b8b1f);}return _0x2008f2[_0xced3('0x1f')]();};}function saveUpdates(_0x342b9e,_0x21e074){return function(_0x4bf915){if(_0x4bf915){return _0x4bf915[_0xced3('0x20')](_0x342b9e)[_0xced3('0x21')](function(_0x526854){return _0x526854;});}return null;};}function removeEntity(_0x559fa2,_0x3adf14){return function(_0x101708){if(_0x101708){return _0x101708[_0xced3('0x22')]()[_0xced3('0x21')](function(){var _0x50f7c1=_0x101708[_0xced3('0x23')]({'plain':!![]});var _0x23f92b='Voicemails';return db[_0xced3('0x24')]['destroy']({'where':{'type':_0x23f92b,'resourceId':_0x50f7c1['id']}})[_0xced3('0x21')](function(){return _0x101708;});})[_0xced3('0x21')](function(){_0x559fa2[_0xced3('0x17')](0xcc)[_0xced3('0x25')]();});}};}function handleEntityNotFound(_0x2ec2c4,_0x502cf1){return function(_0x5454c0){if(!_0x5454c0){_0x2ec2c4[_0xced3('0x16')](0x194);}return _0x5454c0;};}function handleError(_0x5bb425,_0x2ab8a8){_0x2ab8a8=_0x2ab8a8||0x1f4;return function(_0x1e6923){logger['error'](_0x1e6923[_0xced3('0x26')]);if(_0x1e6923[_0xced3('0x27')]){delete _0x1e6923[_0xced3('0x27')];}_0x5bb425[_0xced3('0x17')](_0x2ab8a8)[_0xced3('0x28')](_0x1e6923);};}exports[_0xced3('0x29')]=function(_0x895a32,_0x41d003){var _0x116cc7={},_0x559b8e={},_0xa78899={'count':0x0,'rows':[]};var _0x1b8baa=_[_0xced3('0x2a')](db[_0xced3('0x2b')][_0xced3('0x2c')],function(_0x21e4a2){return{'name':_0x21e4a2[_0xced3('0x2d')],'type':_0x21e4a2[_0xced3('0x2e')][_0xced3('0x2f')]};});_0x559b8e[_0xced3('0x30')]=_[_0xced3('0x2a')](_0x1b8baa,_0xced3('0x27'));_0x559b8e[_0xced3('0x31')]=_[_0xced3('0x32')](_0x895a32[_0xced3('0x31')]);_0x559b8e[_0xced3('0x33')]=_[_0xced3('0x34')](_0x559b8e[_0xced3('0x30')],_0x559b8e[_0xced3('0x31')]);_0x116cc7[_0xced3('0x35')]=_[_0xced3('0x34')](_0x559b8e['model'],qs[_0xced3('0x36')](_0x895a32['query'][_0xced3('0x36')]));_0x116cc7[_0xced3('0x35')]=_0x116cc7[_0xced3('0x35')][_0xced3('0x37')]?_0x116cc7[_0xced3('0x35')]:_0x559b8e[_0xced3('0x30')];if(!_0x895a32[_0xced3('0x31')][_0xced3('0x38')](_0xced3('0x39'))){_0x116cc7[_0xced3('0x1a')]=qs['limit'](_0x895a32[_0xced3('0x31')][_0xced3('0x1a')]);_0x116cc7['offset']=qs[_0xced3('0x1c')](_0x895a32[_0xced3('0x31')][_0xced3('0x1c')]);}_0x116cc7['order']=qs['sort'](_0x895a32[_0xced3('0x31')]['sort']);_0x116cc7[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x895a32[_0xced3('0x31')],_0x559b8e[_0xced3('0x33')]),_0x1b8baa);if(_0x895a32[_0xced3('0x31')]['filter']){_0x116cc7[_0xced3('0x3a')]=_['merge'](_0x116cc7['where'],{'$or':_[_0xced3('0x2a')](_0x1b8baa,function(_0x31e281){if(_0x31e281[_0xced3('0x2e')]!=='VIRTUAL'){var _0xb2cf20={};_0xb2cf20[_0x31e281[_0xced3('0x27')]]={'$like':'%'+_0x895a32[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0xb2cf20;}})});}_0x116cc7=_[_0xced3('0x3c')]({},_0x116cc7,_0x895a32[_0xced3('0x3d')]);var _0x30e890={'where':_0x116cc7[_0xced3('0x3a')]};return db[_0xced3('0x2b')][_0xced3('0x1b')](_0x30e890)[_0xced3('0x21')](function(_0x38855f){_0xa78899[_0xced3('0x1b')]=_0x38855f;if(_0x895a32[_0xced3('0x31')][_0xced3('0x3e')]){_0x116cc7['include']=[{'all':!![]}];}return db[_0xced3('0x2b')][_0xced3('0x3f')](_0x116cc7);})[_0xced3('0x21')](function(_0x1a6c1f){_0xa78899[_0xced3('0x40')]=_0x1a6c1f;return _0xa78899;})[_0xced3('0x21')](respondWithFilteredResult(_0x41d003,_0x116cc7))[_0xced3('0x41')](handleError(_0x41d003,null));};exports[_0xced3('0x42')]=function(_0x1ab7e0,_0x4cea5c){var _0x6c0238={'raw':!![],'where':{'id':_0x1ab7e0[_0xced3('0x43')]['id']}},_0x47ab23={};_0x47ab23[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMail'][_0xced3('0x2c')]);_0x47ab23[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1ab7e0[_0xced3('0x31')]);_0x47ab23['filters']=_[_0xced3('0x34')](_0x47ab23[_0xced3('0x30')],_0x47ab23[_0xced3('0x31')]);_0x6c0238[_0xced3('0x35')]=_[_0xced3('0x34')](_0x47ab23['model'],qs[_0xced3('0x36')](_0x1ab7e0[_0xced3('0x31')][_0xced3('0x36')]));_0x6c0238[_0xced3('0x35')]=_0x6c0238[_0xced3('0x35')][_0xced3('0x37')]?_0x6c0238[_0xced3('0x35')]:_0x47ab23['model'];if(_0x1ab7e0[_0xced3('0x31')][_0xced3('0x3e')]){_0x6c0238['include']=[{'all':!![]}];}_0x6c0238=_['merge']({},_0x6c0238,_0x1ab7e0[_0xced3('0x3d')]);return db['VoiceMail'][_0xced3('0x44')](_0x6c0238)[_0xced3('0x21')](handleEntityNotFound(_0x4cea5c,null))[_0xced3('0x21')](respondWithResult(_0x4cea5c,null))[_0xced3('0x41')](handleError(_0x4cea5c,null));};exports[_0xced3('0x45')]=function(_0x1b3396,_0x3700ed){return db[_0xced3('0x2b')][_0xced3('0x45')](_0x1b3396['body'],{})[_0xced3('0x21')](function(_0x8df206){var _0x2aa876=_0x1b3396[_0xced3('0x46')][_0xced3('0x23')]({'plain':!![]});if(!_0x2aa876)throw new Error(_0xced3('0x47'));if(_0x2aa876['role']===_0xced3('0x46')){var _0x629ecf=_0x8df206[_0xced3('0x23')]({'plain':!![]});var _0x409da0=_0xced3('0x48');return db[_0xced3('0x49')][_0xced3('0x44')]({'where':{'name':_0x409da0,'userProfileId':_0x2aa876[_0xced3('0x4a')]},'raw':!![]})[_0xced3('0x21')](function(_0x44d779){if(_0x44d779&&_0x44d779[_0xced3('0x4b')]===0x0){return db[_0xced3('0x24')]['create']({'name':_0x629ecf[_0xced3('0x27')],'resourceId':_0x629ecf['id'],'type':_0x44d779['name'],'sectionId':_0x44d779['id']},{})[_0xced3('0x21')](function(){return _0x8df206;});}else{return _0x8df206;}})[_0xced3('0x41')](function(_0xc93e05){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc93e05);throw _0xc93e05;});}return _0x8df206;})[_0xced3('0x21')](respondWithResult(_0x3700ed,0xc9))[_0xced3('0x41')](handleError(_0x3700ed,null));};exports['update']=function(_0x3f41cc,_0x4ae67d){if(_0x3f41cc[_0xced3('0x4c')]['id']){delete _0x3f41cc[_0xced3('0x4c')]['id'];}return db['VoiceMail'][_0xced3('0x44')]({'where':{'id':_0x3f41cc[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x4ae67d,null))['then'](saveUpdates(_0x3f41cc[_0xced3('0x4c')],null))['then'](respondWithResult(_0x4ae67d,null))[_0xced3('0x41')](handleError(_0x4ae67d,null));};exports[_0xced3('0x22')]=function(_0x4694b8,_0x168c36){return db[_0xced3('0x2b')][_0xced3('0x44')]({'where':{'id':_0x4694b8[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x168c36,null))[_0xced3('0x21')](removeEntity(_0x168c36,null))[_0xced3('0x41')](handleError(_0x168c36,null));};exports[_0xced3('0x4d')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){return db[_0xced3('0x2b')][_0xced3('0x4e')]({'where':{'id':_0x4b14dd[_0xced3('0x43')]['id']}})[_0xced3('0x21')](handleEntityNotFound(_0x3859e8,null))['then'](function(_0x9db425){var _0x171081;var _0x21ea6a={},_0x440a0f={};_0x440a0f[_0xced3('0x30')]=_[_0xced3('0x32')](db['VoiceMailMessage'][_0xced3('0x2c')]);_0x440a0f['query']=_[_0xced3('0x32')](_0x4b14dd['query']);_0x440a0f[_0xced3('0x33')]=_[_0xced3('0x34')](_0x440a0f['model'],_0x440a0f[_0xced3('0x31')]);_0x21ea6a[_0xced3('0x35')]=_[_0xced3('0x34')](_0x440a0f[_0xced3('0x30')],qs[_0xced3('0x36')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x36')]));_0x21ea6a[_0xced3('0x35')]=_0x21ea6a[_0xced3('0x35')][_0xced3('0x37')]?_0x21ea6a[_0xced3('0x35')]:_0x440a0f[_0xced3('0x30')];if(!_0x4b14dd[_0xced3('0x31')]['hasOwnProperty'](_0xced3('0x39'))){_0x21ea6a[_0xced3('0x1a')]=qs[_0xced3('0x1a')](_0x4b14dd[_0xced3('0x31')]['limit']);_0x21ea6a[_0xced3('0x1c')]=qs[_0xced3('0x1c')](_0x4b14dd[_0xced3('0x31')][_0xced3('0x1c')]);}_0x21ea6a[_0xced3('0x4f')]=qs[_0xced3('0x50')](_0x4b14dd[_0xced3('0x31')]['sort']);_0x21ea6a[_0xced3('0x3a')]=qs[_0xced3('0x33')](_['pick'](_0x4b14dd[_0xced3('0x31')],_0x440a0f[_0xced3('0x33')]));if(_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]){_0x21ea6a['where']=_[_0xced3('0x3c')](_0x21ea6a[_0xced3('0x3a')],{'$or':_[_0xced3('0x2a')](_0x21ea6a[_0xced3('0x35')],function(_0x3992d2){var _0x385d45={};_0x385d45[_0x3992d2]={'$like':'%'+_0x4b14dd[_0xced3('0x31')][_0xced3('0x3b')]+'%'};return _0x385d45;})});}_0x21ea6a[_0xced3('0x3a')]=_[_0xced3('0x3c')](_0x21ea6a['where'],{'mailboxuser':_0x9db425[_0xced3('0x51')]});_0x21ea6a=_[_0xced3('0x3c')]({},_0x21ea6a,_0x4b14dd['options']);return db['VoiceMailMessage'][_0xced3('0x52')](_0x21ea6a)['then'](respondWithFilteredResult(_0x3859e8,_0x21ea6a));})[_0xced3('0x41')](handleError(_0x3859e8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index dfb370b..801bdd9 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 _0xcf86=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger'];(function(_0x58fbb0,_0xe497b5){var _0x1783d2=function(_0x5554a8){while(--_0x5554a8){_0x58fbb0['push'](_0x58fbb0['shift']());}};_0x1783d2(++_0xe497b5);}(_0xcf86,0x7e));var _0x6cf8=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcf86[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x6cf8('0x0'));var util=require('util');var logger=require(_0x6cf8('0x1'))(_0x6cf8('0x2'));var moment=require(_0x6cf8('0x3'));var BPromise=require(_0x6cf8('0x4'));var rp=require(_0x6cf8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf8('0x6'));var config=require(_0x6cf8('0x7'));var attributes=require(_0x6cf8('0x8'));module[_0x6cf8('0x9')]=function(_0x11b737,_0xa3540e){return _0x11b737[_0x6cf8('0xa')](_0x6cf8('0xb'),attributes,{'tableName':_0x6cf8('0xc'),'paranoid':![],'indexes':[{'name':_0x6cf8('0xd'),'fields':[_0x6cf8('0xe'),_0x6cf8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7657=['request-promise','path','../../config/environment','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x575e18,_0x25a520){var _0x5626c0=function(_0x3bd81e){while(--_0x3bd81e){_0x575e18['push'](_0x575e18['shift']());}};_0x5626c0(++_0x25a520);}(_0x7657,0x108));var _0x7765=function(_0x453acf,_0x3c10c6){_0x453acf=_0x453acf-0x0;var _0x49c3c1=_0x7657[_0x453acf];return _0x49c3c1;};'use strict';var _=require(_0x7765('0x0'));var util=require(_0x7765('0x1'));var logger=require(_0x7765('0x2'))(_0x7765('0x3'));var moment=require(_0x7765('0x4'));var BPromise=require(_0x7765('0x5'));var rp=require(_0x7765('0x6'));var fs=require('fs');var path=require(_0x7765('0x7'));var rimraf=require('rimraf');var config=require(_0x7765('0x8'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x46c500,_0x8b18){return _0x46c500[_0x7765('0x9')](_0x7765('0xa'),attributes,{'tableName':_0x7765('0xb'),'paranoid':![],'indexes':[{'name':_0x7765('0xc'),'fields':[_0x7765('0xd'),_0x7765('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index c4a1e8a..4c68724 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 _0x078a=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58ab93,_0x49027d){var _0x273a3d=function(_0x4c8e9b){while(--_0x4c8e9b){_0x58ab93['push'](_0x58ab93['shift']());}};_0x273a3d(++_0x49027d);}(_0x078a,0x7d));var _0xa078=function(_0x550eb1,_0x3aabbd){_0x550eb1=_0x550eb1-0x0;var _0xf971de=_0x078a[_0x550eb1];return _0xf971de;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa078('0x0'));var BPromise=require(_0xa078('0x1'));var rs=require(_0xa078('0x2'));var fs=require('fs');var Redis=require(_0xa078('0x3'));var db=require(_0xa078('0x4'))['db'];var utils=require(_0xa078('0x5'));var logger=require(_0xa078('0x6'))(_0xa078('0x7'));var config=require(_0xa078('0x8'));var jayson=require(_0xa078('0x9'));var client=jayson['client'][_0xa078('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3abe2e,_0x4c7b06,_0x4074a9){return new BPromise(function(_0x1710d8,_0x1101e7){return client[_0xa078('0xb')](_0x3abe2e,_0x4074a9)[_0xa078('0xc')](function(_0x3f8071){logger[_0xa078('0xd')](_0xa078('0xe'),_0x4c7b06,_0xa078('0xf'));logger[_0xa078('0x10')](_0xa078('0x11'),_0x4c7b06,'request\x20sent',JSON[_0xa078('0x12')](_0x3f8071));if(_0x3f8071[_0xa078('0x13')]){if(_0x3f8071[_0xa078('0x13')]['code']===0x1f4){logger[_0xa078('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4c7b06,_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);return _0x1101e7(_0x3f8071[_0xa078('0x13')]['message']);}logger[_0xa078('0x13')](_0xa078('0xe'),_0x4c7b06,_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);return _0x1710d8(_0x3f8071[_0xa078('0x13')][_0xa078('0x14')]);}else{logger[_0xa078('0xd')](_0xa078('0xe'),_0x4c7b06,_0xa078('0xf'));_0x1710d8(_0x3f8071[_0xa078('0x15')][_0xa078('0x14')]);}})['catch'](function(_0x34bf7a){logger[_0xa078('0x13')]('VoiceMail,\x20%s,\x20%s',_0x4c7b06,_0x34bf7a);_0x1101e7(_0x34bf7a);});});} \ No newline at end of file +var _0x50ac=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x231a53,_0x328649){var _0x587a55=function(_0x3331b2){while(--_0x3331b2){_0x231a53['push'](_0x231a53['shift']());}};_0x587a55(++_0x328649);}(_0x50ac,0x170));var _0xc50a=function(_0x1c42f1,_0x18e091){_0x1c42f1=_0x1c42f1-0x0;var _0x4f151d=_0x50ac[_0x1c42f1];return _0x4f151d;};'use strict';var _=require('lodash');var util=require(_0xc50a('0x0'));var moment=require(_0xc50a('0x1'));var BPromise=require(_0xc50a('0x2'));var rs=require(_0xc50a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc50a('0x4'))['db'];var utils=require(_0xc50a('0x5'));var logger=require(_0xc50a('0x6'))(_0xc50a('0x7'));var config=require(_0xc50a('0x8'));var jayson=require(_0xc50a('0x9'));var client=jayson[_0xc50a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cd42,_0x48dbab,_0xdb9560){return new BPromise(function(_0x5c0c83,_0x22e48f){return client[_0xc50a('0xb')](_0x27cd42,_0xdb9560)[_0xc50a('0xc')](function(_0x4470b1){logger['info'](_0xc50a('0xd'),_0x48dbab,'request\x20sent');logger[_0xc50a('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x48dbab,_0xc50a('0xf'),JSON[_0xc50a('0x10')](_0x4470b1));if(_0x4470b1[_0xc50a('0x11')]){if(_0x4470b1[_0xc50a('0x11')][_0xc50a('0x12')]===0x1f4){logger[_0xc50a('0x11')](_0xc50a('0xd'),_0x48dbab,_0x4470b1[_0xc50a('0x11')][_0xc50a('0x13')]);return _0x22e48f(_0x4470b1[_0xc50a('0x11')][_0xc50a('0x13')]);}logger['error'](_0xc50a('0xd'),_0x48dbab,_0x4470b1[_0xc50a('0x11')][_0xc50a('0x13')]);return _0x5c0c83(_0x4470b1[_0xc50a('0x11')][_0xc50a('0x13')]);}else{logger[_0xc50a('0x14')](_0xc50a('0xd'),_0x48dbab,'request\x20sent');_0x5c0c83(_0x4470b1['result']['message']);}})[_0xc50a('0x15')](function(_0x33fc05){logger['error'](_0xc50a('0xd'),_0x48dbab,_0x33fc05);_0x22e48f(_0x33fc05);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 287c0b7..a4dc9c1 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 _0x25bd=['post','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x10b581,_0x1365d9){var _0x460038=function(_0x4f2023){while(--_0x4f2023){_0x10b581['push'](_0x10b581['shift']());}};_0x460038(++_0x1365d9);}(_0x25bd,0x134));var _0xd25b=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x25bd[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xd25b('0x0'));var util=require(_0xd25b('0x1'));var path=require(_0xd25b('0x2'));var timeout=require(_0xd25b('0x3'));var express=require('express');var router=express[_0xd25b('0x4')]();var fs_extra=require(_0xd25b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd25b('0x6'));var config=require('../../config/environment');var controller=require(_0xd25b('0x7'));router[_0xd25b('0x8')]('/',auth[_0xd25b('0x9')](),controller[_0xd25b('0xa')]);router[_0xd25b('0x8')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller[_0xd25b('0xc')]);router['get'](_0xd25b('0xd'),auth[_0xd25b('0x9')](),controller[_0xd25b('0xe')]);router[_0xd25b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd25b('0x10')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller['update']);router[_0xd25b('0x11')](_0xd25b('0xb'),auth[_0xd25b('0x9')](),controller['destroy']);module[_0xd25b('0x12')]=router; \ No newline at end of file +var _0xe9f4=['download','post','put','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x5b1d80,_0x4230ba){var _0x4f344c=function(_0x50d40b){while(--_0x50d40b){_0x5b1d80['push'](_0x5b1d80['shift']());}};_0x4f344c(++_0x4230ba);}(_0xe9f4,0x1e1));var _0x4e9f=function(_0xc532f1,_0x2b11aa){_0xc532f1=_0xc532f1-0x0;var _0x2f7edc=_0xe9f4[_0xc532f1];return _0x2f7edc;};'use strict';var multer=require(_0x4e9f('0x0'));var util=require(_0x4e9f('0x1'));var path=require(_0x4e9f('0x2'));var timeout=require(_0x4e9f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4e9f('0x4'));var interaction=require(_0x4e9f('0x5'));var config=require('../../config/environment');var controller=require(_0x4e9f('0x6'));router[_0x4e9f('0x7')]('/',auth[_0x4e9f('0x8')](),controller['index']);router[_0x4e9f('0x7')](_0x4e9f('0x9'),auth[_0x4e9f('0x8')](),controller[_0x4e9f('0xa')]);router[_0x4e9f('0x7')](_0x4e9f('0xb'),auth[_0x4e9f('0x8')](),controller[_0x4e9f('0xc')]);router[_0x4e9f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e9f('0xe')](_0x4e9f('0x9'),auth[_0x4e9f('0x8')](),controller['update']);router[_0x4e9f('0xf')](_0x4e9f('0x9'),auth[_0x4e9f('0x8')](),controller['destroy']);module[_0x4e9f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 357a8b9..7deba7e 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 _0xf38f=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0xf38f,0x1e3));var _0xff38=function(_0x295df8,_0x1f9924){_0x295df8=_0x295df8-0x0;var _0x1c4b61=_0xf38f[_0x295df8];return _0x1c4b61;};'use strict';var Sequelize=require('sequelize');module[_0xff38('0x0')]={'name':{'type':Sequelize[_0xff38('0x1')],'get':function(_0x1a0de2){return this[_0xff38('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xff38('0x4')](_0xff38('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xff38('0x3')],'defaultValue':''},'stamp':{'type':_0xff38('0x6'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x5b5d=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x1c2262,_0x2011ce){var _0x288795=function(_0x3bc3a3){while(--_0x3bc3a3){_0x1c2262['push'](_0x1c2262['shift']());}};_0x288795(++_0x2011ce);}(_0x5b5d,0x100));var _0xd5b5=function(_0x9a6574,_0x10bb70){_0x9a6574=_0x9a6574-0x0;var _0x4ec2bb=_0x5b5d[_0x9a6574];return _0x4ec2bb;};'use strict';var Sequelize=require(_0xd5b5('0x0'));module[_0xd5b5('0x1')]={'name':{'type':Sequelize[_0xd5b5('0x2')],'get':function(_0x4499e5){return this[_0xd5b5('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xd5b5('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xd5b5('0x6')](_0xd5b5('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xd5b5('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd5b5('0x8'),'defaultValue':Sequelize[_0xd5b5('0x9')](_0xd5b5('0xa'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5b056e1..c00d6b7 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 _0xd00a=['send','index','VoiceMailMessage','fieldName','type','key','model','differenceBy','map','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','findAll','catch','show','params','rawAttributes','find','create','body','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','name'];(function(_0x3785e4,_0x21136f){var _0x4a211f=function(_0x36a28e){while(--_0x36a28e){_0x3785e4['push'](_0x3785e4['shift']());}};_0x4a211f(++_0x21136f);}(_0xd00a,0x16c));var _0xad00=function(_0x3ef2b3,_0x1ca524){_0x3ef2b3=_0x3ef2b3-0x0;var _0xe7016d=_0xd00a[_0x3ef2b3];return _0xe7016d;};'use strict';var emlformat=require(_0xad00('0x0'));var rimraf=require(_0xad00('0x1'));var zipdir=require(_0xad00('0x2'));var jsonpatch=require(_0xad00('0x3'));var rp=require(_0xad00('0x4'));var moment=require('moment');var BPromise=require(_0xad00('0x5'));var Mustache=require(_0xad00('0x6'));var util=require(_0xad00('0x7'));var path=require(_0xad00('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad00('0x9'));var fs=require('fs');var fs_extra=require(_0xad00('0xa'));var _=require(_0xad00('0xb'));var squel=require(_0xad00('0xc'));var crypto=require(_0xad00('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xad00('0xe'));var toCsv=require(_0xad00('0xf'));var querystring=require('querystring');var Papa=require(_0xad00('0x10'));var Redis=require(_0xad00('0x11'));var authService=require(_0xad00('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad00('0x13'));var hardwareService=require(_0xad00('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xad00('0x15'));var config=require(_0xad00('0x16'));var licenseUtil=require(_0xad00('0x17'));var db=require(_0xad00('0x18'))['db'];function respondWithStatusCode(_0x3f79f1,_0x4068f3){_0x4068f3=_0x4068f3||0xcc;return function(_0x371f2d){if(_0x371f2d){return _0x3f79f1[_0xad00('0x19')](_0x4068f3);}return _0x3f79f1[_0xad00('0x1a')](_0x4068f3)[_0xad00('0x1b')]();};}function respondWithResult(_0x1412d0,_0x202b80){_0x202b80=_0x202b80||0xc8;return function(_0x72f4a7){if(_0x72f4a7){return _0x1412d0[_0xad00('0x1a')](_0x202b80)[_0xad00('0x1c')](_0x72f4a7);}};}function respondWithFilteredResult(_0x3c6705,_0x4fdc2d){return function(_0xaf8d70){if(_0xaf8d70){var _0x1e469d=typeof _0x4fdc2d['offset']===_0xad00('0x1d')&&typeof _0x4fdc2d[_0xad00('0x1e')]===_0xad00('0x1d');var _0x2169d2=_0xaf8d70['count'];var _0x447e16=_0x1e469d?0x0:_0x4fdc2d[_0xad00('0x1f')];var _0x26b319=_0x1e469d?_0xaf8d70[_0xad00('0x20')]:_0x4fdc2d[_0xad00('0x1f')]+_0x4fdc2d['limit'];var _0x35f87e;if(_0x26b319>=_0x2169d2){_0x26b319=_0x2169d2;_0x35f87e=0xc8;}else{_0x35f87e=0xce;}_0x3c6705[_0xad00('0x1a')](_0x35f87e);return _0x3c6705[_0xad00('0x21')](_0xad00('0x22'),_0x447e16+'-'+_0x26b319+'/'+_0x2169d2)['json'](_0xaf8d70);}return null;};}function patchUpdates(_0x40ab09){return function(_0x2ebb55){try{jsonpatch[_0xad00('0x23')](_0x2ebb55,_0x40ab09,!![]);}catch(_0x4605a6){return BPromise[_0xad00('0x24')](_0x4605a6);}return _0x2ebb55[_0xad00('0x25')]();};}function saveUpdates(_0x2748a6,_0x5d7f5b){return function(_0x399d7c){if(_0x399d7c){return _0x399d7c['update'](_0x2748a6)['then'](function(_0x3f7f03){return _0x3f7f03;});}return null;};}function removeEntity(_0x695612,_0x25c3b3){return function(_0x13dd98){if(_0x13dd98){return _0x13dd98[_0xad00('0x26')]()[_0xad00('0x27')](function(){_0x695612[_0xad00('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f132f,_0x5f1cf8){return function(_0x329a2e){if(!_0x329a2e){_0x3f132f['sendStatus'](0x194);}return _0x329a2e;};}function handleError(_0x535757,_0x330b88){_0x330b88=_0x330b88||0x1f4;return function(_0x2c3b48){logger['error'](_0x2c3b48['stack']);if(_0x2c3b48['name']){delete _0x2c3b48[_0xad00('0x28')];}_0x535757['status'](_0x330b88)[_0xad00('0x29')](_0x2c3b48);};}exports[_0xad00('0x2a')]=function(_0x1c3576,_0xc93254){var _0x249ffa={},_0x230974={},_0x468d91={'count':0x0,'rows':[]};var _0x51d30d=_['map'](db[_0xad00('0x2b')]['rawAttributes'],function(_0x170c78){return{'name':_0x170c78[_0xad00('0x2c')],'type':_0x170c78[_0xad00('0x2d')][_0xad00('0x2e')]};});_0x230974[_0xad00('0x2f')]=_[_0xad00('0x30')](_[_0xad00('0x31')](_0x51d30d,_0xad00('0x28')),[_0xad00('0x28')]);_0x230974['query']=_[_0xad00('0x32')](_0x1c3576[_0xad00('0x33')]);_0x230974['filters']=_[_0xad00('0x34')](_0x230974['model'],_0x230974[_0xad00('0x33')]);_0x249ffa[_0xad00('0x35')]=_[_0xad00('0x34')](_0x230974[_0xad00('0x2f')],qs[_0xad00('0x36')](_0x1c3576[_0xad00('0x33')]['fields']));_0x249ffa[_0xad00('0x35')]=_0x249ffa['attributes']['length']?_0x249ffa['attributes']:_0x230974[_0xad00('0x2f')];if(!_0x1c3576[_0xad00('0x33')]['hasOwnProperty'](_0xad00('0x37'))){_0x249ffa['limit']=qs[_0xad00('0x1e')](_0x1c3576[_0xad00('0x33')][_0xad00('0x1e')]);_0x249ffa[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x1c3576[_0xad00('0x33')][_0xad00('0x1f')]);}_0x249ffa[_0xad00('0x38')]=qs[_0xad00('0x39')](_0x1c3576[_0xad00('0x33')][_0xad00('0x39')]);_0x249ffa['where']=qs[_0xad00('0x3a')](_[_0xad00('0x3b')](_0x1c3576['query'],_0x230974[_0xad00('0x3a')]),_0x51d30d);if(_0x1c3576[_0xad00('0x33')][_0xad00('0x3c')]){_0x249ffa[_0xad00('0x3d')]=_[_0xad00('0x3e')](_0x249ffa[_0xad00('0x3d')],{'$or':_[_0xad00('0x31')](_0x51d30d,function(_0x12c8be){if(_0x12c8be[_0xad00('0x2d')]!=='VIRTUAL'){var _0xb72afa={};_0xb72afa[_0x12c8be[_0xad00('0x28')]]={'$like':'%'+_0x1c3576[_0xad00('0x33')][_0xad00('0x3c')]+'%'};return _0xb72afa;}})});}_0x249ffa=_[_0xad00('0x3e')]({},_0x249ffa,_0x1c3576['options']);var _0x35cd74={'where':_0x249ffa[_0xad00('0x3d')]};return db['VoiceMailMessage'][_0xad00('0x20')](_0x35cd74)[_0xad00('0x27')](function(_0x2b1cd5){_0x468d91[_0xad00('0x20')]=_0x2b1cd5;if(_0x1c3576[_0xad00('0x33')][_0xad00('0x3f')]){_0x249ffa['include']=[{'all':!![]}];}return db[_0xad00('0x2b')][_0xad00('0x40')](_0x249ffa);})['then'](function(_0x358aaa){_0x468d91['rows']=_0x358aaa;return _0x468d91;})[_0xad00('0x27')](respondWithFilteredResult(_0xc93254,_0x249ffa))[_0xad00('0x41')](handleError(_0xc93254,null));};exports[_0xad00('0x42')]=function(_0x54a566,_0x2af109){var _0xb8242b={'raw':!![],'where':{'id':_0x54a566[_0xad00('0x43')]['id']}},_0x2c1c6b={};_0x2c1c6b[_0xad00('0x2f')]=_[_0xad00('0x32')](db['VoiceMailMessage'][_0xad00('0x44')]);_0x2c1c6b[_0xad00('0x33')]=_[_0xad00('0x32')](_0x54a566[_0xad00('0x33')]);_0x2c1c6b[_0xad00('0x3a')]=_[_0xad00('0x34')](_0x2c1c6b['model'],_0x2c1c6b[_0xad00('0x33')]);_0xb8242b[_0xad00('0x35')]=_[_0xad00('0x34')](_0x2c1c6b[_0xad00('0x2f')],qs['fields'](_0x54a566[_0xad00('0x33')][_0xad00('0x36')]));_0xb8242b[_0xad00('0x35')]=_0xb8242b[_0xad00('0x35')]['length']?_0xb8242b[_0xad00('0x35')]:_0x2c1c6b[_0xad00('0x2f')];if(_0x54a566[_0xad00('0x33')][_0xad00('0x3f')]){_0xb8242b['include']=[{'all':!![]}];}_0xb8242b=_['merge']({},_0xb8242b,_0x54a566['options']);return db[_0xad00('0x2b')][_0xad00('0x45')](_0xb8242b)[_0xad00('0x27')](handleEntityNotFound(_0x2af109,null))[_0xad00('0x27')](respondWithResult(_0x2af109,null))[_0xad00('0x41')](handleError(_0x2af109,null));};exports[_0xad00('0x46')]=function(_0x24660c,_0x1a235d){return db[_0xad00('0x2b')][_0xad00('0x46')](_0x24660c[_0xad00('0x47')],{})[_0xad00('0x27')](respondWithResult(_0x1a235d,0xc9))[_0xad00('0x41')](handleError(_0x1a235d,null));};exports['update']=function(_0x43757b,_0x4fd80c){if(_0x43757b[_0xad00('0x47')]['id']){delete _0x43757b['body']['id'];}return db[_0xad00('0x2b')][_0xad00('0x45')]({'where':{'id':_0x43757b[_0xad00('0x43')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x4fd80c,null))[_0xad00('0x27')](saveUpdates(_0x43757b[_0xad00('0x47')],null))[_0xad00('0x27')](respondWithResult(_0x4fd80c,null))[_0xad00('0x41')](handleError(_0x4fd80c,null));};exports[_0xad00('0x26')]=function(_0x315333,_0x3df85b){return db[_0xad00('0x2b')]['find']({'where':{'id':_0x315333[_0xad00('0x43')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x3df85b,null))[_0xad00('0x27')](removeEntity(_0x3df85b,null))[_0xad00('0x41')](handleError(_0x3df85b,null));};exports[_0xad00('0x48')]=function(_0x2b66d2,_0x5937b8,_0x529447){return db['VoiceMailMessage']['find']({'where':{'id':_0x2b66d2['params']['id']},'attributes':['id','recording',_0xad00('0x49')]})[_0xad00('0x27')](handleEntityNotFound(_0x5937b8,null))[_0xad00('0x27')](function(_0x27dd55){if(_0x27dd55){if(!_0x27dd55['recording']){throw new db['Sequelize'][(_0xad00('0x4a'))](_0xad00('0x4b'));}var _0x56263c={'Content-Type':_0xad00('0x4c'),'Content-Disposition':_0xad00('0x4d')};if(_0x27dd55[_0xad00('0x49')]){_0x56263c[_0xad00('0x4e')]=_0xad00('0x4f')+_0x27dd55[_0xad00('0x49')]+'.wav\x22';}_0x5937b8[_0xad00('0x21')](_0x56263c);return _0x5937b8[_0xad00('0x29')](new Buffer(_0x27dd55[_0xad00('0x50')]));}})[_0xad00('0x41')](handleError(_0x5937b8,null));}; \ No newline at end of file +var _0xa75d=['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','end','json','offset','limit','count','apply','update','then','stack','name','index','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceMailMessage','findAll','catch','show','params','rawAttributes','length','find','create','body','destroy','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','msg_id','.wav\x22','send','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x54c889,_0x5a11e7){var _0x5c733c=function(_0x1dced5){while(--_0x1dced5){_0x54c889['push'](_0x54c889['shift']());}};_0x5c733c(++_0x5a11e7);}(_0xa75d,0xe8));var _0xda75=function(_0x34b734,_0xe0fba2){_0x34b734=_0x34b734-0x0;var _0x464f44=_0xa75d[_0x34b734];return _0x464f44;};'use strict';var emlformat=require(_0xda75('0x0'));var rimraf=require(_0xda75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xda75('0x2'));var moment=require(_0xda75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xda75('0x4'));var util=require(_0xda75('0x5'));var path=require(_0xda75('0x6'));var sox=require(_0xda75('0x7'));var csv=require(_0xda75('0x8'));var ejs=require(_0xda75('0x9'));var fs=require('fs');var fs_extra=require(_0xda75('0xa'));var _=require(_0xda75('0xb'));var squel=require(_0xda75('0xc'));var crypto=require(_0xda75('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda75('0xe'));var toCsv=require('to-csv');var querystring=require(_0xda75('0xf'));var Papa=require(_0xda75('0x10'));var Redis=require('ioredis');var authService=require(_0xda75('0x11'));var qs=require(_0xda75('0x12'));var as=require(_0xda75('0x13'));var hardwareService=require(_0xda75('0x14'));var logger=require('../../config/logger')(_0xda75('0x15'));var utils=require(_0xda75('0x16'));var config=require(_0xda75('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xda75('0x18'))['db'];function respondWithStatusCode(_0x368c1d,_0x5d0d8d){_0x5d0d8d=_0x5d0d8d||0xcc;return function(_0x5e23c4){if(_0x5e23c4){return _0x368c1d[_0xda75('0x19')](_0x5d0d8d);}return _0x368c1d[_0xda75('0x1a')](_0x5d0d8d)[_0xda75('0x1b')]();};}function respondWithResult(_0x3b5065,_0x3eaff0){_0x3eaff0=_0x3eaff0||0xc8;return function(_0xf3f207){if(_0xf3f207){return _0x3b5065['status'](_0x3eaff0)[_0xda75('0x1c')](_0xf3f207);}};}function respondWithFilteredResult(_0xff0275,_0x5cd713){return function(_0x28c262){if(_0x28c262){var _0x34772d=typeof _0x5cd713[_0xda75('0x1d')]==='undefined'&&typeof _0x5cd713[_0xda75('0x1e')]==='undefined';var _0xcd91d9=_0x28c262[_0xda75('0x1f')];var _0x126721=_0x34772d?0x0:_0x5cd713[_0xda75('0x1d')];var _0x19b101=_0x34772d?_0x28c262[_0xda75('0x1f')]:_0x5cd713['offset']+_0x5cd713[_0xda75('0x1e')];var _0x206c06;if(_0x19b101>=_0xcd91d9){_0x19b101=_0xcd91d9;_0x206c06=0xc8;}else{_0x206c06=0xce;}_0xff0275[_0xda75('0x1a')](_0x206c06);return _0xff0275['set']('Content-Range',_0x126721+'-'+_0x19b101+'/'+_0xcd91d9)[_0xda75('0x1c')](_0x28c262);}return null;};}function patchUpdates(_0x2f544f){return function(_0x45ddff){try{jsonpatch[_0xda75('0x20')](_0x45ddff,_0x2f544f,!![]);}catch(_0x3d9df5){return BPromise['reject'](_0x3d9df5);}return _0x45ddff['save']();};}function saveUpdates(_0x3ab0db,_0x2eb34e){return function(_0x1032d9){if(_0x1032d9){return _0x1032d9[_0xda75('0x21')](_0x3ab0db)[_0xda75('0x22')](function(_0x18d843){return _0x18d843;});}return null;};}function removeEntity(_0x1c1a3c,_0x3befbe){return function(_0x47c692){if(_0x47c692){return _0x47c692['destroy']()['then'](function(){_0x1c1a3c[_0xda75('0x1a')](0xcc)[_0xda75('0x1b')]();});}};}function handleEntityNotFound(_0x113f5e,_0x41afb2){return function(_0x313472){if(!_0x313472){_0x113f5e[_0xda75('0x19')](0x194);}return _0x313472;};}function handleError(_0x3d39f4,_0x4a75d4){_0x4a75d4=_0x4a75d4||0x1f4;return function(_0x42616f){logger['error'](_0x42616f[_0xda75('0x23')]);if(_0x42616f[_0xda75('0x24')]){delete _0x42616f[_0xda75('0x24')];}_0x3d39f4[_0xda75('0x1a')](_0x4a75d4)['send'](_0x42616f);};}exports[_0xda75('0x25')]=function(_0x367205,_0x6cfac9){var _0x3a33cd={},_0x5a6243={},_0x586ed8={'count':0x0,'rows':[]};var _0x2ff04e=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x5e646f){return{'name':_0x5e646f[_0xda75('0x26')],'type':_0x5e646f[_0xda75('0x27')][_0xda75('0x28')]};});_0x5a6243[_0xda75('0x29')]=_[_0xda75('0x2a')](_[_0xda75('0x2b')](_0x2ff04e,_0xda75('0x24')),[_0xda75('0x24')]);_0x5a6243[_0xda75('0x2c')]=_[_0xda75('0x2d')](_0x367205['query']);_0x5a6243[_0xda75('0x2e')]=_[_0xda75('0x2f')](_0x5a6243[_0xda75('0x29')],_0x5a6243['query']);_0x3a33cd[_0xda75('0x30')]=_[_0xda75('0x2f')](_0x5a6243['model'],qs[_0xda75('0x31')](_0x367205[_0xda75('0x2c')][_0xda75('0x31')]));_0x3a33cd[_0xda75('0x30')]=_0x3a33cd['attributes']['length']?_0x3a33cd[_0xda75('0x30')]:_0x5a6243['model'];if(!_0x367205[_0xda75('0x2c')][_0xda75('0x32')](_0xda75('0x33'))){_0x3a33cd['limit']=qs[_0xda75('0x1e')](_0x367205[_0xda75('0x2c')][_0xda75('0x1e')]);_0x3a33cd[_0xda75('0x1d')]=qs[_0xda75('0x1d')](_0x367205[_0xda75('0x2c')][_0xda75('0x1d')]);}_0x3a33cd[_0xda75('0x34')]=qs[_0xda75('0x35')](_0x367205['query'][_0xda75('0x35')]);_0x3a33cd[_0xda75('0x36')]=qs['filters'](_['pick'](_0x367205['query'],_0x5a6243[_0xda75('0x2e')]),_0x2ff04e);if(_0x367205[_0xda75('0x2c')][_0xda75('0x37')]){_0x3a33cd[_0xda75('0x36')]=_[_0xda75('0x38')](_0x3a33cd[_0xda75('0x36')],{'$or':_[_0xda75('0x2b')](_0x2ff04e,function(_0x475921){if(_0x475921[_0xda75('0x27')]!==_0xda75('0x39')){var _0x491ebf={};_0x491ebf[_0x475921[_0xda75('0x24')]]={'$like':'%'+_0x367205[_0xda75('0x2c')]['filter']+'%'};return _0x491ebf;}})});}_0x3a33cd=_[_0xda75('0x38')]({},_0x3a33cd,_0x367205[_0xda75('0x3a')]);var _0x50bc57={'where':_0x3a33cd[_0xda75('0x36')]};return db['VoiceMailMessage'][_0xda75('0x1f')](_0x50bc57)[_0xda75('0x22')](function(_0x5e9324){_0x586ed8[_0xda75('0x1f')]=_0x5e9324;if(_0x367205[_0xda75('0x2c')][_0xda75('0x3b')]){_0x3a33cd[_0xda75('0x3c')]=[{'all':!![]}];}return db[_0xda75('0x3d')][_0xda75('0x3e')](_0x3a33cd);})['then'](function(_0x22f46f){_0x586ed8['rows']=_0x22f46f;return _0x586ed8;})[_0xda75('0x22')](respondWithFilteredResult(_0x6cfac9,_0x3a33cd))[_0xda75('0x3f')](handleError(_0x6cfac9,null));};exports[_0xda75('0x40')]=function(_0xd229ff,_0x1b7df9){var _0xc0fb7c={'raw':!![],'where':{'id':_0xd229ff[_0xda75('0x41')]['id']}},_0x558dc1={};_0x558dc1[_0xda75('0x29')]=_['keys'](db[_0xda75('0x3d')][_0xda75('0x42')]);_0x558dc1[_0xda75('0x2c')]=_[_0xda75('0x2d')](_0xd229ff[_0xda75('0x2c')]);_0x558dc1[_0xda75('0x2e')]=_['intersection'](_0x558dc1['model'],_0x558dc1[_0xda75('0x2c')]);_0xc0fb7c[_0xda75('0x30')]=_['intersection'](_0x558dc1['model'],qs[_0xda75('0x31')](_0xd229ff[_0xda75('0x2c')]['fields']));_0xc0fb7c[_0xda75('0x30')]=_0xc0fb7c['attributes'][_0xda75('0x43')]?_0xc0fb7c[_0xda75('0x30')]:_0x558dc1['model'];if(_0xd229ff['query'][_0xda75('0x3b')]){_0xc0fb7c[_0xda75('0x3c')]=[{'all':!![]}];}_0xc0fb7c=_[_0xda75('0x38')]({},_0xc0fb7c,_0xd229ff[_0xda75('0x3a')]);return db[_0xda75('0x3d')][_0xda75('0x44')](_0xc0fb7c)['then'](handleEntityNotFound(_0x1b7df9,null))[_0xda75('0x22')](respondWithResult(_0x1b7df9,null))[_0xda75('0x3f')](handleError(_0x1b7df9,null));};exports[_0xda75('0x45')]=function(_0x474b9b,_0x239e99){return db[_0xda75('0x3d')][_0xda75('0x45')](_0x474b9b[_0xda75('0x46')],{})[_0xda75('0x22')](respondWithResult(_0x239e99,0xc9))['catch'](handleError(_0x239e99,null));};exports[_0xda75('0x21')]=function(_0x572b0b,_0x4c79b1){if(_0x572b0b['body']['id']){delete _0x572b0b['body']['id'];}return db[_0xda75('0x3d')][_0xda75('0x44')]({'where':{'id':_0x572b0b['params']['id']}})[_0xda75('0x22')](handleEntityNotFound(_0x4c79b1,null))['then'](saveUpdates(_0x572b0b['body'],null))[_0xda75('0x22')](respondWithResult(_0x4c79b1,null))['catch'](handleError(_0x4c79b1,null));};exports[_0xda75('0x47')]=function(_0x3e9412,_0x52c05b){return db[_0xda75('0x3d')][_0xda75('0x44')]({'where':{'id':_0x3e9412[_0xda75('0x41')]['id']}})[_0xda75('0x22')](handleEntityNotFound(_0x52c05b,null))[_0xda75('0x22')](removeEntity(_0x52c05b,null))[_0xda75('0x3f')](handleError(_0x52c05b,null));};exports['download']=function(_0x3b1e98,_0x1d9a2c,_0xf6fea4){return db[_0xda75('0x3d')]['find']({'where':{'id':_0x3b1e98[_0xda75('0x41')]['id']},'attributes':['id','recording','msg_id']})[_0xda75('0x22')](handleEntityNotFound(_0x1d9a2c,null))[_0xda75('0x22')](function(_0x5bc092){if(_0x5bc092){if(!_0x5bc092[_0xda75('0x48')]){throw new db[(_0xda75('0x49'))]['ValidationError'](_0xda75('0x4a'));}var _0x2bc277={'Content-Type':_0xda75('0x4b'),'Content-Disposition':'attachment'};if(_0x5bc092['msg_id']){_0x2bc277[_0xda75('0x4c')]=_0xda75('0x4d')+_0x5bc092[_0xda75('0x4e')]+_0xda75('0x4f');}_0x1d9a2c['set'](_0x2bc277);return _0x1d9a2c[_0xda75('0x50')](new Buffer(_0x5bc092[_0xda75('0x48')]));}})[_0xda75('0x3f')](handleError(_0x1d9a2c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f92cfdd..bb427c7 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 _0xf90f=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xf90f,0x1ef));var _0xff90=function(_0x691c1c,_0x1507b1){_0x691c1c=_0x691c1c-0x0;var _0x22eed4=_0xf90f[_0x691c1c];return _0x22eed4;};'use strict';var _=require(_0xff90('0x0'));var util=require(_0xff90('0x1'));var logger=require(_0xff90('0x2'))('api');var moment=require('moment');var BPromise=require(_0xff90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xff90('0x4'));var config=require(_0xff90('0x5'));var attributes=require(_0xff90('0x6'));module[_0xff90('0x7')]=function(_0x26691a,_0xaa2da8){return _0x26691a[_0xff90('0x8')]('VoiceMailMessage',attributes,{'tableName':_0xff90('0x9'),'paranoid':![],'indexes':[{'name':_0xff90('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xe877=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util'];(function(_0x35209f,_0xa03777){var _0x2f32be=function(_0x1bf183){while(--_0x1bf183){_0x35209f['push'](_0x35209f['shift']());}};_0x2f32be(++_0xa03777);}(_0xe877,0x16b));var _0x7e87=function(_0x5bf742,_0x340f3a){_0x5bf742=_0x5bf742-0x0;var _0x161d3a=_0xe877[_0x5bf742];return _0x161d3a;};'use strict';var _=require('lodash');var util=require(_0x7e87('0x0'));var logger=require(_0x7e87('0x1'))(_0x7e87('0x2'));var moment=require(_0x7e87('0x3'));var BPromise=require(_0x7e87('0x4'));var rp=require(_0x7e87('0x5'));var fs=require('fs');var path=require(_0x7e87('0x6'));var rimraf=require('rimraf');var config=require(_0x7e87('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0x7e87('0x8')]=function(_0x42869b,_0x5da31e){return _0x42869b[_0x7e87('0x9')](_0x7e87('0xa'),attributes,{'tableName':_0x7e87('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7e87('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 8c936ba..25adeb9 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 _0xe169=['catch','VoiceMailMessage,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result'];(function(_0x241841,_0x17ceba){var _0x2d57ea=function(_0x953ed){while(--_0x953ed){_0x241841['push'](_0x241841['shift']());}};_0x2d57ea(++_0x17ceba);}(_0xe169,0x11a));var _0x9e16=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe169[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x9e16('0x0'));var util=require(_0x9e16('0x1'));var moment=require('moment');var BPromise=require(_0x9e16('0x2'));var rs=require(_0x9e16('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e16('0x4'))['db'];var utils=require(_0x9e16('0x5'));var logger=require(_0x9e16('0x6'))(_0x9e16('0x7'));var config=require(_0x9e16('0x8'));var jayson=require(_0x9e16('0x9'));var client=jayson[_0x9e16('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5789df,_0x26c0bf,_0x11db8d){return new BPromise(function(_0x20d498,_0xe8c0df){return client[_0x9e16('0xb')](_0x5789df,_0x11db8d)['then'](function(_0x1b794b){logger[_0x9e16('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,'request\x20sent');logger['debug'](_0x9e16('0xd'),_0x26c0bf,'request\x20sent',JSON['stringify'](_0x1b794b));if(_0x1b794b[_0x9e16('0xe')]){if(_0x1b794b[_0x9e16('0xe')]['code']===0x1f4){logger[_0x9e16('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x1b794b[_0x9e16('0xe')]['message']);return _0xe8c0df(_0x1b794b[_0x9e16('0xe')][_0x9e16('0xf')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x1b794b[_0x9e16('0xe')]['message']);return _0x20d498(_0x1b794b[_0x9e16('0xe')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x26c0bf,_0x9e16('0x10'));_0x20d498(_0x1b794b[_0x9e16('0x11')]['message']);}})[_0x9e16('0x12')](function(_0x5bae62){logger[_0x9e16('0xe')](_0x9e16('0x13'),_0x26c0bf,_0x5bae62);_0xe8c0df(_0x5bae62);});});} \ No newline at end of file +var _0x5ad5=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x1073bc,_0x145656){var _0x2f27a9=function(_0x19bcae){while(--_0x19bcae){_0x1073bc['push'](_0x1073bc['shift']());}};_0x2f27a9(++_0x145656);}(_0x5ad5,0x107));var _0x55ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5ad5[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x55ad('0x0'));var util=require(_0x55ad('0x1'));var moment=require(_0x55ad('0x2'));var BPromise=require(_0x55ad('0x3'));var rs=require(_0x55ad('0x4'));var fs=require('fs');var Redis=require(_0x55ad('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x55ad('0x6'));var config=require(_0x55ad('0x7'));var jayson=require(_0x55ad('0x8'));var client=jayson[_0x55ad('0x9')][_0x55ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x183b66,_0x565eac,_0x3031fe){return new BPromise(function(_0x3f9561,_0x2bfa0d){return client[_0x55ad('0xb')](_0x183b66,_0x3031fe)['then'](function(_0x499ef6){logger[_0x55ad('0xc')](_0x55ad('0xd'),_0x565eac,_0x55ad('0xe'));logger[_0x55ad('0xf')](_0x55ad('0x10'),_0x565eac,_0x55ad('0xe'),JSON[_0x55ad('0x11')](_0x499ef6));if(_0x499ef6[_0x55ad('0x12')]){if(_0x499ef6[_0x55ad('0x12')][_0x55ad('0x13')]===0x1f4){logger['error'](_0x55ad('0xd'),_0x565eac,_0x499ef6[_0x55ad('0x12')]['message']);return _0x2bfa0d(_0x499ef6[_0x55ad('0x12')]['message']);}logger[_0x55ad('0x12')](_0x55ad('0xd'),_0x565eac,_0x499ef6[_0x55ad('0x12')][_0x55ad('0x14')]);return _0x3f9561(_0x499ef6[_0x55ad('0x12')]['message']);}else{logger[_0x55ad('0xc')](_0x55ad('0xd'),_0x565eac,_0x55ad('0xe'));_0x3f9561(_0x499ef6[_0x55ad('0x15')][_0x55ad('0x14')]);}})[_0x55ad('0x16')](function(_0x463609){logger[_0x55ad('0x12')](_0x55ad('0xd'),_0x565eac,_0x463609);_0x2bfa0d(_0x463609);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index efbfd08..9dbc8d0 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 _0xb7bf=['delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','getSounds','post','create','/:id/sounds','addSound','put','update'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xb7bf,0x131));var _0xfb7b=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xb7bf[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xfb7b('0x0'));var util=require(_0xfb7b('0x1'));var path=require(_0xfb7b('0x2'));var timeout=require(_0xfb7b('0x3'));var express=require(_0xfb7b('0x4'));var router=express[_0xfb7b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb7b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb7b('0x7'));var controller=require(_0xfb7b('0x8'));router[_0xfb7b('0x9')]('/',auth[_0xfb7b('0xa')](),controller[_0xfb7b('0xb')]);router[_0xfb7b('0x9')](_0xfb7b('0xc'),auth[_0xfb7b('0xa')](),controller['show']);router[_0xfb7b('0x9')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xfb7b('0xd')]);router[_0xfb7b('0xe')]('/',auth['isAuthenticated'](),controller[_0xfb7b('0xf')]);router[_0xfb7b('0xe')](_0xfb7b('0x10'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x11')]);router[_0xfb7b('0x12')](_0xfb7b('0xc'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x13')]);router[_0xfb7b('0x14')]('/:id',auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x15')]);router[_0xfb7b('0x14')](_0xfb7b('0x16'),auth[_0xfb7b('0xa')](),controller[_0xfb7b('0x17')]);module[_0xfb7b('0x18')]=router; \ No newline at end of file +var _0xd34a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xd34a,0xcc));var _0xad34=function(_0x57a79a,_0x54bdf9){_0x57a79a=_0x57a79a-0x0;var _0x47f63e=_0xd34a[_0x57a79a];return _0x47f63e;};'use strict';var multer=require(_0xad34('0x0'));var util=require(_0xad34('0x1'));var path=require(_0xad34('0x2'));var timeout=require(_0xad34('0x3'));var express=require(_0xad34('0x4'));var router=express[_0xad34('0x5')]();var fs_extra=require(_0xad34('0x6'));var auth=require(_0xad34('0x7'));var interaction=require(_0xad34('0x8'));var config=require(_0xad34('0x9'));var controller=require(_0xad34('0xa'));router['get']('/',auth[_0xad34('0xb')](),controller['index']);router[_0xad34('0xc')](_0xad34('0xd'),auth['isAuthenticated'](),controller[_0xad34('0xe')]);router[_0xad34('0xc')](_0xad34('0xf'),auth['isAuthenticated'](),controller[_0xad34('0x10')]);router[_0xad34('0x11')]('/',auth[_0xad34('0xb')](),controller[_0xad34('0x12')]);router[_0xad34('0x11')](_0xad34('0xf'),auth[_0xad34('0xb')](),controller[_0xad34('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xad34('0x14')]);router[_0xad34('0x15')](_0xad34('0xd'),auth[_0xad34('0xb')](),controller[_0xad34('0x16')]);router[_0xad34('0x15')](_0xad34('0x17'),auth[_0xad34('0xb')](),controller[_0xad34('0x18')]);module[_0xad34('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 855ea2c..8c279bc 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 _0xa385=['quietmp3nb','quietmp3','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xa385,0x94));var _0x5a38=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xa385[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0x5a38('0x0'));module[_0x5a38('0x1')]={'name':{'type':Sequelize[_0x5a38('0x2')],'allowNull':![],'unique':_0x5a38('0x3')},'mode':{'type':Sequelize[_0x5a38('0x4')](_0x5a38('0x5'),_0x5a38('0x6'),_0x5a38('0x7'),_0x5a38('0x8'),_0x5a38('0x9'),_0x5a38('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5a38('0xb')},'format':{'type':Sequelize[_0x5a38('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x5a38('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7126=['STRING','name','ENUM','custom','quietmp3nb','quietmp3','mp3','files','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x2d1850,_0x4f9e1a){var _0x3ce0d9=function(_0x40aaa9){while(--_0x40aaa9){_0x2d1850['push'](_0x2d1850['shift']());}};_0x3ce0d9(++_0x4f9e1a);}(_0x7126,0xa6));var _0x6712=function(_0x8e4015,_0x1d4e1d){_0x8e4015=_0x8e4015-0x0;var _0x410814=_0x7126[_0x8e4015];return _0x410814;};'use strict';var Sequelize=require(_0x6712('0x0'));module[_0x6712('0x1')]={'name':{'type':Sequelize[_0x6712('0x2')],'allowNull':![],'unique':_0x6712('0x3')},'mode':{'type':Sequelize[_0x6712('0x4')](_0x6712('0x5'),'files','mp3nb',_0x6712('0x6'),_0x6712('0x7'),_0x6712('0x8')),'allowNull':!![],'defaultValue':_0x6712('0x9')},'directory':{'type':Sequelize[_0x6712('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6712('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x6712('0x2')],'allowNull':!![]},'stamp':{'type':_0x6712('0xa')},'defaultEntry':{'type':Sequelize[_0x6712('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b55a96d..98bf54e 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 _0xd6b5=['nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','params','options','find','body','create','sequelize','transaction','mode','directory','join','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','rmdirSync','Sequelize','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','root','%s.%s','symlinkSync','removeSound','findOne','id2','unlinkSync','ValidationError','getSounds','length','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0xd6b5,0x103));var _0x5d6b=function(_0xd4b628,_0x1d653f){_0xd4b628=_0xd4b628-0x0;var _0x41b47f=_0xd6b5[_0xd4b628];return _0x41b47f;};'use strict';var emlformat=require(_0x5d6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d6b('0x1'));var jsonpatch=require(_0x5d6b('0x2'));var rp=require(_0x5d6b('0x3'));var moment=require(_0x5d6b('0x4'));var BPromise=require(_0x5d6b('0x5'));var Mustache=require(_0x5d6b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5d6b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5d6b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d6b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5d6b('0x7'));var querystring=require('querystring');var Papa=require(_0x5d6b('0xa'));var Redis=require('ioredis');var authService=require(_0x5d6b('0xb'));var qs=require(_0x5d6b('0xc'));var as=require(_0x5d6b('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d6b('0xe'));var utils=require(_0x5d6b('0xf'));var config=require(_0x5d6b('0x10'));var licenseUtil=require(_0x5d6b('0x11'));var db=require(_0x5d6b('0x12'))['db'];function respondWithStatusCode(_0x5ec548,_0x1ba37f){_0x1ba37f=_0x1ba37f||0xcc;return function(_0x55331e){if(_0x55331e){return _0x5ec548[_0x5d6b('0x13')](_0x1ba37f);}return _0x5ec548['status'](_0x1ba37f)[_0x5d6b('0x14')]();};}function respondWithResult(_0x1a7725,_0x27c6e8){_0x27c6e8=_0x27c6e8||0xc8;return function(_0xe1e057){if(_0xe1e057){return _0x1a7725['status'](_0x27c6e8)[_0x5d6b('0x15')](_0xe1e057);}};}function respondWithFilteredResult(_0x473d81,_0x3f5ad1){return function(_0x406726){if(_0x406726){var _0x28069c=typeof _0x3f5ad1[_0x5d6b('0x16')]===_0x5d6b('0x17')&&typeof _0x3f5ad1[_0x5d6b('0x18')]===_0x5d6b('0x17');var _0x380595=_0x406726[_0x5d6b('0x19')];var _0x4798f5=_0x28069c?0x0:_0x3f5ad1[_0x5d6b('0x16')];var _0x477479=_0x28069c?_0x406726['count']:_0x3f5ad1[_0x5d6b('0x16')]+_0x3f5ad1[_0x5d6b('0x18')];var _0x341930;if(_0x477479>=_0x380595){_0x477479=_0x380595;_0x341930=0xc8;}else{_0x341930=0xce;}_0x473d81[_0x5d6b('0x1a')](_0x341930);return _0x473d81[_0x5d6b('0x1b')](_0x5d6b('0x1c'),_0x4798f5+'-'+_0x477479+'/'+_0x380595)[_0x5d6b('0x15')](_0x406726);}return null;};}function patchUpdates(_0x3955c4){return function(_0x144d3c){try{jsonpatch['apply'](_0x144d3c,_0x3955c4,!![]);}catch(_0x5af19d){return BPromise[_0x5d6b('0x1d')](_0x5af19d);}return _0x144d3c[_0x5d6b('0x1e')]();};}function saveUpdates(_0x5d9986,_0x3b98ff){return function(_0x3f42b8){if(_0x3f42b8){return _0x3f42b8[_0x5d6b('0x1f')](_0x5d9986)['then'](function(_0x236af8){return _0x236af8;});}return null;};}function removeEntity(_0x24d352,_0x5a94eb){return function(_0x7202b8){if(_0x7202b8){return _0x7202b8[_0x5d6b('0x20')]()[_0x5d6b('0x21')](function(){var _0x4388dd=_0x7202b8[_0x5d6b('0x22')]({'plain':!![]});var _0x4cbaea=_0x5d6b('0x23');return db[_0x5d6b('0x24')][_0x5d6b('0x20')]({'where':{'type':_0x4cbaea,'resourceId':_0x4388dd['id']}})[_0x5d6b('0x21')](function(){return _0x7202b8;});})[_0x5d6b('0x21')](function(){_0x24d352['status'](0xcc)[_0x5d6b('0x14')]();});}};}function handleEntityNotFound(_0xf18915,_0x79fd86){return function(_0x508ca5){if(!_0x508ca5){_0xf18915[_0x5d6b('0x13')](0x194);}return _0x508ca5;};}function handleError(_0x4520fc,_0x448e89){_0x448e89=_0x448e89||0x1f4;return function(_0x49f0f9){logger['error'](_0x49f0f9[_0x5d6b('0x25')]);if(_0x49f0f9[_0x5d6b('0x26')]){delete _0x49f0f9[_0x5d6b('0x26')];}_0x4520fc[_0x5d6b('0x1a')](_0x448e89)[_0x5d6b('0x27')](_0x49f0f9);};}exports['index']=function(_0x27805d,_0x479971){var _0x9973df={},_0x280144={},_0x21156d={'count':0x0,'rows':[]};var _0x43441a=_[_0x5d6b('0x28')](db[_0x5d6b('0x29')][_0x5d6b('0x2a')],function(_0x17ea8e){return{'name':_0x17ea8e[_0x5d6b('0x2b')],'type':_0x17ea8e[_0x5d6b('0x2c')][_0x5d6b('0x2d')]};});_0x280144[_0x5d6b('0x2e')]=_[_0x5d6b('0x28')](_0x43441a,'name');_0x280144['query']=_[_0x5d6b('0x2f')](_0x27805d[_0x5d6b('0x30')]);_0x280144[_0x5d6b('0x31')]=_[_0x5d6b('0x32')](_0x280144[_0x5d6b('0x2e')],_0x280144[_0x5d6b('0x30')]);_0x9973df['attributes']=_[_0x5d6b('0x32')](_0x280144[_0x5d6b('0x2e')],qs['fields'](_0x27805d['query'][_0x5d6b('0x33')]));_0x9973df['attributes']=_0x9973df[_0x5d6b('0x34')]['length']?_0x9973df[_0x5d6b('0x34')]:_0x280144[_0x5d6b('0x2e')];if(!_0x27805d[_0x5d6b('0x30')]['hasOwnProperty'](_0x5d6b('0x35'))){_0x9973df[_0x5d6b('0x18')]=qs[_0x5d6b('0x18')](_0x27805d[_0x5d6b('0x30')]['limit']);_0x9973df[_0x5d6b('0x16')]=qs[_0x5d6b('0x16')](_0x27805d[_0x5d6b('0x30')][_0x5d6b('0x16')]);}_0x9973df[_0x5d6b('0x36')]=qs[_0x5d6b('0x37')](_0x27805d['query']['sort']);delete _0x27805d[_0x5d6b('0x30')]['sort'];_0x9973df[_0x5d6b('0x38')]=qs[_0x5d6b('0x31')](_[_0x5d6b('0x39')](_0x27805d[_0x5d6b('0x30')],_0x280144[_0x5d6b('0x31')]),_0x43441a);if(_0x27805d['query'][_0x5d6b('0x3a')]){_0x9973df[_0x5d6b('0x38')]=_[_0x5d6b('0x3b')](_0x9973df[_0x5d6b('0x38')],{'$or':_[_0x5d6b('0x28')](_0x43441a,function(_0x8b37f7){if(_0x8b37f7[_0x5d6b('0x2c')]!=='VIRTUAL'){var _0x9911f8={};_0x9911f8[_0x8b37f7[_0x5d6b('0x26')]]={'$like':'%'+_0x27805d['query']['filter']+'%'};return _0x9911f8;}})});}_0x9973df=_[_0x5d6b('0x3b')]({},_0x9973df,_0x27805d['options']);var _0x533d59={'where':_0x9973df['where']};return db[_0x5d6b('0x29')][_0x5d6b('0x19')](_0x533d59)['then'](function(_0x1db4d9){_0x21156d[_0x5d6b('0x19')]=_0x1db4d9;if(_0x27805d['query'][_0x5d6b('0x3c')]){_0x9973df['include']=[{'all':!![]}];}return db[_0x5d6b('0x29')][_0x5d6b('0x3d')](_0x9973df);})['then'](function(_0x19e016){_0x21156d[_0x5d6b('0x3e')]=_0x19e016;return _0x21156d;})[_0x5d6b('0x21')](respondWithFilteredResult(_0x479971,_0x9973df))[_0x5d6b('0x3f')](handleError(_0x479971,null));};exports['show']=function(_0x4b5e2f,_0x5d3d3a){var _0x1f8089={'raw':![],'where':{'id':_0x4b5e2f[_0x5d6b('0x40')]['id']}},_0x269918={};_0x269918[_0x5d6b('0x2e')]=_[_0x5d6b('0x2f')](db['VoiceMusicOnHold']['rawAttributes']);_0x269918[_0x5d6b('0x30')]=_[_0x5d6b('0x2f')](_0x4b5e2f[_0x5d6b('0x30')]);_0x269918[_0x5d6b('0x31')]=_['intersection'](_0x269918[_0x5d6b('0x2e')],_0x269918['query']);_0x1f8089[_0x5d6b('0x34')]=_['intersection'](_0x269918[_0x5d6b('0x2e')],qs['fields'](_0x4b5e2f[_0x5d6b('0x30')]['fields']));_0x1f8089[_0x5d6b('0x34')]=_0x1f8089[_0x5d6b('0x34')]['length']?_0x1f8089[_0x5d6b('0x34')]:_0x269918[_0x5d6b('0x2e')];if(_0x4b5e2f[_0x5d6b('0x30')][_0x5d6b('0x3c')]){_0x1f8089['include']=[{'all':!![]}];}_0x1f8089=_['merge']({},_0x1f8089,_0x4b5e2f[_0x5d6b('0x41')]);return db[_0x5d6b('0x29')][_0x5d6b('0x42')](_0x1f8089)[_0x5d6b('0x21')](handleEntityNotFound(_0x5d3d3a,null))[_0x5d6b('0x21')](respondWithResult(_0x5d3d3a,null))['catch'](handleError(_0x5d3d3a,null));};exports[_0x5d6b('0x1f')]=function(_0x19c7ab,_0x45d3db){if(_0x19c7ab[_0x5d6b('0x43')]['id']){delete _0x19c7ab[_0x5d6b('0x43')]['id'];}return db[_0x5d6b('0x29')][_0x5d6b('0x42')]({'where':{'id':_0x19c7ab[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](handleEntityNotFound(_0x45d3db,null))['then'](saveUpdates(_0x19c7ab[_0x5d6b('0x43')],null))[_0x5d6b('0x21')](respondWithResult(_0x45d3db,null))[_0x5d6b('0x3f')](handleError(_0x45d3db,null));};exports[_0x5d6b('0x44')]=function(_0x85232,_0x17d6d5,_0x51ac12){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0xd6bfdb){if(_0x85232[_0x5d6b('0x43')][_0x5d6b('0x47')]==='files'){_0x85232[_0x5d6b('0x43')][_0x5d6b('0x48')]=path[_0x5d6b('0x49')](config['root'],_0x5d6b('0x4a'),_0x85232['body'][_0x5d6b('0x26')]);}return db['VoiceMusicOnHold'][_0x5d6b('0x44')](_0x85232['body'],{'transaction':_0xd6bfdb})[_0x5d6b('0x21')](function(_0x417a36){if(_0x85232[_0x5d6b('0x43')][_0x5d6b('0x47')]==='files'){fs[_0x5d6b('0x4b')](_0x417a36[_0x5d6b('0x48')],parseInt(_0x5d6b('0x4c'),0x8));}var _0x264bd9=_0x85232['user'][_0x5d6b('0x22')]({'plain':!![]});if(!_0x264bd9)throw new Error(_0x5d6b('0x4d'));if(_0x264bd9[_0x5d6b('0x4e')]==='user'){var _0x1b85f2=_0x417a36[_0x5d6b('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x264bd9['userProfileId']},'raw':!![]})[_0x5d6b('0x21')](function(_0x12a429){if(_0x12a429&&_0x12a429[_0x5d6b('0x4f')]===0x0){return db[_0x5d6b('0x24')][_0x5d6b('0x44')]({'name':_0x1b85f2[_0x5d6b('0x26')],'resourceId':_0x1b85f2['id'],'type':_0x12a429['name'],'sectionId':_0x12a429['id']},{})[_0x5d6b('0x21')](function(){return _0x417a36;});}else{return _0x417a36;}})[_0x5d6b('0x3f')](function(_0x47d4d0){logger[_0x5d6b('0x50')](_0x5d6b('0x51'),_0x47d4d0);});}return _0x417a36;});})[_0x5d6b('0x21')](respondWithResult(_0x17d6d5,0xc9))['catch'](handleError(_0x17d6d5,null));};exports[_0x5d6b('0x20')]=function(_0x4cb876,_0x252bcb,_0x245200){var _0x3f87fd;return db[_0x5d6b('0x29')][_0x5d6b('0x42')]({'where':{'id':_0x4cb876[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](function(_0x473c2e){if(_0x473c2e){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0xf27758){return _0x473c2e['destroy']({'transaction':_0xf27758,'raw':!![]})[_0x5d6b('0x21')](function(_0x1b4d56){if(_0x1b4d56[_0x5d6b('0x48')]){fs[_0x5d6b('0x52')](_0x1b4d56[_0x5d6b('0x48')])[_0x5d6b('0x53')](function(_0x1e78bd){fs['unlinkSync'](path[_0x5d6b('0x49')](_0x1b4d56[_0x5d6b('0x48')],_0x1e78bd));});fs[_0x5d6b('0x54')](_0x1b4d56['directory']);}return _0x1b4d56;});})[_0x5d6b('0x3f')](function(_0x374a99){throw new db[(_0x5d6b('0x55'))]['ValidationError'](_0x374a99[_0x5d6b('0x56')]);});}})[_0x5d6b('0x21')](handleEntityNotFound(_0x252bcb,null))['then'](removeEntity(_0x252bcb,null))[_0x5d6b('0x3f')](handleError(_0x252bcb,null));};exports['addSound']=function(_0x3d3acb,_0x34e9c5,_0x1a722b){return db[_0x5d6b('0x45')][_0x5d6b('0x46')](function(_0x3d9e33){var _0x480d6a;return db['VoiceMusicOnHold'][_0x5d6b('0x42')]({'where':{'id':_0x3d3acb[_0x5d6b('0x40')]['id']}})[_0x5d6b('0x21')](function(_0x13e892){if(_0x13e892){_0x480d6a=_0x13e892;return _0x13e892[_0x5d6b('0x57')](_0x3d3acb[_0x5d6b('0x43')]['id'],{'transaction':_0x3d9e33});}})['then'](function(_0x196e9c){if(_0x196e9c){return db[_0x5d6b('0x58')]['findOne']({'where':{'id':_0x3d3acb[_0x5d6b('0x43')]['id']},'attributes':['id','name',_0x5d6b('0x59'),_0x5d6b('0x5a'),_0x5d6b('0x5b')],'raw':!![]});}})[_0x5d6b('0x21')](function(_0x54aab2){if(_0x54aab2){var _0x19d33a=path[_0x5d6b('0x49')](config['root'],_0x5d6b('0x5c'),util[_0x5d6b('0x5d')]('%s.%s',path['basename'](_0x54aab2[_0x5d6b('0x59')],path['extname'](_0x54aab2[_0x5d6b('0x59')])),_0x54aab2[_0x5d6b('0x5a')]));var _0x4f5db4=path['join'](config[_0x5d6b('0x5e')],_0x5d6b('0x4a'),_0x480d6a[_0x5d6b('0x26')],util[_0x5d6b('0x5d')](_0x5d6b('0x5f'),_0x54aab2[_0x5d6b('0x26')],_0x54aab2[_0x5d6b('0x5a')]));fs[_0x5d6b('0x60')](_0x19d33a,_0x4f5db4);return _0x54aab2;}})[_0x5d6b('0x3f')](function(_0x171e6c){throw new db[(_0x5d6b('0x55'))]['ValidationError'](_0x171e6c[_0x5d6b('0x56')]);});})['then'](handleEntityNotFound(_0x34e9c5,null))['then'](respondWithResult(_0x34e9c5,0xc9))[_0x5d6b('0x3f')](handleError(_0x34e9c5,null));};exports[_0x5d6b('0x61')]=function(_0x28bc25,_0xec4612,_0xaf949e){return db[_0x5d6b('0x45')]['transaction'](function(_0x41a109){var _0x4319cf;return db[_0x5d6b('0x29')][_0x5d6b('0x62')]({'where':{'id':_0x28bc25[_0x5d6b('0x40')]['id']}})['then'](handleEntityNotFound(_0xec4612,null))[_0x5d6b('0x21')](function(_0x408020){if(_0x408020){_0x4319cf=_0x408020;return _0x408020[_0x5d6b('0x61')](_0x28bc25[_0x5d6b('0x40')][_0x5d6b('0x63')]);}})[_0x5d6b('0x21')](function(_0x4bbff7){if(_0x4bbff7){return db[_0x5d6b('0x58')][_0x5d6b('0x62')]({'where':{'id':_0x28bc25[_0x5d6b('0x40')][_0x5d6b('0x63')]},'attributes':['id',_0x5d6b('0x26'),_0x5d6b('0x59'),_0x5d6b('0x5a'),_0x5d6b('0x5b')],'raw':!![]});}})['then'](function(_0x4421d1){if(_0x4421d1){fs[_0x5d6b('0x64')](path[_0x5d6b('0x49')](_0x4319cf[_0x5d6b('0x48')],util[_0x5d6b('0x5d')](_0x5d6b('0x5f'),_0x4421d1[_0x5d6b('0x26')],_0x4421d1[_0x5d6b('0x5a')])));return _0x4421d1;}})[_0x5d6b('0x3f')](function(_0x411520){throw new db[(_0x5d6b('0x55'))][(_0x5d6b('0x65'))](_0x411520[_0x5d6b('0x56')]);});})['then'](handleEntityNotFound(_0xec4612,null))[_0x5d6b('0x21')](respondWithStatusCode(_0xec4612,0xcc))[_0x5d6b('0x3f')](handleError(_0xec4612,null));};exports[_0x5d6b('0x66')]=function(_0xaa136f,_0x2b5831,_0x446bfa){var _0x4217ec={};var _0x37c755={};var _0x13c8bb;var _0x2aad66;return db[_0x5d6b('0x29')][_0x5d6b('0x62')]({'where':{'id':_0xaa136f['params']['id']}})['then'](handleEntityNotFound(_0x2b5831,null))['then'](function(_0x3d8a6c){if(_0x3d8a6c){_0x13c8bb=_0x3d8a6c;_0x37c755[_0x5d6b('0x2e')]=_['keys'](db[_0x5d6b('0x58')]['rawAttributes']);_0x37c755['query']=_[_0x5d6b('0x2f')](_0xaa136f['query']);_0x37c755['filters']=_['intersection'](_0x37c755[_0x5d6b('0x2e')],_0x37c755['query']);_0x4217ec[_0x5d6b('0x34')]=_['intersection'](_0x37c755[_0x5d6b('0x2e')],qs[_0x5d6b('0x33')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x33')]));_0x4217ec[_0x5d6b('0x34')]=_0x4217ec[_0x5d6b('0x34')][_0x5d6b('0x67')]?_0x4217ec[_0x5d6b('0x34')]:_0x37c755[_0x5d6b('0x2e')];_0x4217ec[_0x5d6b('0x36')]=qs[_0x5d6b('0x37')](_0xaa136f['query'][_0x5d6b('0x37')]);_0x4217ec['where']=qs['filters'](_['pick'](_0xaa136f[_0x5d6b('0x30')],_0x37c755[_0x5d6b('0x31')]));if(_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x3a')]){_0x4217ec[_0x5d6b('0x38')]=_[_0x5d6b('0x3b')](_0x4217ec[_0x5d6b('0x38')],{'$or':_['map'](_0x4217ec[_0x5d6b('0x34')],function(_0x4d1e7a){var _0x343801={};_0x343801[_0x4d1e7a]={'$like':'%'+_0xaa136f[_0x5d6b('0x30')]['filter']+'%'};return _0x343801;})});}_0x4217ec=_[_0x5d6b('0x3b')]({},_0x4217ec,_0xaa136f[_0x5d6b('0x41')]);return _0x13c8bb[_0x5d6b('0x66')](_0x4217ec);}})[_0x5d6b('0x21')](function(_0x25b358){if(_0x25b358){_0x2aad66=_0x25b358[_0x5d6b('0x67')];if(!_0xaa136f['query']['hasOwnProperty'](_0x5d6b('0x35'))){_0x4217ec[_0x5d6b('0x18')]=qs[_0x5d6b('0x18')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x18')]);_0x4217ec[_0x5d6b('0x16')]=qs[_0x5d6b('0x16')](_0xaa136f[_0x5d6b('0x30')][_0x5d6b('0x16')]);}return _0x13c8bb[_0x5d6b('0x66')](_0x4217ec);}})[_0x5d6b('0x21')](function(_0x544674){if(_0x544674){return _0x544674?{'count':_0x2aad66,'rows':_0x544674}:null;}})[_0x5d6b('0x21')](respondWithResult(_0x2b5831,null))[_0x5d6b('0x3f')](handleError(_0x2b5831,null));}; \ No newline at end of file +var _0x81de=['unlinkSync','getSounds','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','find','body','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','user','UserProfileSection','userProfileId','UserProfileResource','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','removeSound','id2'];(function(_0x425d7c,_0x5a4c75){var _0x80c16d=function(_0x231005){while(--_0x231005){_0x425d7c['push'](_0x425d7c['shift']());}};_0x80c16d(++_0x5a4c75);}(_0x81de,0x6c));var _0xe81d=function(_0x4a501a,_0x25fc65){_0x4a501a=_0x4a501a-0x0;var _0x20579c=_0x81de[_0x4a501a];return _0x20579c;};'use strict';var emlformat=require(_0xe81d('0x0'));var rimraf=require(_0xe81d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe81d('0x2'));var rp=require('request-promise');var moment=require(_0xe81d('0x3'));var BPromise=require(_0xe81d('0x4'));var Mustache=require(_0xe81d('0x5'));var util=require('util');var path=require(_0xe81d('0x6'));var sox=require(_0xe81d('0x7'));var csv=require(_0xe81d('0x8'));var ejs=require(_0xe81d('0x9'));var fs=require('fs');var fs_extra=require(_0xe81d('0xa'));var _=require(_0xe81d('0xb'));var squel=require(_0xe81d('0xc'));var crypto=require(_0xe81d('0xd'));var jsforce=require(_0xe81d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe81d('0x8'));var querystring=require(_0xe81d('0xf'));var Papa=require('papaparse');var Redis=require(_0xe81d('0x10'));var authService=require(_0xe81d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe81d('0x12'));var logger=require(_0xe81d('0x13'))(_0xe81d('0x14'));var utils=require(_0xe81d('0x15'));var config=require(_0xe81d('0x16'));var licenseUtil=require(_0xe81d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245590,_0xc9ea){_0xc9ea=_0xc9ea||0xcc;return function(_0x37eccc){if(_0x37eccc){return _0x245590['sendStatus'](_0xc9ea);}return _0x245590[_0xe81d('0x18')](_0xc9ea)[_0xe81d('0x19')]();};}function respondWithResult(_0x274588,_0x230c9b){_0x230c9b=_0x230c9b||0xc8;return function(_0x2ddf53){if(_0x2ddf53){return _0x274588['status'](_0x230c9b)['json'](_0x2ddf53);}};}function respondWithFilteredResult(_0x4d0e9a,_0x37a74c){return function(_0x367c81){if(_0x367c81){var _0x8192b9=typeof _0x37a74c[_0xe81d('0x1a')]===_0xe81d('0x1b')&&typeof _0x37a74c[_0xe81d('0x1c')]===_0xe81d('0x1b');var _0x58e6f4=_0x367c81[_0xe81d('0x1d')];var _0xc723b8=_0x8192b9?0x0:_0x37a74c[_0xe81d('0x1a')];var _0x386517=_0x8192b9?_0x367c81[_0xe81d('0x1d')]:_0x37a74c[_0xe81d('0x1a')]+_0x37a74c[_0xe81d('0x1c')];var _0x356237;if(_0x386517>=_0x58e6f4){_0x386517=_0x58e6f4;_0x356237=0xc8;}else{_0x356237=0xce;}_0x4d0e9a[_0xe81d('0x18')](_0x356237);return _0x4d0e9a[_0xe81d('0x1e')]('Content-Range',_0xc723b8+'-'+_0x386517+'/'+_0x58e6f4)[_0xe81d('0x1f')](_0x367c81);}return null;};}function patchUpdates(_0x556009){return function(_0x52a84c){try{jsonpatch['apply'](_0x52a84c,_0x556009,!![]);}catch(_0x336fab){return BPromise['reject'](_0x336fab);}return _0x52a84c[_0xe81d('0x20')]();};}function saveUpdates(_0x4c7633,_0x8747fd){return function(_0x2ee41c){if(_0x2ee41c){return _0x2ee41c[_0xe81d('0x21')](_0x4c7633)[_0xe81d('0x22')](function(_0x420c46){return _0x420c46;});}return null;};}function removeEntity(_0x54a75d,_0x337b19){return function(_0x1497c1){if(_0x1497c1){return _0x1497c1[_0xe81d('0x23')]()[_0xe81d('0x22')](function(){var _0x183d07=_0x1497c1[_0xe81d('0x24')]({'plain':!![]});var _0x82c010=_0xe81d('0x25');return db['UserProfileResource'][_0xe81d('0x23')]({'where':{'type':_0x82c010,'resourceId':_0x183d07['id']}})[_0xe81d('0x22')](function(){return _0x1497c1;});})['then'](function(){_0x54a75d[_0xe81d('0x18')](0xcc)[_0xe81d('0x19')]();});}};}function handleEntityNotFound(_0x3aa0d1,_0x261c18){return function(_0x104b5c){if(!_0x104b5c){_0x3aa0d1[_0xe81d('0x26')](0x194);}return _0x104b5c;};}function handleError(_0x51c30e,_0x2afee6){_0x2afee6=_0x2afee6||0x1f4;return function(_0x524395){logger[_0xe81d('0x27')](_0x524395['stack']);if(_0x524395[_0xe81d('0x28')]){delete _0x524395['name'];}_0x51c30e[_0xe81d('0x18')](_0x2afee6)[_0xe81d('0x29')](_0x524395);};}exports['index']=function(_0x31fadd,_0x2c506b){var _0x35c640={},_0x39b9c9={},_0x43066a={'count':0x0,'rows':[]};var _0xb3ed0b=_[_0xe81d('0x2a')](db['VoiceMusicOnHold'][_0xe81d('0x2b')],function(_0x20ce3b){return{'name':_0x20ce3b['fieldName'],'type':_0x20ce3b[_0xe81d('0x2c')][_0xe81d('0x2d')]};});_0x39b9c9[_0xe81d('0x2e')]=_[_0xe81d('0x2a')](_0xb3ed0b,_0xe81d('0x28'));_0x39b9c9['query']=_[_0xe81d('0x2f')](_0x31fadd[_0xe81d('0x30')]);_0x39b9c9[_0xe81d('0x31')]=_[_0xe81d('0x32')](_0x39b9c9['model'],_0x39b9c9[_0xe81d('0x30')]);_0x35c640[_0xe81d('0x33')]=_['intersection'](_0x39b9c9[_0xe81d('0x2e')],qs[_0xe81d('0x34')](_0x31fadd[_0xe81d('0x30')]['fields']));_0x35c640[_0xe81d('0x33')]=_0x35c640['attributes'][_0xe81d('0x35')]?_0x35c640[_0xe81d('0x33')]:_0x39b9c9[_0xe81d('0x2e')];if(!_0x31fadd[_0xe81d('0x30')][_0xe81d('0x36')](_0xe81d('0x37'))){_0x35c640['limit']=qs[_0xe81d('0x1c')](_0x31fadd[_0xe81d('0x30')]['limit']);_0x35c640[_0xe81d('0x1a')]=qs['offset'](_0x31fadd[_0xe81d('0x30')][_0xe81d('0x1a')]);}_0x35c640[_0xe81d('0x38')]=qs[_0xe81d('0x39')](_0x31fadd['query'][_0xe81d('0x39')]);delete _0x31fadd['query'][_0xe81d('0x39')];_0x35c640['where']=qs[_0xe81d('0x31')](_[_0xe81d('0x3a')](_0x31fadd[_0xe81d('0x30')],_0x39b9c9[_0xe81d('0x31')]),_0xb3ed0b);if(_0x31fadd[_0xe81d('0x30')][_0xe81d('0x3b')]){_0x35c640[_0xe81d('0x3c')]=_[_0xe81d('0x3d')](_0x35c640[_0xe81d('0x3c')],{'$or':_[_0xe81d('0x2a')](_0xb3ed0b,function(_0x5b623b){if(_0x5b623b['type']!=='VIRTUAL'){var _0x48e2c0={};_0x48e2c0[_0x5b623b[_0xe81d('0x28')]]={'$like':'%'+_0x31fadd[_0xe81d('0x30')][_0xe81d('0x3b')]+'%'};return _0x48e2c0;}})});}_0x35c640=_[_0xe81d('0x3d')]({},_0x35c640,_0x31fadd[_0xe81d('0x3e')]);var _0x1a6a4b={'where':_0x35c640[_0xe81d('0x3c')]};return db[_0xe81d('0x3f')][_0xe81d('0x1d')](_0x1a6a4b)['then'](function(_0x240d8d){_0x43066a['count']=_0x240d8d;if(_0x31fadd[_0xe81d('0x30')][_0xe81d('0x40')]){_0x35c640[_0xe81d('0x41')]=[{'all':!![]}];}return db[_0xe81d('0x3f')][_0xe81d('0x42')](_0x35c640);})[_0xe81d('0x22')](function(_0x4fd751){_0x43066a[_0xe81d('0x43')]=_0x4fd751;return _0x43066a;})[_0xe81d('0x22')](respondWithFilteredResult(_0x2c506b,_0x35c640))[_0xe81d('0x44')](handleError(_0x2c506b,null));};exports[_0xe81d('0x45')]=function(_0xccbe7a,_0x358295){var _0xc9523={'raw':![],'where':{'id':_0xccbe7a[_0xe81d('0x46')]['id']}},_0x2089f6={};_0x2089f6[_0xe81d('0x2e')]=_[_0xe81d('0x2f')](db[_0xe81d('0x3f')]['rawAttributes']);_0x2089f6[_0xe81d('0x30')]=_[_0xe81d('0x2f')](_0xccbe7a[_0xe81d('0x30')]);_0x2089f6['filters']=_['intersection'](_0x2089f6['model'],_0x2089f6['query']);_0xc9523[_0xe81d('0x33')]=_['intersection'](_0x2089f6[_0xe81d('0x2e')],qs[_0xe81d('0x34')](_0xccbe7a[_0xe81d('0x30')][_0xe81d('0x34')]));_0xc9523[_0xe81d('0x33')]=_0xc9523[_0xe81d('0x33')]['length']?_0xc9523['attributes']:_0x2089f6[_0xe81d('0x2e')];if(_0xccbe7a[_0xe81d('0x30')][_0xe81d('0x40')]){_0xc9523[_0xe81d('0x41')]=[{'all':!![]}];}_0xc9523=_[_0xe81d('0x3d')]({},_0xc9523,_0xccbe7a[_0xe81d('0x3e')]);return db['VoiceMusicOnHold'][_0xe81d('0x47')](_0xc9523)[_0xe81d('0x22')](handleEntityNotFound(_0x358295,null))[_0xe81d('0x22')](respondWithResult(_0x358295,null))[_0xe81d('0x44')](handleError(_0x358295,null));};exports[_0xe81d('0x21')]=function(_0x3b952f,_0x38c992){if(_0x3b952f[_0xe81d('0x48')]['id']){delete _0x3b952f[_0xe81d('0x48')]['id'];}return db[_0xe81d('0x3f')]['find']({'where':{'id':_0x3b952f['params']['id']}})['then'](handleEntityNotFound(_0x38c992,null))[_0xe81d('0x22')](saveUpdates(_0x3b952f[_0xe81d('0x48')],null))[_0xe81d('0x22')](respondWithResult(_0x38c992,null))[_0xe81d('0x44')](handleError(_0x38c992,null));};exports['create']=function(_0x593036,_0x1e64ab,_0x41a330){return db['sequelize'][_0xe81d('0x49')](function(_0x98cf22){if(_0x593036[_0xe81d('0x48')][_0xe81d('0x4a')]===_0xe81d('0x4b')){_0x593036[_0xe81d('0x48')][_0xe81d('0x4c')]=path[_0xe81d('0x4d')](config[_0xe81d('0x4e')],_0xe81d('0x4f'),_0x593036[_0xe81d('0x48')][_0xe81d('0x28')]);}return db[_0xe81d('0x3f')][_0xe81d('0x50')](_0x593036[_0xe81d('0x48')],{'transaction':_0x98cf22})[_0xe81d('0x22')](function(_0x4ed6e2){if(_0x593036[_0xe81d('0x48')][_0xe81d('0x4a')]==='files'){fs[_0xe81d('0x51')](_0x4ed6e2[_0xe81d('0x4c')],parseInt('0777',0x8));}var _0x592779=_0x593036[_0xe81d('0x52')][_0xe81d('0x24')]({'plain':!![]});if(!_0x592779)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x592779['role']===_0xe81d('0x52')){var _0x417cdc=_0x4ed6e2[_0xe81d('0x24')]({'plain':!![]});return db[_0xe81d('0x53')][_0xe81d('0x47')]({'where':{'name':_0xe81d('0x25'),'userProfileId':_0x592779[_0xe81d('0x54')]},'raw':!![]})['then'](function(_0x321853){if(_0x321853&&_0x321853['autoAssociation']===0x0){return db[_0xe81d('0x55')][_0xe81d('0x50')]({'name':_0x417cdc[_0xe81d('0x28')],'resourceId':_0x417cdc['id'],'type':_0x321853[_0xe81d('0x28')],'sectionId':_0x321853['id']},{})[_0xe81d('0x22')](function(){return _0x4ed6e2;});}else{return _0x4ed6e2;}})[_0xe81d('0x44')](function(_0x572278){logger[_0xe81d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572278);});}return _0x4ed6e2;});})[_0xe81d('0x22')](respondWithResult(_0x1e64ab,0xc9))[_0xe81d('0x44')](handleError(_0x1e64ab,null));};exports[_0xe81d('0x23')]=function(_0x4c2de6,_0x452bcc,_0x14410b){var _0xdfb65f;return db[_0xe81d('0x3f')][_0xe81d('0x47')]({'where':{'id':_0x4c2de6[_0xe81d('0x46')]['id']}})['then'](function(_0x24a058){if(_0x24a058){return db['sequelize']['transaction'](function(_0x309af7){return _0x24a058[_0xe81d('0x23')]({'transaction':_0x309af7,'raw':!![]})['then'](function(_0xe662e6){if(_0xe662e6[_0xe81d('0x4c')]){fs[_0xe81d('0x56')](_0xe662e6[_0xe81d('0x4c')])[_0xe81d('0x57')](function(_0x55baa1){fs['unlinkSync'](path[_0xe81d('0x4d')](_0xe662e6['directory'],_0x55baa1));});fs[_0xe81d('0x58')](_0xe662e6[_0xe81d('0x4c')]);}return _0xe662e6;});})[_0xe81d('0x44')](function(_0x1dec39){throw new db[(_0xe81d('0x59'))][(_0xe81d('0x5a'))](_0x1dec39[_0xe81d('0x5b')]);});}})[_0xe81d('0x22')](handleEntityNotFound(_0x452bcc,null))[_0xe81d('0x22')](removeEntity(_0x452bcc,null))[_0xe81d('0x44')](handleError(_0x452bcc,null));};exports[_0xe81d('0x5c')]=function(_0x1722c1,_0x42e069,_0x24f1bc){return db[_0xe81d('0x5d')][_0xe81d('0x49')](function(_0xbca368){var _0xa35566;return db[_0xe81d('0x3f')][_0xe81d('0x47')]({'where':{'id':_0x1722c1['params']['id']}})['then'](function(_0x426e4a){if(_0x426e4a){_0xa35566=_0x426e4a;return _0x426e4a[_0xe81d('0x5c')](_0x1722c1['body']['id'],{'transaction':_0xbca368});}})[_0xe81d('0x22')](function(_0x526748){if(_0x526748){return db[_0xe81d('0x5e')][_0xe81d('0x5f')]({'where':{'id':_0x1722c1[_0xe81d('0x48')]['id']},'attributes':['id',_0xe81d('0x28'),_0xe81d('0x60'),_0xe81d('0x61'),_0xe81d('0x62')],'raw':!![]});}})[_0xe81d('0x22')](function(_0xf2d1ec){if(_0xf2d1ec){var _0x3039e0=path[_0xe81d('0x4d')](config[_0xe81d('0x4e')],_0xe81d('0x63'),util[_0xe81d('0x64')](_0xe81d('0x65'),path['basename'](_0xf2d1ec[_0xe81d('0x60')],path['extname'](_0xf2d1ec[_0xe81d('0x60')])),_0xf2d1ec['converted_format']));var _0xe20efc=path['join'](config[_0xe81d('0x4e')],'server/files/moh',_0xa35566[_0xe81d('0x28')],util[_0xe81d('0x64')](_0xe81d('0x65'),_0xf2d1ec[_0xe81d('0x28')],_0xf2d1ec[_0xe81d('0x61')]));fs['symlinkSync'](_0x3039e0,_0xe20efc);return _0xf2d1ec;}})[_0xe81d('0x44')](function(_0x1dcb8e){throw new db[(_0xe81d('0x59'))][(_0xe81d('0x5a'))](_0x1dcb8e[_0xe81d('0x5b')]);});})['then'](handleEntityNotFound(_0x42e069,null))[_0xe81d('0x22')](respondWithResult(_0x42e069,0xc9))['catch'](handleError(_0x42e069,null));};exports[_0xe81d('0x66')]=function(_0x4e2c98,_0x339fad,_0x585069){return db[_0xe81d('0x5d')][_0xe81d('0x49')](function(_0x21d943){var _0x1435ee;return db[_0xe81d('0x3f')][_0xe81d('0x5f')]({'where':{'id':_0x4e2c98[_0xe81d('0x46')]['id']}})[_0xe81d('0x22')](handleEntityNotFound(_0x339fad,null))[_0xe81d('0x22')](function(_0x475245){if(_0x475245){_0x1435ee=_0x475245;return _0x475245[_0xe81d('0x66')](_0x4e2c98['params'][_0xe81d('0x67')]);}})['then'](function(_0x36057f){if(_0x36057f){return db[_0xe81d('0x5e')][_0xe81d('0x5f')]({'where':{'id':_0x4e2c98['params']['id2']},'attributes':['id',_0xe81d('0x28'),_0xe81d('0x60'),_0xe81d('0x61'),'createdAt'],'raw':!![]});}})[_0xe81d('0x22')](function(_0x3269d0){if(_0x3269d0){fs[_0xe81d('0x68')](path[_0xe81d('0x4d')](_0x1435ee[_0xe81d('0x4c')],util['format'](_0xe81d('0x65'),_0x3269d0['name'],_0x3269d0[_0xe81d('0x61')])));return _0x3269d0;}})['catch'](function(_0x465651){throw new db['Sequelize'][(_0xe81d('0x5a'))](_0x465651[_0xe81d('0x5b')]);});})[_0xe81d('0x22')](handleEntityNotFound(_0x339fad,null))[_0xe81d('0x22')](respondWithStatusCode(_0x339fad,0xcc))[_0xe81d('0x44')](handleError(_0x339fad,null));};exports[_0xe81d('0x69')]=function(_0x284e2a,_0x3479a1,_0x428624){var _0x22fc9b={};var _0x1711c8={};var _0x331fed;var _0x4af15b;return db[_0xe81d('0x3f')][_0xe81d('0x5f')]({'where':{'id':_0x284e2a[_0xe81d('0x46')]['id']}})[_0xe81d('0x22')](handleEntityNotFound(_0x3479a1,null))['then'](function(_0x1c481f){if(_0x1c481f){_0x331fed=_0x1c481f;_0x1711c8[_0xe81d('0x2e')]=_[_0xe81d('0x2f')](db[_0xe81d('0x5e')][_0xe81d('0x2b')]);_0x1711c8[_0xe81d('0x30')]=_[_0xe81d('0x2f')](_0x284e2a['query']);_0x1711c8['filters']=_['intersection'](_0x1711c8[_0xe81d('0x2e')],_0x1711c8[_0xe81d('0x30')]);_0x22fc9b['attributes']=_[_0xe81d('0x32')](_0x1711c8[_0xe81d('0x2e')],qs[_0xe81d('0x34')](_0x284e2a['query'][_0xe81d('0x34')]));_0x22fc9b[_0xe81d('0x33')]=_0x22fc9b['attributes'][_0xe81d('0x35')]?_0x22fc9b['attributes']:_0x1711c8[_0xe81d('0x2e')];_0x22fc9b[_0xe81d('0x38')]=qs[_0xe81d('0x39')](_0x284e2a['query'][_0xe81d('0x39')]);_0x22fc9b[_0xe81d('0x3c')]=qs['filters'](_['pick'](_0x284e2a[_0xe81d('0x30')],_0x1711c8[_0xe81d('0x31')]));if(_0x284e2a[_0xe81d('0x30')][_0xe81d('0x3b')]){_0x22fc9b['where']=_[_0xe81d('0x3d')](_0x22fc9b[_0xe81d('0x3c')],{'$or':_[_0xe81d('0x2a')](_0x22fc9b[_0xe81d('0x33')],function(_0x334c29){var _0x1b6434={};_0x1b6434[_0x334c29]={'$like':'%'+_0x284e2a['query'][_0xe81d('0x3b')]+'%'};return _0x1b6434;})});}_0x22fc9b=_[_0xe81d('0x3d')]({},_0x22fc9b,_0x284e2a['options']);return _0x331fed[_0xe81d('0x69')](_0x22fc9b);}})[_0xe81d('0x22')](function(_0xcdb6f1){if(_0xcdb6f1){_0x4af15b=_0xcdb6f1[_0xe81d('0x35')];if(!_0x284e2a[_0xe81d('0x30')][_0xe81d('0x36')](_0xe81d('0x37'))){_0x22fc9b[_0xe81d('0x1c')]=qs[_0xe81d('0x1c')](_0x284e2a[_0xe81d('0x30')][_0xe81d('0x1c')]);_0x22fc9b[_0xe81d('0x1a')]=qs[_0xe81d('0x1a')](_0x284e2a[_0xe81d('0x30')]['offset']);}return _0x331fed['getSounds'](_0x22fc9b);}})['then'](function(_0x519aa2){if(_0x519aa2){return _0x519aa2?{'count':_0x4af15b,'rows':_0x519aa2}:null;}})[_0xe81d('0x22')](respondWithResult(_0x3479a1,null))[_0xe81d('0x44')](handleError(_0x3479a1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index fe69566..1138c5c 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 _0x777c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api'];(function(_0x2c90c1,_0x446eda){var _0xcb55d4=function(_0x30e230){while(--_0x30e230){_0x2c90c1['push'](_0x2c90c1['shift']());}};_0xcb55d4(++_0x446eda);}(_0x777c,0x1c3));var _0xc777=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x777c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc777('0x0'));var util=require(_0xc777('0x1'));var logger=require(_0xc777('0x2'))(_0xc777('0x3'));var moment=require(_0xc777('0x4'));var BPromise=require(_0xc777('0x5'));var rp=require(_0xc777('0x6'));var fs=require('fs');var path=require(_0xc777('0x7'));var rimraf=require(_0xc777('0x8'));var config=require(_0xc777('0x9'));var attributes=require(_0xc777('0xa'));module[_0xc777('0xb')]=function(_0x4d9cb1,_0x28fa46){return _0x4d9cb1['define'](_0xc777('0xc'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x935e=['exports','VoiceMusicOnHold','voice_musiconhold','api','moment','path','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x3f73f9,_0x36df24){var _0x1e63ad=function(_0x1a1f5c){while(--_0x1a1f5c){_0x3f73f9['push'](_0x3f73f9['shift']());}};_0x1e63ad(++_0x36df24);}(_0x935e,0xb3));var _0xe935=function(_0x1abd69,_0x27540f){_0x1abd69=_0x1abd69-0x0;var _0x48f4bb=_0x935e[_0x1abd69];return _0x48f4bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe935('0x0'));var moment=require(_0xe935('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe935('0x2'));var rimraf=require('rimraf');var config=require(_0xe935('0x3'));var attributes=require(_0xe935('0x4'));module[_0xe935('0x5')]=function(_0x55a27d,_0x200ba4){return _0x55a27d['define'](_0xe935('0x6'),attributes,{'tableName':_0xe935('0x7'),'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 4c6aa52..878efc3 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x4372c4,_0x501602){var _0x4b9b12=function(_0x15fdf5){while(--_0x15fdf5){_0x4372c4['push'](_0x4372c4['shift']());}};_0x4b9b12(++_0x501602);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xcb91[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xf7b0e,_0x1f7088){var _0x2e95aa=function(_0x45a76c){while(--_0x45a76c){_0xf7b0e['push'](_0xf7b0e['shift']());}};_0x2e95aa(++_0x1f7088);}(_0x70e0,0x17b));var _0x070e=function(_0x221584,_0x183542){_0x221584=_0x221584-0x0;var _0x2a782d=_0x70e0[_0x221584];return _0x2a782d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a64a9df..e60364a 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 _0xb258=['addAgents','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','show','/:id/users','getAgents','/:id/teams','post','create'];(function(_0x4bc3a0,_0x38862c){var _0x3fe34b=function(_0x2bfa4e){while(--_0x2bfa4e){_0x4bc3a0['push'](_0x4bc3a0['shift']());}};_0x3fe34b(++_0x38862c);}(_0xb258,0x12b));var _0x8b25=function(_0x7062f6,_0xc78f87){_0x7062f6=_0x7062f6-0x0;var _0x392def=_0xb258[_0x7062f6];return _0x392def;};'use strict';var multer=require(_0x8b25('0x0'));var util=require('util');var path=require(_0x8b25('0x1'));var timeout=require(_0x8b25('0x2'));var express=require('express');var router=express[_0x8b25('0x3')]();var fs_extra=require(_0x8b25('0x4'));var auth=require(_0x8b25('0x5'));var interaction=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var controller=require(_0x8b25('0x8'));router['get']('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0xa')]);router[_0x8b25('0xb')](_0x8b25('0xc'),auth['isAuthenticated'](),controller[_0x8b25('0xd')]);router[_0x8b25('0xb')]('/:id',auth[_0x8b25('0x9')](),controller[_0x8b25('0xe')]);router[_0x8b25('0xb')](_0x8b25('0xf'),auth['isAuthenticated'](),controller[_0x8b25('0x10')]);router[_0x8b25('0xb')](_0x8b25('0x11'),auth[_0x8b25('0x9')](),controller['getTeams']);router[_0x8b25('0x12')]('/',auth[_0x8b25('0x9')](),controller[_0x8b25('0x13')]);router['post'](_0x8b25('0xf'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x14')]);router[_0x8b25('0x12')]('/:id/teams',auth[_0x8b25('0x9')](),controller['addTeams']);router[_0x8b25('0x15')](_0x8b25('0x16'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x17')]);router[_0x8b25('0x18')](_0x8b25('0x16'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x19')]);router[_0x8b25('0x18')](_0x8b25('0xf'),auth[_0x8b25('0x9')](),controller[_0x8b25('0x1a')]);router[_0x8b25('0x18')](_0x8b25('0x11'),auth['isAuthenticated'](),controller[_0x8b25('0x1b')]);module[_0x8b25('0x1c')]=router; \ No newline at end of file +var _0xb2ff=['/describe','describe','/:id','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xb2ff,0x123));var _0xfb2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2ff[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var path=require('path');var timeout=require(_0xfb2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfb2f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfb2f('0x4'));var controller=require(_0xfb2f('0x5'));router[_0xfb2f('0x6')]('/',auth[_0xfb2f('0x7')](),controller['index']);router['get'](_0xfb2f('0x8'),auth['isAuthenticated'](),controller[_0xfb2f('0x9')]);router[_0xfb2f('0x6')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller['show']);router[_0xfb2f('0x6')]('/:id/users',auth[_0xfb2f('0x7')](),controller['getAgents']);router[_0xfb2f('0x6')](_0xfb2f('0xb'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0xc')]);router[_0xfb2f('0xd')]('/',auth['isAuthenticated'](),controller[_0xfb2f('0xe')]);router[_0xfb2f('0xd')](_0xfb2f('0xf'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x10')]);router[_0xfb2f('0xd')](_0xfb2f('0xb'),auth[_0xfb2f('0x7')](),controller['addTeams']);router[_0xfb2f('0x11')](_0xfb2f('0xa'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x12')]);router[_0xfb2f('0x13')]('/:id',auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x14')]);router[_0xfb2f('0x13')](_0xfb2f('0xf'),auth[_0xfb2f('0x7')](),controller[_0xfb2f('0x15')]);router['delete'](_0xfb2f('0xb'),auth[_0xfb2f('0x7')](),controller['removeTeams']);module[_0xfb2f('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8574040..e555b72 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 _0xcc46=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x263d88,_0x5cd913){var _0x212585=function(_0x2dccc4){while(--_0x2dccc4){_0x263d88['push'](_0x263d88['shift']());}};_0x212585(++_0x5cd913);}(_0xcc46,0xa5));var _0x6cc4=function(_0x10d386,_0x101138){_0x10d386=_0x10d386-0x0;var _0x45a236=_0xcc46[_0x10d386];return _0x45a236;};'use strict';var Sequelize=require(_0x6cc4('0x0'));module[_0x6cc4('0x1')]={'name':{'type':Sequelize[_0x6cc4('0x2')],'allowNull':![],'unique':_0x6cc4('0x3')},'prefix':{'type':Sequelize[_0x6cc4('0x4')],'get':function(_0x5b3022){return _0x6cc4('0x5')+this[_0x6cc4('0x6')](_0x6cc4('0x3'))+'-';}},'description':{'type':Sequelize[_0x6cc4('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x6cc4('0x7')]}}; \ No newline at end of file +var _0x7acc=['getDataValue','INTEGER','sequelize','exports','STRING','name','system-'];(function(_0x9d3c56,_0x569898){var _0x460d1c=function(_0x3458d1){while(--_0x3458d1){_0x9d3c56['push'](_0x9d3c56['shift']());}};_0x460d1c(++_0x569898);}(_0x7acc,0xfe));var _0xc7ac=function(_0x5eab95,_0x3719f6){_0x5eab95=_0x5eab95-0x0;var _0x2ee708=_0x7acc[_0x5eab95];return _0x2ee708;};'use strict';var Sequelize=require(_0xc7ac('0x0'));module[_0xc7ac('0x1')]={'name':{'type':Sequelize[_0xc7ac('0x2')],'allowNull':![],'unique':_0xc7ac('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x31aa79){return _0xc7ac('0x4')+this[_0xc7ac('0x5')](_0xc7ac('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xc7ac('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xc7ac('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index be60d88..952ab86 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 _0xd7d1=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','intersection','describe','create','sequelize','VoiceExtension','VoiceExtensionId','user','role','find','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','Team','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','VoicePrefixes','destroy','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2da421,_0x4d3ba5){var _0x42a20b=function(_0x10415f){while(--_0x10415f){_0x2da421['push'](_0x2da421['shift']());}};_0x42a20b(++_0x4d3ba5);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x33575e,_0x181154){_0x33575e=_0x33575e-0x0;var _0x367cf3=_0xd7d1[_0x33575e];return _0x367cf3;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x1d7d('0x1c')]=_['defaults'](config['redis'],{'host':_0x1d7d('0x1d'),'port':0x18eb});var socket=require(_0x1d7d('0x1e'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1d7d('0x1f')](socket);function respondWithStatusCode(_0x334e78,_0xe10fdd){_0xe10fdd=_0xe10fdd||0xcc;return function(_0x183fc6){if(_0x183fc6){return _0x334e78[_0x1d7d('0x20')](_0xe10fdd);}return _0x334e78['status'](_0xe10fdd)[_0x1d7d('0x21')]();};}function respondWithResult(_0x1de6cc,_0x51cbca){_0x51cbca=_0x51cbca||0xc8;return function(_0xb90a8c){if(_0xb90a8c){return _0x1de6cc[_0x1d7d('0x22')](_0x51cbca)[_0x1d7d('0x23')](_0xb90a8c);}};}function respondWithFilteredResult(_0x47826a,_0x40db4d){return function(_0x4db4f2){if(_0x4db4f2){var _0x664e3f=typeof _0x40db4d[_0x1d7d('0x24')]==='undefined'&&typeof _0x40db4d['limit']===_0x1d7d('0x25');var _0x1a5101=_0x4db4f2[_0x1d7d('0x26')];var _0x396802=_0x664e3f?0x0:_0x40db4d[_0x1d7d('0x24')];var _0x275d3c=_0x664e3f?_0x4db4f2['count']:_0x40db4d[_0x1d7d('0x24')]+_0x40db4d[_0x1d7d('0x27')];var _0x3a93d0;if(_0x275d3c>=_0x1a5101){_0x275d3c=_0x1a5101;_0x3a93d0=0xc8;}else{_0x3a93d0=0xce;}_0x47826a['status'](_0x3a93d0);return _0x47826a[_0x1d7d('0x28')](_0x1d7d('0x29'),_0x396802+'-'+_0x275d3c+'/'+_0x1a5101)['json'](_0x4db4f2);}return null;};}function patchUpdates(_0x5950bd){return function(_0x1dcaf2){try{jsonpatch[_0x1d7d('0x2a')](_0x1dcaf2,_0x5950bd,!![]);}catch(_0x3d631f){return BPromise['reject'](_0x3d631f);}return _0x1dcaf2[_0x1d7d('0x2b')]();};}function saveUpdates(_0x106376,_0x2d4c0c){return function(_0x21e59){if(_0x21e59){return _0x21e59['update'](_0x106376)[_0x1d7d('0x2c')](function(_0x151198){return _0x151198;});}return null;};}function removeEntity(_0x5c8257,_0x57bbd8){return function(_0x301e5c){if(_0x301e5c){return _0x301e5c['destroy']()[_0x1d7d('0x2c')](function(){var _0x2d4de4=_0x301e5c[_0x1d7d('0x2d')]({'plain':!![]});var _0x22c40d=_0x1d7d('0x2e');return db['UserProfileResource'][_0x1d7d('0x2f')]({'where':{'type':_0x22c40d,'resourceId':_0x2d4de4['id']}})[_0x1d7d('0x2c')](function(){return _0x301e5c;});})[_0x1d7d('0x2c')](function(){_0x5c8257['status'](0xcc)[_0x1d7d('0x21')]();});}};}function handleEntityNotFound(_0x1a935a,_0x23ad85){return function(_0x482367){if(!_0x482367){_0x1a935a['sendStatus'](0x194);}return _0x482367;};}function handleError(_0x53e25c,_0x189a6a){_0x189a6a=_0x189a6a||0x1f4;return function(_0x329f56){logger['error'](_0x329f56[_0x1d7d('0x30')]);if(_0x329f56[_0x1d7d('0x31')]){delete _0x329f56[_0x1d7d('0x31')];}_0x53e25c[_0x1d7d('0x22')](_0x189a6a)[_0x1d7d('0x32')](_0x329f56);};}exports[_0x1d7d('0x33')]=function(_0x452293,_0x803dc9){var _0xd701e1={},_0x456b56={},_0x5b2209={'count':0x0,'rows':[]};var _0x57c22e=_[_0x1d7d('0x34')](db[_0x1d7d('0x35')][_0x1d7d('0x36')],function(_0x40318f){return{'name':_0x40318f[_0x1d7d('0x37')],'type':_0x40318f[_0x1d7d('0x38')][_0x1d7d('0x39')]};});_0x456b56[_0x1d7d('0x3a')]=_[_0x1d7d('0x34')](_0x57c22e,'name');_0x456b56[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x452293[_0x1d7d('0x3b')]);_0x456b56[_0x1d7d('0x3d')]=_['intersection'](_0x456b56['model'],_0x456b56[_0x1d7d('0x3b')]);_0xd701e1[_0x1d7d('0x3e')]=_['intersection'](_0x456b56[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x452293['query']['fields']));_0xd701e1[_0x1d7d('0x3e')]=_0xd701e1[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0xd701e1[_0x1d7d('0x3e')]:_0x456b56[_0x1d7d('0x3a')];if(!_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xd701e1[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x452293['query']['limit']);_0xd701e1['offset']=qs['offset'](_0x452293[_0x1d7d('0x3b')]['offset']);}_0xd701e1[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x452293[_0x1d7d('0x3b')]['sort']);_0xd701e1[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x452293['query'],_0x456b56[_0x1d7d('0x3d')]),_0x57c22e);if(_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xd701e1[_0x1d7d('0x45')]=_['merge'](_0xd701e1[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x57c22e,function(_0x4239fa){if(_0x4239fa[_0x1d7d('0x38')]!=='VIRTUAL'){var _0x14a6b3={};_0x14a6b3[_0x4239fa['name']]={'$like':'%'+_0x452293[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0x14a6b3;}})});}_0xd701e1=_[_0x1d7d('0x48')]({},_0xd701e1,_0x452293[_0x1d7d('0x49')]);var _0xf667a1={'where':_0xd701e1['where']};return db['VoicePrefix'][_0x1d7d('0x26')](_0xf667a1)[_0x1d7d('0x2c')](function(_0x1637fc){_0x5b2209['count']=_0x1637fc;if(_0x452293['query'][_0x1d7d('0x4a')]){_0xd701e1['include']=[{'all':!![]}];}return db[_0x1d7d('0x35')][_0x1d7d('0x4b')](_0xd701e1);})[_0x1d7d('0x2c')](function(_0x21394c){_0x5b2209[_0x1d7d('0x4c')]=_0x21394c;return _0x5b2209;})[_0x1d7d('0x2c')](respondWithFilteredResult(_0x803dc9,_0xd701e1))[_0x1d7d('0x4d')](handleError(_0x803dc9,null));};exports['show']=function(_0x3ccd44,_0x8b0c22){var _0x49de57={'raw':![],'where':{'id':_0x3ccd44[_0x1d7d('0x4e')]['id']}},_0x17c68b={};_0x17c68b[_0x1d7d('0x3a')]=_[_0x1d7d('0x3c')](db[_0x1d7d('0x35')][_0x1d7d('0x36')]);_0x17c68b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x3ccd44[_0x1d7d('0x3b')]);_0x17c68b[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x17c68b[_0x1d7d('0x3a')],_0x17c68b['query']);_0x49de57[_0x1d7d('0x3e')]=_['intersection'](_0x17c68b[_0x1d7d('0x3a')],qs['fields'](_0x3ccd44[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x49de57[_0x1d7d('0x3e')]=_0x49de57[_0x1d7d('0x3e')]['length']?_0x49de57[_0x1d7d('0x3e')]:_0x17c68b['model'];if(_0x3ccd44['query'][_0x1d7d('0x4a')]){_0x49de57['include']=[{'all':!![]}];}_0x49de57=_['merge']({},_0x49de57,_0x3ccd44[_0x1d7d('0x49')]);return db[_0x1d7d('0x35')]['find'](_0x49de57)[_0x1d7d('0x2c')](handleEntityNotFound(_0x8b0c22,null))[_0x1d7d('0x2c')](respondWithResult(_0x8b0c22,null))['catch'](handleError(_0x8b0c22,null));};exports[_0x1d7d('0x2f')]=function(_0x2b9faa,_0xa64dbe){return db[_0x1d7d('0x35')]['find']({'where':{'id':_0x2b9faa['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0xa64dbe,null))[_0x1d7d('0x2c')](removeEntity(_0xa64dbe,null))[_0x1d7d('0x4d')](handleError(_0xa64dbe,null));};exports[_0x1d7d('0x50')]=function(_0x3cc5b7,_0x550c9f){return db[_0x1d7d('0x35')][_0x1d7d('0x50')]()[_0x1d7d('0x2c')](respondWithResult(_0x550c9f,null))[_0x1d7d('0x4d')](handleError(_0x550c9f,null));};exports[_0x1d7d('0x51')]=function(_0x42a103,_0x276e7e){var _0x296e7c;return db[_0x1d7d('0x52')]['transaction'](function(_0x3e7c4c){return db[_0x1d7d('0x35')][_0x1d7d('0x51')](_0x42a103['body'],{'transaction':_0x3e7c4c})['then'](function(_0x1d3f54){_0x296e7c=_0x1d3f54[_0x1d7d('0x2d')]({'plain':!![]});return db[_0x1d7d('0x53')]['find']({'where':{'id':_0x296e7c[_0x1d7d('0x54')]},'raw':!![]})[_0x1d7d('0x2c')](function(_0x5eff64){return createVoicePrefixExtensions(_0x296e7c,_0x5eff64,_0x3e7c4c);});});})[_0x1d7d('0x2c')](function(){var _0x2cf508=_0x42a103[_0x1d7d('0x55')][_0x1d7d('0x2d')]({'plain':!![]});if(!_0x2cf508)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cf508[_0x1d7d('0x56')]===_0x1d7d('0x55')){var _0x4ba6ec=_0x296e7c;return db['UserProfileSection'][_0x1d7d('0x57')]({'where':{'name':_0x1d7d('0x2e'),'userProfileId':_0x2cf508['userProfileId']},'raw':!![]})['then'](function(_0x155ef4){if(_0x155ef4&&_0x155ef4[_0x1d7d('0x58')]===0x0){return db[_0x1d7d('0x59')][_0x1d7d('0x51')]({'name':_0x4ba6ec['name'],'resourceId':_0x4ba6ec['id'],'type':_0x155ef4[_0x1d7d('0x31')],'sectionId':_0x155ef4['id']},{})['then'](function(){return _0x296e7c;});}else{return _0x296e7c;}})[_0x1d7d('0x4d')](function(_0x1b1d9e){logger[_0x1d7d('0x5a')](_0x1d7d('0x5b'),_0x1b1d9e);throw _0x1b1d9e;});}return _0x296e7c;})['then'](respondWithResult(_0x276e7e,null))[_0x1d7d('0x4d')](handleError(_0x276e7e,null));};function Extension(_0x1ea966,_0x193135,_0x226509,_0x28ec14){this[_0x1d7d('0x5c')]=_0x1d7d('0x5d');this[_0x1d7d('0x5e')]=_0x1ea966;this[_0x1d7d('0x5f')]=_0x226509;this[_0x1d7d('0x38')]=_0x1d7d('0x60');this[_0x1d7d('0x61')]=_0x1d7d('0x62');this[_0x1d7d('0x63')]=_0x193135;this[_0x1d7d('0x64')]=_0x28ec14;}function createVoicePrefixExtensions(_0x520d3c,_0x2279c5,_0x566d27){return new BPromise(function(_0x1c9fe7,_0x1e3853){var _0x1c698c=new Extension(formatPrefixName(_0x520d3c[_0x1d7d('0x65')]),0x1,_0x1d7d('0x66'),_0x1d7d('0x67'));_0x1c698c['VoicePrefixId']=_0x520d3c['id'];return db[_0x1d7d('0x53')][_0x1d7d('0x51')](_0x1c698c,{'transaction':_0x566d27})['then'](function(_0x2c6d03){var _0x5ed678=_0x2c6d03[_0x1d7d('0x2d')]({'plain':!![]});var _0x119e76=_[_0x1d7d('0x34')](addVoicePrefixExtensions(_0x520d3c,_0x2279c5),function(_0x283f77){_0x283f77[_0x1d7d('0x54')]=_0x5ed678['id'];_0x283f77[_0x1d7d('0x68')]=_0x520d3c['id'];return _0x283f77;});return db['VoiceExtension'][_0x1d7d('0x69')](_0x119e76,{'transaction':_0x566d27})[_0x1d7d('0x2c')](function(_0x4d69cc){if(!_0x4d69cc){return _0x1e3853(_0x1d7d('0x6a'));}else{return _0x1c9fe7(_0x4d69cc);}})[_0x1d7d('0x4d')](function(_0x3c8a65){return _0x1e3853(_0x3c8a65);});});;});};function addVoicePrefixExtensions(_0x4bc7b8,_0x3b3975){var _0xe5c3ba=[];var _0x1038ae=formatPrefixName(_0x4bc7b8[_0x1d7d('0x65')]);_0xe5c3ba['push'](new Extension(_0x1038ae,0x2,_0x1d7d('0x6b'),_0x1d7d('0x6c')+_0x4bc7b8[_0x1d7d('0x31')]));if(_0x4bc7b8[_0x1d7d('0x6d')]){_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x3,'Set',_0x1d7d('0x6f')+_0x4bc7b8[_0x1d7d('0x6d')]));}else{_0xe5c3ba['push'](new Extension(_0x1038ae,0x3,_0x1d7d('0x66'),_0x1d7d('0x70')));}_0xe5c3ba[_0x1d7d('0x6e')](new Extension(_0x1038ae,0x4,_0x1d7d('0x71'),_0x3b3975['context']+','+_0x1d7d('0x72')+(0x8+_0x4bc7b8['name'][_0x1d7d('0x40')])+'}'+','+0x1));return _0xe5c3ba;}function formatPrefixName(_0x138fc2){var _0x30dc64='_';for(var _0x5e1172=0x0;_0x5e1172<_0x138fc2[_0x1d7d('0x40')];_0x5e1172++){if(_0x138fc2[_0x1d7d('0x73')](_0x5e1172)=='-'){_0x30dc64+=_0x138fc2[_0x1d7d('0x73')](_0x5e1172);}else{_0x30dc64+='['+_0x138fc2['charAt'](_0x5e1172)+']';}}_0x30dc64+='.';return _0x30dc64;}exports[_0x1d7d('0x74')]=function(_0x47c1d5,_0x6e9ee6,_0x2a413b){var _0x131c8e=_0x47c1d5[_0x1d7d('0x75')];_0x131c8e[_0x1d7d('0x65')]=_0x1d7d('0x76')+_0x131c8e[_0x1d7d('0x31')]+'-';return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x347877){return db[_0x1d7d('0x35')]['update'](_0x131c8e,{'where':{'id':_0x131c8e['id']},'transaction':_0x347877})['then'](function(){return db[_0x1d7d('0x53')][_0x1d7d('0x2f')]({'where':{'VoicePrefixId':_0x131c8e['id']},'transaction':_0x347877})[_0x1d7d('0x2c')](function(){return db['VoiceExtension'][_0x1d7d('0x57')]({'where':{'id':_0x131c8e['VoiceExtensionId']},'raw':!![]})[_0x1d7d('0x2c')](function(_0x33e656){return createVoicePrefixExtensions(_0x131c8e,_0x33e656,_0x347877);});});});})['then'](function(){return db[_0x1d7d('0x35')][_0x1d7d('0x78')](_0x131c8e['id']);})['then'](respondWithResult(_0x6e9ee6,null))[_0x1d7d('0x4d')](handleError(_0x6e9ee6,null));};exports[_0x1d7d('0x79')]=function(_0xc9b467,_0x50a21e,_0x47dc25){return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0xc9b467['params']['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x50a21e,null))[_0x1d7d('0x2c')](function(_0x268046){if(_0x268046){return _0x268046[_0x1d7d('0x79')](_0xc9b467['body'][_0x1d7d('0x7a')],_[_0x1d7d('0x7b')](_0xc9b467[_0x1d7d('0x75')],[_0x1d7d('0x7a'),'id'])||{})[_0x1d7d('0x7c')](function(_0x38bddd){for(var _0x42a83c=0x0;_0x42a83c<_0xc9b467[_0x1d7d('0x75')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x42a83c+=0x1){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':Number(_0xc9b467[_0x1d7d('0x75')]['ids'][_0x42a83c]),'VoicePrefixId':Number(_0xc9b467[_0x1d7d('0x4e')]['id'])});}return _0x38bddd;});}})[_0x1d7d('0x2c')](respondWithResult(_0x50a21e,null))['catch'](handleError(_0x50a21e,null));};exports[_0x1d7d('0x7f')]=function(_0x2e4373,_0x5d1a0e,_0x5b61c1){return db['VoicePrefix'][_0x1d7d('0x57')]({'where':{'id':_0x2e4373[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5d1a0e,null))[_0x1d7d('0x2c')](function(_0x4db998){if(_0x4db998){return _0x4db998[_0x1d7d('0x7f')](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])[_0x1d7d('0x2c')](function(){if(_['isArray'](_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')])){for(var _0x135910=0x0;_0x135910<_0x2e4373[_0x1d7d('0x3b')][_0x1d7d('0x7a')][_0x1d7d('0x40')];_0x135910+=0x1){socket['emit'](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373[_0x1d7d('0x3b')]['ids'][_0x135910]),'VoicePrefixId':Number(_0x2e4373[_0x1d7d('0x4e')]['id'])});}}else{socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':Number(_0x2e4373['query'][_0x1d7d('0x7a')]),'VoicePrefixId':Number(_0x2e4373['params']['id'])});}});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5d1a0e,null))[_0x1d7d('0x4d')](handleError(_0x5d1a0e,null));};exports['getAgents']=function(_0x122483,_0x3390ab,_0xe381ff){var _0xc3c42f={};var _0x20b275={};var _0xb6519f;var _0x17ba85;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x122483[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](handleEntityNotFound(_0x3390ab,null))[_0x1d7d('0x2c')](function(_0x4e635a){if(_0x4e635a){_0xb6519f=_0x4e635a;_0x20b275['model']=_[_0x1d7d('0x3c')](db[_0x1d7d('0x82')][_0x1d7d('0x36')]);_0x20b275[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x122483[_0x1d7d('0x3b')]);_0x20b275[_0x1d7d('0x3d')]=_[_0x1d7d('0x4f')](_0x20b275[_0x1d7d('0x3a')],_0x20b275[_0x1d7d('0x3b')]);_0xc3c42f[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x20b275['model'],qs[_0x1d7d('0x3f')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0xc3c42f[_0x1d7d('0x3e')]=_0xc3c42f['attributes'][_0x1d7d('0x40')]?_0xc3c42f[_0x1d7d('0x3e')]:_0x20b275[_0x1d7d('0x3a')];_0xc3c42f[_0x1d7d('0x43')]=qs['sort'](_0x122483['query']['sort']);_0xc3c42f['where']=qs[_0x1d7d('0x3d')](_[_0x1d7d('0x46')](_0x122483['query'],_0x20b275['filters']));if(_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x47')]){_0xc3c42f[_0x1d7d('0x45')]=_[_0x1d7d('0x48')](_0xc3c42f[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0xc3c42f[_0x1d7d('0x3e')],function(_0x35020c){var _0x2f2a28={};_0x2f2a28[_0x35020c]={'$like':'%'+_0x122483[_0x1d7d('0x3b')]['filter']+'%'};return _0x2f2a28;})});}_0xc3c42f=_[_0x1d7d('0x48')]({},_0xc3c42f,_0x122483['options']);return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0x29186b){if(_0x29186b){_0x17ba85=_0x29186b['length'];if(!_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0xc3c42f[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0xc3c42f[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x122483[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xb6519f[_0x1d7d('0x83')](_0xc3c42f);}})[_0x1d7d('0x2c')](function(_0xd6c7ad){if(_0xd6c7ad){return _0xd6c7ad?{'count':_0x17ba85,'rows':_0xd6c7ad}:null;}})[_0x1d7d('0x2c')](respondWithResult(_0x3390ab,null))[_0x1d7d('0x4d')](handleError(_0x3390ab,null));};exports[_0x1d7d('0x84')]=function(_0x2aac19,_0x37ba0e,_0x443c53){var _0x689a17={};var _0x65407b={};var _0xecfc39;var _0x4fac26;return db[_0x1d7d('0x35')][_0x1d7d('0x81')]({'where':{'id':_0x2aac19[_0x1d7d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37ba0e,null))[_0x1d7d('0x2c')](function(_0x589609){if(_0x589609){_0xecfc39=_0x589609;_0x65407b['model']=_['keys'](db['Team'][_0x1d7d('0x36')]);_0x65407b[_0x1d7d('0x3b')]=_[_0x1d7d('0x3c')](_0x2aac19['query']);_0x65407b[_0x1d7d('0x3d')]=_['intersection'](_0x65407b[_0x1d7d('0x3a')],_0x65407b[_0x1d7d('0x3b')]);_0x689a17[_0x1d7d('0x3e')]=_[_0x1d7d('0x4f')](_0x65407b[_0x1d7d('0x3a')],qs[_0x1d7d('0x3f')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x3f')]));_0x689a17[_0x1d7d('0x3e')]=_0x689a17[_0x1d7d('0x3e')][_0x1d7d('0x40')]?_0x689a17['attributes']:_0x65407b[_0x1d7d('0x3a')];_0x689a17[_0x1d7d('0x43')]=qs[_0x1d7d('0x44')](_0x2aac19['query'][_0x1d7d('0x44')]);_0x689a17[_0x1d7d('0x45')]=qs[_0x1d7d('0x3d')](_['pick'](_0x2aac19['query'],_0x65407b[_0x1d7d('0x3d')]));if(_0x2aac19['query'][_0x1d7d('0x47')]){_0x689a17[_0x1d7d('0x45')]=_['merge'](_0x689a17[_0x1d7d('0x45')],{'$or':_[_0x1d7d('0x34')](_0x689a17['attributes'],function(_0x3cfd3d){var _0xd0d1b5={};_0xd0d1b5[_0x3cfd3d]={'$like':'%'+_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x47')]+'%'};return _0xd0d1b5;})});}_0x689a17=_['merge']({},_0x689a17,_0x2aac19['options']);return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x3c257c){if(_0x3c257c){_0x4fac26=_0x3c257c[_0x1d7d('0x40')];if(!_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x41')](_0x1d7d('0x42'))){_0x689a17[_0x1d7d('0x27')]=qs[_0x1d7d('0x27')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x27')]);_0x689a17[_0x1d7d('0x24')]=qs[_0x1d7d('0x24')](_0x2aac19[_0x1d7d('0x3b')][_0x1d7d('0x24')]);}return _0xecfc39[_0x1d7d('0x84')](_0x689a17);}})[_0x1d7d('0x2c')](function(_0x1c1ace){if(_0x1c1ace){return _0x1c1ace?{'count':_0x4fac26,'rows':_0x1c1ace}:null;}})['then'](respondWithResult(_0x37ba0e,null))[_0x1d7d('0x4d')](handleError(_0x37ba0e,null));};exports[_0x1d7d('0x85')]=function(_0x16ce51,_0x20b99d,_0x5ca824){var _0x4096cf=_0x16ce51[_0x1d7d('0x75')][_0x1d7d('0x7a')];var _0x1d1a34;return db['Team'][_0x1d7d('0x4b')]({'where':{'id':_0x4096cf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1d7d('0x86'),'attributes':['id',_0x1d7d('0x31'),_0x1d7d('0x87'),'voicePause',_0x1d7d('0x88')],'raw':!![]}]})['then'](function(_0x341e74){if(_0x341e74){_0x1d1a34=_0x341e74;var _0x1c1077=_[_0x1d7d('0x89')](_0x341e74,function(_0x466208){var _0x4bbdc8=_0x466208[_0x1d7d('0x2d')]({'plain':!![]});return _0x4bbdc8['Agents'];});return db[_0x1d7d('0x35')][_0x1d7d('0x57')]({'where':{'id':_0x16ce51['params']['id']}})[_0x1d7d('0x2c')](function(_0x3dc8ee){return db[_0x1d7d('0x52')][_0x1d7d('0x77')](function(_0x4dca1d){return _0x3dc8ee['addTeams'](_0x4096cf,{'transaction':_0x4dca1d})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1d1a34,function(_0x3ae715){return db[_0x1d7d('0x8b')][_0x1d7d('0x8c')]({'TeamId':_0x3ae715['id'],'VoicePrefixId':_0x16ce51[_0x1d7d('0x4e')]['id']},{'transaction':_0x4dca1d});});})['then'](function(){return BPromise[_0x1d7d('0x8a')](_0x1c1077,function(_0x41874){return db[_0x1d7d('0x8d')][_0x1d7d('0x8e')]({'where':{'UserId':_0x41874['id'],'VoicePrefixId':_0x16ce51['params']['id']},'transaction':_0x4dca1d});});})['then'](function(){_0x1c1077[_0x1d7d('0x8f')](function(_0x21995f){socket[_0x1d7d('0x7d')](_0x1d7d('0x7e'),{'UserId':_0x21995f['id'],'VoicePrefixId':_0x3dc8ee['id']});});});});});}})[_0x1d7d('0x2c')](respondWithStatusCode(_0x20b99d,null))[_0x1d7d('0x4d')](handleError(_0x20b99d,null));};exports['removeTeams']=function(_0x37863c,_0x5cf31f,_0x42893a){return db[_0x1d7d('0x90')]['findAll']({'where':{'id':_0x37863c[_0x1d7d('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1d7d('0x82')],'as':_0x1d7d('0x86'),'attributes':['id'],'raw':!![]}]})[_0x1d7d('0x2c')](handleEntityNotFound(_0x5cf31f,null))[_0x1d7d('0x2c')](function(_0xa5c124){var _0x481997=_[_0x1d7d('0x34')](_0xa5c124,'id');var _0x572be9=[];var _0x303d6f=[];var _0x5bf0de=squel['select']();_0x5bf0de[_0x1d7d('0x91')](_0x1d7d('0x92'))[_0x1d7d('0x93')](_0x1d7d('0x94'),'tq')[_0x1d7d('0x95')](_0x1d7d('0x96'),'ut',_0x1d7d('0x97'))[_0x1d7d('0x45')](_0x1d7d('0x98'),_0x37863c[_0x1d7d('0x4e')]['id']);for(var _0x3e94d6=0x0;_0x3e94d6<_0xa5c124[_0x1d7d('0x40')];_0x3e94d6+=0x1){let _0x5a05a3=_0xa5c124[_0x3e94d6];for(var _0x542ae6=0x0;_0x542ae6<_0x5a05a3[_0x1d7d('0x86')]['length'];_0x542ae6+=0x1){let _0x43ee13=_0x5a05a3['Agents'][_0x542ae6];var _0x489649=_0x5bf0de[_0x1d7d('0x99')]();_0x489649[_0x1d7d('0x45')](_0x1d7d('0x9a'),_0x43ee13['id']);_0x303d6f[_0x1d7d('0x6e')](db[_0x1d7d('0x52')][_0x1d7d('0x3b')](_0x489649[_0x1d7d('0x9b')](),{'type':db[_0x1d7d('0x52')][_0x1d7d('0x9c')]['SELECT']})['then'](function(_0x38cde1){if(_0x38cde1['length']===0x1){return _0x43ee13['id'];}else{var _0x3d863b=_[_0x1d7d('0x9d')](_[_0x1d7d('0x34')](_0x38cde1,_0x1d7d('0x9e')),function(_0x10b561){return _[_0x1d7d('0x9f')](_0x481997,_0x10b561);});if(_0x3d863b){return _0x43ee13['id'];}}}));}}return BPromise[_0x1d7d('0xa0')](_0x303d6f)[_0x1d7d('0x2c')](function(_0x2dfb5c){_0x572be9=_(_0x572be9)[_0x1d7d('0xa1')](_0x2dfb5c)[_0x1d7d('0xa2')]()[_0x1d7d('0xa3')]();return db['VoicePrefix']['find']({'where':{'id':_0x37863c[_0x1d7d('0x4e')]['id']}})[_0x1d7d('0x2c')](function(_0xfd4b25){return db['sequelize']['transaction'](function(_0x19a53b){return _0xfd4b25[_0x1d7d('0xa4')](_0x37863c['query'][_0x1d7d('0x7a')],{'transaction':_0x19a53b})['then'](function(){if(!_[_0x1d7d('0xa5')](_0x572be9)){return _0xfd4b25['removeAgents'](_0x572be9,{'transaction':_0x19a53b});}})[_0x1d7d('0x2c')](function(){_0x572be9[_0x1d7d('0x8f')](function(_0x44f307){socket[_0x1d7d('0x7d')](_0x1d7d('0x80'),{'UserId':_0x44f307,'VoicePrefixId':_0xfd4b25['id']});});});});});});})[_0x1d7d('0x2c')](respondWithStatusCode(_0x5cf31f,null))[_0x1d7d('0x4d')](handleError(_0x5cf31f,null));}; \ No newline at end of file +var _0xb78e=['userVoicePrefix:remove','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','then','get','VoicePrefixes','destroy','sendStatus','name','index','map','VoicePrefix','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','include','findAll','catch','params','keys','rawAttributes','length','includeAll','find','create','sequelize','transaction','body','VoiceExtension','user','userProfileId','autoAssociation','error','exten','app','system','description','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','omit','ids','spread','emit','removeAgents','getAgents','User','pick','merge','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','each','upsert','UserVoicePrefix','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty'];(function(_0x41da6a,_0xb6ad1c){var _0x2cbd52=function(_0x42d34e){while(--_0x42d34e){_0x41da6a['push'](_0x41da6a['shift']());}};_0x2cbd52(++_0xb6ad1c);}(_0xb78e,0x1c9));var _0xeb78=function(_0x38ef85,_0x317bcc){_0x38ef85=_0x38ef85-0x0;var _0x1ffa8d=_0xb78e[_0x38ef85];return _0x1ffa8d;};'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'];config[_0xeb78('0x1d')]=_[_0xeb78('0x1e')](config[_0xeb78('0x1d')],{'host':_0xeb78('0x1f'),'port':0x18eb});var socket=require(_0xeb78('0x20'))(new Redis(config[_0xeb78('0x1d')]));require(_0xeb78('0x21'))['register'](socket);function respondWithStatusCode(_0x315914,_0x3e4d24){_0x3e4d24=_0x3e4d24||0xcc;return function(_0x4e8b8c){if(_0x4e8b8c){return _0x315914['sendStatus'](_0x3e4d24);}return _0x315914['status'](_0x3e4d24)[_0xeb78('0x22')]();};}function respondWithResult(_0x50ebae,_0xa28d5e){_0xa28d5e=_0xa28d5e||0xc8;return function(_0x247cb1){if(_0x247cb1){return _0x50ebae['status'](_0xa28d5e)[_0xeb78('0x23')](_0x247cb1);}};}function respondWithFilteredResult(_0x53c811,_0x21c521){return function(_0x92e410){if(_0x92e410){var _0x576802=typeof _0x21c521[_0xeb78('0x24')]===_0xeb78('0x25')&&typeof _0x21c521[_0xeb78('0x26')]==='undefined';var _0x24d845=_0x92e410[_0xeb78('0x27')];var _0x4ab933=_0x576802?0x0:_0x21c521['offset'];var _0x455e30=_0x576802?_0x92e410[_0xeb78('0x27')]:_0x21c521[_0xeb78('0x24')]+_0x21c521[_0xeb78('0x26')];var _0x432b18;if(_0x455e30>=_0x24d845){_0x455e30=_0x24d845;_0x432b18=0xc8;}else{_0x432b18=0xce;}_0x53c811[_0xeb78('0x28')](_0x432b18);return _0x53c811[_0xeb78('0x29')](_0xeb78('0x2a'),_0x4ab933+'-'+_0x455e30+'/'+_0x24d845)[_0xeb78('0x23')](_0x92e410);}return null;};}function patchUpdates(_0x52b8c1){return function(_0x5d3cf8){try{jsonpatch['apply'](_0x5d3cf8,_0x52b8c1,!![]);}catch(_0x5c9e0d){return BPromise[_0xeb78('0x2b')](_0x5c9e0d);}return _0x5d3cf8['save']();};}function saveUpdates(_0x2159c1,_0x1fbf2f){return function(_0x566336){if(_0x566336){return _0x566336[_0xeb78('0x2c')](_0x2159c1)['then'](function(_0x9a00b){return _0x9a00b;});}return null;};}function removeEntity(_0x5fc575,_0x315f98){return function(_0x12b3b2){if(_0x12b3b2){return _0x12b3b2['destroy']()[_0xeb78('0x2d')](function(){var _0x515158=_0x12b3b2[_0xeb78('0x2e')]({'plain':!![]});var _0x23295a=_0xeb78('0x2f');return db['UserProfileResource'][_0xeb78('0x30')]({'where':{'type':_0x23295a,'resourceId':_0x515158['id']}})[_0xeb78('0x2d')](function(){return _0x12b3b2;});})[_0xeb78('0x2d')](function(){_0x5fc575[_0xeb78('0x28')](0xcc)[_0xeb78('0x22')]();});}};}function handleEntityNotFound(_0x3516b8,_0x1131a9){return function(_0x22c25f){if(!_0x22c25f){_0x3516b8[_0xeb78('0x31')](0x194);}return _0x22c25f;};}function handleError(_0x19ad00,_0x1f3a14){_0x1f3a14=_0x1f3a14||0x1f4;return function(_0x505468){logger['error'](_0x505468['stack']);if(_0x505468[_0xeb78('0x32')]){delete _0x505468[_0xeb78('0x32')];}_0x19ad00[_0xeb78('0x28')](_0x1f3a14)['send'](_0x505468);};}exports[_0xeb78('0x33')]=function(_0x1ecdfb,_0x3de59f){var _0x83b35d={},_0x4e720c={},_0x1a0ce6={'count':0x0,'rows':[]};var _0x1ec0bc=_[_0xeb78('0x34')](db[_0xeb78('0x35')]['rawAttributes'],function(_0x3ff33f){return{'name':_0x3ff33f['fieldName'],'type':_0x3ff33f[_0xeb78('0x36')][_0xeb78('0x37')]};});_0x4e720c[_0xeb78('0x38')]=_[_0xeb78('0x34')](_0x1ec0bc,_0xeb78('0x32'));_0x4e720c[_0xeb78('0x39')]=_['keys'](_0x1ecdfb['query']);_0x4e720c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x4e720c[_0xeb78('0x38')],_0x4e720c[_0xeb78('0x39')]);_0x83b35d[_0xeb78('0x3c')]=_['intersection'](_0x4e720c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x83b35d[_0xeb78('0x3c')]=_0x83b35d[_0xeb78('0x3c')]['length']?_0x83b35d['attributes']:_0x4e720c['model'];if(!_0x1ecdfb['query'][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x83b35d[_0xeb78('0x26')]=qs['limit'](_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x26')]);_0x83b35d['offset']=qs['offset'](_0x1ecdfb['query'][_0xeb78('0x24')]);}_0x83b35d[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x1ecdfb['query'][_0xeb78('0x41')]);_0x83b35d[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_['pick'](_0x1ecdfb[_0xeb78('0x39')],_0x4e720c[_0xeb78('0x3a')]),_0x1ec0bc);if(_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]){_0x83b35d['where']=_['merge'](_0x83b35d[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ec0bc,function(_0x2e416b){if(_0x2e416b[_0xeb78('0x36')]!==_0xeb78('0x44')){var _0x2fbdb4={};_0x2fbdb4[_0x2e416b[_0xeb78('0x32')]]={'$like':'%'+_0x1ecdfb[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x2fbdb4;}})});}_0x83b35d=_['merge']({},_0x83b35d,_0x1ecdfb[_0xeb78('0x45')]);var _0xa02a32={'where':_0x83b35d[_0xeb78('0x42')]};return db['VoicePrefix'][_0xeb78('0x27')](_0xa02a32)['then'](function(_0x21f81b){_0x1a0ce6[_0xeb78('0x27')]=_0x21f81b;if(_0x1ecdfb[_0xeb78('0x39')]['includeAll']){_0x83b35d[_0xeb78('0x46')]=[{'all':!![]}];}return db[_0xeb78('0x35')][_0xeb78('0x47')](_0x83b35d);})[_0xeb78('0x2d')](function(_0x2dc9f7){_0x1a0ce6['rows']=_0x2dc9f7;return _0x1a0ce6;})[_0xeb78('0x2d')](respondWithFilteredResult(_0x3de59f,_0x83b35d))[_0xeb78('0x48')](handleError(_0x3de59f,null));};exports['show']=function(_0xece1cb,_0x31a146){var _0x1f2610={'raw':![],'where':{'id':_0xece1cb[_0xeb78('0x49')]['id']}},_0x51dfbc={};_0x51dfbc[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x35')][_0xeb78('0x4b')]);_0x51dfbc[_0xeb78('0x39')]=_['keys'](_0xece1cb['query']);_0x51dfbc[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x51dfbc['model'],_0x51dfbc[_0xeb78('0x39')]);_0x1f2610[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0x51dfbc[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0xece1cb[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1f2610[_0xeb78('0x3c')]=_0x1f2610[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x1f2610[_0xeb78('0x3c')]:_0x51dfbc[_0xeb78('0x38')];if(_0xece1cb[_0xeb78('0x39')][_0xeb78('0x4d')]){_0x1f2610[_0xeb78('0x46')]=[{'all':!![]}];}_0x1f2610=_['merge']({},_0x1f2610,_0xece1cb[_0xeb78('0x45')]);return db[_0xeb78('0x35')][_0xeb78('0x4e')](_0x1f2610)[_0xeb78('0x2d')](handleEntityNotFound(_0x31a146,null))['then'](respondWithResult(_0x31a146,null))[_0xeb78('0x48')](handleError(_0x31a146,null));};exports[_0xeb78('0x30')]=function(_0xcaccc5,_0x3d30a4){return db[_0xeb78('0x35')]['find']({'where':{'id':_0xcaccc5['params']['id']}})['then'](handleEntityNotFound(_0x3d30a4,null))[_0xeb78('0x2d')](removeEntity(_0x3d30a4,null))[_0xeb78('0x48')](handleError(_0x3d30a4,null));};exports['describe']=function(_0x10efdb,_0x43164f){return db[_0xeb78('0x35')]['describe']()['then'](respondWithResult(_0x43164f,null))[_0xeb78('0x48')](handleError(_0x43164f,null));};exports[_0xeb78('0x4f')]=function(_0x1f5b67,_0x4e3f1a){var _0x3c7214;return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x4a3c91){return db['VoicePrefix']['create'](_0x1f5b67[_0xeb78('0x52')],{'transaction':_0x4a3c91})[_0xeb78('0x2d')](function(_0x55c643){_0x3c7214=_0x55c643[_0xeb78('0x2e')]({'plain':!![]});return db[_0xeb78('0x53')][_0xeb78('0x4e')]({'where':{'id':_0x3c7214['VoiceExtensionId']},'raw':!![]})[_0xeb78('0x2d')](function(_0x572aaf){return createVoicePrefixExtensions(_0x3c7214,_0x572aaf,_0x4a3c91);});});})[_0xeb78('0x2d')](function(){var _0x151083=_0x1f5b67[_0xeb78('0x54')]['get']({'plain':!![]});if(!_0x151083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151083['role']==='user'){var _0x3238e9=_0x3c7214;return db['UserProfileSection'][_0xeb78('0x4e')]({'where':{'name':_0xeb78('0x2f'),'userProfileId':_0x151083[_0xeb78('0x55')]},'raw':!![]})[_0xeb78('0x2d')](function(_0x2a1f7f){if(_0x2a1f7f&&_0x2a1f7f[_0xeb78('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x3238e9[_0xeb78('0x32')],'resourceId':_0x3238e9['id'],'type':_0x2a1f7f[_0xeb78('0x32')],'sectionId':_0x2a1f7f['id']},{})[_0xeb78('0x2d')](function(){return _0x3c7214;});}else{return _0x3c7214;}})[_0xeb78('0x48')](function(_0x480093){logger[_0xeb78('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x480093);throw _0x480093;});}return _0x3c7214;})[_0xeb78('0x2d')](respondWithResult(_0x4e3f1a,null))[_0xeb78('0x48')](handleError(_0x4e3f1a,null));};function Extension(_0x1d4761,_0x5b4998,_0x363cec,_0x37649c){this['context']='from-sip';this[_0xeb78('0x58')]=_0x1d4761;this[_0xeb78('0x59')]=_0x363cec;this['type']=_0xeb78('0x5a');this[_0xeb78('0x5b')]='Voice\x20Prefix\x20Extension';this['priority']=_0x5b4998;this[_0xeb78('0x5c')]=_0x37649c;}function createVoicePrefixExtensions(_0x5baf31,_0x539ad7,_0x2029ea){return new BPromise(function(_0x486899,_0x27b425){var _0x42c249=new Extension(formatPrefixName(_0x5baf31[_0xeb78('0x5d')]),0x1,'NoOp',_0xeb78('0x5e'));_0x42c249[_0xeb78('0x5f')]=_0x5baf31['id'];return db[_0xeb78('0x53')]['create'](_0x42c249,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x4ec4ec){var _0xd61214=_0x4ec4ec[_0xeb78('0x2e')]({'plain':!![]});var _0x45aeaf=_[_0xeb78('0x34')](addVoicePrefixExtensions(_0x5baf31,_0x539ad7),function(_0x50d38d){_0x50d38d[_0xeb78('0x60')]=_0xd61214['id'];_0x50d38d['VoicePrefixId']=_0x5baf31['id'];return _0x50d38d;});return db[_0xeb78('0x53')][_0xeb78('0x61')](_0x45aeaf,{'transaction':_0x2029ea})[_0xeb78('0x2d')](function(_0x442fa7){if(!_0x442fa7){return _0x27b425(_0xeb78('0x62'));}else{return _0x486899(_0x442fa7);}})['catch'](function(_0x2ffe3b){return _0x27b425(_0x2ffe3b);});});;});};function addVoicePrefixExtensions(_0x2bf5a8,_0xf7eebe){var _0x22aa3a=[];var _0x3eb9c5=formatPrefixName(_0x2bf5a8[_0xeb78('0x5d')]);_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x2,_0xeb78('0x64'),_0xeb78('0x65')+_0x2bf5a8[_0xeb78('0x32')]));if(_0x2bf5a8[_0xeb78('0x66')]){_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,_0xeb78('0x64'),_0xeb78('0x67')+_0x2bf5a8[_0xeb78('0x66')]));}else{_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x3,'NoOp',_0xeb78('0x68')));}_0x22aa3a[_0xeb78('0x63')](new Extension(_0x3eb9c5,0x4,_0xeb78('0x69'),_0xf7eebe['context']+','+_0xeb78('0x6a')+(0x8+_0x2bf5a8[_0xeb78('0x32')][_0xeb78('0x4c')])+'}'+','+0x1));return _0x22aa3a;}function formatPrefixName(_0x2208c2){var _0xe88f54='_';for(var _0x2d6f67=0x0;_0x2d6f67<_0x2208c2[_0xeb78('0x4c')];_0x2d6f67++){if(_0x2208c2[_0xeb78('0x6b')](_0x2d6f67)=='-'){_0xe88f54+=_0x2208c2[_0xeb78('0x6b')](_0x2d6f67);}else{_0xe88f54+='['+_0x2208c2['charAt'](_0x2d6f67)+']';}}_0xe88f54+='.';return _0xe88f54;}exports['update']=function(_0x2bf610,_0x129e0e,_0x44a2c8){var _0x30c186=_0x2bf610[_0xeb78('0x52')];_0x30c186[_0xeb78('0x5d')]=_0xeb78('0x6c')+_0x30c186[_0xeb78('0x32')]+'-';return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x5c27de){return db[_0xeb78('0x35')][_0xeb78('0x2c')](_0x30c186,{'where':{'id':_0x30c186['id']},'transaction':_0x5c27de})[_0xeb78('0x2d')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x30c186['id']},'transaction':_0x5c27de})['then'](function(){return db['VoiceExtension'][_0xeb78('0x4e')]({'where':{'id':_0x30c186[_0xeb78('0x60')]},'raw':!![]})[_0xeb78('0x2d')](function(_0xf89f26){return createVoicePrefixExtensions(_0x30c186,_0xf89f26,_0x5c27de);});});});})[_0xeb78('0x2d')](function(){return db[_0xeb78('0x35')][_0xeb78('0x6d')](_0x30c186['id']);})[_0xeb78('0x2d')](respondWithResult(_0x129e0e,null))[_0xeb78('0x48')](handleError(_0x129e0e,null));};exports[_0xeb78('0x6e')]=function(_0x259525,_0x53cf73,_0x42cfd1){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x259525['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x53cf73,null))[_0xeb78('0x2d')](function(_0x2a9d4d){if(_0x2a9d4d){return _0x2a9d4d[_0xeb78('0x6e')](_0x259525[_0xeb78('0x52')]['ids'],_[_0xeb78('0x6f')](_0x259525[_0xeb78('0x52')],[_0xeb78('0x70'),'id'])||{})[_0xeb78('0x71')](function(_0x3896a1){for(var _0x2da098=0x0;_0x2da098<_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0xeb78('0x4c')];_0x2da098+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x259525[_0xeb78('0x52')][_0xeb78('0x70')][_0x2da098]),'VoicePrefixId':Number(_0x259525[_0xeb78('0x49')]['id'])});}return _0x3896a1;});}})[_0xeb78('0x2d')](respondWithResult(_0x53cf73,null))[_0xeb78('0x48')](handleError(_0x53cf73,null));};exports[_0xeb78('0x73')]=function(_0x37217c,_0x5dbfef,_0x37a587){return db['VoicePrefix'][_0xeb78('0x4e')]({'where':{'id':_0x37217c[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x5dbfef,null))['then'](function(_0x1732e5){if(_0x1732e5){return _0x1732e5[_0xeb78('0x73')](_0x37217c['query'][_0xeb78('0x70')])[_0xeb78('0x2d')](function(){if(_['isArray'](_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')])){for(var _0x1f000b=0x0;_0x1f000b<_0x37217c['query'][_0xeb78('0x70')][_0xeb78('0x4c')];_0x1f000b+=0x1){socket[_0xeb78('0x72')]('userVoicePrefix:remove',{'UserId':Number(_0x37217c[_0xeb78('0x39')][_0xeb78('0x70')][_0x1f000b]),'VoicePrefixId':Number(_0x37217c['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x37217c['query'][_0xeb78('0x70')]),'VoicePrefixId':Number(_0x37217c[_0xeb78('0x49')]['id'])});}});}})[_0xeb78('0x2d')](respondWithStatusCode(_0x5dbfef,null))[_0xeb78('0x48')](handleError(_0x5dbfef,null));};exports[_0xeb78('0x74')]=function(_0x468483,_0x7fc774,_0x34a1f3){var _0x3232a8={};var _0xd3ed51={};var _0x3386f3;var _0x21e3ac;return db[_0xeb78('0x35')]['findOne']({'where':{'id':_0x468483['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x7fc774,null))[_0xeb78('0x2d')](function(_0x39f1cc){if(_0x39f1cc){_0x3386f3=_0x39f1cc;_0xd3ed51[_0xeb78('0x38')]=_[_0xeb78('0x4a')](db[_0xeb78('0x75')]['rawAttributes']);_0xd3ed51[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x468483['query']);_0xd3ed51[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],_0xd3ed51[_0xeb78('0x39')]);_0x3232a8[_0xeb78('0x3c')]=_[_0xeb78('0x3b')](_0xd3ed51[_0xeb78('0x38')],qs['fields'](_0x468483[_0xeb78('0x39')]['fields']));_0x3232a8[_0xeb78('0x3c')]=_0x3232a8[_0xeb78('0x3c')][_0xeb78('0x4c')]?_0x3232a8[_0xeb78('0x3c')]:_0xd3ed51['model'];_0x3232a8[_0xeb78('0x40')]=qs['sort'](_0x468483['query'][_0xeb78('0x41')]);_0x3232a8[_0xeb78('0x42')]=qs[_0xeb78('0x3a')](_[_0xeb78('0x76')](_0x468483[_0xeb78('0x39')],_0xd3ed51[_0xeb78('0x3a')]));if(_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]){_0x3232a8[_0xeb78('0x42')]=_['merge'](_0x3232a8['where'],{'$or':_[_0xeb78('0x34')](_0x3232a8[_0xeb78('0x3c')],function(_0x2ea1fe){var _0x49936c={};_0x49936c[_0x2ea1fe]={'$like':'%'+_0x468483[_0xeb78('0x39')][_0xeb78('0x43')]+'%'};return _0x49936c;})});}_0x3232a8=_[_0xeb78('0x77')]({},_0x3232a8,_0x468483[_0xeb78('0x45')]);return _0x3386f3['getAgents'](_0x3232a8);}})['then'](function(_0x493f82){if(_0x493f82){_0x21e3ac=_0x493f82['length'];if(!_0x468483[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x3232a8[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x468483[_0xeb78('0x39')]['limit']);_0x3232a8[_0xeb78('0x24')]=qs[_0xeb78('0x24')](_0x468483[_0xeb78('0x39')][_0xeb78('0x24')]);}return _0x3386f3[_0xeb78('0x74')](_0x3232a8);}})[_0xeb78('0x2d')](function(_0x51a349){if(_0x51a349){return _0x51a349?{'count':_0x21e3ac,'rows':_0x51a349}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x7fc774,null))['catch'](handleError(_0x7fc774,null));};exports[_0xeb78('0x78')]=function(_0x506734,_0x30eb7c,_0x43637d){var _0x1ad737={};var _0x25cb1c={};var _0x335008;var _0x5d6506;return db[_0xeb78('0x35')][_0xeb78('0x79')]({'where':{'id':_0x506734['params']['id']}})[_0xeb78('0x2d')](handleEntityNotFound(_0x30eb7c,null))['then'](function(_0x2e9eb9){if(_0x2e9eb9){_0x335008=_0x2e9eb9;_0x25cb1c['model']=_[_0xeb78('0x4a')](db[_0xeb78('0x7a')][_0xeb78('0x4b')]);_0x25cb1c[_0xeb78('0x39')]=_[_0xeb78('0x4a')](_0x506734[_0xeb78('0x39')]);_0x25cb1c[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x25cb1c['model'],_0x25cb1c[_0xeb78('0x39')]);_0x1ad737[_0xeb78('0x3c')]=_['intersection'](_0x25cb1c[_0xeb78('0x38')],qs[_0xeb78('0x3d')](_0x506734[_0xeb78('0x39')][_0xeb78('0x3d')]));_0x1ad737[_0xeb78('0x3c')]=_0x1ad737['attributes'][_0xeb78('0x4c')]?_0x1ad737[_0xeb78('0x3c')]:_0x25cb1c['model'];_0x1ad737[_0xeb78('0x40')]=qs[_0xeb78('0x41')](_0x506734['query'][_0xeb78('0x41')]);_0x1ad737[_0xeb78('0x42')]=qs['filters'](_[_0xeb78('0x76')](_0x506734['query'],_0x25cb1c['filters']));if(_0x506734[_0xeb78('0x39')][_0xeb78('0x43')]){_0x1ad737[_0xeb78('0x42')]=_[_0xeb78('0x77')](_0x1ad737[_0xeb78('0x42')],{'$or':_[_0xeb78('0x34')](_0x1ad737[_0xeb78('0x3c')],function(_0x2da372){var _0x1a929b={};_0x1a929b[_0x2da372]={'$like':'%'+_0x506734[_0xeb78('0x39')]['filter']+'%'};return _0x1a929b;})});}_0x1ad737=_['merge']({},_0x1ad737,_0x506734[_0xeb78('0x45')]);return _0x335008[_0xeb78('0x78')](_0x1ad737);}})[_0xeb78('0x2d')](function(_0x3f99a1){if(_0x3f99a1){_0x5d6506=_0x3f99a1[_0xeb78('0x4c')];if(!_0x506734[_0xeb78('0x39')][_0xeb78('0x3e')](_0xeb78('0x3f'))){_0x1ad737[_0xeb78('0x26')]=qs[_0xeb78('0x26')](_0x506734[_0xeb78('0x39')][_0xeb78('0x26')]);_0x1ad737['offset']=qs['offset'](_0x506734[_0xeb78('0x39')]['offset']);}return _0x335008[_0xeb78('0x78')](_0x1ad737);}})['then'](function(_0x577f5f){if(_0x577f5f){return _0x577f5f?{'count':_0x5d6506,'rows':_0x577f5f}:null;}})[_0xeb78('0x2d')](respondWithResult(_0x30eb7c,null))[_0xeb78('0x48')](handleError(_0x30eb7c,null));};exports[_0xeb78('0x7b')]=function(_0x371c1d,_0x29a90d,_0xb69f0e){var _0x370f7a=_0x371c1d[_0xeb78('0x52')]['ids'];var _0x12773a;return db[_0xeb78('0x7a')]['findAll']({'where':{'id':_0x370f7a},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id',_0xeb78('0x32'),_0xeb78('0x7d'),'voicePause',_0xeb78('0x7e')],'raw':!![]}]})['then'](function(_0x64848b){if(_0x64848b){_0x12773a=_0x64848b;var _0x15b7d3=_[_0xeb78('0x7f')](_0x64848b,function(_0x523dc9){var _0x2401c8=_0x523dc9[_0xeb78('0x2e')]({'plain':!![]});return _0x2401c8[_0xeb78('0x7c')];});return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x371c1d[_0xeb78('0x49')]['id']}})[_0xeb78('0x2d')](function(_0x12b7d7){return db[_0xeb78('0x50')][_0xeb78('0x51')](function(_0x3e7088){return _0x12b7d7[_0xeb78('0x7b')](_0x370f7a,{'transaction':_0x3e7088})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x12773a,function(_0x5b1d20){return db['TeamVoicePrefix'][_0xeb78('0x81')]({'TeamId':_0x5b1d20['id'],'VoicePrefixId':_0x371c1d[_0xeb78('0x49')]['id']},{'transaction':_0x3e7088});});})[_0xeb78('0x2d')](function(){return BPromise[_0xeb78('0x80')](_0x15b7d3,function(_0x4c2c7e){return db[_0xeb78('0x82')]['findOrCreate']({'where':{'UserId':_0x4c2c7e['id'],'VoicePrefixId':_0x371c1d['params']['id']},'transaction':_0x3e7088});});})['then'](function(){_0x15b7d3[_0xeb78('0x83')](function(_0x1f5d36){socket['emit']('userVoicePrefix:save',{'UserId':_0x1f5d36['id'],'VoicePrefixId':_0x12b7d7['id']});});});});});}})['then'](respondWithStatusCode(_0x29a90d,null))[_0xeb78('0x48')](handleError(_0x29a90d,null));};exports[_0xeb78('0x84')]=function(_0x5fb310,_0x5553cf,_0x3d4163){return db[_0xeb78('0x7a')][_0xeb78('0x47')]({'where':{'id':_0x5fb310[_0xeb78('0x39')][_0xeb78('0x70')]},'attributes':['id'],'include':[{'model':db[_0xeb78('0x75')],'as':_0xeb78('0x7c'),'attributes':['id'],'raw':!![]}]})[_0xeb78('0x2d')](handleEntityNotFound(_0x5553cf,null))[_0xeb78('0x2d')](function(_0x502af6){var _0x32f23a=_[_0xeb78('0x34')](_0x502af6,'id');var _0x5a1c25=[];var _0x3e2374=[];var _0x3a80b7=squel[_0xeb78('0x85')]();_0x3a80b7[_0xeb78('0x86')](_0xeb78('0x87'))[_0xeb78('0x88')](_0xeb78('0x89'),'tq')[_0xeb78('0x8a')]('user_has_teams','ut',_0xeb78('0x8b'))[_0xeb78('0x42')](_0xeb78('0x8c'),_0x5fb310['params']['id']);for(var _0x55515a=0x0;_0x55515a<_0x502af6[_0xeb78('0x4c')];_0x55515a+=0x1){let _0x207202=_0x502af6[_0x55515a];for(var _0x5edbef=0x0;_0x5edbef<_0x207202[_0xeb78('0x7c')][_0xeb78('0x4c')];_0x5edbef+=0x1){let _0x55041b=_0x207202[_0xeb78('0x7c')][_0x5edbef];var _0x13d95b=_0x3a80b7['clone']();_0x13d95b[_0xeb78('0x42')](_0xeb78('0x8d'),_0x55041b['id']);_0x3e2374['push'](db[_0xeb78('0x50')][_0xeb78('0x39')](_0x13d95b[_0xeb78('0x8e')](),{'type':db[_0xeb78('0x50')][_0xeb78('0x8f')][_0xeb78('0x90')]})[_0xeb78('0x2d')](function(_0x5df43e){if(_0x5df43e[_0xeb78('0x4c')]===0x1){return _0x55041b['id'];}else{var _0x399b9c=_[_0xeb78('0x91')](_[_0xeb78('0x34')](_0x5df43e,_0xeb78('0x92')),function(_0x4beb24){return _['includes'](_0x32f23a,_0x4beb24);});if(_0x399b9c){return _0x55041b['id'];}}}));}}return BPromise[_0xeb78('0x93')](_0x3e2374)[_0xeb78('0x2d')](function(_0x497b99){_0x5a1c25=_(_0x5a1c25)['union'](_0x497b99)[_0xeb78('0x94')]()[_0xeb78('0x95')]();return db[_0xeb78('0x35')][_0xeb78('0x4e')]({'where':{'id':_0x5fb310[_0xeb78('0x49')]['id']}})['then'](function(_0x326468){return db['sequelize']['transaction'](function(_0x1170d3){return _0x326468['removeTeams'](_0x5fb310[_0xeb78('0x39')]['ids'],{'transaction':_0x1170d3})['then'](function(){if(!_[_0xeb78('0x96')](_0x5a1c25)){return _0x326468[_0xeb78('0x73')](_0x5a1c25,{'transaction':_0x1170d3});}})['then'](function(){_0x5a1c25[_0xeb78('0x83')](function(_0x10f23e){socket['emit'](_0xeb78('0x97'),{'UserId':_0x10f23e,'VoicePrefixId':_0x326468['id']});});});});});});})[_0xeb78('0x2d')](respondWithStatusCode(_0x5553cf,null))[_0xeb78('0x48')](handleError(_0x5553cf,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6c4f81f..eee0431 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 _0x4354=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x12ab4d,_0x3ad65d){var _0x1d21e6=function(_0x13bf4b){while(--_0x13bf4b){_0x12ab4d['push'](_0x12ab4d['shift']());}};_0x1d21e6(++_0x3ad65d);}(_0x4354,0xd5));var _0x4435=function(_0x1e1a30,_0x24fdcc){_0x1e1a30=_0x1e1a30-0x0;var _0x163e9e=_0x4354[_0x1e1a30];return _0x163e9e;};'use strict';var EventEmitter=require(_0x4435('0x0'));var VoicePrefix=require(_0x4435('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4435('0x2'),'afterUpdate':_0x4435('0x3'),'afterDestroy':_0x4435('0x4')};function emitEvent(_0x508904){return function(_0x5ca1cc,_0xa8adab,_0x4449f7){VoicePrefixEvents[_0x4435('0x5')](_0x508904+':'+_0x5ca1cc['id'],_0x5ca1cc);VoicePrefixEvents[_0x4435('0x5')](_0x508904,_0x5ca1cc);_0x4449f7(null);};}for(var e in events){if(events[_0x4435('0x6')](e)){var event=events[e];VoicePrefix[_0x4435('0x7')](e,emitEvent(event));}}module[_0x4435('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa358=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x1414b3,_0x477031){var _0x5761ab=function(_0x4017cd){while(--_0x4017cd){_0x1414b3['push'](_0x1414b3['shift']());}};_0x5761ab(++_0x477031);}(_0xa358,0x133));var _0x8a35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa358[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x8a35('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8a35('0x1')](0x0);var events={'afterCreate':_0x8a35('0x2'),'afterUpdate':_0x8a35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51d552){return function(_0x48080c,_0x4ebc1b,_0x3b5c00){VoicePrefixEvents[_0x8a35('0x4')](_0x51d552+':'+_0x48080c['id'],_0x48080c);VoicePrefixEvents['emit'](_0x51d552,_0x48080c);_0x3b5c00(null);};}for(var e in events){if(events[_0x8a35('0x5')](e)){var event=events[e];VoicePrefix[_0x8a35('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 013aec3..14df299 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 _0x73c1=['./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3e311c,_0x462325){var _0x295852=function(_0x2a37d4){while(--_0x2a37d4){_0x3e311c['push'](_0x3e311c['shift']());}};_0x295852(++_0x462325);}(_0x73c1,0x126));var _0x173c=function(_0x219def,_0x43b89b){_0x219def=_0x219def-0x0;var _0x265f81=_0x73c1[_0x219def];return _0x265f81;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x173c('0x0'))(_0x173c('0x1'));var moment=require(_0x173c('0x2'));var BPromise=require('bluebird');var rp=require(_0x173c('0x3'));var fs=require('fs');var path=require(_0x173c('0x4'));var rimraf=require(_0x173c('0x5'));var config=require('../../config/environment');var attributes=require(_0x173c('0x6'));module[_0x173c('0x7')]=function(_0x390ced,_0x128999){return _0x390ced['define'](_0x173c('0x8'),attributes,{'tableName':_0x173c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66a1=['../../config/environment','./voicePrefix.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xa8347,_0xfaaf22){var _0x5b4401=function(_0x1d6be8){while(--_0x1d6be8){_0xa8347['push'](_0xa8347['shift']());}};_0x5b4401(++_0xfaaf22);}(_0x66a1,0x1c7));var _0x166a=function(_0x2ff6d0,_0x5153dd){_0x2ff6d0=_0x2ff6d0-0x0;var _0xb65808=_0x66a1[_0x2ff6d0];return _0xb65808;};'use strict';var _=require(_0x166a('0x0'));var util=require(_0x166a('0x1'));var logger=require(_0x166a('0x2'))(_0x166a('0x3'));var moment=require('moment');var BPromise=require(_0x166a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x166a('0x5'));var rimraf=require(_0x166a('0x6'));var config=require(_0x166a('0x7'));var attributes=require(_0x166a('0x8'));module[_0x166a('0x9')]=function(_0x4a8009,_0x102b00){return _0x4a8009[_0x166a('0xa')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index e76a259..1851361 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 _0x4dcb=['request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x586459,_0x2e107b){var _0x4381c2=function(_0xd0fd3b){while(--_0xd0fd3b){_0x586459['push'](_0x586459['shift']());}};_0x4381c2(++_0x2e107b);}(_0x4dcb,0x186));var _0xb4dc=function(_0x18f509,_0x3ca231){_0x18f509=_0x18f509-0x0;var _0x55c15a=_0x4dcb[_0x18f509];return _0x55c15a;};'use strict';var _=require('lodash');var util=require(_0xb4dc('0x0'));var moment=require(_0xb4dc('0x1'));var BPromise=require(_0xb4dc('0x2'));var rs=require(_0xb4dc('0x3'));var fs=require('fs');var Redis=require(_0xb4dc('0x4'));var db=require(_0xb4dc('0x5'))['db'];var utils=require(_0xb4dc('0x6'));var logger=require(_0xb4dc('0x7'))(_0xb4dc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb4dc('0x9')]['http']({'port':0x232a});config[_0xb4dc('0xa')]=_[_0xb4dc('0xb')](config[_0xb4dc('0xa')],{'host':_0xb4dc('0xc'),'port':0x18eb});var socket=require(_0xb4dc('0xd'))(new Redis(config[_0xb4dc('0xa')]));require('./voicePrefix.socket')[_0xb4dc('0xe')](socket);function respondWithRpcPromise(_0x43e354,_0x9b7f60,_0x1a1872){return new BPromise(function(_0x3fd9ec,_0x27a1bb){return client[_0xb4dc('0xf')](_0x43e354,_0x1a1872)[_0xb4dc('0x10')](function(_0x2746b0){logger[_0xb4dc('0x11')](_0xb4dc('0x12'),_0x9b7f60,_0xb4dc('0x13'));logger[_0xb4dc('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x9b7f60,_0xb4dc('0x13'),JSON[_0xb4dc('0x15')](_0x2746b0));if(_0x2746b0[_0xb4dc('0x16')]){if(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x17')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x9b7f60,_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);return _0x27a1bb(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);}logger[_0xb4dc('0x16')](_0xb4dc('0x12'),_0x9b7f60,_0x2746b0['error']['message']);return _0x3fd9ec(_0x2746b0[_0xb4dc('0x16')][_0xb4dc('0x18')]);}else{logger[_0xb4dc('0x11')](_0xb4dc('0x12'),_0x9b7f60,_0xb4dc('0x13'));_0x3fd9ec(_0x2746b0[_0xb4dc('0x19')][_0xb4dc('0x18')]);}})[_0xb4dc('0x1a')](function(_0x2040cb){logger[_0xb4dc('0x16')](_0xb4dc('0x12'),_0x9b7f60,_0x2040cb);_0x27a1bb(_0x2040cb);});});} \ No newline at end of file +var _0x229c=['util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x229c,0xcf));var _0xc229=function(_0x39e0c7,_0x5970c8){_0x39e0c7=_0x39e0c7-0x0;var _0x215cd9=_0x229c[_0x39e0c7];return _0x215cd9;};'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});config['redis']=_[_0xc229('0x7')](config[_0xc229('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc229('0x9'))(new Redis(config[_0xc229('0x8')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x1dc38f,_0x5a5d9b,_0x4abe4c){return new BPromise(function(_0x36263a,_0x1434a3){return client[_0xc229('0xa')](_0x1dc38f,_0x4abe4c)[_0xc229('0xb')](function(_0x25fd05){logger[_0xc229('0xc')](_0xc229('0xd'),_0x5a5d9b,_0xc229('0xe'));logger[_0xc229('0xf')](_0xc229('0x10'),_0x5a5d9b,_0xc229('0xe'),JSON[_0xc229('0x11')](_0x25fd05));if(_0x25fd05[_0xc229('0x12')]){if(_0x25fd05['error'][_0xc229('0x13')]===0x1f4){logger['error'](_0xc229('0xd'),_0x5a5d9b,_0x25fd05[_0xc229('0x12')][_0xc229('0x14')]);return _0x1434a3(_0x25fd05[_0xc229('0x12')][_0xc229('0x14')]);}logger[_0xc229('0x12')](_0xc229('0xd'),_0x5a5d9b,_0x25fd05[_0xc229('0x12')][_0xc229('0x14')]);return _0x36263a(_0x25fd05[_0xc229('0x12')][_0xc229('0x14')]);}else{logger[_0xc229('0xc')](_0xc229('0xd'),_0x5a5d9b,'request\x20sent');_0x36263a(_0x25fd05[_0xc229('0x15')][_0xc229('0x14')]);}})[_0xc229('0x16')](function(_0x193c75){logger[_0xc229('0x12')](_0xc229('0xd'),_0x5a5d9b,_0x193c75);_0x1434a3(_0x193c75);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 0084b35..718ca41 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 _0x94dc=['register','voicePrefix:','./voicePrefix.events','remove','removeListener'];(function(_0x1181d8,_0x49abfb){var _0x407233=function(_0x5eea5d){while(--_0x5eea5d){_0x1181d8['push'](_0x1181d8['shift']());}};_0x407233(++_0x49abfb);}(_0x94dc,0xb1));var _0xc94d=function(_0x5ac272,_0x2b8183){_0x5ac272=_0x5ac272-0x0;var _0x555a17=_0x94dc[_0x5ac272];return _0x555a17;};'use strict';var VoicePrefixEvents=require(_0xc94d('0x0'));var events=['save',_0xc94d('0x1'),'update'];function createListener(_0x1645b0,_0x1b2070){return function(_0x40e7d8){_0x1b2070['emit'](_0x1645b0,_0x40e7d8);};}function removeListener(_0x306706,_0x41d4ec){return function(){VoicePrefixEvents[_0xc94d('0x2')](_0x306706,_0x41d4ec);};}exports[_0xc94d('0x3')]=function(_0x3c0601){for(var _0x344188=0x0,_0xb7275c=events['length'];_0x344188<_0xb7275c;_0x344188++){var _0x2f9757=events[_0x344188];var _0xbe5904=createListener(_0xc94d('0x4')+_0x2f9757,_0x3c0601);VoicePrefixEvents['on'](_0x2f9757,_0xbe5904);}}; \ No newline at end of file +var _0xd87e=['save','update','emit','removeListener','length','voicePrefix:','./voicePrefix.events'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0xd87e,0x1bf));var _0xed87=function(_0x5366e7,_0x1b8be9){_0x5366e7=_0x5366e7-0x0;var _0x1b7106=_0xd87e[_0x5366e7];return _0x1b7106;};'use strict';var VoicePrefixEvents=require(_0xed87('0x0'));var events=[_0xed87('0x1'),'remove',_0xed87('0x2')];function createListener(_0x189fdd,_0x16509b){return function(_0x5901be){_0x16509b[_0xed87('0x3')](_0x189fdd,_0x5901be);};}function removeListener(_0x5e960f,_0x11a5d9){return function(){VoicePrefixEvents[_0xed87('0x4')](_0x5e960f,_0x11a5d9);};}exports['register']=function(_0x17adfe){for(var _0x589fb9=0x0,_0x5da793=events[_0xed87('0x5')];_0x589fb9<_0x5da793;_0x589fb9++){var _0x42fef6=events[_0x589fb9];var _0x33e1c1=createListener(_0xed87('0x6')+_0x42fef6,_0x17adfe);VoicePrefixEvents['on'](_0x42fef6,_0x33e1c1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9b573cc..6205f55 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(_0xb06221,_0x3b47da){var _0x542c06=function(_0x5cd5ff){while(--_0x5cd5ff){_0xb06221['push'](_0xb06221['shift']());}};_0x542c06(++_0x3b47da);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x23d494,_0x545dd9){var _0x7c8b34=function(_0x3333a4){while(--_0x3333a4){_0x23d494['push'](_0x23d494['shift']());}};_0x7c8b34(++_0x545dd9);}(_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/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 314d0a9..3cbe1a0 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 _0x95fe=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','rrmemory','rrordered','strategy','getDataValue','type','dialMethod','booked','progressive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','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\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0x95fe,0x15e));var _0xe95f=function(_0x556b1d,_0xa0f67e){_0x556b1d=_0x556b1d-0x0;var _0x346381=_0x95fe[_0x556b1d];return _0x346381;};'use strict';var Sequelize=require(_0xe95f('0x0'));module[_0xe95f('0x1')]={'name':{'type':Sequelize[_0xe95f('0x2')],'allowNull':![],'unique':_0xe95f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x5'),_0xe95f('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x7')},'announce':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe95f('0x4')]('rr','ringall',_0xe95f('0x8'),_0xe95f('0x9'),'random',_0xe95f('0xa'),'linear','wrandom',_0xe95f('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x330c60){this['setDataValue'](_0xe95f('0xc'),_0x330c60?_0x330c60:_0xe95f('0xa'));},'get':function(){var _0x5e9874=this[_0xe95f('0xd')](_0xe95f('0xe'));var _0x18f9e=this[_0xe95f('0xd')](_0xe95f('0xf'));var _0x23586d=this['getDataValue'](_0xe95f('0xc'));if(_0x5e9874===_0xe95f('0x5')){return _0x23586d;}if(_0x18f9e===_0xe95f('0x10')&&_0x23586d===_0xe95f('0xa')||_0x18f9e===_0xe95f('0x10')&&_0x23586d==='roundrobin'){return _0x23586d;}if(_0x18f9e===_0xe95f('0x11')||_0x18f9e==='predictive'||_0x18f9e===_0xe95f('0x12')){return _0x23586d;}return null;}},'servicelevel':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe95f('0x13')](0xb)},'timeout':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe95f('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no',_0xe95f('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xe95f('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe95f('0x4')]('yes','no'),'defaultValue':_0xe95f('0x14')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xe95f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xe95f('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe95f('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe95f('0x2')]},'queue_youarenext':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe95f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe95f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xe95f('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xe95f('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe95f('0x17')],'set':function(_0x152d1b){this[_0xe95f('0x18')](_0xe95f('0x19'),_0x152d1b?_0x152d1b[_0xe95f('0x1a')](','):[]);},'get':function(){return this[_0xe95f('0xd')](_0xe95f('0x19'))?this[_0xe95f('0xd')]('periodic_announce')[_0xe95f('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'yes','set':function(_0x118407){this[_0xe95f('0x18')]('joinempty',_0x118407?_0x118407['join'](','):undefined);},'get':function(){return this['getDataValue'](_0xe95f('0x1c'))?this[_0xe95f('0xd')]('joinempty')[_0xe95f('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':'no','set':function(_0x3429e8){this[_0xe95f('0x18')]('leavewhenempty',_0x3429e8?_0x3429e8[_0xe95f('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xe95f('0x1d'))?this[_0xe95f('0xd')](_0xe95f('0x1d'))[_0xe95f('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe95f('0x2')]},'description':{'type':Sequelize[_0xe95f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x550e02){this[_0xe95f('0x18')](_0xe95f('0x1e'),_0x550e02);if(_0x550e02){if(this['getDataValue'](_0xe95f('0x1f'))<0x2){this[_0xe95f('0x18')](_0xe95f('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe95f('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe95f('0x20')},'dialMethod':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x21'),_0xe95f('0x11'),_0xe95f('0x12'),_0xe95f('0x22'),_0xe95f('0x10')),'defaultValue':_0xe95f('0x11'),'comment':_0xe95f('0x23')},'dialLimitChannel':{'type':Sequelize[_0xe95f('0x13')](0x4)[_0xe95f('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xe95f('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe95f('0x25')},'dialPowerLevel':{'type':Sequelize[_0xe95f('0x26')](0x2)[_0xe95f('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe95f('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe95f('0x28'),'dropRate'),'defaultValue':_0xe95f('0x29'),'comment':_0xe95f('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe95f('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xe95f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x2e')},'dialQueueProject':{'type':Sequelize[_0xe95f('0x2')],'comment':_0xe95f('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'comment':_0xe95f('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe95f('0x34')},'dialTimezone':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':_0xe95f('0x35')},'dialPrefix':{'type':Sequelize[_0xe95f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x36'),_0xe95f('0x37'),_0xe95f('0x38')),'defaultValue':_0xe95f('0x36')},'dialAMDActive':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':0x0,'comment':_0xe95f('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe95f('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe95f('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe95f('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe95f('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe95f('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe95f('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe95f('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe95f('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe95f('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe95f('0x13')](0x9)[_0xe95f('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe95f('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe95f('0x4')](_0xe95f('0x43'),_0xe95f('0x44')),'defaultValue':_0xe95f('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe95f('0x45')},'dialCutDigit':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe95f('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe95f('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe95f('0x13')](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe95f('0x13')](0x3)[_0xe95f('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe95f('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe95f('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xe95f('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![],'comment':_0xe95f('0x4f'),'set':function(_0x34eaaf){if(!_0x34eaaf)this[_0xe95f('0x18')](_0xe95f('0x50'),null);this[_0xe95f('0x18')](_0xe95f('0x51'),_0x34eaaf);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe95f('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe95f('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe95f('0x39')],'defaultValue':![]}}; \ No newline at end of file +var _0x72dc=['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)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','name','inbound','default','ENUM','ringall','leastrecent','random','rrmemory','linear','rrordered','setDataValue','getDataValue','type','dialMethod','strategy','booked','roundrobin','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','Max\x209999\x20channels,\x200\x20means\x20unlimited.','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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x72dc,0xc4));var _0xc72d=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0x72dc[_0x31dde9];return _0x1fbf2d;};'use strict';var Sequelize=require(_0xc72d('0x0'));module[_0xc72d('0x1')]={'name':{'type':Sequelize[_0xc72d('0x2')],'allowNull':![],'unique':_0xc72d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xc72d('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xc72d('0x4')},'musiconhold':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':_0xc72d('0x5')},'announce':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc72d('0x6')]('rr',_0xc72d('0x7'),_0xc72d('0x8'),'fewestcalls',_0xc72d('0x9'),_0xc72d('0xa'),_0xc72d('0xb'),'wrandom',_0xc72d('0xc')),'allowNull':![],'defaultValue':_0xc72d('0x7'),'set':function(_0x5a24af){this[_0xc72d('0xd')]('strategy',_0x5a24af?_0x5a24af:_0xc72d('0xa'));},'get':function(){var _0x4ff9ab=this[_0xc72d('0xe')](_0xc72d('0xf'));var _0x38709f=this[_0xc72d('0xe')](_0xc72d('0x10'));var _0x1d821e=this[_0xc72d('0xe')](_0xc72d('0x11'));if(_0x4ff9ab===_0xc72d('0x4')){return _0x1d821e;}if(_0x38709f==='booked'&&_0x1d821e===_0xc72d('0xa')||_0x38709f===_0xc72d('0x12')&&_0x1d821e===_0xc72d('0x13')){return _0x1d821e;}if(_0x38709f==='progressive'||_0x38709f===_0xc72d('0x14')||_0x38709f===_0xc72d('0x15')){return _0x1d821e;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc72d('0x16')](0xb)},'timeout':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc72d('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no'),'defaultValue':_0xc72d('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc72d('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc72d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc72d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xc72d('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xc72d('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc72d('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc72d('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc72d('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xc72d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xc72d('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc72d('0x19')],'set':function(_0x3dfeda){this[_0xc72d('0xd')](_0xc72d('0x1a'),_0x3dfeda?_0x3dfeda['join'](','):[]);},'get':function(){return this[_0xc72d('0xe')](_0xc72d('0x1a'))?this['getDataValue'](_0xc72d('0x1a'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':'yes','set':function(_0x4af5e6){this[_0xc72d('0xd')](_0xc72d('0x1b'),_0x4af5e6?_0x4af5e6[_0xc72d('0x1c')](','):undefined);},'get':function(){return this[_0xc72d('0xe')]('joinempty')?this['getDataValue'](_0xc72d('0x1b'))[_0xc72d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':'no','set':function(_0x2d90b4){this[_0xc72d('0xd')](_0xc72d('0x1e'),_0x2d90b4?_0x2d90b4[_0xc72d('0x1c')](','):undefined);},'get':function(){return this[_0xc72d('0xe')](_0xc72d('0x1e'))?this[_0xc72d('0xe')](_0xc72d('0x1e'))[_0xc72d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xc72d('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc72d('0x2')]},'description':{'type':Sequelize[_0xc72d('0x2')]},'acw':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':0x0,'set':function(_0x112c49){this[_0xc72d('0xd')](_0xc72d('0x20'),_0x112c49);if(_0x112c49){if(this[_0xc72d('0xe')](_0xc72d('0x21'))<0x2){this['setDataValue'](_0xc72d('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc72d('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x22'),_0xc72d('0x23'),_0xc72d('0x15'),'predictive',_0xc72d('0x12')),'defaultValue':_0xc72d('0x23'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xc72d('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc72d('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xc72d('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc72d('0x26')},'dialPowerLevel':{'type':Sequelize[_0xc72d('0x27')](0x2)[_0xc72d('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc72d('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xc72d('0x29'),_0xc72d('0x2a')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc72d('0x27')](0x2)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc72d('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc72d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc72d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':_0xc72d('0x2d'),'comment':_0xc72d('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc72d('0x2')],'comment':_0xc72d('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x32')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)[_0xc72d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'comment':_0xc72d('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc72d('0x37')},'dialTimezone':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc72d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc72d('0x6')](_0xc72d('0x38'),_0xc72d('0x39'),_0xc72d('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':0x0,'comment':_0xc72d('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc72d('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc72d('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc72d('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc72d('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc72d('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc72d('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc72d('0x16')](0x5)[_0xc72d('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc72d('0x16')](0x9)[_0xc72d('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc72d('0x42')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xc72d('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc72d('0x43')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc72d('0x44')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc72d('0x6')]('DESC',_0xc72d('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xc72d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc72d('0x46')},'dialCutDigit':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc72d('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)[_0xc72d('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc72d('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc72d('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc72d('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xc72d('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x53c0af){if(!_0x53c0af)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xc72d('0xd')](_0xc72d('0x50'),_0x53c0af);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc72d('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc72d('0x16')](0x3)[_0xc72d('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc72d('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4b97870..9214197 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 _0xf1c6=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','include','omit','updatedAt','body','createdAt','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','nolimit','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','SIP/%s','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','isEmpty','upsert','format','all','getAgents','getMembers','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./voiceQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','UserProfileResource','then','error','stack','send','index','fieldName','key'];(function(_0x503048,_0x30af72){var _0x3eeb5b=function(_0xae09ae){while(--_0xae09ae){_0x503048['push'](_0x503048['shift']());}};_0x3eeb5b(++_0x30af72);}(_0xf1c6,0x145));var _0x6f1c=function(_0x5395fe,_0x887fa4){_0x5395fe=_0x5395fe-0x0;var _0x4bab55=_0xf1c6[_0x5395fe];return _0x4bab55;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){var _0x59931c=_0x3c0dd1['get']({'plain':!![]});var _0x500e36=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25'),'ignore':![]},{'name':_0x6f1c('0x26'),'value':_0x6f1c('0x27'),'ignore':![]}];var _0x29b952=_(_0x500e36)[_0x6f1c('0x28')](_0x6f1c('0x29'))[_0x6f1c('0x2a')](_0x6f1c('0x2b'))[_0x6f1c('0x2b')]();if(_[_0x6f1c('0x2c')](_0x29b952,_0x59931c[_0x6f1c('0x2d')])){return;}var _0x4ca3cc=_['find'](_0x500e36,[_0x6f1c('0x2b'),_0x59931c[_0x6f1c('0x2d')]])[_0x6f1c('0x2e')];return db[_0x6f1c('0x2f')][_0x6f1c('0x23')]({'where':{'type':_0x4ca3cc,'resourceId':_0x59931c['id']}})['then'](function(){return _0x3c0dd1;});})[_0x6f1c('0x30')](function(){_0x2b29af['status'](0xcc)[_0x6f1c('0x16')]();});}};}function handleEntityNotFound(_0x48c5f4,_0x23b575){return function(_0x16045d){if(!_0x16045d){_0x48c5f4[_0x6f1c('0x15')](0x194);}return _0x16045d;};}function handleError(_0x14d3cf,_0x2c7bad){_0x2c7bad=_0x2c7bad||0x1f4;return function(_0x1c8619){logger[_0x6f1c('0x31')](_0x1c8619[_0x6f1c('0x32')]);if(_0x1c8619[_0x6f1c('0x2e')]){delete _0x1c8619[_0x6f1c('0x2e')];}_0x14d3cf['status'](_0x2c7bad)[_0x6f1c('0x33')](_0x1c8619);};}exports[_0x6f1c('0x34')]=function(_0x1e5e4f,_0x5d7a33){var _0x317df4={},_0x1609e3={},_0x454507={'count':0x0,'rows':[]};var _0x326f85=_[_0x6f1c('0x2a')](db['VoiceQueue']['rawAttributes'],function(_0x4aa4af){return{'name':_0x4aa4af[_0x6f1c('0x35')],'type':_0x4aa4af[_0x6f1c('0x2d')][_0x6f1c('0x36')]};});_0x1609e3[_0x6f1c('0x37')]=_[_0x6f1c('0x2a')](_0x326f85,_0x6f1c('0x2e'));_0x1609e3[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x1e5e4f[_0x6f1c('0x38')]);_0x1609e3[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x1609e3[_0x6f1c('0x37')],_0x1609e3[_0x6f1c('0x38')]);_0x317df4[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1609e3['model'],qs['fields'](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x317df4[_0x6f1c('0x3c')]=_0x317df4[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x317df4[_0x6f1c('0x3c')]:_0x1609e3[_0x6f1c('0x37')];if(!_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0x317df4[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x317df4['offset']=qs[_0x6f1c('0x19')](_0x1e5e4f['query'][_0x6f1c('0x19')]);}_0x317df4[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x317df4[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x1e5e4f[_0x6f1c('0x38')],_0x1609e3[_0x6f1c('0x3a')]),_0x326f85);if(_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x317df4['where']=_[_0x6f1c('0x44')](_0x317df4[_0x6f1c('0x42')],{'$or':_['map'](_0x326f85,function(_0x30b5d0){if(_0x30b5d0[_0x6f1c('0x2d')]!==_0x6f1c('0x45')){var _0x682523={};_0x682523[_0x30b5d0[_0x6f1c('0x2e')]]={'$like':'%'+_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x682523;}})});}_0x317df4=_['merge']({},_0x317df4,_0x1e5e4f[_0x6f1c('0x46')]);var _0x486bd5={'where':_0x317df4[_0x6f1c('0x42')]};return db[_0x6f1c('0x47')][_0x6f1c('0x1c')](_0x486bd5)[_0x6f1c('0x30')](function(_0x200596){_0x454507['count']=_0x200596;if(_0x1e5e4f[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0x317df4['include']=[{'all':!![]}];}return db[_0x6f1c('0x47')][_0x6f1c('0x49')](_0x317df4);})[_0x6f1c('0x30')](function(_0x491fdd){_0x454507[_0x6f1c('0x4a')]=_0x491fdd;return _0x454507;})[_0x6f1c('0x30')](respondWithFilteredResult(_0x5d7a33,_0x317df4))[_0x6f1c('0x4b')](handleError(_0x5d7a33,null));};exports[_0x6f1c('0x4c')]=function(_0x18d103,_0x4453b0){var _0x434274={'raw':![],'where':{'id':_0x18d103['params']['id']}},_0x2f8841={};_0x2f8841[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x47')]['rawAttributes']);_0x2f8841[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x18d103[_0x6f1c('0x38')]);_0x2f8841['filters']=_[_0x6f1c('0x3b')](_0x2f8841[_0x6f1c('0x37')],_0x2f8841[_0x6f1c('0x38')]);_0x434274[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x2f8841[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x18d103[_0x6f1c('0x38')]['fields']));_0x434274[_0x6f1c('0x3c')]=_0x434274[_0x6f1c('0x3c')]['length']?_0x434274[_0x6f1c('0x3c')]:_0x2f8841[_0x6f1c('0x37')];if(_0x18d103['query']['includeAll']){_0x434274['include']=[{'all':!![]}];}_0x434274=_[_0x6f1c('0x44')]({},_0x434274,_0x18d103['options']);return db['VoiceQueue'][_0x6f1c('0x4d')](_0x434274)[_0x6f1c('0x30')](handleEntityNotFound(_0x4453b0,null))['then'](respondWithResult(_0x4453b0,null))[_0x6f1c('0x4b')](handleError(_0x4453b0,null));};exports[_0x6f1c('0x4e')]=function(_0x39b67c,_0x4f7fb1){return db[_0x6f1c('0x47')][_0x6f1c('0x4e')](_0x39b67c['body'],{})[_0x6f1c('0x30')](function(_0x4efe57){var _0x410903=_0x39b67c[_0x6f1c('0x4f')][_0x6f1c('0x50')]({'plain':!![]});if(!_0x410903)throw new Error(_0x6f1c('0x51'));if(_0x410903[_0x6f1c('0x52')]===_0x6f1c('0x4f')){var _0x480934=_0x4efe57['get']({'plain':!![]});var _0x4fe6e3=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25')},{'name':'QueueCampaigns','value':_0x6f1c('0x27')}];var _0x5052b8=_[_0x6f1c('0x4d')](_0x4fe6e3,['value',_0x480934[_0x6f1c('0x2d')]])[_0x6f1c('0x2e')];return db[_0x6f1c('0x53')][_0x6f1c('0x4d')]({'where':{'name':_0x5052b8,'userProfileId':_0x410903[_0x6f1c('0x54')]},'raw':!![]})[_0x6f1c('0x30')](function(_0x1f51b4){if(_0x1f51b4&&_0x1f51b4[_0x6f1c('0x55')]===0x0){return db[_0x6f1c('0x2f')][_0x6f1c('0x4e')]({'name':_0x480934[_0x6f1c('0x2e')],'resourceId':_0x480934['id'],'type':_0x1f51b4['name'],'sectionId':_0x1f51b4['id']},{})[_0x6f1c('0x30')](function(){return _0x4efe57;});}else{return _0x4efe57;}})['catch'](function(_0x761896){logger['error'](_0x6f1c('0x56'),_0x761896);throw _0x761896;});}return _0x4efe57;})[_0x6f1c('0x30')](respondWithResult(_0x4f7fb1,0xc9))['catch'](handleError(_0x4f7fb1,null));};exports[_0x6f1c('0x57')]=function(_0x197b3d,_0x4a236f){var _0x4c1c7e={'where':{'id':_0x197b3d[_0x6f1c('0x58')]['id']}},_0x1ba3e8={};_0x1ba3e8[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x47')][_0x6f1c('0x59')]);_0x4c1c7e[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1ba3e8[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x197b3d['query'][_0x6f1c('0x3d')]));_0x4c1c7e[_0x6f1c('0x3c')]=_0x4c1c7e['attributes']['length']?_0x4c1c7e[_0x6f1c('0x3c')]:_0x1ba3e8[_0x6f1c('0x37')];if(_0x197b3d['query'][_0x6f1c('0x48')]){_0x4c1c7e[_0x6f1c('0x5a')]=[{'all':!![]}];}_0x4c1c7e=_[_0x6f1c('0x44')]({},_0x4c1c7e,_0x197b3d[_0x6f1c('0x46')]);return db[_0x6f1c('0x47')][_0x6f1c('0x4d')](_0x4c1c7e)[_0x6f1c('0x30')](handleEntityNotFound(_0x4a236f,null))['then'](function(_0xc11cdf){if(_0xc11cdf){var _0x233e42=_0xc11cdf['get']({'plain':!![]});_0x233e42=qs[_0x6f1c('0x5b')](_0x233e42,['id','createdAt',_0x6f1c('0x5c')]);_0x197b3d[_0x6f1c('0x5d')]=_['omit'](_0x197b3d[_0x6f1c('0x5d')],['id',_0x6f1c('0x5e'),_0x6f1c('0x5c')]);return db['VoiceQueue'][_0x6f1c('0x4e')](_[_0x6f1c('0x44')](_0x233e42,_0x197b3d[_0x6f1c('0x5d')]),{'include':_0x197b3d[_0x6f1c('0x38')][_0x6f1c('0x48')]?[{'all':!![]}]:undefined})[_0x6f1c('0x30')](function(_0xb34928){var _0x51ae01=_0x197b3d[_0x6f1c('0x4f')][_0x6f1c('0x50')]({'plain':!![]});if(!_0x51ae01)throw new Error(_0x6f1c('0x51'));if(_0x51ae01['role']===_0x6f1c('0x4f')){var _0x2c50ab=_0xb34928['get']({'plain':!![]});var _0x753f9f=[{'name':_0x6f1c('0x24'),'value':_0x6f1c('0x25')},{'name':_0x6f1c('0x26'),'value':_0x6f1c('0x27')}];var _0x4bd3e3=_['find'](_0x753f9f,[_0x6f1c('0x2b'),_0x2c50ab['type']])['name'];return db[_0x6f1c('0x53')]['find']({'where':{'name':_0x4bd3e3,'userProfileId':_0x51ae01[_0x6f1c('0x54')]},'raw':!![]})[_0x6f1c('0x30')](function(_0x34395b){if(_0x34395b&&_0x34395b[_0x6f1c('0x55')]===0x0){return db[_0x6f1c('0x2f')][_0x6f1c('0x4e')]({'name':_0x2c50ab[_0x6f1c('0x2e')],'resourceId':_0x2c50ab['id'],'type':_0x34395b[_0x6f1c('0x2e')],'sectionId':_0x34395b['id']},{})[_0x6f1c('0x30')](function(){return _0xb34928;});}else{return _0xb34928;}})[_0x6f1c('0x4b')](function(_0x5d1416){logger[_0x6f1c('0x31')](_0x6f1c('0x56'),_0x5d1416);throw _0x5d1416;});}return _0xb34928;});}})[_0x6f1c('0x30')](respondWithResult(_0x4a236f,0xc9))['catch'](handleError(_0x4a236f,null));};exports[_0x6f1c('0x22')]=function(_0x2427c5,_0x112865){if(_0x2427c5[_0x6f1c('0x5d')]['id']){delete _0x2427c5[_0x6f1c('0x5d')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2427c5['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x112865,null))['then'](saveUpdates(_0x2427c5[_0x6f1c('0x5d')],null))[_0x6f1c('0x30')](respondWithResult(_0x112865,null))[_0x6f1c('0x4b')](handleError(_0x112865,null));};exports[_0x6f1c('0x23')]=function(_0x4805c9,_0x2cfae1){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x4805c9['params']['id']}})['then'](handleEntityNotFound(_0x2cfae1,null))[_0x6f1c('0x30')](removeEntity(_0x2cfae1,null))['catch'](handleError(_0x2cfae1,null));};exports[_0x6f1c('0x5f')]=function(_0x1d05bb,_0x46bf09,_0x114299){var _0x3034fe={'raw':![],'where':{}};var _0x92cb8c={};var _0x115c7b={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x1d05bb[_0x6f1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x46bf09,null))['then'](function(_0x16b758){if(_0x16b758){_0x92cb8c[_0x6f1c('0x37')]=_['keys'](db['CmHopper'][_0x6f1c('0x59')]);_0x92cb8c[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x1d05bb[_0x6f1c('0x38')]);_0x92cb8c[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x92cb8c[_0x6f1c('0x37')],_0x92cb8c[_0x6f1c('0x38')]);_0x3034fe[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x92cb8c[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x1d05bb['query'][_0x6f1c('0x3d')]));_0x3034fe[_0x6f1c('0x3c')]=_0x3034fe[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x3034fe[_0x6f1c('0x3c')]:_0x92cb8c['model'];if(!_0x1d05bb[_0x6f1c('0x38')]['hasOwnProperty']('nolimit')){_0x3034fe[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x1d05bb[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x3034fe[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x1d05bb[_0x6f1c('0x38')]['offset']);}_0x3034fe[_0x6f1c('0x40')]=qs['sort'](_0x1d05bb[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x3034fe['where']=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x1d05bb[_0x6f1c('0x38')],_0x92cb8c[_0x6f1c('0x3a')]));_0x3034fe[_0x6f1c('0x42')][_0x6f1c('0x61')]=_0x16b758['id'];if(_0x1d05bb[_0x6f1c('0x38')]['filter']){_0x3034fe[_0x6f1c('0x42')]=_['merge'](_0x3034fe['where'],{'$or':_['map'](_0x3034fe[_0x6f1c('0x3c')],function(_0x49afcd){var _0x287007={};_0x287007[_0x49afcd]={'$like':'%'+_0x1d05bb['query'][_0x6f1c('0x28')]+'%'};return _0x287007;})});}_0x3034fe=_[_0x6f1c('0x44')]({},_0x3034fe,_0x1d05bb[_0x6f1c('0x46')]);return db['CmHopper'][_0x6f1c('0x1c')]({'where':_0x3034fe[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0x4909e9){_0x115c7b[_0x6f1c('0x1c')]=_0x4909e9;if(_0x1d05bb['query'][_0x6f1c('0x48')]){_0x3034fe['include']=[{'all':!![]}];}return db[_0x6f1c('0x62')][_0x6f1c('0x49')](_0x3034fe);})[_0x6f1c('0x30')](function(_0x2c21f9){_0x115c7b[_0x6f1c('0x4a')]=_0x2c21f9;return _0x115c7b;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x46bf09,_0x3034fe))[_0x6f1c('0x4b')](handleError(_0x46bf09,null));};exports[_0x6f1c('0x63')]=function(_0x40f43f,_0x35dec3,_0x427b2b){var _0x342047={'raw':!![],'where':{}};var _0x5898dd={};var _0x55a654={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')]['findOne']({'where':{'id':_0x40f43f['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x35dec3,null))['then'](function(_0x4a449a){if(_0x4a449a){_0x5898dd[_0x6f1c('0x37')]=_['keys'](db[_0x6f1c('0x64')]['rawAttributes']);_0x5898dd[_0x6f1c('0x38')]=_['keys'](_0x40f43f[_0x6f1c('0x38')]);_0x5898dd[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x5898dd['model'],_0x5898dd[_0x6f1c('0x38')]);_0x342047[_0x6f1c('0x3c')]=_['intersection'](_0x5898dd[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x342047[_0x6f1c('0x3c')]=_0x342047[_0x6f1c('0x3c')]['length']?_0x342047[_0x6f1c('0x3c')]:_0x5898dd['model'];if(!_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0x342047['limit']=qs['limit'](_0x40f43f[_0x6f1c('0x38')]['limit']);_0x342047[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x40f43f['query']['offset']);}_0x342047[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x342047['where']=qs[_0x6f1c('0x3a')](_['pick'](_0x40f43f[_0x6f1c('0x38')],_0x5898dd[_0x6f1c('0x3a')]));_0x342047['where']['VoiceQueueId']=_0x4a449a['id'];if(_0x40f43f['query'][_0x6f1c('0x28')]){_0x342047[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x342047['where'],{'$or':_[_0x6f1c('0x2a')](_0x342047['attributes'],function(_0x64cc2e){var _0x513515={};_0x513515[_0x64cc2e]={'$like':'%'+_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x513515;})});}_0x342047=_['merge']({},_0x342047,_0x40f43f[_0x6f1c('0x46')]);return db['CmHopperHistory'][_0x6f1c('0x1c')]({'where':_0x342047['where']})[_0x6f1c('0x30')](function(_0x34a038){_0x55a654['count']=_0x34a038;if(_0x40f43f[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0x342047[_0x6f1c('0x5a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6f1c('0x49')](_0x342047);})[_0x6f1c('0x30')](function(_0x1f8354){_0x55a654[_0x6f1c('0x4a')]=_0x1f8354;return _0x55a654;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x35dec3,_0x342047))['catch'](handleError(_0x35dec3,null));};exports['getHopperFinals']=function(_0x4b5eeb,_0x1496b0,_0x9a7cfc){var _0xbc5e6e={'raw':!![],'where':{}};var _0x428c1f={};var _0x5e6ad2={'count':0x0,'rows':[]};return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x4b5eeb[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1496b0,null))[_0x6f1c('0x30')](function(_0x4384e9){if(_0x4384e9){_0x428c1f['model']=_[_0x6f1c('0x39')](db[_0x6f1c('0x65')]['rawAttributes']);_0x428c1f[_0x6f1c('0x38')]=_['keys'](_0x4b5eeb[_0x6f1c('0x38')]);_0x428c1f['filters']=_[_0x6f1c('0x3b')](_0x428c1f[_0x6f1c('0x37')],_0x428c1f[_0x6f1c('0x38')]);_0xbc5e6e[_0x6f1c('0x3c')]=_['intersection'](_0x428c1f[_0x6f1c('0x37')],qs['fields'](_0x4b5eeb['query'][_0x6f1c('0x3d')]));_0xbc5e6e[_0x6f1c('0x3c')]=_0xbc5e6e[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0xbc5e6e['attributes']:_0x428c1f['model'];if(!_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x3f')]('nolimit')){_0xbc5e6e['limit']=qs[_0x6f1c('0x1b')](_0x4b5eeb[_0x6f1c('0x38')]['limit']);_0xbc5e6e[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x19')]);}_0xbc5e6e['order']=qs[_0x6f1c('0x41')](_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0xbc5e6e['where']=qs['filters'](_[_0x6f1c('0x43')](_0x4b5eeb[_0x6f1c('0x38')],_0x428c1f[_0x6f1c('0x3a')]));_0xbc5e6e['where'][_0x6f1c('0x61')]=_0x4384e9['id'];if(_0x4b5eeb['query'][_0x6f1c('0x28')]){_0xbc5e6e[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0xbc5e6e[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0xbc5e6e[_0x6f1c('0x3c')],function(_0x50b6c3){var _0x50a5f2={};_0x50a5f2[_0x50b6c3]={'$like':'%'+_0x4b5eeb['query'][_0x6f1c('0x28')]+'%'};return _0x50a5f2;})});}_0xbc5e6e=_[_0x6f1c('0x44')]({},_0xbc5e6e,_0x4b5eeb[_0x6f1c('0x46')]);return db[_0x6f1c('0x65')][_0x6f1c('0x1c')]({'where':_0xbc5e6e[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0x58c7b7){_0x5e6ad2['count']=_0x58c7b7;if(_0x4b5eeb[_0x6f1c('0x38')][_0x6f1c('0x48')]){_0xbc5e6e['include']=[{'all':!![]}];}return db[_0x6f1c('0x65')][_0x6f1c('0x49')](_0xbc5e6e);})[_0x6f1c('0x30')](function(_0xd15eba){_0x5e6ad2['rows']=_0xd15eba;return _0x5e6ad2;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x1496b0,_0xbc5e6e))[_0x6f1c('0x4b')](handleError(_0x1496b0,null));};exports[_0x6f1c('0x66')]=function(_0x19d68b,_0x100bd3,_0x1bdb0f){var _0x44e89d={'raw':!![],'where':{}};var _0x1f0c6b={};var _0x57ca7f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x19d68b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x100bd3,null))[_0x6f1c('0x30')](function(_0x2d405d){if(_0x2d405d){_0x1f0c6b[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x67')][_0x6f1c('0x59')]);_0x1f0c6b['query']=_['keys'](_0x19d68b[_0x6f1c('0x38')]);_0x1f0c6b[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x1f0c6b[_0x6f1c('0x37')],_0x1f0c6b[_0x6f1c('0x38')]);_0x44e89d[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x1f0c6b[_0x6f1c('0x37')],qs['fields'](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x44e89d[_0x6f1c('0x3c')]=_0x44e89d[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x44e89d[_0x6f1c('0x3c')]:_0x1f0c6b[_0x6f1c('0x37')];if(!_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x44e89d[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x44e89d[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x19')]);}_0x44e89d['order']=qs[_0x6f1c('0x41')](_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x44e89d[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_['pick'](_0x19d68b[_0x6f1c('0x38')],_0x1f0c6b[_0x6f1c('0x3a')]));_0x44e89d[_0x6f1c('0x42')]['VoiceQueueId']=_0x2d405d['id'];if(_0x19d68b[_0x6f1c('0x38')]['filter']){_0x44e89d[_0x6f1c('0x42')]=_['merge'](_0x44e89d[_0x6f1c('0x42')],{'$or':_['map'](_0x44e89d[_0x6f1c('0x3c')],function(_0x35ff82){var _0x1bdf67={};_0x1bdf67[_0x35ff82]={'$like':'%'+_0x19d68b[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x1bdf67;})});}_0x44e89d=_[_0x6f1c('0x44')]({},_0x44e89d,_0x19d68b[_0x6f1c('0x46')]);return db[_0x6f1c('0x67')][_0x6f1c('0x1c')]({'where':_0x44e89d[_0x6f1c('0x42')]})[_0x6f1c('0x30')](function(_0xfef5b1){_0x57ca7f[_0x6f1c('0x1c')]=_0xfef5b1;if(_0x19d68b['query'][_0x6f1c('0x48')]){_0x44e89d[_0x6f1c('0x5a')]=[{'all':!![]}];}return db[_0x6f1c('0x67')][_0x6f1c('0x49')](_0x44e89d);})[_0x6f1c('0x30')](function(_0x5cce63){_0x57ca7f[_0x6f1c('0x4a')]=_0x5cce63;return _0x57ca7f;});}})[_0x6f1c('0x30')](respondWithFilteredResult(_0x100bd3,_0x44e89d))[_0x6f1c('0x4b')](handleError(_0x100bd3,null));};exports[_0x6f1c('0x69')]=function(_0x4de2ea,_0x31f061,_0x48e056){var _0x59cf5c={};var _0x531394={};var _0xfbb84b;var _0x4ea59c;return db['VoiceQueue'][_0x6f1c('0x60')]({'where':{'id':_0x4de2ea['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x31f061,null))[_0x6f1c('0x30')](function(_0x577d0e){if(_0x577d0e){_0xfbb84b=_0x577d0e;_0x531394[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x6a')][_0x6f1c('0x59')]);_0x531394['query']=_[_0x6f1c('0x39')](_0x4de2ea[_0x6f1c('0x38')]);_0x531394[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x531394[_0x6f1c('0x37')],_0x531394[_0x6f1c('0x38')]);_0x59cf5c[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x531394[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x4de2ea['query'][_0x6f1c('0x3d')]));_0x59cf5c[_0x6f1c('0x3c')]=_0x59cf5c['attributes'][_0x6f1c('0x3e')]?_0x59cf5c[_0x6f1c('0x3c')]:_0x531394[_0x6f1c('0x37')];_0x59cf5c[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x4de2ea['query'][_0x6f1c('0x41')]);_0x59cf5c[_0x6f1c('0x42')]=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x4de2ea[_0x6f1c('0x38')],_0x531394[_0x6f1c('0x3a')]));if(_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x59cf5c[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x59cf5c[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x59cf5c[_0x6f1c('0x3c')],function(_0x2e302e){var _0x353526={};_0x353526[_0x2e302e]={'$like':'%'+_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x353526;})});}_0x59cf5c=_['merge']({},_0x59cf5c,_0x4de2ea['options']);return _0xfbb84b[_0x6f1c('0x69')](_0x59cf5c);}})[_0x6f1c('0x30')](function(_0x4248fe){if(_0x4248fe){_0x4ea59c=_0x4248fe[_0x6f1c('0x3e')];if(!_0x4de2ea['query'][_0x6f1c('0x3f')]('nolimit')){_0x59cf5c['limit']=qs['limit'](_0x4de2ea['query']['limit']);_0x59cf5c['offset']=qs['offset'](_0x4de2ea[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0xfbb84b[_0x6f1c('0x69')](_0x59cf5c);}})['then'](function(_0x3db0ad){if(_0x3db0ad){return _0x3db0ad?{'count':_0x4ea59c,'rows':_0x3db0ad}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x31f061,null))[_0x6f1c('0x4b')](handleError(_0x31f061,null));};exports[_0x6f1c('0x6b')]=function(_0x2fcd7b,_0x43b068,_0x4ea6a6){var _0x4befd0=_0x2fcd7b[_0x6f1c('0x5d')][_0x6f1c('0x6c')];var _0x3306b9=_[_0x6f1c('0x2a')](_0x4befd0,'id');return db[_0x6f1c('0x6a')][_0x6f1c('0x49')]({'where':{'id':_0x3306b9},'attributes':['id'],'include':[{'model':db[_0x6f1c('0x6d')],'as':'Agents','attributes':['id',_0x6f1c('0x2e'),_0x6f1c('0x6e'),_0x6f1c('0x6f'),_0x6f1c('0x70')],'raw':!![]}]})[_0x6f1c('0x30')](function(_0x24ef0b){if(_0x24ef0b){var _0x57e2ea=_[_0x6f1c('0x71')](_0x24ef0b,function(_0x557c14){var _0x19368f=_0x557c14[_0x6f1c('0x50')]({'plain':!![]});_0x19368f[_0x6f1c('0x72')][_0x6f1c('0x73')](function(_0x2ee82d){_0x2ee82d['penalty']=_['find'](_0x4befd0,{'id':_0x19368f['id']})[_0x6f1c('0x74')];});return _0x19368f['Agents'];});return db[_0x6f1c('0x47')]['find']({'where':{'id':_0x2fcd7b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(_0x5d06d9){return db['sequelize'][_0x6f1c('0x75')](function(_0x58e187){return _0x5d06d9[_0x6f1c('0x6b')](_0x3306b9,{'transaction':_0x58e187})[_0x6f1c('0x30')](function(){return BPromise[_0x6f1c('0x76')](_0x4befd0,function(_0x13dd68){return db[_0x6f1c('0x77')]['upsert']({'TeamId':_0x13dd68['id'],'VoiceQueueId':_0x2fcd7b[_0x6f1c('0x58')]['id'],'penalty':_0x13dd68[_0x6f1c('0x74')]},{'transaction':_0x58e187});});})[_0x6f1c('0x30')](function(){return BPromise[_0x6f1c('0x76')](_0x57e2ea,function(_0x4bad66){return db['UserVoiceQueue'][_0x6f1c('0x78')]({'where':{'UserId':_0x4bad66['id'],'VoiceQueueId':_0x2fcd7b[_0x6f1c('0x58')]['id']},'defaults':{'penalty':_0x4bad66[_0x6f1c('0x74')]},'transaction':_0x58e187});});})['then'](function(){return BPromise[_0x6f1c('0x76')](_[_0x6f1c('0x28')](_0x57e2ea,{'online':!![]}),function(_0x52727d){return db[_0x6f1c('0x79')]['upsert']({'membername':_0x52727d[_0x6f1c('0x2e')],'UserId':_0x52727d['id'],'queue_name':_0x5d06d9[_0x6f1c('0x2e')],'VoiceQueueId':_0x5d06d9['id'],'interface':_[_0x6f1c('0x7a')](_0x52727d[_0x6f1c('0x70')])?util['format'](_0x6f1c('0x7b'),_0x52727d[_0x6f1c('0x2e')]):_0x52727d[_0x6f1c('0x70')],'paused':_0x52727d[_0x6f1c('0x6f')]||![],'penalty':_0x52727d[_0x6f1c('0x74')]},{'transaction':_0x58e187});});})['then'](function(){_0x57e2ea[_0x6f1c('0x73')](function(_0x12d39c){socket[_0x6f1c('0x7c')]('userVoiceQueue:save',{'UserId':_0x12d39c['id'],'VoiceQueueId':_0x5d06d9['id']});});});});});}})['then'](respondWithStatusCode(_0x43b068,null))[_0x6f1c('0x4b')](handleError(_0x43b068,null));};exports[_0x6f1c('0x7d')]=function(_0x22721d,_0x465ec8,_0x1e3d9b){return db[_0x6f1c('0x6a')]['findAll']({'where':{'id':_0x22721d[_0x6f1c('0x38')][_0x6f1c('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x6f1c('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6f1c('0x30')](handleEntityNotFound(_0x465ec8,null))[_0x6f1c('0x30')](function(_0x1f2580){var _0x33cb05=_[_0x6f1c('0x2a')](_0x1f2580,'id');var _0x3d2590=[];var _0x44c4f3=[];var _0x32642f=squel['select']();_0x32642f[_0x6f1c('0x7f')](_0x6f1c('0x80'))[_0x6f1c('0x81')](_0x6f1c('0x82'),'tq')[_0x6f1c('0x83')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6f1c('0x84'),_0x22721d[_0x6f1c('0x58')]['id']);for(var _0x5705b9=0x0;_0x5705b9<_0x1f2580[_0x6f1c('0x3e')];_0x5705b9+=0x1){let _0x4c64d4=_0x1f2580[_0x5705b9];for(var _0x9079ef=0x0;_0x9079ef<_0x4c64d4[_0x6f1c('0x72')][_0x6f1c('0x3e')];_0x9079ef+=0x1){let _0x59c873=_0x4c64d4[_0x6f1c('0x72')][_0x9079ef];var _0x109a99=_0x32642f[_0x6f1c('0x57')]();_0x109a99[_0x6f1c('0x42')](_0x6f1c('0x85'),_0x59c873['id']);_0x44c4f3[_0x6f1c('0x86')](db[_0x6f1c('0x87')]['query'](_0x109a99[_0x6f1c('0x88')](),{'type':db[_0x6f1c('0x87')]['QueryTypes'][_0x6f1c('0x89')]})[_0x6f1c('0x30')](function(_0x5c33e0){if(_0x5c33e0[_0x6f1c('0x3e')]===0x1){return _0x59c873['id'];}else{var _0x59106b=_[_0x6f1c('0x8a')](_[_0x6f1c('0x2a')](_0x5c33e0,_0x6f1c('0x8b')),function(_0x1e9294){return _[_0x6f1c('0x2c')](_0x33cb05,_0x1e9294);});if(_0x59106b){return _0x59c873['id'];}}}));}}return BPromise['all'](_0x44c4f3)[_0x6f1c('0x30')](function(_0x35d408){_0x3d2590=_(_0x3d2590)['union'](_0x35d408)['compact']()[_0x6f1c('0x2b')]();return db['VoiceQueue'][_0x6f1c('0x4d')]({'where':{'id':_0x22721d[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(_0x439561){return db[_0x6f1c('0x87')][_0x6f1c('0x75')](function(_0x5edffb){return _0x439561[_0x6f1c('0x7d')](_0x22721d[_0x6f1c('0x38')][_0x6f1c('0x7e')],{'transaction':_0x5edffb})[_0x6f1c('0x30')](function(){if(!_['isEmpty'](_0x3d2590)){return _0x439561[_0x6f1c('0x8c')](_0x3d2590,{'transaction':_0x5edffb})[_0x6f1c('0x30')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x22721d[_0x6f1c('0x58')]['id'],'UserId':_0x3d2590},'transaction':_0x5edffb});});}})[_0x6f1c('0x30')](function(){_0x3d2590[_0x6f1c('0x73')](function(_0x525349){socket[_0x6f1c('0x7c')](_0x6f1c('0x8d'),{'UserId':_0x525349,'VoiceQueueId':_0x439561['id']});});});});});});})['then'](respondWithStatusCode(_0x465ec8,null))[_0x6f1c('0x4b')](handleError(_0x465ec8,null));};exports[_0x6f1c('0x8e')]=function(_0x312cd5,_0xf2eb69,_0x4a893f){var _0x3c7e20,_0x320d9e;return db['VoiceQueue'][_0x6f1c('0x4d')]({'where':{'id':_0x312cd5[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0xf2eb69,null))['then'](function(_0x1f0b6e){if(_0x1f0b6e){_0x320d9e=_0x1f0b6e;return _0x1f0b6e[_0x6f1c('0x8e')](_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')],_[_0x6f1c('0x5b')](_0x312cd5[_0x6f1c('0x5d')],['ids','id'])||{})['spread'](function(_0x1e98db){for(var _0x104a64=0x0;_0x104a64<_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')][_0x6f1c('0x3e')];_0x104a64+=0x1){socket['emit'](_0x6f1c('0x8f'),{'UserId':Number(_0x312cd5[_0x6f1c('0x5d')]['ids'][_0x104a64]),'VoiceQueueId':Number(_0x312cd5['params']['id'])});}return _0x1e98db;});}})[_0x6f1c('0x30')](function(_0x537b5f){_0x3c7e20=_0x537b5f||[];if(_0x320d9e){return db[_0x6f1c('0x6d')][_0x6f1c('0x49')]({'where':{'id':_0x312cd5[_0x6f1c('0x5d')][_0x6f1c('0x7e')]},'attributes':['id',_0x6f1c('0x2e'),_0x6f1c('0x6e'),'voicePause',_0x6f1c('0x70')],'raw':!![]});}})[_0x6f1c('0x30')](function(_0x5b83ba){if(!_[_0x6f1c('0x90')](_0x5b83ba)){var _0x4cf246=[];for(var _0x10b75b=0x0;_0x10b75b<_0x5b83ba[_0x6f1c('0x3e')];_0x10b75b++){if(_0x5b83ba[_0x10b75b][_0x6f1c('0x6e')]){_0x4cf246[_0x6f1c('0x86')](db[_0x6f1c('0x79')][_0x6f1c('0x91')]({'membername':_0x5b83ba[_0x10b75b][_0x6f1c('0x2e')],'UserId':_0x5b83ba[_0x10b75b]['id'],'queue_name':_0x320d9e[_0x6f1c('0x2e')],'VoiceQueueId':_0x320d9e['id'],'interface':_[_0x6f1c('0x7a')](_0x5b83ba[_0x10b75b][_0x6f1c('0x70')])?util[_0x6f1c('0x92')](_0x6f1c('0x7b'),_0x5b83ba[_0x10b75b][_0x6f1c('0x2e')]):_0x5b83ba[_0x10b75b][_0x6f1c('0x70')],'paused':_0x5b83ba[_0x10b75b]['voicePause']||![],'penalty':_0x312cd5['body'][_0x6f1c('0x74')]||0x0}));}}return BPromise[_0x6f1c('0x93')](_0x4cf246);}})[_0x6f1c('0x30')](function(){return _0x3c7e20;})['then'](respondWithResult(_0xf2eb69,null))[_0x6f1c('0x4b')](handleError(_0xf2eb69,null));};exports[_0x6f1c('0x8c')]=function(_0x13d93b,_0x48ebef,_0x5cb835){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x13d93b[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x48ebef,null))[_0x6f1c('0x30')](function(_0x368cc2){if(_0x368cc2){return _0x368cc2[_0x6f1c('0x8c')](_0x13d93b[_0x6f1c('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x13d93b[_0x6f1c('0x38')][_0x6f1c('0x7e')])){for(var _0x720a5=0x0;_0x720a5<_0x13d93b[_0x6f1c('0x38')]['ids']['length'];_0x720a5+=0x1){socket['emit'](_0x6f1c('0x8d'),{'UserId':Number(_0x13d93b['query']['ids'][_0x720a5]),'VoiceQueueId':Number(_0x13d93b[_0x6f1c('0x58')]['id'])});}}else{socket[_0x6f1c('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x13d93b['query'][_0x6f1c('0x7e')]),'VoiceQueueId':Number(_0x13d93b[_0x6f1c('0x58')]['id'])});}});}})[_0x6f1c('0x30')](function(_0x3b834f){return db['UserVoiceQueueRt'][_0x6f1c('0x23')]({'where':{'VoiceQueueId':_0x13d93b[_0x6f1c('0x58')]['id'],'UserId':_0x13d93b[_0x6f1c('0x38')]['ids']}})[_0x6f1c('0x30')](function(){return _0x3b834f;});})[_0x6f1c('0x30')](respondWithStatusCode(_0x48ebef,null))['catch'](handleError(_0x48ebef,null));};exports[_0x6f1c('0x94')]=function(_0x366fe8,_0x2e2ba7,_0x54c44b){var _0x2948f8={};var _0x450a81={};var _0x15af61;var _0x5e9408;return db['VoiceQueue']['findOne']({'where':{'id':_0x366fe8[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x2e2ba7,null))[_0x6f1c('0x30')](function(_0x46daad){if(_0x46daad){_0x15af61=_0x46daad;_0x450a81[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x6d')][_0x6f1c('0x59')]);_0x450a81[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x366fe8[_0x6f1c('0x38')]);_0x450a81[_0x6f1c('0x3a')]=_['intersection'](_0x450a81[_0x6f1c('0x37')],_0x450a81[_0x6f1c('0x38')]);_0x2948f8[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x450a81[_0x6f1c('0x37')],qs[_0x6f1c('0x3d')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x2948f8[_0x6f1c('0x3c')]=_0x2948f8[_0x6f1c('0x3c')]['length']?_0x2948f8[_0x6f1c('0x3c')]:_0x450a81[_0x6f1c('0x37')];_0x2948f8['order']=qs[_0x6f1c('0x41')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x2948f8[_0x6f1c('0x42')]=qs['filters'](_[_0x6f1c('0x43')](_0x366fe8[_0x6f1c('0x38')],_0x450a81['filters']));if(_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x2948f8[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x2948f8['where'],{'$or':_[_0x6f1c('0x2a')](_0x2948f8[_0x6f1c('0x3c')],function(_0x5c09ec){var _0x33a01e={};_0x33a01e[_0x5c09ec]={'$like':'%'+_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x33a01e;})});}_0x2948f8=_[_0x6f1c('0x44')]({},_0x2948f8,_0x366fe8[_0x6f1c('0x46')]);return _0x15af61[_0x6f1c('0x94')](_0x2948f8);}})[_0x6f1c('0x30')](function(_0x1dcb6e){if(_0x1dcb6e){_0x5e9408=_0x1dcb6e[_0x6f1c('0x3e')];if(!_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x2948f8['limit']=qs[_0x6f1c('0x1b')](_0x366fe8['query'][_0x6f1c('0x1b')]);_0x2948f8['offset']=qs[_0x6f1c('0x19')](_0x366fe8[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0x15af61[_0x6f1c('0x94')](_0x2948f8);}})[_0x6f1c('0x30')](function(_0x2f6c74){if(_0x2f6c74){return _0x2f6c74?{'count':_0x5e9408,'rows':_0x2f6c74}:null;}})['then'](respondWithResult(_0x2e2ba7,null))[_0x6f1c('0x4b')](handleError(_0x2e2ba7,null));};exports['getMembers']=function(_0x55a1be,_0x44f923,_0x260d8a){var _0x134a19={};var _0x18558b={};var _0x5eea62;var _0x1aee7b;return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x55a1be['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x44f923,null))[_0x6f1c('0x30')](function(_0x548e26){if(_0x548e26){_0x5eea62=_0x548e26;_0x18558b[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x79')][_0x6f1c('0x59')]);_0x18558b[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x55a1be[_0x6f1c('0x38')]);_0x18558b['filters']=_[_0x6f1c('0x3b')](_0x18558b[_0x6f1c('0x37')],_0x18558b[_0x6f1c('0x38')]);_0x134a19[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x18558b['model'],qs[_0x6f1c('0x3d')](_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x3d')]));_0x134a19[_0x6f1c('0x3c')]=_0x134a19[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x134a19[_0x6f1c('0x3c')]:_0x18558b[_0x6f1c('0x37')];_0x134a19[_0x6f1c('0x40')]=qs[_0x6f1c('0x41')](_0x55a1be[_0x6f1c('0x38')]['sort']);_0x134a19['where']=qs[_0x6f1c('0x3a')](_[_0x6f1c('0x43')](_0x55a1be[_0x6f1c('0x38')],_0x18558b[_0x6f1c('0x3a')]));if(_0x55a1be['query'][_0x6f1c('0x28')]){_0x134a19[_0x6f1c('0x42')]=_[_0x6f1c('0x44')](_0x134a19[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x134a19[_0x6f1c('0x3c')],function(_0xfb4c41){var _0x5724c0={};_0x5724c0[_0xfb4c41]={'$like':'%'+_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x5724c0;})});}_0x134a19=_[_0x6f1c('0x44')]({},_0x134a19,_0x55a1be[_0x6f1c('0x46')]);return _0x5eea62[_0x6f1c('0x95')](_0x134a19);}})[_0x6f1c('0x30')](function(_0x4e622f){if(_0x4e622f){_0x1aee7b=_0x4e622f['length'];if(!_0x55a1be[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x134a19[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x55a1be['query'][_0x6f1c('0x1b')]);_0x134a19[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x55a1be[_0x6f1c('0x38')]['offset']);}return _0x5eea62[_0x6f1c('0x95')](_0x134a19);}})[_0x6f1c('0x30')](function(_0x27a771){return _0x27a771?{'count':_0x1aee7b,'rows':_0x27a771}:null;})[_0x6f1c('0x30')](respondWithResult(_0x44f923,null))[_0x6f1c('0x4b')](handleError(_0x44f923,null));};exports['getLists']=function(_0x2a4c68,_0x3cad4f,_0x3b9469){var _0x37f9d5={};var _0x54141c={};var _0x4977b8;var _0x9bf532;return db[_0x6f1c('0x47')]['findOne']({'where':{'id':_0x2a4c68[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x3cad4f,null))[_0x6f1c('0x30')](function(_0xbada51){if(_0xbada51){_0x4977b8=_0xbada51;_0x54141c[_0x6f1c('0x37')]=_[_0x6f1c('0x39')](db[_0x6f1c('0x96')][_0x6f1c('0x59')]);_0x54141c[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x2a4c68[_0x6f1c('0x38')]);_0x54141c[_0x6f1c('0x3a')]=_[_0x6f1c('0x3b')](_0x54141c[_0x6f1c('0x37')],_0x54141c[_0x6f1c('0x38')]);_0x37f9d5[_0x6f1c('0x3c')]=_[_0x6f1c('0x3b')](_0x54141c['model'],qs[_0x6f1c('0x3d')](_0x2a4c68[_0x6f1c('0x38')]['fields']));_0x37f9d5['attributes']=_0x37f9d5[_0x6f1c('0x3c')][_0x6f1c('0x3e')]?_0x37f9d5[_0x6f1c('0x3c')]:_0x54141c['model'];_0x37f9d5['order']=qs[_0x6f1c('0x41')](_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x37f9d5[_0x6f1c('0x42')]=qs['filters'](_['pick'](_0x2a4c68[_0x6f1c('0x38')],_0x54141c[_0x6f1c('0x3a')]));if(_0x2a4c68['query']['filter']){_0x37f9d5['where']=_['merge'](_0x37f9d5[_0x6f1c('0x42')],{'$or':_['map'](_0x37f9d5[_0x6f1c('0x3c')],function(_0x2a3ab1){var _0x452e23={};_0x452e23[_0x2a3ab1]={'$like':'%'+_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x28')]+'%'};return _0x452e23;})});}_0x37f9d5=_[_0x6f1c('0x44')]({},_0x37f9d5,_0x2a4c68[_0x6f1c('0x46')]);return _0x4977b8[_0x6f1c('0x97')](_0x37f9d5);}})[_0x6f1c('0x30')](function(_0x2b8e5e){if(_0x2b8e5e){_0x9bf532=_0x2b8e5e[_0x6f1c('0x3e')];if(!_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x37f9d5[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x2a4c68['query'][_0x6f1c('0x1b')]);_0x37f9d5[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x2a4c68[_0x6f1c('0x38')][_0x6f1c('0x19')]);}return _0x4977b8[_0x6f1c('0x97')](_0x37f9d5);}})['then'](function(_0x404b5e){if(_0x404b5e){return _0x404b5e?{'count':_0x9bf532,'rows':_0x404b5e}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x3cad4f,null))['catch'](handleError(_0x3cad4f,null));};exports[_0x6f1c('0x98')]=function(_0x281727,_0x1013ea,_0x2bc173){var _0x1a32dc=moment()['format'](_0x6f1c('0x99'));var _0x13f856,_0x37cb3d;return db[_0x6f1c('0x47')]['find']({'where':{'id':_0x281727['params']['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1013ea,null))['then'](function(_0x554696){if(_0x554696){_0x37cb3d=_0x554696;return _0x554696[_0x6f1c('0x98')](_0x281727['body']['ids'],_['omit'](_0x281727[_0x6f1c('0x5d')],[_0x6f1c('0x7e'),'id'])||{});}return null;})[_0x6f1c('0x9a')](function(_0x30f7b9){var _0x183c3b;_0x13f856=_0x30f7b9||[];var _0x2106af=[];if(_0x30f7b9){for(var _0x3f894f=0x0;_0x3f894f<_0x30f7b9[_0x6f1c('0x3e')];_0x3f894f+=0x1){var _0x11004b=_0x30f7b9[_0x3f894f][_0x6f1c('0x50')]({'plain':!![]});_0x37cb3d[_0x6f1c('0x9b')]=_0x281727['body'][_0x6f1c('0x9b')]?_0x281727[_0x6f1c('0x5d')][_0x6f1c('0x9b')]:_0x37cb3d['dialCheckDuplicateType'];switch(_0x37cb3d[_0x6f1c('0x9b')]){case _0x6f1c('0x9c'):_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0x9f'))[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),_0x6f1c('0x61'),_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),_0x6f1c('0xa1'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id','ContactId')['field'](_0x11004b['CmListId'][_0x6f1c('0x88')](),'ListId')[_0x6f1c('0x7f')](_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))['from'](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x11004b[_0x6f1c('0xa9')][_0x6f1c('0x88')]())['where'](_0x6f1c('0xaa'))['where'](_0x6f1c('0xab'),squel[_0x6f1c('0xa5')]()['field'](_0x6f1c('0xac'))[_0x6f1c('0x81')]('cm_hopper_final')['where'](_0x6f1c('0x84'),_0x281727['params']['id']['toString']()))['where'](_0x6f1c('0xab'),squel['select']()[_0x6f1c('0x7f')](_0x6f1c('0xad'))[_0x6f1c('0x81')](_0x6f1c('0x9f'))[_0x6f1c('0x42')](_0x6f1c('0x84'),_0x281727[_0x6f1c('0x58')]['id']['toString']())))[_0x6f1c('0x88')]();break;case _0x6f1c('0xae'):_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')]('cm_hopper')[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),'VoiceQueueId',_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),_0x6f1c('0xa1'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id',_0x6f1c('0xa3'))['field'](_0x11004b[_0x6f1c('0xa9')]['toString'](),_0x6f1c('0xa4'))['field'](_0x281727['params']['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x11004b[_0x6f1c('0xa9')][_0x6f1c('0x88')]())[_0x6f1c('0x42')](_0x6f1c('0xaa'))['where'](_0x6f1c('0xab'),squel['select']()[_0x6f1c('0x7f')](_0x6f1c('0xad'))[_0x6f1c('0x81')](_0x6f1c('0x9f'))[_0x6f1c('0x42')]('VoiceQueueId\x20=\x20?',_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')]())))[_0x6f1c('0x88')]();break;default:_0x183c3b=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0x9f'))[_0x6f1c('0xa0')](['phone',_0x6f1c('0xa2'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),_0x6f1c('0x61'),'createdAt','updatedAt'],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),'phone')[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0xa2'))[_0x6f1c('0x7f')]('id','ContactId')['field'](_0x11004b['CmListId'][_0x6f1c('0x88')](),_0x6f1c('0xa4'))[_0x6f1c('0x7f')](_0x281727[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),'VoiceQueueId')[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))[_0x6f1c('0x7f')]('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))['where'](_0x6f1c('0xa8'),_0x11004b['CmListId']['toString']())[_0x6f1c('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2106af[_0x6f1c('0x86')](db['sequelize']['query'](_0x183c3b));}return BPromise[_0x6f1c('0x93')](_0x2106af);}})[_0x6f1c('0x30')](function(){var _0x390ea4=[];var _0x41c282=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')]('cm_hopper_additional_phones')[_0x6f1c('0xa0')]([_0x6f1c('0xaf'),_0x6f1c('0xa1'),_0x6f1c('0xb0'),'createdAt',_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xb1'))['field'](_0x6f1c('0xb2'))[_0x6f1c('0x7f')](_0x6f1c('0xb3'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5e'))['field']('\x27'+_0x1a32dc+'\x27',_0x6f1c('0x5c'))[_0x6f1c('0x81')](_0x6f1c('0xb4'),'ci')[_0x6f1c('0x83')](_0x6f1c('0x9f'),'h',_0x6f1c('0xb5'))[_0x6f1c('0x42')](_0x6f1c('0xb6'),_0x1a32dc)[_0x6f1c('0x42')](_0x6f1c('0xb7'),_0x6f1c('0xb8')))[_0x6f1c('0x88')]();_0x390ea4[_0x6f1c('0x86')](db['sequelize'][_0x6f1c('0x38')](_0x41c282));return BPromise[_0x6f1c('0x93')](_0x390ea4);})[_0x6f1c('0x30')](function(){return _0x13f856;})[_0x6f1c('0x30')](respondWithResult(_0x1013ea,null))[_0x6f1c('0x4b')](handleError(_0x1013ea,null));};exports['removeLists']=function(_0x3556ab,_0x546a6c,_0x5c1b6f){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x3556ab['params']['id']}})['then'](handleEntityNotFound(_0x546a6c,null))['then'](function(_0x1d75f5){if(_0x1d75f5){return _0x1d75f5['removeLists'](_0x3556ab[_0x6f1c('0x38')][_0x6f1c('0x7e')]);}})[_0x6f1c('0x30')](function(_0x1c982f){if(_0x1c982f){return db[_0x6f1c('0x62')][_0x6f1c('0x23')]({'where':{'ListId':_0x3556ab[_0x6f1c('0x38')][_0x6f1c('0x7e')],'VoiceQueueId':_0x3556ab[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](function(){return _0x1c982f;});}})[_0x6f1c('0x30')](respondWithStatusCode(_0x546a6c,null))['catch'](handleError(_0x546a6c,null));};exports['getBlackLists']=function(_0x4f3ec3,_0x22d6d5,_0x20943c){var _0x3a941b={};var _0x44b2bf={};var _0x537741;var _0x307138;return db[_0x6f1c('0x47')][_0x6f1c('0x60')]({'where':{'id':_0x4f3ec3[_0x6f1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x22d6d5,null))[_0x6f1c('0x30')](function(_0x2a1e8d){if(_0x2a1e8d){_0x537741=_0x2a1e8d;_0x44b2bf['model']=_[_0x6f1c('0x39')](db[_0x6f1c('0x96')][_0x6f1c('0x59')]);_0x44b2bf[_0x6f1c('0x38')]=_[_0x6f1c('0x39')](_0x4f3ec3[_0x6f1c('0x38')]);_0x44b2bf['filters']=_[_0x6f1c('0x3b')](_0x44b2bf['model'],_0x44b2bf[_0x6f1c('0x38')]);_0x3a941b['attributes']=_['intersection'](_0x44b2bf['model'],qs[_0x6f1c('0x3d')](_0x4f3ec3[_0x6f1c('0x38')]['fields']));_0x3a941b[_0x6f1c('0x3c')]=_0x3a941b['attributes'][_0x6f1c('0x3e')]?_0x3a941b['attributes']:_0x44b2bf[_0x6f1c('0x37')];_0x3a941b[_0x6f1c('0x40')]=qs['sort'](_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x41')]);_0x3a941b['where']=qs[_0x6f1c('0x3a')](_['pick'](_0x4f3ec3[_0x6f1c('0x38')],_0x44b2bf[_0x6f1c('0x3a')]));if(_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x28')]){_0x3a941b['where']=_[_0x6f1c('0x44')](_0x3a941b[_0x6f1c('0x42')],{'$or':_[_0x6f1c('0x2a')](_0x3a941b[_0x6f1c('0x3c')],function(_0x11fd25){var _0x161970={};_0x161970[_0x11fd25]={'$like':'%'+_0x4f3ec3['query']['filter']+'%'};return _0x161970;})});}_0x3a941b=_['merge']({},_0x3a941b,_0x4f3ec3[_0x6f1c('0x46')]);return _0x537741['getBlackLists'](_0x3a941b);}})[_0x6f1c('0x30')](function(_0x39f4a2){if(_0x39f4a2){_0x307138=_0x39f4a2['length'];if(!_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x3f')](_0x6f1c('0x68'))){_0x3a941b[_0x6f1c('0x1b')]=qs[_0x6f1c('0x1b')](_0x4f3ec3[_0x6f1c('0x38')][_0x6f1c('0x1b')]);_0x3a941b[_0x6f1c('0x19')]=qs[_0x6f1c('0x19')](_0x4f3ec3[_0x6f1c('0x38')]['offset']);}return _0x537741[_0x6f1c('0xb9')](_0x3a941b);}})['then'](function(_0x3b9f2a){if(_0x3b9f2a){return _0x3b9f2a?{'count':_0x307138,'rows':_0x3b9f2a}:null;}})[_0x6f1c('0x30')](respondWithResult(_0x22d6d5,null))[_0x6f1c('0x4b')](handleError(_0x22d6d5,null));};exports['addBlackLists']=function(_0x16ac91,_0x1352cb,_0x5d7bce){var _0x17b890,_0x3bedbf;return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x16ac91[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x1352cb,null))[_0x6f1c('0x30')](function(_0x52238f){if(_0x52238f){_0x3bedbf=_0x52238f;return _0x52238f[_0x6f1c('0xba')](_0x16ac91['body'][_0x6f1c('0x7e')],_[_0x6f1c('0x5b')](_0x16ac91[_0x6f1c('0x5d')],[_0x6f1c('0x7e'),'id'])||{});}return null;})[_0x6f1c('0x9a')](function(_0x595fc1){var _0x27d2cc;_0x17b890=_0x595fc1||[];var _0x3e0da3=[];if(_0x595fc1){for(var _0x295802=0x0;_0x295802<_0x595fc1['length'];_0x295802+=0x1){var _0x294674=_0x595fc1[_0x295802][_0x6f1c('0x50')]({'plain':!![]});_0x27d2cc=squel[_0x6f1c('0x9d')]()[_0x6f1c('0x9e')](_0x6f1c('0xbb'))[_0x6f1c('0xa0')]([_0x6f1c('0xa1'),_0x6f1c('0xa3'),_0x6f1c('0xa4'),'VoiceQueueId',_0x6f1c('0x5e'),_0x6f1c('0x5c')],squel[_0x6f1c('0xa5')]()[_0x6f1c('0x7f')](_0x6f1c('0xa1'),'phone')[_0x6f1c('0x7f')]('id',_0x6f1c('0xa3'))[_0x6f1c('0x7f')](_0x294674[_0x6f1c('0xa9')][_0x6f1c('0x88')](),_0x6f1c('0xa4'))[_0x6f1c('0x7f')](_0x16ac91[_0x6f1c('0x58')]['id'][_0x6f1c('0x88')](),_0x6f1c('0x61'))['field'](_0x6f1c('0xbc'),_0x6f1c('0x5e'))[_0x6f1c('0x7f')](_0x6f1c('0xbc'),_0x6f1c('0x5c'))['from'](_0x6f1c('0xa6'))[_0x6f1c('0x42')](_0x6f1c('0xa7'))[_0x6f1c('0x42')](_0x6f1c('0xa8'),_0x294674['CmListId'][_0x6f1c('0x88')]())[_0x6f1c('0x42')](_0x6f1c('0xaa')))[_0x6f1c('0x88')]();_0x3e0da3[_0x6f1c('0x86')](db[_0x6f1c('0x87')][_0x6f1c('0x38')](_0x27d2cc));}return BPromise['all'](_0x3e0da3);}})[_0x6f1c('0x30')](function(){return _0x17b890;})['then'](respondWithResult(_0x1352cb,null))[_0x6f1c('0x4b')](handleError(_0x1352cb,null));};exports[_0x6f1c('0xbd')]=function(_0x201eb1,_0x402b28,_0x27017a){return db[_0x6f1c('0x47')][_0x6f1c('0x4d')]({'where':{'id':_0x201eb1[_0x6f1c('0x58')]['id']}})[_0x6f1c('0x30')](handleEntityNotFound(_0x402b28,null))[_0x6f1c('0x30')](function(_0x326ea8){if(_0x326ea8){return _0x326ea8[_0x6f1c('0xbd')](_0x201eb1['query'][_0x6f1c('0x7e')]);}})[_0x6f1c('0x30')](function(_0x462c0f){if(_0x462c0f){return db[_0x6f1c('0x67')]['destroy']({'where':{'ListId':_0x201eb1['query'][_0x6f1c('0x7e')],'VoiceQueueId':_0x201eb1['params']['id']}})[_0x6f1c('0x30')](function(){return _0x462c0f;});}})[_0x6f1c('0x30')](respondWithStatusCode(_0x402b28,null))[_0x6f1c('0x4b')](handleError(_0x402b28,null));}; \ No newline at end of file +var _0x90ec=['getHoppers','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','User','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueueRt','format','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','online','isNil','isArray','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ListId','select','phone','ContactId','CmListId','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','scheduledAt','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','json','offset','count','status','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','value','includes','type','find','name','UserProfileResource','send','index','map','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','omit','role','userProfileId'];(function(_0x505a6a,_0x26eb35){var _0x2f0202=function(_0x3b340f){while(--_0x3b340f){_0x505a6a['push'](_0x505a6a['shift']());}};_0x2f0202(++_0x26eb35);}(_0x90ec,0x1d4));var _0xc90e=function(_0x44af47,_0x596cf2){_0x44af47=_0x44af47-0x0;var _0x232cc9=_0x90ec[_0x44af47];return _0x232cc9;};'use strict';var emlformat=require(_0xc90e('0x0'));var rimraf=require(_0xc90e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc90e('0x2'));var rp=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var Mustache=require(_0xc90e('0x6'));var util=require('util');var path=require(_0xc90e('0x7'));var sox=require(_0xc90e('0x8'));var csv=require(_0xc90e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc90e('0xa'));var _=require('lodash');var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require(_0xc90e('0x9'));var querystring=require(_0xc90e('0xe'));var Papa=require(_0xc90e('0xf'));var Redis=require(_0xc90e('0x10'));var authService=require(_0xc90e('0x11'));var qs=require(_0xc90e('0x12'));var as=require(_0xc90e('0x13'));var hardwareService=require(_0xc90e('0x14'));var logger=require('../../config/logger')(_0xc90e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc90e('0x16')]=_[_0xc90e('0x17')](config['redis'],{'host':_0xc90e('0x18'),'port':0x18eb});var socket=require(_0xc90e('0x19'))(new Redis(config['redis']));require(_0xc90e('0x1a'))[_0xc90e('0x1b')](socket);function respondWithStatusCode(_0x274876,_0x2758bb){_0x2758bb=_0x2758bb||0xcc;return function(_0x1de265){if(_0x1de265){return _0x274876[_0xc90e('0x1c')](_0x2758bb);}return _0x274876['status'](_0x2758bb)[_0xc90e('0x1d')]();};}function respondWithResult(_0x2ada5a,_0x4ff295){_0x4ff295=_0x4ff295||0xc8;return function(_0xd16172){if(_0xd16172){return _0x2ada5a['status'](_0x4ff295)[_0xc90e('0x1e')](_0xd16172);}};}function respondWithFilteredResult(_0x153415,_0x558b22){return function(_0x934f8b){if(_0x934f8b){var _0xe0e0bc=typeof _0x558b22[_0xc90e('0x1f')]==='undefined'&&typeof _0x558b22['limit']==='undefined';var _0x161a3a=_0x934f8b[_0xc90e('0x20')];var _0x25b1d7=_0xe0e0bc?0x0:_0x558b22[_0xc90e('0x1f')];var _0x8fb1ef=_0xe0e0bc?_0x934f8b['count']:_0x558b22[_0xc90e('0x1f')]+_0x558b22['limit'];var _0x3ae806;if(_0x8fb1ef>=_0x161a3a){_0x8fb1ef=_0x161a3a;_0x3ae806=0xc8;}else{_0x3ae806=0xce;}_0x153415[_0xc90e('0x21')](_0x3ae806);return _0x153415['set'](_0xc90e('0x22'),_0x25b1d7+'-'+_0x8fb1ef+'/'+_0x161a3a)[_0xc90e('0x1e')](_0x934f8b);}return null;};}function patchUpdates(_0x957d1e){return function(_0x114042){try{jsonpatch[_0xc90e('0x23')](_0x114042,_0x957d1e,!![]);}catch(_0x282c53){return BPromise[_0xc90e('0x24')](_0x282c53);}return _0x114042[_0xc90e('0x25')]();};}function saveUpdates(_0x1cff73,_0x52aa00){return function(_0x1d700a){if(_0x1d700a){return _0x1d700a[_0xc90e('0x26')](_0x1cff73)[_0xc90e('0x27')](function(_0x380f3f){return _0x380f3f;});}return null;};}function removeEntity(_0x3371aa,_0x59d731){return function(_0x2e4d0c){if(_0x2e4d0c){return _0x2e4d0c[_0xc90e('0x28')]()[_0xc90e('0x27')](function(){var _0x4fde04=_0x2e4d0c[_0xc90e('0x29')]({'plain':!![]});var _0x2ea6e6=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b'),'ignore':![]},{'name':_0xc90e('0x2c'),'value':_0xc90e('0x2d'),'ignore':![]}];var _0x5ab0af=_(_0x2ea6e6)['filter'](_0xc90e('0x2e'))['map'](_0xc90e('0x2f'))[_0xc90e('0x2f')]();if(_[_0xc90e('0x30')](_0x5ab0af,_0x4fde04[_0xc90e('0x31')])){return;}var _0x2c9ced=_[_0xc90e('0x32')](_0x2ea6e6,[_0xc90e('0x2f'),_0x4fde04['type']])[_0xc90e('0x33')];return db[_0xc90e('0x34')]['destroy']({'where':{'type':_0x2c9ced,'resourceId':_0x4fde04['id']}})[_0xc90e('0x27')](function(){return _0x2e4d0c;});})['then'](function(){_0x3371aa[_0xc90e('0x21')](0xcc)[_0xc90e('0x1d')]();});}};}function handleEntityNotFound(_0xad857d,_0x3ecbc1){return function(_0x297498){if(!_0x297498){_0xad857d[_0xc90e('0x1c')](0x194);}return _0x297498;};}function handleError(_0xc65f5b,_0x14f534){_0x14f534=_0x14f534||0x1f4;return function(_0x89462e){logger['error'](_0x89462e['stack']);if(_0x89462e[_0xc90e('0x33')]){delete _0x89462e[_0xc90e('0x33')];}_0xc65f5b[_0xc90e('0x21')](_0x14f534)[_0xc90e('0x35')](_0x89462e);};}exports[_0xc90e('0x36')]=function(_0x314644,_0x5924fa){var _0x1f7d4c={},_0x42b216={},_0x186db4={'count':0x0,'rows':[]};var _0x4fc508=_[_0xc90e('0x37')](db[_0xc90e('0x38')][_0xc90e('0x39')],function(_0x437d26){return{'name':_0x437d26['fieldName'],'type':_0x437d26['type']['key']};});_0x42b216[_0xc90e('0x3a')]=_[_0xc90e('0x37')](_0x4fc508,_0xc90e('0x33'));_0x42b216[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x314644['query']);_0x42b216[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x42b216[_0xc90e('0x3a')],_0x42b216[_0xc90e('0x3b')]);_0x1f7d4c[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x42b216[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x314644[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x1f7d4c[_0xc90e('0x3f')]=_0x1f7d4c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x1f7d4c['attributes']:_0x42b216[_0xc90e('0x3a')];if(!_0x314644[_0xc90e('0x3b')]['hasOwnProperty']('nolimit')){_0x1f7d4c[_0xc90e('0x42')]=qs['limit'](_0x314644[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x1f7d4c['offset']=qs[_0xc90e('0x1f')](_0x314644['query']['offset']);}_0x1f7d4c[_0xc90e('0x43')]=qs['sort'](_0x314644['query'][_0xc90e('0x44')]);_0x1f7d4c[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x314644[_0xc90e('0x3b')],_0x42b216[_0xc90e('0x3d')]),_0x4fc508);if(_0x314644[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x1f7d4c[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x1f7d4c[_0xc90e('0x45')],{'$or':_['map'](_0x4fc508,function(_0xd8113c){if(_0xd8113c['type']!=='VIRTUAL'){var _0x36f1f7={};_0x36f1f7[_0xd8113c['name']]={'$like':'%'+_0x314644[_0xc90e('0x3b')]['filter']+'%'};return _0x36f1f7;}})});}_0x1f7d4c=_[_0xc90e('0x48')]({},_0x1f7d4c,_0x314644[_0xc90e('0x49')]);var _0x15f492={'where':_0x1f7d4c[_0xc90e('0x45')]};return db[_0xc90e('0x38')][_0xc90e('0x20')](_0x15f492)[_0xc90e('0x27')](function(_0x260520){_0x186db4[_0xc90e('0x20')]=_0x260520;if(_0x314644['query'][_0xc90e('0x4a')]){_0x1f7d4c[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x38')][_0xc90e('0x4c')](_0x1f7d4c);})['then'](function(_0x21408a){_0x186db4[_0xc90e('0x4d')]=_0x21408a;return _0x186db4;})[_0xc90e('0x27')](respondWithFilteredResult(_0x5924fa,_0x1f7d4c))['catch'](handleError(_0x5924fa,null));};exports[_0xc90e('0x4e')]=function(_0x49c8ab,_0x45f816){var _0x4c547c={'raw':![],'where':{'id':_0x49c8ab['params']['id']}},_0x130263={};_0x130263[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x38')][_0xc90e('0x39')]);_0x130263[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x49c8ab[_0xc90e('0x3b')]);_0x130263[_0xc90e('0x3d')]=_['intersection'](_0x130263[_0xc90e('0x3a')],_0x130263[_0xc90e('0x3b')]);_0x4c547c['attributes']=_['intersection'](_0x130263[_0xc90e('0x3a')],qs['fields'](_0x49c8ab[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x4c547c[_0xc90e('0x3f')]=_0x4c547c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x4c547c['attributes']:_0x130263[_0xc90e('0x3a')];if(_0x49c8ab[_0xc90e('0x3b')]['includeAll']){_0x4c547c[_0xc90e('0x4b')]=[{'all':!![]}];}_0x4c547c=_['merge']({},_0x4c547c,_0x49c8ab[_0xc90e('0x49')]);return db['VoiceQueue'][_0xc90e('0x32')](_0x4c547c)[_0xc90e('0x27')](handleEntityNotFound(_0x45f816,null))[_0xc90e('0x27')](respondWithResult(_0x45f816,null))[_0xc90e('0x4f')](handleError(_0x45f816,null));};exports[_0xc90e('0x50')]=function(_0x3b8ec8,_0xa8b8b6){return db[_0xc90e('0x38')][_0xc90e('0x50')](_0x3b8ec8[_0xc90e('0x51')],{})[_0xc90e('0x27')](function(_0x38e86c){var _0x13f306=_0x3b8ec8[_0xc90e('0x52')][_0xc90e('0x29')]({'plain':!![]});if(!_0x13f306)throw new Error(_0xc90e('0x53'));if(_0x13f306['role']===_0xc90e('0x52')){var _0x1e0ef8=_0x38e86c[_0xc90e('0x29')]({'plain':!![]});var _0x2dadfe=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b')},{'name':_0xc90e('0x2c'),'value':'outbound'}];var _0x1ec7f2=_['find'](_0x2dadfe,[_0xc90e('0x2f'),_0x1e0ef8[_0xc90e('0x31')]])[_0xc90e('0x33')];return db[_0xc90e('0x54')][_0xc90e('0x32')]({'where':{'name':_0x1ec7f2,'userProfileId':_0x13f306['userProfileId']},'raw':!![]})[_0xc90e('0x27')](function(_0x26f06f){if(_0x26f06f&&_0x26f06f['autoAssociation']===0x0){return db[_0xc90e('0x34')][_0xc90e('0x50')]({'name':_0x1e0ef8[_0xc90e('0x33')],'resourceId':_0x1e0ef8['id'],'type':_0x26f06f[_0xc90e('0x33')],'sectionId':_0x26f06f['id']},{})['then'](function(){return _0x38e86c;});}else{return _0x38e86c;}})['catch'](function(_0x308b22){logger[_0xc90e('0x55')](_0xc90e('0x56'),_0x308b22);throw _0x308b22;});}return _0x38e86c;})[_0xc90e('0x27')](respondWithResult(_0xa8b8b6,0xc9))[_0xc90e('0x4f')](handleError(_0xa8b8b6,null));};exports['clone']=function(_0x3e8c0d,_0x40b61e){var _0x4aa069={'where':{'id':_0x3e8c0d[_0xc90e('0x57')]['id']}},_0x4a0f64={};_0x4a0f64[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x38')]['rawAttributes']);_0x4aa069[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4a0f64[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x3e8c0d[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x4aa069[_0xc90e('0x3f')]=_0x4aa069[_0xc90e('0x3f')]['length']?_0x4aa069[_0xc90e('0x3f')]:_0x4a0f64[_0xc90e('0x3a')];if(_0x3e8c0d[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x4aa069[_0xc90e('0x4b')]=[{'all':!![]}];}_0x4aa069=_['merge']({},_0x4aa069,_0x3e8c0d[_0xc90e('0x49')]);return db[_0xc90e('0x38')][_0xc90e('0x32')](_0x4aa069)['then'](handleEntityNotFound(_0x40b61e,null))['then'](function(_0x31bca6){if(_0x31bca6){var _0x52691a=_0x31bca6[_0xc90e('0x29')]({'plain':!![]});_0x52691a=qs['omit'](_0x52691a,['id',_0xc90e('0x58'),_0xc90e('0x59')]);_0x3e8c0d[_0xc90e('0x51')]=_[_0xc90e('0x5a')](_0x3e8c0d[_0xc90e('0x51')],['id',_0xc90e('0x58'),_0xc90e('0x59')]);return db[_0xc90e('0x38')][_0xc90e('0x50')](_[_0xc90e('0x48')](_0x52691a,_0x3e8c0d[_0xc90e('0x51')]),{'include':_0x3e8c0d[_0xc90e('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xc90e('0x27')](function(_0x511e33){var _0x5c4441=_0x3e8c0d['user']['get']({'plain':!![]});if(!_0x5c4441)throw new Error(_0xc90e('0x53'));if(_0x5c4441[_0xc90e('0x5b')]==='user'){var _0x5c6240=_0x511e33[_0xc90e('0x29')]({'plain':!![]});var _0x1e4477=[{'name':_0xc90e('0x2a'),'value':_0xc90e('0x2b')},{'name':_0xc90e('0x2c'),'value':'outbound'}];var _0x371ba6=_[_0xc90e('0x32')](_0x1e4477,[_0xc90e('0x2f'),_0x5c6240[_0xc90e('0x31')]])[_0xc90e('0x33')];return db[_0xc90e('0x54')]['find']({'where':{'name':_0x371ba6,'userProfileId':_0x5c4441[_0xc90e('0x5c')]},'raw':!![]})['then'](function(_0x1b92e3){if(_0x1b92e3&&_0x1b92e3['autoAssociation']===0x0){return db['UserProfileResource'][_0xc90e('0x50')]({'name':_0x5c6240[_0xc90e('0x33')],'resourceId':_0x5c6240['id'],'type':_0x1b92e3['name'],'sectionId':_0x1b92e3['id']},{})[_0xc90e('0x27')](function(){return _0x511e33;});}else{return _0x511e33;}})['catch'](function(_0x555e41){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x555e41);throw _0x555e41;});}return _0x511e33;});}})[_0xc90e('0x27')](respondWithResult(_0x40b61e,0xc9))[_0xc90e('0x4f')](handleError(_0x40b61e,null));};exports['update']=function(_0x104288,_0x115f53){if(_0x104288[_0xc90e('0x51')]['id']){delete _0x104288[_0xc90e('0x51')]['id'];}return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x104288[_0xc90e('0x57')]['id']}})['then'](handleEntityNotFound(_0x115f53,null))[_0xc90e('0x27')](saveUpdates(_0x104288[_0xc90e('0x51')],null))['then'](respondWithResult(_0x115f53,null))['catch'](handleError(_0x115f53,null));};exports[_0xc90e('0x28')]=function(_0x4c37ab,_0x4ce773){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x4c37ab[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x4ce773,null))[_0xc90e('0x27')](removeEntity(_0x4ce773,null))[_0xc90e('0x4f')](handleError(_0x4ce773,null));};exports[_0xc90e('0x5d')]=function(_0x4a081e,_0x1225a4,_0x3eafba){var _0x56f2be={'raw':![],'where':{}};var _0x29619f={};var _0xefb790={'count':0x0,'rows':[]};return db[_0xc90e('0x38')]['findOne']({'where':{'id':_0x4a081e['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1225a4,null))['then'](function(_0x2db8af){if(_0x2db8af){_0x29619f[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x5e')]['rawAttributes']);_0x29619f[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x4a081e[_0xc90e('0x3b')]);_0x29619f[_0xc90e('0x3d')]=_['intersection'](_0x29619f[_0xc90e('0x3a')],_0x29619f['query']);_0x56f2be[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x29619f[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x4a081e[_0xc90e('0x3b')]['fields']));_0x56f2be[_0xc90e('0x3f')]=_0x56f2be[_0xc90e('0x3f')]['length']?_0x56f2be[_0xc90e('0x3f')]:_0x29619f[_0xc90e('0x3a')];if(!_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x56f2be[_0xc90e('0x42')]=qs['limit'](_0x4a081e['query'][_0xc90e('0x42')]);_0x56f2be[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x4a081e[_0xc90e('0x3b')]['offset']);}_0x56f2be[_0xc90e('0x43')]=qs['sort'](_0x4a081e['query'][_0xc90e('0x44')]);_0x56f2be[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_['pick'](_0x4a081e[_0xc90e('0x3b')],_0x29619f[_0xc90e('0x3d')]));_0x56f2be[_0xc90e('0x45')][_0xc90e('0x61')]=_0x2db8af['id'];if(_0x4a081e[_0xc90e('0x3b')]['filter']){_0x56f2be[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x56f2be[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x56f2be[_0xc90e('0x3f')],function(_0x51eee0){var _0x4316c3={};_0x4316c3[_0x51eee0]={'$like':'%'+_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x4316c3;})});}_0x56f2be=_[_0xc90e('0x48')]({},_0x56f2be,_0x4a081e['options']);return db[_0xc90e('0x5e')][_0xc90e('0x20')]({'where':_0x56f2be[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x57b031){_0xefb790[_0xc90e('0x20')]=_0x57b031;if(_0x4a081e[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x56f2be[_0xc90e('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xc90e('0x4c')](_0x56f2be);})['then'](function(_0x466275){_0xefb790[_0xc90e('0x4d')]=_0x466275;return _0xefb790;});}})['then'](respondWithFilteredResult(_0x1225a4,_0x56f2be))[_0xc90e('0x4f')](handleError(_0x1225a4,null));};exports[_0xc90e('0x62')]=function(_0x159835,_0x474b17,_0x169cf2){var _0x51c8c5={'raw':!![],'where':{}};var _0x1054dc={};var _0x1ffcab={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x159835[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x474b17,null))[_0xc90e('0x27')](function(_0x20adcb){if(_0x20adcb){_0x1054dc[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x64')]['rawAttributes']);_0x1054dc[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x159835['query']);_0x1054dc['filters']=_[_0xc90e('0x3e')](_0x1054dc[_0xc90e('0x3a')],_0x1054dc['query']);_0x51c8c5['attributes']=_['intersection'](_0x1054dc['model'],qs['fields'](_0x159835[_0xc90e('0x3b')]['fields']));_0x51c8c5[_0xc90e('0x3f')]=_0x51c8c5[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x51c8c5['attributes']:_0x1054dc['model'];if(!_0x159835[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x51c8c5[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x159835['query'][_0xc90e('0x42')]);_0x51c8c5[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x159835['query'][_0xc90e('0x1f')]);}_0x51c8c5[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x159835['query'][_0xc90e('0x44')]);_0x51c8c5['where']=qs['filters'](_[_0xc90e('0x46')](_0x159835[_0xc90e('0x3b')],_0x1054dc[_0xc90e('0x3d')]));_0x51c8c5[_0xc90e('0x45')][_0xc90e('0x61')]=_0x20adcb['id'];if(_0x159835[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x51c8c5[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x51c8c5[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x51c8c5['attributes'],function(_0x2c01f5){var _0x5c12e2={};_0x5c12e2[_0x2c01f5]={'$like':'%'+_0x159835[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x5c12e2;})});}_0x51c8c5=_[_0xc90e('0x48')]({},_0x51c8c5,_0x159835['options']);return db[_0xc90e('0x64')][_0xc90e('0x20')]({'where':_0x51c8c5[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x24735b){_0x1ffcab[_0xc90e('0x20')]=_0x24735b;if(_0x159835[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x51c8c5[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x64')][_0xc90e('0x4c')](_0x51c8c5);})['then'](function(_0x104005){_0x1ffcab[_0xc90e('0x4d')]=_0x104005;return _0x1ffcab;});}})[_0xc90e('0x27')](respondWithFilteredResult(_0x474b17,_0x51c8c5))[_0xc90e('0x4f')](handleError(_0x474b17,null));};exports[_0xc90e('0x65')]=function(_0x2bedad,_0x3922f5,_0x393231){var _0x3fcfa7={'raw':!![],'where':{}};var _0x1d10eb={};var _0x590b13={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x2bedad['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x3922f5,null))[_0xc90e('0x27')](function(_0x29a281){if(_0x29a281){_0x1d10eb[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x66')]['rawAttributes']);_0x1d10eb[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x2bedad[_0xc90e('0x3b')]);_0x1d10eb[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x1d10eb[_0xc90e('0x3a')],_0x1d10eb['query']);_0x3fcfa7[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x1d10eb[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x3fcfa7[_0xc90e('0x3f')]=_0x3fcfa7['attributes']['length']?_0x3fcfa7['attributes']:_0x1d10eb[_0xc90e('0x3a')];if(!_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x5f')]('nolimit')){_0x3fcfa7['limit']=qs[_0xc90e('0x42')](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x3fcfa7[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x2bedad['query'][_0xc90e('0x1f')]);}_0x3fcfa7[_0xc90e('0x43')]=qs['sort'](_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x3fcfa7[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_['pick'](_0x2bedad[_0xc90e('0x3b')],_0x1d10eb['filters']));_0x3fcfa7[_0xc90e('0x45')][_0xc90e('0x61')]=_0x29a281['id'];if(_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x3fcfa7['where']=_['merge'](_0x3fcfa7[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x3fcfa7[_0xc90e('0x3f')],function(_0x221bc4){var _0x20b6df={};_0x20b6df[_0x221bc4]={'$like':'%'+_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x20b6df;})});}_0x3fcfa7=_[_0xc90e('0x48')]({},_0x3fcfa7,_0x2bedad[_0xc90e('0x49')]);return db[_0xc90e('0x66')]['count']({'where':_0x3fcfa7[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0x1a2ad1){_0x590b13['count']=_0x1a2ad1;if(_0x2bedad[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x3fcfa7['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc90e('0x4c')](_0x3fcfa7);})[_0xc90e('0x27')](function(_0x5626e1){_0x590b13[_0xc90e('0x4d')]=_0x5626e1;return _0x590b13;});}})['then'](respondWithFilteredResult(_0x3922f5,_0x3fcfa7))['catch'](handleError(_0x3922f5,null));};exports['getHopperBlacks']=function(_0x41febe,_0x40d552,_0x77d99a){var _0x350070={'raw':!![],'where':{}};var _0x337775={};var _0x5e004c={'count':0x0,'rows':[]};return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x41febe[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x40d552,null))['then'](function(_0x3ec332){if(_0x3ec332){_0x337775[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db[_0xc90e('0x67')]['rawAttributes']);_0x337775['query']=_[_0xc90e('0x3c')](_0x41febe[_0xc90e('0x3b')]);_0x337775[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x337775[_0xc90e('0x3a')],_0x337775[_0xc90e('0x3b')]);_0x350070[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x337775[_0xc90e('0x3a')],qs['fields'](_0x41febe[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x350070[_0xc90e('0x3f')]=_0x350070[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x350070[_0xc90e('0x3f')]:_0x337775['model'];if(!_0x41febe[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x350070[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x41febe[_0xc90e('0x3b')]['limit']);_0x350070[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x41febe[_0xc90e('0x3b')]['offset']);}_0x350070[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x41febe[_0xc90e('0x3b')]['sort']);_0x350070[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x41febe[_0xc90e('0x3b')],_0x337775[_0xc90e('0x3d')]));_0x350070[_0xc90e('0x45')]['VoiceQueueId']=_0x3ec332['id'];if(_0x41febe[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x350070[_0xc90e('0x45')]=_['merge'](_0x350070[_0xc90e('0x45')],{'$or':_['map'](_0x350070[_0xc90e('0x3f')],function(_0x4d7b5d){var _0x5b6ae5={};_0x5b6ae5[_0x4d7b5d]={'$like':'%'+_0x41febe[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x5b6ae5;})});}_0x350070=_[_0xc90e('0x48')]({},_0x350070,_0x41febe[_0xc90e('0x49')]);return db['CmHopperBlack']['count']({'where':_0x350070[_0xc90e('0x45')]})[_0xc90e('0x27')](function(_0xbf1725){_0x5e004c[_0xc90e('0x20')]=_0xbf1725;if(_0x41febe[_0xc90e('0x3b')][_0xc90e('0x4a')]){_0x350070[_0xc90e('0x4b')]=[{'all':!![]}];}return db[_0xc90e('0x67')]['findAll'](_0x350070);})['then'](function(_0x312306){_0x5e004c['rows']=_0x312306;return _0x5e004c;});}})[_0xc90e('0x27')](respondWithFilteredResult(_0x40d552,_0x350070))[_0xc90e('0x4f')](handleError(_0x40d552,null));};exports['getTeams']=function(_0x226701,_0x4bb7d2,_0x35fdea){var _0x476261={};var _0x4512fa={};var _0x5dfe4f;var _0x304616;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x226701[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x4bb7d2,null))['then'](function(_0x5c81fc){if(_0x5c81fc){_0x5dfe4f=_0x5c81fc;_0x4512fa['model']=_[_0xc90e('0x3c')](db[_0xc90e('0x68')][_0xc90e('0x39')]);_0x4512fa[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x226701['query']);_0x4512fa[_0xc90e('0x3d')]=_['intersection'](_0x4512fa[_0xc90e('0x3a')],_0x4512fa[_0xc90e('0x3b')]);_0x476261[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4512fa[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x226701[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x476261['attributes']=_0x476261[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x476261[_0xc90e('0x3f')]:_0x4512fa[_0xc90e('0x3a')];_0x476261[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x226701['query'][_0xc90e('0x44')]);_0x476261[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x226701[_0xc90e('0x3b')],_0x4512fa[_0xc90e('0x3d')]));if(_0x226701[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x476261['where']=_[_0xc90e('0x48')](_0x476261[_0xc90e('0x45')],{'$or':_['map'](_0x476261[_0xc90e('0x3f')],function(_0x569664){var _0x1a83af={};_0x1a83af[_0x569664]={'$like':'%'+_0x226701['query'][_0xc90e('0x47')]+'%'};return _0x1a83af;})});}_0x476261=_['merge']({},_0x476261,_0x226701[_0xc90e('0x49')]);return _0x5dfe4f[_0xc90e('0x69')](_0x476261);}})[_0xc90e('0x27')](function(_0x4966db){if(_0x4966db){_0x304616=_0x4966db['length'];if(!_0x226701[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x476261[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x226701[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x476261[_0xc90e('0x1f')]=qs['offset'](_0x226701['query'][_0xc90e('0x1f')]);}return _0x5dfe4f['getTeams'](_0x476261);}})[_0xc90e('0x27')](function(_0x3dd719){if(_0x3dd719){return _0x3dd719?{'count':_0x304616,'rows':_0x3dd719}:null;}})['then'](respondWithResult(_0x4bb7d2,null))[_0xc90e('0x4f')](handleError(_0x4bb7d2,null));};exports[_0xc90e('0x6a')]=function(_0x1c42ae,_0x4f4904,_0x59a7f1){var _0x1069d1=_0x1c42ae[_0xc90e('0x51')]['teams'];var _0x1a4883=_['map'](_0x1069d1,'id');return db[_0xc90e('0x68')][_0xc90e('0x4c')]({'where':{'id':_0x1a4883},'attributes':['id'],'include':[{'model':db[_0xc90e('0x6b')],'as':'Agents','attributes':['id',_0xc90e('0x33'),'online',_0xc90e('0x6c'),_0xc90e('0x6d')],'raw':!![]}]})['then'](function(_0x140331){if(_0x140331){var _0x4055e5=_[_0xc90e('0x6e')](_0x140331,function(_0xd85f0f){var _0x350c4a=_0xd85f0f['get']({'plain':!![]});_0x350c4a[_0xc90e('0x6f')][_0xc90e('0x70')](function(_0x2646c6){_0x2646c6[_0xc90e('0x71')]=_['find'](_0x1069d1,{'id':_0x350c4a['id']})['penalty'];});return _0x350c4a[_0xc90e('0x6f')];});return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0x1c42ae[_0xc90e('0x57')]['id']}})['then'](function(_0x1204bd){return db[_0xc90e('0x72')][_0xc90e('0x73')](function(_0x8439c6){return _0x1204bd[_0xc90e('0x6a')](_0x1a4883,{'transaction':_0x8439c6})['then'](function(){return BPromise[_0xc90e('0x74')](_0x1069d1,function(_0x20f863){return db['TeamVoiceQueue'][_0xc90e('0x75')]({'TeamId':_0x20f863['id'],'VoiceQueueId':_0x1c42ae[_0xc90e('0x57')]['id'],'penalty':_0x20f863[_0xc90e('0x71')]},{'transaction':_0x8439c6});});})['then'](function(){return BPromise[_0xc90e('0x74')](_0x4055e5,function(_0x3195aa){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x3195aa['id'],'VoiceQueueId':_0x1c42ae['params']['id']},'defaults':{'penalty':_0x3195aa[_0xc90e('0x71')]},'transaction':_0x8439c6});});})[_0xc90e('0x27')](function(){return BPromise[_0xc90e('0x74')](_['filter'](_0x4055e5,{'online':!![]}),function(_0x3a4f74){return db[_0xc90e('0x76')][_0xc90e('0x75')]({'membername':_0x3a4f74[_0xc90e('0x33')],'UserId':_0x3a4f74['id'],'queue_name':_0x1204bd[_0xc90e('0x33')],'VoiceQueueId':_0x1204bd['id'],'interface':_['isNil'](_0x3a4f74[_0xc90e('0x6d')])?util[_0xc90e('0x77')]('SIP/%s',_0x3a4f74['name']):_0x3a4f74['interface'],'paused':_0x3a4f74[_0xc90e('0x6c')]||![],'penalty':_0x3a4f74[_0xc90e('0x71')]},{'transaction':_0x8439c6});});})[_0xc90e('0x27')](function(){_0x4055e5['forEach'](function(_0x1d50c1){socket['emit']('userVoiceQueue:save',{'UserId':_0x1d50c1['id'],'VoiceQueueId':_0x1204bd['id']});});});});});}})[_0xc90e('0x27')](respondWithStatusCode(_0x4f4904,null))['catch'](handleError(_0x4f4904,null));};exports[_0xc90e('0x78')]=function(_0x3083f5,_0x55ffd8,_0x2c2d6a){return db[_0xc90e('0x68')][_0xc90e('0x4c')]({'where':{'id':_0x3083f5[_0xc90e('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc90e('0x6b')],'as':_0xc90e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xc90e('0x27')](handleEntityNotFound(_0x55ffd8,null))[_0xc90e('0x27')](function(_0x450fd2){var _0x39af19=_['map'](_0x450fd2,'id');var _0x40a1e2=[];var _0x1c6c3c=[];var _0x405359=squel['select']();_0x405359[_0xc90e('0x79')](_0xc90e('0x7a'))[_0xc90e('0x7b')]('team_has_voice_queues','tq')[_0xc90e('0x7c')](_0xc90e('0x7d'),'ut',_0xc90e('0x7e'))['where']('VoiceQueueId\x20=\x20?',_0x3083f5[_0xc90e('0x57')]['id']);for(var _0x4c3fc2=0x0;_0x4c3fc2<_0x450fd2[_0xc90e('0x41')];_0x4c3fc2+=0x1){let _0x4b8b0e=_0x450fd2[_0x4c3fc2];for(var _0x2cc4c9=0x0;_0x2cc4c9<_0x4b8b0e[_0xc90e('0x6f')][_0xc90e('0x41')];_0x2cc4c9+=0x1){let _0x29a154=_0x4b8b0e[_0xc90e('0x6f')][_0x2cc4c9];var _0x96b3f7=_0x405359[_0xc90e('0x7f')]();_0x96b3f7[_0xc90e('0x45')](_0xc90e('0x80'),_0x29a154['id']);_0x1c6c3c[_0xc90e('0x81')](db[_0xc90e('0x72')]['query'](_0x96b3f7[_0xc90e('0x82')](),{'type':db[_0xc90e('0x72')][_0xc90e('0x83')][_0xc90e('0x84')]})['then'](function(_0x3f17bb){if(_0x3f17bb['length']===0x1){return _0x29a154['id'];}else{var _0x492df6=_[_0xc90e('0x85')](_['map'](_0x3f17bb,_0xc90e('0x86')),function(_0x398528){return _[_0xc90e('0x30')](_0x39af19,_0x398528);});if(_0x492df6){return _0x29a154['id'];}}}));}}return BPromise[_0xc90e('0x87')](_0x1c6c3c)['then'](function(_0x163e0c){_0x40a1e2=_(_0x40a1e2)[_0xc90e('0x88')](_0x163e0c)['compact']()[_0xc90e('0x2f')]();return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x3083f5[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(_0x2e3f34){return db[_0xc90e('0x72')][_0xc90e('0x73')](function(_0x41a212){return _0x2e3f34[_0xc90e('0x78')](_0x3083f5['query'][_0xc90e('0x89')],{'transaction':_0x41a212})[_0xc90e('0x27')](function(){if(!_[_0xc90e('0x8a')](_0x40a1e2)){return _0x2e3f34[_0xc90e('0x8b')](_0x40a1e2,{'transaction':_0x41a212})['then'](function(){return db[_0xc90e('0x76')][_0xc90e('0x28')]({'where':{'VoiceQueueId':_0x3083f5['params']['id'],'UserId':_0x40a1e2},'transaction':_0x41a212});});}})['then'](function(){_0x40a1e2['forEach'](function(_0x218969){socket['emit'](_0xc90e('0x8c'),{'UserId':_0x218969,'VoiceQueueId':_0x2e3f34['id']});});});});});});})[_0xc90e('0x27')](respondWithStatusCode(_0x55ffd8,null))['catch'](handleError(_0x55ffd8,null));};exports[_0xc90e('0x8d')]=function(_0x4f7c46,_0x54d74b,_0x3a6572){var _0x121da6,_0xa5764c;return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0x4f7c46['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x54d74b,null))[_0xc90e('0x27')](function(_0x4a23c8){if(_0x4a23c8){_0xa5764c=_0x4a23c8;return _0x4a23c8['addAgents'](_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x89')],_[_0xc90e('0x5a')](_0x4f7c46['body'],[_0xc90e('0x89'),'id'])||{})[_0xc90e('0x8e')](function(_0x4ab394){for(var _0x3231b6=0x0;_0x3231b6<_0x4f7c46['body']['ids'][_0xc90e('0x41')];_0x3231b6+=0x1){socket[_0xc90e('0x8f')](_0xc90e('0x90'),{'UserId':Number(_0x4f7c46[_0xc90e('0x51')]['ids'][_0x3231b6]),'VoiceQueueId':Number(_0x4f7c46[_0xc90e('0x57')]['id'])});}return _0x4ab394;});}})[_0xc90e('0x27')](function(_0x28fc0c){_0x121da6=_0x28fc0c||[];if(_0xa5764c){return db[_0xc90e('0x6b')]['findAll']({'where':{'id':_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x89')]},'attributes':['id',_0xc90e('0x33'),_0xc90e('0x91'),_0xc90e('0x6c'),_0xc90e('0x6d')],'raw':!![]});}})[_0xc90e('0x27')](function(_0x931c7e){if(!_[_0xc90e('0x8a')](_0x931c7e)){var _0x4292db=[];for(var _0x2614da=0x0;_0x2614da<_0x931c7e[_0xc90e('0x41')];_0x2614da++){if(_0x931c7e[_0x2614da][_0xc90e('0x91')]){_0x4292db[_0xc90e('0x81')](db[_0xc90e('0x76')][_0xc90e('0x75')]({'membername':_0x931c7e[_0x2614da][_0xc90e('0x33')],'UserId':_0x931c7e[_0x2614da]['id'],'queue_name':_0xa5764c[_0xc90e('0x33')],'VoiceQueueId':_0xa5764c['id'],'interface':_[_0xc90e('0x92')](_0x931c7e[_0x2614da][_0xc90e('0x6d')])?util['format']('SIP/%s',_0x931c7e[_0x2614da]['name']):_0x931c7e[_0x2614da][_0xc90e('0x6d')],'paused':_0x931c7e[_0x2614da]['voicePause']||![],'penalty':_0x4f7c46[_0xc90e('0x51')][_0xc90e('0x71')]||0x0}));}}return BPromise['all'](_0x4292db);}})['then'](function(){return _0x121da6;})[_0xc90e('0x27')](respondWithResult(_0x54d74b,null))[_0xc90e('0x4f')](handleError(_0x54d74b,null));};exports[_0xc90e('0x8b')]=function(_0x15de20,_0xa646cf,_0x290e46){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x15de20['params']['id']}})['then'](handleEntityNotFound(_0xa646cf,null))[_0xc90e('0x27')](function(_0x53229b){if(_0x53229b){return _0x53229b[_0xc90e('0x8b')](_0x15de20[_0xc90e('0x3b')]['ids'])[_0xc90e('0x27')](function(){if(_[_0xc90e('0x93')](_0x15de20[_0xc90e('0x3b')]['ids'])){for(var _0x5386be=0x0;_0x5386be<_0x15de20['query']['ids'][_0xc90e('0x41')];_0x5386be+=0x1){socket[_0xc90e('0x8f')](_0xc90e('0x8c'),{'UserId':Number(_0x15de20['query'][_0xc90e('0x89')][_0x5386be]),'VoiceQueueId':Number(_0x15de20['params']['id'])});}}else{socket[_0xc90e('0x8f')](_0xc90e('0x8c'),{'UserId':Number(_0x15de20[_0xc90e('0x3b')][_0xc90e('0x89')]),'VoiceQueueId':Number(_0x15de20[_0xc90e('0x57')]['id'])});}});}})[_0xc90e('0x27')](function(_0x1c218e){return db[_0xc90e('0x76')]['destroy']({'where':{'VoiceQueueId':_0x15de20[_0xc90e('0x57')]['id'],'UserId':_0x15de20[_0xc90e('0x3b')][_0xc90e('0x89')]}})[_0xc90e('0x27')](function(){return _0x1c218e;});})['then'](respondWithStatusCode(_0xa646cf,null))[_0xc90e('0x4f')](handleError(_0xa646cf,null));};exports[_0xc90e('0x94')]=function(_0x3712e9,_0xc6f721,_0x59860a){var _0x2748b1={};var _0x48ada1={};var _0x11b2f0;var _0x24e3f0;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x3712e9[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0xc6f721,null))[_0xc90e('0x27')](function(_0x3d4e2e){if(_0x3d4e2e){_0x11b2f0=_0x3d4e2e;_0x48ada1['model']=_['keys'](db[_0xc90e('0x6b')][_0xc90e('0x39')]);_0x48ada1[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x3712e9[_0xc90e('0x3b')]);_0x48ada1['filters']=_['intersection'](_0x48ada1[_0xc90e('0x3a')],_0x48ada1[_0xc90e('0x3b')]);_0x2748b1[_0xc90e('0x3f')]=_['intersection'](_0x48ada1[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x3712e9[_0xc90e('0x3b')]['fields']));_0x2748b1[_0xc90e('0x3f')]=_0x2748b1[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x2748b1[_0xc90e('0x3f')]:_0x48ada1[_0xc90e('0x3a')];_0x2748b1[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x2748b1['where']=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x3712e9['query'],_0x48ada1[_0xc90e('0x3d')]));if(_0x3712e9[_0xc90e('0x3b')]['filter']){_0x2748b1['where']=_[_0xc90e('0x48')](_0x2748b1[_0xc90e('0x45')],{'$or':_['map'](_0x2748b1[_0xc90e('0x3f')],function(_0x2a08f4){var _0x44cabb={};_0x44cabb[_0x2a08f4]={'$like':'%'+_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x44cabb;})});}_0x2748b1=_[_0xc90e('0x48')]({},_0x2748b1,_0x3712e9[_0xc90e('0x49')]);return _0x11b2f0['getAgents'](_0x2748b1);}})[_0xc90e('0x27')](function(_0x696bb6){if(_0x696bb6){_0x24e3f0=_0x696bb6[_0xc90e('0x41')];if(!_0x3712e9[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x2748b1[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x3712e9[_0xc90e('0x3b')]['limit']);_0x2748b1[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x3712e9[_0xc90e('0x3b')][_0xc90e('0x1f')]);}return _0x11b2f0['getAgents'](_0x2748b1);}})['then'](function(_0x128ea8){if(_0x128ea8){return _0x128ea8?{'count':_0x24e3f0,'rows':_0x128ea8}:null;}})['then'](respondWithResult(_0xc6f721,null))[_0xc90e('0x4f')](handleError(_0xc6f721,null));};exports[_0xc90e('0x95')]=function(_0x4910ea,_0x1b1733,_0x1cae9f){var _0x6ede9c={};var _0x4e6b69={};var _0x3a6352;var _0x2d76d0;return db[_0xc90e('0x38')]['findOne']({'where':{'id':_0x4910ea[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1b1733,null))[_0xc90e('0x27')](function(_0x222fbd){if(_0x222fbd){_0x3a6352=_0x222fbd;_0x4e6b69[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['UserVoiceQueueRt'][_0xc90e('0x39')]);_0x4e6b69[_0xc90e('0x3b')]=_[_0xc90e('0x3c')](_0x4910ea[_0xc90e('0x3b')]);_0x4e6b69[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x4e6b69['model'],_0x4e6b69[_0xc90e('0x3b')]);_0x6ede9c[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x4e6b69[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x6ede9c[_0xc90e('0x3f')]=_0x6ede9c[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x6ede9c[_0xc90e('0x3f')]:_0x4e6b69[_0xc90e('0x3a')];_0x6ede9c[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x6ede9c[_0xc90e('0x45')]=qs['filters'](_[_0xc90e('0x46')](_0x4910ea[_0xc90e('0x3b')],_0x4e6b69[_0xc90e('0x3d')]));if(_0x4910ea[_0xc90e('0x3b')]['filter']){_0x6ede9c[_0xc90e('0x45')]=_['merge'](_0x6ede9c[_0xc90e('0x45')],{'$or':_['map'](_0x6ede9c['attributes'],function(_0x472f4d){var _0x1d56cf={};_0x1d56cf[_0x472f4d]={'$like':'%'+_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x1d56cf;})});}_0x6ede9c=_[_0xc90e('0x48')]({},_0x6ede9c,_0x4910ea[_0xc90e('0x49')]);return _0x3a6352['getMembers'](_0x6ede9c);}})[_0xc90e('0x27')](function(_0x2c13ad){if(_0x2c13ad){_0x2d76d0=_0x2c13ad['length'];if(!_0x4910ea['query'][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x6ede9c[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x4910ea[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x6ede9c['offset']=qs[_0xc90e('0x1f')](_0x4910ea['query']['offset']);}return _0x3a6352[_0xc90e('0x95')](_0x6ede9c);}})[_0xc90e('0x27')](function(_0x25bd9f){return _0x25bd9f?{'count':_0x2d76d0,'rows':_0x25bd9f}:null;})[_0xc90e('0x27')](respondWithResult(_0x1b1733,null))[_0xc90e('0x4f')](handleError(_0x1b1733,null));};exports['getLists']=function(_0x1c7a36,_0x46b5e2,_0x58b8a8){var _0x435360={};var _0xaa739c={};var _0x10a5fe;var _0x8da189;return db[_0xc90e('0x38')][_0xc90e('0x63')]({'where':{'id':_0x1c7a36[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x46b5e2,null))[_0xc90e('0x27')](function(_0x1abdcf){if(_0x1abdcf){_0x10a5fe=_0x1abdcf;_0xaa739c[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['CmList'][_0xc90e('0x39')]);_0xaa739c['query']=_[_0xc90e('0x3c')](_0x1c7a36[_0xc90e('0x3b')]);_0xaa739c[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0xaa739c[_0xc90e('0x3a')],_0xaa739c[_0xc90e('0x3b')]);_0x435360[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0xaa739c[_0xc90e('0x3a')],qs['fields'](_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x435360[_0xc90e('0x3f')]=_0x435360[_0xc90e('0x3f')]['length']?_0x435360[_0xc90e('0x3f')]:_0xaa739c[_0xc90e('0x3a')];_0x435360[_0xc90e('0x43')]=qs[_0xc90e('0x44')](_0x1c7a36['query'][_0xc90e('0x44')]);_0x435360['where']=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x1c7a36[_0xc90e('0x3b')],_0xaa739c[_0xc90e('0x3d')]));if(_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x47')]){_0x435360['where']=_['merge'](_0x435360[_0xc90e('0x45')],{'$or':_[_0xc90e('0x37')](_0x435360[_0xc90e('0x3f')],function(_0xb13ab2){var _0x256cc0={};_0x256cc0[_0xb13ab2]={'$like':'%'+_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x47')]+'%'};return _0x256cc0;})});}_0x435360=_['merge']({},_0x435360,_0x1c7a36['options']);return _0x10a5fe['getLists'](_0x435360);}})[_0xc90e('0x27')](function(_0x326ed8){if(_0x326ed8){_0x8da189=_0x326ed8[_0xc90e('0x41')];if(!_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x5f')](_0xc90e('0x60'))){_0x435360[_0xc90e('0x42')]=qs[_0xc90e('0x42')](_0x1c7a36[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x435360[_0xc90e('0x1f')]=qs[_0xc90e('0x1f')](_0x1c7a36[_0xc90e('0x3b')]['offset']);}return _0x10a5fe[_0xc90e('0x96')](_0x435360);}})[_0xc90e('0x27')](function(_0x4bedb7){if(_0x4bedb7){return _0x4bedb7?{'count':_0x8da189,'rows':_0x4bedb7}:null;}})[_0xc90e('0x27')](respondWithResult(_0x46b5e2,null))[_0xc90e('0x4f')](handleError(_0x46b5e2,null));};exports[_0xc90e('0x97')]=function(_0x2d6eaa,_0x42ad22,_0x1045d1){var _0x165886=moment()[_0xc90e('0x77')](_0xc90e('0x98'));var _0x1a413c,_0x4565e7;return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x2d6eaa[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x42ad22,null))[_0xc90e('0x27')](function(_0x34fcdf){if(_0x34fcdf){_0x4565e7=_0x34fcdf;return _0x34fcdf[_0xc90e('0x97')](_0x2d6eaa['body']['ids'],_['omit'](_0x2d6eaa['body'],[_0xc90e('0x89'),'id'])||{});}return null;})[_0xc90e('0x8e')](function(_0x5d50e1){var _0x4ca33c;_0x1a413c=_0x5d50e1||[];var _0xe2c837=[];if(_0x5d50e1){for(var _0x218efa=0x0;_0x218efa<_0x5d50e1['length'];_0x218efa+=0x1){var _0x2e5249=_0x5d50e1[_0x218efa]['get']({'plain':!![]});_0x4565e7[_0xc90e('0x99')]=_0x2d6eaa[_0xc90e('0x51')][_0xc90e('0x99')]?_0x2d6eaa[_0xc90e('0x51')][_0xc90e('0x99')]:_0x4565e7[_0xc90e('0x99')];switch(_0x4565e7[_0xc90e('0x99')]){case _0xc90e('0x9a'):_0x4ca33c=squel[_0xc90e('0x9b')]()[_0xc90e('0x9c')](_0xc90e('0x9d'))[_0xc90e('0x9e')](['phone','scheduledAt','ContactId',_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa1'),_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27','scheduledAt')[_0xc90e('0x79')]('id',_0xc90e('0xa2'))['field'](_0x2e5249[_0xc90e('0xa3')]['toString'](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')](),_0xc90e('0x61'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')]('cm_contacts')[_0xc90e('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0xc90e('0xa4'),_0x2e5249[_0xc90e('0xa3')]['toString']())[_0xc90e('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xc90e('0x45')](_0xc90e('0xa5'),squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa6'))[_0xc90e('0x7b')](_0xc90e('0xa7'))[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')]()))[_0xc90e('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa9'))[_0xc90e('0x7b')]('cm_hopper')[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa[_0xc90e('0x57')]['id'][_0xc90e('0x82')]())))[_0xc90e('0x82')]();break;case'onlyIfOpen':_0x4ca33c=squel[_0xc90e('0x9b')]()[_0xc90e('0x9c')]('cm_hopper')[_0xc90e('0x9e')]([_0xc90e('0xa1'),'scheduledAt',_0xc90e('0xa2'),_0xc90e('0x9f'),'VoiceQueueId',_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')]('phone',_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0xaa'))['field']('id',_0xc90e('0xa2'))[_0xc90e('0x79')](_0x2e5249[_0xc90e('0xa3')][_0xc90e('0x82')](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa['params']['id'][_0xc90e('0x82')](),_0xc90e('0x61'))['field']('\x27'+_0x165886+'\x27',_0xc90e('0x58'))['field']('\x27'+_0x165886+'\x27','updatedAt')[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')](_0xc90e('0xac'))[_0xc90e('0x45')](_0xc90e('0xa4'),_0x2e5249[_0xc90e('0xa3')]['toString']())[_0xc90e('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc90e('0xa5'),squel['select']()[_0xc90e('0x79')](_0xc90e('0xa9'))[_0xc90e('0x7b')](_0xc90e('0x9d'))[_0xc90e('0x45')](_0xc90e('0xa8'),_0x2d6eaa['params']['id'][_0xc90e('0x82')]())))[_0xc90e('0x82')]();break;default:_0x4ca33c=squel['insert']()['into'](_0xc90e('0x9d'))[_0xc90e('0x9e')](['phone',_0xc90e('0xaa'),_0xc90e('0xa2'),_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xa1'),_0xc90e('0xa1'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27','scheduledAt')['field']('id',_0xc90e('0xa2'))['field'](_0x2e5249[_0xc90e('0xa3')]['toString'](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0x2d6eaa['params']['id']['toString'](),_0xc90e('0x61'))['field']('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')](_0xc90e('0xac'))[_0xc90e('0x45')](_0xc90e('0xa4'),_0x2e5249['CmListId'][_0xc90e('0x82')]())[_0xc90e('0x45')](_0xc90e('0xad')))[_0xc90e('0x82')]();}_0xe2c837[_0xc90e('0x81')](db[_0xc90e('0x72')][_0xc90e('0x3b')](_0x4ca33c));}return BPromise['all'](_0xe2c837);}})[_0xc90e('0x27')](function(){var _0x41d7ae=[];var _0x552205=squel['insert']()[_0xc90e('0x9c')]('cm_hopper_additional_phones')[_0xc90e('0x9e')]([_0xc90e('0xae'),_0xc90e('0xa1'),_0xc90e('0xaf'),_0xc90e('0x58'),_0xc90e('0x59')],squel[_0xc90e('0xa0')]()[_0xc90e('0x79')](_0xc90e('0xb0'))['field']('ci.item')[_0xc90e('0x79')]('ci.OrderBy+1')[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x58'))[_0xc90e('0x79')]('\x27'+_0x165886+'\x27',_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xb1'),'ci')[_0xc90e('0x7c')]('cm_hopper','h',_0xc90e('0xb2'))[_0xc90e('0x45')](_0xc90e('0xb3'),_0x165886)[_0xc90e('0x45')](_0xc90e('0xb4'),_0xc90e('0xb5')))[_0xc90e('0x82')]();_0x41d7ae['push'](db[_0xc90e('0x72')]['query'](_0x552205));return BPromise[_0xc90e('0x87')](_0x41d7ae);})[_0xc90e('0x27')](function(){return _0x1a413c;})[_0xc90e('0x27')](respondWithResult(_0x42ad22,null))['catch'](handleError(_0x42ad22,null));};exports[_0xc90e('0xb6')]=function(_0x1fac05,_0x1f3519,_0x274794){return db[_0xc90e('0x38')][_0xc90e('0x32')]({'where':{'id':_0x1fac05['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1f3519,null))[_0xc90e('0x27')](function(_0x21d868){if(_0x21d868){return _0x21d868[_0xc90e('0xb6')](_0x1fac05['query'][_0xc90e('0x89')]);}})[_0xc90e('0x27')](function(_0x590269){if(_0x590269){return db['CmHopper'][_0xc90e('0x28')]({'where':{'ListId':_0x1fac05[_0xc90e('0x3b')][_0xc90e('0x89')],'VoiceQueueId':_0x1fac05[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(){return _0x590269;});}})[_0xc90e('0x27')](respondWithStatusCode(_0x1f3519,null))['catch'](handleError(_0x1f3519,null));};exports[_0xc90e('0xb7')]=function(_0x5fc2a9,_0x29602e,_0x3eb0e2){var _0x6b049a={};var _0x366cca={};var _0x4d569a;var _0x1f4224;return db['VoiceQueue'][_0xc90e('0x63')]({'where':{'id':_0x5fc2a9['params']['id']}})['then'](handleEntityNotFound(_0x29602e,null))['then'](function(_0x4a86b8){if(_0x4a86b8){_0x4d569a=_0x4a86b8;_0x366cca[_0xc90e('0x3a')]=_[_0xc90e('0x3c')](db['CmList']['rawAttributes']);_0x366cca['query']=_['keys'](_0x5fc2a9['query']);_0x366cca[_0xc90e('0x3d')]=_[_0xc90e('0x3e')](_0x366cca[_0xc90e('0x3a')],_0x366cca[_0xc90e('0x3b')]);_0x6b049a[_0xc90e('0x3f')]=_[_0xc90e('0x3e')](_0x366cca[_0xc90e('0x3a')],qs[_0xc90e('0x40')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x40')]));_0x6b049a['attributes']=_0x6b049a[_0xc90e('0x3f')][_0xc90e('0x41')]?_0x6b049a[_0xc90e('0x3f')]:_0x366cca['model'];_0x6b049a['order']=qs[_0xc90e('0x44')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x44')]);_0x6b049a[_0xc90e('0x45')]=qs[_0xc90e('0x3d')](_[_0xc90e('0x46')](_0x5fc2a9[_0xc90e('0x3b')],_0x366cca[_0xc90e('0x3d')]));if(_0x5fc2a9['query'][_0xc90e('0x47')]){_0x6b049a[_0xc90e('0x45')]=_[_0xc90e('0x48')](_0x6b049a[_0xc90e('0x45')],{'$or':_['map'](_0x6b049a[_0xc90e('0x3f')],function(_0x5bfcdd){var _0x3c3c1e={};_0x3c3c1e[_0x5bfcdd]={'$like':'%'+_0x5fc2a9['query']['filter']+'%'};return _0x3c3c1e;})});}_0x6b049a=_[_0xc90e('0x48')]({},_0x6b049a,_0x5fc2a9[_0xc90e('0x49')]);return _0x4d569a[_0xc90e('0xb7')](_0x6b049a);}})['then'](function(_0x3c935b){if(_0x3c935b){_0x1f4224=_0x3c935b[_0xc90e('0x41')];if(!_0x5fc2a9[_0xc90e('0x3b')]['hasOwnProperty'](_0xc90e('0x60'))){_0x6b049a[_0xc90e('0x42')]=qs['limit'](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x42')]);_0x6b049a['offset']=qs[_0xc90e('0x1f')](_0x5fc2a9[_0xc90e('0x3b')][_0xc90e('0x1f')]);}return _0x4d569a['getBlackLists'](_0x6b049a);}})['then'](function(_0x7ddb9){if(_0x7ddb9){return _0x7ddb9?{'count':_0x1f4224,'rows':_0x7ddb9}:null;}})[_0xc90e('0x27')](respondWithResult(_0x29602e,null))['catch'](handleError(_0x29602e,null));};exports['addBlackLists']=function(_0xd11328,_0x1ab33a,_0x17ebd9){var _0x58c112,_0x39a7dc;return db['VoiceQueue'][_0xc90e('0x32')]({'where':{'id':_0xd11328['params']['id']}})[_0xc90e('0x27')](handleEntityNotFound(_0x1ab33a,null))[_0xc90e('0x27')](function(_0x58ab9b){if(_0x58ab9b){_0x39a7dc=_0x58ab9b;return _0x58ab9b['addBlackLists'](_0xd11328[_0xc90e('0x51')][_0xc90e('0x89')],_[_0xc90e('0x5a')](_0xd11328['body'],['ids','id'])||{});}return null;})[_0xc90e('0x8e')](function(_0x2f05c6){var _0x2162ed;_0x58c112=_0x2f05c6||[];var _0x2689a7=[];if(_0x2f05c6){for(var _0x441a6c=0x0;_0x441a6c<_0x2f05c6[_0xc90e('0x41')];_0x441a6c+=0x1){var _0x5b3649=_0x2f05c6[_0x441a6c][_0xc90e('0x29')]({'plain':!![]});_0x2162ed=squel['insert']()[_0xc90e('0x9c')](_0xc90e('0xb8'))[_0xc90e('0x9e')]([_0xc90e('0xa1'),_0xc90e('0xa2'),_0xc90e('0x9f'),_0xc90e('0x61'),_0xc90e('0x58'),_0xc90e('0x59')],squel['select']()[_0xc90e('0x79')](_0xc90e('0xa1'),'phone')[_0xc90e('0x79')]('id',_0xc90e('0xa2'))['field'](_0x5b3649['CmListId'][_0xc90e('0x82')](),_0xc90e('0x9f'))[_0xc90e('0x79')](_0xd11328['params']['id']['toString'](),'VoiceQueueId')['field'](_0xc90e('0xb9'),'createdAt')[_0xc90e('0x79')](_0xc90e('0xb9'),_0xc90e('0x59'))[_0xc90e('0x7b')](_0xc90e('0xab'))[_0xc90e('0x45')]('deletedAt\x20IS\x20NULL')[_0xc90e('0x45')](_0xc90e('0xa4'),_0x5b3649[_0xc90e('0xa3')]['toString']())['where'](_0xc90e('0xad')))['toString']();_0x2689a7[_0xc90e('0x81')](db['sequelize'][_0xc90e('0x3b')](_0x2162ed));}return BPromise[_0xc90e('0x87')](_0x2689a7);}})[_0xc90e('0x27')](function(){return _0x58c112;})[_0xc90e('0x27')](respondWithResult(_0x1ab33a,null))[_0xc90e('0x4f')](handleError(_0x1ab33a,null));};exports[_0xc90e('0xba')]=function(_0x2604d7,_0x1f0fc1,_0x45c307){return db[_0xc90e('0x38')]['find']({'where':{'id':_0x2604d7['params']['id']}})['then'](handleEntityNotFound(_0x1f0fc1,null))[_0xc90e('0x27')](function(_0x36bbf3){if(_0x36bbf3){return _0x36bbf3[_0xc90e('0xba')](_0x2604d7[_0xc90e('0x3b')][_0xc90e('0x89')]);}})[_0xc90e('0x27')](function(_0x47fdb2){if(_0x47fdb2){return db[_0xc90e('0x67')][_0xc90e('0x28')]({'where':{'ListId':_0x2604d7[_0xc90e('0x3b')][_0xc90e('0x89')],'VoiceQueueId':_0x2604d7[_0xc90e('0x57')]['id']}})[_0xc90e('0x27')](function(){return _0x47fdb2;});}})[_0xc90e('0x27')](respondWithStatusCode(_0x1f0fc1,null))[_0xc90e('0x4f')](handleError(_0x1f0fc1,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 33d27b6..4a347ca 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 _0xc834=['hook','events','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2bc5a0,_0x119ece){var _0x2fedfe=function(_0x3a98c2){while(--_0x3a98c2){_0x2bc5a0['push'](_0x2bc5a0['shift']());}};_0x2fedfe(++_0x119ece);}(_0xc834,0xcc));var _0x4c83=function(_0x2361c5,_0x149033){_0x2361c5=_0x2361c5-0x0;var _0x4a09b4=_0xc834[_0x2361c5];return _0x4a09b4;};'use strict';var EventEmitter=require(_0x4c83('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4c83('0x1')](0x0);var events={'afterCreate':_0x4c83('0x2'),'afterUpdate':_0x4c83('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4166c5){return function(_0x3efed8,_0x25eacd,_0x1870b2){VoiceQueueEvents[_0x4c83('0x4')](_0x4166c5+':'+_0x3efed8['id'],_0x3efed8);VoiceQueueEvents['emit'](_0x4166c5,_0x3efed8);_0x1870b2(null);};}for(var e in events){if(events[_0x4c83('0x5')](e)){var event=events[e];VoiceQueue[_0x4c83('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xfa76=['remove','emit','hasOwnProperty','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x3a6194,_0x4574e2){var _0x298116=function(_0x27297c){while(--_0x27297c){_0x3a6194['push'](_0x3a6194['shift']());}};_0x298116(++_0x4574e2);}(_0xfa76,0xb8));var _0x6fa7=function(_0x1a0f4f,_0xc30484){_0x1a0f4f=_0x1a0f4f-0x0;var _0x4af487=_0xfa76[_0x1a0f4f];return _0x4af487;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x6fa7('0x0'))['db'][_0x6fa7('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6fa7('0x2')](0x0);var events={'afterCreate':_0x6fa7('0x3'),'afterUpdate':_0x6fa7('0x4'),'afterDestroy':_0x6fa7('0x5')};function emitEvent(_0x5bed83){return function(_0x3760e9,_0x46060b,_0x436723){VoiceQueueEvents[_0x6fa7('0x6')](_0x5bed83+':'+_0x3760e9['id'],_0x3760e9);VoiceQueueEvents[_0x6fa7('0x6')](_0x5bed83,_0x3760e9);_0x436723(null);};}for(var e in events){if(events[_0x6fa7('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x6fa7('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f1fc766..73ec416 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x519af7,_0xe60ec1){var _0x16f903=function(_0x309186){while(--_0x309186){_0x519af7['push'](_0x519af7['shift']());}};_0x16f903(++_0xe60ec1);}(_0x34e8,0x12c));var _0x834e=function(_0x4651e7,_0x420769){_0x4651e7=_0x4651e7-0x0;var _0x52b7e0=_0x34e8[_0x4651e7];return _0x52b7e0;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x364252,_0x12fd50){var _0x7eb8f5=function(_0x439cc6){while(--_0x439cc6){_0x364252['push'](_0x364252['shift']());}};_0x7eb8f5(++_0x12fd50);}(_0x34e8,0x12c));var _0x834e=function(_0x406a0f,_0x1e964d){_0x406a0f=_0x406a0f-0x0;var _0x2aef1a=_0x34e8[_0x406a0f];return _0x2aef1a;};'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 8c19391..72ac6f9 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 _0xc2f1=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','debug','ShowVoiceQueue','raw','lodash','moment','bluebird','../../mysqldb'];(function(_0x1fd547,_0x34945){var _0x49578e=function(_0x3b9114){while(--_0x3b9114){_0x1fd547['push'](_0x1fd547['shift']());}};_0x49578e(++_0x34945);}(_0xc2f1,0x1a9));var _0x1c2f=function(_0x401292,_0x3536ce){_0x401292=_0x401292-0x0;var _0x4c2c92=_0xc2f1[_0x401292];return _0x4c2c92;};'use strict';var _=require(_0x1c2f('0x0'));var util=require('util');var moment=require(_0x1c2f('0x1'));var BPromise=require(_0x1c2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c2f('0x3'))['db'];var utils=require(_0x1c2f('0x4'));var logger=require(_0x1c2f('0x5'))(_0x1c2f('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c2f('0x7'));var client=jayson[_0x1c2f('0x8')][_0x1c2f('0x9')]({'port':0x232a});config[_0x1c2f('0xa')]=_[_0x1c2f('0xb')](config[_0x1c2f('0xa')],{'host':_0x1c2f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c2f('0xd'))[_0x1c2f('0xe')](socket);function respondWithRpcPromise(_0x28a468,_0x41768d,_0x1af485){return new BPromise(function(_0x45b889,_0x1639d4){return client[_0x1c2f('0xf')](_0x28a468,_0x1af485)[_0x1c2f('0x10')](function(_0x46e967){logger['info'](_0x1c2f('0x11'),_0x41768d,'request\x20sent');logger['debug'](_0x1c2f('0x12'),_0x41768d,_0x1c2f('0x13'),JSON[_0x1c2f('0x14')](_0x46e967));if(_0x46e967[_0x1c2f('0x15')]){if(_0x46e967[_0x1c2f('0x15')]['code']===0x1f4){logger[_0x1c2f('0x15')](_0x1c2f('0x11'),_0x41768d,_0x46e967[_0x1c2f('0x15')]['message']);return _0x1639d4(_0x46e967[_0x1c2f('0x15')][_0x1c2f('0x16')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x41768d,_0x46e967['error']['message']);return _0x45b889(_0x46e967[_0x1c2f('0x15')][_0x1c2f('0x16')]);}else{logger[_0x1c2f('0x17')](_0x1c2f('0x11'),_0x41768d,_0x1c2f('0x13'));_0x45b889(_0x46e967[_0x1c2f('0x18')][_0x1c2f('0x16')]);}})[_0x1c2f('0x19')](function(_0x4f90d9){logger[_0x1c2f('0x15')](_0x1c2f('0x11'),_0x41768d,_0x4f90d9);_0x1639d4(_0x4f90d9);});});}exports[_0x1c2f('0x1a')]=function(_0x194371){var _0x1ef671=this;return new Promise(function(_0x54ead5,_0x587444){return db[_0x1c2f('0x1b')][_0x1c2f('0x1c')]({'raw':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')][_0x1c2f('0x1e')]||null:null,'attributes':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')]['attributes']||null:null,'limit':_0x194371[_0x1c2f('0x1d')]?_0x194371['options'][_0x1c2f('0x1f')]||null:null,'include':_0x194371[_0x1c2f('0x1d')]?_0x194371[_0x1c2f('0x1d')][_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0x194371['options'][_0x1c2f('0x20')],function(_0x2d0497){return{'model':db[_0x2d0497[_0x1c2f('0x22')]],'as':_0x2d0497['as'],'attributes':_0x2d0497[_0x1c2f('0x23')],'include':_0x2d0497[_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0x2d0497['include'],function(_0xdaa658){return{'model':db[_0xdaa658['model']],'as':_0xdaa658['as'],'attributes':_0xdaa658['attributes'],'include':_0xdaa658[_0x1c2f('0x20')]?_[_0x1c2f('0x21')](_0xdaa658[_0x1c2f('0x20')],function(_0x3e8071){return{'model':db[_0x3e8071[_0x1c2f('0x22')]],'as':_0x3e8071['as'],'attributes':_0x3e8071[_0x1c2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1c2f('0x10')](function(_0xacfb0){logger['info'](_0x1c2f('0x1a'),_0x194371);logger[_0x1c2f('0x24')](_0x1c2f('0x1a'),_0x194371,JSON[_0x1c2f('0x14')](_0xacfb0));_0x54ead5(_0xacfb0);})['catch'](function(_0x5bb949){logger[_0x1c2f('0x15')]('GetVoiceQueue',_0x5bb949[_0x1c2f('0x16')],_0x194371);_0x587444(_0x1ef671['error'](0x1f4,_0x5bb949[_0x1c2f('0x16')]));});});};exports[_0x1c2f('0x25')]=function(_0x407a0b){var _0x3bc466=this;return new Promise(function(_0x28ee2c,_0x3276f9){return db[_0x1c2f('0x1b')]['find']({'raw':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x26')]===undefined?!![]:![]:!![],'where':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x1e')]||null:null,'attributes':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x23')]||null:null,'include':_0x407a0b[_0x1c2f('0x1d')]?_0x407a0b[_0x1c2f('0x1d')]['include']?_[_0x1c2f('0x21')](_0x407a0b[_0x1c2f('0x1d')][_0x1c2f('0x20')],function(_0x12420b){return{'model':db[_0x12420b[_0x1c2f('0x22')]],'as':_0x12420b['as'],'attributes':_0x12420b[_0x1c2f('0x23')],'include':_0x12420b[_0x1c2f('0x20')]?_['map'](_0x12420b[_0x1c2f('0x20')],function(_0x30b9a6){return{'model':db[_0x30b9a6[_0x1c2f('0x22')]],'as':_0x30b9a6['as'],'attributes':_0x30b9a6[_0x1c2f('0x23')],'include':_0x30b9a6['include']?_[_0x1c2f('0x21')](_0x30b9a6[_0x1c2f('0x20')],function(_0x1411a8){return{'model':db[_0x1411a8['model']],'as':_0x1411a8['as'],'attributes':_0x1411a8[_0x1c2f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x1c2f('0x10')](function(_0x3e46cf){logger[_0x1c2f('0x17')]('ShowVoiceQueue',_0x407a0b);logger[_0x1c2f('0x24')](_0x1c2f('0x25'),_0x407a0b,JSON[_0x1c2f('0x14')](_0x3e46cf));_0x28ee2c(_0x3e46cf);})[_0x1c2f('0x19')](function(_0xb6a3e0){logger[_0x1c2f('0x15')](_0x1c2f('0x25'),_0xb6a3e0['message'],_0x407a0b);_0x3276f9(_0x3bc466[_0x1c2f('0x15')](0x1f4,_0xb6a3e0[_0x1c2f('0x16')]));});});}; \ No newline at end of file +var _0xbd9f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x37a1bd,_0x4bc832){var _0x42f356=function(_0x2122f4){while(--_0x2122f4){_0x37a1bd['push'](_0x37a1bd['shift']());}};_0x42f356(++_0x4bc832);}(_0xbd9f,0x121));var _0xfbd9=function(_0x5ac45b,_0x5b1f51){_0x5ac45b=_0x5ac45b-0x0;var _0x67fb=_0xbd9f[_0x5ac45b];return _0x67fb;};'use strict';var _=require(_0xfbd9('0x0'));var util=require(_0xfbd9('0x1'));var moment=require('moment');var BPromise=require(_0xfbd9('0x2'));var rs=require(_0xfbd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfbd9('0x4'))['db'];var utils=require(_0xfbd9('0x5'));var logger=require(_0xfbd9('0x6'))(_0xfbd9('0x7'));var config=require(_0xfbd9('0x8'));var jayson=require(_0xfbd9('0x9'));var client=jayson[_0xfbd9('0xa')]['http']({'port':0x232a});config[_0xfbd9('0xb')]=_[_0xfbd9('0xc')](config[_0xfbd9('0xb')],{'host':_0xfbd9('0xd'),'port':0x18eb});var socket=require(_0xfbd9('0xe'))(new Redis(config[_0xfbd9('0xb')]));require(_0xfbd9('0xf'))[_0xfbd9('0x10')](socket);function respondWithRpcPromise(_0x86e030,_0x1f0888,_0x3abd8b){return new BPromise(function(_0xa68664,_0x1cb9be){return client[_0xfbd9('0x11')](_0x86e030,_0x3abd8b)[_0xfbd9('0x12')](function(_0x14fec0){logger[_0xfbd9('0x13')](_0xfbd9('0x14'),_0x1f0888,'request\x20sent');logger[_0xfbd9('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1f0888,_0xfbd9('0x16'),JSON[_0xfbd9('0x17')](_0x14fec0));if(_0x14fec0[_0xfbd9('0x18')]){if(_0x14fec0[_0xfbd9('0x18')][_0xfbd9('0x19')]===0x1f4){logger[_0xfbd9('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x1f0888,_0x14fec0['error'][_0xfbd9('0x1a')]);return _0x1cb9be(_0x14fec0[_0xfbd9('0x18')][_0xfbd9('0x1a')]);}logger['error'](_0xfbd9('0x14'),_0x1f0888,_0x14fec0[_0xfbd9('0x18')]['message']);return _0xa68664(_0x14fec0['error']['message']);}else{logger[_0xfbd9('0x13')](_0xfbd9('0x14'),_0x1f0888,_0xfbd9('0x16'));_0xa68664(_0x14fec0[_0xfbd9('0x1b')][_0xfbd9('0x1a')]);}})['catch'](function(_0x41557e){logger['error'](_0xfbd9('0x14'),_0x1f0888,_0x41557e);_0x1cb9be(_0x41557e);});});}exports[_0xfbd9('0x1c')]=function(_0x126474){var _0x419477=this;return new Promise(function(_0x3dc68e,_0x43e045){return db[_0xfbd9('0x1d')][_0xfbd9('0x1e')]({'raw':_0x126474[_0xfbd9('0x1f')]?_0x126474[_0xfbd9('0x1f')][_0xfbd9('0x20')]===undefined?!![]:![]:!![],'where':_0x126474[_0xfbd9('0x1f')]?_0x126474[_0xfbd9('0x1f')][_0xfbd9('0x21')]||null:null,'attributes':_0x126474['options']?_0x126474['options'][_0xfbd9('0x22')]||null:null,'limit':_0x126474['options']?_0x126474[_0xfbd9('0x1f')][_0xfbd9('0x23')]||null:null,'include':_0x126474[_0xfbd9('0x1f')]?_0x126474[_0xfbd9('0x1f')][_0xfbd9('0x24')]?_[_0xfbd9('0x25')](_0x126474['options'][_0xfbd9('0x24')],function(_0x4531f7){return{'model':db[_0x4531f7['model']],'as':_0x4531f7['as'],'attributes':_0x4531f7[_0xfbd9('0x22')],'include':_0x4531f7[_0xfbd9('0x24')]?_['map'](_0x4531f7[_0xfbd9('0x24')],function(_0x1fa857){return{'model':db[_0x1fa857['model']],'as':_0x1fa857['as'],'attributes':_0x1fa857['attributes'],'include':_0x1fa857[_0xfbd9('0x24')]?_[_0xfbd9('0x25')](_0x1fa857[_0xfbd9('0x24')],function(_0x4ea97f){return{'model':db[_0x4ea97f[_0xfbd9('0x26')]],'as':_0x4ea97f['as'],'attributes':_0x4ea97f[_0xfbd9('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfbd9('0x12')](function(_0x4cd25e){logger[_0xfbd9('0x13')]('GetVoiceQueue',_0x126474);logger[_0xfbd9('0x15')]('GetVoiceQueue',_0x126474,JSON[_0xfbd9('0x17')](_0x4cd25e));_0x3dc68e(_0x4cd25e);})[_0xfbd9('0x27')](function(_0x3aa3c3){logger[_0xfbd9('0x18')]('GetVoiceQueue',_0x3aa3c3['message'],_0x126474);_0x43e045(_0x419477['error'](0x1f4,_0x3aa3c3['message']));});});};exports[_0xfbd9('0x28')]=function(_0x49afc6){var _0x1469af=this;return new Promise(function(_0x10b5fe,_0x4c025e){return db[_0xfbd9('0x1d')][_0xfbd9('0x29')]({'raw':_0x49afc6[_0xfbd9('0x1f')]?_0x49afc6['options'][_0xfbd9('0x20')]===undefined?!![]:![]:!![],'where':_0x49afc6['options']?_0x49afc6[_0xfbd9('0x1f')][_0xfbd9('0x21')]||null:null,'attributes':_0x49afc6[_0xfbd9('0x1f')]?_0x49afc6[_0xfbd9('0x1f')][_0xfbd9('0x22')]||null:null,'include':_0x49afc6[_0xfbd9('0x1f')]?_0x49afc6['options'][_0xfbd9('0x24')]?_['map'](_0x49afc6[_0xfbd9('0x1f')][_0xfbd9('0x24')],function(_0x16d97b){return{'model':db[_0x16d97b['model']],'as':_0x16d97b['as'],'attributes':_0x16d97b['attributes'],'include':_0x16d97b[_0xfbd9('0x24')]?_[_0xfbd9('0x25')](_0x16d97b[_0xfbd9('0x24')],function(_0x59b42f){return{'model':db[_0x59b42f[_0xfbd9('0x26')]],'as':_0x59b42f['as'],'attributes':_0x59b42f[_0xfbd9('0x22')],'include':_0x59b42f[_0xfbd9('0x24')]?_[_0xfbd9('0x25')](_0x59b42f[_0xfbd9('0x24')],function(_0x30610e){return{'model':db[_0x30610e[_0xfbd9('0x26')]],'as':_0x30610e['as'],'attributes':_0x30610e[_0xfbd9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bda09){logger[_0xfbd9('0x13')]('ShowVoiceQueue',_0x49afc6);logger[_0xfbd9('0x15')](_0xfbd9('0x28'),_0x49afc6,JSON['stringify'](_0x2bda09));_0x10b5fe(_0x2bda09);})[_0xfbd9('0x27')](function(_0x4ed3dc){logger[_0xfbd9('0x18')](_0xfbd9('0x28'),_0x4ed3dc['message'],_0x49afc6);_0x4c025e(_0x1469af[_0xfbd9('0x18')](0x1f4,_0x4ed3dc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 802dd1c..22df888 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 _0xaf2a=['length','voiceQueue:','./voiceQueue.events','save','emit','removeListener','register'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xaf2a,0x1d7));var _0xaaf2=function(_0x11a1c8,_0xf0822){_0x11a1c8=_0x11a1c8-0x0;var _0x2067f0=_0xaf2a[_0x11a1c8];return _0x2067f0;};'use strict';var VoiceQueueEvents=require(_0xaaf2('0x0'));var events=[_0xaaf2('0x1'),'remove','update'];function createListener(_0x4d01dd,_0x46a1ef){return function(_0x45bf09){_0x46a1ef[_0xaaf2('0x2')](_0x4d01dd,_0x45bf09);};}function removeListener(_0x113555,_0x453121){return function(){VoiceQueueEvents[_0xaaf2('0x3')](_0x113555,_0x453121);};}exports[_0xaaf2('0x4')]=function(_0xdc7f5b){for(var _0x13197c=0x0,_0x395a69=events[_0xaaf2('0x5')];_0x13197c<_0x395a69;_0x13197c++){var _0x3582f8=events[_0x13197c];var _0x2e4eb0=createListener(_0xaaf2('0x6')+_0x3582f8,_0xdc7f5b);VoiceQueueEvents['on'](_0x3582f8,_0x2e4eb0);}}; \ No newline at end of file +var _0x0e07=['./voiceQueue.events','save','update','emit','register','voiceQueue:'];(function(_0x340737,_0x4e773c){var _0x41e24b=function(_0x51fe2f){while(--_0x51fe2f){_0x340737['push'](_0x340737['shift']());}};_0x41e24b(++_0x4e773c);}(_0x0e07,0x150));var _0x70e0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x0e07[_0x160c73];return _0xd9302;};'use strict';var VoiceQueueEvents=require(_0x70e0('0x0'));var events=[_0x70e0('0x1'),'remove',_0x70e0('0x2')];function createListener(_0x46b502,_0x33f9f7){return function(_0x4af05b){_0x33f9f7[_0x70e0('0x3')](_0x46b502,_0x4af05b);};}function removeListener(_0x29a6a0,_0xdac50c){return function(){VoiceQueueEvents['removeListener'](_0x29a6a0,_0xdac50c);};}exports[_0x70e0('0x4')]=function(_0x362d10){for(var _0x54c9e3=0x0,_0xf47254=events['length'];_0x54c9e3<_0xf47254;_0x54c9e3++){var _0x31770d=events[_0x54c9e3];var _0x3fe016=createListener(_0x70e0('0x5')+_0x31770d,_0x362d10);VoiceQueueEvents['on'](_0x31770d,_0x3fe016);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ce717e6..03d8bdf 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 _0xe509=['getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x2e3a2c,_0x52ae45){var _0x1939b5=function(_0x3f0a4b){while(--_0x3f0a4b){_0x2e3a2c['push'](_0x2e3a2c['shift']());}};_0x1939b5(++_0x52ae45);}(_0xe509,0x184));var _0x9e50=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0xe509[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require('multer');var util=require(_0x9e50('0x0'));var path=require(_0x9e50('0x1'));var timeout=require(_0x9e50('0x2'));var express=require(_0x9e50('0x3'));var router=express[_0x9e50('0x4')]();var fs_extra=require(_0x9e50('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9e50('0x6'));var config=require(_0x9e50('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0x9e50('0x8')](),controller[_0x9e50('0x9')]);router[_0x9e50('0xa')]('/describe',auth[_0x9e50('0x8')](),controller['describe']);router[_0x9e50('0xa')]('/index',auth[_0x9e50('0x8')](),controller[_0x9e50('0xb')]);router[_0x9e50('0xa')](_0x9e50('0xc'),auth[_0x9e50('0x8')](),controller[_0x9e50('0xd')]);router['post']('/',auth[_0x9e50('0x8')](),controller[_0x9e50('0xe')]);router[_0x9e50('0xf')](_0x9e50('0xc'),auth[_0x9e50('0x8')](),controller['update']);router[_0x9e50('0x10')](_0x9e50('0xc'),auth['isAuthenticated'](),controller[_0x9e50('0x11')]);module[_0x9e50('0x12')]=router; \ No newline at end of file +var _0x3556=['util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','destroy','multer'];(function(_0xf2c6bb,_0x3ebb2c){var _0x4cde19=function(_0x47ce13){while(--_0x47ce13){_0xf2c6bb['push'](_0xf2c6bb['shift']());}};_0x4cde19(++_0x3ebb2c);}(_0x3556,0xa7));var _0x6355=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x3556[_0x45783c];return _0x1161da;};'use strict';var multer=require(_0x6355('0x0'));var util=require(_0x6355('0x1'));var path=require(_0x6355('0x2'));var timeout=require(_0x6355('0x3'));var express=require(_0x6355('0x4'));var router=express[_0x6355('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6355('0x6'));var config=require('../../config/environment');var controller=require(_0x6355('0x7'));router['get']('/',auth[_0x6355('0x8')](),controller[_0x6355('0x9')]);router[_0x6355('0xa')](_0x6355('0xb'),auth[_0x6355('0x8')](),controller[_0x6355('0xc')]);router[_0x6355('0xa')](_0x6355('0xd'),auth[_0x6355('0x8')](),controller[_0x6355('0xe')]);router[_0x6355('0xa')](_0x6355('0xf'),auth[_0x6355('0x8')](),controller[_0x6355('0x10')]);router[_0x6355('0x11')]('/',auth[_0x6355('0x8')](),controller[_0x6355('0x12')]);router[_0x6355('0x13')](_0x6355('0xf'),auth[_0x6355('0x8')](),controller['update']);router['delete'](_0x6355('0xf'),auth[_0x6355('0x8')](),controller[_0x6355('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 358eac9..8f31f22 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 _0xc3f7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xc3f7,0x13c));var _0x7c3f=function(_0x122354,_0x5bba72){_0x122354=_0x122354-0x0;var _0xb68790=_0xc3f7[_0x122354];return _0xb68790;};'use strict';var Sequelize=require(_0x7c3f('0x0'));var moment=require('moment');module[_0x7c3f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7c3f('0x2')]},'calleridnum':{'type':Sequelize[_0x7c3f('0x2')]},'calleridname':{'type':Sequelize[_0x7c3f('0x2')]},'queue':{'type':Sequelize[_0x7c3f('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7c3f('0x3')],'set':function(_0xb5e5ac){var _0x525e94=moment(_0xb5e5ac);var _0x3f199f=moment(this[_0x7c3f('0x4')]('queuecallerjoinAt'))['format'](_0x7c3f('0x5'));var _0x152ce1=_0x525e94[_0x7c3f('0x6')](_0x3f199f,_0x7c3f('0x7'));this[_0x7c3f('0x8')](_0x7c3f('0x9'),_0xb5e5ac);this[_0x7c3f('0x8')](_0x7c3f('0xa'),_0x152ce1||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7c3f('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7c3f('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7c3f('0x2')],'comment':_0x7c3f('0xd')},'originalposition':{'type':Sequelize[_0x7c3f('0xb')]},'channel':{'type':Sequelize[_0x7c3f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7c3f('0x2')]},'connectedlinename':{'type':Sequelize[_0x7c3f('0x2')]},'accountcode':{'type':Sequelize[_0x7c3f('0x2')]},'context':{'type':Sequelize[_0x7c3f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7c3f('0x2')]},'holdtime':{'type':Sequelize[_0x7c3f('0xb')]},'mohtime':{'type':Sequelize[_0x7c3f('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7c3f('0x2')]},'transfer':{'type':Sequelize[_0x7c3f('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7c3f('0x2')],'comment':_0x7c3f('0xe')},'transferexten':{'type':Sequelize[_0x7c3f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7c3f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7c3f('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7c3f('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4897=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x9a62de,_0x127f28){var _0x14d7b3=function(_0x23d73f){while(--_0x23d73f){_0x9a62de['push'](_0x9a62de['shift']());}};_0x14d7b3(++_0x127f28);}(_0x4897,0x72));var _0x7489=function(_0x64c9ab,_0x26dfc0){_0x64c9ab=_0x64c9ab-0x0;var _0x286546=_0x4897[_0x64c9ab];return _0x286546;};'use strict';var Sequelize=require(_0x7489('0x0'));var moment=require(_0x7489('0x1'));module['exports']={'type':{'type':Sequelize[_0x7489('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7489('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7489('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7489('0x3')],'set':function(_0x5b8cff){var _0x409390=moment(_0x5b8cff);var _0x233b4d=moment(this[_0x7489('0x4')](_0x7489('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xc9761f=_0x409390[_0x7489('0x6')](_0x233b4d,'seconds');this[_0x7489('0x7')](_0x7489('0x8'),_0x5b8cff);this['setDataValue'](_0x7489('0x9'),_0xc9761f||null);}},'position':{'type':Sequelize[_0x7489('0xa')]},'count':{'type':Sequelize[_0x7489('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x7489('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7489('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7489('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7489('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7489('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x7489('0xc')},'originalposition':{'type':Sequelize[_0x7489('0xa')]},'channel':{'type':Sequelize[_0x7489('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7489('0x2')]},'connectedlinename':{'type':Sequelize[_0x7489('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7489('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7489('0x2')]},'holdtime':{'type':Sequelize[_0x7489('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7489('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7489('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7489('0x2')],'comment':_0x7489('0xd')},'transferexten':{'type':Sequelize[_0x7489('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7489('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7489('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7489('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7489('0xa')],'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 747b520..e5319fc 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 _0x5d09=['util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','getVoiceQueuesReport','rimraf','zip-dir','request-promise','bluebird'];(function(_0xb6802,_0x657198){var _0xc796c5=function(_0x7126b6){while(--_0x7126b6){_0xb6802['push'](_0xb6802['shift']());}};_0xc796c5(++_0x657198);}(_0x5d09,0x9c));var _0x95d0=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x5d09[_0x4bc428];return _0x3ca37f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95d0('0x0'));var zipdir=require(_0x95d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95d0('0x2'));var moment=require('moment');var BPromise=require(_0x95d0('0x3'));var Mustache=require('mustache');var util=require(_0x95d0('0x4'));var path=require(_0x95d0('0x5'));var sox=require(_0x95d0('0x6'));var csv=require(_0x95d0('0x7'));var ejs=require(_0x95d0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95d0('0x9'));var squel=require('squel');var crypto=require(_0x95d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95d0('0xb'));var toCsv=require(_0x95d0('0x7'));var querystring=require(_0x95d0('0xc'));var Papa=require('papaparse');var Redis=require(_0x95d0('0xd'));var authService=require(_0x95d0('0xe'));var qs=require(_0x95d0('0xf'));var as=require(_0x95d0('0x10'));var hardwareService=require(_0x95d0('0x11'));var logger=require(_0x95d0('0x12'))(_0x95d0('0x13'));var utils=require(_0x95d0('0x14'));var config=require(_0x95d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x95d0('0x16'))['db'];config[_0x95d0('0x17')]=_[_0x95d0('0x18')](config[_0x95d0('0x17')],{'host':_0x95d0('0x19'),'port':0x18eb});var socket=require(_0x95d0('0x1a'))(new Redis(config[_0x95d0('0x17')]));require('./voiceQueueReport.socket')[_0x95d0('0x1b')](socket);function respondWithStatusCode(_0x32ab35,_0x29d613){_0x29d613=_0x29d613||0xcc;return function(_0x17f459){if(_0x17f459){return _0x32ab35['sendStatus'](_0x29d613);}return _0x32ab35[_0x95d0('0x1c')](_0x29d613)['end']();};}function respondWithResult(_0x353d6b,_0x4d8e9a){_0x4d8e9a=_0x4d8e9a||0xc8;return function(_0x5e05a1){if(_0x5e05a1){return _0x353d6b['status'](_0x4d8e9a)[_0x95d0('0x1d')](_0x5e05a1);}};}function respondWithFilteredResult(_0x115c61,_0x5c15df){return function(_0xe54ff0){if(_0xe54ff0){var _0x470d0c=typeof _0x5c15df[_0x95d0('0x1e')]===_0x95d0('0x1f')&&typeof _0x5c15df['limit']===_0x95d0('0x1f');var _0xb05510=_0xe54ff0[_0x95d0('0x20')];var _0x86f4e=_0x470d0c?0x0:_0x5c15df['offset'];var _0x24c887=_0x470d0c?_0xe54ff0[_0x95d0('0x20')]:_0x5c15df['offset']+_0x5c15df[_0x95d0('0x21')];var _0x550fab;if(_0x24c887>=_0xb05510){_0x24c887=_0xb05510;_0x550fab=0xc8;}else{_0x550fab=0xce;}_0x115c61[_0x95d0('0x1c')](_0x550fab);return _0x115c61[_0x95d0('0x22')](_0x95d0('0x23'),_0x86f4e+'-'+_0x24c887+'/'+_0xb05510)[_0x95d0('0x1d')](_0xe54ff0);}return null;};}function patchUpdates(_0x15cc39){return function(_0x57d6d8){try{jsonpatch[_0x95d0('0x24')](_0x57d6d8,_0x15cc39,!![]);}catch(_0x46d048){return BPromise[_0x95d0('0x25')](_0x46d048);}return _0x57d6d8[_0x95d0('0x26')]();};}function saveUpdates(_0x23f0a4,_0x3edaa7){return function(_0x2c1dbc){if(_0x2c1dbc){return _0x2c1dbc[_0x95d0('0x27')](_0x23f0a4)[_0x95d0('0x28')](function(_0x29cfcb){return _0x29cfcb;});}return null;};}function removeEntity(_0xc124a7,_0x531909){return function(_0x300322){if(_0x300322){return _0x300322[_0x95d0('0x29')]()[_0x95d0('0x28')](function(){_0xc124a7[_0x95d0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x411b90,_0x18f34e){return function(_0x25c615){if(!_0x25c615){_0x411b90[_0x95d0('0x2a')](0x194);}return _0x25c615;};}function handleError(_0x3c1ba7,_0x464625){_0x464625=_0x464625||0x1f4;return function(_0x329830){logger[_0x95d0('0x2b')](_0x329830[_0x95d0('0x2c')]);if(_0x329830['name']){delete _0x329830[_0x95d0('0x2d')];}_0x3c1ba7[_0x95d0('0x1c')](_0x464625)[_0x95d0('0x2e')](_0x329830);};}exports[_0x95d0('0x2f')]=function(_0xfc5c7a,_0x14ecc7){var _0x436aee={},_0x5913a0={},_0x1d135e={'count':0x0,'rows':[]};var _0x36d2e3=_[_0x95d0('0x30')](db[_0x95d0('0x31')][_0x95d0('0x32')],function(_0x438778){return{'name':_0x438778[_0x95d0('0x33')],'type':_0x438778[_0x95d0('0x34')][_0x95d0('0x35')]};});_0x5913a0['model']=_[_0x95d0('0x30')](_0x36d2e3,_0x95d0('0x2d'));_0x5913a0[_0x95d0('0x36')]=_[_0x95d0('0x37')](_0xfc5c7a[_0x95d0('0x36')]);_0x5913a0[_0x95d0('0x38')]=_[_0x95d0('0x39')](_0x5913a0[_0x95d0('0x3a')],_0x5913a0['query']);_0x436aee[_0x95d0('0x3b')]=_[_0x95d0('0x39')](_0x5913a0[_0x95d0('0x3a')],qs[_0x95d0('0x3c')](_0xfc5c7a['query'][_0x95d0('0x3c')]));_0x436aee[_0x95d0('0x3b')]=_0x436aee[_0x95d0('0x3b')][_0x95d0('0x3d')]?_0x436aee[_0x95d0('0x3b')]:_0x5913a0[_0x95d0('0x3a')];if(!_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x3e')](_0x95d0('0x3f'))){_0x436aee['limit']=qs[_0x95d0('0x21')](_0xfc5c7a[_0x95d0('0x36')]['limit']);_0x436aee[_0x95d0('0x1e')]=qs[_0x95d0('0x1e')](_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x1e')]);}_0x436aee[_0x95d0('0x40')]=qs['sort'](_0xfc5c7a['query']['sort']);_0x436aee[_0x95d0('0x41')]=qs[_0x95d0('0x38')](_[_0x95d0('0x42')](_0xfc5c7a[_0x95d0('0x36')],_0x5913a0[_0x95d0('0x38')]),_0x36d2e3);if(_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x43')]){_0x436aee['where']=_[_0x95d0('0x44')](_0x436aee[_0x95d0('0x41')],{'$or':_[_0x95d0('0x30')](_0x36d2e3,function(_0x51f2ba){if(_0x51f2ba[_0x95d0('0x34')]!=='VIRTUAL'){var _0x3a8151={};_0x3a8151[_0x51f2ba[_0x95d0('0x2d')]]={'$like':'%'+_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x43')]+'%'};return _0x3a8151;}})});}_0x436aee=_[_0x95d0('0x44')]({},_0x436aee,_0xfc5c7a[_0x95d0('0x45')]);var _0x82550e={'where':_0x436aee[_0x95d0('0x41')]};return db[_0x95d0('0x31')][_0x95d0('0x20')](_0x82550e)[_0x95d0('0x28')](function(_0x3b5225){_0x1d135e[_0x95d0('0x20')]=_0x3b5225;if(_0xfc5c7a[_0x95d0('0x36')][_0x95d0('0x46')]){_0x436aee['include']=[{'all':!![]}];}return db[_0x95d0('0x31')][_0x95d0('0x47')](_0x436aee);})[_0x95d0('0x28')](function(_0xaa437a){_0x1d135e[_0x95d0('0x48')]=_0xaa437a;return _0x1d135e;})[_0x95d0('0x28')](respondWithFilteredResult(_0x14ecc7,_0x436aee))[_0x95d0('0x49')](handleError(_0x14ecc7,null));};exports['show']=function(_0x4a55d3,_0x57f3c1){var _0xe4cbf3={'raw':![],'where':{'id':_0x4a55d3['params']['id']}},_0x19c71e={};_0x19c71e[_0x95d0('0x3a')]=_[_0x95d0('0x37')](db['VoiceQueueReport'][_0x95d0('0x32')]);_0x19c71e[_0x95d0('0x36')]=_['keys'](_0x4a55d3[_0x95d0('0x36')]);_0x19c71e['filters']=_[_0x95d0('0x39')](_0x19c71e[_0x95d0('0x3a')],_0x19c71e[_0x95d0('0x36')]);_0xe4cbf3[_0x95d0('0x3b')]=_[_0x95d0('0x39')](_0x19c71e['model'],qs[_0x95d0('0x3c')](_0x4a55d3[_0x95d0('0x36')][_0x95d0('0x3c')]));_0xe4cbf3[_0x95d0('0x3b')]=_0xe4cbf3[_0x95d0('0x3b')][_0x95d0('0x3d')]?_0xe4cbf3[_0x95d0('0x3b')]:_0x19c71e[_0x95d0('0x3a')];if(_0x4a55d3[_0x95d0('0x36')][_0x95d0('0x46')]){_0xe4cbf3[_0x95d0('0x4a')]=[{'all':!![]}];}_0xe4cbf3=_['merge']({},_0xe4cbf3,_0x4a55d3[_0x95d0('0x45')]);return db[_0x95d0('0x31')][_0x95d0('0x4b')](_0xe4cbf3)[_0x95d0('0x28')](handleEntityNotFound(_0x57f3c1,null))[_0x95d0('0x28')](respondWithResult(_0x57f3c1,null))[_0x95d0('0x49')](handleError(_0x57f3c1,null));};exports[_0x95d0('0x4c')]=function(_0x247f1f,_0x1325af){return db[_0x95d0('0x31')][_0x95d0('0x4c')](_0x247f1f[_0x95d0('0x4d')],{})[_0x95d0('0x28')](respondWithResult(_0x1325af,0xc9))[_0x95d0('0x49')](handleError(_0x1325af,null));};exports[_0x95d0('0x27')]=function(_0x58d916,_0x21b253){if(_0x58d916['body']['id']){delete _0x58d916[_0x95d0('0x4d')]['id'];}return db[_0x95d0('0x31')][_0x95d0('0x4b')]({'where':{'id':_0x58d916[_0x95d0('0x4e')]['id']}})[_0x95d0('0x28')](handleEntityNotFound(_0x21b253,null))[_0x95d0('0x28')](saveUpdates(_0x58d916[_0x95d0('0x4d')],null))[_0x95d0('0x28')](respondWithResult(_0x21b253,null))[_0x95d0('0x49')](handleError(_0x21b253,null));};exports[_0x95d0('0x29')]=function(_0x36a9e2,_0x512f2d){return db[_0x95d0('0x31')][_0x95d0('0x4b')]({'where':{'id':_0x36a9e2['params']['id']}})['then'](handleEntityNotFound(_0x512f2d,null))[_0x95d0('0x28')](removeEntity(_0x512f2d,null))[_0x95d0('0x49')](handleError(_0x512f2d,null));};exports['describe']=function(_0x26dfe9,_0xc42282){return db[_0x95d0('0x31')]['describe']()[_0x95d0('0x28')](respondWithResult(_0xc42282,null))['catch'](handleError(_0xc42282,null));};exports[_0x95d0('0x4f')]=function(_0x5aef16,_0x484ffb){var _0x41dcb3={},_0x49345a={},_0x22fdf4={'count':0x0,'rows':[]};_0x49345a[_0x95d0('0x3a')]=_[_0x95d0('0x37')](db[_0x95d0('0x31')]['rawAttributes']);_0x49345a['query']=_[_0x95d0('0x37')](_0x5aef16[_0x95d0('0x36')]);_0x49345a[_0x95d0('0x38')]=_[_0x95d0('0x39')](_0x49345a[_0x95d0('0x3a')],_0x49345a[_0x95d0('0x36')]);_0x41dcb3['attributes']=_[_0x95d0('0x39')](_0x49345a[_0x95d0('0x3a')],qs['fields'](_0x5aef16[_0x95d0('0x36')]['fields']));_0x41dcb3['attributes']=_0x41dcb3[_0x95d0('0x3b')]['length']?_0x41dcb3['attributes']:_0x49345a[_0x95d0('0x3a')];if(!_0x5aef16['query']['hasOwnProperty'](_0x95d0('0x3f'))){_0x41dcb3[_0x95d0('0x21')]=qs[_0x95d0('0x21')](_0x5aef16[_0x95d0('0x36')][_0x95d0('0x21')]);_0x41dcb3[_0x95d0('0x1e')]=qs['offset'](_0x5aef16[_0x95d0('0x36')][_0x95d0('0x1e')]);}_0x41dcb3[_0x95d0('0x40')]=qs['sort'](_0x5aef16[_0x95d0('0x36')]['sort']);_0x41dcb3['where']=qs['filters'](_[_0x95d0('0x42')](_0x5aef16[_0x95d0('0x36')],_0x49345a[_0x95d0('0x38')]));if(_0x5aef16[_0x95d0('0x36')][_0x95d0('0x43')]){_0x41dcb3[_0x95d0('0x41')]=_['merge'](_0x41dcb3[_0x95d0('0x41')],{'$or':_[_0x95d0('0x30')](_0x41dcb3[_0x95d0('0x3b')],function(_0x4b0413){var _0x451a1f={};_0x451a1f[_0x4b0413]={'$like':'%'+_0x5aef16[_0x95d0('0x36')][_0x95d0('0x43')]+'%'};return _0x451a1f;})});}_0x41dcb3=_[_0x95d0('0x44')]({},_0x41dcb3,_0x5aef16[_0x95d0('0x45')]);var _0x37c84b={'where':_0x41dcb3[_0x95d0('0x41')]};return db[_0x95d0('0x31')]['count'](_0x37c84b)[_0x95d0('0x28')](function(_0x1e5ddb){_0x22fdf4[_0x95d0('0x20')]=_0x1e5ddb;if(_0x5aef16['query']['includeAll']){_0x41dcb3['include']=[{'all':!![]}];}return db[_0x95d0('0x31')]['findAll'](_0x41dcb3);})[_0x95d0('0x28')](function(_0xeb4550){_0x22fdf4[_0x95d0('0x48')]=_0xeb4550;return _0x22fdf4;})[_0x95d0('0x28')](respondWithFilteredResult(_0x484ffb,_0x41dcb3,_0x95d0('0x4f')))['catch'](handleError(_0x484ffb,null,_0x95d0('0x4f')));}; \ No newline at end of file +var _0x4fc6=['../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','destroy','params','describe','getVoiceQueuesReport','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x4fc6,0x1bc));var _0x64fc=function(_0x16e007,_0x214a1c){_0x16e007=_0x16e007-0x0;var _0x5daeac=_0x4fc6[_0x16e007];return _0x5daeac;};'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(_0x64fc('0x0'));var moment=require(_0x64fc('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x64fc('0x2'));var util=require(_0x64fc('0x3'));var path=require(_0x64fc('0x4'));var sox=require('sox');var csv=require(_0x64fc('0x5'));var ejs=require(_0x64fc('0x6'));var fs=require('fs');var fs_extra=require(_0x64fc('0x7'));var _=require(_0x64fc('0x8'));var squel=require(_0x64fc('0x9'));var crypto=require(_0x64fc('0xa'));var jsforce=require(_0x64fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x64fc('0x5'));var querystring=require(_0x64fc('0xc'));var Papa=require('papaparse');var Redis=require(_0x64fc('0xd'));var authService=require(_0x64fc('0xe'));var qs=require(_0x64fc('0xf'));var as=require(_0x64fc('0x10'));var hardwareService=require(_0x64fc('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x64fc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x64fc('0x13'));var db=require('../../mysqldb')['db'];config[_0x64fc('0x14')]=_[_0x64fc('0x15')](config[_0x64fc('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x64fc('0x16'))(new Redis(config[_0x64fc('0x14')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x5f20ee,_0x50e2a0){_0x50e2a0=_0x50e2a0||0xcc;return function(_0x46e809){if(_0x46e809){return _0x5f20ee[_0x64fc('0x17')](_0x50e2a0);}return _0x5f20ee[_0x64fc('0x18')](_0x50e2a0)[_0x64fc('0x19')]();};}function respondWithResult(_0x49bd68,_0x175846){_0x175846=_0x175846||0xc8;return function(_0x2e24e8){if(_0x2e24e8){return _0x49bd68['status'](_0x175846)[_0x64fc('0x1a')](_0x2e24e8);}};}function respondWithFilteredResult(_0x2ad7a3,_0x48c8e2){return function(_0x33937f){if(_0x33937f){var _0x31b414=typeof _0x48c8e2[_0x64fc('0x1b')]===_0x64fc('0x1c')&&typeof _0x48c8e2[_0x64fc('0x1d')]===_0x64fc('0x1c');var _0x25c231=_0x33937f[_0x64fc('0x1e')];var _0x365588=_0x31b414?0x0:_0x48c8e2['offset'];var _0x2b5528=_0x31b414?_0x33937f[_0x64fc('0x1e')]:_0x48c8e2[_0x64fc('0x1b')]+_0x48c8e2[_0x64fc('0x1d')];var _0xfb09ed;if(_0x2b5528>=_0x25c231){_0x2b5528=_0x25c231;_0xfb09ed=0xc8;}else{_0xfb09ed=0xce;}_0x2ad7a3[_0x64fc('0x18')](_0xfb09ed);return _0x2ad7a3[_0x64fc('0x1f')](_0x64fc('0x20'),_0x365588+'-'+_0x2b5528+'/'+_0x25c231)[_0x64fc('0x1a')](_0x33937f);}return null;};}function patchUpdates(_0x4fa6ca){return function(_0xa77470){try{jsonpatch['apply'](_0xa77470,_0x4fa6ca,!![]);}catch(_0x36b6f3){return BPromise[_0x64fc('0x21')](_0x36b6f3);}return _0xa77470[_0x64fc('0x22')]();};}function saveUpdates(_0x3706c5,_0x5e170d){return function(_0x101b46){if(_0x101b46){return _0x101b46[_0x64fc('0x23')](_0x3706c5)[_0x64fc('0x24')](function(_0x466835){return _0x466835;});}return null;};}function removeEntity(_0x3fc81b,_0x1682b4){return function(_0xbec66c){if(_0xbec66c){return _0xbec66c['destroy']()[_0x64fc('0x24')](function(){_0x3fc81b[_0x64fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe5588,_0x2c325c){return function(_0x353f3f){if(!_0x353f3f){_0xfe5588['sendStatus'](0x194);}return _0x353f3f;};}function handleError(_0x5dbbc2,_0x28623e){_0x28623e=_0x28623e||0x1f4;return function(_0x496f62){logger[_0x64fc('0x25')](_0x496f62[_0x64fc('0x26')]);if(_0x496f62['name']){delete _0x496f62['name'];}_0x5dbbc2[_0x64fc('0x18')](_0x28623e)[_0x64fc('0x27')](_0x496f62);};}exports[_0x64fc('0x28')]=function(_0x216daa,_0x247cb2){var _0x1271d8={},_0x160a61={},_0x17d273={'count':0x0,'rows':[]};var _0x3253ac=_[_0x64fc('0x29')](db['VoiceQueueReport'][_0x64fc('0x2a')],function(_0x543662){return{'name':_0x543662[_0x64fc('0x2b')],'type':_0x543662[_0x64fc('0x2c')][_0x64fc('0x2d')]};});_0x160a61[_0x64fc('0x2e')]=_['map'](_0x3253ac,_0x64fc('0x2f'));_0x160a61['query']=_[_0x64fc('0x30')](_0x216daa[_0x64fc('0x31')]);_0x160a61[_0x64fc('0x32')]=_['intersection'](_0x160a61[_0x64fc('0x2e')],_0x160a61[_0x64fc('0x31')]);_0x1271d8[_0x64fc('0x33')]=_['intersection'](_0x160a61[_0x64fc('0x2e')],qs[_0x64fc('0x34')](_0x216daa['query'][_0x64fc('0x34')]));_0x1271d8[_0x64fc('0x33')]=_0x1271d8[_0x64fc('0x33')]['length']?_0x1271d8[_0x64fc('0x33')]:_0x160a61[_0x64fc('0x2e')];if(!_0x216daa[_0x64fc('0x31')][_0x64fc('0x35')](_0x64fc('0x36'))){_0x1271d8[_0x64fc('0x1d')]=qs[_0x64fc('0x1d')](_0x216daa['query'][_0x64fc('0x1d')]);_0x1271d8[_0x64fc('0x1b')]=qs[_0x64fc('0x1b')](_0x216daa[_0x64fc('0x31')]['offset']);}_0x1271d8[_0x64fc('0x37')]=qs[_0x64fc('0x38')](_0x216daa[_0x64fc('0x31')][_0x64fc('0x38')]);_0x1271d8[_0x64fc('0x39')]=qs[_0x64fc('0x32')](_[_0x64fc('0x3a')](_0x216daa[_0x64fc('0x31')],_0x160a61[_0x64fc('0x32')]),_0x3253ac);if(_0x216daa[_0x64fc('0x31')]['filter']){_0x1271d8['where']=_['merge'](_0x1271d8['where'],{'$or':_[_0x64fc('0x29')](_0x3253ac,function(_0x30de97){if(_0x30de97[_0x64fc('0x2c')]!=='VIRTUAL'){var _0x5f19fa={};_0x5f19fa[_0x30de97[_0x64fc('0x2f')]]={'$like':'%'+_0x216daa[_0x64fc('0x31')][_0x64fc('0x3b')]+'%'};return _0x5f19fa;}})});}_0x1271d8=_[_0x64fc('0x3c')]({},_0x1271d8,_0x216daa[_0x64fc('0x3d')]);var _0x4b3538={'where':_0x1271d8[_0x64fc('0x39')]};return db[_0x64fc('0x3e')][_0x64fc('0x1e')](_0x4b3538)['then'](function(_0x1a26bc){_0x17d273[_0x64fc('0x1e')]=_0x1a26bc;if(_0x216daa['query'][_0x64fc('0x3f')]){_0x1271d8[_0x64fc('0x40')]=[{'all':!![]}];}return db[_0x64fc('0x3e')][_0x64fc('0x41')](_0x1271d8);})[_0x64fc('0x24')](function(_0x3c341d){_0x17d273[_0x64fc('0x42')]=_0x3c341d;return _0x17d273;})[_0x64fc('0x24')](respondWithFilteredResult(_0x247cb2,_0x1271d8))[_0x64fc('0x43')](handleError(_0x247cb2,null));};exports[_0x64fc('0x44')]=function(_0x2f1404,_0x45e4bb){var _0x9692d7={'raw':![],'where':{'id':_0x2f1404['params']['id']}},_0x8dc950={};_0x8dc950[_0x64fc('0x2e')]=_[_0x64fc('0x30')](db[_0x64fc('0x3e')][_0x64fc('0x2a')]);_0x8dc950[_0x64fc('0x31')]=_[_0x64fc('0x30')](_0x2f1404[_0x64fc('0x31')]);_0x8dc950[_0x64fc('0x32')]=_[_0x64fc('0x45')](_0x8dc950[_0x64fc('0x2e')],_0x8dc950[_0x64fc('0x31')]);_0x9692d7[_0x64fc('0x33')]=_[_0x64fc('0x45')](_0x8dc950[_0x64fc('0x2e')],qs[_0x64fc('0x34')](_0x2f1404[_0x64fc('0x31')][_0x64fc('0x34')]));_0x9692d7[_0x64fc('0x33')]=_0x9692d7['attributes']['length']?_0x9692d7[_0x64fc('0x33')]:_0x8dc950[_0x64fc('0x2e')];if(_0x2f1404['query']['includeAll']){_0x9692d7[_0x64fc('0x40')]=[{'all':!![]}];}_0x9692d7=_[_0x64fc('0x3c')]({},_0x9692d7,_0x2f1404[_0x64fc('0x3d')]);return db[_0x64fc('0x3e')][_0x64fc('0x46')](_0x9692d7)[_0x64fc('0x24')](handleEntityNotFound(_0x45e4bb,null))[_0x64fc('0x24')](respondWithResult(_0x45e4bb,null))[_0x64fc('0x43')](handleError(_0x45e4bb,null));};exports[_0x64fc('0x47')]=function(_0x2cfa26,_0x22aab7){return db[_0x64fc('0x3e')][_0x64fc('0x47')](_0x2cfa26[_0x64fc('0x48')],{})[_0x64fc('0x24')](respondWithResult(_0x22aab7,0xc9))['catch'](handleError(_0x22aab7,null));};exports[_0x64fc('0x23')]=function(_0x501d59,_0x326efe){if(_0x501d59[_0x64fc('0x48')]['id']){delete _0x501d59[_0x64fc('0x48')]['id'];}return db[_0x64fc('0x3e')][_0x64fc('0x46')]({'where':{'id':_0x501d59['params']['id']}})[_0x64fc('0x24')](handleEntityNotFound(_0x326efe,null))['then'](saveUpdates(_0x501d59[_0x64fc('0x48')],null))[_0x64fc('0x24')](respondWithResult(_0x326efe,null))[_0x64fc('0x43')](handleError(_0x326efe,null));};exports[_0x64fc('0x49')]=function(_0x24d6a5,_0x191e67){return db['VoiceQueueReport'][_0x64fc('0x46')]({'where':{'id':_0x24d6a5[_0x64fc('0x4a')]['id']}})[_0x64fc('0x24')](handleEntityNotFound(_0x191e67,null))[_0x64fc('0x24')](removeEntity(_0x191e67,null))['catch'](handleError(_0x191e67,null));};exports[_0x64fc('0x4b')]=function(_0x3423d4,_0x23339e){return db[_0x64fc('0x3e')][_0x64fc('0x4b')]()[_0x64fc('0x24')](respondWithResult(_0x23339e,null))[_0x64fc('0x43')](handleError(_0x23339e,null));};exports[_0x64fc('0x4c')]=function(_0x354e74,_0x25e96f){var _0x651ee3={},_0x2e9b1d={},_0x55730f={'count':0x0,'rows':[]};_0x2e9b1d['model']=_[_0x64fc('0x30')](db[_0x64fc('0x3e')][_0x64fc('0x2a')]);_0x2e9b1d[_0x64fc('0x31')]=_[_0x64fc('0x30')](_0x354e74[_0x64fc('0x31')]);_0x2e9b1d[_0x64fc('0x32')]=_[_0x64fc('0x45')](_0x2e9b1d[_0x64fc('0x2e')],_0x2e9b1d[_0x64fc('0x31')]);_0x651ee3['attributes']=_[_0x64fc('0x45')](_0x2e9b1d[_0x64fc('0x2e')],qs['fields'](_0x354e74[_0x64fc('0x31')][_0x64fc('0x34')]));_0x651ee3[_0x64fc('0x33')]=_0x651ee3[_0x64fc('0x33')]['length']?_0x651ee3[_0x64fc('0x33')]:_0x2e9b1d[_0x64fc('0x2e')];if(!_0x354e74[_0x64fc('0x31')][_0x64fc('0x35')](_0x64fc('0x36'))){_0x651ee3[_0x64fc('0x1d')]=qs[_0x64fc('0x1d')](_0x354e74['query'][_0x64fc('0x1d')]);_0x651ee3[_0x64fc('0x1b')]=qs['offset'](_0x354e74['query']['offset']);}_0x651ee3['order']=qs['sort'](_0x354e74[_0x64fc('0x31')][_0x64fc('0x38')]);_0x651ee3[_0x64fc('0x39')]=qs[_0x64fc('0x32')](_[_0x64fc('0x3a')](_0x354e74[_0x64fc('0x31')],_0x2e9b1d[_0x64fc('0x32')]));if(_0x354e74[_0x64fc('0x31')][_0x64fc('0x3b')]){_0x651ee3[_0x64fc('0x39')]=_[_0x64fc('0x3c')](_0x651ee3[_0x64fc('0x39')],{'$or':_[_0x64fc('0x29')](_0x651ee3[_0x64fc('0x33')],function(_0x52b4f0){var _0x40bb97={};_0x40bb97[_0x52b4f0]={'$like':'%'+_0x354e74[_0x64fc('0x31')]['filter']+'%'};return _0x40bb97;})});}_0x651ee3=_[_0x64fc('0x3c')]({},_0x651ee3,_0x354e74['options']);var _0x29341e={'where':_0x651ee3[_0x64fc('0x39')]};return db[_0x64fc('0x3e')][_0x64fc('0x1e')](_0x29341e)[_0x64fc('0x24')](function(_0x5ea29f){_0x55730f[_0x64fc('0x1e')]=_0x5ea29f;if(_0x354e74[_0x64fc('0x31')][_0x64fc('0x3f')]){_0x651ee3[_0x64fc('0x40')]=[{'all':!![]}];}return db[_0x64fc('0x3e')][_0x64fc('0x41')](_0x651ee3);})[_0x64fc('0x24')](function(_0x38a4bb){_0x55730f[_0x64fc('0x42')]=_0x38a4bb;return _0x55730f;})['then'](respondWithFilteredResult(_0x25e96f,_0x651ee3,_0x64fc('0x4c')))[_0x64fc('0x43')](handleError(_0x25e96f,null,_0x64fc('0x4c')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 11ab958..da45269 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 _0x582f=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x488b82,_0x3893ef){var _0x5c43dd=function(_0x1f5a98){while(--_0x1f5a98){_0x488b82['push'](_0x488b82['shift']());}};_0x5c43dd(++_0x3893ef);}(_0x582f,0x15d));var _0xf582=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x582f[_0x462999];return _0x4b1366;};'use strict';var EventEmitter=require(_0xf582('0x0'));var VoiceQueueReport=require(_0xf582('0x1'))['db'][_0xf582('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf582('0x3')](0x0);var events={'afterCreate':_0xf582('0x4'),'afterUpdate':_0xf582('0x5'),'afterDestroy':_0xf582('0x6')};function emitEvent(_0x52a13f){return function(_0x51b7e6,_0x4bb7cd,_0x438723){VoiceQueueReportEvents['emit'](_0x52a13f+':'+_0x51b7e6['id'],_0x51b7e6);VoiceQueueReportEvents[_0xf582('0x7')](_0x52a13f,_0x51b7e6);_0x438723(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xf582('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x25e4=['hasOwnProperty','events','../../mysqldb','VoiceQueueReport','save','remove','emit'];(function(_0x433e29,_0x14b418){var _0x84abd4=function(_0x232635){while(--_0x232635){_0x433e29['push'](_0x433e29['shift']());}};_0x84abd4(++_0x14b418);}(_0x25e4,0x135));var _0x425e=function(_0x40293e,_0x3f86cd){_0x40293e=_0x40293e-0x0;var _0x10ec22=_0x25e4[_0x40293e];return _0x10ec22;};'use strict';var EventEmitter=require(_0x425e('0x0'));var VoiceQueueReport=require(_0x425e('0x1'))['db'][_0x425e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x425e('0x3'),'afterUpdate':'update','afterDestroy':_0x425e('0x4')};function emitEvent(_0x58e262){return function(_0x201ea4,_0x1bf8dd,_0x380b36){VoiceQueueReportEvents[_0x425e('0x5')](_0x58e262+':'+_0x201ea4['id'],_0x201ea4);VoiceQueueReportEvents[_0x425e('0x5')](_0x58e262,_0x201ea4);_0x380b36(null);};}for(var e in events){if(events[_0x425e('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 24370dd..46476ba 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 _0xff47=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport'];(function(_0x5f0034,_0x1bf6d0){var _0x35a7ea=function(_0x39332f){while(--_0x39332f){_0x5f0034['push'](_0x5f0034['shift']());}};_0x35a7ea(++_0x1bf6d0);}(_0xff47,0x1f4));var _0x7ff4=function(_0x443bdd,_0x517654){_0x443bdd=_0x443bdd-0x0;var _0x3a1e48=_0xff47[_0x443bdd];return _0x3a1e48;};'use strict';var _=require(_0x7ff4('0x0'));var util=require(_0x7ff4('0x1'));var logger=require('../../config/logger')(_0x7ff4('0x2'));var moment=require('moment');var BPromise=require(_0x7ff4('0x3'));var rp=require(_0x7ff4('0x4'));var fs=require('fs');var path=require(_0x7ff4('0x5'));var rimraf=require(_0x7ff4('0x6'));var config=require(_0x7ff4('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0x7ff4('0x8')]=function(_0x5b0db7,_0x326859){return _0x5b0db7['define'](_0x7ff4('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb31=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','report_queue','uniqueid','lodash'];(function(_0x2265e6,_0x131794){var _0x50c937=function(_0x31a78b){while(--_0x31a78b){_0x2265e6['push'](_0x2265e6['shift']());}};_0x50c937(++_0x131794);}(_0xcb31,0xe6));var _0x1cb3=function(_0x366c46,_0x2132fd){_0x366c46=_0x366c46-0x0;var _0x53b39c=_0xcb31[_0x366c46];return _0x53b39c;};'use strict';var _=require(_0x1cb3('0x0'));var util=require(_0x1cb3('0x1'));var logger=require(_0x1cb3('0x2'))(_0x1cb3('0x3'));var moment=require('moment');var BPromise=require(_0x1cb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1cb3('0x5'));var config=require(_0x1cb3('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x1cb3('0x7')]=function(_0x263a7d,_0xd1cc36){return _0x263a7d[_0x1cb3('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x1cb3('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb3('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 961c192..aa74877 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 _0x5427=['raw','options','limit','map','include','model','attributes','CreateVoiceQueueReport','body','catch','UpdateVoiceQueueReport','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll'];(function(_0x57c1a9,_0x2f5b60){var _0x1072ec=function(_0x58d22f){while(--_0x58d22f){_0x57c1a9['push'](_0x57c1a9['shift']());}};_0x1072ec(++_0x2f5b60);}(_0x5427,0xe3));var _0x7542=function(_0x539373,_0xeb40a7){_0x539373=_0x539373-0x0;var _0x35182a=_0x5427[_0x539373];return _0x35182a;};'use strict';var _=require(_0x7542('0x0'));var util=require(_0x7542('0x1'));var moment=require(_0x7542('0x2'));var BPromise=require('bluebird');var rs=require(_0x7542('0x3'));var fs=require('fs');var Redis=require(_0x7542('0x4'));var db=require(_0x7542('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7542('0x6'))(_0x7542('0x7'));var config=require(_0x7542('0x8'));var jayson=require(_0x7542('0x9'));var client=jayson['client'][_0x7542('0xa')]({'port':0x232a});config[_0x7542('0xb')]=_['defaults'](config['redis'],{'host':_0x7542('0xc'),'port':0x18eb});var socket=require(_0x7542('0xd'))(new Redis(config[_0x7542('0xb')]));require(_0x7542('0xe'))[_0x7542('0xf')](socket);function respondWithRpcPromise(_0x480d8d,_0x2516ef,_0x230ec8){return new BPromise(function(_0x479371,_0x2b9201){return client[_0x7542('0x10')](_0x480d8d,_0x230ec8)[_0x7542('0x11')](function(_0x5ab460){logger[_0x7542('0x12')](_0x7542('0x13'),_0x2516ef,_0x7542('0x14'));logger[_0x7542('0x15')](_0x7542('0x16'),_0x2516ef,_0x7542('0x14'),JSON[_0x7542('0x17')](_0x5ab460));if(_0x5ab460[_0x7542('0x18')]){if(_0x5ab460[_0x7542('0x18')][_0x7542('0x19')]===0x1f4){logger[_0x7542('0x18')](_0x7542('0x13'),_0x2516ef,_0x5ab460[_0x7542('0x18')][_0x7542('0x1a')]);return _0x2b9201(_0x5ab460[_0x7542('0x18')][_0x7542('0x1a')]);}logger[_0x7542('0x18')](_0x7542('0x13'),_0x2516ef,_0x5ab460['error'][_0x7542('0x1a')]);return _0x479371(_0x5ab460[_0x7542('0x18')]['message']);}else{logger[_0x7542('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2516ef,_0x7542('0x14'));_0x479371(_0x5ab460[_0x7542('0x1b')]['message']);}})['catch'](function(_0x4fad40){logger[_0x7542('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x2516ef,_0x4fad40);_0x2b9201(_0x4fad40);});});}exports[_0x7542('0x1c')]=function(_0x30b557){var _0x29d8de=this;return new Promise(function(_0x47a1a6,_0x2c0846){return db[_0x7542('0x1d')][_0x7542('0x1e')]({'raw':_0x30b557['options']?_0x30b557['options'][_0x7542('0x1f')]===undefined?!![]:![]:!![],'where':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['where']||null:null,'attributes':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['attributes']||null:null,'limit':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')][_0x7542('0x21')]||null:null,'include':_0x30b557[_0x7542('0x20')]?_0x30b557[_0x7542('0x20')]['include']?_[_0x7542('0x22')](_0x30b557['options'][_0x7542('0x23')],function(_0x4ad8f1){return{'model':db[_0x4ad8f1[_0x7542('0x24')]],'as':_0x4ad8f1['as'],'attributes':_0x4ad8f1[_0x7542('0x25')],'include':_0x4ad8f1[_0x7542('0x23')]?_['map'](_0x4ad8f1[_0x7542('0x23')],function(_0x33bddb){return{'model':db[_0x33bddb[_0x7542('0x24')]],'as':_0x33bddb['as'],'attributes':_0x33bddb[_0x7542('0x25')],'include':_0x33bddb['include']?_['map'](_0x33bddb['include'],function(_0x3c3139){return{'model':db[_0x3c3139[_0x7542('0x24')]],'as':_0x3c3139['as'],'attributes':_0x3c3139[_0x7542('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7542('0x11')](function(_0x2e5ac3){logger[_0x7542('0x12')](_0x7542('0x1c'),_0x30b557);logger['debug'](_0x7542('0x1c'),_0x30b557,JSON['stringify'](_0x2e5ac3));_0x47a1a6(_0x2e5ac3);})['catch'](function(_0x556778){logger[_0x7542('0x18')](_0x7542('0x1c'),_0x556778[_0x7542('0x1a')],_0x30b557);_0x2c0846(_0x29d8de['error'](0x1f4,_0x556778[_0x7542('0x1a')]));});});};exports[_0x7542('0x26')]=function(_0x3bea2d){var _0x39ae21=this;return new Promise(function(_0xe77532,_0x245696){return db[_0x7542('0x1d')]['create'](_0x3bea2d[_0x7542('0x27')],{'raw':_0x3bea2d['options']?_0x3bea2d[_0x7542('0x20')][_0x7542('0x1f')]===undefined?!![]:![]:!![]})[_0x7542('0x11')](function(_0x511070){logger[_0x7542('0x12')](_0x7542('0x26'),_0x3bea2d);logger[_0x7542('0x15')](_0x7542('0x26'),_0x3bea2d,JSON[_0x7542('0x17')](_0x511070));_0xe77532(_0x511070);})[_0x7542('0x28')](function(_0x3a6591){logger[_0x7542('0x18')]('CreateVoiceQueueReport',_0x3a6591[_0x7542('0x1a')],_0x3bea2d);_0x245696(_0x39ae21[_0x7542('0x18')](0x1f4,_0x3a6591[_0x7542('0x1a')]));});});};exports[_0x7542('0x29')]=function(_0x18b9b9){var _0x4163d1=this;return new Promise(function(_0x456398,_0x249b2d){return db['VoiceQueueReport']['update'](_0x18b9b9[_0x7542('0x27')],{'raw':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9['options'][_0x7542('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9[_0x7542('0x20')][_0x7542('0x2a')]||null:null,'attributes':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9[_0x7542('0x20')][_0x7542('0x25')]||null:null,'limit':_0x18b9b9[_0x7542('0x20')]?_0x18b9b9['options'][_0x7542('0x21')]||null:null})[_0x7542('0x11')](function(_0x43042e){logger[_0x7542('0x12')](_0x7542('0x29'),_0x18b9b9);logger[_0x7542('0x15')]('UpdateVoiceQueueReport',_0x18b9b9,JSON[_0x7542('0x17')](_0x43042e));_0x456398(_0x43042e);})[_0x7542('0x28')](function(_0x4a4ea9){logger[_0x7542('0x18')](_0x7542('0x29'),_0x4a4ea9[_0x7542('0x1a')],_0x18b9b9);_0x249b2d(_0x4163d1[_0x7542('0x18')](0x1f4,_0x4a4ea9[_0x7542('0x1a')]));});});}; \ No newline at end of file +var _0x1078=['stringify','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','VoiceQueueReport,\x20%s,\x20%s','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','model','map','include','CreateVoiceQueueReport','create','body','raw'];(function(_0x136628,_0xdd3206){var _0x35aad7=function(_0x542332){while(--_0x542332){_0x136628['push'](_0x136628['shift']());}};_0x35aad7(++_0xdd3206);}(_0x1078,0x174));var _0x8107=function(_0x550e26,_0x1e1050){_0x550e26=_0x550e26-0x0;var _0x5b0782=_0x1078[_0x550e26];return _0x5b0782;};'use strict';var _=require(_0x8107('0x0'));var util=require('util');var moment=require(_0x8107('0x1'));var BPromise=require(_0x8107('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8107('0x3'));var db=require(_0x8107('0x4'))['db'];var utils=require(_0x8107('0x5'));var logger=require(_0x8107('0x6'))(_0x8107('0x7'));var config=require('../../config/environment');var jayson=require(_0x8107('0x8'));var client=jayson[_0x8107('0x9')][_0x8107('0xa')]({'port':0x232a});config[_0x8107('0xb')]=_['defaults'](config[_0x8107('0xb')],{'host':_0x8107('0xc'),'port':0x18eb});var socket=require(_0x8107('0xd'))(new Redis(config[_0x8107('0xb')]));require(_0x8107('0xe'))['register'](socket);function respondWithRpcPromise(_0x1a347e,_0x4d4418,_0x3baae1){return new BPromise(function(_0x11950f,_0x27558d){return client['request'](_0x1a347e,_0x3baae1)[_0x8107('0xf')](function(_0x849a9a){logger[_0x8107('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d4418,_0x8107('0x11'));logger[_0x8107('0x12')](_0x8107('0x13'),_0x4d4418,'request\x20sent',JSON['stringify'](_0x849a9a));if(_0x849a9a[_0x8107('0x14')]){if(_0x849a9a[_0x8107('0x14')]['code']===0x1f4){logger[_0x8107('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d4418,_0x849a9a[_0x8107('0x14')][_0x8107('0x15')]);return _0x27558d(_0x849a9a[_0x8107('0x14')][_0x8107('0x15')]);}logger[_0x8107('0x14')](_0x8107('0x16'),_0x4d4418,_0x849a9a[_0x8107('0x14')]['message']);return _0x11950f(_0x849a9a[_0x8107('0x14')][_0x8107('0x15')]);}else{logger['info'](_0x8107('0x16'),_0x4d4418,_0x8107('0x11'));_0x11950f(_0x849a9a['result'][_0x8107('0x15')]);}})[_0x8107('0x17')](function(_0x3e9df0){logger[_0x8107('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x4d4418,_0x3e9df0);_0x27558d(_0x3e9df0);});});}exports[_0x8107('0x18')]=function(_0x460c1b){var _0x2a5746=this;return new Promise(function(_0x2f023d,_0x3962ef){return db[_0x8107('0x19')][_0x8107('0x1a')]({'raw':_0x460c1b[_0x8107('0x1b')]?_0x460c1b[_0x8107('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x460c1b[_0x8107('0x1b')]?_0x460c1b[_0x8107('0x1b')][_0x8107('0x1c')]||null:null,'attributes':_0x460c1b[_0x8107('0x1b')]?_0x460c1b[_0x8107('0x1b')][_0x8107('0x1d')]||null:null,'limit':_0x460c1b['options']?_0x460c1b[_0x8107('0x1b')][_0x8107('0x1e')]||null:null,'include':_0x460c1b[_0x8107('0x1b')]?_0x460c1b[_0x8107('0x1b')]['include']?_['map'](_0x460c1b[_0x8107('0x1b')]['include'],function(_0x3254ce){return{'model':db[_0x3254ce[_0x8107('0x1f')]],'as':_0x3254ce['as'],'attributes':_0x3254ce[_0x8107('0x1d')],'include':_0x3254ce['include']?_[_0x8107('0x20')](_0x3254ce[_0x8107('0x21')],function(_0x55144b){return{'model':db[_0x55144b[_0x8107('0x1f')]],'as':_0x55144b['as'],'attributes':_0x55144b[_0x8107('0x1d')],'include':_0x55144b['include']?_[_0x8107('0x20')](_0x55144b[_0x8107('0x21')],function(_0x5d0431){return{'model':db[_0x5d0431[_0x8107('0x1f')]],'as':_0x5d0431['as'],'attributes':_0x5d0431[_0x8107('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x362a74){logger[_0x8107('0x10')]('GetVoiceQueueReport',_0x460c1b);logger[_0x8107('0x12')](_0x8107('0x18'),_0x460c1b,JSON['stringify'](_0x362a74));_0x2f023d(_0x362a74);})['catch'](function(_0x511b09){logger[_0x8107('0x14')](_0x8107('0x18'),_0x511b09[_0x8107('0x15')],_0x460c1b);_0x3962ef(_0x2a5746[_0x8107('0x14')](0x1f4,_0x511b09[_0x8107('0x15')]));});});};exports[_0x8107('0x22')]=function(_0x41425f){var _0x29556b=this;return new Promise(function(_0x447bce,_0x4944ad){return db['VoiceQueueReport'][_0x8107('0x23')](_0x41425f[_0x8107('0x24')],{'raw':_0x41425f[_0x8107('0x1b')]?_0x41425f[_0x8107('0x1b')][_0x8107('0x25')]===undefined?!![]:![]:!![]})[_0x8107('0xf')](function(_0x1c9593){logger[_0x8107('0x10')](_0x8107('0x22'),_0x41425f);logger[_0x8107('0x12')](_0x8107('0x22'),_0x41425f,JSON[_0x8107('0x26')](_0x1c9593));_0x447bce(_0x1c9593);})[_0x8107('0x17')](function(_0x48d0cd){logger['error']('CreateVoiceQueueReport',_0x48d0cd['message'],_0x41425f);_0x4944ad(_0x29556b[_0x8107('0x14')](0x1f4,_0x48d0cd[_0x8107('0x15')]));});});};exports[_0x8107('0x27')]=function(_0x3ed7d8){var _0x382edc=this;return new Promise(function(_0x5bb65d,_0x5c169b){return db['VoiceQueueReport'][_0x8107('0x28')](_0x3ed7d8[_0x8107('0x24')],{'raw':_0x3ed7d8['options']?_0x3ed7d8[_0x8107('0x1b')][_0x8107('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed7d8[_0x8107('0x1b')]?_0x3ed7d8[_0x8107('0x1b')][_0x8107('0x1c')]||null:null,'attributes':_0x3ed7d8[_0x8107('0x1b')]?_0x3ed7d8[_0x8107('0x1b')][_0x8107('0x1d')]||null:null,'limit':_0x3ed7d8[_0x8107('0x1b')]?_0x3ed7d8[_0x8107('0x1b')][_0x8107('0x1e')]||null:null})[_0x8107('0xf')](function(_0x1ce762){logger[_0x8107('0x10')](_0x8107('0x27'),_0x3ed7d8);logger[_0x8107('0x12')]('UpdateVoiceQueueReport',_0x3ed7d8,JSON[_0x8107('0x26')](_0x1ce762));_0x5bb65d(_0x1ce762);})[_0x8107('0x17')](function(_0xc81232){logger[_0x8107('0x14')](_0x8107('0x27'),_0xc81232[_0x8107('0x15')],_0x3ed7d8);_0x5c169b(_0x382edc[_0x8107('0x14')](0x1f4,_0xc81232[_0x8107('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 16a133a..ea8ffb7 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 _0x4f29=['emit','removeListener','register','length','voiceQueueReport:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f29,0xfd));var _0x94f2=function(_0x2aabc5,_0x552f4e){_0x2aabc5=_0x2aabc5-0x0;var _0x160bb6=_0x4f29[_0x2aabc5];return _0x160bb6;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x94f2('0x0'),_0x94f2('0x1'),_0x94f2('0x2')];function createListener(_0x2a6804,_0xc16ee3){return function(_0x36e06e){_0xc16ee3[_0x94f2('0x3')](_0x2a6804,_0x36e06e);};}function removeListener(_0x2a6535,_0x106798){return function(){VoiceQueueReportEvents[_0x94f2('0x4')](_0x2a6535,_0x106798);};}exports[_0x94f2('0x5')]=function(_0x493302){for(var _0x5e9216=0x0,_0xe14ba5=events[_0x94f2('0x6')];_0x5e9216<_0xe14ba5;_0x5e9216++){var _0x1d1910=events[_0x5e9216];var _0x224a93=createListener(_0x94f2('0x7')+_0x1d1910,_0x493302);VoiceQueueReportEvents['on'](_0x1d1910,_0x224a93);}}; \ No newline at end of file +var _0x24dc=['register','remove','update','emit','removeListener'];(function(_0x33fb32,_0x53d280){var _0x45fc18=function(_0x463b69){while(--_0x463b69){_0x33fb32['push'](_0x33fb32['shift']());}};_0x45fc18(++_0x53d280);}(_0x24dc,0x65));var _0xc24d=function(_0x295089,_0x50ae46){_0x295089=_0x295089-0x0;var _0x364472=_0x24dc[_0x295089];return _0x364472;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xc24d('0x0'),_0xc24d('0x1')];function createListener(_0x31a8df,_0x292770){return function(_0x1fa05b){_0x292770[_0xc24d('0x2')](_0x31a8df,_0x1fa05b);};}function removeListener(_0x707559,_0x2737e1){return function(){VoiceQueueReportEvents[_0xc24d('0x3')](_0x707559,_0x2737e1);};}exports[_0xc24d('0x4')]=function(_0x1c833b){for(var _0x17ec2e=0x0,_0x1d5829=events['length'];_0x17ec2e<_0x1d5829;_0x17ec2e++){var _0x42b44d=events[_0x17ec2e];var _0x2e6391=createListener('voiceQueueReport:'+_0x42b44d,_0x1c833b);VoiceQueueReportEvents['on'](_0x42b44d,_0x2e6391);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 37eb526..943cb92 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 _0x8ba3=['../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0xac635d,_0x2dd837){var _0x3c5d71=function(_0xd3a108){while(--_0xd3a108){_0xac635d['push'](_0xac635d['shift']());}};_0x3c5d71(++_0x2dd837);}(_0x8ba3,0x1b0));var _0x38ba=function(_0x43e788,_0x4264c1){_0x43e788=_0x43e788-0x0;var _0x4332c0=_0x8ba3[_0x43e788];return _0x4332c0;};'use strict';var multer=require('multer');var util=require(_0x38ba('0x0'));var path=require(_0x38ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x38ba('0x2'));var router=express[_0x38ba('0x3')]();var fs_extra=require(_0x38ba('0x4'));var auth=require(_0x38ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x38ba('0x6'));var controller=require(_0x38ba('0x7'));router['get']('/',auth[_0x38ba('0x8')](),controller['index']);router[_0x38ba('0x9')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0xb')]);router[_0x38ba('0xc')]('/',auth['isAuthenticated'](),controller[_0x38ba('0xd')]);router[_0x38ba('0xe')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0xf')]);router[_0x38ba('0x10')](_0x38ba('0xa'),auth[_0x38ba('0x8')](),controller[_0x38ba('0x11')]);module[_0x38ba('0x12')]=router; \ No newline at end of file +var _0x906c=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','update','delete'];(function(_0x1afbbb,_0x1f7c5d){var _0x59054e=function(_0x150e9e){while(--_0x150e9e){_0x1afbbb['push'](_0x1afbbb['shift']());}};_0x59054e(++_0x1f7c5d);}(_0x906c,0x17d));var _0xc906=function(_0xa37ec8,_0x49be74){_0xa37ec8=_0xa37ec8-0x0;var _0x466115=_0x906c[_0xa37ec8];return _0x466115;};'use strict';var multer=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var path=require(_0xc906('0x2'));var timeout=require(_0xc906('0x3'));var express=require(_0xc906('0x4'));var router=express[_0xc906('0x5')]();var fs_extra=require(_0xc906('0x6'));var auth=require(_0xc906('0x7'));var interaction=require(_0xc906('0x8'));var config=require(_0xc906('0x9'));var controller=require(_0xc906('0xa'));router[_0xc906('0xb')]('/',auth[_0xc906('0xc')](),controller[_0xc906('0xd')]);router[_0xc906('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xc906('0xe')]);router[_0xc906('0xf')]('/',auth[_0xc906('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc906('0x10')]);router[_0xc906('0x11')](_0xc906('0x12'),auth[_0xc906('0xc')](),controller[_0xc906('0x13')]);module[_0xc906('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index f22354c..8b5c9f7 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 _0x4316=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x4316,0x1ee));var _0x6431=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4316[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6431('0x0'));var moment=require(_0x6431('0x1'));module[_0x6431('0x2')]={'time':{'type':Sequelize[_0x6431('0x3')]},'callid':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6431('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6431('0x4')],'allowNull':![],'defaultValue':moment()[_0x6431('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xee3c=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xee3c,0x14a));var _0xcee3=function(_0x2a03b5,_0x4d4427){_0x2a03b5=_0x2a03b5-0x0;var _0x34bdae=_0xee3c[_0x2a03b5];return _0x34bdae;};'use strict';var Sequelize=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));module[_0xcee3('0x2')]={'time':{'type':Sequelize[_0xcee3('0x3')]},'callid':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xcee3('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcee3('0x4')],'allowNull':![],'defaultValue':moment()[_0xcee3('0x5')](_0xcee3('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 621b7aa..735f5a1 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 _0x8bd5=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x537f42,_0x2a15a4){var _0x466f2d=function(_0x45e072){while(--_0x45e072){_0x537f42['push'](_0x537f42['shift']());}};_0x466f2d(++_0x2a15a4);}(_0x8bd5,0xea));var _0x58bd=function(_0x59657d,_0x51226c){_0x59657d=_0x59657d-0x0;var _0xf19e2e=_0x8bd5[_0x59657d];return _0xf19e2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58bd('0x0'));var zipdir=require(_0x58bd('0x1'));var jsonpatch=require(_0x58bd('0x2'));var rp=require(_0x58bd('0x3'));var moment=require(_0x58bd('0x4'));var BPromise=require(_0x58bd('0x5'));var Mustache=require(_0x58bd('0x6'));var util=require('util');var path=require(_0x58bd('0x7'));var sox=require('sox');var csv=require(_0x58bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x58bd('0x9'));var squel=require(_0x58bd('0xa'));var crypto=require('crypto');var jsforce=require(_0x58bd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x58bd('0x8'));var querystring=require(_0x58bd('0xc'));var Papa=require('papaparse');var Redis=require(_0x58bd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x58bd('0xe'));var as=require(_0x58bd('0xf'));var hardwareService=require(_0x58bd('0x10'));var logger=require('../../config/logger')(_0x58bd('0x11'));var utils=require('../../config/utils');var config=require(_0x58bd('0x12'));var licenseUtil=require(_0x58bd('0x13'));var db=require(_0x58bd('0x14'))['db'];function respondWithStatusCode(_0x510686,_0xf54e9a){_0xf54e9a=_0xf54e9a||0xcc;return function(_0xdbe09){if(_0xdbe09){return _0x510686[_0x58bd('0x15')](_0xf54e9a);}return _0x510686[_0x58bd('0x16')](_0xf54e9a)[_0x58bd('0x17')]();};}function respondWithResult(_0x594c5b,_0x4c9154){_0x4c9154=_0x4c9154||0xc8;return function(_0x461800){if(_0x461800){return _0x594c5b[_0x58bd('0x16')](_0x4c9154)[_0x58bd('0x18')](_0x461800);}};}function respondWithFilteredResult(_0x4ac677,_0x22e30f){return function(_0x31f431){if(_0x31f431){var _0xcc61e=typeof _0x22e30f['offset']===_0x58bd('0x19')&&typeof _0x22e30f[_0x58bd('0x1a')]===_0x58bd('0x19');var _0x4b5aba=_0x31f431[_0x58bd('0x1b')];var _0x363047=_0xcc61e?0x0:_0x22e30f[_0x58bd('0x1c')];var _0x1b54ca=_0xcc61e?_0x31f431['count']:_0x22e30f[_0x58bd('0x1c')]+_0x22e30f[_0x58bd('0x1a')];var _0x17ec38;if(_0x1b54ca>=_0x4b5aba){_0x1b54ca=_0x4b5aba;_0x17ec38=0xc8;}else{_0x17ec38=0xce;}_0x4ac677[_0x58bd('0x16')](_0x17ec38);return _0x4ac677[_0x58bd('0x1d')]('Content-Range',_0x363047+'-'+_0x1b54ca+'/'+_0x4b5aba)[_0x58bd('0x18')](_0x31f431);}return null;};}function patchUpdates(_0x55dc95){return function(_0x377143){try{jsonpatch[_0x58bd('0x1e')](_0x377143,_0x55dc95,!![]);}catch(_0x12821e){return BPromise[_0x58bd('0x1f')](_0x12821e);}return _0x377143[_0x58bd('0x20')]();};}function saveUpdates(_0x49996a,_0x4e7d97){return function(_0x5e2408){if(_0x5e2408){return _0x5e2408[_0x58bd('0x21')](_0x49996a)[_0x58bd('0x22')](function(_0x2ccab3){return _0x2ccab3;});}return null;};}function removeEntity(_0x380fa2,_0x1aba03){return function(_0x2f2a07){if(_0x2f2a07){return _0x2f2a07['destroy']()[_0x58bd('0x22')](function(){_0x380fa2[_0x58bd('0x16')](0xcc)[_0x58bd('0x17')]();});}};}function handleEntityNotFound(_0x396fd8,_0x5d7107){return function(_0x5b967c){if(!_0x5b967c){_0x396fd8[_0x58bd('0x15')](0x194);}return _0x5b967c;};}function handleError(_0x4382be,_0xcad31a){_0xcad31a=_0xcad31a||0x1f4;return function(_0x45b895){logger['error'](_0x45b895[_0x58bd('0x23')]);if(_0x45b895[_0x58bd('0x24')]){delete _0x45b895[_0x58bd('0x24')];}_0x4382be[_0x58bd('0x16')](_0xcad31a)[_0x58bd('0x25')](_0x45b895);};}exports['index']=function(_0x330d98,_0x2cf4ce){var _0x305e91={},_0x4aa50d={},_0x5237c1={'count':0x0,'rows':[]};var _0x2a8a06=_[_0x58bd('0x26')](db[_0x58bd('0x27')][_0x58bd('0x28')],function(_0x2cb96e){return{'name':_0x2cb96e[_0x58bd('0x29')],'type':_0x2cb96e[_0x58bd('0x2a')][_0x58bd('0x2b')]};});_0x4aa50d[_0x58bd('0x2c')]=_[_0x58bd('0x26')](_0x2a8a06,_0x58bd('0x24'));_0x4aa50d[_0x58bd('0x2d')]=_[_0x58bd('0x2e')](_0x330d98[_0x58bd('0x2d')]);_0x4aa50d[_0x58bd('0x2f')]=_[_0x58bd('0x30')](_0x4aa50d[_0x58bd('0x2c')],_0x4aa50d[_0x58bd('0x2d')]);_0x305e91[_0x58bd('0x31')]=_[_0x58bd('0x30')](_0x4aa50d['model'],qs[_0x58bd('0x32')](_0x330d98[_0x58bd('0x2d')]['fields']));_0x305e91[_0x58bd('0x31')]=_0x305e91[_0x58bd('0x31')][_0x58bd('0x33')]?_0x305e91[_0x58bd('0x31')]:_0x4aa50d[_0x58bd('0x2c')];if(!_0x330d98['query'][_0x58bd('0x34')](_0x58bd('0x35'))){_0x305e91[_0x58bd('0x1a')]=qs[_0x58bd('0x1a')](_0x330d98[_0x58bd('0x2d')][_0x58bd('0x1a')]);_0x305e91[_0x58bd('0x1c')]=qs[_0x58bd('0x1c')](_0x330d98[_0x58bd('0x2d')][_0x58bd('0x1c')]);}_0x305e91['order']=qs[_0x58bd('0x36')](_0x330d98['query'][_0x58bd('0x36')]);_0x305e91[_0x58bd('0x37')]=qs[_0x58bd('0x2f')](_[_0x58bd('0x38')](_0x330d98[_0x58bd('0x2d')],_0x4aa50d['filters']),_0x2a8a06);if(_0x330d98[_0x58bd('0x2d')][_0x58bd('0x39')]){_0x305e91[_0x58bd('0x37')]=_[_0x58bd('0x3a')](_0x305e91[_0x58bd('0x37')],{'$or':_[_0x58bd('0x26')](_0x2a8a06,function(_0x47d602){if(_0x47d602[_0x58bd('0x2a')]!==_0x58bd('0x3b')){var _0x483c31={};_0x483c31[_0x47d602[_0x58bd('0x24')]]={'$like':'%'+_0x330d98['query'][_0x58bd('0x39')]+'%'};return _0x483c31;}})});}_0x305e91=_[_0x58bd('0x3a')]({},_0x305e91,_0x330d98['options']);var _0x2f0f97={'where':_0x305e91[_0x58bd('0x37')]};return db[_0x58bd('0x27')][_0x58bd('0x1b')](_0x2f0f97)[_0x58bd('0x22')](function(_0x1a6a00){_0x5237c1['count']=_0x1a6a00;if(_0x330d98['query'][_0x58bd('0x3c')]){_0x305e91['include']=[{'all':!![]}];}return db[_0x58bd('0x27')][_0x58bd('0x3d')](_0x305e91);})[_0x58bd('0x22')](function(_0x1dc220){_0x5237c1[_0x58bd('0x3e')]=_0x1dc220;return _0x5237c1;})[_0x58bd('0x22')](respondWithFilteredResult(_0x2cf4ce,_0x305e91))[_0x58bd('0x3f')](handleError(_0x2cf4ce,null));};exports['show']=function(_0x385811,_0x2c255b){var _0x40b889={'raw':!![],'where':{'id':_0x385811[_0x58bd('0x40')]['id']}},_0x15cb0c={};_0x15cb0c[_0x58bd('0x2c')]=_['keys'](db[_0x58bd('0x27')][_0x58bd('0x28')]);_0x15cb0c['query']=_[_0x58bd('0x2e')](_0x385811[_0x58bd('0x2d')]);_0x15cb0c[_0x58bd('0x2f')]=_[_0x58bd('0x30')](_0x15cb0c[_0x58bd('0x2c')],_0x15cb0c[_0x58bd('0x2d')]);_0x40b889[_0x58bd('0x31')]=_[_0x58bd('0x30')](_0x15cb0c[_0x58bd('0x2c')],qs['fields'](_0x385811['query'][_0x58bd('0x32')]));_0x40b889[_0x58bd('0x31')]=_0x40b889[_0x58bd('0x31')][_0x58bd('0x33')]?_0x40b889[_0x58bd('0x31')]:_0x15cb0c['model'];if(_0x385811['query'][_0x58bd('0x3c')]){_0x40b889[_0x58bd('0x41')]=[{'all':!![]}];}_0x40b889=_[_0x58bd('0x3a')]({},_0x40b889,_0x385811[_0x58bd('0x42')]);return db['VoiceQueuesLog'][_0x58bd('0x43')](_0x40b889)[_0x58bd('0x22')](handleEntityNotFound(_0x2c255b,null))[_0x58bd('0x22')](respondWithResult(_0x2c255b,null))[_0x58bd('0x3f')](handleError(_0x2c255b,null));};exports[_0x58bd('0x44')]=function(_0x485193,_0x1b381a){return db['VoiceQueuesLog']['create'](_0x485193[_0x58bd('0x45')],{})[_0x58bd('0x22')](respondWithResult(_0x1b381a,0xc9))[_0x58bd('0x3f')](handleError(_0x1b381a,null));};exports['update']=function(_0x123f3c,_0x1498a1){if(_0x123f3c['body']['id']){delete _0x123f3c['body']['id'];}return db[_0x58bd('0x27')]['find']({'where':{'id':_0x123f3c[_0x58bd('0x40')]['id']}})[_0x58bd('0x22')](handleEntityNotFound(_0x1498a1,null))['then'](saveUpdates(_0x123f3c[_0x58bd('0x45')],null))[_0x58bd('0x22')](respondWithResult(_0x1498a1,null))[_0x58bd('0x3f')](handleError(_0x1498a1,null));};exports[_0x58bd('0x46')]=function(_0x15c85b,_0x1bc029){return db[_0x58bd('0x27')][_0x58bd('0x43')]({'where':{'id':_0x15c85b[_0x58bd('0x40')]['id']}})[_0x58bd('0x22')](handleEntityNotFound(_0x1bc029,null))[_0x58bd('0x22')](removeEntity(_0x1bc029,null))[_0x58bd('0x3f')](handleError(_0x1bc029,null));}; \ No newline at end of file +var _0x88d6=['catch','show','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','json','reject','save','then','end','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x88d6,0x99));var _0x688d=function(_0x1cda37,_0x2f894c){_0x1cda37=_0x1cda37-0x0;var _0x461e79=_0x88d6[_0x1cda37];return _0x461e79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x688d('0x0'));var zipdir=require(_0x688d('0x1'));var jsonpatch=require(_0x688d('0x2'));var rp=require(_0x688d('0x3'));var moment=require(_0x688d('0x4'));var BPromise=require(_0x688d('0x5'));var Mustache=require(_0x688d('0x6'));var util=require(_0x688d('0x7'));var path=require('path');var sox=require(_0x688d('0x8'));var csv=require(_0x688d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x688d('0xa'));var _=require(_0x688d('0xb'));var squel=require(_0x688d('0xc'));var crypto=require(_0x688d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x688d('0xe'));var toCsv=require(_0x688d('0x9'));var querystring=require(_0x688d('0xf'));var Papa=require(_0x688d('0x10'));var Redis=require(_0x688d('0x11'));var authService=require(_0x688d('0x12'));var qs=require(_0x688d('0x13'));var as=require(_0x688d('0x14'));var hardwareService=require(_0x688d('0x15'));var logger=require(_0x688d('0x16'))(_0x688d('0x17'));var utils=require(_0x688d('0x18'));var config=require(_0x688d('0x19'));var licenseUtil=require(_0x688d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x534ec3,_0x7cf37e){_0x7cf37e=_0x7cf37e||0xcc;return function(_0x1fe364){if(_0x1fe364){return _0x534ec3[_0x688d('0x1b')](_0x7cf37e);}return _0x534ec3['status'](_0x7cf37e)['end']();};}function respondWithResult(_0x4fc9f0,_0xfc0baf){_0xfc0baf=_0xfc0baf||0xc8;return function(_0x49e656){if(_0x49e656){return _0x4fc9f0[_0x688d('0x1c')](_0xfc0baf)['json'](_0x49e656);}};}function respondWithFilteredResult(_0x58dbf3,_0x3a0691){return function(_0xf88ecc){if(_0xf88ecc){var _0x1121a6=typeof _0x3a0691[_0x688d('0x1d')]===_0x688d('0x1e')&&typeof _0x3a0691[_0x688d('0x1f')]===_0x688d('0x1e');var _0x3c1761=_0xf88ecc[_0x688d('0x20')];var _0x154319=_0x1121a6?0x0:_0x3a0691['offset'];var _0x162e6e=_0x1121a6?_0xf88ecc[_0x688d('0x20')]:_0x3a0691['offset']+_0x3a0691[_0x688d('0x1f')];var _0x6698ce;if(_0x162e6e>=_0x3c1761){_0x162e6e=_0x3c1761;_0x6698ce=0xc8;}else{_0x6698ce=0xce;}_0x58dbf3[_0x688d('0x1c')](_0x6698ce);return _0x58dbf3['set']('Content-Range',_0x154319+'-'+_0x162e6e+'/'+_0x3c1761)[_0x688d('0x21')](_0xf88ecc);}return null;};}function patchUpdates(_0x102327){return function(_0x2912f7){try{jsonpatch['apply'](_0x2912f7,_0x102327,!![]);}catch(_0x27cef3){return BPromise[_0x688d('0x22')](_0x27cef3);}return _0x2912f7[_0x688d('0x23')]();};}function saveUpdates(_0x35a423,_0x1591f6){return function(_0x4339bd){if(_0x4339bd){return _0x4339bd['update'](_0x35a423)[_0x688d('0x24')](function(_0x2d1326){return _0x2d1326;});}return null;};}function removeEntity(_0x153c11,_0x5b4586){return function(_0x572714){if(_0x572714){return _0x572714['destroy']()['then'](function(){_0x153c11[_0x688d('0x1c')](0xcc)[_0x688d('0x25')]();});}};}function handleEntityNotFound(_0x50d856,_0x236b81){return function(_0xb5441b){if(!_0xb5441b){_0x50d856[_0x688d('0x1b')](0x194);}return _0xb5441b;};}function handleError(_0x530056,_0x5478ee){_0x5478ee=_0x5478ee||0x1f4;return function(_0x544ad9){logger['error'](_0x544ad9[_0x688d('0x26')]);if(_0x544ad9[_0x688d('0x27')]){delete _0x544ad9[_0x688d('0x27')];}_0x530056[_0x688d('0x1c')](_0x5478ee)[_0x688d('0x28')](_0x544ad9);};}exports[_0x688d('0x29')]=function(_0x5ba4c8,_0x2ce22b){var _0xa5778={},_0x32ce7a={},_0xf05ea3={'count':0x0,'rows':[]};var _0x28eadb=_[_0x688d('0x2a')](db[_0x688d('0x2b')][_0x688d('0x2c')],function(_0x24f959){return{'name':_0x24f959[_0x688d('0x2d')],'type':_0x24f959['type'][_0x688d('0x2e')]};});_0x32ce7a[_0x688d('0x2f')]=_[_0x688d('0x2a')](_0x28eadb,'name');_0x32ce7a[_0x688d('0x30')]=_[_0x688d('0x31')](_0x5ba4c8[_0x688d('0x30')]);_0x32ce7a[_0x688d('0x32')]=_[_0x688d('0x33')](_0x32ce7a[_0x688d('0x2f')],_0x32ce7a['query']);_0xa5778['attributes']=_['intersection'](_0x32ce7a[_0x688d('0x2f')],qs['fields'](_0x5ba4c8[_0x688d('0x30')][_0x688d('0x34')]));_0xa5778[_0x688d('0x35')]=_0xa5778[_0x688d('0x35')]['length']?_0xa5778[_0x688d('0x35')]:_0x32ce7a[_0x688d('0x2f')];if(!_0x5ba4c8[_0x688d('0x30')]['hasOwnProperty']('nolimit')){_0xa5778[_0x688d('0x1f')]=qs[_0x688d('0x1f')](_0x5ba4c8[_0x688d('0x30')]['limit']);_0xa5778[_0x688d('0x1d')]=qs[_0x688d('0x1d')](_0x5ba4c8[_0x688d('0x30')][_0x688d('0x1d')]);}_0xa5778[_0x688d('0x36')]=qs[_0x688d('0x37')](_0x5ba4c8[_0x688d('0x30')][_0x688d('0x37')]);_0xa5778[_0x688d('0x38')]=qs[_0x688d('0x32')](_[_0x688d('0x39')](_0x5ba4c8[_0x688d('0x30')],_0x32ce7a[_0x688d('0x32')]),_0x28eadb);if(_0x5ba4c8[_0x688d('0x30')][_0x688d('0x3a')]){_0xa5778['where']=_[_0x688d('0x3b')](_0xa5778[_0x688d('0x38')],{'$or':_[_0x688d('0x2a')](_0x28eadb,function(_0x1d2fbe){if(_0x1d2fbe[_0x688d('0x3c')]!==_0x688d('0x3d')){var _0x5450d7={};_0x5450d7[_0x1d2fbe[_0x688d('0x27')]]={'$like':'%'+_0x5ba4c8[_0x688d('0x30')]['filter']+'%'};return _0x5450d7;}})});}_0xa5778=_[_0x688d('0x3b')]({},_0xa5778,_0x5ba4c8[_0x688d('0x3e')]);var _0x4cfbe3={'where':_0xa5778[_0x688d('0x38')]};return db[_0x688d('0x2b')][_0x688d('0x20')](_0x4cfbe3)['then'](function(_0x306b92){_0xf05ea3['count']=_0x306b92;if(_0x5ba4c8[_0x688d('0x30')][_0x688d('0x3f')]){_0xa5778[_0x688d('0x40')]=[{'all':!![]}];}return db[_0x688d('0x2b')]['findAll'](_0xa5778);})[_0x688d('0x24')](function(_0x5d930f){_0xf05ea3[_0x688d('0x41')]=_0x5d930f;return _0xf05ea3;})['then'](respondWithFilteredResult(_0x2ce22b,_0xa5778))[_0x688d('0x42')](handleError(_0x2ce22b,null));};exports[_0x688d('0x43')]=function(_0x4ff541,_0x5c665d){var _0x1aa347={'raw':!![],'where':{'id':_0x4ff541['params']['id']}},_0x1f7021={};_0x1f7021[_0x688d('0x2f')]=_['keys'](db['VoiceQueuesLog'][_0x688d('0x2c')]);_0x1f7021['query']=_[_0x688d('0x31')](_0x4ff541['query']);_0x1f7021['filters']=_['intersection'](_0x1f7021[_0x688d('0x2f')],_0x1f7021['query']);_0x1aa347[_0x688d('0x35')]=_[_0x688d('0x33')](_0x1f7021[_0x688d('0x2f')],qs[_0x688d('0x34')](_0x4ff541[_0x688d('0x30')][_0x688d('0x34')]));_0x1aa347['attributes']=_0x1aa347[_0x688d('0x35')]['length']?_0x1aa347[_0x688d('0x35')]:_0x1f7021[_0x688d('0x2f')];if(_0x4ff541[_0x688d('0x30')][_0x688d('0x3f')]){_0x1aa347[_0x688d('0x40')]=[{'all':!![]}];}_0x1aa347=_[_0x688d('0x3b')]({},_0x1aa347,_0x4ff541[_0x688d('0x3e')]);return db[_0x688d('0x2b')]['find'](_0x1aa347)[_0x688d('0x24')](handleEntityNotFound(_0x5c665d,null))['then'](respondWithResult(_0x5c665d,null))[_0x688d('0x42')](handleError(_0x5c665d,null));};exports[_0x688d('0x44')]=function(_0x28743e,_0x4219b8){return db[_0x688d('0x2b')][_0x688d('0x44')](_0x28743e['body'],{})[_0x688d('0x24')](respondWithResult(_0x4219b8,0xc9))['catch'](handleError(_0x4219b8,null));};exports['update']=function(_0x4c7fad,_0x5c4afd){if(_0x4c7fad[_0x688d('0x45')]['id']){delete _0x4c7fad['body']['id'];}return db[_0x688d('0x2b')][_0x688d('0x46')]({'where':{'id':_0x4c7fad[_0x688d('0x47')]['id']}})[_0x688d('0x24')](handleEntityNotFound(_0x5c4afd,null))[_0x688d('0x24')](saveUpdates(_0x4c7fad['body'],null))[_0x688d('0x24')](respondWithResult(_0x5c4afd,null))[_0x688d('0x42')](handleError(_0x5c4afd,null));};exports[_0x688d('0x48')]=function(_0x3556de,_0x3ecc5f){return db['VoiceQueuesLog']['find']({'where':{'id':_0x3556de[_0x688d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ecc5f,null))['then'](removeEntity(_0x3ecc5f,null))['catch'](handleError(_0x3ecc5f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d728a2f..591e3ae 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 _0x8b9d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','event_dtm','event','dtm'];(function(_0x3a9569,_0x17f5a5){var _0x104532=function(_0x2de986){while(--_0x2de986){_0x3a9569['push'](_0x3a9569['shift']());}};_0x104532(++_0x17f5a5);}(_0x8b9d,0x1ee));var _0xd8b9=function(_0xcfcdcb,_0x335750){_0xcfcdcb=_0xcfcdcb-0x0;var _0x55b9da=_0x8b9d[_0xcfcdcb];return _0x55b9da;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b9('0x0'))(_0xd8b9('0x1'));var moment=require(_0xd8b9('0x2'));var BPromise=require(_0xd8b9('0x3'));var rp=require(_0xd8b9('0x4'));var fs=require('fs');var path=require(_0xd8b9('0x5'));var rimraf=require(_0xd8b9('0x6'));var config=require(_0xd8b9('0x7'));var attributes=require(_0xd8b9('0x8'));module['exports']=function(_0x99cfe7,_0x45335b){return _0x99cfe7['define'](_0xd8b9('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xd8b9('0xa'),'fields':[_0xd8b9('0xb'),_0xd8b9('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1e43=['bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','dtm','lodash','util','moment'];(function(_0x5d3afa,_0x584768){var _0x230dd9=function(_0x5ca224){while(--_0x5ca224){_0x5d3afa['push'](_0x5d3afa['shift']());}};_0x230dd9(++_0x584768);}(_0x1e43,0x1d1));var _0x31e4=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x1e43[_0x55e1d1];return _0x1165db;};'use strict';var _=require(_0x31e4('0x0'));var util=require(_0x31e4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31e4('0x2'));var BPromise=require(_0x31e4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x31e4('0x4'));var config=require(_0x31e4('0x5'));var attributes=require(_0x31e4('0x6'));module[_0x31e4('0x7')]=function(_0x274a52,_0x6e71fe){return _0x274a52[_0x31e4('0x8')](_0x31e4('0x9'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x31e4('0xa'),'fields':['event',_0x31e4('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index dc32aa2..38c6ee1 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 _0x5262=['rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2fbaf5,_0x18f3f1){var _0x3596a3=function(_0x2e1d47){while(--_0x2e1d47){_0x2fbaf5['push'](_0x2fbaf5['shift']());}};_0x3596a3(++_0x18f3f1);}(_0x5262,0xc2));var _0x2526=function(_0x24edaf,_0x4b8020){_0x24edaf=_0x24edaf-0x0;var _0x1a3bf8=_0x5262[_0x24edaf];return _0x1a3bf8;};'use strict';var _=require(_0x2526('0x0'));var util=require(_0x2526('0x1'));var moment=require(_0x2526('0x2'));var BPromise=require(_0x2526('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2526('0x4'));var db=require(_0x2526('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2526('0x6'));var config=require(_0x2526('0x7'));var jayson=require(_0x2526('0x8'));var client=jayson[_0x2526('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd090c2,_0x3f9c89,_0xba0c8f){return new BPromise(function(_0x46c5c4,_0x246b29){return client['request'](_0xd090c2,_0xba0c8f)[_0x2526('0xa')](function(_0x58dbbf){logger[_0x2526('0xb')](_0x2526('0xc'),_0x3f9c89,_0x2526('0xd'));logger[_0x2526('0xe')](_0x2526('0xf'),_0x3f9c89,_0x2526('0xd'),JSON[_0x2526('0x10')](_0x58dbbf));if(_0x58dbbf['error']){if(_0x58dbbf[_0x2526('0x11')][_0x2526('0x12')]===0x1f4){logger[_0x2526('0x11')](_0x2526('0xc'),_0x3f9c89,_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);return _0x246b29(_0x58dbbf['error']['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3f9c89,_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);return _0x46c5c4(_0x58dbbf[_0x2526('0x11')][_0x2526('0x13')]);}else{logger[_0x2526('0xb')](_0x2526('0xc'),_0x3f9c89,_0x2526('0xd'));_0x46c5c4(_0x58dbbf['result']['message']);}})['catch'](function(_0x21353f){logger[_0x2526('0x11')](_0x2526('0xc'),_0x3f9c89,_0x21353f);_0x246b29(_0x21353f);});});} \ No newline at end of file +var _0x11cd=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x11cd,0x194));var _0xd11c=function(_0x265eef,_0x41e803){_0x265eef=_0x265eef-0x0;var _0x22a7a0=_0x11cd[_0x265eef];return _0x22a7a0;};'use strict';var _=require('lodash');var util=require(_0xd11c('0x0'));var moment=require('moment');var BPromise=require(_0xd11c('0x1'));var rs=require(_0xd11c('0x2'));var fs=require('fs');var Redis=require(_0xd11c('0x3'));var db=require(_0xd11c('0x4'))['db'];var utils=require(_0xd11c('0x5'));var logger=require('../../config/logger')(_0xd11c('0x6'));var config=require(_0xd11c('0x7'));var jayson=require(_0xd11c('0x8'));var client=jayson['client'][_0xd11c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x569a3e,_0x24c207,_0x243e49){return new BPromise(function(_0x32bb3e,_0x1d7a55){return client[_0xd11c('0xa')](_0x569a3e,_0x243e49)[_0xd11c('0xb')](function(_0x4ae757){logger[_0xd11c('0xc')](_0xd11c('0xd'),_0x24c207,_0xd11c('0xe'));logger[_0xd11c('0xf')](_0xd11c('0x10'),_0x24c207,'request\x20sent',JSON[_0xd11c('0x11')](_0x4ae757));if(_0x4ae757[_0xd11c('0x12')]){if(_0x4ae757[_0xd11c('0x12')][_0xd11c('0x13')]===0x1f4){logger['error'](_0xd11c('0xd'),_0x24c207,_0x4ae757[_0xd11c('0x12')][_0xd11c('0x14')]);return _0x1d7a55(_0x4ae757['error'][_0xd11c('0x14')]);}logger[_0xd11c('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x24c207,_0x4ae757[_0xd11c('0x12')][_0xd11c('0x14')]);return _0x32bb3e(_0x4ae757[_0xd11c('0x12')][_0xd11c('0x14')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x24c207,'request\x20sent');_0x32bb3e(_0x4ae757[_0xd11c('0x15')][_0xd11c('0x14')]);}})[_0xd11c('0x16')](function(_0x1b25fb){logger[_0xd11c('0x12')](_0xd11c('0xd'),_0x24c207,_0x1b25fb);_0x1d7a55(_0x1b25fb);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0bc5b73..1c967e0 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 _0x93d7=['describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x58836a,_0x2fd615){var _0x5ac6ab=function(_0x479298){while(--_0x479298){_0x58836a['push'](_0x58836a['shift']());}};_0x5ac6ab(++_0x2fd615);}(_0x93d7,0x153));var _0x793d=function(_0x5c1b79,_0x201f89){_0x5c1b79=_0x5c1b79-0x0;var _0x2ba6c1=_0x93d7[_0x5c1b79];return _0x2ba6c1;};'use strict';var multer=require('multer');var util=require(_0x793d('0x0'));var path=require(_0x793d('0x1'));var timeout=require(_0x793d('0x2'));var express=require(_0x793d('0x3'));var router=express[_0x793d('0x4')]();var fs_extra=require(_0x793d('0x5'));var auth=require(_0x793d('0x6'));var interaction=require(_0x793d('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x793d('0x8')]('/',auth[_0x793d('0x9')](),controller['index']);router[_0x793d('0x8')](_0x793d('0xa'),auth['isAuthenticated'](),controller[_0x793d('0xb')]);router[_0x793d('0x8')](_0x793d('0xc'),auth[_0x793d('0x9')](),controller['show']);router[_0x793d('0x8')](_0x793d('0xd'),auth[_0x793d('0x9')](),controller[_0x793d('0xe')]);router[_0x793d('0x8')](_0x793d('0xf'),controller['downloads']);router[_0x793d('0x8')](_0x793d('0x10'),auth[_0x793d('0x9')](),controller[_0x793d('0x11')]);router[_0x793d('0x12')]('/',auth['isAuthenticated'](),controller[_0x793d('0x13')]);router[_0x793d('0x12')]('/:id/transcribe',auth[_0x793d('0x9')](),controller[_0x793d('0x14')]);router[_0x793d('0x15')](_0x793d('0xc'),auth['isAuthenticated'](),controller[_0x793d('0x16')]);router[_0x793d('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x793d('0x18')]=router; \ No newline at end of file +var _0x537f=['/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x537f,0x15b));var _0xf537=function(_0x16cdec,_0x4359f2){_0x16cdec=_0x16cdec-0x0;var _0x2f827b=_0x537f[_0x16cdec];return _0x2f827b;};'use strict';var multer=require(_0xf537('0x0'));var util=require(_0xf537('0x1'));var path=require(_0xf537('0x2'));var timeout=require('connect-timeout');var express=require(_0xf537('0x3'));var router=express['Router']();var fs_extra=require(_0xf537('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf537('0x5'));var config=require(_0xf537('0x6'));var controller=require(_0xf537('0x7'));router['get']('/',auth[_0xf537('0x8')](),controller[_0xf537('0x9')]);router['get'](_0xf537('0xa'),auth[_0xf537('0x8')](),controller[_0xf537('0xb')]);router[_0xf537('0xc')](_0xf537('0xd'),auth['isAuthenticated'](),controller[_0xf537('0xe')]);router[_0xf537('0xc')](_0xf537('0xf'),auth['isAuthenticated'](),controller[_0xf537('0x10')]);router[_0xf537('0xc')](_0xf537('0x11'),controller[_0xf537('0x12')]);router[_0xf537('0xc')](_0xf537('0x13'),auth['isAuthenticated'](),controller[_0xf537('0x14')]);router[_0xf537('0x15')]('/',auth['isAuthenticated'](),controller[_0xf537('0x16')]);router[_0xf537('0x15')](_0xf537('0x13'),auth[_0xf537('0x8')](),controller[_0xf537('0x17')]);router[_0xf537('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xf537('0x19')]);router[_0xf537('0x1a')](_0xf537('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf537('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 98adfa3..74e7d40 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(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 05bb139..fe89bd8 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 _0x8ea5=['destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Sequelize','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','keys','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','options','rows','catch','show','params','length','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','$and','push','format','secrets'];(function(_0x3b12be,_0x276d47){var _0xe27d37=function(_0x44883c){while(--_0x44883c){_0x3b12be['push'](_0x3b12be['shift']());}};_0xe27d37(++_0x276d47);}(_0x8ea5,0xd7));var _0x58ea=function(_0xd5115f,_0x4a4775){_0xd5115f=_0xd5115f-0x0;var _0x5d230d=_0x8ea5[_0xd5115f];return _0x5d230d;};'use strict';var emlformat=require(_0x58ea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x58ea('0x1'));var moment=require(_0x58ea('0x2'));var BPromise=require(_0x58ea('0x3'));var Mustache=require(_0x58ea('0x4'));var util=require(_0x58ea('0x5'));var path=require(_0x58ea('0x6'));var sox=require(_0x58ea('0x7'));var csv=require(_0x58ea('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58ea('0x9'));var _=require(_0x58ea('0xa'));var squel=require(_0x58ea('0xb'));var crypto=require('crypto');var jsforce=require(_0x58ea('0xc'));var deskjs=require(_0x58ea('0xd'));var toCsv=require('to-csv');var querystring=require(_0x58ea('0xe'));var Papa=require('papaparse');var AWS=require(_0x58ea('0xf'));var uuidv4=require(_0x58ea('0x10'));var Redis=require(_0x58ea('0x11'));var authService=require(_0x58ea('0x12'));var qs=require(_0x58ea('0x13'));var as=require(_0x58ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x58ea('0x15'));var utils=require(_0x58ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x58ea('0x17'));var db=require(_0x58ea('0x18'))['db'];function respondWithStatusCode(_0xf9fec5,_0x45fbfa){_0x45fbfa=_0x45fbfa||0xcc;return function(_0x3156c9){if(_0x3156c9){return _0xf9fec5['sendStatus'](_0x45fbfa);}return _0xf9fec5[_0x58ea('0x19')](_0x45fbfa)[_0x58ea('0x1a')]();};}function respondWithResult(_0x3c1268,_0x53a156){_0x53a156=_0x53a156||0xc8;return function(_0x2a2390){if(_0x2a2390){return _0x3c1268[_0x58ea('0x19')](_0x53a156)[_0x58ea('0x1b')](_0x2a2390);}};}function respondWithFilteredResult(_0x5c5e72,_0xbf6c44){return function(_0x2e4709){if(_0x2e4709){var _0x47b8df=typeof _0xbf6c44[_0x58ea('0x1c')]===_0x58ea('0x1d')&&typeof _0xbf6c44[_0x58ea('0x1e')]===_0x58ea('0x1d');var _0x3f25b0=_0x2e4709[_0x58ea('0x1f')];var _0x158a8c=_0x47b8df?0x0:_0xbf6c44[_0x58ea('0x1c')];var _0x259fb8=_0x47b8df?_0x2e4709['count']:_0xbf6c44[_0x58ea('0x1c')]+_0xbf6c44[_0x58ea('0x1e')];var _0x5dec22;if(_0x259fb8>=_0x3f25b0){_0x259fb8=_0x3f25b0;_0x5dec22=0xc8;}else{_0x5dec22=0xce;}_0x5c5e72[_0x58ea('0x19')](_0x5dec22);return _0x5c5e72[_0x58ea('0x20')](_0x58ea('0x21'),_0x158a8c+'-'+_0x259fb8+'/'+_0x3f25b0)['json'](_0x2e4709);}return null;};}function patchUpdates(_0x28c32a){return function(_0x5a2cb5){try{jsonpatch[_0x58ea('0x22')](_0x5a2cb5,_0x28c32a,!![]);}catch(_0x5ce72d){return BPromise[_0x58ea('0x23')](_0x5ce72d);}return _0x5a2cb5[_0x58ea('0x24')]();};}function saveUpdates(_0x56fd17,_0x441e9c){return function(_0x20ec3e){if(_0x20ec3e){return _0x20ec3e[_0x58ea('0x25')](_0x56fd17)[_0x58ea('0x26')](function(_0x49d743){return _0x49d743;});}return null;};}function removeEntity(_0x232ed1,_0x4158cf){return function(_0x53a49a){if(_0x53a49a){return _0x53a49a['destroy']()[_0x58ea('0x26')](function(){_0x232ed1['status'](0xcc)[_0x58ea('0x1a')]();});}};}function handleEntityNotFound(_0x3bd11a,_0x588b0f){return function(_0x26f745){if(!_0x26f745){_0x3bd11a[_0x58ea('0x27')](0x194);}return _0x26f745;};}function handleError(_0x2e130d,_0x2393b0){_0x2393b0=_0x2393b0||0x1f4;return function(_0x15b1c9){logger[_0x58ea('0x28')](_0x15b1c9[_0x58ea('0x29')]);if(_0x15b1c9[_0x58ea('0x2a')]){delete _0x15b1c9[_0x58ea('0x2a')];}_0x2e130d[_0x58ea('0x19')](_0x2393b0)[_0x58ea('0x2b')](_0x15b1c9);};}exports[_0x58ea('0x2c')]=function(_0x39d9ed,_0x554806){var _0x20fa6b={},_0x3b17ec={},_0x5e0d72={'count':0x0,'rows':[]};var _0x2b0611=_[_0x58ea('0x2d')](db[_0x58ea('0x2e')][_0x58ea('0x2f')],function(_0x1f653){return{'name':_0x1f653[_0x58ea('0x30')],'type':_0x1f653[_0x58ea('0x31')]['key']};});_0x3b17ec[_0x58ea('0x32')]=_[_0x58ea('0x33')](_[_0x58ea('0x2d')](_0x2b0611,_0x58ea('0x2a')),['format']);_0x3b17ec['query']=_[_0x58ea('0x34')](_0x39d9ed['query']);_0x3b17ec['filters']=_[_0x58ea('0x35')](_0x3b17ec[_0x58ea('0x32')],_0x3b17ec[_0x58ea('0x36')]);_0x20fa6b[_0x58ea('0x37')]=_[_0x58ea('0x35')](_0x3b17ec[_0x58ea('0x32')],qs[_0x58ea('0x38')](_0x39d9ed[_0x58ea('0x36')]['fields']));_0x20fa6b[_0x58ea('0x37')]=_0x20fa6b[_0x58ea('0x37')]['length']?_0x20fa6b[_0x58ea('0x37')]:_0x3b17ec['model'];if(!_0x39d9ed[_0x58ea('0x36')]['hasOwnProperty'](_0x58ea('0x39'))){_0x20fa6b['limit']=qs[_0x58ea('0x1e')](_0x39d9ed['query'][_0x58ea('0x1e')]);_0x20fa6b['offset']=qs[_0x58ea('0x1c')](_0x39d9ed[_0x58ea('0x36')][_0x58ea('0x1c')]);}_0x20fa6b[_0x58ea('0x3a')]=qs[_0x58ea('0x3b')](_0x39d9ed[_0x58ea('0x36')]['sort']);_0x20fa6b[_0x58ea('0x3c')]=qs['filters'](_[_0x58ea('0x3d')](_0x39d9ed['query'],_0x3b17ec[_0x58ea('0x3e')]),_0x2b0611);if(_0x39d9ed[_0x58ea('0x36')][_0x58ea('0x3f')]){_0x20fa6b[_0x58ea('0x3c')]=_[_0x58ea('0x40')](_0x20fa6b['where'],{'$or':_[_0x58ea('0x2d')](_0x2b0611,function(_0x4b4784){if(_0x4b4784[_0x58ea('0x31')]!=='VIRTUAL'){var _0x11fb6f={};_0x11fb6f[_0x4b4784[_0x58ea('0x2a')]]={'$like':'%'+_0x39d9ed[_0x58ea('0x36')]['filter']+'%'};return _0x11fb6f;}})});}_0x20fa6b=_[_0x58ea('0x40')]({},_0x20fa6b,_0x39d9ed[_0x58ea('0x41')]);var _0x338fae={'where':_0x20fa6b['where']};return db['VoiceRecording'][_0x58ea('0x1f')](_0x338fae)[_0x58ea('0x26')](function(_0x342d84){_0x5e0d72['count']=_0x342d84;if(_0x39d9ed[_0x58ea('0x36')]['includeAll']){_0x20fa6b['include']=[{'all':!![]}];}return db[_0x58ea('0x2e')]['findAll'](_0x20fa6b);})[_0x58ea('0x26')](function(_0x542abf){_0x5e0d72[_0x58ea('0x42')]=_0x542abf;return _0x5e0d72;})[_0x58ea('0x26')](respondWithFilteredResult(_0x554806,_0x20fa6b))[_0x58ea('0x43')](handleError(_0x554806,null));};exports[_0x58ea('0x44')]=function(_0x29c7cf,_0x2b89d0){var _0x5a53eb={'raw':![],'where':{'id':_0x29c7cf[_0x58ea('0x45')]['id']}},_0x3b1c5e={};_0x3b1c5e[_0x58ea('0x32')]=_[_0x58ea('0x34')](db[_0x58ea('0x2e')][_0x58ea('0x2f')]);_0x3b1c5e[_0x58ea('0x36')]=_['keys'](_0x29c7cf['query']);_0x3b1c5e[_0x58ea('0x3e')]=_['intersection'](_0x3b1c5e[_0x58ea('0x32')],_0x3b1c5e['query']);_0x5a53eb[_0x58ea('0x37')]=_['intersection'](_0x3b1c5e[_0x58ea('0x32')],qs['fields'](_0x29c7cf['query'][_0x58ea('0x38')]));_0x5a53eb[_0x58ea('0x37')]=_0x5a53eb['attributes'][_0x58ea('0x46')]?_0x5a53eb['attributes']:_0x3b1c5e['model'];if(_0x29c7cf[_0x58ea('0x36')][_0x58ea('0x47')]){_0x5a53eb[_0x58ea('0x48')]=[{'all':!![]}];}_0x5a53eb=_[_0x58ea('0x40')]({},_0x5a53eb,_0x29c7cf[_0x58ea('0x41')]);return db[_0x58ea('0x2e')][_0x58ea('0x49')](_0x5a53eb)['then'](handleEntityNotFound(_0x2b89d0,null))['then'](respondWithResult(_0x2b89d0,null))['catch'](handleError(_0x2b89d0,null));};exports[_0x58ea('0x4a')]=function(_0x36c197,_0x4d1085){return db['VoiceRecording']['create'](_0x36c197['body'],{})['then'](respondWithResult(_0x4d1085,0xc9))['catch'](handleError(_0x4d1085,null));};exports[_0x58ea('0x25')]=function(_0x4c3495,_0x170e43){if(_0x4c3495[_0x58ea('0x4b')]['id']){delete _0x4c3495[_0x58ea('0x4b')]['id'];}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':{'id':_0x4c3495[_0x58ea('0x45')]['id']}})[_0x58ea('0x26')](handleEntityNotFound(_0x170e43,null))[_0x58ea('0x26')](saveUpdates(_0x4c3495[_0x58ea('0x4b')],null))[_0x58ea('0x26')](respondWithResult(_0x170e43,null))[_0x58ea('0x43')](handleError(_0x170e43,null));};exports['describe']=function(_0x57c340,_0x3bbfbb){return db['VoiceRecording'][_0x58ea('0x4c')]()['then'](respondWithResult(_0x3bbfbb,null))[_0x58ea('0x43')](handleError(_0x3bbfbb,null));};exports[_0x58ea('0x4d')]=function(_0x29a2ef,_0x3fc6e2,_0x3c61a4){var _0x473881=require(_0x58ea('0x4e'));var _0x3abe5d=![];var _0x2665ee={};if(_0x29a2ef[_0x58ea('0x36')][_0x58ea('0x31')]&&_0x29a2ef[_0x58ea('0x36')]['type']===_0x58ea('0x4f')){_0x2665ee[_0x58ea('0x4f')]=_0x29a2ef[_0x58ea('0x45')]['id'];}else{_0x2665ee['id']=_0x29a2ef[_0x58ea('0x45')]['id'];}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':_0x2665ee,'attributes':['id',_0x58ea('0x50')],'raw':!![]})[_0x58ea('0x26')](handleEntityNotFound(_0x3fc6e2,null))[_0x58ea('0x26')](function(_0x146b59){if(_0x146b59){var _0x3a64c7=_0x146b59[_0x58ea('0x50')];var _0x4924ed=util['format'](_0x58ea('0x51'),_0x3a64c7);if(fs[_0x58ea('0x52')](_0x4924ed)){_0x3abe5d=!![];return _0x473881[_0x58ea('0x53')](_0x4924ed,_0x3a64c7,config['secrets'][_0x58ea('0x54')])[_0x58ea('0x26')](function(){return _0x146b59;});}return _0x146b59;}})[_0x58ea('0x26')](function(_0x2254a8){if(_0x2254a8){var _0x44dda2=_0x2254a8[_0x58ea('0x50')];if(!fs['existsSync'](_0x44dda2)){throw new db['Sequelize'][(_0x58ea('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x2254a8[_0x58ea('0x56')]){return _0x3fc6e2[_0x58ea('0x4d')](_0x44dda2,_0x2254a8['filename']+path[_0x58ea('0x57')](_0x44dda2),function(){if(_0x3abe5d){fs[_0x58ea('0x58')](_0x44dda2);}});}else{return _0x3fc6e2['download'](_0x44dda2,function(_0x1e9981){if(_0x3abe5d){fs[_0x58ea('0x58')](_0x44dda2);}});}}})[_0x58ea('0x43')](function(_0x5f3e12){if(_0x5f3e12[_0x58ea('0x59')]===_0x58ea('0x5a')){_0x3fc6e2[_0x58ea('0x19')](0x194)[_0x58ea('0x2b')]('Not\x20found');}else{return handleError(_0x3fc6e2,null);}});};exports[_0x58ea('0x5b')]=function(_0x1380b7,_0x1f929e,_0x5dad5a){var _0x56ec36=require('../../components/encryptor');var _0x4c61e7=![];var _0x565ad7={'$and':[db[_0x58ea('0x5c')]['where'](db['sequelize']['fn'](_0x58ea('0x5d'),db[_0x58ea('0x5c')][_0x58ea('0x5e')](_0x58ea('0x4f'))),_0x1380b7[_0x58ea('0x36')]['token'])]};if(_0x1380b7[_0x58ea('0x36')]['type']&&_0x1380b7[_0x58ea('0x36')]['type']===_0x58ea('0x4f')){_0x565ad7[_0x58ea('0x5f')][_0x58ea('0x60')]({'uniqueid':_0x1380b7['params']['id']});}else{_0x565ad7[_0x58ea('0x5f')]['push']({'id':_0x1380b7[_0x58ea('0x45')]['id']});}return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':_0x565ad7,'attributes':['id',_0x58ea('0x50')],'raw':!![]})[_0x58ea('0x26')](handleEntityNotFound(_0x1f929e,null))[_0x58ea('0x26')](function(_0xdbf52){if(_0xdbf52){var _0x2f02f3=util[_0x58ea('0x61')](_0x58ea('0x51'),_0xdbf52[_0x58ea('0x50')]);if(fs[_0x58ea('0x52')](_0x2f02f3)){_0x4c61e7=!![];return _0x56ec36['decryptFile'](_0x2f02f3,_0xdbf52[_0x58ea('0x50')],config[_0x58ea('0x62')][_0x58ea('0x54')])['then'](function(){return _0xdbf52;});}return _0xdbf52;}})[_0x58ea('0x26')](function(_0x11e699){if(_0x11e699){if(!fs['existsSync'](_0x11e699['value'])){throw new db['Sequelize'][(_0x58ea('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x11e699[_0x58ea('0x56')]){return _0x1f929e[_0x58ea('0x4d')](_0x11e699[_0x58ea('0x50')],_0x11e699[_0x58ea('0x56')]+path[_0x58ea('0x57')](_0x11e699[_0x58ea('0x50')]),function(){if(_0x4c61e7){fs[_0x58ea('0x58')](_0x11e699[_0x58ea('0x50')]);}});}else{return _0x1f929e['download'](_0x11e699[_0x58ea('0x50')],function(_0x39cb73){if(_0x4c61e7){fs['unlink'](_0x11e699['value']);}});}}})[_0x58ea('0x43')](handleError(_0x1f929e,null));};exports[_0x58ea('0x63')]=function(_0x27aa13,_0x360d4d){return db[_0x58ea('0x2e')][_0x58ea('0x49')]({'where':{'id':_0x27aa13['params']['id']}})['then'](function(_0x37ff9f){if(_[_0x58ea('0x64')](_0x37ff9f)){throw new ReferenceError(_0x58ea('0x65'));}return _0x37ff9f;})[_0x58ea('0x26')](function(_0x1efe03){var _0x8ae70b=_0x1efe03['value'];logger[_0x58ea('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x8ae70b);if(!_[_0x58ea('0x64')](_0x1efe03[_0x58ea('0x50')])&&fs[_0x58ea('0x52')](_0x8ae70b)){logger[_0x58ea('0x66')]('File:\x20\x22'+_0x8ae70b+_0x58ea('0x67'));fs[_0x58ea('0x68')](_0x8ae70b);}_0x8ae70b=_0x8ae70b+_0x58ea('0x69');if(!_[_0x58ea('0x64')](_0x1efe03[_0x58ea('0x50')])&&fs[_0x58ea('0x52')](_0x8ae70b)){logger[_0x58ea('0x66')](_0x58ea('0x6a')+_0x8ae70b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x8ae70b);}return _0x1efe03;})['then'](function(_0x242b79){if(!_0x242b79)throw new InternalError();return _0x242b79['destroy']();})[_0x58ea('0x26')](function(){_0x360d4d[_0x58ea('0x19')](0xcc)[_0x58ea('0x1a')]();})[_0x58ea('0x43')](handleError(_0x360d4d,null));};function getBucketslist(_0x567655,_0x56c782,_0x17aa2a){return new Promise(function(_0x57e10f,_0xb24e81){var _0x325789=new AWS['S3']({'accessKeyId':_0x56c782,'secretAccessKey':_0x567655,'region':_0x17aa2a});_0x325789[_0x58ea('0x6b')]({},function(_0x45cbdf,_0x48a651){if(_0x45cbdf){return _0xb24e81(_0x45cbdf);}else{return _0x57e10f(_0x48a651);}});});}function createBucket(_0x2aa20f,_0x148d5e,_0x69f88b,_0x367e74){return new Promise(function(_0x23af95,_0x4db5da){var _0x40213a=new AWS['S3']({'accessKeyId':_0x148d5e,'secretAccessKey':_0x2aa20f,'region':_0x69f88b});_0x40213a[_0x58ea('0x6c')]({'Bucket':_0x367e74},function(_0x5f212e,_0x592017){if(_0x5f212e){return _0x4db5da(_0x5f212e);}else{return _0x23af95(_0x592017);}});});}function uploadFile(_0x1b2fd4,_0x2a9567,_0x2f163a,_0x35b139,_0x1889cb,_0x4b4f9b){return new Promise(function(_0x213a14,_0x2ce473){var _0x1d50b2=new AWS['S3']({'accessKeyId':_0x2a9567,'secretAccessKey':_0x1b2fd4,'region':_0x2f163a});_0x1d50b2[_0x58ea('0x6d')]({'Bucket':_0x35b139,'Key':_0x1889cb,'Body':_0x4b4f9b},function(_0x3988a0,_0x5d6e5b){if(_0x3988a0){return _0x2ce473(_0x3988a0);}else{return _0x213a14(_0x5d6e5b);}});});}function startTranscribe(_0x5d270a,_0x4e93a9,_0xb52b3b,_0x15b4fc,_0x390898,_0x55e20a){return new Promise(function(_0xad939,_0x2004a9){var _0x472a46=new AWS[(_0x58ea('0x6e'))]({'accessKeyId':_0x4e93a9,'secretAccessKey':_0x5d270a,'region':_0xb52b3b});_0x472a46[_0x58ea('0x6f')]({'TranscriptionJobName':_0x15b4fc,'LanguageCode':_0x390898,'Media':{'MediaFileUri':_0x55e20a}},function(_0x39b242,_0xf7b27c){if(_0x39b242){return _0x2004a9(_0x39b242);}else{return _0xad939(_0xf7b27c);}});});}function transcribe(_0xe7076b,_0x40aa7c,_0x43780f,_0x1beb25,_0x3f0765,_0x119f5d,_0x304e9b){return new Promise(function(_0x4e3ba4,_0x1abde2){var _0x469efc={};logger['info'](util[_0x58ea('0x61')](_0x58ea('0x70'),_0xe7076b,_0x3f0765));return uploadFile(_0x40aa7c,_0x43780f,_0x1beb25,_0x3f0765,path[_0x58ea('0x71')](_0x119f5d),fs['readFileSync'](_0x119f5d))['then'](function(_0x16577d){logger['info'](util[_0x58ea('0x61')](_0x58ea('0x72'),_0xe7076b,_0x3f0765,_0x16577d[_0x58ea('0x73')]));_0x469efc['bucket']=_0x16577d[_0x58ea('0x74')];_0x469efc[_0x58ea('0x75')]=_0x16577d[_0x58ea('0x73')];logger['info'](util[_0x58ea('0x61')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0xe7076b));return startTranscribe(_0x40aa7c,_0x43780f,_0x1beb25,uuidv4(),_0x304e9b,_0x16577d['Location']);})[_0x58ea('0x26')](function(_0x56be47){logger[_0x58ea('0x66')](util['format'](_0x58ea('0x76'),_0xe7076b,_0x56be47[_0x58ea('0x77')][_0x58ea('0x78')]));_0x469efc[_0x58ea('0x79')]=_0x56be47[_0x58ea('0x77')]['TranscriptionJobName'];_0x469efc[_0x58ea('0x7a')]=_0x56be47[_0x58ea('0x77')][_0x58ea('0x7b')];return _0x4e3ba4(_0x469efc);})[_0x58ea('0x43')](function(_0x5c95e1){return _0x1abde2(_0x5c95e1);});});}exports[_0x58ea('0x7c')]=function(_0x9f7294,_0x1cecd3,_0x1de269){var _0x5ddfa2;var _0x5d9a1d;var _0x2d8783;var _0x1df94f=require('../../components/encryptor');return db['VoiceRecording'][_0x58ea('0x7d')]({'where':{'id':_0x9f7294[_0x58ea('0x45')]['id']}})[_0x58ea('0x26')](function(_0x9b1c82){if(_0x9b1c82){var _0x2123c1=util[_0x58ea('0x61')](_0x58ea('0x51'),_0x9b1c82[_0x58ea('0x50')]);if(fs['existsSync'](_0x2123c1)){cypher=!![];return _0x1df94f[_0x58ea('0x53')](_0x2123c1,_0x9b1c82[_0x58ea('0x50')],config[_0x58ea('0x62')][_0x58ea('0x54')])['then'](function(){return _0x9b1c82;});}return _0x9b1c82;}})[_0x58ea('0x26')](function(_0x51f509){if(!_0x51f509){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x7f'));}_0x5d9a1d=_0x51f509;return db[_0x58ea('0x80')][_0x58ea('0x7d')]({'where':{'id':0x1}});})[_0x58ea('0x26')](handleEntityNotFound(_0x1cecd3,null))[_0x58ea('0x26')](function(_0xcaf4a2){if(_0xcaf4a2){_0x5ddfa2=_0xcaf4a2;if(!_0x5ddfa2['transcribe']||!_0x5ddfa2[_0x58ea('0x81')]||!_0x5ddfa2[_0x58ea('0x82')]||!_0x5ddfa2[_0x58ea('0x83')]||!_0x5ddfa2[_0x58ea('0x84')]){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x85'));}if(_0x9f7294[_0x58ea('0x4b')][_0x58ea('0x86')]&&(!_0x5ddfa2[_0x58ea('0x87')]||!_0x5ddfa2[_0x58ea('0x88')]||!_0x5ddfa2[_0x58ea('0x89')]||!_0x5ddfa2[_0x58ea('0x83')]||!_0x5ddfa2[_0x58ea('0x84')])){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x8a'));}return db[_0x58ea('0x8b')]['findOne']({'where':{'id':_0x5ddfa2[_0x58ea('0x81')]}});}})['then'](function(_0x278e38){if(!_0x278e38){throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x8c'));}if(!_0x278e38[_0x58ea('0x8d')]||!_0x278e38['data2']){throw new db[(_0x58ea('0x7e'))]['ValidationError'](_0x58ea('0x8e'));}_0x2d8783=_0x278e38;return getBucketslist(_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')]);})['then'](function(_0x44ed1b){if(_0x44ed1b&&_0x44ed1b['Buckets']){var _0x1e22b0=_[_0x58ea('0x49')](_0x44ed1b[_0x58ea('0x90')],function(_0x2bcacd){return _0x2bcacd[_0x58ea('0x91')]===_0x5ddfa2['bucket'];});if(!_0x1e22b0){logger[_0x58ea('0x66')](util[_0x58ea('0x61')](_0x58ea('0x92'),_0x9f7294[_0x58ea('0x45')]['id'],_0x5ddfa2[_0x58ea('0x84')]));return createBucket(_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')],_0x5ddfa2[_0x58ea('0x84')]);}logger['info'](util[_0x58ea('0x61')](_0x58ea('0x93'),_0x9f7294[_0x58ea('0x45')]['id'],_0x5ddfa2[_0x58ea('0x84')]));return;}})[_0x58ea('0x26')](function(_0x44dc68){if(_0x5d9a1d[_0x58ea('0x7a')]===_0x58ea('0x94')){return transcribe(_0x9f7294[_0x58ea('0x45')]['id'],_0x2d8783[_0x58ea('0x8d')],_0x2d8783[_0x58ea('0x8f')],_0x5ddfa2[_0x58ea('0x82')],_0x5ddfa2[_0x58ea('0x84')],_0x5d9a1d[_0x58ea('0x50')],_0x5ddfa2[_0x58ea('0x83')]);}else{logger[_0x58ea('0x66')](util[_0x58ea('0x61')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x9f7294[_0x58ea('0x45')]['id']));return{'transcribeStatus':_0x58ea('0x95')};}})[_0x58ea('0x26')](function(_0x5cef9e){if(_0x5cef9e){_0x5cef9e['tempSentiment']=_0x9f7294['body'][_0x58ea('0x86')];return _0x5d9a1d[_0x58ea('0x96')](_0x5cef9e);}})[_0x58ea('0x26')](respondWithResult(_0x1cecd3,null))[_0x58ea('0x43')](handleError(_0x1cecd3,null));};function writeFile(_0x2dd30a,_0x141a43){return new Promise(function(_0x1fce9b,_0x147a27){fs[_0x58ea('0x97')](_0x141a43,_0x2dd30a,function(_0x55a391,_0x554029){if(_0x55a391){return _0x147a27(_0x55a391);}else{return _0x1fce9b(_0x554029);}});});}exports[_0x58ea('0x98')]=function(_0x263f8a,_0x4599de,_0x4ccd57){return db[_0x58ea('0x2e')][_0x58ea('0x7d')]({'where':{'id':_0x263f8a['params']['id']}})[_0x58ea('0x26')](handleEntityNotFound(_0x4599de))[_0x58ea('0x26')](function(_0x5e9cb4){if(_0x5e9cb4&&_0x5e9cb4[_0x58ea('0x99')]){var _0x5e4c27=_0x5e9cb4[_0x58ea('0x99')];var _0x1f553e=config['root']+_0x58ea('0x9a')+_0x5e9cb4['id']+_0x58ea('0x9b');if(fs['existsSync'](_0x1f553e)){return _0x1f553e;}return writeFile(_0x5e4c27,_0x1f553e)['then'](function(){return _0x1f553e;});}else{throw new db[(_0x58ea('0x7e'))][(_0x58ea('0x55'))](_0x58ea('0x9c'));}})[_0x58ea('0x26')](function(_0x4482e4){return _0x4599de[_0x58ea('0x4d')](_0x4482e4);})[_0x58ea('0x43')](handleError(_0x4599de));}; \ No newline at end of file +var _0x1b24=['VoiceRecording','rawAttributes','fieldName','type','differenceBy','format','keys','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','catch','create','body','update','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording','Sequelize','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','destroy','then','end','error','stack','name','index','map'];(function(_0x2dc46e,_0x22c800){var _0x4eb52c=function(_0x235e58){while(--_0x235e58){_0x2dc46e['push'](_0x2dc46e['shift']());}};_0x4eb52c(++_0x22c800);}(_0x1b24,0x1a0));var _0x41b2=function(_0x132e1f,_0x29d247){_0x132e1f=_0x132e1f-0x0;var _0x20a853=_0x1b24[_0x132e1f];return _0x20a853;};'use strict';var emlformat=require(_0x41b2('0x0'));var rimraf=require(_0x41b2('0x1'));var zipdir=require(_0x41b2('0x2'));var jsonpatch=require(_0x41b2('0x3'));var rp=require(_0x41b2('0x4'));var moment=require(_0x41b2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41b2('0x6'));var util=require(_0x41b2('0x7'));var path=require(_0x41b2('0x8'));var sox=require(_0x41b2('0x9'));var csv=require(_0x41b2('0xa'));var ejs=require(_0x41b2('0xb'));var fs=require('fs');var fs_extra=require(_0x41b2('0xc'));var _=require(_0x41b2('0xd'));var squel=require(_0x41b2('0xe'));var crypto=require(_0x41b2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x41b2('0x10'));var toCsv=require(_0x41b2('0xa'));var querystring=require(_0x41b2('0x11'));var Papa=require(_0x41b2('0x12'));var AWS=require(_0x41b2('0x13'));var uuidv4=require('uuid/v4');var Redis=require(_0x41b2('0x14'));var authService=require(_0x41b2('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x41b2('0x16'));var hardwareService=require(_0x41b2('0x17'));var logger=require(_0x41b2('0x18'))(_0x41b2('0x19'));var utils=require('../../config/utils');var config=require(_0x41b2('0x1a'));var licenseUtil=require(_0x41b2('0x1b'));var db=require(_0x41b2('0x1c'))['db'];function respondWithStatusCode(_0xa9bdf4,_0x42e776){_0x42e776=_0x42e776||0xcc;return function(_0x4faf14){if(_0x4faf14){return _0xa9bdf4[_0x41b2('0x1d')](_0x42e776);}return _0xa9bdf4[_0x41b2('0x1e')](_0x42e776)['end']();};}function respondWithResult(_0x31f580,_0x459e33){_0x459e33=_0x459e33||0xc8;return function(_0x562b2c){if(_0x562b2c){return _0x31f580[_0x41b2('0x1e')](_0x459e33)[_0x41b2('0x1f')](_0x562b2c);}};}function respondWithFilteredResult(_0xc23fb8,_0x529a18){return function(_0x485670){if(_0x485670){var _0x405b6c=typeof _0x529a18[_0x41b2('0x20')]===_0x41b2('0x21')&&typeof _0x529a18[_0x41b2('0x22')]==='undefined';var _0x32880d=_0x485670['count'];var _0x1010d7=_0x405b6c?0x0:_0x529a18[_0x41b2('0x20')];var _0x25c538=_0x405b6c?_0x485670['count']:_0x529a18[_0x41b2('0x20')]+_0x529a18[_0x41b2('0x22')];var _0x3fd377;if(_0x25c538>=_0x32880d){_0x25c538=_0x32880d;_0x3fd377=0xc8;}else{_0x3fd377=0xce;}_0xc23fb8[_0x41b2('0x1e')](_0x3fd377);return _0xc23fb8[_0x41b2('0x23')](_0x41b2('0x24'),_0x1010d7+'-'+_0x25c538+'/'+_0x32880d)[_0x41b2('0x1f')](_0x485670);}return null;};}function patchUpdates(_0x40edb2){return function(_0x2f5120){try{jsonpatch[_0x41b2('0x25')](_0x2f5120,_0x40edb2,!![]);}catch(_0x45b8a9){return BPromise['reject'](_0x45b8a9);}return _0x2f5120['save']();};}function saveUpdates(_0x594417,_0x500ccd){return function(_0x11b2ea){if(_0x11b2ea){return _0x11b2ea['update'](_0x594417)['then'](function(_0x12b2dd){return _0x12b2dd;});}return null;};}function removeEntity(_0x665e0c,_0x45096f){return function(_0x47db2f){if(_0x47db2f){return _0x47db2f[_0x41b2('0x26')]()[_0x41b2('0x27')](function(){_0x665e0c['status'](0xcc)[_0x41b2('0x28')]();});}};}function handleEntityNotFound(_0x562bc5,_0x2955a1){return function(_0x5ddcff){if(!_0x5ddcff){_0x562bc5[_0x41b2('0x1d')](0x194);}return _0x5ddcff;};}function handleError(_0x4df0c4,_0x96ec58){_0x96ec58=_0x96ec58||0x1f4;return function(_0xa58d9){logger[_0x41b2('0x29')](_0xa58d9[_0x41b2('0x2a')]);if(_0xa58d9[_0x41b2('0x2b')]){delete _0xa58d9['name'];}_0x4df0c4[_0x41b2('0x1e')](_0x96ec58)['send'](_0xa58d9);};}exports[_0x41b2('0x2c')]=function(_0x365aae,_0x5e78b5){var _0x19eaaa={},_0x2aef7b={},_0x3f774c={'count':0x0,'rows':[]};var _0xe5ce4c=_[_0x41b2('0x2d')](db[_0x41b2('0x2e')][_0x41b2('0x2f')],function(_0x1e4c6b){return{'name':_0x1e4c6b[_0x41b2('0x30')],'type':_0x1e4c6b[_0x41b2('0x31')]['key']};});_0x2aef7b['model']=_[_0x41b2('0x32')](_[_0x41b2('0x2d')](_0xe5ce4c,_0x41b2('0x2b')),[_0x41b2('0x33')]);_0x2aef7b['query']=_[_0x41b2('0x34')](_0x365aae[_0x41b2('0x35')]);_0x2aef7b[_0x41b2('0x36')]=_[_0x41b2('0x37')](_0x2aef7b[_0x41b2('0x38')],_0x2aef7b[_0x41b2('0x35')]);_0x19eaaa['attributes']=_[_0x41b2('0x37')](_0x2aef7b[_0x41b2('0x38')],qs['fields'](_0x365aae[_0x41b2('0x35')][_0x41b2('0x39')]));_0x19eaaa[_0x41b2('0x3a')]=_0x19eaaa['attributes']['length']?_0x19eaaa['attributes']:_0x2aef7b['model'];if(!_0x365aae['query']['hasOwnProperty'](_0x41b2('0x3b'))){_0x19eaaa['limit']=qs[_0x41b2('0x22')](_0x365aae['query'][_0x41b2('0x22')]);_0x19eaaa[_0x41b2('0x20')]=qs[_0x41b2('0x20')](_0x365aae[_0x41b2('0x35')][_0x41b2('0x20')]);}_0x19eaaa[_0x41b2('0x3c')]=qs[_0x41b2('0x3d')](_0x365aae['query'][_0x41b2('0x3d')]);_0x19eaaa[_0x41b2('0x3e')]=qs[_0x41b2('0x36')](_[_0x41b2('0x3f')](_0x365aae[_0x41b2('0x35')],_0x2aef7b[_0x41b2('0x36')]),_0xe5ce4c);if(_0x365aae[_0x41b2('0x35')][_0x41b2('0x40')]){_0x19eaaa[_0x41b2('0x3e')]=_[_0x41b2('0x41')](_0x19eaaa[_0x41b2('0x3e')],{'$or':_[_0x41b2('0x2d')](_0xe5ce4c,function(_0x5e5bfe){if(_0x5e5bfe['type']!==_0x41b2('0x42')){var _0x4f41e9={};_0x4f41e9[_0x5e5bfe[_0x41b2('0x2b')]]={'$like':'%'+_0x365aae[_0x41b2('0x35')][_0x41b2('0x40')]+'%'};return _0x4f41e9;}})});}_0x19eaaa=_[_0x41b2('0x41')]({},_0x19eaaa,_0x365aae[_0x41b2('0x43')]);var _0x1c679c={'where':_0x19eaaa[_0x41b2('0x3e')]};return db['VoiceRecording'][_0x41b2('0x44')](_0x1c679c)['then'](function(_0x508d0f){_0x3f774c[_0x41b2('0x44')]=_0x508d0f;if(_0x365aae['query'][_0x41b2('0x45')]){_0x19eaaa[_0x41b2('0x46')]=[{'all':!![]}];}return db[_0x41b2('0x2e')]['findAll'](_0x19eaaa);})[_0x41b2('0x27')](function(_0x4b1d1e){_0x3f774c[_0x41b2('0x47')]=_0x4b1d1e;return _0x3f774c;})['then'](respondWithFilteredResult(_0x5e78b5,_0x19eaaa))['catch'](handleError(_0x5e78b5,null));};exports[_0x41b2('0x48')]=function(_0x147b37,_0x140007){var _0x34ad0b={'raw':![],'where':{'id':_0x147b37[_0x41b2('0x49')]['id']}},_0x1f79bf={};_0x1f79bf[_0x41b2('0x38')]=_[_0x41b2('0x34')](db['VoiceRecording']['rawAttributes']);_0x1f79bf[_0x41b2('0x35')]=_[_0x41b2('0x34')](_0x147b37[_0x41b2('0x35')]);_0x1f79bf['filters']=_[_0x41b2('0x37')](_0x1f79bf[_0x41b2('0x38')],_0x1f79bf[_0x41b2('0x35')]);_0x34ad0b[_0x41b2('0x3a')]=_[_0x41b2('0x37')](_0x1f79bf['model'],qs[_0x41b2('0x39')](_0x147b37[_0x41b2('0x35')]['fields']));_0x34ad0b[_0x41b2('0x3a')]=_0x34ad0b[_0x41b2('0x3a')][_0x41b2('0x4a')]?_0x34ad0b[_0x41b2('0x3a')]:_0x1f79bf[_0x41b2('0x38')];if(_0x147b37['query'][_0x41b2('0x45')]){_0x34ad0b[_0x41b2('0x46')]=[{'all':!![]}];}_0x34ad0b=_[_0x41b2('0x41')]({},_0x34ad0b,_0x147b37[_0x41b2('0x43')]);return db[_0x41b2('0x2e')][_0x41b2('0x4b')](_0x34ad0b)[_0x41b2('0x27')](handleEntityNotFound(_0x140007,null))[_0x41b2('0x27')](respondWithResult(_0x140007,null))[_0x41b2('0x4c')](handleError(_0x140007,null));};exports[_0x41b2('0x4d')]=function(_0xce150a,_0x15bc6){return db['VoiceRecording']['create'](_0xce150a[_0x41b2('0x4e')],{})['then'](respondWithResult(_0x15bc6,0xc9))[_0x41b2('0x4c')](handleError(_0x15bc6,null));};exports[_0x41b2('0x4f')]=function(_0x4aa73e,_0x444595){if(_0x4aa73e['body']['id']){delete _0x4aa73e[_0x41b2('0x4e')]['id'];}return db[_0x41b2('0x2e')][_0x41b2('0x4b')]({'where':{'id':_0x4aa73e['params']['id']}})[_0x41b2('0x27')](handleEntityNotFound(_0x444595,null))[_0x41b2('0x27')](saveUpdates(_0x4aa73e[_0x41b2('0x4e')],null))[_0x41b2('0x27')](respondWithResult(_0x444595,null))[_0x41b2('0x4c')](handleError(_0x444595,null));};exports[_0x41b2('0x50')]=function(_0x5252c0,_0x39b37e){return db['VoiceRecording']['describe']()[_0x41b2('0x27')](respondWithResult(_0x39b37e,null))['catch'](handleError(_0x39b37e,null));};exports[_0x41b2('0x51')]=function(_0x4879a9,_0xb281dd,_0x291a06){var _0x18930a=require('../../components/encryptor');var _0x3ed6a9=![];var _0x5b2ce1={};if(_0x4879a9[_0x41b2('0x35')][_0x41b2('0x31')]&&_0x4879a9['query'][_0x41b2('0x31')]===_0x41b2('0x52')){_0x5b2ce1[_0x41b2('0x52')]=_0x4879a9['params']['id'];}else{_0x5b2ce1['id']=_0x4879a9[_0x41b2('0x49')]['id'];}return db['VoiceRecording'][_0x41b2('0x4b')]({'where':_0x5b2ce1,'attributes':['id',_0x41b2('0x53')],'raw':!![]})[_0x41b2('0x27')](handleEntityNotFound(_0xb281dd,null))['then'](function(_0x104259){if(_0x104259){var _0x1359be=_0x104259[_0x41b2('0x53')];var _0x274886=util['format'](_0x41b2('0x54'),_0x1359be);if(fs[_0x41b2('0x55')](_0x274886)){_0x3ed6a9=!![];return _0x18930a[_0x41b2('0x56')](_0x274886,_0x1359be,config['secrets']['recording'])[_0x41b2('0x27')](function(){return _0x104259;});}return _0x104259;}})[_0x41b2('0x27')](function(_0x5d685d){if(_0x5d685d){var _0x248d8b=_0x5d685d[_0x41b2('0x53')];if(!fs['existsSync'](_0x248d8b)){throw new db['Sequelize'][(_0x41b2('0x57'))](_0x41b2('0x58'));}if(_0x5d685d[_0x41b2('0x59')]){return _0xb281dd[_0x41b2('0x51')](_0x248d8b,_0x5d685d[_0x41b2('0x59')]+path[_0x41b2('0x5a')](_0x248d8b),function(){if(_0x3ed6a9){fs[_0x41b2('0x5b')](_0x248d8b);}});}else{return _0xb281dd[_0x41b2('0x51')](_0x248d8b,function(_0x3e5688){if(_0x3ed6a9){fs[_0x41b2('0x5b')](_0x248d8b);}});}}})[_0x41b2('0x4c')](function(_0x5aa3ef){if(_0x5aa3ef['message']==='VoiceRecording\x20not\x20found'){_0xb281dd[_0x41b2('0x1e')](0x194)[_0x41b2('0x5c')](_0x41b2('0x5d'));}else{return handleError(_0xb281dd,null);}});};exports['downloads']=function(_0x5cbba2,_0x3b6c30,_0x2bb85f){var _0x546bb3=require(_0x41b2('0x5e'));var _0x205f95=![];var _0xed44d6={'$and':[db[_0x41b2('0x5f')]['where'](db[_0x41b2('0x5f')]['fn'](_0x41b2('0x60'),db[_0x41b2('0x5f')][_0x41b2('0x61')](_0x41b2('0x52'))),_0x5cbba2['query'][_0x41b2('0x62')])]};if(_0x5cbba2[_0x41b2('0x35')][_0x41b2('0x31')]&&_0x5cbba2['query'][_0x41b2('0x31')]==='uniqueid'){_0xed44d6[_0x41b2('0x63')]['push']({'uniqueid':_0x5cbba2[_0x41b2('0x49')]['id']});}else{_0xed44d6[_0x41b2('0x63')][_0x41b2('0x64')]({'id':_0x5cbba2[_0x41b2('0x49')]['id']});}return db[_0x41b2('0x2e')][_0x41b2('0x4b')]({'where':_0xed44d6,'attributes':['id','value'],'raw':!![]})[_0x41b2('0x27')](handleEntityNotFound(_0x3b6c30,null))[_0x41b2('0x27')](function(_0x3d0a18){if(_0x3d0a18){var _0x12808f=util['format'](_0x41b2('0x54'),_0x3d0a18['value']);if(fs['existsSync'](_0x12808f)){_0x205f95=!![];return _0x546bb3[_0x41b2('0x56')](_0x12808f,_0x3d0a18[_0x41b2('0x53')],config['secrets'][_0x41b2('0x65')])['then'](function(){return _0x3d0a18;});}return _0x3d0a18;}})[_0x41b2('0x27')](function(_0x3a877f){if(_0x3a877f){if(!fs[_0x41b2('0x55')](_0x3a877f['value'])){throw new db[(_0x41b2('0x66'))][(_0x41b2('0x57'))](_0x41b2('0x58'));}if(_0x3a877f[_0x41b2('0x59')]){return _0x3b6c30[_0x41b2('0x51')](_0x3a877f[_0x41b2('0x53')],_0x3a877f['filename']+path[_0x41b2('0x5a')](_0x3a877f[_0x41b2('0x53')]),function(){if(_0x205f95){fs['unlink'](_0x3a877f[_0x41b2('0x53')]);}});}else{return _0x3b6c30['download'](_0x3a877f[_0x41b2('0x53')],function(_0x58b34e){if(_0x205f95){fs[_0x41b2('0x5b')](_0x3a877f['value']);}});}}})['catch'](handleError(_0x3b6c30,null));};exports[_0x41b2('0x26')]=function(_0x27abe7,_0x4e09dd){return db[_0x41b2('0x2e')][_0x41b2('0x4b')]({'where':{'id':_0x27abe7[_0x41b2('0x49')]['id']}})[_0x41b2('0x27')](function(_0x24f457){if(_[_0x41b2('0x67')](_0x24f457)){throw new ReferenceError(_0x41b2('0x68'));}return _0x24f457;})[_0x41b2('0x27')](function(_0x3e2c5d){var _0x25d36e=_0x3e2c5d['value'];logger['info'](_0x41b2('0x69'),_0x25d36e);if(!_['isNil'](_0x3e2c5d['value'])&&fs[_0x41b2('0x55')](_0x25d36e)){logger[_0x41b2('0x6a')](_0x41b2('0x6b')+_0x25d36e+_0x41b2('0x6c'));fs['unlinkSync'](_0x25d36e);}_0x25d36e=_0x25d36e+'.cypher';if(!_['isNil'](_0x3e2c5d[_0x41b2('0x53')])&&fs['existsSync'](_0x25d36e)){logger[_0x41b2('0x6a')](_0x41b2('0x6b')+_0x25d36e+_0x41b2('0x6c'));fs['unlinkSync'](_0x25d36e);}return _0x3e2c5d;})[_0x41b2('0x27')](function(_0x3574df){if(!_0x3574df)throw new InternalError();return _0x3574df[_0x41b2('0x26')]();})[_0x41b2('0x27')](function(){_0x4e09dd[_0x41b2('0x1e')](0xcc)[_0x41b2('0x28')]();})[_0x41b2('0x4c')](handleError(_0x4e09dd,null));};function getBucketslist(_0xd4de45,_0x4e7269,_0x2e4477){return new Promise(function(_0x46fbaf,_0x169a24){var _0x31e1df=new AWS['S3']({'accessKeyId':_0x4e7269,'secretAccessKey':_0xd4de45,'region':_0x2e4477});_0x31e1df['listBuckets']({},function(_0xfcec16,_0x175081){if(_0xfcec16){return _0x169a24(_0xfcec16);}else{return _0x46fbaf(_0x175081);}});});}function createBucket(_0x569cdb,_0x33d8dd,_0x3c3745,_0x1e85df){return new Promise(function(_0x30965a,_0x161c2a){var _0x8e5570=new AWS['S3']({'accessKeyId':_0x33d8dd,'secretAccessKey':_0x569cdb,'region':_0x3c3745});_0x8e5570[_0x41b2('0x6d')]({'Bucket':_0x1e85df},function(_0x405d20,_0x518870){if(_0x405d20){return _0x161c2a(_0x405d20);}else{return _0x30965a(_0x518870);}});});}function uploadFile(_0x1183ec,_0x425a71,_0x1a3bd0,_0x382348,_0x1dd41e,_0x148b3a){return new Promise(function(_0x52530d,_0x3efc14){var _0x176186=new AWS['S3']({'accessKeyId':_0x425a71,'secretAccessKey':_0x1183ec,'region':_0x1a3bd0});_0x176186[_0x41b2('0x6e')]({'Bucket':_0x382348,'Key':_0x1dd41e,'Body':_0x148b3a},function(_0x404c5e,_0x18b76f){if(_0x404c5e){return _0x3efc14(_0x404c5e);}else{return _0x52530d(_0x18b76f);}});});}function startTranscribe(_0x12dd90,_0x5a4e28,_0x2eca47,_0x1020d0,_0x120f34,_0x3be3df){return new Promise(function(_0x5254e7,_0x52e823){var _0x11de43=new AWS[(_0x41b2('0x6f'))]({'accessKeyId':_0x5a4e28,'secretAccessKey':_0x12dd90,'region':_0x2eca47});_0x11de43['startTranscriptionJob']({'TranscriptionJobName':_0x1020d0,'LanguageCode':_0x120f34,'Media':{'MediaFileUri':_0x3be3df}},function(_0x1b3ece,_0x3d5753){if(_0x1b3ece){return _0x52e823(_0x1b3ece);}else{return _0x5254e7(_0x3d5753);}});});}function transcribe(_0x5c2298,_0x2e1d3d,_0x2af284,_0x24fd8a,_0x1b25b6,_0x2b3398,_0x48faeb){return new Promise(function(_0x55eca4,_0x1de389){var _0x1791a8={};logger['info'](util[_0x41b2('0x33')](_0x41b2('0x70'),_0x5c2298,_0x1b25b6));return uploadFile(_0x2e1d3d,_0x2af284,_0x24fd8a,_0x1b25b6,path[_0x41b2('0x71')](_0x2b3398),fs[_0x41b2('0x72')](_0x2b3398))[_0x41b2('0x27')](function(_0x42a088){logger[_0x41b2('0x6a')](util[_0x41b2('0x33')](_0x41b2('0x73'),_0x5c2298,_0x1b25b6,_0x42a088[_0x41b2('0x74')]));_0x1791a8[_0x41b2('0x75')]=_0x42a088[_0x41b2('0x76')];_0x1791a8[_0x41b2('0x77')]=_0x42a088[_0x41b2('0x74')];logger['info'](util[_0x41b2('0x33')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x5c2298));return startTranscribe(_0x2e1d3d,_0x2af284,_0x24fd8a,uuidv4(),_0x48faeb,_0x42a088[_0x41b2('0x74')]);})['then'](function(_0x445c2f){logger[_0x41b2('0x6a')](util[_0x41b2('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x5c2298,_0x445c2f['TranscriptionJob'][_0x41b2('0x78')]));_0x1791a8[_0x41b2('0x79')]=_0x445c2f[_0x41b2('0x7a')][_0x41b2('0x78')];_0x1791a8[_0x41b2('0x7b')]=_0x445c2f[_0x41b2('0x7a')][_0x41b2('0x7c')];return _0x55eca4(_0x1791a8);})[_0x41b2('0x4c')](function(_0x523293){return _0x1de389(_0x523293);});});}exports[_0x41b2('0x7d')]=function(_0x28e081,_0x33d916,_0x1566f6){var _0x122018;var _0x412952;var _0x473122;var _0x291a11=require(_0x41b2('0x5e'));return db[_0x41b2('0x2e')][_0x41b2('0x7e')]({'where':{'id':_0x28e081[_0x41b2('0x49')]['id']}})[_0x41b2('0x27')](function(_0x598088){if(_0x598088){var _0x566d9c=util[_0x41b2('0x33')](_0x41b2('0x54'),_0x598088[_0x41b2('0x53')]);if(fs[_0x41b2('0x55')](_0x566d9c)){cypher=!![];return _0x291a11[_0x41b2('0x56')](_0x566d9c,_0x598088[_0x41b2('0x53')],config[_0x41b2('0x7f')][_0x41b2('0x65')])[_0x41b2('0x27')](function(){return _0x598088;});}return _0x598088;}})['then'](function(_0x2761ca){if(!_0x2761ca){throw new db['Sequelize'][(_0x41b2('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x412952=_0x2761ca;return db[_0x41b2('0x80')]['findOne']({'where':{'id':0x1}});})[_0x41b2('0x27')](handleEntityNotFound(_0x33d916,null))[_0x41b2('0x27')](function(_0x52ef13){if(_0x52ef13){_0x122018=_0x52ef13;if(!_0x122018[_0x41b2('0x81')]||!_0x122018[_0x41b2('0x82')]||!_0x122018['transcribeRegion']||!_0x122018['language']||!_0x122018[_0x41b2('0x75')]){throw new db[(_0x41b2('0x66'))]['ValidationError'](_0x41b2('0x83'));}if(_0x28e081['body'][_0x41b2('0x84')]&&(!_0x122018[_0x41b2('0x85')]||!_0x122018[_0x41b2('0x86')]||!_0x122018['sentimentRegion']||!_0x122018['language']||!_0x122018[_0x41b2('0x75')])){throw new db['Sequelize'][(_0x41b2('0x57'))](_0x41b2('0x87'));}return db['CloudProvider']['findOne']({'where':{'id':_0x122018[_0x41b2('0x82')]}});}})['then'](function(_0x12e5f3){if(!_0x12e5f3){throw new db[(_0x41b2('0x66'))]['ValidationError'](_0x41b2('0x88'));}if(!_0x12e5f3['data1']||!_0x12e5f3[_0x41b2('0x89')]){throw new db[(_0x41b2('0x66'))]['ValidationError'](_0x41b2('0x8a'));}_0x473122=_0x12e5f3;return getBucketslist(_0x473122[_0x41b2('0x8b')],_0x473122['data2'],_0x122018[_0x41b2('0x8c')]);})['then'](function(_0x595a1e){if(_0x595a1e&&_0x595a1e[_0x41b2('0x8d')]){var _0x1a53e2=_[_0x41b2('0x4b')](_0x595a1e[_0x41b2('0x8d')],function(_0x30fbec){return _0x30fbec[_0x41b2('0x8e')]===_0x122018[_0x41b2('0x75')];});if(!_0x1a53e2){logger[_0x41b2('0x6a')](util[_0x41b2('0x33')](_0x41b2('0x8f'),_0x28e081['params']['id'],_0x122018['bucket']));return createBucket(_0x473122[_0x41b2('0x8b')],_0x473122['data2'],_0x122018[_0x41b2('0x8c')],_0x122018['bucket']);}logger['info'](util[_0x41b2('0x33')](_0x41b2('0x90'),_0x28e081[_0x41b2('0x49')]['id'],_0x122018[_0x41b2('0x75')]));return;}})['then'](function(_0x3efd83){if(_0x412952['transcribeStatus']===_0x41b2('0x91')){return transcribe(_0x28e081['params']['id'],_0x473122[_0x41b2('0x8b')],_0x473122[_0x41b2('0x89')],_0x122018[_0x41b2('0x8c')],_0x122018[_0x41b2('0x75')],_0x412952[_0x41b2('0x53')],_0x122018['language']);}else{logger[_0x41b2('0x6a')](util[_0x41b2('0x33')](_0x41b2('0x92'),_0x28e081['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x264a64){if(_0x264a64){_0x264a64[_0x41b2('0x93')]=_0x28e081[_0x41b2('0x4e')][_0x41b2('0x84')];return _0x412952[_0x41b2('0x94')](_0x264a64);}})[_0x41b2('0x27')](respondWithResult(_0x33d916,null))[_0x41b2('0x4c')](handleError(_0x33d916,null));};function writeFile(_0x32380c,_0x3d7064){return new Promise(function(_0x5009be,_0x4dc6b4){fs['writeFile'](_0x3d7064,_0x32380c,function(_0x4fbb03,_0x20cfce){if(_0x4fbb03){return _0x4dc6b4(_0x4fbb03);}else{return _0x5009be(_0x20cfce);}});});}exports[_0x41b2('0x95')]=function(_0x3e428f,_0x5f5c17,_0x3b56c1){return db['VoiceRecording'][_0x41b2('0x7e')]({'where':{'id':_0x3e428f[_0x41b2('0x49')]['id']}})[_0x41b2('0x27')](handleEntityNotFound(_0x5f5c17))['then'](function(_0x36b650){if(_0x36b650&&_0x36b650[_0x41b2('0x96')]){var _0x5f2816=_0x36b650[_0x41b2('0x96')];var _0x2fef1b=config[_0x41b2('0x97')]+_0x41b2('0x98')+_0x36b650['id']+'.txt';if(fs[_0x41b2('0x55')](_0x2fef1b)){return _0x2fef1b;}return writeFile(_0x5f2816,_0x2fef1b)['then'](function(){return _0x2fef1b;});}else{throw new db[(_0x41b2('0x66'))]['ValidationError'](_0x41b2('0x99'));}})[_0x41b2('0x27')](function(_0x50ea22){return _0x5f5c17[_0x41b2('0x51')](_0x50ea22);})[_0x41b2('0x4c')](handleError(_0x5f5c17));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 5b3b0bf..def39a5 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 _0x3d15=['transcribeStatus','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0x3d15,0x127));var _0x53d1=function(_0x8ae5f9,_0x49ff8c){_0x8ae5f9=_0x8ae5f9-0x0;var _0x181054=_0x3d15[_0x8ae5f9];return _0x181054;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x53d1('0x0')]=function(_0x24e0fe,_0x5ed61d){return _0x24e0fe[_0x53d1('0x1')](_0x53d1('0x2'),attributes,{'tableName':_0x53d1('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x53d1('0x4')]},{'name':_0x53d1('0x5'),'fields':[_0x53d1('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7dc=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x56f4ac,_0x14785b){var _0x4a7623=function(_0x241ead){while(--_0x241ead){_0x56f4ac['push'](_0x56f4ac['shift']());}};_0x4a7623(++_0x14785b);}(_0xa7dc,0x11d));var _0xca7d=function(_0x49194c,_0x208554){_0x49194c=_0x49194c-0x0;var _0x362b56=_0xa7dc[_0x49194c];return _0x362b56;};'use strict';var attributes=require(_0xca7d('0x0'));module[_0xca7d('0x1')]=function(_0x150001,_0x4ea9c6){return _0x150001[_0xca7d('0x2')]('VoiceRecording',attributes,{'tableName':_0xca7d('0x3'),'paranoid':![],'indexes':[{'name':_0xca7d('0x4'),'fields':[_0xca7d('0x4')]},{'name':_0xca7d('0x5'),'fields':[_0xca7d('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a3a8995..a49415d 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 _0x5f66=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','UpdateVoiceRecording','update','raw','options','where','attributes','../../components/encryptor','findOne','callRecordingEncryption','body','existsSync','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird'];(function(_0x1f8f47,_0xb1a3d8){var _0x5c56de=function(_0x37e34a){while(--_0x37e34a){_0x1f8f47['push'](_0x1f8f47['shift']());}};_0x5c56de(++_0xb1a3d8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['VoiceRecording'][_0x65f6('0x16')](_0x1f974c['body'],{'raw':_0x1f974c['options']?_0x1f974c['options'][_0x65f6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f974c[_0x65f6('0x18')]?_0x1f974c['options'][_0x65f6('0x19')]||null:null,'attributes':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')][_0x65f6('0x1a')]||null:null,'limit':_0x1f974c[_0x65f6('0x18')]?_0x1f974c[_0x65f6('0x18')]['limit']||null:null})[_0x65f6('0xa')](function(_0x4bb39e){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')]('UpdateVoiceRecording',_0x1f974c,JSON[_0x65f6('0xf')](_0x4bb39e));_0x18380e(_0x4bb39e);})[_0x65f6('0x14')](function(_0x2317ce){logger[_0x65f6('0x12')]('UpdateVoiceRecording',_0x2317ce[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x2317ce[_0x65f6('0x11')]));});});};exports['CreateVoiceRecording']=function(_0x5cb131){var _0x4fde2f=this;return new Promise(function(_0x29abdb,_0x16cde8){var _0x4b2292=require(_0x65f6('0x1b'));var _0x28f710;return db['Setting'][_0x65f6('0x1c')]({'attributes':['id',_0x65f6('0x1d')],'where':{'id':0x1},'raw':!![]})[_0x65f6('0xa')](function(_0x559330){_0x28f710=_0x559330;return db['VoiceRecording']['create'](_0x5cb131[_0x65f6('0x1e')]);})[_0x65f6('0xa')](function(_0x4344b3){if(_0x28f710[_0x65f6('0x1d')]&&fs[_0x65f6('0x1f')](_0x4344b3[_0x65f6('0x20')])){var _0x144e55=util['format']('%s.cypher',_0x4344b3[_0x65f6('0x20')]);return _0x4b2292[_0x65f6('0x21')](_0x4344b3['value'],_0x144e55,config['secrets'][_0x65f6('0x22')])[_0x65f6('0xa')](function(){fs[_0x65f6('0x23')](_0x4344b3[_0x65f6('0x20')]);logger[_0x65f6('0x13')](_0x65f6('0x24'));return _0x4344b3;});}return _0x4344b3;})['then'](function(_0x103265){logger[_0x65f6('0x13')](_0x65f6('0x25'),_0x5cb131);logger['debug'](_0x65f6('0x25'),_0x5cb131,JSON[_0x65f6('0xf')](_0x103265));_0x29abdb(_0x103265);})[_0x65f6('0x14')](function(_0x45510a){logger[_0x65f6('0x12')](_0x65f6('0x25'),_0x45510a['message'],_0x5cb131);_0x16cde8(_0x4fde2f[_0x65f6('0x12')](0x1f4,_0x45510a[_0x65f6('0x11')]));});});}; \ No newline at end of file +var _0x47c5=['secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceRecording','update','body','options','raw','where','attributes','limit','UpdateVoiceRecording','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher'];(function(_0x2fc3ee,_0x56ab8c){var _0x2ad3f4=function(_0x101eca){while(--_0x101eca){_0x2fc3ee['push'](_0x2fc3ee['shift']());}};_0x2ad3f4(++_0x56ab8c);}(_0x47c5,0x165));var _0x547c=function(_0x57dc4e,_0x480ebb){_0x57dc4e=_0x57dc4e-0x0;var _0x58bed7=_0x47c5[_0x57dc4e];return _0x58bed7;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['UpdateVoiceRecording']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fa9e['options']?_0x23fa9e['options'][_0x547c('0x1d')]||null:null,'attributes':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1e')]||null:null,'limit':_0x23fa9e[_0x547c('0x1b')]?_0x23fa9e['options'][_0x547c('0x1f')]||null:null})[_0x547c('0xc')](function(_0x436e67){logger['info'](_0x547c('0x20'),_0x23fa9e);logger[_0x547c('0x10')](_0x547c('0x20'),_0x23fa9e,JSON[_0x547c('0x12')](_0x436e67));_0xeb059e(_0x436e67);})[_0x547c('0x17')](function(_0x2663bc){logger[_0x547c('0x13')](_0x547c('0x20'),_0x2663bc['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2663bc['message']));});});};exports['CreateVoiceRecording']=function(_0x4855fd){var _0x478f04=this;return new Promise(function(_0x2c725d,_0x4c5256){var _0x93985c=require('../../components/encryptor');var _0x3ea493;return db['Setting'][_0x547c('0x21')]({'attributes':['id',_0x547c('0x22')],'where':{'id':0x1},'raw':!![]})[_0x547c('0xc')](function(_0x30a96c){_0x3ea493=_0x30a96c;return db[_0x547c('0x18')]['create'](_0x4855fd['body']);})[_0x547c('0xc')](function(_0x54de6f){if(_0x3ea493[_0x547c('0x22')]&&fs[_0x547c('0x23')](_0x54de6f[_0x547c('0x24')])){var _0x1695be=util[_0x547c('0x25')](_0x547c('0x26'),_0x54de6f[_0x547c('0x24')]);return _0x93985c['encryptFile'](_0x54de6f['value'],_0x1695be,config[_0x547c('0x27')][_0x547c('0x28')])[_0x547c('0xc')](function(){fs[_0x547c('0x29')](_0x54de6f[_0x547c('0x24')]);logger[_0x547c('0xd')](_0x547c('0x2a'));return _0x54de6f;});}return _0x54de6f;})[_0x547c('0xc')](function(_0x378bac){logger[_0x547c('0xd')](_0x547c('0x2b'),_0x4855fd);logger[_0x547c('0x10')](_0x547c('0x2b'),_0x4855fd,JSON[_0x547c('0x12')](_0x378bac));_0x2c725d(_0x378bac);})['catch'](function(_0x3afc28){logger['error']('CreateVoiceRecording',_0x3afc28['message'],_0x4855fd);_0x4c5256(_0x478f04[_0x547c('0x13')](0x1f4,_0x3afc28[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4272f94..1f68686 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 _0x4048=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','post'];(function(_0x4695e2,_0x3d5f15){var _0x160563=function(_0x5df0a2){while(--_0x5df0a2){_0x4695e2['push'](_0x4695e2['shift']());}};_0x160563(++_0x3d5f15);}(_0x4048,0x69));var _0x8404=function(_0x290601,_0x21d1c9){_0x290601=_0x290601-0x0;var _0x23dc9f=_0x4048[_0x290601];return _0x23dc9f;};'use strict';var multer=require(_0x8404('0x0'));var util=require(_0x8404('0x1'));var path=require(_0x8404('0x2'));var timeout=require(_0x8404('0x3'));var express=require(_0x8404('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8404('0x5'));var interaction=require(_0x8404('0x6'));var config=require(_0x8404('0x7'));var controller=require(_0x8404('0x8'));router[_0x8404('0x9')]('/',auth['isAuthenticated'](),controller[_0x8404('0xa')]);router[_0x8404('0x9')](_0x8404('0xb'),auth[_0x8404('0xc')](),controller['describe']);router[_0x8404('0x9')](_0x8404('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8404('0xe')]('/',auth[_0x8404('0xc')](),controller['create']);router[_0x8404('0xf')](_0x8404('0xd'),auth[_0x8404('0xc')](),controller[_0x8404('0x10')]);router[_0x8404('0x11')](_0x8404('0xd'),auth[_0x8404('0xc')](),controller[_0x8404('0x12')]);module[_0x8404('0x13')]=router; \ No newline at end of file +var _0xc0d3=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put'];(function(_0x1894e7,_0x1253e6){var _0x5e857f=function(_0x1b47c3){while(--_0x1b47c3){_0x1894e7['push'](_0x1894e7['shift']());}};_0x5e857f(++_0x1253e6);}(_0xc0d3,0x9d));var _0x3c0d=function(_0x1dcbfa,_0x3df713){_0x1dcbfa=_0x1dcbfa-0x0;var _0x55fb42=_0xc0d3[_0x1dcbfa];return _0x55fb42;};'use strict';var multer=require(_0x3c0d('0x0'));var util=require(_0x3c0d('0x1'));var path=require('path');var timeout=require(_0x3c0d('0x2'));var express=require(_0x3c0d('0x3'));var router=express[_0x3c0d('0x4')]();var fs_extra=require(_0x3c0d('0x5'));var auth=require(_0x3c0d('0x6'));var interaction=require(_0x3c0d('0x7'));var config=require(_0x3c0d('0x8'));var controller=require(_0x3c0d('0x9'));router['get']('/',auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xb')]);router[_0x3c0d('0xc')]('/describe',auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xd')]);router[_0x3c0d('0xc')](_0x3c0d('0xe'),auth[_0x3c0d('0xa')](),controller[_0x3c0d('0xf')]);router[_0x3c0d('0x10')]('/',auth['isAuthenticated'](),controller[_0x3c0d('0x11')]);router[_0x3c0d('0x12')](_0x3c0d('0xe'),auth['isAuthenticated'](),controller[_0x3c0d('0x13')]);router[_0x3c0d('0x14')](_0x3c0d('0xe'),auth[_0x3c0d('0xa')](),controller['destroy']);module[_0x3c0d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ce64934..ef6fc88 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 _0xa053=['ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x1a6469,_0x3509da){var _0x1d4e68=function(_0x2d2abd){while(--_0x2d2abd){_0x1a6469['push'](_0x1a6469['shift']());}};_0x1d4e68(++_0x3509da);}(_0xa053,0xee));var _0x3a05=function(_0x58f255,_0xebaa22){_0x58f255=_0x58f255-0x0;var _0x23fbe5=_0xa053[_0x58f255];return _0x23fbe5;};'use strict';var Sequelize=require(_0x3a05('0x0'));var moment=require(_0x3a05('0x1'));module['exports']={'type':{'type':Sequelize[_0x3a05('0x2')](_0x3a05('0x3'),_0x3a05('0x4'))},'result':{'type':Sequelize[_0x3a05('0x5')]},'transfererchannel':{'type':Sequelize[_0x3a05('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x3a05('0x5')]},'transferercalleridname':{'type':Sequelize[_0x3a05('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3a05('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x3a05('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x3a05('0x5')]},'transfereechannel':{'type':Sequelize[_0x3a05('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x3a05('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x3a05('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x3a05('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x3a05('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x3a05('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x3a05('0x5')]},'isexternal':{'type':Sequelize[_0x3a05('0x2')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3a05('0x5')]}}; \ No newline at end of file +var _0xcc10=['sequelize','moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xcc10,0x70));var _0x0cc1=function(_0x402a9c,_0x5dca4f){_0x402a9c=_0x402a9c-0x0;var _0x53892b=_0xcc10[_0x402a9c];return _0x53892b;};'use strict';var Sequelize=require(_0x0cc1('0x0'));var moment=require(_0x0cc1('0x1'));module[_0x0cc1('0x2')]={'type':{'type':Sequelize[_0x0cc1('0x3')](_0x0cc1('0x4'),_0x0cc1('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x0cc1('0x6')]},'transferercalleridname':{'type':Sequelize[_0x0cc1('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0cc1('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x0cc1('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x0cc1('0x6')]},'transferercontext':{'type':Sequelize[_0x0cc1('0x6')]},'transfererexten':{'type':Sequelize[_0x0cc1('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x0cc1('0x6')]},'transfereechannel':{'type':Sequelize[_0x0cc1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x0cc1('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x0cc1('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0cc1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x0cc1('0x6')]},'transfereecontext':{'type':Sequelize[_0x0cc1('0x6')]},'transfereeexten':{'type':Sequelize[_0x0cc1('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x0cc1('0x6')]},'isexternal':{'type':Sequelize[_0x0cc1('0x3')](_0x0cc1('0x7'),'No')},'context':{'type':Sequelize[_0x0cc1('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 9c81fa5..009b22d 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 _0x4ecf=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','findAll','rows','catch','show','find','update','body','params','fast-json-patch','request-promise','moment','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection'];(function(_0x46d79a,_0x3a4d5b){var _0x30aa0e=function(_0x528065){while(--_0x528065){_0x46d79a['push'](_0x46d79a['shift']());}};_0x30aa0e(++_0x3a4d5b);}(_0x4ecf,0xe6));var _0xf4ec=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4ecf[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf4ec('0x0'));var rp=require(_0xf4ec('0x1'));var moment=require(_0xf4ec('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf4ec('0x3'));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(_0xf4ec('0x4'));var crypto=require(_0xf4ec('0x5'));var jsforce=require(_0xf4ec('0x6'));var deskjs=require(_0xf4ec('0x7'));var toCsv=require(_0xf4ec('0x8'));var querystring=require('querystring');var Papa=require(_0xf4ec('0x9'));var Redis=require(_0xf4ec('0xa'));var authService=require(_0xf4ec('0xb'));var qs=require(_0xf4ec('0xc'));var as=require(_0xf4ec('0xd'));var hardwareService=require(_0xf4ec('0xe'));var logger=require(_0xf4ec('0xf'))(_0xf4ec('0x10'));var utils=require(_0xf4ec('0x11'));var config=require(_0xf4ec('0x12'));var licenseUtil=require(_0xf4ec('0x13'));var db=require(_0xf4ec('0x14'))['db'];function respondWithStatusCode(_0xc80233,_0x543b07){_0x543b07=_0x543b07||0xcc;return function(_0x1d851b){if(_0x1d851b){return _0xc80233[_0xf4ec('0x15')](_0x543b07);}return _0xc80233[_0xf4ec('0x16')](_0x543b07)['end']();};}function respondWithResult(_0x50c980,_0xdc92ff){_0xdc92ff=_0xdc92ff||0xc8;return function(_0x21347e){if(_0x21347e){return _0x50c980[_0xf4ec('0x16')](_0xdc92ff)[_0xf4ec('0x17')](_0x21347e);}};}function respondWithFilteredResult(_0x2e7ec3,_0x33625c){return function(_0x188c0f){if(_0x188c0f){var _0x247c67=typeof _0x33625c[_0xf4ec('0x18')]===_0xf4ec('0x19')&&typeof _0x33625c[_0xf4ec('0x1a')]==='undefined';var _0x346de3=_0x188c0f[_0xf4ec('0x1b')];var _0x5bc9ad=_0x247c67?0x0:_0x33625c[_0xf4ec('0x18')];var _0x256971=_0x247c67?_0x188c0f['count']:_0x33625c[_0xf4ec('0x18')]+_0x33625c[_0xf4ec('0x1a')];var _0xb2dd1c;if(_0x256971>=_0x346de3){_0x256971=_0x346de3;_0xb2dd1c=0xc8;}else{_0xb2dd1c=0xce;}_0x2e7ec3[_0xf4ec('0x16')](_0xb2dd1c);return _0x2e7ec3['set'](_0xf4ec('0x1c'),_0x5bc9ad+'-'+_0x256971+'/'+_0x346de3)['json'](_0x188c0f);}return null;};}function patchUpdates(_0x46c490){return function(_0x2de30f){try{jsonpatch['apply'](_0x2de30f,_0x46c490,!![]);}catch(_0x33954e){return BPromise[_0xf4ec('0x1d')](_0x33954e);}return _0x2de30f[_0xf4ec('0x1e')]();};}function saveUpdates(_0x20c274,_0x366895){return function(_0x50578a){if(_0x50578a){return _0x50578a['update'](_0x20c274)[_0xf4ec('0x1f')](function(_0x33b0bf){return _0x33b0bf;});}return null;};}function removeEntity(_0x5b6d95,_0x8d853a){return function(_0x3dc474){if(_0x3dc474){return _0x3dc474[_0xf4ec('0x20')]()[_0xf4ec('0x1f')](function(){_0x5b6d95[_0xf4ec('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd74a,_0x4b427b){return function(_0x3928ee){if(!_0x3928ee){_0x3cd74a[_0xf4ec('0x15')](0x194);}return _0x3928ee;};}function handleError(_0x1547c0,_0x2e7f8b){_0x2e7f8b=_0x2e7f8b||0x1f4;return function(_0x2c88a6){logger['error'](_0x2c88a6['stack']);if(_0x2c88a6['name']){delete _0x2c88a6['name'];}_0x1547c0['status'](_0x2e7f8b)[_0xf4ec('0x21')](_0x2c88a6);};}exports[_0xf4ec('0x22')]=function(_0xad403d,_0x375363){var _0x1324e1={},_0x39913c={},_0x18bf82={'count':0x0,'rows':[]};var _0x2753f3=_[_0xf4ec('0x23')](db['VoiceTransferReport'][_0xf4ec('0x24')],function(_0x112084){return{'name':_0x112084[_0xf4ec('0x25')],'type':_0x112084[_0xf4ec('0x26')][_0xf4ec('0x27')]};});_0x39913c[_0xf4ec('0x28')]=_['map'](_0x2753f3,_0xf4ec('0x29'));_0x39913c[_0xf4ec('0x2a')]=_[_0xf4ec('0x2b')](_0xad403d[_0xf4ec('0x2a')]);_0x39913c[_0xf4ec('0x2c')]=_[_0xf4ec('0x2d')](_0x39913c[_0xf4ec('0x28')],_0x39913c['query']);_0x1324e1[_0xf4ec('0x2e')]=_[_0xf4ec('0x2d')](_0x39913c[_0xf4ec('0x28')],qs['fields'](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x2f')]));_0x1324e1[_0xf4ec('0x2e')]=_0x1324e1['attributes'][_0xf4ec('0x30')]?_0x1324e1[_0xf4ec('0x2e')]:_0x39913c[_0xf4ec('0x28')];if(!_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x31')](_0xf4ec('0x32'))){_0x1324e1['limit']=qs[_0xf4ec('0x1a')](_0xad403d['query'][_0xf4ec('0x1a')]);_0x1324e1['offset']=qs['offset'](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x18')]);}_0x1324e1[_0xf4ec('0x33')]=qs[_0xf4ec('0x34')](_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x34')]);_0x1324e1[_0xf4ec('0x35')]=qs[_0xf4ec('0x2c')](_[_0xf4ec('0x36')](_0xad403d[_0xf4ec('0x2a')],_0x39913c[_0xf4ec('0x2c')]),_0x2753f3);if(_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x37')]){_0x1324e1[_0xf4ec('0x35')]=_[_0xf4ec('0x38')](_0x1324e1[_0xf4ec('0x35')],{'$or':_[_0xf4ec('0x23')](_0x2753f3,function(_0xb376f0){if(_0xb376f0[_0xf4ec('0x26')]!==_0xf4ec('0x39')){var _0x801f0c={};_0x801f0c[_0xb376f0[_0xf4ec('0x29')]]={'$like':'%'+_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x37')]+'%'};return _0x801f0c;}})});}_0x1324e1=_[_0xf4ec('0x38')]({},_0x1324e1,_0xad403d[_0xf4ec('0x3a')]);var _0x16fe64={'where':_0x1324e1[_0xf4ec('0x35')]};return db[_0xf4ec('0x3b')]['count'](_0x16fe64)[_0xf4ec('0x1f')](function(_0x145e1b){_0x18bf82[_0xf4ec('0x1b')]=_0x145e1b;if(_0xad403d[_0xf4ec('0x2a')][_0xf4ec('0x3c')]){_0x1324e1['include']=[{'all':!![]}];}return db[_0xf4ec('0x3b')][_0xf4ec('0x3d')](_0x1324e1);})[_0xf4ec('0x1f')](function(_0x3e7681){_0x18bf82[_0xf4ec('0x3e')]=_0x3e7681;return _0x18bf82;})[_0xf4ec('0x1f')](respondWithFilteredResult(_0x375363,_0x1324e1))[_0xf4ec('0x3f')](handleError(_0x375363,null));};exports[_0xf4ec('0x40')]=function(_0x1827a4,_0x2b2515){var _0x1b9880={'raw':!![],'where':{'id':_0x1827a4['params']['id']}},_0x43a793={};_0x43a793['model']=_[_0xf4ec('0x2b')](db[_0xf4ec('0x3b')][_0xf4ec('0x24')]);_0x43a793[_0xf4ec('0x2a')]=_[_0xf4ec('0x2b')](_0x1827a4['query']);_0x43a793[_0xf4ec('0x2c')]=_['intersection'](_0x43a793[_0xf4ec('0x28')],_0x43a793[_0xf4ec('0x2a')]);_0x1b9880[_0xf4ec('0x2e')]=_[_0xf4ec('0x2d')](_0x43a793['model'],qs['fields'](_0x1827a4[_0xf4ec('0x2a')][_0xf4ec('0x2f')]));_0x1b9880[_0xf4ec('0x2e')]=_0x1b9880[_0xf4ec('0x2e')][_0xf4ec('0x30')]?_0x1b9880['attributes']:_0x43a793['model'];if(_0x1827a4[_0xf4ec('0x2a')][_0xf4ec('0x3c')]){_0x1b9880['include']=[{'all':!![]}];}_0x1b9880=_['merge']({},_0x1b9880,_0x1827a4[_0xf4ec('0x3a')]);return db[_0xf4ec('0x3b')][_0xf4ec('0x41')](_0x1b9880)['then'](handleEntityNotFound(_0x2b2515,null))[_0xf4ec('0x1f')](respondWithResult(_0x2b2515,null))[_0xf4ec('0x3f')](handleError(_0x2b2515,null));};exports['create']=function(_0x2d8ff7,_0x1a046a){return db['VoiceTransferReport']['create'](_0x2d8ff7['body'],{})[_0xf4ec('0x1f')](respondWithResult(_0x1a046a,0xc9))[_0xf4ec('0x3f')](handleError(_0x1a046a,null));};exports[_0xf4ec('0x42')]=function(_0x24479a,_0x2631ec){if(_0x24479a['body']['id']){delete _0x24479a[_0xf4ec('0x43')]['id'];}return db['VoiceTransferReport'][_0xf4ec('0x41')]({'where':{'id':_0x24479a[_0xf4ec('0x44')]['id']}})[_0xf4ec('0x1f')](handleEntityNotFound(_0x2631ec,null))[_0xf4ec('0x1f')](saveUpdates(_0x24479a[_0xf4ec('0x43')],null))[_0xf4ec('0x1f')](respondWithResult(_0x2631ec,null))['catch'](handleError(_0x2631ec,null));};exports[_0xf4ec('0x20')]=function(_0x3e3708,_0x17c269){return db[_0xf4ec('0x3b')][_0xf4ec('0x41')]({'where':{'id':_0x3e3708[_0xf4ec('0x44')]['id']}})[_0xf4ec('0x1f')](handleEntityNotFound(_0x17c269,null))['then'](removeEntity(_0x17c269,null))[_0xf4ec('0x3f')](handleError(_0x17c269,null));};exports['describe']=function(_0x303c1f,_0x260209){return db[_0xf4ec('0x3b')]['describe']()[_0xf4ec('0x1f')](respondWithResult(_0x260209,null))['catch'](handleError(_0x260209,null));}; \ No newline at end of file +var _0xfa9b=['sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','offset','count','Content-Range','json','apply','update','then','destroy','sendStatus','stack','name','send','index','map','VoiceTransferReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','merge','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x13ca76,_0x11dfbd){var _0xcc9566=function(_0x3fdf9c){while(--_0x3fdf9c){_0x13ca76['push'](_0x13ca76['shift']());}};_0xcc9566(++_0x11dfbd);}(_0xfa9b,0xce));var _0xbfa9=function(_0x12f66d,_0x249470){_0x12f66d=_0x12f66d-0x0;var _0x39900f=_0xfa9b[_0x12f66d];return _0x39900f;};'use strict';var emlformat=require(_0xbfa9('0x0'));var rimraf=require(_0xbfa9('0x1'));var zipdir=require(_0xbfa9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbfa9('0x3'));var moment=require(_0xbfa9('0x4'));var BPromise=require(_0xbfa9('0x5'));var Mustache=require('mustache');var util=require(_0xbfa9('0x6'));var path=require('path');var sox=require(_0xbfa9('0x7'));var csv=require(_0xbfa9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbfa9('0x9'));var squel=require(_0xbfa9('0xa'));var crypto=require('crypto');var jsforce=require(_0xbfa9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbfa9('0x8'));var querystring=require(_0xbfa9('0xc'));var Papa=require(_0xbfa9('0xd'));var Redis=require(_0xbfa9('0xe'));var authService=require(_0xbfa9('0xf'));var qs=require(_0xbfa9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbfa9('0x11'));var utils=require(_0xbfa9('0x12'));var config=require(_0xbfa9('0x13'));var licenseUtil=require(_0xbfa9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b5f23,_0x11b629){_0x11b629=_0x11b629||0xcc;return function(_0x36a51b){if(_0x36a51b){return _0x4b5f23['sendStatus'](_0x11b629);}return _0x4b5f23[_0xbfa9('0x15')](_0x11b629)[_0xbfa9('0x16')]();};}function respondWithResult(_0x12e706,_0x5f2871){_0x5f2871=_0x5f2871||0xc8;return function(_0x3a16f4){if(_0x3a16f4){return _0x12e706[_0xbfa9('0x15')](_0x5f2871)['json'](_0x3a16f4);}};}function respondWithFilteredResult(_0x113d7e,_0x255221){return function(_0x265e2d){if(_0x265e2d){var _0x23937b=typeof _0x255221['offset']===_0xbfa9('0x17')&&typeof _0x255221[_0xbfa9('0x18')]===_0xbfa9('0x17');var _0x5541aa=_0x265e2d['count'];var _0x532bfd=_0x23937b?0x0:_0x255221[_0xbfa9('0x19')];var _0x4cc85c=_0x23937b?_0x265e2d[_0xbfa9('0x1a')]:_0x255221[_0xbfa9('0x19')]+_0x255221[_0xbfa9('0x18')];var _0x8113d9;if(_0x4cc85c>=_0x5541aa){_0x4cc85c=_0x5541aa;_0x8113d9=0xc8;}else{_0x8113d9=0xce;}_0x113d7e[_0xbfa9('0x15')](_0x8113d9);return _0x113d7e['set'](_0xbfa9('0x1b'),_0x532bfd+'-'+_0x4cc85c+'/'+_0x5541aa)[_0xbfa9('0x1c')](_0x265e2d);}return null;};}function patchUpdates(_0x4f7cad){return function(_0x3901f4){try{jsonpatch[_0xbfa9('0x1d')](_0x3901f4,_0x4f7cad,!![]);}catch(_0x1aeadc){return BPromise['reject'](_0x1aeadc);}return _0x3901f4['save']();};}function saveUpdates(_0x29869f,_0x3d1ffc){return function(_0x20c6d4){if(_0x20c6d4){return _0x20c6d4[_0xbfa9('0x1e')](_0x29869f)[_0xbfa9('0x1f')](function(_0x2531d8){return _0x2531d8;});}return null;};}function removeEntity(_0x5d140d,_0x38cbc5){return function(_0x260687){if(_0x260687){return _0x260687[_0xbfa9('0x20')]()['then'](function(){_0x5d140d[_0xbfa9('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c4565,_0x34554e){return function(_0x50abcc){if(!_0x50abcc){_0x3c4565[_0xbfa9('0x21')](0x194);}return _0x50abcc;};}function handleError(_0x21910b,_0x7600e0){_0x7600e0=_0x7600e0||0x1f4;return function(_0x545098){logger['error'](_0x545098[_0xbfa9('0x22')]);if(_0x545098[_0xbfa9('0x23')]){delete _0x545098[_0xbfa9('0x23')];}_0x21910b[_0xbfa9('0x15')](_0x7600e0)[_0xbfa9('0x24')](_0x545098);};}exports[_0xbfa9('0x25')]=function(_0x3f0b90,_0x3e0c68){var _0x56a1ac={},_0x32cc05={},_0x37c8b6={'count':0x0,'rows':[]};var _0x5d97ee=_[_0xbfa9('0x26')](db[_0xbfa9('0x27')]['rawAttributes'],function(_0x47fec0){return{'name':_0x47fec0[_0xbfa9('0x28')],'type':_0x47fec0[_0xbfa9('0x29')]['key']};});_0x32cc05[_0xbfa9('0x2a')]=_[_0xbfa9('0x26')](_0x5d97ee,_0xbfa9('0x23'));_0x32cc05['query']=_['keys'](_0x3f0b90[_0xbfa9('0x2b')]);_0x32cc05[_0xbfa9('0x2c')]=_[_0xbfa9('0x2d')](_0x32cc05['model'],_0x32cc05[_0xbfa9('0x2b')]);_0x56a1ac[_0xbfa9('0x2e')]=_[_0xbfa9('0x2d')](_0x32cc05[_0xbfa9('0x2a')],qs[_0xbfa9('0x2f')](_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x2f')]));_0x56a1ac['attributes']=_0x56a1ac[_0xbfa9('0x2e')][_0xbfa9('0x30')]?_0x56a1ac[_0xbfa9('0x2e')]:_0x32cc05[_0xbfa9('0x2a')];if(!_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x31')](_0xbfa9('0x32'))){_0x56a1ac[_0xbfa9('0x18')]=qs[_0xbfa9('0x18')](_0x3f0b90[_0xbfa9('0x2b')]['limit']);_0x56a1ac[_0xbfa9('0x19')]=qs[_0xbfa9('0x19')](_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x19')]);}_0x56a1ac['order']=qs[_0xbfa9('0x33')](_0x3f0b90['query']['sort']);_0x56a1ac[_0xbfa9('0x34')]=qs['filters'](_[_0xbfa9('0x35')](_0x3f0b90[_0xbfa9('0x2b')],_0x32cc05[_0xbfa9('0x2c')]),_0x5d97ee);if(_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x36')]){_0x56a1ac['where']=_['merge'](_0x56a1ac[_0xbfa9('0x34')],{'$or':_[_0xbfa9('0x26')](_0x5d97ee,function(_0x20c74d){if(_0x20c74d[_0xbfa9('0x29')]!==_0xbfa9('0x37')){var _0x5ef2e7={};_0x5ef2e7[_0x20c74d[_0xbfa9('0x23')]]={'$like':'%'+_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x36')]+'%'};return _0x5ef2e7;}})});}_0x56a1ac=_['merge']({},_0x56a1ac,_0x3f0b90[_0xbfa9('0x38')]);var _0x2377b8={'where':_0x56a1ac['where']};return db['VoiceTransferReport'][_0xbfa9('0x1a')](_0x2377b8)[_0xbfa9('0x1f')](function(_0x2aea3e){_0x37c8b6[_0xbfa9('0x1a')]=_0x2aea3e;if(_0x3f0b90[_0xbfa9('0x2b')][_0xbfa9('0x39')]){_0x56a1ac[_0xbfa9('0x3a')]=[{'all':!![]}];}return db[_0xbfa9('0x27')][_0xbfa9('0x3b')](_0x56a1ac);})[_0xbfa9('0x1f')](function(_0xa47131){_0x37c8b6[_0xbfa9('0x3c')]=_0xa47131;return _0x37c8b6;})[_0xbfa9('0x1f')](respondWithFilteredResult(_0x3e0c68,_0x56a1ac))[_0xbfa9('0x3d')](handleError(_0x3e0c68,null));};exports[_0xbfa9('0x3e')]=function(_0x145373,_0x37bdf0){var _0x3f9b3d={'raw':!![],'where':{'id':_0x145373[_0xbfa9('0x3f')]['id']}},_0x47e8ba={};_0x47e8ba['model']=_[_0xbfa9('0x40')](db[_0xbfa9('0x27')][_0xbfa9('0x41')]);_0x47e8ba['query']=_[_0xbfa9('0x40')](_0x145373[_0xbfa9('0x2b')]);_0x47e8ba['filters']=_[_0xbfa9('0x2d')](_0x47e8ba[_0xbfa9('0x2a')],_0x47e8ba[_0xbfa9('0x2b')]);_0x3f9b3d[_0xbfa9('0x2e')]=_[_0xbfa9('0x2d')](_0x47e8ba['model'],qs['fields'](_0x145373[_0xbfa9('0x2b')][_0xbfa9('0x2f')]));_0x3f9b3d[_0xbfa9('0x2e')]=_0x3f9b3d['attributes'][_0xbfa9('0x30')]?_0x3f9b3d[_0xbfa9('0x2e')]:_0x47e8ba[_0xbfa9('0x2a')];if(_0x145373[_0xbfa9('0x2b')]['includeAll']){_0x3f9b3d[_0xbfa9('0x3a')]=[{'all':!![]}];}_0x3f9b3d=_[_0xbfa9('0x42')]({},_0x3f9b3d,_0x145373[_0xbfa9('0x38')]);return db[_0xbfa9('0x27')][_0xbfa9('0x43')](_0x3f9b3d)[_0xbfa9('0x1f')](handleEntityNotFound(_0x37bdf0,null))[_0xbfa9('0x1f')](respondWithResult(_0x37bdf0,null))[_0xbfa9('0x3d')](handleError(_0x37bdf0,null));};exports['create']=function(_0x32e897,_0x1c44d8){return db['VoiceTransferReport'][_0xbfa9('0x44')](_0x32e897[_0xbfa9('0x45')],{})[_0xbfa9('0x1f')](respondWithResult(_0x1c44d8,0xc9))[_0xbfa9('0x3d')](handleError(_0x1c44d8,null));};exports[_0xbfa9('0x1e')]=function(_0x2f6cec,_0x42ff48){if(_0x2f6cec[_0xbfa9('0x45')]['id']){delete _0x2f6cec[_0xbfa9('0x45')]['id'];}return db[_0xbfa9('0x27')][_0xbfa9('0x43')]({'where':{'id':_0x2f6cec[_0xbfa9('0x3f')]['id']}})[_0xbfa9('0x1f')](handleEntityNotFound(_0x42ff48,null))[_0xbfa9('0x1f')](saveUpdates(_0x2f6cec[_0xbfa9('0x45')],null))[_0xbfa9('0x1f')](respondWithResult(_0x42ff48,null))[_0xbfa9('0x3d')](handleError(_0x42ff48,null));};exports[_0xbfa9('0x20')]=function(_0x3d801c,_0x521f5a){return db['VoiceTransferReport'][_0xbfa9('0x43')]({'where':{'id':_0x3d801c[_0xbfa9('0x3f')]['id']}})[_0xbfa9('0x1f')](handleEntityNotFound(_0x521f5a,null))[_0xbfa9('0x1f')](removeEntity(_0x521f5a,null))['catch'](handleError(_0x521f5a,null));};exports[_0xbfa9('0x46')]=function(_0x349ebb,_0xbd653a){return db[_0xbfa9('0x27')][_0xbfa9('0x46')]()[_0xbfa9('0x1f')](respondWithResult(_0xbd653a,null))[_0xbfa9('0x3d')](handleError(_0xbd653a,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 53db744..bead733 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 _0xc296=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xc296,0x1c3));var _0x6c29=function(_0x161d0c,_0x337272){_0x161d0c=_0x161d0c-0x0;var _0x53518f=_0xc296[_0x161d0c];return _0x53518f;};'use strict';var _=require(_0x6c29('0x0'));var util=require(_0x6c29('0x1'));var logger=require(_0x6c29('0x2'))(_0x6c29('0x3'));var moment=require(_0x6c29('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c29('0x5'));var rimraf=require(_0x6c29('0x6'));var config=require(_0x6c29('0x7'));var attributes=require(_0x6c29('0x8'));module['exports']=function(_0x368817,_0xbddb8c){return _0x368817[_0x6c29('0x9')](_0x6c29('0xa'),attributes,{'tableName':_0x6c29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb190=['define','VoiceTransferReport','report_call_transfer','lodash','api','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x1dc0cb,_0x440046){var _0x44d004=function(_0x522f8a){while(--_0x522f8a){_0x1dc0cb['push'](_0x1dc0cb['shift']());}};_0x44d004(++_0x440046);}(_0xb190,0x142));var _0x0b19=function(_0x362448,_0x4391aa){_0x362448=_0x362448-0x0;var _0x5749e6=_0xb190[_0x362448];return _0x5749e6;};'use strict';var _=require(_0x0b19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0b19('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0b19('0x2'));var fs=require('fs');var path=require(_0x0b19('0x3'));var rimraf=require(_0x0b19('0x4'));var config=require(_0x0b19('0x5'));var attributes=require(_0x0b19('0x6'));module[_0x0b19('0x7')]=function(_0x27889a,_0x45fd19){return _0x27889a[_0x0b19('0x8')](_0x0b19('0x9'),attributes,{'tableName':_0x0b19('0xa'),'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 a0a0d91..358cbb3 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 _0xbc12=['jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xbc12,0x19a));var _0x2bc1=function(_0x221246,_0x168ceb){_0x221246=_0x221246-0x0;var _0x13e1ea=_0xbc12[_0x221246];return _0x13e1ea;};'use strict';var _=require(_0x2bc1('0x0'));var util=require(_0x2bc1('0x1'));var moment=require('moment');var BPromise=require(_0x2bc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2bc1('0x4'))('rpc');var config=require(_0x2bc1('0x5'));var jayson=require(_0x2bc1('0x6'));var client=jayson['client'][_0x2bc1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3fa9ae,_0x252781,_0xfa384b){return new BPromise(function(_0x461f77,_0x2485dc){return client[_0x2bc1('0x8')](_0x3fa9ae,_0xfa384b)[_0x2bc1('0x9')](function(_0x27ccf2){logger[_0x2bc1('0xa')](_0x2bc1('0xb'),_0x252781,_0x2bc1('0xc'));logger[_0x2bc1('0xd')](_0x2bc1('0xe'),_0x252781,_0x2bc1('0xc'),JSON[_0x2bc1('0xf')](_0x27ccf2));if(_0x27ccf2[_0x2bc1('0x10')]){if(_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x11')]===0x1f4){logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x27ccf2['error'][_0x2bc1('0x12')]);return _0x2485dc(_0x27ccf2['error'][_0x2bc1('0x12')]);}logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x12')]);return _0x461f77(_0x27ccf2[_0x2bc1('0x10')][_0x2bc1('0x12')]);}else{logger['info'](_0x2bc1('0xb'),_0x252781,_0x2bc1('0xc'));_0x461f77(_0x27ccf2['result'][_0x2bc1('0x12')]);}})[_0x2bc1('0x13')](function(_0x5b1bfd){logger[_0x2bc1('0x10')](_0x2bc1('0xb'),_0x252781,_0x5b1bfd);_0x2485dc(_0x5b1bfd);});});}exports[_0x2bc1('0x14')]=function(_0x42a57c){var _0x14afc9=this;return new Promise(function(_0x3b8128,_0x33e24b){return db[_0x2bc1('0x15')][_0x2bc1('0x16')](_0x42a57c[_0x2bc1('0x17')],{'raw':_0x42a57c['options']?_0x42a57c[_0x2bc1('0x18')][_0x2bc1('0x19')]===undefined?!![]:![]:!![]})[_0x2bc1('0x9')](function(_0x2e97f0){logger[_0x2bc1('0xa')](_0x2bc1('0x14'),_0x42a57c);logger['debug'](_0x2bc1('0x14'),_0x42a57c,JSON[_0x2bc1('0xf')](_0x2e97f0));_0x3b8128(_0x2e97f0);})[_0x2bc1('0x13')](function(_0x5b595f){logger[_0x2bc1('0x10')]('CreateVoiceTransferReport',_0x5b595f[_0x2bc1('0x12')],_0x42a57c);_0x33e24b(_0x14afc9[_0x2bc1('0x10')](0x1f4,_0x5b595f[_0x2bc1('0x12')]));});});}; \ No newline at end of file +var _0xfa92=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','debug','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa92,0x89));var _0x2fa9=function(_0x2c510e,_0x4492ae){_0x2c510e=_0x2c510e-0x0;var _0x1532b4=_0xfa92[_0x2c510e];return _0x1532b4;};'use strict';var _=require('lodash');var util=require(_0x2fa9('0x0'));var moment=require(_0x2fa9('0x1'));var BPromise=require(_0x2fa9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fa9('0x3'));var db=require(_0x2fa9('0x4'))['db'];var utils=require(_0x2fa9('0x5'));var logger=require(_0x2fa9('0x6'))(_0x2fa9('0x7'));var config=require(_0x2fa9('0x8'));var jayson=require(_0x2fa9('0x9'));var client=jayson[_0x2fa9('0xa')][_0x2fa9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35ac61,_0x42acf9,_0x3368e8){return new BPromise(function(_0x4c5514,_0x47c358){return client[_0x2fa9('0xc')](_0x35ac61,_0x3368e8)[_0x2fa9('0xd')](function(_0x53be29){logger[_0x2fa9('0xe')](_0x2fa9('0xf'),_0x42acf9,'request\x20sent');logger['debug'](_0x2fa9('0x10'),_0x42acf9,'request\x20sent',JSON[_0x2fa9('0x11')](_0x53be29));if(_0x53be29[_0x2fa9('0x12')]){if(_0x53be29[_0x2fa9('0x12')]['code']===0x1f4){logger[_0x2fa9('0x12')](_0x2fa9('0xf'),_0x42acf9,_0x53be29[_0x2fa9('0x12')][_0x2fa9('0x13')]);return _0x47c358(_0x53be29['error'][_0x2fa9('0x13')]);}logger[_0x2fa9('0x12')](_0x2fa9('0xf'),_0x42acf9,_0x53be29[_0x2fa9('0x12')][_0x2fa9('0x13')]);return _0x4c5514(_0x53be29['error'][_0x2fa9('0x13')]);}else{logger[_0x2fa9('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x42acf9,'request\x20sent');_0x4c5514(_0x53be29['result'][_0x2fa9('0x13')]);}})[_0x2fa9('0x14')](function(_0x283c63){logger[_0x2fa9('0x12')](_0x2fa9('0xf'),_0x42acf9,_0x283c63);_0x47c358(_0x283c63);});});}exports[_0x2fa9('0x15')]=function(_0x3fdfd5){var _0x52715c=this;return new Promise(function(_0x392453,_0x34ce8f){return db[_0x2fa9('0x16')][_0x2fa9('0x17')](_0x3fdfd5[_0x2fa9('0x18')],{'raw':_0x3fdfd5[_0x2fa9('0x19')]?_0x3fdfd5[_0x2fa9('0x19')][_0x2fa9('0x1a')]===undefined?!![]:![]:!![]})[_0x2fa9('0xd')](function(_0x41f691){logger[_0x2fa9('0xe')](_0x2fa9('0x15'),_0x3fdfd5);logger[_0x2fa9('0x1b')](_0x2fa9('0x15'),_0x3fdfd5,JSON[_0x2fa9('0x11')](_0x41f691));_0x392453(_0x41f691);})['catch'](function(_0x3ca7e1){logger['error']('CreateVoiceTransferReport',_0x3ca7e1[_0x2fa9('0x13')],_0x3fdfd5);_0x34ce8f(_0x52715c[_0x2fa9('0x12')](0x1f4,_0x3ca7e1[_0x2fa9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 608852f..c7e4c0c 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 _0x750a=['Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/unhold','unhold','/calls','calls','/transfer','transfer','exports'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x750a,0x140));var _0xa750=function(_0x4eeb05,_0xd22898){_0x4eeb05=_0x4eeb05-0x0;var _0x313626=_0x750a[_0x4eeb05];return _0x313626;};'use strict';var express=require('express');var router=express[_0xa750('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0xa750('0x1')](_0xa750('0x2'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x5')]);router[_0xa750('0x1')](_0xa750('0x6'),auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller[_0xa750('0x7')]);router[_0xa750('0x1')](_0xa750('0x8'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xa750('0x1')]('/hold',auth[_0xa750('0x3')](),auth[_0xa750('0x4')](),controller['hold']);router[_0xa750('0x1')](_0xa750('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xa750('0xa')]);router['post'](_0xa750('0xb'),auth[_0xa750('0x3')](),auth['isWebrtcLicence'](),controller[_0xa750('0xc')]);router[_0xa750('0x1')](_0xa750('0xd'),auth['isAuthenticated'](),auth[_0xa750('0x4')](),controller[_0xa750('0xe')]);module[_0xa750('0xf')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb43b,0x1b2));var _0xbb43=function(_0xab498f,_0x50165c){_0xab498f=_0xab498f-0x0;var _0x5e511a=_0xb43b[_0xab498f];return _0x5e511a;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0829061..2986dab 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 _0x6f7f=['client','../../config/logger','webbarapi','ioredis','defaults','localhost','socket.io-emitter','redis','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','stack','name','status','send','request','then','error','message','result','User','findOne','agent','VoiceChannels','all','rows','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x34d478,_0x4e5042){var _0x27aff3=function(_0x1ae6b9){while(--_0x1ae6b9){_0x34d478['push'](_0x34d478['shift']());}};_0x27aff3(++_0x4e5042);}(_0x6f7f,0x177));var _0xf6f7=function(_0x2b69f1,_0x3635c5){_0x2b69f1=_0x2b69f1-0x0;var _0x2b1387=_0x6f7f[_0x2b69f1];return _0x2b1387;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf6f7('0x0'));var db=require(_0xf6f7('0x1'))['db'];var config=require(_0xf6f7('0x2'));var util=require(_0xf6f7('0x3'));var BPromise=require(_0xf6f7('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xf6f7('0x5')]['http']({'port':0x232a});var logger=require(_0xf6f7('0x6'))(_0xf6f7('0x7'));var Redis=require(_0xf6f7('0x8'));config['redis']=_[_0xf6f7('0x9')](config['redis'],{'host':_0xf6f7('0xa'),'port':0x18eb});var io=require(_0xf6f7('0xb'))(new Redis(config[_0xf6f7('0xc')]));var Schema=require(_0xf6f7('0xd'));var originateValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]},'callNumber':{'type':'string','required':[!![],_0xf6f7('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6f7('0xf')]},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0xf6f7('0x12')]},'transferNumber':{'type':_0xf6f7('0x11'),'required':[!![],_0xf6f7('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf6f7('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf6f7('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf6f7('0xe'),'required':[!![],_0xf6f7('0xf')]}});function emit(_0x2758c0,_0x16cde1,_0x4b8eb2){logger[_0xf6f7('0x14')](_0x2758c0,_0x16cde1,JSON[_0xf6f7('0x15')](_0x4b8eb2));io['to'](_0x2758c0)['emit'](_0x16cde1,_0x4b8eb2);}function handleError(_0x2e5fa3){return function(_0x438e3d){console[_0xf6f7('0x16')](_0xf6f7('0x17'),_0x438e3d,_0x438e3d instanceof RangeError);logger['error'](_0x438e3d[_0xf6f7('0x18')]);if(_0x438e3d instanceof RangeError){if(_0x438e3d[_0xf6f7('0x19')]){delete _0x438e3d['name'];}_0x2e5fa3[_0xf6f7('0x1a')](0x194)[_0xf6f7('0x1b')](_0x438e3d);}else{if(_0x438e3d[_0xf6f7('0x19')]){delete _0x438e3d[_0xf6f7('0x19')];}_0x2e5fa3[_0xf6f7('0x1a')](0x1f4)[_0xf6f7('0x1b')](_0x438e3d);}};}function checkError(){return function(_0x3ec9c4){if(!_0x3ec9c4){throw new RangeError('NotFound');}return _0x3ec9c4;};}function respondWithRpcPromise(_0x138c7e,_0x5b6d3f){return new BPromise(function(_0x58ca0f,_0x66e5e4){var _0x532ee4=amiClient;return _0x532ee4[_0xf6f7('0x1c')](_0x138c7e,_0x5b6d3f)[_0xf6f7('0x1d')](function(_0x50b550){if(_0x50b550[_0xf6f7('0x1e')]){if(_0x50b550['error']['code']===0x1f4){return _0x66e5e4(_0x50b550[_0xf6f7('0x1e')][_0xf6f7('0x1f')]);}return _0x58ca0f(_0x50b550[_0xf6f7('0x1e')][_0xf6f7('0x1f')]);}else{_0x58ca0f(_0x50b550[_0xf6f7('0x20')]);}})['catch'](function(_0x4c1ecd){_0x66e5e4(_0x4c1ecd);});});}function getAgent(_0x3fecc1){return db[_0xf6f7('0x21')][_0xf6f7('0x22')]({'where':{'id':_0x3fecc1,'role':_0xf6f7('0x23')}})[_0xf6f7('0x1d')](checkError());}function getAgentCheckSession(_0x2c93c8,_0x4b6e82){return new BPromise(function(_0x49dd11,_0x2c545c){var _0x3a6f6a=respondWithRpcPromise(_0xf6f7('0x24'));var _0x35a384=getAgent(_0x2c93c8);Promise[_0xf6f7('0x25')]([_0x3a6f6a,_0x35a384])[_0xf6f7('0x1d')](function(_0x4b3100){var _0x47f9ef=_0x4b3100[0x0];var _0x4bd86c=_0x4b3100[0x1];var _0x3bd11b=_['filter'](_0x47f9ef[_0xf6f7('0x26')],function(_0x35b586){return _0x35b586['UserId']==_0x4bd86c['id']&&_0x35b586['sessionId']==_0x4b6e82;});if(_0x3bd11b[_0xf6f7('0x27')]==0x1){_0x49dd11(_0x4bd86c);}else{_0x2c545c(new RangeError(_0xf6f7('0x28')+_0x4b6e82+_0xf6f7('0x29')));}});});}exports['originate']=function(_0x2fcb7c,_0x505b20){logger[_0xf6f7('0x14')](_0xf6f7('0x2a'),_0x2fcb7c[_0xf6f7('0x2b')]);var _0x2f2178=originateValidation[_0xf6f7('0xd')](_0x2fcb7c[_0xf6f7('0x2b')]);if(_0x2f2178[_0xf6f7('0x27')]>0x0){return _0x505b20[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x2f2178);}var _0x174730=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x5883e3=_0x2fcb7c[_0xf6f7('0x2b')]['callNumber'];var _0x1feb3a=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2e')];var _0x16404d=_0x2fcb7c[_0xf6f7('0x2b')][_0xf6f7('0x2f')];return getAgent(_0x174730)[_0xf6f7('0x1d')](function(_0x16522e){logger[_0xf6f7('0x14')]('entityFound:',_0x16522e['name']);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x16522e[_0xf6f7('0x19')]),_0xf6f7('0x32'),{'callNumber':_0x5883e3,'callerId':_0x1feb3a,'callbackUrl':_0x16404d});return _0x505b20[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x33')});})[_0xf6f7('0x34')](handleError(_0x505b20));};exports[_0xf6f7('0x35')]=function(_0x27be8a,_0x332da0){logger[_0xf6f7('0x14')](_0xf6f7('0x36'),_0x27be8a[_0xf6f7('0x2b')]);var _0x12488c=hangupValidation[_0xf6f7('0xd')](_0x27be8a['body']);if(_0x12488c['length']>0x0){return _0x332da0[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x12488c);}var _0x9dde0a=_0x27be8a[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x2759fd=_0x27be8a['body'][_0xf6f7('0x37')];return getAgent(_0x9dde0a)[_0xf6f7('0x1d')](function(_0x14e4ee){logger[_0xf6f7('0x14')]('entityFound:',_0x14e4ee['name']);emit(util[_0xf6f7('0x30')]('user:%s',_0x14e4ee['name']),_0xf6f7('0x38'),{'sessionId':_0x2759fd});return _0x332da0[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':'hangup\x20executed!'});})[_0xf6f7('0x34')](handleError(_0x332da0));};exports[_0xf6f7('0x39')]=function(_0x3717a0,_0x417716){logger['info'](_0xf6f7('0x3a'),_0x3717a0[_0xf6f7('0x2b')]);var _0x49bfca=answerValidation['validate'](_0x3717a0[_0xf6f7('0x2b')]);if(_0x49bfca['length']>0x0){return _0x417716[_0xf6f7('0x1a')](0x190)['json'](_0x49bfca);}var _0x4c168a=_0x3717a0['body'][_0xf6f7('0x2d')];var _0x2bc188=_0x3717a0[_0xf6f7('0x2b')][_0xf6f7('0x37')];return getAgent(_0x4c168a)['then'](function(_0x8206f8){logger['info'](_0xf6f7('0x3b'),_0x8206f8['name']);emit(util['format'](_0xf6f7('0x31'),_0x8206f8[_0xf6f7('0x19')]),_0xf6f7('0x3c'),{'sessionId':_0x2bc188});return _0x417716['status'](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x3d')});})['catch'](handleError(_0x417716));};exports['hold']=function(_0x1d687c,_0x585d70){logger[_0xf6f7('0x14')]('hold\x20fired:',_0x1d687c['body']);var _0xdd039d=holdValidation['validate'](_0x1d687c[_0xf6f7('0x2b')]);if(_0xdd039d['length']>0x0){return _0x585d70[_0xf6f7('0x1a')](0x190)['json'](_0xdd039d);}var _0x4afd83=_0x1d687c[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x2b1a0c=_0x1d687c[_0xf6f7('0x2b')][_0xf6f7('0x37')];return getAgent(_0x4afd83)[_0xf6f7('0x1d')](function(_0x1d944a){logger[_0xf6f7('0x14')](_0xf6f7('0x3b'),_0x1d944a[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x1d944a['name']),_0xf6f7('0x3e'),{'sessionId':_0x2b1a0c});return _0x585d70['status'](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x3f')});})[_0xf6f7('0x34')](handleError(_0x585d70));};exports['unhold']=function(_0x142cb4,_0x1cc654){logger[_0xf6f7('0x14')](_0xf6f7('0x40'),_0x142cb4[_0xf6f7('0x2b')]);var _0x54228d=unholdValidation[_0xf6f7('0xd')](_0x142cb4['body']);if(_0x54228d[_0xf6f7('0x27')]>0x0){return _0x1cc654[_0xf6f7('0x1a')](0x190)[_0xf6f7('0x2c')](_0x54228d);}var _0x5f19f2=_0x142cb4['body'][_0xf6f7('0x2d')];var _0x21c3e8=_0x142cb4[_0xf6f7('0x2b')]['sessionId'];return getAgent(_0x5f19f2)[_0xf6f7('0x1d')](function(_0x240ce5){logger[_0xf6f7('0x14')](_0xf6f7('0x3b'),_0x240ce5[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')]('user:%s',_0x240ce5[_0xf6f7('0x19')]),_0xf6f7('0x41'),{'sessionId':_0x21c3e8});return _0x1cc654['status'](0xc8)['json']({'error':![],'message':_0xf6f7('0x42')});})[_0xf6f7('0x34')](handleError(_0x1cc654));};exports['calls']=function(_0x208507,_0x5878ff){logger[_0xf6f7('0x14')](_0xf6f7('0x43'),_0x5878ff[_0xf6f7('0x2b')]);var _0xe674ca=callsValidation[_0xf6f7('0xd')](_0x208507[_0xf6f7('0x2b')]);if(_0xe674ca[_0xf6f7('0x27')]>0x0){return _0x5878ff[_0xf6f7('0x1a')](0x190)['json'](_0xe674ca);}var _0x56aad4=_0x208507['body'][_0xf6f7('0x2d')];var _0x2a2fdb=respondWithRpcPromise(_0xf6f7('0x24'));var _0x2986e0=getAgent(_0x56aad4);return Promise['all']([_0x2a2fdb,_0x2986e0])[_0xf6f7('0x1d')](function(_0x4e6415){var _0x117ec1=_0x4e6415[0x0];var _0x10a570=_0x4e6415[0x1];var _0x8065df=_[_0xf6f7('0x44')](_0x117ec1['rows'],function(_0x1e43c4){return _0x1e43c4[_0xf6f7('0x45')]==_0x10a570['id'];});return _0x5878ff[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'count':_0x8065df[_0xf6f7('0x27')],'rows':_0x8065df});})[_0xf6f7('0x34')](handleError(_0x5878ff));};exports[_0xf6f7('0x46')]=function(_0x48d456,_0x4ee370){logger['info'](_0xf6f7('0x47'),_0x48d456[_0xf6f7('0x2b')]);var _0xbc6c20=conferenceValidation[_0xf6f7('0xd')](_0x48d456[_0xf6f7('0x2b')]);if(_0xbc6c20[_0xf6f7('0x27')]>0x0){return _0x4ee370[_0xf6f7('0x1a')](0x190)['json'](_0xbc6c20);}var _0x4a8602=_0x48d456[_0xf6f7('0x2b')][_0xf6f7('0x2d')];return getAgent(_0x4a8602)['then'](function(_0x100e14){logger['info']('entityFound:',_0x100e14[_0xf6f7('0x19')]);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x100e14[_0xf6f7('0x19')]),_0xf6f7('0x48'));return _0x4ee370[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x49')});})[_0xf6f7('0x34')](handleError(_0x4ee370));};exports[_0xf6f7('0x4a')]=function(_0x161bb2,_0x12a8e1){logger[_0xf6f7('0x14')]('transfer\x20fired:',_0x161bb2['body']);var _0x7ce53f=transferValidation['validate'](_0x161bb2[_0xf6f7('0x2b')]);if(_0x7ce53f[_0xf6f7('0x27')]>0x0){return _0x12a8e1[_0xf6f7('0x1a')](0x190)['json'](_0x7ce53f);}var _0x1e078d=_0x161bb2[_0xf6f7('0x2b')][_0xf6f7('0x2d')];var _0x188a9a=_0x161bb2['body'][_0xf6f7('0x37')];var _0x350f64=_0x161bb2['body']['transferNumber'];return getAgent(_0x1e078d)[_0xf6f7('0x1d')](function(_0x4a8a51){logger['info'](_0xf6f7('0x3b'),_0x4a8a51['name']);emit(util[_0xf6f7('0x30')](_0xf6f7('0x31'),_0x4a8a51[_0xf6f7('0x19')]),'webbar:transfer',{'sessionId':_0x188a9a,'transferNumber':_0x350f64});return _0x12a8e1[_0xf6f7('0x1a')](0xc8)[_0xf6f7('0x2c')]({'error':![],'message':_0xf6f7('0x4b')});})['catch'](handleError(_0x12a8e1));}; \ No newline at end of file +var _0x9aea=['calls\x20fired:','conference\x20fired:','conference\x20executed!','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','NotFound','error','message','result','catch','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','length','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9aea,0xdd));var _0xa9ae=function(_0x43b9bc,_0x7063){_0x43b9bc=_0x43b9bc-0x0;var _0x35dc7a=_0x9aea[_0x43b9bc];return _0x35dc7a;};'use strict';var path=require(_0xa9ae('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xa9ae('0x1'))['db'];var config=require('../../config/environment');var util=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xa9ae('0x4')][_0xa9ae('0x5')]({'port':0x232a});var logger=require(_0xa9ae('0x6'))(_0xa9ae('0x7'));var Redis=require(_0xa9ae('0x8'));config['redis']=_[_0xa9ae('0x9')](config[_0xa9ae('0xa')],{'host':_0xa9ae('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa9ae('0xa')]));var Schema=require(_0xa9ae('0xc'));var originateValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'callNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x10')]},'callerId':{'type':_0xa9ae('0xf')},'callbackUrl':{'type':_0xa9ae('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x11')]},'transferNumber':{'type':_0xa9ae('0xf'),'required':[!![],_0xa9ae('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':_0xa9ae('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa9ae('0xd'),'required':[!![],_0xa9ae('0xe')]}});function emit(_0x77b0a4,_0xddb095,_0x524bb2){logger[_0xa9ae('0x13')](_0x77b0a4,_0xddb095,JSON[_0xa9ae('0x14')](_0x524bb2));io['to'](_0x77b0a4)[_0xa9ae('0x15')](_0xddb095,_0x524bb2);}function handleError(_0x4ac5a6){return function(_0x4dbb30){console[_0xa9ae('0x16')]('handleError:',_0x4dbb30,_0x4dbb30 instanceof RangeError);logger['error'](_0x4dbb30[_0xa9ae('0x17')]);if(_0x4dbb30 instanceof RangeError){if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x194)['send'](_0x4dbb30);}else{if(_0x4dbb30[_0xa9ae('0x18')]){delete _0x4dbb30[_0xa9ae('0x18')];}_0x4ac5a6[_0xa9ae('0x19')](0x1f4)[_0xa9ae('0x1a')](_0x4dbb30);}};}function checkError(){return function(_0x426317){if(!_0x426317){throw new RangeError(_0xa9ae('0x1b'));}return _0x426317;};}function respondWithRpcPromise(_0x971ee1,_0x5a062d){return new BPromise(function(_0xc021cf,_0x4ca9a9){var _0x49dca9=amiClient;return _0x49dca9['request'](_0x971ee1,_0x5a062d)['then'](function(_0x1afd07){if(_0x1afd07['error']){if(_0x1afd07[_0xa9ae('0x1c')]['code']===0x1f4){return _0x4ca9a9(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}return _0xc021cf(_0x1afd07[_0xa9ae('0x1c')][_0xa9ae('0x1d')]);}else{_0xc021cf(_0x1afd07[_0xa9ae('0x1e')]);}})[_0xa9ae('0x1f')](function(_0x23c1ec){_0x4ca9a9(_0x23c1ec);});});}function getAgent(_0x5e82f1){return db[_0xa9ae('0x20')][_0xa9ae('0x21')]({'where':{'id':_0x5e82f1,'role':_0xa9ae('0x22')}})[_0xa9ae('0x23')](checkError());}function getAgentCheckSession(_0x222db7,_0x428934){return new BPromise(function(_0xb12fa8,_0x5dfcd7){var _0x489e88=respondWithRpcPromise(_0xa9ae('0x24'));var _0x3c324e=getAgent(_0x222db7);Promise[_0xa9ae('0x25')]([_0x489e88,_0x3c324e])[_0xa9ae('0x23')](function(_0x74cd94){var _0x54a821=_0x74cd94[0x0];var _0x52dd4f=_0x74cd94[0x1];var _0x1892b5=_[_0xa9ae('0x26')](_0x54a821[_0xa9ae('0x27')],function(_0x3a48b7){return _0x3a48b7[_0xa9ae('0x28')]==_0x52dd4f['id']&&_0x3a48b7[_0xa9ae('0x29')]==_0x428934;});if(_0x1892b5['length']==0x1){_0xb12fa8(_0x52dd4f);}else{_0x5dfcd7(new RangeError('sessionId\x20'+_0x428934+_0xa9ae('0x2a')));}});});}exports[_0xa9ae('0x2b')]=function(_0x3d9b30,_0x3cd87a){logger[_0xa9ae('0x13')](_0xa9ae('0x2c'),_0x3d9b30[_0xa9ae('0x2d')]);var _0x3e2ec2=originateValidation['validate'](_0x3d9b30[_0xa9ae('0x2d')]);if(_0x3e2ec2['length']>0x0){return _0x3cd87a[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x3e2ec2);}var _0x3a701b=_0x3d9b30['body'][_0xa9ae('0x2f')];var _0x3eb867=_0x3d9b30[_0xa9ae('0x2d')][_0xa9ae('0x30')];var _0x353227=_0x3d9b30['body'][_0xa9ae('0x31')];var _0xa0730a=_0x3d9b30[_0xa9ae('0x2d')]['callbackUrl'];return getAgent(_0x3a701b)['then'](function(_0x2155c8){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x2155c8[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x2155c8[_0xa9ae('0x18')]),_0xa9ae('0x34'),{'callNumber':_0x3eb867,'callerId':_0x353227,'callbackUrl':_0xa0730a});return _0x3cd87a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x3cd87a));};exports['hangup']=function(_0x26c8fb,_0x38f360){logger[_0xa9ae('0x13')]('hangup\x20fired:',_0x26c8fb[_0xa9ae('0x2d')]);var _0x1ffcab=hangupValidation[_0xa9ae('0xc')](_0x26c8fb['body']);if(_0x1ffcab[_0xa9ae('0x35')]>0x0){return _0x38f360[_0xa9ae('0x19')](0x190)['json'](_0x1ffcab);}var _0x2993b2=_0x26c8fb['body'][_0xa9ae('0x2f')];var _0x24c237=_0x26c8fb['body'][_0xa9ae('0x29')];return getAgent(_0x2993b2)[_0xa9ae('0x23')](function(_0x234da5){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x234da5[_0xa9ae('0x18')]);emit(util['format'](_0xa9ae('0x33'),_0x234da5[_0xa9ae('0x18')]),'webbar:hangup',{'sessionId':_0x24c237});return _0x38f360['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x36')});})[_0xa9ae('0x1f')](handleError(_0x38f360));};exports[_0xa9ae('0x37')]=function(_0x4c110a,_0x1b0f5e){logger[_0xa9ae('0x13')](_0xa9ae('0x38'),_0x4c110a[_0xa9ae('0x2d')]);var _0x23c91d=answerValidation[_0xa9ae('0xc')](_0x4c110a[_0xa9ae('0x2d')]);if(_0x23c91d['length']>0x0){return _0x1b0f5e[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x23c91d);}var _0x566cb0=_0x4c110a[_0xa9ae('0x2d')]['userId'];var _0xb51a6c=_0x4c110a[_0xa9ae('0x2d')][_0xa9ae('0x29')];return getAgent(_0x566cb0)[_0xa9ae('0x23')](function(_0x250d2b){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x250d2b['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x250d2b['name']),_0xa9ae('0x3a'),{'sessionId':_0xb51a6c});return _0x1b0f5e[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x3b')});})[_0xa9ae('0x1f')](handleError(_0x1b0f5e));};exports[_0xa9ae('0x3c')]=function(_0x571cb4,_0x1416a2){logger['info'](_0xa9ae('0x3d'),_0x571cb4[_0xa9ae('0x2d')]);var _0x52c6e9=holdValidation['validate'](_0x571cb4[_0xa9ae('0x2d')]);if(_0x52c6e9[_0xa9ae('0x35')]>0x0){return _0x1416a2[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x52c6e9);}var _0x435c29=_0x571cb4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x60342a=_0x571cb4['body']['sessionId'];return getAgent(_0x435c29)[_0xa9ae('0x23')](function(_0x3cf89c){logger['info'](_0xa9ae('0x32'),_0x3cf89c[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x3cf89c[_0xa9ae('0x18')]),_0xa9ae('0x3e'),{'sessionId':_0x60342a});return _0x1416a2[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':'hold\x20executed!'});})[_0xa9ae('0x1f')](handleError(_0x1416a2));};exports[_0xa9ae('0x3f')]=function(_0x5ea18d,_0x128f88){logger['info']('unhold\x20fired:',_0x5ea18d['body']);var _0x3b8916=unholdValidation[_0xa9ae('0xc')](_0x5ea18d['body']);if(_0x3b8916['length']>0x0){return _0x128f88['status'](0x190)[_0xa9ae('0x2e')](_0x3b8916);}var _0x54c67c=_0x5ea18d[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x4e39d5=_0x5ea18d[_0xa9ae('0x2d')]['sessionId'];return getAgent(_0x54c67c)[_0xa9ae('0x23')](function(_0xade70a){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0xade70a[_0xa9ae('0x18')]);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0xade70a[_0xa9ae('0x18')]),_0xa9ae('0x40'),{'sessionId':_0x4e39d5});return _0x128f88[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x41')});})['catch'](handleError(_0x128f88));};exports[_0xa9ae('0x42')]=function(_0x9e42b3,_0x24087a){logger[_0xa9ae('0x13')](_0xa9ae('0x43'),_0x24087a['body']);var _0x4fe9e7=callsValidation[_0xa9ae('0xc')](_0x9e42b3[_0xa9ae('0x2d')]);if(_0x4fe9e7['length']>0x0){return _0x24087a['status'](0x190)[_0xa9ae('0x2e')](_0x4fe9e7);}var _0x48637a=_0x9e42b3[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x1a1605=respondWithRpcPromise('VoiceChannels');var _0x36d844=getAgent(_0x48637a);return Promise['all']([_0x1a1605,_0x36d844])[_0xa9ae('0x23')](function(_0x56e847){var _0x157628=_0x56e847[0x0];var _0x38ad8f=_0x56e847[0x1];var _0x46ab4c=_[_0xa9ae('0x26')](_0x157628[_0xa9ae('0x27')],function(_0x44c3cc){return _0x44c3cc['UserId']==_0x38ad8f['id'];});return _0x24087a[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'count':_0x46ab4c[_0xa9ae('0x35')],'rows':_0x46ab4c});})[_0xa9ae('0x1f')](handleError(_0x24087a));};exports['conference']=function(_0x2ebb14,_0x2803fb){logger[_0xa9ae('0x13')](_0xa9ae('0x44'),_0x2ebb14[_0xa9ae('0x2d')]);var _0x1f563a=conferenceValidation[_0xa9ae('0xc')](_0x2ebb14[_0xa9ae('0x2d')]);if(_0x1f563a[_0xa9ae('0x35')]>0x0){return _0x2803fb[_0xa9ae('0x19')](0x190)['json'](_0x1f563a);}var _0xc6b8a4=_0x2ebb14[_0xa9ae('0x2d')][_0xa9ae('0x2f')];return getAgent(_0xc6b8a4)[_0xa9ae('0x23')](function(_0x5b2f69){logger[_0xa9ae('0x13')](_0xa9ae('0x32'),_0x5b2f69['name']);emit(util[_0xa9ae('0x39')](_0xa9ae('0x33'),_0x5b2f69[_0xa9ae('0x18')]),'webbar:conference');return _0x2803fb['status'](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x45')});})['catch'](handleError(_0x2803fb));};exports['transfer']=function(_0x2369e4,_0x7d0c93){logger[_0xa9ae('0x13')]('transfer\x20fired:',_0x2369e4[_0xa9ae('0x2d')]);var _0x619ae4=transferValidation[_0xa9ae('0xc')](_0x2369e4[_0xa9ae('0x2d')]);if(_0x619ae4[_0xa9ae('0x35')]>0x0){return _0x7d0c93[_0xa9ae('0x19')](0x190)[_0xa9ae('0x2e')](_0x619ae4);}var _0x381298=_0x2369e4[_0xa9ae('0x2d')][_0xa9ae('0x2f')];var _0x53445e=_0x2369e4['body'][_0xa9ae('0x29')];var _0x1a632a=_0x2369e4[_0xa9ae('0x2d')]['transferNumber'];return getAgent(_0x381298)[_0xa9ae('0x23')](function(_0xf2cd59){logger[_0xa9ae('0x13')]('entityFound:',_0xf2cd59['name']);emit(util[_0xa9ae('0x39')]('user:%s',_0xf2cd59[_0xa9ae('0x18')]),_0xa9ae('0x46'),{'sessionId':_0x53445e,'transferNumber':_0x1a632a});return _0x7d0c93[_0xa9ae('0x19')](0xc8)[_0xa9ae('0x2e')]({'error':![],'message':_0xa9ae('0x47')});})[_0xa9ae('0x1f')](handleError(_0x7d0c93));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 48eea44..f25175b 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 _0x33af=['getAnswers','/:id/users','/:id/applications','post','create','addDisposition','addAgents','addApplications','/:id/notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions'];(function(_0x146995,_0x456d3e){var _0x3039eb=function(_0x5659dd){while(--_0x5659dd){_0x146995['push'](_0x146995['shift']());}};_0x3039eb(++_0x456d3e);}(_0x33af,0xec));var _0xf33a=function(_0x39d9ec,_0x4ed6e5){_0x39d9ec=_0x39d9ec-0x0;var _0x499ff0=_0x33af[_0x39d9ec];return _0x499ff0;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/canned_answers',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x8')](_0xf33a('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0xf33a('0x13')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x13')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x13')]('/:id/canned_answers',auth[_0xf33a('0xb')](),controller['addAnswer']);router[_0xf33a('0x13')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x16')]);router[_0xf33a('0x13')]('/:id/applications',auth[_0xf33a('0xb')](),controller[_0xf33a('0x17')]);router[_0xf33a('0x13')](_0xf33a('0x18'),controller['notify']);router[_0xf33a('0x13')](_0xf33a('0x19'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x1b')](_0xf33a('0x1c'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x1d')]);router[_0xf33a('0x1e')](_0xf33a('0x1c'),auth['isAuthenticated'](),controller[_0xf33a('0x1f')]);router[_0xf33a('0x1e')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x20')]);router['delete'](_0xf33a('0x21'),auth['isAuthenticated'](),controller[_0xf33a('0x22')]);router[_0xf33a('0x1e')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x23')]);module['exports']=router; \ No newline at end of file +var _0xb016=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','addAnswer','post','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x48d6d9,_0x1e6f52){var _0x53872e=function(_0x3496e5){while(--_0x3496e5){_0x48d6d9['push'](_0x48d6d9['shift']());}};_0x53872e(++_0x1e6f52);}(_0xb016,0x159));var _0x6b01=function(_0x4cbf5d,_0x46cb20){_0x4cbf5d=_0x4cbf5d-0x0;var _0x58b0f8=_0xb016[_0x4cbf5d];return _0x58b0f8;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./whatsappAccount.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getDispositions']);router['get'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['get'](_0x6b01('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6b01('0x7')]('/:id/applications',auth[_0x6b01('0x8')](),controller[_0x6b01('0x10')]);router['post']('/',auth[_0x6b01('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x6b01('0x8')](),controller['addDisposition']);router['post'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x11')]);router[_0x6b01('0x12')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x13')]);router[_0x6b01('0x12')](_0x6b01('0x14'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x15')]);router['post'](_0x6b01('0x16'),controller[_0x6b01('0x17')]);router[_0x6b01('0x12')](_0x6b01('0x18'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x19')]);router[_0x6b01('0x1a')](_0x6b01('0x1b'),auth['isAuthenticated'](),controller[_0x6b01('0x1c')]);router[_0x6b01('0x1d')](_0x6b01('0x1b'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x1e')]);router[_0x6b01('0x1d')](_0x6b01('0xc'),auth['isAuthenticated'](),controller[_0x6b01('0x1f')]);router[_0x6b01('0x1d')](_0x6b01('0xd'),auth['isAuthenticated'](),controller[_0x6b01('0x20')]);router[_0x6b01('0x1d')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x21')]);module[_0x6b01('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ddf5198..f51db6c 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 _0x91ff=['STRING','name','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91ff,0xd0));var _0xf91f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x91ff[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xf91f('0x0'));var rs=require(_0xf91f('0x1'));module['exports']={'name':{'type':Sequelize[_0xf91f('0x2')],'unique':_0xf91f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf91f('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf91f('0x4')]();}},'phone':{'type':Sequelize[_0xf91f('0x2')]},'type':{'type':Sequelize[_0xf91f('0x5')]('twilio',_0xf91f('0x6'))},'accountSid':{'type':Sequelize[_0xf91f('0x2')]},'baseUrl':{'type':Sequelize[_0xf91f('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf91f('0x7');}},'notificationSound':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf91f('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf91f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf91f('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf91f('0xa'),'set':function(_0x47b53d){if(!_0x47b53d){this['setDataValue'](_0xf91f('0xb'),null);}this[_0xf91f('0xc')](_0xf91f('0xd'),_0x47b53d);}},'description':{'type':Sequelize[_0xf91f('0x2')]}}; \ No newline at end of file +var _0x6f7b=['sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio'];(function(_0x2506d4,_0xd953b5){var _0x95feaa=function(_0x3c2bbf){while(--_0x3c2bbf){_0x2506d4['push'](_0x2506d4['shift']());}};_0x95feaa(++_0xd953b5);}(_0x6f7b,0x125));var _0xb6f7=function(_0x4b0589,_0x46e130){_0x4b0589=_0x4b0589-0x0;var _0x5ef78c=_0x6f7b[_0x4b0589];return _0x5ef78c;};'use strict';var Sequelize=require(_0xb6f7('0x0'));var rs=require(_0xb6f7('0x1'));module[_0xb6f7('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xb6f7('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb6f7('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb6f7('0x3')],'defaultValue':function(){return rs[_0xb6f7('0x4')]();}},'phone':{'type':Sequelize[_0xb6f7('0x3')]},'type':{'type':Sequelize[_0xb6f7('0x5')](_0xb6f7('0x6'),_0xb6f7('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xb6f7('0x3')]},'authToken':{'type':Sequelize[_0xb6f7('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb6f7('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb6f7('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb6f7('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb6f7('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6f7('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb6f7('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xb6f7('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xde5964){if(!_0xde5964){this[_0xb6f7('0xc')](_0xb6f7('0xd'),null);}this['setDataValue'](_0xb6f7('0xe'),_0xde5964);}},'description':{'type':Sequelize[_0xb6f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7579a09..37e0391 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 _0x90aa=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','body','describe','addDisposition','WhatsappAccountId','Disposition','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','account','sinch','statuses','state','read','applications','Applications','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','Body','messageId','MessageSid','notifications','message_id','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','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','push','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','get','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x90aa,0x12b));var _0xa90a=function(_0x1da919,_0x329d3c){_0x1da919=_0x1da919-0x0;var _0x58aca7=_0x90aa[_0x1da919];return _0x58aca7;};'use strict';var emlformat=require(_0xa90a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa90a('0x1'));var jsonpatch=require(_0xa90a('0x2'));var rp=require(_0xa90a('0x3'));var moment=require('moment');var BPromise=require(_0xa90a('0x4'));var Mustache=require(_0xa90a('0x5'));var util=require(_0xa90a('0x6'));var path=require(_0xa90a('0x7'));var sox=require(_0xa90a('0x8'));var csv=require(_0xa90a('0x9'));var ejs=require(_0xa90a('0xa'));var fs=require('fs');var fs_extra=require(_0xa90a('0xb'));var _=require('lodash');var squel=require(_0xa90a('0xc'));var crypto=require(_0xa90a('0xd'));var jsforce=require(_0xa90a('0xe'));var deskjs=require(_0xa90a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa90a('0x10'));var Papa=require(_0xa90a('0x11'));var Redis=require(_0xa90a('0x12'));var authService=require(_0xa90a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa90a('0x14'));var hardwareService=require(_0xa90a('0x15'));var logger=require(_0xa90a('0x16'))(_0xa90a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa90a('0x18'))['db'];config[_0xa90a('0x19')]=_[_0xa90a('0x1a')](config['redis'],{'host':_0xa90a('0x1b'),'port':0x18eb});var socket=require(_0xa90a('0x1c'))(new Redis(config[_0xa90a('0x19')]));require(_0xa90a('0x1d'))[_0xa90a('0x1e')](socket);var jayson=require(_0xa90a('0x1f'));var client=jayson['client'][_0xa90a('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1e739b,_0x3cf5c6,_0x2cd99d,_0x5e4a32){return new BPromise(function(_0x570646,_0x3c9dd9){var _0x239f23=_0x5e4a32||client;return _0x239f23[_0xa90a('0x21')](_0x1e739b,_0x2cd99d)['then'](function(_0x2a474f){logger['info'](_0xa90a('0x22'),_0x3cf5c6,_0xa90a('0x23'));logger[_0xa90a('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3cf5c6,'request\x20sent',JSON[_0xa90a('0x25')](_0x2a474f));if(_0x2a474f[_0xa90a('0x26')]){if(_0x2a474f[_0xa90a('0x26')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cf5c6,_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);return _0x3c9dd9(_0x2a474f['error'][_0xa90a('0x27')]);}logger[_0xa90a('0x26')](_0xa90a('0x22'),_0x3cf5c6,_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);return _0x570646(_0x2a474f[_0xa90a('0x26')][_0xa90a('0x27')]);}else{logger[_0xa90a('0x28')](_0xa90a('0x22'),_0x3cf5c6,_0xa90a('0x23'));_0x570646(_0x2a474f[_0xa90a('0x29')][_0xa90a('0x27')]);}})[_0xa90a('0x2a')](function(_0x50abf6){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3cf5c6,_0x50abf6);_0x3c9dd9(_0x50abf6);});});}function respondWithStatusCode(_0x296cbd,_0x370f8a){_0x370f8a=_0x370f8a||0xcc;return function(_0x2d3ab2){if(_0x2d3ab2){return _0x296cbd[_0xa90a('0x2b')](_0x370f8a);}return _0x296cbd[_0xa90a('0x2c')](_0x370f8a)[_0xa90a('0x2d')]();};}function respondWithResult(_0x372b53,_0x41c85c){_0x41c85c=_0x41c85c||0xc8;return function(_0x3102ff){if(_0x3102ff){return _0x372b53[_0xa90a('0x2c')](_0x41c85c)['json'](_0x3102ff);}};}function respondWithFilteredResult(_0x55983f,_0x3a6213){return function(_0x1b4d16){if(_0x1b4d16){var _0x190783=typeof _0x3a6213[_0xa90a('0x2e')]==='undefined'&&typeof _0x3a6213[_0xa90a('0x2f')]===_0xa90a('0x30');var _0x36a7a6=_0x1b4d16[_0xa90a('0x31')];var _0x3c871f=_0x190783?0x0:_0x3a6213[_0xa90a('0x2e')];var _0x130ac6=_0x190783?_0x1b4d16[_0xa90a('0x31')]:_0x3a6213[_0xa90a('0x2e')]+_0x3a6213['limit'];var _0x518fa3;if(_0x130ac6>=_0x36a7a6){_0x130ac6=_0x36a7a6;_0x518fa3=0xc8;}else{_0x518fa3=0xce;}_0x55983f[_0xa90a('0x2c')](_0x518fa3);return _0x55983f[_0xa90a('0x32')]('Content-Range',_0x3c871f+'-'+_0x130ac6+'/'+_0x36a7a6)[_0xa90a('0x33')](_0x1b4d16);}return null;};}function patchUpdates(_0xafc7cc){return function(_0xe60271){try{jsonpatch[_0xa90a('0x34')](_0xe60271,_0xafc7cc,!![]);}catch(_0x5089f4){return BPromise[_0xa90a('0x35')](_0x5089f4);}return _0xe60271[_0xa90a('0x36')]();};}function saveUpdates(_0x1d7d01,_0x504325){return function(_0x5cf73f){if(_0x5cf73f){return _0x5cf73f[_0xa90a('0x37')](_0x1d7d01)[_0xa90a('0x38')](function(_0x3ac6fa){return _0x3ac6fa;});}return null;};}function removeEntity(_0x34e409,_0x514d07){return function(_0x49335e){if(_0x49335e){return _0x49335e['destroy']()['then'](function(){var _0x1f657b=_0x49335e[_0xa90a('0x39')]({'plain':!![]});var _0x285242='WhatsappAccounts';return db['UserProfileResource'][_0xa90a('0x3a')]({'where':{'type':_0x285242,'resourceId':_0x1f657b['id']}})[_0xa90a('0x38')](function(){return _0x49335e;});})[_0xa90a('0x38')](function(){_0x34e409[_0xa90a('0x2c')](0xcc)[_0xa90a('0x2d')]();});}};}function handleEntityNotFound(_0x3d08d3,_0x362d14){return function(_0x35d725){if(!_0x35d725){_0x3d08d3[_0xa90a('0x2b')](0x194);}return _0x35d725;};}function handleError(_0x307315,_0x32c69e){_0x32c69e=_0x32c69e||0x1f4;return function(_0x30a69e){logger['error'](_0x30a69e[_0xa90a('0x3b')]);if(_0x30a69e['name']){delete _0x30a69e[_0xa90a('0x3c')];}_0x307315[_0xa90a('0x2c')](_0x32c69e)[_0xa90a('0x3d')](_0x30a69e);};}exports[_0xa90a('0x3e')]=function(_0x109021,_0x188144){var _0x161806={'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]},_0x2deaf2={},_0x2c765b={'count':0x0,'rows':[]};var _0x1e3671=_[_0xa90a('0x41')](db[_0xa90a('0x42')]['rawAttributes'],function(_0x33cf49){return{'name':_0x33cf49[_0xa90a('0x43')],'type':_0x33cf49[_0xa90a('0x44')][_0xa90a('0x45')]};});_0x2deaf2['model']=_[_0xa90a('0x41')](_0x1e3671,_0xa90a('0x3c'));_0x2deaf2[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x109021[_0xa90a('0x46')]);_0x2deaf2['filters']=_[_0xa90a('0x48')](_0x2deaf2['model'],_0x2deaf2[_0xa90a('0x46')]);_0x161806[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x2deaf2[_0xa90a('0x4a')],qs[_0xa90a('0x4b')](_0x109021[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x161806[_0xa90a('0x49')]=_0x161806[_0xa90a('0x49')]['length']?_0x161806[_0xa90a('0x49')]:_0x2deaf2[_0xa90a('0x4a')];if(!_0x109021['query'][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x161806[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x109021['query']['limit']);_0x161806[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x109021['query'][_0xa90a('0x2e')]);}_0x161806[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x109021[_0xa90a('0x46')]['sort']);_0x161806[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x109021[_0xa90a('0x46')],_0x2deaf2['filters']),_0x1e3671);if(_0x109021[_0xa90a('0x46')]['filter']){_0x161806['where']=_[_0xa90a('0x53')](_0x161806['where'],{'$or':_[_0xa90a('0x41')](_0x1e3671,function(_0x3b332d){if(_0x3b332d[_0xa90a('0x44')]!==_0xa90a('0x54')){var _0x5c78db={};_0x5c78db[_0x3b332d['name']]={'$like':'%'+_0x109021[_0xa90a('0x46')][_0xa90a('0x55')]+'%'};return _0x5c78db;}})});}_0x161806=_['merge']({},_0x161806,_0x109021[_0xa90a('0x56')]);var _0x231871={'where':_0x161806[_0xa90a('0x50')]};return db[_0xa90a('0x42')][_0xa90a('0x31')](_0x231871)[_0xa90a('0x38')](function(_0x2411f6){_0x2c765b[_0xa90a('0x31')]=_0x2411f6;if(_0x109021[_0xa90a('0x46')][_0xa90a('0x57')]){_0x161806[_0xa90a('0x58')]=[{'all':!![]}];}return db[_0xa90a('0x42')][_0xa90a('0x59')](_0x161806);})['then'](function(_0x3800df){_0x2c765b[_0xa90a('0x5a')]=_0x3800df;return _0x2c765b;})[_0xa90a('0x38')](respondWithFilteredResult(_0x188144,_0x161806))[_0xa90a('0x2a')](handleError(_0x188144,null));};exports[_0xa90a('0x5b')]=function(_0x34e594,_0x4cbe31){var _0x2ba008={'raw':![],'where':{'id':_0x34e594[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]},_0x5eefd4={};_0x5eefd4[_0xa90a('0x4a')]=_['keys'](db[_0xa90a('0x42')][_0xa90a('0x5d')]);_0x5eefd4[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x34e594[_0xa90a('0x46')]);_0x5eefd4[_0xa90a('0x51')]=_['intersection'](_0x5eefd4[_0xa90a('0x4a')],_0x5eefd4[_0xa90a('0x46')]);_0x2ba008[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x5eefd4[_0xa90a('0x4a')],qs['fields'](_0x34e594['query'][_0xa90a('0x4b')]));_0x2ba008['attributes']=_0x2ba008[_0xa90a('0x49')]['length']?_0x2ba008['attributes']:_0x5eefd4['model'];if(_0x34e594[_0xa90a('0x46')][_0xa90a('0x57')]){_0x2ba008[_0xa90a('0x58')]=[{'all':!![]}];}_0x2ba008=_[_0xa90a('0x53')]({},_0x2ba008,_0x34e594[_0xa90a('0x56')]);return db['WhatsappAccount'][_0xa90a('0x5e')](_0x2ba008)[_0xa90a('0x38')](handleEntityNotFound(_0x4cbe31,null))[_0xa90a('0x38')](respondWithResult(_0x4cbe31,null))[_0xa90a('0x2a')](handleError(_0x4cbe31,null));};exports[_0xa90a('0x5f')]=function(_0xbf7c4b,_0x546f79){return db['WhatsappAccount']['create'](_0xbf7c4b['body'],{})[_0xa90a('0x38')](function(_0x7e7cd9){var _0x1239e0=_0xbf7c4b['user']['get']({'plain':!![]});if(!_0x1239e0)throw new Error(_0xa90a('0x60'));if(_0x1239e0[_0xa90a('0x61')]===_0xa90a('0x62')){var _0x511197=_0x7e7cd9[_0xa90a('0x39')]({'plain':!![]});var _0x438eb8='WhatsappAccounts';return db[_0xa90a('0x63')][_0xa90a('0x5e')]({'where':{'name':_0x438eb8,'userProfileId':_0x1239e0['userProfileId']},'raw':!![]})[_0xa90a('0x38')](function(_0x2b28b2){if(_0x2b28b2&&_0x2b28b2[_0xa90a('0x64')]===0x0){return db[_0xa90a('0x65')][_0xa90a('0x5f')]({'name':_0x511197['name'],'resourceId':_0x511197['id'],'type':_0x2b28b2[_0xa90a('0x3c')],'sectionId':_0x2b28b2['id']},{})[_0xa90a('0x38')](function(){return _0x7e7cd9;});}else{return _0x7e7cd9;}})['catch'](function(_0x4042bb){logger[_0xa90a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4042bb);throw _0x4042bb;});}return _0x7e7cd9;})[_0xa90a('0x38')](respondWithResult(_0x546f79,0xc9))['catch'](handleError(_0x546f79,null));};exports[_0xa90a('0x37')]=function(_0x1ce3bf,_0x569c98){if(_0x1ce3bf[_0xa90a('0x66')]['id']){delete _0x1ce3bf[_0xa90a('0x66')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1ce3bf['params']['id']},'include':[{'model':db[_0xa90a('0x3f')],'as':_0xa90a('0x40')}]})[_0xa90a('0x38')](handleEntityNotFound(_0x569c98,null))[_0xa90a('0x38')](saveUpdates(_0x1ce3bf[_0xa90a('0x66')],null))[_0xa90a('0x38')](respondWithResult(_0x569c98,null))[_0xa90a('0x2a')](handleError(_0x569c98,null));};exports[_0xa90a('0x3a')]=function(_0x50b1d3,_0xc321e8){return db[_0xa90a('0x42')]['find']({'where':{'id':_0x50b1d3[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xc321e8,null))[_0xa90a('0x38')](removeEntity(_0xc321e8,null))[_0xa90a('0x2a')](handleError(_0xc321e8,null));};exports['describe']=function(_0x19312b,_0x57eddf){return db[_0xa90a('0x42')][_0xa90a('0x67')]()['then'](respondWithResult(_0x57eddf,null))[_0xa90a('0x2a')](handleError(_0x57eddf,null));};exports[_0xa90a('0x68')]=function(_0xe8d931,_0x491090,_0x415d77){if(_0xe8d931[_0xa90a('0x66')]['id']){delete _0xe8d931[_0xa90a('0x66')]['id'];}return db['WhatsappAccount'][_0xa90a('0x5e')]({'where':{'id':_0xe8d931['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x491090,null))[_0xa90a('0x38')](function(_0x441ba6){if(_0x441ba6){_0xe8d931[_0xa90a('0x66')][_0xa90a('0x69')]=_0x441ba6['id'];return db[_0xa90a('0x6a')]['create'](_0xe8d931[_0xa90a('0x66')]);}})[_0xa90a('0x38')](respondWithResult(_0x491090,null))[_0xa90a('0x2a')](handleError(_0x491090,null));};exports['getDispositions']=function(_0x4737a9,_0x4f2c28,_0x3b82aa){var _0x3f92f5={'raw':![],'where':{}};var _0x3daecd={};var _0xfb99b={'count':0x0,'rows':[]};return db[_0xa90a('0x42')][_0xa90a('0x6b')]({'where':{'id':_0x4737a9[_0xa90a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4f2c28,null))[_0xa90a('0x38')](function(_0x322165){if(_0x322165){_0x3daecd[_0xa90a('0x4a')]=_['keys'](db['Disposition'][_0xa90a('0x5d')]);_0x3daecd[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x4737a9[_0xa90a('0x46')]);_0x3daecd[_0xa90a('0x51')]=_['intersection'](_0x3daecd[_0xa90a('0x4a')],_0x3daecd[_0xa90a('0x46')]);_0x3f92f5['attributes']=_[_0xa90a('0x48')](_0x3daecd[_0xa90a('0x4a')],qs[_0xa90a('0x4b')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x3f92f5[_0xa90a('0x49')]=_0x3f92f5[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x3f92f5[_0xa90a('0x49')]:_0x3daecd[_0xa90a('0x4a')];if(!_0x4737a9['query']['hasOwnProperty'](_0xa90a('0x4d'))){_0x3f92f5[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x2f')]);_0x3f92f5[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x4737a9[_0xa90a('0x46')][_0xa90a('0x2e')]);}_0x3f92f5[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x4737a9[_0xa90a('0x46')]['sort']);_0x3f92f5[_0xa90a('0x50')]=qs['filters'](_[_0xa90a('0x52')](_0x4737a9[_0xa90a('0x46')],_0x3daecd[_0xa90a('0x51')]));_0x3f92f5[_0xa90a('0x50')][_0xa90a('0x69')]=_0x322165['id'];if(_0x4737a9['query'][_0xa90a('0x55')]){_0x3f92f5[_0xa90a('0x50')]=_[_0xa90a('0x53')](_0x3f92f5[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x3f92f5[_0xa90a('0x49')],function(_0x2af4b9){var _0x5e2975={};_0x5e2975[_0x2af4b9]={'$like':'%'+_0x4737a9[_0xa90a('0x46')]['filter']+'%'};return _0x5e2975;})});}_0x3f92f5=_['merge']({},_0x3f92f5,_0x4737a9[_0xa90a('0x56')]);return db[_0xa90a('0x6a')][_0xa90a('0x31')]({'where':_0x3f92f5[_0xa90a('0x50')]})['then'](function(_0x2cc936){_0xfb99b['count']=_0x2cc936;if(_0x4737a9[_0xa90a('0x46')][_0xa90a('0x57')]){_0x3f92f5[_0xa90a('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xa90a('0x59')](_0x3f92f5);})[_0xa90a('0x38')](function(_0x53dd0c){_0xfb99b[_0xa90a('0x5a')]=_0x53dd0c;return _0xfb99b;});}})[_0xa90a('0x38')](respondWithFilteredResult(_0x4f2c28,_0x3f92f5))[_0xa90a('0x2a')](handleError(_0x4f2c28,null));};exports['removeDispositions']=function(_0xefd06f,_0x316eee,_0x44d213){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0xefd06f[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x316eee,null))[_0xa90a('0x38')](function(_0x2bd0e7){if(_0x2bd0e7){return _0x2bd0e7[_0xa90a('0x6d')](_0xefd06f[_0xa90a('0x46')][_0xa90a('0x6e')]);}})['then'](respondWithStatusCode(_0x316eee,null))[_0xa90a('0x2a')](handleError(_0x316eee,null));};exports[_0xa90a('0x6f')]=function(_0x1c9c20,_0x50556c,_0x1ebd16){if(_0x1c9c20['body']['id']){delete _0x1c9c20['body']['id'];}return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x1c9c20['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x50556c,null))[_0xa90a('0x38')](function(_0x1b9aaf){if(_0x1b9aaf){_0x1c9c20[_0xa90a('0x66')]['WhatsappAccountId']=_0x1b9aaf['id'];return db[_0xa90a('0x70')][_0xa90a('0x5f')](_0x1c9c20['body']);}})[_0xa90a('0x38')](respondWithResult(_0x50556c,null))[_0xa90a('0x2a')](handleError(_0x50556c,null));};exports[_0xa90a('0x71')]=function(_0x140e61,_0x716a8c,_0x212045){var _0x5ba8a2={'raw':![],'where':{}};var _0x2607fd={};var _0x26bc4b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xa90a('0x6b')]({'where':{'id':_0x140e61['params']['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x716a8c,null))[_0xa90a('0x38')](function(_0x1ad01c){if(_0x1ad01c){_0x2607fd['model']=_[_0xa90a('0x47')](db[_0xa90a('0x70')][_0xa90a('0x5d')]);_0x2607fd[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x140e61[_0xa90a('0x46')]);_0x2607fd[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2607fd[_0xa90a('0x4a')],_0x2607fd['query']);_0x5ba8a2['attributes']=_['intersection'](_0x2607fd['model'],qs['fields'](_0x140e61[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x5ba8a2[_0xa90a('0x49')]=_0x5ba8a2[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x5ba8a2[_0xa90a('0x49')]:_0x2607fd[_0xa90a('0x4a')];if(!_0x140e61[_0xa90a('0x46')][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x5ba8a2[_0xa90a('0x2f')]=qs['limit'](_0x140e61[_0xa90a('0x46')][_0xa90a('0x2f')]);_0x5ba8a2['offset']=qs['offset'](_0x140e61['query']['offset']);}_0x5ba8a2[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x140e61[_0xa90a('0x46')][_0xa90a('0x4f')]);_0x5ba8a2[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x140e61[_0xa90a('0x46')],_0x2607fd[_0xa90a('0x51')]));_0x5ba8a2[_0xa90a('0x50')][_0xa90a('0x69')]=_0x1ad01c['id'];if(_0x140e61[_0xa90a('0x46')][_0xa90a('0x55')]){_0x5ba8a2['where']=_[_0xa90a('0x53')](_0x5ba8a2[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x5ba8a2['attributes'],function(_0x5e6b00){var _0x2dc87c={};_0x2dc87c[_0x5e6b00]={'$like':'%'+_0x140e61[_0xa90a('0x46')]['filter']+'%'};return _0x2dc87c;})});}_0x5ba8a2=_[_0xa90a('0x53')]({},_0x5ba8a2,_0x140e61['options']);return db[_0xa90a('0x70')][_0xa90a('0x31')]({'where':_0x5ba8a2[_0xa90a('0x50')]})[_0xa90a('0x38')](function(_0x213a2e){_0x26bc4b['count']=_0x213a2e;if(_0x140e61['query'][_0xa90a('0x57')]){_0x5ba8a2['include']=[{'all':!![]}];}return db[_0xa90a('0x70')][_0xa90a('0x59')](_0x5ba8a2);})[_0xa90a('0x38')](function(_0x33fa82){_0x26bc4b['rows']=_0x33fa82;return _0x26bc4b;});}})[_0xa90a('0x38')](respondWithFilteredResult(_0x716a8c,_0x5ba8a2))['catch'](handleError(_0x716a8c,null));};exports[_0xa90a('0x72')]=function(_0x79ca36,_0xdbf475,_0x28ce71){return db[_0xa90a('0x42')]['find']({'where':{'id':_0x79ca36[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xdbf475,null))[_0xa90a('0x38')](function(_0x26cd53){if(_0x26cd53){return _0x26cd53['removeAnswers'](_0x79ca36[_0xa90a('0x46')][_0xa90a('0x6e')]);}})[_0xa90a('0x38')](respondWithStatusCode(_0xdbf475,null))[_0xa90a('0x2a')](handleError(_0xdbf475,null));};exports[_0xa90a('0x73')]=function(_0x13fea9,_0x1c7756,_0x535202){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x13fea9[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x1c7756,null))[_0xa90a('0x38')](function(_0x420f11){if(_0x420f11){return _0x420f11[_0xa90a('0x73')](_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')],_[_0xa90a('0x74')](_0x13fea9[_0xa90a('0x66')],[_0xa90a('0x6e'),'id'])||{})['spread'](function(_0x4eb95e){for(var _0x4b7674=0x0;_0x4b7674<_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')][_0xa90a('0x6c')];_0x4b7674+=0x1){socket[_0xa90a('0x75')](_0xa90a('0x76'),{'UserId':Number(_0x13fea9[_0xa90a('0x66')][_0xa90a('0x6e')][_0x4b7674]),'WhatsappAccountId':Number(_0x13fea9[_0xa90a('0x5c')]['id'])});}return _0x4eb95e;});}})[_0xa90a('0x38')](respondWithResult(_0x1c7756,null))[_0xa90a('0x2a')](handleError(_0x1c7756,null));};exports[_0xa90a('0x77')]=function(_0x2b8f84,_0xfa0f24,_0x131070){return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x2b8f84[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0xfa0f24,null))[_0xa90a('0x38')](function(_0x124f7d){if(_0x124f7d){return _0x124f7d[_0xa90a('0x77')](_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')])[_0xa90a('0x38')](function(){if(_['isArray'](_0x2b8f84[_0xa90a('0x46')]['ids'])){for(var _0x495826=0x0;_0x495826<_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')]['length'];_0x495826+=0x1){socket[_0xa90a('0x75')](_0xa90a('0x78'),{'UserId':Number(_0x2b8f84[_0xa90a('0x46')][_0xa90a('0x6e')][_0x495826]),'WhatsappAccountId':Number(_0x2b8f84[_0xa90a('0x5c')]['id'])});}}else{socket[_0xa90a('0x75')](_0xa90a('0x78'),{'UserId':Number(_0x2b8f84[_0xa90a('0x46')]['ids']),'WhatsappAccountId':Number(_0x2b8f84[_0xa90a('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0xfa0f24,null))['catch'](handleError(_0xfa0f24,null));};exports[_0xa90a('0x79')]=function(_0x1eb694,_0x50e920,_0x5487de){var _0x2c44f5={};var _0x2b5cc7={};var _0x1c6269;var _0x1a20ce;return db['WhatsappAccount'][_0xa90a('0x6b')]({'where':{'id':_0x1eb694[_0xa90a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50e920,null))[_0xa90a('0x38')](function(_0x1dfc89){if(_0x1dfc89){_0x1c6269=_0x1dfc89;_0x2b5cc7['model']=_[_0xa90a('0x47')](db[_0xa90a('0x7a')][_0xa90a('0x5d')]);_0x2b5cc7[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x1eb694[_0xa90a('0x46')]);_0x2b5cc7[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2b5cc7[_0xa90a('0x4a')],_0x2b5cc7[_0xa90a('0x46')]);_0x2c44f5['attributes']=_[_0xa90a('0x48')](_0x2b5cc7['model'],qs[_0xa90a('0x4b')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x4b')]));_0x2c44f5[_0xa90a('0x49')]=_0x2c44f5[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x2c44f5[_0xa90a('0x49')]:_0x2b5cc7['model'];_0x2c44f5[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x4f')]);_0x2c44f5[_0xa90a('0x50')]=qs[_0xa90a('0x51')](_[_0xa90a('0x52')](_0x1eb694[_0xa90a('0x46')],_0x2b5cc7[_0xa90a('0x51')]));if(_0x1eb694['query'][_0xa90a('0x55')]){_0x2c44f5[_0xa90a('0x50')]=_[_0xa90a('0x53')](_0x2c44f5[_0xa90a('0x50')],{'$or':_[_0xa90a('0x41')](_0x2c44f5[_0xa90a('0x49')],function(_0x471a9c){var _0x23046d={};_0x23046d[_0x471a9c]={'$like':'%'+_0x1eb694['query'][_0xa90a('0x55')]+'%'};return _0x23046d;})});}_0x2c44f5=_['merge']({},_0x2c44f5,_0x1eb694['options']);return _0x1c6269[_0xa90a('0x79')](_0x2c44f5);}})[_0xa90a('0x38')](function(_0x450a1e){if(_0x450a1e){_0x1a20ce=_0x450a1e['length'];if(!_0x1eb694['query']['hasOwnProperty']('nolimit')){_0x2c44f5[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x1eb694['query'][_0xa90a('0x2f')]);_0x2c44f5[_0xa90a('0x2e')]=qs[_0xa90a('0x2e')](_0x1eb694[_0xa90a('0x46')][_0xa90a('0x2e')]);}return _0x1c6269[_0xa90a('0x79')](_0x2c44f5);}})[_0xa90a('0x38')](function(_0x53da77){if(_0x53da77){return _0x53da77?{'count':_0x1a20ce,'rows':_0x53da77}:null;}})['then'](respondWithResult(_0x50e920,null))[_0xa90a('0x2a')](handleError(_0x50e920,null));};exports[_0xa90a('0x7b')]=function(_0x380069,_0x349100){var _0x11e6be=_0x380069['params']['id'];var _0x2cb3dd=_0x380069['body'];var _0x51a793=0xc8;var _0x3c52b2=null;return db[_0xa90a('0x7c')][_0xa90a('0x7d')]({'isolationLevel':db[_0xa90a('0x7c')][_0xa90a('0x7e')][_0xa90a('0x7f')][_0xa90a('0x80')]},function(_0x450873){return db[_0xa90a('0x42')]['findOne']({'where':{'id':_0x11e6be},'transaction':_0x450873})[_0xa90a('0x38')](function(_0x37374d){if(_0x37374d){return db[_0xa90a('0x81')][_0xa90a('0x3a')]({'where':{'WhatsappAccountId':_0x11e6be},'transaction':_0x450873})['then'](function(){var _0x1e9723=_[_0xa90a('0x41')](_0x2cb3dd,function(_0x1f64f1){_0x1f64f1[_0xa90a('0x69')]=_0x11e6be;return _0x1f64f1;});return db[_0xa90a('0x81')][_0xa90a('0x82')](_0x1e9723,{'transaction':_0x450873});});}else{_0x51a793=0x194;_0x3c52b2=[];}});})[_0xa90a('0x38')](function(){if(_0x51a793!==0x194){return db[_0xa90a('0x81')][_0xa90a('0x83')]({'where':{'WhatsappAccountId':_0x11e6be},'order':'priority'})[_0xa90a('0x38')](function(_0x3a7a41){_0x3c52b2=_0x3a7a41;});}})[_0xa90a('0x2a')](function(_0x3bd702){_0x51a793=0x1f4;logger['error'](_0x3bd702[_0xa90a('0x3b')]);if(_0x3bd702[_0xa90a('0x3c')]){delete _0x3bd702[_0xa90a('0x3c')];}_0x3c52b2=_0x3bd702;})[_0xa90a('0x84')](function(){if(_0x3c52b2===null){_0x349100[_0xa90a('0x2b')](_0x51a793);}else{if(_0x51a793===0x1f4){_0x349100[_0xa90a('0x2c')](_0x51a793)[_0xa90a('0x3d')](_0x3c52b2);}else{_0x349100[_0xa90a('0x2c')](_0x51a793)['json'](_0x3c52b2);}}});};exports[_0xa90a('0x85')]=function(_0x3181ff,_0x3a3c1b,_0x39f40c){var _0x1a211b={};var _0x2322a4={};var _0x3dc982;var _0x33febc;return db[_0xa90a('0x42')][_0xa90a('0x6b')]({'where':{'id':_0x3181ff[_0xa90a('0x5c')]['id']}})[_0xa90a('0x38')](handleEntityNotFound(_0x3a3c1b,null))[_0xa90a('0x38')](function(_0x4d8130){if(_0x4d8130){_0x3dc982=_0x4d8130;_0x2322a4[_0xa90a('0x4a')]=_[_0xa90a('0x47')](db[_0xa90a('0x81')]['rawAttributes']);_0x2322a4[_0xa90a('0x46')]=_[_0xa90a('0x47')](_0x3181ff[_0xa90a('0x46')]);_0x2322a4[_0xa90a('0x51')]=_[_0xa90a('0x48')](_0x2322a4['model'],_0x2322a4[_0xa90a('0x46')]);_0x1a211b[_0xa90a('0x49')]=_[_0xa90a('0x48')](_0x2322a4['model'],qs[_0xa90a('0x4b')](_0x3181ff['query'][_0xa90a('0x4b')]));_0x1a211b[_0xa90a('0x49')]=_0x1a211b[_0xa90a('0x49')][_0xa90a('0x6c')]?_0x1a211b[_0xa90a('0x49')]:_0x2322a4[_0xa90a('0x4a')];_0x1a211b[_0xa90a('0x4e')]=qs[_0xa90a('0x4f')](_0x3181ff[_0xa90a('0x46')]['sort']);_0x1a211b[_0xa90a('0x50')]=qs['filters'](_[_0xa90a('0x52')](_0x3181ff[_0xa90a('0x46')],_0x2322a4[_0xa90a('0x51')]));if(_0x3181ff[_0xa90a('0x46')][_0xa90a('0x55')]){_0x1a211b['where']=_['merge'](_0x1a211b['where'],{'$or':_[_0xa90a('0x41')](_0x1a211b[_0xa90a('0x49')],function(_0x4737ca){var _0x52f0d2={};_0x52f0d2[_0x4737ca]={'$like':'%'+_0x3181ff[_0xa90a('0x46')][_0xa90a('0x55')]+'%'};return _0x52f0d2;})});}_0x1a211b=_['merge']({},_0x1a211b,_0x3181ff[_0xa90a('0x56')]);return _0x3dc982['getApplications'](_0x1a211b);}})[_0xa90a('0x38')](function(_0x39d682){if(_0x39d682){_0x33febc=_0x39d682[_0xa90a('0x6c')];if(!_0x3181ff['query'][_0xa90a('0x4c')](_0xa90a('0x4d'))){_0x1a211b[_0xa90a('0x2f')]=qs[_0xa90a('0x2f')](_0x3181ff['query'][_0xa90a('0x2f')]);_0x1a211b[_0xa90a('0x2e')]=qs['offset'](_0x3181ff[_0xa90a('0x46')][_0xa90a('0x2e')]);}return _0x3dc982['getApplications'](_0x1a211b);}})[_0xa90a('0x38')](function(_0x362b98){if(_0x362b98){return _0x362b98?{'count':_0x33febc,'rows':_0x362b98}:null;}})[_0xa90a('0x38')](respondWithResult(_0x3a3c1b,null))[_0xa90a('0x2a')](handleError(_0x3a3c1b,null));};exports[_0xa90a('0x86')]=function(_0x51c354,_0x1a5d92,_0x47d53b){var _0x378364={'channel':'whatsapp'};var _0x4dadc0=[];var _0x38dcd8=[];var _0x425fed={};return db['WhatsappAccount'][_0xa90a('0x5e')]({'where':{'id':_0x51c354[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0x81')],'as':'Applications'}]})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x46ae2e){_0x378364['account']=_0x46ae2e;if(_0x378364[_0xa90a('0x87')]&&_0x378364[_0xa90a('0x87')][_0xa90a('0x44')]===_0xa90a('0x88')&&_0x51c354[_0xa90a('0x66')][_0xa90a('0x89')]){if(_0x51c354[_0xa90a('0x66')]['statuses'][_0xa90a('0x6c')]===0x0)return;if(_0x51c354['body'][_0xa90a('0x89')][0x0][_0xa90a('0x8a')]!==_0xa90a('0x8b'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x51c354[_0xa90a('0x66')][_0xa90a('0x89')][0x0]['timestamp']},{'where':{'messageId':_0x51c354[_0xa90a('0x66')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xa90a('0x38')](function(_0x368591){return _0x1a5d92[_0xa90a('0x2c')](0xc8)[_0xa90a('0x33')](_0x368591);});}_0x378364[_0xa90a('0x8c')]=_['orderBy'](_0x46ae2e[_0xa90a('0x8d')],[_0xa90a('0x8e')],[_0xa90a('0x8f')]);if(_0x378364['account'][_0xa90a('0x8d')]){delete _0x378364[_0xa90a('0x87')][_0xa90a('0x8d')];}return db[_0xa90a('0x90')][_0xa90a('0x67')]()[_0xa90a('0x38')](function(_0x5896f2){if(!_0x5896f2){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))]('no\x20available\x20attributes');}_0x4dadc0=_[_0xa90a('0x93')](_[_0xa90a('0x47')](_0x5896f2),[_0xa90a('0x94'),_0xa90a('0x95')]);_0x38dcd8=_['difference'](_['keys'](_0x5896f2),[_0xa90a('0x94'),'updatedAt',_0xa90a('0x96'),_0xa90a('0x97')]);_0x378364[_0xa90a('0x66')]={'mapKey':_0xa90a('0x98')};if(_0x378364[_0xa90a('0x87')]&&_0x378364['account'][_0xa90a('0x44')]==='twilio'){_0x378364['body'][_0xa90a('0x99')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9a')][_0xa90a('0x9b')]('whatsapp:','');_0x378364[_0xa90a('0x66')]['body']=_0x51c354['body'][_0xa90a('0x9c')];_0x378364[_0xa90a('0x66')][_0xa90a('0x9d')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9e')];}if(_0x378364['account']&&_0x378364['account'][_0xa90a('0x44')]===_0xa90a('0x88')){_0x378364[_0xa90a('0x66')][_0xa90a('0x99')]=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9f')][0x0]['from'];_0x378364[_0xa90a('0x66')]['body']=_0x51c354[_0xa90a('0x66')][_0xa90a('0x9f')][0x0][_0xa90a('0x27')][_0xa90a('0x66')];_0x378364['body']['messageId']=_0x51c354['body'][_0xa90a('0x9f')][0x0][_0xa90a('0xa0')];}if(_0x378364[_0xa90a('0x66')]['id']){delete _0x378364['body']['id'];}if(_[_0xa90a('0xa1')](_0x378364[_0xa90a('0x66')][_0xa90a('0x99')])){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x378364['body'][_0xa90a('0x66')])||_0x378364[_0xa90a('0x66')][_0xa90a('0x66')]===''){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))](_0xa90a('0xa2'));}if(_[_0xa90a('0xa1')](_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')])){throw new db['Sequelize'][(_0xa90a('0x92'))](_0xa90a('0xa4')+_0x38dcd8);}if(!_[_0xa90a('0xa5')](_0x38dcd8,_0x378364[_0xa90a('0x66')]['mapKey'])){throw new db[(_0xa90a('0x91'))][(_0xa90a('0x92'))](_0xa90a('0xa6')+_0x38dcd8);}_0x425fed[_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')]]=_0x378364[_0xa90a('0x66')][_0xa90a('0x99')];return db['CmList'][_0xa90a('0x5e')]({'where':{'id':_0x378364[_0xa90a('0x87')][_0xa90a('0x97')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x425fed,'limit':0x1,'order':[[_0xa90a('0x95'),_0xa90a('0xa7')]]}]});})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x2b4218){if(_0x2b4218){_0x378364[_0xa90a('0xa8')]=_[_0xa90a('0x74')](_0x2b4218,[_0xa90a('0xa9')]);if(_0x2b4218[_0xa90a('0xa9')][_0xa90a('0x6c')]){return _0x2b4218[_0xa90a('0xa9')][0x0];}var _0x250244=_[_0xa90a('0x1a')](_0x378364[_0xa90a('0x66')],{'firstName':_0x378364[_0xa90a('0x66')][_0xa90a('0x99')],'ListId':_0x2b4218['id']});_0x250244[_0x378364[_0xa90a('0x66')][_0xa90a('0xa3')]]=_0x378364['body'][_0xa90a('0x99')];return db['CmContact']['create'](_0x250244,{'fields':_0x4dadc0,'raw':!![]});}})[_0xa90a('0x38')](handleEntityNotFound(_0x1a5d92,null))[_0xa90a('0x38')](function(_0x4c3660){if(_0x4c3660){_0x378364[_0xa90a('0xaa')]=_0x4c3660;var _0x13daac={'ContactId':_0x4c3660['id'],'phone':_0x378364[_0xa90a('0x66')]['from'],'WhatsappAccountId':_0x51c354[_0xa90a('0x5c')]['id']};var _0x416c31={'ContactId':_0x4c3660['id'],'WhatsappAccountId':_0x51c354[_0xa90a('0x5c')]['id'],'closed':![]};return db[_0xa90a('0xab')][_0xa90a('0x5e')]({'where':_0x416c31})[_0xa90a('0x38')](function(_0x53d004){if(_0x53d004){return[_0x53d004,![]];}return db[_0xa90a('0xab')][_0xa90a('0x5f')](_0x13daac)[_0xa90a('0x38')](function(_0x2b05f1){return[_0x2b05f1,!![]];});});}})['spread'](function(_0x411f62,_0x369aae){_0x378364[_0xa90a('0xac')]=_0x411f62[_0xa90a('0x39')]({'plain':!![]});_0x378364[_0xa90a('0xac')][_0xa90a('0xad')]=![];if(_0x369aae){if(_0x378364['account']['autoclose']){_0x378364[_0xa90a('0x8c')][_0xa90a('0xae')]({'id':0x0,'priority':_0x378364[_0xa90a('0x8c')]['length']+0x1,'app':'close','appdata':_0xa90a('0xaf'),'interval':_0xa90a('0xb0')});}_0x378364[_0xa90a('0xac')][_0xa90a('0xad')]=!![];}return db[_0xa90a('0xb1')][_0xa90a('0x5f')]({'phone':_0x378364[_0xa90a('0x66')][_0xa90a('0x99')],'messageId':_0x378364[_0xa90a('0x66')][_0xa90a('0x9d')],'body':_0x378364[_0xa90a('0x66')]['body'],'WhatsappAccountId':_0x51c354['params']['id'],'WhatsappInteractionId':_0x411f62['id'],'direction':'in','ContactId':_0x411f62[_0xa90a('0xb2')],'AttachmentId':_0x378364[_0xa90a('0x66')][_0xa90a('0xb3')]});})[_0xa90a('0x38')](function(_0x3af4a3){_0x378364[_0xa90a('0x27')]=_0x3af4a3;if(_0x378364[_0xa90a('0xac')]['UserId']){return db['User'][_0xa90a('0x5e')]({'attributes':['id',_0xa90a('0x3c')],'where':{'id':_0x378364[_0xa90a('0xac')]['UserId']}})[_0xa90a('0x38')](function(_0x4159f6){if(_0x4159f6){_0x378364['applications'][_0xa90a('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4159f6['name']+','+(_0x378364[_0xa90a('0x87')][_0xa90a('0xb5')]||0xa),'interval':_0xa90a('0xb0')});}return respondWithRpcPromise(_0xa90a('0xb6'),_0xa90a('0xb7'),_0x378364);});}return respondWithRpcPromise('Start',_0xa90a('0xb7'),_0x378364);})['then'](function(_0x83a099){if(_0x83a099){var _0x69bcbb=0xc8;var _0x4aa497=_0xa90a('0xb8');logger['info'](_0xa90a('0xb9'),_0x4aa497,_0x69bcbb,_0xa90a('0xba'));logger['debug'](_0xa90a('0xbb'),_0x4aa497,_0x69bcbb,_0xa90a('0xba'),JSON[_0xa90a('0x25')](_0x83a099));if(_0x378364[_0xa90a('0x87')]['type']===_0xa90a('0xbc')){return _0x1a5d92[_0xa90a('0x2c')](_0x69bcbb)[_0xa90a('0x32')](_0xa90a('0xbd'),_0xa90a('0xbe'))[_0xa90a('0x3d')](_0xa90a('0xbf'));}else{return _0x1a5d92['status'](_0x69bcbb)[_0xa90a('0x33')](_0x83a099);}}});})[_0xa90a('0x2a')](handleError(_0x1a5d92,null));};exports[_0xa90a('0x3d')]=function(_0x4a521b,_0xbf572c,_0x544800){var _0x28e097,_0x3e365d,_0x3f2bfa;if(_[_0xa90a('0xa1')](_0x4a521b['body'][_0xa90a('0x66')])||_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')]===''){throw new db[(_0xa90a('0x91'))]['ValidationError'](_0xa90a('0xa2'));}if(_[_0xa90a('0xa1')](_0x4a521b[_0xa90a('0x66')]['to'])){throw new db['Sequelize'][(_0xa90a('0x92'))](_0xa90a('0xc0'));}_0x28e097=_0x4a521b[_0xa90a('0x66')]['to'];return db[_0xa90a('0x42')][_0xa90a('0x5e')]({'where':{'id':_0x4a521b[_0xa90a('0x5c')]['id']},'include':[{'model':db[_0xa90a('0xc1')],'as':_0xa90a('0xc2'),'include':[{'model':db[_0xa90a('0x90')],'as':'Contacts','where':{'mobile':_0x28e097},'limit':0x1,'order':[[_0xa90a('0x95'),_0xa90a('0xa7')]]}]}]})[_0xa90a('0x38')](handleEntityNotFound(_0xbf572c,null))[_0xa90a('0x38')](function(_0x1e936b){if(_0x1e936b&&_0x1e936b['List']){_0x3e365d=_0x1e936b[_0xa90a('0x39')]({'plain':!![]});if(_0x3e365d[_0xa90a('0xc2')]&&_0x3e365d['List'][_0xa90a('0xa9')][_0xa90a('0x6c')]){return _0x3e365d[_0xa90a('0xc2')]['Contacts'][0x0];}return db[_0xa90a('0x90')][_0xa90a('0x5f')](_['defaults'](_0x4a521b[_0xa90a('0x66')],{'firstName':_0x28e097,'mobile':_0x28e097,'phone':_0x28e097,'ListId':_0x3e365d['ListId']}));}})[_0xa90a('0x38')](handleEntityNotFound(_0xbf572c,null))[_0xa90a('0x38')](function(_0x10afae){if(_0x10afae){_0x3f2bfa=_0x10afae;return db['WhatsappInteraction'][_0xa90a('0x5e')]({'where':{'ContactId':_0x3f2bfa['id'],'closed':![],'WhatsappAccountId':_0x3e365d['id']}})[_0xa90a('0x38')](function(_0x4f2875){if(_0x4f2875){return[_0x4f2875,![]];}return db[_0xa90a('0xab')]['create']({'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id'],'WhatsappAccountId':_0x3e365d['id'],'phone':_0x28e097,'firstMsgDirection':'out','Messages':[_[_0xa90a('0x53')](_0x4a521b[_0xa90a('0x66')],{'read':![],'body':_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')],'phone':_0x28e097,'WhatsappAccountId':_0x3e365d['id'],'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id']})]},{'include':[{'model':db[_0xa90a('0xb1')],'as':_0xa90a('0xc3')}]})[_0xa90a('0x38')](function(_0x223365){return[_0x223365,!![]];});});}})['spread'](function(_0x6d991f,_0x594553){if(_0x594553){return _0x6d991f;}return db[_0xa90a('0xb1')][_0xa90a('0x5f')](_[_0xa90a('0x53')](_0x4a521b[_0xa90a('0x66')],{'read':![],'body':_0x4a521b[_0xa90a('0x66')][_0xa90a('0x66')],'phone':_0x28e097,'WhatsappAccountId':_0x3e365d['id'],'WhatsappInteractionId':_0x6d991f['id'],'UserId':_0x4a521b[_0xa90a('0x62')]['id'],'ContactId':_0x3f2bfa['id']}))[_0xa90a('0x38')](function(_0x5e6d0f){_0x6d991f[_0xa90a('0xc4')][_0xa90a('0xc3')]=[];_0x6d991f[_0xa90a('0xc4')][_0xa90a('0xc3')][_0xa90a('0xae')](_0x5e6d0f[_0xa90a('0xc4')]);return _0x6d991f;});})[_0xa90a('0x38')](respondWithResult(_0xbf572c,null))[_0xa90a('0x2a')](handleError(_0xbf572c,null));}; \ No newline at end of file +var _0x66b8=['messageId','MessageSid','notifications','message_id','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','WhatsappInteraction','interaction','created','applications','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','Messages','push','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','map','WhatsappAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','type','VIRTUAL','filter','merge','includeAll','include','rows','show','params','mandatoryDispositionPause','rawAttributes','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','options','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','findAll','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','whatsapp','account','sinch','statuses','state','read','timestamp','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','replace','whatsapp:','Body'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x66b8,0x1ad));var _0x866b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x66b8[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x866b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x866b('0x1'));var jsonpatch=require(_0x866b('0x2'));var rp=require(_0x866b('0x3'));var moment=require(_0x866b('0x4'));var BPromise=require(_0x866b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x866b('0x6'));var sox=require(_0x866b('0x7'));var csv=require('to-csv');var ejs=require(_0x866b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x866b('0x9'));var crypto=require('crypto');var jsforce=require(_0x866b('0xa'));var deskjs=require(_0x866b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x866b('0xc'));var Redis=require(_0x866b('0xd'));var authService=require(_0x866b('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x866b('0xf'));var hardwareService=require(_0x866b('0x10'));var logger=require(_0x866b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x866b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x866b('0x13'))['db'];config[_0x866b('0x14')]=_[_0x866b('0x15')](config[_0x866b('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x866b('0x16'))(new Redis(config[_0x866b('0x14')]));require(_0x866b('0x17'))[_0x866b('0x18')](socket);var jayson=require(_0x866b('0x19'));var client=jayson[_0x866b('0x1a')][_0x866b('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0xb5b2d9,_0xe04316,_0xffffbc,_0x277aed){return new BPromise(function(_0x1ecce8,_0x124954){var _0x33c49c=_0x277aed||client;return _0x33c49c[_0x866b('0x1c')](_0xb5b2d9,_0xffffbc)['then'](function(_0x295cc6){logger[_0x866b('0x1d')](_0x866b('0x1e'),_0xe04316,_0x866b('0x1f'));logger[_0x866b('0x20')](_0x866b('0x21'),_0xe04316,'request\x20sent',JSON['stringify'](_0x295cc6));if(_0x295cc6[_0x866b('0x22')]){if(_0x295cc6[_0x866b('0x22')]['code']===0x1f4){logger[_0x866b('0x22')](_0x866b('0x1e'),_0xe04316,_0x295cc6[_0x866b('0x22')][_0x866b('0x23')]);return _0x124954(_0x295cc6[_0x866b('0x22')][_0x866b('0x23')]);}logger[_0x866b('0x22')](_0x866b('0x1e'),_0xe04316,_0x295cc6[_0x866b('0x22')][_0x866b('0x23')]);return _0x1ecce8(_0x295cc6['error']['message']);}else{logger['info'](_0x866b('0x1e'),_0xe04316,_0x866b('0x1f'));_0x1ecce8(_0x295cc6[_0x866b('0x24')][_0x866b('0x23')]);}})[_0x866b('0x25')](function(_0x2aaead){logger[_0x866b('0x22')](_0x866b('0x1e'),_0xe04316,_0x2aaead);_0x124954(_0x2aaead);});});}function respondWithStatusCode(_0x2291cb,_0x2f6bfe){_0x2f6bfe=_0x2f6bfe||0xcc;return function(_0x11e99e){if(_0x11e99e){return _0x2291cb[_0x866b('0x26')](_0x2f6bfe);}return _0x2291cb[_0x866b('0x27')](_0x2f6bfe)[_0x866b('0x28')]();};}function respondWithResult(_0x154f4e,_0xb8d891){_0xb8d891=_0xb8d891||0xc8;return function(_0x4bf6fe){if(_0x4bf6fe){return _0x154f4e['status'](_0xb8d891)[_0x866b('0x29')](_0x4bf6fe);}};}function respondWithFilteredResult(_0x2c38a2,_0x3aa9b9){return function(_0x46a24a){if(_0x46a24a){var _0x5ae5b1=typeof _0x3aa9b9[_0x866b('0x2a')]===_0x866b('0x2b')&&typeof _0x3aa9b9['limit']===_0x866b('0x2b');var _0x409ab9=_0x46a24a[_0x866b('0x2c')];var _0x4d4ab1=_0x5ae5b1?0x0:_0x3aa9b9[_0x866b('0x2a')];var _0x300e68=_0x5ae5b1?_0x46a24a[_0x866b('0x2c')]:_0x3aa9b9[_0x866b('0x2a')]+_0x3aa9b9['limit'];var _0x55e9c0;if(_0x300e68>=_0x409ab9){_0x300e68=_0x409ab9;_0x55e9c0=0xc8;}else{_0x55e9c0=0xce;}_0x2c38a2['status'](_0x55e9c0);return _0x2c38a2[_0x866b('0x2d')](_0x866b('0x2e'),_0x4d4ab1+'-'+_0x300e68+'/'+_0x409ab9)[_0x866b('0x29')](_0x46a24a);}return null;};}function patchUpdates(_0x5f2bae){return function(_0x55b8a9){try{jsonpatch[_0x866b('0x2f')](_0x55b8a9,_0x5f2bae,!![]);}catch(_0x19af6d){return BPromise[_0x866b('0x30')](_0x19af6d);}return _0x55b8a9[_0x866b('0x31')]();};}function saveUpdates(_0x27ecee,_0x3dbc08){return function(_0x376d78){if(_0x376d78){return _0x376d78[_0x866b('0x32')](_0x27ecee)[_0x866b('0x33')](function(_0x1851c8){return _0x1851c8;});}return null;};}function removeEntity(_0x24372a,_0x14eb1b){return function(_0x559cc2){if(_0x559cc2){return _0x559cc2['destroy']()[_0x866b('0x33')](function(){var _0x11ea81=_0x559cc2[_0x866b('0x34')]({'plain':!![]});var _0x5020e5=_0x866b('0x35');return db['UserProfileResource'][_0x866b('0x36')]({'where':{'type':_0x5020e5,'resourceId':_0x11ea81['id']}})[_0x866b('0x33')](function(){return _0x559cc2;});})[_0x866b('0x33')](function(){_0x24372a[_0x866b('0x27')](0xcc)[_0x866b('0x28')]();});}};}function handleEntityNotFound(_0x5d341a,_0x17265c){return function(_0x1ec46d){if(!_0x1ec46d){_0x5d341a[_0x866b('0x26')](0x194);}return _0x1ec46d;};}function handleError(_0x23e4ff,_0x1f7a82){_0x1f7a82=_0x1f7a82||0x1f4;return function(_0x556276){logger[_0x866b('0x22')](_0x556276[_0x866b('0x37')]);if(_0x556276['name']){delete _0x556276[_0x866b('0x38')];}_0x23e4ff['status'](_0x1f7a82)[_0x866b('0x39')](_0x556276);};}exports[_0x866b('0x3a')]=function(_0x438a85,_0x1f2202){var _0x5ea7ac={'include':[{'model':db[_0x866b('0x3b')],'as':'mandatoryDispositionPause'}]},_0x4118cf={},_0xc6c5f={'count':0x0,'rows':[]};var _0x373337=_[_0x866b('0x3c')](db[_0x866b('0x3d')]['rawAttributes'],function(_0x8d520a){return{'name':_0x8d520a[_0x866b('0x3e')],'type':_0x8d520a['type'][_0x866b('0x3f')]};});_0x4118cf[_0x866b('0x40')]=_[_0x866b('0x3c')](_0x373337,_0x866b('0x38'));_0x4118cf[_0x866b('0x41')]=_[_0x866b('0x42')](_0x438a85['query']);_0x4118cf[_0x866b('0x43')]=_[_0x866b('0x44')](_0x4118cf[_0x866b('0x40')],_0x4118cf[_0x866b('0x41')]);_0x5ea7ac[_0x866b('0x45')]=_[_0x866b('0x44')](_0x4118cf[_0x866b('0x40')],qs[_0x866b('0x46')](_0x438a85[_0x866b('0x41')][_0x866b('0x46')]));_0x5ea7ac['attributes']=_0x5ea7ac['attributes'][_0x866b('0x47')]?_0x5ea7ac[_0x866b('0x45')]:_0x4118cf[_0x866b('0x40')];if(!_0x438a85[_0x866b('0x41')]['hasOwnProperty'](_0x866b('0x48'))){_0x5ea7ac[_0x866b('0x49')]=qs[_0x866b('0x49')](_0x438a85[_0x866b('0x41')][_0x866b('0x49')]);_0x5ea7ac[_0x866b('0x2a')]=qs[_0x866b('0x2a')](_0x438a85[_0x866b('0x41')][_0x866b('0x2a')]);}_0x5ea7ac[_0x866b('0x4a')]=qs[_0x866b('0x4b')](_0x438a85['query'][_0x866b('0x4b')]);_0x5ea7ac['where']=qs[_0x866b('0x43')](_['pick'](_0x438a85[_0x866b('0x41')],_0x4118cf['filters']),_0x373337);if(_0x438a85['query']['filter']){_0x5ea7ac[_0x866b('0x4c')]=_['merge'](_0x5ea7ac[_0x866b('0x4c')],{'$or':_['map'](_0x373337,function(_0x520f53){if(_0x520f53[_0x866b('0x4d')]!==_0x866b('0x4e')){var _0x877d64={};_0x877d64[_0x520f53[_0x866b('0x38')]]={'$like':'%'+_0x438a85['query'][_0x866b('0x4f')]+'%'};return _0x877d64;}})});}_0x5ea7ac=_[_0x866b('0x50')]({},_0x5ea7ac,_0x438a85['options']);var _0x23654b={'where':_0x5ea7ac[_0x866b('0x4c')]};return db[_0x866b('0x3d')]['count'](_0x23654b)['then'](function(_0x22c396){_0xc6c5f['count']=_0x22c396;if(_0x438a85['query'][_0x866b('0x51')]){_0x5ea7ac[_0x866b('0x52')]=[{'all':!![]}];}return db[_0x866b('0x3d')]['findAll'](_0x5ea7ac);})['then'](function(_0x5c381e){_0xc6c5f[_0x866b('0x53')]=_0x5c381e;return _0xc6c5f;})[_0x866b('0x33')](respondWithFilteredResult(_0x1f2202,_0x5ea7ac))['catch'](handleError(_0x1f2202,null));};exports[_0x866b('0x54')]=function(_0x40513d,_0x8187a6){var _0x1f9b86={'raw':![],'where':{'id':_0x40513d[_0x866b('0x55')]['id']},'include':[{'model':db[_0x866b('0x3b')],'as':_0x866b('0x56')}]},_0x3a2963={};_0x3a2963[_0x866b('0x40')]=_['keys'](db['WhatsappAccount'][_0x866b('0x57')]);_0x3a2963[_0x866b('0x41')]=_['keys'](_0x40513d[_0x866b('0x41')]);_0x3a2963[_0x866b('0x43')]=_[_0x866b('0x44')](_0x3a2963['model'],_0x3a2963['query']);_0x1f9b86[_0x866b('0x45')]=_[_0x866b('0x44')](_0x3a2963[_0x866b('0x40')],qs[_0x866b('0x46')](_0x40513d['query'][_0x866b('0x46')]));_0x1f9b86['attributes']=_0x1f9b86['attributes'][_0x866b('0x47')]?_0x1f9b86[_0x866b('0x45')]:_0x3a2963[_0x866b('0x40')];if(_0x40513d[_0x866b('0x41')][_0x866b('0x51')]){_0x1f9b86[_0x866b('0x52')]=[{'all':!![]}];}_0x1f9b86=_['merge']({},_0x1f9b86,_0x40513d['options']);return db[_0x866b('0x3d')][_0x866b('0x58')](_0x1f9b86)[_0x866b('0x33')](handleEntityNotFound(_0x8187a6,null))[_0x866b('0x33')](respondWithResult(_0x8187a6,null))[_0x866b('0x25')](handleError(_0x8187a6,null));};exports[_0x866b('0x59')]=function(_0x189cb1,_0x33f6c3){return db[_0x866b('0x3d')][_0x866b('0x59')](_0x189cb1['body'],{})['then'](function(_0x2e319e){var _0x42d966=_0x189cb1[_0x866b('0x5a')][_0x866b('0x34')]({'plain':!![]});if(!_0x42d966)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42d966[_0x866b('0x5b')]===_0x866b('0x5a')){var _0x551af9=_0x2e319e[_0x866b('0x34')]({'plain':!![]});var _0xeabe09=_0x866b('0x35');return db[_0x866b('0x5c')]['find']({'where':{'name':_0xeabe09,'userProfileId':_0x42d966[_0x866b('0x5d')]},'raw':!![]})[_0x866b('0x33')](function(_0x4c51be){if(_0x4c51be&&_0x4c51be[_0x866b('0x5e')]===0x0){return db[_0x866b('0x5f')][_0x866b('0x59')]({'name':_0x551af9[_0x866b('0x38')],'resourceId':_0x551af9['id'],'type':_0x4c51be[_0x866b('0x38')],'sectionId':_0x4c51be['id']},{})['then'](function(){return _0x2e319e;});}else{return _0x2e319e;}})[_0x866b('0x25')](function(_0x33b4c0){logger[_0x866b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33b4c0);throw _0x33b4c0;});}return _0x2e319e;})[_0x866b('0x33')](respondWithResult(_0x33f6c3,0xc9))['catch'](handleError(_0x33f6c3,null));};exports[_0x866b('0x32')]=function(_0x503fcf,_0x29ae7c){if(_0x503fcf[_0x866b('0x60')]['id']){delete _0x503fcf[_0x866b('0x60')]['id'];}return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x503fcf[_0x866b('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x29ae7c,null))['then'](saveUpdates(_0x503fcf[_0x866b('0x60')],null))['then'](respondWithResult(_0x29ae7c,null))[_0x866b('0x25')](handleError(_0x29ae7c,null));};exports[_0x866b('0x36')]=function(_0x94542b,_0x23b688){return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x94542b[_0x866b('0x55')]['id']}})['then'](handleEntityNotFound(_0x23b688,null))[_0x866b('0x33')](removeEntity(_0x23b688,null))[_0x866b('0x25')](handleError(_0x23b688,null));};exports[_0x866b('0x61')]=function(_0x4d3d4e,_0x3bec99){return db['WhatsappAccount'][_0x866b('0x61')]()[_0x866b('0x33')](respondWithResult(_0x3bec99,null))[_0x866b('0x25')](handleError(_0x3bec99,null));};exports[_0x866b('0x62')]=function(_0x216e69,_0x2f733d,_0x485ba4){if(_0x216e69[_0x866b('0x60')]['id']){delete _0x216e69['body']['id'];}return db['WhatsappAccount'][_0x866b('0x58')]({'where':{'id':_0x216e69[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x2f733d,null))[_0x866b('0x33')](function(_0x525e3e){if(_0x525e3e){_0x216e69[_0x866b('0x60')][_0x866b('0x63')]=_0x525e3e['id'];return db[_0x866b('0x64')][_0x866b('0x59')](_0x216e69[_0x866b('0x60')]);}})['then'](respondWithResult(_0x2f733d,null))['catch'](handleError(_0x2f733d,null));};exports[_0x866b('0x65')]=function(_0x521d1a,_0x2c17e1,_0x4f9f3d){var _0x1a4277={'raw':![],'where':{}};var _0x31b102={};var _0x552360={'count':0x0,'rows':[]};return db[_0x866b('0x3d')][_0x866b('0x66')]({'where':{'id':_0x521d1a[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x2c17e1,null))[_0x866b('0x33')](function(_0x1b8b85){if(_0x1b8b85){_0x31b102['model']=_['keys'](db[_0x866b('0x64')]['rawAttributes']);_0x31b102[_0x866b('0x41')]=_['keys'](_0x521d1a['query']);_0x31b102[_0x866b('0x43')]=_[_0x866b('0x44')](_0x31b102[_0x866b('0x40')],_0x31b102[_0x866b('0x41')]);_0x1a4277['attributes']=_[_0x866b('0x44')](_0x31b102[_0x866b('0x40')],qs[_0x866b('0x46')](_0x521d1a['query']['fields']));_0x1a4277[_0x866b('0x45')]=_0x1a4277[_0x866b('0x45')]['length']?_0x1a4277[_0x866b('0x45')]:_0x31b102[_0x866b('0x40')];if(!_0x521d1a[_0x866b('0x41')][_0x866b('0x67')](_0x866b('0x48'))){_0x1a4277[_0x866b('0x49')]=qs[_0x866b('0x49')](_0x521d1a[_0x866b('0x41')][_0x866b('0x49')]);_0x1a4277[_0x866b('0x2a')]=qs['offset'](_0x521d1a[_0x866b('0x41')][_0x866b('0x2a')]);}_0x1a4277[_0x866b('0x4a')]=qs['sort'](_0x521d1a[_0x866b('0x41')][_0x866b('0x4b')]);_0x1a4277[_0x866b('0x4c')]=qs['filters'](_['pick'](_0x521d1a[_0x866b('0x41')],_0x31b102[_0x866b('0x43')]));_0x1a4277[_0x866b('0x4c')][_0x866b('0x63')]=_0x1b8b85['id'];if(_0x521d1a[_0x866b('0x41')][_0x866b('0x4f')]){_0x1a4277[_0x866b('0x4c')]=_['merge'](_0x1a4277['where'],{'$or':_['map'](_0x1a4277[_0x866b('0x45')],function(_0x2fa52c){var _0xb369d2={};_0xb369d2[_0x2fa52c]={'$like':'%'+_0x521d1a[_0x866b('0x41')][_0x866b('0x4f')]+'%'};return _0xb369d2;})});}_0x1a4277=_['merge']({},_0x1a4277,_0x521d1a[_0x866b('0x68')]);return db['Disposition'][_0x866b('0x2c')]({'where':_0x1a4277[_0x866b('0x4c')]})['then'](function(_0x29365c){_0x552360[_0x866b('0x2c')]=_0x29365c;if(_0x521d1a[_0x866b('0x41')][_0x866b('0x51')]){_0x1a4277['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x1a4277);})[_0x866b('0x33')](function(_0x4f5f1e){_0x552360[_0x866b('0x53')]=_0x4f5f1e;return _0x552360;});}})[_0x866b('0x33')](respondWithFilteredResult(_0x2c17e1,_0x1a4277))[_0x866b('0x25')](handleError(_0x2c17e1,null));};exports[_0x866b('0x69')]=function(_0x1dae07,_0x4d7e0d,_0x55295e){return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x1dae07[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x4d7e0d,null))[_0x866b('0x33')](function(_0x15669f){if(_0x15669f){return _0x15669f[_0x866b('0x69')](_0x1dae07['query']['ids']);}})[_0x866b('0x33')](respondWithStatusCode(_0x4d7e0d,null))[_0x866b('0x25')](handleError(_0x4d7e0d,null));};exports[_0x866b('0x6a')]=function(_0x308b8f,_0x4ec3e0,_0x4db18e){if(_0x308b8f[_0x866b('0x60')]['id']){delete _0x308b8f['body']['id'];}return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x308b8f[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x4ec3e0,null))[_0x866b('0x33')](function(_0x5c0505){if(_0x5c0505){_0x308b8f[_0x866b('0x60')]['WhatsappAccountId']=_0x5c0505['id'];return db[_0x866b('0x6b')][_0x866b('0x59')](_0x308b8f['body']);}})['then'](respondWithResult(_0x4ec3e0,null))[_0x866b('0x25')](handleError(_0x4ec3e0,null));};exports[_0x866b('0x6c')]=function(_0x501f80,_0x11cdae,_0x24787e){var _0x128d93={'raw':![],'where':{}};var _0x245469={};var _0x140db7={'count':0x0,'rows':[]};return db[_0x866b('0x3d')][_0x866b('0x66')]({'where':{'id':_0x501f80[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x11cdae,null))[_0x866b('0x33')](function(_0x22e02f){if(_0x22e02f){_0x245469[_0x866b('0x40')]=_[_0x866b('0x42')](db['CannedAnswer'][_0x866b('0x57')]);_0x245469['query']=_['keys'](_0x501f80[_0x866b('0x41')]);_0x245469[_0x866b('0x43')]=_[_0x866b('0x44')](_0x245469[_0x866b('0x40')],_0x245469[_0x866b('0x41')]);_0x128d93['attributes']=_[_0x866b('0x44')](_0x245469[_0x866b('0x40')],qs[_0x866b('0x46')](_0x501f80[_0x866b('0x41')][_0x866b('0x46')]));_0x128d93[_0x866b('0x45')]=_0x128d93[_0x866b('0x45')][_0x866b('0x47')]?_0x128d93[_0x866b('0x45')]:_0x245469[_0x866b('0x40')];if(!_0x501f80[_0x866b('0x41')][_0x866b('0x67')](_0x866b('0x48'))){_0x128d93['limit']=qs['limit'](_0x501f80['query']['limit']);_0x128d93[_0x866b('0x2a')]=qs[_0x866b('0x2a')](_0x501f80[_0x866b('0x41')]['offset']);}_0x128d93[_0x866b('0x4a')]=qs[_0x866b('0x4b')](_0x501f80['query'][_0x866b('0x4b')]);_0x128d93[_0x866b('0x4c')]=qs[_0x866b('0x43')](_[_0x866b('0x6d')](_0x501f80['query'],_0x245469[_0x866b('0x43')]));_0x128d93[_0x866b('0x4c')]['WhatsappAccountId']=_0x22e02f['id'];if(_0x501f80['query'][_0x866b('0x4f')]){_0x128d93[_0x866b('0x4c')]=_[_0x866b('0x50')](_0x128d93['where'],{'$or':_[_0x866b('0x3c')](_0x128d93['attributes'],function(_0x38b873){var _0x38764f={};_0x38764f[_0x38b873]={'$like':'%'+_0x501f80[_0x866b('0x41')][_0x866b('0x4f')]+'%'};return _0x38764f;})});}_0x128d93=_[_0x866b('0x50')]({},_0x128d93,_0x501f80['options']);return db['CannedAnswer']['count']({'where':_0x128d93[_0x866b('0x4c')]})[_0x866b('0x33')](function(_0x279036){_0x140db7[_0x866b('0x2c')]=_0x279036;if(_0x501f80['query'][_0x866b('0x51')]){_0x128d93['include']=[{'all':!![]}];}return db[_0x866b('0x6b')][_0x866b('0x6e')](_0x128d93);})[_0x866b('0x33')](function(_0x2a8e38){_0x140db7[_0x866b('0x53')]=_0x2a8e38;return _0x140db7;});}})[_0x866b('0x33')](respondWithFilteredResult(_0x11cdae,_0x128d93))[_0x866b('0x25')](handleError(_0x11cdae,null));};exports['removeAnswers']=function(_0x1d158a,_0xda0028,_0x46fc26){return db[_0x866b('0x3d')]['find']({'where':{'id':_0x1d158a['params']['id']}})[_0x866b('0x33')](handleEntityNotFound(_0xda0028,null))[_0x866b('0x33')](function(_0x21ae6b){if(_0x21ae6b){return _0x21ae6b[_0x866b('0x6f')](_0x1d158a[_0x866b('0x41')][_0x866b('0x70')]);}})[_0x866b('0x33')](respondWithStatusCode(_0xda0028,null))[_0x866b('0x25')](handleError(_0xda0028,null));};exports[_0x866b('0x71')]=function(_0x3b3dc4,_0x52b82f,_0x3bace7){return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x3b3dc4['params']['id']}})['then'](handleEntityNotFound(_0x52b82f,null))[_0x866b('0x33')](function(_0x45ff4e){if(_0x45ff4e){return _0x45ff4e[_0x866b('0x71')](_0x3b3dc4[_0x866b('0x60')][_0x866b('0x70')],_['omit'](_0x3b3dc4[_0x866b('0x60')],[_0x866b('0x70'),'id'])||{})[_0x866b('0x72')](function(_0x4ecc9f){for(var _0x140daf=0x0;_0x140daf<_0x3b3dc4[_0x866b('0x60')][_0x866b('0x70')][_0x866b('0x47')];_0x140daf+=0x1){socket[_0x866b('0x73')](_0x866b('0x74'),{'UserId':Number(_0x3b3dc4[_0x866b('0x60')][_0x866b('0x70')][_0x140daf]),'WhatsappAccountId':Number(_0x3b3dc4['params']['id'])});}return _0x4ecc9f;});}})[_0x866b('0x33')](respondWithResult(_0x52b82f,null))[_0x866b('0x25')](handleError(_0x52b82f,null));};exports[_0x866b('0x75')]=function(_0x5f4a45,_0x4dcc2e,_0x5b7267){return db['WhatsappAccount'][_0x866b('0x58')]({'where':{'id':_0x5f4a45[_0x866b('0x55')]['id']}})['then'](handleEntityNotFound(_0x4dcc2e,null))[_0x866b('0x33')](function(_0x56a09a){if(_0x56a09a){return _0x56a09a[_0x866b('0x75')](_0x5f4a45['query'][_0x866b('0x70')])['then'](function(){if(_[_0x866b('0x76')](_0x5f4a45[_0x866b('0x41')]['ids'])){for(var _0x5d7c45=0x0;_0x5d7c45<_0x5f4a45['query'][_0x866b('0x70')][_0x866b('0x47')];_0x5d7c45+=0x1){socket[_0x866b('0x73')](_0x866b('0x77'),{'UserId':Number(_0x5f4a45[_0x866b('0x41')]['ids'][_0x5d7c45]),'WhatsappAccountId':Number(_0x5f4a45[_0x866b('0x55')]['id'])});}}else{socket['emit'](_0x866b('0x77'),{'UserId':Number(_0x5f4a45[_0x866b('0x41')][_0x866b('0x70')]),'WhatsappAccountId':Number(_0x5f4a45['params']['id'])});}});}})[_0x866b('0x33')](respondWithStatusCode(_0x4dcc2e,null))[_0x866b('0x25')](handleError(_0x4dcc2e,null));};exports['getAgents']=function(_0x4c199b,_0x1c6198,_0x740e42){var _0x32c62d={};var _0x35dc55={};var _0x4dc5ba;var _0x266c07;return db['WhatsappAccount']['findOne']({'where':{'id':_0x4c199b[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x1c6198,null))[_0x866b('0x33')](function(_0x189f37){if(_0x189f37){_0x4dc5ba=_0x189f37;_0x35dc55[_0x866b('0x40')]=_[_0x866b('0x42')](db[_0x866b('0x78')][_0x866b('0x57')]);_0x35dc55[_0x866b('0x41')]=_[_0x866b('0x42')](_0x4c199b['query']);_0x35dc55[_0x866b('0x43')]=_['intersection'](_0x35dc55[_0x866b('0x40')],_0x35dc55[_0x866b('0x41')]);_0x32c62d['attributes']=_[_0x866b('0x44')](_0x35dc55[_0x866b('0x40')],qs[_0x866b('0x46')](_0x4c199b['query'][_0x866b('0x46')]));_0x32c62d['attributes']=_0x32c62d[_0x866b('0x45')][_0x866b('0x47')]?_0x32c62d[_0x866b('0x45')]:_0x35dc55[_0x866b('0x40')];_0x32c62d[_0x866b('0x4a')]=qs['sort'](_0x4c199b[_0x866b('0x41')][_0x866b('0x4b')]);_0x32c62d[_0x866b('0x4c')]=qs[_0x866b('0x43')](_[_0x866b('0x6d')](_0x4c199b[_0x866b('0x41')],_0x35dc55[_0x866b('0x43')]));if(_0x4c199b['query'][_0x866b('0x4f')]){_0x32c62d[_0x866b('0x4c')]=_[_0x866b('0x50')](_0x32c62d[_0x866b('0x4c')],{'$or':_['map'](_0x32c62d[_0x866b('0x45')],function(_0x450d16){var _0xcf4470={};_0xcf4470[_0x450d16]={'$like':'%'+_0x4c199b[_0x866b('0x41')][_0x866b('0x4f')]+'%'};return _0xcf4470;})});}_0x32c62d=_[_0x866b('0x50')]({},_0x32c62d,_0x4c199b[_0x866b('0x68')]);return _0x4dc5ba[_0x866b('0x79')](_0x32c62d);}})[_0x866b('0x33')](function(_0x560097){if(_0x560097){_0x266c07=_0x560097[_0x866b('0x47')];if(!_0x4c199b[_0x866b('0x41')][_0x866b('0x67')]('nolimit')){_0x32c62d['limit']=qs[_0x866b('0x49')](_0x4c199b[_0x866b('0x41')]['limit']);_0x32c62d[_0x866b('0x2a')]=qs[_0x866b('0x2a')](_0x4c199b[_0x866b('0x41')][_0x866b('0x2a')]);}return _0x4dc5ba[_0x866b('0x79')](_0x32c62d);}})[_0x866b('0x33')](function(_0x2185ea){if(_0x2185ea){return _0x2185ea?{'count':_0x266c07,'rows':_0x2185ea}:null;}})['then'](respondWithResult(_0x1c6198,null))['catch'](handleError(_0x1c6198,null));};exports['addApplications']=function(_0x48e4fc,_0x2a8e36){var _0xf6cddd=_0x48e4fc[_0x866b('0x55')]['id'];var _0x280641=_0x48e4fc[_0x866b('0x60')];var _0x2006c9=0xc8;var _0x23feb4=null;return db[_0x866b('0x7a')]['transaction']({'isolationLevel':db[_0x866b('0x7a')][_0x866b('0x7b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x22f117){return db[_0x866b('0x3d')]['findOne']({'where':{'id':_0xf6cddd},'transaction':_0x22f117})[_0x866b('0x33')](function(_0x3c86fb){if(_0x3c86fb){return db[_0x866b('0x7c')][_0x866b('0x36')]({'where':{'WhatsappAccountId':_0xf6cddd},'transaction':_0x22f117})[_0x866b('0x33')](function(){var _0x3c3106=_[_0x866b('0x3c')](_0x280641,function(_0x3c6c06){_0x3c6c06[_0x866b('0x63')]=_0xf6cddd;return _0x3c6c06;});return db['WhatsappApplication'][_0x866b('0x7d')](_0x3c3106,{'transaction':_0x22f117});});}else{_0x2006c9=0x194;_0x23feb4=[];}});})[_0x866b('0x33')](function(){if(_0x2006c9!==0x194){return db[_0x866b('0x7c')][_0x866b('0x7e')]({'where':{'WhatsappAccountId':_0xf6cddd},'order':_0x866b('0x7f')})['then'](function(_0x271769){_0x23feb4=_0x271769;});}})[_0x866b('0x25')](function(_0x4872bf){_0x2006c9=0x1f4;logger['error'](_0x4872bf[_0x866b('0x37')]);if(_0x4872bf['name']){delete _0x4872bf[_0x866b('0x38')];}_0x23feb4=_0x4872bf;})[_0x866b('0x80')](function(){if(_0x23feb4===null){_0x2a8e36[_0x866b('0x26')](_0x2006c9);}else{if(_0x2006c9===0x1f4){_0x2a8e36[_0x866b('0x27')](_0x2006c9)[_0x866b('0x39')](_0x23feb4);}else{_0x2a8e36[_0x866b('0x27')](_0x2006c9)[_0x866b('0x29')](_0x23feb4);}}});};exports[_0x866b('0x81')]=function(_0x544281,_0x19d933,_0x35129b){var _0x4bf26f={};var _0x7d0948={};var _0x23ffad;var _0x221b3f;return db[_0x866b('0x3d')]['findOne']({'where':{'id':_0x544281[_0x866b('0x55')]['id']}})[_0x866b('0x33')](handleEntityNotFound(_0x19d933,null))['then'](function(_0x55a30a){if(_0x55a30a){_0x23ffad=_0x55a30a;_0x7d0948[_0x866b('0x40')]=_[_0x866b('0x42')](db[_0x866b('0x7c')][_0x866b('0x57')]);_0x7d0948[_0x866b('0x41')]=_[_0x866b('0x42')](_0x544281[_0x866b('0x41')]);_0x7d0948[_0x866b('0x43')]=_[_0x866b('0x44')](_0x7d0948[_0x866b('0x40')],_0x7d0948['query']);_0x4bf26f[_0x866b('0x45')]=_[_0x866b('0x44')](_0x7d0948[_0x866b('0x40')],qs['fields'](_0x544281[_0x866b('0x41')][_0x866b('0x46')]));_0x4bf26f['attributes']=_0x4bf26f[_0x866b('0x45')][_0x866b('0x47')]?_0x4bf26f[_0x866b('0x45')]:_0x7d0948['model'];_0x4bf26f['order']=qs[_0x866b('0x4b')](_0x544281[_0x866b('0x41')][_0x866b('0x4b')]);_0x4bf26f['where']=qs[_0x866b('0x43')](_['pick'](_0x544281[_0x866b('0x41')],_0x7d0948[_0x866b('0x43')]));if(_0x544281[_0x866b('0x41')][_0x866b('0x4f')]){_0x4bf26f[_0x866b('0x4c')]=_[_0x866b('0x50')](_0x4bf26f['where'],{'$or':_[_0x866b('0x3c')](_0x4bf26f[_0x866b('0x45')],function(_0x38fa97){var _0x15f372={};_0x15f372[_0x38fa97]={'$like':'%'+_0x544281['query'][_0x866b('0x4f')]+'%'};return _0x15f372;})});}_0x4bf26f=_['merge']({},_0x4bf26f,_0x544281[_0x866b('0x68')]);return _0x23ffad[_0x866b('0x81')](_0x4bf26f);}})[_0x866b('0x33')](function(_0x353ca2){if(_0x353ca2){_0x221b3f=_0x353ca2[_0x866b('0x47')];if(!_0x544281['query'][_0x866b('0x67')](_0x866b('0x48'))){_0x4bf26f[_0x866b('0x49')]=qs['limit'](_0x544281[_0x866b('0x41')][_0x866b('0x49')]);_0x4bf26f[_0x866b('0x2a')]=qs['offset'](_0x544281['query'][_0x866b('0x2a')]);}return _0x23ffad[_0x866b('0x81')](_0x4bf26f);}})[_0x866b('0x33')](function(_0x5d7f48){if(_0x5d7f48){return _0x5d7f48?{'count':_0x221b3f,'rows':_0x5d7f48}:null;}})['then'](respondWithResult(_0x19d933,null))[_0x866b('0x25')](handleError(_0x19d933,null));};exports['notify']=function(_0x329a44,_0x20528b,_0x334e5e){var _0x2ddb05={'channel':_0x866b('0x82')};var _0x272258=[];var _0x9a7453=[];var _0x174210={};return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x329a44[_0x866b('0x55')]['id']},'include':[{'model':db[_0x866b('0x7c')],'as':'Applications'}]})[_0x866b('0x33')](handleEntityNotFound(_0x20528b,null))[_0x866b('0x33')](function(_0x3f328c){_0x2ddb05[_0x866b('0x83')]=_0x3f328c;if(_0x2ddb05[_0x866b('0x83')]&&_0x2ddb05['account'][_0x866b('0x4d')]===_0x866b('0x84')&&_0x329a44['body']['statuses']){if(_0x329a44['body']['statuses'][_0x866b('0x47')]===0x0)return;if(_0x329a44[_0x866b('0x60')][_0x866b('0x85')][0x0][_0x866b('0x86')]!==_0x866b('0x87'))return;return db['WhatsappMessage'][_0x866b('0x32')]({'read':!![],'readAt':_0x329a44['body'][_0x866b('0x85')][0x0][_0x866b('0x88')]},{'where':{'messageId':_0x329a44['body'][_0x866b('0x85')][0x0]['message_id']},'individualHooks':!![]})[_0x866b('0x33')](function(_0x3cea40){return _0x20528b[_0x866b('0x27')](0xc8)[_0x866b('0x29')](_0x3cea40);});}_0x2ddb05['applications']=_[_0x866b('0x89')](_0x3f328c[_0x866b('0x8a')],['priority'],[_0x866b('0x8b')]);if(_0x2ddb05[_0x866b('0x83')][_0x866b('0x8a')]){delete _0x2ddb05[_0x866b('0x83')][_0x866b('0x8a')];}return db[_0x866b('0x8c')][_0x866b('0x61')]()['then'](function(_0x2fa74d){if(!_0x2fa74d){throw new db[(_0x866b('0x8d'))][(_0x866b('0x8e'))](_0x866b('0x8f'));}_0x272258=_[_0x866b('0x90')](_['keys'](_0x2fa74d),[_0x866b('0x91'),_0x866b('0x92')]);_0x9a7453=_[_0x866b('0x90')](_[_0x866b('0x42')](_0x2fa74d),[_0x866b('0x91'),_0x866b('0x92'),_0x866b('0x93'),_0x866b('0x94')]);_0x2ddb05[_0x866b('0x60')]={'mapKey':'mobile'};if(_0x2ddb05[_0x866b('0x83')]&&_0x2ddb05['account']['type']===_0x866b('0x95')){_0x2ddb05['body']['from']=_0x329a44[_0x866b('0x60')]['From'][_0x866b('0x96')](_0x866b('0x97'),'');_0x2ddb05[_0x866b('0x60')]['body']=_0x329a44[_0x866b('0x60')][_0x866b('0x98')];_0x2ddb05[_0x866b('0x60')][_0x866b('0x99')]=_0x329a44[_0x866b('0x60')][_0x866b('0x9a')];}if(_0x2ddb05[_0x866b('0x83')]&&_0x2ddb05[_0x866b('0x83')][_0x866b('0x4d')]==='sinch'){_0x2ddb05[_0x866b('0x60')]['from']=_0x329a44[_0x866b('0x60')][_0x866b('0x9b')][0x0]['from'];_0x2ddb05[_0x866b('0x60')][_0x866b('0x60')]=_0x329a44[_0x866b('0x60')]['notifications'][0x0][_0x866b('0x23')]['body'];_0x2ddb05[_0x866b('0x60')][_0x866b('0x99')]=_0x329a44[_0x866b('0x60')][_0x866b('0x9b')][0x0][_0x866b('0x9c')];}if(_0x2ddb05['body']['id']){delete _0x2ddb05[_0x866b('0x60')]['id'];}if(_[_0x866b('0x9d')](_0x2ddb05['body'][_0x866b('0x9e')])){throw new db['Sequelize'][(_0x866b('0x8e'))](_0x866b('0x9f'));}if(_['isNil'](_0x2ddb05[_0x866b('0x60')][_0x866b('0x60')])||_0x2ddb05[_0x866b('0x60')][_0x866b('0x60')]===''){throw new db[(_0x866b('0x8d'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2ddb05[_0x866b('0x60')][_0x866b('0xa0')])){throw new db['Sequelize'][(_0x866b('0x8e'))](_0x866b('0xa1')+_0x9a7453);}if(!_[_0x866b('0xa2')](_0x9a7453,_0x2ddb05['body'][_0x866b('0xa0')])){throw new db['Sequelize'][(_0x866b('0x8e'))](_0x866b('0xa3')+_0x9a7453);}_0x174210[_0x2ddb05[_0x866b('0x60')][_0x866b('0xa0')]]=_0x2ddb05['body'][_0x866b('0x9e')];return db[_0x866b('0xa4')][_0x866b('0x58')]({'where':{'id':_0x2ddb05[_0x866b('0x83')][_0x866b('0x94')]},'include':[{'model':db[_0x866b('0x8c')],'as':_0x866b('0xa5'),'where':_0x174210,'limit':0x1,'order':[[_0x866b('0x92'),_0x866b('0xa6')]]}]});})[_0x866b('0x33')](handleEntityNotFound(_0x20528b,null))[_0x866b('0x33')](function(_0x127b75){if(_0x127b75){_0x2ddb05[_0x866b('0xa7')]=_[_0x866b('0xa8')](_0x127b75,[_0x866b('0xa5')]);if(_0x127b75['Contacts'][_0x866b('0x47')]){return _0x127b75[_0x866b('0xa5')][0x0];}var _0x1ab6ea=_[_0x866b('0x15')](_0x2ddb05['body'],{'firstName':_0x2ddb05['body'][_0x866b('0x9e')],'ListId':_0x127b75['id']});_0x1ab6ea[_0x2ddb05[_0x866b('0x60')]['mapKey']]=_0x2ddb05[_0x866b('0x60')]['from'];return db[_0x866b('0x8c')][_0x866b('0x59')](_0x1ab6ea,{'fields':_0x272258,'raw':!![]});}})['then'](handleEntityNotFound(_0x20528b,null))[_0x866b('0x33')](function(_0x3d81ae){if(_0x3d81ae){_0x2ddb05['contact']=_0x3d81ae;var _0x426d21={'ContactId':_0x3d81ae['id'],'phone':_0x2ddb05['body'][_0x866b('0x9e')],'WhatsappAccountId':_0x329a44[_0x866b('0x55')]['id']};var _0x4d42e8={'ContactId':_0x3d81ae['id'],'WhatsappAccountId':_0x329a44['params']['id'],'closed':![]};return db[_0x866b('0xa9')][_0x866b('0x58')]({'where':_0x4d42e8})[_0x866b('0x33')](function(_0x3163bc){if(_0x3163bc){return[_0x3163bc,![]];}return db[_0x866b('0xa9')]['create'](_0x426d21)[_0x866b('0x33')](function(_0x173bf2){return[_0x173bf2,!![]];});});}})['spread'](function(_0x2f39a5,_0x47b0d6){_0x2ddb05['interaction']=_0x2f39a5[_0x866b('0x34')]({'plain':!![]});_0x2ddb05[_0x866b('0xaa')][_0x866b('0xab')]=![];if(_0x47b0d6){if(_0x2ddb05[_0x866b('0x83')]['autoclose']){_0x2ddb05[_0x866b('0xac')]['push']({'id':0x0,'priority':_0x2ddb05['applications']['length']+0x1,'app':_0x866b('0xad'),'appdata':_0x866b('0xae'),'interval':_0x866b('0xaf')});}_0x2ddb05[_0x866b('0xaa')][_0x866b('0xab')]=!![];}return db[_0x866b('0xb0')][_0x866b('0x59')]({'phone':_0x2ddb05[_0x866b('0x60')][_0x866b('0x9e')],'messageId':_0x2ddb05[_0x866b('0x60')][_0x866b('0x99')],'body':_0x2ddb05[_0x866b('0x60')][_0x866b('0x60')],'WhatsappAccountId':_0x329a44[_0x866b('0x55')]['id'],'WhatsappInteractionId':_0x2f39a5['id'],'direction':'in','ContactId':_0x2f39a5[_0x866b('0xb1')],'AttachmentId':_0x2ddb05[_0x866b('0x60')]['AttachmentId']});})[_0x866b('0x33')](function(_0x1961c9){_0x2ddb05[_0x866b('0x23')]=_0x1961c9;if(_0x2ddb05[_0x866b('0xaa')][_0x866b('0xb2')]){return db[_0x866b('0x78')][_0x866b('0x58')]({'attributes':['id',_0x866b('0x38')],'where':{'id':_0x2ddb05['interaction'][_0x866b('0xb2')]}})[_0x866b('0x33')](function(_0x55efc8){if(_0x55efc8){_0x2ddb05[_0x866b('0xac')][_0x866b('0xb3')]({'id':0x0,'priority':0x0,'app':_0x866b('0xb4'),'appdata':_0x55efc8[_0x866b('0x38')]+','+(_0x2ddb05[_0x866b('0x83')]['waitForTheAssignedAgent']||0xa),'interval':_0x866b('0xaf')});}return respondWithRpcPromise(_0x866b('0xb5'),_0x866b('0xb6'),_0x2ddb05);});}return respondWithRpcPromise('Start',_0x866b('0xb6'),_0x2ddb05);})[_0x866b('0x33')](function(_0x31422a){if(_0x31422a){var _0x1cba2f=0xc8;var _0x8aff1d=_0x866b('0xb7');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8aff1d,_0x1cba2f,_0x866b('0xb8'));logger['debug'](_0x866b('0xb9'),_0x8aff1d,_0x1cba2f,_0x866b('0xb8'),JSON[_0x866b('0xba')](_0x31422a));if(_0x2ddb05[_0x866b('0x83')]['type']==='twilio'){return _0x20528b[_0x866b('0x27')](_0x1cba2f)['set']('Content-Type',_0x866b('0xbb'))[_0x866b('0x39')](_0x866b('0xbc'));}else{return _0x20528b[_0x866b('0x27')](_0x1cba2f)[_0x866b('0x29')](_0x31422a);}}});})[_0x866b('0x25')](handleError(_0x20528b,null));};exports[_0x866b('0x39')]=function(_0x31455e,_0x38094b,_0x1a6517){var _0x32b0d3,_0x101edb,_0xe7e08;if(_[_0x866b('0x9d')](_0x31455e[_0x866b('0x60')][_0x866b('0x60')])||_0x31455e[_0x866b('0x60')]['body']===''){throw new db[(_0x866b('0x8d'))]['ValidationError'](_0x866b('0xbd'));}if(_[_0x866b('0x9d')](_0x31455e['body']['to'])){throw new db[(_0x866b('0x8d'))][(_0x866b('0x8e'))]('to\x20is\x20mandatory');}_0x32b0d3=_0x31455e[_0x866b('0x60')]['to'];return db[_0x866b('0x3d')][_0x866b('0x58')]({'where':{'id':_0x31455e[_0x866b('0x55')]['id']},'include':[{'model':db[_0x866b('0xa4')],'as':_0x866b('0xbe'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x32b0d3},'limit':0x1,'order':[[_0x866b('0x92'),_0x866b('0xa6')]]}]}]})[_0x866b('0x33')](handleEntityNotFound(_0x38094b,null))['then'](function(_0x15ebc1){if(_0x15ebc1&&_0x15ebc1[_0x866b('0xbe')]){_0x101edb=_0x15ebc1[_0x866b('0x34')]({'plain':!![]});if(_0x101edb['List']&&_0x101edb[_0x866b('0xbe')][_0x866b('0xa5')][_0x866b('0x47')]){return _0x101edb[_0x866b('0xbe')][_0x866b('0xa5')][0x0];}return db[_0x866b('0x8c')][_0x866b('0x59')](_['defaults'](_0x31455e[_0x866b('0x60')],{'firstName':_0x32b0d3,'mobile':_0x32b0d3,'phone':_0x32b0d3,'ListId':_0x101edb[_0x866b('0x94')]}));}})[_0x866b('0x33')](handleEntityNotFound(_0x38094b,null))['then'](function(_0x480d21){if(_0x480d21){_0xe7e08=_0x480d21;return db[_0x866b('0xa9')][_0x866b('0x58')]({'where':{'ContactId':_0xe7e08['id'],'closed':![],'WhatsappAccountId':_0x101edb['id']}})[_0x866b('0x33')](function(_0x510ef1){if(_0x510ef1){return[_0x510ef1,![]];}return db[_0x866b('0xa9')]['create']({'UserId':_0x31455e[_0x866b('0x5a')]['id'],'ContactId':_0xe7e08['id'],'WhatsappAccountId':_0x101edb['id'],'phone':_0x32b0d3,'firstMsgDirection':'out','Messages':[_[_0x866b('0x50')](_0x31455e[_0x866b('0x60')],{'read':![],'body':_0x31455e[_0x866b('0x60')][_0x866b('0x60')],'phone':_0x32b0d3,'WhatsappAccountId':_0x101edb['id'],'UserId':_0x31455e['user']['id'],'ContactId':_0xe7e08['id']})]},{'include':[{'model':db[_0x866b('0xb0')],'as':_0x866b('0xbf')}]})[_0x866b('0x33')](function(_0x3d3444){return[_0x3d3444,!![]];});});}})[_0x866b('0x72')](function(_0x76683a,_0x355b50){if(_0x355b50){return _0x76683a;}return db['WhatsappMessage']['create'](_[_0x866b('0x50')](_0x31455e[_0x866b('0x60')],{'read':![],'body':_0x31455e[_0x866b('0x60')]['body'],'phone':_0x32b0d3,'WhatsappAccountId':_0x101edb['id'],'WhatsappInteractionId':_0x76683a['id'],'UserId':_0x31455e[_0x866b('0x5a')]['id'],'ContactId':_0xe7e08['id']}))[_0x866b('0x33')](function(_0x5f4558){_0x76683a['dataValues'][_0x866b('0xbf')]=[];_0x76683a['dataValues'][_0x866b('0xbf')][_0x866b('0xc0')](_0x5f4558[_0x866b('0xc1')]);return _0x76683a;});})[_0x866b('0x33')](respondWithResult(_0x38094b,null))['catch'](handleError(_0x38094b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ac3309f..3d28531 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 _0x597a=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x56a424,_0x2188ad){var _0x30700a=function(_0x4c8346){while(--_0x4c8346){_0x56a424['push'](_0x56a424['shift']());}};_0x30700a(++_0x2188ad);}(_0x597a,0xb1));var _0xa597=function(_0xed95eb,_0x2132e1){_0xed95eb=_0xed95eb-0x0;var _0x292cd7=_0x597a[_0xed95eb];return _0x292cd7;};'use strict';var EventEmitter=require(_0xa597('0x0'));var WhatsappAccount=require(_0xa597('0x1'))['db'][_0xa597('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa597('0x3')](0x0);var events={'afterCreate':_0xa597('0x4'),'afterUpdate':'update','afterDestroy':_0xa597('0x5')};function emitEvent(_0x3cadcb){return function(_0x506286,_0x2ccdb0,_0x34148f){WhatsappAccountEvents['emit'](_0x3cadcb+':'+_0x506286['id'],_0x506286);WhatsappAccountEvents[_0xa597('0x6')](_0x3cadcb,_0x506286);_0x34148f(null);};}for(var e in events){if(events[_0xa597('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa597('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x930f=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x529bd2,_0x967f08){var _0x1a0972=function(_0x12d1c2){while(--_0x12d1c2){_0x529bd2['push'](_0x529bd2['shift']());}};_0x1a0972(++_0x967f08);}(_0x930f,0x147));var _0xf930=function(_0x4d6766,_0x33b8f1){_0x4d6766=_0x4d6766-0x0;var _0x4b171c=_0x930f[_0x4d6766];return _0x4b171c;};'use strict';var EventEmitter=require(_0xf930('0x0'));var WhatsappAccount=require(_0xf930('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf930('0x2')](0x0);var events={'afterCreate':_0xf930('0x3'),'afterUpdate':'update','afterDestroy':_0xf930('0x4')};function emitEvent(_0x5d7730){return function(_0x33b318,_0xcee7d2,_0x330e50){WhatsappAccountEvents[_0xf930('0x5')](_0x5d7730+':'+_0x33b318['id'],_0x33b318);WhatsappAccountEvents[_0xf930('0x5')](_0x5d7730,_0x33b318);_0x330e50(null);};}for(var e in events){if(events[_0xf930('0x6')](e)){var event=events[e];WhatsappAccount[_0xf930('0x7')](e,emitEvent(event));}}module[_0xf930('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5e3bce8..cb6c4a8 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 _0x081b=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','bluebird','request-promise'];(function(_0x200e06,_0x2b73a9){var _0x3ed1f3=function(_0x584d95){while(--_0x584d95){_0x200e06['push'](_0x200e06['shift']());}};_0x3ed1f3(++_0x2b73a9);}(_0x081b,0x125));var _0xb081=function(_0x454f8f,_0xdbbcc3){_0x454f8f=_0x454f8f-0x0;var _0x46ba15=_0x081b[_0x454f8f];return _0x46ba15;};'use strict';var _=require(_0xb081('0x0'));var util=require(_0xb081('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb081('0x2'));var rp=require(_0xb081('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb081('0x4'));var config=require(_0xb081('0x5'));var attributes=require(_0xb081('0x6'));module[_0xb081('0x7')]=function(_0x583858,_0x487178){return _0x583858[_0xb081('0x8')](_0xb081('0x9'),attributes,{'tableName':_0xb081('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a29=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6a29,0x6c));var _0x96a2=function(_0x5f0183,_0x8b3cf){_0x5f0183=_0x5f0183-0x0;var _0x45653d=_0x6a29[_0x5f0183];return _0x45653d;};'use strict';var _=require(_0x96a2('0x0'));var util=require(_0x96a2('0x1'));var logger=require('../../config/logger')(_0x96a2('0x2'));var moment=require(_0x96a2('0x3'));var BPromise=require(_0x96a2('0x4'));var rp=require(_0x96a2('0x5'));var fs=require('fs');var path=require(_0x96a2('0x6'));var rimraf=require(_0x96a2('0x7'));var config=require(_0x96a2('0x8'));var attributes=require(_0x96a2('0x9'));module['exports']=function(_0x555bca,_0xec60e9){return _0x555bca[_0x96a2('0xa')](_0x96a2('0xb'),attributes,{'tableName':_0x96a2('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 09b6d9c..3d97c21 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 _0xaeea=['client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x34288e,_0xd85134){var _0xd78212=function(_0x279c4c){while(--_0x279c4c){_0x34288e['push'](_0x34288e['shift']());}};_0xd78212(++_0xd85134);}(_0xaeea,0x1bf));var _0xaaee=function(_0x203d1e,_0xe2a68f){_0x203d1e=_0x203d1e-0x0;var _0x588291=_0xaeea[_0x203d1e];return _0x588291;};'use strict';var _=require('lodash');var util=require(_0xaaee('0x0'));var moment=require(_0xaaee('0x1'));var BPromise=require(_0xaaee('0x2'));var rs=require(_0xaaee('0x3'));var fs=require('fs');var Redis=require(_0xaaee('0x4'));var db=require(_0xaaee('0x5'))['db'];var utils=require(_0xaaee('0x6'));var logger=require('../../config/logger')(_0xaaee('0x7'));var config=require('../../config/environment');var jayson=require(_0xaaee('0x8'));var client=jayson[_0xaaee('0x9')]['http']({'port':0x232a});config[_0xaaee('0xa')]=_[_0xaaee('0xb')](config['redis'],{'host':_0xaaee('0xc'),'port':0x18eb});var socket=require(_0xaaee('0xd'))(new Redis(config[_0xaaee('0xa')]));require(_0xaaee('0xe'))[_0xaaee('0xf')](socket);function respondWithRpcPromise(_0x521806,_0x5b08ff,_0x2a651d){return new BPromise(function(_0x567bbc,_0x191cb7){return client[_0xaaee('0x10')](_0x521806,_0x2a651d)[_0xaaee('0x11')](function(_0x5ca2a1){logger[_0xaaee('0x12')](_0xaaee('0x13'),_0x5b08ff,_0xaaee('0x14'));logger[_0xaaee('0x15')](_0xaaee('0x16'),_0x5b08ff,_0xaaee('0x14'),JSON[_0xaaee('0x17')](_0x5ca2a1));if(_0x5ca2a1['error']){if(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x19')]===0x1f4){logger[_0xaaee('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x5b08ff,_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);return _0x191cb7(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);}logger['error'](_0xaaee('0x13'),_0x5b08ff,_0x5ca2a1['error'][_0xaaee('0x1a')]);return _0x567bbc(_0x5ca2a1[_0xaaee('0x18')][_0xaaee('0x1a')]);}else{logger['info'](_0xaaee('0x13'),_0x5b08ff,_0xaaee('0x14'));_0x567bbc(_0x5ca2a1[_0xaaee('0x1b')][_0xaaee('0x1a')]);}})[_0xaaee('0x1c')](function(_0x96c51f){logger[_0xaaee('0x18')](_0xaaee('0x13'),_0x5b08ff,_0x96c51f);_0x191cb7(_0x96c51f);});});}exports[_0xaaee('0x1d')]=function(_0x1d4b2e){var _0x2ce472=this;return new Promise(function(_0x4788f7,_0x2680a7){return db[_0xaaee('0x1e')][_0xaaee('0x1f')]({'raw':_0x1d4b2e[_0xaaee('0x20')]?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x21')]===undefined?!![]:![]:!![],'where':_0x1d4b2e['options']?_0x1d4b2e[_0xaaee('0x20')]['where']||null:null,'attributes':_0x1d4b2e[_0xaaee('0x20')]?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x22')]||null:null,'include':_0x1d4b2e['options']?_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x1d4b2e[_0xaaee('0x20')][_0xaaee('0x23')],function(_0x15850b){return{'model':db[_0x15850b[_0xaaee('0x25')]],'as':_0x15850b['as'],'attributes':_0x15850b['attributes'],'include':_0x15850b[_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x15850b['include'],function(_0x1b7b73){return{'model':db[_0x1b7b73['model']],'as':_0x1b7b73['as'],'attributes':_0x1b7b73[_0xaaee('0x22')],'include':_0x1b7b73[_0xaaee('0x23')]?_[_0xaaee('0x24')](_0x1b7b73[_0xaaee('0x23')],function(_0x2e230f){return{'model':db[_0x2e230f[_0xaaee('0x25')]],'as':_0x2e230f['as'],'attributes':_0x2e230f[_0xaaee('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27a272){logger['info'](_0xaaee('0x1d'),_0x1d4b2e);logger[_0xaaee('0x15')](_0xaaee('0x1d'),_0x1d4b2e,JSON['stringify'](_0x27a272));_0x4788f7(_0x27a272);})[_0xaaee('0x1c')](function(_0x28f88a){logger[_0xaaee('0x18')]('ShowWhatsappAccount',_0x28f88a[_0xaaee('0x1a')],_0x1d4b2e);_0x2680a7(_0x2ce472[_0xaaee('0x18')](0x1f4,_0x28f88a['message']));});});}; \ No newline at end of file +var _0xfc8f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model'];(function(_0x188610,_0x48fe4a){var _0x4acec6=function(_0x14a6ea){while(--_0x14a6ea){_0x188610['push'](_0x188610['shift']());}};_0x4acec6(++_0x48fe4a);}(_0xfc8f,0xa0));var _0xffc8=function(_0x43d4f8,_0x50783e){_0x43d4f8=_0x43d4f8-0x0;var _0x1c7b84=_0xfc8f[_0x43d4f8];return _0x1c7b84;};'use strict';var _=require(_0xffc8('0x0'));var util=require(_0xffc8('0x1'));var moment=require(_0xffc8('0x2'));var BPromise=require(_0xffc8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffc8('0x4'));var db=require(_0xffc8('0x5'))['db'];var utils=require(_0xffc8('0x6'));var logger=require(_0xffc8('0x7'))(_0xffc8('0x8'));var config=require(_0xffc8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xffc8('0xa')]['http']({'port':0x232a});config['redis']=_[_0xffc8('0xb')](config[_0xffc8('0xc')],{'host':_0xffc8('0xd'),'port':0x18eb});var socket=require(_0xffc8('0xe'))(new Redis(config['redis']));require(_0xffc8('0xf'))[_0xffc8('0x10')](socket);function respondWithRpcPromise(_0x47df96,_0x4f69f2,_0x59f254){return new BPromise(function(_0x4a1354,_0x21230a){return client[_0xffc8('0x11')](_0x47df96,_0x59f254)[_0xffc8('0x12')](function(_0x10d770){logger[_0xffc8('0x13')](_0xffc8('0x14'),_0x4f69f2,_0xffc8('0x15'));logger[_0xffc8('0x16')](_0xffc8('0x17'),_0x4f69f2,_0xffc8('0x15'),JSON[_0xffc8('0x18')](_0x10d770));if(_0x10d770['error']){if(_0x10d770[_0xffc8('0x19')][_0xffc8('0x1a')]===0x1f4){logger[_0xffc8('0x19')](_0xffc8('0x14'),_0x4f69f2,_0x10d770['error']['message']);return _0x21230a(_0x10d770[_0xffc8('0x19')][_0xffc8('0x1b')]);}logger[_0xffc8('0x19')](_0xffc8('0x14'),_0x4f69f2,_0x10d770[_0xffc8('0x19')]['message']);return _0x4a1354(_0x10d770[_0xffc8('0x19')][_0xffc8('0x1b')]);}else{logger[_0xffc8('0x13')](_0xffc8('0x14'),_0x4f69f2,_0xffc8('0x15'));_0x4a1354(_0x10d770[_0xffc8('0x1c')][_0xffc8('0x1b')]);}})[_0xffc8('0x1d')](function(_0x4b9ac9){logger[_0xffc8('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x4f69f2,_0x4b9ac9);_0x21230a(_0x4b9ac9);});});}exports[_0xffc8('0x1e')]=function(_0x2baba7){var _0x252aab=this;return new Promise(function(_0x106514,_0xc3ad2e){return db[_0xffc8('0x1f')][_0xffc8('0x20')]({'raw':_0x2baba7[_0xffc8('0x21')]?_0x2baba7['options'][_0xffc8('0x22')]===undefined?!![]:![]:!![],'where':_0x2baba7['options']?_0x2baba7[_0xffc8('0x21')][_0xffc8('0x23')]||null:null,'attributes':_0x2baba7['options']?_0x2baba7[_0xffc8('0x21')][_0xffc8('0x24')]||null:null,'include':_0x2baba7[_0xffc8('0x21')]?_0x2baba7[_0xffc8('0x21')][_0xffc8('0x25')]?_['map'](_0x2baba7[_0xffc8('0x21')][_0xffc8('0x25')],function(_0x3beb60){return{'model':db[_0x3beb60['model']],'as':_0x3beb60['as'],'attributes':_0x3beb60['attributes'],'include':_0x3beb60[_0xffc8('0x25')]?_[_0xffc8('0x26')](_0x3beb60[_0xffc8('0x25')],function(_0x1115ae){return{'model':db[_0x1115ae[_0xffc8('0x27')]],'as':_0x1115ae['as'],'attributes':_0x1115ae[_0xffc8('0x24')],'include':_0x1115ae[_0xffc8('0x25')]?_[_0xffc8('0x26')](_0x1115ae[_0xffc8('0x25')],function(_0x48e931){return{'model':db[_0x48e931[_0xffc8('0x27')]],'as':_0x48e931['as'],'attributes':_0x48e931[_0xffc8('0x24')]};}):[]};}):[]};}):[]:[]})[_0xffc8('0x12')](function(_0x393caa){logger[_0xffc8('0x13')](_0xffc8('0x1e'),_0x2baba7);logger[_0xffc8('0x16')](_0xffc8('0x1e'),_0x2baba7,JSON[_0xffc8('0x18')](_0x393caa));_0x106514(_0x393caa);})[_0xffc8('0x1d')](function(_0xcc295){logger[_0xffc8('0x19')](_0xffc8('0x1e'),_0xcc295['message'],_0x2baba7);_0xc3ad2e(_0x252aab[_0xffc8('0x19')](0x1f4,_0xcc295[_0xffc8('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 157044d..e47e6b4 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 _0x9652=['register','whatsappAccount:','./whatsappAccount.events','update','removeListener'];(function(_0x26742c,_0xe241ee){var _0x4d9df4=function(_0x5bf307){while(--_0x5bf307){_0x26742c['push'](_0x26742c['shift']());}};_0x4d9df4(++_0xe241ee);}(_0x9652,0x151));var _0x2965=function(_0x23c217,_0x3aee12){_0x23c217=_0x23c217-0x0;var _0x53fcf8=_0x9652[_0x23c217];return _0x53fcf8;};'use strict';var WhatsappAccountEvents=require(_0x2965('0x0'));var events=['save','remove',_0x2965('0x1')];function createListener(_0x16a646,_0x9e9115){return function(_0x386806){_0x9e9115['emit'](_0x16a646,_0x386806);};}function removeListener(_0xeb300e,_0x54481f){return function(){WhatsappAccountEvents[_0x2965('0x2')](_0xeb300e,_0x54481f);};}exports[_0x2965('0x3')]=function(_0x59e471){for(var _0x383b82=0x0,_0x246780=events['length'];_0x383b82<_0x246780;_0x383b82++){var _0x18932c=events[_0x383b82];var _0xd261d0=createListener(_0x2965('0x4')+_0x18932c,_0x59e471);WhatsappAccountEvents['on'](_0x18932c,_0xd261d0);}}; \ No newline at end of file +var _0x562e=['save','remove','update','removeListener','whatsappAccount:','./whatsappAccount.events'];(function(_0x5ed1e6,_0x49000a){var _0x40ddc3=function(_0x632780){while(--_0x632780){_0x5ed1e6['push'](_0x5ed1e6['shift']());}};_0x40ddc3(++_0x49000a);}(_0x562e,0x131));var _0xe562=function(_0xd31fbc,_0x43222a){_0xd31fbc=_0xd31fbc-0x0;var _0x5c9d58=_0x562e[_0xd31fbc];return _0x5c9d58;};'use strict';var WhatsappAccountEvents=require(_0xe562('0x0'));var events=[_0xe562('0x1'),_0xe562('0x2'),_0xe562('0x3')];function createListener(_0x4fd070,_0x222b3f){return function(_0x3a8a35){_0x222b3f['emit'](_0x4fd070,_0x3a8a35);};}function removeListener(_0x36560e,_0x4ed407){return function(){WhatsappAccountEvents[_0xe562('0x4')](_0x36560e,_0x4ed407);};}exports['register']=function(_0x73418c){for(var _0x32cea0=0x0,_0x507c69=events['length'];_0x32cea0<_0x507c69;_0x32cea0++){var _0x1ccde9=events[_0x32cea0];var _0x52f8e0=createListener(_0xe562('0x5')+_0x1ccde9,_0x73418c);WhatsappAccountEvents['on'](_0x1ccde9,_0x52f8e0);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 93627fe..c901145 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 _0xd2b8=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy'];(function(_0x3ab094,_0x4d101e){var _0x18eaa2=function(_0x4e4cb5){while(--_0x4e4cb5){_0x3ab094['push'](_0x3ab094['shift']());}};_0x18eaa2(++_0x4d101e);}(_0xd2b8,0x1c9));var _0x8d2b=function(_0xc28ffa,_0x6827dd){_0xc28ffa=_0xc28ffa-0x0;var _0xaf3a5=_0xd2b8[_0xc28ffa];return _0xaf3a5;};'use strict';var multer=require(_0x8d2b('0x0'));var util=require(_0x8d2b('0x1'));var path=require(_0x8d2b('0x2'));var timeout=require(_0x8d2b('0x3'));var express=require('express');var router=express[_0x8d2b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d2b('0x5'));var interaction=require(_0x8d2b('0x6'));var config=require(_0x8d2b('0x7'));var controller=require(_0x8d2b('0x8'));router[_0x8d2b('0x9')]('/',auth[_0x8d2b('0xa')](),controller[_0x8d2b('0xb')]);router['get'](_0x8d2b('0xc'),auth['isAuthenticated'](),controller[_0x8d2b('0xd')]);router[_0x8d2b('0xe')]('/',auth[_0x8d2b('0xa')](),controller[_0x8d2b('0xf')]);router['put'](_0x8d2b('0xc'),auth[_0x8d2b('0xa')](),controller['update']);router[_0x8d2b('0x10')](_0x8d2b('0xc'),auth['isAuthenticated'](),controller[_0x8d2b('0x11')]);module[_0x8d2b('0x12')]=router; \ No newline at end of file +var _0xf497=['../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x305c2f,_0x306f52){var _0x1ad4fc=function(_0x39f06e){while(--_0x39f06e){_0x305c2f['push'](_0x305c2f['shift']());}};_0x1ad4fc(++_0x306f52);}(_0xf497,0xa4));var _0x7f49=function(_0x2e845e,_0x36ef70){_0x2e845e=_0x2e845e-0x0;var _0x52c24e=_0xf497[_0x2e845e];return _0x52c24e;};'use strict';var multer=require(_0x7f49('0x0'));var util=require('util');var path=require(_0x7f49('0x1'));var timeout=require(_0x7f49('0x2'));var express=require(_0x7f49('0x3'));var router=express[_0x7f49('0x4')]();var fs_extra=require(_0x7f49('0x5'));var auth=require(_0x7f49('0x6'));var interaction=require(_0x7f49('0x7'));var config=require('../../config/environment');var controller=require(_0x7f49('0x8'));router[_0x7f49('0x9')]('/',auth[_0x7f49('0xa')](),controller[_0x7f49('0xb')]);router[_0x7f49('0x9')](_0x7f49('0xc'),auth['isAuthenticated'](),controller[_0x7f49('0xd')]);router['post']('/',auth[_0x7f49('0xa')](),controller[_0x7f49('0xe')]);router[_0x7f49('0xf')](_0x7f49('0xc'),auth[_0x7f49('0xa')](),controller[_0x7f49('0x10')]);router[_0x7f49('0x11')](_0x7f49('0xc'),auth[_0x7f49('0xa')](),controller[_0x7f49('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b256a73..896abcd 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 _0x8842=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8842,0x1ea));var _0x2884=function(_0x49fffd,_0x534844){_0x49fffd=_0x49fffd-0x0;var _0x4c90ed=_0x8842[_0x49fffd];return _0x4c90ed;};'use strict';var Sequelize=require(_0x2884('0x0'));module[_0x2884('0x1')]={'priority':{'type':Sequelize[_0x2884('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2884('0x3')],'allowNull':![],'defaultValue':_0x2884('0x4')},'appdata':{'type':Sequelize[_0x2884('0x5')]()},'description':{'type':Sequelize[_0x2884('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2884('0x6')}}; \ No newline at end of file +var _0x7a4f=['noop','TEXT','sequelize','exports','STRING'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0x7a4f,0x156));var _0xf7a4=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0x7a4f[_0xe0b81f];return _0x290e5e;};'use strict';var Sequelize=require(_0xf7a4('0x0'));module[_0xf7a4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf7a4('0x2')],'allowNull':![],'defaultValue':_0xf7a4('0x3')},'appdata':{'type':Sequelize[_0xf7a4('0x4')]()},'description':{'type':Sequelize[_0xf7a4('0x2')]},'interval':{'type':Sequelize[_0xf7a4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1806e81..21f9ffe 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 _0xd6f9=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xd6f9[_0x2f3848];return _0x102668;};'use strict';var emlformat=require(_0x9d6f('0x0'));var rimraf=require(_0x9d6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d6f('0x2'));var moment=require(_0x9d6f('0x3'));var BPromise=require(_0x9d6f('0x4'));var Mustache=require(_0x9d6f('0x5'));var util=require('util');var path=require(_0x9d6f('0x6'));var sox=require(_0x9d6f('0x7'));var csv=require(_0x9d6f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d6f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9d6f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9d6f('0xb'));var toCsv=require(_0x9d6f('0x8'));var querystring=require(_0x9d6f('0xc'));var Papa=require(_0x9d6f('0xd'));var Redis=require(_0x9d6f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d6f('0xf'));var logger=require(_0x9d6f('0x10'))(_0x9d6f('0x11'));var utils=require(_0x9d6f('0x12'));var config=require(_0x9d6f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d6f('0x14'))['db'];function respondWithStatusCode(_0x736008,_0x29ce37){_0x29ce37=_0x29ce37||0xcc;return function(_0x2e19a5){if(_0x2e19a5){return _0x736008[_0x9d6f('0x15')](_0x29ce37);}return _0x736008['status'](_0x29ce37)[_0x9d6f('0x16')]();};}function respondWithResult(_0x2da36f,_0x34e8dd){_0x34e8dd=_0x34e8dd||0xc8;return function(_0x3916f1){if(_0x3916f1){return _0x2da36f[_0x9d6f('0x17')](_0x34e8dd)['json'](_0x3916f1);}};}function respondWithFilteredResult(_0x149557,_0x2f927a){return function(_0x41546b){if(_0x41546b){var _0x509713=typeof _0x2f927a['offset']===_0x9d6f('0x18')&&typeof _0x2f927a[_0x9d6f('0x19')]===_0x9d6f('0x18');var _0x251ce5=_0x41546b['count'];var _0x433555=_0x509713?0x0:_0x2f927a[_0x9d6f('0x1a')];var _0x556ac7=_0x509713?_0x41546b[_0x9d6f('0x1b')]:_0x2f927a[_0x9d6f('0x1a')]+_0x2f927a[_0x9d6f('0x19')];var _0x4e9598;if(_0x556ac7>=_0x251ce5){_0x556ac7=_0x251ce5;_0x4e9598=0xc8;}else{_0x4e9598=0xce;}_0x149557[_0x9d6f('0x17')](_0x4e9598);return _0x149557[_0x9d6f('0x1c')](_0x9d6f('0x1d'),_0x433555+'-'+_0x556ac7+'/'+_0x251ce5)['json'](_0x41546b);}return null;};}function patchUpdates(_0x3ce2ca){return function(_0x339b40){try{jsonpatch[_0x9d6f('0x1e')](_0x339b40,_0x3ce2ca,!![]);}catch(_0x9fa1b5){return BPromise[_0x9d6f('0x1f')](_0x9fa1b5);}return _0x339b40['save']();};}function saveUpdates(_0x770eab,_0x312de5){return function(_0x3e9ad3){if(_0x3e9ad3){return _0x3e9ad3[_0x9d6f('0x20')](_0x770eab)['then'](function(_0x16175d){return _0x16175d;});}return null;};}function removeEntity(_0x21f538,_0x367d48){return function(_0x2a13dc){if(_0x2a13dc){return _0x2a13dc[_0x9d6f('0x21')]()[_0x9d6f('0x22')](function(){_0x21f538[_0x9d6f('0x17')](0xcc)[_0x9d6f('0x16')]();});}};}function handleEntityNotFound(_0x6d51d8,_0x10ec7a){return function(_0x233c17){if(!_0x233c17){_0x6d51d8['sendStatus'](0x194);}return _0x233c17;};}function handleError(_0x6b51a5,_0x44aee2){_0x44aee2=_0x44aee2||0x1f4;return function(_0x3c2714){logger['error'](_0x3c2714[_0x9d6f('0x23')]);if(_0x3c2714['name']){delete _0x3c2714[_0x9d6f('0x24')];}_0x6b51a5[_0x9d6f('0x17')](_0x44aee2)[_0x9d6f('0x25')](_0x3c2714);};}exports[_0x9d6f('0x26')]=function(_0x4b25a5,_0x4f343e){var _0x51ade6={},_0x545b0c={},_0x162126={'count':0x0,'rows':[]};var _0x410c8c=_[_0x9d6f('0x27')](db[_0x9d6f('0x28')][_0x9d6f('0x29')],function(_0x489185){return{'name':_0x489185[_0x9d6f('0x2a')],'type':_0x489185[_0x9d6f('0x2b')][_0x9d6f('0x2c')]};});_0x545b0c[_0x9d6f('0x2d')]=_[_0x9d6f('0x27')](_0x410c8c,_0x9d6f('0x24'));_0x545b0c[_0x9d6f('0x2e')]=_[_0x9d6f('0x2f')](_0x4b25a5[_0x9d6f('0x2e')]);_0x545b0c[_0x9d6f('0x30')]=_[_0x9d6f('0x31')](_0x545b0c[_0x9d6f('0x2d')],_0x545b0c[_0x9d6f('0x2e')]);_0x51ade6[_0x9d6f('0x32')]=_['intersection'](_0x545b0c[_0x9d6f('0x2d')],qs['fields'](_0x4b25a5['query'][_0x9d6f('0x33')]));_0x51ade6[_0x9d6f('0x32')]=_0x51ade6[_0x9d6f('0x32')][_0x9d6f('0x34')]?_0x51ade6[_0x9d6f('0x32')]:_0x545b0c[_0x9d6f('0x2d')];if(!_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x35')](_0x9d6f('0x36'))){_0x51ade6[_0x9d6f('0x19')]=qs[_0x9d6f('0x19')](_0x4b25a5[_0x9d6f('0x2e')]['limit']);_0x51ade6[_0x9d6f('0x1a')]=qs[_0x9d6f('0x1a')](_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x1a')]);}_0x51ade6[_0x9d6f('0x37')]=qs[_0x9d6f('0x38')](_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x38')]);_0x51ade6['where']=qs[_0x9d6f('0x30')](_[_0x9d6f('0x39')](_0x4b25a5['query'],_0x545b0c[_0x9d6f('0x30')]),_0x410c8c);if(_0x4b25a5['query'][_0x9d6f('0x3a')]){_0x51ade6[_0x9d6f('0x3b')]=_['merge'](_0x51ade6[_0x9d6f('0x3b')],{'$or':_[_0x9d6f('0x27')](_0x410c8c,function(_0x39ad4b){if(_0x39ad4b['type']!==_0x9d6f('0x3c')){var _0x54c8dc={};_0x54c8dc[_0x39ad4b[_0x9d6f('0x24')]]={'$like':'%'+_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x3a')]+'%'};return _0x54c8dc;}})});}_0x51ade6=_[_0x9d6f('0x3d')]({},_0x51ade6,_0x4b25a5[_0x9d6f('0x3e')]);var _0x1d6c08={'where':_0x51ade6['where']};return db[_0x9d6f('0x28')][_0x9d6f('0x1b')](_0x1d6c08)['then'](function(_0x2fb805){_0x162126[_0x9d6f('0x1b')]=_0x2fb805;if(_0x4b25a5[_0x9d6f('0x2e')][_0x9d6f('0x3f')]){_0x51ade6[_0x9d6f('0x40')]=[{'all':!![]}];}return db[_0x9d6f('0x28')][_0x9d6f('0x41')](_0x51ade6);})[_0x9d6f('0x22')](function(_0x3a19f8){_0x162126[_0x9d6f('0x42')]=_0x3a19f8;return _0x162126;})[_0x9d6f('0x22')](respondWithFilteredResult(_0x4f343e,_0x51ade6))['catch'](handleError(_0x4f343e,null));};exports['show']=function(_0x254703,_0x4992cd){var _0x175b80={'raw':!![],'where':{'id':_0x254703[_0x9d6f('0x43')]['id']}},_0x5602f9={};_0x5602f9['model']=_[_0x9d6f('0x2f')](db['WhatsappApplication'][_0x9d6f('0x29')]);_0x5602f9['query']=_['keys'](_0x254703['query']);_0x5602f9[_0x9d6f('0x30')]=_[_0x9d6f('0x31')](_0x5602f9['model'],_0x5602f9[_0x9d6f('0x2e')]);_0x175b80[_0x9d6f('0x32')]=_['intersection'](_0x5602f9[_0x9d6f('0x2d')],qs[_0x9d6f('0x33')](_0x254703[_0x9d6f('0x2e')][_0x9d6f('0x33')]));_0x175b80[_0x9d6f('0x32')]=_0x175b80['attributes'][_0x9d6f('0x34')]?_0x175b80[_0x9d6f('0x32')]:_0x5602f9[_0x9d6f('0x2d')];if(_0x254703[_0x9d6f('0x2e')][_0x9d6f('0x3f')]){_0x175b80[_0x9d6f('0x40')]=[{'all':!![]}];}_0x175b80=_[_0x9d6f('0x3d')]({},_0x175b80,_0x254703[_0x9d6f('0x3e')]);return db[_0x9d6f('0x28')]['find'](_0x175b80)[_0x9d6f('0x22')](handleEntityNotFound(_0x4992cd,null))[_0x9d6f('0x22')](respondWithResult(_0x4992cd,null))[_0x9d6f('0x44')](handleError(_0x4992cd,null));};exports[_0x9d6f('0x45')]=function(_0x17ca02,_0x12611c){return db['WhatsappApplication'][_0x9d6f('0x45')](_0x17ca02[_0x9d6f('0x46')],{})[_0x9d6f('0x22')](respondWithResult(_0x12611c,0xc9))['catch'](handleError(_0x12611c,null));};exports['update']=function(_0x42c209,_0x4ef463){if(_0x42c209[_0x9d6f('0x46')]['id']){delete _0x42c209[_0x9d6f('0x46')]['id'];}return db[_0x9d6f('0x28')][_0x9d6f('0x47')]({'where':{'id':_0x42c209[_0x9d6f('0x43')]['id']}})[_0x9d6f('0x22')](handleEntityNotFound(_0x4ef463,null))[_0x9d6f('0x22')](saveUpdates(_0x42c209[_0x9d6f('0x46')],null))[_0x9d6f('0x22')](respondWithResult(_0x4ef463,null))[_0x9d6f('0x44')](handleError(_0x4ef463,null));};exports[_0x9d6f('0x21')]=function(_0x388d31,_0x40842a){return db[_0x9d6f('0x28')][_0x9d6f('0x47')]({'where':{'id':_0x388d31[_0x9d6f('0x43')]['id']}})[_0x9d6f('0x22')](handleEntityNotFound(_0x40842a,null))[_0x9d6f('0x22')](removeEntity(_0x40842a,null))[_0x9d6f('0x44')](handleError(_0x40842a,null));}; \ No newline at end of file +var _0xc14a=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','WhatsappApplication','findAll','rows','show','params','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','map','query','keys','filters','model'];(function(_0xd2bf1f,_0x2b84fe){var _0x1d32eb=function(_0x1e5e38){while(--_0x1e5e38){_0xd2bf1f['push'](_0xd2bf1f['shift']());}};_0x1d32eb(++_0x2b84fe);}(_0xc14a,0xa9));var _0xac14=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc14a[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0xac14('0x0'));var rimraf=require(_0xac14('0x1'));var zipdir=require(_0xac14('0x2'));var jsonpatch=require(_0xac14('0x3'));var rp=require(_0xac14('0x4'));var moment=require('moment');var BPromise=require(_0xac14('0x5'));var Mustache=require(_0xac14('0x6'));var util=require('util');var path=require(_0xac14('0x7'));var sox=require('sox');var csv=require(_0xac14('0x8'));var ejs=require(_0xac14('0x9'));var fs=require('fs');var fs_extra=require(_0xac14('0xa'));var _=require('lodash');var squel=require(_0xac14('0xb'));var crypto=require(_0xac14('0xc'));var jsforce=require(_0xac14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac14('0x8'));var querystring=require(_0xac14('0xe'));var Papa=require(_0xac14('0xf'));var Redis=require(_0xac14('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac14('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac14('0x12'));var logger=require(_0xac14('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xac14('0x14'));var licenseUtil=require(_0xac14('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d522,_0x394952){_0x394952=_0x394952||0xcc;return function(_0x5920f7){if(_0x5920f7){return _0x11d522[_0xac14('0x16')](_0x394952);}return _0x11d522['status'](_0x394952)[_0xac14('0x17')]();};}function respondWithResult(_0x3a171d,_0x44e80d){_0x44e80d=_0x44e80d||0xc8;return function(_0x5a80ed){if(_0x5a80ed){return _0x3a171d['status'](_0x44e80d)[_0xac14('0x18')](_0x5a80ed);}};}function respondWithFilteredResult(_0x5c00df,_0xe50537){return function(_0x497be2){if(_0x497be2){var _0x270284=typeof _0xe50537[_0xac14('0x19')]===_0xac14('0x1a')&&typeof _0xe50537[_0xac14('0x1b')]===_0xac14('0x1a');var _0x4d7f22=_0x497be2[_0xac14('0x1c')];var _0x219ee6=_0x270284?0x0:_0xe50537[_0xac14('0x19')];var _0x1682b1=_0x270284?_0x497be2[_0xac14('0x1c')]:_0xe50537[_0xac14('0x19')]+_0xe50537[_0xac14('0x1b')];var _0x572d08;if(_0x1682b1>=_0x4d7f22){_0x1682b1=_0x4d7f22;_0x572d08=0xc8;}else{_0x572d08=0xce;}_0x5c00df[_0xac14('0x1d')](_0x572d08);return _0x5c00df[_0xac14('0x1e')](_0xac14('0x1f'),_0x219ee6+'-'+_0x1682b1+'/'+_0x4d7f22)[_0xac14('0x18')](_0x497be2);}return null;};}function patchUpdates(_0x14b2a0){return function(_0x52d9d2){try{jsonpatch['apply'](_0x52d9d2,_0x14b2a0,!![]);}catch(_0x1cbb67){return BPromise[_0xac14('0x20')](_0x1cbb67);}return _0x52d9d2['save']();};}function saveUpdates(_0x44a533,_0x492f37){return function(_0x528406){if(_0x528406){return _0x528406['update'](_0x44a533)[_0xac14('0x21')](function(_0x4c6580){return _0x4c6580;});}return null;};}function removeEntity(_0x1b863e,_0x8e5979){return function(_0x272b46){if(_0x272b46){return _0x272b46[_0xac14('0x22')]()['then'](function(){_0x1b863e[_0xac14('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x186a10,_0xa2c069){return function(_0x536eb3){if(!_0x536eb3){_0x186a10[_0xac14('0x16')](0x194);}return _0x536eb3;};}function handleError(_0x34f641,_0x3d2eeb){_0x3d2eeb=_0x3d2eeb||0x1f4;return function(_0x1c581b){logger[_0xac14('0x23')](_0x1c581b[_0xac14('0x24')]);if(_0x1c581b['name']){delete _0x1c581b[_0xac14('0x25')];}_0x34f641['status'](_0x3d2eeb)['send'](_0x1c581b);};}exports['index']=function(_0x23a5b3,_0x25b07e){var _0x2f6914={},_0x53584e={},_0x4b72e0={'count':0x0,'rows':[]};var _0x506837=_['map'](db['WhatsappApplication'][_0xac14('0x26')],function(_0x568024){return{'name':_0x568024[_0xac14('0x27')],'type':_0x568024[_0xac14('0x28')][_0xac14('0x29')]};});_0x53584e['model']=_[_0xac14('0x2a')](_0x506837,'name');_0x53584e[_0xac14('0x2b')]=_[_0xac14('0x2c')](_0x23a5b3[_0xac14('0x2b')]);_0x53584e[_0xac14('0x2d')]=_['intersection'](_0x53584e[_0xac14('0x2e')],_0x53584e[_0xac14('0x2b')]);_0x2f6914[_0xac14('0x2f')]=_[_0xac14('0x30')](_0x53584e[_0xac14('0x2e')],qs[_0xac14('0x31')](_0x23a5b3['query']['fields']));_0x2f6914['attributes']=_0x2f6914[_0xac14('0x2f')][_0xac14('0x32')]?_0x2f6914[_0xac14('0x2f')]:_0x53584e[_0xac14('0x2e')];if(!_0x23a5b3['query'][_0xac14('0x33')](_0xac14('0x34'))){_0x2f6914[_0xac14('0x1b')]=qs['limit'](_0x23a5b3[_0xac14('0x2b')][_0xac14('0x1b')]);_0x2f6914['offset']=qs['offset'](_0x23a5b3['query'][_0xac14('0x19')]);}_0x2f6914[_0xac14('0x35')]=qs[_0xac14('0x36')](_0x23a5b3[_0xac14('0x2b')][_0xac14('0x36')]);_0x2f6914[_0xac14('0x37')]=qs[_0xac14('0x2d')](_[_0xac14('0x38')](_0x23a5b3['query'],_0x53584e[_0xac14('0x2d')]),_0x506837);if(_0x23a5b3[_0xac14('0x2b')]['filter']){_0x2f6914[_0xac14('0x37')]=_[_0xac14('0x39')](_0x2f6914[_0xac14('0x37')],{'$or':_[_0xac14('0x2a')](_0x506837,function(_0x561a70){if(_0x561a70[_0xac14('0x28')]!==_0xac14('0x3a')){var _0x296644={};_0x296644[_0x561a70[_0xac14('0x25')]]={'$like':'%'+_0x23a5b3[_0xac14('0x2b')]['filter']+'%'};return _0x296644;}})});}_0x2f6914=_[_0xac14('0x39')]({},_0x2f6914,_0x23a5b3[_0xac14('0x3b')]);var _0x116a5a={'where':_0x2f6914[_0xac14('0x37')]};return db['WhatsappApplication'][_0xac14('0x1c')](_0x116a5a)['then'](function(_0x35f359){_0x4b72e0[_0xac14('0x1c')]=_0x35f359;if(_0x23a5b3[_0xac14('0x2b')][_0xac14('0x3c')]){_0x2f6914[_0xac14('0x3d')]=[{'all':!![]}];}return db[_0xac14('0x3e')][_0xac14('0x3f')](_0x2f6914);})['then'](function(_0x375712){_0x4b72e0[_0xac14('0x40')]=_0x375712;return _0x4b72e0;})[_0xac14('0x21')](respondWithFilteredResult(_0x25b07e,_0x2f6914))['catch'](handleError(_0x25b07e,null));};exports[_0xac14('0x41')]=function(_0x46b7ea,_0x515b58){var _0x160621={'raw':!![],'where':{'id':_0x46b7ea[_0xac14('0x42')]['id']}},_0x34932e={};_0x34932e[_0xac14('0x2e')]=_['keys'](db[_0xac14('0x3e')][_0xac14('0x26')]);_0x34932e[_0xac14('0x2b')]=_[_0xac14('0x2c')](_0x46b7ea['query']);_0x34932e['filters']=_[_0xac14('0x30')](_0x34932e[_0xac14('0x2e')],_0x34932e[_0xac14('0x2b')]);_0x160621[_0xac14('0x2f')]=_[_0xac14('0x30')](_0x34932e['model'],qs[_0xac14('0x31')](_0x46b7ea[_0xac14('0x2b')]['fields']));_0x160621[_0xac14('0x2f')]=_0x160621[_0xac14('0x2f')]['length']?_0x160621[_0xac14('0x2f')]:_0x34932e['model'];if(_0x46b7ea[_0xac14('0x2b')][_0xac14('0x3c')]){_0x160621[_0xac14('0x3d')]=[{'all':!![]}];}_0x160621=_[_0xac14('0x39')]({},_0x160621,_0x46b7ea[_0xac14('0x3b')]);return db[_0xac14('0x3e')][_0xac14('0x43')](_0x160621)[_0xac14('0x21')](handleEntityNotFound(_0x515b58,null))[_0xac14('0x21')](respondWithResult(_0x515b58,null))[_0xac14('0x44')](handleError(_0x515b58,null));};exports[_0xac14('0x45')]=function(_0x43d34e,_0x1ba97c){return db['WhatsappApplication'][_0xac14('0x45')](_0x43d34e[_0xac14('0x46')],{})[_0xac14('0x21')](respondWithResult(_0x1ba97c,0xc9))[_0xac14('0x44')](handleError(_0x1ba97c,null));};exports[_0xac14('0x47')]=function(_0x19b9a2,_0x24764b){if(_0x19b9a2[_0xac14('0x46')]['id']){delete _0x19b9a2[_0xac14('0x46')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x19b9a2[_0xac14('0x42')]['id']}})[_0xac14('0x21')](handleEntityNotFound(_0x24764b,null))[_0xac14('0x21')](saveUpdates(_0x19b9a2['body'],null))[_0xac14('0x21')](respondWithResult(_0x24764b,null))[_0xac14('0x44')](handleError(_0x24764b,null));};exports[_0xac14('0x22')]=function(_0x5d817a,_0x33b158){return db[_0xac14('0x3e')]['find']({'where':{'id':_0x5d817a[_0xac14('0x42')]['id']}})[_0xac14('0x21')](handleEntityNotFound(_0x33b158,null))[_0xac14('0x21')](removeEntity(_0x33b158,null))['catch'](handleError(_0x33b158,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e3178a8..d73919f 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 _0x3ee5=['define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x128815,_0x294754){_0x128815=_0x128815-0x0;var _0x271bf9=_0x3ee5[_0x128815];return _0x271bf9;};'use strict';var _=require('lodash');var util=require(_0x53ee('0x0'));var logger=require(_0x53ee('0x1'))('api');var moment=require(_0x53ee('0x2'));var BPromise=require(_0x53ee('0x3'));var rp=require(_0x53ee('0x4'));var fs=require('fs');var path=require(_0x53ee('0x5'));var rimraf=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var attributes=require(_0x53ee('0x8'));module[_0x53ee('0x9')]=function(_0x343bbb,_0x16ad68){return _0x343bbb[_0x53ee('0xa')]('WhatsappApplication',attributes,{'tableName':_0x53ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x53ee('0xc'),'collate':_0x53ee('0xd')});}; \ No newline at end of file +var _0x6334=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4'];(function(_0x2a3efd,_0x5a516a){var _0x1ec226=function(_0x1f5996){while(--_0x1f5996){_0x2a3efd['push'](_0x2a3efd['shift']());}};_0x1ec226(++_0x5a516a);}(_0x6334,0x119));var _0x4633=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x6334[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));module[_0x4633('0xa')]=function(_0x6493dc,_0x175e14){return _0x6493dc['define'](_0x4633('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4633('0xc'),'collate':_0x4633('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 884b3eb..0d8a2a1 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 _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x783834,_0x38c810){var _0x22055f=function(_0x6a6998){while(--_0x6a6998){_0x783834['push'](_0x783834['shift']());}};_0x22055f(++_0x38c810);}(_0x2d17,0x17e));var _0x72d1=function(_0x2bf5df,_0x39eefa){_0x2bf5df=_0x2bf5df-0x0;var _0x56dd38=_0x2d17[_0x2bf5df];return _0x56dd38;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x008c,0x188));var _0xc008=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x008c[_0x4a3acd];return _0x3efdaa;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b9735d6..da7cd81 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 _0x3831=['whatsappinteraction:destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete'];(function(_0x1599fd,_0x40b96d){var _0x3a81b6=function(_0x292fdd){while(--_0x292fdd){_0x1599fd['push'](_0x1599fd['shift']());}};_0x3a81b6(++_0x40b96d);}(_0x3831,0x14c));var _0x1383=function(_0x49225d,_0x312d6c){_0x49225d=_0x49225d-0x0;var _0x2c228f=_0x3831[_0x49225d];return _0x2c228f;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0x8')](_0x1383('0xd'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0x8')](_0x1383('0xf'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);router['post']('/',auth[_0x1383('0x9')](),controller[_0x1383('0x11')]);router[_0x1383('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1383('0x13')]);router[_0x1383('0x12')](_0x1383('0x14'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x17')),controller[_0x1383('0x18')]);router['put'](_0x1383('0xb'),auth[_0x1383('0x9')](),interaction[_0x1383('0x15')](_0x1383('0x16'),_0x1383('0x19')),controller[_0x1383('0x1a')]);router[_0x1383('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0x1383('0x15')]('whatsapp',_0x1383('0x1c')),controller['destroy']);router['delete']('/:id/tags',auth[_0x1383('0x9')](),controller['removeTags']);module[_0x1383('0x1d')]=router; \ No newline at end of file +var _0x9206=['whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x48186a,_0x228fb5){var _0x57fdd1=function(_0x58a273){while(--_0x58a273){_0x48186a['push'](_0x48186a['shift']());}};_0x57fdd1(++_0x228fb5);}(_0x9206,0x176));var _0x6920=function(_0x2678c9,_0x57bd25){_0x2678c9=_0x2678c9-0x0;var _0x6b9c15=_0x9206[_0x2678c9];return _0x6b9c15;};'use strict';var multer=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var path=require(_0x6920('0x2'));var timeout=require(_0x6920('0x3'));var express=require(_0x6920('0x4'));var router=express[_0x6920('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6920('0x6'));var config=require(_0x6920('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0x6920('0x8')](),controller['index']);router[_0x6920('0x9')](_0x6920('0xa'),auth[_0x6920('0x8')](),controller[_0x6920('0xb')]);router['get']('/:id',auth[_0x6920('0x8')](),controller[_0x6920('0xc')]);router[_0x6920('0x9')](_0x6920('0xd'),auth[_0x6920('0x8')](),controller[_0x6920('0xe')]);router[_0x6920('0x9')](_0x6920('0xf'),auth[_0x6920('0x8')](),controller[_0x6920('0x10')]);router[_0x6920('0x11')]('/',auth[_0x6920('0x8')](),controller[_0x6920('0x12')]);router['post']('/:id/messages',auth[_0x6920('0x8')](),controller[_0x6920('0x13')]);router['post'](_0x6920('0x14'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x17')),controller['addTags']);router[_0x6920('0x18')](_0x6920('0x19'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x1a')),controller[_0x6920('0x1b')]);router[_0x6920('0x1c')](_0x6920('0x19'),auth[_0x6920('0x8')](),interaction[_0x6920('0x15')](_0x6920('0x16'),_0x6920('0x1d')),controller[_0x6920('0x1e')]);router[_0x6920('0x1c')]('/:id/tags',auth[_0x6920('0x8')](),controller[_0x6920('0x1f')]);module[_0x6920('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 83147a1..97a88ea 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 _0x1224=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1224,0x10d));var _0x4122=function(_0x4547d5,_0x91d898){_0x4547d5=_0x4547d5-0x0;var _0x81ad1f=_0x1224[_0x4547d5];return _0x81ad1f;};'use strict';var Sequelize=require(_0x4122('0x0'));var moment=require(_0x4122('0x1'));module[_0x4122('0x2')]={'closed':{'type':Sequelize[_0x4122('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4122('0x4')]},'disposition':{'type':Sequelize[_0x4122('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4122('0x5')]},'note':{'type':Sequelize[_0x4122('0x5')]},'phone':{'type':Sequelize[_0x4122('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4122('0x6')]('in',_0x4122('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4122('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4122('0x6')]('in',_0x4122('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4122('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf71=['ENUM','out','sequelize','moment','exports','BOOLEAN','STRING','DATE'];(function(_0x31be33,_0x55945d){var _0x1ae217=function(_0x33fb3e){while(--_0x33fb3e){_0x31be33['push'](_0x31be33['shift']());}};_0x1ae217(++_0x55945d);}(_0xcf71,0xba));var _0x1cf7=function(_0x7f5123,_0x3062c5){_0x7f5123=_0x7f5123-0x0;var _0x10a02a=_0xcf71[_0x7f5123];return _0x10a02a;};'use strict';var Sequelize=require(_0x1cf7('0x0'));var moment=require(_0x1cf7('0x1'));module[_0x1cf7('0x2')]={'closed':{'type':Sequelize[_0x1cf7('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1cf7('0x4')]},'secondDisposition':{'type':Sequelize[_0x1cf7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1cf7('0x4')]},'note':{'type':Sequelize[_0x1cf7('0x4')]},'phone':{'type':Sequelize[_0x1cf7('0x4')]},'read1stAt':{'type':Sequelize[_0x1cf7('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x1cf7('0x6')]('in',_0x1cf7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cf7('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x1cf7('0x6')]('in',_0x1cf7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1cf7('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index a310b55..bc0a690 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 _0x0f8d=['out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','key','findAll','whatsapp','query','user','show','model','keys','filters','intersection','attributes','fields','includeAll','include','options','catch','create','update','body','find','params','destroy','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','spread','color','emit','removeTags','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','secret','read','WhatsappAccount','Owner','fullname','get','mkdirSync','Whatsapp','Account','N.A.','createdAt','toString','closed','closedAt','disposition','basename','direction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f8d,0x185));var _0xd0f8=function(_0x71e017,_0x550bc2){_0x71e017=_0x71e017-0x0;var _0x24fe13=_0x0f8d[_0x71e017];return _0x24fe13;};'use strict';var rimraf=require(_0xd0f8('0x0'));var zipdir=require(_0xd0f8('0x1'));var moment=require(_0xd0f8('0x2'));var BPromise=require('bluebird');var util=require(_0xd0f8('0x3'));var path=require(_0xd0f8('0x4'));var ejs=require(_0xd0f8('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xd0f8('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xd0f8('0x7'));var pdf=require(_0xd0f8('0x8'));var logger=require(_0xd0f8('0x9'))(_0xd0f8('0xa'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xd0f8('0xb')]=_[_0xd0f8('0xc')](config['redis'],{'host':_0xd0f8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd0f8('0xb')]));require(_0xd0f8('0xe'))['register'](socket);function respondWithStatusCode(_0x9537a5,_0x137971){_0x137971=_0x137971||0xcc;return function(_0x1d7941){if(_0x1d7941){return _0x9537a5[_0xd0f8('0xf')](_0x137971);}return _0x9537a5[_0xd0f8('0x10')](_0x137971)[_0xd0f8('0x11')]();};}function respondWithResult(_0x5204ba,_0x5c5da2){_0x5c5da2=_0x5c5da2||0xc8;return function(_0x3de794){if(_0x3de794){return _0x5204ba[_0xd0f8('0x10')](_0x5c5da2)[_0xd0f8('0x12')](_0x3de794);}};}function respondWithFilteredResult(_0x54f7e8,_0x336f42){return function(_0x261092){if(_0x261092){var _0x321281=typeof _0x336f42[_0xd0f8('0x13')]===_0xd0f8('0x14')&&typeof _0x336f42['limit']===_0xd0f8('0x14');var _0x22d53e=_0x261092[_0xd0f8('0x15')];var _0x37f18e=_0x321281?0x0:_0x336f42[_0xd0f8('0x13')];var _0x36c1ca=_0x321281?_0x261092[_0xd0f8('0x15')]:_0x336f42[_0xd0f8('0x13')]+_0x336f42[_0xd0f8('0x16')];var _0x530767;if(_0x36c1ca>=_0x22d53e){_0x36c1ca=_0x22d53e;_0x530767=0xc8;}else{_0x530767=0xce;}_0x54f7e8[_0xd0f8('0x10')](_0x530767);return _0x54f7e8[_0xd0f8('0x17')](_0xd0f8('0x18'),_0x37f18e+'-'+_0x36c1ca+'/'+_0x22d53e)[_0xd0f8('0x12')](_0x261092);}return null;};}function saveUpdates(_0xe0c06b){return function(_0x45ef96){if(_0x45ef96){return _0x45ef96['update'](_0xe0c06b)[_0xd0f8('0x19')](function(_0x21b65c){return _0x21b65c;});}return null;};}function removeEntity(_0x1c0dc6){return function(_0x4f46d4){if(_0x4f46d4){return _0x4f46d4['destroy']()[_0xd0f8('0x19')](function(){_0x1c0dc6[_0xd0f8('0x10')](0xcc)[_0xd0f8('0x11')]();});}};}function handleEntityNotFound(_0x26f8d3){return function(_0x76e7c1){if(!_0x76e7c1){_0x26f8d3[_0xd0f8('0xf')](0x194);}return _0x76e7c1;};}function handleError(_0x54d7e0,_0x30bb25){_0x30bb25=_0x30bb25||0x1f4;return function(_0x2d632d){logger[_0xd0f8('0x1a')](_0x2d632d[_0xd0f8('0x1b')]);if(_0x2d632d[_0xd0f8('0x1c')]){delete _0x2d632d[_0xd0f8('0x1c')];}_0x54d7e0[_0xd0f8('0x10')](_0x30bb25)[_0xd0f8('0x1d')](_0x2d632d);};}exports[_0xd0f8('0x1e')]=function(_0x2d44d2,_0x3af6f5){var _0x151a09={};var _0x181f12=_['map'](db[_0xd0f8('0x1f')][_0xd0f8('0x20')],function(_0x1c8c28){return{'name':_0x1c8c28[_0xd0f8('0x21')],'type':_0x1c8c28['type'][_0xd0f8('0x22')]};});_0x151a09=qs['getOptions'](_0x181f12,_0x2d44d2);return interaction[_0xd0f8('0x23')](_0xd0f8('0x24'),_0x2d44d2[_0xd0f8('0x25')],_0x2d44d2[_0xd0f8('0x26')],_0x151a09,_0x181f12)[_0xd0f8('0x19')](respondWithFilteredResult(_0x3af6f5,_0x151a09))['catch'](handleError(_0x3af6f5,null));};exports[_0xd0f8('0x27')]=function(_0x45730a,_0x571b5f){var _0xea46cf={'raw':![],'where':{'id':_0x45730a['params']['id']}},_0x5c9ced={};_0x5c9ced[_0xd0f8('0x28')]=_[_0xd0f8('0x29')](db[_0xd0f8('0x1f')][_0xd0f8('0x20')]);_0x5c9ced[_0xd0f8('0x25')]=_['keys'](_0x45730a[_0xd0f8('0x25')]);_0x5c9ced[_0xd0f8('0x2a')]=_[_0xd0f8('0x2b')](_0x5c9ced['model'],_0x5c9ced[_0xd0f8('0x25')]);_0xea46cf[_0xd0f8('0x2c')]=_['intersection'](_0x5c9ced[_0xd0f8('0x28')],qs[_0xd0f8('0x2d')](_0x45730a['query'][_0xd0f8('0x2d')]));_0xea46cf[_0xd0f8('0x2c')]=_0xea46cf[_0xd0f8('0x2c')]['length']?_0xea46cf[_0xd0f8('0x2c')]:_0x5c9ced[_0xd0f8('0x28')];if(_0x45730a[_0xd0f8('0x25')][_0xd0f8('0x2e')]){_0xea46cf[_0xd0f8('0x2f')]=[{'all':!![]}];}_0xea46cf=_['merge']({},_0xea46cf,_0x45730a[_0xd0f8('0x30')]);return db[_0xd0f8('0x1f')]['find'](_0xea46cf)[_0xd0f8('0x19')](handleEntityNotFound(_0x571b5f,null))[_0xd0f8('0x19')](respondWithResult(_0x571b5f,null))[_0xd0f8('0x31')](handleError(_0x571b5f,null));};exports[_0xd0f8('0x32')]=function(_0x5763f8,_0x1926f8){return db[_0xd0f8('0x1f')][_0xd0f8('0x32')](_0x5763f8['body'],{})[_0xd0f8('0x19')](respondWithResult(_0x1926f8,0xc9))[_0xd0f8('0x31')](handleError(_0x1926f8,null));};exports[_0xd0f8('0x33')]=function(_0x2ab265,_0x17c2ee){if(_0x2ab265['body']['id']){delete _0x2ab265[_0xd0f8('0x34')]['id'];}return db['WhatsappInteraction'][_0xd0f8('0x35')]({'where':{'id':_0x2ab265[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x17c2ee,null))[_0xd0f8('0x19')](saveUpdates(_0x2ab265['body'],null))[_0xd0f8('0x19')](respondWithResult(_0x17c2ee,null))[_0xd0f8('0x31')](handleError(_0x17c2ee,null));};exports[_0xd0f8('0x37')]=function(_0x9f3f9d,_0x160ce8){return db[_0xd0f8('0x1f')]['find']({'where':{'id':_0x9f3f9d[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x160ce8,null))[_0xd0f8('0x19')](removeEntity(_0x160ce8,null))['catch'](handleError(_0x160ce8,null));};exports[_0xd0f8('0x38')]=function(_0x2f2b43,_0x3d933c){return db['WhatsappInteraction'][_0xd0f8('0x38')]()[_0xd0f8('0x19')](respondWithResult(_0x3d933c,null))[_0xd0f8('0x31')](handleError(_0x3d933c,null));};exports[_0xd0f8('0x39')]=function(_0xd1306,_0x46d281){return db[_0xd0f8('0x3a')][_0xd0f8('0x35')]({'where':{'id':_0xd1306[_0xd0f8('0x36')]['id']}})['then'](handleEntityNotFound(_0x46d281,null))['then'](function(_0x4aeb3d){if(_0x4aeb3d){return _0x4aeb3d['addMessage'](_0xd1306[_0xd0f8('0x34')]['ids'],_[_0xd0f8('0x3b')](_0xd1306[_0xd0f8('0x34')],[_0xd0f8('0x3c'),'id'])||{});}})[_0xd0f8('0x19')](respondWithResult(_0x46d281,null))[_0xd0f8('0x31')](handleError(_0x46d281,null));};exports[_0xd0f8('0x3d')]=function(_0x39a461,_0x24ee18){var _0x5ec608={'raw':![],'where':{}};var _0x55d933={};var _0x42d8fa={'count':0x0,'rows':[]};return db[_0xd0f8('0x1f')][_0xd0f8('0x3e')]({'where':{'id':_0x39a461[_0xd0f8('0x36')]['id']}})[_0xd0f8('0x19')](handleEntityNotFound(_0x24ee18,null))[_0xd0f8('0x19')](function(_0x4c7251){if(_0x4c7251){_0x55d933[_0xd0f8('0x28')]=_[_0xd0f8('0x29')](db[_0xd0f8('0x3a')][_0xd0f8('0x20')]);_0x55d933['query']=_[_0xd0f8('0x29')](_0x39a461[_0xd0f8('0x25')]);_0x55d933[_0xd0f8('0x2a')]=_[_0xd0f8('0x2b')](_0x55d933[_0xd0f8('0x28')],_0x55d933[_0xd0f8('0x25')]);_0x5ec608[_0xd0f8('0x2c')]=_[_0xd0f8('0x2b')](_0x55d933[_0xd0f8('0x28')],qs[_0xd0f8('0x2d')](_0x39a461['query'][_0xd0f8('0x2d')]));_0x5ec608['attributes']=_0x5ec608[_0xd0f8('0x2c')][_0xd0f8('0x3f')]?_0x5ec608[_0xd0f8('0x2c')]:_0x55d933['model'];if(!_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x40')](_0xd0f8('0x41'))){_0x5ec608['limit']=qs[_0xd0f8('0x16')](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x16')]);_0x5ec608[_0xd0f8('0x13')]=qs['offset'](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x13')]);}_0x5ec608[_0xd0f8('0x42')]=qs[_0xd0f8('0x43')](_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x43')]);_0x5ec608['where']=qs[_0xd0f8('0x2a')](_[_0xd0f8('0x44')](_0x39a461[_0xd0f8('0x25')],_0x55d933[_0xd0f8('0x2a')]));_0x5ec608['where']['WhatsappInteractionId']=_0x4c7251['id'];if(_0x39a461[_0xd0f8('0x25')]['filter']){_0x5ec608[_0xd0f8('0x45')]=_['merge'](_0x5ec608['where'],{'$or':_[_0xd0f8('0x46')](_0x5ec608[_0xd0f8('0x2c')],function(_0x402993){var _0x3b069c={};_0x3b069c[_0x402993]={'$like':'%'+_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x47')]+'%'};return _0x3b069c;})});}if(_0x39a461['query'][_0xd0f8('0x48')]){var _0x2ba4a4=_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x48')][_0xd0f8('0x49')](',');var _0x2b031b={};_0x2b031b[_0x2ba4a4[0x0]]={'$gte':moment(_0x2ba4a4[0x1])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))};_0x5ec608[_0xd0f8('0x45')]=_[_0xd0f8('0x4c')](_0x5ec608[_0xd0f8('0x45')],_0x2b031b);}_0x5ec608=_['merge']({},_0x5ec608,_0x39a461[_0xd0f8('0x30')]);return db[_0xd0f8('0x3a')][_0xd0f8('0x15')]({'where':_0x5ec608['where']})[_0xd0f8('0x19')](function(_0x452b4f){_0x42d8fa['count']=_0x452b4f;if(_0x39a461[_0xd0f8('0x25')][_0xd0f8('0x2e')]){_0x5ec608['include']=[{'all':!![]}];}return db[_0xd0f8('0x3a')][_0xd0f8('0x23')](_0x5ec608);})['then'](function(_0x434227){_0x42d8fa[_0xd0f8('0x4d')]=_0x434227;return _0x42d8fa;});}})[_0xd0f8('0x19')](respondWithFilteredResult(_0x24ee18,_0x5ec608))[_0xd0f8('0x31')](handleError(_0x24ee18,null));};exports[_0xd0f8('0x4e')]=function(_0x3d6132,_0x1e7517){return db[_0xd0f8('0x1f')][_0xd0f8('0x35')]({'where':{'id':_0x3d6132[_0xd0f8('0x36')]['id']}})['then'](handleEntityNotFound(_0x1e7517,null))['then'](function(_0x4e282f){if(_0x4e282f){return _0x4e282f['setTags'](_0x3d6132[_0xd0f8('0x34')][_0xd0f8('0x3c')],_[_0xd0f8('0x3b')](_0x3d6132[_0xd0f8('0x34')],[_0xd0f8('0x3c'),'id'])||{})[_0xd0f8('0x4f')](function(){return db['Tag'][_0xd0f8('0x23')]({'attributes':['id',_0xd0f8('0x1c'),_0xd0f8('0x50')],'where':{'id':_0x3d6132[_0xd0f8('0x34')]['ids']}});})[_0xd0f8('0x19')](function(_0x5d5e19){socket[_0xd0f8('0x51')]('whatsappInteractionTags:save',{'id':Number(_0x3d6132[_0xd0f8('0x36')]['id']),'tags':_0x5d5e19||[]});return{'id':Number(_0x3d6132[_0xd0f8('0x36')]['id']),'tags':_0x5d5e19||[]};});}})[_0xd0f8('0x19')](respondWithResult(_0x1e7517,null))[_0xd0f8('0x31')](handleError(_0x1e7517,null));};exports['removeTags']=function(_0x12c6fd,_0x2aeb06){return db[_0xd0f8('0x1f')][_0xd0f8('0x35')]({'where':{'id':_0x12c6fd['params']['id']}})['then'](handleEntityNotFound(_0x2aeb06,null))[_0xd0f8('0x19')](function(_0x28eef9){if(_0x28eef9){return _0x28eef9[_0xd0f8('0x52')](_0x12c6fd[_0xd0f8('0x25')][_0xd0f8('0x3c')]);}})[_0xd0f8('0x19')](respondWithStatusCode(_0x2aeb06,null))[_0xd0f8('0x31')](handleError(_0x2aeb06,null));};exports['download']=function(_0x1b50da,_0x1ced5a){var _0x3d29a1=moment()[_0xd0f8('0x53')]()['toString']();var _0xd30ff9=path[_0xd0f8('0x54')](config[_0xd0f8('0x55')],_0xd0f8('0x56'),'files',_0xd0f8('0x57'));var _0x4dd16d=path['join'](config['root'],_0xd0f8('0x56'),_0xd0f8('0x58'),_0xd0f8('0x59'));var _0x1aca75=path[_0xd0f8('0x54')](_0xd30ff9,_0x3d29a1);var _0x413330=util[_0xd0f8('0x4a')](_0xd0f8('0x5a'),_0x1b50da['params']['id'],_0x3d29a1);var _0x3ab0d8=path['join'](_0xd30ff9,_0x413330);var _0x24f4d0=[];_0x24f4d0[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x5c')],'as':_0xd0f8('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x24f4d0['push']({'model':db['CmContact'],'as':_0xd0f8('0x5d'),'attributes':['id',_0xd0f8('0x5e'),_0xd0f8('0x5f')],'raw':!![]});if(_0x1b50da['query'][_0xd0f8('0x59')]){_0x24f4d0['push']({'model':db[_0xd0f8('0x60')],'as':'Attachment','raw':!![]});}var _0x1a2645=[{'model':db[_0xd0f8('0x3a')],'as':_0xd0f8('0x61'),'attributes':['id',_0xd0f8('0x34'),'createdAt','direction',_0xd0f8('0x62'),_0xd0f8('0x63')],'include':_0x24f4d0}];_0x1a2645[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x64')],'as':'Account','attributes':['id',_0xd0f8('0x1c')]});_0x1a2645[_0xd0f8('0x5b')]({'model':db[_0xd0f8('0x5c')],'as':_0xd0f8('0x65'),'attributes':['id',_0xd0f8('0x66')]});return db[_0xd0f8('0x1f')]['find']({'where':{'id':_0x1b50da['params']['id']},'include':_0x1a2645})[_0xd0f8('0x19')](handleEntityNotFound(_0x1ced5a,null))['then'](function(_0x298477){if(_0x298477){var _0x509460=_0x298477[_0xd0f8('0x67')]({'plain':!![]});fs[_0xd0f8('0x68')](_0x1aca75);var _0x51c80f={'channel':_0xd0f8('0x69'),'account':_0x509460[_0xd0f8('0x6a')][_0xd0f8('0x1c')],'agent':_0x509460[_0xd0f8('0x65')]?_0x509460[_0xd0f8('0x65')]['fullname']:_0xd0f8('0x6b'),'createdAt':moment(_0x509460[_0xd0f8('0x6c')])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))[_0xd0f8('0x6d')](),'closedAt':_0x509460[_0xd0f8('0x6e')]?moment(_0x509460[_0xd0f8('0x6f')])[_0xd0f8('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x509460[_0xd0f8('0x70')],'messages':_(_0x509460[_0xd0f8('0x61')])[_0xd0f8('0x47')]({'secret':![]})[_0xd0f8('0x46')](function(_0x2a18f9){if(_0x2a18f9[_0xd0f8('0x60')]){var _0x577aa7=path['join'](_0x4dd16d,_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')]);if(fs['existsSync'](_0x577aa7)){fs['createReadStream'](_0x577aa7)['pipe'](fs['createWriteStream'](path[_0xd0f8('0x54')](_0x1aca75,_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')])));}}return{'date':moment(_0x2a18f9['createdAt'])[_0xd0f8('0x4a')](_0xd0f8('0x4b'))[_0xd0f8('0x6d')](),'sender':_0x2a18f9[_0xd0f8('0x72')]===_0xd0f8('0x73')?_0x2a18f9[_0xd0f8('0x5c')]?_0x2a18f9['User'][_0xd0f8('0x66')]:_0xd0f8('0x74'):_0x2a18f9[_0xd0f8('0x5d')][_0xd0f8('0x5e')]+(_0x2a18f9['Contact'][_0xd0f8('0x5f')]?'\x20'+_0x2a18f9['Contact']['lastName']:''),'body':_0x2a18f9[_0xd0f8('0x60')]?_0x2a18f9[_0xd0f8('0x60')][_0xd0f8('0x71')]:_0x2a18f9[_0xd0f8('0x34')],'direction':_0x2a18f9[_0xd0f8('0x72')]===_0xd0f8('0x73')?'A':'C','secret':_0x2a18f9['secret'],'read':_0x2a18f9['read'],'attachment':_0x2a18f9[_0xd0f8('0x60')]};})[_0xd0f8('0x75')]()};return ejs[_0xd0f8('0x76')](path['join'](config[_0xd0f8('0x55')],_0xd0f8('0x56'),_0xd0f8('0x77'),_0xd0f8('0x78')),{'interaction':_0x51c80f})['then'](function(_0x38f9b2){var _0x529880=path[_0xd0f8('0x54')](_0x1aca75,'transcript-'+_0x509460['id']+'-'+_0x3d29a1+_0xd0f8('0x79'));var _0x24a84d={'path':_0x529880,'channel':_0xd0f8('0x69'),'interactionId':_0x509460['id']};return pdf['createPdfFromHTML'](_0x38f9b2,_0x24a84d);})[_0xd0f8('0x19')](function(){return new BPromise(function(_0x2df3d2,_0x558887){zipdir(_0x1aca75,{'saveTo':_0x3ab0d8},function(_0x2c8177,_0x2670a8){if(_0x2c8177)return _0x558887(_0x2c8177);return _0x2df3d2(_0x2670a8);});})['then'](function(){return new BPromise(function(_0x45f94b,_0x26bc86){rimraf(_0x1aca75,function(_0xbe524c){if(_0xbe524c)_0x26bc86(_0xbe524c);return _0x45f94b();});});})['then'](function(){return _0x1ced5a[_0xd0f8('0x7a')](_0x3ab0d8,_0x413330,function(_0x3e384b){if(_0x3e384b){console[_0xd0f8('0x7b')](_0xd0f8('0x7c'),_0x3e384b);}else{fs[_0xd0f8('0x7d')](_0x3ab0d8);}});});});}else{return _0x1ced5a[_0xd0f8('0xf')](0xc8);}})[_0xd0f8('0x31')](handleError(_0x1ced5a,null));}; \ No newline at end of file +var _0xcdde=['includeAll','include','merge','create','body','find','describe','addMessage','WhatsappMessage','ids','omit','findOne','keys','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Owner','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','findAll','query','user','catch','show','params','model','WhatsappInteraction','filters','intersection','fields','attributes','length'];(function(_0xe323e3,_0x110473){var _0x208a43=function(_0x18695c){while(--_0x18695c){_0xe323e3['push'](_0xe323e3['shift']());}};_0x208a43(++_0x110473);}(_0xcdde,0x1c1));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xecdd('0x0'));var BPromise=require(_0xecdd('0x1'));var util=require(_0xecdd('0x2'));var path=require(_0xecdd('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xecdd('0x4'));var Redis=require(_0xecdd('0x5'));var interaction=require(_0xecdd('0x6'));var qs=require(_0xecdd('0x7'));var pdf=require(_0xecdd('0x8'));var logger=require(_0xecdd('0x9'))(_0xecdd('0xa'));var config=require(_0xecdd('0xb'));var db=require(_0xecdd('0xc'))['db'];config['redis']=_[_0xecdd('0xd')](config[_0xecdd('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xecdd('0xf'))(new Redis(config[_0xecdd('0xe')]));require(_0xecdd('0x10'))['register'](socket);function respondWithStatusCode(_0x53f783,_0x32ece2){_0x32ece2=_0x32ece2||0xcc;return function(_0x46862d){if(_0x46862d){return _0x53f783[_0xecdd('0x11')](_0x32ece2);}return _0x53f783[_0xecdd('0x12')](_0x32ece2)[_0xecdd('0x13')]();};}function respondWithResult(_0x490b01,_0x2b5dc2){_0x2b5dc2=_0x2b5dc2||0xc8;return function(_0x585b16){if(_0x585b16){return _0x490b01[_0xecdd('0x12')](_0x2b5dc2)['json'](_0x585b16);}};}function respondWithFilteredResult(_0x299635,_0x5a9709){return function(_0x4fa0ce){if(_0x4fa0ce){var _0x2b45a7=typeof _0x5a9709['offset']===_0xecdd('0x14')&&typeof _0x5a9709[_0xecdd('0x15')]===_0xecdd('0x14');var _0x5a7240=_0x4fa0ce[_0xecdd('0x16')];var _0x46205d=_0x2b45a7?0x0:_0x5a9709[_0xecdd('0x17')];var _0x5cc1dd=_0x2b45a7?_0x4fa0ce[_0xecdd('0x16')]:_0x5a9709[_0xecdd('0x17')]+_0x5a9709[_0xecdd('0x15')];var _0x5015cf;if(_0x5cc1dd>=_0x5a7240){_0x5cc1dd=_0x5a7240;_0x5015cf=0xc8;}else{_0x5015cf=0xce;}_0x299635['status'](_0x5015cf);return _0x299635['set'](_0xecdd('0x18'),_0x46205d+'-'+_0x5cc1dd+'/'+_0x5a7240)[_0xecdd('0x19')](_0x4fa0ce);}return null;};}function saveUpdates(_0x353668){return function(_0xb918b0){if(_0xb918b0){return _0xb918b0[_0xecdd('0x1a')](_0x353668)[_0xecdd('0x1b')](function(_0x352209){return _0x352209;});}return null;};}function removeEntity(_0x29f969){return function(_0x5128c5){if(_0x5128c5){return _0x5128c5[_0xecdd('0x1c')]()[_0xecdd('0x1b')](function(){_0x29f969[_0xecdd('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b3b55){return function(_0x13ecfe){if(!_0x13ecfe){_0x2b3b55[_0xecdd('0x11')](0x194);}return _0x13ecfe;};}function handleError(_0x1af152,_0x32bded){_0x32bded=_0x32bded||0x1f4;return function(_0x2ccdae){logger[_0xecdd('0x1d')](_0x2ccdae[_0xecdd('0x1e')]);if(_0x2ccdae[_0xecdd('0x1f')]){delete _0x2ccdae[_0xecdd('0x1f')];}_0x1af152[_0xecdd('0x12')](_0x32bded)['send'](_0x2ccdae);};}exports[_0xecdd('0x20')]=function(_0x444026,_0x44dbb3){var _0x3c68de={};var _0x2d903d=_[_0xecdd('0x21')](db['WhatsappInteraction'][_0xecdd('0x22')],function(_0x2b6e75){return{'name':_0x2b6e75[_0xecdd('0x23')],'type':_0x2b6e75[_0xecdd('0x24')][_0xecdd('0x25')]};});_0x3c68de=qs['getOptions'](_0x2d903d,_0x444026);return interaction[_0xecdd('0x26')]('whatsapp',_0x444026[_0xecdd('0x27')],_0x444026[_0xecdd('0x28')],_0x3c68de,_0x2d903d)[_0xecdd('0x1b')](respondWithFilteredResult(_0x44dbb3,_0x3c68de))[_0xecdd('0x29')](handleError(_0x44dbb3,null));};exports[_0xecdd('0x2a')]=function(_0x2d8289,_0x446de1){var _0x42a1b9={'raw':![],'where':{'id':_0x2d8289[_0xecdd('0x2b')]['id']}},_0x200bf3={};_0x200bf3[_0xecdd('0x2c')]=_['keys'](db[_0xecdd('0x2d')]['rawAttributes']);_0x200bf3[_0xecdd('0x27')]=_['keys'](_0x2d8289[_0xecdd('0x27')]);_0x200bf3[_0xecdd('0x2e')]=_[_0xecdd('0x2f')](_0x200bf3['model'],_0x200bf3['query']);_0x42a1b9['attributes']=_[_0xecdd('0x2f')](_0x200bf3[_0xecdd('0x2c')],qs[_0xecdd('0x30')](_0x2d8289[_0xecdd('0x27')][_0xecdd('0x30')]));_0x42a1b9[_0xecdd('0x31')]=_0x42a1b9['attributes'][_0xecdd('0x32')]?_0x42a1b9[_0xecdd('0x31')]:_0x200bf3[_0xecdd('0x2c')];if(_0x2d8289[_0xecdd('0x27')][_0xecdd('0x33')]){_0x42a1b9[_0xecdd('0x34')]=[{'all':!![]}];}_0x42a1b9=_[_0xecdd('0x35')]({},_0x42a1b9,_0x2d8289['options']);return db[_0xecdd('0x2d')]['find'](_0x42a1b9)['then'](handleEntityNotFound(_0x446de1,null))[_0xecdd('0x1b')](respondWithResult(_0x446de1,null))[_0xecdd('0x29')](handleError(_0x446de1,null));};exports[_0xecdd('0x36')]=function(_0x1883dd,_0x1ff3d5){return db[_0xecdd('0x2d')][_0xecdd('0x36')](_0x1883dd[_0xecdd('0x37')],{})['then'](respondWithResult(_0x1ff3d5,0xc9))[_0xecdd('0x29')](handleError(_0x1ff3d5,null));};exports['update']=function(_0x402f57,_0x3b70d3){if(_0x402f57[_0xecdd('0x37')]['id']){delete _0x402f57[_0xecdd('0x37')]['id'];}return db['WhatsappInteraction'][_0xecdd('0x38')]({'where':{'id':_0x402f57[_0xecdd('0x2b')]['id']}})[_0xecdd('0x1b')](handleEntityNotFound(_0x3b70d3,null))[_0xecdd('0x1b')](saveUpdates(_0x402f57[_0xecdd('0x37')],null))[_0xecdd('0x1b')](respondWithResult(_0x3b70d3,null))[_0xecdd('0x29')](handleError(_0x3b70d3,null));};exports[_0xecdd('0x1c')]=function(_0x346fe4,_0x26a664){return db[_0xecdd('0x2d')][_0xecdd('0x38')]({'where':{'id':_0x346fe4[_0xecdd('0x2b')]['id']}})[_0xecdd('0x1b')](handleEntityNotFound(_0x26a664,null))[_0xecdd('0x1b')](removeEntity(_0x26a664,null))[_0xecdd('0x29')](handleError(_0x26a664,null));};exports[_0xecdd('0x39')]=function(_0x24ebaa,_0x44b546){return db[_0xecdd('0x2d')]['describe']()[_0xecdd('0x1b')](respondWithResult(_0x44b546,null))['catch'](handleError(_0x44b546,null));};exports[_0xecdd('0x3a')]=function(_0x5705a5,_0x3c2b2e){return db[_0xecdd('0x3b')][_0xecdd('0x38')]({'where':{'id':_0x5705a5[_0xecdd('0x2b')]['id']}})[_0xecdd('0x1b')](handleEntityNotFound(_0x3c2b2e,null))[_0xecdd('0x1b')](function(_0x16ee45){if(_0x16ee45){return _0x16ee45[_0xecdd('0x3a')](_0x5705a5[_0xecdd('0x37')][_0xecdd('0x3c')],_[_0xecdd('0x3d')](_0x5705a5[_0xecdd('0x37')],[_0xecdd('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x3c2b2e,null))['catch'](handleError(_0x3c2b2e,null));};exports['getMessages']=function(_0x48f711,_0x5116fe){var _0x2cfd49={'raw':![],'where':{}};var _0x360dcd={};var _0x1e0753={'count':0x0,'rows':[]};return db[_0xecdd('0x2d')][_0xecdd('0x3e')]({'where':{'id':_0x48f711[_0xecdd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5116fe,null))[_0xecdd('0x1b')](function(_0x4ecb4d){if(_0x4ecb4d){_0x360dcd[_0xecdd('0x2c')]=_[_0xecdd('0x3f')](db['WhatsappMessage']['rawAttributes']);_0x360dcd[_0xecdd('0x27')]=_['keys'](_0x48f711[_0xecdd('0x27')]);_0x360dcd[_0xecdd('0x2e')]=_[_0xecdd('0x2f')](_0x360dcd['model'],_0x360dcd[_0xecdd('0x27')]);_0x2cfd49[_0xecdd('0x31')]=_['intersection'](_0x360dcd[_0xecdd('0x2c')],qs[_0xecdd('0x30')](_0x48f711['query'][_0xecdd('0x30')]));_0x2cfd49['attributes']=_0x2cfd49[_0xecdd('0x31')]['length']?_0x2cfd49[_0xecdd('0x31')]:_0x360dcd['model'];if(!_0x48f711['query'][_0xecdd('0x40')](_0xecdd('0x41'))){_0x2cfd49['limit']=qs[_0xecdd('0x15')](_0x48f711[_0xecdd('0x27')][_0xecdd('0x15')]);_0x2cfd49[_0xecdd('0x17')]=qs[_0xecdd('0x17')](_0x48f711[_0xecdd('0x27')][_0xecdd('0x17')]);}_0x2cfd49['order']=qs[_0xecdd('0x42')](_0x48f711['query']['sort']);_0x2cfd49[_0xecdd('0x43')]=qs['filters'](_[_0xecdd('0x44')](_0x48f711['query'],_0x360dcd[_0xecdd('0x2e')]));_0x2cfd49['where']['WhatsappInteractionId']=_0x4ecb4d['id'];if(_0x48f711[_0xecdd('0x27')][_0xecdd('0x45')]){_0x2cfd49[_0xecdd('0x43')]=_['merge'](_0x2cfd49[_0xecdd('0x43')],{'$or':_['map'](_0x2cfd49[_0xecdd('0x31')],function(_0x4cf9cc){var _0x2b00c8={};_0x2b00c8[_0x4cf9cc]={'$like':'%'+_0x48f711[_0xecdd('0x27')][_0xecdd('0x45')]+'%'};return _0x2b00c8;})});}if(_0x48f711[_0xecdd('0x27')]['$gte']){var _0x1d2652=_0x48f711[_0xecdd('0x27')][_0xecdd('0x46')][_0xecdd('0x47')](',');var _0x24efd4={};_0x24efd4[_0x1d2652[0x0]]={'$gte':moment(_0x1d2652[0x1])[_0xecdd('0x48')](_0xecdd('0x49'))};_0x2cfd49['where']=_[_0xecdd('0x35')](_0x2cfd49['where'],_0x24efd4);}_0x2cfd49=_['merge']({},_0x2cfd49,_0x48f711[_0xecdd('0x4a')]);return db[_0xecdd('0x3b')][_0xecdd('0x16')]({'where':_0x2cfd49['where']})[_0xecdd('0x1b')](function(_0x8bfffc){_0x1e0753[_0xecdd('0x16')]=_0x8bfffc;if(_0x48f711['query'][_0xecdd('0x33')]){_0x2cfd49['include']=[{'all':!![]}];}return db[_0xecdd('0x3b')][_0xecdd('0x26')](_0x2cfd49);})['then'](function(_0x44e865){_0x1e0753[_0xecdd('0x4b')]=_0x44e865;return _0x1e0753;});}})[_0xecdd('0x1b')](respondWithFilteredResult(_0x5116fe,_0x2cfd49))[_0xecdd('0x29')](handleError(_0x5116fe,null));};exports[_0xecdd('0x4c')]=function(_0x11c9ce,_0x443ff8){return db[_0xecdd('0x2d')]['find']({'where':{'id':_0x11c9ce[_0xecdd('0x2b')]['id']}})[_0xecdd('0x1b')](handleEntityNotFound(_0x443ff8,null))[_0xecdd('0x1b')](function(_0x5083fb){if(_0x5083fb){return _0x5083fb[_0xecdd('0x4d')](_0x11c9ce[_0xecdd('0x37')][_0xecdd('0x3c')],_[_0xecdd('0x3d')](_0x11c9ce['body'],[_0xecdd('0x3c'),'id'])||{})['spread'](function(){return db[_0xecdd('0x4e')][_0xecdd('0x26')]({'attributes':['id',_0xecdd('0x1f'),_0xecdd('0x4f')],'where':{'id':_0x11c9ce[_0xecdd('0x37')]['ids']}});})['then'](function(_0x5e6e88){socket[_0xecdd('0x50')](_0xecdd('0x51'),{'id':Number(_0x11c9ce[_0xecdd('0x2b')]['id']),'tags':_0x5e6e88||[]});return{'id':Number(_0x11c9ce[_0xecdd('0x2b')]['id']),'tags':_0x5e6e88||[]};});}})[_0xecdd('0x1b')](respondWithResult(_0x443ff8,null))['catch'](handleError(_0x443ff8,null));};exports[_0xecdd('0x52')]=function(_0x34055a,_0x5439b0){return db[_0xecdd('0x2d')][_0xecdd('0x38')]({'where':{'id':_0x34055a[_0xecdd('0x2b')]['id']}})[_0xecdd('0x1b')](handleEntityNotFound(_0x5439b0,null))[_0xecdd('0x1b')](function(_0x492fa0){if(_0x492fa0){return _0x492fa0['removeTags'](_0x34055a[_0xecdd('0x27')]['ids']);}})[_0xecdd('0x1b')](respondWithStatusCode(_0x5439b0,null))[_0xecdd('0x29')](handleError(_0x5439b0,null));};exports[_0xecdd('0x53')]=function(_0x59fe6f,_0x24bbb9){var _0x279d4a=moment()[_0xecdd('0x54')]()[_0xecdd('0x55')]();var _0x24fde6=path[_0xecdd('0x56')](config[_0xecdd('0x57')],_0xecdd('0x58'),_0xecdd('0x59'),'tmp');var _0x409e6a=path[_0xecdd('0x56')](config[_0xecdd('0x57')],'server',_0xecdd('0x59'),_0xecdd('0x5a'));var _0x254077=path['join'](_0x24fde6,_0x279d4a);var _0x47d038=util['format'](_0xecdd('0x5b'),_0x59fe6f[_0xecdd('0x2b')]['id'],_0x279d4a);var _0x5dfddd=path[_0xecdd('0x56')](_0x24fde6,_0x47d038);var _0x4dfb00=[];_0x4dfb00[_0xecdd('0x5c')]({'model':db[_0xecdd('0x5d')],'as':_0xecdd('0x5d'),'attributes':['id',_0xecdd('0x5e')],'raw':!![]});_0x4dfb00[_0xecdd('0x5c')]({'model':db['CmContact'],'as':_0xecdd('0x5f'),'attributes':['id',_0xecdd('0x60'),_0xecdd('0x61')],'raw':!![]});if(_0x59fe6f['query'][_0xecdd('0x5a')]){_0x4dfb00[_0xecdd('0x5c')]({'model':db[_0xecdd('0x62')],'as':_0xecdd('0x62'),'raw':!![]});}var _0x581947=[{'model':db['WhatsappMessage'],'as':_0xecdd('0x63'),'attributes':['id',_0xecdd('0x37'),_0xecdd('0x64'),_0xecdd('0x65'),_0xecdd('0x66'),'read'],'include':_0x4dfb00}];_0x581947[_0xecdd('0x5c')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0xecdd('0x1f')]});_0x581947[_0xecdd('0x5c')]({'model':db[_0xecdd('0x5d')],'as':_0xecdd('0x67'),'attributes':['id','fullname']});return db[_0xecdd('0x2d')]['find']({'where':{'id':_0x59fe6f[_0xecdd('0x2b')]['id']},'include':_0x581947})[_0xecdd('0x1b')](handleEntityNotFound(_0x24bbb9,null))[_0xecdd('0x1b')](function(_0x1f7096){if(_0x1f7096){var _0x58eb8d=_0x1f7096['get']({'plain':!![]});fs[_0xecdd('0x68')](_0x254077);var _0xe57922={'channel':_0xecdd('0x69'),'account':_0x58eb8d['Account'][_0xecdd('0x1f')],'agent':_0x58eb8d['Owner']?_0x58eb8d[_0xecdd('0x67')][_0xecdd('0x5e')]:_0xecdd('0x6a'),'createdAt':moment(_0x58eb8d[_0xecdd('0x64')])[_0xecdd('0x48')](_0xecdd('0x49'))[_0xecdd('0x55')](),'closedAt':_0x58eb8d['closed']?moment(_0x58eb8d[_0xecdd('0x6b')])[_0xecdd('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xecdd('0x55')]():'','disposition':_0x58eb8d[_0xecdd('0x6c')],'messages':_(_0x58eb8d[_0xecdd('0x63')])[_0xecdd('0x45')]({'secret':![]})[_0xecdd('0x21')](function(_0x38a9ce){if(_0x38a9ce[_0xecdd('0x62')]){var _0x273587=path[_0xecdd('0x56')](_0x409e6a,_0x38a9ce[_0xecdd('0x62')][_0xecdd('0x6d')]);if(fs[_0xecdd('0x6e')](_0x273587)){fs[_0xecdd('0x6f')](_0x273587)[_0xecdd('0x70')](fs[_0xecdd('0x71')](path[_0xecdd('0x56')](_0x254077,_0x38a9ce[_0xecdd('0x62')]['basename'])));}}return{'date':moment(_0x38a9ce[_0xecdd('0x64')])[_0xecdd('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xecdd('0x55')](),'sender':_0x38a9ce[_0xecdd('0x65')]===_0xecdd('0x72')?_0x38a9ce[_0xecdd('0x5d')]?_0x38a9ce[_0xecdd('0x5d')]['fullname']:_0xecdd('0x73'):_0x38a9ce[_0xecdd('0x5f')][_0xecdd('0x60')]+(_0x38a9ce[_0xecdd('0x5f')][_0xecdd('0x61')]?'\x20'+_0x38a9ce[_0xecdd('0x5f')]['lastName']:''),'body':_0x38a9ce['Attachment']?_0x38a9ce[_0xecdd('0x62')][_0xecdd('0x6d')]:_0x38a9ce[_0xecdd('0x37')],'direction':_0x38a9ce[_0xecdd('0x65')]===_0xecdd('0x72')?'A':'C','secret':_0x38a9ce[_0xecdd('0x66')],'read':_0x38a9ce[_0xecdd('0x74')],'attachment':_0x38a9ce[_0xecdd('0x62')]};})['value']()};return ejs[_0xecdd('0x75')](path[_0xecdd('0x56')](config[_0xecdd('0x57')],_0xecdd('0x58'),_0xecdd('0x76'),_0xecdd('0x77')),{'interaction':_0xe57922})[_0xecdd('0x1b')](function(_0x26fe44){var _0x4ac015=path[_0xecdd('0x56')](_0x254077,_0xecdd('0x78')+_0x58eb8d['id']+'-'+_0x279d4a+_0xecdd('0x79'));var _0x8a9b86={'path':_0x4ac015,'channel':'Whatsapp','interactionId':_0x58eb8d['id']};return pdf[_0xecdd('0x7a')](_0x26fe44,_0x8a9b86);})[_0xecdd('0x1b')](function(){return new BPromise(function(_0x4c8e55,_0x22e720){zipdir(_0x254077,{'saveTo':_0x5dfddd},function(_0x2abfdf,_0x311987){if(_0x2abfdf)return _0x22e720(_0x2abfdf);return _0x4c8e55(_0x311987);});})[_0xecdd('0x1b')](function(){return new BPromise(function(_0x5f357e,_0x42289f){rimraf(_0x254077,function(_0x3ce8e7){if(_0x3ce8e7)_0x42289f(_0x3ce8e7);return _0x5f357e();});});})['then'](function(){return _0x24bbb9[_0xecdd('0x53')](_0x5dfddd,_0x47d038,function(_0x2691d7){if(_0x2691d7){console['log'](_0xecdd('0x7b'),_0x2691d7);}else{fs[_0xecdd('0x7c')](_0x5dfddd);}});});});}else{return _0x24bbb9[_0xecdd('0x11')](0xc8);}})[_0xecdd('0x29')](handleError(_0x24bbb9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3a53ef5..917d686 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 _0xc6d8=['unreadMessages','length','emit','catch','hook','events','WhatsappInteraction','WhatsappMessage','save','getUsers','then','Users','map','setDataValue'];(function(_0x45ac7c,_0x40fba8){var _0x246346=function(_0xce4bba){while(--_0xce4bba){_0x45ac7c['push'](_0x45ac7c['shift']());}};_0x246346(++_0x40fba8);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x50b66d,_0x11c61c){_0x50b66d=_0x50b66d-0x0;var _0x41aa8e=_0xc6d8[_0x50b66d];return _0x41aa8e;};'use strict';var EventEmitter=require(_0x8c6d('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x8c6d('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x8c6d('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c6d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x352b8c){return function(_0xdff6f,_0x17781d,_0x4f5e8f){_0xdff6f[_0x8c6d('0x4')]({'attributes':['id'],'raw':!![]})[_0x8c6d('0x5')](function(_0x98cae4){_0xdff6f['setDataValue'](_0x8c6d('0x6'),_0x98cae4[_0x8c6d('0x7')](function(_0x16d4b2){return{'id':_0x16d4b2['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xdff6f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c6d('0x5')](function(_0x1ec65c){_0xdff6f[_0x8c6d('0x8')](_0x8c6d('0x9'),_0x1ec65c[_0x8c6d('0xa')]);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c+':'+_0xdff6f['id'],_0xdff6f);WhatsappInteractionEvents[_0x8c6d('0xb')](_0x352b8c,_0xdff6f);_0x4f5e8f(null);})[_0x8c6d('0xc')](_0x4f5e8f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x8c6d('0xd')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x8482=['length','emit','catch','hasOwnProperty','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','map','findAll','unreadMessages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8482,0x14e));var _0x2848=function(_0x866d4f,_0x7eda41){_0x866d4f=_0x866d4f-0x0;var _0x225134=_0x8482[_0x866d4f];return _0x225134;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x2848('0x0'))['db'][_0x2848('0x1')];var WhatsappMessage=require(_0x2848('0x0'))['db'][_0x2848('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2848('0x3')](0x0);var events={'afterCreate':_0x2848('0x4'),'afterUpdate':_0x2848('0x5'),'afterDestroy':_0x2848('0x6')};function emitEvent(_0x467ee5){return function(_0x391cad,_0x5cc8e1,_0x1eb602){_0x391cad[_0x2848('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xeca507){_0x391cad['setDataValue']('Users',_0xeca507[_0x2848('0x8')](function(_0x582500){return{'id':_0x582500['id']};}));return WhatsappMessage[_0x2848('0x9')]({'where':{'WhatsappInteractionId':_0x391cad['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5bcc65){_0x391cad['setDataValue'](_0x2848('0xa'),_0x5bcc65[_0x2848('0xb')]);WhatsappInteractionEvents[_0x2848('0xc')](_0x467ee5+':'+_0x391cad['id'],_0x391cad);WhatsappInteractionEvents[_0x2848('0xc')](_0x467ee5,_0x391cad);_0x1eb602(null);})[_0x2848('0xd')](_0x1eb602(null));};}for(var e in events){if(events[_0x2848('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 54ed48c..1d0d195 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 _0xe0e2=['../../config/logger','moment','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x206d65,_0x547606){var _0x43aac0=function(_0x28f506){while(--_0x28f506){_0x206d65['push'](_0x206d65['shift']());}};_0x43aac0(++_0x547606);}(_0xe0e2,0x197));var _0x2e0e=function(_0x30c133,_0x20e3bd){_0x30c133=_0x30c133-0x0;var _0x38a446=_0xe0e2[_0x30c133];return _0x38a446;};'use strict';var _=require('lodash');var util=require(_0x2e0e('0x0'));var logger=require(_0x2e0e('0x1'))('api');var moment=require(_0x2e0e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e0e('0x3'));var config=require('../../config/environment');var attributes=require(_0x2e0e('0x4'));module[_0x2e0e('0x5')]=function(_0x170902,_0x3723c1){return _0x170902[_0x2e0e('0x6')](_0x2e0e('0x7'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30d545,_0x4be999,_0x433173){if(_0x30d545[_0x2e0e('0x8')](_0x2e0e('0x9'))){_0x30d545[_0x2e0e('0xa')]=moment()['format'](_0x2e0e('0xb'));}_0x433173(null,_0x30d545);}}});}; \ No newline at end of file +var _0x28a0=['bluebird','request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','closedAt','format','lodash','../../config/logger','api','moment'];(function(_0x3ce3bc,_0x3530af){var _0x31100b=function(_0x2a2f46){while(--_0x2a2f46){_0x3ce3bc['push'](_0x3ce3bc['shift']());}};_0x31100b(++_0x3530af);}(_0x28a0,0x155));var _0x028a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x28a0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x028a('0x0'));var util=require('util');var logger=require(_0x028a('0x1'))(_0x028a('0x2'));var moment=require(_0x028a('0x3'));var BPromise=require(_0x028a('0x4'));var rp=require(_0x028a('0x5'));var fs=require('fs');var path=require(_0x028a('0x6'));var rimraf=require('rimraf');var config=require(_0x028a('0x7'));var attributes=require(_0x028a('0x8'));module['exports']=function(_0x5055dd,_0x24b87d){return _0x5055dd[_0x028a('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x028a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51cdee,_0x2838bf,_0x2004df){if(_0x51cdee[_0x028a('0xb')](_0x028a('0xc'))){_0x51cdee[_0x028a('0xd')]=moment()[_0x028a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2004df(null,_0x51cdee);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4582e68..5e23d2f 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 _0x6fa7=['randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','attributes','AddTagsToWhatsappInteraction','find','where','addTags','omit','AddTags','lodash','util','moment','bluebird'];(function(_0x4579fc,_0x387af1){var _0x4a8bf1=function(_0x34e362){while(--_0x34e362){_0x4579fc['push'](_0x4579fc['shift']());}};_0x4a8bf1(++_0x387af1);}(_0x6fa7,0xe6));var _0x76fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fa7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76fa('0x0'));var util=require(_0x76fa('0x1'));var moment=require(_0x76fa('0x2'));var BPromise=require(_0x76fa('0x3'));var rs=require(_0x76fa('0x4'));var fs=require('fs');var Redis=require(_0x76fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x76fa('0x6'));var logger=require(_0x76fa('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76fa('0x8')][_0x76fa('0x9')]({'port':0x232a});config[_0x76fa('0xa')]=_[_0x76fa('0xb')](config[_0x76fa('0xa')],{'host':_0x76fa('0xc'),'port':0x18eb});var socket=require(_0x76fa('0xd'))(new Redis(config[_0x76fa('0xa')]));require(_0x76fa('0xe'))[_0x76fa('0xf')](socket);function respondWithRpcPromise(_0x5d1c87,_0x4f357b,_0x18ec74){return new BPromise(function(_0x23d476,_0x3f341b){return client[_0x76fa('0x10')](_0x5d1c87,_0x18ec74)[_0x76fa('0x11')](function(_0x13163b){logger[_0x76fa('0x12')](_0x76fa('0x13'),_0x4f357b,_0x76fa('0x14'));logger[_0x76fa('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4f357b,'request\x20sent',JSON[_0x76fa('0x16')](_0x13163b));if(_0x13163b[_0x76fa('0x17')]){if(_0x13163b[_0x76fa('0x17')][_0x76fa('0x18')]===0x1f4){logger['error'](_0x76fa('0x13'),_0x4f357b,_0x13163b[_0x76fa('0x17')][_0x76fa('0x19')]);return _0x3f341b(_0x13163b[_0x76fa('0x17')][_0x76fa('0x19')]);}logger[_0x76fa('0x17')](_0x76fa('0x13'),_0x4f357b,_0x13163b['error'][_0x76fa('0x19')]);return _0x23d476(_0x13163b[_0x76fa('0x17')]['message']);}else{logger[_0x76fa('0x12')](_0x76fa('0x13'),_0x4f357b,_0x76fa('0x14'));_0x23d476(_0x13163b['result'][_0x76fa('0x19')]);}})[_0x76fa('0x1a')](function(_0x3c58ca){logger[_0x76fa('0x17')](_0x76fa('0x13'),_0x4f357b,_0x3c58ca);_0x3f341b(_0x3c58ca);});});}exports[_0x76fa('0x1b')]=function(_0x652406){var _0x46fd17=this;return new Promise(function(_0x47e11b,_0x12719c){return db[_0x76fa('0x1c')][_0x76fa('0x1d')](_0x652406[_0x76fa('0x1e')],{'raw':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x652406['options']?_0x652406['options']['where']||null:null,'attributes':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')][_0x76fa('0x20')]||null:null,'limit':_0x652406[_0x76fa('0x1f')]?_0x652406[_0x76fa('0x1f')]['limit']||null:null})[_0x76fa('0x11')](function(_0x301df1){logger[_0x76fa('0x12')](_0x76fa('0x1b'),_0x652406);logger[_0x76fa('0x15')]('UpdateWhatsappInteraction',_0x652406,JSON[_0x76fa('0x16')](_0x301df1));_0x47e11b(_0x301df1);})[_0x76fa('0x1a')](function(_0x116b41){logger['error']('UpdateWhatsappInteraction',_0x116b41['message'],_0x652406);_0x12719c(_0x46fd17['error'](0x1f4,_0x116b41[_0x76fa('0x19')]));});});};exports[_0x76fa('0x21')]=function(_0x407ef3){return new Promise(function(_0x30b84d,_0x2f854f){return db[_0x76fa('0x1c')][_0x76fa('0x22')]({'where':_0x407ef3[_0x76fa('0x1f')]?_0x407ef3[_0x76fa('0x1f')][_0x76fa('0x23')]||null:null})[_0x76fa('0x11')](function(_0x291629){if(_0x291629){return _0x291629[_0x76fa('0x24')](_0x407ef3[_0x76fa('0x1e')]['ids'],_[_0x76fa('0x25')](_0x407ef3['body'],['ids','id'])||{});}})['spread'](function(_0x34d79f){logger[_0x76fa('0x12')](_0x76fa('0x26'),_0x407ef3);logger[_0x76fa('0x15')](_0x76fa('0x26'),_0x407ef3,JSON[_0x76fa('0x16')](_0x34d79f));_0x30b84d(_0x34d79f);})['catch'](function(_0x527f3f){logger[_0x76fa('0x17')](_0x76fa('0x26'),_0x527f3f['message'],_0x407ef3);_0x2f854f(_this[_0x76fa('0x17')](0x1f4,_0x527f3f[_0x76fa('0x19')]));});});}; \ No newline at end of file +var _0x8421=['UpdateWhatsappInteraction','update','body','options','raw','where','attributes','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8421,0x106));var _0x1842=function(_0x368178,_0x2d5678){_0x368178=_0x368178-0x0;var _0x10a228=_0x8421[_0x368178];return _0x10a228;};'use strict';var _=require(_0x1842('0x0'));var util=require(_0x1842('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1842('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1842('0x3'))['db'];var utils=require(_0x1842('0x4'));var logger=require('../../config/logger')(_0x1842('0x5'));var config=require(_0x1842('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1842('0x7')][_0x1842('0x8')]({'port':0x232a});config[_0x1842('0x9')]=_[_0x1842('0xa')](config[_0x1842('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1842('0xb'))(new Redis(config[_0x1842('0x9')]));require('./whatsappInteraction.socket')[_0x1842('0xc')](socket);function respondWithRpcPromise(_0x57eb65,_0x59dddd,_0x508674){return new BPromise(function(_0x4db555,_0x1c8480){return client[_0x1842('0xd')](_0x57eb65,_0x508674)[_0x1842('0xe')](function(_0x31b87b){logger[_0x1842('0xf')](_0x1842('0x10'),_0x59dddd,_0x1842('0x11'));logger['debug'](_0x1842('0x12'),_0x59dddd,_0x1842('0x11'),JSON[_0x1842('0x13')](_0x31b87b));if(_0x31b87b[_0x1842('0x14')]){if(_0x31b87b[_0x1842('0x14')][_0x1842('0x15')]===0x1f4){logger[_0x1842('0x14')](_0x1842('0x10'),_0x59dddd,_0x31b87b['error'][_0x1842('0x16')]);return _0x1c8480(_0x31b87b[_0x1842('0x14')][_0x1842('0x16')]);}logger[_0x1842('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x59dddd,_0x31b87b[_0x1842('0x14')][_0x1842('0x16')]);return _0x4db555(_0x31b87b['error'][_0x1842('0x16')]);}else{logger[_0x1842('0xf')](_0x1842('0x10'),_0x59dddd,'request\x20sent');_0x4db555(_0x31b87b[_0x1842('0x17')][_0x1842('0x16')]);}})[_0x1842('0x18')](function(_0x158aed){logger[_0x1842('0x14')](_0x1842('0x10'),_0x59dddd,_0x158aed);_0x1c8480(_0x158aed);});});}exports[_0x1842('0x19')]=function(_0x5d5017){var _0x17cb70=this;return new Promise(function(_0x3c56a7,_0x142718){return db['WhatsappInteraction'][_0x1842('0x1a')](_0x5d5017[_0x1842('0x1b')],{'raw':_0x5d5017[_0x1842('0x1c')]?_0x5d5017[_0x1842('0x1c')][_0x1842('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d5017[_0x1842('0x1c')]?_0x5d5017['options'][_0x1842('0x1e')]||null:null,'attributes':_0x5d5017[_0x1842('0x1c')]?_0x5d5017[_0x1842('0x1c')][_0x1842('0x1f')]||null:null,'limit':_0x5d5017[_0x1842('0x1c')]?_0x5d5017[_0x1842('0x1c')]['limit']||null:null})[_0x1842('0xe')](function(_0x25d559){logger[_0x1842('0xf')](_0x1842('0x19'),_0x5d5017);logger[_0x1842('0x20')](_0x1842('0x19'),_0x5d5017,JSON[_0x1842('0x13')](_0x25d559));_0x3c56a7(_0x25d559);})['catch'](function(_0x74ac16){logger[_0x1842('0x14')](_0x1842('0x19'),_0x74ac16[_0x1842('0x16')],_0x5d5017);_0x142718(_0x17cb70[_0x1842('0x14')](0x1f4,_0x74ac16['message']));});});};exports[_0x1842('0x21')]=function(_0x3e697e){return new Promise(function(_0x1b3e63,_0x3e6199){return db[_0x1842('0x22')][_0x1842('0x23')]({'where':_0x3e697e[_0x1842('0x1c')]?_0x3e697e[_0x1842('0x1c')][_0x1842('0x1e')]||null:null})[_0x1842('0xe')](function(_0x3e8c9c){if(_0x3e8c9c){return _0x3e8c9c[_0x1842('0x24')](_0x3e697e['body'][_0x1842('0x25')],_[_0x1842('0x26')](_0x3e697e['body'],['ids','id'])||{});}})[_0x1842('0x27')](function(_0x4e4d14){logger[_0x1842('0xf')]('AddTags',_0x3e697e);logger[_0x1842('0x20')]('AddTags',_0x3e697e,JSON[_0x1842('0x13')](_0x4e4d14));_0x1b3e63(_0x4e4d14);})[_0x1842('0x18')](function(_0x527644){logger[_0x1842('0x14')](_0x1842('0x28'),_0x527644[_0x1842('0x16')],_0x3e697e);_0x3e6199(_this[_0x1842('0x14')](0x1f4,_0x527644[_0x1842('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index c53331b..d87e30f 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 _0x8f30=['emit','removeListener','whatsappInteraction:','save','remove','update'];(function(_0x10cdea,_0x2facc0){var _0x46b383=function(_0x3ce52d){while(--_0x3ce52d){_0x10cdea['push'](_0x10cdea['shift']());}};_0x46b383(++_0x2facc0);}(_0x8f30,0x189));var _0x08f3=function(_0x50d21a,_0x1c252c){_0x50d21a=_0x50d21a-0x0;var _0xca50c7=_0x8f30[_0x50d21a];return _0xca50c7;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x08f3('0x0'),_0x08f3('0x1'),_0x08f3('0x2')];function createListener(_0x31f310,_0xd0cae2){return function(_0x5b10de){_0xd0cae2[_0x08f3('0x3')](_0x31f310,_0x5b10de);};}function removeListener(_0x5c42da,_0x239832){return function(){WhatsappInteractionEvents[_0x08f3('0x4')](_0x5c42da,_0x239832);};}exports['register']=function(_0xf9054e){for(var _0x43301e=0x0,_0xd43b1=events['length'];_0x43301e<_0xd43b1;_0x43301e++){var _0x2af205=events[_0x43301e];var _0x4dd5b3=createListener(_0x08f3('0x5')+_0x2af205,_0xf9054e);WhatsappInteractionEvents['on'](_0x2af205,_0x4dd5b3);}}; \ No newline at end of file +var _0xb926=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','removeListener'];(function(_0x439ea9,_0x375bcf){var _0x1c1639=function(_0x1f0bd9){while(--_0x1f0bd9){_0x439ea9['push'](_0x439ea9['shift']());}};_0x1c1639(++_0x375bcf);}(_0xb926,0x133));var _0x6b92=function(_0x18cc15,_0x4b52c3){_0x18cc15=_0x18cc15-0x0;var _0x2b4185=_0xb926[_0x18cc15];return _0x2b4185;};'use strict';var WhatsappInteractionEvents=require(_0x6b92('0x0'));var events=[_0x6b92('0x1'),_0x6b92('0x2'),_0x6b92('0x3')];function createListener(_0x3ada87,_0x5bb29d){return function(_0x137170){_0x5bb29d['emit'](_0x3ada87,_0x137170);};}function removeListener(_0x2e0327,_0x3804b8){return function(){WhatsappInteractionEvents[_0x6b92('0x4')](_0x2e0327,_0x3804b8);};}exports[_0x6b92('0x5')]=function(_0x466d18){for(var _0x4183f9=0x0,_0x16597d=events[_0x6b92('0x6')];_0x4183f9<_0x16597d;_0x4183f9++){var _0x478070=events[_0x4183f9];var _0x18e5b0=createListener(_0x6b92('0x7')+_0x478070,_0x466d18);WhatsappInteractionEvents['on'](_0x478070,_0x18e5b0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 483f58a..f9cac72 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 _0xadc9=['/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xadc9,0x14a));var _0x9adc=function(_0x9264dc,_0x3432ac){_0x9264dc=_0x9264dc-0x0;var _0x4ac434=_0xadc9[_0x9264dc];return _0x4ac434;};'use strict';var multer=require(_0x9adc('0x0'));var util=require(_0x9adc('0x1'));var path=require(_0x9adc('0x2'));var timeout=require(_0x9adc('0x3'));var express=require(_0x9adc('0x4'));var router=express[_0x9adc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9adc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9adc('0x7'));router[_0x9adc('0x8')]('/',auth[_0x9adc('0x9')](),controller[_0x9adc('0xa')]);router[_0x9adc('0x8')](_0x9adc('0xb'),auth[_0x9adc('0x9')](),controller[_0x9adc('0xc')]);router[_0x9adc('0x8')]('/:id',auth[_0x9adc('0x9')](),controller['show']);router[_0x9adc('0xd')]('/',auth[_0x9adc('0x9')](),interaction['tracked'](_0x9adc('0xe'),_0x9adc('0xf')),controller[_0x9adc('0x10')]);router['post'](_0x9adc('0x11'),controller[_0x9adc('0x12')]);router[_0x9adc('0x13')](_0x9adc('0x14'),auth['isAuthenticated'](),controller['update']);router['put'](_0x9adc('0x15'),auth[_0x9adc('0x9')](),controller[_0x9adc('0x16')]);router[_0x9adc('0x13')](_0x9adc('0x17'),auth['isAuthenticated'](),controller[_0x9adc('0x18')]);router['delete']('/:id',auth[_0x9adc('0x9')](),controller[_0x9adc('0x19')]);module[_0x9adc('0x1a')]=router; \ No newline at end of file +var _0x8dbf=['tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','show'];(function(_0x4f1749,_0x998e73){var _0x9a9ab3=function(_0x37ee0b){while(--_0x37ee0b){_0x4f1749['push'](_0x4f1749['shift']());}};_0x9a9ab3(++_0x998e73);}(_0x8dbf,0xca));var _0xf8db=function(_0x16a049,_0x267f3d){_0x16a049=_0x16a049-0x0;var _0x3fe723=_0x8dbf[_0x16a049];return _0x3fe723;};'use strict';var multer=require(_0xf8db('0x0'));var util=require(_0xf8db('0x1'));var path=require(_0xf8db('0x2'));var timeout=require(_0xf8db('0x3'));var express=require(_0xf8db('0x4'));var router=express[_0xf8db('0x5')]();var fs_extra=require(_0xf8db('0x6'));var auth=require(_0xf8db('0x7'));var interaction=require(_0xf8db('0x8'));var config=require(_0xf8db('0x9'));var controller=require(_0xf8db('0xa'));router[_0xf8db('0xb')]('/',auth[_0xf8db('0xc')](),controller['index']);router[_0xf8db('0xb')](_0xf8db('0xd'),auth[_0xf8db('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf8db('0xe')]);router['post']('/',auth[_0xf8db('0xc')](),interaction[_0xf8db('0xf')](_0xf8db('0x10'),_0xf8db('0x11')),controller[_0xf8db('0x12')]);router[_0xf8db('0x13')](_0xf8db('0x14'),controller['status']);router[_0xf8db('0x15')](_0xf8db('0x16'),auth[_0xf8db('0xc')](),controller[_0xf8db('0x17')]);router[_0xf8db('0x15')](_0xf8db('0x18'),auth['isAuthenticated'](),controller[_0xf8db('0x19')]);router['put'](_0xf8db('0x1a'),auth[_0xf8db('0xc')](),controller[_0xf8db('0x1b')]);router[_0xf8db('0x1c')](_0xf8db('0x16'),auth[_0xf8db('0xc')](),controller[_0xf8db('0x1d')]);module[_0xf8db('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index cb1446b..01c8c8a 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 _0x3649=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4ad30c,_0x34f4d3){var _0x15d68e=function(_0x265ac6){while(--_0x265ac6){_0x4ad30c['push'](_0x4ad30c['shift']());}};_0x15d68e(++_0x34f4d3);}(_0x3649,0x1d1));var _0x9364=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3649[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x9364('0x0'));module[_0x9364('0x1')]={'body':{'type':Sequelize[_0x9364('0x2')](_0x9364('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9364('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9364('0x5')]('in',_0x9364('0x6')),'defaultValue':_0x9364('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9364('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9364('0x7')]},'providerResponse':{'type':Sequelize[_0x9364('0x2')]}}; \ No newline at end of file +var _0x27c9=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x2ecd83,_0x3594e8){var _0x435f08=function(_0x2eb454){while(--_0x2eb454){_0x2ecd83['push'](_0x2ecd83['shift']());}};_0x435f08(++_0x3594e8);}(_0x27c9,0x1e7));var _0x927c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x27c9[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x927c('0x0'));module[_0x927c('0x1')]={'body':{'type':Sequelize[_0x927c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x927c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x927c('0x4')]('in',_0x927c('0x5')),'defaultValue':_0x927c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x927c('0x6')](0xbe)},'phone':{'type':Sequelize[_0x927c('0x6')]},'readAt':{'type':Sequelize[_0x927c('0x7')]},'secret':{'type':Sequelize[_0x927c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x927c('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 2159304..6b2e193 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 _0x4907=['defaults','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','end','stack','name','send','index','map','WhatsappMessage','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis'];(function(_0x22ce71,_0x228464){var _0xcd9503=function(_0x1aa6e2){while(--_0x1aa6e2){_0x22ce71['push'](_0x22ce71['shift']());}};_0xcd9503(++_0x228464);}(_0x4907,0x191));var _0x7490=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4907[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7490('0x0'));var rimraf=require(_0x7490('0x1'));var zipdir=require(_0x7490('0x2'));var jsonpatch=require(_0x7490('0x3'));var rp=require('request-promise');var moment=require(_0x7490('0x4'));var BPromise=require(_0x7490('0x5'));var Mustache=require(_0x7490('0x6'));var util=require(_0x7490('0x7'));var path=require('path');var sox=require(_0x7490('0x8'));var csv=require(_0x7490('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7490('0xa'));var crypto=require(_0x7490('0xb'));var jsforce=require(_0x7490('0xc'));var deskjs=require(_0x7490('0xd'));var toCsv=require(_0x7490('0x9'));var querystring=require(_0x7490('0xe'));var Papa=require(_0x7490('0xf'));var Redis=require(_0x7490('0x10'));var authService=require(_0x7490('0x11'));var qs=require(_0x7490('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7490('0x13'));var logger=require(_0x7490('0x14'))(_0x7490('0x15'));var utils=require('../../config/utils');var config=require(_0x7490('0x16'));var licenseUtil=require(_0x7490('0x17'));var db=require('../../mysqldb')['db'];config[_0x7490('0x18')]=_[_0x7490('0x19')](config[_0x7490('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7490('0x18')]));require(_0x7490('0x1a'))[_0x7490('0x1b')](socket);var jayson=require(_0x7490('0x1c'));var client=jayson[_0x7490('0x1d')][_0x7490('0x1e')]({'port':0x232c});var client9002=jayson[_0x7490('0x1d')][_0x7490('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x307b1c,_0x1edba8,_0x365ccf,_0x5936f3){return new BPromise(function(_0x5c5c3f,_0xc6de42){var _0x41bb9a=_0x5936f3||client;return _0x41bb9a[_0x7490('0x1f')](_0x307b1c,_0x365ccf)[_0x7490('0x20')](function(_0xc8c288){logger[_0x7490('0x21')](_0x7490('0x22'),_0x1edba8,'request\x20sent');logger['debug'](_0x7490('0x23'),_0x1edba8,_0x7490('0x24'),JSON[_0x7490('0x25')](_0xc8c288));if(_0xc8c288[_0x7490('0x26')]){if(_0xc8c288['error'][_0x7490('0x27')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1edba8,_0xc8c288[_0x7490('0x26')][_0x7490('0x28')]);return _0xc6de42(_0xc8c288['error'][_0x7490('0x28')]);}logger['error'](_0x7490('0x22'),_0x1edba8,_0xc8c288['error'][_0x7490('0x28')]);return _0x5c5c3f(_0xc8c288['error'][_0x7490('0x28')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1edba8,'request\x20sent');_0x5c5c3f(_0xc8c288['result'][_0x7490('0x28')]);}})[_0x7490('0x29')](function(_0x15383d){logger[_0x7490('0x26')](_0x7490('0x22'),_0x1edba8,_0x15383d);_0xc6de42(_0x15383d);});});}function respondWithStatusCode(_0x96cb9f,_0x533741){_0x533741=_0x533741||0xcc;return function(_0x2cc64c){if(_0x2cc64c){return _0x96cb9f[_0x7490('0x2a')](_0x533741);}return _0x96cb9f['status'](_0x533741)['end']();};}function respondWithResult(_0x461049,_0x100f8c){_0x100f8c=_0x100f8c||0xc8;return function(_0x4c8d87){if(_0x4c8d87){return _0x461049[_0x7490('0x2b')](_0x100f8c)[_0x7490('0x2c')](_0x4c8d87);}};}function respondWithFilteredResult(_0x578d1b,_0x592259){return function(_0x460bba){if(_0x460bba){var _0x1c79cd=typeof _0x592259[_0x7490('0x2d')]===_0x7490('0x2e')&&typeof _0x592259[_0x7490('0x2f')]===_0x7490('0x2e');var _0x322b83=_0x460bba[_0x7490('0x30')];var _0x39a47d=_0x1c79cd?0x0:_0x592259[_0x7490('0x2d')];var _0x14103e=_0x1c79cd?_0x460bba['count']:_0x592259[_0x7490('0x2d')]+_0x592259[_0x7490('0x2f')];var _0x2b82d2;if(_0x14103e>=_0x322b83){_0x14103e=_0x322b83;_0x2b82d2=0xc8;}else{_0x2b82d2=0xce;}_0x578d1b['status'](_0x2b82d2);return _0x578d1b[_0x7490('0x31')](_0x7490('0x32'),_0x39a47d+'-'+_0x14103e+'/'+_0x322b83)['json'](_0x460bba);}return null;};}function patchUpdates(_0x265be5){return function(_0x83735f){try{jsonpatch[_0x7490('0x33')](_0x83735f,_0x265be5,!![]);}catch(_0x4cbe1d){return BPromise[_0x7490('0x34')](_0x4cbe1d);}return _0x83735f['save']();};}function saveUpdates(_0x254d37,_0x23ab66){return function(_0x4fccd2){if(_0x4fccd2){return _0x4fccd2[_0x7490('0x35')](_0x254d37)[_0x7490('0x20')](function(_0x91d4ad){return _0x91d4ad;});}return null;};}function removeEntity(_0xaf3f32,_0x3a615a){return function(_0x156a40){if(_0x156a40){return _0x156a40[_0x7490('0x36')]()['then'](function(){_0xaf3f32[_0x7490('0x2b')](0xcc)[_0x7490('0x37')]();});}};}function handleEntityNotFound(_0x5eb6cb,_0x425e95){return function(_0x25e44f){if(!_0x25e44f){_0x5eb6cb[_0x7490('0x2a')](0x194);}return _0x25e44f;};}function handleError(_0x55b4a4,_0x36fd4e){_0x36fd4e=_0x36fd4e||0x1f4;return function(_0x428b1c){logger['error'](_0x428b1c[_0x7490('0x38')]);if(_0x428b1c[_0x7490('0x39')]){delete _0x428b1c[_0x7490('0x39')];}_0x55b4a4[_0x7490('0x2b')](_0x36fd4e)[_0x7490('0x3a')](_0x428b1c);};}exports[_0x7490('0x3b')]=function(_0x2d836c,_0x108115){var _0x5483d7={},_0x2e4733={},_0x3b1398={'count':0x0,'rows':[]};var _0x176abd=_[_0x7490('0x3c')](db[_0x7490('0x3d')]['rawAttributes'],function(_0x4fd850){return{'name':_0x4fd850['fieldName'],'type':_0x4fd850['type'][_0x7490('0x3e')]};});_0x2e4733[_0x7490('0x3f')]=_['map'](_0x176abd,_0x7490('0x39'));_0x2e4733[_0x7490('0x40')]=_[_0x7490('0x41')](_0x2d836c[_0x7490('0x40')]);_0x2e4733[_0x7490('0x42')]=_['intersection'](_0x2e4733[_0x7490('0x3f')],_0x2e4733[_0x7490('0x40')]);_0x5483d7[_0x7490('0x43')]=_[_0x7490('0x44')](_0x2e4733[_0x7490('0x3f')],qs[_0x7490('0x45')](_0x2d836c[_0x7490('0x40')][_0x7490('0x45')]));_0x5483d7[_0x7490('0x43')]=_0x5483d7[_0x7490('0x43')][_0x7490('0x46')]?_0x5483d7[_0x7490('0x43')]:_0x2e4733[_0x7490('0x3f')];if(!_0x2d836c['query'][_0x7490('0x47')](_0x7490('0x48'))){_0x5483d7[_0x7490('0x2f')]=qs[_0x7490('0x2f')](_0x2d836c[_0x7490('0x40')][_0x7490('0x2f')]);_0x5483d7[_0x7490('0x2d')]=qs['offset'](_0x2d836c[_0x7490('0x40')]['offset']);}_0x5483d7['order']=qs['sort'](_0x2d836c['query'][_0x7490('0x49')]);_0x5483d7[_0x7490('0x4a')]=qs[_0x7490('0x42')](_[_0x7490('0x4b')](_0x2d836c[_0x7490('0x40')],_0x2e4733[_0x7490('0x42')]),_0x176abd);if(_0x2d836c[_0x7490('0x40')][_0x7490('0x4c')]){_0x5483d7[_0x7490('0x4a')]=_['merge'](_0x5483d7[_0x7490('0x4a')],{'$or':_[_0x7490('0x3c')](_0x176abd,function(_0x26c425){if(_0x26c425['type']!=='VIRTUAL'){var _0x3b8e0b={};_0x3b8e0b[_0x26c425[_0x7490('0x39')]]={'$like':'%'+_0x2d836c['query'][_0x7490('0x4c')]+'%'};return _0x3b8e0b;}})});}_0x5483d7=_[_0x7490('0x4d')]({},_0x5483d7,_0x2d836c[_0x7490('0x4e')]);var _0x4bba78={'where':_0x5483d7['where']};return db[_0x7490('0x3d')][_0x7490('0x30')](_0x4bba78)['then'](function(_0xec5d92){_0x3b1398[_0x7490('0x30')]=_0xec5d92;if(_0x2d836c[_0x7490('0x40')][_0x7490('0x4f')]){_0x5483d7[_0x7490('0x50')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x7490('0x51')](_0x5483d7);})[_0x7490('0x20')](function(_0x248ed5){_0x3b1398[_0x7490('0x52')]=_0x248ed5;return _0x3b1398;})['then'](respondWithFilteredResult(_0x108115,_0x5483d7))[_0x7490('0x29')](handleError(_0x108115,null));};exports[_0x7490('0x53')]=function(_0x38d075,_0x20f80e){var _0x414b9a={'raw':!![],'where':{'id':_0x38d075[_0x7490('0x54')]['id']}},_0x166293={};_0x166293[_0x7490('0x3f')]=_[_0x7490('0x41')](db[_0x7490('0x3d')][_0x7490('0x55')]);_0x166293['query']=_['keys'](_0x38d075[_0x7490('0x40')]);_0x166293['filters']=_[_0x7490('0x44')](_0x166293[_0x7490('0x3f')],_0x166293[_0x7490('0x40')]);_0x414b9a[_0x7490('0x43')]=_[_0x7490('0x44')](_0x166293[_0x7490('0x3f')],qs[_0x7490('0x45')](_0x38d075[_0x7490('0x40')][_0x7490('0x45')]));_0x414b9a[_0x7490('0x43')]=_0x414b9a[_0x7490('0x43')][_0x7490('0x46')]?_0x414b9a[_0x7490('0x43')]:_0x166293[_0x7490('0x3f')];if(_0x38d075['query']['includeAll']){_0x414b9a[_0x7490('0x50')]=[{'all':!![]}];}_0x414b9a=_[_0x7490('0x4d')]({},_0x414b9a,_0x38d075[_0x7490('0x4e')]);return db[_0x7490('0x3d')][_0x7490('0x56')](_0x414b9a)[_0x7490('0x20')](handleEntityNotFound(_0x20f80e,null))[_0x7490('0x20')](respondWithResult(_0x20f80e,null))[_0x7490('0x29')](handleError(_0x20f80e,null));};exports[_0x7490('0x57')]=function(_0x39d36a,_0x4561b1){return db[_0x7490('0x3d')][_0x7490('0x57')](_0x39d36a[_0x7490('0x58')],{})[_0x7490('0x20')](respondWithResult(_0x4561b1,0xc9))[_0x7490('0x29')](handleError(_0x4561b1,null));};exports[_0x7490('0x35')]=function(_0x321716,_0x1a68df){if(_0x321716[_0x7490('0x58')]['id']){delete _0x321716['body']['id'];}return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x321716[_0x7490('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a68df,null))[_0x7490('0x20')](saveUpdates(_0x321716[_0x7490('0x58')],null))[_0x7490('0x20')](respondWithResult(_0x1a68df,null))[_0x7490('0x29')](handleError(_0x1a68df,null));};exports[_0x7490('0x36')]=function(_0x373963,_0x5dc99c){return db['WhatsappMessage']['find']({'where':{'id':_0x373963['params']['id']}})['then'](handleEntityNotFound(_0x5dc99c,null))['then'](removeEntity(_0x5dc99c,null))[_0x7490('0x29')](handleError(_0x5dc99c,null));};exports[_0x7490('0x59')]=function(_0x4b7c60,_0x4aa082){return db['WhatsappMessage']['describe']()[_0x7490('0x20')](respondWithResult(_0x4aa082,null))['catch'](handleError(_0x4aa082,null));};var interaction_log=require(_0x7490('0x14'))(_0x7490('0x5a'));exports[_0x7490('0x5b')]=function(_0x2dd828,_0x407ba3,_0x16ac9d){var _0xcca523={'agent':{},'channel':'whatsapp'};if(_0x2dd828[_0x7490('0x58')]['id']){delete _0x2dd828['body']['id'];}_0x2dd828[_0x7490('0x58')][_0x7490('0x5c')]=!![];_0x2dd828['body'][_0x7490('0x5d')]=moment()[_0x7490('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2dd828['body']['UserId']=_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')]||_0x2dd828[_0x7490('0x60')]['id'];_0xcca523['agent']['id']=_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')];return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x2dd828[_0x7490('0x54')]['id'],'UserId':null}})[_0x7490('0x20')](handleEntityNotFound(_0x407ba3,null))[_0x7490('0x20')](saveUpdates(_0x2dd828[_0x7490('0x58')],null))['then'](function(_0x4b1b59){if(_0x4b1b59){_0xcca523['message']=_0x4b1b59[_0x7490('0x61')]({'plain':!![]});return db[_0x7490('0x62')][_0x7490('0x56')]({'where':{'id':_0x4b1b59[_0x7490('0x63')]}});}return null;})[_0x7490('0x20')](handleEntityNotFound(_0x407ba3,null))[_0x7490('0x20')](function(_0x31a594){if(_0x31a594){return _0x31a594[_0x7490('0x35')]({'UserId':_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')],'read1stAt':_[_0x7490('0x64')](_0x31a594[_0x7490('0x65')])?moment()['format'](_0x7490('0x66')):undefined});}return null;})[_0x7490('0x20')](function(_0x4e0599){if(_0x4e0599){_0xcca523[_0x7490('0x67')]=_0x4e0599[_0x7490('0x61')]({'plain':!![]});interaction_log[_0x7490('0x21')](_0x7490('0x68'),_0x2dd828[_0x7490('0x60')]['id'],_0x2dd828[_0x7490('0x60')][_0x7490('0x39')],_0x2dd828[_0x7490('0x60')]['role'],_0xcca523['interaction']['id'],_0x2dd828[_0x7490('0x58')]?JSON[_0x7490('0x25')](_0x2dd828[_0x7490('0x58')]):_0x7490('0x69'));return respondWithRpcPromise(_0x7490('0x6a'),'acceptMessage',_0xcca523);}return null;})[_0x7490('0x20')](function(_0x1b768a){var _0x377198='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1b768a[_0x7490('0x28')][_0x7490('0x6b')];return db['sequelize'][_0x7490('0x40')](_0x377198,{'type':db[_0x7490('0x6c')]['QueryTypes'][_0x7490('0x6d')],'raw':!![]})[_0x7490('0x20')](function(_0x1ee519){return _0x1ee519;});})[_0x7490('0x20')](function(_0x1973f2){if(_0x1973f2){_0xcca523['message'][_0x7490('0x6e')]=_0x1973f2[0x0];if(!_0x2dd828[_0x7490('0x58')]['UserId'])return;return db[_0x7490('0x6f')]['find']({'where':{'id':_0x2dd828[_0x7490('0x58')][_0x7490('0x5f')],'role':_0x7490('0x70')},'attributes':['id','name',_0x7490('0x71'),_0x7490('0x72'),_0x7490('0x73')],'raw':!![]});}return null;})[_0x7490('0x20')](function(_0x1f696e){if(!_0x1f696e)return null;_0xcca523['message'][_0x7490('0x70')]=_0x1f696e;return _0xcca523;})[_0x7490('0x20')](function(_0x3a963a){if(_0x3a963a){if(_0x2dd828['body'][_0x7490('0x74')]){_0xcca523['message'][_0x7490('0x75')]=util['format'](_0x7490('0x76'),_0x2dd828[_0x7490('0x60')][_0x7490('0x39')]);_0xcca523['message'][_0x7490('0x77')]=_0xcca523['channel'];_0xcca523[_0x7490('0x28')][_0x7490('0x78')]=_0xcca523[_0x7490('0x77')];_0xcca523[_0x7490('0x28')][_0x7490('0x79')]=_0x7490('0x5b');return respondWithRpcPromise(_0x7490('0x7a'),_0x7490('0x7a'),{'event':'acceptmessage','message':_0xcca523[_0x7490('0x28')]},client9002)[_0x7490('0x20')](function(){return _0xcca523;});}return _0xcca523;}return null;})[_0x7490('0x20')](respondWithResult(_0x407ba3,null))[_0x7490('0x29')](handleError(_0x407ba3,null));};var interaction_log=require(_0x7490('0x14'))('whatsapp-interactions');exports['reject']=function(_0x3a5e78,_0x700ac3,_0x47ed4c){var _0x2852b6={'agent':{},'channel':_0x7490('0x7b')};if(_0x3a5e78[_0x7490('0x58')]['id']){delete _0x3a5e78[_0x7490('0x58')]['id'];}_0x3a5e78['body'][_0x7490('0x5f')]=_0x3a5e78['body']['UserId']||_0x3a5e78[_0x7490('0x60')]['id'];_0x2852b6[_0x7490('0x70')]['id']=_0x3a5e78[_0x7490('0x58')][_0x7490('0x5f')];return db[_0x7490('0x3d')][_0x7490('0x56')]({'where':{'id':_0x3a5e78[_0x7490('0x54')]['id'],'UserId':null}})[_0x7490('0x20')](handleEntityNotFound(_0x700ac3,null))[_0x7490('0x20')](function(_0x210e05){if(_0x210e05){_0x2852b6[_0x7490('0x28')]=_0x210e05['get']({'plain':!![]});return db[_0x7490('0x62')][_0x7490('0x56')]({'where':{'id':_0x210e05['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x700ac3,null))['then'](function(_0x416ed7){if(_0x416ed7){_0x2852b6[_0x7490('0x67')]=_0x416ed7[_0x7490('0x61')]({'plain':!![]});interaction_log[_0x7490('0x21')](_0x7490('0x7c'),_0x3a5e78[_0x7490('0x60')]['id'],_0x3a5e78[_0x7490('0x60')]['name'],_0x3a5e78[_0x7490('0x60')][_0x7490('0x7d')],_0x2852b6[_0x7490('0x67')]['id'],_0x3a5e78[_0x7490('0x58')]?JSON['stringify'](_0x3a5e78[_0x7490('0x58')]):_0x7490('0x69'));return respondWithRpcPromise(_0x7490('0x7e'),_0x7490('0x7f'),_0x2852b6);}return null;})['then'](function(_0x32db3c){var _0x2fd1c5=_0x7490('0x80')+_0x32db3c[_0x7490('0x28')][_0x7490('0x6b')];return db[_0x7490('0x81')]['query'](_0x2fd1c5,{'type':db['Sequelize'][_0x7490('0x82')]['SELECT'],'raw':!![]})[_0x7490('0x20')](function(_0x5ac8ad){return _0x5ac8ad;});})['then'](function(_0x457764){if(_0x457764){_0x2852b6[_0x7490('0x28')][_0x7490('0x6e')]=_0x457764[0x0];if(!_0x3a5e78['body']['UserId'])return;return db[_0x7490('0x6f')][_0x7490('0x56')]({'where':{'id':_0x3a5e78[_0x7490('0x58')][_0x7490('0x5f')],'role':'agent'},'attributes':['id',_0x7490('0x39'),_0x7490('0x71'),_0x7490('0x72'),_0x7490('0x73')],'raw':!![]});}return null;})[_0x7490('0x20')](function(_0x599bf5){if(!_0x599bf5)return null;_0x2852b6[_0x7490('0x28')][_0x7490('0x70')]=_0x599bf5;return _0x2852b6;})[_0x7490('0x20')](function(_0xd1e7dd){if(_0xd1e7dd){_0xd1e7dd[_0x7490('0x28')][_0x7490('0x75')]=util[_0x7490('0x5e')]('SIP/%s',_0x3a5e78[_0x7490('0x60')][_0x7490('0x39')]);_0xd1e7dd['message'][_0x7490('0x77')]=_0x2852b6[_0x7490('0x77')];_0xd1e7dd['message'][_0x7490('0x78')]=_0x2852b6[_0x7490('0x77')];_0xd1e7dd[_0x7490('0x28')][_0x7490('0x79')]=_0x7490('0x34');respondWithRpcPromise('EventManager',_0x7490('0x7a'),{'event':_0x7490('0x83'),'message':_0xd1e7dd[_0x7490('0x28')]},client9002);return _0x2852b6;}return null;})[_0x7490('0x20')](respondWithResult(_0x700ac3,null))['catch'](handleError(_0x700ac3,null));};exports['status']=function(_0x39e9ac,_0x5e1e5d,_0x18d77d){if(_0x39e9ac[_0x7490('0x58')]['id']){delete _0x39e9ac[_0x7490('0x58')]['id'];}var _0x232332;return db[_0x7490('0x3d')]['find']({'where':{'id':_0x39e9ac[_0x7490('0x54')]['id']}})['then'](handleEntityNotFound(_0x5e1e5d,null))['then'](function(_0x166857){if(_0x166857){_0x232332=_0x166857;return db[_0x7490('0x84')][_0x7490('0x56')]({'where':{'id':_0x166857[_0x7490('0x85')]}});}})['then'](handleEntityNotFound(_0x5e1e5d,null))[_0x7490('0x20')](function(_0x24dca1){if(_0x24dca1){logger[_0x7490('0x86')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x7490('0x2b'),_0x7490('0x87'),_0x24dca1[_0x7490('0x88')],util[_0x7490('0x89')](_0x39e9ac[_0x7490('0x58')],{'showHidden':![],'depth':null}));switch(_0x24dca1['type']){case _0x7490('0x8a'):if(_0x39e9ac[_0x7490('0x58')]['MessageSid']&&_0x39e9ac[_0x7490('0x58')][_0x7490('0x8b')]===_0x232332['messageId']&&_0x39e9ac['body']['MessageStatus']&&_0x39e9ac[_0x7490('0x58')][_0x7490('0x8c')]===_0x7490('0x5c')){return _0x232332[_0x7490('0x35')]({'read':!![]});}else{logger[_0x7490('0x26')](_0x7490('0x8d'),_0x7490('0x2b'),'twilio',util[_0x7490('0x89')](_0x39e9ac[_0x7490('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x232332;}})[_0x7490('0x20')](respondWithResult(_0x5e1e5d,null))['catch'](handleError(_0x5e1e5d,null));}; \ No newline at end of file +var _0xe298=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','sendStatus','stack','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','name','keys','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','show','params','length','include','options','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x1e5330,_0x2404eb){var _0x20376f=function(_0x34364b){while(--_0x34364b){_0x1e5330['push'](_0x1e5330['shift']());}};_0x20376f(++_0x2404eb);}(_0xe298,0x82));var _0x8e29=function(_0x139cdf,_0x2897cd){_0x139cdf=_0x139cdf-0x0;var _0x2e8d=_0xe298[_0x139cdf];return _0x2e8d;};'use strict';var emlformat=require(_0x8e29('0x0'));var rimraf=require(_0x8e29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e29('0x2'));var rp=require('request-promise');var moment=require(_0x8e29('0x3'));var BPromise=require(_0x8e29('0x4'));var Mustache=require(_0x8e29('0x5'));var util=require(_0x8e29('0x6'));var path=require(_0x8e29('0x7'));var sox=require(_0x8e29('0x8'));var csv=require(_0x8e29('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e29('0xa'));var _=require(_0x8e29('0xb'));var squel=require(_0x8e29('0xc'));var crypto=require(_0x8e29('0xd'));var jsforce=require(_0x8e29('0xe'));var deskjs=require(_0x8e29('0xf'));var toCsv=require(_0x8e29('0x9'));var querystring=require('querystring');var Papa=require(_0x8e29('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8e29('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8e29('0x12'));var utils=require(_0x8e29('0x13'));var config=require(_0x8e29('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e29('0x15'))['db'];config['redis']=_['defaults'](config[_0x8e29('0x16')],{'host':_0x8e29('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e29('0x16')]));require(_0x8e29('0x18'))[_0x8e29('0x19')](socket);var jayson=require(_0x8e29('0x1a'));var client=jayson[_0x8e29('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x8e29('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x169a20,_0x11b9e9,_0x2fc688,_0x5c2c06){return new BPromise(function(_0x24c786,_0x3b107e){var _0x1988cd=_0x5c2c06||client;return _0x1988cd[_0x8e29('0x1d')](_0x169a20,_0x2fc688)[_0x8e29('0x1e')](function(_0xa8da11){logger[_0x8e29('0x1f')](_0x8e29('0x20'),_0x11b9e9,'request\x20sent');logger[_0x8e29('0x21')](_0x8e29('0x22'),_0x11b9e9,_0x8e29('0x23'),JSON['stringify'](_0xa8da11));if(_0xa8da11['error']){if(_0xa8da11[_0x8e29('0x24')]['code']===0x1f4){logger[_0x8e29('0x24')](_0x8e29('0x20'),_0x11b9e9,_0xa8da11[_0x8e29('0x24')][_0x8e29('0x25')]);return _0x3b107e(_0xa8da11[_0x8e29('0x24')][_0x8e29('0x25')]);}logger['error'](_0x8e29('0x20'),_0x11b9e9,_0xa8da11[_0x8e29('0x24')][_0x8e29('0x25')]);return _0x24c786(_0xa8da11[_0x8e29('0x24')]['message']);}else{logger[_0x8e29('0x1f')](_0x8e29('0x20'),_0x11b9e9,'request\x20sent');_0x24c786(_0xa8da11[_0x8e29('0x26')]['message']);}})[_0x8e29('0x27')](function(_0xf88f28){logger[_0x8e29('0x24')](_0x8e29('0x20'),_0x11b9e9,_0xf88f28);_0x3b107e(_0xf88f28);});});}function respondWithStatusCode(_0x181748,_0x553293){_0x553293=_0x553293||0xcc;return function(_0x507fea){if(_0x507fea){return _0x181748['sendStatus'](_0x553293);}return _0x181748[_0x8e29('0x28')](_0x553293)[_0x8e29('0x29')]();};}function respondWithResult(_0x370d10,_0x1c9064){_0x1c9064=_0x1c9064||0xc8;return function(_0x5cc1d1){if(_0x5cc1d1){return _0x370d10[_0x8e29('0x28')](_0x1c9064)[_0x8e29('0x2a')](_0x5cc1d1);}};}function respondWithFilteredResult(_0x20abcf,_0xcd200f){return function(_0x5109b8){if(_0x5109b8){var _0x3c1814=typeof _0xcd200f[_0x8e29('0x2b')]===_0x8e29('0x2c')&&typeof _0xcd200f[_0x8e29('0x2d')]===_0x8e29('0x2c');var _0x20d1b5=_0x5109b8['count'];var _0x30d877=_0x3c1814?0x0:_0xcd200f['offset'];var _0x3f1e2b=_0x3c1814?_0x5109b8[_0x8e29('0x2e')]:_0xcd200f[_0x8e29('0x2b')]+_0xcd200f['limit'];var _0x4246a4;if(_0x3f1e2b>=_0x20d1b5){_0x3f1e2b=_0x20d1b5;_0x4246a4=0xc8;}else{_0x4246a4=0xce;}_0x20abcf[_0x8e29('0x28')](_0x4246a4);return _0x20abcf['set'](_0x8e29('0x2f'),_0x30d877+'-'+_0x3f1e2b+'/'+_0x20d1b5)[_0x8e29('0x2a')](_0x5109b8);}return null;};}function patchUpdates(_0x3853c0){return function(_0x586d54){try{jsonpatch['apply'](_0x586d54,_0x3853c0,!![]);}catch(_0x19abb8){return BPromise[_0x8e29('0x30')](_0x19abb8);}return _0x586d54[_0x8e29('0x31')]();};}function saveUpdates(_0x8e81c1,_0x3d9b60){return function(_0x2c0154){if(_0x2c0154){return _0x2c0154[_0x8e29('0x32')](_0x8e81c1)['then'](function(_0x346f58){return _0x346f58;});}return null;};}function removeEntity(_0x96868e,_0x32d4e3){return function(_0x1483b0){if(_0x1483b0){return _0x1483b0[_0x8e29('0x33')]()[_0x8e29('0x1e')](function(){_0x96868e[_0x8e29('0x28')](0xcc)[_0x8e29('0x29')]();});}};}function handleEntityNotFound(_0x421945,_0x592c52){return function(_0x5cddd0){if(!_0x5cddd0){_0x421945[_0x8e29('0x34')](0x194);}return _0x5cddd0;};}function handleError(_0x50ae67,_0x4a0097){_0x4a0097=_0x4a0097||0x1f4;return function(_0x2ca1e3){logger[_0x8e29('0x24')](_0x2ca1e3[_0x8e29('0x35')]);if(_0x2ca1e3['name']){delete _0x2ca1e3['name'];}_0x50ae67[_0x8e29('0x28')](_0x4a0097)[_0x8e29('0x36')](_0x2ca1e3);};}exports[_0x8e29('0x37')]=function(_0x100b71,_0x2adbfd){var _0x555054={},_0x26496a={},_0x5e81e0={'count':0x0,'rows':[]};var _0x20c1d2=_[_0x8e29('0x38')](db[_0x8e29('0x39')][_0x8e29('0x3a')],function(_0x2e949c){return{'name':_0x2e949c[_0x8e29('0x3b')],'type':_0x2e949c[_0x8e29('0x3c')][_0x8e29('0x3d')]};});_0x26496a['model']=_[_0x8e29('0x38')](_0x20c1d2,_0x8e29('0x3e'));_0x26496a['query']=_[_0x8e29('0x3f')](_0x100b71[_0x8e29('0x40')]);_0x26496a['filters']=_[_0x8e29('0x41')](_0x26496a[_0x8e29('0x42')],_0x26496a[_0x8e29('0x40')]);_0x555054['attributes']=_['intersection'](_0x26496a[_0x8e29('0x42')],qs[_0x8e29('0x43')](_0x100b71[_0x8e29('0x40')][_0x8e29('0x43')]));_0x555054[_0x8e29('0x44')]=_0x555054['attributes']['length']?_0x555054[_0x8e29('0x44')]:_0x26496a[_0x8e29('0x42')];if(!_0x100b71[_0x8e29('0x40')][_0x8e29('0x45')](_0x8e29('0x46'))){_0x555054[_0x8e29('0x2d')]=qs['limit'](_0x100b71[_0x8e29('0x40')][_0x8e29('0x2d')]);_0x555054[_0x8e29('0x2b')]=qs[_0x8e29('0x2b')](_0x100b71[_0x8e29('0x40')]['offset']);}_0x555054[_0x8e29('0x47')]=qs[_0x8e29('0x48')](_0x100b71[_0x8e29('0x40')][_0x8e29('0x48')]);_0x555054[_0x8e29('0x49')]=qs['filters'](_['pick'](_0x100b71[_0x8e29('0x40')],_0x26496a[_0x8e29('0x4a')]),_0x20c1d2);if(_0x100b71['query'][_0x8e29('0x4b')]){_0x555054[_0x8e29('0x49')]=_[_0x8e29('0x4c')](_0x555054[_0x8e29('0x49')],{'$or':_[_0x8e29('0x38')](_0x20c1d2,function(_0x55e394){if(_0x55e394['type']!==_0x8e29('0x4d')){var _0x63ac65={};_0x63ac65[_0x55e394[_0x8e29('0x3e')]]={'$like':'%'+_0x100b71[_0x8e29('0x40')]['filter']+'%'};return _0x63ac65;}})});}_0x555054=_[_0x8e29('0x4c')]({},_0x555054,_0x100b71['options']);var _0x52e743={'where':_0x555054['where']};return db[_0x8e29('0x39')][_0x8e29('0x2e')](_0x52e743)[_0x8e29('0x1e')](function(_0x3a230c){_0x5e81e0['count']=_0x3a230c;if(_0x100b71[_0x8e29('0x40')][_0x8e29('0x4e')]){_0x555054['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x555054);})[_0x8e29('0x1e')](function(_0x76a9d4){_0x5e81e0['rows']=_0x76a9d4;return _0x5e81e0;})[_0x8e29('0x1e')](respondWithFilteredResult(_0x2adbfd,_0x555054))[_0x8e29('0x27')](handleError(_0x2adbfd,null));};exports[_0x8e29('0x4f')]=function(_0x5460d2,_0x49083e){var _0xc204a2={'raw':!![],'where':{'id':_0x5460d2[_0x8e29('0x50')]['id']}},_0x26854f={};_0x26854f[_0x8e29('0x42')]=_[_0x8e29('0x3f')](db[_0x8e29('0x39')][_0x8e29('0x3a')]);_0x26854f['query']=_[_0x8e29('0x3f')](_0x5460d2[_0x8e29('0x40')]);_0x26854f['filters']=_[_0x8e29('0x41')](_0x26854f[_0x8e29('0x42')],_0x26854f[_0x8e29('0x40')]);_0xc204a2[_0x8e29('0x44')]=_[_0x8e29('0x41')](_0x26854f['model'],qs[_0x8e29('0x43')](_0x5460d2[_0x8e29('0x40')][_0x8e29('0x43')]));_0xc204a2['attributes']=_0xc204a2['attributes'][_0x8e29('0x51')]?_0xc204a2[_0x8e29('0x44')]:_0x26854f[_0x8e29('0x42')];if(_0x5460d2[_0x8e29('0x40')][_0x8e29('0x4e')]){_0xc204a2[_0x8e29('0x52')]=[{'all':!![]}];}_0xc204a2=_[_0x8e29('0x4c')]({},_0xc204a2,_0x5460d2[_0x8e29('0x53')]);return db[_0x8e29('0x39')][_0x8e29('0x54')](_0xc204a2)['then'](handleEntityNotFound(_0x49083e,null))[_0x8e29('0x1e')](respondWithResult(_0x49083e,null))[_0x8e29('0x27')](handleError(_0x49083e,null));};exports[_0x8e29('0x55')]=function(_0x26a2bb,_0x4462c3){return db[_0x8e29('0x39')][_0x8e29('0x55')](_0x26a2bb['body'],{})['then'](respondWithResult(_0x4462c3,0xc9))[_0x8e29('0x27')](handleError(_0x4462c3,null));};exports['update']=function(_0x15267b,_0x4ac357){if(_0x15267b[_0x8e29('0x56')]['id']){delete _0x15267b[_0x8e29('0x56')]['id'];}return db['WhatsappMessage'][_0x8e29('0x54')]({'where':{'id':_0x15267b['params']['id']}})[_0x8e29('0x1e')](handleEntityNotFound(_0x4ac357,null))[_0x8e29('0x1e')](saveUpdates(_0x15267b[_0x8e29('0x56')],null))['then'](respondWithResult(_0x4ac357,null))[_0x8e29('0x27')](handleError(_0x4ac357,null));};exports[_0x8e29('0x33')]=function(_0x222b50,_0x3f0fd2){return db['WhatsappMessage'][_0x8e29('0x54')]({'where':{'id':_0x222b50['params']['id']}})[_0x8e29('0x1e')](handleEntityNotFound(_0x3f0fd2,null))['then'](removeEntity(_0x3f0fd2,null))[_0x8e29('0x27')](handleError(_0x3f0fd2,null));};exports['describe']=function(_0x1fa33c,_0x4585bd){return db[_0x8e29('0x39')][_0x8e29('0x57')]()[_0x8e29('0x1e')](respondWithResult(_0x4585bd,null))['catch'](handleError(_0x4585bd,null));};var interaction_log=require(_0x8e29('0x58'))(_0x8e29('0x59'));exports[_0x8e29('0x5a')]=function(_0xfed8fd,_0x1c1ce7,_0x30bc63){var _0x43b1e2={'agent':{},'channel':_0x8e29('0x5b')};if(_0xfed8fd[_0x8e29('0x56')]['id']){delete _0xfed8fd[_0x8e29('0x56')]['id'];}_0xfed8fd[_0x8e29('0x56')]['read']=!![];_0xfed8fd[_0x8e29('0x56')][_0x8e29('0x5c')]=moment()[_0x8e29('0x5d')](_0x8e29('0x5e'));_0xfed8fd[_0x8e29('0x56')]['UserId']=_0xfed8fd[_0x8e29('0x56')]['UserId']||_0xfed8fd[_0x8e29('0x5f')]['id'];_0x43b1e2[_0x8e29('0x60')]['id']=_0xfed8fd[_0x8e29('0x56')][_0x8e29('0x61')];return db['WhatsappMessage']['find']({'where':{'id':_0xfed8fd[_0x8e29('0x50')]['id'],'UserId':null}})[_0x8e29('0x1e')](handleEntityNotFound(_0x1c1ce7,null))[_0x8e29('0x1e')](saveUpdates(_0xfed8fd[_0x8e29('0x56')],null))[_0x8e29('0x1e')](function(_0x1778f7){if(_0x1778f7){_0x43b1e2[_0x8e29('0x25')]=_0x1778f7[_0x8e29('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x8e29('0x54')]({'where':{'id':_0x1778f7[_0x8e29('0x63')]}});}return null;})[_0x8e29('0x1e')](handleEntityNotFound(_0x1c1ce7,null))[_0x8e29('0x1e')](function(_0x40cef6){if(_0x40cef6){return _0x40cef6[_0x8e29('0x32')]({'UserId':_0xfed8fd[_0x8e29('0x56')][_0x8e29('0x61')],'read1stAt':_[_0x8e29('0x64')](_0x40cef6[_0x8e29('0x65')])?moment()[_0x8e29('0x5d')](_0x8e29('0x5e')):undefined});}return null;})[_0x8e29('0x1e')](function(_0x384752){if(_0x384752){_0x43b1e2[_0x8e29('0x66')]=_0x384752['get']({'plain':!![]});interaction_log[_0x8e29('0x1f')](_0x8e29('0x67'),_0xfed8fd[_0x8e29('0x5f')]['id'],_0xfed8fd[_0x8e29('0x5f')][_0x8e29('0x3e')],_0xfed8fd[_0x8e29('0x5f')]['role'],_0x43b1e2[_0x8e29('0x66')]['id'],_0xfed8fd['body']?JSON['stringify'](_0xfed8fd[_0x8e29('0x56')]):_0x8e29('0x68'));return respondWithRpcPromise(_0x8e29('0x69'),_0x8e29('0x6a'),_0x43b1e2);}return null;})[_0x8e29('0x1e')](function(_0x269b4c){var _0x4ce7a5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x269b4c[_0x8e29('0x25')]['ContactId'];return db[_0x8e29('0x6b')][_0x8e29('0x40')](_0x4ce7a5,{'type':db[_0x8e29('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x8e29('0x1e')](function(_0x12867f){return _0x12867f;});})[_0x8e29('0x1e')](function(_0x44d866){if(_0x44d866){_0x43b1e2[_0x8e29('0x25')][_0x8e29('0x6d')]=_0x44d866[0x0];if(!_0xfed8fd[_0x8e29('0x56')][_0x8e29('0x61')])return;return db[_0x8e29('0x6e')][_0x8e29('0x54')]({'where':{'id':_0xfed8fd[_0x8e29('0x56')][_0x8e29('0x61')],'role':_0x8e29('0x60')},'attributes':['id',_0x8e29('0x3e'),_0x8e29('0x6f'),_0x8e29('0x70'),_0x8e29('0x71')],'raw':!![]});}return null;})[_0x8e29('0x1e')](function(_0x4d88b8){if(!_0x4d88b8)return null;_0x43b1e2[_0x8e29('0x25')][_0x8e29('0x60')]=_0x4d88b8;return _0x43b1e2;})[_0x8e29('0x1e')](function(_0x1420e1){if(_0x1420e1){if(_0xfed8fd['body'][_0x8e29('0x72')]){_0x43b1e2[_0x8e29('0x25')][_0x8e29('0x73')]=util[_0x8e29('0x5d')](_0x8e29('0x74'),_0xfed8fd[_0x8e29('0x5f')][_0x8e29('0x3e')]);_0x43b1e2[_0x8e29('0x25')][_0x8e29('0x75')]=_0x43b1e2[_0x8e29('0x75')];_0x43b1e2['message'][_0x8e29('0x76')]=_0x43b1e2[_0x8e29('0x75')];_0x43b1e2[_0x8e29('0x25')]['event']=_0x8e29('0x5a');return respondWithRpcPromise(_0x8e29('0x77'),_0x8e29('0x77'),{'event':_0x8e29('0x78'),'message':_0x43b1e2[_0x8e29('0x25')]},client9002)[_0x8e29('0x1e')](function(){return _0x43b1e2;});}return _0x43b1e2;}return null;})[_0x8e29('0x1e')](respondWithResult(_0x1c1ce7,null))[_0x8e29('0x27')](handleError(_0x1c1ce7,null));};var interaction_log=require(_0x8e29('0x58'))(_0x8e29('0x59'));exports['reject']=function(_0x3edc38,_0x213994,_0x66b802){var _0x3e8a08={'agent':{},'channel':'whatsapp'};if(_0x3edc38[_0x8e29('0x56')]['id']){delete _0x3edc38[_0x8e29('0x56')]['id'];}_0x3edc38[_0x8e29('0x56')][_0x8e29('0x61')]=_0x3edc38[_0x8e29('0x56')][_0x8e29('0x61')]||_0x3edc38[_0x8e29('0x5f')]['id'];_0x3e8a08[_0x8e29('0x60')]['id']=_0x3edc38[_0x8e29('0x56')][_0x8e29('0x61')];return db['WhatsappMessage'][_0x8e29('0x54')]({'where':{'id':_0x3edc38[_0x8e29('0x50')]['id'],'UserId':null}})[_0x8e29('0x1e')](handleEntityNotFound(_0x213994,null))['then'](function(_0x4b3167){if(_0x4b3167){_0x3e8a08['message']=_0x4b3167[_0x8e29('0x62')]({'plain':!![]});return db[_0x8e29('0x79')][_0x8e29('0x54')]({'where':{'id':_0x4b3167[_0x8e29('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x213994,null))[_0x8e29('0x1e')](function(_0x4eee88){if(_0x4eee88){_0x3e8a08[_0x8e29('0x66')]=_0x4eee88[_0x8e29('0x62')]({'plain':!![]});interaction_log[_0x8e29('0x1f')](_0x8e29('0x7a'),_0x3edc38[_0x8e29('0x5f')]['id'],_0x3edc38[_0x8e29('0x5f')][_0x8e29('0x3e')],_0x3edc38[_0x8e29('0x5f')]['role'],_0x3e8a08[_0x8e29('0x66')]['id'],_0x3edc38['body']?JSON[_0x8e29('0x7b')](_0x3edc38[_0x8e29('0x56')]):_0x8e29('0x68'));return respondWithRpcPromise('RejectMessage',_0x8e29('0x7c'),_0x3e8a08);}return null;})[_0x8e29('0x1e')](function(_0x61fba2){var _0x468aeb=_0x8e29('0x7d')+_0x61fba2[_0x8e29('0x25')][_0x8e29('0x7e')];return db[_0x8e29('0x6b')][_0x8e29('0x40')](_0x468aeb,{'type':db['Sequelize'][_0x8e29('0x7f')]['SELECT'],'raw':!![]})[_0x8e29('0x1e')](function(_0x5a214a){return _0x5a214a;});})[_0x8e29('0x1e')](function(_0x327b4d){if(_0x327b4d){_0x3e8a08[_0x8e29('0x25')][_0x8e29('0x6d')]=_0x327b4d[0x0];if(!_0x3edc38[_0x8e29('0x56')]['UserId'])return;return db[_0x8e29('0x6e')][_0x8e29('0x54')]({'where':{'id':_0x3edc38[_0x8e29('0x56')]['UserId'],'role':_0x8e29('0x60')},'attributes':['id',_0x8e29('0x3e'),_0x8e29('0x6f'),_0x8e29('0x70'),_0x8e29('0x71')],'raw':!![]});}return null;})[_0x8e29('0x1e')](function(_0x2e6c3c){if(!_0x2e6c3c)return null;_0x3e8a08[_0x8e29('0x25')]['agent']=_0x2e6c3c;return _0x3e8a08;})[_0x8e29('0x1e')](function(_0x17f70f){if(_0x17f70f){_0x17f70f[_0x8e29('0x25')][_0x8e29('0x73')]=util['format']('SIP/%s',_0x3edc38[_0x8e29('0x5f')]['name']);_0x17f70f[_0x8e29('0x25')]['channel']=_0x3e8a08[_0x8e29('0x75')];_0x17f70f['message'][_0x8e29('0x76')]=_0x3e8a08['channel'];_0x17f70f[_0x8e29('0x25')]['event']='reject';respondWithRpcPromise(_0x8e29('0x77'),_0x8e29('0x77'),{'event':_0x8e29('0x80'),'message':_0x17f70f[_0x8e29('0x25')]},client9002);return _0x3e8a08;}return null;})[_0x8e29('0x1e')](respondWithResult(_0x213994,null))['catch'](handleError(_0x213994,null));};exports['status']=function(_0x8bdacd,_0x40bc33,_0x4f4246){if(_0x8bdacd['body']['id']){delete _0x8bdacd['body']['id'];}var _0xacec1b;return db[_0x8e29('0x39')][_0x8e29('0x54')]({'where':{'id':_0x8bdacd[_0x8e29('0x50')]['id']}})[_0x8e29('0x1e')](handleEntityNotFound(_0x40bc33,null))[_0x8e29('0x1e')](function(_0x32f766){if(_0x32f766){_0xacec1b=_0x32f766;return db[_0x8e29('0x81')][_0x8e29('0x54')]({'where':{'id':_0x32f766[_0x8e29('0x82')]}});}})[_0x8e29('0x1e')](handleEntityNotFound(_0x40bc33,null))[_0x8e29('0x1e')](function(_0x39252c){if(_0x39252c){logger['debug'](_0x8e29('0x83'),_0x8e29('0x28'),_0x8e29('0x84'),_0x39252c[_0x8e29('0x3c')],util[_0x8e29('0x85')](_0x8bdacd[_0x8e29('0x56')],{'showHidden':![],'depth':null}));switch(_0x39252c[_0x8e29('0x3c')]){case _0x8e29('0x86'):if(_0x8bdacd[_0x8e29('0x56')]['MessageSid']&&_0x8bdacd[_0x8e29('0x56')][_0x8e29('0x87')]===_0xacec1b[_0x8e29('0x88')]&&_0x8bdacd[_0x8e29('0x56')][_0x8e29('0x89')]&&_0x8bdacd[_0x8e29('0x56')][_0x8e29('0x89')]===_0x8e29('0x8a')){return _0xacec1b[_0x8e29('0x32')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x8e29('0x86'),util[_0x8e29('0x85')](_0x8bdacd[_0x8e29('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xacec1b;}})[_0x8e29('0x1e')](respondWithResult(_0x40bc33,null))[_0x8e29('0x27')](handleError(_0x40bc33,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c76a28b..7699f34 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 _0xc29b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','save','update'];(function(_0x4f485f,_0x1db0f7){var _0x1e998e=function(_0x14066c){while(--_0x14066c){_0x4f485f['push'](_0x4f485f['shift']());}};_0x1e998e(++_0x1db0f7);}(_0xc29b,0x12d));var _0xbc29=function(_0x57d7d3,_0xd490a9){_0x57d7d3=_0x57d7d3-0x0;var _0x2ad9b2=_0xc29b[_0x57d7d3];return _0x2ad9b2;};'use strict';var EventEmitter=require(_0xbc29('0x0'));var WhatsappMessage=require(_0xbc29('0x1'))['db'][_0xbc29('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc29('0x3'),'afterUpdate':_0xbc29('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3032cb){return function(_0x294a45,_0x217922,_0xa365e8){WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb+':'+_0x294a45['id'],_0x294a45);WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb,_0x294a45);_0xa365e8(null);};}for(var e in events){if(events[_0xbc29('0x6')](e)){var event=events[e];WhatsappMessage[_0xbc29('0x7')](e,emitEvent(event));}}module[_0xbc29('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5eb1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappMessage'];(function(_0xf088cb,_0x224833){var _0x1ab411=function(_0x26f8be){while(--_0x26f8be){_0xf088cb['push'](_0xf088cb['shift']());}};_0x1ab411(++_0x224833);}(_0x5eb1,0x7c));var _0x15eb=function(_0x5f4abc,_0x1692ac){_0x5f4abc=_0x5f4abc-0x0;var _0x3c29a6=_0x5eb1[_0x5f4abc];return _0x3c29a6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x15eb('0x0'))['db'][_0x15eb('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x15eb('0x2')](0x0);var events={'afterCreate':_0x15eb('0x3'),'afterUpdate':_0x15eb('0x4'),'afterDestroy':_0x15eb('0x5')};function emitEvent(_0x5e1142){return function(_0x3ba774,_0x19d816,_0x1f38c6){WhatsappMessageEvents[_0x15eb('0x6')](_0x5e1142+':'+_0x3ba774['id'],_0x3ba774);WhatsappMessageEvents['emit'](_0x5e1142,_0x3ba774);_0x1f38c6(null);};}for(var e in events){if(events[_0x15eb('0x7')](e)){var event=events[e];WhatsappMessage[_0x15eb('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a6ba5ef..cff42a5 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 _0xebe0=['UserId','WhatsappInteraction','then','createdAt','error','WhatsappAccount','find','WhatsappAccountId','twilio','accountSid','authToken','phone','create','body','whatsapp:','remote','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','catch','err','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0xebe0,0x16f));var _0x0ebe=function(_0x65ae52,_0x4d7408){_0x65ae52=_0x65ae52-0x0;var _0xfbd161=_0xebe0[_0x65ae52];return _0xfbd161;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ebe('0x0'))('api');var moment=require(_0x0ebe('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x0ebe('0x2'));var fs=require('fs');var path=require(_0x0ebe('0x3'));var rimraf=require(_0x0ebe('0x4'));var config=require(_0x0ebe('0x5'));var attributes=require(_0x0ebe('0x6'));module[_0x0ebe('0x7')]=function(_0x37c327,_0x355735){return _0x37c327[_0x0ebe('0x8')]('WhatsappMessage',attributes,{'tableName':_0x0ebe('0x9'),'paranoid':![],'indexes':[{'name':_0x0ebe('0xa'),'fields':[_0x0ebe('0xa')]},{'name':_0x0ebe('0xb'),'fields':['body'],'type':_0x0ebe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f7380,_0x2628d3,_0xdf91b8){var _0x54dcd0=_0x37c327['models'];var _0x407a3e=_0x4f7380['get']({'plain':!![]});if(_0x407a3e[_0x0ebe('0xd')]['toLowerCase']()==='in'||_0x407a3e[_0x0ebe('0xd')][_0x0ebe('0xe')]()===_0x0ebe('0xf')&&!_0x407a3e[_0x0ebe('0x10')]&&!_[_0x0ebe('0x11')](_0x407a3e[_0x0ebe('0x12')])){_0x54dcd0[_0x0ebe('0x13')]['findOne']({'where':{'id':_0x407a3e['WhatsappInteractionId']}})[_0x0ebe('0x14')](function(_0x503e8f){if(_0x503e8f){_0x503e8f['update']({'lastMsgAt':_0x407a3e[_0x0ebe('0x15')],'lastMsgDirection':_0x407a3e[_0x0ebe('0xd')][_0x0ebe('0xe')]()});}})['catch'](function(_0x34717c){console[_0x0ebe('0x16')](_0x34717c);});}if(_0x407a3e[_0x0ebe('0xd')]===_0x0ebe('0xf')&&!_0x407a3e[_0x0ebe('0x10')]){var _0x260792;_0x54dcd0[_0x0ebe('0x17')][_0x0ebe('0x18')]({'where':{'id':_0x407a3e[_0x0ebe('0x19')]},'raw':!![]})['then'](function(_0x44b6f8){_0x260792=_0x44b6f8;if(_0x260792&&_0x260792['type']){switch(_0x260792['type']){case _0x0ebe('0x1a'):var _0x33e605=require(_0x0ebe('0x1a'));if(_0x260792[_0x0ebe('0x1b')]&&_0x260792[_0x0ebe('0x1c')]&&_0x260792[_0x0ebe('0x1d')]){var _0x5122d9=new _0x33e605(_0x260792['accountSid'],_0x260792[_0x0ebe('0x1c')]);_0x5122d9['messages'][_0x0ebe('0x1e')]({'body':_0x407a3e[_0x0ebe('0x1f')],'to':_0x0ebe('0x20')+_0x407a3e[_0x0ebe('0x1d')],'from':_0x0ebe('0x20')+_0x260792['phone'],'statusCallback':_0x260792[_0x0ebe('0x21')]+'/api/whatsapp/messages/'+_0x407a3e['id']+'/status?token='+_0x260792[_0x0ebe('0x22')]})[_0x0ebe('0x14')](function(_0x429059){if(_0x429059[_0x0ebe('0x23')]){return _0x4f7380[_0x0ebe('0x24')]({'messageId':_0x429059[_0x0ebe('0x23')]});}})['catch'](function(_0x122b24){logger[_0x0ebe('0x16')](_0x0ebe('0x25'),_0x0ebe('0x26'),_0x0ebe('0x1a'),util['inspect'](_0x122b24,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0ebe('0x25'),_0x0ebe('0x26'),'twilio',_0x0ebe('0x27'));}break;case _0x0ebe('0x28'):var _0x48489f=_0x260792[_0x0ebe('0x1b')];var _0xe3492c=_0x260792[_0x0ebe('0x1c')];var _0x590a45=_0x260792[_0x0ebe('0x29')]+_0x0ebe('0x2a')+_0x48489f+_0x0ebe('0x2b');var _0x3750a2={'to':[_0x407a3e[_0x0ebe('0x1d')]],'message':{'type':_0x0ebe('0x2c'),'text':_0x407a3e[_0x0ebe('0x1f')]}};var _0xc84917={'method':_0x0ebe('0x2d'),'uri':_0x590a45,'headers':{'Authorization':_0x0ebe('0x2e')+_0xe3492c,'Content-Type':_0x0ebe('0x2f')},'body':_0x3750a2,'json':!![]};rp(_0xc84917)[_0x0ebe('0x14')](function(_0x490ead){if(_0x490ead[_0x0ebe('0x30')][0x0]['message_id']){return _0x4f7380[_0x0ebe('0x24')]({'messageId':_0x490ead[_0x0ebe('0x30')][0x0][_0x0ebe('0x31')]});}})[_0x0ebe('0x32')](function(_0x42ec11){logger[_0x0ebe('0x33')]('WhatsappMessage,\x20%s',_0x42ec11);});break;}}})[_0x0ebe('0x34')](function(){_0xdf91b8();});}else{_0xdf91b8();}}},'charset':_0x0ebe('0x35'),'collate':_0x0ebe('0x36')});}; \ No newline at end of file +var _0x0810=['isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','update','statuses','message_id','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','node-fetch','../../config/environment','exports','WhatsappMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','secret'];(function(_0x143019,_0x3a3d14){var _0x57dffc=function(_0x37a47e){while(--_0x37a47e){_0x143019['push'](_0x143019['shift']());}};_0x57dffc(++_0x3a3d14);}(_0x0810,0x95));var _0x0081=function(_0xdc6c34,_0x4d3202){_0xdc6c34=_0xdc6c34-0x0;var _0x1cb4d9=_0x0810[_0xdc6c34];return _0x1cb4d9;};'use strict';var _=require(_0x0081('0x0'));var util=require(_0x0081('0x1'));var logger=require(_0x0081('0x2'))(_0x0081('0x3'));var moment=require(_0x0081('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x0081('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0081('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0x0081('0x7')]=function(_0x5e90a5,_0x5d17fb){return _0x5e90a5['define'](_0x0081('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0081('0x9')]},{'name':'fti_whatsapp_messages','fields':[_0x0081('0xa')],'type':_0x0081('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x322360,_0x3d8088,_0x5a1251){var _0x24378e=_0x5e90a5['models'];var _0x2f9fa5=_0x322360[_0x0081('0xc')]({'plain':!![]});if(_0x2f9fa5['direction']['toLowerCase']()==='in'||_0x2f9fa5[_0x0081('0xd')][_0x0081('0xe')]()==='out'&&!_0x2f9fa5[_0x0081('0xf')]&&!_[_0x0081('0x10')](_0x2f9fa5[_0x0081('0x11')])){_0x24378e[_0x0081('0x12')][_0x0081('0x13')]({'where':{'id':_0x2f9fa5['WhatsappInteractionId']}})[_0x0081('0x14')](function(_0x8c61a){if(_0x8c61a){_0x8c61a['update']({'lastMsgAt':_0x2f9fa5[_0x0081('0x15')],'lastMsgDirection':_0x2f9fa5[_0x0081('0xd')][_0x0081('0xe')]()});}})[_0x0081('0x16')](function(_0x144b04){console[_0x0081('0x17')](_0x144b04);});}if(_0x2f9fa5['direction']==='out'&&!_0x2f9fa5[_0x0081('0xf')]){var _0x10df08;_0x24378e[_0x0081('0x18')][_0x0081('0x19')]({'where':{'id':_0x2f9fa5[_0x0081('0x1a')]},'raw':!![]})['then'](function(_0x15e653){_0x10df08=_0x15e653;if(_0x10df08&&_0x10df08[_0x0081('0x1b')]){switch(_0x10df08[_0x0081('0x1b')]){case _0x0081('0x1c'):var _0x14e414=require('twilio');if(_0x10df08[_0x0081('0x1d')]&&_0x10df08[_0x0081('0x1e')]&&_0x10df08[_0x0081('0x1f')]){var _0x58cacc=new _0x14e414(_0x10df08[_0x0081('0x1d')],_0x10df08[_0x0081('0x1e')]);_0x58cacc['messages'][_0x0081('0x20')]({'body':_0x2f9fa5[_0x0081('0xa')],'to':_0x0081('0x21')+_0x2f9fa5[_0x0081('0x1f')],'from':_0x0081('0x21')+_0x10df08['phone'],'statusCallback':_0x10df08[_0x0081('0x22')]+'/api/whatsapp/messages/'+_0x2f9fa5['id']+_0x0081('0x23')+_0x10df08[_0x0081('0x24')]})[_0x0081('0x14')](function(_0xc45fd6){if(_0xc45fd6[_0x0081('0x25')]){return _0x322360['update']({'messageId':_0xc45fd6['sid']});}})['catch'](function(_0xd41f1c){logger['error'](_0x0081('0x26'),_0x0081('0x27'),_0x0081('0x1c'),util['inspect'](_0xd41f1c,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0081('0x1c'),_0x0081('0x28'));}break;case _0x0081('0x29'):var _0x4f7d13=_0x10df08[_0x0081('0x1d')];var _0x419e76=_0x10df08[_0x0081('0x1e')];var _0x319338=_0x10df08[_0x0081('0x2a')]+_0x0081('0x2b')+_0x4f7d13+'/messages/';var _0x2277ce={'to':[_0x2f9fa5['phone']],'message':{'type':_0x0081('0x2c'),'text':_0x2f9fa5[_0x0081('0xa')]}};var _0x1474aa={'method':_0x0081('0x2d'),'uri':_0x319338,'headers':{'Authorization':_0x0081('0x2e')+_0x419e76,'Content-Type':_0x0081('0x2f')},'body':_0x2277ce,'json':!![]};rp(_0x1474aa)[_0x0081('0x14')](function(_0x5ed9b8){if(_0x5ed9b8['statuses'][0x0]['message_id']){return _0x322360[_0x0081('0x30')]({'messageId':_0x5ed9b8[_0x0081('0x31')][0x0][_0x0081('0x32')]});}})['catch'](function(_0x46e8d6){logger['err'](_0x0081('0x33'),_0x46e8d6);});break;}}})[_0x0081('0x34')](function(){_0x5a1251();});}else{_0x5a1251();}}},'charset':_0x0081('0x35'),'collate':_0x0081('0x36')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0bd14ac..b422c90 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 _0x6899=['debug','stringify','error','message','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','then','CreateWhatsappMessage','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6899,0x8e));var _0x9689=function(_0x546b3a,_0x5a4628){_0x546b3a=_0x546b3a-0x0;var _0x1a6e0b=_0x6899[_0x546b3a];return _0x1a6e0b;};'use strict';var _=require('lodash');var util=require(_0x9689('0x0'));var moment=require('moment');var BPromise=require(_0x9689('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9689('0x2'));var db=require(_0x9689('0x3'))['db'];var utils=require(_0x9689('0x4'));var logger=require(_0x9689('0x5'))(_0x9689('0x6'));var config=require(_0x9689('0x7'));var jayson=require(_0x9689('0x8'));var client=jayson[_0x9689('0x9')][_0x9689('0xa')]({'port':0x232a});config[_0x9689('0xb')]=_['defaults'](config[_0x9689('0xb')],{'host':_0x9689('0xc'),'port':0x18eb});var socket=require(_0x9689('0xd'))(new Redis(config[_0x9689('0xb')]));require(_0x9689('0xe'))[_0x9689('0xf')](socket);function respondWithRpcPromise(_0x21fbd3,_0x36557b,_0x2b98c7){return new BPromise(function(_0xa07d58,_0x557fba){return client['request'](_0x21fbd3,_0x2b98c7)['then'](function(_0x5e58d9){logger[_0x9689('0x10')](_0x9689('0x11'),_0x36557b,'request\x20sent');logger[_0x9689('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x36557b,'request\x20sent',JSON[_0x9689('0x13')](_0x5e58d9));if(_0x5e58d9[_0x9689('0x14')]){if(_0x5e58d9[_0x9689('0x14')]['code']===0x1f4){logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0x5e58d9[_0x9689('0x14')][_0x9689('0x15')]);return _0x557fba(_0x5e58d9[_0x9689('0x14')][_0x9689('0x15')]);}logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0x5e58d9['error'][_0x9689('0x15')]);return _0xa07d58(_0x5e58d9['error'][_0x9689('0x15')]);}else{logger[_0x9689('0x10')](_0x9689('0x11'),_0x36557b,_0x9689('0x16'));_0xa07d58(_0x5e58d9[_0x9689('0x17')][_0x9689('0x15')]);}})[_0x9689('0x18')](function(_0xc8c1a7){logger[_0x9689('0x14')](_0x9689('0x11'),_0x36557b,_0xc8c1a7);_0x557fba(_0xc8c1a7);});});}exports['CreateWhatsappMessage']=function(_0x359bf5){var _0x2d3dc0=this;return new Promise(function(_0x26541a,_0x42a43f){return db[_0x9689('0x19')][_0x9689('0x1a')](_0x359bf5[_0x9689('0x1b')],{'raw':_0x359bf5[_0x9689('0x1c')]?_0x359bf5['options'][_0x9689('0x1d')]===undefined?!![]:![]:!![]})[_0x9689('0x1e')](function(_0x182680){logger[_0x9689('0x10')]('CreateWhatsappMessage',_0x359bf5);logger[_0x9689('0x12')]('CreateWhatsappMessage',_0x359bf5,JSON['stringify'](_0x182680));_0x26541a(_0x182680);})[_0x9689('0x18')](function(_0x3cb2fd){logger[_0x9689('0x14')](_0x9689('0x1f'),_0x3cb2fd[_0x9689('0x15')],_0x359bf5);_0x42a43f(_0x2d3dc0[_0x9689('0x14')](0x1f4,_0x3cb2fd[_0x9689('0x15')]));});});}; \ No newline at end of file +var _0xc8bc=['raw','debug','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateWhatsappMessage','body','options'];(function(_0x2bd858,_0x296750){var _0x23fa0a=function(_0x4ce0a5){while(--_0x4ce0a5){_0x2bd858['push'](_0x2bd858['shift']());}};_0x23fa0a(++_0x296750);}(_0xc8bc,0xfb));var _0xcc8b=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xc8bc[_0x39106e];return _0x892aec;};'use strict';var _=require(_0xcc8b('0x0'));var util=require(_0xcc8b('0x1'));var moment=require('moment');var BPromise=require(_0xcc8b('0x2'));var rs=require(_0xcc8b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc8b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc8b('0x5'))(_0xcc8b('0x6'));var config=require(_0xcc8b('0x7'));var jayson=require(_0xcc8b('0x8'));var client=jayson[_0xcc8b('0x9')]['http']({'port':0x232a});config[_0xcc8b('0xa')]=_[_0xcc8b('0xb')](config[_0xcc8b('0xa')],{'host':_0xcc8b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc8b('0xa')]));require(_0xcc8b('0xd'))[_0xcc8b('0xe')](socket);function respondWithRpcPromise(_0x155e65,_0x21678c,_0x250321){return new BPromise(function(_0x1ca233,_0x2b170b){return client[_0xcc8b('0xf')](_0x155e65,_0x250321)[_0xcc8b('0x10')](function(_0x35c1b8){logger['info'](_0xcc8b('0x11'),_0x21678c,'request\x20sent');logger['debug'](_0xcc8b('0x12'),_0x21678c,_0xcc8b('0x13'),JSON[_0xcc8b('0x14')](_0x35c1b8));if(_0x35c1b8['error']){if(_0x35c1b8[_0xcc8b('0x15')][_0xcc8b('0x16')]===0x1f4){logger['error'](_0xcc8b('0x11'),_0x21678c,_0x35c1b8[_0xcc8b('0x15')][_0xcc8b('0x17')]);return _0x2b170b(_0x35c1b8[_0xcc8b('0x15')][_0xcc8b('0x17')]);}logger[_0xcc8b('0x15')](_0xcc8b('0x11'),_0x21678c,_0x35c1b8['error'][_0xcc8b('0x17')]);return _0x1ca233(_0x35c1b8['error'][_0xcc8b('0x17')]);}else{logger['info'](_0xcc8b('0x11'),_0x21678c,_0xcc8b('0x13'));_0x1ca233(_0x35c1b8[_0xcc8b('0x18')]['message']);}})['catch'](function(_0x28d5d8){logger['error'](_0xcc8b('0x11'),_0x21678c,_0x28d5d8);_0x2b170b(_0x28d5d8);});});}exports[_0xcc8b('0x19')]=function(_0x16638e){var _0x56f45e=this;return new Promise(function(_0x3d2655,_0xc3e8fd){return db['WhatsappMessage']['create'](_0x16638e[_0xcc8b('0x1a')],{'raw':_0x16638e[_0xcc8b('0x1b')]?_0x16638e[_0xcc8b('0x1b')][_0xcc8b('0x1c')]===undefined?!![]:![]:!![]})[_0xcc8b('0x10')](function(_0x54c98c){logger['info'](_0xcc8b('0x19'),_0x16638e);logger[_0xcc8b('0x1d')](_0xcc8b('0x19'),_0x16638e,JSON['stringify'](_0x54c98c));_0x3d2655(_0x54c98c);})[_0xcc8b('0x1e')](function(_0x445d11){logger[_0xcc8b('0x15')](_0xcc8b('0x19'),_0x445d11[_0xcc8b('0x17')],_0x16638e);_0xc3e8fd(_0x56f45e[_0xcc8b('0x15')](0x1f4,_0x445d11[_0xcc8b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ca76aef..fac3d25 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 _0x8b28=['emit','register','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x5be1d9,_0x423b37){var _0x3ef483=function(_0x325a82){while(--_0x325a82){_0x5be1d9['push'](_0x5be1d9['shift']());}};_0x3ef483(++_0x423b37);}(_0x8b28,0x161));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var WhatsappMessageEvents=require(_0x88b2('0x0'));var events=[_0x88b2('0x1'),_0x88b2('0x2'),_0x88b2('0x3')];function createListener(_0x4f9a17,_0x1b2545){return function(_0x2565cb){_0x1b2545[_0x88b2('0x4')](_0x4f9a17,_0x2565cb);};}function removeListener(_0x3517f4,_0x345326){return function(){WhatsappMessageEvents['removeListener'](_0x3517f4,_0x345326);};}exports[_0x88b2('0x5')]=function(_0xf88e23){for(var _0x3e8fa1=0x0,_0x39f31f=events['length'];_0x3e8fa1<_0x39f31f;_0x3e8fa1++){var _0x5418f5=events[_0x3e8fa1];var _0x2a3598=createListener(_0x88b2('0x6')+_0x5418f5,_0xf88e23);WhatsappMessageEvents['on'](_0x5418f5,_0x2a3598);}}; \ No newline at end of file +var _0x9ba2=['./whatsappMessage.events','save','remove','emit','removeListener','register','length','whatsappMessage:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ba2,0x150));var _0x29ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9ba2[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappMessageEvents=require(_0x29ba('0x0'));var events=[_0x29ba('0x1'),_0x29ba('0x2'),'update'];function createListener(_0x39f736,_0x492778){return function(_0x3160c9){_0x492778[_0x29ba('0x3')](_0x39f736,_0x3160c9);};}function removeListener(_0x3f2492,_0x483e89){return function(){WhatsappMessageEvents[_0x29ba('0x4')](_0x3f2492,_0x483e89);};}exports[_0x29ba('0x5')]=function(_0x568be){for(var _0x6b9b32=0x0,_0x5403a4=events[_0x29ba('0x6')];_0x6b9b32<_0x5403a4;_0x6b9b32++){var _0x5c98f9=events[_0x6b9b32];var _0x327f8c=createListener(_0x29ba('0x7')+_0x5c98f9,_0x568be);WhatsappMessageEvents['on'](_0x5c98f9,_0x327f8c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 202dab5..9e28b6f 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 _0xf058=['addAgents','put','/:id','delete','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','describe','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf058,0xbb));var _0x8f05=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf058[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8f05('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8f05('0x1'));var express=require(_0x8f05('0x2'));var router=express[_0x8f05('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8f05('0x4'));var interaction=require(_0x8f05('0x5'));var config=require(_0x8f05('0x6'));var controller=require(_0x8f05('0x7'));router['get']('/',auth[_0x8f05('0x8')](),controller[_0x8f05('0x9')]);router['get'](_0x8f05('0xa'),auth[_0x8f05('0x8')](),controller[_0x8f05('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8f05('0xc')]);router[_0x8f05('0xd')](_0x8f05('0xe'),auth[_0x8f05('0x8')](),controller[_0x8f05('0xf')]);router[_0x8f05('0xd')](_0x8f05('0x10'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x11')]);router['get'](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x13')]);router[_0x8f05('0x14')]('/',auth['isAuthenticated'](),controller[_0x8f05('0x15')]);router[_0x8f05('0x14')](_0x8f05('0x10'),auth['isAuthenticated'](),controller[_0x8f05('0x16')]);router[_0x8f05('0x14')](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x17')]);router[_0x8f05('0x18')](_0x8f05('0x19'),auth[_0x8f05('0x8')](),controller['update']);router[_0x8f05('0x1a')](_0x8f05('0x19'),auth['isAuthenticated'](),controller['destroy']);router[_0x8f05('0x1a')]('/:id/teams',auth[_0x8f05('0x8')](),controller[_0x8f05('0x1b')]);router[_0x8f05('0x1a')](_0x8f05('0x12'),auth[_0x8f05('0x8')](),controller[_0x8f05('0x1c')]);module[_0x8f05('0x1d')]=router; \ No newline at end of file +var _0x0511=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','delete','destroy','exports','multer','path','Router'];(function(_0x5be8cc,_0x4a6037){var _0x5f1b7e=function(_0xebd8db){while(--_0xebd8db){_0x5be8cc['push'](_0x5be8cc['shift']());}};_0x5f1b7e(++_0x4a6037);}(_0x0511,0x11f));var _0x1051=function(_0x52da21,_0x242123){_0x52da21=_0x52da21-0x0;var _0x12cb79=_0x0511[_0x52da21];return _0x12cb79;};'use strict';var multer=require(_0x1051('0x0'));var util=require('util');var path=require(_0x1051('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1051('0x2')]();var fs_extra=require(_0x1051('0x3'));var auth=require(_0x1051('0x4'));var interaction=require(_0x1051('0x5'));var config=require(_0x1051('0x6'));var controller=require(_0x1051('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1051('0x8')]);router[_0x1051('0x9')](_0x1051('0xa'),auth['isAuthenticated'](),controller[_0x1051('0xb')]);router[_0x1051('0x9')](_0x1051('0xc'),auth[_0x1051('0xd')](),controller[_0x1051('0xe')]);router['get'](_0x1051('0xf'),auth[_0x1051('0xd')](),controller[_0x1051('0x10')]);router['get'](_0x1051('0x11'),auth[_0x1051('0xd')](),controller[_0x1051('0x12')]);router[_0x1051('0x9')]('/:id/users',auth[_0x1051('0xd')](),controller['getAgents']);router[_0x1051('0x13')]('/',auth[_0x1051('0xd')](),controller[_0x1051('0x14')]);router[_0x1051('0x13')]('/:id/teams',auth[_0x1051('0xd')](),controller[_0x1051('0x15')]);router['post'](_0x1051('0x16'),auth['isAuthenticated'](),controller[_0x1051('0x17')]);router[_0x1051('0x18')](_0x1051('0xc'),auth[_0x1051('0xd')](),controller[_0x1051('0x19')]);router[_0x1051('0x1a')]('/:id',auth[_0x1051('0xd')](),controller[_0x1051('0x1b')]);router[_0x1051('0x1a')](_0x1051('0x11'),auth[_0x1051('0xd')](),controller['removeTeams']);router['delete'](_0x1051('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1051('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0eb33e7..4c3babf 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 _0x7a72=['roundrobin','exports','STRING','INTEGER','rrmemory'];(function(_0x3190d2,_0x1c4114){var _0x12a9a6=function(_0x14f2bf){while(--_0x14f2bf){_0x3190d2['push'](_0x3190d2['shift']());}};_0x12a9a6(++_0x1c4114);}(_0x7a72,0x1be));var _0x27a7=function(_0x469c92,_0x1e3542){_0x469c92=_0x469c92-0x0;var _0x9dbf5=_0x7a72[_0x469c92];return _0x9dbf5;};'use strict';var Sequelize=require('sequelize');module[_0x27a7('0x0')]={'name':{'type':Sequelize[_0x27a7('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x27a7('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27a7('0x3'),'beepall',_0x27a7('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b83=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x558924,_0x459768){var _0x5413a9=function(_0x345c16){while(--_0x345c16){_0x558924['push'](_0x558924['shift']());}};_0x5413a9(++_0x459768);}(_0x9b83,0x84));var _0x39b8=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0x9b83[_0x4bb581];return _0x316bf5;};'use strict';var Sequelize=require(_0x39b8('0x0'));module[_0x39b8('0x1')]={'name':{'type':Sequelize[_0x39b8('0x2')],'unique':_0x39b8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x39b8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x39b8('0x5')](_0x39b8('0x6'),_0x39b8('0x7'),_0x39b8('0x8'))},'description':{'type':Sequelize[_0x39b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 292451b..4c3f178 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 _0x56d1=['merge','VIRTUAL','filter','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','describe','getMembers','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','options','Agents','online','interface','flatMap','transaction','addTeams','each','forEach','emit','removeTeams','ids','select','field','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','every','TeamId','includes','all','compact','value','removeAgents','spread','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','destroy','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x56d1,0x14b));var _0x156d=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x56d1[_0x21bfab];return _0x4db318;};'use strict';var emlformat=require(_0x156d('0x0'));var rimraf=require(_0x156d('0x1'));var zipdir=require(_0x156d('0x2'));var jsonpatch=require(_0x156d('0x3'));var rp=require('request-promise');var moment=require(_0x156d('0x4'));var BPromise=require(_0x156d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x156d('0x6'));var sox=require(_0x156d('0x7'));var csv=require(_0x156d('0x8'));var ejs=require(_0x156d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x156d('0xa'));var squel=require(_0x156d('0xb'));var crypto=require('crypto');var jsforce=require(_0x156d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x156d('0x8'));var querystring=require('querystring');var Papa=require(_0x156d('0xd'));var Redis=require('ioredis');var authService=require(_0x156d('0xe'));var qs=require(_0x156d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x156d('0x10'))(_0x156d('0x11'));var utils=require(_0x156d('0x12'));var config=require(_0x156d('0x13'));var licenseUtil=require(_0x156d('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x156d('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x156d('0x16'))(new Redis(config[_0x156d('0x15')]));require(_0x156d('0x17'))[_0x156d('0x18')](socket);function respondWithStatusCode(_0x153aa3,_0xf61e9a){_0xf61e9a=_0xf61e9a||0xcc;return function(_0x58d58d){if(_0x58d58d){return _0x153aa3[_0x156d('0x19')](_0xf61e9a);}return _0x153aa3['status'](_0xf61e9a)[_0x156d('0x1a')]();};}function respondWithResult(_0x20b201,_0xdfefc7){_0xdfefc7=_0xdfefc7||0xc8;return function(_0x1ba3c9){if(_0x1ba3c9){return _0x20b201['status'](_0xdfefc7)[_0x156d('0x1b')](_0x1ba3c9);}};}function respondWithFilteredResult(_0x13f83,_0xcebe16){return function(_0x4b99e7){if(_0x4b99e7){var _0xb565ee=typeof _0xcebe16[_0x156d('0x1c')]===_0x156d('0x1d')&&typeof _0xcebe16[_0x156d('0x1e')]===_0x156d('0x1d');var _0xbbd78=_0x4b99e7[_0x156d('0x1f')];var _0x7cc950=_0xb565ee?0x0:_0xcebe16[_0x156d('0x1c')];var _0x8f9d45=_0xb565ee?_0x4b99e7[_0x156d('0x1f')]:_0xcebe16[_0x156d('0x1c')]+_0xcebe16[_0x156d('0x1e')];var _0x58cfb3;if(_0x8f9d45>=_0xbbd78){_0x8f9d45=_0xbbd78;_0x58cfb3=0xc8;}else{_0x58cfb3=0xce;}_0x13f83['status'](_0x58cfb3);return _0x13f83['set'](_0x156d('0x20'),_0x7cc950+'-'+_0x8f9d45+'/'+_0xbbd78)[_0x156d('0x1b')](_0x4b99e7);}return null;};}function patchUpdates(_0x23557e){return function(_0x40594f){try{jsonpatch[_0x156d('0x21')](_0x40594f,_0x23557e,!![]);}catch(_0x32d14f){return BPromise[_0x156d('0x22')](_0x32d14f);}return _0x40594f[_0x156d('0x23')]();};}function saveUpdates(_0x325c40,_0xde223){return function(_0x5e540f){if(_0x5e540f){return _0x5e540f[_0x156d('0x24')](_0x325c40)[_0x156d('0x25')](function(_0x4c6507){return _0x4c6507;});}return null;};}function removeEntity(_0xa04363,_0x257d2c){return function(_0x1f3285){if(_0x1f3285){return _0x1f3285['destroy']()[_0x156d('0x25')](function(){var _0x6d2e14=_0x1f3285[_0x156d('0x26')]({'plain':!![]});var _0x46a6e8=_0x156d('0x27');return db['UserProfileResource'][_0x156d('0x28')]({'where':{'type':_0x46a6e8,'resourceId':_0x6d2e14['id']}})[_0x156d('0x25')](function(){return _0x1f3285;});})[_0x156d('0x25')](function(){_0xa04363[_0x156d('0x29')](0xcc)[_0x156d('0x1a')]();});}};}function handleEntityNotFound(_0x49d55f,_0x4078b9){return function(_0xc520d2){if(!_0xc520d2){_0x49d55f[_0x156d('0x19')](0x194);}return _0xc520d2;};}function handleError(_0x305e1b,_0x5d5dc1){_0x5d5dc1=_0x5d5dc1||0x1f4;return function(_0x23b1f9){logger[_0x156d('0x2a')](_0x23b1f9[_0x156d('0x2b')]);if(_0x23b1f9[_0x156d('0x2c')]){delete _0x23b1f9['name'];}_0x305e1b[_0x156d('0x29')](_0x5d5dc1)[_0x156d('0x2d')](_0x23b1f9);};}exports[_0x156d('0x2e')]=function(_0x4c96b1,_0x166067){var _0x2515e9={},_0x200715={},_0x3ef7f9={'count':0x0,'rows':[]};var _0xbb1ca=_[_0x156d('0x2f')](db['WhatsappQueue'][_0x156d('0x30')],function(_0x43e44b){return{'name':_0x43e44b[_0x156d('0x31')],'type':_0x43e44b[_0x156d('0x32')]['key']};});_0x200715['model']=_[_0x156d('0x2f')](_0xbb1ca,_0x156d('0x2c'));_0x200715[_0x156d('0x33')]=_[_0x156d('0x34')](_0x4c96b1[_0x156d('0x33')]);_0x200715[_0x156d('0x35')]=_[_0x156d('0x36')](_0x200715[_0x156d('0x37')],_0x200715['query']);_0x2515e9[_0x156d('0x38')]=_[_0x156d('0x36')](_0x200715[_0x156d('0x37')],qs[_0x156d('0x39')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x39')]));_0x2515e9[_0x156d('0x38')]=_0x2515e9['attributes'][_0x156d('0x3a')]?_0x2515e9[_0x156d('0x38')]:_0x200715['model'];if(!_0x4c96b1[_0x156d('0x33')][_0x156d('0x3b')](_0x156d('0x3c'))){_0x2515e9['limit']=qs[_0x156d('0x1e')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x1e')]);_0x2515e9[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x1c')]);}_0x2515e9[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x4c96b1[_0x156d('0x33')][_0x156d('0x3e')]);_0x2515e9[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x4c96b1[_0x156d('0x33')],_0x200715['filters']),_0xbb1ca);if(_0x4c96b1[_0x156d('0x33')]['filter']){_0x2515e9[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x2515e9['where'],{'$or':_[_0x156d('0x2f')](_0xbb1ca,function(_0x30dc2b){if(_0x30dc2b[_0x156d('0x32')]!==_0x156d('0x42')){var _0xe36bc2={};_0xe36bc2[_0x30dc2b['name']]={'$like':'%'+_0x4c96b1[_0x156d('0x33')][_0x156d('0x43')]+'%'};return _0xe36bc2;}})});}_0x2515e9=_[_0x156d('0x41')]({},_0x2515e9,_0x4c96b1['options']);var _0xa835be={'where':_0x2515e9['where']};return db[_0x156d('0x44')]['count'](_0xa835be)[_0x156d('0x25')](function(_0x34997f){_0x3ef7f9['count']=_0x34997f;if(_0x4c96b1[_0x156d('0x33')][_0x156d('0x45')]){_0x2515e9[_0x156d('0x46')]=[{'all':!![]}];}return db[_0x156d('0x44')][_0x156d('0x47')](_0x2515e9);})[_0x156d('0x25')](function(_0x4c792e){_0x3ef7f9[_0x156d('0x48')]=_0x4c792e;return _0x3ef7f9;})[_0x156d('0x25')](respondWithFilteredResult(_0x166067,_0x2515e9))[_0x156d('0x49')](handleError(_0x166067,null));};exports[_0x156d('0x4a')]=function(_0x9e5bf2,_0x4203a1){var _0x5d60d2={'raw':!![],'where':{'id':_0x9e5bf2[_0x156d('0x4b')]['id']}},_0x1c9b85={};_0x1c9b85['model']=_[_0x156d('0x34')](db[_0x156d('0x44')][_0x156d('0x30')]);_0x1c9b85[_0x156d('0x33')]=_[_0x156d('0x34')](_0x9e5bf2['query']);_0x1c9b85[_0x156d('0x35')]=_[_0x156d('0x36')](_0x1c9b85[_0x156d('0x37')],_0x1c9b85[_0x156d('0x33')]);_0x5d60d2[_0x156d('0x38')]=_[_0x156d('0x36')](_0x1c9b85[_0x156d('0x37')],qs[_0x156d('0x39')](_0x9e5bf2['query'][_0x156d('0x39')]));_0x5d60d2[_0x156d('0x38')]=_0x5d60d2[_0x156d('0x38')][_0x156d('0x3a')]?_0x5d60d2[_0x156d('0x38')]:_0x1c9b85[_0x156d('0x37')];if(_0x9e5bf2[_0x156d('0x33')][_0x156d('0x45')]){_0x5d60d2[_0x156d('0x46')]=[{'all':!![]}];}_0x5d60d2=_['merge']({},_0x5d60d2,_0x9e5bf2['options']);return db[_0x156d('0x44')][_0x156d('0x4c')](_0x5d60d2)[_0x156d('0x25')](handleEntityNotFound(_0x4203a1,null))[_0x156d('0x25')](respondWithResult(_0x4203a1,null))[_0x156d('0x49')](handleError(_0x4203a1,null));};exports[_0x156d('0x4d')]=function(_0x48cc8c,_0x1ba6a2){return db[_0x156d('0x44')][_0x156d('0x4d')](_0x48cc8c[_0x156d('0x4e')],{})[_0x156d('0x25')](function(_0x5e8289){var _0x2144ff=_0x48cc8c['user'][_0x156d('0x26')]({'plain':!![]});if(!_0x2144ff)throw new Error(_0x156d('0x4f'));if(_0x2144ff[_0x156d('0x50')]==='user'){var _0x58527b=_0x5e8289[_0x156d('0x26')]({'plain':!![]});var _0x492310=_0x156d('0x27');return db[_0x156d('0x51')][_0x156d('0x4c')]({'where':{'name':_0x492310,'userProfileId':_0x2144ff[_0x156d('0x52')]},'raw':!![]})[_0x156d('0x25')](function(_0x428995){if(_0x428995&&_0x428995['autoAssociation']===0x0){return db['UserProfileResource'][_0x156d('0x4d')]({'name':_0x58527b[_0x156d('0x2c')],'resourceId':_0x58527b['id'],'type':_0x428995['name'],'sectionId':_0x428995['id']},{})[_0x156d('0x25')](function(){return _0x5e8289;});}else{return _0x5e8289;}})[_0x156d('0x49')](function(_0x27a643){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27a643);throw _0x27a643;});}return _0x5e8289;})[_0x156d('0x25')](respondWithResult(_0x1ba6a2,0xc9))[_0x156d('0x49')](handleError(_0x1ba6a2,null));};exports['update']=function(_0x27e610,_0x40aa33){if(_0x27e610['body']['id']){delete _0x27e610[_0x156d('0x4e')]['id'];}return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x27e610[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x40aa33,null))['then'](saveUpdates(_0x27e610[_0x156d('0x4e')],null))[_0x156d('0x25')](respondWithResult(_0x40aa33,null))['catch'](handleError(_0x40aa33,null));};exports[_0x156d('0x28')]=function(_0x3cb166,_0x4b5685){return db[_0x156d('0x44')][_0x156d('0x4c')]({'where':{'id':_0x3cb166[_0x156d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b5685,null))[_0x156d('0x25')](removeEntity(_0x4b5685,null))['catch'](handleError(_0x4b5685,null));};exports[_0x156d('0x53')]=function(_0x417cea,_0xe6ac0a){return db[_0x156d('0x44')][_0x156d('0x53')]()['then'](respondWithResult(_0xe6ac0a,null))[_0x156d('0x49')](handleError(_0xe6ac0a,null));};exports[_0x156d('0x54')]=function(_0x17e578,_0x32b00e,_0x177ccf){var _0x39c29f={'raw':!![],'where':{}},_0x78547c={},_0x4ad4b9;return db[_0x156d('0x44')]['findOne']({'where':{'id':_0x17e578[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x32b00e,null))[_0x156d('0x25')](function(_0x5731f6){if(_0x5731f6){_0x4ad4b9=_0x5731f6['get']({'plain':!![]});_0x78547c[_0x156d('0x37')]=_['keys'](db['UserWhatsappQueue'][_0x156d('0x30')]);_0x78547c['query']=_[_0x156d('0x34')](_0x17e578[_0x156d('0x33')]);_0x78547c['filters']=_[_0x156d('0x36')](_0x78547c[_0x156d('0x37')],_0x78547c[_0x156d('0x33')]);_0x39c29f['attributes']=_[_0x156d('0x36')](_0x78547c['model'],qs[_0x156d('0x39')](_0x17e578[_0x156d('0x33')][_0x156d('0x39')]));_0x39c29f[_0x156d('0x38')]=_0x39c29f[_0x156d('0x38')][_0x156d('0x3a')]?_0x39c29f['attributes']:_0x78547c[_0x156d('0x37')];if(!_0x17e578[_0x156d('0x33')][_0x156d('0x3b')]('nolimit')){_0x39c29f['limit']=qs[_0x156d('0x1e')](_0x17e578[_0x156d('0x33')]['limit']);_0x39c29f[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x17e578[_0x156d('0x33')][_0x156d('0x1c')]);}_0x39c29f[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x17e578['query'][_0x156d('0x3e')]);_0x39c29f['where']=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x17e578[_0x156d('0x33')],_0x78547c[_0x156d('0x35')]));_0x39c29f['where'][_0x156d('0x55')]=_0x5731f6['id'];if(_0x17e578['query'][_0x156d('0x43')]){_0x39c29f[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x39c29f[_0x156d('0x3f')],{'$or':_[_0x156d('0x2f')](_0x39c29f[_0x156d('0x38')],function(_0x1d7779){var _0x2a8173={};_0x2a8173[_0x1d7779]={'$like':'%'+_0x17e578[_0x156d('0x33')][_0x156d('0x43')]+'%'};return _0x2a8173;})});}_0x39c29f=_[_0x156d('0x41')]({},_0x39c29f,_0x17e578['options']);return db[_0x156d('0x56')][_0x156d('0x47')](_0x39c29f);}})[_0x156d('0x25')](function(_0x190e97){if(_0x190e97){return db[_0x156d('0x57')][_0x156d('0x58')]({'where':{'id':_[_0x156d('0x2f')](_0x190e97,'UserId'),'role':_0x156d('0x59')},'attributes':['id','name',_0x156d('0x5a'),_0x156d('0x5b'),_0x156d('0x5c')]});}})[_0x156d('0x25')](function(_0x3b7e42){if(_0x3b7e42){return{'count':_0x3b7e42[_0x156d('0x1f')],'rows':_[_0x156d('0x2f')](_0x3b7e42[_0x156d('0x48')],function(_0x3c555a){return{'membername':_0x3c555a[_0x156d('0x2c')],'UserId':_0x3c555a['id'],'queue_name':_0x4ad4b9[_0x156d('0x2c')],'WhatsappQueueId':_0x4ad4b9['id'],'interface':util['format'](_0x156d('0x5d'),_0x156d('0x5e'),_0x3c555a['name']),'penalty':0x0,'paused':_0x3c555a[_0x156d('0x5a')],'createdAt':_0x3c555a[_0x156d('0x5c')],'updatedAt':_0x3c555a[_0x156d('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x156d('0x25')](respondWithFilteredResult(_0x32b00e,_0x39c29f))['catch'](handleError(_0x32b00e,null));};exports[_0x156d('0x5f')]=function(_0x3f1003,_0x30916d,_0x341760){var _0x536446={};var _0x5e4f51={};var _0x519009;var _0x341959;return db[_0x156d('0x44')][_0x156d('0x60')]({'where':{'id':_0x3f1003[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x30916d,null))[_0x156d('0x25')](function(_0x46cdef){if(_0x46cdef){_0x519009=_0x46cdef;_0x5e4f51[_0x156d('0x37')]=_[_0x156d('0x34')](db[_0x156d('0x61')][_0x156d('0x30')]);_0x5e4f51[_0x156d('0x33')]=_[_0x156d('0x34')](_0x3f1003[_0x156d('0x33')]);_0x5e4f51['filters']=_[_0x156d('0x36')](_0x5e4f51['model'],_0x5e4f51[_0x156d('0x33')]);_0x536446[_0x156d('0x38')]=_[_0x156d('0x36')](_0x5e4f51[_0x156d('0x37')],qs[_0x156d('0x39')](_0x3f1003['query'][_0x156d('0x39')]));_0x536446['attributes']=_0x536446['attributes'][_0x156d('0x3a')]?_0x536446[_0x156d('0x38')]:_0x5e4f51[_0x156d('0x37')];_0x536446[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x3f1003['query'][_0x156d('0x3e')]);_0x536446[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x3f1003[_0x156d('0x33')],_0x5e4f51[_0x156d('0x35')]));if(_0x3f1003[_0x156d('0x33')][_0x156d('0x43')]){_0x536446[_0x156d('0x3f')]=_[_0x156d('0x41')](_0x536446[_0x156d('0x3f')],{'$or':_[_0x156d('0x2f')](_0x536446[_0x156d('0x38')],function(_0x132f86){var _0x500806={};_0x500806[_0x132f86]={'$like':'%'+_0x3f1003['query'][_0x156d('0x43')]+'%'};return _0x500806;})});}_0x536446=_[_0x156d('0x41')]({},_0x536446,_0x3f1003[_0x156d('0x62')]);return _0x519009['getTeams'](_0x536446);}})[_0x156d('0x25')](function(_0x1fae60){if(_0x1fae60){_0x341959=_0x1fae60[_0x156d('0x3a')];if(!_0x3f1003[_0x156d('0x33')]['hasOwnProperty'](_0x156d('0x3c'))){_0x536446[_0x156d('0x1e')]=qs[_0x156d('0x1e')](_0x3f1003[_0x156d('0x33')][_0x156d('0x1e')]);_0x536446[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x3f1003['query'][_0x156d('0x1c')]);}return _0x519009[_0x156d('0x5f')](_0x536446);}})['then'](function(_0x274f94){if(_0x274f94){return _0x274f94?{'count':_0x341959,'rows':_0x274f94}:null;}})[_0x156d('0x25')](respondWithResult(_0x30916d,null))[_0x156d('0x49')](handleError(_0x30916d,null));};exports['addTeams']=function(_0x200817,_0x3aded6,_0x5e22ab){var _0x5c58be=_0x200817[_0x156d('0x4e')]['ids'];return db[_0x156d('0x61')][_0x156d('0x47')]({'where':{'id':_0x5c58be},'attributes':['id'],'include':[{'model':db['User'],'as':_0x156d('0x63'),'attributes':['id',_0x156d('0x2c'),_0x156d('0x64'),'voicePause',_0x156d('0x65')],'raw':!![]}]})[_0x156d('0x25')](function(_0x2fcb8e){if(_0x2fcb8e){var _0x1ccae=_[_0x156d('0x66')](_0x2fcb8e,function(_0x44df0e){var _0x19b020=_0x44df0e[_0x156d('0x26')]({'plain':!![]});return _0x19b020[_0x156d('0x63')];});return db['WhatsappQueue']['find']({'where':{'id':_0x200817[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](function(_0x1fc18e){return db['sequelize'][_0x156d('0x67')](function(_0x2d0c84){return _0x1fc18e[_0x156d('0x68')](_0x5c58be,{'transaction':_0x2d0c84})[_0x156d('0x25')](function(){return BPromise[_0x156d('0x69')](_0x1ccae,function(_0x3adaf8){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x3adaf8['id'],'WhatsappQueueId':_0x200817[_0x156d('0x4b')]['id']},'transaction':_0x2d0c84});});})[_0x156d('0x25')](function(){_0x1ccae[_0x156d('0x6a')](function(_0x44194c){socket[_0x156d('0x6b')]('userWhatsappQueue:save',{'UserId':_0x44194c['id'],'WhatsappQueueId':_0x1fc18e['id']});});});});});}})[_0x156d('0x25')](respondWithStatusCode(_0x3aded6,null))[_0x156d('0x49')](handleError(_0x3aded6,null));};exports[_0x156d('0x6c')]=function(_0x3655fe,_0x3cfeff,_0x20a363){return db[_0x156d('0x61')]['findAll']({'where':{'id':_0x3655fe[_0x156d('0x33')][_0x156d('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x156d('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3cfeff,null))[_0x156d('0x25')](function(_0x26abc2){var _0x4eb985=_[_0x156d('0x2f')](_0x26abc2,'id');var _0x4136ea=[];var _0x39b667=[];var _0x114f7b=squel[_0x156d('0x6e')]();_0x114f7b[_0x156d('0x6f')]('tq.TeamId')[_0x156d('0x70')](_0x156d('0x71'),'tq')['join'](_0x156d('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x156d('0x3f')](_0x156d('0x73'),_0x3655fe[_0x156d('0x4b')]['id']);for(var _0xe3740d=0x0;_0xe3740d<_0x26abc2[_0x156d('0x3a')];_0xe3740d+=0x1){let _0x19fd48=_0x26abc2[_0xe3740d];for(var _0x256bb7=0x0;_0x256bb7<_0x19fd48[_0x156d('0x63')][_0x156d('0x3a')];_0x256bb7+=0x1){let _0x2ec3fa=_0x19fd48[_0x156d('0x63')][_0x256bb7];var _0x194aae=_0x114f7b['clone']();_0x194aae[_0x156d('0x3f')](_0x156d('0x74'),_0x2ec3fa['id']);_0x39b667[_0x156d('0x75')](db['sequelize'][_0x156d('0x33')](_0x194aae[_0x156d('0x76')](),{'type':db[_0x156d('0x77')]['QueryTypes']['SELECT']})[_0x156d('0x25')](function(_0x2a8c15){if(_0x2a8c15['length']===0x1){return _0x2ec3fa['id'];}else{var _0x10cddc=_[_0x156d('0x78')](_[_0x156d('0x2f')](_0x2a8c15,_0x156d('0x79')),function(_0x349fd8){return _[_0x156d('0x7a')](_0x4eb985,_0x349fd8);});if(_0x10cddc){return _0x2ec3fa['id'];}}}));}}return BPromise[_0x156d('0x7b')](_0x39b667)[_0x156d('0x25')](function(_0x3136cc){_0x4136ea=_(_0x4136ea)['union'](_0x3136cc)[_0x156d('0x7c')]()[_0x156d('0x7d')]();return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x3655fe[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](function(_0x3e70cd){return db[_0x156d('0x77')][_0x156d('0x67')](function(_0x5933cd){return _0x3e70cd[_0x156d('0x6c')](_0x3655fe[_0x156d('0x33')][_0x156d('0x6d')],{'transaction':_0x5933cd})[_0x156d('0x25')](function(){if(!_['isEmpty'](_0x4136ea)){return _0x3e70cd[_0x156d('0x7e')](_0x4136ea,{'transaction':_0x5933cd});}})[_0x156d('0x25')](function(){_0x4136ea[_0x156d('0x6a')](function(_0x25ba70){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x25ba70,'WhatsappQueueId':_0x3e70cd['id']});});});});});});})[_0x156d('0x25')](respondWithStatusCode(_0x3cfeff,null))[_0x156d('0x49')](handleError(_0x3cfeff,null));};exports['addAgents']=function(_0x37ee12,_0x5eacae,_0x8f3f43){return db[_0x156d('0x44')]['find']({'where':{'id':_0x37ee12[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x5eacae,null))[_0x156d('0x25')](function(_0x56d35f){if(_0x56d35f){return _0x56d35f['addAgents'](_0x37ee12['body'][_0x156d('0x6d')],_['omit'](_0x37ee12[_0x156d('0x4e')],['ids','id'])||{})[_0x156d('0x7f')](function(_0xe2786){for(var _0x68f116=0x0;_0x68f116<_0x37ee12['body'][_0x156d('0x6d')][_0x156d('0x3a')];_0x68f116+=0x1){socket[_0x156d('0x6b')](_0x156d('0x80'),{'UserId':Number(_0x37ee12[_0x156d('0x4e')]['ids'][_0x68f116]),'WhatsappQueueId':Number(_0x37ee12[_0x156d('0x4b')]['id'])});}return _0xe2786;});}})[_0x156d('0x25')](respondWithResult(_0x5eacae,null))[_0x156d('0x49')](handleError(_0x5eacae,null));};exports[_0x156d('0x7e')]=function(_0x21de07,_0xc6e6fa,_0x28841d){return db['WhatsappQueue'][_0x156d('0x4c')]({'where':{'id':_0x21de07[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0xc6e6fa,null))[_0x156d('0x25')](function(_0x10aade){if(_0x10aade){return _0x10aade['removeAgents'](_0x21de07[_0x156d('0x33')][_0x156d('0x6d')])[_0x156d('0x25')](function(){if(_[_0x156d('0x81')](_0x21de07[_0x156d('0x33')][_0x156d('0x6d')])){for(var _0x5d2fac=0x0;_0x5d2fac<_0x21de07[_0x156d('0x33')][_0x156d('0x6d')][_0x156d('0x3a')];_0x5d2fac+=0x1){socket[_0x156d('0x6b')](_0x156d('0x82'),{'UserId':Number(_0x21de07[_0x156d('0x33')][_0x156d('0x6d')][_0x5d2fac]),'WhatsappQueueId':Number(_0x21de07[_0x156d('0x4b')]['id'])});}}else{socket[_0x156d('0x6b')](_0x156d('0x82'),{'UserId':Number(_0x21de07['query'][_0x156d('0x6d')]),'WhatsappQueueId':Number(_0x21de07[_0x156d('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0xc6e6fa,null))[_0x156d('0x49')](handleError(_0xc6e6fa,null));};exports[_0x156d('0x83')]=function(_0x48f9aa,_0x41da4a,_0x5f5126){var _0x28e046={};var _0x1c74ce={};var _0x1fc567;var _0x45b53b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x48f9aa[_0x156d('0x4b')]['id']}})[_0x156d('0x25')](handleEntityNotFound(_0x41da4a,null))[_0x156d('0x25')](function(_0x42f517){if(_0x42f517){_0x1fc567=_0x42f517;_0x1c74ce[_0x156d('0x37')]=_[_0x156d('0x34')](db[_0x156d('0x57')][_0x156d('0x30')]);_0x1c74ce[_0x156d('0x33')]=_['keys'](_0x48f9aa['query']);_0x1c74ce[_0x156d('0x35')]=_[_0x156d('0x36')](_0x1c74ce[_0x156d('0x37')],_0x1c74ce[_0x156d('0x33')]);_0x28e046[_0x156d('0x38')]=_[_0x156d('0x36')](_0x1c74ce[_0x156d('0x37')],qs['fields'](_0x48f9aa[_0x156d('0x33')][_0x156d('0x39')]));_0x28e046[_0x156d('0x38')]=_0x28e046[_0x156d('0x38')]['length']?_0x28e046[_0x156d('0x38')]:_0x1c74ce[_0x156d('0x37')];_0x28e046[_0x156d('0x3d')]=qs[_0x156d('0x3e')](_0x48f9aa['query'][_0x156d('0x3e')]);_0x28e046[_0x156d('0x3f')]=qs[_0x156d('0x35')](_[_0x156d('0x40')](_0x48f9aa[_0x156d('0x33')],_0x1c74ce[_0x156d('0x35')]));if(_0x48f9aa[_0x156d('0x33')][_0x156d('0x43')]){_0x28e046['where']=_[_0x156d('0x41')](_0x28e046['where'],{'$or':_[_0x156d('0x2f')](_0x28e046[_0x156d('0x38')],function(_0xde90e0){var _0x7027fa={};_0x7027fa[_0xde90e0]={'$like':'%'+_0x48f9aa['query'][_0x156d('0x43')]+'%'};return _0x7027fa;})});}_0x28e046=_[_0x156d('0x41')]({},_0x28e046,_0x48f9aa[_0x156d('0x62')]);return _0x1fc567[_0x156d('0x83')](_0x28e046);}})['then'](function(_0x25caf1){if(_0x25caf1){_0x45b53b=_0x25caf1[_0x156d('0x3a')];if(!_0x48f9aa[_0x156d('0x33')][_0x156d('0x3b')]('nolimit')){_0x28e046[_0x156d('0x1e')]=qs[_0x156d('0x1e')](_0x48f9aa['query'][_0x156d('0x1e')]);_0x28e046[_0x156d('0x1c')]=qs[_0x156d('0x1c')](_0x48f9aa[_0x156d('0x33')][_0x156d('0x1c')]);}return _0x1fc567[_0x156d('0x83')](_0x28e046);}})[_0x156d('0x25')](function(_0x5c7330){if(_0x5c7330){return _0x5c7330?{'count':_0x45b53b,'rows':_0x5c7330}:null;}})[_0x156d('0x25')](respondWithResult(_0x41da4a,null))['catch'](handleError(_0x41da4a,null));}; \ No newline at end of file +var _0xe649=['userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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','../../config/license/util','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','userWhatsappQueue:save','select','field','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','all','value','removeTeams','isEmpty','removeAgents','emit'];(function(_0x2db7ec,_0x4ee00d){var _0xb3020c=function(_0x458f19){while(--_0x458f19){_0x2db7ec['push'](_0x2db7ec['shift']());}};_0xb3020c(++_0x4ee00d);}(_0xe649,0x1b0));var _0x9e64=function(_0x1162a3,_0x3b760c){_0x1162a3=_0x1162a3-0x0;var _0x2ccb37=_0xe649[_0x1162a3];return _0x2ccb37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e64('0x0'));var zipdir=require(_0x9e64('0x1'));var jsonpatch=require(_0x9e64('0x2'));var rp=require(_0x9e64('0x3'));var moment=require('moment');var BPromise=require(_0x9e64('0x4'));var Mustache=require(_0x9e64('0x5'));var util=require(_0x9e64('0x6'));var path=require(_0x9e64('0x7'));var sox=require('sox');var csv=require(_0x9e64('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e64('0x9'));var _=require(_0x9e64('0xa'));var squel=require(_0x9e64('0xb'));var crypto=require(_0x9e64('0xc'));var jsforce=require(_0x9e64('0xd'));var deskjs=require(_0x9e64('0xe'));var toCsv=require(_0x9e64('0x8'));var querystring=require(_0x9e64('0xf'));var Papa=require(_0x9e64('0x10'));var Redis=require(_0x9e64('0x11'));var authService=require(_0x9e64('0x12'));var qs=require(_0x9e64('0x13'));var as=require(_0x9e64('0x14'));var hardwareService=require(_0x9e64('0x15'));var logger=require(_0x9e64('0x16'))('api');var utils=require(_0x9e64('0x17'));var config=require(_0x9e64('0x18'));var licenseUtil=require(_0x9e64('0x19'));var db=require(_0x9e64('0x1a'))['db'];config[_0x9e64('0x1b')]=_['defaults'](config[_0x9e64('0x1b')],{'host':_0x9e64('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e64('0x1d'))[_0x9e64('0x1e')](socket);function respondWithStatusCode(_0x40e488,_0x2e7be1){_0x2e7be1=_0x2e7be1||0xcc;return function(_0xcfe4f9){if(_0xcfe4f9){return _0x40e488[_0x9e64('0x1f')](_0x2e7be1);}return _0x40e488[_0x9e64('0x20')](_0x2e7be1)[_0x9e64('0x21')]();};}function respondWithResult(_0x11d366,_0x559715){_0x559715=_0x559715||0xc8;return function(_0x1a408b){if(_0x1a408b){return _0x11d366['status'](_0x559715)[_0x9e64('0x22')](_0x1a408b);}};}function respondWithFilteredResult(_0x5dac6e,_0x45916f){return function(_0x2ef06c){if(_0x2ef06c){var _0x718f2c=typeof _0x45916f[_0x9e64('0x23')]===_0x9e64('0x24')&&typeof _0x45916f[_0x9e64('0x25')]==='undefined';var _0x2db77f=_0x2ef06c[_0x9e64('0x26')];var _0x2d26d3=_0x718f2c?0x0:_0x45916f[_0x9e64('0x23')];var _0xefe6b6=_0x718f2c?_0x2ef06c[_0x9e64('0x26')]:_0x45916f[_0x9e64('0x23')]+_0x45916f['limit'];var _0x4032e6;if(_0xefe6b6>=_0x2db77f){_0xefe6b6=_0x2db77f;_0x4032e6=0xc8;}else{_0x4032e6=0xce;}_0x5dac6e['status'](_0x4032e6);return _0x5dac6e[_0x9e64('0x27')](_0x9e64('0x28'),_0x2d26d3+'-'+_0xefe6b6+'/'+_0x2db77f)[_0x9e64('0x22')](_0x2ef06c);}return null;};}function patchUpdates(_0x2b921a){return function(_0x502c01){try{jsonpatch[_0x9e64('0x29')](_0x502c01,_0x2b921a,!![]);}catch(_0x52be41){return BPromise[_0x9e64('0x2a')](_0x52be41);}return _0x502c01['save']();};}function saveUpdates(_0x39bc09,_0xb3de1a){return function(_0x31a915){if(_0x31a915){return _0x31a915['update'](_0x39bc09)['then'](function(_0xa292da){return _0xa292da;});}return null;};}function removeEntity(_0x48fbfd,_0x57ef4b){return function(_0xb49f3a){if(_0xb49f3a){return _0xb49f3a[_0x9e64('0x2b')]()[_0x9e64('0x2c')](function(){var _0x45de2e=_0xb49f3a[_0x9e64('0x2d')]({'plain':!![]});var _0x4fa750=_0x9e64('0x2e');return db[_0x9e64('0x2f')][_0x9e64('0x2b')]({'where':{'type':_0x4fa750,'resourceId':_0x45de2e['id']}})[_0x9e64('0x2c')](function(){return _0xb49f3a;});})['then'](function(){_0x48fbfd[_0x9e64('0x20')](0xcc)[_0x9e64('0x21')]();});}};}function handleEntityNotFound(_0x340826,_0x247b6b){return function(_0x4097be){if(!_0x4097be){_0x340826[_0x9e64('0x1f')](0x194);}return _0x4097be;};}function handleError(_0x4ad5ab,_0x58658d){_0x58658d=_0x58658d||0x1f4;return function(_0x2183f0){logger[_0x9e64('0x30')](_0x2183f0[_0x9e64('0x31')]);if(_0x2183f0[_0x9e64('0x32')]){delete _0x2183f0[_0x9e64('0x32')];}_0x4ad5ab[_0x9e64('0x20')](_0x58658d)[_0x9e64('0x33')](_0x2183f0);};}exports[_0x9e64('0x34')]=function(_0x2d7d3a,_0x4f06cf){var _0x581155={},_0x37378a={},_0x63e846={'count':0x0,'rows':[]};var _0x12195d=_[_0x9e64('0x35')](db['WhatsappQueue'][_0x9e64('0x36')],function(_0x23f6fd){return{'name':_0x23f6fd['fieldName'],'type':_0x23f6fd[_0x9e64('0x37')][_0x9e64('0x38')]};});_0x37378a[_0x9e64('0x39')]=_['map'](_0x12195d,_0x9e64('0x32'));_0x37378a[_0x9e64('0x3a')]=_[_0x9e64('0x3b')](_0x2d7d3a['query']);_0x37378a[_0x9e64('0x3c')]=_[_0x9e64('0x3d')](_0x37378a['model'],_0x37378a[_0x9e64('0x3a')]);_0x581155[_0x9e64('0x3e')]=_[_0x9e64('0x3d')](_0x37378a[_0x9e64('0x39')],qs['fields'](_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x3f')]));_0x581155['attributes']=_0x581155[_0x9e64('0x3e')]['length']?_0x581155[_0x9e64('0x3e')]:_0x37378a['model'];if(!_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x40')](_0x9e64('0x41'))){_0x581155[_0x9e64('0x25')]=qs[_0x9e64('0x25')](_0x2d7d3a[_0x9e64('0x3a')]['limit']);_0x581155[_0x9e64('0x23')]=qs[_0x9e64('0x23')](_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x23')]);}_0x581155[_0x9e64('0x42')]=qs[_0x9e64('0x43')](_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x43')]);_0x581155['where']=qs[_0x9e64('0x3c')](_[_0x9e64('0x44')](_0x2d7d3a[_0x9e64('0x3a')],_0x37378a[_0x9e64('0x3c')]),_0x12195d);if(_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x45')]){_0x581155[_0x9e64('0x46')]=_[_0x9e64('0x47')](_0x581155[_0x9e64('0x46')],{'$or':_[_0x9e64('0x35')](_0x12195d,function(_0x438828){if(_0x438828['type']!==_0x9e64('0x48')){var _0xc66539={};_0xc66539[_0x438828[_0x9e64('0x32')]]={'$like':'%'+_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x45')]+'%'};return _0xc66539;}})});}_0x581155=_[_0x9e64('0x47')]({},_0x581155,_0x2d7d3a[_0x9e64('0x49')]);var _0xf6cbc0={'where':_0x581155['where']};return db[_0x9e64('0x4a')]['count'](_0xf6cbc0)[_0x9e64('0x2c')](function(_0x305a8a){_0x63e846[_0x9e64('0x26')]=_0x305a8a;if(_0x2d7d3a[_0x9e64('0x3a')][_0x9e64('0x4b')]){_0x581155[_0x9e64('0x4c')]=[{'all':!![]}];}return db[_0x9e64('0x4a')]['findAll'](_0x581155);})[_0x9e64('0x2c')](function(_0x6fd69c){_0x63e846[_0x9e64('0x4d')]=_0x6fd69c;return _0x63e846;})[_0x9e64('0x2c')](respondWithFilteredResult(_0x4f06cf,_0x581155))[_0x9e64('0x4e')](handleError(_0x4f06cf,null));};exports[_0x9e64('0x4f')]=function(_0xcbf906,_0x391a70){var _0x33f8cb={'raw':!![],'where':{'id':_0xcbf906[_0x9e64('0x50')]['id']}},_0x107958={};_0x107958[_0x9e64('0x39')]=_['keys'](db[_0x9e64('0x4a')][_0x9e64('0x36')]);_0x107958[_0x9e64('0x3a')]=_['keys'](_0xcbf906[_0x9e64('0x3a')]);_0x107958['filters']=_['intersection'](_0x107958[_0x9e64('0x39')],_0x107958[_0x9e64('0x3a')]);_0x33f8cb[_0x9e64('0x3e')]=_['intersection'](_0x107958[_0x9e64('0x39')],qs[_0x9e64('0x3f')](_0xcbf906[_0x9e64('0x3a')][_0x9e64('0x3f')]));_0x33f8cb[_0x9e64('0x3e')]=_0x33f8cb[_0x9e64('0x3e')][_0x9e64('0x51')]?_0x33f8cb[_0x9e64('0x3e')]:_0x107958[_0x9e64('0x39')];if(_0xcbf906[_0x9e64('0x3a')][_0x9e64('0x4b')]){_0x33f8cb[_0x9e64('0x4c')]=[{'all':!![]}];}_0x33f8cb=_[_0x9e64('0x47')]({},_0x33f8cb,_0xcbf906[_0x9e64('0x49')]);return db[_0x9e64('0x4a')]['find'](_0x33f8cb)['then'](handleEntityNotFound(_0x391a70,null))['then'](respondWithResult(_0x391a70,null))[_0x9e64('0x4e')](handleError(_0x391a70,null));};exports[_0x9e64('0x52')]=function(_0x16ad15,_0x2e65ed){return db[_0x9e64('0x4a')]['create'](_0x16ad15[_0x9e64('0x53')],{})[_0x9e64('0x2c')](function(_0x313e37){var _0x5c7c48=_0x16ad15['user'][_0x9e64('0x2d')]({'plain':!![]});if(!_0x5c7c48)throw new Error(_0x9e64('0x54'));if(_0x5c7c48[_0x9e64('0x55')]===_0x9e64('0x56')){var _0x5644c6=_0x313e37[_0x9e64('0x2d')]({'plain':!![]});var _0x2f53cc=_0x9e64('0x2e');return db[_0x9e64('0x57')][_0x9e64('0x58')]({'where':{'name':_0x2f53cc,'userProfileId':_0x5c7c48[_0x9e64('0x59')]},'raw':!![]})['then'](function(_0x3b11a1){if(_0x3b11a1&&_0x3b11a1[_0x9e64('0x5a')]===0x0){return db[_0x9e64('0x2f')][_0x9e64('0x52')]({'name':_0x5644c6[_0x9e64('0x32')],'resourceId':_0x5644c6['id'],'type':_0x3b11a1[_0x9e64('0x32')],'sectionId':_0x3b11a1['id']},{})[_0x9e64('0x2c')](function(){return _0x313e37;});}else{return _0x313e37;}})[_0x9e64('0x4e')](function(_0x2d236a){logger[_0x9e64('0x30')](_0x9e64('0x5b'),_0x2d236a);throw _0x2d236a;});}return _0x313e37;})['then'](respondWithResult(_0x2e65ed,0xc9))['catch'](handleError(_0x2e65ed,null));};exports['update']=function(_0x46c2f7,_0x1348b1){if(_0x46c2f7[_0x9e64('0x53')]['id']){delete _0x46c2f7['body']['id'];}return db[_0x9e64('0x4a')][_0x9e64('0x58')]({'where':{'id':_0x46c2f7[_0x9e64('0x50')]['id']}})['then'](handleEntityNotFound(_0x1348b1,null))[_0x9e64('0x2c')](saveUpdates(_0x46c2f7['body'],null))['then'](respondWithResult(_0x1348b1,null))[_0x9e64('0x4e')](handleError(_0x1348b1,null));};exports['destroy']=function(_0x591102,_0x4d3440){return db[_0x9e64('0x4a')][_0x9e64('0x58')]({'where':{'id':_0x591102[_0x9e64('0x50')]['id']}})[_0x9e64('0x2c')](handleEntityNotFound(_0x4d3440,null))[_0x9e64('0x2c')](removeEntity(_0x4d3440,null))['catch'](handleError(_0x4d3440,null));};exports[_0x9e64('0x5c')]=function(_0x2c7107,_0x4ced81){return db[_0x9e64('0x4a')][_0x9e64('0x5c')]()['then'](respondWithResult(_0x4ced81,null))[_0x9e64('0x4e')](handleError(_0x4ced81,null));};exports[_0x9e64('0x5d')]=function(_0x1cea30,_0x4c8e44,_0x459dfa){var _0xe8ad12={'raw':!![],'where':{}},_0x13cf57={},_0x251652;return db[_0x9e64('0x4a')]['findOne']({'where':{'id':_0x1cea30['params']['id']}})['then'](handleEntityNotFound(_0x4c8e44,null))[_0x9e64('0x2c')](function(_0x33d132){if(_0x33d132){_0x251652=_0x33d132[_0x9e64('0x2d')]({'plain':!![]});_0x13cf57[_0x9e64('0x39')]=_['keys'](db[_0x9e64('0x5e')]['rawAttributes']);_0x13cf57[_0x9e64('0x3a')]=_[_0x9e64('0x3b')](_0x1cea30[_0x9e64('0x3a')]);_0x13cf57['filters']=_[_0x9e64('0x3d')](_0x13cf57[_0x9e64('0x39')],_0x13cf57['query']);_0xe8ad12[_0x9e64('0x3e')]=_['intersection'](_0x13cf57[_0x9e64('0x39')],qs['fields'](_0x1cea30['query'][_0x9e64('0x3f')]));_0xe8ad12[_0x9e64('0x3e')]=_0xe8ad12[_0x9e64('0x3e')][_0x9e64('0x51')]?_0xe8ad12[_0x9e64('0x3e')]:_0x13cf57[_0x9e64('0x39')];if(!_0x1cea30[_0x9e64('0x3a')][_0x9e64('0x40')](_0x9e64('0x41'))){_0xe8ad12[_0x9e64('0x25')]=qs[_0x9e64('0x25')](_0x1cea30[_0x9e64('0x3a')][_0x9e64('0x25')]);_0xe8ad12['offset']=qs[_0x9e64('0x23')](_0x1cea30['query'][_0x9e64('0x23')]);}_0xe8ad12['order']=qs[_0x9e64('0x43')](_0x1cea30[_0x9e64('0x3a')]['sort']);_0xe8ad12['where']=qs[_0x9e64('0x3c')](_[_0x9e64('0x44')](_0x1cea30[_0x9e64('0x3a')],_0x13cf57['filters']));_0xe8ad12[_0x9e64('0x46')][_0x9e64('0x5f')]=_0x33d132['id'];if(_0x1cea30['query']['filter']){_0xe8ad12[_0x9e64('0x46')]=_[_0x9e64('0x47')](_0xe8ad12[_0x9e64('0x46')],{'$or':_['map'](_0xe8ad12[_0x9e64('0x3e')],function(_0x2f0f7b){var _0x3af4f6={};_0x3af4f6[_0x2f0f7b]={'$like':'%'+_0x1cea30[_0x9e64('0x3a')][_0x9e64('0x45')]+'%'};return _0x3af4f6;})});}_0xe8ad12=_[_0x9e64('0x47')]({},_0xe8ad12,_0x1cea30[_0x9e64('0x49')]);return db['UserWhatsappQueue']['findAll'](_0xe8ad12);}})[_0x9e64('0x2c')](function(_0x3429ea){if(_0x3429ea){return db[_0x9e64('0x60')][_0x9e64('0x61')]({'where':{'id':_['map'](_0x3429ea,'UserId'),'role':_0x9e64('0x62')},'attributes':['id',_0x9e64('0x32'),_0x9e64('0x63'),_0x9e64('0x64'),_0x9e64('0x65')]});}})[_0x9e64('0x2c')](function(_0x5b6a22){if(_0x5b6a22){return{'count':_0x5b6a22[_0x9e64('0x26')],'rows':_[_0x9e64('0x35')](_0x5b6a22[_0x9e64('0x4d')],function(_0x2f0d23){return{'membername':_0x2f0d23[_0x9e64('0x32')],'UserId':_0x2f0d23['id'],'queue_name':_0x251652[_0x9e64('0x32')],'WhatsappQueueId':_0x251652['id'],'interface':util[_0x9e64('0x66')](_0x9e64('0x67'),_0x9e64('0x68'),_0x2f0d23[_0x9e64('0x32')]),'penalty':0x0,'paused':_0x2f0d23['whatsappPause'],'createdAt':_0x2f0d23[_0x9e64('0x65')],'updatedAt':_0x2f0d23[_0x9e64('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e64('0x2c')](respondWithFilteredResult(_0x4c8e44,_0xe8ad12))['catch'](handleError(_0x4c8e44,null));};exports[_0x9e64('0x69')]=function(_0x26aab3,_0x25b360,_0x4423ae){var _0x37eaac={};var _0x2964a8={};var _0x28100d;var _0x427581;return db['WhatsappQueue'][_0x9e64('0x6a')]({'where':{'id':_0x26aab3[_0x9e64('0x50')]['id']}})['then'](handleEntityNotFound(_0x25b360,null))[_0x9e64('0x2c')](function(_0x40db30){if(_0x40db30){_0x28100d=_0x40db30;_0x2964a8['model']=_['keys'](db[_0x9e64('0x6b')][_0x9e64('0x36')]);_0x2964a8['query']=_[_0x9e64('0x3b')](_0x26aab3[_0x9e64('0x3a')]);_0x2964a8[_0x9e64('0x3c')]=_[_0x9e64('0x3d')](_0x2964a8[_0x9e64('0x39')],_0x2964a8[_0x9e64('0x3a')]);_0x37eaac['attributes']=_[_0x9e64('0x3d')](_0x2964a8[_0x9e64('0x39')],qs['fields'](_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x3f')]));_0x37eaac[_0x9e64('0x3e')]=_0x37eaac[_0x9e64('0x3e')]['length']?_0x37eaac['attributes']:_0x2964a8[_0x9e64('0x39')];_0x37eaac[_0x9e64('0x42')]=qs[_0x9e64('0x43')](_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x43')]);_0x37eaac[_0x9e64('0x46')]=qs['filters'](_[_0x9e64('0x44')](_0x26aab3[_0x9e64('0x3a')],_0x2964a8[_0x9e64('0x3c')]));if(_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x45')]){_0x37eaac[_0x9e64('0x46')]=_[_0x9e64('0x47')](_0x37eaac[_0x9e64('0x46')],{'$or':_[_0x9e64('0x35')](_0x37eaac['attributes'],function(_0x4d5ff0){var _0x536384={};_0x536384[_0x4d5ff0]={'$like':'%'+_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x45')]+'%'};return _0x536384;})});}_0x37eaac=_[_0x9e64('0x47')]({},_0x37eaac,_0x26aab3[_0x9e64('0x49')]);return _0x28100d[_0x9e64('0x69')](_0x37eaac);}})['then'](function(_0xdd444a){if(_0xdd444a){_0x427581=_0xdd444a[_0x9e64('0x51')];if(!_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x40')](_0x9e64('0x41'))){_0x37eaac['limit']=qs[_0x9e64('0x25')](_0x26aab3['query'][_0x9e64('0x25')]);_0x37eaac[_0x9e64('0x23')]=qs[_0x9e64('0x23')](_0x26aab3[_0x9e64('0x3a')][_0x9e64('0x23')]);}return _0x28100d[_0x9e64('0x69')](_0x37eaac);}})[_0x9e64('0x2c')](function(_0x50f933){if(_0x50f933){return _0x50f933?{'count':_0x427581,'rows':_0x50f933}:null;}})[_0x9e64('0x2c')](respondWithResult(_0x25b360,null))[_0x9e64('0x4e')](handleError(_0x25b360,null));};exports['addTeams']=function(_0x69f8ea,_0x4fd4ee,_0x47064f){var _0x8d5339=_0x69f8ea[_0x9e64('0x53')][_0x9e64('0x6c')];return db['Team']['findAll']({'where':{'id':_0x8d5339},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9e64('0x6d'),'attributes':['id',_0x9e64('0x32'),'online',_0x9e64('0x6e'),_0x9e64('0x6f')],'raw':!![]}]})[_0x9e64('0x2c')](function(_0x228ce4){if(_0x228ce4){var _0x49a78f=_[_0x9e64('0x70')](_0x228ce4,function(_0x1b6e41){var _0x102a19=_0x1b6e41[_0x9e64('0x2d')]({'plain':!![]});return _0x102a19[_0x9e64('0x6d')];});return db[_0x9e64('0x4a')]['find']({'where':{'id':_0x69f8ea['params']['id']}})[_0x9e64('0x2c')](function(_0x754992){return db['sequelize'][_0x9e64('0x71')](function(_0x5e1d15){return _0x754992[_0x9e64('0x72')](_0x8d5339,{'transaction':_0x5e1d15})[_0x9e64('0x2c')](function(){return BPromise['each'](_0x49a78f,function(_0xa91c21){return db['UserWhatsappQueue'][_0x9e64('0x73')]({'where':{'UserId':_0xa91c21['id'],'WhatsappQueueId':_0x69f8ea[_0x9e64('0x50')]['id']},'transaction':_0x5e1d15});});})[_0x9e64('0x2c')](function(){_0x49a78f[_0x9e64('0x74')](function(_0x395929){socket['emit'](_0x9e64('0x75'),{'UserId':_0x395929['id'],'WhatsappQueueId':_0x754992['id']});});});});});}})[_0x9e64('0x2c')](respondWithStatusCode(_0x4fd4ee,null))['catch'](handleError(_0x4fd4ee,null));};exports['removeTeams']=function(_0x2caca5,_0x2b6848,_0x50aac3){return db['Team']['findAll']({'where':{'id':_0x2caca5[_0x9e64('0x3a')][_0x9e64('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9e64('0x2c')](handleEntityNotFound(_0x2b6848,null))[_0x9e64('0x2c')](function(_0x12f655){var _0x3537a6=_['map'](_0x12f655,'id');var _0x2bdfaa=[];var _0xa44b77=[];var _0x53d45f=squel[_0x9e64('0x76')]();_0x53d45f[_0x9e64('0x77')]('tq.TeamId')[_0x9e64('0x78')](_0x9e64('0x79'),'tq')[_0x9e64('0x7a')](_0x9e64('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9e64('0x46')](_0x9e64('0x7c'),_0x2caca5[_0x9e64('0x50')]['id']);for(var _0x2f22a1=0x0;_0x2f22a1<_0x12f655[_0x9e64('0x51')];_0x2f22a1+=0x1){let _0x4352fe=_0x12f655[_0x2f22a1];for(var _0xa20466=0x0;_0xa20466<_0x4352fe[_0x9e64('0x6d')][_0x9e64('0x51')];_0xa20466+=0x1){let _0xc47919=_0x4352fe[_0x9e64('0x6d')][_0xa20466];var _0x4e5a9a=_0x53d45f['clone']();_0x4e5a9a[_0x9e64('0x46')]('ut.UserId\x20=\x20?',_0xc47919['id']);_0xa44b77['push'](db[_0x9e64('0x7d')][_0x9e64('0x3a')](_0x4e5a9a['toString'](),{'type':db[_0x9e64('0x7d')][_0x9e64('0x7e')]['SELECT']})[_0x9e64('0x2c')](function(_0x539c65){if(_0x539c65[_0x9e64('0x51')]===0x1){return _0xc47919['id'];}else{var _0x26d714=_[_0x9e64('0x7f')](_[_0x9e64('0x35')](_0x539c65,_0x9e64('0x80')),function(_0x158c02){return _[_0x9e64('0x81')](_0x3537a6,_0x158c02);});if(_0x26d714){return _0xc47919['id'];}}}));}}return BPromise[_0x9e64('0x82')](_0xa44b77)[_0x9e64('0x2c')](function(_0x5f1202){_0x2bdfaa=_(_0x2bdfaa)['union'](_0x5f1202)['compact']()[_0x9e64('0x83')]();return db[_0x9e64('0x4a')][_0x9e64('0x58')]({'where':{'id':_0x2caca5[_0x9e64('0x50')]['id']}})[_0x9e64('0x2c')](function(_0x239fcf){return db['sequelize'][_0x9e64('0x71')](function(_0x48eb1b){return _0x239fcf[_0x9e64('0x84')](_0x2caca5[_0x9e64('0x3a')][_0x9e64('0x6c')],{'transaction':_0x48eb1b})['then'](function(){if(!_[_0x9e64('0x85')](_0x2bdfaa)){return _0x239fcf[_0x9e64('0x86')](_0x2bdfaa,{'transaction':_0x48eb1b});}})[_0x9e64('0x2c')](function(){_0x2bdfaa[_0x9e64('0x74')](function(_0x557af5){socket[_0x9e64('0x87')](_0x9e64('0x88'),{'UserId':_0x557af5,'WhatsappQueueId':_0x239fcf['id']});});});});});});})['then'](respondWithStatusCode(_0x2b6848,null))[_0x9e64('0x4e')](handleError(_0x2b6848,null));};exports[_0x9e64('0x89')]=function(_0x3e0871,_0x2644e3,_0x4b5d4f){return db[_0x9e64('0x4a')]['find']({'where':{'id':_0x3e0871[_0x9e64('0x50')]['id']}})[_0x9e64('0x2c')](handleEntityNotFound(_0x2644e3,null))[_0x9e64('0x2c')](function(_0x223ff5){if(_0x223ff5){return _0x223ff5[_0x9e64('0x89')](_0x3e0871[_0x9e64('0x53')]['ids'],_[_0x9e64('0x8a')](_0x3e0871['body'],[_0x9e64('0x6c'),'id'])||{})[_0x9e64('0x8b')](function(_0x43cf98){for(var _0x4f58f1=0x0;_0x4f58f1<_0x3e0871['body'][_0x9e64('0x6c')][_0x9e64('0x51')];_0x4f58f1+=0x1){socket[_0x9e64('0x87')](_0x9e64('0x75'),{'UserId':Number(_0x3e0871[_0x9e64('0x53')]['ids'][_0x4f58f1]),'WhatsappQueueId':Number(_0x3e0871[_0x9e64('0x50')]['id'])});}return _0x43cf98;});}})[_0x9e64('0x2c')](respondWithResult(_0x2644e3,null))[_0x9e64('0x4e')](handleError(_0x2644e3,null));};exports[_0x9e64('0x86')]=function(_0x2ab07f,_0x3eae6e,_0x5e9a08){return db[_0x9e64('0x4a')]['find']({'where':{'id':_0x2ab07f[_0x9e64('0x50')]['id']}})['then'](handleEntityNotFound(_0x3eae6e,null))[_0x9e64('0x2c')](function(_0x5bfe18){if(_0x5bfe18){return _0x5bfe18[_0x9e64('0x86')](_0x2ab07f[_0x9e64('0x3a')][_0x9e64('0x6c')])[_0x9e64('0x2c')](function(){if(_[_0x9e64('0x8c')](_0x2ab07f[_0x9e64('0x3a')][_0x9e64('0x6c')])){for(var _0x30d0dc=0x0;_0x30d0dc<_0x2ab07f[_0x9e64('0x3a')][_0x9e64('0x6c')][_0x9e64('0x51')];_0x30d0dc+=0x1){socket[_0x9e64('0x87')](_0x9e64('0x88'),{'UserId':Number(_0x2ab07f[_0x9e64('0x3a')][_0x9e64('0x6c')][_0x30d0dc]),'WhatsappQueueId':Number(_0x2ab07f[_0x9e64('0x50')]['id'])});}}else{socket[_0x9e64('0x87')](_0x9e64('0x88'),{'UserId':Number(_0x2ab07f['query'][_0x9e64('0x6c')]),'WhatsappQueueId':Number(_0x2ab07f[_0x9e64('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eae6e,null))[_0x9e64('0x4e')](handleError(_0x3eae6e,null));};exports[_0x9e64('0x8d')]=function(_0x26de12,_0x6f3018,_0x45337b){var _0x5494bc={};var _0x1bf4d1={};var _0x2c34d9;var _0x254413;return db[_0x9e64('0x4a')][_0x9e64('0x6a')]({'where':{'id':_0x26de12[_0x9e64('0x50')]['id']}})[_0x9e64('0x2c')](handleEntityNotFound(_0x6f3018,null))[_0x9e64('0x2c')](function(_0x4c4147){if(_0x4c4147){_0x2c34d9=_0x4c4147;_0x1bf4d1['model']=_[_0x9e64('0x3b')](db['User']['rawAttributes']);_0x1bf4d1[_0x9e64('0x3a')]=_[_0x9e64('0x3b')](_0x26de12[_0x9e64('0x3a')]);_0x1bf4d1['filters']=_[_0x9e64('0x3d')](_0x1bf4d1[_0x9e64('0x39')],_0x1bf4d1[_0x9e64('0x3a')]);_0x5494bc['attributes']=_[_0x9e64('0x3d')](_0x1bf4d1[_0x9e64('0x39')],qs['fields'](_0x26de12[_0x9e64('0x3a')][_0x9e64('0x3f')]));_0x5494bc[_0x9e64('0x3e')]=_0x5494bc[_0x9e64('0x3e')][_0x9e64('0x51')]?_0x5494bc[_0x9e64('0x3e')]:_0x1bf4d1['model'];_0x5494bc[_0x9e64('0x42')]=qs[_0x9e64('0x43')](_0x26de12[_0x9e64('0x3a')][_0x9e64('0x43')]);_0x5494bc[_0x9e64('0x46')]=qs[_0x9e64('0x3c')](_[_0x9e64('0x44')](_0x26de12[_0x9e64('0x3a')],_0x1bf4d1[_0x9e64('0x3c')]));if(_0x26de12[_0x9e64('0x3a')][_0x9e64('0x45')]){_0x5494bc[_0x9e64('0x46')]=_[_0x9e64('0x47')](_0x5494bc['where'],{'$or':_[_0x9e64('0x35')](_0x5494bc['attributes'],function(_0x1d039f){var _0x1784ce={};_0x1784ce[_0x1d039f]={'$like':'%'+_0x26de12[_0x9e64('0x3a')]['filter']+'%'};return _0x1784ce;})});}_0x5494bc=_['merge']({},_0x5494bc,_0x26de12['options']);return _0x2c34d9[_0x9e64('0x8d')](_0x5494bc);}})[_0x9e64('0x2c')](function(_0x3b3776){if(_0x3b3776){_0x254413=_0x3b3776[_0x9e64('0x51')];if(!_0x26de12['query'][_0x9e64('0x40')](_0x9e64('0x41'))){_0x5494bc[_0x9e64('0x25')]=qs['limit'](_0x26de12[_0x9e64('0x3a')]['limit']);_0x5494bc[_0x9e64('0x23')]=qs[_0x9e64('0x23')](_0x26de12[_0x9e64('0x3a')][_0x9e64('0x23')]);}return _0x2c34d9[_0x9e64('0x8d')](_0x5494bc);}})[_0x9e64('0x2c')](function(_0x102db0){if(_0x102db0){return _0x102db0?{'count':_0x254413,'rows':_0x102db0}:null;}})['then'](respondWithResult(_0x6f3018,null))['catch'](handleError(_0x6f3018,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 229e482..e072824 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 _0x06a4=['events','WhatsappQueue','setMaxListeners','save','update','remove','hook','exports'];(function(_0x121d9e,_0x11b966){var _0x5df466=function(_0x519340){while(--_0x519340){_0x121d9e['push'](_0x121d9e['shift']());}};_0x5df466(++_0x11b966);}(_0x06a4,0xf0));var _0x406a=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0x06a4[_0xd60031];return _0x43d00a;};'use strict';var EventEmitter=require(_0x406a('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x406a('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x406a('0x2')](0x0);var events={'afterCreate':_0x406a('0x3'),'afterUpdate':_0x406a('0x4'),'afterDestroy':_0x406a('0x5')};function emitEvent(_0x100ca2){return function(_0x3ed74a,_0x1886fd,_0x49335c){WhatsappQueueEvents['emit'](_0x100ca2+':'+_0x3ed74a['id'],_0x3ed74a);WhatsappQueueEvents['emit'](_0x100ca2,_0x3ed74a);_0x49335c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x406a('0x6')](e,emitEvent(event));}}module[_0x406a('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x5aa2=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x41aa4d,_0x51e45f){var _0x3fb7d6=function(_0x3833ec){while(--_0x3833ec){_0x41aa4d['push'](_0x41aa4d['shift']());}};_0x3fb7d6(++_0x51e45f);}(_0x5aa2,0x1d3));var _0x25aa=function(_0x56a1b7,_0x1118cf){_0x56a1b7=_0x56a1b7-0x0;var _0x5e31fc=_0x5aa2[_0x56a1b7];return _0x5e31fc;};'use strict';var EventEmitter=require(_0x25aa('0x0'));var WhatsappQueue=require(_0x25aa('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x25aa('0x2')](0x0);var events={'afterCreate':_0x25aa('0x3'),'afterUpdate':_0x25aa('0x4'),'afterDestroy':_0x25aa('0x5')};function emitEvent(_0x566f66){return function(_0x3266fc,_0xd6f40d,_0x5bcc01){WhatsappQueueEvents[_0x25aa('0x6')](_0x566f66+':'+_0x3266fc['id'],_0x3266fc);WhatsappQueueEvents['emit'](_0x566f66,_0x3266fc);_0x5bcc01(null);};}for(var e in events){if(events[_0x25aa('0x7')](e)){var event=events[e];WhatsappQueue[_0x25aa('0x8')](e,emitEvent(event));}}module[_0x25aa('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index cdeac2e..1a8ffb0 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 _0x0e7b=['lodash','util','../../config/logger','bluebird','path','./whatsappQueue.attributes','define','WhatsappQueue'];(function(_0x38c8f5,_0x37e7b9){var _0xcd1ec2=function(_0x45d22a){while(--_0x45d22a){_0x38c8f5['push'](_0x38c8f5['shift']());}};_0xcd1ec2(++_0x37e7b9);}(_0x0e7b,0x158));var _0xb0e7=function(_0x126d0d,_0x447c7f){_0x126d0d=_0x126d0d-0x0;var _0x14c01f=_0x0e7b[_0x126d0d];return _0x14c01f;};'use strict';var _=require(_0xb0e7('0x0'));var util=require(_0xb0e7('0x1'));var logger=require(_0xb0e7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb0e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0e7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb0e7('0x5'));module['exports']=function(_0x1e4f47,_0x202a42){return _0x1e4f47[_0xb0e7('0x6')](_0xb0e7('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd319=['WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd319,0x98));var _0x9d31=function(_0x4f66f0,_0x30de3a){_0x4f66f0=_0x4f66f0-0x0;var _0x309c2d=_0xd319[_0x4f66f0];return _0x309c2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d31('0x0'))(_0x9d31('0x1'));var moment=require(_0x9d31('0x2'));var BPromise=require(_0x9d31('0x3'));var rp=require(_0x9d31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d31('0x5'));var config=require(_0x9d31('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x3ce107,_0x2bed71){return _0x3ce107[_0x9d31('0x7')](_0x9d31('0x8'),attributes,{'tableName':_0x9d31('0x9'),'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 d84230d..10ed366 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 _0x8da5=['WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','debug','stringify','ShowWhatsappQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','redis','./whatsappQueue.socket','register','request','then','info'];(function(_0x5a5099,_0xeb4601){var _0x5ea330=function(_0x24e1b5){while(--_0x24e1b5){_0x5a5099['push'](_0x5a5099['shift']());}};_0x5ea330(++_0xeb4601);}(_0x8da5,0x1a6));var _0x58da=function(_0x71a826,_0x3095d2){_0x71a826=_0x71a826-0x0;var _0x1af7f9=_0x8da5[_0x71a826];return _0x1af7f9;};'use strict';var _=require(_0x58da('0x0'));var util=require(_0x58da('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x58da('0x2'));var fs=require('fs');var Redis=require(_0x58da('0x3'));var db=require(_0x58da('0x4'))['db'];var utils=require(_0x58da('0x5'));var logger=require(_0x58da('0x6'))(_0x58da('0x7'));var config=require('../../config/environment');var jayson=require(_0x58da('0x8'));var client=jayson['client'][_0x58da('0x9')]({'port':0x232a});config['redis']=_[_0x58da('0xa')](config['redis'],{'host':_0x58da('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x58da('0xc')]));require(_0x58da('0xd'))[_0x58da('0xe')](socket);function respondWithRpcPromise(_0x116aa8,_0x2249d2,_0x1a6bd4){return new BPromise(function(_0x4c8cae,_0x4f15ce){return client[_0x58da('0xf')](_0x116aa8,_0x1a6bd4)[_0x58da('0x10')](function(_0x553534){logger[_0x58da('0x11')](_0x58da('0x12'),_0x2249d2,_0x58da('0x13'));logger['debug'](_0x58da('0x14'),_0x2249d2,_0x58da('0x13'),JSON['stringify'](_0x553534));if(_0x553534[_0x58da('0x15')]){if(_0x553534[_0x58da('0x15')][_0x58da('0x16')]===0x1f4){logger[_0x58da('0x15')](_0x58da('0x12'),_0x2249d2,_0x553534[_0x58da('0x15')][_0x58da('0x17')]);return _0x4f15ce(_0x553534[_0x58da('0x15')][_0x58da('0x17')]);}logger[_0x58da('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2249d2,_0x553534['error'][_0x58da('0x17')]);return _0x4c8cae(_0x553534['error'][_0x58da('0x17')]);}else{logger['info'](_0x58da('0x12'),_0x2249d2,_0x58da('0x13'));_0x4c8cae(_0x553534[_0x58da('0x18')]['message']);}})[_0x58da('0x19')](function(_0x125129){logger[_0x58da('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2249d2,_0x125129);_0x4f15ce(_0x125129);});});}exports['GetWhatsappQueue']=function(_0x3d29e0){var _0x4bfc65=this;return new Promise(function(_0xbdf388,_0x2c3964){return db[_0x58da('0x1a')][_0x58da('0x1b')]({'raw':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0['options'][_0x58da('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x1e')]||null:null,'attributes':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x1f')]||null:null,'limit':_0x3d29e0['options']?_0x3d29e0['options'][_0x58da('0x20')]||null:null,'include':_0x3d29e0[_0x58da('0x1c')]?_0x3d29e0[_0x58da('0x1c')][_0x58da('0x21')]?_[_0x58da('0x22')](_0x3d29e0[_0x58da('0x1c')][_0x58da('0x21')],function(_0x1b5c2e){return{'model':db[_0x1b5c2e[_0x58da('0x23')]],'as':_0x1b5c2e['as'],'attributes':_0x1b5c2e['attributes'],'include':_0x1b5c2e[_0x58da('0x21')]?_[_0x58da('0x22')](_0x1b5c2e[_0x58da('0x21')],function(_0x35e4ee){return{'model':db[_0x35e4ee[_0x58da('0x23')]],'as':_0x35e4ee['as'],'attributes':_0x35e4ee[_0x58da('0x1f')],'include':_0x35e4ee['include']?_[_0x58da('0x22')](_0x35e4ee['include'],function(_0x57c803){return{'model':db[_0x57c803[_0x58da('0x23')]],'as':_0x57c803['as'],'attributes':_0x57c803['attributes']};}):[]};}):[]};}):[]:[]})[_0x58da('0x10')](function(_0x17ebd6){logger['info'](_0x58da('0x24'),_0x3d29e0);logger[_0x58da('0x25')]('GetWhatsappQueue',_0x3d29e0,JSON[_0x58da('0x26')](_0x17ebd6));_0xbdf388(_0x17ebd6);})[_0x58da('0x19')](function(_0x1a8e0e){logger[_0x58da('0x15')](_0x58da('0x24'),_0x1a8e0e[_0x58da('0x17')],_0x3d29e0);_0x2c3964(_0x4bfc65['error'](0x1f4,_0x1a8e0e[_0x58da('0x17')]));});});};exports[_0x58da('0x27')]=function(_0x25bf05){var _0x3f873b=this;return new Promise(function(_0x3a8d6f,_0x14af7f){return db[_0x58da('0x1a')]['find']({'raw':_0x25bf05['options']?_0x25bf05['options']['raw']===undefined?!![]:![]:!![],'where':_0x25bf05[_0x58da('0x1c')]?_0x25bf05[_0x58da('0x1c')]['where']||null:null,'attributes':_0x25bf05[_0x58da('0x1c')]?_0x25bf05['options'][_0x58da('0x1f')]||null:null,'include':_0x25bf05[_0x58da('0x1c')]?_0x25bf05[_0x58da('0x1c')]['include']?_[_0x58da('0x22')](_0x25bf05[_0x58da('0x1c')][_0x58da('0x21')],function(_0x4aef16){return{'model':db[_0x4aef16['model']],'as':_0x4aef16['as'],'attributes':_0x4aef16[_0x58da('0x1f')],'include':_0x4aef16[_0x58da('0x21')]?_[_0x58da('0x22')](_0x4aef16['include'],function(_0x416d03){return{'model':db[_0x416d03[_0x58da('0x23')]],'as':_0x416d03['as'],'attributes':_0x416d03[_0x58da('0x1f')],'include':_0x416d03['include']?_['map'](_0x416d03['include'],function(_0x2c2075){return{'model':db[_0x2c2075[_0x58da('0x23')]],'as':_0x2c2075['as'],'attributes':_0x2c2075[_0x58da('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x58da('0x10')](function(_0x3538e6){logger[_0x58da('0x11')](_0x58da('0x27'),_0x25bf05);logger['debug'](_0x58da('0x27'),_0x25bf05,JSON[_0x58da('0x26')](_0x3538e6));_0x3a8d6f(_0x3538e6);})[_0x58da('0x19')](function(_0x76a745){logger['error'](_0x58da('0x27'),_0x76a745[_0x58da('0x17')],_0x25bf05);_0x14af7f(_0x3f873b[_0x58da('0x15')](0x1f4,_0x76a745[_0x58da('0x17')]));});});}; \ No newline at end of file +var _0x5129=['where','attributes','include','map','model','stringify','ShowWhatsappQueue','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./whatsappQueue.socket','then','info','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','code','WhatsappQueue,\x20%s,\x20%s','error','message','catch','GetWhatsappQueue','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5129,0xbd));var _0x9512=function(_0x4e159c,_0x4c74f2){_0x4e159c=_0x4e159c-0x0;var _0x3ccf60=_0x5129[_0x4e159c];return _0x3ccf60;};'use strict';var _=require(_0x9512('0x0'));var util=require(_0x9512('0x1'));var moment=require(_0x9512('0x2'));var BPromise=require('bluebird');var rs=require(_0x9512('0x3'));var fs=require('fs');var Redis=require(_0x9512('0x4'));var db=require(_0x9512('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9512('0x6'))(_0x9512('0x7'));var config=require(_0x9512('0x8'));var jayson=require(_0x9512('0x9'));var client=jayson[_0x9512('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9512('0xb')](config[_0x9512('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9512('0xd'))(new Redis(config[_0x9512('0xc')]));require(_0x9512('0xe'))['register'](socket);function respondWithRpcPromise(_0x229aa2,_0x596c15,_0x537ac6){return new BPromise(function(_0x5c62f0,_0x48846c){return client['request'](_0x229aa2,_0x537ac6)[_0x9512('0xf')](function(_0x4bcfd7){logger[_0x9512('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x596c15,_0x9512('0x11'));logger['debug'](_0x9512('0x12'),_0x596c15,_0x9512('0x11'),JSON['stringify'](_0x4bcfd7));if(_0x4bcfd7['error']){if(_0x4bcfd7['error'][_0x9512('0x13')]===0x1f4){logger['error'](_0x9512('0x14'),_0x596c15,_0x4bcfd7[_0x9512('0x15')]['message']);return _0x48846c(_0x4bcfd7[_0x9512('0x15')]['message']);}logger['error'](_0x9512('0x14'),_0x596c15,_0x4bcfd7[_0x9512('0x15')][_0x9512('0x16')]);return _0x5c62f0(_0x4bcfd7[_0x9512('0x15')][_0x9512('0x16')]);}else{logger[_0x9512('0x10')](_0x9512('0x14'),_0x596c15,_0x9512('0x11'));_0x5c62f0(_0x4bcfd7['result']['message']);}})[_0x9512('0x17')](function(_0x592795){logger[_0x9512('0x15')](_0x9512('0x14'),_0x596c15,_0x592795);_0x48846c(_0x592795);});});}exports[_0x9512('0x18')]=function(_0x449b84){var _0xb6e903=this;return new Promise(function(_0x5540b1,_0x89ddf){return db['WhatsappQueue']['findAll']({'raw':_0x449b84[_0x9512('0x19')]?_0x449b84[_0x9512('0x19')][_0x9512('0x1a')]===undefined?!![]:![]:!![],'where':_0x449b84[_0x9512('0x19')]?_0x449b84[_0x9512('0x19')][_0x9512('0x1b')]||null:null,'attributes':_0x449b84[_0x9512('0x19')]?_0x449b84[_0x9512('0x19')][_0x9512('0x1c')]||null:null,'limit':_0x449b84['options']?_0x449b84[_0x9512('0x19')]['limit']||null:null,'include':_0x449b84['options']?_0x449b84[_0x9512('0x19')][_0x9512('0x1d')]?_[_0x9512('0x1e')](_0x449b84[_0x9512('0x19')][_0x9512('0x1d')],function(_0x42faa0){return{'model':db[_0x42faa0['model']],'as':_0x42faa0['as'],'attributes':_0x42faa0[_0x9512('0x1c')],'include':_0x42faa0[_0x9512('0x1d')]?_[_0x9512('0x1e')](_0x42faa0['include'],function(_0x47fea1){return{'model':db[_0x47fea1[_0x9512('0x1f')]],'as':_0x47fea1['as'],'attributes':_0x47fea1[_0x9512('0x1c')],'include':_0x47fea1['include']?_[_0x9512('0x1e')](_0x47fea1['include'],function(_0x3a98a8){return{'model':db[_0x3a98a8[_0x9512('0x1f')]],'as':_0x3a98a8['as'],'attributes':_0x3a98a8[_0x9512('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9512('0xf')](function(_0x510f91){logger['info']('GetWhatsappQueue',_0x449b84);logger['debug'](_0x9512('0x18'),_0x449b84,JSON[_0x9512('0x20')](_0x510f91));_0x5540b1(_0x510f91);})['catch'](function(_0xa16b8a){logger[_0x9512('0x15')]('GetWhatsappQueue',_0xa16b8a[_0x9512('0x16')],_0x449b84);_0x89ddf(_0xb6e903[_0x9512('0x15')](0x1f4,_0xa16b8a[_0x9512('0x16')]));});});};exports[_0x9512('0x21')]=function(_0x491748){var _0x47dc9c=this;return new Promise(function(_0x53b910,_0x19884c){return db['WhatsappQueue'][_0x9512('0x22')]({'raw':_0x491748['options']?_0x491748[_0x9512('0x19')][_0x9512('0x1a')]===undefined?!![]:![]:!![],'where':_0x491748['options']?_0x491748['options']['where']||null:null,'attributes':_0x491748[_0x9512('0x19')]?_0x491748[_0x9512('0x19')][_0x9512('0x1c')]||null:null,'include':_0x491748[_0x9512('0x19')]?_0x491748[_0x9512('0x19')][_0x9512('0x1d')]?_[_0x9512('0x1e')](_0x491748['options']['include'],function(_0x36341e){return{'model':db[_0x36341e[_0x9512('0x1f')]],'as':_0x36341e['as'],'attributes':_0x36341e[_0x9512('0x1c')],'include':_0x36341e[_0x9512('0x1d')]?_[_0x9512('0x1e')](_0x36341e[_0x9512('0x1d')],function(_0x59d3f9){return{'model':db[_0x59d3f9[_0x9512('0x1f')]],'as':_0x59d3f9['as'],'attributes':_0x59d3f9['attributes'],'include':_0x59d3f9[_0x9512('0x1d')]?_[_0x9512('0x1e')](_0x59d3f9[_0x9512('0x1d')],function(_0x57d2ca){return{'model':db[_0x57d2ca['model']],'as':_0x57d2ca['as'],'attributes':_0x57d2ca[_0x9512('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9512('0xf')](function(_0x868f30){logger[_0x9512('0x10')]('ShowWhatsappQueue',_0x491748);logger[_0x9512('0x23')]('ShowWhatsappQueue',_0x491748,JSON[_0x9512('0x20')](_0x868f30));_0x53b910(_0x868f30);})[_0x9512('0x17')](function(_0x44c7bf){logger[_0x9512('0x15')](_0x9512('0x21'),_0x44c7bf[_0x9512('0x16')],_0x491748);_0x19884c(_0x47dc9c['error'](0x1f4,_0x44c7bf[_0x9512('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 567747e..2a8e2e5 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 _0x44f1=['update','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0xc3a63e,_0x20074e){var _0x39dc4a=function(_0x45c90f){while(--_0x45c90f){_0xc3a63e['push'](_0xc3a63e['shift']());}};_0x39dc4a(++_0x20074e);}(_0x44f1,0x1bd));var _0x144f=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x44f1[_0x2a6809];return _0x11c371;};'use strict';var WhatsappQueueEvents=require(_0x144f('0x0'));var events=[_0x144f('0x1'),_0x144f('0x2'),_0x144f('0x3')];function createListener(_0x2c1a8e,_0x1bad81){return function(_0x101f48){_0x1bad81['emit'](_0x2c1a8e,_0x101f48);};}function removeListener(_0x14591d,_0xcc3dd2){return function(){WhatsappQueueEvents[_0x144f('0x4')](_0x14591d,_0xcc3dd2);};}exports[_0x144f('0x5')]=function(_0xa75e31){for(var _0x5d547d=0x0,_0x59f5ce=events['length'];_0x5d547d<_0x59f5ce;_0x5d547d++){var _0x299f0a=events[_0x5d547d];var _0x4836df=createListener(_0x144f('0x6')+_0x299f0a,_0xa75e31);WhatsappQueueEvents['on'](_0x299f0a,_0x4836df);}}; \ No newline at end of file +var _0x3f13=['update','removeListener','register','./whatsappQueue.events','remove'];(function(_0x2ea7c6,_0xd3da6c){var _0x1ef268=function(_0x42b943){while(--_0x42b943){_0x2ea7c6['push'](_0x2ea7c6['shift']());}};_0x1ef268(++_0xd3da6c);}(_0x3f13,0xda));var _0x33f1=function(_0x50b8f3,_0x58542d){_0x50b8f3=_0x50b8f3-0x0;var _0x5b6f1b=_0x3f13[_0x50b8f3];return _0x5b6f1b;};'use strict';var WhatsappQueueEvents=require(_0x33f1('0x0'));var events=['save',_0x33f1('0x1'),_0x33f1('0x2')];function createListener(_0x2a303a,_0x2cd8da){return function(_0x268225){_0x2cd8da['emit'](_0x2a303a,_0x268225);};}function removeListener(_0x45d5b7,_0x358693){return function(){WhatsappQueueEvents[_0x33f1('0x3')](_0x45d5b7,_0x358693);};}exports[_0x33f1('0x4')]=function(_0x1c048c){for(var _0x220bd5=0x0,_0x24b6e1=events['length'];_0x220bd5<_0x24b6e1;_0x220bd5++){var _0x109fb7=events[_0x220bd5];var _0x224e56=createListener('whatsappQueue:'+_0x109fb7,_0x1c048c);WhatsappQueueEvents['on'](_0x109fb7,_0x224e56);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 052f2e3..cdbcd3e 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 _0xcb2c=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x314454,_0x4ccb32){var _0x2717b3=function(_0x588813){while(--_0x588813){_0x314454['push'](_0x314454['shift']());}};_0x2717b3(++_0x4ccb32);}(_0xcb2c,0x17a));var _0xccb2=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xcb2c[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var path=require(_0xccb2('0x2'));var timeout=require(_0xccb2('0x3'));var express=require(_0xccb2('0x4'));var router=express['Router']();var fs_extra=require(_0xccb2('0x5'));var auth=require(_0xccb2('0x6'));var interaction=require(_0xccb2('0x7'));var config=require(_0xccb2('0x8'));var controller=require(_0xccb2('0x9'));router[_0xccb2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xccb2('0xa')](_0xccb2('0xb'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xd')]);router[_0xccb2('0xa')](_0xccb2('0xe'),auth[_0xccb2('0xc')](),controller[_0xccb2('0xf')]);router[_0xccb2('0x10')]('/',auth[_0xccb2('0xc')](),controller[_0xccb2('0x11')]);router[_0xccb2('0x12')]('/:id',auth[_0xccb2('0xc')](),controller[_0xccb2('0x13')]);router[_0xccb2('0x14')](_0xccb2('0xe'),auth[_0xccb2('0xc')](),controller['destroy']);module[_0xccb2('0x15')]=router; \ No newline at end of file +var _0x4215=['update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x1a04f4,_0x4c3e77){var _0x47e9bc=function(_0x250b00){while(--_0x250b00){_0x1a04f4['push'](_0x1a04f4['shift']());}};_0x47e9bc(++_0x4c3e77);}(_0x4215,0x9c));var _0x5421=function(_0x27d4cc,_0x16df4c){_0x27d4cc=_0x27d4cc-0x0;var _0x309d8a=_0x4215[_0x27d4cc];return _0x309d8a;};'use strict';var multer=require(_0x5421('0x0'));var util=require(_0x5421('0x1'));var path=require('path');var timeout=require(_0x5421('0x2'));var express=require(_0x5421('0x3'));var router=express['Router']();var fs_extra=require(_0x5421('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5421('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x5421('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5421('0x6')](_0x5421('0x7'),auth[_0x5421('0x8')](),controller[_0x5421('0x9')]);router[_0x5421('0x6')](_0x5421('0xa'),auth[_0x5421('0x8')](),controller[_0x5421('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5421('0xc')]);router[_0x5421('0xd')](_0x5421('0xa'),auth['isAuthenticated'](),controller[_0x5421('0xe')]);router[_0x5421('0xf')]('/:id',auth[_0x5421('0x8')](),controller[_0x5421('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 41f0658..a4f67ec 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(_0x14d91b,_0x549b40){var _0x2c4d52=function(_0xd06c83){while(--_0xd06c83){_0x14d91b['push'](_0x14d91b['shift']());}};_0x2c4d52(++_0x549b40);}(_0x7a54,0x106));var _0x47a5=function(_0x2fb791,_0x50a455){_0x2fb791=_0x2fb791-0x0;var _0x108dff=_0x7a54[_0x2fb791];return _0x108dff;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x122e7c,_0xb94e2f){var _0x487f1b=function(_0x87aed2){while(--_0x87aed2){_0x122e7c['push'](_0x122e7c['shift']());}};_0x487f1b(++_0xb94e2f);}(_0x7a54,0x106));var _0x47a5=function(_0x3b9a10,_0x37c5d9){_0x3b9a10=_0x3b9a10-0x0;var _0x4a4329=_0x7a54[_0x3b9a10];return _0x4a4329;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 8b034b3..2789446 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 _0x8603=['fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes'];(function(_0x84fd21,_0x10fc28){var _0x53fd29=function(_0x1b9116){while(--_0x1b9116){_0x84fd21['push'](_0x84fd21['shift']());}};_0x53fd29(++_0x10fc28);}(_0x8603,0x190));var _0x3860=function(_0x2b2998,_0xc35385){_0x2b2998=_0x2b2998-0x0;var _0x491cec=_0x8603[_0x2b2998];return _0x491cec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];function respondWithStatusCode(_0x8ad61d,_0x2428f6){_0x2428f6=_0x2428f6||0xcc;return function(_0x1ea619){if(_0x1ea619){return _0x8ad61d[_0x3860('0x15')](_0x2428f6);}return _0x8ad61d[_0x3860('0x16')](_0x2428f6)[_0x3860('0x17')]();};}function respondWithResult(_0x12b23b,_0x465d8d){_0x465d8d=_0x465d8d||0xc8;return function(_0x46264d){if(_0x46264d){return _0x12b23b['status'](_0x465d8d)[_0x3860('0x18')](_0x46264d);}};}function respondWithFilteredResult(_0x21eaf1,_0x122e40){return function(_0x37d9ab){if(_0x37d9ab){var _0x1055b3=typeof _0x122e40[_0x3860('0x19')]===_0x3860('0x1a')&&typeof _0x122e40[_0x3860('0x1b')]===_0x3860('0x1a');var _0x3c0d91=_0x37d9ab[_0x3860('0x1c')];var _0x45b799=_0x1055b3?0x0:_0x122e40['offset'];var _0x4863bd=_0x1055b3?_0x37d9ab[_0x3860('0x1c')]:_0x122e40[_0x3860('0x19')]+_0x122e40[_0x3860('0x1b')];var _0x53fc63;if(_0x4863bd>=_0x3c0d91){_0x4863bd=_0x3c0d91;_0x53fc63=0xc8;}else{_0x53fc63=0xce;}_0x21eaf1[_0x3860('0x16')](_0x53fc63);return _0x21eaf1[_0x3860('0x1d')](_0x3860('0x1e'),_0x45b799+'-'+_0x4863bd+'/'+_0x3c0d91)[_0x3860('0x18')](_0x37d9ab);}return null;};}function patchUpdates(_0x20a5b0){return function(_0x45081f){try{jsonpatch[_0x3860('0x1f')](_0x45081f,_0x20a5b0,!![]);}catch(_0x1f8891){return BPromise[_0x3860('0x20')](_0x1f8891);}return _0x45081f[_0x3860('0x21')]();};}function saveUpdates(_0xacd57f,_0x2e0b6e){return function(_0x280ea9){if(_0x280ea9){return _0x280ea9[_0x3860('0x22')](_0xacd57f)[_0x3860('0x23')](function(_0x564efd){return _0x564efd;});}return null;};}function removeEntity(_0xfc10a5,_0x133093){return function(_0x2b91f2){if(_0x2b91f2){return _0x2b91f2[_0x3860('0x24')]()[_0x3860('0x23')](function(){_0xfc10a5['status'](0xcc)[_0x3860('0x17')]();});}};}function handleEntityNotFound(_0x568515,_0x577750){return function(_0xfa9705){if(!_0xfa9705){_0x568515[_0x3860('0x15')](0x194);}return _0xfa9705;};}function handleError(_0x54b5ec,_0x4d9a90){_0x4d9a90=_0x4d9a90||0x1f4;return function(_0x5f42d5){logger[_0x3860('0x25')](_0x5f42d5[_0x3860('0x26')]);if(_0x5f42d5[_0x3860('0x27')]){delete _0x5f42d5[_0x3860('0x27')];}_0x54b5ec[_0x3860('0x16')](_0x4d9a90)[_0x3860('0x28')](_0x5f42d5);};}exports['index']=function(_0x4c4314,_0x389bd0){var _0x1f1809={},_0x5a9af2={},_0x2551f4={'count':0x0,'rows':[]};var _0x3d5143=_[_0x3860('0x29')](db[_0x3860('0x2a')][_0x3860('0x2b')],function(_0x4bbae9){return{'name':_0x4bbae9[_0x3860('0x2c')],'type':_0x4bbae9[_0x3860('0x2d')][_0x3860('0x2e')]};});_0x5a9af2['model']=_[_0x3860('0x29')](_0x3d5143,'name');_0x5a9af2[_0x3860('0x2f')]=_['keys'](_0x4c4314[_0x3860('0x2f')]);_0x5a9af2[_0x3860('0x30')]=_[_0x3860('0x31')](_0x5a9af2['model'],_0x5a9af2[_0x3860('0x2f')]);_0x1f1809[_0x3860('0x32')]=_['intersection'](_0x5a9af2[_0x3860('0x33')],qs['fields'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x34')]));_0x1f1809[_0x3860('0x32')]=_0x1f1809[_0x3860('0x32')][_0x3860('0x35')]?_0x1f1809[_0x3860('0x32')]:_0x5a9af2[_0x3860('0x33')];if(!_0x4c4314['query'][_0x3860('0x36')](_0x3860('0x37'))){_0x1f1809['limit']=qs[_0x3860('0x1b')](_0x4c4314[_0x3860('0x2f')][_0x3860('0x1b')]);_0x1f1809['offset']=qs['offset'](_0x4c4314[_0x3860('0x2f')][_0x3860('0x19')]);}_0x1f1809[_0x3860('0x38')]=qs[_0x3860('0x39')](_0x4c4314['query']['sort']);_0x1f1809[_0x3860('0x3a')]=qs[_0x3860('0x30')](_[_0x3860('0x3b')](_0x4c4314[_0x3860('0x2f')],_0x5a9af2[_0x3860('0x30')]),_0x3d5143);if(_0x4c4314['query'][_0x3860('0x3c')]){_0x1f1809[_0x3860('0x3a')]=_['merge'](_0x1f1809['where'],{'$or':_[_0x3860('0x29')](_0x3d5143,function(_0x148914){if(_0x148914[_0x3860('0x2d')]!==_0x3860('0x3d')){var _0x2b35b2={};_0x2b35b2[_0x148914['name']]={'$like':'%'+_0x4c4314[_0x3860('0x2f')]['filter']+'%'};return _0x2b35b2;}})});}_0x1f1809=_[_0x3860('0x3e')]({},_0x1f1809,_0x4c4314[_0x3860('0x3f')]);var _0x53d443={'where':_0x1f1809[_0x3860('0x3a')]};return db[_0x3860('0x2a')]['count'](_0x53d443)[_0x3860('0x23')](function(_0xc7d34d){_0x2551f4[_0x3860('0x1c')]=_0xc7d34d;if(_0x4c4314[_0x3860('0x2f')]['includeAll']){_0x1f1809[_0x3860('0x40')]=[{'all':!![]}];}return db[_0x3860('0x2a')][_0x3860('0x41')](_0x1f1809);})['then'](function(_0x3a87e5){_0x2551f4['rows']=_0x3a87e5;return _0x2551f4;})[_0x3860('0x23')](respondWithFilteredResult(_0x389bd0,_0x1f1809))[_0x3860('0x42')](handleError(_0x389bd0,null));};exports[_0x3860('0x43')]=function(_0x3f613f,_0x2220c8){var _0x3f4216={'raw':!![],'where':{'id':_0x3f613f[_0x3860('0x44')]['id']}},_0x4e0a44={};_0x4e0a44[_0x3860('0x33')]=_['keys'](db['WhatsappQueueReport'][_0x3860('0x2b')]);_0x4e0a44[_0x3860('0x2f')]=_['keys'](_0x3f613f[_0x3860('0x2f')]);_0x4e0a44[_0x3860('0x30')]=_['intersection'](_0x4e0a44[_0x3860('0x33')],_0x4e0a44[_0x3860('0x2f')]);_0x3f4216[_0x3860('0x32')]=_[_0x3860('0x31')](_0x4e0a44[_0x3860('0x33')],qs[_0x3860('0x34')](_0x3f613f[_0x3860('0x2f')][_0x3860('0x34')]));_0x3f4216[_0x3860('0x32')]=_0x3f4216[_0x3860('0x32')][_0x3860('0x35')]?_0x3f4216[_0x3860('0x32')]:_0x4e0a44[_0x3860('0x33')];if(_0x3f613f['query'][_0x3860('0x45')]){_0x3f4216['include']=[{'all':!![]}];}_0x3f4216=_[_0x3860('0x3e')]({},_0x3f4216,_0x3f613f[_0x3860('0x3f')]);return db[_0x3860('0x2a')][_0x3860('0x46')](_0x3f4216)[_0x3860('0x23')](handleEntityNotFound(_0x2220c8,null))[_0x3860('0x23')](respondWithResult(_0x2220c8,null))[_0x3860('0x42')](handleError(_0x2220c8,null));};exports[_0x3860('0x47')]=function(_0x5a91b2,_0x3cd575){return db[_0x3860('0x2a')][_0x3860('0x47')](_0x5a91b2['body'],{})[_0x3860('0x23')](respondWithResult(_0x3cd575,0xc9))[_0x3860('0x42')](handleError(_0x3cd575,null));};exports[_0x3860('0x22')]=function(_0x3dc957,_0x5ed2db){if(_0x3dc957['body']['id']){delete _0x3dc957[_0x3860('0x48')]['id'];}return db['WhatsappQueueReport'][_0x3860('0x46')]({'where':{'id':_0x3dc957[_0x3860('0x44')]['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x5ed2db,null))['then'](saveUpdates(_0x3dc957[_0x3860('0x48')],null))['then'](respondWithResult(_0x5ed2db,null))[_0x3860('0x42')](handleError(_0x5ed2db,null));};exports['destroy']=function(_0xf9edb4,_0x25d22f){return db[_0x3860('0x2a')]['find']({'where':{'id':_0xf9edb4['params']['id']}})[_0x3860('0x23')](handleEntityNotFound(_0x25d22f,null))[_0x3860('0x23')](removeEntity(_0x25d22f,null))['catch'](handleError(_0x25d22f,null));};exports[_0x3860('0x49')]=function(_0x58237e,_0x3b3bfe){return db[_0x3860('0x2a')][_0x3860('0x49')]()[_0x3860('0x23')](respondWithResult(_0x3b3bfe,null))[_0x3860('0x42')](handleError(_0x3b3bfe,null));}; \ No newline at end of file +var _0x9c00=['fields','length','nolimit','offset','order','sort','pick','type','VIRTUAL','filter','options','where','then','include','findAll','rows','catch','show','params','keys','includeAll','merge','create','body','find','describe','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','query','filters','intersection','attributes'];(function(_0x473121,_0x3b7009){var _0x495b49=function(_0x465b58){while(--_0x465b58){_0x473121['push'](_0x473121['shift']());}};_0x495b49(++_0x3b7009);}(_0x9c00,0x1a0));var _0x09c0=function(_0xe22435,_0x27157f){_0xe22435=_0xe22435-0x0;var _0x4fa237=_0x9c00[_0xe22435];return _0x4fa237;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x56d883,_0x2c7202){return function(_0x163a59){if(!_0x163a59){_0x56d883[_0x09c0('0x1b')](0x194);}return _0x163a59;};}function handleError(_0x30c2a1,_0x1f8131){_0x1f8131=_0x1f8131||0x1f4;return function(_0x1d2d9d){logger[_0x09c0('0x27')](_0x1d2d9d[_0x09c0('0x28')]);if(_0x1d2d9d[_0x09c0('0x29')]){delete _0x1d2d9d[_0x09c0('0x29')];}_0x30c2a1[_0x09c0('0x1c')](_0x1f8131)['send'](_0x1d2d9d);};}exports[_0x09c0('0x2a')]=function(_0x1bdde9,_0x53a7b8){var _0x1d09e0={},_0x5aa0b9={},_0x3f5b10={'count':0x0,'rows':[]};var _0x4d6bdc=_[_0x09c0('0x2b')](db[_0x09c0('0x2c')][_0x09c0('0x2d')],function(_0x4159bc){return{'name':_0x4159bc['fieldName'],'type':_0x4159bc['type'][_0x09c0('0x2e')]};});_0x5aa0b9[_0x09c0('0x2f')]=_[_0x09c0('0x2b')](_0x4d6bdc,'name');_0x5aa0b9[_0x09c0('0x30')]=_['keys'](_0x1bdde9[_0x09c0('0x30')]);_0x5aa0b9[_0x09c0('0x31')]=_[_0x09c0('0x32')](_0x5aa0b9['model'],_0x5aa0b9[_0x09c0('0x30')]);_0x1d09e0[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x5aa0b9[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x34')]));_0x1d09e0['attributes']=_0x1d09e0[_0x09c0('0x33')][_0x09c0('0x35')]?_0x1d09e0[_0x09c0('0x33')]:_0x5aa0b9[_0x09c0('0x2f')];if(!_0x1bdde9[_0x09c0('0x30')]['hasOwnProperty'](_0x09c0('0x36'))){_0x1d09e0[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x20')]);_0x1d09e0['offset']=qs[_0x09c0('0x37')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x37')]);}_0x1d09e0[_0x09c0('0x38')]=qs[_0x09c0('0x39')](_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x39')]);_0x1d09e0['where']=qs[_0x09c0('0x31')](_[_0x09c0('0x3a')](_0x1bdde9[_0x09c0('0x30')],_0x5aa0b9[_0x09c0('0x31')]),_0x4d6bdc);if(_0x1bdde9[_0x09c0('0x30')]['filter']){_0x1d09e0['where']=_['merge'](_0x1d09e0['where'],{'$or':_[_0x09c0('0x2b')](_0x4d6bdc,function(_0x15c631){if(_0x15c631[_0x09c0('0x3b')]!==_0x09c0('0x3c')){var _0x1a8c0c={};_0x1a8c0c[_0x15c631['name']]={'$like':'%'+_0x1bdde9[_0x09c0('0x30')][_0x09c0('0x3d')]+'%'};return _0x1a8c0c;}})});}_0x1d09e0=_['merge']({},_0x1d09e0,_0x1bdde9[_0x09c0('0x3e')]);var _0x5d50b9={'where':_0x1d09e0[_0x09c0('0x3f')]};return db['WhatsappQueueReport'][_0x09c0('0x21')](_0x5d50b9)[_0x09c0('0x40')](function(_0x56a511){_0x3f5b10[_0x09c0('0x21')]=_0x56a511;if(_0x1bdde9[_0x09c0('0x30')]['includeAll']){_0x1d09e0[_0x09c0('0x41')]=[{'all':!![]}];}return db[_0x09c0('0x2c')][_0x09c0('0x42')](_0x1d09e0);})[_0x09c0('0x40')](function(_0xeb8191){_0x3f5b10[_0x09c0('0x43')]=_0xeb8191;return _0x3f5b10;})['then'](respondWithFilteredResult(_0x53a7b8,_0x1d09e0))[_0x09c0('0x44')](handleError(_0x53a7b8,null));};exports[_0x09c0('0x45')]=function(_0x2d6344,_0x57835c){var _0x193ed2={'raw':!![],'where':{'id':_0x2d6344[_0x09c0('0x46')]['id']}},_0x30c0c5={};_0x30c0c5['model']=_[_0x09c0('0x47')](db[_0x09c0('0x2c')]['rawAttributes']);_0x30c0c5['query']=_[_0x09c0('0x47')](_0x2d6344[_0x09c0('0x30')]);_0x30c0c5['filters']=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],_0x30c0c5['query']);_0x193ed2[_0x09c0('0x33')]=_[_0x09c0('0x32')](_0x30c0c5[_0x09c0('0x2f')],qs[_0x09c0('0x34')](_0x2d6344[_0x09c0('0x30')]['fields']));_0x193ed2[_0x09c0('0x33')]=_0x193ed2['attributes']['length']?_0x193ed2[_0x09c0('0x33')]:_0x30c0c5[_0x09c0('0x2f')];if(_0x2d6344[_0x09c0('0x30')][_0x09c0('0x48')]){_0x193ed2[_0x09c0('0x41')]=[{'all':!![]}];}_0x193ed2=_[_0x09c0('0x49')]({},_0x193ed2,_0x2d6344['options']);return db['WhatsappQueueReport']['find'](_0x193ed2)[_0x09c0('0x40')](handleEntityNotFound(_0x57835c,null))[_0x09c0('0x40')](respondWithResult(_0x57835c,null))[_0x09c0('0x44')](handleError(_0x57835c,null));};exports['create']=function(_0xdf1553,_0xff9650){return db[_0x09c0('0x2c')][_0x09c0('0x4a')](_0xdf1553[_0x09c0('0x4b')],{})[_0x09c0('0x40')](respondWithResult(_0xff9650,0xc9))[_0x09c0('0x44')](handleError(_0xff9650,null));};exports[_0x09c0('0x25')]=function(_0x3f6d14,_0x38085c){if(_0x3f6d14[_0x09c0('0x4b')]['id']){delete _0x3f6d14[_0x09c0('0x4b')]['id'];}return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x3f6d14[_0x09c0('0x46')]['id']}})[_0x09c0('0x40')](handleEntityNotFound(_0x38085c,null))[_0x09c0('0x40')](saveUpdates(_0x3f6d14[_0x09c0('0x4b')],null))[_0x09c0('0x40')](respondWithResult(_0x38085c,null))[_0x09c0('0x44')](handleError(_0x38085c,null));};exports['destroy']=function(_0x4acf54,_0x44befb){return db[_0x09c0('0x2c')][_0x09c0('0x4c')]({'where':{'id':_0x4acf54[_0x09c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x44befb,null))[_0x09c0('0x40')](removeEntity(_0x44befb,null))[_0x09c0('0x44')](handleError(_0x44befb,null));};exports[_0x09c0('0x4d')]=function(_0x4a92c0,_0xe0b82a){return db[_0x09c0('0x2c')][_0x09c0('0x4d')]()[_0x09c0('0x40')](respondWithResult(_0xe0b82a,null))[_0x09c0('0x44')](handleError(_0xe0b82a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0ebba1e..8845185 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 _0x586c=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x586c,0xbe));var _0xc586=function(_0x23d50e,_0x378059){_0x23d50e=_0x23d50e-0x0;var _0x1ce88f=_0x586c[_0x23d50e];return _0x1ce88f;};'use strict';var _=require(_0xc586('0x0'));var util=require('util');var logger=require(_0xc586('0x1'))(_0xc586('0x2'));var moment=require(_0xc586('0x3'));var BPromise=require('bluebird');var rp=require(_0xc586('0x4'));var fs=require('fs');var path=require(_0xc586('0x5'));var rimraf=require('rimraf');var config=require(_0xc586('0x6'));var attributes=require(_0xc586('0x7'));module[_0xc586('0x8')]=function(_0x3850f4,_0x326a22){return _0x3850f4[_0xc586('0x9')](_0xc586('0xa'),attributes,{'tableName':_0xc586('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc586('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8403=['../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','api','moment','request-promise','path'];(function(_0x33ac75,_0x4953e3){var _0x34d5f2=function(_0x4c2b4a){while(--_0x4c2b4a){_0x33ac75['push'](_0x33ac75['shift']());}};_0x34d5f2(++_0x4953e3);}(_0x8403,0x1c9));var _0x3840=function(_0x3100ad,_0x39e636){_0x3100ad=_0x3100ad-0x0;var _0x98626=_0x8403[_0x3100ad];return _0x98626;};'use strict';var _=require(_0x3840('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3840('0x1'));var moment=require(_0x3840('0x2'));var BPromise=require('bluebird');var rp=require(_0x3840('0x3'));var fs=require('fs');var path=require(_0x3840('0x4'));var rimraf=require('rimraf');var config=require(_0x3840('0x5'));var attributes=require(_0x3840('0x6'));module[_0x3840('0x7')]=function(_0x10a4a5,_0x906e0){return _0x10a4a5[_0x3840('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x3840('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3840('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 6dfcff8..2372414 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 _0x7138=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','UpdateWhatsappQueueReport','options','where','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4d451d,_0x3e6852){var _0x59b2a8=function(_0x1562bd){while(--_0x1562bd){_0x4d451d['push'](_0x4d451d['shift']());}};_0x59b2a8(++_0x3e6852);}(_0x7138,0x7a));var _0x8713=function(_0x51b7c5,_0x218969){_0x51b7c5=_0x51b7c5-0x0;var _0x3355d7=_0x7138[_0x51b7c5];return _0x3355d7;};'use strict';var _=require(_0x8713('0x0'));var util=require(_0x8713('0x1'));var moment=require(_0x8713('0x2'));var BPromise=require(_0x8713('0x3'));var rs=require(_0x8713('0x4'));var fs=require('fs');var Redis=require(_0x8713('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8713('0x6'));var logger=require(_0x8713('0x7'))(_0x8713('0x8'));var config=require(_0x8713('0x9'));var jayson=require(_0x8713('0xa'));var client=jayson['client'][_0x8713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4ad3,_0x477d55,_0x22e3ad){return new BPromise(function(_0x3c76f4,_0x4c2e3d){return client['request'](_0x4f4ad3,_0x22e3ad)['then'](function(_0x5e7781){logger[_0x8713('0xc')](_0x8713('0xd'),_0x477d55,_0x8713('0xe'));logger[_0x8713('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x477d55,'request\x20sent',JSON[_0x8713('0x10')](_0x5e7781));if(_0x5e7781[_0x8713('0x11')]){if(_0x5e7781['error'][_0x8713('0x12')]===0x1f4){logger['error'](_0x8713('0xd'),_0x477d55,_0x5e7781['error'][_0x8713('0x13')]);return _0x4c2e3d(_0x5e7781[_0x8713('0x11')][_0x8713('0x13')]);}logger[_0x8713('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x477d55,_0x5e7781[_0x8713('0x11')]['message']);return _0x3c76f4(_0x5e7781['error'][_0x8713('0x13')]);}else{logger[_0x8713('0xc')](_0x8713('0xd'),_0x477d55,_0x8713('0xe'));_0x3c76f4(_0x5e7781[_0x8713('0x14')][_0x8713('0x13')]);}})[_0x8713('0x15')](function(_0x44b16c){logger[_0x8713('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x477d55,_0x44b16c);_0x4c2e3d(_0x44b16c);});});}exports[_0x8713('0x16')]=function(_0x30080c){var _0x36bef3=this;return new Promise(function(_0x38157c,_0x5a1576){return db[_0x8713('0x17')][_0x8713('0x18')](_0x30080c[_0x8713('0x19')],{'raw':_0x30080c['options']?_0x30080c['options'][_0x8713('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3cf542){logger[_0x8713('0xc')]('CreateWhatsappQueueReport',_0x30080c);logger['debug'](_0x8713('0x16'),_0x30080c,JSON[_0x8713('0x10')](_0x3cf542));_0x38157c(_0x3cf542);})[_0x8713('0x15')](function(_0x388dc4){logger[_0x8713('0x11')](_0x8713('0x16'),_0x388dc4[_0x8713('0x13')],_0x30080c);_0x5a1576(_0x36bef3[_0x8713('0x11')](0x1f4,_0x388dc4[_0x8713('0x13')]));});});};exports[_0x8713('0x1b')]=function(_0x15153e){var _0x6e4451=this;return new Promise(function(_0x2eee89,_0x2bf1f6){return db[_0x8713('0x17')]['update'](_0x15153e[_0x8713('0x19')],{'raw':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1d')]||null:null,'attributes':_0x15153e[_0x8713('0x1c')]?_0x15153e[_0x8713('0x1c')][_0x8713('0x1e')]||null:null,'limit':_0x15153e['options']?_0x15153e['options']['limit']||null:null})[_0x8713('0x1f')](function(_0x123056){logger[_0x8713('0xc')](_0x8713('0x1b'),_0x15153e);logger[_0x8713('0xf')](_0x8713('0x1b'),_0x15153e,JSON[_0x8713('0x10')](_0x123056));_0x2eee89(_0x123056);})[_0x8713('0x15')](function(_0x648482){logger[_0x8713('0x11')](_0x8713('0x1b'),_0x648482['message'],_0x15153e);_0x2bf1f6(_0x6e4451[_0x8713('0x11')](0x1f4,_0x648482[_0x8713('0x13')]));});});}; \ No newline at end of file +var _0x98d4=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1ca71b,_0x395cf1){var _0x4912bb=function(_0x38f03e){while(--_0x38f03e){_0x1ca71b['push'](_0x1ca71b['shift']());}};_0x4912bb(++_0x395cf1);}(_0x98d4,0xa3));var _0x498d=function(_0x4e49fe,_0xa47437){_0x4e49fe=_0x4e49fe-0x0;var _0x250334=_0x98d4[_0x4e49fe];return _0x250334;};'use strict';var _=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var moment=require(_0x498d('0x2'));var BPromise=require(_0x498d('0x3'));var rs=require(_0x498d('0x4'));var fs=require('fs');var Redis=require(_0x498d('0x5'));var db=require(_0x498d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x498d('0x7'))(_0x498d('0x8'));var config=require('../../config/environment');var jayson=require(_0x498d('0x9'));var client=jayson[_0x498d('0xa')][_0x498d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36568a,_0x1fddfd,_0x2157c0){return new BPromise(function(_0x3e33d7,_0x26aa44){return client[_0x498d('0xc')](_0x36568a,_0x2157c0)[_0x498d('0xd')](function(_0x343964){logger[_0x498d('0xe')](_0x498d('0xf'),_0x1fddfd,'request\x20sent');logger[_0x498d('0x10')](_0x498d('0x11'),_0x1fddfd,_0x498d('0x12'),JSON[_0x498d('0x13')](_0x343964));if(_0x343964['error']){if(_0x343964[_0x498d('0x14')][_0x498d('0x15')]===0x1f4){logger['error'](_0x498d('0xf'),_0x1fddfd,_0x343964['error'][_0x498d('0x16')]);return _0x26aa44(_0x343964['error'][_0x498d('0x16')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x1fddfd,_0x343964[_0x498d('0x14')][_0x498d('0x16')]);return _0x3e33d7(_0x343964[_0x498d('0x14')][_0x498d('0x16')]);}else{logger['info'](_0x498d('0xf'),_0x1fddfd,_0x498d('0x12'));_0x3e33d7(_0x343964[_0x498d('0x17')][_0x498d('0x16')]);}})[_0x498d('0x18')](function(_0x1d9a55){logger[_0x498d('0x14')](_0x498d('0xf'),_0x1fddfd,_0x1d9a55);_0x26aa44(_0x1d9a55);});});}exports[_0x498d('0x19')]=function(_0x31c080){var _0x53033b=this;return new Promise(function(_0x3cf98f,_0x39bbc6){return db[_0x498d('0x1a')][_0x498d('0x1b')](_0x31c080[_0x498d('0x1c')],{'raw':_0x31c080['options']?_0x31c080[_0x498d('0x1d')][_0x498d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2a820c){logger[_0x498d('0xe')](_0x498d('0x19'),_0x31c080);logger[_0x498d('0x10')](_0x498d('0x19'),_0x31c080,JSON['stringify'](_0x2a820c));_0x3cf98f(_0x2a820c);})[_0x498d('0x18')](function(_0x4b7053){logger[_0x498d('0x14')](_0x498d('0x19'),_0x4b7053[_0x498d('0x16')],_0x31c080);_0x39bbc6(_0x53033b[_0x498d('0x14')](0x1f4,_0x4b7053[_0x498d('0x16')]));});});};exports[_0x498d('0x1f')]=function(_0xf3b04e){var _0x2ce6ba=this;return new Promise(function(_0x1cbc44,_0x8b5413){return db['WhatsappQueueReport']['update'](_0xf3b04e[_0x498d('0x1c')],{'raw':_0xf3b04e[_0x498d('0x1d')]?_0xf3b04e[_0x498d('0x1d')][_0x498d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf3b04e[_0x498d('0x1d')]?_0xf3b04e[_0x498d('0x1d')]['where']||null:null,'attributes':_0xf3b04e[_0x498d('0x1d')]?_0xf3b04e[_0x498d('0x1d')][_0x498d('0x20')]||null:null,'limit':_0xf3b04e['options']?_0xf3b04e[_0x498d('0x1d')][_0x498d('0x21')]||null:null})[_0x498d('0xd')](function(_0x65ad2){logger[_0x498d('0xe')]('UpdateWhatsappQueueReport',_0xf3b04e);logger[_0x498d('0x10')](_0x498d('0x1f'),_0xf3b04e,JSON[_0x498d('0x13')](_0x65ad2));_0x1cbc44(_0x65ad2);})[_0x498d('0x18')](function(_0x5eb597){logger[_0x498d('0x14')](_0x498d('0x1f'),_0x5eb597[_0x498d('0x16')],_0xf3b04e);_0x8b5413(_0x2ce6ba[_0x498d('0x14')](0x1f4,_0x5eb597['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index d880a90..f0bfb88 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 _0x139b=['../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ff9a7,_0x376098){var _0x6c817c=function(_0x2652fa){while(--_0x2652fa){_0x1ff9a7['push'](_0x1ff9a7['shift']());}};_0x6c817c(++_0x376098);}(_0x139b,0x10d));var _0xb139=function(_0x577062,_0x2e7e84){_0x577062=_0x577062-0x0;var _0x1b9a84=_0x139b[_0x577062];return _0x1b9a84;};'use strict';var multer=require('multer');var util=require(_0xb139('0x0'));var path=require('path');var timeout=require(_0xb139('0x1'));var express=require(_0xb139('0x2'));var router=express[_0xb139('0x3')]();var fs_extra=require(_0xb139('0x4'));var auth=require(_0xb139('0x5'));var interaction=require(_0xb139('0x6'));var config=require(_0xb139('0x7'));var controller=require(_0xb139('0x8'));router[_0xb139('0x9')]('/',auth['isAuthenticated'](),controller[_0xb139('0xa')]);router[_0xb139('0x9')](_0xb139('0xb'),auth[_0xb139('0xc')](),controller[_0xb139('0xd')]);router[_0xb139('0x9')](_0xb139('0xe'),auth['isAuthenticated'](),controller[_0xb139('0xf')]);router[_0xb139('0x10')]('/',auth[_0xb139('0xc')](),controller[_0xb139('0x11')]);router[_0xb139('0x12')](_0xb139('0xe'),auth[_0xb139('0xc')](),controller[_0xb139('0x13')]);router[_0xb139('0x14')](_0xb139('0xe'),auth[_0xb139('0xc')](),controller[_0xb139('0x15')]);module[_0xb139('0x16')]=router; \ No newline at end of file +var _0xf47c=['exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','post','put','update','delete','/:id','destroy'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xf47c,0xa9));var _0xcf47=function(_0xdb39cf,_0x1a43da){_0xdb39cf=_0xdb39cf-0x0;var _0x5a9216=_0xf47c[_0xdb39cf];return _0x5a9216;};'use strict';var multer=require('multer');var util=require(_0xcf47('0x0'));var path=require(_0xcf47('0x1'));var timeout=require(_0xcf47('0x2'));var express=require('express');var router=express[_0xcf47('0x3')]();var fs_extra=require(_0xcf47('0x4'));var auth=require(_0xcf47('0x5'));var interaction=require(_0xcf47('0x6'));var config=require(_0xcf47('0x7'));var controller=require(_0xcf47('0x8'));router[_0xcf47('0x9')]('/',auth[_0xcf47('0xa')](),controller[_0xcf47('0xb')]);router[_0xcf47('0x9')](_0xcf47('0xc'),auth[_0xcf47('0xa')](),controller[_0xcf47('0xd')]);router[_0xcf47('0x9')]('/:id',auth[_0xcf47('0xa')](),controller['show']);router[_0xcf47('0xe')]('/',auth[_0xcf47('0xa')](),controller['create']);router[_0xcf47('0xf')]('/:id',auth[_0xcf47('0xa')](),controller[_0xcf47('0x10')]);router[_0xcf47('0x11')](_0xcf47('0x12'),auth[_0xcf47('0xa')](),controller[_0xcf47('0x13')]);module[_0xcf47('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 44953c4..21b8fae 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 _0x8286=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x3f7623,_0x28d9e2){var _0x512a9d=function(_0x385b82){while(--_0x385b82){_0x3f7623['push'](_0x3f7623['shift']());}};_0x512a9d(++_0x28d9e2);}(_0x8286,0x66));var _0x6828=function(_0x151c98,_0x8efee0){_0x151c98=_0x151c98-0x0;var _0x272953=_0x8286[_0x151c98];return _0x272953;};'use strict';var Sequelize=require(_0x6828('0x0'));module[_0x6828('0x1')]={'uniqueid':{'type':Sequelize[_0x6828('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6828('0x3')](_0x6828('0x4'),_0x6828('0x5'),_0x6828('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6828('0x7')]}}; \ No newline at end of file +var _0x9d5b=['account','agent','DATE','exports','STRING','ENUM'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x4b85fd,_0x496237){_0x4b85fd=_0x4b85fd-0x0;var _0x355ba1=_0x9d5b[_0x4b85fd];return _0x355ba1;};'use strict';var Sequelize=require('sequelize');module[_0xb9d5('0x0')]={'uniqueid':{'type':Sequelize[_0xb9d5('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb9d5('0x2')](_0xb9d5('0x3'),_0xb9d5('0x4'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb9d5('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index b84473a..3055718 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 _0xd6ed=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','WhatsappTransferReport','findAll','show','options','find','catch','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x423035,_0x51ddeb){var _0x3645fc=function(_0x2205f8){while(--_0x2205f8){_0x423035['push'](_0x423035['shift']());}};_0x3645fc(++_0x51ddeb);}(_0xd6ed,0x1aa));var _0xdd6e=function(_0x103976,_0xba3169){_0x103976=_0x103976-0x0;var _0x3bb94e=_0xd6ed[_0x103976];return _0x3bb94e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd6e('0x0'));var zipdir=require(_0xdd6e('0x1'));var jsonpatch=require(_0xdd6e('0x2'));var rp=require(_0xdd6e('0x3'));var moment=require(_0xdd6e('0x4'));var BPromise=require(_0xdd6e('0x5'));var Mustache=require(_0xdd6e('0x6'));var util=require(_0xdd6e('0x7'));var path=require(_0xdd6e('0x8'));var sox=require(_0xdd6e('0x9'));var csv=require(_0xdd6e('0xa'));var ejs=require(_0xdd6e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdd6e('0xc'));var crypto=require(_0xdd6e('0xd'));var jsforce=require(_0xdd6e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdd6e('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd6e('0x10'));var authService=require(_0xdd6e('0x11'));var qs=require(_0xdd6e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd6e('0x13'));var logger=require(_0xdd6e('0x14'))(_0xdd6e('0x15'));var utils=require(_0xdd6e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdd6e('0x17'))['db'];function respondWithStatusCode(_0x510ea4,_0x5a0eaf){_0x5a0eaf=_0x5a0eaf||0xcc;return function(_0xf200){if(_0xf200){return _0x510ea4[_0xdd6e('0x18')](_0x5a0eaf);}return _0x510ea4[_0xdd6e('0x19')](_0x5a0eaf)[_0xdd6e('0x1a')]();};}function respondWithResult(_0x554906,_0x9e2bda){_0x9e2bda=_0x9e2bda||0xc8;return function(_0x2483f8){if(_0x2483f8){return _0x554906[_0xdd6e('0x19')](_0x9e2bda)[_0xdd6e('0x1b')](_0x2483f8);}};}function respondWithFilteredResult(_0xf899,_0x41b6ad){return function(_0x40728a){if(_0x40728a){var _0x36c0c8=typeof _0x41b6ad['offset']===_0xdd6e('0x1c')&&typeof _0x41b6ad['limit']===_0xdd6e('0x1c');var _0x14b01f=_0x40728a[_0xdd6e('0x1d')];var _0x527c7b=_0x36c0c8?0x0:_0x41b6ad[_0xdd6e('0x1e')];var _0x6bb629=_0x36c0c8?_0x40728a[_0xdd6e('0x1d')]:_0x41b6ad['offset']+_0x41b6ad[_0xdd6e('0x1f')];var _0x32b2d6;if(_0x6bb629>=_0x14b01f){_0x6bb629=_0x14b01f;_0x32b2d6=0xc8;}else{_0x32b2d6=0xce;}_0xf899['status'](_0x32b2d6);return _0xf899[_0xdd6e('0x20')](_0xdd6e('0x21'),_0x527c7b+'-'+_0x6bb629+'/'+_0x14b01f)[_0xdd6e('0x1b')](_0x40728a);}return null;};}function patchUpdates(_0xa24f09){return function(_0x57bc30){try{jsonpatch[_0xdd6e('0x22')](_0x57bc30,_0xa24f09,!![]);}catch(_0x2e3f47){return BPromise[_0xdd6e('0x23')](_0x2e3f47);}return _0x57bc30['save']();};}function saveUpdates(_0x3c2376,_0xf4f6d4){return function(_0x5ac8fe){if(_0x5ac8fe){return _0x5ac8fe[_0xdd6e('0x24')](_0x3c2376)[_0xdd6e('0x25')](function(_0x3b088e){return _0x3b088e;});}return null;};}function removeEntity(_0x4e72e1,_0x2e9174){return function(_0x2a3447){if(_0x2a3447){return _0x2a3447[_0xdd6e('0x26')]()[_0xdd6e('0x25')](function(){_0x4e72e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f380f,_0x37ffc0){return function(_0x2e7702){if(!_0x2e7702){_0x4f380f['sendStatus'](0x194);}return _0x2e7702;};}function handleError(_0x54b679,_0x8bb9cf){_0x8bb9cf=_0x8bb9cf||0x1f4;return function(_0x2c2ef5){logger[_0xdd6e('0x27')](_0x2c2ef5[_0xdd6e('0x28')]);if(_0x2c2ef5[_0xdd6e('0x29')]){delete _0x2c2ef5[_0xdd6e('0x29')];}_0x54b679['status'](_0x8bb9cf)[_0xdd6e('0x2a')](_0x2c2ef5);};}exports[_0xdd6e('0x2b')]=function(_0x51a68b,_0x48cc63){var _0x554fee={},_0x5a895f={},_0x53ed4b={'count':0x0,'rows':[]};var _0x43f3f9=_[_0xdd6e('0x2c')](db['WhatsappTransferReport'][_0xdd6e('0x2d')],function(_0x53cb1e){return{'name':_0x53cb1e['fieldName'],'type':_0x53cb1e['type'][_0xdd6e('0x2e')]};});_0x5a895f['model']=_[_0xdd6e('0x2c')](_0x43f3f9,_0xdd6e('0x29'));_0x5a895f['query']=_[_0xdd6e('0x2f')](_0x51a68b['query']);_0x5a895f[_0xdd6e('0x30')]=_[_0xdd6e('0x31')](_0x5a895f[_0xdd6e('0x32')],_0x5a895f[_0xdd6e('0x33')]);_0x554fee[_0xdd6e('0x34')]=_['intersection'](_0x5a895f['model'],qs[_0xdd6e('0x35')](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x35')]));_0x554fee['attributes']=_0x554fee[_0xdd6e('0x34')][_0xdd6e('0x36')]?_0x554fee[_0xdd6e('0x34')]:_0x5a895f[_0xdd6e('0x32')];if(!_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x37')](_0xdd6e('0x38'))){_0x554fee['limit']=qs['limit'](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x1f')]);_0x554fee[_0xdd6e('0x1e')]=qs['offset'](_0x51a68b[_0xdd6e('0x33')]['offset']);}_0x554fee[_0xdd6e('0x39')]=qs['sort'](_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3a')]);_0x554fee[_0xdd6e('0x3b')]=qs[_0xdd6e('0x30')](_[_0xdd6e('0x3c')](_0x51a68b[_0xdd6e('0x33')],_0x5a895f[_0xdd6e('0x30')]),_0x43f3f9);if(_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3d')]){_0x554fee[_0xdd6e('0x3b')]=_[_0xdd6e('0x3e')](_0x554fee[_0xdd6e('0x3b')],{'$or':_[_0xdd6e('0x2c')](_0x43f3f9,function(_0x503f91){if(_0x503f91[_0xdd6e('0x3f')]!==_0xdd6e('0x40')){var _0x28f5f0={};_0x28f5f0[_0x503f91[_0xdd6e('0x29')]]={'$like':'%'+_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x3d')]+'%'};return _0x28f5f0;}})});}_0x554fee=_[_0xdd6e('0x3e')]({},_0x554fee,_0x51a68b['options']);var _0x2f7b66={'where':_0x554fee[_0xdd6e('0x3b')]};return db['WhatsappTransferReport'][_0xdd6e('0x1d')](_0x2f7b66)[_0xdd6e('0x25')](function(_0x18bf02){_0x53ed4b[_0xdd6e('0x1d')]=_0x18bf02;if(_0x51a68b[_0xdd6e('0x33')][_0xdd6e('0x41')]){_0x554fee[_0xdd6e('0x42')]=[{'all':!![]}];}return db[_0xdd6e('0x43')][_0xdd6e('0x44')](_0x554fee);})[_0xdd6e('0x25')](function(_0xb93fd1){_0x53ed4b['rows']=_0xb93fd1;return _0x53ed4b;})['then'](respondWithFilteredResult(_0x48cc63,_0x554fee))['catch'](handleError(_0x48cc63,null));};exports[_0xdd6e('0x45')]=function(_0x41c86a,_0x58c4b3){var _0x4381be={'raw':!![],'where':{'id':_0x41c86a['params']['id']}},_0x5a5a78={};_0x5a5a78[_0xdd6e('0x32')]=_['keys'](db[_0xdd6e('0x43')][_0xdd6e('0x2d')]);_0x5a5a78[_0xdd6e('0x33')]=_[_0xdd6e('0x2f')](_0x41c86a['query']);_0x5a5a78[_0xdd6e('0x30')]=_['intersection'](_0x5a5a78['model'],_0x5a5a78[_0xdd6e('0x33')]);_0x4381be[_0xdd6e('0x34')]=_[_0xdd6e('0x31')](_0x5a5a78[_0xdd6e('0x32')],qs['fields'](_0x41c86a[_0xdd6e('0x33')][_0xdd6e('0x35')]));_0x4381be['attributes']=_0x4381be[_0xdd6e('0x34')][_0xdd6e('0x36')]?_0x4381be[_0xdd6e('0x34')]:_0x5a5a78[_0xdd6e('0x32')];if(_0x41c86a[_0xdd6e('0x33')]['includeAll']){_0x4381be[_0xdd6e('0x42')]=[{'all':!![]}];}_0x4381be=_[_0xdd6e('0x3e')]({},_0x4381be,_0x41c86a[_0xdd6e('0x46')]);return db[_0xdd6e('0x43')][_0xdd6e('0x47')](_0x4381be)[_0xdd6e('0x25')](handleEntityNotFound(_0x58c4b3,null))[_0xdd6e('0x25')](respondWithResult(_0x58c4b3,null))[_0xdd6e('0x48')](handleError(_0x58c4b3,null));};exports['create']=function(_0x10a211,_0x5ba453){return db[_0xdd6e('0x43')][_0xdd6e('0x49')](_0x10a211[_0xdd6e('0x4a')],{})[_0xdd6e('0x25')](respondWithResult(_0x5ba453,0xc9))[_0xdd6e('0x48')](handleError(_0x5ba453,null));};exports[_0xdd6e('0x24')]=function(_0x3f3d07,_0x15d913){if(_0x3f3d07[_0xdd6e('0x4a')]['id']){delete _0x3f3d07[_0xdd6e('0x4a')]['id'];}return db[_0xdd6e('0x43')][_0xdd6e('0x47')]({'where':{'id':_0x3f3d07[_0xdd6e('0x4b')]['id']}})[_0xdd6e('0x25')](handleEntityNotFound(_0x15d913,null))[_0xdd6e('0x25')](saveUpdates(_0x3f3d07[_0xdd6e('0x4a')],null))['then'](respondWithResult(_0x15d913,null))[_0xdd6e('0x48')](handleError(_0x15d913,null));};exports['destroy']=function(_0x5d605f,_0x52963f){return db[_0xdd6e('0x43')]['find']({'where':{'id':_0x5d605f[_0xdd6e('0x4b')]['id']}})[_0xdd6e('0x25')](handleEntityNotFound(_0x52963f,null))[_0xdd6e('0x25')](removeEntity(_0x52963f,null))[_0xdd6e('0x48')](handleError(_0x52963f,null));};exports[_0xdd6e('0x4c')]=function(_0x4c3a66,_0x55354c){return db[_0xdd6e('0x43')][_0xdd6e('0x4c')]()[_0xdd6e('0x25')](respondWithResult(_0x55354c,null))['catch'](handleError(_0x55354c,null));}; \ No newline at end of file +var _0xb035=['describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','limit','offset','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','body'];(function(_0x51fd1f,_0x453dfb){var _0x4f314b=function(_0x4ae5e5){while(--_0x4ae5e5){_0x51fd1f['push'](_0x51fd1f['shift']());}};_0x4f314b(++_0x453dfb);}(_0xb035,0x1b7));var _0x5b03=function(_0x928aa1,_0x16bd67){_0x928aa1=_0x928aa1-0x0;var _0x37b02b=_0xb035[_0x928aa1];return _0x37b02b;};'use strict';var emlformat=require(_0x5b03('0x0'));var rimraf=require(_0x5b03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b03('0x2'));var moment=require(_0x5b03('0x3'));var BPromise=require(_0x5b03('0x4'));var Mustache=require(_0x5b03('0x5'));var util=require(_0x5b03('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5b03('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b03('0x8'));var _=require(_0x5b03('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b03('0xa'));var toCsv=require(_0x5b03('0x7'));var querystring=require(_0x5b03('0xb'));var Papa=require('papaparse');var Redis=require(_0x5b03('0xc'));var authService=require(_0x5b03('0xd'));var qs=require(_0x5b03('0xe'));var as=require(_0x5b03('0xf'));var hardwareService=require(_0x5b03('0x10'));var logger=require(_0x5b03('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5b03('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b03('0x13'))['db'];function respondWithStatusCode(_0x141d01,_0x2c4bcd){_0x2c4bcd=_0x2c4bcd||0xcc;return function(_0x53b154){if(_0x53b154){return _0x141d01[_0x5b03('0x14')](_0x2c4bcd);}return _0x141d01[_0x5b03('0x15')](_0x2c4bcd)[_0x5b03('0x16')]();};}function respondWithResult(_0x17b2e3,_0x1066f9){_0x1066f9=_0x1066f9||0xc8;return function(_0xb54127){if(_0xb54127){return _0x17b2e3['status'](_0x1066f9)['json'](_0xb54127);}};}function respondWithFilteredResult(_0xb1f715,_0x51a09a){return function(_0x2b7951){if(_0x2b7951){var _0x5be165=typeof _0x51a09a['offset']==='undefined'&&typeof _0x51a09a[_0x5b03('0x17')]==='undefined';var _0x2d8b2a=_0x2b7951['count'];var _0x5d1a1b=_0x5be165?0x0:_0x51a09a[_0x5b03('0x18')];var _0x300ee9=_0x5be165?_0x2b7951[_0x5b03('0x19')]:_0x51a09a[_0x5b03('0x18')]+_0x51a09a[_0x5b03('0x17')];var _0x466b8f;if(_0x300ee9>=_0x2d8b2a){_0x300ee9=_0x2d8b2a;_0x466b8f=0xc8;}else{_0x466b8f=0xce;}_0xb1f715[_0x5b03('0x15')](_0x466b8f);return _0xb1f715[_0x5b03('0x1a')](_0x5b03('0x1b'),_0x5d1a1b+'-'+_0x300ee9+'/'+_0x2d8b2a)[_0x5b03('0x1c')](_0x2b7951);}return null;};}function patchUpdates(_0x1e49bb){return function(_0x4f11a9){try{jsonpatch[_0x5b03('0x1d')](_0x4f11a9,_0x1e49bb,!![]);}catch(_0x3c1e27){return BPromise['reject'](_0x3c1e27);}return _0x4f11a9[_0x5b03('0x1e')]();};}function saveUpdates(_0x44d128,_0x238bee){return function(_0x1f94ac){if(_0x1f94ac){return _0x1f94ac[_0x5b03('0x1f')](_0x44d128)['then'](function(_0x393d4a){return _0x393d4a;});}return null;};}function removeEntity(_0xc74ea1,_0x1d69af){return function(_0x4ce234){if(_0x4ce234){return _0x4ce234[_0x5b03('0x20')]()[_0x5b03('0x21')](function(){_0xc74ea1[_0x5b03('0x15')](0xcc)[_0x5b03('0x16')]();});}};}function handleEntityNotFound(_0x509264,_0x5d40ac){return function(_0xc010f9){if(!_0xc010f9){_0x509264[_0x5b03('0x14')](0x194);}return _0xc010f9;};}function handleError(_0x4268af,_0x338c87){_0x338c87=_0x338c87||0x1f4;return function(_0x2472e2){logger[_0x5b03('0x22')](_0x2472e2[_0x5b03('0x23')]);if(_0x2472e2[_0x5b03('0x24')]){delete _0x2472e2['name'];}_0x4268af[_0x5b03('0x15')](_0x338c87)[_0x5b03('0x25')](_0x2472e2);};}exports[_0x5b03('0x26')]=function(_0x1d29ee,_0x50b144){var _0x3dc413={},_0x11ebdd={},_0x2b499a={'count':0x0,'rows':[]};var _0xc055d=_['map'](db[_0x5b03('0x27')][_0x5b03('0x28')],function(_0x33bd8b){return{'name':_0x33bd8b['fieldName'],'type':_0x33bd8b['type'][_0x5b03('0x29')]};});_0x11ebdd[_0x5b03('0x2a')]=_[_0x5b03('0x2b')](_0xc055d,'name');_0x11ebdd[_0x5b03('0x2c')]=_['keys'](_0x1d29ee[_0x5b03('0x2c')]);_0x11ebdd['filters']=_[_0x5b03('0x2d')](_0x11ebdd[_0x5b03('0x2a')],_0x11ebdd[_0x5b03('0x2c')]);_0x3dc413[_0x5b03('0x2e')]=_[_0x5b03('0x2d')](_0x11ebdd[_0x5b03('0x2a')],qs['fields'](_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x2f')]));_0x3dc413[_0x5b03('0x2e')]=_0x3dc413[_0x5b03('0x2e')]['length']?_0x3dc413['attributes']:_0x11ebdd[_0x5b03('0x2a')];if(!_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x30')](_0x5b03('0x31'))){_0x3dc413[_0x5b03('0x17')]=qs['limit'](_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x17')]);_0x3dc413[_0x5b03('0x18')]=qs[_0x5b03('0x18')](_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x18')]);}_0x3dc413[_0x5b03('0x32')]=qs[_0x5b03('0x33')](_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x33')]);_0x3dc413[_0x5b03('0x34')]=qs[_0x5b03('0x35')](_[_0x5b03('0x36')](_0x1d29ee[_0x5b03('0x2c')],_0x11ebdd['filters']),_0xc055d);if(_0x1d29ee['query'][_0x5b03('0x37')]){_0x3dc413[_0x5b03('0x34')]=_[_0x5b03('0x38')](_0x3dc413[_0x5b03('0x34')],{'$or':_['map'](_0xc055d,function(_0x2eef1b){if(_0x2eef1b[_0x5b03('0x39')]!==_0x5b03('0x3a')){var _0x1de2ac={};_0x1de2ac[_0x2eef1b[_0x5b03('0x24')]]={'$like':'%'+_0x1d29ee[_0x5b03('0x2c')][_0x5b03('0x37')]+'%'};return _0x1de2ac;}})});}_0x3dc413=_[_0x5b03('0x38')]({},_0x3dc413,_0x1d29ee[_0x5b03('0x3b')]);var _0x453e51={'where':_0x3dc413[_0x5b03('0x34')]};return db[_0x5b03('0x27')]['count'](_0x453e51)[_0x5b03('0x21')](function(_0x1b028d){_0x2b499a[_0x5b03('0x19')]=_0x1b028d;if(_0x1d29ee['query']['includeAll']){_0x3dc413['include']=[{'all':!![]}];}return db[_0x5b03('0x27')][_0x5b03('0x3c')](_0x3dc413);})[_0x5b03('0x21')](function(_0x38335f){_0x2b499a[_0x5b03('0x3d')]=_0x38335f;return _0x2b499a;})[_0x5b03('0x21')](respondWithFilteredResult(_0x50b144,_0x3dc413))[_0x5b03('0x3e')](handleError(_0x50b144,null));};exports[_0x5b03('0x3f')]=function(_0x2f8190,_0xb0efbd){var _0x3c91e5={'raw':!![],'where':{'id':_0x2f8190[_0x5b03('0x40')]['id']}},_0x9dc4de={};_0x9dc4de[_0x5b03('0x2a')]=_['keys'](db[_0x5b03('0x27')][_0x5b03('0x28')]);_0x9dc4de[_0x5b03('0x2c')]=_[_0x5b03('0x41')](_0x2f8190[_0x5b03('0x2c')]);_0x9dc4de[_0x5b03('0x35')]=_[_0x5b03('0x2d')](_0x9dc4de['model'],_0x9dc4de[_0x5b03('0x2c')]);_0x3c91e5[_0x5b03('0x2e')]=_[_0x5b03('0x2d')](_0x9dc4de[_0x5b03('0x2a')],qs[_0x5b03('0x2f')](_0x2f8190[_0x5b03('0x2c')]['fields']));_0x3c91e5[_0x5b03('0x2e')]=_0x3c91e5[_0x5b03('0x2e')][_0x5b03('0x42')]?_0x3c91e5[_0x5b03('0x2e')]:_0x9dc4de[_0x5b03('0x2a')];if(_0x2f8190[_0x5b03('0x2c')][_0x5b03('0x43')]){_0x3c91e5[_0x5b03('0x44')]=[{'all':!![]}];}_0x3c91e5=_[_0x5b03('0x38')]({},_0x3c91e5,_0x2f8190[_0x5b03('0x3b')]);return db[_0x5b03('0x27')][_0x5b03('0x45')](_0x3c91e5)[_0x5b03('0x21')](handleEntityNotFound(_0xb0efbd,null))['then'](respondWithResult(_0xb0efbd,null))[_0x5b03('0x3e')](handleError(_0xb0efbd,null));};exports[_0x5b03('0x46')]=function(_0x345c14,_0x266d53){return db[_0x5b03('0x27')][_0x5b03('0x46')](_0x345c14['body'],{})[_0x5b03('0x21')](respondWithResult(_0x266d53,0xc9))[_0x5b03('0x3e')](handleError(_0x266d53,null));};exports[_0x5b03('0x1f')]=function(_0x34df77,_0x21727d){if(_0x34df77[_0x5b03('0x47')]['id']){delete _0x34df77['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x34df77[_0x5b03('0x40')]['id']}})[_0x5b03('0x21')](handleEntityNotFound(_0x21727d,null))[_0x5b03('0x21')](saveUpdates(_0x34df77[_0x5b03('0x47')],null))[_0x5b03('0x21')](respondWithResult(_0x21727d,null))[_0x5b03('0x3e')](handleError(_0x21727d,null));};exports[_0x5b03('0x20')]=function(_0x447ad4,_0x2de73d){return db['WhatsappTransferReport'][_0x5b03('0x45')]({'where':{'id':_0x447ad4['params']['id']}})['then'](handleEntityNotFound(_0x2de73d,null))['then'](removeEntity(_0x2de73d,null))[_0x5b03('0x3e')](handleError(_0x2de73d,null));};exports[_0x5b03('0x48')]=function(_0x301012,_0x56ea9b){return db[_0x5b03('0x27')][_0x5b03('0x48')]()[_0x5b03('0x21')](respondWithResult(_0x56ea9b,null))[_0x5b03('0x3e')](handleError(_0x56ea9b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 061225d..e8c32c7 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 _0x2704=['uniqueid','lodash','util','../../config/logger','request-promise','rimraf','./whatsappTransferReport.attributes','define','report_whatsapp_transfer'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x2704,0x118));var _0x4270=function(_0x6b1c9e,_0x322a1){_0x6b1c9e=_0x6b1c9e-0x0;var _0x4fb0d5=_0x2704[_0x6b1c9e];return _0x4fb0d5;};'use strict';var _=require(_0x4270('0x0'));var util=require(_0x4270('0x1'));var logger=require(_0x4270('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4270('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4270('0x4'));var config=require('../../config/environment');var attributes=require(_0x4270('0x5'));module['exports']=function(_0x32835d,_0x34e7c4){return _0x32835d[_0x4270('0x6')]('WhatsappTransferReport',attributes,{'tableName':_0x4270('0x7'),'paranoid':![],'indexes':[{'name':_0x4270('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7707=['exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7707,0x101));var _0x7770=function(_0x59a664,_0x216420){_0x59a664=_0x59a664-0x0;var _0x467a02=_0x7707[_0x59a664];return _0x467a02;};'use strict';var _=require(_0x7770('0x0'));var util=require(_0x7770('0x1'));var logger=require(_0x7770('0x2'))(_0x7770('0x3'));var moment=require(_0x7770('0x4'));var BPromise=require(_0x7770('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7770('0x6'));var rimraf=require(_0x7770('0x7'));var config=require(_0x7770('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x7770('0x9')]=function(_0x592402,_0x42fdd3){return _0x592402[_0x7770('0xa')](_0x7770('0xb'),attributes,{'tableName':_0x7770('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7770('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 dac7205..9ad53c4 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 _0xc208=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1b28ff,_0x2f6364){var _0x369ba3=function(_0x688258){while(--_0x688258){_0x1b28ff['push'](_0x1b28ff['shift']());}};_0x369ba3(++_0x2f6364);}(_0xc208,0x125));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x8c20('0x0'));var moment=require(_0x8c20('0x1'));var BPromise=require(_0x8c20('0x2'));var rs=require(_0x8c20('0x3'));var fs=require('fs');var Redis=require(_0x8c20('0x4'));var db=require(_0x8c20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c20('0x6'))(_0x8c20('0x7'));var config=require(_0x8c20('0x8'));var jayson=require(_0x8c20('0x9'));var client=jayson[_0x8c20('0xa')][_0x8c20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30eeab,_0x44629d,_0x4ca7bf){return new BPromise(function(_0x364962,_0x6887be){return client[_0x8c20('0xc')](_0x30eeab,_0x4ca7bf)[_0x8c20('0xd')](function(_0x20a8eb){logger[_0x8c20('0xe')](_0x8c20('0xf'),_0x44629d,_0x8c20('0x10'));logger[_0x8c20('0x11')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x44629d,_0x8c20('0x10'),JSON['stringify'](_0x20a8eb));if(_0x20a8eb['error']){if(_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x13')]===0x1f4){logger[_0x8c20('0x12')](_0x8c20('0xf'),_0x44629d,_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);return _0x6887be(_0x20a8eb['error']['message']);}logger[_0x8c20('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x44629d,_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);return _0x364962(_0x20a8eb[_0x8c20('0x12')][_0x8c20('0x14')]);}else{logger['info'](_0x8c20('0xf'),_0x44629d,_0x8c20('0x10'));_0x364962(_0x20a8eb[_0x8c20('0x15')][_0x8c20('0x14')]);}})['catch'](function(_0x5036df){logger['error'](_0x8c20('0xf'),_0x44629d,_0x5036df);_0x6887be(_0x5036df);});});} \ No newline at end of file +var _0xb7a0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x15ba36,_0x3c057e){var _0x5b4c6d=function(_0x3ecd32){while(--_0x3ecd32){_0x15ba36['push'](_0x15ba36['shift']());}};_0x5b4c6d(++_0x3c057e);}(_0xb7a0,0x143));var _0x0b7a=function(_0x142902,_0x345124){_0x142902=_0x142902-0x0;var _0x2dfc83=_0xb7a0[_0x142902];return _0x2dfc83;};'use strict';var _=require(_0x0b7a('0x0'));var util=require(_0x0b7a('0x1'));var moment=require(_0x0b7a('0x2'));var BPromise=require(_0x0b7a('0x3'));var rs=require(_0x0b7a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b7a('0x6'))(_0x0b7a('0x7'));var config=require(_0x0b7a('0x8'));var jayson=require(_0x0b7a('0x9'));var client=jayson[_0x0b7a('0xa')][_0x0b7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4191c9,_0x316a3c,_0xbf54e0){return new BPromise(function(_0x5eaeb3,_0x2378af){return client[_0x0b7a('0xc')](_0x4191c9,_0xbf54e0)[_0x0b7a('0xd')](function(_0x539cdf){logger[_0x0b7a('0xe')](_0x0b7a('0xf'),_0x316a3c,'request\x20sent');logger[_0x0b7a('0x10')](_0x0b7a('0x11'),_0x316a3c,_0x0b7a('0x12'),JSON['stringify'](_0x539cdf));if(_0x539cdf[_0x0b7a('0x13')]){if(_0x539cdf[_0x0b7a('0x13')][_0x0b7a('0x14')]===0x1f4){logger[_0x0b7a('0x13')](_0x0b7a('0xf'),_0x316a3c,_0x539cdf[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x2378af(_0x539cdf[_0x0b7a('0x13')]['message']);}logger[_0x0b7a('0x13')](_0x0b7a('0xf'),_0x316a3c,_0x539cdf[_0x0b7a('0x13')][_0x0b7a('0x15')]);return _0x5eaeb3(_0x539cdf[_0x0b7a('0x13')][_0x0b7a('0x15')]);}else{logger[_0x0b7a('0xe')](_0x0b7a('0xf'),_0x316a3c,_0x0b7a('0x12'));_0x5eaeb3(_0x539cdf['result'][_0x0b7a('0x15')]);}})['catch'](function(_0x1f4a6e){logger[_0x0b7a('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x316a3c,_0x1f4a6e);_0x2378af(_0x1f4a6e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 2c7a2a3..4fdc9bc 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a52=['pm2_env','name','Online\x20apps:','map','join','Offline\x20apps:','status','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x4d7f6a,_0x5e0f44){var _0x3a019a=function(_0x4c9642){while(--_0x4c9642){_0x4d7f6a['push'](_0x4d7f6a['shift']());}};_0x3a019a(++_0x5e0f44);}(_0x5a52,0x18d));var _0x25a5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a52[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x25a5('0x0'));var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x25a5('0x1'));var config=require(_0x25a5('0x2'));var logger=require(_0x25a5('0x3'))(_0x25a5('0x4'));var pm2=require(_0x25a5('0x5'));var pm2Config=require(_0x25a5('0x6'));var schedule=require(_0x25a5('0x7'));var chat=require(_0x25a5('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x25a5('0x9'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x25a5('0xa')][_0x25a5('0xb')]()[_0x25a5('0xc')](function(){if(config[_0x25a5('0xd')]){return seedDb[_0x25a5('0xe')]();}})[_0x25a5('0xc')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x25a5('0xf')]();})[_0x25a5('0xc')](function(_0x107e85){logger[_0x25a5('0x10')](_0x107e85);return chat[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return whatsapp[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return schedule['start']();})[_0x25a5('0xc')](function(){return transcribe[_0x25a5('0x11')]();})[_0x25a5('0xc')](function(){return provider['start']();})[_0x25a5('0xc')](function(_0x4a6a9a){logger[_0x25a5('0x10')](_0x4a6a9a);return pm2[_0x25a5('0x11')](pm2Config);})[_0x25a5('0xc')](function(_0x47d1d1){var _0x4c5f3a=_0x47d1d1[_0x25a5('0x12')](function(_0x5e1590){return typeof _0x5e1590[_0x25a5('0x13')]===_0x25a5('0x14')&&_0x5e1590[_0x25a5('0x13')]>=0x0;});if(_0x4c5f3a[_0x25a5('0x15')]>0x0){throw new Error(_0x4c5f3a['length']+_0x25a5('0x16')+_['map'](_0x4c5f3a,function(_0x5f257b){return'\x22'+_0x5f257b[_0x25a5('0x17')][_0x25a5('0x18')]+'\x22';}));}logger[_0x25a5('0x10')](_0x25a5('0x19'),_[_0x25a5('0x1a')](_['filter'](_0x47d1d1,{'status':'online'}),_0x25a5('0x18'))[_0x25a5('0x1b')]());logger[_0x25a5('0x10')](_0x25a5('0x1c'),_[_0x25a5('0x1a')](_[_0x25a5('0x12')](_0x47d1d1,function(_0x514c59){return _0x514c59[_0x25a5('0x1d')]!=='online';}),'name')[_0x25a5('0x1b')]()||'None');console[_0x25a5('0x1e')](_0x25a5('0x1f'));})['catch'](function(_0x312d01){console[_0x25a5('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x312d01);logger[_0x25a5('0x20')](_0x25a5('0x21'),_0x312d01);process[_0x25a5('0x22')](0x1);});}main(); \ No newline at end of file +var _0x818f=['App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','join','status','online','None'];(function(_0x2f3092,_0x485b57){var _0x39991c=function(_0x1ccd8a){while(--_0x1ccd8a){_0x2f3092['push'](_0x2f3092['shift']());}};_0x39991c(++_0x485b57);}(_0x818f,0x1da));var _0xf818=function(_0x45e4fa,_0xe6ed3){_0x45e4fa=_0x45e4fa-0x0;var _0x27342=_0x818f[_0x45e4fa];return _0x27342;};'use strict';var _=require(_0xf818('0x0'));var db=require(_0xf818('0x1'))['db'];var seedDb=require(_0xf818('0x2'));var checkLicense=require(_0xf818('0x3'));var rpc=require(_0xf818('0x4'));var config=require(_0xf818('0x5'));var logger=require('./config/logger')(_0xf818('0x6'));var pm2=require(_0xf818('0x7'));var pm2Config=require(_0xf818('0x8'));var schedule=require(_0xf818('0x9'));var chat=require(_0xf818('0xa'));var whatsapp=require(_0xf818('0xb'));var transcribe=require(_0xf818('0xc'));var provider=require(_0xf818('0xd'));function main(){return db[_0xf818('0xe')]['sync']()[_0xf818('0xf')](function(){if(config[_0xf818('0x10')]){return seedDb[_0xf818('0x11')]();}})['then'](function(){return checkLicense['default']();})[_0xf818('0xf')](function(){return rpc[_0xf818('0x12')]();})[_0xf818('0xf')](function(_0x3386f9){logger[_0xf818('0x13')](_0x3386f9);return chat['start']();})[_0xf818('0xf')](function(){return whatsapp[_0xf818('0x14')]();})[_0xf818('0xf')](function(){return schedule[_0xf818('0x14')]();})[_0xf818('0xf')](function(){return transcribe['start']();})['then'](function(){return provider[_0xf818('0x14')]();})[_0xf818('0xf')](function(_0x950109){logger[_0xf818('0x13')](_0x950109);return pm2['start'](pm2Config);})[_0xf818('0xf')](function(_0x3234c5){var _0xbc3568=_0x3234c5[_0xf818('0x15')](function(_0xbfdd71){return typeof _0xbfdd71['exitCode']==='number'&&_0xbfdd71[_0xf818('0x16')]>=0x0;});if(_0xbc3568['length']>0x0){throw new Error(_0xbc3568[_0xf818('0x17')]+_0xf818('0x18')+_['map'](_0xbc3568,function(_0x2bf9f3){return'\x22'+_0x2bf9f3[_0xf818('0x19')][_0xf818('0x1a')]+'\x22';}));}logger['info'](_0xf818('0x1b'),_[_0xf818('0x1c')](_[_0xf818('0x15')](_0x3234c5,{'status':'online'}),'name')[_0xf818('0x1d')]());logger[_0xf818('0x13')]('Offline\x20apps:',_[_0xf818('0x1c')](_['filter'](_0x3234c5,function(_0x1849bf){return _0x1849bf[_0xf818('0x1e')]!==_0xf818('0x1f');}),'name')[_0xf818('0x1d')]()||_0xf818('0x20'));console['log'](_0xf818('0x21'));})[_0xf818('0x22')](function(_0x1160f4){console[_0xf818('0x23')](_0xf818('0x24'),_0x1160f4);logger[_0xf818('0x25')](_0xf818('0x26'),_0x1160f4);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e6c6a65..b732045 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 _0x008c=['The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','sign','session','payload','options','promisify','verify','randomBytes','hex','floor','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','name','userpic','permissions','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','smsAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','disposition','then','unmanaged','json','headers','startsWith','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x008c,0x188));var _0xc008=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0x008c[_0x13ff53];return _0x290228;};'use strict';var db=require(_0xc008('0x0'))['db'];var config=require(_0xc008('0x1'));var hardwareConf=require(_0xc008('0x2'));var licenseUtil=require(_0xc008('0x3'));var encryptor=require(_0xc008('0x4'));var _=require('lodash');var jwt=require(_0xc008('0x5'));var expressJwt=require(_0xc008('0x6'));var compose=require(_0xc008('0x7'));var basicAuth=require(_0xc008('0x8'));var crypto=require(_0xc008('0x9'));var BPromise=require(_0xc008('0xa'));var util=require(_0xc008('0xb'));var moment=require(_0xc008('0xc'));var validateJwt=expressJwt({'secret':config[_0xc008('0xd')]['session']});var userAttributes=['id',_0xc008('0xe'),'fullname',_0xc008('0xf'),'internal','email',_0xc008('0x10'),_0xc008('0x11'),'md5secret','voicePause','chatPause',_0xc008('0x12'),_0xc008('0x13'),'smsPause',_0xc008('0x14'),_0xc008('0x15'),_0xc008('0x16'),_0xc008('0x17'),_0xc008('0x18'),_0xc008('0x19'),_0xc008('0x1a'),'passwordResetAt','alias',_0xc008('0x1b'),'phoneBarAutoAnswerDelay',_0xc008('0x1c'),_0xc008('0x1d'),_0xc008('0x1e'),_0xc008('0x1f'),_0xc008('0x20'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xc008('0x21'),_0xc008('0x22'),_0xc008('0x23'),_0xc008('0x24'),'settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0xc008('0x25'),_0xc008('0x26'),'selectRecallMeCampaign',_0xc008('0x27'),'chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer',_0xc008('0x28'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xc008('0x29')];exports[_0xc008('0x2a')]=function(){return this[_0xc008('0x2b')](!![])[_0xc008('0x2c')](function(_0x11cc75,_0x110128,_0x4f43e2){if(_0x11cc75[_0xc008('0x2d')]){_0x4f43e2();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x11cc75[_0xc008('0x2e')]['id']},'attributes':['id',_0xc008('0x2f'),_0xc008('0x30')],'raw':!![]})[_0xc008('0x31')](function(_0x5410f5){if(_0x5410f5&&_0x5410f5['closed']){return _0x110128['status'](_0x5410f5[_0xc008('0x30')]===_0xc008('0x32')?0x195:0x193)[_0xc008('0x33')]({'message':_0x5410f5[_0xc008('0x30')]==='unmanaged'?'Unmanaged.':'Forbidden.'});}else{_0x4f43e2();}})['catch'](function(_0x4caaf4){_0x4f43e2(_0x4caaf4);});}});};exports[_0xc008('0x2b')]=function isAuthenticated(_0x29ba43){return compose()[_0xc008('0x2c')](function(_0x529961,_0x24c14c,_0x32390d){var _0x209591;if(_0x529961[_0xc008('0x34')]['authorization']){if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],'Basic')){var _0x539766=basicAuth(_0x529961);db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'name':_0x539766[_0xc008('0xf')]}})[_0xc008('0x31')](function(_0x1de04b){if(!_0x1de04b||!_0x1de04b[_0xc008('0x38')](_0x539766[_0xc008('0x39')])){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x3b')});}_0x529961[_0xc008('0x2d')]={'id':_0x1de04b['id']};_0x32390d();})[_0xc008('0x3c')](function(_0x596ee8){_0x32390d(_0x596ee8);});}else if(_[_0xc008('0x35')](_0x529961[_0xc008('0x34')]['authorization'],_0xc008('0x3d'))){validateJwt(_0x529961,_0x24c14c,_0x32390d);}else{if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}}}else if(_0x529961[_0xc008('0x3f')][_0xc008('0x40')]){try{var _0x7cfbc5={'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};verifyJwt(_0x529961['query'][_0xc008('0x40')],_0x7cfbc5)[_0xc008('0x31')](function(_0x459df4){return db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x459df4[_0xc008('0x42')]}})[_0xc008('0x31')](function(_0x5d0e06){_0x209591=_0x5d0e06;return db[_0xc008('0x43')][_0xc008('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc008('0x45')],'raw':!![]});})[_0xc008('0x31')](function(_0x5e38d5){if(!_0x209591||!_[_0xc008('0x46')](_0x209591[_0xc008('0x47')],_0x459df4[_0xc008('0x48')])){return _0x24c14c['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x209591[_0xc008('0x49')]){return _0x24c14c['status'](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}if(_0x209591[_0xc008('0x4b')]){if(_0x5e38d5[_0xc008('0x45')]>0x0){if(moment(_0x209591[_0xc008('0x4c')])[_0xc008('0x4d')](_0x5e38d5[_0xc008('0x45')],_0xc008('0x4e'))>moment()){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}else{return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});}}_0x529961['user']={'id':_0x209591['id']};_0x32390d();});})[_0xc008('0x3c')](function(){return _0x24c14c[_0xc008('0x3a')](0x191)[_0xc008('0x33')]({'message':_0xc008('0x4a')});});}catch(_0x49a16d){_0x32390d(_0x49a16d);}}else if(_0x29ba43){_0x32390d();}else{return _0x24c14c[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x3e')});}})[_0xc008('0x2c')](function(_0x2d142d,_0x5706bb,_0x398cdd){if(_0x2d142d[_0xc008('0x2d')]){db[_0xc008('0x36')][_0xc008('0x37')]({'where':{'id':_0x2d142d[_0xc008('0x2d')]['id']},'attributes':userAttributes})['then'](function(_0xf4cc4b){if(!_0xf4cc4b){return _0x5706bb[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x4f')});}_0x2d142d['user']=_0xf4cc4b;_0x398cdd();})[_0xc008('0x3c')](function(_0xe37446){_0x398cdd(_0xe37446);});}else if(_0x29ba43){_0x398cdd();}else{return _0x5706bb[_0xc008('0x3a')](0x194)['json']({'message':_0xc008('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc008('0x2c')](function(_0x5d3a72,_0x46fa8f,_0x213014){return licenseUtil['getLicense']()[_0xc008('0x31')](function(_0x24ba0f){if(_0x24ba0f[_0xc008('0x51')]){_0x213014();}else{return _0x46fa8f['status'](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x44fc5d){_0x213014(_0x44fc5d);});});};exports[_0xc008('0x53')]=function isWebrtcLicence(){return compose()[_0xc008('0x2c')](function(_0x59ca2b,_0x47cafa,_0x5283a8){return licenseUtil[_0xc008('0x54')]()[_0xc008('0x31')](function(_0x103a83){if(_0x103a83[_0xc008('0x55')]){_0x5283a8();}else{return _0x47cafa[_0xc008('0x3a')](0x193)[_0xc008('0x33')]({'message':_0xc008('0x52')});}})[_0xc008('0x3c')](function(_0x572593){_0x5283a8(_0x572593);});});};exports['isMiddleware']=function(_0x516e43,_0x2d5a49,_0x2651cf){_0x516e43[_0xc008('0x56')]=!![];return _0x2651cf();};exports['signToken']=function signToken(_0x28bc33){return signJwt(_0x28bc33);};exports[_0xc008('0x57')]=function(_0x17ab1a,_0x1c2c50){if(!_0x17ab1a[_0xc008('0x2d')]){return _0x1c2c50[_0xc008('0x3a')](0x194)[_0xc008('0x33')]({'message':_0xc008('0x58')});}var _0x3fd7d9={'payload':{'id':_0x17ab1a[_0xc008('0x2d')]['id'],'role':_0x17ab1a['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fd7d9)[_0xc008('0x31')](function(_0x51cb14){_0x1c2c50[_0xc008('0x59')](_0xc008('0x5a'),_0x51cb14);_0x1c2c50[_0xc008('0x5b')]('/dashboards/general');})[_0xc008('0x3c')](function(_0x32b435){return _0x1c2c50[_0xc008('0x3a')](0x1f4)[_0xc008('0x5c')](_0x32b435);});};exports[_0xc008('0x5d')]=function(_0x51105f){if(_[_0xc008('0x5e')](_0x51105f[_0xc008('0x47')])||_['isNil'](_0x51105f[_0xc008('0x5f')])){return null;}else{return createJwt(_0x51105f);}};exports[_0xc008('0x60')]=function(_0x5b5fbf){_0x5b5fbf['apiKeyNonce']=generateNonce();_0x5b5fbf[_0xc008('0x5f')]=generateIssuedAt();return createJwt(_0x5b5fbf);};exports[_0xc008('0x61')]=function(_0x20947b,_0x30d0aa){var _0x14b6a0=_0x20947b['query']['apikey'];if(_0x14b6a0){var _0x34b72a={'nonce':_0x30d0aa['apiKeyNonce'],'iat':_0x30d0aa[_0xc008('0x5f')],'audience':hardwareConf[_0xc008('0x41')](),'issuer':hardwareConf[_0xc008('0x41')]()};return verifyJwt(_0x14b6a0,_0x34b72a)[_0xc008('0x31')](function(){return generateApiKey(_0x30d0aa);});}else{throw{'message':_0xc008('0x62')};}};exports[_0xc008('0x63')]=function(_0x49d8b0){var _0x2ea742=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2ea742[_0xc008('0x64')](_0x49d8b0))throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0xc008('0x67'));return;};exports['validatePasswordHistory']=function(_0x41fae3,_0x4fdab4,_0x535e6e){var _0x5dbfca=encryptor[_0xc008('0x68')](_0x4fdab4)[_0xc008('0x69')](',');for(var _0x5dfb69=0x0;_0x5dfb69<_0x535e6e;_0x5dfb69++){if(!_0x5dbfca[_0x5dfb69])break;if(_0x41fae3['toLowerCase']()===_0x5dbfca[_0x5dfb69][_0xc008('0x6a')]()){var _0x2d8361=util[_0xc008('0x6b')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x535e6e);if(_0x535e6e===0x1){_0x2d8361=_0xc008('0x6c');}throw new db[(_0xc008('0x65'))][(_0xc008('0x66'))](_0x2d8361);}}return;};exports[_0xc008('0x6d')]=function(_0x5baff1,_0x4022dd){var _0x4eaa6d=_0x4022dd?encryptor[_0xc008('0x68')](_0x4022dd)[_0xc008('0x69')](','):[];if(_0x4eaa6d[_0xc008('0x6e')]===0x5){_0x4eaa6d[_0xc008('0x6f')](-0x1,0x1);}_0x4eaa6d[_0xc008('0x70')](_0x5baff1);return encryptor[_0xc008('0x71')](_0x4eaa6d['join'](','));};function signJwt(_0x375e71){var _0x570001=BPromise['promisify'](jwt[_0xc008('0x72')],{'context':jwt});var _0x30aa1e=_0x375e71['secret']||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x3e373e,_0x4517c0){_0x570001(_0x375e71[_0xc008('0x74')],_0x30aa1e,_0x375e71[_0xc008('0x75')])[_0xc008('0x31')](function(_0x57ce9a){_0x3e373e(_0x57ce9a);})[_0xc008('0x3c')](function(_0x462e1e){_0x4517c0(_0x462e1e);});});}function verifyJwt(_0x3bfb15,_0x2a60e6,_0xb3ca0f){var _0x167425=BPromise[_0xc008('0x76')](jwt[_0xc008('0x77')],{'context':jwt});var _0xbc430a=_0xb3ca0f||config[_0xc008('0xd')][_0xc008('0x73')];return new BPromise(function(_0x2b5eb6,_0x131b81){_0x167425(_0x3bfb15,_0xbc430a,_0x2a60e6)[_0xc008('0x31')](function(_0x4e0251){_0x2b5eb6(_0x4e0251);})[_0xc008('0x3c')](function(_0x2e5467){_0x131b81(_0x2e5467);});});}function generateNonce(){return crypto[_0xc008('0x78')](0x10)['toString'](_0xc008('0x79'));}function generateIssuedAt(){return Math[_0xc008('0x7a')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x1a03fd){var _0x2a4c2b={'payload':{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd[_0xc008('0x47')]},'options':{'algorithm':_0xc008('0x7b'),'subject':_0x1a03fd['id'][_0xc008('0x7c')](),'issuer':hardwareConf[_0xc008('0x41')](),'audience':hardwareConf[_0xc008('0x41')]()}};return signJwt(_0x2a4c2b)[_0xc008('0x31')](function(_0x1b059b){return{'iat':_0x1a03fd[_0xc008('0x5f')],'nonce':_0x1a03fd['apiKeyNonce'],'token':_0x1b059b};});} \ No newline at end of file +var _0x4b84=['User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secret','secrets','payload','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../encryptor','express-jwt','composable-middleware','basic-auth','moment','session','fullname','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','User','find','name','authenticate','pass','json','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0x2a897d,_0x29e446){var _0x5a17c3=function(_0x6b66aa){while(--_0x6b66aa){_0x2a897d['push'](_0x2a897d['shift']());}};_0x5a17c3(++_0x29e446);}(_0x4b84,0x1cc));var _0x44b8=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x4b84[_0x439d59];return _0x3670c7;};'use strict';var db=require(_0x44b8('0x0'))['db'];var config=require(_0x44b8('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x44b8('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x44b8('0x3'));var compose=require(_0x44b8('0x4'));var basicAuth=require(_0x44b8('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0x44b8('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0x44b8('0x7')]});var userAttributes=['id','role',_0x44b8('0x8'),'name','internal',_0x44b8('0x9'),_0x44b8('0xa'),_0x44b8('0xb'),'md5secret',_0x44b8('0xc'),_0x44b8('0xd'),_0x44b8('0xe'),_0x44b8('0xf'),_0x44b8('0x10'),_0x44b8('0x11'),_0x44b8('0x12'),'showWebBar',_0x44b8('0x13'),_0x44b8('0x14'),'crudPermissions',_0x44b8('0x15'),'passwordResetAt',_0x44b8('0x16'),_0x44b8('0x17'),'phoneBarAutoAnswerDelay',_0x44b8('0x18'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),'phoneBarRemoteControlPort','hotdesk','interface',_0x44b8('0x1d'),'privacyEnabled',_0x44b8('0x1e'),_0x44b8('0x1f'),'downloadVoiceRecordings',_0x44b8('0x20'),_0x44b8('0x21'),'ignorePauseForPreviewCalls',_0x44b8('0x22'),_0x44b8('0x23'),'chatAutoanswerDelay',_0x44b8('0x24'),_0x44b8('0x25'),_0x44b8('0x26'),_0x44b8('0x27'),_0x44b8('0x28'),_0x44b8('0x29'),_0x44b8('0x2a'),_0x44b8('0x2b'),_0x44b8('0x2c'),_0x44b8('0x2d')];exports[_0x44b8('0x2e')]=function(){return this[_0x44b8('0x2f')](!![])['use'](function(_0x56549a,_0x3a8aa4,_0x416b34){if(_0x56549a[_0x44b8('0x30')]){_0x416b34();}else{return db[_0x44b8('0x31')]['findOne']({'where':{'id':_0x56549a[_0x44b8('0x32')]['id']},'attributes':['id','closed',_0x44b8('0x33')],'raw':!![]})[_0x44b8('0x34')](function(_0x25a0c1){if(_0x25a0c1&&_0x25a0c1[_0x44b8('0x35')]){return _0x3a8aa4[_0x44b8('0x36')](_0x25a0c1['disposition']===_0x44b8('0x37')?0x195:0x193)['json']({'message':_0x25a0c1[_0x44b8('0x33')]===_0x44b8('0x37')?'Unmanaged.':_0x44b8('0x38')});}else{_0x416b34();}})[_0x44b8('0x39')](function(_0x2656d7){_0x416b34(_0x2656d7);});}});};exports['isAuthenticated']=function isAuthenticated(_0xb22107){return compose()[_0x44b8('0x3a')](function(_0x53d9c7,_0x2e0174,_0x4a182d){var _0xfb0028;if(_0x53d9c7['headers']['authorization']){if(_['startsWith'](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x3d'))){var _0x1bd1be=basicAuth(_0x53d9c7);db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'name':_0x1bd1be[_0x44b8('0x40')]}})[_0x44b8('0x34')](function(_0xd1d320){if(!_0xd1d320||!_0xd1d320[_0x44b8('0x41')](_0x1bd1be[_0x44b8('0x42')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Wrong\x20credentials.'});}_0x53d9c7[_0x44b8('0x30')]={'id':_0xd1d320['id']};_0x4a182d();})['catch'](function(_0x212983){_0x4a182d(_0x212983);});}else if(_[_0x44b8('0x44')](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x45'))){validateJwt(_0x53d9c7,_0x2e0174,_0x4a182d);}else{if(_0xb22107){_0x4a182d();}else{return _0x2e0174['status'](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}}}else if(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')]){try{var _0x46b008={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x44b8('0x49')]()};verifyJwt(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')],_0x46b008)[_0x44b8('0x34')](function(_0x140a79){return db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x140a79[_0x44b8('0x4a')]}})[_0x44b8('0x34')](function(_0x181761){_0xfb0028=_0x181761;return db[_0x44b8('0x4b')][_0x44b8('0x4c')]({'where':{'id':0x1},'attributes':[_0x44b8('0x4d'),_0x44b8('0x4e')],'raw':!![]});})[_0x44b8('0x34')](function(_0x1becb0){if(!_0xfb0028||!_[_0x44b8('0x4f')](_0xfb0028[_0x44b8('0x50')],_0x140a79[_0x44b8('0x51')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x52')});}if(_0xfb0028['disabled']){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xfb0028[_0x44b8('0x53')]){if(_0x1becb0[_0x44b8('0x4e')]>0x0){if(moment(_0xfb0028[_0x44b8('0x54')])[_0x44b8('0x55')](_0x1becb0['blockDuration'],_0x44b8('0x56'))>moment()){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}else{return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}_0x53d9c7[_0x44b8('0x30')]={'id':_0xfb0028['id']};_0x4a182d();});})[_0x44b8('0x39')](function(){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});});}catch(_0xd69398){_0x4a182d(_0xd69398);}}else if(_0xb22107){_0x4a182d();}else{return _0x2e0174[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}})['use'](function(_0x12a0a4,_0x43e43a,_0xbf444f){if(_0x12a0a4['user']){db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x12a0a4[_0x44b8('0x30')]['id']},'attributes':userAttributes})['then'](function(_0xbad4bb){if(!_0xbad4bb){return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x58')});}_0x12a0a4[_0x44b8('0x30')]=_0xbad4bb;_0xbf444f();})['catch'](function(_0x5ae5f9){_0xbf444f(_0x5ae5f9);});}else if(_0xb22107){_0xbf444f();}else{return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x59')});}});};exports[_0x44b8('0x5a')]=function canUpdate(){return compose()[_0x44b8('0x3a')](function(_0x26e1f1,_0x3fc41b,_0x457348){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x197782){if(_0x197782[_0x44b8('0x5c')]){_0x457348();}else{return _0x3fc41b[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x5d')});}})[_0x44b8('0x39')](function(_0xce06dc){_0x457348(_0xce06dc);});});};exports[_0x44b8('0x5e')]=function isWebrtcLicence(){return compose()[_0x44b8('0x3a')](function(_0x49c507,_0x547dc1,_0x3b1b12){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x269284){if(_0x269284[_0x44b8('0x5f')]){_0x3b1b12();}else{return _0x547dc1[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':'Forbidden'});}})[_0x44b8('0x39')](function(_0x53edca){_0x3b1b12(_0x53edca);});});};exports[_0x44b8('0x60')]=function(_0x3ef886,_0x1dbc28,_0x9207bf){_0x3ef886[_0x44b8('0x60')]=!![];return _0x9207bf();};exports[_0x44b8('0x61')]=function signToken(_0x491600){return signJwt(_0x491600);};exports[_0x44b8('0x62')]=function(_0xff92fb,_0x10602c){if(!_0xff92fb[_0x44b8('0x30')]){return _0x10602c['status'](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x63')});}var _0x36afa9={'payload':{'id':_0xff92fb[_0x44b8('0x30')]['id'],'role':_0xff92fb[_0x44b8('0x30')][_0x44b8('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36afa9)['then'](function(_0x19d95d){_0x10602c[_0x44b8('0x65')](_0x44b8('0x66'),_0x19d95d);_0x10602c[_0x44b8('0x67')](_0x44b8('0x68'));})['catch'](function(_0x493840){return _0x10602c[_0x44b8('0x36')](0x1f4)['send'](_0x493840);});};exports[_0x44b8('0x69')]=function(_0x5785ef){if(_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x50')])||_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x6b')])){return null;}else{return createJwt(_0x5785ef);}};exports[_0x44b8('0x6c')]=function(_0x32f588){_0x32f588[_0x44b8('0x50')]=generateNonce();_0x32f588['apiKeyIat']=generateIssuedAt();return createJwt(_0x32f588);};exports[_0x44b8('0x6d')]=function(_0x37b2c2,_0x1e6a5e){var _0x492be6=_0x37b2c2[_0x44b8('0x47')][_0x44b8('0x48')];if(_0x492be6){var _0x45f9a0={'nonce':_0x1e6a5e[_0x44b8('0x50')],'iat':_0x1e6a5e['apiKeyIat'],'audience':hardwareConf[_0x44b8('0x49')](),'issuer':hardwareConf[_0x44b8('0x49')]()};return verifyJwt(_0x492be6,_0x45f9a0)['then'](function(){return generateApiKey(_0x1e6a5e);});}else{throw{'message':_0x44b8('0x6e')};}};exports[_0x44b8('0x6f')]=function(_0x35136e){var _0x3df6aa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3df6aa[_0x44b8('0x70')](_0x35136e))throw new db['Sequelize']['ValidationError'](_0x44b8('0x71'));return;};exports[_0x44b8('0x72')]=function(_0xa30834,_0x4358aa,_0x765e45){var _0x3f6b92=encryptor[_0x44b8('0x73')](_0x4358aa)[_0x44b8('0x74')](',');for(var _0x10bbd9=0x0;_0x10bbd9<_0x765e45;_0x10bbd9++){if(!_0x3f6b92[_0x10bbd9])break;if(_0xa30834[_0x44b8('0x75')]()===_0x3f6b92[_0x10bbd9][_0x44b8('0x75')]()){var _0x3f7576=util['format'](_0x44b8('0x76'),_0x765e45);if(_0x765e45===0x1){_0x3f7576=_0x44b8('0x77');}throw new db[(_0x44b8('0x78'))][(_0x44b8('0x79'))](_0x3f7576);}}return;};exports[_0x44b8('0x7a')]=function(_0x1df915,_0x426a6a){var _0x172ff3=_0x426a6a?encryptor[_0x44b8('0x73')](_0x426a6a)[_0x44b8('0x74')](','):[];if(_0x172ff3[_0x44b8('0x7b')]===0x5){_0x172ff3[_0x44b8('0x7c')](-0x1,0x1);}_0x172ff3[_0x44b8('0x7d')](_0x1df915);return encryptor[_0x44b8('0x7e')](_0x172ff3[_0x44b8('0x7f')](','));};function signJwt(_0x293c2e){var _0x25f91c=BPromise[_0x44b8('0x80')](jwt['sign'],{'context':jwt});var _0x1ec516=_0x293c2e[_0x44b8('0x81')]||config[_0x44b8('0x82')][_0x44b8('0x7')];return new BPromise(function(_0x51f763,_0x29ed5d){_0x25f91c(_0x293c2e[_0x44b8('0x83')],_0x1ec516,_0x293c2e['options'])[_0x44b8('0x34')](function(_0xc4d667){_0x51f763(_0xc4d667);})['catch'](function(_0x2a95f6){_0x29ed5d(_0x2a95f6);});});}function verifyJwt(_0x3354bd,_0x520929,_0x37e42e){var _0x454fe6=BPromise[_0x44b8('0x80')](jwt['verify'],{'context':jwt});var _0x16e790=_0x37e42e||config['secrets'][_0x44b8('0x7')];return new BPromise(function(_0x5161ea,_0x176536){_0x454fe6(_0x3354bd,_0x16e790,_0x520929)[_0x44b8('0x34')](function(_0xf4d81f){_0x5161ea(_0xf4d81f);})[_0x44b8('0x39')](function(_0x3c6aad){_0x176536(_0x3c6aad);});});}function generateNonce(){return crypto[_0x44b8('0x84')](0x10)['toString'](_0x44b8('0x85'));}function generateIssuedAt(){return Math['floor'](Date[_0x44b8('0x86')]()/0x3e8)[_0x44b8('0x87')]();}function createJwt(_0x4c1a7c){var _0x3f9438={'payload':{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')]},'options':{'algorithm':_0x44b8('0x88'),'subject':_0x4c1a7c['id'][_0x44b8('0x87')](),'issuer':hardwareConf[_0x44b8('0x49')](),'audience':hardwareConf[_0x44b8('0x49')]()}};return signJwt(_0x3f9438)[_0x44b8('0x34')](function(_0x3f9102){return{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')],'token':_0x3f9102};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b11e4fa..a1e0e82 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['findOne','slice','fieldType','keys','type','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','tags','checkListsRestrictions','ids','tag','countFilteredContacts','count','clause','rows','catch','describe','startsWith','cf_','map','CmCustomField'];(function(_0x1972f4,_0x1231ff){var _0x42159b=function(_0x1f9d6f){while(--_0x1f9d6f){_0x1972f4['push'](_0x1972f4['shift']());}};_0x42159b(++_0x1231ff);}(_0x757a,0xde));var _0xa757=function(_0x11b5d0,_0x560684){_0x11b5d0=_0x11b5d0-0x0;var _0x10644d=_0x757a[_0x11b5d0];return _0x10644d;};'use strict';var _=require('lodash');var sqlUtils=require(_0xa757('0x0'));var db=require(_0xa757('0x1'))['db'];exports['findAll']=function(_0x5c03c3,_0x5709ed,_0x32be3b,_0x1721c6){var _0x1c2932={'count':0x0,'rows':[]};var _0x453d07=sqlUtils[_0xa757('0x2')](_0x5709ed,_0x5c03c3);if(_0x453d07){return Promise[_0xa757('0x3')](_0x1c2932);}var _0x5edca8=sqlUtils[_0xa757('0x4')]();var _0x4343b6={};var _0x53be0e=![];var _0x2930fa=![];return Promise[_0xa757('0x3')]()[_0xa757('0x5')](function(){if(_0x5c03c3[_0xa757('0x6')]){return sqlUtils[_0xa757('0x7')](_0x5c03c3['search'],_0x1721c6);}else{return sqlUtils[_0xa757('0x8')](_0x5c03c3,_0x1721c6);}})[_0xa757('0x5')](function(_0x32f0ec){_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xa')]);_0x5edca8[_0xa757('0x9')](_0x32f0ec[_0xa757('0xb')]);_0x5edca8['where'](_0x32f0ec['filter']);_0x5edca8['where'](_0x32f0ec['user']['clause']);_0x4343b6=_0x32f0ec[_0xa757('0xc')];_0x2930fa=_0x32f0ec['user']['skip'];return sqlUtils[_0xa757('0xd')](_0x5709ed,_0x5c03c3,_0x2930fa);})['then'](function(_0x481508){_0x5edca8[_0xa757('0x9')](_0x481508);var _0x1b670e=_0x5c03c3[_0xa757('0x6')]?_0x4343b6[_0xa757('0xe')]:_0x5c03c3[_0xa757('0xf')];_0x53be0e=_0x1b670e?!![]:![];return sqlUtils[_0xa757('0x10')](_0x5edca8,_0x1b670e);})[_0xa757('0x5')](function(_0x2f7947){_0x1c2932[_0xa757('0x11')]=_0x2f7947;if(_0x1c2932[_0xa757('0x11')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x5edca8,_0x5c03c3[_0xa757('0xb')],_0x32be3b,_0x53be0e,_0x4343b6[_0xa757('0x12')],_0x2930fa);})[_0xa757('0x5')](function(_0x4d9f58){if(!_0x4d9f58){return[];}return sqlUtils['getFilteredContacts'](_0x4d9f58,_0x5c03c3,_0x32be3b);})[_0xa757('0x5')](function(_0x468d45){_0x1c2932[_0xa757('0x13')]=_0x468d45;return _0x1c2932;})[_0xa757('0x14')](function(_0x27f4ba){throw _0x27f4ba;});};exports[_0xa757('0x15')]=function(){var _0x4bd137={};var _0x58954=[];return db['CmContact'][_0xa757('0x15')]()[_0xa757('0x5')](function(_0x14014c){_0x4bd137=_0x14014c;var _0x2c9ec6=Object['keys'](_0x4bd137)['filter'](function(_0x40ec48){return _[_0xa757('0x16')](_0x40ec48,_0xa757('0x17'))?_0x40ec48:undefined;});var _0x8d121f=_0x2c9ec6[_0xa757('0x18')](function(_0x40562f){return db[_0xa757('0x19')][_0xa757('0x1a')]({'where':{'id':_0x40562f[_0xa757('0x1b')](0x3)},'raw':!![]});});return Promise['all'](_0x8d121f);})[_0xa757('0x5')](function(_0x59e9d4){for(var _0x422e9e=0x0;_0x422e9e<_0x59e9d4['length'];_0x422e9e++){if(_0x59e9d4[_0x422e9e]){var _0x40551d=_0xa757('0x17')+_0x59e9d4[_0x422e9e]['id'];_0x4bd137[_0x40551d][_0xa757('0x1c')]=_0x59e9d4[_0x422e9e]['type'];}}_0x58954=_[_0xa757('0x18')](Object[_0xa757('0x1d')](_0x4bd137),function(_0x471e84){return{'name':_0x471e84,'type':_0x4bd137[_0x471e84][_0xa757('0x1e')]};});return _0x58954;})['catch'](function(_0x449a7d){throw _0x449a7d;});}; \ No newline at end of file +var _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x4b10f0,_0x25c95d){var _0x455af5=function(_0x57526b){while(--_0x57526b){_0x4b10f0['push'](_0x4b10f0['shift']());}};_0x455af5(++_0x25c95d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 9cb3196..637a0e3 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd86c=['CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','type','default','text','value','Tag','tags','clause','and','user','uc.UserId\x20=\x20?','keys','some','Contact','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','filter','resolve','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','DESC','order','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','query','toString','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','phone','ListId','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags'];(function(_0x215f2e,_0x1ca853){var _0x53f1da=function(_0x29157e){while(--_0x29157e){_0x215f2e['push'](_0x215f2e['shift']());}};_0x53f1da(++_0x1ca853);}(_0xd86c,0x1ef));var _0xcd86=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xd86c[_0x3aeb36];return _0xa2ef21;};'use strict';var _=require(_0xcd86('0x0'));var squel=require(_0xcd86('0x1'));var as=require(_0xcd86('0x2'));var qs=require('../parsers/qs');var utils=require(_0xcd86('0x3'));var db=require(_0xcd86('0x4'))['db'];function skipContactsQuery(_0x570595,_0x29c059){var _0x4a4b3e=![];if(_0x570595[_0xcd86('0x5')]==='agent'&&!_0x29c059[_0xcd86('0x6')]&&!_0x29c059['ListId']&&_0x29c059[_0xcd86('0x7')]!==_0xcd86('0x8')){_0x4a4b3e=!![];}return _0x4a4b3e;}function getContactsSubquery(){return squel[_0xcd86('0x9')]()[_0xcd86('0xa')](_0xcd86('0xb'),'c')[_0xcd86('0xc')](_0xcd86('0xd'));}function applyJoinClauses(_0x29ad91,_0x1c4e5f){var _0x5a3b83=_0x1c4e5f?'c':_0xcd86('0xe');_0x29ad91[_0xcd86('0xf')](_0xcd86('0x10'),'uc','uc.CmContactId\x20=\x20'+_0x5a3b83+_0xcd86('0x11'))[_0xcd86('0xf')](_0xcd86('0x12'),'ct','ct.CmContactId\x20=\x20'+_0x5a3b83+_0xcd86('0x11'))[_0xcd86('0xf')](_0xcd86('0x13'),'t',_0xcd86('0x14'));return _0x29ad91;}function addFieldsToQuery(_0x5232de,_0x51d16a,_0x3cd1bc,_0x14ac9e,_0x4ef3f3){var _0x1a89ce=_0x4ef3f3?'c':_0xcd86('0xe');if(!_0x51d16a){_0x51d16a=['id',_0xcd86('0x15'),'lastName',_0xcd86('0x16'),'mobile','fax','email',_0xcd86('0x17'),_0xcd86('0x18'),_0xcd86('0x19'),'updatedAt',_0xcd86('0x1a'),_0xcd86('0x1b')];}else if(!_0x51d16a[_0xcd86('0x1c')]('id')){_0x51d16a[_0xcd86('0x1d')]('id');}var _0x1b4f7e=_0x3cd1bc&&_0x4ef3f3||!_0x3cd1bc&&!_0x4ef3f3;if(_0x14ac9e){_0x1b4f7e=_0x14ac9e&&_0x4ef3f3||!_0x14ac9e&&!_0x4ef3f3;}_0x51d16a[_0xcd86('0x1e')](function(_0x1564ec){if(_0x1564ec===_0xcd86('0x1b')){if(_0x1b4f7e){_0x5232de['field'](_0xcd86('0x1f'),_0x1564ec);}else if(_0x3cd1bc||_0x14ac9e){_0x5232de[_0xcd86('0x20')](_0x1a89ce+'.'+_0x1564ec);}}else{_0x5232de[_0xcd86('0x20')](_0x1a89ce+'.'+_0x1564ec);}});return _0x5232de;}function getSqlClauses(){var _0x30aca5={'default':squel[_0xcd86('0x21')](),'fields':squel[_0xcd86('0x21')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xcd86('0x21')](),'ids':null},'user':{'clause':squel[_0xcd86('0x21')](),'skip':![]}};return _0x30aca5;}function parseTagParameter(_0x3451e5){var _0x291911=squel[_0xcd86('0x21')]();if(_0x3451e5){var _0x95c82c=utils[_0xcd86('0x22')](_0x3451e5);_0x95c82c[_0xcd86('0x1e')](function(_0x5230d8){_0x291911['or'](_0xcd86('0x23'),'%,'+_0x5230d8+',%');});}return _0x291911;}function parseSearchFilter(_0x3d010b){var _0x10acfb=squel[_0xcd86('0x21')]();if(_0x3d010b){var _0x5b7f22=_0x3d010b[_0xcd86('0x24')]('\x5c','\x5c\x5c')[_0xcd86('0x24')](/'/g,'\x27\x27');if(_0x5b7f22[_0xcd86('0x25')]('\x20')[_0xcd86('0x26')]>0x1){_0x10acfb['or'](_0xcd86('0x27'),qs[_0xcd86('0x28')](_0x5b7f22),null);}else{if(qs['isNumeric'](_0x5b7f22)){_0x10acfb['or'](_0xcd86('0x29'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2a'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2b'),_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x2c'),_0x5b7f22+'%');}else if(qs[_0xcd86('0x2d')](_0x5b7f22)){_0x10acfb['or'](_0xcd86('0x2e'),_0x5b7f22+'%');}else{_0x10acfb['or'](_0xcd86('0x2f'),'%'+_0x5b7f22+'%');_0x10acfb['or'](_0xcd86('0x30'),'%'+_0x5b7f22+'%');_0x10acfb['or']('c.email\x20LIKE\x20?','%'+_0x5b7f22+'%');}}}return _0x10acfb;}function parseAdvancedSearchFilter(_0x5b0de2,_0x4bca44){var _0x5394bc=getSqlClauses();var _0x584c1f=as[_0xcd86('0x31')](_0x5b0de2);var _0x14acca=_0x584c1f['sqlOperator'];for(var _0x39e6fd=0x0;_0x39e6fd<_0x584c1f[_0xcd86('0x32')][_0xcd86('0x26')];_0x39e6fd++){var _0x3c9bd0=_0x584c1f['conditions'][_0x39e6fd];var _0x1e6638='c';var _0xb7a9ef=_[_0xcd86('0x33')](_0x4bca44,[_0xcd86('0x34'),_0x3c9bd0[_0xcd86('0x20')]]);if(_0xb7a9ef){if(_0x3c9bd0[_0xcd86('0x20')]===_0xcd86('0x35')||_0xb7a9ef[_0xcd86('0x36')]===_0xcd86('0x37')){_0x3c9bd0[_0xcd86('0x38')]=_0xcd86('0x39');}var _0x49b01b=as['buildExpression'](_0x1e6638,_0xb7a9ef[_0xcd86('0x3a')],_0x3c9bd0);_0x5394bc[_0xcd86('0x3b')][_0x14acca](_0x49b01b[_0xcd86('0x3c')],_0x49b01b['value']['start'],_0x49b01b[_0xcd86('0x3d')]['end']);}else{if(_0x3c9bd0[_0xcd86('0x20')]===_0xcd86('0x3e')){var _0x227de8=_0x3c9bd0[_0xcd86('0x3d')][_0xcd86('0x25')](',')['map'](function(_0x1dc21d){return Number(_0x1dc21d);});var _0x5708dd=parseTagParameter(_0x227de8);_0x5394bc[_0xcd86('0x3f')][_0xcd86('0x40')][_0xcd86('0x41')](_0x5708dd);_0x5394bc['tags']['ids']=_0x227de8;}else if(_0x3c9bd0[_0xcd86('0x20')]==='User'){_0x5394bc[_0xcd86('0x42')][_0xcd86('0x40')][_0xcd86('0x41')](_0xcd86('0x43'),_0x3c9bd0[_0xcd86('0x3d')]);_0x5394bc[_0xcd86('0x42')]['skip']=!![];}}}return _0x5394bc;}function parseModelFields(_0x28ea70,_0x176b8d){var _0x4ce070=squel[_0xcd86('0x21')]();var _0x4e1229=_(_0x28ea70)[_0xcd86('0x44')]()['map'](function(_0xddf358){return _[_0xcd86('0x45')](_0x176b8d,['name',_0xddf358])?_0xddf358:undefined;})['compact']()['value']();if(_0x28ea70['Contact']){_0x4e1229['push'](_0xcd86('0x46'));}if(_0x4e1229['length']>0x0){_0x4e1229['forEach'](function(_0x3eeace){if(_0x3eeace===_0xcd86('0x17')){_0x4ce070[_0xcd86('0x41')](_0xcd86('0x47'),[][_0xcd86('0x48')](_0x28ea70[_0x3eeace]));}else if(_0x3eeace===_0xcd86('0x46')){var _0x368e9d='%'+_0x28ea70[_0x3eeace]+'%';_0x4ce070[_0xcd86('0x41')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x368e9d);}else{_0x4ce070['and']('c.'+_0x3eeace+_0xcd86('0x49'),_0x28ea70[_0x3eeace]);}});}return _0x4ce070;}function parseQueryParameters(_0x1581a6,_0x175997){var _0xf7373=getSqlClauses();return Promise['resolve']()[_0xcd86('0x4a')](function(){return parseModelFields(_0x1581a6,_0x175997);})[_0xcd86('0x4a')](function(_0x45667c){_0xf7373[_0xcd86('0x4b')][_0xcd86('0x41')](_0x45667c);return parseTagParameter(_0x1581a6['tag']);})[_0xcd86('0x4a')](function(_0x3d1833){_0xf7373['tags']['clause']['and'](_0x3d1833);return parseSearchFilter(_0x1581a6[_0xcd86('0x4c')]);})['then'](function(_0x10227b){_0xf7373['filter']=_0x10227b;return _0xf7373;});}function checkListsRestrictions(_0x5edcb9,_0x1197a1,_0x46222f){var _0x38a054=squel[_0xcd86('0x21')]();return Promise[_0xcd86('0x4d')]()[_0xcd86('0x4a')](function(){if(_0x1197a1[_0xcd86('0x6')]&&_0x5edcb9[_0xcd86('0x5')]===_0xcd86('0x4e')&&!_0x46222f){return _0x5edcb9[_0xcd86('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0xcd86('0x4a')](function(_0x4fbc8a){if(_0x4fbc8a){if(_0x4fbc8a[_0xcd86('0x26')]===0x0){_0x38a054[_0xcd86('0x41')](_0xcd86('0x50'));}else{_0x38a054[_0xcd86('0x41')](_0xcd86('0x47'),_['map'](_0x4fbc8a,'id'));}}})['then'](function(){return _0x38a054;});}function buildContactsQuery(_0x19b54c,_0x27dba6,_0x13bcca,_0x6463e6,_0x122b42,_0x594329){if(_0x27dba6){_0x27dba6=_0x13bcca[_0xcd86('0x51')];}_0x19b54c=addFieldsToQuery(_0x19b54c,_0x27dba6,_0x6463e6,_0x594329,!![]);var _0x264b14=squel['select']();_0x264b14=addFieldsToQuery(_0x264b14,_0x27dba6,_0x6463e6,_0x594329,![]);if(_0x6463e6||_0x594329){_0x19b54c=applyJoinClauses(_0x19b54c,!![]);_0x19b54c[_0xcd86('0x52')]('c.id');if(_0x13bcca[_0xcd86('0x53')]){_0x264b14[_0xcd86('0x53')](_0x13bcca[_0xcd86('0x53')]);}if(_0x13bcca[_0xcd86('0x54')]){_0x264b14[_0xcd86('0x54')](_0x13bcca[_0xcd86('0x54')]);}}else{_0x264b14=applyJoinClauses(_0x264b14,![]);_0x264b14[_0xcd86('0x52')](_0xcd86('0x55'));if(_0x13bcca[_0xcd86('0x53')]){_0x19b54c[_0xcd86('0x53')](_0x13bcca[_0xcd86('0x53')]);}if(_0x13bcca[_0xcd86('0x54')]){_0x19b54c[_0xcd86('0x54')](_0x13bcca['offset']);}}_0x264b14['having'](_0x122b42);if(_0x13bcca['order']){_0x13bcca['order']['forEach'](function(_0x2bf824){_0x19b54c['order']('c.'+_0x2bf824[0x0],_0x2bf824[0x1]===_0xcd86('0x56')?![]:!![]);_0x264b14[_0xcd86('0x57')](_0xcd86('0x58')+_0x2bf824[0x0],_0x2bf824[0x1]===_0xcd86('0x56')?![]:!![]);});}_0x264b14[_0xcd86('0xa')](_0x19b54c,_0xcd86('0xe'));return _0x264b14;}function getFilteredContacts(_0x2e3c02){var _0x2f4cb9=[];return db['Tag'][_0xcd86('0x59')]({'attributes':['id','name',_0xcd86('0x5a')],'raw':!![]})[_0xcd86('0x4a')](function(_0x2c7c41){_0x2f4cb9=_[_0xcd86('0x5b')](_0x2c7c41,'id');var _0x5075ef={'type':db[_0xcd86('0x5c')][_0xcd86('0x5d')][_0xcd86('0x5e')],'model':db[_0xcd86('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xcd86('0x60')]['query'](_0x2e3c02['toString'](),_0x5075ef);})[_0xcd86('0x4a')](function(_0x596fec){_0x596fec[_0xcd86('0x1e')](function(_0xf6f0f){if(_0xf6f0f[_0xcd86('0x1b')]){_0xf6f0f[_0xcd86('0x61')]=[];_0xf6f0f['TagIds'][_0xcd86('0x25')](',')[_0xcd86('0x1e')](function(_0x2a4c33){_0xf6f0f[_0xcd86('0x61')]['push'](_0x2f4cb9[_0x2a4c33]);});}delete _0xf6f0f[_0xcd86('0x1b')];});return _0x596fec;});}function countFilteredContacts(_0x22b837,_0x30ec9e){var _0x21d18d=_0x22b837[_0xcd86('0x62')]();_0x21d18d[_0xcd86('0x20')](_0xcd86('0x63'));_0x21d18d=applyJoinClauses(_0x21d18d,!![]);_0x22b837[_0xcd86('0x52')](_0xcd86('0x64'));var _0x39ff74=utils[_0xcd86('0x22')](_0x30ec9e);if(!_[_0xcd86('0x65')](_0x39ff74)){_0x21d18d['where'](_0xcd86('0x66'),_0x39ff74);}var _0x4d176c={'type':db[_0xcd86('0x5c')][_0xcd86('0x5d')]['SELECT'],'raw':!![]};return db[_0xcd86('0x60')][_0xcd86('0x67')](_0x21d18d[_0xcd86('0x68')](),_0x4d176c)[_0xcd86('0x4a')](function(_0x16393b){return _0x16393b[0x0][_0xcd86('0x63')];});}module[_0xcd86('0x69')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xa755=['split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','fieldType','datetime','castTo','buildExpression','type','default','text','value','start','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','tag','filter','search','c.ListId\x20IN\x20?','select','group','c.id','limit','offset','having','order','color','QueryTypes','SELECT','CmContact','sequelize','query','Tags','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','autocomplete','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','.id','ct.CmContactId\x20=\x20','tools_tags','firstName','mobile','fax','email','CompanyId','createdAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace'];(function(_0xac6c1c,_0x33804f){var _0x586dfd=function(_0x2474fd){while(--_0x2474fd){_0xac6c1c['push'](_0xac6c1c['shift']());}};_0x586dfd(++_0x33804f);}(_0xa755,0xfd));var _0x5a75=function(_0x37407b,_0x9f637e){_0x37407b=_0x37407b-0x0;var _0x15d65f=_0xa755[_0x37407b];return _0x15d65f;};'use strict';var _=require('lodash');var squel=require(_0x5a75('0x0'));var as=require(_0x5a75('0x1'));var qs=require(_0x5a75('0x2'));var utils=require('../interaction/utils');var db=require(_0x5a75('0x3'))['db'];function skipContactsQuery(_0x364e1a,_0xe0b771){var _0x44027b=![];if(_0x364e1a[_0x5a75('0x4')]===_0x5a75('0x5')&&!_0xe0b771['search']&&!_0xe0b771['ListId']&&_0xe0b771[_0x5a75('0x6')]!=='true'){_0x44027b=!![];}return _0x44027b;}function getContactsSubquery(){return squel['select']()[_0x5a75('0x7')](_0x5a75('0x8'),'c')['where'](_0x5a75('0x9'));}function applyJoinClauses(_0xa1909a,_0x4a7ede){var _0xf9e5c4=_0x4a7ede?'c':_0x5a75('0xa');_0xa1909a[_0x5a75('0xb')]('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0xf9e5c4+_0x5a75('0xc'))[_0x5a75('0xb')]('cm_contact_has_tags','ct',_0x5a75('0xd')+_0xf9e5c4+_0x5a75('0xc'))[_0x5a75('0xb')](_0x5a75('0xe'),'t','t.id\x20=\x20ct.TagId');return _0xa1909a;}function addFieldsToQuery(_0x1d33d5,_0x2a46de,_0xfc8158,_0x4f46cf,_0x2365e3){var _0x3fe4db=_0x2365e3?'c':_0x5a75('0xa');if(!_0x2a46de){_0x2a46de=['id',_0x5a75('0xf'),'lastName','phone',_0x5a75('0x10'),_0x5a75('0x11'),_0x5a75('0x12'),'ListId',_0x5a75('0x13'),_0x5a75('0x14'),'updatedAt',_0x5a75('0x15'),_0x5a75('0x16')];}else if(!_0x2a46de[_0x5a75('0x17')]('id')){_0x2a46de[_0x5a75('0x18')]('id');}var _0x44fe09=_0xfc8158&&_0x2365e3||!_0xfc8158&&!_0x2365e3;if(_0x4f46cf){_0x44fe09=_0x4f46cf&&_0x2365e3||!_0x4f46cf&&!_0x2365e3;}_0x2a46de[_0x5a75('0x19')](function(_0x784783){if(_0x784783===_0x5a75('0x16')){if(_0x44fe09){_0x1d33d5[_0x5a75('0x1a')](_0x5a75('0x1b'),_0x784783);}else if(_0xfc8158||_0x4f46cf){_0x1d33d5[_0x5a75('0x1a')](_0x3fe4db+'.'+_0x784783);}}else{_0x1d33d5[_0x5a75('0x1a')](_0x3fe4db+'.'+_0x784783);}});return _0x1d33d5;}function getSqlClauses(){var _0x136ed6={'default':squel[_0x5a75('0x1c')](),'fields':squel[_0x5a75('0x1c')](),'filter':squel[_0x5a75('0x1c')](),'tags':{'clause':squel[_0x5a75('0x1c')](),'ids':null},'user':{'clause':squel[_0x5a75('0x1c')](),'skip':![]}};return _0x136ed6;}function parseTagParameter(_0x1f6410){var _0x528dfd=squel['expr']();if(_0x1f6410){var _0x10bd91=utils[_0x5a75('0x1d')](_0x1f6410);_0x10bd91[_0x5a75('0x19')](function(_0x16e5a5){_0x528dfd['or'](_0x5a75('0x1e'),'%,'+_0x16e5a5+',%');});}return _0x528dfd;}function parseSearchFilter(_0x661a7d){var _0x5bef3b=squel[_0x5a75('0x1c')]();if(_0x661a7d){var _0x40a527=_0x661a7d[_0x5a75('0x1f')]('\x5c','\x5c\x5c')[_0x5a75('0x1f')](/'/g,'\x27\x27');if(_0x40a527[_0x5a75('0x20')]('\x20')['length']>0x1){_0x5bef3b['or'](_0x5a75('0x21'),qs['getFullTextValue'](_0x40a527),null);}else{if(qs['isNumeric'](_0x40a527)){_0x5bef3b['or'](_0x5a75('0x22'),_0x40a527+'%');_0x5bef3b['or'](_0x5a75('0x23'),_0x40a527+'%');_0x5bef3b['or']('c.mobile\x20LIKE\x20?',_0x40a527+'%');_0x5bef3b['or']('c.fax\x20LIKE\x20?',_0x40a527+'%');}else if(qs['isEmail'](_0x40a527)){_0x5bef3b['or'](_0x5a75('0x24'),_0x40a527+'%');}else{_0x5bef3b['or'](_0x5a75('0x25'),'%'+_0x40a527+'%');_0x5bef3b['or'](_0x5a75('0x26'),'%'+_0x40a527+'%');_0x5bef3b['or'](_0x5a75('0x24'),'%'+_0x40a527+'%');}}}return _0x5bef3b;}function parseAdvancedSearchFilter(_0x592b36,_0x5de20b){var _0x4d21a9=getSqlClauses();var _0x57b6cf=as[_0x5a75('0x27')](_0x592b36);var _0x46e90c=_0x57b6cf[_0x5a75('0x28')];for(var _0x5d18c3=0x0;_0x5d18c3<_0x57b6cf[_0x5a75('0x29')][_0x5a75('0x2a')];_0x5d18c3++){var _0x3c9faa=_0x57b6cf[_0x5a75('0x29')][_0x5d18c3];var _0x2d6efe='c';var _0x2fad7c=_[_0x5a75('0x2b')](_0x5de20b,[_0x5a75('0x2c'),_0x3c9faa[_0x5a75('0x1a')]]);if(_0x2fad7c){if(_0x3c9faa[_0x5a75('0x1a')]==='dateOfBirth'||_0x2fad7c[_0x5a75('0x2d')]===_0x5a75('0x2e')){_0x3c9faa[_0x5a75('0x2f')]='DATE';}var _0x5abb89=as[_0x5a75('0x30')](_0x2d6efe,_0x2fad7c[_0x5a75('0x31')],_0x3c9faa);_0x4d21a9[_0x5a75('0x32')][_0x46e90c](_0x5abb89[_0x5a75('0x33')],_0x5abb89[_0x5a75('0x34')][_0x5a75('0x35')],_0x5abb89[_0x5a75('0x34')]['end']);}else{if(_0x3c9faa['field']===_0x5a75('0x36')){var _0xae85e4=_0x3c9faa['value'][_0x5a75('0x20')](',')[_0x5a75('0x37')](function(_0x52e805){return Number(_0x52e805);});var _0x82f612=parseTagParameter(_0xae85e4);_0x4d21a9[_0x5a75('0x38')][_0x5a75('0x39')][_0x5a75('0x3a')](_0x82f612);_0x4d21a9[_0x5a75('0x38')][_0x5a75('0x3b')]=_0xae85e4;}else if(_0x3c9faa[_0x5a75('0x1a')]===_0x5a75('0x3c')){_0x4d21a9[_0x5a75('0x3d')][_0x5a75('0x39')]['and'](_0x5a75('0x3e'),_0x3c9faa[_0x5a75('0x34')]);_0x4d21a9[_0x5a75('0x3d')][_0x5a75('0x3f')]=!![];}}}return _0x4d21a9;}function parseModelFields(_0x99a4ff,_0x53e349){var _0x3c0a87=squel['expr']();var _0x5e3ce0=_(_0x99a4ff)[_0x5a75('0x40')]()[_0x5a75('0x37')](function(_0x484fcc){return _[_0x5a75('0x41')](_0x53e349,[_0x5a75('0x2c'),_0x484fcc])?_0x484fcc:undefined;})['compact']()['value']();if(_0x99a4ff[_0x5a75('0x42')]){_0x5e3ce0[_0x5a75('0x18')](_0x5a75('0x42'));}if(_0x5e3ce0[_0x5a75('0x2a')]>0x0){_0x5e3ce0[_0x5a75('0x19')](function(_0x24bc91){if(_0x24bc91===_0x5a75('0x43')){_0x3c0a87['and']('c.ListId\x20IN\x20?',[][_0x5a75('0x44')](_0x99a4ff[_0x24bc91]));}else if(_0x24bc91===_0x5a75('0x42')){var _0x2172cc='%'+_0x99a4ff[_0x24bc91]+'%';_0x3c0a87[_0x5a75('0x3a')](_0x5a75('0x45'),_0x2172cc);}else{_0x3c0a87['and']('c.'+_0x24bc91+'\x20=\x20?',_0x99a4ff[_0x24bc91]);}});}return _0x3c0a87;}function parseQueryParameters(_0x4ab624,_0x1134a7){var _0x596bc0=getSqlClauses();return Promise[_0x5a75('0x46')]()[_0x5a75('0x47')](function(){return parseModelFields(_0x4ab624,_0x1134a7);})[_0x5a75('0x47')](function(_0x1f5199){_0x596bc0['fields'][_0x5a75('0x3a')](_0x1f5199);return parseTagParameter(_0x4ab624[_0x5a75('0x48')]);})[_0x5a75('0x47')](function(_0x3080c3){_0x596bc0[_0x5a75('0x38')]['clause']['and'](_0x3080c3);return parseSearchFilter(_0x4ab624[_0x5a75('0x49')]);})[_0x5a75('0x47')](function(_0x3ea46d){_0x596bc0['filter']=_0x3ea46d;return _0x596bc0;});}function checkListsRestrictions(_0x4fcd4a,_0x43906e,_0xa8ac68){var _0x4eaa4f=squel[_0x5a75('0x1c')]();return Promise[_0x5a75('0x46')]()[_0x5a75('0x47')](function(){if(_0x43906e[_0x5a75('0x4a')]&&_0x4fcd4a[_0x5a75('0x4')]==='agent'&&!_0xa8ac68){return _0x4fcd4a['getLists']({'attributes':['id'],'raw':!![]});}})[_0x5a75('0x47')](function(_0x48d0ee){if(_0x48d0ee){if(_0x48d0ee[_0x5a75('0x2a')]===0x0){_0x4eaa4f[_0x5a75('0x3a')]('c.ListId\x20IS\x20NULL');}else{_0x4eaa4f['and'](_0x5a75('0x4b'),_[_0x5a75('0x37')](_0x48d0ee,'id'));}}})[_0x5a75('0x47')](function(){return _0x4eaa4f;});}function buildContactsQuery(_0x31702a,_0x5a8c68,_0x44978e,_0x260830,_0x371fed,_0x3756a3){if(_0x5a8c68){_0x5a8c68=_0x44978e['attributes'];}_0x31702a=addFieldsToQuery(_0x31702a,_0x5a8c68,_0x260830,_0x3756a3,!![]);var _0x4a4a76=squel[_0x5a75('0x4c')]();_0x4a4a76=addFieldsToQuery(_0x4a4a76,_0x5a8c68,_0x260830,_0x3756a3,![]);if(_0x260830||_0x3756a3){_0x31702a=applyJoinClauses(_0x31702a,!![]);_0x31702a[_0x5a75('0x4d')](_0x5a75('0x4e'));if(_0x44978e['limit']){_0x4a4a76[_0x5a75('0x4f')](_0x44978e['limit']);}if(_0x44978e[_0x5a75('0x50')]){_0x4a4a76[_0x5a75('0x50')](_0x44978e[_0x5a75('0x50')]);}}else{_0x4a4a76=applyJoinClauses(_0x4a4a76,![]);_0x4a4a76[_0x5a75('0x4d')]('subqry.id');if(_0x44978e[_0x5a75('0x4f')]){_0x31702a['limit'](_0x44978e['limit']);}if(_0x44978e[_0x5a75('0x50')]){_0x31702a[_0x5a75('0x50')](_0x44978e[_0x5a75('0x50')]);}}_0x4a4a76[_0x5a75('0x51')](_0x371fed);if(_0x44978e['order']){_0x44978e['order'][_0x5a75('0x19')](function(_0xdb7f41){_0x31702a['order']('c.'+_0xdb7f41[0x0],_0xdb7f41[0x1]==='DESC'?![]:!![]);_0x4a4a76[_0x5a75('0x52')]('subqry.'+_0xdb7f41[0x0],_0xdb7f41[0x1]==='DESC'?![]:!![]);});}_0x4a4a76['from'](_0x31702a,_0x5a75('0xa'));return _0x4a4a76;}function getFilteredContacts(_0x4dd7b6){var _0x4469d7=[];return db[_0x5a75('0x36')]['findAll']({'attributes':['id',_0x5a75('0x2c'),_0x5a75('0x53')],'raw':!![]})[_0x5a75('0x47')](function(_0x32d751){_0x4469d7=_['keyBy'](_0x32d751,'id');var _0x58b58e={'type':db['Sequelize'][_0x5a75('0x54')][_0x5a75('0x55')],'model':db[_0x5a75('0x56')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x5a75('0x57')][_0x5a75('0x58')](_0x4dd7b6['toString'](),_0x58b58e);})[_0x5a75('0x47')](function(_0x4cf6c8){_0x4cf6c8['forEach'](function(_0x16f180){if(_0x16f180[_0x5a75('0x16')]){_0x16f180[_0x5a75('0x59')]=[];_0x16f180['TagIds']['split'](',')[_0x5a75('0x19')](function(_0x21ff72){_0x16f180[_0x5a75('0x59')][_0x5a75('0x18')](_0x4469d7[_0x21ff72]);});}delete _0x16f180[_0x5a75('0x16')];});return _0x4cf6c8;});}function countFilteredContacts(_0x424724,_0x54af8f){var _0x5bd220=_0x424724['clone']();_0x5bd220['field'](_0x5a75('0x5a'));_0x5bd220=applyJoinClauses(_0x5bd220,!![]);_0x424724['group'](_0x5a75('0x4e'));var _0xf354d8=utils[_0x5a75('0x1d')](_0x54af8f);if(!_[_0x5a75('0x5b')](_0xf354d8)){_0x5bd220['where'](_0x5a75('0x5c'),_0xf354d8);}var _0x313e48={'type':db[_0x5a75('0x5d')][_0x5a75('0x54')][_0x5a75('0x55')],'raw':!![]};return db[_0x5a75('0x57')][_0x5a75('0x58')](_0x5bd220['toString'](),_0x313e48)[_0x5a75('0x47')](function(_0x35de1f){return _0x35de1f[0x0][_0x5a75('0x5a')];});}module[_0x5a75('0x5e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 8956c8e..b650278 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 _0xe2e0=['binary','final','secret','createCipher','utf8','base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','data','update','end','write','close','unlink','decryptFile','createReadStream'];(function(_0x5d9b2e,_0x25ce00){var _0x59a14c=function(_0x5c365f){while(--_0x5c365f){_0x5d9b2e['push'](_0x5d9b2e['shift']());}};_0x59a14c(++_0x25ce00);}(_0xe2e0,0x166));var _0x0e2e=function(_0x5bc3fc,_0x54db61){_0x5bc3fc=_0x5bc3fc-0x0;var _0x1253d0=_0xe2e0[_0x5bc3fc];return _0x1253d0;};'use strict';var crypto=require(_0x0e2e('0x0'));var fs=require('fs');var BPromise=require(_0x0e2e('0x1'));var _=require(_0x0e2e('0x2'));var config=require(_0x0e2e('0x3'));var logger=require(_0x0e2e('0x4'))(_0x0e2e('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0e2e('0x6')][_0x0e2e('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x0e2e('0x8')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x0e2e('0x9')]);if(isSupported){fileOptions[_0x0e2e('0x9')]=config[_0x0e2e('0x8')][_0x0e2e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0e2e('0xa')](',\x20');logger[_0x0e2e('0xb')](config['encrypt']['algorithm'],_0x0e2e('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x5d35ed){return AES_SUPPORTED_RX[_0x0e2e('0xd')](_0x5d35ed);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0e2e('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x38e73c){return getSupportedCiphers()[_0x0e2e('0xf')](_0x38e73c)>-0x1;}function combineOptions(_0x1921d1){var _0x387c93={};for(var _0x196fb0 in fileOptions){if(fileOptions[_0x0e2e('0x10')](_0x196fb0)){_0x387c93[_0x196fb0]=fileOptions[_0x196fb0];}}if(_0x1921d1){for(var _0x33e545 in _0x1921d1){if(_0x1921d1[_0x0e2e('0x10')](_0x33e545)){_0x387c93[_0x33e545]=_0x1921d1[_0x33e545];}}}return _0x387c93;}exports[_0x0e2e('0x11')]=function(_0x5b9b19,_0x3d299c,_0x37febe,_0x35943e){return new BPromise(function(_0x5bbacf,_0x37d5fd){_0x35943e=combineOptions(_0x35943e);var _0x1aa067=new Buffer(_0x37febe);var _0x3b69e0=fs['createReadStream'](_0x5b9b19);var _0x3b7313=fs[_0x0e2e('0x12')](_0x3d299c);var _0x457a82=crypto['createCipher'](_0x35943e[_0x0e2e('0x9')],_0x1aa067);_0x3b69e0['on'](_0x0e2e('0x13'),function(_0x2ca2d3){var _0x44be5c=new Buffer(_0x457a82[_0x0e2e('0x14')](_0x2ca2d3),'binary');_0x3b7313['write'](_0x44be5c);});_0x3b69e0['on'](_0x0e2e('0x15'),function(){try{var _0x302664=new Buffer(_0x457a82['final']('binary'),'binary');_0x3b7313[_0x0e2e('0x16')](_0x302664);_0x3b7313[_0x0e2e('0x15')]();_0x3b7313['on'](_0x0e2e('0x17'),function(){return _0x5bbacf(_0x3d299c);});}catch(_0x1cf7ef){fs[_0x0e2e('0x18')](_0x3d299c);return _0x37d5fd(_0x1cf7ef);}});});};exports[_0x0e2e('0x19')]=function(_0x24b9b0,_0x4c0a09,_0x1ae857,_0x53ec69){return new BPromise(function(_0x909b5d,_0x517cb0){_0x53ec69=combineOptions(_0x53ec69);var _0x351fdb=new Buffer(_0x1ae857);var _0x206764=fs[_0x0e2e('0x1a')](_0x24b9b0);var _0x79b713=fs['createWriteStream'](_0x4c0a09);var _0x3b80c4=crypto['createDecipher'](_0x53ec69[_0x0e2e('0x9')],_0x351fdb);_0x206764['on'](_0x0e2e('0x13'),function(_0x230955){var _0x4d9bd9=new Buffer(_0x3b80c4[_0x0e2e('0x14')](_0x230955),_0x0e2e('0x1b'));_0x79b713[_0x0e2e('0x16')](_0x4d9bd9);});_0x206764['on'](_0x0e2e('0x15'),function(){try{var _0x3c2847=new Buffer(_0x3b80c4[_0x0e2e('0x1c')]('binary'),_0x0e2e('0x1b'));_0x79b713[_0x0e2e('0x16')](_0x3c2847);_0x79b713[_0x0e2e('0x15')]();_0x79b713['on']('close',function(){return _0x909b5d(_0x4c0a09);});}catch(_0x1c7ad3){fs['unlink'](_0x4c0a09);return _0x517cb0(_0x1c7ad3);}});});};exports['encryptString']=function(_0x2dede0,_0x1b0b8b,_0x9dbf2){var _0xd18d6c=_0x9dbf2||stringOptions[_0x0e2e('0x9')];var _0x496764=_0x1b0b8b||stringOptions[_0x0e2e('0x1d')];var _0x3324fa=crypto[_0x0e2e('0x1e')](_0xd18d6c,_0x496764);var _0x2078ab=_0x3324fa[_0x0e2e('0x14')](_0x2dede0,_0x0e2e('0x1f'),_0x0e2e('0x20'));_0x2078ab+=_0x3324fa['final']('base64');return _0x2078ab;};exports[_0x0e2e('0x21')]=function(_0xa4108e,_0x4faa96,_0x406926){var _0xf39380=_0x406926||stringOptions[_0x0e2e('0x9')];var _0x3f6632=_0x4faa96||stringOptions[_0x0e2e('0x1d')];var _0x350862=crypto[_0x0e2e('0x22')](_0xf39380,_0x3f6632);var _0x4cee54=_0x350862['update'](_0xa4108e,_0x0e2e('0x20'),_0x0e2e('0x1f'));_0x4cee54+=_0x350862[_0x0e2e('0x1c')](_0x0e2e('0x1f'));return _0x4cee54;}; \ No newline at end of file +var _0x638b=['bluebird','lodash','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','end','final','close','secret','update','utf8','base64','decryptString','createDecipher','crypto'];(function(_0x1fd9d8,_0x3eee6e){var _0x48d050=function(_0x4a42e3){while(--_0x4a42e3){_0x1fd9d8['push'](_0x1fd9d8['shift']());}};_0x48d050(++_0x3eee6e);}(_0x638b,0x192));var _0xb638=function(_0x436f2c,_0x36ade1){_0x436f2c=_0x436f2c-0x0;var _0x5d6cb2=_0x638b[_0x436f2c];return _0x5d6cb2;};'use strict';var crypto=require(_0xb638('0x0'));var fs=require('fs');var BPromise=require(_0xb638('0x1'));var _=require(_0xb638('0x2'));var config=require(_0xb638('0x3'));var logger=require(_0xb638('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb638('0x5')][_0xb638('0x6')],'algorithm':_0xb638('0x7')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0xb638('0x8')][_0xb638('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0xb638('0x9')]=config[_0xb638('0x8')][_0xb638('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt']['algorithm'],_0xb638('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x58305a){return AES_SUPPORTED_RX[_0xb638('0xb')](_0x58305a);}function getSupportedCiphers(){return crypto[_0xb638('0xc')]()[_0xb638('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x54ecaa){return getSupportedCiphers()[_0xb638('0xe')](_0x54ecaa)>-0x1;}function combineOptions(_0x149462){var _0x4cdae1={};for(var _0x5673e8 in fileOptions){if(fileOptions[_0xb638('0xf')](_0x5673e8)){_0x4cdae1[_0x5673e8]=fileOptions[_0x5673e8];}}if(_0x149462){for(var _0x117760 in _0x149462){if(_0x149462[_0xb638('0xf')](_0x117760)){_0x4cdae1[_0x117760]=_0x149462[_0x117760];}}}return _0x4cdae1;}exports[_0xb638('0x10')]=function(_0x5a5cde,_0x2946b2,_0x4c79ce,_0x494a50){return new BPromise(function(_0x5e1a05,_0x1e6af8){_0x494a50=combineOptions(_0x494a50);var _0x382426=new Buffer(_0x4c79ce);var _0x3a4afc=fs[_0xb638('0x11')](_0x5a5cde);var _0x21f5c4=fs['createWriteStream'](_0x2946b2);var _0x5184f6=crypto[_0xb638('0x12')](_0x494a50[_0xb638('0x9')],_0x382426);_0x3a4afc['on'](_0xb638('0x13'),function(_0x163235){var _0x5ae969=new Buffer(_0x5184f6['update'](_0x163235),_0xb638('0x14'));_0x21f5c4[_0xb638('0x15')](_0x5ae969);});_0x3a4afc['on'](_0xb638('0x16'),function(){try{var _0x5814cf=new Buffer(_0x5184f6[_0xb638('0x17')](_0xb638('0x14')),_0xb638('0x14'));_0x21f5c4[_0xb638('0x15')](_0x5814cf);_0x21f5c4[_0xb638('0x16')]();_0x21f5c4['on'](_0xb638('0x18'),function(){return _0x5e1a05(_0x2946b2);});}catch(_0x20fbb7){fs['unlink'](_0x2946b2);return _0x1e6af8(_0x20fbb7);}});});};exports['decryptFile']=function(_0x1a3b29,_0x3b9bfd,_0x5aabed,_0x34e162){return new BPromise(function(_0xa183b4,_0x1dad69){_0x34e162=combineOptions(_0x34e162);var _0x39dea6=new Buffer(_0x5aabed);var _0x6ab966=fs['createReadStream'](_0x1a3b29);var _0x5e7eda=fs['createWriteStream'](_0x3b9bfd);var _0x34c3c3=crypto['createDecipher'](_0x34e162['algorithm'],_0x39dea6);_0x6ab966['on']('data',function(_0x3f06f4){var _0x30502d=new Buffer(_0x34c3c3['update'](_0x3f06f4),'binary');_0x5e7eda['write'](_0x30502d);});_0x6ab966['on']('end',function(){try{var _0x753902=new Buffer(_0x34c3c3['final'](_0xb638('0x14')),_0xb638('0x14'));_0x5e7eda[_0xb638('0x15')](_0x753902);_0x5e7eda[_0xb638('0x16')]();_0x5e7eda['on']('close',function(){return _0xa183b4(_0x3b9bfd);});}catch(_0x344e19){fs['unlink'](_0x3b9bfd);return _0x1dad69(_0x344e19);}});});};exports['encryptString']=function(_0x1d5637,_0x378031,_0x1ff740){var _0x1d28cd=_0x1ff740||stringOptions[_0xb638('0x9')];var _0x5b2bf7=_0x378031||stringOptions[_0xb638('0x19')];var _0x3877d9=crypto[_0xb638('0x12')](_0x1d28cd,_0x5b2bf7);var _0x449c39=_0x3877d9[_0xb638('0x1a')](_0x1d5637,_0xb638('0x1b'),'base64');_0x449c39+=_0x3877d9['final'](_0xb638('0x1c'));return _0x449c39;};exports[_0xb638('0x1d')]=function(_0x4df3c2,_0x57292c,_0x439faf){var _0x342151=_0x439faf||stringOptions[_0xb638('0x9')];var _0x1a93ab=_0x57292c||stringOptions[_0xb638('0x19')];var _0x209044=crypto[_0xb638('0x1e')](_0x342151,_0x1a93ab);var _0x233af0=_0x209044[_0xb638('0x1a')](_0x4df3c2,'base64','utf8');_0x233af0+=_0x209044[_0xb638('0x17')](_0xb638('0x1b'));return _0x233af0;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c4255f7..70d6f3b 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 _0x49f4=['zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','query','sequelize','QueryTypes','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x49f4,0x177));var _0x449f=function(_0x11aee5,_0x27fa94){_0x11aee5=_0x11aee5-0x0;var _0x2e8c9d=_0x49f4[_0x11aee5];return _0x2e8c9d;};'use strict';var util=require(_0x449f('0x0'));var path=require(_0x449f('0x1'));var _=require(_0x449f('0x2'));var csv=require(_0x449f('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x449f('0x4'));var rimraf=require(_0x449f('0x5'));var db=require(_0x449f('0x6'))['db'];var dbH=require(_0x449f('0x6'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d7140,_0x11d2d6){var _0x35f15f={'status':_0x4d7140};var _0x145df1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x11d2d6){_0x35f15f[_0x449f('0x7')]=_0x11d2d6;}return db[_0x449f('0x8')][_0x449f('0x9')](_0x35f15f,_0x145df1);}function main(){var _0xc12551=0x1388;var _0x4f9219;logger[_0x449f('0xa')](util[_0x449f('0xb')](_0x449f('0xc'),EXTRACTED_REPORT_ID,_0x449f('0xd')));return db[_0x449f('0xe')][_0x449f('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x449f('0x10'),'splitSizeCsv']})[_0x449f('0x11')](function(_0x517792){if(_0x517792){_0x4f9219=_0x517792;_0xc12551=_0x4f9219[_0x449f('0x12')]||0x1388;}})[_0x449f('0x11')](function(){return dbH['sequelize'][_0x449f('0x13')](util[_0x449f('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')]['SELECT']});})[_0x449f('0x11')](function(_0x3d74ab){if(!_0x3d74ab[0x0][_0x449f('0x16')]){return analyticExtractedReport('Empty');}var _0x1a8a7c=[];var _0x1294f6=0x0;if(_0x4f9219[_0x449f('0x10')]){if(_0x3d74ab&&_0x3d74ab[_0x449f('0x17')]){var _0xf61f01=_[_0x449f('0x18')](_0x3d74ab[0x0][_0x449f('0x16')]/_0xc12551);var _0x1c8e02=Number[_0x449f('0x19')](_0x3d74ab[0x0][_0x449f('0x16')]/_0xc12551)?_0x3d74ab[0x0]['num']%_0xc12551:0x0;_0xf61f01[_0x449f('0x1a')](function(_0x3afffc){if(_0x3afffc>0x0){_0x1294f6+=_0xc12551;}_0x1a8a7c[_0x449f('0x1b')](dbH[_0x449f('0x14')][_0x449f('0x13')](util[_0x449f('0xb')](_0x449f('0x1c'),QUERY,_0xc12551,_0x1294f6),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')][_0x449f('0x1d')]}));});if(_0x1c8e02>0x0){_0x1294f6+=_0xc12551;_0x1a8a7c[_0x449f('0x1b')](dbH[_0x449f('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c8e02,_0x1294f6),{'type':dbH[_0x449f('0x14')][_0x449f('0x15')]['SELECT']}));}}}else{_0x1a8a7c['push'](dbH[_0x449f('0x14')][_0x449f('0x13')](QUERY,{'type':dbH[_0x449f('0x14')][_0x449f('0x15')][_0x449f('0x1d')]}));}var _0xecc74b=path[_0x449f('0x1e')](PATH);var _0xc85ef8=path[_0x449f('0x1f')](PATH,_0x449f('0x20'));var _0xfa87e9=_0x4f9219['split']&&_0x1a8a7c[_0x449f('0x17')]>0x1;var _0x42f518=[];if(!fs['existsSync'](path[_0x449f('0x21')](_0xecc74b,_0xc85ef8))&&_0xfa87e9){fs[_0x449f('0x22')](path[_0x449f('0x21')](_0xecc74b,_0xc85ef8));}return BPromise[_0x449f('0x23')](_0x1a8a7c,function(_0x4e4028){_0x42f518[_0x449f('0x1b')](_0x4e4028);})[_0x449f('0x11')](function(){for(var _0x18cfb6=0x0;_0x18cfb6<_0x42f518[_0x449f('0x17')];_0x18cfb6+=0x1){var _0x2052a4;var _0x4da86a=_0x42f518[_0x18cfb6];if(_0xfa87e9){_0x2052a4=path['join'](_0xecc74b,_0xc85ef8,util['format'](_0x449f('0x24'),_0xc85ef8,_0x18cfb6,_0x449f('0x25')));}else{_0x2052a4=path[_0x449f('0x21')](_0xecc74b,util[_0x449f('0xb')](_0x449f('0x26'),_0xc85ef8,_0x449f('0x25')));}fs['writeFileSync'](_0x2052a4,csv(_0x4da86a));}})['then'](function(){if(_0xfa87e9){return new Promise(function(_0x577fa0){zipdir(path[_0x449f('0x21')](_0xecc74b,_0xc85ef8),{'saveTo':path[_0x449f('0x21')](_0xecc74b,util[_0x449f('0xb')](_0x449f('0x26'),_0xc85ef8,_0x449f('0x27')))},function(_0x404687,_0x372ed2){rimraf(path[_0x449f('0x21')](_0xecc74b,_0xc85ef8),function(){});_0x577fa0(_0x449f('0x28'));});});}})[_0x449f('0x11')](function(){logger[_0x449f('0xa')](util[_0x449f('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x449f('0x29'),_0xfa87e9?util['format']('%s.%s',_0xc85ef8,_0xfa87e9?_0x449f('0x27'):'csv'):null);});})[_0x449f('0x2a')](function(_0x2dbf52){logger['info'](util[_0x449f('0xb')](_0x449f('0x2b'),EXTRACTED_REPORT_ID,_0x449f('0xd')),util[_0x449f('0x2c')](_0x2dbf52,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x449f('0x2d'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x75f4=['csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','join','each','%s%d.%s'];(function(_0x555258,_0x2a8eda){var _0x2b8872=function(_0x214dea){while(--_0x214dea){_0x555258['push'](_0x555258['shift']());}};_0x2b8872(++_0x2a8eda);}(_0x75f4,0xd4));var _0x475f=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x75f4[_0x2675da];return _0x5e6153;};'use strict';var util=require(_0x475f('0x0'));var path=require(_0x475f('0x1'));var _=require(_0x475f('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x475f('0x3'));var zipdir=require(_0x475f('0x4'));var rimraf=require('rimraf');var db=require(_0x475f('0x5'))['db'];var dbH=require(_0x475f('0x5'))[_0x475f('0x6')];var logger=require(_0x475f('0x7'))(_0x475f('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x475f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5966e3,_0xfb0afa){var _0x5ecb4c={'status':_0x5966e3};var _0x4431c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xfb0afa){_0x5ecb4c[_0x475f('0xa')]=_0xfb0afa;}return db[_0x475f('0xb')][_0x475f('0xc')](_0x5ecb4c,_0x4431c9);}function main(){var _0x5ef16a=0x1388;var _0xf35c26;logger['info'](util['format'](_0x475f('0xd'),EXTRACTED_REPORT_ID,_0x475f('0xe')));return db[_0x475f('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x475f('0x10'),_0x475f('0x11')]})[_0x475f('0x12')](function(_0x5032e7){if(_0x5032e7){_0xf35c26=_0x5032e7;_0x5ef16a=_0xf35c26[_0x475f('0x11')]||0x1388;}})['then'](function(){return dbH[_0x475f('0x13')][_0x475f('0x14')](util[_0x475f('0x15')](_0x475f('0x16'),QUERY),{'type':dbH[_0x475f('0x13')][_0x475f('0x17')][_0x475f('0x18')]});})[_0x475f('0x12')](function(_0x3385a3){if(!_0x3385a3[0x0][_0x475f('0x19')]){return analyticExtractedReport(_0x475f('0x1a'));}var _0x3f8917=[];var _0x580158=0x0;if(_0xf35c26[_0x475f('0x10')]){if(_0x3385a3&&_0x3385a3['length']){var _0xeba75f=_['range'](_0x3385a3[0x0][_0x475f('0x19')]/_0x5ef16a);var _0x219594=Number[_0x475f('0x1b')](_0x3385a3[0x0]['num']/_0x5ef16a)?_0x3385a3[0x0][_0x475f('0x19')]%_0x5ef16a:0x0;_0xeba75f[_0x475f('0x1c')](function(_0x4ae890){if(_0x4ae890>0x0){_0x580158+=_0x5ef16a;}_0x3f8917[_0x475f('0x1d')](dbH[_0x475f('0x13')]['query'](util[_0x475f('0x15')](_0x475f('0x1e'),QUERY,_0x5ef16a,_0x580158),{'type':dbH[_0x475f('0x13')]['QueryTypes'][_0x475f('0x18')]}));});if(_0x219594>0x0){_0x580158+=_0x5ef16a;_0x3f8917[_0x475f('0x1d')](dbH[_0x475f('0x13')][_0x475f('0x14')](util['format'](_0x475f('0x1e'),QUERY,_0x219594,_0x580158),{'type':dbH[_0x475f('0x13')][_0x475f('0x17')][_0x475f('0x18')]}));}}}else{_0x3f8917[_0x475f('0x1d')](dbH[_0x475f('0x13')][_0x475f('0x14')](QUERY,{'type':dbH[_0x475f('0x13')][_0x475f('0x17')][_0x475f('0x18')]}));}var _0x1a1f08=path[_0x475f('0x1f')](PATH);var _0x3c9cac=path[_0x475f('0x20')](PATH,'.csv');var _0x594afd=_0xf35c26[_0x475f('0x10')]&&_0x3f8917[_0x475f('0x21')]>0x1;var _0x6d2115=[];if(!fs[_0x475f('0x22')](path[_0x475f('0x23')](_0x1a1f08,_0x3c9cac))&&_0x594afd){fs['mkdirSync'](path['join'](_0x1a1f08,_0x3c9cac));}return BPromise[_0x475f('0x24')](_0x3f8917,function(_0x20205b){_0x6d2115[_0x475f('0x1d')](_0x20205b);})[_0x475f('0x12')](function(){for(var _0x37b863=0x0;_0x37b863<_0x6d2115[_0x475f('0x21')];_0x37b863+=0x1){var _0x2fb0ae;var _0x4baee8=_0x6d2115[_0x37b863];if(_0x594afd){_0x2fb0ae=path[_0x475f('0x23')](_0x1a1f08,_0x3c9cac,util[_0x475f('0x15')](_0x475f('0x25'),_0x3c9cac,_0x37b863,_0x475f('0x26')));}else{_0x2fb0ae=path[_0x475f('0x23')](_0x1a1f08,util[_0x475f('0x15')](_0x475f('0x27'),_0x3c9cac,'csv'));}fs[_0x475f('0x28')](_0x2fb0ae,csv(_0x4baee8));}})['then'](function(){if(_0x594afd){return new Promise(function(_0x4cc098){zipdir(path[_0x475f('0x23')](_0x1a1f08,_0x3c9cac),{'saveTo':path['join'](_0x1a1f08,util['format'](_0x475f('0x27'),_0x3c9cac,_0x475f('0x29')))},function(_0x3a0976,_0x4f2184){rimraf(path['join'](_0x1a1f08,_0x3c9cac),function(){});_0x4cc098('zip\x20finished');});});}})['then'](function(){logger['info'](util['format'](_0x475f('0x2a'),EXTRACTED_REPORT_ID,_0x475f('0xe')));return analyticExtractedReport(_0x475f('0x2b'),_0x594afd?util[_0x475f('0x15')](_0x475f('0x27'),_0x3c9cac,_0x594afd?'zip':'csv'):null);});})[_0x475f('0x2c')](function(_0x29d724){logger[_0x475f('0x2d')](util['format'](_0x475f('0x2e'),EXTRACTED_REPORT_ID,_0x475f('0xe')),util[_0x475f('0x2f')](_0x29d724,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x475f('0x30'));})['finally'](function(){process[_0x475f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0a1aa73..d2f248d 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 _0x9f9a=['Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','end','util','moment','html-to-pdfmake','zip-dir','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','before','margin','toString','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','center'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9f9a,0xb3));var _0xa9f9=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x9f9a[_0x5d7227];return _0x15ac55;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa9f9('0x0'));var path=require('path');var moment=require(_0xa9f9('0x1'));var htmlToPdfmake=require(_0xa9f9('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xa9f9('0x3'));var rimraf=require('rimraf');var JSDOM=require(_0xa9f9('0x4'))['JSDOM'];var window=new JSDOM('')[_0xa9f9('0x5')];var BPromise=require(_0xa9f9('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa9f9('0x7'))[_0xa9f9('0x8')];var logger=require(_0xa9f9('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa9f9('0xa')][0x2]);var QUERY=process[_0xa9f9('0xa')][0x3];var PATH=process[_0xa9f9('0xa')][0x4];var NAME=process[_0xa9f9('0xa')][0x5];var FORMAT=_0xa9f9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3778b7,_0x48979c){var _0x1f0a86={'status':_0x3778b7};var _0x4e10f7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x48979c){_0x1f0a86['savename']=_0x48979c;}return db[_0xa9f9('0xc')][_0xa9f9('0xd')](_0x1f0a86,_0x4e10f7);}function getHeaders(_0x1a855d){return _[_0xa9f9('0xe')](_0x1a855d,function(_0xf13ece){return{'text':_0xf13ece,'style':_0xa9f9('0xf')};});}function getRows(_0x5db5ac,_0x2bdd58){return _[_0xa9f9('0xe')](_0x2bdd58,function(_0x1d1adc){return _(_0x1d1adc)[_0xa9f9('0x10')](_0x5db5ac)[_0xa9f9('0xe')](function(_0x50c8b8){return _0x50c8b8?_['toString'](_0x50c8b8):'';})[_0xa9f9('0x11')]();});}function createTable(_0x4e4a94,_0x15dc51){var _0x545af1={'widths':_['fill'](Array(_0x4e4a94[_0xa9f9('0x12')]),0x91),'heights':function(_0x12c8d6){return _0x12c8d6===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x751cb=getHeaders(_0x4e4a94);_0x545af1[_0xa9f9('0x13')][_0xa9f9('0x14')](_0x751cb);var _0x2edd69=getRows(_0x4e4a94,_0x15dc51);_0x545af1[_0xa9f9('0x13')]=_0x545af1['body'][_0xa9f9('0x15')](_0x2edd69);return _0x545af1;}function createTables(_0x2c5e75){var _0x54a686=[];var _0x19679f=_[_0xa9f9('0x16')](Object[_0xa9f9('0x17')](_0x2c5e75[0x0]),0x5);_0x19679f[_0xa9f9('0x18')](function(_0xfdbb60){_0x54a686['push'](createTable(_0xfdbb60,_0x2c5e75));});return _0x54a686;}function getPDFDocDefinition(_0x59f33b){var _0x5f5915=util[_0xa9f9('0x19')](_0xa9f9('0x1a'),NAME,EXTRACTED_REPORT[_0xa9f9('0x1b')],moment(EXTRACTED_REPORT[_0xa9f9('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xa9f9('0x1d')])['format'](FORMAT));var _0x12ef8c=[];for(var _0x4725e5=0x0;_0x4725e5<_0x59f33b['length'];_0x4725e5++){var _0x5c6e57=[];if(_0x4725e5===0x0){_0x5c6e57['push']({'text':_0x5f5915,'style':_0xa9f9('0x1e')});}var _0xa02d6f={'table':_0x59f33b[_0x4725e5]};if(_0x4725e5>0x0){_0xa02d6f['pageBreak']=_0xa9f9('0x1f');_0xa02d6f[_0xa9f9('0x20')]=[0x0,0x46,0x0,0x0];}_0x5c6e57['push'](_0xa02d6f);_0x12ef8c[_0xa9f9('0x14')](_0x5c6e57);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x12ef8c,'footer':function(_0x519a93,_0x18f1ce){return{'text':_0x519a93[_0xa9f9('0x21')]()+'\x20/\x20'+_0x18f1ce,'style':_0xa9f9('0x22')};},'defaultStyle':{'font':_0xa9f9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa9f9('0x24')},'footer':{'alignment':_0xa9f9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4193c7){var _0x15584d=0x1388;var _0x2d9f59;if(!_0x4193c7[0x0][_0xa9f9('0x26')]){return analyticExtractedReport(_0xa9f9('0x27'));}return db[_0xa9f9('0x28')][_0xa9f9('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa9f9('0x2a'),_0xa9f9('0x2b')]})[_0xa9f9('0x2c')](function(_0xf2cffc){if(_0xf2cffc){_0x2d9f59=_0xf2cffc;_0x15584d=_0x2d9f59[_0xa9f9('0x2b')]||0x3e8;}})[_0xa9f9('0x2c')](function(){var _0x5b55e3=[];var _0x303b5f=0x0;if(_0x2d9f59[_0xa9f9('0x2a')]){if(_0x4193c7&&_0x4193c7[_0xa9f9('0x12')]){var _0x2b7b8f=_[_0xa9f9('0x2d')](_0x4193c7[0x0][_0xa9f9('0x26')]/_0x15584d);var _0x2a5d5c=Number[_0xa9f9('0x2e')](_0x4193c7[0x0][_0xa9f9('0x26')]/_0x15584d)?_0x4193c7[0x0][_0xa9f9('0x26')]%_0x15584d:0x0;_0x2b7b8f['forEach'](function(_0x3d7c38){if(_0x3d7c38>0x0){_0x303b5f+=_0x15584d;}_0x5b55e3[_0xa9f9('0x14')](dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x31'),QUERY,_0x15584d,_0x303b5f),{'type':dbH['sequelize'][_0xa9f9('0x32')][_0xa9f9('0x33')]}));});if(_0x2a5d5c>0x0){_0x303b5f+=_0x15584d;_0x5b55e3[_0xa9f9('0x14')](dbH['sequelize'][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x31'),QUERY,_0x2a5d5c,_0x303b5f),{'type':dbH[_0xa9f9('0x2f')][_0xa9f9('0x32')]['SELECT']}));}}}else{_0x5b55e3['push'](dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](QUERY,{'type':dbH[_0xa9f9('0x2f')][_0xa9f9('0x32')][_0xa9f9('0x33')]}));}var _0x42bae6=path['dirname'](PATH);var _0x2d6488=path[_0xa9f9('0x34')](PATH,_0xa9f9('0x35'));var _0x47a2a6=_0x2d9f59[_0xa9f9('0x2a')]&&_0x5b55e3[_0xa9f9('0x12')]>0x1;var _0x383d2a=[];if(!fs[_0xa9f9('0x36')](path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488))&&_0x47a2a6){fs[_0xa9f9('0x38')](path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488));}return BPromise[_0xa9f9('0x39')](_0x5b55e3,function(_0x3755f1){_0x383d2a[_0xa9f9('0x14')](_0x3755f1);})[_0xa9f9('0x2c')](function(){var _0x4b8dbf=[];for(var _0x4a455b=0x0;_0x4a455b<_0x383d2a[_0xa9f9('0x12')];_0x4a455b+=0x1){var _0x427711=_0x383d2a[_0x4a455b];var _0x1be7ce=createTables(_[_0xa9f9('0x3a')](_0x427711));var _0x15e9a7;var _0x5798dd=getPDFDocDefinition(_0x1be7ce);var _0x39b1f3=getPDFPrinter();var _0x274365=_0x39b1f3[_0xa9f9('0x3b')](_0x5798dd);if(_0x47a2a6){_0x15e9a7=path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488,util[_0xa9f9('0x19')](_0xa9f9('0x3c'),_0x2d6488,_0x4a455b,_0xa9f9('0x3d')));}else{_0x15e9a7=path[_0xa9f9('0x37')](_0x42bae6,util[_0xa9f9('0x19')](_0xa9f9('0x3e'),_0x2d6488,_0xa9f9('0x3d')));}_0x4b8dbf[_0xa9f9('0x14')](writePDFDocument(_0x274365,_0x15e9a7));}return Promise[_0xa9f9('0x3f')](_0x4b8dbf);})[_0xa9f9('0x2c')](function(){if(_0x47a2a6){return new Promise(function(_0x2ea587){zipdir(path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488),{'saveTo':path['join'](_0x42bae6,util[_0xa9f9('0x19')](_0xa9f9('0x3e'),_0x2d6488,_0xa9f9('0x40')))},function(){rimraf(path['join'](_0x42bae6,_0x2d6488),function(){});_0x2ea587(_0xa9f9('0x41'));});});}})[_0xa9f9('0x2c')](function(){if(!_0x47a2a6)return;rimraf(path[_0xa9f9('0x37')](_0x42bae6,_0x2d6488),function(){});})[_0xa9f9('0x2c')](function(){logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa9f9('0x44'),_0x47a2a6?util[_0xa9f9('0x19')]('%s.%s',_0x2d6488,_0x47a2a6?_0xa9f9('0x40'):_0xa9f9('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x45'),EXTRACTED_REPORT_ID,_0xa9f9('0x46')));return db[_0xa9f9('0xc')][_0xa9f9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa9f9('0x2c')](function(_0x1095f8){EXTRACTED_REPORT=_0x1095f8;return dbH[_0xa9f9('0x2f')][_0xa9f9('0x30')](util[_0xa9f9('0x19')](_0xa9f9('0x48'),QUERY),{'type':dbH['sequelize'][_0xa9f9('0x32')][_0xa9f9('0x33')]});})[_0xa9f9('0x2c')](extractReport)[_0xa9f9('0x49')](function(_0x36b34f){logger[_0xa9f9('0x42')](util[_0xa9f9('0x19')](_0xa9f9('0x4a'),EXTRACTED_REPORT_ID,_0xa9f9('0x46')),util['inspect'](_0x36b34f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa9f9('0x4b')](function(){process[_0xa9f9('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5b232e=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xa9f9('0x4d'),'italics':__dirname+_0xa9f9('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x5b232e;}function getPDFDocDefinitionFromHTML(_0x107c10,_0xd120a0){var _0x4f8192=util[_0xa9f9('0x19')](_0xa9f9('0x4f'),_0xd120a0['channel'],_0xd120a0[_0xa9f9('0x50')]);var _0x11a5b8=moment()[_0xa9f9('0x19')]('YYYY-MM-DD')[_0xa9f9('0x21')]();var _0x1e8179=htmlToPdfmake(_0x107c10,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e8179],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa9f9('0x51'),'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':_0xa9f9('0x51')}},'header':function(){return[{'text':_0xa9f9('0x52'),'style':'header'}];},'footer':function(_0x19fdad,_0x5d0ae3){return[{'text':util[_0xa9f9('0x19')](_0xa9f9('0x53'),_0x4f8192,_0x19fdad,_0x5d0ae3,_0x11a5b8),'style':_0xa9f9('0x22')}];}};}function writePDFDocument(_0x195f44,_0x1f876f){return new Promise(function(_0x44d355,_0x21bbd6){var _0x1bcdc1=_0x195f44['pipe'](fs[_0xa9f9('0x54')](_0x1f876f));_0x1bcdc1['on'](_0xa9f9('0x55'),function(){_0x44d355('finish');});_0x1bcdc1['on']('error',function(_0x7ac7d3){_0x21bbd6(_0x7ac7d3);});_0x195f44[_0xa9f9('0x56')]();});}exports['createPdfFromHTML']=function(_0xc53407,_0x2ecf0c){var _0x272a15=getPDFPrinter();var _0xa89d54=getPDFDocDefinitionFromHTML(_0xc53407,_0x2ecf0c);var _0xec269=_0x272a15['createPdfKitDocument'](_0xa89d54);return writePDFDocument(_0xec269,_0x2ecf0c['path'])['catch'](function(_0x428319){throw _0x428319;});}; \ No newline at end of file +var _0x8db6=['zip\x20finished','info','PDF','Completed','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','push','body','chunk','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','format','header','margin','landscape','right','num','Empty','Setting','find','split','then','range','isInteger','forEach','query','sequelize','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s.%s','pdf','zip'];(function(_0x4cbcd3,_0x3b59e5){var _0x5a6eaa=function(_0x288bc3){while(--_0x288bc3){_0x4cbcd3['push'](_0x4cbcd3['shift']());}};_0x5a6eaa(++_0x3b59e5);}(_0x8db6,0x1b0));var _0x68db=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x8db6[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0x68db('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x68db('0x1'));var moment=require(_0x68db('0x2'));var htmlToPdfmake=require(_0x68db('0x3'));var PdfPrinter=require(_0x68db('0x4'));var zipdir=require(_0x68db('0x5'));var rimraf=require(_0x68db('0x6'));var JSDOM=require(_0x68db('0x7'))[_0x68db('0x8')];var window=new JSDOM('')[_0x68db('0x9')];var BPromise=require(_0x68db('0xa'));var db=require(_0x68db('0xb'))['db'];var dbH=require(_0x68db('0xb'))[_0x68db('0xc')];var logger=require('../../config/logger')(_0x68db('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x68db('0xe')][0x2]);var QUERY=process[_0x68db('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x68db('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x185746,_0x7c1826){var _0x2c1b56={'status':_0x185746};var _0x4f2c4e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7c1826){_0x2c1b56['savename']=_0x7c1826;}return db[_0x68db('0xf')][_0x68db('0x10')](_0x2c1b56,_0x4f2c4e);}function getHeaders(_0x543dac){return _[_0x68db('0x11')](_0x543dac,function(_0x4c6226){return{'text':_0x4c6226,'style':_0x68db('0x12')};});}function getRows(_0x3389af,_0x5bc2e6){return _[_0x68db('0x11')](_0x5bc2e6,function(_0x5555fe){return _(_0x5555fe)[_0x68db('0x13')](_0x3389af)[_0x68db('0x11')](function(_0x454774){return _0x454774?_[_0x68db('0x14')](_0x454774):'';})[_0x68db('0x15')]();});}function createTable(_0x8f0f86,_0x5dc8ad){var _0x1c1b3e={'widths':_[_0x68db('0x16')](Array(_0x8f0f86[_0x68db('0x17')]),0x91),'heights':function(_0x3635de){return _0x3635de===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2aa2e8=getHeaders(_0x8f0f86);_0x1c1b3e['body'][_0x68db('0x18')](_0x2aa2e8);var _0x4694bc=getRows(_0x8f0f86,_0x5dc8ad);_0x1c1b3e[_0x68db('0x19')]=_0x1c1b3e[_0x68db('0x19')]['concat'](_0x4694bc);return _0x1c1b3e;}function createTables(_0x377393){var _0x50bc51=[];var _0x94bd76=_[_0x68db('0x1a')](Object['keys'](_0x377393[0x0]),0x5);_0x94bd76['forEach'](function(_0x1e9603){_0x50bc51[_0x68db('0x18')](createTable(_0x1e9603,_0x377393));});return _0x50bc51;}function getPDFDocDefinition(_0x7d6a57){var _0x296e4d=util['format'](_0x68db('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x68db('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x68db('0x1d')])[_0x68db('0x1e')](FORMAT));var _0x12f8fd=[];for(var _0x5dd76b=0x0;_0x5dd76b<_0x7d6a57[_0x68db('0x17')];_0x5dd76b++){var _0x1c5afc=[];if(_0x5dd76b===0x0){_0x1c5afc[_0x68db('0x18')]({'text':_0x296e4d,'style':_0x68db('0x1f')});}var _0x5ac54e={'table':_0x7d6a57[_0x5dd76b]};if(_0x5dd76b>0x0){_0x5ac54e['pageBreak']='before';_0x5ac54e[_0x68db('0x20')]=[0x0,0x46,0x0,0x0];}_0x1c5afc['push'](_0x5ac54e);_0x12f8fd[_0x68db('0x18')](_0x1c5afc);}return{'pageSize':'A4','pageOrientation':_0x68db('0x21'),'content':_0x12f8fd,'footer':function(_0x1472fe,_0x357b20){return{'text':_0x1472fe[_0x68db('0x14')]()+'\x20/\x20'+_0x357b20,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x68db('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3a4e1a){var _0x1c8d17=0x1388;var _0x5f049b;if(!_0x3a4e1a[0x0][_0x68db('0x23')]){return analyticExtractedReport(_0x68db('0x24'));}return db[_0x68db('0x25')][_0x68db('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x68db('0x27'),'splitSizePdf']})['then'](function(_0x1b52b7){if(_0x1b52b7){_0x5f049b=_0x1b52b7;_0x1c8d17=_0x5f049b['splitSizePdf']||0x3e8;}})[_0x68db('0x28')](function(){var _0x5f2c5c=[];var _0x54633b=0x0;if(_0x5f049b[_0x68db('0x27')]){if(_0x3a4e1a&&_0x3a4e1a[_0x68db('0x17')]){var _0x18d02f=_[_0x68db('0x29')](_0x3a4e1a[0x0][_0x68db('0x23')]/_0x1c8d17);var _0x13b435=Number[_0x68db('0x2a')](_0x3a4e1a[0x0][_0x68db('0x23')]/_0x1c8d17)?_0x3a4e1a[0x0][_0x68db('0x23')]%_0x1c8d17:0x0;_0x18d02f[_0x68db('0x2b')](function(_0x590ca2){if(_0x590ca2>0x0){_0x54633b+=_0x1c8d17;}_0x5f2c5c[_0x68db('0x18')](dbH['sequelize'][_0x68db('0x2c')](util[_0x68db('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c8d17,_0x54633b),{'type':dbH[_0x68db('0x2d')][_0x68db('0x2e')]['SELECT']}));});if(_0x13b435>0x0){_0x54633b+=_0x1c8d17;_0x5f2c5c[_0x68db('0x18')](dbH['sequelize']['query'](util[_0x68db('0x1e')](_0x68db('0x2f'),QUERY,_0x13b435,_0x54633b),{'type':dbH[_0x68db('0x2d')][_0x68db('0x2e')]['SELECT']}));}}}else{_0x5f2c5c[_0x68db('0x18')](dbH[_0x68db('0x2d')][_0x68db('0x2c')](QUERY,{'type':dbH['sequelize'][_0x68db('0x2e')][_0x68db('0x30')]}));}var _0x5cb468=path['dirname'](PATH);var _0x2afea7=path[_0x68db('0x31')](PATH,_0x68db('0x32'));var _0x3c9da3=_0x5f049b['split']&&_0x5f2c5c['length']>0x1;var _0x43da6b=[];if(!fs[_0x68db('0x33')](path[_0x68db('0x34')](_0x5cb468,_0x2afea7))&&_0x3c9da3){fs[_0x68db('0x35')](path[_0x68db('0x34')](_0x5cb468,_0x2afea7));}return BPromise[_0x68db('0x36')](_0x5f2c5c,function(_0x119c9d){_0x43da6b[_0x68db('0x18')](_0x119c9d);})[_0x68db('0x28')](function(){var _0x45db93=[];for(var _0xaf92ae=0x0;_0xaf92ae<_0x43da6b[_0x68db('0x17')];_0xaf92ae+=0x1){var _0x5bbc67=_0x43da6b[_0xaf92ae];var _0x37efb8=createTables(_[_0x68db('0x37')](_0x5bbc67));var _0x52ac66;var _0x500cdb=getPDFDocDefinition(_0x37efb8);var _0x397d23=getPDFPrinter();var _0x1d924e=_0x397d23[_0x68db('0x38')](_0x500cdb);if(_0x3c9da3){_0x52ac66=path[_0x68db('0x34')](_0x5cb468,_0x2afea7,util[_0x68db('0x1e')]('%s%d.%s',_0x2afea7,_0xaf92ae,'pdf'));}else{_0x52ac66=path[_0x68db('0x34')](_0x5cb468,util['format'](_0x68db('0x39'),_0x2afea7,_0x68db('0x3a')));}_0x45db93['push'](writePDFDocument(_0x1d924e,_0x52ac66));}return Promise['all'](_0x45db93);})[_0x68db('0x28')](function(){if(_0x3c9da3){return new Promise(function(_0x27b5e5){zipdir(path[_0x68db('0x34')](_0x5cb468,_0x2afea7),{'saveTo':path[_0x68db('0x34')](_0x5cb468,util[_0x68db('0x1e')](_0x68db('0x39'),_0x2afea7,_0x68db('0x3b')))},function(){rimraf(path[_0x68db('0x34')](_0x5cb468,_0x2afea7),function(){});_0x27b5e5(_0x68db('0x3c'));});});}})['then'](function(){if(!_0x3c9da3)return;rimraf(path[_0x68db('0x34')](_0x5cb468,_0x2afea7),function(){});})[_0x68db('0x28')](function(){logger[_0x68db('0x3d')](util[_0x68db('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x68db('0x3e')));return analyticExtractedReport(_0x68db('0x3f'),_0x3c9da3?util['format']('%s.%s',_0x2afea7,_0x3c9da3?_0x68db('0x3b'):_0x68db('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x68db('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x68db('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xbab958){EXTRACTED_REPORT=_0xbab958;return dbH['sequelize'][_0x68db('0x2c')](util[_0x68db('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x68db('0x2d')][_0x68db('0x2e')][_0x68db('0x30')]});})[_0x68db('0x28')](extractReport)['catch'](function(_0x396e67){logger['info'](util[_0x68db('0x1e')](_0x68db('0x41'),EXTRACTED_REPORT_ID,'PDF'),util['inspect'](_0x396e67,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x68db('0x42'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x27ca9e=new PdfPrinter({'Arial':{'normal':__dirname+_0x68db('0x43'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x68db('0x44'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x27ca9e;}function getPDFDocDefinitionFromHTML(_0x2606c7,_0x11247a){var _0x3b3fa4=util[_0x68db('0x1e')](_0x68db('0x45'),_0x11247a[_0x68db('0x46')],_0x11247a[_0x68db('0x47')]);var _0x962d38=moment()[_0x68db('0x1e')](_0x68db('0x48'))[_0x68db('0x14')]();var _0x24f7aa=htmlToPdfmake(_0x2606c7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x24f7aa],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x68db('0x49'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x68db('0x49'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x68db('0x49')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x132a57,_0x5bd6a0){return[{'text':util[_0x68db('0x1e')](_0x68db('0x4a'),_0x3b3fa4,_0x132a57,_0x5bd6a0,_0x962d38),'style':_0x68db('0x4b')}];}};}function writePDFDocument(_0x39eb8d,_0x1108f3){return new Promise(function(_0x39a568,_0x3d79b4){var _0x32f462=_0x39eb8d[_0x68db('0x4c')](fs[_0x68db('0x4d')](_0x1108f3));_0x32f462['on'](_0x68db('0x4e'),function(){_0x39a568(_0x68db('0x4e'));});_0x32f462['on'](_0x68db('0x4f'),function(_0xb42655){_0x3d79b4(_0xb42655);});_0x39eb8d[_0x68db('0x50')]();});}exports[_0x68db('0x51')]=function(_0x25f514,_0x5b5261){var _0x236c87=getPDFPrinter();var _0x4ee561=getPDFDocDefinitionFromHTML(_0x25f514,_0x5b5261);var _0x3f559e=_0x236c87[_0x68db('0x38')](_0x4ee561);return writePDFDocument(_0x3f559e,_0x5b5261[_0x68db('0x1')])['catch'](function(_0x347404){throw _0x347404;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index afac2ef..ad40233 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 _0xb5a4=['isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','XLSX','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','range','num'];(function(_0x19da4d,_0x260981){var _0xc71c77=function(_0x4edb82){while(--_0x4edb82){_0x19da4d['push'](_0x19da4d['shift']());}};_0xc71c77(++_0x260981);}(_0xb5a4,0x17d));var _0x4b5a=function(_0x445562,_0x34806c){_0x445562=_0x445562-0x0;var _0x55cb1e=_0xb5a4[_0x445562];return _0x55cb1e;};'use strict';var util=require('util');var path=require(_0x4b5a('0x0'));var _=require(_0x4b5a('0x1'));var fs=require('fs');var json2xls=require(_0x4b5a('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x4b5a('0x3'));var rimraf=require(_0x4b5a('0x4'));var db=require(_0x4b5a('0x5'))['db'];var dbH=require(_0x4b5a('0x5'))[_0x4b5a('0x6')];var logger=require(_0x4b5a('0x7'))(_0x4b5a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4b5a('0x9')][0x2]);var QUERY=process[_0x4b5a('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b3d11,_0xa18b37){var _0x6be522={'status':_0x2b3d11};var _0x30fada={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa18b37){_0x6be522[_0x4b5a('0xa')]=_0xa18b37;}return db[_0x4b5a('0xb')][_0x4b5a('0xc')](_0x6be522,_0x30fada);}function main(){var _0x10e9ac=0x1388;var _0x5b8213;logger[_0x4b5a('0xd')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4b5a('0xe')));return db['Setting'][_0x4b5a('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4b5a('0x10'),_0x4b5a('0x11')]})['then'](function(_0x4f7256){if(_0x4f7256){_0x5b8213=_0x4f7256;_0x10e9ac=_0x5b8213[_0x4b5a('0x11')]||0x1388;}})[_0x4b5a('0x12')](function(){return dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](util[_0x4b5a('0x15')](_0x4b5a('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x4b5a('0x17')]});})[_0x4b5a('0x12')](function(_0x307876){if(!_0x307876[0x0]['num']){return analyticExtractedReport('Empty');}var _0x240552=[];var _0x4fc505=0x0;if(_0x5b8213[_0x4b5a('0x10')]){if(_0x307876&&_0x307876[_0x4b5a('0x18')]){var _0x4f95e2=_[_0x4b5a('0x19')](_0x307876[0x0][_0x4b5a('0x1a')]/_0x10e9ac);var _0x1b1840=Number[_0x4b5a('0x1b')](_0x307876[0x0][_0x4b5a('0x1a')]/_0x10e9ac)?_0x307876[0x0]['num']%_0x10e9ac:0x0;_0x4f95e2['forEach'](function(_0x5b9415){if(_0x5b9415>0x0){_0x4fc505+=_0x10e9ac;}_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](util[_0x4b5a('0x15')](_0x4b5a('0x1d'),QUERY,_0x10e9ac,_0x4fc505),{'type':dbH['sequelize'][_0x4b5a('0x1e')][_0x4b5a('0x17')]}));});if(_0x1b1840>0x0){_0x4fc505+=_0x10e9ac;_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')]['query'](util[_0x4b5a('0x15')](_0x4b5a('0x1d'),QUERY,_0x1b1840,_0x4fc505),{'type':dbH[_0x4b5a('0x13')]['QueryTypes'][_0x4b5a('0x17')]}));}}}else{_0x240552[_0x4b5a('0x1c')](dbH[_0x4b5a('0x13')][_0x4b5a('0x14')](QUERY,{'type':dbH[_0x4b5a('0x13')]['QueryTypes'][_0x4b5a('0x17')]}));}var _0x9bcf2=path[_0x4b5a('0x1f')](PATH);var _0x5b4da9=path[_0x4b5a('0x20')](PATH,_0x4b5a('0x21'));var _0x49887a=_0x5b8213[_0x4b5a('0x10')]&&_0x240552[_0x4b5a('0x18')]>0x1;var _0x561f0f=[];if(!fs[_0x4b5a('0x22')](path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9))&&_0x49887a){fs[_0x4b5a('0x24')](path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9));}return BPromise[_0x4b5a('0x25')](_0x240552,function(_0x245054){_0x561f0f['push'](_0x245054);})['then'](function(){for(var _0x41ba9e=0x0;_0x41ba9e<_0x561f0f[_0x4b5a('0x18')];_0x41ba9e+=0x1){var _0x3b2ba5;var _0x51c187=_0x561f0f[_0x41ba9e];if(_0x49887a){_0x3b2ba5=path['join'](_0x9bcf2,_0x5b4da9,util[_0x4b5a('0x15')](_0x4b5a('0x26'),_0x5b4da9,_0x41ba9e,_0x4b5a('0x27')));}else{_0x3b2ba5=path['join'](_0x9bcf2,util['format']('%s.%s',_0x5b4da9,_0x4b5a('0x27')));}fs[_0x4b5a('0x28')](_0x3b2ba5,json2xls(_0x51c187),_0x4b5a('0x29'));}})[_0x4b5a('0x12')](function(){if(_0x49887a){return new Promise(function(_0x2f9507){zipdir(path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9),{'saveTo':path[_0x4b5a('0x23')](_0x9bcf2,util[_0x4b5a('0x15')]('%s.%s',_0x5b4da9,_0x4b5a('0x2a')))},function(_0x2a0d84,_0x16e7a8){rimraf(path[_0x4b5a('0x23')](_0x9bcf2,_0x5b4da9),function(){});_0x2f9507(_0x4b5a('0x2b'));});});}})[_0x4b5a('0x12')](function(){logger[_0x4b5a('0xd')](util[_0x4b5a('0x15')](_0x4b5a('0x2c'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x4b5a('0x2d'),_0x49887a?util[_0x4b5a('0x15')](_0x4b5a('0x2e'),_0x5b4da9,_0x49887a?'zip':'xlsx'):null);});})[_0x4b5a('0x2f')](function(_0x5b38a0){logger['info'](util[_0x4b5a('0x15')](_0x4b5a('0x30'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x5b38a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4b5a('0x31')](function(){process[_0x4b5a('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6c1f=['writeFileSync','binary','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','QueryTypes','num','Empty','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c1f,0x158));var _0xf6c1=function(_0x54cba8,_0x3e5114){_0x54cba8=_0x54cba8-0x0;var _0x324d1f=_0x6c1f[_0x54cba8];return _0x324d1f;};'use strict';var util=require('util');var path=require(_0xf6c1('0x0'));var _=require(_0xf6c1('0x1'));var fs=require('fs');var json2xls=require(_0xf6c1('0x2'));var BPromise=require(_0xf6c1('0x3'));var zipdir=require(_0xf6c1('0x4'));var rimraf=require(_0xf6c1('0x5'));var db=require(_0xf6c1('0x6'))['db'];var dbH=require(_0xf6c1('0x6'))[_0xf6c1('0x7')];var logger=require('../../config/logger')(_0xf6c1('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xf6c1('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c4732,_0x2f5f21){var _0x5cd5de={'status':_0x4c4732};var _0x27da1f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f5f21){_0x5cd5de[_0xf6c1('0xa')]=_0x2f5f21;}return db[_0xf6c1('0xb')][_0xf6c1('0xc')](_0x5cd5de,_0x27da1f);}function main(){var _0x253639=0x1388;var _0x4e1b8a;logger[_0xf6c1('0xd')](util[_0xf6c1('0xe')](_0xf6c1('0xf'),EXTRACTED_REPORT_ID,_0xf6c1('0x10')));return db['Setting'][_0xf6c1('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf6c1('0x12'),_0xf6c1('0x13')]})[_0xf6c1('0x14')](function(_0x4b9afc){if(_0x4b9afc){_0x4e1b8a=_0x4b9afc;_0x253639=_0x4e1b8a[_0xf6c1('0x13')]||0x1388;}})['then'](function(){return dbH[_0xf6c1('0x15')]['query'](util[_0xf6c1('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf6c1('0x15')][_0xf6c1('0x16')]['SELECT']});})[_0xf6c1('0x14')](function(_0x226d12){if(!_0x226d12[0x0][_0xf6c1('0x17')]){return analyticExtractedReport(_0xf6c1('0x18'));}var _0x417582=[];var _0x8dab43=0x0;if(_0x4e1b8a[_0xf6c1('0x12')]){if(_0x226d12&&_0x226d12[_0xf6c1('0x19')]){var _0x2cdfa6=_['range'](_0x226d12[0x0][_0xf6c1('0x17')]/_0x253639);var _0x583fe1=Number[_0xf6c1('0x1a')](_0x226d12[0x0]['num']/_0x253639)?_0x226d12[0x0][_0xf6c1('0x17')]%_0x253639:0x0;_0x2cdfa6[_0xf6c1('0x1b')](function(_0x93cb16){if(_0x93cb16>0x0){_0x8dab43+=_0x253639;}_0x417582[_0xf6c1('0x1c')](dbH['sequelize'][_0xf6c1('0x1d')](util[_0xf6c1('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x253639,_0x8dab43),{'type':dbH[_0xf6c1('0x15')][_0xf6c1('0x16')]['SELECT']}));});if(_0x583fe1>0x0){_0x8dab43+=_0x253639;_0x417582[_0xf6c1('0x1c')](dbH[_0xf6c1('0x15')][_0xf6c1('0x1d')](util[_0xf6c1('0xe')](_0xf6c1('0x1e'),QUERY,_0x583fe1,_0x8dab43),{'type':dbH[_0xf6c1('0x15')][_0xf6c1('0x16')][_0xf6c1('0x1f')]}));}}}else{_0x417582[_0xf6c1('0x1c')](dbH['sequelize'][_0xf6c1('0x1d')](QUERY,{'type':dbH[_0xf6c1('0x15')]['QueryTypes'][_0xf6c1('0x1f')]}));}var _0x205ae3=path[_0xf6c1('0x20')](PATH);var _0x1f8443=path['basename'](PATH,'.xlsx');var _0x538554=_0x4e1b8a[_0xf6c1('0x12')]&&_0x417582[_0xf6c1('0x19')]>0x1;var _0x248d15=[];if(!fs[_0xf6c1('0x21')](path[_0xf6c1('0x22')](_0x205ae3,_0x1f8443))&&_0x538554){fs[_0xf6c1('0x23')](path[_0xf6c1('0x22')](_0x205ae3,_0x1f8443));}return BPromise[_0xf6c1('0x24')](_0x417582,function(_0x5d43b4){_0x248d15[_0xf6c1('0x1c')](_0x5d43b4);})[_0xf6c1('0x14')](function(){for(var _0x586421=0x0;_0x586421<_0x248d15[_0xf6c1('0x19')];_0x586421+=0x1){var _0x35b366;var _0x25619c=_0x248d15[_0x586421];if(_0x538554){_0x35b366=path['join'](_0x205ae3,_0x1f8443,util['format'](_0xf6c1('0x25'),_0x1f8443,_0x586421,_0xf6c1('0x26')));}else{_0x35b366=path[_0xf6c1('0x22')](_0x205ae3,util[_0xf6c1('0xe')](_0xf6c1('0x27'),_0x1f8443,_0xf6c1('0x26')));}fs[_0xf6c1('0x28')](_0x35b366,json2xls(_0x25619c),_0xf6c1('0x29'));}})['then'](function(){if(_0x538554){return new Promise(function(_0x170fd9){zipdir(path[_0xf6c1('0x22')](_0x205ae3,_0x1f8443),{'saveTo':path[_0xf6c1('0x22')](_0x205ae3,util['format']('%s.%s',_0x1f8443,_0xf6c1('0x2a')))},function(_0x4d104f,_0x5cc3f4){rimraf(path['join'](_0x205ae3,_0x1f8443),function(){});_0x170fd9('zip\x20finished');});});}})[_0xf6c1('0x14')](function(){logger[_0xf6c1('0xd')](util[_0xf6c1('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf6c1('0x10')));return analyticExtractedReport('Completed',_0x538554?util[_0xf6c1('0xe')](_0xf6c1('0x27'),_0x1f8443,_0x538554?'zip':'xlsx'):null);});})[_0xf6c1('0x2b')](function(_0x241120){logger['info'](util[_0xf6c1('0xe')](_0xf6c1('0x2c'),EXTRACTED_REPORT_ID,_0xf6c1('0x10')),util[_0xf6c1('0x2d')](_0x241120,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6c1('0x2e'));})['finally'](function(){process[_0xf6c1('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 9ae792d..baf07c6 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 _0x4eb1=['recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','error','rewrite','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','priority','extension','extensions','Set','format','type','VoiceExtensionId','CDR(routeid)=','context','outbound','push','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid='];(function(_0x5abe2d,_0x2e77fa){var _0x14d094=function(_0x441c92){while(--_0x441c92){_0x5abe2d['push'](_0x5abe2d['shift']());}};_0x14d094(++_0x2e77fa);}(_0x4eb1,0xa5));var _0x14eb=function(_0x2745ac,_0x293a2a){_0x2745ac=_0x2745ac-0x0;var _0x1d9d0e=_0x4eb1[_0x2745ac];return _0x1d9d0e;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x3285f9,_0x15297a){var _0x20ae0d=this;return _0x3285f9['models']['Interval'][_0x14eb('0x0')]({'raw':!![]})[_0x14eb('0x1')](function(_0x1852b1){_0x20ae0d[_0x14eb('0x2')]=_0x1852b1;return _0x3285f9[_0x14eb('0x3')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x15297a[_0x14eb('0x4')]},'raw':!![]});})[_0x14eb('0x1')](function(_0x24b56d){return _0x3285f9[_0x14eb('0x3')][_0x14eb('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x14eb('0x6')](_['map'](_0x24b56d,_0x14eb('0x7')))}},'order':[{'raw':_0x14eb('0x8')}],'raw':!![]});})['then'](function(_0x3d6ef4){var _0x9ca2cb=_[_0x14eb('0x9')](_0x3d6ef4,{'priority':'1'});var _0x53fa6f=_[_0x14eb('0x9')](_0x3d6ef4,{'isApp':0x1});var _0xe0b66f=_[_0x14eb('0xa')](_0x53fa6f,_0x14eb('0x7'));var _0x558992=['queue','playback'];var _0x2fd189=[];var _0xa1dd38=[];for(var _0x2f74d3 in _0xe0b66f){if(_0xe0b66f[_0x14eb('0xb')](_0x2f74d3)){_0x20ae0d[_0x14eb('0xc')]=0x2;_0x20ae0d['extensions']=[];_0x20ae0d[_0x14eb('0xd')]=_['find'](_0x9ca2cb,{'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')]});_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':util[_0x14eb('0x10')]('CDR(type)=%s',_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')]),'context':_0xe0b66f[_0x2f74d3][0x0]['context'],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')]==='inbound'){_0x20ae0d['extensions']['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x13')+_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}else if(_0xe0b66f[_0x2f74d3][0x0]['type']===_0x14eb('0x15')){if(_0x20ae0d[_0x14eb('0xd')]){_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x17')+(_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]?_0x14eb('0x19')+_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]+'}':_0x14eb('0x1a')),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x13')+_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0]['exten'],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});var _0x3973a1=_0x20ae0d[_0x14eb('0xc')]++;_0x20ae0d['extensions'][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0x1b'),'appdata':_0x14eb('0x1c')+(_0x3973a1+0x2)+_0x14eb('0x1d')+(_0x3973a1+0x1)+')','context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x3973a1,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0x20ae0d[_0x14eb('0xd')]){_0x20ae0d['extensions'][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x18')]?_0x14eb('0x1e')+_0x20ae0d['extension'][_0x14eb('0x18')]+'}':_0x14eb('0x1f'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId']});}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x20')+_0xe0b66f[_0x2f74d3][0x0]['VoiceExtensionId'],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0]['exten'],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});if(_0x20ae0d[_0x14eb('0xd')]&&_0x20ae0d['extension'][_0x14eb('0xb')](_0x14eb('0x21'))&&_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x21')]!==_0x14eb('0x22')){_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x23'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x24')+_0x20ae0d[_0x14eb('0xd')][_0x14eb('0x21')]||_0x14eb('0x25'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}}_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x26'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')]['push']({'type':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x27'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d[_0x14eb('0xc')]++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x28'),'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'priority':_0x20ae0d['priority']++,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});for(var _0x29198d=0x0,_0x1848eb=0x0;_0x29198d<_0xe0b66f[_0x2f74d3][_0x14eb('0x29')];_0x29198d+=0x1,_0x1848eb=0x0){var _0x16c346=_0xe0b66f[_0x2f74d3][_0x29198d];if(_0x16c346[_0x14eb('0x11')]){_0x16c346['type']=_0x16c346[_0x14eb('0x11')][_0x14eb('0x2a')]();}var _0x27063a=[];var _0xda5059=[];delete _0x16c346['id'];delete _0x16c346[_0x14eb('0x2b')];delete _0x16c346[_0x14eb('0x2c')];var _0x15a60c=_0x16c346[_0x14eb('0x2d')]!=='*,*,*,*'?[_0x16c346[_0x14eb('0x2d')]]:_0x16c346[_0x14eb('0x4')]?_['map'](_[_0x14eb('0x9')](_0x20ae0d[_0x14eb('0x2')],{'IntervalId':_0x16c346[_0x14eb('0x4')]}),_0x14eb('0x2d')):[];if(_0x16c346[_0x14eb('0xb')](_0x14eb('0x2e'))){if(_0x16c346[_0x14eb('0x2e')]&&_0x16c346[_0x14eb('0x2e')]!=='--'){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':'Set','appdata':_0x14eb('0x2f')+_0x16c346['tag'],'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346['exten'],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});}}if(_0x16c346[_0x14eb('0x11')]===_0x14eb('0x15')&&_0x16c346[_0x14eb('0xb')](_0x14eb('0x30'))){if(_0x16c346[_0x14eb('0x30')]){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x16c346[_0x14eb('0x30')]+')','context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}else{_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':'ExecIf','appdata':_0x14eb('0x31'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d['priority']+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}}if(_0x16c346[_0x14eb('0xb')](_0x14eb('0x32'))){if(_0x558992[_0x14eb('0x33')](_0x16c346[_0x14eb('0x34')]['toLowerCase']())>=0x0&&_0x16c346[_0x14eb('0x35')]!==_0x14eb('0x36')){if(_0x16c346[_0x14eb('0x32')]){_0x27063a[_0x14eb('0x16')]({'type':_0x16c346['type'],'app':_0x14eb('0x1b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x16c346['context'],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});_0x27063a['push']({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x37'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});}else{_0x27063a[_0x14eb('0x16')]({'type':_0x16c346['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c['length']+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346[_0x14eb('0x12')]});_0x27063a[_0x14eb('0x16')]({'type':_0x16c346[_0x14eb('0x11')],'app':_0x14eb('0xf'),'appdata':_0x14eb('0x38'),'context':_0x16c346[_0x14eb('0x14')],'exten':_0x16c346[_0x14eb('0x7')],'priority':_0x15a60c[_0x14eb('0x29')]+_0x20ae0d[_0x14eb('0xc')]+_0x1848eb++,'VoiceExtensionId':_0x16c346['VoiceExtensionId']});}}}for(var _0x3247bb=0x0;_0x3247bb<_0x15a60c[_0x14eb('0x29')];_0x3247bb+=0x1){var _0x1f9c4d=_0x20ae0d[_0x14eb('0xc')]+_0x15a60c[_0x14eb('0x29')];var _0x4c8dee=_0x3247bb===_0x15a60c[_0x14eb('0x29')]-0x1?_0x20ae0d[_0x14eb('0xc')]+_0x27063a[_0x14eb('0x29')]+_0xda5059[_0x14eb('0x29')]+0x2:_0x20ae0d[_0x14eb('0xc')]+_0x3247bb+0x1;_0x27063a['splice'](_0x3247bb,0x0,{'type':_0x16c346[_0x14eb('0x11')],'app':'GotoIfTime','appdata':_0x15a60c[_0x3247bb]+'?'+_0x16c346[_0x14eb('0x14')]+_0x14eb('0x39')+_0x1f9c4d+':'+_0x16c346[_0x14eb('0x14')]+',${EXTEN},'+_0x4c8dee,'exten':_0x16c346['exten'],'context':_0x16c346[_0x14eb('0x14')],'priority':_0x20ae0d[_0x14eb('0xc')]+_0x3247bb,'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});}_0x16c346[_0x14eb('0xc')]=_0x27063a[_0x14eb('0x29')]?_[_0x14eb('0x3a')](_0x27063a)['priority']+0x1:_0x20ae0d['priority'];_0x20ae0d[_0x14eb('0xc')]=(_0xda5059[_0x14eb('0x29')]?_[_0x14eb('0x3a')](_0xda5059)[_0x14eb('0xc')]:_0x16c346['priority'])+0x1;_0x20ae0d[_0x14eb('0xe')]=_[_0x14eb('0x3b')](_0x20ae0d[_0x14eb('0xe')],_0x27063a,[_0x16c346],_0xda5059);}_0x20ae0d[_0x14eb('0xe')][_0x14eb('0x16')]({'type':_0xe0b66f[_0x2f74d3][0x0]['type'],'app':_0x14eb('0x3c'),'exten':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x7')],'context':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x14')],'priority':_0x20ae0d[_0x14eb('0xc')],'VoiceExtensionId':_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]});_0x2fd189[_0x14eb('0x16')](_0xe0b66f[_0x2f74d3][0x0][_0x14eb('0x12')]);_0xa1dd38=_[_0x14eb('0x3b')](_0xa1dd38,_0x20ae0d[_0x14eb('0xe')]);}}return _0x3285f9[_0x14eb('0x3d')](function(_0x2bbc62){return _0x3285f9['models'][_0x14eb('0x5')][_0x14eb('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x2fd189}},'transaction':_0x2bbc62})[_0x14eb('0x1')](function(_0x2fce72){return _0x3285f9['models'][_0x14eb('0x5')]['bulkCreate'](_[_0x14eb('0x3f')](_0xa1dd38,_0x14eb('0xc')),{'transaction':_0x2bbc62});});});})['catch'](function(_0x5a5af8){console[_0x14eb('0x40')](_0x5a5af8);});}exports[_0x14eb('0x41')]=rewrite; \ No newline at end of file +var _0xedf1=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','custom','answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','exten','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','recordingFormat','wav'];(function(_0x32673e,_0x5b2f4d){var _0xf8822d=function(_0x4a6792){while(--_0x4a6792){_0x32673e['push'](_0x32673e['shift']());}};_0xf8822d(++_0x5b2f4d);}(_0xedf1,0xa5));var _0x1edf=function(_0x2e99d5,_0x2bd4c3){_0x2e99d5=_0x2e99d5-0x0;var _0x35b68e=_0xedf1[_0x2e99d5];return _0x35b68e;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));function rewrite(_0x557a02,_0xc07e57){var _0x15b0ef=this;return _0x557a02[_0x1edf('0x2')][_0x1edf('0x3')][_0x1edf('0x4')]({'raw':!![]})[_0x1edf('0x5')](function(_0x1bcbb0){_0x15b0ef['intervals']=_0x1bcbb0;return _0x557a02[_0x1edf('0x2')][_0x1edf('0x6')][_0x1edf('0x4')]({'where':{'IntervalId':_0xc07e57[_0x1edf('0x7')]},'raw':!![]});})['then'](function(_0x4bf34c){return _0x557a02['models'][_0x1edf('0x6')][_0x1edf('0x4')]({'where':{'exten':{'$in':_[_0x1edf('0x8')](_[_0x1edf('0x9')](_0x4bf34c,'exten'))}},'order':[{'raw':_0x1edf('0xa')}],'raw':!![]});})[_0x1edf('0x5')](function(_0x3da527){var _0x177687=_[_0x1edf('0xb')](_0x3da527,{'priority':'1'});var _0x401286=_[_0x1edf('0xb')](_0x3da527,{'isApp':0x1});var _0x7039d9=_[_0x1edf('0xc')](_0x401286,'exten');var _0x332a24=[_0x1edf('0xd'),'playback'];var _0x3f937d=[];var _0x194e51=[];for(var _0x5a55f8 in _0x7039d9){if(_0x7039d9[_0x1edf('0xe')](_0x5a55f8)){_0x15b0ef[_0x1edf('0xf')]=0x2;_0x15b0ef[_0x1edf('0x10')]=[];_0x15b0ef['extension']=_['find'](_0x177687,{'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')]});_0x15b0ef['extensions'][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':util[_0x1edf('0x15')](_0x1edf('0x16'),_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')]),'context':_0x7039d9[_0x5a55f8][0x0]['context'],'exten':_0x7039d9[_0x5a55f8][0x0]['exten'],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});if(_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')]===_0x1edf('0x18')){_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x19')+_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')],'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});}else if(_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')]===_0x1edf('0x1b')){if(_0x15b0ef[_0x1edf('0x1c')]){_0x15b0ef[_0x1edf('0x10')]['push']({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x1d')+(_0x15b0ef[_0x1edf('0x1c')][_0x1edf('0x1e')]?_0x1edf('0x1f')+_0x15b0ef['extension'][_0x1edf('0x1e')]+'}':_0x1edf('0x20')),'context':_0x7039d9[_0x5a55f8][0x0]['context'],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});}_0x15b0ef['extensions'][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0]['type'],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x19')+_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId'],'context':_0x7039d9[_0x5a55f8][0x0]['context'],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef['priority']++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});var _0x35d2d5=_0x15b0ef[_0x1edf('0xf')]++;_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x21'),'appdata':_0x1edf('0x22')+(_0x35d2d5+0x2)+'):Goto('+(_0x35d2d5+0x1)+')','context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x35d2d5,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});if(_0x15b0ef['extension']){_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x15b0ef[_0x1edf('0x1c')][_0x1edf('0x1e')]?_0x1edf('0x23')+_0x15b0ef[_0x1edf('0x1c')][_0x1edf('0x1e')]+'}':_0x1edf('0x24'),'context':_0x7039d9[_0x5a55f8][0x0]['context'],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});}_0x15b0ef[_0x1edf('0x10')]['push']({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':'Set','appdata':_0x1edf('0x25')+_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId'],'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});if(_0x15b0ef[_0x1edf('0x1c')]&&_0x15b0ef[_0x1edf('0x1c')][_0x1edf('0xe')]('recordingFormat')&&_0x15b0ef['extension']['recordingFormat']!==_0x1edf('0x26')){_0x15b0ef[_0x1edf('0x10')]['push']({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x27'),'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0]['exten'],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0]['type'],'app':_0x1edf('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x15b0ef[_0x1edf('0x1c')][_0x1edf('0x28')]||_0x1edf('0x29'),'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef['priority']++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});}}_0x15b0ef['extensions'][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x2a'),'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x2b'),'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]});_0x15b0ef[_0x1edf('0x10')][_0x1edf('0x12')]({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':_0x1edf('0x2c'),'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'exten':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x11')],'priority':_0x15b0ef[_0x1edf('0xf')]++,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});for(var _0x41f075=0x0,_0x3385ee=0x0;_0x41f075<_0x7039d9[_0x5a55f8][_0x1edf('0x2d')];_0x41f075+=0x1,_0x3385ee=0x0){var _0x4d715d=_0x7039d9[_0x5a55f8][_0x41f075];if(_0x4d715d[_0x1edf('0x13')]){_0x4d715d[_0x1edf('0x13')]=_0x4d715d['type'][_0x1edf('0x2e')]();}var _0xc04e9f=[];var _0x9eb0f7=[];delete _0x4d715d['id'];delete _0x4d715d[_0x1edf('0x2f')];delete _0x4d715d[_0x1edf('0x30')];var _0x3de2c1=_0x4d715d['interval']!==_0x1edf('0x31')?[_0x4d715d[_0x1edf('0x32')]]:_0x4d715d[_0x1edf('0x7')]?_[_0x1edf('0x9')](_[_0x1edf('0xb')](_0x15b0ef['intervals'],{'IntervalId':_0x4d715d[_0x1edf('0x7')]}),_0x1edf('0x32')):[];if(_0x4d715d['hasOwnProperty']('tag')){if(_0x4d715d[_0x1edf('0x33')]&&_0x4d715d[_0x1edf('0x33')]!=='--'){_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d[_0x1edf('0x13')],'app':'Set','appdata':_0x1edf('0x34')+_0x4d715d[_0x1edf('0x33')],'context':_0x4d715d['context'],'exten':_0x4d715d[_0x1edf('0x11')],'priority':_0x3de2c1[_0x1edf('0x2d')]+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d[_0x1edf('0x17')]});}}if(_0x4d715d[_0x1edf('0x13')]===_0x1edf('0x1b')&&_0x4d715d[_0x1edf('0xe')](_0x1edf('0x35'))){if(_0x4d715d[_0x1edf('0x35')]){_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d['type'],'app':_0x1edf('0x21'),'appdata':_0x1edf('0x36')+_0x4d715d[_0x1edf('0x35')]+')','context':_0x4d715d[_0x1edf('0x1a')],'exten':_0x4d715d['exten'],'priority':_0x3de2c1['length']+_0x15b0ef['priority']+_0x3385ee++,'VoiceExtensionId':_0x4d715d['VoiceExtensionId']});}else{_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d[_0x1edf('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4d715d[_0x1edf('0x1a')],'exten':_0x4d715d['exten'],'priority':_0x3de2c1[_0x1edf('0x2d')]+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d['VoiceExtensionId']});}}if(_0x4d715d['hasOwnProperty']('answer')){if(_0x332a24['indexOf'](_0x4d715d['app'][_0x1edf('0x2e')]())>=0x0&&_0x4d715d['appType']!==_0x1edf('0x37')){if(_0x4d715d[_0x1edf('0x38')]){_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d[_0x1edf('0x13')],'app':_0x1edf('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4d715d[_0x1edf('0x1a')],'exten':_0x4d715d[_0x1edf('0x11')],'priority':_0x3de2c1[_0x1edf('0x2d')]+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d[_0x1edf('0x17')]});_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d[_0x1edf('0x13')],'app':_0x1edf('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4d715d[_0x1edf('0x1a')],'exten':_0x4d715d['exten'],'priority':_0x3de2c1[_0x1edf('0x2d')]+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d[_0x1edf('0x17')]});}else{_0xc04e9f['push']({'type':_0x4d715d['type'],'app':_0x1edf('0x21'),'appdata':_0x1edf('0x39'),'context':_0x4d715d['context'],'exten':_0x4d715d[_0x1edf('0x11')],'priority':_0x3de2c1['length']+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d[_0x1edf('0x17')]});_0xc04e9f[_0x1edf('0x12')]({'type':_0x4d715d[_0x1edf('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4d715d[_0x1edf('0x1a')],'exten':_0x4d715d[_0x1edf('0x11')],'priority':_0x3de2c1[_0x1edf('0x2d')]+_0x15b0ef[_0x1edf('0xf')]+_0x3385ee++,'VoiceExtensionId':_0x4d715d[_0x1edf('0x17')]});}}}for(var _0x20f2b0=0x0;_0x20f2b0<_0x3de2c1[_0x1edf('0x2d')];_0x20f2b0+=0x1){var _0x4e7ef6=_0x15b0ef[_0x1edf('0xf')]+_0x3de2c1[_0x1edf('0x2d')];var _0x5f5baa=_0x20f2b0===_0x3de2c1[_0x1edf('0x2d')]-0x1?_0x15b0ef[_0x1edf('0xf')]+_0xc04e9f['length']+_0x9eb0f7[_0x1edf('0x2d')]+0x2:_0x15b0ef[_0x1edf('0xf')]+_0x20f2b0+0x1;_0xc04e9f[_0x1edf('0x3a')](_0x20f2b0,0x0,{'type':_0x4d715d[_0x1edf('0x13')],'app':_0x1edf('0x3b'),'appdata':_0x3de2c1[_0x20f2b0]+'?'+_0x4d715d['context']+_0x1edf('0x3c')+_0x4e7ef6+':'+_0x4d715d['context']+',${EXTEN},'+_0x5f5baa,'exten':_0x4d715d[_0x1edf('0x11')],'context':_0x4d715d[_0x1edf('0x1a')],'priority':_0x15b0ef['priority']+_0x20f2b0,'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});}_0x4d715d['priority']=_0xc04e9f['length']?_['last'](_0xc04e9f)[_0x1edf('0xf')]+0x1:_0x15b0ef[_0x1edf('0xf')];_0x15b0ef[_0x1edf('0xf')]=(_0x9eb0f7[_0x1edf('0x2d')]?_[_0x1edf('0x3d')](_0x9eb0f7)[_0x1edf('0xf')]:_0x4d715d[_0x1edf('0xf')])+0x1;_0x15b0ef['extensions']=_[_0x1edf('0x3e')](_0x15b0ef['extensions'],_0xc04e9f,[_0x4d715d],_0x9eb0f7);}_0x15b0ef[_0x1edf('0x10')]['push']({'type':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x13')],'app':'Hangup','exten':_0x7039d9[_0x5a55f8][0x0]['exten'],'context':_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x1a')],'priority':_0x15b0ef[_0x1edf('0xf')],'VoiceExtensionId':_0x7039d9[_0x5a55f8][0x0]['VoiceExtensionId']});_0x3f937d[_0x1edf('0x12')](_0x7039d9[_0x5a55f8][0x0][_0x1edf('0x17')]);_0x194e51=_[_0x1edf('0x3e')](_0x194e51,_0x15b0ef[_0x1edf('0x10')]);}}return _0x557a02['transaction'](function(_0x57020b){return _0x557a02['models']['VoiceExtension'][_0x1edf('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x3f937d}},'transaction':_0x57020b})[_0x1edf('0x5')](function(_0x47e01a){return _0x557a02[_0x1edf('0x2')][_0x1edf('0x6')][_0x1edf('0x40')](_[_0x1edf('0x41')](_0x194e51,'priority'),{'transaction':_0x57020b});});});})[_0x1edf('0x42')](function(_0x34744e){console[_0x1edf('0x43')](_0x34744e);});}exports[_0x1edf('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 d8a3b4d..ba97927 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 _0x2fc7=['sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','generalCheckHopper','finally','contact:csv_','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','split','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','contact','index','test','isNil','errors','length','map','message','join','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','NOW()','toString','createdAt','updatedAt','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','cm_hopper_final','into','cm_contacts','str','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always'];(function(_0x5bff30,_0x40a7a4){var _0xf51b20=function(_0x3e5833){while(--_0x3e5833){_0x5bff30['push'](_0x5bff30['shift']());}};_0xf51b20(++_0x40a7a4);}(_0x2fc7,0x167));var _0x72fc=function(_0x451240,_0x4f7681){_0x451240=_0x451240-0x0;var _0x378de5=_0x2fc7[_0x451240];return _0x378de5;};'use strict';var BPromise=require(_0x72fc('0x0'));var util=require(_0x72fc('0x1'));var _=require(_0x72fc('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x72fc('0x3'));var Redis=require('ioredis');var db=require(_0x72fc('0x4'))['db'];var config=require(_0x72fc('0x5'));var logger=require(_0x72fc('0x6'))('api');config[_0x72fc('0x7')]=_[_0x72fc('0x8')](config[_0x72fc('0x7')],{'host':_0x72fc('0x9'),'port':0x18eb});var socket=require(_0x72fc('0xa'))(new Redis(config['redis']));require(_0x72fc('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x72fc('0xc')][0x2]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x2]===_0x72fc('0xe')){throw new Error(_0x72fc('0xf'));}var FILEPATH=process[_0x72fc('0xc')][0x2];if(!process[_0x72fc('0xc')][0x3]||process[_0x72fc('0xc')][0x3]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x3]==='null'||!process[_0x72fc('0xc')][0x4]||process[_0x72fc('0xc')][0x4]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x4]===_0x72fc('0xe')){throw new Error(_0x72fc('0x10'));}var FIELDS=_[_0x72fc('0x11')](process[_0x72fc('0xc')][0x3]['split'](','),process[_0x72fc('0xc')][0x4]['split'](','));if(!process[_0x72fc('0xc')][0x5]||process['argv'][0x5]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x72fc('0xc')][0x5];var COMPANYID=process[_0x72fc('0xc')][0x6]&&process[_0x72fc('0xc')][0x6]!==_0x72fc('0xd')&&process[_0x72fc('0xc')][0x6]!==_0x72fc('0xe')?process[_0x72fc('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x72fc('0xc')][0x7]!==_0x72fc('0xd')&&process['argv'][0x7]!==_0x72fc('0xe')?process[_0x72fc('0xc')][0x7]:null;if(!process[_0x72fc('0xc')][0x8]||process['argv'][0x8]===_0x72fc('0xd')||process[_0x72fc('0xc')][0x8]===_0x72fc('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x72fc('0xc')][0x8];}catch(_0x3d55e3){logger['error'](_0x3d55e3);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(_0xff1410,_0x29c15e,_0x57b8ee,_0x1d7698){var _0x4cfe5a={'message':_0x29c15e};_0x4cfe5a[_0xff1410]=!![];if(_0x57b8ee){_0x4cfe5a[_0x72fc('0x12')]=_0x57b8ee;}if(_0x1d7698){_0x4cfe5a[_0x72fc('0x13')]=_0x1d7698;}return _0x4cfe5a;}function isEmail(_0x2c1226){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))*$/[_0x72fc('0x14')](_0x2c1226);}function checkRow(_0x24cb71,_0x29c062,_0x1b6afa){return new BPromise(function(_0x34e818,_0x20ce53){if(_[_0x72fc('0x15')](_0x24cb71)){return _0x20ce53(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x1b6afa));}if(_0x24cb71['errors']&&_0x24cb71[_0x72fc('0x16')][_0x72fc('0x17')]){var _0x39b783=_[_0x72fc('0x18')](_0x24cb71[_0x72fc('0x16')],_0x72fc('0x19'))[_0x72fc('0x1a')](';');return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x39b783,null,_0x1b6afa));}var _0xd103d7={};for(var _0x3de02 in FIELDS){if(FIELDS[_0x72fc('0x1c')](_0x3de02)&&FIELDS[_0x3de02]){_0xd103d7[_0x3de02]=_0x24cb71[_0x72fc('0x1d')][0x0][FIELDS[_0x3de02]]||_0x24cb71[_0x72fc('0x1d')][0x0]['\ufeff'+FIELDS[_0x3de02]];}}if(!_0xd103d7[_0x72fc('0x1e')]){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x1f'),null,_0x1b6afa));}if(!_0xd103d7[_0x72fc('0x20')]){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x21'),null,_0x1b6afa));}if(_0xd103d7[_0x72fc('0x22')]){var _0x4329c6=moment(_0xd103d7[_0x72fc('0x22')],_0x72fc('0x23'));if(!_0x4329c6[_0x72fc('0x24')]()){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x25'),null,_0x1b6afa));}}if(_0xd103d7[_0x72fc('0x26')]){if(!isEmail(_0xd103d7['email'])){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),'email\x20format\x20is\x20not\x20valid!',null,_0x1b6afa));}}_0xd103d7[_0x72fc('0x27')]=LISTID;_0xd103d7[_0x72fc('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x29c062){var _0x57945d={};for(var _0x48693e=0x0,_0x459464=DUPLICATES[_0x72fc('0x17')];_0x48693e<_0x459464;_0x48693e+=0x1){_0x57945d[DUPLICATES[_0x48693e]]=_0xd103d7[DUPLICATES[_0x48693e]];}var _0x37e263=_[_0x72fc('0x29')](_0x29c062,_0x57945d);if(_0x37e263){return _0x20ce53(handleCheckRowError(_0x72fc('0x2a'),_0x72fc('0x2b'),_0x37e263,_0x1b6afa));}}return db['CmContact'][_0x72fc('0x2c')](_0xd103d7,{'raw':!![],'hooks':![],'fields':_[_0x72fc('0x2d')](_0xd103d7)})[_0x72fc('0x2e')](function(_0x182f7d){if(DUPLICATES&&DUPLICATES[_0x72fc('0x17')]&&_0x29c062){_0x29c062[_0x72fc('0x2f')](_[_0x72fc('0x30')](_0xd103d7,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x182f7d['id'];return _0x34e818();})[_0x72fc('0x31')](function(_0x208e08){return _0x20ce53(handleCheckRowError(_0x72fc('0x1b'),_0x72fc('0x32')+(_0x208e08[_0x72fc('0x19')]||JSON[_0x72fc('0x33')](_0x208e08)),null,_0x1b6afa));});});}function checkHopper(){function _0x2b08dd(){return function(_0x5b70a0){logger[_0x72fc('0x1b')]('cmContact',_0x72fc('0x34'),util[_0x72fc('0x35')](_0x5b70a0,{'showHidden':![],'depth':null}));};}var _0x2f06f4=function(_0x3d86bb,_0x503978){var _0x1b8d22=squel[_0x72fc('0x36')]()['into'](_0x72fc('0x37'))[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x39'),_0x72fc('0x3a'),_0x72fc('0x27'),_0x503978,'createdAt','updatedAt'],squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x39'))[_0x72fc('0x3c')]('id',_0x72fc('0x3a'))[_0x72fc('0x3c')](LISTID['toString'](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x3d86bb['id'][_0x72fc('0x3e')](),_0x503978)[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))['from']('cm_contacts')[_0x72fc('0x41')]('deletedAt\x20IS\x20NULL')[_0x72fc('0x41')](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x43'))['where'](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'))[_0x72fc('0x45')](_0x72fc('0x37'))[_0x72fc('0x41')](_0x503978+_0x72fc('0x46'),_0x3d86bb['id'][_0x72fc('0x3e')]())))[_0x72fc('0x3e')]();return _0x1b8d22;};var _0x4f6d3c=function(_0x456b41,_0x47d60e){var _0x3e6471=squel[_0x72fc('0x36')]()['into'](_0x72fc('0x37'))[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x39'),_0x72fc('0x3a'),_0x72fc('0x27'),_0x47d60e,_0x72fc('0x3f'),'updatedAt'],squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x39'))[_0x72fc('0x3c')]('id',_0x72fc('0x3a'))[_0x72fc('0x3c')](LISTID[_0x72fc('0x3e')](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x456b41['id'][_0x72fc('0x3e')](),_0x47d60e)[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))[_0x72fc('0x45')]('cm_contacts')[_0x72fc('0x41')](_0x72fc('0x47'))[_0x72fc('0x41')](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x48'),squel['str'](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43'))[_0x72fc('0x41')](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()[_0x72fc('0x3c')]('calleridnum')[_0x72fc('0x45')](_0x72fc('0x49'))[_0x72fc('0x41')](_0x47d60e+_0x72fc('0x46'),_0x456b41['id']['toString']()))[_0x72fc('0x41')](_0x72fc('0x44'),squel[_0x72fc('0x3b')]()['field'](_0x72fc('0x20'))[_0x72fc('0x45')]('cm_hopper')['where'](_0x47d60e+_0x72fc('0x46'),_0x456b41['id'][_0x72fc('0x3e')]())))[_0x72fc('0x3e')]();return _0x3e6471;};function _0xba9573(_0x2f96e0,_0xfd0b30){var _0x338619=squel[_0x72fc('0x36')]()[_0x72fc('0x4a')]('cm_hopper')[_0x72fc('0x38')]([_0x72fc('0x20'),'scheduledAt','ContactId','ListId',_0xfd0b30,'createdAt',_0x72fc('0x40')],squel[_0x72fc('0x3b')]()['field'](_0x72fc('0x20'),'phone')['field']('NOW()',_0x72fc('0x39'))[_0x72fc('0x3c')]('id','ContactId')[_0x72fc('0x3c')](LISTID['toString'](),'ListId')[_0x72fc('0x3c')](_0x2f96e0['id'][_0x72fc('0x3e')](),_0xfd0b30)[_0x72fc('0x3c')](_0x72fc('0x3d'),'createdAt')[_0x72fc('0x3c')]('NOW()',_0x72fc('0x40'))['from'](_0x72fc('0x4b'))[_0x72fc('0x41')](_0x72fc('0x47'))[_0x72fc('0x41')]('ListId\x20=\x20?',LISTID['toString']())[_0x72fc('0x41')](_0x72fc('0x48'),squel['str'](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43')))[_0x72fc('0x3e')]();return _0x338619;}function _0x3ecb50(_0x5b51c7,_0x29e61f){var _0x4bd88b=squel[_0x72fc('0x36')]()[_0x72fc('0x4a')]('cm_hopper_black')[_0x72fc('0x38')]([_0x72fc('0x20'),_0x72fc('0x3a'),'ListId',_0x29e61f,_0x72fc('0x3f'),_0x72fc('0x40')],squel['select']()[_0x72fc('0x3c')](_0x72fc('0x20'),_0x72fc('0x20'))[_0x72fc('0x3c')]('id','ContactId')[_0x72fc('0x3c')](LISTID['toString'](),_0x72fc('0x27'))[_0x72fc('0x3c')](_0x5b51c7['id'][_0x72fc('0x3e')](),_0x29e61f)['field'](_0x72fc('0x3d'),_0x72fc('0x3f'))[_0x72fc('0x3c')](_0x72fc('0x3d'),_0x72fc('0x40'))[_0x72fc('0x45')](_0x72fc('0x4b'))[_0x72fc('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0x72fc('0x42'),LISTID[_0x72fc('0x3e')]())[_0x72fc('0x41')](_0x72fc('0x48'),squel[_0x72fc('0x4c')](hopperContacts))[_0x72fc('0x41')](_0x72fc('0x43')))[_0x72fc('0x3e')]();return _0x4bd88b;}return db[_0x72fc('0x4d')][_0x72fc('0x4e')]({'where':{'type':_0x72fc('0x4f')},'attributes':['id',_0x72fc('0x50')],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x52'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x1421a4){var _0x139cff=[];if(_0x1421a4){var _0x4c814e;for(var _0x48c1ce=0x0,_0x160bb8;_0x48c1ce<_0x1421a4[_0x72fc('0x17')];_0x48c1ce+=0x1){_0x160bb8=_0x1421a4[_0x48c1ce][_0x72fc('0x53')]({'plain':!![]});switch(_0x160bb8['dialCheckDuplicateType']){case _0x72fc('0x54'):_0x139cff[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x4f6d3c(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;case _0x72fc('0x58'):_0x139cff[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x2f06f4(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;default:_0x139cff[_0x72fc('0x2f')](db['sequelize']['query'](_0xba9573(_0x160bb8,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}}return _0x139cff;})[_0x72fc('0x59')]()[_0x72fc('0x2e')](function(){return db[_0x72fc('0x4d')]['findAll']({'where':{'type':_0x72fc('0x4f')},'attributes':['id'],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x5a'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x120826){var _0x37008a=[];if(_0x120826){var _0xc7d291;for(var _0x1a29d3=0x0,_0x15f8dd;_0x1a29d3<_0x120826[_0x72fc('0x17')];_0x1a29d3+=0x1){_0x15f8dd=_0x120826[_0x1a29d3][_0x72fc('0x53')]({'plain':!![]});_0x37008a['push'](db[_0x72fc('0x55')]['query'](_0x3ecb50(_0x15f8dd,_0x72fc('0x57')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}return _0x37008a;})[_0x72fc('0x59')]();})[_0x72fc('0x2e')](function(){return db[_0x72fc('0x5b')][_0x72fc('0x4e')]({'attributes':['id',_0x72fc('0x50')],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x52'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x22de2e){var _0x24189d=[];if(_0x22de2e){for(var _0x42aafe=0x0,_0x583aef;_0x42aafe<_0x22de2e['length'];_0x42aafe+=0x1){_0x583aef=_0x22de2e[_0x42aafe][_0x72fc('0x53')]({'plain':!![]});switch(_0x583aef[_0x72fc('0x50')]){case _0x72fc('0x54'):_0x24189d[_0x72fc('0x2f')](db['sequelize'][_0x72fc('0x56')](_0x4f6d3c(_0x583aef,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));break;case'onlyIfOpen':_0x24189d['push'](db[_0x72fc('0x55')][_0x72fc('0x56')](_0x2f06f4(_0x583aef,'CampaignId'))['then'](function(){})['catch'](_0x2b08dd()));break;default:_0x24189d[_0x72fc('0x2f')](db[_0x72fc('0x55')][_0x72fc('0x56')](_0xba9573(_0x583aef,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})['catch'](_0x2b08dd()));}}}return _0x24189d;})['all']();})[_0x72fc('0x2e')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x72fc('0x51')],'as':_0x72fc('0x5a'),'where':{'id':LISTID}}]})[_0x72fc('0x2e')](function(_0x19589f){var _0x4fdea9=[];if(_0x19589f){for(var _0x2dc61b=0x0,_0x2fe143;_0x2dc61b<_0x19589f[_0x72fc('0x17')];_0x2dc61b+=0x1){_0x2fe143=_0x19589f[_0x2dc61b]['get']({'plain':!![]});_0x4fdea9[_0x72fc('0x2f')](db[_0x72fc('0x55')]['query'](_0x3ecb50(_0x2fe143,_0x72fc('0x5c')))[_0x72fc('0x2e')](function(){})[_0x72fc('0x31')](_0x2b08dd()));}}return _0x4fdea9;})[_0x72fc('0x59')]();})[_0x72fc('0x31')](function(_0xbf15fd){logger[_0x72fc('0x1b')]('cmContact,\x20%s,\x20%s',_0x72fc('0x5d'),_0xbf15fd['message']);});}var processPromises=function(_0xb1ceb8){return BPromise[_0x72fc('0x59')](promises)[_0x72fc('0x2e')](function(_0x50de74){})['catch'](function(_0x3805e8){logger[_0x72fc('0x1b')]('Error\x20processing\x20rows\x20block:',JSON[_0x72fc('0x33')](_0x3805e8));})[_0x72fc('0x5e')](function(){socket['emit'](_0x72fc('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xb1ceb8){return _0xb1ceb8['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x72fc('0x2e')](function(){if(hopperContacts){return checkHopper();}})[_0x72fc('0x2e')](function(){socket[_0x72fc('0x60')](_0x72fc('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x72fc('0x61')](FILEPATH);}catch(_0x6eece6){logger['error'](_0x72fc('0x62'),JSON[_0x72fc('0x33')](_0x6eece6));}finally{process[_0x72fc('0x63')](0x0);}});};process['on'](_0x72fc('0x64'),function(){logger[_0x72fc('0x65')](_0x72fc('0x66'));endCsv();});function main(){return BPromise[_0x72fc('0x67')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x72fc('0x68')](',');return db[_0x72fc('0x69')][_0x72fc('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x72fc('0x2e')](function(_0x5602d3){var _0x538332=fs[_0x72fc('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x72fc('0x6b')](_0x538332,{'header':!![],'skipEmptyLines':!![],'step':function(_0xd83396,_0xe65ed6){total+=0x1;var _0x194710=total;promises[_0x72fc('0x2f')](checkRow(_0xd83396,_0x5602d3,_0x194710)[_0x72fc('0x2e')](function(){success+=0x1;})[_0x72fc('0x31')](function(_0x5b0ffa){if(_0x5b0ffa['error']){errors+=0x1;delete _0x5b0ffa[_0x72fc('0x1b')];}else if(_0x5b0ffa[_0x72fc('0x2a')]){duplicates+=0x1;delete _0x5b0ffa[_0x72fc('0x2a')];}rows[_0x72fc('0x2f')](_0x5b0ffa);}));if(total%0xc8===0x0){_0xe65ed6[_0x72fc('0x6c')]();return processPromises(_0xe65ed6);}},'complete':function(){return processPromises()[_0x72fc('0x2e')](function(){logger[_0x72fc('0x65')](_0x72fc('0x6d'));endCsv();});},'error':function(_0x442081,_0x3bc49c){logger['info'](_0x72fc('0x6e'),JSON[_0x72fc('0x33')](_0x442081));endCsv();}});})[_0x72fc('0x31')](function(_0x1267c7){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x72fc('0x33')](_0x1267c7));});}main(); \ No newline at end of file +var _0x7990=['id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','sequelize','query','VoiceQueueId','onlyIfOpen','all','findAll','outbound','BlackLists','get','Lists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','scheduledAt','ListId','createdAt','updatedAt','select','field','NOW()','ContactId','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper','\x20=\x20?','insert','into','fromQuery','phone\x20NOT\x20IN\x20(?)','cm_hopper_final'];(function(_0x5ab169,_0x1f690b){var _0x68aa94=function(_0x267693){while(--_0x267693){_0x5ab169['push'](_0x5ab169['shift']());}};_0x68aa94(++_0x1f690b);}(_0x7990,0x16f));var _0x0799=function(_0x50c6b7,_0x495444){_0x50c6b7=_0x50c6b7-0x0;var _0x203fbf=_0x7990[_0x50c6b7];return _0x203fbf;};'use strict';var BPromise=require('bluebird');var util=require(_0x0799('0x0'));var _=require(_0x0799('0x1'));var fs=require('fs');var squel=require(_0x0799('0x2'));var Papa=require(_0x0799('0x3'));var Redis=require(_0x0799('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x0799('0x5'));var logger=require(_0x0799('0x6'))(_0x0799('0x7'));config[_0x0799('0x8')]=_[_0x0799('0x9')](config['redis'],{'host':_0x0799('0xa'),'port':0x18eb});var socket=require(_0x0799('0xb'))(new Redis(config[_0x0799('0x8')]));require(_0x0799('0xc'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x0799('0xd')][0x2]===_0x0799('0xe')||process[_0x0799('0xd')][0x2]==='null'){throw new Error(_0x0799('0xf'));}var FILEPATH=process[_0x0799('0xd')][0x2];if(!process[_0x0799('0xd')][0x3]||process[_0x0799('0xd')][0x3]===_0x0799('0xe')||process[_0x0799('0xd')][0x3]===_0x0799('0x10')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0x0799('0xd')][0x4]===_0x0799('0x10')){throw new Error(_0x0799('0x11'));}var FIELDS=_[_0x0799('0x12')](process[_0x0799('0xd')][0x3][_0x0799('0x13')](','),process[_0x0799('0xd')][0x4][_0x0799('0x13')](','));if(!process[_0x0799('0xd')][0x5]||process[_0x0799('0xd')][0x5]==='undefined'||process[_0x0799('0xd')][0x5]==='null'){throw new Error(_0x0799('0x14'));}var LISTID=process[_0x0799('0xd')][0x5];var COMPANYID=process[_0x0799('0xd')][0x6]&&process[_0x0799('0xd')][0x6]!==_0x0799('0xe')&&process['argv'][0x6]!==_0x0799('0x10')?process[_0x0799('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0799('0xd')][0x7]!=='undefined'&&process[_0x0799('0xd')][0x7]!==_0x0799('0x10')?process['argv'][0x7]:null;if(!process[_0x0799('0xd')][0x8]||process[_0x0799('0xd')][0x8]===_0x0799('0xe')||process[_0x0799('0xd')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x0799('0xd')][0x8];}catch(_0x220255){logger['error'](_0x220255);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(_0x4860b6,_0xd9373d,_0x3ff157,_0x4ae7c9){var _0xc4bb0d={'message':_0xd9373d};_0xc4bb0d[_0x4860b6]=!![];if(_0x3ff157){_0xc4bb0d[_0x0799('0x15')]=_0x3ff157;}if(_0x4ae7c9){_0xc4bb0d['index']=_0x4ae7c9;}return _0xc4bb0d;}function isEmail(_0xea20bf){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))*$/[_0x0799('0x16')](_0xea20bf);}function checkRow(_0x1e3034,_0x433c44,_0x172865){return new BPromise(function(_0x314d65,_0x4b353b){if(_[_0x0799('0x17')](_0x1e3034)){return _0x4b353b(handleCheckRowError(_0x0799('0x18'),_0x0799('0x19'),null,_0x172865));}if(_0x1e3034[_0x0799('0x1a')]&&_0x1e3034[_0x0799('0x1a')][_0x0799('0x1b')]){var _0x28e367=_[_0x0799('0x1c')](_0x1e3034[_0x0799('0x1a')],_0x0799('0x1d'))['join'](';');return _0x4b353b(handleCheckRowError(_0x0799('0x18'),_0x28e367,null,_0x172865));}var _0x1a6af4={};for(var _0x23131b in FIELDS){if(FIELDS[_0x0799('0x1e')](_0x23131b)&&FIELDS[_0x23131b]){_0x1a6af4[_0x23131b]=_0x1e3034['data'][0x0][FIELDS[_0x23131b]]||_0x1e3034[_0x0799('0x1f')][0x0]['\ufeff'+FIELDS[_0x23131b]];}}if(!_0x1a6af4[_0x0799('0x20')]){return _0x4b353b(handleCheckRowError('error',_0x0799('0x21'),null,_0x172865));}if(!_0x1a6af4[_0x0799('0x22')]){return _0x4b353b(handleCheckRowError(_0x0799('0x18'),_0x0799('0x23'),null,_0x172865));}if(_0x1a6af4[_0x0799('0x24')]){var _0x33f0bc=moment(_0x1a6af4[_0x0799('0x24')],_0x0799('0x25'));if(!_0x33f0bc['isValid']()){return _0x4b353b(handleCheckRowError(_0x0799('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x172865));}}if(_0x1a6af4[_0x0799('0x26')]){if(!isEmail(_0x1a6af4[_0x0799('0x26')])){return _0x4b353b(handleCheckRowError('error',_0x0799('0x27'),null,_0x172865));}}_0x1a6af4['ListId']=LISTID;_0x1a6af4[_0x0799('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0799('0x1b')]&&_0x433c44){var _0x2f5d99={};for(var _0x259045=0x0,_0x3782a4=DUPLICATES[_0x0799('0x1b')];_0x259045<_0x3782a4;_0x259045+=0x1){_0x2f5d99[DUPLICATES[_0x259045]]=_0x1a6af4[DUPLICATES[_0x259045]];}var _0x1d55b0=_[_0x0799('0x29')](_0x433c44,_0x2f5d99);if(_0x1d55b0){return _0x4b353b(handleCheckRowError(_0x0799('0x2a'),_0x0799('0x2b'),_0x1d55b0,_0x172865));}}return db[_0x0799('0x2c')][_0x0799('0x2d')](_0x1a6af4,{'raw':!![],'hooks':![],'fields':_[_0x0799('0x2e')](_0x1a6af4)})[_0x0799('0x2f')](function(_0x41c308){if(DUPLICATES&&DUPLICATES['length']&&_0x433c44){_0x433c44[_0x0799('0x30')](_[_0x0799('0x31')](_0x1a6af4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x41c308['id'];return _0x314d65();})[_0x0799('0x32')](function(_0x45dcca){return _0x4b353b(handleCheckRowError(_0x0799('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x45dcca[_0x0799('0x1d')]||JSON[_0x0799('0x33')](_0x45dcca)),null,_0x172865));});});}function checkHopper(){function _0x9ddb81(){return function(_0x56e39f){logger['error'](_0x0799('0x34'),_0x0799('0x35'),util[_0x0799('0x36')](_0x56e39f,{'showHidden':![],'depth':null}));};}var _0x2fe15a=function(_0x39b5c6,_0x5b2ced){var _0x214bd3=squel['insert']()['into']('cm_hopper')['fromQuery'](['phone',_0x0799('0x37'),'ContactId',_0x0799('0x38'),_0x5b2ced,_0x0799('0x39'),_0x0799('0x3a')],squel[_0x0799('0x3b')]()[_0x0799('0x3c')]('phone','phone')[_0x0799('0x3c')](_0x0799('0x3d'),_0x0799('0x37'))[_0x0799('0x3c')]('id',_0x0799('0x3e'))['field'](LISTID[_0x0799('0x3f')](),'ListId')['field'](_0x39b5c6['id'][_0x0799('0x3f')](),_0x5b2ced)['field'](_0x0799('0x3d'),'createdAt')[_0x0799('0x3c')](_0x0799('0x3d'),_0x0799('0x3a'))['from'](_0x0799('0x40'))[_0x0799('0x41')](_0x0799('0x42'))[_0x0799('0x41')](_0x0799('0x43'),LISTID['toString']())[_0x0799('0x41')](_0x0799('0x44'))[_0x0799('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0799('0x3b')]()[_0x0799('0x3c')](_0x0799('0x22'))[_0x0799('0x45')](_0x0799('0x46'))[_0x0799('0x41')](_0x5b2ced+_0x0799('0x47'),_0x39b5c6['id'][_0x0799('0x3f')]())))['toString']();return _0x214bd3;};var _0x1376d1=function(_0x563e9d,_0x18c0fb){var _0x31a0df=squel[_0x0799('0x48')]()[_0x0799('0x49')](_0x0799('0x46'))[_0x0799('0x4a')](['phone',_0x0799('0x37'),_0x0799('0x3e'),_0x0799('0x38'),_0x18c0fb,_0x0799('0x39'),_0x0799('0x3a')],squel[_0x0799('0x3b')]()[_0x0799('0x3c')]('phone',_0x0799('0x22'))['field'](_0x0799('0x3d'),_0x0799('0x37'))[_0x0799('0x3c')]('id',_0x0799('0x3e'))[_0x0799('0x3c')](LISTID[_0x0799('0x3f')](),_0x0799('0x38'))[_0x0799('0x3c')](_0x563e9d['id']['toString'](),_0x18c0fb)[_0x0799('0x3c')](_0x0799('0x3d'),'createdAt')[_0x0799('0x3c')](_0x0799('0x3d'),_0x0799('0x3a'))[_0x0799('0x45')](_0x0799('0x40'))[_0x0799('0x41')](_0x0799('0x42'))[_0x0799('0x41')](_0x0799('0x43'),LISTID['toString']())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x0799('0x41')](_0x0799('0x44'))[_0x0799('0x41')](_0x0799('0x4b'),squel['select']()[_0x0799('0x3c')]('calleridnum')[_0x0799('0x45')](_0x0799('0x4c'))[_0x0799('0x41')](_0x18c0fb+'\x20=\x20?',_0x563e9d['id'][_0x0799('0x3f')]()))[_0x0799('0x41')](_0x0799('0x4b'),squel[_0x0799('0x3b')]()['field'](_0x0799('0x22'))[_0x0799('0x45')]('cm_hopper')[_0x0799('0x41')](_0x18c0fb+'\x20=\x20?',_0x563e9d['id']['toString']())))['toString']();return _0x31a0df;};function _0x211da6(_0x100352,_0x3599e5){var _0x4d6e0b=squel[_0x0799('0x48')]()[_0x0799('0x49')](_0x0799('0x46'))['fromQuery']([_0x0799('0x22'),_0x0799('0x37'),_0x0799('0x3e'),_0x0799('0x38'),_0x3599e5,_0x0799('0x39'),'updatedAt'],squel['select']()[_0x0799('0x3c')](_0x0799('0x22'),_0x0799('0x22'))[_0x0799('0x3c')]('NOW()',_0x0799('0x37'))[_0x0799('0x3c')]('id',_0x0799('0x3e'))[_0x0799('0x3c')](LISTID['toString'](),_0x0799('0x38'))[_0x0799('0x3c')](_0x100352['id'][_0x0799('0x3f')](),_0x3599e5)[_0x0799('0x3c')](_0x0799('0x3d'),_0x0799('0x39'))['field']('NOW()','updatedAt')[_0x0799('0x45')](_0x0799('0x40'))[_0x0799('0x41')](_0x0799('0x42'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x0799('0x41')](_0x0799('0x4d'),squel[_0x0799('0x4e')](hopperContacts))[_0x0799('0x41')](_0x0799('0x44')))[_0x0799('0x3f')]();return _0x4d6e0b;}function _0x297d15(_0x1a2041,_0x24435d){var _0x41882d=squel[_0x0799('0x48')]()[_0x0799('0x49')](_0x0799('0x4f'))[_0x0799('0x4a')]([_0x0799('0x22'),'ContactId',_0x0799('0x38'),_0x24435d,_0x0799('0x39'),_0x0799('0x3a')],squel[_0x0799('0x3b')]()[_0x0799('0x3c')](_0x0799('0x22'),_0x0799('0x22'))[_0x0799('0x3c')]('id',_0x0799('0x3e'))[_0x0799('0x3c')](LISTID[_0x0799('0x3f')](),_0x0799('0x38'))['field'](_0x1a2041['id'][_0x0799('0x3f')](),_0x24435d)['field'](_0x0799('0x3d'),_0x0799('0x39'))[_0x0799('0x3c')]('NOW()','updatedAt')[_0x0799('0x45')](_0x0799('0x40'))[_0x0799('0x41')](_0x0799('0x42'))[_0x0799('0x41')]('ListId\x20=\x20?',LISTID[_0x0799('0x3f')]())[_0x0799('0x41')]('id\x20IN\x20?',squel[_0x0799('0x4e')](hopperContacts))[_0x0799('0x41')](_0x0799('0x44')))[_0x0799('0x3f')]();return _0x41882d;}return db[_0x0799('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x0799('0x51')],'include':[{'model':db[_0x0799('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0799('0x2f')](function(_0x494992){var _0x878329=[];if(_0x494992){var _0x443b77;for(var _0x5df74b=0x0,_0x3528b3;_0x5df74b<_0x494992[_0x0799('0x1b')];_0x5df74b+=0x1){_0x3528b3=_0x494992[_0x5df74b]['get']({'plain':!![]});switch(_0x3528b3['dialCheckDuplicateType']){case'always':_0x878329[_0x0799('0x30')](db[_0x0799('0x53')][_0x0799('0x54')](_0x1376d1(_0x3528b3,_0x0799('0x55')))[_0x0799('0x2f')](function(){})[_0x0799('0x32')](_0x9ddb81()));break;case _0x0799('0x56'):_0x878329[_0x0799('0x30')](db[_0x0799('0x53')][_0x0799('0x54')](_0x2fe15a(_0x3528b3,_0x0799('0x55')))[_0x0799('0x2f')](function(){})[_0x0799('0x32')](_0x9ddb81()));break;default:_0x878329[_0x0799('0x30')](db[_0x0799('0x53')][_0x0799('0x54')](_0x211da6(_0x3528b3,_0x0799('0x55')))[_0x0799('0x2f')](function(){})[_0x0799('0x32')](_0x9ddb81()));}}}return _0x878329;})[_0x0799('0x57')]()[_0x0799('0x2f')](function(){return db['VoiceQueue'][_0x0799('0x58')]({'where':{'type':_0x0799('0x59')},'attributes':['id'],'include':[{'model':db[_0x0799('0x52')],'as':_0x0799('0x5a'),'where':{'id':LISTID}}]})[_0x0799('0x2f')](function(_0xac2d68){var _0x42f48c=[];if(_0xac2d68){var _0x2077d4;for(var _0x51304a=0x0,_0x41a629;_0x51304a<_0xac2d68[_0x0799('0x1b')];_0x51304a+=0x1){_0x41a629=_0xac2d68[_0x51304a][_0x0799('0x5b')]({'plain':!![]});_0x42f48c[_0x0799('0x30')](db['sequelize'][_0x0799('0x54')](_0x297d15(_0x41a629,_0x0799('0x55')))['then'](function(){})[_0x0799('0x32')](_0x9ddb81()));}}return _0x42f48c;})['all']();})[_0x0799('0x2f')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x0799('0x51')],'include':[{'model':db[_0x0799('0x52')],'as':_0x0799('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x81a071){var _0x3cdf6d=[];if(_0x81a071){for(var _0xc6f840=0x0,_0x4bd007;_0xc6f840<_0x81a071['length'];_0xc6f840+=0x1){_0x4bd007=_0x81a071[_0xc6f840][_0x0799('0x5b')]({'plain':!![]});switch(_0x4bd007['dialCheckDuplicateType']){case'always':_0x3cdf6d[_0x0799('0x30')](db['sequelize'][_0x0799('0x54')](_0x1376d1(_0x4bd007,_0x0799('0x5d')))['then'](function(){})[_0x0799('0x32')](_0x9ddb81()));break;case _0x0799('0x56'):_0x3cdf6d[_0x0799('0x30')](db['sequelize'][_0x0799('0x54')](_0x2fe15a(_0x4bd007,_0x0799('0x5d')))[_0x0799('0x2f')](function(){})[_0x0799('0x32')](_0x9ddb81()));break;default:_0x3cdf6d[_0x0799('0x30')](db['sequelize'][_0x0799('0x54')](_0x211da6(_0x4bd007,_0x0799('0x5d')))[_0x0799('0x2f')](function(){})[_0x0799('0x32')](_0x9ddb81()));}}}return _0x3cdf6d;})[_0x0799('0x57')]();})['then'](function(){return db[_0x0799('0x5e')][_0x0799('0x58')]({'attributes':['id'],'include':[{'model':db[_0x0799('0x52')],'as':_0x0799('0x5a'),'where':{'id':LISTID}}]})[_0x0799('0x2f')](function(_0x5a595d){var _0x5beefd=[];if(_0x5a595d){for(var _0x226005=0x0,_0x28e5cf;_0x226005<_0x5a595d[_0x0799('0x1b')];_0x226005+=0x1){_0x28e5cf=_0x5a595d[_0x226005][_0x0799('0x5b')]({'plain':!![]});_0x5beefd['push'](db['sequelize'][_0x0799('0x54')](_0x297d15(_0x28e5cf,_0x0799('0x5d')))[_0x0799('0x2f')](function(){})['catch'](_0x9ddb81()));}}return _0x5beefd;})[_0x0799('0x57')]();})[_0x0799('0x32')](function(_0x141889){logger[_0x0799('0x18')](_0x0799('0x5f'),'generalCheckHopper',_0x141889[_0x0799('0x1d')]);});}var processPromises=function(_0x583aa0){return BPromise[_0x0799('0x57')](promises)[_0x0799('0x2f')](function(_0x192d56){})[_0x0799('0x32')](function(_0x11dc9e){logger[_0x0799('0x18')](_0x0799('0x60'),JSON[_0x0799('0x33')](_0x11dc9e));})[_0x0799('0x61')](function(){socket[_0x0799('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x583aa0){return _0x583aa0['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x0799('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x0799('0x2f')](function(){socket['emit'](_0x0799('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0799('0x64')](FILEPATH);}catch(_0x53b681){logger[_0x0799('0x18')](_0x0799('0x65'),JSON[_0x0799('0x33')](_0x53b681));}finally{process[_0x0799('0x66')](0x0);}});};process['on'](_0x0799('0x67'),function(){logger[_0x0799('0x68')](_0x0799('0x69'));endCsv();});function main(){return BPromise['resolve']()[_0x0799('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0799('0x13')](',');return db['CmContact'][_0x0799('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2515fc){var _0x2c111c=fs[_0x0799('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0799('0x6b')](_0x2c111c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x385bbc,_0x45d9bc){total+=0x1;var _0x504af3=total;promises[_0x0799('0x30')](checkRow(_0x385bbc,_0x2515fc,_0x504af3)[_0x0799('0x2f')](function(){success+=0x1;})[_0x0799('0x32')](function(_0x3f9b4a){if(_0x3f9b4a[_0x0799('0x18')]){errors+=0x1;delete _0x3f9b4a[_0x0799('0x18')];}else if(_0x3f9b4a[_0x0799('0x2a')]){duplicates+=0x1;delete _0x3f9b4a['duplicate'];}rows[_0x0799('0x30')](_0x3f9b4a);}));if(total%0xc8===0x0){_0x45d9bc[_0x0799('0x6c')]();return processPromises(_0x45d9bc);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0799('0x68')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xfbf1e2,_0x1e515a){logger[_0x0799('0x68')](_0x0799('0x6d'),JSON[_0x0799('0x33')](_0xfbf1e2));endCsv();}});})[_0x0799('0x32')](function(_0x1ba008){logger[_0x0799('0x18')](_0x0799('0x6e'),JSON['stringify'](_0x1ba008));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 410d1ba..2109ab9 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 _0x5777=['from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','then','length','push','AdditionalPhones','split','filter','findOne','CmContactHasItem','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','scheduledat','cm_contacts.createdAt\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','MIN(id)','group','Received\x20SIGINT','error','message','exit','errors','code','info','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','voice_queues.id','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','all','timezones','utcOffset','set','offset','dialTimezone','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','keys','includes','header','name','parse','createReadStream','rows','data','find','_description','isNil','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment/shared','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field'];(function(_0x1fab69,_0x279ffd){var _0x1d8b67=function(_0x42ee2e){while(--_0x42ee2e){_0x1fab69['push'](_0x1fab69['shift']());}};_0x1d8b67(++_0x279ffd);}(_0x5777,0x15e));var _0x7577=function(_0x36e009,_0x2a869d){_0x36e009=_0x36e009-0x0;var _0x447dff=_0x5777[_0x36e009];return _0x447dff;};'use strict';var fs=require('fs');var path=require(_0x7577('0x0'));var _=require(_0x7577('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x7577('0x2'));var moment=require('moment');var squel=require(_0x7577('0x3'));var Redis=require(_0x7577('0x4'));var db=require(_0x7577('0x5'))['db'];var config=require('../../../config/environment');var shared=require(_0x7577('0x6'));var logger=require('../../../config/logger')('import');config[_0x7577('0x7')]=_[_0x7577('0x8')](config[_0x7577('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7577('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7577('0x9')](_0x7577('0xa'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7577('0x9')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x287076){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))*$/[_0x7577('0xb')](_0x287076);}function selectNotIn(_0x54896a,_0x2a8601,_0x5d67f9,_0x228877,_0x14b299){return squel[_0x7577('0xc')]()[_0x7577('0xd')]('phone')[_0x7577('0xe')](_0x228877)[_0x7577('0xf')](_0x2a8601,null,_0x2a8601+'.id\x20=\x20'+_0x228877+'.'+_0x5d67f9)[_0x7577('0x10')](_0x228877+'.'+_0x5d67f9+_0x7577('0x11')+_0x54896a+'.'+_0x5d67f9)[_0x7577('0x10')](_0x2a8601+_0x7577('0x12')+_0x14b299['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3bbb15,_0x2fcf81){promisesAdditionalPhones=[];return db['CmContact'][_0x7577('0x13')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x7577('0x14')](function(_0x437328){if(_0x437328!==null){var _0x2d487c=[];for(var _0x4492a6=0x0;_0x4492a6<_0x437328[_0x7577('0x15')];_0x4492a6++){var _0x42aee8=_0x437328[_0x4492a6];_0x2d487c[_0x7577('0x16')](insertAdditionalPhones(_0x42aee8));}}Promise['all'](_0x2d487c)[_0x7577('0x14')](function(){_0x3bbb15({'val':0x1});});});});}function insertAdditionalPhones(_0x35bd4d){return new Promise(function(_0x34bbdb,_0x265df3){var _0x4eb2f6=_0x35bd4d[_0x7577('0x17')];var _0x48fd93=_0x4eb2f6[_0x7577('0x18')](';');var _0x5ba1a0=[];orderBy=0x0;for(var _0xee0714=0x0;_0xee0714<_0x48fd93[_0x7577('0x15')];_0xee0714++){_0x5ba1a0['push'](splitAdditionalPhone(_0x35bd4d['id'],_0x48fd93[_0xee0714]));}Promise['all'](_0x5ba1a0)[_0x7577('0x14')](function(){_0x34bbdb({'val':_0x48fd93[_0x7577('0x15')]});});});}function splitAdditionalPhone(_0x4a0cd7,_0xb345b6){return new Promise(function(_0x1af48a,_0xf052dc){var _0x261dab=_0xb345b6[_0x7577('0x18')](':');var _0x26e34d=_0x261dab[0x0];var _0x506044=_0x261dab[0x1];if(!_['isNil'](_0x506044)){var _0xece08=_0x506044['split']('|');var _0x566db5=[];for(var _0x1559ec=0x0;_0x1559ec<_0xece08['length'];_0x1559ec++){if(_0xece08[_0x1559ec]!==''){var _0xe13d21=_[_0x7577('0x19')](promisesAdditionalPhones,{'contactId':_0x4a0cd7,'phone':_0xece08[_0x1559ec]});if(_0xe13d21[_0x7577('0x15')]==0x0){orderBy++;promisesAdditionalPhones[_0x7577('0x16')]({'contactId':_0x4a0cd7,'contactTypeId':_0x26e34d,'phone':_0xece08[_0x1559ec],'orderBy':orderBy});}}}_0x1af48a({'ok':0x1});}else _0x1af48a({'res':0x0});});}function createAdditionalPhone(_0x5ae70e,_0x2dec0c,_0x610f99,_0x2004aa){var _0x349113='';var _0x5d42bc='';var _0x11f9cc=_0x610f99[_0x7577('0x18')]('§');_0x349113=_0x11f9cc[0x0];if(_0x11f9cc[_0x7577('0x15')]==0x2)_0x5d42bc=_0x11f9cc[0x1];return new Promise(function(_0xa90b51,_0x426573){return db['CmContactHasItem'][_0x7577('0x1a')]({'where':{'CmContactId':_0x5ae70e,'item':_0x349113}})[_0x7577('0x14')](function(_0x28aaa3){if(_0x28aaa3){return db[_0x7577('0x1b')]['update']({'ItemTypeId':_0x2dec0c,'description':_0x5d42bc,'OrderBy':_0x2004aa},{'where':{'CmContactId':_0x5ae70e,'item':_0x349113}})[_0x7577('0x14')](function(_0x398a2c){_0xa90b51({'res':'updated'});});}else{return db[_0x7577('0x1b')]['create']({'CmContactId':_0x5ae70e,'item':_0x349113,'description':_0x5d42bc,'ItemTypeId':_0x2dec0c,'OrderBy':_0x2004aa,'ItemClass':'PHONE'})[_0x7577('0x14')](function(_0xd47c7f){_0xa90b51({'res':_0x7577('0x1c')});});}});});}function insertCmHopper(_0x2dd367,_0x4a435b,_0x1bb8ec,_0x38ae4f,_0x5e4426){var _0x252804=[_0x7577('0x1d'),_0x7577('0x1e'),_0x7577('0x1f'),_0x7577('0x20'),_0x4a435b+'.'+_0x38ae4f,_0x7577('0x21'),_0x7577('0x22'),_0x7577('0x23'),'cm_contacts.UserId','\x22'+_0x5e4426+'\x22'];return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x26'))[_0x7577('0x27')]([_0x7577('0x28'),'scheduledat',_0x7577('0x29'),_0x7577('0x2a'),_0x38ae4f,_0x7577('0x2b'),_0x7577('0x2c'),_0x7577('0x2d'),_0x7577('0x2e'),_0x7577('0x2f')],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x252804)['from'](_0x4a435b)['join'](_0x7577('0x31'),null,_0x7577('0x32')+_0x4a435b+_0x7577('0x33'))[_0x7577('0xf')](_0x1bb8ec,null,_0x1bb8ec+_0x7577('0x34')+_0x4a435b+'.'+_0x38ae4f)['where'](_0x4a435b+_0x7577('0x35'),_0x2dd367)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x7577('0x36'),selectNotIn(_0x4a435b,_0x1bb8ec,_0x38ae4f,'cm_hopper',[_0x7577('0x37'),_0x7577('0x38')]))[_0x7577('0x10')](_0x7577('0x36'),selectNotIn(_0x4a435b,_0x1bb8ec,_0x38ae4f,_0x7577('0x26'),[_0x7577('0x37')])))[_0x7577('0x39')]();}function insertCmHopperBlack(_0x188f32,_0x2b0311,_0x41aae1,_0x32980c){var _0x4fb7eb=[_0x7577('0x1d'),_0x7577('0x1f'),_0x7577('0x20'),_0x2b0311+'.'+_0x32980c,_0x7577('0x21'),_0x7577('0x22')];return squel['insert']()[_0x7577('0x25')]('cm_hopper_black')['fromQuery']([_0x7577('0x28'),_0x7577('0x29'),_0x7577('0x2a'),_0x32980c,'createdAt',_0x7577('0x2c')],squel[_0x7577('0xc')]()['fields'](_0x4fb7eb)['from'](_0x2b0311)[_0x7577('0xf')](_0x7577('0x31'),null,_0x7577('0x32')+_0x2b0311+_0x7577('0x33'))[_0x7577('0xf')](_0x41aae1,null,_0x41aae1+_0x7577('0x34')+_0x2b0311+'.'+_0x32980c)['where'](_0x2b0311+'.CmListId\x20=\x20?',_0x188f32)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7577('0x10')](_0x7577('0x36'),squel[_0x7577('0xc')]()['field'](_0x7577('0x28'))[_0x7577('0xe')](_0x7577('0x3a'))[_0x7577('0x10')]('ListId\x20=\x20?',_0x188f32)[_0x7577('0x10')](_0x32980c+_0x7577('0x11')+_0x2b0311+'.'+_0x32980c)))[_0x7577('0x39')]();}function insertTzCmHopper(_0x54dcbb,_0xe3efcb,_0x4b16c9,_0x48096b,_0x351f6e,_0x40423c){var _0x127e08=['cm_contacts.phone',_0x7577('0x3b')+_0x40423c+'.offset-cm_contacts.utcOffset\x20minute)',_0x7577('0x1f'),_0x7577('0x20'),_0xe3efcb+'.'+_0x48096b,_0x7577('0x21'),_0x7577('0x22'),_0x7577('0x23'),'cm_contacts.UserId','\x22'+_0x351f6e+'\x22'];var _0x5aa9d8=squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x26'))[_0x7577('0x27')]([_0x7577('0x28'),_0x7577('0x3c'),_0x7577('0x29'),'ListId',_0x48096b,_0x7577('0x2b'),'updatedAt',_0x7577('0x2d'),_0x7577('0x2e'),'recallme'],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x127e08)[_0x7577('0xe')](_0xe3efcb)[_0x7577('0xf')]('cm_contacts',null,_0x7577('0x32')+_0xe3efcb+'.CmListId')[_0x7577('0xf')](_0x4b16c9,null,_0x4b16c9+_0x7577('0x34')+_0xe3efcb+'.'+_0x48096b)[_0x7577('0xf')](_0x40423c,null,_0x40423c+'.id\x20=\x20'+_0xe3efcb+'.'+_0x48096b)[_0x7577('0x10')](_0xe3efcb+_0x7577('0x35'),_0x54dcbb)[_0x7577('0x10')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7577('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xe3efcb,_0x4b16c9,_0x48096b,'cm_hopper',['\x22always\x22',_0x7577('0x38')]))[_0x7577('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xe3efcb,_0x4b16c9,_0x48096b,_0x7577('0x26'),[_0x7577('0x37')])))[_0x7577('0x39')]();return _0x5aa9d8;}function insertTzCmHopperBlack(_0x36003d,_0x15c0c2,_0x1c9c05,_0x468aa5){var _0x180624=[_0x7577('0x1d'),_0x7577('0x1f'),_0x7577('0x20'),_0x15c0c2+'.'+_0x468aa5,_0x7577('0x21'),_0x7577('0x22')];return squel[_0x7577('0x24')]()['into'](_0x7577('0x3a'))[_0x7577('0x27')]([_0x7577('0x28'),_0x7577('0x29'),_0x7577('0x2a'),_0x468aa5,'createdAt',_0x7577('0x2c')],squel[_0x7577('0xc')]()['fields'](_0x180624)[_0x7577('0xe')](_0x15c0c2)[_0x7577('0xf')](_0x7577('0x31'),null,_0x7577('0x32')+_0x15c0c2+_0x7577('0x33'))['join'](_0x1c9c05,null,_0x1c9c05+_0x7577('0x34')+_0x15c0c2+'.'+_0x468aa5)[_0x7577('0x10')](_0x15c0c2+_0x7577('0x35'),_0x36003d)['where'](_0x7577('0x3d'),NOW)['where'](_0x7577('0x36'),squel[_0x7577('0xc')]()['field'](_0x7577('0x28'))[_0x7577('0xe')](_0x7577('0x3a'))[_0x7577('0x10')]('ListId\x20=\x20?',_0x36003d)[_0x7577('0x10')](_0x468aa5+_0x7577('0x11')+_0x15c0c2+'.'+_0x468aa5)))[_0x7577('0x39')]();}function insertCmHopperAdditionalPhones(_0x25c133){var _0x1b5a81=[_0x7577('0x3e'),_0x7577('0x3f'),'cm_contact_has_items.OrderBy',_0x7577('0x40'),_0x7577('0x41')];return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x42'))['fromQuery']([_0x7577('0x43'),_0x7577('0x28'),_0x7577('0x44'),_0x7577('0x2b'),'updatedAt'],squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x1b5a81)['from']('cm_hopper')['join'](_0x7577('0x31'),null,_0x7577('0x45'))['join'](_0x7577('0x46'),null,_0x7577('0x47'))['where'](_0x7577('0x48'),_0x25c133)[_0x7577('0x10')](_0x7577('0x3d'),NOW))['toString']();}function insertCmContact(_0x3b0ef2,_0x2ec341,_0x53c509,_0x13ed2d){var _0x1ec5c0=_[_0x7577('0x49')](_['keys'](_0x13ed2d),[_0x7577('0x2a'),_0x7577('0x4a'),_0x7577('0x2b'),_0x7577('0x2c')]);return squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x7577('0x31'))['fromQuery'](_0x1ec5c0,squel['select']()[_0x7577('0x30')](_0x1ec5c0)[_0x7577('0xe')](_0x2ec341)['where']('('+_0x53c509['join'](',')+_0x7577('0x4b'),squel[_0x7577('0xc')]()[_0x7577('0x30')](_0x53c509)['from'](_0x7577('0x31'))['where'](_0x7577('0x4c'),_0x3b0ef2)[_0x7577('0x10')]('deletedAt\x20IS\x20NULL'))[_0x7577('0x10')]('id\x20IN\x20?',squel[_0x7577('0xc')]()[_0x7577('0xd')](_0x7577('0x4d'),'min_id')['from'](_0x2ec341)[_0x7577('0x4e')](_0x53c509[_0x7577('0xf')](','))))[_0x7577('0x39')]();}function handleStop(){logger['info'](_0x7577('0x4f'));stopped=!![];}function handleUncaughtException(_0x55e82e){logger[_0x7577('0x50')](_0x55e82e[_0x7577('0x51')]);process[_0x7577('0x52')](0x1);}function handleError(_0x1cdb04,_0x6d3093){stats[_0x7577('0x53')][_0x7577('0x16')]({'name':_0x6d3093[_0x7577('0x54')],'message':_0x6d3093[_0x7577('0x51')],'row':_0x1cdb04});}function handleQuery(_0x3c2dd7){logger[_0x7577('0x55')](_0x3c2dd7);return db['sequelize']['query'](_0x3c2dd7)[_0x7577('0x56')](function(_0x2a293c){results[_0x7577('0x16')](_0x2a293c);})[_0x7577('0x57')](function(_0x21074a){logger['error'](_0x21074a[_0x7577('0x51')]);});}function updateTzCampaigns(_0x51b0ce){return new Promise(function(_0x726cff,_0x8d062c){var _0x1ad4a5=squel['select']()[_0x7577('0x30')]([_0x7577('0x58'),_0x7577('0x59')])[_0x7577('0xe')](_0x7577('0x5a'))[_0x7577('0xf')](_0x7577('0x5b'),null,_0x7577('0x5c'))['where'](_0x7577('0x5d')+_0x51b0ce);db[_0x7577('0x5e')][_0x7577('0x5f')](_0x1ad4a5['toString']())[_0x7577('0x56')](function(_0x3b9523){var _0x4ab8d9=[];for(var _0x4ed6fa=0x0;_0x4ed6fa<_0x3b9523[_0x7577('0x15')];_0x4ed6fa++){_0x4ab8d9[_0x7577('0x16')](getTimezoneData(_0x3b9523[_0x4ed6fa],tmp_campaigns));}BPromise['all'](_0x4ab8d9)[_0x7577('0x14')](function(){_0x726cff({'val':0x1});});})[_0x7577('0x57')](function(_0x64e3a1){logger[_0x7577('0x50')](_0x64e3a1[_0x7577('0x51')]);_0x726cff({'val':0x0});});});}function updateTzVoiceQueues(_0x309758){return new Promise(function(_0x398b1c,_0x18f526){var _0x643df8=squel['select']()['fields']([_0x7577('0x60'),'voice_queues.dialTimezone'])['from'](_0x7577('0x61'))[_0x7577('0xf')]('voice_queues_has_cm_lists',null,_0x7577('0x62'))[_0x7577('0x10')](_0x7577('0x63')+_0x309758);db[_0x7577('0x5e')][_0x7577('0x5f')](_0x643df8[_0x7577('0x39')]())[_0x7577('0x56')](function(_0x1f614a){var _0x794b70=[];for(var _0x17369b=0x0;_0x17369b<_0x1f614a[_0x7577('0x15')];_0x17369b++){_0x794b70['push'](getTimezoneData(_0x1f614a[_0x17369b],tmp_voice_queues));}BPromise[_0x7577('0x64')](_0x794b70)[_0x7577('0x14')](function(){_0x398b1c({'val':0x1});});})[_0x7577('0x57')](function(_0x57b348){logger[_0x7577('0x50')](_0x57b348[_0x7577('0x51')]);_0x398b1c({'val':0x0});});});}function getTimezoneData(_0x5c791d,_0x389642){return new Promise(function(_0x1df380,_0x539716){var _0x45c8f=shared[_0x7577('0x65')];var _0x471202=_0x45c8f[_0x5c791d['dialTimezone']];if(_['isNil'](_0x471202)){_0x1df380({'ret':0x1});}else{var _0x2b3dcd=_0x471202[_0x7577('0x66')];var _0x24f26f=squel[_0x7577('0x24')]()[_0x7577('0x25')](_0x389642)[_0x7577('0x67')]('id',_0x5c791d['id'])[_0x7577('0x67')](_0x7577('0x68'),_0x2b3dcd)[_0x7577('0x67')](_0x7577('0x69'),_0x5c791d['dialTimezone'])[_0x7577('0x39')]();return db['sequelize'][_0x7577('0x5f')](_0x24f26f)[_0x7577('0x56')](function(_0x3ca534){_0x1df380({'ret':0x1});})[_0x7577('0x57')](function(_0x5463bd){logger[_0x7577('0x50')](_0x5463bd['message']);_0x539716({'ret':0x1});});}});}function handleTZQuery(_0xcf3b2c){logger['info'](_0xcf3b2c);return db[_0x7577('0x5e')][_0x7577('0x5f')](_0xcf3b2c)[_0x7577('0x56')](function(_0x543df1){})[_0x7577('0x57')](function(_0x6f0c13){logger[_0x7577('0x50')](_0x6f0c13['message']);});}function main(_0x2146b7,_0xcb3862,_0x2bb041,_0x54b9ee){logger[_0x7577('0x55')](_0x7577('0x6a'),_0x2146b7,JSON[_0x7577('0x6b')](_0xcb3862));process[_0x7577('0x6c')](_0x7577('0x6d'));var _0x5dda19=_0xcb3862[_0x7577('0x6e')];var _0x3ad449=_[_0x7577('0x6f')](_0x5dda19);var _0x3088cb=_0xcb3862['socket_timestamp'];var _0x3e9bf9=path[_0x7577('0xf')](config[_0x7577('0x70')],_0x7577('0x71'),_0x3088cb+_0x7577('0x72'));hasTZ=_[_0x7577('0x73')](_0x5dda19)[_0x7577('0x74')](_0x7577('0x69'));var _0x5e0303=_[_0x7577('0x73')](_0x5dda19)[_0x7577('0xf')]();logger[_0x7577('0x55')](_0x7577('0x75'),_0x5e0303);db['ContactItemType'][_0x7577('0x13')]({'raw':!![],'attributes':['id','name']})[_0x7577('0x14')](function(_0x131875){for(var _0x406e58=0x0;_0x406e58<_0x131875[_0x7577('0x15')];_0x406e58++){if(_0x131875[_0x406e58]['name']in _0x5dda19){contactItemTypes[_0x7577('0x16')](_0x131875[_0x406e58]);delete _0x3ad449[_0x131875[_0x406e58]['name']];hasAdditionalPhones=!![];}for(var _0x33b3ca in _0x5dda19){if(_0x131875[_0x406e58][_0x7577('0x76')]+'_description'===_0x33b3ca){phoneDescriptions[_0x7577('0x16')]({'itemTypeId':_0x131875[_0x406e58]['id'],'description':_0x33b3ca});delete _0x3ad449[_0x33b3ca];}}}if(hasAdditionalPhones)_0x3ad449[_0x7577('0x17')]='';var _0x5ed0f4=_['keys'](_0x3ad449)[_0x7577('0xf')]();logger[_0x7577('0x55')](_0x7577('0x75'),_0x5ed0f4);fs['writeFileSync'](_0x3e9bf9,_0x5ed0f4+'\x0a');Papa[_0x7577('0x77')](fs[_0x7577('0x78')](_0x2146b7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x30b85d,_0x6c8018){try{for(var _0x2da792=0x0,_0x2f5174=[];_0x2da792<_0x30b85d['data'][_0x7577('0x15')];_0x2da792++){stats[_0x7577('0x79')]+=0x1;if(_0x30b85d[_0x7577('0x53')][_0x2da792]){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],_0x30b85d['errors'][_0x2da792]);}else{var _0x29ff44=[];var _0x27168e=[];var _0x34fa7a={};for(var _0x2e25f0 in _0x5dda19){let _0x468dc6=contactItemTypes[_0x7577('0x7b')](_0x42843c=>_0x42843c[_0x7577('0x76')]===_0x2e25f0);let _0x153146=contactItemTypes[_0x7577('0x7b')](_0x4544db=>_0x4544db['name']+_0x7577('0x7c')===_0x2e25f0);if(_['isNil'](_0x468dc6)&&_[_0x7577('0x7d')](_0x153146)){if(_0x5dda19[_0x7577('0x7e')](_0x2e25f0)){if(_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]]){var _0xc4609c=_[_0x7577('0x7f')](_0x30b85d['data'][_0x2da792][_0x5dda19[_0x2e25f0]][_0x7577('0x80')](/"/g,'\x27'));switch(_0x2e25f0){case'scheduledat':var _0x192cc7=moment(_0xc4609c,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x192cc7['isValid']()){_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');}else{_0x29ff44['push'](_0x7577('0x81'));}break;case'priority':var _0xc480be=parseInt(_0xc4609c);_0xc4609c=_[_0x7577('0x82')](_0xc480be)||_0xc480be<0x0||_0xc480be>0x4?_0x54b9ee?0x3:0x2:_0xc480be;_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');break;case _0x7577('0x2e'):var _0xa2a0a0=parseInt(_0xc4609c);if(_[_0x7577('0x83')](_0xa2a0a0)&&_[_0x7577('0x74')](_0x2bb041,_0xa2a0a0)){_0x2f5174['push']('\x22'+_0xa2a0a0+'\x22');}else{_0x29ff44[_0x7577('0x16')]('agent\x20not\x20exists');}break;case _0x7577('0x84'):if(isEmail(_0xc4609c)){_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}else{_0x29ff44[_0x7577('0x16')](_0x7577('0x85'));}break;case _0x7577('0x86'):var _0x48932b=moment(_0xc4609c,_0x7577('0x87'),!![]);if(_0x48932b[_0x7577('0x88')]()){_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}else{_0x29ff44[_0x7577('0x16')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x7577('0x69'):var _0x5395fd=shared[_0x7577('0x65')];var _0x1dff77=_0x5395fd[_0xc4609c];if(!_[_0x7577('0x7d')](_0x1dff77)){var _0x1f6173=_0x1dff77['utcOffset'];_0x2f5174[_0x7577('0x16')]('\x22'+_0xc4609c+'\x22');_0x2f5174[_0x7577('0x16')]('\x22'+_0x1f6173+'\x22');}break;default:_0x2f5174['push']('\x22'+_0xc4609c+'\x22');}}else{switch(_0x2e25f0){case _0x7577('0x89'):case'phone':_0x29ff44[_0x7577('0x16')](_0x2e25f0+_0x7577('0x8a'));break;default:_0x2f5174[_0x7577('0x16')]('\x22\x22');}}}}else{var _0x433e62='';if(!_[_0x7577('0x7d')](_0x468dc6)){if(!_0x34fa7a[_0x7577('0x7e')](_0x468dc6['id'])){if(!_[_0x7577('0x7d')](_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]])){var _0xc4609c=_[_0x7577('0x7f')](_0x30b85d[_0x7577('0x7a')][_0x2da792][_0x5dda19[_0x2e25f0]][_0x7577('0x80')](/"/g,'\x27'));var _0x28dd5a=phoneDescriptions[_0x7577('0x7b')](_0x4442f1=>_0x4442f1[_0x7577('0x8b')]===_0x468dc6['id']);if(!_[_0x7577('0x7d')](_0x28dd5a)){var _0x343b6b=_[_0x7577('0x7f')](_0x30b85d['data'][_0x2da792][_0x5dda19[_0x28dd5a[_0x7577('0x8c')]]][_0x7577('0x80')](/"/g,'\x27'));if(!_[_0x7577('0x7d')](_0x343b6b))_0xc4609c=_0xc4609c+'§'+_0x343b6b;}if(_0x433e62=='')_0x433e62=_0xc4609c;else _0x433e62+='|'+_0xc4609c;}_0x27168e['push'](_0x468dc6['id']+':'+_0x433e62);_0x34fa7a[_0x468dc6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2f5174[_0x7577('0x16')]('\x22'+_0x27168e['join'](';')+'\x22');}if(_0x29ff44[_0x7577('0x15')]){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],{'code':_0x7577('0x8d'),'message':_0x29ff44['join']()});}else{fs[_0x7577('0x8e')](_0x3e9bf9,_0x2f5174[_0x7577('0xf')]()+'\x0a');}_0x2f5174=[];}if(!(stats[_0x7577('0x79')]%0xc8)){socket[_0x7577('0x8f')]('contact:import:'+_0x3088cb,stats);stats['errors']=[];}}if(stopped){logger[_0x7577('0x55')](_0x7577('0x90'));_0x6c8018[_0x7577('0x91')]();}}catch(_0x468e1a){handleError(_0x30b85d[_0x7577('0x7a')][_0x2da792],{'code':_0x7577('0x92'),'message':_0x468e1a[_0x7577('0x51')]});logger['error'](_0x7577('0x93'),_0x468e1a['message']);}},'complete':function(){try{var _0x43a094=[];var _0x2cf52c=[];var _0x3604c3=_0x7577('0x31');if(_0xcb3862[_0x7577('0x94')]&&_0xcb3862[_0x7577('0x94')][_0x7577('0x15')]){_0x3604c3=_0x7577('0x95')+_0x3088cb;_0x43a094['push'](_0x7577('0x96')+_0x3604c3+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7577('0x97')+_0x3088cb;tmp_voice_queues=_0x7577('0x98')+_0x3088cb;_0x2cf52c['push'](_0x7577('0x96')+tmp_campaigns+_0x7577('0x99'));_0x2cf52c[_0x7577('0x16')](_0x7577('0x96')+tmp_voice_queues+_0x7577('0x99'));BPromise[_0x7577('0x9a')](_0x2cf52c,handleTZQuery)[_0x7577('0x14')](function(_0x5cd3aa){updateTzCampaigns(_0xcb3862['ListId'])[_0x7577('0x14')](function(_0x110427){updateTzVoiceQueues(_0xcb3862['ListId'])['then'](function(_0x569a05){if(hasTZ)_0x5ed0f4=_0x5ed0f4['replace'](_0x7577('0x69'),_0x7577('0x9b'));var _0x20274d=util[_0x7577('0x9')](_0x7577('0x9c'),_0x3e9bf9,_0x3604c3,_0x5ed0f4,_0xcb3862['ListId'],_0xcb3862[_0x7577('0x4a')]||null,NOW,NOW);if(_[_0x7577('0x7d')](_0x5dda19['scheduledat'])){_0x20274d+=_0x7577('0x9d');}_0x43a094[_0x7577('0x16')](_0x20274d);if(_0xcb3862[_0x7577('0x94')]&&_0xcb3862[_0x7577('0x94')][_0x7577('0x15')]){_0x43a094[_0x7577('0x16')](insertCmContact(_0xcb3862['ListId'],_0x3604c3,_0xcb3862[_0x7577('0x94')],_0x5dda19));_0x43a094['push'](_0x7577('0x9e')+_0x3604c3+';');}BPromise[_0x7577('0x9a')](_0x43a094,handleQuery)[_0x7577('0x14')](function(_0x5530f5){BPromise['all']([handleAdditionalPhones()])[_0x7577('0x14')](function(){_0x43a094=[];for(var _0x261c9f=0x0;_0x261c9f\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','then','all','split','push','isNil','filter','length','CmContactHasItem','findOne','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','insert','cm_hopper_black','ListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20'];(function(_0x5c4139,_0x12479e){var _0x5df4b6=function(_0xb532ce){while(--_0xb532ce){_0x5c4139['push'](_0x5c4139['shift']());}};_0x5df4b6(++_0x12479e);}(_0x10f9,0x69));var _0x910f=function(_0x1047ef,_0x46905a){_0x1047ef=_0x1047ef-0x0;var _0x4aea1d=_0x10f9[_0x1047ef];return _0x4aea1d;};'use strict';var fs=require('fs');var path=require(_0x910f('0x0'));var _=require(_0x910f('0x1'));var Papa=require(_0x910f('0x2'));var util=require(_0x910f('0x3'));var BPromise=require(_0x910f('0x4'));var moment=require(_0x910f('0x5'));var squel=require(_0x910f('0x6'));var Redis=require(_0x910f('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x910f('0x8'));var shared=require(_0x910f('0x9'));var logger=require(_0x910f('0xa'))(_0x910f('0xb'));config[_0x910f('0xc')]=_[_0x910f('0xd')](config[_0x910f('0xc')],{'host':_0x910f('0xe'),'port':0x18eb});var socket=require(_0x910f('0xf'))(new Redis(config[_0x910f('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x910f('0x10')](_0x910f('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x910f('0x10')](_0x910f('0x11'));function isEmail(_0x45772b){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))*$/[_0x910f('0x12')](_0x45772b);}function selectNotIn(_0x52087b,_0x22b933,_0x1314e3,_0x3e716a,_0x1429ac){return squel[_0x910f('0x13')]()['field'](_0x910f('0x14'))[_0x910f('0x15')](_0x3e716a)[_0x910f('0x16')](_0x22b933,null,_0x22b933+_0x910f('0x17')+_0x3e716a+'.'+_0x1314e3)[_0x910f('0x18')](_0x3e716a+'.'+_0x1314e3+_0x910f('0x19')+_0x52087b+'.'+_0x1314e3)['where'](_0x22b933+_0x910f('0x1a')+_0x1429ac['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x181cfa,_0x54a58b){promisesAdditionalPhones=[];return db[_0x910f('0x1b')]['findAll']({'raw':!![],'attributes':['id',_0x910f('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x910f('0x1d')](function(_0x53c49e){if(_0x53c49e!==null){var _0x3b6611=[];for(var _0x7dcf3b=0x0;_0x7dcf3b<_0x53c49e['length'];_0x7dcf3b++){var _0x3efed8=_0x53c49e[_0x7dcf3b];_0x3b6611['push'](insertAdditionalPhones(_0x3efed8));}}Promise[_0x910f('0x1e')](_0x3b6611)[_0x910f('0x1d')](function(){_0x181cfa({'val':0x1});});});});}function insertAdditionalPhones(_0x366aef){return new Promise(function(_0x45a61d,_0x3ae156){var _0x205723=_0x366aef[_0x910f('0x1c')];var _0x599c20=_0x205723[_0x910f('0x1f')](';');var _0x30c137=[];orderBy=0x0;for(var _0x3dbf3b=0x0;_0x3dbf3b<_0x599c20['length'];_0x3dbf3b++){_0x30c137[_0x910f('0x20')](splitAdditionalPhone(_0x366aef['id'],_0x599c20[_0x3dbf3b]));}Promise[_0x910f('0x1e')](_0x30c137)['then'](function(){_0x45a61d({'val':_0x599c20['length']});});});}function splitAdditionalPhone(_0x3520e8,_0x1189f2){return new Promise(function(_0x1ba677,_0x112e3c){var _0x369b05=_0x1189f2[_0x910f('0x1f')](':');var _0x1ad83b=_0x369b05[0x0];var _0x6bce91=_0x369b05[0x1];if(!_[_0x910f('0x21')](_0x6bce91)){var _0x27f993=_0x6bce91['split']('|');var _0x17b388=[];for(var _0x5cdcf0=0x0;_0x5cdcf0<_0x27f993['length'];_0x5cdcf0++){if(_0x27f993[_0x5cdcf0]!==''){var _0x25c10b=_[_0x910f('0x22')](promisesAdditionalPhones,{'contactId':_0x3520e8,'phone':_0x27f993[_0x5cdcf0]});if(_0x25c10b[_0x910f('0x23')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3520e8,'contactTypeId':_0x1ad83b,'phone':_0x27f993[_0x5cdcf0],'orderBy':orderBy});}}}_0x1ba677({'ok':0x1});}else _0x1ba677({'res':0x0});});}function createAdditionalPhone(_0x5cb8b1,_0x3c1fee,_0x48df81,_0x1239c2){var _0x21fce0='';var _0x5c35ba='';var _0xd63646=_0x48df81['split']('§');_0x21fce0=_0xd63646[0x0];if(_0xd63646[_0x910f('0x23')]==0x2)_0x5c35ba=_0xd63646[0x1];return new Promise(function(_0x40fad8,_0x2a6f21){return db[_0x910f('0x24')][_0x910f('0x25')]({'where':{'CmContactId':_0x5cb8b1,'item':_0x21fce0}})[_0x910f('0x1d')](function(_0x21a501){if(_0x21a501){return db['CmContactHasItem']['update']({'ItemTypeId':_0x3c1fee,'description':_0x5c35ba,'OrderBy':_0x1239c2},{'where':{'CmContactId':_0x5cb8b1,'item':_0x21fce0}})[_0x910f('0x1d')](function(_0x397ff0){_0x40fad8({'res':_0x910f('0x26')});});}else{return db[_0x910f('0x24')][_0x910f('0x27')]({'CmContactId':_0x5cb8b1,'item':_0x21fce0,'description':_0x5c35ba,'ItemTypeId':_0x3c1fee,'OrderBy':_0x1239c2,'ItemClass':_0x910f('0x28')})['then'](function(_0x2d4187){_0x40fad8({'res':'inserted'});});}});});}function insertCmHopper(_0x1c27d7,_0x2f4e25,_0x2e2c74,_0x3fe079,_0x18c893){var _0x2a7f71=[_0x910f('0x29'),_0x910f('0x2a'),_0x910f('0x2b'),_0x910f('0x2c'),_0x2f4e25+'.'+_0x3fe079,_0x910f('0x2d'),_0x910f('0x2e'),_0x910f('0x2f'),_0x910f('0x30'),'\x22'+_0x18c893+'\x22'];return squel['insert']()[_0x910f('0x31')](_0x910f('0x32'))[_0x910f('0x33')](['phone',_0x910f('0x34'),_0x910f('0x35'),'ListId',_0x3fe079,_0x910f('0x36'),_0x910f('0x37'),'priority',_0x910f('0x38'),_0x910f('0x39')],squel[_0x910f('0x13')]()[_0x910f('0x3a')](_0x2a7f71)[_0x910f('0x15')](_0x2f4e25)[_0x910f('0x16')](_0x910f('0x3b'),null,_0x910f('0x3c')+_0x2f4e25+_0x910f('0x3d'))[_0x910f('0x16')](_0x2e2c74,null,_0x2e2c74+_0x910f('0x17')+_0x2f4e25+'.'+_0x3fe079)[_0x910f('0x18')](_0x2f4e25+'.CmListId\x20=\x20?',_0x1c27d7)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x910f('0x18')](_0x910f('0x3e'),selectNotIn(_0x2f4e25,_0x2e2c74,_0x3fe079,_0x910f('0x32'),[_0x910f('0x3f'),'\x22onlyIfOpen\x22']))[_0x910f('0x18')](_0x910f('0x3e'),selectNotIn(_0x2f4e25,_0x2e2c74,_0x3fe079,_0x910f('0x32'),[_0x910f('0x3f')])))[_0x910f('0x40')]();}function insertCmHopperBlack(_0x5becac,_0x584a46,_0x42c444,_0x279cc1){var _0x5f2b98=[_0x910f('0x29'),_0x910f('0x2b'),'cm_contacts.ListId',_0x584a46+'.'+_0x279cc1,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x910f('0x41')]()['into'](_0x910f('0x42'))[_0x910f('0x33')]([_0x910f('0x14'),_0x910f('0x35'),_0x910f('0x43'),_0x279cc1,_0x910f('0x36'),_0x910f('0x37')],squel['select']()['fields'](_0x5f2b98)[_0x910f('0x15')](_0x584a46)[_0x910f('0x16')](_0x910f('0x3b'),null,_0x910f('0x3c')+_0x584a46+_0x910f('0x3d'))[_0x910f('0x16')](_0x42c444,null,_0x42c444+_0x910f('0x17')+_0x584a46+'.'+_0x279cc1)[_0x910f('0x18')](_0x584a46+_0x910f('0x44'),_0x5becac)['where'](_0x910f('0x45'),NOW)[_0x910f('0x18')](_0x910f('0x3e'),squel[_0x910f('0x13')]()[_0x910f('0x46')](_0x910f('0x14'))[_0x910f('0x15')](_0x910f('0x42'))[_0x910f('0x18')](_0x910f('0x47'),_0x5becac)[_0x910f('0x18')](_0x279cc1+_0x910f('0x19')+_0x584a46+'.'+_0x279cc1)))[_0x910f('0x40')]();}function insertTzCmHopper(_0xf706c3,_0x2c7372,_0x169737,_0x3cbb10,_0x262f40,_0x49ca18){var _0x47664b=[_0x910f('0x29'),_0x910f('0x48')+_0x49ca18+_0x910f('0x49'),_0x910f('0x2b'),'cm_contacts.ListId',_0x2c7372+'.'+_0x3cbb10,_0x910f('0x2d'),_0x910f('0x2e'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x262f40+'\x22'];var _0x1c4009=squel['insert']()['into'](_0x910f('0x32'))[_0x910f('0x33')](['phone',_0x910f('0x34'),'ContactId',_0x910f('0x43'),_0x3cbb10,_0x910f('0x36'),_0x910f('0x37'),_0x910f('0x4a'),'UserId',_0x910f('0x39')],squel[_0x910f('0x13')]()['fields'](_0x47664b)[_0x910f('0x15')](_0x2c7372)['join']('cm_contacts',null,_0x910f('0x3c')+_0x2c7372+_0x910f('0x3d'))[_0x910f('0x16')](_0x169737,null,_0x169737+_0x910f('0x17')+_0x2c7372+'.'+_0x3cbb10)[_0x910f('0x16')](_0x49ca18,null,_0x49ca18+'.id\x20=\x20'+_0x2c7372+'.'+_0x3cbb10)[_0x910f('0x18')](_0x2c7372+'.CmListId\x20=\x20?',_0xf706c3)[_0x910f('0x18')](_0x910f('0x45'),NOW)[_0x910f('0x18')](_0x910f('0x3e'),selectNotIn(_0x2c7372,_0x169737,_0x3cbb10,'cm_hopper',[_0x910f('0x3f'),_0x910f('0x4b')]))['where'](_0x910f('0x3e'),selectNotIn(_0x2c7372,_0x169737,_0x3cbb10,'cm_hopper',[_0x910f('0x3f')])))[_0x910f('0x40')]();return _0x1c4009;}function insertTzCmHopperBlack(_0x3dbff6,_0x456672,_0x3794d7,_0xe67b4d){var _0x131722=[_0x910f('0x29'),_0x910f('0x2b'),_0x910f('0x2c'),_0x456672+'.'+_0xe67b4d,'cm_contacts.createdAt',_0x910f('0x2e')];return squel[_0x910f('0x41')]()[_0x910f('0x31')](_0x910f('0x42'))['fromQuery']([_0x910f('0x14'),_0x910f('0x35'),_0x910f('0x43'),_0xe67b4d,'createdAt',_0x910f('0x37')],squel[_0x910f('0x13')]()[_0x910f('0x3a')](_0x131722)['from'](_0x456672)[_0x910f('0x16')](_0x910f('0x3b'),null,'cm_contacts.ListId\x20=\x20'+_0x456672+_0x910f('0x3d'))[_0x910f('0x16')](_0x3794d7,null,_0x3794d7+'.id\x20=\x20'+_0x456672+'.'+_0xe67b4d)[_0x910f('0x18')](_0x456672+_0x910f('0x44'),_0x3dbff6)[_0x910f('0x18')](_0x910f('0x45'),NOW)[_0x910f('0x18')](_0x910f('0x3e'),squel[_0x910f('0x13')]()[_0x910f('0x46')](_0x910f('0x14'))['from']('cm_hopper_black')['where']('ListId\x20=\x20?',_0x3dbff6)['where'](_0xe67b4d+'\x20=\x20'+_0x456672+'.'+_0xe67b4d)))[_0x910f('0x40')]();}function insertCmHopperAdditionalPhones(_0x597a18){var _0x74b4a2=[_0x910f('0x4c'),_0x910f('0x4d'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x910f('0x4e')];return squel[_0x910f('0x41')]()[_0x910f('0x31')](_0x910f('0x4f'))[_0x910f('0x33')](['CmHopperId',_0x910f('0x14'),'OrderBy',_0x910f('0x36'),'updatedAt'],squel[_0x910f('0x13')]()[_0x910f('0x3a')](_0x74b4a2)[_0x910f('0x15')](_0x910f('0x32'))[_0x910f('0x16')](_0x910f('0x3b'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x910f('0x16')](_0x910f('0x50'),null,_0x910f('0x51'))[_0x910f('0x18')](_0x910f('0x52'),_0x597a18)[_0x910f('0x18')](_0x910f('0x45'),NOW))[_0x910f('0x40')]();}function insertCmContact(_0x4da5f7,_0x575f07,_0x5f4adb,_0x29a8aa){var _0x27350c=_['concat'](_[_0x910f('0x53')](_0x29a8aa),[_0x910f('0x43'),_0x910f('0x54'),'createdAt','updatedAt']);return squel[_0x910f('0x41')]()[_0x910f('0x31')](_0x910f('0x3b'))[_0x910f('0x33')](_0x27350c,squel[_0x910f('0x13')]()[_0x910f('0x3a')](_0x27350c)[_0x910f('0x15')](_0x575f07)[_0x910f('0x18')]('('+_0x5f4adb[_0x910f('0x16')](',')+_0x910f('0x55'),squel['select']()[_0x910f('0x3a')](_0x5f4adb)[_0x910f('0x15')]('cm_contacts')[_0x910f('0x18')]('ListId\x20=\x20?',_0x4da5f7)[_0x910f('0x18')](_0x910f('0x56')))[_0x910f('0x18')](_0x910f('0x57'),squel['select']()[_0x910f('0x46')](_0x910f('0x58'),'min_id')[_0x910f('0x15')](_0x575f07)[_0x910f('0x59')](_0x5f4adb[_0x910f('0x16')](','))))[_0x910f('0x40')]();}function handleStop(){logger['info'](_0x910f('0x5a'));stopped=!![];}function handleUncaughtException(_0x3f30b3){logger[_0x910f('0x5b')](_0x3f30b3[_0x910f('0x5c')]);process[_0x910f('0x5d')](0x1);}function handleError(_0x3f3cae,_0x255c83){stats[_0x910f('0x5e')][_0x910f('0x20')]({'name':_0x255c83[_0x910f('0x5f')],'message':_0x255c83[_0x910f('0x5c')],'row':_0x3f3cae});}function handleQuery(_0x30fa81){logger['info'](_0x30fa81);return db[_0x910f('0x60')][_0x910f('0x61')](_0x30fa81)[_0x910f('0x62')](function(_0x45cdd5){results[_0x910f('0x20')](_0x45cdd5);})[_0x910f('0x63')](function(_0xd62b9f){logger['error'](_0xd62b9f['message']);});}function updateTzCampaigns(_0x2458bd){return new Promise(function(_0x311505,_0x59ba1d){var _0x2db270=squel[_0x910f('0x13')]()[_0x910f('0x3a')]([_0x910f('0x64'),_0x910f('0x65')])[_0x910f('0x15')]('campaigns')[_0x910f('0x16')]('campaigns_has_cm_lists',null,_0x910f('0x66'))[_0x910f('0x18')](_0x910f('0x67')+_0x2458bd);db[_0x910f('0x60')][_0x910f('0x61')](_0x2db270[_0x910f('0x40')]())[_0x910f('0x62')](function(_0x4275c6){var _0x49c080=[];for(var _0x4ce893=0x0;_0x4ce893<_0x4275c6[_0x910f('0x23')];_0x4ce893++){_0x49c080[_0x910f('0x20')](getTimezoneData(_0x4275c6[_0x4ce893],tmp_campaigns));}BPromise[_0x910f('0x1e')](_0x49c080)[_0x910f('0x1d')](function(){_0x311505({'val':0x1});});})['catch'](function(_0x5ab917){logger[_0x910f('0x5b')](_0x5ab917[_0x910f('0x5c')]);_0x311505({'val':0x0});});});}function updateTzVoiceQueues(_0x13c9ab){return new Promise(function(_0x37a72f,_0x5f7c0e){var _0xe45e54=squel[_0x910f('0x13')]()[_0x910f('0x3a')]([_0x910f('0x68'),'voice_queues.dialTimezone'])[_0x910f('0x15')](_0x910f('0x69'))[_0x910f('0x16')](_0x910f('0x6a'),null,_0x910f('0x6b'))[_0x910f('0x18')]('voice_queues_has_cm_lists.CmListId='+_0x13c9ab);db[_0x910f('0x60')][_0x910f('0x61')](_0xe45e54[_0x910f('0x40')]())[_0x910f('0x62')](function(_0x4488c4){var _0x1e0b98=[];for(var _0x161134=0x0;_0x161134<_0x4488c4['length'];_0x161134++){_0x1e0b98[_0x910f('0x20')](getTimezoneData(_0x4488c4[_0x161134],tmp_voice_queues));}BPromise['all'](_0x1e0b98)[_0x910f('0x1d')](function(){_0x37a72f({'val':0x1});});})[_0x910f('0x63')](function(_0xa81cb3){logger['error'](_0xa81cb3['message']);_0x37a72f({'val':0x0});});});}function getTimezoneData(_0x16b6ae,_0x150728){return new Promise(function(_0x931cea,_0x279230){var _0x477c0f=shared[_0x910f('0x6c')];var _0x207be1=_0x477c0f[_0x16b6ae['dialTimezone']];if(_['isNil'](_0x207be1)){_0x931cea({'ret':0x1});}else{var _0x8c7e61=_0x207be1[_0x910f('0x6d')];var _0x5181a1=squel[_0x910f('0x41')]()[_0x910f('0x31')](_0x150728)[_0x910f('0x6e')]('id',_0x16b6ae['id'])[_0x910f('0x6e')]('offset',_0x8c7e61)[_0x910f('0x6e')](_0x910f('0x6f'),_0x16b6ae[_0x910f('0x6f')])[_0x910f('0x40')]();return db['sequelize'][_0x910f('0x61')](_0x5181a1)['spread'](function(_0x4655fb){_0x931cea({'ret':0x1});})[_0x910f('0x63')](function(_0x10cf9c){logger[_0x910f('0x5b')](_0x10cf9c[_0x910f('0x5c')]);_0x279230({'ret':0x1});});}});}function handleTZQuery(_0x184047){logger['info'](_0x184047);return db['sequelize'][_0x910f('0x61')](_0x184047)['spread'](function(_0x4fc140){})[_0x910f('0x63')](function(_0xb27ea4){logger['error'](_0xb27ea4[_0x910f('0x5c')]);});}function main(_0x313936,_0x45b39d,_0x35b55a,_0xc3e613){logger[_0x910f('0x70')](_0x910f('0x71'),_0x313936,JSON['stringify'](_0x45b39d));process[_0x910f('0x72')](_0x910f('0x73'));var _0x23cb2f=_0x45b39d[_0x910f('0x74')];var _0x52629e=_[_0x910f('0x75')](_0x23cb2f);var _0x3126ed=_0x45b39d[_0x910f('0x76')];var _0x433e86=path[_0x910f('0x16')](config[_0x910f('0x77')],_0x910f('0x78'),_0x3126ed+'.csv');hasTZ=_[_0x910f('0x53')](_0x23cb2f)[_0x910f('0x79')]('dialTimezone');var _0xe80371=_[_0x910f('0x53')](_0x23cb2f)[_0x910f('0x16')]();logger[_0x910f('0x70')](_0x910f('0x7a'),_0xe80371);db[_0x910f('0x7b')][_0x910f('0x7c')]({'raw':!![],'attributes':['id',_0x910f('0x7d')]})['then'](function(_0x4da836){for(var _0x3a1978=0x0;_0x3a1978<_0x4da836[_0x910f('0x23')];_0x3a1978++){if(_0x4da836[_0x3a1978][_0x910f('0x7d')]in _0x23cb2f){contactItemTypes[_0x910f('0x20')](_0x4da836[_0x3a1978]);delete _0x52629e[_0x4da836[_0x3a1978][_0x910f('0x7d')]];hasAdditionalPhones=!![];}for(var _0x32b9b2 in _0x23cb2f){if(_0x4da836[_0x3a1978][_0x910f('0x7d')]+_0x910f('0x7e')===_0x32b9b2){phoneDescriptions[_0x910f('0x20')]({'itemTypeId':_0x4da836[_0x3a1978]['id'],'description':_0x32b9b2});delete _0x52629e[_0x32b9b2];}}}if(hasAdditionalPhones)_0x52629e[_0x910f('0x1c')]='';var _0x56dcc3=_[_0x910f('0x53')](_0x52629e)[_0x910f('0x16')]();logger['info'](_0x910f('0x7a'),_0x56dcc3);fs['writeFileSync'](_0x433e86,_0x56dcc3+'\x0a');Papa[_0x910f('0x7f')](fs[_0x910f('0x80')](_0x313936),{'header':!![],'skipEmptyLines':!![],'step':function(_0x24cea4,_0x2b7a68){try{for(var _0x2096ac=0x0,_0x4fa064=[];_0x2096ac<_0x24cea4[_0x910f('0x81')][_0x910f('0x23')];_0x2096ac++){stats[_0x910f('0x82')]+=0x1;if(_0x24cea4[_0x910f('0x5e')][_0x2096ac]){handleError(_0x24cea4[_0x910f('0x81')][_0x2096ac],_0x24cea4[_0x910f('0x5e')][_0x2096ac]);}else{var _0x2a1df3=[];var _0x8e9570=[];var _0x38b9b2={};for(var _0x35c010 in _0x23cb2f){let _0xa91e3a=contactItemTypes[_0x910f('0x83')](_0x3ccd5f=>_0x3ccd5f[_0x910f('0x7d')]===_0x35c010);let _0x539109=contactItemTypes[_0x910f('0x83')](_0x369462=>_0x369462[_0x910f('0x7d')]+_0x910f('0x7e')===_0x35c010);if(_[_0x910f('0x21')](_0xa91e3a)&&_[_0x910f('0x21')](_0x539109)){if(_0x23cb2f['hasOwnProperty'](_0x35c010)){if(_0x24cea4['data'][_0x2096ac][_0x23cb2f[_0x35c010]]){var _0x386188=_[_0x910f('0x84')](_0x24cea4[_0x910f('0x81')][_0x2096ac][_0x23cb2f[_0x35c010]][_0x910f('0x85')](/"/g,'\x27'));switch(_0x35c010){case _0x910f('0x34'):var _0x289949=moment(_0x386188,_0x910f('0x11'),!![]);if(_0x289949['isValid']()){_0x4fa064[_0x910f('0x20')]('\x22'+_0x386188+'\x22');}else{_0x2a1df3[_0x910f('0x20')](_0x910f('0x86'));}break;case _0x910f('0x4a'):var _0x29d981=parseInt(_0x386188);_0x386188=_['isNaN'](_0x29d981)||_0x29d981<0x0||_0x29d981>0x4?_0xc3e613?0x3:0x2:_0x29d981;_0x4fa064['push']('\x22'+_0x386188+'\x22');break;case _0x910f('0x38'):var _0x5de3ec=parseInt(_0x386188);if(_['isNumber'](_0x5de3ec)&&_[_0x910f('0x79')](_0x35b55a,_0x5de3ec)){_0x4fa064[_0x910f('0x20')]('\x22'+_0x5de3ec+'\x22');}else{_0x2a1df3[_0x910f('0x20')]('agent\x20not\x20exists');}break;case _0x910f('0x87'):if(isEmail(_0x386188)){_0x4fa064['push']('\x22'+_0x386188+'\x22');}else{_0x2a1df3['push'](_0x910f('0x88'));}break;case _0x910f('0x89'):var _0x905bb7=moment(_0x386188,_0x910f('0x8a'),!![]);if(_0x905bb7[_0x910f('0x8b')]()){_0x4fa064[_0x910f('0x20')]('\x22'+_0x386188+'\x22');}else{_0x2a1df3[_0x910f('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0xa111c0=shared[_0x910f('0x6c')];var _0x29b349=_0xa111c0[_0x386188];if(!_[_0x910f('0x21')](_0x29b349)){var _0x3af32b=_0x29b349[_0x910f('0x6d')];_0x4fa064[_0x910f('0x20')]('\x22'+_0x386188+'\x22');_0x4fa064[_0x910f('0x20')]('\x22'+_0x3af32b+'\x22');}break;default:_0x4fa064[_0x910f('0x20')]('\x22'+_0x386188+'\x22');}}else{switch(_0x35c010){case _0x910f('0x8c'):case _0x910f('0x14'):_0x2a1df3[_0x910f('0x20')](_0x35c010+_0x910f('0x8d'));break;default:_0x4fa064['push']('\x22\x22');}}}}else{var _0xdd3cab='';if(!_[_0x910f('0x21')](_0xa91e3a)){if(!_0x38b9b2[_0x910f('0x8e')](_0xa91e3a['id'])){if(!_[_0x910f('0x21')](_0x24cea4[_0x910f('0x81')][_0x2096ac][_0x23cb2f[_0x35c010]])){var _0x386188=_['trim'](_0x24cea4['data'][_0x2096ac][_0x23cb2f[_0x35c010]]['replace'](/"/g,'\x27'));var _0x43ee19=phoneDescriptions[_0x910f('0x83')](_0x12a8fb=>_0x12a8fb[_0x910f('0x8f')]===_0xa91e3a['id']);if(!_['isNil'](_0x43ee19)){var _0x9187c8=_[_0x910f('0x84')](_0x24cea4['data'][_0x2096ac][_0x23cb2f[_0x43ee19['description']]][_0x910f('0x85')](/"/g,'\x27'));if(!_[_0x910f('0x21')](_0x9187c8))_0x386188=_0x386188+'§'+_0x9187c8;}if(_0xdd3cab=='')_0xdd3cab=_0x386188;else _0xdd3cab+='|'+_0x386188;}_0x8e9570['push'](_0xa91e3a['id']+':'+_0xdd3cab);_0x38b9b2[_0xa91e3a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4fa064['push']('\x22'+_0x8e9570[_0x910f('0x16')](';')+'\x22');}if(_0x2a1df3['length']){handleError(_0x24cea4[_0x910f('0x81')][_0x2096ac],{'code':'SystemRow','message':_0x2a1df3[_0x910f('0x16')]()});}else{fs[_0x910f('0x90')](_0x433e86,_0x4fa064[_0x910f('0x16')]()+'\x0a');}_0x4fa064=[];}if(!(stats[_0x910f('0x82')]%0xc8)){socket[_0x910f('0x91')](_0x910f('0x92')+_0x3126ed,stats);stats[_0x910f('0x5e')]=[];}}if(stopped){logger[_0x910f('0x70')]('Abort\x20parser');_0x2b7a68['abort']();}}catch(_0x2963b5){handleError(_0x24cea4[_0x910f('0x81')][_0x2096ac],{'code':_0x910f('0x93'),'message':_0x2963b5[_0x910f('0x5c')]});logger[_0x910f('0x5b')](_0x910f('0x94'),_0x2963b5[_0x910f('0x5c')]);}},'complete':function(){try{var _0x37dcb0=[];var _0xb92605=[];var _0x53f650=_0x910f('0x3b');if(_0x45b39d['duplicates']&&_0x45b39d[_0x910f('0x95')]['length']){_0x53f650=_0x910f('0x96')+_0x3126ed;_0x37dcb0[_0x910f('0x20')](_0x910f('0x97')+_0x53f650+_0x910f('0x98'));}tmp_campaigns='campaigns_'+_0x3126ed;tmp_voice_queues=_0x910f('0x99')+_0x3126ed;_0xb92605['push'](_0x910f('0x97')+tmp_campaigns+_0x910f('0x9a'));_0xb92605['push'](_0x910f('0x97')+tmp_voice_queues+_0x910f('0x9a'));BPromise[_0x910f('0x9b')](_0xb92605,handleTZQuery)['then'](function(_0x22ae6b){updateTzCampaigns(_0x45b39d[_0x910f('0x43')])[_0x910f('0x1d')](function(_0x1dd647){updateTzVoiceQueues(_0x45b39d[_0x910f('0x43')])[_0x910f('0x1d')](function(_0x3ceb80){if(hasTZ)_0x56dcc3=_0x56dcc3[_0x910f('0x85')](_0x910f('0x6f'),_0x910f('0x9c'));var _0x1b5289=util[_0x910f('0x10')](_0x910f('0x9d'),_0x433e86,_0x53f650,_0x56dcc3,_0x45b39d[_0x910f('0x43')],_0x45b39d[_0x910f('0x54')]||null,NOW,NOW);if(_['isNil'](_0x23cb2f['scheduledat'])){_0x1b5289+=_0x910f('0x9e');}_0x37dcb0[_0x910f('0x20')](_0x1b5289);if(_0x45b39d[_0x910f('0x95')]&&_0x45b39d[_0x910f('0x95')][_0x910f('0x23')]){_0x37dcb0[_0x910f('0x20')](insertCmContact(_0x45b39d[_0x910f('0x43')],_0x53f650,_0x45b39d[_0x910f('0x95')],_0x23cb2f));_0x37dcb0['push']('DROP\x20TABLE\x20'+_0x53f650+';');}BPromise[_0x910f('0x9b')](_0x37dcb0,handleQuery)[_0x910f('0x1d')](function(_0x1a23d9){BPromise['all']([handleAdditionalPhones()])[_0x910f('0x1d')](function(){_0x37dcb0=[];for(var _0x4af32a=0x0;_0x4af32a\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','YYYYMMDDHHmmss','test','select','phone','.id\x20=\x20','where'];(function(_0x1a90fd,_0x5042e4){var _0x49b5a0=function(_0x31500e){while(--_0x31500e){_0x1a90fd['push'](_0x1a90fd['shift']());}};_0x49b5a0(++_0x5042e4);}(_0x3c8e,0x89));var _0xe3c8=function(_0xee30ad,_0xd6f640){_0xee30ad=_0xee30ad-0x0;var _0x5c32bc=_0x3c8e[_0xee30ad];return _0x5c32bc;};'use strict';var fs=require('fs');var path=require(_0xe3c8('0x0'));var _=require(_0xe3c8('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var squel=require(_0xe3c8('0x4'));var Redis=require('ioredis');var db=require(_0xe3c8('0x5'))['db'];var config=require(_0xe3c8('0x6'));var logger=require(_0xe3c8('0x7'))(_0xe3c8('0x8'));config['redis']=_[_0xe3c8('0x9')](config[_0xe3c8('0xa')],{'host':_0xe3c8('0xb'),'port':0x18eb});var socket=require(_0xe3c8('0xc'))(new Redis(config[_0xe3c8('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xe3c8('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0xe3c8('0xe')](_0xe3c8('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1ec873){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))*$/[_0xe3c8('0x10')](_0x1ec873);}function selectNotIn(_0x50e959,_0x2eb76d,_0x216f2a,_0x273b36,_0x4c24b6){return squel[_0xe3c8('0x11')]()['field'](_0xe3c8('0x12'))['from'](_0x273b36)['join'](_0x2eb76d,null,_0x2eb76d+_0xe3c8('0x13')+_0x273b36+'.'+_0x216f2a)[_0xe3c8('0x14')](_0x273b36+'.'+_0x216f2a+_0xe3c8('0x15')+_0x50e959+'.'+_0x216f2a)['where'](_0x2eb76d+_0xe3c8('0x16')+_0x4c24b6[_0xe3c8('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x45c7c3,_0x1b3615){promisesAdditionalPhones=[];promisesContact=[];return db[_0xe3c8('0x18')][_0xe3c8('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0xe3c8('0x1a')](function(_0x138dc8){if(_0x138dc8!==null){var _0x599149=[];for(var _0x7b146b=0x0;_0x7b146b<_0x138dc8[_0xe3c8('0x1b')];_0x7b146b++){var _0x17e26c=_0x138dc8[_0x7b146b];if(!_['isNil'](_0x17e26c[_0xe3c8('0x12')])){if(!_[_0xe3c8('0x1c')](_0x17e26c[_0xe3c8('0x1d')]))_0x599149[_0xe3c8('0x1e')](insertAdditionalPhones(_0x17e26c));promisesContact[_0xe3c8('0x1e')]({'contact':_0x17e26c});}}}Promise[_0xe3c8('0x1f')](_0x599149)[_0xe3c8('0x20')](function(){_0x45c7c3({'val':0x1});});})['catch'](function(_0x2a073d){logger[_0xe3c8('0x21')](_0x2a073d[_0xe3c8('0x22')]);});});}function insertAdditionalPhones(_0x44f4eb){return new Promise(function(_0x3692c7,_0x2fd61e){var _0x4907ed=_0x44f4eb[_0xe3c8('0x1d')];if(_[_0xe3c8('0x1c')](_0x4907ed))_0x2fd61e({'val':0x0});else{var _0x499665=_0x4907ed[_0xe3c8('0x23')](';');var _0x44bf1d=[];orderBy=0x0;for(var _0x5396ea=0x0;_0x5396ea<_0x499665[_0xe3c8('0x1b')];_0x5396ea++){_0x44bf1d[_0xe3c8('0x1e')](splitAdditionalPhone(_0x44f4eb['id'],_0x499665[_0x5396ea]));}Promise['all'](_0x44bf1d)[_0xe3c8('0x20')](function(){_0x3692c7({'val':_0x499665[_0xe3c8('0x1b')]});});}});}function splitAdditionalPhone(_0x2558b8,_0x33ee35){return new Promise(function(_0x1f5bf8,_0x4ddae1){var _0x1665c6=_0x33ee35['split'](':');var _0x4a0cfb=_0x1665c6[0x0];var _0x4b9fa5=_0x1665c6[0x1];if(_0x4b9fa5!==''){var _0xf2f111=_0x4b9fa5['split']('|');var _0x350134=[];for(var _0x27887a=0x0;_0x27887a<_0xf2f111['length'];_0x27887a++){if(_0xf2f111[_0x27887a]!==''){var _0x2e02bf=_['filter'](promisesAdditionalPhones,{'contactId':_0x2558b8,'phone':_0xf2f111[_0x27887a]});if(_0x2e02bf[_0xe3c8('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0xe3c8('0x1e')]({'contactId':_0x2558b8,'contactTypeId':_0x4a0cfb,'phone':_0xf2f111[_0x27887a],'orderBy':orderBy});}}}_0x1f5bf8({'ok':0x1});}else _0x1f5bf8({'res':0x0});});}function createAdditionalPhone(_0xb4187b,_0x3e375b,_0xca96ed,_0x182d57){var _0x9d9e45='';var _0x497448='';var _0x56b742=_0xca96ed[_0xe3c8('0x23')]('§');_0x9d9e45=_0x56b742[0x0];if(_0x56b742[_0xe3c8('0x1b')]==0x2)_0x497448=_0x56b742[0x1];return new Promise(function(_0x40d365,_0x564b86){return db[_0xe3c8('0x24')][_0xe3c8('0x25')]({'where':{'CmContactId':_0xb4187b,'item':_0x9d9e45}})[_0xe3c8('0x20')](function(_0x1d5da7){if(_0x1d5da7){return db['CmContactHasItem'][_0xe3c8('0x26')]({'ItemTypeId':_0x3e375b,'description':_0x497448,'OrderBy':_0x182d57},{'where':{'CmContactId':_0xb4187b,'item':_0x9d9e45}})['then'](function(_0x364fa3){_0x40d365({'res':_0xe3c8('0x27')});});}else{return db[_0xe3c8('0x24')][_0xe3c8('0x28')]({'CmContactId':_0xb4187b,'item':_0x9d9e45,'ItemTypeId':_0x3e375b,'description':_0x497448,'OrderBy':_0x182d57,'ItemClass':'PHONE'})[_0xe3c8('0x20')](function(_0xb0e545){_0x40d365({'res':_0xe3c8('0x29')});});}});});}function updateContact(_0x4bfd46){return new Promise(function(_0x309dc2,_0x2a2cc8){var _0x111fd6=_0x4bfd46['id'];delete _0x4bfd46['id'];return db[_0xe3c8('0x2a')][_0xe3c8('0x26')](_0x4bfd46,{'where':{'id':_0x111fd6}})[_0xe3c8('0x20')](function(_0x5411a3){updatedRows+=0x1;return db[_0xe3c8('0x2b')]['update']({'phone':_0x4bfd46[_0xe3c8('0x12')]},{'where':{'ContactId':_0x111fd6}})[_0xe3c8('0x20')](function(_0x1e9912){_0x309dc2({'ret':'OK'});});});});}function insertCmHopper(_0xf4cea5,_0x179faa,_0x13333a,_0x973a85,_0x212bb9){var _0x553991=[_0xe3c8('0x2c'),'cm_contacts.scheduledat','cm_contacts.id',_0xe3c8('0x2d'),_0x179faa+'.'+_0x973a85,_0xe3c8('0x2e'),_0xe3c8('0x2f'),_0xe3c8('0x30'),'cm_contacts.UserId','\x22'+_0x212bb9+'\x22'];return squel[_0xe3c8('0x31')]()['into'](_0xe3c8('0x32'))[_0xe3c8('0x33')]([_0xe3c8('0x12'),_0xe3c8('0x34'),_0xe3c8('0x35'),_0xe3c8('0x36'),_0x973a85,_0xe3c8('0x37'),_0xe3c8('0x38'),_0xe3c8('0x39'),_0xe3c8('0x3a'),_0xe3c8('0x3b')],squel['select']()['fields'](_0x553991)[_0xe3c8('0x3c')](_0x179faa)[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x3e')+_0x179faa+'.CmListId')[_0xe3c8('0x17')](_0x13333a,null,_0x13333a+'.id\x20=\x20'+_0x179faa+'.'+_0x973a85)[_0xe3c8('0x14')](_0x179faa+_0xe3c8('0x3f'),_0xf4cea5)[_0xe3c8('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xe3c8('0x14')](_0xe3c8('0x40'),selectNotIn(_0x179faa,_0x13333a,_0x973a85,_0xe3c8('0x32'),[_0xe3c8('0x41'),_0xe3c8('0x42')]))[_0xe3c8('0x14')](_0xe3c8('0x40'),selectNotIn(_0x179faa,_0x13333a,_0x973a85,'cm_hopper',['\x22always\x22'])))[_0xe3c8('0x43')]();}function insertCmHopperBlack(_0x52e813,_0x30f63c,_0x2bd33f,_0x440858){var _0x152210=[_0xe3c8('0x2c'),_0xe3c8('0x44'),'cm_contacts.ListId',_0x30f63c+'.'+_0x440858,_0xe3c8('0x2e'),_0xe3c8('0x2f')];return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0xe3c8('0x36'),_0x440858,_0xe3c8('0x37'),_0xe3c8('0x38')],squel['select']()['fields'](_0x152210)[_0xe3c8('0x3c')](_0x30f63c)[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x3e')+_0x30f63c+_0xe3c8('0x46'))[_0xe3c8('0x17')](_0x2bd33f,null,_0x2bd33f+_0xe3c8('0x13')+_0x30f63c+'.'+_0x440858)['where'](_0x30f63c+_0xe3c8('0x3f'),_0x52e813)[_0xe3c8('0x14')](_0xe3c8('0x47'),NOW)[_0xe3c8('0x14')](_0xe3c8('0x40'),squel[_0xe3c8('0x11')]()['field'](_0xe3c8('0x12'))[_0xe3c8('0x3c')]('cm_hopper_black')['where'](_0xe3c8('0x48'),_0x52e813)[_0xe3c8('0x14')](_0x440858+'\x20=\x20?',_0x30f63c+'.'+_0x440858)))[_0xe3c8('0x43')]();}function insertCmHopperAdditionalPhones(_0x344d39){var _0x5138b3=[_0xe3c8('0x49'),_0xe3c8('0x4a'),_0xe3c8('0x4b'),_0xe3c8('0x4c'),_0xe3c8('0x4d')];return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_hopper_additional_phones')['fromQuery']([_0xe3c8('0x4e'),_0xe3c8('0x12'),_0xe3c8('0x4f'),_0xe3c8('0x37'),_0xe3c8('0x38')],squel['select']()[_0xe3c8('0x50')](_0x5138b3)[_0xe3c8('0x3c')](_0xe3c8('0x32'))[_0xe3c8('0x17')](_0xe3c8('0x3d'),null,_0xe3c8('0x51'))['join'](_0xe3c8('0x52'),null,_0xe3c8('0x53'))[_0xe3c8('0x14')](_0xe3c8('0x54'),_0x344d39)[_0xe3c8('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x3cbe3a,_0x1dc73d,_0x408e07,_0x331833){var _0x4183fe=_[_0xe3c8('0x55')](_[_0xe3c8('0x56')](_0x331833),[_0xe3c8('0x36'),_0xe3c8('0x57'),'createdAt',_0xe3c8('0x38')]);return squel[_0xe3c8('0x31')]()[_0xe3c8('0x45')]('cm_contacts')['fromQuery'](_0x4183fe,squel['select']()[_0xe3c8('0x50')](_0x4183fe)[_0xe3c8('0x3c')](_0x1dc73d)['where']('('+_0x408e07[_0xe3c8('0x17')](',')+_0xe3c8('0x58'),squel['select']()['fields'](_0x408e07)['from']('cm_contacts')['where'](_0xe3c8('0x48'),_0x3cbe3a))['where'](_0xe3c8('0x59'),squel[_0xe3c8('0x11')]()[_0xe3c8('0x5a')](_0xe3c8('0x5b'),_0xe3c8('0x5c'))[_0xe3c8('0x3c')](_0x1dc73d)[_0xe3c8('0x5d')](_0x408e07['join'](','))))[_0xe3c8('0x43')]();}function handleStop(){logger[_0xe3c8('0x5e')](_0xe3c8('0x5f'));stopped=!![];}function handleUncaughtException(_0xdb2ac1){logger['error'](_0xdb2ac1[_0xe3c8('0x22')]);process[_0xe3c8('0x60')](0x1);}function handleError(_0x1d0df,_0x27091c){stats[_0xe3c8('0x61')]['push']({'name':_0x27091c['code'],'message':_0x27091c[_0xe3c8('0x22')],'row':_0x1d0df});}function handleQuery(_0x283941){logger[_0xe3c8('0x5e')](_0x283941);return db['sequelize'][_0xe3c8('0x19')](_0x283941)[_0xe3c8('0x1a')](function(_0x2d427f){results['push'](_0x2d427f);})[_0xe3c8('0x62')](function(_0x5f58cb){logger[_0xe3c8('0x21')](_0x5f58cb[_0xe3c8('0x22')]);});}function main(_0x126072,_0x32df08,_0x573c16,_0xed36ec){logger[_0xe3c8('0x5e')](_0xe3c8('0x63'),_0x126072,JSON[_0xe3c8('0x64')](_0x32df08));process[_0xe3c8('0x65')](_0xe3c8('0x66'));var _0x311a89=_0x32df08['binding'];var _0x6cccd0=_[_0xe3c8('0x67')](_0x311a89);var _0x142df3=_0x32df08[_0xe3c8('0x68')];var _0x2679d1=path['join'](config[_0xe3c8('0x69')],_0xe3c8('0x6a'),_0x142df3+_0xe3c8('0x6b'));logger[_0xe3c8('0x5e')]('body',_0x32df08);db[_0xe3c8('0x6c')][_0xe3c8('0x6d')]({'raw':!![],'attributes':['id',_0xe3c8('0x6e')]})[_0xe3c8('0x20')](function(_0x21ac27){for(var _0xa5f2c9=0x0;_0xa5f2c9<_0x21ac27[_0xe3c8('0x1b')];_0xa5f2c9++){if(_0x21ac27[_0xa5f2c9]['name']in _0x311a89){contactItemTypes[_0xe3c8('0x1e')](_0x21ac27[_0xa5f2c9]);delete _0x6cccd0[_0x21ac27[_0xa5f2c9][_0xe3c8('0x6e')]];hasAdditionalPhones=!![];}for(var _0x526947 in _0x311a89){if(_0x21ac27[_0xa5f2c9][_0xe3c8('0x6e')]+_0xe3c8('0x6f')===_0x526947){phoneDescriptions['push']({'itemTypeId':_0x21ac27[_0xa5f2c9]['id'],'description':_0x526947});delete _0x6cccd0[_0x526947];}}}if(hasAdditionalPhones)_0x6cccd0[_0xe3c8('0x1d')]='';var _0x965bc3=_['keys'](_0x6cccd0)[_0xe3c8('0x17')]();logger[_0xe3c8('0x5e')](_0xe3c8('0x70'),_0x965bc3);fs[_0xe3c8('0x71')](_0x2679d1,_0x965bc3+'\x0a');Papa['parse'](fs[_0xe3c8('0x72')](_0x126072),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4cf3da,_0x3a589c){try{for(var _0x22323a=0x0,_0x181bf0=[];_0x22323a<_0x4cf3da[_0xe3c8('0x73')]['length'];_0x22323a++){stats[_0xe3c8('0x74')]+=0x1;if(_0x4cf3da[_0xe3c8('0x61')][_0x22323a]){handleError(_0x4cf3da['data'][_0x22323a],_0x4cf3da[_0xe3c8('0x61')][_0x22323a]);}else{var _0x2ba998=[];var _0x4ae73f=[];var _0x390b5d={};for(var _0x15247a in _0x311a89){let _0x41cae0=contactItemTypes['find'](_0x5f63d4=>_0x5f63d4['name']===_0x15247a);let _0x484da2=contactItemTypes[_0xe3c8('0x75')](_0x3114f9=>_0x3114f9[_0xe3c8('0x6e')]+'_description'===_0x15247a);if(_[_0xe3c8('0x1c')](_0x41cae0)&&_[_0xe3c8('0x1c')](_0x484da2)){if(_0x311a89[_0xe3c8('0x76')](_0x15247a)){if(_0x4cf3da['data'][_0x22323a][_0x311a89[_0x15247a]]){var _0x32db65=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x15247a]]['replace'](/"/g,'\x27'));switch(_0x15247a){case _0xe3c8('0x34'):var _0x58b517=moment(_0x32db65,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x58b517[_0xe3c8('0x78')]()){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x79'));}break;case _0xe3c8('0x39'):var _0x110b4d=parseInt(_0x32db65);_0x32db65=_[_0xe3c8('0x7a')](_0x110b4d)||_0x110b4d<0x0||_0x110b4d>0x4?_0xed36ec?0x3:0x2:_0x110b4d;_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');break;case _0xe3c8('0x3a'):var _0x4bd818=parseInt(_0x32db65);if(_[_0xe3c8('0x7b')](_0x4bd818)&&_['includes'](_0x573c16,_0x4bd818)){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x4bd818+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x7c'));}break;case'email':if(isEmail(_0x32db65)){_0x181bf0['push']('\x22'+_0x32db65+'\x22');}else{_0x2ba998[_0xe3c8('0x1e')](_0xe3c8('0x7d'));}break;case _0xe3c8('0x7e'):var _0x390fe7=moment(_0x32db65,_0xe3c8('0x7f'),!![]);if(_0x390fe7[_0xe3c8('0x78')]()){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x32db65+'\x22');}else{_0x2ba998['push'](_0xe3c8('0x80'));}break;default:_0x181bf0['push']('\x22'+_0x32db65+'\x22');}}else{switch(_0x15247a){case'firstName':case'phone':_0x2ba998['push'](_0x15247a+_0xe3c8('0x81'));break;default:_0x181bf0[_0xe3c8('0x1e')]('\x22\x22');}}}}else{var _0x1beeae='';if(!_[_0xe3c8('0x1c')](_0x41cae0)){if(!_0x390b5d[_0xe3c8('0x76')](_0x41cae0['id'])){for(var _0x477dd0=0x0;_0x477dd0<_0x311a89[_0x15247a][_0xe3c8('0x1b')];_0x477dd0++){var _0x32db65=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x15247a][_0x477dd0]][_0xe3c8('0x82')](/"/g,'\x27'));var _0x2d0eca=phoneDescriptions[_0xe3c8('0x75')](_0x563f74=>_0x563f74['itemTypeId']===_0x41cae0['id']);if(!_[_0xe3c8('0x1c')](_0x2d0eca)){var _0x45c724=_[_0xe3c8('0x77')](_0x4cf3da[_0xe3c8('0x73')][_0x22323a][_0x311a89[_0x2d0eca[_0xe3c8('0x83')]][0x0]][_0xe3c8('0x82')](/"/g,'\x27'));if(!_[_0xe3c8('0x1c')](_0x45c724))_0x32db65=_0x32db65+'§'+_0x45c724;}if(_0x1beeae=='')_0x1beeae=_0x32db65;else _0x1beeae+='|'+_0x32db65;}_0x4ae73f[_0xe3c8('0x1e')](_0x41cae0['id']+':'+_0x1beeae);_0x390b5d[_0x41cae0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x181bf0[_0xe3c8('0x1e')]('\x22'+_0x4ae73f[_0xe3c8('0x17')](';')+'\x22');}if(_0x2ba998['length']){handleError(_0x4cf3da[_0xe3c8('0x73')][_0x22323a],{'code':_0xe3c8('0x84'),'message':_0x2ba998[_0xe3c8('0x17')]()});}else{fs[_0xe3c8('0x85')](_0x2679d1,_0x181bf0[_0xe3c8('0x17')]()+'\x0a');}_0x181bf0=[];}if(!(stats['rows']%0xc8)){socket[_0xe3c8('0x86')](_0xe3c8('0x87')+_0x142df3,stats);stats['errors']=[];}}if(stopped){logger[_0xe3c8('0x5e')](_0xe3c8('0x88'));_0x3a589c[_0xe3c8('0x89')]();}}catch(_0x221aa0){handleError(_0x4cf3da[_0xe3c8('0x73')][_0x22323a],{'code':_0xe3c8('0x8a'),'message':_0x221aa0[_0xe3c8('0x22')]});logger[_0xe3c8('0x21')]('step',_0x221aa0['message']);}},'complete':function(){try{var _0x3a7408=[];var _0x3a89ef=tempTableName;_0x3a7408['push']('CREATE\x20TABLE\x20'+_0x3a89ef+_0xe3c8('0x8b'));logger[_0xe3c8('0x5e')]('CIS\x20len',contactItemTypes[_0xe3c8('0x1b')]);var _0x612af5=util[_0xe3c8('0xe')](_0xe3c8('0x8c'),_0x2679d1,_0x3a89ef,_0x965bc3,_0x32df08['ListId'],_0x32df08['CompanyId']||null,NOW,NOW);if(_[_0xe3c8('0x1c')](_0x311a89[_0xe3c8('0x34')])){_0x612af5+=_0xe3c8('0x8d');}_0x3a7408[_0xe3c8('0x1e')](_0x612af5);BPromise[_0xe3c8('0x8e')](_0x3a7408,handleQuery)[_0xe3c8('0x20')](function(_0x5253a4){BPromise[_0xe3c8('0x1f')]([handleAdditionalPhones()])[_0xe3c8('0x20')](function(){_0x3a7408=[];for(var _0x5061b4=0x0;_0x5061b4\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','isNil','phone','AdditionalPhones','push','all','then','catch','error','split','length','filter','CmContactHasItem','PHONE','inserted','CmContact','CmHopper','update','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','ContactId','ListId','createdAt','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0x720f,0x185));var _0xf720=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x720f[_0x297fd3];return _0x2af381;};'use strict';var fs=require('fs');var path=require(_0xf720('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xf720('0x1'));var moment=require(_0xf720('0x2'));var squel=require(_0xf720('0x3'));var Redis=require(_0xf720('0x4'));var db=require(_0xf720('0x5'))['db'];var config=require(_0xf720('0x6'));var logger=require(_0xf720('0x7'))(_0xf720('0x8'));config[_0xf720('0x9')]=_[_0xf720('0xa')](config['redis'],{'host':_0xf720('0xb'),'port':0x18eb});var socket=require(_0xf720('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0xf720('0xd'));var tempTableName=_0xf720('0xe')+moment()['format'](_0xf720('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x41b251){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'](_0x41b251);}function selectNotIn(_0xddeab4,_0x4c1ccb,_0x509cb7,_0x4e995f,_0x54956e){return squel[_0xf720('0x10')]()[_0xf720('0x11')]('phone')[_0xf720('0x12')](_0x4e995f)[_0xf720('0x13')](_0x4c1ccb,null,_0x4c1ccb+_0xf720('0x14')+_0x4e995f+'.'+_0x509cb7)[_0xf720('0x15')](_0x4e995f+'.'+_0x509cb7+_0xf720('0x16')+_0xddeab4+'.'+_0x509cb7)[_0xf720('0x15')](_0x4c1ccb+_0xf720('0x17')+_0x54956e['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x381fa3,_0x4d5ba0){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf720('0x18')][_0xf720('0x19')](_0xf720('0x1a')+tempTableName)['spread'](function(_0x504e8a){if(_0x504e8a!==null){var _0x59de81=[];for(var _0xa56a3d=0x0;_0xa56a3d<_0x504e8a['length'];_0xa56a3d++){var _0xe4844a=_0x504e8a[_0xa56a3d];if(!_[_0xf720('0x1b')](_0xe4844a[_0xf720('0x1c')])){if(!_[_0xf720('0x1b')](_0xe4844a[_0xf720('0x1d')]))_0x59de81[_0xf720('0x1e')](insertAdditionalPhones(_0xe4844a));promisesContact['push']({'contact':_0xe4844a});}}}Promise[_0xf720('0x1f')](_0x59de81)[_0xf720('0x20')](function(){_0x381fa3({'val':0x1});});})[_0xf720('0x21')](function(_0x4a6646){logger[_0xf720('0x22')](_0x4a6646['message']);});});}function insertAdditionalPhones(_0x22003c){return new Promise(function(_0x541b29,_0x464c75){var _0x4ab375=_0x22003c['AdditionalPhones'];if(_[_0xf720('0x1b')](_0x4ab375))_0x464c75({'val':0x0});else{var _0x5d1ed2=_0x4ab375[_0xf720('0x23')](';');var _0x2ea7de=[];orderBy=0x0;for(var _0xc8e046=0x0;_0xc8e046<_0x5d1ed2['length'];_0xc8e046++){_0x2ea7de[_0xf720('0x1e')](splitAdditionalPhone(_0x22003c['id'],_0x5d1ed2[_0xc8e046]));}Promise[_0xf720('0x1f')](_0x2ea7de)[_0xf720('0x20')](function(){_0x541b29({'val':_0x5d1ed2[_0xf720('0x24')]});});}});}function splitAdditionalPhone(_0x1afdb4,_0x39f80a){return new Promise(function(_0x1f1241,_0x5ec591){var _0x8a2e0b=_0x39f80a['split'](':');var _0x372a0f=_0x8a2e0b[0x0];var _0x45b8c1=_0x8a2e0b[0x1];if(_0x45b8c1!==''){var _0x4dda43=_0x45b8c1[_0xf720('0x23')]('|');var _0x5117f4=[];for(var _0x38db53=0x0;_0x38db53<_0x4dda43[_0xf720('0x24')];_0x38db53++){if(_0x4dda43[_0x38db53]!==''){var _0x14eb89=_[_0xf720('0x25')](promisesAdditionalPhones,{'contactId':_0x1afdb4,'phone':_0x4dda43[_0x38db53]});if(_0x14eb89[_0xf720('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0xf720('0x1e')]({'contactId':_0x1afdb4,'contactTypeId':_0x372a0f,'phone':_0x4dda43[_0x38db53],'orderBy':orderBy});}}}_0x1f1241({'ok':0x1});}else _0x1f1241({'res':0x0});});}function createAdditionalPhone(_0x375ec4,_0x10d3c9,_0x15b739,_0x52166b){var _0x178bb3='';var _0x2ccc64='';var _0x468ab9=_0x15b739['split']('§');_0x178bb3=_0x468ab9[0x0];if(_0x468ab9[_0xf720('0x24')]==0x2)_0x2ccc64=_0x468ab9[0x1];return new Promise(function(_0x2ae589,_0x223cf2){return db[_0xf720('0x26')]['findOne']({'where':{'CmContactId':_0x375ec4,'item':_0x178bb3}})['then'](function(_0x42740c){if(_0x42740c){return db[_0xf720('0x26')]['update']({'ItemTypeId':_0x10d3c9,'description':_0x2ccc64,'OrderBy':_0x52166b},{'where':{'CmContactId':_0x375ec4,'item':_0x178bb3}})[_0xf720('0x20')](function(_0x364210){_0x2ae589({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x375ec4,'item':_0x178bb3,'ItemTypeId':_0x10d3c9,'description':_0x2ccc64,'OrderBy':_0x52166b,'ItemClass':_0xf720('0x27')})[_0xf720('0x20')](function(_0xa41a78){_0x2ae589({'res':_0xf720('0x28')});});}});});}function updateContact(_0x8918c9){return new Promise(function(_0x2a4aad,_0x3468ad){var _0x1e80f4=_0x8918c9['id'];delete _0x8918c9['id'];return db[_0xf720('0x29')]['update'](_0x8918c9,{'where':{'id':_0x1e80f4}})[_0xf720('0x20')](function(_0x53ac2e){updatedRows+=0x1;return db[_0xf720('0x2a')][_0xf720('0x2b')]({'phone':_0x8918c9['phone']},{'where':{'ContactId':_0x1e80f4}})[_0xf720('0x20')](function(_0x4b32d3){_0x2a4aad({'ret':'OK'});});});});}function insertCmHopper(_0x1f715e,_0xbd457b,_0x4bd400,_0x50acf9,_0xc7ae08){var _0x4e6a83=[_0xf720('0x2c'),_0xf720('0x2d'),_0xf720('0x2e'),_0xf720('0x2f'),_0xbd457b+'.'+_0x50acf9,_0xf720('0x30'),_0xf720('0x31'),'cm_contacts.priority',_0xf720('0x32'),'\x22'+_0xc7ae08+'\x22'];return squel[_0xf720('0x33')]()[_0xf720('0x34')](_0xf720('0x35'))[_0xf720('0x36')]([_0xf720('0x1c'),_0xf720('0x37'),'ContactId','ListId',_0x50acf9,'createdAt',_0xf720('0x38'),_0xf720('0x39'),_0xf720('0x3a'),_0xf720('0x3b')],squel[_0xf720('0x10')]()[_0xf720('0x3c')](_0x4e6a83)['from'](_0xbd457b)[_0xf720('0x13')](_0xf720('0x3d'),null,_0xf720('0x3e')+_0xbd457b+_0xf720('0x3f'))[_0xf720('0x13')](_0x4bd400,null,_0x4bd400+'.id\x20=\x20'+_0xbd457b+'.'+_0x50acf9)[_0xf720('0x15')](_0xbd457b+'.CmListId\x20=\x20?',_0x1f715e)['where'](_0xf720('0x40'),NOW)[_0xf720('0x15')](_0xf720('0x41'),selectNotIn(_0xbd457b,_0x4bd400,_0x50acf9,_0xf720('0x35'),[_0xf720('0x42'),_0xf720('0x43')]))['where'](_0xf720('0x41'),selectNotIn(_0xbd457b,_0x4bd400,_0x50acf9,_0xf720('0x35'),[_0xf720('0x42')])))[_0xf720('0x44')]();}function insertCmHopperBlack(_0x267b8b,_0x52e0ae,_0x4df083,_0x1157bc){var _0x2bf442=[_0xf720('0x2c'),_0xf720('0x2e'),_0xf720('0x2f'),_0x52e0ae+'.'+_0x1157bc,_0xf720('0x30'),_0xf720('0x31')];return squel['insert']()[_0xf720('0x34')](_0xf720('0x45'))['fromQuery']([_0xf720('0x1c'),_0xf720('0x46'),_0xf720('0x47'),_0x1157bc,_0xf720('0x48'),'updatedAt'],squel[_0xf720('0x10')]()[_0xf720('0x3c')](_0x2bf442)[_0xf720('0x12')](_0x52e0ae)[_0xf720('0x13')](_0xf720('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x52e0ae+_0xf720('0x3f'))[_0xf720('0x13')](_0x4df083,null,_0x4df083+'.id\x20=\x20'+_0x52e0ae+'.'+_0x1157bc)[_0xf720('0x15')](_0x52e0ae+_0xf720('0x49'),_0x267b8b)[_0xf720('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf720('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xf720('0x10')]()[_0xf720('0x11')]('phone')[_0xf720('0x12')]('cm_hopper_black')[_0xf720('0x15')](_0xf720('0x4a'),_0x267b8b)[_0xf720('0x15')](_0x1157bc+_0xf720('0x4b'),_0x52e0ae+'.'+_0x1157bc)))[_0xf720('0x44')]();}function insertCmHopperAdditionalPhones(_0x5354dd){var _0x1d5617=[_0xf720('0x4c'),'cm_contact_has_items.item',_0xf720('0x4d'),_0xf720('0x4e'),_0xf720('0x4f')];return squel[_0xf720('0x33')]()['into'](_0xf720('0x50'))['fromQuery']([_0xf720('0x51'),_0xf720('0x1c'),_0xf720('0x52'),_0xf720('0x48'),_0xf720('0x38')],squel[_0xf720('0x10')]()[_0xf720('0x3c')](_0x1d5617)[_0xf720('0x12')]('cm_hopper')['join'](_0xf720('0x3d'),null,_0xf720('0x53'))['join'](_0xf720('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf720('0x15')](_0xf720('0x55'),_0x5354dd)[_0xf720('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xf720('0x44')]();}function insertCmContact(_0x197f57,_0x11fe04,_0x57f1ea,_0x5f3c8f){var _0x2abce2=_[_0xf720('0x56')](_['keys'](_0x5f3c8f),['ListId','CompanyId',_0xf720('0x48'),'updatedAt']);return squel[_0xf720('0x33')]()['into'](_0xf720('0x3d'))['fromQuery'](_0x2abce2,squel['select']()[_0xf720('0x3c')](_0x2abce2)[_0xf720('0x12')](_0x11fe04)[_0xf720('0x15')]('('+_0x57f1ea[_0xf720('0x13')](',')+_0xf720('0x57'),squel[_0xf720('0x10')]()['fields'](_0x57f1ea)[_0xf720('0x12')](_0xf720('0x3d'))[_0xf720('0x15')](_0xf720('0x4a'),_0x197f57))['where'](_0xf720('0x58'),squel[_0xf720('0x10')]()[_0xf720('0x11')]('MIN(id)',_0xf720('0x59'))[_0xf720('0x12')](_0x11fe04)[_0xf720('0x5a')](_0x57f1ea[_0xf720('0x13')](','))))['toString']();}function handleStop(){logger[_0xf720('0x5b')](_0xf720('0x5c'));stopped=!![];}function handleUncaughtException(_0x1638f3){logger[_0xf720('0x22')](_0x1638f3[_0xf720('0x5d')]);process[_0xf720('0x5e')](0x1);}function handleError(_0x271e8c,_0x203a6a){stats[_0xf720('0x5f')][_0xf720('0x1e')]({'name':_0x203a6a[_0xf720('0x60')],'message':_0x203a6a[_0xf720('0x5d')],'row':_0x271e8c});}function handleQuery(_0x4e9916){logger[_0xf720('0x5b')](_0x4e9916);return db[_0xf720('0x18')]['query'](_0x4e9916)['spread'](function(_0x55a9fc){results['push'](_0x55a9fc);})['catch'](function(_0x565a82){logger[_0xf720('0x22')](_0x565a82[_0xf720('0x5d')]);});}function main(_0x15ed0f,_0x13e502,_0x510541,_0x126a10){logger[_0xf720('0x5b')]('main',_0x15ed0f,JSON[_0xf720('0x61')](_0x13e502));process[_0xf720('0x62')](_0xf720('0x63'));var _0x20d767=_0x13e502[_0xf720('0x64')];var _0x4896dc=_['clone'](_0x20d767);var _0x362725=_0x13e502['socket_timestamp'];var _0x1b5231=path[_0xf720('0x13')](config['root'],_0xf720('0x65'),_0x362725+_0xf720('0x66'));logger[_0xf720('0x5b')](_0xf720('0x67'),_0x13e502);db['ContactItemType'][_0xf720('0x68')]({'raw':!![],'attributes':['id','name']})[_0xf720('0x20')](function(_0x480ef8){for(var _0x45f14f=0x0;_0x45f14f<_0x480ef8[_0xf720('0x24')];_0x45f14f++){if(_0x480ef8[_0x45f14f]['name']in _0x20d767){contactItemTypes['push'](_0x480ef8[_0x45f14f]);delete _0x4896dc[_0x480ef8[_0x45f14f]['name']];hasAdditionalPhones=!![];}for(var _0x39f8ea in _0x20d767){if(_0x480ef8[_0x45f14f][_0xf720('0x69')]+_0xf720('0x6a')===_0x39f8ea){phoneDescriptions[_0xf720('0x1e')]({'itemTypeId':_0x480ef8[_0x45f14f]['id'],'description':_0x39f8ea});delete _0x4896dc[_0x39f8ea];}}}if(hasAdditionalPhones)_0x4896dc[_0xf720('0x1d')]='';var _0x624deb=_['keys'](_0x4896dc)['join']();logger['info'](_0xf720('0x6b'),_0x624deb);fs[_0xf720('0x6c')](_0x1b5231,_0x624deb+'\x0a');Papa[_0xf720('0x6d')](fs[_0xf720('0x6e')](_0x15ed0f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x23a9bf,_0x49d1b0){try{for(var _0x37b7bf=0x0,_0x7d93da=[];_0x37b7bf<_0x23a9bf[_0xf720('0x6f')][_0xf720('0x24')];_0x37b7bf++){stats[_0xf720('0x70')]+=0x1;if(_0x23a9bf[_0xf720('0x5f')][_0x37b7bf]){handleError(_0x23a9bf[_0xf720('0x6f')][_0x37b7bf],_0x23a9bf[_0xf720('0x5f')][_0x37b7bf]);}else{var _0xc85fcc=[];var _0x121054=[];var _0x41809c={};for(var _0x5503a7 in _0x20d767){let _0x53d636=contactItemTypes['find'](_0x3cb05f=>_0x3cb05f[_0xf720('0x69')]===_0x5503a7);let _0x351400=contactItemTypes['find'](_0x394606=>_0x394606['name']+_0xf720('0x6a')===_0x5503a7);if(_[_0xf720('0x1b')](_0x53d636)&&_[_0xf720('0x1b')](_0x351400)){if(_0x20d767[_0xf720('0x71')](_0x5503a7)){if(_0x23a9bf[_0xf720('0x6f')][_0x37b7bf][_0x20d767[_0x5503a7]]){var _0x36b78e=_['trim'](_0x23a9bf[_0xf720('0x6f')][_0x37b7bf][_0x20d767[_0x5503a7]]['replace'](/"/g,'\x27'));switch(_0x5503a7){case _0xf720('0x37'):var _0x342e49=moment(_0x36b78e,_0xf720('0xd'),!![]);if(_0x342e49[_0xf720('0x72')]()){_0x7d93da['push']('\x22'+_0x36b78e+'\x22');}else{_0xc85fcc[_0xf720('0x1e')](_0xf720('0x73'));}break;case'priority':var _0x17c236=parseInt(_0x36b78e);_0x36b78e=_['isNaN'](_0x17c236)||_0x17c236<0x0||_0x17c236>0x4?_0x126a10?0x3:0x2:_0x17c236;_0x7d93da['push']('\x22'+_0x36b78e+'\x22');break;case _0xf720('0x3a'):var _0x574def=parseInt(_0x36b78e);if(_[_0xf720('0x74')](_0x574def)&&_['includes'](_0x510541,_0x574def)){_0x7d93da[_0xf720('0x1e')]('\x22'+_0x574def+'\x22');}else{_0xc85fcc['push'](_0xf720('0x75'));}break;case _0xf720('0x76'):if(isEmail(_0x36b78e)){_0x7d93da['push']('\x22'+_0x36b78e+'\x22');}else{_0xc85fcc['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x1f8051=moment(_0x36b78e,'YYYY-MM-DD',!![]);if(_0x1f8051['isValid']()){_0x7d93da[_0xf720('0x1e')]('\x22'+_0x36b78e+'\x22');}else{_0xc85fcc[_0xf720('0x1e')](_0xf720('0x77'));}break;default:_0x7d93da[_0xf720('0x1e')]('\x22'+_0x36b78e+'\x22');}}else{switch(_0x5503a7){case'firstName':case _0xf720('0x1c'):_0xc85fcc[_0xf720('0x1e')](_0x5503a7+'\x20not\x20specified');break;default:_0x7d93da[_0xf720('0x1e')]('\x22\x22');}}}}else{var _0x2ed39e='';if(!_[_0xf720('0x1b')](_0x53d636)){if(!_0x41809c[_0xf720('0x71')](_0x53d636['id'])){for(var _0x48a08a=0x0;_0x48a08a<_0x20d767[_0x5503a7]['length'];_0x48a08a++){var _0x36b78e=_['trim'](_0x23a9bf[_0xf720('0x6f')][_0x37b7bf][_0x20d767[_0x5503a7][_0x48a08a]][_0xf720('0x78')](/"/g,'\x27'));var _0x12146e=phoneDescriptions[_0xf720('0x79')](_0x4e0d0f=>_0x4e0d0f[_0xf720('0x7a')]===_0x53d636['id']);if(!_[_0xf720('0x1b')](_0x12146e)){var _0x4d799f=_[_0xf720('0x7b')](_0x23a9bf[_0xf720('0x6f')][_0x37b7bf][_0x20d767[_0x12146e['description']][0x0]][_0xf720('0x78')](/"/g,'\x27'));if(!_[_0xf720('0x1b')](_0x4d799f))_0x36b78e=_0x36b78e+'§'+_0x4d799f;}if(_0x2ed39e=='')_0x2ed39e=_0x36b78e;else _0x2ed39e+='|'+_0x36b78e;}_0x121054[_0xf720('0x1e')](_0x53d636['id']+':'+_0x2ed39e);_0x41809c[_0x53d636['id']]=0x1;}}}}if(hasAdditionalPhones){_0x7d93da[_0xf720('0x1e')]('\x22'+_0x121054['join'](';')+'\x22');}if(_0xc85fcc['length']){handleError(_0x23a9bf[_0xf720('0x6f')][_0x37b7bf],{'code':'SystemRow','message':_0xc85fcc['join']()});}else{fs[_0xf720('0x7c')](_0x1b5231,_0x7d93da['join']()+'\x0a');}_0x7d93da=[];}if(!(stats[_0xf720('0x70')]%0xc8)){socket[_0xf720('0x7d')](_0xf720('0x7e')+_0x362725,stats);stats['errors']=[];}}if(stopped){logger[_0xf720('0x5b')](_0xf720('0x7f'));_0x49d1b0[_0xf720('0x80')]();}}catch(_0x488d93){handleError(_0x23a9bf[_0xf720('0x6f')][_0x37b7bf],{'code':_0xf720('0x81'),'message':_0x488d93['message']});logger[_0xf720('0x22')](_0xf720('0x82'),_0x488d93[_0xf720('0x5d')]);}},'complete':function(){try{var _0x579682=[];var _0x22b419=tempTableName;_0x579682[_0xf720('0x1e')](_0xf720('0x83')+_0x22b419+_0xf720('0x84'));logger[_0xf720('0x5b')](_0xf720('0x85'),contactItemTypes['length']);var _0x2d6cf6=util[_0xf720('0x86')](_0xf720('0x87'),_0x1b5231,_0x22b419,_0x624deb,_0x13e502['ListId'],_0x13e502[_0xf720('0x88')]||null,NOW,NOW);if(_['isNil'](_0x20d767['scheduledat'])){_0x2d6cf6+=_0xf720('0x89');}_0x579682[_0xf720('0x1e')](_0x2d6cf6);BPromise[_0xf720('0x8a')](_0x579682,handleQuery)[_0xf720('0x20')](function(_0x5d790f){BPromise['all']([handleAdditionalPhones()])[_0xf720('0x20')](function(){_0x579682=[];for(var _0x3388ea=0x0;_0x3388ea\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','mail','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','type','text','value','unreadMessages','read','and','Contact','$substring','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?'];(function(_0x501ded,_0x54ec7f){var _0x377b89=function(_0x47a6a0){while(--_0x47a6a0){_0x501ded['push'](_0x501ded['shift']());}};_0x377b89(++_0x54ec7f);}(_0x19ea,0xfe));var _0xa19e=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x19ea[_0x4e4f0e];return _0x1a7219;};'use strict';var _=require(_0xa19e('0x0'));var squel=require('squel');var as=require('../parsers/advancedSearch');var qs=require(_0xa19e('0x1'));var updateInteraction=require('./update-interaction')[_0xa19e('0x2')];var utils=require(_0xa19e('0x3'));var db=require(_0xa19e('0x4'))['db'];function skipInteractionsQuery(_0x4d323a,_0x4a6556,_0x1fac51){var _0x2a8e2c=![];var _0x29fe52=utils[_0xa19e('0x5')](_0x4d323a);if(_0x4a6556[_0xa19e('0x6')]===_0xa19e('0x7')&&!_0x1fac51[_0xa19e('0x8')]&&!_0x1fac51[_0x29fe52]){_0x2a8e2c=!![];}return _0x2a8e2c;}function getTagsQuery(){return squel[_0xa19e('0x9')]()[_0xa19e('0xa')]('id')[_0xa19e('0xa')](_0xa19e('0xb'))['field'](_0xa19e('0xc'))[_0xa19e('0xd')](_0xa19e('0xe'));}function getUsersQuery(_0x8e307b,_0x54bf8c){var _0x13818d=utils[_0xa19e('0xf')](_0x8e307b);var _0xfb8dbf='user_has_'+_0x8e307b+_0xa19e('0x10');var _0x1d63b6=squel[_0xa19e('0x9')]()[_0xa19e('0xa')](_0xa19e('0x11'))['field'](_0xa19e('0x12'))[_0xa19e('0xa')](_0xa19e('0x13')+_0x13818d)[_0xa19e('0xd')](_0xfb8dbf,'ui')[_0xa19e('0x14')](_0xa19e('0x15'),'u',_0xa19e('0x16'));if(_0x54bf8c[_0xa19e('0x17')]>0x0){_0x1d63b6[_0xa19e('0x18')](_0xa19e('0x13')+_0x13818d+_0xa19e('0x19'),_['map'](_0x54bf8c,'id'));}return _0x1d63b6;}function getInteractionsQuery(_0x28fd37){var _0x34066a=utils[_0xa19e('0x1a')](_0x28fd37);var _0x256819=utils[_0xa19e('0x5')](_0x28fd37);var _0x38e398=utils[_0xa19e('0xf')](_0x28fd37);return squel['select']()[_0xa19e('0xd')](_0x34066a['interactions'],'i')[_0xa19e('0x14')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa19e('0x14')](_0xa19e('0x15'),'o','o.id\x20=\x20i.UserId')[_0xa19e('0x14')](_0x34066a[_0xa19e('0x1b')],'a',_0xa19e('0x1c')+_0x256819)[_0xa19e('0x14')](_0x34066a['messages'],'me',_0xa19e('0x1d')+_0x38e398+_0xa19e('0x1e'))[_0xa19e('0x14')](_0x34066a[_0xa19e('0x1f')],'it',_0xa19e('0x20')+_0x38e398+_0xa19e('0x1e'))[_0xa19e('0x14')](_0xa19e('0xe'),'t',_0xa19e('0x21'));}function getSqlClauses(){var _0x536386={'body':squel[_0xa19e('0x22')](),'contact':squel[_0xa19e('0x22')](),'default':squel['expr'](),'fields':squel[_0xa19e('0x22')](),'filter':squel[_0xa19e('0x22')](),'read':squel['expr'](),'tags':{'clause':squel[_0xa19e('0x22')](),'ids':null},'user':squel[_0xa19e('0x22')]()};return _0x536386;}function parseTagParameter(_0x5d5559){var _0x40dc1c=squel[_0xa19e('0x22')]();if(_0x5d5559){var _0x2bd823=utils[_0xa19e('0x23')](_0x5d5559);_0x2bd823[_0xa19e('0x24')](function(_0x180407){_0x40dc1c['or'](_0xa19e('0x25'),'%,'+_0x180407+',%');});}return _0x40dc1c;}function parseReadParameter(_0x3f5ac6){var _0x18c96f='';if(_0x3f5ac6){_0x18c96f=_0xa19e('0x26');if(_0x3f5ac6==='1'){_0x18c96f=_0x18c96f[_0xa19e('0x27')](_0xa19e('0x28'),'=');}else{_0x18c96f=_0x18c96f[_0xa19e('0x27')](_0xa19e('0x28'),'>');}}return _0x18c96f;}function parseSearchFilter(_0xdf0b20,_0x4613c3){var _0x16bcd5=squel[_0xa19e('0x22')]();if(_0x4613c3){var _0x3dcd74=_0x4613c3[_0xa19e('0x27')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xa19e('0x29')](_0x3dcd74)){_0x16bcd5['or'](_0xa19e('0x2a'),_0x3dcd74+'%');if([_0xa19e('0x2b'),_0xa19e('0x2c')][_0xa19e('0x2d')](_0xdf0b20)){_0x16bcd5['or'](_0xa19e('0x2e'),_0x3dcd74+'%');}else if(_0xdf0b20==='fax'){_0x16bcd5['or'](_0xa19e('0x2f'),_0x3dcd74+'%');}else if(_0xdf0b20===_0xa19e('0x30')){_0x16bcd5['or']('i.from\x20LIKE\x20?',_0x3dcd74+'%');}}else if(_0xdf0b20===_0xa19e('0x31')&&qs['isEmail'](_0x3dcd74)){_0x16bcd5['or']('c.email\x20LIKE\x20?',_0x3dcd74+'%');}else{if(_0xdf0b20===_0xa19e('0x31')){_0x16bcd5['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3dcd74))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa19e('0x32')](_0x3dcd74));}else{if(_0xdf0b20!==_0xa19e('0x33')){_0x16bcd5['or'](_0xa19e('0x34'),qs['getFullTextValue'](_0x3dcd74));}_0x16bcd5['or'](_0xa19e('0x35'),_0x3dcd74+'%');}}}return _0x16bcd5;}function parseAdvancedSearchFilter(_0x3f959c,_0x1f9af3){var _0x288a41=getSqlClauses();var _0xf857e7=as[_0xa19e('0x36')](_0x3f959c);var _0x53899a=_0xf857e7[_0xa19e('0x37')];for(var _0x434081=0x0;_0x434081<_0xf857e7['conditions'][_0xa19e('0x17')];_0x434081++){var _0x12b20a=_0xf857e7[_0xa19e('0x38')][_0x434081];var _0x5824c5='i';var _0x4bf11f=_[_0xa19e('0x39')](_0x1f9af3,['name',_0x12b20a[_0xa19e('0xa')]]);if(_0x4bf11f){var _0x13b2f8=as[_0xa19e('0x3a')](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41['default'][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8[_0xa19e('0x3d')]['start'],_0x13b2f8[_0xa19e('0x3d')]['end']);}else{switch(_0x12b20a[_0xa19e('0xa')]){case _0xa19e('0x3e'):var _0x209424=parseReadParameter(_0x12b20a['value']);_0x288a41[_0xa19e('0x3f')][_0xa19e('0x40')](_0x209424);break;case _0xa19e('0x41'):if(_0x12b20a['operator']===_0xa19e('0x42')){if(_0x12b20a[_0xa19e('0x3d')]['split']('\x20')['length']>0x1){_0x288a41[_0xa19e('0x43')][_0x53899a](_0xa19e('0x44'),qs['getFullTextValue'](_0x12b20a[_0xa19e('0x3d')]),null);}else{var _0x2d43b4='%'+_0x12b20a['value']+'%';_0x288a41[_0xa19e('0x43')][_0x53899a](_0xa19e('0x45'),_0x2d43b4,_0x2d43b4,_0x2d43b4);}}else{_0x4bf11f=_[_0xa19e('0x39')](_0x1f9af3,[_0xa19e('0xb'),_0xa19e('0x46')]);_0x12b20a['field']=_0xa19e('0x46');_0x13b2f8=as[_0xa19e('0x3a')](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41[_0xa19e('0x43')][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8['value'][_0xa19e('0x47')],_0x13b2f8['value'][_0xa19e('0x48')]);}break;case _0xa19e('0x49'):var _0x5d493c=_0x12b20a[_0xa19e('0x3d')][_0xa19e('0x4a')](',')['map'](function(_0x41d7ae){return Number(_0x41d7ae);});var _0x5b58b1=parseTagParameter(_0x5d493c);_0x288a41[_0xa19e('0x4b')][_0xa19e('0x4c')][_0xa19e('0x40')](_0x5b58b1);_0x288a41[_0xa19e('0x4b')][_0xa19e('0x4d')]=_0x5d493c;break;case _0xa19e('0x4e'):if(_0x12b20a[_0xa19e('0x4f')]===_0xa19e('0x42')){_0x288a41['user'][_0x53899a](_0xa19e('0x50'),'%'+_0x12b20a[_0xa19e('0x3d')]+'%',null);}else{_0x4bf11f=_['find'](_0x1f9af3,['name',_0xa19e('0x51')]);_0x12b20a[_0xa19e('0xa')]=_0xa19e('0x51');_0x13b2f8=as['buildExpression'](_0x5824c5,_0x4bf11f[_0xa19e('0x3b')],_0x12b20a);_0x288a41[_0xa19e('0x52')][_0x53899a](_0x13b2f8['text'],_0x13b2f8[_0xa19e('0x3d')][_0xa19e('0x47')],_0x13b2f8[_0xa19e('0x3d')]['end']);}break;case _0xa19e('0x53'):case'plainBody':_0x13b2f8=as[_0xa19e('0x3a')]('me',null,_0x12b20a);_0x288a41[_0xa19e('0x53')][_0x53899a](_0x13b2f8[_0xa19e('0x3c')],_0x13b2f8[_0xa19e('0x3d')][_0xa19e('0x47')],_0x13b2f8['value'][_0xa19e('0x48')]);break;}}}return _0x288a41;}function parseModelFields(_0x4c90fe,_0x4779d8,_0x5d2e5f){var _0x17e36e=utils[_0xa19e('0x5')](_0x4c90fe);var _0x2db3b2=squel[_0xa19e('0x22')]();var _0x538c9a=_(_0x4779d8)[_0xa19e('0x54')]()[_0xa19e('0x55')](function(_0x427214){return _[_0xa19e('0x56')](_0x5d2e5f,['name',_0x427214])?_0x427214:undefined;})[_0xa19e('0x57')]()['value']();if(_0x538c9a[_0xa19e('0x17')]>0x0){_0x538c9a[_0xa19e('0x24')](function(_0x3309ec){if(_0x3309ec===_0x17e36e){_0x2db3b2['and']('i.'+_0x17e36e+_0xa19e('0x19'),[][_0xa19e('0x58')](_0x4779d8[_0x3309ec]));}else if(_0x3309ec==='createdAt'){var _0x101576=JSON[_0xa19e('0x59')](_0x4779d8[_0x3309ec])[_0xa19e('0x5a')];var _0x3f8751=JSON['parse'](_0x4779d8[_0x3309ec])['$lte'];_0x2db3b2[_0xa19e('0x40')](_0xa19e('0x5b'),_0x101576,_0x3f8751);}else{if(_0x4779d8[_0x3309ec]==='null'){_0x2db3b2[_0xa19e('0x40')]('i.'+_0x3309ec+_0xa19e('0x5c'));}else{_0x2db3b2['and']('i.'+_0x3309ec+_0xa19e('0x5d'),_0x4779d8[_0x3309ec]);}}});}return _0x2db3b2;}function parseQueryParameters(_0x68e0d1,_0x44a946,_0x22890b){var _0x3cc870=getSqlClauses();return Promise[_0xa19e('0x5e')]()[_0xa19e('0x5f')](function(){return parseModelFields(_0x68e0d1,_0x44a946,_0x22890b);})[_0xa19e('0x5f')](function(_0x9008e4){_0x3cc870[_0xa19e('0x60')][_0xa19e('0x40')](_0x9008e4);return parseReadParameter(_0x44a946['read']);})['then'](function(_0x2f37b0){_0x3cc870[_0xa19e('0x3f')][_0xa19e('0x40')](_0x2f37b0);return parseTagParameter(_0x44a946['tag']);})['then'](function(_0x51b2cc){_0x3cc870[_0xa19e('0x4b')]['clause'][_0xa19e('0x40')](_0x51b2cc);return parseSearchFilter(_0x68e0d1,_0x44a946[_0xa19e('0x61')]);})[_0xa19e('0x5f')](function(_0xdf2b29){_0x3cc870['filter']=_0xdf2b29;return _0x3cc870;});}function checkAccountsRestrictions(_0x966a23,_0xe4bb66,_0x437292){var _0xfe4a4=utils[_0xa19e('0x5')](_0x966a23);var _0x12064e=_0xa19e('0x62')+_[_0xa19e('0x63')](_0x966a23)+(_0x966a23===_0xa19e('0x64')?_0xa19e('0x65'):_0xa19e('0x66'));var _0xae7dbc=squel[_0xa19e('0x22')]();return Promise[_0xa19e('0x5e')]()[_0xa19e('0x5f')](function(){if(_0x437292[_0xa19e('0x8')]&&_0xe4bb66[_0xa19e('0x6')]==='agent'){return _0xe4bb66[_0x12064e]({'attributes':['id'],'raw':!![]});}})[_0xa19e('0x5f')](function(_0x3cf325){if(_0x3cf325){if(_0x3cf325['length']===0x0){_0xae7dbc[_0xa19e('0x40')]('i.'+_0xfe4a4+'\x20IS\x20NULL');}else{_0xae7dbc['and']('i.'+_0xfe4a4+_0xa19e('0x19'),_[_0xa19e('0x55')](_0x3cf325,'id'));}}else if(!_0x437292[_0xfe4a4]){_0xae7dbc[_0xa19e('0x40')]('i.'+_0xfe4a4+'\x20IS\x20NOT\x20NULL');}})[_0xa19e('0x5f')](function(){return _0xae7dbc;});}function getClosedOrderClause(_0x4ad542,_0x462a4e){var _0x5afd28='';var _0x423d57=[_0xa19e('0x67'),_0xa19e('0x68'),_0xa19e('0x69')];if(_0x4ad542===_0xa19e('0x31')){_0x423d57['unshift'](_0xa19e('0x6a'));}if(_0x462a4e['closed']==='0'&&_0x4ad542===_0xa19e('0x31')){_0x5afd28=_0xa19e('0x6a');}else{if(_0x462a4e[_0xa19e('0x6b')]==='1'){_0x423d57[_0xa19e('0x6c')]();}_0x5afd28=_0xa19e('0x6d')+_0x423d57[_0xa19e('0x6e')](',\x20')+')';}return _0x5afd28;}function getFilteredInteractions(_0x9d442b,_0x331b17,_0x340df1,_0x3f6bf7){var _0x307a5d=utils[_0xa19e('0xf')](_0x9d442b);var _0x481e43=_[_0xa19e('0x63')](_0x9d442b)+_0xa19e('0x6f');var _0x5ca466=[];var _0x4195c9=getTagsQuery();var _0x53a806={'type':db[_0xa19e('0x70')]['QueryTypes'][_0xa19e('0x71')],'raw':!![]};var _0x45f260=[];var _0x52159a=[];return db[_0xa19e('0x72')]['query'](_0x4195c9[_0xa19e('0x73')](),_0x53a806)[_0xa19e('0x5f')](function(_0x14da59){_0x5ca466=_[_0xa19e('0x74')](_0x14da59,'id');_0x53a806=_[_0xa19e('0x75')](_0x53a806,{'model':db[_0x481e43],'mapToModel':!![],'nest':!![]});if(_0x340df1[_0xa19e('0x60')]){_0x3f6bf7['attributes'][_0xa19e('0x24')](function(_0x45e5f6){_0x331b17[_0xa19e('0xa')]('i.'+_0x45e5f6);});}else{_0x331b17['field'](_0xa19e('0x76'),_0xa19e('0x3e'));_0x331b17[_0xa19e('0xa')]('a.key',_0xa19e('0x77'));_0x331b17[_0xa19e('0xa')]('a.mandatoryDisposition',_0xa19e('0x78'));if(_0x9d442b===_0xa19e('0x31')){_0x331b17[_0xa19e('0xa')]('a.email',_0xa19e('0x79'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7a'),_0xa19e('0x7b'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7c'));_0x331b17[_0xa19e('0xa')]('i.createdAt');_0x331b17[_0xa19e('0xa')](_0xa19e('0x7d'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7e'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x7f'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x80'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x81'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x82'));_0x331b17[_0xa19e('0xa')]('i.subject');_0x331b17[_0xa19e('0xa')](_0xa19e('0x69'));_0x331b17['field'](_0xa19e('0x68'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x67'));_0x331b17['field'](_0xa19e('0x6a'));_0x331b17['field']('i.to');_0x331b17['field'](_0xa19e('0x83'));_0x331b17['field'](_0xa19e('0x84'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x85'));}else if(_0x9d442b==='openchannel'){_0x331b17[_0xa19e('0xa')](_0xa19e('0x86'),_0xa19e('0x7b'));}else{_0x331b17[_0xa19e('0xa')](_0xa19e('0x87'),_0xa19e('0x7b'));}if(_0x9d442b!==_0xa19e('0x31')){_0x331b17[_0xa19e('0xa')]('i.*');}_0x331b17[_0xa19e('0xa')]('c.firstName',_0xa19e('0x88'));_0x331b17['field'](_0xa19e('0x89'),_0xa19e('0x8a'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x8b'),_0xa19e('0x8c'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x8d'),'Contact.phone');_0x331b17[_0xa19e('0xa')](_0xa19e('0x8e'),_0xa19e('0x8f'));_0x331b17[_0xa19e('0xa')]('c.fax',_0xa19e('0x90'));_0x331b17['field']('o.fullname','Owner.fullname');_0x331b17[_0xa19e('0xa')](_0xa19e('0x91'),_0xa19e('0x92'));_0x331b17[_0xa19e('0xa')](_0xa19e('0x93'),_0xa19e('0x94'));}if(_0x3f6bf7['limit']){_0x331b17[_0xa19e('0x95')](_0x3f6bf7['limit']);}if(_0x3f6bf7[_0xa19e('0x96')]){_0x331b17['offset'](_0x3f6bf7['offset']);}return db['sequelize'][_0xa19e('0x97')](_0x331b17[_0xa19e('0x73')](),_0x53a806);})[_0xa19e('0x5f')](function(_0x29177c){_0x45f260=_0x29177c;var _0x45ae6d=getUsersQuery(_0x9d442b,_0x45f260);return db[_0xa19e('0x72')][_0xa19e('0x97')](_0x45ae6d[_0xa19e('0x73')](),_0x53a806);})[_0xa19e('0x5f')](function(_0x23cefa){_0x52159a=_[_0xa19e('0x98')](_0x23cefa,_0x307a5d);if(_0x9d442b===_0xa19e('0x31')){return db['Setting'][_0xa19e('0x99')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x444a6e){var _0x23b6d9=_0x444a6e?_0x444a6e[_0xa19e('0x9a')]:undefined;var _0x3f2610=_0x45f260[_0xa19e('0x55')](function(_0x2ce237){return updateInteraction(_0x2ce237,_0x5ca466,_0x52159a,_0x23b6d9);});return Promise[_0xa19e('0x9b')](_0x3f2610);});}function countFilteredInteractions(_0x1c77d4,_0x52e038){var _0xc1d84e=_0x1c77d4[_0xa19e('0x9c')]();_0xc1d84e['field'](_0xa19e('0x9d'));_0xc1d84e[_0xa19e('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');var _0x12cb29=utils[_0xa19e('0x23')](_0x52e038);if(!_[_0xa19e('0x9e')](_0x12cb29)){_0xc1d84e[_0xa19e('0x18')](_0xa19e('0x9f'),_0x12cb29);}var _0x195f22={'type':db[_0xa19e('0x70')][_0xa19e('0xa0')][_0xa19e('0x71')],'raw':!![]};return db[_0xa19e('0x72')][_0xa19e('0x97')](_0xc1d84e[_0xa19e('0x73')](),_0x195f22);}module[_0xa19e('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd52a=['Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','findOne','enableEmailPreview','COUNT(*)','getSelectedTags','isEmpty','SELECT','squel','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','role','search','field','from','getInteractionFK','select','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getAccountFK','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','value','start','end','unreadMessages','and','Contact','operator','$substring','contact','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','text','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','read','filter','capitalize','chat','Websites','Accounts','resolve','agent','\x20IS\x20NOT\x20NULL','i.disposition','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','sequelize','query','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0xd52a,0xca));var _0xad52=function(_0x463c8b,_0x280a03){_0x463c8b=_0x463c8b-0x0;var _0x3fad8f=_0xd52a[_0x463c8b];return _0x3fad8f;};'use strict';var _=require('lodash');var squel=require(_0xad52('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xad52('0x1'));var updateInteraction=require(_0xad52('0x2'))[_0xad52('0x3')];var utils=require('./utils');var db=require(_0xad52('0x4'))['db'];function skipInteractionsQuery(_0x383c44,_0x130d6d,_0x27cbf3){var _0x4ed1e9=![];var _0x525806=utils['getAccountFK'](_0x383c44);if(_0x130d6d[_0xad52('0x5')]==='agent'&&!_0x27cbf3[_0xad52('0x6')]&&!_0x27cbf3[_0x525806]){_0x4ed1e9=!![];}return _0x4ed1e9;}function getTagsQuery(){return squel['select']()[_0xad52('0x7')]('id')[_0xad52('0x7')]('name')[_0xad52('0x7')]('color')[_0xad52('0x8')]('tools_tags');}function getUsersQuery(_0x125d8a,_0xfd0d43){var _0x2037fe=utils[_0xad52('0x9')](_0x125d8a);var _0x59e9e8='user_has_'+_0x125d8a+'_interactions';var _0x25c86a=squel[_0xad52('0xa')]()[_0xad52('0x7')](_0xad52('0xb'))[_0xad52('0x7')](_0xad52('0xc'))[_0xad52('0x7')](_0xad52('0xd')+_0x2037fe)[_0xad52('0x8')](_0x59e9e8,'ui')['left_join'](_0xad52('0xe'),'u',_0xad52('0xf'));if(_0xfd0d43[_0xad52('0x10')]>0x0){_0x25c86a[_0xad52('0x11')](_0xad52('0xd')+_0x2037fe+_0xad52('0x12'),_[_0xad52('0x13')](_0xfd0d43,'id'));}return _0x25c86a;}function getInteractionsQuery(_0x3aed76){var _0x450099=utils['getInteractionsTables'](_0x3aed76);var _0x4abd73=utils[_0xad52('0x14')](_0x3aed76);var _0x39128c=utils[_0xad52('0x9')](_0x3aed76);return squel[_0xad52('0xa')]()[_0xad52('0x8')](_0x450099['interactions'],'i')[_0xad52('0x15')]('cm_contacts','c',_0xad52('0x16'))[_0xad52('0x15')](_0xad52('0xe'),'o','o.id\x20=\x20i.UserId')[_0xad52('0x15')](_0x450099['accounts'],'a',_0xad52('0x17')+_0x4abd73)[_0xad52('0x15')](_0x450099[_0xad52('0x18')],'me',_0xad52('0x19')+_0x39128c+_0xad52('0x1a'))[_0xad52('0x15')](_0x450099['interactionsTags'],'it',_0xad52('0x1b')+_0x39128c+'\x20=\x20i.id')[_0xad52('0x15')](_0xad52('0x1c'),'t',_0xad52('0x1d'));}function getSqlClauses(){var _0x5bce67={'body':squel[_0xad52('0x1e')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0xad52('0x1e')](),'filter':squel['expr'](),'read':squel[_0xad52('0x1e')](),'tags':{'clause':squel[_0xad52('0x1e')](),'ids':null},'user':squel['expr']()};return _0x5bce67;}function parseTagParameter(_0x58adf5){var _0xb526bf=squel[_0xad52('0x1e')]();if(_0x58adf5){var _0x42db69=utils['getSelectedTags'](_0x58adf5);_0x42db69[_0xad52('0x1f')](function(_0x5771ce){_0xb526bf['or'](_0xad52('0x20'),'%,'+_0x5771ce+',%');});}return _0xb526bf;}function parseReadParameter(_0x3b5613){var _0x25fd54='';if(_0x3b5613){_0x25fd54=_0xad52('0x21');if(_0x3b5613==='1'){_0x25fd54=_0x25fd54['replace'](_0xad52('0x22'),'=');}else{_0x25fd54=_0x25fd54[_0xad52('0x23')]('{OPERATOR}','>');}}return _0x25fd54;}function parseSearchFilter(_0x3f5757,_0x3a0fd6){var _0x41d11b=squel[_0xad52('0x1e')]();if(_0x3a0fd6){var _0x32f4fe=_0x3a0fd6['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x32f4fe)){_0x41d11b['or'](_0xad52('0x24'),_0x32f4fe+'%');if([_0xad52('0x25'),_0xad52('0x26')]['includes'](_0x3f5757)){_0x41d11b['or']('i.phone\x20LIKE\x20?',_0x32f4fe+'%');}else if(_0x3f5757===_0xad52('0x27')){_0x41d11b['or'](_0xad52('0x28'),_0x32f4fe+'%');}else if(_0x3f5757===_0xad52('0x29')){_0x41d11b['or'](_0xad52('0x2a'),_0x32f4fe+'%');}}else if(_0x3f5757===_0xad52('0x2b')&&qs[_0xad52('0x2c')](_0x32f4fe)){_0x41d11b['or']('c.email\x20LIKE\x20?',_0x32f4fe+'%');}else{if(_0x3f5757===_0xad52('0x2b')){_0x41d11b['or'](_0xad52('0x2d'),qs[_0xad52('0x2e')](_0x32f4fe))['or'](_0xad52('0x2f'),qs[_0xad52('0x2e')](_0x32f4fe));}else{if(_0x3f5757!==_0xad52('0x27')){_0x41d11b['or'](_0xad52('0x30'),qs[_0xad52('0x2e')](_0x32f4fe));}_0x41d11b['or'](_0xad52('0x31'),_0x32f4fe+'%');}}}return _0x41d11b;}function parseAdvancedSearchFilter(_0x434762,_0x3bd0ca){var _0x5027c1=getSqlClauses();var _0x1745e0=as[_0xad52('0x32')](_0x434762);var _0x3fd2b7=_0x1745e0[_0xad52('0x33')];for(var _0x33c3e5=0x0;_0x33c3e5<_0x1745e0[_0xad52('0x34')]['length'];_0x33c3e5++){var _0x244140=_0x1745e0[_0xad52('0x34')][_0x33c3e5];var _0xc9461d='i';var _0x596a3a=_[_0xad52('0x35')](_0x3bd0ca,[_0xad52('0x36'),_0x244140[_0xad52('0x7')]]);if(_0x596a3a){var _0x4ad21c=as[_0xad52('0x37')](_0xc9461d,_0x596a3a[_0xad52('0x38')],_0x244140);_0x5027c1[_0xad52('0x39')][_0x3fd2b7](_0x4ad21c['text'],_0x4ad21c[_0xad52('0x3a')][_0xad52('0x3b')],_0x4ad21c[_0xad52('0x3a')][_0xad52('0x3c')]);}else{switch(_0x244140[_0xad52('0x7')]){case _0xad52('0x3d'):var _0x51b311=parseReadParameter(_0x244140[_0xad52('0x3a')]);_0x5027c1['read'][_0xad52('0x3e')](_0x51b311);break;case _0xad52('0x3f'):if(_0x244140[_0xad52('0x40')]===_0xad52('0x41')){if(_0x244140[_0xad52('0x3a')]['split']('\x20')[_0xad52('0x10')]>0x1){_0x5027c1[_0xad52('0x42')][_0x3fd2b7](_0xad52('0x43'),qs['getFullTextValue'](_0x244140[_0xad52('0x3a')]),null);}else{var _0x10b4d4='%'+_0x244140[_0xad52('0x3a')]+'%';_0x5027c1['contact'][_0x3fd2b7](_0xad52('0x44'),_0x10b4d4,_0x10b4d4,_0x10b4d4);}}else{_0x596a3a=_['find'](_0x3bd0ca,[_0xad52('0x36'),_0xad52('0x45')]);_0x244140[_0xad52('0x7')]=_0xad52('0x45');_0x4ad21c=as['buildExpression'](_0xc9461d,_0x596a3a[_0xad52('0x38')],_0x244140);_0x5027c1[_0xad52('0x42')][_0x3fd2b7](_0x4ad21c[_0xad52('0x46')],_0x4ad21c[_0xad52('0x3a')][_0xad52('0x3b')],_0x4ad21c[_0xad52('0x3a')][_0xad52('0x3c')]);}break;case _0xad52('0x47'):var _0x5a4fc1=_0x244140[_0xad52('0x3a')]['split'](',')[_0xad52('0x13')](function(_0x38c473){return Number(_0x38c473);});var _0x15baac=parseTagParameter(_0x5a4fc1);_0x5027c1[_0xad52('0x48')][_0xad52('0x49')][_0xad52('0x3e')](_0x15baac);_0x5027c1[_0xad52('0x48')][_0xad52('0x4a')]=_0x5a4fc1;break;case _0xad52('0x4b'):if(_0x244140[_0xad52('0x40')]===_0xad52('0x41')){_0x5027c1[_0xad52('0x4c')][_0x3fd2b7](_0xad52('0x4d'),'%'+_0x244140[_0xad52('0x3a')]+'%',null);}else{_0x596a3a=_[_0xad52('0x35')](_0x3bd0ca,[_0xad52('0x36'),_0xad52('0x4e')]);_0x244140[_0xad52('0x7')]=_0xad52('0x4e');_0x4ad21c=as[_0xad52('0x37')](_0xc9461d,_0x596a3a['type'],_0x244140);_0x5027c1[_0xad52('0x4c')][_0x3fd2b7](_0x4ad21c[_0xad52('0x46')],_0x4ad21c[_0xad52('0x3a')]['start'],_0x4ad21c[_0xad52('0x3a')]['end']);}break;case _0xad52('0x4f'):case'plainBody':_0x4ad21c=as['buildExpression']('me',null,_0x244140);_0x5027c1[_0xad52('0x4f')][_0x3fd2b7](_0x4ad21c[_0xad52('0x46')],_0x4ad21c[_0xad52('0x3a')][_0xad52('0x3b')],_0x4ad21c['value']['end']);break;}}}return _0x5027c1;}function parseModelFields(_0x254416,_0x5dede4,_0x207096){var _0x581f41=utils[_0xad52('0x14')](_0x254416);var _0x11d392=squel[_0xad52('0x1e')]();var _0x15d989=_(_0x5dede4)[_0xad52('0x50')]()[_0xad52('0x13')](function(_0x59c0d7){return _[_0xad52('0x51')](_0x207096,[_0xad52('0x36'),_0x59c0d7])?_0x59c0d7:undefined;})[_0xad52('0x52')]()[_0xad52('0x3a')]();if(_0x15d989['length']>0x0){_0x15d989[_0xad52('0x1f')](function(_0x413338){if(_0x413338===_0x581f41){_0x11d392[_0xad52('0x3e')]('i.'+_0x581f41+'\x20IN\x20?',[][_0xad52('0x53')](_0x5dede4[_0x413338]));}else if(_0x413338===_0xad52('0x54')){var _0x23400a=JSON[_0xad52('0x55')](_0x5dede4[_0x413338])['$gte'];var _0x32a6c3=JSON[_0xad52('0x55')](_0x5dede4[_0x413338])[_0xad52('0x56')];_0x11d392[_0xad52('0x3e')](_0xad52('0x57'),_0x23400a,_0x32a6c3);}else{if(_0x5dede4[_0x413338]==='null'){_0x11d392['and']('i.'+_0x413338+_0xad52('0x58'));}else{_0x11d392[_0xad52('0x3e')]('i.'+_0x413338+_0xad52('0x59'),_0x5dede4[_0x413338]);}}});}return _0x11d392;}function parseQueryParameters(_0x93114f,_0x2df920,_0x5298aa){var _0x21f850=getSqlClauses();return Promise['resolve']()[_0xad52('0x5a')](function(){return parseModelFields(_0x93114f,_0x2df920,_0x5298aa);})[_0xad52('0x5a')](function(_0x96bc15){_0x21f850['fields'][_0xad52('0x3e')](_0x96bc15);return parseReadParameter(_0x2df920['read']);})[_0xad52('0x5a')](function(_0x4218c6){_0x21f850[_0xad52('0x5b')]['and'](_0x4218c6);return parseTagParameter(_0x2df920['tag']);})[_0xad52('0x5a')](function(_0x4a5def){_0x21f850[_0xad52('0x48')][_0xad52('0x49')]['and'](_0x4a5def);return parseSearchFilter(_0x93114f,_0x2df920[_0xad52('0x5c')]);})['then'](function(_0x2d6ea9){_0x21f850[_0xad52('0x5c')]=_0x2d6ea9;return _0x21f850;});}function checkAccountsRestrictions(_0x6cce9f,_0x208eda,_0x516f43){var _0x5197d9=utils[_0xad52('0x14')](_0x6cce9f);var _0x12a38b='get'+_[_0xad52('0x5d')](_0x6cce9f)+(_0x6cce9f===_0xad52('0x5e')?_0xad52('0x5f'):_0xad52('0x60'));var _0x5b3ae8=squel[_0xad52('0x1e')]();return Promise[_0xad52('0x61')]()[_0xad52('0x5a')](function(){if(_0x516f43[_0xad52('0x6')]&&_0x208eda[_0xad52('0x5')]===_0xad52('0x62')){return _0x208eda[_0x12a38b]({'attributes':['id'],'raw':!![]});}})[_0xad52('0x5a')](function(_0x16807a){if(_0x16807a){if(_0x16807a['length']===0x0){_0x5b3ae8['and']('i.'+_0x5197d9+_0xad52('0x58'));}else{_0x5b3ae8[_0xad52('0x3e')]('i.'+_0x5197d9+_0xad52('0x12'),_['map'](_0x16807a,'id'));}}else if(!_0x516f43[_0x5197d9]){_0x5b3ae8[_0xad52('0x3e')]('i.'+_0x5197d9+_0xad52('0x63'));}})[_0xad52('0x5a')](function(){return _0x5b3ae8;});}function getClosedOrderClause(_0x54baff,_0x3be96f){var _0x5a3feb='';var _0xee30d1=['i.thirdDisposition','i.secondDisposition',_0xad52('0x64')];if(_0x54baff===_0xad52('0x2b')){_0xee30d1['unshift']('i.substatus');}if(_0x3be96f['closed']==='0'&&_0x54baff===_0xad52('0x2b')){_0x5a3feb=_0xad52('0x65');}else{if(_0x3be96f['closed']==='1'){_0xee30d1[_0xad52('0x66')]();}_0x5a3feb=_0xad52('0x67')+_0xee30d1[_0xad52('0x68')](',\x20')+')';}return _0x5a3feb;}function getFilteredInteractions(_0x529b16,_0x376187,_0x2622a4,_0x26935e){var _0x4fbcb1=utils['getInteractionFK'](_0x529b16);var _0x45a065=_[_0xad52('0x5d')](_0x529b16)+_0xad52('0x69');var _0xe22d76=[];var _0x57f90a=getTagsQuery();var _0x4d6b7a={'type':db['Sequelize'][_0xad52('0x6a')]['SELECT'],'raw':!![]};var _0x122753=[];var _0x3043f7=[];return db[_0xad52('0x6b')][_0xad52('0x6c')](_0x57f90a[_0xad52('0x6d')](),_0x4d6b7a)[_0xad52('0x5a')](function(_0xa4097c){_0xe22d76=_[_0xad52('0x6e')](_0xa4097c,'id');_0x4d6b7a=_[_0xad52('0x6f')](_0x4d6b7a,{'model':db[_0x45a065],'mapToModel':!![],'nest':!![]});if(_0x2622a4[_0xad52('0x70')]){_0x26935e[_0xad52('0x71')]['forEach'](function(_0x5c026a){_0x376187[_0xad52('0x7')]('i.'+_0x5c026a);});}else{_0x376187['field'](_0xad52('0x72'),_0xad52('0x3d'));_0x376187[_0xad52('0x7')]('a.key',_0xad52('0x73'));_0x376187['field']('a.mandatoryDisposition',_0xad52('0x74'));if(_0x529b16===_0xad52('0x2b')){_0x376187[_0xad52('0x7')](_0xad52('0x75'),_0xad52('0x76'));_0x376187['field'](_0xad52('0x77'),'contactName');_0x376187[_0xad52('0x7')](_0xad52('0x78'));_0x376187['field'](_0xad52('0x79'));_0x376187[_0xad52('0x7')](_0xad52('0x7a'));_0x376187[_0xad52('0x7')]('i.closed');_0x376187[_0xad52('0x7')](_0xad52('0x7b'));_0x376187[_0xad52('0x7')](_0xad52('0x7c'));_0x376187[_0xad52('0x7')](_0xad52('0x7d'));_0x376187[_0xad52('0x7')](_0xad52('0x7e'));_0x376187[_0xad52('0x7')](_0xad52('0x7f'));_0x376187['field'](_0xad52('0x64'));_0x376187[_0xad52('0x7')](_0xad52('0x80'));_0x376187['field'](_0xad52('0x81'));_0x376187[_0xad52('0x7')](_0xad52('0x65'));_0x376187[_0xad52('0x7')](_0xad52('0x82'));_0x376187[_0xad52('0x7')](_0xad52('0x83'));_0x376187[_0xad52('0x7')](_0xad52('0x84'));_0x376187[_0xad52('0x7')](_0xad52('0x85'));}else if(_0x529b16===_0xad52('0x29')){_0x376187[_0xad52('0x7')](_0xad52('0x86'),_0xad52('0x87'));}else{_0x376187[_0xad52('0x7')]('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',_0xad52('0x87'));}if(_0x529b16!==_0xad52('0x2b')){_0x376187[_0xad52('0x7')](_0xad52('0x88'));}_0x376187[_0xad52('0x7')](_0xad52('0x89'),_0xad52('0x8a'));_0x376187[_0xad52('0x7')](_0xad52('0x8b'),_0xad52('0x8c'));_0x376187['field'](_0xad52('0x8d'),_0xad52('0x8e'));_0x376187[_0xad52('0x7')](_0xad52('0x8f'),_0xad52('0x90'));_0x376187['field']('c.mobile','Contact.mobile');_0x376187[_0xad52('0x7')]('c.fax',_0xad52('0x91'));_0x376187['field']('o.fullname',_0xad52('0x92'));_0x376187[_0xad52('0x7')](_0xad52('0x93'),_0xad52('0x94'));_0x376187['field'](_0xad52('0x95'),'TagIds');}if(_0x26935e[_0xad52('0x96')]){_0x376187['limit'](_0x26935e[_0xad52('0x96')]);}if(_0x26935e['offset']){_0x376187[_0xad52('0x97')](_0x26935e[_0xad52('0x97')]);}return db['sequelize']['query'](_0x376187[_0xad52('0x6d')](),_0x4d6b7a);})[_0xad52('0x5a')](function(_0x5b2f8a){_0x122753=_0x5b2f8a;var _0x90ade5=getUsersQuery(_0x529b16,_0x122753);return db[_0xad52('0x6b')][_0xad52('0x6c')](_0x90ade5[_0xad52('0x6d')](),_0x4d6b7a);})[_0xad52('0x5a')](function(_0xd3cd9e){_0x3043f7=_[_0xad52('0x98')](_0xd3cd9e,_0x4fbcb1);if(_0x529b16==='mail'){return db['Setting'][_0xad52('0x99')]({'attributes':[_0xad52('0x9a')],'raw':!![]});}})[_0xad52('0x5a')](function(_0x17c2d0){var _0x4f8ebc=_0x17c2d0?_0x17c2d0[_0xad52('0x9a')]:undefined;var _0x291756=_0x122753[_0xad52('0x13')](function(_0x45b41a){return updateInteraction(_0x45b41a,_0xe22d76,_0x3043f7,_0x4f8ebc);});return Promise['all'](_0x291756);});}function countFilteredInteractions(_0xa5c2d0,_0x3cc1d9){var _0x1c310a=_0xa5c2d0['clone']();_0x1c310a[_0xad52('0x7')](_0xad52('0x9b'));_0x1c310a[_0xad52('0x7')](_0xad52('0x72'),_0xad52('0x3d'));var _0xae2453=utils[_0xad52('0x9c')](_0x3cc1d9);if(!_[_0xad52('0x9d')](_0xae2453)){_0x1c310a['where']('t.id\x20IN\x20?',_0xae2453);}var _0x52cf15={'type':db['Sequelize'][_0xad52('0x6a')][_0xad52('0x9e')],'raw':!![]};return db[_0xad52('0x6b')][_0xad52('0x6c')](_0x1c310a[_0xad52('0x6d')](),_0x52cf15);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 2ccab34..ef1401a 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebf0=['updateInteraction','Users','TagIds','Tags','map','fullname','split','push','waiting','talking','answered','unmanaged','total','abandoned','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xebf0,0x117));var _0x0ebf=function(_0x4fed8a,_0x532e54){_0x4fed8a=_0x4fed8a-0x0;var _0x83600c=_0xebf0[_0x4fed8a];return _0x83600c;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x1d8986,_0x176e6e){return new Promise(function(_0x344556,_0x1c809a){try{var _0x653650=[];if(_0x176e6e[_0x1d8986]){_0x653650=_0x176e6e[_0x1d8986][_0x0ebf('0x0')](function(_0x39a05e){return{'id':_0x39a05e['id'],'fullname':_0x39a05e[_0x0ebf('0x1')]};});}return _0x344556(_0x653650);}catch(_0x53c389){_0x1c809a(_0x53c389);}});}function getInteractionTags(_0x489384,_0x29d28f){var _0x9dea4a=[];if(_0x489384){_0x489384[_0x0ebf('0x2')](',')['forEach'](function(_0x1410af){_0x9dea4a[_0x0ebf('0x3')](_0x29d28f[_0x1410af]);});}return _0x9dea4a;}function updateWaitingCounter(_0x3f9c17){if(_0x3f9c17[_0x0ebf('0x4')]){_0x3f9c17['waiting']-=0x1;}}function updateInteractionCounters(_0x1a9af0){_0x1a9af0[_0x0ebf('0x4')]=0x0;_0x1a9af0[_0x0ebf('0x5')]=0x0;_0x1a9af0[_0x0ebf('0x6')]=0x0;_0x1a9af0[_0x0ebf('0x7')]=0x0;_0x1a9af0['abandoned']=0x0;_0x1a9af0[_0x0ebf('0x8')]=0x0;if(_0x1a9af0['closed']){if(_0x1a9af0['disposition']===_0x0ebf('0x9')){_0x1a9af0[_0x0ebf('0x9')]+=0x1;updateWaitingCounter(_0x1a9af0);}if(_0x1a9af0['UserId']){_0x1a9af0[_0x0ebf('0x6')]+=0x1;if(_0x1a9af0[_0x0ebf('0x5')]){_0x1a9af0['talking']-=0x1;}}else{if(_0x1a9af0[_0x0ebf('0xa')]){_0x1a9af0[_0x0ebf('0x7')]+=0x1;updateWaitingCounter(_0x1a9af0);}}}else{if(!_0x1a9af0['UserId']){_0x1a9af0[_0x0ebf('0x4')]+=0x1;}if(_0x1a9af0[_0x0ebf('0xb')]){_0x1a9af0[_0x0ebf('0x5')]+=0x1;updateWaitingCounter(_0x1a9af0);}}_0x1a9af0[_0x0ebf('0x8')]+=0x1;return _0x1a9af0;}function getLastMessageText(_0x1d9f63){return db[_0x0ebf('0xc')][_0x0ebf('0xd')]({'where':{'$and':[{'MailInteractionId':_0x1d9f63['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0ebf('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0ebf('0xf')],'order':_0x0ebf('0x10'),'raw':!![]})[_0x0ebf('0x11')](function(_0x21822b){if(_0x21822b&&_0x21822b['plainBody']){_0x1d9f63[_0x0ebf('0x12')]=_[_0x0ebf('0x13')](_0x21822b[_0x0ebf('0xf')]);}return _0x1d9f63;})[_0x0ebf('0x14')](function(_0x4d0182){throw _0x4d0182;});}exports[_0x0ebf('0x15')]=function(_0xb1f4fe,_0x324e2f,_0x439798,_0x4ff986){return new Promise(function(_0x209a5c,_0xe7b802){return getInteractionUsers(_0xb1f4fe['id'],_0x439798)[_0x0ebf('0x11')](function(_0x42bd16){_0xb1f4fe[_0x0ebf('0x16')]=_0x42bd16;return getInteractionTags(_0xb1f4fe[_0x0ebf('0x17')],_0x324e2f);})[_0x0ebf('0x11')](function(_0x249a97){_0xb1f4fe[_0x0ebf('0x18')]=_0x249a97;delete _0xb1f4fe[_0x0ebf('0x17')];return updateInteractionCounters(_0xb1f4fe);})['then'](function(_0x48499b){if(_0x4ff986){return getLastMessageText(_0x48499b);}else{return _0x48499b;}})[_0x0ebf('0x11')](function(_0x5b2cd5){_0x209a5c(_0x5b2cd5);})[_0x0ebf('0x14')](function(_0x505c64){_0xe7b802(_0x505c64);});});}; \ No newline at end of file +var _0xe4ac=['UserId','answered','talking','findOne','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','forEach','waiting','unmanaged','abandoned','total','closed','disposition'];(function(_0x8d7443,_0x32c428){var _0x44b8a8=function(_0x2a367f){while(--_0x2a367f){_0x8d7443['push'](_0x8d7443['shift']());}};_0x44b8a8(++_0x32c428);}(_0xe4ac,0x1d6));var _0xce4a=function(_0x32c97a,_0x29b6fc){_0x32c97a=_0x32c97a-0x0;var _0x5de34d=_0xe4ac[_0x32c97a];return _0x5de34d;};'use strict';var _=require(_0xce4a('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x321516,_0x1b3804){return new Promise(function(_0x186cdf,_0x217baf){try{var _0x19bb9f=[];if(_0x1b3804[_0x321516]){_0x19bb9f=_0x1b3804[_0x321516][_0xce4a('0x1')](function(_0x1deae0){return{'id':_0x1deae0['id'],'fullname':_0x1deae0[_0xce4a('0x2')]};});}return _0x186cdf(_0x19bb9f);}catch(_0x346322){_0x217baf(_0x346322);}});}function getInteractionTags(_0x20fbb7,_0x5f3279){var _0x106db8=[];if(_0x20fbb7){_0x20fbb7['split'](',')[_0xce4a('0x3')](function(_0xe1e286){_0x106db8['push'](_0x5f3279[_0xe1e286]);});}return _0x106db8;}function updateWaitingCounter(_0x5625cf){if(_0x5625cf[_0xce4a('0x4')]){_0x5625cf[_0xce4a('0x4')]-=0x1;}}function updateInteractionCounters(_0x15a4d8){_0x15a4d8[_0xce4a('0x4')]=0x0;_0x15a4d8['talking']=0x0;_0x15a4d8['answered']=0x0;_0x15a4d8[_0xce4a('0x5')]=0x0;_0x15a4d8[_0xce4a('0x6')]=0x0;_0x15a4d8[_0xce4a('0x7')]=0x0;if(_0x15a4d8[_0xce4a('0x8')]){if(_0x15a4d8[_0xce4a('0x9')]===_0xce4a('0x6')){_0x15a4d8[_0xce4a('0x6')]+=0x1;updateWaitingCounter(_0x15a4d8);}if(_0x15a4d8[_0xce4a('0xa')]){_0x15a4d8[_0xce4a('0xb')]+=0x1;if(_0x15a4d8[_0xce4a('0xc')]){_0x15a4d8[_0xce4a('0xc')]-=0x1;}}else{if(_0x15a4d8['disposition']){_0x15a4d8[_0xce4a('0x5')]+=0x1;updateWaitingCounter(_0x15a4d8);}}}else{if(!_0x15a4d8[_0xce4a('0xa')]){_0x15a4d8[_0xce4a('0x4')]+=0x1;}if(_0x15a4d8[_0xce4a('0xa')]){_0x15a4d8[_0xce4a('0xc')]+=0x1;updateWaitingCounter(_0x15a4d8);}}_0x15a4d8[_0xce4a('0x7')]+=0x1;return _0x15a4d8;}function getLastMessageText(_0x4f5056){return db['MailMessage'][_0xce4a('0xd')]({'where':{'$and':[{'MailInteractionId':_0x4f5056['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xce4a('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xce4a('0xf')],'order':_0xce4a('0x10'),'raw':!![]})[_0xce4a('0x11')](function(_0x24a789){if(_0x24a789&&_0x24a789[_0xce4a('0xf')]){_0x4f5056[_0xce4a('0x12')]=_[_0xce4a('0x13')](_0x24a789[_0xce4a('0xf')]);}return _0x4f5056;})['catch'](function(_0xb4af5f){throw _0xb4af5f;});}exports[_0xce4a('0x14')]=function(_0x525d8e,_0x41a5c2,_0x637f9f,_0x46122b){return new Promise(function(_0x2e888a,_0x308bbc){return getInteractionUsers(_0x525d8e['id'],_0x637f9f)[_0xce4a('0x11')](function(_0x9249ea){_0x525d8e[_0xce4a('0x15')]=_0x9249ea;return getInteractionTags(_0x525d8e[_0xce4a('0x16')],_0x41a5c2);})[_0xce4a('0x11')](function(_0x61dfe7){_0x525d8e[_0xce4a('0x17')]=_0x61dfe7;delete _0x525d8e[_0xce4a('0x16')];return updateInteractionCounters(_0x525d8e);})[_0xce4a('0x11')](function(_0x5ba472){if(_0x46122b){return getLastMessageText(_0x5ba472);}else{return _0x5ba472;}})[_0xce4a('0x11')](function(_0x130964){_0x2e888a(_0x130964);})['catch'](function(_0x55d4a0){_0x308bbc(_0x55d4a0);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 597c2a6..fb6b66b 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f35=['unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','Interaction','findOne','then','update','catch','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7f35,0x81));var _0x57f3=function(_0x1b72f6,_0x5358cc){_0x1b72f6=_0x1b72f6-0x0;var _0x195bdc=_0x7f35[_0x1b72f6];return _0x195bdc;};'use strict';var _=require('lodash');var db=require(_0x57f3('0x0'))['db'];var loggers={'openchannel':require(_0x57f3('0x1'))(_0x57f3('0x2')),'mail':require(_0x57f3('0x1'))(_0x57f3('0x3')),'fax':require(_0x57f3('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x57f3('0x1'))('chat-interactions'),'whatsapp':require(_0x57f3('0x1'))(_0x57f3('0x4'))};function getAccountFK(_0x3a94b9){return _[_0x57f3('0x5')](_0x3a94b9)+(_0x3a94b9===_0x57f3('0x6')?_0x57f3('0x7'):_0x57f3('0x8'))+'Id';}function getInteractionFK(_0x245a74){return _['capitalize'](_0x245a74)+_0x57f3('0x9');}function getInteractionId(_0x545ac0,_0xade76e,_0x2e74d0){if(_0x545ac0&&_0x545ac0[_['upperFirst'](_0x2e74d0)+_0x57f3('0x9')]){return _0x545ac0[_[_0x57f3('0xa')](_0x2e74d0)+_0x57f3('0x9')];}else if(_0x545ac0&&_0x545ac0['id']){return _0x545ac0['id'];}else if(_0xade76e&&_0xade76e['id']){return _0xade76e['id'];}else{return _0x57f3('0xb');}}function getInteractionsTables(_0x54ed38){return{'accounts':_0x54ed38+'_'+(_0x54ed38===_0x57f3('0x6')?_0x57f3('0xc'):_0x57f3('0xd')),'interactions':_0x54ed38+_0x57f3('0xe'),'interactionsTags':_0x54ed38+_0x57f3('0xf'),'messages':_0x54ed38+_0x57f3('0x10'),'userInteractions':_0x57f3('0x11')+_0x54ed38+_0x57f3('0xe')};}function getSelectedTags(_0x125542){var _0x209eb9=[];if(_0x125542){_0x209eb9=Array[_0x57f3('0x12')](_0x125542)?_0x125542:[_0x125542];}return _0x209eb9;}function log(_0x1ee06,_0x2b6062,_0x40a218,_0x45641a,_0x317233,_0x287881){loggers[_0x317233[_0x57f3('0x13')]()][_0x1ee06](_0x57f3('0x14'),_0x287881[_0x57f3('0x15')](),_0x2b6062?_0x2b6062['id']:null,_0x2b6062?_0x2b6062['name']:null,_0x2b6062?_0x2b6062[_0x57f3('0x16')]:null,getInteractionId(_0x40a218,_0x45641a,_0x317233),_0x40a218?JSON['stringify'](_0x40a218):'null');}function updateUser(_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0){db[_['upperFirst'](_0x44c3cf)+_0x57f3('0x17')][_0x57f3('0x18')]({'where':{'id':getInteractionId(_0xda3be6,_0x45df14,_0x44c3cf)}})[_0x57f3('0x19')](function(_0x5e9ff3){if(_0x5e9ff3){return _0x5e9ff3[_0x57f3('0x1a')]({'UserId':_0x5e9cd4?_0x5e9cd4['id']:null});}})['then'](function(_0x5a5eac){if(_0x5a5eac){log('info',_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0);}})[_0x57f3('0x1b')](function(){log('error',_0x5e9cd4,_0xda3be6,_0x45df14,_0x44c3cf,_0x2fb6e0);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x9c05=['accounts','_interaction_has_tags','_messages','user_has_','_interactions','toLowerCase','toUpperCase','role','null','upperFirst','findOne','then','update','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','capitalize','Website','InteractionId','unknown'];(function(_0x4fa6c8,_0x5ad782){var _0x166b11=function(_0xfcc77a){while(--_0xfcc77a){_0x4fa6c8['push'](_0x4fa6c8['shift']());}};_0x166b11(++_0x5ad782);}(_0x9c05,0x73));var _0x59c0=function(_0x4df719,_0x14bebc){_0x4df719=_0x4df719-0x0;var _0x599195=_0x9c05[_0x4df719];return _0x599195;};'use strict';var _=require(_0x59c0('0x0'));var db=require(_0x59c0('0x1'))['db'];var loggers={'openchannel':require(_0x59c0('0x2'))(_0x59c0('0x3')),'mail':require(_0x59c0('0x2'))('mail-interactions'),'fax':require(_0x59c0('0x2'))('fax-interactions'),'sms':require(_0x59c0('0x2'))(_0x59c0('0x4')),'chat':require(_0x59c0('0x2'))(_0x59c0('0x5')),'whatsapp':require(_0x59c0('0x2'))('whatsapp-interactions')};function getAccountFK(_0x22d581){return _[_0x59c0('0x6')](_0x22d581)+(_0x22d581==='chat'?_0x59c0('0x7'):'Account')+'Id';}function getInteractionFK(_0xffcf83){return _[_0x59c0('0x6')](_0xffcf83)+_0x59c0('0x8');}function getInteractionId(_0x2d61ab,_0x1dd234,_0x12fab4){if(_0x2d61ab&&_0x2d61ab[_['upperFirst'](_0x12fab4)+_0x59c0('0x8')]){return _0x2d61ab[_['upperFirst'](_0x12fab4)+_0x59c0('0x8')];}else if(_0x2d61ab&&_0x2d61ab['id']){return _0x2d61ab['id'];}else if(_0x1dd234&&_0x1dd234['id']){return _0x1dd234['id'];}else{return _0x59c0('0x9');}}function getInteractionsTables(_0x491adb){return{'accounts':_0x491adb+'_'+(_0x491adb==='chat'?'websites':_0x59c0('0xa')),'interactions':_0x491adb+'_interactions','interactionsTags':_0x491adb+_0x59c0('0xb'),'messages':_0x491adb+_0x59c0('0xc'),'userInteractions':_0x59c0('0xd')+_0x491adb+_0x59c0('0xe')};}function getSelectedTags(_0x3d69e0){var _0x2d0b98=[];if(_0x3d69e0){_0x2d0b98=Array['isArray'](_0x3d69e0)?_0x3d69e0:[_0x3d69e0];}return _0x2d0b98;}function log(_0x109360,_0xa1ebc,_0x31d826,_0x2e8fd4,_0x578fc3,_0x2673b6){loggers[_0x578fc3[_0x59c0('0xf')]()][_0x109360]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2673b6[_0x59c0('0x10')](),_0xa1ebc?_0xa1ebc['id']:null,_0xa1ebc?_0xa1ebc['name']:null,_0xa1ebc?_0xa1ebc[_0x59c0('0x11')]:null,getInteractionId(_0x31d826,_0x2e8fd4,_0x578fc3),_0x31d826?JSON['stringify'](_0x31d826):_0x59c0('0x12'));}function updateUser(_0x53b194,_0x57c07a,_0x1258b9,_0x136ea0,_0x21adaa){db[_[_0x59c0('0x13')](_0x136ea0)+'Interaction'][_0x59c0('0x14')]({'where':{'id':getInteractionId(_0x57c07a,_0x1258b9,_0x136ea0)}})[_0x59c0('0x15')](function(_0x4f0eaa){if(_0x4f0eaa){return _0x4f0eaa[_0x59c0('0x16')]({'UserId':_0x53b194?_0x53b194['id']:null});}})[_0x59c0('0x15')](function(_0x868e0e){if(_0x868e0e){log('info',_0x53b194,_0x57c07a,_0x1258b9,_0x136ea0,_0x21adaa);}})['catch'](function(){log(_0x59c0('0x17'),_0x53b194,_0x57c07a,_0x1258b9,_0x136ea0,_0x21adaa);});}module[_0x59c0('0x18')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8c25eb9..92790e6 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 _0x4e86=['License','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','isUserLimit','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','use'];(function(_0x5a64eb,_0x286782){var _0x3ad930=function(_0x36a52f){while(--_0x36a52f){_0x5a64eb['push'](_0x5a64eb['shift']());}};_0x3ad930(++_0x286782);}(_0x4e86,0x111));var _0x64e8=function(_0x4e5a48,_0x17e904){_0x4e5a48=_0x4e5a48-0x0;var _0x31baef=_0x4e86[_0x4e5a48];return _0x31baef;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0x64e8('0x0'));var db=require(_0x64e8('0x1'))['db'];var config=require(_0x64e8('0x2'));function getValueFromLicense(_0x36fd33,_0x32a24a){if(_0x36fd33&&_0x32a24a){if(_0x32a24a[_0x64e8('0x3')]&&_0x32a24a[_0x64e8('0x4')]){var _0x285400=_0x32a24a['data1'];var _0x379abb=_0x32a24a[_0x64e8('0x4')];var _0x59d0a1=_0x285400[_0x64e8('0x5')]('-')[0x4];var _0x53b88e=_0x285400[_0x64e8('0x5')]('-')[0x0];var _0x30e9e2=crypto[_0x64e8('0x6')](_0x64e8('0x7'),util[_0x64e8('0x8')](_0x64e8('0x9'),_0x59d0a1,_0x285400,_0x53b88e));var _0x11f49c=_0x30e9e2[_0x64e8('0xa')](_0x379abb,_0x64e8('0xb'),'utf8');_0x11f49c+=_0x30e9e2[_0x64e8('0xc')](_0x64e8('0xd'));var _0x47f58d=JSON['parse'](_0x11f49c);return _0x47f58d['hasOwnProperty'](_0x36fd33)?_0x47f58d[_0x36fd33]:null;}}return null;}function isLimit(_0x12559b,_0x4dbe13,_0x3fd07c,_0x1a9b83){var _0xa5c663=_0x4dbe13;return compose()[_0x64e8('0xe')](function(_0x45a58e,_0x4f71b6,_0x328991){return db[_0x64e8('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x64e8('0x10')](function(_0x2f54bb){var _0x577f0e=getValueFromLicense(_0x12559b,_0x2f54bb);return _0x577f0e?_0x577f0e:_0xa5c663;})[_0x64e8('0x10')](function(_0x5542c4){_0xa5c663=_0x5542c4;return _0x3fd07c['count'](_0x1a9b83);})['then'](function(_0x2a3240){if(_0x2a3240>=_0xa5c663){return _0x4f71b6['status'](0x193)[_0x64e8('0x11')]({'message':util[_0x64e8('0x8')](_0x64e8('0x12'),_0x12559b)});}_0x328991();})[_0x64e8('0x13')](function(_0x27603e){_0x328991(_0x27603e);});});}function isUserLimit(){return isLimit(_0x64e8('0x14'),0x1,db[_0x64e8('0x15')],{'where':{'$or':[{'role':_0x64e8('0x16')},{'role':'user'}]}});}exports[_0x64e8('0x17')]=isUserLimit; \ No newline at end of file +var _0x4825=['catch','users','admin','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count','status','json'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4825,0x148));var _0x5482=function(_0x12f080,_0x584482){_0x12f080=_0x12f080-0x0;var _0x537d59=_0x4825[_0x12f080];return _0x537d59;};'use strict';var crypto=require('crypto');var util=require(_0x5482('0x0'));var compose=require(_0x5482('0x1'));var db=require(_0x5482('0x2'))['db'];var config=require(_0x5482('0x3'));function getValueFromLicense(_0x2b343f,_0x52d345){if(_0x2b343f&&_0x52d345){if(_0x52d345[_0x5482('0x4')]&&_0x52d345[_0x5482('0x5')]){var _0x17991f=_0x52d345[_0x5482('0x4')];var _0x5adaa9=_0x52d345[_0x5482('0x5')];var _0x4c55e8=_0x17991f[_0x5482('0x6')]('-')[0x4];var _0x35ac47=_0x17991f[_0x5482('0x6')]('-')[0x0];var _0x2e9f52=crypto[_0x5482('0x7')](_0x5482('0x8'),util[_0x5482('0x9')](_0x5482('0xa'),_0x4c55e8,_0x17991f,_0x35ac47));var _0x5205a9=_0x2e9f52[_0x5482('0xb')](_0x5adaa9,_0x5482('0xc'),_0x5482('0xd'));_0x5205a9+=_0x2e9f52[_0x5482('0xe')](_0x5482('0xd'));var _0x583617=JSON[_0x5482('0xf')](_0x5205a9);return _0x583617[_0x5482('0x10')](_0x2b343f)?_0x583617[_0x2b343f]:null;}}return null;}function isLimit(_0x4df3b6,_0x4160a3,_0x42e85c,_0x125146){var _0x55adda=_0x4160a3;return compose()[_0x5482('0x11')](function(_0x1a52ea,_0x1ba88f,_0x3da2a4){return db[_0x5482('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x5482('0x13')](function(_0x5941be){var _0x2cdf2=getValueFromLicense(_0x4df3b6,_0x5941be);return _0x2cdf2?_0x2cdf2:_0x55adda;})[_0x5482('0x13')](function(_0xad9f3a){_0x55adda=_0xad9f3a;return _0x42e85c[_0x5482('0x14')](_0x125146);})['then'](function(_0x2878d6){if(_0x2878d6>=_0x55adda){return _0x1ba88f[_0x5482('0x15')](0x193)[_0x5482('0x16')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4df3b6)});}_0x3da2a4();})[_0x5482('0x17')](function(_0x46f59c){_0x3da2a4(_0x46f59c);});});}function isUserLimit(){return isLimit(_0x5482('0x18'),0x1,db['User'],{'where':{'$or':[{'role':_0x5482('0x19')},{'role':'user'}]}});}exports[_0x5482('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index cb59ae9..ce1abd4 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 _0xdf72=['minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','split','slice','shift','match','forEach','filter','conditions','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','add','days','YYYY-MM-DD','CAST(','field','\x20AS\x20','castTo','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','$substring','start','$endsWith','utcOffset','format'];(function(_0x296098,_0x43125e){var _0x341dc2=function(_0x15712a){while(--_0x15712a){_0x296098['push'](_0x296098['shift']());}};_0x341dc2(++_0x43125e);}(_0xdf72,0x1ba));var _0x2df7=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0xdf72[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0x2df7('0x0'));var moment=require(_0x2df7('0x1'));exports[_0x2df7('0x2')]=function(_0xbd9bd5){var _0x10ac54={'conditions':[]};_0x10ac54[_0x2df7('0x3')]=_[_0x2df7('0x4')](_0xbd9bd5,_0x2df7('0x5'))?'or':_0x2df7('0x6');var _0x437f1c=_0xbd9bd5[_0x2df7('0x7')](_0x2df7('0x8'),'')[_0x2df7('0x7')](_0x2df7('0x5'),'')['split']('||');for(var _0x26d4fa=0x0;_0x26d4fa<_0x437f1c[_0x2df7('0x9')];_0x26d4fa++){var _0x5e5ffe=_0x437f1c[_0x26d4fa][_0x2df7('0xa')](':=');var _0x38e066=_0x5e5ffe[0x0];var _0x383456=_0x5e5ffe[_0x2df7('0xb')](0x1);_0x383456['forEach'](function(_0x6f0e86){var _0x164505=_0x6f0e86[_0x2df7('0xa')]('[')[_0x2df7('0xc')]();var _0x1bba13=_0x6f0e86[_0x2df7('0xd')](/\[(.*?)\]/g);_0x1bba13[_0x2df7('0xe')](function(_0x2ac9b0){var _0x196201=_0x2ac9b0[_0x2df7('0xa')]('[')[_0x2df7('0xf')](function(_0x2570ac){return _0x2570ac['indexOf'](']')>-0x1;})['map'](function(_0x4cfe9e){return _0x4cfe9e[_0x2df7('0xa')](']')[0x0];})[0x0];_0x10ac54[_0x2df7('0x10')]['push']({'field':_0x38e066,'operator':_0x164505,'value':_0x196201});});});}return _0x10ac54;};exports[_0x2df7('0x11')]=function(_0x306a97,_0x2af410,_0x4ca158){var _0xd8ad6b={};if(_0x2af410===_0x2df7('0x12')){if(_0x4ca158[_0x2df7('0x13')]===_0x2df7('0x14')){_0x4ca158[_0x2df7('0x13')]=_0x2df7('0x15');_0x4ca158[_0x2df7('0x16')]+=','+_0x4ca158[_0x2df7('0x16')];}else if(_[_0x2df7('0x17')]([_0x2df7('0x18'),'$lte'],_0x4ca158['operator'])){_0x4ca158[_0x2df7('0x16')]=moment(_0x4ca158[_0x2df7('0x16')])[_0x2df7('0x19')](0x1,_0x2df7('0x1a'))['format'](_0x2df7('0x1b'));}}if(_0x4ca158['castTo']){_0x2af410=_0x4ca158['castTo'];_0xd8ad6b['text']=_0x2df7('0x1c')+_0x306a97+'.'+_0x4ca158[_0x2df7('0x1d')]+_0x2df7('0x1e')+_0x4ca158[_0x2df7('0x1f')]+')\x20'+parseOperator(_0x4ca158[_0x2df7('0x13')]);}else{_0xd8ad6b[_0x2df7('0x20')]=_0x306a97+'.'+_0x4ca158[_0x2df7('0x1d')]+'\x20'+parseOperator(_0x4ca158[_0x2df7('0x13')]);}if(_['includes']([_0x2df7('0x21'),_0x2df7('0x22')],_0x4ca158[_0x2df7('0x13')]))_0xd8ad6b['text']='('+_0xd8ad6b[_0x2df7('0x20')]+_0x2df7('0x23')+_0x306a97+'.'+_0x4ca158['field']+_0x2df7('0x24');_0xd8ad6b[_0x2df7('0x16')]=parseValue(_0x2af410,_0x4ca158[_0x2df7('0x13')],_0x4ca158[_0x2df7('0x16')]);return _0xd8ad6b;};function parseOperator(_0x3bebd6){var _0x462008;switch(_0x3bebd6){case _0x2df7('0x25'):_0x462008=_0x2df7('0x26');break;case _0x2df7('0x22'):_0x462008='NOT\x20IN\x20?';break;case'$eq':_0x462008=_0x2df7('0x27');break;case _0x2df7('0x21'):_0x462008='<>\x20?';break;case'$substring':case _0x2df7('0x28'):case'$endsWith':_0x462008=_0x2df7('0x29');break;case _0x2df7('0x2a'):_0x462008=_0x2df7('0x2b');break;case _0x2df7('0x18'):_0x462008=_0x2df7('0x2c');break;case _0x2df7('0x2d'):_0x462008=_0x2df7('0x2e');break;case'$gte':_0x462008=_0x2df7('0x2f');break;case _0x2df7('0x15'):_0x462008='BETWEEN\x20?\x20AND\x20?';break;}return _0x462008;}function parseValue(_0x96ffd9,_0x493f74,_0x14ce8e){var _0x5adf59={'start':undefined,'end':undefined};switch(_0x493f74){case _0x2df7('0x25'):case _0x2df7('0x22'):_0x5adf59['start']=_0x14ce8e[_0x2df7('0xa')](',');break;case _0x2df7('0x30'):_0x5adf59[_0x2df7('0x31')]='%'+_0x14ce8e+'%';break;case'$startsWith':_0x5adf59[_0x2df7('0x31')]=_0x14ce8e+'%';break;case _0x2df7('0x32'):_0x5adf59[_0x2df7('0x31')]='%'+_0x14ce8e;break;case'$between':var _0x4dce06=_0x14ce8e[_0x2df7('0xa')](',');var _0x14ce8e=_0x4dce06[_0x2df7('0xc')]();var _0x12aaf0=_0x4dce06['pop']();if(_0x96ffd9==='DATE'){_0x14ce8e=moment(_0x14ce8e)[_0x2df7('0x33')](0x0,!![])[_0x2df7('0x34')]();_0x12aaf0=moment(_0x12aaf0)['utcOffset'](0x0,!![])[_0x2df7('0x19')](0x17,'hours')[_0x2df7('0x19')](0x3b,_0x2df7('0x35'))['add'](0x3b,_0x2df7('0x36'))[_0x2df7('0x34')]();}_0x5adf59={'start':_0x14ce8e,'end':_0x12aaf0};break;default:_0x5adf59[_0x2df7('0x31')]=_0x14ce8e;break;}return _0x5adf59;} \ No newline at end of file +var _0x1cc9=['field','\x20AS\x20','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','shift','pop','utcOffset','format','add','hours','minutes','moment','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo'];(function(_0x3d69f5,_0xb99af3){var _0xfc942a=function(_0x106248){while(--_0x106248){_0x3d69f5['push'](_0x3d69f5['shift']());}};_0xfc942a(++_0xb99af3);}(_0x1cc9,0x140));var _0x91cc=function(_0x37ad0c,_0x587af7){_0x37ad0c=_0x37ad0c-0x0;var _0x389e0c=_0x1cc9[_0x37ad0c];return _0x389e0c;};'use strict';var _=require('lodash');var moment=require(_0x91cc('0x0'));exports['parseSearch']=function(_0xaf91f8){var _0x4a7510={'conditions':[]};_0x4a7510[_0x91cc('0x1')]=_[_0x91cc('0x2')](_0xaf91f8,_0x91cc('0x3'))?'or':_0x91cc('0x4');var _0x261014=_0xaf91f8['replace'](_0x91cc('0x5'),'')[_0x91cc('0x6')]('[$or]','')[_0x91cc('0x7')]('||');for(var _0xf9b76b=0x0;_0xf9b76b<_0x261014['length'];_0xf9b76b++){var _0x4e5af9=_0x261014[_0xf9b76b][_0x91cc('0x7')](':=');var _0x1a052=_0x4e5af9[0x0];var _0x252e83=_0x4e5af9[_0x91cc('0x8')](0x1);_0x252e83[_0x91cc('0x9')](function(_0x557fab){var _0x5e95c2=_0x557fab[_0x91cc('0x7')]('[')['shift']();var _0xf012ff=_0x557fab[_0x91cc('0xa')](/\[(.*?)\]/g);_0xf012ff[_0x91cc('0x9')](function(_0x1907ca){var _0x521fb2=_0x1907ca[_0x91cc('0x7')]('[')[_0x91cc('0xb')](function(_0x261192){return _0x261192[_0x91cc('0xc')](']')>-0x1;})[_0x91cc('0xd')](function(_0xbb8fc1){return _0xbb8fc1[_0x91cc('0x7')](']')[0x0];})[0x0];_0x4a7510[_0x91cc('0xe')][_0x91cc('0xf')]({'field':_0x1a052,'operator':_0x5e95c2,'value':_0x521fb2});});});}return _0x4a7510;};exports[_0x91cc('0x10')]=function(_0x298d46,_0x259c7c,_0x4504ef){var _0x9a9c62={};if(_0x259c7c===_0x91cc('0x11')){if(_0x4504ef[_0x91cc('0x12')]===_0x91cc('0x13')){_0x4504ef[_0x91cc('0x12')]=_0x91cc('0x14');_0x4504ef[_0x91cc('0x15')]+=','+_0x4504ef[_0x91cc('0x15')];}else if(_[_0x91cc('0x16')]([_0x91cc('0x17'),_0x91cc('0x18')],_0x4504ef[_0x91cc('0x12')])){_0x4504ef['value']=moment(_0x4504ef['value'])['add'](0x1,_0x91cc('0x19'))['format'](_0x91cc('0x1a'));}}if(_0x4504ef[_0x91cc('0x1b')]){_0x259c7c=_0x4504ef['castTo'];_0x9a9c62['text']='CAST('+_0x298d46+'.'+_0x4504ef[_0x91cc('0x1c')]+_0x91cc('0x1d')+_0x4504ef[_0x91cc('0x1b')]+')\x20'+parseOperator(_0x4504ef[_0x91cc('0x12')]);}else{_0x9a9c62[_0x91cc('0x1e')]=_0x298d46+'.'+_0x4504ef[_0x91cc('0x1c')]+'\x20'+parseOperator(_0x4504ef['operator']);}if(_[_0x91cc('0x16')]([_0x91cc('0x1f'),_0x91cc('0x20')],_0x4504ef[_0x91cc('0x12')]))_0x9a9c62[_0x91cc('0x1e')]='('+_0x9a9c62[_0x91cc('0x1e')]+'\x20OR\x20'+_0x298d46+'.'+_0x4504ef[_0x91cc('0x1c')]+_0x91cc('0x21');_0x9a9c62['value']=parseValue(_0x259c7c,_0x4504ef[_0x91cc('0x12')],_0x4504ef[_0x91cc('0x15')]);return _0x9a9c62;};function parseOperator(_0x52fda8){var _0x39890e;switch(_0x52fda8){case _0x91cc('0x22'):_0x39890e=_0x91cc('0x23');break;case'$notIn':_0x39890e=_0x91cc('0x24');break;case'$eq':_0x39890e=_0x91cc('0x25');break;case'$ne':_0x39890e=_0x91cc('0x26');break;case _0x91cc('0x27'):case'$startsWith':case'$endsWith':_0x39890e=_0x91cc('0x28');break;case _0x91cc('0x29'):_0x39890e=_0x91cc('0x2a');break;case _0x91cc('0x17'):_0x39890e=_0x91cc('0x2b');break;case _0x91cc('0x18'):_0x39890e=_0x91cc('0x2c');break;case _0x91cc('0x2d'):_0x39890e=_0x91cc('0x2e');break;case _0x91cc('0x14'):_0x39890e=_0x91cc('0x2f');break;}return _0x39890e;}function parseValue(_0x3c79a9,_0x29259c,_0xd95629){var _0x476eeb={'start':undefined,'end':undefined};switch(_0x29259c){case'$in':case _0x91cc('0x20'):_0x476eeb[_0x91cc('0x30')]=_0xd95629['split'](',');break;case _0x91cc('0x27'):_0x476eeb[_0x91cc('0x30')]='%'+_0xd95629+'%';break;case _0x91cc('0x31'):_0x476eeb[_0x91cc('0x30')]=_0xd95629+'%';break;case _0x91cc('0x32'):_0x476eeb[_0x91cc('0x30')]='%'+_0xd95629;break;case _0x91cc('0x14'):var _0x585900=_0xd95629[_0x91cc('0x7')](',');var _0xd95629=_0x585900[_0x91cc('0x33')]();var _0x14f9de=_0x585900[_0x91cc('0x34')]();if(_0x3c79a9==='DATE'){_0xd95629=moment(_0xd95629)[_0x91cc('0x35')](0x0,!![])[_0x91cc('0x36')]();_0x14f9de=moment(_0x14f9de)['utcOffset'](0x0,!![])[_0x91cc('0x37')](0x17,_0x91cc('0x38'))[_0x91cc('0x37')](0x3b,_0x91cc('0x39'))['add'](0x3b,'seconds')[_0x91cc('0x36')]();}_0x476eeb={'start':_0xd95629,'end':_0x14f9de};break;default:_0x476eeb[_0x91cc('0x30')]=_0xd95629;break;}return _0x476eeb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 3ae1bdc..5efe3a9 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 _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(_0x58271e,_0x307e00){var _0x4605e9=function(_0x32ac57){while(--_0x32ac57){_0x58271e['push'](_0x58271e['shift']());}};_0x4605e9(++_0x307e00);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3564d6,_0x37d1cb){_0x3564d6=_0x3564d6-0x0;var _0x1f2267=_0xf2ca[_0x3564d6];return _0x1f2267;};'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 +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(_0x588161,_0x3dfa00){var _0x32915e=function(_0x26c33b){while(--_0x26c33b){_0x588161['push'](_0x588161['shift']());}};_0x32915e(++_0x3dfa00);}(_0x7da7,0x10d));var _0x77da=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x7da7[_0x5c4e16];return _0x36044a;};'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 diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3a7e76b..f34e9d2 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1326=['every','length','unknown','unavailable','ringing','idle','voiceStatus','pause','chatStatus','faxStatus','mailStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','Queue','map','flatten','uniq','value','getAgentIdsByQueues','filter','includes','getAgentIdsByStatus','resolve','User','findAll','fullname','chatPause','mailPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','openchannelStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableAutomaticScreenRecording','../../mysqldb','client','http','faxPause','openchannelPause','smsPause','voicePause','whatsappPause'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0x1326,0x150));var _0x6132=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x1326[_0xd299c3];return _0x376574;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require(_0x6132('0x0'))['db'];var amiClient=jayson[_0x6132('0x1')][_0x6132('0x2')]({'port':0x232a});var routingClient=jayson[_0x6132('0x1')]['http']({'port':0x232c});function isAgentPaused(_0x3b9dae,_0x4b05c4){var _0x354ea6=[_0x3b9dae['chatPause'],_0x3b9dae[_0x6132('0x3')],_0x3b9dae['mailPause'],_0x3b9dae[_0x6132('0x4')],_0x3b9dae[_0x6132('0x5')],_0x3b9dae[_0x6132('0x6')],_0x3b9dae[_0x6132('0x7')]];if(!_0x4b05c4)return _[_0x6132('0x8')](_0x354ea6);var _0x349e93=_['filter'](_0x354ea6);return _0x349e93['length']>0x0&&_0x349e93[_0x6132('0x9')]<_0x354ea6[_0x6132('0x9')]?!![]:![];}function isIdle(_0x18e1ee){return _0x18e1ee==='idle'||_0x18e1ee===_0x6132('0xa')||_0x18e1ee===_0x6132('0xb')||_0x18e1ee===_0x6132('0xc')||_['isNil'](_0x18e1ee);}function isAgentIdle(_0x2fc476){if(_0x2fc476['voiceStatus']!==_0x6132('0xd')&&_0x2fc476[_0x6132('0x6')]){_0x2fc476[_0x6132('0xe')]=_0x6132('0xf');return![];}return _[_0x6132('0x8')]([_0x2fc476[_0x6132('0x10')],_0x2fc476[_0x6132('0x11')],_0x2fc476[_0x6132('0x12')],_0x2fc476['openchannelStatus'],_0x2fc476[_0x6132('0x13')],_0x2fc476[_0x6132('0xe')],_0x2fc476['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x6132('0x14')](_0x6132('0x15'),{})[_0x6132('0x16')](function(_0x110ea1){if(_0x110ea1[_0x6132('0x17')]){throw new Error(_0x6132('0x18'));}var _0x52db33=_0x110ea1[_0x6132('0x19')];return routingClient['request']('Agents',{})[_0x6132('0x16')](function(_0x29425c){if(_0x29425c[_0x6132('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4f8c5d=_0x29425c[_0x6132('0x19')];return _['merge']({},_0x52db33,_0x4f8c5d);});})[_0x6132('0x1a')](function(_0x48df11){throw _0x48df11;});}exports[_0x6132('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x58028b){var _0x40bc58=_0x6132('0xa');if(isAgentPaused(_0x58028b))_0x40bc58='pause';else if(isAgentPaused(_0x58028b,!![]))_0x40bc58=_0x6132('0x1c');else if(isAgentIdle(_0x58028b))_0x40bc58='idle';else _0x40bc58=_0x6132('0x1d');return _0x40bc58;}exports[_0x6132('0x1e')]=getAgentStatus;function getAgentIdsByQueues(_0x23ead8,_0x14e2b3){var _0x45cf4b=_[_0x6132('0x1f')](_0x23ead8)?_0x23ead8:[_0x23ead8];var _0x5d1a15=_['startCase'](_0x14e2b3)+_0x6132('0x20');var _0xd643e1=_[_0x6132('0x21')](_0x45cf4b,function(_0x29051b){return db[_0x5d1a15]['findOne']({'where':{'id':_0x29051b}})[_0x6132('0x16')](function(_0x28d5cb){if(!_0x28d5cb)return[];return _0x28d5cb['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0xd643e1)[_0x6132('0x16')](function(_0x1c5e30){var _0x1b8ed0=_(_0x1c5e30)[_0x6132('0x22')]()[_0x6132('0x21')]('id')[_0x6132('0x23')]()[_0x6132('0x24')]();return _0x1b8ed0;});}exports[_0x6132('0x25')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1e5f63,_0x1766c,_0x20d4bc){try{if(_0x1766c[_0x6132('0x9')]>0x0){_0x1e5f63=_0x1e5f63[_0x6132('0x26')](function(_0x39e28b){return _0x1766c[_0x6132('0x27')](_0x39e28b['id']);});}var _0x523540=_0x1e5f63[_0x6132('0x26')](function(_0x1e2c3d){var _0xbd6818=_0x6132('0x1d');if(isAgentIdle(_0x1e2c3d)){_0xbd6818=_0x6132('0xd');}return _0xbd6818===_0x20d4bc;});return _['map'](_0x523540,'id');}catch(_0x2a7ac6){throw _0x2a7ac6;}}exports[_0x6132('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1b0438,_0x5c0f46,_0x1f361a){return Promise[_0x6132('0x29')]()[_0x6132('0x16')](function(){if(_0x5c0f46[_0x6132('0x9')]>0x0){_0x1b0438=_0x1b0438['filter'](function(_0x5e1b36){return _0x5c0f46[_0x6132('0x27')](_0x5e1b36['id']);});}return _0x1b0438;})['then'](function(){return db[_0x6132('0x2a')][_0x6132('0x2b')]({'attributes':['id','name',_0x6132('0x2c'),_0x6132('0x2d'),_0x6132('0x3'),_0x6132('0x2e'),_0x6132('0x4'),'smsPause',_0x6132('0x6'),_0x6132('0x7'),_0x6132('0x2f')],'where':{'id':{'$in':_[_0x6132('0x21')](_0x1b0438,'id')}},'raw':!![]});})[_0x6132('0x16')](function(_0x2388da){return _0x2388da['map'](function(_0x263650){var _0x44f3d1=_[_0x6132('0x30')](_0x1b0438,['id',_0x263650['id']]);var _0x3d2cd3=filterAgentAttributes(_0x44f3d1);_[_0x6132('0x31')](_0x263650,_0x3d2cd3);_0x263650['globalStatus']=getAgentStatus(_0x263650);return _0x263650;});})[_0x6132('0x16')](function(_0x33e51b){var _0x5307dd=sortAgentsByStatus(_0x33e51b,_0x1f361a);return _[_0x6132('0x21')](_0x5307dd,'id');})[_0x6132('0x1a')](function(_0x360d5c){throw _0x360d5c;});}exports[_0x6132('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x574947){var _0x358de8={'fields':[],'order':null};var _0x5e8aa2=_0x574947[_0x6132('0x33')](',');_0x358de8[_0x6132('0x34')]=_[_0x6132('0x26')](_0x5e8aa2,function(_0x1d050d){if(!_0x1d050d[_0x6132('0x27')](_0x6132('0x35'))){return!![];}_0x358de8[_0x6132('0x36')]=_[_0x6132('0x37')](_0x1d050d,'-')?_0x6132('0x38'):_0x6132('0x39');return![];});return _0x358de8;}exports[_0x6132('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x1fa127){if(_0x1fa127[_0x6132('0x27')](_0x6132('0x2c'))&&!_0x1fa127[_0x6132('0x27')](_0x6132('0x3b'))){var _0x3b3b80=_0x1fa127['substring'](0x0,_0x1fa127['indexOf']('fullname'));_0x1fa127+=','+_0x3b3b80+_0x6132('0x3b');}return _0x1fa127;}exports[_0x6132('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x5669b1,_0x2a398a){var _0x581787=_0x5669b1['sort'](function(_0x37b927,_0x492f31){if(_0x37b927[_0x6132('0x35')]===_0x492f31['globalStatus']){if(_0x37b927[_0x6132('0x35')]===_0x6132('0xf')){if(_0x2a398a===_0x6132('0x38')){return(_0x37b927[_0x6132('0x2f')]||'')<(_0x492f31[_0x6132('0x2f')]||'')||_0x37b927[_0x6132('0x2c')][_0x6132('0x3d')]()>_0x492f31[_0x6132('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x37b927[_0x6132('0x2f')]||'')<(_0x492f31[_0x6132('0x2f')]||'')||_0x37b927['fullname'][_0x6132('0x3d')]()>_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?-0x1:0x1;}}else{if(_0x2a398a===_0x6132('0x38')){return _0x37b927[_0x6132('0x2c')][_0x6132('0x3d')]()<_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?0x1:-0x1;}else{return _0x37b927[_0x6132('0x2c')]['toLowerCase']()<_0x492f31[_0x6132('0x2c')][_0x6132('0x3d')]()?-0x1:0x1;}}}else{if(_0x2a398a===_0x6132('0x38')){return _0x37b927['globalStatus']<_0x492f31['globalStatus']?0x1:-0x1;}else{return _0x37b927[_0x6132('0x35')]<_0x492f31[_0x6132('0x35')]?-0x1:0x1;}}});return _0x581787;}exports[_0x6132('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x2e667d){var _0x508519=[_0x6132('0x3f'),_0x6132('0x40'),_0x6132('0x41'),_0x6132('0x42'),_0x6132('0x2f'),_0x6132('0x42'),'internal',_0x6132('0x43'),'chatPause',_0x6132('0x4'),_0x6132('0x2e'),_0x6132('0x5'),_0x6132('0x7'),_0x6132('0x3'),_0x6132('0x6'),_0x6132('0x44'),_0x6132('0x45'),_0x6132('0x46'),_0x6132('0x47'),_0x6132('0x48'),'faxCapacity',_0x6132('0x49'),_0x6132('0x4a'),_0x6132('0x4b'),'smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity',_0x6132('0x10'),_0x6132('0x4c'),_0x6132('0x12'),_0x6132('0x13'),'whatsappStatus',_0x6132('0x11'),_0x6132('0xe'),_0x6132('0x4d'),_0x6132('0x4e'),_0x6132('0x4f'),_0x6132('0x50'),_0x6132('0x51'),_0x6132('0x52'),'voiceStatusTime',_0x6132('0x53'),'destconnectedlinenum',_0x6132('0x54'),'phoneBarEnableScreenRecordingByAgent',_0x6132('0x55'),'routealias'];var _0xd7c778=['chatPause',_0x6132('0x4'),_0x6132('0x2e'),_0x6132('0x5'),_0x6132('0x7'),_0x6132('0x3'),_0x6132('0x6'),_0x6132('0x40')];var _0x3d8b25=_(_0x2e667d)['omit'](_0xd7c778)['pick'](_0x508519)['value']();return _0x3d8b25;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x47f1=['filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','resolve','User','findAll','name','fullname','pauseType','find','getSortedAgentsIdsByStatus','split','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','openchannelCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','whatsappStatus','openchannelStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','filterAgentAttributes','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47f1,0x1b8));var _0x147f=function(_0x2a48ea,_0x325995){_0x2a48ea=_0x2a48ea-0x0;var _0x140cbd=_0x47f1[_0x2a48ea];return _0x140cbd;};'use strict';var _=require(_0x147f('0x0'));var jayson=require('jayson/promise');var db=require(_0x147f('0x1'))['db'];var amiClient=jayson[_0x147f('0x2')][_0x147f('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x147f('0x3')]({'port':0x232c});function isAgentPaused(_0x22ba58,_0xdb5f0f){var _0x5f4104=[_0x22ba58[_0x147f('0x4')],_0x22ba58[_0x147f('0x5')],_0x22ba58[_0x147f('0x6')],_0x22ba58['openchannelPause'],_0x22ba58[_0x147f('0x7')],_0x22ba58[_0x147f('0x8')],_0x22ba58[_0x147f('0x9')]];if(!_0xdb5f0f)return _['every'](_0x5f4104);var _0x12f9cf=_[_0x147f('0xa')](_0x5f4104);return _0x12f9cf[_0x147f('0xb')]>0x0&&_0x12f9cf[_0x147f('0xb')]<_0x5f4104[_0x147f('0xb')]?!![]:![];}function isIdle(_0x59a8c9){return _0x59a8c9===_0x147f('0xc')||_0x59a8c9===_0x147f('0xd')||_0x59a8c9===_0x147f('0xe')||_0x59a8c9===_0x147f('0xf')||_[_0x147f('0x10')](_0x59a8c9);}function isAgentIdle(_0xf5cc9f){if(_0xf5cc9f[_0x147f('0x11')]!=='idle'&&_0xf5cc9f[_0x147f('0x8')]){_0xf5cc9f['voiceStatus']='pause';return![];}return _['every']([_0xf5cc9f[_0x147f('0x12')],_0xf5cc9f[_0x147f('0x13')],_0xf5cc9f[_0x147f('0x14')],_0xf5cc9f[_0x147f('0x15')],_0xf5cc9f[_0x147f('0x16')],_0xf5cc9f[_0x147f('0x11')],_0xf5cc9f['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x147f('0x17')](function(_0x308e42){if(_0x308e42['error']){throw new Error(_0x147f('0x18'));}var _0x409073=_0x308e42['result'];return routingClient['request'](_0x147f('0x19'),{})[_0x147f('0x17')](function(_0x4dddaf){if(_0x4dddaf[_0x147f('0x1a')]){throw new Error(_0x147f('0x1b'));}var _0x5a6e98=_0x4dddaf[_0x147f('0x1c')];return _[_0x147f('0x1d')]({},_0x409073,_0x5a6e98);});})[_0x147f('0x1e')](function(_0x3289cf){throw _0x3289cf;});}exports[_0x147f('0x1f')]=getRealtimeAgents;function getAgentStatus(_0x560875){var _0x1e432e=_0x147f('0xd');if(isAgentPaused(_0x560875))_0x1e432e=_0x147f('0x20');else if(isAgentPaused(_0x560875,!![]))_0x1e432e=_0x147f('0x21');else if(isAgentIdle(_0x560875))_0x1e432e='idle';else _0x1e432e=_0x147f('0x22');return _0x1e432e;}exports[_0x147f('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x555078,_0x10a928){var _0x4f72e9=_[_0x147f('0x24')](_0x555078)?_0x555078:[_0x555078];var _0x53cf0d=_[_0x147f('0x25')](_0x10a928)+_0x147f('0x26');var _0x29afd8=_[_0x147f('0x27')](_0x4f72e9,function(_0x357d1a){return db[_0x53cf0d][_0x147f('0x28')]({'where':{'id':_0x357d1a}})[_0x147f('0x17')](function(_0x47de2d){if(!_0x47de2d)return[];return _0x47de2d['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x147f('0x29')](_0x29afd8)[_0x147f('0x17')](function(_0x5717e7){var _0x5d5eef=_(_0x5717e7)[_0x147f('0x2a')]()['map']('id')['uniq']()[_0x147f('0x2b')]();return _0x5d5eef;});}exports[_0x147f('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5d9a1a,_0x395a38,_0x5ac5ee){try{if(_0x395a38[_0x147f('0xb')]>0x0){_0x5d9a1a=_0x5d9a1a[_0x147f('0xa')](function(_0x134e18){return _0x395a38[_0x147f('0x2d')](_0x134e18['id']);});}var _0x58e38e=_0x5d9a1a[_0x147f('0xa')](function(_0x335c62){var _0x3d52f3=_0x147f('0x22');if(isAgentIdle(_0x335c62)){_0x3d52f3=_0x147f('0xc');}return _0x3d52f3===_0x5ac5ee;});return _[_0x147f('0x27')](_0x58e38e,'id');}catch(_0x2a1ba0){throw _0x2a1ba0;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5d22b8,_0x276a0d,_0x46f585){return Promise[_0x147f('0x2e')]()[_0x147f('0x17')](function(){if(_0x276a0d['length']>0x0){_0x5d22b8=_0x5d22b8[_0x147f('0xa')](function(_0x523d11){return _0x276a0d[_0x147f('0x2d')](_0x523d11['id']);});}return _0x5d22b8;})['then'](function(){return db[_0x147f('0x2f')][_0x147f('0x30')]({'attributes':['id',_0x147f('0x31'),_0x147f('0x32'),_0x147f('0x4'),_0x147f('0x5'),'mailPause','openchannelPause','smsPause','voicePause',_0x147f('0x9'),_0x147f('0x33')],'where':{'id':{'$in':_[_0x147f('0x27')](_0x5d22b8,'id')}},'raw':!![]});})['then'](function(_0x5b0104){return _0x5b0104[_0x147f('0x27')](function(_0x4a6972){var _0x2b4422=_[_0x147f('0x34')](_0x5d22b8,['id',_0x4a6972['id']]);var _0x529fff=filterAgentAttributes(_0x2b4422);_['merge'](_0x4a6972,_0x529fff);_0x4a6972['globalStatus']=getAgentStatus(_0x4a6972);return _0x4a6972;});})['then'](function(_0x747e37){var _0x1b788d=sortAgentsByStatus(_0x747e37,_0x46f585);return _['map'](_0x1b788d,'id');})[_0x147f('0x1e')](function(_0x18ff11){throw _0x18ff11;});}exports[_0x147f('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x22bc76){var _0x51e92f={'fields':[],'order':null};var _0x4f65e2=_0x22bc76[_0x147f('0x36')](',');_0x51e92f['fields']=_[_0x147f('0xa')](_0x4f65e2,function(_0x411734){if(!_0x411734[_0x147f('0x2d')](_0x147f('0x37'))){return!![];}_0x51e92f['order']=_[_0x147f('0x38')](_0x411734,'-')?_0x147f('0x39'):_0x147f('0x3a');return![];});return _0x51e92f;}exports[_0x147f('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x1d3a78){if(_0x1d3a78['includes']('fullname')&&!_0x1d3a78[_0x147f('0x2d')](_0x147f('0x3c'))){var _0x1a7a38=_0x1d3a78[_0x147f('0x3d')](0x0,_0x1d3a78[_0x147f('0x3e')]('fullname'));_0x1d3a78+=','+_0x1a7a38+'internal';}return _0x1d3a78;}exports[_0x147f('0x3f')]=validateSortParameter;function sortAgentsByStatus(_0x14e549,_0x4687c4){var _0x4b74d6=_0x14e549[_0x147f('0x40')](function(_0x4d0f03,_0x4f8cc2){if(_0x4d0f03[_0x147f('0x37')]===_0x4f8cc2['globalStatus']){if(_0x4d0f03[_0x147f('0x37')]===_0x147f('0x20')){if(_0x4687c4===_0x147f('0x39')){return(_0x4d0f03['pauseType']||'')<(_0x4f8cc2[_0x147f('0x33')]||'')||_0x4d0f03[_0x147f('0x32')][_0x147f('0x41')]()>_0x4f8cc2[_0x147f('0x32')][_0x147f('0x41')]()?0x1:-0x1;}else{return(_0x4d0f03['pauseType']||'')<(_0x4f8cc2[_0x147f('0x33')]||'')||_0x4d0f03['fullname']['toLowerCase']()>_0x4f8cc2['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x4687c4===_0x147f('0x39')){return _0x4d0f03['fullname'][_0x147f('0x41')]()<_0x4f8cc2[_0x147f('0x32')][_0x147f('0x41')]()?0x1:-0x1;}else{return _0x4d0f03[_0x147f('0x32')][_0x147f('0x41')]()<_0x4f8cc2[_0x147f('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x4687c4===_0x147f('0x39')){return _0x4d0f03['globalStatus']<_0x4f8cc2[_0x147f('0x37')]?0x1:-0x1;}else{return _0x4d0f03[_0x147f('0x37')]<_0x4f8cc2[_0x147f('0x37')]?-0x1:0x1;}}});return _0x4b74d6;}exports[_0x147f('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x5a4873){var _0x104371=[_0x147f('0x43'),'online',_0x147f('0x44'),_0x147f('0x45'),_0x147f('0x33'),_0x147f('0x45'),_0x147f('0x3c'),_0x147f('0x46'),_0x147f('0x4'),_0x147f('0x47'),_0x147f('0x6'),_0x147f('0x7'),_0x147f('0x9'),_0x147f('0x5'),_0x147f('0x8'),'chatCapacity',_0x147f('0x48'),'mailCapacity',_0x147f('0x49'),'whatsappCapacity',_0x147f('0x4a'),_0x147f('0x4b'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x147f('0x4c'),_0x147f('0x4d'),'faxCurrentCapacity','chatStatus',_0x147f('0x15'),_0x147f('0x14'),_0x147f('0x16'),_0x147f('0x4e'),_0x147f('0x13'),_0x147f('0x11'),'chatStatusTime',_0x147f('0x4f'),'mailStatusTime',_0x147f('0x50'),_0x147f('0x51'),'faxStatusTime','voiceStatusTime',_0x147f('0x52'),_0x147f('0x53'),'screenrecording',_0x147f('0x54'),_0x147f('0x55'),_0x147f('0x56')];var _0x46901e=['chatPause','openchannelPause',_0x147f('0x6'),_0x147f('0x7'),_0x147f('0x9'),'faxPause',_0x147f('0x8'),_0x147f('0x57')];var _0x34f5ca=_(_0x5a4873)[_0x147f('0x58')](_0x46901e)['pick'](_0x104371)[_0x147f('0x2b')]();return _0x34f5ca;}exports[_0x147f('0x59')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c87bac4..28954a8 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(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0xd746ed,_0x81920c){var _0x5ef2a6=function(_0x3ec97a){while(--_0x3ec97a){_0xd746ed['push'](_0xd746ed['shift']());}};_0x5ef2a6(++_0x81920c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 e48d71e..a4b3693 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 _0x026b=['replace','hostname','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','keys','length','filter','family','IPv4','internal','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x45518f,_0x475a6b){var _0x198175=function(_0x40d333){while(--_0x40d333){_0x45518f['push'](_0x45518f['shift']());}};_0x198175(++_0x475a6b);}(_0x026b,0x1ef));var _0xb026=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x026b[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0xb026('0x0'));var os=require('os');var crypto=require(_0xb026('0x1'));var machine=require(_0xb026('0x2'));var exec=require(_0xb026('0x3'))[_0xb026('0x4')];var config=require('../environment');function getInterfaces(){var _0x1763ab=[];var _0x57fdb8=os[_0xb026('0x5')]();var _0x99b839=_['orderBy'](_[_0xb026('0x6')](_0x57fdb8));for(var _0x34bb9f=0x0;_0x34bb9f<_0x99b839[_0xb026('0x7')];_0x34bb9f++){var _0x4e2e67=_0x57fdb8[_0x99b839[_0x34bb9f]][_0xb026('0x8')](function(_0xade454){return _0xade454[_0xb026('0x9')]===_0xb026('0xa')&&_0xade454[_0xb026('0xb')]===![];});_0x1763ab=_0x1763ab['concat'](_0x4e2e67);}return _0x1763ab;}function getFirstInterface(){var _0xce15df=_[_0xb026('0xc')](getInterfaces());return{'macAddress':_0xce15df&&_0xce15df[_0xb026('0xd')]?_0xce15df[_0xb026('0xd')]:_0xb026('0xe'),'ipAddress':_0xce15df&&_0xce15df['address']?_0xce15df['address']:'127.0.0.1'};}exports[_0xb026('0xf')]=getFirstInterface;function getCPUhash(){var _0x599aa7=_['orderBy'](os[_0xb026('0x10')]()[_0xb026('0x11')](function(_0x2308d1){return _0x2308d1['model'];}))[_0xb026('0x12')](':');return crypto[_0xb026('0x13')]('md5')[_0xb026('0x14')](_0x599aa7)[_0xb026('0x15')](_0xb026('0x16'));}exports[_0xb026('0x17')]=function(){var _0x559dcd=os[_0xb026('0x18')]();var _0x4b18b8=/[0-9a-f-]{36}/;if(config[_0xb026('0x19')]&&_0x4b18b8[_0xb026('0x1a')](config['licenseToken'])){return config[_0xb026('0x19')];}else if(_0x559dcd===_0xb026('0x1b')){return exec(_0xb026('0x1c'),{'encoding':_0xb026('0x1d')})[_0xb026('0x1e')]('\x0d\x0a','');}else{var _0x454088=getFirstInterface();var _0x50fe61=getCPUhash();var _0x3cbeac=_0x50fe61+'|'+os[_0xb026('0x1f')]()+'|'+_0x454088['macAddress']+'|'+_0x454088[_0xb026('0x20')];var _0x13fbde=crypto[_0xb026('0x13')](_0xb026('0x21'))[_0xb026('0x14')](_0x3cbeac)['digest'](_0xb026('0x16'));return _0x13fbde[_0xb026('0x22')](0x0,0x8)+'-'+_0x13fbde[_0xb026('0x22')](0x8,0xc)+'-'+_0x13fbde[_0xb026('0x22')](0xc,0x10)+'-'+_0x13fbde['substring'](0x10,0x14)+'-'+_0x13fbde[_0xb026('0x22')](0x14);}}; \ No newline at end of file +var _0x6d7f=['replace','hostname','macAddress','ipAddress','md5','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','update','digest','hex','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x6d7f,0x14a));var _0xf6d7=function(_0x444760,_0x3539f4){_0x444760=_0x444760-0x0;var _0x4f12bf=_0x6d7f[_0x444760];return _0x4f12bf;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xf6d7('0x0'));var machine=require(_0xf6d7('0x1'));var exec=require(_0xf6d7('0x2'))[_0xf6d7('0x3')];var config=require(_0xf6d7('0x4'));function getInterfaces(){var _0x29fd52=[];var _0x5e2e82=os[_0xf6d7('0x5')]();var _0x42a7fe=_[_0xf6d7('0x6')](_[_0xf6d7('0x7')](_0x5e2e82));for(var _0x1901ee=0x0;_0x1901ee<_0x42a7fe[_0xf6d7('0x8')];_0x1901ee++){var _0x3aa5db=_0x5e2e82[_0x42a7fe[_0x1901ee]]['filter'](function(_0x4355d7){return _0x4355d7[_0xf6d7('0x9')]===_0xf6d7('0xa')&&_0x4355d7[_0xf6d7('0xb')]===![];});_0x29fd52=_0x29fd52[_0xf6d7('0xc')](_0x3aa5db);}return _0x29fd52;}function getFirstInterface(){var _0x1660c1=_['head'](getInterfaces());return{'macAddress':_0x1660c1&&_0x1660c1[_0xf6d7('0xd')]?_0x1660c1[_0xf6d7('0xd')]:_0xf6d7('0xe'),'ipAddress':_0x1660c1&&_0x1660c1[_0xf6d7('0xf')]?_0x1660c1[_0xf6d7('0xf')]:_0xf6d7('0x10')};}exports[_0xf6d7('0x11')]=getFirstInterface;function getCPUhash(){var _0x19fcc6=_[_0xf6d7('0x6')](os[_0xf6d7('0x12')]()['map'](function(_0x5fd006){return _0x5fd006[_0xf6d7('0x13')];}))['join'](':');return crypto[_0xf6d7('0x14')]('md5')[_0xf6d7('0x15')](_0x19fcc6)[_0xf6d7('0x16')](_0xf6d7('0x17'));}exports[_0xf6d7('0x18')]=function(){var _0x4e039c=os[_0xf6d7('0x19')]();var _0x2f4b14=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x2f4b14[_0xf6d7('0x1a')](config[_0xf6d7('0x1b')])){return config[_0xf6d7('0x1b')];}else if(_0x4e039c==='win32'){return exec(_0xf6d7('0x1c'),{'encoding':_0xf6d7('0x1d')})[_0xf6d7('0x1e')]('\x0d\x0a','');}else{var _0x29b4bf=getFirstInterface();var _0x3463a2=getCPUhash();var _0x4939e9=_0x3463a2+'|'+os[_0xf6d7('0x1f')]()+'|'+_0x29b4bf[_0xf6d7('0x20')]+'|'+_0x29b4bf[_0xf6d7('0x21')];var _0x17fa63=crypto[_0xf6d7('0x14')](_0xf6d7('0x22'))['update'](_0x4939e9)[_0xf6d7('0x16')](_0xf6d7('0x17'));return _0x17fa63[_0xf6d7('0x23')](0x0,0x8)+'-'+_0x17fa63[_0xf6d7('0x23')](0x8,0xc)+'-'+_0x17fa63['substring'](0xc,0x10)+'-'+_0x17fa63[_0xf6d7('0x23')](0x10,0x14)+'-'+_0x17fa63[_0xf6d7('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 82ccc84..3b70f26 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 _0xca3f=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xca3f,0x1ea));var _0xfca3=function(_0x3f8353,_0x493caa){_0x3f8353=_0x3f8353-0x0;var _0x513881=_0xca3f[_0x3f8353];return _0x513881;};'use strict';var util=require(_0xfca3('0x0'));var moment=require(_0xfca3('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xfca3('0x2'))(module,_0xfca3('0x3'));var db=require(_0xfca3('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xfca3('0x5'));var logger=require(_0xfca3('0x6'))(_0xfca3('0x7'));var HOST=_0xfca3('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x34cae2){return new BPromise(function(_0x2f3467,_0x289e40){var _0x13b005=util[_0xfca3('0x9')](_0xfca3('0xa'),HOST,_0x34cae2,module[_0xfca3('0xb')][_0xfca3('0x3')]);if(oldToken){_0x13b005=util[_0xfca3('0x9')](_0xfca3('0xc'),HOST,_0x34cae2,module[_0xfca3('0xb')][_0xfca3('0x3')],oldToken);}var _0x82e8b0={'uri':_0x13b005,'method':_0xfca3('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x82e8b0)['then'](function(_0x2aa3a9){_0x2f3467(_0x2aa3a9);})[_0xfca3('0xe')](function(_0x1b3c7c){_0x289e40(_0x1b3c7c);});});}function manageLicense(_0x146f19,_0x20dc16){var _0x8bacd3=_0x20dc16[_0xfca3('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x8bacd3[_0xfca3('0x10')]!==_0x146f19&&!_0x8bacd3[_0xfca3('0x11')]){oldToken=_0x8bacd3['data1'];}httpRequest(_0x146f19)[_0xfca3('0x12')](function(_0x1e9295){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1e9295[_0xfca3('0x13')]){isOldTokenSent=![];if(!_0x8bacd3[_0xfca3('0x7')]&&_0x8bacd3[_0xfca3('0x7')]!=_0x1e9295[_0xfca3('0x7')]||_0x8bacd3[_0xfca3('0x7')]&&_0x8bacd3[_0xfca3('0x11')]){logger[_0xfca3('0x14')](_0xfca3('0x15'));}if(_0x8bacd3['license']&&!_0x8bacd3[_0xfca3('0x11')]&&_0x8bacd3['license']!=_0x1e9295[_0xfca3('0x7')]){logger[_0xfca3('0x14')](_0xfca3('0x16'));}if(_0x8bacd3[_0xfca3('0x7')]&&!_0x8bacd3[_0xfca3('0x11')]&&_0x8bacd3[_0xfca3('0x7')]==_0x1e9295[_0xfca3('0x7')]){return _0x20dc16;}return _0x20dc16[_0xfca3('0x17')]({'data1':_0x146f19,'data2':null,'license':_0x1e9295[_0xfca3('0x7')]});}else{if(_0x1e9295[_0xfca3('0x7')]||_0x8bacd3[_0xfca3('0x7')]){if(!_0x8bacd3[_0xfca3('0x11')]){if(_0x8bacd3[_0xfca3('0x10')]==_0x146f19){GRAY_PERIOD_REASON=_0xfca3('0x18');logger[_0xfca3('0x14')](_0xfca3('0x19'));}else{GRAY_PERIOD_REASON=_0xfca3('0x1a');logger[_0xfca3('0x14')](_0xfca3('0x1b'),_0x8bacd3[_0xfca3('0x10')],_0x146f19);}logger[_0xfca3('0x14')](_0xfca3('0x1c'),GRAY_PERIOD_REASON[_0xfca3('0x1d')](),moment()[_0xfca3('0x9')](_0xfca3('0x1e')));return _0x20dc16[_0xfca3('0x17')]({'data2':encryptor['encryptString'](moment()[_0xfca3('0x9')](_0xfca3('0x1e')))});}else{if(moment()[_0xfca3('0x1f')](encryptor[_0xfca3('0x20')](_0x8bacd3[_0xfca3('0x11')]),_0xfca3('0x21'))>DAYS){logger[_0xfca3('0x14')](_0xfca3('0x22'),moment()[_0xfca3('0x9')](_0xfca3('0x1e')));isOldTokenSent=![];return _0x20dc16[_0xfca3('0x17')]({'data1':_0x146f19,'data2':null,'license':null});}}}else{if(_0x8bacd3[_0xfca3('0x10')]!=_0x146f19){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x8bacd3[_0xfca3('0x10')],_0x146f19);return _0x20dc16['update']({'data1':_0x146f19,'data2':null,'license':null});}}}return _0x20dc16;})['then'](function(_0x3c50a2){_0x20dc16=_0x3c50a2;})['catch'](function(_0x1b8de7){logger[_0xfca3('0x23')](_0x1b8de7[_0xfca3('0x24')]);})[_0xfca3('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xfca3('0x26')](),_0x20dc16);},TIME);});}function defaultLicense(){var _0x38878c=hardware[_0xfca3('0x26')]();if(_0x38878c){return db[_0xfca3('0x27')][_0xfca3('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x38878c}})['spread'](function(_0x186b94,_0x83c507){logger[_0xfca3('0x14')](_0xfca3('0x29'),_0x38878c);manageLicense(_0x38878c,_0x186b94);})['catch'](function(_0x364864){logger[_0xfca3('0x23')](_0x364864[_0xfca3('0x24')]);});}}exports[_0xfca3('0x2a')]=defaultLicense; \ No newline at end of file +var _0x0529=['../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','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','decryptString','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','error','default','util','request-promise','bluebird','pkginfo','version'];(function(_0x3023c8,_0x5d734e){var _0x20bddd=function(_0x261170){while(--_0x261170){_0x3023c8['push'](_0x3023c8['shift']());}};_0x20bddd(++_0x5d734e);}(_0x0529,0xe5));var _0x9052=function(_0x57ee7a,_0x7d202b){_0x57ee7a=_0x57ee7a-0x0;var _0xdf9b8b=_0x0529[_0x57ee7a];return _0xdf9b8b;};'use strict';var util=require(_0x9052('0x0'));var moment=require('moment');var rp=require(_0x9052('0x1'));var BPromise=require(_0x9052('0x2'));var pkginfo=require(_0x9052('0x3'))(module,_0x9052('0x4'));var db=require(_0x9052('0x5'))['db'];var encryptor=require(_0x9052('0x6'));var hardware=require(_0x9052('0x7'));var logger=require(_0x9052('0x8'))(_0x9052('0x9'));var HOST=_0x9052('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x58bb71){return new BPromise(function(_0x222e32,_0x5d3b2c){var _0x293b44=util[_0x9052('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x58bb71,module[_0x9052('0xc')][_0x9052('0x4')]);if(oldToken){_0x293b44=util[_0x9052('0xb')](_0x9052('0xd'),HOST,_0x58bb71,module[_0x9052('0xc')][_0x9052('0x4')],oldToken);}var _0x4aefcc={'uri':_0x293b44,'method':_0x9052('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4aefcc)[_0x9052('0xf')](function(_0x35fc74){_0x222e32(_0x35fc74);})[_0x9052('0x10')](function(_0x4bc7e7){_0x5d3b2c(_0x4bc7e7);});});}function manageLicense(_0x4ea69d,_0x283793){var _0x16efcd=_0x283793[_0x9052('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x16efcd['data1']!==_0x4ea69d&&!_0x16efcd[_0x9052('0x12')]){oldToken=_0x16efcd['data1'];}httpRequest(_0x4ea69d)[_0x9052('0xf')](function(_0x40eb1f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x40eb1f[_0x9052('0x13')]){isOldTokenSent=![];if(!_0x16efcd[_0x9052('0x9')]&&_0x16efcd[_0x9052('0x9')]!=_0x40eb1f[_0x9052('0x9')]||_0x16efcd[_0x9052('0x9')]&&_0x16efcd['data2']){logger[_0x9052('0x14')](_0x9052('0x15'));}if(_0x16efcd[_0x9052('0x9')]&&!_0x16efcd[_0x9052('0x12')]&&_0x16efcd[_0x9052('0x9')]!=_0x40eb1f[_0x9052('0x9')]){logger['info'](_0x9052('0x16'));}if(_0x16efcd[_0x9052('0x9')]&&!_0x16efcd[_0x9052('0x12')]&&_0x16efcd['license']==_0x40eb1f[_0x9052('0x9')]){return _0x283793;}return _0x283793['update']({'data1':_0x4ea69d,'data2':null,'license':_0x40eb1f['license']});}else{if(_0x40eb1f[_0x9052('0x9')]||_0x16efcd[_0x9052('0x9')]){if(!_0x16efcd['data2']){if(_0x16efcd[_0x9052('0x17')]==_0x4ea69d){GRAY_PERIOD_REASON='Disabled';logger[_0x9052('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x9052('0x18');logger['info'](_0x9052('0x19'),_0x16efcd[_0x9052('0x17')],_0x4ea69d);}logger['info'](_0x9052('0x1a'),GRAY_PERIOD_REASON[_0x9052('0x1b')](),moment()[_0x9052('0xb')](_0x9052('0x1c')));return _0x283793[_0x9052('0x1d')]({'data2':encryptor[_0x9052('0x1e')](moment()[_0x9052('0xb')](_0x9052('0x1c')))});}else{if(moment()['diff'](encryptor[_0x9052('0x1f')](_0x16efcd['data2']),_0x9052('0x20'))>DAYS){logger['info'](_0x9052('0x21'),moment()[_0x9052('0xb')](_0x9052('0x1c')));isOldTokenSent=![];return _0x283793[_0x9052('0x1d')]({'data1':_0x4ea69d,'data2':null,'license':null});}}}else{if(_0x16efcd[_0x9052('0x17')]!=_0x4ea69d){logger[_0x9052('0x14')](_0x9052('0x19'),_0x16efcd['data1'],_0x4ea69d);return _0x283793[_0x9052('0x1d')]({'data1':_0x4ea69d,'data2':null,'license':null});}}}return _0x283793;})['then'](function(_0x14635b){_0x283793=_0x14635b;})[_0x9052('0x10')](function(_0x368ed9){logger['error'](_0x368ed9[_0x9052('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9052('0x23')](),_0x283793);},TIME);});}function defaultLicense(){var _0x4a677f=hardware[_0x9052('0x23')]();if(_0x4a677f){return db[_0x9052('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4a677f}})['spread'](function(_0x40e55d,_0x13de9c){logger[_0x9052('0x14')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4a677f);manageLicense(_0x4a677f,_0x40e55d);})[_0x9052('0x10')](function(_0x36767c){logger[_0x9052('0x25')](_0x36767c[_0x9052('0x22')]);});}}exports[_0x9052('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4def367..0ac3e3d 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 _0x5a68=['changed','message','User','findAll','sequelize','COUNT','col','role','admin','telephone','users','telephones','user','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','util','lodash','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','grayReason'];(function(_0xf9b9e5,_0x5df420){var _0x4b591e=function(_0x502eaa){while(--_0x502eaa){_0xf9b9e5['push'](_0xf9b9e5['shift']());}};_0x4b591e(++_0x5df420);}(_0x5a68,0x126));var _0x85a6=function(_0xa11497,_0x3714a5){_0xa11497=_0xa11497-0x0;var _0x1bbe80=_0x5a68[_0xa11497];return _0x1bbe80;};'use strict';var util=require(_0x85a6('0x0'));var _=require(_0x85a6('0x1'));var moment=require('moment');var BPromise=require(_0x85a6('0x2'));var hardware=require(_0x85a6('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x85a6('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x85a6('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x85a6('0x6'),'machineUuid':hardware[_0x85a6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x85a6('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x85a6('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x8e4bf1){return new BPromise(function(_0x41c8ea,_0x126337){return db[_0x85a6('0x8')][_0x85a6('0x9')](_['defaults'](_0x8e4bf1,{'raw':!![],'where':{'id':0x1}}))[_0x85a6('0xa')](function(_0x59da92){return checkLicense(_0x59da92,null);})['then'](function(_0x3272a1){_0x41c8ea(_0x3272a1);return;})['catch'](function(_0x12fc08){_0x126337(_0x12fc08);});});}function checkLicense(_0x128d09,_0x37e5f3){if(!_0x128d09){demoLicense['uuid']=_0x128d09['data1'];return demoLicense;}try{var _0x1ba532=_0x37e5f3||_0x128d09[_0x85a6('0xb')];if(_[_0x85a6('0xc')](_0x1ba532)){throw new Error(_0x85a6('0xd'));}var _0x1f2474=_0x128d09[_0x85a6('0xe')];var _0xbe043c=_0x128d09[_0x85a6('0xf')];var _0x548d14=_0x1f2474[_0x85a6('0x10')]('-')[0x4];var _0x36161a=_0x1f2474['split']('-')[0x0];var _0x1f1804=encryptor[_0x85a6('0x11')](_0x1ba532,util[_0x85a6('0x12')](_0x85a6('0x13'),_0x548d14,_0x1f2474,_0x36161a));var _0xe3503d=JSON[_0x85a6('0x14')](_0x1f1804);_0xe3503d[_0x85a6('0x15')]=![];_0xe3503d[_0x85a6('0x16')]=_0x1f2474;_0xe3503d[_0x85a6('0x17')]=hardware[_0x85a6('0x7')]();if(_0xbe043c){var _0x7ebd19=encryptor['decryptString'](_0xbe043c);_0xe3503d[_0x85a6('0x18')]=_0x7ebd19;_0xe3503d[_0x85a6('0x19')]=moment(_0x7ebd19)[_0x85a6('0x1a')](0x7,'days')['format']();_0xe3503d[_0x85a6('0x1b')]=_0xe3503d[_0x85a6('0x16')]!=_0xe3503d[_0x85a6('0x17')]?_0x85a6('0x1c'):'disabled';}return _0xe3503d;}catch(_0x55525e){breakingLicense[_0x85a6('0x16')]=_0x128d09[_0x85a6('0xe')];breakingLicense['message']=_0x55525e[_0x85a6('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x45c870,_0x56fba0){getLicense()[_0x85a6('0xa')](function(_0x452014){return db[_0x85a6('0x1e')][_0x85a6('0x1f')]({'attributes':['role',[db[_0x85a6('0x20')]['fn'](_0x85a6('0x21'),db['sequelize'][_0x85a6('0x22')](_0x85a6('0x23'))),'count']],'group':_0x85a6('0x23'),'where':{'role':{'$or':[_0x85a6('0x24'),'user',_0x85a6('0x25')]}},'raw':!![]})[_0x85a6('0xa')](function(_0x316c5e){var _0x575d9b={'user':_0x452014[_0x85a6('0x26')]||0x0,'telephone':_0x452014[_0x85a6('0x27')]||0x0};_0x316c5e['forEach'](function(_0x4b10c9){var _0x4f083f=_0x4b10c9[_0x85a6('0x23')]===_0x85a6('0x24')?_0x85a6('0x28'):_0x4b10c9[_0x85a6('0x23')];_0x575d9b[_0x4f083f]-=_0x4b10c9[_0x85a6('0x29')];if(_0x575d9b[_0x4f083f]<0x0)_0x575d9b[_0x4f083f]=0x0;});_0x45c870(_0x575d9b);return;});})[_0x85a6('0x2a')](function(_0x254b79){_0x56fba0(_0x254b79);});});}function checkUserLimits(_0x3a7ccd){return new BPromise(function(_0x365d71,_0x276dbc){getLimits()[_0x85a6('0xa')](function(_0x4f7bcd){var _0x12aeb7=_[_0x85a6('0x2b')](_[_0x85a6('0x2c')](_0x3a7ccd,_0x85a6('0x23')),[_0x85a6('0x24'),_0x85a6('0x28'),_0x85a6('0x25')]);var _0x5c817e=(_0x12aeb7['admin']||0x0)+(_0x12aeb7[_0x85a6('0x28')]||0x0);var _0x2b9e2b=_0x12aeb7[_0x85a6('0x25')]||0x0;if(_0x5c817e>_0x4f7bcd[_0x85a6('0x28')])return _0x276dbc('License\x20limit\x20reached\x20for\x20users');if(_0x2b9e2b>_0x4f7bcd[_0x85a6('0x25')])return _0x276dbc(_0x85a6('0x2d'));return _0x365d71();})[_0x85a6('0x2a')](function(_0x4dfcb9){_0x276dbc(_0x4dfcb9);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x67a0=['days','disabled','message','User','role','sequelize','COUNT','col','count','user','telephone','forEach','admin','pick','exports','util','lodash','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x67a0,0x1b3));var _0x067a=function(_0x16a79a,_0x3550f6){_0x16a79a=_0x16a79a-0x0;var _0x3e022c=_0x67a0[_0x16a79a];return _0x3e022c;};'use strict';var util=require(_0x067a('0x0'));var _=require(_0x067a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0x067a('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x067a('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x067a('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x067a('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x067a('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x067a('0x6'),'machineUuid':hardware[_0x067a('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2065de){return new BPromise(function(_0x117736,_0x571826){return db[_0x067a('0x7')][_0x067a('0x8')](_[_0x067a('0x9')](_0x2065de,{'raw':!![],'where':{'id':0x1}}))[_0x067a('0xa')](function(_0x4d59ef){return checkLicense(_0x4d59ef,null);})[_0x067a('0xa')](function(_0x43144b){_0x117736(_0x43144b);return;})[_0x067a('0xb')](function(_0x18d9de){_0x571826(_0x18d9de);});});}function checkLicense(_0x3aff35,_0x3ea4f2){if(!_0x3aff35){demoLicense[_0x067a('0xc')]=_0x3aff35[_0x067a('0xd')];return demoLicense;}try{var _0x60f0b2=_0x3ea4f2||_0x3aff35['license'];if(_[_0x067a('0xe')](_0x60f0b2)){throw new Error(_0x067a('0xf'));}var _0x720aca=_0x3aff35['data1'];var _0x1ba740=_0x3aff35[_0x067a('0x10')];var _0x462670=_0x720aca['split']('-')[0x4];var _0xe54f23=_0x720aca[_0x067a('0x11')]('-')[0x0];var _0xd2976e=encryptor[_0x067a('0x12')](_0x60f0b2,util[_0x067a('0x13')](_0x067a('0x14'),_0x462670,_0x720aca,_0xe54f23));var _0x5313b7=JSON[_0x067a('0x15')](_0xd2976e);_0x5313b7[_0x067a('0x16')]=![];_0x5313b7[_0x067a('0xc')]=_0x720aca;_0x5313b7[_0x067a('0x17')]=hardware[_0x067a('0x5')]();if(_0x1ba740){var _0x51c216=encryptor[_0x067a('0x12')](_0x1ba740);_0x5313b7[_0x067a('0x18')]=_0x51c216;_0x5313b7[_0x067a('0x19')]=moment(_0x51c216)[_0x067a('0x1a')](0x7,_0x067a('0x1b'))[_0x067a('0x13')]();_0x5313b7['grayReason']=_0x5313b7['uuid']!=_0x5313b7[_0x067a('0x17')]?'changed':_0x067a('0x1c');}return _0x5313b7;}catch(_0x4d39e8){breakingLicense[_0x067a('0xc')]=_0x3aff35[_0x067a('0xd')];breakingLicense['message']=_0x4d39e8[_0x067a('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x44f0f1,_0xb839e6){getLicense()[_0x067a('0xa')](function(_0x3732c5){return db[_0x067a('0x1e')]['findAll']({'attributes':[_0x067a('0x1f'),[db[_0x067a('0x20')]['fn'](_0x067a('0x21'),db[_0x067a('0x20')][_0x067a('0x22')](_0x067a('0x1f'))),_0x067a('0x23')]],'group':_0x067a('0x1f'),'where':{'role':{'$or':['admin',_0x067a('0x24'),_0x067a('0x25')]}},'raw':!![]})[_0x067a('0xa')](function(_0x568176){var _0x450fb7={'user':_0x3732c5['users']||0x0,'telephone':_0x3732c5['telephones']||0x0};_0x568176[_0x067a('0x26')](function(_0x388afd){var _0x4f6e70=_0x388afd[_0x067a('0x1f')]===_0x067a('0x27')?'user':_0x388afd[_0x067a('0x1f')];_0x450fb7[_0x4f6e70]-=_0x388afd[_0x067a('0x23')];if(_0x450fb7[_0x4f6e70]<0x0)_0x450fb7[_0x4f6e70]=0x0;});_0x44f0f1(_0x450fb7);return;});})[_0x067a('0xb')](function(_0xb2658){_0xb839e6(_0xb2658);});});}function checkUserLimits(_0x2789aa){return new BPromise(function(_0x902497,_0x440e8f){getLimits()['then'](function(_0x1d416c){var _0x51c38e=_[_0x067a('0x28')](_['countBy'](_0x2789aa,'role'),[_0x067a('0x27'),_0x067a('0x24'),_0x067a('0x25')]);var _0x469353=(_0x51c38e[_0x067a('0x27')]||0x0)+(_0x51c38e['user']||0x0);var _0x1debf9=_0x51c38e[_0x067a('0x25')]||0x0;if(_0x469353>_0x1d416c[_0x067a('0x24')])return _0x440e8f('License\x20limit\x20reached\x20for\x20users');if(_0x1debf9>_0x1d416c['telephone'])return _0x440e8f('License\x20limit\x20reached\x20for\x20telephones');return _0x902497();})['catch'](function(_0x50a608){_0x440e8f(_0x50a608);});});}module[_0x067a('0x29')]={'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 7b89563..ade7493 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 _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0xe58f62,_0x42b6df){var _0x316a14=function(_0x3f9d02){while(--_0x3f9d02){_0xe58f62['push'](_0xe58f62['shift']());}};_0x316a14(++_0x42b6df);}(_0xdb28,0x106));var _0x8db2=function(_0x278824,_0x5f2ffc){_0x278824=_0x278824-0x0;var _0x550575=_0xdb28[_0x278824];return _0x550575;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x28f2,0x193));var _0x228f=function(_0x224496,_0x4eadbd){_0x224496=_0x224496-0x0;var _0x41c108=_0x28f2[_0x224496];return _0x41c108;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 609b3f2..2da88bb 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4681=['fileLogger'];(function(_0x248706,_0x5bc444){var _0x42191b=function(_0x302fd6){while(--_0x302fd6){_0x248706['push'](_0x248706['shift']());}};_0x42191b(++_0x5bc444);}(_0x4681,0x76));var _0x1468=function(_0x295baf,_0xd3abfa){_0x295baf=_0x295baf-0x0;var _0xccdd10=_0x4681[_0x295baf];return _0xccdd10;};'use strict';var fileLogger=require('../utils/loggers')[_0x1468('0x0')];module['exports']=fileLogger; \ No newline at end of file +var _0x4b01=['../utils/loggers','fileLogger','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4b01,0x129));var _0x14b0=function(_0xb62f31,_0x154afd){_0xb62f31=_0xb62f31-0x0;var _0x37c2c8=_0x4b01[_0xb62f31];return _0x37c2c8;};'use strict';var fileLogger=require(_0x14b0('0x0'))[_0x14b0('0x1')];module[_0x14b0('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3cd4fc5..2bf3926 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 _0x5d3f=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x44c37f,_0x185917){var _0x2c0d33=function(_0xd87bcf){while(--_0xd87bcf){_0x44c37f['push'](_0x44c37f['shift']());}};_0x2c0d33(++_0x185917);}(_0x5d3f,0x144));var _0xf5d3=function(_0x5859db,_0xf843a3){_0x5859db=_0x5859db-0x0;var _0x67c069=_0x5d3f[_0x5859db];return _0x67c069;};'use strict';var path=require(_0xf5d3('0x0'));var os=require('os');var config={'apps':[{'name':_0xf5d3('0x1'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x3'))},{'name':_0xf5d3('0x4'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x5'))},{'name':'agi','script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x6'))},{'name':_0xf5d3('0x7'),'script':path[_0xf5d3('0x2')](__dirname,_0xf5d3('0x8'))},{'name':_0xf5d3('0x9'),'script':path['join'](__dirname,_0xf5d3('0xa'))},{'name':_0xf5d3('0xb'),'script':path[_0xf5d3('0x2')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0xe146=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js'];(function(_0x2ba612,_0x31ffe7){var _0x2250b7=function(_0x2b8094){while(--_0x2b8094){_0x2ba612['push'](_0x2ba612['shift']());}};_0x2250b7(++_0x31ffe7);}(_0xe146,0xdc));var _0x6e14=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0xe146[_0x58381c];return _0x1a7440;};'use strict';var path=require(_0x6e14('0x0'));var os=require('os');var config={'apps':[{'name':_0x6e14('0x1'),'script':path[_0x6e14('0x2')](__dirname,_0x6e14('0x3'))},{'name':_0x6e14('0x4'),'script':path[_0x6e14('0x2')](__dirname,_0x6e14('0x5'))},{'name':'agi','script':path[_0x6e14('0x2')](__dirname,_0x6e14('0x6'))},{'name':_0x6e14('0x7'),'script':path[_0x6e14('0x2')](__dirname,_0x6e14('0x8'))},{'name':_0x6e14('0x9'),'script':path[_0x6e14('0x2')](__dirname,_0x6e14('0xa'))},{'name':_0x6e14('0xb'),'script':path[_0x6e14('0x2')](__dirname,_0x6e14('0xc'))}]};module[_0x6e14('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2b71c36..d2a2269 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 _0x2f3a=['restart','list','describe','delete','dump','saved','bluebird','./config','connect','connected','start','then','disconnect'];(function(_0x52c5e9,_0xd5fab7){var _0x21b5d7=function(_0x5eadd2){while(--_0x5eadd2){_0x52c5e9['push'](_0x52c5e9['shift']());}};_0x21b5d7(++_0xd5fab7);}(_0x2f3a,0x117));var _0xa2f3=function(_0x25b676,_0x73e863){_0x25b676=_0x25b676-0x0;var _0x4f0374=_0x2f3a[_0x25b676];return _0x4f0374;};'use strict';var pm2=require('pm2');var BPromise=require(_0xa2f3('0x0'));var config=require(_0xa2f3('0x1'));function connect(){return new BPromise(function(_0x3bb97a,_0x1682bc){return pm2[_0xa2f3('0x2')](function(_0x198add){if(_0x198add){return _0x1682bc(_0x198add);}return _0x3bb97a(_0xa2f3('0x3'));});});};exports[_0xa2f3('0x4')]=function(_0x3ceb91){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x9ea5b3,_0x334ee8){return pm2[_0xa2f3('0x4')](_0x3ceb91,function(_0xefaa00,_0xb7ef3a){if(_0xefaa00){return _0x334ee8(_0xefaa00);}pm2['disconnect']();return _0x9ea5b3(_0xb7ef3a);});});});};exports['stop']=function(_0x3967c4){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x131732,_0x1a95a2){return pm2['stop'](_0x3967c4,function(_0x8b405a,_0x1efe94){if(_0x8b405a){return _0x1a95a2(_0x8b405a);}pm2[_0xa2f3('0x6')]();return _0x131732(_0x1efe94);});});});};exports[_0xa2f3('0x7')]=function(_0x11df75){return connect()['then'](function(){return new BPromise(function(_0x320baf,_0x12298d){return pm2['restart'](_0x11df75,function(_0x4cdf4f,_0x3e4c27){if(_0x4cdf4f){return _0x12298d(_0x4cdf4f);}pm2[_0xa2f3('0x6')]();return _0x320baf(_0x3e4c27);});});});};exports[_0xa2f3('0x8')]=function(){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x52adb7,_0x2d24e8){return pm2[_0xa2f3('0x8')](function(_0x15e508,_0x2555a1){if(_0x15e508){return _0x2d24e8(_0x15e508);}pm2[_0xa2f3('0x6')]();return _0x52adb7(_0x2555a1);});});});};exports['describe']=function(_0x5a4ccf){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x13d64d,_0x3dbfbc){return pm2[_0xa2f3('0x9')](_0x5a4ccf,function(_0x4b5b47,_0x5b073a){if(_0x4b5b47){return _0x3dbfbc(_0x4b5b47);}pm2['disconnect']();return _0x13d64d(_0x5b073a);});});});};exports[_0xa2f3('0xa')]=function(_0x5e06b3){return connect()['then'](function(){return new BPromise(function(_0x200691,_0x3fe39a){return pm2['delete'](_0x5e06b3,function(_0x49da3c,_0x4da5f3){if(_0x49da3c){return _0x3fe39a(_0x49da3c);}pm2['disconnect']();return _0x200691(_0x4da5f3);});});});};exports[_0xa2f3('0xb')]=function(){return connect()[_0xa2f3('0x5')](function(){return new BPromise(function(_0x25fd91,_0x2826e2){return pm2['dump'](function(_0x11c7a9){if(_0x11c7a9){return _0x2826e2(_0x11c7a9);}return _0x25fd91(_0xa2f3('0xc'));});});});}; \ No newline at end of file +var _0x30a5=['disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','then','start'];(function(_0x3d98cf,_0x5b4aff){var _0x447d34=function(_0x1402af){while(--_0x1402af){_0x3d98cf['push'](_0x3d98cf['shift']());}};_0x447d34(++_0x5b4aff);}(_0x30a5,0xa4));var _0x530a=function(_0x1612d6,_0x5577bf){_0x1612d6=_0x1612d6-0x0;var _0x27a583=_0x30a5[_0x1612d6];return _0x27a583;};'use strict';var pm2=require(_0x530a('0x0'));var BPromise=require('bluebird');var config=require(_0x530a('0x1'));function connect(){return new BPromise(function(_0x469b3d,_0x5eb80d){return pm2[_0x530a('0x2')](function(_0x2b2ff7){if(_0x2b2ff7){return _0x5eb80d(_0x2b2ff7);}return _0x469b3d('connected');});});};exports['start']=function(_0x412746){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x25c84d,_0x19338b){return pm2[_0x530a('0x4')](_0x412746,function(_0x53858b,_0x7714b4){if(_0x53858b){return _0x19338b(_0x53858b);}pm2[_0x530a('0x5')]();return _0x25c84d(_0x7714b4);});});});};exports[_0x530a('0x6')]=function(_0x53d5a6){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x180cf8,_0x4d206b){return pm2[_0x530a('0x6')](_0x53d5a6,function(_0x12b952,_0x326aea){if(_0x12b952){return _0x4d206b(_0x12b952);}pm2[_0x530a('0x5')]();return _0x180cf8(_0x326aea);});});});};exports[_0x530a('0x7')]=function(_0x50948e){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x44cb65,_0x222e85){return pm2[_0x530a('0x7')](_0x50948e,function(_0x5ebe62,_0x189940){if(_0x5ebe62){return _0x222e85(_0x5ebe62);}pm2[_0x530a('0x5')]();return _0x44cb65(_0x189940);});});});};exports[_0x530a('0x8')]=function(){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x537fb5,_0x32e199){return pm2['list'](function(_0x355e9a,_0x59c29f){if(_0x355e9a){return _0x32e199(_0x355e9a);}pm2['disconnect']();return _0x537fb5(_0x59c29f);});});});};exports['describe']=function(_0xb1b94b){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x182365,_0x4efe3c){return pm2[_0x530a('0x9')](_0xb1b94b,function(_0x13b31d,_0x1db6b1){if(_0x13b31d){return _0x4efe3c(_0x13b31d);}pm2[_0x530a('0x5')]();return _0x182365(_0x1db6b1);});});});};exports[_0x530a('0xa')]=function(_0x2f1e44){return connect()['then'](function(){return new BPromise(function(_0x2de0bc,_0x271e07){return pm2[_0x530a('0xa')](_0x2f1e44,function(_0x29bec6,_0xe0bcbc){if(_0x29bec6){return _0x271e07(_0x29bec6);}pm2[_0x530a('0x5')]();return _0x2de0bc(_0xe0bcbc);});});});};exports['dump']=function(){return connect()[_0x530a('0x3')](function(){return new BPromise(function(_0x2d16ba,_0x2aaa42){return pm2[_0x530a('0xb')](function(_0x41e9e9){if(_0x41e9e9){return _0x2aaa42(_0x41e9e9);}return _0x2d16ba(_0x530a('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 62512f6..fad8978 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 _0x98ce=['lastMsgAt','minutes','length','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll'];(function(_0x4bd963,_0x2681e4){var _0x26e68a=function(_0x62eeaf){while(--_0x62eeaf){_0x4bd963['push'](_0x4bd963['shift']());}};_0x26e68a(++_0x2681e4);}(_0x98ce,0x99));var _0xe98c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98ce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0xe98c('0x0'));var Redis=require(_0xe98c('0x1'));var util=require(_0xe98c('0x2'));var config=require(_0xe98c('0x3'));var db=require(_0xe98c('0x4'))['db'];var logger=require(_0xe98c('0x5'))(_0xe98c('0x6'));config[_0xe98c('0x7')]=_[_0xe98c('0x8')](config[_0xe98c('0x7')],{'host':_0xe98c('0x9'),'port':0x18eb});var io=require(_0xe98c('0xa'))(new Redis(config[_0xe98c('0x7')]));function closeInteractions(){var _0x5dd005=0x0;var _0x1a81dd=[];return db[_0xe98c('0xb')][_0xe98c('0xc')]({'raw':!![],'attributes':['id',_0xe98c('0xd')],'where':{'id':0x1}})[_0xe98c('0xe')](function(_0x32b6cf){_0x5dd005=_0x32b6cf[_0xe98c('0xd')];if(_0x5dd005){return db[_0xe98c('0xf')][_0xe98c('0x10')]({'raw':!![],'attributes':['id',_0xe98c('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x32b6cf[_0xe98c('0xd')],_0xe98c('0x12'))}}});}else{return[];}})[_0xe98c('0xe')](function(_0x21814f){if(_0x21814f&&_0x21814f[_0xe98c('0x13')]){_0x1a81dd=_['map'](_0x21814f||[],'id');logger[_0xe98c('0x14')]('[CHAT]\x20Interactions\x20to\x20close:',_0x1a81dd[_0xe98c('0x15')]());return db[_0xe98c('0xf')][_0xe98c('0x16')]({'closeReason':_0xe98c('0x17'),'disposition':_0xe98c('0x18'),'closed':!![],'closedAt':moment()[_0xe98c('0x19')](_0xe98c('0x1a'))},{'where':{'id':_0x1a81dd}});}})[_0xe98c('0xe')](function(){if(_0x1a81dd&&_0x1a81dd['length']){logger[_0xe98c('0x14')](_0xe98c('0x1b'),_0x1a81dd['join']());for(var _0x2e2d8c=0x0;_0x2e2d8c<_0x1a81dd[_0xe98c('0x13')];_0x2e2d8c++){io['emit'](_0xe98c('0x1c'),{'id':_0x1a81dd[_0x2e2d8c],'closed':!![]});}}})[_0xe98c('0x1d')](function(_0x27282f){logger[_0xe98c('0x1e')](_0xe98c('0x1f'),_0x27282f?util[_0xe98c('0x20')](_0x27282f,{'showHidden':![],'depth':null}):'');});}exports[_0xe98c('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xef08=['../logger','schedule','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb'];(function(_0x536c1e,_0x18be65){var _0x5d2b51=function(_0x4c8a38){while(--_0x4c8a38){_0x536c1e['push'](_0x536c1e['shift']());}};_0x5d2b51(++_0x18be65);}(_0xef08,0x77));var _0x8ef0=function(_0x339478,_0x246478){_0x339478=_0x339478-0x0;var _0xa696b0=_0xef08[_0x339478];return _0xa696b0;};'use strict';var _=require(_0x8ef0('0x0'));var moment=require(_0x8ef0('0x1'));var Redis=require(_0x8ef0('0x2'));var util=require(_0x8ef0('0x3'));var config=require('../../config/environment');var db=require(_0x8ef0('0x4'))['db'];var logger=require(_0x8ef0('0x5'))(_0x8ef0('0x6'));config['redis']=_[_0x8ef0('0x7')](config['redis'],{'host':_0x8ef0('0x8'),'port':0x18eb});var io=require(_0x8ef0('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x2f43cf=0x0;var _0x38251f=[];return db[_0x8ef0('0xa')][_0x8ef0('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x296769){_0x2f43cf=_0x296769[_0x8ef0('0xc')];if(_0x2f43cf){return db[_0x8ef0('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8ef0('0xe')](_0x296769['chatTimeout'],_0x8ef0('0xf'))}}});}else{return[];}})[_0x8ef0('0x10')](function(_0x3ab4b0){if(_0x3ab4b0&&_0x3ab4b0[_0x8ef0('0x11')]){_0x38251f=_[_0x8ef0('0x12')](_0x3ab4b0||[],'id');logger[_0x8ef0('0x13')](_0x8ef0('0x14'),_0x38251f[_0x8ef0('0x15')]());return db[_0x8ef0('0xd')]['update']({'closeReason':_0x8ef0('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x8ef0('0x17'))},{'where':{'id':_0x38251f}});}})[_0x8ef0('0x10')](function(){if(_0x38251f&&_0x38251f['length']){logger['info'](_0x8ef0('0x18'),_0x38251f[_0x8ef0('0x15')]());for(var _0x1a23bf=0x0;_0x1a23bf<_0x38251f[_0x8ef0('0x11')];_0x1a23bf++){io[_0x8ef0('0x19')](_0x8ef0('0x1a'),{'id':_0x38251f[_0x1a23bf],'closed':!![]});}}})[_0x8ef0('0x1b')](function(_0x10c89d){logger['error'](_0x8ef0('0x1c'),_0x10c89d?util[_0x8ef0('0x1d')](_0x10c89d,{'showHidden':![],'depth':null}):'');});}exports[_0x8ef0('0x1e')]=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 684f4f9..a2989ea 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 _0x9ee1=['startAllRefreshIntervals','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9ee1,0xaa));var _0x19ee=function(_0x10d6ca,_0x265cfe){_0x10d6ca=_0x10d6ca-0x0;var _0x44cfe1=_0x9ee1[_0x10d6ca];return _0x44cfe1;};'use strict';function start(){var _0x1e5c08=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1e5c08[_0x19ee('0x0')]();}module[_0x19ee('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0d5b=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x4d6db9,_0x24b29b){var _0x58f3ae=function(_0x57bce8){while(--_0x57bce8){_0x4d6db9['push'](_0x4d6db9['shift']());}};_0x58f3ae(++_0x24b29b);}(_0x0d5b,0x187));var _0xb0d5=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x0d5b[_0x24259d];return _0x5a701;};'use strict';function start(){var _0x33374f=require(_0xb0d5('0x0'));return _0x33374f[_0xb0d5('0x1')]();}module[_0xb0d5('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 4fe5919..7bfbd88 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 _0xeee9=['email','MailAccount','format','name','Smtp','bcc','../../files/reports','savename','%s.%s','extname','zip','join','existsSync','status','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','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','stop\x20cron','update\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to'];(function(_0x49ea8f,_0xd3f62c){var _0x314374=function(_0x5328a1){while(--_0x5328a1){_0x49ea8f['push'](_0x49ea8f['shift']());}};_0x314374(++_0xd3f62c);}(_0xeee9,0x1f0));var _0x9eee=function(_0x211543,_0x254f24){_0x211543=_0x211543-0x0;var _0x11a997=_0xeee9[_0x211543];return _0x11a997;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x9eee('0x0'));var _=require(_0x9eee('0x1'));var moment=require(_0x9eee('0x2'));var CronJobManager=require(_0x9eee('0x3'));var jayson=require(_0x9eee('0x4'));var BPromise=require(_0x9eee('0x5'));var logger=require(_0x9eee('0x6'))(_0x9eee('0x7'));var db=require(_0x9eee('0x8'))['db'];var analyticCustomReportController=require(_0x9eee('0x9'));var analyticDefaultReportController=require(_0x9eee('0xa'));var client=jayson[_0x9eee('0xb')][_0x9eee('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x55de23,_0x2bc09e){return function(){logger['info'](_0x9eee('0xd'),_0x55de23[_0x9eee('0xe')]);var _0x1c3034=!![];var _0x39aa04=_0x55de23[_0x9eee('0xf')]['getSmtpOptions']();var _0x56a55a={'account':_0x39aa04,'message':{'from':util[_0x9eee('0x10')]('\x22%s\x22\x20<%s>',_0x55de23[_0x9eee('0xf')][_0x9eee('0x11')],_0x55de23[_0x9eee('0xf')][_0x9eee('0xe')]||_0x55de23[_0x9eee('0xf')][_0x9eee('0x12')]['user']),'to':_0x55de23['email'],'cc':_0x55de23['cc'],'bcc':_0x55de23[_0x9eee('0x13')],'subject':util[_0x9eee('0x10')]('Report\x20%s\x20last\x20%s\x20%s',_0x2bc09e[_0x9eee('0x11')],_0x55de23['subtractNumber'],_0x55de23['subtractUnit'])}};var _0xe2b2c4=path['join'](__dirname,_0x9eee('0x14'));var _0xf0e13b=_0x2bc09e[_0x9eee('0x15')];var _0x1327e8=util['format'](_0x9eee('0x16'),path['basename'](_0x2bc09e['savename'],path[_0x9eee('0x17')](_0x2bc09e['savename'])),_0x9eee('0x18'));var _0x32aab3=path[_0x9eee('0x19')](_0xe2b2c4,_0xf0e13b);var _0x35d20f=path[_0x9eee('0x19')](_0xe2b2c4,_0x1327e8);if(fs[_0x9eee('0x1a')](_0x32aab3)){_0x2bc09e[_0x9eee('0x1b')]='Sent';_0x56a55a[_0x9eee('0x1c')][_0x9eee('0x1d')]=[{'filename':_0xf0e13b,'path':_0x32aab3}];_0x56a55a[_0x9eee('0x1c')]['text']=util[_0x9eee('0x10')](_0x9eee('0x1e'),JSON[_0x9eee('0x1f')](_0x2bc09e,null,0x2));}else if(fs['existsSync'](_0x35d20f)){_0x2bc09e[_0x9eee('0x1b')]=_0x9eee('0x20');_0x56a55a['message'][_0x9eee('0x1d')]=[{'filename':_0x1327e8,'path':_0x35d20f}];}else{_0x56a55a['message'][_0x9eee('0x21')]=_0x9eee('0x22');if(!_0x55de23[_0x9eee('0x23')]){_0x1c3034=![];logger[_0x9eee('0x24')](_0x9eee('0x25'));}}if(_0x1c3034){return client['request']('SendMail',_0x56a55a)['then'](function(_0x21e5a3){if(_0x21e5a3[_0x9eee('0x26')]){return logger['error'](_0x9eee('0x27'),JSON[_0x9eee('0x1f')](_0x21e5a3));}return logger['info'](_0x9eee('0x28'));})[_0x9eee('0x29')](function(_0x4f4597){return logger[_0x9eee('0x26')]('error\x20mail',JSON[_0x9eee('0x1f')](_0x4f4597));});}};}function handleError(){return function(_0x22cc71){return logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x22cc71));};}function handleResult(_0x27e224){return function(_0x1b1cef){logger[_0x9eee('0x24')](_0x9eee('0x2a'),JSON[_0x9eee('0x1f')](_0x1b1cef));if(_0x27e224[_0x9eee('0xf')]&&_0x27e224[_0x9eee('0xf')][_0x9eee('0x12')]&&!_[_0x9eee('0x2b')](_0x27e224[_0x9eee('0xe')])){setTimeout(handleSendEmail(_0x27e224,_0x1b1cef),0x3c*0x3e8);}};}function handleJob(_0x34348b){return function(){try{if(_[_0x9eee('0x2b')](_0x34348b[_0x9eee('0x2c')])){return logger[_0x9eee('0x24')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x9eee('0x2b')](_0x34348b['subtractUnit'])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1256b4={'startDate':moment()[_0x9eee('0x2d')](_0x34348b[_0x9eee('0x2c')],_0x34348b['subtractUnit'])[_0x9eee('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x9eee('0x10')](_0x9eee('0x2e')),'type':_0x9eee('0x2f'),'output':_0x34348b[_0x9eee('0x30')],'name':_0x34348b[_0x9eee('0x11')]};if(!_[_0x9eee('0x2b')](_0x34348b[_0x9eee('0x31')])){logger[_0x9eee('0x24')](_0x9eee('0x32'),_0x34348b[_0x9eee('0x31')]);return analyticDefaultReportController[_0x9eee('0x33')]({'id':_0x34348b[_0x9eee('0x31')]},_0x1256b4)[_0x9eee('0x34')](handleResult(_0x34348b))[_0x9eee('0x29')](handleError());}if(!_['isNil'](_0x34348b[_0x9eee('0x35')])){logger[_0x9eee('0x24')](_0x9eee('0x36'),_0x34348b[_0x9eee('0x35')]);return analyticCustomReportController['runReport']({'id':_0x34348b['CustomReportId']},_0x1256b4)[_0x9eee('0x34')](handleResult(_0x34348b))[_0x9eee('0x29')](handleError());}}catch(_0x4561bd){logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x4561bd));}return logger['info'](_0x9eee('0x37'));};}function getJobs(_0xff7c9){var _0x5e24ff={};if(_0xff7c9){_0x5e24ff['id']=_0xff7c9;}return db[_0x9eee('0x38')][_0x9eee('0x39')]({'where':_0x5e24ff,'include':[{'model':db[_0x9eee('0xf')],'attributes':['id',_0x9eee('0x11'),_0x9eee('0xe')],'include':[{'model':db['MailServerOut'],'as':_0x9eee('0x12'),'include':[{'model':db['CloudProvider'],'as':_0x9eee('0x3a')}]}]}]})[_0x9eee('0x34')](function(_0x32591f){var _0xccba53=_[_0x9eee('0x3b')](manager[_0x9eee('0x3c')]);var _0x1f4669=_[_0x9eee('0x3d')](_0x32591f,function(_0x2bce9a){return _0x2bce9a['id'][_0x9eee('0x3e')]();});var _0x525c76=_[_0x9eee('0x3f')](_0x32591f,function(_0x4785ae){return _0x4785ae['id']['toString']();});var _0x29e654=_0xff7c9?_0x1f4669:_[_0x9eee('0x40')](_0x1f4669,_0xccba53);var _0x282cd7=_[_0x9eee('0x41')](_0x1f4669,_0xccba53);var _0x39ddad=_[_0x9eee('0x40')](_0xccba53,_0x1f4669);var _0x2f936a;var _0x2ece02;for(_0x2f936a=0x0;_0x2f936a<_0x39ddad[_0x9eee('0x42')]&&!_0xff7c9;_0x2f936a+=0x1){_0x2ece02=_0x39ddad[_0x2f936a][_0x9eee('0x3e')]();if(manager[_0x9eee('0x43')](_0x2ece02)){manager[_0x9eee('0x44')](_0x2ece02);manager['deleteJob'](_0x2ece02);logger[_0x9eee('0x24')](_0x9eee('0x45'),_0x2ece02);}}logger['info'](_0x9eee('0x46'),JSON['stringify'](_0x29e654));for(_0x2f936a=0x0;_0x2f936a<_0x29e654[_0x9eee('0x42')];_0x2f936a+=0x1){_0x2ece02=_0x29e654[_0x2f936a][_0x9eee('0x3e')]();logger[_0x9eee('0x24')](_0x9eee('0x47'),_0x2ece02);if(_0xff7c9){logger[_0x9eee('0x24')](_0x9eee('0x48'),_0xff7c9);logger[_0x9eee('0x24')](JSON[_0x9eee('0x1f')](_0x525c76[_0x2ece02]));BPromise[_0x9eee('0x49')]()[_0x9eee('0x34')](handleJob(_0x525c76[_0x2ece02]));logger['info'](_0x9eee('0x4a'),_0x525c76[_0x2ece02]['name'],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}else if(_0x525c76[_0x2ece02][_0x9eee('0x4b')]&&_0x525c76[_0x2ece02][_0x9eee('0x4c')]&&moment()[_0x9eee('0x4d')](_0x525c76[_0x2ece02][_0x9eee('0x4e')],_0x525c76[_0x2ece02][_0x9eee('0x4f')])){manager[_0x9eee('0x50')](_0x2ece02,_0x525c76[_0x2ece02]['cron'],handleJob(_0x525c76[_0x2ece02]));manager[_0x9eee('0x51')](_0x2ece02);logger[_0x9eee('0x24')]('add\x20cron',_0x525c76[_0x2ece02]['name'],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}else if(manager[_0x9eee('0x43')](_0x2ece02)){manager['stop'](_0x2ece02);manager[_0x9eee('0x52')](_0x2ece02);logger['info'](_0x9eee('0x53'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}}for(_0x2f936a=0x0,_0x2ece02;_0x2f936a<_0x282cd7['length']&&!_0xff7c9;_0x2f936a+=0x1){_0x2ece02=_0x282cd7[_0x2f936a][_0x9eee('0x3e')]();if(manager['exists'](_0x2ece02)){if(_0x525c76[_0x2ece02][_0x9eee('0x4b')]&&_0x525c76[_0x2ece02][_0x9eee('0x4c')]&&moment()[_0x9eee('0x4d')](_0x525c76[_0x2ece02]['startAt'],_0x525c76[_0x2ece02][_0x9eee('0x4f')])){manager['update'](_0x2ece02,_0x525c76[_0x2ece02]['cron'],handleJob(_0x525c76[_0x2ece02]));logger[_0x9eee('0x24')](_0x9eee('0x54'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02]['cron']);}else{manager[_0x9eee('0x44')](_0x2ece02);manager[_0x9eee('0x52')](_0x2ece02);logger['info'](_0x9eee('0x53'),_0x525c76[_0x2ece02][_0x9eee('0x11')],_0x525c76[_0x2ece02][_0x9eee('0x4b')]);}}}})['catch'](function(_0x1a2727){logger[_0x9eee('0x26')](JSON[_0x9eee('0x1f')](_0x1a2727));});}exports['run']=function(_0x2c0f0e){return getJobs(_0x2c0f0e);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x03fe=['runReport','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','map','difference','intersection','exists','delete\x20cron','toRun','length','toString','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','basename','extname','zip','existsSync','status','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','text','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','data','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId'];(function(_0x62117a,_0xe697fd){var _0x5cb735=function(_0xf56a44){while(--_0xf56a44){_0x62117a['push'](_0x62117a['shift']());}};_0x5cb735(++_0xe697fd);}(_0x03fe,0x73));var _0xe03f=function(_0x363eab,_0x466c43){_0x363eab=_0x363eab-0x0;var _0xe2916=_0x03fe[_0x363eab];return _0xe2916;};'use strict';var fs=require('fs');var util=require(_0xe03f('0x0'));var path=require(_0xe03f('0x1'));var _=require(_0xe03f('0x2'));var moment=require(_0xe03f('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe03f('0x4'));var BPromise=require(_0xe03f('0x5'));var logger=require('../logger')(_0xe03f('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe03f('0x7'));var client=jayson[_0xe03f('0x8')][_0xe03f('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3a3227,_0x163e08){return function(){logger['info'](_0xe03f('0xa'),_0x3a3227[_0xe03f('0xb')]);var _0x4eb71c=!![];var _0x1f9e37=_0x3a3227[_0xe03f('0xc')][_0xe03f('0xd')]();var _0x35eb55={'account':_0x1f9e37,'message':{'from':util[_0xe03f('0xe')](_0xe03f('0xf'),_0x3a3227[_0xe03f('0xc')][_0xe03f('0x10')],_0x3a3227[_0xe03f('0xc')][_0xe03f('0xb')]||_0x3a3227['MailAccount'][_0xe03f('0x11')][_0xe03f('0x12')]),'to':_0x3a3227[_0xe03f('0xb')],'cc':_0x3a3227['cc'],'bcc':_0x3a3227[_0xe03f('0x13')],'subject':util[_0xe03f('0xe')](_0xe03f('0x14'),_0x163e08[_0xe03f('0x10')],_0x3a3227[_0xe03f('0x15')],_0x3a3227[_0xe03f('0x16')])}};var _0x23ba83=path[_0xe03f('0x17')](__dirname,'../../files/reports');var _0x32ecb1=_0x163e08['savename'];var _0x2d9c34=util['format']('%s.%s',path[_0xe03f('0x18')](_0x163e08['savename'],path[_0xe03f('0x19')](_0x163e08['savename'])),_0xe03f('0x1a'));var _0x3ecf83=path[_0xe03f('0x17')](_0x23ba83,_0x32ecb1);var _0x9589ef=path[_0xe03f('0x17')](_0x23ba83,_0x2d9c34);if(fs[_0xe03f('0x1b')](_0x3ecf83)){_0x163e08[_0xe03f('0x1c')]=_0xe03f('0x1d');_0x35eb55[_0xe03f('0x1e')]['attachments']=[{'filename':_0x32ecb1,'path':_0x3ecf83}];_0x35eb55[_0xe03f('0x1e')]['text']=util[_0xe03f('0xe')](_0xe03f('0x1f'),JSON[_0xe03f('0x20')](_0x163e08,null,0x2));}else if(fs[_0xe03f('0x1b')](_0x9589ef)){_0x163e08['status']=_0xe03f('0x1d');_0x35eb55['message']['attachments']=[{'filename':_0x2d9c34,'path':_0x9589ef}];}else{_0x35eb55[_0xe03f('0x1e')][_0xe03f('0x21')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x3a3227['sendIfEmpty']){_0x4eb71c=![];logger[_0xe03f('0x22')](_0xe03f('0x23'));}}if(_0x4eb71c){return client[_0xe03f('0x24')](_0xe03f('0x25'),_0x35eb55)['then'](function(_0x9a2f44){if(_0x9a2f44[_0xe03f('0x26')]){return logger['error'](_0xe03f('0x27'),JSON['stringify'](_0x9a2f44));}return logger[_0xe03f('0x22')]('email\x20sent');})['catch'](function(_0x26ba6e){return logger[_0xe03f('0x26')]('error\x20mail',JSON[_0xe03f('0x20')](_0x26ba6e));});}};}function handleError(){return function(_0x413c06){return logger['error'](JSON[_0xe03f('0x20')](_0x413c06));};}function handleResult(_0x1402ee){return function(_0x43f1a7){logger['info'](_0xe03f('0x28'),JSON[_0xe03f('0x20')](_0x43f1a7));if(_0x1402ee[_0xe03f('0xc')]&&_0x1402ee['MailAccount'][_0xe03f('0x11')]&&!_[_0xe03f('0x29')](_0x1402ee['email'])){setTimeout(handleSendEmail(_0x1402ee,_0x43f1a7),0x3c*0x3e8);}};}function handleJob(_0x3c8c43){return function(){try{if(_[_0xe03f('0x29')](_0x3c8c43[_0xe03f('0x15')])){return logger[_0xe03f('0x22')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xe03f('0x29')](_0x3c8c43[_0xe03f('0x16')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x27c608={'startDate':moment()[_0xe03f('0x2a')](_0x3c8c43[_0xe03f('0x15')],_0x3c8c43[_0xe03f('0x16')])[_0xe03f('0xe')](_0xe03f('0x2b')),'endDate':moment()[_0xe03f('0xe')](_0xe03f('0x2b')),'type':_0xe03f('0x2c'),'output':_0x3c8c43[_0xe03f('0x2d')],'name':_0x3c8c43[_0xe03f('0x10')]};if(!_[_0xe03f('0x29')](_0x3c8c43[_0xe03f('0x2e')])){logger[_0xe03f('0x22')]('exec\x20defaul\x20report\x20id:%s',_0x3c8c43[_0xe03f('0x2e')]);return analyticDefaultReportController[_0xe03f('0x2f')]({'id':_0x3c8c43['DefaultReportId']},_0x27c608)[_0xe03f('0x30')](handleResult(_0x3c8c43))[_0xe03f('0x31')](handleError());}if(!_['isNil'](_0x3c8c43[_0xe03f('0x32')])){logger[_0xe03f('0x22')](_0xe03f('0x33'),_0x3c8c43[_0xe03f('0x32')]);return analyticCustomReportController[_0xe03f('0x2f')]({'id':_0x3c8c43['CustomReportId']},_0x27c608)[_0xe03f('0x30')](handleResult(_0x3c8c43))[_0xe03f('0x31')](handleError());}}catch(_0x2c20a8){logger[_0xe03f('0x26')](JSON[_0xe03f('0x20')](_0x2c20a8));}return logger['info']('no\x20report\x20id');};}function getJobs(_0xdd18e0){var _0x282a31={};if(_0xdd18e0){_0x282a31['id']=_0xdd18e0;}return db[_0xe03f('0x34')][_0xe03f('0x35')]({'where':_0x282a31,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe03f('0x10'),_0xe03f('0xb')],'include':[{'model':db[_0xe03f('0x36')],'as':_0xe03f('0x11'),'include':[{'model':db[_0xe03f('0x37')],'as':_0xe03f('0x37')}]}]}]})[_0xe03f('0x30')](function(_0x82960a){var _0x33d9ef=_[_0xe03f('0x38')](manager['jobs']);var _0xabf1ab=_[_0xe03f('0x39')](_0x82960a,function(_0x443afb){return _0x443afb['id']['toString']();});var _0x56089b=_['keyBy'](_0x82960a,function(_0x3acffa){return _0x3acffa['id']['toString']();});var _0x845807=_0xdd18e0?_0xabf1ab:_[_0xe03f('0x3a')](_0xabf1ab,_0x33d9ef);var _0x4fb5ab=_[_0xe03f('0x3b')](_0xabf1ab,_0x33d9ef);var _0x239063=_['difference'](_0x33d9ef,_0xabf1ab);var _0x407912;var _0x44d514;for(_0x407912=0x0;_0x407912<_0x239063['length']&&!_0xdd18e0;_0x407912+=0x1){_0x44d514=_0x239063[_0x407912]['toString']();if(manager[_0xe03f('0x3c')](_0x44d514)){manager['stop'](_0x44d514);manager['deleteJob'](_0x44d514);logger[_0xe03f('0x22')](_0xe03f('0x3d'),_0x44d514);}}logger[_0xe03f('0x22')](_0xe03f('0x3e'),JSON[_0xe03f('0x20')](_0x845807));for(_0x407912=0x0;_0x407912<_0x845807[_0xe03f('0x3f')];_0x407912+=0x1){_0x44d514=_0x845807[_0x407912][_0xe03f('0x40')]();logger[_0xe03f('0x22')](_0xe03f('0x41'),_0x44d514);if(_0xdd18e0){logger[_0xe03f('0x22')](_0xe03f('0x42'),_0xdd18e0);logger[_0xe03f('0x22')](JSON[_0xe03f('0x20')](_0x56089b[_0x44d514]));BPromise[_0xe03f('0x43')]()[_0xe03f('0x30')](handleJob(_0x56089b[_0x44d514]));logger[_0xe03f('0x22')](_0xe03f('0x44'),_0x56089b[_0x44d514][_0xe03f('0x10')],_0x56089b[_0x44d514][_0xe03f('0x45')]);}else if(_0x56089b[_0x44d514][_0xe03f('0x45')]&&_0x56089b[_0x44d514][_0xe03f('0x46')]&&moment()[_0xe03f('0x47')](_0x56089b[_0x44d514][_0xe03f('0x48')],_0x56089b[_0x44d514][_0xe03f('0x49')])){manager[_0xe03f('0x4a')](_0x44d514,_0x56089b[_0x44d514][_0xe03f('0x45')],handleJob(_0x56089b[_0x44d514]));manager[_0xe03f('0x4b')](_0x44d514);logger[_0xe03f('0x22')](_0xe03f('0x4c'),_0x56089b[_0x44d514][_0xe03f('0x10')],_0x56089b[_0x44d514][_0xe03f('0x45')]);}else if(manager['exists'](_0x44d514)){manager['stop'](_0x44d514);manager[_0xe03f('0x4d')](_0x44d514);logger[_0xe03f('0x22')](_0xe03f('0x4e'),_0x56089b[_0x44d514][_0xe03f('0x10')],_0x56089b[_0x44d514][_0xe03f('0x45')]);}}for(_0x407912=0x0,_0x44d514;_0x407912<_0x4fb5ab['length']&&!_0xdd18e0;_0x407912+=0x1){_0x44d514=_0x4fb5ab[_0x407912]['toString']();if(manager['exists'](_0x44d514)){if(_0x56089b[_0x44d514][_0xe03f('0x45')]&&_0x56089b[_0x44d514][_0xe03f('0x46')]&&moment()[_0xe03f('0x47')](_0x56089b[_0x44d514]['startAt'],_0x56089b[_0x44d514][_0xe03f('0x49')])){manager['update'](_0x44d514,_0x56089b[_0x44d514][_0xe03f('0x45')],handleJob(_0x56089b[_0x44d514]));logger[_0xe03f('0x22')](_0xe03f('0x4f'),_0x56089b[_0x44d514][_0xe03f('0x10')],_0x56089b[_0x44d514][_0xe03f('0x45')]);}else{manager['stop'](_0x44d514);manager['deleteJob'](_0x44d514);logger[_0xe03f('0x22')](_0xe03f('0x4e'),_0x56089b[_0x44d514][_0xe03f('0x10')],_0x56089b[_0x44d514]['cron']);}}}})['catch'](function(_0x5341a4){logger['error'](JSON[_0xe03f('0x20')](_0x5341a4));});}exports[_0xe03f('0x50')]=function(_0x1dc1a9){return getJobs(_0x1dc1a9);};exports[_0xe03f('0x4b')]=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 8bdb969..35e67fd 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 _0x77f1=['sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Sentiment','Neutral','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','CloudProvider','push','start','aws-sdk','request-promise','util','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment'];(function(_0x4d3fac,_0x1598b2){var _0x202e79=function(_0x37656a){while(--_0x37656a){_0x4d3fac['push'](_0x4d3fac['shift']());}};_0x202e79(++_0x1598b2);}(_0x77f1,0x1dd));var _0x177f=function(_0x900b63,_0x58019b){_0x900b63=_0x900b63-0x0;var _0x232f3b=_0x77f1[_0x900b63];return _0x232f3b;};var _=require('lodash');var AWS=require(_0x177f('0x0'));var rp=require(_0x177f('0x1'));var util=require(_0x177f('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x177f('0x3'));function getTranscriptionJob(_0x139df2,_0x57dc73,_0x68cb6a,_0x22c85f){return new Promise(function(_0x31c4de,_0x3f30a3){var _0x1bd6b3=new AWS['TranscribeService']({'accessKeyId':_0x57dc73,'secretAccessKey':_0x139df2,'region':_0x68cb6a});_0x1bd6b3[_0x177f('0x4')]({'TranscriptionJobName':_0x22c85f},function(_0xbbdec1,_0x480125){if(_0xbbdec1){return _0x3f30a3(_0xbbdec1);}else{return _0x31c4de(_0x480125);}});});}function sentiment(_0xba9371,_0x51a488,_0x2652b4,_0x4e1bab,_0x2050c2){return new Promise(function(_0x38989d,_0x47ccab){var _0x42d6d2=new AWS[(_0x177f('0x5'))]({'accessKeyId':_0x51a488,'secretAccessKey':_0xba9371,'region':_0x2652b4});_0x42d6d2[_0x177f('0x6')]({'Text':_0x4e1bab,'LanguageCode':_0x2050c2[_0x177f('0x7')](0x0,0x2)},function(_0x233919,_0x46e4d0){if(_0x233919){return _0x47ccab(_0x233919);}else{return _0x38989d(_0x46e4d0);}});});}function checkTranscribeJob(_0x35e9f3,_0x224550,_0x564f48){var _0x2d1299;return new BPromise(function(_0xb74829,_0x3e4b5e){logger[_0x177f('0x8')](util['format'](_0x177f('0x9'),_0x35e9f3['id'],_0x35e9f3[_0x177f('0xa')]));return getTranscriptionJob(_0x564f48[_0x177f('0xb')],_0x564f48['data2'],_0x224550['transcribeRegion'],_0x35e9f3[_0x177f('0xa')])[_0x177f('0xc')](function(_0x457d8b){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0xe'),_0x35e9f3['id'],_0x35e9f3[_0x177f('0xa')],_0x457d8b[_0x177f('0xf')][_0x177f('0x10')]));if(!_0x35e9f3[_0x177f('0x11')]){switch(_0x457d8b['TranscriptionJob'][_0x177f('0x10')]){case _0x177f('0x12'):var _0x4d1c1e={'transcribeStatus':_0x457d8b[_0x177f('0xf')][_0x177f('0x10')],'fileUri':_0x457d8b[_0x177f('0xf')][_0x177f('0x13')][_0x177f('0x14')]};logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x15'),_0x35e9f3['id']));return rp({'uri':_0x457d8b[_0x177f('0xf')][_0x177f('0x13')]['TranscriptFileUri'],'json':!![]})[_0x177f('0xc')](function(_0xac2388){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x16'),_0x35e9f3['id']));if(_0xac2388&&_0xac2388[_0x177f('0x17')]&&_0xac2388[_0x177f('0x17')]['transcripts']&&_0xac2388['results'][_0x177f('0x18')][_0x177f('0x19')]){_0x4d1c1e[_0x177f('0x11')]='';for(var _0x240211=0x0;_0x240211<_0xac2388[_0x177f('0x17')][_0x177f('0x18')]['length'];_0x240211++){_0x4d1c1e[_0x177f('0x11')]+=_0xac2388[_0x177f('0x17')][_0x177f('0x18')][_0x240211][_0x177f('0x1a')]+'';}}return _0x35e9f3[_0x177f('0x1b')](_0x4d1c1e);})[_0x177f('0xc')](function(){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x1c'),_0x35e9f3['id']));if(!_0x35e9f3[_0x177f('0x1d')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x20'));}if(!_0x224550[_0x177f('0x21')]||!_0x224550[_0x177f('0x22')]||!_0x224550['sentimentRegion']||!_0x224550[_0x177f('0x23')]||!_0x224550[_0x177f('0x24')]){throw new db['Sequelize'][(_0x177f('0x1f'))](_0x177f('0x25'));}if(!_0x4d1c1e['fileText']){throw new Error(_0x177f('0x26'));}if(_0x224550[_0x177f('0x22')]===_0x564f48['id']){return _0x564f48;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2f66e0){if(!_0x2f66e0){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x27'));}if(!_0x2f66e0[_0x177f('0xb')]||!_0x2f66e0[_0x177f('0x28')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x29'));}_0x2d1299=_0x2f66e0;logger[_0x177f('0x8')](util['format'](_0x177f('0x2a'),_0x35e9f3['id']));return sentiment(_0x2d1299[_0x177f('0xb')],_0x2d1299['data2'],_0x224550[_0x177f('0x2b')],_0x4d1c1e[_0x177f('0x11')],_0x224550['language']);})['then'](function(_0x3261df){logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x2c'),_0x35e9f3['id']));return _0x35e9f3['update']({'sentiment':_0x3261df['Sentiment'],'sPositive':_0x3261df[_0x177f('0x2d')][_0x177f('0x2e')],'sNegative':_0x3261df[_0x177f('0x2d')][_0x177f('0x2f')],'sMixed':_0x3261df[_0x177f('0x2d')][_0x177f('0x30')],'sNeutral':_0x3261df[_0x177f('0x2d')]['Neutral']});})[_0x177f('0xc')](function(){logger['info'](util[_0x177f('0xd')](_0x177f('0x1c'),_0x35e9f3['id']));_0xb74829();});case'FAILED':return _0x35e9f3[_0x177f('0x1b')]({'transcribeStatus':_0x177f('0x31'),'failureReason':_0x457d8b[_0x177f('0xf')][_0x177f('0x32')]})['then'](function(){logger['info'](util['format'](_0x177f('0x1c'),_0x35e9f3['id']));_0xb74829();});default:logger[_0x177f('0x8')](util[_0x177f('0xd')](_0x177f('0x33'),_0x35e9f3['id']));break;}}else{return BPromise[_0x177f('0x34')]()[_0x177f('0xc')](function(){if(!_0x35e9f3[_0x177f('0x1d')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x20'));}if(!_0x224550[_0x177f('0x21')]||!_0x224550['sentimentAccountId']||!_0x224550[_0x177f('0x2b')]||!_0x224550[_0x177f('0x23')]||!_0x224550[_0x177f('0x24')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x25'));}if(!_0x35e9f3[_0x177f('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x224550[_0x177f('0x22')]===_0x564f48['id']){return _0x564f48;}else{return db['CloudProvider'][_0x177f('0x35')]({'where':{'id':_settings[_0x177f('0x22')]}});}})['then'](function(_0x2ea504){if(!_0x2ea504){throw new db[(_0x177f('0x1e'))]['ValidationError'](_0x177f('0x27'));}if(!_0x2ea504['data1']||!_0x2ea504['data2']){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x29'));}_0x2d1299=_0x2ea504;logger['info'](util[_0x177f('0xd')](_0x177f('0x2a'),_0x35e9f3['id']));return sentiment(_0x2d1299[_0x177f('0xb')],_0x2d1299[_0x177f('0x28')],_0x224550['sentimentRegion'],_0x35e9f3[_0x177f('0x11')],_0x224550[_0x177f('0x23')]);})['then'](function(_0x10adbf){logger['info'](util[_0x177f('0xd')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x35e9f3['id']));return _0x35e9f3[_0x177f('0x1b')]({'sentiment':_0x10adbf[_0x177f('0x36')],'sPositive':_0x10adbf[_0x177f('0x2d')][_0x177f('0x2e')],'sNegative':_0x10adbf[_0x177f('0x2d')]['Negative'],'sMixed':_0x10adbf[_0x177f('0x2d')][_0x177f('0x30')],'sNeutral':_0x10adbf[_0x177f('0x2d')][_0x177f('0x37')],'transcribeStatus':'COMPLETED'});})[_0x177f('0xc')](function(){logger[_0x177f('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35e9f3['id']));_0xb74829();});}})[_0x177f('0x38')](function(_0x881083){if(_0x881083){if(!_0x881083[_0x177f('0x39')]||_0x881083['name']!==_0x177f('0x3a')){logger[_0x177f('0x3b')](util[_0x177f('0xd')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x35e9f3['id']),util[_0x177f('0x3c')](_0x881083,{'showHidden':![],'depth':null}));}}_0xb74829();});});}function checkTranscribe(){var _0x13a292;var _0x4e639d;var _0x32dfaa;return db[_0x177f('0x3d')][_0x177f('0x3e')]({'where':{'transcribeStatus':_0x177f('0x3f')}})[_0x177f('0xc')](function(_0x3839ff){if(!_0x3839ff||!_0x3839ff[_0x177f('0x19')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x40'));}_0x13a292=_0x3839ff;return db[_0x177f('0x41')][_0x177f('0x35')]({'where':{'id':0x1}});})[_0x177f('0xc')](function(_0x2249ef){if(!_0x2249ef){throw new db['Sequelize']['ValidationError'](_0x177f('0x42'));}_0x4e639d=_0x2249ef;if(!_0x4e639d[_0x177f('0x3')]||!_0x4e639d[_0x177f('0x43')]||!_0x4e639d[_0x177f('0x44')]||!_0x4e639d['language']||!_0x4e639d[_0x177f('0x24')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x45'));}return db[_0x177f('0x46')][_0x177f('0x35')]({'where':{'id':_0x4e639d[_0x177f('0x43')]}});})[_0x177f('0xc')](function(_0x24bca6){if(!_0x24bca6){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))](_0x177f('0x27'));}if(!_0x24bca6[_0x177f('0xb')]||!_0x24bca6[_0x177f('0x28')]){throw new db[(_0x177f('0x1e'))][(_0x177f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x32dfaa=_0x24bca6;var _0x424904=[];_0x13a292['forEach'](function(_0x25cd3f){_0x424904[_0x177f('0x47')](checkTranscribeJob(_0x25cd3f,_0x4e639d,_0x32dfaa));});return BPromise['all'](_0x424904);})['catch'](function(_0x4d5864){if(_0x4d5864){if(!_0x4d5864[_0x177f('0x39')]||_0x4d5864['name']!==_0x177f('0x3a')){logger['error'](util['inspect'](_0x4d5864,{'showHidden':![],'depth':null}));}}});}exports[_0x177f('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xbd20=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','sentiment','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','sentimentAccountId','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Cloud\x20Provider\x20not\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','inspect','start','lodash','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','info','format'];(function(_0xacd3ea,_0x40ff5a){var _0x51f070=function(_0x4c0a59){while(--_0x4c0a59){_0xacd3ea['push'](_0xacd3ea['shift']());}};_0x51f070(++_0x40ff5a);}(_0xbd20,0x14a));var _0x0bd2=function(_0x39d980,_0x15c127){_0x39d980=_0x39d980-0x0;var _0x33fcbc=_0xbd20[_0x39d980];return _0x33fcbc;};var _=require(_0x0bd2('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x0bd2('0x1'));var BPromise=require(_0x0bd2('0x2'));var db=require(_0x0bd2('0x3'))['db'];var logger=require(_0x0bd2('0x4'))(_0x0bd2('0x5'));function getTranscriptionJob(_0x5d701d,_0x231f0d,_0x1dc728,_0x1fcf74){return new Promise(function(_0x550f03,_0xe39613){var _0x45b631=new AWS['TranscribeService']({'accessKeyId':_0x231f0d,'secretAccessKey':_0x5d701d,'region':_0x1dc728});_0x45b631['getTranscriptionJob']({'TranscriptionJobName':_0x1fcf74},function(_0x377853,_0x29335c){if(_0x377853){return _0xe39613(_0x377853);}else{return _0x550f03(_0x29335c);}});});}function sentiment(_0x3d1092,_0xefa2ed,_0x473068,_0x4a0a29,_0x4c5ae4){return new Promise(function(_0x3168c6,_0x28210c){var _0x44d6f6=new AWS[(_0x0bd2('0x6'))]({'accessKeyId':_0xefa2ed,'secretAccessKey':_0x3d1092,'region':_0x473068});_0x44d6f6[_0x0bd2('0x7')]({'Text':_0x4a0a29,'LanguageCode':_0x4c5ae4['substring'](0x0,0x2)},function(_0x11e117,_0x4ff199){if(_0x11e117){return _0x28210c(_0x11e117);}else{return _0x3168c6(_0x4ff199);}});});}function checkTranscribeJob(_0x196a05,_0x20571b,_0x4c6b99){var _0x5f0205;return new BPromise(function(_0x2ca03f,_0x453ddb){logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0xa'),_0x196a05['id'],_0x196a05['transcribeName']));return getTranscriptionJob(_0x4c6b99['data1'],_0x4c6b99[_0x0bd2('0xb')],_0x20571b[_0x0bd2('0xc')],_0x196a05['transcribeName'])[_0x0bd2('0xd')](function(_0xd988bb){logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0xe'),_0x196a05['id'],_0x196a05[_0x0bd2('0xf')],_0xd988bb[_0x0bd2('0x10')]['TranscriptionJobStatus']));if(!_0x196a05['fileText']){switch(_0xd988bb[_0x0bd2('0x10')][_0x0bd2('0x11')]){case _0x0bd2('0x12'):var _0x51ddd8={'transcribeStatus':_0xd988bb[_0x0bd2('0x10')]['TranscriptionJobStatus'],'fileUri':_0xd988bb[_0x0bd2('0x10')]['Transcript'][_0x0bd2('0x13')]};logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x196a05['id']));return rp({'uri':_0xd988bb[_0x0bd2('0x10')][_0x0bd2('0x14')][_0x0bd2('0x13')],'json':!![]})[_0x0bd2('0xd')](function(_0xff78ae){logger['info'](util[_0x0bd2('0x9')](_0x0bd2('0x15'),_0x196a05['id']));if(_0xff78ae&&_0xff78ae[_0x0bd2('0x16')]&&_0xff78ae[_0x0bd2('0x16')][_0x0bd2('0x17')]&&_0xff78ae[_0x0bd2('0x16')][_0x0bd2('0x17')][_0x0bd2('0x18')]){_0x51ddd8[_0x0bd2('0x19')]='';for(var _0x272d93=0x0;_0x272d93<_0xff78ae[_0x0bd2('0x16')][_0x0bd2('0x17')][_0x0bd2('0x18')];_0x272d93++){_0x51ddd8[_0x0bd2('0x19')]+=_0xff78ae[_0x0bd2('0x16')][_0x0bd2('0x17')][_0x272d93][_0x0bd2('0x1a')]+'';}}return _0x196a05['update'](_0x51ddd8);})['then'](function(){logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x1b'),_0x196a05['id']));if(!_0x196a05[_0x0bd2('0x1c')]){throw new db[(_0x0bd2('0x1d'))][(_0x0bd2('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x20571b[_0x0bd2('0x1f')]||!_0x20571b['sentimentAccountId']||!_0x20571b[_0x0bd2('0x20')]||!_0x20571b['language']||!_0x20571b[_0x0bd2('0x21')]){throw new db['Sequelize'][(_0x0bd2('0x1e'))](_0x0bd2('0x22'));}if(!_0x51ddd8['fileText']){throw new Error(_0x0bd2('0x23'));}if(_0x20571b['sentimentAccountId']===_0x4c6b99['id']){return _0x4c6b99;}else{return db['CloudProvider'][_0x0bd2('0x24')]({'where':{'id':_settings[_0x0bd2('0x25')]}});}})[_0x0bd2('0xd')](function(_0x47b963){if(!_0x47b963){throw new db[(_0x0bd2('0x1d'))][(_0x0bd2('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x47b963[_0x0bd2('0x26')]||!_0x47b963[_0x0bd2('0xb')]){throw new db[(_0x0bd2('0x1d'))]['ValidationError'](_0x0bd2('0x27'));}_0x5f0205=_0x47b963;logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x28'),_0x196a05['id']));return sentiment(_0x5f0205[_0x0bd2('0x26')],_0x5f0205['data2'],_0x20571b[_0x0bd2('0x20')],_0x51ddd8['fileText'],_0x20571b[_0x0bd2('0x29')]);})[_0x0bd2('0xd')](function(_0x2cee45){logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x2a'),_0x196a05['id']));return _0x196a05['update']({'sentiment':_0x2cee45[_0x0bd2('0x2b')],'sPositive':_0x2cee45[_0x0bd2('0x2c')][_0x0bd2('0x2d')],'sNegative':_0x2cee45['SentimentScore']['Negative'],'sMixed':_0x2cee45[_0x0bd2('0x2c')][_0x0bd2('0x2e')],'sNeutral':_0x2cee45[_0x0bd2('0x2c')][_0x0bd2('0x2f')]});})['then'](function(){logger['info'](util[_0x0bd2('0x9')](_0x0bd2('0x1b'),_0x196a05['id']));_0x2ca03f();});case'FAILED':return _0x196a05[_0x0bd2('0x30')]({'transcribeStatus':_0x0bd2('0x31'),'failureReason':_0xd988bb[_0x0bd2('0x10')][_0x0bd2('0x32')]})[_0x0bd2('0xd')](function(){logger[_0x0bd2('0x8')](util['format'](_0x0bd2('0x1b'),_0x196a05['id']));_0x2ca03f();});default:logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x33'),_0x196a05['id']));break;}}else{return BPromise[_0x0bd2('0x34')]()[_0x0bd2('0xd')](function(){if(!_0x196a05[_0x0bd2('0x1c')]){throw new db[(_0x0bd2('0x1d'))][(_0x0bd2('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x20571b[_0x0bd2('0x1f')]||!_0x20571b[_0x0bd2('0x25')]||!_0x20571b[_0x0bd2('0x20')]||!_0x20571b['language']||!_0x20571b[_0x0bd2('0x21')]){throw new db[(_0x0bd2('0x1d'))][(_0x0bd2('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x196a05[_0x0bd2('0x19')]){throw new Error('Transcript\x20not\x20available');}if(_0x20571b[_0x0bd2('0x25')]===_0x4c6b99['id']){return _0x4c6b99;}else{return db[_0x0bd2('0x35')][_0x0bd2('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x552ece){if(!_0x552ece){throw new db[(_0x0bd2('0x1d'))]['ValidationError'](_0x0bd2('0x36'));}if(!_0x552ece[_0x0bd2('0x26')]||!_0x552ece[_0x0bd2('0xb')]){throw new db[(_0x0bd2('0x1d'))][(_0x0bd2('0x1e'))](_0x0bd2('0x27'));}_0x5f0205=_0x552ece;logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x28'),_0x196a05['id']));return sentiment(_0x5f0205[_0x0bd2('0x26')],_0x5f0205[_0x0bd2('0xb')],_0x20571b[_0x0bd2('0x20')],_0x196a05[_0x0bd2('0x19')],_0x20571b[_0x0bd2('0x29')]);})[_0x0bd2('0xd')](function(_0x38ea4d){logger[_0x0bd2('0x8')](util[_0x0bd2('0x9')](_0x0bd2('0x2a'),_0x196a05['id']));return _0x196a05[_0x0bd2('0x30')]({'sentiment':_0x38ea4d['Sentiment'],'sPositive':_0x38ea4d[_0x0bd2('0x2c')][_0x0bd2('0x2d')],'sNegative':_0x38ea4d['SentimentScore']['Negative'],'sMixed':_0x38ea4d['SentimentScore'][_0x0bd2('0x2e')],'sNeutral':_0x38ea4d[_0x0bd2('0x2c')][_0x0bd2('0x2f')],'transcribeStatus':_0x0bd2('0x12')});})[_0x0bd2('0xd')](function(){logger[_0x0bd2('0x8')](util['format'](_0x0bd2('0x1b'),_0x196a05['id']));_0x2ca03f();});}})[_0x0bd2('0x37')](function(_0x2f99ba){if(_0x2f99ba){if(!_0x2f99ba[_0x0bd2('0x38')]||_0x2f99ba['name']!=='SequelizeValidationError'){logger[_0x0bd2('0x39')](util[_0x0bd2('0x9')](_0x0bd2('0x3a'),_0x196a05['id']),util['inspect'](_0x2f99ba,{'showHidden':![],'depth':null}));}}_0x2ca03f();});});}function checkTranscribe(){var _0x270b19;var _0x2c9871;var _0x3eac12;return db['VoiceRecording'][_0x0bd2('0x3b')]({'where':{'transcribeStatus':_0x0bd2('0x3c')}})[_0x0bd2('0xd')](function(_0x1c6cfb){if(!_0x1c6cfb||!_0x1c6cfb['length']){throw new db['Sequelize'][(_0x0bd2('0x1e'))](_0x0bd2('0x3d'));}_0x270b19=_0x1c6cfb;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x0bd2('0xd')](function(_0x49c69e){if(!_0x49c69e){throw new db['Sequelize'][(_0x0bd2('0x1e'))](_0x0bd2('0x3e'));}_0x2c9871=_0x49c69e;if(!_0x2c9871[_0x0bd2('0x5')]||!_0x2c9871[_0x0bd2('0x3f')]||!_0x2c9871[_0x0bd2('0xc')]||!_0x2c9871['language']||!_0x2c9871[_0x0bd2('0x21')]){throw new db[(_0x0bd2('0x1d'))]['ValidationError'](_0x0bd2('0x40'));}return db[_0x0bd2('0x35')][_0x0bd2('0x24')]({'where':{'id':_0x2c9871[_0x0bd2('0x3f')]}});})[_0x0bd2('0xd')](function(_0x30f9c9){if(!_0x30f9c9){throw new db['Sequelize'][(_0x0bd2('0x1e'))](_0x0bd2('0x36'));}if(!_0x30f9c9[_0x0bd2('0x26')]||!_0x30f9c9['data2']){throw new db[(_0x0bd2('0x1d'))]['ValidationError'](_0x0bd2('0x27'));}_0x3eac12=_0x30f9c9;var _0xab3d81=[];_0x270b19['forEach'](function(_0x37ef58){_0xab3d81[_0x0bd2('0x41')](checkTranscribeJob(_0x37ef58,_0x2c9871,_0x3eac12));});return BPromise['all'](_0xab3d81);})[_0x0bd2('0x37')](function(_0x36638c){if(_0x36638c){if(!_0x36638c['name']||_0x36638c[_0x0bd2('0x38')]!=='SequelizeValidationError'){logger[_0x0bd2('0x39')](util[_0x0bd2('0x42')](_0x36638c,{'showHidden':![],'depth':null}));}}});}exports[_0x0bd2('0x43')]=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 996cd78..2c0cf26 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 _0x654f=['lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll'];(function(_0x289c9f,_0x5b8e19){var _0x29d99a=function(_0x4effcf){while(--_0x4effcf){_0x289c9f['push'](_0x289c9f['shift']());}};_0x29d99a(++_0x5b8e19);}(_0x654f,0x16d));var _0xf654=function(_0x49ce55,_0x96d941){_0x49ce55=_0x49ce55-0x0;var _0x5c6ad0=_0x654f[_0x49ce55];return _0x5c6ad0;};'use strict';var _=require('lodash');var moment=require(_0xf654('0x0'));var Redis=require(_0xf654('0x1'));var util=require(_0xf654('0x2'));var config=require(_0xf654('0x3'));var db=require(_0xf654('0x4'))['db'];var logger=require(_0xf654('0x5'))('schedule');config[_0xf654('0x6')]=_[_0xf654('0x7')](config['redis'],{'host':_0xf654('0x8'),'port':0x18eb});var io=require(_0xf654('0x9'))(new Redis(config[_0xf654('0x6')]));function closeInteractions(){var _0x192141=[];return db[_0xf654('0xa')][_0xf654('0xb')]({'raw':!![],'attributes':['id',_0xf654('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf654('0xd'))}}})[_0xf654('0xe')](function(_0xaae61){if(_0xaae61&&_0xaae61[_0xf654('0xf')]){_0x192141=_[_0xf654('0x10')](_0xaae61||[],'id');logger[_0xf654('0x11')](_0xf654('0x12'),_0x192141[_0xf654('0x13')]());return db[_0xf654('0xa')][_0xf654('0x14')]({'closeReason':'system','disposition':_0xf654('0x15'),'closed':!![],'closedAt':moment()['format'](_0xf654('0x16'))},{'where':{'id':_0x192141}});}})[_0xf654('0xe')](function(){if(_0x192141&&_0x192141['length']){logger[_0xf654('0x11')](_0xf654('0x17'),_0x192141[_0xf654('0x13')]());for(var _0x281dce=0x0;_0x281dce<_0x192141['length'];_0x281dce++){io[_0xf654('0x18')]('whatsappInteraction:update',{'id':_0x192141[_0x281dce],'closed':!![]});}}})[_0xf654('0x19')](function(_0xb27bce){logger[_0xf654('0x1a')](_0xf654('0x1b'),_0xb27bce?util[_0xf654('0x1c')](_0xb27bce,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7c7e=['lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7c7e,0x15f));var _0xe7c7=function(_0x502834,_0x7e96e5){_0x502834=_0x502834-0x0;var _0x22e859=_0x7c7e[_0x502834];return _0x22e859;};'use strict';var _=require(_0xe7c7('0x0'));var moment=require(_0xe7c7('0x1'));var Redis=require(_0xe7c7('0x2'));var util=require(_0xe7c7('0x3'));var config=require(_0xe7c7('0x4'));var db=require(_0xe7c7('0x5'))['db'];var logger=require(_0xe7c7('0x6'))(_0xe7c7('0x7'));config['redis']=_[_0xe7c7('0x8')](config[_0xe7c7('0x9')],{'host':_0xe7c7('0xa'),'port':0x18eb});var io=require(_0xe7c7('0xb'))(new Redis(config[_0xe7c7('0x9')]));function closeInteractions(){var _0x222f98=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe7c7('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe7c7('0xd'))}}})[_0xe7c7('0xe')](function(_0x59193a){if(_0x59193a&&_0x59193a[_0xe7c7('0xf')]){_0x222f98=_[_0xe7c7('0x10')](_0x59193a||[],'id');logger[_0xe7c7('0x11')](_0xe7c7('0x12'),_0x222f98[_0xe7c7('0x13')]());return db[_0xe7c7('0x14')][_0xe7c7('0x15')]({'closeReason':_0xe7c7('0x16'),'disposition':_0xe7c7('0x17'),'closed':!![],'closedAt':moment()[_0xe7c7('0x18')](_0xe7c7('0x19'))},{'where':{'id':_0x222f98}});}})[_0xe7c7('0xe')](function(){if(_0x222f98&&_0x222f98['length']){logger[_0xe7c7('0x11')](_0xe7c7('0x1a'),_0x222f98[_0xe7c7('0x13')]());for(var _0x2321c8=0x0;_0x2321c8<_0x222f98['length'];_0x2321c8++){io[_0xe7c7('0x1b')](_0xe7c7('0x1c'),{'id':_0x222f98[_0x2321c8],'closed':!![]});}}})[_0xe7c7('0x1d')](function(_0x56cd09){logger[_0xe7c7('0x1e')](_0xe7c7('0x1f'),_0x56cd09?util['inspect'](_0x56cd09,{'showHidden':![],'depth':null}):'');});}exports[_0xe7c7('0x20')]=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 871b074..59db5dd 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a40=['catch','util','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','CmContact','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','bulkCreate'];(function(_0x218581,_0x377be8){var _0x2688d2=function(_0x436c37){while(--_0x436c37){_0x218581['push'](_0x218581['shift']());}};_0x2688d2(++_0x377be8);}(_0x4a40,0x188));var _0x04a4=function(_0x46f76e,_0x5b923b){_0x46f76e=_0x46f76e-0x0;var _0x426ce4=_0x4a40[_0x46f76e];return _0x426ce4;};'use strict';var util=require(_0x04a4('0x0'));var db=require(_0x04a4('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x04a4('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x04a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x04a4('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x04a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x04a4('0x5')](),'updatedAt':Date[_0x04a4('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x04a4('0x2')]({'id':i,'firstName':_0x04a4('0x6')+i,'lastName':_0x04a4('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x04a4('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x04a4('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x04a4('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x04a4('0x5')]()});}db[_0x04a4('0x7')]['destroy']({'where':{}})[_0x04a4('0x8')](function(){return db[_0x04a4('0x7')]['bulkCreate'](contacts);})['then'](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),_0x04a4('0xb'));return db[_0x04a4('0xc')]['destroy']({'where':{}});})['then'](function(){return db[_0x04a4('0xc')]['bulkCreate'](hopper);})[_0x04a4('0x8')](function(){console['log'](_0x04a4('0xa'),_0x04a4('0xd'));return db[_0x04a4('0x7')]['bulkCreate'](contacts2);})[_0x04a4('0x8')](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),_0x04a4('0xe'));return db['CmHopper'][_0x04a4('0xf')](hopper2);})[_0x04a4('0x8')](function(){console[_0x04a4('0x9')](_0x04a4('0xa'),'hopper2');})[_0x04a4('0x10')](function(_0xb7055a){console[_0x04a4('0x9')](_0xb7055a);}); \ No newline at end of file +var _0xf379=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xf379,0xfe));var _0x9f37=function(_0x13171a,_0x11ffff){_0x13171a=_0x13171a-0x0;var _0xc9f60c=_0xf379[_0x13171a];return _0xc9f60c;};'use strict';var util=require(_0x9f37('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9f37('0x1')]({'id':i,'firstName':_0x9f37('0x2')+i,'lastName':_0x9f37('0x3')+i,'phone':0xf879fb460+i,'email':_0x9f37('0x4')+i+_0x9f37('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x9f37('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9f37('0x6')](),'updatedAt':Date[_0x9f37('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9f37('0x1')]({'id':i,'firstName':_0x9f37('0x2')+i,'lastName':_0x9f37('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9f37('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x9f37('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9f37('0x6')](),'updatedAt':Date['now']()});}db[_0x9f37('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x9f37('0x7')]['bulkCreate'](contacts);})[_0x9f37('0x8')](function(){console[_0x9f37('0x9')](_0x9f37('0xa'),_0x9f37('0xb'));return db['CmHopper']['destroy']({'where':{}});})[_0x9f37('0x8')](function(){return db[_0x9f37('0xc')][_0x9f37('0xd')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x9f37('0xe'));return db[_0x9f37('0x7')]['bulkCreate'](contacts2);})[_0x9f37('0x8')](function(){console[_0x9f37('0x9')]('finished\x20populating',_0x9f37('0xf'));return db['CmHopper'][_0x9f37('0xd')](hopper2);})[_0x9f37('0x8')](function(){console['log'](_0x9f37('0xa'),_0x9f37('0x10'));})['catch'](function(_0x53c6cb){console[_0x9f37('0x9')](_0x53c6cb);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index d3a7238..0975d11 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa263=['ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','add\x20user','log','util','../mysqldb','push','format','agent','%s%s@xcally.com','password','udp','wss','all'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xa263,0x170));var _0x3a26=function(_0x1bd860,_0x5dc850){_0x1bd860=_0x1bd860-0x0;var _0x3bd65c=_0xa263[_0x1bd860];return _0x3bd65c;};'use strict';var util=require(_0x3a26('0x0'));var db=require(_0x3a26('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3a26('0x2')]({'name':util[_0x3a26('0x3')]('%s%s',_0x3a26('0x4'),i),'fullname':util[_0x3a26('0x3')]('%s%s',_0x3a26('0x4'),i),'email':util[_0x3a26('0x3')](_0x3a26('0x5'),_0x3a26('0x4'),i),'role':_0x3a26('0x4'),'password':_0x3a26('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x3a26('0x7'),'ws',_0x3a26('0x8')],'disallow':[_0x3a26('0x9')],'allow':[_0x3a26('0xa')],'defaultuser':util[_0x3a26('0x3')](_0x3a26('0xb'),_0x3a26('0x4'),i),'encryption':_0x3a26('0xc'),'avpf':_0x3a26('0xc'),'force_avp':_0x3a26('0xc'),'icesupport':_0x3a26('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x3a26('0xd'),'dtlsprivatekey':_0x3a26('0xe'),'dtlssetup':_0x3a26('0xf'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x3a26('0xb'),'agent',i),0xfa0+i)});}db[_0x3a26('0x10')][_0x3a26('0x11')](users)[_0x3a26('0x12')](function(){console['log'](_0x3a26('0x13'));})['catch'](function(_0x1927d3){console[_0x3a26('0x14')](_0x1927d3);}); \ No newline at end of file +var _0xa889=['push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','add\x20user','catch','log','util','../mysqldb'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xa889,0x1a2));var _0x9a88=function(_0x8a4aca,_0x7f0f91){_0x8a4aca=_0x8a4aca-0x0;var _0x3d2064=_0xa889[_0x8a4aca];return _0x3d2064;};'use strict';var util=require(_0x9a88('0x0'));var db=require(_0x9a88('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9a88('0x2')]({'name':util[_0x9a88('0x3')](_0x9a88('0x4'),_0x9a88('0x5'),i),'fullname':util[_0x9a88('0x3')](_0x9a88('0x4'),_0x9a88('0x5'),i),'email':util[_0x9a88('0x3')](_0x9a88('0x6'),_0x9a88('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x9a88('0x7'),'transport':[_0x9a88('0x8'),'ws',_0x9a88('0x9')],'disallow':['all'],'allow':[_0x9a88('0xa')],'defaultuser':util['format']('%s%s',_0x9a88('0x5'),i),'encryption':_0x9a88('0xb'),'avpf':_0x9a88('0xb'),'force_avp':_0x9a88('0xb'),'icesupport':_0x9a88('0xb'),'dtlsenable':_0x9a88('0xb'),'dtlsverify':'no','dtlscertfile':_0x9a88('0xc'),'dtlsprivatekey':_0x9a88('0xd'),'dtlssetup':_0x9a88('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util['format'](_0x9a88('0x4'),_0x9a88('0x5'),i),0xfa0+i)});}db[_0x9a88('0xf')]['bulkCreate'](users)[_0x9a88('0x10')](function(){console['log'](_0x9a88('0x11'));})[_0x9a88('0x12')](function(_0x339b77){console[_0x9a88('0x13')](_0x339b77);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index ef7a4a4..1875672 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fce=['then','where','role','ivr','%s:queue:%s','format','user:%s','handshake','query','find','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','userProfileId','FaxQueues','FaxQueue','Trunks','Campaign','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','length','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','telephone','agent','type','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource'];(function(_0xe92833,_0x514fc7){var _0x69b9a0=function(_0x2b0068){while(--_0x2b0068){_0xe92833['push'](_0xe92833['shift']());}};_0x69b9a0(++_0x514fc7);}(_0x3fce,0x121));var _0xe3fc=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x3fce[_0x3efe87];return _0x56a4cc;};'use strict';var _=require('lodash');var util=require(_0xe3fc('0x0'));var BPromise=require(_0xe3fc('0x1'));var db=require(_0xe3fc('0x2'))['db'];var config=require(_0xe3fc('0x3'));var queryQueues={'attributes':['id',_0xe3fc('0x4')],'include':[{'as':_0xe3fc('0x5'),'model':db[_0xe3fc('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe3fc('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xe3fc('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xe3fc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xe3fc('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0xeada2b,_0x43ec3c,_0x1bb7be){return db[_0xe3fc('0xa')][_0xe3fc('0xb')]({'where':{'name':_0xeada2b,'userProfileId':_0x43ec3c},'raw':!![]})['then'](function(_0x52b9ee){if(_0x52b9ee){if(_0x52b9ee[_0xe3fc('0xc')]){switch(_0xeada2b){case _0xe3fc('0xd'):case _0xe3fc('0xe'):case'FaxQueues':case _0xe3fc('0xf'):case _0xe3fc('0x10'):case _0xe3fc('0x11'):case _0xe3fc('0x12'):return db[_0x1bb7be][_0xe3fc('0x13')](queryQueues);case _0xe3fc('0x14'):return db[_0x1bb7be][_0xe3fc('0x13')](queryTelephones);case'Trunks':return db[_0x1bb7be][_0xe3fc('0x13')](queryTrunks);case _0xe3fc('0x15'):return db[_0x1bb7be]['findAll'](queryCampaigns);}}else{return db[_0xe3fc('0x16')][_0xe3fc('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x52b9ee['id']},'raw':!![]})[_0xe3fc('0x17')](function(_0x25852e){if(_0x25852e){var _0x4b6256={'where':{'id':_['map'](_0x25852e,'resourceId')},'raw':!![]};switch(_0x1bb7be){case _0xe3fc('0x6'):_0x4b6256[_0xe3fc('0x18')][_0xe3fc('0x19')]='telephone';break;case'Campaign':_0x4b6256[_0xe3fc('0x18')]['type']=_0xe3fc('0x1a');break;}return db[_0x1bb7be][_0xe3fc('0x13')](_0x4b6256);}else{return[];}});}}else{return[];}})[_0xe3fc('0x17')](function(_0x51c7f2){return _0x51c7f2;});}function joinOrLeaveQueues(_0x57a0f4,_0x42140f,_0x107abb,_0x16b914){_0x57a0f4[_0x42140f](util['format'](_0xe3fc('0x1b'),_0x107abb,_0x16b914[_0xe3fc('0x4')]));if(_0x16b914['Agents']){for(var _0x457bb1=0x0;_0x457bb1<_0x16b914[_0xe3fc('0x5')]['length'];_0x457bb1+=0x1){_0x57a0f4[_0x42140f](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x16b914[_0xe3fc('0x5')][_0x457bb1]['name']));}}}function joinOrLeave(_0x4ac172,_0x2194f8,_0x4f4134){var _0x55ea5e;if(_0x4ac172[_0xe3fc('0x1e')][_0xe3fc('0x1f')]['id']){db[_0xe3fc('0x6')][_0xe3fc('0x20')]({'attributes':['id','name',_0xe3fc('0x19'),'userProfileId'],'where':{'id':_0x4ac172['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x21')],'as':_0xe3fc('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xe3fc('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x24')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x25')],'as':_0xe3fc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xe3fc('0x27')],'as':_0xe3fc('0x28'),'attributes':['id'],'raw':!![]}]})[_0xe3fc('0x17')](function(_0x21ccdd){if(_0x21ccdd){_0x55ea5e=_0x21ccdd;_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x21ccdd[_0xe3fc('0x4')]));var _0xbb0f17=[];switch(_0x21ccdd[_0xe3fc('0x19')]){case _0xe3fc('0x29'):_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));if(queryQueues[_0xe3fc('0x2c')](_0xe3fc('0x2d'))){delete queryQueues['include'];}_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x2f')][_0xe3fc('0x13')](queryQueues));_0xbb0f17['push'](db[_0xe3fc('0x30')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db['FaxQueue'][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x31')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x32')]['findAll'](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x33')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x34')][_0xe3fc('0x13')](queryQueues));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryTelephones));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x35')][_0xe3fc('0x13')](queryTrunks));_0xbb0f17[_0xe3fc('0x2e')](db['Campaign']['findAll'](queryCampaigns));_0xbb0f17['push'](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryAgents));break;case _0xe3fc('0x36'):_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0xd'),_0x21ccdd[_0xe3fc('0x37')],'VoiceQueue'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0xe'),_0x21ccdd['userProfileId'],_0xe3fc('0x30')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x38'),_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x39')));_0xbb0f17['push'](getAssociatedResources(_0xe3fc('0xf'),_0x21ccdd['userProfileId'],'SmsQueue'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x10'),_0x21ccdd['userProfileId'],_0xe3fc('0x32')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x11'),_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x33')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources('WhatsappQueues',_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x34')));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x14'),_0x21ccdd[_0xe3fc('0x37')],'User'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources(_0xe3fc('0x3a'),_0x21ccdd[_0xe3fc('0x37')],'Trunk'));_0xbb0f17[_0xe3fc('0x2e')](getAssociatedResources('IvrCampaigns',_0x21ccdd[_0xe3fc('0x37')],_0xe3fc('0x3b')));_0xbb0f17[_0xe3fc('0x2e')](db[_0xe3fc('0x6')][_0xe3fc('0x13')](queryAgents));break;case'agent':_0x4ac172[_0x2194f8](_0xe3fc('0x2a'));_0x4ac172[_0x2194f8](_0xe3fc('0x2b'));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3c')]({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17['push'](_0x21ccdd[_0xe3fc('0x3d')]({'attributes':['id','name']}));_0xbb0f17['push'](_0x21ccdd['getFaxQueues']({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3e')]({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x3f')]({'attributes':['id','name']}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd['getOpenchannelQueues']({'attributes':['id',_0xe3fc('0x4')]}));_0xbb0f17[_0xe3fc('0x2e')](_0x21ccdd[_0xe3fc('0x40')]({'attributes':['id',_0xe3fc('0x4')]}));break;}return BPromise['all'](_0xbb0f17);}})[_0xe3fc('0x17')](function(_0x72f328){if(_0x72f328&&_0x72f328[_0xe3fc('0x41')]){for(var _0x331fd4=0x0;_0x331fd4<_0x72f328[_0xe3fc('0x41')];_0x331fd4+=0x1){for(var _0x20459f=0x0;_0x20459f<_0x72f328[_0x331fd4]['length'];_0x20459f+=0x1){switch(_0x331fd4){case 0x0:joinOrLeaveQueues(_0x4ac172,_0x2194f8,'voice',_0x72f328[_0x331fd4][_0x20459f]);break;case 0x1:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x42'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x2:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x43'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x3:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x44'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x4:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x45'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x5:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x46'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x6:joinOrLeaveQueues(_0x4ac172,_0x2194f8,_0xe3fc('0x47'),_0x72f328[_0x331fd4][_0x20459f]);break;case 0x7:if(_0x55ea5e['role']!==_0xe3fc('0x8'))_0x4ac172[_0x2194f8](util['format'](_0xe3fc('0x48'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;case 0x8:if(_0x55ea5e['role']!=='agent')_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x49'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;case 0x9:if(_0x55ea5e[_0xe3fc('0x19')]!=='agent')_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x4a'),_0x72f328[_0x331fd4][_0x20459f][_0xe3fc('0x9')],_0x72f328[_0x331fd4][_0x20459f][_0xe3fc('0x4')]));break;case 0xa:_0x4ac172[_0x2194f8](util[_0xe3fc('0x1c')](_0xe3fc('0x1d'),_0x72f328[_0x331fd4][_0x20459f]['name']));break;}}}}})['then'](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x1ca515=_[_0xe3fc('0x4c')](_0x55ea5e[_0xe3fc('0x4d')],'id');return _0x55ea5e[_0xe3fc('0x4e')](_0x1ca515)[_0xe3fc('0x17')](function(){for(var _0x305506=0x0;_0x305506<_0x1ca515['length'];_0x305506+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x50'),{'ChatInteractionId':Number(_0x1ca515[_0x305506]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x5bcd1c=_['map'](_0x55ea5e['MailInteractions'],'id');return _0x55ea5e[_0xe3fc('0x51')](_0x5bcd1c)[_0xe3fc('0x17')](function(){for(var _0x2321fd=0x0;_0x2321fd<_0x5bcd1c[_0xe3fc('0x41')];_0x2321fd+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x52'),{'MailInteractionId':Number(_0x5bcd1c[_0x2321fd]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x189ae9=_[_0xe3fc('0x4c')](_0x55ea5e[_0xe3fc('0x23')],'id');return _0x55ea5e[_0xe3fc('0x53')](_0x189ae9)[_0xe3fc('0x17')](function(){for(var _0x5c7d4a=0x0;_0x5c7d4a<_0x189ae9['length'];_0x5c7d4a+=0x1){_0x4f4134['emit'](_0xe3fc('0x54'),{'FaxInteractionId':Number(_0x189ae9[_0x5c7d4a]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x17')](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x4e5eb8=_['map'](_0x55ea5e[_0xe3fc('0x55')],'id');return _0x55ea5e[_0xe3fc('0x56')](_0x4e5eb8)[_0xe3fc('0x17')](function(){for(var _0x47be07=0x0;_0x47be07<_0x4e5eb8['length'];_0x47be07+=0x1){_0x4f4134['emit'](_0xe3fc('0x57'),{'SmsInteractionId':Number(_0x4e5eb8[_0x47be07]),'UserId':Number(_0x55ea5e['id'])});}});}})['then'](function(){if(_0x2194f8==='leave'){var _0x3020fb=_['map'](_0x55ea5e['OpenchannelInteractions'],'id');return _0x55ea5e['removeOpenchannelInteractions'](_0x3020fb)[_0xe3fc('0x17')](function(){for(var _0x7c7c99=0x0;_0x7c7c99<_0x3020fb[_0xe3fc('0x41')];_0x7c7c99+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x58'),{'OpenchannelInteractionId':Number(_0x3020fb[_0x7c7c99]),'UserId':Number(_0x55ea5e['id'])});}});}})['then'](function(){if(_0x2194f8===_0xe3fc('0x4b')){var _0x34585a=_['map'](_0x55ea5e[_0xe3fc('0x28')],'id');return _0x55ea5e[_0xe3fc('0x59')](_0x34585a)[_0xe3fc('0x17')](function(){for(var _0x474550=0x0;_0x474550<_0x34585a[_0xe3fc('0x41')];_0x474550+=0x1){_0x4f4134[_0xe3fc('0x4f')](_0xe3fc('0x5a'),{'WhatsappInteractionId':Number(_0x34585a[_0x474550]),'UserId':Number(_0x55ea5e['id'])});}});}})[_0xe3fc('0x5b')](function(_0x3dbf21){_0x4ac172[_0xe3fc('0x5c')](_0x3dbf21);});}}function onDisconnect(_0x8d1312,_0xd08412){joinOrLeave(_0x8d1312,_0xe3fc('0x4b'),_0xd08412);}function onConnect(_0x25f7bb){joinOrLeave(_0x25f7bb,_0xe3fc('0x5d'));}exports[_0xe3fc('0x5e')]=function(_0x460c7b){_0x460c7b['on'](_0xe3fc('0x5f'),function(_0x216dd3){_0x216dd3['setMaxListeners'](0x0);_0x216dd3[_0xe3fc('0x60')]=_0x216dd3[_0xe3fc('0x61')][_0xe3fc('0x5f')]['remoteAddress']+':'+_0x216dd3[_0xe3fc('0x61')]['connection'][_0xe3fc('0x62')];_0x216dd3['connectedAt']=new Date();_0x216dd3['log']=function(_0x45f3b7){console[_0xe3fc('0x5c')](_0xe3fc('0x63')+_0x216dd3[_0xe3fc('0x64')]['name']+'['+_0x216dd3[_0xe3fc('0x60')]+']',_0x45f3b7);};_0x216dd3['on'](_0xe3fc('0x65'),function(){onDisconnect(_0x216dd3,_0x460c7b);_0x216dd3[_0xe3fc('0x5c')](_0xe3fc('0x66'));});onConnect(_0x216dd3);_0x216dd3[_0xe3fc('0x5c')](_0xe3fc('0x67'));});}; \ No newline at end of file +var _0xf970=['Campaign','%s:queue:%s','length','format','query','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','voice:inbound','voice:outbound','ChatQueues','OpenchannelQueue','Trunk','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','connectedAt','SocketIO\x20','disconnect','DISCONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','findOne','then','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','where','role'];(function(_0x393f5f,_0x285391){var _0x1e8256=function(_0x81d325){while(--_0x81d325){_0x393f5f['push'](_0x393f5f['shift']());}};_0x1e8256(++_0x285391);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var BPromise=require(_0x0f97('0x1'));var db=require(_0x0f97('0x2'))['db'];var config=require(_0x0f97('0x3'));var queryQueues={'attributes':['id',_0x0f97('0x4')],'include':[{'as':_0x0f97('0x5'),'model':db[_0x0f97('0x6')],'attributes':['id',_0x0f97('0x4'),'role'],'raw':!![],'where':{'role':_0x0f97('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0f97('0x4')],'where':{'role':_0x0f97('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0f97('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x0f97('0x4')],'where':{'role':_0x0f97('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0f97('0x4'),_0x0f97('0x9')],'where':{'type':_0x0f97('0xa')}};function getAssociatedResources(_0x5598eb,_0x52d08e,_0x12397b){return db['UserProfileSection'][_0x0f97('0xb')]({'where':{'name':_0x5598eb,'userProfileId':_0x52d08e},'raw':!![]})[_0x0f97('0xc')](function(_0xc8aa14){if(_0xc8aa14){if(_0xc8aa14['autoAssociation']){switch(_0x5598eb){case _0x0f97('0xd'):case'ChatQueues':case _0x0f97('0xe'):case _0x0f97('0xf'):case _0x0f97('0x10'):case _0x0f97('0x11'):case _0x0f97('0x12'):return db[_0x12397b]['findAll'](queryQueues);case _0x0f97('0x13'):return db[_0x12397b][_0x0f97('0x14')](queryTelephones);case _0x0f97('0x15'):return db[_0x12397b][_0x0f97('0x14')](queryTrunks);case _0x0f97('0x16'):return db[_0x12397b][_0x0f97('0x14')](queryCampaigns);}}else{return db[_0x0f97('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0xc8aa14['id']},'raw':!![]})[_0x0f97('0xc')](function(_0x2392c0){if(_0x2392c0){var _0x1448f9={'where':{'id':_[_0x0f97('0x18')](_0x2392c0,'resourceId')},'raw':!![]};switch(_0x12397b){case'User':_0x1448f9[_0x0f97('0x19')][_0x0f97('0x1a')]=_0x0f97('0x8');break;case _0x0f97('0x1b'):_0x1448f9[_0x0f97('0x19')][_0x0f97('0x9')]='ivr';break;}return db[_0x12397b]['findAll'](_0x1448f9);}else{return[];}});}}else{return[];}})[_0x0f97('0xc')](function(_0x132d2f){return _0x132d2f;});}function joinOrLeaveQueues(_0x3b547f,_0x425d97,_0x398216,_0x3a91b4){_0x3b547f[_0x425d97](util['format'](_0x0f97('0x1c'),_0x398216,_0x3a91b4[_0x0f97('0x4')]));if(_0x3a91b4[_0x0f97('0x5')]){for(var _0x15376e=0x0;_0x15376e<_0x3a91b4[_0x0f97('0x5')][_0x0f97('0x1d')];_0x15376e+=0x1){_0x3b547f[_0x425d97](util[_0x0f97('0x1e')]('user:%s',_0x3a91b4[_0x0f97('0x5')][_0x15376e][_0x0f97('0x4')]));}}}function joinOrLeave(_0xf2dab8,_0x5c2af0,_0x31d384){var _0x25d1ef;if(_0xf2dab8['handshake'][_0x0f97('0x1f')]['id']){db[_0x0f97('0x6')]['find']({'attributes':['id','name','role',_0x0f97('0x20')],'where':{'id':_0xf2dab8[_0x0f97('0x21')]['query']['id']},'include':[{'model':db[_0x0f97('0x22')],'as':_0x0f97('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x0f97('0x24')],'as':_0x0f97('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x0f97('0x26')],'as':_0x0f97('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x0f97('0x28')],'as':_0x0f97('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x0f97('0x2a')],'as':_0x0f97('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x0f97('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x0f97('0xc')](function(_0x22cc9e){if(_0x22cc9e){_0x25d1ef=_0x22cc9e;_0xf2dab8[_0x5c2af0](util[_0x0f97('0x1e')](_0x0f97('0x2d'),_0x22cc9e[_0x0f97('0x4')]));var _0x29bcf2=[];switch(_0x22cc9e[_0x0f97('0x1a')]){case _0x0f97('0x2e'):_0xf2dab8[_0x5c2af0]('voice:inbound');_0xf2dab8[_0x5c2af0]('voice:outbound');if(queryQueues[_0x0f97('0x2f')](_0x0f97('0x30'))){delete queryQueues[_0x0f97('0x30')];}_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x32')][_0x0f97('0x14')](queryQueues));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x33')][_0x0f97('0x14')](queryQueues));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x34')]['findAll'](queryQueues));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x35')][_0x0f97('0x14')](queryQueues));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x36')]['findAll'](queryQueues));_0x29bcf2[_0x0f97('0x31')](db['OpenchannelQueue'][_0x0f97('0x14')](queryQueues));_0x29bcf2['push'](db[_0x0f97('0x37')][_0x0f97('0x14')](queryQueues));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x6')][_0x0f97('0x14')](queryTelephones));_0x29bcf2['push'](db['Trunk'][_0x0f97('0x14')](queryTrunks));_0x29bcf2[_0x0f97('0x31')](db['Campaign'][_0x0f97('0x14')](queryCampaigns));_0x29bcf2[_0x0f97('0x31')](db[_0x0f97('0x6')][_0x0f97('0x14')](queryAgents));break;case'user':_0xf2dab8[_0x5c2af0](_0x0f97('0x38'));_0xf2dab8[_0x5c2af0](_0x0f97('0x39'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0xd'),_0x22cc9e[_0x0f97('0x20')],'VoiceQueue'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x3a'),_0x22cc9e[_0x0f97('0x20')],_0x0f97('0x33')));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0xe'),_0x22cc9e['userProfileId'],'FaxQueue'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0xf'),_0x22cc9e[_0x0f97('0x20')],'SmsQueue'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x10'),_0x22cc9e[_0x0f97('0x20')],'MailQueue'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x11'),_0x22cc9e[_0x0f97('0x20')],_0x0f97('0x3b')));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x12'),_0x22cc9e[_0x0f97('0x20')],_0x0f97('0x37')));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x13'),_0x22cc9e[_0x0f97('0x20')],'User'));_0x29bcf2[_0x0f97('0x31')](getAssociatedResources(_0x0f97('0x15'),_0x22cc9e['userProfileId'],_0x0f97('0x3c')));_0x29bcf2['push'](getAssociatedResources(_0x0f97('0x16'),_0x22cc9e[_0x0f97('0x20')],_0x0f97('0x1b')));_0x29bcf2['push'](db['User'][_0x0f97('0x14')](queryAgents));break;case _0x0f97('0x7'):_0xf2dab8[_0x5c2af0](_0x0f97('0x38'));_0xf2dab8[_0x5c2af0](_0x0f97('0x39'));_0x29bcf2[_0x0f97('0x31')](_0x22cc9e['getVoiceQueues']({'attributes':['id','name']}));_0x29bcf2[_0x0f97('0x31')](_0x22cc9e[_0x0f97('0x3d')]({'attributes':['id',_0x0f97('0x4')]}));_0x29bcf2[_0x0f97('0x31')](_0x22cc9e[_0x0f97('0x3e')]({'attributes':['id',_0x0f97('0x4')]}));_0x29bcf2[_0x0f97('0x31')](_0x22cc9e[_0x0f97('0x3f')]({'attributes':['id',_0x0f97('0x4')]}));_0x29bcf2['push'](_0x22cc9e[_0x0f97('0x40')]({'attributes':['id','name']}));_0x29bcf2[_0x0f97('0x31')](_0x22cc9e[_0x0f97('0x41')]({'attributes':['id',_0x0f97('0x4')]}));_0x29bcf2['push'](_0x22cc9e['getWhatsappQueues']({'attributes':['id',_0x0f97('0x4')]}));break;}return BPromise[_0x0f97('0x42')](_0x29bcf2);}})[_0x0f97('0xc')](function(_0x4d3649){if(_0x4d3649&&_0x4d3649['length']){for(var _0x546aac=0x0;_0x546aac<_0x4d3649[_0x0f97('0x1d')];_0x546aac+=0x1){for(var _0x3cdbee=0x0;_0x3cdbee<_0x4d3649[_0x546aac][_0x0f97('0x1d')];_0x3cdbee+=0x1){switch(_0x546aac){case 0x0:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x43'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x1:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x44'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x2:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x45'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x3:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x46'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x4:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x47'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x5:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x48'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x6:joinOrLeaveQueues(_0xf2dab8,_0x5c2af0,_0x0f97('0x49'),_0x4d3649[_0x546aac][_0x3cdbee]);break;case 0x7:if(_0x25d1ef[_0x0f97('0x1a')]!=='agent')_0xf2dab8[_0x5c2af0](util[_0x0f97('0x1e')]('telephone:%s',_0x4d3649[_0x546aac][_0x3cdbee]['name']));break;case 0x8:if(_0x25d1ef[_0x0f97('0x1a')]!=='agent')_0xf2dab8[_0x5c2af0](util[_0x0f97('0x1e')](_0x0f97('0x4a'),_0x4d3649[_0x546aac][_0x3cdbee][_0x0f97('0x4')]));break;case 0x9:if(_0x25d1ef[_0x0f97('0x1a')]!==_0x0f97('0x7'))_0xf2dab8[_0x5c2af0](util['format']('campaign:%s:%s',_0x4d3649[_0x546aac][_0x3cdbee][_0x0f97('0x9')],_0x4d3649[_0x546aac][_0x3cdbee][_0x0f97('0x4')]));break;case 0xa:_0xf2dab8[_0x5c2af0](util['format'](_0x0f97('0x2d'),_0x4d3649[_0x546aac][_0x3cdbee][_0x0f97('0x4')]));break;}}}}})[_0x0f97('0xc')](function(){if(_0x5c2af0===_0x0f97('0x4b')){var _0x4c18fe=_[_0x0f97('0x18')](_0x25d1ef[_0x0f97('0x23')],'id');return _0x25d1ef[_0x0f97('0x4c')](_0x4c18fe)[_0x0f97('0xc')](function(){for(var _0x185238=0x0;_0x185238<_0x4c18fe[_0x0f97('0x1d')];_0x185238+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x4e'),{'ChatInteractionId':Number(_0x4c18fe[_0x185238]),'UserId':Number(_0x25d1ef['id'])});}});}})[_0x0f97('0xc')](function(){if(_0x5c2af0===_0x0f97('0x4b')){var _0x29d47b=_[_0x0f97('0x18')](_0x25d1ef[_0x0f97('0x25')],'id');return _0x25d1ef[_0x0f97('0x4f')](_0x29d47b)['then'](function(){for(var _0x1b757a=0x0;_0x1b757a<_0x29d47b['length'];_0x1b757a+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x50'),{'MailInteractionId':Number(_0x29d47b[_0x1b757a]),'UserId':Number(_0x25d1ef['id'])});}});}})[_0x0f97('0xc')](function(){if(_0x5c2af0==='leave'){var _0x327517=_[_0x0f97('0x18')](_0x25d1ef[_0x0f97('0x27')],'id');return _0x25d1ef['removeFaxInteractions'](_0x327517)['then'](function(){for(var _0x5f0f31=0x0;_0x5f0f31<_0x327517['length'];_0x5f0f31+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x51'),{'FaxInteractionId':Number(_0x327517[_0x5f0f31]),'UserId':Number(_0x25d1ef['id'])});}});}})[_0x0f97('0xc')](function(){if(_0x5c2af0==='leave'){var _0x3e4a26=_['map'](_0x25d1ef[_0x0f97('0x29')],'id');return _0x25d1ef[_0x0f97('0x52')](_0x3e4a26)[_0x0f97('0xc')](function(){for(var _0x8410d8=0x0;_0x8410d8<_0x3e4a26[_0x0f97('0x1d')];_0x8410d8+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x53'),{'SmsInteractionId':Number(_0x3e4a26[_0x8410d8]),'UserId':Number(_0x25d1ef['id'])});}});}})[_0x0f97('0xc')](function(){if(_0x5c2af0===_0x0f97('0x4b')){var _0x59a646=_[_0x0f97('0x18')](_0x25d1ef[_0x0f97('0x2b')],'id');return _0x25d1ef[_0x0f97('0x54')](_0x59a646)[_0x0f97('0xc')](function(){for(var _0x46c9f2=0x0;_0x46c9f2<_0x59a646[_0x0f97('0x1d')];_0x46c9f2+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x55'),{'OpenchannelInteractionId':Number(_0x59a646[_0x46c9f2]),'UserId':Number(_0x25d1ef['id'])});}});}})['then'](function(){if(_0x5c2af0===_0x0f97('0x4b')){var _0xddbd8d=_['map'](_0x25d1ef[_0x0f97('0x56')],'id');return _0x25d1ef[_0x0f97('0x57')](_0xddbd8d)[_0x0f97('0xc')](function(){for(var _0x45bbef=0x0;_0x45bbef<_0xddbd8d['length'];_0x45bbef+=0x1){_0x31d384[_0x0f97('0x4d')](_0x0f97('0x58'),{'WhatsappInteractionId':Number(_0xddbd8d[_0x45bbef]),'UserId':Number(_0x25d1ef['id'])});}});}})[_0x0f97('0x59')](function(_0x3e357d){_0xf2dab8[_0x0f97('0x5a')](_0x3e357d);});}}function onDisconnect(_0x27d98c,_0x13ce92){joinOrLeave(_0x27d98c,_0x0f97('0x4b'),_0x13ce92);}function onConnect(_0x155b5b){joinOrLeave(_0x155b5b,_0x0f97('0x5b'));}exports[_0x0f97('0x5c')]=function(_0xeddf70){_0xeddf70['on'](_0x0f97('0x5d'),function(_0x2fa000){_0x2fa000['setMaxListeners'](0x0);_0x2fa000[_0x0f97('0x5e')]=_0x2fa000[_0x0f97('0x5f')][_0x0f97('0x5d')]['remoteAddress']+':'+_0x2fa000['request'][_0x0f97('0x5d')]['remotePort'];_0x2fa000[_0x0f97('0x60')]=new Date();_0x2fa000['log']=function(_0x23bcd8){console['log'](_0x0f97('0x61')+_0x2fa000['nsp'][_0x0f97('0x4')]+'['+_0x2fa000[_0x0f97('0x5e')]+']',_0x23bcd8);};_0x2fa000['on'](_0x0f97('0x62'),function(){onDisconnect(_0x2fa000,_0xeddf70);_0x2fa000[_0x0f97('0x5a')](_0x0f97('0x63'));});onConnect(_0x2fa000);_0x2fa000[_0x0f97('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a33dc35..c1b716e 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 _0x6530=['fullname','email','internal','hasOwnProperty','model','hook','callback','util','../../mysqldb','jayson/promise','../logger','triggers','http','ChatInteraction','newinteraction','Chat','afterUpdate','closedinteraction','afterCreate','newmessage','ChatOfflineMessage','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','QueryTypes','contact','UserId','interface','format','SIP/%s','name','agent','outgoingmessage','offlineMessage','opened','resolve','sequelize','SELECT','AfterCreate','changed','closed','substatus','AfterUpdate','User','find'];(function(_0x6002db,_0x18a070){var _0x25725c=function(_0xacacc3){while(--_0xacacc3){_0x6002db['push'](_0x6002db['shift']());}};_0x25725c(++_0x18a070);}(_0x6530,0x174));var _0x0653=function(_0x5c81d1,_0x3e1d94){_0x5c81d1=_0x5c81d1-0x0;var _0x275777=_0x6530[_0x5c81d1];return _0x275777;};'use strict';var util=require(_0x0653('0x0'));var db=require(_0x0653('0x1'))['db'];var jayson=require(_0x0653('0x2'));var logger=require(_0x0653('0x3'))(_0x0653('0x4'));var client=jayson['client'][_0x0653('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x0653('0x6'),'event':'afterCreate','condition':_0x0653('0x7'),'callback':afterCreate},{'channel':_0x0653('0x8'),'model':_0x0653('0x6'),'event':_0x0653('0x9'),'condition':_0x0653('0xa'),'callback':afterUpdate},{'channel':_0x0653('0x8'),'model':'ChatMessage','event':_0x0653('0xb'),'condition':_0x0653('0xc'),'callback':afterCreateMessage},{'channel':_0x0653('0x8'),'model':_0x0653('0xd'),'event':_0x0653('0xb'),'condition':_0x0653('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0x0653('0xb'),'condition':_0x0653('0x7'),'callback':afterCreate},{'channel':_0x0653('0xe'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x0653('0xa'),'callback':afterUpdate},{'channel':_0x0653('0xe'),'model':_0x0653('0xf'),'event':_0x0653('0xb'),'condition':_0x0653('0xc'),'callback':afterCreateMessage},{'channel':_0x0653('0x10'),'model':'WhatsappInteraction','event':_0x0653('0xb'),'condition':_0x0653('0x7'),'callback':afterCreate},{'channel':_0x0653('0x10'),'model':_0x0653('0x11'),'event':_0x0653('0x9'),'condition':_0x0653('0xa'),'callback':afterUpdate},{'channel':_0x0653('0x10'),'model':_0x0653('0x12'),'event':'afterCreate','condition':_0x0653('0xc'),'callback':afterCreateMessage},{'channel':_0x0653('0x13'),'model':_0x0653('0x14'),'event':_0x0653('0xb'),'condition':_0x0653('0x7'),'callback':afterCreate},{'channel':_0x0653('0x13'),'model':_0x0653('0x14'),'event':_0x0653('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0653('0x13'),'model':_0x0653('0x15'),'event':_0x0653('0xb'),'condition':_0x0653('0xc'),'callback':afterCreateMessage},{'channel':_0x0653('0x16'),'model':_0x0653('0x17'),'event':_0x0653('0xb'),'condition':_0x0653('0x7'),'callback':afterCreate},{'channel':_0x0653('0x16'),'model':_0x0653('0x17'),'event':_0x0653('0x9'),'condition':_0x0653('0xa'),'callback':afterUpdate},{'channel':_0x0653('0x16'),'model':_0x0653('0x18'),'event':'afterCreate','condition':_0x0653('0xc'),'callback':afterCreateMessage},{'channel':_0x0653('0x19'),'model':'OpenchannelInteraction','event':_0x0653('0xb'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x0653('0x19'),'model':_0x0653('0x1a'),'event':_0x0653('0x9'),'condition':_0x0653('0xa'),'callback':afterUpdate},{'channel':_0x0653('0x19'),'model':_0x0653('0x1b'),'event':'afterCreate','condition':_0x0653('0xc'),'callback':afterCreateMessage}];function request(_0x13011e){return client['request'](_0x0653('0x1c'),_0x13011e)[_0x0653('0x1d')](function(_0x2b5e56){logger[_0x0653('0x1e')](_0x0653('0x1f'),_0x0653('0x1c'),_0x2b5e56);if(_0x2b5e56[_0x0653('0x20')]){if(_0x2b5e56['error'][_0x0653('0x21')]===0x1f4){logger[_0x0653('0x20')]('Trigger,\x20%s',_0x0653('0x1c'),_0x2b5e56[_0x0653('0x20')]);}}})[_0x0653('0x22')](function(_0x346c8f){logger['error'](_0x0653('0x1f'),_0x0653('0x1c'),_0x346c8f);});}function afterCreateMessage(_0x57dbcd){return function(_0x53b3df){_0x53b3df=_0x53b3df[_0x0653('0x23')]({'plain':!![]});_0x53b3df[_0x0653('0x24')]=_0x57dbcd;_0x53b3df[_0x0653('0x25')]=_0x57dbcd;_0x53b3df[_0x0653('0x26')]=_0x53b3df[_0x0653('0x27')];Promise['resolve']()[_0x0653('0x1d')](function(){if(typeof _0x53b3df['ContactId']===_0x0653('0x28'))return null;var _0x301e2f=_0x0653('0x29')+_0x53b3df[_0x0653('0x2a')];return db['sequelize'][_0x0653('0x2b')](_0x301e2f,{'type':db[_0x0653('0x2c')][_0x0653('0x2d')]['SELECT'],'raw':!![]});})['then'](function(_0x5d5aee){if(_0x5d5aee){_0x53b3df[_0x0653('0x2e')]=_0x5d5aee[0x0];}if(typeof _0x53b3df[_0x0653('0x2f')]==='undefined')return;return getAgent(_0x53b3df['UserId']);})['then'](function(_0xa5c2c8){if(_0xa5c2c8){_0x53b3df[_0x0653('0x30')]=util[_0x0653('0x31')](_0x0653('0x32'),_0xa5c2c8[_0x0653('0x33')]);_0x53b3df[_0x0653('0x34')]=_0xa5c2c8;_0x53b3df['channel']=_0x57dbcd;return request({'event':'incomingmessage','message':_0x53b3df});}else{return request({'event':_0x0653('0x35'),'message':_0x53b3df});}})['catch'](function(_0x7a6008){logger[_0x0653('0x20')](_0x0653('0x1f'),'AfterCreateMessage',_0x7a6008);});};}function afterCreateOfflineMessage(_0x4d19cf){return function(_0x1e335e){_0x1e335e=_0x1e335e[_0x0653('0x23')]({'plain':!![]});_0x1e335e[_0x0653('0x24')]=_0x4d19cf;_0x1e335e['motionChannel']=_0x4d19cf;_0x1e335e[_0x0653('0x26')]=_0x0653('0x36');return request({'event':_0x1e335e['event'],'message':_0x1e335e});};}function afterCreate(_0x4ed343,_0xf2c298){return function(_0x3bdfb3){_0x3bdfb3=_0x3bdfb3[_0x0653('0x23')]({'plain':!![]});_0x3bdfb3[_0x0653('0x24')]=_0x4ed343;_0x3bdfb3[_0x0653('0x25')]=_0x4ed343;_0x3bdfb3['event']=_0x0653('0x37');Promise[_0x0653('0x38')]()[_0x0653('0x1d')](function(){var _0x119c7d=_0x0653('0x29')+_0x3bdfb3[_0x0653('0x2a')];return db[_0x0653('0x39')][_0x0653('0x2b')](_0x119c7d,{'type':db[_0x0653('0x2c')][_0x0653('0x2d')][_0x0653('0x3a')],'raw':!![]});})[_0x0653('0x1d')](function(_0x446b17){if(_0x446b17){_0x3bdfb3['contact']=_0x446b17[0x0];}if(typeof _0x3bdfb3['UserId']===_0x0653('0x28'))return;return getAgent(_0x3bdfb3[_0x0653('0x2f')]);})[_0x0653('0x1d')](function(_0x3e71ca){if(_0x3e71ca){_0x3bdfb3[_0x0653('0x30')]=util[_0x0653('0x31')](_0x0653('0x32'),_0x3e71ca[_0x0653('0x33')]);_0x3bdfb3[_0x0653('0x34')]=_0x3e71ca;}return request({'event':_0xf2c298,'message':_0x3bdfb3});})[_0x0653('0x22')](function(_0x124d94){logger[_0x0653('0x20')]('Trigger,\x20%s',_0x0653('0x3b'),_0x124d94);});};}function afterUpdate(_0x21416d){return function(_0x50948a){var _0x3f8ce6=_0x50948a[_0x0653('0x3c')](_0x0653('0x3d'))&&_0x50948a['closed'];var _0x3c2ad5=_0x50948a[_0x0653('0x3c')](_0x0653('0x3e'));if(_0x3f8ce6||_0x3c2ad5){var _0x2c590d=_0x3f8ce6?_0x0653('0xa'):_0x0653('0x3e');var _0x374b84=_0x50948a[_0x0653('0x23')]({'plain':!![]});_0x374b84[_0x0653('0x24')]=_0x21416d;_0x374b84[_0x0653('0x25')]=_0x21416d;_0x374b84['event']=_0x3f8ce6?_0x0653('0x3d'):_0x0653('0x3e');var _0x507350=_0x0653('0x29')+_0x374b84[_0x0653('0x2a')];return db[_0x0653('0x39')][_0x0653('0x2b')](_0x507350,{'type':db[_0x0653('0x2c')][_0x0653('0x2d')][_0x0653('0x3a')],'raw':!![]})['then'](function(_0x4bbaee){if(_0x4bbaee){_0x374b84[_0x0653('0x2e')]=_0x4bbaee[0x0];}if(typeof _0x374b84[_0x0653('0x2f')]==='undefined')return;return getAgent(_0x374b84[_0x0653('0x2f')]);})[_0x0653('0x1d')](function(_0x497e65){if(_0x497e65){_0x374b84[_0x0653('0x30')]=util['format'](_0x0653('0x32'),_0x497e65[_0x0653('0x33')]);_0x374b84[_0x0653('0x34')]=_0x497e65;}return request({'event':_0x2c590d,'message':_0x374b84});})[_0x0653('0x22')](function(_0x9bd5a5){logger[_0x0653('0x20')](_0x0653('0x1f'),_0x0653('0x3f'),_0x9bd5a5);});}};}function getAgent(_0xc9226f){return db[_0x0653('0x40')][_0x0653('0x41')]({'where':{'id':_0xc9226f},'attributes':['id',_0x0653('0x33'),_0x0653('0x42'),_0x0653('0x43'),_0x0653('0x44')],'raw':!![]})[_0x0653('0x1d')](function(_0xfc3424){return _0xfc3424;});}exports['default']=function(){for(var _0x3afbc2=0x0;_0x3afbc2=_0x5d66cb[_0xf7fc('0x14')]){throw Error(_0xf7fc('0x15'));}_0x5aa53f(_0x33f604);})[_0xf7fc('0x16')](function(_0x4ebe33){_0x3917a0(_0x4ebe33);});});}; \ No newline at end of file +var _0xd05d=['then','agents','catch','lodash','bluebird','./license/util','voice','mail','chat','sms','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','role','agent','User','count'];(function(_0x5a2584,_0x5ad869){var _0x47cece=function(_0x304947){while(--_0x304947){_0x5a2584['push'](_0x5a2584['shift']());}};_0x47cece(++_0x5ad869);}(_0xd05d,0xab));var _0xdd05=function(_0x34792f,_0x1fc821){_0x34792f=_0x34792f-0x0;var _0x41c25f=_0xd05d[_0x34792f];return _0x41c25f;};'use strict';var _=require(_0xdd05('0x0'));var BPromise=require(_0xdd05('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xdd05('0x2'));var channels=[_0xdd05('0x3'),_0xdd05('0x4'),_0xdd05('0x5'),'fax',_0xdd05('0x6'),'whatsapp',_0xdd05('0x7')];exports[_0xdd05('0x8')]=function(){return channels;};exports[_0xdd05('0x9')]=function(_0x2de8ae){_0x2de8ae=_0x2de8ae[_0xdd05('0xa')]();return _['includes'](channels,_0x2de8ae);};exports[_0xdd05('0xb')]=function(_0x3fdf1e,_0x14d588,_0x51d20a,_0x3ff2f3){var _0x349c34={'loginAttempts':_0x14d588,'blocked':_0x51d20a};if(!_[_0xdd05('0xc')](_0x3ff2f3)){_0x349c34[_0xdd05('0xd')]=_0x3ff2f3;}return _0x3fdf1e['updateAttributes'](_0x349c34);};exports['getLicense']=function(_0x4a56d7){return new BPromise(function(_0x4ade08,_0x4f0bd1){var _0x2df014=0x0;if(_0x4a56d7[_0xdd05('0xe')]!==_0xdd05('0xf')){_0x4ade08(_0x4a56d7);}db[_0xdd05('0x10')][_0xdd05('0x11')]({'where':{'role':_0xdd05('0xf'),'online':!![],'id':{'$ne':_0x4a56d7['id']}}})[_0xdd05('0x12')](function(_0x15bafc){_0x2df014=_0x15bafc;return util['getLicense']();})['then'](function(_0x3600b9){if(_0x3600b9&&_0x3600b9[_0xdd05('0x13')]&&_0x2df014>=_0x3600b9['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4ade08(_0x4a56d7);})[_0xdd05('0x14')](function(_0x597fe3){_0x4f0bd1(_0x597fe3);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index a6c5682..08a9fe4 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['status','send','exports','../config/logger','api','message','Internal\x20Server\x20Error','Error','inherits','name','Entity\x20not\x20found','Not\x20Found','Bad\x20Request','Forbidden','OutOfInterval','error','stack'];(function(_0xee12a3,_0x4d2c79){var _0x41a6a2=function(_0x1dbf98){while(--_0x1dbf98){_0xee12a3['push'](_0xee12a3['shift']());}};_0x41a6a2(++_0x4d2c79);}(_0xb688,0xcf));var _0x8b68=function(_0xbd3d68,_0x3e470a){_0xbd3d68=_0xbd3d68-0x0;var _0x31bc93=_0xb688[_0xbd3d68];return _0x31bc93;};'use strict';var util=require('util');var logger=require(_0x8b68('0x0'))(_0x8b68('0x1'));var APIError=function(_0x266285,_0x1080e8){this[_0x8b68('0x2')]=_0x266285||_0x8b68('0x3');this['name']=_0x1080e8||_0x8b68('0x4');util[_0x8b68('0x5')](APIError,Error);};var APIBadRequestError=function(_0x30f33d){this[_0x8b68('0x2')]=_0x30f33d||'Bad\x20Request';this[_0x8b68('0x6')]='Bad\x20Request';util[_0x8b68('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x2bbffd){this[_0x8b68('0x2')]=_0x2bbffd||_0x8b68('0x7');this[_0x8b68('0x6')]=_0x8b68('0x8');util[_0x8b68('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x21d944){switch(_0x21d944){case _0x8b68('0x9'):return 0x190;case _0x8b68('0xa'),_0x8b68('0xb'):return 0x193;case _0x8b68('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2a852a){return function(_0x502727){logger[_0x8b68('0xc')](_0x502727[_0x8b68('0xd')]);var _0x5e76c=getStatusCode(_0x502727[_0x8b68('0x6')]);if(_0x502727[_0x8b68('0x6')])delete _0x502727[_0x8b68('0x6')];return _0x2a852a[_0x8b68('0xe')](_0x5e76c)[_0x8b68('0xf')](_0x502727);};}module[_0x8b68('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xf4eb=['Bad\x20Request','name','Not\x20Found','Forbidden','OutOfInterval','stack','send','exports','util','message','Error','inherits'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf4eb,0xec));var _0xbf4e=function(_0x267d82,_0x2df727){_0x267d82=_0x267d82-0x0;var _0x4335aa=_0xf4eb[_0x267d82];return _0x4335aa;};'use strict';var util=require(_0xbf4e('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x479210,_0x5ed5b9){this[_0xbf4e('0x1')]=_0x479210||'Internal\x20Server\x20Error';this['name']=_0x5ed5b9||_0xbf4e('0x2');util[_0xbf4e('0x3')](APIError,Error);};var APIBadRequestError=function(_0x32d1d7){this[_0xbf4e('0x1')]=_0x32d1d7||_0xbf4e('0x4');this[_0xbf4e('0x5')]=_0xbf4e('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x449d55){this['message']=_0x449d55||'Entity\x20not\x20found';this[_0xbf4e('0x5')]=_0xbf4e('0x6');util[_0xbf4e('0x3')](APINotFoundError,APIError);};function getStatusCode(_0xc86f04){switch(_0xc86f04){case _0xbf4e('0x4'):return 0x190;case _0xbf4e('0x7'),_0xbf4e('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d9a07){return function(_0x7dfb74){logger['error'](_0x7dfb74[_0xbf4e('0x9')]);var _0xcf6ba8=getStatusCode(_0x7dfb74['name']);if(_0x7dfb74[_0xbf4e('0x5')])delete _0x7dfb74['name'];return _0x4d9a07['status'](_0xcf6ba8)[_0xbf4e('0xa')](_0x7dfb74);};}module[_0xbf4e('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f7005f0..7906c41 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe495=['render','json','exports','status'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xe495,0xfe));var _0x5e49=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xe495[_0x42bdad];return _0x122626;};'use strict';module[_0x5e49('0x0')][0x194]=function pageNotFound(_0x4e0de7,_0x2f241b){var _0x35d3b0='404';var _0xdf0a7a=0x194;var _0x31ddfe={'status':_0xdf0a7a};_0x2f241b[_0x5e49('0x1')](_0x31ddfe['status']);_0x2f241b[_0x5e49('0x2')](_0x35d3b0,{},function(_0xb36bc1,_0x1a76d8){if(_0xb36bc1){return _0x2f241b[_0x5e49('0x1')](_0x31ddfe[_0x5e49('0x1')])[_0x5e49('0x3')](_0x31ddfe);}_0x2f241b['send'](_0x1a76d8);});}; \ No newline at end of file +var _0x93d3=['exports','status','render'];(function(_0x122796,_0x29d441){var _0x3b6f3a=function(_0x13be34){while(--_0x13be34){_0x122796['push'](_0x122796['shift']());}};_0x3b6f3a(++_0x29d441);}(_0x93d3,0x1e9));var _0x393d=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x93d3[_0x1928c9];return _0x51b5fb;};'use strict';module[_0x393d('0x0')][0x194]=function pageNotFound(_0x59f21d,_0x1b738f){var _0x4eb63c='404';var _0x530f7d=0x194;var _0x4cbd17={'status':_0x530f7d};_0x1b738f[_0x393d('0x1')](_0x4cbd17[_0x393d('0x1')]);_0x1b738f[_0x393d('0x2')](_0x4eb63c,{},function(_0x547b0b,_0x4a3ea3){if(_0x547b0b){return _0x1b738f['status'](_0x4cbd17['status'])['json'](_0x4cbd17);}_0x1b738f['send'](_0x4a3ea3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 04c470e..68b53cb 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a38=['../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','userSetting','hasMany','Recordings','UserVoiceQueueRt','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','ChatInteraction','ChatInteractions','FaxInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','OpenchannelInteractions','user_has_openchannel_interactions','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','moh_has_sounds','Members','Hoppers','HopperHistories','VoiceQueueId','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceCallReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPauseId','Agents','MailMessage','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','List','Dashboard','Dispositions','FaxAccountId','FaxApplication','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsApplication','TagId','SmsInteractionId','sms_interaction_has_tags','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CmCompany','Contacts','CmContactId','FaxInteractions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','ChatApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ContactItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','Trigger','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','MetricId','Configurations','AccountId','SalesforceConfiguration','SubjectId','Descriptions','DescriptionId','Fields','Subject','Description','Field','VariableId','Subjects','FieldId','DeskAccount','int_desk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','Dynamics365Field','FromId','ToId','SessionId','JscriptyProject','ProjectId','user_has_teams','VoiceQueues','team_has_mail_queues','team_has_whatsapp_queues','VoicePrefix','TrunkId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToUserId','ToChatQueueId','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToQueue','ToSmsAccountId','CustomFields','HopperHistory','Queues','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','motion2','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','database','username','options','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model'];(function(_0x2a3d53,_0x473811){var _0x26921b=function(_0x2787dd){while(--_0x2787dd){_0x2a3d53['push'](_0x2a3d53['shift']());}};_0x26921b(++_0x473811);}(_0x7a38,0x1f0));var _0x87a3=function(_0x2b22e4,_0x26b1a8){_0x2b22e4=_0x2b22e4-0x0;var _0x15f1d1=_0x7a38[_0x2b22e4];return _0x15f1d1;};'use strict';var config=require(_0x87a3('0x0'));var Sequelize=require(_0x87a3('0x1'));var _=require(_0x87a3('0x2'));var jstz=require(_0x87a3('0x3'));var timezone=jstz['determine']();config[_0x87a3('0x1')]=_['defaultsDeep'](config[_0x87a3('0x1')],{'database':_0x87a3('0x4'),'username':_0x87a3('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x87a3('0x6'),'dialectOptions':{'charset':_0x87a3('0x7')},'logging':![],'timezone':timezone[_0x87a3('0x8')](),'define':{'charset':_0x87a3('0x9'),'collate':_0x87a3('0xa')}}});config[_0x87a3('0xb')]=_['defaultsDeep'](config[_0x87a3('0xb')],{'database':_0x87a3('0x4'),'username':'xcall','password':_0x87a3('0xc'),'options':{'host':_0x87a3('0xd'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x87a3('0x7')},'logging':![],'timezone':timezone[_0x87a3('0x8')](),'define':{'charset':_0x87a3('0x9'),'collate':_0x87a3('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x87a3('0xe')],config['sequelize']['username'],config['sequelize']['password'],config[_0x87a3('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x87a3('0xb')][_0x87a3('0xe')],config['sequelizeHistory'][_0x87a3('0xf')],config[_0x87a3('0xb')]['password'],config['sequelizeHistory'][_0x87a3('0x10')])};db['User']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x12'));db['VoiceChanSpy']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x13'));db[_0x87a3('0x14')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x15'));db['VoiceMusicOnHold']=db[_0x87a3('0x1')]['import'](_0x87a3('0x16'));db[_0x87a3('0x17')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x18'));db[_0x87a3('0x19')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x87a3('0x1a')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x1b'));db[_0x87a3('0x1c')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x1d'));db['VoiceMailMessage']=db['sequelize']['import'](_0x87a3('0x1e'));db['VoiceCallReport']=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x1f'));db[_0x87a3('0x20')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x21'));db[_0x87a3('0x22')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x23'));db['MemberReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x24'));db[_0x87a3('0x25')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x26'));db[_0x87a3('0x27')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x28'));db['UserVoiceQueueRt']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x29'));db[_0x87a3('0x2a')]=db[_0x87a3('0x1')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x87a3('0x2b')]=db[_0x87a3('0x1')]['import']('../api/userChatQueue/userChatQueue.model');db[_0x87a3('0x2c')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0x87a3('0x2d')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x2e'));db[_0x87a3('0x2f')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x30'));db[_0x87a3('0x31')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x32'));db[_0x87a3('0x33')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x34'));db['MailServerOut']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x35'));db[_0x87a3('0x36')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/mailAccount/mailAccount.model');db[_0x87a3('0x37')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x38'));db[_0x87a3('0x39')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x3a'));db[_0x87a3('0x3b')]=db['sequelize']['import'](_0x87a3('0x3c'));db['MailMessage']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x3d'));db[_0x87a3('0x3e')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x3f'));db[_0x87a3('0x40')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x41'));db['Dashboard']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x42'));db[_0x87a3('0x43')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x44'));db[_0x87a3('0x45')]=db['sequelize']['import'](_0x87a3('0x46'));db['FaxApplication']=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize']['import'](_0x87a3('0x47'));db['FaxMessage']=db['sequelize']['import'](_0x87a3('0x48'));db[_0x87a3('0x49')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x4a'));db[_0x87a3('0x4b')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x4c'));db[_0x87a3('0x4d')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db['sequelize'][_0x87a3('0x11')]('../api/smsApplication/smsApplication.model');db[_0x87a3('0x4e')]=db[_0x87a3('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x87a3('0x1')]['import'](_0x87a3('0x4f'));db[_0x87a3('0x50')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x51'));db['OpenchannelAccount']=db[_0x87a3('0x1')]['import'](_0x87a3('0x52'));db[_0x87a3('0x53')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x54'));db[_0x87a3('0x55')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x56'));db[_0x87a3('0x57')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x58'));db[_0x87a3('0x59')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x5a'));db[_0x87a3('0x5b')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x5c'));db['OpenchannelQueueReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x5d'));db[_0x87a3('0x5e')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x5f'));db['ChatInteraction']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x60'));db['ChatMessage']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x61'));db[_0x87a3('0x62')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x63'));db[_0x87a3('0x64')]=db['sequelize'][_0x87a3('0x11')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db['sequelize']['import'](_0x87a3('0x65'));db[_0x87a3('0x66')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x67'));db['CmCompany']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x68'));db[_0x87a3('0x69')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x6a'));db[_0x87a3('0x6b')]=db['sequelize'][_0x87a3('0x11')]('../api/cmHopper/cmHopper.model');db[_0x87a3('0x6c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x6d'));db[_0x87a3('0x6e')]=db['sequelize']['import'](_0x87a3('0x6f'));db[_0x87a3('0x70')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x71'));db[_0x87a3('0x72')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x73'));db[_0x87a3('0x74')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x87a3('0x75')]=db[_0x87a3('0x1')]['import']('../api/action/action.model');db[_0x87a3('0x76')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x77'));db[_0x87a3('0x78')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x79'));db[_0x87a3('0x7a')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x7b'));db[_0x87a3('0x7c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x7d'));db[_0x87a3('0x7e')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/interval/interval.model');db[_0x87a3('0x7f')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x80'));db[_0x87a3('0x81')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x82'));db[_0x87a3('0x83')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x84'));db['Schedule']=db[_0x87a3('0x1')]['import'](_0x87a3('0x85'));db[_0x87a3('0x86')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x87'));db[_0x87a3('0x88')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x89'));db['ContactItemType']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8a'));db[_0x87a3('0x8b')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8c'));db['CmHopperAdditionalPhone']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x8d'));db[_0x87a3('0x8e')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x8f'));db['Trigger']=db['sequelize'][_0x87a3('0x11')]('../api/trigger/trigger.model');db[_0x87a3('0x90')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x91'));db[_0x87a3('0x92')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x93'));db['IntegrationReport']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x94'));db['AnalyticCustomReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x95'));db[_0x87a3('0x96')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x97'));db[_0x87a3('0x98')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x99'));db[_0x87a3('0x9a')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x9b'));db[_0x87a3('0x9c')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x9d'));db['AnalyticTreeReport']=db[_0x87a3('0x1')]['import'](_0x87a3('0x9e'));db[_0x87a3('0x9f')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa0'));db[_0x87a3('0xa1')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa2'));db[_0x87a3('0xa3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xa4'));db[_0x87a3('0xa5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xa6'));db[_0x87a3('0xa7')]=db['sequelize']['import'](_0x87a3('0xa8'));db['DeskAccount']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xa9'));db[_0x87a3('0xaa')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xab'));db[_0x87a3('0xac')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xad'));db[_0x87a3('0xae')]=db['sequelize'][_0x87a3('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0x87a3('0xaf')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xb0'));db[_0x87a3('0xb1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xb2'));db[_0x87a3('0xb3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xb4'));db[_0x87a3('0xb5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xb6'));db[_0x87a3('0xb7')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xb8'));db[_0x87a3('0xb9')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xba'));db['FreshdeskConfiguration']=db[_0x87a3('0x1')]['import'](_0x87a3('0xbb'));db['FreshdeskField']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xbc'));db[_0x87a3('0xbd')]=db[_0x87a3('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x87a3('0xbe')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xbf'));db[_0x87a3('0xc0')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intVtigerField/intVtigerField.model');db[_0x87a3('0xc1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xc2'));db[_0x87a3('0xc3')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xc4'));db[_0x87a3('0xc5')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/intServicenowField/intServicenowField.model');db[_0x87a3('0xc6')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xc7'));db[_0x87a3('0xc8')]=db[_0x87a3('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xc9'));db[_0x87a3('0xca')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xcb'));db[_0x87a3('0xcc')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xcd'));db[_0x87a3('0xce')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xcf'));db[_0x87a3('0x92')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x93'));db['Network']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd0'));db[_0x87a3('0xd1')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xd2'));db[_0x87a3('0xd3')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd4'));db[_0x87a3('0xd5')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd6'));db[_0x87a3('0xd7')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xd8'));db[_0x87a3('0xd9')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x87a3('0xda')]=db['sequelize'][_0x87a3('0x11')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xdb'));db[_0x87a3('0xdc')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xdd'));db['JscriptyProject']=db[_0x87a3('0x1')]['import'](_0x87a3('0xde'));db[_0x87a3('0xdf')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe0'));db[_0x87a3('0xe1')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe2'));db[_0x87a3('0xe3')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xe4'));db['SquareRecording']=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xe5'));db[_0x87a3('0xe6')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xe7'));db[_0x87a3('0xe8')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/team/team.model');db[_0x87a3('0xe9')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xea'));db[_0x87a3('0xeb')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/campaign/campaign.model');db[_0x87a3('0xec')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0xed'));db[_0x87a3('0xee')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xef'));db[_0x87a3('0xf0')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf1'));db[_0x87a3('0xf2')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf3'));db[_0x87a3('0xf4')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xf5'));db['FaxTransferReport']=db['sequelize']['import'](_0x87a3('0xf6'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0x87a3('0xf7'));db[_0x87a3('0xf8')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/smsTransferReport/smsTransferReport.model');db[_0x87a3('0xf9')]=db['sequelize']['import'](_0x87a3('0xfa'));db['VoicePrefix']=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xfb'));db[_0x87a3('0xfc')]=db[_0x87a3('0x1')]['import'](_0x87a3('0xfd'));db[_0x87a3('0xfe')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0xff'));db[_0x87a3('0x100')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x101'));db[_0x87a3('0x102')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x103'));db['WhatsappAccount']=db['sequelize']['import'](_0x87a3('0x104'));db[_0x87a3('0x105')]=db[_0x87a3('0x1')][_0x87a3('0x11')]('../api/whatsappApplication/whatsappApplication.model');db[_0x87a3('0x106')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x107'));db[_0x87a3('0x108')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x109'));db[_0x87a3('0x10a')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x10b'));db[_0x87a3('0x10c')]=db[_0x87a3('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x87a3('0x10d')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x10e'));db[_0x87a3('0x10f')]=db[_0x87a3('0x1')]['import'](_0x87a3('0x110'));db[_0x87a3('0x111')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x112'));db[_0x87a3('0x113')]=db[_0x87a3('0x1')][_0x87a3('0x11')](_0x87a3('0x114'));db['UserVoicePrefix']=db[_0x87a3('0x1')]['import'](_0x87a3('0x115'));db[_0x87a3('0x116')]=db['sequelize'][_0x87a3('0x11')](_0x87a3('0x117'));db[_0x87a3('0x118')][_0x87a3('0x119')](db[_0x87a3('0x1c')],{'as':_0x87a3('0x1c'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x11b')});db['User'][_0x87a3('0x119')](db[_0x87a3('0x116')],{'as':_0x87a3('0x11c'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x11b')});db['User'][_0x87a3('0x11d')](db[_0x87a3('0x19')],{'as':_0x87a3('0x11e'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x11f')],{'as':_0x87a3('0x120'),'foreignKey':'UserId'});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x118')]['hasMany'](db[_0x87a3('0x6e')],{'as':_0x87a3('0x123'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':'OpenchannelInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')]['hasMany'](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x4e')],{'as':'SmsInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':'FaxInteractions','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x118')][_0x87a3('0x11d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x128'),'foreignKey':'UserId'});db['User'][_0x87a3('0x11d')](db[_0x87a3('0x102')],{'as':_0x87a3('0x129'),'foreignKey':_0x87a3('0x12a')});db['User'][_0x87a3('0x12b')](db[_0x87a3('0xfc')],{'as':'UserProfile','foreignKey':_0x87a3('0x12c')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x12e')],{'as':_0x87a3('0x12f'),'through':_0x87a3('0x130')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x69')],{'as':'Contacts','through':_0x87a3('0x131')});db['User']['belongsToMany'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x132'),'through':_0x87a3('0x133')});db['User']['belongsToMany'](db[_0x87a3('0xe8')],{'through':'user_has_teams'});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'through':_0x87a3('0x134')});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'through':_0x87a3('0x135')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x126')],{'as':'FaxInteractions','through':_0x87a3('0x136')});db['User']['belongsToMany'](db['SmsInteraction'],{'as':_0x87a3('0x137'),'through':'user_has_sms_interactions'});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x138'),'through':_0x87a3('0x139')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x128'),'through':'user_has_whatsapp_interactions'});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'as':'VoiceQueues','through':_0x87a3('0x2a'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db['VoicePrefix'],{'as':_0x87a3('0x13a'),'through':_0x87a3('0x13b'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x37')],{'as':_0x87a3('0x13c'),'through':_0x87a3('0x2c'),'required':![]});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x64')],{'as':_0x87a3('0x13d'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x87a3('0x118')]['belongsToMany'](db['FaxQueue'],{'as':_0x87a3('0x13e'),'through':_0x87a3('0x2d'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x50')],{'as':_0x87a3('0x13f'),'through':'UserSmsQueue','required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x59')],{'as':_0x87a3('0x140'),'through':_0x87a3('0x2f'),'required':![]});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x10d')],{'as':_0x87a3('0x141'),'through':_0x87a3('0x31'),'required':![]});db['User']['belongsToMany'](db[_0x87a3('0xf9')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x87a3('0x142')});db['User'][_0x87a3('0x12d')](db[_0x87a3('0x45')],{'as':_0x87a3('0x143'),'through':_0x87a3('0x144')});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0x36')],{'as':_0x87a3('0x145'),'through':_0x87a3('0x146')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x147')],{'as':_0x87a3('0x148'),'through':'user_has_openchannel_accounts'});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0x4d')],{'as':'SmsAccounts','through':_0x87a3('0x149')});db[_0x87a3('0x118')][_0x87a3('0x12d')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x14b'),'through':_0x87a3('0x14c')});db[_0x87a3('0x118')]['belongsToMany'](db[_0x87a3('0xe3')],{'as':_0x87a3('0x14d'),'through':_0x87a3('0x14e')});db[_0x87a3('0x14f')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x150'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x151')});db['VoiceContext'][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x121')][_0x87a3('0x11d')](db['VoiceExtension'],{'as':_0x87a3('0x152'),'onDelete':'cascade'});db[_0x87a3('0x153')]['belongsToMany'](db[_0x87a3('0x86')],{'as':'Sounds','through':_0x87a3('0x154')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x11f')],{'as':_0x87a3('0x155'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')][_0x87a3('0x11d')](db['CmHopperFinal'],{'as':_0x87a3('0x123'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x11d')](db[_0x87a3('0x6c')],{'as':_0x87a3('0x159'),'foreignKey':'VoiceQueueId'});db[_0x87a3('0x17')]['hasMany'](db[_0x87a3('0xd9')],{'as':_0x87a3('0x15a'),'foreignKey':_0x87a3('0x158')});db[_0x87a3('0x17')][_0x87a3('0x12b')](db['Trunk'],{'as':_0x87a3('0x25'),'foreignKey':'TrunkId'});db[_0x87a3('0x17')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x15b'),'foreignKey':_0x87a3('0x15c')});db[_0x87a3('0x17')]['belongsTo'](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x17')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x132'),'through':_0x87a3('0x15f')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':'Agents','through':_0x87a3('0x2a')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'as':_0x87a3('0x160'),'through':_0x87a3('0x111')});db[_0x87a3('0x17')][_0x87a3('0x12d')](db['CmList'],{'as':_0x87a3('0x161'),'through':_0x87a3('0x162')});db[_0x87a3('0x19')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x118'),'foreignKey':_0x87a3('0x11b')});db['ScreenRecording'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118'),'foreignKey':'UserId'});db[_0x87a3('0x1c')][_0x87a3('0x11d')](db['VoiceMailMessage'],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x164'),'sourceKey':_0x87a3('0x165')});db[_0x87a3('0x166')][_0x87a3('0x12b')](db[_0x87a3('0x1c')],{'foreignKey':_0x87a3('0x164'),'targetKey':_0x87a3('0x165')});db[_0x87a3('0x167')][_0x87a3('0x11d')](db[_0x87a3('0x22')],{'as':_0x87a3('0x168'),'foreignKey':_0x87a3('0x169'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x87a3('0x20')],{'as':_0x87a3('0x16a'),'foreignKey':_0x87a3('0x169'),'constraints':![]});db[_0x87a3('0x167')]['belongsTo'](db[_0x87a3('0x118')],{'as':'User','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x167')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x33')]['belongsTo'](db[_0x87a3('0x36')],{'as':_0x87a3('0x36'),'foreignKey':'MailAccountId'});db[_0x87a3('0x33')][_0x87a3('0x12b')](db[_0x87a3('0x10f')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailServerOut'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'as':_0x87a3('0x36'),'foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x16e')]['belongsTo'](db[_0x87a3('0x10f')],{'as':_0x87a3('0x10f'),'foreignKey':_0x87a3('0x16f'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x36')][_0x87a3('0x119')](db[_0x87a3('0x33')],{'as':_0x87a3('0x171'),'onDelete':'cascade'});db[_0x87a3('0x36')][_0x87a3('0x119')](db[_0x87a3('0x16e')],{'as':_0x87a3('0x172'),'onDelete':'cascade'});db[_0x87a3('0x36')][_0x87a3('0x11d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x87a3('0x16d'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db['CannedAnswer'],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x16d')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':_0x87a3('0x163'),'foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x174')});db[_0x87a3('0x36')][_0x87a3('0x11d')](db[_0x87a3('0x3e')],{'as':_0x87a3('0x152')});db[_0x87a3('0x36')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x36')]['belongsTo'](db[_0x87a3('0x8e')],{'as':_0x87a3('0x8e'),'foreignKey':_0x87a3('0x176')});db[_0x87a3('0x36')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':_0x87a3('0x177')});db[_0x87a3('0x36')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x146')});db[_0x87a3('0x37')]['belongsToMany'](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2c')});db[_0x87a3('0x37')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':'team_has_mail_queues','as':_0x87a3('0x160')});db[_0x87a3('0x3b')][_0x87a3('0x11d')](db[_0x87a3('0x179')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x17a')});db[_0x87a3('0x3b')][_0x87a3('0x12b')](db['MailAccount'],{'as':'Account','foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x3b')]['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db['MailInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x3b')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x17c'),'as':_0x87a3('0x17d')});db[_0x87a3('0x3b')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x17c'),'as':_0x87a3('0x17e')});db[_0x87a3('0x3b')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':'Users','through':_0x87a3('0x134'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x87a3('0x11d')](db[_0x87a3('0xee')],{'as':_0x87a3('0x17f'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x17a')});db[_0x87a3('0x179')][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'as':'Account','foreignKey':_0x87a3('0x16d')});db[_0x87a3('0x179')]['belongsTo'](db[_0x87a3('0x5b')],{'as':_0x87a3('0x5b'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x179')]['belongsTo'](db[_0x87a3('0x62')],{'as':'ChatOfflineMessage','foreignKey':_0x87a3('0x182')});db['MailApplication']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db['MailApplication'][_0x87a3('0x12b')](db[_0x87a3('0x37')],{'onDelete':'restrict'});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db['MailAccount'],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':'restrict','foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x3e')][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db[_0x87a3('0x40')]['belongsTo'](db[_0x87a3('0x36')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId'});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x3b')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x179')],{});db[_0x87a3('0x40')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0x40')]['belongsTo'](db[_0x87a3('0x37')],{});db[_0x87a3('0x184')][_0x87a3('0x11d')](db[_0x87a3('0x43')],{'as':'Items','onDelete':'cascade'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x186'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':'FaxAccountId'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':_0x87a3('0x174')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x187')],{'as':'Applications'});db[_0x87a3('0x45')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':'Exntensions','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x45')][_0x87a3('0x11d')](db['FaxMessage'],{'as':'Messages'});db[_0x87a3('0x45')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x25')});db['FaxAccount']['belongsTo'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId'});db[_0x87a3('0x45')][_0x87a3('0x12b')](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x45')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x144')});db['FaxApplication']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db['FaxApplication'][_0x87a3('0x12b')](db[_0x87a3('0x49')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x187')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x87a3('0x170')});db['FaxApplication'][_0x87a3('0x12b')](db[_0x87a3('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x87a3('0x126')][_0x87a3('0x11d')](db[_0x87a3('0x188')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x189')});db[_0x87a3('0x126')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x186')});db[_0x87a3('0x126')]['belongsTo'](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x126')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x126')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x18b'),'as':_0x87a3('0x17d')});db[_0x87a3('0x126')][_0x87a3('0x12d')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x87a3('0x17e')});db['FaxInteraction']['belongsToMany'](db['User'],{'as':_0x87a3('0x18c'),'through':'user_has_fax_interactions','foreignKey':_0x87a3('0x189')});db['FaxMessage']['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db[_0x87a3('0x188')][_0x87a3('0x12b')](db['FaxInteraction'],{'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x189')});db['FaxMessage'][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x188')]['belongsTo'](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':_0x87a3('0x18a'),'foreignKey':'FaxAccountId'});db[_0x87a3('0x49')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2d')});db[_0x87a3('0x49')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x18e'),'as':'Teams'});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['CmContact'],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db[_0x87a3('0x126')],{});db[_0x87a3('0x4b')]['belongsTo'](db['FaxMessage'],{});db[_0x87a3('0x4b')][_0x87a3('0x12b')](db['User'],{});db[_0x87a3('0x4b')]['belongsTo'](db[_0x87a3('0x49')],{});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':'Dispositions','foreignKey':_0x87a3('0x18f'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x18f')});db[_0x87a3('0x4d')][_0x87a3('0x11d')](db[_0x87a3('0x190')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x87a3('0x4e')],{'as':_0x87a3('0x174')});db[_0x87a3('0x4d')]['hasMany'](db[_0x87a3('0x191')],{'as':_0x87a3('0x152')});db[_0x87a3('0x4d')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x4d')]['belongsTo'](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x4d')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':'user_has_sms_accounts'});db[_0x87a3('0x191')]['belongsTo'](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')]['belongsTo'](db[_0x87a3('0x50')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x191')]['belongsTo'](db['Interval'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db['SmsApplication'][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x192')});db[_0x87a3('0x4e')][_0x87a3('0x11d')](db[_0x87a3('0x190')],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x193')});db[_0x87a3('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x18f')});db[_0x87a3('0x4e')]['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x4e')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x4e')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x194'),'as':_0x87a3('0x17d')});db[_0x87a3('0x4e')]['belongsToMany'](db[_0x87a3('0x88')],{'through':'sms_interaction_has_tags','as':_0x87a3('0x17e')});db[_0x87a3('0x4e')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db[_0x87a3('0x190')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':'Contact'});db[_0x87a3('0x190')][_0x87a3('0x12b')](db[_0x87a3('0x4e')],{'onDelete':_0x87a3('0x11a'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x87a3('0x190')][_0x87a3('0x12b')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x87a3('0x50')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x195'),'foreignKey':_0x87a3('0x196')});db['SmsQueue'][_0x87a3('0x12d')](db['Team'],{'through':_0x87a3('0x197'),'as':_0x87a3('0x160')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db['Disposition'],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x198'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0x87a3('0x147')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x174'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x147')][_0x87a3('0x11d')](db['OpenchannelMessage'],{'as':_0x87a3('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x87a3('0x147')]['hasMany'](db[_0x87a3('0x53')],{'as':_0x87a3('0x152'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x147')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x147')][_0x87a3('0x12b')](db['Pause'],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x147')][_0x87a3('0x12d')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x53')][_0x87a3('0x12b')](db['OpenchannelQueue'],{'onDelete':_0x87a3('0x170'),'foreignKey':'OpenchannelQueueId'});db[_0x87a3('0x53')][_0x87a3('0x12b')](db['OpenchannelAccount'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x198')});db['OpenchannelApplication'][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0x53')][_0x87a3('0x12b')](db[_0x87a3('0x88')],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db[_0x87a3('0x55')][_0x87a3('0x11d')](db[_0x87a3('0x57')],{'as':_0x87a3('0x163'),'onDelete':'cascade','foreignKey':_0x87a3('0x199')});db[_0x87a3('0x55')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x55')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x19a'),'as':_0x87a3('0x17d')});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x19a'),'as':'ThroughTags'});db[_0x87a3('0x55')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db[_0x87a3('0x57')][_0x87a3('0x12b')](db['CmContact'],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x57')]['belongsTo'](db[_0x87a3('0x55')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x199')});db['OpenchannelMessage']['belongsTo'](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db[_0x87a3('0x57')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x198')});db[_0x87a3('0x59')]['belongsToMany'](db[_0x87a3('0x118')],{'as':'Agents','through':_0x87a3('0x2f'),'foreignKey':_0x87a3('0x19b')});db['OpenchannelQueue']['belongsToMany'](db[_0x87a3('0xe8')],{'through':_0x87a3('0x19c'),'as':_0x87a3('0x160')});db['ChatWebsite'][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x181'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x78')],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x66')],{'as':_0x87a3('0x19d')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db['ChatInteraction'],{'as':_0x87a3('0x174')});db['ChatWebsite'][_0x87a3('0x11d')](db[_0x87a3('0x5e')],{'as':_0x87a3('0x152')});db[_0x87a3('0x5b')][_0x87a3('0x11d')](db[_0x87a3('0x19e')],{'as':_0x87a3('0x163')});db[_0x87a3('0x5b')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':_0x87a3('0x175')});db[_0x87a3('0x5b')][_0x87a3('0x12b')](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db['ChatWebsite'][_0x87a3('0x12b')](db['MailAccount'],{'as':_0x87a3('0x36'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x87a3('0x7f')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x87a3('0x5b')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x142')});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x147')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':'ContactId'});db[_0x87a3('0x19f')]['belongsTo'](db[_0x87a3('0x55')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x57')],{});db[_0x87a3('0x19f')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0x19f')]['belongsTo'](db[_0x87a3('0x59')],{});db['ChatApplication'][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x1a0'),'foreignKey':'UserId','onDelete':_0x87a3('0x170')});db['ChatApplication'][_0x87a3('0x12b')](db[_0x87a3('0x64')],{'as':_0x87a3('0x1a1'),'foreignKey':_0x87a3('0x1a2'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x5e')][_0x87a3('0x12b')](db[_0x87a3('0x5b')],{'as':'Website','foreignKey':_0x87a3('0x181'),'onDelete':_0x87a3('0x170')});db['ChatApplication']['belongsTo'](db[_0x87a3('0x88')],{'onDelete':_0x87a3('0x170'),'foreignKey':'TagId'});db['ChatInteraction'][_0x87a3('0x11d')](db[_0x87a3('0x19e')],{'as':_0x87a3('0x163'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1a3')});db['ChatInteraction'][_0x87a3('0x12b')](db['ChatWebsite'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x181')});db['ChatInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x124')]['belongsTo'](db[_0x87a3('0x118')],{'as':'Owner','foreignKey':_0x87a3('0x11b')});db[_0x87a3('0x124')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1a4'),'as':_0x87a3('0x17d')});db[_0x87a3('0x124')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1a4'),'as':_0x87a3('0x17e')});db[_0x87a3('0x124')]['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':_0x87a3('0x135'),'foreignKey':'ChatInteractionId'});db[_0x87a3('0x19e')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x118')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b'),'foreignKey':'ContactId'});db[_0x87a3('0x19e')][_0x87a3('0x12b')](db[_0x87a3('0x124')],{'onDelete':'cascade','as':_0x87a3('0x180'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x87a3('0x12b')](db[_0x87a3('0xee')],{'as':_0x87a3('0xee'),'foreignKey':_0x87a3('0x18d')});db[_0x87a3('0x19e')]['belongsTo'](db[_0x87a3('0x5b')],{'as':'Account','foreignKey':_0x87a3('0x181')});db[_0x87a3('0x62')][_0x87a3('0x11d')](db[_0x87a3('0xee')],{'as':_0x87a3('0x17f'),'foreignKey':_0x87a3('0x182'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x62')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x62')][_0x87a3('0x12b')](db[_0x87a3('0x5b')],{'as':_0x87a3('0x18a'),'foreignKey':'ChatWebsiteId'});db[_0x87a3('0x64')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x2b'),'hooks':!![]});db[_0x87a3('0x64')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x1a5'),'as':'Teams'});db[_0x87a3('0x12e')]['hasMany'](db[_0x87a3('0xd3')],{'as':_0x87a3('0x163'),'foreignKey':_0x87a3('0x1a6'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x12e')][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x155'),'through':'chat_group_has_users'});db[_0x87a3('0x66')]['belongsTo'](db[_0x87a3('0x5b')],{'as':_0x87a3('0x1a7'),'foreignKey':_0x87a3('0x181')});db[_0x87a3('0x1a8')]['hasMany'](db[_0x87a3('0x69')],{'as':_0x87a3('0x1a9'),'foreignKey':'CompanyId'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x8b')],{'as':'Phones','foreignKey':_0x87a3('0x1aa')});db['CmContact'][_0x87a3('0x11d')](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')]['hasMany'](db[_0x87a3('0x6e')],{'as':_0x87a3('0x123'),'foreignKey':'ContactId'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db['ReportAgentPreview'],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0xd9')],{'as':'JscriptySessions','foreignKey':_0x87a3('0x16c')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x55')],{'as':_0x87a3('0x138'),'foreignKey':_0x87a3('0x16c'),'onDelete':'restrict'});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x124')],{'as':_0x87a3('0x125'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x4e')],{'as':_0x87a3('0x137'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x69')][_0x87a3('0x11d')](db[_0x87a3('0x126')],{'as':_0x87a3('0x1ab'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db['CmContact'][_0x87a3('0x11d')](db[_0x87a3('0x3b')],{'as':_0x87a3('0x127'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x170')});db['CmContact'][_0x87a3('0x12b')](db[_0x87a3('0x1a8')],{'as':_0x87a3('0x1ac'),'foreignKey':'CompanyId'});db[_0x87a3('0x69')]['belongsTo'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':'ListId','onDelete':'cascade'});db['CmContact'][_0x87a3('0x12d')](db['User'],{'as':'Users','through':_0x87a3('0x131')});db[_0x87a3('0x69')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'as':'Tags','through':_0x87a3('0x1ad')});db[_0x87a3('0x69')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1ad'),'as':_0x87a3('0x17e')});db[_0x87a3('0x6b')][_0x87a3('0x11d')](db[_0x87a3('0x1ae')],{'as':_0x87a3('0x1af'),'foreignKey':_0x87a3('0x1b0')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db['CmList'],{'as':'List','foreignKey':_0x87a3('0x175'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x1a0'),'foreignKey':'UserId'});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0x17')],{'as':_0x87a3('0x1a1'),'foreignKey':_0x87a3('0x158'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')][_0x87a3('0x12b')](db[_0x87a3('0xeb')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6b')]['belongsTo'](db[_0x87a3('0x118')],{'as':'Owner','foreignKey':_0x87a3('0x1b1')});db[_0x87a3('0x6c')][_0x87a3('0x12b')](db['CmContact'],{'as':_0x87a3('0x16b'),'foreignKey':'ContactId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6c')]['belongsTo'](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175'),'onDelete':'cascade'});db[_0x87a3('0x6c')]['belongsTo'](db[_0x87a3('0x17')],{'as':_0x87a3('0x1a1'),'foreignKey':'VoiceQueueId','onDelete':_0x87a3('0x11a')});db[_0x87a3('0x6c')][_0x87a3('0x12b')](db[_0x87a3('0xeb')],{'as':_0x87a3('0xeb'),'foreignKey':_0x87a3('0x1b2'),'onDelete':'cascade'});db[_0x87a3('0x76')][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1b3'),'singular':_0x87a3('0x1b4')},'foreignKey':_0x87a3('0x1b5'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x76')][_0x87a3('0x11d')](db['Condition'],{'as':{'plural':_0x87a3('0x1b6'),'singular':_0x87a3('0x1b7')},'foreignKey':_0x87a3('0x1b8'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x76')][_0x87a3('0x11d')](db[_0x87a3('0x75')],{'as':_0x87a3('0x1b9'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x87a3('0x7a')][_0x87a3('0x11d')](db[_0x87a3('0x7a')],{'as':_0x87a3('0x185'),'foreignKey':'ParentId','onDelete':_0x87a3('0x11a')});db['Interval']['hasMany'](db[_0x87a3('0x7e')],{'as':_0x87a3('0x1ba'),'foreignKey':_0x87a3('0x15d'),'onDelete':_0x87a3('0x11a'),'hooks':!![],'required':![]});db[_0x87a3('0x7e')]['hasMany'](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'foreignKey':_0x87a3('0x15d'),'onDelete':'restrict'});db[_0x87a3('0x7e')][_0x87a3('0x11d')](db[_0x87a3('0x3e')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x87a3('0x11d')](db[_0x87a3('0x5e')],{'as':_0x87a3('0x1bb'),'foreignKey':'IntervalId'});db[_0x87a3('0x7e')]['hasMany'](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0x87a3('0x15d')});db['Interval'][_0x87a3('0x11d')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x87a3('0x15d')});db['Schedule'][_0x87a3('0x12b')](db['MailAccount'],{});db[_0x87a3('0x1bc')]['belongsTo'](db[_0x87a3('0x96')],{'foreignKey':_0x87a3('0x1bd')});db['Schedule'][_0x87a3('0x12b')](db[_0x87a3('0x1be')],{'foreignKey':_0x87a3('0x1bf')});db[_0x87a3('0x86')][_0x87a3('0x12d')](db[_0x87a3('0x153')],{'as':_0x87a3('0x1c0'),'through':'moh_has_sounds','onDelete':_0x87a3('0x170')});db[_0x87a3('0x88')]['belongsToMany'](db[_0x87a3('0x69')],{'through':_0x87a3('0x1ad')});db['Tag'][_0x87a3('0x12d')](db[_0x87a3('0x124')],{'through':'chat_interaction_has_tags'});db[_0x87a3('0x88')][_0x87a3('0x12d')](db['MailInteraction'],{'through':_0x87a3('0x17c')});db['Tag'][_0x87a3('0x12d')](db[_0x87a3('0x4e')],{'through':'sms_interaction_has_tags'});db[_0x87a3('0x88')][_0x87a3('0x12d')](db[_0x87a3('0x126')],{'through':_0x87a3('0x18b')});db[_0x87a3('0x88')][_0x87a3('0x12d')](db[_0x87a3('0x55')],{'through':'openchannel_interaction_has_tags'});db[_0x87a3('0x88')]['belongsToMany'](db[_0x87a3('0x106')],{'through':_0x87a3('0x1c1')});db[_0x87a3('0x8b')][_0x87a3('0x12b')](db[_0x87a3('0x1c2')],{'as':'ItemType','foreignKey':_0x87a3('0x1c3')});db[_0x87a3('0x1ae')][_0x87a3('0x12b')](db['CmHopper'],{'as':_0x87a3('0x1c4'),'foreignKey':_0x87a3('0x1b0')});db['CmContactHasItem']['belongsTo'](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':'CmContactId'});db['Trigger'][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1c5'),'singular':'AllCondition'},'foreignKey':_0x87a3('0x1c6'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db[_0x87a3('0x1c7')][_0x87a3('0x11d')](db[_0x87a3('0x7c')],{'as':{'plural':_0x87a3('0x1c8'),'singular':_0x87a3('0x1c9')},'foreignKey':_0x87a3('0x1ca'),'onDelete':_0x87a3('0x11a'),'hooks':!![]});db['Trigger'][_0x87a3('0x11d')](db[_0x87a3('0x75')],{'as':_0x87a3('0x1b9'),'foreignKey':_0x87a3('0x1cb'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x1be')]['hasMany'](db[_0x87a3('0x9c')],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1bf'),'hooks':!![]});db[_0x87a3('0x96')][_0x87a3('0x11d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':'DefaultReportId'});db[_0x87a3('0x9a')][_0x87a3('0x11d')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x87a3('0x11a'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x87a3('0x12b')](db[_0x87a3('0x9a')],{'foreignKey':_0x87a3('0x1cc')});db[_0x87a3('0x9f')][_0x87a3('0x11d')](db['SalesforceConfiguration'],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1cf')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':'Subjects','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1cf')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d1'),'onDelete':'cascade','foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1cf')]['hasMany'](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':'FieldId'});db[_0x87a3('0x1cf')][_0x87a3('0x12b')](db[_0x87a3('0x9f')],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa1')][_0x87a3('0x11d')](db['SalesforceField'],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['SalesforceField'][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xa1')][_0x87a3('0x11d')](db[_0x87a3('0xa1')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db[_0x87a3('0xa1')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db['SugarcrmAccount'][_0x87a3('0x11d')](db[_0x87a3('0xa5')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa5')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d8'),'onDelete':'cascade','foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xa5')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db['SugarcrmConfiguration'][_0x87a3('0x11d')](db['SugarcrmField'],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db['SugarcrmConfiguration'][_0x87a3('0x12b')](db[_0x87a3('0xa3')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xa7')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xa7')]['hasMany'](db[_0x87a3('0xa7')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xa7')][_0x87a3('0x11d')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x87a3('0xa7')]['belongsTo'](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0x1da')][_0x87a3('0x11d')](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db['DeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d0')});db['DeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':'Descriptions','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xaa')][_0x87a3('0x11d')](db['DeskField'],{'as':_0x87a3('0x1d3'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x87a3('0xaa')][_0x87a3('0x12b')](db[_0x87a3('0x1da')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xaa')][_0x87a3('0x12d')](db['Tag'],{'through':_0x87a3('0x1db')});db[_0x87a3('0xac')][_0x87a3('0x11d')](db['DeskField'],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['DeskField']['hasMany'](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xac')][_0x87a3('0x11d')](db[_0x87a3('0xac')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xae')][_0x87a3('0x11d')](db['ZohoConfiguration'],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db['ZohoField'],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':'SubjectId'});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xaf')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db['ZohoConfiguration']['belongsTo'](db[_0x87a3('0xae')],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb1')][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db['ZohoField'][_0x87a3('0x11d')](db[_0x87a3('0xb1')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['ZohoField'][_0x87a3('0x11d')](db['ZohoField'],{'as':'Field','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb1')]['belongsTo'](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0xb3')][_0x87a3('0x11d')](db[_0x87a3('0xb5')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb5')][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xb5')]['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb5')]['belongsTo'](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xb5')][_0x87a3('0x12d')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x87a3('0xb7')][_0x87a3('0x11d')](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d4'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0x87a3('0xb7')],{'as':_0x87a3('0x1d5'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x87a3('0x11d')](db['ZendeskField'],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xb7')][_0x87a3('0x12b')](db['Variable'],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db['FreshdeskAccount']['hasMany'](db[_0x87a3('0x1dc')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1dc')][_0x87a3('0x11d')](db['FreshdeskField'],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0x1dc')][_0x87a3('0x12b')](db[_0x87a3('0xb9')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1dc')]['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1de')});db['FreshdeskField'][_0x87a3('0x11d')](db[_0x87a3('0x1dd')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0x1dd')][_0x87a3('0x11d')](db['FreshdeskField'],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db['FreshdeskField'][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xbd')][_0x87a3('0x11d')](db[_0x87a3('0xbe')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xbe')][_0x87a3('0x11d')](db['VtigerField'],{'as':_0x87a3('0x1d3'),'foreignKey':_0x87a3('0x1d9')});db['VtigerConfiguration']['belongsTo'](db['VtigerAccount'],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xc0')]['hasMany'](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d4'),'foreignKey':'SubjectId'});db['VtigerField'][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xc0')][_0x87a3('0x11d')](db[_0x87a3('0xc0')],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc0')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xc1')][_0x87a3('0x11d')](db[_0x87a3('0xc3')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':'AccountId'});db[_0x87a3('0xc3')][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d8'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xc3')]['hasMany'](db[_0x87a3('0xc5')],{'as':'Fields','foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc3')]['belongsTo'](db[_0x87a3('0xc1')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xc5')][_0x87a3('0x11d')](db[_0x87a3('0xc5')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xc5')][_0x87a3('0x11d')](db['ServicenowField'],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db['ServicenowField']['hasMany'](db[_0x87a3('0xc5')],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db['ServicenowField'][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':'Variable','foreignKey':_0x87a3('0x1d7')});db['Dynamics365Account'][_0x87a3('0x11d')](db[_0x87a3('0xc8')],{'as':_0x87a3('0x1cd'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1ce')});db['Dynamics365Account']['belongsTo'](db['CloudProvider'],{'as':_0x87a3('0x10f'),'foreignKey':'CloudProviderId'});db[_0x87a3('0xc8')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d8'),'onDelete':_0x87a3('0x11a'),'foreignKey':'SubjectId'});db[_0x87a3('0xc8')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d1'),'onDelete':_0x87a3('0x11a'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d3'),'onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0xc8')][_0x87a3('0x12b')](db[_0x87a3('0xc6')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0x1df')][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':'Subject','foreignKey':'SubjectId'});db['Dynamics365Field'][_0x87a3('0x11d')](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d5'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0x1df')]['hasMany'](db[_0x87a3('0x1df')],{'as':_0x87a3('0x1d6'),'foreignKey':_0x87a3('0x1d9')});db[_0x87a3('0x1df')][_0x87a3('0x12b')](db[_0x87a3('0x90')],{'as':_0x87a3('0x90'),'foreignKey':_0x87a3('0x1d7')});db[_0x87a3('0xca')][_0x87a3('0x11d')](db[_0x87a3('0xcc')],{'as':_0x87a3('0x1cd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d8'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d1'),'foreignKey':_0x87a3('0x1d2')});db[_0x87a3('0xcc')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d3'),'foreignKey':_0x87a3('0x1d9')});db['FreshsalesConfiguration']['belongsTo'](db[_0x87a3('0xca')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x1ce')});db[_0x87a3('0xce')][_0x87a3('0x11d')](db[_0x87a3('0xce')],{'as':_0x87a3('0x1d4'),'foreignKey':_0x87a3('0x1d0')});db[_0x87a3('0xce')][_0x87a3('0x11d')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x87a3('0x1d2')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x87a3('0x1d6'),'foreignKey':'FieldId'});db[_0x87a3('0xce')]['belongsTo'](db['Variable'],{'as':_0x87a3('0x90'),'foreignKey':'VariableId'});db[_0x87a3('0xd1')][_0x87a3('0x12b')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xd1')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0xd1')]['belongsTo'](db[_0x87a3('0x124')],{});db[_0x87a3('0xd1')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport']['belongsTo'](db[_0x87a3('0x118')],{});db[_0x87a3('0xd1')]['belongsTo'](db[_0x87a3('0x64')],{});db[_0x87a3('0xd3')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':'cascade','foreignKey':_0x87a3('0x1e0')});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0x87a3('0x1e1')});db['JscriptySessionReport'][_0x87a3('0x11d')](db['JscriptyQuestionReport'],{'foreignKey':_0x87a3('0x1e2'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0xd9')][_0x87a3('0x11d')](db[_0x87a3('0xd5')],{'foreignKey':_0x87a3('0x1e2'),'onDelete':_0x87a3('0x11a')});db['SmsQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':_0x87a3('0x16b'),'foreignKey':_0x87a3('0x16c')});db[_0x87a3('0xda')]['belongsTo'](db[_0x87a3('0x4e')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x190')],{});db[_0x87a3('0xda')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db[_0x87a3('0xda')]['belongsTo'](db[_0x87a3('0x50')],{});db[_0x87a3('0x1e3')]['hasMany'](db[_0x87a3('0xd9')],{'foreignKey':_0x87a3('0x1e4')});db['JscriptyProject'][_0x87a3('0x11d')](db[_0x87a3('0xd7')],{'foreignKey':_0x87a3('0x1e4')});db[_0x87a3('0x1e3')][_0x87a3('0x11d')](db[_0x87a3('0xd5')],{'foreignKey':_0x87a3('0x1e4')});db[_0x87a3('0xe3')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x18c'),'through':_0x87a3('0x14e')});db['Team'][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x1e5')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'through':_0x87a3('0x111'),'as':_0x87a3('0x1e6')});db[_0x87a3('0xe8')]['belongsToMany'](db[_0x87a3('0x37')],{'through':_0x87a3('0x1e7'),'as':_0x87a3('0x13c')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x64')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x87a3('0xe8')]['belongsToMany'](db['FaxQueue'],{'through':_0x87a3('0x18e'),'as':'FaxQueues'});db[_0x87a3('0xe8')]['belongsToMany'](db[_0x87a3('0x50')],{'through':_0x87a3('0x197'),'as':_0x87a3('0x13f')});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db['OpenchannelQueue'],{'through':_0x87a3('0x19c'),'as':'OpenchannelQueues'});db[_0x87a3('0xe8')][_0x87a3('0x12d')](db[_0x87a3('0x10d')],{'through':_0x87a3('0x1e8'),'as':_0x87a3('0x141')});db['Team'][_0x87a3('0x12d')](db[_0x87a3('0x1e9')],{'through':_0x87a3('0x113'),'as':_0x87a3('0x13a')});db[_0x87a3('0xeb')]['hasMany'](db[_0x87a3('0x6b')],{'as':_0x87a3('0x156'),'foreignKey':_0x87a3('0x1b2')});db['Campaign'][_0x87a3('0x11d')](db['CmHopperFinal'],{'as':_0x87a3('0x123'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x157'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x11d')](db[_0x87a3('0x6c')],{'as':_0x87a3('0x159'),'foreignKey':_0x87a3('0x1b2')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db[_0x87a3('0x25')],{'as':_0x87a3('0x25'),'foreignKey':_0x87a3('0x1ea')});db[_0x87a3('0xeb')]['belongsTo'](db[_0x87a3('0x25')],{'as':_0x87a3('0x15b'),'foreignKey':_0x87a3('0x15c')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db['Interval'],{'as':_0x87a3('0x7e'),'foreignKey':_0x87a3('0x15d')});db[_0x87a3('0xeb')][_0x87a3('0x12b')](db[_0x87a3('0xe3')],{'as':_0x87a3('0xe3'),'foreignKey':_0x87a3('0x1eb')});db[_0x87a3('0xeb')][_0x87a3('0x12d')](db['CmList'],{'as':_0x87a3('0x132'),'through':_0x87a3('0x1ec')});db[_0x87a3('0xeb')]['belongsToMany'](db[_0x87a3('0xf9')],{'as':_0x87a3('0x161'),'through':'campaigns_has_cm_blacklists'});db[_0x87a3('0xee')][_0x87a3('0x12b')](db[_0x87a3('0x62')],{'as':'ChatOfflineMessage','foreignKey':_0x87a3('0x182')});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x179')],{});db['MailTransferReport'][_0x87a3('0x12b')](db['MailInteraction'],{});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'foreignKey':_0x87a3('0x1ed'),'as':'FromAccount'});db[_0x87a3('0xf2')]['belongsTo'](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db['MailTransferReport']['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':'ToUserId','as':_0x87a3('0x1f0')});db['MailTransferReport']['belongsTo'](db[_0x87a3('0x37')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x36')],{'foreignKey':_0x87a3('0x1f1'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatMessage'],{});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db[_0x87a3('0x124')],{});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatWebsite'],{'foreignKey':_0x87a3('0x1f3'),'as':_0x87a3('0x1f4')});db['ChatTransferReport']['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0xf4')]['belongsTo'](db[_0x87a3('0x64')],{'foreignKey':_0x87a3('0x1f6'),'as':'ToQueue'});db[_0x87a3('0xf4')][_0x87a3('0x12b')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x87a3('0x1f2')});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x188')],{});db['FaxTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x126')],{});db['FaxTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'foreignKey':_0x87a3('0x1f8'),'as':_0x87a3('0x1f4')});db[_0x87a3('0x1f7')]['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1ee'),'as':'FromAgent'});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x49')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0x87a3('0x1f7')][_0x87a3('0x12b')](db[_0x87a3('0x45')],{'foreignKey':_0x87a3('0x1f9'),'as':_0x87a3('0x1f2')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x57')],{});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x55')],{});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db['OpenchannelAccount'],{'foreignKey':_0x87a3('0x1fb'),'as':_0x87a3('0x1f4')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db[_0x87a3('0x1fa')][_0x87a3('0x12b')](db['OpenchannelQueue'],{'foreignKey':_0x87a3('0x1fc'),'as':'ToQueue'});db['OpenchannelTransferReport'][_0x87a3('0x12b')](db['OpenchannelAccount'],{'foreignKey':_0x87a3('0x1fd'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['SmsMessage'],{});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4e')],{});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'foreignKey':_0x87a3('0x1fe'),'as':_0x87a3('0x1f4')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'foreignKey':'ToUserId','as':_0x87a3('0x1f0')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db['SmsQueue'],{'foreignKey':_0x87a3('0x1ff'),'as':_0x87a3('0x200')});db[_0x87a3('0xf8')][_0x87a3('0x12b')](db[_0x87a3('0x4d')],{'foreignKey':_0x87a3('0x201'),'as':_0x87a3('0x1f2')});db[_0x87a3('0xf9')]['hasMany'](db['Disposition'],{'as':_0x87a3('0x185'),'foreignKey':_0x87a3('0x175'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db['CmCustomField'],{'as':_0x87a3('0x202'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x69')],{'as':_0x87a3('0x1a9'),'onDelete':_0x87a3('0x11a'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x87a3('0x6e')],{'as':'HopperFinals','foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x70')],{'as':_0x87a3('0x203'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x11d')](db[_0x87a3('0x72')],{'as':_0x87a3('0x72'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0xf9')][_0x87a3('0x12d')](db[_0x87a3('0x17')],{'as':_0x87a3('0x204'),'through':'voice_queues_has_cm_lists'});db[_0x87a3('0xf9')][_0x87a3('0x12d')](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x133')});db[_0x87a3('0x1e9')][_0x87a3('0x11d')](db[_0x87a3('0x121')],{'as':_0x87a3('0x122'),'onDelete':_0x87a3('0x11a')});db['VoicePrefix']['belongsToMany'](db[_0x87a3('0x118')],{'as':_0x87a3('0x178'),'through':_0x87a3('0x13b')});db[_0x87a3('0x1e9')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x113'),'as':'Teams'});db['UserProfile'][_0x87a3('0x11d')](db['User'],{'as':_0x87a3('0x18c'),'foreignKey':'userProfileId'});db[_0x87a3('0xfc')][_0x87a3('0x11d')](db[_0x87a3('0xfe')],{'as':'UserProfileSections','foreignKey':_0x87a3('0x12c'),'onDelete':'cascade'});db[_0x87a3('0xfe')][_0x87a3('0x11d')](db[_0x87a3('0x100')],{'as':'Resources','foreignKey':_0x87a3('0x205'),'onDelete':_0x87a3('0x11a')});db[_0x87a3('0x14a')]['hasMany'](db[_0x87a3('0x7a')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x87a3('0x11a')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0x87a3('0x173'),'foreignKey':_0x87a3('0x206')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x108')],{'as':'Messages','foreignKey':_0x87a3('0x206')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x106')],{'as':_0x87a3('0x174')});db['WhatsappAccount'][_0x87a3('0x11d')](db[_0x87a3('0x105')],{'as':'Applications'});db[_0x87a3('0x14a')][_0x87a3('0x12b')](db[_0x87a3('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0x87a3('0x14a')]['belongsTo'](db[_0x87a3('0x7f')],{'as':_0x87a3('0x15e'),'foreignKey':_0x87a3('0x177')});db[_0x87a3('0x14a')][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x14c')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')]['belongsTo'](db[_0x87a3('0x10d')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'onDelete':_0x87a3('0x170')});db[_0x87a3('0x105')][_0x87a3('0x12b')](db[_0x87a3('0x7e')],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x15d')});db['WhatsappApplication'][_0x87a3('0x12b')](db['Tag'],{'onDelete':_0x87a3('0x170'),'foreignKey':_0x87a3('0x192')});db['WhatsappInteraction']['hasMany'](db[_0x87a3('0x108')],{'as':'Messages','onDelete':_0x87a3('0x11a'),'foreignKey':_0x87a3('0x207')});db['WhatsappInteraction'][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x206')});db[_0x87a3('0x106')][_0x87a3('0x12b')](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0x87a3('0x106')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x17b'),'foreignKey':_0x87a3('0x11b')});db['WhatsappInteraction']['belongsToMany'](db[_0x87a3('0x88')],{'through':_0x87a3('0x1c1'),'as':_0x87a3('0x17d')});db[_0x87a3('0x106')][_0x87a3('0x12d')](db[_0x87a3('0x88')],{'through':_0x87a3('0x1c1'),'as':_0x87a3('0x17e')});db[_0x87a3('0x106')]['belongsToMany'](db[_0x87a3('0x118')],{'as':'Users','through':_0x87a3('0x208'),'foreignKey':_0x87a3('0x207')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{'as':_0x87a3('0x118')});db['WhatsappMessage']['belongsTo'](db[_0x87a3('0x69')],{'onDelete':_0x87a3('0x11a'),'as':_0x87a3('0x16b')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x87a3('0x180'),'foreignKey':_0x87a3('0x207')});db[_0x87a3('0x108')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'as':_0x87a3('0x18a'),'foreignKey':_0x87a3('0x206')});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db['CmList'],{'as':_0x87a3('0x183'),'foreignKey':_0x87a3('0x175')});db[_0x87a3('0x10a')]['belongsTo'](db[_0x87a3('0x69')],{'as':'Contact','foreignKey':_0x87a3('0x16c')});db['WhatsappQueueReport'][_0x87a3('0x12b')](db[_0x87a3('0x106')],{});db[_0x87a3('0x10a')]['belongsTo'](db[_0x87a3('0x10d')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x108')],{});db[_0x87a3('0x10a')][_0x87a3('0x12b')](db[_0x87a3('0x118')],{});db['WhatsappTransferReport'][_0x87a3('0x12b')](db['WhatsappMessage'],{});db[_0x87a3('0x10c')][_0x87a3('0x12b')](db[_0x87a3('0x106')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x87a3('0x209'),'as':_0x87a3('0x1f4')});db['WhatsappTransferReport'][_0x87a3('0x12b')](db[_0x87a3('0x14a')],{'foreignKey':_0x87a3('0x20a'),'as':_0x87a3('0x1f2')});db['WhatsappTransferReport'][_0x87a3('0x12b')](db['WhatsappQueue'],{'foreignKey':_0x87a3('0x20b'),'as':'ToQueue'});db[_0x87a3('0x10c')][_0x87a3('0x12b')](db['User'],{'foreignKey':_0x87a3('0x1ee'),'as':_0x87a3('0x1ef')});db[_0x87a3('0x10c')]['belongsTo'](db[_0x87a3('0x118')],{'foreignKey':_0x87a3('0x1f5'),'as':_0x87a3('0x1f0')});db['WhatsappQueue'][_0x87a3('0x12d')](db['User'],{'as':_0x87a3('0x178'),'through':_0x87a3('0x31'),'foreignKey':_0x87a3('0x20c')});db[_0x87a3('0x10d')][_0x87a3('0x12d')](db[_0x87a3('0xe8')],{'through':_0x87a3('0x1e8'),'as':_0x87a3('0x160')});db[_0x87a3('0x116')]['belongsTo'](db[_0x87a3('0x118')],{'as':_0x87a3('0x20d'),'foreignKey':_0x87a3('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0x87a3('0x10f')]['hasOne'](db[_0x87a3('0xc6')],{'as':_0x87a3('0xc6'),'onDelete':_0x87a3('0x170')});db[_0x87a3('0x10f')]['hasOne'](db[_0x87a3('0x33')],{'as':'Imap','onDelete':'restrict'});db[_0x87a3('0x10f')][_0x87a3('0x119')](db[_0x87a3('0x16e')],{'as':_0x87a3('0x172'),'onDelete':_0x87a3('0x170')});module[_0x87a3('0x20e')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd64e=['UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../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','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','hasOne','cascade','hasMany','UserId','VoiceQueuesRt','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Interactions','List','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','MailApplication','IntervalId','TagId','MailQueueReport','ListId','Dashboard','DashboardItem','Items','FaxAccountId','Answers','Exntensions','FaxMessage','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsApplication','SmsInteractionId','sms_interaction_has_tags','ThroughTags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','CmCompany','CompanyId','CmContactHasItem','Phones','CmContactId','CmHopper','JscriptySessions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','Action','ParentId','Intervals','Extensions','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','Subject','DescriptionId','Field','FieldId','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Description','DeskAccount','int_desk_configuration_has_tags','ZohoAccount','ZohoField','ZendeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowField','FreshsalesField','ChatInternalMessage','FromId','ToId','JscriptyQuestionReport','ProjectId','team_has_sms_queues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','OpenchannelTransferReport','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','UserVoicePrefix','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','WhatsappQueueId','user','exports','sequelize','jstz','xcall','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','defaultsDeep','motion2','xC@LL1234','name','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','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','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','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','Tag','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile'];(function(_0x21b69b,_0x2b1ed3){var _0x2fc9c8=function(_0x3d73ae){while(--_0x3d73ae){_0x21b69b['push'](_0x21b69b['shift']());}};_0x2fc9c8(++_0x2b1ed3);}(_0xd64e,0x10c));var _0xed64=function(_0x528a2f,_0x563e1b){_0x528a2f=_0x528a2f-0x0;var _0xcb7083=_0xd64e[_0x528a2f];return _0xcb7083;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xed64('0x0'));var _=require('lodash');var jstz=require(_0xed64('0x1'));var timezone=jstz['determine']();config[_0xed64('0x0')]=_['defaultsDeep'](config[_0xed64('0x0')],{'database':'motion2','username':_0xed64('0x2'),'password':'xC@LL1234','options':{'host':_0xed64('0x3'),'port':0xcea,'dialect':_0xed64('0x4'),'dialectOptions':{'charset':_0xed64('0x5')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xed64('0x6')}}});config[_0xed64('0x7')]=_[_0xed64('0x8')](config[_0xed64('0x7')],{'database':_0xed64('0x9'),'username':_0xed64('0x2'),'password':_0xed64('0xa'),'options':{'host':_0xed64('0x3'),'port':0xcea,'dialect':_0xed64('0x4'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xed64('0xb')](),'define':{'charset':'utf8','collate':_0xed64('0x6')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xed64('0xc')],config[_0xed64('0x0')]['username'],config[_0xed64('0x0')]['password'],config[_0xed64('0x0')][_0xed64('0xd')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xed64('0x7')][_0xed64('0xe')],config[_0xed64('0x7')][_0xed64('0xf')],config[_0xed64('0x7')][_0xed64('0xd')])};db[_0xed64('0x10')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x12'));db[_0xed64('0x13')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x14'));db[_0xed64('0x15')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/voiceContext/voiceContext.model');db[_0xed64('0x16')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/voiceExtension/voiceExtension.model');db[_0xed64('0x17')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xed64('0x18')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x19'));db[_0xed64('0x1a')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x1b'));db['ScreenRecording']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x1c'));db[_0xed64('0x1d')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x1e'));db[_0xed64('0x1f')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x20'));db[_0xed64('0x21')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x22'));db[_0xed64('0x23')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/voiceDialReport/voiceDialReport.model');db[_0xed64('0x24')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x25'));db[_0xed64('0x26')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x27'));db[_0xed64('0x28')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x29'));db[_0xed64('0x2a')]=db[_0xed64('0x0')]['import'](_0xed64('0x2b'));db[_0xed64('0x2c')]=db[_0xed64('0x0')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0xed64('0x2d')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x2e'));db[_0xed64('0x2f')]=db[_0xed64('0x0')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xed64('0x30')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/userChatQueue/userChatQueue.model');db[_0xed64('0x31')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x32'));db[_0xed64('0x33')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x34'));db['UserSmsQueue']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x35'));db[_0xed64('0x36')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x37'));db[_0xed64('0x38')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x39'));db[_0xed64('0x3a')]=db[_0xed64('0x0')]['import'](_0xed64('0x3b'));db[_0xed64('0x3c')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x3d'));db[_0xed64('0x3e')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x3f'));db[_0xed64('0x40')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x41'));db[_0xed64('0x42')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x43'));db[_0xed64('0x44')]=db[_0xed64('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xed64('0x45')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize'][_0xed64('0x11')](_0xed64('0x46'));db['MailQueueReport']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x47'));db['Dashboard']=db[_0xed64('0x0')]['import'](_0xed64('0x48'));db['DashboardItem']=db[_0xed64('0x0')][_0xed64('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xed64('0x49')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/faxAccount/faxAccount.model');db[_0xed64('0x4a')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x4b'));db['FaxInteraction']=db['sequelize'][_0xed64('0x11')](_0xed64('0x4c'));db['FaxMessage']=db[_0xed64('0x0')][_0xed64('0x11')]('../api/faxMessage/faxMessage.model');db[_0xed64('0x4d')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x4e'));db[_0xed64('0x4f')]=db['sequelize']['import'](_0xed64('0x50'));db[_0xed64('0x51')]=db[_0xed64('0x0')]['import'](_0xed64('0x52'));db['SmsApplication']=db['sequelize'][_0xed64('0x11')](_0xed64('0x53'));db[_0xed64('0x54')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x55'));db[_0xed64('0x56')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x57'));db[_0xed64('0x58')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x59'));db[_0xed64('0x5a')]=db[_0xed64('0x0')]['import'](_0xed64('0x5b'));db[_0xed64('0x5c')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x5d'));db[_0xed64('0x5e')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x5f'));db['OpenchannelMessage']=db['sequelize']['import'](_0xed64('0x60'));db[_0xed64('0x61')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x62'));db[_0xed64('0x63')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x64'));db[_0xed64('0x65')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x66'));db[_0xed64('0x67')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x68'));db['ChatInteraction']=db['sequelize'][_0xed64('0x11')](_0xed64('0x69'));db[_0xed64('0x6a')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x6b'));db[_0xed64('0x6c')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x6d'));db[_0xed64('0x6e')]=db[_0xed64('0x0')]['import'](_0xed64('0x6f'));db[_0xed64('0x70')]=db[_0xed64('0x0')]['import'](_0xed64('0x71'));db[_0xed64('0x72')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x73'));db['CmCompany']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x74'));db['CmContact']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x75'));db['CmHopper']=db['sequelize'][_0xed64('0x11')](_0xed64('0x76'));db[_0xed64('0x77')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x78'));db['CmHopperFinal']=db[_0xed64('0x0')]['import'](_0xed64('0x79'));db[_0xed64('0x7a')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xed64('0x7b')]=db['sequelize'][_0xed64('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x7c'));db['Action']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x7d'));db[_0xed64('0x7e')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x7f'));db['CannedAnswer']=db[_0xed64('0x0')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0xed64('0x80')]=db[_0xed64('0x0')]['import'](_0xed64('0x81'));db[_0xed64('0x82')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x83'));db[_0xed64('0x84')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x85'));db[_0xed64('0x86')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x87'));db[_0xed64('0x88')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x89'));db[_0xed64('0x8a')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x8b'));db[_0xed64('0x8c')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x8d'));db[_0xed64('0x8e')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x8f'));db[_0xed64('0x90')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/tag/tag.model');db[_0xed64('0x91')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x92'));db['CmContactHasItem']=db[_0xed64('0x0')]['import'](_0xed64('0x93'));db['CmHopperAdditionalPhone']=db[_0xed64('0x0')]['import'](_0xed64('0x94'));db[_0xed64('0x95')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x96'));db['Trigger']=db['sequelize'][_0xed64('0x11')](_0xed64('0x97'));db['Variable']=db['sequelize'][_0xed64('0x11')](_0xed64('0x98'));db[_0xed64('0x99')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x9a'));db[_0xed64('0x9b')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x9c'));db[_0xed64('0x9d')]=db['sequelize']['import'](_0xed64('0x9e'));db[_0xed64('0x9f')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xa0'));db[_0xed64('0xa1')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xed64('0xa2')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/analyticMetric/analyticMetric.model');db[_0xed64('0xa3')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xed64('0xa4')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xa5'));db[_0xed64('0xa6')]=db['sequelize']['import'](_0xed64('0xa7'));db[_0xed64('0xa8')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xa9'));db[_0xed64('0xaa')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xab'));db['SugarcrmAccount']=db['sequelize'][_0xed64('0x11')](_0xed64('0xac'));db['SugarcrmConfiguration']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xad'));db[_0xed64('0xae')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xaf'));db['DeskAccount']=db[_0xed64('0x0')]['import'](_0xed64('0xb0'));db[_0xed64('0xb1')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xed64('0xb2')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xb3'));db['ZohoAccount']=db['sequelize'][_0xed64('0x11')]('../api/intZohoAccount/intZohoAccount.model');db[_0xed64('0xb4')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xb5'));db['ZohoField']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xb6'));db['ZendeskAccount']=db[_0xed64('0x0')][_0xed64('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xed64('0xb7')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xb8'));db[_0xed64('0xb9')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xba'));db[_0xed64('0xbb')]=db[_0xed64('0x0')]['import'](_0xed64('0xbc'));db[_0xed64('0xbd')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xbe'));db['FreshdeskField']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xbf'));db[_0xed64('0xc0')]=db[_0xed64('0x0')]['import'](_0xed64('0xc1'));db[_0xed64('0xc2')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xc3'));db[_0xed64('0xc4')]=db[_0xed64('0x0')]['import'](_0xed64('0xc5'));db[_0xed64('0xc6')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xc7'));db[_0xed64('0xc8')]=db['sequelize'][_0xed64('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xc9'));db[_0xed64('0xca')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xcb'));db[_0xed64('0xcc')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xcd'));db[_0xed64('0xce')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xcf'));db[_0xed64('0xd0')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd1'));db[_0xed64('0xd2')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd3'));db['FreshsalesField']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd4'));db[_0xed64('0x99')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x9a'));db[_0xed64('0xd5')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd6'));db[_0xed64('0xd7')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd8'));db['ChatInternalMessage']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xd9'));db[_0xed64('0xda')]=db[_0xed64('0x0')]['import'](_0xed64('0xdb'));db['JscriptyQuestionReport']=db['sequelize'][_0xed64('0x11')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xed64('0xdc')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xdd'));db[_0xed64('0xde')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xdf'));db['SquareReport']=db['sequelize'][_0xed64('0x11')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize'][_0xed64('0x11')](_0xed64('0xe0'));db[_0xed64('0xe1')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xe2'));db[_0xed64('0xe3')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/setting/setting.model');db[_0xed64('0xe4')]=db[_0xed64('0x0')]['import'](_0xed64('0xe5'));db[_0xed64('0xe6')]=db[_0xed64('0x0')]['import'](_0xed64('0xe7'));db[_0xed64('0xe8')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/squareRecording/squareRecording.model');db[_0xed64('0xe9')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xea'));db['Team']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xeb'));db['License']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xec'));db[_0xed64('0xed')]=db[_0xed64('0x0')]['import']('../api/campaign/campaign.model');db[_0xed64('0xee')]=db['sequelize'][_0xed64('0x11')](_0xed64('0xef'));db[_0xed64('0xf0')]=db[_0xed64('0x0')]['import'](_0xed64('0xf1'));db['Plugin']=db[_0xed64('0x0')][_0xed64('0x11')]('../api/plugin/plugin.model');db[_0xed64('0xf2')]=db['sequelize']['import'](_0xed64('0xf3'));db[_0xed64('0xf4')]=db['sequelize']['import'](_0xed64('0xf5'));db[_0xed64('0xf6')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xf7'));db['OpenchannelTransferReport']=db[_0xed64('0x0')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xf8'));db[_0xed64('0xf9')]=db[_0xed64('0x0')]['import'](_0xed64('0xfa'));db[_0xed64('0xfb')]=db[_0xed64('0x0')][_0xed64('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0xed64('0xfc')]=db['sequelize'][_0xed64('0x11')]('../api/userProfile/userProfile.model');db[_0xed64('0xfd')]=db[_0xed64('0x0')]['import']('../api/userProfileSection/userProfileSection.model');db[_0xed64('0xfe')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0xff'));db[_0xed64('0x100')]=db['sequelize'][_0xed64('0x11')](_0xed64('0x101'));db[_0xed64('0x102')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x103'));db['WhatsappApplication']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x104'));db[_0xed64('0x105')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x106'));db[_0xed64('0x107')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x108'));db[_0xed64('0x109')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x10a'));db[_0xed64('0x10b')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x10c'));db[_0xed64('0x10d')]=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x10e'));db[_0xed64('0x10f')]=db[_0xed64('0x0')]['import'](_0xed64('0x110'));db['TeamVoiceQueue']=db[_0xed64('0x0')][_0xed64('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xed64('0x111')]=db[_0xed64('0x0')]['import'](_0xed64('0x112'));db['UserVoicePrefix']=db[_0xed64('0x0')][_0xed64('0x11')](_0xed64('0x113'));db[_0xed64('0x114')]=db[_0xed64('0x0')]['import']('../api/user-setting/user-setting.model');db['User'][_0xed64('0x115')](db[_0xed64('0x1d')],{'as':_0xed64('0x1d'),'onDelete':'cascade','foreignKey':'UserId'});db[_0xed64('0x10')][_0xed64('0x115')](db[_0xed64('0x114')],{'as':'userSetting','onDelete':_0xed64('0x116'),'foreignKey':'UserId'});db['User'][_0xed64('0x117')](db[_0xed64('0x1a')],{'as':'Recordings','foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db['UserVoiceQueueRt'],{'as':_0xed64('0x119'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')]['hasMany'](db[_0xed64('0x16')],{'as':'Extensions','onDelete':_0xed64('0x116'),'hooks':!![]});db['User'][_0xed64('0x117')](db[_0xed64('0x11a')],{'as':_0xed64('0x11b'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db['CmHopperHistory'],{'as':_0xed64('0x11c'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db[_0xed64('0x7b')],{'as':_0xed64('0x7b'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db[_0xed64('0x5e')],{'as':_0xed64('0x11d'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db[_0xed64('0x11e')],{'as':_0xed64('0x11f'),'foreignKey':'UserId'});db[_0xed64('0x10')][_0xed64('0x117')](db[_0xed64('0x54')],{'as':_0xed64('0x120'),'foreignKey':_0xed64('0x118')});db['User'][_0xed64('0x117')](db[_0xed64('0x121')],{'as':_0xed64('0x122'),'foreignKey':_0xed64('0x118')});db['User'][_0xed64('0x117')](db[_0xed64('0x44')],{'as':_0xed64('0x123'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x10')][_0xed64('0x117')](db[_0xed64('0x105')],{'as':_0xed64('0x124'),'foreignKey':'UserId'});db['User'][_0xed64('0x117')](db[_0xed64('0x100')],{'as':_0xed64('0x125'),'foreignKey':'SenderId'});db[_0xed64('0x10')][_0xed64('0x126')](db['UserProfile'],{'as':_0xed64('0xfc'),'foreignKey':'userProfileId'});db['User'][_0xed64('0x127')](db[_0xed64('0x70')],{'as':_0xed64('0x128'),'through':_0xed64('0x129')});db['User'][_0xed64('0x127')](db[_0xed64('0x12a')],{'as':_0xed64('0x12b'),'through':_0xed64('0x12c')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0xf9')],{'as':_0xed64('0x12d'),'through':'cm_user_has_lists'});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':_0xed64('0x12f')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x44')],{'as':_0xed64('0x123'),'through':_0xed64('0x130')});db['User'][_0xed64('0x127')](db['ChatInteraction'],{'as':_0xed64('0x11f'),'through':_0xed64('0x131')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x121')],{'as':_0xed64('0x122'),'through':_0xed64('0x132')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x54')],{'as':'SmsInteractions','through':_0xed64('0x133')});db[_0xed64('0x10')][_0xed64('0x127')](db['OpenchannelInteraction'],{'as':_0xed64('0x11d'),'through':_0xed64('0x134')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x105')],{'as':_0xed64('0x124'),'through':'user_has_whatsapp_interactions'});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x18')],{'as':_0xed64('0x135'),'through':_0xed64('0x2f'),'required':![]});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0xfb')],{'as':_0xed64('0x136'),'through':'UserVoicePrefix','required':![]});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x40')],{'as':_0xed64('0x137'),'through':_0xed64('0x31'),'required':![]});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x6e')],{'as':_0xed64('0x138'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0xed64('0x127')](db[_0xed64('0x4d')],{'as':_0xed64('0x139'),'through':_0xed64('0x33'),'required':![]});db['User'][_0xed64('0x127')](db[_0xed64('0x58')],{'as':_0xed64('0x13a'),'through':_0xed64('0x13b'),'required':![]});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x61')],{'as':'OpenchannelQueues','through':_0xed64('0x36'),'required':![]});db[_0xed64('0x10')]['belongsToMany'](db[_0xed64('0x10d')],{'as':_0xed64('0x13c'),'through':_0xed64('0x38'),'required':![]});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0xf9')],{'through':_0xed64('0x13d')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x63')],{'as':_0xed64('0x13e'),'through':_0xed64('0x13f')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x49')],{'as':_0xed64('0x140'),'through':_0xed64('0x141')});db[_0xed64('0x10')][_0xed64('0x127')](db['MailAccount'],{'as':'MailAccounts','through':_0xed64('0x142')});db[_0xed64('0x10')][_0xed64('0x127')](db[_0xed64('0x5a')],{'as':_0xed64('0x143'),'through':'user_has_openchannel_accounts'});db['User'][_0xed64('0x127')](db[_0xed64('0x51')],{'as':_0xed64('0x144'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db[_0xed64('0x102')],{'as':_0xed64('0x145'),'through':_0xed64('0x146')});db[_0xed64('0x10')][_0xed64('0x127')](db['SquareProject'],{'as':_0xed64('0x147'),'through':_0xed64('0x148')});db['VoiceChanSpy'][_0xed64('0x117')](db['VoiceExtension'],{'as':_0xed64('0x149'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x14a')});db[_0xed64('0x15')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xed64('0x116')});db[_0xed64('0x16')][_0xed64('0x117')](db[_0xed64('0x16')],{'as':_0xed64('0x14b'),'onDelete':'cascade'});db[_0xed64('0x17')]['belongsToMany'](db[_0xed64('0x8e')],{'as':_0xed64('0x14c'),'through':_0xed64('0x14d')});db[_0xed64('0x18')]['hasMany'](db[_0xed64('0x2d')],{'as':_0xed64('0x14e'),'foreignKey':'VoiceQueueId'});db[_0xed64('0x18')]['hasMany'](db['CmHopper'],{'as':_0xed64('0x14f'),'foreignKey':_0xed64('0x150')});db[_0xed64('0x18')][_0xed64('0x117')](db[_0xed64('0x11a')],{'as':_0xed64('0x11b'),'foreignKey':_0xed64('0x150')});db[_0xed64('0x18')][_0xed64('0x117')](db[_0xed64('0x7a')],{'as':_0xed64('0x151'),'foreignKey':_0xed64('0x150')});db[_0xed64('0x18')]['hasMany'](db['ReportAgentPreview'],{'as':_0xed64('0x7b'),'foreignKey':_0xed64('0x150')});db[_0xed64('0x18')][_0xed64('0x117')](db[_0xed64('0x77')],{'as':_0xed64('0x152'),'foreignKey':_0xed64('0x150')});db[_0xed64('0x18')][_0xed64('0x117')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xed64('0x150')});db[_0xed64('0x18')][_0xed64('0x126')](db[_0xed64('0x2a')],{'as':_0xed64('0x2a'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db[_0xed64('0x2a')],{'as':_0xed64('0x153'),'foreignKey':_0xed64('0x154')});db[_0xed64('0x18')][_0xed64('0x126')](db['Interval'],{'as':_0xed64('0x84'),'foreignKey':'IntervalId'});db[_0xed64('0x18')][_0xed64('0x126')](db[_0xed64('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xed64('0x155')});db[_0xed64('0x18')][_0xed64('0x127')](db[_0xed64('0xf9')],{'as':_0xed64('0x12d'),'through':_0xed64('0x156')});db['VoiceQueue'][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x2f')});db[_0xed64('0x18')][_0xed64('0x127')](db[_0xed64('0x12e')],{'as':_0xed64('0x158'),'through':'TeamVoiceQueue'});db[_0xed64('0x18')][_0xed64('0x127')](db[_0xed64('0xf9')],{'as':'BlackLists','through':_0xed64('0x159')});db[_0xed64('0x1a')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':_0xed64('0x10'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x15a')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':_0xed64('0x10'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x1d')][_0xed64('0x117')](db['VoiceMailMessage'],{'as':_0xed64('0x15b'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x15c'),'sourceKey':_0xed64('0x15d')});db['VoiceMailMessage']['belongsTo'](db[_0xed64('0x1d')],{'foreignKey':_0xed64('0x15c'),'targetKey':_0xed64('0x15d')});db[_0xed64('0x21')][_0xed64('0x117')](db[_0xed64('0x26')],{'as':_0xed64('0x15e'),'foreignKey':_0xed64('0x15f'),'constraints':![]});db[_0xed64('0x21')][_0xed64('0x117')](db['VoiceAgentReport'],{'as':_0xed64('0x160'),'foreignKey':_0xed64('0x15f'),'constraints':![]});db[_0xed64('0x21')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':_0xed64('0x10'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x21')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db['MailServerIn'][_0xed64('0x126')](db[_0xed64('0x3e')],{'as':_0xed64('0x3e'),'foreignKey':'MailAccountId'});db[_0xed64('0x3a')]['belongsTo'](db[_0xed64('0x10f')],{'as':'CloudProvider','foreignKey':_0xed64('0x163'),'onDelete':_0xed64('0x164')});db['MailServerOut'][_0xed64('0x126')](db[_0xed64('0x3e')],{'as':_0xed64('0x3e'),'foreignKey':_0xed64('0x165')});db[_0xed64('0x3c')][_0xed64('0x126')](db[_0xed64('0x10f')],{'as':_0xed64('0x10f'),'foreignKey':_0xed64('0x163'),'onDelete':_0xed64('0x164')});db[_0xed64('0x3e')][_0xed64('0x115')](db[_0xed64('0x3a')],{'as':_0xed64('0x166'),'onDelete':_0xed64('0x116')});db['MailAccount'][_0xed64('0x115')](db[_0xed64('0x3c')],{'as':_0xed64('0x167'),'onDelete':_0xed64('0x116')});db[_0xed64('0x3e')][_0xed64('0x117')](db[_0xed64('0x80')],{'as':_0xed64('0x168'),'foreignKey':_0xed64('0x165'),'onDelete':'cascade'});db[_0xed64('0x3e')]['hasMany'](db[_0xed64('0x169')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xed64('0x3e')]['hasMany'](db[_0xed64('0x45')],{'as':_0xed64('0x15b'),'foreignKey':_0xed64('0x165')});db['MailAccount'][_0xed64('0x117')](db[_0xed64('0x44')],{'as':_0xed64('0x16a')});db[_0xed64('0x3e')][_0xed64('0x117')](db['MailApplication'],{'as':'Applications'});db[_0xed64('0x3e')]['belongsTo'](db['CmList'],{'as':_0xed64('0x16b'),'foreignKey':'ListId'});db[_0xed64('0x3e')][_0xed64('0x126')](db[_0xed64('0x95')],{'as':'Template','foreignKey':_0xed64('0x16c')});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0xed64('0x16d'),'foreignKey':_0xed64('0x155')});db[_0xed64('0x3e')]['belongsToMany'](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':'user_has_mail_accounts'});db[_0xed64('0x40')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x31')});db['MailQueue'][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':_0xed64('0x16e'),'as':_0xed64('0x158')});db[_0xed64('0x44')][_0xed64('0x117')](db[_0xed64('0x45')],{'as':'Messages','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x16f')});db[_0xed64('0x44')]['belongsTo'](db[_0xed64('0x3e')],{'as':'Account','foreignKey':_0xed64('0x165')});db[_0xed64('0x44')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':'ContactId'});db[_0xed64('0x44')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xed64('0x44')]['belongsToMany'](db['Tag'],{'through':_0xed64('0x170'),'as':_0xed64('0x171')});db[_0xed64('0x44')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xed64('0x44')]['belongsToMany'](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x130'),'foreignKey':_0xed64('0x16f')});db[_0xed64('0x45')][_0xed64('0x117')](db[_0xed64('0xf0')],{'as':_0xed64('0x173'),'onDelete':_0xed64('0x116')});db[_0xed64('0x45')][_0xed64('0x126')](db['User'],{'as':_0xed64('0x10')});db[_0xed64('0x45')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x161')});db[_0xed64('0x45')]['belongsTo'](db[_0xed64('0x44')],{'as':_0xed64('0x174'),'foreignKey':_0xed64('0x16f')});db[_0xed64('0x45')][_0xed64('0x126')](db[_0xed64('0x3e')],{'as':'Account','foreignKey':_0xed64('0x165')});db['MailMessage']['belongsTo'](db[_0xed64('0x63')],{'as':_0xed64('0x63'),'foreignKey':'ChatWebsiteId'});db[_0xed64('0x45')][_0xed64('0x126')](db[_0xed64('0x6c')],{'as':_0xed64('0x6c'),'foreignKey':'ChatOfflineMessageId'});db[_0xed64('0x175')][_0xed64('0x126')](db['User'],{'onDelete':_0xed64('0x164')});db[_0xed64('0x175')]['belongsTo'](db[_0xed64('0x40')],{'onDelete':'restrict'});db[_0xed64('0x175')][_0xed64('0x126')](db[_0xed64('0x3e')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x175')][_0xed64('0x126')](db[_0xed64('0x84')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x176')});db[_0xed64('0x175')][_0xed64('0x126')](db[_0xed64('0x90')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db[_0xed64('0x178')]['belongsTo'](db[_0xed64('0x3e')],{});db['MailQueueReport']['belongsTo'](db[_0xed64('0xf9')],{'as':'List','foreignKey':_0xed64('0x179')});db['MailQueueReport'][_0xed64('0x126')](db['CmContact'],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db['MailQueueReport'][_0xed64('0x126')](db['MailInteraction'],{});db[_0xed64('0x178')]['belongsTo'](db[_0xed64('0x45')],{});db['MailQueueReport']['belongsTo'](db[_0xed64('0x10')],{});db['MailQueueReport']['belongsTo'](db[_0xed64('0x40')],{});db[_0xed64('0x17a')]['hasMany'](db[_0xed64('0x17b')],{'as':_0xed64('0x17c'),'onDelete':'cascade'});db[_0xed64('0x49')][_0xed64('0x117')](db[_0xed64('0x80')],{'as':'Dispositions','foreignKey':_0xed64('0x17d'),'onDelete':_0xed64('0x116')});db[_0xed64('0x49')][_0xed64('0x117')](db[_0xed64('0x169')],{'as':_0xed64('0x17e'),'foreignKey':_0xed64('0x17d')});db[_0xed64('0x49')]['hasMany'](db[_0xed64('0x121')],{'as':_0xed64('0x16a')});db[_0xed64('0x49')]['hasMany'](db[_0xed64('0x4a')],{'as':_0xed64('0x14b')});db[_0xed64('0x49')][_0xed64('0x117')](db[_0xed64('0x16')],{'as':_0xed64('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0xed64('0x117')](db[_0xed64('0x180')],{'as':'Messages'});db['FaxAccount'][_0xed64('0x126')](db[_0xed64('0x2a')],{'as':_0xed64('0x2a')});db[_0xed64('0x49')]['belongsTo'](db[_0xed64('0xf9')],{'as':'List','foreignKey':_0xed64('0x179')});db['FaxAccount'][_0xed64('0x126')](db['Pause'],{'as':_0xed64('0x16d'),'foreignKey':_0xed64('0x155')});db[_0xed64('0x49')]['belongsToMany'](db['User'],{'as':_0xed64('0x157'),'through':_0xed64('0x141')});db[_0xed64('0x4a')][_0xed64('0x126')](db[_0xed64('0x10')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x4a')][_0xed64('0x126')](db[_0xed64('0x4d')],{'onDelete':'restrict'});db['FaxApplication'][_0xed64('0x126')](db[_0xed64('0x49')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x4a')]['belongsTo'](db['Tag'],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db['FaxInteraction'][_0xed64('0x117')](db[_0xed64('0x180')],{'as':_0xed64('0x15b'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x181')});db[_0xed64('0x121')][_0xed64('0x126')](db[_0xed64('0x49')],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x17d')});db['FaxInteraction'][_0xed64('0x126')](db['CmContact'],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db['FaxInteraction'][_0xed64('0x126')](db['User'],{'as':_0xed64('0x183'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x121')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction'][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x184'),'as':'ThroughTags'});db['FaxInteraction'][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x132'),'foreignKey':_0xed64('0x181')});db[_0xed64('0x180')][_0xed64('0x126')](db['User'],{'onDelete':_0xed64('0x116'),'as':'User'});db[_0xed64('0x180')][_0xed64('0x126')](db[_0xed64('0x121')],{'as':_0xed64('0x174'),'foreignKey':_0xed64('0x181')});db[_0xed64('0x180')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':'cascade','as':_0xed64('0x161')});db[_0xed64('0x180')][_0xed64('0x126')](db[_0xed64('0xf0')],{'as':_0xed64('0xf0'),'foreignKey':_0xed64('0x185')});db['FaxMessage'][_0xed64('0x126')](db[_0xed64('0x49')],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x17d')});db[_0xed64('0x4d')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':'UserFaxQueue'});db[_0xed64('0x4d')]['belongsToMany'](db[_0xed64('0x12e')],{'through':_0xed64('0x186'),'as':_0xed64('0x158')});db[_0xed64('0x4f')][_0xed64('0x126')](db[_0xed64('0x49')],{});db[_0xed64('0x4f')][_0xed64('0x126')](db['CmList'],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179')});db[_0xed64('0x4f')][_0xed64('0x126')](db['CmContact'],{'as':'Contact','foreignKey':_0xed64('0x162')});db[_0xed64('0x4f')]['belongsTo'](db[_0xed64('0x121')],{});db[_0xed64('0x4f')][_0xed64('0x126')](db[_0xed64('0x180')],{});db[_0xed64('0x4f')][_0xed64('0x126')](db[_0xed64('0x10')],{});db[_0xed64('0x4f')][_0xed64('0x126')](db[_0xed64('0x4d')],{});db[_0xed64('0x51')][_0xed64('0x117')](db[_0xed64('0x80')],{'as':'Dispositions','foreignKey':_0xed64('0x187'),'onDelete':_0xed64('0x116')});db[_0xed64('0x51')][_0xed64('0x117')](db[_0xed64('0x169')],{'as':'Answers','foreignKey':_0xed64('0x187')});db['SmsAccount']['hasMany'](db[_0xed64('0x56')],{'as':_0xed64('0x15b'),'foreignKey':_0xed64('0x187')});db['SmsAccount']['hasMany'](db[_0xed64('0x54')],{'as':_0xed64('0x16a')});db[_0xed64('0x51')]['hasMany'](db['SmsApplication'],{'as':_0xed64('0x14b')});db[_0xed64('0x51')][_0xed64('0x126')](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':'ListId'});db[_0xed64('0x51')][_0xed64('0x126')](db[_0xed64('0x86')],{'as':_0xed64('0x16d'),'foreignKey':_0xed64('0x155')});db['SmsAccount'][_0xed64('0x127')](db[_0xed64('0x10')],{'as':'Agents','through':_0xed64('0x188')});db[_0xed64('0x189')]['belongsTo'](db[_0xed64('0x10')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x189')]['belongsTo'](db[_0xed64('0x58')],{'onDelete':'restrict'});db['SmsApplication'][_0xed64('0x126')](db[_0xed64('0x51')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x189')]['belongsTo'](db[_0xed64('0x84')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x176')});db[_0xed64('0x189')][_0xed64('0x126')](db[_0xed64('0x90')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db[_0xed64('0x54')][_0xed64('0x117')](db[_0xed64('0x56')],{'as':_0xed64('0x15b'),'onDelete':'cascade','foreignKey':_0xed64('0x18a')});db['SmsInteraction']['belongsTo'](db[_0xed64('0x51')],{'as':'Account','foreignKey':_0xed64('0x187')});db[_0xed64('0x54')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':'ContactId'});db[_0xed64('0x54')][_0xed64('0x126')](db['User'],{'as':_0xed64('0x183'),'foreignKey':_0xed64('0x118')});db[_0xed64('0x54')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x18b'),'as':_0xed64('0x171')});db[_0xed64('0x54')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x18b'),'as':_0xed64('0x18c')});db[_0xed64('0x54')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x133'),'foreignKey':_0xed64('0x18a')});db['SmsMessage']['belongsTo'](db[_0xed64('0x10')],{'as':_0xed64('0x10')});db[_0xed64('0x56')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':'cascade','as':'Contact'});db[_0xed64('0x56')][_0xed64('0x126')](db[_0xed64('0x54')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x174'),'foreignKey':'SmsInteractionId'});db[_0xed64('0x56')][_0xed64('0x126')](db['SmsAccount'],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x187')});db[_0xed64('0x58')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x13b'),'foreignKey':_0xed64('0x18d')});db[_0xed64('0x58')][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':'team_has_sms_queues','as':_0xed64('0x158')});db['OpenchannelAccount']['hasMany'](db[_0xed64('0x80')],{'as':'Dispositions','foreignKey':_0xed64('0x18e'),'onDelete':_0xed64('0x116')});db['OpenchannelAccount'][_0xed64('0x117')](db[_0xed64('0x169')],{'as':_0xed64('0x17e'),'foreignKey':_0xed64('0x18e')});db[_0xed64('0x5a')][_0xed64('0x117')](db[_0xed64('0x5e')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xed64('0x5a')]['hasMany'](db['OpenchannelMessage'],{'as':_0xed64('0x15b'),'foreignKey':'OpenchannelAccountId'});db[_0xed64('0x5a')]['hasMany'](db[_0xed64('0x5c')],{'as':_0xed64('0x14b'),'foreignKey':'OpenchannelAccountId'});db[_0xed64('0x5a')]['belongsTo'](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179')});db['OpenchannelAccount'][_0xed64('0x126')](db[_0xed64('0x86')],{'as':_0xed64('0x16d'),'foreignKey':_0xed64('0x155')});db['OpenchannelAccount']['belongsToMany'](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x18f')});db[_0xed64('0x5c')][_0xed64('0x126')](db['User'],{'onDelete':'restrict'});db[_0xed64('0x5c')][_0xed64('0x126')](db['OpenchannelQueue'],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x190')});db[_0xed64('0x5c')][_0xed64('0x126')](db['OpenchannelAccount'],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x18e')});db[_0xed64('0x5c')]['belongsTo'](db[_0xed64('0x84')],{'onDelete':'restrict','foreignKey':_0xed64('0x176')});db[_0xed64('0x5c')][_0xed64('0x126')](db[_0xed64('0x90')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db['OpenchannelInteraction'][_0xed64('0x117')](db[_0xed64('0x191')],{'as':_0xed64('0x15b'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x192')});db[_0xed64('0x5e')][_0xed64('0x126')](db[_0xed64('0x5a')],{'as':_0xed64('0x182'),'foreignKey':'OpenchannelAccountId'});db[_0xed64('0x5e')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x5e')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':'Owner','foreignKey':'UserId'});db[_0xed64('0x5e')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':'openchannel_interaction_has_tags','as':_0xed64('0x171')});db[_0xed64('0x5e')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x193'),'as':_0xed64('0x18c')});db[_0xed64('0x5e')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x134'),'foreignKey':_0xed64('0x192')});db[_0xed64('0x191')]['belongsTo'](db[_0xed64('0x10')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x10')});db[_0xed64('0x191')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x161')});db[_0xed64('0x191')]['belongsTo'](db[_0xed64('0x5e')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x174'),'foreignKey':'OpenchannelInteractionId'});db[_0xed64('0x191')][_0xed64('0x126')](db[_0xed64('0xf0')],{'as':_0xed64('0xf0'),'foreignKey':_0xed64('0x185')});db[_0xed64('0x191')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xed64('0x18e')});db[_0xed64('0x61')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x36'),'foreignKey':_0xed64('0x190')});db[_0xed64('0x61')][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0xed64('0x117')](db[_0xed64('0x80')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0xed64('0x116')});db[_0xed64('0x63')][_0xed64('0x117')](db[_0xed64('0x169')],{'as':_0xed64('0x17e'),'foreignKey':_0xed64('0x194')});db[_0xed64('0x63')][_0xed64('0x117')](db[_0xed64('0x72')],{'as':_0xed64('0x195')});db['ChatWebsite'][_0xed64('0x117')](db[_0xed64('0x11e')],{'as':_0xed64('0x16a')});db[_0xed64('0x63')]['hasMany'](db[_0xed64('0x67')],{'as':_0xed64('0x14b')});db[_0xed64('0x63')][_0xed64('0x117')](db[_0xed64('0x6a')],{'as':_0xed64('0x15b')});db['ChatWebsite']['belongsTo'](db[_0xed64('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0xed64('0x63')][_0xed64('0x126')](db[_0xed64('0x84')],{'as':_0xed64('0x84'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0xed64('0x126')](db['MailAccount'],{'as':_0xed64('0x3e'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0xed64('0x126')](db[_0xed64('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0xed64('0x155')});db[_0xed64('0x63')]['belongsToMany'](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x13f')});db[_0xed64('0x65')][_0xed64('0x126')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xed64('0x126')](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179')});db[_0xed64('0x65')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x65')][_0xed64('0x126')](db[_0xed64('0x5e')],{});db[_0xed64('0x65')][_0xed64('0x126')](db[_0xed64('0x191')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xed64('0x10')],{});db[_0xed64('0x65')][_0xed64('0x126')](db[_0xed64('0x61')],{});db[_0xed64('0x67')]['belongsTo'](db[_0xed64('0x10')],{'as':_0xed64('0x196'),'foreignKey':_0xed64('0x118'),'onDelete':_0xed64('0x164')});db[_0xed64('0x67')]['belongsTo'](db[_0xed64('0x6e')],{'as':_0xed64('0x197'),'foreignKey':_0xed64('0x198'),'onDelete':_0xed64('0x164')});db[_0xed64('0x67')][_0xed64('0x126')](db[_0xed64('0x63')],{'as':_0xed64('0x199'),'foreignKey':'ChatWebsiteId','onDelete':_0xed64('0x164')});db[_0xed64('0x67')][_0xed64('0x126')](db[_0xed64('0x90')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db[_0xed64('0x11e')]['hasMany'](db[_0xed64('0x6a')],{'as':_0xed64('0x15b'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x19a')});db[_0xed64('0x11e')][_0xed64('0x126')](db[_0xed64('0x63')],{'as':'Account','foreignKey':_0xed64('0x194')});db[_0xed64('0x11e')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x11e')][_0xed64('0x126')](db[_0xed64('0x10')],{'as':_0xed64('0x183'),'foreignKey':_0xed64('0x118')});db['ChatInteraction'][_0xed64('0x127')](db['Tag'],{'through':_0xed64('0x19b'),'as':_0xed64('0x171')});db[_0xed64('0x11e')][_0xed64('0x127')](db['Tag'],{'through':_0xed64('0x19b'),'as':_0xed64('0x18c')});db[_0xed64('0x11e')][_0xed64('0x127')](db['User'],{'as':_0xed64('0x172'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0xed64('0x6a')][_0xed64('0x126')](db['User'],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x10')});db[_0xed64('0x6a')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':_0xed64('0x116'),'as':'Contact','foreignKey':'ContactId'});db[_0xed64('0x6a')][_0xed64('0x126')](db[_0xed64('0x11e')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x174'),'foreignKey':_0xed64('0x19a')});db[_0xed64('0x6a')][_0xed64('0x126')](db[_0xed64('0xf0')],{'as':_0xed64('0xf0'),'foreignKey':'AttachmentId'});db[_0xed64('0x6a')][_0xed64('0x126')](db[_0xed64('0x63')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xed64('0x6c')][_0xed64('0x117')](db[_0xed64('0xf0')],{'as':_0xed64('0x173'),'foreignKey':_0xed64('0x19c'),'onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x6c')][_0xed64('0x126')](db['CmContact'],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x6c')][_0xed64('0x126')](db[_0xed64('0x63')],{'as':'Account','foreignKey':_0xed64('0x194')});db[_0xed64('0x6e')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x30'),'hooks':!![]});db[_0xed64('0x6e')][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':_0xed64('0x19d'),'as':_0xed64('0x158')});db[_0xed64('0x70')][_0xed64('0x117')](db['ChatInternalMessage'],{'as':_0xed64('0x15b'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xed64('0x70')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x14e'),'through':_0xed64('0x129')});db[_0xed64('0x72')]['belongsTo'](db[_0xed64('0x63')],{'as':_0xed64('0x199'),'foreignKey':_0xed64('0x194')});db[_0xed64('0x19e')][_0xed64('0x117')](db[_0xed64('0x12a')],{'as':'Contacts','foreignKey':_0xed64('0x19f')});db[_0xed64('0x12a')][_0xed64('0x117')](db[_0xed64('0x1a0')],{'as':_0xed64('0x1a1'),'foreignKey':_0xed64('0x1a2')});db[_0xed64('0x12a')]['hasMany'](db[_0xed64('0x1a3')],{'as':_0xed64('0x14f'),'foreignKey':'ContactId'});db['CmContact'][_0xed64('0x117')](db[_0xed64('0x11a')],{'as':'HopperFinals','foreignKey':_0xed64('0x162')});db[_0xed64('0x12a')][_0xed64('0x117')](db['CmHopperHistory'],{'as':_0xed64('0x151'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x12a')][_0xed64('0x117')](db[_0xed64('0x7b')],{'as':_0xed64('0x7b'),'foreignKey':_0xed64('0x162')});db[_0xed64('0x12a')][_0xed64('0x117')](db['JscriptySessionReport'],{'as':_0xed64('0x1a4'),'foreignKey':_0xed64('0x162')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0xed64('0x11d'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xed64('0x117')](db[_0xed64('0x11e')],{'as':_0xed64('0x11f'),'foreignKey':_0xed64('0x162'),'onDelete':_0xed64('0x164')});db[_0xed64('0x12a')][_0xed64('0x117')](db['SmsInteraction'],{'as':_0xed64('0x120'),'foreignKey':_0xed64('0x162'),'onDelete':_0xed64('0x164')});db[_0xed64('0x12a')][_0xed64('0x117')](db[_0xed64('0x121')],{'as':'FaxInteractions','foreignKey':_0xed64('0x162'),'onDelete':_0xed64('0x164')});db[_0xed64('0x12a')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xed64('0x164')});db[_0xed64('0x12a')][_0xed64('0x126')](db[_0xed64('0x19e')],{'as':_0xed64('0x1a5'),'foreignKey':_0xed64('0x19f')});db[_0xed64('0x12a')][_0xed64('0x126')](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179'),'onDelete':'cascade'});db[_0xed64('0x12a')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x12c')});db[_0xed64('0x12a')][_0xed64('0x127')](db['Tag'],{'as':_0xed64('0x171'),'through':'cm_contact_has_tags'});db[_0xed64('0x12a')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x1a6'),'as':_0xed64('0x18c')});db[_0xed64('0x1a3')][_0xed64('0x117')](db[_0xed64('0x1a7')],{'as':_0xed64('0x1a8'),'foreignKey':_0xed64('0x1a9')});db[_0xed64('0x1a3')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162'),'onDelete':'cascade'});db[_0xed64('0x1a3')]['belongsTo'](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179'),'onDelete':_0xed64('0x116')});db['CmHopper'][_0xed64('0x126')](db[_0xed64('0x10')],{'as':_0xed64('0x196'),'foreignKey':'UserId'});db[_0xed64('0x1a3')]['belongsTo'](db[_0xed64('0x18')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xed64('0x116')});db[_0xed64('0x1a3')][_0xed64('0x126')](db[_0xed64('0xed')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xed64('0x116')});db[_0xed64('0x1a3')]['belongsTo'](db[_0xed64('0x10')],{'as':_0xed64('0x183'),'foreignKey':_0xed64('0x1aa')});db[_0xed64('0x77')]['belongsTo'](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':'ContactId','onDelete':_0xed64('0x116')});db[_0xed64('0x77')]['belongsTo'](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xed64('0x77')][_0xed64('0x126')](db['VoiceQueue'],{'as':_0xed64('0x197'),'foreignKey':_0xed64('0x150'),'onDelete':'cascade'});db[_0xed64('0x77')][_0xed64('0x126')](db[_0xed64('0xed')],{'as':_0xed64('0xed'),'foreignKey':_0xed64('0x1ab'),'onDelete':_0xed64('0x116')});db[_0xed64('0x7e')][_0xed64('0x117')](db['Condition'],{'as':{'plural':_0xed64('0x1ac'),'singular':_0xed64('0x1ad')},'foreignKey':_0xed64('0x1ae'),'onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x7e')][_0xed64('0x117')](db['Condition'],{'as':{'plural':_0xed64('0x1af'),'singular':_0xed64('0x1b0')},'foreignKey':'AutomationAnyId','onDelete':_0xed64('0x116'),'hooks':!![]});db['Automation'][_0xed64('0x117')](db[_0xed64('0x1b1')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x80')]['hasMany'](db[_0xed64('0x80')],{'as':_0xed64('0x168'),'foreignKey':_0xed64('0x1b2'),'onDelete':'cascade'});db[_0xed64('0x84')][_0xed64('0x117')](db[_0xed64('0x84')],{'as':_0xed64('0x1b3'),'foreignKey':_0xed64('0x176'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xed64('0x84')][_0xed64('0x117')](db[_0xed64('0x16')],{'as':_0xed64('0x1b4'),'foreignKey':'IntervalId','onDelete':_0xed64('0x164')});db[_0xed64('0x84')][_0xed64('0x117')](db[_0xed64('0x175')],{'as':'MailApplications','foreignKey':_0xed64('0x176')});db[_0xed64('0x84')][_0xed64('0x117')](db['ChatApplication'],{'as':_0xed64('0x1b5'),'foreignKey':_0xed64('0x176')});db['Interval'][_0xed64('0x117')](db[_0xed64('0x4a')],{'as':_0xed64('0x1b6'),'foreignKey':_0xed64('0x176')});db[_0xed64('0x84')][_0xed64('0x117')](db['SmsApplication'],{'as':_0xed64('0x1b7'),'foreignKey':_0xed64('0x176')});db[_0xed64('0x8c')][_0xed64('0x126')](db[_0xed64('0x3e')],{});db[_0xed64('0x8c')][_0xed64('0x126')](db[_0xed64('0x9f')],{'foreignKey':_0xed64('0x1b8')});db['Schedule']['belongsTo'](db[_0xed64('0x9d')],{'foreignKey':_0xed64('0x1b9')});db[_0xed64('0x8e')][_0xed64('0x127')](db[_0xed64('0x17')],{'as':_0xed64('0x1ba'),'through':_0xed64('0x14d'),'onDelete':_0xed64('0x164')});db[_0xed64('0x90')][_0xed64('0x127')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xed64('0x90')][_0xed64('0x127')](db['ChatInteraction'],{'through':_0xed64('0x19b')});db[_0xed64('0x90')][_0xed64('0x127')](db[_0xed64('0x44')],{'through':'mail_interaction_has_tags'});db[_0xed64('0x90')]['belongsToMany'](db[_0xed64('0x54')],{'through':_0xed64('0x18b')});db[_0xed64('0x90')][_0xed64('0x127')](db['FaxInteraction'],{'through':_0xed64('0x184')});db[_0xed64('0x90')][_0xed64('0x127')](db[_0xed64('0x5e')],{'through':_0xed64('0x193')});db[_0xed64('0x90')][_0xed64('0x127')](db[_0xed64('0x105')],{'through':_0xed64('0x1bb')});db['CmContactHasItem'][_0xed64('0x126')](db[_0xed64('0x91')],{'as':_0xed64('0x1bc'),'foreignKey':_0xed64('0x1bd')});db['CmHopperAdditionalPhone']['belongsTo'](db[_0xed64('0x1a3')],{'as':'Hopper','foreignKey':_0xed64('0x1a9')});db[_0xed64('0x1a0')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':'CmContactId'});db[_0xed64('0x1be')][_0xed64('0x117')](db[_0xed64('0x82')],{'as':{'plural':_0xed64('0x1bf'),'singular':'AllCondition'},'foreignKey':_0xed64('0x1c0'),'onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x1be')][_0xed64('0x117')](db[_0xed64('0x82')],{'as':{'plural':_0xed64('0x1c1'),'singular':_0xed64('0x1c2')},'foreignKey':_0xed64('0x1c3'),'onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x1be')][_0xed64('0x117')](db['Action'],{'as':'Actions','foreignKey':_0xed64('0x1c4'),'onDelete':_0xed64('0x116'),'hooks':!![]});db[_0xed64('0x9d')][_0xed64('0x117')](db[_0xed64('0xa3')],{'as':'Fields','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1b9'),'hooks':!![]});db['AnalyticDefaultReport'][_0xed64('0x117')](db[_0xed64('0xa3')],{'as':_0xed64('0x1c5'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1b8')});db[_0xed64('0xa2')][_0xed64('0x117')](db[_0xed64('0xa3')],{'as':_0xed64('0x1c5'),'onDelete':'cascade','foreignKey':_0xed64('0x1c6')});db[_0xed64('0xa3')]['belongsTo'](db[_0xed64('0xa2')],{'foreignKey':_0xed64('0x1c6')});db[_0xed64('0xa6')][_0xed64('0x117')](db[_0xed64('0xa8')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xa8')][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':_0xed64('0x1c9'),'onDelete':'cascade','foreignKey':_0xed64('0x1ca')});db[_0xed64('0xa8')][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':_0xed64('0x1cb'),'onDelete':_0xed64('0x116'),'foreignKey':'DescriptionId'});db['SalesforceConfiguration'][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':_0xed64('0x1c5'),'onDelete':_0xed64('0x116'),'foreignKey':'FieldId'});db[_0xed64('0xa8')][_0xed64('0x126')](db[_0xed64('0xa6')],{'as':'Account','foreignKey':_0xed64('0x1c8')});db[_0xed64('0xaa')][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':_0xed64('0x1cc'),'foreignKey':'SubjectId'});db[_0xed64('0xaa')][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db[_0xed64('0xaa')][_0xed64('0x117')](db[_0xed64('0xaa')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0xaa')]['belongsTo'](db['Variable'],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0x1d2')][_0xed64('0x117')](db[_0xed64('0x1d3')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0x1d3')][_0xed64('0x117')](db['SugarcrmField'],{'as':_0xed64('0x1c9'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0x1d3')][_0xed64('0x117')](db['SugarcrmField'],{'as':_0xed64('0x1cb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xed64('0x117')](db[_0xed64('0xae')],{'as':_0xed64('0x1c5'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0x1d3')][_0xed64('0x126')](db[_0xed64('0x1d2')],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xae')][_0xed64('0x117')](db[_0xed64('0xae')],{'as':_0xed64('0x1cc'),'foreignKey':'SubjectId'});db[_0xed64('0xae')][_0xed64('0x117')](db[_0xed64('0xae')],{'as':_0xed64('0x1d4'),'foreignKey':'DescriptionId'});db[_0xed64('0xae')][_0xed64('0x117')](db[_0xed64('0xae')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0xae')][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0x1d5')][_0xed64('0x117')](db[_0xed64('0xb1')],{'as':'Configurations','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xb1')][_0xed64('0x117')](db['DeskField'],{'as':_0xed64('0x1c9'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1ca')});db['DeskConfiguration'][_0xed64('0x117')](db[_0xed64('0xb2')],{'as':_0xed64('0x1cb'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1cd')});db['DeskConfiguration']['hasMany'](db[_0xed64('0xb2')],{'as':_0xed64('0x1c5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xed64('0xb1')][_0xed64('0x126')](db['DeskAccount'],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xb1')]['belongsToMany'](db[_0xed64('0x90')],{'through':_0xed64('0x1d6')});db[_0xed64('0xb2')][_0xed64('0x117')](db[_0xed64('0xb2')],{'as':'Subject','foreignKey':_0xed64('0x1ca')});db['DeskField']['hasMany'](db[_0xed64('0xb2')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db[_0xed64('0xb2')][_0xed64('0x117')](db['DeskField'],{'as':'Field','foreignKey':_0xed64('0x1cf')});db[_0xed64('0xb2')][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0x1d7')][_0xed64('0x117')](db[_0xed64('0xb4')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xb4')]['hasMany'](db[_0xed64('0x1d8')],{'as':_0xed64('0x1c9'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0xb4')][_0xed64('0x117')](db[_0xed64('0x1d8')],{'as':_0xed64('0x1cb'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1cd')});db['ZohoConfiguration'][_0xed64('0x117')](db['ZohoField'],{'as':_0xed64('0x1c5'),'onDelete':_0xed64('0x116'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xed64('0x126')](db['ZohoAccount'],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x1c8')});db['ZohoField'][_0xed64('0x117')](db[_0xed64('0x1d8')],{'as':_0xed64('0x1cc'),'foreignKey':_0xed64('0x1ca')});db['ZohoField'][_0xed64('0x117')](db[_0xed64('0x1d8')],{'as':_0xed64('0x1d4'),'foreignKey':'DescriptionId'});db[_0xed64('0x1d8')][_0xed64('0x117')](db[_0xed64('0x1d8')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db['ZohoField'][_0xed64('0x126')](db['Variable'],{'as':'Variable','foreignKey':_0xed64('0x1d1')});db[_0xed64('0x1d9')][_0xed64('0x117')](db[_0xed64('0xb7')],{'as':'Configurations','onDelete':_0xed64('0x116'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xed64('0x117')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xed64('0x1ca')});db['ZendeskConfiguration'][_0xed64('0x117')](db[_0xed64('0xb9')],{'as':_0xed64('0x1cb'),'foreignKey':_0xed64('0x1cd')});db[_0xed64('0xb7')][_0xed64('0x117')](db[_0xed64('0xb9')],{'as':_0xed64('0x1c5'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0xb7')][_0xed64('0x126')](db[_0xed64('0x1d9')],{'as':'Account','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xed64('0x127')](db[_0xed64('0x90')],{'through':'int_zendesk_configuration_has_tags'});db[_0xed64('0xb9')][_0xed64('0x117')](db[_0xed64('0xb9')],{'as':'Subject','foreignKey':_0xed64('0x1ca')});db['ZendeskField'][_0xed64('0x117')](db[_0xed64('0xb9')],{'as':_0xed64('0x1d4'),'foreignKey':_0xed64('0x1cd')});db[_0xed64('0xb9')][_0xed64('0x117')](db[_0xed64('0xb9')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField'][_0xed64('0x126')](db['Variable'],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0xbb')][_0xed64('0x117')](db[_0xed64('0xbd')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xbd')][_0xed64('0x117')](db[_0xed64('0x1da')],{'as':'Subjects','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0xbd')][_0xed64('0x117')](db[_0xed64('0x1da')],{'as':'Descriptions','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1cd')});db[_0xed64('0xbd')][_0xed64('0x117')](db[_0xed64('0x1da')],{'as':'Fields','onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0xbd')][_0xed64('0x126')](db[_0xed64('0xbb')],{'as':_0xed64('0x182'),'foreignKey':'AccountId'});db[_0xed64('0xbd')]['belongsToMany'](db[_0xed64('0x90')],{'through':_0xed64('0x1db')});db[_0xed64('0x1da')][_0xed64('0x117')](db[_0xed64('0x1da')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xed64('0x1da')]['hasMany'](db[_0xed64('0x1da')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db['FreshdeskField'][_0xed64('0x117')](db[_0xed64('0x1da')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db['FreshdeskField'][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0xc0')][_0xed64('0x117')](db[_0xed64('0xc2')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db['VtigerConfiguration'][_0xed64('0x117')](db[_0xed64('0xc4')],{'as':'Subjects','foreignKey':_0xed64('0x1ca')});db[_0xed64('0xc2')][_0xed64('0x117')](db[_0xed64('0xc4')],{'as':_0xed64('0x1cb'),'foreignKey':_0xed64('0x1cd')});db[_0xed64('0xc2')]['hasMany'](db[_0xed64('0xc4')],{'as':'Fields','foreignKey':'FieldId'});db[_0xed64('0xc2')][_0xed64('0x126')](db['VtigerAccount'],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x1c8')});db['VtigerField'][_0xed64('0x117')](db[_0xed64('0xc4')],{'as':'Subject','foreignKey':_0xed64('0x1ca')});db[_0xed64('0xc4')][_0xed64('0x117')](db[_0xed64('0xc4')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db[_0xed64('0xc4')][_0xed64('0x117')](db[_0xed64('0xc4')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db['VtigerField'][_0xed64('0x126')](db['Variable'],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db[_0xed64('0xc6')][_0xed64('0x117')](db[_0xed64('0xc8')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xc8')]['hasMany'](db[_0xed64('0x1dc')],{'as':_0xed64('0x1c9'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0xc8')][_0xed64('0x117')](db[_0xed64('0x1dc')],{'as':_0xed64('0x1cb'),'foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xed64('0x117')](db[_0xed64('0x1dc')],{'as':'Fields','foreignKey':_0xed64('0x1cf')});db[_0xed64('0xc8')][_0xed64('0x126')](db[_0xed64('0xc6')],{'as':'Account','foreignKey':_0xed64('0x1c8')});db[_0xed64('0x1dc')][_0xed64('0x117')](db[_0xed64('0x1dc')],{'as':_0xed64('0x1cc'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0x1dc')][_0xed64('0x117')](db[_0xed64('0x1dc')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db[_0xed64('0x1dc')][_0xed64('0x117')](db['ServicenowField'],{'as':_0xed64('0x1ce'),'foreignKey':'FieldId'});db[_0xed64('0x1dc')][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db['Dynamics365Account'][_0xed64('0x117')](db[_0xed64('0xcc')],{'as':_0xed64('0x1c7'),'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0xca')][_0xed64('0x126')](db['CloudProvider'],{'as':_0xed64('0x10f'),'foreignKey':'CloudProviderId'});db[_0xed64('0xcc')][_0xed64('0x117')](db[_0xed64('0xce')],{'as':_0xed64('0x1c9'),'onDelete':_0xed64('0x116'),'foreignKey':'SubjectId'});db[_0xed64('0xcc')]['hasMany'](db[_0xed64('0xce')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xed64('0x1c5'),'onDelete':'cascade','foreignKey':_0xed64('0x1cf')});db[_0xed64('0xcc')][_0xed64('0x126')](db[_0xed64('0xca')],{'as':'Account','foreignKey':_0xed64('0x1c8')});db[_0xed64('0xce')][_0xed64('0x117')](db[_0xed64('0xce')],{'as':_0xed64('0x1cc'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0xce')]['hasMany'](db[_0xed64('0xce')],{'as':_0xed64('0x1d4'),'foreignKey':_0xed64('0x1cd')});db['Dynamics365Field'][_0xed64('0x117')](db['Dynamics365Field'],{'as':_0xed64('0x1ce'),'foreignKey':'FieldId'});db[_0xed64('0xce')][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':'Variable','foreignKey':'VariableId'});db[_0xed64('0xd0')][_0xed64('0x117')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xed64('0x116'),'foreignKey':'AccountId'});db[_0xed64('0xd2')][_0xed64('0x117')](db[_0xed64('0x1dd')],{'as':_0xed64('0x1c9'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0xd2')][_0xed64('0x117')](db[_0xed64('0x1dd')],{'as':_0xed64('0x1cb'),'foreignKey':_0xed64('0x1cd')});db[_0xed64('0xd2')][_0xed64('0x117')](db['FreshsalesField'],{'as':_0xed64('0x1c5'),'foreignKey':'FieldId'});db[_0xed64('0xd2')]['belongsTo'](db[_0xed64('0xd0')],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x1c8')});db[_0xed64('0x1dd')]['hasMany'](db['FreshsalesField'],{'as':_0xed64('0x1cc'),'foreignKey':_0xed64('0x1ca')});db[_0xed64('0x1dd')]['hasMany'](db[_0xed64('0x1dd')],{'as':'Description','foreignKey':_0xed64('0x1cd')});db[_0xed64('0x1dd')]['hasMany'](db[_0xed64('0x1dd')],{'as':_0xed64('0x1ce'),'foreignKey':_0xed64('0x1cf')});db[_0xed64('0x1dd')][_0xed64('0x126')](db[_0xed64('0x1d0')],{'as':_0xed64('0x1d0'),'foreignKey':_0xed64('0x1d1')});db['ChatQueueReport'][_0xed64('0x126')](db['ChatWebsite'],{});db[_0xed64('0xd7')]['belongsTo'](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':'ListId'});db[_0xed64('0xd7')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0xd7')][_0xed64('0x126')](db[_0xed64('0x11e')],{});db['ChatQueueReport'][_0xed64('0x126')](db[_0xed64('0x6a')],{});db[_0xed64('0xd7')][_0xed64('0x126')](db[_0xed64('0x10')],{});db[_0xed64('0xd7')][_0xed64('0x126')](db[_0xed64('0x6e')],{});db[_0xed64('0x1de')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xed64('0x1df')});db['ChatInternalMessage']['belongsTo'](db[_0xed64('0x10')],{'onDelete':_0xed64('0x116'),'foreignKey':_0xed64('0x1e0')});db[_0xed64('0xdc')]['hasMany'](db[_0xed64('0x1e1')],{'foreignKey':'SessionId','onDelete':_0xed64('0x116')});db[_0xed64('0xdc')][_0xed64('0x117')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xed64('0x116')});db[_0xed64('0xde')][_0xed64('0x126')](db['SmsAccount'],{});db[_0xed64('0xde')][_0xed64('0x126')](db['CmList'],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179')});db[_0xed64('0xde')]['belongsTo'](db['CmContact'],{'as':_0xed64('0x161'),'foreignKey':_0xed64('0x162')});db[_0xed64('0xde')][_0xed64('0x126')](db['SmsInteraction'],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0xed64('0xde')][_0xed64('0x126')](db[_0xed64('0x10')],{});db[_0xed64('0xde')][_0xed64('0x126')](db['SmsQueue'],{});db['JscriptyProject'][_0xed64('0x117')](db[_0xed64('0xdc')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xed64('0x117')](db[_0xed64('0x1e1')],{'foreignKey':_0xed64('0x1e2')});db[_0xed64('0xe1')][_0xed64('0x117')](db[_0xed64('0xda')],{'foreignKey':_0xed64('0x1e2')});db[_0xed64('0xe6')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'through':_0xed64('0x148')});db[_0xed64('0x12e')][_0xed64('0x127')](db['User'],{'as':'Agents','through':_0xed64('0x12f')});db['Team']['belongsToMany'](db[_0xed64('0x18')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0xed64('0x12e')][_0xed64('0x127')](db['MailQueue'],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team']['belongsToMany'](db[_0xed64('0x6e')],{'through':_0xed64('0x19d'),'as':_0xed64('0x138')});db[_0xed64('0x12e')]['belongsToMany'](db[_0xed64('0x4d')],{'through':_0xed64('0x186'),'as':_0xed64('0x139')});db['Team'][_0xed64('0x127')](db[_0xed64('0x58')],{'through':_0xed64('0x1e3'),'as':'SmsQueues'});db[_0xed64('0x12e')][_0xed64('0x127')](db[_0xed64('0x61')],{'through':_0xed64('0x1e4'),'as':'OpenchannelQueues'});db[_0xed64('0x12e')][_0xed64('0x127')](db[_0xed64('0x10d')],{'through':_0xed64('0x1e5'),'as':_0xed64('0x13c')});db['Team'][_0xed64('0x127')](db[_0xed64('0xfb')],{'through':_0xed64('0x111'),'as':'VoicePrefixes'});db['Campaign'][_0xed64('0x117')](db[_0xed64('0x1a3')],{'as':'Hoppers','foreignKey':_0xed64('0x1ab')});db['Campaign']['hasMany'](db['CmHopperFinal'],{'as':_0xed64('0x11b'),'foreignKey':'CampaignId'});db[_0xed64('0xed')][_0xed64('0x117')](db[_0xed64('0x7a')],{'as':'HopperHistories','foreignKey':_0xed64('0x1ab')});db[_0xed64('0xed')]['hasMany'](db[_0xed64('0x77')],{'as':_0xed64('0x152'),'foreignKey':_0xed64('0x1ab')});db[_0xed64('0xed')][_0xed64('0x126')](db[_0xed64('0x2a')],{'as':_0xed64('0x2a'),'foreignKey':_0xed64('0x1e6')});db[_0xed64('0xed')]['belongsTo'](db[_0xed64('0x2a')],{'as':_0xed64('0x153'),'foreignKey':_0xed64('0x154')});db[_0xed64('0xed')][_0xed64('0x126')](db[_0xed64('0x84')],{'as':_0xed64('0x84'),'foreignKey':_0xed64('0x176')});db[_0xed64('0xed')][_0xed64('0x126')](db['SquareProject'],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xed64('0xed')][_0xed64('0x127')](db[_0xed64('0xf9')],{'as':_0xed64('0x12d'),'through':_0xed64('0x1e7')});db[_0xed64('0xed')][_0xed64('0x127')](db[_0xed64('0xf9')],{'as':'BlackLists','through':_0xed64('0x1e8')});db['Attachment'][_0xed64('0x126')](db[_0xed64('0x6c')],{'as':_0xed64('0x6c'),'foreignKey':_0xed64('0x19c')});db[_0xed64('0xf2')]['belongsTo'](db[_0xed64('0x45')],{});db[_0xed64('0xf2')][_0xed64('0x126')](db[_0xed64('0x44')],{});db[_0xed64('0xf2')][_0xed64('0x126')](db[_0xed64('0x3e')],{'foreignKey':_0xed64('0x1e9'),'as':_0xed64('0x1ea')});db['MailTransferReport'][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':_0xed64('0x1ec')});db[_0xed64('0xf2')][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1ed'),'as':_0xed64('0x1ee')});db['MailTransferReport'][_0xed64('0x126')](db[_0xed64('0x40')],{'foreignKey':_0xed64('0x1ef'),'as':_0xed64('0x1f0')});db[_0xed64('0xf2')][_0xed64('0x126')](db[_0xed64('0x3e')],{'foreignKey':'ToMailAccountId','as':_0xed64('0x1f1')});db[_0xed64('0xf4')][_0xed64('0x126')](db[_0xed64('0x6a')],{});db['ChatTransferReport'][_0xed64('0x126')](db['ChatInteraction'],{});db[_0xed64('0xf4')]['belongsTo'](db[_0xed64('0x63')],{'foreignKey':_0xed64('0x1f2'),'as':_0xed64('0x1ea')});db['ChatTransferReport'][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':_0xed64('0x1ec')});db[_0xed64('0xf4')]['belongsTo'](db[_0xed64('0x10')],{'foreignKey':'ToUserId','as':_0xed64('0x1ee')});db[_0xed64('0xf4')]['belongsTo'](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xed64('0xf4')][_0xed64('0x126')](db[_0xed64('0x63')],{'foreignKey':_0xed64('0x1f3'),'as':'ToAccount'});db[_0xed64('0xf6')][_0xed64('0x126')](db['FaxMessage'],{});db[_0xed64('0xf6')][_0xed64('0x126')](db[_0xed64('0x121')],{});db[_0xed64('0xf6')]['belongsTo'](db[_0xed64('0x49')],{'foreignKey':_0xed64('0x1f4'),'as':'FromAccount'});db['FaxTransferReport'][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':'FromAgent'});db['FaxTransferReport'][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1ed'),'as':_0xed64('0x1ee')});db[_0xed64('0xf6')][_0xed64('0x126')](db[_0xed64('0x4d')],{'foreignKey':_0xed64('0x1f5'),'as':_0xed64('0x1f0')});db['FaxTransferReport']['belongsTo'](db[_0xed64('0x49')],{'foreignKey':'ToFaxAccountId','as':_0xed64('0x1f1')});db['OpenchannelTransferReport'][_0xed64('0x126')](db[_0xed64('0x191')],{});db['OpenchannelTransferReport'][_0xed64('0x126')](db[_0xed64('0x5e')],{});db['OpenchannelTransferReport'][_0xed64('0x126')](db['OpenchannelAccount'],{'foreignKey':_0xed64('0x1f6'),'as':_0xed64('0x1ea')});db[_0xed64('0x1f7')]['belongsTo'](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':_0xed64('0x1ec')});db['OpenchannelTransferReport']['belongsTo'](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1ed'),'as':'ToAgent'});db[_0xed64('0x1f7')][_0xed64('0x126')](db[_0xed64('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0xed64('0x1f7')]['belongsTo'](db[_0xed64('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xed64('0x1f8')]['belongsTo'](db['SmsMessage'],{});db['SmsTransferReport']['belongsTo'](db[_0xed64('0x54')],{});db[_0xed64('0x1f8')][_0xed64('0x126')](db[_0xed64('0x51')],{'foreignKey':_0xed64('0x1f9'),'as':'FromAccount'});db[_0xed64('0x1f8')][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':'FromAgent'});db[_0xed64('0x1f8')]['belongsTo'](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1ed'),'as':_0xed64('0x1ee')});db[_0xed64('0x1f8')]['belongsTo'](db[_0xed64('0x58')],{'foreignKey':_0xed64('0x1fa'),'as':_0xed64('0x1f0')});db[_0xed64('0x1f8')][_0xed64('0x126')](db[_0xed64('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xed64('0x1f1')});db[_0xed64('0xf9')][_0xed64('0x117')](db[_0xed64('0x80')],{'as':_0xed64('0x168'),'foreignKey':'ListId','onDelete':_0xed64('0x116')});db['CmList'][_0xed64('0x117')](db[_0xed64('0x1fb')],{'as':'CustomFields','foreignKey':_0xed64('0x179')});db[_0xed64('0xf9')]['hasMany'](db['CmContact'],{'as':_0xed64('0x12b'),'onDelete':'cascade','foreignKey':_0xed64('0x179')});db['CmList'][_0xed64('0x117')](db[_0xed64('0x11a')],{'as':_0xed64('0x11b'),'foreignKey':'ListId'});db[_0xed64('0xf9')]['hasMany'](db[_0xed64('0x7a')],{'as':'HopperHistory','foreignKey':_0xed64('0x179')});db[_0xed64('0xf9')]['hasMany'](db['ReportAgentPreview'],{'as':_0xed64('0x7b'),'foreignKey':_0xed64('0x179')});db[_0xed64('0xf9')][_0xed64('0x127')](db[_0xed64('0x18')],{'as':_0xed64('0x1fc'),'through':_0xed64('0x156')});db[_0xed64('0xf9')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':'Agents','through':_0xed64('0x13d')});db[_0xed64('0xfb')][_0xed64('0x117')](db[_0xed64('0x16')],{'as':_0xed64('0x1b4'),'onDelete':_0xed64('0x116')});db[_0xed64('0xfb')][_0xed64('0x127')](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':_0xed64('0x1fd')});db[_0xed64('0xfb')][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':_0xed64('0x111'),'as':'Teams'});db['UserProfile'][_0xed64('0x117')](db[_0xed64('0x10')],{'as':_0xed64('0x172'),'foreignKey':_0xed64('0x1fe')});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':_0xed64('0x1ff'),'foreignKey':_0xed64('0x1fe'),'onDelete':_0xed64('0x116')});db['UserProfileSection'][_0xed64('0x117')](db['UserProfileResource'],{'as':_0xed64('0x200'),'foreignKey':'sectionId','onDelete':_0xed64('0x116')});db[_0xed64('0x102')]['hasMany'](db[_0xed64('0x80')],{'as':_0xed64('0x168'),'foreignKey':_0xed64('0x201'),'onDelete':'cascade'});db[_0xed64('0x102')][_0xed64('0x117')](db[_0xed64('0x169')],{'as':_0xed64('0x17e'),'foreignKey':_0xed64('0x201')});db[_0xed64('0x102')][_0xed64('0x117')](db[_0xed64('0x107')],{'as':_0xed64('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0xed64('0x102')]['hasMany'](db[_0xed64('0x105')],{'as':'Interactions'});db[_0xed64('0x102')][_0xed64('0x117')](db[_0xed64('0x202')],{'as':_0xed64('0x14b')});db[_0xed64('0x102')][_0xed64('0x126')](db['CmList'],{'as':_0xed64('0x16b'),'foreignKey':'ListId'});db['WhatsappAccount'][_0xed64('0x126')](db['Pause'],{'as':_0xed64('0x16d'),'foreignKey':_0xed64('0x155')});db[_0xed64('0x102')]['belongsToMany'](db[_0xed64('0x10')],{'as':_0xed64('0x157'),'through':'user_has_whatsapp_accounts'});db[_0xed64('0x202')][_0xed64('0x126')](db['User'],{'onDelete':_0xed64('0x164')});db[_0xed64('0x202')][_0xed64('0x126')](db[_0xed64('0x10d')],{'onDelete':_0xed64('0x164')});db[_0xed64('0x202')][_0xed64('0x126')](db[_0xed64('0x102')],{'onDelete':_0xed64('0x164')});db['WhatsappApplication'][_0xed64('0x126')](db[_0xed64('0x84')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x176')});db[_0xed64('0x202')][_0xed64('0x126')](db[_0xed64('0x90')],{'onDelete':_0xed64('0x164'),'foreignKey':_0xed64('0x177')});db[_0xed64('0x105')][_0xed64('0x117')](db[_0xed64('0x107')],{'as':_0xed64('0x15b'),'onDelete':'cascade','foreignKey':_0xed64('0x203')});db[_0xed64('0x105')][_0xed64('0x126')](db['WhatsappAccount'],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x201')});db[_0xed64('0x105')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':'Contact','foreignKey':_0xed64('0x162')});db[_0xed64('0x105')][_0xed64('0x126')](db['User'],{'as':_0xed64('0x183'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xed64('0x90')],{'through':_0xed64('0x1bb'),'as':_0xed64('0x171')});db[_0xed64('0x105')][_0xed64('0x127')](db[_0xed64('0x90')],{'through':_0xed64('0x1bb'),'as':_0xed64('0x18c')});db[_0xed64('0x105')][_0xed64('0x127')](db['User'],{'as':_0xed64('0x172'),'through':_0xed64('0x204'),'foreignKey':_0xed64('0x203')});db[_0xed64('0x107')]['belongsTo'](db[_0xed64('0x10')],{'as':'User'});db[_0xed64('0x107')][_0xed64('0x126')](db[_0xed64('0x12a')],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x161')});db[_0xed64('0x107')][_0xed64('0x126')](db['WhatsappInteraction'],{'onDelete':_0xed64('0x116'),'as':_0xed64('0x174'),'foreignKey':_0xed64('0x203')});db['WhatsappMessage'][_0xed64('0x126')](db[_0xed64('0x102')],{'as':_0xed64('0x182'),'foreignKey':_0xed64('0x201')});db[_0xed64('0x109')]['belongsTo'](db['WhatsappAccount'],{});db[_0xed64('0x109')][_0xed64('0x126')](db[_0xed64('0xf9')],{'as':_0xed64('0x16b'),'foreignKey':_0xed64('0x179')});db[_0xed64('0x109')][_0xed64('0x126')](db[_0xed64('0x12a')],{'as':_0xed64('0x161'),'foreignKey':'ContactId'});db[_0xed64('0x109')][_0xed64('0x126')](db[_0xed64('0x105')],{});db['WhatsappQueueReport'][_0xed64('0x126')](db['WhatsappQueue'],{});db[_0xed64('0x109')][_0xed64('0x126')](db[_0xed64('0x107')],{});db['WhatsappQueueReport'][_0xed64('0x126')](db[_0xed64('0x10')],{});db[_0xed64('0x10b')][_0xed64('0x126')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0xed64('0x126')](db['WhatsappInteraction'],{});db[_0xed64('0x10b')][_0xed64('0x126')](db[_0xed64('0x102')],{'foreignKey':_0xed64('0x205'),'as':_0xed64('0x1ea')});db[_0xed64('0x10b')][_0xed64('0x126')](db['WhatsappAccount'],{'foreignKey':'ToWhatsappAccountId','as':_0xed64('0x1f1')});db[_0xed64('0x10b')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0xed64('0x1f0')});db[_0xed64('0x10b')][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1eb'),'as':'FromAgent'});db[_0xed64('0x10b')][_0xed64('0x126')](db[_0xed64('0x10')],{'foreignKey':_0xed64('0x1ed'),'as':'ToAgent'});db[_0xed64('0x10d')][_0xed64('0x127')](db['User'],{'as':_0xed64('0x157'),'through':_0xed64('0x38'),'foreignKey':_0xed64('0x206')});db['WhatsappQueue'][_0xed64('0x127')](db[_0xed64('0x12e')],{'through':_0xed64('0x1e5'),'as':_0xed64('0x158')});db[_0xed64('0x114')][_0xed64('0x126')](db['User'],{'as':_0xed64('0x207'),'foreignKey':_0xed64('0x118'),'onDelete':_0xed64('0x116'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0xed64('0xca')],{'as':'Dynamics365Account','onDelete':_0xed64('0x164')});db['CloudProvider']['hasOne'](db['MailServerIn'],{'as':_0xed64('0x166'),'onDelete':_0xed64('0x164')});db[_0xed64('0x10f')][_0xed64('0x115')](db['MailServerOut'],{'as':_0xed64('0x167'),'onDelete':_0xed64('0x164')});module[_0xed64('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cf5032b..d0b7c5a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6be=['./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','root','/snippet','snippet','3.0.0','route','get','sendFile','resolve','appPath','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','/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/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations'];(function(_0x51afc4,_0x4e02df){var _0x64fbda=function(_0x455b52){while(--_0x455b52){_0x51afc4['push'](_0x51afc4['shift']());}};_0x64fbda(++_0x4e02df);}(_0xe6be,0x189));var _0xee6b=function(_0x5f360d,_0x343ec2){_0x5f360d=_0x5f360d-0x0;var _0x4690cd=_0xe6be[_0x5f360d];return _0x4690cd;};'use strict';var path=require('path');var express=require(_0xee6b('0x0'));var errors=require(_0xee6b('0x1'));var config=require(_0xee6b('0x2'));var setupLoggers=require(_0xee6b('0x3'))[_0xee6b('0x4')];var clientSideLogs=require(_0xee6b('0x5'));exports[_0xee6b('0x6')]=function(_0xe64950){return setupLoggers(_0xe64950)[_0xee6b('0x7')](function(){_0xe64950['use'](_0xee6b('0x8'),require(_0xee6b('0x9')));_0xe64950['use'](_0xee6b('0xa'),require(_0xee6b('0xb')));_0xe64950[_0xee6b('0xc')]('/api/voice/contexts',require(_0xee6b('0xd')));_0xe64950['use']('/api/voice/extensions',require(_0xee6b('0xe')));_0xe64950['use'](_0xee6b('0xf'),require(_0xee6b('0x10')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x11'),require(_0xee6b('0x12')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x13'),require('./api/voiceRecording'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x14'),require(_0xee6b('0x15')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x16'),require(_0xee6b('0x17')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x18'),require(_0xee6b('0x19')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x1a'),require(_0xee6b('0x1b')));_0xe64950['use'](_0xee6b('0x1c'),require('./api/voiceDialReport'));_0xe64950[_0xee6b('0xc')]('/api/voice/agents/reports',require(_0xee6b('0x1d')));_0xe64950[_0xee6b('0xc')]('/api/voice/queues/reports',require(_0xee6b('0x1e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x1f'),require(_0xee6b('0x20')));_0xe64950['use'](_0xee6b('0x21'),require(_0xee6b('0x22')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x23'),require(_0xee6b('0x24')));_0xe64950['use'](_0xee6b('0x25'),require(_0xee6b('0x26')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x27'),require('./api/mailAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x28'),require('./api/mailQueue'));_0xe64950['use'](_0xee6b('0x29'),require(_0xee6b('0x2a')));_0xe64950['use']('/api/mail/interactions',require('./api/mailInteraction'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x2b'),require('./api/mailMessage'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x2c'),require(_0xee6b('0x2d')));_0xe64950[_0xee6b('0xc')]('/api/mail/reports/queue',require(_0xee6b('0x2e')));_0xe64950[_0xee6b('0xc')]('/api/dashboards',require(_0xee6b('0x2f')));_0xe64950[_0xee6b('0xc')]('/api/dashboards/items',require(_0xee6b('0x30')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x31'),require('./api/faxAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x32'),require(_0xee6b('0x33')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x34'),require(_0xee6b('0x35')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x36'),require(_0xee6b('0x37')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x38'),require(_0xee6b('0x39')));_0xe64950[_0xee6b('0xc')]('/api/fax/reports/queue',require(_0xee6b('0x3a')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3b'),require('./api/smsAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3c'),require('./api/smsApplication'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3d'),require(_0xee6b('0x3e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x3f'),require(_0xee6b('0x40')));_0xe64950['use'](_0xee6b('0x41'),require(_0xee6b('0x42')));_0xe64950['use'](_0xee6b('0x43'),require(_0xee6b('0x44')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/applications',require(_0xee6b('0x45')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x46'),require(_0xee6b('0x47')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/messages',require(_0xee6b('0x48')));_0xe64950[_0xee6b('0xc')]('/api/openchannel/queues',require(_0xee6b('0x49')));_0xe64950[_0xee6b('0xc')]('/api/chat/websites',require(_0xee6b('0x4a')));_0xe64950['use'](_0xee6b('0x4b'),require(_0xee6b('0x4c')));_0xe64950['use'](_0xee6b('0x4d'),require(_0xee6b('0x4e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x4f'),require('./api/chatInteraction'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x50'),require(_0xee6b('0x51')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x52'),require(_0xee6b('0x53')));_0xe64950['use'](_0xee6b('0x54'),require('./api/chatQueue'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x55'),require(_0xee6b('0x56')));_0xe64950[_0xee6b('0xc')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0xe64950['use'](_0xee6b('0x57'),require(_0xee6b('0x58')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x59'),require(_0xee6b('0x5a')));_0xe64950[_0xee6b('0xc')]('/api/cm/hopper',require(_0xee6b('0x5b')));_0xe64950[_0xee6b('0xc')]('/api/cm/hopper_black',require(_0xee6b('0x5c')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x5d'),require(_0xee6b('0x5e')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x5f'),require(_0xee6b('0x60')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x61'),require(_0xee6b('0x62')));_0xe64950['use'](_0xee6b('0x63'),require('./api/action'));_0xe64950[_0xee6b('0xc')]('/api/automations',require(_0xee6b('0x64')));_0xe64950['use'](_0xee6b('0x65'),require(_0xee6b('0x66')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x67'),require(_0xee6b('0x68')));_0xe64950['use']('/api/conditions',require(_0xee6b('0x69')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x6a'),require(_0xee6b('0x6b')));_0xe64950[_0xee6b('0xc')]('/api/pauses',require(_0xee6b('0x6c')));_0xe64950['use']('/api/cdr',require(_0xee6b('0x6d')));_0xe64950['use'](_0xee6b('0x6e'),require(_0xee6b('0x6f')));_0xe64950[_0xee6b('0xc')]('/api/schedules',require(_0xee6b('0x70')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x71'),require('./api/sound'));_0xe64950['use'](_0xee6b('0x72'),require(_0xee6b('0x73')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x74'),require(_0xee6b('0x75')));_0xe64950[_0xee6b('0xc')]('/api/cm_contact_has_items',require(_0xee6b('0x76')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x77'),require(_0xee6b('0x78')));_0xe64950[_0xee6b('0xc')]('/api/templates',require(_0xee6b('0x79')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7a'),require(_0xee6b('0x7b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7c'),require(_0xee6b('0x7d')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x7e'),require(_0xee6b('0x7f')));_0xe64950[_0xee6b('0xc')]('/api/integrations/reports',require(_0xee6b('0x80')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x81'),require(_0xee6b('0x82')));_0xe64950[_0xee6b('0xc')]('/api/analytics/default_reports',require(_0xee6b('0x83')));_0xe64950[_0xee6b('0xc')]('/api/analytics/extracted_reports',require(_0xee6b('0x84')));_0xe64950[_0xee6b('0xc')]('/api/analytics/metrics',require(_0xee6b('0x85')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x86'),require('./api/analyticFieldReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x87'),require('./api/analyticTreeReport'));_0xe64950[_0xee6b('0xc')]('/api/integrations/salesforce/accounts',require(_0xee6b('0x88')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x89'),require('./api/intSalesforceConfiguration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8a'),require(_0xee6b('0x8b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8c'),require(_0xee6b('0x8d')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x8e'),require(_0xee6b('0x8f')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x90'),require(_0xee6b('0x91')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x92'),require(_0xee6b('0x93')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x94'),require('./api/intDeskConfiguration'));_0xe64950[_0xee6b('0xc')]('/api/integrations/desk/fields',require(_0xee6b('0x95')));_0xe64950[_0xee6b('0xc')]('/api/integrations/zoho/accounts',require(_0xee6b('0x96')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x97'),require(_0xee6b('0x98')));_0xe64950[_0xee6b('0xc')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xe64950[_0xee6b('0xc')]('/api/integrations/zendesk/accounts',require(_0xee6b('0x99')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9a'),require(_0xee6b('0x9b')));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9c'),require('./api/intZendeskField'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9d'),require(_0xee6b('0x9e')));_0xe64950[_0xee6b('0xc')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0x9f'),require(_0xee6b('0xa0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa1'),require('./api/intVtigerAccount'));_0xe64950[_0xee6b('0xc')]('/api/integrations/vtiger/configurations',require(_0xee6b('0xa2')));_0xe64950[_0xee6b('0xc')]('/api/integrations/vtiger/fields',require(_0xee6b('0xa3')));_0xe64950['use'](_0xee6b('0xa4'),require('./api/intServicenowAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa5'),require(_0xee6b('0xa6')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xa7'),require(_0xee6b('0xa8')));_0xe64950['use'](_0xee6b('0xa9'),require('./api/intDynamics365Account'));_0xe64950['use']('/api/integrations/dynamics365/configurations',require(_0xee6b('0xaa')));_0xe64950[_0xee6b('0xc')]('/api/integrations/dynamics365/fields',require(_0xee6b('0xab')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xac'),require('./api/intFreshsalesAccount'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xad'),require('./api/intFreshsalesConfiguration'));_0xe64950[_0xee6b('0xc')]('/api/integrations/freshsales/fields',require(_0xee6b('0xae')));_0xe64950[_0xee6b('0xc')]('/api/networks',require(_0xee6b('0xaf')));_0xe64950[_0xee6b('0xc')]('/api/chat/reports/queue',require(_0xee6b('0xb0')));_0xe64950[_0xee6b('0xc')]('/api/chat/internal/messages',require(_0xee6b('0xb1')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb2'),require('./api/jscriptyAnswerReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb3'),require('./api/jscriptyQuestionReport'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb4'),require('./api/jscriptySessionReport'));_0xe64950['use'](_0xee6b('0xb5'),require(_0xee6b('0xb6')));_0xe64950['use']('/api/square/reports',require(_0xee6b('0xb7')));_0xe64950[_0xee6b('0xc')]('/api/square/details/reports',require('./api/squareReportDetail'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xb8'),require(_0xee6b('0xb9')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xba'),require('./api/setting'));_0xe64950[_0xee6b('0xc')]('/api/square/odbc',require(_0xee6b('0xbb')));_0xe64950['use'](_0xee6b('0xbc'),require(_0xee6b('0xbd')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xbe'),require('./api/squareRecording'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xbf'),require(_0xee6b('0xc0')));_0xe64950['use'](_0xee6b('0xc1'),require(_0xee6b('0xc2')));_0xe64950['use'](_0xee6b('0xc3'),require(_0xee6b('0xc4')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xc5'),require(_0xee6b('0xc6')));_0xe64950[_0xee6b('0xc')]('/api/migrations',require('./api/migration'));_0xe64950[_0xee6b('0xc')](_0xee6b('0xc7'),require('./api/attachment'));_0xe64950[_0xee6b('0xc')]('/api/plugins',require(_0xee6b('0xc8')));_0xe64950['use']('/api/mail/reports/transfer',require(_0xee6b('0xc9')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xca'),require(_0xee6b('0xcb')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xcc'),require(_0xee6b('0xcd')));_0xe64950['use'](_0xee6b('0xce'),require(_0xee6b('0xcf')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd0'),require('./api/smsTransferReport'));_0xe64950[_0xee6b('0xc')]('/api/cm/lists',require(_0xee6b('0xd1')));_0xe64950[_0xee6b('0xc')]('/api/voice/prefixes',require(_0xee6b('0xd2')));_0xe64950[_0xee6b('0xc')]('/api/userProfiles',require('./api/userProfile'));_0xe64950['use'](_0xee6b('0xd3'),require(_0xee6b('0xd4')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd5'),require(_0xee6b('0xd6')));_0xe64950['use'](_0xee6b('0xd7'),require(_0xee6b('0xd8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xd9'),require(_0xee6b('0xda')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdb'),require(_0xee6b('0xdc')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdd'),require(_0xee6b('0xde')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xdf'),require(_0xee6b('0xe0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe1'),require(_0xee6b('0xe2')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe3'),require(_0xee6b('0xe4')));_0xe64950['use'](_0xee6b('0xe5'),require(_0xee6b('0xe6')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe7'),require(_0xee6b('0xe8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xe9'),require(_0xee6b('0xea')));_0xe64950['use'](_0xee6b('0xeb'),require(_0xee6b('0xec')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xed'),require(_0xee6b('0xee')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xef'),require(_0xee6b('0xf0')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf1'),require(_0xee6b('0xf2')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf3'),require('./api/jira'));_0xe64950['use'](_0xee6b('0xf4'),require(_0xee6b('0xf5')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf6'),require(_0xee6b('0xf7')));_0xe64950[_0xee6b('0xc')]('/api/system',require(_0xee6b('0xf8')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xf9'),require(_0xee6b('0xfa')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xfb'),require(_0xee6b('0xfc')));_0xe64950[_0xee6b('0xc')](_0xee6b('0xfd'),clientSideLogs);_0xe64950['use'](_0xee6b('0xfe'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config['root'],_0xee6b('0xfe'))));_0xe64950['use']('/www',express['static'](path[_0xee6b('0x100')](config['root'],_0xee6b('0x101'))));_0xe64950[_0xee6b('0xc')](_0xee6b('0x102'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config[_0xee6b('0x103')],_0xee6b('0x102'))));_0xe64950[_0xee6b('0xc')](_0xee6b('0x104'),express[_0xee6b('0xff')](path[_0xee6b('0x100')](config[_0xee6b('0x103')],_0xee6b('0x105'),_0xee6b('0x106'))));_0xe64950['use']('/plugins',express['static'](path[_0xee6b('0x100')](config[_0xee6b('0x103')],'/server/files/plugins')));_0xe64950[_0xee6b('0x107')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xee6b('0x108')](errors[0x194]);_0xe64950[_0xee6b('0x107')]('/*')[_0xee6b('0x108')](function(_0x18abb7,_0x1fc4a6){_0x1fc4a6[_0xee6b('0x109')](path[_0xee6b('0x10a')](_0xe64950['get'](_0xee6b('0x10b'))+'/index.html'));});return _0xe64950;});}; \ No newline at end of file +var _0xff8f=['./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','./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/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','root','/apidoc','/www','join','/demo','/snippet','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions'];(function(_0x31889a,_0x1d6bf6){var _0x16b798=function(_0x24c169){while(--_0x24c169){_0x31889a['push'](_0x31889a['shift']());}};_0x16b798(++_0x1d6bf6);}(_0xff8f,0x1e0));var _0xfff8=function(_0x6c9be0,_0x1bdfb3){_0x6c9be0=_0x6c9be0-0x0;var _0x2b69ba=_0xff8f[_0x6c9be0];return _0x2b69ba;};'use strict';var path=require(_0xfff8('0x0'));var express=require('express');var errors=require(_0xfff8('0x1'));var config=require(_0xfff8('0x2'));var setupLoggers=require(_0xfff8('0x3'))[_0xfff8('0x4')];var clientSideLogs=require(_0xfff8('0x5'));exports[_0xfff8('0x6')]=function(_0x237ff6){return setupLoggers(_0x237ff6)[_0xfff8('0x7')](function(){_0x237ff6['use'](_0xfff8('0x8'),require(_0xfff8('0x9')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xb'),require(_0xfff8('0xc')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xd'),require(_0xfff8('0xe')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xf'),require('./api/voiceExtension'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x10'),require(_0xfff8('0x11')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x12'),require(_0xfff8('0x13')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x14'),require(_0xfff8('0x15')));_0x237ff6['use'](_0xfff8('0x16'),require(_0xfff8('0x17')));_0x237ff6['use'](_0xfff8('0x18'),require('./api/voiceMail'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x19'),require(_0xfff8('0x1a')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x1b'),require(_0xfff8('0x1c')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x1d'),require(_0xfff8('0x1e')));_0x237ff6[_0xfff8('0xa')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x237ff6[_0xfff8('0xa')]('/api/voice/queues/reports',require(_0xfff8('0x1f')));_0x237ff6['use'](_0xfff8('0x20'),require(_0xfff8('0x21')));_0x237ff6['use'](_0xfff8('0x22'),require(_0xfff8('0x23')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x24'),require(_0xfff8('0x25')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x26'),require('./api/mailServerOut'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x27'),require('./api/mailAccount'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x28'),require(_0xfff8('0x29')));_0x237ff6[_0xfff8('0xa')]('/api/mail/substatuses',require(_0xfff8('0x2a')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x2b'),require(_0xfff8('0x2c')));_0x237ff6[_0xfff8('0xa')]('/api/mail/messages',require('./api/mailMessage'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x2d'),require('./api/mailApplication'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x2e'),require(_0xfff8('0x2f')));_0x237ff6['use']('/api/dashboards',require(_0xfff8('0x30')));_0x237ff6['use'](_0xfff8('0x31'),require('./api/dashboardItem'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x32'),require(_0xfff8('0x33')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x34'),require('./api/faxApplication'));_0x237ff6[_0xfff8('0xa')]('/api/fax/interactions',require('./api/faxInteraction'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x35'),require('./api/faxMessage'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x36'),require(_0xfff8('0x37')));_0x237ff6['use'](_0xfff8('0x38'),require('./api/faxQueueReport'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x39'),require(_0xfff8('0x3a')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x3b'),require(_0xfff8('0x3c')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x3d'),require(_0xfff8('0x3e')));_0x237ff6['use'](_0xfff8('0x3f'),require(_0xfff8('0x40')));_0x237ff6['use'](_0xfff8('0x41'),require(_0xfff8('0x42')));_0x237ff6['use'](_0xfff8('0x43'),require('./api/openchannelAccount'));_0x237ff6['use'](_0xfff8('0x44'),require('./api/openchannelApplication'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x45'),require('./api/openchannelInteraction'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x46'),require('./api/openchannelMessage'));_0x237ff6['use']('/api/openchannel/queues',require(_0xfff8('0x47')));_0x237ff6['use'](_0xfff8('0x48'),require(_0xfff8('0x49')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x4a'),require(_0xfff8('0x4b')));_0x237ff6[_0xfff8('0xa')]('/api/chat/applications',require(_0xfff8('0x4c')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x4d'),require(_0xfff8('0x4e')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x4f'),require(_0xfff8('0x50')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x51'),require(_0xfff8('0x52')));_0x237ff6['use'](_0xfff8('0x53'),require(_0xfff8('0x54')));_0x237ff6['use'](_0xfff8('0x55'),require('./api/chatGroup'));_0x237ff6[_0xfff8('0xa')]('/api/chat/proactive_actions',require(_0xfff8('0x56')));_0x237ff6[_0xfff8('0xa')]('/api/cm/companies',require(_0xfff8('0x57')));_0x237ff6[_0xfff8('0xa')]('/api/cm/contacts',require(_0xfff8('0x58')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x59'),require(_0xfff8('0x5a')));_0x237ff6['use'](_0xfff8('0x5b'),require('./api/cmHopperBlack'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x5c'),require(_0xfff8('0x5d')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x5e'),require(_0xfff8('0x5f')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x60'),require('./api/cmCustomField'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x61'),require(_0xfff8('0x62')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x63'),require(_0xfff8('0x64')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x65'),require(_0xfff8('0x66')));_0x237ff6['use']('/api/dispositions',require(_0xfff8('0x67')));_0x237ff6['use'](_0xfff8('0x68'),require('./api/condition'));_0x237ff6['use'](_0xfff8('0x69'),require('./api/interval'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x6a'),require(_0xfff8('0x6b')));_0x237ff6[_0xfff8('0xa')]('/api/cdr',require('./api/cdr'));_0x237ff6['use'](_0xfff8('0x6c'),require('./api/voiceQueuesLog'));_0x237ff6[_0xfff8('0xa')]('/api/schedules',require(_0xfff8('0x6d')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x6e'),require(_0xfff8('0x6f')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x70'),require(_0xfff8('0x71')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x72'),require(_0xfff8('0x73')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x74'),require(_0xfff8('0x75')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x76'),require(_0xfff8('0x77')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x78'),require('./api/template'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x79'),require(_0xfff8('0x7a')));_0x237ff6['use'](_0xfff8('0x7b'),require(_0xfff8('0x7c')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x7d'),require('./api/integration'));_0x237ff6['use'](_0xfff8('0x7e'),require(_0xfff8('0x7f')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x80'),require(_0xfff8('0x81')));_0x237ff6[_0xfff8('0xa')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x237ff6['use'](_0xfff8('0x82'),require(_0xfff8('0x83')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x84'),require(_0xfff8('0x85')));_0x237ff6[_0xfff8('0xa')]('/api/analytics/field_reports',require(_0xfff8('0x86')));_0x237ff6[_0xfff8('0xa')]('/api/analytics/tree_reports',require(_0xfff8('0x87')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x88'),require(_0xfff8('0x89')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x8a'),require(_0xfff8('0x8b')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/sugarcrm/accounts',require(_0xfff8('0x8c')));_0x237ff6['use'](_0xfff8('0x8d'),require(_0xfff8('0x8e')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x8f'),require('./api/intSugarcrmField'));_0x237ff6['use'](_0xfff8('0x90'),require(_0xfff8('0x91')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x92'),require('./api/intDeskConfiguration'));_0x237ff6['use'](_0xfff8('0x93'),require(_0xfff8('0x94')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x95'),require(_0xfff8('0x96')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/zoho/configurations',require(_0xfff8('0x97')));_0x237ff6['use']('/api/integrations/zoho/fields',require(_0xfff8('0x98')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/zendesk/accounts',require(_0xfff8('0x99')));_0x237ff6['use'](_0xfff8('0x9a'),require('./api/intZendeskConfiguration'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x9b'),require(_0xfff8('0x9c')));_0x237ff6['use'](_0xfff8('0x9d'),require(_0xfff8('0x9e')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x9f'),require(_0xfff8('0xa0')));_0x237ff6['use'](_0xfff8('0xa1'),require(_0xfff8('0xa2')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xa3'),require(_0xfff8('0xa4')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xa5'),require('./api/intVtigerConfiguration'));_0x237ff6[_0xfff8('0xa')]('/api/integrations/vtiger/fields',require(_0xfff8('0xa6')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xa7'),require(_0xfff8('0xa8')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/servicenow/configurations',require(_0xfff8('0xa9')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xaa'),require(_0xfff8('0xab')));_0x237ff6['use']('/api/integrations/dynamics365/accounts',require(_0xfff8('0xac')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xad'),require(_0xfff8('0xae')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xaf'),require(_0xfff8('0xb0')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/freshsales/accounts',require(_0xfff8('0xb1')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xb2'),require(_0xfff8('0xb3')));_0x237ff6[_0xfff8('0xa')]('/api/integrations/freshsales/fields',require(_0xfff8('0xb4')));_0x237ff6['use'](_0xfff8('0xb5'),require(_0xfff8('0xb6')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xb7'),require(_0xfff8('0xb8')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xb9'),require(_0xfff8('0xba')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xbb'),require('./api/jscriptyAnswerReport'));_0x237ff6[_0xfff8('0xa')]('/api/jscripty/questions/reports',require(_0xfff8('0xbc')));_0x237ff6['use']('/api/jscripty/sessions/reports',require(_0xfff8('0xbd')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xbe'),require(_0xfff8('0xbf')));_0x237ff6[_0xfff8('0xa')]('/api/square/reports',require(_0xfff8('0xc0')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xc1'),require(_0xfff8('0xc2')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xc3'),require(_0xfff8('0xc4')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xc5'),require(_0xfff8('0xc6')));_0x237ff6['use'](_0xfff8('0xc7'),require(_0xfff8('0xc8')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xc9'),require(_0xfff8('0xca')));_0x237ff6['use']('/api/square/recordings',require('./api/squareRecording'));_0x237ff6[_0xfff8('0xa')]('/api/square/messages',require(_0xfff8('0xcb')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xcc'),require('./api/team'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xcd'),require(_0xfff8('0xce')));_0x237ff6['use']('/api/campaigns',require(_0xfff8('0xcf')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xd0'),require(_0xfff8('0xd1')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xd2'),require(_0xfff8('0xd3')));_0x237ff6['use'](_0xfff8('0xd4'),require(_0xfff8('0xd5')));_0x237ff6['use']('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xd6'),require(_0xfff8('0xd7')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xd8'),require(_0xfff8('0xd9')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xda'),require('./api/openchannelTransferReport'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xdb'),require(_0xfff8('0xdc')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xdd'),require(_0xfff8('0xde')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xdf'),require('./api/voicePrefix'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xe0'),require(_0xfff8('0xe1')));_0x237ff6[_0xfff8('0xa')]('/api/userProfile/sections',require(_0xfff8('0xe2')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xe3'),require(_0xfff8('0xe4')));_0x237ff6[_0xfff8('0xa')]('/api/userNotifications',require(_0xfff8('0xe5')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xe6'),require('./api/whatsappAccount'));_0x237ff6[_0xfff8('0xa')]('/api/whatsapp/applications',require(_0xfff8('0xe7')));_0x237ff6[_0xfff8('0xa')]('/api/whatsapp/interactions',require(_0xfff8('0xe8')));_0x237ff6[_0xfff8('0xa')]('/api/whatsapp/messages',require(_0xfff8('0xe9')));_0x237ff6['use']('/api/whatsapp/reports/queue',require(_0xfff8('0xea')));_0x237ff6['use']('/api/whatsapp/reports/transfer',require(_0xfff8('0xeb')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xec'),require(_0xfff8('0xed')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xee'),require(_0xfff8('0xef')));_0x237ff6['use'](_0xfff8('0xf0'),require(_0xfff8('0xf1')));_0x237ff6['use'](_0xfff8('0xf2'),require(_0xfff8('0xf3')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xf4'),require('./api/authLocal'));_0x237ff6['use']('/api/auth/google',require(_0xfff8('0xf5')));_0x237ff6[_0xfff8('0xa')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xf6'),require(_0xfff8('0xf7')));_0x237ff6['use'](_0xfff8('0xf8'),require('./api/rpc'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xf9'),require(_0xfff8('0xfa')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xfb'),require('./api/system'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xfc'),require(_0xfff8('0xfd')));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xfe'),require('./api/webbar'));_0x237ff6[_0xfff8('0xa')](_0xfff8('0xff'),clientSideLogs);_0x237ff6[_0xfff8('0xa')]('/apidoc',express[_0xfff8('0x100')](path['join'](config[_0xfff8('0x101')],_0xfff8('0x102'))));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x103'),express['static'](path[_0xfff8('0x104')](config['root'],_0xfff8('0x103'))));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x105'),express[_0xfff8('0x100')](path['join'](config[_0xfff8('0x101')],_0xfff8('0x105'))));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x106'),express[_0xfff8('0x100')](path[_0xfff8('0x104')](config[_0xfff8('0x101')],_0xfff8('0x107'),_0xfff8('0x108'))));_0x237ff6[_0xfff8('0xa')](_0xfff8('0x109'),express[_0xfff8('0x100')](path['join'](config['root'],'/server/files/plugins')));_0x237ff6[_0xfff8('0x10a')](_0xfff8('0x10b'))[_0xfff8('0x10c')](errors[0x194]);_0x237ff6[_0xfff8('0x10a')]('/*')[_0xfff8('0x10c')](function(_0x3b9027,_0x26ffa4){_0x26ffa4['sendFile'](path['resolve'](_0x237ff6[_0xfff8('0x10c')](_0xfff8('0x10d'))+_0xfff8('0x10e')));});return _0x237ff6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 92a306b..b0f5ba9 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb383=['../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','localhost','error','log','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc'];(function(_0x302408,_0x30de19){var _0x1679e0=function(_0x420796){while(--_0x420796){_0x302408['push'](_0x302408['shift']());}};_0x1679e0(++_0x30de19);}(_0xb383,0x87));var _0x3b38=function(_0x14eb81,_0x40bbdb){_0x14eb81=_0x14eb81-0x0;var _0x336b05=_0xb383[_0x14eb81];return _0x336b05;};'use strict';var jayson=require(_0x3b38('0x0'));var _=require(_0x3b38('0x1'));var config=require('../config/environment');exports[_0x3b38('0x2')]=function(){return new Promise(function(_0x5f1ae0,_0x40589d){var _0x3e856b={};_0x3e856b=_['merge'](_0x3e856b,require('../api/user/user.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x4')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceQueue/voiceQueue.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x5')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x6')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x7')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x8')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x9')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xa')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xb')));_0x3e856b=_['merge'](_0x3e856b,require('../api/mailServerIn/mailServerIn.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0xc')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xd')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0xe')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0xf')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x10')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x11')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/faxAccount/faxAccount.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x12')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x13')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x14')));_0x3e856b=_['merge'](_0x3e856b,require('../api/faxQueue/faxQueue.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x15')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/smsInteraction/smsInteraction.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x16')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x17')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x18')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x19')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1a')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1c')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/chatInteraction/chatInteraction.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x1d')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/chatQueue/chatQueue.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1e')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x1f')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x20')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x21')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x22')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x23')));_0x3e856b=_['merge'](_0x3e856b,require('../api/sound/sound.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x24')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x25')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x26')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x27')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x28')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x29')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x2a')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2c')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2d')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x2e')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x2f')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x30')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x31')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x32')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x33')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x34')));_0x3e856b=_['merge'](_0x3e856b,require('../api/squareOdbc/squareOdbc.rpc'));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x35')));_0x3e856b=_['merge'](_0x3e856b,require('../api/squareRecording/squareRecording.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x36')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x37')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x38')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x39')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x3a')));_0x3e856b=_['merge'](_0x3e856b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x3b')));_0x3e856b=_[_0x3b38('0x3')](_0x3e856b,require(_0x3b38('0x3c')));_0x3e856b=_['merge'](_0x3e856b,require(_0x3b38('0x3d')));var _0x46681a=jayson['server'](_0x3e856b)[_0x3b38('0x3e')]();var _0x5c8774=config[_0x3b38('0x3f')][_0x3b38('0x40')]||config['port']+0x1;var _0xc0bf58=config[_0x3b38('0x3f')]['ip']||_0x3b38('0x41');_0x46681a['on'](_0x3b38('0x42'),function(_0x279282){return _0x40589d(_0x279282);});_0x46681a[_0x3b38('0x2')](_0x5c8774,_0xc0bf58,function(){console[_0x3b38('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0xc0bf58,_0x5c8774);require('../config/triggers')[_0x3b38('0x44')]();return _0x5f1ae0(_0x3b38('0x45')+_0xc0bf58+':'+_0x5c8774);});});}; \ No newline at end of file +var _0x0946=['../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','default','RPC\x20listening\x20on\x20','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc'];(function(_0x32b3ae,_0x3b632a){var _0x30b2e3=function(_0x4c0131){while(--_0x4c0131){_0x32b3ae['push'](_0x32b3ae['shift']());}};_0x30b2e3(++_0x3b632a);}(_0x0946,0xf5));var _0x6094=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x0946[_0x209ec9];return _0x129b1b;};'use strict';var jayson=require(_0x6094('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x6094('0x1')]=function(){return new Promise(function(_0x14ffc5,_0x244989){var _0xa9d4a2={};_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/voiceExtension/voiceExtension.rpc'));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x4')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x5')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x6')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x7')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x8')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x9')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0xa')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0xb')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0xc')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0xd')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0xe')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0xf')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x10')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x11')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x12')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/mailApplication/mailApplication.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x13')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x14')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/faxInteraction/faxInteraction.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x15')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x16')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x17')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/smsAccount/smsAccount.rpc'));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x18')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x19')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/smsQueue/smsQueue.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x1a')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x1b')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x1c')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/chatInteraction/chatInteraction.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x1d')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x1e')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/cmContact/cmContact.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x1f')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x20')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x21')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x22')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x23')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x24')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/sound/sound.rpc'));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x25')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x26')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x27')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x28')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x29')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2a')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2b')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2c')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2d')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2e')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x2f')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x30')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x31')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x32')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x33')));_0xa9d4a2=_['merge'](_0xa9d4a2,require('../api/squareReport/squareReport.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x34')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x35')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x36')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x37')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x38')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x39')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3a')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require('../api/attachment/attachment.rpc'));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3b')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3c')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3d')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x3e')));_0xa9d4a2=_['merge'](_0xa9d4a2,require(_0x6094('0x3f')));_0xa9d4a2=_[_0x6094('0x2')](_0xa9d4a2,require(_0x6094('0x40')));var _0xa145f1=jayson[_0x6094('0x41')](_0xa9d4a2)['http']();var _0xc1710c=config[_0x6094('0x42')]['port']||config['port']+0x1;var _0x394f9b=config['rpc']['ip']||'localhost';_0xa145f1['on']('error',function(_0x3afd06){return _0x244989(_0x3afd06);});_0xa145f1[_0x6094('0x1')](_0xc1710c,_0x394f9b,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x394f9b,_0xc1710c);require('../config/triggers')[_0x6094('0x43')]();return _0x14ffc5(_0x6094('0x44')+_0x394f9b+':'+_0xc1710c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8b7a25a..e9bb4a3 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 _0x157f=['./reply','./error','call','setEncoding','utf8','emit','substring','520-Invalid','function','no\x20code','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','answer','sendRequest','ANSWER','prototype','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','hangup','HANGUP','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','label','util','lodash','EventEmitter'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x157f,0xd2));var _0xf157=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x157f[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0xf157('0x0'));var _=require(_0xf157('0x1'));var EventEmitter=require('events')[_0xf157('0x2')];var AGIReply=require(_0xf157('0x3'));var AGIError=require(_0xf157('0x4'));function AGIChannel(_0x5b15b4){var _0x19d725=this,_0x6920cf=new AGIReply(),_0x34a187=![],_0x248c09={};EventEmitter[_0xf157('0x5')](_0x19d725);_0x5b15b4[_0xf157('0x6')]('utf8');_0x5b15b4['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x6920cf[_0xf157('0x6')](_0xf157('0x7'));_0x6920cf['on']('headers',function(_0x1e0f37){for(var _0x5e58de in _0x1e0f37){_0x19d725[_0x5e58de]=_0x1e0f37[_0x5e58de];}_0x19d725[_0xf157('0x8')]('ready');});_0x6920cf['on']('line',function(_0x1b8e0e){if(_0x1b8e0e['toLowerCase']()=='hangup'){_0x19d725[_0xf157('0x8')]('hangup');return;}if(_0x1b8e0e[_0xf157('0x9')](0x0,0xb)==_0xf157('0xa')){_0x34a187=!![];}if(_0x34a187){_0x248c09['rx']+=_0x1b8e0e+'\x0a';if(_0x1b8e0e['search']('520\x20End\x20of\x20proper')!=-0x1){_0x34a187=![];}}else{_0x248c09['rx']=_0x1b8e0e;}if(_0x34a187){return;}if(typeof _0x248c09['cb']==_0xf157('0xb')){var _0x635f07=_0x248c09['rx']['substring'](0x0,0x3),_0x3202f1=null,_0x576406=null;_0x635f07=parseInt(_0x635f07);if(isNaN(_0x635f07)){_0x248c09['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf157('0xc')});return;}if(_0x635f07!=0xc8){_0x248c09['cb'](null,{'code':_0x635f07,'result':-0x1,'extra':'KO'});return;}_0x3202f1=_0x248c09['rx']['substring'](0x4)['replace'](_0xf157('0xd'),'');if(_0x3202f1['indexOf']('\x20')!=-0x1){_0x3202f1=_0x3202f1[_0xf157('0xe')](0x0,_0x3202f1[_0xf157('0xf')]('\x20'));}if(_[_0xf157('0x10')](_0x3202f1,'-1')){_0x3202f1=parseInt(_0x3202f1);}_0x576406=_0x248c09['rx'][_0xf157('0x11')]('\x20');if(_0x576406['length']==0x3){_0x576406=_0x576406[0x2][_0xf157('0x9')](0x1,_0x576406[0x2][_0xf157('0x12')]-0x1);}else if(_0x576406['length']>0x3){var _0x4eb791=/\((.+)\)/;var _0x40f54a=_0x248c09['rx'][_0xf157('0x13')](_0x4eb791);if(_0x40f54a){_0x576406=_0x40f54a[0x1];}else{_0x576406=null;}}else{_0x576406=null;}_0x248c09['cb'](null,{'code':_0x635f07,'result':_0x3202f1,'extra':_0x576406});}});_0x5b15b4['on'](_0xf157('0x14'),function(_0x22c3bb){_0x19d725[_0xf157('0x8')]('error',new AGIError(_0xf157('0x15'),_0x22c3bb[_0xf157('0x16')]));});_0x5b15b4['on'](_0xf157('0x17'),function(){_0x19d725['emit']('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x5b15b4['on']('timeout',function(){_0x19d725[_0xf157('0x8')]('timeout',new AGIError(_0xf157('0x18')));_0x5b15b4[_0xf157('0x19')]();});_0x5b15b4[_0xf157('0x1a')](_0x6920cf);this[_0xf157('0x1b')]=function(_0xb923a8,_0x5f2741){var _0xb923a8=_0xb923a8||'',_0x5f2741=typeof _0x5f2741==_0xf157('0xb')?_0x5f2741:new Function();_0x248c09={'tx':_0xb923a8,'rx':'','cb':_0x5f2741};_0x5b15b4[_0xf157('0x1c')](_0xb923a8+'\x0a');},this[_0xf157('0x17')]=function(){_0x5b15b4[_0xf157('0x19')]();};}util[_0xf157('0x1d')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0xca3935){return this[_0xf157('0x1b')][_0xf157('0x1e')](this,_0xca3935);};AGIChannel['prototype'][_0xf157('0x1f')]=function(){return this[_0xf157('0x20')](_0xf157('0x21'));};AGIChannel[_0xf157('0x22')][_0xf157('0x23')]=function(_0x2d4307,_0x571497,_0x69da8a){_0x2d4307=_0x2d4307===undefined?_0xf157('0x24'):_0x2d4307;_0x571497=_0x571497===undefined?'5':_0x571497;_0x69da8a=_0x69da8a===undefined?'1':_0x69da8a;return this['sendRequest'](util[_0xf157('0x25')](_0xf157('0x26'),_0x2d4307,_0x571497*0x3e8,_0x69da8a));};AGIChannel[_0xf157('0x22')][_0xf157('0x27')]=function(_0x127040){_0x127040=_0x127040||'NO\x20MESSAGE';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x28'),_0x127040));};AGIChannel[_0xf157('0x22')]['exec']=function(_0x2163a2,_0x5300ec){if(_[_0xf157('0x29')](_0x5300ec)){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x2a'),_0x2163a2,_0x5300ec[_0xf157('0x2b')](',')));}return this['sendRequest'](util[_0xf157('0x25')]('EXEC\x20%s\x20%s',_0x2163a2,_0x5300ec));};AGIChannel[_0xf157('0x22')][_0xf157('0x2c')]=function(_0x1bab79){return this[_0xf157('0x20')](util['format']('SET\x20CONTEXT\x20%s',_0x1bab79));};AGIChannel['prototype'][_0xf157('0x2d')]=function(_0x3c4478){return this[_0xf157('0x20')](util['format'](_0xf157('0x2e'),_0x3c4478));};AGIChannel['prototype']['setPriority']=function(_0x5cb727){return this[_0xf157('0x20')](util[_0xf157('0x25')]('SET\x20PRIORITY\x20%s',_0x5cb727));};AGIChannel[_0xf157('0x22')][_0xf157('0x2f')]=function(){return this[_0xf157('0x20')](_0xf157('0x30'));};AGIChannel[_0xf157('0x22')]['setVariable']=function(_0x418381,_0x13f701){var _0x371b9e=_['isBoolean'](_0x13f701)||_['isNumber'](_0x13f701)?_0x13f701[_0xf157('0x31')]():_0x13f701;return this[_0xf157('0x20')](util['format'](_0xf157('0x32'),_0x418381,_0x371b9e?_0x371b9e[_0xf157('0x31')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xf157('0x22')][_0xf157('0x33')]=function(_0x3be27e,_0x592b96){return this[_0xf157('0x20')](util['format'](_0xf157('0x34'),_0x3be27e,_0x592b96));};AGIChannel['prototype'][_0xf157('0x35')]=function(_0x293fdf,_0x5320b3){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x36'),_0x293fdf,_0x5320b3));};AGIChannel[_0xf157('0x22')]['sayPhonetic']=function(_0x3c3e4e,_0x4779e9){return this['sendRequest'](util[_0xf157('0x25')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x3c3e4e,_0x4779e9));};AGIChannel[_0xf157('0x22')]['continueAt']=function(_0x1444e2,_0x24eab0,_0x1bc449){_0x24eab0=_0x24eab0||this[_0xf157('0x37')];_0x1bc449=_0x1bc449||0x1;this[_0xf157('0x2c')](_0x1444e2);this[_0xf157('0x2d')](_0x24eab0);this[_0xf157('0x38')](_0x1bc449);return this['noop'](util[_0xf157('0x25')](_0xf157('0x39'),_0x1444e2,_0x24eab0,_0x1bc449));};AGIChannel[_0xf157('0x22')][_0xf157('0x3a')]=function(_0x53cd2f){return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x3b'),_0x53cd2f));};AGIChannel[_0xf157('0x22')][_0xf157('0x3c')]=function(_0x4a64c4,_0x47ce4e,_0x2d85c0,_0x3546ab,_0x4409af,_0x3ff6f6){_0x47ce4e=_0x47ce4e||_0xf157('0x3d');_0x2d85c0=_0x2d85c0||'';_0x3546ab=_0x3546ab===undefined?-0x1:_0x3546ab==='-1'?-0x1:_0x3546ab*0x3e8;_0x4409af=_0x4409af===undefined?'':'s='+_0x4409af;_0x3ff6f6=_0x3ff6f6?'BEEP':'';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x3e'),_0x4a64c4,_0x47ce4e,_0x2d85c0,_0x3546ab,_0x3ff6f6,_0x4409af));};AGIChannel[_0xf157('0x22')][_0xf157('0x3f')]=function(_0x55c69a,_0x37a1ac){_0x37a1ac=_0x37a1ac||'';return this[_0xf157('0x20')](util[_0xf157('0x25')](_0xf157('0x40'),_0x55c69a,_0x37a1ac));};AGIChannel['prototype'][_0xf157('0x41')]=function(_0x1b8cd8){return this[_0xf157('0x42')](_0xf157('0x43'),_0x1b8cd8);};AGIChannel[_0xf157('0x22')][_0xf157('0x44')]=function(_0xdf739b){return this[_0xf157('0x42')](_0xf157('0x45'),_0xdf739b);};AGIChannel[_0xf157('0x22')][_0xf157('0x14')]=function(_0x20731a,_0x371137){this['noop'](util[_0xf157('0x25')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x20731a['id'],_0x20731a[_0xf157('0x46')],_0x371137));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x3336=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','sendRequest','command','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s'];(function(_0x366412,_0x2899ed){var _0x548fef=function(_0x47c209){while(--_0x47c209){_0x366412['push'](_0x366412['shift']());}};_0x548fef(++_0x2899ed);}(_0x3336,0x106));var _0x6333=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x3336[_0x2b5b44];return _0x32cb66;};'use strict';var util=require(_0x6333('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x6333('0x1')];var AGIReply=require(_0x6333('0x2'));var AGIError=require(_0x6333('0x3'));function AGIChannel(_0x419d8d){var _0x450564=this,_0x371e97=new AGIReply(),_0x4c920e=![],_0xe53ff0={};EventEmitter[_0x6333('0x4')](_0x450564);_0x419d8d[_0x6333('0x5')](_0x6333('0x6'));_0x419d8d[_0x6333('0x7')](0x8*0x3c*0x3c*0x3e8);_0x371e97[_0x6333('0x5')](_0x6333('0x6'));_0x371e97['on'](_0x6333('0x8'),function(_0x38e635){for(var _0x5d04f7 in _0x38e635){_0x450564[_0x5d04f7]=_0x38e635[_0x5d04f7];}_0x450564[_0x6333('0x9')](_0x6333('0xa'));});_0x371e97['on'](_0x6333('0xb'),function(_0x4089da){if(_0x4089da[_0x6333('0xc')]()==_0x6333('0xd')){_0x450564[_0x6333('0x9')](_0x6333('0xd'));return;}if(_0x4089da[_0x6333('0xe')](0x0,0xb)=='520-Invalid'){_0x4c920e=!![];}if(_0x4c920e){_0xe53ff0['rx']+=_0x4089da+'\x0a';if(_0x4089da[_0x6333('0xf')](_0x6333('0x10'))!=-0x1){_0x4c920e=![];}}else{_0xe53ff0['rx']=_0x4089da;}if(_0x4c920e){return;}if(typeof _0xe53ff0['cb']==_0x6333('0x11')){var _0x314587=_0xe53ff0['rx'][_0x6333('0xe')](0x0,0x3),_0x2415b7=null,_0x4a28a2=null;_0x314587=parseInt(_0x314587);if(isNaN(_0x314587)){_0xe53ff0['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x6333('0x12')});return;}if(_0x314587!=0xc8){_0xe53ff0['cb'](null,{'code':_0x314587,'result':-0x1,'extra':'KO'});return;}_0x2415b7=_0xe53ff0['rx']['substring'](0x4)[_0x6333('0x13')]('result=','');if(_0x2415b7[_0x6333('0x14')]('\x20')!=-0x1){_0x2415b7=_0x2415b7[_0x6333('0x15')](0x0,_0x2415b7[_0x6333('0x14')]('\x20'));}if(_[_0x6333('0x16')](_0x2415b7,'-1')){_0x2415b7=parseInt(_0x2415b7);}_0x4a28a2=_0xe53ff0['rx'][_0x6333('0x17')]('\x20');if(_0x4a28a2[_0x6333('0x18')]==0x3){_0x4a28a2=_0x4a28a2[0x2][_0x6333('0xe')](0x1,_0x4a28a2[0x2][_0x6333('0x18')]-0x1);}else if(_0x4a28a2[_0x6333('0x18')]>0x3){var _0x20bc6d=/\((.+)\)/;var _0x1cf029=_0xe53ff0['rx'][_0x6333('0x19')](_0x20bc6d);if(_0x1cf029){_0x4a28a2=_0x1cf029[0x1];}else{_0x4a28a2=null;}}else{_0x4a28a2=null;}_0xe53ff0['cb'](null,{'code':_0x314587,'result':_0x2415b7,'extra':_0x4a28a2});}});_0x419d8d['on'](_0x6333('0x1a'),function(_0x20047e){_0x450564['emit'](_0x6333('0x1a'),new AGIError(_0x6333('0x1b'),_0x20047e[_0x6333('0x1c')]));});_0x419d8d['on'](_0x6333('0x1d'),function(){_0x450564[_0x6333('0x9')]('close',new AGIError(_0x6333('0x1e')));});_0x419d8d['on'](_0x6333('0x1f'),function(){_0x450564[_0x6333('0x9')]('timeout',new AGIError(_0x6333('0x20')));_0x419d8d[_0x6333('0x21')]();});_0x419d8d[_0x6333('0x22')](_0x371e97);this['command']=function(_0x4c2dfb,_0x11c95a){var _0x4c2dfb=_0x4c2dfb||'',_0x11c95a=typeof _0x11c95a==_0x6333('0x11')?_0x11c95a:new Function();_0xe53ff0={'tx':_0x4c2dfb,'rx':'','cb':_0x11c95a};_0x419d8d[_0x6333('0x23')](_0x4c2dfb+'\x0a');},this['close']=function(){_0x419d8d[_0x6333('0x21')]();};}util[_0x6333('0x24')](AGIChannel,EventEmitter);AGIChannel[_0x6333('0x25')][_0x6333('0x26')]=function(_0x18230a){return this[_0x6333('0x27')]['sync'](this,_0x18230a);};AGIChannel[_0x6333('0x25')][_0x6333('0x28')]=function(){return this[_0x6333('0x26')](_0x6333('0x29'));};AGIChannel[_0x6333('0x25')][_0x6333('0x2a')]=function(_0x1d1990,_0x4fd2f6,_0x4e6766){_0x1d1990=_0x1d1990===undefined?_0x6333('0x2b'):_0x1d1990;_0x4fd2f6=_0x4fd2f6===undefined?'5':_0x4fd2f6;_0x4e6766=_0x4e6766===undefined?'1':_0x4e6766;return this[_0x6333('0x26')](util[_0x6333('0x2c')](_0x6333('0x2d'),_0x1d1990,_0x4fd2f6*0x3e8,_0x4e6766));};AGIChannel['prototype'][_0x6333('0x2e')]=function(_0x23aadb){_0x23aadb=_0x23aadb||'NO\x20MESSAGE';return this[_0x6333('0x26')](util[_0x6333('0x2c')](_0x6333('0x2f'),_0x23aadb));};AGIChannel[_0x6333('0x25')][_0x6333('0x30')]=function(_0x3a2372,_0x2f0ae2){if(_[_0x6333('0x31')](_0x2f0ae2)){return this[_0x6333('0x26')](util[_0x6333('0x2c')](_0x6333('0x32'),_0x3a2372,_0x2f0ae2[_0x6333('0x33')](',')));}return this[_0x6333('0x26')](util[_0x6333('0x2c')](_0x6333('0x32'),_0x3a2372,_0x2f0ae2));};AGIChannel[_0x6333('0x25')][_0x6333('0x34')]=function(_0x37e6fc){return this['sendRequest'](util[_0x6333('0x2c')]('SET\x20CONTEXT\x20%s',_0x37e6fc));};AGIChannel['prototype']['setExtension']=function(_0x297f20){return this[_0x6333('0x26')](util[_0x6333('0x2c')]('SET\x20EXTENSION\x20%s',_0x297f20));};AGIChannel[_0x6333('0x25')][_0x6333('0x35')]=function(_0x40f1f4){return this['sendRequest'](util[_0x6333('0x2c')](_0x6333('0x36'),_0x40f1f4));};AGIChannel[_0x6333('0x25')]['hangup']=function(){return this[_0x6333('0x26')](_0x6333('0x37'));};AGIChannel[_0x6333('0x25')][_0x6333('0x38')]=function(_0x1d8c08,_0x5c8bd8){var _0x468f3d=_[_0x6333('0x39')](_0x5c8bd8)||_[_0x6333('0x3a')](_0x5c8bd8)?_0x5c8bd8[_0x6333('0x3b')]():_0x5c8bd8;return this['sendRequest'](util[_0x6333('0x2c')](_0x6333('0x3c'),_0x1d8c08,_0x468f3d?_0x468f3d['toString']()[_0x6333('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x6333('0x25')]['sayNumber']=function(_0x2d5555,_0x3c8710){return this[_0x6333('0x26')](util['format'](_0x6333('0x3d'),_0x2d5555,_0x3c8710));};AGIChannel[_0x6333('0x25')][_0x6333('0x3e')]=function(_0x20412f,_0x537b52){return this['sendRequest'](util['format'](_0x6333('0x3f'),_0x20412f,_0x537b52));};AGIChannel[_0x6333('0x25')][_0x6333('0x40')]=function(_0xa2411c,_0x1ae654){return this[_0x6333('0x26')](util['format'](_0x6333('0x41'),_0xa2411c,_0x1ae654));};AGIChannel[_0x6333('0x25')][_0x6333('0x42')]=function(_0x4c0f24,_0x58a3d3,_0x4c5c70){_0x58a3d3=_0x58a3d3||this[_0x6333('0x43')];_0x4c5c70=_0x4c5c70||0x1;this[_0x6333('0x34')](_0x4c0f24);this[_0x6333('0x44')](_0x58a3d3);this['setPriority'](_0x4c5c70);return this[_0x6333('0x2e')](util[_0x6333('0x2c')](_0x6333('0x45'),_0x4c0f24,_0x58a3d3,_0x4c5c70));};AGIChannel[_0x6333('0x25')][_0x6333('0x46')]=function(_0x501f7d){return this['sendRequest'](util[_0x6333('0x2c')](_0x6333('0x47'),_0x501f7d));};AGIChannel[_0x6333('0x25')]['recordFile']=function(_0x2f498c,_0x4f4336,_0x92dbb6,_0x404c05,_0x527feb,_0x477ab6){_0x4f4336=_0x4f4336||_0x6333('0x48');_0x92dbb6=_0x92dbb6||'';_0x404c05=_0x404c05===undefined?-0x1:_0x404c05==='-1'?-0x1:_0x404c05*0x3e8;_0x527feb=_0x527feb===undefined?'':'s='+_0x527feb;_0x477ab6=_0x477ab6?_0x6333('0x49'):'';return this[_0x6333('0x26')](util[_0x6333('0x2c')](_0x6333('0x4a'),_0x2f498c,_0x4f4336,_0x92dbb6,_0x404c05,_0x477ab6,_0x527feb));};AGIChannel[_0x6333('0x25')][_0x6333('0x4b')]=function(_0xd82819,_0x58eac7){_0x58eac7=_0x58eac7||'';return this[_0x6333('0x26')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xd82819,_0x58eac7));};AGIChannel[_0x6333('0x25')][_0x6333('0x4c')]=function(_0x53d7ac){return this['exec'](_0x6333('0x4d'),_0x53d7ac);};AGIChannel[_0x6333('0x25')][_0x6333('0x4e')]=function(_0x321b37){return this[_0x6333('0x30')](_0x6333('0x4f'),_0x321b37);};AGIChannel[_0x6333('0x25')][_0x6333('0x1a')]=function(_0x15c6b2,_0x3bf144){this[_0x6333('0x2e')](util[_0x6333('0x2c')](_0x6333('0x50'),_0x15c6b2['id'],_0x15c6b2[_0x6333('0x51')],_0x3bf144));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x6333('0x52')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 33f214b..68df02b 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 _0x466d=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x359995,_0x1d13d0){var _0x2d90c0=function(_0x1d005f){while(--_0x1d005f){_0x359995['push'](_0x359995['shift']());}};_0x2d90c0(++_0x1d13d0);}(_0x466d,0x182));var _0xd466=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x466d[_0xf2662b];return _0x257dc7;};'use strict';var util=require(_0xd466('0x0'));var error={'E_AGI_UNDEFINED':_0xd466('0x1'),'E_AGI_ARGUMENT_PORT':_0xd466('0x2'),'E_AGI_SERVER_ERROR':_0xd466('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd466('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd466('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xd466('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xd466('0x7'),'E_AGI_COMMAND_EMPTY':_0xd466('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd466('0x9'),'E_AGI_IVR_ENTRY':_0xd466('0xa')};function AGIError(_0x20e4ef){var _0x20e4ef=_0x20e4ef||null,_0x171ea5=_0x171ea5||[],_0x5b59ed=0x1,_0x52cd5d='';if(!error[_0x20e4ef]){_0x20e4ef='E_AGI_UNDEFINED';}_0x171ea5[_0xd466('0xb')](error[_0x20e4ef]);while(arguments[_0x5b59ed]){_0x171ea5['push'](arguments[_0x5b59ed]);_0x5b59ed++;}_0x52cd5d=util['format'][_0xd466('0xc')](util,_0x171ea5);this['message']=_0x52cd5d;this[_0xd466('0xd')]=_0x20e4ef;}module['exports']=AGIError; \ No newline at end of file +var _0x7790=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x4e624f,_0x488557){var _0x2d8c36=function(_0x4200e7){while(--_0x4200e7){_0x4e624f['push'](_0x4e624f['shift']());}};_0x2d8c36(++_0x488557);}(_0x7790,0x1b4));var _0x0779=function(_0x93ecfe,_0x21a1a8){_0x93ecfe=_0x93ecfe-0x0;var _0xc5470b=_0x7790[_0x93ecfe];return _0xc5470b;};'use strict';var util=require(_0x0779('0x0'));var error={'E_AGI_UNDEFINED':_0x0779('0x1'),'E_AGI_ARGUMENT_PORT':_0x0779('0x2'),'E_AGI_SERVER_ERROR':_0x0779('0x3'),'E_AGI_SERVER_CLOSE':_0x0779('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x0779('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x0779('0x6'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x0779('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x0779('0x8'),'E_AGI_COMMAND_EMPTY':_0x0779('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x0779('0xa'),'E_AGI_IVR_ENTRY':_0x0779('0xb')};function AGIError(_0x1ead58){var _0x1ead58=_0x1ead58||null,_0x38022f=_0x38022f||[],_0xf69405=0x1,_0x1a4b91='';if(!error[_0x1ead58]){_0x1ead58=_0x0779('0xc');}_0x38022f[_0x0779('0xd')](error[_0x1ead58]);while(arguments[_0xf69405]){_0x38022f[_0x0779('0xd')](arguments[_0xf69405]);_0xf69405++;}_0x1a4b91=util[_0x0779('0xe')][_0x0779('0xf')](util,_0x38022f);this[_0x0779('0x10')]=_0x1a4b91;this[_0x0779('0x11')]=_0x1ead58;}module[_0x0779('0x12')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 68344c7..b3ac89d 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1635=['error','E_AGI_SERVER_ERROR','projectUpdate','emit','lodash','events','ioredis','./error','redis','localhost','subscribe','agi'];(function(_0x3ef535,_0x38b557){var _0x318b35=function(_0xb44489){while(--_0xb44489){_0x3ef535['push'](_0x3ef535['shift']());}};_0x318b35(++_0x38b557);}(_0x1635,0xe8));var _0x5163=function(_0x52704a,_0x1c46aa){_0x52704a=_0x52704a-0x0;var _0x77f14c=_0x1635[_0x52704a];return _0x77f14c;};'use strict';var _=require(_0x5163('0x0'));var EventEmitter=require(_0x5163('0x1'))['EventEmitter'];var Redis=require(_0x5163('0x2'));var AGIError=require(_0x5163('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x5163('0x4')],{'host':_0x5163('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5163('0x4')]);sub[_0x5163('0x6')](_0x5163('0x7'),function(_0xed4295){if(_0xed4295)return eventEmitter['emit'](_0x5163('0x8'),new AGIError(_0x5163('0x9'),_0xed4295));});sub['on']('message',function(_0x657de0,_0x519505){if(_0x657de0!==_0x5163('0x7'))return;try{var _0x2b5e8f=JSON['parse'](_0x519505);eventEmitter['emit'](_0x5163('0xa'),_0x2b5e8f);}catch(_0x1a97ab){eventEmitter[_0x5163('0xb')](_0x5163('0x8'),new AGIError(_0x5163('0x9'),_0x1a97ab));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x90eb=['exports','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','error','E_AGI_SERVER_ERROR','message','parse','emit'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x90eb,0x1a5));var _0xb90e=function(_0x483870,_0x515904){_0x483870=_0x483870-0x0;var _0xa44164=_0x90eb[_0x483870];return _0xa44164;};'use strict';var _=require('lodash');var EventEmitter=require(_0xb90e('0x0'))[_0xb90e('0x1')];var Redis=require(_0xb90e('0x2'));var AGIError=require(_0xb90e('0x3'));var config=require(_0xb90e('0x4'));config[_0xb90e('0x5')]=_[_0xb90e('0x6')](config[_0xb90e('0x5')],{'host':_0xb90e('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xb90e('0x5')]);sub[_0xb90e('0x8')]('agi',function(_0x220b9f){if(_0x220b9f)return eventEmitter['emit'](_0xb90e('0x9'),new AGIError(_0xb90e('0xa'),_0x220b9f));});sub['on'](_0xb90e('0xb'),function(_0x103d8b,_0x23e807){if(_0x103d8b!=='agi')return;try{var _0x555819=JSON[_0xb90e('0xc')](_0x23e807);eventEmitter['emit']('projectUpdate',_0x555819);}catch(_0x39d96d){eventEmitter[_0xb90e('0xd')]('error',new AGIError(_0xb90e('0xa'),_0x39d96d));}});module[_0xb90e('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1246370..6f8887d 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 _0xea56=['vswitch','target','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','prototype','addVertex','edges','addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition'];(function(_0x2b098d,_0x40ffd0){var _0x4208f7=function(_0x42fa21){while(--_0x42fa21){_0x2b098d['push'](_0x2b098d['shift']());}};_0x4208f7(++_0x40ffd0);}(_0xea56,0xd4));var _0x6ea5=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0xea56[_0x270dba];return _0x36b83b;};'use strict';var _=require(_0x6ea5('0x0'));var logger=require(_0x6ea5('0x1'))('agi');var verticesWithRetry=[_0x6ea5('0x2'),_0x6ea5('0x3'),_0x6ea5('0x4')];var Graph=function(){this[_0x6ea5('0x5')]={};this['edges']={};this['numberOfEdges']=0x0;};Graph[_0x6ea5('0x6')][_0x6ea5('0x7')]=function(_0x3acc99){this[_0x6ea5('0x5')][_0x3acc99['id']]=_0x3acc99;this[_0x6ea5('0x8')][_0x3acc99['id']]=[];};Graph[_0x6ea5('0x6')][_0x6ea5('0x9')]=function(_0x274605,_0x60ad75,_0x11b037){this[_0x6ea5('0x8')][_0x274605]['push']({'target':_0x60ad75,'condition':_0x11b037});this[_0x6ea5('0xa')]+=0x1;};Graph['prototype'][_0x6ea5('0xb')]=function(){return _[_0x6ea5('0xb')](this[_0x6ea5('0x5')]);};Graph['prototype'][_0x6ea5('0xc')]=function(){return this[_0x6ea5('0xa')];};Graph[_0x6ea5('0x6')][_0x6ea5('0xd')]=function(_0x550f10){return this[_0x6ea5('0x5')][_0x550f10];};Graph['prototype'][_0x6ea5('0xe')]=function(_0x11a7c2,_0xf75a0b){if(!this[_0x6ea5('0x5')][_0x11a7c2]){return logger[_0x6ea5('0xf')](_0x6ea5('0x10'));}var _0x1dd84d=_0xf75a0b(this['vertices'][_0x11a7c2]);if(!_0x1dd84d){return logger['info']('stop\x20traverse');}if(this[_0x6ea5('0x8')][_0x11a7c2]['length']===0x0){return logger[_0x6ea5('0xf')](_0x6ea5('0x11'));}for(var _0x4c7fe4=0x0,_0x4a0298=[],_0x39b702=![];_0x4c7fe4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','close','handleNotFound','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','syncho','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','error','stack','findIndex'];(function(_0x4655bf,_0x7daea2){var _0x4a5344=function(_0x5a74ee){while(--_0x5a74ee){_0x4655bf['push'](_0x4655bf['shift']());}};_0x4a5344(++_0x7daea2);}(_0xaecb,0x1f2));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var syncho=require(_0xbaec('0x0'));var util=require('util');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xbaec('0x1'));var utilLicense=require(_0xbaec('0x2'));var rpc=require(_0xbaec('0x3'));var Project=require(_0xbaec('0x4'));var AGIEmitter=require(_0xbaec('0x5'))[_0xbaec('0x6')];var projects=[];config[_0xbaec('0x1')]=_[_0xbaec('0x7')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xbaec('0x8'),projectUpdateHandler);function connectionHandler(_0x3ad86e){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3ad86e);agiHandler(_0x3ad86e);}catch(_0x207db7){logger[_0xbaec('0x9')](_0x207db7[_0xbaec('0xa')]);}});});}function projectUpdateHandler(_0x1e25e0){try{var _0x132c75=_[_0xbaec('0xb')](projects,['id',_0x1e25e0['id']]);if(_0x132c75>-0x1){if(_0x1e25e0[_0xbaec('0xc')]===!![]){projects['splice'](_0x132c75,0x1);}else{projects[_0x132c75]=_0x1e25e0;}}else{projects[_0xbaec('0xd')](_0x1e25e0);}}catch(_0x1d1961){logger[_0xbaec('0x9')](_0x1d1961[_0xbaec('0xa')]);}}function listeningHandler(){console[_0xbaec('0xe')](_0xbaec('0xf'),config[_0xbaec('0x1')][_0xbaec('0x10')]);logger[_0xbaec('0x11')](util['format'](_0xbaec('0x12'),config['agi']['ip'],config[_0xbaec('0x1')]['port']));}function errorHandler(_0x434909){if(_0x434909&&_0x434909[_0xbaec('0x13')]&&_0x434909[_0xbaec('0x14')]){logger['error'](util[_0xbaec('0x15')](_0xbaec('0x16'),_0x434909[_0xbaec('0x13')],_0x434909[_0xbaec('0x14')]));}else{logger[_0xbaec('0x9')](util[_0xbaec('0x15')](_0xbaec('0x17'),_0x434909['stack']));}}function closeHandler(){logger[_0xbaec('0x11')](util[_0xbaec('0x15')](_0xbaec('0x18'),this[_0xbaec('0x19')],this[_0xbaec('0x1a')],this[_0xbaec('0x1b')],this['dnid'],this[_0xbaec('0x1c')]));try{createSquareReport(this);}catch(_0x4c7dcf){logger['error'](_0x4c7dcf[_0xbaec('0xa')]);}}function timeoutHandler(){logger[_0xbaec('0x11')](util[_0xbaec('0x15')](_0xbaec('0x1d'),this[_0xbaec('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xbaec('0x1c')]));}function hangupHandler(){logger['info'](util['format'](_0xbaec('0x1e'),this[_0xbaec('0x19')],this['calleridname'],this[_0xbaec('0x1b')],this['dnid'],this[_0xbaec('0x1c')]));this[_0xbaec('0x1f')]=!![];}function createSquareReport(_0x169c98,_0x30ac4b){rpc[_0xbaec('0x20')](_0x169c98)['then'](function(_0x3b04e5){if(_0x30ac4b){_0x30ac4b(null,_0x3b04e5);}})[_0xbaec('0x21')](function(_0x2964f9){if(_0x30ac4b){_0x30ac4b(null,_0x2964f9);}});}function setChannelVariables(_0x58bb07){for(var _0x4965ee in _0x58bb07){if(_0x58bb07[_0xbaec('0x22')](_0x4965ee)){if(_0x4965ee[_0xbaec('0x23')](_0xbaec('0x24'))===0x0){_0x58bb07[_0x4965ee[_0xbaec('0x25')](0x4)]=_0x58bb07[_0x4965ee];delete _0x58bb07[_0x4965ee];}}}}function agiHandler(_0x3452fe){logger['debug'](_0xbaec('0x26'),JSON[_0xbaec('0x27')](_0x3452fe,null,0x2));logger[_0xbaec('0x11')](util[_0xbaec('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3452fe['arg_1'],_0x3452fe[_0xbaec('0x1a')],_0x3452fe[_0xbaec('0x1b')],_0x3452fe['dnid'],_0x3452fe[_0xbaec('0x1c')]));_0x3452fe['on'](_0xbaec('0x9'),errorHandler);_0x3452fe['on'](_0xbaec('0x28'),closeHandler);_0x3452fe['on']('timeout',timeoutHandler);_0x3452fe['evtHangup']=![];_0x3452fe['on']('hangup',hangupHandler);var _0x4063a0=_['find'](projects,[_0xbaec('0x13'),_0x3452fe[_0xbaec('0x19')]]);if(!_0x4063a0)return Project[_0xbaec('0x29')](_0x3452fe);if(!_0x4063a0['production'])return Project[_0xbaec('0x2a')](_0x3452fe);return Project[_0xbaec('0x2b')](_0x4063a0,_0x3452fe);}function main(){var _0x19a6d2;return utilLicense['getLicense']()[_0xbaec('0x2c')](function(_0x30734a){if(!_0x30734a)return;if(_0x30734a[_0xbaec('0x2d')]){if(_0x30734a['callysquare']&&_0x30734a[_0xbaec('0x2e')]>0x0){logger['info'](util[_0xbaec('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x30734a[_0xbaec('0x2e')]));_0x19a6d2=_0x30734a[_0xbaec('0x2e')];}else{logger[_0xbaec('0x11')](_0xbaec('0x2f'));}}else{logger[_0xbaec('0x11')](_0xbaec('0x30'));_0x19a6d2=-0x1;}})[_0xbaec('0x2c')](function(){return Project[_0xbaec('0x31')]();})[_0xbaec('0x2c')](function(_0x17c7bf){projects=_0x17c7bf;return;})[_0xbaec('0x21')](function(_0x5479e0){logger[_0xbaec('0x9')]('[LICENSE]',_0x5479e0['stack']);})[_0xbaec('0x32')](function(){var _0x4d4472=require('./server')(config[_0xbaec('0x1')][_0xbaec('0x10')],config['agi']['ip'],_0x19a6d2);_0x4d4472['on'](_0xbaec('0x9'),errorHandler);_0x4d4472['on']('listening',listeningHandler);_0x4d4472['on']('connection',connectionHandler);_0x4d4472['on'](_0xbaec('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0x2d18=['../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','defaults','error','stack','splice','push','log','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','info','arg_1','calleridname','callerid','dnid','uniqueid','evtHangup','createSquareReport','then','catch','agi_','substring','debug','variables','stringify','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','getLicense','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','lodash','syncho','util'];(function(_0x37940f,_0x381ddf){var _0x44f648=function(_0xbf5405){while(--_0xbf5405){_0x37940f['push'](_0x37940f['shift']());}};_0x44f648(++_0x381ddf);}(_0x2d18,0x101));var _0x82d1=function(_0x5a9885,_0x567f93){_0x5a9885=_0x5a9885-0x0;var _0x565161=_0x2d18[_0x5a9885];return _0x565161;};'use strict';var _=require(_0x82d1('0x0'));var syncho=require(_0x82d1('0x1'));var util=require(_0x82d1('0x2'));var config=require(_0x82d1('0x3'));var logger=require(_0x82d1('0x4'))(_0x82d1('0x5'));var utilLicense=require(_0x82d1('0x6'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0x82d1('0x7'))[_0x82d1('0x8')];var projects=[];config[_0x82d1('0x5')]=_[_0x82d1('0x9')](config[_0x82d1('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x36c6e4){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x36c6e4);agiHandler(_0x36c6e4);}catch(_0x403528){logger[_0x82d1('0xa')](_0x403528[_0x82d1('0xb')]);}});});}function projectUpdateHandler(_0x4fd05c){try{var _0x1826ac=_['findIndex'](projects,['id',_0x4fd05c['id']]);if(_0x1826ac>-0x1){if(_0x4fd05c['deleted']===!![]){projects[_0x82d1('0xc')](_0x1826ac,0x1);}else{projects[_0x1826ac]=_0x4fd05c;}}else{projects[_0x82d1('0xd')](_0x4fd05c);}}catch(_0x3f10a6){logger['error'](_0x3f10a6['stack']);}}function listeningHandler(){console[_0x82d1('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x82d1('0x5')][_0x82d1('0xf')]);logger['info'](util['format'](_0x82d1('0x10'),config[_0x82d1('0x5')]['ip'],config['agi'][_0x82d1('0xf')]));}function errorHandler(_0x3c3061){if(_0x3c3061&&_0x3c3061[_0x82d1('0x11')]&&_0x3c3061[_0x82d1('0x12')]){logger[_0x82d1('0xa')](util[_0x82d1('0x13')](_0x82d1('0x14'),_0x3c3061[_0x82d1('0x11')],_0x3c3061['message']));}else{logger['error'](util[_0x82d1('0x13')](_0x82d1('0x15'),_0x3c3061[_0x82d1('0xb')]));}}function closeHandler(){logger[_0x82d1('0x16')](util[_0x82d1('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x82d1('0x17')],this[_0x82d1('0x18')],this[_0x82d1('0x19')],this[_0x82d1('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x1c6a9){logger['error'](_0x1c6a9['stack']);}}function timeoutHandler(){logger[_0x82d1('0x16')](util[_0x82d1('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x82d1('0x17')],this['calleridname'],this[_0x82d1('0x19')],this[_0x82d1('0x1a')],this[_0x82d1('0x1b')]));}function hangupHandler(){logger['info'](util[_0x82d1('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x82d1('0x17')],this[_0x82d1('0x18')],this['callerid'],this[_0x82d1('0x1a')],this['uniqueid']));this[_0x82d1('0x1c')]=!![];}function createSquareReport(_0xc5afae,_0x282af9){rpc[_0x82d1('0x1d')](_0xc5afae)[_0x82d1('0x1e')](function(_0x515fd2){if(_0x282af9){_0x282af9(null,_0x515fd2);}})[_0x82d1('0x1f')](function(_0x424230){if(_0x282af9){_0x282af9(null,_0x424230);}});}function setChannelVariables(_0xcf2bc){for(var _0x43949d in _0xcf2bc){if(_0xcf2bc['hasOwnProperty'](_0x43949d)){if(_0x43949d['indexOf'](_0x82d1('0x20'))===0x0){_0xcf2bc[_0x43949d[_0x82d1('0x21')](0x4)]=_0xcf2bc[_0x43949d];delete _0xcf2bc[_0x43949d];}}}}function agiHandler(_0x2d4987){logger[_0x82d1('0x22')](_0x82d1('0x23'),JSON[_0x82d1('0x24')](_0x2d4987,null,0x2));logger[_0x82d1('0x16')](util[_0x82d1('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2d4987[_0x82d1('0x17')],_0x2d4987[_0x82d1('0x18')],_0x2d4987['callerid'],_0x2d4987[_0x82d1('0x1a')],_0x2d4987['uniqueid']));_0x2d4987['on']('error',errorHandler);_0x2d4987['on'](_0x82d1('0x25'),closeHandler);_0x2d4987['on'](_0x82d1('0x26'),timeoutHandler);_0x2d4987[_0x82d1('0x1c')]=![];_0x2d4987['on'](_0x82d1('0x27'),hangupHandler);var _0x3c1509=_['find'](projects,[_0x82d1('0x11'),_0x2d4987['arg_1']]);if(!_0x3c1509)return Project[_0x82d1('0x28')](_0x2d4987);if(!_0x3c1509[_0x82d1('0x29')])return Project[_0x82d1('0x2a')](_0x2d4987);return Project[_0x82d1('0x2b')](_0x3c1509,_0x2d4987);}function main(){var _0x1e661d;return utilLicense[_0x82d1('0x2c')]()['then'](function(_0x28de91){if(!_0x28de91)return;if(_0x28de91['voice']){if(_0x28de91['callysquare']&&_0x28de91['callysquare']>0x0){logger[_0x82d1('0x16')](util[_0x82d1('0x13')](_0x82d1('0x2d'),_0x28de91[_0x82d1('0x2e')]));_0x1e661d=_0x28de91[_0x82d1('0x2e')];}else{logger[_0x82d1('0x16')](_0x82d1('0x2f'));}}else{logger[_0x82d1('0x16')](_0x82d1('0x30'));_0x1e661d=-0x1;}})['then'](function(){return Project['getAll']();})[_0x82d1('0x1e')](function(_0x5ecdc2){projects=_0x5ecdc2;return;})['catch'](function(_0x1ca249){logger[_0x82d1('0xa')](_0x82d1('0x31'),_0x1ca249[_0x82d1('0xb')]);})[_0x82d1('0x32')](function(){var _0x4a6144=require(_0x82d1('0x33'))(config['agi']['port'],config[_0x82d1('0x5')]['ip'],_0x1e661d);_0x4a6144['on'](_0x82d1('0xa'),errorHandler);_0x4a6144['on']('listening',listeningHandler);_0x4a6144['on']('connection',connectionHandler);_0x4a6144['on'](_0x82d1('0x25'),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 fc483ce..ac295cf 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 _0x3971=['jayson/promise','http','then','error','sendMailMessage','SendMail','bluebird'];(function(_0x2b4cd0,_0x457878){var _0x474616=function(_0x435315){while(--_0x435315){_0x2b4cd0['push'](_0x2b4cd0['shift']());}};_0x474616(++_0x457878);}(_0x3971,0x180));var _0x1397=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x3971[_0x210603];return _0x1bcb7d;};'use strict';var BPromise=require(_0x1397('0x0'));var jayson=require(_0x1397('0x1'));var client=jayson['client'][_0x1397('0x2')]({'port':0x232b});function request(_0x41af67,_0x2a375e){return new BPromise(function(_0x139f5f,_0x15f038){return client['request'](_0x41af67,_0x2a375e)[_0x1397('0x3')](function(_0x3bded0){if(_0x3bded0[_0x1397('0x4')]){return _0x15f038(_0x3bded0[_0x1397('0x4')]['message']);}else{return _0x139f5f(_0x3bded0['result']);}})['catch'](function(_0x17ff9b){return _0x15f038(_0x17ff9b);});});}exports[_0x1397('0x5')]=function(_0x2a06c3,_0x523d18){return request(_0x1397('0x6'),{'account':_0x2a06c3,'message':_0x523d18});}; \ No newline at end of file +var _0xf7a1=['catch','sendMailMessage','SendMail','jayson/promise','client','http','request','error','result'];(function(_0x308d75,_0x308317){var _0x4af568=function(_0x2b2b74){while(--_0x2b2b74){_0x308d75['push'](_0x308d75['shift']());}};_0x4af568(++_0x308317);}(_0xf7a1,0x159));var _0x1f7a=function(_0xb983c4,_0x679e53){_0xb983c4=_0xb983c4-0x0;var _0x4d4570=_0xf7a1[_0xb983c4];return _0x4d4570;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1f7a('0x0'));var client=jayson[_0x1f7a('0x1')][_0x1f7a('0x2')]({'port':0x232b});function request(_0x44eb22,_0x4a1967){return new BPromise(function(_0x2f04ea,_0x2ec3df){return client[_0x1f7a('0x3')](_0x44eb22,_0x4a1967)['then'](function(_0x30d04f){if(_0x30d04f[_0x1f7a('0x4')]){return _0x2ec3df(_0x30d04f[_0x1f7a('0x4')]['message']);}else{return _0x2f04ea(_0x30d04f[_0x1f7a('0x5')]);}})[_0x1f7a('0x6')](function(_0x253091){return _0x2ec3df(_0x253091);});});}exports[_0x1f7a('0x7')]=function(_0x37f13d,_0x102ed7){return request(_0x1f7a('0x8'),{'account':_0x37f13d,'message':_0x102ed7});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7c98f6c..432741e 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x745f=['length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','stringify','joinAt','format','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','isArray'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x745f,0x199));var _0xf745=function(_0x1db481,_0x1627b2){_0x1db481=_0x1db481-0x0;var _0x3db95b=_0x745f[_0x1db481];return _0x3db95b;};'use strict';var _=require(_0xf745('0x0'));var moment=require(_0xf745('0x1'));var parser=require('xml2json');var util=require(_0xf745('0x2'));var logger=require(_0xf745('0x3'))(_0xf745('0x4'));var rpc=require(_0xf745('0x5'));var mailRpc=require(_0xf745('0x6'));var Graph=require(_0xf745('0x7'));var Vertices=require(_0xf745('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xf745('0x9')]()[_0xf745('0xa')](function(_0x4b7375){logger['error'](_0xf745('0xb'),_0x4b7375[_0xf745('0xc')]);return[];});}function addVertex(_0x46efbb,_0x13bf2a,_0x2bffb6){_0x13bf2a[_0xf745('0xd')]=_0x2bffb6;if(_0x13bf2a[_0xf745('0xe')](_0xf745('0xf'))){_0x13bf2a['maxRetry']=parseInt(_0x13bf2a['retry'],0xa);}_0x46efbb['addVertex'](_[_0xf745('0x10')](_0x13bf2a,'mxCell'));}function initGraph(_0x577e44,_0x3aabf6){var _0x3708ea=new Graph();for(var _0xc5402c in _0x577e44){if(_0x577e44[_0xf745('0xe')](_0xc5402c)){if(_[_0xf745('0x11')](_0x577e44[_0xc5402c])){for(var _0x547227=0x0;_0x547227<_0x577e44[_0xc5402c][_0xf745('0x12')];_0x547227+=0x1){addVertex(_0x3708ea,_0x577e44[_0xc5402c][_0x547227],_0xc5402c);}}else{addVertex(_0x3708ea,_0x577e44[_0xc5402c],_0xc5402c);}}}for(var _0x417629=0x0;_0x417629<_0x3aabf6['length'];_0x417629+=0x1){if(_0x3aabf6[_0x417629][_0xf745('0x13')]&&_0x3aabf6[_0x417629][_0xf745('0x14')]){_0x3708ea[_0xf745('0x15')](_0x3aabf6[_0x417629]['source'],_0x3aabf6[_0x417629][_0xf745('0x14')],_0x3aabf6[_0x417629][_0xf745('0x16')]);}}return _0x3708ea;}function getRoot(_0x168c14){return parser[_0xf745('0x17')](_0x168c14,{'object':!![]})[_0xf745('0x18')][_0xf745('0x19')];}function inspect(_0x1b1930){return util['inspect'](_0x1b1930,{'showHidden':![],'depth':null});}function initialize(_0x4895ba,_0x6e384b){var _0x4ac840=getRoot(_0x4895ba[_0xf745('0x1a')]);if(!_0x4ac840||!_0x4ac840[_0xf745('0x1b')])return;var _0x60420,_0x59b387,_0x3d4d30;logger['debug']('root',JSON[_0xf745('0x1c')](_0x4ac840,null,0x2));_0x6e384b[_0xf745('0x1d')]=moment()[_0xf745('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');_0x60420=initGraph(_['omit'](_0x4ac840,'mxCell'),_0x4ac840[_0xf745('0x1f')]);_0x59b387=new Vertices(_0x6e384b,rpc,mailRpc);logger[_0xf745('0x20')](util[_0xf745('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x6e384b[_0xf745('0x21')],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b[_0xf745('0x24')],_0x6e384b[_0xf745('0x25')]));_0x60420[_0xf745('0x26')](_0x4ac840[_0xf745('0x1b')]['id'],function(_0x54e00e){try{_0x54e00e=_0x59b387[_0xf745('0x27')](_0x54e00e);logger[_0xf745('0x28')](_0xf745('0x29'),JSON[_0xf745('0x1c')](_0x54e00e,null,0x2));if(_0x54e00e['agicommand']==='gotoc'){logger[_0xf745('0x20')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x6e384b[_0xf745('0x2a')]=_0x54e00e[_0xf745('0x2a')]||_0x6e384b['context'];_0x6e384b[_0xf745('0x2b')]=_0x54e00e['extension'];_0x6e384b[_0xf745('0x2c')]=_0x54e00e[_0xf745('0x2c')]?_0x54e00e[_0xf745('0x2c')]-0x1:0x1;return null;}else if(_0x54e00e&&_0x59b387[_0x54e00e[_0xf745('0xd')]]){_0x3d4d30=_0x59b387[_0x54e00e[_0xf745('0xd')]](_0x54e00e);logger[_0xf745('0x20')](_0xf745('0x2d'),JSON[_0xf745('0x1c')](_0x3d4d30,null,0x2));if(_0x3d4d30&&_0x3d4d30[_0xf745('0x2e')]===AGI_CODE_SUCCESS&&_0x3d4d30[_0xf745('0x2f')]!==AGI_RESULT_ERROR&&!_0x6e384b[_0xf745('0x30')]){logger[_0xf745('0x28')]('response',inspect(_0x3d4d30));return _[_0xf745('0x31')](_0x3d4d30['result'])?null:_0x3d4d30['result'][_0xf745('0x32')]();}else{logger[_0xf745('0x33')]('response',inspect(_0x3d4d30));return null;}}else{logger[_0xf745('0x33')](_0xf745('0x34'));return null;}}catch(_0x353068){logger['error'](_0x353068[_0xf745('0xc')]);return null;}});if(_0x4ac840[_0xf745('0x35')]){logger[_0xf745('0x20')](util['format'](_0xf745('0x36'),_0x6e384b[_0xf745('0x21')],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b['dnid'],_0x6e384b['uniqueid']));_0x60420['traverseBFS'](_0x4ac840[_0xf745('0x35')]['id'],function(_0x244af1){try{_0x244af1=_0x59b387[_0xf745('0x27')](_0x244af1);logger[_0xf745('0x28')](_0xf745('0x29'),JSON[_0xf745('0x1c')](_0x244af1,null,0x2));if(_0x244af1&&_0x59b387[_0x244af1[_0xf745('0xd')]]){_0x3d4d30=_0x59b387[_0x244af1[_0xf745('0xd')]](_0x244af1);if(_0x3d4d30){logger[_0xf745('0x28')](_0xf745('0x2d'),inspect(_0x3d4d30));return _['isUndefined'](_0x3d4d30[_0xf745('0x2f')])?null:_0x3d4d30[_0xf745('0x2f')][_0xf745('0x32')]();}else{logger['error'](_0xf745('0x2d'),inspect(_0x3d4d30));return null;}}else{logger[_0xf745('0x33')](_0xf745('0x34'));return null;}}catch(_0x3fefe0){logger['error'](_0x3fefe0[_0xf745('0xc')]);return null;}});}logger['info'](util[_0xf745('0x1e')](_0xf745('0x37'),_0x6e384b['arg_1'],_0x6e384b[_0xf745('0x22')],_0x6e384b[_0xf745('0x23')],_0x6e384b['dnid'],_0x6e384b[_0xf745('0x25')]));logger[_0xf745('0x20')](util[_0xf745('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x6e384b[_0xf745('0x2a')],_0x6e384b[_0xf745('0x2b')],parseInt(_0x6e384b[_0xf745('0x2c')],0xa)+0x1));_0x6e384b[_0xf745('0x38')](_0x6e384b[_0xf745('0x2a')],_0x6e384b['extension'],parseInt(_0x6e384b[_0xf745('0x2c')],0xa)+0x1);_0x6e384b[_0xf745('0x39')]();}function handleNotFound(_0x3045ce){logger[_0xf745('0x33')](util['format'](_0xf745('0x3a'),_0x3045ce[_0xf745('0x21')]));_0x3045ce['continueAt'](_0x3045ce[_0xf745('0x2a')],_0x3045ce[_0xf745('0x2b')],parseInt(_0x3045ce['priority'],0xa)+0x1);_0x3045ce['close']();}function handleUnpublished(_0x454f9c){logger[_0xf745('0x33')](util['format'](_0xf745('0x3b'),_0x454f9c[_0xf745('0x21')]));_0x454f9c['continueAt'](_0x454f9c[_0xf745('0x2a')],_0x454f9c[_0xf745('0x2b')],parseInt(_0x454f9c[_0xf745('0x2c')],0xa)+0x1);_0x454f9c[_0xf745('0x39')]();}module[_0xf745('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x0724=['agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','evtHangup','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20found','continueAt','close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','addVertex','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex'];(function(_0x385aa6,_0x45f973){var _0x2e1305=function(_0x46eb3c){while(--_0x46eb3c){_0x385aa6['push'](_0x385aa6['shift']());}};_0x2e1305(++_0x45f973);}(_0x0724,0x150));var _0x4072=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0724[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4072('0x0'));var moment=require(_0x4072('0x1'));var parser=require(_0x4072('0x2'));var util=require(_0x4072('0x3'));var logger=require(_0x4072('0x4'))(_0x4072('0x5'));var rpc=require('./rpc');var mailRpc=require(_0x4072('0x6'));var Graph=require(_0x4072('0x7'));var Vertices=require(_0x4072('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x4072('0x9')](function(_0x3ec786){logger[_0x4072('0xa')](_0x4072('0xb'),_0x3ec786[_0x4072('0xc')]);return[];});}function addVertex(_0x2ff326,_0x580228,_0x5cc0eb){_0x580228['agicommand']=_0x5cc0eb;if(_0x580228['hasOwnProperty'](_0x4072('0xd'))){_0x580228['maxRetry']=parseInt(_0x580228[_0x4072('0xd')],0xa);}_0x2ff326[_0x4072('0xe')](_[_0x4072('0xf')](_0x580228,'mxCell'));}function initGraph(_0x54795c,_0x15ea80){var _0x21889d=new Graph();for(var _0x54763f in _0x54795c){if(_0x54795c[_0x4072('0x10')](_0x54763f)){if(_[_0x4072('0x11')](_0x54795c[_0x54763f])){for(var _0x1dd46e=0x0;_0x1dd46e<_0x54795c[_0x54763f]['length'];_0x1dd46e+=0x1){addVertex(_0x21889d,_0x54795c[_0x54763f][_0x1dd46e],_0x54763f);}}else{addVertex(_0x21889d,_0x54795c[_0x54763f],_0x54763f);}}}for(var _0x2771bf=0x0;_0x2771bf<_0x15ea80[_0x4072('0x12')];_0x2771bf+=0x1){if(_0x15ea80[_0x2771bf][_0x4072('0x13')]&&_0x15ea80[_0x2771bf][_0x4072('0x14')]){_0x21889d[_0x4072('0x15')](_0x15ea80[_0x2771bf][_0x4072('0x13')],_0x15ea80[_0x2771bf]['target'],_0x15ea80[_0x2771bf][_0x4072('0x16')]);}}return _0x21889d;}function getRoot(_0x2853c0){return parser[_0x4072('0x17')](_0x2853c0,{'object':!![]})[_0x4072('0x18')][_0x4072('0x19')];}function inspect(_0x372a3f){return util['inspect'](_0x372a3f,{'showHidden':![],'depth':null});}function initialize(_0x181080,_0x39e75f){var _0x34d3bb=getRoot(_0x181080[_0x4072('0x1a')]);if(!_0x34d3bb||!_0x34d3bb[_0x4072('0x1b')])return;var _0x57f973,_0x4a003b,_0x43bfaa;logger[_0x4072('0x1c')](_0x4072('0x19'),JSON[_0x4072('0x1d')](_0x34d3bb,null,0x2));_0x39e75f['joinAt']=moment()[_0x4072('0x1e')](_0x4072('0x1f'));_0x57f973=initGraph(_['omit'](_0x34d3bb,_0x4072('0x20')),_0x34d3bb['mxCell']);_0x4a003b=new Vertices(_0x39e75f,rpc,mailRpc);logger[_0x4072('0x21')](util['format'](_0x4072('0x22'),_0x39e75f['arg_1'],_0x39e75f[_0x4072('0x23')],_0x39e75f[_0x4072('0x24')],_0x39e75f[_0x4072('0x25')],_0x39e75f[_0x4072('0x26')]));_0x57f973[_0x4072('0x27')](_0x34d3bb[_0x4072('0x1b')]['id'],function(_0x5932fc){try{_0x5932fc=_0x4a003b[_0x4072('0x28')](_0x5932fc);logger[_0x4072('0x1c')](_0x4072('0x29'),JSON[_0x4072('0x1d')](_0x5932fc,null,0x2));if(_0x5932fc[_0x4072('0x2a')]===_0x4072('0x2b')){logger[_0x4072('0x21')](_0x4072('0x2c'));_0x39e75f[_0x4072('0x2d')]=_0x5932fc[_0x4072('0x2d')]||_0x39e75f[_0x4072('0x2d')];_0x39e75f[_0x4072('0x2e')]=_0x5932fc[_0x4072('0x2e')];_0x39e75f[_0x4072('0x2f')]=_0x5932fc[_0x4072('0x2f')]?_0x5932fc[_0x4072('0x2f')]-0x1:0x1;return null;}else if(_0x5932fc&&_0x4a003b[_0x5932fc[_0x4072('0x2a')]]){_0x43bfaa=_0x4a003b[_0x5932fc[_0x4072('0x2a')]](_0x5932fc);logger[_0x4072('0x21')]('response',JSON[_0x4072('0x1d')](_0x43bfaa,null,0x2));if(_0x43bfaa&&_0x43bfaa['code']===AGI_CODE_SUCCESS&&_0x43bfaa[_0x4072('0x30')]!==AGI_RESULT_ERROR&&!_0x39e75f[_0x4072('0x31')]){logger[_0x4072('0x1c')](_0x4072('0x32'),inspect(_0x43bfaa));return _[_0x4072('0x33')](_0x43bfaa['result'])?null:_0x43bfaa['result'][_0x4072('0x34')]();}else{logger['error'](_0x4072('0x32'),inspect(_0x43bfaa));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x3ba925){logger[_0x4072('0xa')](_0x3ba925[_0x4072('0xc')]);return null;}});if(_0x34d3bb[_0x4072('0x35')]){logger[_0x4072('0x21')](util['format'](_0x4072('0x36'),_0x39e75f[_0x4072('0x37')],_0x39e75f[_0x4072('0x23')],_0x39e75f['callerid'],_0x39e75f['dnid'],_0x39e75f[_0x4072('0x26')]));_0x57f973[_0x4072('0x27')](_0x34d3bb['finally']['id'],function(_0x4d49c5){try{_0x4d49c5=_0x4a003b[_0x4072('0x28')](_0x4d49c5);logger[_0x4072('0x1c')](_0x4072('0x29'),JSON[_0x4072('0x1d')](_0x4d49c5,null,0x2));if(_0x4d49c5&&_0x4a003b[_0x4d49c5['agicommand']]){_0x43bfaa=_0x4a003b[_0x4d49c5['agicommand']](_0x4d49c5);if(_0x43bfaa){logger[_0x4072('0x1c')](_0x4072('0x32'),inspect(_0x43bfaa));return _[_0x4072('0x33')](_0x43bfaa['result'])?null:_0x43bfaa['result'][_0x4072('0x34')]();}else{logger[_0x4072('0xa')](_0x4072('0x32'),inspect(_0x43bfaa));return null;}}else{logger['error'](_0x4072('0x38'));return null;}}catch(_0x1af387){logger[_0x4072('0xa')](_0x1af387[_0x4072('0xc')]);return null;}});}logger[_0x4072('0x21')](util[_0x4072('0x1e')](_0x4072('0x39'),_0x39e75f[_0x4072('0x37')],_0x39e75f[_0x4072('0x23')],_0x39e75f[_0x4072('0x24')],_0x39e75f['dnid'],_0x39e75f['uniqueid']));logger['info'](util[_0x4072('0x1e')](_0x4072('0x3a'),_0x39e75f[_0x4072('0x2d')],_0x39e75f['extension'],parseInt(_0x39e75f['priority'],0xa)+0x1));_0x39e75f['continueAt'](_0x39e75f[_0x4072('0x2d')],_0x39e75f[_0x4072('0x2e')],parseInt(_0x39e75f['priority'],0xa)+0x1);_0x39e75f['close']();}function handleNotFound(_0x2b7806){logger[_0x4072('0xa')](util[_0x4072('0x1e')](_0x4072('0x3b'),_0x2b7806[_0x4072('0x37')]));_0x2b7806[_0x4072('0x3c')](_0x2b7806[_0x4072('0x2d')],_0x2b7806[_0x4072('0x2e')],parseInt(_0x2b7806[_0x4072('0x2f')],0xa)+0x1);_0x2b7806['close']();}function handleUnpublished(_0x2480e5){logger[_0x4072('0xa')](util['format']('Project\x20%s\x20not\x20published',_0x2480e5[_0x4072('0x37')]));_0x2480e5[_0x4072('0x3c')](_0x2480e5['context'],_0x2480e5[_0x4072('0x2e')],parseInt(_0x2480e5['priority'],0xa)+0x1);_0x2480e5[_0x4072('0x3d')]();}module[_0x4072('0x3e')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c7baffd..7f9b542 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 _0x66f4=['slice','trim','length','emit','indexOf','line','exports','stream','call','_localBuffer','_inBody','_transform','toString','substring','split'];(function(_0x1f09fa,_0x3265ca){var _0x197c8d=function(_0x91c3b){while(--_0x91c3b){_0x1f09fa['push'](_0x1f09fa['shift']());}};_0x197c8d(++_0x3265ca);}(_0x66f4,0x7f));var _0x466f=function(_0x38fe19,_0x1785dc){_0x38fe19=_0x38fe19-0x0;var _0x34b138=_0x66f4[_0x38fe19];return _0x34b138;};'use strict';var util=require('util');var Transform=require(_0x466f('0x0'))['Transform'];function AGIReply(_0x4a4c10){Transform[_0x466f('0x1')](this,_0x4a4c10);this[_0x466f('0x2')]='';this[_0x466f('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x466f('0x4')]=function(_0x53caa9,_0x5388ae,_0x231b3c){var _0x941ea6='\x0a',_0x3e712c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x435b63=-0x1,_0x5224b2=-0x1,_0xb9c5be='',_0x161913=0x0,_0x502318='',_0x4b3c28='';this[_0x466f('0x2')]+=_0x53caa9[_0x466f('0x5')]();_0x502318=this[_0x466f('0x2')];if(!this[_0x466f('0x3')]){_0x161913=0x0;while(_0x3e712c[_0x161913]){while((_0x5224b2=_0x502318['indexOf'](_0x3e712c[_0x161913]))!=-0x1){_0xb9c5be=_0x3e712c[_0x161913];_0x4b3c28=_0x502318[_0x466f('0x6')](0x0,_0x5224b2);_0x502318=_0x502318[_0x466f('0x6')](_0x5224b2+_0xb9c5be['length']);var _0x32ff9c=_0x4b3c28[_0x466f('0x7')](_0x941ea6),_0x2b05bf=0x0,_0x4b742c={},_0x173b69='',_0x393ad3='',_0x4803e4=-0x1;while(_0x32ff9c[_0x2b05bf]){_0x4803e4=_0x32ff9c[_0x2b05bf]['indexOf'](':');if(_0x4803e4!=-0x1){_0x173b69=_0x32ff9c[_0x2b05bf][_0x466f('0x8')](0x0,_0x4803e4)[_0x466f('0x9')]();_0x393ad3=_0x32ff9c[_0x2b05bf]['slice'](_0x4803e4+0x1)['trim']();if(_0x173b69[_0x466f('0xa')]>0x0){_0x4b742c[_0x173b69]=_0x393ad3;}}else{}_0x2b05bf++;}this[_0x466f('0xb')]('headers',_0x4b742c);this[_0x466f('0x3')]=!![];}_0x161913++;}this['_localBuffer']=_0x502318;}else{while((_0x435b63=_0x502318[_0x466f('0xc')](_0x941ea6))!=-0x1){_0x4b3c28=_0x502318['substring'](0x0,_0x435b63);this[_0x466f('0xb')](_0x466f('0xd'),_0x4b3c28);_0x502318=_0x502318['substring'](_0x435b63+_0x941ea6[_0x466f('0xa')]);}this[_0x466f('0x2')]=_0x502318;}_0x231b3c();};module[_0x466f('0xe')]=AGIReply; \ No newline at end of file +var _0xb093=['slice','trim','emit','headers','line','exports','util','stream','Transform','call','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','indexOf','substring','length','split'];(function(_0x434f54,_0x4289a4){var _0x127fe2=function(_0x3271ee){while(--_0x3271ee){_0x434f54['push'](_0x434f54['shift']());}};_0x127fe2(++_0x4289a4);}(_0xb093,0xfd));var _0x3b09=function(_0x377ab0,_0x919644){_0x377ab0=_0x377ab0-0x0;var _0x3a9986=_0xb093[_0x377ab0];return _0x3a9986;};'use strict';var util=require(_0x3b09('0x0'));var Transform=require(_0x3b09('0x1'))[_0x3b09('0x2')];function AGIReply(_0x299ec7){Transform[_0x3b09('0x3')](this,_0x299ec7);this['_localBuffer']='';this[_0x3b09('0x4')]=![];}util[_0x3b09('0x5')](AGIReply,Transform);AGIReply[_0x3b09('0x6')]['_transform']=function(_0x177f91,_0x2bf153,_0x5ebad9){var _0xc2062d='\x0a',_0x176bc4=['\x0a\x0a',_0x3b09('0x7')],_0x54d24f=-0x1,_0x417ba1=-0x1,_0x5985c5='',_0x20f236=0x0,_0x3343d4='',_0xec1055='';this[_0x3b09('0x8')]+=_0x177f91['toString']();_0x3343d4=this[_0x3b09('0x8')];if(!this[_0x3b09('0x4')]){_0x20f236=0x0;while(_0x176bc4[_0x20f236]){while((_0x417ba1=_0x3343d4[_0x3b09('0x9')](_0x176bc4[_0x20f236]))!=-0x1){_0x5985c5=_0x176bc4[_0x20f236];_0xec1055=_0x3343d4[_0x3b09('0xa')](0x0,_0x417ba1);_0x3343d4=_0x3343d4[_0x3b09('0xa')](_0x417ba1+_0x5985c5[_0x3b09('0xb')]);var _0xf12af1=_0xec1055[_0x3b09('0xc')](_0xc2062d),_0x8dcc11=0x0,_0x1108e4={},_0xa1d8ab='',_0x319018='',_0x32885d=-0x1;while(_0xf12af1[_0x8dcc11]){_0x32885d=_0xf12af1[_0x8dcc11]['indexOf'](':');if(_0x32885d!=-0x1){_0xa1d8ab=_0xf12af1[_0x8dcc11][_0x3b09('0xd')](0x0,_0x32885d)[_0x3b09('0xe')]();_0x319018=_0xf12af1[_0x8dcc11]['slice'](_0x32885d+0x1)[_0x3b09('0xe')]();if(_0xa1d8ab[_0x3b09('0xb')]>0x0){_0x1108e4[_0xa1d8ab]=_0x319018;}}else{}_0x8dcc11++;}this[_0x3b09('0xf')](_0x3b09('0x10'),_0x1108e4);this['_inBody']=!![];}_0x20f236++;}this[_0x3b09('0x8')]=_0x3343d4;}else{while((_0x54d24f=_0x3343d4[_0x3b09('0x9')](_0xc2062d))!=-0x1){_0xec1055=_0x3343d4[_0x3b09('0xa')](0x0,_0x54d24f);this[_0x3b09('0xf')](_0x3b09('0x11'),_0xec1055);_0x3343d4=_0x3343d4[_0x3b09('0xa')](_0x54d24f+_0xc2062d['length']);}this['_localBuffer']=_0x3343d4;}_0x5ebad9();};module[_0x3b09('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 36ebdcf..a7e21b3 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 _0xc906=['arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','Interval','Intervals','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1'];(function(_0x162be7,_0x399cd5){var _0x58da4c=function(_0x4d5a49){while(--_0x4d5a49){_0x162be7['push'](_0x162be7['shift']());}};_0x58da4c(++_0x399cd5);}(_0xc906,0x1ad));var _0x6c90=function(_0x47fd38,_0x536b52){_0x47fd38=_0x47fd38-0x0;var _0x12321b=_0xc906[_0x47fd38];return _0x12321b;};'use strict';var _=require(_0x6c90('0x0'));var moment=require(_0x6c90('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x6c90('0x2')][_0x6c90('0x3')]({'port':0x2329});function request(_0xc65efc,_0x52d2ec){return new Promise(function(_0x3b57e1,_0x237d5d){return client[_0x6c90('0x4')](_0xc65efc,_0x52d2ec)[_0x6c90('0x5')](function(_0x114ba2){if(_0x114ba2[_0x6c90('0x6')]){return _0x237d5d(_0x114ba2['error']['message']);}else{return _0x3b57e1(_0x114ba2['result']);}})[_0x6c90('0x7')](function(_0x54d440){return _0x237d5d(_0x54d440);});});}exports[_0x6c90('0x8')]=function(){return request(_0x6c90('0x9'),{'options':{'raw':![],'attributes':['id',_0x6c90('0xa'),_0x6c90('0xb')]}});};exports[_0x6c90('0xc')]=function(_0x43e2bd){return request(_0x6c90('0xd'),{'options':{'raw':![],'where':{'name':_0x43e2bd},'attributes':[_0x6c90('0xb')]}});};exports[_0x6c90('0xe')]=function(_0x188ca0){return request(_0x6c90('0xf'),{'options':{'raw':![],'where':{'id':_0x188ca0},'include':[{'model':_0x6c90('0x10'),'as':_0x6c90('0x11'),'include':[{'model':_0x6c90('0x12'),'as':'CloudProvider'}]}],'attributes':['id','name',_0x6c90('0x13')],'smtp':!![]}});};exports[_0x6c90('0x14')]=function(_0xe093a5){return request(_0x6c90('0xd'),{'options':{'where':{'id':_0xe093a5},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x15')]=function(_0x117da5){return request(_0x6c90('0x16'),{'options':{'where':{'id':_0x117da5},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x17')]=function(_0x49e7ef){return request(_0x6c90('0x18'),{'options':{'where':{'id':_0x49e7ef},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x19')]=function(_0x1c6143){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1c6143},'attributes':[_0x6c90('0x1a')]}});};exports[_0x6c90('0x1b')]=function(_0x5589ad){return request(_0x6c90('0x1c'),{'options':{'where':{'id':_0x5589ad},'attributes':[_0x6c90('0xa')]}});};exports[_0x6c90('0x1d')]=function(_0x424902){return request(_0x6c90('0x1e'),{'options':{'where':{'phone':_0x424902[_0x6c90('0x1f')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x9fc18e){return request(_0x6c90('0x20'),{'options':{'where':{'id':_0x9fc18e},'attributes':[_0x6c90('0xa')]}});};exports['getSoundById']=function(_0x5b772a){return request(_0x6c90('0x21'),{'options':{'where':{'id':_0x5b772a},'attributes':[_0x6c90('0x22')]}});};exports['getIntervalById']=function(_0x224115){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x224115},'include':[{'model':_0x6c90('0x23'),'as':_0x6c90('0x24')}]}});};exports['getSmsAccountById']=function(_0x137285){return request('ShowSmsAccount',{'options':{'where':{'id':_0x137285},'attributes':['id','name']}});};exports[_0x6c90('0x25')]=function(_0x59ba0e){return request(_0x6c90('0x26'),{'body':_0x59ba0e});};exports['createSquareDetailsReport']=function(_0xc3f320){return request(_0x6c90('0x27'),{'body':_0xc3f320});};exports[_0x6c90('0x28')]=function(_0x1ddc4){return request(_0x6c90('0x29'),{'body':_['merge'](_0x1ddc4,{'project_name':_0x1ddc4[_0x6c90('0x2a')],'prev_project_name':_0x1ddc4[_0x6c90('0x2b')]||'','is_subproject':_0x1ddc4['arg_2']?!![]:![],'leaveAt':moment()[_0x6c90('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x6c90('0x2d')]=function(_0x289cba){return request(_0x6c90('0x2e'),{'body':_0x289cba});};exports[_0x6c90('0x2f')]=function(_0x1dad84){return request('CreateSquareMessage',{'body':_0x1dad84});};exports[_0x6c90('0x30')]=function(_0x122246){return request(_0x6c90('0x31'),{'options':{'raw':![],'where':{'phone':_0x122246['phone'],'ListId':_0x122246[_0x6c90('0x32')]}}})[_0x6c90('0x5')](function(_0x18fb32){if(_0x18fb32){return _0x18fb32;}return request(_0x6c90('0x33'),{'body':_0x122246});});};exports[_0x6c90('0x34')]=function(_0x4ab78b){return request(_0x6c90('0x35'),{'options':{'where':{'id':_0x4ab78b},'attributes':['name']}});};exports[_0x6c90('0x36')]=function(_0x290b0d,_0x131a83){return request('LoginUser',{'body':{'interface':_0x131a83},'options':{'where':_0x290b0d}});};exports[_0x6c90('0x37')]=function(_0x3f9500,_0x238492,_0x5a1ef5){return request(_0x6c90('0x38'),{'body':{'type':_0x238492,'uniqueid':_0x5a1ef5},'options':{'where':_0x3f9500}});};exports['agentUnpause']=function(_0x3cac66){return request('UnpauseUser',{'body':{},'options':{'where':_0x3cac66}});};exports[_0x6c90('0x39')]=function(_0x56e5ca){return request(_0x6c90('0x3a'),{'body':{},'options':{'where':_0x56e5ca}});}; \ No newline at end of file +var _0xc298=['ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getTrunkById'];(function(_0xd458a4,_0x1e0d28){var _0x40633f=function(_0x5d99ae){while(--_0x5d99ae){_0xd458a4['push'](_0xd458a4['shift']());}};_0x40633f(++_0x1e0d28);}(_0xc298,0x143));var _0x8c29=function(_0x226857,_0x183547){_0x226857=_0x226857-0x0;var _0x21281d=_0xc298[_0x226857];return _0x21281d;};'use strict';var _=require('lodash');var moment=require(_0x8c29('0x0'));var jayson=require(_0x8c29('0x1'));var client=jayson[_0x8c29('0x2')][_0x8c29('0x3')]({'port':0x2329});function request(_0x3b7b6f,_0x17f0d4){return new Promise(function(_0x565994,_0x9da56d){return client[_0x8c29('0x4')](_0x3b7b6f,_0x17f0d4)[_0x8c29('0x5')](function(_0xd11739){if(_0xd11739[_0x8c29('0x6')]){return _0x9da56d(_0xd11739['error'][_0x8c29('0x7')]);}else{return _0x565994(_0xd11739[_0x8c29('0x8')]);}})[_0x8c29('0x9')](function(_0xef6e28){return _0x9da56d(_0xef6e28);});});}exports[_0x8c29('0xa')]=function(){return request(_0x8c29('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x402937){return request(_0x8c29('0xc'),{'options':{'raw':![],'where':{'name':_0x402937},'attributes':[_0x8c29('0xd')]}});};exports[_0x8c29('0xe')]=function(_0x31248e){return request(_0x8c29('0xf'),{'options':{'raw':![],'where':{'id':_0x31248e},'include':[{'model':_0x8c29('0x10'),'as':_0x8c29('0x11'),'include':[{'model':_0x8c29('0x12'),'as':_0x8c29('0x12')}]}],'attributes':['id',_0x8c29('0x13'),_0x8c29('0x14')],'smtp':!![]}});};exports[_0x8c29('0x15')]=function(_0x1dcf46){return request(_0x8c29('0xc'),{'options':{'where':{'id':_0x1dcf46},'attributes':[_0x8c29('0x13')]}});};exports['getVoiceQueueById']=function(_0x3dc480){return request(_0x8c29('0x16'),{'options':{'where':{'id':_0x3dc480},'attributes':['name']}});};exports['getVariableById']=function(_0x17d84b){return request(_0x8c29('0x17'),{'options':{'where':{'id':_0x17d84b},'attributes':['name']}});};exports[_0x8c29('0x18')]=function(_0x12285e){return request(_0x8c29('0x19'),{'options':{'where':{'id':_0x12285e},'attributes':['dsn']}});};exports[_0x8c29('0x1a')]=function(_0x37fc8e){return request(_0x8c29('0x1b'),{'options':{'where':{'id':_0x37fc8e},'attributes':[_0x8c29('0x13')]}});};exports[_0x8c29('0x1c')]=function(_0x21ada9){return request('GetContactByPhone',{'options':{'where':{'phone':_0x21ada9[_0x8c29('0x1d')]},'attributes':['id']}});};exports[_0x8c29('0x1e')]=function(_0x41e389){return request(_0x8c29('0x1f'),{'options':{'where':{'id':_0x41e389},'attributes':[_0x8c29('0x13')]}});};exports[_0x8c29('0x20')]=function(_0x46b950){return request(_0x8c29('0x21'),{'options':{'where':{'id':_0x46b950},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x2702a1){return request(_0x8c29('0x22'),{'options':{'raw':![],'where':{'id':_0x2702a1},'include':[{'model':_0x8c29('0x23'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x3fb320){return request(_0x8c29('0x24'),{'options':{'where':{'id':_0x3fb320},'attributes':['id',_0x8c29('0x13')]}});};exports[_0x8c29('0x25')]=function(_0x34cf21){return request('CreateSmsMessage',{'body':_0x34cf21});};exports[_0x8c29('0x26')]=function(_0x5459b7){return request(_0x8c29('0x27'),{'body':_0x5459b7});};exports['createSquareReport']=function(_0x5e288d){return request(_0x8c29('0x28'),{'body':_[_0x8c29('0x29')](_0x5e288d,{'project_name':_0x5e288d[_0x8c29('0x2a')],'prev_project_name':_0x5e288d['arg_2']||'','is_subproject':_0x5e288d[_0x8c29('0x2b')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x8c29('0x2c')]=function(_0x4f0e29){return request(_0x8c29('0x2d'),{'body':_0x4f0e29});};exports[_0x8c29('0x2e')]=function(_0x4efd8c){return request(_0x8c29('0x2f'),{'body':_0x4efd8c});};exports[_0x8c29('0x30')]=function(_0x4eee54){return request(_0x8c29('0x31'),{'options':{'raw':![],'where':{'phone':_0x4eee54['phone'],'ListId':_0x4eee54['ListId']}}})[_0x8c29('0x5')](function(_0x20e42f){if(_0x20e42f){return _0x20e42f;}return request(_0x8c29('0x32'),{'body':_0x4eee54});});};exports['getPauseById']=function(_0x38890d){return request(_0x8c29('0x33'),{'options':{'where':{'id':_0x38890d},'attributes':['name']}});};exports[_0x8c29('0x34')]=function(_0x2e12b1,_0x515a98){return request(_0x8c29('0x35'),{'body':{'interface':_0x515a98},'options':{'where':_0x2e12b1}});};exports[_0x8c29('0x36')]=function(_0x471a58,_0x327d1d,_0x208520){return request('PauseUser',{'body':{'type':_0x327d1d,'uniqueid':_0x208520},'options':{'where':_0x471a58}});};exports[_0x8c29('0x37')]=function(_0x152978){return request(_0x8c29('0x38'),{'body':{},'options':{'where':_0x152978}});};exports[_0x8c29('0x39')]=function(_0x42d53d){return request(_0x8c29('0x3a'),{'body':{},'options':{'where':_0x42d53d}});}; \ 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 9fc4728..2f747c6 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 _0xcbd3=['./lex','exports','./polly'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xcbd3,0x1eb));var _0x3cbd=function(_0x258fac,_0x2654e7){_0x258fac=_0x258fac-0x0;var _0x295904=_0xcbd3[_0x258fac];return _0x295904;};var polly=require(_0x3cbd('0x0'));var lex=require(_0x3cbd('0x1'));module[_0x3cbd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9fd4=['exports','./polly','./lex'];(function(_0x1098b3,_0x187e65){var _0x32a98b=function(_0x175f77){while(--_0x175f77){_0x1098b3['push'](_0x1098b3['shift']());}};_0x32a98b(++_0x187e65);}(_0x9fd4,0x16c));var _0x49fd=function(_0x52991d,_0x429d72){_0x52991d=_0x52991d-0x0;var _0x5b9004=_0x9fd4[_0x52991d];return _0x5b9004;};var polly=require(_0x49fd('0x0'));var lex=require(_0x49fd('0x1'));module[_0x49fd('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index ed33311..35200dd 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 _0xaa88=['exports','./lib/api'];(function(_0x2b64bc,_0x4049de){var _0x444aad=function(_0xe71269){while(--_0xe71269){_0x2b64bc['push'](_0x2b64bc['shift']());}};_0x444aad(++_0x4049de);}(_0xaa88,0x137));var _0x8aa8=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xaa88[_0x2d3ab3];return _0x321f9e;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0x55e0=['./lib/api','exports'];(function(_0x5a1945,_0x4b0a0a){var _0x4ff480=function(_0x477552){while(--_0x477552){_0x5a1945['push'](_0x5a1945['shift']());}};_0x4ff480(++_0x4b0a0a);}(_0x55e0,0xdc));var _0x055e=function(_0x294683,_0x46fb29){_0x294683=_0x294683-0x0;var _0x22196e=_0x55e0[_0x294683];return _0x22196e;};'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 134d794..56b7f30 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(_0x225cb8,_0x5a5807){var _0x6dc37d=function(_0x5c57f2){while(--_0x5c57f2){_0x225cb8['push'](_0x225cb8['shift']());}};_0x6dc37d(++_0x5a5807);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x3e266a,_0x41ac4e){var _0x376ad0=function(_0x4e0d70){while(--_0x4e0d70){_0x3e266a['push'](_0x3e266a['shift']());}};_0x376ad0(++_0x41ac4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 4e771a7..48acb7f 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 _0xa72b=['./lib/api','exports'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xa72b,0x116));var _0xba72=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0xa72b[_0xb4f240];return _0x30682a;};'use strict';var polly=require(_0xba72('0x0'));module[_0xba72('0x1')]=function(_0x411548,_0x220991,_0x15e97f,_0xdd4a2b,_0x48e576,_0x365119,_0x302705){return polly(_0x411548,_0x220991,_0x15e97f,_0xdd4a2b,_0x48e576,_0x365119,_0x302705);}; \ No newline at end of file +var _0x5022=['./lib/api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5022,0x156));var _0x2502=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x5022[_0x424a9a];return _0xa7831c;};'use strict';var polly=require(_0x2502('0x0'));module['exports']=function(_0x25e82f,_0x525cde,_0xcb2bd7,_0x4265bf,_0x36a570,_0x3398f4,_0x3ff7b4){return polly(_0x25e82f,_0x525cde,_0xcb2bd7,_0x4265bf,_0x36a570,_0x3398f4,_0x3ff7b4);}; \ 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 ad1612d..1f1ad09 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 _0x6437=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x237815,_0x1ef2b0){var _0x5498ee=function(_0x5d0f6e){while(--_0x5d0f6e){_0x237815['push'](_0x237815['shift']());}};_0x5498ee(++_0x1ef2b0);}(_0x6437,0x96));var _0x7643=function(_0xb5a147,_0xd967ea){_0xb5a147=_0xb5a147-0x0;var _0x132c84=_0x6437[_0xb5a147];return _0x132c84;};'use strict';var fs=require('fs');var path=require(_0x7643('0x0'));var BPromise=require('bluebird');var rs=require(_0x7643('0x1'));var AWS=require(_0x7643('0x2'));function pollyResult(_0x3dd099,_0x586203,_0x5d5023){return new BPromise(function(_0x11518d,_0x1b2eb3){_0x3dd099[_0x7643('0x3')](_0x586203,function(_0x58ddab,_0x2e1952){if(_0x58ddab){_0x1b2eb3(_0x58ddab);}else if(_0x2e1952){if(_0x2e1952[_0x7643('0x4')]instanceof Buffer){fs[_0x7643('0x5')](_0x5d5023,_0x2e1952['AudioStream'],function(_0x34085a){if(_0x34085a){_0x1b2eb3(_0x34085a);}else{_0x11518d();}});}else{_0x1b2eb3(new Error(_0x7643('0x6')));}}else{_0x1b2eb3(new Error(_0x7643('0x7')));}});});}module[_0x7643('0x8')]=function(_0x12bf37,_0x5417a1,_0x421dcb,_0x2661c9,_0x5c296a,_0x4e92b8,_0x450fd0){var _0x1500c1=new AWS['Polly']({'accessKeyId':_0x12bf37,'secretAccessKey':_0x5417a1,'region':_0x421dcb});var _0x3d942f={'Text':_0x5c296a,'TextType':_0x4e92b8||_0x7643('0x9'),'OutputFormat':_0x7643('0xa'),'VoiceId':_0x2661c9};return pollyResult(_0x1500c1,_0x3d942f,_0x450fd0);}; \ No newline at end of file +var _0xadbf=['aws-sdk','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x34fc0f,_0x5f3394){var _0xb0fb06=function(_0x30f56f){while(--_0x30f56f){_0x34fc0f['push'](_0x34fc0f['shift']());}};_0xb0fb06(++_0x5f3394);}(_0xadbf,0x1b8));var _0xfadb=function(_0x118da9,_0x21a9f8){_0x118da9=_0x118da9-0x0;var _0x31d18c=_0xadbf[_0x118da9];return _0x31d18c;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xfadb('0x0'));var rs=require('randomstring');var AWS=require(_0xfadb('0x1'));function pollyResult(_0x29cf45,_0x5331b0,_0x47a2bf){return new BPromise(function(_0xf28bc9,_0x3a5f98){_0x29cf45['synthesizeSpeech'](_0x5331b0,function(_0x1693ce,_0x5e832b){if(_0x1693ce){_0x3a5f98(_0x1693ce);}else if(_0x5e832b){if(_0x5e832b['AudioStream']instanceof Buffer){fs[_0xfadb('0x2')](_0x47a2bf,_0x5e832b['AudioStream'],function(_0x91b6b9){if(_0x91b6b9){_0x3a5f98(_0x91b6b9);}else{_0xf28bc9();}});}else{_0x3a5f98(new Error(_0xfadb('0x3')));}}else{_0x3a5f98(new Error(_0xfadb('0x4')));}});});}module[_0xfadb('0x5')]=function(_0x49c862,_0xf7e731,_0x4c2aca,_0x3479d9,_0x46efc0,_0x99bfe4,_0x86e2f8){var _0x2407d4=new AWS[(_0xfadb('0x6'))]({'accessKeyId':_0x49c862,'secretAccessKey':_0xf7e731,'region':_0x4c2aca});var _0x2705aa={'Text':_0x46efc0,'TextType':_0x99bfe4||_0xfadb('0x7'),'OutputFormat':_0xfadb('0x8'),'VoiceId':_0x3479d9};return pollyResult(_0x2407d4,_0x2705aa,_0x86e2f8);}; \ 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 52a3e30..a3c95e2 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 _0xefdb=['./lib/api','exports'];(function(_0x5264bf,_0x5d870e){var _0x55e28d=function(_0x49101f){while(--_0x49101f){_0x5264bf['push'](_0x5264bf['shift']());}};_0x55e28d(++_0x5d870e);}(_0xefdb,0x1ac));var _0xbefd=function(_0x15b824,_0x2ad93b){_0x15b824=_0x15b824-0x0;var _0x239ccb=_0xefdb[_0x15b824];return _0x239ccb;};'use strict';var asr=require(_0xbefd('0x0'));module[_0xbefd('0x1')]=function(_0x142b69,_0xae1751,_0x31a2a4,_0x4dd43b){return asr(_0x142b69,_0xae1751,_0x31a2a4);}; \ No newline at end of file +var _0xb62d=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62d,0xfb));var _0xdb62=function(_0x49355b,_0x9019c5){_0x49355b=_0x49355b-0x0;var _0x2ae953=_0xb62d[_0x49355b];return _0x2ae953;};'use strict';var asr=require(_0xdb62('0x0'));module[_0xdb62('0x1')]=function(_0x4b6ad7,_0x19bef1,_0x435273,_0xf03c22){return asr(_0x4b6ad7,_0x19bef1,_0x435273);}; \ 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 c5fa676..9115a6b 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 _0xfaa4=['filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string'];(function(_0x24cfd8,_0x552a39){var _0x2ff259=function(_0x742997){while(--_0x742997){_0x24cfd8['push'](_0x24cfd8['shift']());}};_0x2ff259(++_0x552a39);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3a9390,_0x3bb211){_0x3a9390=_0x3a9390-0x0;var _0x429197=_0xfaa4[_0x3a9390];return _0x429197;};'use strict';var url=require(_0x4faa('0x0'));var BPromise=require(_0x4faa('0x1'));var fs=require('fs');var host=_0x4faa('0x2');module[_0x4faa('0x3')]=function(_0x122c51,_0x1f79b7,_0x5141d1){return new BPromise(function(_0x1d9494,_0x819149){var _0x144600;if(typeof _0x122c51!==_0x4faa('0x4')||_0x122c51['length']===0x0){return _0x819149(_0x4faa('0x5'));}if(typeof _0x1f79b7!==_0x4faa('0x4')||_0x1f79b7[_0x4faa('0x6')]===0x0){return _0x819149('key\x20should\x20be\x20a\x20string');}if(typeof _0x5141d1!=='undefined'&&(typeof _0x5141d1!=='string'||_0x5141d1[_0x4faa('0x6')]===0x0)){return _0x819149(_0x4faa('0x7'));}try{_0x144600=fs[_0x4faa('0x8')](_0x122c51)['toString'](_0x4faa('0x9'));}catch(_0x383778){return _0x819149(_0x383778);}return _0x1d9494({'method':_0x4faa('0xa'),'uri':host+_0x4faa('0xb')+_0x1f79b7,'body':{'config':{'encoding':_0x4faa('0xc'),'sampleRateHertz':'8000','languageCode':_0x5141d1},'audio':{'content':_0x144600}},'json':!![]});});}; \ No newline at end of file +var _0xb2b3=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x4a1649,_0x3e99c2){var _0x3a6a38=function(_0xfc7ed1){while(--_0xfc7ed1){_0x4a1649['push'](_0x4a1649['shift']());}};_0x3a6a38(++_0x3e99c2);}(_0xb2b3,0x71));var _0x3b2b=function(_0x13abd3,_0x33d1c0){_0x13abd3=_0x13abd3-0x0;var _0x421844=_0xb2b3[_0x13abd3];return _0x421844;};'use strict';var url=require(_0x3b2b('0x0'));var BPromise=require(_0x3b2b('0x1'));var fs=require('fs');var host=_0x3b2b('0x2');module[_0x3b2b('0x3')]=function(_0xf005ed,_0x3de73b,_0x2059f0){return new BPromise(function(_0x4dad94,_0x3eff63){var _0x222c10;if(typeof _0xf005ed!==_0x3b2b('0x4')||_0xf005ed[_0x3b2b('0x5')]===0x0){return _0x3eff63(_0x3b2b('0x6'));}if(typeof _0x3de73b!==_0x3b2b('0x4')||_0x3de73b[_0x3b2b('0x5')]===0x0){return _0x3eff63(_0x3b2b('0x7'));}if(typeof _0x2059f0!==_0x3b2b('0x8')&&(typeof _0x2059f0!==_0x3b2b('0x4')||_0x2059f0[_0x3b2b('0x5')]===0x0)){return _0x3eff63(_0x3b2b('0x9'));}try{_0x222c10=fs['readFileSync'](_0xf005ed)[_0x3b2b('0xa')](_0x3b2b('0xb'));}catch(_0xd2f168){return _0x3eff63(_0xd2f168);}return _0x4dad94({'method':_0x3b2b('0xc'),'uri':host+_0x3b2b('0xd')+_0x3de73b,'body':{'config':{'encoding':_0x3b2b('0xe'),'sampleRateHertz':'8000','languageCode':_0x2059f0},'audio':{'content':_0x222c10}},'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 2d63ef4..9c8eab0 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 _0x9bb5=['./asr'];(function(_0x43bfaa,_0x59f842){var _0x184e3e=function(_0x442849){while(--_0x442849){_0x43bfaa['push'](_0x43bfaa['shift']());}};_0x184e3e(++_0x59f842);}(_0x9bb5,0x1de));var _0x59bb=function(_0x473eb8,_0x1ada19){_0x473eb8=_0x473eb8-0x0;var _0x4e9e09=_0x9bb5[_0x473eb8];return _0x4e9e09;};var asr=require(_0x59bb('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xc293=['./asr','exports'];(function(_0x2bea4d,_0x22d58f){var _0x1d9038=function(_0x2be08a){while(--_0x2be08a){_0x2bea4d['push'](_0x2bea4d['shift']());}};_0x1d9038(++_0x22d58f);}(_0xc293,0xaa));var _0x3c29=function(_0x494368,_0x56d9a3){_0x494368=_0x494368-0x0;var _0x1491a3=_0xc293[_0x494368];return _0x1491a3;};var asr=require(_0x3c29('0x0'));module[_0x3c29('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 11acaa2..0c6891d 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 _0x939c=['allRequiredParamsPresent','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','generate','.mp3','from','writeFile','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','Dialogflow\x20V2\x20response:'];(function(_0x557942,_0x5b2ba3){var _0x2ad22d=function(_0x3b8270){while(--_0x3b8270){_0x557942['push'](_0x557942['shift']());}};_0x2ad22d(++_0x5b2ba3);}(_0x939c,0xa8));var _0xc939=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x939c[_0x2b31a8];return _0x1175a5;};'use strict';var apiai=require(_0xc939('0x0'));var BPromise=require(_0xc939('0x1'));var dialogflow=require(_0xc939('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc939('0x3'));var md5=require(_0xc939('0x4'));var path=require(_0xc939('0x5'));var querystring=require('querystring');var rp=require(_0xc939('0x6'));var rs=require(_0xc939('0x7'));var sox=require(_0xc939('0x8'));var tts=require(_0xc939('0x9'));var urlParse=require(_0xc939('0xa'))[_0xc939('0xb')];var util=require(_0xc939('0xc'));var aws=require(_0xc939('0xd'));var google=require('./google');var sestek=require(_0xc939('0xe'));var tilde=require(_0xc939('0xf'));var logger=require(_0xc939('0x10'))(_0xc939('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x371cf1,_0xb6c5b6){return new BPromise(function(_0x167742,_0x35744f){var _0x44dbcb=urlParse(_0x371cf1);var _0x2f2de0=_0x44dbcb['protocol']==='https:'?https:http;var _0x4c2cd4={'host':_0x44dbcb[_0xc939('0x12')],'path':_0x44dbcb[_0xc939('0x5')],'headers':{'user-agent':_0xc939('0x13')}};_0x2f2de0[_0xc939('0x14')](_0x4c2cd4,function(_0x556a91){if(_0x556a91[_0xc939('0x15')]!==0xc8){logger[_0xc939('0x16')](_0xc939('0x17')+_0x371cf1+_0xc939('0x18')+_0x556a91[_0xc939('0x15')]+'\x20('+_0x556a91[_0xc939('0x19')]+')');_0x35744f(new Error('request\x20to\x20'+_0x371cf1+'\x20failed,\x20status\x20code\x20=\x20'+_0x556a91[_0xc939('0x15')]+'\x20('+_0x556a91[_0xc939('0x19')]+')'));return;}var _0x1937fe=fs['createWriteStream'](_0xb6c5b6);_0x1937fe['on'](_0xc939('0x1a'),function(){logger[_0xc939('0x1b')](_0xc939('0x1c'));_0x1937fe[_0xc939('0x1d')](_0x167742);});_0x1937fe['on'](_0xc939('0x16'),function(_0x1468b2){fs[_0xc939('0x1e')](_0xb6c5b6);logger['error'](_0xc939('0x1f'),_0x1468b2);_0x35744f(_0x1468b2);});_0x556a91[_0xc939('0x20')](_0x1937fe);})['on']('error',function(_0x7cc6ab){logger[_0xc939('0x16')](_0x7cc6ab);_0x35744f(_0x7cc6ab);})[_0xc939('0x21')]();});}function uploadFile(_0x72bc1d){return new BPromise(function(_0x124a7b,_0x5c9aaf){var _0x1ce162=urlParse(_0x72bc1d);var _0x3e5eea=_0x1ce162[_0xc939('0x22')]===_0xc939('0x23')?https:http;var _0x10f7c6={'host':_0x1ce162[_0xc939('0x12')],'path':_0x1ce162[_0xc939('0x5')],'headers':{'user-agent':_0xc939('0x13')}};_0x3e5eea[_0xc939('0x14')](_0x10f7c6,function(_0x29306b){if(_0x29306b[_0xc939('0x15')]!==0xc8){_0x5c9aaf(new Error(_0xc939('0x17')+_0x72bc1d+'\x20failed,\x20status\x20code\x20=\x20'+_0x29306b[_0xc939('0x15')]+'\x20('+_0x29306b['statusMessage']+')'));return;}var _0x301deb='';_0x29306b['on'](_0xc939('0x24'),function(_0x6052f6){_0x301deb+=_0x6052f6;});_0x29306b['on'](_0xc939('0x21'),function(){_0x124a7b(_0x301deb);});})['on'](_0xc939('0x16'),function(_0x564809){_0x5c9aaf(_0x564809);})[_0xc939('0x21')]();});}function convertFile(_0x42c93f,_0x555f00){return new BPromise(function(_0x12bd73,_0x3d4376){var _0x586bb6=sox[_0xc939('0x25')](_0x42c93f,_0x555f00,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x586bb6['on']('error',function(_0x141fea){logger['error'](_0xc939('0x26'),_0x141fea);_0x3d4376(_0x141fea);});_0x586bb6['on'](_0xc939('0x21'),function(){logger[_0xc939('0x1b')](_0xc939('0x27'));_0x12bd73();});_0x586bb6[_0xc939('0x28')]();});}function base64Decode(_0x431c76,_0x406db4){var _0x3858bb=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+_0xc939('0x2b'));fs[_0xc939('0x2c')](_0x3858bb,_0x431c76,_0xc939('0x2d'));return convertFile(_0x3858bb,_0x406db4)[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x3858bb);fs[_0xc939('0x2f')](_0x406db4,'777');}catch(_0x538e4d){logger[_0xc939('0x16')](_0x538e4d);}return _0x406db4[_0xc939('0x30')]('.')[0x0];});}function base64Encode(_0x130cb6){var _0x2815a4=fs[_0xc939('0x31')](_0x130cb6);return new Buffer(_0x2815a4)[_0xc939('0x32')](_0xc939('0x2d'));}exports[_0xc939('0x33')]=function(_0x18e295,_0x54ad0e,_0x417f55,_0x5ae00c,_0x3bb7bc,_0x2981b7){var _0x223c89,_0x2362cb;var _0x21c6ee=_0xc939('0x34');var _0x523558=_0xc939('0x35')+_0x18e295;var _0x204291={};if(_0x54ad0e===_0xc939('0x36')){_0x204291['input']={'ssml':_0x417f55};}else{_0x204291[_0xc939('0x37')]={'text':_0x417f55};};_0x204291[_0xc939('0x38')]={'languageCode':_0x5ae00c,'ssmlGender':_0x3bb7bc};_0x204291[_0xc939('0x39')]={'audioEncoding':_0xc939('0x3a'),'sampleRateHertz':0x1f40};var _0x103009={'url':_0x21c6ee+_0xc939('0x3b')+_0x523558,'method':_0xc939('0x3c'),'json':!![],'body':_0x204291};return rp(_0x103009)['then'](function(_0x1f8541){return new BPromise(function(_0x50fce5,_0x26bfa9){_0x223c89=path[_0xc939('0x29')](__dirname,'tmp',rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));var _0x3508f0=Buffer[_0xc939('0x3f')](_0x1f8541['audioContent'],_0xc939('0x2d'));return fs[_0xc939('0x40')](_0x223c89,_0x3508f0,function(_0x4fb5d6){_0x26bfa9(_0x4fb5d6);},function(_0x64d380){fs['chmodSync'](_0x223c89,'777');_0x50fce5(_0x64d380);});});})[_0xc939('0x2e')](function(_0x271196){_0x2362cb=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x2b'));return convertFile(_0x223c89,_0x2362cb);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x223c89);fs[_0xc939('0x2f')](_0x2362cb,_0xc939('0x41'));}catch(_0x1508aa){logger[_0xc939('0x16')](_0x1508aa);}logger['info'](_0xc939('0x42'),_0x2362cb['split']('.')[0x0]);return _0x2362cb[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x43')]=function(_0x47a38a,_0x2788a0){var _0x1515f8=_0xc939('0x44');var _0x18be84,_0x5bfd6b;var _0x19edd0;var _0x2fe0f4={'encoding':_0xc939('0x45'),'method':_0xc939('0x3c'),'timeout':0x2710,'url':_0x1515f8,'headers':{'Content-Type':_0xc939('0x46')},'body':_0xc939('0x47')+encodeURIComponent(JSON[_0xc939('0x48')]([[[_0xc939('0x49'),JSON['stringify']([_0x47a38a,_0x2788a0||'en',![],_0xc939('0x4a')]),null,_0xc939('0x4b')]]]))};return rp(_0x2fe0f4)[_0xc939('0x2e')](function(_0x57a26a){try{_0x19edd0=eval(_0x57a26a[_0xc939('0x4c')](0x5))[0x0][0x2];}catch(_0x1bf0ad){throw new Error(_0xc939('0x4d')+_0x57a26a[_0xc939('0x24')]);}if(!_0x19edd0){if(_0x47a38a['length']>0xc8){throw new Error(_0xc939('0x4e'));}else{throw new Error(_0xc939('0x4f')+_0x2788a0+'\x22\x20might\x20not\x20exist');}}try{_0x19edd0=eval(_0x19edd0)[0x0];}catch(_0x5e8751){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc939('0x24')]);}const _0x512a69=_0x19edd0;_0x18be84=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));fs['writeFileSync'](_0x18be84,_0x19edd0,{'encoding':'base64'});_0x5bfd6b=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+'.wav');return convertFile(_0x18be84,_0x5bfd6b);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x18be84);fs['chmodSync'](_0x5bfd6b,_0xc939('0x41'));}catch(_0x4a0fbe){logger[_0xc939('0x16')](_0x4a0fbe);}logger['info'](_0xc939('0x50'),_0x5bfd6b[_0xc939('0x30')]('.')[0x0]);return _0x5bfd6b[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x51')]=function(_0x3e85ee,_0x4a636f,_0x57feb9){return google[_0xc939('0x52')](_0x3e85ee,_0x4a636f,_0x57feb9)[_0xc939('0x2e')](function(_0x3fd98b){logger[_0xc939('0x1b')](_0x3fd98b[_0xc939('0x53')]);return rp(_0x3fd98b);})[_0xc939('0x2e')](function(_0x3c91e3){var _0x17a909='';var _0x25fbec=0x0;try{fs[_0xc939('0x1e')](_0x3e85ee);}catch(_0x75b903){logger[_0xc939('0x16')](_0x75b903);}if(_0x3c91e3&&_0x3c91e3[_0xc939('0x54')]){_0x17a909=_0x3c91e3['results'][_0xc939('0x55')](function(_0x395b5b){return _0x395b5b&&_0x395b5b[_0xc939('0x56')][0x0]&&_0x395b5b[_0xc939('0x56')][0x0]['transcript']?_0x395b5b[_0xc939('0x56')][0x0][_0xc939('0x57')]:'';})[_0xc939('0x58')]('\x0a');_0x25fbec=_0x3c91e3[_0xc939('0x54')][_0xc939('0x55')](function(_0x20ac6b){return _0x20ac6b&&_0x20ac6b['alternatives'][0x0]&&_0x20ac6b[_0xc939('0x56')][0x0][_0xc939('0x59')]?_0x20ac6b[_0xc939('0x56')][0x0][_0xc939('0x59')]:0x0;})[_0xc939('0x58')]('\x0a');}logger[_0xc939('0x1b')](_0xc939('0x5a'),_0x17a909);logger[_0xc939('0x1b')](_0xc939('0x5b'),_0x25fbec);return{'transcript':_0x17a909,'confidence':_0x25fbec};})[_0xc939('0x5c')](function(_0xc7e9d){logger[_0xc939('0x16')]('[%s]\x20%s:%s',_0xc7e9d[_0xc939('0x15')],_0xc7e9d[_0xc939('0x5d')],_0xc7e9d[_0xc939('0x5e')]);});};exports[_0xc939('0x5f')]=function(_0x5e0e5f,_0x34b10b,_0x240815,_0x50a0b9){var _0x28c596=apiai(_0x34b10b,{'language':_0x50a0b9||'en'});return _0x28c596[_0xc939('0x60')](_0x240815,{'sessionId':md5(_0x5e0e5f)})[_0xc939('0x2e')](function(_0x10c653){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x10c653));return{'source':_0x10c653['result'][_0xc939('0x61')],'resolvedQuery':_0x10c653['result'][_0xc939('0x62')],'action':_0x10c653[_0xc939('0x63')]['action'],'actionIncomplete':_0x10c653['result'][_0xc939('0x64')],'speech':_0x10c653[_0xc939('0x63')]['fulfillment'][_0xc939('0x65')],'score':_0x10c653[_0xc939('0x63')][_0xc939('0x66')],'statusCode':_0x10c653[_0xc939('0x67')][_0xc939('0x68')],'endConversation':_0x10c653[_0xc939('0x63')][_0xc939('0x69')][_0xc939('0x6a')]||![],'isFallbackIntent':_0x10c653[_0xc939('0x63')][_0xc939('0x69')][_0xc939('0x6b')]};});};exports[_0xc939('0x6c')]=function(_0x1543e4,_0x4871ee,_0x2095e1,_0x11932e,_0x4f795f,_0x23b82f){var _0x36ce74=_0x11932e['replace'](/\\n/g,'\x0a');var _0x357cae={'credentials':{'private_key':_0x36ce74,'client_email':_0x2095e1}};var _0x339c10=new dialogflow['SessionsClient'](_0x357cae);var _0x652c26=_0x339c10[_0xc939('0x6d')](_0x4871ee,md5(_0x1543e4));var _0x2afeeb={'session':_0x652c26,'queryInput':{'text':{'text':_0x4f795f,'languageCode':_0x23b82f}}};return _0x339c10[_0xc939('0x6e')](_0x2afeeb)[_0xc939('0x2e')](function(_0x28268f){if(_0x28268f&&_0x28268f['length']){logger[_0xc939('0x1b')](_0xc939('0x6f'),JSON[_0xc939('0x48')](_0x28268f));var _0x62a250=_0x28268f[0x0];if(_0x62a250){var _0x46d155={'action':_0x62a250['queryResult']['action'],'allRequiredParamsPresent':_0x62a250['queryResult'][_0xc939('0x70')],'endConversation':_0x62a250[_0xc939('0x71')]['diagnosticInfo']&&_0x62a250[_0xc939('0x71')][_0xc939('0x72')][_0xc939('0x73')]?_0x62a250['queryResult']['diagnosticInfo'][_0xc939('0x73')]['end_conversation'][_0xc939('0x74')]:![],'fulfillmentText':_0x62a250[_0xc939('0x71')][_0xc939('0x75')],'intentName':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x5d')],'intentDisplayName':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x77')],'isFallbackIntent':_0x62a250[_0xc939('0x71')][_0xc939('0x76')][_0xc939('0x78')],'languageCode':_0x62a250[_0xc939('0x71')][_0xc939('0x79')],'queryText':_0x62a250[_0xc939('0x71')]['queryText'],'responseId':_0x62a250[_0xc939('0x7a')],'score':_0x62a250[_0xc939('0x71')][_0xc939('0x7b')],'speech':_0x62a250[_0xc939('0x71')]['fulfillmentText'],'providerResponse':JSON[_0xc939('0x48')](_0x28268f)};return _0x46d155;}}});};exports[_0xc939('0x7c')]=function(_0x53571e,_0x3b3263,_0x10b05c,_0x33c0a6){return tilde[_0xc939('0x52')](_0x53571e,_0x3b3263,_0x10b05c,_0x33c0a6)[_0xc939('0x2e')](function(_0x566f22){try{fs['unlink'](_0x53571e);}catch(_0x4f7394){logger[_0xc939('0x16')](_0x4f7394);}logger[_0xc939('0x1b')](_0xc939('0x7d'),_0x566f22[_0xc939('0x57')]);logger[_0xc939('0x1b')](_0xc939('0x7e'),_0x566f22[_0xc939('0x59')]);return _0x566f22;});};exports[_0xc939('0x7f')]=function(_0x267424,_0x34a544,_0x481592,_0xd7906d,_0x221369,_0x252ef0){var _0x4242a2=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x3e'));var _0x4b48f4;return aws[_0xc939('0x80')](_0x267424,_0x34a544,_0x481592,_0xd7906d,_0x221369,_0x252ef0,_0x4242a2)[_0xc939('0x2e')](function(){_0x4b48f4=path['resolve'](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+'.wav');return convertFile(_0x4242a2,_0x4b48f4);})[_0xc939('0x2e')](function(){try{fs[_0xc939('0x1e')](_0x4242a2);fs['chmodSync'](_0x4b48f4,_0xc939('0x41'));}catch(_0x1a938a){logger[_0xc939('0x16')](_0x1a938a);}return _0x4b48f4[_0xc939('0x30')]('.')[0x0];});};exports[_0xc939('0x81')]=function(_0x3af472,_0xd608c9,_0x35300e,_0x528812,_0x577c02,_0x261ba8){return aws[_0xc939('0x82')](_0x3af472,_0xd608c9,_0x35300e,_0x528812,_0x577c02,_0x261ba8)[_0xc939('0x2e')](function(_0x53c6c5){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x53c6c5));return _0x53c6c5;});};exports[_0xc939('0x83')]=function(_0x201b34,_0x1e4c9b,_0x12d407,_0x11a294){var _0xc40456=util[_0xc939('0x84')](_0xc939('0x85'),ISPEECH_API,_0x201b34,encodeURIComponent(_0x1e4c9b),_0x12d407,_0x11a294);var _0x110c79=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+'.mp3');var _0x2c6681;return downloadFile(_0xc40456,_0x110c79)[_0xc939('0x2e')](function(){_0x2c6681=path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs[_0xc939('0x3d')](0x4)+_0xc939('0x2b'));return convertFile(_0x110c79,_0x2c6681);})['then'](function(){try{fs[_0xc939('0x1e')](_0x110c79);fs['chmodSync'](_0x2c6681,_0xc939('0x41'));}catch(_0x440505){logger['error'](_0x440505);}return _0x2c6681[_0xc939('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x2be3b5,_0x5a353c,_0x44c6db,_0x3803b5){var _0x4a185d=util[_0xc939('0x84')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5a353c,_0x44c6db,base64Encode(_0x2be3b5),_0x3803b5?util[_0xc939('0x84')](_0xc939('0x86'),encodeURIComponent(_0x3803b5)):'freeform=3');return uploadFile(_0x4a185d)[_0xc939('0x2e')](function(_0x300290){return querystring[_0xc939('0xb')](_0x300290);});};exports['sestekNDA']=function(_0x3a6609,_0x3acd35){return sestek['nda'](_0x3a6609,_0x3acd35)[_0xc939('0x2e')](function(_0x3825c9){logger[_0xc939('0x1b')](JSON[_0xc939('0x48')](_0x3825c9));var _0x4a29df={'speech':_0x3825c9['text'],'action':_0x3825c9[_0xc939('0x87')]?_0x3825c9[_0xc939('0x87')]['CustomAction']:undefined,'actiondata':_0x3825c9['channelData']?_0x3825c9['channelData'][_0xc939('0x88')]:undefined};if(_0x3825c9[_0xc939('0x87')]&&_0x3825c9[_0xc939('0x87')][_0xc939('0x89')]){return base64Decode(_0x3825c9[_0xc939('0x87')][_0xc939('0x89')][_0xc939('0x8a')],path[_0xc939('0x29')](__dirname,_0xc939('0x2a'),rs['generate'](0x4)+_0xc939('0x2b')))[_0xc939('0x2e')](function(_0x524356){_0x4a29df[_0xc939('0x8b')]=_0x524356;return _0x4a29df;});}return _0x4a29df;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x4ebe=['chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','then','resolve','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','results','map','alternatives','transcript','join','catch','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','boolValue','fulfillmentText','intent','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','protocol','data','transcode','wav','error\x20convert','tmp','generate','.wav','writeFileSync','base64'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4ebe,0xe0));var _0xe4eb=function(_0x4db8d1,_0x218bf8){_0x4db8d1=_0x4db8d1-0x0;var _0x2344f3=_0x4ebe[_0x4db8d1];return _0x2344f3;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0xe4eb('0x0'));var fs=require('fs');var http=require(_0xe4eb('0x1'));var https=require(_0xe4eb('0x2'));var md5=require('md5');var path=require(_0xe4eb('0x3'));var querystring=require(_0xe4eb('0x4'));var rp=require(_0xe4eb('0x5'));var rs=require(_0xe4eb('0x6'));var sox=require(_0xe4eb('0x7'));var tts=require(_0xe4eb('0x8'));var urlParse=require(_0xe4eb('0x9'))[_0xe4eb('0xa')];var util=require('util');var aws=require(_0xe4eb('0xb'));var google=require(_0xe4eb('0xc'));var sestek=require(_0xe4eb('0xd'));var tilde=require(_0xe4eb('0xe'));var logger=require(_0xe4eb('0xf'))(_0xe4eb('0x10'));var ISPEECH_API=_0xe4eb('0x11');function downloadFile(_0x332f64,_0x1fb4f8){return new BPromise(function(_0x4ad6a1,_0x51105c){var _0x1d0477=urlParse(_0x332f64);var _0x51a055=_0x1d0477['protocol']===_0xe4eb('0x12')?https:http;var _0x1ad06f={'host':_0x1d0477['host'],'path':_0x1d0477[_0xe4eb('0x3')],'headers':{'user-agent':_0xe4eb('0x13')}};_0x51a055[_0xe4eb('0x14')](_0x1ad06f,function(_0xec2557){if(_0xec2557[_0xe4eb('0x15')]!==0xc8){logger[_0xe4eb('0x16')](_0xe4eb('0x17')+_0x332f64+_0xe4eb('0x18')+_0xec2557[_0xe4eb('0x15')]+'\x20('+_0xec2557['statusMessage']+')');_0x51105c(new Error(_0xe4eb('0x17')+_0x332f64+'\x20failed,\x20status\x20code\x20=\x20'+_0xec2557[_0xe4eb('0x15')]+'\x20('+_0xec2557[_0xe4eb('0x19')]+')'));return;}var _0x270b2e=fs['createWriteStream'](_0x1fb4f8);_0x270b2e['on'](_0xe4eb('0x1a'),function(){logger[_0xe4eb('0x1b')](_0xe4eb('0x1c'));_0x270b2e[_0xe4eb('0x1d')](_0x4ad6a1);});_0x270b2e['on']('error',function(_0x90a377){fs[_0xe4eb('0x1e')](_0x1fb4f8);logger[_0xe4eb('0x16')](_0xe4eb('0x1f'),_0x90a377);_0x51105c(_0x90a377);});_0xec2557[_0xe4eb('0x20')](_0x270b2e);})['on'](_0xe4eb('0x16'),function(_0x227c70){logger['error'](_0x227c70);_0x51105c(_0x227c70);})[_0xe4eb('0x21')]();});}function uploadFile(_0x120f58){return new BPromise(function(_0x3a8462,_0x14fd3f){var _0xe1f332=urlParse(_0x120f58);var _0xba17d7=_0xe1f332[_0xe4eb('0x22')]===_0xe4eb('0x12')?https:http;var _0x22fc7f={'host':_0xe1f332['host'],'path':_0xe1f332['path'],'headers':{'user-agent':_0xe4eb('0x13')}};_0xba17d7[_0xe4eb('0x14')](_0x22fc7f,function(_0x5c38c9){if(_0x5c38c9[_0xe4eb('0x15')]!==0xc8){_0x14fd3f(new Error(_0xe4eb('0x17')+_0x120f58+_0xe4eb('0x18')+_0x5c38c9[_0xe4eb('0x15')]+'\x20('+_0x5c38c9[_0xe4eb('0x19')]+')'));return;}var _0x5ce52c='';_0x5c38c9['on'](_0xe4eb('0x23'),function(_0x564977){_0x5ce52c+=_0x564977;});_0x5c38c9['on']('end',function(){_0x3a8462(_0x5ce52c);});})['on'](_0xe4eb('0x16'),function(_0x3a7252){_0x14fd3f(_0x3a7252);})[_0xe4eb('0x21')]();});}function convertFile(_0x4c7c29,_0x46c793){return new BPromise(function(_0x26aff1,_0x3dad95){var _0x3685d4=sox[_0xe4eb('0x24')](_0x4c7c29,_0x46c793,{'sampleRate':0x1f40,'format':_0xe4eb('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3685d4['on'](_0xe4eb('0x16'),function(_0x1c124f){logger[_0xe4eb('0x16')](_0xe4eb('0x26'),_0x1c124f);_0x3dad95(_0x1c124f);});_0x3685d4['on'](_0xe4eb('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x26aff1();});_0x3685d4['start']();});}function base64Decode(_0x49273e,_0x69536d){var _0x2cb79a=path['resolve'](__dirname,_0xe4eb('0x27'),rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x29'));fs[_0xe4eb('0x2a')](_0x2cb79a,_0x49273e,_0xe4eb('0x2b'));return convertFile(_0x2cb79a,_0x69536d)['then'](function(){try{fs[_0xe4eb('0x1e')](_0x2cb79a);fs[_0xe4eb('0x2c')](_0x69536d,_0xe4eb('0x2d'));}catch(_0x4afa62){logger[_0xe4eb('0x16')](_0x4afa62);}return _0x69536d[_0xe4eb('0x2e')]('.')[0x0];});}function base64Encode(_0x375d25){var _0x3d75d9=fs[_0xe4eb('0x2f')](_0x375d25);return new Buffer(_0x3d75d9)[_0xe4eb('0x30')]('base64');}exports[_0xe4eb('0x31')]=function(_0x592bb5,_0x5f3952,_0x5d58ef,_0x3b664b,_0x598511,_0x1839a3){var _0x3b5715,_0x56d85e;var _0x58fa4f=_0xe4eb('0x32');var _0x4cd105='?key='+_0x592bb5;var _0x24a057={};if(_0x5f3952===_0xe4eb('0x33')){_0x24a057[_0xe4eb('0x34')]={'ssml':_0x5d58ef};}else{_0x24a057[_0xe4eb('0x34')]={'text':_0x5d58ef};};_0x24a057['voice']={'languageCode':_0x3b664b,'ssmlGender':_0x598511};_0x24a057[_0xe4eb('0x35')]={'audioEncoding':_0xe4eb('0x36'),'sampleRateHertz':0x1f40};var _0x4a034f={'url':_0x58fa4f+_0xe4eb('0x37')+_0x4cd105,'method':'POST','json':!![],'body':_0x24a057};return rp(_0x4a034f)[_0xe4eb('0x38')](function(_0x5ac372){return new BPromise(function(_0x1bc14b,_0x4f2b91){_0x3b5715=path[_0xe4eb('0x39')](__dirname,_0xe4eb('0x27'),rs['generate'](0x4)+_0xe4eb('0x3a'));var _0x56b80d=Buffer['from'](_0x5ac372[_0xe4eb('0x3b')],_0xe4eb('0x2b'));return fs[_0xe4eb('0x3c')](_0x3b5715,_0x56b80d,function(_0x2c2db6){_0x4f2b91(_0x2c2db6);},function(_0x34bed6){fs[_0xe4eb('0x2c')](_0x3b5715,_0xe4eb('0x2d'));_0x1bc14b(_0x34bed6);});});})['then'](function(_0x4699a9){_0x56d85e=path[_0xe4eb('0x39')](__dirname,_0xe4eb('0x27'),rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x29'));return convertFile(_0x3b5715,_0x56d85e);})['then'](function(){try{fs[_0xe4eb('0x1e')](_0x3b5715);fs[_0xe4eb('0x2c')](_0x56d85e,_0xe4eb('0x2d'));}catch(_0x1c7f94){logger[_0xe4eb('0x16')](_0x1c7f94);}logger[_0xe4eb('0x1b')](_0xe4eb('0x3d'),_0x56d85e[_0xe4eb('0x2e')]('.')[0x0]);return _0x56d85e['split']('.')[0x0];});};exports[_0xe4eb('0x3e')]=function(_0x2fb5da,_0x4b55bd){var _0x48cbe2=_0xe4eb('0x3f');var _0x52ab5c,_0x5d786f;var _0x4473fb;var _0x5dae17={'encoding':_0xe4eb('0x40'),'method':_0xe4eb('0x41'),'timeout':0x2710,'url':_0x48cbe2,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xe4eb('0x42')+encodeURIComponent(JSON[_0xe4eb('0x43')]([[[_0xe4eb('0x44'),JSON[_0xe4eb('0x43')]([_0x2fb5da,_0x4b55bd||'en',![],'null']),null,_0xe4eb('0x45')]]]))};return rp(_0x5dae17)['then'](function(_0x545498){try{_0x4473fb=eval(_0x545498[_0xe4eb('0x46')](0x5))[0x0][0x2];}catch(_0x5e16af){throw new Error(_0xe4eb('0x47')+_0x545498[_0xe4eb('0x23')]);}if(!_0x4473fb){if(_0x2fb5da[_0xe4eb('0x48')]>0xc8){throw new Error(_0xe4eb('0x49'));}else{throw new Error(_0xe4eb('0x4a')+_0x4b55bd+_0xe4eb('0x4b'));}}try{_0x4473fb=eval(_0x4473fb)[0x0];}catch(_0x12f4c0){throw new Error(_0xe4eb('0x47')+res[_0xe4eb('0x23')]);}const _0xaaf296=_0x4473fb;_0x52ab5c=path[_0xe4eb('0x39')](__dirname,'tmp',rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x3a'));fs['writeFileSync'](_0x52ab5c,_0x4473fb,{'encoding':_0xe4eb('0x2b')});_0x5d786f=path[_0xe4eb('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0xe4eb('0x29'));return convertFile(_0x52ab5c,_0x5d786f);})['then'](function(){try{fs[_0xe4eb('0x1e')](_0x52ab5c);fs[_0xe4eb('0x2c')](_0x5d786f,_0xe4eb('0x2d'));}catch(_0x407d41){logger[_0xe4eb('0x16')](_0x407d41);}logger[_0xe4eb('0x1b')]('goggleTTS\x20path',_0x5d786f['split']('.')[0x0]);return _0x5d786f[_0xe4eb('0x2e')]('.')[0x0];});};exports['googleASR']=function(_0x97031e,_0x268375,_0x431537){return google['asr'](_0x97031e,_0x268375,_0x431537)[_0xe4eb('0x38')](function(_0x68bf14){logger[_0xe4eb('0x1b')](_0x68bf14['uri']);return rp(_0x68bf14);})['then'](function(_0xe79f43){var _0x5ecba5='';var _0x18c513=0x0;try{fs[_0xe4eb('0x1e')](_0x97031e);}catch(_0x5e1422){logger['error'](_0x5e1422);}if(_0xe79f43&&_0xe79f43[_0xe4eb('0x4c')]){_0x5ecba5=_0xe79f43[_0xe4eb('0x4c')][_0xe4eb('0x4d')](function(_0x41ec19){return _0x41ec19&&_0x41ec19[_0xe4eb('0x4e')][0x0]&&_0x41ec19[_0xe4eb('0x4e')][0x0][_0xe4eb('0x4f')]?_0x41ec19[_0xe4eb('0x4e')][0x0][_0xe4eb('0x4f')]:'';})[_0xe4eb('0x50')]('\x0a');_0x18c513=_0xe79f43[_0xe4eb('0x4c')][_0xe4eb('0x4d')](function(_0x287ce4){return _0x287ce4&&_0x287ce4['alternatives'][0x0]&&_0x287ce4[_0xe4eb('0x4e')][0x0]['confidence']?_0x287ce4[_0xe4eb('0x4e')][0x0]['confidence']:0x0;})[_0xe4eb('0x50')]('\x0a');}logger[_0xe4eb('0x1b')]('googleASR\x20transcription',_0x5ecba5);logger[_0xe4eb('0x1b')]('googleASR\x20confidence',_0x18c513);return{'transcript':_0x5ecba5,'confidence':_0x18c513};})[_0xe4eb('0x51')](function(_0x4cc0a8){logger['error']('[%s]\x20%s:%s',_0x4cc0a8[_0xe4eb('0x15')],_0x4cc0a8[_0xe4eb('0x52')],_0x4cc0a8['message']);});};exports[_0xe4eb('0x53')]=function(_0x445688,_0x205783,_0x17eab3,_0x4b0ac8){var _0x1abe07=apiai(_0x205783,{'language':_0x4b0ac8||'en'});return _0x1abe07[_0xe4eb('0x54')](_0x17eab3,{'sessionId':md5(_0x445688)})[_0xe4eb('0x38')](function(_0x25fca5){logger[_0xe4eb('0x1b')](JSON[_0xe4eb('0x43')](_0x25fca5));return{'source':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x56')],'resolvedQuery':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x57')],'action':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x58')],'actionIncomplete':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x59')],'speech':_0x25fca5[_0xe4eb('0x55')]['fulfillment']['speech'],'score':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x5a')],'statusCode':_0x25fca5[_0xe4eb('0x5b')][_0xe4eb('0x5c')],'endConversation':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x5d')]['endConversation']||![],'isFallbackIntent':_0x25fca5[_0xe4eb('0x55')][_0xe4eb('0x5d')][_0xe4eb('0x5e')]};});};exports[_0xe4eb('0x5f')]=function(_0x3004ba,_0x2893e7,_0x306cb7,_0x58c4c4,_0x3d198f,_0x5805bc){var _0x42b14f=_0x58c4c4['replace'](/\\n/g,'\x0a');var _0x4c24ff={'credentials':{'private_key':_0x42b14f,'client_email':_0x306cb7}};var _0x58ad8a=new dialogflow[(_0xe4eb('0x60'))](_0x4c24ff);var _0x5c4511=_0x58ad8a[_0xe4eb('0x61')](_0x2893e7,md5(_0x3004ba));var _0x51dc88={'session':_0x5c4511,'queryInput':{'text':{'text':_0x3d198f,'languageCode':_0x5805bc}}};return _0x58ad8a['detectIntent'](_0x51dc88)[_0xe4eb('0x38')](function(_0x1998c0){if(_0x1998c0&&_0x1998c0[_0xe4eb('0x48')]){logger[_0xe4eb('0x1b')](_0xe4eb('0x62'),JSON['stringify'](_0x1998c0));var _0x1ccb47=_0x1998c0[0x0];if(_0x1ccb47){var _0x549498={'action':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x58')],'allRequiredParamsPresent':_0x1ccb47['queryResult'][_0xe4eb('0x64')],'endConversation':_0x1ccb47[_0xe4eb('0x63')]['diagnosticInfo']&&_0x1ccb47['queryResult']['diagnosticInfo'][_0xe4eb('0x65')]?_0x1ccb47['queryResult'][_0xe4eb('0x66')][_0xe4eb('0x65')]['end_conversation'][_0xe4eb('0x67')]:![],'fulfillmentText':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x68')],'intentName':_0x1ccb47['queryResult'][_0xe4eb('0x69')][_0xe4eb('0x52')],'intentDisplayName':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x69')]['displayName'],'isFallbackIntent':_0x1ccb47['queryResult']['intent']['isFallback'],'languageCode':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x6a')],'queryText':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x6b')],'responseId':_0x1ccb47[_0xe4eb('0x6c')],'score':_0x1ccb47[_0xe4eb('0x63')][_0xe4eb('0x6d')],'speech':_0x1ccb47['queryResult'][_0xe4eb('0x68')],'providerResponse':JSON[_0xe4eb('0x43')](_0x1998c0)};return _0x549498;}}});};exports[_0xe4eb('0x6e')]=function(_0x1e7291,_0x5a8e00,_0x394fde,_0x5b3ba1){return tilde['asr'](_0x1e7291,_0x5a8e00,_0x394fde,_0x5b3ba1)[_0xe4eb('0x38')](function(_0x1b9cff){try{fs['unlink'](_0x1e7291);}catch(_0x34eeaa){logger[_0xe4eb('0x16')](_0x34eeaa);}logger[_0xe4eb('0x1b')](_0xe4eb('0x6f'),_0x1b9cff['transcript']);logger[_0xe4eb('0x1b')](_0xe4eb('0x70'),_0x1b9cff[_0xe4eb('0x71')]);return _0x1b9cff;});};exports[_0xe4eb('0x72')]=function(_0x343b93,_0x5aefa9,_0x42a5d6,_0x3a043a,_0x400b34,_0x8ab184){var _0x47db4a=path[_0xe4eb('0x39')](__dirname,_0xe4eb('0x27'),rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x3a'));var _0x528585;return aws[_0xe4eb('0x73')](_0x343b93,_0x5aefa9,_0x42a5d6,_0x3a043a,_0x400b34,_0x8ab184,_0x47db4a)['then'](function(){_0x528585=path['resolve'](__dirname,'tmp',rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x29'));return convertFile(_0x47db4a,_0x528585);})[_0xe4eb('0x38')](function(){try{fs[_0xe4eb('0x1e')](_0x47db4a);fs[_0xe4eb('0x2c')](_0x528585,_0xe4eb('0x2d'));}catch(_0x4ad8fb){logger[_0xe4eb('0x16')](_0x4ad8fb);}return _0x528585[_0xe4eb('0x2e')]('.')[0x0];});};exports['awsLex']=function(_0x17532b,_0x37bdc5,_0x302467,_0x39e040,_0x449ffe,_0xd5445d){return aws[_0xe4eb('0x74')](_0x17532b,_0x37bdc5,_0x302467,_0x39e040,_0x449ffe,_0xd5445d)[_0xe4eb('0x38')](function(_0x2dd6f2){logger[_0xe4eb('0x1b')](JSON[_0xe4eb('0x43')](_0x2dd6f2));return _0x2dd6f2;});};exports[_0xe4eb('0x75')]=function(_0x48e4f1,_0x194854,_0x3a186f,_0x28c377){var _0x482eb6=util[_0xe4eb('0x76')](_0xe4eb('0x77'),ISPEECH_API,_0x48e4f1,encodeURIComponent(_0x194854),_0x3a186f,_0x28c377);var _0x535383=path['resolve'](__dirname,_0xe4eb('0x27'),rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x3a'));var _0x389545;return downloadFile(_0x482eb6,_0x535383)[_0xe4eb('0x38')](function(){_0x389545=path[_0xe4eb('0x39')](__dirname,_0xe4eb('0x27'),rs['generate'](0x4)+'.wav');return convertFile(_0x535383,_0x389545);})[_0xe4eb('0x38')](function(){try{fs['unlink'](_0x535383);fs[_0xe4eb('0x2c')](_0x389545,_0xe4eb('0x2d'));}catch(_0x590783){logger['error'](_0x590783);}return _0x389545[_0xe4eb('0x2e')]('.')[0x0];});};exports[_0xe4eb('0x78')]=function(_0x3e96db,_0x44fd08,_0x5b4618,_0x5be757){var _0x69d4a2=util[_0xe4eb('0x76')](_0xe4eb('0x79'),ISPEECH_API,_0x44fd08,_0x5b4618,base64Encode(_0x3e96db),_0x5be757?util[_0xe4eb('0x76')](_0xe4eb('0x7a'),encodeURIComponent(_0x5be757)):_0xe4eb('0x7b'));return uploadFile(_0x69d4a2)[_0xe4eb('0x38')](function(_0x3d4871){return querystring[_0xe4eb('0xa')](_0x3d4871);});};exports[_0xe4eb('0x7c')]=function(_0x3602f8,_0x1d1dcb){return sestek[_0xe4eb('0x7d')](_0x3602f8,_0x1d1dcb)[_0xe4eb('0x38')](function(_0xadbe1){logger[_0xe4eb('0x1b')](JSON['stringify'](_0xadbe1));var _0x45883c={'speech':_0xadbe1[_0xe4eb('0x7e')],'action':_0xadbe1[_0xe4eb('0x7f')]?_0xadbe1[_0xe4eb('0x7f')][_0xe4eb('0x80')]:undefined,'actiondata':_0xadbe1[_0xe4eb('0x7f')]?_0xadbe1[_0xe4eb('0x7f')][_0xe4eb('0x81')]:undefined};if(_0xadbe1[_0xe4eb('0x7f')]&&_0xadbe1[_0xe4eb('0x7f')][_0xe4eb('0x82')]){return base64Decode(_0xadbe1['channelData'][_0xe4eb('0x82')][_0xe4eb('0x83')],path[_0xe4eb('0x39')](__dirname,_0xe4eb('0x27'),rs[_0xe4eb('0x28')](0x4)+_0xe4eb('0x29')))['then'](function(_0x4f3740){_0x45883c[_0xe4eb('0x84')]=_0x4f3740;return _0x45883c;});}return _0x45883c;});};exports[_0xe4eb('0x85')]=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 a2127bc..37c4084 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 _0x93be=['./nda','exports'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x93be,0xa0));var _0xe93b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93be[_0x14add3];return _0x4a174f;};var nda=require(_0xe93b('0x0'));module[_0xe93b('0x1')]={'nda':nda}; \ No newline at end of file +var _0xbb18=['./nda'];(function(_0x3533d2,_0x24d150){var _0x33f99b=function(_0x3e9138){while(--_0x3e9138){_0x3533d2['push'](_0x3533d2['shift']());}};_0x33f99b(++_0x24d150);}(_0xbb18,0x1e5));var _0x8bb1=function(_0x15ffd5,_0x1bf5de){_0x15ffd5=_0x15ffd5-0x0;var _0x170afa=_0xbb18[_0x15ffd5];return _0x170afa;};var nda=require(_0x8bb1('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index d3f80bb..c42397e 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 _0x0565=['resolve','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','dnid','Bearer\x20','channelData','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var rp=require(_0x5056('0x0'));var url=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));module[_0x5056('0x4')]=function(_0x397289,_0xd4624d){var _0x300055={'method':_0x5056('0x5'),'uri':url[_0x5056('0x6')](_0xd4624d['ndauth_url'],_0x5056('0x7')),'form':{'grant_type':_0x5056('0x8'),'username':_0xd4624d[_0x5056('0x9')],'password':_0xd4624d[_0x5056('0x8')]},'json':!![]};return rp(_0x300055)['then'](function(_0x52b01f){var _0x38f74={'method':_0x5056('0x5'),'uri':url[_0x5056('0x6')](_0xd4624d[_0x5056('0xa')],_0x5056('0xb')),'body':{'type':_0xd4624d[_0x5056('0xc')]||_0x5056('0xd'),'channelId':_0x5056('0xe'),'conversation':{'id':_0x397289['uniqueid']},'from':{'id':_0x397289[_0x5056('0xf')],'name':_0x397289[_0x5056('0x10')]},'recipient':{'id':_0x397289[_0x5056('0x11')],'name':_0x397289['extension']},'text':_0xd4624d['text'],'channelData':{}},'headers':{'Authorization':_0x5056('0x12')+_0x52b01f['access_token']},'json':!![]};if(_0xd4624d['project']){_0x38f74['body'][_0x5056('0x13')]['ProjectName']=_0xd4624d[_0x5056('0x14')];}if(_0xd4624d[_0x5056('0x15')]=='1'){_0x38f74[_0x5056('0x16')]['channelData'][_0x5056('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5056('0x18')};}if(_0xd4624d[_0x5056('0x19')]){_0x38f74[_0x5056('0x16')][_0x5056('0x13')][_0x5056('0x1a')]=_0xd4624d['custom_action'];if(_0xd4624d[_0x5056('0x1b')]){_0x38f74['body'][_0x5056('0x13')][_0x5056('0x1c')]=_0xd4624d[_0x5056('0x1b')];}}logger[_0x5056('0x1d')](JSON[_0x5056('0x1e')](_0x38f74));return rp(_0x38f74);});}; \ No newline at end of file +var _0x9755=['custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','callerid','calleridname','dnid','text','Bearer\x20','access_token','body','channelData','ProjectName','project','AudioOutputSettings','audio/wav','CustomAction'];(function(_0x287e9e,_0x23f555){var _0x3d89e8=function(_0x20768c){while(--_0x20768c){_0x287e9e['push'](_0x287e9e['shift']());}};_0x3d89e8(++_0x23f555);}(_0x9755,0x1c6));var _0x5975=function(_0x4a0801,_0x55b298){_0x4a0801=_0x4a0801-0x0;var _0x47306d=_0x9755[_0x4a0801];return _0x47306d;};'use strict';var rp=require(_0x5975('0x0'));var url=require('url');var logger=require(_0x5975('0x1'))(_0x5975('0x2'));module[_0x5975('0x3')]=function(_0x5e3640,_0x53201e){var _0x5ab8b4={'method':_0x5975('0x4'),'uri':url[_0x5975('0x5')](_0x53201e[_0x5975('0x6')],_0x5975('0x7')),'form':{'grant_type':_0x5975('0x8'),'username':_0x53201e[_0x5975('0x9')],'password':_0x53201e[_0x5975('0x8')]},'json':!![]};return rp(_0x5ab8b4)['then'](function(_0x48d8b5){var _0x2209f1={'method':'POST','uri':url[_0x5975('0x5')](_0x53201e[_0x5975('0xa')],_0x5975('0xb')),'body':{'type':_0x53201e['ndaactivity_type']||_0x5975('0xc'),'channelId':'Nda','conversation':{'id':_0x5e3640['uniqueid']},'from':{'id':_0x5e3640[_0x5975('0xd')],'name':_0x5e3640[_0x5975('0xe')]},'recipient':{'id':_0x5e3640[_0x5975('0xf')],'name':_0x5e3640['extension']},'text':_0x53201e[_0x5975('0x10')],'channelData':{}},'headers':{'Authorization':_0x5975('0x11')+_0x48d8b5[_0x5975('0x12')]},'json':!![]};if(_0x53201e['project']){_0x2209f1[_0x5975('0x13')][_0x5975('0x14')][_0x5975('0x15')]=_0x53201e[_0x5975('0x16')];}if(_0x53201e['ndagenerate_audio']=='1'){_0x2209f1['body'][_0x5975('0x14')][_0x5975('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x5975('0x18')};}if(_0x53201e['custom_action']){_0x2209f1[_0x5975('0x13')]['channelData'][_0x5975('0x19')]=_0x53201e['custom_action'];if(_0x53201e[_0x5975('0x1a')]){_0x2209f1[_0x5975('0x13')][_0x5975('0x14')][_0x5975('0x1b')]=_0x53201e[_0x5975('0x1a')];}}logger[_0x5975('0x1c')](JSON[_0x5975('0x1d')](_0x2209f1));return rp(_0x2209f1);});}; \ 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 eb26d1c..a447b1e 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 _0x2c7e=['./lib/api'];(function(_0x51970b,_0x947e94){var _0x47db54=function(_0x5bab49){while(--_0x5bab49){_0x51970b['push'](_0x51970b['shift']());}};_0x47db54(++_0x947e94);}(_0x2c7e,0x73));var _0xe2c7=function(_0xd2c5bc,_0x50008a){_0xd2c5bc=_0xd2c5bc-0x0;var _0x5ae9fc=_0x2c7e[_0xd2c5bc];return _0x5ae9fc;};'use strict';var asr=require(_0xe2c7('0x0'));module['exports']=function(_0x3d73a1,_0x40202a,_0x578f2b,_0x1e1a70){return asr(_0x3d73a1,_0x40202a,_0x578f2b,_0x1e1a70);}; \ No newline at end of file +var _0xccbd=['./lib/api','exports'];(function(_0x499dbc,_0x1a93da){var _0x578230=function(_0x1bdede){while(--_0x1bdede){_0x499dbc['push'](_0x499dbc['shift']());}};_0x578230(++_0x1a93da);}(_0xccbd,0xb2));var _0xdccb=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xccbd[_0x3ff085];return _0x2b68c3;};'use strict';var asr=require(_0xdccb('0x0'));module[_0xdccb('0x1')]=function(_0x532c2,_0x58ec50,_0x5171db,_0x117e08){return asr(_0x532c2,_0x58ec50,_0x5171db,_0x117e08);}; \ 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 46ac536..7a9389d 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 _0x5836=['unix','send','stringify','createReadStream','close','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5836,0xd1));var _0x6583=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0x5836[_0x2e58c7];return _0x26eb00;};'use strict';var BPromise=require(_0x6583('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x6583('0x1'));var crypto=require(_0x6583('0x2'));var logger=require(_0x6583('0x3'))(_0x6583('0x4'));module['exports']=function(_0x372f82,_0x3b9a1c,_0x2cd3d7,_0xb3bcfb){return new BPromise(function(_0x1184b7,_0x5b312c){logger[_0x6583('0x5')](_0x6583('0x6'),_0xb3bcfb||_0x6583('0x7'));var _0x49d281=new WebSocket(_0xb3bcfb||_0x6583('0x7'),{'perMessageDeflate':![]});var _0x46f93d='';var _0x5c68ca='0';var _0x41d7='1';var _0x5daeae='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0xb8f240(_0x3dfa99){var _0x4bd218=crypto['createHash'](_0x6583('0x8'));_0x4bd218[_0x6583('0x9')](_0x3dfa99);return _0x4bd218[_0x6583('0xa')](_0x6583('0xb'));}function _0x117da2(){try{logger[_0x6583('0x5')](_0x6583('0xc'));var _0x1ee142=moment()[_0x6583('0xd')]();var _0x5c62e7=_0xb8f240(_0x1ee142+_0x3b9a1c+_0x2cd3d7);_0x49d281[_0x6583('0xe')](JSON[_0x6583('0xf')]({'appID':_0x3b9a1c,'timestamp':_0x1ee142,'appKey':_0x5c62e7}));var _0x4a96bd=fs[_0x6583('0x10')](_0x372f82);_0x4a96bd['on']('data',function(_0x5517ba){_0x49d281[_0x6583('0xe')](_0x5517ba);});_0x4a96bd['on'](_0x6583('0x11'),function(){_0x49d281[_0x6583('0xe')]('EOS');});}catch(_0x2bb6a9){logger['error'](_0x6583('0x12'),JSON[_0x6583('0xf')](_0x2bb6a9));_0x49d281[_0x6583('0x13')]();}}function _0x4a471b(_0x1138a3){try{if(_0x1138a3){var _0x28bae0=JSON['parse'](_0x1138a3);switch(_0x28bae0[_0x6583('0x14')]){case 0x0:if(_0x28bae0[_0x6583('0x15')]){if(_0x28bae0[_0x6583('0x15')]['final']){logger['info'](_0x6583('0x16'),JSON[_0x6583('0xf')](_0x28bae0[_0x6583('0x15')][_0x6583('0x17')]));_0x46f93d=_0x28bae0[_0x6583('0x15')][_0x6583('0x17')][0x0]['transcript'];_0x5c68ca=_0x28bae0[_0x6583('0x15')][_0x6583('0x17')][0x0]['likelihood'];_0x41d7='0';_0x5daeae=_0x6583('0x18');_0x49d281[_0x6583('0x13')]();}}break;case 0x1:logger[_0x6583('0x5')](_0x6583('0x19'));_0x41d7='1';_0x5daeae=_0x6583('0x19');break;case 0x2:logger[_0x6583('0x5')](_0x6583('0x1a'));_0x41d7='2';_0x5daeae=_0x6583('0x1a');break;case 0x9:logger[_0x6583('0x5')](_0x6583('0x1b'));_0x41d7='9';_0x5daeae=_0x6583('0x1b');break;case 0xa:logger['info'](_0x6583('0x1c'));_0x41d7='10';_0x5daeae=_0x6583('0x1c');break;case 0xb:logger[_0x6583('0x5')](_0x6583('0x1d'));_0x41d7='11';_0x5daeae=_0x6583('0x1d');}}}catch(_0x261f8a){logger[_0x6583('0x1e')](_0x6583('0x1f'),JSON[_0x6583('0xf')](_0x261f8a));_0x49d281['terminate']();}}function _0x2dd4a6(){logger[_0x6583('0x5')](_0x6583('0x20'));_0x1184b7({'transcript':_0x46f93d,'confidence':_0x5c68ca,'status':_0x41d7,'status_message':_0x5daeae});}function _0x561f04(_0x256f42){logger[_0x6583('0x1e')](_0x6583('0x21'));if(!_[_0x6583('0x22')](_0x256f42)){logger[_0x6583('0x1e')](_[_0x6583('0x23')](_0x256f42)?JSON[_0x6583('0xf')](_0x256f42):_0x256f42);}}_0x49d281['on'](_0x6583('0x24'),_0x117da2);_0x49d281['on']('message',_0x4a471b);_0x49d281['on'](_0x6583('0x11'),_0x2dd4a6);_0x49d281['on'](_0x6583('0x1e'),_0x561f04);});}; \ No newline at end of file +var _0x21a2=['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','digest','hex','unix','send','stringify','data','close','error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','crypto','../../../../../../config/logger','agi'];(function(_0x51dcb0,_0x2360ea){var _0x3bb98a=function(_0x47250a){while(--_0x47250a){_0x51dcb0['push'](_0x51dcb0['shift']());}};_0x3bb98a(++_0x2360ea);}(_0x21a2,0x171));var _0x221a=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x21a2[_0x2ec461];return _0x28603d;};'use strict';var BPromise=require(_0x221a('0x0'));var _=require(_0x221a('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x221a('0x2'));var logger=require(_0x221a('0x3'))(_0x221a('0x4'));module['exports']=function(_0x1105c7,_0x5dea94,_0x53d79d,_0x288263){return new BPromise(function(_0x5b233c,_0x58ced2){logger[_0x221a('0x5')](_0x221a('0x6'),_0x288263||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x227b41=new WebSocket(_0x288263||_0x221a('0x7'),{'perMessageDeflate':![]});var _0x7b1adb='';var _0xd1ae07='0';var _0x226b48='1';var _0x41e49e=_0x221a('0x8');function _0x2647c2(_0x20ad96){var _0xf0cff4=crypto[_0x221a('0x9')](_0x221a('0xa'));_0xf0cff4['update'](_0x20ad96);return _0xf0cff4[_0x221a('0xb')](_0x221a('0xc'));}function _0xca0dc0(){try{logger[_0x221a('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x17e25f=moment()[_0x221a('0xd')]();var _0x32552b=_0x2647c2(_0x17e25f+_0x5dea94+_0x53d79d);_0x227b41[_0x221a('0xe')](JSON[_0x221a('0xf')]({'appID':_0x5dea94,'timestamp':_0x17e25f,'appKey':_0x32552b}));var _0x268d20=fs['createReadStream'](_0x1105c7);_0x268d20['on'](_0x221a('0x10'),function(_0x11aab3){_0x227b41[_0x221a('0xe')](_0x11aab3);});_0x268d20['on'](_0x221a('0x11'),function(){_0x227b41[_0x221a('0xe')]('EOS');});}catch(_0xc2a39e){logger[_0x221a('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x221a('0xf')](_0xc2a39e));_0x227b41[_0x221a('0x13')]();}}function _0x357832(_0x56a2af){try{if(_0x56a2af){var _0xd00f42=JSON[_0x221a('0x14')](_0x56a2af);switch(_0xd00f42['status']){case 0x0:if(_0xd00f42[_0x221a('0x15')]){if(_0xd00f42[_0x221a('0x15')][_0x221a('0x16')]){logger[_0x221a('0x5')](_0x221a('0x17'),JSON[_0x221a('0xf')](_0xd00f42[_0x221a('0x15')][_0x221a('0x18')]));_0x7b1adb=_0xd00f42['result'][_0x221a('0x18')][0x0][_0x221a('0x19')];_0xd1ae07=_0xd00f42['result'][_0x221a('0x18')][0x0][_0x221a('0x1a')];_0x226b48='0';_0x41e49e='Success.';_0x227b41[_0x221a('0x13')]();}}break;case 0x1:logger['info'](_0x221a('0x8'));_0x226b48='1';_0x41e49e=_0x221a('0x8');break;case 0x2:logger[_0x221a('0x5')](_0x221a('0x1b'));_0x226b48='2';_0x41e49e=_0x221a('0x1b');break;case 0x9:logger[_0x221a('0x5')](_0x221a('0x1c'));_0x226b48='9';_0x41e49e=_0x221a('0x1c');break;case 0xa:logger[_0x221a('0x5')](_0x221a('0x1d'));_0x226b48='10';_0x41e49e=_0x221a('0x1d');break;case 0xb:logger[_0x221a('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x226b48='11';_0x41e49e='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x21e155){logger[_0x221a('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x21e155));_0x227b41['terminate']();}}function _0x2a8dda(){logger[_0x221a('0x5')](_0x221a('0x1e'));_0x5b233c({'transcript':_0x7b1adb,'confidence':_0xd1ae07,'status':_0x226b48,'status_message':_0x41e49e});}function _0x22f707(_0x448d95){logger[_0x221a('0x12')](_0x221a('0x1f'));if(!_['isNil'](_0x448d95)){logger[_0x221a('0x12')](_[_0x221a('0x20')](_0x448d95)?JSON[_0x221a('0xf')](_0x448d95):_0x448d95);}}_0x227b41['on']('open',_0xca0dc0);_0x227b41['on'](_0x221a('0x21'),_0x357832);_0x227b41['on'](_0x221a('0x11'),_0x2a8dda);_0x227b41['on'](_0x221a('0x12'),_0x22f707);});}; \ 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 a284c5a..4318475 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 _0x121c=['./asr','exports'];(function(_0x4c3026,_0x682e15){var _0x42418c=function(_0x51425f){while(--_0x51425f){_0x4c3026['push'](_0x4c3026['shift']());}};_0x42418c(++_0x682e15);}(_0x121c,0x15c));var _0xc121=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x121c[_0x55abd9];return _0x3e5669;};var asr=require(_0xc121('0x0'));module[_0xc121('0x1')]={'asr':asr}; \ No newline at end of file +var _0x9e8a=['./asr','exports'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0x9e8a,0x1d6));var _0xa9e8=function(_0x5ec09b,_0x12d654){_0x5ec09b=_0x5ec09b-0x0;var _0x5a8482=_0x9e8a[_0x5ec09b];return _0x5a8482;};var asr=require(_0xa9e8('0x0'));module[_0xa9e8('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d6a2ee2..8af7e42 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0xe706,0xa3));var _0x6e70=function(_0x3a2147,_0x536e69){_0x3a2147=_0x3a2147-0x0;var _0x158499=_0xe706[_0x3a2147];return _0x158499;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x55bd38,_0x48eacf){var _0x444323=function(_0x22c59c){while(--_0x22c59c){_0x55bd38['push'](_0x55bd38['shift']());}};_0x444323(++_0x48eacf);}(_0xe706,0xa3));var _0x6e70=function(_0x45655c,_0x407b81){_0x45655c=_0x45655c-0x0;var _0x24a8d9=_0xe706[_0x45655c];return _0x24a8d9;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 014c2fc..40737cd 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 _0x4c71=['%s.%s','setVariable','replaceObjectAllVariables','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','exec','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','toUpperCase','out','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','ndassistant_url','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','extension','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusCode','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','sayNumber','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getSquareProject','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agent','agentPause','error','agentUnpause','agentLogout','%s/%s@from-sip/n','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','google_tts_language','method','timeout','number','includes','POST','PUT','headers','parse','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult'];(function(_0x1c3fef,_0x4aba65){var _0xefba55=function(_0x467b84){while(--_0x467b84){_0x1c3fef['push'](_0x1c3fef['shift']());}};_0xefba55(++_0x4aba65);}(_0x4c71,0x12b));var _0x14c7=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4c71[_0x1928c9];return _0x51b5fb;};'use strict';var fs=require('fs');var util=require(_0x14c7('0x0'));var _=require(_0x14c7('0x1'));var sh=require('shelljs');var odbc=require(_0x14c7('0x2'))();var rs=require(_0x14c7('0x3'));var moment=require(_0x14c7('0x4'));var Mustache=require(_0x14c7('0x5'));var rp=require(_0x14c7('0x6'));var logger=require('../../config/logger')(_0x14c7('0x7'));var config=require(_0x14c7('0x8'));var shared=require(_0x14c7('0x9'));var scripts=require(_0x14c7('0xa'));var FILES_PATH=_0x14c7('0xb');var recursiveMapAttributes=['rawHeaders',_0x14c7('0xc')];var verticesWithRetry=[_0x14c7('0xd'),_0x14c7('0xe'),_0x14c7('0xf')];var AGIVertices=function(_0x2f19cc,_0x542adc,_0x350ef8){this['channel']=_0x2f19cc;this[_0x14c7('0x10')]=_0x542adc;this[_0x14c7('0x11')]=_0x350ef8;};AGIVertices['prototype'][_0x14c7('0x12')]=function(_0x47077e,_0x30aa3b){this[_0x14c7('0x10')][_0x14c7('0x13')](_0x47077e)[_0x14c7('0x14')](function(_0x53f5fa){_0x30aa3b(null,_0x53f5fa?_0x53f5fa['name']:![]);})[_0x14c7('0x15')](function(_0x651044){_0x30aa3b(_0x651044);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x17')]=function(_0x1199a1,_0x3e779f){this['rpc']['getVoiceQueueById'](_0x1199a1)[_0x14c7('0x14')](function(_0x34b078){_0x3e779f(null,_0x34b078?_0x34b078['name']:![]);})[_0x14c7('0x15')](function(_0x39c742){_0x3e779f(_0x39c742);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x18')]=function(_0x17e459,_0x2c8c03){this[_0x14c7('0x10')]['getSquareProjectById'](_0x17e459)[_0x14c7('0x14')](function(_0x76ee68){_0x2c8c03(null,_0x76ee68?_0x76ee68[_0x14c7('0x19')]:![]);})[_0x14c7('0x15')](function(_0x57d383){_0x2c8c03(_0x57d383);});};AGIVertices['prototype'][_0x14c7('0x1a')]=function(_0x3c6ab5,_0x44a561){this['rpc'][_0x14c7('0x1b')](_0x3c6ab5)[_0x14c7('0x14')](function(_0x2622b5){_0x44a561(null,_0x2622b5?_0x2622b5[_0x14c7('0x1c')]:![]);})['catch'](function(_0x5e1df1){_0x44a561(_0x5e1df1);});};AGIVertices['prototype'][_0x14c7('0x1d')]=function(_0x4944ad,_0x5be2e5){this[_0x14c7('0x10')][_0x14c7('0x1e')](_0x4944ad)[_0x14c7('0x14')](function(_0x1c914b){_0x5be2e5(null,_0x1c914b?_0x1c914b[_0x14c7('0x19')]:![]);})['catch'](function(_0x5d0f51){_0x5be2e5(_0x5d0f51);});};AGIVertices['prototype'][_0x14c7('0x1f')]=function(_0x1f24b4,_0x3ffc41){this[_0x14c7('0x10')][_0x14c7('0x20')](_0x1f24b4)[_0x14c7('0x14')](function(_0xb50129){_0x3ffc41(null,_0xb50129?_0xb50129['name']:![]);})[_0x14c7('0x15')](function(_0x21be43){_0x3ffc41(_0x21be43);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x21')]=function(_0x3b4344,_0x5a48e9){var _0x3dc18d=this;this[_0x14c7('0x10')][_0x14c7('0x22')](_0x3b4344)['then'](function(_0x576de4){_0x5a48e9(null,_0x576de4?_0x3dc18d['getSoundPath'](_0x576de4['save_name']):![]);})['catch'](function(_0x21656e){_0x5a48e9(_0x21656e);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x23')]=function(_0x2123b8,_0x58e5e7){this['rpc']['getMailAccountById'](_0x2123b8)[_0x14c7('0x14')](function(_0x235ee8){_0x58e5e7(null,_0x235ee8?_0x235ee8:![]);})[_0x14c7('0x15')](function(_0x8f1224){_0x58e5e7(_0x8f1224);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x24')]=function(_0x5a7f43,_0x14c55c,_0x2500f2){this[_0x14c7('0x11')]['sendMailMessage'](_0x5a7f43,_0x14c55c)['then'](function(){_0x2500f2(null);})[_0x14c7('0x15')](function(_0x286a65){_0x2500f2(_0x286a65);});};AGIVertices['prototype'][_0x14c7('0x25')]=function(_0x5957f4,_0xdfa924){this[_0x14c7('0x10')][_0x14c7('0x26')](_0x5957f4)[_0x14c7('0x14')](function(_0x19c8ba){if(_0x19c8ba){if(_0x19c8ba['IntervalId']){_0xdfa924(null,[_0x19c8ba[_0x14c7('0x27')]]);}else{_0xdfa924(null,_[_0x14c7('0x28')](_0x19c8ba[_0x14c7('0x29')],'interval'));}}else{_0xdfa924(null,![]);}})['catch'](function(_0x48d724){_0xdfa924(_0x48d724);});};AGIVertices[_0x14c7('0x16')]['getSoundPath']=function(_0x21caef){return util[_0x14c7('0x2a')](_0x14c7('0x2b'),FILES_PATH,_0x21caef);};AGIVertices[_0x14c7('0x16')]['getQueryOdbc']=function(_0x24252b,_0x330f41,_0x441d27){odbc[_0x14c7('0x2c')](_0x24252b,function(_0x5993c8){if(_0x5993c8){logger['error'](_0x14c7('0x2d'),_0x5993c8);_0x441d27(_0x5993c8);}else{logger[_0x14c7('0x2e')](_0x14c7('0x2f'));odbc[_0x14c7('0x30')](_0x330f41,function(_0x180275,_0x1d95f7){if(_0x180275){logger[_0x14c7('0x2e')]('Error\x20executing\x20query\x20%s',_0x330f41);_0x441d27(_0x180275);}else{logger[_0x14c7('0x2e')]('Query\x20executed\x20correctly\x20%s',_0x330f41);odbc['close'](function(_0x3e43f8){if(_0x3e43f8){logger['error'](_0x14c7('0x31'),_0x3e43f8);}_0x441d27(null,_0x1d95f7);});}});}});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x32')]=function(_0x3224bc,_0x2226d2){this[_0x14c7('0x10')]['getSmsAccountById'](_0x3224bc)[_0x14c7('0x14')](function(_0x2690a6){_0x2226d2(null,_0x2690a6?_0x2690a6:![]);})[_0x14c7('0x15')](function(_0xce0c81){_0x2226d2(_0xce0c81);});};AGIVertices['prototype'][_0x14c7('0x33')]=function(_0x190b75,_0x128956){this['rpc'][_0x14c7('0x33')](_0x190b75)[_0x14c7('0x14')](function(_0x349729){_0x128956(null,_0x349729);})[_0x14c7('0x15')](function(_0x4a31e8){_0x128956(_0x4a31e8);});};AGIVertices[_0x14c7('0x16')]['createSquareDetailsReport']=function(_0x5246d6,_0x961bdf,_0x4e7320){this[_0x14c7('0x10')][_0x14c7('0x34')]({'uniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'node':_0x5246d6[_0x14c7('0x37')],'application':_0x5246d6['agicommand'],'data':_0x961bdf||null,'project_name':this['channel'][_0x14c7('0x38')],'callerid':this[_0x14c7('0x35')][_0x14c7('0x39')]})[_0x14c7('0x14')](function(_0x1ece65){if(_0x4e7320){_0x4e7320(null,_0x1ece65);}})[_0x14c7('0x15')](function(_0xd0ac25){if(_0x4e7320){_0x4e7320(_0xd0ac25);}});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x3a')]=function(_0x576014,_0x3338ec,_0x4c0098,_0x2d0e17){this[_0x14c7('0x10')][_0x14c7('0x3a')]({'uniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x14c7('0x3b')],'context':this['channel'][_0x14c7('0x3c')],'extension':this[_0x14c7('0x35')]['extension'],'priority':this[_0x14c7('0x35')][_0x14c7('0x3d')],'accountcode':this[_0x14c7('0x35')][_0x14c7('0x3e')],'dnid':this['channel'][_0x14c7('0x3f')],'projectName':this[_0x14c7('0x35')][_0x14c7('0x38')],'saveName':_0x3338ec,'filename':_0x576014[_0x14c7('0x40')]||_0x3338ec,'savePath':_0x4c0098})[_0x14c7('0x14')](function(_0x13c2dc){_0x2d0e17(null,_0x13c2dc);})['catch'](function(_0x439780){_0x2d0e17(_0x439780);});};AGIVertices[_0x14c7('0x16')]['createSquareMessage']=function(_0x2e3227,_0x459517,_0xe9da42,_0xa0accb,_0x1c41e0){this[_0x14c7('0x10')][_0x14c7('0x41')]({'uniqueid':this[_0x14c7('0x35')]['uniqueid'],'body':_0x2e3227,'direction':_0x459517,'providerName':_0xe9da42,'providerResponse':_0xa0accb})[_0x14c7('0x14')](function(_0x12762c){if(_0x1c41e0){_0x1c41e0(null,_0x12762c);}})[_0x14c7('0x15')](function(_0x2903d2){if(_0x1c41e0){_0x1c41e0(_0x2903d2);}});};AGIVertices[_0x14c7('0x16')]['createCmContact']=function(_0x5c84ef,_0x101be){this['rpc'][_0x14c7('0x42')]({'firstName':_['isEmpty'](_0x5c84ef['name'])||_[_0x14c7('0x43')](_0x5c84ef[_0x14c7('0x19')])?'callback_'+Math[_0x14c7('0x44')]():_0x5c84ef[_0x14c7('0x19')],'lastName':_[_0x14c7('0x45')](_0x5c84ef[_0x14c7('0x46')])||_[_0x14c7('0x43')](_0x5c84ef[_0x14c7('0x46')])?null:_0x5c84ef['lastName'],'phone':_0x5c84ef['phone'],'ListId':_0x5c84ef[_0x14c7('0x47')],'scheduledat':_0x5c84ef[_0x14c7('0x48')],'callbackUniqueid':this[_0x14c7('0x35')][_0x14c7('0x36')],'tags':'callback','description':_0x14c7('0x49')+_0x5c84ef[_0x14c7('0x48')][_0x14c7('0x4a')](),'priority':_0x5c84ef[_0x14c7('0x4b')]})['then'](function(_0xebd4b9){_0x101be(null,_0xebd4b9);})['catch'](function(_0x284fc9){_0x101be(_0x284fc9);});};AGIVertices[_0x14c7('0x16')]['getPause']=function(_0x5e5a87,_0x3d2194){this[_0x14c7('0x10')][_0x14c7('0x4c')](_0x5e5a87)[_0x14c7('0x14')](function(_0x17f2ad){_0x3d2194(null,_0x17f2ad?_0x17f2ad['name']:![]);})[_0x14c7('0x15')](function(_0x5d2f75){_0x3d2194(_0x5d2f75);});};AGIVertices['prototype']['agentPause']=function(_0x35d996,_0x574f1d,_0x59d81f){var _0x5158fc={'role':_0x14c7('0x4d')};_0x5158fc[_0x35d996]=this[_0x14c7('0x35')]['callerid'];this['rpc'][_0x14c7('0x4e')](_0x5158fc,_0x574f1d,this[_0x14c7('0x35')][_0x14c7('0x36')])[_0x14c7('0x14')](function(_0x28d673){_0x59d81f(null,_[_0x14c7('0x43')](_0x28d673)?![]:!![]);})['catch'](function(_0x1b58b7){logger[_0x14c7('0x4f')](_0x1b58b7);_0x59d81f(null,![]);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x50')]=function(_0x263276,_0x43303f){var _0x369e5e={'role':_0x14c7('0x4d')};_0x369e5e[_0x263276]=this[_0x14c7('0x35')]['callerid'];this[_0x14c7('0x10')][_0x14c7('0x50')](_0x369e5e)[_0x14c7('0x14')](function(_0x29fc3c){_0x43303f(null,_[_0x14c7('0x43')](_0x29fc3c)?![]:!![]);})[_0x14c7('0x15')](function(_0x1e6152){logger['error'](_0x1e6152);_0x43303f(null,![]);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x51')]=function(_0x2de9bf,_0x3fe7f3){var _0x3b552b={'role':'agent'};_0x3b552b[_0x2de9bf]=this[_0x14c7('0x35')][_0x14c7('0x39')];this['rpc'][_0x14c7('0x51')](_0x3b552b)[_0x14c7('0x14')](function(_0x52fb08){_0x3fe7f3(null,_[_0x14c7('0x43')](_0x52fb08)?![]:!![]);})[_0x14c7('0x15')](function(_0x49c38b){logger['error'](_0x49c38b);_0x3fe7f3(null,![]);});};AGIVertices[_0x14c7('0x16')]['agentLogin']=function(_0x56e23c,_0x5c6c4b){var _0x325928={'role':_0x14c7('0x4d')};_0x325928[_0x56e23c]=this[_0x14c7('0x35')][_0x14c7('0x39')];var _0x42462e=_0x56e23c!='internal'?util[_0x14c7('0x2a')](_0x14c7('0x52'),'LOCAL',this['channel'][_0x14c7('0x39')]):undefined;this[_0x14c7('0x10')][_0x14c7('0x53')](_0x325928,_0x42462e)[_0x14c7('0x14')](function(_0x5be9b0){_0x5c6c4b(null,_[_0x14c7('0x43')](_0x5be9b0)?![]:!![]);})[_0x14c7('0x15')](function(_0x12b5a5){logger['error'](_0x12b5a5);_0x5c6c4b(null,![]);});};AGIVertices['prototype'][_0x14c7('0x54')]=function(_0x39a48e,_0x28c640){sh['exec'](_[_0x14c7('0x55')](_0x39a48e),function(_0x217f5c,_0x313d01){var _0x5108ea=_0x313d01[_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'');_0x28c640(null,_0x5108ea);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x1e59cc,_0x27d907){scripts[_0x14c7('0x57')](_0x1e59cc[_0x14c7('0x58')],_0x1e59cc[_0x14c7('0x59')]||'text',_0x1e59cc[_0x14c7('0x5a')],_0x1e59cc[_0x14c7('0x5b')]||_0x14c7('0x5c'),_0x1e59cc[_0x14c7('0x5d')]||_0x14c7('0x5e'),_0x1e59cc['audioEncoding']||'MP3')[_0x14c7('0x14')](function(_0x12f2f2){_0x27d907(null,_0x12f2f2);})[_0x14c7('0x15')](function(_0x519e4e){_0x27d907(_0x519e4e);});};AGIVertices[_0x14c7('0x16')]['googleTTS']=function(_0x527d3c,_0x968fc9){scripts['googleTTS'](_0x527d3c[_0x14c7('0x5a')],_0x527d3c[_0x14c7('0x5f')]||'en',0x1)[_0x14c7('0x14')](function(_0x535430){_0x968fc9(null,_0x535430);})[_0x14c7('0x15')](function(_0x435dba){_0x968fc9(_0x435dba);});};AGIVertices[_0x14c7('0x16')]['restAPI']=function(_0x5309ae,_0x5ed94d){var _0x5ee87c={'uri':_0x5309ae['url'],'method':_0x5309ae[_0x14c7('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5309ae[_0x14c7('0x61')])===_0x14c7('0x62')&&parseInt(_0x5309ae[_0x14c7('0x61')])>=0x1?parseInt(_0x5309ae['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x14c7('0x63')]([_0x14c7('0x64'),_0x14c7('0x65')],_0x5ee87c[_0x14c7('0x60')]['toUpperCase']())){try{_0x5ee87c['body']=_0x5309ae[_0x14c7('0xc')]?JSON['parse'](_0x5309ae[_0x14c7('0xc')]):{};}catch(_0x29d8d6){logger[_0x14c7('0x4f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x29d8d6);}}try{_0x5ee87c[_0x14c7('0x66')]=_0x5309ae['rawHeaders']?JSON[_0x14c7('0x67')](_0x5309ae[_0x14c7('0x68')]):{};}catch(_0x47b66b){logger[_0x14c7('0x4f')](_0x14c7('0x69'),_0x47b66b);}if(_0x5309ae[_0x14c7('0x6a')]){try{var _0x518543=require(_0x5309ae[_0x14c7('0x6a')])[_0x14c7('0x6b')](this,_0x5ee87c);_0x5ee87c[_0x14c7('0x6c')]=Mustache[_0x14c7('0x6d')](_0x5309ae[_0x14c7('0x6e')],_0x518543,{},['$$','$$']);if(_0x5ee87c[_0x14c7('0x66')]){_0x5ee87c[_0x14c7('0x66')]=JSON['parse'](Mustache['render'](JSON[_0x14c7('0x6f')](_0x5ee87c[_0x14c7('0x66')]),_0x518543,{},['$$','$$']));}if(_0x5ee87c[_0x14c7('0x70')]){_0x5ee87c[_0x14c7('0x70')]=JSON[_0x14c7('0x67')](Mustache['render'](JSON[_0x14c7('0x6f')](_0x5ee87c[_0x14c7('0x70')]),_0x518543,{},['$$','$$']));}}catch(_0x2fbe98){logger[_0x14c7('0x4f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2fbe98);}}rp(_0x5ee87c)[_0x14c7('0x14')](function(_0x371afe){var _0x4a0eee={'statusCode':_0x371afe['statusCode']||0xc8,'statusMessage':_0x371afe['statusMessage']||'OK','headers':_0x371afe[_0x14c7('0x66')]||{},'body':_0x371afe[_0x14c7('0x70')]||{}};_0x5ed94d(null,_0x4a0eee);})[_0x14c7('0x15')](function(_0x27fb70){var _0x28b598={'statusCode':_0x27fb70['statusCode']||0x1f4,'statusMessage':_0x27fb70[_0x14c7('0x71')]||_0x14c7('0x72'),'headers':_0x27fb70[_0x14c7('0x73')][_0x14c7('0x66')]||{},'body':_0x27fb70[_0x14c7('0x73')][_0x14c7('0x70')]||{}};_0x5ed94d(null,_0x28b598);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x74')]=function(_0x44275c,_0x18f857){scripts['googleDialogflow'](this[_0x14c7('0x35')][_0x14c7('0x36')],_0x44275c['key'],_0x44275c[_0x14c7('0x5a')],_0x44275c['dialogflow_language']||'en')[_0x14c7('0x14')](function(_0x5f2770){_0x18f857(null,_0x5f2770);})[_0x14c7('0x15')](function(_0x531279){_0x18f857(_0x531279);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x75')]=function(_0x1583ac,_0x285532){scripts[_0x14c7('0x75')](this[_0x14c7('0x35')][_0x14c7('0x36')],_0x1583ac[_0x14c7('0x76')],_0x1583ac[_0x14c7('0x77')],_0x1583ac[_0x14c7('0x78')],_0x1583ac['text'],_0x1583ac['dialogflowV2_language']||'en')[_0x14c7('0x14')](function(_0x1ec2c7){_0x285532(null,_0x1ec2c7);})[_0x14c7('0x15')](function(_0x5486fe){_0x285532(_0x5486fe);});};AGIVertices['prototype'][_0x14c7('0x79')]=function(_0xffb744,_0x360b79){scripts[_0x14c7('0x79')](this[_0x14c7('0x35')],_0xffb744)[_0x14c7('0x14')](function(_0x52c615){_0x360b79(null,_0x52c615);})['catch'](function(_0x3815e0){_0x360b79(_0x3815e0);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x7a')]=function(_0x160851,_0x43551c){scripts['ispeechTTS'](_0x160851[_0x14c7('0x7b')],_0x160851[_0x14c7('0x5a')],_0x160851[_0x14c7('0x7c')]||_0x14c7('0x5c'),_0x160851[_0x14c7('0x7d')])[_0x14c7('0x14')](function(_0x544be7){_0x43551c(null,_0x544be7);})['catch'](function(_0x537662){_0x43551c(_0x537662);});};AGIVertices['prototype'][_0x14c7('0x7e')]=function(_0x55d571,_0x2ec528,_0x56bccb){scripts[_0x14c7('0x7e')](_0x2ec528,_0x55d571[_0x14c7('0x7b')],_0x55d571[_0x14c7('0x7f')]||'en-US',this[_0x14c7('0x80')](_0x55d571['model'])?_0x55d571[_0x14c7('0x81')]:undefined)[_0x14c7('0x14')](function(_0x40f53e){_0x56bccb(null,_0x40f53e);})[_0x14c7('0x15')](function(_0x4b4051){_0x56bccb(_0x4b4051);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x82')]=function(_0x41d772,_0x55a8a1){scripts[_0x14c7('0x82')](_0x41d772['aws_access_key_id'],_0x41d772[_0x14c7('0x83')],_0x41d772[_0x14c7('0x84')],_0x41d772['aws_polly_voice']||_0x14c7('0x85'),_0x41d772['text'],_0x41d772['aws_text_type']||_0x14c7('0x5a'))[_0x14c7('0x14')](function(_0x4aeacb){_0x55a8a1(null,_0x4aeacb);})['catch'](function(_0x1c05c8){_0x55a8a1(_0x1c05c8);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x86')]=function(_0x2789c6,_0x3596c3){scripts[_0x14c7('0x86')](this['channel'][_0x14c7('0x36')],_0x2789c6['aws_access_key_id'],_0x2789c6[_0x14c7('0x83')],_0x2789c6[_0x14c7('0x87')],_0x2789c6[_0x14c7('0x5a')],_0x2789c6[_0x14c7('0x88')])[_0x14c7('0x14')](function(_0x485143){_0x3596c3(null,_0x485143);})['catch'](function(_0x3c0276){_0x3596c3(_0x3c0276);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x89')]=function(_0x10bf39,_0x3f5b51,_0x2e5a73){scripts[_0x14c7('0x89')](_0x3f5b51,_0x10bf39[_0x14c7('0x7b')],_0x10bf39[_0x14c7('0x8a')]||_0x14c7('0x5c'))[_0x14c7('0x14')](function(_0x122987){_0x2e5a73(null,_0x122987);})[_0x14c7('0x15')](function(_0x564033){_0x2e5a73(_0x564033);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x8b')]=function(_0x1e5e7c,_0x3e4725,_0x47908d){scripts['tildeASR'](_0x3e4725,_0x1e5e7c[_0x14c7('0x8c')],_0x1e5e7c['appsecret'],_0x1e5e7c[_0x14c7('0x6c')])[_0x14c7('0x14')](function(_0x4a047a){_0x47908d(null,_0x4a047a);})[_0x14c7('0x15')](function(_0x4adcfa){_0x47908d(_0x4adcfa);});};AGIVertices[_0x14c7('0x16')][_0x14c7('0x8d')]=function(_0x4eb152){var _0x1862d1=_[_0x14c7('0x63')](verticesWithRetry,_0x4eb152['agicommand'])?_0x4eb152:_[_0x14c7('0x8e')](_0x4eb152);for(var _0x1bd8c5 in _0x1862d1){if(_0x1862d1[_0x14c7('0x8f')](_0x1bd8c5)){if(_0x1862d1[_0x1bd8c5]&&_[_0x14c7('0x90')](_0x1862d1[_0x1bd8c5])){if(_['includes'](recursiveMapAttributes,_0x1bd8c5)){_0x1862d1[_0x1bd8c5]=this['replaceObjectAllVariables'](_0x1862d1[_0x1bd8c5]);}else{_0x1862d1[_0x1bd8c5]=this[_0x14c7('0x91')](_0x1862d1[_0x1bd8c5]);}}}}return _0x1862d1;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x92')]=function(_0x35fbbc){for(var _0x5c3bba in _0x35fbbc){if(_0x35fbbc[_0x14c7('0x8f')](_0x5c3bba)){if(_[_0x14c7('0x93')](_0x35fbbc[_0x5c3bba])){this['recursiveNodeIndex'](_0x35fbbc[_0x5c3bba]);}else if(_[_0x14c7('0x94')](_0x35fbbc[_0x5c3bba])){for(var _0x113efb=0x0;_0x113efb<_0x35fbbc[_0x5c3bba][_0x14c7('0x95')];_0x113efb++){this[_0x14c7('0x92')](_0x35fbbc[_0x5c3bba][_0x113efb]);}}else if(_[_0x14c7('0x90')](_0x35fbbc[_0x5c3bba])){_0x35fbbc[_0x5c3bba]=this[_0x14c7('0x91')](_0x35fbbc[_0x5c3bba]);}}}};AGIVertices['prototype'][_0x14c7('0x96')]=function(_0xc56a5e,_0x22d857){for(var _0x51a42b in _0xc56a5e){if(_0xc56a5e[_0x14c7('0x8f')](_0x51a42b)){if(_['isPlainObject'](_0xc56a5e[_0x51a42b])){if(!_[_0x14c7('0x45')](_0xc56a5e[_0x51a42b])){this[_0x14c7('0x96')](_0xc56a5e[_0x51a42b],util['format'](_0x14c7('0x97'),_0x22d857,_0x51a42b));}}else if(_['isArray'](_0xc56a5e[_0x51a42b])){for(var _0x2e4d54=0x0;_0x2e4d54<_0xc56a5e[_0x51a42b]['length'];_0x2e4d54++){this[_0x14c7('0x96')](_0xc56a5e[_0x51a42b][_0x2e4d54],util[_0x14c7('0x2a')](_0x14c7('0x97'),_0x22d857,_0x51a42b+'['+_0x2e4d54+']'));}}else{if(!_[_0x14c7('0x43')](_0xc56a5e[_0x51a42b])){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0x97'),_0x22d857,_0x51a42b),_0xc56a5e[_0x51a42b]);}}}}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x99')]=function(_0x38a50d){try{var _0xdb08c1=JSON['parse'](_0x38a50d);this[_0x14c7('0x92')](_0xdb08c1);return JSON['stringify'](_0xdb08c1);}catch(_0x50d218){return this[_0x14c7('0x91')](_0x38a50d);}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x91')]=function(_0x257302){var _0x2b56b8=_0x257302[_0x14c7('0x9a')]('{');for(var _0x518216=0x1;_0x518216<_0x2b56b8[_0x14c7('0x95')];_0x518216+=0x1){var _0x5ee66b=_0x2b56b8[_0x518216][_0x14c7('0x9a')]('}');if(_0x5ee66b[_0x14c7('0x95')]>0x1){_0x257302=_0x257302['replaceAll']('{'+_0x5ee66b[0x0]+'}',this[_0x14c7('0x35')][_0x14c7('0x12')](_0x5ee66b[0x0])[_0x14c7('0x9b')]||_0x5ee66b[0x0]);}}if(_0x2b56b8[_0x14c7('0x95')]===0x1){return _0x257302['toString']();}return this[_0x14c7('0x91')](_0x257302);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x9c')]=function(_0x453e0a,_0x427e80){var _0x13899b=this['channel'][_0x14c7('0x12')](_0x453e0a);if(_0x13899b[_0x14c7('0x9d')]===-0x1){return _0x13899b;}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x9e'),_0x427e80,_0x13899b[_0x14c7('0x9b')]));return this[_0x14c7('0x35')]['setVariable'](_0x427e80,_0x13899b[_0x14c7('0x9b')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x80')]=function(_0x1ec46a){return _0x1ec46a&&_0x1ec46a!=='0'&&_0x1ec46a!=='-1'&&_0x1ec46a!=='';};AGIVertices[_0x14c7('0x16')][_0x14c7('0x9f')]=function(_0x35e218){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x35e218,'-');_0x35e218[_0x14c7('0xa0')]=_0x35e218[_0x14c7('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x14c7('0x16')][_0x14c7('0xa1')]=function(_0x57963f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xa2'),_0x57963f[_0x14c7('0x37')]));if(!this['isConfigured'](_0x57963f['text'])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0xa3'));}var _0x5571a0='\x22'+_0x57963f[_0x14c7('0x5a')]+'\x22';if(this[_0x14c7('0x80')](_0x57963f['options'])){_0x5571a0+=','+_0x57963f['options'];}var _0x38304a=this[_0x14c7('0x35')]['exec'](_0x14c7('0xa4'),_0x5571a0);if(_0x38304a[_0x14c7('0x9d')]===-0x1){return _0x38304a;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xa6'),_0x5571a0));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xa7')]=function(_0x54b5d4){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xa8'),_0x54b5d4[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x54b5d4[_0x14c7('0xa9')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0xcee1b6=_0x54b5d4[_0x14c7('0xa9')];if(this['isConfigured'](_0x54b5d4[_0x14c7('0x73')])){_0xcee1b6+=','+_0x54b5d4['options'];}var _0x206f35=this['channel']['exec'](_0x14c7('0xab'),_0xcee1b6);if(_0x206f35[_0x14c7('0x9d')]===-0x1){return _0x206f35;}var _0x2c2f7e=this[_0x14c7('0x9c')](_0x14c7('0xac'),_0x14c7('0xad'));if(_0x2c2f7e['result']===-0x1){return _0x2c2f7e;}var _0x243b75=this[_0x14c7('0x9c')]('RECOG_INPUT()',_0x14c7('0xae'));if(_0x243b75['result']===-0x1){return _0x243b75;}var _0x48860a=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xb0'));if(_0x48860a[_0x14c7('0x9d')]===-0x1){return _0x48860a;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0xcee1b6));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x7')]=function(_0x1568d1){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xb1'),_0x1568d1[_0x14c7('0x37')]));return this['channel'][_0x14c7('0x7')]([_0x1568d1[_0x14c7('0xb2')],_0x1568d1[_0x14c7('0xb3')]]);};AGIVertices['prototype']['answer']=function(_0x254c68){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x254c68['label']));if(this['isConfigured'](_0x254c68['timeout'])){logger['info'](util[_0x14c7('0x2a')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x254c68[_0x14c7('0x61')]));var _0x208dac=this[_0x14c7('0x35')]['wait'](_0x254c68[_0x14c7('0x61')]);if(_0x208dac[_0x14c7('0x9d')]===-0x1){return _0x208dac;}}return this[_0x14c7('0x35')][_0x14c7('0xb4')]();};AGIVertices[_0x14c7('0x16')][_0x14c7('0xb5')]=function(_0x59a7c6){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0xb6'),_0x59a7c6[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x59a7c6['list_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x59a7c6,_0x14c7('0xb7'));}_0x59a7c6['scheduledAt']=moment();if(this[_0x14c7('0x80')](_0x59a7c6['delay'])){_0x59a7c6['scheduledAt']=moment()[_0x14c7('0xb8')](_0x59a7c6['delay'],_0x14c7('0xb9'));}if(!this[_0x14c7('0x80')](_0x59a7c6[_0x14c7('0x4b')])){_0x59a7c6[_0x14c7('0x4b')]=0x2;}this['createCmContact']['sync'](this,_0x59a7c6);return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xba'),_0x59a7c6[_0x14c7('0xbb')],_0x59a7c6[_0x14c7('0x47')],_0x59a7c6[_0x14c7('0x48')]));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xbc')]=function(_0x38f870){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xbd'),_0x38f870[_0x14c7('0x37')]));var _0x18af69=this[_0x14c7('0x35')]['exec'](_0x38f870['application'],_0x38f870['options']);if(_0x18af69[_0x14c7('0x9d')]===-0x1){return _0x18af69;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x38f870[_0x14c7('0xbf')],_0x38f870[_0x14c7('0x73')]));};AGIVertices[_0x14c7('0x16')]['lumenvoxtts']=function(_0x3c0d96){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc0'),_0x3c0d96[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x3c0d96[_0x14c7('0x5a')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x56006f='\x22'+_0x3c0d96[_0x14c7('0x5a')]+'\x22';if(this['isConfigured'](_0x3c0d96[_0x14c7('0x73')])){_0x56006f+=','+_0x3c0d96['options'];}var _0x2c9d30=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xa4'),_0x56006f);if(_0x2c9d30['result']===-0x1){return _0x2c9d30;}return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0xa6'),_0x56006f));};AGIVertices['prototype'][_0x14c7('0xc2')]=function(_0x35d344){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc3'),_0x35d344[_0x14c7('0x37')]));if(!this['isConfigured'](_0x35d344[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}var _0x334f39='\x22'+_0x35d344[_0x14c7('0x5a')]+'\x22';if(this['isConfigured'](_0x35d344[_0x14c7('0x73')])){_0x334f39+=','+_0x35d344[_0x14c7('0x73')];}var _0x4047d2=this[_0x14c7('0x35')]['exec'](_0x14c7('0xa4'),_0x334f39);if(_0x4047d2[_0x14c7('0x9d')]===-0x1){return _0x4047d2;}return this['channel']['noop'](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x334f39));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xc4')]=function(_0x321f5d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xc5'),_0x321f5d[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x321f5d[_0x14c7('0xa9')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0x479a00=_0x321f5d['grammar'];if(this[_0x14c7('0x80')](_0x321f5d[_0x14c7('0x73')])){_0x479a00+=','+_0x321f5d[_0x14c7('0x73')];}var _0x374fb7=this['channel']['exec']('MRCPRecog',_0x479a00);if(_0x374fb7['result']===-0x1){return _0x374fb7;}var _0x420714=this[_0x14c7('0x9c')](_0x14c7('0xac'),'LUMENVOX_ASR_CONFIDENCE');if(_0x420714[_0x14c7('0x9d')]===-0x1){return _0x420714;}var _0x558cc3=this['getAndSetVariable'](_0x14c7('0xc6'),_0x14c7('0xc7'));if(_0x558cc3[_0x14c7('0x9d')]===-0x1){return _0x558cc3;}var _0x48155c=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xc8'));if(_0x48155c[_0x14c7('0x9d')]===-0x1){return _0x48155c;}return this[_0x14c7('0x35')]['noop'](util['format'](_0x14c7('0xc9'),_0x479a00));};AGIVertices['prototype'][_0x14c7('0xca')]=function(_0x1e0be4){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xcb'),_0x1e0be4['label']));if(!this[_0x14c7('0x80')](_0x1e0be4[_0x14c7('0xa9')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xaa'));}var _0x2dbe7f=_0x1e0be4[_0x14c7('0xa9')];if(this[_0x14c7('0x80')](_0x1e0be4[_0x14c7('0x73')])){_0x2dbe7f+=','+_0x1e0be4[_0x14c7('0x73')];}var _0x3a8480=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xab'),_0x2dbe7f);if(_0x3a8480[_0x14c7('0x9d')]===-0x1){return _0x3a8480;}var _0x484ba6=this[_0x14c7('0x9c')](_0x14c7('0xac'),_0x14c7('0xcc'));if(_0x484ba6['result']===-0x1){return _0x484ba6;}var _0x242246=this[_0x14c7('0x9c')](_0x14c7('0xc6'),_0x14c7('0xcd'));if(_0x242246[_0x14c7('0x9d')]===-0x1){return _0x242246;}var _0x29fc6c=this[_0x14c7('0x9c')](_0x14c7('0xaf'),_0x14c7('0xce'));if(_0x29fc6c[_0x14c7('0x9d')]===-0x1){return _0x29fc6c;}return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x2dbe7f));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xcf')]=function(_0x2a3bb6){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2a3bb6[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0xd0')])){return this['channel'][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd1'));}var _0x246f38=this['getSquareOdbc'][_0x14c7('0x6b')](this,_0x2a3bb6[_0x14c7('0xd0')]);if(!_0x246f38){return this['channel'][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd2'));}if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0x30')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd3'));}var _0x10f428=_0x2a3bb6['query'][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xd4'),_0x10f428));var _0x29728e=this[_0x14c7('0xd5')][_0x14c7('0x6b')](this,_0x246f38,_0x10f428);this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x2a3bb6,_0x10f428);if(!this[_0x14c7('0x80')](_0x2a3bb6[_0x14c7('0xd6')])){return this['channel']['noop'](_0x14c7('0xd7'));}var _0xbfe3fc=this['getVariable'][_0x14c7('0x6b')](this,_0x2a3bb6[_0x14c7('0xd6')]);if(!_0xbfe3fc){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a3bb6,_0x14c7('0xd8'));}var _0x142283=this;_0x29728e[_0x14c7('0xd9')](function(_0x5eac1e,_0x1df714){Object[_0x14c7('0xda')](_0x5eac1e)[_0x14c7('0xd9')](function(_0x6efe7a){_0x142283['channel']['setVariable'](util[_0x14c7('0x2a')]('%s[%s][%s]',_0xbfe3fc,_0x1df714,_0x6efe7a),_0x5eac1e[_0x6efe7a]);});});this['channel']['setVariable'](util[_0x14c7('0x2a')]('%s_ROWS_COUNT',_0xbfe3fc),_0x29728e[_0x14c7('0x95')]);return this['channel']['noop'](util[_0x14c7('0x2a')]('variable\x20%s\x20set',_0xbfe3fc));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xdb')]=function(_0x205fa2){logger[_0x14c7('0xdc')](util[_0x14c7('0x2a')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x205fa2[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x205fa2[_0x14c7('0xdd')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x205fa2,_0x14c7('0xde'));}var _0x5bc72d=this[_0x14c7('0x1d')][_0x14c7('0x6b')](this,_0x205fa2[_0x14c7('0xdd')]);if(!_0x5bc72d){return this[_0x14c7('0x35')]['error'](_0x205fa2,_0x14c7('0xdf'));}var _0x10c4e0=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xe0'),[util[_0x14c7('0x2a')](_0x14c7('0xe1'),_0x5bc72d),_0x205fa2[_0x14c7('0x61')],_0x205fa2[_0x14c7('0xe2')],_0x205fa2['url']]);if(_0x10c4e0['result']===-0x1){return _0x10c4e0;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xe3'),_0x14c7('0xe0')));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xe4')]=function(_0x173eb9){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x173eb9[_0x14c7('0x37')]));if(!this['isConfigured'](_0x173eb9[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}if(!this[_0x14c7('0x80')](_0x173eb9[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this[_0x14c7('0x34')](_0x173eb9);this[_0x14c7('0x41')](_0x173eb9[_0x14c7('0x5a')],'in','','');this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format']('Trying\x20Dialogflow:\x20%s',_0x173eb9[_0x14c7('0x5a')]));var _0x2fca0b=this[_0x14c7('0x74')][_0x14c7('0x6b')](this,_0x173eb9);if(_0x2fca0b){for(var _0x47b952 in _0x2fca0b){if(_0x2fca0b['hasOwnProperty'](_0x47b952)){this[_0x14c7('0x35')]['setVariable'](util[_0x14c7('0x2a')](_0x14c7('0xe7'),_0x47b952['toUpperCase']()),_0x2fca0b[_0x47b952]);}}this['createSquareMessage'](_0x2fca0b[_0x14c7('0xe8')],'out','dialogflow','');return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Dialogflow\x20Result\x20%s',_0x2fca0b[_0x14c7('0xe8')]));}return this['channel'][_0x14c7('0x4f')](_0x173eb9,_0x14c7('0xe9'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xea')]=function(_0x57a1be){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xeb'),_0x57a1be['label']));if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x76')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xec'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x77')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xed'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x78')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20private_key\x20configured');}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0xee')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xef'));}if(!this[_0x14c7('0x80')](_0x57a1be[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x57a1be);this['createSquareMessage'](_0x57a1be[_0x14c7('0x5a')],'in','','');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xf0'),_0x57a1be[_0x14c7('0x5a')]));var _0x554229=this[_0x14c7('0x75')][_0x14c7('0x6b')](this,_0x57a1be);if(_0x554229){for(var _0x31c667 in _0x554229){if(_0x554229[_0x14c7('0x8f')](_0x31c667)){if(_0x31c667!==_0x14c7('0xf1')){this['channel'][_0x14c7('0x98')](util['format'](_0x14c7('0xe7'),_0x31c667[_0x14c7('0xf2')]()),_0x554229[_0x31c667]);}}}this[_0x14c7('0x41')](_0x554229[_0x14c7('0xe8')],_0x14c7('0xf3'),_0x14c7('0xea'),_0x554229[_0x14c7('0xf1')]);return this[_0x14c7('0x35')]['noop'](util['format']('DialogflowV2\x20Result\x20%s',_0x554229[_0x14c7('0xe8')]));}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x57a1be,_0x14c7('0xf4'));};AGIVertices[_0x14c7('0x16')]['sesteknda']=function(_0x298a35){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0xf5'),_0x298a35[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x298a35[_0x14c7('0xf6')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x298a35['username'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x298a35['password'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20password\x20configured');}if(!this[_0x14c7('0x80')](_0x298a35[_0x14c7('0xf7')])){return this[_0x14c7('0x35')]['noop']('no\x20text\x20configured');}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x298a35);this[_0x14c7('0x41')](_0x298a35[_0x14c7('0x5a')],'in','','');this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Trying\x20SestekNDA:\x20%s',_0x298a35['text']));var _0x5a6a0f=this[_0x14c7('0x79')][_0x14c7('0x6b')](this,_0x298a35);if(_0x5a6a0f){for(var _0x4dcbc0 in _0x5a6a0f){if(_0x5a6a0f[_0x14c7('0x8f')](_0x4dcbc0)){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0xf8'),_0x4dcbc0[_0x14c7('0xf2')]()),_0x5a6a0f[_0x4dcbc0]);}}this[_0x14c7('0x41')](_0x5a6a0f['speech'],'out',_0x14c7('0xf9'),'');if(_0x5a6a0f['audiofile']){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5a6a0f[_0x14c7('0xfa')]));var _0x499634=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x5a6a0f['audiofile']);try{fs['unlink'](_0x5a6a0f['audiofile']+_0x14c7('0xfc'));}catch(_0x1a3e97){logger[_0x14c7('0x4f')](_0x1a3e97);}return _0x499634;}else{return this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('SestekNDA\x20Result\x20%s',_0x5a6a0f['speech']));}}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x298a35,_0x14c7('0xfd'));};AGIVertices['prototype']['end']=function(_0x19e176){logger['info'](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x19e176['label']));return this[_0x14c7('0x35')]['noop']('end');};AGIVertices[_0x14c7('0x16')][_0x14c7('0xfe')]=function(_0x1d4871){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x1d4871[_0x14c7('0x37')]));var _0xe02662='';if(_0x1d4871[_0x14c7('0xff')]){if(!this[_0x14c7('0x80')](_0x1d4871[_0x14c7('0xff')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x100'));}else{var _0x8cd3ef=parseInt(_0x1d4871['trunk_id'],0xa);if(isNaN(_0x8cd3ef)){_0xe02662=_0x1d4871[_0x14c7('0xff')];}else{_0xe02662=this[_0x14c7('0x1f')][_0x14c7('0x6b')](this,_0x1d4871['trunk_id']);if(!_0xe02662){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x101'));}}}}else if(_0x1d4871[_0x14c7('0x102')]){_0xe02662=_0x1d4871[_0x14c7('0x102')];}else{return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x1d4871,_0x14c7('0x100'));}var _0x430494=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0xe0'),[util[_0x14c7('0x2a')](_0x14c7('0x103'),_0xe02662,_0x1d4871[_0x14c7('0xbb')]),_0x1d4871[_0x14c7('0x61')],_0x1d4871[_0x14c7('0xe2')],_0x1d4871['url']]);if(_0x430494[_0x14c7('0x9d')]===-0x1){return _0x430494;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Executed\x20command\x20%s',_0x14c7('0xe0')));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x104')]=function(_0x51469c){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x105'),_0x51469c[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x104'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0xe')]=function(_0x51c9db){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x51c9db[_0x14c7('0x37')]));if(_0x51c9db[_0x14c7('0xa0')]===0x0){return this[_0x14c7('0x9f')](_0x51c9db);}_0x51c9db[_0x14c7('0xa0')]-=0x1;if(!this[_0x14c7('0x80')](_0x51c9db[_0x14c7('0x106')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x51c9db,_0x14c7('0x107'));}var _0x3df6f9=this[_0x14c7('0x21')][_0x14c7('0x6b')](this,_0x51c9db[_0x14c7('0x106')]);if(!_0x3df6f9){return this['channel'][_0x14c7('0x4f')](_0x51c9db,_0x14c7('0x108'));}if(!this[_0x14c7('0x80')](_0x51c9db[_0x14c7('0xd6')])){return this['channel'][_0x14c7('0x4f')](_0x14c7('0xd7'));}var _0x144c10=this[_0x14c7('0x35')][_0x14c7('0x109')](_0x3df6f9,_0x51c9db[_0x14c7('0x10a')],_0x51c9db[_0x14c7('0x10b')]);var _0xefa7ff=_0x144c10['result']?_0x144c10[_0x14c7('0x9d')][_0x14c7('0x4a')]():'';logger[_0x14c7('0x2e')]('test',JSON[_0x14c7('0x6f')](_0x144c10));if(_0x144c10[_0x14c7('0x9d')]===-0x1){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0xefa7ff);return _0x144c10;}else if(_0x144c10['extra']===_0x14c7('0x61')){_0x144c10[_0x14c7('0x9d')]=_0xefa7ff[_0x14c7('0x95')]>=parseInt(_0x51c9db[_0x14c7('0x10c')])?'x':'i';}else{_0x144c10[_0x14c7('0x9d')]=_0xefa7ff['length']>=parseInt(_0x51c9db[_0x14c7('0x10c')])&&_0xefa7ff['length']<=parseInt(_0x51c9db['maxdigit'])?'x':'i';}var _0xc5d061=this['getVariable'][_0x14c7('0x6b')](this,_0x51c9db[_0x14c7('0xd6')]);if(!_0xc5d061){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x51c9db,'no\x20variable\x20found');}this[_0x14c7('0x35')]['setVariable'](_0xc5d061,_0xefa7ff);if(this[_0x14c7('0x80')](_0x51c9db['hiddendigitsnum'])){var _0x3ca830=parseInt(_0x51c9db[_0x14c7('0x10d')],0xa);var _0x5ae44d=rs[_0x14c7('0x10e')]({'charset':'*','length':_0x3ca830});var _0xd50e8f=_0xefa7ff['length'];if(_0xd50e8f>0x0){if(_0xd50e8f>_0x3ca830){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0x51c9db[_0x14c7('0x10f')]===_0x14c7('0x110')?_0x5ae44d+_0xefa7ff[_0x14c7('0x111')](_0x3ca830):_0xefa7ff[_0x14c7('0x111')](0x0,_0xd50e8f-_0x3ca830)+_0x5ae44d);}else{this['createSquareDetailsReport'][_0x14c7('0x6b')](this,_0x51c9db,rs[_0x14c7('0x10e')]({'charset':'*','length':_0xd50e8f}));}}else{this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,'');}}else{this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x51c9db,_0xefa7ff);}return _0x144c10;};AGIVertices['prototype'][_0x14c7('0xf')]=function(_0x212a92){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x212a92['label']));return this['getdigits'](_0x212a92);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x112')]=function(_0x5973ae){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x113'),_0x5973ae[_0x14c7('0x37')]));this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x5973ae,_0x5973ae[_0x14c7('0x114')]);return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x115'),_0x5973ae[_0x14c7('0x114')]));};AGIVertices[_0x14c7('0x16')]['awspolly']=function(_0x43a5a5){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x116'),_0x43a5a5[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x117')])||!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x83')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x118'));}if(!this[_0x14c7('0x80')](_0x43a5a5[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')]['noop'](util['format'](_0x14c7('0x119'),_0x43a5a5['text']));var _0x59c14f=this[_0x14c7('0x82')][_0x14c7('0x6b')](this,_0x43a5a5);if(_0x59c14f){this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x11a'),_0x59c14f));var _0x2aa434=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x59c14f);try{fs['unlink'](_0x59c14f+'.wav');}catch(_0x1e0f1b){logger['error'](_0x1e0f1b);}return _0x2aa434;}return this['channel']['error'](_0x43a5a5,_0x14c7('0x11b'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x11c')]=function(_0x53bc40){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x11d'),_0x53bc40[_0x14c7('0x37')]));if(!this['isConfigured'](_0x53bc40[_0x14c7('0x117')])||!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x83')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x118'));}if(!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x88')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x11e'));}if(!this[_0x14c7('0x80')](_0x53bc40[_0x14c7('0x5a')])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xe6')]=!![];this['createSquareDetailsReport'](_0x53bc40);this['createSquareMessage'](_0x53bc40[_0x14c7('0x5a')],'in','','');this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x11f'),_0x53bc40['text']));var _0x520ace=this[_0x14c7('0x86')]['sync'](this,_0x53bc40);if(_0x520ace){for(var _0x366c20 in _0x520ace){if(_0x520ace[_0x14c7('0x8f')](_0x366c20)&&_[_0x14c7('0x90')](_0x520ace[_0x366c20])){this[_0x14c7('0x35')][_0x14c7('0x98')](util['format'](_0x14c7('0x120'),_0x366c20[_0x14c7('0xf2')]()),_0x520ace[_0x366c20]);}}if(_[_0x14c7('0x43')](_0x520ace['message'])){return this[_0x14c7('0x35')]['noop'](_0x14c7('0x121'));}else{this[_0x14c7('0x41')](_0x520ace['message'],_0x14c7('0xf3'),'amazonlex','');return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x122'),_0x520ace[_0x14c7('0x71')]));}}return this['channel']['error'](_0x53bc40,_0x14c7('0x123'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x124')]=function(_0x40860d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x125'),_0x40860d[_0x14c7('0x37')],_0x40860d['timeout']));if(!this[_0x14c7('0x80')](_0x40860d[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}var _0x3a25ba=_0x14c7('0x126');var _0x28d91f=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x1c845e=util[_0x14c7('0x2a')](_0x14c7('0x97'),_0x28d91f,_0x3a25ba);var _0x4b59fa=!![];if(_0x40860d[_0x14c7('0x128')]===_0x14c7('0x129')){_0x4b59fa=![];}var _0x1489df=this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x28d91f,_0x3a25ba,_0x40860d['intKey'],_0x40860d['timeout'],undefined,_0x4b59fa);if(_0x1489df[_0x14c7('0x9d')]!==-0x1){this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x12b'),_0x1c845e));var _0x56e6af=this['googleASR'][_0x14c7('0x6b')](this,_0x40860d,_0x1c845e);if(_0x56e6af){for(var _0x36b7b7 in _0x56e6af){if(_0x56e6af['hasOwnProperty'](_0x36b7b7)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('GOOGLE_ASR_%s',_0x36b7b7[_0x14c7('0xf2')]()),_0x56e6af[_0x36b7b7]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x12c'),JSON[_0x14c7('0x6f')](_0x56e6af)));}}return _0x1489df;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x12d')]=function(_0x47c2ee){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x12e'),_0x47c2ee[_0x14c7('0x37')]));if(!this['isConfigured'](_0x47c2ee[_0x14c7('0x8c')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0x12f'));}if(!this['isConfigured'](_0x47c2ee['appsecret'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x130'));}var _0x420b8e='wav';var _0x3aa3e1=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,rs['generate'](0x4));var _0x1c9f10=util[_0x14c7('0x2a')]('%s.%s',_0x3aa3e1,_0x420b8e);var _0x36a3fb=!![];if(_0x47c2ee[_0x14c7('0x128')]==='NOBEEP'){_0x36a3fb=![];}var _0x118740=this['channel']['recordFile'](_0x3aa3e1,_0x420b8e,_0x47c2ee[_0x14c7('0x131')],_0x47c2ee['timeout'],undefined,_0x36a3fb);if(_0x118740[_0x14c7('0x9d')]!==-0x1){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x132'),_0x1c9f10));var _0x12b90a=this['tildeASR'][_0x14c7('0x6b')](this,_0x47c2ee,_0x1c9f10);if(_0x12b90a){for(var _0x2f93d8 in _0x12b90a){if(_0x12b90a[_0x14c7('0x8f')](_0x2f93d8)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('TILDE_ASR_%s',_0x2f93d8[_0x14c7('0xf2')]()),_0x12b90a[_0x2f93d8]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0x133'),JSON[_0x14c7('0x6f')](_0x12b90a)));}}return _0x118740;};AGIVertices[_0x14c7('0x16')]['gotoc']=function(_0x393598){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x393598[_0x14c7('0x37')]));return this['channel']['continueAt'](_0x393598[_0x14c7('0x3c')],_0x393598[_0x14c7('0x134')],_0x393598['priority']);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x135')]=function(_0xe8a6e3){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xe8a6e3[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0xe8a6e3[_0x14c7('0x136')])){return this[_0x14c7('0x35')]['error'](_0xe8a6e3,_0x14c7('0x137'));}try{var _0x2a2e76=eval(_0xe8a6e3[_0x14c7('0x136')])?_0x14c7('0x138'):_0x14c7('0x139');this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x13a'),_0xe8a6e3[_0x14c7('0x136')],_0x2a2e76));return{'code':0xc8,'result':_0x2a2e76};}catch(_0x21dd54){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x13b')]=function(_0x704206){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x13c'),_0x704206[_0x14c7('0x37')]));if(!this['isConfigured'](_0x704206[_0x14c7('0x13d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x704206,_0x14c7('0x13e'));}var _0x3c6093=this['getIntervals'][_0x14c7('0x6b')](this,_0x704206[_0x14c7('0x13d')]);if(!_0x3c6093){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x704206,_0x14c7('0x13f'));}for(var _0x715b5b=0x0;_0x715b5b<_0x3c6093[_0x14c7('0x95')];_0x715b5b+=0x1){var _0x384df1=this[_0x14c7('0x35')]['getVariable'](util[_0x14c7('0x2a')](_0x14c7('0x140'),_0x3c6093[_0x715b5b]));if(_0x384df1[_0x14c7('0x9d')]===-0x1){return _0x384df1;}logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x141'),_0x3c6093[_0x715b5b],_0x384df1['extra']));if(_0x384df1[_0x14c7('0x9b')]==='true'){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x141'),_0x3c6093[_0x715b5b],_0x14c7('0x138')));this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')]('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],_0x14c7('0x138')));return{'code':0xc8,'result':_0x14c7('0x138')};}else{logger['info'](util[_0x14c7('0x2a')]('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],_0x14c7('0x139')));this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format']('IFTIME\x20%s\x20%s',_0x3c6093[_0x715b5b],'false'));}}return{'code':0xc8,'result':_0x14c7('0x139')};};AGIVertices[_0x14c7('0x16')][_0x14c7('0x142')]=function(_0x539b35){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x539b35[_0x14c7('0x37')]));return this['channel'][_0x14c7('0x142')]();};AGIVertices[_0x14c7('0x16')][_0x14c7('0x143')]=function(_0x38e48e){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x144'),_0x38e48e[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x38e48e[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')]('no\x20key\x20configured');}var _0x34c139=_0x14c7('0x126');var _0x2d4d48=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x14c7('0x10e')](0x4));var _0x565f19=util['format'](_0x14c7('0x97'),_0x2d4d48,_0x34c139);var _0x215d9f=!![];if(_0x38e48e[_0x14c7('0x128')]===_0x14c7('0x129')){_0x215d9f=![];}var _0x2b9b80=this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x2d4d48,_0x34c139,_0x38e48e[_0x14c7('0x131')],_0x38e48e[_0x14c7('0x61')],undefined,_0x215d9f);if(_0x2b9b80[_0x14c7('0x9d')]!==-0x1){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('ispeech\x20%s\x20file\x20created',_0x565f19));var _0x26c4ed=this[_0x14c7('0x7e')][_0x14c7('0x6b')](this,_0x38e48e,_0x565f19);if(_0x26c4ed){for(var _0x141c55 in _0x26c4ed){if(_0x26c4ed['hasOwnProperty'](_0x141c55)){this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x145'),_0x141c55[_0x14c7('0xf2')]()),_0x26c4ed[_0x141c55]);}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0x146'),JSON['stringify'](_0x26c4ed)));}}return _0x2b9b80;};AGIVertices[_0x14c7('0x16')][_0x14c7('0x147')]=function(_0x3c752f){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x148'),_0x3c752f[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x3c752f[_0x14c7('0x7b')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xe5'));}if(!this[_0x14c7('0x80')](_0x3c752f[_0x14c7('0x5a')])){return this['channel'][_0x14c7('0xa5')](_0x14c7('0xa3'));}this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x149'),_0x3c752f[_0x14c7('0x5a')]));var _0x354df8=this['ispeechTTS'][_0x14c7('0x6b')](this,_0x3c752f);if(_0x354df8){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('ispeech\x20%s\x20file\x20created',_0x354df8));var _0x4440fa=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x354df8,_0x3c752f[_0x14c7('0x131')]);try{fs['unlink'](_0x354df8+_0x14c7('0xfc'));}catch(_0x49a43a){logger['error'](_0x49a43a);}return _0x4440fa;}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x3c752f,_0x14c7('0x14a'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x14b')]=function(_0x562e3e){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x14c'),_0x562e3e[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x562e3e[_0x14c7('0x14d')])){return this[_0x14c7('0x35')]['error'](_0x562e3e,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x14f'),this['channel']['callerid'],_0x562e3e[_0x14c7('0x14d')]));var _0x4bd9ff=this[_0x14c7('0x53')][_0x14c7('0x6b')](this,_0x562e3e[_0x14c7('0x14d')]);if(_0x4bd9ff){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e['findBy']));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')]['callerid'],_0x562e3e[_0x14c7('0x14d')]));this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x562e3e['findBy']));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')]['logout']=function(_0x1f7bae){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x154'),_0x1f7bae['label']));if(!this[_0x14c7('0x80')](_0x1f7bae[_0x14c7('0x14d')])){return this['channel'][_0x14c7('0x4f')](_0x1f7bae,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));var _0x1f7ab2=this[_0x14c7('0x51')][_0x14c7('0x6b')](this,_0x1f7bae[_0x14c7('0x14d')]);if(_0x1f7ab2){logger['info'](util[_0x14c7('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));this['channel'][_0x14c7('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae['findBy']));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')]['callerid'],_0x1f7bae[_0x14c7('0x14d')]));this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x1f7bae[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x155')]=function(_0x292fa9){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x156'),_0x292fa9[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x292fa9['operation'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x292fa9,_0x14c7('0x157'));}this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0x158'),_0x292fa9[_0x14c7('0x159')]));var _0x157a5e=eval(_0x292fa9[_0x14c7('0x159')]);if(!this[_0x14c7('0x80')](_0x292fa9['variable_id'])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xd7'));}var _0x375969=this['getVariable']['sync'](this,_0x292fa9[_0x14c7('0xd6')]);if(!_0x375969){return this[_0x14c7('0x35')]['error'](_0x292fa9,_0x14c7('0xd8'));}if(_['isArray'](_0x157a5e)){var _0x9684fa=this;_0x157a5e[_0x14c7('0xd9')](function(_0x5ab457,_0x4d60d2){_0x9684fa[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')]('%s[%s]',_0x375969,_0x4d60d2),_0x5ab457);});return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x15a'),_0x375969));}else{return this[_0x14c7('0x35')][_0x14c7('0x98')](_0x375969,_0x157a5e);}};AGIVertices[_0x14c7('0x16')][_0x14c7('0xd')]=function(_0x140b8){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x140b8[_0x14c7('0x37')]));if(_0x140b8[_0x14c7('0xa0')]===0x0){return this['maxRetry'](_0x140b8);}_0x140b8[_0x14c7('0xa0')]-=0x1;if(!this[_0x14c7('0x80')](_0x140b8[_0x14c7('0x106')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,_0x14c7('0x107'));}var _0x3c18db=this[_0x14c7('0x21')][_0x14c7('0x6b')](this,_0x140b8[_0x14c7('0x106')]);if(!_0x3c18db){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,_0x14c7('0x108'));}var _0x46f179=this[_0x14c7('0x35')][_0x14c7('0x109')](_0x3c18db,_0x140b8[_0x14c7('0x10a')],_0x140b8[_0x14c7('0x15b')]);var _0x58fd60=_0x46f179[_0x14c7('0x9d')];if(_0x46f179[_0x14c7('0x9d')]===-0x1){this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x140b8,'-1');return _0x46f179;}else if(_0x46f179['extra']===_0x14c7('0x61')){_0x46f179[_0x14c7('0x9d')]=_0x46f179['result'][_0x14c7('0x95')]>0x0?_0x46f179[_0x14c7('0x9d')]:'t';}else if(_[_0x14c7('0x45')](_0x46f179[_0x14c7('0x9d')])){_0x46f179[_0x14c7('0x9d')]='#';_0x58fd60='#';}if(!this['isConfigured'](_0x140b8[_0x14c7('0xd6')])){this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xd7'));}else{var _0x243f8e=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x140b8[_0x14c7('0xd6')]);if(!_0x243f8e){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x140b8,'no\x20variable\x20found');}this['channel'][_0x14c7('0x98')](_0x243f8e,_0x58fd60);}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x140b8,_0x58fd60);return _0x46f179;};AGIVertices['prototype'][_0x14c7('0xa5')]=function(_0x1dd1e3){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x15c'),_0x1dd1e3[_0x14c7('0x37')]));return this['channel'][_0x14c7('0xa5')](_0x1dd1e3[_0x14c7('0x15d')]||_0x1dd1e3[_0x14c7('0x37')]);};AGIVertices['prototype'][_0x14c7('0x15e')]=function(_0x2ae381){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x15f'),_0x2ae381[_0x14c7('0x37')]));if(!this['isConfigured'](_0x2ae381[_0x14c7('0x14d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2ae381,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x14f'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381['findBy']));var _0x21f647=this['getPause'][_0x14c7('0x6b')](this,_0x2ae381[_0x14c7('0x160')]);var _0x4db31b=this[_0x14c7('0x4e')]['sync'](this,_0x2ae381['findBy'],_0x21f647);if(_0x4db31b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x14c7('0x35')]['callerid'],_0x2ae381[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger['info'](util['format'](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381['findBy']));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x2ae381[_0x14c7('0x14d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x161')]=function(_0x231c08){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x162'),_0x231c08[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x231c08['file_id'])){return this['channel'][_0x14c7('0x4f')](_0x231c08,_0x14c7('0x107'));}var _0x54495e=this['getSound']['sync'](this,_0x231c08['file_id']);if(!_0x54495e){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x231c08,_0x14c7('0x108'));}var _0x35be01=this[_0x14c7('0x35')]['exec']('PLAYBACK',[_0x54495e,_0x231c08[_0x14c7('0xe2')]]);if(_0x35be01['result']===-0x1){return _0x35be01;}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x163'),_0x54495e));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x164')]=function(_0x4aa59f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x165'),_0x4aa59f[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x4aa59f['queue_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x4aa59f,'no\x20queue\x20selected');}var _0x47379f='';var _0x12d94b=parseInt(_0x4aa59f[_0x14c7('0x166')],0xa);if(isNaN(_0x12d94b)){_0x47379f=_0x4aa59f['queue_id'];}else{_0x47379f=this[_0x14c7('0x17')][_0x14c7('0x6b')](this,_0x4aa59f[_0x14c7('0x166')]);if(!_0x47379f){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x4aa59f,_0x14c7('0x167'));}}var _0x2c86c5='';if(this['isConfigured'](_0x4aa59f['file_id'])){var _0x452593=this['getSound'][_0x14c7('0x6b')](this,_0x4aa59f['file_id']);if(_0x452593){_0x2c86c5=_0x452593;}}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x4aa59f,_0x47379f);if(_0x4aa59f[_0x14c7('0xe2')]['indexOf']('x')<0x0){_0x4aa59f[_0x14c7('0xe2')]+='x';}if(_0x4aa59f[_0x14c7('0xe2')][_0x14c7('0x168')]('X')<0x0){_0x4aa59f[_0x14c7('0xe2')]+='X';}this[_0x14c7('0x35')][_0x14c7('0x98')](_0x14c7('0x169'),_0x47379f?_0x47379f[_0x14c7('0x16a')]():'');var _0x3c457a=this[_0x14c7('0x35')][_0x14c7('0xc1')](_0x14c7('0x16b'),[_0x47379f,_0x4aa59f[_0x14c7('0xe2')],_0x4aa59f['url'],_0x2c86c5,_0x4aa59f[_0x14c7('0x61')],_0x4aa59f[_0x14c7('0x7')],_0x4aa59f[_0x14c7('0x16c')],_0x4aa59f[_0x14c7('0x16d')],'',_0x4aa59f[_0x14c7('0x16e')]]);if(_0x3c457a['result']===-0x1){return _0x3c457a;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x16b'),_0x47379f));};AGIVertices['prototype'][_0x14c7('0x16f')]=function(_0x4b0d1e){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x170'),_0x4b0d1e[_0x14c7('0x37')]));var _0x1e98c6=_0x4b0d1e[_0x14c7('0x171')]||_0x14c7('0x126');var _0x1fec9e=util[_0x14c7('0x2a')]('%s_%s',this[_0x14c7('0x35')][_0x14c7('0x36')],rs['generate'](0x5));var _0x212b0e=util[_0x14c7('0x2a')](_0x14c7('0x172'),FILES_PATH,_0x1fec9e,_0x1e98c6);var _0x269907=util[_0x14c7('0x2a')](_0x14c7('0x127'),FILES_PATH,_0x1fec9e);this['createSquareRecording']['sync'](this,_0x4b0d1e,_0x1fec9e,_0x212b0e);this['channel'][_0x14c7('0x98')]('RECORDING_SAVENAME',_0x1fec9e);logger[_0x14c7('0x2e')](_0x14c7('0x173'),_0x269907,_0x1e98c6,_0x4b0d1e[_0x14c7('0x174')],_0x4b0d1e[_0x14c7('0x61')]);return this[_0x14c7('0x35')][_0x14c7('0x12a')](_0x269907,_0x1e98c6,_0x4b0d1e['escape_digits'],_0x4b0d1e[_0x14c7('0x61')],undefined,!![]);};AGIVertices[_0x14c7('0x16')]['restapi']=function(_0x16e225){logger['info'](util[_0x14c7('0x2a')](_0x14c7('0x175'),_0x16e225[_0x14c7('0x37')]));if(!this['isConfigured'](_0x16e225[_0x14c7('0x6e')])){return this['channel']['noop'](_0x14c7('0x176'));}var _0x1f2da8=this[_0x14c7('0x177')][_0x14c7('0x6b')](this,_0x16e225);logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Response:',util[_0x14c7('0x178')](_0x1f2da8,{'showHidden':![],'depth':null})));if(!this[_0x14c7('0x80')](_0x16e225[_0x14c7('0xd6')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x179'));}var _0x1e675a=this['getVariable'][_0x14c7('0x6b')](this,_0x16e225[_0x14c7('0xd6')]);if(!_0x1e675a){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x16e225,_0x14c7('0xd8'));}this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x17a'),_0x1e675a),_0x1f2da8['statusCode']?_0x1f2da8[_0x14c7('0x17b')]:_0x14c7('0x17c'));this[_0x14c7('0x35')][_0x14c7('0x98')](util[_0x14c7('0x2a')](_0x14c7('0x17d'),_0x1e675a),_0x1f2da8[_0x14c7('0x17e')]?_0x1f2da8[_0x14c7('0x17e')]:'OK');if(_0x1f2da8[_0x14c7('0x70')]){try{this['saveRestApiResult'](_0x1f2da8[_0x14c7('0x70')],_0x1e675a);}catch(_0x2e4d83){logger[_0x14c7('0x4f')](util[_0x14c7('0x2a')](_0x14c7('0x17f'),_0x1e675a));}}return this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x180'),_0x1e675a));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x181')]=function(_0x54bf88){logger['info'](util['format'](_0x14c7('0x182'),_0x54bf88[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0x183')](_0x54bf88['digits']['replace'](/\s+/g,''),_0x54bf88[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x184')]=function(_0x480866){logger['info'](util[_0x14c7('0x2a')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x480866[_0x14c7('0x37')]));return this[_0x14c7('0x35')][_0x14c7('0x185')](_0x480866['number'][_0x14c7('0x56')](/\s+/g,''),_0x480866[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')][_0x14c7('0x186')]=function(_0x44a5b2){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x44a5b2['label']));return this[_0x14c7('0x35')][_0x14c7('0x187')](_0x44a5b2['text'],_0x44a5b2[_0x14c7('0x174')]);};AGIVertices[_0x14c7('0x16')]['sendMail']=function(_0x557c62){logger[_0x14c7('0x2e')](util['format'](_0x14c7('0x188'),_0x557c62[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x557c62[_0x14c7('0x189')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x18a'));}var _0x3d5650=this[_0x14c7('0x23')][_0x14c7('0x6b')](this,_0x557c62[_0x14c7('0x189')]);if(!_0x3d5650||!_0x3d5650[_0x14c7('0x18b')]){return this[_0x14c7('0x35')]['error'](_0x557c62,'no\x20mail\x20account\x20found');}var _0x11b139={'from':util[_0x14c7('0x2a')](_0x14c7('0x18c'),_0x3d5650[_0x14c7('0x19')],_0x3d5650[_0x14c7('0x18d')]||_0x3d5650[_0x14c7('0x18b')][_0x14c7('0x18e')]),'to':_0x557c62['to']||'','cc':_0x557c62['cc']||'','bcc':_0x557c62['bcc']||'','subject':_0x557c62['subject'],'html':_0x557c62[_0x14c7('0x5a')],'text':_0x557c62['text']};if(this['isConfigured'](_0x557c62[_0x14c7('0x18f')])){}logger[_0x14c7('0xdc')](_0x14c7('0x190'),JSON[_0x14c7('0x6f')](_0x11b139));this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x557c62,_0x557c62[_0x14c7('0x189')]);this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x191'),_0x3d5650[_0x14c7('0x19')]));this['sendMailMessage']['sync'](this,_0x3d5650[_0x14c7('0x192')],_0x11b139);return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x193'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x194')]=function(_0x1b4039){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x195'),_0x1b4039['label']));return this['channel'][_0x14c7('0xa5')](_0x14c7('0x196'));};AGIVertices[_0x14c7('0x16')]['sendSMS']=function(_0x52783b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x197'),_0x52783b[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x52783b[_0x14c7('0x198')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x199'));}var _0x185904=this[_0x14c7('0x32')][_0x14c7('0x6b')](this,_0x52783b[_0x14c7('0x198')]);if(!_0x185904){return this['channel'][_0x14c7('0x4f')](_0x52783b,_0x14c7('0x19a'));}var _0x502556={'body':_0x52783b[_0x14c7('0x19b')],'phone':_0x52783b['to']||'','SmsAccountId':_0x185904['id']};logger['debug'](_0x14c7('0x19c'),JSON[_0x14c7('0x6f')](_0x502556));this[_0x14c7('0x34')]['sync'](this,_0x52783b,_0x52783b[_0x14c7('0x198')]);this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x185904['name']));this['createSmsMessage'][_0x14c7('0x6b')](this,_0x502556);return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x19d'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x19e')]=function(_0x5edfc8){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x19f'),_0x5edfc8['label']));if(!this[_0x14c7('0x80')](_0x5edfc8['variable_id'])){return this[_0x14c7('0x35')]['error'](_0x5edfc8,_0x14c7('0x1a0'));}var _0x1b2248=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x5edfc8[_0x14c7('0xd6')]);if(!_0x1b2248){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x5edfc8,_0x14c7('0xd8'));}return this[_0x14c7('0x35')]['setVariable'](_0x1b2248,_0x5edfc8['variable_value']);};AGIVertices[_0x14c7('0x16')]['start']=function(_0x52405d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1a1'),_0x52405d['label']));this[_0x14c7('0x35')][_0x14c7('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x52405d[_0x14c7('0xb4')]===_0x14c7('0x1a2')){this['channel'][_0x14c7('0xa5')](_0x14c7('0x1a3'));return this[_0x14c7('0x35')]['answer']();}return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0x1a4'));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1a5')]=function(_0x2a9d7f){logger[_0x14c7('0x2e')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2a9d7f['label']));if(!this[_0x14c7('0x80')](_0x2a9d7f['project_id'])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x2a9d7f,_0x14c7('0x1a6'));}var _0x317d0e=this[_0x14c7('0x18')][_0x14c7('0x6b')](this,_0x2a9d7f[_0x14c7('0x1a7')]);if(!this[_0x14c7('0x80')](_0x317d0e)){return this['channel'][_0x14c7('0x4f')](_0x2a9d7f,util[_0x14c7('0x2a')](_0x14c7('0x1a8'),_0x2a9d7f[_0x14c7('0x1a7')]));}if(_0x317d0e===this[_0x14c7('0x35')][_0x14c7('0x38')]){return this['channel'][_0x14c7('0x4f')](_0x2a9d7f,_0x14c7('0x1a9'));}this[_0x14c7('0x34')][_0x14c7('0x6b')](this,_0x2a9d7f,_0x317d0e);var _0x2a94f6=this[_0x14c7('0x35')]['exec'](_0x14c7('0x1aa'),util[_0x14c7('0x2a')](_0x14c7('0x1ab'),config[_0x14c7('0x7')][_0x14c7('0x1ac')]||'127.0.0.1',_0x317d0e,this['channel'][_0x14c7('0x38')]));if(_0x2a94f6[_0x14c7('0x9d')]===-0x1){return _0x2a94f6;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util['format'](_0x14c7('0xbe'),_0x14c7('0x1aa'),_0x317d0e));};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1ad')]=function(_0x423cb9){logger['info'](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x423cb9['label']));var _0x5af163=this[_0x14c7('0x54')][_0x14c7('0x6b')](this,_0x423cb9[_0x14c7('0xb2')]);this['createSquareDetailsReport'][_0x14c7('0x6b')](this,_0x423cb9,_0x423cb9[_0x14c7('0xb2')]);if(this['isConfigured'](_0x423cb9[_0x14c7('0xd6')])){var _0x51f154=this[_0x14c7('0x12')][_0x14c7('0x6b')](this,_0x423cb9['variable_id']);if(_0x51f154){this['channel'][_0x14c7('0x98')](_0x51f154,_0x5af163);return this['channel']['noop'](util[_0x14c7('0x2a')](_0x14c7('0x1ae'),_0x423cb9[_0x14c7('0xb2')],_0x51f154));}}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x1af'),_0x423cb9[_0x14c7('0xb2')]));};AGIVertices['prototype'][_0x14c7('0x1b0')]=function(_0x38e74d){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b1'),_0x38e74d['label']));_0x38e74d['text']=_0x38e74d[_0x14c7('0x5a')][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14c7('0x80')](_0x38e74d[_0x14c7('0x58')])){return this['channel'][_0x14c7('0xa5')]('no\x20apiKey\x20configured');}if(!this[_0x14c7('0x80')](_0x38e74d[_0x14c7('0x5a')])){return this[_0x14c7('0x35')]['noop']('no\x20text\x20configured');}this[_0x14c7('0x35')]['noop'](util[_0x14c7('0x2a')](_0x14c7('0x1b2'),_0x38e74d[_0x14c7('0x5a')]));var _0x5e272b=this[_0x14c7('0x57')][_0x14c7('0x6b')](this,_0x38e74d);if(_0x5e272b){this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5e272b));var _0x38a1f9=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x5e272b);try{fs[_0x14c7('0x1b3')](_0x5e272b+_0x14c7('0xfc'));}catch(_0x473667){logger[_0x14c7('0x4f')](_0x473667);}return _0x38a1f9;}return this['channel'][_0x14c7('0x4f')](_0x38e74d,_0x14c7('0x1b4'));};AGIVertices[_0x14c7('0x16')]['tts']=function(_0x19271e){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b5'),_0x19271e[_0x14c7('0x37')]));_0x19271e[_0x14c7('0x5a')]=_0x19271e[_0x14c7('0x5a')][_0x14c7('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x14c7('0x80')](_0x19271e[_0x14c7('0x5a')])){return this[_0x14c7('0x35')][_0x14c7('0xa5')](_0x14c7('0xa3'));}this['channel'][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0x1b6'),_0x19271e['text']));var _0x375a94=this[_0x14c7('0x1b7')][_0x14c7('0x6b')](this,_0x19271e);if(_0x375a94){this[_0x14c7('0x35')]['noop'](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x375a94));var _0x5b87fe=this[_0x14c7('0x35')][_0x14c7('0xfb')](_0x375a94);try{fs['unlink'](_0x375a94+_0x14c7('0xfc'));}catch(_0x161c21){logger[_0x14c7('0x4f')](_0x161c21);}return _0x5b87fe;}return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x19271e,_0x14c7('0x1b8'));};AGIVertices[_0x14c7('0x16')]['unpause']=function(_0x12da5b){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1b9'),_0x12da5b['label']));if(!this[_0x14c7('0x80')](_0x12da5b[_0x14c7('0x14d')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x12da5b,_0x14c7('0x14e'));}logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x14f'),this[_0x14c7('0x35')]['callerid'],_0x12da5b[_0x14c7('0x14d')]));var _0x197a3f=this['agentUnpause'][_0x14c7('0x6b')](this,_0x12da5b[_0x14c7('0x14d')]);if(_0x197a3f){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x150'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));this[_0x14c7('0x35')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));return{'code':0xc8,'result':_0x14c7('0x151')};}else{logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x152'),this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b[_0x14c7('0x14d')]));this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x14c7('0x35')][_0x14c7('0x39')],_0x12da5b['findBy']));return{'code':0xc8,'result':_0x14c7('0x153')};}};AGIVertices[_0x14c7('0x16')][_0x14c7('0x1ba')]=function(_0x12b4aa){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x12b4aa[_0x14c7('0x37')]));var _0x6fe6f9=this[_0x14c7('0x35')]['exec']('VOICEMAIL',[_0x12b4aa[_0x14c7('0x1bb')],_0x12b4aa['options']]);if(_0x6fe6f9['result']===-0x1){return _0x6fe6f9;}return this[_0x14c7('0x35')][_0x14c7('0xa5')](util[_0x14c7('0x2a')](_0x14c7('0xbe'),_0x14c7('0x1bc'),_0x12b4aa[_0x14c7('0x1bb')]));};AGIVertices['prototype'][_0x14c7('0x1bd')]=function(_0x23180c){logger[_0x14c7('0x2e')](util[_0x14c7('0x2a')](_0x14c7('0x1be'),_0x23180c[_0x14c7('0x37')]));if(!this[_0x14c7('0x80')](_0x23180c[_0x14c7('0xd6')])){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x23180c,_0x14c7('0x1a0'));}var _0x440941=this['getVariable']['sync'](this,_0x23180c[_0x14c7('0xd6')]);if(!_0x440941){return this[_0x14c7('0x35')][_0x14c7('0x4f')](_0x23180c,'no\x20variable\x20found');}var _0x5eac7b=this[_0x14c7('0x35')][_0x14c7('0x12')](_0x440941);return{'code':0xc8,'result':_0x5eac7b[_0x14c7('0x9b')]?_0x5eac7b[_0x14c7('0x9b')]:'-'};};String['prototype'][_0x14c7('0x1bf')]=function(_0x13499b,_0xa4d06d){return this[_0x14c7('0x9a')](_0x13499b)[_0x14c7('0x1c0')](_0xa4d06d);};module[_0x14c7('0x1c1')]=AGIVertices; \ No newline at end of file +var _0xf69b=['Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','getData','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','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','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','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','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','escape_digits','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\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','odbc','moment','mustache','request-promise','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','then','name','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','getQueryOdbc','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','callerid','createSquareRecording','uniqueid','context','extension','createSquareMessage','createCmContact','isEmpty','callback_','random','isNil','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','PUT','toUpperCase','body','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','parse','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','google_asr_language','tildeASR','appid','appsecret','uri','includes','agicommand','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','result','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0xf69b,0xc8));var _0xbf69=function(_0x5bb4f3,_0x2b59bd){_0x5bb4f3=_0x5bb4f3-0x0;var _0x2711a3=_0xf69b[_0x5bb4f3];return _0x2711a3;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xbf69('0x0'));var sh=require('shelljs');var odbc=require(_0xbf69('0x1'))();var rs=require('randomstring');var moment=require(_0xbf69('0x2'));var Mustache=require(_0xbf69('0x3'));var rp=require(_0xbf69('0x4'));var logger=require('../../config/logger')(_0xbf69('0x5'));var config=require('../../config/environment');var shared=require(_0xbf69('0x6'));var scripts=require(_0xbf69('0x7'));var FILES_PATH=_0xbf69('0x8');var recursiveMapAttributes=[_0xbf69('0x9'),_0xbf69('0xa')];var verticesWithRetry=[_0xbf69('0xb'),_0xbf69('0xc'),_0xbf69('0xd')];var AGIVertices=function(_0xd7c347,_0x64efd7,_0x516ebe){this[_0xbf69('0xe')]=_0xd7c347;this[_0xbf69('0xf')]=_0x64efd7;this[_0xbf69('0x10')]=_0x516ebe;};AGIVertices['prototype'][_0xbf69('0x11')]=function(_0x143d60,_0x134773){this[_0xbf69('0xf')]['getVariableById'](_0x143d60)[_0xbf69('0x12')](function(_0xa9d09f){_0x134773(null,_0xa9d09f?_0xa9d09f[_0xbf69('0x13')]:![]);})[_0xbf69('0x14')](function(_0x294fdb){_0x134773(_0x294fdb);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x429769,_0x514f81){this['rpc']['getVoiceQueueById'](_0x429769)[_0xbf69('0x12')](function(_0x16b8e3){_0x514f81(null,_0x16b8e3?_0x16b8e3[_0xbf69('0x13')]:![]);})['catch'](function(_0x1b7412){_0x514f81(_0x1b7412);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x16')]=function(_0x256274,_0x45312f){this[_0xbf69('0xf')][_0xbf69('0x17')](_0x256274)[_0xbf69('0x12')](function(_0x307fbb){_0x45312f(null,_0x307fbb?_0x307fbb[_0xbf69('0x13')]:![]);})[_0xbf69('0x14')](function(_0x26be42){_0x45312f(_0x26be42);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x18')]=function(_0x191972,_0x9d59e4){this['rpc'][_0xbf69('0x19')](_0x191972)[_0xbf69('0x12')](function(_0x331a3c){_0x9d59e4(null,_0x331a3c?_0x331a3c['dsn']:![]);})[_0xbf69('0x14')](function(_0x3fcfd9){_0x9d59e4(_0x3fcfd9);});};AGIVertices[_0xbf69('0x15')]['getUser']=function(_0x4cb86f,_0xc75cf){this[_0xbf69('0xf')][_0xbf69('0x1a')](_0x4cb86f)[_0xbf69('0x12')](function(_0x3e0f36){_0xc75cf(null,_0x3e0f36?_0x3e0f36['name']:![]);})[_0xbf69('0x14')](function(_0x49edb3){_0xc75cf(_0x49edb3);});};AGIVertices[_0xbf69('0x15')]['getTrunk']=function(_0x2a5874,_0x301e6c){this[_0xbf69('0xf')][_0xbf69('0x1b')](_0x2a5874)[_0xbf69('0x12')](function(_0x18f08c){_0x301e6c(null,_0x18f08c?_0x18f08c[_0xbf69('0x13')]:![]);})[_0xbf69('0x14')](function(_0x7ad809){_0x301e6c(_0x7ad809);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x1c')]=function(_0x3fb393,_0x3993f6){var _0x381d75=this;this['rpc'][_0xbf69('0x1d')](_0x3fb393)[_0xbf69('0x12')](function(_0x36c8e5){_0x3993f6(null,_0x36c8e5?_0x381d75[_0xbf69('0x1e')](_0x36c8e5[_0xbf69('0x1f')]):![]);})[_0xbf69('0x14')](function(_0x2e8556){_0x3993f6(_0x2e8556);});};AGIVertices['prototype'][_0xbf69('0x20')]=function(_0x42339f,_0x56fe97){this['rpc']['getMailAccountById'](_0x42339f)['then'](function(_0x2f2156){_0x56fe97(null,_0x2f2156?_0x2f2156:![]);})[_0xbf69('0x14')](function(_0x55fe42){_0x56fe97(_0x55fe42);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x21')]=function(_0x2cfc02,_0x57cc3b,_0x540636){this[_0xbf69('0x10')][_0xbf69('0x21')](_0x2cfc02,_0x57cc3b)[_0xbf69('0x12')](function(){_0x540636(null);})[_0xbf69('0x14')](function(_0x47d0d2){_0x540636(_0x47d0d2);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x22')]=function(_0x197b90,_0xa42223){this[_0xbf69('0xf')][_0xbf69('0x23')](_0x197b90)[_0xbf69('0x12')](function(_0x4124cd){if(_0x4124cd){if(_0x4124cd['IntervalId']){_0xa42223(null,[_0x4124cd[_0xbf69('0x24')]]);}else{_0xa42223(null,_[_0xbf69('0x25')](_0x4124cd[_0xbf69('0x26')],'interval'));}}else{_0xa42223(null,![]);}})[_0xbf69('0x14')](function(_0x5b160e){_0xa42223(_0x5b160e);});};AGIVertices['prototype'][_0xbf69('0x1e')]=function(_0x1ccddd){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x1ccddd);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x27')]=function(_0x24321f,_0x57d5c3,_0xf50bee){odbc['open'](_0x24321f,function(_0x179971){if(_0x179971){logger['error'](_0xbf69('0x28'),_0x179971);_0xf50bee(_0x179971);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xbf69('0x29')](_0x57d5c3,function(_0x40efb3,_0x78922a){if(_0x40efb3){logger[_0xbf69('0x2a')](_0xbf69('0x2b'),_0x57d5c3);_0xf50bee(_0x40efb3);}else{logger['info'](_0xbf69('0x2c'),_0x57d5c3);odbc[_0xbf69('0x2d')](function(_0x473988){if(_0x473988){logger[_0xbf69('0x2e')](_0xbf69('0x2f'),_0x473988);}_0xf50bee(null,_0x78922a);});}});}});};AGIVertices[_0xbf69('0x15')]['getSmsAccount']=function(_0x1a75b7,_0xd17f90){this['rpc'][_0xbf69('0x30')](_0x1a75b7)[_0xbf69('0x12')](function(_0x4bfdd0){_0xd17f90(null,_0x4bfdd0?_0x4bfdd0:![]);})[_0xbf69('0x14')](function(_0x49e341){_0xd17f90(_0x49e341);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x31')]=function(_0x2cf88f,_0x3b9dc8){this['rpc'][_0xbf69('0x31')](_0x2cf88f)[_0xbf69('0x12')](function(_0x4531d7){_0x3b9dc8(null,_0x4531d7);})[_0xbf69('0x14')](function(_0xdcd0c1){_0x3b9dc8(_0xdcd0c1);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x32')]=function(_0x496a64,_0x47b92f,_0x5920dd){this[_0xbf69('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xbf69('0xe')]['uniqueid'],'node':_0x496a64[_0xbf69('0x33')],'application':_0x496a64['agicommand'],'data':_0x47b92f||null,'project_name':this['channel'][_0xbf69('0x34')],'callerid':this[_0xbf69('0xe')][_0xbf69('0x35')]})[_0xbf69('0x12')](function(_0x18f33f){if(_0x5920dd){_0x5920dd(null,_0x18f33f);}})[_0xbf69('0x14')](function(_0x4124e8){if(_0x5920dd){_0x5920dd(_0x4124e8);}});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x36')]=function(_0x2fc1d6,_0x3ab9e8,_0x452ffd,_0x41d9b0){this['rpc'][_0xbf69('0x36')]({'uniqueid':this[_0xbf69('0xe')][_0xbf69('0x37')],'callerid':this[_0xbf69('0xe')]['callerid'],'calleridname':this['channel']['calleridname'],'context':this[_0xbf69('0xe')][_0xbf69('0x38')],'extension':this[_0xbf69('0xe')][_0xbf69('0x39')],'priority':this[_0xbf69('0xe')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xbf69('0xe')]['dnid'],'projectName':this['channel'][_0xbf69('0x34')],'saveName':_0x3ab9e8,'filename':_0x2fc1d6['file']||_0x3ab9e8,'savePath':_0x452ffd})[_0xbf69('0x12')](function(_0x3d23a2){_0x41d9b0(null,_0x3d23a2);})[_0xbf69('0x14')](function(_0x34df9f){_0x41d9b0(_0x34df9f);});};AGIVertices['prototype'][_0xbf69('0x3a')]=function(_0x38aca5,_0x525fa1,_0x63d062,_0x44ac40,_0x353b9a){this['rpc'][_0xbf69('0x3a')]({'uniqueid':this[_0xbf69('0xe')][_0xbf69('0x37')],'body':_0x38aca5,'direction':_0x525fa1,'providerName':_0x63d062,'providerResponse':_0x44ac40})[_0xbf69('0x12')](function(_0x17dd26){if(_0x353b9a){_0x353b9a(null,_0x17dd26);}})[_0xbf69('0x14')](function(_0x3d3b22){if(_0x353b9a){_0x353b9a(_0x3d3b22);}});};AGIVertices['prototype'][_0xbf69('0x3b')]=function(_0x515f65,_0x5220d1){this[_0xbf69('0xf')][_0xbf69('0x3b')]({'firstName':_[_0xbf69('0x3c')](_0x515f65[_0xbf69('0x13')])||_['isNil'](_0x515f65['name'])?_0xbf69('0x3d')+Math[_0xbf69('0x3e')]():_0x515f65[_0xbf69('0x13')],'lastName':_[_0xbf69('0x3c')](_0x515f65['lastName'])||_[_0xbf69('0x3f')](_0x515f65[_0xbf69('0x40')])?null:_0x515f65[_0xbf69('0x40')],'phone':_0x515f65[_0xbf69('0x41')],'ListId':_0x515f65['list_id'],'scheduledat':_0x515f65[_0xbf69('0x42')],'callbackUniqueid':this[_0xbf69('0xe')]['uniqueid'],'tags':_0xbf69('0x43'),'description':_0xbf69('0x44')+_0x515f65[_0xbf69('0x42')][_0xbf69('0x45')](),'priority':_0x515f65[_0xbf69('0x46')]})[_0xbf69('0x12')](function(_0x2136af){_0x5220d1(null,_0x2136af);})[_0xbf69('0x14')](function(_0x128d0d){_0x5220d1(_0x128d0d);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x47')]=function(_0x55b1d2,_0x39f593){this[_0xbf69('0xf')][_0xbf69('0x48')](_0x55b1d2)[_0xbf69('0x12')](function(_0x29481f){_0x39f593(null,_0x29481f?_0x29481f[_0xbf69('0x13')]:![]);})['catch'](function(_0x303d38){_0x39f593(_0x303d38);});};AGIVertices['prototype'][_0xbf69('0x49')]=function(_0x170e86,_0x528e46,_0x214126){var _0x23b38b={'role':_0xbf69('0x4a')};_0x23b38b[_0x170e86]=this[_0xbf69('0xe')]['callerid'];this[_0xbf69('0xf')][_0xbf69('0x49')](_0x23b38b,_0x528e46,this[_0xbf69('0xe')][_0xbf69('0x37')])[_0xbf69('0x12')](function(_0x432863){_0x214126(null,_[_0xbf69('0x3f')](_0x432863)?![]:!![]);})[_0xbf69('0x14')](function(_0x3406ed){logger[_0xbf69('0x2e')](_0x3406ed);_0x214126(null,![]);});};AGIVertices[_0xbf69('0x15')]['agentUnpause']=function(_0x1244df,_0x3cc6e3){var _0x58389d={'role':_0xbf69('0x4a')};_0x58389d[_0x1244df]=this[_0xbf69('0xe')][_0xbf69('0x35')];this[_0xbf69('0xf')][_0xbf69('0x4b')](_0x58389d)[_0xbf69('0x12')](function(_0x1fd6bb){_0x3cc6e3(null,_['isNil'](_0x1fd6bb)?![]:!![]);})[_0xbf69('0x14')](function(_0xe83e2){logger['error'](_0xe83e2);_0x3cc6e3(null,![]);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x4c')]=function(_0x4874c7,_0x4ce39e){var _0x240d4c={'role':_0xbf69('0x4a')};_0x240d4c[_0x4874c7]=this[_0xbf69('0xe')]['callerid'];this[_0xbf69('0xf')][_0xbf69('0x4c')](_0x240d4c)['then'](function(_0x598b6c){_0x4ce39e(null,_['isNil'](_0x598b6c)?![]:!![]);})['catch'](function(_0x3e7e77){logger['error'](_0x3e7e77);_0x4ce39e(null,![]);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x4d')]=function(_0x338ddc,_0x2ba0d8){var _0x5a3be0={'role':_0xbf69('0x4a')};_0x5a3be0[_0x338ddc]=this[_0xbf69('0xe')]['callerid'];var _0x1313cd=_0x338ddc!=_0xbf69('0x4e')?util[_0xbf69('0x4f')](_0xbf69('0x50'),_0xbf69('0x51'),this['channel'][_0xbf69('0x35')]):undefined;this[_0xbf69('0xf')]['agentLogin'](_0x5a3be0,_0x1313cd)[_0xbf69('0x12')](function(_0x4772b9){_0x2ba0d8(null,_[_0xbf69('0x3f')](_0x4772b9)?![]:!![]);})[_0xbf69('0x14')](function(_0x434d2f){logger[_0xbf69('0x2e')](_0x434d2f);_0x2ba0d8(null,![]);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x52')]=function(_0x3b437d,_0x43b6fe){sh[_0xbf69('0x53')](_[_0xbf69('0x54')](_0x3b437d),function(_0x309695,_0x5452c1){var _0x2a72c9=_0x5452c1[_0xbf69('0x55')](/(\r\n|\n|\r)/gm,'');_0x43b6fe(null,_0x2a72c9);});};AGIVertices['prototype'][_0xbf69('0x56')]=function(_0x334250,_0x4d4040){scripts['googleCloudTTS'](_0x334250[_0xbf69('0x57')],_0x334250[_0xbf69('0x58')]||_0xbf69('0x59'),_0x334250['text'],_0x334250['languageCode']||_0xbf69('0x5a'),_0x334250['ssmlGender']||'MALE',_0x334250[_0xbf69('0x5b')]||_0xbf69('0x5c'))['then'](function(_0x45c1ce){_0x4d4040(null,_0x45c1ce);})['catch'](function(_0x36d742){_0x4d4040(_0x36d742);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x5d')]=function(_0x442d90,_0x41fe74){scripts[_0xbf69('0x5d')](_0x442d90[_0xbf69('0x59')],_0x442d90[_0xbf69('0x5e')]||'en',0x1)['then'](function(_0x389f26){_0x41fe74(null,_0x389f26);})[_0xbf69('0x14')](function(_0xfbfa89){_0x41fe74(_0xfbfa89);});};AGIVertices[_0xbf69('0x15')]['restAPI']=function(_0x4db563,_0x5754ef){var _0x152f29={'uri':_0x4db563[_0xbf69('0x5f')],'method':_0x4db563[_0xbf69('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4db563[_0xbf69('0x61')])===_0xbf69('0x62')&&parseInt(_0x4db563[_0xbf69('0x61')])>=0x1?parseInt(_0x4db563[_0xbf69('0x61')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xbf69('0x63')],_0x152f29[_0xbf69('0x60')][_0xbf69('0x64')]())){try{_0x152f29[_0xbf69('0x65')]=_0x4db563['rawBody']?JSON['parse'](_0x4db563[_0xbf69('0xa')]):{};}catch(_0x170fcb){logger[_0xbf69('0x2e')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x170fcb);}}try{_0x152f29[_0xbf69('0x66')]=_0x4db563[_0xbf69('0x9')]?JSON['parse'](_0x4db563[_0xbf69('0x9')]):{};}catch(_0x436436){logger[_0xbf69('0x2e')](_0xbf69('0x67'),_0x436436);}if(_0x4db563[_0xbf69('0x68')]){try{var _0x449245=require(_0x4db563[_0xbf69('0x68')])[_0xbf69('0x69')](this,_0x152f29);_0x152f29['uri']=Mustache['render'](_0x4db563[_0xbf69('0x5f')],_0x449245,{},['$$','$$']);if(_0x152f29['headers']){_0x152f29[_0xbf69('0x66')]=JSON[_0xbf69('0x6a')](Mustache[_0xbf69('0x6b')](JSON[_0xbf69('0x6c')](_0x152f29[_0xbf69('0x66')]),_0x449245,{},['$$','$$']));}if(_0x152f29[_0xbf69('0x65')]){_0x152f29[_0xbf69('0x65')]=JSON[_0xbf69('0x6a')](Mustache[_0xbf69('0x6b')](JSON[_0xbf69('0x6c')](_0x152f29[_0xbf69('0x65')]),_0x449245,{},['$$','$$']));}}catch(_0x40ac04){logger['error'](_0xbf69('0x6d'),_0x40ac04);}}rp(_0x152f29)[_0xbf69('0x12')](function(_0x312123){var _0x1d500c={'statusCode':_0x312123['statusCode']||0xc8,'statusMessage':_0x312123[_0xbf69('0x6e')]||'OK','headers':_0x312123['headers']||{},'body':_0x312123['body']||{}};_0x5754ef(null,_0x1d500c);})['catch'](function(_0x42e4ae){var _0x3c4f6e={'statusCode':_0x42e4ae[_0xbf69('0x6f')]||0x1f4,'statusMessage':_0x42e4ae[_0xbf69('0x70')]||_0xbf69('0x71'),'headers':_0x42e4ae[_0xbf69('0x72')][_0xbf69('0x66')]||{},'body':_0x42e4ae[_0xbf69('0x72')][_0xbf69('0x65')]||{}};_0x5754ef(null,_0x3c4f6e);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x73')]=function(_0x5c8a2e,_0x261f39){scripts[_0xbf69('0x73')](this[_0xbf69('0xe')][_0xbf69('0x37')],_0x5c8a2e[_0xbf69('0x74')],_0x5c8a2e[_0xbf69('0x59')],_0x5c8a2e[_0xbf69('0x75')]||'en')['then'](function(_0x1252da){_0x261f39(null,_0x1252da);})[_0xbf69('0x14')](function(_0x1873ef){_0x261f39(_0x1873ef);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x76')]=function(_0x585b53,_0x1b6d45){scripts[_0xbf69('0x76')](this[_0xbf69('0xe')][_0xbf69('0x37')],_0x585b53[_0xbf69('0x77')],_0x585b53[_0xbf69('0x78')],_0x585b53[_0xbf69('0x79')],_0x585b53[_0xbf69('0x59')],_0x585b53[_0xbf69('0x7a')]||'en')['then'](function(_0x530544){_0x1b6d45(null,_0x530544);})['catch'](function(_0x5001b0){_0x1b6d45(_0x5001b0);});};AGIVertices[_0xbf69('0x15')]['sestekNDA']=function(_0x422077,_0x343e9b){scripts[_0xbf69('0x7b')](this[_0xbf69('0xe')],_0x422077)[_0xbf69('0x12')](function(_0xc44824){_0x343e9b(null,_0xc44824);})[_0xbf69('0x14')](function(_0x4e319e){_0x343e9b(_0x4e319e);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x7c')]=function(_0x361f75,_0x2659a9){scripts[_0xbf69('0x7c')](_0x361f75[_0xbf69('0x74')],_0x361f75[_0xbf69('0x59')],_0x361f75[_0xbf69('0x7d')]||_0xbf69('0x5a'),_0x361f75['speed'])[_0xbf69('0x12')](function(_0x4483cf){_0x2659a9(null,_0x4483cf);})[_0xbf69('0x14')](function(_0x321e2f){_0x2659a9(_0x321e2f);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x7e')]=function(_0x57dbbe,_0x4b015f,_0x4d35e3){scripts[_0xbf69('0x7e')](_0x4b015f,_0x57dbbe[_0xbf69('0x74')],_0x57dbbe[_0xbf69('0x7f')]||_0xbf69('0x5a'),this[_0xbf69('0x80')](_0x57dbbe[_0xbf69('0x81')])?_0x57dbbe[_0xbf69('0x81')]:undefined)[_0xbf69('0x12')](function(_0x5b6a56){_0x4d35e3(null,_0x5b6a56);})['catch'](function(_0xde3cb4){_0x4d35e3(_0xde3cb4);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x82')]=function(_0x399151,_0x30296b){scripts['awsPolly'](_0x399151[_0xbf69('0x83')],_0x399151[_0xbf69('0x84')],_0x399151[_0xbf69('0x85')],_0x399151[_0xbf69('0x86')]||'Amy',_0x399151[_0xbf69('0x59')],_0x399151[_0xbf69('0x87')]||'text')['then'](function(_0x52f1b7){_0x30296b(null,_0x52f1b7);})[_0xbf69('0x14')](function(_0x2d6ad9){_0x30296b(_0x2d6ad9);});};AGIVertices[_0xbf69('0x15')]['awsLex']=function(_0x577814,_0x4ae0ad){scripts[_0xbf69('0x88')](this['channel'][_0xbf69('0x37')],_0x577814['aws_access_key_id'],_0x577814['aws_secret_access_key'],_0x577814[_0xbf69('0x89')],_0x577814['text'],_0x577814['aws_bot_name'])['then'](function(_0x8e548b){_0x4ae0ad(null,_0x8e548b);})[_0xbf69('0x14')](function(_0x285ece){_0x4ae0ad(_0x285ece);});};AGIVertices['prototype']['googleASR']=function(_0x30bdd9,_0xf357e,_0x9e1d8a){scripts['googleASR'](_0xf357e,_0x30bdd9['key'],_0x30bdd9[_0xbf69('0x8a')]||_0xbf69('0x5a'))[_0xbf69('0x12')](function(_0x52bf45){_0x9e1d8a(null,_0x52bf45);})[_0xbf69('0x14')](function(_0x4f2387){_0x9e1d8a(_0x4f2387);});};AGIVertices[_0xbf69('0x15')][_0xbf69('0x8b')]=function(_0x8fff4c,_0x5f1752,_0x1d9a51){scripts['tildeASR'](_0x5f1752,_0x8fff4c[_0xbf69('0x8c')],_0x8fff4c[_0xbf69('0x8d')],_0x8fff4c[_0xbf69('0x8e')])[_0xbf69('0x12')](function(_0x2f5f67){_0x1d9a51(null,_0x2f5f67);})['catch'](function(_0x3765c0){_0x1d9a51(_0x3765c0);});};AGIVertices['prototype']['clear']=function(_0x5c1aaf){var _0x149d0f=_[_0xbf69('0x8f')](verticesWithRetry,_0x5c1aaf[_0xbf69('0x90')])?_0x5c1aaf:_[_0xbf69('0x91')](_0x5c1aaf);for(var _0x2b1dcc in _0x149d0f){if(_0x149d0f['hasOwnProperty'](_0x2b1dcc)){if(_0x149d0f[_0x2b1dcc]&&_[_0xbf69('0x92')](_0x149d0f[_0x2b1dcc])){if(_[_0xbf69('0x8f')](recursiveMapAttributes,_0x2b1dcc)){_0x149d0f[_0x2b1dcc]=this[_0xbf69('0x93')](_0x149d0f[_0x2b1dcc]);}else{_0x149d0f[_0x2b1dcc]=this['replaceAllVariables'](_0x149d0f[_0x2b1dcc]);}}}}return _0x149d0f;};AGIVertices['prototype'][_0xbf69('0x94')]=function(_0x478816){for(var _0x16fe7e in _0x478816){if(_0x478816[_0xbf69('0x95')](_0x16fe7e)){if(_[_0xbf69('0x96')](_0x478816[_0x16fe7e])){this[_0xbf69('0x94')](_0x478816[_0x16fe7e]);}else if(_[_0xbf69('0x97')](_0x478816[_0x16fe7e])){for(var _0x3dd1bb=0x0;_0x3dd1bb<_0x478816[_0x16fe7e][_0xbf69('0x98')];_0x3dd1bb++){this['recursiveNodeIndex'](_0x478816[_0x16fe7e][_0x3dd1bb]);}}else if(_['isString'](_0x478816[_0x16fe7e])){_0x478816[_0x16fe7e]=this[_0xbf69('0x99')](_0x478816[_0x16fe7e]);}}}};AGIVertices[_0xbf69('0x15')]['saveRestApiResult']=function(_0x2cc943,_0x548548){for(var _0x4b5b5a in _0x2cc943){if(_0x2cc943[_0xbf69('0x95')](_0x4b5b5a)){if(_['isPlainObject'](_0x2cc943[_0x4b5b5a])){if(!_[_0xbf69('0x3c')](_0x2cc943[_0x4b5b5a])){this[_0xbf69('0x9a')](_0x2cc943[_0x4b5b5a],util[_0xbf69('0x4f')](_0xbf69('0x9b'),_0x548548,_0x4b5b5a));}}else if(_[_0xbf69('0x97')](_0x2cc943[_0x4b5b5a])){for(var _0x1f6dc1=0x0;_0x1f6dc1<_0x2cc943[_0x4b5b5a][_0xbf69('0x98')];_0x1f6dc1++){this['saveRestApiResult'](_0x2cc943[_0x4b5b5a][_0x1f6dc1],util[_0xbf69('0x4f')]('%s.%s',_0x548548,_0x4b5b5a+'['+_0x1f6dc1+']'));}}else{if(!_[_0xbf69('0x3f')](_0x2cc943[_0x4b5b5a])){this['channel'][_0xbf69('0x9c')](util[_0xbf69('0x4f')](_0xbf69('0x9b'),_0x548548,_0x4b5b5a),_0x2cc943[_0x4b5b5a]);}}}}};AGIVertices[_0xbf69('0x15')][_0xbf69('0x93')]=function(_0x44b613){try{var _0x21bb8e=JSON[_0xbf69('0x6a')](_0x44b613);this[_0xbf69('0x94')](_0x21bb8e);return JSON[_0xbf69('0x6c')](_0x21bb8e);}catch(_0x302734){return this['replaceAllVariables'](_0x44b613);}};AGIVertices[_0xbf69('0x15')][_0xbf69('0x99')]=function(_0x55f235){var _0x5aedf4=_0x55f235[_0xbf69('0x9d')]('{');for(var _0xc16a29=0x1;_0xc16a29<_0x5aedf4[_0xbf69('0x98')];_0xc16a29+=0x1){var _0x41f59b=_0x5aedf4[_0xc16a29][_0xbf69('0x9d')]('}');if(_0x41f59b[_0xbf69('0x98')]>0x1){_0x55f235=_0x55f235[_0xbf69('0x9e')]('{'+_0x41f59b[0x0]+'}',this[_0xbf69('0xe')][_0xbf69('0x11')](_0x41f59b[0x0])[_0xbf69('0x9f')]||_0x41f59b[0x0]);}}if(_0x5aedf4[_0xbf69('0x98')]===0x1){return _0x55f235['toString']();}return this[_0xbf69('0x99')](_0x55f235);};AGIVertices[_0xbf69('0x15')][_0xbf69('0xa0')]=function(_0x3e4bc7,_0x29df49){var _0xaa6f24=this[_0xbf69('0xe')][_0xbf69('0x11')](_0x3e4bc7);if(_0xaa6f24['result']===-0x1){return _0xaa6f24;}logger[_0xbf69('0x2a')](util['format'](_0xbf69('0xa1'),_0x29df49,_0xaa6f24[_0xbf69('0x9f')]));return this[_0xbf69('0xe')][_0xbf69('0x9c')](_0x29df49,_0xaa6f24[_0xbf69('0x9f')]);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x80')]=function(_0x507344){return _0x507344&&_0x507344!=='0'&&_0x507344!=='-1'&&_0x507344!=='';};AGIVertices[_0xbf69('0x15')][_0xbf69('0xa2')]=function(_0x133250){this[_0xbf69('0x32')]['sync'](this,_0x133250,'-');_0x133250[_0xbf69('0xa3')]=_0x133250[_0xbf69('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xbf69('0xa4')]=function(_0x1f8667){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xa5'),_0x1f8667[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x1f8667[_0xbf69('0x59')])){return this['channel'][_0xbf69('0xa6')]('no\x20text\x20configured');}var _0x4407bc='\x22'+_0x1f8667[_0xbf69('0x59')]+'\x22';if(this[_0xbf69('0x80')](_0x1f8667[_0xbf69('0x72')])){_0x4407bc+=','+_0x1f8667[_0xbf69('0x72')];}var _0x30d0da=this['channel'][_0xbf69('0x53')]('MRCPSynth',_0x4407bc);if(_0x30d0da[_0xbf69('0xa7')]===-0x1){return _0x30d0da;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4407bc));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xa8')]=function(_0x132f0e){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xa9'),_0x132f0e[_0xbf69('0x33')]));if(!this['isConfigured'](_0x132f0e[_0xbf69('0xaa')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xab'));}var _0xe7f70d=_0x132f0e[_0xbf69('0xaa')];if(this[_0xbf69('0x80')](_0x132f0e[_0xbf69('0x72')])){_0xe7f70d+=','+_0x132f0e['options'];}var _0x4dc572=this['channel'][_0xbf69('0x53')](_0xbf69('0xac'),_0xe7f70d);if(_0x4dc572[_0xbf69('0xa7')]===-0x1){return _0x4dc572;}var _0x436749=this[_0xbf69('0xa0')](_0xbf69('0xad'),_0xbf69('0xae'));if(_0x436749['result']===-0x1){return _0x436749;}var _0x3b7c75=this['getAndSetVariable'](_0xbf69('0xaf'),_0xbf69('0xb0'));if(_0x3b7c75[_0xbf69('0xa7')]===-0x1){return _0x3b7c75;}var _0x2d7c93=this['getAndSetVariable'](_0xbf69('0xb1'),_0xbf69('0xb2'));if(_0x2d7c93[_0xbf69('0xa7')]===-0x1){return _0x2d7c93;}return this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0xb3'),_0xe7f70d));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x5')]=function(_0x1fae17){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1fae17[_0xbf69('0x33')]));return this['channel'][_0xbf69('0x5')]([_0x1fae17[_0xbf69('0xb4')],_0x1fae17[_0xbf69('0xb5')]]);};AGIVertices[_0xbf69('0x15')][_0xbf69('0xb6')]=function(_0x382983){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0xb7'),_0x382983['label']));if(this['isConfigured'](_0x382983[_0xbf69('0x61')])){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0xb8'),_0x382983[_0xbf69('0x61')]));var _0x30c933=this[_0xbf69('0xe')][_0xbf69('0xb9')](_0x382983[_0xbf69('0x61')]);if(_0x30c933[_0xbf69('0xa7')]===-0x1){return _0x30c933;}}return this['channel'][_0xbf69('0xb6')]();};AGIVertices['prototype'][_0xbf69('0x43')]=function(_0x2438f8){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xba'),_0x2438f8[_0xbf69('0x33')]));if(!this['isConfigured'](_0x2438f8['list_id'])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x2438f8,_0xbf69('0xbb'));}_0x2438f8[_0xbf69('0x42')]=moment();if(this[_0xbf69('0x80')](_0x2438f8[_0xbf69('0xbc')])){_0x2438f8[_0xbf69('0x42')]=moment()[_0xbf69('0xbd')](_0x2438f8[_0xbf69('0xbc')],_0xbf69('0xbe'));}if(!this[_0xbf69('0x80')](_0x2438f8[_0xbf69('0x46')])){_0x2438f8[_0xbf69('0x46')]=0x2;}this['createCmContact'][_0xbf69('0x69')](this,_0x2438f8);return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x2438f8[_0xbf69('0x41')],_0x2438f8['list_id'],_0x2438f8[_0xbf69('0x42')]));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xbf')]=function(_0x253333){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xc0'),_0x253333['label']));var _0x34d4a0=this[_0xbf69('0xe')][_0xbf69('0x53')](_0x253333[_0xbf69('0xc1')],_0x253333[_0xbf69('0x72')]);if(_0x34d4a0[_0xbf69('0xa7')]===-0x1){return _0x34d4a0;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('Executed\x20command\x20%s\x20%s',_0x253333['application'],_0x253333[_0xbf69('0x72')]));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xc2')]=function(_0x193652){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xc3'),_0x193652[_0xbf69('0x33')]));if(!this['isConfigured'](_0x193652[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xc4'));}var _0x2ceb7e='\x22'+_0x193652['text']+'\x22';if(this[_0xbf69('0x80')](_0x193652[_0xbf69('0x72')])){_0x2ceb7e+=','+_0x193652[_0xbf69('0x72')];}var _0x1b19ab=this[_0xbf69('0xe')]['exec'](_0xbf69('0xc5'),_0x2ceb7e);if(_0x1b19ab[_0xbf69('0xa7')]===-0x1){return _0x1b19ab;}return this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2ceb7e));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xc6')]=function(_0x340d98){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0xc7'),_0x340d98[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x340d98[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')]('no\x20text\x20configured');}var _0x2c0a1a='\x22'+_0x340d98[_0xbf69('0x59')]+'\x22';if(this[_0xbf69('0x80')](_0x340d98[_0xbf69('0x72')])){_0x2c0a1a+=','+_0x340d98[_0xbf69('0x72')];}var _0x1d9375=this[_0xbf69('0xe')][_0xbf69('0x53')](_0xbf69('0xc5'),_0x2c0a1a);if(_0x1d9375[_0xbf69('0xa7')]===-0x1){return _0x1d9375;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2c0a1a));};AGIVertices['prototype'][_0xbf69('0xc8')]=function(_0x424488){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0xc9'),_0x424488[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x424488[_0xbf69('0xaa')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')]('no\x20grammar\x20configured');}var _0x3e352f=_0x424488['grammar'];if(this[_0xbf69('0x80')](_0x424488[_0xbf69('0x72')])){_0x3e352f+=','+_0x424488['options'];}var _0x4061ad=this['channel'][_0xbf69('0x53')](_0xbf69('0xac'),_0x3e352f);if(_0x4061ad['result']===-0x1){return _0x4061ad;}var _0x39463f=this[_0xbf69('0xa0')](_0xbf69('0xad'),_0xbf69('0xca'));if(_0x39463f[_0xbf69('0xa7')]===-0x1){return _0x39463f;}var _0xa78390=this[_0xbf69('0xa0')](_0xbf69('0xaf'),_0xbf69('0xcb'));if(_0xa78390['result']===-0x1){return _0xa78390;}var _0x3a36f0=this[_0xbf69('0xa0')](_0xbf69('0xb1'),_0xbf69('0xcc'));if(_0x3a36f0[_0xbf69('0xa7')]===-0x1){return _0x3a36f0;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0xb3'),_0x3e352f));};AGIVertices['prototype']['sestekasr']=function(_0x289d4d){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xcd'),_0x289d4d[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x289d4d[_0xbf69('0xaa')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xab'));}var _0x2dd996=_0x289d4d['grammar'];if(this[_0xbf69('0x80')](_0x289d4d[_0xbf69('0x72')])){_0x2dd996+=','+_0x289d4d[_0xbf69('0x72')];}var _0x126ec6=this[_0xbf69('0xe')]['exec'](_0xbf69('0xac'),_0x2dd996);if(_0x126ec6['result']===-0x1){return _0x126ec6;}var _0x15824e=this[_0xbf69('0xa0')](_0xbf69('0xad'),_0xbf69('0xce'));if(_0x15824e[_0xbf69('0xa7')]===-0x1){return _0x15824e;}var _0x45d0df=this[_0xbf69('0xa0')](_0xbf69('0xaf'),_0xbf69('0xcf'));if(_0x45d0df[_0xbf69('0xa7')]===-0x1){return _0x45d0df;}var _0x101734=this[_0xbf69('0xa0')](_0xbf69('0xb1'),_0xbf69('0xd0'));if(_0x101734[_0xbf69('0xa7')]===-0x1){return _0x101734;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0xb3'),_0x2dd996));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xd1')]=function(_0x4bbd45){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xd2'),_0x4bbd45[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x4bbd45['odbc_id'])){return this[_0xbf69('0xe')]['error'](_0x4bbd45,_0xbf69('0xd3'));}var _0x24ae2b=this['getSquareOdbc'][_0xbf69('0x69')](this,_0x4bbd45[_0xbf69('0xd4')]);if(!_0x24ae2b){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x4bbd45,_0xbf69('0xd5'));}if(!this['isConfigured'](_0x4bbd45[_0xbf69('0x29')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x4bbd45,_0xbf69('0xd6'));}var _0x14df25=_0x4bbd45[_0xbf69('0x29')][_0xbf69('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('query:\x20%s',_0x14df25));var _0x2dc7a9=this['getQueryOdbc'][_0xbf69('0x69')](this,_0x24ae2b,_0x14df25);this['createSquareDetailsReport'][_0xbf69('0x69')](this,_0x4bbd45,_0x14df25);if(!this[_0xbf69('0x80')](_0x4bbd45[_0xbf69('0xd7')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xd8'));}var _0x4fde9e=this['getVariable'][_0xbf69('0x69')](this,_0x4bbd45[_0xbf69('0xd7')]);if(!_0x4fde9e){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x4bbd45,'no\x20variable\x20found');}var _0x3e6732=this;_0x2dc7a9['forEach'](function(_0xfff2eb,_0x12b1aa){Object['keys'](_0xfff2eb)[_0xbf69('0xd9')](function(_0x4ffff9){_0x3e6732[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')]('%s[%s][%s]',_0x4fde9e,_0x12b1aa,_0x4ffff9),_0xfff2eb[_0x4ffff9]);});});this[_0xbf69('0xe')]['setVariable'](util['format'](_0xbf69('0xda'),_0x4fde9e),_0x2dc7a9[_0xbf69('0x98')]);return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0xdb'),_0x4fde9e));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xdc')]=function(_0x5a79a3){logger[_0xbf69('0xdd')](util[_0xbf69('0x4f')](_0xbf69('0xde'),_0x5a79a3[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x5a79a3[_0xbf69('0xdf')])){return this[_0xbf69('0xe')]['error'](_0x5a79a3,_0xbf69('0xe0'));}var _0x5265dd=this[_0xbf69('0xe1')][_0xbf69('0x69')](this,_0x5a79a3[_0xbf69('0xdf')]);if(!_0x5265dd){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x5a79a3,_0xbf69('0xe2'));}var _0x475b31=this[_0xbf69('0xe')][_0xbf69('0x53')]('DIAL',[util[_0xbf69('0x4f')](_0xbf69('0xe3'),_0x5265dd),_0x5a79a3[_0xbf69('0x61')],_0x5a79a3[_0xbf69('0xe4')],_0x5a79a3[_0xbf69('0x5f')]]);if(_0x475b31['result']===-0x1){return _0x475b31;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('Executed\x20command\x20%s',_0xbf69('0xe5')));};AGIVertices[_0xbf69('0x15')]['dialogflow']=function(_0x28f785){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xe6'),_0x28f785[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x28f785[_0xbf69('0x74')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xe7'));}if(!this[_0xbf69('0x80')](_0x28f785[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')]('no\x20text\x20configured');}this['channel'][_0xbf69('0xe8')]=!![];this['createSquareDetailsReport'](_0x28f785);this['createSquareMessage'](_0x28f785[_0xbf69('0x59')],'in','','');this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0xe9'),_0x28f785[_0xbf69('0x59')]));var _0x12b596=this[_0xbf69('0x73')][_0xbf69('0x69')](this,_0x28f785);if(_0x12b596){for(var _0x184231 in _0x12b596){if(_0x12b596[_0xbf69('0x95')](_0x184231)){this[_0xbf69('0xe')][_0xbf69('0x9c')](util['format'](_0xbf69('0xea'),_0x184231[_0xbf69('0x64')]()),_0x12b596[_0x184231]);}}this['createSquareMessage'](_0x12b596[_0xbf69('0xeb')],_0xbf69('0xec'),_0xbf69('0xed'),'');return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0xee'),_0x12b596[_0xbf69('0xeb')]));}return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x28f785,_0xbf69('0xef'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xf0')]=function(_0x1d5804){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1d5804[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x1d5804['dialogflowV2_project_id'])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0xf1'));}if(!this[_0xbf69('0x80')](_0x1d5804[_0xbf69('0x78')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xf2'));}if(!this[_0xbf69('0x80')](_0x1d5804['private_key'])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xf3'));}if(!this[_0xbf69('0x80')](_0x1d5804['dialogflowV2_language'])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xf4'));}if(!this[_0xbf69('0x80')](_0x1d5804['text'])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xe8')]=!![];this[_0xbf69('0x32')](_0x1d5804);this[_0xbf69('0x3a')](_0x1d5804[_0xbf69('0x59')],'in','','');this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0xf5'),_0x1d5804[_0xbf69('0x59')]));var _0x4b491f=this[_0xbf69('0x76')][_0xbf69('0x69')](this,_0x1d5804);if(_0x4b491f){for(var _0xb15b76 in _0x4b491f){if(_0x4b491f[_0xbf69('0x95')](_0xb15b76)){if(_0xb15b76!=='providerResponse'){this['channel'][_0xbf69('0x9c')](util[_0xbf69('0x4f')](_0xbf69('0xea'),_0xb15b76[_0xbf69('0x64')]()),_0x4b491f[_0xb15b76]);}}}this[_0xbf69('0x3a')](_0x4b491f[_0xbf69('0xeb')],_0xbf69('0xec'),_0xbf69('0xf0'),_0x4b491f[_0xbf69('0xf6')]);return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0xf7'),_0x4b491f[_0xbf69('0xeb')]));}return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1d5804,_0xbf69('0xf8'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0xf9')]=function(_0x4f9fb7){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0xfa'),_0x4f9fb7[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x4f9fb7[_0xbf69('0xfb')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xbf69('0x80')](_0x4f9fb7[_0xbf69('0xfc')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xfd'));}if(!this[_0xbf69('0x80')](_0x4f9fb7[_0xbf69('0xfe')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xff'));}if(!this[_0xbf69('0x80')](_0x4f9fb7['ndassistant_url'])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xe8')]=!![];this[_0xbf69('0x32')](_0x4f9fb7);this[_0xbf69('0x3a')](_0x4f9fb7['text'],'in','','');this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x100'),_0x4f9fb7[_0xbf69('0x59')]));var _0x3d6f4d=this[_0xbf69('0x7b')]['sync'](this,_0x4f9fb7);if(_0x3d6f4d){for(var _0x406fba in _0x3d6f4d){if(_0x3d6f4d[_0xbf69('0x95')](_0x406fba)){this[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')]('SESTEK_NDA_%s',_0x406fba['toUpperCase']()),_0x3d6f4d[_0x406fba]);}}this[_0xbf69('0x3a')](_0x3d6f4d[_0xbf69('0xeb')],'out',_0xbf69('0xf9'),'');if(_0x3d6f4d[_0xbf69('0x101')]){this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x102'),_0x3d6f4d[_0xbf69('0x101')]));var _0x3d9300=this[_0xbf69('0xe')][_0xbf69('0x103')](_0x3d6f4d[_0xbf69('0x101')]);try{fs['unlink'](_0x3d6f4d['audiofile']+_0xbf69('0x104'));}catch(_0x36a1e3){logger[_0xbf69('0x2e')](_0x36a1e3);}return _0x3d9300;}else{return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x105'),_0x3d6f4d[_0xbf69('0xeb')]));}}return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x4f9fb7,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xbf69('0x106')]=function(_0x12eaa4){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20END\x20(%s)\x20block',_0x12eaa4[_0xbf69('0x33')]));return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x106'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x107')]=function(_0x1c8eea){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x108'),_0x1c8eea[_0xbf69('0x33')]));var _0x5d20cd='';if(_0x1c8eea[_0xbf69('0x109')]){if(!this[_0xbf69('0x80')](_0x1c8eea['trunk_id'])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1c8eea,_0xbf69('0x10a'));}else{var _0x5b17c4=parseInt(_0x1c8eea['trunk_id'],0xa);if(isNaN(_0x5b17c4)){_0x5d20cd=_0x1c8eea[_0xbf69('0x109')];}else{_0x5d20cd=this[_0xbf69('0x10b')][_0xbf69('0x69')](this,_0x1c8eea[_0xbf69('0x109')]);if(!_0x5d20cd){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1c8eea,_0xbf69('0x10c'));}}}}else if(_0x1c8eea[_0xbf69('0x10d')]){_0x5d20cd=_0x1c8eea[_0xbf69('0x10d')];}else{return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1c8eea,_0xbf69('0x10a'));}var _0x7b5063=this[_0xbf69('0xe')][_0xbf69('0x53')](_0xbf69('0xe5'),[util[_0xbf69('0x4f')](_0xbf69('0x10e'),_0x5d20cd,_0x1c8eea[_0xbf69('0x41')]),_0x1c8eea[_0xbf69('0x61')],_0x1c8eea[_0xbf69('0xe4')],_0x1c8eea[_0xbf69('0x5f')]]);if(_0x7b5063['result']===-0x1){return _0x7b5063;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x10f'),_0xbf69('0xe5')));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x110')]=function(_0x3ab0fe){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x111'),_0x3ab0fe[_0xbf69('0x33')]));return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x110'));};AGIVertices['prototype'][_0xbf69('0xc')]=function(_0x22f7b0){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x112'),_0x22f7b0['label']));if(_0x22f7b0['retry']===0x0){return this[_0xbf69('0xa2')](_0x22f7b0);}_0x22f7b0[_0xbf69('0xa3')]-=0x1;if(!this[_0xbf69('0x80')](_0x22f7b0['file_id'])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x22f7b0,_0xbf69('0x113'));}var _0x3c4172=this['getSound']['sync'](this,_0x22f7b0[_0xbf69('0x114')]);if(!_0x3c4172){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x22f7b0,'no\x20file\x20audio\x20found');}if(!this[_0xbf69('0x80')](_0x22f7b0['variable_id'])){return this['channel'][_0xbf69('0x2e')](_0xbf69('0xd8'));}var _0x3ca3da=this[_0xbf69('0xe')][_0xbf69('0x115')](_0x3c4172,_0x22f7b0['response'],_0x22f7b0[_0xbf69('0x116')]);var _0x376b8e=_0x3ca3da[_0xbf69('0xa7')]?_0x3ca3da[_0xbf69('0xa7')][_0xbf69('0x45')]():'';logger[_0xbf69('0x2a')]('test',JSON['stringify'](_0x3ca3da));if(_0x3ca3da[_0xbf69('0xa7')]===-0x1){this['createSquareDetailsReport'][_0xbf69('0x69')](this,_0x22f7b0,_0x376b8e);return _0x3ca3da;}else if(_0x3ca3da['extra']==='timeout'){_0x3ca3da[_0xbf69('0xa7')]=_0x376b8e[_0xbf69('0x98')]>=parseInt(_0x22f7b0['mindigit'])?'x':'i';}else{_0x3ca3da['result']=_0x376b8e[_0xbf69('0x98')]>=parseInt(_0x22f7b0[_0xbf69('0x117')])&&_0x376b8e[_0xbf69('0x98')]<=parseInt(_0x22f7b0[_0xbf69('0x116')])?'x':'i';}var _0x19be38=this['getVariable'][_0xbf69('0x69')](this,_0x22f7b0[_0xbf69('0xd7')]);if(!_0x19be38){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x22f7b0,_0xbf69('0x118'));}this[_0xbf69('0xe')][_0xbf69('0x9c')](_0x19be38,_0x376b8e);if(this[_0xbf69('0x80')](_0x22f7b0[_0xbf69('0x119')])){var _0x5977c8=parseInt(_0x22f7b0[_0xbf69('0x119')],0xa);var _0x49f45a=rs[_0xbf69('0x11a')]({'charset':'*','length':_0x5977c8});var _0x5e15fc=_0x376b8e[_0xbf69('0x98')];if(_0x5e15fc>0x0){if(_0x5e15fc>_0x5977c8){this[_0xbf69('0x32')][_0xbf69('0x69')](this,_0x22f7b0,_0x22f7b0[_0xbf69('0x11b')]==='first'?_0x49f45a+_0x376b8e[_0xbf69('0x11c')](_0x5977c8):_0x376b8e['substr'](0x0,_0x5e15fc-_0x5977c8)+_0x49f45a);}else{this[_0xbf69('0x32')]['sync'](this,_0x22f7b0,rs[_0xbf69('0x11a')]({'charset':'*','length':_0x5e15fc}));}}else{this[_0xbf69('0x32')][_0xbf69('0x69')](this,_0x22f7b0,'');}}else{this[_0xbf69('0x32')]['sync'](this,_0x22f7b0,_0x376b8e);}return _0x3ca3da;};AGIVertices[_0xbf69('0x15')][_0xbf69('0xd')]=function(_0x5d3168){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x11d'),_0x5d3168[_0xbf69('0x33')]));return this['getdigits'](_0x5d3168);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x11e')]=function(_0x59c979){logger['info'](util[_0xbf69('0x4f')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x59c979[_0xbf69('0x33')]));this['createSquareDetailsReport']['sync'](this,_0x59c979,_0x59c979[_0xbf69('0x11f')]);return this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x120'),_0x59c979[_0xbf69('0x11f')]));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x121')]=function(_0x19e3f3){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x122'),_0x19e3f3[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x19e3f3[_0xbf69('0x83')])||!this[_0xbf69('0x80')](_0x19e3f3[_0xbf69('0x84')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x123'));}if(!this['isConfigured'](_0x19e3f3[_0xbf69('0x59')])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x124'),_0x19e3f3['text']));var _0x47b252=this[_0xbf69('0x82')][_0xbf69('0x69')](this,_0x19e3f3);if(_0x47b252){this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x125'),_0x47b252));var _0x49d7e0=this[_0xbf69('0xe')][_0xbf69('0x103')](_0x47b252);try{fs[_0xbf69('0x126')](_0x47b252+_0xbf69('0x104'));}catch(_0xafd97a){logger[_0xbf69('0x2e')](_0xafd97a);}return _0x49d7e0;}return this['channel'][_0xbf69('0x2e')](_0x19e3f3,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xbf69('0x15')][_0xbf69('0x127')]=function(_0x16c0dc){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x128'),_0x16c0dc[_0xbf69('0x33')]));if(!this['isConfigured'](_0x16c0dc[_0xbf69('0x83')])||!this['isConfigured'](_0x16c0dc['aws_secret_access_key'])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0x123'));}if(!this[_0xbf69('0x80')](_0x16c0dc['aws_bot_name'])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0x129'));}if(!this['isConfigured'](_0x16c0dc[_0xbf69('0x59')])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xe8')]=!![];this[_0xbf69('0x32')](_0x16c0dc);this[_0xbf69('0x3a')](_0x16c0dc[_0xbf69('0x59')],'in','','');this[_0xbf69('0xe')]['noop'](util['format'](_0xbf69('0x12a'),_0x16c0dc['text']));var _0x2d318d=this[_0xbf69('0x88')][_0xbf69('0x69')](this,_0x16c0dc);if(_0x2d318d){for(var _0x20b722 in _0x2d318d){if(_0x2d318d[_0xbf69('0x95')](_0x20b722)&&_['isString'](_0x2d318d[_0x20b722])){this[_0xbf69('0xe')][_0xbf69('0x9c')](util['format'](_0xbf69('0x12b'),_0x20b722['toUpperCase']()),_0x2d318d[_0x20b722]);}}if(_[_0xbf69('0x3f')](_0x2d318d[_0xbf69('0x70')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0x12c'));}else{this['createSquareMessage'](_0x2d318d[_0xbf69('0x70')],'out','amazonlex','');return this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x12d'),_0x2d318d[_0xbf69('0x70')]));}}return this[_0xbf69('0xe')]['error'](_0x16c0dc,_0xbf69('0x12e'));};AGIVertices['prototype'][_0xbf69('0x12f')]=function(_0x34f437){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x34f437[_0xbf69('0x33')],_0x34f437[_0xbf69('0x61')]));if(!this[_0xbf69('0x80')](_0x34f437[_0xbf69('0x74')])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0xe7'));}var _0x3fc439=_0xbf69('0x130');var _0x319f14=util[_0xbf69('0x4f')](_0xbf69('0x131'),FILES_PATH,rs[_0xbf69('0x11a')](0x4));var _0x876fcf=util[_0xbf69('0x4f')](_0xbf69('0x9b'),_0x319f14,_0x3fc439);var _0x40aa04=!![];if(_0x34f437['beep']===_0xbf69('0x132')){_0x40aa04=![];}var _0x38b0c0=this[_0xbf69('0xe')]['recordFile'](_0x319f14,_0x3fc439,_0x34f437['intKey'],_0x34f437['timeout'],undefined,_0x40aa04);if(_0x38b0c0['result']!==-0x1){this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x133'),_0x876fcf));var _0x4bbced=this[_0xbf69('0x134')][_0xbf69('0x69')](this,_0x34f437,_0x876fcf);if(_0x4bbced){for(var _0x59e055 in _0x4bbced){if(_0x4bbced[_0xbf69('0x95')](_0x59e055)){this[_0xbf69('0xe')][_0xbf69('0x9c')](util['format'](_0xbf69('0x135'),_0x59e055[_0xbf69('0x64')]()),_0x4bbced[_0x59e055]);}}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('GoogleASR\x20Result\x20%s',JSON[_0xbf69('0x6c')](_0x4bbced)));}}return _0x38b0c0;};AGIVertices['prototype'][_0xbf69('0x136')]=function(_0x39259f){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x137'),_0x39259f[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x39259f[_0xbf69('0x8c')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x138'));}if(!this[_0xbf69('0x80')](_0x39259f[_0xbf69('0x8d')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0x139'));}var _0x5080c9=_0xbf69('0x130');var _0x9ebd8d=util[_0xbf69('0x4f')](_0xbf69('0x131'),FILES_PATH,rs[_0xbf69('0x11a')](0x4));var _0x4391ef=util[_0xbf69('0x4f')](_0xbf69('0x9b'),_0x9ebd8d,_0x5080c9);var _0x1c7b8c=!![];if(_0x39259f[_0xbf69('0x13a')]===_0xbf69('0x132')){_0x1c7b8c=![];}var _0x38cb81=this[_0xbf69('0xe')]['recordFile'](_0x9ebd8d,_0x5080c9,_0x39259f[_0xbf69('0x13b')],_0x39259f['timeout'],undefined,_0x1c7b8c);if(_0x38cb81[_0xbf69('0xa7')]!==-0x1){this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x13c'),_0x4391ef));var _0x4349cf=this[_0xbf69('0x8b')]['sync'](this,_0x39259f,_0x4391ef);if(_0x4349cf){for(var _0x8e446e in _0x4349cf){if(_0x4349cf['hasOwnProperty'](_0x8e446e)){this[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')](_0xbf69('0x13d'),_0x8e446e[_0xbf69('0x64')]()),_0x4349cf[_0x8e446e]);}}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x13e'),JSON[_0xbf69('0x6c')](_0x4349cf)));}}return _0x38cb81;};AGIVertices['prototype']['gotoc']=function(_0x4db64c){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4db64c[_0xbf69('0x33')]));return this[_0xbf69('0xe')][_0xbf69('0x13f')](_0x4db64c['context'],_0x4db64c[_0xbf69('0x39')],_0x4db64c[_0xbf69('0x140')]);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x141')]=function(_0x24f44d){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x142'),_0x24f44d[_0xbf69('0x33')]));if(!this['isConfigured'](_0x24f44d[_0xbf69('0x143')])){return this['channel'][_0xbf69('0x2e')](_0x24f44d,_0xbf69('0x144'));}try{var _0x485f66=eval(_0x24f44d[_0xbf69('0x143')])?'true':_0xbf69('0x145');this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('EVAL\x20CONDITION\x20%s\x20%s',_0x24f44d['condition'],_0x485f66));return{'code':0xc8,'result':_0x485f66};}catch(_0x19cbc9){return{'code':0xc8,'result':_0xbf69('0x145')};}};AGIVertices[_0xbf69('0x15')]['gotoiftime']=function(_0x263326){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x146'),_0x263326[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x263326[_0xbf69('0x147')])){return this[_0xbf69('0xe')]['error'](_0x263326,_0xbf69('0x148'));}var _0x2aa4d4=this[_0xbf69('0x22')][_0xbf69('0x69')](this,_0x263326[_0xbf69('0x147')]);if(!_0x2aa4d4){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x263326,_0xbf69('0x149'));}for(var _0x2434fc=0x0;_0x2434fc<_0x2aa4d4[_0xbf69('0x98')];_0x2434fc+=0x1){var _0x1c4ef0=this[_0xbf69('0xe')][_0xbf69('0x11')](util['format']('IFTIME(%s?true:false)',_0x2aa4d4[_0x2434fc]));if(_0x1c4ef0[_0xbf69('0xa7')]===-0x1){return _0x1c4ef0;}logger['info'](util['format'](_0xbf69('0x14a'),_0x2aa4d4[_0x2434fc],_0x1c4ef0[_0xbf69('0x9f')]));if(_0x1c4ef0[_0xbf69('0x9f')]==='true'){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x14a'),_0x2aa4d4[_0x2434fc],_0xbf69('0x14b')));this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x14a'),_0x2aa4d4[_0x2434fc],'true'));return{'code':0xc8,'result':_0xbf69('0x14b')};}else{logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x14a'),_0x2aa4d4[_0x2434fc],'false'));this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x14a'),_0x2aa4d4[_0x2434fc],_0xbf69('0x145')));}}return{'code':0xc8,'result':_0xbf69('0x145')};};AGIVertices[_0xbf69('0x15')][_0xbf69('0x14c')]=function(_0x2ca187){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x14d'),_0x2ca187[_0xbf69('0x33')]));return this['channel'][_0xbf69('0x14c')]();};AGIVertices['prototype'][_0xbf69('0x14e')]=function(_0x26b7d5){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x14f'),_0x26b7d5[_0xbf69('0x33')]));if(!this['isConfigured'](_0x26b7d5[_0xbf69('0x74')])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0xe7'));}var _0x19f944=_0xbf69('0x130');var _0x39681a=util[_0xbf69('0x4f')](_0xbf69('0x131'),FILES_PATH,rs[_0xbf69('0x11a')](0x4));var _0x83d02e=util[_0xbf69('0x4f')](_0xbf69('0x9b'),_0x39681a,_0x19f944);var _0x5a414f=!![];if(_0x26b7d5[_0xbf69('0x13a')]==='NOBEEP'){_0x5a414f=![];}var _0x197369=this[_0xbf69('0xe')][_0xbf69('0x150')](_0x39681a,_0x19f944,_0x26b7d5[_0xbf69('0x13b')],_0x26b7d5[_0xbf69('0x61')],undefined,_0x5a414f);if(_0x197369[_0xbf69('0xa7')]!==-0x1){this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x151'),_0x83d02e));var _0x49961c=this['ispeechASR'][_0xbf69('0x69')](this,_0x26b7d5,_0x83d02e);if(_0x49961c){for(var _0x313aec in _0x49961c){if(_0x49961c[_0xbf69('0x95')](_0x313aec)){this[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')]('ISPEECH_ASR_%s',_0x313aec[_0xbf69('0x64')]()),_0x49961c[_0x313aec]);}}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x152'),JSON[_0xbf69('0x6c')](_0x49961c)));}}return _0x197369;};AGIVertices[_0xbf69('0x15')]['ispeechtts']=function(_0x206ee2){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x153'),_0x206ee2['label']));if(!this[_0xbf69('0x80')](_0x206ee2['key'])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xe7'));}if(!this[_0xbf69('0x80')](_0x206ee2[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('Trying\x20ispeech\x20TTS\x20%s',_0x206ee2[_0xbf69('0x59')]));var _0x282471=this[_0xbf69('0x7c')][_0xbf69('0x69')](this,_0x206ee2);if(_0x282471){this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x151'),_0x282471));var _0x21dc2b=this[_0xbf69('0xe')]['streamFile'](_0x282471,_0x206ee2['intKey']);try{fs[_0xbf69('0x126')](_0x282471+'.wav');}catch(_0x2cd702){logger['error'](_0x2cd702);}return _0x21dc2b;}return this[_0xbf69('0xe')]['error'](_0x206ee2,_0xbf69('0x154'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x155')]=function(_0x44276a){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x156'),_0x44276a[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x44276a[_0xbf69('0x157')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x44276a,_0xbf69('0x158'));}logger['info'](util[_0xbf69('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf69('0xe')][_0xbf69('0x35')],_0x44276a[_0xbf69('0x157')]));var _0x4fc5d9=this[_0xbf69('0x4d')][_0xbf69('0x69')](this,_0x44276a['findBy']);if(_0x4fc5d9){logger['info'](util[_0xbf69('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf69('0xe')]['callerid'],_0x44276a[_0xbf69('0x157')]));this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x159'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x44276a[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15a')};}else{logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x15b'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x44276a[_0xbf69('0x157')]));this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x15b'),this['channel']['callerid'],_0x44276a[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15c')};}};AGIVertices[_0xbf69('0x15')][_0xbf69('0x15d')]=function(_0x13c7f8){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x15e'),_0x13c7f8[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x13c7f8[_0xbf69('0x157')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x13c7f8,'no\x20find\x20by\x20configured');}logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf69('0xe')][_0xbf69('0x35')],_0x13c7f8['findBy']));var _0x2660eb=this[_0xbf69('0x4c')][_0xbf69('0x69')](this,_0x13c7f8[_0xbf69('0x157')]);if(_0x2660eb){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x159'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x13c7f8['findBy']));this['channel'][_0xbf69('0xa6')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xbf69('0xe')][_0xbf69('0x35')],_0x13c7f8[_0xbf69('0x157')]));return{'code':0xc8,'result':'success'};}else{logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xbf69('0xe')][_0xbf69('0x35')],_0x13c7f8[_0xbf69('0x157')]));this[_0xbf69('0xe')]['noop'](util['format'](_0xbf69('0x15b'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x13c7f8[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15c')};}};AGIVertices[_0xbf69('0x15')]['math']=function(_0x567f89){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x15f'),_0x567f89[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x567f89['operation'])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x567f89,_0xbf69('0x160'));}this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x161'),_0x567f89['operation']));var _0x205417=eval(_0x567f89['operation']);if(!this[_0xbf69('0x80')](_0x567f89[_0xbf69('0xd7')])){return this['channel'][_0xbf69('0xa6')](_0xbf69('0xd8'));}var _0x15929a=this['getVariable'][_0xbf69('0x69')](this,_0x567f89[_0xbf69('0xd7')]);if(!_0x15929a){return this['channel'][_0xbf69('0x2e')](_0x567f89,_0xbf69('0x118'));}if(_[_0xbf69('0x97')](_0x205417)){var _0x567feb=this;_0x205417[_0xbf69('0xd9')](function(_0x21e95c,_0x5a9721){_0x567feb[_0xbf69('0xe')][_0xbf69('0x9c')](util['format'](_0xbf69('0x162'),_0x15929a,_0x5a9721),_0x21e95c);});return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x163'),_0x15929a));}else{return this[_0xbf69('0xe')]['setVariable'](_0x15929a,_0x205417);}};AGIVertices[_0xbf69('0x15')][_0xbf69('0xb')]=function(_0x1bf5d0){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x164'),_0x1bf5d0[_0xbf69('0x33')]));if(_0x1bf5d0[_0xbf69('0xa3')]===0x0){return this['maxRetry'](_0x1bf5d0);}_0x1bf5d0[_0xbf69('0xa3')]-=0x1;if(!this[_0xbf69('0x80')](_0x1bf5d0[_0xbf69('0x114')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1bf5d0,_0xbf69('0x113'));}var _0x34de2a=this[_0xbf69('0x1c')]['sync'](this,_0x1bf5d0[_0xbf69('0x114')]);if(!_0x34de2a){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1bf5d0,_0xbf69('0x165'));}var _0x26a8bd=this[_0xbf69('0xe')]['getData'](_0x34de2a,_0x1bf5d0[_0xbf69('0x166')],_0x1bf5d0[_0xbf69('0x167')]);var _0x2ee5aa=_0x26a8bd[_0xbf69('0xa7')];if(_0x26a8bd[_0xbf69('0xa7')]===-0x1){this[_0xbf69('0x32')]['sync'](this,_0x1bf5d0,'-1');return _0x26a8bd;}else if(_0x26a8bd[_0xbf69('0x9f')]==='timeout'){_0x26a8bd['result']=_0x26a8bd[_0xbf69('0xa7')]['length']>0x0?_0x26a8bd[_0xbf69('0xa7')]:'t';}else if(_[_0xbf69('0x3c')](_0x26a8bd[_0xbf69('0xa7')])){_0x26a8bd[_0xbf69('0xa7')]='#';_0x2ee5aa='#';}if(!this[_0xbf69('0x80')](_0x1bf5d0[_0xbf69('0xd7')])){this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xd8'));}else{var _0x5f0db3=this[_0xbf69('0x11')][_0xbf69('0x69')](this,_0x1bf5d0['variable_id']);if(!_0x5f0db3){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x1bf5d0,_0xbf69('0x118'));}this[_0xbf69('0xe')]['setVariable'](_0x5f0db3,_0x2ee5aa);}this[_0xbf69('0x32')][_0xbf69('0x69')](this,_0x1bf5d0,_0x2ee5aa);return _0x26a8bd;};AGIVertices['prototype'][_0xbf69('0xa6')]=function(_0x2cb27a){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x168'),_0x2cb27a['label']));return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0x2cb27a['output']||_0x2cb27a[_0xbf69('0x33')]);};AGIVertices['prototype']['pause']=function(_0x446c31){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x169'),_0x446c31[_0xbf69('0x33')]));if(!this['isConfigured'](_0x446c31[_0xbf69('0x157')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x446c31,_0xbf69('0x158'));}logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xbf69('0xe')][_0xbf69('0x35')],_0x446c31[_0xbf69('0x157')]));var _0x3fb7e1=this['getPause'][_0xbf69('0x69')](this,_0x446c31[_0xbf69('0x16a')]);var _0x4c8bcd=this[_0xbf69('0x49')][_0xbf69('0x69')](this,_0x446c31[_0xbf69('0x157')],_0x3fb7e1);if(_0x4c8bcd){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x159'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x446c31[_0xbf69('0x157')]));this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x159'),this['channel'][_0xbf69('0x35')],_0x446c31[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15a')};}else{logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x15b'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x446c31[_0xbf69('0x157')]));this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x159'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x446c31[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15c')};}};AGIVertices[_0xbf69('0x15')]['playback']=function(_0x207b24){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x16b'),_0x207b24['label']));if(!this[_0xbf69('0x80')](_0x207b24[_0xbf69('0x114')])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x207b24,'no\x20file\x20audio\x20selected');}var _0x263d2d=this['getSound'][_0xbf69('0x69')](this,_0x207b24['file_id']);if(!_0x263d2d){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x207b24,_0xbf69('0x165'));}var _0x1e095d=this[_0xbf69('0xe')][_0xbf69('0x53')]('PLAYBACK',[_0x263d2d,_0x207b24[_0xbf69('0xe4')]]);if(_0x1e095d[_0xbf69('0xa7')]===-0x1){return _0x1e095d;}return this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x16c'),_0xbf69('0x16d'),_0x263d2d));};AGIVertices['prototype'][_0xbf69('0x16e')]=function(_0x4864ce){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x16f'),_0x4864ce[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x4864ce['queue_id'])){return this[_0xbf69('0xe')]['error'](_0x4864ce,_0xbf69('0x170'));}var _0x2ae8b7='';var _0x3fb821=parseInt(_0x4864ce['queue_id'],0xa);if(isNaN(_0x3fb821)){_0x2ae8b7=_0x4864ce[_0xbf69('0x171')];}else{_0x2ae8b7=this[_0xbf69('0x172')][_0xbf69('0x69')](this,_0x4864ce[_0xbf69('0x171')]);if(!_0x2ae8b7){return this[_0xbf69('0xe')]['error'](_0x4864ce,'no\x20queue\x20found');}}var _0x53a30b='';if(this[_0xbf69('0x80')](_0x4864ce[_0xbf69('0x114')])){var _0x22cb50=this[_0xbf69('0x1c')][_0xbf69('0x69')](this,_0x4864ce['file_id']);if(_0x22cb50){_0x53a30b=_0x22cb50;}}this[_0xbf69('0x32')][_0xbf69('0x69')](this,_0x4864ce,_0x2ae8b7);if(_0x4864ce[_0xbf69('0xe4')][_0xbf69('0x173')]('x')<0x0){_0x4864ce[_0xbf69('0xe4')]+='x';}if(_0x4864ce['opts'][_0xbf69('0x173')]('X')<0x0){_0x4864ce[_0xbf69('0xe4')]+='X';}this[_0xbf69('0xe')][_0xbf69('0x9c')](_0xbf69('0x174'),_0x2ae8b7?_0x2ae8b7[_0xbf69('0x175')]():'');var _0x1c003d=this['channel']['exec'](_0xbf69('0x176'),[_0x2ae8b7,_0x4864ce['opts'],_0x4864ce[_0xbf69('0x5f')],_0x53a30b,_0x4864ce['timeout'],_0x4864ce[_0xbf69('0x5')],_0x4864ce[_0xbf69('0x177')],_0x4864ce['gosub'],'',_0x4864ce['position']]);if(_0x1c003d[_0xbf69('0xa7')]===-0x1){return _0x1c003d;}return this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x16c'),_0xbf69('0x176'),_0x2ae8b7));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x178')]=function(_0x36e71d){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x179'),_0x36e71d[_0xbf69('0x33')]));var _0x3ac2f5=_0x36e71d['recordingFormat']||_0xbf69('0x130');var _0x4b011a=util[_0xbf69('0x4f')](_0xbf69('0x17a'),this['channel'][_0xbf69('0x37')],rs['generate'](0x5));var _0x2f8b1f=util[_0xbf69('0x4f')](_0xbf69('0x17b'),FILES_PATH,_0x4b011a,_0x3ac2f5);var _0x10851b=util['format'](_0xbf69('0x131'),FILES_PATH,_0x4b011a);this[_0xbf69('0x36')][_0xbf69('0x69')](this,_0x36e71d,_0x4b011a,_0x2f8b1f);this['channel'][_0xbf69('0x9c')](_0xbf69('0x17c'),_0x4b011a);logger['info'](_0xbf69('0x17d'),_0x10851b,_0x3ac2f5,_0x36e71d['escape_digits'],_0x36e71d[_0xbf69('0x61')]);return this[_0xbf69('0xe')][_0xbf69('0x150')](_0x10851b,_0x3ac2f5,_0x36e71d['escape_digits'],_0x36e71d['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x7421fb){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x7421fb[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x7421fb['url'])){return this['channel'][_0xbf69('0xa6')]('no\x20url\x20configured');}var _0x48219c=this[_0xbf69('0x17e')][_0xbf69('0x69')](this,_0x7421fb);logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Response:',util[_0xbf69('0x17f')](_0x48219c,{'showHidden':![],'depth':null})));if(!this[_0xbf69('0x80')](_0x7421fb[_0xbf69('0xd7')])){return this[_0xbf69('0xe')]['noop'](_0xbf69('0x180'));}var _0x54b826=this[_0xbf69('0x11')][_0xbf69('0x69')](this,_0x7421fb[_0xbf69('0xd7')]);if(!_0x54b826){return this['channel'][_0xbf69('0x2e')](_0x7421fb,'no\x20variable\x20found');}this[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')](_0xbf69('0x181'),_0x54b826),_0x48219c[_0xbf69('0x6f')]?_0x48219c['statusCode']:_0xbf69('0x182'));this[_0xbf69('0xe')][_0xbf69('0x9c')](util[_0xbf69('0x4f')]('%s_STATUS_MESSAGE',_0x54b826),_0x48219c['statusMessage']?_0x48219c['statusMessage']:'OK');if(_0x48219c['body']){try{this['saveRestApiResult'](_0x48219c[_0xbf69('0x65')],_0x54b826);}catch(_0x42ac79){logger[_0xbf69('0x2e')](util[_0xbf69('0x4f')](_0xbf69('0x183'),_0x54b826));}}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')]('variable\x20%s\x20set',_0x54b826));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x184')]=function(_0x3475e6){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x3475e6[_0xbf69('0x33')]));return this[_0xbf69('0xe')][_0xbf69('0x185')](_0x3475e6[_0xbf69('0x186')][_0xbf69('0x55')](/\s+/g,''),_0x3475e6[_0xbf69('0x187')]);};AGIVertices[_0xbf69('0x15')]['saynumber']=function(_0x5c3b85){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x188'),_0x5c3b85[_0xbf69('0x33')]));return this[_0xbf69('0xe')][_0xbf69('0x189')](_0x5c3b85[_0xbf69('0x62')][_0xbf69('0x55')](/\s+/g,''),_0x5c3b85[_0xbf69('0x187')]);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x18a')]=function(_0x24623c){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x18b'),_0x24623c[_0xbf69('0x33')]));return this['channel']['sayPhonetic'](_0x24623c[_0xbf69('0x59')],_0x24623c['escape_digits']);};AGIVertices[_0xbf69('0x15')][_0xbf69('0x18c')]=function(_0x3fe717){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x18d'),_0x3fe717[_0xbf69('0x33')]));if(!this['isConfigured'](_0x3fe717[_0xbf69('0x18e')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x18f'));}var _0x20ab25=this[_0xbf69('0x20')][_0xbf69('0x69')](this,_0x3fe717['account_id']);if(!_0x20ab25||!_0x20ab25[_0xbf69('0x190')]){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x3fe717,_0xbf69('0x191'));}var _0x3f7d71={'from':util[_0xbf69('0x4f')](_0xbf69('0x192'),_0x20ab25[_0xbf69('0x13')],_0x20ab25['email']||_0x20ab25[_0xbf69('0x190')]['user']),'to':_0x3fe717['to']||'','cc':_0x3fe717['cc']||'','bcc':_0x3fe717[_0xbf69('0x193')]||'','subject':_0x3fe717[_0xbf69('0x194')],'html':_0x3fe717[_0xbf69('0x59')],'text':_0x3fe717[_0xbf69('0x59')]};if(this[_0xbf69('0x80')](_0x3fe717[_0xbf69('0x195')])){}logger['debug'](_0xbf69('0x196'),JSON['stringify'](_0x3f7d71));this[_0xbf69('0x32')]['sync'](this,_0x3fe717,_0x3fe717['account_id']);this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x197'),_0x20ab25[_0xbf69('0x13')]));this[_0xbf69('0x21')][_0xbf69('0x69')](this,_0x20ab25[_0xbf69('0x198')],_0x3f7d71);return this['channel'][_0xbf69('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xbf69('0x15')][_0xbf69('0x199')]=function(_0x22aa0f){logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x19a'),_0x22aa0f[_0xbf69('0x33')]));return this[_0xbf69('0xe')]['noop'](_0xbf69('0x19b'));};AGIVertices['prototype'][_0xbf69('0x19c')]=function(_0xee7102){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x19d'),_0xee7102[_0xbf69('0x33')]));if(!this['isConfigured'](_0xee7102[_0xbf69('0x19e')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x19f'));}var _0x5354b5=this['getSmsAccount'][_0xbf69('0x69')](this,_0xee7102[_0xbf69('0x19e')]);if(!_0x5354b5){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0xee7102,_0xbf69('0x1a0'));}var _0x56d2d7={'body':_0xee7102[_0xbf69('0x1a1')],'phone':_0xee7102['to']||'','SmsAccountId':_0x5354b5['id']};logger[_0xbf69('0xdd')](_0xbf69('0x1a2'),JSON['stringify'](_0x56d2d7));this[_0xbf69('0x32')][_0xbf69('0x69')](this,_0xee7102,_0xee7102[_0xbf69('0x19e')]);this['channel'][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x1a3'),_0x5354b5[_0xbf69('0x13')]));this[_0xbf69('0x31')][_0xbf69('0x69')](this,_0x56d2d7);return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x1a4'));};AGIVertices['prototype'][_0xbf69('0x1a5')]=function(_0x38a98c){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x1a6'),_0x38a98c['label']));if(!this[_0xbf69('0x80')](_0x38a98c[_0xbf69('0xd7')])){return this[_0xbf69('0xe')]['error'](_0x38a98c,'no\x20variable\x20selected');}var _0x1f1fff=this[_0xbf69('0x11')]['sync'](this,_0x38a98c['variable_id']);if(!_0x1f1fff){return this[_0xbf69('0xe')]['error'](_0x38a98c,_0xbf69('0x118'));}return this[_0xbf69('0xe')][_0xbf69('0x9c')](_0x1f1fff,_0x38a98c[_0xbf69('0x1a7')]);};AGIVertices['prototype']['start']=function(_0x109bf6){logger[_0xbf69('0x2a')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x109bf6[_0xbf69('0x33')]));this['channel'][_0xbf69('0xa6')]('START\x20CALLY\x20SQUARE');if(_0x109bf6[_0xbf69('0xb6')]===_0xbf69('0x1a8')){this[_0xbf69('0xe')]['noop'](_0xbf69('0x1a9'));return this[_0xbf69('0xe')][_0xbf69('0xb6')]();}return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x1aa'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x1ab')]=function(_0x36bade){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x36bade[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x36bade[_0xbf69('0x1ac')])){return this['channel'][_0xbf69('0x2e')](_0x36bade,_0xbf69('0x1ad'));}var _0x150237=this[_0xbf69('0x16')][_0xbf69('0x69')](this,_0x36bade[_0xbf69('0x1ac')]);if(!this[_0xbf69('0x80')](_0x150237)){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x36bade,util[_0xbf69('0x4f')](_0xbf69('0x1ae'),_0x36bade['project_id']));}if(_0x150237===this['channel'][_0xbf69('0x34')]){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0x36bade,_0xbf69('0x1af'));}this['createSquareDetailsReport'][_0xbf69('0x69')](this,_0x36bade,_0x150237);var _0x56a4b7=this[_0xbf69('0xe')][_0xbf69('0x53')](_0xbf69('0x1b0'),util[_0xbf69('0x4f')](_0xbf69('0x1b1'),config[_0xbf69('0x5')][_0xbf69('0x1b2')]||'127.0.0.1',_0x150237,this[_0xbf69('0xe')][_0xbf69('0x34')]));if(_0x56a4b7[_0xbf69('0xa7')]===-0x1){return _0x56a4b7;}return this['channel']['noop'](util[_0xbf69('0x4f')](_0xbf69('0x16c'),_0xbf69('0x1b0'),_0x150237));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x1b3')]=function(_0x5e6cfa){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5e6cfa[_0xbf69('0x33')]));var _0x3ff59b=this[_0xbf69('0x52')][_0xbf69('0x69')](this,_0x5e6cfa['command']);this['createSquareDetailsReport'][_0xbf69('0x69')](this,_0x5e6cfa,_0x5e6cfa[_0xbf69('0xb4')]);if(this[_0xbf69('0x80')](_0x5e6cfa['variable_id'])){var _0x2ae63e=this[_0xbf69('0x11')]['sync'](this,_0x5e6cfa[_0xbf69('0xd7')]);if(_0x2ae63e){this[_0xbf69('0xe')][_0xbf69('0x9c')](_0x2ae63e,_0x3ff59b);return this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x1b4'),_0x5e6cfa[_0xbf69('0xb4')],_0x2ae63e));}}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format'](_0xbf69('0x1b5'),_0x5e6cfa[_0xbf69('0xb4')]));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x1b6')]=function(_0x44c26f){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x1b7'),_0x44c26f['label']));_0x44c26f['text']=_0x44c26f[_0xbf69('0x59')][_0xbf69('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf69('0x80')](_0x44c26f[_0xbf69('0x57')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0x1b8'));}if(!this[_0xbf69('0x80')](_0x44c26f[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x1b9'),_0x44c26f[_0xbf69('0x59')]));var _0x4760b3=this[_0xbf69('0x56')][_0xbf69('0x69')](this,_0x44c26f);if(_0x4760b3){this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x1ba'),_0x4760b3));var _0x3fb486=this['channel'][_0xbf69('0x103')](_0x4760b3);try{fs[_0xbf69('0x126')](_0x4760b3+_0xbf69('0x104'));}catch(_0x13add5){logger[_0xbf69('0x2e')](_0x13add5);}return _0x3fb486;}return this['channel'][_0xbf69('0x2e')](_0x44c26f,_0xbf69('0x1bb'));};AGIVertices[_0xbf69('0x15')][_0xbf69('0x1bc')]=function(_0x2174d0){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x1bd'),_0x2174d0[_0xbf69('0x33')]));_0x2174d0[_0xbf69('0x59')]=_0x2174d0[_0xbf69('0x59')][_0xbf69('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xbf69('0x80')](_0x2174d0[_0xbf69('0x59')])){return this[_0xbf69('0xe')][_0xbf69('0xa6')](_0xbf69('0xc4'));}this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x1be'),_0x2174d0[_0xbf69('0x59')]));var _0x428242=this[_0xbf69('0x5d')][_0xbf69('0x69')](this,_0x2174d0);if(_0x428242){this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x1bf'),_0x428242));var _0x29026d=this['channel'][_0xbf69('0x103')](_0x428242);try{fs['unlink'](_0x428242+'.wav');}catch(_0x17ad3a){logger[_0xbf69('0x2e')](_0x17ad3a);}return _0x29026d;}return this['channel'][_0xbf69('0x2e')](_0x2174d0,_0xbf69('0x1c0'));};AGIVertices['prototype']['unpause']=function(_0x2b33ae){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x1c1'),_0x2b33ae[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0x2b33ae['findBy'])){return this[_0xbf69('0xe')]['error'](_0x2b33ae,_0xbf69('0x158'));}logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x1c2'),this['channel'][_0xbf69('0x35')],_0x2b33ae[_0xbf69('0x157')]));var _0x339c6e=this[_0xbf69('0x4b')][_0xbf69('0x69')](this,_0x2b33ae['findBy']);if(_0x339c6e){logger[_0xbf69('0x2a')](util['format'](_0xbf69('0x159'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x2b33ae[_0xbf69('0x157')]));this[_0xbf69('0xe')][_0xbf69('0xa6')](util[_0xbf69('0x4f')](_0xbf69('0x159'),this['channel'][_0xbf69('0x35')],_0x2b33ae[_0xbf69('0x157')]));return{'code':0xc8,'result':_0xbf69('0x15a')};}else{logger['info'](util[_0xbf69('0x4f')](_0xbf69('0x15b'),this['channel'][_0xbf69('0x35')],_0x2b33ae['findBy']));this[_0xbf69('0xe')]['noop'](util[_0xbf69('0x4f')](_0xbf69('0x15b'),this[_0xbf69('0xe')][_0xbf69('0x35')],_0x2b33ae['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xbf69('0x1c3')]=function(_0x58cfc0){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x1c4'),_0x58cfc0[_0xbf69('0x33')]));var _0x181897=this[_0xbf69('0xe')][_0xbf69('0x53')](_0xbf69('0x1c5'),[_0x58cfc0[_0xbf69('0x1c6')],_0x58cfc0[_0xbf69('0x72')]]);if(_0x181897[_0xbf69('0xa7')]===-0x1){return _0x181897;}return this[_0xbf69('0xe')][_0xbf69('0xa6')](util['format']('Executed\x20command\x20%s\x20%s',_0xbf69('0x1c5'),_0x58cfc0[_0xbf69('0x1c6')]));};AGIVertices['prototype']['vswitch']=function(_0xd92ec5){logger[_0xbf69('0x2a')](util[_0xbf69('0x4f')](_0xbf69('0x1c7'),_0xd92ec5[_0xbf69('0x33')]));if(!this[_0xbf69('0x80')](_0xd92ec5['variable_id'])){return this[_0xbf69('0xe')][_0xbf69('0x2e')](_0xd92ec5,'no\x20variable\x20selected');}var _0x2c2304=this['getVariable']['sync'](this,_0xd92ec5['variable_id']);if(!_0x2c2304){return this[_0xbf69('0xe')]['error'](_0xd92ec5,_0xbf69('0x118'));}var _0xe2322c=this['channel'][_0xbf69('0x11')](_0x2c2304);return{'code':0xc8,'result':_0xe2322c[_0xbf69('0x9f')]?_0xe2322c['extra']:'-'};};String['prototype'][_0xbf69('0x9e')]=function(_0x5f1331,_0x3365ca){return this[_0xbf69('0x9d')](_0x5f1331)[_0xbf69('0x1c8')](_0x3365ca);};module[_0xbf69('0x1c9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index f7226c9..c99777b 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 _0xca92=['transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','channels','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','info','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','acw','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil'];(function(_0x3007c5,_0x34995c){var _0x44a200=function(_0x7356f6){while(--_0x7356f6){_0x3007c5['push'](_0x3007c5['shift']());}};_0x44a200(++_0x34995c);}(_0xca92,0x1c0));var _0x2ca9=function(_0x330ac6,_0x3adc83){_0x330ac6=_0x330ac6-0x0;var _0x59b845=_0xca92[_0x330ac6];return _0x59b845;};'use strict';var util=require(_0x2ca9('0x0'));var _=require(_0x2ca9('0x1'));var moment=require(_0x2ca9('0x2'));var ami=require('../ami');var logger=require(_0x2ca9('0x3'))('acw');var RpcUser=require(_0x2ca9('0x4'));var RpcVoiceAgentReport=require(_0x2ca9('0x5'));function Acw(_0x27c40){this[_0x2ca9('0x6')]=_0x27c40[_0x2ca9('0x6')];this[_0x2ca9('0x7')]=_0x27c40[_0x2ca9('0x7')];this[_0x2ca9('0x8')]=_0x27c40[_0x2ca9('0x8')];this['channels']={};ami['on'](_0x2ca9('0x9'),this[_0x2ca9('0xa')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0xc'),this[_0x2ca9('0xd')]['bind'](this));ami['on'](_0x2ca9('0xe'),this['syncHangup'][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0xf'),this[_0x2ca9('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0x2ca9('0x11')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0x12'),this[_0x2ca9('0x13')][_0x2ca9('0xb')](this));ami['on'](_0x2ca9('0x14'),this[_0x2ca9('0x15')]['bind'](this));}function getDiff(_0x5a76ed){var _0x5dd256=moment()[_0x2ca9('0x16')](0x0);var _0x20d918=moment(_0x5a76ed)[_0x2ca9('0x16')](0x0);return _0x5dd256[_0x2ca9('0x17')](_0x20d918,'seconds');}Acw['prototype']['startAcw']=function(_0x304730){try{var _0x3fa6d0=this;var _0xd20d15=this[_0x2ca9('0x18')][_0x304730]['interface'];var _0xbb5bad=this[_0x2ca9('0x18')][_0x304730][_0x2ca9('0x19')];var _0x239268=this[_0x2ca9('0x6')][_0xbb5bad];var _0x2628e9=![];var _0x39001e=_0x2ca9('0x1a');if(_0x239268[_0x2ca9('0x1b')]){if(_0x239268['mandatoryDispositionPause'][_0x2ca9('0x1c')]){_0x2628e9=!![];_0x39001e=_0x239268[_0x2ca9('0x1d')][_0x2ca9('0x1c')];}}ami[_0x2ca9('0x1e')]({'action':_0x2ca9('0x1f'),'interface':_0xd20d15,'paused':!![],'reason':_0x39001e})[_0x2ca9('0x20')](function(_0x13cf10){if(_0x3fa6d0[_0x2ca9('0x7')][_0xd20d15]){return RpcUser[_0x2ca9('0x21')](_0x3fa6d0['agents'][_0xd20d15]['id'])[_0x2ca9('0x20')](function(_0x1757c2){if(_0x1757c2&&!_0x1757c2[_0x2ca9('0x22')]){logger['info'](_0x2ca9('0x23'),_0x304730,_0xd20d15,_0xbb5bad);var _0x119af2=_0x3fa6d0[_0x2ca9('0x18')][_0x304730][_0x2ca9('0x24')]&&_0x3fa6d0[_0x2ca9('0x18')][_0x304730]['destlinkedid']?_0x3fa6d0[_0x2ca9('0x18')][_0x304730]['destlinkedid']:_0x304730;return RpcUser[_0x2ca9('0x25')](_0x3fa6d0[_0x2ca9('0x7')][_0xd20d15],_0x39001e,_0x119af2)[_0x2ca9('0x20')](function(_0x3f1eb){if(!_0x2628e9){_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]={};logger[_0x2ca9('0x26')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x304730,_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')],_0xd20d15,_0xbb5bad);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]['timer']=setTimeout(_0x3fa6d0['stopAcw'][_0x2ca9('0xb')](_0x3fa6d0,_0xd20d15),_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')]*0x3e8);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x28')]=moment()[_0x2ca9('0x29')](_0x2ca9('0x2a'));_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2b')]=_0x304730;_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15]['queue']=_0xbb5bad;_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2c')]=function(){var _0x37992d=getDiff(_0x3fa6d0['timers'][_0xd20d15][_0x2ca9('0x28')]);clearTimeout(_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2d')]);_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2d')]=![];RpcVoiceAgentReport[_0x2ca9('0x2e')]({'acwtime':_0x37992d},_0x3fa6d0[_0x2ca9('0x8')][_0xd20d15][_0x2ca9('0x2b')],_0xd20d15)[_0x2ca9('0x20')](function(_0x96d685){logger[_0x2ca9('0x26')](_0x2ca9('0x2f'),_0x304730,_0x37992d,_0x96d685);})[_0x2ca9('0x30')](function(_0x3f0693){logger[_0x2ca9('0x31')](_0x2ca9('0x32'),_0x304730,_0x3f0693);});delete _0x3fa6d0[_0x2ca9('0x8')][_0xd20d15];};}});}else{logger['info'](_0x2ca9('0x33'),_0x304730,_0xd20d15,_0xbb5bad);}});}})['catch'](function(_0x16bcd6){logger[_0x2ca9('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x304730,_0x3fa6d0[_0x2ca9('0x6')][_0xbb5bad][_0x2ca9('0x27')],_0xd20d15,_0xbb5bad);})[_0x2ca9('0x34')](function(){delete _0x3fa6d0['channels'][_0x304730];});}catch(_0x50802f){logger['error'](_0x2ca9('0x35'),_0x50802f[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')]['stopAcw']=function(_0x200894){try{var _0x4dbc88=this;if(_0x4dbc88[_0x2ca9('0x8')][_0x200894]){_0x4dbc88['timers'][_0x200894][_0x2ca9('0x2d')]=![];var _0x1b2c74=_0x4dbc88['timers'][_0x200894]['uniqueid'];var _0x125821=_0x4dbc88[_0x2ca9('0x8')][_0x200894][_0x2ca9('0x19')];var _0x4d867a=_0x4dbc88[_0x2ca9('0x6')][_0x125821]['acwTimeout'];logger[_0x2ca9('0x26')](_0x2ca9('0x38'),_0x1b2c74,_0x200894);RpcUser['saveUnpause'](this[_0x2ca9('0x7')][_0x200894]);RpcVoiceAgentReport[_0x2ca9('0x2e')]({'acwtime':_0x4d867a,'agentacw':!![]},_0x1b2c74,_0x200894)[_0x2ca9('0x20')](function(_0x29c7cd){logger[_0x2ca9('0x26')](_0x2ca9('0x2f'),_0x1b2c74,_0x4d867a,_0x29c7cd);})['catch'](function(_0x13b126){logger[_0x2ca9('0x31')](_0x2ca9('0x32'),_0x1b2c74,_0x13b126);});}else{logger[_0x2ca9('0x31')](_0x2ca9('0x39'),_0x200894);if(_0x4dbc88[_0x2ca9('0x8')]){logger[_0x2ca9('0x26')]('[ACW][TIMERS]',JSON[_0x2ca9('0x3a')](_0x4dbc88[_0x2ca9('0x8')]));}}}catch(_0x445e2b){logger[_0x2ca9('0x31')](_0x2ca9('0x3b'),_0x445e2b['message']);}};Acw[_0x2ca9('0x37')][_0x2ca9('0xa')]=function(_0x498873){try{if(this[_0x2ca9('0x6')][_0x498873['queue']]&&(this[_0x2ca9('0x6')][_0x498873[_0x2ca9('0x19')]]['acw']||this[_0x2ca9('0x6')][_0x498873[_0x2ca9('0x19')]]['mandatoryDisposition'])){if(this['agents'][_0x498873[_0x2ca9('0x3c')]]){this[_0x2ca9('0x18')][_0x498873[_0x2ca9('0x2b')]]={'queue':_0x498873[_0x2ca9('0x19')],'interface':_0x498873[_0x2ca9('0x3c')],'destlinkedid':_0x498873[_0x2ca9('0x3d')]};}}}catch(_0x341a8d){logger['error'](_0x2ca9('0x3e'),_0x341a8d['message']);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x15')]=function(_0x4c6bb0){try{if(this[_0x2ca9('0x6')][_0x4c6bb0[_0x2ca9('0x19')]]&&(this[_0x2ca9('0x6')][_0x4c6bb0[_0x2ca9('0x19')]][_0x2ca9('0x3f')]||this['voiceQueues'][_0x4c6bb0['queue']][_0x2ca9('0x1b')])){if(this[_0x2ca9('0x7')][_0x4c6bb0[_0x2ca9('0x3c')]]){this[_0x2ca9('0x18')][_0x4c6bb0[_0x2ca9('0x2b')]]={'queue':_0x4c6bb0[_0x2ca9('0x19')],'interface':_0x4c6bb0[_0x2ca9('0x3c')]};}}}catch(_0x25391c){logger[_0x2ca9('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x25391c[_0x2ca9('0x36')]);}};Acw['prototype']['syncHangupRequest']=function(_0x7220d4){try{if(this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x2b')]]&&_[_0x2ca9('0x40')](this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x2b')]][_0x2ca9('0x24')])){logger[_0x2ca9('0x26')](_0x2ca9('0x41'),_0x7220d4[_0x2ca9('0x2b')]);this['startAcw'](_0x7220d4[_0x2ca9('0x2b')]);}else if(this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x42')]]&&_[_0x2ca9('0x40')](this[_0x2ca9('0x18')][_0x7220d4[_0x2ca9('0x42')]][_0x2ca9('0x24')])){logger['info'](_0x2ca9('0x43'),_0x7220d4[_0x2ca9('0x42')]);this[_0x2ca9('0x44')](_0x7220d4[_0x2ca9('0x42')]);}}catch(_0x285f1a){logger[_0x2ca9('0x31')](_0x2ca9('0x45'),_0x285f1a[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x46')]=function(_0x21eece){try{if(this['channels'][_0x21eece[_0x2ca9('0x2b')]]&&this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x2b')]][_0x2ca9('0x24')]){logger['info'](_0x2ca9('0x47'),_0x21eece[_0x2ca9('0x2b')]);this[_0x2ca9('0x44')](_0x21eece[_0x2ca9('0x2b')]);}else if(this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x42')]]&&this[_0x2ca9('0x18')][_0x21eece[_0x2ca9('0x42')]][_0x2ca9('0x24')]){logger[_0x2ca9('0x26')](_0x2ca9('0x48'),_0x21eece[_0x2ca9('0x42')]);this[_0x2ca9('0x44')](_0x21eece[_0x2ca9('0x42')]);}}catch(_0x191187){logger[_0x2ca9('0x31')]('[ACW][syncHangup]\x20%s',_0x191187[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')]['syncAttendedTransfer']=function(_0x21beda){try{if(!_[_0x2ca9('0x49')](this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4a')]])){this[_0x2ca9('0x44')](_0x21beda[_0x2ca9('0x4a')]);if(this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4b')]]){this['channels'][_0x21beda[_0x2ca9('0x4b')]][_0x2ca9('0x24')]=!![];this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4c')]]=this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4b')]];delete this['channels'][_0x21beda[_0x2ca9('0x4b')]];}}else if(!_[_0x2ca9('0x49')](this[_0x2ca9('0x18')][_0x21beda['transfertargetuniqueid']])){this['startAcw'](_0x21beda[_0x2ca9('0x4c')]);if(this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4d')]]){this['channels'][_0x21beda[_0x2ca9('0x4d')]]['attended']=!![];this['channels'][_0x21beda[_0x2ca9('0x4a')]]=this[_0x2ca9('0x18')][_0x21beda[_0x2ca9('0x4d')]];delete this['channels'][_0x21beda['origtransfereruniqueid']];}}}catch(_0x3333ad){logger['error'](_0x2ca9('0x4e'),_0x3333ad[_0x2ca9('0x36')]);}};Acw[_0x2ca9('0x37')][_0x2ca9('0x13')]=function(_0x501db6){try{if(this[_0x2ca9('0x18')][_0x501db6['transfereruniqueid']]){logger[_0x2ca9('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x2ca9('0x3a')](_0x501db6['transfereruniqueid']));this[_0x2ca9('0x44')](_0x501db6[_0x2ca9('0x4f')]);}else if(this[_0x2ca9('0x18')][_0x501db6[_0x2ca9('0x50')]]){logger[_0x2ca9('0x26')](_0x2ca9('0x51'),JSON[_0x2ca9('0x3a')](_0x501db6[_0x2ca9('0x50')]));this[_0x2ca9('0x44')](_0x501db6[_0x2ca9('0x50')]);}}catch(_0x2ab624){logger['error'](_0x2ca9('0x52'),_0x2ab624[_0x2ca9('0x36')]);}};Acw['prototype'][_0x2ca9('0x10')]=function(_0x2b3d68){try{if(this[_0x2ca9('0x6')][_0x2b3d68[_0x2ca9('0x19')]]&&this[_0x2ca9('0x6')][_0x2b3d68[_0x2ca9('0x19')]][_0x2ca9('0x53')]===_0x2ca9('0x54')){if(this[_0x2ca9('0x7')][_0x2b3d68[_0x2ca9('0x3c')]]){logger[_0x2ca9('0x26')](_0x2ca9('0x55'),_0x2b3d68['uniqueid'],_0x2b3d68['interface'],_0x2b3d68[_0x2ca9('0x19')]);return RpcUser['savePause'](this['agents'][_0x2b3d68['interface']],'Auto-Pause',_0x2b3d68[_0x2ca9('0x2b')]);}}}catch(_0x1a5c0e){logger[_0x2ca9('0x31')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1a5c0e[_0x2ca9('0x36')]);}};module[_0x2ca9('0x56')]=Acw; \ No newline at end of file +var _0xeee8=['acwTimeout','lastPauseAt','format','uniqueid','update','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','message','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw'];(function(_0x4365bd,_0x4b939d){var _0x337edb=function(_0x4037b7){while(--_0x4037b7){_0x4365bd['push'](_0x4365bd['shift']());}};_0x337edb(++_0x4b939d);}(_0xeee8,0x174));var _0x8eee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeee8[_0x2dafbe];return _0x58a45a;};'use strict';var util=require('util');var _=require(_0x8eee('0x0'));var moment=require(_0x8eee('0x1'));var ami=require(_0x8eee('0x2'));var logger=require(_0x8eee('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x8eee('0x4'));function Acw(_0x561936){this[_0x8eee('0x5')]=_0x561936[_0x8eee('0x5')];this[_0x8eee('0x6')]=_0x561936[_0x8eee('0x6')];this['timers']=_0x561936[_0x8eee('0x7')];this[_0x8eee('0x8')]={};ami['on'](_0x8eee('0x9'),this[_0x8eee('0xa')][_0x8eee('0xb')](this));ami['on']('hanguprequest',this[_0x8eee('0xc')][_0x8eee('0xb')](this));ami['on'](_0x8eee('0xd'),this[_0x8eee('0xe')][_0x8eee('0xb')](this));ami['on'](_0x8eee('0xf'),this[_0x8eee('0x10')][_0x8eee('0xb')](this));ami['on'](_0x8eee('0x11'),this[_0x8eee('0x12')][_0x8eee('0xb')](this));ami['on'](_0x8eee('0x13'),this[_0x8eee('0x14')][_0x8eee('0xb')](this));ami['on'](_0x8eee('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x316c54){var _0x571e25=moment()[_0x8eee('0x16')](0x0);var _0x511117=moment(_0x316c54)[_0x8eee('0x16')](0x0);return _0x571e25[_0x8eee('0x17')](_0x511117,_0x8eee('0x18'));}Acw[_0x8eee('0x19')][_0x8eee('0x1a')]=function(_0x323add){try{var _0x486109=this;var _0x3ea7ad=this[_0x8eee('0x8')][_0x323add][_0x8eee('0x1b')];var _0x3a5664=this[_0x8eee('0x8')][_0x323add][_0x8eee('0x1c')];var _0x37209b=this[_0x8eee('0x5')][_0x3a5664];var _0x500245=![];var _0x1c525b='ACW';if(_0x37209b[_0x8eee('0x1d')]){if(_0x37209b['mandatoryDispositionPause'][_0x8eee('0x1e')]){_0x500245=!![];_0x1c525b=_0x37209b[_0x8eee('0x1f')]['name'];}}ami[_0x8eee('0x20')]({'action':'QueuePause','interface':_0x3ea7ad,'paused':!![],'reason':_0x1c525b})[_0x8eee('0x21')](function(_0xbf8087){if(_0x486109['agents'][_0x3ea7ad]){return RpcUser[_0x8eee('0x22')](_0x486109[_0x8eee('0x6')][_0x3ea7ad]['id'])[_0x8eee('0x21')](function(_0x2edd97){if(_0x2edd97&&!_0x2edd97[_0x8eee('0x23')]){logger[_0x8eee('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x323add,_0x3ea7ad,_0x3a5664);var _0x47810e=_0x486109[_0x8eee('0x8')][_0x323add][_0x8eee('0x25')]&&_0x486109['channels'][_0x323add][_0x8eee('0x26')]?_0x486109[_0x8eee('0x8')][_0x323add]['destlinkedid']:_0x323add;return RpcUser[_0x8eee('0x27')](_0x486109[_0x8eee('0x6')][_0x3ea7ad],_0x1c525b,_0x47810e)['then'](function(_0x1d5457){if(!_0x500245){_0x486109['timers'][_0x3ea7ad]={};logger[_0x8eee('0x24')](_0x8eee('0x28'),_0x323add,_0x486109[_0x8eee('0x5')][_0x3a5664]['acwTimeout'],_0x3ea7ad,_0x3a5664);_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x29')]=setTimeout(_0x486109[_0x8eee('0x2a')][_0x8eee('0xb')](_0x486109,_0x3ea7ad),_0x486109['voiceQueues'][_0x3a5664][_0x8eee('0x2b')]*0x3e8);_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x2c')]=moment()[_0x8eee('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x2e')]=_0x323add;_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x1c')]=_0x3a5664;_0x486109[_0x8eee('0x7')][_0x3ea7ad]['updateAcw']=function(){var _0x17043e=getDiff(_0x486109['timers'][_0x3ea7ad]['lastPauseAt']);clearTimeout(_0x486109['timers'][_0x3ea7ad][_0x8eee('0x29')]);_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x29')]=![];RpcVoiceAgentReport[_0x8eee('0x2f')]({'acwtime':_0x17043e},_0x486109[_0x8eee('0x7')][_0x3ea7ad][_0x8eee('0x2e')],_0x3ea7ad)['then'](function(_0x193364){logger[_0x8eee('0x24')]('[%s][UPDATE][ACWTIME:%s]',_0x323add,_0x17043e,_0x193364);})[_0x8eee('0x30')](function(_0xe6f71b){logger['error'](_0x8eee('0x31'),_0x323add,_0xe6f71b);});delete _0x486109[_0x8eee('0x7')][_0x3ea7ad];};}});}else{logger[_0x8eee('0x24')](_0x8eee('0x32'),_0x323add,_0x3ea7ad,_0x3a5664);}});}})['catch'](function(_0x290ce3){logger[_0x8eee('0x33')](_0x8eee('0x28'),_0x323add,_0x486109[_0x8eee('0x5')][_0x3a5664]['acwTimeout'],_0x3ea7ad,_0x3a5664);})[_0x8eee('0x34')](function(){delete _0x486109[_0x8eee('0x8')][_0x323add];});}catch(_0x5967d3){logger['error'](_0x8eee('0x35'),_0x5967d3['message']);}};Acw['prototype'][_0x8eee('0x2a')]=function(_0x5f14bd){try{var _0x4ae4fd=this;if(_0x4ae4fd['timers'][_0x5f14bd]){_0x4ae4fd[_0x8eee('0x7')][_0x5f14bd][_0x8eee('0x29')]=![];var _0x61f8c4=_0x4ae4fd[_0x8eee('0x7')][_0x5f14bd][_0x8eee('0x2e')];var _0x47ca17=_0x4ae4fd[_0x8eee('0x7')][_0x5f14bd]['queue'];var _0x1df5f4=_0x4ae4fd[_0x8eee('0x5')][_0x47ca17]['acwTimeout'];logger[_0x8eee('0x24')](_0x8eee('0x36'),_0x61f8c4,_0x5f14bd);RpcUser[_0x8eee('0x37')](this[_0x8eee('0x6')][_0x5f14bd]);RpcVoiceAgentReport[_0x8eee('0x2f')]({'acwtime':_0x1df5f4,'agentacw':!![]},_0x61f8c4,_0x5f14bd)[_0x8eee('0x21')](function(_0x414fca){logger[_0x8eee('0x24')](_0x8eee('0x38'),_0x61f8c4,_0x1df5f4,_0x414fca);})[_0x8eee('0x30')](function(_0x46170e){logger[_0x8eee('0x33')](_0x8eee('0x31'),_0x61f8c4,_0x46170e);});}else{logger[_0x8eee('0x33')](_0x8eee('0x39'),_0x5f14bd);if(_0x4ae4fd['timers']){logger[_0x8eee('0x24')](_0x8eee('0x3a'),JSON['stringify'](_0x4ae4fd[_0x8eee('0x7')]));}}}catch(_0xc3f00b){logger[_0x8eee('0x33')]('[ACW][STOP]\x20%s',_0xc3f00b[_0x8eee('0x3b')]);}};Acw[_0x8eee('0x19')][_0x8eee('0xa')]=function(_0x35e4a9){try{if(this[_0x8eee('0x5')][_0x35e4a9['queue']]&&(this[_0x8eee('0x5')][_0x35e4a9[_0x8eee('0x1c')]][_0x8eee('0x3c')]||this['voiceQueues'][_0x35e4a9[_0x8eee('0x1c')]][_0x8eee('0x1d')])){if(this[_0x8eee('0x6')][_0x35e4a9[_0x8eee('0x1b')]]){this[_0x8eee('0x8')][_0x35e4a9[_0x8eee('0x2e')]]={'queue':_0x35e4a9[_0x8eee('0x1c')],'interface':_0x35e4a9[_0x8eee('0x1b')],'destlinkedid':_0x35e4a9['destlinkedid']};}}}catch(_0x4ebb4c){logger[_0x8eee('0x33')]('[ACW][syncAgentConnect]\x20%s',_0x4ebb4c['message']);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x1180bf){try{if(this[_0x8eee('0x5')][_0x1180bf[_0x8eee('0x1c')]]&&(this[_0x8eee('0x5')][_0x1180bf[_0x8eee('0x1c')]]['acw']||this[_0x8eee('0x5')][_0x1180bf[_0x8eee('0x1c')]][_0x8eee('0x1d')])){if(this['agents'][_0x1180bf['interface']]){this['channels'][_0x1180bf['uniqueid']]={'queue':_0x1180bf[_0x8eee('0x1c')],'interface':_0x1180bf[_0x8eee('0x1b')]};}}}catch(_0x2f61b6){logger[_0x8eee('0x33')](_0x8eee('0x3d'),_0x2f61b6['message']);}};Acw[_0x8eee('0x19')][_0x8eee('0xc')]=function(_0x43d10a){try{if(this['channels'][_0x43d10a['uniqueid']]&&_[_0x8eee('0x3e')](this[_0x8eee('0x8')][_0x43d10a[_0x8eee('0x2e')]][_0x8eee('0x25')])){logger[_0x8eee('0x24')]('[%s][HANGUP:UNIQUEID]',_0x43d10a[_0x8eee('0x2e')]);this['startAcw'](_0x43d10a[_0x8eee('0x2e')]);}else if(this[_0x8eee('0x8')][_0x43d10a['linkedid']]&&_[_0x8eee('0x3e')](this[_0x8eee('0x8')][_0x43d10a[_0x8eee('0x3f')]][_0x8eee('0x25')])){logger['info'](_0x8eee('0x40'),_0x43d10a[_0x8eee('0x3f')]);this[_0x8eee('0x1a')](_0x43d10a[_0x8eee('0x3f')]);}}catch(_0x116176){logger[_0x8eee('0x33')](_0x8eee('0x41'),_0x116176[_0x8eee('0x3b')]);}};Acw[_0x8eee('0x19')][_0x8eee('0xe')]=function(_0x9ff0ff){try{if(this[_0x8eee('0x8')][_0x9ff0ff[_0x8eee('0x2e')]]&&this[_0x8eee('0x8')][_0x9ff0ff[_0x8eee('0x2e')]]['attended']){logger[_0x8eee('0x24')](_0x8eee('0x42'),_0x9ff0ff[_0x8eee('0x2e')]);this['startAcw'](_0x9ff0ff[_0x8eee('0x2e')]);}else if(this[_0x8eee('0x8')][_0x9ff0ff['linkedid']]&&this[_0x8eee('0x8')][_0x9ff0ff[_0x8eee('0x3f')]][_0x8eee('0x25')]){logger[_0x8eee('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x9ff0ff[_0x8eee('0x3f')]);this[_0x8eee('0x1a')](_0x9ff0ff['linkedid']);}}catch(_0x5778e2){logger[_0x8eee('0x33')](_0x8eee('0x43'),_0x5778e2[_0x8eee('0x3b')]);}};Acw[_0x8eee('0x19')][_0x8eee('0x12')]=function(_0x531873){try{if(!_['isNil'](this['channels'][_0x531873[_0x8eee('0x44')]])){this['startAcw'](_0x531873[_0x8eee('0x44')]);if(this[_0x8eee('0x8')][_0x531873['secondtransfereruniqueid']]){this[_0x8eee('0x8')][_0x531873[_0x8eee('0x45')]][_0x8eee('0x25')]=!![];this[_0x8eee('0x8')][_0x531873[_0x8eee('0x46')]]=this[_0x8eee('0x8')][_0x531873[_0x8eee('0x45')]];delete this['channels'][_0x531873[_0x8eee('0x45')]];}}else if(!_['isNil'](this[_0x8eee('0x8')][_0x531873[_0x8eee('0x46')]])){this['startAcw'](_0x531873[_0x8eee('0x46')]);if(this[_0x8eee('0x8')][_0x531873[_0x8eee('0x47')]]){this['channels'][_0x531873[_0x8eee('0x47')]][_0x8eee('0x25')]=!![];this[_0x8eee('0x8')][_0x531873[_0x8eee('0x44')]]=this[_0x8eee('0x8')][_0x531873[_0x8eee('0x47')]];delete this['channels'][_0x531873[_0x8eee('0x47')]];}}}catch(_0x36f249){logger['error'](_0x8eee('0x48'),_0x36f249[_0x8eee('0x3b')]);}};Acw['prototype'][_0x8eee('0x14')]=function(_0x1e7277){try{if(this[_0x8eee('0x8')][_0x1e7277['transfereruniqueid']]){logger[_0x8eee('0x24')](_0x8eee('0x49'),JSON[_0x8eee('0x4a')](_0x1e7277[_0x8eee('0x4b')]));this[_0x8eee('0x1a')](_0x1e7277['transfereruniqueid']);}else if(this['channels'][_0x1e7277['transfererlinkedid']]){logger[_0x8eee('0x24')](_0x8eee('0x4c'),JSON['stringify'](_0x1e7277['transfererlinkedid']));this[_0x8eee('0x1a')](_0x1e7277['transfererlinkedid']);}}catch(_0x3dbc5d){logger[_0x8eee('0x33')](_0x8eee('0x4d'),_0x3dbc5d['message']);}};Acw[_0x8eee('0x19')][_0x8eee('0x10')]=function(_0x270b14){try{if(this['voiceQueues'][_0x270b14[_0x8eee('0x1c')]]&&this[_0x8eee('0x5')][_0x270b14[_0x8eee('0x1c')]][_0x8eee('0x4e')]===_0x8eee('0x4f')){if(this[_0x8eee('0x6')][_0x270b14[_0x8eee('0x1b')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x270b14['uniqueid'],_0x270b14[_0x8eee('0x1b')],_0x270b14[_0x8eee('0x1c')]);return RpcUser[_0x8eee('0x27')](this[_0x8eee('0x6')][_0x270b14['interface']],_0x8eee('0x50'),_0x270b14[_0x8eee('0x2e')]);}}}catch(_0x247c13){logger[_0x8eee('0x33')](_0x8eee('0x51'),_0x247c13[_0x8eee('0x3b')]);}};module[_0x8eee('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 92d1d17..a248fc2 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x7b36bb,_0x40db4f){var _0x248a91=function(_0x22a1db){while(--_0x22a1db){_0x7b36bb['push'](_0x7b36bb['shift']());}};_0x248a91(++_0x40db4f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x0b0e[_0x1147ab];return _0x55cb5a;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x0713=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','error'];(function(_0x1ce9ea,_0x32e6f4){var _0x2a95b9=function(_0x1a0496){while(--_0x1a0496){_0x1ce9ea['push'](_0x1ce9ea['shift']());}};_0x2a95b9(++_0x32e6f4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var _=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x3071('0x5')][_0x3071('0x6')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')][_0x3071('0x8')],!![]);ami[_0x3071('0x9')]();ami[_0x3071('0xa')]=BPromise[_0x3071('0xb')](ami[_0x3071('0xc')]);function error(_0x2fce7a){logger[_0x3071('0xd')](util['format'](_0x3071('0xe'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')]['port'],util[_0x3071('0xf')](_0x2fce7a,![],null)));}function close(){logger[_0x3071('0xd')](util[_0x3071('0x10')](_0x3071('0x11'),config[_0x3071('0x5')]['username'],config['asterisk']['ip'],config[_0x3071('0x5')]['port']));}ami[_0x3071('0x12')]=function(){return function(){return ami[_0x3071('0xa')]({'action':'sipshowregistry'});};};ami[_0x3071('0x13')]=function(){return function(){return ami['Action']({'action':_0x3071('0x14')});};};ami[_0x3071('0x15')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x16')});};};ami[_0x3071('0x17')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x18')});};};ami[_0x3071('0x19')]=function(){return function(){return ami[_0x3071('0xa')]({'action':_0x3071('0x1a')});};};function connect(_0x5f3c22){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x1c'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));ami['once'](_0x3071('0xd'),error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x3071('0x1f'),function(_0x5cd80d){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x20'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')],util['inspect'](_0x5cd80d,![],null)));});ami['on']('fullybooted',function(_0x2ce48a){logger[_0x3071('0x1b')](util[_0x3071('0x10')](_0x3071('0x21'),config[_0x3071('0x5')][_0x3071('0x7')],config[_0x3071('0x5')]['ip'],config[_0x3071('0x5')][_0x3071('0x6')]));return BPromise['resolve']()[_0x3071('0x22')](ami[_0x3071('0x12')]())[_0x3071('0x22')](ami['actionDeviceStateList']())[_0x3071('0x22')](ami[_0x3071('0x15')]())[_0x3071('0x22')](ami[_0x3071('0x17')]())[_0x3071('0x22')](ami[_0x3071('0x19')]())[_0x3071('0x23')](function(_0x3921a1){logger[_0x3071('0xd')](_0x3071('0x24'),util[_0x3071('0xf')](_0x3921a1,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0x3071('0x1d')](_0x3071('0x1e'),close);module[_0x3071('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0a43be0..b0c7cbd 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x70e0,0x17b));var _0x070e=function(_0x290eab,_0x3a9885){_0x290eab=_0x290eab-0x0;var _0xd40914=_0x70e0[_0x290eab];return _0xd40914;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xaa88=['bluebird','../../config/logger','ami','http','Request','rpc','memberReport','error','message','result','catch','jayson/promise'];(function(_0x4640ce,_0xaa7776){var _0x233ed4=function(_0x1c9df1){while(--_0x1c9df1){_0x4640ce['push'](_0x4640ce['shift']());}};_0x233ed4(++_0xaa7776);}(_0xaa88,0x137));var _0x8aa8=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0xaa88[_0x5df033];return _0x445829;};'use strict';var jayson=require(_0x8aa8('0x0'));var BPromise=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var client=jayson['client'][_0x8aa8('0x4')]({'port':0x2329});client[_0x8aa8('0x5')]=function(_0x43f7e4,_0x3b2c88){return new BPromise(function(_0x3e3b70,_0x350e8b){return client['request'](_0x43f7e4,_0x3b2c88)['then'](function(_0x460042){logger['debug'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x3b2c88,_0x460042);if(_0x460042[_0x8aa8('0x8')]){logger[_0x8aa8('0x8')]('rpc',_0x8aa8('0x7'),_0x43f7e4,_0x460042[_0x8aa8('0x8')][_0x8aa8('0x9')],_0x3b2c88);return _0x350e8b(_0x460042['error'][_0x8aa8('0x9')]);}else{return _0x3e3b70(_0x460042[_0x8aa8('0xa')]);}})[_0x8aa8('0xb')](function(_0x33cc5c){logger['error'](_0x8aa8('0x6'),_0x8aa8('0x7'),_0x43f7e4,_0x33cc5c,_0x3b2c88);return _0x350e8b(_0x33cc5c);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index c681358..984c3b0 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 _0x7932=['getQueue','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring'];(function(_0x26275d,_0x38a44b){var _0x15377f=function(_0x15cc53){while(--_0x15cc53){_0x26275d['push'](_0x26275d['shift']());}};_0x15377f(++_0x38a44b);}(_0x7932,0x1ee));var _0x2793=function(_0x540615,_0x53224e){_0x540615=_0x540615-0x0;var _0x3be560=_0x7932[_0x540615];return _0x3be560;};'use strict';var util=require(_0x2793('0x0'));var _=require(_0x2793('0x1'));var moment=require(_0x2793('0x2'));function checkNameSurname(_0x3380f2,_0x29d98b,_0x4c357f){var _0x1437a2='';if(!_['isNil'](_0x29d98b)&&_0x2793('0x3')===typeof _0x29d98b){_0x1437a2+=_0x29d98b;}if(!_[_0x2793('0x4')](_0x4c357f)&&_0x2793('0x3')===typeof _0x4c357f){_0x1437a2+='\x20'+_0x4c357f;}if(_0x1437a2!==''){return _0x1437a2;}return _0x3380f2;}function Action(_0x35d713,_0x189dbc,_0xc6ac03){this[_0x2793('0x5')]=_0x35d713;this[_0x2793('0x6')]=_0xc6ac03||undefined;this['name']=checkNameSurname(_0x189dbc[_0x2793('0x7')]['phone'],_0x189dbc['Contact'][_0x2793('0x8')],_0x189dbc['Contact'][_0x2793('0x9')]);this[_0x2793('0xa')]=_0x189dbc[_0x2793('0xb')];this[_0x2793('0xc')]=_0x35d713[_0x2793('0xd')];this['active']=_0x189dbc['active']||![];this[_0x2793('0xe')]=_0x35d713[_0x2793('0xe')];this['dialQueueTimeout']=_0x35d713[_0x2793('0xf')]||0x3;this['scheduledat']=_0x189dbc['scheduledat'];this['countbusyretry']=_0x189dbc[_0x2793('0x10')];this[_0x2793('0x11')]=_0x189dbc[_0x2793('0x11')];this[_0x2793('0x12')]=_0x189dbc[_0x2793('0x12')];this[_0x2793('0x13')]=_0x189dbc[_0x2793('0x13')];this[_0x2793('0x14')]=_0x189dbc[_0x2793('0x14')];this[_0x2793('0x15')]=_0x189dbc[_0x2793('0x15')];this['countmachineretry']=_0x189dbc['countmachineretry'];this[_0x2793('0x16')]=_0x189dbc[_0x2793('0x16')];this[_0x2793('0x17')]=_0x189dbc[_0x2793('0x17')];this[_0x2793('0x18')]=_0x189dbc[_0x2793('0x18')];this[_0x2793('0x19')]=_0x189dbc[_0x2793('0x19')];this[_0x2793('0x1a')]=_0x189dbc[_0x2793('0x1a')];this[_0x2793('0x1b')]=_0x189dbc[_0x2793('0x1b')];this[_0x2793('0x1c')]=_0x189dbc['id'];this['ContactFirstName']=_0x189dbc[_0x2793('0x7')][_0x2793('0x8')]||'';this['starttime']=moment()[_0x2793('0x1d')](_0x2793('0x1e'));this[_0x2793('0x1f')]=_0x189dbc['callback'];this[_0x2793('0x20')]=_0x189dbc[_0x2793('0x20')];this['callbackat']=_0x189dbc[_0x2793('0x21')];this['recallme']=_0x189dbc['recallme'];this['originatecalleridnum']='';this[_0x2793('0x22')]='';}Action['prototype'][_0x2793('0x23')]=function(){return util['format'](_0x2793('0x24'),this[_0x2793('0xd')],this[_0x2793('0x5')][_0x2793('0x25')]>0x0?this[_0x2793('0xa')][_0x2793('0x26')](this[_0x2793('0x5')][_0x2793('0x25')]):this[_0x2793('0xa')]);};Action['prototype'][_0x2793('0x27')]=function(){return this['queue'];};module[_0x2793('0x28')]=Action; \ No newline at end of file +var _0x3886=['ContactFirstName','firstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x241a41,_0x4dd61c){var _0x51a20a=function(_0x35a2be){while(--_0x35a2be){_0x241a41['push'](_0x241a41['shift']());}};_0x51a20a(++_0x4dd61c);}(_0x3886,0x9a));var _0x6388=function(_0xdcc6ab,_0x4a3611){_0xdcc6ab=_0xdcc6ab-0x0;var _0x2aa467=_0x3886[_0xdcc6ab];return _0x2aa467;};'use strict';var util=require(_0x6388('0x0'));var _=require(_0x6388('0x1'));var moment=require(_0x6388('0x2'));function checkNameSurname(_0x5d7919,_0x5666e5,_0x180d96){var _0x32529a='';if(!_['isNil'](_0x5666e5)&&'string'===typeof _0x5666e5){_0x32529a+=_0x5666e5;}if(!_[_0x6388('0x3')](_0x180d96)&&_0x6388('0x4')===typeof _0x180d96){_0x32529a+='\x20'+_0x180d96;}if(_0x32529a!==''){return _0x32529a;}return _0x5d7919;}function Action(_0x261daa,_0x5c5a0e,_0x286220){this['voiceQueue']=_0x261daa;this[_0x6388('0x5')]=_0x286220||undefined;this[_0x6388('0x6')]=checkNameSurname(_0x5c5a0e[_0x6388('0x7')][_0x6388('0x8')],_0x5c5a0e['Contact']['firstName'],_0x5c5a0e[_0x6388('0x7')][_0x6388('0x9')]);this[_0x6388('0xa')]=_0x5c5a0e['phone'];this[_0x6388('0xb')]=_0x261daa[_0x6388('0x6')];this[_0x6388('0xc')]=_0x5c5a0e[_0x6388('0xc')]||![];this['type']=_0x261daa[_0x6388('0xd')];this[_0x6388('0xe')]=_0x261daa[_0x6388('0xe')]||0x3;this[_0x6388('0xf')]=_0x5c5a0e[_0x6388('0xf')];this[_0x6388('0x10')]=_0x5c5a0e[_0x6388('0x10')];this[_0x6388('0x11')]=_0x5c5a0e[_0x6388('0x11')];this[_0x6388('0x12')]=_0x5c5a0e[_0x6388('0x12')];this[_0x6388('0x13')]=_0x5c5a0e[_0x6388('0x13')];this[_0x6388('0x14')]=_0x5c5a0e[_0x6388('0x14')];this[_0x6388('0x15')]=_0x5c5a0e[_0x6388('0x15')];this[_0x6388('0x16')]=_0x5c5a0e[_0x6388('0x16')];this[_0x6388('0x17')]=_0x5c5a0e['countagentrejectretry'];this['ContactId']=_0x5c5a0e[_0x6388('0x18')];this['ListId']=_0x5c5a0e[_0x6388('0x19')];this[_0x6388('0x1a')]=_0x5c5a0e[_0x6388('0x1a')];this[_0x6388('0x1b')]=_0x5c5a0e['VoiceQueueId'];this[_0x6388('0x1c')]=_0x5c5a0e[_0x6388('0x1c')];this[_0x6388('0x1d')]=_0x5c5a0e['id'];this[_0x6388('0x1e')]=_0x5c5a0e[_0x6388('0x7')][_0x6388('0x1f')]||'';this[_0x6388('0x20')]=moment()[_0x6388('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6388('0x22')]=_0x5c5a0e[_0x6388('0x22')];this[_0x6388('0x23')]=_0x5c5a0e['callbackuniqueid'];this['callbackat']=_0x5c5a0e[_0x6388('0x24')];this['recallme']=_0x5c5a0e[_0x6388('0x25')];this['originatecalleridnum']='';this[_0x6388('0x26')]='';}Action[_0x6388('0x27')][_0x6388('0x28')]=function(){return util[_0x6388('0x21')](_0x6388('0x29'),this[_0x6388('0x6')],this[_0x6388('0x2a')][_0x6388('0x2b')]>0x0?this[_0x6388('0xa')][_0x6388('0x2c')](this[_0x6388('0x2a')][_0x6388('0x2b')]):this['number']);};Action['prototype'][_0x6388('0x2d')]=function(){return this[_0x6388('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 698ee33..666a790 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 _0x2101=['YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format'];(function(_0x4d0729,_0x107590){var _0xe3c29f=function(_0x2774a0){while(--_0x2774a0){_0x4d0729['push'](_0x4d0729['shift']());}};_0xe3c29f(++_0x107590);}(_0x2101,0x12b));var _0x1210=function(_0x49a9de,_0x3f939c){_0x49a9de=_0x49a9de-0x0;var _0x45b020=_0x2101[_0x49a9de];return _0x45b020;};'use strict';var util=require(_0x1210('0x0'));var _=require(_0x1210('0x1'));var moment=require('moment');function getSeconds(_0xec4253,_0x3e1d93){var _0x2cb709=moment(_0xec4253)[_0x1210('0x2')](0x0);var _0x4e47a7=moment(_0x3e1d93)[_0x1210('0x2')](0x0);return _0x2cb709[_0x1210('0x3')](_0x4e47a7,_0x1210('0x4'));}function AgentComplete(_0x937c17,_0x50abc4){this[_0x1210('0x5')]=0x4;this[_0x1210('0x6')]=_0x1210('0x7');this['scheduledat']=_0x937c17[_0x1210('0x8')];this[_0x1210('0x9')]=_0x937c17[_0x1210('0x9')];this[_0x1210('0xa')]=_0x937c17[_0x1210('0x9')]==='outbound'?_0x1210('0xb'):_0x937c17[_0x1210('0x9')];this[_0x1210('0xc')]=_0x937c17['countbusyretry'];this[_0x1210('0xd')]=_0x937c17['countcongestionretry'];this['countnoanswerretry']=_0x937c17[_0x1210('0xe')];this[_0x1210('0xf')]=_0x937c17['countbusyretry']+_0x937c17[_0x1210('0xd')]+_0x937c17[_0x1210('0xe')]+_0x937c17[_0x1210('0x10')]+_0x937c17[_0x1210('0x11')]+_0x937c17[_0x1210('0x12')]+_0x937c17[_0x1210('0x13')]+_0x937c17[_0x1210('0x14')];this[_0x1210('0x10')]=_0x937c17[_0x1210('0x10')];this[_0x1210('0x11')]=_0x937c17[_0x1210('0x11')];this[_0x1210('0x12')]=_0x937c17[_0x1210('0x12')];this['countmachineretry']=_0x937c17[_0x1210('0x13')];this[_0x1210('0x14')]=_0x937c17[_0x1210('0x14')];this['uniqueid']=_0x50abc4[_0x1210('0x15')];this[_0x1210('0x16')]=_0x937c17['name'];this[_0x1210('0x17')]=_0x937c17[_0x1210('0x18')];this[_0x1210('0x19')]=_0x937c17['starttime'];this[_0x1210('0x1a')]=_0x937c17[_0x1210('0x1a')];this[_0x1210('0x1b')]=_0x937c17[_0x1210('0x1b')];this[_0x1210('0x1c')]=moment()[_0x1210('0x1d')](_0x1210('0x1e'));this[_0x1210('0x1f')]=getSeconds(_0x937c17[_0x1210('0x1a')],_0x937c17[_0x1210('0x19')]);this[_0x1210('0x20')]=getSeconds(_0x937c17[_0x1210('0x1b')],_0x937c17[_0x1210('0x1a')]);this[_0x1210('0x21')]=getSeconds(this[_0x1210('0x1c')],_0x937c17['answertime']);this['queue']=_0x50abc4[_0x1210('0xb')];this[_0x1210('0x22')]=_0x50abc4['membername'];this[_0x1210('0x23')]=_0x50abc4[_0x1210('0x23')];this[_0x1210('0x24')]=_0x937c17[_0x1210('0x24')];this['callbackuniqueid']=_0x937c17[_0x1210('0x25')];this[_0x1210('0x26')]=_0x937c17['callbackat'];this[_0x1210('0x27')]=_0x937c17['recallme'];this['ContactId']=_0x937c17[_0x1210('0x28')];this[_0x1210('0x29')]=_0x937c17[_0x1210('0x29')];this['UserId']=_0x937c17['UserId'];this[_0x1210('0x2a')]=_0x937c17[_0x1210('0x2a')];this[_0x1210('0x2b')]=_0x937c17[_0x1210('0x2b')];this['originatecalleridnum']=_0x937c17[_0x1210('0x2c')]||'';this['originatecalleridname']=_0x937c17[_0x1210('0x2d')]||'';}module[_0x1210('0x2e')]=AgentComplete; \ No newline at end of file +var _0x61f8=['state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff'];(function(_0x3e77fa,_0x17a4c1){var _0x4d83cf=function(_0x197fe8){while(--_0x197fe8){_0x3e77fa['push'](_0x3e77fa['shift']());}};_0x4d83cf(++_0x17a4c1);}(_0x61f8,0x83));var _0x861f=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0x61f8[_0x45c981];return _0x4f62c8;};'use strict';var util=require(_0x861f('0x0'));var _=require(_0x861f('0x1'));var moment=require(_0x861f('0x2'));function getSeconds(_0xe19b27,_0x323b93){var _0x1d6ff9=moment(_0xe19b27)['milliseconds'](0x0);var _0x5b18bc=moment(_0x323b93)['milliseconds'](0x0);return _0x1d6ff9[_0x861f('0x3')](_0x5b18bc,'seconds');}function AgentComplete(_0x405c2d,_0x253042){this[_0x861f('0x4')]=0x4;this[_0x861f('0x5')]=_0x861f('0x6');this[_0x861f('0x7')]=_0x405c2d['scheduledat'];this[_0x861f('0x8')]=_0x405c2d[_0x861f('0x8')];this['campaigntype']=_0x405c2d[_0x861f('0x8')]===_0x861f('0x9')?'queue':_0x405c2d[_0x861f('0x8')];this[_0x861f('0xa')]=_0x405c2d[_0x861f('0xa')];this['countcongestionretry']=_0x405c2d[_0x861f('0xb')];this[_0x861f('0xc')]=_0x405c2d[_0x861f('0xc')];this[_0x861f('0xd')]=_0x405c2d[_0x861f('0xa')]+_0x405c2d[_0x861f('0xb')]+_0x405c2d[_0x861f('0xc')]+_0x405c2d[_0x861f('0xe')]+_0x405c2d[_0x861f('0xf')]+_0x405c2d[_0x861f('0x10')]+_0x405c2d[_0x861f('0x11')]+_0x405c2d['countagentrejectretry'];this[_0x861f('0xe')]=_0x405c2d[_0x861f('0xe')];this['countdropretry']=_0x405c2d['countdropretry'];this[_0x861f('0x10')]=_0x405c2d[_0x861f('0x10')];this[_0x861f('0x11')]=_0x405c2d[_0x861f('0x11')];this[_0x861f('0x12')]=_0x405c2d[_0x861f('0x12')];this[_0x861f('0x13')]=_0x253042[_0x861f('0x13')];this[_0x861f('0x14')]=_0x405c2d['name'];this[_0x861f('0x15')]=_0x405c2d[_0x861f('0x16')];this[_0x861f('0x17')]=_0x405c2d[_0x861f('0x17')];this[_0x861f('0x18')]=_0x405c2d['responsetime'];this[_0x861f('0x19')]=_0x405c2d[_0x861f('0x19')];this['endtime']=moment()['format'](_0x861f('0x1a'));this[_0x861f('0x1b')]=getSeconds(_0x405c2d[_0x861f('0x18')],_0x405c2d[_0x861f('0x17')]);this[_0x861f('0x1c')]=getSeconds(_0x405c2d[_0x861f('0x19')],_0x405c2d[_0x861f('0x18')]);this['talktime']=getSeconds(this[_0x861f('0x1d')],_0x405c2d['answertime']);this[_0x861f('0x1e')]=_0x253042[_0x861f('0x1e')];this[_0x861f('0x1f')]=_0x253042[_0x861f('0x1f')];this[_0x861f('0x20')]=_0x253042[_0x861f('0x20')];this[_0x861f('0x21')]=_0x405c2d[_0x861f('0x21')];this[_0x861f('0x22')]=_0x405c2d[_0x861f('0x22')];this[_0x861f('0x23')]=_0x405c2d[_0x861f('0x23')];this[_0x861f('0x24')]=_0x405c2d['recallme'];this[_0x861f('0x25')]=_0x405c2d[_0x861f('0x25')];this[_0x861f('0x26')]=_0x405c2d[_0x861f('0x26')];this[_0x861f('0x27')]=_0x405c2d[_0x861f('0x27')];this[_0x861f('0x28')]=_0x405c2d[_0x861f('0x28')];this[_0x861f('0x29')]=_0x405c2d[_0x861f('0x29')];this['originatecalleridnum']=_0x405c2d[_0x861f('0x2a')]||'';this[_0x861f('0x2b')]=_0x405c2d[_0x861f('0x2b')]||'';}module[_0x861f('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 1a0c11b..0be3bcd 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 _0xf767=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime'];(function(_0xdf74fc,_0x109d17){var _0x56c061=function(_0x1cb85a){while(--_0x1cb85a){_0xdf74fc['push'](_0xdf74fc['shift']());}};_0x56c061(++_0x109d17);}(_0xf767,0x76));var _0x7f76=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xf767[_0x1dd532];return _0x3732aa;};'use strict';var util=require('util');var _=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));function getSeconds(_0x39149,_0x23f0c3){var _0x90398d=moment(_0x39149)['milliseconds'](0x0);var _0x396137=moment(_0x23f0c3)[_0x7f76('0x2')](0x0);return _0x90398d[_0x7f76('0x3')](_0x396137,_0x7f76('0x4'));}function Final(_0x5922e5){this[_0x7f76('0x5')]=_0x5922e5[_0x7f76('0x5')];this[_0x7f76('0x6')]=_0x5922e5[_0x7f76('0x6')];this[_0x7f76('0x7')]=_0x5922e5['type'];this[_0x7f76('0x8')]=_0x5922e5[_0x7f76('0x7')]===_0x7f76('0x9')?_0x7f76('0xa'):_0x5922e5['type'];this[_0x7f76('0xb')]=_0x5922e5['countbusyretry'];this[_0x7f76('0xc')]=_0x5922e5[_0x7f76('0xc')];this[_0x7f76('0xd')]=_0x5922e5[_0x7f76('0xd')];this[_0x7f76('0xe')]=_0x5922e5[_0x7f76('0xb')]+_0x5922e5['countcongestionretry']+_0x5922e5[_0x7f76('0xd')]+_0x5922e5[_0x7f76('0xf')]+_0x5922e5[_0x7f76('0x10')]+_0x5922e5[_0x7f76('0x11')]+_0x5922e5[_0x7f76('0x12')]+_0x5922e5['countagentrejectretry'];this[_0x7f76('0xf')]=_0x5922e5['countnosuchnumberretry'];this[_0x7f76('0x10')]=_0x5922e5[_0x7f76('0x10')];this['countabandonedretry']=_0x5922e5['countabandonedretry'];this['countmachineretry']=_0x5922e5[_0x7f76('0x12')];this[_0x7f76('0x13')]=_0x5922e5[_0x7f76('0x13')];this['queue']=_0x5922e5[_0x7f76('0xa')];this['calleridname']=_0x5922e5[_0x7f76('0x14')];this[_0x7f76('0x15')]=_0x5922e5[_0x7f76('0x15')];this['starttime']=_0x5922e5['starttime'];this['responsetime']=_0x5922e5['responsetime'];this['endtime']=_0x5922e5[_0x7f76('0x16')];this[_0x7f76('0x17')]=_0x5922e5[_0x7f76('0x17')]||0x0;this[_0x7f76('0x18')]=_0x5922e5['holdtime']||0x0;this[_0x7f76('0x19')]=_0x5922e5['talktime']||0x0;this[_0x7f76('0x1a')]=_0x5922e5[_0x7f76('0x1a')];this['callbackuniqueid']=_0x5922e5['callbackuniqueid'];this[_0x7f76('0x1b')]=_0x5922e5[_0x7f76('0x1b')];this['recallme']=_0x5922e5[_0x7f76('0x1c')];this['ContactId']=_0x5922e5[_0x7f76('0x1d')];this[_0x7f76('0x1e')]=_0x5922e5[_0x7f76('0x1e')];this[_0x7f76('0x1f')]=_0x5922e5[_0x7f76('0x1f')];this['VoiceQueueId']=_0x5922e5[_0x7f76('0x20')];this['CampaignId']=_0x5922e5['CampaignId'];this[_0x7f76('0x21')]=_0x5922e5[_0x7f76('0x21')]||'';this[_0x7f76('0x22')]=_0x5922e5['originatecalleridname']||'';}module[_0x7f76('0x23')]=Final; \ No newline at end of file +var _0xd6d2=['countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x4f64bd,_0x509a17){_0x4f64bd=_0x4f64bd-0x0;var _0xb8927b=_0xd6d2[_0x4f64bd];return _0xb8927b;};'use strict';var util=require(_0x2d6d('0x0'));var _=require(_0x2d6d('0x1'));var moment=require('moment');function getSeconds(_0x19be1a,_0x224caa){var _0x5b4a5b=moment(_0x19be1a)[_0x2d6d('0x2')](0x0);var _0x482d86=moment(_0x224caa)[_0x2d6d('0x2')](0x0);return _0x5b4a5b[_0x2d6d('0x3')](_0x482d86,_0x2d6d('0x4'));}function Final(_0x4a4c5e){this[_0x2d6d('0x5')]=_0x4a4c5e[_0x2d6d('0x5')];this[_0x2d6d('0x6')]=_0x4a4c5e[_0x2d6d('0x6')];this[_0x2d6d('0x7')]=_0x4a4c5e[_0x2d6d('0x7')];this[_0x2d6d('0x8')]=_0x4a4c5e[_0x2d6d('0x7')]===_0x2d6d('0x9')?_0x2d6d('0xa'):_0x4a4c5e[_0x2d6d('0x7')];this['countbusyretry']=_0x4a4c5e[_0x2d6d('0xb')];this[_0x2d6d('0xc')]=_0x4a4c5e[_0x2d6d('0xc')];this[_0x2d6d('0xd')]=_0x4a4c5e[_0x2d6d('0xd')];this['countglobal']=_0x4a4c5e[_0x2d6d('0xb')]+_0x4a4c5e[_0x2d6d('0xc')]+_0x4a4c5e[_0x2d6d('0xd')]+_0x4a4c5e[_0x2d6d('0xe')]+_0x4a4c5e[_0x2d6d('0xf')]+_0x4a4c5e['countabandonedretry']+_0x4a4c5e[_0x2d6d('0x10')]+_0x4a4c5e[_0x2d6d('0x11')];this[_0x2d6d('0xe')]=_0x4a4c5e[_0x2d6d('0xe')];this['countdropretry']=_0x4a4c5e[_0x2d6d('0xf')];this[_0x2d6d('0x12')]=_0x4a4c5e['countabandonedretry'];this['countmachineretry']=_0x4a4c5e[_0x2d6d('0x10')];this[_0x2d6d('0x11')]=_0x4a4c5e[_0x2d6d('0x11')];this['queue']=_0x4a4c5e[_0x2d6d('0xa')];this['calleridname']=_0x4a4c5e['calleridname'];this['calleridnum']=_0x4a4c5e[_0x2d6d('0x13')];this[_0x2d6d('0x14')]=_0x4a4c5e[_0x2d6d('0x14')];this[_0x2d6d('0x15')]=_0x4a4c5e[_0x2d6d('0x15')];this[_0x2d6d('0x16')]=_0x4a4c5e[_0x2d6d('0x15')];this[_0x2d6d('0x17')]=_0x4a4c5e[_0x2d6d('0x17')]||0x0;this['holdtime']=_0x4a4c5e[_0x2d6d('0x18')]||0x0;this[_0x2d6d('0x19')]=_0x4a4c5e['talktime']||0x0;this[_0x2d6d('0x1a')]=_0x4a4c5e[_0x2d6d('0x1a')];this[_0x2d6d('0x1b')]=_0x4a4c5e[_0x2d6d('0x1b')];this[_0x2d6d('0x1c')]=_0x4a4c5e[_0x2d6d('0x1c')];this['recallme']=_0x4a4c5e[_0x2d6d('0x1d')];this[_0x2d6d('0x1e')]=_0x4a4c5e[_0x2d6d('0x1e')];this['ListId']=_0x4a4c5e['ListId'];this[_0x2d6d('0x1f')]=_0x4a4c5e['UserId'];this['VoiceQueueId']=_0x4a4c5e['VoiceQueueId'];this[_0x2d6d('0x20')]=_0x4a4c5e[_0x2d6d('0x20')];this[_0x2d6d('0x21')]=_0x4a4c5e[_0x2d6d('0x21')]||'';this[_0x2d6d('0x22')]=_0x4a4c5e['originatecalleridname']||'';}module[_0x2d6d('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 4eb5a8f..f933cb0 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 _0x1fde=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x1fde,0x186));var _0xe1fd=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x1fde[_0x382a62];return _0x490a25;};'use strict';var util=require('util');var _=require(_0xe1fd('0x0'));var moment=require(_0xe1fd('0x1'));function getSeconds(_0x32d53e,_0x313bac){var _0x3278cd=moment(_0x32d53e)['milliseconds'](0x0);var _0x545585=moment(_0x313bac)[_0xe1fd('0x2')](0x0);return _0x3278cd[_0xe1fd('0x3')](_0x545585,_0xe1fd('0x4'));}function Hangup(_0x3c6568,_0x4b7f0c){this['state']=0x4;this[_0xe1fd('0x5')]=_0xe1fd('0x6');this[_0xe1fd('0x7')]=_0x3c6568[_0xe1fd('0x7')];this[_0xe1fd('0x8')]=_0x3c6568[_0xe1fd('0x8')];this[_0xe1fd('0x9')]=_0x3c6568[_0xe1fd('0x8')]===_0xe1fd('0xa')?_0xe1fd('0xb'):_0x3c6568[_0xe1fd('0x8')];this[_0xe1fd('0xc')]=_0x3c6568['countbusyretry'];this[_0xe1fd('0xd')]=_0x3c6568[_0xe1fd('0xd')];this[_0xe1fd('0xe')]=_0x3c6568[_0xe1fd('0xe')];this[_0xe1fd('0xf')]=_0x3c6568[_0xe1fd('0xc')]+_0x3c6568[_0xe1fd('0xd')]+_0x3c6568[_0xe1fd('0xe')]+_0x3c6568[_0xe1fd('0x10')]+_0x3c6568[_0xe1fd('0x11')]+_0x3c6568[_0xe1fd('0x12')]+_0x3c6568[_0xe1fd('0x13')]+_0x3c6568[_0xe1fd('0x14')];this[_0xe1fd('0x10')]=_0x3c6568[_0xe1fd('0x10')];this[_0xe1fd('0x11')]=_0x3c6568['countdropretry'];this[_0xe1fd('0x12')]=_0x3c6568['countabandonedretry'];this[_0xe1fd('0x13')]=_0x3c6568[_0xe1fd('0x13')];this[_0xe1fd('0x14')]=_0x3c6568[_0xe1fd('0x14')];this['uniqueid']=_0x4b7f0c[_0xe1fd('0x15')];this[_0xe1fd('0x16')]=_0x3c6568[_0xe1fd('0x17')];this[_0xe1fd('0x18')]=_0x3c6568[_0xe1fd('0x19')];this['starttime']=_0x3c6568[_0xe1fd('0x1a')];this[_0xe1fd('0x1b')]=_0x3c6568[_0xe1fd('0x1b')];this[_0xe1fd('0x1c')]=moment()[_0xe1fd('0x1d')](_0xe1fd('0x1e'));this[_0xe1fd('0x1f')]=getSeconds(_0x3c6568[_0xe1fd('0x1b')],_0x3c6568[_0xe1fd('0x1a')]);this['holdtime']=0x0;this[_0xe1fd('0x20')]=getSeconds(this['endtime'],_0x3c6568['responsetime']);this['queue']=_0x3c6568[_0xe1fd('0xb')];this[_0xe1fd('0x21')]=_0xe1fd('0x22');this[_0xe1fd('0x23')]=_0x4b7f0c[_0xe1fd('0x24')];this[_0xe1fd('0x25')]=_0x3c6568[_0xe1fd('0x25')];this[_0xe1fd('0x26')]=_0x3c6568[_0xe1fd('0x26')];this[_0xe1fd('0x27')]=_0x3c6568[_0xe1fd('0x27')];this[_0xe1fd('0x28')]=_0x3c6568['recallme'];this['ContactId']=_0x3c6568[_0xe1fd('0x29')];this[_0xe1fd('0x2a')]=_0x3c6568[_0xe1fd('0x2a')];this[_0xe1fd('0x2b')]=_0x3c6568[_0xe1fd('0x2b')];this[_0xe1fd('0x2c')]=_0x3c6568[_0xe1fd('0x2c')];this[_0xe1fd('0x2d')]=_0x3c6568['CampaignId'];}module[_0xe1fd('0x2e')]=Hangup; \ No newline at end of file +var _0xf43e=['countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','endtime','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3061b6,_0x292311){var _0x1d29ec=function(_0x3c26aa){while(--_0x3c26aa){_0x3061b6['push'](_0x3061b6['shift']());}};_0x1d29ec(++_0x292311);}(_0xf43e,0x73));var _0xef43=function(_0x499a07,_0x5bdd31){_0x499a07=_0x499a07-0x0;var _0x398bfb=_0xf43e[_0x499a07];return _0x398bfb;};'use strict';var util=require(_0xef43('0x0'));var _=require(_0xef43('0x1'));var moment=require(_0xef43('0x2'));function getSeconds(_0x529788,_0x15b673){var _0x35b558=moment(_0x529788)[_0xef43('0x3')](0x0);var _0x454e1d=moment(_0x15b673)[_0xef43('0x3')](0x0);return _0x35b558[_0xef43('0x4')](_0x454e1d,_0xef43('0x5'));}function Hangup(_0x4cb0c4,_0x10d98a){this[_0xef43('0x6')]=0x4;this[_0xef43('0x7')]=_0xef43('0x8');this[_0xef43('0x9')]=_0x4cb0c4['scheduledat'];this[_0xef43('0xa')]=_0x4cb0c4[_0xef43('0xa')];this[_0xef43('0xb')]=_0x4cb0c4[_0xef43('0xa')]===_0xef43('0xc')?_0xef43('0xd'):_0x4cb0c4['type'];this[_0xef43('0xe')]=_0x4cb0c4[_0xef43('0xe')];this['countcongestionretry']=_0x4cb0c4[_0xef43('0xf')];this[_0xef43('0x10')]=_0x4cb0c4[_0xef43('0x10')];this[_0xef43('0x11')]=_0x4cb0c4['countbusyretry']+_0x4cb0c4[_0xef43('0xf')]+_0x4cb0c4['countnoanswerretry']+_0x4cb0c4['countnosuchnumberretry']+_0x4cb0c4[_0xef43('0x12')]+_0x4cb0c4[_0xef43('0x13')]+_0x4cb0c4['countmachineretry']+_0x4cb0c4[_0xef43('0x14')];this[_0xef43('0x15')]=_0x4cb0c4[_0xef43('0x15')];this['countdropretry']=_0x4cb0c4[_0xef43('0x12')];this['countabandonedretry']=_0x4cb0c4[_0xef43('0x13')];this[_0xef43('0x16')]=_0x4cb0c4[_0xef43('0x16')];this[_0xef43('0x14')]=_0x4cb0c4[_0xef43('0x14')];this[_0xef43('0x17')]=_0x10d98a[_0xef43('0x17')];this[_0xef43('0x18')]=_0x4cb0c4[_0xef43('0x19')];this[_0xef43('0x1a')]=_0x4cb0c4['number'];this['starttime']=_0x4cb0c4[_0xef43('0x1b')];this[_0xef43('0x1c')]=_0x4cb0c4[_0xef43('0x1c')];this['endtime']=moment()[_0xef43('0x1d')](_0xef43('0x1e'));this['ringtime']=getSeconds(_0x4cb0c4[_0xef43('0x1c')],_0x4cb0c4[_0xef43('0x1b')]);this[_0xef43('0x1f')]=0x0;this['talktime']=getSeconds(this[_0xef43('0x20')],_0x4cb0c4[_0xef43('0x1c')]);this[_0xef43('0xd')]=_0x4cb0c4[_0xef43('0xd')];this['membername']='IVR';this[_0xef43('0x21')]=_0x10d98a[_0xef43('0x22')];this[_0xef43('0x23')]=_0x4cb0c4['callback'];this['callbackuniqueid']=_0x4cb0c4[_0xef43('0x24')];this['callbackat']=_0x4cb0c4[_0xef43('0x25')];this['recallme']=_0x4cb0c4[_0xef43('0x26')];this['ContactId']=_0x4cb0c4['ContactId'];this['ListId']=_0x4cb0c4[_0xef43('0x27')];this[_0xef43('0x28')]=_0x4cb0c4[_0xef43('0x28')];this[_0xef43('0x29')]=_0x4cb0c4[_0xef43('0x29')];this[_0xef43('0x2a')]=_0x4cb0c4[_0xef43('0x2a')];}module[_0xef43('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index a06a0e3..32eb25b 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 _0x7373=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3079a8,_0x3cfa9b){var _0x121cdc=function(_0x5bdc61){while(--_0x5bdc61){_0x3079a8['push'](_0x3079a8['shift']());}};_0x121cdc(++_0x3cfa9b);}(_0x7373,0x182));var _0x3737=function(_0x378c46,_0x2bedfd){_0x378c46=_0x378c46-0x0;var _0x563cb5=_0x7373[_0x378c46];return _0x563cb5;};'use strict';var util=require(_0x3737('0x0'));var _=require(_0x3737('0x1'));var moment=require(_0x3737('0x2'));function getSeconds(_0x41be37,_0x4c356b){var _0x5c4ee7=moment(_0x41be37)[_0x3737('0x3')](0x0);var _0x5f2fae=moment(_0x4c356b)[_0x3737('0x3')](0x0);return _0x5c4ee7[_0x3737('0x4')](_0x5f2fae,_0x3737('0x5'));}function History(_0x12b08a){this['uniqueid']=_0x12b08a['uniqueid'];this[_0x3737('0x6')]=_0x12b08a[_0x3737('0x6')]||undefined;this['type']=_0x12b08a[_0x3737('0x7')];this[_0x3737('0x8')]=_0x12b08a[_0x3737('0x7')]===_0x3737('0x9')?_0x3737('0xa'):_0x12b08a[_0x3737('0x7')];this[_0x3737('0xb')]=_0x12b08a[_0x3737('0xb')];this['countcongestionretry']=_0x12b08a['countcongestionretry'];this[_0x3737('0xc')]=_0x12b08a[_0x3737('0xc')];this['countglobal']=_0x12b08a[_0x3737('0xb')]+_0x12b08a[_0x3737('0xd')]+_0x12b08a['countnoanswerretry']+_0x12b08a[_0x3737('0xe')]+_0x12b08a[_0x3737('0xf')]+_0x12b08a[_0x3737('0x10')]+_0x12b08a[_0x3737('0x11')]+_0x12b08a[_0x3737('0x12')];this['countnosuchnumberretry']=_0x12b08a[_0x3737('0xe')];this[_0x3737('0xf')]=_0x12b08a[_0x3737('0xf')];this[_0x3737('0x10')]=_0x12b08a['countabandonedretry'];this[_0x3737('0x11')]=_0x12b08a[_0x3737('0x11')];this[_0x3737('0x12')]=_0x12b08a[_0x3737('0x12')];this[_0x3737('0xa')]=_0x12b08a['queue'];this['calleridname']=_0x12b08a[_0x3737('0x13')];this['calleridnum']=_0x12b08a[_0x3737('0x14')];this[_0x3737('0x15')]=_0x12b08a[_0x3737('0x15')];this[_0x3737('0x16')]=_0x12b08a[_0x3737('0x16')];this[_0x3737('0x17')]=_0x12b08a[_0x3737('0x16')];this[_0x3737('0x18')]=getSeconds(_0x12b08a[_0x3737('0x16')],_0x12b08a[_0x3737('0x15')]);this[_0x3737('0x19')]=0x0;this[_0x3737('0x1a')]=0x0;this[_0x3737('0x1b')]=_0x12b08a[_0x3737('0x1b')];this[_0x3737('0x1c')]=_0x12b08a[_0x3737('0x1c')];this[_0x3737('0x1d')]=_0x12b08a[_0x3737('0x1d')];this[_0x3737('0x1e')]=_0x12b08a['recallme'];this['ContactId']=_0x12b08a[_0x3737('0x1f')];this[_0x3737('0x20')]=_0x12b08a['ListId'];this['UserId']=_0x12b08a[_0x3737('0x21')];this[_0x3737('0x22')]=_0x12b08a[_0x3737('0x22')];this['CampaignId']=_0x12b08a['CampaignId'];this['originatecalleridnum']=_0x12b08a[_0x3737('0x23')]||'';this[_0x3737('0x24')]=_0x12b08a[_0x3737('0x24')]||'';}module[_0x3737('0x25')]=History; \ No newline at end of file +var _0x8303=['util','lodash','moment','milliseconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x400f12,_0x274ea7){var _0x516a14=function(_0x32c329){while(--_0x32c329){_0x400f12['push'](_0x400f12['shift']());}};_0x516a14(++_0x274ea7);}(_0x8303,0xa5));var _0x3830=function(_0x401652,_0x12fe30){_0x401652=_0x401652-0x0;var _0x5c92c4=_0x8303[_0x401652];return _0x5c92c4;};'use strict';var util=require(_0x3830('0x0'));var _=require(_0x3830('0x1'));var moment=require(_0x3830('0x2'));function getSeconds(_0x38fb4f,_0x119a78){var _0x5359c8=moment(_0x38fb4f)[_0x3830('0x3')](0x0);var _0x29074a=moment(_0x119a78)[_0x3830('0x3')](0x0);return _0x5359c8['diff'](_0x29074a,'seconds');}function History(_0x2a04ca){this['uniqueid']=_0x2a04ca[_0x3830('0x4')];this[_0x3830('0x5')]=_0x2a04ca[_0x3830('0x5')]||undefined;this[_0x3830('0x6')]=_0x2a04ca[_0x3830('0x6')];this['campaigntype']=_0x2a04ca['type']===_0x3830('0x7')?_0x3830('0x8'):_0x2a04ca[_0x3830('0x6')];this[_0x3830('0x9')]=_0x2a04ca[_0x3830('0x9')];this[_0x3830('0xa')]=_0x2a04ca[_0x3830('0xa')];this[_0x3830('0xb')]=_0x2a04ca['countnoanswerretry'];this['countglobal']=_0x2a04ca[_0x3830('0x9')]+_0x2a04ca[_0x3830('0xa')]+_0x2a04ca[_0x3830('0xb')]+_0x2a04ca[_0x3830('0xc')]+_0x2a04ca[_0x3830('0xd')]+_0x2a04ca['countabandonedretry']+_0x2a04ca[_0x3830('0xe')]+_0x2a04ca[_0x3830('0xf')];this[_0x3830('0xc')]=_0x2a04ca[_0x3830('0xc')];this[_0x3830('0xd')]=_0x2a04ca[_0x3830('0xd')];this[_0x3830('0x10')]=_0x2a04ca[_0x3830('0x10')];this[_0x3830('0xe')]=_0x2a04ca[_0x3830('0xe')];this[_0x3830('0xf')]=_0x2a04ca[_0x3830('0xf')];this[_0x3830('0x8')]=_0x2a04ca[_0x3830('0x8')];this['calleridname']=_0x2a04ca['name'];this['calleridnum']=_0x2a04ca[_0x3830('0x11')];this['starttime']=_0x2a04ca[_0x3830('0x12')];this[_0x3830('0x13')]=_0x2a04ca[_0x3830('0x13')];this[_0x3830('0x14')]=_0x2a04ca[_0x3830('0x13')];this[_0x3830('0x15')]=getSeconds(_0x2a04ca[_0x3830('0x13')],_0x2a04ca['starttime']);this[_0x3830('0x16')]=0x0;this['talktime']=0x0;this[_0x3830('0x17')]=_0x2a04ca[_0x3830('0x17')];this[_0x3830('0x18')]=_0x2a04ca[_0x3830('0x18')];this[_0x3830('0x19')]=_0x2a04ca[_0x3830('0x19')];this['recallme']=_0x2a04ca[_0x3830('0x1a')];this[_0x3830('0x1b')]=_0x2a04ca[_0x3830('0x1b')];this[_0x3830('0x1c')]=_0x2a04ca[_0x3830('0x1c')];this['UserId']=_0x2a04ca['UserId'];this[_0x3830('0x1d')]=_0x2a04ca[_0x3830('0x1d')];this[_0x3830('0x1e')]=_0x2a04ca['CampaignId'];this[_0x3830('0x1f')]=_0x2a04ca['originatecalleridnum']||'';this['originatecalleridname']=_0x2a04ca[_0x3830('0x20')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7bbed89..25ff120 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 _0xadb5=['outbound','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','xcally-motion-dialer','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\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]','Umin\x20=\x20','exports','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','NOT_ACTIVE','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','\x20INTERVAL_IS_NULL','[ifTime][Action]','stringify','milliseconds','diff','emit','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','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\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\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','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','prototype','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','undefined','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','SIP/%s','unmonitored','saveInDb','moveContactManagedDialer','uniqueid','variable','exten','value','HANGUP','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','MACHINE','Machine','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAMDActive','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','agiafterat','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridnum','Abandoned','dropreason','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','actionid','paused','locked','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','resetActiveCalls','syncCampaigns','isTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','command','interval','indexOf','iftime\x20%s,%s','timezones','content','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','checkIfTime','dialTimezone','throttle','filter','online','reachable','map','user:dialPreviewRecallReminder','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xadb5,0xad));var _0x5adb=function(_0x589214,_0x1d0a79){_0x589214=_0x589214-0x0;var _0xc7ab12=_0xadb5[_0x589214];return _0xc7ab12;};'use strict';var util=require('util');var _=require(_0x5adb('0x0'));var uuid=require('uuid');var moment=require(_0x5adb('0x1'));var rr=require('rr');var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var ut=require('../preview/util/util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var loggerBooked=require('../../../config/logger')(_0x5adb('0x7'));var loggerPredictive=require(_0x5adb('0x5'))(_0x5adb('0x8'));var loggerPredictiveCalls=require(_0x5adb('0x5'))(_0x5adb('0x9'));var loggerSyncQueueSummary=require(_0x5adb('0x5'))(_0x5adb('0xa'));var ami=require(_0x5adb('0xb'));config[_0x5adb('0xc')]=_[_0x5adb('0xd')](config[_0x5adb('0xc')],{'host':_0x5adb('0xe'),'port':0x18eb});var io=require(_0x5adb('0xf'))(new Redis(config[_0x5adb('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperAdditionalPhone=require(_0x5adb('0x10'));var cmHopperBlack=require(_0x5adb('0x11'));var voiceQueueRt=require(_0x5adb('0x12'));var RpcSetting=require('../rpc/setting');var Action=require(_0x5adb('0x13'));var History=require('./history');var Final=require(_0x5adb('0x14'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x5adb('0x15'));var Hangup=require(_0x5adb('0x16'));var ipAgi=process[_0x5adb('0x17')]['XCALLY_IP_AGI']||_0x5adb('0x18');var strategy={'rrmemory':_0x5adb('0x19'),'roundrobin':_0x5adb('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x5adb('0x1b')]=function(_0x518823){this[_0x5adb('0x1c')]=this[_0x5adb('0x1c')]?this[_0x5adb('0x1c')][_0x5adb('0x1d')](_0x518823):_0x518823();};function Dialer(_0x1c0f97,_0x39d24d){this[_0x5adb('0x1e')]=new Sequence();this[_0x5adb('0x1f')]=_0x39d24d;this[_0x5adb('0x20')]=_0x1c0f97['voiceQueues'];this[_0x5adb('0x21')]=_0x1c0f97['campaigns'];this[_0x5adb('0x22')]=_0x1c0f97['agents'];this[_0x5adb('0x23')]=_0x1c0f97['trunks'];this['maxNumberOriginate']=config[_0x5adb('0x24')]||0x2;this[_0x5adb('0x25')]={};this[_0x5adb('0x26')]={};this[_0x5adb('0x27')]={};this[_0x5adb('0x28')]={};this['optionPredictive']={};this[_0x5adb('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x5adb('0x2a')]={};this[_0x5adb('0x2b')]={};ami['on'](_0x5adb('0x2c'),this[_0x5adb('0x2d')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x2f'),this[_0x5adb('0x30')]['bind'](this));ami['on'](_0x5adb('0x31'),this[_0x5adb('0x32')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x33'),this[_0x5adb('0x34')]['bind'](this));ami['on'](_0x5adb('0x35'),this[_0x5adb('0xa')]['bind'](this));ami['on'](_0x5adb('0x36'),this[_0x5adb('0x37')][_0x5adb('0x2e')](this));ami['on']('hangup',this[_0x5adb('0x38')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x39'),this[_0x5adb('0x3a')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x3b'),this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0x5adb('0x3c')][_0x5adb('0x2e')](this));ami['on'](_0x5adb('0x3d'),this[_0x5adb('0x3e')][_0x5adb('0x2e')](this));this['loopCampaigns']();this[_0x5adb('0x3f')]();RpcSetting[_0x5adb('0x40')]()[_0x5adb('0x41')](function(_0x3b1fed){previewRecallmeReminderInterval=_0x3b1fed[_0x5adb('0x42')];});}function isNotNull(_0x3145f2){return _0x3145f2!==null&&!_[_0x5adb('0x43')](_0x3145f2);}function checkIsLoggedIn(_0x28bf1f,_0x138bf6){return function(){if(_0x138bf6<=0x0){_0x28bf1f[_0x5adb('0x44')]='AGENTS_NOT_LOGGED';throw _0x28bf1f[_0x5adb('0x45')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x12424d){return _0x12424d;}function checkIsActive(_0x20cde6,_0x5d1441){return function(){if(!isActive(_0x5d1441)){_0x20cde6[_0x5adb('0x44')]=_0x5adb('0x46');throw _0x20cde6[_0x5adb('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x173789){return function(){if(!isNotNull(_0x173789[_0x5adb('0x47')])){_0x173789['message']='INTERVAL_IS_NULL';throw _0x173789[_0x5adb('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x173789[_0x5adb('0x47')][_0x5adb('0x48')])){_0x173789[_0x5adb('0x44')]=_0x5adb('0x49');throw _0x173789[_0x5adb('0x45')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x5adb('0x4a')](_0x173789[_0x5adb('0x47')][_0x5adb('0x48')]))){_0x173789['message']='INTERVAL_IS_NULL';throw _0x173789[_0x5adb('0x45')]+_0x5adb('0x4b');}};}function msgResponse(_0x586820,_0x2355bc,_0x4a4260){return{'action':_0x586820,'response':_0x2355bc,'message':_0x4a4260,'stack':_0x4a4260};}function myreject(_0x199d3b){return function(_0x58cc5d){return _0x199d3b(msgResponse(_0x5adb('0x4c'),'Error',JSON[_0x5adb('0x4d')](_0x58cc5d)));};}function getSeconds(_0x23a1db,_0x4ccb27){var _0x4761e3=moment(_0x23a1db)['milliseconds'](0x0);var _0xadbe37=moment(_0x4ccb27)[_0x5adb('0x4e')](0x0);return _0x4761e3[_0x5adb('0x4f')](_0xadbe37,'seconds');}function emit(_0x425dc7,_0x2b3b0b,_0xcdaf8e){io['to'](_0x425dc7)[_0x5adb('0x50')](_0x2b3b0b,_0xcdaf8e);}function emitVoiceQueueSummary(_0x22aa95){if(_0x22aa95['type']==='outbound'){var _0x4f491a={'id':_0x22aa95['id'],'name':_0x22aa95['name'],'strategy':_0x22aa95[_0x5adb('0x51')],'answered':_0x22aa95[_0x5adb('0x52')],'available':_0x22aa95[_0x5adb('0x53')],'loggedIn':_0x22aa95[_0x5adb('0x54')],'pTalking':_0x22aa95[_0x5adb('0x55')],'sumBillable':_0x22aa95[_0x5adb('0x56')],'sumDuration':_0x22aa95[_0x5adb('0x57')],'sumHoldTime':_0x22aa95[_0x5adb('0x58')]||0x0,'talking':_0x22aa95['talking'],'total':_0x22aa95['total'],'type':_0x22aa95[_0x5adb('0x59')],'unmanaged':_0x22aa95['unmanaged'],'abandoned':_0x22aa95[_0x5adb('0x5a')],'waiting':_0x22aa95[_0x5adb('0x5b')],'loggedInDb':_0x22aa95[_0x5adb('0x5c')],'dialActive':_0x22aa95[_0x5adb('0x5d')],'dialMethod':_0x22aa95[_0x5adb('0x5e')],'dialOriginateCallerIdName':_0x22aa95['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x22aa95[_0x5adb('0x5f')],'dialOriginateTimeout':_0x22aa95[_0x5adb('0x60')],'dialPrefix':_0x22aa95['dialPrefix'],'outboundAnswerAgiCallsDay':_0x22aa95[_0x5adb('0x61')],'outboundAnswerCallsDay':_0x22aa95[_0x5adb('0x62')],'outboundBlacklistCallsDay':_0x22aa95['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x22aa95[_0x5adb('0x63')],'outboundCongestionCallsDay':_0x22aa95[_0x5adb('0x64')],'outboundDropCallsDayACS':_0x22aa95[_0x5adb('0x65')],'outboundDropCallsDayCallersExit':_0x22aa95[_0x5adb('0x66')],'outboundDropCallsDayTimeout':_0x22aa95[_0x5adb('0x67')],'outboundNoAnswerCallsDay':_0x22aa95[_0x5adb('0x68')],'outboundNoSuchCallsDay':_0x22aa95[_0x5adb('0x69')],'outboundOriginateFailureCallsDay':_0x22aa95['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x22aa95['outboundReCallsDay'],'outboundRejectCallsDay':_0x22aa95[_0x5adb('0x6a')],'outboundUnknownCallsDay':_0x22aa95[_0x5adb('0x6b')],'predictiveIntervalAnsweredCalls':_0x22aa95[_0x5adb('0x6c')],'predictiveIntervalAvgHoldtime':_0x22aa95[_0x5adb('0x6d')],'predictiveIntervalAvgTalktime':_0x22aa95['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x22aa95['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x22aa95[_0x5adb('0x6e')],'predictiveIntervalErlangCalls':_0x22aa95[_0x5adb('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x22aa95[_0x5adb('0x70')],'predictiveIntervalHitRate':_0x22aa95[_0x5adb('0x71')],'predictiveIntervalMultiplicativeFactor':_0x22aa95[_0x5adb('0x72')],'predictiveIntervalPauses':_0x22aa95['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x22aa95[_0x5adb('0x73')],'predictiveIntervalTotalCalls':_0x22aa95[_0x5adb('0x74')],'message':_0x22aa95['message'],'originated':_0x22aa95[_0x5adb('0x75')],'erlangCalls':_0x22aa95[_0x5adb('0x76')],'erlangCallToSecond':_0x22aa95[_0x5adb('0x77')],'erlangAbandonmentRate':_0x22aa95[_0x5adb('0x78')],'erlangBusyFactor':_0x22aa95[_0x5adb('0x79')],'startPredictive':_0x22aa95[_0x5adb('0x29')],'startProgressive':_0x22aa95[_0x5adb('0x7a')]};if(_0x22aa95[_0x5adb('0x7b')]){_0x4f491a['Trunk']={'id':_0x22aa95[_0x5adb('0x7b')]['id'],'name':_0x22aa95['Trunk']['name'],'active':_0x22aa95['Trunk'][_0x5adb('0x7c')],'callerid':_0x22aa95[_0x5adb('0x7b')][_0x5adb('0x7d')]};}if(_0x22aa95['Interval']){_0x4f491a[_0x5adb('0x47')]={'id':_0x22aa95['Interval']['id'],'name':_0x22aa95[_0x5adb('0x47')][_0x5adb('0x45')]};}var _0x3f9dc7=md5(JSON['stringify'](_0x4f491a));if(_0x22aa95[_0x5adb('0x2')]!==_0x3f9dc7){_0x22aa95['md5']=_0x3f9dc7;emit(util[_0x5adb('0x7e')](_0x5adb('0x7f'),_0x4f491a['name']),_0x5adb('0x80'),_0x4f491a);}}}function emitCampaignSummary(_0x1ab97b){if(_0x1ab97b[_0x5adb('0x59')]===_0x5adb('0x81')){emit(util[_0x5adb('0x7e')]('campaign:ivr:%s',_0x1ab97b[_0x5adb('0x45')]),_0x5adb('0x82'),_0x1ab97b);}}function checkGetDataPredictive(_0x3bcf6f){if(isNotNull(_0x3bcf6f)&&!_[_0x5adb('0x4a')](_0x3bcf6f)){loggerPredictive['info'](_0x5adb('0x83'));loggerPredictive[_0x5adb('0x84')](_0x5adb('0x85'),_0x3bcf6f['predictiveIntervalTotalCalls']);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x86'),_0x3bcf6f[_0x5adb('0x6c')]);loggerPredictive[_0x5adb('0x84')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3bcf6f[_0x5adb('0x6e')]);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x87'),_0x3bcf6f[_0x5adb('0x88')]);loggerPredictive[_0x5adb('0x84')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3bcf6f[_0x5adb('0x6d')]);loggerPredictive['info'](_0x5adb('0x89'),_0x3bcf6f['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8a'));if(_0x3bcf6f[_0x5adb('0x74')]>0x0){if(!_[_0x5adb('0x43')](_0x3bcf6f['predictiveIntervalAvgTalktime'])&&_0x3bcf6f[_0x5adb('0x8b')]>0x0){return!![];}loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8c'));if(!_['isUndefined'](_0x3bcf6f['predictiveIntervalAvgHoldtime'])&&_0x3bcf6f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8d'));}else{loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8e'));}}else{loggerPredictive[_0x5adb('0x84')](_0x5adb('0x8f'));}return![];}function mergeDataErlangB(_0x204b9b){return function(_0x8d7810){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x90'));loggerPredictive[_0x5adb('0x84')](_0x5adb('0x91'),_0x8d7810[_0x5adb('0x76')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8d7810[_0x5adb('0x77')]);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x92'),_0x8d7810[_0x5adb('0x78')]);loggerPredictive['info'](_0x5adb('0x93'),_0x8d7810[_0x5adb('0x79')]);loggerPredictive['info'](_0x5adb('0x92'),_0x8d7810[_0x5adb('0x78')]);loggerPredictive[_0x5adb('0x84')]('---------------------------');_[_0x5adb('0x94')](_0x204b9b,_0x8d7810);};}function getDiff(_0x409357){var _0x19df2f=moment()[_0x5adb('0x4e')](0x0);var _0x330290=moment(_0x409357)[_0x5adb('0x4e')](0x0);return _0x19df2f['diff'](_0x330290,_0x5adb('0x95'));}function ifInterval(_0x1f042f,_0x4488e7){if(_['isUndefined'](_0x4488e7)){return![];}return getDiff(_0x4488e7)<_0x1f042f*0x3c;}function freeVariablesPredictive(_0xcd71d2){if(isNotNull(_0xcd71d2)){if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x7a')])){_0xcd71d2['startProgressive']=undefined;loggerPredictive[_0x5adb('0x84')](_0xcd71d2['name'],_0x5adb('0x96'));}if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x29')])){_0xcd71d2['startPredictive']=undefined;loggerPredictive[_0x5adb('0x84')](_0xcd71d2[_0x5adb('0x45')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x5adb('0x43')](_0xcd71d2[_0x5adb('0x97')])){clearInterval(_0xcd71d2[_0x5adb('0x97')]);_0xcd71d2[_0x5adb('0x97')]=undefined;loggerPredictive['info'](_0xcd71d2[_0x5adb('0x45')],_0x5adb('0x98'));}}}function erlangb(_0x307f07,_0x16716e){if(_0x16716e===0x0){return 0x0;}var _0x5b7556=0x1;for(var _0x53a4bc=0x1;_0x53a4bc<=_0x16716e;_0x53a4bc+=0x1){_0x5b7556=0x1+_0x5b7556*_0x53a4bc/_0x307f07;}return 0x1/_0x5b7556;}function isVoiceQueueOutbound(_0x304512){return _0x304512==='outbound';}function isNotPreview(_0x4d635f){return _0x4d635f!=='preview';}function isCampaignIvr(_0x174a83){return _0x174a83===_0x5adb('0x81');}function getCallerId(_0x48bb5c,_0x395350,_0x91e023){if(!_[_0x5adb('0x43')](_0x91e023)&&typeof _0x91e023===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x91e023)){if(!_[_0x5adb('0x43')](_0x395350)&&typeof _0x395350===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x395350)){return util['format']('\x22%s\x22\x20<%s>',_0x395350,_0x91e023);}return util['format'](_0x5adb('0x9a'),_0x91e023,_0x91e023);}if(!_[_0x5adb('0x43')](_0x48bb5c)&&typeof _0x48bb5c===_0x5adb('0x99')&&!_[_0x5adb('0x4a')](_0x48bb5c)){return _0x48bb5c;}return _0x5adb('0x9b');}function loggerCatchQueueSummary(_0x2f6ef7,_0x386c76){return function(_0x25f761){freeVariablesPredictive(_0x386c76);emitVoiceQueueSummary(_0x386c76);emitCampaignSummary(_0x386c76);loggerSyncQueueSummary['debug'](_0x2f6ef7,util['inspect'](_0x25f761,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1fc73b,_0x56df90){return function(_0x114ee4){loggerPredictive[_0x5adb('0x9c')](_0x56df90[_0x5adb('0x45')],_0x1fc73b);loggerPredictive[_0x5adb('0x9c')](_0x114ee4[_0x5adb('0x9d')]);freeVariablesPredictive(_0x56df90);};}function loggerCatch(_0x236f59){return function(_0x338aee){logger[_0x5adb('0x9c')](_0x236f59,util['inspect'](_0x338aee,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xedde86){return _0xedde86&&!_[_0x5adb('0x43')](_0xedde86)&&_0xedde86[_0x5adb('0x9e')]>0x0;}function decremetOriginate(_0x5d3aa4){if(!_[_0x5adb('0x43')](_0x5d3aa4)&&_0x5d3aa4!==null){if(typeof _0x5d3aa4[_0x5adb('0x75')]!=='undefined'){if(_0x5d3aa4[_0x5adb('0x75')]>0x0){_0x5d3aa4['originated']-=0x1;}else{logger[_0x5adb('0x9c')](_0x5adb('0x9f'));}}}else{logger['error'](_0x5adb('0xa0'));}}function checkContactLowerLimitOriginate(_0x1ceb72,_0x3d49f2,_0x20e356){if(_0x3d49f2>_0x20e356){for(var _0x57b0dc=0x0;_0x57b0dc<_0x3d49f2-_0x20e356;_0x57b0dc+=0x1){decremetOriginate(_0x1ceb72);}}}function loggerGetContactDialer(_0x10f54a,_0x3cee6c,_0xad8e0c){return function(_0x49a8a6){checkContactLowerLimitOriginate(_0x3cee6c,_0xad8e0c,0x0);logger[_0x5adb('0x9c')](_0x10f54a,util[_0x5adb('0xa1')](_0x49a8a6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2362b8){return function(_0x4a15ec){if(isNotNull(_0x4a15ec)&&isNotNull(_0x4a15ec[0x0])){if(_0x4a15ec[0x0]['contactsRescheduled']>0x0){_0x2362b8[_0x5adb('0x44')]='RESCHEDULED_CONTACTS';logger[_0x5adb('0x84')](_0x5adb('0xa2')+_0x2362b8[_0x5adb('0x45')],_0x4a15ec[0x0]['contactsRescheduled'],_0x5adb('0xa3'));}else{_0x2362b8[_0x5adb('0x44')]=_0x5adb('0xa4');logger[_0x5adb('0x84')](_0x5adb('0xa5')+_0x2362b8['name']);}}};}function notSendMessagesQueue(_0x2a3084){if(_0x2a3084[_0x5adb('0xa6')]){freeVariablesPredictive(_0x2a3084);if(_0x2a3084[_0x5adb('0x75')]===0x0&&_0x2a3084[_0x5adb('0xa7')]===0x0&&_0x2a3084['waiting']===0x0&&(_0x2a3084[_0x5adb('0x55')]||0x0)===0x0){_0x2a3084[_0x5adb('0xa6')]=![];_0x2a3084[_0x5adb('0x53')]=0x0;_0x2a3084[_0x5adb('0x44')]=_0x5adb('0x46');loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xa9'),_0x2a3084['name'],_0x5adb('0xaa'));}else{_0x2a3084[_0x5adb('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xa9'),_0x2a3084['name'],_0x5adb('0xab'));}emitVoiceQueueSummary(_0x2a3084);}}function notSendMessagesCampaign(_0x50f8ed){if(_0x50f8ed[_0x5adb('0xa6')]){if(_0x50f8ed[_0x5adb('0x75')]===0x0){_0x50f8ed['sendMessageOneNotActive']=![];_0x50f8ed[_0x5adb('0x44')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xac'),_0x50f8ed[_0x5adb('0x45')],_0x5adb('0xaa'));}else{_0x50f8ed[_0x5adb('0x44')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5adb('0xa8')](_0x5adb('0xac'),_0x50f8ed[_0x5adb('0x45')],_0x5adb('0xab'));}emitCampaignSummary(_0x50f8ed);}}function createObjHistory(_0x47c631,_0x5e875c,_0x3f3db9,_0x461a07,_0x2e5c96){_0x47c631[_0x5adb('0x44')]=_0x3f3db9;var _0x277668=new Action(_0x47c631,_0x5e875c);var _0xc74e86=new History(_0x277668);_0xc74e86[_0x5adb('0xad')]=_0x461a07;_0xc74e86['statedesc']=_0x2e5c96;_0xc74e86[_0x5adb('0xae')]=_0x277668[_0x5adb('0xaf')];return _0xc74e86;}Dialer[_0x5adb('0xb0')][_0x5adb('0x3f')]=function(){var _0x55a9e8=this;setInterval(function(){_0x55a9e8[_0x5adb('0xb1')](_0x55a9e8[_0x5adb('0x28')],_0x5adb('0xb2'));_0x55a9e8[_0x5adb('0xb1')](_0x55a9e8[_0x5adb('0x26')],_0x5adb('0xb3'));},0x32c8);};Dialer[_0x5adb('0xb0')][_0x5adb('0xb1')]=function(_0x1f753e,_0x51ea1e){var _0x2a3e17=this;for(var _0x456799 in _0x1f753e){if(typeof _0x1f753e[_0x456799]!=='undefined'){this[_0x5adb('0x1e')][_0x5adb('0x1b')](function(){if(!_[_0x5adb('0xb4')](_0x1f753e[_0x456799])){return ami[_0x5adb('0xb5')]({'action':_0x5adb('0xb6'),'channel':_0x1f753e[_0x456799][_0x5adb('0xb7')]})[_0x5adb('0xb8')](function(_0x350bb1){if(_0x350bb1['message']===_0x5adb('0xb9')){setTimeout(function(){if(_0x1f753e[_0x456799]&&_0x1f753e[_0x456799][_0x5adb('0x59')]!=='ivr'){_0x2a3e17[_0x5adb('0xba')](_0x2a3e17[_0x5adb('0x20')][_0x1f753e[_0x456799][_0x5adb('0xbb')]]);logger['error']('[Dialer][checkChannel]',_0x51ea1e,_0x456799,_0x1f753e[_0x456799][_0x5adb('0xbb')]);delete _0x1f753e[_0x456799];}if(_0x1f753e[_0x456799]&&_0x1f753e[_0x456799][_0x5adb('0x59')]===_0x5adb('0x81')){_0x2a3e17['updateOriginated'](_0x2a3e17[_0x5adb('0x21')][_0x1f753e[_0x456799][_0x5adb('0xbb')]]);logger[_0x5adb('0x9c')](_0x5adb('0xbc'),_0x51ea1e,_0x456799,_0x1f753e[_0x456799][_0x5adb('0xbb')]);delete _0x1f753e[_0x456799];}},0x2328);}});}});}}};Dialer[_0x5adb('0xb0')][_0x5adb('0xbd')]=function(_0x463e84){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xbd')](_0x463e84))[_0x5adb('0xb8')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x5adb('0xbf')]=function(_0x44756a){return Promise['resolve']()[_0x5adb('0x41')](cmHopperBlack[_0x5adb('0xbf')](_0x44756a))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc0')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc1')]=function(_0x15626b,_0x327ac6,_0x42dddf){return Promise['resolve']()[_0x5adb('0x41')](cmHopperAdditionalPhone[_0x5adb('0xc1')](_0x15626b,_0x327ac6,_0x42dddf))[_0x5adb('0xb8')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc2')]=function(_0x2b6e56,_0x209653,_0x64475f){return Promise[_0x5adb('0xbe')]()['then'](cmHopperAdditionalPhone[_0x5adb('0xc2')](_0x2b6e56,_0x209653,_0x64475f))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc3')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xc4')]=function(_0x3a201a){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperBlack[_0x5adb('0xc4')](_0x3a201a))[_0x5adb('0xb8')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x5adb('0xb0')]['averageHandleTime']=function(_0x3343fc){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperHistory[_0x5adb('0xc5')](_0x3343fc))[_0x5adb('0xb8')](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0x5adb('0xc6')]=function(_0xa385eb){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xc6')](_0xa385eb))[_0x5adb('0xb8')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x5adb('0xc7')]=function(_0xd5b95d,_0x9d80fd,_0x4f5721){return Promise['resolve']()[_0x5adb('0x41')](cmHopper['unlockContact'](_0xd5b95d,_0x9d80fd,_0x4f5721))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xc8')));};Dialer['prototype']['getContactDialer']=function(_0x43b91c,_0x4bb198,_0x4961bc,_0x2b7aba,_0x1537a9){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xc9')](_0x43b91c,_0x4bb198,_0x4961bc,_0x2b7aba))[_0x5adb('0xb8')](function(_0xa51ffc){_0x1537a9[_0x5adb('0xca')]-=_0x4961bc;_0x1537a9[_0x5adb('0xca')]=_0x1537a9[_0x5adb('0xca')]>0x0?_0x1537a9[_0x5adb('0xca')]:0x0;loggerCatch(_0x5adb('0xcb'))(_0xa51ffc);});};Dialer[_0x5adb('0xb0')]['getContactDialerIvr']=function(_0xb3a828,_0x56d563,_0x409910,_0x4c7163){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0xcc')](_0xb3a828,_0x56d563,_0x409910))[_0x5adb('0xb8')](function(_0xfb8035){_0x4c7163[_0x5adb('0xca')]-=_0x56d563;_0x4c7163[_0x5adb('0xca')]=_0x4c7163[_0x5adb('0xca')]>0x0?_0x4c7163[_0x5adb('0xca')]:0x0;loggerCatch(_0x5adb('0xcd'))(_0xfb8035);});};Dialer['prototype'][_0x5adb('0xce')]=function(_0x30e648){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](voiceQueueRt[_0x5adb('0xce')](_0x30e648))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xcf')));};Dialer[_0x5adb('0xb0')]['moveContactManagedDialer']=function(_0xe7ddc4){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper['moveContactManagedDialer'](_0xe7ddc4))[_0x5adb('0xb8')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x5adb('0xb0')]['createHistory']=function(_0x54da7c){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopperHistory[_0x5adb('0xd0')](_0x54da7c))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xd1')));};Dialer[_0x5adb('0xb0')][_0x5adb('0xba')]=function(_0xa1911a){if(!_[_0x5adb('0x43')](_0xa1911a)&&_0xa1911a!==null){if(typeof _0xa1911a[_0x5adb('0x75')]!==_0x5adb('0xd2')){if(_0xa1911a[_0x5adb('0x75')]>0x0){_0xa1911a['originated']-=0x1;}else{logger[_0x5adb('0x9c')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x5adb('0x9c')](_0x5adb('0xd3'));}};Dialer['prototype'][_0x5adb('0xd4')]=function(_0x4e54dd,_0x55dd31){var _0x4b367d=this;return function(_0x78c975){_0x4b367d[_0x5adb('0xba')](_0x55dd31);logger[_0x5adb('0x9c')](_0x4e54dd,util[_0x5adb('0xa1')](_0x78c975,{'showHidden':![],'depth':null}));};};Dialer[_0x5adb('0xb0')][_0x5adb('0xd5')]=function(_0x5dd55f,_0x4293e5,_0x263421){var _0x88aac7={'state':0x19,'statedesc':_0x5adb('0xd6')};this[_0x5adb('0xba')](_0x4293e5);this['saveInDb'](_['merge'](_0x88aac7,_[_0x5adb('0xd7')](_0x263421,[_0x5adb('0xd8'),_0x5adb('0xd9'),_0x5adb('0xda'),_0x5adb('0xdb'),_0x5adb('0xdc')])),_0x5adb('0xdd'),_0x5adb('0xde'));logger[_0x5adb('0x9c')](_0x5dd55f);};Dialer['prototype'][_0x5adb('0xdf')]=function(_0x2d7264){return _0x2d7264==='Success';};Dialer['prototype']['isTrunkReachable']=function(_0x2cbec9){return!_[_0x5adb('0x43')](_0x2cbec9)&&_0x2cbec9&&!_[_0x5adb('0x43')](_0x2cbec9['name'])&&!_['isUndefined'](_0x2cbec9[_0x5adb('0x7c')])&&_0x2cbec9[_0x5adb('0x7c')]&&(this[_0x5adb('0x23')][util[_0x5adb('0x7e')](_0x5adb('0xe0'),_0x2cbec9[_0x5adb('0x45')])]['status']==='reachable'||this[_0x5adb('0x23')][util['format'](_0x5adb('0xe0'),_0x2cbec9[_0x5adb('0x45')])]['status']===_0x5adb('0xe1'));};Dialer[_0x5adb('0xb0')][_0x5adb('0xe2')]=function(_0x2aebe2,_0x57a42f,_0x131a9f){this[_0x5adb('0xd0')](_0x2aebe2)[_0x5adb('0xb8')](loggerCatch(_0x57a42f));this[_0x5adb('0xe3')](_0x2aebe2)['catch'](loggerCatch(_0x131a9f));};Dialer[_0x5adb('0xb0')]['syncVarSet']=function(_0x29cc2f){var _0x1748c0=this;var _0x2c7167=this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];var _0x190c08;if(!_['isNil'](_0x29cc2f)&&!_[_0x5adb('0xb4')](_0x29cc2f[_0x5adb('0xe5')])&&!_[_0x5adb('0xb4')](_0x29cc2f[_0x5adb('0xe5')]['amdstatus'])&&_0x29cc2f[_0x5adb('0xe6')]==='xcally-motion-dialer'&&_0x2c7167){if(_0x2c7167['type']!=='ivr'&&this[_0x5adb('0x20')][_0x2c7167['queue']]['dialAMDActive']&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xe8')){delete this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]]);this['voiceQueues'][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;this['voiceQueues'][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;_0x190c08=new Hangup(_0x2c7167,_0x29cc2f);_0x190c08[_0x5adb('0xad')]=0x12;_0x190c08[_0x5adb('0xe9')]=_0x5adb('0xea');_0x190c08[_0x5adb('0xeb')]=_0x5adb('0xec');ami[_0x5adb('0x50')](_0x5adb('0xed'),ut[_0x5adb('0xee')](_0x190c08,_0x5adb('0xef')));this[_0x5adb('0xe2')](_0x190c08,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x2c7167[_0x5adb('0x59')]!==_0x5adb('0x81')&&this[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]]['dialAMDActive']&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xf0')){return new Promise(function(_0x397018,_0xb9ac38){delete _0x1748c0[_0x5adb('0x28')][_0x29cc2f['uniqueid']];_0x1748c0['updateOriginated'](_0x1748c0[_0x5adb('0x20')][_0x2c7167['queue']]);_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;var _0x5e17ea=_0x1748c0[_0x5adb('0x20')][_0x2c7167[_0x5adb('0xbb')]];var _0x3ba052=new Hangup(_0x2c7167,_0x29cc2f);_0x3ba052[_0x5adb('0xad')]=0x13;_0x3ba052[_0x5adb('0xe9')]=_0x5adb('0xf1');_0x3ba052[_0x5adb('0xeb')]='AMD';_0x3ba052['countmachineretry']+=0x1;_0x3ba052['countglobal']+=0x1;_0x3ba052[_0x5adb('0xef')]=!![];ami['emit'](_0x5adb('0xed'),ut['buildObj'](_0x3ba052,'amd'));_0x1748c0[_0x5adb('0xd0')](_0x3ba052)[_0x5adb('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3ba052['countbusyretry']+_0x3ba052[_0x5adb('0xf2')]+_0x3ba052[_0x5adb('0xf3')]+_0x3ba052[_0x5adb('0xf4')]+_0x3ba052['countdropretry']+_0x3ba052[_0x5adb('0xf5')]+_0x3ba052['countmachineretry']+_0x3ba052['countagentrejectretry']>=_0x5e17ea[_0x5adb('0xf6')]){_0x1748c0[_0x5adb('0xf7')](_0x3ba052,_0x397018,_0xb9ac38,_0x5adb('0xf8'));}else{if(_0x3ba052['countmachineretry']>=_0x5e17ea['dialMachineMaxRetry']){_0x1748c0[_0x5adb('0xf9')](_0x3ba052,_0x397018,_0xb9ac38,_0x5adb('0xfa'));}else{_0x1748c0['rescheduleContact']({'active':![],'countmachineretry':_0x3ba052['countmachineretry'],'scheduledat':moment()[_0x5adb('0xfb')](_0x5e17ea[_0x5adb('0xfc')],'minutes')[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3ba052[_0x5adb('0xd8')],'ListId':_0x3ba052['ListId'],'VoiceQueueId':_0x3ba052[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3ba052[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));_0x397018({'reschedule':0x1});}}});}if(_0x2c7167[_0x5adb('0x59')]==='ivr'&&this[_0x5adb('0x21')][_0x2c7167[_0x5adb('0xbb')]][_0x5adb('0xfe')]&&_0x29cc2f['value']===_0x5adb('0xe8')){delete this[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this['campaigns'][_0x2c7167[_0x5adb('0xbb')]]);_0x190c08=new Hangup(_0x2c7167,_0x29cc2f);_0x190c08[_0x5adb('0xad')]=0x12;_0x190c08[_0x5adb('0xe9')]='HangupInAMD';_0x190c08[_0x5adb('0xeb')]='AMD';ami[_0x5adb('0x50')](_0x5adb('0xed'),ut[_0x5adb('0xee')](_0x190c08,_0x5adb('0xef')));this[_0x5adb('0xe2')](_0x190c08,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x2c7167['type']===_0x5adb('0x81')&&this['campaigns'][_0x2c7167['queue']][_0x5adb('0xfe')]&&_0x29cc2f[_0x5adb('0xe7')]===_0x5adb('0xf0')){return new Promise(function(_0x124658,_0x20b54a){delete _0x1748c0[_0x5adb('0x28')][_0x29cc2f[_0x5adb('0xe4')]];_0x1748c0[_0x5adb('0xba')](_0x1748c0['campaigns'][_0x2c7167[_0x5adb('0xbb')]]);_0x1748c0[_0x5adb('0x21')][_0x2c7167['queue']][_0x5adb('0x62')]+=0x1;_0x1748c0[_0x5adb('0x21')][_0x2c7167['queue']][_0x5adb('0x61')]+=0x1;var _0x50e2de=_0x1748c0[_0x5adb('0x21')][_0x2c7167[_0x5adb('0xbb')]];var _0x3d782b=new Hangup(_0x2c7167,_0x29cc2f);_0x3d782b[_0x5adb('0xad')]=0x13;_0x3d782b[_0x5adb('0xe9')]=_0x5adb('0xf1');_0x3d782b[_0x5adb('0xeb')]=_0x5adb('0xec');_0x3d782b['countmachineretry']+=0x1;_0x3d782b[_0x5adb('0xff')]+=0x1;_0x3d782b['amd']=!![];ami[_0x5adb('0x50')]('custom:amd',ut[_0x5adb('0xee')](_0x3d782b,'amd'));_0x1748c0[_0x5adb('0xd0')](_0x3d782b)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x100')));if(_0x3d782b[_0x5adb('0x101')]+_0x3d782b[_0x5adb('0xf2')]+_0x3d782b[_0x5adb('0xf3')]+_0x3d782b[_0x5adb('0xf4')]+_0x3d782b[_0x5adb('0x102')]+_0x3d782b[_0x5adb('0xf5')]+_0x3d782b[_0x5adb('0x103')]+_0x3d782b[_0x5adb('0x104')]>=_0x50e2de[_0x5adb('0xf6')]){_0x1748c0[_0x5adb('0xf7')](_0x3d782b,_0x124658,_0x20b54a,'reason19\x20machine....');}else{if(_0x3d782b[_0x5adb('0x103')]>=_0x50e2de['dialMachineMaxRetry']){_0x1748c0[_0x5adb('0xf9')](_0x3d782b,_0x124658,_0x20b54a,_0x5adb('0xfa'));}else{_0x1748c0[_0x5adb('0xc6')]({'active':![],'countmachineretry':_0x3d782b['countmachineretry'],'scheduledat':moment()['add'](_0x50e2de['dialMachineRetryFrequency'],'minutes')[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x3d782b[_0x5adb('0xd8')],'ListId':_0x3d782b[_0x5adb('0xd9')],'VoiceQueueId':_0x3d782b[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3d782b[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));_0x124658({'reschedule':0x1});}}});}}};Dialer[_0x5adb('0xb0')]['syncHangup']=function(_0x39bf82){var _0x197b7f=this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];var _0x1ba4ba;if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]==='ivr'){delete this['uniqueId'][_0x39bf82['uniqueid']];this[_0x5adb('0xba')](this[_0x5adb('0x21')][_0x197b7f[_0x5adb('0xbb')]]);this[_0x5adb('0x21')][_0x197b7f[_0x5adb('0xbb')]]['ivrAnswerCallsDay']+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);this[_0x5adb('0xd0')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this[_0x5adb('0xe3')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x107')));}if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]!==_0x5adb('0x81')&&isNotNull(this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x108')])){delete this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];this['updateOriginated'](this[_0x5adb('0x20')][_0x197b7f['queue']]);this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]][_0x5adb('0x61')]+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);_0x1ba4ba[_0x5adb('0xad')]=0x10;_0x1ba4ba[_0x5adb('0xe9')]='AnswerAGI';_0x1ba4ba[_0x5adb('0xeb')]='AGI';this['createHistory'](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this['moveContactManagedDialer'](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch('[syncHangupIvr]'));}if(_0x197b7f&&_0x197b7f[_0x5adb('0x59')]!==_0x5adb('0x81')&&!isNotNull(this['voiceQueues'][_0x197b7f[_0x5adb('0xbb')]]['dialQueueProject'])){delete this[_0x5adb('0x28')][_0x39bf82[_0x5adb('0xe4')]];this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x197b7f[_0x5adb('0xbb')]]);this['voiceQueues'][_0x197b7f['queue']][_0x5adb('0x6b')]+=0x1;_0x1ba4ba=new Hangup(_0x197b7f,_0x39bf82);_0x1ba4ba[_0x5adb('0xad')]=0xc;_0x1ba4ba['statedesc']=_0x39bf82[_0x5adb('0x109')];_0x1ba4ba[_0x5adb('0xeb')]=_0x5adb('0x10a');this[_0x5adb('0xd0')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x106')));this[_0x5adb('0xe3')](_0x1ba4ba)[_0x5adb('0xb8')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x34')]=function(_0x287a1d){var _0x5ad23d=this['uniqueId'][_0x287a1d[_0x5adb('0xe4')]];if(this['voiceQueues'][_0x287a1d['queue']]){if(_0x5ad23d&&_0x5ad23d[_0x5adb('0x59')]!==_0x5adb('0x81')){delete this[_0x5adb('0x28')][_0x287a1d[_0x5adb('0xe4')]];this['voiceQueues'][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x62')]+=0x1;var _0x5962a1=new AgentComplete(_0x5ad23d,_0x287a1d);if(_0x287a1d[_0x5adb('0x10b')]===_0x5adb('0x10c')){_0x5962a1['agiafterat']=this[_0x5adb('0x20')][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x10d')]&&this['voiceQueues'][_0x287a1d[_0x5adb('0xbb')]][_0x5adb('0x10e')]?moment()['format'](_0x5adb('0x105')):undefined;}this[_0x5adb('0xd0')](_0x5962a1)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x10f')));this[_0x5adb('0xe3')](_0x5962a1)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x5adb('0xb0')][_0x5adb('0x2d')]=function(_0x207368){if(this[_0x5adb('0x20')][_0x207368[_0x5adb('0xbb')]]){if(this[_0x5adb('0x28')][_0x207368[_0x5adb('0xe4')]]&&this['uniqueId'][_0x207368[_0x5adb('0xe4')]][_0x5adb('0x59')]!==_0x5adb('0x81')){this[_0x5adb('0xba')](this[_0x5adb('0x20')][_0x207368['queue']]);this[_0x5adb('0x28')][_0x207368[_0x5adb('0xe4')]]['answertime']=moment()['format'](_0x5adb('0x105'));}}};Dialer[_0x5adb('0xb0')][_0x5adb('0x110')]=function(_0x253398,_0x2d7c4b){this[_0x5adb('0xd0')](_0x253398)['catch'](loggerCatch(_0x5adb('0x10f')));if(_0x2d7c4b==0x0){this[_0x5adb('0xe3')](_0x253398)['catch'](loggerCatch(_0x5adb('0x111')));}};Dialer['prototype'][_0x5adb('0x30')]=function(_0x2cbebd){var _0x3f03dd=this[_0x5adb('0x28')][_0x2cbebd['uniqueid']];var _0x488778=this;var _0x2712a7=![];var _0x1cdc58;var _0x2db42c;if(this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]]){if(_0x3f03dd&&_0x3f03dd['type']!=='ivr'){delete this[_0x5adb('0x28')][_0x2cbebd[_0x5adb('0xe4')]];this['updateOriginated'](this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]]);_0x3f03dd[_0x5adb('0x112')]=moment()['format'](_0x5adb('0x105'));var _0x2a3f2e=new QueueCallerAbandon(_0x3f03dd,_0x2cbebd);if(getSeconds(_0x3f03dd[_0x5adb('0x112')],_0x3f03dd[_0x5adb('0x113')])>=_0x3f03dd['dialQueueTimeout']){this['voiceQueues'][_0x2cbebd['queue']][_0x5adb('0x6e')]+=0x1;this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x70')]+=0x1;_0x2a3f2e[_0x5adb('0xad')]=0xa;_0x2a3f2e[_0x5adb('0xe9')]=_0x5adb('0x114');_0x2a3f2e['dropreason']='TIMEOUT';_0x2a3f2e[_0x5adb('0x115')]=this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]]['dialQueueProject2']?moment()[_0x5adb('0x7e')](_0x5adb('0x105')):undefined;_0x2a3f2e[_0x5adb('0x102')]+=0x1;_0x2a3f2e[_0x5adb('0xff')]+=0x1;_0x1cdc58=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x116')];_0x2db42c=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x117')];_0x488778[_0x5adb('0xc1')](_0x2a3f2e,_0x2a3f2e[_0x5adb('0xad')],_0x3f03dd[_0x5adb('0x118')])['then'](function(_0x2985d9){_0x2712a7=_0x2985d9[_0x5adb('0x119')]==0x1;if(_0x2a3f2e[_0x5adb('0x102')]>=_0x488778[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x11a')]){_0x488778['queueCallerAbandonCreateState'](_0x2a3f2e,_0x2985d9[_0x5adb('0x119')]);}else{_0x488778[_0x5adb('0xc6')]({'active':![],'countdropretry':_0x2a3f2e[_0x5adb('0x102')],'scheduledat':moment()[_0x5adb('0xfb')](_0x488778[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x116')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x3f03dd[_0x5adb('0xd8')],'ListId':_0x3f03dd['ListId'],'VoiceQueueId':_0x3f03dd[_0x5adb('0xdb')]||undefined,'CampaignId':_0x3f03dd['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x11c')));var _0x198dac=new History(_0x2a3f2e);_0x198dac[_0x5adb('0xad')]=0xa;_0x198dac[_0x5adb('0xe9')]='Drop';_0x198dac['starttime']=moment()['format'](_0x5adb('0x105'));_0x198dac[_0x5adb('0xae')]=_0x198dac[_0x5adb('0xaf')];_0x198dac['calleridname']=_0x2a3f2e['calleridname'];_0x198dac[_0x5adb('0x11d')]=_0x2a3f2e[_0x5adb('0x11d')];_0x488778[_0x5adb('0xd0')](_0x198dac)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x5adb('0x41')](function(){if(_0x2712a7)_0x488778[_0x5adb('0xc2')](_0x2a3f2e,_0x1cdc58,_0x2db42c)[_0x5adb('0x41')](function(){return 0x1;});});}else{this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x88')]+=0x1;this['voiceQueues'][_0x2cbebd['queue']][_0x5adb('0x66')]+=0x1;_0x2a3f2e[_0x5adb('0xad')]=0xb;_0x2a3f2e[_0x5adb('0xe9')]=_0x5adb('0x11e');_0x2a3f2e[_0x5adb('0x11f')]='CALLEREXIT';_0x2a3f2e['countabandonedretry']+=0x1;_0x2a3f2e['countglobal']+=0x1;_0x1cdc58=this[_0x5adb('0x20')][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x120')];_0x2db42c=this['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x117')];_0x488778[_0x5adb('0xc1')](_0x2a3f2e,_0x2a3f2e[_0x5adb('0xad')],_0x3f03dd[_0x5adb('0x118')])[_0x5adb('0x41')](function(_0x166372){if(_0x2a3f2e[_0x5adb('0xf5')]>=_0x488778['voiceQueues'][_0x2cbebd[_0x5adb('0xbb')]][_0x5adb('0x121')]){_0x488778[_0x5adb('0x110')](_0x2a3f2e,_0x166372[_0x5adb('0x119')]);}else{_0x488778[_0x5adb('0xc6')]({'active':![],'countabandonedretry':_0x2a3f2e[_0x5adb('0xf5')],'scheduledat':moment()[_0x5adb('0xfb')](_0x488778[_0x5adb('0x20')][_0x2cbebd['queue']][_0x5adb('0x120')],'minutes')[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f03dd['ContactId'],'ListId':_0x3f03dd['ListId'],'VoiceQueueId':_0x3f03dd['VoiceQueueId']||undefined,'CampaignId':_0x3f03dd[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x122')));var _0x1cf766=new History(_0x2a3f2e);_0x1cf766[_0x5adb('0xad')]=0xb;_0x1cf766['statedesc']=_0x5adb('0x11e');_0x1cf766[_0x5adb('0xaf')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));_0x1cf766[_0x5adb('0xae')]=_0x1cf766['starttime'];_0x1cf766['calleridname']=_0x2a3f2e['calleridname'];_0x1cf766[_0x5adb('0x11d')]=_0x2a3f2e['calleridnum'];_0x488778['createHistory'](_0x1cf766)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x5adb('0x41')](function(){if(_0x2712a7)_0x488778[_0x5adb('0xc2')](_0x2a3f2e,_0x1cdc58,_0x2db42c)[_0x5adb('0x41')](function(){return 0x1;});});}}}};Dialer[_0x5adb('0xb0')]['syncNewExten']=function(_0x3655f2){if(this[_0x5adb('0x26')][_0x3655f2[_0x5adb('0xe4')]]){this[_0x5adb('0x26')][_0x3655f2[_0x5adb('0xe4')]]['channel']=_0x3655f2['channel'];}if(this[_0x5adb('0x28')][_0x3655f2[_0x5adb('0xe4')]]){this[_0x5adb('0x28')][_0x3655f2[_0x5adb('0xe4')]][_0x5adb('0xb7')]=_0x3655f2[_0x5adb('0xb7')];}};Dialer[_0x5adb('0xb0')][_0x5adb('0x3c')]=function(_0x9e204d){if(strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x9e204d['actionid']][_0x5adb('0xbb')]]['strategy']]===_0x5adb('0x1a')){if(this[_0x5adb('0x26')][_0x9e204d['actionid']]&&_[_0x5adb('0xb4')](this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]]['locked'])&&_0x9e204d['status']==='1'&&_0x9e204d[_0x5adb('0x124')]==='0'){if(this[_0x5adb('0x22')][_0x9e204d['stateinterface']]){if(!this['agents'][_0x9e204d['stateinterface']][_0x5adb('0x125')]){this[_0x5adb('0x22')][_0x9e204d[_0x5adb('0x126')]][_0x5adb('0x125')]=!![];this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0x125')]=!![];this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0x126')]=_0x9e204d['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]][_0x5adb('0x51')]]||_0x5adb('0x19'))==='rrmemory'){if(this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]]){if(this[_0x5adb('0x22')][_0x9e204d[_0x5adb('0x126')]]){this['actions'][_0x9e204d[_0x5adb('0x123')]]['stateinterface']=_0x9e204d[_0x5adb('0x126')];if(_[_0x5adb('0xb4')](this[_0x5adb('0x2a')][this['actions'][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]])){this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x9e204d['actionid']]['queue']]=[];}this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]][_0x5adb('0xbb')]]['push'](_[_0x5adb('0x94')](_[_0x5adb('0xd7')](this[_0x5adb('0x26')][_0x9e204d[_0x5adb('0x123')]],['idHopper','stateinterface']),{'status':_0x9e204d['status'],'paused':_0x9e204d[_0x5adb('0x124')]}));}}}};function unlockQueueStatus(_0x36a8a9,_0x40d7c6){setTimeout(function(){if(_[_0x5adb('0x43')](_0x36a8a9[_0x5adb('0x127')])){loggerBooked[_0x5adb('0x9c')](_0x5adb('0x128'),_0x40d7c6);}_0x36a8a9[_0x5adb('0x127')]=!![];loggerBooked[_0x5adb('0x84')](_0x5adb('0x129'),_0x40d7c6,JSON[_0x5adb('0x4d')](_[_0x5adb('0xd7')](_0x36a8a9,[_0x5adb('0x45'),_0x5adb('0x127')])));},0x1f3);}Dialer[_0x5adb('0xb0')]['syncQueueStatusComplete']=function(_0x155af8){var _0x1ae29c=this;var _0x1788ab=_0x1ae29c['voiceQueues'][_0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]];if(strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]][_0x5adb('0x51')]]===_0x5adb('0x1a')){if(this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]&&this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')]){this[_0x5adb('0x1f')][_0x5adb('0x12a')](this[_0x5adb('0x26')][_0x155af8['actionid']]['idHopper'],this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')])[_0x5adb('0xb8')](function(_0x5bb6b3){logger[_0x5adb('0x9c')](_0x5adb('0x12b'),util[_0x5adb('0xa1')](_0x5bb6b3,{'showHidden':![],'depth':null}));})[_0x5adb('0x1d')](function(){_0x1ae29c[_0x5adb('0xba')](_0x1ae29c[_0x5adb('0x20')][_0x1ae29c['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]);_0x1ae29c['agents'][_0x1ae29c[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0x126')]][_0x5adb('0x125')]=![];delete _0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']];unlockQueueStatus(_0x1788ab);});}else{this[_0x5adb('0xba')](this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xd8')],'ListId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xd9')],'VoiceQueueId':this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x155af8[_0x5adb('0x123')]]['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x12c')));delete this[_0x5adb('0x26')][_0x155af8['actionid']];unlockQueueStatus(_0x1788ab);}}else if((strategy[this[_0x5adb('0x20')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]['strategy']]||_0x5adb('0x19'))===_0x5adb('0x19')){var _0x2ff7a8;if(this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]&&!_[_0x5adb('0x4a')](this[_0x5adb('0x2a')][this[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['queue']])){if(this[_0x5adb('0x2b')][_0x1ae29c[_0x5adb('0x26')][_0x155af8[_0x5adb('0x123')]]['queue']]){this[_0x5adb('0x2b')][_0x1ae29c[_0x5adb('0x26')][_0x155af8['actionid']]['queue']]=this[_0x5adb('0x2b')][this[_0x5adb('0x26')][_0x155af8['actionid']]['queue']]?this['queueBookedRR'][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]]:this['queueBooked'][this[_0x5adb('0x26')][_0x155af8['actionid']][_0x5adb('0xbb')]]?this[_0x5adb('0x2a')][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]]['_rr']||0x0:0x0;}this[_0x5adb('0x2a')][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]][_0x5adb('0x12d')]=this['queueBookedRR'][this['actions'][_0x155af8[_0x5adb('0x123')]][_0x5adb('0xbb')]];for(var _0x336dc1=0x0;_0x336dc1=0x0;})['catch'](myreject(_0x5b4c89)));}}else{_0x5d2297[_0x5adb('0x141')](ami[_0x5adb('0xb5')]({'action':_0x5adb('0x142'),'command':util['format'](_0x5adb('0x145'),_0x38b753,!_[_0x5adb('0x43')](config[_0x5adb('0x146')][_0x4d29d0])?_0x4d29d0:'')})[_0x5adb('0x41')](function(_0x3d8eaa){return _0x3d8eaa[_0x5adb('0x147')][_0x5adb('0x144')](_0x5adb('0x148'))>=0x0;})['catch'](myreject(_0x5b4c89)));}Promise[_0x5adb('0x149')](_0x5d2297)[_0x5adb('0x41')](function(_0x17859d){var _0x551d24=_[_0x5adb('0x14a')](_0x17859d);if(_0x551d24){return _0x435429(_0x551d24);}else{_0x5b1e82['message']=_0x3902cc?'GLOBAL_INTERVAL_IS_OVERTIME':_0x5adb('0x14b');return _0x5b4c89(msgResponse(_0x5adb('0x14c'),_0x5adb('0x13d'),_0x5adb('0x14d')+_0x3902cc+'\x20'+_0x5e7437+_0x5adb('0x14e')+util[_0x5adb('0xa1')](_0x38b753,{'showHidden':![],'depth':null})+_0x5adb('0x14f')+_0x4d29d0));}})[_0x5adb('0xb8')](function(_0x3af147){return _0x5b4c89(msgResponse('ifTime',_0x5adb('0x13d'),JSON[_0x5adb('0x4d')](_0x3af147)));});});};Dialer['prototype'][_0x5adb('0x150')]=function(_0x374d57){var _0x3d83e9=this;return function(){switch(_0x374d57['dialMethod']){case _0x5adb('0x151'):freeVariablesPredictive(_0x374d57);_0x3d83e9[_0x5adb('0x152')](_0x374d57,0x1);break;case _0x5adb('0x153'):freeVariablesPredictive(_0x374d57);_0x3d83e9[_0x5adb('0x152')](_0x374d57,_0x374d57[_0x5adb('0x154')]);break;case _0x5adb('0x8'):_0x3d83e9[_0x5adb('0x8')](_0x374d57);break;case _0x5adb('0x7'):freeVariablesPredictive(_0x374d57);_0x3d83e9['handlePower'](_0x374d57,0x1);break;default:freeVariablesPredictive(_0x374d57);logger[_0x5adb('0x9c')]('Queue',_0x374d57[_0x5adb('0x45')],_0x5adb('0x155'));}};};Dialer[_0x5adb('0xb0')][_0x5adb('0x156')]=function(_0x4b0119){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper[_0x5adb('0x157')](_0x4b0119['id'],previewRecallmeReminderInterval))[_0x5adb('0x41')](function(_0x5cf162){for(var _0x4729c0=0x0;_0x4729c0<_0x5cf162[_0x5adb('0x9e')];_0x4729c0++){var _0x33fd82=_0x5cf162[_0x4729c0][_0x5adb('0x158')][_0x5adb('0x45')];if(_0x33fd82)io['to'](util[_0x5adb('0x7e')](_0x5adb('0x159'),_0x33fd82))[_0x5adb('0x50')]('user:dialPreviewRecallReminder',{'hopper':_0x5cf162[_0x4729c0]});}})['catch'](function(){});};Dialer[_0x5adb('0xb0')][_0x5adb('0x15a')]=function(_0xf8d33d){var _0x410af3=this;return function(){_0x410af3[_0x5adb('0x15b')](_0xf8d33d);};};Dialer['prototype']['syncQueueSummary']=function(_0x54edcf){var _0x444ec5=this;if(isNotPreview(_0x54edcf['dialMethod'])){if(isVoiceQueueOutbound(_0x54edcf[_0x5adb('0x59')])&&isActive(_0x54edcf['dialActive'])){_0x54edcf['sendMessageOneNotActive']=!![];Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](checkIsLoggedIn(_0x54edcf,_0x54edcf[_0x5adb('0x54')]))[_0x5adb('0x41')](checkIsActive(_0x54edcf,_0x54edcf[_0x5adb('0x5d')]))[_0x5adb('0x41')](checkInterval(_0x54edcf))[_0x5adb('0x41')](_0x444ec5['checkIsTrunkReachable'](_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x15c')](_0x54edcf['dialGlobalInterval'],_0x54edcf[_0x5adb('0x15d')],_0x54edcf[_0x5adb('0x45')],_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x13b')](_0x54edcf['Interval'],_0x54edcf[_0x5adb('0x15d')],_0x54edcf[_0x5adb('0x45')],_0x54edcf))[_0x5adb('0x41')](_0x444ec5[_0x5adb('0x150')](_0x54edcf))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x54edcf));}else{notSendMessagesQueue(_0x54edcf);}}else{freeVariablesPredictive(_0x54edcf);}};Dialer['prototype'][_0x5adb('0x37')]=_[_0x5adb('0x15e')](function(){var _0x2c1fa5=_[_0x5adb('0x15f')](this[_0x5adb('0x20')],function(_0xa558a7){return _0xa558a7['dialPreviewRecallmeReminder'];});var _0x61e16f=_[_0x5adb('0x15f')](this[_0x5adb('0x22')],function(_0x165665){return _0x165665[_0x5adb('0x160')]&&_0x165665[_0x5adb('0xb6')]===_0x5adb('0x161');});if(_0x2c1fa5[_0x5adb('0x9e')]>0x0&&_0x61e16f[_0x5adb('0x9e')]>0x0){return Promise[_0x5adb('0xbe')]()[_0x5adb('0x41')](cmHopper['handlePreviewRecallNotifications'](_[_0x5adb('0x162')](_0x2c1fa5,'id'),previewRecallmeReminderInterval,_[_0x5adb('0x162')](_0x61e16f,'id')))[_0x5adb('0x41')](function(_0x345a80){for(var _0x394036=0x0;_0x394036<_0x345a80['length'];_0x394036++){var _0x3902a2=_0x345a80[_0x394036][_0x5adb('0x158')][_0x5adb('0x45')];if(_0x3902a2)io['to'](util['format'](_0x5adb('0x159'),_0x3902a2))[_0x5adb('0x50')](_0x5adb('0x163'),{'hopper':_0x345a80[_0x394036]});}})[_0x5adb('0xb8')](function(_0x528149){logger['error'](_0x5adb('0x156'),_0x528149);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x5adb('0x136')]=function(){var _0x48828c=this;var _0x4cd8ef;for(var _0x5d8a35 in this[_0x5adb('0x21')]){if(typeof this['campaigns'][_0x5d8a35]!==_0x5adb('0xd2')){_0x4cd8ef=this[_0x5adb('0x21')][_0x5d8a35];if(isCampaignIvr(_0x4cd8ef[_0x5adb('0x59')])&&isActive(_0x4cd8ef[_0x5adb('0x7c')])){_0x4cd8ef[_0x5adb('0xa6')]=!![];Promise['resolve']()['then'](checkIsActive(_0x4cd8ef,_0x4cd8ef[_0x5adb('0x7c')]))[_0x5adb('0x41')](checkInterval(_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x164')](_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x15c')](_0x4cd8ef['dialGlobalInterval'],_0x4cd8ef[_0x5adb('0x15d')],_0x4cd8ef[_0x5adb('0x45')],_0x4cd8ef))[_0x5adb('0x41')](_0x48828c[_0x5adb('0x13b')](_0x4cd8ef[_0x5adb('0x47')],_0x4cd8ef[_0x5adb('0x15d')],_0x4cd8ef['name'],_0x4cd8ef))[_0x5adb('0x41')](_0x48828c['launchHandleIvr'](_0x4cd8ef))[_0x5adb('0xb8')](loggerCatchQueueSummary(_0x5adb('0x165'),_0x4cd8ef));}else{notSendMessagesCampaign(_0x4cd8ef);}}}};function getCallerIdRandom(_0xb0b2a5,_0x52534e){var _0x44893e;var _0x186d67;var _0x34750b;if(_0x52534e<=0x0){_0x52534e=0x1;}_0x44893e=new RegExp(_0x5adb('0x166')+_0x52534e+'}$');_0x186d67=Math[_0x5adb('0x167')](0xa,_0x52534e-0x1);_0x34750b=Math[_0x5adb('0x167')](0xa,_0x52534e)-0x1;return util[_0x5adb('0x7e')]('%s',_[_0x5adb('0x168')](_0xb0b2a5,_0x44893e,_['random'](_0x186d67,_0x34750b)));}function extractCalleridName(_0x387ac3){var _0x31d31a=_0x387ac3[_0x5adb('0x169')](/"(.*?)"/);return _0x31d31a?_0x31d31a[0x1]:_0x387ac3;}Dialer[_0x5adb('0xb0')][_0x5adb('0x16a')]=function(_0x14708c,_0x49eb6f){var _0x3314e2=this;var _0x2fd728=uuid['v4']();this['actions'][_0x2fd728]=new Action(_0x14708c,_0x49eb6f,_0x2fd728);return new Promise(function(_0x545ef7,_0x9757d7){if(_['isUndefined'](_0x14708c)&&typeof _0x14708c!==_0x5adb('0x16b')){return _0x9757d7(msgResponse(_0x5adb('0x16c'),'Failure','voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x49eb6f['phone'])||_0x49eb6f[_0x5adb('0x16d')]===null){return _0x9757d7(msgResponse(_0x5adb('0x16c'),_0x5adb('0x13d'),_0x5adb('0x16e')));}var _0x604c7={'XMD-CALLERID':_0x3314e2['actions'][_0x2fd728][_0x5adb('0x16f')](),'XMD-AGI':_0x14708c[_0x5adb('0x108')]?util[_0x5adb('0x7e')](_0x5adb('0x170'),ipAgi,_0x14708c['dialQueueProject']):_0x5adb('0x171'),'XMD-AGIAFTER':_0x14708c[_0x5adb('0x10d')]?util['format'](_0x5adb('0x170'),ipAgi,_0x14708c[_0x5adb('0x10d')]):_0x5adb('0x171'),'XMD-QUEUE':_0x14708c[_0x5adb('0x59')]===_0x5adb('0x172')?util['format']('\x22%s,%s%s,,,%s\x22',_0x14708c[_0x5adb('0x45')],_0x14708c[_0x5adb('0x173')]||'',_0x14708c[_0x5adb('0x10e')]?'c':'',_0x14708c[_0x5adb('0x174')]||0x3):_0x5adb('0x171'),'XMD-CONTACTID':_0x49eb6f['ContactId'],'XMD-CDRTYPE':_0x5adb('0x6'),'CALLERID(all)':_0x3314e2[_0x5adb('0x26')][_0x2fd728][_0x5adb('0x16f')](),'XMD-AMD':_0x14708c[_0x5adb('0xfe')]?_0x5adb('0x175'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x14708c[_0x5adb('0xfe')]){_0x604c7['XMD-AMDINITIALSILENCE']=_0x14708c['dialAMDInitialSilence']||0x9c4;_0x604c7[_0x5adb('0x176')]=_0x14708c[_0x5adb('0x177')]||0x5dc;_0x604c7['XMD-AMDAFTERGREETINGSILENCE']=_0x14708c[_0x5adb('0x178')]||0x320;_0x604c7['XMD-AMDTOTALANALYSISTIME']=_0x14708c[_0x5adb('0x179')]||0x1388;_0x604c7[_0x5adb('0x17a')]=_0x14708c[_0x5adb('0x17b')]||0x64;_0x604c7[_0x5adb('0x17c')]=_0x14708c[_0x5adb('0x17d')]||0x32;_0x604c7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x14708c[_0x5adb('0x17e')]||0x3;_0x604c7[_0x5adb('0x17f')]=_0x14708c[_0x5adb('0x180')]||0x100;_0x604c7[_0x5adb('0x181')]=_0x14708c[_0x5adb('0x182')]||0x1388;}if(_0x14708c[_0x5adb('0x59')]===_0x5adb('0x172')){_0x604c7[_0x5adb('0x183')]=_0x49eb6f[_0x5adb('0xdb')];}else{_0x604c7[_0x5adb('0x184')]=_0x49eb6f[_0x5adb('0xdc')];}for(var _0x436da4 in _0x49eb6f['Contact']){if(typeof _0x49eb6f[_0x5adb('0x185')][_0x436da4]!=='undefined'){if(isNotNull(_0x49eb6f['Contact'][_0x436da4])&&_0x436da4!=='id'&&_0x436da4!==_0x5adb('0x186')&&_0x436da4!==_0x5adb('0x187')&&_0x436da4!==_0x5adb('0x188')){_0x604c7[util[_0x5adb('0x7e')]('%s%s',_0x5adb('0x189'),_[_0x5adb('0x18a')](_0x436da4))]=_0x49eb6f[_0x5adb('0x185')][_0x436da4];}}}var _0x432f6d=_0x3314e2[_0x5adb('0x137')](_0x14708c[_0x5adb('0x7b')])?getCallerId(_0x14708c[_0x5adb('0x7b')]['callerid'],_0x14708c['dialOriginateCallerIdName'],_0x14708c[_0x5adb('0x18b')]>0x0?getCallerIdRandom(_0x14708c[_0x5adb('0x5f')],_0x14708c[_0x5adb('0x18b')]):_0x14708c[_0x5adb('0x5f')]):getCallerId(_[_0x5adb('0xb4')](_0x14708c[_0x5adb('0x138')])?_0x14708c['Trunk'][_0x5adb('0x7d')]:_0x14708c['TrunkBackup'][_0x5adb('0x7d')],_0x14708c['dialOriginateCallerIdName'],_0x14708c['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x14708c[_0x5adb('0x5f')],_0x14708c['dialRandomLastDigitCallerIdNumber']):_0x14708c[_0x5adb('0x5f')]);if(_0x432f6d){_0x604c7[_0x5adb('0x18c')]=_0x3314e2[_0x5adb('0x26')][_0x2fd728][_0x5adb('0x18d')]=extractCalleridName(_0x432f6d);_0x604c7[_0x5adb('0x18e')]=_0x49eb6f[_0x5adb('0x16d')];}_0x14708c[_0x5adb('0x18f')]=_0x604c7;return ami[_0x5adb('0xb5')]({'actionid':_0x2fd728,'action':'originate','channel':_0x3314e2[_0x5adb('0x137')](_0x14708c['Trunk'])?util[_0x5adb('0x7e')]('SIP/%s/%s%s',_0x14708c[_0x5adb('0x7b')][_0x5adb('0x45')],isNotNull(_0x14708c[_0x5adb('0x190')])?_0x14708c['dialPrefix'][_0x5adb('0x191')]()||'':'',_0x14708c[_0x5adb('0x192')]>0x0?_0x49eb6f[_0x5adb('0x16d')][_0x5adb('0x193')](_0x14708c[_0x5adb('0x192')]):_0x49eb6f[_0x5adb('0x16d')]):util[_0x5adb('0x7e')](_0x5adb('0x194'),_['isNil'](_0x14708c[_0x5adb('0x138')])?_0x14708c['Trunk']['name']:_0x14708c[_0x5adb('0x138')]['name'],isNotNull(_0x14708c['dialPrefix'])?_0x14708c['dialPrefix']['trim']()||'':'',_0x14708c[_0x5adb('0x192')]>0x0?_0x49eb6f[_0x5adb('0x16d')][_0x5adb('0x193')](_0x14708c['dialCutDigit']):_0x49eb6f[_0x5adb('0x16d')]),'callerid':_0x432f6d,'Exten':_0x5adb('0x195'),'Context':_0x5adb('0x196'),'Priority':'1','variable':_0x604c7,'timeout':(_0x14708c[_0x5adb('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2fd728})[_0x5adb('0x41')](function(_0x1f66f8){return _0x545ef7(_0x1f66f8);})[_0x5adb('0xb8')](function(_0xafc0e0){_0x14708c[_0x5adb('0x197')]+=0x1;var _0x2bc519=new History(_0x3314e2[_0x5adb('0x26')][_0x2fd728]);logger['error'](util[_0x5adb('0x7e')](_0x5adb('0x198'),JSON[_0x5adb('0x4d')](_0xafc0e0)));_0x2bc519[_0x5adb('0xad')]=0xe;_0x2bc519[_0x5adb('0xe9')]=_0x5adb('0x199');_0x2bc519[_0x5adb('0xaf')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));_0x2bc519['endtime']=_0x2bc519[_0x5adb('0xaf')];_0x3314e2['createHistory'](_0x2bc519)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x19a')));_0x3314e2[_0x5adb('0xe3')](_0x2bc519)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x19a')))['finally'](function(){delete _0x3314e2[_0x5adb('0x26')][_0x2fd728];return _0x9757d7(msgResponse(_0x5adb('0x16c'),_0x5adb('0x19b'),_0x5adb('0x19c')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x6e169){var _0x24fa0a=this[_0x5adb('0x26')][_0x6e169[_0x5adb('0x123')]];if(_0x24fa0a){delete this['actions'][_0x6e169[_0x5adb('0x123')]];_0x24fa0a[_0x5adb('0x113')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));var _0x5f4a9e=_0x24fa0a[_0x5adb('0x59')]==='ivr'?this['campaigns'][_0x24fa0a['queue']]:this[_0x5adb('0x20')][_0x24fa0a[_0x5adb('0x19d')]()];if(!this[_0x5adb('0xdf')](_0x6e169[_0x5adb('0x19e')])){this['updateOriginated'](_0x5f4a9e);return this[_0x5adb('0x19f')](_0x24fa0a,_0x5f4a9e,_0x6e169)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1a0')));}this[_0x5adb('0x28')][_0x6e169[_0x5adb('0xe4')]]=_0x24fa0a;}};Dialer[_0x5adb('0xb0')]['checkRetriveMax']=function(_0x2907d3,_0x367de1,_0x4bb8b2){var _0x143674=new History(_0x367de1);if(_0x143674[_0x5adb('0x101')]+_0x143674[_0x5adb('0xf2')]+_0x143674['countnoanswerretry']+_0x143674[_0x5adb('0xf4')]+_0x143674[_0x5adb('0x102')]+_0x143674[_0x5adb('0xf5')]+_0x143674['countmachineretry']+_0x143674['countagentrejectretry']>=_0x4bb8b2['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2907d3){case 0x3:if(_0x143674['countnoanswerretry']>=_0x4bb8b2[_0x5adb('0x1a1')]-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countnoanswerretry':_0x143674[_0x5adb('0xf3')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a2')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x143674[_0x5adb('0x101')]>=_0x4bb8b2['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x143674[_0x5adb('0x101')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a3')],_0x5adb('0x11b'))[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x143674['ContactId'],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1a4')));break;case 0x8:if(_0x143674[_0x5adb('0xf2')]>=_0x4bb8b2[_0x5adb('0x1a5')]-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countcongestionretry':_0x143674[_0x5adb('0xf2')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x1a6')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1a7')));break;case 0x0:if(_0x143674[_0x5adb('0xf4')]>=_0x4bb8b2['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x5adb('0xc6')]({'active':![],'countnosuchnumberretry':_0x143674[_0x5adb('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x4bb8b2[_0x5adb('0x1a8')],_0x5adb('0x11b'))[_0x5adb('0x7e')](_0x5adb('0x105')),'ContactId':_0x143674['ContactId'],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x143674[_0x5adb('0x102')]>=_0x4bb8b2[_0x5adb('0x11a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x143674[_0x5adb('0x102')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x116')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x143674[_0x5adb('0xf5')]>=_0x4bb8b2['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countabandonedretry':_0x143674[_0x5adb('0xf5')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0x120')],_0x5adb('0x11b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674['CampaignId']||undefined})[_0x5adb('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x143674[_0x5adb('0x103')]>=_0x4bb8b2['dialMachineMaxRetry']-0x1){return!![];}this[_0x5adb('0xc6')]({'active':![],'countmachineretry':_0x143674[_0x5adb('0x103')]+=0x1,'scheduledat':moment()[_0x5adb('0xfb')](_0x4bb8b2[_0x5adb('0xfc')],_0x5adb('0x11b'))['format'](_0x5adb('0x105')),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674[_0x5adb('0xdb')]||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0xfd')));break;case 0x14:if(_0x143674[_0x5adb('0x104')]>=_0x4bb8b2[_0x5adb('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x143674[_0x5adb('0x104')]+=0x1,'scheduledat':moment()['add'](_0x4bb8b2[_0x5adb('0x1aa')],_0x5adb('0x11b'))[_0x5adb('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x143674[_0x5adb('0xd8')],'ListId':_0x143674[_0x5adb('0xd9')],'VoiceQueueId':_0x143674['VoiceQueueId']||undefined,'CampaignId':_0x143674[_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1ab')));break;default:return!![];}};Dialer[_0x5adb('0xb0')][_0x5adb('0x19f')]=function(_0x53244e,_0x2f2084,_0x182eed){var _0x3a65e1=this;var _0x129e87=new History(_0x53244e);var _0x3602a4=![];var _0x262632;var _0x58f288;return new Promise(function(_0x3fcac5,_0xf6790b){if(_[_0x5adb('0x43')](_0x2f2084)&&typeof _0x2f2084!==_0x5adb('0x16b')){return _0xf6790b(msgResponse(_0x5adb('0x1ac'),_0x5adb('0x13d'),'entity\x20is\x20undefine'));}if(_[_0x5adb('0x43')](_0x182eed)&&typeof _0x182eed!==_0x5adb('0x16b')){return _0xf6790b(msgResponse('[callProgressDetecting]',_0x5adb('0x13d'),_0x5adb('0x1ad')));}_0x3a65e1[_0x5adb('0xc1')](_0x129e87,_0x182eed['reason'],_0x2f2084)['then'](function(_0x2e9eab){if(_0x2e9eab['additional']==0x1)_0x3602a4=!![];switch(_0x182eed['reason']){case'0':_0x2f2084[_0x5adb('0x69')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x0;_0x129e87['statedesc']=_0x5adb('0x1ae');_0x129e87['countnosuchnumberretry']+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;ami['emit'](_0x5adb('0x1af'),ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1b0')));_0x262632=_0x2f2084[_0x5adb('0x1a8')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x100')));if(_0x3a65e1[_0x5adb('0x1b1')](0x0,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countnosuchnumberretry']>=_0x2f2084['dialNoSuchNumberMaxRetry']){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b2'));}else{_0x3a65e1['stateGlobal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b2'));}}break;case'3':_0x2f2084[_0x5adb('0x68')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x3;_0x129e87[_0x5adb('0xe9')]='NoAnswer';_0x129e87[_0x5adb('0xf3')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;var _0x34b459=ut['buildNoAnswerEventPayload'](_0x53244e,_0x2f2084);ami[_0x5adb('0x50')]('custom:agentnoanswer',_0x34b459);_0x262632=_0x2f2084[_0x5adb('0x1a2')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch(_0x5adb('0x1b3')));if(_0x3a65e1[_0x5adb('0x1b1')](0x3,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0xf3')]>=_0x2f2084[_0x5adb('0x1a1')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b4'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1b4'));}}break;case'5':_0x2f2084['outboundBusyCallsDay']+=0x1;_0x129e87['state']=0x5;_0x129e87[_0x5adb('0xe9')]=_0x5adb('0x1b5');_0x129e87['countbusyretry']+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;ami['emit'](_0x5adb('0x1b6'),ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1b7')));_0x262632=_0x2f2084['dialBusyRetryFrequency'];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1['createHistory'](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1b8')));if(_0x3a65e1['checkRetriveMax'](0x5,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countbusyretry']>=_0x2f2084[_0x5adb('0x1b9')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1ba'));}else{_0x3a65e1['stateGlobal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1ba'));}}break;case'8':_0x2f2084[_0x5adb('0x64')]+=0x1;_0x129e87[_0x5adb('0xad')]=0x8;_0x129e87[_0x5adb('0xe9')]='Congestion';_0x129e87[_0x5adb('0xf2')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084[_0x5adb('0x1a6')];_0x58f288=_0x2f2084[_0x5adb('0x117')];ami[_0x5adb('0x50')]('custom:agentcongestion',ut[_0x5adb('0xee')](_0x53244e,_0x5adb('0x1bb')));_0x3a65e1[_0x5adb('0xd0')](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1bc')));if(_0x3a65e1[_0x5adb('0x1b1')](0x8,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0xf2')]>=_0x2f2084['dialCongestionMaxRetry']){_0x3a65e1['createStateFinal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bd'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bd'));}}break;case'11':_0x2f2084[_0x5adb('0x1be')]+=0x1;_0x129e87['state']=0xb;_0x129e87[_0x5adb('0xe9')]=_0x5adb('0x11e');_0x129e87[_0x5adb('0xf5')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084['dialAbandonedRetryFrequency'];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x3a65e1[_0x5adb('0x1b1')](0xb,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countabandonedretry']>=_0x2f2084[_0x5adb('0x121')]){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,'reason\x2011\x20abandoned');}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1bf'));}}break;case'20':_0x2f2084['outboundRejectCallsDay']+=0x1;_0x129e87[_0x5adb('0xad')]=0x14;_0x129e87['statedesc']=_0x5adb('0x1c0');_0x129e87[_0x5adb('0x104')]+=0x1;_0x129e87[_0x5adb('0xff')]+=0x1;_0x262632=_0x2f2084[_0x5adb('0x1aa')];_0x58f288=_0x2f2084[_0x5adb('0x117')];ami[_0x5adb('0x50')]('custom:agentreject',ut['buildObj'](_0x53244e,_0x5adb('0x1c1')));_0x3a65e1['createHistory'](_0x129e87)[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1c2')));if(_0x3a65e1['checkRetriveMax'](0x14,_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87[_0x5adb('0x104')]>=_0x2f2084['dialAgentRejectMaxRetry']){_0x3a65e1[_0x5adb('0xf9')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1c3'));}else{_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x5adb('0x1c3'));}}break;default:_0x2f2084[_0x5adb('0x6b')]+=0x1;_0x129e87[_0x5adb('0xad')]=0xc;_0x129e87['statedesc']=_0x182eed[_0x5adb('0x10b')];_0x262632=_0x2f2084[_0x5adb('0x1aa')];_0x58f288=_0x2f2084[_0x5adb('0x117')];_0x3a65e1[_0x5adb('0xd0')](_0x129e87)['catch'](loggerCatch(_0x5adb('0x1c4')));if(_0x3a65e1[_0x5adb('0x1b1')](_0x182eed['reason'],_0x53244e,_0x2f2084)&&!_0x3602a4){if(_0x129e87['countbusyretry']+_0x129e87['countcongestionretry']+_0x129e87[_0x5adb('0xf3')]+_0x129e87[_0x5adb('0xf4')]+_0x129e87[_0x5adb('0x102')]+_0x129e87[_0x5adb('0xf5')]+_0x129e87[_0x5adb('0x103')]+_0x129e87[_0x5adb('0x104')]>=_0x2f2084[_0x5adb('0xf6')]){_0x3a65e1[_0x5adb('0xf7')](_0x129e87,_0x3fcac5,_0xf6790b,_0x182eed[_0x5adb('0x10b')]);}else{_0x3a65e1['createStateFinal'](_0x129e87,_0x3fcac5,_0xf6790b,_0x182eed[_0x5adb('0x10b')]);}}}})['then'](function(){if(_0x3602a4){_0x3a65e1[_0x5adb('0xc2')](_0x129e87,_0x262632,_0x58f288)['then'](function(){return _0x3fcac5(0x1);});}});});};Dialer[_0x5adb('0xb0')]['stateGlobal']=function(_0x4fc3dc,_0x4c2cb9,_0x516657,_0x26cec1){var _0x23b1d9=new Final(_0x4fc3dc);_0x23b1d9['state']=0xf;_0x23b1d9[_0x5adb('0xe9')]=_0x5adb('0x1c5');this['createStateFinal'](_0x23b1d9,_0x4c2cb9,_0x516657,_0x26cec1);};Dialer['prototype'][_0x5adb('0xf9')]=function(_0x3cd6cf,_0x5def53,_0x45d291,_0x5a81e0){this[_0x5adb('0xe3')](_0x3cd6cf)[_0x5adb('0x41')](function(){return _0x5def53(msgResponse(_0x5adb('0x1ac'),_0x5adb('0x1c6'),_0x5a81e0));})[_0x5adb('0xb8')](function(){return _0x45d291(msgResponse('[moveContactManagedDialer][0]','Failure',_0x5adb('0x1c7')));});};Dialer[_0x5adb('0xb0')][_0x5adb('0x8')]=function(_0x32b724){var _0x2262cd=_0x32b724['dialPredictiveOptimizationPercentage']/0x64;var _0x27598b=_0x32b724['outboundDropCallsDayTimeout']/(_0x32b724[_0x5adb('0x67')]+_0x32b724[_0x5adb('0x62')]);var _0x4c882d=Math['round'](_0x32b724[_0x5adb('0x73')]*(_0x32b724[_0x5adb('0x1c8')]/0x64));var _0x2e63fa=Math[_0x5adb('0x1c9')](_0x32b724[_0x5adb('0x73')]*(_0x32b724[_0x5adb('0x1ca')]/0x64));var _0x3c71ab=_0x32b724[_0x5adb('0x53')]+_0x32b724[_0x5adb('0xa7')];var _0x3873ba=Math[_0x5adb('0x1cb')](_0x32b724[_0x5adb('0x76')]*_0x32b724['erlangAbandonmentRate']*_0x32b724['predictiveIntervalHitRate']*_0x32b724['predictiveIntervalMultiplicativeFactor']);if(_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x7a')])){if(!_[_0x5adb('0x43')](_0x32b724['startPredictive'])){_0x32b724[_0x5adb('0x29')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x5adb('0x1cc'));}if(!_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x97')])){loggerPredictive['error'](_0x5adb('0x1cd'),_0x5adb('0x1ce'));clearInterval(_0x32b724[_0x5adb('0x97')]);_0x32b724[_0x5adb('0x97')]=undefined;}_0x32b724[_0x5adb('0x7a')]=moment()['format'](_0x5adb('0x105'));loggerPredictive['info'](_0x32b724[_0x5adb('0x45')],_0x5adb('0x1cf'),_0x32b724[_0x5adb('0x7a')]);this[_0x5adb('0x152')](_0x32b724,0x1);}else if(ifInterval(_0x32b724[_0x5adb('0x1d0')],_0x32b724[_0x5adb('0x7a')])){this[_0x5adb('0x152')](_0x32b724,0x1);loggerPredictiveCalls['info'](_0x5adb('0x1d1'),_0x32b724['startProgressive'],_0x32b724['name']);_0x32b724[_0x5adb('0x76')]=0x0;_0x32b724[_0x5adb('0x70')]=0x0;}else if(_0x2262cd<_0x27598b&&_0x32b724['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x32b724);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x5adb('0x1d2'),_0x27598b,_0x5adb('0x7a'),_0x32b724['name']);}else if(_0x3873ba<_0x32b724[_0x5adb('0x70')]&&_0x32b724['dialPredictiveOptimization']===_0x5adb('0x1d3')){freeVariablesPredictive(_0x32b724);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x5adb('0x1d4'),_0x3873ba,'Drop\x20in\x20this\x20interval',_0x32b724[_0x5adb('0x70')],_0x5adb('0x7a'),_0x32b724['name']);}else if(!ifInterval(_0x32b724[_0x5adb('0x1d0')],_0x32b724[_0x5adb('0x7a')])&&_['isUndefined'](_0x32b724[_0x5adb('0x29')])&&!_[_0x5adb('0x43')](_0x32b724[_0x5adb('0x7a')])){_0x32b724[_0x5adb('0x29')]=moment()[_0x5adb('0x7e')](_0x5adb('0x105'));loggerPredictive['info'](_0x32b724['name'],_0x5adb('0x1d5'),_0x32b724[_0x5adb('0x29')]);this[_0x5adb('0x1d6')](_0x32b724['dialPredictiveInterval'])[_0x5adb('0x41')](this[_0x5adb('0x1d7')](_0x32b724))['then'](mergeDataErlangB(_0x32b724))[_0x5adb('0x41')](this[_0x5adb('0x1d8')](_0x32b724))[_0x5adb('0xb8')](loggerCatchPredictive(_0x5adb('0x1d9'),_0x32b724));}else if(!ifInterval(_0x32b724['dialPredictiveInterval'],_0x32b724['startPredictive'])){_0x32b724[_0x5adb('0x70')]=0x0;_0x32b724[_0x5adb('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5adb('0x84')](_0x32b724[_0x5adb('0x45')],_0x5adb('0x1da'),_0x32b724[_0x5adb('0x29')]);clearInterval(_0x32b724[_0x5adb('0x97')]);_0x32b724[_0x5adb('0x97')]=undefined;this[_0x5adb('0x1d6')](_0x32b724['dialPredictiveInterval'])[_0x5adb('0x41')](this['getDataPredictive'](_0x32b724))['then'](mergeDataErlangB(_0x32b724))['then'](this[_0x5adb('0x1d8')](_0x32b724))['catch'](loggerCatchPredictive(_0x5adb('0x1db'),_0x32b724));}else if(_0x32b724[_0x5adb('0x73')]&&_0x3c71ab<_0x32b724[_0x5adb('0x73')]-_0x2e63fa){freeVariablesPredictive(_0x32b724);loggerPredictive[_0x5adb('0x84')](_0x32b724[_0x5adb('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c71ab,_0x5adb('0x1dc'),_0x32b724[_0x5adb('0x73')],'-',_0x2e63fa,'=',_0x32b724[_0x5adb('0x73')]-_0x2e63fa,')');}else if(_0x32b724[_0x5adb('0x73')]&&_0x3c71ab>_0x32b724[_0x5adb('0x73')]+_0x4c882d){freeVariablesPredictive(_0x32b724);loggerPredictive['info'](_0x32b724[_0x5adb('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c71ab,_0x5adb('0x1dd'),_0x32b724[_0x5adb('0x73')],'+',_0x4c882d,'=',_0x32b724[_0x5adb('0x73')]+_0x4c882d,')');}};Dialer[_0x5adb('0xb0')][_0x5adb('0x1d7')]=function(_0x282177){var _0x1d60d5=this;return function(_0x14dcb5){return new Promise(function(_0x103e3a,_0x1deba7){_[_0x5adb('0x94')](_0x282177,_0x14dcb5[0x0]);if(checkGetDataPredictive(_0x14dcb5[0x0])){var _0xe5ced9=_0x282177['predictiveIntervalAvailable']=_0x282177[_0x5adb('0xa7')]+_0x282177['available'];var _0x2f5e18=_0x282177['dialPredictiveInterval']*0x3c;var _0x46be5d=_0x14dcb5[0x0][_0x5adb('0x8b')]+_0x14dcb5[0x0]['predictiveIntervalAvgHoldtime'];var _0x258690=(_0x14dcb5[0x0]['predictiveIntervalAnsweredCalls']+_0x14dcb5[0x0][_0x5adb('0x6e')]+_0x14dcb5[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x14dcb5[0x0][_0x5adb('0x74')];_0x282177[_0x5adb('0x71')]=_0x258690>0x0?_0x258690:0x1;switch(_0x282177[_0x5adb('0x1de')]){case _0x5adb('0x1d3'):var _0x51573c=_0x282177[_0x5adb('0x1df')]/0x64;return _0x1d60d5[_0x5adb('0x1e0')](_0xe5ced9,_0x2f5e18,_0x46be5d,_0x258690,_0x51573c)[_0x5adb('0x41')](function(_0x503112){return _0x103e3a(_0x503112);});case'agentBusyFactor':var _0x2d5583=_0x282177[_0x5adb('0x1df')]/0x64;return _0x1d60d5[_0x5adb('0x1e1')](_0xe5ced9,_0x2f5e18,_0x46be5d,_0x258690,_0x2d5583)['then'](function(_0x4ff01c){return _0x103e3a(_0x4ff01c);});default:return _0x1deba7(msgResponse(_0x5adb('0x1e2'),_0x5adb('0x13d'),_0x5adb('0x1e3')));}}else{return _0x1deba7(msgResponse(_0x5adb('0x1e2'),_0x5adb('0x13d'),_0x5adb('0x1e4')));}});};};Dialer[_0x5adb('0xb0')]['getDataPredictiveOld']=function(_0x3486af){var _0x7a83dd=this;return function(_0x21d855){return new Promise(function(_0x4ad569,_0x3a2c09){_[_0x5adb('0x94')](_0x3486af,_0x21d855[0x0]);if(checkGetDataPredictive(_0x21d855[0x0])){loggerPredictive[_0x5adb('0x84')](JSON[_0x5adb('0x4d')](_0x21d855[0x0]));if(_0x3486af['dialPredictiveOptimization']===_0x5adb('0x1d3')){return _0x7a83dd['getVoiceQueueRtPauses'](_0x3486af['id'])['then'](function(_0x2cb2e3){var _0x42cbd9=_0x3486af[_0x5adb('0x54')]-_0x2cb2e3[0x0][_0x5adb('0x1e5')];var _0x2f0323=_0x3486af[_0x5adb('0x1d0')]*0x3c;var _0x5af834=_0x21d855[0x0]['predictiveIntervalAvgTalktime']+_0x21d855[0x0][_0x5adb('0x6d')];var _0x5a8755=(_0x21d855[0x0][_0x5adb('0x6c')]+_0x21d855[0x0][_0x5adb('0x6e')]+_0x21d855[0x0][_0x5adb('0x88')])/_0x21d855[0x0][_0x5adb('0x74')];var _0x293db1=_0x3486af['dialPredictiveOptimizationPercentage']/0x64;_0x3486af['predictiveIntervalPauses']=_0x2cb2e3[0x0][_0x5adb('0x1e5')]||0x0;_0x3486af[_0x5adb('0x71')]=_0x5a8755>0x0?_0x5a8755:0x1;return _0x7a83dd[_0x5adb('0x1e0')](_0x42cbd9,_0x2f0323,_0x5af834,_0x5a8755,_0x293db1);})['then'](function(_0x3a97dd){return _0x4ad569(_0x3a97dd);})['catch'](function(_0x190653){return _0x3a2c09(msgResponse('[CatchErlangB]',_0x5adb('0x13d'),JSON[_0x5adb('0x4d')](_0x190653)));});}if(_0x3486af[_0x5adb('0x1de')]==='agentBusyFactor'){return _0x7a83dd[_0x5adb('0xce')](_0x3486af['id'])[_0x5adb('0x41')](function(_0xcd99ec){var _0x538b72=_0x3486af[_0x5adb('0x54')]-_0xcd99ec[0x0][_0x5adb('0x1e5')];var _0x25bc2a=_0x3486af[_0x5adb('0x1d0')]*0x3c;var _0x1f2913=_0x21d855[0x0]['predictiveIntervalAvgTalktime']+_0x21d855[0x0][_0x5adb('0x6d')];var _0x11be18=(_0x21d855[0x0][_0x5adb('0x6c')]+_0x21d855[0x0][_0x5adb('0x6e')]+_0x21d855[0x0][_0x5adb('0x88')])/_0x21d855[0x0][_0x5adb('0x74')];var _0x949b35=_0x3486af['dialPredictiveOptimizationPercentage']/0x64;_0x3486af[_0x5adb('0x1e6')]=_0xcd99ec[0x0][_0x5adb('0x1e5')]||0x0;_0x3486af[_0x5adb('0x71')]=_0x11be18>0x0?_0x11be18:0x1;return _0x7a83dd['busyFactor'](_0x538b72,_0x25bc2a,_0x1f2913,_0x11be18,_0x949b35);})[_0x5adb('0x41')](function(_0x46af7e){return _0x4ad569(_0x46af7e);})[_0x5adb('0xb8')](function(_0xd3124a){return _0x3a2c09(msgResponse(_0x5adb('0x1e7'),_0x5adb('0x13d'),JSON['stringify'](_0xd3124a)));});}}else{return _0x3a2c09(msgResponse(_0x5adb('0x1e2'),'Failure',_0x5adb('0x1e4')));}});};};Dialer[_0x5adb('0xb0')]['startMethodPredictive']=function(_0xdeb1f9){var _0x39c601=this;return function(){var _0x144788=0x0;var _0x555dc4=Math[_0x5adb('0x1cb')](_0xdeb1f9[_0x5adb('0x77')]*0x3e8);if(_0x555dc4>0x0){_0x555dc4=_0x555dc4<0x64?0x64:_0x555dc4;loggerPredictive[_0x5adb('0x84')](_0xdeb1f9[_0x5adb('0x45')],_0x5adb('0x1e8'),_0x555dc4,_0x5adb('0x4e'));_0xdeb1f9[_0x5adb('0x97')]=setInterval(function(){_0x39c601['handlePredictive'](_0xdeb1f9);loggerPredictiveCalls[_0x5adb('0x84')](_0x5adb('0x1e9'),_0x144788+=0x1);},_0x555dc4);}else{loggerPredictive['info'](_0xdeb1f9[_0x5adb('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0x5adb('0x1ea')]=function(_0x25f9fb,_0x531d34){var _0x23ba9e=this;return function(_0xec07b9){if(_['isEmpty'](_0xec07b9)){if(_[_0x5adb('0xb4')](_0x531d34[_0x5adb('0xda')])||!_0x531d34['recallme']){if(_0x25f9fb[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x25f9fb[_0x5adb('0x127')]=_[_0x5adb('0x43')](_0x25f9fb[_0x5adb('0x127')])?!![]:_0x25f9fb[_0x5adb('0x127')];var _0x28135f=uuid['v4']();_0x23ba9e['actions'][_0x28135f]=new Action(_0x25f9fb,_0x531d34,_0x28135f);loggerBooked['info'](_0x5adb('0x1eb'),_0x28135f,_0x5adb('0x1ec'),JSON[_0x5adb('0x4d')](_0x25f9fb[_0x5adb('0x127')]),_0x5adb('0x1ed'),_0x25f9fb[_0x5adb('0x45')]);if(_0x25f9fb[_0x5adb('0x127')]){_0x25f9fb[_0x5adb('0x127')]=![];_0x23ba9e['queueBooked'][_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xbb')]]=[];ami[_0x5adb('0xb5')]({'actionid':_0x28135f,'action':'queuestatus','queue':_0x25f9fb[_0x5adb('0x45')]})[_0x5adb('0xb8')](function(){_0x23ba9e['updateOriginated'](_0x25f9fb);_0x23ba9e[_0x5adb('0xc6')]({'active':![],'ContactId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd8')],'ListId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd9')],'VoiceQueueId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xdb')]||undefined,'CampaignId':_0x23ba9e['actions'][_0x28135f][_0x5adb('0xdc')]||undefined})[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1ee')));delete _0x23ba9e[_0x5adb('0x26')][_0x28135f];});}else{loggerBooked[_0x5adb('0x84')](_0x5adb('0x1ef'),JSON[_0x5adb('0x4d')](_0x25f9fb['queueStatusComplete']),_0x5adb('0x1ed'),_0x25f9fb['name']);_0x23ba9e['updateOriginated'](_0x25f9fb);_0x23ba9e['rescheduleContact']({'active':![],'ContactId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xd8')],'ListId':_0x23ba9e['actions'][_0x28135f]['ListId'],'VoiceQueueId':_0x23ba9e['actions'][_0x28135f][_0x5adb('0xdb')]||undefined,'CampaignId':_0x23ba9e[_0x5adb('0x26')][_0x28135f][_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1ee')));delete _0x23ba9e[_0x5adb('0x26')][_0x28135f];}}else{return _0x23ba9e[_0x5adb('0x16a')](_0x25f9fb,_0x531d34);}}else{if(getDiff(_0x531d34[_0x5adb('0x1f0')])<_0x25f9fb[_0x5adb('0x1f1')]*0x3c){if(_0x531d34[_0x5adb('0x158')]&&!_0x531d34[_0x5adb('0x158')]['voicePause']){_0x23ba9e['preview'][_0x5adb('0x12a')](_0x531d34['id'])[_0x5adb('0x1d')](function(){_0x23ba9e[_0x5adb('0xba')](_0x25f9fb);});}else{_0x23ba9e['unlockContact']({'active':![]},_0x531d34['id'],0x1)['finally'](function(){_0x23ba9e['updateOriginated'](_0x25f9fb);});}}else{_0x25f9fb[_0x5adb('0x1f2')]+=0x1;_0x23ba9e[_0x5adb('0xba')](_0x25f9fb);if(_0x25f9fb[_0x5adb('0x1f3')]){_0x23ba9e[_0x5adb('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x531d34[_0x5adb('0xd8')],'ListId':_0x531d34[_0x5adb('0xd9')],'VoiceQueueId':_0x531d34[_0x5adb('0xdb')]||undefined,'CampaignId':_0x531d34[_0x5adb('0xdc')]||undefined})['catch'](loggerCatch(_0x5adb('0x1f4')));_0x23ba9e[_0x5adb('0xd0')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1f5'),0x17,_0x5adb('0x1f6')))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x1f7')));}else{_0x23ba9e[_0x5adb('0xe2')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1f8'),0x16,_0x5adb('0x1f9')),_0x5adb('0x1fa'),_0x5adb('0x1fb'));}}}}else{_0x25f9fb[_0x5adb('0x1fc')]+=0x1;_0x23ba9e[_0x5adb('0xe2')](createObjHistory(_0x25f9fb,_0x531d34,_0x5adb('0x1fd'),0xd,_0x5adb('0x1fe')),_0x5adb('0x1ff'),_0x5adb('0x200'));throw'inBlackList';}};};Dialer[_0x5adb('0xb0')][_0x5adb('0x15b')]=function(_0x15ac80){var _0x94e26c=this;var _0x453f13=_0x15ac80[_0x5adb('0x201')]-_0x15ac80[_0x5adb('0x75')]-_0x15ac80[_0x5adb('0xca')];emitCampaignSummary(_0x15ac80);if(_0x453f13>0x0){if(_0x453f13>this[_0x5adb('0x24')]){_0x453f13=this[_0x5adb('0x24')];}_0x15ac80[_0x5adb('0xca')]+=_0x453f13;this['getContactDialerIvr'](_0x15ac80['id'],_0x453f13,_0x15ac80[_0x5adb('0x202')],_0x15ac80)[_0x5adb('0x41')](function(_0x31a86a){_0x15ac80[_0x5adb('0xca')]-=_0x453f13;_0x15ac80['temp']=_0x15ac80['temp']>0x0?_0x15ac80['temp']:0x0;if(!checkContactEmpty(_0x31a86a)){_0x15ac80[_0x5adb('0x44')]=_0x5adb('0xa4');logger[_0x5adb('0x84')](_0x5adb('0x203')+_0x15ac80['name']);}else{_0x15ac80['originated']+=_0x31a86a[_0x5adb('0x9e')];_0x15ac80[_0x5adb('0x44')]=_0x5adb('0x204');for(var _0x2d2117=0x0;_0x2d2117<_0x31a86a['length'];_0x2d2117+=0x1){_0x15ac80['ivrTotalCallsDays']+=0x1;if(_[_0x5adb('0xb4')](_0x31a86a[_0x2d2117])||_['isNil'](_0x31a86a[_0x2d2117][_0x5adb('0x185')])||_['isNil'](_0x31a86a[_0x2d2117][_0x5adb('0x16d')])){_0x94e26c['emptyContact']('[actionOriginate]\x20',_0x15ac80,_0x31a86a[_0x2d2117]);}else{_0x94e26c[_0x5adb('0xc4')](_['pick'](_0x31a86a[_0x2d2117],[_0x5adb('0xdc'),_0x5adb('0x16d')]))['then'](_0x94e26c['checkContactBlack'](_0x15ac80,_0x31a86a[_0x2d2117]))[_0x5adb('0xb8')](_0x94e26c[_0x5adb('0xd4')](_0x5adb('0x205'),_0x15ac80));}}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x206'),_0x15ac80,_0x453f13));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x152')]=function(_0x5a2933,_0x568521){var _0x4e41e6=this;var _0x2587b4=[];var _0x49f355=_0x568521>=0x1?_0x568521:0x1;if(_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x49f355=0x1;}var _0x5df8c4=Math[_0x5adb('0x1cb')](_0x5a2933['available']*_0x49f355)-_0x5a2933[_0x5adb('0x75')]-_0x5a2933[_0x5adb('0xca')];emitVoiceQueueSummary(_0x5a2933);if(_0x5a2933[_0x5adb('0x207')]>0x0){var _0x6d698=_0x5a2933[_0x5adb('0x207')]-_0x5a2933['originated']-_0x5a2933[_0x5adb('0xa7')]-_0x5a2933[_0x5adb('0xca')]-_0x5a2933['pTalking'];if(_0x5df8c4>_0x6d698){_0x5df8c4=_0x6d698;}}if(_0x5df8c4>0x0){if(_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')){_0x5df8c4=0x1;}if(_0x5df8c4>this['maxNumberOriginate']){_0x5df8c4=this[_0x5adb('0x24')];}_0x5a2933[_0x5adb('0xca')]+=_0x5df8c4;for(var _0x3caa67 in this[_0x5adb('0x22')]){if(typeof this[_0x5adb('0x22')][_0x3caa67]!==_0x5adb('0xd2')){if(this['agents'][_0x3caa67][_0x5adb('0xad')]===_0x5adb('0x208')&&this[_0x5adb('0x22')][_0x3caa67]['status']===_0x5adb('0x161')){_0x2587b4[_0x5adb('0x141')](this['agents'][_0x3caa67]['id']);}}}this['getContactDialer'](_0x5a2933['id'],_0x2587b4,_0x5df8c4,_0x5a2933['dialOrderByScheduledAt'],_0x5a2933)[_0x5adb('0x41')](function(_0x5c7166){_0x5a2933[_0x5adb('0xca')]-=_0x5df8c4;_0x5a2933[_0x5adb('0xca')]=_0x5a2933[_0x5adb('0xca')]>0x0?_0x5a2933[_0x5adb('0xca')]:0x0;if(!checkContactEmpty(_0x5c7166)){_0x4e41e6[_0x5adb('0xbd')](_0x5a2933)[_0x5adb('0x41')](sendMessageReschedule(_0x5a2933))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x209')));}else{_0x5a2933[_0x5adb('0x75')]+=_0x5c7166[_0x5adb('0x9e')];_0x5a2933[_0x5adb('0x44')]=_0x5a2933[_0x5adb('0x5e')]===_0x5adb('0x7')?_0x5adb('0x175'):'RUNNING';for(var _0x53d8fb=0x0;_0x53d8fb<_0x5c7166[_0x5adb('0x9e')];_0x53d8fb+=0x1){if(_[_0x5adb('0xb4')](_0x5c7166[_0x53d8fb])||_[_0x5adb('0xb4')](_0x5c7166[_0x53d8fb][_0x5adb('0x185')])||_['isNil'](_0x5c7166[_0x53d8fb][_0x5adb('0x16d')])){_0x4e41e6[_0x5adb('0xd5')](_0x5adb('0x20a'),_0x5a2933,_0x5c7166[_0x53d8fb]);}else{_0x4e41e6[_0x5adb('0xbf')](_[_0x5adb('0xd7')](_0x5c7166[_0x53d8fb],[_0x5adb('0xdb'),_0x5adb('0x16d')]))[_0x5adb('0x41')](_0x4e41e6[_0x5adb('0x1ea')](_0x5a2933,_0x5c7166[_0x53d8fb]))['catch'](_0x4e41e6['loggerHandler'](_0x5adb('0x20a'),_0x5a2933));}}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x20b'),_0x5a2933,_0x5df8c4));}};Dialer[_0x5adb('0xb0')][_0x5adb('0x97')]=function(_0x53a482){if(_0x53a482[_0x5adb('0x207')]>0x0){var _0x250255=_0x53a482[_0x5adb('0x207')]-_0x53a482[_0x5adb('0x75')]-_0x53a482['talking'];if(_0x250255>0x0){this[_0x5adb('0x20c')](_0x53a482);}else{loggerPredictiveCalls[_0x5adb('0x84')]('[handlePredictive][limitChannel]');}}else{this[_0x5adb('0x20c')](_0x53a482);}};Dialer[_0x5adb('0xb0')][_0x5adb('0x20c')]=function(_0x517683){var _0x12a509=this;var _0x3ad7bf=[];_0x517683[_0x5adb('0x75')]+=0x1;for(var _0x2aa949 in this['agents']){if(typeof this['agents'][_0x2aa949]!==_0x5adb('0xd2')){if(this['agents'][_0x2aa949][_0x5adb('0xad')]==='not_inuse'&&this[_0x5adb('0x22')][_0x2aa949][_0x5adb('0xb6')]===_0x5adb('0x161')){_0x3ad7bf[_0x5adb('0x141')](this[_0x5adb('0x22')][_0x2aa949]['id']);}}}this[_0x5adb('0xc9')](_0x517683['id'],_0x3ad7bf,0x1,_0x517683[_0x5adb('0x202')],_0x517683)[_0x5adb('0x41')](function(_0x118ca7){if(!checkContactEmpty(_0x118ca7)){checkContactLowerLimitOriginate(_0x517683,0x1,0x0);_0x12a509['countReScheduled'](_0x517683)[_0x5adb('0x41')](sendMessageReschedule(_0x517683))[_0x5adb('0xb8')](loggerCatch(_0x5adb('0x209')));}else{_0x517683[_0x5adb('0x44')]=_0x5adb('0x204');if(_[_0x5adb('0xb4')](_0x118ca7[0x0])||_[_0x5adb('0xb4')](_0x118ca7[0x0][_0x5adb('0x185')])||_[_0x5adb('0xb4')](_0x118ca7[0x0]['phone'])){_0x12a509['emptyContact']('[actionOriginate]\x20',_0x517683,_0x118ca7[0x0]);}else{_0x12a509['checkIsBlackList'](_[_0x5adb('0xd7')](_0x118ca7[0x0],[_0x5adb('0xdb'),_0x5adb('0x16d')]))[_0x5adb('0x41')](_0x12a509[_0x5adb('0x1ea')](_0x517683,_0x118ca7[0x0]))['catch'](_0x12a509[_0x5adb('0xd4')](_0x5adb('0x20d'),_0x517683));}}})[_0x5adb('0xb8')](loggerGetContactDialer(_0x5adb('0x20e'),_0x517683,0x1));emitVoiceQueueSummary(_0x517683);};Dialer[_0x5adb('0xb0')][_0x5adb('0x1e0')]=function(_0x5bb8f2,_0x1439f4,_0x4513a9,_0xe473fd,_0x454189,_0x13550a){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x20f'));loggerPredictive[_0x5adb('0x84')]('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',_0x5bb8f2);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x210'),_0x1439f4);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x211'),_0x4513a9);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x212'),_0xe473fd);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x213'),_0x454189);loggerPredictive['info'](_0x5adb('0x8a'));return new Promise(function(_0x188481,_0x2c3ef1){if(_0x5bb8f2<=0x0||isNaN(_0x5bb8f2)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x215')+_0x5bb8f2));}if(_0x4513a9<=0x0||isNaN(_0x4513a9)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x216')+_0x4513a9));}if(_0xe473fd<=0x0||isNaN(_0xe473fd)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),'Error',_0x5adb('0x217')+_0xe473fd));}if(_0x1439f4<=0x0||isNaN(_0x1439f4)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),_0x5adb('0x19b'),_0x5adb('0x218')+_0x1439f4));}if(_0x454189<=0x0||isNaN(_0x454189)){return _0x2c3ef1(msgResponse(_0x5adb('0x214'),'Error',_0x5adb('0x219')+_0x454189));}_0x13550a=_0x13550a||0x0;var _0x1b1352=0x1/_0x4513a9;var _0x587acc=0x0;var _0x38cf0f=0x0;var _0x4155e7=0x0;var _0x2f8a17=0x0;for(var _0x487d27=0x0;_0x4155e7<_0x454189;_0x487d27+=0x1){_0x38cf0f=_0x487d27/_0x1439f4;_0x587acc=(_0xe473fd*_0x38cf0f+_0x13550a)/_0x1b1352;_0x4155e7=erlangb(_0x587acc,_0x5bb8f2);_0x2f8a17=_0x587acc/_0x5bb8f2*(0x1-erlangb(_0x587acc,_0x5bb8f2));}return _0x188481({'erlangCalls':_0x487d27,'erlangCallToSecond':_0x1439f4/_0x487d27,'erlangAbandonmentRate':_0x4155e7,'erlangBusyFactor':_0x2f8a17});});};Dialer['prototype'][_0x5adb('0x1e1')]=function(_0x552d89,_0xc38d68,_0xc05e33,_0x168cb8,_0x2ed5d6,_0x50c31c){loggerPredictive[_0x5adb('0x84')](_0x5adb('0x21a'));loggerPredictive[_0x5adb('0x84')]('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',_0x552d89);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x210'),_0xc38d68);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x211'),_0xc05e33);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x212'),_0x168cb8);loggerPredictive[_0x5adb('0x84')](_0x5adb('0x21b'),_0x2ed5d6);loggerPredictive[_0x5adb('0x84')]('---------------------------');return new Promise(function(_0x4ceb3e,_0x55a8cb){if(_0x552d89<=0x0||isNaN(_0x552d89)){return _0x55a8cb(msgResponse('[busyFactor]',_0x5adb('0x19b'),_0x5adb('0x215')+_0x552d89));}if(_0xc05e33<=0x0||isNaN(_0xc05e33)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),'Ts\x20=\x20'+_0xc05e33));}if(_0x168cb8<=0x0||isNaN(_0x168cb8)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),'Error',_0x5adb('0x217')+_0x168cb8));}if(_0xc38d68<=0x0||isNaN(_0xc38d68)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),_0x5adb('0x218')+_0xc38d68));}if(_0x2ed5d6<=0x0||isNaN(_0x2ed5d6)){return _0x55a8cb(msgResponse(_0x5adb('0x21c'),_0x5adb('0x19b'),_0x5adb('0x21d')+_0x2ed5d6));}_0x50c31c=_0x50c31c||0x0;var _0x2cb0d5=0x1/_0xc05e33;var _0x25bd61=0x0;var _0x30d644=0x0;var _0x2814b4=0x0;var _0x558759=0x0;for(var _0x333f94=0x0;_0x558759<_0x2ed5d6;_0x333f94+=0x1){_0x30d644=_0x333f94/_0xc38d68;_0x25bd61=(_0x168cb8*_0x30d644+_0x50c31c)/_0x2cb0d5;_0x2814b4=erlangb(_0x25bd61,_0x552d89);_0x558759=_0x25bd61/_0x552d89*(0x1-erlangb(_0x25bd61,_0x552d89));}return _0x4ceb3e({'erlangCalls':_0x333f94,'erlangCallToSecond':_0xc38d68/_0x333f94,'erlangAbandonmentRate':_0x2814b4,'erlangBusyFactor':_0x558759});});};module[_0x5adb('0x21e')]=Dialer; \ No newline at end of file +var _0x64d9=['predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','voice:queue:%s','ivr','format','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','milliseconds','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','starttime','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[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','emptyContact','notFound','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','unmonitored','saveInDb','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','state','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countabandonedretry','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','Drop','dropreason','TIMEOUT','agiafterat','callAdditionalPhoneAfterMin','additional','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','voiceQueue','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncNewExten','syncQueueMember','actionid','locked','paused','agents','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','run','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','resetActiveCalls','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','launchHandleIvr','handleIvr','loggedIn','dialTimezone','checkDialMethod','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','map','Agent','user:dialPreviewRecallReminder','syncCampaigns','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22%s,%s%s,,,%s\x22','getCaller','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','dialCutDigit','dialPrefix','substring','[originateError]:\x20%s','OriginateError','[originate][error]','syncOriginateResponse','responsetime','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','talking','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','[countReScheduled]\x20','ACTIVE','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','p\x20=\x20','[busyFactor]','exports','util','lodash','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','seconds','emit','type','outbound','strategy','answered','pTalking','sumBillable','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x1005cb,_0x4a7ade){var _0x5e2696=function(_0x6ce4e2){while(--_0x6ce4e2){_0x1005cb['push'](_0x1005cb['shift']());}};_0x5e2696(++_0x4a7ade);}(_0x64d9,0x1d4));var _0x964d=function(_0x4a2dd1,_0x28dcd3){_0x4a2dd1=_0x4a2dd1-0x0;var _0x1cf616=_0x64d9[_0x4a2dd1];return _0x1cf616;};'use strict';var util=require(_0x964d('0x0'));var _=require(_0x964d('0x1'));var uuid=require(_0x964d('0x2'));var moment=require(_0x964d('0x3'));var rr=require('rr');var md5=require(_0x964d('0x4'));var Redis=require('ioredis');var ut=require(_0x964d('0x5'));var config=require(_0x964d('0x6'));var logger=require(_0x964d('0x7'))(_0x964d('0x8'));var loggerBooked=require(_0x964d('0x7'))(_0x964d('0x9'));var loggerPredictive=require(_0x964d('0x7'))(_0x964d('0xa'));var loggerPredictiveCalls=require(_0x964d('0x7'))(_0x964d('0xb'));var loggerSyncQueueSummary=require(_0x964d('0x7'))(_0x964d('0xc'));var ami=require(_0x964d('0xd'));config['redis']=_[_0x964d('0xe')](config[_0x964d('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0x964d('0x10'))(new Redis(config[_0x964d('0xf')]));var cmHopper=require(_0x964d('0x11'));var cmHopperHistory=require(_0x964d('0x12'));var cmHopperAdditionalPhone=require(_0x964d('0x13'));var cmHopperBlack=require(_0x964d('0x14'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x964d('0x15'));var Action=require(_0x964d('0x16'));var History=require(_0x964d('0x17'));var Final=require('./final');var AgentComplete=require(_0x964d('0x18'));var QueueCallerAbandon=require(_0x964d('0x19'));var Hangup=require('./hangup');var ipAgi=process[_0x964d('0x1a')][_0x964d('0x1b')]||_0x964d('0x1c');var strategy={'rrmemory':_0x964d('0x1d'),'roundrobin':_0x964d('0x1e')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x964d('0x1f')][_0x964d('0x20')]=function(_0x20f083){this[_0x964d('0x21')]=this[_0x964d('0x21')]?this[_0x964d('0x21')][_0x964d('0x22')](_0x20f083):_0x20f083();};function Dialer(_0x395e6e,_0x1ddc8d){this[_0x964d('0x23')]=new Sequence();this['preview']=_0x1ddc8d;this['voiceQueues']=_0x395e6e[_0x964d('0x24')];this['campaigns']=_0x395e6e[_0x964d('0x25')];this['agents']=_0x395e6e['agents'];this['trunks']=_0x395e6e[_0x964d('0x26')];this[_0x964d('0x27')]=config[_0x964d('0x27')]||0x2;this[_0x964d('0x28')]={};this[_0x964d('0x29')]={};this[_0x964d('0x2a')]={};this[_0x964d('0x2b')]={};this[_0x964d('0x2c')]={};this[_0x964d('0x2d')]={};this[_0x964d('0x2e')]={};this[_0x964d('0x2f')]={};this[_0x964d('0x30')]={};this[_0x964d('0x31')]={};ami['on'](_0x964d('0x32'),this[_0x964d('0x33')][_0x964d('0x34')](this));ami['on']('queuecallerabandon',this[_0x964d('0x35')][_0x964d('0x34')](this));ami['on'](_0x964d('0x36'),this['syncOriginateResponse'][_0x964d('0x34')](this));ami['on'](_0x964d('0x37'),this[_0x964d('0x38')]['bind'](this));ami['on'](_0x964d('0x39'),this[_0x964d('0xc')][_0x964d('0x34')](this));ami['on'](_0x964d('0x3a'),this[_0x964d('0x3b')][_0x964d('0x34')](this));ami['on'](_0x964d('0x3c'),this[_0x964d('0x3d')][_0x964d('0x34')](this));ami['on'](_0x964d('0x3e'),this['syncNewExten'][_0x964d('0x34')](this));ami['on']('varset',this[_0x964d('0x3f')]['bind'](this));ami['on'](_0x964d('0x40'),this['syncQueueMember']['bind'](this));ami['on'](_0x964d('0x41'),this[_0x964d('0x42')][_0x964d('0x34')](this));this['loopCampaigns']();this[_0x964d('0x43')]();RpcSetting[_0x964d('0x44')]()[_0x964d('0x45')](function(_0xe3088c){previewRecallmeReminderInterval=_0xe3088c[_0x964d('0x46')];});}function isNotNull(_0xbecc3d){return _0xbecc3d!==null&&!_[_0x964d('0x47')](_0xbecc3d);}function checkIsLoggedIn(_0x3e325f,_0x2617b1){return function(){if(_0x2617b1<=0x0){_0x3e325f[_0x964d('0x48')]=_0x964d('0x49');throw _0x3e325f[_0x964d('0x4a')]+_0x964d('0x4b');}};}function isActive(_0x1ae31a){return _0x1ae31a;}function checkIsActive(_0x9e117c,_0x10ac30){return function(){if(!isActive(_0x10ac30)){_0x9e117c[_0x964d('0x48')]=_0x964d('0x4c');throw _0x9e117c[_0x964d('0x4a')]+_0x964d('0x4d');}};}function checkInterval(_0x4c1a7a){return function(){if(!isNotNull(_0x4c1a7a[_0x964d('0x4e')])){_0x4c1a7a['message']=_0x964d('0x4f');throw _0x4c1a7a[_0x964d('0x4a')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4c1a7a[_0x964d('0x4e')][_0x964d('0x50')])){_0x4c1a7a[_0x964d('0x48')]=_0x964d('0x4f');throw _0x4c1a7a[_0x964d('0x4a')]+_0x964d('0x51');}if(!isNotNull(_[_0x964d('0x52')](_0x4c1a7a[_0x964d('0x4e')][_0x964d('0x50')]))){_0x4c1a7a[_0x964d('0x48')]='INTERVAL_IS_NULL';throw _0x4c1a7a[_0x964d('0x4a')]+_0x964d('0x51');}};}function msgResponse(_0x3d4093,_0x56b530,_0x21e989){return{'action':_0x3d4093,'response':_0x56b530,'message':_0x21e989,'stack':_0x21e989};}function myreject(_0x288c5e){return function(_0x8b6078){return _0x288c5e(msgResponse(_0x964d('0x53'),_0x964d('0x54'),JSON[_0x964d('0x55')](_0x8b6078)));};}function getSeconds(_0x560cd8,_0x2dc6b1){var _0x363485=moment(_0x560cd8)['milliseconds'](0x0);var _0x5bc070=moment(_0x2dc6b1)['milliseconds'](0x0);return _0x363485['diff'](_0x5bc070,_0x964d('0x56'));}function emit(_0x51a682,_0x12d428,_0x2e79dc){io['to'](_0x51a682)[_0x964d('0x57')](_0x12d428,_0x2e79dc);}function emitVoiceQueueSummary(_0x42c830){if(_0x42c830[_0x964d('0x58')]===_0x964d('0x59')){var _0x282cae={'id':_0x42c830['id'],'name':_0x42c830[_0x964d('0x4a')],'strategy':_0x42c830[_0x964d('0x5a')],'answered':_0x42c830[_0x964d('0x5b')],'available':_0x42c830['available'],'loggedIn':_0x42c830['loggedIn'],'pTalking':_0x42c830[_0x964d('0x5c')],'sumBillable':_0x42c830[_0x964d('0x5d')],'sumDuration':_0x42c830['sumDuration'],'sumHoldTime':_0x42c830['sumHoldTime']||0x0,'talking':_0x42c830['talking'],'total':_0x42c830[_0x964d('0x5e')],'type':_0x42c830['type'],'unmanaged':_0x42c830[_0x964d('0x5f')],'abandoned':_0x42c830[_0x964d('0x60')],'waiting':_0x42c830['waiting'],'loggedInDb':_0x42c830[_0x964d('0x61')],'dialActive':_0x42c830[_0x964d('0x62')],'dialMethod':_0x42c830[_0x964d('0x63')],'dialOriginateCallerIdName':_0x42c830[_0x964d('0x64')],'dialOriginateCallerIdNumber':_0x42c830[_0x964d('0x65')],'dialOriginateTimeout':_0x42c830[_0x964d('0x66')],'dialPrefix':_0x42c830['dialPrefix'],'outboundAnswerAgiCallsDay':_0x42c830['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x42c830[_0x964d('0x67')],'outboundBlacklistCallsDay':_0x42c830[_0x964d('0x68')],'outboundBusyCallsDay':_0x42c830[_0x964d('0x69')],'outboundCongestionCallsDay':_0x42c830[_0x964d('0x6a')],'outboundDropCallsDayACS':_0x42c830['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42c830[_0x964d('0x6b')],'outboundDropCallsDayTimeout':_0x42c830[_0x964d('0x6c')],'outboundNoAnswerCallsDay':_0x42c830[_0x964d('0x6d')],'outboundNoSuchCallsDay':_0x42c830[_0x964d('0x6e')],'outboundOriginateFailureCallsDay':_0x42c830[_0x964d('0x6f')],'outboundReCallsDay':_0x42c830[_0x964d('0x70')],'outboundRejectCallsDay':_0x42c830[_0x964d('0x71')],'outboundUnknownCallsDay':_0x42c830[_0x964d('0x72')],'predictiveIntervalAnsweredCalls':_0x42c830['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x42c830['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x42c830[_0x964d('0x73')],'predictiveIntervalDroppedCallsCallersExit':_0x42c830[_0x964d('0x74')],'predictiveIntervalDroppedCallsTimeout':_0x42c830['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x42c830[_0x964d('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x42c830[_0x964d('0x76')],'predictiveIntervalHitRate':_0x42c830[_0x964d('0x77')],'predictiveIntervalMultiplicativeFactor':_0x42c830[_0x964d('0x78')],'predictiveIntervalPauses':_0x42c830['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x42c830[_0x964d('0x79')],'predictiveIntervalTotalCalls':_0x42c830[_0x964d('0x7a')],'message':_0x42c830[_0x964d('0x48')],'originated':_0x42c830[_0x964d('0x7b')],'erlangCalls':_0x42c830['erlangCalls'],'erlangCallToSecond':_0x42c830['erlangCallToSecond'],'erlangAbandonmentRate':_0x42c830[_0x964d('0x7c')],'erlangBusyFactor':_0x42c830[_0x964d('0x7d')],'startPredictive':_0x42c830[_0x964d('0x2d')],'startProgressive':_0x42c830[_0x964d('0x2e')]};if(_0x42c830['Trunk']){_0x282cae[_0x964d('0x7e')]={'id':_0x42c830[_0x964d('0x7e')]['id'],'name':_0x42c830[_0x964d('0x7e')][_0x964d('0x4a')],'active':_0x42c830['Trunk'][_0x964d('0x7f')],'callerid':_0x42c830['Trunk']['callerid']};}if(_0x42c830['Interval']){_0x282cae[_0x964d('0x4e')]={'id':_0x42c830['Interval']['id'],'name':_0x42c830[_0x964d('0x4e')][_0x964d('0x4a')]};}var _0x370305=md5(JSON[_0x964d('0x55')](_0x282cae));if(_0x42c830[_0x964d('0x4')]!==_0x370305){_0x42c830['md5']=_0x370305;emit(util['format'](_0x964d('0x80'),_0x282cae[_0x964d('0x4a')]),'voice_queue:save',_0x282cae);}}}function emitCampaignSummary(_0x5dc448){if(_0x5dc448[_0x964d('0x58')]===_0x964d('0x81')){emit(util[_0x964d('0x82')]('campaign:ivr:%s',_0x5dc448[_0x964d('0x4a')]),_0x964d('0x83'),_0x5dc448);}}function checkGetDataPredictive(_0xa3049){if(isNotNull(_0xa3049)&&!_[_0x964d('0x52')](_0xa3049)){loggerPredictive[_0x964d('0x84')](_0x964d('0x85'));loggerPredictive[_0x964d('0x84')](_0x964d('0x86'),_0xa3049[_0x964d('0x7a')]);loggerPredictive['info'](_0x964d('0x87'),_0xa3049[_0x964d('0x88')]);loggerPredictive[_0x964d('0x84')](_0x964d('0x89'),_0xa3049['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x964d('0x84')](_0x964d('0x8a'),_0xa3049[_0x964d('0x74')]);loggerPredictive[_0x964d('0x84')](_0x964d('0x8b'),_0xa3049[_0x964d('0x8c')]);loggerPredictive['info'](_0x964d('0x8d'),_0xa3049[_0x964d('0x73')]);loggerPredictive['info'](_0x964d('0x8e'));if(_0xa3049['predictiveIntervalTotalCalls']>0x0){if(!_[_0x964d('0x47')](_0xa3049['predictiveIntervalAvgTalktime'])&&_0xa3049['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0x964d('0x8f'));if(!_[_0x964d('0x47')](_0xa3049[_0x964d('0x8c')])&&_0xa3049[_0x964d('0x8c')]>0x0){return!![];}loggerPredictive[_0x964d('0x84')](_0x964d('0x90'));}else{loggerPredictive[_0x964d('0x84')](_0x964d('0x91'));}}else{loggerPredictive[_0x964d('0x84')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2d4f4a){return function(_0x552820){loggerPredictive[_0x964d('0x84')](_0x964d('0x92'));loggerPredictive[_0x964d('0x84')](_0x964d('0x93'),_0x552820[_0x964d('0x94')]);loggerPredictive[_0x964d('0x84')](_0x964d('0x95'),_0x552820['erlangCallToSecond']);loggerPredictive[_0x964d('0x84')](_0x964d('0x96'),_0x552820[_0x964d('0x7c')]);loggerPredictive['info'](_0x964d('0x97'),_0x552820[_0x964d('0x7d')]);loggerPredictive['info'](_0x964d('0x96'),_0x552820[_0x964d('0x7c')]);loggerPredictive[_0x964d('0x84')](_0x964d('0x8e'));_[_0x964d('0x98')](_0x2d4f4a,_0x552820);};}function getDiff(_0x36edde){var _0x27cf49=moment()[_0x964d('0x99')](0x0);var _0x1d38a9=moment(_0x36edde)[_0x964d('0x99')](0x0);return _0x27cf49[_0x964d('0x9a')](_0x1d38a9,'seconds');}function ifInterval(_0x588ab6,_0x372dbb){if(_[_0x964d('0x47')](_0x372dbb)){return![];}return getDiff(_0x372dbb)<_0x588ab6*0x3c;}function freeVariablesPredictive(_0x560f9c){if(isNotNull(_0x560f9c)){if(!_['isUndefined'](_0x560f9c[_0x964d('0x2e')])){_0x560f9c[_0x964d('0x2e')]=undefined;loggerPredictive[_0x964d('0x84')](_0x560f9c[_0x964d('0x4a')],_0x964d('0x9b'));}if(!_[_0x964d('0x47')](_0x560f9c[_0x964d('0x2d')])){_0x560f9c[_0x964d('0x2d')]=undefined;loggerPredictive[_0x964d('0x84')](_0x560f9c[_0x964d('0x4a')],_0x964d('0x9c'));}if(!_[_0x964d('0x47')](_0x560f9c[_0x964d('0x9d')])){clearInterval(_0x560f9c[_0x964d('0x9d')]);_0x560f9c[_0x964d('0x9d')]=undefined;loggerPredictive[_0x964d('0x84')](_0x560f9c[_0x964d('0x4a')],_0x964d('0x9e'));}}}function erlangb(_0x42a1cf,_0x211f42){if(_0x211f42===0x0){return 0x0;}var _0xf27571=0x1;for(var _0x48a620=0x1;_0x48a620<=_0x211f42;_0x48a620+=0x1){_0xf27571=0x1+_0xf27571*_0x48a620/_0x42a1cf;}return 0x1/_0xf27571;}function isVoiceQueueOutbound(_0x52db41){return _0x52db41===_0x964d('0x59');}function isNotPreview(_0x4d28bf){return _0x4d28bf!==_0x964d('0x9f');}function isCampaignIvr(_0x138504){return _0x138504===_0x964d('0x81');}function getCallerId(_0x33ceed,_0x42166e,_0x2916af){if(!_[_0x964d('0x47')](_0x2916af)&&typeof _0x2916af===_0x964d('0xa0')&&!_[_0x964d('0x52')](_0x2916af)){if(!_[_0x964d('0x47')](_0x42166e)&&typeof _0x42166e===_0x964d('0xa0')&&!_[_0x964d('0x52')](_0x42166e)){return util[_0x964d('0x82')](_0x964d('0xa1'),_0x42166e,_0x2916af);}return util[_0x964d('0x82')](_0x964d('0xa1'),_0x2916af,_0x2916af);}if(!_[_0x964d('0x47')](_0x33ceed)&&typeof _0x33ceed===_0x964d('0xa0')&&!_[_0x964d('0x52')](_0x33ceed)){return _0x33ceed;}return _0x964d('0xa2');}function loggerCatchQueueSummary(_0x5569a2,_0x3ea324){return function(_0x1661d0){freeVariablesPredictive(_0x3ea324);emitVoiceQueueSummary(_0x3ea324);emitCampaignSummary(_0x3ea324);loggerSyncQueueSummary[_0x964d('0xa3')](_0x5569a2,util[_0x964d('0xa4')](_0x1661d0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x138cc8,_0xa88618){return function(_0x336496){loggerPredictive[_0x964d('0xa5')](_0xa88618[_0x964d('0x4a')],_0x138cc8);loggerPredictive['error'](_0x336496['stack']);freeVariablesPredictive(_0xa88618);};}function loggerCatch(_0x2f5d12){return function(_0x528314){logger[_0x964d('0xa5')](_0x2f5d12,util[_0x964d('0xa4')](_0x528314,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2cf7cb){return _0x2cf7cb&&!_[_0x964d('0x47')](_0x2cf7cb)&&_0x2cf7cb[_0x964d('0xa6')]>0x0;}function decremetOriginate(_0x5bd0ea){if(!_[_0x964d('0x47')](_0x5bd0ea)&&_0x5bd0ea!==null){if(typeof _0x5bd0ea[_0x964d('0x7b')]!==_0x964d('0xa7')){if(_0x5bd0ea[_0x964d('0x7b')]>0x0){_0x5bd0ea[_0x964d('0x7b')]-=0x1;}else{logger['error'](_0x964d('0xa8'));}}}else{logger['error'](_0x964d('0xa9'));}}function checkContactLowerLimitOriginate(_0x1864bd,_0x5efeb4,_0x3388ad){if(_0x5efeb4>_0x3388ad){for(var _0x34c330=0x0;_0x34c330<_0x5efeb4-_0x3388ad;_0x34c330+=0x1){decremetOriginate(_0x1864bd);}}}function loggerGetContactDialer(_0x4c97fb,_0x514652,_0x42e969){return function(_0xe80878){checkContactLowerLimitOriginate(_0x514652,_0x42e969,0x0);logger[_0x964d('0xa5')](_0x4c97fb,util[_0x964d('0xa4')](_0xe80878,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x465eac){return function(_0x22deed){if(isNotNull(_0x22deed)&&isNotNull(_0x22deed[0x0])){if(_0x22deed[0x0][_0x964d('0xaa')]>0x0){_0x465eac[_0x964d('0x48')]=_0x964d('0xab');logger[_0x964d('0x84')](_0x964d('0xac')+_0x465eac[_0x964d('0x4a')],_0x22deed[0x0]['contactsRescheduled'],_0x964d('0xad'));}else{_0x465eac[_0x964d('0x48')]=_0x964d('0xae');logger[_0x964d('0x84')]('[getContactDialer2][Empty]'+_0x465eac[_0x964d('0x4a')]);}}};}function notSendMessagesQueue(_0x10889a){if(_0x10889a[_0x964d('0xaf')]){freeVariablesPredictive(_0x10889a);if(_0x10889a[_0x964d('0x7b')]===0x0&&_0x10889a['talking']===0x0&&_0x10889a[_0x964d('0xb0')]===0x0&&(_0x10889a[_0x964d('0x5c')]||0x0)===0x0){_0x10889a[_0x964d('0xaf')]=![];_0x10889a[_0x964d('0xb1')]=0x0;_0x10889a['message']=_0x964d('0x4c');loggerSyncQueueSummary[_0x964d('0xa3')](_0x964d('0xb2'),_0x10889a['name'],'is\x20not\x20active');}else{_0x10889a[_0x964d('0x48')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x964d('0xa3')](_0x964d('0xb2'),_0x10889a[_0x964d('0x4a')],_0x964d('0xb3'));}emitVoiceQueueSummary(_0x10889a);}}function notSendMessagesCampaign(_0x4fc0a3){if(_0x4fc0a3[_0x964d('0xaf')]){if(_0x4fc0a3[_0x964d('0x7b')]===0x0){_0x4fc0a3[_0x964d('0xaf')]=![];_0x4fc0a3[_0x964d('0x48')]=_0x964d('0x4c');loggerSyncQueueSummary[_0x964d('0xa3')](_0x964d('0xb4'),_0x4fc0a3[_0x964d('0x4a')],'is\x20not\x20active');}else{_0x4fc0a3['message']=_0x964d('0xb5');loggerSyncQueueSummary[_0x964d('0xa3')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4fc0a3['name'],_0x964d('0xb3'));}emitCampaignSummary(_0x4fc0a3);}}function createObjHistory(_0x59c8e0,_0x1542c2,_0x552952,_0x3d7991,_0x125a09){_0x59c8e0[_0x964d('0x48')]=_0x552952;var _0x38ae5e=new Action(_0x59c8e0,_0x1542c2);var _0x12a241=new History(_0x38ae5e);_0x12a241['state']=_0x3d7991;_0x12a241[_0x964d('0xb6')]=_0x125a09;_0x12a241['endtime']=_0x38ae5e[_0x964d('0xb7')];return _0x12a241;}Dialer['prototype'][_0x964d('0x43')]=function(){var _0x4aa9f9=this;setInterval(function(){_0x4aa9f9[_0x964d('0xb8')](_0x4aa9f9[_0x964d('0x2b')],_0x964d('0xb9'));_0x4aa9f9[_0x964d('0xb8')](_0x4aa9f9[_0x964d('0x29')],'[actions]');},0x32c8);};Dialer[_0x964d('0x1f')][_0x964d('0xb8')]=function(_0x563679,_0x53f98e){var _0x4f3dce=this;for(var _0x42d7dc in _0x563679){if(typeof _0x563679[_0x42d7dc]!==_0x964d('0xa7')){this[_0x964d('0x23')][_0x964d('0x20')](function(){if(!_[_0x964d('0xba')](_0x563679[_0x42d7dc])){return ami[_0x964d('0xbb')]({'action':_0x964d('0xbc'),'channel':_0x563679[_0x42d7dc][_0x964d('0xbd')]})['catch'](function(_0x586dbe){if(_0x586dbe[_0x964d('0x48')]===_0x964d('0xbe')){setTimeout(function(){if(_0x563679[_0x42d7dc]&&_0x563679[_0x42d7dc][_0x964d('0x58')]!==_0x964d('0x81')){_0x4f3dce[_0x964d('0xbf')](_0x4f3dce[_0x964d('0x24')][_0x563679[_0x42d7dc]['queue']]);logger[_0x964d('0xa5')](_0x964d('0xc0'),_0x53f98e,_0x42d7dc,_0x563679[_0x42d7dc][_0x964d('0xc1')]);delete _0x563679[_0x42d7dc];}if(_0x563679[_0x42d7dc]&&_0x563679[_0x42d7dc][_0x964d('0x58')]==='ivr'){_0x4f3dce[_0x964d('0xbf')](_0x4f3dce[_0x964d('0x25')][_0x563679[_0x42d7dc]['queue']]);logger[_0x964d('0xa5')](_0x964d('0xc2'),_0x53f98e,_0x42d7dc,_0x563679[_0x42d7dc][_0x964d('0xc1')]);delete _0x563679[_0x42d7dc];}},0x2328);}});}});}}};Dialer[_0x964d('0x1f')][_0x964d('0xc3')]=function(_0x5bbc08){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0xc3')](_0x5bbc08))[_0x964d('0xc5')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x964d('0xc6')]=function(_0x369327){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopperBlack['checkIsBlackList'](_0x369327))[_0x964d('0xc5')](loggerCatch(_0x964d('0xc7')));};Dialer['prototype'][_0x964d('0xc8')]=function(_0x2bb32b,_0x72625e,_0x1dab0c){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopperAdditionalPhone[_0x964d('0xc8')](_0x2bb32b,_0x72625e,_0x1dab0c))[_0x964d('0xc5')](loggerCatch(_0x964d('0xc9')));};Dialer[_0x964d('0x1f')][_0x964d('0xca')]=function(_0x231ce8,_0x1faffd,_0x55f88e){return Promise['resolve']()[_0x964d('0x45')](cmHopperAdditionalPhone[_0x964d('0xca')](_0x231ce8,_0x1faffd,_0x55f88e))['catch'](loggerCatch(_0x964d('0xcb')));};Dialer[_0x964d('0x1f')]['checkIsBlackListIvr']=function(_0x377d0b){return Promise[_0x964d('0xc4')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x377d0b))[_0x964d('0xc5')](loggerCatch(_0x964d('0xcc')));};Dialer['prototype'][_0x964d('0xcd')]=function(_0x575a5c){return Promise['resolve']()[_0x964d('0x45')](cmHopperHistory[_0x964d('0xce')](_0x575a5c))[_0x964d('0xc5')](loggerCatch(_0x964d('0xcf')));};Dialer[_0x964d('0x1f')][_0x964d('0xd0')]=function(_0x5df005){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0xd0')](_0x5df005))['catch'](loggerCatch(_0x964d('0xd1')));};Dialer[_0x964d('0x1f')]['unlockContact']=function(_0x51b9e9,_0x406839,_0x3b2848){return Promise['resolve']()[_0x964d('0x45')](cmHopper['unlockContact'](_0x51b9e9,_0x406839,_0x3b2848))[_0x964d('0xc5')](loggerCatch(_0x964d('0xd2')));};Dialer['prototype']['getContactDialer']=function(_0x5d56f7,_0x256522,_0x3eca00,_0x835e51,_0x1852a0){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0xd3')](_0x5d56f7,_0x256522,_0x3eca00,_0x835e51))[_0x964d('0xc5')](function(_0x1e9380){_0x1852a0['temp']-=_0x3eca00;_0x1852a0[_0x964d('0xd4')]=_0x1852a0[_0x964d('0xd4')]>0x0?_0x1852a0['temp']:0x0;loggerCatch(_0x964d('0xd5'))(_0x1e9380);});};Dialer[_0x964d('0x1f')][_0x964d('0xd6')]=function(_0xce1316,_0x218b4c,_0x47a73a,_0x355a31){return Promise['resolve']()['then'](cmHopper['getContactDialerIvr'](_0xce1316,_0x218b4c,_0x47a73a))[_0x964d('0xc5')](function(_0x5380ab){_0x355a31['temp']-=_0x218b4c;_0x355a31[_0x964d('0xd4')]=_0x355a31[_0x964d('0xd4')]>0x0?_0x355a31[_0x964d('0xd4')]:0x0;loggerCatch(_0x964d('0xd7'))(_0x5380ab);});};Dialer[_0x964d('0x1f')][_0x964d('0xd8')]=function(_0x3a0eab){return Promise['resolve']()[_0x964d('0x45')](voiceQueueRt[_0x964d('0xd8')](_0x3a0eab))['catch'](loggerCatch(_0x964d('0xd9')));};Dialer[_0x964d('0x1f')][_0x964d('0xda')]=function(_0x39fc97){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0xda')](_0x39fc97))['catch'](loggerCatch(_0x964d('0xdb')));};Dialer['prototype'][_0x964d('0xdc')]=function(_0x191a6b){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopperHistory[_0x964d('0xdc')](_0x191a6b))[_0x964d('0xc5')](loggerCatch(_0x964d('0xdd')));};Dialer[_0x964d('0x1f')]['updateOriginated']=function(_0x430de4){if(!_['isUndefined'](_0x430de4)&&_0x430de4!==null){if(typeof _0x430de4['originated']!==_0x964d('0xa7')){if(_0x430de4[_0x964d('0x7b')]>0x0){_0x430de4[_0x964d('0x7b')]-=0x1;}else{logger[_0x964d('0xa5')](_0x964d('0xde'));}}}else{logger[_0x964d('0xa5')](_0x964d('0xdf'));}};Dialer['prototype'][_0x964d('0xe0')]=function(_0x2d0cf4,_0x36ffc7){var _0x232bac=this;return function(_0x2798b6){_0x232bac[_0x964d('0xbf')](_0x36ffc7);logger[_0x964d('0xa5')](_0x2d0cf4,util[_0x964d('0xa4')](_0x2798b6,{'showHidden':![],'depth':null}));};};Dialer[_0x964d('0x1f')][_0x964d('0xe1')]=function(_0xecfc0,_0x29b44e,_0x13ecdc){var _0x18c2d1={'state':0x19,'statedesc':_0x964d('0xe2')};this['updateOriginated'](_0x29b44e);this['saveInDb'](_[_0x964d('0x98')](_0x18c2d1,_[_0x964d('0xe3')](_0x13ecdc,[_0x964d('0xe4'),_0x964d('0xe5'),'UserId',_0x964d('0xe6'),_0x964d('0xe7')])),_0x964d('0xe8'),'[emptyContact]');logger[_0x964d('0xa5')](_0xecfc0);};Dialer['prototype']['isSuccess']=function(_0x41e57f){return _0x41e57f===_0x964d('0xe9');};Dialer[_0x964d('0x1f')]['isTrunkReachable']=function(_0x466f57){return!_[_0x964d('0x47')](_0x466f57)&&_0x466f57&&!_[_0x964d('0x47')](_0x466f57[_0x964d('0x4a')])&&!_[_0x964d('0x47')](_0x466f57['active'])&&_0x466f57[_0x964d('0x7f')]&&(this[_0x964d('0x26')][util[_0x964d('0x82')](_0x964d('0xea'),_0x466f57['name'])][_0x964d('0xbc')]===_0x964d('0xeb')||this[_0x964d('0x26')][util[_0x964d('0x82')](_0x964d('0xea'),_0x466f57['name'])][_0x964d('0xbc')]===_0x964d('0xec'));};Dialer[_0x964d('0x1f')][_0x964d('0xed')]=function(_0x4fa84c,_0x93a6bd,_0x6606f){this[_0x964d('0xdc')](_0x4fa84c)[_0x964d('0xc5')](loggerCatch(_0x93a6bd));this['moveContactManagedDialer'](_0x4fa84c)[_0x964d('0xc5')](loggerCatch(_0x6606f));};Dialer[_0x964d('0x1f')][_0x964d('0x3f')]=function(_0x2a9336){var _0xb5bd42=this;var _0x3730df=this[_0x964d('0x2b')][_0x2a9336['uniqueid']];var _0x1b8047;if(!_[_0x964d('0xba')](_0x2a9336)&&!_['isNil'](_0x2a9336[_0x964d('0xee')])&&!_[_0x964d('0xba')](_0x2a9336[_0x964d('0xee')]['amdstatus'])&&_0x2a9336[_0x964d('0xef')]===_0x964d('0xf0')&&_0x3730df){if(_0x3730df[_0x964d('0x58')]!==_0x964d('0x81')&&this[_0x964d('0x24')][_0x3730df[_0x964d('0xc1')]][_0x964d('0xf1')]&&_0x2a9336[_0x964d('0xf2')]===_0x964d('0xf3')){delete this[_0x964d('0x2b')][_0x2a9336[_0x964d('0xf4')]];this['updateOriginated'](this[_0x964d('0x24')][_0x3730df['queue']]);this[_0x964d('0x24')][_0x3730df[_0x964d('0xc1')]][_0x964d('0x67')]+=0x1;this['voiceQueues'][_0x3730df['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x1b8047=new Hangup(_0x3730df,_0x2a9336);_0x1b8047[_0x964d('0xf5')]=0x12;_0x1b8047[_0x964d('0xb6')]=_0x964d('0xf6');_0x1b8047[_0x964d('0xf7')]=_0x964d('0xf8');ami[_0x964d('0x57')]('custom:amd',ut[_0x964d('0xf9')](_0x1b8047,_0x964d('0xfa')));this['saveInDb'](_0x1b8047,_0x964d('0xfb'),_0x964d('0xfc'));}if(_0x3730df[_0x964d('0x58')]!==_0x964d('0x81')&&this[_0x964d('0x24')][_0x3730df[_0x964d('0xc1')]][_0x964d('0xf1')]&&_0x2a9336[_0x964d('0xf2')]===_0x964d('0xfd')){return new Promise(function(_0x42a69b,_0x124663){delete _0xb5bd42['uniqueId'][_0x2a9336[_0x964d('0xf4')]];_0xb5bd42[_0x964d('0xbf')](_0xb5bd42[_0x964d('0x24')][_0x3730df[_0x964d('0xc1')]]);_0xb5bd42[_0x964d('0x24')][_0x3730df['queue']][_0x964d('0x67')]+=0x1;_0xb5bd42[_0x964d('0x24')][_0x3730df['queue']][_0x964d('0xfe')]+=0x1;var _0x247b47=_0xb5bd42['voiceQueues'][_0x3730df[_0x964d('0xc1')]];var _0x484710=new Hangup(_0x3730df,_0x2a9336);_0x484710[_0x964d('0xf5')]=0x13;_0x484710[_0x964d('0xb6')]=_0x964d('0xff');_0x484710[_0x964d('0xf7')]=_0x964d('0xf8');_0x484710[_0x964d('0x100')]+=0x1;_0x484710[_0x964d('0x101')]+=0x1;_0x484710[_0x964d('0xfa')]=!![];ami[_0x964d('0x57')](_0x964d('0x102'),ut[_0x964d('0xf9')](_0x484710,_0x964d('0xfa')));_0xb5bd42[_0x964d('0xdc')](_0x484710)[_0x964d('0xc5')](loggerCatch(_0x964d('0x103')));if(_0x484710['countbusyretry']+_0x484710[_0x964d('0x104')]+_0x484710[_0x964d('0x105')]+_0x484710[_0x964d('0x106')]+_0x484710[_0x964d('0x107')]+_0x484710['countabandonedretry']+_0x484710[_0x964d('0x100')]+_0x484710[_0x964d('0x108')]>=_0x247b47[_0x964d('0x109')]){_0xb5bd42[_0x964d('0x10a')](_0x484710,_0x42a69b,_0x124663,_0x964d('0x10b'));}else{if(_0x484710[_0x964d('0x100')]>=_0x247b47[_0x964d('0x10c')]){_0xb5bd42[_0x964d('0x10d')](_0x484710,_0x42a69b,_0x124663,_0x964d('0x10e'));}else{_0xb5bd42[_0x964d('0xd0')]({'active':![],'countmachineretry':_0x484710[_0x964d('0x100')],'scheduledat':moment()[_0x964d('0x10f')](_0x247b47['dialMachineRetryFrequency'],_0x964d('0x110'))[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x484710[_0x964d('0xe4')],'ListId':_0x484710[_0x964d('0xe5')],'VoiceQueueId':_0x484710[_0x964d('0xe6')]||undefined,'CampaignId':_0x484710[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x112')));_0x42a69b({'reschedule':0x1});}}});}if(_0x3730df[_0x964d('0x58')]===_0x964d('0x81')&&this[_0x964d('0x25')][_0x3730df[_0x964d('0xc1')]][_0x964d('0xf1')]&&_0x2a9336[_0x964d('0xf2')]==='HANGUP'){delete this['uniqueId'][_0x2a9336[_0x964d('0xf4')]];this[_0x964d('0xbf')](this[_0x964d('0x25')][_0x3730df[_0x964d('0xc1')]]);_0x1b8047=new Hangup(_0x3730df,_0x2a9336);_0x1b8047['state']=0x12;_0x1b8047[_0x964d('0xb6')]=_0x964d('0xf6');_0x1b8047[_0x964d('0xf7')]='AMD';ami[_0x964d('0x57')](_0x964d('0x102'),ut[_0x964d('0xf9')](_0x1b8047,'amd'));this[_0x964d('0xed')](_0x1b8047,_0x964d('0x113'),_0x964d('0x114'));}if(_0x3730df['type']==='ivr'&&this['campaigns'][_0x3730df['queue']]['dialAMDActive']&&_0x2a9336[_0x964d('0xf2')]===_0x964d('0xfd')){return new Promise(function(_0x40d7a3,_0x5e96d0){delete _0xb5bd42[_0x964d('0x2b')][_0x2a9336[_0x964d('0xf4')]];_0xb5bd42[_0x964d('0xbf')](_0xb5bd42['campaigns'][_0x3730df[_0x964d('0xc1')]]);_0xb5bd42[_0x964d('0x25')][_0x3730df[_0x964d('0xc1')]][_0x964d('0x67')]+=0x1;_0xb5bd42[_0x964d('0x25')][_0x3730df[_0x964d('0xc1')]][_0x964d('0xfe')]+=0x1;var _0x3f1333=_0xb5bd42['campaigns'][_0x3730df[_0x964d('0xc1')]];var _0x3bab50=new Hangup(_0x3730df,_0x2a9336);_0x3bab50[_0x964d('0xf5')]=0x13;_0x3bab50['statedesc']='Machine';_0x3bab50[_0x964d('0xf7')]=_0x964d('0xf8');_0x3bab50[_0x964d('0x100')]+=0x1;_0x3bab50[_0x964d('0x101')]+=0x1;_0x3bab50['amd']=!![];ami[_0x964d('0x57')](_0x964d('0x102'),ut[_0x964d('0xf9')](_0x3bab50,_0x964d('0xfa')));_0xb5bd42[_0x964d('0xdc')](_0x3bab50)[_0x964d('0xc5')](loggerCatch(_0x964d('0x103')));if(_0x3bab50[_0x964d('0x115')]+_0x3bab50[_0x964d('0x104')]+_0x3bab50['countnoanswerretry']+_0x3bab50['countnosuchnumberretry']+_0x3bab50[_0x964d('0x107')]+_0x3bab50[_0x964d('0x116')]+_0x3bab50[_0x964d('0x100')]+_0x3bab50[_0x964d('0x108')]>=_0x3f1333['dialGlobalMaxRetry']){_0xb5bd42[_0x964d('0x10a')](_0x3bab50,_0x40d7a3,_0x5e96d0,'reason19\x20machine....');}else{if(_0x3bab50[_0x964d('0x100')]>=_0x3f1333['dialMachineMaxRetry']){_0xb5bd42[_0x964d('0x10d')](_0x3bab50,_0x40d7a3,_0x5e96d0,_0x964d('0x10e'));}else{_0xb5bd42[_0x964d('0xd0')]({'active':![],'countmachineretry':_0x3bab50[_0x964d('0x100')],'scheduledat':moment()[_0x964d('0x10f')](_0x3f1333[_0x964d('0x117')],_0x964d('0x110'))[_0x964d('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3bab50['ContactId'],'ListId':_0x3bab50['ListId'],'VoiceQueueId':_0x3bab50[_0x964d('0xe6')]||undefined,'CampaignId':_0x3bab50[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x112')));_0x40d7a3({'reschedule':0x1});}}});}}};Dialer[_0x964d('0x1f')][_0x964d('0x3d')]=function(_0x218ebc){var _0x5024b4=this[_0x964d('0x2b')][_0x218ebc['uniqueid']];var _0x43bbb8;if(_0x5024b4&&_0x5024b4[_0x964d('0x58')]===_0x964d('0x81')){delete this[_0x964d('0x2b')][_0x218ebc[_0x964d('0xf4')]];this[_0x964d('0xbf')](this['campaigns'][_0x5024b4[_0x964d('0xc1')]]);this[_0x964d('0x25')][_0x5024b4[_0x964d('0xc1')]][_0x964d('0x118')]+=0x1;_0x43bbb8=new Hangup(_0x5024b4,_0x218ebc);this[_0x964d('0xdc')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch(_0x964d('0x119')));this[_0x964d('0xda')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch(_0x964d('0x11a')));}if(_0x5024b4&&_0x5024b4['type']!==_0x964d('0x81')&&isNotNull(this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]][_0x964d('0x11b')])){delete this[_0x964d('0x2b')][_0x218ebc['uniqueid']];this[_0x964d('0xbf')](this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]]);this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]]['outboundAnswerCallsDay']+=0x1;this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]][_0x964d('0xfe')]+=0x1;_0x43bbb8=new Hangup(_0x5024b4,_0x218ebc);_0x43bbb8['state']=0x10;_0x43bbb8['statedesc']=_0x964d('0x11c');_0x43bbb8[_0x964d('0xf7')]='AGI';this[_0x964d('0xdc')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x964d('0xda')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch(_0x964d('0x11a')));}if(_0x5024b4&&_0x5024b4['type']!==_0x964d('0x81')&&!isNotNull(this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]][_0x964d('0x11b')])){delete this[_0x964d('0x2b')][_0x218ebc[_0x964d('0xf4')]];this['updateOriginated'](this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]]);this[_0x964d('0x24')][_0x5024b4[_0x964d('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x43bbb8=new Hangup(_0x5024b4,_0x218ebc);_0x43bbb8[_0x964d('0xf5')]=0xc;_0x43bbb8['statedesc']=_0x218ebc[_0x964d('0x11d')];_0x43bbb8[_0x964d('0xf7')]=_0x964d('0x11e');this[_0x964d('0xdc')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch(_0x964d('0x119')));this[_0x964d('0xda')](_0x43bbb8)[_0x964d('0xc5')](loggerCatch(_0x964d('0x11a')));}};Dialer['prototype']['syncAgentComplete']=function(_0x5a6cd1){var _0x54b148=this[_0x964d('0x2b')][_0x5a6cd1['uniqueid']];if(this[_0x964d('0x24')][_0x5a6cd1[_0x964d('0xc1')]]){if(_0x54b148&&_0x54b148[_0x964d('0x58')]!==_0x964d('0x81')){delete this[_0x964d('0x2b')][_0x5a6cd1[_0x964d('0xf4')]];this[_0x964d('0x24')][_0x5a6cd1[_0x964d('0xc1')]][_0x964d('0x67')]+=0x1;var _0x10ea38=new AgentComplete(_0x54b148,_0x5a6cd1);if(_0x5a6cd1[_0x964d('0x11f')]===_0x964d('0x120')){_0x10ea38['agiafterat']=this[_0x964d('0x24')][_0x5a6cd1['queue']][_0x964d('0x121')]&&this[_0x964d('0x24')][_0x5a6cd1[_0x964d('0xc1')]][_0x964d('0x122')]?moment()[_0x964d('0x82')](_0x964d('0x111')):undefined;}this['createHistory'](_0x10ea38)[_0x964d('0xc5')](loggerCatch(_0x964d('0x123')));this[_0x964d('0xda')](_0x10ea38)['catch'](loggerCatch(_0x964d('0x124')));}}};Dialer[_0x964d('0x1f')][_0x964d('0x33')]=function(_0x193ad1){if(this['voiceQueues'][_0x193ad1[_0x964d('0xc1')]]){if(this[_0x964d('0x2b')][_0x193ad1[_0x964d('0xf4')]]&&this['uniqueId'][_0x193ad1['uniqueid']]['type']!=='ivr'){this['updateOriginated'](this['voiceQueues'][_0x193ad1[_0x964d('0xc1')]]);this[_0x964d('0x2b')][_0x193ad1[_0x964d('0xf4')]][_0x964d('0x125')]=moment()['format'](_0x964d('0x111'));}}};Dialer[_0x964d('0x1f')]['queueCallerAbandonCreateState']=function(_0x2918e7,_0x298160){this['createHistory'](_0x2918e7)['catch'](loggerCatch(_0x964d('0x123')));if(_0x298160==0x0){this[_0x964d('0xda')](_0x2918e7)[_0x964d('0xc5')](loggerCatch(_0x964d('0x126')));}};Dialer[_0x964d('0x1f')][_0x964d('0x35')]=function(_0x55d4eb){var _0x5533e5=this[_0x964d('0x2b')][_0x55d4eb['uniqueid']];var _0x2ca0b7=this;var _0x515e0a=![];var _0x1f37bc;var _0x3650f6;if(this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]]){if(_0x5533e5&&_0x5533e5['type']!==_0x964d('0x81')){delete this[_0x964d('0x2b')][_0x55d4eb[_0x964d('0xf4')]];this[_0x964d('0xbf')](this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]]);_0x5533e5[_0x964d('0x127')]=moment()[_0x964d('0x82')](_0x964d('0x111'));var _0x30827d=new QueueCallerAbandon(_0x5533e5,_0x55d4eb);if(getSeconds(_0x5533e5[_0x964d('0x127')],_0x5533e5['responsetime'])>=_0x5533e5[_0x964d('0x128')]){this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x129')]+=0x1;this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x6c')]+=0x1;this[_0x964d('0x24')][_0x55d4eb['queue']][_0x964d('0x76')]+=0x1;_0x30827d[_0x964d('0xf5')]=0xa;_0x30827d[_0x964d('0xb6')]=_0x964d('0x12a');_0x30827d[_0x964d('0x12b')]=_0x964d('0x12c');_0x30827d[_0x964d('0x12d')]=this['voiceQueues'][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x121')]?moment()[_0x964d('0x82')](_0x964d('0x111')):undefined;_0x30827d[_0x964d('0x107')]+=0x1;_0x30827d[_0x964d('0x101')]+=0x1;_0x1f37bc=this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]]['dialDropRetryFrequency'];_0x3650f6=this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x12e')];_0x2ca0b7[_0x964d('0xc8')](_0x30827d,_0x30827d['state'],_0x5533e5['voiceQueue'])['then'](function(_0x3392d6){_0x515e0a=_0x3392d6[_0x964d('0x12f')]==0x1;if(_0x30827d[_0x964d('0x107')]>=_0x2ca0b7[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]]['dialDropMaxRetry']){_0x2ca0b7[_0x964d('0x130')](_0x30827d,_0x3392d6[_0x964d('0x12f')]);}else{_0x2ca0b7[_0x964d('0xd0')]({'active':![],'countdropretry':_0x30827d[_0x964d('0x107')],'scheduledat':moment()[_0x964d('0x10f')](_0x2ca0b7[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x131')],_0x964d('0x110'))['format'](_0x964d('0x111')),'ContactId':_0x5533e5[_0x964d('0xe4')],'ListId':_0x5533e5['ListId'],'VoiceQueueId':_0x5533e5[_0x964d('0xe6')]||undefined,'CampaignId':_0x5533e5[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x132')));var _0x31ef55=new History(_0x30827d);_0x31ef55[_0x964d('0xf5')]=0xa;_0x31ef55[_0x964d('0xb6')]='Drop';_0x31ef55[_0x964d('0xb7')]=moment()[_0x964d('0x82')](_0x964d('0x111'));_0x31ef55[_0x964d('0x133')]=_0x31ef55['starttime'];_0x31ef55[_0x964d('0x134')]=_0x30827d[_0x964d('0x134')];_0x31ef55['calleridnum']=_0x30827d[_0x964d('0x135')];_0x2ca0b7[_0x964d('0xdc')](_0x31ef55)[_0x964d('0xc5')](loggerCatch(_0x964d('0x136')));}})[_0x964d('0x45')](function(){if(_0x515e0a)_0x2ca0b7[_0x964d('0xca')](_0x30827d,_0x1f37bc,_0x3650f6)[_0x964d('0x45')](function(){return 0x1;});});}else{this['voiceQueues'][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x74')]+=0x1;this[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x6b')]+=0x1;_0x30827d[_0x964d('0xf5')]=0xb;_0x30827d[_0x964d('0xb6')]=_0x964d('0x137');_0x30827d['dropreason']=_0x964d('0x138');_0x30827d[_0x964d('0x116')]+=0x1;_0x30827d[_0x964d('0x101')]+=0x1;_0x1f37bc=this['voiceQueues'][_0x55d4eb[_0x964d('0xc1')]]['dialAbandonedRetryFrequency'];_0x3650f6=this['voiceQueues'][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x12e')];_0x2ca0b7[_0x964d('0xc8')](_0x30827d,_0x30827d[_0x964d('0xf5')],_0x5533e5[_0x964d('0x139')])[_0x964d('0x45')](function(_0x3de624){if(_0x30827d[_0x964d('0x116')]>=_0x2ca0b7['voiceQueues'][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x13a')]){_0x2ca0b7[_0x964d('0x130')](_0x30827d,_0x3de624['additional']);}else{_0x2ca0b7[_0x964d('0xd0')]({'active':![],'countabandonedretry':_0x30827d[_0x964d('0x116')],'scheduledat':moment()[_0x964d('0x10f')](_0x2ca0b7[_0x964d('0x24')][_0x55d4eb[_0x964d('0xc1')]][_0x964d('0x13b')],_0x964d('0x110'))[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x5533e5['ContactId'],'ListId':_0x5533e5[_0x964d('0xe5')],'VoiceQueueId':_0x5533e5['VoiceQueueId']||undefined,'CampaignId':_0x5533e5[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x13c')));var _0x58800a=new History(_0x30827d);_0x58800a[_0x964d('0xf5')]=0xb;_0x58800a['statedesc']=_0x964d('0x137');_0x58800a[_0x964d('0xb7')]=moment()[_0x964d('0x82')](_0x964d('0x111'));_0x58800a[_0x964d('0x133')]=_0x58800a[_0x964d('0xb7')];_0x58800a['calleridname']=_0x30827d[_0x964d('0x134')];_0x58800a[_0x964d('0x135')]=_0x30827d[_0x964d('0x135')];_0x2ca0b7[_0x964d('0xdc')](_0x58800a)[_0x964d('0xc5')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x964d('0x45')](function(){if(_0x515e0a)_0x2ca0b7[_0x964d('0xca')](_0x30827d,_0x1f37bc,_0x3650f6)['then'](function(){return 0x1;});});}}}};Dialer[_0x964d('0x1f')][_0x964d('0x13d')]=function(_0x4552e3){if(this[_0x964d('0x29')][_0x4552e3[_0x964d('0xf4')]]){this['actions'][_0x4552e3[_0x964d('0xf4')]][_0x964d('0xbd')]=_0x4552e3[_0x964d('0xbd')];}if(this[_0x964d('0x2b')][_0x4552e3[_0x964d('0xf4')]]){this[_0x964d('0x2b')][_0x4552e3[_0x964d('0xf4')]]['channel']=_0x4552e3[_0x964d('0xbd')];}};Dialer[_0x964d('0x1f')][_0x964d('0x13e')]=function(_0x4a310f){if(strategy[this[_0x964d('0x24')][this[_0x964d('0x29')][_0x4a310f['actionid']][_0x964d('0xc1')]][_0x964d('0x5a')]]===_0x964d('0x1e')){if(this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]]&&_[_0x964d('0xba')](this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]][_0x964d('0x140')])&&_0x4a310f[_0x964d('0xbc')]==='1'&&_0x4a310f[_0x964d('0x141')]==='0'){if(this[_0x964d('0x142')][_0x4a310f[_0x964d('0x143')]]){if(!this[_0x964d('0x142')][_0x4a310f[_0x964d('0x143')]][_0x964d('0x140')]){this['agents'][_0x4a310f[_0x964d('0x143')]][_0x964d('0x140')]=!![];this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]]['locked']=!![];this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]][_0x964d('0x143')]=_0x4a310f[_0x964d('0x143')];}}}}else if((strategy[this[_0x964d('0x24')][this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]][_0x964d('0xc1')]][_0x964d('0x5a')]]||_0x964d('0x1d'))===_0x964d('0x1d')){if(this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]]){if(this[_0x964d('0x142')][_0x4a310f['stateinterface']]){this['actions'][_0x4a310f['actionid']][_0x964d('0x143')]=_0x4a310f[_0x964d('0x143')];if(_[_0x964d('0xba')](this[_0x964d('0x30')][this['actions'][_0x4a310f[_0x964d('0x13f')]][_0x964d('0xc1')]])){this[_0x964d('0x30')][this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]][_0x964d('0xc1')]]=[];}this[_0x964d('0x30')][this[_0x964d('0x29')][_0x4a310f['actionid']][_0x964d('0xc1')]][_0x964d('0x144')](_[_0x964d('0x98')](_[_0x964d('0xe3')](this[_0x964d('0x29')][_0x4a310f[_0x964d('0x13f')]],[_0x964d('0x145'),_0x964d('0x143')]),{'status':_0x4a310f['status'],'paused':_0x4a310f['paused']}));}}}};function unlockQueueStatus(_0x31b4cf,_0x2f37e5){setTimeout(function(){if(_['isUndefined'](_0x31b4cf[_0x964d('0x146')])){loggerBooked['error'](_0x964d('0x147'),_0x2f37e5);}_0x31b4cf[_0x964d('0x146')]=!![];loggerBooked[_0x964d('0x84')](_0x964d('0x148'),_0x2f37e5,JSON[_0x964d('0x55')](_[_0x964d('0xe3')](_0x31b4cf,[_0x964d('0x4a'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x964d('0x1f')]['syncQueueStatusComplete']=function(_0x544b09){var _0x18b438=this;var _0x4532fe=_0x18b438['voiceQueues'][_0x18b438['actions'][_0x544b09[_0x964d('0x13f')]]['queue']];if(strategy[this[_0x964d('0x24')][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]]['queue']]['strategy']]===_0x964d('0x1e')){if(this[_0x964d('0x29')][_0x544b09['actionid']]&&this['actions'][_0x544b09[_0x964d('0x13f')]][_0x964d('0x143')]){this[_0x964d('0x9f')]['run'](this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]]['idHopper'],this[_0x964d('0x29')][_0x544b09['actionid']][_0x964d('0x143')])[_0x964d('0xc5')](function(_0x4269e4){logger[_0x964d('0xa5')](_0x964d('0x149'),util[_0x964d('0xa4')](_0x4269e4,{'showHidden':![],'depth':null}));})[_0x964d('0x22')](function(){_0x18b438[_0x964d('0xbf')](_0x18b438[_0x964d('0x24')][_0x18b438[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]);_0x18b438['agents'][_0x18b438[_0x964d('0x29')][_0x544b09['actionid']][_0x964d('0x143')]][_0x964d('0x140')]=![];delete _0x18b438[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]];unlockQueueStatus(_0x4532fe);});}else{this[_0x964d('0xbf')](this[_0x964d('0x24')][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]);this[_0x964d('0xd0')]({'active':![],'ContactId':this[_0x964d('0x29')][_0x544b09['actionid']][_0x964d('0xe4')],'ListId':this[_0x964d('0x29')][_0x544b09['actionid']]['ListId'],'VoiceQueueId':this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xe6')]||undefined,'CampaignId':this['actions'][_0x544b09[_0x964d('0x13f')]][_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x14a')));delete this['actions'][_0x544b09[_0x964d('0x13f')]];unlockQueueStatus(_0x4532fe);}}else if((strategy[this[_0x964d('0x24')][this[_0x964d('0x29')][_0x544b09['actionid']]['queue']][_0x964d('0x5a')]]||_0x964d('0x1d'))==='rrmemory'){var _0x429ca4;if(this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]]&&!_[_0x964d('0x52')](this[_0x964d('0x30')][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]]['queue']])){if(this[_0x964d('0x31')][_0x18b438[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]){this[_0x964d('0x31')][_0x18b438['actions'][_0x544b09['actionid']][_0x964d('0xc1')]]=this[_0x964d('0x31')][this['actions'][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]?this[_0x964d('0x31')][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]:this[_0x964d('0x30')][this[_0x964d('0x29')][_0x544b09['actionid']][_0x964d('0xc1')]]?this['queueBooked'][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]]['_rr']||0x0:0x0;}this[_0x964d('0x30')][this['actions'][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]][_0x964d('0x14b')]=this[_0x964d('0x31')][this[_0x964d('0x29')][_0x544b09[_0x964d('0x13f')]][_0x964d('0xc1')]];for(var _0x11d722=0x0;_0x11d722=0x0;})[_0x964d('0xc5')](myreject(_0xd81a70)));}}else{_0x2542f1[_0x964d('0x144')](ami['Action']({'action':_0x964d('0x165'),'command':util[_0x964d('0x82')](_0x964d('0x166'),_0x21224f,!_['isUndefined'](config[_0x964d('0x161')][_0x354eb2])?_0x354eb2:'')})[_0x964d('0x45')](function(_0x38b663){return _0x38b663[_0x964d('0x168')][_0x964d('0x169')](_0x964d('0x16a'))>=0x0;})[_0x964d('0xc5')](myreject(_0xd81a70)));}Promise[_0x964d('0x16b')](_0x2542f1)[_0x964d('0x45')](function(_0x2959ba){var _0x3b4c33=_['some'](_0x2959ba);if(_0x3b4c33){return _0x5d896f(_0x3b4c33);}else{_0x134cec['message']=_0x29d8b8?_0x964d('0x16c'):_0x964d('0x16d');return _0xd81a70(msgResponse(_0x964d('0x16e'),_0x964d('0x15e'),'Global:\x20'+_0x29d8b8+'\x20'+_0x3ba6cb+_0x964d('0x16f')+util[_0x964d('0xa4')](_0x21224f,{'showHidden':![],'depth':null})+_0x964d('0x170')+_0x354eb2));}})['catch'](function(_0x8b2c15){return _0xd81a70(msgResponse('ifTime',_0x964d('0x15e'),JSON[_0x964d('0x55')](_0x8b2c15)));});});};Dialer['prototype']['checkDialMethod']=function(_0x546a43){var _0x296abd=this;return function(){switch(_0x546a43[_0x964d('0x63')]){case _0x964d('0x171'):freeVariablesPredictive(_0x546a43);_0x296abd[_0x964d('0x172')](_0x546a43,0x1);break;case _0x964d('0x173'):freeVariablesPredictive(_0x546a43);_0x296abd[_0x964d('0x172')](_0x546a43,_0x546a43[_0x964d('0x174')]);break;case _0x964d('0xa'):_0x296abd['predictive'](_0x546a43);break;case _0x964d('0x9'):freeVariablesPredictive(_0x546a43);_0x296abd[_0x964d('0x172')](_0x546a43,0x1);break;default:freeVariablesPredictive(_0x546a43);logger[_0x964d('0xa5')](_0x964d('0x175'),_0x546a43[_0x964d('0x4a')],_0x964d('0x176'));}};};Dialer[_0x964d('0x1f')][_0x964d('0x177')]=function(_0x4f61d4){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0x178')](_0x4f61d4['id'],previewRecallmeReminderInterval))['then'](function(_0x89d78f){for(var _0xa82f77=0x0;_0xa82f77<_0x89d78f[_0x964d('0xa6')];_0xa82f77++){var _0x1df8c8=_0x89d78f[_0xa82f77]['Agent'][_0x964d('0x4a')];if(_0x1df8c8)io['to'](util[_0x964d('0x82')](_0x964d('0x179'),_0x1df8c8))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x89d78f[_0xa82f77]});}})[_0x964d('0xc5')](function(){});};Dialer['prototype'][_0x964d('0x17a')]=function(_0xf62c1d){var _0x107b47=this;return function(){_0x107b47[_0x964d('0x17b')](_0xf62c1d);};};Dialer[_0x964d('0x1f')][_0x964d('0xc')]=function(_0x45ffd3){var _0x51c9e5=this;if(isNotPreview(_0x45ffd3['dialMethod'])){if(isVoiceQueueOutbound(_0x45ffd3[_0x964d('0x58')])&&isActive(_0x45ffd3[_0x964d('0x62')])){_0x45ffd3[_0x964d('0xaf')]=!![];Promise[_0x964d('0xc4')]()[_0x964d('0x45')](checkIsLoggedIn(_0x45ffd3,_0x45ffd3[_0x964d('0x17c')]))[_0x964d('0x45')](checkIsActive(_0x45ffd3,_0x45ffd3[_0x964d('0x62')]))[_0x964d('0x45')](checkInterval(_0x45ffd3))[_0x964d('0x45')](_0x51c9e5[_0x964d('0x157')](_0x45ffd3))['then'](_0x51c9e5[_0x964d('0x15b')](_0x45ffd3['dialGlobalInterval'],_0x45ffd3[_0x964d('0x17d')],_0x45ffd3[_0x964d('0x4a')],_0x45ffd3))[_0x964d('0x45')](_0x51c9e5['checkIfTimeIntervals'](_0x45ffd3[_0x964d('0x4e')],_0x45ffd3['dialTimezone'],_0x45ffd3[_0x964d('0x4a')],_0x45ffd3))['then'](_0x51c9e5[_0x964d('0x17e')](_0x45ffd3))['catch'](loggerCatchQueueSummary(_0x964d('0x17f'),_0x45ffd3));}else{notSendMessagesQueue(_0x45ffd3);}}else{freeVariablesPredictive(_0x45ffd3);}};Dialer[_0x964d('0x1f')]['syncQueueSummaryComplete']=_[_0x964d('0x180')](function(){var _0x50d584=_[_0x964d('0x181')](this['voiceQueues'],function(_0x4fcaa2){return _0x4fcaa2[_0x964d('0x182')];});var _0x48d013=_[_0x964d('0x181')](this[_0x964d('0x142')],function(_0x5ac383){return _0x5ac383[_0x964d('0x183')]&&_0x5ac383[_0x964d('0xbc')]===_0x964d('0xeb');});if(_0x50d584[_0x964d('0xa6')]>0x0&&_0x48d013[_0x964d('0xa6')]>0x0){return Promise[_0x964d('0xc4')]()[_0x964d('0x45')](cmHopper[_0x964d('0x178')](_[_0x964d('0x184')](_0x50d584,'id'),previewRecallmeReminderInterval,_['map'](_0x48d013,'id')))[_0x964d('0x45')](function(_0xc3686e){for(var _0x2b6c7b=0x0;_0x2b6c7b<_0xc3686e[_0x964d('0xa6')];_0x2b6c7b++){var _0x481cb3=_0xc3686e[_0x2b6c7b][_0x964d('0x185')][_0x964d('0x4a')];if(_0x481cb3)io['to'](util['format'](_0x964d('0x179'),_0x481cb3))[_0x964d('0x57')](_0x964d('0x186'),{'hopper':_0xc3686e[_0x2b6c7b]});}})[_0x964d('0xc5')](function(_0x53d5be){logger[_0x964d('0xa5')]('checkPreviewRecallReminder',_0x53d5be);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x964d('0x187')]=function(){var _0xb2001b=this;var _0x627170;for(var _0xe58dfa in this[_0x964d('0x25')]){if(typeof this['campaigns'][_0xe58dfa]!==_0x964d('0xa7')){_0x627170=this[_0x964d('0x25')][_0xe58dfa];if(isCampaignIvr(_0x627170[_0x964d('0x58')])&&isActive(_0x627170[_0x964d('0x7f')])){_0x627170[_0x964d('0xaf')]=!![];Promise[_0x964d('0xc4')]()[_0x964d('0x45')](checkIsActive(_0x627170,_0x627170[_0x964d('0x7f')]))[_0x964d('0x45')](checkInterval(_0x627170))[_0x964d('0x45')](_0xb2001b[_0x964d('0x157')](_0x627170))[_0x964d('0x45')](_0xb2001b[_0x964d('0x15b')](_0x627170[_0x964d('0x188')],_0x627170['dialTimezone'],_0x627170[_0x964d('0x4a')],_0x627170))['then'](_0xb2001b['checkIfTimeIntervals'](_0x627170[_0x964d('0x4e')],_0x627170[_0x964d('0x17d')],_0x627170[_0x964d('0x4a')],_0x627170))[_0x964d('0x45')](_0xb2001b[_0x964d('0x17a')](_0x627170))[_0x964d('0xc5')](loggerCatchQueueSummary(_0x964d('0x189'),_0x627170));}else{notSendMessagesCampaign(_0x627170);}}}};function getCallerIdRandom(_0x772900,_0x269a8e){var _0x3605b4;var _0x53d229;var _0x125c87;if(_0x269a8e<=0x0){_0x269a8e=0x1;}_0x3605b4=new RegExp(_0x964d('0x18a')+_0x269a8e+'}$');_0x53d229=Math['pow'](0xa,_0x269a8e-0x1);_0x125c87=Math['pow'](0xa,_0x269a8e)-0x1;return util[_0x964d('0x82')]('%s',_[_0x964d('0x18b')](_0x772900,_0x3605b4,_['random'](_0x53d229,_0x125c87)));}function extractCalleridName(_0x1a507a){var _0x5236e6=_0x1a507a[_0x964d('0x18c')](/"(.*?)"/);return _0x5236e6?_0x5236e6[0x1]:_0x1a507a;}Dialer[_0x964d('0x1f')][_0x964d('0x18d')]=function(_0x3e969d,_0x3c0b3e){var _0x105605=this;var _0x4bb67f=uuid['v4']();this[_0x964d('0x29')][_0x4bb67f]=new Action(_0x3e969d,_0x3c0b3e,_0x4bb67f);return new Promise(function(_0x45c491,_0x77e40e){if(_['isUndefined'](_0x3e969d)&&typeof _0x3e969d!==_0x964d('0x18e')){return _0x77e40e(msgResponse(_0x964d('0x18f'),_0x964d('0x15e'),_0x964d('0x190')));}if(_[_0x964d('0x47')](_0x3c0b3e[_0x964d('0x191')])||_0x3c0b3e['phone']===null){return _0x77e40e(msgResponse('originate','Failure',_0x964d('0x192')));}var _0x26121f={'XMD-CALLERID':_0x105605['actions'][_0x4bb67f]['getCaller'](),'XMD-AGI':_0x3e969d[_0x964d('0x11b')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3e969d[_0x964d('0x11b')]):'NONE','XMD-AGIAFTER':_0x3e969d[_0x964d('0x121')]?util[_0x964d('0x82')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3e969d[_0x964d('0x121')]):_0x964d('0x193'),'XMD-QUEUE':_0x3e969d['type']===_0x964d('0x59')?util[_0x964d('0x82')](_0x964d('0x194'),_0x3e969d['name'],_0x3e969d['dialQueueOptions']||'',_0x3e969d[_0x964d('0x122')]?'c':'',_0x3e969d['dialQueueTimeout']||0x3):_0x964d('0x193'),'XMD-CONTACTID':_0x3c0b3e[_0x964d('0xe4')],'XMD-CDRTYPE':_0x964d('0x8'),'CALLERID(all)':_0x105605['actions'][_0x4bb67f][_0x964d('0x195')](),'XMD-AMD':_0x3e969d[_0x964d('0xf1')]?'ACTIVE':_0x964d('0x193'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3e969d['dialAMDActive']){_0x26121f['XMD-AMDINITIALSILENCE']=_0x3e969d[_0x964d('0x196')]||0x9c4;_0x26121f['XMD-AMDGREETING']=_0x3e969d[_0x964d('0x197')]||0x5dc;_0x26121f[_0x964d('0x198')]=_0x3e969d[_0x964d('0x199')]||0x320;_0x26121f[_0x964d('0x19a')]=_0x3e969d[_0x964d('0x19b')]||0x1388;_0x26121f['XMD-AMDMINWORDLENGTH']=_0x3e969d[_0x964d('0x19c')]||0x64;_0x26121f['XMD-AMDBETWEENWORDSSILENCE']=_0x3e969d[_0x964d('0x19d')]||0x32;_0x26121f[_0x964d('0x19e')]=_0x3e969d[_0x964d('0x19f')]||0x3;_0x26121f[_0x964d('0x1a0')]=_0x3e969d['dialAMDSilenceThreshold']||0x100;_0x26121f[_0x964d('0x1a1')]=_0x3e969d[_0x964d('0x1a2')]||0x1388;}if(_0x3e969d[_0x964d('0x58')]===_0x964d('0x59')){_0x26121f[_0x964d('0x1a3')]=_0x3c0b3e['VoiceQueueId'];}else{_0x26121f[_0x964d('0x1a4')]=_0x3c0b3e['CampaignId'];}for(var _0x248ce6 in _0x3c0b3e['Contact']){if(typeof _0x3c0b3e['Contact'][_0x248ce6]!=='undefined'){if(isNotNull(_0x3c0b3e[_0x964d('0x1a5')][_0x248ce6])&&_0x248ce6!=='id'&&_0x248ce6!==_0x964d('0x1a6')&&_0x248ce6!==_0x964d('0x1a7')&&_0x248ce6!==_0x964d('0x1a8')){_0x26121f[util[_0x964d('0x82')](_0x964d('0x1a9'),'XMD-',_[_0x964d('0x1aa')](_0x248ce6))]=_0x3c0b3e['Contact'][_0x248ce6];}}}var _0x48a7e0=_0x105605[_0x964d('0x158')](_0x3e969d[_0x964d('0x7e')])?getCallerId(_0x3e969d[_0x964d('0x7e')]['callerid'],_0x3e969d['dialOriginateCallerIdName'],_0x3e969d[_0x964d('0x1ab')]>0x0?getCallerIdRandom(_0x3e969d['dialOriginateCallerIdNumber'],_0x3e969d[_0x964d('0x1ab')]):_0x3e969d[_0x964d('0x65')]):getCallerId(_['isNil'](_0x3e969d[_0x964d('0x159')])?_0x3e969d['Trunk'][_0x964d('0x1ac')]:_0x3e969d[_0x964d('0x159')][_0x964d('0x1ac')],_0x3e969d[_0x964d('0x64')],_0x3e969d[_0x964d('0x1ab')]>0x0?getCallerIdRandom(_0x3e969d[_0x964d('0x65')],_0x3e969d[_0x964d('0x1ab')]):_0x3e969d[_0x964d('0x65')]);if(_0x48a7e0){_0x26121f[_0x964d('0x1ad')]=_0x105605[_0x964d('0x29')][_0x4bb67f][_0x964d('0x1ae')]=extractCalleridName(_0x48a7e0);_0x26121f[_0x964d('0x1af')]=_0x3c0b3e[_0x964d('0x191')];}_0x3e969d[_0x964d('0x1b0')]=_0x26121f;return ami[_0x964d('0xbb')]({'actionid':_0x4bb67f,'action':_0x964d('0x18f'),'channel':_0x105605[_0x964d('0x158')](_0x3e969d[_0x964d('0x7e')])?util[_0x964d('0x82')](_0x964d('0x1b1'),_0x3e969d[_0x964d('0x7e')][_0x964d('0x4a')],isNotNull(_0x3e969d['dialPrefix'])?_0x3e969d['dialPrefix'][_0x964d('0x1b2')]()||'':'',_0x3e969d[_0x964d('0x1b3')]>0x0?_0x3c0b3e[_0x964d('0x191')]['substring'](_0x3e969d['dialCutDigit']):_0x3c0b3e['phone']):util['format']('SIP/%s/%s%s',_[_0x964d('0xba')](_0x3e969d[_0x964d('0x159')])?_0x3e969d[_0x964d('0x7e')][_0x964d('0x4a')]:_0x3e969d['TrunkBackup']['name'],isNotNull(_0x3e969d[_0x964d('0x1b4')])?_0x3e969d['dialPrefix'][_0x964d('0x1b2')]()||'':'',_0x3e969d['dialCutDigit']>0x0?_0x3c0b3e[_0x964d('0x191')][_0x964d('0x1b5')](_0x3e969d['dialCutDigit']):_0x3c0b3e[_0x964d('0x191')]),'callerid':_0x48a7e0,'Exten':_0x964d('0xf0'),'Context':'from-sip','Priority':'1','variable':_0x26121f,'timeout':(_0x3e969d[_0x964d('0x66')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4bb67f})[_0x964d('0x45')](function(_0x6ff4c6){return _0x45c491(_0x6ff4c6);})[_0x964d('0xc5')](function(_0x173bdd){_0x3e969d[_0x964d('0x6f')]+=0x1;var _0x140b3f=new History(_0x105605['actions'][_0x4bb67f]);logger[_0x964d('0xa5')](util[_0x964d('0x82')](_0x964d('0x1b6'),JSON[_0x964d('0x55')](_0x173bdd)));_0x140b3f[_0x964d('0xf5')]=0xe;_0x140b3f['statedesc']=_0x964d('0x1b7');_0x140b3f['starttime']=moment()[_0x964d('0x82')]('YYYY-MM-DD\x20HH:mm:ss');_0x140b3f['endtime']=_0x140b3f['starttime'];_0x105605['createHistory'](_0x140b3f)['catch'](loggerCatch(_0x964d('0x1b8')));_0x105605['moveContactManagedDialer'](_0x140b3f)[_0x964d('0xc5')](loggerCatch(_0x964d('0x1b8')))[_0x964d('0x22')](function(){delete _0x105605[_0x964d('0x29')][_0x4bb67f];return _0x77e40e(msgResponse('originate','Error','originate\x20action\x20Error'));});});});};Dialer[_0x964d('0x1f')][_0x964d('0x1b9')]=function(_0x1adbc2){var _0x35be8e=this[_0x964d('0x29')][_0x1adbc2['actionid']];if(_0x35be8e){delete this['actions'][_0x1adbc2[_0x964d('0x13f')]];_0x35be8e[_0x964d('0x1ba')]=moment()[_0x964d('0x82')](_0x964d('0x111'));var _0x1e9a8b=_0x35be8e[_0x964d('0x58')]===_0x964d('0x81')?this[_0x964d('0x25')][_0x35be8e[_0x964d('0xc1')]]:this['voiceQueues'][_0x35be8e[_0x964d('0x1bb')]()];if(!this[_0x964d('0x1bc')](_0x1adbc2['response'])){this[_0x964d('0xbf')](_0x1e9a8b);return this[_0x964d('0x1bd')](_0x35be8e,_0x1e9a8b,_0x1adbc2)['catch'](loggerCatch(_0x964d('0x1be')));}this[_0x964d('0x2b')][_0x1adbc2[_0x964d('0xf4')]]=_0x35be8e;}};Dialer[_0x964d('0x1f')][_0x964d('0x1bf')]=function(_0x45d2ab,_0xf3b97b,_0x1fcb2c){var _0x2edf0b=new History(_0xf3b97b);if(_0x2edf0b[_0x964d('0x115')]+_0x2edf0b[_0x964d('0x104')]+_0x2edf0b[_0x964d('0x105')]+_0x2edf0b[_0x964d('0x106')]+_0x2edf0b[_0x964d('0x107')]+_0x2edf0b['countabandonedretry']+_0x2edf0b[_0x964d('0x100')]+_0x2edf0b[_0x964d('0x108')]>=_0x1fcb2c[_0x964d('0x109')]-0x1){return!![];}switch(_0x45d2ab){case 0x3:if(_0x2edf0b['countnoanswerretry']>=_0x1fcb2c[_0x964d('0x1c0')]-0x1){return!![];}this[_0x964d('0xd0')]({'active':![],'countnoanswerretry':_0x2edf0b[_0x964d('0x105')]+=0x1,'scheduledat':moment()['add'](_0x1fcb2c[_0x964d('0x1c1')],'minutes')[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x2edf0b['ContactId'],'ListId':_0x2edf0b['ListId'],'VoiceQueueId':_0x2edf0b['VoiceQueueId']||undefined,'CampaignId':_0x2edf0b['CampaignId']||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x1c2')));break;case 0x5:if(_0x2edf0b[_0x964d('0x115')]>=_0x1fcb2c[_0x964d('0x1c3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2edf0b[_0x964d('0x115')]+=0x1,'scheduledat':moment()[_0x964d('0x10f')](_0x1fcb2c['dialBusyRetryFrequency'],_0x964d('0x110'))[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b[_0x964d('0xe5')],'VoiceQueueId':_0x2edf0b['VoiceQueueId']||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x1c4')));break;case 0x8:if(_0x2edf0b[_0x964d('0x104')]>=_0x1fcb2c[_0x964d('0x1c5')]-0x1){return!![];}this[_0x964d('0xd0')]({'active':![],'countcongestionretry':_0x2edf0b[_0x964d('0x104')]+=0x1,'scheduledat':moment()['add'](_0x1fcb2c[_0x964d('0x1c6')],'minutes')[_0x964d('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b[_0x964d('0xe5')],'VoiceQueueId':_0x2edf0b['VoiceQueueId']||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2edf0b[_0x964d('0x106')]>=_0x1fcb2c[_0x964d('0x1c7')]-0x1){return!![];}else{this[_0x964d('0xd0')]({'active':![],'countnosuchnumberretry':_0x2edf0b[_0x964d('0x106')]+=0x1,'scheduledat':moment()[_0x964d('0x10f')](_0x1fcb2c['dialNoSuchNumberRetryFrequency'],_0x964d('0x110'))[_0x964d('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b[_0x964d('0xe5')],'VoiceQueueId':_0x2edf0b[_0x964d('0xe6')]||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x1c8')));}break;case 0xa:if(_0x2edf0b[_0x964d('0x107')]>=_0x1fcb2c[_0x964d('0x1c9')]-0x1){return!![];}this[_0x964d('0xd0')]({'active':![],'countdropretry':_0x2edf0b[_0x964d('0x107')]+=0x1,'scheduledat':moment()[_0x964d('0x10f')](_0x1fcb2c[_0x964d('0x131')],_0x964d('0x110'))['format'](_0x964d('0x111')),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b['ListId'],'VoiceQueueId':_0x2edf0b['VoiceQueueId']||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2edf0b[_0x964d('0x116')]>=_0x1fcb2c[_0x964d('0x13a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x2edf0b[_0x964d('0x116')]+=0x1,'scheduledat':moment()[_0x964d('0x10f')](_0x1fcb2c[_0x964d('0x13b')],_0x964d('0x110'))[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x2edf0b['ContactId'],'ListId':_0x2edf0b[_0x964d('0xe5')],'VoiceQueueId':_0x2edf0b[_0x964d('0xe6')]||undefined,'CampaignId':_0x2edf0b['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2edf0b[_0x964d('0x100')]>=_0x1fcb2c[_0x964d('0x10c')]-0x1){return!![];}this[_0x964d('0xd0')]({'active':![],'countmachineretry':_0x2edf0b[_0x964d('0x100')]+=0x1,'scheduledat':moment()['add'](_0x1fcb2c['dialMachineRetryFrequency'],_0x964d('0x110'))['format'](_0x964d('0x111')),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b['ListId'],'VoiceQueueId':_0x2edf0b[_0x964d('0xe6')]||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2edf0b[_0x964d('0x108')]>=_0x1fcb2c[_0x964d('0x1ca')]-0x1){return!![];}this[_0x964d('0xd0')]({'active':![],'countagentrejectretry':_0x2edf0b[_0x964d('0x108')]+=0x1,'scheduledat':moment()['add'](_0x1fcb2c[_0x964d('0x1cb')],_0x964d('0x110'))[_0x964d('0x82')](_0x964d('0x111')),'ContactId':_0x2edf0b[_0x964d('0xe4')],'ListId':_0x2edf0b[_0x964d('0xe5')],'VoiceQueueId':_0x2edf0b[_0x964d('0xe6')]||undefined,'CampaignId':_0x2edf0b[_0x964d('0xe7')]||undefined})['catch'](loggerCatch(_0x964d('0x1cc')));break;default:return!![];}};Dialer[_0x964d('0x1f')][_0x964d('0x1bd')]=function(_0x529b53,_0x15606e,_0x1e47c4){var _0xe756d=this;var _0x4d6c26=new History(_0x529b53);var _0x2d755c=![];var _0x21342d;var _0x2213b2;return new Promise(function(_0x58fd1a,_0x5615bd){if(_[_0x964d('0x47')](_0x15606e)&&typeof _0x15606e!==_0x964d('0x18e')){return _0x5615bd(msgResponse(_0x964d('0x1cd'),_0x964d('0x15e'),_0x964d('0x1ce')));}if(_[_0x964d('0x47')](_0x1e47c4)&&typeof _0x1e47c4!==_0x964d('0x18e')){return _0x5615bd(msgResponse(_0x964d('0x1cd'),_0x964d('0x15e'),_0x964d('0x1cf')));}_0xe756d['verifyAdditionalPhones'](_0x4d6c26,_0x1e47c4[_0x964d('0x11f')],_0x15606e)['then'](function(_0x475305){if(_0x475305['additional']==0x1)_0x2d755c=!![];switch(_0x1e47c4[_0x964d('0x11f')]){case'0':_0x15606e['outboundNoSuchCallsDay']+=0x1;_0x4d6c26[_0x964d('0xf5')]=0x0;_0x4d6c26[_0x964d('0xb6')]='NoSuchNumber';_0x4d6c26['countnosuchnumberretry']+=0x1;_0x4d6c26[_0x964d('0x101')]+=0x1;ami[_0x964d('0x57')]('custom:agentnosuchnumber',ut[_0x964d('0xf9')](_0x529b53,_0x964d('0x1d0')));_0x21342d=_0x15606e[_0x964d('0x1d1')];_0x2213b2=_0x15606e['callAdditionalPhoneAfterMin'];_0xe756d['createHistory'](_0x4d6c26)[_0x964d('0xc5')](loggerCatch(_0x964d('0x103')));if(_0xe756d['checkRetriveMax'](0x0,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26[_0x964d('0x106')]>=_0x15606e['dialNoSuchNumberMaxRetry']){_0xe756d[_0x964d('0x10d')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1d2'));}else{_0xe756d['stateGlobal'](_0x4d6c26,_0x58fd1a,_0x5615bd,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x15606e[_0x964d('0x6d')]+=0x1;_0x4d6c26[_0x964d('0xf5')]=0x3;_0x4d6c26[_0x964d('0xb6')]=_0x964d('0x1d3');_0x4d6c26['countnoanswerretry']+=0x1;_0x4d6c26['countglobal']+=0x1;var _0xbc2d44=ut['buildNoAnswerEventPayload'](_0x529b53,_0x15606e);ami[_0x964d('0x57')](_0x964d('0x1d4'),_0xbc2d44);_0x21342d=_0x15606e[_0x964d('0x1c1')];_0x2213b2=_0x15606e[_0x964d('0x12e')];_0xe756d[_0x964d('0xdc')](_0x4d6c26)[_0x964d('0xc5')](loggerCatch(_0x964d('0x1d5')));if(_0xe756d[_0x964d('0x1bf')](0x3,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26[_0x964d('0x105')]>=_0x15606e[_0x964d('0x1c0')]){_0xe756d[_0x964d('0x10d')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1d6'));}else{_0xe756d[_0x964d('0x10a')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1d6'));}}break;case'5':_0x15606e[_0x964d('0x69')]+=0x1;_0x4d6c26[_0x964d('0xf5')]=0x5;_0x4d6c26[_0x964d('0xb6')]=_0x964d('0x1d7');_0x4d6c26[_0x964d('0x115')]+=0x1;_0x4d6c26[_0x964d('0x101')]+=0x1;ami[_0x964d('0x57')](_0x964d('0x1d8'),ut[_0x964d('0xf9')](_0x529b53,_0x964d('0x1d9')));_0x21342d=_0x15606e[_0x964d('0x1da')];_0x2213b2=_0x15606e[_0x964d('0x12e')];_0xe756d[_0x964d('0xdc')](_0x4d6c26)[_0x964d('0xc5')](loggerCatch(_0x964d('0x1db')));if(_0xe756d[_0x964d('0x1bf')](0x5,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26['countbusyretry']>=_0x15606e[_0x964d('0x1c3')]){_0xe756d['createStateFinal'](_0x4d6c26,_0x58fd1a,_0x5615bd,'reason\x205\x20busy');}else{_0xe756d[_0x964d('0x10a')](_0x4d6c26,_0x58fd1a,_0x5615bd,'reason\x205\x20busy');}}break;case'8':_0x15606e[_0x964d('0x6a')]+=0x1;_0x4d6c26['state']=0x8;_0x4d6c26[_0x964d('0xb6')]=_0x964d('0x1dc');_0x4d6c26[_0x964d('0x104')]+=0x1;_0x4d6c26[_0x964d('0x101')]+=0x1;_0x21342d=_0x15606e[_0x964d('0x1c6')];_0x2213b2=_0x15606e['callAdditionalPhoneAfterMin'];ami[_0x964d('0x57')](_0x964d('0x1dd'),ut['buildObj'](_0x529b53,_0x964d('0x1de')));_0xe756d[_0x964d('0xdc')](_0x4d6c26)['catch'](loggerCatch(_0x964d('0x1df')));if(_0xe756d['checkRetriveMax'](0x8,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26[_0x964d('0x104')]>=_0x15606e[_0x964d('0x1c5')]){_0xe756d[_0x964d('0x10d')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1e0'));}else{_0xe756d['stateGlobal'](_0x4d6c26,_0x58fd1a,_0x5615bd,'reason\x208\x20congestion');}}break;case'11':_0x15606e[_0x964d('0x1e1')]+=0x1;_0x4d6c26['state']=0xb;_0x4d6c26[_0x964d('0xb6')]=_0x964d('0x137');_0x4d6c26[_0x964d('0x116')]+=0x1;_0x4d6c26[_0x964d('0x101')]+=0x1;_0x21342d=_0x15606e[_0x964d('0x13b')];_0x2213b2=_0x15606e[_0x964d('0x12e')];_0xe756d[_0x964d('0xdc')](_0x4d6c26)[_0x964d('0xc5')](loggerCatch(_0x964d('0x1e2')));if(_0xe756d[_0x964d('0x1bf')](0xb,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26[_0x964d('0x116')]>=_0x15606e[_0x964d('0x13a')]){_0xe756d[_0x964d('0x10d')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1e3'));}else{_0xe756d[_0x964d('0x10a')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1e3'));}}break;case'20':_0x15606e[_0x964d('0x71')]+=0x1;_0x4d6c26[_0x964d('0xf5')]=0x14;_0x4d6c26[_0x964d('0xb6')]=_0x964d('0x1e4');_0x4d6c26[_0x964d('0x108')]+=0x1;_0x4d6c26[_0x964d('0x101')]+=0x1;_0x21342d=_0x15606e[_0x964d('0x1cb')];_0x2213b2=_0x15606e[_0x964d('0x12e')];ami[_0x964d('0x57')](_0x964d('0x1e5'),ut[_0x964d('0xf9')](_0x529b53,'agentreject'));_0xe756d[_0x964d('0xdc')](_0x4d6c26)[_0x964d('0xc5')](loggerCatch(_0x964d('0x1e6')));if(_0xe756d[_0x964d('0x1bf')](0x14,_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26[_0x964d('0x108')]>=_0x15606e[_0x964d('0x1ca')]){_0xe756d['createStateFinal'](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1e7'));}else{_0xe756d['stateGlobal'](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x964d('0x1e7'));}}break;default:_0x15606e[_0x964d('0x72')]+=0x1;_0x4d6c26[_0x964d('0xf5')]=0xc;_0x4d6c26[_0x964d('0xb6')]=_0x1e47c4[_0x964d('0x11f')];_0x21342d=_0x15606e[_0x964d('0x1cb')];_0x2213b2=_0x15606e['callAdditionalPhoneAfterMin'];_0xe756d[_0x964d('0xdc')](_0x4d6c26)['catch'](loggerCatch(_0x964d('0x1e8')));if(_0xe756d[_0x964d('0x1bf')](_0x1e47c4['reason'],_0x529b53,_0x15606e)&&!_0x2d755c){if(_0x4d6c26['countbusyretry']+_0x4d6c26[_0x964d('0x104')]+_0x4d6c26[_0x964d('0x105')]+_0x4d6c26['countnosuchnumberretry']+_0x4d6c26['countdropretry']+_0x4d6c26[_0x964d('0x116')]+_0x4d6c26[_0x964d('0x100')]+_0x4d6c26['countagentrejectretry']>=_0x15606e[_0x964d('0x109')]){_0xe756d[_0x964d('0x10a')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x1e47c4[_0x964d('0x11f')]);}else{_0xe756d[_0x964d('0x10d')](_0x4d6c26,_0x58fd1a,_0x5615bd,_0x1e47c4[_0x964d('0x11f')]);}}}})[_0x964d('0x45')](function(){if(_0x2d755c){_0xe756d[_0x964d('0xca')](_0x4d6c26,_0x21342d,_0x2213b2)[_0x964d('0x45')](function(){return _0x58fd1a(0x1);});}});});};Dialer[_0x964d('0x1f')][_0x964d('0x10a')]=function(_0x599b6c,_0x54e07e,_0x4ad331,_0x3aa95b){var _0x21bfd6=new Final(_0x599b6c);_0x21bfd6['state']=0xf;_0x21bfd6[_0x964d('0xb6')]=_0x964d('0x1e9');this[_0x964d('0x10d')](_0x21bfd6,_0x54e07e,_0x4ad331,_0x3aa95b);};Dialer['prototype']['createStateFinal']=function(_0x402e5d,_0x1cad5f,_0xd18428,_0x3ab829){this[_0x964d('0xda')](_0x402e5d)[_0x964d('0x45')](function(){return _0x1cad5f(msgResponse('[callProgressDetecting]',_0x964d('0xe9'),_0x3ab829));})['catch'](function(){return _0xd18428(msgResponse(_0x964d('0x1ea'),_0x964d('0x15e'),_0x964d('0x1eb')));});};Dialer[_0x964d('0x1f')]['predictive']=function(_0x4fa83f){var _0x12e0d9=_0x4fa83f['dialPredictiveOptimizationPercentage']/0x64;var _0xbd0ec4=_0x4fa83f[_0x964d('0x6c')]/(_0x4fa83f['outboundDropCallsDayTimeout']+_0x4fa83f['outboundAnswerCallsDay']);var _0x17a905=Math[_0x964d('0x1ec')](_0x4fa83f[_0x964d('0x79')]*(_0x4fa83f[_0x964d('0x1ed')]/0x64));var _0x2656e5=Math[_0x964d('0x1ec')](_0x4fa83f[_0x964d('0x79')]*(_0x4fa83f[_0x964d('0x1ee')]/0x64));var _0x1598f1=_0x4fa83f[_0x964d('0xb1')]+_0x4fa83f['talking'];var _0x153483=Math[_0x964d('0x1ef')](_0x4fa83f[_0x964d('0x94')]*_0x4fa83f[_0x964d('0x7c')]*_0x4fa83f[_0x964d('0x77')]*_0x4fa83f[_0x964d('0x78')]);if(_[_0x964d('0x47')](_0x4fa83f[_0x964d('0x2e')])){if(!_[_0x964d('0x47')](_0x4fa83f['startPredictive'])){_0x4fa83f['startPredictive']=undefined;loggerPredictive['error'](_0x964d('0x1f0'),_0x964d('0x1f1'));}if(!_[_0x964d('0x47')](_0x4fa83f['handlePredictive'])){loggerPredictive[_0x964d('0xa5')](_0x964d('0x1f0'),_0x964d('0x1f2'));clearInterval(_0x4fa83f[_0x964d('0x9d')]);_0x4fa83f[_0x964d('0x9d')]=undefined;}_0x4fa83f[_0x964d('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x964d('0x84')](_0x4fa83f['name'],_0x964d('0x1f3'),_0x4fa83f[_0x964d('0x2e')]);this[_0x964d('0x172')](_0x4fa83f,0x1);}else if(ifInterval(_0x4fa83f[_0x964d('0x1f4')],_0x4fa83f['startProgressive'])){this[_0x964d('0x172')](_0x4fa83f,0x1);loggerPredictiveCalls[_0x964d('0x84')]('[startMethodPredictive][StartProgressive][Loop]',_0x4fa83f[_0x964d('0x2e')],_0x4fa83f[_0x964d('0x4a')]);_0x4fa83f['erlangCalls']=0x0;_0x4fa83f[_0x964d('0x76')]=0x0;}else if(_0x12e0d9<_0xbd0ec4&&_0x4fa83f[_0x964d('0x1f5')]==='dropRate'){freeVariablesPredictive(_0x4fa83f);loggerPredictive['info'](_0x964d('0x1f6'),_0x964d('0x1f7'),_0xbd0ec4,_0x964d('0x2e'),_0x4fa83f['name']);}else if(_0x153483<_0x4fa83f[_0x964d('0x76')]&&_0x4fa83f[_0x964d('0x1f5')]===_0x964d('0x1f8')){freeVariablesPredictive(_0x4fa83f);loggerPredictive[_0x964d('0x84')](_0x964d('0x1f9'),_0x964d('0x1fa'),_0x153483,'Drop\x20in\x20this\x20interval',_0x4fa83f[_0x964d('0x76')],'startProgressive',_0x4fa83f[_0x964d('0x4a')]);}else if(!ifInterval(_0x4fa83f[_0x964d('0x1f4')],_0x4fa83f[_0x964d('0x2e')])&&_['isUndefined'](_0x4fa83f[_0x964d('0x2d')])&&!_[_0x964d('0x47')](_0x4fa83f['startProgressive'])){_0x4fa83f['startPredictive']=moment()['format'](_0x964d('0x111'));loggerPredictive[_0x964d('0x84')](_0x4fa83f['name'],_0x964d('0x1fb'),_0x4fa83f['startPredictive']);this[_0x964d('0xcd')](_0x4fa83f[_0x964d('0x1f4')])[_0x964d('0x45')](this[_0x964d('0x1fc')](_0x4fa83f))[_0x964d('0x45')](mergeDataErlangB(_0x4fa83f))[_0x964d('0x45')](this[_0x964d('0x1fd')](_0x4fa83f))[_0x964d('0xc5')](loggerCatchPredictive(_0x964d('0x1fe'),_0x4fa83f));}else if(!ifInterval(_0x4fa83f['dialPredictiveInterval'],_0x4fa83f['startPredictive'])){_0x4fa83f[_0x964d('0x76')]=0x0;_0x4fa83f[_0x964d('0x2d')]=moment()['format'](_0x964d('0x111'));loggerPredictive[_0x964d('0x84')](_0x4fa83f[_0x964d('0x4a')],_0x964d('0x1ff'),_0x4fa83f[_0x964d('0x2d')]);clearInterval(_0x4fa83f[_0x964d('0x9d')]);_0x4fa83f[_0x964d('0x9d')]=undefined;this[_0x964d('0xcd')](_0x4fa83f[_0x964d('0x1f4')])['then'](this[_0x964d('0x1fc')](_0x4fa83f))['then'](mergeDataErlangB(_0x4fa83f))[_0x964d('0x45')](this[_0x964d('0x1fd')](_0x4fa83f))[_0x964d('0xc5')](loggerCatchPredictive(_0x964d('0x200'),_0x4fa83f));}else if(_0x4fa83f[_0x964d('0x79')]&&_0x1598f1<_0x4fa83f['predictiveIntervalAvailable']-_0x2656e5){freeVariablesPredictive(_0x4fa83f);loggerPredictive['info'](_0x4fa83f[_0x964d('0x4a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1598f1,_0x964d('0x201'),_0x4fa83f[_0x964d('0x79')],'-',_0x2656e5,'=',_0x4fa83f[_0x964d('0x79')]-_0x2656e5,')');}else if(_0x4fa83f[_0x964d('0x79')]&&_0x1598f1>_0x4fa83f[_0x964d('0x79')]+_0x17a905){freeVariablesPredictive(_0x4fa83f);loggerPredictive[_0x964d('0x84')](_0x4fa83f[_0x964d('0x4a')],_0x964d('0x202'),_0x1598f1,')\x20are\x20more\x20than\x20threshold\x20(',_0x4fa83f[_0x964d('0x79')],'+',_0x17a905,'=',_0x4fa83f[_0x964d('0x79')]+_0x17a905,')');}};Dialer['prototype'][_0x964d('0x1fc')]=function(_0x32e7da){var _0x1b5f32=this;return function(_0x2c9538){return new Promise(function(_0x3d7860,_0x45c64a){_[_0x964d('0x98')](_0x32e7da,_0x2c9538[0x0]);if(checkGetDataPredictive(_0x2c9538[0x0])){var _0x425e11=_0x32e7da['predictiveIntervalAvailable']=_0x32e7da[_0x964d('0x203')]+_0x32e7da['available'];var _0x420022=_0x32e7da['dialPredictiveInterval']*0x3c;var _0x39ca9f=_0x2c9538[0x0]['predictiveIntervalAvgTalktime']+_0x2c9538[0x0][_0x964d('0x8c')];var _0x5a9f7e=(_0x2c9538[0x0][_0x964d('0x88')]+_0x2c9538[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2c9538[0x0][_0x964d('0x74')])/_0x2c9538[0x0][_0x964d('0x7a')];_0x32e7da['predictiveIntervalHitRate']=_0x5a9f7e>0x0?_0x5a9f7e:0x1;switch(_0x32e7da['dialPredictiveOptimization']){case'dropRate':var _0x30c718=_0x32e7da['dialPredictiveOptimizationPercentage']/0x64;return _0x1b5f32[_0x964d('0x204')](_0x425e11,_0x420022,_0x39ca9f,_0x5a9f7e,_0x30c718)[_0x964d('0x45')](function(_0x3b3315){return _0x3d7860(_0x3b3315);});case _0x964d('0x205'):var _0xe33a1a=_0x32e7da[_0x964d('0x206')]/0x64;return _0x1b5f32['busyFactor'](_0x425e11,_0x420022,_0x39ca9f,_0x5a9f7e,_0xe33a1a)[_0x964d('0x45')](function(_0x3922de){return _0x3d7860(_0x3922de);});default:return _0x45c64a(msgResponse(_0x964d('0x207'),_0x964d('0x15e'),_0x964d('0x208')));}}else{return _0x45c64a(msgResponse('[getDataPredictive]','Failure',_0x964d('0x209')));}});};};Dialer['prototype'][_0x964d('0x20a')]=function(_0x23fd52){var _0x261a06=this;return function(_0x13698e){return new Promise(function(_0x8155a8,_0x5816f4){_['merge'](_0x23fd52,_0x13698e[0x0]);if(checkGetDataPredictive(_0x13698e[0x0])){loggerPredictive[_0x964d('0x84')](JSON['stringify'](_0x13698e[0x0]));if(_0x23fd52[_0x964d('0x1f5')]==='dropRate'){return _0x261a06[_0x964d('0xd8')](_0x23fd52['id'])[_0x964d('0x45')](function(_0x55407e){var _0x272809=_0x23fd52[_0x964d('0x17c')]-_0x55407e[0x0][_0x964d('0x20b')];var _0x12d302=_0x23fd52[_0x964d('0x1f4')]*0x3c;var _0xa1a289=_0x13698e[0x0][_0x964d('0x73')]+_0x13698e[0x0]['predictiveIntervalAvgHoldtime'];var _0x58ffa8=(_0x13698e[0x0][_0x964d('0x88')]+_0x13698e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x13698e[0x0][_0x964d('0x74')])/_0x13698e[0x0][_0x964d('0x7a')];var _0x258af8=_0x23fd52['dialPredictiveOptimizationPercentage']/0x64;_0x23fd52[_0x964d('0x20c')]=_0x55407e[0x0]['outboundQueuePauses']||0x0;_0x23fd52[_0x964d('0x77')]=_0x58ffa8>0x0?_0x58ffa8:0x1;return _0x261a06[_0x964d('0x204')](_0x272809,_0x12d302,_0xa1a289,_0x58ffa8,_0x258af8);})[_0x964d('0x45')](function(_0x2bc285){return _0x8155a8(_0x2bc285);})[_0x964d('0xc5')](function(_0x153d2f){return _0x5816f4(msgResponse('[CatchErlangB]',_0x964d('0x15e'),JSON['stringify'](_0x153d2f)));});}if(_0x23fd52['dialPredictiveOptimization']===_0x964d('0x205')){return _0x261a06[_0x964d('0xd8')](_0x23fd52['id'])[_0x964d('0x45')](function(_0x1ef346){var _0x462bcb=_0x23fd52[_0x964d('0x17c')]-_0x1ef346[0x0][_0x964d('0x20b')];var _0x4b9d29=_0x23fd52[_0x964d('0x1f4')]*0x3c;var _0x5f3116=_0x13698e[0x0]['predictiveIntervalAvgTalktime']+_0x13698e[0x0][_0x964d('0x8c')];var _0x3e063f=(_0x13698e[0x0][_0x964d('0x88')]+_0x13698e[0x0][_0x964d('0x129')]+_0x13698e[0x0][_0x964d('0x74')])/_0x13698e[0x0][_0x964d('0x7a')];var _0x58c9ec=_0x23fd52[_0x964d('0x206')]/0x64;_0x23fd52[_0x964d('0x20c')]=_0x1ef346[0x0][_0x964d('0x20b')]||0x0;_0x23fd52[_0x964d('0x77')]=_0x3e063f>0x0?_0x3e063f:0x1;return _0x261a06[_0x964d('0x20d')](_0x462bcb,_0x4b9d29,_0x5f3116,_0x3e063f,_0x58c9ec);})['then'](function(_0x5431fa){return _0x8155a8(_0x5431fa);})['catch'](function(_0x10b339){return _0x5816f4(msgResponse(_0x964d('0x20e'),_0x964d('0x15e'),JSON['stringify'](_0x10b339)));});}}else{return _0x5816f4(msgResponse('[getDataPredictive]',_0x964d('0x15e'),_0x964d('0x209')));}});};};Dialer[_0x964d('0x1f')][_0x964d('0x1fd')]=function(_0x5457e5){var _0x2e23da=this;return function(){var _0x459cad=0x0;var _0x36849d=Math[_0x964d('0x1ef')](_0x5457e5[_0x964d('0x20f')]*0x3e8);if(_0x36849d>0x0){_0x36849d=_0x36849d<0x64?0x64:_0x36849d;loggerPredictive['info'](_0x5457e5[_0x964d('0x4a')],_0x964d('0x210'),_0x36849d,_0x964d('0x99'));_0x5457e5[_0x964d('0x9d')]=setInterval(function(){_0x2e23da[_0x964d('0x9d')](_0x5457e5);loggerPredictiveCalls[_0x964d('0x84')]('[handlePredictive]',_0x459cad+=0x1);},_0x36849d);}else{loggerPredictive['info'](_0x5457e5[_0x964d('0x4a')],_0x964d('0x211'));}};};Dialer[_0x964d('0x1f')][_0x964d('0x212')]=function(_0x4fbda3,_0x34ba3c){var _0x3f9075=this;return function(_0x297286){if(_[_0x964d('0x52')](_0x297286)){if(_[_0x964d('0xba')](_0x34ba3c['UserId'])||!_0x34ba3c[_0x964d('0x213')]){if(_0x4fbda3['dialMethod']===_0x964d('0x9')){_0x4fbda3[_0x964d('0x146')]=_[_0x964d('0x47')](_0x4fbda3[_0x964d('0x146')])?!![]:_0x4fbda3[_0x964d('0x146')];var _0x23f7cd=uuid['v4']();_0x3f9075[_0x964d('0x29')][_0x23f7cd]=new Action(_0x4fbda3,_0x34ba3c,_0x23f7cd);loggerBooked[_0x964d('0x84')](_0x964d('0x214'),_0x23f7cd,_0x964d('0x215'),JSON[_0x964d('0x55')](_0x4fbda3[_0x964d('0x146')]),_0x964d('0x216'),_0x4fbda3[_0x964d('0x4a')]);if(_0x4fbda3[_0x964d('0x146')]){_0x4fbda3['queueStatusComplete']=![];_0x3f9075[_0x964d('0x30')][_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xc1')]]=[];ami['Action']({'actionid':_0x23f7cd,'action':_0x964d('0x217'),'queue':_0x4fbda3[_0x964d('0x4a')]})['catch'](function(){_0x3f9075[_0x964d('0xbf')](_0x4fbda3);_0x3f9075[_0x964d('0xd0')]({'active':![],'ContactId':_0x3f9075['actions'][_0x23f7cd][_0x964d('0xe4')],'ListId':_0x3f9075['actions'][_0x23f7cd]['ListId'],'VoiceQueueId':_0x3f9075['actions'][_0x23f7cd]['VoiceQueueId']||undefined,'CampaignId':_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch(_0x964d('0x218')));delete _0x3f9075[_0x964d('0x29')][_0x23f7cd];});}else{loggerBooked[_0x964d('0x84')](_0x964d('0x219'),JSON[_0x964d('0x55')](_0x4fbda3['queueStatusComplete']),_0x964d('0x216'),_0x4fbda3[_0x964d('0x4a')]);_0x3f9075[_0x964d('0xbf')](_0x4fbda3);_0x3f9075['rescheduleContact']({'active':![],'ContactId':_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xe4')],'ListId':_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xe5')],'VoiceQueueId':_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xe6')]||undefined,'CampaignId':_0x3f9075[_0x964d('0x29')][_0x23f7cd][_0x964d('0xe7')]||undefined})[_0x964d('0xc5')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x3f9075['actions'][_0x23f7cd];}}else{return _0x3f9075['actionOriginate'](_0x4fbda3,_0x34ba3c);}}else{if(getDiff(_0x34ba3c[_0x964d('0x21a')])<_0x4fbda3[_0x964d('0x21b')]*0x3c){if(_0x34ba3c[_0x964d('0x185')]&&!_0x34ba3c[_0x964d('0x185')][_0x964d('0x21c')]){_0x3f9075['preview']['run'](_0x34ba3c['id'])[_0x964d('0x22')](function(){_0x3f9075[_0x964d('0xbf')](_0x4fbda3);});}else{_0x3f9075['unlockContact']({'active':![]},_0x34ba3c['id'],0x1)[_0x964d('0x22')](function(){_0x3f9075[_0x964d('0xbf')](_0x4fbda3);});}}else{_0x4fbda3[_0x964d('0x70')]+=0x1;_0x3f9075[_0x964d('0xbf')](_0x4fbda3);if(_0x4fbda3[_0x964d('0x21d')]){_0x3f9075[_0x964d('0xd0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x34ba3c[_0x964d('0xe4')],'ListId':_0x34ba3c[_0x964d('0xe5')],'VoiceQueueId':_0x34ba3c[_0x964d('0xe6')]||undefined,'CampaignId':_0x34ba3c[_0x964d('0xe7')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3f9075['createHistory'](createObjHistory(_0x4fbda3,_0x34ba3c,_0x964d('0x21e'),0x17,'RecallInQueue'))[_0x964d('0xc5')](loggerCatch(_0x964d('0x21f')));}else{_0x3f9075[_0x964d('0xed')](createObjHistory(_0x4fbda3,_0x34ba3c,_0x964d('0x220'),0x16,'RecallFailedTimeout'),_0x964d('0x221'),_0x964d('0x222'));}}}}else{_0x4fbda3[_0x964d('0x68')]+=0x1;_0x3f9075['saveInDb'](createObjHistory(_0x4fbda3,_0x34ba3c,_0x964d('0x223'),0xd,_0x964d('0x224')),_0x964d('0x225'),_0x964d('0x226'));throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x2b06bc){var _0x34ef9a=this;var _0x54094f=_0x2b06bc[_0x964d('0x227')]-_0x2b06bc['originated']-_0x2b06bc[_0x964d('0xd4')];emitCampaignSummary(_0x2b06bc);if(_0x54094f>0x0){if(_0x54094f>this['maxNumberOriginate']){_0x54094f=this[_0x964d('0x27')];}_0x2b06bc[_0x964d('0xd4')]+=_0x54094f;this['getContactDialerIvr'](_0x2b06bc['id'],_0x54094f,_0x2b06bc[_0x964d('0x228')],_0x2b06bc)[_0x964d('0x45')](function(_0x201f47){_0x2b06bc[_0x964d('0xd4')]-=_0x54094f;_0x2b06bc[_0x964d('0xd4')]=_0x2b06bc['temp']>0x0?_0x2b06bc[_0x964d('0xd4')]:0x0;if(!checkContactEmpty(_0x201f47)){_0x2b06bc['message']=_0x964d('0xae');logger[_0x964d('0x84')](_0x964d('0x229')+_0x2b06bc[_0x964d('0x4a')]);}else{_0x2b06bc[_0x964d('0x7b')]+=_0x201f47[_0x964d('0xa6')];_0x2b06bc[_0x964d('0x48')]=_0x964d('0x22a');for(var _0xb51f4=0x0;_0xb51f4<_0x201f47['length'];_0xb51f4+=0x1){_0x2b06bc[_0x964d('0x22b')]+=0x1;if(_[_0x964d('0xba')](_0x201f47[_0xb51f4])||_[_0x964d('0xba')](_0x201f47[_0xb51f4]['Contact'])||_[_0x964d('0xba')](_0x201f47[_0xb51f4][_0x964d('0x191')])){_0x34ef9a[_0x964d('0xe1')]('[actionOriginate]\x20',_0x2b06bc,_0x201f47[_0xb51f4]);}else{_0x34ef9a[_0x964d('0x22c')](_[_0x964d('0xe3')](_0x201f47[_0xb51f4],['CampaignId',_0x964d('0x191')]))[_0x964d('0x45')](_0x34ef9a[_0x964d('0x212')](_0x2b06bc,_0x201f47[_0xb51f4]))[_0x964d('0xc5')](_0x34ef9a[_0x964d('0xe0')](_0x964d('0x22d'),_0x2b06bc));}}}})[_0x964d('0xc5')](loggerGetContactDialer('[getContactCampaign2]',_0x2b06bc,_0x54094f));}};Dialer['prototype'][_0x964d('0x172')]=function(_0x5852ff,_0x3afc72){var _0x490815=this;var _0x81dc21=[];var _0x2a490b=_0x3afc72>=0x1?_0x3afc72:0x1;if(_0x5852ff[_0x964d('0x63')]===_0x964d('0x9')){_0x2a490b=0x1;}var _0x57da0b=Math[_0x964d('0x1ef')](_0x5852ff['available']*_0x2a490b)-_0x5852ff[_0x964d('0x7b')]-_0x5852ff[_0x964d('0xd4')];emitVoiceQueueSummary(_0x5852ff);if(_0x5852ff[_0x964d('0x22e')]>0x0){var _0x2dd2fe=_0x5852ff[_0x964d('0x22e')]-_0x5852ff[_0x964d('0x7b')]-_0x5852ff[_0x964d('0x203')]-_0x5852ff[_0x964d('0xd4')]-_0x5852ff[_0x964d('0x5c')];if(_0x57da0b>_0x2dd2fe){_0x57da0b=_0x2dd2fe;}}if(_0x57da0b>0x0){if(_0x5852ff[_0x964d('0x63')]===_0x964d('0x9')){_0x57da0b=0x1;}if(_0x57da0b>this[_0x964d('0x27')]){_0x57da0b=this[_0x964d('0x27')];}_0x5852ff['temp']+=_0x57da0b;for(var _0x5182b3 in this[_0x964d('0x142')]){if(typeof this[_0x964d('0x142')][_0x5182b3]!==_0x964d('0xa7')){if(this['agents'][_0x5182b3][_0x964d('0xf5')]==='not_inuse'&&this[_0x964d('0x142')][_0x5182b3][_0x964d('0xbc')]===_0x964d('0xeb')){_0x81dc21[_0x964d('0x144')](this[_0x964d('0x142')][_0x5182b3]['id']);}}}this[_0x964d('0xd3')](_0x5852ff['id'],_0x81dc21,_0x57da0b,_0x5852ff[_0x964d('0x228')],_0x5852ff)[_0x964d('0x45')](function(_0x2fb616){_0x5852ff[_0x964d('0xd4')]-=_0x57da0b;_0x5852ff[_0x964d('0xd4')]=_0x5852ff[_0x964d('0xd4')]>0x0?_0x5852ff[_0x964d('0xd4')]:0x0;if(!checkContactEmpty(_0x2fb616)){_0x490815['countReScheduled'](_0x5852ff)[_0x964d('0x45')](sendMessageReschedule(_0x5852ff))[_0x964d('0xc5')](loggerCatch(_0x964d('0x22f')));}else{_0x5852ff[_0x964d('0x7b')]+=_0x2fb616[_0x964d('0xa6')];_0x5852ff[_0x964d('0x48')]=_0x5852ff[_0x964d('0x63')]==='booked'?_0x964d('0x230'):_0x964d('0x22a');for(var _0x3eca8b=0x0;_0x3eca8b<_0x2fb616[_0x964d('0xa6')];_0x3eca8b+=0x1){if(_[_0x964d('0xba')](_0x2fb616[_0x3eca8b])||_['isNil'](_0x2fb616[_0x3eca8b][_0x964d('0x1a5')])||_[_0x964d('0xba')](_0x2fb616[_0x3eca8b][_0x964d('0x191')])){_0x490815[_0x964d('0xe1')](_0x964d('0x231'),_0x5852ff,_0x2fb616[_0x3eca8b]);}else{_0x490815['checkIsBlackList'](_[_0x964d('0xe3')](_0x2fb616[_0x3eca8b],[_0x964d('0xe6'),_0x964d('0x191')]))['then'](_0x490815['checkContactBlack'](_0x5852ff,_0x2fb616[_0x3eca8b]))[_0x964d('0xc5')](_0x490815[_0x964d('0xe0')]('[actionOriginate]\x20',_0x5852ff));}}}})[_0x964d('0xc5')](loggerGetContactDialer(_0x964d('0x232'),_0x5852ff,_0x57da0b));}};Dialer[_0x964d('0x1f')][_0x964d('0x9d')]=function(_0x3593e0){if(_0x3593e0[_0x964d('0x22e')]>0x0){var _0xab6ddd=_0x3593e0[_0x964d('0x22e')]-_0x3593e0[_0x964d('0x7b')]-_0x3593e0[_0x964d('0x203')];if(_0xab6ddd>0x0){this['tryOriginatePredictive'](_0x3593e0);}else{loggerPredictiveCalls['info'](_0x964d('0x233'));}}else{this[_0x964d('0x234')](_0x3593e0);}};Dialer[_0x964d('0x1f')][_0x964d('0x234')]=function(_0x3060dd){var _0x26ce3a=this;var _0x2455b7=[];_0x3060dd[_0x964d('0x7b')]+=0x1;for(var _0x1d3c22 in this[_0x964d('0x142')]){if(typeof this[_0x964d('0x142')][_0x1d3c22]!==_0x964d('0xa7')){if(this[_0x964d('0x142')][_0x1d3c22][_0x964d('0xf5')]===_0x964d('0x235')&&this[_0x964d('0x142')][_0x1d3c22]['status']==='reachable'){_0x2455b7[_0x964d('0x144')](this[_0x964d('0x142')][_0x1d3c22]['id']);}}}this['getContactDialer'](_0x3060dd['id'],_0x2455b7,0x1,_0x3060dd['dialOrderByScheduledAt'],_0x3060dd)[_0x964d('0x45')](function(_0x1d20bf){if(!checkContactEmpty(_0x1d20bf)){checkContactLowerLimitOriginate(_0x3060dd,0x1,0x0);_0x26ce3a[_0x964d('0xc3')](_0x3060dd)[_0x964d('0x45')](sendMessageReschedule(_0x3060dd))['catch'](loggerCatch(_0x964d('0x22f')));}else{_0x3060dd[_0x964d('0x48')]=_0x964d('0x22a');if(_['isNil'](_0x1d20bf[0x0])||_['isNil'](_0x1d20bf[0x0][_0x964d('0x1a5')])||_[_0x964d('0xba')](_0x1d20bf[0x0]['phone'])){_0x26ce3a['emptyContact'](_0x964d('0x231'),_0x3060dd,_0x1d20bf[0x0]);}else{_0x26ce3a[_0x964d('0xc6')](_[_0x964d('0xe3')](_0x1d20bf[0x0],[_0x964d('0xe6'),_0x964d('0x191')]))[_0x964d('0x45')](_0x26ce3a[_0x964d('0x212')](_0x3060dd,_0x1d20bf[0x0]))[_0x964d('0xc5')](_0x26ce3a[_0x964d('0xe0')](_0x964d('0x236'),_0x3060dd));}}})[_0x964d('0xc5')](loggerGetContactDialer(_0x964d('0x237'),_0x3060dd,0x1));emitVoiceQueueSummary(_0x3060dd);};Dialer[_0x964d('0x1f')]['abandonmentRate']=function(_0x141c6c,_0x52dd24,_0x26075d,_0x1e3572,_0x28faa7,_0x50074){loggerPredictive[_0x964d('0x84')](_0x964d('0x238'));loggerPredictive[_0x964d('0x84')](_0x964d('0x239'),_0x141c6c);loggerPredictive[_0x964d('0x84')](_0x964d('0x23a'),_0x52dd24);loggerPredictive[_0x964d('0x84')](_0x964d('0x23b'),_0x26075d);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',_0x1e3572);loggerPredictive[_0x964d('0x84')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28faa7);loggerPredictive[_0x964d('0x84')](_0x964d('0x8e'));return new Promise(function(_0x532324,_0xbee861){if(_0x141c6c<=0x0||isNaN(_0x141c6c)){return _0xbee861(msgResponse(_0x964d('0x23c'),'Error',_0x964d('0x23d')+_0x141c6c));}if(_0x26075d<=0x0||isNaN(_0x26075d)){return _0xbee861(msgResponse(_0x964d('0x23c'),_0x964d('0x54'),_0x964d('0x23e')+_0x26075d));}if(_0x1e3572<=0x0||isNaN(_0x1e3572)){return _0xbee861(msgResponse('[abandonmentRate]',_0x964d('0x54'),'p\x20=\x20'+_0x1e3572));}if(_0x52dd24<=0x0||isNaN(_0x52dd24)){return _0xbee861(msgResponse(_0x964d('0x23c'),_0x964d('0x54'),_0x964d('0x23f')+_0x52dd24));}if(_0x28faa7<=0x0||isNaN(_0x28faa7)){return _0xbee861(msgResponse(_0x964d('0x23c'),_0x964d('0x54'),_0x964d('0x240')+_0x28faa7));}_0x50074=_0x50074||0x0;var _0x2489e0=0x1/_0x26075d;var _0x1eaea8=0x0;var _0x4f20a4=0x0;var _0x447503=0x0;var _0x360937=0x0;for(var _0x3a6522=0x0;_0x447503<_0x28faa7;_0x3a6522+=0x1){_0x4f20a4=_0x3a6522/_0x52dd24;_0x1eaea8=(_0x1e3572*_0x4f20a4+_0x50074)/_0x2489e0;_0x447503=erlangb(_0x1eaea8,_0x141c6c);_0x360937=_0x1eaea8/_0x141c6c*(0x1-erlangb(_0x1eaea8,_0x141c6c));}return _0x532324({'erlangCalls':_0x3a6522,'erlangCallToSecond':_0x52dd24/_0x3a6522,'erlangAbandonmentRate':_0x447503,'erlangBusyFactor':_0x360937});});};Dialer['prototype']['busyFactor']=function(_0x297319,_0x3180a8,_0x3c21dd,_0x1e4d4f,_0x5c1a90,_0x7e128c){loggerPredictive[_0x964d('0x84')](_0x964d('0x241'));loggerPredictive[_0x964d('0x84')](_0x964d('0x239'),_0x297319);loggerPredictive[_0x964d('0x84')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3180a8);loggerPredictive[_0x964d('0x84')](_0x964d('0x23b'),_0x3c21dd);loggerPredictive[_0x964d('0x84')](_0x964d('0x242'),_0x1e4d4f);loggerPredictive[_0x964d('0x84')](_0x964d('0x243'),_0x5c1a90);loggerPredictive[_0x964d('0x84')](_0x964d('0x8e'));return new Promise(function(_0x179eca,_0x54def1){if(_0x297319<=0x0||isNaN(_0x297319)){return _0x54def1(msgResponse('[busyFactor]','Error',_0x964d('0x23d')+_0x297319));}if(_0x3c21dd<=0x0||isNaN(_0x3c21dd)){return _0x54def1(msgResponse('[busyFactor]',_0x964d('0x54'),_0x964d('0x23e')+_0x3c21dd));}if(_0x1e4d4f<=0x0||isNaN(_0x1e4d4f)){return _0x54def1(msgResponse('[busyFactor]',_0x964d('0x54'),_0x964d('0x244')+_0x1e4d4f));}if(_0x3180a8<=0x0||isNaN(_0x3180a8)){return _0x54def1(msgResponse(_0x964d('0x245'),_0x964d('0x54'),_0x964d('0x23f')+_0x3180a8));}if(_0x5c1a90<=0x0||isNaN(_0x5c1a90)){return _0x54def1(msgResponse(_0x964d('0x245'),_0x964d('0x54'),'Umin\x20=\x20'+_0x5c1a90));}_0x7e128c=_0x7e128c||0x0;var _0x56c7e8=0x1/_0x3c21dd;var _0x29adc3=0x0;var _0x560e0b=0x0;var _0xf4541e=0x0;var _0xddcd4e=0x0;for(var _0x3a91bb=0x0;_0xddcd4e<_0x5c1a90;_0x3a91bb+=0x1){_0x560e0b=_0x3a91bb/_0x3180a8;_0x29adc3=(_0x1e4d4f*_0x560e0b+_0x7e128c)/_0x56c7e8;_0xf4541e=erlangb(_0x29adc3,_0x297319);_0xddcd4e=_0x29adc3/_0x297319*(0x1-erlangb(_0x29adc3,_0x297319));}return _0x179eca({'erlangCalls':_0x3a91bb,'erlangCallToSecond':_0x3180a8/_0x3a91bb,'erlangAbandonmentRate':_0xf4541e,'erlangBusyFactor':_0xddcd4e});});};module[_0x964d('0x246')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 69208d0..1d943f7 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 _0x901b=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId'];(function(_0xf3b124,_0x5bd998){var _0x16aa63=function(_0x25a72b){while(--_0x25a72b){_0xf3b124['push'](_0xf3b124['shift']());}};_0x16aa63(++_0x5bd998);}(_0x901b,0x15d));var _0xb901=function(_0x2593ee,_0x555ca3){_0x2593ee=_0x2593ee-0x0;var _0x236ca3=_0x901b[_0x2593ee];return _0x236ca3;};'use strict';var util=require(_0xb901('0x0'));var _=require(_0xb901('0x1'));var moment=require(_0xb901('0x2'));function getSeconds(_0x35836b,_0x29a572){var _0x409e6f=moment(_0x35836b)['milliseconds'](0x0);var _0x559b35=moment(_0x29a572)[_0xb901('0x3')](0x0);return _0x409e6f[_0xb901('0x4')](_0x559b35,'seconds');}function QueueCallerAbandon(_0x365754,_0x3975de){this[_0xb901('0x5')]=_0x365754[_0xb901('0x5')];this[_0xb901('0x6')]=_0x365754[_0xb901('0x6')];this[_0xb901('0x7')]=_0x365754[_0xb901('0x6')]===_0xb901('0x8')?_0xb901('0x9'):_0x365754[_0xb901('0x6')];this['countbusyretry']=_0x365754[_0xb901('0xa')];this['countcongestionretry']=_0x365754[_0xb901('0xb')];this[_0xb901('0xc')]=_0x365754[_0xb901('0xc')];this[_0xb901('0xd')]=_0x365754[_0xb901('0xa')]+_0x365754[_0xb901('0xb')]+_0x365754[_0xb901('0xc')]+_0x365754[_0xb901('0xe')]+_0x365754[_0xb901('0xf')]+_0x365754[_0xb901('0x10')]+_0x365754[_0xb901('0x11')]+_0x365754[_0xb901('0x12')];this['countnosuchnumberretry']=_0x365754[_0xb901('0xe')];this[_0xb901('0xf')]=_0x365754[_0xb901('0xf')];this[_0xb901('0x10')]=_0x365754[_0xb901('0x10')];this[_0xb901('0x11')]=_0x365754[_0xb901('0x11')];this[_0xb901('0x12')]=_0x365754[_0xb901('0x12')];this[_0xb901('0x13')]=_0x3975de['uniqueid'];this[_0xb901('0x14')]=_0x365754[_0xb901('0x15')];this[_0xb901('0x16')]=_0x365754[_0xb901('0x17')];this['starttime']=_0x365754[_0xb901('0x18')];this[_0xb901('0x19')]=_0x365754[_0xb901('0x19')];this[_0xb901('0x1a')]=_0x365754[_0xb901('0x1a')];this[_0xb901('0x1b')]=this[_0xb901('0x1a')];this[_0xb901('0x1c')]=getSeconds(_0x365754[_0xb901('0x19')],_0x365754['starttime']);this[_0xb901('0x1d')]=getSeconds(this[_0xb901('0x1a')],_0x365754[_0xb901('0x19')]);this['talktime']=0x0;this[_0xb901('0x9')]=_0x3975de[_0xb901('0x9')];this[_0xb901('0x1e')]=_0x3975de['connectedlinename'];this[_0xb901('0x1f')]=_0x3975de['reason'];this[_0xb901('0x20')]=_0x365754[_0xb901('0x20')];this[_0xb901('0x21')]=_0x365754[_0xb901('0x21')];this['callbackat']=_0x365754['callbackat'];this[_0xb901('0x22')]=_0x365754[_0xb901('0x22')];this[_0xb901('0x23')]=_0x365754[_0xb901('0x23')];this[_0xb901('0x24')]=_0x365754[_0xb901('0x24')];this[_0xb901('0x25')]=_0x365754['UserId'];this[_0xb901('0x26')]=_0x365754[_0xb901('0x26')];this[_0xb901('0x27')]=_0x365754[_0xb901('0x27')];this[_0xb901('0x28')]=_0x365754[_0xb901('0x28')]||'';this[_0xb901('0x29')]=_0x365754['originatecalleridname']||'';}module[_0xb901('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xcd3a=['ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xcd3a,0x8e));var _0xacd3=function(_0x10ae24,_0xf16609){_0x10ae24=_0x10ae24-0x0;var _0x1b0f78=_0xcd3a[_0x10ae24];return _0x1b0f78;};'use strict';var util=require('util');var _=require(_0xacd3('0x0'));var moment=require(_0xacd3('0x1'));function getSeconds(_0x277b50,_0x772b79){var _0x422157=moment(_0x277b50)[_0xacd3('0x2')](0x0);var _0x3f1da3=moment(_0x772b79)[_0xacd3('0x2')](0x0);return _0x422157[_0xacd3('0x3')](_0x3f1da3,'seconds');}function QueueCallerAbandon(_0x38a440,_0x3ea033){this[_0xacd3('0x4')]=_0x38a440[_0xacd3('0x4')];this[_0xacd3('0x5')]=_0x38a440['type'];this[_0xacd3('0x6')]=_0x38a440[_0xacd3('0x5')]===_0xacd3('0x7')?_0xacd3('0x8'):_0x38a440['type'];this[_0xacd3('0x9')]=_0x38a440['countbusyretry'];this[_0xacd3('0xa')]=_0x38a440[_0xacd3('0xa')];this[_0xacd3('0xb')]=_0x38a440[_0xacd3('0xb')];this[_0xacd3('0xc')]=_0x38a440[_0xacd3('0x9')]+_0x38a440[_0xacd3('0xa')]+_0x38a440[_0xacd3('0xb')]+_0x38a440[_0xacd3('0xd')]+_0x38a440[_0xacd3('0xe')]+_0x38a440[_0xacd3('0xf')]+_0x38a440['countmachineretry']+_0x38a440[_0xacd3('0x10')];this[_0xacd3('0xd')]=_0x38a440[_0xacd3('0xd')];this[_0xacd3('0xe')]=_0x38a440[_0xacd3('0xe')];this[_0xacd3('0xf')]=_0x38a440[_0xacd3('0xf')];this[_0xacd3('0x11')]=_0x38a440[_0xacd3('0x11')];this['countagentrejectretry']=_0x38a440[_0xacd3('0x10')];this[_0xacd3('0x12')]=_0x3ea033[_0xacd3('0x12')];this['calleridname']=_0x38a440[_0xacd3('0x13')];this[_0xacd3('0x14')]=_0x38a440[_0xacd3('0x15')];this[_0xacd3('0x16')]=_0x38a440[_0xacd3('0x16')];this[_0xacd3('0x17')]=_0x38a440[_0xacd3('0x17')];this['droptime']=_0x38a440[_0xacd3('0x18')];this[_0xacd3('0x19')]=this[_0xacd3('0x18')];this[_0xacd3('0x1a')]=getSeconds(_0x38a440[_0xacd3('0x17')],_0x38a440[_0xacd3('0x16')]);this['holdtime']=getSeconds(this[_0xacd3('0x18')],_0x38a440['responsetime']);this[_0xacd3('0x1b')]=0x0;this[_0xacd3('0x8')]=_0x3ea033[_0xacd3('0x8')];this['membername']=_0x3ea033[_0xacd3('0x1c')];this[_0xacd3('0x1d')]=_0x3ea033[_0xacd3('0x1d')];this[_0xacd3('0x1e')]=_0x38a440[_0xacd3('0x1e')];this[_0xacd3('0x1f')]=_0x38a440[_0xacd3('0x1f')];this[_0xacd3('0x20')]=_0x38a440[_0xacd3('0x20')];this[_0xacd3('0x21')]=_0x38a440[_0xacd3('0x21')];this[_0xacd3('0x22')]=_0x38a440['ContactId'];this[_0xacd3('0x23')]=_0x38a440[_0xacd3('0x23')];this[_0xacd3('0x24')]=_0x38a440[_0xacd3('0x24')];this[_0xacd3('0x25')]=_0x38a440[_0xacd3('0x25')];this[_0xacd3('0x26')]=_0x38a440[_0xacd3('0x26')];this[_0xacd3('0x27')]=_0x38a440[_0xacd3('0x27')]||'';this[_0xacd3('0x28')]=_0x38a440[_0xacd3('0x28')]||'';}module[_0xacd3('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 05d1d52..42ddcf9 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(_0x3a37a3,_0x3a74e6){var _0x19434d=function(_0x1f2a7f){while(--_0x1f2a7f){_0x3a37a3['push'](_0x3a37a3['shift']());}};_0x19434d(++_0x3a74e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x135337,_0x32a3bc){var _0x4e33ea=function(_0xc474b5){while(--_0xc474b5){_0x135337['push'](_0x135337['shift']());}};_0x4e33ea(++_0x32a3bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 9ccf18e..7658235 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 _0xa4ce=['stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SENDING\x20FAILED:\x20','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','XMF-PATH','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./util/util','./action','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error'];(function(_0x56e711,_0x5917c8){var _0x1cf38f=function(_0x145210){while(--_0x145210){_0x56e711['push'](_0x56e711['shift']());}};_0x1cf38f(++_0x5917c8);}(_0xa4ce,0x193));var _0xea4c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa4ce[_0x1ac595];return _0x455fff;};'use strict';var util=require(_0xea4c('0x0'));var _=require(_0xea4c('0x1'));var BPromise=require(_0xea4c('0x2'));var uuid=require(_0xea4c('0x3'));var moment=require(_0xea4c('0x4'));var path=require(_0xea4c('0x5'));var tiff2pdf=require(_0xea4c('0x6'));var gs=require(_0xea4c('0x7'));var logger=require(_0xea4c('0x8'))(_0xea4c('0x9'));var ami=require('../ami');var rpcDb=require(_0xea4c('0xa'));var Channel=require('./channel');var ut=require(_0xea4c('0xb'));var Action=require(_0xea4c('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0xea4c('0xd'));function Fax(_0x4276a7){this[_0xea4c('0xe')]={};this[_0xea4c('0xf')]=_0x4276a7[_0xea4c('0xf')];this[_0xea4c('0x10')]=_0x4276a7['trunks'];this[_0xea4c('0x11')]={};ami['on'](_0xea4c('0x12'),this[_0xea4c('0x13')][_0xea4c('0x14')](this));ami['on']('varset',this[_0xea4c('0x15')]['bind'](this));ami['on'](_0xea4c('0x16'),this[_0xea4c('0x17')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x18'),this[_0xea4c('0x19')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1a'),this[_0xea4c('0x1b')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1c'),this[_0xea4c('0x1d')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x1e'),this[_0xea4c('0x1f')][_0xea4c('0x14')](this));ami['on'](_0xea4c('0x20'),this[_0xea4c('0x21')][_0xea4c('0x14')](this));}Fax[_0xea4c('0x22')][_0xea4c('0x13')]=function(_0x55ff64){if(_0x55ff64[_0xea4c('0x23')]===_0xea4c('0x24')){for(var _0x422795 in this[_0xea4c('0xf')]){if(this[_0xea4c('0xf')]['hasOwnProperty'](_0x422795)){if(_0x55ff64[_0xea4c('0x25')]===this[_0xea4c('0xf')][_0x422795][_0xea4c('0x26')]){this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]]={};this['channels'][_0x55ff64['uniqueid']][_0xea4c('0x28')]=_0x55ff64[_0xea4c('0x28')];this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]]['id']=this[_0xea4c('0xf')][_0x422795]['id'];this['channels'][_0x55ff64['uniqueid']][_0xea4c('0x29')]=this[_0xea4c('0xf')][_0x422795][_0xea4c('0x29')];logger[_0xea4c('0x2a')](_0x55ff64[_0xea4c('0x27')],_0xea4c('0x2b'));}}}}if(this[_0xea4c('0x11')][_0x55ff64[_0xea4c('0x27')]]){this['channels'][_0x55ff64[_0xea4c('0x27')]]={};this[_0xea4c('0xe')][_0x55ff64[_0xea4c('0x27')]][_0xea4c('0x28')]=_0x55ff64['channel'];logger[_0xea4c('0x2a')](_0x55ff64['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0xea4c('0x22')][_0xea4c('0x15')]=function(_0x5c71e7){if(this['channels'][_0x5c71e7[_0xea4c('0x27')]]){for(var _0x4241c3 in _0x5c71e7[_0xea4c('0x2c')]){if(_0x5c71e7[_0xea4c('0x2c')][_0xea4c('0x2d')](_0x4241c3)){this[_0xea4c('0xe')][_0x5c71e7[_0xea4c('0x27')]][_0x4241c3]=_0x5c71e7['value'];}}}};Fax[_0xea4c('0x22')][_0xea4c('0x17')]=function(_0x1c79ef){if(this[_0xea4c('0xe')][_0x1c79ef[_0xea4c('0x27')]]){this[_0xea4c('0xe')][_0x1c79ef[_0xea4c('0x27')]][_0xea4c('0x2e')]=_0x1c79ef[_0xea4c('0x2e')];this['channels'][_0x1c79ef['uniqueid']][_0xea4c('0x2f')]=_0x1c79ef[_0xea4c('0x2f')];}};Fax[_0xea4c('0x22')][_0xea4c('0x19')]=function(_0x30909c){if(this['channels'][_0x30909c[_0xea4c('0x27')]]){for(var _0xbe8909 in _0x30909c[_0xea4c('0x2c')]){if(_0x30909c['variable'][_0xea4c('0x2d')](_0xbe8909)){this['channels'][_0x30909c[_0xea4c('0x27')]][_0xbe8909]=_0x30909c['value'];}}}};Fax['prototype'][_0xea4c('0x1b')]=function(_0x186e8f){if(this[_0xea4c('0xe')][_0x186e8f['uniqueid']]){this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x30')]=_0x186e8f['operation'];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x31')]=_0x186e8f[_0xea4c('0x31')];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]]['localstationid']=_0x186e8f[_0xea4c('0x26')];this[_0xea4c('0xe')][_0x186e8f[_0xea4c('0x27')]][_0xea4c('0x32')]=_0x186e8f[_0xea4c('0x32')];logger[_0xea4c('0x2a')](_0x186e8f[_0xea4c('0x27')],_0xea4c('0x33'));}};Fax[_0xea4c('0x22')][_0xea4c('0x1d')]=function(_0x5a800f){var _0x3b38b9=this;if(this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]]){var _0x7bd931=this[_0xea4c('0xe')][_0x5a800f['uniqueid']]['id'];this[_0xea4c('0xe')][_0x5a800f['uniqueid']][_0xea4c('0x34')]=_0x5a800f[_0xea4c('0x34')];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x35')]=_0x5a800f[_0xea4c('0x35')];this[_0xea4c('0xe')][_0x5a800f['uniqueid']]['localstationid']=_0x5a800f[_0xea4c('0x26')];this[_0xea4c('0xe')][_0x5a800f['uniqueid']][_0xea4c('0x36')]=_0x5a800f['resolution'];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x37')]=_0x5a800f[_0xea4c('0x37')];this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]]['filename']=_0x5a800f['filename'];this['channels'][_0x5a800f[_0xea4c('0x27')]]['calleridnum']=_0x5a800f[_0xea4c('0x38')];if(this[_0xea4c('0xe')][_0x5a800f[_0xea4c('0x27')]][_0xea4c('0x35')]>0x0){tiff2pdf(_0x5a800f[_0xea4c('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x373d85){logger[_0xea4c('0x2a')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x39'),_0x373d85[_0xea4c('0x3a')]);attachment[_0xea4c('0x3b')]({'name':path[_0xea4c('0x3c')](_0x5a800f[_0xea4c('0x32')])[_0xea4c('0x29')],'basename':path[_0xea4c('0x3c')](_0x5a800f[_0xea4c('0x32')])[_0xea4c('0x29')]+_0xea4c('0x3d'),'type':'application/pdf'})['then'](function(_0x38788c){faxAccount[_0xea4c('0x3e')](_0x7bd931,{'from':_0x5a800f[_0xea4c('0x38')],'mapKey':_0xea4c('0x9'),'body':path[_0xea4c('0x3c')](_0x5a800f['filename'])[_0xea4c('0x29')]+_0xea4c('0x3d'),'AttachmentId':_0x38788c['id']})[_0xea4c('0x3f')](function(_0x59c142){logger[_0xea4c('0x40')](_0x5a800f[_0xea4c('0x27')],'\x20notify\x20',JSON[_0xea4c('0x41')](_0x59c142));});})[_0xea4c('0x3f')](function(_0x10ea51){logger[_0xea4c('0x40')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x42'),JSON[_0xea4c('0x41')](_0x10ea51));});});}logger[_0xea4c('0x2a')](_0x5a800f[_0xea4c('0x27')],_0xea4c('0x42'));}};Fax[_0xea4c('0x22')][_0xea4c('0x21')]=function(_0x4a2c60){if(this[_0xea4c('0x11')][_0x4a2c60[_0xea4c('0x27')]]){_[_0xea4c('0x43')](this[_0xea4c('0xe')][_0x4a2c60['uniqueid']],_[_0xea4c('0x44')](_0x4a2c60,[_0xea4c('0x45'),_0xea4c('0x46')]));}};function updateStatus(_0x42ed1f){if(_0x42ed1f[_0xea4c('0x47')]){faxMessage['update'](_0x42ed1f[_0xea4c('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xea4c('0x48')](function(_0x1cb39b){ut['logger']('[Fax][Message][Error][Updated]',_0x1cb39b);})['catch'](function(_0x52a4f5){ut[_0xea4c('0x49')](_0xea4c('0x4a'),_0x52a4f5);});}else{ut[_0xea4c('0x49')](_0xea4c('0x4b'));}}Fax[_0xea4c('0x22')][_0xea4c('0x4c')]=function(_0x19bfe8,_0xe0e822,_0x28a94a){var _0x3206f0=this;var _0x449357={};if(_0xe0e822){_0x449357={'read':_0xe0e822};}else{_0x449357={'failMessage':_0x28a94a};}if(this[_0xea4c('0x11')][_0x19bfe8]['AttachmentId']){faxMessage[_0xea4c('0x4d')](this[_0xea4c('0x11')][_0x19bfe8]['AttachmentId'],_0x449357)['then'](function(_0xc34c41){ut[_0xea4c('0x49')](_0xea4c('0x4e'),_0xc34c41);})['catch'](function(_0x48e5a1){ut[_0xea4c('0x49')](_0xea4c('0x4f'),_0x48e5a1);})[_0xea4c('0x50')](function(){delete _0x3206f0[_0xea4c('0xe')][_0x19bfe8];delete _0x3206f0['actions'][_0x19bfe8];});}else{ut[_0xea4c('0x49')](_0xea4c('0x51'));delete this[_0xea4c('0xe')][_0x19bfe8];delete this['actions'][_0x19bfe8];}};Fax[_0xea4c('0x22')][_0xea4c('0x1f')]=function(_0x59e97d){var _0x3b607=this;if(this['channels'][_0x59e97d[_0xea4c('0x27')]]){if(this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]){this['channels'][_0x59e97d[_0xea4c('0x27')]]['id']=this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]['id'];this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]]['name']=this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x29')];}logger[_0xea4c('0x2a')](_0x59e97d[_0xea4c('0x27')],this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]?_0xea4c('0x52'):_0xea4c('0x53'),JSON[_0xea4c('0x41')](this['channels'][_0x59e97d[_0xea4c('0x27')]]));if(this[_0xea4c('0x11')][_0x59e97d[_0xea4c('0x27')]]){if(this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x54')]>0x0&&this['channels'][_0x59e97d[_0xea4c('0x27')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x59e97d[_0xea4c('0x27')],!![]);}else{this['updateStatus'](_0x59e97d[_0xea4c('0x27')],![],this['channels'][_0x59e97d[_0xea4c('0x27')]]['faxstatusstring']?_0xea4c('0x55')+this[_0xea4c('0xe')][_0x59e97d[_0xea4c('0x27')]][_0xea4c('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x2ba293){var _0x1bab8a=this;return new BPromise(function(_0x498696,_0x15ba03){_0x1bab8a[_0xea4c('0x57')](_0x2ba293,_0x1bab8a['faxAccounts'][_0x2ba293[_0xea4c('0x58')]])[_0xea4c('0x48')](function(_0x350ade){ut['logger'](_0xea4c('0x59'),_0x350ade);_0x498696(ut[_0xea4c('0x3a')]('Fax\x20received'));})[_0xea4c('0x3f')](function(_0x5958e9){ut[_0xea4c('0x49')](_0xea4c('0x5a'),_0x5958e9);updateStatus(_0x2ba293);_0x15ba03(ut[_0xea4c('0x3a')](_0xea4c('0x5b')));});});};Fax[_0xea4c('0x22')][_0xea4c('0x5c')]=function(_0x2976f3){var _0x47bbc5=this;return new BPromise(function(_0x1ada24,_0x5b23f5){var _0x5c14e0=_0x47bbc5['checkTrunk'](_0x47bbc5[_0xea4c('0xf')][_0x2976f3['FaxAccountId']][_0xea4c('0x5d')],_0x2976f3);if(_0x5c14e0['isValid']){_0x1ada24(ut[_0xea4c('0x3a')](_0xea4c('0x5e')));}else{_0x5b23f5(ut[_0xea4c('0x3a')](_0x5c14e0[_0xea4c('0x3a')]));}});};function originate(_0x495ed1,_0xca0eed,_0x2553c3){return new BPromise(function(_0x34c839,_0x31080d){if(_0x2553c3){var _0x4d39bb=util[_0xea4c('0x5f')](_0xea4c('0x60'),path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x29')],_0x495ed1[_0xea4c('0x5')]);gs[_0xea4c('0x61')](_0x4d39bb)['then'](function(){_0x495ed1[_0xea4c('0x5')]=util[_0xea4c('0x5f')]('%s/%s.tif',path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x62')],path[_0xea4c('0x3c')](_0x495ed1[_0xea4c('0x5')])[_0xea4c('0x29')]);_0xca0eed[_0xea4c('0x63')]=_0x495ed1[_0xea4c('0x5')];ut[_0xea4c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0xea4c('0x64')](ut['variablesAction'](_0x495ed1,_0xca0eed))[_0xea4c('0x48')](function(_0x5be7ca){_0x34c839(_0x5be7ca);})['catch'](function(_0x57bb57){_0x31080d(_0x57bb57);});})[_0xea4c('0x3f')](function(_0x9d987e){_0x31080d(_0x9d987e);});}else{ami[_0xea4c('0x64')](ut['variablesAction'](_0x495ed1,_0xca0eed))[_0xea4c('0x48')](function(_0x2ad5c7){_0x34c839(_0x2ad5c7);})[_0xea4c('0x3f')](function(_0x303ac1){_0x31080d(_0x303ac1);});}});}Fax[_0xea4c('0x22')][_0xea4c('0x57')]=function(_0x313884,_0x45625b){var _0x452f47=this;return new BPromise(function(_0x25f5bf,_0x5ee19f){var _0x1970f7=uuid['v4']();var _0xf5043b=ut[_0xea4c('0x65')](_0x313884,_0x45625b);_0x452f47[_0xea4c('0x11')][_0x1970f7]=new Action(_0x1970f7,_0x45625b,_0x313884);var _0x357033=_0x452f47['actions'][_0x1970f7];if(path[_0xea4c('0x3c')](_0x313884[_0xea4c('0x5')])[_0xea4c('0x66')]===_0xea4c('0x3d')){originate(_0x357033,_0xf5043b,!![])[_0xea4c('0x48')](function(_0x37298a){_0x25f5bf(_0x37298a);})[_0xea4c('0x3f')](function(_0x1968e9){_0x5ee19f(_0x1968e9);});}else{originate(_0x357033,_0xf5043b,![])[_0xea4c('0x48')](function(_0x4ae5c5){_0x25f5bf(_0x4ae5c5);})[_0xea4c('0x3f')](function(_0x3ceed5){_0x5ee19f(_0x3ceed5);});}});};Fax[_0xea4c('0x22')][_0xea4c('0x67')]=function(_0x5c5559){return!_[_0xea4c('0x68')](_0x5c5559)&&!_[_0xea4c('0x68')](_0x5c5559[_0xea4c('0x29')])&&!_[_0xea4c('0x68')](_0x5c5559[_0xea4c('0x69')])&&_0x5c5559['active']&&!_[_0xea4c('0x68')](this['trunks'][util[_0xea4c('0x5f')](_0xea4c('0x6a'),_0x5c5559['name'])])&&!_[_0xea4c('0x68')](this[_0xea4c('0x10')][util[_0xea4c('0x5f')]('SIP/%s',_0x5c5559[_0xea4c('0x29')])]['status'])&&(this[_0xea4c('0x10')][util[_0xea4c('0x5f')](_0xea4c('0x6a'),_0x5c5559[_0xea4c('0x29')])][_0xea4c('0x31')]===_0xea4c('0x6b')||this['trunks'][util['format'](_0xea4c('0x6a'),_0x5c5559['name'])][_0xea4c('0x31')]==='unmonitored');};Fax[_0xea4c('0x22')][_0xea4c('0x6c')]=function(_0x3c0c1b,_0x303701){if(!this['isTrunkReachable'](_0x3c0c1b)){ut[_0xea4c('0x49')](_0xea4c('0x6d'),_[_0xea4c('0x68')](_0x3c0c1b)?'':_0x3c0c1b['name']+_0xea4c('0x6e'));return{'isValid':![],'message':_0xea4c('0x6f')};}if(_[_0xea4c('0x68')](_0x303701[_0xea4c('0x9')])){ut[_0xea4c('0x49')](_0xea4c('0x70'),JSON['stringify'](_0x303701));return{'isValid':![],'message':_0xea4c('0x71')};}if(_['isNil'](_0x303701['path'])){ut['logger'](_0xea4c('0x72'),JSON[_0xea4c('0x41')](_0x303701));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xea4c('0x73')};};module[_0xea4c('0x74')]=Fax; \ No newline at end of file +var _0xfccd=['prototype','syncVarSet','variable','value','channelstatedesc','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','fax','catch','error','\x20receiveFax\x20','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','stringify','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info'];(function(_0x12e455,_0x581732){var _0x5d5ce7=function(_0x1511bc){while(--_0x1511bc){_0x12e455['push'](_0x12e455['shift']());}};_0x5d5ce7(++_0x581732);}(_0xfccd,0xc2));var _0xdfcc=function(_0x883d31,_0x50f7d0){_0x883d31=_0x883d31-0x0;var _0x4201bb=_0xfccd[_0x883d31];return _0x4201bb;};'use strict';var util=require(_0xdfcc('0x0'));var _=require(_0xdfcc('0x1'));var BPromise=require(_0xdfcc('0x2'));var uuid=require('uuid');var moment=require(_0xdfcc('0x3'));var path=require(_0xdfcc('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xdfcc('0x5'));var logger=require(_0xdfcc('0x6'))('fax');var ami=require(_0xdfcc('0x7'));var rpcDb=require(_0xdfcc('0x8'));var Channel=require(_0xdfcc('0x9'));var ut=require(_0xdfcc('0xa'));var Action=require(_0xdfcc('0xb'));var faxAccount=require(_0xdfcc('0xc'));var attachment=require(_0xdfcc('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x568a99){this[_0xdfcc('0xe')]={};this[_0xdfcc('0xf')]=_0x568a99[_0xdfcc('0xf')];this[_0xdfcc('0x10')]=_0x568a99[_0xdfcc('0x10')];this[_0xdfcc('0x11')]={};ami['on'](_0xdfcc('0x12'),this[_0xdfcc('0x13')][_0xdfcc('0x14')](this));ami['on']('varset',this['syncVarSet'][_0xdfcc('0x14')](this));ami['on'](_0xdfcc('0x15'),this[_0xdfcc('0x16')][_0xdfcc('0x14')](this));ami['on'](_0xdfcc('0x17'),this[_0xdfcc('0x18')][_0xdfcc('0x14')](this));ami['on'](_0xdfcc('0x19'),this[_0xdfcc('0x1a')][_0xdfcc('0x14')](this));ami['on'](_0xdfcc('0x1b'),this['syncReceiveFax']['bind'](this));ami['on'](_0xdfcc('0x1c'),this['syncHangup']['bind'](this));ami['on'](_0xdfcc('0x1d'),this[_0xdfcc('0x1e')][_0xdfcc('0x14')](this));}Fax['prototype']['syncNewchannel']=function(_0xd149ce){if(_0xd149ce['context']===_0xdfcc('0x1f')){for(var _0x1b7329 in this[_0xdfcc('0xf')]){if(this[_0xdfcc('0xf')][_0xdfcc('0x20')](_0x1b7329)){if(_0xd149ce['exten']===this[_0xdfcc('0xf')][_0x1b7329][_0xdfcc('0x21')]){this[_0xdfcc('0xe')][_0xd149ce['uniqueid']]={};this['channels'][_0xd149ce[_0xdfcc('0x22')]][_0xdfcc('0x23')]=_0xd149ce[_0xdfcc('0x23')];this[_0xdfcc('0xe')][_0xd149ce['uniqueid']]['id']=this[_0xdfcc('0xf')][_0x1b7329]['id'];this[_0xdfcc('0xe')][_0xd149ce['uniqueid']][_0xdfcc('0x24')]=this['faxAccounts'][_0x1b7329]['name'];logger[_0xdfcc('0x25')](_0xd149ce[_0xdfcc('0x22')],'\x20syncNewchannel\x20');}}}}if(this[_0xdfcc('0x11')][_0xd149ce[_0xdfcc('0x22')]]){this[_0xdfcc('0xe')][_0xd149ce[_0xdfcc('0x22')]]={};this[_0xdfcc('0xe')][_0xd149ce[_0xdfcc('0x22')]][_0xdfcc('0x23')]=_0xd149ce[_0xdfcc('0x23')];logger[_0xdfcc('0x25')](_0xd149ce[_0xdfcc('0x22')],'\x20syncNewchannel\x20');}};Fax[_0xdfcc('0x26')][_0xdfcc('0x27')]=function(_0x1fcc8c){if(this['channels'][_0x1fcc8c[_0xdfcc('0x22')]]){for(var _0x50b990 in _0x1fcc8c[_0xdfcc('0x28')]){if(_0x1fcc8c[_0xdfcc('0x28')][_0xdfcc('0x20')](_0x50b990)){this[_0xdfcc('0xe')][_0x1fcc8c['uniqueid']][_0x50b990]=_0x1fcc8c[_0xdfcc('0x29')];}}}};Fax[_0xdfcc('0x26')]['syncNewState']=function(_0x21b549){if(this[_0xdfcc('0xe')][_0x21b549['uniqueid']]){this[_0xdfcc('0xe')][_0x21b549['uniqueid']]['channelstate']=_0x21b549['channelstate'];this[_0xdfcc('0xe')][_0x21b549[_0xdfcc('0x22')]][_0xdfcc('0x2a')]=_0x21b549[_0xdfcc('0x2a')];}};Fax[_0xdfcc('0x26')][_0xdfcc('0x18')]=function(_0x37d849){if(this[_0xdfcc('0xe')][_0x37d849['uniqueid']]){for(var _0x2c8190 in _0x37d849[_0xdfcc('0x28')]){if(_0x37d849[_0xdfcc('0x28')][_0xdfcc('0x20')](_0x2c8190)){this[_0xdfcc('0xe')][_0x37d849[_0xdfcc('0x22')]][_0x2c8190]=_0x37d849[_0xdfcc('0x29')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x31f5ca){if(this['channels'][_0x31f5ca['uniqueid']]){this[_0xdfcc('0xe')][_0x31f5ca[_0xdfcc('0x22')]]['operation']=_0x31f5ca['operation'];this[_0xdfcc('0xe')][_0x31f5ca[_0xdfcc('0x22')]][_0xdfcc('0x2b')]=_0x31f5ca[_0xdfcc('0x2b')];this[_0xdfcc('0xe')][_0x31f5ca[_0xdfcc('0x22')]][_0xdfcc('0x21')]=_0x31f5ca[_0xdfcc('0x21')];this['channels'][_0x31f5ca['uniqueid']]['filename']=_0x31f5ca[_0xdfcc('0x2c')];logger['info'](_0x31f5ca[_0xdfcc('0x22')],'\x20syncFaxStatus\x20');}};Fax[_0xdfcc('0x26')][_0xdfcc('0x2d')]=function(_0x4b18a5){var _0x13d2f7=this;if(this['channels'][_0x4b18a5[_0xdfcc('0x22')]]){var _0x3b6a75=this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]]['id'];this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x2e')]=_0x4b18a5[_0xdfcc('0x2e')];this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x2f')]=_0x4b18a5[_0xdfcc('0x2f')];this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x21')]=_0x4b18a5[_0xdfcc('0x21')];this[_0xdfcc('0xe')][_0x4b18a5['uniqueid']][_0xdfcc('0x30')]=_0x4b18a5[_0xdfcc('0x30')];this['channels'][_0x4b18a5[_0xdfcc('0x22')]]['transferrate']=_0x4b18a5[_0xdfcc('0x31')];this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x2c')]=_0x4b18a5['filename'];this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x32')]=_0x4b18a5[_0xdfcc('0x32')];if(this[_0xdfcc('0xe')][_0x4b18a5[_0xdfcc('0x22')]][_0xdfcc('0x2f')]>0x0){tiff2pdf(_0x4b18a5[_0xdfcc('0x2c')],_0xdfcc('0x33'),function(_0xa7b418){logger[_0xdfcc('0x25')](_0x4b18a5[_0xdfcc('0x22')],_0xdfcc('0x34'),_0xa7b418['message']);attachment[_0xdfcc('0x35')]({'name':path[_0xdfcc('0x36')](_0x4b18a5[_0xdfcc('0x2c')])[_0xdfcc('0x24')],'basename':path[_0xdfcc('0x36')](_0x4b18a5[_0xdfcc('0x2c')])[_0xdfcc('0x24')]+_0xdfcc('0x37'),'type':_0xdfcc('0x38')})['then'](function(_0x2d584e){faxAccount['notify'](_0x3b6a75,{'from':_0x4b18a5['calleridnum'],'mapKey':_0xdfcc('0x39'),'body':path[_0xdfcc('0x36')](_0x4b18a5[_0xdfcc('0x2c')])[_0xdfcc('0x24')]+_0xdfcc('0x37'),'AttachmentId':_0x2d584e['id']})[_0xdfcc('0x3a')](function(_0x3776b8){logger[_0xdfcc('0x3b')](_0x4b18a5[_0xdfcc('0x22')],'\x20notify\x20',JSON['stringify'](_0x3776b8));});})[_0xdfcc('0x3a')](function(_0x54cb07){logger[_0xdfcc('0x3b')](_0x4b18a5['uniqueid'],_0xdfcc('0x3c'),JSON['stringify'](_0x54cb07));});});}logger['info'](_0x4b18a5[_0xdfcc('0x22')],_0xdfcc('0x3c'));}};Fax[_0xdfcc('0x26')]['syncOriginateResponse']=function(_0x4ff669){if(this['actions'][_0x4ff669[_0xdfcc('0x22')]]){_['merge'](this['channels'][_0x4ff669[_0xdfcc('0x22')]],_[_0xdfcc('0x3d')](_0x4ff669,[_0xdfcc('0x3e'),_0xdfcc('0x3f')]));}};function updateStatus(_0x21675e){if(_0x21675e[_0xdfcc('0x40')]){faxMessage['update'](_0x21675e[_0xdfcc('0x40')],{'failMessage':_0xdfcc('0x41')})[_0xdfcc('0x42')](function(_0x309065){ut[_0xdfcc('0x43')](_0xdfcc('0x44'),_0x309065);})[_0xdfcc('0x3a')](function(_0x9ff05c){ut[_0xdfcc('0x43')]('[Fax][Message][Error][NoUpdate1]',_0x9ff05c);});}else{ut[_0xdfcc('0x43')](_0xdfcc('0x45'));}}Fax[_0xdfcc('0x26')][_0xdfcc('0x46')]=function(_0x3554d8,_0x24b237,_0x532c3){var _0x3d12b7=this;var _0x57337e={};if(_0x24b237){_0x57337e={'read':_0x24b237};}else{_0x57337e={'failMessage':_0x532c3};}if(this[_0xdfcc('0x11')][_0x3554d8][_0xdfcc('0x40')]){faxMessage[_0xdfcc('0x47')](this[_0xdfcc('0x11')][_0x3554d8][_0xdfcc('0x40')],_0x57337e)[_0xdfcc('0x42')](function(_0x4472e4){ut[_0xdfcc('0x43')](_0xdfcc('0x48'),_0x4472e4);})[_0xdfcc('0x3a')](function(_0x4c3314){ut['logger'](_0xdfcc('0x49'),_0x4c3314);})[_0xdfcc('0x4a')](function(){delete _0x3d12b7[_0xdfcc('0xe')][_0x3554d8];delete _0x3d12b7[_0xdfcc('0x11')][_0x3554d8];});}else{ut[_0xdfcc('0x43')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x3554d8];delete this[_0xdfcc('0x11')][_0x3554d8];}};Fax[_0xdfcc('0x26')][_0xdfcc('0x4b')]=function(_0x38eefa){var _0x4a2b4f=this;if(this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]]){if(this['actions'][_0x38eefa[_0xdfcc('0x22')]]){this['channels'][_0x38eefa[_0xdfcc('0x22')]]['id']=this[_0xdfcc('0x11')][_0x38eefa[_0xdfcc('0x22')]]['id'];this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x24')]=this[_0xdfcc('0x11')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x24')];}logger['info'](_0x38eefa[_0xdfcc('0x22')],this[_0xdfcc('0x11')][_0x38eefa[_0xdfcc('0x22')]]?_0xdfcc('0x4c'):_0xdfcc('0x4d'),JSON['stringify'](this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]]));if(this[_0xdfcc('0x11')][_0x38eefa[_0xdfcc('0x22')]]){if(this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x4e')]>0x0&&this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x19')]==='SUCCESS'){this[_0xdfcc('0x46')](_0x38eefa[_0xdfcc('0x22')],!![]);}else{this[_0xdfcc('0x46')](_0x38eefa[_0xdfcc('0x22')],![],this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x4f')]?_0xdfcc('0x50')+this[_0xdfcc('0xe')][_0x38eefa[_0xdfcc('0x22')]][_0xdfcc('0x4f')]:_0xdfcc('0x51'));}}}};Fax[_0xdfcc('0x26')]['send']=function(_0x433ce8){var _0x2c60dc=this;return new BPromise(function(_0x1159f5,_0x19c9d1){_0x2c60dc[_0xdfcc('0x52')](_0x433ce8,_0x2c60dc[_0xdfcc('0xf')][_0x433ce8[_0xdfcc('0x53')]])[_0xdfcc('0x42')](function(_0x4155cf){ut[_0xdfcc('0x43')](_0xdfcc('0x54'),_0x4155cf);_0x1159f5(ut[_0xdfcc('0x55')](_0xdfcc('0x56')));})['catch'](function(_0x55cef4){ut[_0xdfcc('0x43')](_0xdfcc('0x57'),_0x55cef4);updateStatus(_0x433ce8);_0x19c9d1(ut[_0xdfcc('0x55')](_0xdfcc('0x58')));});});};Fax[_0xdfcc('0x26')][_0xdfcc('0x59')]=function(_0x3238ee){var _0x3958ac=this;return new BPromise(function(_0x33c1e2,_0x184011){var _0x2f8d3f=_0x3958ac[_0xdfcc('0x5a')](_0x3958ac[_0xdfcc('0xf')][_0x3238ee[_0xdfcc('0x53')]][_0xdfcc('0x5b')],_0x3238ee);if(_0x2f8d3f[_0xdfcc('0x5c')]){_0x33c1e2(ut['message'](_0xdfcc('0x5d')));}else{_0x184011(ut[_0xdfcc('0x55')](_0x2f8d3f[_0xdfcc('0x55')]));}});};function originate(_0x5ece73,_0x2230a4,_0x28acfb){return new BPromise(function(_0x10e060,_0x7b2b2a){if(_0x28acfb){var _0x4f2e12=util[_0xdfcc('0x5e')](_0xdfcc('0x5f'),path[_0xdfcc('0x36')](_0x5ece73[_0xdfcc('0x4')])[_0xdfcc('0x24')],_0x5ece73[_0xdfcc('0x4')]);gs[_0xdfcc('0x60')](_0x4f2e12)[_0xdfcc('0x42')](function(){_0x5ece73[_0xdfcc('0x4')]=util[_0xdfcc('0x5e')](_0xdfcc('0x61'),path[_0xdfcc('0x36')](_0x5ece73[_0xdfcc('0x4')])[_0xdfcc('0x62')],path[_0xdfcc('0x36')](_0x5ece73[_0xdfcc('0x4')])[_0xdfcc('0x24')]);_0x2230a4[_0xdfcc('0x63')]=_0x5ece73['path'];ut[_0xdfcc('0x43')]('Convert\x20pdf\x20to\x20tif','');ami[_0xdfcc('0x64')](ut[_0xdfcc('0x65')](_0x5ece73,_0x2230a4))[_0xdfcc('0x42')](function(_0x1533b7){_0x10e060(_0x1533b7);})[_0xdfcc('0x3a')](function(_0x4a71be){_0x7b2b2a(_0x4a71be);});})[_0xdfcc('0x3a')](function(_0x527220){_0x7b2b2a(_0x527220);});}else{ami[_0xdfcc('0x64')](ut[_0xdfcc('0x65')](_0x5ece73,_0x2230a4))[_0xdfcc('0x42')](function(_0x335c1a){_0x10e060(_0x335c1a);})['catch'](function(_0xec4716){_0x7b2b2a(_0xec4716);});}});}Fax[_0xdfcc('0x26')][_0xdfcc('0x52')]=function(_0xaa61d,_0x1c6dc6){var _0x3ed148=this;return new BPromise(function(_0x49daf5,_0x502ace){var _0x1eed19=uuid['v4']();var _0x5115be=ut[_0xdfcc('0x66')](_0xaa61d,_0x1c6dc6);_0x3ed148['actions'][_0x1eed19]=new Action(_0x1eed19,_0x1c6dc6,_0xaa61d);var _0x4096d1=_0x3ed148['actions'][_0x1eed19];if(path[_0xdfcc('0x36')](_0xaa61d['path'])[_0xdfcc('0x67')]===_0xdfcc('0x37')){originate(_0x4096d1,_0x5115be,!![])[_0xdfcc('0x42')](function(_0x21fc94){_0x49daf5(_0x21fc94);})[_0xdfcc('0x3a')](function(_0x23a792){_0x502ace(_0x23a792);});}else{originate(_0x4096d1,_0x5115be,![])[_0xdfcc('0x42')](function(_0x1d286e){_0x49daf5(_0x1d286e);})['catch'](function(_0x6e0467){_0x502ace(_0x6e0467);});}});};Fax[_0xdfcc('0x26')]['isTrunkReachable']=function(_0x4291c1){return!_['isNil'](_0x4291c1)&&!_[_0xdfcc('0x68')](_0x4291c1['name'])&&!_[_0xdfcc('0x68')](_0x4291c1[_0xdfcc('0x69')])&&_0x4291c1[_0xdfcc('0x69')]&&!_[_0xdfcc('0x68')](this[_0xdfcc('0x10')][util[_0xdfcc('0x5e')](_0xdfcc('0x6a'),_0x4291c1[_0xdfcc('0x24')])])&&!_[_0xdfcc('0x68')](this[_0xdfcc('0x10')][util[_0xdfcc('0x5e')](_0xdfcc('0x6a'),_0x4291c1[_0xdfcc('0x24')])][_0xdfcc('0x2b')])&&(this[_0xdfcc('0x10')][util['format'](_0xdfcc('0x6a'),_0x4291c1[_0xdfcc('0x24')])][_0xdfcc('0x2b')]===_0xdfcc('0x6b')||this['trunks'][util[_0xdfcc('0x5e')]('SIP/%s',_0x4291c1[_0xdfcc('0x24')])]['status']===_0xdfcc('0x6c'));};Fax[_0xdfcc('0x26')][_0xdfcc('0x5a')]=function(_0xa2df0f,_0x2f5ea2){if(!this[_0xdfcc('0x6d')](_0xa2df0f)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xdfcc('0x68')](_0xa2df0f)?'':_0xa2df0f['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xdfcc('0x68')](_0x2f5ea2[_0xdfcc('0x39')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xdfcc('0x6e')](_0x2f5ea2));return{'isValid':![],'message':_0xdfcc('0x6f')};}if(_[_0xdfcc('0x68')](_0x2f5ea2[_0xdfcc('0x4')])){ut[_0xdfcc('0x43')](_0xdfcc('0x70'),JSON['stringify'](_0x2f5ea2));return{'isValid':![],'message':_0xdfcc('0x71')};}return{'isValid':!![],'message':_0xdfcc('0x72')};};module[_0xdfcc('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 19dcb1d..ce4877d 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 _0x9477=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x9477,0x17b));var _0x7947=function(_0x7c99d,_0x1d55dd){_0x7c99d=_0x7c99d-0x0;var _0x3c02ce=_0x9477[_0x7c99d];return _0x3c02ce;};'use strict';var util=require(_0x7947('0x0'));var BPromise=require(_0x7947('0x1'));var logger=require(_0x7947('0x2'))(_0x7947('0x3'));var _=require(_0x7947('0x4'));var faxAccount=require(_0x7947('0x5'));function loggerCatch(_0x497c3a){return function(_0x55125e){logger[_0x7947('0x6')](_0x497c3a,util[_0x7947('0x7')](_0x55125e,{'showHidden':![],'depth':null}));};}exports[_0x7947('0x8')]=function(_0x38f378,_0x4ac176){return BPromise[_0x7947('0x9')]()[_0x7947('0xa')](faxAccount[_0x7947('0x8')](_0x38f378,_0x4ac176))[_0x7947('0xb')](loggerCatch(_0x7947('0xc')));}; \ No newline at end of file +var _0x8ef5=['catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x4c1d9a,_0x5a59f9){var _0x1ba68d=function(_0x3f6889){while(--_0x3f6889){_0x4c1d9a['push'](_0x4c1d9a['shift']());}};_0x1ba68d(++_0x5a59f9);}(_0x8ef5,0x1e2));var _0x58ef=function(_0xcd7c70,_0x3614d4){_0xcd7c70=_0xcd7c70-0x0;var _0x3dd552=_0x8ef5[_0xcd7c70];return _0x3dd552;};'use strict';var util=require(_0x58ef('0x0'));var BPromise=require('bluebird');var logger=require(_0x58ef('0x1'))(_0x58ef('0x2'));var _=require(_0x58ef('0x3'));var faxAccount=require(_0x58ef('0x4'));function loggerCatch(_0x5e2915){return function(_0x5a300a){logger[_0x58ef('0x5')](_0x5e2915,util[_0x58ef('0x6')](_0x5a300a,{'showHidden':![],'depth':null}));};}exports[_0x58ef('0x7')]=function(_0x33346d,_0x364c1b){return BPromise[_0x58ef('0x8')]()[_0x58ef('0x9')](faxAccount[_0x58ef('0x7')](_0x33346d,_0x364c1b))[_0x58ef('0xa')](loggerCatch(_0x58ef('0xb')));}; \ 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 9d54e4b..ff58ab0 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 _0xaad8=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird'];(function(_0x5de58f,_0x438e81){var _0x18ec2f=function(_0x4450d3){while(--_0x4450d3){_0x5de58f['push'](_0x5de58f['shift']());}};_0x18ec2f(++_0x438e81);}(_0xaad8,0x115));var _0x8aad=function(_0x2cf58a,_0x2f6336){_0x2cf58a=_0x2cf58a-0x0;var _0x2f25e3=_0xaad8[_0x2cf58a];return _0x2f25e3;};'use strict';var util=require('util');var logger=require(_0x8aad('0x0'))(_0x8aad('0x1'));var BPromise=require(_0x8aad('0x2'));var exec=require(_0x8aad('0x3'))[_0x8aad('0x4')];exports[_0x8aad('0x5')]=function(_0x1a92c4){return new BPromise(function(_0x2fd1bc,_0x2125ee){exec(_0x1a92c4,function(_0x59c79c,_0x2ae5f2,_0x1ac1ac){logger[_0x8aad('0x6')](_0x8aad('0x7'),_0x2ae5f2);if(_0x59c79c){logger[_0x8aad('0x6')](_0x8aad('0x7'),_0x8aad('0x8'),util[_0x8aad('0x9')](_0x59c79c,{'showHidden':![],'depth':null}),_0x2ae5f2,_0x1ac1ac);_0x2125ee(_0x59c79c);}_0x2fd1bc(_0x2ae5f2);});});}; \ No newline at end of file +var _0x4013=['../../../../config/logger','fax','bluebird','child_process','exec','Exec\x20gs','info','util'];(function(_0x5c4112,_0x38c2db){var _0xcc8c4e=function(_0x4e0b1b){while(--_0x4e0b1b){_0x5c4112['push'](_0x5c4112['shift']());}};_0xcc8c4e(++_0x38c2db);}(_0x4013,0x1e7));var _0x3401=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4013[_0x19e35c];return _0x3e1fe8;};'use strict';var util=require(_0x3401('0x0'));var logger=require(_0x3401('0x1'))(_0x3401('0x2'));var BPromise=require(_0x3401('0x3'));var exec=require(_0x3401('0x4'))[_0x3401('0x5')];exports['execute']=function(_0x414279){return new BPromise(function(_0xd1946,_0x2789ca){exec(_0x414279,function(_0x5db4f4,_0x543876,_0xd4106a){logger['info'](_0x3401('0x6'),_0x543876);if(_0x5db4f4){logger[_0x3401('0x7')](_0x3401('0x6'),'\x20Error\x20:',util['inspect'](_0x5db4f4,{'showHidden':![],'depth':null}),_0x543876,_0xd4106a);_0x2789ca(_0x5db4f4);}_0xd1946(_0x543876);});});}; \ 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 cd8e401..90b82f8 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 _0x48d0=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x4b0553,_0xa77d27){var _0x4826cc=function(_0x4c47ac){while(--_0x4c47ac){_0x4b0553['push'](_0x4b0553['shift']());}};_0x4826cc(++_0xa77d27);}(_0x48d0,0xd3));var _0x048d=function(_0x3b6f7d,_0x5e8c7a){_0x3b6f7d=_0x3b6f7d-0x0;var _0x125b88=_0x48d0[_0x3b6f7d];return _0x125b88;};'use strict';var util=require(_0x048d('0x0'));var _=require(_0x048d('0x1'));var moment=require('moment');var logger=require(_0x048d('0x2'))(_0x048d('0x3'));exports[_0x048d('0x4')]=function(_0x4ec740){return{'message':_0x4ec740};};exports[_0x048d('0x5')]=function(_0x1e9131,_0x57d051){logger[_0x048d('0x6')](_0x1e9131,util[_0x048d('0x7')](_0x57d051,{'showHidden':![],'depth':null}));};exports[_0x048d('0x8')]=function(_0x49c342,_0x16b9b6){var _0x339f60={'XMF-ECM':_0x16b9b6['ecm'],'XMF-HEADERINFO':_0x16b9b6[_0x048d('0x9')],'XMF-MINRATE':_0x16b9b6[_0x048d('0xa')],'XMF-MAXRATE':_0x16b9b6[_0x048d('0xb')],'XMF-MODEM':util[_0x048d('0xc')](_0x048d('0xd'),_0x16b9b6[_0x048d('0xe')]),'XMF-GATEWAY':_0x16b9b6[_0x048d('0xf')],'XMF-FAXDETECT':_0x16b9b6[_0x048d('0x10')],'XMF-T38TIMEOUT':_0x16b9b6[_0x048d('0x11')],'XMF-LOCALSTATIONID':_0x16b9b6[_0x048d('0x12')],'XMF-PATH':_0x49c342[_0x048d('0x13')]};return _0x339f60;};exports[_0x048d('0x14')]=function(_0x5bede6,_0x40243){return{'actionid':_0x5bede6['uniqueid'],'action':_0x048d('0x15'),'channel':_0x5bede6[_0x048d('0x16')],'Exten':_0x048d('0x17'),'Context':'from-sip','Priority':'1','callerid':util[_0x048d('0xc')]('\x22%s\x22\x20<%s>',_0x5bede6[_0x048d('0x9')]?_0x5bede6[_0x048d('0x9')]:'',_0x5bede6[_0x048d('0x12')]),'variable':_0x40243,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5bede6[_0x048d('0x18')]};}; \ No newline at end of file +var _0xfec3=['logger','info','inspect','ecm','headerinfo','minrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','fax','message'];(function(_0x4df89e,_0x4bfdf2){var _0x5144ff=function(_0x142d24){while(--_0x142d24){_0x4df89e['push'](_0x4df89e['shift']());}};_0x5144ff(++_0x4bfdf2);}(_0xfec3,0x1a3));var _0x3fec=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfec3[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x3fec('0x0'));var _=require(_0x3fec('0x1'));var moment=require(_0x3fec('0x2'));var logger=require(_0x3fec('0x3'))(_0x3fec('0x4'));exports[_0x3fec('0x5')]=function(_0x108050){return{'message':_0x108050};};exports[_0x3fec('0x6')]=function(_0x1902e5,_0x5bf1db){logger[_0x3fec('0x7')](_0x1902e5,util[_0x3fec('0x8')](_0x5bf1db,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x504849,_0x2d3578){var _0x10ca23={'XMF-ECM':_0x2d3578[_0x3fec('0x9')],'XMF-HEADERINFO':_0x2d3578[_0x3fec('0xa')],'XMF-MINRATE':_0x2d3578[_0x3fec('0xb')],'XMF-MAXRATE':_0x2d3578['maxrate'],'XMF-MODEM':util['format'](_0x3fec('0xc'),_0x2d3578['modem']),'XMF-GATEWAY':_0x2d3578[_0x3fec('0xd')],'XMF-FAXDETECT':_0x2d3578[_0x3fec('0xe')],'XMF-T38TIMEOUT':_0x2d3578[_0x3fec('0xf')],'XMF-LOCALSTATIONID':_0x2d3578[_0x3fec('0x10')],'XMF-PATH':_0x504849[_0x3fec('0x11')]};return _0x10ca23;};exports[_0x3fec('0x12')]=function(_0x1910fc,_0x1dff13){return{'actionid':_0x1910fc['uniqueid'],'action':_0x3fec('0x13'),'channel':_0x1910fc['channel'],'Exten':_0x3fec('0x14'),'Context':_0x3fec('0x15'),'Priority':'1','callerid':util[_0x3fec('0x16')](_0x3fec('0x17'),_0x1910fc['headerinfo']?_0x1910fc[_0x3fec('0xa')]:'',_0x1910fc['localstationid']),'variable':_0x1dff13,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1910fc[_0x3fec('0x18')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ec60a84..427ac0a 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 _0xe87d=['getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts'];(function(_0x542967,_0x277658){var _0x81f5f3=function(_0x43e55f){while(--_0x43e55f){_0x542967['push'](_0x542967['shift']());}};_0x81f5f3(++_0x277658);}(_0xe87d,0x12f));var _0xde87=function(_0x23c3f5,_0x1e0dba){_0x23c3f5=_0x23c3f5-0x0;var _0x50a8b3=_0xe87d[_0x23c3f5];return _0x50a8b3;};'use strict';var BPromise=require(_0xde87('0x0'));var util=require(_0xde87('0x1'));var moment=require('moment');var server=require(_0xde87('0x2'));var Realtime=require('./realtime');var Report=require(_0xde87('0x3'));var Acw=require(_0xde87('0x4'));var Trigger=require(_0xde87('0x5'));var Dialer=require(_0xde87('0x6'));var Preview=require('./preview');var Fax=require(_0xde87('0x7'));var user=require(_0xde87('0x8'));var voiceQueue=require(_0xde87('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xde87('0xa'));var trunk=require(_0xde87('0xb'));var trigger=require(_0xde87('0xc'));var template=require(_0xde87('0xd'));var cmHopperHistory=require(_0xde87('0xe'));var campaign=require(_0xde87('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xde87('0x10'));var zendesk=require(_0xde87('0x11'));var salesforce=require(_0xde87('0x12'));var sugarcrm=require(_0xde87('0x13'));var freshdesk=require(_0xde87('0x14'));var desk=require(_0xde87('0x15'));var zoho=require(_0xde87('0x16'));var vtiger=require(_0xde87('0x17'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xde87('0x18'));var dynamics365=require(_0xde87('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(_0xde87('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xde87('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xde87('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xde87('0x1d')]()[_0xde87('0x1e')](user[_0xde87('0x1f')]())['then'](realtime[_0xde87('0x20')]())[_0xde87('0x1e')](user['getTelephones']())[_0xde87('0x1e')](realtime[_0xde87('0x21')]())[_0xde87('0x1e')](trunk[_0xde87('0x22')]())[_0xde87('0x1e')](realtime[_0xde87('0x23')]())[_0xde87('0x1e')](voiceQueue[_0xde87('0x24')]())[_0xde87('0x1e')](realtime['initVoiceQueues']())[_0xde87('0x1e')](trigger[_0xde87('0x25')]())['then'](realtime[_0xde87('0x26')]())[_0xde87('0x1e')](template[_0xde87('0x27')]())['then'](realtime['initTemplates']())[_0xde87('0x1e')](zendesk[_0xde87('0x28')]())['then'](realtime[_0xde87('0x29')]())['then'](salesforce[_0xde87('0x2a')]())[_0xde87('0x1e')](realtime['initSalesforceAccounts']())[_0xde87('0x1e')](sugarcrm[_0xde87('0x2b')]())[_0xde87('0x1e')](realtime[_0xde87('0x2c')]())[_0xde87('0x1e')](freshdesk['getFreshdeskAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x2d')]())[_0xde87('0x1e')](desk[_0xde87('0x2e')]())['then'](realtime['initDeskAccounts']())[_0xde87('0x1e')](zoho[_0xde87('0x2f')]())['then'](realtime['initZohoAccounts']())[_0xde87('0x1e')](vtiger[_0xde87('0x30')]())[_0xde87('0x1e')](realtime['initVtigerAccounts']())[_0xde87('0x1e')](freshsales['getFreshsalesAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x31')]())[_0xde87('0x1e')](servicenow[_0xde87('0x32')]())[_0xde87('0x1e')](realtime['initServicenowAccounts']())[_0xde87('0x1e')](dynamics365[_0xde87('0x33')]())[_0xde87('0x1e')](realtime[_0xde87('0x34')]())[_0xde87('0x1e')](campaign[_0xde87('0x35')]())[_0xde87('0x1e')](realtime[_0xde87('0x36')]())[_0xde87('0x1e')](voiceExtension['getVoiceExtensions']())[_0xde87('0x1e')](realtime[_0xde87('0x37')]())[_0xde87('0x1e')](faxAccount['getFaxAccounts']())[_0xde87('0x1e')](realtime[_0xde87('0x38')]())[_0xde87('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xde87('0x1d')]()[_0xde87('0x1e')](voiceQueueReport[_0xde87('0x39')]())[_0xde87('0x1e')](realtime[_0xde87('0x3a')]())['then'](cmHopperHistory[_0xde87('0x3b')]())[_0xde87('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0xde87('0x1e')](cmHopperHistory[_0xde87('0x3c')]())[_0xde87('0x1e')](realtime['initCampaignHopperHistory']())[_0xde87('0x1e')](voiceCallReport[_0xde87('0x3d')]())[_0xde87('0x1e')](realtime[_0xde87('0x3e')]())[_0xde87('0x3f')](function(_0x383774){logger[_0xde87('0x40')](_0xde87('0x41'),util[_0xde87('0x42')](_0x383774,{'showHidden':![],'depth':null}));});}function main(){return server[_0xde87('0x43')](realtime,preview,fax)['then'](function(_0x3200b6){return initRealtime();})[_0xde87('0x1e')](function(){return initParams();})[_0xde87('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xde87('0x3f')](function(_0x576cab){logger[_0xde87('0x40')](_0xde87('0x44'),util[_0xde87('0x42')](_0x576cab,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xbafb=['initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0xbafb,0xf0));var _0xbbaf=function(_0xee538c,_0x127089){_0xee538c=_0xee538c-0x0;var _0x4b6fee=_0xbafb[_0xee538c];return _0x4b6fee;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0xbbaf('0x0'));var Realtime=require(_0xbbaf('0x1'));var Report=require(_0xbbaf('0x2'));var Acw=require(_0xbbaf('0x3'));var Trigger=require(_0xbbaf('0x4'));var Dialer=require(_0xbbaf('0x5'));var Preview=require(_0xbbaf('0x6'));var Fax=require('./fax');var user=require(_0xbbaf('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xbbaf('0x8'));var voiceCallReport=require(_0xbbaf('0x9'));var trunk=require(_0xbbaf('0xa'));var trigger=require(_0xbbaf('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xbbaf('0xc'));var campaign=require(_0xbbaf('0xd'));var voiceExtension=require(_0xbbaf('0xe'));var faxAccount=require(_0xbbaf('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xbbaf('0x10'));var sugarcrm=require(_0xbbaf('0x11'));var freshdesk=require(_0xbbaf('0x12'));var desk=require(_0xbbaf('0x13'));var zoho=require(_0xbbaf('0x14'));var vtiger=require(_0xbbaf('0x15'));var freshsales=require(_0xbbaf('0x16'));var servicenow=require(_0xbbaf('0x17'));var dynamics365=require(_0xbbaf('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xbbaf('0x19'))(_0xbbaf('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xbbaf('0x1b')](_0xbbaf('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbbaf('0x1b')](_0xbbaf('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xbbaf('0x1d')]()[_0xbbaf('0x1e')](user[_0xbbaf('0x1f')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x20')]())[_0xbbaf('0x1e')](user[_0xbbaf('0x21')]())[_0xbbaf('0x1e')](realtime['initTelephones']())['then'](trunk[_0xbbaf('0x22')]())['then'](realtime[_0xbbaf('0x23')]())[_0xbbaf('0x1e')](voiceQueue[_0xbbaf('0x24')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x25')]())['then'](trigger[_0xbbaf('0x26')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x27')]())[_0xbbaf('0x1e')](template[_0xbbaf('0x28')]())['then'](realtime[_0xbbaf('0x29')]())[_0xbbaf('0x1e')](zendesk[_0xbbaf('0x2a')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x2b')]())[_0xbbaf('0x1e')](salesforce[_0xbbaf('0x2c')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x2d')]())[_0xbbaf('0x1e')](sugarcrm[_0xbbaf('0x2e')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xbbaf('0x2f')]())[_0xbbaf('0x1e')](realtime['initFreshdeskAccounts']())[_0xbbaf('0x1e')](desk[_0xbbaf('0x30')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x31')]())[_0xbbaf('0x1e')](zoho[_0xbbaf('0x32')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x33')]())[_0xbbaf('0x1e')](vtiger[_0xbbaf('0x34')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x35')]())['then'](freshsales[_0xbbaf('0x36')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x37')]())[_0xbbaf('0x1e')](servicenow[_0xbbaf('0x38')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x39')]())['then'](dynamics365[_0xbbaf('0x3a')]())['then'](realtime['initDynamics365Accounts']())[_0xbbaf('0x1e')](campaign[_0xbbaf('0x3b')]())['then'](realtime['initCampaigns']())[_0xbbaf('0x1e')](voiceExtension[_0xbbaf('0x3c')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x3d')]())[_0xbbaf('0x1e')](faxAccount['getFaxAccounts']())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x3e')]())[_0xbbaf('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xbbaf('0x1d')]()[_0xbbaf('0x1e')](voiceQueueReport[_0xbbaf('0x3f')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x40')]())[_0xbbaf('0x1e')](cmHopperHistory[_0xbbaf('0x41')]())['then'](realtime[_0xbbaf('0x42')]())[_0xbbaf('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0xbbaf('0x1e')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xbbaf('0x43')]())[_0xbbaf('0x1e')](realtime[_0xbbaf('0x44')]())[_0xbbaf('0x45')](function(_0x115856){logger[_0xbbaf('0x46')](_0xbbaf('0x47'),util[_0xbbaf('0x48')](_0x115856,{'showHidden':![],'depth':null}));});}function main(){return server[_0xbbaf('0x49')](realtime,preview,fax)[_0xbbaf('0x1e')](function(_0x280cfa){return initRealtime();})[_0xbbaf('0x1e')](function(){return initParams();})[_0xbbaf('0x1e')](function(){report[_0xbbaf('0x4a')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x238b11){logger[_0xbbaf('0x46')](_0xbbaf('0x4b'),util[_0xbbaf('0x48')](_0x238b11,{'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 ada57ee..b303d1a 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x23dc1a,_0x87949d){var _0x5a8c07=function(_0x5471ae){while(--_0x5471ae){_0x23dc1a['push'](_0x23dc1a['shift']());}};_0x5a8c07(++_0x87949d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xcb91[_0x422be2];return _0x1b820e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=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(_0x2725e7,_0x12b278){var _0x2f382c=function(_0x134d0e){while(--_0x134d0e){_0x2725e7['push'](_0x2725e7['shift']());}};_0x2f382c(++_0x12b278);}(_0xe706,0xa3));var _0x6e70=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0xe706[_0x2c1114];return _0x2b877c;};'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 ec06768..74e0ffb 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 _0x195f=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting'];(function(_0x103aa0,_0x4b2079){var _0x128855=function(_0x26d234){while(--_0x26d234){_0x103aa0['push'](_0x103aa0['shift']());}};_0x128855(++_0x4b2079);}(_0x195f,0xed));var _0xf195=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x195f[_0x4ec13d];return _0x3c3fa7;};'use strict';function Campaign(_0x480638){this['id']=_0x480638['id']||0x0;this[_0xf195('0x0')]=_0x480638['name']||'';this[_0xf195('0x1')]=_0x480638[_0xf195('0x1')]||_0xf195('0x2');this[_0xf195('0x3')]=0x0;this[_0xf195('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xf195('0x5')]=0x0;this[_0xf195('0x6')]='';this[_0xf195('0x7')]=!![];this[_0xf195('0x8')]=_0x480638[_0xf195('0x8')];this['limitCalls']=_0x480638['limitCalls'];this[_0xf195('0x9')]=_0x480638['dialTimezone']||null;this[_0xf195('0xa')]=_0x480638[_0xf195('0xa')]?_0x480638[_0xf195('0xa')]:null;this['dialOriginateCallerIdName']=_0x480638[_0xf195('0xb')];this[_0xf195('0xc')]=_0x480638[_0xf195('0xc')];this[_0xf195('0xd')]=_0x480638[_0xf195('0xd')]||0x1e;this[_0xf195('0xe')]=_0x480638[_0xf195('0xe')];this['dialCongestionRetryFrequency']=_0x480638[_0xf195('0xf')];this[_0xf195('0x10')]=_0x480638[_0xf195('0x10')];this['dialBusyRetryFrequency']=_0x480638['dialBusyRetryFrequency'];this[_0xf195('0x11')]=_0x480638[_0xf195('0x11')];this['dialNoAnswerRetryFrequency']=_0x480638[_0xf195('0x12')];this[_0xf195('0x13')]=_0x480638[_0xf195('0x13')];this[_0xf195('0x14')]=_0x480638[_0xf195('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x480638['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x480638[_0xf195('0x15')]||0x3;this[_0xf195('0x16')]=_0x480638[_0xf195('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x480638['dialAbandonedMaxRetry']||0x3;this[_0xf195('0x17')]=_0x480638['dialAbandonedRetryFrequency']||0x96;this[_0xf195('0x18')]=_0x480638[_0xf195('0x18')]||0x3;this[_0xf195('0x19')]=_0x480638[_0xf195('0x19')]||0x96;this[_0xf195('0x1a')]=_0x480638['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x480638['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x480638[_0xf195('0x1b')]||_0xf195('0x1c');this[_0xf195('0x1d')]=_0x480638[_0xf195('0x1d')]||undefined;this[_0xf195('0x1e')]=_0x480638[_0xf195('0x1e')]||undefined;this[_0xf195('0x1f')]=_0x480638[_0xf195('0x1f')]||undefined;this[_0xf195('0x20')]=_0x480638[_0xf195('0x20')]?_0x480638[_0xf195('0x20')]:undefined;this['Trunk']=_0x480638[_0xf195('0x21')]?_0x480638['Trunk']:undefined;this[_0xf195('0x22')]=_0x480638['Interval']?_0x480638[_0xf195('0x22')]:undefined;this[_0xf195('0x23')]=_0x480638[_0xf195('0x23')]?_0x480638[_0xf195('0x23')]:undefined;this[_0xf195('0x24')]=_0x480638['SquareProject']?_0x480638[_0xf195('0x23')][_0xf195('0x0')]:undefined;this['dialAMDActive']=_0x480638[_0xf195('0x25')]||![];this['dialAMDInitialSilence']=_0x480638['dialAMDInitialSilence'];this[_0xf195('0x26')]=_0x480638[_0xf195('0x26')];this['dialAMDAfterGreetingSilence']=_0x480638['dialAMDAfterGreetingSilence'];this[_0xf195('0x27')]=_0x480638[_0xf195('0x27')];this[_0xf195('0x28')]=_0x480638['dialAMDMinWordLength'];this[_0xf195('0x29')]=_0x480638['dialAMDBetweenWordsSilence'];this[_0xf195('0x2a')]=_0x480638[_0xf195('0x2a')];this[_0xf195('0x2b')]=_0x480638['dialAMDSilenceThreshold'];this[_0xf195('0x2c')]=_0x480638[_0xf195('0x2c')];}module[_0xf195('0x2d')]=Campaign; \ No newline at end of file +var _0x2949=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','SquareProject','dialQueueProject','dialAMDActive'];(function(_0x43b45e,_0x5b27c5){var _0x1e94c0=function(_0x2939d2){while(--_0x2939d2){_0x43b45e['push'](_0x43b45e['shift']());}};_0x1e94c0(++_0x5b27c5);}(_0x2949,0x161));var _0x9294=function(_0x27f616,_0xf48a6d){_0x27f616=_0x27f616-0x0;var _0x5ebae0=_0x2949[_0x27f616];return _0x5ebae0;};'use strict';function Campaign(_0x32ddd8){this['id']=_0x32ddd8['id']||0x0;this[_0x9294('0x0')]=_0x32ddd8[_0x9294('0x0')]||'';this[_0x9294('0x1')]=_0x32ddd8[_0x9294('0x1')]||_0x9294('0x2');this[_0x9294('0x3')]=0x0;this[_0x9294('0x4')]=0x0;this[_0x9294('0x5')]=0x0;this[_0x9294('0x6')]=0x0;this[_0x9294('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x9294('0x8')]=_0x32ddd8[_0x9294('0x8')];this[_0x9294('0x9')]=_0x32ddd8[_0x9294('0x9')];this['dialTimezone']=_0x32ddd8['dialTimezone']||null;this[_0x9294('0xa')]=_0x32ddd8[_0x9294('0xa')]?_0x32ddd8[_0x9294('0xa')]:null;this[_0x9294('0xb')]=_0x32ddd8['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x32ddd8['dialOriginateCallerIdNumber'];this[_0x9294('0xc')]=_0x32ddd8[_0x9294('0xc')]||0x1e;this[_0x9294('0xd')]=_0x32ddd8[_0x9294('0xd')];this[_0x9294('0xe')]=_0x32ddd8['dialCongestionRetryFrequency'];this[_0x9294('0xf')]=_0x32ddd8['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x32ddd8[_0x9294('0x10')];this[_0x9294('0x11')]=_0x32ddd8[_0x9294('0x11')];this['dialNoAnswerRetryFrequency']=_0x32ddd8['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x32ddd8[_0x9294('0x12')];this[_0x9294('0x13')]=_0x32ddd8[_0x9294('0x13')]||0x3;this[_0x9294('0x14')]=_0x32ddd8['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9294('0x15')]=_0x32ddd8[_0x9294('0x15')]||0x3;this['dialDropRetryFrequency']=_0x32ddd8[_0x9294('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x32ddd8[_0x9294('0x17')]||0x3;this[_0x9294('0x18')]=_0x32ddd8[_0x9294('0x18')]||0x96;this[_0x9294('0x19')]=_0x32ddd8['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x32ddd8[_0x9294('0x1a')]||0x96;this[_0x9294('0x1b')]=_0x32ddd8[_0x9294('0x1b')]||0x3;this[_0x9294('0x1c')]=_0x32ddd8[_0x9294('0x1c')]||0x96;this[_0x9294('0x1d')]=_0x32ddd8[_0x9294('0x1d')]||_0x9294('0x1e');this[_0x9294('0x1f')]=_0x32ddd8[_0x9294('0x1f')]||undefined;this[_0x9294('0x20')]=_0x32ddd8['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x9294('0x21')]=_0x32ddd8[_0x9294('0x21')]||undefined;this['TrunkBackup']=_0x32ddd8[_0x9294('0x22')]?_0x32ddd8[_0x9294('0x22')]:undefined;this[_0x9294('0x23')]=_0x32ddd8[_0x9294('0x23')]?_0x32ddd8[_0x9294('0x23')]:undefined;this['Interval']=_0x32ddd8['Interval']?_0x32ddd8['Interval']:undefined;this['SquareProject']=_0x32ddd8[_0x9294('0x24')]?_0x32ddd8['SquareProject']:undefined;this[_0x9294('0x25')]=_0x32ddd8[_0x9294('0x24')]?_0x32ddd8[_0x9294('0x24')][_0x9294('0x0')]:undefined;this['dialAMDActive']=_0x32ddd8[_0x9294('0x26')]||![];this['dialAMDInitialSilence']=_0x32ddd8[_0x9294('0x27')];this[_0x9294('0x28')]=_0x32ddd8[_0x9294('0x28')];this[_0x9294('0x29')]=_0x32ddd8['dialAMDAfterGreetingSilence'];this[_0x9294('0x2a')]=_0x32ddd8[_0x9294('0x2a')];this[_0x9294('0x2b')]=_0x32ddd8['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x32ddd8[_0x9294('0x2c')];this[_0x9294('0x2d')]=_0x32ddd8[_0x9294('0x2d')];this[_0x9294('0x2e')]=_0x32ddd8['dialAMDSilenceThreshold'];this[_0x9294('0x2f')]=_0x32ddd8[_0x9294('0x2f')];}module[_0x9294('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 81943e1..b2bbe68 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 _0x3c32=['endtime','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','linkedid','exten','answered','answertime'];(function(_0x4d4475,_0x71afc){var _0x4016bb=function(_0x17aae6){while(--_0x17aae6){_0x4d4475['push'](_0x4d4475['shift']());}};_0x4016bb(++_0x71afc);}(_0x3c32,0x161));var _0x23c3=function(_0x362d70,_0x300dba){_0x362d70=_0x362d70-0x0;var _0x2a5f8d=_0x3c32[_0x362d70];return _0x2a5f8d;};'use strict';function Channel(){this[_0x23c3('0x0')]=null;this[_0x23c3('0x1')]='';this[_0x23c3('0x2')]='';this['calleridnum']=0x0;this[_0x23c3('0x3')]='';this[_0x23c3('0x4')]=undefined;this[_0x23c3('0x5')]=undefined;this['accountcode']=0x0;this[_0x23c3('0x6')]='';this['uniqueid']=0x0;this[_0x23c3('0x7')]=0x0;this[_0x23c3('0x8')]=0x0;this[_0x23c3('0x9')]=![];this[_0x23c3('0xa')]=null;this[_0x23c3('0xb')]=null;this['unmanaged']=![];this['abandoned']=![];this['lastapplication']='';this[_0x23c3('0xc')]='';this[_0x23c3('0xd')]=0x0;this[_0x23c3('0xe')]=0x0;this[_0x23c3('0xf')]=0x0;this[_0x23c3('0x10')]=null;this[_0x23c3('0x11')]=null;this[_0x23c3('0x12')]=null;this[_0x23c3('0x13')]=![];this[_0x23c3('0x14')]=null;this[_0x23c3('0x15')]=null;this[_0x23c3('0x16')]=[];this[_0x23c3('0x17')]=undefined;this[_0x23c3('0x18')]=undefined;this[_0x23c3('0x19')]=undefined;this[_0x23c3('0x1a')]=0x0;}module[_0x23c3('0x1b')]=Channel; \ No newline at end of file +var _0x3222=['uniqueid','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','type','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x39d908,_0x33971a){var _0x44d307=function(_0x4962ba){while(--_0x4962ba){_0x39d908['push'](_0x39d908['shift']());}};_0x44d307(++_0x33971a);}(_0x3222,0xe1));var _0x2322=function(_0xf869e4,_0x132bb3){_0xf869e4=_0xf869e4-0x0;var _0x206929=_0x3222[_0xf869e4];return _0x206929;};'use strict';function Channel(){this[_0x2322('0x0')]=null;this[_0x2322('0x1')]='';this[_0x2322('0x2')]='';this[_0x2322('0x3')]=0x0;this[_0x2322('0x4')]='';this[_0x2322('0x5')]=undefined;this[_0x2322('0x6')]=undefined;this[_0x2322('0x7')]=0x0;this[_0x2322('0x8')]='';this[_0x2322('0x9')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x2322('0xa')]=![];this[_0x2322('0xb')]=null;this[_0x2322('0xc')]=null;this['unmanaged']=![];this[_0x2322('0xd')]=![];this[_0x2322('0xe')]='';this[_0x2322('0xf')]='';this[_0x2322('0x10')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x2322('0x11')]=null;this['tag']=null;this[_0x2322('0x12')]=null;this['monitor']=![];this[_0x2322('0x13')]=null;this['queue']=null;this[_0x2322('0x14')]=[];this[_0x2322('0x15')]=undefined;this[_0x2322('0x16')]=undefined;this[_0x2322('0x17')]=undefined;this[_0x2322('0x18')]=0x0;}module[_0x2322('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 096ee99..223b8cc 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 _0x789d=['token','tokenSecret','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x789d,0x17b));var _0xd789=function(_0x96383e,_0x35b28f){_0x96383e=_0x96383e-0x0;var _0x419e14=_0x789d[_0x96383e];return _0x419e14;};'use strict';function DeskAccount(_0x4cca0e){this['id']=_0x4cca0e['id']||0x0;this[_0xd789('0x0')]=_0x4cca0e[_0xd789('0x0')]||'';this[_0xd789('0x1')]=_0x4cca0e[_0xd789('0x1')]||'';this[_0xd789('0x2')]=_0x4cca0e[_0xd789('0x2')]||'';this[_0xd789('0x3')]=_0x4cca0e[_0xd789('0x3')]||'';this[_0xd789('0x4')]=_0x4cca0e['password']||'';this['consumerKey']=_0x4cca0e['consumerKey']||'';this[_0xd789('0x5')]=_0x4cca0e[_0xd789('0x5')]||'';this[_0xd789('0x6')]=_0x4cca0e[_0xd789('0x6')]||'';this[_0xd789('0x7')]=_0x4cca0e[_0xd789('0x7')]||'';this['type']=_0x4cca0e['type']||'';this[_0xd789('0x8')]=_0x4cca0e['serverUrl']||'';this[_0xd789('0x9')]=_0x4cca0e[_0xd789('0x9')]||{};}module[_0xd789('0xa')]=DeskAccount; \ No newline at end of file +var _0xeb33=['tokenSecret','type','serverUrl','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x356196,_0x3f914d){var _0x26533e=function(_0x58b268){while(--_0x58b268){_0x356196['push'](_0x356196['shift']());}};_0x26533e(++_0x3f914d);}(_0xeb33,0x101));var _0x3eb3=function(_0x44b40d,_0x77aa74){_0x44b40d=_0x44b40d-0x0;var _0xe1b421=_0xeb33[_0x44b40d];return _0xe1b421;};'use strict';function DeskAccount(_0x566caa){this['id']=_0x566caa['id']||0x0;this['name']=_0x566caa[_0x3eb3('0x0')]||'';this['username']=_0x566caa['username']||'';this[_0x3eb3('0x1')]=_0x566caa[_0x3eb3('0x1')]||'';this[_0x3eb3('0x2')]=_0x566caa[_0x3eb3('0x2')]||'';this['password']=_0x566caa[_0x3eb3('0x3')]||'';this[_0x3eb3('0x4')]=_0x566caa['consumerKey']||'';this['consumerSecret']=_0x566caa[_0x3eb3('0x5')]||'';this[_0x3eb3('0x6')]=_0x566caa[_0x3eb3('0x6')]||'';this[_0x3eb3('0x7')]=_0x566caa[_0x3eb3('0x7')]||'';this[_0x3eb3('0x8')]=_0x566caa[_0x3eb3('0x8')]||'';this['serverUrl']=_0x566caa[_0x3eb3('0x9')]||'';this['Configurations']=_0x566caa['Configurations']||{};}module[_0x3eb3('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cba90b6..c53e743 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 _0x8bd8=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','name','username','password'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x8bd8,0x89));var _0x88bd=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8bd8[_0x2d7f0e];return _0x110b07;};'use strict';function Dynamics365Account(_0x2a25e7){this['id']=_0x2a25e7['id']||0x0;this[_0x88bd('0x0')]=_0x2a25e7[_0x88bd('0x0')]||'';this[_0x88bd('0x1')]=_0x2a25e7['username']||'';this[_0x88bd('0x2')]=_0x2a25e7['password']||'';this[_0x88bd('0x3')]=_0x2a25e7[_0x88bd('0x3')]||'';this[_0x88bd('0x4')]=_0x2a25e7[_0x88bd('0x4')]||'';this[_0x88bd('0x5')]=_0x2a25e7[_0x88bd('0x5')]||'';this[_0x88bd('0x6')]=_0x2a25e7['clientSecret']||{};this[_0x88bd('0x7')]=_0x2a25e7['serverUrl']||'';this['modernAuthentication']=_0x2a25e7[_0x88bd('0x8')]||![];this[_0x88bd('0x9')]=_0x2a25e7[_0x88bd('0x9')]||{};this['CloudProvider']=_0x2a25e7['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x598c=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x598c,0x83));var _0xc598=function(_0x45ce95,_0x455572){_0x45ce95=_0x45ce95-0x0;var _0x36ac41=_0x598c[_0x45ce95];return _0x36ac41;};'use strict';function Dynamics365Account(_0x1f41ff){this['id']=_0x1f41ff['id']||0x0;this[_0xc598('0x0')]=_0x1f41ff['name']||'';this[_0xc598('0x1')]=_0x1f41ff[_0xc598('0x1')]||'';this['password']=_0x1f41ff[_0xc598('0x2')]||'';this[_0xc598('0x3')]=_0x1f41ff[_0xc598('0x3')]||'';this[_0xc598('0x4')]=_0x1f41ff[_0xc598('0x4')]||'';this[_0xc598('0x5')]=_0x1f41ff[_0xc598('0x5')]||'';this[_0xc598('0x6')]=_0x1f41ff['clientSecret']||{};this['serverUrl']=_0x1f41ff[_0xc598('0x7')]||'';this[_0xc598('0x8')]=_0x1f41ff['modernAuthentication']||![];this[_0xc598('0x9')]=_0x1f41ff[_0xc598('0x9')]||{};this[_0xc598('0xa')]=_0x1f41ff['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 790a57f..c2db7c2 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 _0xd382=['faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway'];(function(_0x3c2efd,_0x405f28){var _0x433b01=function(_0xd9f231){while(--_0xd9f231){_0x3c2efd['push'](_0x3c2efd['shift']());}};_0x433b01(++_0x405f28);}(_0xd382,0xc7));var _0x2d38=function(_0x4f655a,_0x1a21a9){_0x4f655a=_0x4f655a-0x0;var _0x15da36=_0xd382[_0x4f655a];return _0x15da36;};'use strict';function FaxAccount(_0x3dc47f){this['id']=_0x3dc47f['id']||0x0;this[_0x2d38('0x0')]=_0x3dc47f['name']||'';this[_0x2d38('0x1')]=_0x3dc47f['description'];this[_0x2d38('0x2')]=_0x3dc47f['ecm'];this['headerinfo']=_0x3dc47f[_0x2d38('0x3')];this[_0x2d38('0x4')]=_0x3dc47f[_0x2d38('0x4')];this['minrate']=_0x3dc47f[_0x2d38('0x5')]||0x960;this['maxrate']=_0x3dc47f[_0x2d38('0x6')]||0x3840;this['modem']=_0x3dc47f['modem']||_0x2d38('0x7');this[_0x2d38('0x8')]=_0x3dc47f[_0x2d38('0x8')]||'no';this[_0x2d38('0x9')]=_0x3dc47f[_0x2d38('0x9')]||'no';this['t38timeout']=_0x3dc47f['t38timeout']||0x1388;this[_0x2d38('0xa')]=_0x3dc47f[_0x2d38('0xa')]||_0x2d38('0xb');this[_0x2d38('0xc')]=_0x3dc47f[_0x2d38('0xc')]?_0x3dc47f[_0x2d38('0xc')]:undefined;this[_0x2d38('0xd')]=_0x3dc47f['ListId'];this['key']=_0x3dc47f[_0x2d38('0xe')];}module[_0x2d38('0xf')]=FaxAccount; \ No newline at end of file +var _0x4bb3=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x4bb3,0xc2));var _0x34bb=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x4bb3[_0x587dd0];return _0x56f153;};'use strict';function FaxAccount(_0x5cb898){this['id']=_0x5cb898['id']||0x0;this[_0x34bb('0x0')]=_0x5cb898[_0x34bb('0x0')]||'';this['description']=_0x5cb898[_0x34bb('0x1')];this[_0x34bb('0x2')]=_0x5cb898[_0x34bb('0x2')];this[_0x34bb('0x3')]=_0x5cb898['headerinfo'];this[_0x34bb('0x4')]=_0x5cb898[_0x34bb('0x4')];this[_0x34bb('0x5')]=_0x5cb898[_0x34bb('0x5')]||0x960;this[_0x34bb('0x6')]=_0x5cb898[_0x34bb('0x6')]||0x3840;this['modem']=_0x5cb898[_0x34bb('0x7')]||_0x34bb('0x8');this[_0x34bb('0x9')]=_0x5cb898[_0x34bb('0x9')]||'no';this[_0x34bb('0xa')]=_0x5cb898[_0x34bb('0xa')]||'no';this[_0x34bb('0xb')]=_0x5cb898[_0x34bb('0xb')]||0x1388;this[_0x34bb('0xc')]=_0x5cb898['tech']||_0x34bb('0xd');this[_0x34bb('0xe')]=_0x5cb898['Trunk']?_0x5cb898['Trunk']:undefined;this[_0x34bb('0xf')]=_0x5cb898[_0x34bb('0xf')];this[_0x34bb('0x10')]=_0x5cb898[_0x34bb('0x10')];}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 30204eb..510aecb 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 _0xd3ed=['exports','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x4f187d,_0x4f3568){var _0x35063f=function(_0x20dc78){while(--_0x20dc78){_0x4f187d['push'](_0x4f187d['shift']());}};_0x35063f(++_0x4f3568);}(_0xd3ed,0xf7));var _0xdd3e=function(_0x3978d3,_0x5b9984){_0x3978d3=_0x3978d3-0x0;var _0x2f1dfa=_0xd3ed[_0x3978d3];return _0x2f1dfa;};'use strict';function FreshdeskAccount(_0x33daab){this['id']=_0x33daab['id']||0x0;this['name']=_0x33daab['name']||'';this['username']=_0x33daab[_0xdd3e('0x0')]||'';this[_0xdd3e('0x1')]=_0x33daab['token']||'';this[_0xdd3e('0x2')]=_0x33daab['remoteUri']||'';this['serverUrl']=_0x33daab[_0xdd3e('0x3')]||'';this[_0xdd3e('0x4')]=_0x33daab[_0xdd3e('0x4')]||{};}module[_0xdd3e('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xc9f8=['Configurations','name','username','token','remoteUri','serverUrl'];(function(_0x46a40b,_0x435c9a){var _0x283733=function(_0x83f6fd){while(--_0x83f6fd){_0x46a40b['push'](_0x46a40b['shift']());}};_0x283733(++_0x435c9a);}(_0xc9f8,0x13f));var _0x8c9f=function(_0x3ebc58,_0x4d2749){_0x3ebc58=_0x3ebc58-0x0;var _0x5b5d69=_0xc9f8[_0x3ebc58];return _0x5b5d69;};'use strict';function FreshdeskAccount(_0x2515ed){this['id']=_0x2515ed['id']||0x0;this['name']=_0x2515ed[_0x8c9f('0x0')]||'';this[_0x8c9f('0x1')]=_0x2515ed[_0x8c9f('0x1')]||'';this['apiKey']=_0x2515ed[_0x8c9f('0x2')]||'';this[_0x8c9f('0x3')]=_0x2515ed[_0x8c9f('0x3')]||'';this[_0x8c9f('0x4')]=_0x2515ed[_0x8c9f('0x4')]||'';this[_0x8c9f('0x5')]=_0x2515ed[_0x8c9f('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 39368d1..2a2a605 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 _0xf3cc=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x34eabc,_0x51d411){_0x34eabc=_0x34eabc-0x0;var _0x43e72f=_0xf3cc[_0x34eabc];return _0x43e72f;};'use strict';function FreshsalesAccount(_0x48162b){this['id']=_0x48162b['id']||0x0;this[_0xcf3c('0x0')]=_0x48162b[_0xcf3c('0x0')]||'';this[_0xcf3c('0x1')]=_0x48162b['username']||'';this[_0xcf3c('0x2')]=_0x48162b[_0xcf3c('0x3')]||'';this[_0xcf3c('0x4')]=_0x48162b['remoteUri']||'';this[_0xcf3c('0x5')]=_0x48162b[_0xcf3c('0x5')]||'';this['Configurations']=_0x48162b[_0xcf3c('0x6')]||{};}module[_0xcf3c('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xfd6e=['name','username','apiKey','serverUrl','Configurations','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';function FreshsalesAccount(_0x501204){this['id']=_0x501204['id']||0x0;this['name']=_0x501204[_0xefd6('0x0')]||'';this['username']=_0x501204[_0xefd6('0x1')]||'';this[_0xefd6('0x2')]=_0x501204['token']||'';this['remoteUri']=_0x501204['remoteUri']||'';this[_0xefd6('0x3')]=_0x501204['serverUrl']||'';this['Configurations']=_0x501204[_0xefd6('0x4')]||{};}module[_0xefd6('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9402c4a..b079035 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 _0xbe56=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xbe56,0x13d));var _0x6be5=function(_0xf4c2a,_0x326579){_0xf4c2a=_0xf4c2a-0x0;var _0x18e9b8=_0xbe56[_0xf4c2a];return _0x18e9b8;};'use strict';function QueueReport(){this[_0x6be5('0x0')]='inbound';this[_0x6be5('0x1')]='';this[_0x6be5('0x2')]='';this['calleridname']='';this['queue']='';this[_0x6be5('0x3')]=null;this[_0x6be5('0x4')]=null;this[_0x6be5('0x5')]=0x1;this[_0x6be5('0x6')]=0x1;this['queuecallerabandon']=![];this[_0x6be5('0x7')]=null;this['queuecallercomplete']=![];this[_0x6be5('0x8')]=null;this[_0x6be5('0x9')]=![];this[_0x6be5('0xa')]=null;this['originalposition']=0x1;this[_0x6be5('0xb')]='';this[_0x6be5('0xc')]='';this[_0x6be5('0xd')]='';this[_0x6be5('0xe')]='';this[_0x6be5('0xf')]='';this[_0x6be5('0x10')]='';this[_0x6be5('0x11')]='';this[_0x6be5('0x12')]=0x0;this['assigned']=![];this[_0x6be5('0x13')]='';this[_0x6be5('0x14')]=_0x6be5('0x15');this[_0x6be5('0x16')]=0x0;this[_0x6be5('0x17')]={};}module[_0x6be5('0x18')]=QueueReport; \ No newline at end of file +var _0x0f3a=['exports','inbound','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0f3a,0x177));var _0xa0f3=function(_0x3de7e5,_0x52212e){_0x3de7e5=_0x3de7e5-0x0;var _0x1d3683=_0x0f3a[_0x3de7e5];return _0x1d3683;};'use strict';function QueueReport(){this['type']=_0xa0f3('0x0');this['uniqueid']='';this[_0xa0f3('0x1')]='';this['calleridname']='';this[_0xa0f3('0x2')]='';this[_0xa0f3('0x3')]=null;this['queuecallerleaveAt']=null;this[_0xa0f3('0x4')]=0x1;this[_0xa0f3('0x5')]=0x1;this[_0xa0f3('0x6')]=![];this[_0xa0f3('0x7')]=null;this[_0xa0f3('0x8')]=![];this[_0xa0f3('0x9')]=null;this[_0xa0f3('0xa')]=![];this[_0xa0f3('0xb')]=null;this[_0xa0f3('0xc')]=0x1;this['channel']='';this[_0xa0f3('0xd')]='';this[_0xa0f3('0xe')]='';this['accountcode']='';this['context']='';this['exten']='';this[_0xa0f3('0xf')]='';this[_0xa0f3('0x10')]=0x0;this[_0xa0f3('0x11')]=![];this[_0xa0f3('0x12')]='';this[_0xa0f3('0x13')]='voice';this[_0xa0f3('0x14')]=0x0;this['variables']={};}module[_0xa0f3('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1a7bd0b..fb459cd 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 _0x27d7=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x3a9661,_0x530b12){var _0x5bb119=function(_0x1278f){while(--_0x1278f){_0x3a9661['push'](_0x3a9661['shift']());}};_0x5bb119(++_0x530b12);}(_0x27d7,0xa4));var _0x727d=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x27d7[_0x210d7f];return _0x42d687;};'use strict';function SalesforceAccount(_0x52e768){this['id']=_0x52e768['id']||0x0;this['name']=_0x52e768[_0x727d('0x0')]||'';this[_0x727d('0x1')]=_0x52e768['username']||'';this[_0x727d('0x2')]=_0x52e768['remoteUri']||'';this[_0x727d('0x3')]=_0x52e768[_0x727d('0x3')]||'';this[_0x727d('0x4')]=_0x52e768[_0x727d('0x4')]||'';this['clientSecret']=_0x52e768[_0x727d('0x5')]||'';this['securityToken']=_0x52e768[_0x727d('0x6')]||'';this[_0x727d('0x7')]=_0x52e768[_0x727d('0x7')]||_0x727d('0x8');this[_0x727d('0x9')]=_0x52e768[_0x727d('0x9')]||'';this[_0x727d('0xa')]=_0x52e768[_0x727d('0xa')]||{};}module[_0x727d('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x9931=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','exports','name','username'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9931,0x1b6));var _0x1993=function(_0x2b771e,_0x3bbe3e){_0x2b771e=_0x2b771e-0x0;var _0x39add7=_0x9931[_0x2b771e];return _0x39add7;};'use strict';function SalesforceAccount(_0xa53aca){this['id']=_0xa53aca['id']||0x0;this[_0x1993('0x0')]=_0xa53aca['name']||'';this[_0x1993('0x1')]=_0xa53aca[_0x1993('0x1')]||'';this[_0x1993('0x2')]=_0xa53aca[_0x1993('0x2')]||'';this[_0x1993('0x3')]=_0xa53aca[_0x1993('0x3')]||'';this[_0x1993('0x4')]=_0xa53aca[_0x1993('0x4')]||'';this[_0x1993('0x5')]=_0xa53aca[_0x1993('0x5')]||'';this[_0x1993('0x6')]=_0xa53aca[_0x1993('0x6')]||'';this[_0x1993('0x7')]=_0xa53aca[_0x1993('0x7')]||_0x1993('0x8');this[_0x1993('0x9')]=_0xa53aca[_0x1993('0x9')]||'';this['Configurations']=_0xa53aca['Configurations']||{};}module[_0x1993('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index bba90e4..b942008 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 _0xa790=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xa34bda,_0x34f584){var _0x37c970=function(_0xa3eca2){while(--_0xa3eca2){_0xa34bda['push'](_0xa34bda['shift']());}};_0x37c970(++_0x34f584);}(_0xa790,0x174));var _0x0a79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa790[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x33b134){this['id']=_0x33b134['id']||0x0;this[_0x0a79('0x0')]=_0x33b134[_0x0a79('0x0')]||'';this[_0x0a79('0x1')]=_0x33b134[_0x0a79('0x1')]||'';this[_0x0a79('0x2')]=_0x33b134['password']||'';this[_0x0a79('0x3')]=_0x33b134[_0x0a79('0x3')]||'';this[_0x0a79('0x4')]=_0x33b134[_0x0a79('0x4')]||'';this[_0x0a79('0x5')]=_0x33b134['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xb73a=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x8230ee,_0xa65339){var _0x45cd7=function(_0x2af977){while(--_0x2af977){_0x8230ee['push'](_0x8230ee['shift']());}};_0x45cd7(++_0xa65339);}(_0xb73a,0x1e8));var _0xab73=function(_0x3b39ce,_0x1fc022){_0x3b39ce=_0x3b39ce-0x0;var _0x3cdd22=_0xb73a[_0x3b39ce];return _0x3cdd22;};'use strict';function ServicenowAccount(_0x22f76f){this['id']=_0x22f76f['id']||0x0;this[_0xab73('0x0')]=_0x22f76f[_0xab73('0x0')]||'';this['username']=_0x22f76f[_0xab73('0x1')]||'';this['password']=_0x22f76f[_0xab73('0x2')]||'';this[_0xab73('0x3')]=_0x22f76f[_0xab73('0x3')]||'';this[_0xab73('0x4')]=_0x22f76f['serverUrl']||'';this['Configurations']=_0x22f76f[_0xab73('0x5')]||{};}module[_0xab73('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 fac2034..72a1757 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 _0x86c9=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x86c9,0x100));var _0x986c=function(_0x39a7f3,_0x99b34d){_0x39a7f3=_0x39a7f3-0x0;var _0x46b4f9=_0x86c9[_0x39a7f3];return _0x46b4f9;};'use strict';function SugarcrmAccount(_0x2174aa){this['id']=_0x2174aa['id']||0x0;this['name']=_0x2174aa[_0x986c('0x0')]||'';this[_0x986c('0x1')]=_0x2174aa[_0x986c('0x1')]||'';this[_0x986c('0x2')]=_0x2174aa[_0x986c('0x2')]||'';this[_0x986c('0x3')]=_0x2174aa['remoteUri']||'';this[_0x986c('0x4')]=_0x2174aa[_0x986c('0x4')]||'';this['Configurations']=_0x2174aa[_0x986c('0x5')]||{};}module[_0x986c('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x431a=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x3a768e,_0x2c981d){var _0x5c42af=function(_0x440beb){while(--_0x440beb){_0x3a768e['push'](_0x3a768e['shift']());}};_0x5c42af(++_0x2c981d);}(_0x431a,0x1e3));var _0xa431=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x431a[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x55736d){this['id']=_0x55736d['id']||0x0;this[_0xa431('0x0')]=_0x55736d[_0xa431('0x0')]||'';this['username']=_0x55736d[_0xa431('0x1')]||'';this[_0xa431('0x2')]=_0x55736d[_0xa431('0x2')]||'';this[_0xa431('0x3')]=_0x55736d[_0xa431('0x3')]||'';this[_0xa431('0x4')]=_0x55736d[_0xa431('0x4')]||'';this[_0xa431('0x5')]=_0x55736d[_0xa431('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 77a20f4..836d5bf 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 _0x7462=['status','address','exports','name','accountcode','stateTime'];(function(_0xf5df05,_0x1b35c6){var _0xe6db6d=function(_0x4febe1){while(--_0x4febe1){_0xf5df05['push'](_0xf5df05['shift']());}};_0xe6db6d(++_0x1b35c6);}(_0x7462,0x165));var _0x2746=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x7462[_0x4629ee];return _0x47fb5b;};'use strict';function Telephone(_0x5605cb){this['id']=_0x5605cb['id']||0x0;this[_0x2746('0x0')]=_0x5605cb['name']||'';this['accountcode']=_0x5605cb[_0x2746('0x1')]||'';this['state']='unknown';this[_0x2746('0x2')]=0x0;this[_0x2746('0x3')]='unknown';this[_0x2746('0x4')]='';}module[_0x2746('0x5')]=Telephone; \ No newline at end of file +var _0xf4f5=['stateTime','status','unknown','address','name','accountcode','state'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f5,0x89));var _0x5f4f=function(_0x5634c0,_0x5dfad9){_0x5634c0=_0x5634c0-0x0;var _0x14851e=_0xf4f5[_0x5634c0];return _0x14851e;};'use strict';function Telephone(_0x23a7ea){this['id']=_0x23a7ea['id']||0x0;this[_0x5f4f('0x0')]=_0x23a7ea['name']||'';this[_0x5f4f('0x1')]=_0x23a7ea['accountcode']||'';this[_0x5f4f('0x2')]='unknown';this[_0x5f4f('0x3')]=0x0;this[_0x5f4f('0x4')]=_0x5f4f('0x5');this[_0x5f4f('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index de91d3a..50d662f 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x554d04,_0x145393){var _0x3c91c1=function(_0x49b122){while(--_0x49b122){_0x554d04['push'](_0x554d04['shift']());}};_0x3c91c1(++_0x145393);}(_0xb10b,0x12a));var _0xbb10=function(_0x30505b,_0x3b6c06){_0x30505b=_0x30505b-0x0;var _0x4f7466=_0xb10b[_0x30505b];return _0x4f7466;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x44c460,_0x43fb19){var _0x49eb28=function(_0xb8cb57){while(--_0xb8cb57){_0x44c460['push'](_0x44c460['shift']());}};_0x49eb28(++_0x43fb19);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index cebe595..804db24 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0xea5fef,_0x1811ee){var _0x2958c4=function(_0x266e88){while(--_0x266e88){_0xea5fef['push'](_0xea5fef['shift']());}};_0x2958c4(++_0x1811ee);}(_0x8603,0x190));var _0x3860=function(_0x5c1d0d,_0x3fc558){_0x5c1d0d=_0x5c1d0d-0x0;var _0x3853d1=_0x8603[_0x5c1d0d];return _0x3853d1;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a42a8b1..22a07f0 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 _0x9dd5=['registrationtime','defaultuser','exports','active','name','state','unknown','registry','indexOf','split','host','port','domain'];(function(_0x52e64,_0x6ba4e8){var _0x282b80=function(_0xc11939){while(--_0xc11939){_0x52e64['push'](_0x52e64['shift']());}};_0x282b80(++_0x6ba4e8);}(_0x9dd5,0x148));var _0x59dd=function(_0x4edfef,_0x3d9692){_0x4edfef=_0x4edfef-0x0;var _0x10384f=_0x9dd5[_0x4edfef];return _0x10384f;};'use strict';function Trunk(_0x22f4e8){this['id']=_0x22f4e8['id']||0x0;this[_0x59dd('0x0')]=_0x22f4e8[_0x59dd('0x0')]||![];this[_0x59dd('0x1')]=_0x22f4e8[_0x59dd('0x1')]||'';this[_0x59dd('0x2')]=_0x59dd('0x3');this['stateTime']=0x0;this['status']=_0x59dd('0x3');this[_0x59dd('0x4')]=_0x22f4e8[_0x59dd('0x4')]&&_0x22f4e8[_0x59dd('0x4')][_0x59dd('0x5')](':')?_0x22f4e8[_0x59dd('0x4')][_0x59dd('0x6')](':')[0x0]:'';this[_0x59dd('0x7')]='';this[_0x59dd('0x8')]='';this[_0x59dd('0x9')]='';this['domainport']='';this['refresh']='';this['stateRegistry']=_0x59dd('0x3');this[_0x59dd('0xa')]='';this['address']='';this[_0x59dd('0xb')]=_0x22f4e8[_0x59dd('0xb')]||'';}module[_0x59dd('0xc')]=Trunk; \ No newline at end of file +var _0x52f2=['address','defaultuser','active','name','state','status','unknown','registry','split','host','port','domainport','refresh','stateRegistry','registrationtime'];(function(_0x8e448c,_0x37a1a3){var _0x189909=function(_0x3db713){while(--_0x3db713){_0x8e448c['push'](_0x8e448c['shift']());}};_0x189909(++_0x37a1a3);}(_0x52f2,0x1d3));var _0x252f=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x52f2[_0x4ea69d];return _0x5318e0;};'use strict';function Trunk(_0x335f2a){this['id']=_0x335f2a['id']||0x0;this[_0x252f('0x0')]=_0x335f2a['active']||![];this['name']=_0x335f2a[_0x252f('0x1')]||'';this[_0x252f('0x2')]='unknown';this['stateTime']=0x0;this[_0x252f('0x3')]=_0x252f('0x4');this[_0x252f('0x5')]=_0x335f2a['registry']&&_0x335f2a[_0x252f('0x5')]['indexOf'](':')?_0x335f2a[_0x252f('0x5')][_0x252f('0x6')](':')[0x0]:'';this[_0x252f('0x7')]='';this[_0x252f('0x8')]='';this['domain']='';this[_0x252f('0x9')]='';this[_0x252f('0xa')]='';this[_0x252f('0xb')]=_0x252f('0x4');this[_0x252f('0xc')]='';this[_0x252f('0xd')]='';this[_0x252f('0xe')]=_0x335f2a[_0x252f('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 01ed6de..0f6d315 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 _0x8691=['exten','recordingFormat','none','exports'];(function(_0x57e799,_0x5938d6){var _0x8a389d=function(_0x1df75b){while(--_0x1df75b){_0x57e799['push'](_0x57e799['shift']());}};_0x8a389d(++_0x5938d6);}(_0x8691,0x190));var _0x1869=function(_0x27c46d,_0x446b75){_0x27c46d=_0x27c46d-0x0;var _0x3f3d04=_0x8691[_0x27c46d];return _0x3f3d04;};'use strict';function voiceExtension(_0x55e573){this['id']=_0x55e573['id']||0x0;this[_0x1869('0x0')]=_0x55e573[_0x1869('0x0')]||'';this[_0x1869('0x1')]=_0x55e573[_0x1869('0x1')]||_0x1869('0x2');this['mandatoryDisposition']=_0x55e573['mandatoryDisposition']||![];}module[_0x1869('0x3')]=voiceExtension; \ No newline at end of file +var _0x510d=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x510d,0x1f1));var _0xd510=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x510d[_0x6c993a];return _0x27f547;};'use strict';function voiceExtension(_0x30df40){this['id']=_0x30df40['id']||0x0;this[_0xd510('0x0')]=_0x30df40[_0xd510('0x0')]||'';this[_0xd510('0x1')]=_0x30df40[_0xd510('0x1')]||_0xd510('0x2');this[_0xd510('0x3')]=_0x30df40['mandatoryDisposition']||![];}module[_0xd510('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9d1ee64..6cb8368 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 _0x032b=['queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','ringing','ringinuse','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','acw','acwTimeout','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy'];(function(_0x56d377,_0x7aef7f){var _0x4c102d=function(_0x2c59d4){while(--_0x2c59d4){_0x56d377['push'](_0x56d377['shift']());}};_0x4c102d(++_0x7aef7f);}(_0x032b,0x197));var _0xb032=function(_0x74118b,_0x239694){_0x74118b=_0x74118b-0x0;var _0x257525=_0x032b[_0x74118b];return _0x257525;};'use strict';var statusDesc=[_0xb032('0x0'),_0xb032('0x1'),_0xb032('0x2'),'busy',_0xb032('0x3'),'unavailable',_0xb032('0x4'),_0xb032('0x5'),'onhold'];var monitorFormat={'wav':_0xb032('0x6'),'wav49':_0xb032('0x7'),'gsm':_0xb032('0x8')};var strategy={'rrmemory':_0xb032('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2ffa10){this['id']=_0x2ffa10['id']||0x0;this[_0xb032('0xa')]=_0x2ffa10[_0xb032('0xa')]||'';this[_0xb032('0xb')]=_0x2ffa10[_0xb032('0xb')]||'';this[_0xb032('0xc')]=_0x2ffa10['type']||_0xb032('0xd');this['waiting']=0x0;this['talking']=0x0;this[_0xb032('0xe')]=0x0;this[_0xb032('0xf')]=0x0;this[_0xb032('0x10')]=0x0;this[_0xb032('0x11')]=0x0;this['sumBillable']=0x0;this[_0xb032('0x12')]=0x0;this[_0xb032('0x13')]=0x0;this['loggedIn']=0x0;this[_0xb032('0x14')]=0x0;this[_0xb032('0x15')]=_0x2ffa10[_0xb032('0x15')]||![];this[_0xb032('0x16')]=_0x2ffa10[_0xb032('0x16')]||0xa;this['autopause']=_0x2ffa10['autopause']||'no';this[_0xb032('0x17')]=!![];this['message']='';this[_0xb032('0x18')]=0x0;this[_0xb032('0x19')]=0x0;this[_0xb032('0x1a')]=_0x2ffa10[_0xb032('0x1a')]||null;this['dialGlobalInterval']=_0x2ffa10[_0xb032('0x1b')]?_0x2ffa10[_0xb032('0x1b')]:null;this[_0xb032('0x1c')]=_0x2ffa10[_0xb032('0x1c')];this[_0xb032('0x1d')]=_0x2ffa10['dialMethod']||_0xb032('0x1e');this['dialLimitChannel']=_0x2ffa10[_0xb032('0x1f')]||0x0;this['dialLimitQueue']=_0x2ffa10[_0xb032('0x20')]||0x0;this['dialPowerLevel']=_0x2ffa10[_0xb032('0x21')]||0x1;this[_0xb032('0x22')]=_0x2ffa10[_0xb032('0x22')]||_0xb032('0x23');this[_0xb032('0x24')]=_0x2ffa10[_0xb032('0x24')]||0.03;this['dialPredictiveInterval']=_0x2ffa10[_0xb032('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x2ffa10[_0xb032('0x26')]||'anonymous';this[_0xb032('0x27')]=_0x2ffa10[_0xb032('0x27')]||_0xb032('0x28');this['dialOriginateTimeout']=_0x2ffa10[_0xb032('0x29')]||0x1e;this[_0xb032('0x2a')]=_0x2ffa10[_0xb032('0x2a')]||'tTxX';this[_0xb032('0x2b')]=_0x2ffa10[_0xb032('0x2b')]||0x3;this[_0xb032('0x2c')]=_0x2ffa10[_0xb032('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x2ffa10[_0xb032('0x2d')]||0x3;this[_0xb032('0x2e')]=_0x2ffa10['dialCongestionRetryFrequency']||0x96;this[_0xb032('0x2f')]=_0x2ffa10['dialBusyMaxRetry']||0x3;this[_0xb032('0x30')]=_0x2ffa10[_0xb032('0x30')]||0x96;this[_0xb032('0x31')]=_0x2ffa10[_0xb032('0x31')]||0x3;this[_0xb032('0x32')]=_0x2ffa10[_0xb032('0x32')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2ffa10['dialNoSuchNumberMaxRetry']||0x3;this[_0xb032('0x33')]=_0x2ffa10[_0xb032('0x33')]||0x96;this[_0xb032('0x34')]=_0x2ffa10['dialDropMaxRetry']||0x3;this[_0xb032('0x35')]=_0x2ffa10[_0xb032('0x35')]||0x96;this[_0xb032('0x36')]=_0x2ffa10[_0xb032('0x36')]||0x3;this[_0xb032('0x37')]=_0x2ffa10[_0xb032('0x37')]||0x96;this[_0xb032('0x38')]=_0x2ffa10[_0xb032('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x2ffa10['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2ffa10[_0xb032('0x39')]||0x3;this[_0xb032('0x3a')]=_0x2ffa10[_0xb032('0x3a')]||0x96;this[_0xb032('0x3b')]=_0x2ffa10[_0xb032('0x3b')]||0x3;this[_0xb032('0x3c')]=_0x2ffa10[_0xb032('0x3c')]||0x4;this['Trunk']=_0x2ffa10[_0xb032('0x3d')]?_0x2ffa10[_0xb032('0x3d')]:undefined;this[_0xb032('0x3e')]=_0x2ffa10[_0xb032('0x3e')]?_0x2ffa10['TrunkBackup']:undefined;this['dialPrefix']=_0x2ffa10[_0xb032('0x3f')]||undefined;this[_0xb032('0x40')]=_0x2ffa10[_0xb032('0x40')]?_0x2ffa10[_0xb032('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x2ffa10['dialOrderByScheduledAt']||_0xb032('0x41');this[_0xb032('0x42')]=_0x2ffa10['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2ffa10[_0xb032('0x43')]||undefined;this[_0xb032('0x44')]=strategy[_0x2ffa10[_0xb032('0x44')]]||_0xb032('0x9');this[_0xb032('0x45')]=!![];this['dialAMDActive']=_0x2ffa10[_0xb032('0x46')]||![];this['dialAMDInitialSilence']=_0x2ffa10[_0xb032('0x47')];this['dialAMDGreeting']=_0x2ffa10[_0xb032('0x48')];this[_0xb032('0x49')]=_0x2ffa10[_0xb032('0x49')];this[_0xb032('0x4a')]=_0x2ffa10[_0xb032('0x4a')];this['dialAMDMinWordLength']=_0x2ffa10[_0xb032('0x4b')];this['dialAMDBetweenWordsSilence']=_0x2ffa10[_0xb032('0x4c')];this['dialAMDMaximumNumberOfWords']=_0x2ffa10['dialAMDMaximumNumberOfWords'];this[_0xb032('0x4d')]=_0x2ffa10[_0xb032('0x4d')];this[_0xb032('0x4e')]=_0x2ffa10[_0xb032('0x4e')];this[_0xb032('0x4f')]=0x0;this[_0xb032('0x50')]=0x0;this[_0xb032('0x51')]=_0x2ffa10[_0xb032('0x51')];this[_0xb032('0x52')]=0x0;this[_0xb032('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb032('0x54')]=0x0;this[_0xb032('0x55')]=0x0;this[_0xb032('0x56')]=0x0;this[_0xb032('0x57')]=0x0;this[_0xb032('0x58')]=0x0;this[_0xb032('0x59')]=0x0;this[_0xb032('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb032('0x5b')]=0x0;this[_0xb032('0x5c')]=0x0;this[_0xb032('0x5d')]=undefined;this[_0xb032('0x5e')]=undefined;this[_0xb032('0x5f')]=undefined;this[_0xb032('0x60')]=1.05;this[_0xb032('0x61')]=0x0;this[_0xb032('0x62')]=0x0;this[_0xb032('0x63')]=0x0;this[_0xb032('0x64')]=0x0;this[_0xb032('0x65')]=0x0;this[_0xb032('0x66')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xb032('0x67')]=0x0;this[_0xb032('0x68')]=_0x2ffa10['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb032('0x69')]=_0x2ffa10['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xb032('0x6a')]=0x1;this[_0xb032('0x6b')]=0x0;this[_0xb032('0x6c')]=0x0;this[_0xb032('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0xb032('0x6e')]=_0x2ffa10[_0xb032('0x6e')]||0x1e;this[_0xb032('0x6f')]=_0x2ffa10[_0xb032('0x6f')]||![];this[_0xb032('0x70')]=!!_0x2ffa10[_0xb032('0x70')]||![];this['dialPreviewRecallmeReminder']=!!_0x2ffa10['dialPreviewRecallmeReminder']||![];this[_0xb032('0x71')]=_0x2ffa10[_0xb032('0x71')]||undefined;this[_0xb032('0x72')]=_0x2ffa10['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x2ffa10[_0xb032('0x73')]||![];this[_0xb032('0xb')]=monitorFormat[_0x2ffa10[_0xb032('0xb')]]?monitorFormat[_0x2ffa10['monitor_format']]:undefined;this[_0xb032('0x74')]=_0x2ffa10['mandatoryDisposition']||![];this[_0xb032('0x75')]=_0x2ffa10[_0xb032('0x75')]?_0x2ffa10['mandatoryDispositionPause']:undefined;}module[_0xb032('0x76')]=VoiceQueue; \ No newline at end of file +var _0x5cc3=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval'];(function(_0x118bf0,_0x53dd99){var _0x204345=function(_0x48706f){while(--_0x48706f){_0x118bf0['push'](_0x118bf0['shift']());}};_0x204345(++_0x53dd99);}(_0x5cc3,0x144));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var statusDesc=[_0x35cc('0x0'),_0x35cc('0x1'),_0x35cc('0x2'),_0x35cc('0x3'),_0x35cc('0x4'),_0x35cc('0x5'),_0x35cc('0x6'),_0x35cc('0x7'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x35cc('0x8'),'gsm':_0x35cc('0x9')};var strategy={'rrmemory':_0x35cc('0xa'),'roundrobin':_0x35cc('0xb')};function VoiceQueue(_0x40b600){this['id']=_0x40b600['id']||0x0;this[_0x35cc('0xc')]=_0x40b600[_0x35cc('0xc')]||'';this[_0x35cc('0xd')]=_0x40b600[_0x35cc('0xd')]||'';this[_0x35cc('0xe')]=_0x40b600[_0x35cc('0xe')]||_0x35cc('0xf');this[_0x35cc('0x10')]=0x0;this[_0x35cc('0x11')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x35cc('0x12')]=0x0;this[_0x35cc('0x13')]=0x0;this[_0x35cc('0x14')]=0x0;this[_0x35cc('0x15')]=0x0;this[_0x35cc('0x16')]=0x0;this['loggedIn']=0x0;this[_0x35cc('0x17')]=0x0;this['acw']=_0x40b600[_0x35cc('0x18')]||![];this[_0x35cc('0x19')]=_0x40b600[_0x35cc('0x19')]||0xa;this[_0x35cc('0x1a')]=_0x40b600[_0x35cc('0x1a')]||'no';this[_0x35cc('0x1b')]=!![];this[_0x35cc('0x1c')]='';this[_0x35cc('0x1d')]=0x0;this['temp']=0x0;this[_0x35cc('0x1e')]=_0x40b600['dialTimezone']||null;this[_0x35cc('0x1f')]=_0x40b600[_0x35cc('0x1f')]?_0x40b600[_0x35cc('0x1f')]:null;this[_0x35cc('0x20')]=_0x40b600[_0x35cc('0x20')];this[_0x35cc('0x21')]=_0x40b600[_0x35cc('0x21')]||_0x35cc('0x22');this[_0x35cc('0x23')]=_0x40b600[_0x35cc('0x23')]||0x0;this[_0x35cc('0x24')]=_0x40b600[_0x35cc('0x24')]||0x0;this['dialPowerLevel']=_0x40b600[_0x35cc('0x25')]||0x1;this[_0x35cc('0x26')]=_0x40b600['dialPredictiveOptimization']||_0x35cc('0x27');this[_0x35cc('0x28')]=_0x40b600['dialPredictiveOptimizationPercentage']||0.03;this[_0x35cc('0x29')]=_0x40b600[_0x35cc('0x29')]||0x258;this[_0x35cc('0x2a')]=_0x40b600['dialOriginateCallerIdName']||'anonymous';this[_0x35cc('0x2b')]=_0x40b600[_0x35cc('0x2b')]||'anonymous';this[_0x35cc('0x2c')]=_0x40b600[_0x35cc('0x2c')]||0x1e;this['dialQueueOptions']=_0x40b600[_0x35cc('0x2d')]||_0x35cc('0x2e');this[_0x35cc('0x2f')]=_0x40b600[_0x35cc('0x2f')]||0x3;this[_0x35cc('0x30')]=_0x40b600[_0x35cc('0x30')]||undefined;this[_0x35cc('0x31')]=_0x40b600[_0x35cc('0x31')]||0x3;this[_0x35cc('0x32')]=_0x40b600[_0x35cc('0x32')]||0x96;this[_0x35cc('0x33')]=_0x40b600['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x40b600['dialBusyRetryFrequency']||0x96;this[_0x35cc('0x34')]=_0x40b600[_0x35cc('0x34')]||0x3;this[_0x35cc('0x35')]=_0x40b600['dialNoAnswerRetryFrequency']||0x96;this[_0x35cc('0x36')]=_0x40b600[_0x35cc('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x40b600[_0x35cc('0x37')]||0x96;this[_0x35cc('0x38')]=_0x40b600['dialDropMaxRetry']||0x3;this[_0x35cc('0x39')]=_0x40b600['dialDropRetryFrequency']||0x96;this[_0x35cc('0x3a')]=_0x40b600[_0x35cc('0x3a')]||0x3;this[_0x35cc('0x3b')]=_0x40b600[_0x35cc('0x3b')]||0x96;this[_0x35cc('0x3c')]=_0x40b600[_0x35cc('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x40b600[_0x35cc('0x3d')]||0x96;this[_0x35cc('0x3e')]=_0x40b600[_0x35cc('0x3e')]||0x3;this[_0x35cc('0x3f')]=_0x40b600[_0x35cc('0x3f')]||0x96;this[_0x35cc('0x40')]=_0x40b600[_0x35cc('0x40')]||0x3;this[_0x35cc('0x41')]=_0x40b600[_0x35cc('0x41')]||0x4;this['Trunk']=_0x40b600[_0x35cc('0x42')]?_0x40b600['Trunk']:undefined;this['TrunkBackup']=_0x40b600[_0x35cc('0x43')]?_0x40b600['TrunkBackup']:undefined;this[_0x35cc('0x44')]=_0x40b600[_0x35cc('0x44')]||undefined;this[_0x35cc('0x45')]=_0x40b600['Interval']?_0x40b600[_0x35cc('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x40b600[_0x35cc('0x46')]||_0x35cc('0x47');this[_0x35cc('0x48')]=_0x40b600['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x35cc('0x49')]=_0x40b600['dialCutDigit']||undefined;this['strategy']=strategy[_0x40b600['strategy']]||'rrmemory';this[_0x35cc('0x4a')]=!![];this[_0x35cc('0x4b')]=_0x40b600[_0x35cc('0x4b')]||![];this[_0x35cc('0x4c')]=_0x40b600['dialAMDInitialSilence'];this[_0x35cc('0x4d')]=_0x40b600[_0x35cc('0x4d')];this[_0x35cc('0x4e')]=_0x40b600[_0x35cc('0x4e')];this[_0x35cc('0x4f')]=_0x40b600[_0x35cc('0x4f')];this[_0x35cc('0x50')]=_0x40b600[_0x35cc('0x50')];this[_0x35cc('0x51')]=_0x40b600[_0x35cc('0x51')];this[_0x35cc('0x52')]=_0x40b600[_0x35cc('0x52')];this[_0x35cc('0x53')]=_0x40b600['dialAMDSilenceThreshold'];this[_0x35cc('0x54')]=_0x40b600[_0x35cc('0x54')];this[_0x35cc('0x55')]=0x0;this[_0x35cc('0x56')]=0x0;this[_0x35cc('0x57')]=_0x40b600[_0x35cc('0x57')];this[_0x35cc('0x58')]=0x0;this[_0x35cc('0x59')]=0x0;this[_0x35cc('0x5a')]=0x0;this[_0x35cc('0x5b')]=0x0;this[_0x35cc('0x5c')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x35cc('0x5d')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x35cc('0x5e')]=0x0;this[_0x35cc('0x5f')]=0x0;this[_0x35cc('0x60')]=0x0;this[_0x35cc('0x61')]=0x0;this[_0x35cc('0x62')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x35cc('0x63')]=0x0;this[_0x35cc('0x64')]=0x0;this[_0x35cc('0x65')]=0x0;this[_0x35cc('0x66')]=0x0;this[_0x35cc('0x67')]=0x0;this[_0x35cc('0x68')]=0x0;this[_0x35cc('0x69')]=0x0;this[_0x35cc('0x6a')]=0x0;this[_0x35cc('0x6b')]=_0x40b600['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x40b600[_0x35cc('0x6c')]||0xa;this[_0x35cc('0x6d')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x35cc('0x6e')]=0x0;this[_0x35cc('0x6f')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x35cc('0x70')]=0x0;this['dialRecallMeTimeout']=_0x40b600['dialRecallMeTimeout']||0x1e;this[_0x35cc('0x71')]=_0x40b600[_0x35cc('0x71')]||![];this[_0x35cc('0x72')]=!!_0x40b600[_0x35cc('0x72')]||![];this[_0x35cc('0x73')]=!!_0x40b600[_0x35cc('0x73')]||![];this['dialQueueProject2']=_0x40b600[_0x35cc('0x74')]||undefined;this[_0x35cc('0x75')]=_0x40b600[_0x35cc('0x75')]||![];this[_0x35cc('0x76')]=_0x40b600['dialAgiAfterHangupAgent']||![];this[_0x35cc('0xd')]=monitorFormat[_0x40b600['monitor_format']]?monitorFormat[_0x40b600[_0x35cc('0xd')]]:undefined;this[_0x35cc('0x77')]=_0x40b600[_0x35cc('0x77')]||![];this[_0x35cc('0x78')]=_0x40b600[_0x35cc('0x78')]?_0x40b600[_0x35cc('0x78')]:undefined;}module[_0x35cc('0x79')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index fd80dec..7b37be3 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 _0x8677=['exports','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x8677,0x1c3));var _0x7867=function(_0x419e80,_0x395855){_0x419e80=_0x419e80-0x0;var _0x35f9d5=_0x8677[_0x419e80];return _0x35f9d5;};'use strict';function VtigerAccount(_0x1d7b54){this['id']=_0x1d7b54['id']||0x0;this['name']=_0x1d7b54['name']||'';this[_0x7867('0x0')]=_0x1d7b54['username']||'';this[_0x7867('0x1')]=_0x1d7b54[_0x7867('0x1')]||'';this[_0x7867('0x2')]=_0x1d7b54[_0x7867('0x2')]||'';this[_0x7867('0x3')]=_0x1d7b54[_0x7867('0x3')]||'';this['Configurations']=_0x1d7b54[_0x7867('0x4')]||{};}module[_0x7867('0x5')]=VtigerAccount; \ No newline at end of file +var _0x2bc3=['username','accessKey','remoteUri','serverUrl','exports','name'];(function(_0x1d8295,_0xeb509d){var _0x259513=function(_0x162912){while(--_0x162912){_0x1d8295['push'](_0x1d8295['shift']());}};_0x259513(++_0xeb509d);}(_0x2bc3,0xd1));var _0x32bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc3[_0x3dd15e];return _0x231fd0;};'use strict';function VtigerAccount(_0x39ab19){this['id']=_0x39ab19['id']||0x0;this[_0x32bc('0x0')]=_0x39ab19[_0x32bc('0x0')]||'';this[_0x32bc('0x1')]=_0x39ab19['username']||'';this[_0x32bc('0x2')]=_0x39ab19[_0x32bc('0x2')]||'';this[_0x32bc('0x3')]=_0x39ab19[_0x32bc('0x3')]||'';this[_0x32bc('0x4')]=_0x39ab19[_0x32bc('0x4')]||'';this['Configurations']=_0x39ab19['Configurations']||{};}module[_0x32bc('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6b50a92..3cd60e7 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 _0x8cf5=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x597b57,_0x5183de){var _0x4336a1=function(_0x3f3244){while(--_0x3f3244){_0x597b57['push'](_0x597b57['shift']());}};_0x4336a1(++_0x5183de);}(_0x8cf5,0x13a));var _0x58cf=function(_0x55eeea,_0x450b2c){_0x55eeea=_0x55eeea-0x0;var _0x26dc71=_0x8cf5[_0x55eeea];return _0x26dc71;};'use strict';function ZendeskAccount(_0x5c3eec){this['id']=_0x5c3eec['id']||0x0;this[_0x58cf('0x0')]=_0x5c3eec[_0x58cf('0x0')]||'';this[_0x58cf('0x1')]=_0x5c3eec[_0x58cf('0x1')]||'';this[_0x58cf('0x2')]=_0x5c3eec[_0x58cf('0x2')]||'';this['token']=_0x5c3eec[_0x58cf('0x3')]||'';this[_0x58cf('0x4')]=_0x5c3eec['remoteUri']||'';this[_0x58cf('0x5')]=_0x5c3eec[_0x58cf('0x5')]||'';this['type']=_0x5c3eec['type']||_0x58cf('0x6');this[_0x58cf('0x7')]=_0x5c3eec['serverUrl']||'';this[_0x58cf('0x8')]=_0x5c3eec[_0x58cf('0x8')]||{};}module[_0x58cf('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2658=['authType','type','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x5da54c,_0x520452){var _0x1246b0=function(_0x11e60b){while(--_0x11e60b){_0x5da54c['push'](_0x5da54c['shift']());}};_0x1246b0(++_0x520452);}(_0x2658,0x109));var _0x8265=function(_0x13d58b,_0x4ed10e){_0x13d58b=_0x13d58b-0x0;var _0x40eca1=_0x2658[_0x13d58b];return _0x40eca1;};'use strict';function ZendeskAccount(_0x5a6f64){this['id']=_0x5a6f64['id']||0x0;this[_0x8265('0x0')]=_0x5a6f64[_0x8265('0x0')]||'';this[_0x8265('0x1')]=_0x5a6f64['username']||'';this[_0x8265('0x2')]=_0x5a6f64[_0x8265('0x2')]||'';this[_0x8265('0x3')]=_0x5a6f64['token']||'';this[_0x8265('0x4')]=_0x5a6f64[_0x8265('0x4')]||'';this[_0x8265('0x5')]=_0x5a6f64['authType']||'';this[_0x8265('0x6')]=_0x5a6f64[_0x8265('0x6')]||'integrationTab';this[_0x8265('0x7')]=_0x5a6f64['serverUrl']||'';this[_0x8265('0x8')]=_0x5a6f64[_0x8265('0x8')]||{};}module[_0x8265('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 e94d667..ea9851b 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 _0x512d=['refreshToken','Configurations','exports','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x26a8f1,_0x266a0b){var _0x2e6552=function(_0x1d82d7){while(--_0x1d82d7){_0x26a8f1['push'](_0x26a8f1['shift']());}};_0x2e6552(++_0x266a0b);}(_0x512d,0xdf));var _0xd512=function(_0x2f3f86,_0x341d72){_0x2f3f86=_0x2f3f86-0x0;var _0x1468fb=_0x512d[_0x2f3f86];return _0x1468fb;};'use strict';function ZohoAccount(_0x50ef2c){this['id']=_0x50ef2c['id']||0x0;this['name']=_0x50ef2c['name']||'';this[_0xd512('0x0')]=_0x50ef2c[_0xd512('0x0')]||'';this[_0xd512('0x1')]=_0x50ef2c[_0xd512('0x1')]||'';this[_0xd512('0x2')]=_0x50ef2c['zone']||'';this[_0xd512('0x3')]=_0x50ef2c[_0xd512('0x3')]||'';this[_0xd512('0x4')]=_0x50ef2c[_0xd512('0x4')]||'';this[_0xd512('0x5')]=_0x50ef2c[_0xd512('0x5')]||'';this[_0xd512('0x6')]=_0x50ef2c[_0xd512('0x6')]||'';this[_0xd512('0x7')]=_0x50ef2c[_0xd512('0x7')]||'';this[_0xd512('0x8')]=_0x50ef2c[_0xd512('0x8')]||{};}module[_0xd512('0x9')]=ZohoAccount; \ No newline at end of file +var _0xdec4=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x1156cf,_0xc26149){var _0x4648a8=function(_0x12e645){while(--_0x12e645){_0x1156cf['push'](_0x1156cf['shift']());}};_0x4648a8(++_0xc26149);}(_0xdec4,0x137));var _0x4dec=function(_0x8b62a9,_0x17b817){_0x8b62a9=_0x8b62a9-0x0;var _0x1a9082=_0xdec4[_0x8b62a9];return _0x1a9082;};'use strict';function ZohoAccount(_0xeaeada){this['id']=_0xeaeada['id']||0x0;this['name']=_0xeaeada[_0x4dec('0x0')]||'';this[_0x4dec('0x1')]=_0xeaeada[_0x4dec('0x1')]||'';this[_0x4dec('0x2')]=_0xeaeada[_0x4dec('0x2')]||'';this[_0x4dec('0x3')]=_0xeaeada[_0x4dec('0x3')]||'';this[_0x4dec('0x4')]=_0xeaeada[_0x4dec('0x4')]||'';this[_0x4dec('0x5')]=_0xeaeada['clientSecret']||'';this[_0x4dec('0x6')]=_0xeaeada[_0x4dec('0x6')]||'';this['code']=_0xeaeada[_0x4dec('0x7')]||'';this['refreshToken']=_0xeaeada[_0x4dec('0x8')]||'';this[_0x4dec('0x9')]=_0xeaeada[_0x4dec('0x9')]||{};}module[_0x4dec('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index be7c314..79e6fcc 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 _0x8aad=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','isNil','uniqueid','idContact','queue','name','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0xcff735,_0x39f060){var _0xcea608=function(_0x4ef4f5){while(--_0x4ef4f5){_0xcff735['push'](_0xcff735['shift']());}};_0xcea608(++_0x39f060);}(_0x8aad,0x146));var _0xd8aa=function(_0x2624a5,_0x522f54){_0x2624a5=_0x2624a5-0x0;var _0x2e3dba=_0x8aad[_0x2624a5];return _0x2e3dba;};'use strict';var util=require(_0xd8aa('0x0'));var _=require(_0xd8aa('0x1'));var moment=require('moment');function checkNameSurname(_0x11554c,_0x5bcfd1,_0x276f03){var _0xb610c0='';if(!_['isNil'](_0x5bcfd1)&&'string'===typeof _0x5bcfd1){_0xb610c0+=_0x5bcfd1;}if(!_[_0xd8aa('0x2')](_0x276f03)&&'string'===typeof _0x276f03){_0xb610c0+='\x20'+_0x276f03;}if(_0xb610c0!==''){return _0xb610c0;}return _0x11554c;}function Action(_0x53248c,_0x16b648,_0x43ddeb,_0x16ea12,_0x4a4b10){this[_0xd8aa('0x3')]=_0x43ddeb||undefined;this[_0xd8aa('0x4')]=_0x53248c['id'];this[_0xd8aa('0x5')]=_0x16b648[_0xd8aa('0x6')];this['type']=_0x16b648['type'];this[_0xd8aa('0x7')]=_0xd8aa('0x5');this[_0xd8aa('0x8')]=![];this[_0xd8aa('0x9')]=_[_0xd8aa('0x2')](_0x53248c['Agent'])?undefined:_0x53248c[_0xd8aa('0xa')][_0xd8aa('0x6')];this[_0xd8aa('0xb')]=this[_0xd8aa('0x9')]?util[_0xd8aa('0xc')](_0xd8aa('0xd'),this[_0xd8aa('0x9')]):_0x16ea12||undefined;this[_0xd8aa('0xe')]=checkNameSurname(_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x10')],_0x53248c['Contact']['firstName'],_0x53248c[_0xd8aa('0xf')][_0xd8aa('0x11')]);this[_0xd8aa('0x12')]=_0x53248c['active']||![];this[_0xd8aa('0x13')]=_0x53248c[_0xd8aa('0x10')];this[_0xd8aa('0x14')]=_0x53248c[_0xd8aa('0x14')];this['countbusyretry']=_0x53248c[_0xd8aa('0x15')]||0x0;this[_0xd8aa('0x16')]=_0x53248c['countcongestionretry']||0x0;this[_0xd8aa('0x17')]=_0x53248c[_0xd8aa('0x17')]||0x0;this[_0xd8aa('0x18')]=(_0x53248c[_0xd8aa('0x15')]||0x0)+(_0x53248c[_0xd8aa('0x16')]||0x0)+(_0x53248c['countnoanswerretry']||0x0)+(_0x53248c[_0xd8aa('0x19')]||0x0)+(_0x53248c[_0xd8aa('0x1a')]||0x0)+(_0x53248c[_0xd8aa('0x1b')]||0x0)+(_0x53248c[_0xd8aa('0x1c')]||0x0)+(_0x53248c['countagentrejectretry']||0x0);this[_0xd8aa('0x19')]=_0x53248c[_0xd8aa('0x19')]||0x0;this[_0xd8aa('0x1a')]=_0x53248c[_0xd8aa('0x1a')]||0x0;this[_0xd8aa('0x1b')]=_0x53248c['countabandonedretry']||0x0;this[_0xd8aa('0x1c')]=_0x53248c[_0xd8aa('0x1c')]||0x0;this[_0xd8aa('0x1d')]=_0x53248c['countagentrejectretry']||0x0;this[_0xd8aa('0x1e')]=_0x53248c[_0xd8aa('0x1e')];this[_0xd8aa('0x1f')]=_0x53248c[_0xd8aa('0x1f')];this[_0xd8aa('0x20')]=_0x53248c[_0xd8aa('0x20')];this[_0xd8aa('0x21')]=_0x53248c[_0xd8aa('0x21')];this[_0xd8aa('0x22')]=_0x53248c[_0xd8aa('0x22')];this[_0xd8aa('0x23')]=_0x53248c[_0xd8aa('0x23')];this[_0xd8aa('0x24')]=_['isNil'](_0x53248c[_0xd8aa('0xa')])?_0x53248c[_0xd8aa('0x24')]:_0x53248c[_0xd8aa('0xa')]['id'];this[_0xd8aa('0x25')]=_0x53248c[_0xd8aa('0x25')];this[_0xd8aa('0x26')]='';this[_0xd8aa('0x27')]='';}Action[_0xd8aa('0x28')][_0xd8aa('0x29')]=function(){return util[_0xd8aa('0xc')]('\x22%s\x22\x20<%s>',this[_0xd8aa('0xe')],this[_0xd8aa('0x2a')]);};module[_0xd8aa('0x2b')]=Action; \ No newline at end of file +var _0x0abf=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback'];(function(_0xdc3575,_0x592e0a){var _0x4e1b84=function(_0x1754b0){while(--_0x1754b0){_0xdc3575['push'](_0xdc3575['shift']());}};_0x4e1b84(++_0x592e0a);}(_0x0abf,0xe8));var _0xf0ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0abf[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0xf0ab('0x0'));var _=require('lodash');var moment=require(_0xf0ab('0x1'));function checkNameSurname(_0x27c8c9,_0x528ef7,_0x598001){var _0x313b14='';if(!_['isNil'](_0x528ef7)&&_0xf0ab('0x2')===typeof _0x528ef7){_0x313b14+=_0x528ef7;}if(!_[_0xf0ab('0x3')](_0x598001)&&_0xf0ab('0x2')===typeof _0x598001){_0x313b14+='\x20'+_0x598001;}if(_0x313b14!==''){return _0x313b14;}return _0x27c8c9;}function Action(_0xbb1f91,_0x2ab7d6,_0x4d2ea8,_0x233afe,_0x57ff3b){this[_0xf0ab('0x4')]=_0x4d2ea8||undefined;this[_0xf0ab('0x5')]=_0xbb1f91['id'];this[_0xf0ab('0x6')]=_0x2ab7d6[_0xf0ab('0x7')];this['type']=_0x2ab7d6[_0xf0ab('0x8')];this[_0xf0ab('0x9')]=_0xf0ab('0x6');this['dialAnswer']=![];this['membername']=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?undefined:_0xbb1f91[_0xf0ab('0xa')][_0xf0ab('0x7')];this[_0xf0ab('0xb')]=this[_0xf0ab('0xc')]?util[_0xf0ab('0xd')](_0xf0ab('0xe'),this[_0xf0ab('0xc')]):_0x233afe||undefined;this['calleridname']=checkNameSurname(_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x10')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x11')],_0xbb1f91[_0xf0ab('0xf')][_0xf0ab('0x12')]);this[_0xf0ab('0x13')]=_0xbb1f91[_0xf0ab('0x13')]||![];this[_0xf0ab('0x14')]=_0xbb1f91[_0xf0ab('0x10')];this[_0xf0ab('0x15')]=_0xbb1f91[_0xf0ab('0x15')];this[_0xf0ab('0x16')]=_0xbb1f91[_0xf0ab('0x16')]||0x0;this[_0xf0ab('0x17')]=_0xbb1f91['countcongestionretry']||0x0;this[_0xf0ab('0x18')]=_0xbb1f91[_0xf0ab('0x18')]||0x0;this[_0xf0ab('0x19')]=(_0xbb1f91[_0xf0ab('0x16')]||0x0)+(_0xbb1f91[_0xf0ab('0x17')]||0x0)+(_0xbb1f91[_0xf0ab('0x18')]||0x0)+(_0xbb1f91[_0xf0ab('0x1a')]||0x0)+(_0xbb1f91[_0xf0ab('0x1b')]||0x0)+(_0xbb1f91[_0xf0ab('0x1c')]||0x0)+(_0xbb1f91[_0xf0ab('0x1d')]||0x0)+(_0xbb1f91[_0xf0ab('0x1e')]||0x0);this[_0xf0ab('0x1a')]=_0xbb1f91[_0xf0ab('0x1a')]||0x0;this[_0xf0ab('0x1b')]=_0xbb1f91[_0xf0ab('0x1b')]||0x0;this[_0xf0ab('0x1c')]=_0xbb1f91['countabandonedretry']||0x0;this[_0xf0ab('0x1d')]=_0xbb1f91[_0xf0ab('0x1d')]||0x0;this[_0xf0ab('0x1e')]=_0xbb1f91[_0xf0ab('0x1e')]||0x0;this[_0xf0ab('0x1f')]=_0xbb1f91[_0xf0ab('0x1f')];this[_0xf0ab('0x20')]=_0xbb1f91[_0xf0ab('0x20')];this[_0xf0ab('0x21')]=_0xbb1f91[_0xf0ab('0x21')];this[_0xf0ab('0x22')]=_0xbb1f91['recallme'];this['ContactId']=_0xbb1f91['ContactId'];this[_0xf0ab('0x23')]=_0xbb1f91['ListId'];this[_0xf0ab('0x24')]=_[_0xf0ab('0x3')](_0xbb1f91['Agent'])?_0xbb1f91[_0xf0ab('0x24')]:_0xbb1f91[_0xf0ab('0xa')]['id'];this[_0xf0ab('0x25')]=_0xbb1f91[_0xf0ab('0x25')];this[_0xf0ab('0x26')]='';this['originatecalleridname']='';}Action[_0xf0ab('0x27')]['getCaller']=function(){return util['format'](_0xf0ab('0x28'),this[_0xf0ab('0x29')],this[_0xf0ab('0x2a')]);};module[_0xf0ab('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 58cf12e..e94da23 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 _0x9f4c=['outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','clockClearZombieChannels','hasOwnProperty','outbound','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','sequence','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','activeContact','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','decrementTalkink','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','linkedid','countbusyretry','countglobal','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','additional','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','unlockAgent','congestion','countcongestionretry','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','checkInBlack','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','isEmpty','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','TrunkBackup','getCallerId','dialRandomLastDigitCallerIdNumber','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','[originated][increment]','OriginateError','logLookAgent','clone','isFailure','custom:agentringnoanswer','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','disableContact','[syncHangup][talking][cause]','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','transfer','exports','util','uuid','md5','ioredis','preview','../../../config/logger','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x7713c1,_0xd3f22b){var _0x5d25e6=function(_0xd5f315){while(--_0xd5f315){_0x7713c1['push'](_0x7713c1['shift']());}};_0x5d25e6(++_0xd3f22b);}(_0x9f4c,0x10b));var _0xc9f4=function(_0x52ad49,_0xc54a06){_0x52ad49=_0x52ad49-0x0;var _0x4b1bf3=_0x9f4c[_0x52ad49];return _0x4b1bf3;};'use strict';var util=require(_0xc9f4('0x0'));var _=require('lodash');var uuid=require(_0xc9f4('0x1'));var moment=require('moment');var md5=require(_0xc9f4('0x2'));var Redis=require(_0xc9f4('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xc9f4('0x4'));var loggerAction=require(_0xc9f4('0x5'))(_0xc9f4('0x6'));var ami=require('../ami');var rpcDb=require(_0xc9f4('0x7'));var cmHopperAdditionalPhone=require(_0xc9f4('0x8'));var Action=require(_0xc9f4('0x9'));var ut=require(_0xc9f4('0xa'));config[_0xc9f4('0xb')]=_['defaults'](config[_0xc9f4('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9f4('0xb')]));var Sequence=function(){};Sequence[_0xc9f4('0xc')][_0xc9f4('0xd')]=function(_0x213116){this[_0xc9f4('0xe')]=this['tail']?this[_0xc9f4('0xe')][_0xc9f4('0xf')](_0x213116):_0x213116();};function Preview(_0x323836){this['sequence']=new Sequence();this[_0xc9f4('0x10')]=_0x323836[_0xc9f4('0x11')];this['trunks']=_0x323836[_0xc9f4('0x12')];this[_0xc9f4('0x13')]={};this[_0xc9f4('0x14')]=_0x323836['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xc9f4('0x15'),this[_0xc9f4('0x16')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x18'),this[_0xc9f4('0x19')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1a'),this[_0xc9f4('0x1b')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1c'),this[_0xc9f4('0x1d')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x1e'),this[_0xc9f4('0x1f')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x20'),this[_0xc9f4('0x21')][_0xc9f4('0x17')](this));ami['on'](_0xc9f4('0x22'),this[_0xc9f4('0x23')]['bind'](this));ami['on']('blindtransfer',this[_0xc9f4('0x24')]['bind'](this));this[_0xc9f4('0x25')](this[_0xc9f4('0x10')]);}function emit(_0x21645a,_0x580bcd,_0x281128){io['to'](_0x21645a)[_0xc9f4('0x26')](_0x580bcd,_0x281128);}function emitCampaignPreview(_0x3f43d5){if(_0x3f43d5[_0xc9f4('0x27')]==='outbound'){var _0x2f8ee9={'id':_0x3f43d5['id'],'name':_0x3f43d5[_0xc9f4('0x28')],'strategy':_0x3f43d5['strategy'],'answered':_0x3f43d5[_0xc9f4('0x29')],'available':_0x3f43d5[_0xc9f4('0x2a')],'loggedIn':_0x3f43d5[_0xc9f4('0x2b')],'pTalking':_0x3f43d5[_0xc9f4('0x2c')],'sumBillable':_0x3f43d5[_0xc9f4('0x2d')],'sumDuration':_0x3f43d5['sumDuration'],'sumHoldTime':_0x3f43d5[_0xc9f4('0x2e')]||0x0,'talking':_0x3f43d5[_0xc9f4('0x2f')],'total':_0x3f43d5[_0xc9f4('0x30')],'type':_0x3f43d5[_0xc9f4('0x27')],'unmanaged':_0x3f43d5[_0xc9f4('0x31')],'abandoned':_0x3f43d5[_0xc9f4('0x32')],'waiting':_0x3f43d5[_0xc9f4('0x33')],'loggedInDb':_0x3f43d5[_0xc9f4('0x34')],'dialActive':_0x3f43d5[_0xc9f4('0x35')],'dialMethod':_0x3f43d5[_0xc9f4('0x36')],'dialOriginateCallerIdName':_0x3f43d5[_0xc9f4('0x37')],'dialOriginateCallerIdNumber':_0x3f43d5[_0xc9f4('0x38')],'dialOriginateTimeout':_0x3f43d5[_0xc9f4('0x39')],'dialPrefix':_0x3f43d5[_0xc9f4('0x3a')],'outboundAnswerAgiCallsDay':_0x3f43d5[_0xc9f4('0x3b')],'outboundAnswerCallsDay':_0x3f43d5[_0xc9f4('0x3c')],'outboundBlacklistCallsDay':_0x3f43d5[_0xc9f4('0x3d')],'outboundBusyCallsDay':_0x3f43d5[_0xc9f4('0x3e')],'outboundCongestionCallsDay':_0x3f43d5[_0xc9f4('0x3f')],'outboundDropCallsDayACS':_0x3f43d5[_0xc9f4('0x40')],'outboundDropCallsDayCallersExit':_0x3f43d5[_0xc9f4('0x41')],'outboundDropCallsDayTimeout':_0x3f43d5['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3f43d5['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3f43d5[_0xc9f4('0x42')],'outboundOriginateFailureCallsDay':_0x3f43d5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3f43d5[_0xc9f4('0x43')],'outboundRejectCallsDay':_0x3f43d5[_0xc9f4('0x44')],'outboundUnknownCallsDay':_0x3f43d5[_0xc9f4('0x45')],'outboundAbandonedCallsDay':_0x3f43d5[_0xc9f4('0x46')],'predictiveIntervalAnsweredCalls':_0x3f43d5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3f43d5['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3f43d5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x3f43d5[_0xc9f4('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x3f43d5['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3f43d5[_0xc9f4('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f43d5['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f43d5[_0xc9f4('0x49')],'predictiveIntervalMultiplicativeFactor':_0x3f43d5[_0xc9f4('0x4a')],'predictiveIntervalPauses':_0x3f43d5[_0xc9f4('0x4b')],'predictiveIntervalAvailable':_0x3f43d5['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3f43d5[_0xc9f4('0x4c')],'message':_0x3f43d5[_0xc9f4('0x4d')],'originated':_0x3f43d5[_0xc9f4('0x4e')],'erlangCalls':_0x3f43d5[_0xc9f4('0x4f')],'erlangCallToSecond':_0x3f43d5['erlangCallToSecond'],'erlangAbandonmentRate':_0x3f43d5[_0xc9f4('0x50')],'erlangBusyFactor':_0x3f43d5['erlangBusyFactor'],'startPredictive':_0x3f43d5[_0xc9f4('0x51')],'startProgressive':_0x3f43d5[_0xc9f4('0x52')]};if(_0x3f43d5[_0xc9f4('0x53')]){_0x2f8ee9[_0xc9f4('0x53')]={'id':_0x3f43d5[_0xc9f4('0x53')]['id'],'name':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x28')],'active':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x54')],'callerid':_0x3f43d5[_0xc9f4('0x53')][_0xc9f4('0x55')]};}if(_0x3f43d5['Interval']){_0x2f8ee9[_0xc9f4('0x56')]={'id':_0x3f43d5[_0xc9f4('0x56')]['id'],'name':_0x3f43d5[_0xc9f4('0x56')][_0xc9f4('0x28')]};}var _0x4ae484=md5(JSON['stringify'](_0x2f8ee9));if(_0x3f43d5[_0xc9f4('0x2')]!==_0x4ae484){_0x3f43d5[_0xc9f4('0x2')]=_0x4ae484;emit(util[_0xc9f4('0x57')](_0xc9f4('0x58'),_0x2f8ee9[_0xc9f4('0x28')]),_0xc9f4('0x59'),_0x2f8ee9);}}}function emitVoiceQueueChannelRemove(_0x3257a0){logger['info'](_0xc9f4('0x5a'),JSON[_0xc9f4('0x5b')](_0x3257a0));emit(util[_0xc9f4('0x57')]('voice:queue:%s',_0x3257a0['name']),'voice_queue_channel:remove',_0x3257a0);io[_0xc9f4('0x26')](_0xc9f4('0x5c'),_0x3257a0);}function notSendMessagesQueue(_0x8d7d7a){if(_0x8d7d7a[_0xc9f4('0x5d')]){if(_0x8d7d7a[_0xc9f4('0x4e')]===0x0&&_0x8d7d7a[_0xc9f4('0x2c')]===0x0){_0x8d7d7a['sendMessageOneNotActive']=![];_0x8d7d7a[_0xc9f4('0x2a')]=0x0;_0x8d7d7a[_0xc9f4('0x5e')]=0x0;_0x8d7d7a[_0xc9f4('0x4d')]=_0xc9f4('0x5f');ut[_0xc9f4('0x60')](_0xc9f4('0x61'),_0x8d7d7a[_0xc9f4('0x28')]+_0xc9f4('0x62'));}else{_0x8d7d7a[_0xc9f4('0x4d')]=_0xc9f4('0x63');ut[_0xc9f4('0x60')](_0xc9f4('0x61'),_0x8d7d7a[_0xc9f4('0x28')]+_0xc9f4('0x64'));}emitCampaignPreview(_0x8d7d7a);}}Preview[_0xc9f4('0xc')]['loopCampaigns']=function(){var _0x37711f=this;setInterval(function(){_0x37711f[_0xc9f4('0x65')]();},0x7cf);};Preview[_0xc9f4('0xc')][_0xc9f4('0x65')]=function(){var _0x1b5f30=this[_0xc9f4('0x10')];this[_0xc9f4('0x66')]+=0x1;for(var _0x3f3d9b in _0x1b5f30){if(_0x1b5f30[_0xc9f4('0x67')](_0x3f3d9b)&&(_0x1b5f30[_0x3f3d9b]['dialMethod']===_0xc9f4('0x4')||_0x1b5f30[_0x3f3d9b][_0xc9f4('0x36')]==='booked')&&_0x1b5f30[_0x3f3d9b]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xc9f4('0x66')]=0x0;this['clearZombieChannels']();}}if(_0x1b5f30['hasOwnProperty'](_0x3f3d9b)&&_0x1b5f30[_0x3f3d9b]['dialMethod']===_0xc9f4('0x4')&&_0x1b5f30[_0x3f3d9b][_0xc9f4('0x27')]===_0xc9f4('0x68')){if(_0x1b5f30[_0x3f3d9b][_0xc9f4('0x35')]){this[_0xc9f4('0x69')](_0x1b5f30[_0x3f3d9b]);if(_0x1b5f30[_0x3f3d9b][_0xc9f4('0x6a')])this['recallMe'](_0x1b5f30[_0x3f3d9b]);}else{notSendMessagesQueue(_0x1b5f30[_0x3f3d9b]);}}}};Preview['prototype'][_0xc9f4('0x6b')]=function(_0x3fb6bd){var _0x1474c5=this;this[_0xc9f4('0x6c')][_0xc9f4('0xd')](function(){if(!_[_0xc9f4('0x6d')](_0x1474c5['actions'][_0x3fb6bd])){loggerAction[_0xc9f4('0x6e')](_0xc9f4('0x6f'),_0x3fb6bd,_0xc9f4('0x70'),_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')],_0xc9f4('0x72'),JSON[_0xc9f4('0x5b')](_0x1474c5['campaignsPreview'][_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['queue']][_0xc9f4('0x4e')]),_0xc9f4('0x73'),JSON[_0xc9f4('0x5b')](_0x1474c5[_0xc9f4('0x10')][_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')]]['pTalking']),JSON[_0xc9f4('0x5b')](_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x74')]),JSON[_0xc9f4('0x5b')](_['pick'](_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd],['contactId',_0xc9f4('0x75'),_0xc9f4('0x76'),_0xc9f4('0x77')])));return ami[_0xc9f4('0x78')]({'action':_0xc9f4('0x79'),'channel':_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x7a')]})[_0xc9f4('0x7b')](function(_0x4fb2e0){if(_0x4fb2e0[_0xc9f4('0x4d')]===_0xc9f4('0x7c')){setTimeout(function(){if(_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]){ut['updateOriginated'](_0x1474c5['campaignsPreview'][_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x71')]],_0xc9f4('0x7d'));if(_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['dialAnswer']===!![]){ut['decrementTalkink'](_0x1474c5[_0xc9f4('0x10')][_0x1474c5['actions'][_0x3fb6bd][_0xc9f4('0x71')]],_0xc9f4('0x7d'));ut[_0xc9f4('0x7e')](_0xc9f4('0x7f')+_0x3fb6bd,_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd][_0xc9f4('0x71')]);}ut[_0xc9f4('0x7e')]('[Dialer][checkChannel][Preview]'+_0x3fb6bd,_0x1474c5[_0xc9f4('0x13')][_0x3fb6bd]['queue']);delete _0x1474c5[_0xc9f4('0x13')][_0x3fb6bd];}},0x2328);}});}});};Preview[_0xc9f4('0xc')][_0xc9f4('0x80')]=function(){var _0x5d95fa=this;loggerAction[_0xc9f4('0x6e')]('[action]',_['size'](this['actions']));for(var _0x341a83 in this[_0xc9f4('0x13')]){if(_0x5d95fa[_0xc9f4('0x13')][_0xc9f4('0x67')](_0x341a83)){_0x5d95fa[_0xc9f4('0x6b')](_0x341a83);}}};Preview[_0xc9f4('0xc')]['recallMe']=function(_0x2fbb1f){var _0x3c72a6=this;rpcDb[_0xc9f4('0x81')](_0x2fbb1f['id'],ut[_0xc9f4('0x82')](this[_0xc9f4('0x14')]))['then'](function(_0x1642ca){if(!_[_0xc9f4('0x6d')](_0x1642ca)){for(var _0x3ce567=0x0;_0x3ce567<_0x1642ca[_0xc9f4('0x83')];_0x3ce567+=0x1){if(ut[_0xc9f4('0x84')](_0x1642ca[_0x3ce567][_0xc9f4('0x85')])<_0x2fbb1f['dialRecallMeTimeout']*0x3c){if(_0x1642ca[_0x3ce567][_0xc9f4('0x86')]&&!_0x1642ca[_0x3ce567][_0xc9f4('0x86')][_0xc9f4('0x87')]){_0x3c72a6[_0xc9f4('0x88')](_0x1642ca[_0x3ce567]['id'])[_0xc9f4('0x89')](ut[_0xc9f4('0x8a')](_0xc9f4('0x8b')))[_0xc9f4('0x7b')](ut['logger2'](_0xc9f4('0x8b')));}else{rpcDb['disableContact'](_0x1642ca[_0x3ce567]['id']);}}else{var _0x1ee7e8=new Action(_0x1642ca[_0x3ce567],_0x2fbb1f);_0x1ee7e8[_0xc9f4('0x8c')]=moment()[_0xc9f4('0x57')](_0xc9f4('0x8d'));_0x2fbb1f[_0xc9f4('0x43')]+=0x1;ut[_0xc9f4('0x8e')](_0x1ee7e8,0x17,_0xc9f4('0x8f'));if(_0x2fbb1f[_0xc9f4('0x90')]){rpcDb[_0xc9f4('0x91')](ut[_0xc9f4('0x92')](_0x1642ca[_0x3ce567]));rpcDb[_0xc9f4('0x93')](_0x1ee7e8,_0xc9f4('0x94'));}else{ut['logCustomer'](_0x1ee7e8,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1ee7e8,'[HistoryRecallClose]');rpcDb[_0xc9f4('0x95')](_0x1ee7e8,_0xc9f4('0x96'));}}}}})[_0xc9f4('0x7b')](ut[_0xc9f4('0x8a')](_0xc9f4('0x97')));};Preview['prototype']['setMessage']=function(_0x42859b){_0x42859b[_0xc9f4('0x5d')]=!![];if(ut[_0xc9f4('0x98')](_0x42859b[_0xc9f4('0x2b')])){_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x99');}else if(!ut['isActive'](_0x42859b[_0xc9f4('0x35')])){_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x5f');}else if(!this[_0xc9f4('0x9a')](_0x42859b[_0xc9f4('0x53')])){if(!this[_0xc9f4('0x9a')](_0x42859b['TrunkBackup'])){_0x42859b['message']=_0xc9f4('0x9b');}else{_0x42859b[_0xc9f4('0x4d')]=_0xc9f4('0x9c');}}else{_0x42859b[_0xc9f4('0x4d')]='ACTIVE';}emitCampaignPreview(_0x42859b);};Preview[_0xc9f4('0xc')]['callProgressDetectingCustomer']=function(_0x2f43b1,_0x14c416,_0x2b816c){var _0x80fb98=this;var _0x2582d5=this['actions'][_0x14c416];var _0x24b44a=this['campaignsPreview'][_0x2582d5['queue']];var _0x7ff11a;var _0x27dc5f=![];var _0x1ccb78=0x2;var _0x308502=0x3;if(_0x24b44a){switch(_0x2b816c){case'1':_0x24b44a[_0xc9f4('0x42')]+=0x1;_0x2582d5['countnosuchnumberretry']+=0x1;_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x0,_0xc9f4('0x9e'));ami['emit']('custom:agentnosuchnumber',ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xa0')));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xa1'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'0',_0x24b44a)['then'](function(_0x2fb822){_0x27dc5f=_0x2fb822['additional']==0x1;_0x1ccb78=_0x24b44a[_0xc9f4('0xa3')];_0x308502=_0x24b44a['callAdditionalPhoneAfterMin'];if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2582d5[_0xc9f4('0xa6')]>=_0x24b44a[_0xc9f4('0xa7')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xa6'),_0x24b44a['dialNoSuchNumberRetryFrequency']),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}delete this[_0xc9f4('0x13')][_0x2f43b1['linkedid']];}else{_0x2582d5[_0xc9f4('0xa6')]++;logger[_0xc9f4('0x6e')]('actioncountonusuch',_0x2582d5[_0xc9f4('0xa6')]);logger[_0xc9f4('0x6e')]('id',_0x2582d5[_0xc9f4('0xab')]);_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnosuchnumberretry':_0x2582d5['countnosuchnumberretry']}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case _0xc9f4('0xae'):var _0x500a45=moment()[_0xc9f4('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2582d5[_0xc9f4('0xaf')]=_0x500a45;_0x2582d5[_0xc9f4('0xb0')]=_0x500a45;_0x2582d5[_0xc9f4('0x74')]=!![];_0x24b44a[_0xc9f4('0x2c')]+=0x1;logger[_0xc9f4('0x6e')](_0xc9f4('0xb1'),_0x2582d5['uniqueid'],_0xc9f4('0xb2'),_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x24b44a['pTalking']);ami['emit'](_0xc9f4('0xb3'),ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xb4'),this[_0xc9f4('0x10')][_0x2582d5[_0xc9f4('0x71')]]));if(_0x24b44a[_0xc9f4('0xb5')]){ami[_0xc9f4('0x26')]('custom:agentConnectPreview',ut['buildAcw'](_0x2582d5));}break;case'16':ami[_0xc9f4('0x26')](_0xc9f4('0xb6'),ut[_0xc9f4('0x9f')](_0x2582d5,'complete',this[_0xc9f4('0x10')][_0x2582d5['queue']]));emitVoiceQueueChannelRemove(ut[_0xc9f4('0x9f')](_0x2582d5,'complete'));_0x24b44a[_0xc9f4('0x3c')]+=0x1;_0x24b44a[_0xc9f4('0x30')]+=0x1;_0x24b44a['answered']+=0x1;ut[_0xc9f4('0xb7')](_0x24b44a,'[16]');_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x4,_0xc9f4('0xb8'));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xb9'));rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xba'));rpcDb[_0xc9f4('0xbb')](_0x2582d5);_0x24b44a['sumDuration']+=_0x2582d5['talktime'];_0x24b44a[_0xc9f4('0x2d')]+=_0x2582d5[_0xc9f4('0xbc')];logger[_0xc9f4('0x6e')](_0xc9f4('0xbd'),_0x2582d5[_0xc9f4('0xbe')],'\x20Queue',_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x24b44a[_0xc9f4('0x2c')]);delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];break;case'BUSY':_0x24b44a[_0xc9f4('0x3e')]+=0x1;_0x2582d5[_0xc9f4('0xc0')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut['totalGlobal'](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x5,_0xc9f4('0xc2'));_0x1ccb78=_0x24b44a[_0xc9f4('0xc3')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami[_0xc9f4('0x26')](_0xc9f4('0xc5'),ut['buildObj'](_0x2582d5,'busy'));rpcDb['createCustomerHistory'](_0x2582d5,_0xc9f4('0xc6'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'5',_0x24b44a)[_0xc9f4('0x89')](function(_0xa09bd7){_0x27dc5f=_0xa09bd7['additional']==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xc7'));}else{if(_0x2582d5[_0xc9f4('0xc0')]>=_0x24b44a[_0xc9f4('0xc8')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xc6'));}else{rpcDb[_0xc9f4('0xc9')](ut['scheduledAt'](_0x2582d5,_0xc9f4('0xc0'),_0x24b44a[_0xc9f4('0xc3')]),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xc0')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5['idContact'],'field':{'countbusyretry':_0x2582d5[_0xc9f4('0xc0')]}})['then'](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)['then'](function(){});});}});break;case _0xc9f4('0xca'):_0x24b44a[_0xc9f4('0xcb')]+=0x1;_0x2582d5[_0xc9f4('0xcc')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x3,_0xc9f4('0xcd'));_0x1ccb78=_0x24b44a[_0xc9f4('0xce')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];var _0x56f8ec=ut['buildNoAnswerEventPayload'](_0x2582d5,_0x24b44a);ami['emit'](_0xc9f4('0xcf'),_0x56f8ec);rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][logNoAnswer]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'3',_0x24b44a)[_0xc9f4('0x89')](function(_0x1f046c){_0x27dc5f=_0x1f046c[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xd2'));}else{if(_0x2582d5[_0xc9f4('0xcc')]>=_0x24b44a[_0xc9f4('0xd3')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xcc'),_0x24b44a[_0xc9f4('0xce')]),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5['activeContact']);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5['countnoanswerretry']}})[_0xc9f4('0x89')](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'CONGESTION':_0x24b44a[_0xc9f4('0x3f')]+=0x1;_0x2582d5['countcongestionretry']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x8,'Congestion');_0x1ccb78=_0x24b44a['dialCongestionRetryFrequency'];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami['emit']('custom:agentcongestion',ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xd6')));rpcDb['createCustomerHistory'](_0x2582d5,'[callProgressDetectingCustomer][logCongestion]');_0x80fb98['verifyAdditionalPhones'](_0x2582d5,'8',_0x24b44a)[_0xc9f4('0x89')](function(_0x2b981c){_0x27dc5f=_0x2b981c[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2582d5[_0xc9f4('0xd7')]>=_0x24b44a[_0xc9f4('0xd8')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xd9'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xd7'),_0x24b44a['dialBusyRetryFrequency']),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xd7')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countcongestionretry':_0x2582d5[_0xc9f4('0xd7')]}})[_0xc9f4('0x89')](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)['then'](function(){});});}});break;case _0xc9f4('0xda'):_0x24b44a[_0xc9f4('0x44')]+=0x1;_0x2582d5[_0xc9f4('0xdb')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x14,_0xc9f4('0xdc'));_0x1ccb78=_0x24b44a[_0xc9f4('0xdd')];_0x308502=_0x24b44a[_0xc9f4('0xc4')];ami[_0xc9f4('0x26')](_0xc9f4('0xde'),ut['buildObj'](_0x2582d5,_0xc9f4('0xdf')));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xe0'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'20',_0x24b44a)[_0xc9f4('0x89')](function(_0x9f64e1){_0x27dc5f=_0x9f64e1[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0x14,_0xc9f4('0xdc'));rpcDb['createCustomerFinal'](_0x7ff11a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2582d5['countagentrejectretry']>=_0x24b44a['dialAgentRejectMaxRetry']){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xe1'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xdb'),_0x24b44a['dialAgentRejectRetryFrequency']),_0x2582d5['unlockAgent'],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'ABANDONED':_0x24b44a[_0xc9f4('0x46')]+=0x1;_0x2582d5[_0xc9f4('0xe2')]+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0xb,_0xc9f4('0xe3'));rpcDb[_0xc9f4('0x93')](_0x2582d5,_0xc9f4('0xe4'));_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'11',_0x24b44a)[_0xc9f4('0x89')](function(_0x1b7ae4){_0x27dc5f=_0x1b7ae4[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,'Global');rpcDb[_0xc9f4('0x95')](_0x7ff11a,_0xc9f4('0xe4'));}else{if(_0x2582d5[_0xc9f4('0xe5')]>=_0x24b44a[_0xc9f4('0xe6')]){rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xe4'));}else{rpcDb[_0xc9f4('0xc9')](ut[_0xc9f4('0xa9')](_0x2582d5,_0xc9f4('0xe2'),_0x24b44a[_0xc9f4('0xe7')]),_0x2582d5[_0xc9f4('0xd5')],_0x2582d5[_0xc9f4('0xaa')]);}}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})['then'](function(){_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});break;case'18':_0x24b44a['outboundUnknownCallsDay']+=0x1;_0x2582d5['countmachineretry']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x12,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1[_0xc9f4('0xe9')]);ami['emit']('custom:amd',ut[_0xc9f4('0x9f')](_0x2582d5,'amd'));rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][hangupInAMD]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'18',_0x24b44a)['then'](function(_0x5e368f){_0x27dc5f=_0x5e368f['additional']==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0x12,'Global');rpcDb['createCustomerFinal'](_0x7ff11a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98[_0xc9f4('0xac')]({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});delete this[_0xc9f4('0x13')][_0x2f43b1['linkedid']];break;case'19':_0x24b44a[_0xc9f4('0x45')]+=0x1;_0x2582d5['countglobal']=ut[_0xc9f4('0x9d')](_0x2582d5);ut[_0xc9f4('0x8e')](_0x2582d5,0x13,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1[_0xc9f4('0xe9')]);ami[_0xc9f4('0x26')](_0xc9f4('0xea'),ut[_0xc9f4('0x9f')](_0x2582d5,_0xc9f4('0xeb')));rpcDb[_0xc9f4('0x93')](_0x2582d5,'[callProgressDetectingCustomer][machine]');_0x80fb98['verifyAdditionalPhones'](_0x2582d5,'18',_0x24b44a)[_0xc9f4('0x89')](function(_0x3122e5){_0x27dc5f=_0x3122e5[_0xc9f4('0xd0')]==0x1;if(!_0x27dc5f){if(ut['totalGlobal'](_0x2582d5)>=_0x24b44a[_0xc9f4('0xa4')]){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xec'));}}else{_0x2582d5[_0xc9f4('0xcc')]++;_0x80fb98['incrementPreviewCounters']({'id':_0x2582d5[_0xc9f4('0xab')],'field':{'countnoanswerretry':_0x2582d5[_0xc9f4('0xcc')]}})[_0xc9f4('0x89')](function(){_0x80fb98[_0xc9f4('0xad')](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});});}});delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];break;default:if(_0x2582d5[_0xc9f4('0x74')]){ut[_0xc9f4('0xb7')](_0x24b44a,_0xc9f4('0xed'));ut[_0xc9f4('0x7e')](_0xc9f4('0xee')+_0x24b44a[_0xc9f4('0x28')],_0x2f43b1);}_0x24b44a['outboundUnknownCallsDay']+=0x1;_0x2582d5[_0xc9f4('0xc1')]=ut['totalGlobal'](_0x2582d5);ut['logCustomer'](_0x2582d5,0xc,_0x2f43b1[_0xc9f4('0xe8')]||_0x2f43b1['dialstatus']);_0x1ccb78=_0x24b44a['dialAgentRejectRetryFrequency'];_0x308502=_0x24b44a[_0xc9f4('0xc4')];rpcDb['createCustomerHistory'](_0x2582d5,'[callProgressDetectingCustomer][logUnknown]');_0x80fb98[_0xc9f4('0xa2')](_0x2582d5,'20',_0x24b44a)[_0xc9f4('0x89')](function(_0x4fa7e6){_0x27dc5f=_0x4fa7e6['additional']==0x1;if(!_0x27dc5f){if(ut[_0xc9f4('0x9d')](_0x2582d5)>=_0x24b44a['dialGlobalMaxRetry']){_0x7ff11a=ut[_0xc9f4('0xa5')](_0x2582d5,0xf,_0xc9f4('0xd1'));rpcDb[_0xc9f4('0x95')](_0x7ff11a,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xc9f4('0x95')](_0x2582d5,_0xc9f4('0xef'));}delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];}else{_0x80fb98['swapAdditionalPhones'](_0x2582d5,_0x1ccb78,_0x308502)[_0xc9f4('0x89')](function(){});}});}if(!(_0x2582d5[_0xc9f4('0x74')]&&_0x2b816c==='16')){ut[_0xc9f4('0xf0')](_0x24b44a,'[callProgressDetectingCustomer]');logger[_0xc9f4('0x6e')](_0xc9f4('0xf1'),_0x2582d5[_0xc9f4('0xbe')],'\x20Queue',_0x24b44a[_0xc9f4('0x28')],_0xc9f4('0x72'),_0x24b44a['originated']);}if(_0x2b816c!==_0xc9f4('0xae')){delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xbf')]];delete this[_0xc9f4('0x13')][_0x2f43b1[_0xc9f4('0xf2')]];}}};Preview['prototype'][_0xc9f4('0xf3')]=function(_0x20888c,_0xef34db,_0x3dd490){if(_[_0xc9f4('0xf4')](_0xef34db)&&'object'!==typeof _0xef34db){return;}if(_[_0xc9f4('0xf4')](_0x3dd490)&&'object'!==typeof _0x3dd490){return;}switch(_0x3dd490[_0xc9f4('0xf5')]){case'0':ut['logAgent'](_0x20888c,0x0,_0xc9f4('0x9e'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xf7'));break;case'3':ut[_0xc9f4('0xf8')](_0x20888c,0x3,_0xc9f4('0xcd'));rpcDb[_0xc9f4('0xf6')](_0x20888c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x20888c,0x5,_0xc9f4('0xc2'));rpcDb[_0xc9f4('0xf6')](_0x20888c,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xc9f4('0xf8')](_0x20888c,0x8,_0xc9f4('0xf9'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfa'));break;case'22':ut[_0xc9f4('0xf8')](_0x20888c,0x16,_0xc9f4('0xfb'));rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfc'));break;default:ut['logAgent'](_0x20888c,0xc,_0x3dd490[_0xc9f4('0xf5')]);rpcDb[_0xc9f4('0xf6')](_0x20888c,_0xc9f4('0xfa'));}ut[_0xc9f4('0xf0')](_0xef34db,_0xc9f4('0xfd'));logger[_0xc9f4('0x6e')](_0xc9f4('0xfe'),_0x20888c[_0xc9f4('0xbe')],'\x20Queue',_0xef34db[_0xc9f4('0x28')],_0xc9f4('0x72'),_0xef34db[_0xc9f4('0x4e')]);delete this[_0xc9f4('0x13')][_0x20888c[_0xc9f4('0xbe')]];};Preview[_0xc9f4('0xc')][_0xc9f4('0xa2')]=function(_0xbd503a,_0x5125db,_0x3b8ff0){return Promise['resolve']()[_0xc9f4('0x89')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xbd503a,_0x5125db,_0x3b8ff0))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')](_0xc9f4('0xff')));};Preview[_0xc9f4('0xc')][_0xc9f4('0xad')]=function(_0x2b00a8,_0x24afa7,_0x22c6f9){return Promise[_0xc9f4('0x100')]()[_0xc9f4('0x89')](cmHopperAdditionalPhone[_0xc9f4('0xad')](_0x2b00a8,_0x24afa7,_0x22c6f9))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')](_0xc9f4('0x101')));};Preview[_0xc9f4('0xc')]['incrementPreviewCounters']=function(_0x355a18){return Promise[_0xc9f4('0x100')]()[_0xc9f4('0x89')](cmHopperAdditionalPhone[_0xc9f4('0xac')](_0x355a18))[_0xc9f4('0x7b')](logger[_0xc9f4('0x6e')]('[incrementPreviewCounters]\x20'));};Preview[_0xc9f4('0xc')][_0xc9f4('0x102')]=function(_0x37004e,_0x2b6104,_0x56fdc8,_0x1fb3fb,_0x31331a){var _0x3cc07e=this;return new Promise(function(_0x234ab5,_0x10592e){if(_[_0xc9f4('0x6d')](_0x2b6104)||_[_0xc9f4('0x6d')](_0x2b6104['Contact'])||_[_0xc9f4('0x6d')](_0x2b6104['phone'])||_[_0xc9f4('0x6d')](_0x2b6104['VoiceQueueId'])){_0x10592e(ut[_0xc9f4('0x4d')]('Contact\x20is\x20undefined',_0x1fb3fb,_0x31331a));return;}var _0x79d6a6=uuid['v4']();var _0x440ee4=_0x3cc07e['campaignsPreview'][_0x2b6104[_0xc9f4('0x70')][_0xc9f4('0x28')]];var _0x4817c6=_0x56fdc8?_0x3cc07e['agents'][_0x56fdc8]['id']:undefined;_0x3cc07e['actions'][_0x79d6a6]=new Action(_0x2b6104,_0x440ee4,_0x79d6a6,_0x56fdc8,_0x4817c6);var _0x2e0e6c=_0x3cc07e['actions'][_0x79d6a6];_0x2e0e6c['unlockAgent']=_0x1fb3fb;_0x2e0e6c[_0xc9f4('0xaa')]=_0x31331a;_0x2e0e6c[_0xc9f4('0x103')]=_0x56fdc8;if(_['isEmpty'](_0x37004e)){_0x3cc07e[_0xc9f4('0x104')](_0x2e0e6c,_0x440ee4,_0x2b6104,_0x56fdc8)[_0xc9f4('0x89')](function(_0x4840f3){logger['info'](_0xc9f4('0x105'),_0xc9f4('0x106')+_0x2e0e6c[_0xc9f4('0x71')]+_0xc9f4('0x107')+_0x2e0e6c['idContact'],JSON[_0xc9f4('0x5b')](_0x4840f3));ami[_0xc9f4('0x26')](_0xc9f4('0x108'),ut[_0xc9f4('0x9f')](_0x2e0e6c,_0xc9f4('0x109'),_0x3cc07e[_0xc9f4('0x10')][_0x2e0e6c[_0xc9f4('0x71')]]));_0x234ab5(ut[_0xc9f4('0x4d')](_0xc9f4('0x10a')));})[_0xc9f4('0x7b')](function(_0x160032){ut[_0xc9f4('0x60')](_0xc9f4('0x10b'),_0x160032);_0x10592e(ut[_0xc9f4('0x4d')](_0xc9f4('0x10c'),_0x1fb3fb,_0x31331a));});}else{_0x440ee4['outboundBlacklistCallsDay']+=0x1;ut[_0xc9f4('0x10d')](_0x2e0e6c);rpcDb[_0xc9f4('0x10e')](_0x2e0e6c,_0xc9f4('0x10f'));delete _0x3cc07e[_0xc9f4('0x13')][_0x79d6a6];_0x10592e(ut[_0xc9f4('0x4d')]('Contact\x20in\x20black\x20List',_0x1fb3fb,_0x31331a));}});};Preview[_0xc9f4('0xc')][_0xc9f4('0x9a')]=function(_0x5579cc){return!_[_0xc9f4('0x6d')](_0x5579cc)&&!_['isNil'](_0x5579cc['name'])&&!_[_0xc9f4('0x6d')](_0x5579cc[_0xc9f4('0x54')])&&_0x5579cc['active']&&!_['isNil'](this[_0xc9f4('0x12')][util['format']('SIP/%s',_0x5579cc[_0xc9f4('0x28')])])&&!_[_0xc9f4('0x6d')](this[_0xc9f4('0x12')][util[_0xc9f4('0x57')]('SIP/%s',_0x5579cc[_0xc9f4('0x28')])][_0xc9f4('0x79')])&&(this[_0xc9f4('0x12')][util[_0xc9f4('0x57')](_0xc9f4('0x110'),_0x5579cc['name'])][_0xc9f4('0x79')]==='reachable'||this['trunks'][util[_0xc9f4('0x57')](_0xc9f4('0x110'),_0x5579cc[_0xc9f4('0x28')])][_0xc9f4('0x79')]===_0xc9f4('0x111'));};Preview[_0xc9f4('0xc')][_0xc9f4('0x88')]=function(_0x2f42a2,_0x19a40d){var _0x183ddd=this;return new Promise(function(_0x55e08f,_0x403de7){_0x183ddd[_0xc9f4('0x112')](_0x2f42a2,_0x19a40d)[_0xc9f4('0x89')](function(_0x364738){_0x55e08f(_[_0xc9f4('0x113')](_0x364738,[_0xc9f4('0x4d')]));})[_0xc9f4('0x7b')](function(_0x267fb1){if(_0x267fb1[_0xc9f4('0x114')]){rpcDb[_0xc9f4('0x115')](_0x2f42a2);}if(_0x267fb1[_0xc9f4('0x54')]){rpcDb['disableContact'](_0x2f42a2);}_0x403de7(_[_0xc9f4('0x113')](_0x267fb1,[_0xc9f4('0x4d')]));});});};Preview[_0xc9f4('0xc')]['execRun']=function(_0x166667,_0x19fba2){var _0x2d7205=this;return new Promise(function(_0x27dc60,_0x454f28){var _0x2b92bc,_0x19a898;rpcDb[_0xc9f4('0x116')](_0x166667)['then'](function(_0x1df7c1){if(!_['isNil'](_0x1df7c1[0x0])){_0x19a898=_0x1df7c1[0x0][_0xc9f4('0x117')]?![]:!![];_0x2b92bc=_0x1df7c1[0x0][_0xc9f4('0x117')]?!![]:![];_0x2b92bc=_0x19fba2?!![]:_0x2b92bc;}var _0xf10c56=_0x2d7205['validateContact'](_0x1df7c1);if(_0xf10c56[_0xc9f4('0x118')]){rpcDb[_0xc9f4('0x119')](_[_0xc9f4('0x113')](_0x1df7c1[0x0],['VoiceQueueId',_0xc9f4('0x11a')]))[_0xc9f4('0x89')](function(_0x439e02){_0x2d7205[_0xc9f4('0x102')](_0x439e02,_0x1df7c1[0x0],_0x19fba2,_0x19a898,_0x2b92bc)[_0xc9f4('0x89')](function(_0x4b688a){_0x27dc60(_0x4b688a);})[_0xc9f4('0x7b')](function(_0x1f3e26){_0x454f28(_0x1f3e26);});})[_0xc9f4('0x7b')](function(_0x3285a3){ut[_0xc9f4('0x60')](_0xc9f4('0x11b'),_0x3285a3);_0x454f28(ut[_0xc9f4('0x4d')](_0xc9f4('0x11c'),_0x19a898,_0x2b92bc));});}else{_0x454f28(ut['message'](_0xf10c56[_0xc9f4('0x4d')],_0x19a898,_0x2b92bc));}})[_0xc9f4('0x7b')](function(_0x100114){ut[_0xc9f4('0x60')](_0xc9f4('0x11d'),_0x100114);_0x454f28(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0xc9f4('0xc')][_0xc9f4('0x11e')]=function(_0x264fa1){if(_[_0xc9f4('0x6d')](_0x264fa1)||_[_0xc9f4('0x11f')](_0x264fa1)||!_[_0xc9f4('0x6d')](_0x264fa1[0x0][_0xc9f4('0x86')])&&_[_0xc9f4('0x6d')](_0x264fa1[0x0]['Agent'][_0xc9f4('0x28')])){ut[_0xc9f4('0x60')](_0xc9f4('0x120'),_0x264fa1);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5a07e1=this[_0xc9f4('0x10')][_0x264fa1[0x0][_0xc9f4('0x70')][_0xc9f4('0x28')]];_0x5a07e1[_0xc9f4('0x4d')]=_0xc9f4('0x9c');if(_[_0xc9f4('0x6d')](_0x5a07e1)){ut[_0xc9f4('0x60')](_0xc9f4('0x121'),_0x5a07e1);return{'isValid':![],'message':_0xc9f4('0x122')};}if(!this['isTrunkReachable'](_0x5a07e1[_0xc9f4('0x53')])){ut['logger'](_0xc9f4('0x123'),_0xc9f4('0x124')+_0x5a07e1[_0xc9f4('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xc9f4('0x9a')](_0x5a07e1['TrunkBackup'])){ut[_0xc9f4('0x60')](_0xc9f4('0x123'),_0x5a07e1[_0xc9f4('0x28')]+_0xc9f4('0x125'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xc9f4('0x126')](_0x5a07e1[_0xc9f4('0x35')])){ut[_0xc9f4('0x60')](_0xc9f4('0x127'),_0x5a07e1[_0xc9f4('0x28')]+_0xc9f4('0x128'));return{'isValid':![],'message':_0xc9f4('0x124')+_0x5a07e1['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xc9f4('0x129')};};Preview[_0xc9f4('0xc')][_0xc9f4('0x104')]=function(_0x491403,_0x464e00,_0x455cd8,_0x265eef){var _0x184662=this;return new Promise(function(_0x1eaf9c,_0x73a75b){var _0x428222=_0x491403[_0xc9f4('0xbe')];var _0x486fe8=_0x184662[_0xc9f4('0x9a')](_0x464e00['Trunk'])?util[_0xc9f4('0x57')](_0xc9f4('0x12a'),_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x28')],_[_0xc9f4('0x6d')](_0x464e00['dialPrefix'])?'':_0x464e00[_0xc9f4('0x3a')][_0xc9f4('0x12b')]()||'',_0x464e00['dialCutDigit']>0x0?_0x455cd8[_0xc9f4('0x11a')][_0xc9f4('0x12c')](_0x464e00[_0xc9f4('0x12d')]):_0x455cd8[_0xc9f4('0x11a')]):util['format'](_0xc9f4('0x12a'),_['isNil'](_0x464e00[_0xc9f4('0x12e')])?_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x28')]:_0x464e00[_0xc9f4('0x12e')]['name'],_[_0xc9f4('0x6d')](_0x464e00[_0xc9f4('0x3a')])?'':_0x464e00['dialPrefix'][_0xc9f4('0x12b')]()||'',_0x464e00[_0xc9f4('0x12d')]>0x0?_0x455cd8['phone'][_0xc9f4('0x12c')](_0x464e00[_0xc9f4('0x12d')]):_0x455cd8[_0xc9f4('0x11a')]);var _0x522afc=_0x184662[_0xc9f4('0x9a')](_0x464e00[_0xc9f4('0x53')])?ut[_0xc9f4('0x12f')](_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x55')],_0x464e00['dialOriginateCallerIdName'],_0x464e00['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x464e00[_0xc9f4('0x38')],_0x464e00[_0xc9f4('0x130')]):_0x464e00[_0xc9f4('0x38')]):ut[_0xc9f4('0x12f')](_[_0xc9f4('0x6d')](_0x464e00[_0xc9f4('0x12e')])?_0x464e00[_0xc9f4('0x53')][_0xc9f4('0x55')]:_0x464e00['TrunkBackup'][_0xc9f4('0x55')],_0x464e00[_0xc9f4('0x37')],_0x464e00[_0xc9f4('0x130')]>0x0?ut['getCallerIdRandom'](_0x464e00['dialOriginateCallerIdNumber'],_0x464e00[_0xc9f4('0x130')]):_0x464e00['dialOriginateCallerIdNumber']);if(_0x522afc){_0x491403['originatecalleridname']=ut[_0xc9f4('0x131')](_0x522afc);_0x491403[_0xc9f4('0x132')]=ut[_0xc9f4('0x133')](_0x522afc);}var _0x403ff2=ut[_0xc9f4('0x134')](_0x464e00,_0x455cd8,_0x486fe8,_0x522afc,_0x428222,_0x491403);_[_0xc9f4('0x135')](_0x491403,ut[_0xc9f4('0x136')](_0x403ff2));_0x491403[_0xc9f4('0x8c')]=moment()[_0xc9f4('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x464e00[_0xc9f4('0x137')]=_0x403ff2;ami[_0xc9f4('0x78')](ut['variablesAction'](_0x491403,_0x464e00,_0x403ff2,_0x491403[_0xc9f4('0xaa')],_0x265eef))[_0xc9f4('0x89')](function(_0x1bf036){_0x464e00[_0xc9f4('0x4e')]+=0x1;logger['info'](_0xc9f4('0x138'),_0x428222,'\x20Queue',_0x464e00[_0xc9f4('0x28')],'originated:\x20',_0x464e00[_0xc9f4('0x4e')]);_0x1eaf9c(_0x1bf036);})[_0xc9f4('0x7b')](function(_0x494f2a){ut[_0xc9f4('0xf8')](_0x491403,0xe,_0xc9f4('0x139'));rpcDb[_0xc9f4('0xf6')](_0x491403,'[originateFailure][logOriginateFailure]');_0x73a75b(_0x494f2a);});});};Preview['prototype'][_0xc9f4('0x1f')]=function(_0x121bbd){if(this['actions'][_0x121bbd[_0xc9f4('0xbf')]]){this['actions'][_0x121bbd['linkedid']][_0xc9f4('0x7a')]=_0x121bbd[_0xc9f4('0x7a')];}};Preview[_0xc9f4('0xc')]['syncOriginateResponse']=function(_0x686107){var _0x1feec3=this;var _0x489f1e=this['actions'][_0x686107['actionid']];if(_0x489f1e){if(_0x489f1e[_0xc9f4('0x103')]&&this['agents'][_0x489f1e[_0xc9f4('0x103')]]){ut[_0xc9f4('0x13a')](_0x489f1e,this[_0xc9f4('0x14')][_0x489f1e[_0xc9f4('0x103')]][_0xc9f4('0x28')],this[_0xc9f4('0x14')][_0x489f1e[_0xc9f4('0x103')]]['id']);}var _0x2a8034=_[_0xc9f4('0x13b')](_0x489f1e);_0x2a8034['responsetime']=moment()[_0xc9f4('0x57')](_0xc9f4('0x8d'));var _0x49f0da=_0x1feec3[_0xc9f4('0x10')][_0x489f1e[_0xc9f4('0x71')]];if(ut[_0xc9f4('0x13c')](_0x686107['response'])){if(_0x489f1e['unlockAgent']){rpcDb['unlockContact'](_0x489f1e[_0xc9f4('0xab')]);}if(_0x489f1e[_0xc9f4('0xaa')]){rpcDb['disableContact'](_0x489f1e[_0xc9f4('0xab')]);}ami[_0xc9f4('0x26')](_0xc9f4('0x13d'),ut[_0xc9f4('0x9f')](_0x489f1e,'rejected',this[_0xc9f4('0x10')][_0x489f1e['queue']]));this['callProgressDetectingAgent'](_0x2a8034,_0x49f0da,_0x686107);}else{_0x489f1e[_0xc9f4('0x8c')]=moment()['format'](_0xc9f4('0x8d'));ut[_0xc9f4('0xf8')](_0x2a8034,0x4,_0xc9f4('0xb8'));rpcDb[_0xc9f4('0xf6')](_0x2a8034,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xc9f4('0xc')]['syncHangup']=function(_0x251d7a){var _0x356406=this[_0xc9f4('0x13')][_0x251d7a['linkedid']];var _0x5d8bfe;if(_0x356406){_0x5d8bfe=this[_0xc9f4('0x10')][_0x356406[_0xc9f4('0x71')]];logger[_0xc9f4('0x6e')](_0xc9f4('0x13e'),_0x251d7a['linkedid'],_0xc9f4('0xb2'),_0x5d8bfe[_0xc9f4('0x28')],'pTalking:\x20',_0x5d8bfe[_0xc9f4('0x2c')]);}if(this[_0xc9f4('0x13')][_0x251d7a['linkedid']]&&_0x251d7a[_0xc9f4('0xbf')]!==_0x251d7a['uniqueid']){if(_0x251d7a[_0xc9f4('0x13f')]==='16'&&this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}else if(this['actions'][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger[_0xc9f4('0x6e')]('[syncHangup][talking][cause]',_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')],_0xc9f4('0xb2'),_0x5d8bfe['name'],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this[_0xc9f4('0x140')](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}}else if(_0x356406&&_[_0xc9f4('0x6d')](_0x356406[_0xc9f4('0x141')])&&_0x5d8bfe[_0xc9f4('0x142')]&&_0x251d7a[_0xc9f4('0xbf')]===_0x251d7a[_0xc9f4('0xbe')]&&_['isNil'](_0x251d7a['reason'])&&_0x251d7a[_0xc9f4('0x13f')]==='16'&&_0x251d7a[_0xc9f4('0x143')]==='6'&&_[_0xc9f4('0xf4')](_0x356406['transfer'])){if(_0x356406[_0xc9f4('0xd5')]){rpcDb[_0xc9f4('0x115')](_0x356406[_0xc9f4('0xab')]);}if(_0x356406[_0xc9f4('0xaa')]){rpcDb[_0xc9f4('0x144')](_0x356406[_0xc9f4('0xab')]);}_0x251d7a['reason']='22';this['callProgressDetectingAgent'](_0x356406,_0x5d8bfe,_0x251d7a);}else if(_0x356406&&_0x356406['transfer']){if(_0x251d7a[_0xc9f4('0x13f')]==='16'&&this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger[_0xc9f4('0x6e')]('[syncHangup][talking][transfer]',_0x251d7a[_0xc9f4('0xbf')],_0x251d7a['cause'],_0xc9f4('0xb2'),_0x5d8bfe['name'],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')]);}else if(this[_0xc9f4('0x13')][_0x251d7a[_0xc9f4('0xbf')]][_0xc9f4('0x74')]){logger['info'](_0xc9f4('0x145'),_0x251d7a[_0xc9f4('0xbf')],_0x251d7a[_0xc9f4('0x13f')],_0xc9f4('0xb2'),_0x5d8bfe[_0xc9f4('0x28')],_0xc9f4('0x73'),_0x5d8bfe[_0xc9f4('0x2c')]);this['callProgressDetectingCustomer'](_0x251d7a,_0x251d7a[_0xc9f4('0xbf')],_0x251d7a['cause']);}}};Preview[_0xc9f4('0xc')][_0xc9f4('0x1d')]=function(_0x2331b4){if(this[_0xc9f4('0x13')][_0x2331b4[_0xc9f4('0xf2')]]&&_0x2331b4[_0xc9f4('0xf2')]!==_0x2331b4['destuniqueid']){this[_0xc9f4('0x140')](_0x2331b4,_0x2331b4[_0xc9f4('0xf2')],_0x2331b4['dialstatus']);}};Preview[_0xc9f4('0xc')][_0xc9f4('0x1b')]=function(_0x354b94){if(this[_0xc9f4('0x13')][_0x354b94['linkedid']]&&_0x354b94[_0xc9f4('0xbf')]!==_0x354b94[_0xc9f4('0xbe')]&&!this['actions'][_0x354b94['linkedid']][_0xc9f4('0x74')]){if(_0x354b94['cause']==='1'){this['callProgressDetectingCustomer'](_0x354b94,_0x354b94['linkedid'],_0x354b94[_0xc9f4('0x13f')]);}}};Preview[_0xc9f4('0xc')]['addVariable']=function(_0x4b3f86,_0x4eaffa,_0x42ca29){if(this[_0xc9f4('0x13')][_0x4b3f86]){if(_[_0xc9f4('0x6d')](this['actions'][_0x4b3f86][_0xc9f4('0x137')])){this[_0xc9f4('0x13')][_0x4b3f86][_0xc9f4('0x137')]={};}this[_0xc9f4('0x13')][_0x4b3f86]['variables'][_0x4eaffa]=_0x42ca29;}};Preview[_0xc9f4('0xc')][_0xc9f4('0x21')]=function(_0x339f39){try{if(!_['isNil'](_0x339f39)){if(ut['filterKey'](_[_0xc9f4('0x146')](_0x339f39[_0xc9f4('0x147')])[0x0])){this[_0xc9f4('0x148')](_0x339f39[_0xc9f4('0xbe')],_[_0xc9f4('0x146')](_0x339f39[_0xc9f4('0x147')])[0x0],_0x339f39[_0xc9f4('0x149')]);}}}catch(_0x3ddd69){logger[_0xc9f4('0x14a')](_0xc9f4('0x14b'),util[_0xc9f4('0x14c')](_0x3ddd69,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xc9f4('0x23')]=function(_0x57c410){if(_0x57c410){if(this[_0xc9f4('0x13')][_0x57c410[_0xc9f4('0x14d')]]){this[_0xc9f4('0x13')][_0x57c410[_0xc9f4('0x14d')]]['transfer']=!![];}}};Preview[_0xc9f4('0xc')][_0xc9f4('0x24')]=function(_0x2c5256){if(_0x2c5256){if(this[_0xc9f4('0x13')][_0x2c5256[_0xc9f4('0x14e')]]){this[_0xc9f4('0x13')][_0x2c5256[_0xc9f4('0x14e')]][_0xc9f4('0x14f')]=!![];}}};module[_0xc9f4('0x150')]=Preview; \ No newline at end of file +var _0x7f60=['dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','AnswerAGI','reason','[callProgressDetectingAgent][logCongestion]','updateOriginated','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','disableContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','YYYY-MM-DD\x20HH:mm:ss','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','custom:agentringnoanswer','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','variable','addVariable','keys','value','error','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','name','voice_queue:save','info','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','syncCampaigns','campaignsPreview','booked','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','originated:\x20','queue','dialAnswer','pick','UserId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','connect','acw','custom:agentConnectPreview','complete','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','Global','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','NoAnswer'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7f60,0x1e9));var _0x07f6=function(_0x17e397,_0x162b38){_0x17e397=_0x17e397-0x0;var _0x5cc201=_0x7f60[_0x17e397];return _0x5cc201;};'use strict';var util=require(_0x07f6('0x0'));var _=require(_0x07f6('0x1'));var uuid=require(_0x07f6('0x2'));var moment=require(_0x07f6('0x3'));var md5=require(_0x07f6('0x4'));var Redis=require(_0x07f6('0x5'));var config=require(_0x07f6('0x6'));var logger=require(_0x07f6('0x7'))(_0x07f6('0x8'));var loggerAction=require(_0x07f6('0x7'))(_0x07f6('0x9'));var ami=require('../ami');var rpcDb=require(_0x07f6('0xa'));var cmHopperAdditionalPhone=require(_0x07f6('0xb'));var Action=require(_0x07f6('0xc'));var ut=require(_0x07f6('0xd'));config[_0x07f6('0xe')]=_[_0x07f6('0xf')](config[_0x07f6('0xe')],{'host':_0x07f6('0x10'),'port':0x18eb});var io=require(_0x07f6('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x07f6('0x12')]['enqueue']=function(_0x26702f){this[_0x07f6('0x13')]=this['tail']?this[_0x07f6('0x13')][_0x07f6('0x14')](_0x26702f):_0x26702f();};function Preview(_0x4f40e0){this[_0x07f6('0x15')]=new Sequence();this['campaignsPreview']=_0x4f40e0[_0x07f6('0x16')];this[_0x07f6('0x17')]=_0x4f40e0[_0x07f6('0x17')];this[_0x07f6('0x18')]={};this['agents']=_0x4f40e0[_0x07f6('0x19')];this[_0x07f6('0x1a')]=0x0;ami['on'](_0x07f6('0x1b'),this[_0x07f6('0x1c')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x1e'),this[_0x07f6('0x1f')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x20'),this['syncHangupRequest']['bind'](this));ami['on'](_0x07f6('0x21'),this[_0x07f6('0x22')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x23'),this[_0x07f6('0x24')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x25'),this[_0x07f6('0x26')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x27'),this[_0x07f6('0x28')][_0x07f6('0x1d')](this));ami['on'](_0x07f6('0x29'),this['syncBlindTransfer'][_0x07f6('0x1d')](this));this[_0x07f6('0x2a')](this['campaignsPreview']);}function emit(_0x3e0032,_0x5b6dd2,_0xa23cf3){io['to'](_0x3e0032)[_0x07f6('0x2b')](_0x5b6dd2,_0xa23cf3);}function emitCampaignPreview(_0x4db911){if(_0x4db911[_0x07f6('0x2c')]===_0x07f6('0x2d')){var _0x2f9dfa={'id':_0x4db911['id'],'name':_0x4db911['name'],'strategy':_0x4db911[_0x07f6('0x2e')],'answered':_0x4db911[_0x07f6('0x2f')],'available':_0x4db911[_0x07f6('0x30')],'loggedIn':_0x4db911[_0x07f6('0x31')],'pTalking':_0x4db911['pTalking'],'sumBillable':_0x4db911[_0x07f6('0x32')],'sumDuration':_0x4db911['sumDuration'],'sumHoldTime':_0x4db911[_0x07f6('0x33')]||0x0,'talking':_0x4db911['talking'],'total':_0x4db911[_0x07f6('0x34')],'type':_0x4db911[_0x07f6('0x2c')],'unmanaged':_0x4db911[_0x07f6('0x35')],'abandoned':_0x4db911[_0x07f6('0x36')],'waiting':_0x4db911[_0x07f6('0x37')],'loggedInDb':_0x4db911[_0x07f6('0x38')],'dialActive':_0x4db911[_0x07f6('0x39')],'dialMethod':_0x4db911[_0x07f6('0x3a')],'dialOriginateCallerIdName':_0x4db911[_0x07f6('0x3b')],'dialOriginateCallerIdNumber':_0x4db911[_0x07f6('0x3c')],'dialOriginateTimeout':_0x4db911[_0x07f6('0x3d')],'dialPrefix':_0x4db911[_0x07f6('0x3e')],'outboundAnswerAgiCallsDay':_0x4db911['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4db911[_0x07f6('0x3f')],'outboundBlacklistCallsDay':_0x4db911[_0x07f6('0x40')],'outboundBusyCallsDay':_0x4db911['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4db911[_0x07f6('0x41')],'outboundDropCallsDayACS':_0x4db911['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4db911[_0x07f6('0x42')],'outboundDropCallsDayTimeout':_0x4db911['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4db911['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4db911[_0x07f6('0x43')],'outboundOriginateFailureCallsDay':_0x4db911[_0x07f6('0x44')],'outboundReCallsDay':_0x4db911['outboundReCallsDay'],'outboundRejectCallsDay':_0x4db911['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4db911[_0x07f6('0x45')],'outboundAbandonedCallsDay':_0x4db911['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4db911[_0x07f6('0x46')],'predictiveIntervalAvgHoldtime':_0x4db911[_0x07f6('0x47')],'predictiveIntervalAvgTalktime':_0x4db911['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4db911['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4db911['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4db911[_0x07f6('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x4db911['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4db911[_0x07f6('0x49')],'predictiveIntervalMultiplicativeFactor':_0x4db911[_0x07f6('0x4a')],'predictiveIntervalPauses':_0x4db911['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4db911[_0x07f6('0x4b')],'predictiveIntervalTotalCalls':_0x4db911['predictiveIntervalTotalCalls'],'message':_0x4db911[_0x07f6('0x4c')],'originated':_0x4db911[_0x07f6('0x4d')],'erlangCalls':_0x4db911['erlangCalls'],'erlangCallToSecond':_0x4db911[_0x07f6('0x4e')],'erlangAbandonmentRate':_0x4db911[_0x07f6('0x4f')],'erlangBusyFactor':_0x4db911['erlangBusyFactor'],'startPredictive':_0x4db911[_0x07f6('0x50')],'startProgressive':_0x4db911[_0x07f6('0x51')]};if(_0x4db911[_0x07f6('0x52')]){_0x2f9dfa['Trunk']={'id':_0x4db911[_0x07f6('0x52')]['id'],'name':_0x4db911[_0x07f6('0x52')]['name'],'active':_0x4db911[_0x07f6('0x52')][_0x07f6('0x53')],'callerid':_0x4db911[_0x07f6('0x52')][_0x07f6('0x54')]};}if(_0x4db911[_0x07f6('0x55')]){_0x2f9dfa[_0x07f6('0x55')]={'id':_0x4db911['Interval']['id'],'name':_0x4db911['Interval']['name']};}var _0x33857a=md5(JSON[_0x07f6('0x56')](_0x2f9dfa));if(_0x4db911[_0x07f6('0x4')]!==_0x33857a){_0x4db911[_0x07f6('0x4')]=_0x33857a;emit(util[_0x07f6('0x57')](_0x07f6('0x58'),_0x2f9dfa[_0x07f6('0x59')]),_0x07f6('0x5a'),_0x2f9dfa);}}}function emitVoiceQueueChannelRemove(_0x4892b5){logger[_0x07f6('0x5b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x4892b5));emit(util[_0x07f6('0x57')](_0x07f6('0x58'),_0x4892b5[_0x07f6('0x59')]),_0x07f6('0x5c'),_0x4892b5);io[_0x07f6('0x2b')](_0x07f6('0x5d'),_0x4892b5);}function notSendMessagesQueue(_0x34cdf7){if(_0x34cdf7[_0x07f6('0x5e')]){if(_0x34cdf7['originated']===0x0&&_0x34cdf7[_0x07f6('0x5f')]===0x0){_0x34cdf7[_0x07f6('0x5e')]=![];_0x34cdf7['available']=0x0;_0x34cdf7[_0x07f6('0x60')]=0x0;_0x34cdf7[_0x07f6('0x4c')]=_0x07f6('0x61');ut['logger'](_0x07f6('0x62'),_0x34cdf7[_0x07f6('0x59')]+_0x07f6('0x63'));}else{_0x34cdf7['message']=_0x07f6('0x64');ut[_0x07f6('0x65')](_0x07f6('0x62'),_0x34cdf7[_0x07f6('0x59')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x34cdf7);}}Preview[_0x07f6('0x12')][_0x07f6('0x2a')]=function(){var _0xc641d8=this;setInterval(function(){_0xc641d8[_0x07f6('0x66')]();},0x7cf);};Preview[_0x07f6('0x12')]['syncCampaigns']=function(){var _0x5681d8=this[_0x07f6('0x67')];this[_0x07f6('0x1a')]+=0x1;for(var _0x15bfaf in _0x5681d8){if(_0x5681d8['hasOwnProperty'](_0x15bfaf)&&(_0x5681d8[_0x15bfaf]['dialMethod']===_0x07f6('0x8')||_0x5681d8[_0x15bfaf][_0x07f6('0x3a')]===_0x07f6('0x68'))&&_0x5681d8[_0x15bfaf][_0x07f6('0x2c')]===_0x07f6('0x2d')){if(this[_0x07f6('0x1a')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x5681d8[_0x07f6('0x69')](_0x15bfaf)&&_0x5681d8[_0x15bfaf][_0x07f6('0x3a')]===_0x07f6('0x8')&&_0x5681d8[_0x15bfaf][_0x07f6('0x2c')]===_0x07f6('0x2d')){if(_0x5681d8[_0x15bfaf][_0x07f6('0x39')]){this[_0x07f6('0x6a')](_0x5681d8[_0x15bfaf]);if(_0x5681d8[_0x15bfaf][_0x07f6('0x6b')])this[_0x07f6('0x6c')](_0x5681d8[_0x15bfaf]);}else{notSendMessagesQueue(_0x5681d8[_0x15bfaf]);}}}};Preview[_0x07f6('0x12')][_0x07f6('0x6d')]=function(_0x2aa64f){var _0x33f2db=this;this[_0x07f6('0x15')][_0x07f6('0x6e')](function(){if(!_[_0x07f6('0x6f')](_0x33f2db[_0x07f6('0x18')][_0x2aa64f])){loggerAction[_0x07f6('0x5b')](_0x07f6('0x70'),_0x2aa64f,'Queue',_0x33f2db[_0x07f6('0x18')][_0x2aa64f]['queue'],_0x07f6('0x71'),JSON['stringify'](_0x33f2db[_0x07f6('0x67')][_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]][_0x07f6('0x4d')]),'pTalking:\x20',JSON['stringify'](_0x33f2db[_0x07f6('0x67')][_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]]['pTalking']),JSON['stringify'](_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x73')]),JSON[_0x07f6('0x56')](_[_0x07f6('0x74')](_0x33f2db[_0x07f6('0x18')][_0x2aa64f],['contactId',_0x07f6('0x75'),'VoiceQueueId','ListId'])));return ami[_0x07f6('0x76')]({'action':_0x07f6('0x77'),'channel':_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x78')]})[_0x07f6('0x79')](function(_0x4d8d87){if(_0x4d8d87[_0x07f6('0x4c')]===_0x07f6('0x7a')){setTimeout(function(){if(_0x33f2db[_0x07f6('0x18')][_0x2aa64f]){ut['updateOriginated'](_0x33f2db[_0x07f6('0x67')][_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]],_0x07f6('0x7b'));if(_0x33f2db['actions'][_0x2aa64f]['dialAnswer']===!![]){ut[_0x07f6('0x7c')](_0x33f2db[_0x07f6('0x67')][_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]],_0x07f6('0x7b'));ut[_0x07f6('0x7d')](_0x07f6('0x7e')+_0x2aa64f,_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]);}ut[_0x07f6('0x7d')](_0x07f6('0x7f')+_0x2aa64f,_0x33f2db[_0x07f6('0x18')][_0x2aa64f][_0x07f6('0x72')]);delete _0x33f2db[_0x07f6('0x18')][_0x2aa64f];}},0x2328);}});}});};Preview[_0x07f6('0x12')][_0x07f6('0x80')]=function(){var _0x195c10=this;loggerAction[_0x07f6('0x5b')](_0x07f6('0x81'),_[_0x07f6('0x82')](this[_0x07f6('0x18')]));for(var _0x47b833 in this[_0x07f6('0x18')]){if(_0x195c10[_0x07f6('0x18')][_0x07f6('0x69')](_0x47b833)){_0x195c10[_0x07f6('0x6d')](_0x47b833);}}};Preview[_0x07f6('0x12')][_0x07f6('0x6c')]=function(_0x4fc71e){var _0x3bfabc=this;rpcDb[_0x07f6('0x83')](_0x4fc71e['id'],ut[_0x07f6('0x84')](this[_0x07f6('0x19')]))[_0x07f6('0x85')](function(_0x50a6ef){if(!_[_0x07f6('0x6f')](_0x50a6ef)){for(var _0x28d943=0x0;_0x28d943<_0x50a6ef[_0x07f6('0x86')];_0x28d943+=0x1){if(ut[_0x07f6('0x87')](_0x50a6ef[_0x28d943][_0x07f6('0x88')])<_0x4fc71e[_0x07f6('0x89')]*0x3c){if(_0x50a6ef[_0x28d943][_0x07f6('0x8a')]&&!_0x50a6ef[_0x28d943]['Agent'][_0x07f6('0x8b')]){_0x3bfabc[_0x07f6('0x8c')](_0x50a6ef[_0x28d943]['id'])[_0x07f6('0x85')](ut[_0x07f6('0x8d')]('[RecallMe]'))[_0x07f6('0x79')](ut[_0x07f6('0x8d')](_0x07f6('0x8e')));}else{rpcDb['disableContact'](_0x50a6ef[_0x28d943]['id']);}}else{var _0x76a9e4=new Action(_0x50a6ef[_0x28d943],_0x4fc71e);_0x76a9e4['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4fc71e[_0x07f6('0x8f')]+=0x1;ut['logCustomer'](_0x76a9e4,0x17,_0x07f6('0x90'));if(_0x4fc71e[_0x07f6('0x91')]){rpcDb[_0x07f6('0x92')](ut[_0x07f6('0x93')](_0x50a6ef[_0x28d943]));rpcDb['createCustomerHistory'](_0x76a9e4,_0x07f6('0x94'));}else{ut[_0x07f6('0x95')](_0x76a9e4,0x16,'RecallFailedTimeout');rpcDb[_0x07f6('0x96')](_0x76a9e4,_0x07f6('0x97'));rpcDb['createCustomerFinal'](_0x76a9e4,_0x07f6('0x97'));}}}}})['catch'](ut[_0x07f6('0x8d')](_0x07f6('0x98')));};Preview['prototype'][_0x07f6('0x6a')]=function(_0x1d2876){_0x1d2876[_0x07f6('0x5e')]=!![];if(ut[_0x07f6('0x99')](_0x1d2876[_0x07f6('0x31')])){_0x1d2876[_0x07f6('0x4c')]=_0x07f6('0x9a');}else if(!ut[_0x07f6('0x9b')](_0x1d2876['dialActive'])){_0x1d2876[_0x07f6('0x4c')]=_0x07f6('0x61');}else if(!this[_0x07f6('0x9c')](_0x1d2876[_0x07f6('0x52')])){if(!this[_0x07f6('0x9c')](_0x1d2876[_0x07f6('0x9d')])){_0x1d2876[_0x07f6('0x4c')]='TRUNK_IS_NOT_REACHABLE';}else{_0x1d2876[_0x07f6('0x4c')]=_0x07f6('0x9e');}}else{_0x1d2876[_0x07f6('0x4c')]=_0x07f6('0x9e');}emitCampaignPreview(_0x1d2876);};Preview[_0x07f6('0x12')][_0x07f6('0x9f')]=function(_0x18c183,_0x38eac3,_0x122b41){var _0x4b3eba=this;var _0x2850ca=this[_0x07f6('0x18')][_0x38eac3];var _0x38c6ee=this[_0x07f6('0x67')][_0x2850ca[_0x07f6('0x72')]];var _0x1d0219;var _0x494eaf=![];var _0x4c1e04=0x2;var _0x28497e=0x3;if(_0x38c6ee){switch(_0x122b41){case'1':_0x38c6ee[_0x07f6('0x43')]+=0x1;_0x2850ca['countnosuchnumberretry']+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut[_0x07f6('0xa1')](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0x0,_0x07f6('0xa2'));ami['emit'](_0x07f6('0xa3'),ut[_0x07f6('0xa4')](_0x2850ca,_0x07f6('0xa5')));rpcDb['createCustomerHistory'](_0x2850ca,_0x07f6('0xa6'));_0x4b3eba['verifyAdditionalPhones'](_0x2850ca,'0',_0x38c6ee)[_0x07f6('0x85')](function(_0x2b4a67){_0x494eaf=_0x2b4a67['additional']==0x1;_0x4c1e04=_0x38c6ee[_0x07f6('0xa7')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,'Global');rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xac'));}else{if(_0x2850ca[_0x07f6('0xad')]>=_0x38c6ee[_0x07f6('0xae')]){rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xac'));}else{rpcDb[_0x07f6('0xaf')](ut[_0x07f6('0xb0')](_0x2850ca,_0x07f6('0xad'),_0x38c6ee[_0x07f6('0xa7')]),_0x2850ca[_0x07f6('0xb1')],_0x2850ca[_0x07f6('0xb2')]);}}delete this['actions'][_0x18c183[_0x07f6('0xb3')]];}else{_0x2850ca['countnosuchnumberretry']++;logger[_0x07f6('0x5b')](_0x07f6('0xb4'),_0x2850ca[_0x07f6('0xad')]);logger[_0x07f6('0x5b')]('id',_0x2850ca['idContact']);_0x4b3eba[_0x07f6('0xb5')]({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countnosuchnumberretry':_0x2850ca[_0x07f6('0xad')]}})['then'](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case _0x07f6('0xb8'):var _0x3c5d8f=moment()[_0x07f6('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x2850ca[_0x07f6('0xb9')]=_0x3c5d8f;_0x2850ca['answertime']=_0x3c5d8f;_0x2850ca[_0x07f6('0x73')]=!![];_0x38c6ee[_0x07f6('0x5f')]+=0x1;logger[_0x07f6('0x5b')](_0x07f6('0xba'),_0x2850ca[_0x07f6('0xbb')],_0x07f6('0xbc'),_0x38c6ee['name'],_0x07f6('0xbd'),_0x38c6ee[_0x07f6('0x5f')]);ami[_0x07f6('0x2b')]('custom:agentconnect',ut[_0x07f6('0xa4')](_0x2850ca,_0x07f6('0xbe'),this[_0x07f6('0x67')][_0x2850ca[_0x07f6('0x72')]]));if(_0x38c6ee[_0x07f6('0xbf')]){ami[_0x07f6('0x2b')](_0x07f6('0xc0'),ut['buildAcw'](_0x2850ca));}break;case'16':ami[_0x07f6('0x2b')]('custom:agentcomplete',ut[_0x07f6('0xa4')](_0x2850ca,'complete',this[_0x07f6('0x67')][_0x2850ca[_0x07f6('0x72')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2850ca,_0x07f6('0xc1')));_0x38c6ee[_0x07f6('0x3f')]+=0x1;_0x38c6ee[_0x07f6('0x34')]+=0x1;_0x38c6ee[_0x07f6('0x2f')]+=0x1;ut[_0x07f6('0x7c')](_0x38c6ee,_0x07f6('0xc2'));_0x2850ca['countglobal']=ut[_0x07f6('0xa1')](_0x2850ca);ut['logCustomer'](_0x2850ca,0x4,'Answer');rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xc3'));rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xc4'));rpcDb[_0x07f6('0xc5')](_0x2850ca);_0x38c6ee[_0x07f6('0xc6')]+=_0x2850ca[_0x07f6('0xc7')];_0x38c6ee[_0x07f6('0x32')]+=_0x2850ca[_0x07f6('0xc7')];logger[_0x07f6('0x5b')]('[syncHangup][talking][decrement]',_0x2850ca[_0x07f6('0xbb')],_0x07f6('0xbc'),_0x38c6ee[_0x07f6('0x59')],'pTalking:\x20',_0x38c6ee['pTalking']);delete this[_0x07f6('0x18')][_0x18c183[_0x07f6('0xb3')]];break;case _0x07f6('0xc8'):_0x38c6ee[_0x07f6('0xc9')]+=0x1;_0x2850ca[_0x07f6('0xca')]+=0x1;_0x2850ca['countglobal']=ut[_0x07f6('0xa1')](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0x5,_0x07f6('0xcb'));_0x4c1e04=_0x38c6ee[_0x07f6('0xcc')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];ami[_0x07f6('0x2b')](_0x07f6('0xcd'),ut[_0x07f6('0xa4')](_0x2850ca,_0x07f6('0xce')));rpcDb['createCustomerHistory'](_0x2850ca,_0x07f6('0xcf'));_0x4b3eba[_0x07f6('0xd0')](_0x2850ca,'5',_0x38c6ee)['then'](function(_0x3a0942){_0x494eaf=_0x3a0942[_0x07f6('0xd1')]==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut['cloneAction'](_0x2850ca,0xf,_0x07f6('0xd2'));rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xd3'));}else{if(_0x2850ca[_0x07f6('0xca')]>=_0x38c6ee['dialBusyMaxRetry']){rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xcf'));}else{rpcDb['rescheduleContact'](ut[_0x07f6('0xb0')](_0x2850ca,_0x07f6('0xca'),_0x38c6ee[_0x07f6('0xcc')]),_0x2850ca[_0x07f6('0xb1')],_0x2850ca[_0x07f6('0xb2')]);}}}else{_0x2850ca[_0x07f6('0xca')]++;_0x4b3eba['incrementPreviewCounters']({'id':_0x2850ca['idContact'],'field':{'countbusyretry':_0x2850ca[_0x07f6('0xca')]}})[_0x07f6('0x85')](function(){_0x4b3eba['swapAdditionalPhones'](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case _0x07f6('0xd4'):_0x38c6ee['outboundNoAnswerCallsDay']+=0x1;_0x2850ca[_0x07f6('0xd5')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut['totalGlobal'](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0x3,_0x07f6('0xd6'));_0x4c1e04=_0x38c6ee[_0x07f6('0xd7')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];var _0x955edd=ut[_0x07f6('0xd8')](_0x2850ca,_0x38c6ee);ami[_0x07f6('0x2b')](_0x07f6('0xd9'),_0x955edd);rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xda'));_0x4b3eba['verifyAdditionalPhones'](_0x2850ca,'3',_0x38c6ee)[_0x07f6('0x85')](function(_0x46f7fd){_0x494eaf=_0x46f7fd[_0x07f6('0xd1')]==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,_0x07f6('0xd2'));rpcDb['createCustomerFinal'](_0x1d0219,_0x07f6('0xdb'));}else{if(_0x2850ca['countnoanswerretry']>=_0x38c6ee['dialNoAnswerMaxRetry']){rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xda'));}else{rpcDb[_0x07f6('0xaf')](ut[_0x07f6('0xb0')](_0x2850ca,_0x07f6('0xd5'),_0x38c6ee[_0x07f6('0xd7')]),_0x2850ca['unlockAgent'],_0x2850ca[_0x07f6('0xb2')]);}}}else{_0x2850ca['countnoanswerretry']++;_0x4b3eba['incrementPreviewCounters']({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countnoanswerretry':_0x2850ca['countnoanswerretry']}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case _0x07f6('0xdc'):_0x38c6ee[_0x07f6('0x41')]+=0x1;_0x2850ca[_0x07f6('0xdd')]+=0x1;_0x2850ca['countglobal']=ut[_0x07f6('0xa1')](_0x2850ca);ut['logCustomer'](_0x2850ca,0x8,_0x07f6('0xde'));_0x4c1e04=_0x38c6ee[_0x07f6('0xdf')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];ami[_0x07f6('0x2b')](_0x07f6('0xe0'),ut['buildObj'](_0x2850ca,_0x07f6('0xe1')));rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xe2'));_0x4b3eba[_0x07f6('0xd0')](_0x2850ca,'8',_0x38c6ee)['then'](function(_0x4ec1b1){_0x494eaf=_0x4ec1b1[_0x07f6('0xd1')]==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,'Global');rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xe3'));}else{if(_0x2850ca[_0x07f6('0xdd')]>=_0x38c6ee[_0x07f6('0xe4')]){rpcDb[_0x07f6('0xab')](_0x2850ca,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x07f6('0xaf')](ut[_0x07f6('0xb0')](_0x2850ca,'countcongestionretry',_0x38c6ee[_0x07f6('0xcc')]),_0x2850ca['unlockAgent'],_0x2850ca[_0x07f6('0xb2')]);}}}else{_0x2850ca[_0x07f6('0xdd')]++;_0x4b3eba['incrementPreviewCounters']({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countcongestionretry':_0x2850ca['countcongestionretry']}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case _0x07f6('0xe5'):_0x38c6ee['outboundRejectCallsDay']+=0x1;_0x2850ca[_0x07f6('0xe6')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut[_0x07f6('0xa1')](_0x2850ca);ut['logCustomer'](_0x2850ca,0x14,_0x07f6('0xe7'));_0x4c1e04=_0x38c6ee[_0x07f6('0xe8')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];ami[_0x07f6('0x2b')](_0x07f6('0xe9'),ut[_0x07f6('0xa4')](_0x2850ca,'agentreject'));rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xea'));_0x4b3eba[_0x07f6('0xd0')](_0x2850ca,'20',_0x38c6ee)[_0x07f6('0x85')](function(_0x4ea4dd){_0x494eaf=_0x4ea4dd['additional']==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut['cloneAction'](_0x2850ca,0x14,_0x07f6('0xe7'));rpcDb['createCustomerFinal'](_0x1d0219,_0x07f6('0xeb'));}else{if(_0x2850ca['countagentrejectretry']>=_0x38c6ee[_0x07f6('0xec')]){rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xeb'));}else{rpcDb[_0x07f6('0xaf')](ut[_0x07f6('0xb0')](_0x2850ca,'countagentrejectretry',_0x38c6ee[_0x07f6('0xe8')]),_0x2850ca[_0x07f6('0xb1')],_0x2850ca[_0x07f6('0xb2')]);}}}else{_0x2850ca[_0x07f6('0xd5')]++;_0x4b3eba[_0x07f6('0xb5')]({'id':_0x2850ca['idContact'],'field':{'countnoanswerretry':_0x2850ca[_0x07f6('0xd5')]}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case _0x07f6('0xed'):_0x38c6ee[_0x07f6('0xee')]+=0x1;_0x2850ca[_0x07f6('0xef')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut[_0x07f6('0xa1')](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0xb,_0x07f6('0xf0'));rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xf1'));_0x4b3eba['verifyAdditionalPhones'](_0x2850ca,'11',_0x38c6ee)[_0x07f6('0x85')](function(_0x163080){_0x494eaf=_0x163080[_0x07f6('0xd1')]==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,_0x07f6('0xd2'));rpcDb['createCustomerFinal'](_0x1d0219,_0x07f6('0xf1'));}else{if(_0x2850ca['countabandonedetry']>=_0x38c6ee['dialAbandonedMaxRety']){rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xf1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2850ca,_0x07f6('0xef'),_0x38c6ee[_0x07f6('0xf2')]),_0x2850ca[_0x07f6('0xb1')],_0x2850ca[_0x07f6('0xb2')]);}}}else{_0x2850ca[_0x07f6('0xd5')]++;_0x4b3eba[_0x07f6('0xb5')]({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countnoanswerretry':_0x2850ca[_0x07f6('0xd5')]}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});break;case'18':_0x38c6ee[_0x07f6('0x45')]+=0x1;_0x2850ca[_0x07f6('0xf3')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut['totalGlobal'](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0x12,_0x18c183[_0x07f6('0xf4')]||_0x18c183['dialstatus']);ami[_0x07f6('0x2b')](_0x07f6('0xf5'),ut['buildObj'](_0x2850ca,_0x07f6('0xf6')));rpcDb[_0x07f6('0x96')](_0x2850ca,_0x07f6('0xf7'));_0x4b3eba['verifyAdditionalPhones'](_0x2850ca,'18',_0x38c6ee)['then'](function(_0x58a23e){_0x494eaf=_0x58a23e[_0x07f6('0xd1')]==0x1;if(!_0x494eaf){if(ut['totalGlobal'](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0x12,_0x07f6('0xd2'));rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xf7'));}else{rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xf7'));}}else{_0x2850ca[_0x07f6('0xd5')]++;_0x4b3eba[_0x07f6('0xb5')]({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countnoanswerretry':_0x2850ca[_0x07f6('0xd5')]}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});});}});delete this[_0x07f6('0x18')][_0x18c183[_0x07f6('0xb3')]];break;case'19':_0x38c6ee[_0x07f6('0x45')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut[_0x07f6('0xa1')](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0x13,_0x18c183['cause-txt']||_0x18c183[_0x07f6('0xf8')]);ami['emit'](_0x07f6('0xf5'),ut[_0x07f6('0xa4')](_0x2850ca,_0x07f6('0xf6')));rpcDb['createCustomerHistory'](_0x2850ca,_0x07f6('0xf9'));_0x4b3eba[_0x07f6('0xd0')](_0x2850ca,'18',_0x38c6ee)[_0x07f6('0x85')](function(_0x29ce04){_0x494eaf=_0x29ce04['additional']==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,'Global');rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xf9'));}else{rpcDb[_0x07f6('0xab')](_0x2850ca,_0x07f6('0xf9'));}}else{_0x2850ca['countnoanswerretry']++;_0x4b3eba[_0x07f6('0xb5')]({'id':_0x2850ca[_0x07f6('0xb6')],'field':{'countnoanswerretry':_0x2850ca[_0x07f6('0xd5')]}})[_0x07f6('0x85')](function(){_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)['then'](function(){});});}});delete this[_0x07f6('0x18')][_0x18c183[_0x07f6('0xb3')]];break;default:if(_0x2850ca[_0x07f6('0x73')]){ut['decrementTalkink'](_0x38c6ee,'[default]');ut[_0x07f6('0x7d')](_0x07f6('0xfa')+_0x38c6ee[_0x07f6('0x59')],_0x18c183);}_0x38c6ee[_0x07f6('0x45')]+=0x1;_0x2850ca[_0x07f6('0xa0')]=ut[_0x07f6('0xa1')](_0x2850ca);ut[_0x07f6('0x95')](_0x2850ca,0xc,_0x18c183[_0x07f6('0xf4')]||_0x18c183[_0x07f6('0xf8')]);_0x4c1e04=_0x38c6ee[_0x07f6('0xe8')];_0x28497e=_0x38c6ee[_0x07f6('0xa8')];rpcDb['createCustomerHistory'](_0x2850ca,'[callProgressDetectingCustomer][logUnknown]');_0x4b3eba['verifyAdditionalPhones'](_0x2850ca,'20',_0x38c6ee)[_0x07f6('0x85')](function(_0x5e8853){_0x494eaf=_0x5e8853['additional']==0x1;if(!_0x494eaf){if(ut[_0x07f6('0xa1')](_0x2850ca)>=_0x38c6ee[_0x07f6('0xa9')]){_0x1d0219=ut[_0x07f6('0xaa')](_0x2850ca,0xf,_0x07f6('0xd2'));rpcDb[_0x07f6('0xab')](_0x1d0219,_0x07f6('0xfb'));}else{rpcDb['createCustomerFinal'](_0x2850ca,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x18c183[_0x07f6('0xb3')]];}else{_0x4b3eba[_0x07f6('0xb7')](_0x2850ca,_0x4c1e04,_0x28497e)[_0x07f6('0x85')](function(){});}});}if(!(_0x2850ca[_0x07f6('0x73')]&&_0x122b41==='16')){ut['updateOriginated'](_0x38c6ee,_0x07f6('0xfc'));logger[_0x07f6('0x5b')](_0x07f6('0xfd'),_0x2850ca[_0x07f6('0xbb')],_0x07f6('0xbc'),_0x38c6ee[_0x07f6('0x59')],'originated:\x20',_0x38c6ee[_0x07f6('0x4d')]);}if(_0x122b41!==_0x07f6('0xb8')){delete this[_0x07f6('0x18')][_0x18c183[_0x07f6('0xb3')]];delete this[_0x07f6('0x18')][_0x18c183[_0x07f6('0xfe')]];}}};Preview['prototype'][_0x07f6('0xff')]=function(_0x30abf7,_0x10776b,_0x169817){if(_[_0x07f6('0x100')](_0x10776b)&&_0x07f6('0x101')!==typeof _0x10776b){return;}if(_['isUndefined'](_0x169817)&&'object'!==typeof _0x169817){return;}switch(_0x169817['reason']){case'0':ut[_0x07f6('0x102')](_0x30abf7,0x0,_0x07f6('0xa2'));rpcDb[_0x07f6('0x103')](_0x30abf7,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x30abf7,0x3,_0x07f6('0xd6'));rpcDb['createAgentHistory'](_0x30abf7,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x07f6('0x102')](_0x30abf7,0x5,_0x07f6('0xcb'));rpcDb[_0x07f6('0x103')](_0x30abf7,_0x07f6('0x104'));break;case'8':ut['logAgent'](_0x30abf7,0x8,_0x07f6('0xde'));rpcDb['createAgentHistory'](_0x30abf7,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x07f6('0x102')](_0x30abf7,0x16,_0x07f6('0x105'));rpcDb[_0x07f6('0x103')](_0x30abf7,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x30abf7,0xc,_0x169817[_0x07f6('0x106')]);rpcDb[_0x07f6('0x103')](_0x30abf7,_0x07f6('0x107'));}ut[_0x07f6('0x108')](_0x10776b,'[callProgressDetectingAgent]');logger[_0x07f6('0x5b')](_0x07f6('0x109'),_0x30abf7[_0x07f6('0xbb')],_0x07f6('0xbc'),_0x10776b['name'],'originated:\x20',_0x10776b[_0x07f6('0x4d')]);delete this[_0x07f6('0x18')][_0x30abf7['uniqueid']];};Preview[_0x07f6('0x12')]['verifyAdditionalPhones']=function(_0x3d147d,_0x1ad47e,_0x3534f5){return Promise[_0x07f6('0x10a')]()[_0x07f6('0x85')](cmHopperAdditionalPhone[_0x07f6('0xd0')](_0x3d147d,_0x1ad47e,_0x3534f5))['catch'](logger[_0x07f6('0x5b')]('[verifyAdditionalPhone]\x20'));};Preview[_0x07f6('0x12')]['swapAdditionalPhones']=function(_0x2bb85a,_0x471aaa,_0x38f5c8){return Promise[_0x07f6('0x10a')]()[_0x07f6('0x85')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2bb85a,_0x471aaa,_0x38f5c8))[_0x07f6('0x79')](logger[_0x07f6('0x5b')](_0x07f6('0x10b')));};Preview[_0x07f6('0x12')][_0x07f6('0xb5')]=function(_0x3fdc14){return Promise[_0x07f6('0x10a')]()['then'](cmHopperAdditionalPhone[_0x07f6('0xb5')](_0x3fdc14))[_0x07f6('0x79')](logger[_0x07f6('0x5b')](_0x07f6('0x10c')));};Preview['prototype'][_0x07f6('0x10d')]=function(_0x571c2d,_0x1b91c3,_0x4767a8,_0x5dc7e2,_0x26ecc5){var _0x1421a0=this;return new Promise(function(_0x5e3536,_0x5b2c77){if(_[_0x07f6('0x6f')](_0x1b91c3)||_['isNil'](_0x1b91c3[_0x07f6('0x10e')])||_[_0x07f6('0x6f')](_0x1b91c3[_0x07f6('0x10f')])||_['isNil'](_0x1b91c3[_0x07f6('0x110')])){_0x5b2c77(ut[_0x07f6('0x4c')](_0x07f6('0x111'),_0x5dc7e2,_0x26ecc5));return;}var _0x567ecc=uuid['v4']();var _0x2ff645=_0x1421a0[_0x07f6('0x67')][_0x1b91c3[_0x07f6('0x112')]['name']];var _0x1fd7ab=_0x4767a8?_0x1421a0['agents'][_0x4767a8]['id']:undefined;_0x1421a0[_0x07f6('0x18')][_0x567ecc]=new Action(_0x1b91c3,_0x2ff645,_0x567ecc,_0x4767a8,_0x1fd7ab);var _0x2b1a4b=_0x1421a0[_0x07f6('0x18')][_0x567ecc];_0x2b1a4b[_0x07f6('0xb1')]=_0x5dc7e2;_0x2b1a4b[_0x07f6('0xb2')]=_0x26ecc5;_0x2b1a4b[_0x07f6('0x113')]=_0x4767a8;if(_['isEmpty'](_0x571c2d)){_0x1421a0[_0x07f6('0x114')](_0x2b1a4b,_0x2ff645,_0x1b91c3,_0x4767a8)[_0x07f6('0x85')](function(_0xd9d0a0){logger[_0x07f6('0x5b')](_0x07f6('0x115'),_0x07f6('0x116')+_0x2b1a4b['queue']+_0x07f6('0x117')+_0x2b1a4b['idContact'],JSON['stringify'](_0xd9d0a0));ami[_0x07f6('0x2b')](_0x07f6('0x118'),ut[_0x07f6('0xa4')](_0x2b1a4b,_0x07f6('0x119'),_0x1421a0[_0x07f6('0x67')][_0x2b1a4b[_0x07f6('0x72')]]));_0x5e3536(ut[_0x07f6('0x4c')](_0x07f6('0x11a')));})[_0x07f6('0x79')](function(_0x4e2664){ut['logger'](_0x07f6('0x11b'),_0x4e2664);_0x5b2c77(ut[_0x07f6('0x4c')](_0x07f6('0x11c'),_0x5dc7e2,_0x26ecc5));});}else{_0x2ff645[_0x07f6('0x40')]+=0x1;ut[_0x07f6('0x11d')](_0x2b1a4b);rpcDb[_0x07f6('0x11e')](_0x2b1a4b,_0x07f6('0x11f'));delete _0x1421a0['actions'][_0x567ecc];_0x5b2c77(ut[_0x07f6('0x4c')]('Contact\x20in\x20black\x20List',_0x5dc7e2,_0x26ecc5));}});};Preview[_0x07f6('0x12')][_0x07f6('0x9c')]=function(_0x506c64){return!_[_0x07f6('0x6f')](_0x506c64)&&!_[_0x07f6('0x6f')](_0x506c64['name'])&&!_[_0x07f6('0x6f')](_0x506c64[_0x07f6('0x53')])&&_0x506c64[_0x07f6('0x53')]&&!_['isNil'](this[_0x07f6('0x17')][util[_0x07f6('0x57')](_0x07f6('0x120'),_0x506c64[_0x07f6('0x59')])])&&!_[_0x07f6('0x6f')](this[_0x07f6('0x17')][util[_0x07f6('0x57')](_0x07f6('0x120'),_0x506c64[_0x07f6('0x59')])][_0x07f6('0x77')])&&(this[_0x07f6('0x17')][util[_0x07f6('0x57')](_0x07f6('0x120'),_0x506c64['name'])][_0x07f6('0x77')]===_0x07f6('0x121')||this['trunks'][util[_0x07f6('0x57')](_0x07f6('0x120'),_0x506c64[_0x07f6('0x59')])][_0x07f6('0x77')]===_0x07f6('0x122'));};Preview[_0x07f6('0x12')]['run']=function(_0x3c4018,_0x30ec95){var _0x31d5ba=this;return new Promise(function(_0x3d3c52,_0x51901a){_0x31d5ba[_0x07f6('0x123')](_0x3c4018,_0x30ec95)['then'](function(_0x1e6ef6){_0x3d3c52(_[_0x07f6('0x74')](_0x1e6ef6,[_0x07f6('0x4c')]));})[_0x07f6('0x79')](function(_0x5cf01e){if(_0x5cf01e['unlock']){rpcDb['unlockContact'](_0x3c4018);}if(_0x5cf01e[_0x07f6('0x53')]){rpcDb[_0x07f6('0x124')](_0x3c4018);}_0x51901a(_[_0x07f6('0x74')](_0x5cf01e,[_0x07f6('0x4c')]));});});};Preview[_0x07f6('0x12')][_0x07f6('0x123')]=function(_0x2880c7,_0x31b041){var _0x6602fa=this;return new Promise(function(_0x239671,_0x2fd985){var _0x15ce00,_0x3fce69;rpcDb[_0x07f6('0x125')](_0x2880c7)[_0x07f6('0x85')](function(_0x55b376){if(!_[_0x07f6('0x6f')](_0x55b376[0x0])){_0x3fce69=_0x55b376[0x0][_0x07f6('0x126')]?![]:!![];_0x15ce00=_0x55b376[0x0]['recallme']?!![]:![];_0x15ce00=_0x31b041?!![]:_0x15ce00;}var _0x293dc9=_0x6602fa[_0x07f6('0x127')](_0x55b376);if(_0x293dc9[_0x07f6('0x128')]){rpcDb['checkIsBlackList'](_['pick'](_0x55b376[0x0],[_0x07f6('0x110'),'phone']))[_0x07f6('0x85')](function(_0x967c1e){_0x6602fa['checkInBlack'](_0x967c1e,_0x55b376[0x0],_0x31b041,_0x3fce69,_0x15ce00)[_0x07f6('0x85')](function(_0x48bd50){_0x239671(_0x48bd50);})[_0x07f6('0x79')](function(_0x1be136){_0x2fd985(_0x1be136);});})[_0x07f6('0x79')](function(_0x3cb9f9){ut[_0x07f6('0x65')](_0x07f6('0x129'),_0x3cb9f9);_0x2fd985(ut[_0x07f6('0x4c')](_0x07f6('0x12a'),_0x3fce69,_0x15ce00));});}else{_0x2fd985(ut[_0x07f6('0x4c')](_0x293dc9['message'],_0x3fce69,_0x15ce00));}})[_0x07f6('0x79')](function(_0x104277){ut[_0x07f6('0x65')](_0x07f6('0x12b'),_0x104277);_0x2fd985(ut['message'](_0x07f6('0x12a'),![],!![]));});});};Preview[_0x07f6('0x12')][_0x07f6('0x127')]=function(_0x492b33){if(_[_0x07f6('0x6f')](_0x492b33)||_[_0x07f6('0x12c')](_0x492b33)||!_[_0x07f6('0x6f')](_0x492b33[0x0][_0x07f6('0x8a')])&&_['isNil'](_0x492b33[0x0]['Agent'][_0x07f6('0x59')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x492b33);return{'isValid':![],'message':_0x07f6('0x12d')};}var _0x4521ac=this[_0x07f6('0x67')][_0x492b33[0x0][_0x07f6('0x112')][_0x07f6('0x59')]];_0x4521ac[_0x07f6('0x4c')]=_0x07f6('0x9e');if(_[_0x07f6('0x6f')](_0x4521ac)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x4521ac);return{'isValid':![],'message':_0x07f6('0x12e')};}if(!this[_0x07f6('0x9c')](_0x4521ac[_0x07f6('0x52')])){ut[_0x07f6('0x65')](_0x07f6('0x12f'),_0x07f6('0x130')+_0x4521ac[_0x07f6('0x59')]+_0x07f6('0x131'));if(!this[_0x07f6('0x9c')](_0x4521ac[_0x07f6('0x9d')])){ut[_0x07f6('0x65')](_0x07f6('0x12f'),_0x4521ac['name']+_0x07f6('0x132'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x07f6('0x9b')](_0x4521ac[_0x07f6('0x39')])){ut[_0x07f6('0x65')]('[Preview][validateContact][Campaign\x20Active]',_0x4521ac[_0x07f6('0x59')]+_0x07f6('0x133'));return{'isValid':![],'message':_0x07f6('0x130')+_0x4521ac[_0x07f6('0x59')]+_0x07f6('0x133')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x07f6('0x12')][_0x07f6('0x114')]=function(_0x2dede8,_0x4109b6,_0x2385f7,_0x1180e9){var _0x5cdd28=this;return new Promise(function(_0x377d22,_0x4af644){var _0xdb964c=_0x2dede8[_0x07f6('0xbb')];var _0x5d7565=_0x5cdd28[_0x07f6('0x9c')](_0x4109b6[_0x07f6('0x52')])?util['format'](_0x07f6('0x134'),_0x4109b6[_0x07f6('0x52')]['name'],_['isNil'](_0x4109b6[_0x07f6('0x3e')])?'':_0x4109b6[_0x07f6('0x3e')][_0x07f6('0x135')]()||'',_0x4109b6[_0x07f6('0x136')]>0x0?_0x2385f7[_0x07f6('0x10f')][_0x07f6('0x137')](_0x4109b6[_0x07f6('0x136')]):_0x2385f7['phone']):util[_0x07f6('0x57')]('SIP/%s/%s%s',_[_0x07f6('0x6f')](_0x4109b6['TrunkBackup'])?_0x4109b6[_0x07f6('0x52')][_0x07f6('0x59')]:_0x4109b6[_0x07f6('0x9d')]['name'],_[_0x07f6('0x6f')](_0x4109b6[_0x07f6('0x3e')])?'':_0x4109b6[_0x07f6('0x3e')][_0x07f6('0x135')]()||'',_0x4109b6[_0x07f6('0x136')]>0x0?_0x2385f7[_0x07f6('0x10f')][_0x07f6('0x137')](_0x4109b6[_0x07f6('0x136')]):_0x2385f7[_0x07f6('0x10f')]);var _0x54f684=_0x5cdd28[_0x07f6('0x9c')](_0x4109b6[_0x07f6('0x52')])?ut[_0x07f6('0x138')](_0x4109b6[_0x07f6('0x52')][_0x07f6('0x54')],_0x4109b6[_0x07f6('0x3b')],_0x4109b6[_0x07f6('0x139')]>0x0?ut[_0x07f6('0x13a')](_0x4109b6[_0x07f6('0x3c')],_0x4109b6[_0x07f6('0x139')]):_0x4109b6['dialOriginateCallerIdNumber']):ut[_0x07f6('0x138')](_['isNil'](_0x4109b6[_0x07f6('0x9d')])?_0x4109b6[_0x07f6('0x52')][_0x07f6('0x54')]:_0x4109b6[_0x07f6('0x9d')]['callerid'],_0x4109b6[_0x07f6('0x3b')],_0x4109b6[_0x07f6('0x139')]>0x0?ut[_0x07f6('0x13a')](_0x4109b6[_0x07f6('0x3c')],_0x4109b6[_0x07f6('0x139')]):_0x4109b6['dialOriginateCallerIdNumber']);if(_0x54f684){_0x2dede8[_0x07f6('0x13b')]=ut[_0x07f6('0x13c')](_0x54f684);_0x2dede8['originatecalleridnum']=ut[_0x07f6('0x13d')](_0x54f684);}var _0x1871f6=ut[_0x07f6('0x13e')](_0x4109b6,_0x2385f7,_0x5d7565,_0x54f684,_0xdb964c,_0x2dede8);_[_0x07f6('0x13f')](_0x2dede8,ut[_0x07f6('0x140')](_0x1871f6));_0x2dede8[_0x07f6('0x141')]=moment()[_0x07f6('0x57')](_0x07f6('0x142'));_0x4109b6['variables']=_0x1871f6;ami[_0x07f6('0x76')](ut[_0x07f6('0x143')](_0x2dede8,_0x4109b6,_0x1871f6,_0x2dede8[_0x07f6('0xb2')],_0x1180e9))[_0x07f6('0x85')](function(_0x353b54){_0x4109b6['originated']+=0x1;logger[_0x07f6('0x5b')]('[originated][increment]',_0xdb964c,'\x20Queue',_0x4109b6['name'],'originated:\x20',_0x4109b6[_0x07f6('0x4d')]);_0x377d22(_0x353b54);})[_0x07f6('0x79')](function(_0x5cb550){ut[_0x07f6('0x102')](_0x2dede8,0xe,_0x07f6('0x144'));rpcDb[_0x07f6('0x103')](_0x2dede8,_0x07f6('0x145'));_0x4af644(_0x5cb550);});});};Preview[_0x07f6('0x12')]['syncNewExten']=function(_0x369052){if(this[_0x07f6('0x18')][_0x369052['linkedid']]){this['actions'][_0x369052[_0x07f6('0xb3')]][_0x07f6('0x78')]=_0x369052[_0x07f6('0x78')];}};Preview['prototype'][_0x07f6('0x1c')]=function(_0x75790){var _0x5b2eec=this;var _0x230ddf=this[_0x07f6('0x18')][_0x75790[_0x07f6('0x146')]];if(_0x230ddf){if(_0x230ddf[_0x07f6('0x113')]&&this['agents'][_0x230ddf[_0x07f6('0x113')]]){ut['logLookAgent'](_0x230ddf,this[_0x07f6('0x19')][_0x230ddf[_0x07f6('0x113')]]['name'],this[_0x07f6('0x19')][_0x230ddf[_0x07f6('0x113')]]['id']);}var _0x201d3a=_[_0x07f6('0x147')](_0x230ddf);_0x201d3a['responsetime']=moment()[_0x07f6('0x57')](_0x07f6('0x142'));var _0x2e716e=_0x5b2eec['campaignsPreview'][_0x230ddf[_0x07f6('0x72')]];if(ut[_0x07f6('0x148')](_0x75790['response'])){if(_0x230ddf[_0x07f6('0xb1')]){rpcDb[_0x07f6('0x149')](_0x230ddf[_0x07f6('0xb6')]);}if(_0x230ddf[_0x07f6('0xb2')]){rpcDb['disableContact'](_0x230ddf['idContact']);}ami[_0x07f6('0x2b')](_0x07f6('0x14a'),ut[_0x07f6('0xa4')](_0x230ddf,'rejected',this[_0x07f6('0x67')][_0x230ddf[_0x07f6('0x72')]]));this[_0x07f6('0xff')](_0x201d3a,_0x2e716e,_0x75790);}else{_0x230ddf[_0x07f6('0x141')]=moment()[_0x07f6('0x57')](_0x07f6('0x142'));ut[_0x07f6('0x102')](_0x201d3a,0x4,_0x07f6('0x14b'));rpcDb[_0x07f6('0x103')](_0x201d3a,_0x07f6('0x14c'));}}};Preview[_0x07f6('0x12')][_0x07f6('0x1f')]=function(_0x268e13){var _0x28898a=this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]];var _0x4e209e;if(_0x28898a){_0x4e209e=this[_0x07f6('0x67')][_0x28898a[_0x07f6('0x72')]];logger[_0x07f6('0x5b')](_0x07f6('0x14d'),_0x268e13['linkedid'],_0x07f6('0xbc'),_0x4e209e[_0x07f6('0x59')],'pTalking:\x20',_0x4e209e[_0x07f6('0x5f')]);}if(this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]]&&_0x268e13[_0x07f6('0xb3')]!==_0x268e13[_0x07f6('0xbb')]){if(_0x268e13[_0x07f6('0x14e')]==='16'&&this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]]['dialAnswer']){this[_0x07f6('0x9f')](_0x268e13,_0x268e13['linkedid'],_0x268e13[_0x07f6('0x14e')]);}else if(this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]][_0x07f6('0x73')]){logger[_0x07f6('0x5b')]('[syncHangup][talking][cause]',_0x268e13['linkedid'],_0x268e13[_0x07f6('0x14e')],_0x07f6('0xbc'),_0x4e209e['name'],_0x07f6('0xbd'),_0x4e209e[_0x07f6('0x5f')]);this[_0x07f6('0x9f')](_0x268e13,_0x268e13[_0x07f6('0xb3')],_0x268e13[_0x07f6('0x14e')]);}}else if(_0x28898a&&_[_0x07f6('0x6f')](_0x28898a[_0x07f6('0x14f')])&&_0x4e209e[_0x07f6('0x150')]&&_0x268e13[_0x07f6('0xb3')]===_0x268e13[_0x07f6('0xbb')]&&_[_0x07f6('0x6f')](_0x268e13[_0x07f6('0x106')])&&_0x268e13[_0x07f6('0x14e')]==='16'&&_0x268e13['channelstate']==='6'&&_[_0x07f6('0x100')](_0x28898a[_0x07f6('0x151')])){if(_0x28898a['unlockAgent']){rpcDb[_0x07f6('0x149')](_0x28898a[_0x07f6('0xb6')]);}if(_0x28898a[_0x07f6('0xb2')]){rpcDb[_0x07f6('0x124')](_0x28898a['idContact']);}_0x268e13[_0x07f6('0x106')]='22';this['callProgressDetectingAgent'](_0x28898a,_0x4e209e,_0x268e13);}else if(_0x28898a&&_0x28898a[_0x07f6('0x151')]){if(_0x268e13[_0x07f6('0x14e')]==='16'&&this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]][_0x07f6('0x73')]){logger[_0x07f6('0x5b')](_0x07f6('0x152'),_0x268e13[_0x07f6('0xb3')],_0x268e13[_0x07f6('0x14e')],_0x07f6('0xbc'),_0x4e209e['name'],_0x07f6('0xbd'),_0x4e209e['pTalking']);this['callProgressDetectingCustomer'](_0x268e13,_0x268e13[_0x07f6('0xb3')],_0x268e13['cause']);}else if(this[_0x07f6('0x18')][_0x268e13[_0x07f6('0xb3')]][_0x07f6('0x73')]){logger['info']('[syncHangup][talking][cause]',_0x268e13['linkedid'],_0x268e13[_0x07f6('0x14e')],_0x07f6('0xbc'),_0x4e209e[_0x07f6('0x59')],_0x07f6('0xbd'),_0x4e209e['pTalking']);this[_0x07f6('0x9f')](_0x268e13,_0x268e13['linkedid'],_0x268e13[_0x07f6('0x14e')]);}}};Preview[_0x07f6('0x12')][_0x07f6('0x22')]=function(_0x18a303){if(this['actions'][_0x18a303['destlinkedid']]&&_0x18a303[_0x07f6('0xfe')]!==_0x18a303[_0x07f6('0x153')]){this[_0x07f6('0x9f')](_0x18a303,_0x18a303[_0x07f6('0xfe')],_0x18a303['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x39a31d){if(this['actions'][_0x39a31d[_0x07f6('0xb3')]]&&_0x39a31d[_0x07f6('0xb3')]!==_0x39a31d['uniqueid']&&!this[_0x07f6('0x18')][_0x39a31d['linkedid']][_0x07f6('0x73')]){if(_0x39a31d['cause']==='1'){this['callProgressDetectingCustomer'](_0x39a31d,_0x39a31d[_0x07f6('0xb3')],_0x39a31d[_0x07f6('0x14e')]);}}};Preview[_0x07f6('0x12')]['addVariable']=function(_0x5bdfc0,_0x4a828e,_0x316a5f){if(this[_0x07f6('0x18')][_0x5bdfc0]){if(_[_0x07f6('0x6f')](this['actions'][_0x5bdfc0]['variables'])){this[_0x07f6('0x18')][_0x5bdfc0][_0x07f6('0x154')]={};}this[_0x07f6('0x18')][_0x5bdfc0][_0x07f6('0x154')][_0x4a828e]=_0x316a5f;}};Preview['prototype'][_0x07f6('0x26')]=function(_0x1bf6ad){try{if(!_[_0x07f6('0x6f')](_0x1bf6ad)){if(ut[_0x07f6('0x155')](_['keys'](_0x1bf6ad[_0x07f6('0x156')])[0x0])){this[_0x07f6('0x157')](_0x1bf6ad[_0x07f6('0xbb')],_[_0x07f6('0x158')](_0x1bf6ad['variable'])[0x0],_0x1bf6ad[_0x07f6('0x159')]);}}}catch(_0x2cfdee){logger[_0x07f6('0x15a')]('[syncVarSet][Preview]',util[_0x07f6('0x15b')](_0x2cfdee,{'showHidden':![],'depth':null}));}};Preview[_0x07f6('0x12')][_0x07f6('0x28')]=function(_0x14f878){if(_0x14f878){if(this[_0x07f6('0x18')][_0x14f878[_0x07f6('0x15c')]]){this[_0x07f6('0x18')][_0x14f878[_0x07f6('0x15c')]]['transfer']=!![];}}};Preview[_0x07f6('0x12')][_0x07f6('0x15d')]=function(_0x233c46){if(_0x233c46){if(this[_0x07f6('0x18')][_0x233c46[_0x07f6('0x15e')]]){this[_0x07f6('0x18')][_0x233c46[_0x07f6('0x15e')]][_0x07f6('0x151')]=!![];}}};module[_0x07f6('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 588de98..0db0960 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 _0x2534=['createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect'];(function(_0x21f9b0,_0x5e016f){var _0x422b28=function(_0x22327f){while(--_0x22327f){_0x21f9b0['push'](_0x21f9b0['shift']());}};_0x422b28(++_0x5e016f);}(_0x2534,0xe4));var _0x4253=function(_0x3f4d9d,_0x44cc3e){_0x3f4d9d=_0x3f4d9d-0x0;var _0xf7244c=_0x2534[_0x3f4d9d];return _0xf7244c;};'use strict';var util=require('util');var BPromise=require(_0x4253('0x0'));var logger=require(_0x4253('0x1'))(_0x4253('0x2'));var _=require(_0x4253('0x3'));var cmHopper=require(_0x4253('0x4'));var cmHopperFinal=require(_0x4253('0x5'));var cmHopperHistory=require(_0x4253('0x6'));var cmHopperBlack=require(_0x4253('0x7'));var voiceQueueRt=require(_0x4253('0x8'));var agentReportPreview=require(_0x4253('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55a11f){return function(_0x4a5595){logger[_0x4253('0xa')](_0x55a11f,util[_0x4253('0xb')](_0x4a5595,{'showHidden':![],'depth':null}));};}function create(_0x2eca5f){return BPromise['resolve']()['then'](cmHopperHistory[_0x4253('0xc')](_0x2eca5f))[_0x4253('0xd')](loggerCatch(_0x4253('0xe')));}function createAgent(_0x3c044f){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](agentReportPreview['createHistory'](_0x3c044f))[_0x4253('0xd')](loggerCatch(_0x4253('0xe')));}function moveContact(_0x3c2978){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x11')](_0x3c2978,!![]))['catch'](loggerCatch(_0x4253('0x12')));}exports[_0x4253('0x13')]=function(_0x36539a){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopperBlack['checkIsBlackList'](_0x36539a))['catch'](loggerCatch(_0x4253('0x14')));};exports[_0x4253('0x15')]=function(_0x5c2b2e){return BPromise['resolve']()['then'](cmHopper[_0x4253('0x15')](_0x5c2b2e))[_0x4253('0xd')](loggerCatch(_0x4253('0x16')));};exports[_0x4253('0xc')]=function(_0x5607d1,_0x565aaa){create(_0x5607d1)[_0x4253('0xd')](loggerCatch(_0x565aaa));moveContact(_0x5607d1)[_0x4253('0xd')](loggerCatch(_0x565aaa));};exports[_0x4253('0x17')]=function(_0x2c9fea,_0x1ed271){createAgent(_0x2c9fea)[_0x4253('0xd')](loggerCatch(_0x1ed271));};exports['createCustomerHistory']=function(_0xc03425,_0x200972){create(_0xc03425)['catch'](loggerCatch(_0x200972));};exports[_0x4253('0x18')]=function(_0x247040,_0x427f3d){moveContact(_0x247040)[_0x4253('0xd')](loggerCatch(_0x427f3d));};exports[_0x4253('0x19')]=function(_0x426f40,_0x1dc370,_0x11fcc7){if(_0x1dc370){_0x426f40[_0x4253('0x1a')]=null;}if(_0x11fcc7){_0x426f40[_0x4253('0x1b')]=![];}return BPromise['resolve']()[_0x4253('0x10')](cmHopper[_0x4253('0x19')](_0x426f40))[_0x4253('0xd')](loggerCatch(_0x4253('0x1c')));};exports['countReScheduled']=function(_0x39d093){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x1d')](_0x39d093))[_0x4253('0xd')](loggerCatch(_0x4253('0x1e')));};exports['unlockContact']=function(_0x3e0c7d){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper['unlockContact']({'UserId':null},_0x3e0c7d,0x1))[_0x4253('0xd')](loggerCatch(_0x4253('0x1f')));};exports[_0x4253('0x20')]=function(_0x142675){return BPromise[_0x4253('0xf')]()['then'](cmHopper['unlockContact']({'active':![]},_0x142675,0x1))[_0x4253('0xd')](loggerCatch(_0x4253('0x21')));};exports[_0x4253('0x22')]=function(_0x445317){var _0x3eedcb={};_0x3eedcb[_0x4253('0x23')]=_0x445317[_0x4253('0x23')];_0x3eedcb[_0x4253('0x24')]=_0x445317[_0x4253('0x24')];_0x3eedcb['calleridnum']=_0x445317[_0x4253('0x25')];_0x3eedcb[_0x4253('0x26')]=_0x445317[_0x4253('0x26')];_0x3eedcb[_0x4253('0x27')]=_0x445317[_0x4253('0x27')];_0x3eedcb[_0x4253('0x28')]=_0x445317['answertime'];_0x3eedcb[_0x4253('0x29')]=_0x445317[_0x4253('0x2a')];_0x3eedcb['queuecallercomplete']=0x1;_0x3eedcb[_0x4253('0x2b')]=_0x445317[_0x4253('0x2c')];_0x3eedcb[_0x4253('0x2d')]=_0x445317['membername'];_0x3eedcb[_0x4253('0x2e')]=_0x4253('0x2f');_0x3eedcb[_0x4253('0x30')]=_0x4253('0x31');_0x3eedcb[_0x4253('0x32')]=0x0;_0x3eedcb[_0x4253('0x33')]=0x1;_0x3eedcb[_0x4253('0x34')]=_0x445317['membername'];_0x3eedcb[_0x4253('0x35')]=_0x4253('0x36');return BPromise[_0x4253('0xf')]()['then'](voiceQueueReport[_0x4253('0x37')](_0x3eedcb))[_0x4253('0xd')](loggerCatch(_0x4253('0x38')));};exports[_0x4253('0x39')]=function(_0x1b2eca,_0x2087af){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x39')](_0x1b2eca,_0x2087af))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x4253('0x3a')]=function(_0x694c29){return BPromise[_0x4253('0xf')]()[_0x4253('0x10')](cmHopper[_0x4253('0x19')](_0x694c29,!![],!![]))[_0x4253('0xd')](loggerCatch(_0x4253('0x3b')));}; \ No newline at end of file +var _0xac79=['queuecallerleaveAt','queuecallercomplete','endtime','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xac79,0x1a8));var _0x9ac7=function(_0x1e5215,_0x2dffee){_0x1e5215=_0x1e5215-0x0;var _0x111202=_0xac79[_0x1e5215];return _0x111202;};'use strict';var util=require(_0x9ac7('0x0'));var BPromise=require(_0x9ac7('0x1'));var logger=require(_0x9ac7('0x2'))(_0x9ac7('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x9ac7('0x4'));var cmHopperHistory=require(_0x9ac7('0x5'));var cmHopperBlack=require(_0x9ac7('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x9ac7('0x7'));var voiceQueueReport=require(_0x9ac7('0x8'));function loggerCatch(_0x5156dc){return function(_0x98b751){logger[_0x9ac7('0x9')](_0x5156dc,util[_0x9ac7('0xa')](_0x98b751,{'showHidden':![],'depth':null}));};}function create(_0x50b4f7){return BPromise[_0x9ac7('0xb')]()['then'](cmHopperHistory[_0x9ac7('0xc')](_0x50b4f7))[_0x9ac7('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x47d92b){return BPromise[_0x9ac7('0xb')]()['then'](agentReportPreview[_0x9ac7('0xc')](_0x47d92b))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0xe')));}function moveContact(_0x903e93){return BPromise[_0x9ac7('0xb')]()[_0x9ac7('0xf')](cmHopper[_0x9ac7('0x10')](_0x903e93,!![]))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0x11')));}exports['checkIsBlackList']=function(_0x597437){return BPromise[_0x9ac7('0xb')]()['then'](cmHopperBlack[_0x9ac7('0x12')](_0x597437))[_0x9ac7('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x123484){return BPromise['resolve']()[_0x9ac7('0xf')](cmHopper['getContactPreview'](_0x123484))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0x13')));};exports[_0x9ac7('0xc')]=function(_0x2c4120,_0x1757d6){create(_0x2c4120)[_0x9ac7('0xd')](loggerCatch(_0x1757d6));moveContact(_0x2c4120)[_0x9ac7('0xd')](loggerCatch(_0x1757d6));};exports['createAgentHistory']=function(_0x4316bd,_0x42feea){createAgent(_0x4316bd)[_0x9ac7('0xd')](loggerCatch(_0x42feea));};exports[_0x9ac7('0x14')]=function(_0x4d8d69,_0x36bf47){create(_0x4d8d69)['catch'](loggerCatch(_0x36bf47));};exports[_0x9ac7('0x15')]=function(_0xff0afe,_0x37c803){moveContact(_0xff0afe)[_0x9ac7('0xd')](loggerCatch(_0x37c803));};exports[_0x9ac7('0x16')]=function(_0x51bc3b,_0x2ebf8a,_0x2a8383){if(_0x2ebf8a){_0x51bc3b['UserId']=null;}if(_0x2a8383){_0x51bc3b[_0x9ac7('0x17')]=![];}return BPromise[_0x9ac7('0xb')]()['then'](cmHopper[_0x9ac7('0x16')](_0x51bc3b))[_0x9ac7('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9ac7('0x18')]=function(_0x2b06b7){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x2b06b7))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0x19')));};exports[_0x9ac7('0x1a')]=function(_0x3eeaf1){return BPromise[_0x9ac7('0xb')]()[_0x9ac7('0xf')](cmHopper[_0x9ac7('0x1a')]({'UserId':null},_0x3eeaf1,0x1))[_0x9ac7('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0x9ac7('0x1b')]=function(_0x35c637){return BPromise[_0x9ac7('0xb')]()[_0x9ac7('0xf')](cmHopper[_0x9ac7('0x1a')]({'active':![]},_0x35c637,0x1))[_0x9ac7('0xd')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x2b3441){var _0x2be6d9={};_0x2be6d9[_0x9ac7('0x1c')]=_0x2b3441['type'];_0x2be6d9['uniqueid']=_0x2b3441[_0x9ac7('0x1d')];_0x2be6d9['calleridnum']=_0x2b3441[_0x9ac7('0x1e')];_0x2be6d9[_0x9ac7('0x1f')]=_0x2b3441['calleridname'];_0x2be6d9[_0x9ac7('0x20')]=_0x2b3441[_0x9ac7('0x20')];_0x2be6d9[_0x9ac7('0x21')]=_0x2b3441[_0x9ac7('0x22')];_0x2be6d9[_0x9ac7('0x23')]=_0x2b3441['answertime'];_0x2be6d9[_0x9ac7('0x24')]=0x1;_0x2be6d9['queuecallercompleteAt']=_0x2b3441[_0x9ac7('0x25')];_0x2be6d9['connectedlinename']=_0x2b3441[_0x9ac7('0x26')];_0x2be6d9[_0x9ac7('0x27')]=_0x9ac7('0x28');_0x2be6d9[_0x9ac7('0x29')]='xcally-motion-preview';_0x2be6d9[_0x9ac7('0x2a')]=0x0;_0x2be6d9['assigned']=0x1;_0x2be6d9[_0x9ac7('0x2b')]=_0x2b3441[_0x9ac7('0x26')];_0x2be6d9[_0x9ac7('0x2c')]=_0x9ac7('0x2d');return BPromise[_0x9ac7('0xb')]()[_0x9ac7('0xf')](voiceQueueReport[_0x9ac7('0x2e')](_0x2be6d9))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0x2f')));};exports[_0x9ac7('0x30')]=function(_0x2b3ccd,_0x2749ce){return BPromise[_0x9ac7('0xb')]()['then'](cmHopper['getContactRecallMe'](_0x2b3ccd,_0x2749ce))[_0x9ac7('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x9ac7('0x31')]=function(_0x1994c8){return BPromise[_0x9ac7('0xb')]()[_0x9ac7('0xf')](cmHopper['rescheduleContact'](_0x1994c8,!![],!![]))[_0x9ac7('0xd')](loggerCatch(_0x9ac7('0x32')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 014d274..beff18a 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 _0x9519=['rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','YYYY-MM-DD\x20HH:mm:ss','state','endtime','logAgent','responsetime','ringtime','membername','UserId','logCustomer','statedesc','starttime','talktime','answertime','RECALL','BOOKED','uniqueid','originate','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','interface','channelAgent','motionChannel','mandatoryDisposition','buildAcw','queue','agentReadyId','status','push','getDiff','createBody','filterKey','idContact','type','active','scheduledat','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x4634bd,_0x14daa3){var _0x4a17df=function(_0x27c210){while(--_0x27c210){_0x4634bd['push'](_0x4634bd['shift']());}};_0x4a17df(++_0x14daa3);}(_0x9519,0x9d));var _0x9951=function(_0x38ec8c,_0x5e4b2e){_0x38ec8c=_0x38ec8c-0x0;var _0x120927=_0x9519[_0x38ec8c];return _0x120927;};'use strict';var util=require('util');var _=require(_0x9951('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x9951('0x1'));var ipAgi=process[_0x9951('0x2')][_0x9951('0x3')]||'127.0.0.1';function getSeconds(_0x5f172d,_0x279cd2){var _0x4dc527=moment(_0x5f172d)[_0x9951('0x4')](0x0);var _0x579771=moment(_0x279cd2)[_0x9951('0x4')](0x0);return _0x4dc527['diff'](_0x579771,_0x9951('0x5'));}exports[_0x9951('0x6')]=function(_0x5660d8){return function(_0x27775d){logger['error'](_0x5660d8,util[_0x9951('0x7')](_0x27775d,{'showHidden':![],'depth':null}));};};exports[_0x9951('0x8')]=function(_0x20537b,_0xe2744e){logger[_0x9951('0x9')](_0x20537b,util[_0x9951('0x7')](_0xe2744e,{'showHidden':![],'depth':null}));};exports[_0x9951('0xa')]=function(_0x461fea,_0xec0d5a){logger[_0x9951('0xb')](_0x461fea,util[_0x9951('0x7')](_0xec0d5a,{'showHidden':![],'depth':null}));};exports[_0x9951('0xc')]=function(_0x5b7e13){return function(_0x41ff62){logger[_0x9951('0x9')](_0x5b7e13,util[_0x9951('0x7')](_0x41ff62,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2600fc,_0x3e0894,_0x5e6c83){return{'message':_0x2600fc,'unlock':_0x3e0894,'active':_0x5e6c83};};exports[_0x9951('0xd')]=function(_0x348528,_0x9a46a0,_0x2e4d8a){if(!_[_0x9951('0xe')](_0x2e4d8a)&&_0x9951('0xf')===typeof _0x2e4d8a&&!_[_0x9951('0x10')](_0x2e4d8a)){if(!_[_0x9951('0xe')](_0x9a46a0)&&_0x9951('0xf')===typeof _0x9a46a0&&!_['isEmpty'](_0x9a46a0)){return util[_0x9951('0x11')](_0x9951('0x12'),_0x9a46a0,_0x2e4d8a);}return util[_0x9951('0x11')](_0x9951('0x12'),_0x2e4d8a,_0x2e4d8a);}if(!_[_0x9951('0xe')](_0x348528)&&'string'===typeof _0x348528&&!_[_0x9951('0x10')](_0x348528)){return _0x348528;}return _0x9951('0x13');};exports[_0x9951('0x14')]=function(_0x45898c){if(_[_0x9951('0x15')](_0x45898c)){return![];}return _0x45898c;};exports['addVariables']=function(_0x2729ce,_0xc194a9,_0x547fcc,_0x4149a9,_0x36b63a,_0x43f865){var _0x36ddee={'XMD-QUEUE':_0xc194a9[_0x9951('0x16')]?_0xc194a9['Queue']['name']:'','XMD-CALLERID':_0x4149a9,'XMD-CALLERID-PREVIEW':_0x43f865?util[_0x9951('0x11')]('\x22%s\x22\x20<%s>',_0x43f865[_0x9951('0x17')],_0x43f865['calleridnum']):_0x4149a9,'XMD-DIALID':_0x36b63a,'XMD-CONTACTID':_0xc194a9[_0x9951('0x18')],'XMD-CDRTYPE':_0x9951('0x19'),'CALLERID(all)':_0x4149a9,'XMD-VOICEQUEUEID':_0xc194a9[_0x9951('0x1a')],'XMD-DIALCHANNEL':_0x547fcc,'XMD-DIALTIMEOUT':_0x2729ce[_0x9951('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x9951('0x11')](_0x9951('0x1c'),_0x2729ce['dialQueueProject2']?'g':'',_[_0x9951('0x10')](_0x2729ce['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2729ce[_0x9951('0x1d')]||'','XMD-AGI':_0x2729ce[_0x9951('0x1e')]?util[_0x9951('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2729ce[_0x9951('0x1e')]):_0x9951('0x1f'),'XMD-AGIAFTER':_0x2729ce[_0x9951('0x20')]?util[_0x9951('0x11')](_0x9951('0x21'),ipAgi,_0x2729ce['dialQueueProject2']):_0x9951('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x43f865?_0x43f865['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x43f865?_0x43f865[_0x9951('0x22')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9951('0x23')};if(!_[_0x9951('0x10')](_0x2729ce['monitor_format'])){_0x36ddee[util[_0x9951('0x11')]('%s',_0x9951('0x24'))]=_0x2729ce[_0x9951('0x25')];_0x36ddee[util[_0x9951('0x11')]('%s',_0x9951('0x26'))]=_0x36b63a;}if(_0xc194a9&&_0xc194a9['Contact']){for(var _0x55b1fa in _0xc194a9['Contact']){if(_0xc194a9['Contact'][_0x9951('0x27')](_0x55b1fa)){if(!_[_0x9951('0x15')](_0xc194a9['Contact'][_0x55b1fa])&&_0x55b1fa!=='id'&&_0x55b1fa!==_0x9951('0x28')&&_0x55b1fa!==_0x9951('0x29')&&_0x55b1fa!==_0x9951('0x2a')){_0x36ddee[util[_0x9951('0x11')](_0x9951('0x2b'),'XMD-',_[_0x9951('0x2c')](_0x55b1fa))]=_0xc194a9['Contact'][_0x55b1fa];}}}}return _0x36ddee;};exports[_0x9951('0x2d')]=function(_0x44de9d){var _0x5179b3={};for(var _0x38d211 in _0x44de9d){if(_0x44de9d[_0x9951('0x27')](_0x38d211)){_0x5179b3[util[_0x9951('0x11')]('%s',_[_0x9951('0x2e')](_0x38d211))]=_0x44de9d[_0x38d211];}}return{'variables':_0x5179b3};};exports[_0x9951('0x2f')]=function(_0x1c4cd0,_0x2a9eba){if(!_[_0x9951('0x15')](_0x1c4cd0)){if(_0x1c4cd0['hasOwnProperty'](_0x9951('0x30'))){if(_0x1c4cd0[_0x9951('0x30')]>0x0){_0x1c4cd0[_0x9951('0x30')]-=0x1;}else{logger[_0x9951('0xb')](_0x9951('0x31'),_0x2a9eba);}}}else{logger[_0x9951('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2a9eba);}};exports['logBlacklist']=function(_0x425ef2){var _0x2569d5=moment()[_0x9951('0x11')](_0x9951('0x32'));_0x425ef2[_0x9951('0x33')]=0xd;_0x425ef2['statedesc']='Blacklist';_0x425ef2['starttime']=_0x2569d5;_0x425ef2['responsetime']=_0x2569d5;_0x425ef2[_0x9951('0x34')]=_0x2569d5;};exports[_0x9951('0x35')]=function(_0x2ab8b3,_0x34ecae,_0x41cc04){var _0x1c217e=moment()['format'](_0x9951('0x32'));_0x2ab8b3['state']=_0x34ecae;_0x2ab8b3['statedesc']=_0x41cc04;_0x2ab8b3[_0x9951('0x36')]=_0x1c217e;_0x2ab8b3[_0x9951('0x37')]=getSeconds(_0x2ab8b3[_0x9951('0x36')],_0x2ab8b3['starttime']);};exports['logLookAgent']=function(_0x5d889e,_0x2feb6c,_0x252e16){_0x5d889e[_0x9951('0x38')]=_0x2feb6c;_0x5d889e[_0x9951('0x39')]=_0x252e16;};exports[_0x9951('0x3a')]=function(_0x374cd5,_0x2ded2b,_0x581081){var _0x53872e=moment()[_0x9951('0x11')](_0x9951('0x32'));_0x374cd5[_0x9951('0x33')]=_0x2ded2b;_0x374cd5[_0x9951('0x3b')]=_0x581081;_0x374cd5[_0x9951('0x36')]=_0x374cd5[_0x9951('0x36')]?_0x374cd5[_0x9951('0x36')]:_0x53872e;_0x374cd5[_0x9951('0x34')]=_0x374cd5[_0x9951('0x34')]?_0x374cd5[_0x9951('0x34')]:_0x53872e;_0x374cd5['ringtime']=getSeconds(_0x374cd5[_0x9951('0x36')]||0x0,_0x374cd5[_0x9951('0x3c')]||0x0);_0x374cd5[_0x9951('0x3d')]=_0x374cd5['answertime']?getSeconds(_0x374cd5[_0x9951('0x34')],_0x374cd5[_0x9951('0x3e')]):0x0;};exports['isFailure']=function(_0x7b432d){return _0x7b432d==='Failure';};exports['variablesAction']=function(_0x316c03,_0x1fc89c,_0x594c6e,_0x46fdbf,_0x1c4e3f){var _0x26e4e8=_0x46fdbf?_0x9951('0x3f'):_0x316c03[_0x9951('0x17')];_0x26e4e8=_0x1c4e3f?_0x9951('0x40'):_0x26e4e8;return{'actionid':_0x316c03[_0x9951('0x41')],'action':_0x9951('0x42'),'channel':_0x316c03['channelAgent'],'callerid':util[_0x9951('0x11')]('\x22%s\x22\x20<%s>',_0x26e4e8,_0x316c03[_0x9951('0x43')]),'Exten':_0x9951('0x44'),'Context':_0x9951('0x45'),'Priority':'1','variable':_0x594c6e,'timeout':(_0x1fc89c[_0x9951('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x316c03[_0x9951('0x41')]};};exports[_0x9951('0x47')]=function(_0x560a23){return _0x560a23[_0x9951('0x48')]+_0x560a23[_0x9951('0x49')]+_0x560a23['countnoanswerretry']+_0x560a23['countagentrejectretry']+_0x560a23[_0x9951('0x4a')];};exports[_0x9951('0x4b')]=function(_0x5b1e31){var _0x4b09e1=_[_0x9951('0x4c')](_0x5b1e31);_0x4b09e1['state']=0xf;_0x4b09e1[_0x9951('0x3b')]=_0x9951('0x4d');return _0x4b09e1;};exports[_0x9951('0x4e')]=function(_0x2c1098,_0x59854f,_0x58bc4f){var _0x56b441={};_0x56b441[_0x59854f]=_0x2c1098[_0x59854f];_0x56b441['active']=![];_0x56b441['scheduledat']=moment()['add'](_0x58bc4f,'minutes')['format'](_0x9951('0x32'));_0x56b441['ContactId']=_0x2c1098[_0x9951('0x18')];_0x56b441[_0x9951('0x4f')]=_0x2c1098[_0x9951('0x4f')];_0x56b441[_0x9951('0x1a')]=_0x2c1098[_0x9951('0x1a')]||undefined;return _0x56b441;};exports['decrementTalkink']=function(_0x111d98,_0x35373c){if(!_[_0x9951('0x15')](_0x111d98)){if(_0x111d98[_0x9951('0x50')]>0x0){_0x111d98[_0x9951('0x50')]-=0x1;}else{logger[_0x9951('0xb')](_0x35373c,_0x9951('0x51'));}}else{logger['error'](_0x35373c,_0x9951('0x52'));}};exports[_0x9951('0x53')]=function(_0x522feb){if(_0x522feb<=0x0){return!![];}return![];};function buildObj(_0x35ec94,_0x37e3c4,_0x3996f3){_0x35ec94[_0x9951('0x54')]=_0x37e3c4;_0x35ec94[_0x9951('0x55')]=_0x35ec94['queue'];_0x35ec94[_0x9951('0x56')]=_0x35ec94[_0x9951('0x57')];_0x35ec94[_0x9951('0x58')]='voice';if(_0x3996f3){_0x35ec94[_0x9951('0x59')]=_0x3996f3[_0x9951('0x59')];}return _0x35ec94;}exports['buildObj']=buildObj;exports[_0x9951('0x5a')]=function(_0x372ca6){var _0xc1bab={};_0xc1bab[_0x9951('0x5b')]=_0x372ca6[_0x9951('0x5b')];_0xc1bab[_0x9951('0x56')]=_0x372ca6[_0x9951('0x57')];_0xc1bab['uniqueid']=_0x372ca6['uniqueid'];return _0xc1bab;};exports[_0x9951('0x5c')]=function(_0x3294aa){var _0x56ace2=[];for(var _0x1bd951 in _0x3294aa){if(_0x3294aa['hasOwnProperty'](_0x1bd951)){if(!_['isNil'](_0x3294aa[_0x1bd951])&&_0x3294aa[_0x1bd951]['state']==='not_inuse'&&_0x3294aa[_0x1bd951][_0x9951('0x5d')]==='reachable'){_0x56ace2[_0x9951('0x5e')](_0x3294aa[_0x1bd951]['id']);}}}return _0x56ace2;};exports[_0x9951('0x5f')]=function(_0x169e65){var _0x2c79b2=moment()[_0x9951('0x4')](0x0);var _0x1e707b=moment(_0x169e65)[_0x9951('0x4')](0x0);return _0x2c79b2['diff'](_0x1e707b,_0x9951('0x5'));};exports[_0x9951('0x60')]=function(_0x5c58c6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c58c6[_0x9951('0x18')],'ListId':_0x5c58c6['ListId'],'VoiceQueueId':_0x5c58c6[_0x9951('0x1a')]||undefined,'CampaignId':_0x5c58c6['CampaignId']||undefined};};exports[_0x9951('0x61')]=function(_0xa2c55d){if(_0xa2c55d===_0x9951('0x41')||_0xa2c55d===_0x9951('0x62')||_0xa2c55d===_0x9951('0x5b')||_0xa2c55d===_0x9951('0x63')||_0xa2c55d==='campaigntype'||_0xa2c55d==='dialAnswer'||_0xa2c55d==='membername'||_0xa2c55d==='channelAgent'||_0xa2c55d===_0x9951('0x17')||_0xa2c55d===_0x9951('0x64')||_0xa2c55d===_0x9951('0x43')||_0xa2c55d===_0x9951('0x65')||_0xa2c55d==='countbusyretry'||_0xa2c55d===_0x9951('0x49')||_0xa2c55d==='countnoanswerretry'||_0xa2c55d==='countglobal'||_0xa2c55d===_0x9951('0x66')||_0xa2c55d===_0x9951('0x67')||_0xa2c55d==='callbackat'||_0xa2c55d===_0x9951('0x68')||_0xa2c55d==='ContactId'||_0xa2c55d===_0x9951('0x4f')||_0xa2c55d===_0x9951('0x39')||_0xa2c55d===_0x9951('0x1a')||_0xa2c55d==='sipcallid'||_0xa2c55d===_0x9951('0x69')||_0xa2c55d===_0x9951('0x6a')||_0xa2c55d===_0x9951('0x6b')||_0xa2c55d===_0x9951('0x6c')||_0xa2c55d===_0x9951('0x6d')||_0xa2c55d===_0x9951('0x6e')||_0xa2c55d===_0x9951('0x6f')||_0xa2c55d===_0x9951('0x70')||_0xa2c55d==='xmd-dialchannel'||_0xa2c55d===_0x9951('0x71')||_0xa2c55d==='xmd-cdrtype'||_0xa2c55d===_0x9951('0x72')||_0xa2c55d==='xmd-agiafter'||_0xa2c55d===_0x9951('0x73')||_0xa2c55d===_0x9951('0x74')||_0xa2c55d===_0x9951('0x75')||_0xa2c55d===_0x9951('0x76')||_0xa2c55d===_0x9951('0x77')||_0xa2c55d===_0x9951('0x78')||_0xa2c55d==='rtpaudioqoslossbridged'||_0xa2c55d==='rtpaudioqosrtt'||_0xa2c55d==='rtpaudioqosrttbridged'||_0xa2c55d===_0x9951('0x74')||_0xa2c55d===_0x9951('0x75')||_0xa2c55d===_0x9951('0x76')||_0xa2c55d===_0x9951('0x77')||_0xa2c55d==='rtpaudioqosloss'||_0xa2c55d===_0x9951('0x79')||_0xa2c55d===_0x9951('0x7a')||_0xa2c55d===_0x9951('0x7b')||_0xa2c55d===_0x9951('0x7c')||_0xa2c55d===_0x9951('0x7d')||_0xa2c55d===_0x9951('0x33')||_0xa2c55d===_0x9951('0x3b')){return![];}return!![];};exports[_0x9951('0x7e')]=function(_0x126fad,_0x5822f3){var _0x3555b8,_0x36dea8,_0x1f1917;if(_0x5822f3<=0x0){_0x5822f3=0x1;}_0x3555b8=new RegExp('\x5cw{0,'+_0x5822f3+'}$');_0x36dea8=Math[_0x9951('0x7f')](0xa,_0x5822f3-0x1);_0x1f1917=Math[_0x9951('0x7f')](0xa,_0x5822f3)-0x1;return util[_0x9951('0x11')]('%s',_[_0x9951('0x80')](_0x126fad,_0x3555b8,_['random'](_0x36dea8,_0x1f1917)));};exports[_0x9951('0x81')]=function(_0x100b51){var _0x16dd8c=_0x100b51[_0x9951('0x82')](/"(.*?)"/);return _0x16dd8c?_0x16dd8c[0x1]:_0x100b51;};exports[_0x9951('0x83')]=function(_0x397dd7){var _0x531597=_0x397dd7[_0x9951('0x82')](/<(.*?)>/);return _0x531597?_0x531597[0x1]:_0x397dd7;};function buildNoAnswerEventPayload(_0x34d08c,_0x508e74){var _0x30cb65=buildObj(_0x34d08c,_0x9951('0x84'));if(!_[_0x9951('0x10')](_0x508e74[_0x9951('0x85')])){Object[_0x9951('0x86')](_0x508e74[_0x9951('0x85')])[_0x9951('0x87')](function(_0x31d842){_0x30cb65[_0x31d842[_0x9951('0x88')]()]=_0x508e74['variables'][_0x31d842];});}return _0x30cb65;}exports[_0x9951('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xbadf=['rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','match','extractCalleridNumber','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','format','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','not_inuse','reachable','push','diff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','scheduledat','countbusyretry','countglobal','callback','callbackuniqueid','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos'];(function(_0x176ebd,_0x25fcab){var _0x3e37fb=function(_0x4c3039){while(--_0x4c3039){_0x176ebd['push'](_0x176ebd['shift']());}};_0x3e37fb(++_0x25fcab);}(_0xbadf,0xa9));var _0xfbad=function(_0x22074d,_0x33df85){_0x22074d=_0x22074d-0x0;var _0x3a24ce=_0xbadf[_0x22074d];return _0x3a24ce;};'use strict';var util=require('util');var _=require(_0xfbad('0x0'));var moment=require(_0xfbad('0x1'));var logger=require(_0xfbad('0x2'))(_0xfbad('0x3'));var ipAgi=process['env'][_0xfbad('0x4')]||_0xfbad('0x5');function getSeconds(_0x38485f,_0x147422){var _0x11e391=moment(_0x38485f)[_0xfbad('0x6')](0x0);var _0x592ea8=moment(_0x147422)[_0xfbad('0x6')](0x0);return _0x11e391['diff'](_0x592ea8,_0xfbad('0x7'));}exports[_0xfbad('0x8')]=function(_0x3a3a3e){return function(_0x468434){logger['error'](_0x3a3a3e,util[_0xfbad('0x9')](_0x468434,{'showHidden':![],'depth':null}));};};exports[_0xfbad('0xa')]=function(_0x1ecbdc,_0x5bbec2){logger[_0xfbad('0xb')](_0x1ecbdc,util[_0xfbad('0x9')](_0x5bbec2,{'showHidden':![],'depth':null}));};exports[_0xfbad('0xc')]=function(_0x52eefc,_0x5e4077){logger[_0xfbad('0xd')](_0x52eefc,util['inspect'](_0x5e4077,{'showHidden':![],'depth':null}));};exports[_0xfbad('0xe')]=function(_0x4186c4){return function(_0x1a8c3b){logger['info'](_0x4186c4,util['inspect'](_0x1a8c3b,{'showHidden':![],'depth':null}));};};exports[_0xfbad('0xf')]=function(_0x13c998,_0x33c428,_0x4ef9fd){return{'message':_0x13c998,'unlock':_0x33c428,'active':_0x4ef9fd};};exports['getCallerId']=function(_0x1a931c,_0xc1e62a,_0x1390ad){if(!_['isUndefined'](_0x1390ad)&&_0xfbad('0x10')===typeof _0x1390ad&&!_[_0xfbad('0x11')](_0x1390ad)){if(!_[_0xfbad('0x12')](_0xc1e62a)&&_0xfbad('0x10')===typeof _0xc1e62a&&!_[_0xfbad('0x11')](_0xc1e62a)){return util['format'](_0xfbad('0x13'),_0xc1e62a,_0x1390ad);}return util[_0xfbad('0x14')](_0xfbad('0x13'),_0x1390ad,_0x1390ad);}if(!_[_0xfbad('0x12')](_0x1a931c)&&'string'===typeof _0x1a931c&&!_[_0xfbad('0x11')](_0x1a931c)){return _0x1a931c;}return'\x22\x22\x20<>';};exports[_0xfbad('0x15')]=function(_0x741780){if(_[_0xfbad('0x16')](_0x741780)){return![];}return _0x741780;};exports[_0xfbad('0x17')]=function(_0x1d7a95,_0x137155,_0xc13b0a,_0x1666a5,_0xbe9324,_0x48ff0a){var _0x2c7202={'XMD-QUEUE':_0x137155[_0xfbad('0x18')]?_0x137155[_0xfbad('0x18')][_0xfbad('0x19')]:'','XMD-CALLERID':_0x1666a5,'XMD-CALLERID-PREVIEW':_0x48ff0a?util[_0xfbad('0x14')]('\x22%s\x22\x20<%s>',_0x48ff0a[_0xfbad('0x1a')],_0x48ff0a[_0xfbad('0x1b')]):_0x1666a5,'XMD-DIALID':_0xbe9324,'XMD-CONTACTID':_0x137155[_0xfbad('0x1c')],'XMD-CDRTYPE':_0xfbad('0x1d'),'CALLERID(all)':_0x1666a5,'XMD-VOICEQUEUEID':_0x137155[_0xfbad('0x1e')],'XMD-DIALCHANNEL':_0xc13b0a,'XMD-DIALTIMEOUT':_0x1d7a95[_0xfbad('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xfbad('0x20'),_0x1d7a95[_0xfbad('0x21')]?'g':'',_[_0xfbad('0x11')](_0x1d7a95[_0xfbad('0x22')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x1d7a95[_0xfbad('0x23')]||'','XMD-AGI':_0x1d7a95[_0xfbad('0x24')]?util[_0xfbad('0x14')](_0xfbad('0x25'),ipAgi,_0x1d7a95[_0xfbad('0x24')]):_0xfbad('0x26'),'XMD-AGIAFTER':_0x1d7a95['dialQueueProject2']?util['format'](_0xfbad('0x25'),ipAgi,_0x1d7a95['dialQueueProject2']):_0xfbad('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x48ff0a?_0x48ff0a[_0xfbad('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x48ff0a?_0x48ff0a[_0xfbad('0x28')]:'','XMD-DESTINATION':_0xfbad('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xfbad('0x11')](_0x1d7a95[_0xfbad('0x22')])){_0x2c7202[util[_0xfbad('0x14')]('%s',_0xfbad('0x2a'))]=_0x1d7a95[_0xfbad('0x22')];_0x2c7202[util[_0xfbad('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0xbe9324;}if(_0x137155&&_0x137155[_0xfbad('0x2b')]){for(var _0x1b8dac in _0x137155[_0xfbad('0x2b')]){if(_0x137155['Contact']['hasOwnProperty'](_0x1b8dac)){if(!_[_0xfbad('0x16')](_0x137155[_0xfbad('0x2b')][_0x1b8dac])&&_0x1b8dac!=='id'&&_0x1b8dac!==_0xfbad('0x2c')&&_0x1b8dac!==_0xfbad('0x2d')&&_0x1b8dac!==_0xfbad('0x2e')){_0x2c7202[util[_0xfbad('0x14')](_0xfbad('0x2f'),_0xfbad('0x30'),_[_0xfbad('0x31')](_0x1b8dac))]=_0x137155['Contact'][_0x1b8dac];}}}}return _0x2c7202;};exports['toLowerVariables']=function(_0x2c04fc){var _0x4fb66b={};for(var _0x42351f in _0x2c04fc){if(_0x2c04fc[_0xfbad('0x32')](_0x42351f)){_0x4fb66b[util[_0xfbad('0x14')]('%s',_['toLower'](_0x42351f))]=_0x2c04fc[_0x42351f];}}return{'variables':_0x4fb66b};};exports['updateOriginated']=function(_0x283a2e,_0x44ea60){if(!_[_0xfbad('0x16')](_0x283a2e)){if(_0x283a2e[_0xfbad('0x32')](_0xfbad('0x33'))){if(_0x283a2e['originated']>0x0){_0x283a2e[_0xfbad('0x33')]-=0x1;}else{logger['error'](_0xfbad('0x34'),_0x44ea60);}}}else{logger[_0xfbad('0xd')](_0xfbad('0x35'),_0x44ea60);}};exports[_0xfbad('0x36')]=function(_0x1bd4e2){var _0x7d42a4=moment()[_0xfbad('0x14')](_0xfbad('0x37'));_0x1bd4e2[_0xfbad('0x38')]=0xd;_0x1bd4e2['statedesc']='Blacklist';_0x1bd4e2[_0xfbad('0x39')]=_0x7d42a4;_0x1bd4e2[_0xfbad('0x3a')]=_0x7d42a4;_0x1bd4e2[_0xfbad('0x3b')]=_0x7d42a4;};exports[_0xfbad('0x3c')]=function(_0x140a52,_0x398b6c,_0x4d0bba){var _0xdf8787=moment()[_0xfbad('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x140a52[_0xfbad('0x38')]=_0x398b6c;_0x140a52[_0xfbad('0x3d')]=_0x4d0bba;_0x140a52[_0xfbad('0x3a')]=_0xdf8787;_0x140a52[_0xfbad('0x3e')]=getSeconds(_0x140a52[_0xfbad('0x3a')],_0x140a52[_0xfbad('0x39')]);};exports[_0xfbad('0x3f')]=function(_0x350014,_0x564965,_0x2f1770){_0x350014[_0xfbad('0x40')]=_0x564965;_0x350014[_0xfbad('0x41')]=_0x2f1770;};exports[_0xfbad('0x42')]=function(_0x248117,_0x58089f,_0x30e13f){var _0x260875=moment()[_0xfbad('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x248117[_0xfbad('0x38')]=_0x58089f;_0x248117[_0xfbad('0x3d')]=_0x30e13f;_0x248117[_0xfbad('0x3a')]=_0x248117[_0xfbad('0x3a')]?_0x248117[_0xfbad('0x3a')]:_0x260875;_0x248117[_0xfbad('0x3b')]=_0x248117['endtime']?_0x248117[_0xfbad('0x3b')]:_0x260875;_0x248117['ringtime']=getSeconds(_0x248117[_0xfbad('0x3a')]||0x0,_0x248117[_0xfbad('0x39')]||0x0);_0x248117['talktime']=_0x248117[_0xfbad('0x43')]?getSeconds(_0x248117[_0xfbad('0x3b')],_0x248117[_0xfbad('0x43')]):0x0;};exports[_0xfbad('0x44')]=function(_0x3a7630){return _0x3a7630===_0xfbad('0x45');};exports[_0xfbad('0x46')]=function(_0x4e8be2,_0x5b0a88,_0x2d8172,_0x1b3feb,_0x2d1033){var _0x32c593=_0x1b3feb?_0xfbad('0x47'):_0x4e8be2[_0xfbad('0x1a')];_0x32c593=_0x2d1033?_0xfbad('0x48'):_0x32c593;return{'actionid':_0x4e8be2[_0xfbad('0x49')],'action':_0xfbad('0x4a'),'channel':_0x4e8be2[_0xfbad('0x4b')],'callerid':util[_0xfbad('0x14')](_0xfbad('0x13'),_0x32c593,_0x4e8be2['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x2d8172,'timeout':(_0x5b0a88[_0xfbad('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e8be2[_0xfbad('0x49')]};};exports['totalGlobal']=function(_0x2d6ece){return _0x2d6ece['countbusyretry']+_0x2d6ece['countcongestionretry']+_0x2d6ece[_0xfbad('0x4d')]+_0x2d6ece[_0xfbad('0x4e')]+_0x2d6ece[_0xfbad('0x4f')];};exports[_0xfbad('0x50')]=function(_0x2c3ee8){var _0x2526ad=_[_0xfbad('0x51')](_0x2c3ee8);_0x2526ad[_0xfbad('0x38')]=0xf;_0x2526ad[_0xfbad('0x3d')]=_0xfbad('0x52');return _0x2526ad;};exports[_0xfbad('0x53')]=function(_0x2139d8,_0x13981f,_0x32b487){var _0xd87be0={};_0xd87be0[_0x13981f]=_0x2139d8[_0x13981f];_0xd87be0[_0xfbad('0x54')]=![];_0xd87be0['scheduledat']=moment()[_0xfbad('0x55')](_0x32b487,'minutes')[_0xfbad('0x14')](_0xfbad('0x37'));_0xd87be0['ContactId']=_0x2139d8[_0xfbad('0x1c')];_0xd87be0[_0xfbad('0x56')]=_0x2139d8[_0xfbad('0x56')];_0xd87be0[_0xfbad('0x1e')]=_0x2139d8[_0xfbad('0x1e')]||undefined;return _0xd87be0;};exports[_0xfbad('0x57')]=function(_0x1ff4ea,_0x51bca1){if(!_[_0xfbad('0x16')](_0x1ff4ea)){if(_0x1ff4ea[_0xfbad('0x58')]>0x0){_0x1ff4ea[_0xfbad('0x58')]-=0x1;}else{logger[_0xfbad('0xd')](_0x51bca1,_0xfbad('0x59'));}}else{logger[_0xfbad('0xd')](_0x51bca1,_0xfbad('0x5a'));}};exports[_0xfbad('0x5b')]=function(_0x4db7a6){if(_0x4db7a6<=0x0){return!![];}return![];};function buildObj(_0x4d7a8f,_0x23beb9,_0x1ea5fe){_0x4d7a8f[_0xfbad('0x5c')]=_0x23beb9;_0x4d7a8f[_0xfbad('0x19')]=_0x4d7a8f[_0xfbad('0x5d')];_0x4d7a8f[_0xfbad('0x5e')]=_0x4d7a8f[_0xfbad('0x4b')];_0x4d7a8f[_0xfbad('0x5f')]=_0xfbad('0x60');if(_0x1ea5fe){_0x4d7a8f[_0xfbad('0x61')]=_0x1ea5fe[_0xfbad('0x61')];}return _0x4d7a8f;}exports[_0xfbad('0x62')]=buildObj;exports[_0xfbad('0x63')]=function(_0x175060){var _0x9caaec={};_0x9caaec[_0xfbad('0x5d')]=_0x175060[_0xfbad('0x5d')];_0x9caaec['interface']=_0x175060[_0xfbad('0x4b')];_0x9caaec[_0xfbad('0x49')]=_0x175060[_0xfbad('0x49')];return _0x9caaec;};exports['agentReadyId']=function(_0x1ae4c9){var _0x582857=[];for(var _0x1f9604 in _0x1ae4c9){if(_0x1ae4c9[_0xfbad('0x32')](_0x1f9604)){if(!_[_0xfbad('0x16')](_0x1ae4c9[_0x1f9604])&&_0x1ae4c9[_0x1f9604][_0xfbad('0x38')]===_0xfbad('0x64')&&_0x1ae4c9[_0x1f9604]['status']===_0xfbad('0x65')){_0x582857[_0xfbad('0x66')](_0x1ae4c9[_0x1f9604]['id']);}}}return _0x582857;};exports['getDiff']=function(_0x54ddcb){var _0x2f2e6e=moment()[_0xfbad('0x6')](0x0);var _0x57770e=moment(_0x54ddcb)[_0xfbad('0x6')](0x0);return _0x2f2e6e[_0xfbad('0x67')](_0x57770e,_0xfbad('0x7'));};exports[_0xfbad('0x68')]=function(_0x4dad1b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4dad1b['ContactId'],'ListId':_0x4dad1b[_0xfbad('0x56')],'VoiceQueueId':_0x4dad1b[_0xfbad('0x1e')]||undefined,'CampaignId':_0x4dad1b[_0xfbad('0x69')]||undefined};};exports[_0xfbad('0x6a')]=function(_0x3eac73){if(_0x3eac73===_0xfbad('0x49')||_0x3eac73===_0xfbad('0x6b')||_0x3eac73==='queue'||_0x3eac73==='type'||_0x3eac73===_0xfbad('0x6c')||_0x3eac73===_0xfbad('0x6d')||_0x3eac73===_0xfbad('0x40')||_0x3eac73===_0xfbad('0x4b')||_0x3eac73===_0xfbad('0x1a')||_0x3eac73==='active'||_0x3eac73===_0xfbad('0x1b')||_0x3eac73===_0xfbad('0x6e')||_0x3eac73===_0xfbad('0x6f')||_0x3eac73==='countcongestionretry'||_0x3eac73===_0xfbad('0x4d')||_0x3eac73===_0xfbad('0x70')||_0x3eac73===_0xfbad('0x71')||_0x3eac73===_0xfbad('0x72')||_0x3eac73==='callbackat'||_0x3eac73==='recallme'||_0x3eac73===_0xfbad('0x1c')||_0x3eac73===_0xfbad('0x56')||_0x3eac73===_0xfbad('0x41')||_0x3eac73===_0xfbad('0x1e')||_0x3eac73===_0xfbad('0x73')||_0x3eac73==='xmd-voicequeueid'||_0x3eac73===_0xfbad('0x74')||_0x3eac73==='xmd-phone'||_0x3eac73===_0xfbad('0x75')||_0x3eac73===_0xfbad('0x76')||_0x3eac73===_0xfbad('0x77')||_0x3eac73===_0xfbad('0x78')||_0x3eac73===_0xfbad('0x79')||_0x3eac73===_0xfbad('0x7a')||_0x3eac73===_0xfbad('0x7b')||_0x3eac73===_0xfbad('0x7c')||_0x3eac73===_0xfbad('0x7d')||_0x3eac73===_0xfbad('0x7e')||_0x3eac73===_0xfbad('0x7f')||_0x3eac73===_0xfbad('0x80')||_0x3eac73===_0xfbad('0x81')||_0x3eac73==='rtpaudioqosjitter'||_0x3eac73==='rtpaudioqosjitterbridged'||_0x3eac73===_0xfbad('0x82')||_0x3eac73===_0xfbad('0x83')||_0x3eac73==='rtpaudioqosrtt'||_0x3eac73===_0xfbad('0x84')||_0x3eac73===_0xfbad('0x80')||_0x3eac73==='rtpaudioqosbridged'||_0x3eac73===_0xfbad('0x85')||_0x3eac73===_0xfbad('0x86')||_0x3eac73==='rtpaudioqosloss'||_0x3eac73==='rtpaudioqoslossbridged'||_0x3eac73===_0xfbad('0x87')||_0x3eac73===_0xfbad('0x84')||_0x3eac73===_0xfbad('0x88')||_0x3eac73===_0xfbad('0x89')||_0x3eac73===_0xfbad('0x38')||_0x3eac73===_0xfbad('0x3d')){return![];}return!![];};exports[_0xfbad('0x8a')]=function(_0x1b9b50,_0x370202){var _0xba9293,_0x305a7d,_0xd05293;if(_0x370202<=0x0){_0x370202=0x1;}_0xba9293=new RegExp(_0xfbad('0x8b')+_0x370202+'}$');_0x305a7d=Math[_0xfbad('0x8c')](0xa,_0x370202-0x1);_0xd05293=Math[_0xfbad('0x8c')](0xa,_0x370202)-0x1;return util[_0xfbad('0x14')]('%s',_['replace'](_0x1b9b50,_0xba9293,_[_0xfbad('0x8d')](_0x305a7d,_0xd05293)));};exports['extractCalleridName']=function(_0x7d1c1e){var _0x2364c1=_0x7d1c1e[_0xfbad('0x8e')](/"(.*?)"/);return _0x2364c1?_0x2364c1[0x1]:_0x7d1c1e;};exports[_0xfbad('0x8f')]=function(_0x162f47){var _0x26e300=_0x162f47[_0xfbad('0x8e')](/<(.*?)>/);return _0x26e300?_0x26e300[0x1]:_0x162f47;};function buildNoAnswerEventPayload(_0x1fc16b,_0x31102e){var _0x3a3d2b=buildObj(_0x1fc16b,_0xfbad('0x90'));if(!_[_0xfbad('0x11')](_0x31102e[_0xfbad('0x91')])){Object['keys'](_0x31102e[_0xfbad('0x91')])[_0xfbad('0x92')](function(_0xe05f52){_0x3a3d2b[_0xe05f52[_0xfbad('0x93')]()]=_0x31102e['variables'][_0xe05f52];});}return _0x3a3d2b;}exports[_0xfbad('0x94')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d6133c7..7ba75ca 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 _0x2481=['string','number','boolean','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x2481,0x103));var _0x1248=function(_0x49f104,_0x129159){_0x49f104=_0x49f104-0x0;var _0x21ea5d=_0x2481[_0x49f104];return _0x21ea5d;};'use strict';exports[_0x1248('0x0')]={'queue':{'type':_0x1248('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x1248('0x2'),'required':![]},'paused':{'type':_0x1248('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':'string','required':!![]},'interface':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x1248('0x3')},'reason':{'type':_0x1248('0x1'),'required':![]}};exports[_0x1248('0x5')]={'module':{'type':_0x1248('0x1'),'required':![]}};exports[_0x1248('0x6')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x7')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x1248('0x1')},'mixmonitorid':{'type':_0x1248('0x1')}};exports[_0x1248('0x8')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]}};exports[_0x1248('0x9')]={'uniqueid':{'type':_0x1248('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xd782=['number','queuepause','boolean','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x4e6e4a,_0x3d8293){var _0x48e505=function(_0x34f8ba){while(--_0x34f8ba){_0x4e6e4a['push'](_0x4e6e4a['shift']());}};_0x48e505(++_0x3d8293);}(_0xd782,0xf1));var _0x2d78=function(_0x278516,_0x222985){_0x278516=_0x278516-0x0;var _0x3bd9a0=_0xd782[_0x278516];return _0x3bd9a0;};'use strict';exports[_0x2d78('0x0')]={'queue':{'type':_0x2d78('0x1'),'required':!![]},'interface':{'type':_0x2d78('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x2d78('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x2d78('0x1'),'required':!![]},'interface':{'type':_0x2d78('0x1'),'required':!![]}};exports[_0x2d78('0x3')]={'interface':{'type':_0x2d78('0x1'),'required':!![]},'paused':{'type':_0x2d78('0x4')},'reason':{'type':'string','required':![]}};exports[_0x2d78('0x5')]={'module':{'type':_0x2d78('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x2d78('0x1'),'required':!![]}};exports[_0x2d78('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':_0x2d78('0x1')}};exports[_0x2d78('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2d78('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x2d78('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 63355a7..852fde6 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 _0x9aac=['agents','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','name','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','mergeFromDatabase','telephones','initTrunks','trunks','initVoiceQueues','initTriggers','triggers','initZendeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','util','moment','../model/agent','../model/trunk','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount'];(function(_0x506fa6,_0x453d83){var _0x40eb00=function(_0x1e240a){while(--_0x1e240a){_0x506fa6['push'](_0x506fa6['shift']());}};_0x40eb00(++_0x453d83);}(_0x9aac,0x135));var _0xc9aa=function(_0x6b61de,_0x156fe0){_0x6b61de=_0x6b61de-0x0;var _0x468a10=_0x9aac[_0x6b61de];return _0x468a10;};'use strict';var util=require(_0xc9aa('0x0'));var _=require('lodash');var moment=require(_0xc9aa('0x1'));var Agent=require(_0xc9aa('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0xc9aa('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xc9aa('0x4'));var Template=require('../model/template');var Campaign=require(_0xc9aa('0x5'));var VoiceExtension=require(_0xc9aa('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xc9aa('0x7'));var FreshdeskAccount=require(_0xc9aa('0x8'));var SugarcrmAccount=require(_0xc9aa('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc9aa('0xa'));var VtigerAccount=require(_0xc9aa('0xb'));var ServicenowAccount=require(_0xc9aa('0xc'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xc9aa('0xd'));var FaxAccount=require(_0xc9aa('0xe'));var Realtime=function(){this[_0xc9aa('0xf')]={};this['telephones']={};this['trunks']={};this[_0xc9aa('0x10')]={};this['triggers']={};this[_0xc9aa('0x11')]={};this[_0xc9aa('0x12')]={};this[_0xc9aa('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc9aa('0x14')]={};this[_0xc9aa('0x15')]={};this[_0xc9aa('0x16')]={};this[_0xc9aa('0x17')]={};this[_0xc9aa('0x18')]={};this[_0xc9aa('0x19')]={};this[_0xc9aa('0x1a')]={};this[_0xc9aa('0x1b')]={};this[_0xc9aa('0x1c')]={};this[_0xc9aa('0x1d')]={};this[_0xc9aa('0x1e')]={};this[_0xc9aa('0x1f')]={};this[_0xc9aa('0x20')]={};this[_0xc9aa('0x21')]={};this['dynamics365Accounts']={};this[_0xc9aa('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5b351f,_0x477ca5,_0x553805){var _0x13ed6c=_[_0xc9aa('0x23')](_0x5b351f,function(_0x4b42a4,_0x35f3b4){return _0x4b42a4[_0x553805];});for(var _0x28a1a0 in _0x477ca5){if(_0x477ca5[_0xc9aa('0x24')](_0x28a1a0)){if(!_0x13ed6c[_0x28a1a0]){delete _0x477ca5[_0x28a1a0];}}}}function freeIsNotKeySip(_0x4bacb3,_0x2999e0){var _0x13d32d=_[_0xc9aa('0x23')](_0x4bacb3,function(_0x22ad7f,_0x3a806e){return util[_0xc9aa('0x25')]('SIP/%s',_0x22ad7f[_0xc9aa('0x26')]);});for(var _0x55037f in _0x2999e0){if(_0x2999e0[_0xc9aa('0x24')](_0x55037f)){if(!_0x13d32d[_0x55037f]){delete _0x2999e0[_0x55037f];}}}}function freeIsNotKeyAgent(_0x5b5ffc,_0x7c837f){var _0x5e51e9=_[_0xc9aa('0x23')](_0x5b5ffc,function(_0x3f8bfd,_0x214c09){var _0x465f52=_['isNil'](_0x3f8bfd[_0xc9aa('0x27')])?util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x3f8bfd[_0xc9aa('0x26')]):_0x3f8bfd[_0xc9aa('0x27')];return _0x465f52;});for(var _0x4fdeef in _0x7c837f){if(_0x7c837f[_0xc9aa('0x24')](_0x4fdeef)){if(!_0x5e51e9[_0x4fdeef]){delete _0x7c837f[_0x4fdeef];}}}}function clearVoiceCallReports(_0xdd020f){_0xdd020f[_0xc9aa('0x29')]=0x0;_0xdd020f[_0xc9aa('0x2a')]=0x0;_0xdd020f[_0xc9aa('0x2b')]=0x0;_0xdd020f[_0xc9aa('0x2c')]=0x0;_0xdd020f[_0xc9aa('0x2d')]=0x0;}function clearCampaigns(_0x4dab46){if(!_[_0xc9aa('0x2e')](_0x4dab46)){for(var _0x40e628 in _0x4dab46){if(_0x4dab46['hasOwnProperty'](_0x40e628)){_0x4dab46[_0x40e628]['ivrTotalCallsDays']=0x0;_0x4dab46[_0x40e628][_0xc9aa('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x10a62e){if(!_[_0xc9aa('0x2e')](_0x10a62e)){for(var _0x464cac in _0x10a62e){if(_0x10a62e[_0xc9aa('0x24')](_0x464cac)){_0x10a62e[_0x464cac][_0xc9aa('0x29')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2a')]=0x0;_0x10a62e[_0x464cac]['unmanaged']=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x30')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2b')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2c')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x2d')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x31')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x32')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x33')]=0x0;_0x10a62e[_0x464cac]['outboundCongestionCallsDay']=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x34')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x35')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x36')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x37')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x38')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x39')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3a')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3b')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x31')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3c')]=0x0;_0x10a62e[_0x464cac][_0xc9aa('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1ebcc8,_0x5cdcef){for(var _0x3e5bdc in _0x5cdcef){if(_0x1ebcc8[_0xc9aa('0x24')](_0x3e5bdc)){_0x1ebcc8[_0x3e5bdc]=_0x5cdcef[_0x3e5bdc];}}};Realtime[_0xc9aa('0x3e')]['initAgents']=function(){var _0x5d68fa=this;return function(_0x852ac8){if(_0x852ac8){freeIsNotKeyAgent(_0x852ac8,_0x5d68fa['agents']);for(var _0x40bec1=0x0,_0x646f83={},_0x4ae06c={};_0x40bec1<_0x852ac8[_0xc9aa('0x3f')];_0x40bec1+=0x1){_0x646f83=_0x852ac8[_0x40bec1];var _0x3e2669=_[_0xc9aa('0x40')](_0x646f83[_0xc9aa('0x27')])?util['format'](_0xc9aa('0x28'),_0x646f83[_0xc9aa('0x26')]):_0x646f83['interface'];if(_[_0xc9aa('0x41')](_0x5d68fa[_0xc9aa('0xf')][_0x3e2669])){_0x5d68fa[_0xc9aa('0xf')][_0x3e2669]=new Agent(_0x646f83);}else{_0x5d68fa[_0xc9aa('0x42')](_0x5d68fa[_0xc9aa('0xf')][_0x3e2669],_0x646f83);}}}return _0x5d68fa[_0xc9aa('0xf')];};};Realtime['prototype']['initTelephones']=function(){var _0x3914e9=this;return function(_0x45d4ca){if(_0x45d4ca){freeIsNotKeySip(_0x45d4ca,_0x3914e9[_0xc9aa('0x43')]);for(var _0x44c360=0x0,_0x2da11d={},_0x24fae6={};_0x44c360<_0x45d4ca[_0xc9aa('0x3f')];_0x44c360+=0x1){_0x2da11d=_0x45d4ca[_0x44c360];if(_['isUndefined'](_0x3914e9[_0xc9aa('0x43')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x2da11d[_0xc9aa('0x26')])])){_0x3914e9['telephones'][util['format']('SIP/%s',_0x2da11d[_0xc9aa('0x26')])]=new Telephone(_0x2da11d);}else{_0x3914e9[_0xc9aa('0x42')](_0x3914e9[_0xc9aa('0x43')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x2da11d[_0xc9aa('0x26')])],_0x2da11d);}}}return _0x3914e9[_0xc9aa('0x43')];};};Realtime['prototype'][_0xc9aa('0x44')]=function(){var _0x2bf707=this;return function(_0x1d8ff2){if(_0x1d8ff2){freeIsNotKeySip(_0x1d8ff2,_0x2bf707[_0xc9aa('0x45')]);for(var _0x5938e5=0x0,_0x5ba45d={},_0x43d026={};_0x5938e5<_0x1d8ff2['length'];_0x5938e5+=0x1){_0x5ba45d=_0x1d8ff2[_0x5938e5];if(_[_0xc9aa('0x41')](_0x2bf707[_0xc9aa('0x45')][util[_0xc9aa('0x25')](_0xc9aa('0x28'),_0x5ba45d['name'])])){_0x2bf707[_0xc9aa('0x45')][util['format'](_0xc9aa('0x28'),_0x5ba45d[_0xc9aa('0x26')])]=new Trunk(_0x5ba45d);}else{_0x2bf707[_0xc9aa('0x42')](_0x2bf707[_0xc9aa('0x45')][util[_0xc9aa('0x25')]('SIP/%s',_0x5ba45d[_0xc9aa('0x26')])],_0x5ba45d);}}}return _0x2bf707['trunks'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x46')]=function(){var _0x2e2f1a=this;return function(_0x42b7b8){if(_0x42b7b8){freeIsNotKey(_0x42b7b8,_0x2e2f1a[_0xc9aa('0x10')],_0xc9aa('0x26'));for(var _0x392bcd=0x0,_0x49798f={},_0x4975a9={};_0x392bcd<_0x42b7b8[_0xc9aa('0x3f')];_0x392bcd+=0x1){_0x49798f=_0x42b7b8[_0x392bcd];if(_['isUndefined'](_0x2e2f1a[_0xc9aa('0x10')][_0x49798f['name']])){_0x2e2f1a[_0xc9aa('0x10')][_0x49798f[_0xc9aa('0x26')]]=new VoiceQueue(_0x49798f);}else{_0x2e2f1a[_0xc9aa('0x42')](_0x2e2f1a[_0xc9aa('0x10')][_0x49798f[_0xc9aa('0x26')]],_0x49798f);}}}return _0x2e2f1a[_0xc9aa('0x10')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x47')]=function(){var _0x3e0cf4=this;return function(_0x40da91){if(_0x40da91){freeIsNotKey(_0x40da91,_0x3e0cf4[_0xc9aa('0x48')],'id');for(var _0x150f3e=0x0,_0x5bda7c={},_0x164c0b={};_0x150f3e<_0x40da91[_0xc9aa('0x3f')];_0x150f3e+=0x1){_0x5bda7c=_0x40da91[_0x150f3e];if(_[_0xc9aa('0x41')](_0x3e0cf4['triggers'][_0x5bda7c['id']])){_0x3e0cf4['triggers'][_0x5bda7c['id']]=new Trigger(_0x5bda7c);}else{_0x3e0cf4['mergeFromDatabase'](_0x3e0cf4['triggers'][_0x5bda7c['id']],_0x5bda7c);}}}return _0x3e0cf4['triggers'];};};Realtime['prototype']['initTemplates']=function(){var _0x44c5db=this;return function(_0x4d191b){if(_0x4d191b){freeIsNotKey(_0x4d191b,_0x44c5db[_0xc9aa('0x12')],'id');for(var _0x25ab8e=0x0,_0xcf250a={},_0x710cec={};_0x25ab8e<_0x4d191b[_0xc9aa('0x3f')];_0x25ab8e+=0x1){_0xcf250a=_0x4d191b[_0x25ab8e];if(_[_0xc9aa('0x41')](_0x44c5db['templates'][_0xcf250a['id']])){_0x44c5db[_0xc9aa('0x12')][_0xcf250a['id']]=new Template(_0xcf250a);}else{_0x44c5db[_0xc9aa('0x42')](_0x44c5db[_0xc9aa('0x12')][_0xcf250a['id']],_0xcf250a);}}}return _0x44c5db['templates'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x49')]=function(){var _0x26194c=this;return function(_0x1831bd){if(_0x1831bd){freeIsNotKey(_0x1831bd,_0x26194c['zendeskAccounts'],'id');for(var _0x589529=0x0,_0x402906={},_0x43f164={};_0x589529<_0x1831bd[_0xc9aa('0x3f')];_0x589529+=0x1){_0x402906=_0x1831bd[_0x589529];if(_[_0xc9aa('0x41')](_0x26194c[_0xc9aa('0x1a')][_0x402906['id']])){_0x26194c[_0xc9aa('0x1a')][_0x402906['id']]=new ZendeskAccount(_0x402906);}else{_0x26194c[_0xc9aa('0x42')](_0x26194c['zendeskAccounts'][_0x402906['id']],_0x402906);}}}return _0x26194c['zendeskAccounts'];};};Realtime[_0xc9aa('0x3e')]['initSalesforceAccounts']=function(){var _0x476c08=this;return function(_0x216e42){if(_0x216e42){freeIsNotKey(_0x216e42,_0x476c08[_0xc9aa('0x1b')],'id');for(var _0x77ae93=0x0,_0x4cb558={},_0x5f1cf2={};_0x77ae93<_0x216e42[_0xc9aa('0x3f')];_0x77ae93+=0x1){_0x4cb558=_0x216e42[_0x77ae93];if(_[_0xc9aa('0x41')](_0x476c08['salesforceAccounts'][_0x4cb558['id']])){_0x476c08[_0xc9aa('0x1b')][_0x4cb558['id']]=new SalesforceAccount(_0x4cb558);}else{_0x476c08[_0xc9aa('0x42')](_0x476c08[_0xc9aa('0x1b')][_0x4cb558['id']],_0x4cb558);}}}return _0x476c08[_0xc9aa('0x1b')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x17924e=this;return function(_0x27d702){if(_0x27d702){freeIsNotKey(_0x27d702,_0x17924e[_0xc9aa('0x1d')],'id');for(var _0x476d8a=0x0,_0x1470b3={},_0x7ac27={};_0x476d8a<_0x27d702[_0xc9aa('0x3f')];_0x476d8a+=0x1){_0x1470b3=_0x27d702[_0x476d8a];if(_[_0xc9aa('0x41')](_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']])){_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']]=new FreshdeskAccount(_0x1470b3);}else{_0x17924e['mergeFromDatabase'](_0x17924e[_0xc9aa('0x1d')][_0x1470b3['id']],_0x1470b3);}}}return _0x17924e[_0xc9aa('0x1d')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4a')]=function(){var _0x3dfae1=this;return function(_0x338c76){if(_0x338c76){freeIsNotKey(_0x338c76,_0x3dfae1[_0xc9aa('0x1e')],'id');for(var _0x32d0c4=0x0,_0x947ad6={},_0x1c1cd4={};_0x32d0c4<_0x338c76['length'];_0x32d0c4+=0x1){_0x947ad6=_0x338c76[_0x32d0c4];if(_[_0xc9aa('0x41')](_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']])){_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']]=new ZohoAccount(_0x947ad6);}else{_0x3dfae1[_0xc9aa('0x42')](_0x3dfae1[_0xc9aa('0x1e')][_0x947ad6['id']],_0x947ad6);}}}return _0x3dfae1['zohoAccounts'];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4b')]=function(){var _0x25b5b7=this;return function(_0xdbb4e3){if(_0xdbb4e3){freeIsNotKey(_0xdbb4e3,_0x25b5b7['deskAccounts'],'id');for(var _0x4a4816=0x0,_0xbc766b={},_0x2ddbfb={};_0x4a4816<_0xdbb4e3[_0xc9aa('0x3f')];_0x4a4816+=0x1){_0xbc766b=_0xdbb4e3[_0x4a4816];if(_[_0xc9aa('0x41')](_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']])){_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']]=new DeskAccount(_0xbc766b);}else{_0x25b5b7[_0xc9aa('0x42')](_0x25b5b7[_0xc9aa('0x1f')][_0xbc766b['id']],_0xbc766b);}}}return _0x25b5b7[_0xc9aa('0x1f')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4c')]=function(){var _0x364613=this;return function(_0x33f26b){if(_0x33f26b){freeIsNotKey(_0x33f26b,_0x364613[_0xc9aa('0x1c')],'id');for(var _0x1f8e54=0x0,_0x1a70ec={},_0x1be28a={};_0x1f8e54<_0x33f26b[_0xc9aa('0x3f')];_0x1f8e54+=0x1){_0x1a70ec=_0x33f26b[_0x1f8e54];if(_[_0xc9aa('0x41')](_0x364613[_0xc9aa('0x1c')][_0x1a70ec['id']])){_0x364613['sugarcrmAccounts'][_0x1a70ec['id']]=new SugarcrmAccount(_0x1a70ec);}else{_0x364613['mergeFromDatabase'](_0x364613['sugarcrmAccounts'][_0x1a70ec['id']],_0x1a70ec);}}}return _0x364613[_0xc9aa('0x1c')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4d')]=function(){var _0x252dc0=this;return function(_0x2d8c59){if(_0x2d8c59){freeIsNotKey(_0x2d8c59,_0x252dc0[_0xc9aa('0x20')],'id');for(var _0x40fe29=0x0,_0x234965={},_0x544daf={};_0x40fe29<_0x2d8c59[_0xc9aa('0x3f')];_0x40fe29+=0x1){_0x234965=_0x2d8c59[_0x40fe29];if(_[_0xc9aa('0x41')](_0x252dc0[_0xc9aa('0x20')][_0x234965['id']])){_0x252dc0[_0xc9aa('0x20')][_0x234965['id']]=new VtigerAccount(_0x234965);}else{_0x252dc0[_0xc9aa('0x42')](_0x252dc0[_0xc9aa('0x20')][_0x234965['id']],_0x234965);}}}return _0x252dc0[_0xc9aa('0x20')];};};Realtime[_0xc9aa('0x3e')]['initServicenowAccounts']=function(){var _0x48a039=this;return function(_0x17e74f){if(_0x17e74f){freeIsNotKey(_0x17e74f,_0x48a039[_0xc9aa('0x21')],'id');for(var _0x32ad94=0x0,_0x1ad9f8={},_0x2ecdc6={};_0x32ad94<_0x17e74f[_0xc9aa('0x3f')];_0x32ad94+=0x1){_0x1ad9f8=_0x17e74f[_0x32ad94];if(_[_0xc9aa('0x41')](_0x48a039[_0xc9aa('0x21')][_0x1ad9f8['id']])){_0x48a039[_0xc9aa('0x21')][_0x1ad9f8['id']]=new ServicenowAccount(_0x1ad9f8);}else{_0x48a039['mergeFromDatabase'](_0x48a039['servicenowAccounts'][_0x1ad9f8['id']],_0x1ad9f8);}}}return _0x48a039[_0xc9aa('0x21')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x4e')]=function(){var _0x5dd229=this;return function(_0x518ee4){if(_0x518ee4){freeIsNotKey(_0x518ee4,_0x5dd229[_0xc9aa('0x4f')],'id');for(var _0x24031f=0x0,_0x5b6637={},_0x1f0f88={};_0x24031f<_0x518ee4[_0xc9aa('0x3f')];_0x24031f+=0x1){_0x5b6637=_0x518ee4[_0x24031f];if(_[_0xc9aa('0x41')](_0x5dd229[_0xc9aa('0x4f')][_0x5b6637['id']])){_0x5dd229['dynamics365Accounts'][_0x5b6637['id']]=new Dynamics365Account(_0x5b6637);}else{_0x5dd229[_0xc9aa('0x42')](_0x5dd229['dynamics365Accounts'][_0x5b6637['id']],_0x5b6637);}}}return _0x5dd229['dynamics365Accounts'];};};Realtime['prototype'][_0xc9aa('0x50')]=function(){var _0xdcb73=this;return function(_0x3a433f){if(_0x3a433f){freeIsNotKey(_0x3a433f,_0xdcb73[_0xc9aa('0x22')],'id');for(var _0x38fe0a=0x0,_0x17a611={},_0x12bb09={};_0x38fe0a<_0x3a433f[_0xc9aa('0x3f')];_0x38fe0a+=0x1){_0x17a611=_0x3a433f[_0x38fe0a];if(_[_0xc9aa('0x41')](_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']])){_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']]=new FreshsalesAccount(_0x17a611);}else{_0xdcb73[_0xc9aa('0x42')](_0xdcb73[_0xc9aa('0x22')][_0x17a611['id']],_0x17a611);}}}return _0xdcb73[_0xc9aa('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x347972=this;return function(_0x3a6d5e){for(var _0x14e308=0x0;_0x14e308<_0x3a6d5e[_0xc9aa('0x3f')];_0x14e308+=0x1){_['merge'](_0x347972[_0xc9aa('0x10')][_0x3a6d5e[_0x14e308]['name']],_0x3a6d5e[_0x14e308]);}return _0x347972[_0xc9aa('0x10')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x51')]=function(){var _0x1d3d9b=this;return function(_0x3d1b38){clearVoiceQueues(_0x1d3d9b[_0xc9aa('0x10')]);if(_0x3d1b38){_0x3d1b38=_[_0xc9aa('0x52')](_0x3d1b38,_0xc9aa('0x53'));for(var _0x3892a0 in _0x3d1b38){if(_0x3d1b38[_0xc9aa('0x24')](_0x3892a0)){var _0x51518d={};for(var _0x5f1d8f=0x0;_0x5f1d8f<_0x3d1b38[_0x3892a0][_0xc9aa('0x3f')];_0x5f1d8f+=0x1){var _0x198ce1=_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x54')];if(_0x1d3d9b['voiceQueues'][_0x198ce1]){if(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x55')]){_0x1d3d9b['voiceQueues'][_0x198ce1][_0xc9aa('0x56')]+=0x1;}if(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x57')]){_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x30')]+=0x1;}_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x2b')]+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallerleaveAt'])['diff'](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x58')]),_0xc9aa('0x59'))||0x0;if(_0x5f1d8f===_0x3d1b38[_0x3892a0][_0xc9aa('0x3f')]-0x1){_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1]['sumDuration']+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallercompleteAt']||_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5a')]||_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5b')])[_0xc9aa('0x5c')](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x58')]),_0xc9aa('0x59'))||0x0;_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x29')]+=0x1;if(_0x3d1b38[_0x3892a0][_0x5f1d8f]['queuecallercomplete']){_0x1d3d9b['voiceQueues'][_0x198ce1]['answered']+=0x1;_0x1d3d9b['voiceQueues'][_0x198ce1]['sumBillable']+=moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5d')])['diff'](moment(_0x3d1b38[_0x3892a0][_0x5f1d8f][_0xc9aa('0x5e')]),_0xc9aa('0x59'))||0x0;}}else{_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1][_0xc9aa('0x2c')]+=_0x1d3d9b[_0xc9aa('0x10')][_0x198ce1]['sumHoldTime']||0x0;}}}}}}return _0x1d3d9b[_0xc9aa('0x10')];};};Realtime['prototype'][_0xc9aa('0x5f')]=function(){var _0x5ed6c0=this;return function(_0x168269){clearVoiceCallReports(_0x5ed6c0[_0xc9aa('0x13')]);if(_0x168269){for(var _0x33a4fb=0x0;_0x33a4fb<_0x168269[_0xc9aa('0x3f')];_0x33a4fb+=0x1){_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x29')]+=0x1;_0x5ed6c0[_0xc9aa('0x13')]['sumDuration']+=_0x168269[_0x33a4fb]['duration'];if(_0x168269[_0x33a4fb][_0xc9aa('0x60')]===_0xc9aa('0x61')){_0x5ed6c0['outbound'][_0xc9aa('0x2a')]+=0x1;_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x2b')]+=_0x168269[_0x33a4fb][_0xc9aa('0x62')]-_0x168269[_0x33a4fb][_0xc9aa('0x63')]||0x0;_0x5ed6c0[_0xc9aa('0x13')][_0xc9aa('0x2d')]+=_0x168269[_0x33a4fb][_0xc9aa('0x63')];}}}return _0x5ed6c0[_0xc9aa('0x13')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x64')]=function(){var _0x5a60e4=this;return function(_0xe30f9c){if(_0xe30f9c){freeIsNotKey(_0xe30f9c,_0x5a60e4[_0xc9aa('0x11')],_0xc9aa('0x26'));for(var _0x269ac4=0x0,_0x4cc158={};_0x269ac4<_0xe30f9c[_0xc9aa('0x3f')];_0x269ac4+=0x1){_0x4cc158=_0xe30f9c[_0x269ac4];if(_['isUndefined'](_0x5a60e4[_0xc9aa('0x11')][_0x4cc158[_0xc9aa('0x26')]])){_0x5a60e4['campaigns'][_0x4cc158[_0xc9aa('0x26')]]=new Campaign(_0x4cc158);}else{_0x5a60e4[_0xc9aa('0x42')](_0x5a60e4[_0xc9aa('0x11')][_0x4cc158['name']],_0x4cc158);_0x5a60e4[_0xc9aa('0x11')][_0x4cc158['name']][_0xc9aa('0x65')]=_0x4cc158[_0xc9aa('0x66')]?_0x4cc158[_0xc9aa('0x66')][_0xc9aa('0x26')]:undefined;}}}return _0x5a60e4[_0xc9aa('0x11')];};};Realtime[_0xc9aa('0x3e')]['initVoiceExtensions']=function(){var _0x1d6c8a=this;return function(_0x1f27c7){if(_0x1f27c7){freeIsNotKey(_0x1f27c7,_0x1d6c8a['voiceExtensions'],'id');for(var _0x1d62ab=0x0,_0xd2bee9={};_0x1d62ab<_0x1f27c7[_0xc9aa('0x3f')];_0x1d62ab+=0x1){_0xd2bee9=_0x1f27c7[_0x1d62ab];if(_[_0xc9aa('0x41')](_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']])){_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']]=new VoiceExtension(_0xd2bee9);}else{_0x1d6c8a[_0xc9aa('0x42')](_0x1d6c8a[_0xc9aa('0x14')][_0xd2bee9['id']],_0xd2bee9);}}}return _0x1d6c8a[_0xc9aa('0x14')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x67')]=function(){var _0x287769=this;return function(_0x5e7ce8){clearCampaigns(_0x287769['campaigns']);for(var _0x2a6f76=0x0;_0x2a6f76<_0x5e7ce8['length'];_0x2a6f76+=0x1){_[_0xc9aa('0x68')](_0x287769[_0xc9aa('0x11')][_0x5e7ce8[_0x2a6f76][_0xc9aa('0x26')]],_0x5e7ce8[_0x2a6f76]);}return _0x287769[_0xc9aa('0x11')];};};Realtime[_0xc9aa('0x3e')][_0xc9aa('0x69')]=function(){var _0x4de703=this;return function(_0x11295f){if(_0x11295f){freeIsNotKey(_0x11295f,_0x4de703[_0xc9aa('0x6a')],'id');for(var _0x3559a7=0x0,_0x4601e0={},_0x50d3ef={};_0x3559a7<_0x11295f[_0xc9aa('0x3f')];_0x3559a7+=0x1){_0x4601e0=_0x11295f[_0x3559a7];if(_[_0xc9aa('0x41')](_0x4de703['faxAccounts'][_0x4601e0['id']])){_0x4de703[_0xc9aa('0x6a')][_0x4601e0['id']]=new FaxAccount(_0x4601e0);}else{_0x4de703[_0xc9aa('0x42')](_0x4de703[_0xc9aa('0x6a')][_0x4601e0['id']],_0x4601e0);}}}return _0x4de703['faxAccounts'];};};module[_0xc9aa('0x6b')]=Realtime; \ No newline at end of file +var _0xeb0f=['sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','total','unmanaged','abandoned','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','telephones','initTrunks','trunks','initVoiceQueues','templates','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','voiceQueues','triggers','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','answered','sumHoldTime'];(function(_0x4b1df7,_0x331f15){var _0x2d52aa=function(_0xf0b183){while(--_0xf0b183){_0x4b1df7['push'](_0x4b1df7['shift']());}};_0x2d52aa(++_0x331f15);}(_0xeb0f,0x176));var _0xfeb0=function(_0x407084,_0x2690f1){_0x407084=_0x407084-0x0;var _0x1871cb=_0xeb0f[_0x407084];return _0x1871cb;};'use strict';var util=require(_0xfeb0('0x0'));var _=require('lodash');var moment=require(_0xfeb0('0x1'));var Agent=require(_0xfeb0('0x2'));var Telephone=require(_0xfeb0('0x3'));var Trunk=require(_0xfeb0('0x4'));var VoiceQueue=require(_0xfeb0('0x5'));var Trigger=require(_0xfeb0('0x6'));var Template=require('../model/template');var Campaign=require(_0xfeb0('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xfeb0('0x8'));var FreshdeskAccount=require(_0xfeb0('0x9'));var SugarcrmAccount=require(_0xfeb0('0xa'));var ZohoAccount=require(_0xfeb0('0xb'));var DeskAccount=require(_0xfeb0('0xc'));var VtigerAccount=require(_0xfeb0('0xd'));var ServicenowAccount=require(_0xfeb0('0xe'));var Dynamics365Account=require(_0xfeb0('0xf'));var FreshsalesAccount=require(_0xfeb0('0x10'));var FaxAccount=require(_0xfeb0('0x11'));var Realtime=function(){this[_0xfeb0('0x12')]={};this['telephones']={};this['trunks']={};this[_0xfeb0('0x13')]={};this[_0xfeb0('0x14')]={};this['campaigns']={};this['templates']={};this[_0xfeb0('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xfeb0('0x16')]={};this[_0xfeb0('0x17')]={};this[_0xfeb0('0x18')]={};this[_0xfeb0('0x19')]={};this['timers']={};this[_0xfeb0('0x1a')]={};this[_0xfeb0('0x1b')]={};this[_0xfeb0('0x1c')]={};this[_0xfeb0('0x1d')]={};this[_0xfeb0('0x1e')]={};this[_0xfeb0('0x1f')]={};this[_0xfeb0('0x20')]={};this[_0xfeb0('0x21')]={};this['servicenowAccounts']={};this[_0xfeb0('0x22')]={};this[_0xfeb0('0x23')]={};this[_0xfeb0('0x24')]={};};function freeIsNotKey(_0x58662b,_0x4f0c65,_0x4ede0e){var _0x1aa982=_[_0xfeb0('0x25')](_0x58662b,function(_0x3428ee,_0xf8f560){return _0x3428ee[_0x4ede0e];});for(var _0x3332ea in _0x4f0c65){if(_0x4f0c65[_0xfeb0('0x26')](_0x3332ea)){if(!_0x1aa982[_0x3332ea]){delete _0x4f0c65[_0x3332ea];}}}}function freeIsNotKeySip(_0x14bfc6,_0x2695ab){var _0x4c0611=_[_0xfeb0('0x25')](_0x14bfc6,function(_0x104a8d,_0x574194){return util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0x104a8d[_0xfeb0('0x29')]);});for(var _0x49088f in _0x2695ab){if(_0x2695ab[_0xfeb0('0x26')](_0x49088f)){if(!_0x4c0611[_0x49088f]){delete _0x2695ab[_0x49088f];}}}}function freeIsNotKeyAgent(_0x5f5d5c,_0x141cc0){var _0x43f155=_[_0xfeb0('0x25')](_0x5f5d5c,function(_0x42d053,_0x5aa08f){var _0x51cfc5=_[_0xfeb0('0x2a')](_0x42d053['interface'])?util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0x42d053[_0xfeb0('0x29')]):_0x42d053[_0xfeb0('0x2b')];return _0x51cfc5;});for(var _0x529fd4 in _0x141cc0){if(_0x141cc0[_0xfeb0('0x26')](_0x529fd4)){if(!_0x43f155[_0x529fd4]){delete _0x141cc0[_0x529fd4];}}}}function clearVoiceCallReports(_0x3b27c3){_0x3b27c3['total']=0x0;_0x3b27c3[_0xfeb0('0x2c')]=0x0;_0x3b27c3[_0xfeb0('0x2d')]=0x0;_0x3b27c3[_0xfeb0('0x2e')]=0x0;_0x3b27c3[_0xfeb0('0x2f')]=0x0;}function clearCampaigns(_0x2114dc){if(!_[_0xfeb0('0x30')](_0x2114dc)){for(var _0x298458 in _0x2114dc){if(_0x2114dc[_0xfeb0('0x26')](_0x298458)){_0x2114dc[_0x298458][_0xfeb0('0x31')]=0x0;_0x2114dc[_0x298458]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x44811a){if(!_[_0xfeb0('0x30')](_0x44811a)){for(var _0x4ef02c in _0x44811a){if(_0x44811a[_0xfeb0('0x26')](_0x4ef02c)){_0x44811a[_0x4ef02c][_0xfeb0('0x32')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x2c')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x33')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x34')]=0x0;_0x44811a[_0x4ef02c]['sumHoldTime']=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x2e')]=0x0;_0x44811a[_0x4ef02c]['sumBillable']=0x0;_0x44811a[_0x4ef02c]['outboundAnswerAgiCallsDay']=0x0;_0x44811a[_0x4ef02c]['outboundNoAnswerCallsDay']=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x35')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x36')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x37')]=0x0;_0x44811a[_0x4ef02c]['outboundUnknownCallsDay']=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x38')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x39')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x3a')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x3b')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x3c')]=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x3d')]=0x0;_0x44811a[_0x4ef02c]['outboundAnswerAgiCallsDay']=0x0;_0x44811a[_0x4ef02c]['outboundAnswerCallsDay']=0x0;_0x44811a[_0x4ef02c][_0xfeb0('0x3e')]=!![];}}}}Realtime['prototype'][_0xfeb0('0x3f')]=function(_0x1dde16,_0x3d4b51){for(var _0x1e0b98 in _0x3d4b51){if(_0x1dde16[_0xfeb0('0x26')](_0x1e0b98)){_0x1dde16[_0x1e0b98]=_0x3d4b51[_0x1e0b98];}}};Realtime[_0xfeb0('0x40')][_0xfeb0('0x41')]=function(){var _0x42db75=this;return function(_0x2f7c8a){if(_0x2f7c8a){freeIsNotKeyAgent(_0x2f7c8a,_0x42db75[_0xfeb0('0x12')]);for(var _0x41295c=0x0,_0x2cb4fb={},_0x28d4a6={};_0x41295c<_0x2f7c8a[_0xfeb0('0x42')];_0x41295c+=0x1){_0x2cb4fb=_0x2f7c8a[_0x41295c];var _0x1a59b1=_[_0xfeb0('0x2a')](_0x2cb4fb[_0xfeb0('0x2b')])?util['format'](_0xfeb0('0x28'),_0x2cb4fb[_0xfeb0('0x29')]):_0x2cb4fb['interface'];if(_[_0xfeb0('0x43')](_0x42db75[_0xfeb0('0x12')][_0x1a59b1])){_0x42db75[_0xfeb0('0x12')][_0x1a59b1]=new Agent(_0x2cb4fb);}else{_0x42db75[_0xfeb0('0x3f')](_0x42db75[_0xfeb0('0x12')][_0x1a59b1],_0x2cb4fb);}}}return _0x42db75['agents'];};};Realtime[_0xfeb0('0x40')]['initTelephones']=function(){var _0x52c48d=this;return function(_0x348c2c){if(_0x348c2c){freeIsNotKeySip(_0x348c2c,_0x52c48d['telephones']);for(var _0x3851fb=0x0,_0x58a729={},_0x2888f2={};_0x3851fb<_0x348c2c[_0xfeb0('0x42')];_0x3851fb+=0x1){_0x58a729=_0x348c2c[_0x3851fb];if(_[_0xfeb0('0x43')](_0x52c48d[_0xfeb0('0x44')][util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0x58a729[_0xfeb0('0x29')])])){_0x52c48d[_0xfeb0('0x44')][util[_0xfeb0('0x27')]('SIP/%s',_0x58a729[_0xfeb0('0x29')])]=new Telephone(_0x58a729);}else{_0x52c48d[_0xfeb0('0x3f')](_0x52c48d[_0xfeb0('0x44')][util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0x58a729['name'])],_0x58a729);}}}return _0x52c48d[_0xfeb0('0x44')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x45')]=function(){var _0x27f926=this;return function(_0x534642){if(_0x534642){freeIsNotKeySip(_0x534642,_0x27f926[_0xfeb0('0x46')]);for(var _0x461b60=0x0,_0xd742d7={},_0x189d7e={};_0x461b60<_0x534642[_0xfeb0('0x42')];_0x461b60+=0x1){_0xd742d7=_0x534642[_0x461b60];if(_[_0xfeb0('0x43')](_0x27f926['trunks'][util[_0xfeb0('0x27')]('SIP/%s',_0xd742d7[_0xfeb0('0x29')])])){_0x27f926['trunks'][util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0xd742d7[_0xfeb0('0x29')])]=new Trunk(_0xd742d7);}else{_0x27f926[_0xfeb0('0x3f')](_0x27f926[_0xfeb0('0x46')][util[_0xfeb0('0x27')](_0xfeb0('0x28'),_0xd742d7[_0xfeb0('0x29')])],_0xd742d7);}}}return _0x27f926[_0xfeb0('0x46')];};};Realtime['prototype'][_0xfeb0('0x47')]=function(){var _0x495d02=this;return function(_0x296565){if(_0x296565){freeIsNotKey(_0x296565,_0x495d02[_0xfeb0('0x13')],_0xfeb0('0x29'));for(var _0x35d4f3=0x0,_0x3c1b5d={},_0x5ba6d0={};_0x35d4f3<_0x296565['length'];_0x35d4f3+=0x1){_0x3c1b5d=_0x296565[_0x35d4f3];if(_[_0xfeb0('0x43')](_0x495d02[_0xfeb0('0x13')][_0x3c1b5d[_0xfeb0('0x29')]])){_0x495d02[_0xfeb0('0x13')][_0x3c1b5d[_0xfeb0('0x29')]]=new VoiceQueue(_0x3c1b5d);}else{_0x495d02[_0xfeb0('0x3f')](_0x495d02[_0xfeb0('0x13')][_0x3c1b5d[_0xfeb0('0x29')]],_0x3c1b5d);}}}return _0x495d02[_0xfeb0('0x13')];};};Realtime[_0xfeb0('0x40')]['initTriggers']=function(){var _0xad1f71=this;return function(_0x3e0e19){if(_0x3e0e19){freeIsNotKey(_0x3e0e19,_0xad1f71['triggers'],'id');for(var _0x3eb269=0x0,_0x3ee041={},_0x3f84ff={};_0x3eb269<_0x3e0e19['length'];_0x3eb269+=0x1){_0x3ee041=_0x3e0e19[_0x3eb269];if(_[_0xfeb0('0x43')](_0xad1f71[_0xfeb0('0x14')][_0x3ee041['id']])){_0xad1f71['triggers'][_0x3ee041['id']]=new Trigger(_0x3ee041);}else{_0xad1f71[_0xfeb0('0x3f')](_0xad1f71[_0xfeb0('0x14')][_0x3ee041['id']],_0x3ee041);}}}return _0xad1f71[_0xfeb0('0x14')];};};Realtime['prototype']['initTemplates']=function(){var _0x3f565e=this;return function(_0x491e81){if(_0x491e81){freeIsNotKey(_0x491e81,_0x3f565e[_0xfeb0('0x48')],'id');for(var _0xd774=0x0,_0x3dfb6b={},_0x3ebd6d={};_0xd774<_0x491e81[_0xfeb0('0x42')];_0xd774+=0x1){_0x3dfb6b=_0x491e81[_0xd774];if(_[_0xfeb0('0x43')](_0x3f565e[_0xfeb0('0x48')][_0x3dfb6b['id']])){_0x3f565e['templates'][_0x3dfb6b['id']]=new Template(_0x3dfb6b);}else{_0x3f565e['mergeFromDatabase'](_0x3f565e[_0xfeb0('0x48')][_0x3dfb6b['id']],_0x3dfb6b);}}}return _0x3f565e['templates'];};};Realtime[_0xfeb0('0x40')]['initZendeskAccounts']=function(){var _0x4c3c03=this;return function(_0x352d02){if(_0x352d02){freeIsNotKey(_0x352d02,_0x4c3c03[_0xfeb0('0x1b')],'id');for(var _0x450983=0x0,_0x1cb394={},_0x752bb0={};_0x450983<_0x352d02[_0xfeb0('0x42')];_0x450983+=0x1){_0x1cb394=_0x352d02[_0x450983];if(_[_0xfeb0('0x43')](_0x4c3c03[_0xfeb0('0x1b')][_0x1cb394['id']])){_0x4c3c03[_0xfeb0('0x1b')][_0x1cb394['id']]=new ZendeskAccount(_0x1cb394);}else{_0x4c3c03[_0xfeb0('0x3f')](_0x4c3c03[_0xfeb0('0x1b')][_0x1cb394['id']],_0x1cb394);}}}return _0x4c3c03[_0xfeb0('0x1b')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x49')]=function(){var _0x393681=this;return function(_0x4dbb57){if(_0x4dbb57){freeIsNotKey(_0x4dbb57,_0x393681['salesforceAccounts'],'id');for(var _0x18ec24=0x0,_0x574ad4={},_0x177541={};_0x18ec24<_0x4dbb57[_0xfeb0('0x42')];_0x18ec24+=0x1){_0x574ad4=_0x4dbb57[_0x18ec24];if(_[_0xfeb0('0x43')](_0x393681[_0xfeb0('0x1c')][_0x574ad4['id']])){_0x393681['salesforceAccounts'][_0x574ad4['id']]=new SalesforceAccount(_0x574ad4);}else{_0x393681['mergeFromDatabase'](_0x393681['salesforceAccounts'][_0x574ad4['id']],_0x574ad4);}}}return _0x393681[_0xfeb0('0x1c')];};};Realtime[_0xfeb0('0x40')]['initFreshdeskAccounts']=function(){var _0x11e95f=this;return function(_0x1dc290){if(_0x1dc290){freeIsNotKey(_0x1dc290,_0x11e95f[_0xfeb0('0x1e')],'id');for(var _0x5880cf=0x0,_0x58f7fe={},_0x2ea0d9={};_0x5880cf<_0x1dc290[_0xfeb0('0x42')];_0x5880cf+=0x1){_0x58f7fe=_0x1dc290[_0x5880cf];if(_[_0xfeb0('0x43')](_0x11e95f[_0xfeb0('0x1e')][_0x58f7fe['id']])){_0x11e95f[_0xfeb0('0x1e')][_0x58f7fe['id']]=new FreshdeskAccount(_0x58f7fe);}else{_0x11e95f[_0xfeb0('0x3f')](_0x11e95f[_0xfeb0('0x1e')][_0x58f7fe['id']],_0x58f7fe);}}}return _0x11e95f[_0xfeb0('0x1e')];};};Realtime['prototype'][_0xfeb0('0x4a')]=function(){var _0x39a8b8=this;return function(_0x339792){if(_0x339792){freeIsNotKey(_0x339792,_0x39a8b8['zohoAccounts'],'id');for(var _0x156683=0x0,_0x30a9d0={},_0x4e3c5a={};_0x156683<_0x339792[_0xfeb0('0x42')];_0x156683+=0x1){_0x30a9d0=_0x339792[_0x156683];if(_[_0xfeb0('0x43')](_0x39a8b8[_0xfeb0('0x1f')][_0x30a9d0['id']])){_0x39a8b8[_0xfeb0('0x1f')][_0x30a9d0['id']]=new ZohoAccount(_0x30a9d0);}else{_0x39a8b8[_0xfeb0('0x3f')](_0x39a8b8['zohoAccounts'][_0x30a9d0['id']],_0x30a9d0);}}}return _0x39a8b8[_0xfeb0('0x1f')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x4b')]=function(){var _0x4d02e4=this;return function(_0x4dd525){if(_0x4dd525){freeIsNotKey(_0x4dd525,_0x4d02e4[_0xfeb0('0x20')],'id');for(var _0x921bf3=0x0,_0x549534={},_0xa47efd={};_0x921bf3<_0x4dd525[_0xfeb0('0x42')];_0x921bf3+=0x1){_0x549534=_0x4dd525[_0x921bf3];if(_[_0xfeb0('0x43')](_0x4d02e4['deskAccounts'][_0x549534['id']])){_0x4d02e4[_0xfeb0('0x20')][_0x549534['id']]=new DeskAccount(_0x549534);}else{_0x4d02e4[_0xfeb0('0x3f')](_0x4d02e4[_0xfeb0('0x20')][_0x549534['id']],_0x549534);}}}return _0x4d02e4[_0xfeb0('0x20')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x4c')]=function(){var _0x1e928b=this;return function(_0x5f2cca){if(_0x5f2cca){freeIsNotKey(_0x5f2cca,_0x1e928b[_0xfeb0('0x1d')],'id');for(var _0x156c9c=0x0,_0x1df84e={},_0x91e193={};_0x156c9c<_0x5f2cca['length'];_0x156c9c+=0x1){_0x1df84e=_0x5f2cca[_0x156c9c];if(_['isUndefined'](_0x1e928b[_0xfeb0('0x1d')][_0x1df84e['id']])){_0x1e928b[_0xfeb0('0x1d')][_0x1df84e['id']]=new SugarcrmAccount(_0x1df84e);}else{_0x1e928b[_0xfeb0('0x3f')](_0x1e928b[_0xfeb0('0x1d')][_0x1df84e['id']],_0x1df84e);}}}return _0x1e928b[_0xfeb0('0x1d')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x4d')]=function(){var _0x14be8f=this;return function(_0x112836){if(_0x112836){freeIsNotKey(_0x112836,_0x14be8f[_0xfeb0('0x21')],'id');for(var _0x51c24c=0x0,_0x1a61e5={},_0x5efcab={};_0x51c24c<_0x112836['length'];_0x51c24c+=0x1){_0x1a61e5=_0x112836[_0x51c24c];if(_[_0xfeb0('0x43')](_0x14be8f['vtigerAccounts'][_0x1a61e5['id']])){_0x14be8f[_0xfeb0('0x21')][_0x1a61e5['id']]=new VtigerAccount(_0x1a61e5);}else{_0x14be8f[_0xfeb0('0x3f')](_0x14be8f[_0xfeb0('0x21')][_0x1a61e5['id']],_0x1a61e5);}}}return _0x14be8f[_0xfeb0('0x21')];};};Realtime[_0xfeb0('0x40')]['initServicenowAccounts']=function(){var _0x2ef790=this;return function(_0x5aaefc){if(_0x5aaefc){freeIsNotKey(_0x5aaefc,_0x2ef790[_0xfeb0('0x4e')],'id');for(var _0x5e5756=0x0,_0x5e0592={},_0x14f19e={};_0x5e5756<_0x5aaefc[_0xfeb0('0x42')];_0x5e5756+=0x1){_0x5e0592=_0x5aaefc[_0x5e5756];if(_[_0xfeb0('0x43')](_0x2ef790[_0xfeb0('0x4e')][_0x5e0592['id']])){_0x2ef790['servicenowAccounts'][_0x5e0592['id']]=new ServicenowAccount(_0x5e0592);}else{_0x2ef790[_0xfeb0('0x3f')](_0x2ef790[_0xfeb0('0x4e')][_0x5e0592['id']],_0x5e0592);}}}return _0x2ef790['servicenowAccounts'];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x4f')]=function(){var _0x29ee73=this;return function(_0x3ab187){if(_0x3ab187){freeIsNotKey(_0x3ab187,_0x29ee73[_0xfeb0('0x22')],'id');for(var _0x474556=0x0,_0x12d06e={},_0x5ac8e1={};_0x474556<_0x3ab187[_0xfeb0('0x42')];_0x474556+=0x1){_0x12d06e=_0x3ab187[_0x474556];if(_[_0xfeb0('0x43')](_0x29ee73[_0xfeb0('0x22')][_0x12d06e['id']])){_0x29ee73[_0xfeb0('0x22')][_0x12d06e['id']]=new Dynamics365Account(_0x12d06e);}else{_0x29ee73[_0xfeb0('0x3f')](_0x29ee73['dynamics365Accounts'][_0x12d06e['id']],_0x12d06e);}}}return _0x29ee73[_0xfeb0('0x22')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x50')]=function(){var _0x3ab640=this;return function(_0xfb22ad){if(_0xfb22ad){freeIsNotKey(_0xfb22ad,_0x3ab640[_0xfeb0('0x23')],'id');for(var _0x2065cd=0x0,_0x14ef45={},_0x442b84={};_0x2065cd<_0xfb22ad[_0xfeb0('0x42')];_0x2065cd+=0x1){_0x14ef45=_0xfb22ad[_0x2065cd];if(_[_0xfeb0('0x43')](_0x3ab640[_0xfeb0('0x23')][_0x14ef45['id']])){_0x3ab640[_0xfeb0('0x23')][_0x14ef45['id']]=new FreshsalesAccount(_0x14ef45);}else{_0x3ab640[_0xfeb0('0x3f')](_0x3ab640[_0xfeb0('0x23')][_0x14ef45['id']],_0x14ef45);}}}return _0x3ab640[_0xfeb0('0x23')];};};Realtime['prototype'][_0xfeb0('0x51')]=function(){var _0x2b7937=this;return function(_0x35eed5){for(var _0x3199a9=0x0;_0x3199a9<_0x35eed5[_0xfeb0('0x42')];_0x3199a9+=0x1){_[_0xfeb0('0x52')](_0x2b7937[_0xfeb0('0x13')][_0x35eed5[_0x3199a9][_0xfeb0('0x29')]],_0x35eed5[_0x3199a9]);}return _0x2b7937[_0xfeb0('0x13')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x53')]=function(){var _0x503f8e=this;return function(_0x155630){clearVoiceQueues(_0x503f8e['voiceQueues']);if(_0x155630){_0x155630=_['groupBy'](_0x155630,'uniqueid');for(var _0x3bf7d3 in _0x155630){if(_0x155630['hasOwnProperty'](_0x3bf7d3)){var _0x4ce381={};for(var _0x2be88f=0x0;_0x2be88f<_0x155630[_0x3bf7d3][_0xfeb0('0x42')];_0x2be88f+=0x1){var _0x4cfe88=_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x54')];if(_0x503f8e['voiceQueues'][_0x4cfe88]){if(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x55')]){_0x503f8e[_0xfeb0('0x13')][_0x4cfe88][_0xfeb0('0x33')]+=0x1;}if(_0x155630[_0x3bf7d3][_0x2be88f]['queuecallerabandon']){_0x503f8e[_0xfeb0('0x13')][_0x4cfe88][_0xfeb0('0x34')]+=0x1;}_0x503f8e[_0xfeb0('0x13')][_0x4cfe88]['sumHoldTime']+=moment(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x56')])[_0xfeb0('0x57')](moment(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x58')]),_0xfeb0('0x59'))||0x0;if(_0x2be88f===_0x155630[_0x3bf7d3][_0xfeb0('0x42')]-0x1){_0x503f8e['voiceQueues'][_0x4cfe88]['sumDuration']+=moment(_0x155630[_0x3bf7d3][_0x2be88f]['queuecallercompleteAt']||_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x5a')]||_0x155630[_0x3bf7d3][_0x2be88f]['queuecallerexitAt'])[_0xfeb0('0x57')](moment(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x58')]),_0xfeb0('0x59'))||0x0;_0x503f8e['voiceQueues'][_0x4cfe88]['total']+=0x1;if(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x5b')]){_0x503f8e[_0xfeb0('0x13')][_0x4cfe88][_0xfeb0('0x2c')]+=0x1;_0x503f8e[_0xfeb0('0x13')][_0x4cfe88]['sumBillable']+=moment(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x5c')])['diff'](moment(_0x155630[_0x3bf7d3][_0x2be88f][_0xfeb0('0x56')]),_0xfeb0('0x59'))||0x0;}}else{_0x503f8e[_0xfeb0('0x13')][_0x4cfe88]['sumDuration']+=_0x503f8e[_0xfeb0('0x13')][_0x4cfe88]['sumHoldTime']||0x0;}}}}}}return _0x503f8e[_0xfeb0('0x13')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x5d')]=function(){var _0x41d150=this;return function(_0x24b5f7){clearVoiceCallReports(_0x41d150[_0xfeb0('0x15')]);if(_0x24b5f7){for(var _0x32706a=0x0;_0x32706a<_0x24b5f7[_0xfeb0('0x42')];_0x32706a+=0x1){_0x41d150[_0xfeb0('0x15')][_0xfeb0('0x32')]+=0x1;_0x41d150[_0xfeb0('0x15')][_0xfeb0('0x2e')]+=_0x24b5f7[_0x32706a][_0xfeb0('0x5e')];if(_0x24b5f7[_0x32706a][_0xfeb0('0x5f')]===_0xfeb0('0x60')){_0x41d150[_0xfeb0('0x15')]['answered']+=0x1;_0x41d150[_0xfeb0('0x15')][_0xfeb0('0x2d')]+=_0x24b5f7[_0x32706a]['duration']-_0x24b5f7[_0x32706a][_0xfeb0('0x61')]||0x0;_0x41d150[_0xfeb0('0x15')]['sumBillable']+=_0x24b5f7[_0x32706a][_0xfeb0('0x61')];}}}return _0x41d150[_0xfeb0('0x15')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x62')]=function(){var _0x330195=this;return function(_0xee014b){if(_0xee014b){freeIsNotKey(_0xee014b,_0x330195['campaigns'],_0xfeb0('0x29'));for(var _0x3326b7=0x0,_0x68e26c={};_0x3326b7<_0xee014b[_0xfeb0('0x42')];_0x3326b7+=0x1){_0x68e26c=_0xee014b[_0x3326b7];if(_[_0xfeb0('0x43')](_0x330195['campaigns'][_0x68e26c[_0xfeb0('0x29')]])){_0x330195[_0xfeb0('0x63')][_0x68e26c[_0xfeb0('0x29')]]=new Campaign(_0x68e26c);}else{_0x330195[_0xfeb0('0x3f')](_0x330195[_0xfeb0('0x63')][_0x68e26c[_0xfeb0('0x29')]],_0x68e26c);_0x330195[_0xfeb0('0x63')][_0x68e26c[_0xfeb0('0x29')]][_0xfeb0('0x64')]=_0x68e26c[_0xfeb0('0x65')]?_0x68e26c[_0xfeb0('0x65')]['name']:undefined;}}}return _0x330195[_0xfeb0('0x63')];};};Realtime['prototype'][_0xfeb0('0x66')]=function(){var _0x5e33cb=this;return function(_0x2b7677){if(_0x2b7677){freeIsNotKey(_0x2b7677,_0x5e33cb[_0xfeb0('0x16')],'id');for(var _0x23e6a6=0x0,_0x44cfea={};_0x23e6a6<_0x2b7677['length'];_0x23e6a6+=0x1){_0x44cfea=_0x2b7677[_0x23e6a6];if(_[_0xfeb0('0x43')](_0x5e33cb['voiceExtensions'][_0x44cfea['id']])){_0x5e33cb[_0xfeb0('0x16')][_0x44cfea['id']]=new VoiceExtension(_0x44cfea);}else{_0x5e33cb[_0xfeb0('0x3f')](_0x5e33cb[_0xfeb0('0x16')][_0x44cfea['id']],_0x44cfea);}}}return _0x5e33cb[_0xfeb0('0x16')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x67')]=function(){var _0x58846e=this;return function(_0x2c328c){clearCampaigns(_0x58846e[_0xfeb0('0x63')]);for(var _0x50f4f9=0x0;_0x50f4f9<_0x2c328c[_0xfeb0('0x42')];_0x50f4f9+=0x1){_[_0xfeb0('0x52')](_0x58846e[_0xfeb0('0x63')][_0x2c328c[_0x50f4f9]['name']],_0x2c328c[_0x50f4f9]);}return _0x58846e[_0xfeb0('0x63')];};};Realtime[_0xfeb0('0x40')][_0xfeb0('0x68')]=function(){var _0x567538=this;return function(_0x51a847){if(_0x51a847){freeIsNotKey(_0x51a847,_0x567538[_0xfeb0('0x24')],'id');for(var _0x20e1fb=0x0,_0x1329a5={},_0x482edd={};_0x20e1fb<_0x51a847[_0xfeb0('0x42')];_0x20e1fb+=0x1){_0x1329a5=_0x51a847[_0x20e1fb];if(_[_0xfeb0('0x43')](_0x567538['faxAccounts'][_0x1329a5['id']])){_0x567538[_0xfeb0('0x24')][_0x1329a5['id']]=new FaxAccount(_0x1329a5);}else{_0x567538['mergeFromDatabase'](_0x567538['faxAccounts'][_0x1329a5['id']],_0x1329a5);}}}return _0x567538[_0xfeb0('0x24')];};};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 0a7938d..3aa0738 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 _0x3c50=['exten','connectedlinename','membername','xcally-motion-dialer','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','lastIndexOf','exports','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','SIP/%s','voiceQueueReport','length','connectedlinenum','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','calleridname','transfers','linkedid','uniqueid','UserId','monitors','monitorFilename','filename','createdAt'];(function(_0xa10fd2,_0x43c361){var _0xcc2828=function(_0x2d3f11){while(--_0x2d3f11){_0xa10fd2['push'](_0xa10fd2['shift']());}};_0xcc2828(++_0x43c361);}(_0x3c50,0x175));var _0x03c5=function(_0x15db3a,_0x5d3904){_0x15db3a=_0x15db3a-0x0;var _0x3b6a09=_0x3c50[_0x15db3a];return _0x3b6a09;};'use strict';var _=require('lodash');var moment=require(_0x03c5('0x0'));var util=require('util');var config=require(_0x03c5('0x1'));var ami=require(_0x03c5('0x2'));var RpcVoiceAgentReport=require(_0x03c5('0x3'));var RpcVoiceCallReport=require(_0x03c5('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x03c5('0x5'));var RpcVoiceQueueReport=require(_0x03c5('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x03c5('0x7'));var VoiceQueueReport=require(_0x03c5('0x8'));var VoiceCallReport=require(_0x03c5('0x9'));var VoiceAgentReport=require(_0x03c5('0xa'));var VoiceDialReport=require(_0x03c5('0xb'));var UserReport=require('./userReport');function Report(_0x59cdf2){this[_0x03c5('0xc')]=_0x59cdf2;this[_0x03c5('0xd')]=_0x59cdf2[_0x03c5('0xd')];this['telephones']=_0x59cdf2[_0x03c5('0xe')];}Report[_0x03c5('0xf')][_0x03c5('0x10')]=function(_0x96448){var _0x542ac1=new VoiceQueueReport(this[_0x03c5('0xc')]);var _0x49598a=new VoiceAgentReport(this[_0x03c5('0xc')]);var _0x428e0d=new VoiceDialReport(this[_0x03c5('0xc')]);var _0x2f10fc=new VoiceCallReport(this['realtime']);var _0x1ab336=new UserReport(this[_0x03c5('0xc')]);if(config[_0x03c5('0x11')]&&config[_0x03c5('0x11')][_0x03c5('0x12')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x03c5('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x03c5('0x14')]['bind'](this));ami['on'](_0x03c5('0x15'),this[_0x03c5('0x16')][_0x03c5('0x13')](this));ami['on'](_0x03c5('0x17'),this['voiceDialReport'][_0x03c5('0x13')](this));ami['on'](_0x03c5('0x18'),this[_0x03c5('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x03c5('0x1a')][_0x03c5('0x13')](this));}};Report[_0x03c5('0xf')][_0x03c5('0x1b')]=function(_0x66d68a){var _0x2504d0;_0x2504d0=_[_0x03c5('0x1c')](this['agents'],function(_0x5a6325){return _0x5a6325['accountcode']==_0x66d68a||_0x5a6325[_0x03c5('0x1d')]==_0x66d68a;});if(_[_0x03c5('0x1e')](_0x2504d0)){var _0x306760=_[_0x03c5('0x1c')](this[_0x03c5('0xe')],function(_0x202945){return _0x202945[_0x03c5('0x1f')]==_0x66d68a||_0x202945['name']==_0x66d68a;});if(_0x306760){_0x2504d0=_[_0x03c5('0x1c')](this['agents'],function(_0x2fa7f5){return _0x2fa7f5[_0x03c5('0x20')]==util['format'](_0x03c5('0x21'),_0x306760[_0x03c5('0x1d')]);});}}return _0x2504d0;};Report['prototype'][_0x03c5('0x22')]=function(_0x110c4d){for(var _0x2b7632=0x0;_0x2b7632<_0x110c4d[_0x03c5('0x23')];_0x2b7632+=0x1){var _0x408acb=this['findAgent'](_0x110c4d[_0x2b7632][_0x03c5('0x24')]);if(_0x408acb){_0x110c4d[_0x2b7632]['accountcode']=_0x408acb[_0x03c5('0x1f')];_0x110c4d[_0x2b7632]['assigned']=!![];_0x110c4d[_0x2b7632][_0x03c5('0x25')]=_0x408acb[_0x03c5('0x1d')];_0x110c4d[_0x2b7632]['interface']=_[_0x03c5('0x1e')](_0x408acb[_0x03c5('0x20')])?util[_0x03c5('0x26')](_0x03c5('0x21'),_0x408acb[_0x03c5('0x1d')]):_0x408acb[_0x03c5('0x20')];if(_0x110c4d[_0x2b7632][_0x03c5('0x27')]){_0x110c4d[_0x2b7632][_0x03c5('0x28')]=moment()[_0x03c5('0x26')](_0x03c5('0x29'));}if(_0x110c4d[_0x2b7632][_0x03c5('0x2a')]){_0x110c4d[_0x2b7632][_0x03c5('0x2b')]=moment()['format'](_0x03c5('0x29'));}RpcMemberReport[_0x03c5('0x22')](_0x110c4d[_0x2b7632]);}RpcVoiceQueueReport[_0x03c5('0x2c')](_0x110c4d[_0x2b7632]);}};function extractCalleridNumber(_0x1583f0){var _0x52ad22=_0x1583f0[_0x03c5('0x2d')](/<(.*?)>/);return _0x52ad22?_0x52ad22[0x1]:_0x1583f0;}Report['prototype'][_0x03c5('0x2e')]=function(_0x18d4f3){for(var _0x19d622=0x0;_0x19d622',_0x1dcfe4[_0x03c5('0x44')],_0x1dcfe4[_0x03c5('0x3f')]);}if(RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]]){var _0x39149e=RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]];_0x39149e['transfereelinkedid']=_0x1dcfe4[_0x03c5('0x47')];RpcVoiceTransferReport['blindTransfer'](_0x39149e);delete RpcVoiceTransferReport[_0x03c5('0x45')][_0x1dcfe4[_0x03c5('0x46')]];}if(_[_0x03c5('0x1e')](_0x1dcfe4[_0x03c5('0x35')])){_0x1dcfe4[_0x03c5('0x35')]=this[_0x03c5('0x30')](_0x1dcfe4);}if(_[_0x03c5('0x1e')](_0x1dcfe4[_0x03c5('0x48')])){var _0xc16154=_0x1dcfe4['channel'][_0x03c5('0x31')]('-')[0x0];var _0x15dd99=this[_0x03c5('0xd')][_0xc16154];if(!_0x15dd99)_0x15dd99=this['getAgentByInternal'](_0x1dcfe4[_0x03c5('0x1f')]);if(_0x15dd99){_0x1dcfe4[_0x03c5('0x48')]=_0x15dd99['id'];_0x1dcfe4['membername']=_0x15dd99[_0x03c5('0x1d')];}}RpcVoiceCallReport[_0x03c5('0x2c')](_0x1dcfe4);if(_0x1dcfe4['monitor']){for(var _0x263460=0x0;_0x263460<_0x1dcfe4[_0x03c5('0x49')][_0x03c5('0x23')];_0x263460+=0x1){_0x1dcfe4[_0x03c5('0x4a')]=_0x1dcfe4['monitors'][_0x263460][_0x03c5('0x4b')];_0x1dcfe4[_0x03c5('0x4c')]=_0x1dcfe4['monitors'][_0x263460][_0x03c5('0x4c')];if(_0x1dcfe4[_0x03c5('0x4d')]==_0x03c5('0x3d')){_0x1dcfe4[_0x03c5('0x3f')]=_0x1dcfe4[_0x03c5('0x24')];_0x1dcfe4[_0x03c5('0x44')]=_0x1dcfe4[_0x03c5('0x4e')];_0x1dcfe4[_0x03c5('0x24')]=_0x1dcfe4[_0x03c5('0x1f')];_0x1dcfe4['connectedlinename']=_0x1dcfe4[_0x03c5('0x4f')];_0x1dcfe4[_0x03c5('0x4d')]=_0x1dcfe4['originatecalleridnum'];}else if(_0x1dcfe4[_0x03c5('0x4d')]==_0x03c5('0x50')){_0x1dcfe4[_0x03c5('0x3f')]=_0x1dcfe4[_0x03c5('0x34')];_0x1dcfe4[_0x03c5('0x4d')]=_0x1dcfe4[_0x03c5('0x40')];}RpcVoiceRecording[_0x03c5('0x2c')](_0x1dcfe4);}}};Report[_0x03c5('0xf')]['voiceAgentReport']=function(_0x480991){if(_['isArray'](_0x480991)){_0x480991[_0x03c5('0x51')](function(_0x4e2213){RpcVoiceAgentReport['create'](_0x4e2213);});}else{RpcVoiceAgentReport[_0x03c5('0x2c')](_0x480991);}};Report[_0x03c5('0xf')][_0x03c5('0x52')]=function(_0x326f0e){RpcVoiceDialReport[_0x03c5('0x2c')](_0x326f0e);var _0x4d3078;var _0x314b4c;var _0x431aeb=_0x326f0e[_0x03c5('0x42')];if(_[_0x03c5('0x53')](_0x431aeb,_0x03c5('0x54'))){_0x314b4c=_0x431aeb[_0x03c5('0x55')](_0x431aeb[_0x03c5('0x56')]('/')+0x1,_0x431aeb[_0x03c5('0x56')]('@'));_0x4d3078=_[_0x03c5('0x1c')](this[_0x03c5('0xd')],function(_0x2058f3){return _0x2058f3[_0x03c5('0x57')]==_0x314b4c||_0x2058f3['phone']==_0x314b4c||_0x2058f3[_0x03c5('0x1f')]==_0x314b4c;});}else{_0x314b4c=_0x431aeb[_0x03c5('0x55')](_0x431aeb[_0x03c5('0x56')]('/')+0x1,_0x431aeb[_0x03c5('0x58')]('-'));_0x4d3078=this[_0x03c5('0x1b')](_0x314b4c);}if(_0x4d3078){_0x326f0e[_0x03c5('0x20')]=_[_0x03c5('0x1e')](_0x4d3078['interface'])?util['format'](_0x03c5('0x21'),_0x4d3078[_0x03c5('0x1d')]):_0x4d3078[_0x03c5('0x20')];_0x326f0e[_0x03c5('0x4f')]=_0x4d3078['name'];_0x326f0e['accountcode']=_0x4d3078[_0x03c5('0x1f')];RpcMemberReport[_0x03c5('0x52')](_0x326f0e);}};Report[_0x03c5('0xf')]['blindTransfer']=function(_0x1a2a93){RpcVoiceTransferReport['transfers'][_0x1a2a93['transfererlinkedid']]=_0x1a2a93;};Report['prototype'][_0x03c5('0x1a')]=function(_0x350c5c){RpcVoiceTransferReport[_0x03c5('0x1a')](_0x350c5c);};module[_0x03c5('0x59')]=Report; \ No newline at end of file +var _0x54ee=['membername','monitors','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','isNil','accountcode','name','find','format','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','getCallType','channel','calleridnum','internal','destination','exten','type','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','linkedid','transfereelinkedid','uniqueid','transfers','UserId','split'];(function(_0x387ed5,_0x44e590){var _0x20a79e=function(_0x54f5e5){while(--_0x54f5e5){_0x387ed5['push'](_0x387ed5['shift']());}};_0x20a79e(++_0x44e590);}(_0x54ee,0x17c));var _0xe54e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x54ee[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xe54e('0x0'));var moment=require('moment');var util=require(_0xe54e('0x1'));var config=require('../../../config/environment');var ami=require(_0xe54e('0x2'));var RpcVoiceAgentReport=require(_0xe54e('0x3'));var RpcVoiceCallReport=require(_0xe54e('0x4'));var RpcVoiceDialReport=require(_0xe54e('0x5'));var RpcMemberReport=require(_0xe54e('0x6'));var RpcVoiceQueueReport=require(_0xe54e('0x7'));var RpcVoiceRecording=require(_0xe54e('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xe54e('0x9'));var VoiceCallReport=require(_0xe54e('0xa'));var VoiceAgentReport=require(_0xe54e('0xb'));var VoiceDialReport=require(_0xe54e('0xc'));var UserReport=require(_0xe54e('0xd'));function Report(_0x14fb31){this[_0xe54e('0xe')]=_0x14fb31;this[_0xe54e('0xf')]=_0x14fb31[_0xe54e('0xf')];this[_0xe54e('0x10')]=_0x14fb31[_0xe54e('0x10')];}Report[_0xe54e('0x11')]['sync']=function(_0x4fc7e7){var _0x104033=new VoiceQueueReport(this[_0xe54e('0xe')]);var _0x3f910d=new VoiceAgentReport(this[_0xe54e('0xe')]);var _0x28af7a=new VoiceDialReport(this[_0xe54e('0xe')]);var _0x14abbf=new VoiceCallReport(this[_0xe54e('0xe')]);var _0xdd546b=new UserReport(this['realtime']);if(config[_0xe54e('0x12')]&&config['xdr'][_0xe54e('0x13')]){ami['on'](_0xe54e('0x14'),this[_0xe54e('0x15')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0xe54e('0x16')][_0xe54e('0x17')](this));ami['on']('custom:voiceAgentReport',this[_0xe54e('0x18')][_0xe54e('0x17')](this));ami['on'](_0xe54e('0x19'),this[_0xe54e('0x1a')]['bind'](this));ami['on'](_0xe54e('0x1b'),this[_0xe54e('0x1c')][_0xe54e('0x17')](this));ami['on'](_0xe54e('0x1d'),this['attendedTransfer'][_0xe54e('0x17')](this));}};Report[_0xe54e('0x11')]['findAgent']=function(_0x39376e){var _0x452a4e;_0x452a4e=_['find'](this[_0xe54e('0xf')],function(_0x3a2aba){return _0x3a2aba['accountcode']==_0x39376e||_0x3a2aba['name']==_0x39376e;});if(_[_0xe54e('0x1e')](_0x452a4e)){var _0x5eab55=_['find'](this['telephones'],function(_0x3e3527){return _0x3e3527[_0xe54e('0x1f')]==_0x39376e||_0x3e3527[_0xe54e('0x20')]==_0x39376e;});if(_0x5eab55){_0x452a4e=_[_0xe54e('0x21')](this[_0xe54e('0xf')],function(_0x521851){return _0x521851['interface']==util[_0xe54e('0x22')](_0xe54e('0x23'),_0x5eab55[_0xe54e('0x20')]);});}}return _0x452a4e;};Report[_0xe54e('0x11')][_0xe54e('0x15')]=function(_0x2d0323){for(var _0x2f9c10=0x0;_0x2f9c10<_0x2d0323[_0xe54e('0x24')];_0x2f9c10+=0x1){var _0x56faf7=this[_0xe54e('0x25')](_0x2d0323[_0x2f9c10][_0xe54e('0x26')]);if(_0x56faf7){_0x2d0323[_0x2f9c10]['accountcode']=_0x56faf7[_0xe54e('0x1f')];_0x2d0323[_0x2f9c10][_0xe54e('0x27')]=!![];_0x2d0323[_0x2f9c10][_0xe54e('0x28')]=_0x56faf7[_0xe54e('0x20')];_0x2d0323[_0x2f9c10][_0xe54e('0x29')]=_[_0xe54e('0x1e')](_0x56faf7[_0xe54e('0x29')])?util[_0xe54e('0x22')](_0xe54e('0x23'),_0x56faf7[_0xe54e('0x20')]):_0x56faf7[_0xe54e('0x29')];if(_0x2d0323[_0x2f9c10][_0xe54e('0x2a')]){_0x2d0323[_0x2f9c10][_0xe54e('0x2b')]=moment()['format'](_0xe54e('0x2c'));}if(_0x2d0323[_0x2f9c10][_0xe54e('0x2d')]){_0x2d0323[_0x2f9c10][_0xe54e('0x2e')]=moment()[_0xe54e('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x2d0323[_0x2f9c10]);}RpcVoiceQueueReport[_0xe54e('0x2f')](_0x2d0323[_0x2f9c10]);}};function extractCalleridNumber(_0x76e7e4){var _0x26e9ca=_0x76e7e4[_0xe54e('0x30')](/<(.*?)>/);return _0x26e9ca?_0x26e9ca[0x1]:_0x76e7e4;}Report[_0xe54e('0x11')][_0xe54e('0x31')]=function(_0x2d4ade){for(var _0x2a633c=0x0;_0x2a633c0x0?_0x1bdce3:0x0;this[_0x3964('0x10')][_0x59785a['queue']]['talking']=this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]][_0x3964('0x52')]>_[_0x3964('0x65')](_0x59785a[_0x3964('0x68')])?_['toNumber'](_0x59785a[_0x3964('0x68')]):this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]][_0x3964('0x52')];this[_0x3964('0x4b')](this['voiceQueues'][_0x59785a['queue']],'queuesummary');}logger['debug'](_0x3964('0x69'),util[_0x3964('0x3a')](this[_0x3964('0x10')][_0x59785a[_0x3964('0x61')]],{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')]('custom:queuesummary',this['voiceQueues'][_0x59785a[_0x3964('0x61')]]);}}}catch(_0x5d37d8){logger[_0x3964('0x37')]('[voiceQueueReport][queuesummary]',util[_0x3964('0x3a')](_0x5d37d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x18')]=function(_0x2f4f5b){logger[_0x3964('0x59')](_0x3964('0x6a'),util[_0x3964('0x3a')](_0x2f4f5b,{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')]('custom:queuesummarycomplete',{});this[_0x3964('0x11')]=!![];};VoiceQueueReport['prototype'][_0x3964('0x1a')]=function(_0x4fab77){try{if(this[_0x3964('0x5b')](_0x4fab77)){logger[_0x3964('0x59')](_0x3964('0x6b'),_0x4fab77[_0x3964('0x43')],util['inspect'](_0x4fab77,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4fab77[_0x3964('0x43')]]))this[_0x3964('0x39')][_0x4fab77['uniqueid']]=[];if(_[_0x3964('0x5c')](this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]]))this['channels'][_0x4fab77[_0x3964('0x43')]]={};var _0x377a7c=new QueueReport();_0x377a7c[_0x3964('0x45')]=_0x4fab77[_0x3964('0x61')];_0x377a7c[_0x3964('0x4c')]=this[_0x3964('0x10')][_0x377a7c[_0x3964('0x45')]]&&this['voiceQueues'][_0x377a7c[_0x3964('0x45')]][_0x3964('0x4c')]?this['voiceQueues'][_0x377a7c[_0x3964('0x45')]]['type']||_0x3964('0x6c'):_0x3964('0x6c');_0x377a7c[_0x3964('0x61')]=_0x4fab77[_0x3964('0x61')];_0x377a7c[_0x3964('0x6d')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0x377a7c[_0x3964('0x6f')]=_0x4fab77[_0x3964('0x6f')];_0x377a7c[_0x3964('0x70')]=_0x4fab77[_0x3964('0x70')];_0x377a7c[_0x3964('0x43')]=_0x4fab77[_0x3964('0x43')];_0x377a7c[_0x3964('0x71')]=this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]][_0x3964('0x71')];logger[_0x3964('0x72')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x377a7c[_0x3964('0x45')],_0x377a7c[_0x3964('0x4c')]);_[_0x3964('0x73')](_0x377a7c,_[_0x3964('0x74')](_0x4fab77,_[_0x3964('0x75')](_0x377a7c)));this[_0x3964('0x39')][_0x4fab77[_0x3964('0x43')]][_0x3964('0x76')](_0x377a7c);this[_0x3964('0xf')][_0x4fab77[_0x3964('0x43')]]=_0x377a7c;this['emitVoiceQueueChannelSave'](_0x377a7c,_0x3964('0x19'));}}catch(_0x98a98b){logger[_0x3964('0x37')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4fab77[_0x3964('0x43')],util[_0x3964('0x3a')](_0x98a98b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3964('0x1c')]=function(_0xbd2634){try{if(this['isNotNull'](_0xbd2634)){logger[_0x3964('0x59')]('[%s][voiceQueueReport][queuecallerabandon]',_0xbd2634[_0x3964('0x43')],util[_0x3964('0x3a')](_0xbd2634,{'showHidden':![],'depth':null}));if(this[_0x3964('0x39')][_0xbd2634[_0x3964('0x43')]]){var _0x1e9c18=_[_0x3964('0x77')](this['queueReports'][_0xbd2634[_0x3964('0x43')]]);_0x1e9c18[_0x3964('0x78')]=![];_0x1e9c18['queuecallercompleteAt']=null;_0x1e9c18[_0x3964('0x79')]=_0xbd2634[_0x3964('0x79')];_0x1e9c18[_0x3964('0x7a')]=_0xbd2634[_0x3964('0x7a')];_0x1e9c18[_0x3964('0x1b')]=!![];_0x1e9c18['queuecallerabandonAt']=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0x1e9c18['queuecallerexitreason']=_0x3964('0x7b');_0x1e9c18['lastAssignedTo']=null;logger[_0x3964('0x72')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x1e9c18[_0x3964('0x45')],_0x1e9c18[_0x3964('0x4c')]);this[_0x3964('0xf')][_0xbd2634[_0x3964('0x43')]]=_0x1e9c18;this[_0x3964('0x3d')](_0x1e9c18,_0x3964('0x1b'));}}}catch(_0x260db7){logger['error'](_0x3964('0x7c'),_0xbd2634[_0x3964('0x43')],util[_0x3964('0x3a')](_0x260db7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x7d')]=function(_0x1eb4af){try{if(this[_0x3964('0x5b')](_0x1eb4af)){logger['debug'](_0x3964('0x7e'),_0x1eb4af[_0x3964('0x43')],util[_0x3964('0x3a')](_0x1eb4af,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1eb4af[_0x3964('0x43')]]){var _0x4b33cf=_[_0x3964('0x77')](this['queueReports'][_0x1eb4af[_0x3964('0x43')]]);_0x4b33cf[_0x3964('0x7f')]=moment()['format'](_0x3964('0x6e'));_0x4b33cf[_0x3964('0x80')]=_0x1eb4af[_0x3964('0x80')];_0x4b33cf[_0x3964('0x81')]=_0x1eb4af[_0x3964('0x81')];logger['info'](_0x3964('0x82'),_0x4b33cf[_0x3964('0x45')],_0x4b33cf[_0x3964('0x4c')],_0x1eb4af[_0x3964('0x80')],_0x1eb4af[_0x3964('0x81')]);this[_0x3964('0xf')][_0x1eb4af['uniqueid']]=_0x4b33cf;this['emitVoiceQueueChannelSave'](_0x4b33cf,_0x3964('0x1d'));}}}catch(_0x36dc6d){logger[_0x3964('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x1eb4af[_0x3964('0x43')],util[_0x3964('0x3a')](_0x36dc6d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x83')]=function(_0x71c4fd){try{if(this[_0x3964('0x5b')](_0x71c4fd)){logger[_0x3964('0x59')](_0x3964('0x84'),_0x71c4fd[_0x3964('0x43')],util[_0x3964('0x3a')](_0x71c4fd,{'showHidden':![],'depth':null}));if(this[_0x3964('0x39')][_0x71c4fd[_0x3964('0x43')]]){var _0x4c713d=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x71c4fd[_0x3964('0x43')]]);_0x4c713d[_0x3964('0x78')]=!![];_0x4c713d[_0x3964('0x48')]=_0x3964('0x85');logger['info'](_0x3964('0x86'),_0x4c713d[_0x3964('0x45')],_0x4c713d[_0x3964('0x4c')]);}}}catch(_0x401d25){logger[_0x3964('0x37')]('[%s][voiceQueueReport][agentconnect]',_0x71c4fd[_0x3964('0x43')],util[_0x3964('0x3a')](_0x401d25,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0x1f')]=function(_0x499136){try{if(this[_0x3964('0x5b')](_0x499136)){logger['debug'](_0x3964('0x87'),_0x499136[_0x3964('0x43')],util[_0x3964('0x3a')](_0x499136,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x499136[_0x3964('0x43')]]){var _0x41e011=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]]);_0x41e011[_0x3964('0x1b')]=![];_0x41e011[_0x3964('0x88')]=null;_0x41e011['assigned']=!![];_0x41e011[_0x3964('0x89')]=_0x499136[_0x3964('0x8a')];_0x41e011[_0x3964('0x79')]=_0x499136[_0x3964('0x79')];_0x41e011['queuecallercomplete']=!![];_0x41e011[_0x3964('0x8b')]=![];_0x41e011[_0x3964('0x8c')]=null;if(!_0x41e011['transfer']){if(_0x499136[_0x3964('0x8d')]==_0x3964('0x8e')){_0x41e011[_0x3964('0x48')]=_0x3964('0x8f');logger[_0x3964('0x72')](_0x3964('0x90'),_0x41e011['name'],_0x41e011[_0x3964('0x4c')]);}else{if(_[_0x3964('0x91')](_0x499136[_0x3964('0x34')]['toLowerCase'](),_0x3964('0x92'))){if(this[_0x3964('0x39')][_0x499136['linkedid']]){var _0x92bf13=_['last'](this[_0x3964('0x39')][_0x499136[_0x3964('0x93')]]);_0x92bf13[_0x3964('0x78')]=![];_0x92bf13[_0x3964('0x8b')]=!![];_0x92bf13[_0x3964('0x8c')]=moment(_0x41e011[_0x3964('0x6d')])['add'](_0x499136[_0x3964('0x79')],_0x3964('0x94'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x92bf13['queuecallerexitreason']='FORWARDTRANSFER';_0x92bf13[_0x3964('0x8e')]=!![];_0x92bf13['transfertype']=_0x3964('0x95');_0x92bf13[_0x3964('0x96')]=_0x499136['destexten'];_0x92bf13[_0x3964('0x97')]=_0x499136['uniqueid'];logger['info'](_0x3964('0x98'),_0x92bf13[_0x3964('0x45')],_0x92bf13[_0x3964('0x4c')]);var _0x1ac5d0=this[_0x3964('0x39')][_0x499136[_0x3964('0x93')]];this[_0x3964('0x39')][_0x499136['linkedid']]=this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]];this[_0x3964('0x39')][_0x499136[_0x3964('0x43')]]=_0x1ac5d0;}}else{_0x41e011['queuecallerexitreason']=_0x3964('0x99')+_0x499136[_0x3964('0x8d')][_0x3964('0x9a')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x41e011[_0x3964('0x45')],_0x41e011['type'],_0x41e011[_0x3964('0x48')]);}}}this['channels'][_0x499136[_0x3964('0x43')]]=_0x41e011;this[_0x3964('0x3d')](_0x41e011,_0x3964('0x1e'));}}}catch(_0x1eb967){logger['error'](_0x3964('0x87'),_0x499136[_0x3964('0x43')],util[_0x3964('0x3a')](_0x1eb967,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3964('0x22')]=function(_0x3173f7){try{if(this[_0x3964('0x5b')](_0x3173f7)){logger[_0x3964('0x59')](_0x3964('0x9b'),_0x3173f7['uniqueid'],util['inspect'](_0x3173f7,{'showHidden':![],'depth':null}));this[_0x3964('0x9c')](_0x3173f7['uniqueid'],_[_0x3964('0x75')](_0x3173f7['variable'])[0x0],_0x3173f7['value']);if(this['queueReports'][_0x3173f7[_0x3964('0x43')]]){var _0xdac2a3=_[_0x3964('0x77')](this[_0x3964('0x39')][_0x3173f7[_0x3964('0x43')]]);if(_0xdac2a3){if(this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')])&&this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')][_0x3964('0x9e')])){switch(_0x3173f7[_0x3964('0x9f')]){case _0x3964('0xa0'):_0xdac2a3[_0x3964('0x8b')]=![];_0xdac2a3[_0x3964('0x8c')]=null;break;case'TIMEOUT':_0xdac2a3[_0x3964('0xa1')]=_0x3964('0xa2');_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3[_0x3964('0x8c')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));logger[_0x3964('0x59')](_0x3964('0xa3'),_0x3173f7[_0x3964('0x43')],util['inspect'](_0xdac2a3,{'showHidden':![],'depth':null}));ami[_0x3964('0x3f')](_0x3964('0xa4'),_0xdac2a3);break;default:_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3['queuecallerexitAt']=moment()[_0x3964('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));}_0xdac2a3[_0x3964('0x1b')]=![];_0xdac2a3[_0x3964('0x88')]=null;_0xdac2a3[_0x3964('0x48')]=_0x3173f7[_0x3964('0x9f')];this[_0x3964('0xf')][_0x3173f7[_0x3964('0x43')]]=_0xdac2a3;this['emitVoiceQueueChannelRemove'](_0xdac2a3,_0x3964('0x21'));}else if(this[_0x3964('0x5b')](_0x3173f7[_0x3964('0x9d')])&&this[_0x3964('0x5b')](_0x3173f7['variable'][_0x3964('0xa5')])){if(!_0xdac2a3[_0x3964('0x1b')]){_0xdac2a3[_0x3964('0x8b')]=!![];_0xdac2a3[_0x3964('0x8c')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));_0xdac2a3[_0x3964('0x48')]=_0x3964('0xa6');_0xdac2a3[_0x3964('0x7f')]=moment()[_0x3964('0x49')](_0x3964('0x6e'));this[_0x3964('0xf')][_0x3173f7['uniqueid']]=_0xdac2a3;}}logger['info'](_0x3964('0xa7'),_0x3173f7[_0x3964('0x43')],_0xdac2a3['name'],_0xdac2a3[_0x3964('0x4c')],_[_0x3964('0x75')](_0x3173f7[_0x3964('0x9d')])[0x0],_0x3173f7[_0x3964('0x9f')]);_0xdac2a3[_0x3964('0x13')]=this[_0x3964('0x13')][_0x3173f7[_0x3964('0x43')]];}}}}catch(_0x2bd18c){logger[_0x3964('0x37')](_0x3964('0x9b'),_0x3173f7[_0x3964('0x43')],util['inspect'](_0x2bd18c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3964('0x9')]['addVariable']=function(_0x43071e,_0x5d2ca5,_0x2e589b){var _0x332209=[_0x3964('0xa8'),_0x3964('0xa9'),_0x3964('0xaa'),_0x3964('0xab'),'rtpaudioqosloss',_0x3964('0xac'),_0x3964('0xad'),_0x3964('0xae'),_0x3964('0xaf'),_0x3964('0xb0'),_0x3964('0xb1'),'bridgepvtcallid','membercalls',_0x3964('0xb2'),_0x3964('0xb3'),_0x3964('0xb4'),'membername','memberpenalty',_0x3964('0xb5')];if(!_[_0x3964('0x33')](_0x5d2ca5)&&!_['includes'](_0x332209,_0x5d2ca5)){if(_[_0x3964('0x5c')](this['variables'][_0x43071e])){this[_0x3964('0x13')][_0x43071e]={};}this[_0x3964('0x13')][_0x43071e][_0x5d2ca5]=_0x2e589b;}};VoiceQueueReport[_0x3964('0x9')][_0x3964('0xb6')]=function(_0x512df5,_0x18d0b9,_0x5a8c83){var _0x13583c={};for(var _0x3b6371=0x0;_0x3b63710x0?_0x411eae:0x0;this[_0x6639('0x13')][_0x1f3bca[_0x6639('0x69')]][_0x6639('0x2f')]=this['voiceQueues'][_0x1f3bca[_0x6639('0x69')]][_0x6639('0x2f')]>_[_0x6639('0x6e')](_0x1f3bca[_0x6639('0x70')])?_[_0x6639('0x6e')](_0x1f3bca['loggedin']):this[_0x6639('0x13')][_0x1f3bca['queue']]['talking'];this[_0x6639('0x72')](this['voiceQueues'][_0x1f3bca[_0x6639('0x69')]],_0x6639('0x16'));}logger[_0x6639('0x48')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x6639('0x3d')](this[_0x6639('0x13')][_0x1f3bca[_0x6639('0x69')]],{'showHidden':![],'depth':null}));ami[_0x6639('0x46')]('custom:queuesummary',this[_0x6639('0x13')][_0x1f3bca['queue']]);}}}catch(_0x2d1076){logger[_0x6639('0x3f')]('[voiceQueueReport][queuesummary]',util[_0x6639('0x3d')](_0x2d1076,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')]['syncQueueSummaryComplete']=function(_0x8a72ff){logger['debug'](_0x6639('0x73'),util[_0x6639('0x3d')](_0x8a72ff,{'showHidden':![],'depth':null}));ami[_0x6639('0x46')](_0x6639('0x74'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0x6639('0xa')][_0x6639('0x75')]=function(_0x221951){try{if(this[_0x6639('0x62')](_0x221951)){logger[_0x6639('0x48')](_0x6639('0x76'),_0x221951['uniqueid'],util[_0x6639('0x3d')](_0x221951,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6639('0xf')][_0x221951['uniqueid']]))this[_0x6639('0xf')][_0x221951[_0x6639('0x4b')]]=[];if(_[_0x6639('0x63')](this['channels'][_0x221951[_0x6639('0x4b')]]))this[_0x6639('0x11')][_0x221951['uniqueid']]={};var _0x5bf855=new QueueReport();_0x5bf855[_0x6639('0x4d')]=_0x221951[_0x6639('0x69')];_0x5bf855[_0x6639('0x77')]=this[_0x6639('0x13')][_0x5bf855['name']]&&this[_0x6639('0x13')][_0x5bf855[_0x6639('0x4d')]][_0x6639('0x77')]?this[_0x6639('0x13')][_0x5bf855['name']][_0x6639('0x77')]||_0x6639('0x55'):_0x6639('0x55');_0x5bf855[_0x6639('0x69')]=_0x221951[_0x6639('0x69')];_0x5bf855[_0x6639('0x78')]=moment()[_0x6639('0x4c')](_0x6639('0x79'));_0x5bf855[_0x6639('0x7a')]=_0x221951[_0x6639('0x7a')];_0x5bf855['count']=_0x221951[_0x6639('0x7b')];_0x5bf855[_0x6639('0x4b')]=_0x221951['uniqueid'];_0x5bf855[_0x6639('0x7c')]=this[_0x6639('0x11')][_0x221951[_0x6639('0x4b')]]['routealias'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x5bf855[_0x6639('0x4d')],_0x5bf855[_0x6639('0x77')]);_[_0x6639('0x7d')](_0x5bf855,_[_0x6639('0x7e')](_0x221951,_[_0x6639('0x7f')](_0x5bf855)));this[_0x6639('0xf')][_0x221951[_0x6639('0x4b')]]['push'](_0x5bf855);this[_0x6639('0x11')][_0x221951[_0x6639('0x4b')]]=_0x5bf855;this[_0x6639('0x47')](_0x5bf855,_0x6639('0x1b'));}}catch(_0x4270a9){logger[_0x6639('0x3f')](_0x6639('0x76'),_0x221951['uniqueid'],util[_0x6639('0x3d')](_0x4270a9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')][_0x6639('0x1c')]=function(_0x1b2a42){try{if(this[_0x6639('0x62')](_0x1b2a42)){logger[_0x6639('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1b2a42['uniqueid'],util[_0x6639('0x3d')](_0x1b2a42,{'showHidden':![],'depth':null}));if(this[_0x6639('0xf')][_0x1b2a42['uniqueid']]){var _0x4b5476=_[_0x6639('0x80')](this[_0x6639('0xf')][_0x1b2a42[_0x6639('0x4b')]]);_0x4b5476['queuecallercomplete']=![];_0x4b5476[_0x6639('0x81')]=null;_0x4b5476[_0x6639('0x82')]=_0x1b2a42[_0x6639('0x82')];_0x4b5476[_0x6639('0x83')]=_0x1b2a42['originalposition'];_0x4b5476['queuecallerabandon']=!![];_0x4b5476[_0x6639('0x84')]=moment()[_0x6639('0x4c')](_0x6639('0x79'));_0x4b5476[_0x6639('0x51')]='ABANDONED';_0x4b5476['lastAssignedTo']=null;logger[_0x6639('0x6b')](_0x6639('0x85'),_0x4b5476['name'],_0x4b5476[_0x6639('0x77')]);this[_0x6639('0x11')][_0x1b2a42['uniqueid']]=_0x4b5476;this[_0x6639('0x44')](_0x4b5476,'queuecallerabandon');}}}catch(_0x343c9b){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x1b2a42[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x343c9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')]['syncQueueCallerLeave']=function(_0x4152b7){try{if(this[_0x6639('0x62')](_0x4152b7)){logger['debug'](_0x6639('0x86'),_0x4152b7[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x4152b7,{'showHidden':![],'depth':null}));if(this[_0x6639('0xf')][_0x4152b7[_0x6639('0x4b')]]){var _0x283c28=_[_0x6639('0x80')](this[_0x6639('0xf')][_0x4152b7[_0x6639('0x4b')]]);_0x283c28['queuecallerleaveAt']=moment()['format'](_0x6639('0x79'));_0x283c28[_0x6639('0x87')]=_0x4152b7['connectedlinenum'];_0x283c28[_0x6639('0x88')]=_0x4152b7[_0x6639('0x88')];logger[_0x6639('0x6b')](_0x6639('0x89'),_0x283c28['name'],_0x283c28[_0x6639('0x77')],_0x4152b7[_0x6639('0x87')],_0x4152b7['connectedlinename']);this['channels'][_0x4152b7['uniqueid']]=_0x283c28;this[_0x6639('0x47')](_0x283c28,_0x6639('0x1d'));}}}catch(_0x5e2ffc){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x4152b7[_0x6639('0x4b')],util['inspect'](_0x5e2ffc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')]['syncAgentConnect']=function(_0x38cca6){try{if(this[_0x6639('0x62')](_0x38cca6)){logger['debug'](_0x6639('0x8a'),_0x38cca6[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x38cca6,{'showHidden':![],'depth':null}));if(this[_0x6639('0xf')][_0x38cca6[_0x6639('0x4b')]]){var _0x1ee473=_[_0x6639('0x80')](this[_0x6639('0xf')][_0x38cca6[_0x6639('0x4b')]]);_0x1ee473['queuecallercomplete']=!![];_0x1ee473['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x6639('0x6b')](_0x6639('0x8b'),_0x1ee473[_0x6639('0x4d')],_0x1ee473['type']);}}}catch(_0x48b8c2){logger['error'](_0x6639('0x8a'),_0x38cca6[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x48b8c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')][_0x6639('0x8c')]=function(_0x3fc99e){try{if(this[_0x6639('0x62')](_0x3fc99e)){logger[_0x6639('0x48')](_0x6639('0x8d'),_0x3fc99e[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x3fc99e,{'showHidden':![],'depth':null}));if(this[_0x6639('0xf')][_0x3fc99e[_0x6639('0x4b')]]){var _0x25666c=_[_0x6639('0x80')](this['queueReports'][_0x3fc99e['uniqueid']]);_0x25666c[_0x6639('0x8e')]=![];_0x25666c[_0x6639('0x84')]=null;_0x25666c['assigned']=!![];_0x25666c['lastAssignedTo']=_0x3fc99e[_0x6639('0x8f')];_0x25666c[_0x6639('0x82')]=_0x3fc99e[_0x6639('0x82')];_0x25666c['queuecallercomplete']=!![];_0x25666c[_0x6639('0x90')]=![];_0x25666c[_0x6639('0x91')]=null;if(!_0x25666c[_0x6639('0x92')]){if(_0x3fc99e[_0x6639('0x93')]==_0x6639('0x92')){_0x25666c[_0x6639('0x51')]='COMPLETED';logger[_0x6639('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x25666c['name'],_0x25666c[_0x6639('0x77')]);}else{if(_[_0x6639('0x94')](_0x3fc99e[_0x6639('0x39')][_0x6639('0x95')](),_0x6639('0x96'))){if(this[_0x6639('0xf')][_0x3fc99e[_0x6639('0x97')]]){var _0x57805e=_[_0x6639('0x80')](this['queueReports'][_0x3fc99e[_0x6639('0x97')]]);_0x57805e[_0x6639('0x98')]=![];_0x57805e['queuecallerexit']=!![];_0x57805e[_0x6639('0x91')]=moment(_0x25666c[_0x6639('0x78')])['add'](_0x3fc99e[_0x6639('0x82')],_0x6639('0x99'))[_0x6639('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x57805e[_0x6639('0x51')]=_0x6639('0x9a');_0x57805e[_0x6639('0x92')]=!![];_0x57805e[_0x6639('0x9b')]=_0x6639('0x9c');_0x57805e['transferexten']=_0x3fc99e[_0x6639('0x9d')];_0x57805e[_0x6639('0x9e')]=_0x3fc99e[_0x6639('0x4b')];logger['info'](_0x6639('0x9f'),_0x57805e[_0x6639('0x4d')],_0x57805e[_0x6639('0x77')]);var _0x123b69=this[_0x6639('0xf')][_0x3fc99e['linkedid']];this[_0x6639('0xf')][_0x3fc99e[_0x6639('0x97')]]=this[_0x6639('0xf')][_0x3fc99e[_0x6639('0x4b')]];this['queueReports'][_0x3fc99e[_0x6639('0x4b')]]=_0x123b69;}}else{_0x25666c['queuecallerexitreason']='COMPLETEDBY'+_0x3fc99e[_0x6639('0x93')][_0x6639('0xa0')]();logger[_0x6639('0x6b')](_0x6639('0xa1'),_0x25666c['name'],_0x25666c[_0x6639('0x77')],_0x25666c[_0x6639('0x51')]);}}}this[_0x6639('0x11')][_0x3fc99e[_0x6639('0x4b')]]=_0x25666c;this['emitVoiceQueueChannelRemove'](_0x25666c,'agentcomplete');}}}catch(_0x4b48c0){logger[_0x6639('0x3f')](_0x6639('0x8d'),_0x3fc99e[_0x6639('0x4b')],util['inspect'](_0x4b48c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')][_0x6639('0x21')]=function(_0x1a0749){try{if(this['isNotNull'](_0x1a0749)){logger[_0x6639('0x48')]('[%s][voiceQueueReport][varset]',_0x1a0749[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x1a0749,{'showHidden':![],'depth':null}));this[_0x6639('0xa2')](_0x1a0749[_0x6639('0x4b')],_[_0x6639('0x7f')](_0x1a0749['variable'])[0x0],_0x1a0749[_0x6639('0xa3')]);if(this[_0x6639('0xf')][_0x1a0749[_0x6639('0x4b')]]){var _0x55865a=_[_0x6639('0x80')](this[_0x6639('0xf')][_0x1a0749[_0x6639('0x4b')]]);if(_0x55865a){if(this[_0x6639('0x62')](_0x1a0749[_0x6639('0xa4')])&&this['isNotNull'](_0x1a0749[_0x6639('0xa4')][_0x6639('0xa5')])){switch(_0x1a0749['value']){case _0x6639('0xa6'):_0x55865a['queuecallerexit']=![];_0x55865a[_0x6639('0x91')]=null;break;case'TIMEOUT':_0x55865a[_0x6639('0xa7')]='timeout';_0x55865a['queuecallerexit']=!![];_0x55865a[_0x6639('0x91')]=moment()[_0x6639('0x4c')](_0x6639('0x79'));_0x55865a[_0x6639('0xa8')]=moment()[_0x6639('0x4c')](_0x6639('0x79'));logger['debug'](_0x6639('0xa9'),_0x1a0749[_0x6639('0x4b')],util[_0x6639('0x3d')](_0x55865a,{'showHidden':![],'depth':null}));ami[_0x6639('0x46')](_0x6639('0xaa'),_0x55865a);break;default:_0x55865a[_0x6639('0x90')]=!![];_0x55865a[_0x6639('0x91')]=moment()[_0x6639('0x4c')](_0x6639('0x79'));_0x55865a['queuecallerleaveAt']=moment()['format'](_0x6639('0x79'));}_0x55865a[_0x6639('0x8e')]=![];_0x55865a['queuecallerabandonAt']=null;_0x55865a[_0x6639('0x51')]=_0x1a0749[_0x6639('0xa3')];this[_0x6639('0x11')][_0x1a0749['uniqueid']]=_0x55865a;this[_0x6639('0x44')](_0x55865a,_0x6639('0xab'));}else if(this[_0x6639('0x62')](_0x1a0749['variable'])&&this[_0x6639('0x62')](_0x1a0749['variable'][_0x6639('0xac')])){if(!_0x55865a[_0x6639('0x8e')]){_0x55865a['queuecallerexit']=!![];_0x55865a[_0x6639('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55865a[_0x6639('0x51')]=_0x6639('0xad');_0x55865a['queuecallerleaveAt']=moment()[_0x6639('0x4c')](_0x6639('0x79'));this[_0x6639('0x11')][_0x1a0749[_0x6639('0x4b')]]=_0x55865a;}}logger[_0x6639('0x6b')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x1a0749[_0x6639('0x4b')],_0x55865a[_0x6639('0x4d')],_0x55865a[_0x6639('0x77')],_[_0x6639('0x7f')](_0x1a0749[_0x6639('0xa4')])[0x0],_0x1a0749[_0x6639('0xa3')]);_0x55865a[_0x6639('0xae')]=this[_0x6639('0xae')][_0x1a0749[_0x6639('0x4b')]];}}}}catch(_0x2be70b){logger['error']('[%s][voiceQueueReport][varset]',_0x1a0749['uniqueid'],util['inspect'](_0x2be70b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6639('0xa')][_0x6639('0xa2')]=function(_0x1a4363,_0x27d387,_0x4c223e){var _0x49e2ff=[_0x6639('0xaf'),_0x6639('0xb0'),'rtpaudioqosjitter',_0x6639('0xb1'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x6639('0xb2'),_0x6639('0xb3'),_0x6639('0xb4'),_0x6639('0xb5'),'bridgepeer',_0x6639('0xb6'),_0x6639('0xb7'),'memberdynamic','memberinterface',_0x6639('0xb8'),_0x6639('0x8f'),_0x6639('0xb9'),_0x6639('0xba')];if(!_[_0x6639('0x36')](_0x27d387)&&!_[_0x6639('0xbb')](_0x49e2ff,_0x27d387)){if(_[_0x6639('0x63')](this[_0x6639('0xae')][_0x1a4363])){this['variables'][_0x1a4363]={};}this[_0x6639('0xae')][_0x1a4363][_0x27d387]=_0x4c223e;}};VoiceQueueReport[_0x6639('0xa')][_0x6639('0xbc')]=function(_0x11e349,_0x589a27,_0x48f987){var _0x1c77a7={};for(var _0x4f51ec=0x0;_0x4f51ec=0x0?moment(_0x524e39[_0x656f('0x1b')])[_0x656f('0xe')](_0x524e39[_0x656f('0x1a')],_0x656f('0xf')):null,'data1':_0x656f('0x1c'),'data2':_0x524e39[_0x656f('0x14')],'data3':_0x524e39['exten'],'data4':_0x524e39['dialstring']||null,'role':_0x656f('0x1d'),'internal':_0x524e39[_0x656f('0x14')]?_['toNumber'](_0x524e39[_0x656f('0x14')]):undefined,'uniqueid':_0x524e39[_0x656f('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xd53f=['starttime','endtime','outbound','dialstring','agent','toNumber','moment','util','../client','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','interface','TALKING','diff','queuecallerleaveAt','seconds','inbound','exten','accountcode','uniqueid','membername'];(function(_0x1bdf63,_0x5f1baa){var _0xa20608=function(_0x362228){while(--_0x362228){_0x1bdf63['push'](_0x1bdf63['shift']());}};_0xa20608(++_0x5f1baa);}(_0xd53f,0x1c0));var _0xfd53=function(_0x51bdf7,_0x105403){_0x51bdf7=_0x51bdf7-0x0;var _0x329977=_0xd53f[_0x51bdf7];return _0x329977;};'use strict';var moment=require(_0xfd53('0x0'));var _=require('lodash');var util=require(_0xfd53('0x1'));var client=require(_0xfd53('0x2'));exports['voiceQueueReport']=function(_0x2e4e9e){var _0x395e77=_0x2e4e9e['queuecallercompleteAt']||_0x2e4e9e[_0xfd53('0x3')];return client[_0xfd53('0x4')](_0xfd53('0x5'),{'body':{'channel':_0xfd53('0x6'),'membername':_0x2e4e9e[_0xfd53('0x7')],'interface':_[_0xfd53('0x8')](_0x2e4e9e['interface'])?util[_0xfd53('0x9')]('SIP/%s',_0x2e4e9e[_0xfd53('0x7')]):_0x2e4e9e[_0xfd53('0xa')],'type':_0xfd53('0xb'),'enterAt':_0x2e4e9e['queuecallerleaveAt'],'exitAt':_0x395e77,'duration':moment(_0x395e77)[_0xfd53('0xc')](_0x2e4e9e[_0xfd53('0xd')],_0xfd53('0xe')),'data1':_0xfd53('0xf'),'data2':_0x2e4e9e['calleridnum'],'data3':_0x2e4e9e[_0xfd53('0x10')],'data4':null,'data5':_0x2e4e9e['queue'],'role':'agent','internal':_0x2e4e9e[_0xfd53('0x11')]?_['toNumber'](_0x2e4e9e['accountcode']):undefined,'uniqueid':_0x2e4e9e[_0xfd53('0x12')]},'log':_0xfd53('0x5')});};exports['voiceDialReport']=function(_0x330344){return client[_0xfd53('0x4')](_0xfd53('0x5'),{'body':{'channel':_0xfd53('0x6'),'membername':_0x330344[_0xfd53('0x13')],'interface':_0x330344['interface'],'type':_0xfd53('0xb'),'enterAt':_0x330344[_0xfd53('0x14')],'exitAt':_0x330344[_0xfd53('0x15')],'duration':moment(_0x330344[_0xfd53('0x15')])[_0xfd53('0xc')](_0x330344[_0xfd53('0x14')],_0xfd53('0xe'))>=0x0?moment(_0x330344[_0xfd53('0x15')])['diff'](_0x330344[_0xfd53('0x14')],_0xfd53('0xe')):null,'data1':_0xfd53('0x16'),'data2':_0x330344[_0xfd53('0x11')],'data3':_0x330344[_0xfd53('0x10')],'data4':_0x330344[_0xfd53('0x17')]||null,'role':_0xfd53('0x18'),'internal':_0x330344[_0xfd53('0x11')]?_[_0xfd53('0x19')](_0x330344[_0xfd53('0x11')]):undefined,'uniqueid':_0x330344[_0xfd53('0x12')]},'log':_0xfd53('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 32ef712..b1a00e3 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 _0x0767=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x474f05,_0x3a9247){var _0x34ae54=function(_0x1cbb23){while(--_0x1cbb23){_0x474f05['push'](_0x474f05['shift']());}};_0x34ae54(++_0x3a9247);}(_0x0767,0x1bf));var _0x7076=function(_0x54d77a,_0xd24d65){_0x54d77a=_0x54d77a-0x0;var _0x588253=_0x0767[_0x54d77a];return _0x588253;};'use strict';var client=require(_0x7076('0x0'));exports[_0x7076('0x1')]=function(){return client[_0x7076('0x2')](_0x7076('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7076('0x4'),_0x7076('0x5')]},'log':_0x7076('0x6')});}; \ No newline at end of file +var _0xe1ee=['getSettings','ShowSetting','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xe1ee,0x158));var _0xee1e=function(_0x5acaea,_0x442cb0){_0x5acaea=_0x5acaea-0x0;var _0x509dfa=_0xe1ee[_0x5acaea];return _0x509dfa;};'use strict';var client=require(_0xee1e('0x0'));exports[_0xee1e('0x1')]=function(){return client['Request'](_0xee1e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xee1e('0x3'),'previewRecallmeReminderInterval']},'log':_0xee1e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f7b6e91..f0d1ab4 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 _0x7906=['getTemplates','Request','name','GetTemplate','../client'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0x7906,0x15d));var _0x6790=function(_0x11864a,_0x454fd5){_0x11864a=_0x11864a-0x0;var _0x1e087b=_0x7906[_0x11864a];return _0x1e087b;};'use strict';var client=require(_0x6790('0x0'));exports[_0x6790('0x1')]=function(_0x1261c7){return function(_0x55aa7b){return client[_0x6790('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x6790('0x3'),'html']},'log':_0x6790('0x4')});};}; \ No newline at end of file +var _0xd8a2=['name','../client','getTemplates','Request','GetTemplate'];(function(_0x6bc5a4,_0x569afa){var _0x4af1c1=function(_0x2da28b){while(--_0x2da28b){_0x6bc5a4['push'](_0x6bc5a4['shift']());}};_0x4af1c1(++_0x569afa);}(_0xd8a2,0x128));var _0x2d8a=function(_0xb8cdd5,_0x29c11d){_0xb8cdd5=_0xb8cdd5-0x0;var _0x4d1f81=_0xd8a2[_0xb8cdd5];return _0x4d1f81;};'use strict';var client=require(_0x2d8a('0x0'));exports[_0x2d8a('0x1')]=function(_0x1e8391){return function(_0x293824){return client[_0x2d8a('0x2')](_0x2d8a('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2d8a('0x4'),'html']},'log':_0x2d8a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 5cbc6fc..26e1e64 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 _0x1b8e=['status','Condition','operator','AnyConditions','field','Action','Actions','data3','data4','data5','data7','../client','name','channel'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x1b8e,0x1d9));var _0xe1b8=function(_0x28d4ba,_0x470d91){_0x28d4ba=_0x28d4ba-0x0;var _0x3504fc=_0x1b8e[_0x28d4ba];return _0x3504fc;};'use strict';var client=require(_0xe1b8('0x0'));exports['getTriggers']=function(_0x48cabb){return function(_0x4ee1db){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xe1b8('0x1'),_0xe1b8('0x2'),_0xe1b8('0x3')],'include':[{'model':_0xe1b8('0x4'),'as':'AllConditions','attributes':['id','field',_0xe1b8('0x5'),'value']},{'model':_0xe1b8('0x4'),'as':_0xe1b8('0x6'),'attributes':['id',_0xe1b8('0x7'),'operator','value']},{'model':_0xe1b8('0x8'),'as':_0xe1b8('0x9'),'attributes':['id','action','data1','data2',_0xe1b8('0xa'),_0xe1b8('0xb'),_0xe1b8('0xc'),'data6',_0xe1b8('0xd')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x3baf=['getTriggers','Request','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Actions','data1','data2','data5','data6','data7','../client'];(function(_0x557023,_0xe2ecfd){var _0x16c4f7=function(_0x5dbb4a){while(--_0x5dbb4a){_0x557023['push'](_0x557023['shift']());}};_0x16c4f7(++_0xe2ecfd);}(_0x3baf,0x1d3));var _0xf3ba=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0x3baf[_0x180ac2];return _0xfcaede;};'use strict';var client=require(_0xf3ba('0x0'));exports[_0xf3ba('0x1')]=function(_0x1d78da){return function(_0x5902d4){return client[_0xf3ba('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xf3ba('0x3'),_0xf3ba('0x4'),_0xf3ba('0x5')],'include':[{'model':_0xf3ba('0x6'),'as':_0xf3ba('0x7'),'attributes':['id','field',_0xf3ba('0x8'),_0xf3ba('0x9')]},{'model':_0xf3ba('0x6'),'as':_0xf3ba('0xa'),'attributes':['id',_0xf3ba('0xb'),_0xf3ba('0x8'),_0xf3ba('0x9')]},{'model':'Action','as':_0xf3ba('0xc'),'attributes':['id','action',_0xf3ba('0xd'),_0xf3ba('0xe'),'data3','data4',_0xf3ba('0xf'),_0xf3ba('0x10'),_0xf3ba('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 803eb92..f3ac211 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 _0xff25=['Request','GetTrunk','name','registry'];(function(_0x1ba6aa,_0x6e5946){var _0x4a541b=function(_0x1600c6){while(--_0x1600c6){_0x1ba6aa['push'](_0x1ba6aa['shift']());}};_0x4a541b(++_0x6e5946);}(_0xff25,0x190));var _0x5ff2=function(_0x41b09b,_0x5aa4c5){_0x41b09b=_0x41b09b-0x0;var _0x5b6061=_0xff25[_0x41b09b];return _0x5b6061;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x59179f){return function(_0x52c5fb){return client[_0x5ff2('0x0')](_0x5ff2('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5ff2('0x2'),_0x5ff2('0x3'),'defaultuser']},'log':_0x5ff2('0x1')});};}; \ No newline at end of file +var _0xd187=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x22e714,_0x38d207){var _0x1955ab=function(_0x173287){while(--_0x173287){_0x22e714['push'](_0x22e714['shift']());}};_0x1955ab(++_0x38d207);}(_0xd187,0x90));var _0x7d18=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0xd187[_0x26bcec];return _0x1049dc;};'use strict';var client=require(_0x7d18('0x0'));exports[_0x7d18('0x1')]=function(_0x3423d6){return function(_0x53af61){return client[_0x7d18('0x2')](_0x7d18('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7d18('0x4'),_0x7d18('0x5'),_0x7d18('0x6')]},'log':_0x7d18('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2ade70c..df6c0cf 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x41ca89,_0x4b3d38){var _0x1874e5=function(_0x33afc9){while(--_0x33afc9){_0x41ca89['push'](_0x41ca89['shift']());}};_0x1874e5(++_0x4b3d38);}(_0x70e0,0x17b));var _0x070e=function(_0x88b86d,_0xdf3ae4){_0x88b86d=_0x88b86d-0x0;var _0x584fea=_0x70e0[_0x88b86d];return _0x584fea;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x528ca0,_0xa5169e){var _0x32eb63=function(_0x3a9d0d){while(--_0x3a9d0d){_0x528ca0['push'](_0x528ca0['shift']());}};_0x32eb63(++_0xa5169e);}(_0x70e0,0x17b));var _0x070e=function(_0x5bf5b2,_0x221f5a){_0x5bf5b2=_0x5bf5b2-0x0;var _0x2eb929=_0x70e0[_0x5bf5b2];return _0x2eb929;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 26310b2..bb12c43 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 _0xf174=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x1a4b39,_0xc72fc8){var _0x35d48b=function(_0x530846){while(--_0x530846){_0x1a4b39['push'](_0x1a4b39['shift']());}};_0x35d48b(++_0xc72fc8);}(_0xf174,0xa8));var _0x4f17=function(_0x339bac,_0x18b94e){_0x339bac=_0x339bac-0x0;var _0x32ddd9=_0xf174[_0x339bac];return _0x32ddd9;};'use strict';var client=require(_0x4f17('0x0'));exports[_0x4f17('0x1')]=function(_0x230d27){return client[_0x4f17('0x2')](_0x4f17('0x3'),{'body':_0x230d27,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x283823,_0x1f4f1f,_0xe3f693){return client[_0x4f17('0x2')](_0x4f17('0x4'),{'body':_0x283823,'options':{'where':{'uniqueid':_0x1f4f1f,'interface':_0xe3f693,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x8666=['../client','create','CreateVoiceAgentReport','update'];(function(_0x296da5,_0x15ff68){var _0x38f517=function(_0x59edc7){while(--_0x59edc7){_0x296da5['push'](_0x296da5['shift']());}};_0x38f517(++_0x15ff68);}(_0x8666,0x170));var _0x6866=function(_0x5912cd,_0x5cc626){_0x5912cd=_0x5912cd-0x0;var _0x357e80=_0x8666[_0x5912cd];return _0x357e80;};'use strict';var client=require(_0x6866('0x0'));exports[_0x6866('0x1')]=function(_0x426f5b){return client['Request']('CreateVoiceAgentReport',{'body':_0x426f5b,'log':_0x6866('0x2')});};exports[_0x6866('0x3')]=function(_0x54e6cf,_0x19e06c,_0x50e9ba){return client['Request']('UpdateVoiceAgentReport',{'body':_0x54e6cf,'options':{'where':{'uniqueid':_0x19e06c,'interface':_0x50e9ba,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index bcab75c..8f72c64 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 _0x0d43=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','duration','billableseconds','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x0d43,0x79));var _0x30d4=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x0d43[_0x387777];return _0x3f84c0;};'use strict';var moment=require('moment');var util=require(_0x30d4('0x0'));var _=require(_0x30d4('0x1'));var client=require(_0x30d4('0x2'));exports[_0x30d4('0x3')]=function(_0x4b6dcf){return client['Request'](_0x30d4('0x4'),{'body':_[_0x30d4('0x5')](_0x4b6dcf,{'source':_0x4b6dcf[_0x30d4('0x6')],'destinationcontext':_0x4b6dcf['context'],'callerid':_0x4b6dcf['callerid'],'amaflags':_0x30d4('0x7')}),'log':_0x30d4('0x4')});};exports[_0x30d4('0x8')]=function(){return function(){return client[_0x30d4('0x9')](_0x30d4('0xa'),{'options':{'where':{'type':[_0x30d4('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x30d4('0xc'))[_0x30d4('0xd')](_0x30d4('0xe')),moment()[_0x30d4('0xf')](_0x30d4('0xc'))[_0x30d4('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x30d4('0x10'),_0x30d4('0x11'),_0x30d4('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x8e68=['endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','merge','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format'];(function(_0x3da413,_0x25e0fb){var _0x34b629=function(_0x37c478){while(--_0x37c478){_0x3da413['push'](_0x3da413['shift']());}};_0x34b629(++_0x25e0fb);}(_0x8e68,0x76));var _0x88e6=function(_0x29ff86,_0x573427){_0x29ff86=_0x29ff86-0x0;var _0x3d3a10=_0x8e68[_0x29ff86];return _0x3d3a10;};'use strict';var moment=require(_0x88e6('0x0'));var util=require(_0x88e6('0x1'));var _=require(_0x88e6('0x2'));var client=require(_0x88e6('0x3'));exports['create']=function(_0x398e73){return client[_0x88e6('0x4')]('CreateVoiceCallReport',{'body':_[_0x88e6('0x5')](_0x398e73,{'source':_0x398e73['calleridnum'],'destinationcontext':_0x398e73[_0x88e6('0x6')],'callerid':_0x398e73['callerid'],'amaflags':_0x88e6('0x7')}),'log':_0x88e6('0x8')});};exports[_0x88e6('0x9')]=function(){return function(){return client[_0x88e6('0x4')](_0x88e6('0xa'),{'options':{'where':{'type':[_0x88e6('0xb')],'createdAt':{'$between':[moment()[_0x88e6('0xc')]('day')[_0x88e6('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x88e6('0xe')](_0x88e6('0xf'))['format'](_0x88e6('0x10'))]}},'attributes':[_0x88e6('0x11'),_0x88e6('0x12'),_0x88e6('0x13'),_0x88e6('0x14')]},'log':_0x88e6('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 82c5d60..5659464 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 _0x7c71=['Request','CreateVoiceDialReport'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7c71,0x1c2));var _0x17c7=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x7c71[_0x4ded65];return _0x5864fb;};'use strict';var client=require('../client');exports['create']=function(_0x182705){return client[_0x17c7('0x0')](_0x17c7('0x1'),{'body':_0x182705,'log':_0x17c7('0x1')});}; \ No newline at end of file +var _0x2f1a=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1315b8,_0x5bcd13){var _0x3606fb=function(_0x4f4c01){while(--_0x4f4c01){_0x1315b8['push'](_0x1315b8['shift']());}};_0x3606fb(++_0x5bcd13);}(_0x2f1a,0x94));var _0xa2f1=function(_0x402b24,_0x4c9387){_0x402b24=_0x402b24-0x0;var _0x1772a2=_0x2f1a[_0x402b24];return _0x1772a2;};'use strict';var client=require(_0xa2f1('0x0'));exports[_0xa2f1('0x1')]=function(_0x2097ec){return client[_0xa2f1('0x2')](_0xa2f1('0x3'),{'body':_0x2097ec,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ad5843f..b62a47b 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 _0x2cbd=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x128e15,_0x2f7ffa){var _0x51ea35=function(_0x121aa0){while(--_0x121aa0){_0x128e15['push'](_0x128e15['shift']());}};_0x51ea35(++_0x2f7ffa);}(_0x2cbd,0x19e));var _0xd2cb=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x2cbd[_0x44ae0b];return _0x69232a;};'use strict';var client=require(_0xd2cb('0x0'));exports[_0xd2cb('0x1')]=function(){return function(){return client['Request'](_0xd2cb('0x2'),{'options':{'raw':!![],'attributes':['id',_0xd2cb('0x3'),_0xd2cb('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x422f=['GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x422f,0x1c7));var _0xf422=function(_0x5d4596,_0x3d9191){_0x5d4596=_0x5d4596-0x0;var _0x2a83b2=_0x422f[_0x5d4596];return _0x2a83b2;};'use strict';var client=require('../client');exports[_0xf422('0x0')]=function(){return function(){return client['Request'](_0xf422('0x1'),{'options':{'raw':!![],'attributes':['id',_0xf422('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf422('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 2d1bbd9..39fab9b 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 _0xf97c=['dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueTimeout','dialQueueProject'];(function(_0x7c961a,_0x59dc5e){var _0x293f1e=function(_0x3dc3e9){while(--_0x3dc3e9){_0x7c961a['push'](_0x7c961a['shift']());}};_0x293f1e(++_0x59dc5e);}(_0xf97c,0x1ba));var _0xcf97=function(_0x17ef88,_0x581af4){_0x17ef88=_0x17ef88-0x0;var _0x1dc0fc=_0xf97c[_0x17ef88];return _0x1dc0fc;};'use strict';var client=require(_0xcf97('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0xcf97('0x1')](_0xcf97('0x2'),{'options':{'raw':![],'attributes':['id',_0xcf97('0x3'),'acw','acwTimeout',_0xcf97('0x4'),_0xcf97('0x5'),_0xcf97('0x6'),'dialActive','dialMethod','dialLimitChannel','dialLimitQueue',_0xcf97('0x7'),_0xcf97('0x8'),'dialPredictiveOptimizationPercentage',_0xcf97('0x9'),_0xcf97('0xa'),_0xcf97('0xb'),'dialOriginateTimeout','dialQueueOptions',_0xcf97('0xc'),_0xcf97('0xd'),'dialCongestionMaxRetry',_0xcf97('0xe'),_0xcf97('0xf'),_0xcf97('0x10'),_0xcf97('0x11'),_0xcf97('0x12'),_0xcf97('0x13'),'dialTimezone',_0xcf97('0x14'),_0xcf97('0x15'),'dialCheckDuplicateType',_0xcf97('0x16'),_0xcf97('0x17'),_0xcf97('0x18'),'dialAMDAfterGreetingSilence',_0xcf97('0x19'),_0xcf97('0x1a'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xcf97('0x1b'),_0xcf97('0x1c'),_0xcf97('0x1d'),'dialRecallMeTimeout','dialRecallInQueue',_0xcf97('0x1e'),_0xcf97('0x1f'),'dialAgiAfterHangupClient',_0xcf97('0x20'),_0xcf97('0x5'),_0xcf97('0x21'),_0xcf97('0x22'),'dialCutDigit',_0xcf97('0x23'),_0xcf97('0x24'),_0xcf97('0x25'),'dialDropRetryFrequency','dialAbandonedMaxRetry',_0xcf97('0x26'),_0xcf97('0x27'),_0xcf97('0x28'),_0xcf97('0x29'),'dialAgentRejectRetryFrequency',_0xcf97('0x2a'),_0xcf97('0x2b'),_0xcf97('0x2c'),_0xcf97('0x2d'),_0xcf97('0x2e'),_0xcf97('0x2f')],'include':[{'model':_0xcf97('0x30'),'as':'Trunk','attributes':['id','name',_0xcf97('0x31'),_0xcf97('0x32')]},{'model':_0xcf97('0x33'),'as':'mandatoryDispositionPause','attributes':['id',_0xcf97('0x3')]},{'model':_0xcf97('0x30'),'as':_0xcf97('0x34'),'attributes':['id',_0xcf97('0x3'),_0xcf97('0x31'),_0xcf97('0x32')]},{'model':_0xcf97('0x35'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xcf97('0x35'),'as':_0xcf97('0x36'),'attributes':['id','name',_0xcf97('0x37')]}]}]},'log':_0xcf97('0x38')});};}; \ No newline at end of file +var _0x6f7f=['dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','name','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout'];(function(_0x8c0bf5,_0x2456ab){var _0x447387=function(_0x4c2469){while(--_0x4c2469){_0x8c0bf5['push'](_0x8c0bf5['shift']());}};_0x447387(++_0x2456ab);}(_0x6f7f,0x11c));var _0xf6f7=function(_0x1dce1c,_0x497547){_0x1dce1c=_0x1dce1c-0x0;var _0x4dadff=_0x6f7f[_0x1dce1c];return _0x4dadff;};'use strict';var client=require(_0xf6f7('0x0'));exports[_0xf6f7('0x1')]=function(){return function(){return client[_0xf6f7('0x2')](_0xf6f7('0x3'),{'options':{'raw':![],'attributes':['id','name','acw',_0xf6f7('0x4'),'autopause',_0xf6f7('0x5'),_0xf6f7('0x6'),_0xf6f7('0x7'),'dialMethod',_0xf6f7('0x8'),_0xf6f7('0x9'),_0xf6f7('0xa'),_0xf6f7('0xb'),_0xf6f7('0xc'),_0xf6f7('0xd'),_0xf6f7('0xe'),_0xf6f7('0xf'),_0xf6f7('0x10'),_0xf6f7('0x11'),_0xf6f7('0x12'),_0xf6f7('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0xf6f7('0x14'),_0xf6f7('0x15'),_0xf6f7('0x16'),_0xf6f7('0x17'),_0xf6f7('0x18'),_0xf6f7('0x19'),_0xf6f7('0x1a'),_0xf6f7('0x1b'),_0xf6f7('0x1c'),'dialAMDActive',_0xf6f7('0x1d'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xf6f7('0x1e'),_0xf6f7('0x1f'),'dialAMDBetweenWordsSilence',_0xf6f7('0x20'),_0xf6f7('0x21'),_0xf6f7('0x22'),'timeout',_0xf6f7('0x23'),_0xf6f7('0x24'),'dialOrderByScheduledAt',_0xf6f7('0x25'),_0xf6f7('0x26'),_0xf6f7('0x27'),'monitor_format',_0xf6f7('0x28'),'dialRandomLastDigitCallerIdNumber',_0xf6f7('0x29'),_0xf6f7('0x2a'),_0xf6f7('0x2b'),_0xf6f7('0x2c'),_0xf6f7('0x2d'),'dialAbandonedMaxRetry',_0xf6f7('0x2e'),_0xf6f7('0x2f'),_0xf6f7('0x30'),'dialAgentRejectMaxRetry',_0xf6f7('0x31'),'mandatoryDisposition',_0xf6f7('0x32'),_0xf6f7('0x33'),_0xf6f7('0x34'),_0xf6f7('0x35'),_0xf6f7('0x36')],'include':[{'model':_0xf6f7('0x37'),'as':_0xf6f7('0x37'),'attributes':['id',_0xf6f7('0x38'),'callerid',_0xf6f7('0x39')]},{'model':_0xf6f7('0x3a'),'as':_0xf6f7('0x3b'),'attributes':['id','name']},{'model':_0xf6f7('0x37'),'as':_0xf6f7('0x3c'),'attributes':['id','name',_0xf6f7('0x3d'),_0xf6f7('0x39')]},{'model':_0xf6f7('0x3e'),'as':_0xf6f7('0x3e'),'attributes':['id',_0xf6f7('0x38')],'include':[{'model':_0xf6f7('0x3e'),'as':'Intervals','attributes':['id',_0xf6f7('0x38'),_0xf6f7('0x3f')]}]}]},'log':_0xf6f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2ff1ca0..2d05f7e 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(_0x113f11,_0x645cab){var _0xeb10ab=function(_0x499650){while(--_0x499650){_0x113f11['push'](_0x113f11['shift']());}};_0xeb10ab(++_0x645cab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x43b339,_0x213319){var _0x573f74=function(_0x591d13){while(--_0x591d13){_0x43b339['push'](_0x43b339['shift']());}};_0x573f74(++_0x213319);}(_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 diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index b67a9fc..86c5a9e 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 _0x7afe=['getVoiceQueueRtPauses','Request','../client'];(function(_0xe8a9b7,_0x530de2){var _0x4b2b03=function(_0x189697){while(--_0x189697){_0xe8a9b7['push'](_0xe8a9b7['shift']());}};_0x4b2b03(++_0x530de2);}(_0x7afe,0x146));var _0xe7af=function(_0x35ff69,_0x478322){_0x35ff69=_0x35ff69-0x0;var _0x7ebcc6=_0x7afe[_0x35ff69];return _0x7ebcc6;};'use strict';var client=require(_0xe7af('0x0'));exports[_0xe7af('0x1')]=function(_0x4e195c){return function(){return client[_0xe7af('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4e195c,'paused':!![]},'raw':!![]},'log':_0xe7af('0x1')});};}; \ No newline at end of file +var _0xb62c=['getVoiceQueueRtPauses','Request'];(function(_0x2b1d5a,_0x459393){var _0x463347=function(_0x5d78ba){while(--_0x5d78ba){_0x2b1d5a['push'](_0x2b1d5a['shift']());}};_0x463347(++_0x459393);}(_0xb62c,0x1be));var _0xcb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xcb62('0x0')]=function(_0x50eb28){return function(){return client[_0xcb62('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x50eb28,'paused':!![]},'raw':!![]},'log':_0xcb62('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 644bd04..0eb2b3f 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(_0x230022,_0x49dbd8){var _0x2bd678=function(_0x41f241){while(--_0x41f241){_0x230022['push'](_0x230022['shift']());}};_0x2bd678(++_0x49dbd8);}(_0x7a54,0x106));var _0x47a5=function(_0x259936,_0x3b2bb9){_0x259936=_0x259936-0x0;var _0x4567a1=_0x7a54[_0x259936];return _0x4567a1;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2d16f7,_0x1c65bc){var _0x3118ef=function(_0x3122a5){while(--_0x3122a5){_0x2d16f7['push'](_0x2d16f7['shift']());}};_0x3118ef(++_0x1c65bc);}(_0x7a54,0x106));var _0x47a5=function(_0xfd2cfa,_0x3aa175){_0xfd2cfa=_0xfd2cfa-0x0;var _0x49fc64=_0x7a54[_0xfd2cfa];return _0x49fc64;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 17ec942..fb6a05e 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 _0x5242=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5242,0x13d));var _0x2524=function(_0x155a82,_0xcf36dc){_0x155a82=_0x155a82-0x0;var _0x587a3f=_0x5242[_0x155a82];return _0x587a3f;};'use strict';var client=require('../client');exports[_0x2524('0x0')]={};exports[_0x2524('0x1')]=function(_0x27b643){return client[_0x2524('0x2')](_0x2524('0x3'),{'body':{'result':_0x27b643[_0x2524('0x4')],'transfererchannel':_0x27b643[_0x2524('0x5')],'transferercalleridnum':_0x27b643[_0x2524('0x6')],'transferercalleridname':_0x27b643['transferercalleridname'],'transfererconnectedlinenum':_0x27b643['transfererconnectedlinenum'],'transfererconnectedlinename':_0x27b643['transfererconnectedlinename'],'transfereraccountcode':_0x27b643[_0x2524('0x7')],'transferercontext':_0x27b643[_0x2524('0x8')],'transfererexten':_0x27b643[_0x2524('0x9')],'transfererlinkedid':_0x27b643[_0x2524('0xa')],'transfereechannel':_0x27b643[_0x2524('0xb')],'transfereecalleridnum':_0x27b643[_0x2524('0xc')],'transfereecalleridname':_0x27b643[_0x2524('0xd')],'transfereeconnectedlinenum':_0x27b643[_0x2524('0xe')],'transfereeconnectedlinename':_0x27b643[_0x2524('0xf')],'transfereeaccountcode':_0x27b643[_0x2524('0x10')],'transfereecontext':_0x27b643[_0x2524('0x11')],'transfereeexten':_0x27b643['transfereeexten'],'transfereelinkedid':_0x27b643[_0x2524('0x12')],'isexternal':_0x27b643[_0x2524('0x13')],'context':_0x27b643['context'],'extension':_0x27b643['extension'],'type':_0x2524('0x14')},'log':_0x2524('0x3')});};exports[_0x2524('0x15')]=function(_0x2240bc){return client[_0x2524('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2240bc[_0x2524('0x4')],'transfererchannel':_0x2240bc[_0x2524('0x16')],'transferercalleridnum':_0x2240bc['origtransferercalleridnum'],'transferercalleridname':_0x2240bc[_0x2524('0x17')],'transfererconnectedlinenum':_0x2240bc[_0x2524('0x18')],'transfererconnectedlinename':_0x2240bc[_0x2524('0x19')],'transfereraccountcode':_0x2240bc[_0x2524('0x1a')],'transferercontext':_0x2240bc[_0x2524('0x1b')],'transfererexten':_0x2240bc[_0x2524('0x1c')],'transfererlinkedid':_0x2240bc[_0x2524('0x1d')],'transfereechannel':_0x2240bc[_0x2524('0x1e')],'transfereecalleridnum':_0x2240bc[_0x2524('0x1f')],'transfereecalleridname':_0x2240bc['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2240bc['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2240bc[_0x2524('0x20')],'transfereeaccountcode':_0x2240bc['transfertargetaccountcode'],'transfereecontext':_0x2240bc[_0x2524('0x21')],'transfereeexten':_0x2240bc[_0x2524('0x22')],'transfereelinkedid':_0x2240bc[_0x2524('0x23')],'isexternal':_0x2240bc[_0x2524('0x13')],'context':_0x2240bc['origtransferercontext'],'extension':_0x2240bc[_0x2524('0x24')],'type':_0x2524('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xde29=['origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde29,0x112));var _0x9de2=function(_0x4a9367,_0x1f99db){_0x4a9367=_0x4a9367-0x0;var _0x300ad3=_0xde29[_0x4a9367];return _0x300ad3;};'use strict';var client=require(_0x9de2('0x0'));exports[_0x9de2('0x1')]={};exports[_0x9de2('0x2')]=function(_0x493d02){return client[_0x9de2('0x3')](_0x9de2('0x4'),{'body':{'result':_0x493d02[_0x9de2('0x5')],'transfererchannel':_0x493d02['transfererchannel'],'transferercalleridnum':_0x493d02[_0x9de2('0x6')],'transferercalleridname':_0x493d02[_0x9de2('0x7')],'transfererconnectedlinenum':_0x493d02[_0x9de2('0x8')],'transfererconnectedlinename':_0x493d02[_0x9de2('0x9')],'transfereraccountcode':_0x493d02[_0x9de2('0xa')],'transferercontext':_0x493d02[_0x9de2('0xb')],'transfererexten':_0x493d02['transfererexten'],'transfererlinkedid':_0x493d02[_0x9de2('0xc')],'transfereechannel':_0x493d02[_0x9de2('0xd')],'transfereecalleridnum':_0x493d02[_0x9de2('0xe')],'transfereecalleridname':_0x493d02[_0x9de2('0xf')],'transfereeconnectedlinenum':_0x493d02[_0x9de2('0x10')],'transfereeconnectedlinename':_0x493d02['transfereeconnectedlinename'],'transfereeaccountcode':_0x493d02[_0x9de2('0x11')],'transfereecontext':_0x493d02[_0x9de2('0x12')],'transfereeexten':_0x493d02[_0x9de2('0x13')],'transfereelinkedid':_0x493d02[_0x9de2('0x14')],'isexternal':_0x493d02[_0x9de2('0x15')],'context':_0x493d02[_0x9de2('0x16')],'extension':_0x493d02[_0x9de2('0x17')],'type':_0x9de2('0x18')},'log':'CreateVoiceTransferReport'});};exports[_0x9de2('0x19')]=function(_0x4b3a93){return client['Request'](_0x9de2('0x4'),{'body':{'result':_0x4b3a93['result'],'transfererchannel':_0x4b3a93[_0x9de2('0x1a')],'transferercalleridnum':_0x4b3a93[_0x9de2('0x1b')],'transferercalleridname':_0x4b3a93[_0x9de2('0x1c')],'transfererconnectedlinenum':_0x4b3a93[_0x9de2('0x1d')],'transfererconnectedlinename':_0x4b3a93['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4b3a93['origtransfereraccountcode'],'transferercontext':_0x4b3a93[_0x9de2('0x1e')],'transfererexten':_0x4b3a93[_0x9de2('0x1f')],'transfererlinkedid':_0x4b3a93[_0x9de2('0x20')],'transfereechannel':_0x4b3a93[_0x9de2('0x21')],'transfereecalleridnum':_0x4b3a93[_0x9de2('0x22')],'transfereecalleridname':_0x4b3a93[_0x9de2('0x23')],'transfereeconnectedlinenum':_0x4b3a93[_0x9de2('0x24')],'transfereeconnectedlinename':_0x4b3a93[_0x9de2('0x25')],'transfereeaccountcode':_0x4b3a93[_0x9de2('0x26')],'transfereecontext':_0x4b3a93[_0x9de2('0x27')],'transfereeexten':_0x4b3a93[_0x9de2('0x28')],'transfereelinkedid':_0x4b3a93['transfertargetlinkedid'],'isexternal':_0x4b3a93[_0x9de2('0x15')],'context':_0x4b3a93['origtransferercontext'],'extension':_0x4b3a93[_0x9de2('0x29')],'type':_0x9de2('0x2a')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 909b9c0..daebb51 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 _0x97c1=['dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','format','%s.%s','filename','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','server','http','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','../properties','../ami','listen','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','keys','module','action','Reload','Action','then','message','join','pick','command','Command','content','catch','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97c1,0xdf));var _0x197c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x97c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var jayson=require('jayson/promise');var schema=require(_0x197c('0x2'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x197c('0x3'));var ami=require(_0x197c('0x4'));exports[_0x197c('0x5')]=function(_0x37ac05,_0x40863c,_0x4a6f09){return new Promise(function(_0x5cbff6,_0x1cb6e1){var _0x437214={'QueuePause':function(_0x60fab2){return new Promise(function(_0xfcee35){var _0x5cf5cb=util['format'](_0x197c('0x6'),'SIP',_0x60fab2[_0x197c('0x7')]);if(_0x37ac05[_0x197c('0x8')]&&_0x37ac05[_0x197c('0x8')][_0x5cf5cb]&&_0x37ac05[_0x197c('0x8')][_0x5cf5cb]['timer']){_0x37ac05[_0x197c('0x8')][_0x5cf5cb][_0x197c('0x9')]();}if(_0x37ac05[_0x197c('0xa')][_0x5cf5cb]){_0x37ac05[_0x197c('0xa')][_0x5cf5cb][_0x197c('0xb')]({'statePause':_0x60fab2['pause']?!![]:![]});}_0xfcee35({'code':0xc8,'message':_0x197c('0xc')});});},'Reload':function(_0x668f8){var _0x27e46f=this;return new Promise(function(_0x1adcfa,_0x567658){if(ami[_0x197c('0xd')]()==![]){return _0x567658(_0x27e46f[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],_0x197c('0x11')]['join']('\x20')));}_0x668f8=_['pick'](_0x668f8,_[_0x197c('0x12')](properties[_0x197c('0x13')]));_0x668f8[_0x197c('0x14')]=_0x197c('0x15');return ami[_0x197c('0x16')](_0x668f8)[_0x197c('0x17')](function(_0x437050){_0x1adcfa({'code':0xc8,'message':_0x437050[_0x197c('0x18')]});})['catch'](function(_0x372311){_0x567658(_0x27e46f['error'](0x1f5,_0x372311['message']));});});},'Command':function(_0x1725d9){var _0x226756=this;return new Promise(function(_0x2eca5e,_0x2ce10d){if(ami['isConnected']()==![]){return _0x2ce10d(_0x226756[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')]['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}_0x1725d9=_[_0x197c('0x1a')](_0x1725d9,_0x197c('0x1b'));_0x1725d9[_0x197c('0x14')]=_0x197c('0x1c');return ami[_0x197c('0x16')](_0x1725d9)[_0x197c('0x17')](function(_0x8963fd){_0x2eca5e({'code':0xc8,'message':_0x8963fd[_0x197c('0x1d')]});})[_0x197c('0x1e')](function(_0x177bc9){_0x2ce10d(_0x226756[_0x197c('0xe')](0x1f5,_0x177bc9[_0x197c('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x37b040){var _0x25486a=[];for(var _0x5f4a02 in _0x37ac05[_0x197c('0x1f')]){if(_0x37ac05[_0x197c('0x1f')][_0x197c('0x20')](_0x5f4a02)){var _0x499051=_0x37ac05[_0x197c('0x1f')][_0x5f4a02];var _0x3331ac={'id':_0x499051['id'],'name':_0x499051['name'],'strategy':_0x499051['strategy'],'answered':_0x499051[_0x197c('0x21')],'available':_0x499051['available'],'loggedIn':_0x499051[_0x197c('0x22')],'pTalking':_0x499051[_0x197c('0x23')],'sumBillable':_0x499051[_0x197c('0x24')],'sumDuration':_0x499051[_0x197c('0x25')],'sumHoldTime':_0x499051[_0x197c('0x26')]||0x0,'talking':_0x499051[_0x197c('0x27')],'total':_0x499051[_0x197c('0x28')],'type':_0x499051[_0x197c('0x29')],'unmanaged':_0x499051[_0x197c('0x2a')],'abandoned':_0x499051['abandoned'],'waiting':_0x499051['waiting'],'loggedInDb':_0x499051['loggedInDb']};if(_0x499051['type']===_0x197c('0x2b')){_0x3331ac['dialActive']=_0x499051[_0x197c('0x2c')];_0x3331ac[_0x197c('0x2d')]=_0x499051['dialMethod'];_0x3331ac[_0x197c('0x2e')]=_0x499051['dialOriginateCallerIdName'];_0x3331ac[_0x197c('0x2f')]=_0x499051[_0x197c('0x2f')];_0x3331ac[_0x197c('0x30')]=_0x499051[_0x197c('0x30')];_0x3331ac[_0x197c('0x31')]=_0x499051[_0x197c('0x31')];_0x3331ac[_0x197c('0x32')]=_0x499051[_0x197c('0x32')];_0x3331ac[_0x197c('0x33')]=_0x499051['outboundAnswerAgiCallsDay'];_0x3331ac['outboundAnswerCallsDay']=_0x499051[_0x197c('0x34')];_0x3331ac[_0x197c('0x35')]=_0x499051[_0x197c('0x35')];_0x3331ac[_0x197c('0x36')]=_0x499051[_0x197c('0x36')];_0x3331ac[_0x197c('0x37')]=_0x499051[_0x197c('0x37')];_0x3331ac['outboundDropCallsDayACS']=_0x499051['outboundDropCallsDayACS'];_0x3331ac[_0x197c('0x38')]=_0x499051[_0x197c('0x38')];_0x3331ac['outboundDropCallsDayTimeout']=_0x499051['outboundDropCallsDayTimeout'];_0x3331ac[_0x197c('0x39')]=_0x499051[_0x197c('0x39')];_0x3331ac[_0x197c('0x3a')]=_0x499051[_0x197c('0x3a')];_0x3331ac[_0x197c('0x3b')]=_0x499051[_0x197c('0x3b')];_0x3331ac[_0x197c('0x3c')]=_0x499051[_0x197c('0x3c')];_0x3331ac[_0x197c('0x3d')]=_0x499051['outboundRejectCallsDay'];_0x3331ac[_0x197c('0x3e')]=_0x499051[_0x197c('0x3e')];_0x3331ac[_0x197c('0x3f')]=_0x499051[_0x197c('0x3f')];_0x3331ac[_0x197c('0x40')]=_0x499051[_0x197c('0x40')];_0x3331ac['predictiveIntervalAvgTalktime']=_0x499051[_0x197c('0x41')];_0x3331ac[_0x197c('0x42')]=_0x499051[_0x197c('0x42')];_0x3331ac['predictiveIntervalDroppedCallsTimeout']=_0x499051[_0x197c('0x43')];_0x3331ac[_0x197c('0x44')]=_0x499051[_0x197c('0x44')];_0x3331ac[_0x197c('0x45')]=_0x499051[_0x197c('0x45')];_0x3331ac[_0x197c('0x46')]=_0x499051[_0x197c('0x46')];_0x3331ac[_0x197c('0x47')]=_0x499051[_0x197c('0x47')];_0x3331ac[_0x197c('0x48')]=_0x499051['predictiveIntervalPauses'];_0x3331ac[_0x197c('0x49')]=_0x499051[_0x197c('0x49')];_0x3331ac['predictiveIntervalTotalCalls']=_0x499051['predictiveIntervalTotalCalls'];_0x3331ac[_0x197c('0x18')]=_0x499051[_0x197c('0x18')];_0x3331ac[_0x197c('0x4a')]=_0x499051[_0x197c('0x4a')];_0x3331ac[_0x197c('0x4b')]=_0x499051['erlangCalls'];_0x3331ac[_0x197c('0x4c')]=_0x499051[_0x197c('0x4c')];_0x3331ac[_0x197c('0x4d')]=_0x499051[_0x197c('0x4d')];_0x3331ac[_0x197c('0x4e')]=_0x499051['erlangBusyFactor'];_0x3331ac[_0x197c('0x4f')]=_0x499051[_0x197c('0x4f')];_0x3331ac[_0x197c('0x50')]=_0x499051[_0x197c('0x50')];}if(_0x499051[_0x197c('0x51')]){_0x3331ac['Trunk']={'id':_0x499051[_0x197c('0x51')]['id'],'name':_0x499051[_0x197c('0x51')][_0x197c('0x7')],'active':_0x499051[_0x197c('0x51')][_0x197c('0x52')],'callerid':_0x499051[_0x197c('0x51')][_0x197c('0x53')]};}if(_0x499051[_0x197c('0x54')]){_0x3331ac[_0x197c('0x54')]={'id':_0x499051[_0x197c('0x54')]['id'],'name':_0x499051[_0x197c('0x54')]['name']};}_0x25486a['push'](_0x3331ac);}}_0x37b040({'count':_0x25486a['length'],'rows':_0x25486a});});},'UpdateVoiceQueue':function(_0x54d9d5){return new Promise(function(_0x256501,_0x34271f){var _0x5ea915=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x1f')],{'id':parseInt(_0x54d9d5['id'])});var _0x538449=_[_0x197c('0x56')](_0x54d9d5,['id']);if(_0x5ea915){for(var _0x106f24 in _0x538449){if(typeof _0x538449[_0x106f24]!=='undefined'&&typeof _0x5ea915[_0x106f24]!==_0x197c('0x57')){_0x5ea915[_0x106f24]=_0x538449[_0x106f24];}}_0x256501(_0x5ea915);}else{_0x34271f();}});},'VoiceChannels':function(){return new Promise(function(_0x233ae1){var _0x47e652=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x59')]);_0x233ae1({'count':_0x47e652[_0x197c('0x5a')],'rows':_0x47e652});});},'VoiceChannelMixMonitor':function(_0x5b4e52){var _0x3b36e5=this;return new Promise(function(_0x3f26df,_0x220909){if(ami[_0x197c('0xd')]()==![]){return _0x220909(_0x3b36e5['error'](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x3a5089=schema(properties[_0x197c('0x5b')])[_0x197c('0x2')](_0x5b4e52);if(_0x3a5089[_0x197c('0x5a')]>0x0){return _0x220909(_0x3b36e5[_0x197c('0xe')](0x1f4,_[_0x197c('0x5c')](_0x3a5089,'message')[_0x197c('0x19')](',\x20')));}var _0x5cd670=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x59')],{'uniqueid':_0x5b4e52[_0x197c('0x5d')]});if(_0x5cd670&&_0x5cd670[_0x197c('0x5e')]){var _0x34a211=util[_0x197c('0x5f')](_0x197c('0x60'),_0x5b4e52[_0x197c('0x61')]||_0x5b4e52['uniqueid'],_0x5b4e52[_0x197c('0x5f')]||_0x197c('0x62'));return ami[_0x197c('0x16')]({'action':'MixMonitor','channel':_0x5cd670[_0x197c('0x5e')],'file':_0x34a211,'options':'ai(mixmonitorid)'})[_0x197c('0x17')](function(_0x1d2a5f){var _0x1ec51a=_[_0x197c('0x55')](_0x5cd670[_0x197c('0x63')],{'filename':_0x197c('0x64')+_0x34a211[_0x197c('0x65')]()});if(_[_0x197c('0x66')](_0x1ec51a)){_0x5cd670['monitors'][_0x197c('0x67')]({'filename':_0x197c('0x64')+_0x34a211[_0x197c('0x65')](),'createdAt':moment()['format'](_0x197c('0x68')),'mixmonitorid':_0x1d2a5f[_0x197c('0x69')],'status':_0x197c('0x6a')});}else{_0x1ec51a[_0x197c('0x69')]=_0x1d2a5f[_0x197c('0x69')];_0x1ec51a['status']='rec';}_0x3f26df({'code':0xc8,'message':[_0x5b4e52[_0x197c('0x5d')],_0x197c('0x6b'),_0x1d2a5f[_0x197c('0x69')]][_0x197c('0x19')]('\x20'),'mixmonitorid':_0x1d2a5f[_0x197c('0x69')]});})['catch'](function(_0x5c2c1c){_0x220909(_0x3b36e5[_0x197c('0xe')](0x1f5,[_0x5b4e52[_0x197c('0x5d')],_0x5c2c1c['message'][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x220909(_0x3b36e5[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0xc10419){var _0x35d83a=this;return new Promise(function(_0x4e8c5b,_0x431100){if(ami[_0x197c('0xd')]()==![]){return _0x431100(_0x35d83a['error'](0x1f4,[config['asterisk']['ip'],config[_0x197c('0xf')]['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}var _0x382602=schema(properties['voicechannel'])[_0x197c('0x2')](_0xc10419);if(_0x382602[_0x197c('0x5a')]>0x0){return _0x431100(_0x35d83a['error'](0x1f4,_[_0x197c('0x5c')](_0x382602,_0x197c('0x18'))[_0x197c('0x19')](',\x20')));}var _0x5ebd0b=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x59')],{'uniqueid':_0xc10419['uniqueid']});if(_0x5ebd0b){return Promise['resolve']()[_0x197c('0x17')](function(){if(_0x5ebd0b[_0x197c('0x5e')]){return ami[_0x197c('0x16')]({'action':'StopMixMonitor','channel':_0x5ebd0b[_0x197c('0x5e')],'mixmonitorid':_0xc10419[_0x197c('0x69')]})[_0x197c('0x1e')](function(){});}})['then'](function(){if(_0x5ebd0b[_0x197c('0x6d')]){return ami[_0x197c('0x16')]({'action':_0x197c('0x6e'),'channel':_0x5ebd0b[_0x197c('0x6d')],'mixmonitorid':_0xc10419[_0x197c('0x69')]})[_0x197c('0x1e')](function(){});}})[_0x197c('0x17')](function(){var _0xaf09a=_[_0x197c('0x55')](_0x5ebd0b[_0x197c('0x63')],{'mixmonitorid':_0xc10419['mixmonitorid']});if(_0xaf09a){_0xaf09a[_0x197c('0x6f')]='stop';}})['then'](function(){var _0x4a8e13=util['format'](_0x197c('0x60'),_0xc10419[_0x197c('0x61')]||_0xc10419[_0x197c('0x5d')],_0xc10419[_0x197c('0x5f')]||'wav');var _0x32d739=_['find'](_0x5ebd0b[_0x197c('0x63')],{'filename':'/var/spool/asterisk/monitor/'+_0x4a8e13[_0x197c('0x65')]()});if(_0x32d739){_0x32d739['status']=_0x197c('0x70');}})[_0x197c('0x17')](function(){_0x4e8c5b({'code':0xc8,'message':[_0xc10419[_0x197c('0x5d')],_0x197c('0x71')]['join']('\x20')});})[_0x197c('0x1e')](function(_0x304cb7){_0x431100(_0x35d83a[_0x197c('0xe')](0x1f5,[_0xc10419['uniqueid'],_0x304cb7[_0x197c('0x18')][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x431100(_0x35d83a[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x3d1d6c){var _0x1e6371=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x72')]);_0x3d1d6c({'count':_0x1e6371[_0x197c('0x5a')],'rows':_0x1e6371});});},'VoiceQueuesChannel':function(_0x342efa){var _0x25d3c1=this;return new Promise(function(_0x43c0b2,_0x395fce){var _0x2b1c78=schema(properties[_0x197c('0x73')])[_0x197c('0x2')](_0x342efa);if(_0x2b1c78[_0x197c('0x5a')]>0x0){return _0x395fce(_0x25d3c1['error'](0x1f4,_['map'](_0x2b1c78,'message')[_0x197c('0x19')](',\x20')));}var _0x4b22f2=_[_0x197c('0x55')](_0x37ac05['queueChannels'],{'uniqueid':_0x342efa['uniqueid']});if(_0x4b22f2){_0x43c0b2(_0x4b22f2);}else{return _0x395fce(_0x25d3c1[_0x197c('0xe')](0x1f5,_0x197c('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x2b39fe){var _0x485178=this;return new Promise(function(_0x28e387,_0x238092){if(ami['isConnected']()==![]){return _0x238092(_0x485178[_0x197c('0xe')](0x1f4,[config[_0x197c('0xf')]['ip'],config[_0x197c('0xf')][_0x197c('0x10')],'ami\x20disconnected'][_0x197c('0x19')]('\x20')));}var _0x541dfa=schema(properties[_0x197c('0x74')])['validate'](_0x2b39fe);if(_0x541dfa[_0x197c('0x5a')]>0x0){return _0x238092(_0x485178[_0x197c('0xe')](0x1f4,_[_0x197c('0x5c')](_0x541dfa,'message')[_0x197c('0x19')](',\x20')));}var _0x3bd2ee=_[_0x197c('0x55')](_0x37ac05['queueChannels'],{'uniqueid':_0x2b39fe[_0x197c('0x5d')]});if(_0x3bd2ee&&_0x3bd2ee[_0x197c('0x5e')]){return ami[_0x197c('0x16')]({'action':_0x197c('0x75'),'channel':_0x3bd2ee[_0x197c('0x5e')]})[_0x197c('0x17')](function(_0x4bc7cc){_0x28e387({'code':0xc8,'message':[_0x2b39fe[_0x197c('0x5d')],_0x4bc7cc['message']['toLowerCase']()][_0x197c('0x19')]('\x20')});})[_0x197c('0x1e')](function(_0x58e708){_0x238092(_0x485178[_0x197c('0xe')](0x1f5,[_0x2b39fe[_0x197c('0x5d')],_0x58e708[_0x197c('0x18')][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')));});}else{return _0x238092(_0x485178['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x4ca9b9){var _0x5575fe=this;return new Promise(function(_0x16049c,_0x3d024b){if(ami['isConnected']()==![]){return _0x3d024b(_0x5575fe['error'](0x1f4,[config[_0x197c('0xf')]['ip'],config['asterisk']['username'],_0x197c('0x11')][_0x197c('0x19')]('\x20')));}var _0x1b2dd4=schema(properties[_0x197c('0x76')])[_0x197c('0x2')](_0x4ca9b9);if(_0x1b2dd4[_0x197c('0x5a')]>0x0){return _0x3d024b(_0x5575fe['error'](0x1f4,_[_0x197c('0x5c')](_0x1b2dd4,_0x197c('0x18'))[_0x197c('0x19')](',\x20')));}var _0xee983=_[_0x197c('0x55')](_0x37ac05[_0x197c('0x72')],{'uniqueid':_0x4ca9b9[_0x197c('0x5d')]});if(_0xee983&&_0xee983['channel']){return ami[_0x197c('0x16')]({'action':_0x197c('0x77'),'channel':_0xee983[_0x197c('0x5e')],'exten':_0x4ca9b9[_0x197c('0x78')],'context':_0x4ca9b9[_0x197c('0x79')]||_0xee983[_0x197c('0x79')],'priority':0x1})['then'](function(_0x704f3){_0x16049c({'code':0xc8,'message':[_0x4ca9b9[_0x197c('0x5d')],_0x704f3['message'][_0x197c('0x65')]()][_0x197c('0x19')]('\x20')});})[_0x197c('0x1e')](function(_0x13a742){_0x3d024b(_0x5575fe[_0x197c('0xe')](0x1f5,[_0x4ca9b9['uniqueid'],_0x13a742['message']['toLowerCase']()][_0x197c('0x19')]('\x20')));});}else{return _0x3d024b(_0x5575fe['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x1b7379){return new Promise(function(_0x23472f){var _0x3b9abb=_[_0x197c('0x58')](_0x37ac05[_0x197c('0xa')]);if(_0x1b7379&&_0x1b7379['id']){var _0x542db6=_['find'](_0x3b9abb,function(_0x29de68){return _0x29de68['id']===_0x1b7379['id'];});_0x23472f(_0x542db6);}else{_0x23472f({'count':_0x3b9abb[_0x197c('0x5a')],'rows':_0x3b9abb});}});},'Telephones':function(){return new Promise(function(_0x555cdd){var _0x2e48c9=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x7a')]);_0x555cdd({'count':_0x2e48c9[_0x197c('0x5a')],'rows':_0x2e48c9});});},'Trunks':function(){return new Promise(function(_0x1ff9ee){var _0x1d0616=_['values'](_0x37ac05[_0x197c('0x7b')]);_0x1ff9ee({'count':_0x1d0616[_0x197c('0x5a')],'rows':_0x1d0616});});},'OutboundChannels':function(){return new Promise(function(_0x40f745){var _0x26fe80=_[_0x197c('0x58')](_0x37ac05['outboundChannels']);_0x40f745({'count':_0x26fe80['length'],'rows':_0x26fe80});});},'Outbound':function(){return new Promise(function(_0xe515a1){_0xe515a1(_0x37ac05['outbound']);});},'Campaigns':function(){return new Promise(function(_0x1ea452){var _0x427adb=_[_0x197c('0x58')](_0x37ac05[_0x197c('0x7c')]);_0x1ea452({'count':_0x427adb[_0x197c('0x5a')],'rows':_0x427adb});});},'VoiceQueuesPreview':function(_0x5959b1){var _0x2b6a5d=this;return new Promise(function(_0x176413,_0x2184a3){_0x40863c[_0x197c('0x7d')](_0x5959b1['id'])['then'](function(_0x53428d){_0x176413({'code':0xc8,'message':_0x53428d[_0x197c('0x18')]});})['catch'](function(_0x5505e2){_0x2184a3(_0x2b6a5d[_0x197c('0xe')](0x1f4,_0x5505e2[_0x197c('0x18')]));});});},'EventManager':function(_0x39b79a){var _0x595eec=this;return new Promise(function(_0x4bc9af,_0x4c6322){if(!_0x39b79a[_0x197c('0x7e')]){return _0x4c6322(_0x595eec['error'](0x1f4,_0x197c('0x7f')));}ami[_0x197c('0x80')]('custom:'+_0x39b79a[_0x197c('0x7e')],_0x39b79a[_0x197c('0x18')]);_0x4bc9af({'code':0xc8,'message':_0x39b79a});});},'FaxAccounts':function(){return new Promise(function(_0x5a1026){var _0x31486a=_['values'](_0x37ac05[_0x197c('0x81')]);_0x5a1026({'count':_0x31486a[_0x197c('0x5a')],'rows':_0x31486a});});},'SendFax':function(_0x3f078b){var _0x411c58=this;return new Promise(function(_0x184623,_0x56bdf5){_0x4a6f09[_0x197c('0x82')](_0x3f078b)[_0x197c('0x17')](function(_0x35269e){_0x184623({'code':0xc8,'message':_0x35269e[_0x197c('0x18')]});})[_0x197c('0x1e')](function(_0x33c765){_0x56bdf5(_0x411c58[_0x197c('0xe')](0x1f4,_0x33c765['message']));});});},'CheckAfterSend':function(_0x3e533c){var _0x4b3538=this;return new Promise(function(_0x7b3d35,_0x3c3f7a){_0x4a6f09[_0x197c('0x83')](_0x3e533c)[_0x197c('0x17')](function(_0x4edf13){_0x7b3d35({'code':0xc8,'message':_0x4edf13[_0x197c('0x18')]});})[_0x197c('0x1e')](function(_0x1415c2){_0x3c3f7a(_0x4b3538['error'](0x1f4,_0x1415c2[_0x197c('0x18')]));});});}};var _0x33224d=jayson[_0x197c('0x84')](_0x437214)[_0x197c('0x85')]();_0x33224d['on'](_0x197c('0xe'),function(_0x67c9a3){return _0x1cb6e1(_0x67c9a3);});_0x33224d[_0x197c('0x5')](0x232a,'127.0.0.1',function(){console[_0x197c('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5cbff6(_0x197c('0x87')+0x232a);});});}; \ No newline at end of file +var _0xe3d4=['erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','join','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','voicechannel','map','resolve','StopMixMonitor','destinationchannel','status','stop','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Reload','Action','then','catch','message','command','Command','voiceQueues','strategy','answered','loggedIn','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','type','outbound','dialActive','dialMethod','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','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls'];(function(_0x1a5166,_0x2b6a26){var _0x3c022f=function(_0x96a350){while(--_0x96a350){_0x1a5166['push'](_0x1a5166['shift']());}};_0x3c022f(++_0x2b6a26);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x752005,_0x14dc74){_0x752005=_0x752005-0x0;var _0x40629c=_0xe3d4[_0x752005];return _0x40629c;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var jayson=require(_0x4e3d('0x1'));var schema=require(_0x4e3d('0x2'));var moment=require('moment');var config=require(_0x4e3d('0x3'));var properties=require(_0x4e3d('0x4'));var ami=require('../ami');exports[_0x4e3d('0x5')]=function(_0x4ece82,_0x438b9a,_0x46b757){return new Promise(function(_0x4fd5ff,_0x3eaf60){var _0x1d5c04={'QueuePause':function(_0x5b544d){return new Promise(function(_0x40b814){var _0x4275b0=util[_0x4e3d('0x6')](_0x4e3d('0x7'),_0x4e3d('0x8'),_0x5b544d[_0x4e3d('0x9')]);if(_0x4ece82['timers']&&_0x4ece82['timers'][_0x4275b0]&&_0x4ece82[_0x4e3d('0xa')][_0x4275b0][_0x4e3d('0xb')]){_0x4ece82[_0x4e3d('0xa')][_0x4275b0][_0x4e3d('0xc')]();}if(_0x4ece82[_0x4e3d('0xd')][_0x4275b0]){_0x4ece82[_0x4e3d('0xd')][_0x4275b0]['updateStatusRealtime']({'statePause':_0x5b544d[_0x4e3d('0xe')]?!![]:![]});}_0x40b814({'code':0xc8,'message':_0x4e3d('0xf')});});},'Reload':function(_0x2fc5f6){var _0x30b359=this;return new Promise(function(_0x3556ec,_0xfedcb8){if(ami[_0x4e3d('0x10')]()==![]){return _0xfedcb8(_0x30b359[_0x4e3d('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4e3d('0x12')][_0x4e3d('0x13')],_0x4e3d('0x14')]['join']('\x20')));}_0x2fc5f6=_[_0x4e3d('0x15')](_0x2fc5f6,_[_0x4e3d('0x16')](properties[_0x4e3d('0x17')]));_0x2fc5f6[_0x4e3d('0x18')]=_0x4e3d('0x19');return ami[_0x4e3d('0x1a')](_0x2fc5f6)[_0x4e3d('0x1b')](function(_0x381dc0){_0x3556ec({'code':0xc8,'message':_0x381dc0['message']});})[_0x4e3d('0x1c')](function(_0x5129d5){_0xfedcb8(_0x30b359['error'](0x1f5,_0x5129d5[_0x4e3d('0x1d')]));});});},'Command':function(_0x493949){var _0x5a2389=this;return new Promise(function(_0x46b227,_0x2e37ad){if(ami[_0x4e3d('0x10')]()==![]){return _0x2e37ad(_0x5a2389[_0x4e3d('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4e3d('0x12')]['username'],_0x4e3d('0x14')]['join']('\x20')));}_0x493949=_[_0x4e3d('0x15')](_0x493949,_0x4e3d('0x1e'));_0x493949[_0x4e3d('0x18')]=_0x4e3d('0x1f');return ami[_0x4e3d('0x1a')](_0x493949)[_0x4e3d('0x1b')](function(_0x575c72){_0x46b227({'code':0xc8,'message':_0x575c72['content']});})[_0x4e3d('0x1c')](function(_0x7a0b3c){_0x2e37ad(_0x5a2389[_0x4e3d('0x11')](0x1f5,_0x7a0b3c[_0x4e3d('0x1d')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3e6b53){var _0x58a9cb=[];for(var _0xcec7a6 in _0x4ece82[_0x4e3d('0x20')]){if(_0x4ece82[_0x4e3d('0x20')]['hasOwnProperty'](_0xcec7a6)){var _0x2434ea=_0x4ece82[_0x4e3d('0x20')][_0xcec7a6];var _0x5b1a18={'id':_0x2434ea['id'],'name':_0x2434ea[_0x4e3d('0x9')],'strategy':_0x2434ea[_0x4e3d('0x21')],'answered':_0x2434ea[_0x4e3d('0x22')],'available':_0x2434ea['available'],'loggedIn':_0x2434ea[_0x4e3d('0x23')],'pTalking':_0x2434ea['pTalking'],'sumBillable':_0x2434ea[_0x4e3d('0x24')],'sumDuration':_0x2434ea['sumDuration'],'sumHoldTime':_0x2434ea[_0x4e3d('0x25')]||0x0,'talking':_0x2434ea[_0x4e3d('0x26')],'total':_0x2434ea[_0x4e3d('0x27')],'type':_0x2434ea['type'],'unmanaged':_0x2434ea[_0x4e3d('0x28')],'abandoned':_0x2434ea[_0x4e3d('0x29')],'waiting':_0x2434ea['waiting'],'loggedInDb':_0x2434ea['loggedInDb']};if(_0x2434ea[_0x4e3d('0x2a')]===_0x4e3d('0x2b')){_0x5b1a18[_0x4e3d('0x2c')]=_0x2434ea['dialActive'];_0x5b1a18[_0x4e3d('0x2d')]=_0x2434ea[_0x4e3d('0x2d')];_0x5b1a18['dialOriginateCallerIdName']=_0x2434ea['dialOriginateCallerIdName'];_0x5b1a18[_0x4e3d('0x2e')]=_0x2434ea[_0x4e3d('0x2e')];_0x5b1a18['dialOriginateTimeout']=_0x2434ea[_0x4e3d('0x2f')];_0x5b1a18['dialPrefix']=_0x2434ea[_0x4e3d('0x30')];_0x5b1a18[_0x4e3d('0x31')]=_0x2434ea['temp'];_0x5b1a18[_0x4e3d('0x32')]=_0x2434ea[_0x4e3d('0x32')];_0x5b1a18[_0x4e3d('0x33')]=_0x2434ea['outboundAnswerCallsDay'];_0x5b1a18[_0x4e3d('0x34')]=_0x2434ea[_0x4e3d('0x34')];_0x5b1a18['outboundBusyCallsDay']=_0x2434ea[_0x4e3d('0x35')];_0x5b1a18[_0x4e3d('0x36')]=_0x2434ea['outboundCongestionCallsDay'];_0x5b1a18[_0x4e3d('0x37')]=_0x2434ea[_0x4e3d('0x37')];_0x5b1a18[_0x4e3d('0x38')]=_0x2434ea[_0x4e3d('0x38')];_0x5b1a18[_0x4e3d('0x39')]=_0x2434ea[_0x4e3d('0x39')];_0x5b1a18[_0x4e3d('0x3a')]=_0x2434ea[_0x4e3d('0x3a')];_0x5b1a18[_0x4e3d('0x3b')]=_0x2434ea[_0x4e3d('0x3b')];_0x5b1a18[_0x4e3d('0x3c')]=_0x2434ea['outboundOriginateFailureCallsDay'];_0x5b1a18[_0x4e3d('0x3d')]=_0x2434ea[_0x4e3d('0x3d')];_0x5b1a18[_0x4e3d('0x3e')]=_0x2434ea[_0x4e3d('0x3e')];_0x5b1a18[_0x4e3d('0x3f')]=_0x2434ea[_0x4e3d('0x3f')];_0x5b1a18['predictiveIntervalAnsweredCalls']=_0x2434ea[_0x4e3d('0x40')];_0x5b1a18[_0x4e3d('0x41')]=_0x2434ea[_0x4e3d('0x41')];_0x5b1a18[_0x4e3d('0x42')]=_0x2434ea[_0x4e3d('0x42')];_0x5b1a18[_0x4e3d('0x43')]=_0x2434ea[_0x4e3d('0x43')];_0x5b1a18[_0x4e3d('0x44')]=_0x2434ea[_0x4e3d('0x44')];_0x5b1a18[_0x4e3d('0x45')]=_0x2434ea[_0x4e3d('0x45')];_0x5b1a18[_0x4e3d('0x46')]=_0x2434ea[_0x4e3d('0x46')];_0x5b1a18[_0x4e3d('0x47')]=_0x2434ea[_0x4e3d('0x47')];_0x5b1a18['predictiveIntervalMultiplicativeFactor']=_0x2434ea[_0x4e3d('0x48')];_0x5b1a18['predictiveIntervalPauses']=_0x2434ea[_0x4e3d('0x49')];_0x5b1a18[_0x4e3d('0x4a')]=_0x2434ea[_0x4e3d('0x4a')];_0x5b1a18[_0x4e3d('0x4b')]=_0x2434ea[_0x4e3d('0x4b')];_0x5b1a18[_0x4e3d('0x1d')]=_0x2434ea['message'];_0x5b1a18[_0x4e3d('0x4c')]=_0x2434ea[_0x4e3d('0x4c')];_0x5b1a18[_0x4e3d('0x4d')]=_0x2434ea[_0x4e3d('0x4d')];_0x5b1a18[_0x4e3d('0x4e')]=_0x2434ea['erlangCallToSecond'];_0x5b1a18['erlangAbandonmentRate']=_0x2434ea[_0x4e3d('0x4f')];_0x5b1a18[_0x4e3d('0x50')]=_0x2434ea[_0x4e3d('0x50')];_0x5b1a18['startPredictive']=_0x2434ea[_0x4e3d('0x51')];_0x5b1a18[_0x4e3d('0x52')]=_0x2434ea['startProgressive'];}if(_0x2434ea[_0x4e3d('0x53')]){_0x5b1a18['Trunk']={'id':_0x2434ea[_0x4e3d('0x53')]['id'],'name':_0x2434ea[_0x4e3d('0x53')][_0x4e3d('0x9')],'active':_0x2434ea['Trunk'][_0x4e3d('0x54')],'callerid':_0x2434ea['Trunk'][_0x4e3d('0x55')]};}if(_0x2434ea[_0x4e3d('0x56')]){_0x5b1a18[_0x4e3d('0x56')]={'id':_0x2434ea['Interval']['id'],'name':_0x2434ea[_0x4e3d('0x56')][_0x4e3d('0x9')]};}_0x58a9cb[_0x4e3d('0x57')](_0x5b1a18);}}_0x3e6b53({'count':_0x58a9cb[_0x4e3d('0x58')],'rows':_0x58a9cb});});},'UpdateVoiceQueue':function(_0x44926a){return new Promise(function(_0x2dad49,_0xee533a){var _0xa3ff1f=_[_0x4e3d('0x59')](_0x4ece82[_0x4e3d('0x20')],{'id':parseInt(_0x44926a['id'])});var _0x5430e5=_[_0x4e3d('0x5a')](_0x44926a,['id']);if(_0xa3ff1f){for(var _0x81f3a8 in _0x5430e5){if(typeof _0x5430e5[_0x81f3a8]!==_0x4e3d('0x5b')&&typeof _0xa3ff1f[_0x81f3a8]!==_0x4e3d('0x5b')){_0xa3ff1f[_0x81f3a8]=_0x5430e5[_0x81f3a8];}}_0x2dad49(_0xa3ff1f);}else{_0xee533a();}});},'VoiceChannels':function(){return new Promise(function(_0x145ea8){var _0xa88e0=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x5d')]);_0x145ea8({'count':_0xa88e0[_0x4e3d('0x58')],'rows':_0xa88e0});});},'VoiceChannelMixMonitor':function(_0x8b1cf){var _0x21ab53=this;return new Promise(function(_0x63bcae,_0x4fba01){if(ami['isConnected']()==![]){return _0x4fba01(_0x21ab53[_0x4e3d('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x4e3d('0x12')][_0x4e3d('0x13')],_0x4e3d('0x14')][_0x4e3d('0x5e')]('\x20')));}var _0x403fa7=schema(properties['voicechannel'])[_0x4e3d('0x2')](_0x8b1cf);if(_0x403fa7[_0x4e3d('0x58')]>0x0){return _0x4fba01(_0x21ab53['error'](0x1f4,_['map'](_0x403fa7,'message')['join'](',\x20')));}var _0x393854=_[_0x4e3d('0x59')](_0x4ece82[_0x4e3d('0x5d')],{'uniqueid':_0x8b1cf[_0x4e3d('0x5f')]});if(_0x393854&&_0x393854[_0x4e3d('0x60')]){var _0x2c59ec=util[_0x4e3d('0x6')]('%s.%s',_0x8b1cf[_0x4e3d('0x61')]||_0x8b1cf[_0x4e3d('0x5f')],_0x8b1cf[_0x4e3d('0x6')]||_0x4e3d('0x62'));return ami['Action']({'action':_0x4e3d('0x63'),'channel':_0x393854[_0x4e3d('0x60')],'file':_0x2c59ec,'options':_0x4e3d('0x64')})[_0x4e3d('0x1b')](function(_0x4b074a){var _0x46bd1a=_[_0x4e3d('0x59')](_0x393854[_0x4e3d('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x2c59ec[_0x4e3d('0x66')]()});if(_[_0x4e3d('0x67')](_0x46bd1a)){_0x393854['monitors']['push']({'filename':_0x4e3d('0x68')+_0x2c59ec[_0x4e3d('0x66')](),'createdAt':moment()[_0x4e3d('0x6')](_0x4e3d('0x69')),'mixmonitorid':_0x4b074a[_0x4e3d('0x6a')],'status':'rec'});}else{_0x46bd1a['mixmonitorid']=_0x4b074a[_0x4e3d('0x6a')];_0x46bd1a['status']=_0x4e3d('0x6b');}_0x63bcae({'code':0xc8,'message':[_0x8b1cf[_0x4e3d('0x5f')],'MixMonitor\x20Success',_0x4b074a[_0x4e3d('0x6a')]][_0x4e3d('0x5e')]('\x20'),'mixmonitorid':_0x4b074a['mixmonitorid']});})[_0x4e3d('0x1c')](function(_0x518dda){_0x4fba01(_0x21ab53[_0x4e3d('0x11')](0x1f5,[_0x8b1cf[_0x4e3d('0x5f')],_0x518dda[_0x4e3d('0x1d')]['toLowerCase']()][_0x4e3d('0x5e')]('\x20')));});}else{return _0x4fba01(_0x21ab53['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x18d4f8){var _0xb9f752=this;return new Promise(function(_0x726f33,_0x30cbb0){if(ami[_0x4e3d('0x10')]()==![]){return _0x30cbb0(_0xb9f752['error'](0x1f4,[config[_0x4e3d('0x12')]['ip'],config['asterisk']['username'],'ami\x20disconnected']['join']('\x20')));}var _0x2958ca=schema(properties[_0x4e3d('0x6c')])[_0x4e3d('0x2')](_0x18d4f8);if(_0x2958ca[_0x4e3d('0x58')]>0x0){return _0x30cbb0(_0xb9f752[_0x4e3d('0x11')](0x1f4,_[_0x4e3d('0x6d')](_0x2958ca,_0x4e3d('0x1d'))[_0x4e3d('0x5e')](',\x20')));}var _0x1334c2=_['find'](_0x4ece82[_0x4e3d('0x5d')],{'uniqueid':_0x18d4f8[_0x4e3d('0x5f')]});if(_0x1334c2){return Promise[_0x4e3d('0x6e')]()['then'](function(){if(_0x1334c2['channel']){return ami[_0x4e3d('0x1a')]({'action':_0x4e3d('0x6f'),'channel':_0x1334c2[_0x4e3d('0x60')],'mixmonitorid':_0x18d4f8[_0x4e3d('0x6a')]})[_0x4e3d('0x1c')](function(){});}})[_0x4e3d('0x1b')](function(){if(_0x1334c2[_0x4e3d('0x70')]){return ami[_0x4e3d('0x1a')]({'action':_0x4e3d('0x6f'),'channel':_0x1334c2[_0x4e3d('0x70')],'mixmonitorid':_0x18d4f8[_0x4e3d('0x6a')]})['catch'](function(){});}})[_0x4e3d('0x1b')](function(){var _0x19e760=_[_0x4e3d('0x59')](_0x1334c2['monitors'],{'mixmonitorid':_0x18d4f8[_0x4e3d('0x6a')]});if(_0x19e760){_0x19e760[_0x4e3d('0x71')]=_0x4e3d('0x72');}})[_0x4e3d('0x1b')](function(){var _0x1f47eb=util[_0x4e3d('0x6')]('%s.%s',_0x18d4f8[_0x4e3d('0x61')]||_0x18d4f8[_0x4e3d('0x5f')],_0x18d4f8['format']||_0x4e3d('0x62'));var _0x3839e0=_['find'](_0x1334c2['monitors'],{'filename':_0x4e3d('0x68')+_0x1f47eb[_0x4e3d('0x66')]()});if(_0x3839e0){_0x3839e0[_0x4e3d('0x71')]='stop';}})[_0x4e3d('0x1b')](function(){_0x726f33({'code':0xc8,'message':[_0x18d4f8['uniqueid'],'StopMixMonitor\x20Success'][_0x4e3d('0x5e')]('\x20')});})[_0x4e3d('0x1c')](function(_0x594ef0){_0x30cbb0(_0xb9f752['error'](0x1f5,[_0x18d4f8[_0x4e3d('0x5f')],_0x594ef0[_0x4e3d('0x1d')][_0x4e3d('0x66')]()][_0x4e3d('0x5e')]('\x20')));});}else{return _0x30cbb0(_0xb9f752[_0x4e3d('0x11')](0x1f5,_0x4e3d('0x73')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x272382){var _0x597ec0=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x74')]);_0x272382({'count':_0x597ec0[_0x4e3d('0x58')],'rows':_0x597ec0});});},'VoiceQueuesChannel':function(_0x92e147){var _0x523dec=this;return new Promise(function(_0x5cd6a3,_0x41f6db){var _0x1a70d6=schema(properties[_0x4e3d('0x75')])[_0x4e3d('0x2')](_0x92e147);if(_0x1a70d6[_0x4e3d('0x58')]>0x0){return _0x41f6db(_0x523dec[_0x4e3d('0x11')](0x1f4,_[_0x4e3d('0x6d')](_0x1a70d6,'message')[_0x4e3d('0x5e')](',\x20')));}var _0x8bc195=_[_0x4e3d('0x59')](_0x4ece82[_0x4e3d('0x74')],{'uniqueid':_0x92e147[_0x4e3d('0x5f')]});if(_0x8bc195){_0x5cd6a3(_0x8bc195);}else{return _0x41f6db(_0x523dec[_0x4e3d('0x11')](0x1f5,_0x4e3d('0x73')));}});},'VoiceQueuesChannelHangup':function(_0x2e7d5c){var _0x388c2a=this;return new Promise(function(_0x592ee3,_0x125526){if(ami[_0x4e3d('0x10')]()==![]){return _0x125526(_0x388c2a[_0x4e3d('0x11')](0x1f4,[config[_0x4e3d('0x12')]['ip'],config['asterisk'][_0x4e3d('0x13')],_0x4e3d('0x14')][_0x4e3d('0x5e')]('\x20')));}var _0x5079b9=schema(properties[_0x4e3d('0x76')])[_0x4e3d('0x2')](_0x2e7d5c);if(_0x5079b9[_0x4e3d('0x58')]>0x0){return _0x125526(_0x388c2a[_0x4e3d('0x11')](0x1f4,_[_0x4e3d('0x6d')](_0x5079b9,_0x4e3d('0x1d'))[_0x4e3d('0x5e')](',\x20')));}var _0x2725e0=_[_0x4e3d('0x59')](_0x4ece82['queueChannels'],{'uniqueid':_0x2e7d5c[_0x4e3d('0x5f')]});if(_0x2725e0&&_0x2725e0[_0x4e3d('0x60')]){return ami[_0x4e3d('0x1a')]({'action':_0x4e3d('0x77'),'channel':_0x2725e0['channel']})['then'](function(_0x337629){_0x592ee3({'code':0xc8,'message':[_0x2e7d5c[_0x4e3d('0x5f')],_0x337629[_0x4e3d('0x1d')]['toLowerCase']()][_0x4e3d('0x5e')]('\x20')});})[_0x4e3d('0x1c')](function(_0x58f1c7){_0x125526(_0x388c2a[_0x4e3d('0x11')](0x1f5,[_0x2e7d5c[_0x4e3d('0x5f')],_0x58f1c7[_0x4e3d('0x1d')][_0x4e3d('0x66')]()]['join']('\x20')));});}else{return _0x125526(_0x388c2a['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x363f71){var _0x5895f7=this;return new Promise(function(_0x5a26a6,_0x4bb959){if(ami[_0x4e3d('0x10')]()==![]){return _0x4bb959(_0x5895f7[_0x4e3d('0x11')](0x1f4,[config[_0x4e3d('0x12')]['ip'],config[_0x4e3d('0x12')][_0x4e3d('0x13')],_0x4e3d('0x14')][_0x4e3d('0x5e')]('\x20')));}var _0x37dac9=schema(properties[_0x4e3d('0x78')])[_0x4e3d('0x2')](_0x363f71);if(_0x37dac9['length']>0x0){return _0x4bb959(_0x5895f7[_0x4e3d('0x11')](0x1f4,_[_0x4e3d('0x6d')](_0x37dac9,_0x4e3d('0x1d'))[_0x4e3d('0x5e')](',\x20')));}var _0x282e03=_[_0x4e3d('0x59')](_0x4ece82[_0x4e3d('0x74')],{'uniqueid':_0x363f71[_0x4e3d('0x5f')]});if(_0x282e03&&_0x282e03['channel']){return ami[_0x4e3d('0x1a')]({'action':_0x4e3d('0x79'),'channel':_0x282e03[_0x4e3d('0x60')],'exten':_0x363f71[_0x4e3d('0x7a')],'context':_0x363f71['context']||_0x282e03[_0x4e3d('0x7b')],'priority':0x1})['then'](function(_0x2facbe){_0x5a26a6({'code':0xc8,'message':[_0x363f71[_0x4e3d('0x5f')],_0x2facbe[_0x4e3d('0x1d')][_0x4e3d('0x66')]()][_0x4e3d('0x5e')]('\x20')});})[_0x4e3d('0x1c')](function(_0x42a7b0){_0x4bb959(_0x5895f7[_0x4e3d('0x11')](0x1f5,[_0x363f71[_0x4e3d('0x5f')],_0x42a7b0[_0x4e3d('0x1d')][_0x4e3d('0x66')]()][_0x4e3d('0x5e')]('\x20')));});}else{return _0x4bb959(_0x5895f7[_0x4e3d('0x11')](0x1f5,_0x4e3d('0x73')));}});},'Agents':function(_0x14f259){return new Promise(function(_0x125691){var _0x443bac=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0xd')]);if(_0x14f259&&_0x14f259['id']){var _0x38f5a1=_[_0x4e3d('0x59')](_0x443bac,function(_0x1455cb){return _0x1455cb['id']===_0x14f259['id'];});_0x125691(_0x38f5a1);}else{_0x125691({'count':_0x443bac[_0x4e3d('0x58')],'rows':_0x443bac});}});},'Telephones':function(){return new Promise(function(_0x37990b){var _0x417ad4=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x7c')]);_0x37990b({'count':_0x417ad4[_0x4e3d('0x58')],'rows':_0x417ad4});});},'Trunks':function(){return new Promise(function(_0x4a7469){var _0x54af5b=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x7d')]);_0x4a7469({'count':_0x54af5b[_0x4e3d('0x58')],'rows':_0x54af5b});});},'OutboundChannels':function(){return new Promise(function(_0x3d9c0d){var _0x442ba7=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x7e')]);_0x3d9c0d({'count':_0x442ba7[_0x4e3d('0x58')],'rows':_0x442ba7});});},'Outbound':function(){return new Promise(function(_0x3cad3a){_0x3cad3a(_0x4ece82[_0x4e3d('0x2b')]);});},'Campaigns':function(){return new Promise(function(_0x30e260){var _0x1129ca=_[_0x4e3d('0x5c')](_0x4ece82['campaigns']);_0x30e260({'count':_0x1129ca['length'],'rows':_0x1129ca});});},'VoiceQueuesPreview':function(_0x5b8bc1){var _0x43bbde=this;return new Promise(function(_0x14ec13,_0x58fe2d){_0x438b9a['run'](_0x5b8bc1['id'])[_0x4e3d('0x1b')](function(_0x1eb37d){_0x14ec13({'code':0xc8,'message':_0x1eb37d[_0x4e3d('0x1d')]});})[_0x4e3d('0x1c')](function(_0x5549e9){_0x58fe2d(_0x43bbde['error'](0x1f4,_0x5549e9['message']));});});},'EventManager':function(_0x102132){var _0x29db4b=this;return new Promise(function(_0x2ecc83,_0x2e4d32){if(!_0x102132['event']){return _0x2e4d32(_0x29db4b['error'](0x1f4,_0x4e3d('0x7f')));}ami['emit'](_0x4e3d('0x80')+_0x102132['event'],_0x102132['message']);_0x2ecc83({'code':0xc8,'message':_0x102132});});},'FaxAccounts':function(){return new Promise(function(_0x34e65f){var _0x48dbf5=_[_0x4e3d('0x5c')](_0x4ece82[_0x4e3d('0x81')]);_0x34e65f({'count':_0x48dbf5[_0x4e3d('0x58')],'rows':_0x48dbf5});});},'SendFax':function(_0x647fbb){var _0x298fc6=this;return new Promise(function(_0x415708,_0x224874){_0x46b757[_0x4e3d('0x82')](_0x647fbb)['then'](function(_0x9edce3){_0x415708({'code':0xc8,'message':_0x9edce3['message']});})['catch'](function(_0x38ba1f){_0x224874(_0x298fc6[_0x4e3d('0x11')](0x1f4,_0x38ba1f[_0x4e3d('0x1d')]));});});},'CheckAfterSend':function(_0xd80c52){var _0x343253=this;return new Promise(function(_0x5f0bd4,_0x23cae0){_0x46b757[_0x4e3d('0x83')](_0xd80c52)[_0x4e3d('0x1b')](function(_0x3355d5){_0x5f0bd4({'code':0xc8,'message':_0x3355d5['message']});})['catch'](function(_0x1aaae1){_0x23cae0(_0x343253[_0x4e3d('0x11')](0x1f4,_0x1aaae1[_0x4e3d('0x1d')]));});});}};var _0x2fd93b=jayson[_0x4e3d('0x84')](_0x1d5c04)[_0x4e3d('0x85')]();_0x2fd93b['on']('error',function(_0x294bd4){return _0x3eaf60(_0x294bd4);});_0x2fd93b[_0x4e3d('0x5')](0x232a,_0x4e3d('0x86'),function(){console[_0x4e3d('0x87')](_0x4e3d('0x88'),0x232a);return _0x4fd5ff(_0x4e3d('0x89')+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 a0d9296..038df83 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 _0x620f=['push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','localhost','info','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','destcalleridnum','lastName','mobile','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','','calleridname','Unknown','destcalleridname','resolve'];(function(_0x3452eb,_0x44035e){var _0x4244fd=function(_0x48564b){while(--_0x48564b){_0x3452eb['push'](_0x3452eb['shift']());}};_0x4244fd(++_0x44035e);}(_0x620f,0x1e6));var _0xf620=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x620f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var BPromise=require(_0xf620('0x0'));var Redis=require(_0xf620('0x1'));var util=require('util');var config=require(_0xf620('0x2'));var logger=require('../../../../config/logger')(_0xf620('0x3'));var cmContactRpc=require(_0xf620('0x4'));config[_0xf620('0x5')]=_['defaults'](config[_0xf620('0x5')],{'host':_0xf620('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf620('0x5')]));function emit(_0x389098,_0x3bc32c,_0x17ccd7,_0x270eba,_0xa5c852){logger[_0xf620('0x7')]('[CM][%s][%s]',_0x389098,_0x3bc32c['id'],_0x17ccd7,_0x270eba,JSON['stringify'](_0xa5c852));io['to'](_0x17ccd7)[_0xf620('0x8')](_0x270eba,_0xa5c852);}exports[_0xf620('0x9')]=function(_0x1ae887,_0x4bef57,_0x2b6188,_0x1abb5d){var _0x135d3e,_0x2b8c04;var _0x14ae95={};var _0x1f5a9a;var _0x15cd5d=Number(_0x2b6188[_0xf620('0xa')]);var _0x102730=_0x2b6188['data2']?Boolean(Number(_0x2b6188['data2'])):![];var _0x5116b3;var _0x28192e=![];if(!_[_0xf620('0xb')](_0x2b6188[_0xf620('0xc')])){if(_0x2b6188[_0xf620('0xc')]=='1')_0x28192e=!![];}if(!_0x28192e){if(_0x1abb5d[_0xf620('0xd')]){_0x14ae95['id']=_0x1abb5d[_0xf620('0xd')];}}if(!_0x14ae95['id']){_0x14ae95[_0xf620('0xe')]=_0x15cd5d;_0x5116b3=_0x2b6188[_0xf620('0xf')]&&_0x2b6188[_0xf620('0xf')]!=='0'?_0x2b6188[_0xf620('0xf')][_0xf620('0x10')](','):['phone'];_0x14ae95[_0xf620('0x11')]=_[_0xf620('0x12')](_0x5116b3,function(_0x124b32){var _0x115c42={};_0x115c42[_0x124b32]=_0x1abb5d[_0xf620('0x13')]?_0x1abb5d['destcalleridnum']:_0x1abb5d[_0xf620('0x14')];return _0x115c42;});_0x1f5a9a=_0x1abb5d[_0xf620('0x13')]?_0x1abb5d[_0xf620('0x15')]:_0x1abb5d[_0xf620('0x14')];}var _0x22505a=['id','firstName',_0xf620('0x16'),'phone',_0xf620('0x17'),'fax',_0xf620('0xe'),_0xf620('0x18'),_0xf620('0x19'),_0xf620('0x1a')];var _0x418ae1=_[_0xf620('0x1b')](_0x22505a,_0x5116b3);BPromise['resolve']()[_0xf620('0x1c')](cmContactRpc[_0xf620('0x1d')]({'attributes':_0x418ae1,'where':_0x14ae95,'phone':_0x1f5a9a}))[_0xf620('0x1c')](function(_0x66f48a){_0x2b8c04=_0x66f48a;if(!_[_0xf620('0x1e')](_0x2b8c04)){if(_0x2b8c04[_0xf620('0x1f')]===0x1){_0x135d3e=_0x2b8c04[0x0];logger[_0xf620('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1abb5d[_0xf620('0x20')],_0x4bef57['id'],_0x135d3e['id']);}else{logger[_0xf620('0x7')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x1abb5d['uniqueid'],_0x4bef57['id'],_['map'](_0x2b8c04,'id')[_0xf620('0x21')](','));}return;}else{logger[_0xf620('0x7')](_0xf620('0x22'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);var _0x27546a={'ListId':_0x15cd5d};var _0x2c8333=_0x2b6188[_0xf620('0x23')]&&_0x2b6188['data4']!=='0'?_0x2b6188['data4']:_0xf620('0x24');if(_0x102730){logger['info'](_0xf620('0x25'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);_0x27546a[_0x2c8333]=_[_0xf620('0xb')](_0x1abb5d[_0xf620('0x13')])?_0x1abb5d[_0xf620('0x14')]:_0x1abb5d[_0xf620('0x15')];if(_[_0xf620('0xb')](_0x1abb5d['routeId'])){_0x27546a[_0xf620('0x26')]=_0x1abb5d['calleridname']&&_0x1abb5d['calleridname']!==_0xf620('0x27')?_0x1abb5d[_0xf620('0x28')]:_0xf620('0x29');}else{_0x27546a[_0xf620('0x26')]=_0x1abb5d[_0xf620('0x2a')]&&_0x1abb5d[_0xf620('0x2a')]!==_0xf620('0x27')?_0x1abb5d['destcalleridname']:'Unknown';}return BPromise[_0xf620('0x2b')]()[_0xf620('0x1c')](cmContactRpc['createContact'](_0x27546a))[_0xf620('0x1c')](function(_0x7d9f10){_0x135d3e=_0x7d9f10;_0x2b8c04[_0xf620('0x2c')](_0x7d9f10);if(_0x135d3e){logger[_0xf620('0x7')](_0xf620('0x2d'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id'],_0x135d3e['id']);}return;});}else{logger[_0xf620('0x7')](_0xf620('0x2e'),_0x1abb5d[_0xf620('0x20')],_0x4bef57['id']);_0x27546a[_0x2c8333]=_[_0xf620('0xb')](_0x1abb5d['routeId'])?_0x1abb5d[_0xf620('0x14')]:_0x1abb5d[_0xf620('0x15')];if(_[_0xf620('0xb')](_0x1abb5d[_0xf620('0x13')])){_0x27546a[_0xf620('0x26')]=_0x1abb5d['calleridname']&&_0x1abb5d['calleridname']!==_0xf620('0x27')?_0x1abb5d[_0xf620('0x28')]:_0xf620('0x29');}else{_0x27546a[_0xf620('0x26')]=_0x1abb5d[_0xf620('0x2a')]&&_0x1abb5d[_0xf620('0x2a')]!==''?_0x1abb5d[_0xf620('0x2a')]:_0xf620('0x29');}_0x135d3e=_0x27546a;_0x2b8c04['push'](_0x27546a);return;}}})[_0xf620('0x1c')](function(){if(_0x1ae887){emit(_0x1abb5d[_0xf620('0x20')],_0x4bef57,util[_0xf620('0x2f')]('user:%s',_0x1ae887[_0xf620('0x30')]),util[_0xf620('0x2f')](_0xf620('0x31'),_0x2b6188[_0xf620('0x32')][_0xf620('0x33')]()),{'evt':_[_0xf620('0x34')](_0x1abb5d,{'autoCreate':_0x102730}),'contact':_0x135d3e===undefined?{}:_0x135d3e,'contacts':_0x2b8c04[_0xf620('0x1f')]===0x0?undefined:_0x2b8c04});}});}; \ No newline at end of file +var _0x40cb=['destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','redis','localhost','socket.io-emitter','info','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown'];(function(_0x4d9931,_0x3825b9){var _0x288ed9=function(_0x2ddd23){while(--_0x2ddd23){_0x4d9931['push'](_0x4d9931['shift']());}};_0x288ed9(++_0x3825b9);}(_0x40cb,0x105));var _0xb40c=function(_0x1c0dec,_0x2672ce){_0x1c0dec=_0x1c0dec-0x0;var _0x4ea01e=_0x40cb[_0x1c0dec];return _0x4ea01e;};'use strict';var _=require(_0xb40c('0x0'));var BPromise=require(_0xb40c('0x1'));var Redis=require(_0xb40c('0x2'));var util=require(_0xb40c('0x3'));var config=require(_0xb40c('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xb40c('0x5')]=_['defaults'](config[_0xb40c('0x5')],{'host':_0xb40c('0x6'),'port':0x18eb});var io=require(_0xb40c('0x7'))(new Redis(config[_0xb40c('0x5')]));function emit(_0xb0f2db,_0xb2c233,_0x374e92,_0x36c330,_0x29cbc7){logger[_0xb40c('0x8')]('[CM][%s][%s]',_0xb0f2db,_0xb2c233['id'],_0x374e92,_0x36c330,JSON['stringify'](_0x29cbc7));io['to'](_0x374e92)[_0xb40c('0x9')](_0x36c330,_0x29cbc7);}exports[_0xb40c('0xa')]=function(_0x55d108,_0xf1b0ba,_0x28a283,_0x947ccc){var _0x365af1,_0x2c8ba7;var _0x1ab9b7={};var _0x4d9701;var _0xf6e8fc=Number(_0x28a283['data1']);var _0x6a8623=_0x28a283[_0xb40c('0xb')]?Boolean(Number(_0x28a283['data2'])):![];var _0x2d0f99;var _0x2240e1=![];if(!_[_0xb40c('0xc')](_0x28a283['data5'])){if(_0x28a283[_0xb40c('0xd')]=='1')_0x2240e1=!![];}if(!_0x2240e1){if(_0x947ccc[_0xb40c('0xe')]){_0x1ab9b7['id']=_0x947ccc['xmd-contactid'];}}if(!_0x1ab9b7['id']){_0x1ab9b7[_0xb40c('0xf')]=_0xf6e8fc;_0x2d0f99=_0x28a283[_0xb40c('0x10')]&&_0x28a283[_0xb40c('0x10')]!=='0'?_0x28a283[_0xb40c('0x10')][_0xb40c('0x11')](','):[_0xb40c('0x12')];_0x1ab9b7['$or']=_['map'](_0x2d0f99,function(_0x486acc){var _0x56c7f8={};_0x56c7f8[_0x486acc]=_0x947ccc[_0xb40c('0x13')]?_0x947ccc[_0xb40c('0x14')]:_0x947ccc[_0xb40c('0x15')];return _0x56c7f8;});_0x4d9701=_0x947ccc[_0xb40c('0x13')]?_0x947ccc['destcalleridnum']:_0x947ccc[_0xb40c('0x15')];}var _0x349f35=['id',_0xb40c('0x16'),_0xb40c('0x17'),'phone',_0xb40c('0x18'),_0xb40c('0x19'),'ListId','createdAt','scheduledAt','updatedAt'];var _0x9f24cd=_['union'](_0x349f35,_0x2d0f99);BPromise['resolve']()[_0xb40c('0x1a')](cmContactRpc[_0xb40c('0x1b')]({'attributes':_0x9f24cd,'where':_0x1ab9b7,'phone':_0x4d9701}))[_0xb40c('0x1a')](function(_0x17c54b){_0x2c8ba7=_0x17c54b;if(!_[_0xb40c('0x1c')](_0x2c8ba7)){if(_0x2c8ba7[_0xb40c('0x1d')]===0x1){_0x365af1=_0x2c8ba7[0x0];logger[_0xb40c('0x8')](_0xb40c('0x1e'),_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id'],_0x365af1['id']);}else{logger[_0xb40c('0x8')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id'],_[_0xb40c('0x20')](_0x2c8ba7,'id')[_0xb40c('0x21')](','));}return;}else{logger['info'](_0xb40c('0x22'),_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id']);var _0x4e9d07={'ListId':_0xf6e8fc};var _0x5838d8=_0x28a283['data4']&&_0x28a283[_0xb40c('0x23')]!=='0'?_0x28a283[_0xb40c('0x23')]:'phone';if(_0x6a8623){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id']);_0x4e9d07[_0x5838d8]=_[_0xb40c('0xc')](_0x947ccc[_0xb40c('0x13')])?_0x947ccc[_0xb40c('0x15')]:_0x947ccc[_0xb40c('0x14')];if(_[_0xb40c('0xc')](_0x947ccc[_0xb40c('0x13')])){_0x4e9d07[_0xb40c('0x16')]=_0x947ccc[_0xb40c('0x24')]&&_0x947ccc['calleridname']!==_0xb40c('0x25')?_0x947ccc['calleridname']:_0xb40c('0x26');}else{_0x4e9d07['firstName']=_0x947ccc[_0xb40c('0x27')]&&_0x947ccc['destcalleridname']!==_0xb40c('0x25')?_0x947ccc[_0xb40c('0x27')]:_0xb40c('0x26');}return BPromise[_0xb40c('0x28')]()[_0xb40c('0x1a')](cmContactRpc[_0xb40c('0x29')](_0x4e9d07))['then'](function(_0x454ad3){_0x365af1=_0x454ad3;_0x2c8ba7[_0xb40c('0x2a')](_0x454ad3);if(_0x365af1){logger['info'](_0xb40c('0x2b'),_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id'],_0x365af1['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x947ccc[_0xb40c('0x1f')],_0xf1b0ba['id']);_0x4e9d07[_0x5838d8]=_[_0xb40c('0xc')](_0x947ccc[_0xb40c('0x13')])?_0x947ccc[_0xb40c('0x15')]:_0x947ccc[_0xb40c('0x14')];if(_[_0xb40c('0xc')](_0x947ccc['routeId'])){_0x4e9d07[_0xb40c('0x16')]=_0x947ccc['calleridname']&&_0x947ccc['calleridname']!==_0xb40c('0x25')?_0x947ccc['calleridname']:_0xb40c('0x26');}else{_0x4e9d07[_0xb40c('0x16')]=_0x947ccc[_0xb40c('0x27')]&&_0x947ccc[_0xb40c('0x27')]!==_0xb40c('0x25')?_0x947ccc[_0xb40c('0x27')]:_0xb40c('0x26');}_0x365af1=_0x4e9d07;_0x2c8ba7[_0xb40c('0x2a')](_0x4e9d07);return;}}})[_0xb40c('0x1a')](function(){if(_0x55d108){emit(_0x947ccc['uniqueid'],_0xf1b0ba,util[_0xb40c('0x2c')](_0xb40c('0x2d'),_0x55d108[_0xb40c('0x2e')]),util[_0xb40c('0x2c')](_0xb40c('0x2f'),_0x28a283[_0xb40c('0x30')]['toLowerCase']()),{'evt':_[_0xb40c('0x31')](_0x947ccc,{'autoCreate':_0x6a8623}),'contact':_0x365af1===undefined?{}:_0x365af1,'contacts':_0x2c8ba7[_0xb40c('0x1d')]===0x0?undefined:_0x2c8ba7});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index a48ab16..0f499c8 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 _0x3646=['zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','undefined','motionChannel','voice','interface','checkTriggers','status','checkTrigger','variables','length','Actions','action','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','uriLocation','800','data6','600','winApplication','winArguments','user:%s','name','format','trigger:%s:%s','toLowerCase','merge','trigger:%s','contactmanager','exec','queue','script','parse','query','search','replace','channel','every','AllConditions','checkConditions','some','account','chat','ChatWebsiteId','operator','AccountId','value','upperFirst','message','event','membername','lastevent','routeId','null','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions'];(function(_0x2b6bd4,_0x4f9e70){var _0x14a4b6=function(_0x1b5249){while(--_0x1b5249){_0x2b6bd4['push'](_0x2b6bd4['shift']());}};_0x14a4b6(++_0x4f9e70);}(_0x3646,0x15f));var _0x6364=function(_0x2c5b8b,_0x37d01d){_0x2c5b8b=_0x2c5b8b-0x0;var _0x17995b=_0x3646[_0x2c5b8b];return _0x17995b;};'use strict';var util=require(_0x6364('0x0'));var _=require(_0x6364('0x1'));var url=require(_0x6364('0x2'));var Mustache=require(_0x6364('0x3'));var Redis=require('ioredis');var urlforward=require(_0x6364('0x4'));var integration=require(_0x6364('0x5'));var cmContact=require(_0x6364('0x6'));var script=require(_0x6364('0x7'));var config=require(_0x6364('0x8'));var logger=require(_0x6364('0x9'))(_0x6364('0xa'));var ami=require(_0x6364('0xb'));config[_0x6364('0xc')]=_[_0x6364('0xd')](config[_0x6364('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x6364('0xe'))(new Redis(config[_0x6364('0xc')]));var operators={'equals':function(_0x171f98,_0x1747c6){return _0x171f98==_0x1747c6;},'not_equals':function(_0x4945cd,_0x4bf364){return _0x4945cd!=_0x4bf364;}};var barAndWebActions=['popup',_0x6364('0x2'),_0x6364('0xf')];function Trigger(_0x4646a5){this[_0x6364('0x10')]=_0x4646a5[_0x6364('0x10')];this[_0x6364('0x11')]=_0x4646a5[_0x6364('0x11')];this['voiceQueues']=_0x4646a5[_0x6364('0x12')];this[_0x6364('0x13')]=_0x4646a5[_0x6364('0x13')];this['voiceExtensions']=_0x4646a5[_0x6364('0x14')];this[_0x6364('0x15')]=_0x4646a5[_0x6364('0x15')];this[_0x6364('0x16')]=_0x4646a5['freshdeskAccounts'];this[_0x6364('0x17')]=_0x4646a5['salesforceAccounts'];this[_0x6364('0x18')]=_0x4646a5[_0x6364('0x18')];this[_0x6364('0x19')]=_0x4646a5['zohoAccounts'];this[_0x6364('0x1a')]=_0x4646a5[_0x6364('0x1a')];this[_0x6364('0x1b')]=_0x4646a5[_0x6364('0x1b')];this[_0x6364('0x1c')]=_0x4646a5[_0x6364('0x1c')];this[_0x6364('0x1d')]=_0x4646a5['dynamics365Accounts'];this[_0x6364('0x1e')]=_0x4646a5['freshsalesAccounts'];this[_0x6364('0x1f')]={'zendesk':this[_0x6364('0x15')],'salesforce':this[_0x6364('0x17')],'freshdesk':this[_0x6364('0x16')],'sugarcrm':this[_0x6364('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0x6364('0x1a')],'vtiger':this[_0x6364('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x6364('0x1e')],'servicenow':this['servicenowAccounts']};ami['on'](_0x6364('0x20'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x23'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x24'),this['syncCustomEvent'][_0x6364('0x22')](this));ami['on']('custom:agentcomplete',this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x25'),this['syncCustomEvent'][_0x6364('0x22')](this));ami['on']('custom:agentnoanswer',this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x26'),this['syncCustomEvent'][_0x6364('0x22')](this));ami['on']('custom:agentcongestion',this[_0x6364('0x21')]['bind'](this));ami['on'](_0x6364('0x27'),this['syncCustomEvent'][_0x6364('0x22')](this));ami['on'](_0x6364('0x28'),this[_0x6364('0x21')]['bind'](this));ami['on'](_0x6364('0x29'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on']('custom:timeout',this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on']('custom:dialbegin',this[_0x6364('0x2a')][_0x6364('0x22')](this));ami['on'](_0x6364('0x2b'),this[_0x6364('0x2a')][_0x6364('0x22')](this));ami['on'](_0x6364('0x2c'),this[_0x6364('0x2a')][_0x6364('0x22')](this));ami['on']('custom:newinteraction',this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x2d'),this[_0x6364('0x21')]['bind'](this));ami['on'](_0x6364('0x2e'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x2f'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x30'),this['syncCustomEvent'][_0x6364('0x22')](this));ami['on'](_0x6364('0x31'),this[_0x6364('0x21')][_0x6364('0x22')](this));ami['on'](_0x6364('0x32'),this[_0x6364('0x21')]['bind'](this));ami['on'](_0x6364('0x33'),this[_0x6364('0x21')]['bind'](this));}Trigger[_0x6364('0x34')]['emit']=function(_0x6ad014,_0x4d8a23,_0x1e77ab){logger[_0x6364('0x35')](_0x6ad014,_0x4d8a23,JSON[_0x6364('0x36')](_0x1e77ab));io['to'](_0x6ad014)[_0x6364('0x37')](_0x4d8a23,_0x1e77ab);};Trigger[_0x6364('0x34')]['syncCustomEvent']=function(_0x5046b2){var _0x4e49ed=_['clone'](_0x5046b2);if(typeof _0x4e49ed['motionChannel']===_0x6364('0x38')){_0x4e49ed[_0x6364('0x39')]=_0x6364('0x3a');}this['checkTriggers'](_0x4e49ed);};Trigger['prototype']['syncAgentDial']=function(_0x2c02c4){if(this[_0x6364('0x11')][_0x2c02c4[_0x6364('0x3b')]]){this[_0x6364('0x21')](_0x2c02c4);}};Trigger[_0x6364('0x34')][_0x6364('0x3c')]=function(_0x4a61bf){var _0x2af2d7;for(var _0x4e3e2b in this[_0x6364('0x10')]){if(this[_0x6364('0x10')]['hasOwnProperty'](_0x4e3e2b)){if(this[_0x6364('0x10')][_0x4e3e2b][_0x6364('0x3d')]){_0x2af2d7=this[_0x6364('0x3e')](this[_0x6364('0x10')][_0x4e3e2b],_0x4a61bf);if(_0x2af2d7){_['merge'](_0x4a61bf,_0x4a61bf[_0x6364('0x3f')]);for(var _0x1fec70=0x0,_0x229fdd,_0x54d3c4,_0x5d62cd;_0x1fec700x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe14b,0x93));var _0xbe14=function(_0x2016b8,_0x3f16bc){_0x2016b8=_0x2016b8-0x0;var _0x957286=_0xe14b[_0x2016b8];return _0x957286;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 138be2e..70d6cd7 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 _0x7884=['enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','substring','indexOf','incident','incidents','assign','getString','Subjects','/contacts(','Fields','ticketType','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','remoteUri','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data2','resolve','POST','clientId','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','isdisabled','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','destcalleridnum','calleridnum','/systemusers(','userId','body','headers','odata-entityid','lastIndexOf','outbound','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27'];(function(_0x2d91b4,_0x10e178){var _0x184ecd=function(_0x120fc3){while(--_0x120fc3){_0x2d91b4['push'](_0x2d91b4['shift']());}};_0x184ecd(++_0x10e178);}(_0x7884,0x107));var _0x4788=function(_0x26b459,_0x2b100d){_0x26b459=_0x26b459-0x0;var _0x439618=_0x7884[_0x26b459];return _0x439618;};'use strict';var _=require(_0x4788('0x0'));var rp=require(_0x4788('0x1'));var util=require('util');var intUtil=require(_0x4788('0x2'));var md5=require('md5');var Redis=require(_0x4788('0x3'));var logger=require(_0x4788('0x4'))(_0x4788('0x5'));var config=require('../../../../config/environment');config[_0x4788('0x6')]=_[_0x4788('0x7')](config[_0x4788('0x6')],{'host':_0x4788('0x8'),'port':0x18eb});var io=require(_0x4788('0x9'))(new Redis(config[_0x4788('0x6')]));function getAuthToken(_0x30b10d,_0x83a0cd,_0x29fdea){if(_0x30b10d[_0x4788('0xa')]){_0x30b10d['remoteUri']=_0x30b10d['CloudProvider']['data7'];_0x30b10d['tenantId']=_0x30b10d[_0x4788('0xb')][_0x4788('0xc')];return Promise[_0x4788('0xd')](_0x30b10d[_0x4788('0xb')]['data5']);}var _0x26ce57={'method':_0x4788('0xe'),'uri':_0x83a0cd,'form':{'client_id':_0x30b10d[_0x4788('0xf')],'resource':_0x30b10d['remoteUri'],'username':_0x30b10d['username'],'password':_0x30b10d[_0x4788('0x10')],'grant_type':'password','client_secret':_0x30b10d['clientSecret']},'json':!![]};return rp(_0x26ce57)[_0x4788('0x11')](function(_0x3fe69e){return _0x3fe69e['access_token'];})[_0x4788('0x12')](function(_0x596207){logger['error']('['+[_0x29fdea[_0x4788('0x13')]()]+_0x4788('0x14'));return _0x596207[_0x4788('0x15')];});}function getUser(_0x14a085,_0x500c76,_0x3b8bda,_0x2ff1f1,_0x270d2d,_0x40f443){return new Promise(function(_0x262821,_0x18a8bc){return getAuthToken(_0x500c76,_0x2ff1f1,_0x40f443)[_0x4788('0x11')](function(_0x308f32){var _0x57fd63={'method':_0x4788('0x16'),'uri':_0x270d2d+_0x4788('0x17'),'headers':{'Authorization':_0x4788('0x18')+_0x308f32,'OData-Version':_0x4788('0x19')},'json':!![]};return rp(_0x57fd63);})[_0x4788('0x11')](function(_0x417b3a){var _0x352574=_0x417b3a[_0x4788('0x1a')];var _0x17612c=![];var _0x2d48fa=null;if(!_['isNil'](_0x3b8bda)){if(intUtil['validateEmail'](_0x3b8bda[_0x4788('0x1b')])){_0x14a085[_0x4788('0x1c')]=_0x3b8bda[_0x4788('0x1b')];for(_0x2d48fa=0x0;_0x2d48fa<_0x352574[_0x4788('0x1d')];_0x2d48fa++){if(_0x352574[_0x2d48fa]['internalemailaddress']===_0x3b8bda[_0x4788('0x1b')]&&!_0x352574[_0x2d48fa][_0x4788('0x1e')]){_0x17612c=!![];logger[_0x4788('0x1f')]('['+[_0x40f443[_0x4788('0x13')]()]+']\x20Agent\x20found\x20'+_0x352574[_0x2d48fa]['systemuserid']+'!');_0x14a085['userId']=_0x352574[_0x2d48fa]['systemuserid'];}}}}if(!_0x17612c){logger[_0x4788('0x1f')]('['+[_0x40f443[_0x4788('0x13')]()]+_0x4788('0x20'));_0x14a085[_0x4788('0x1c')]=_0x500c76[_0x4788('0x21')];for(_0x2d48fa=0x0;_0x2d48fa<_0x352574[_0x4788('0x1d')];_0x2d48fa++){if(_0x352574[_0x2d48fa][_0x4788('0x22')]===_0x500c76[_0x4788('0x21')]){_0x14a085['userId']=_0x352574[_0x2d48fa]['systemuserid'];}}}_0x262821(_0x14a085);})['catch'](function(_0x3cc327){_0x18a8bc(_0x3cc327[_0x4788('0x15')]);});});}function createEndUser(_0x4919cd,_0x20cb24,_0x239915,_0x1e82e9,_0x5cd3e7,_0x57a39b,_0xf6f26e){return new Promise(function(_0x5dc8c8,_0x2b63cb){return getAuthToken(_0x20cb24,_0x239915,_0x57a39b)[_0x4788('0x11')](function(_0x434d17){var _0x2ec0f6=_0x57a39b[_0x4788('0x23')]()==='outbound'?_0x5cd3e7[_0x4788('0x24')]:_0x5cd3e7[_0x4788('0x25')];var _0x5a0456={'method':_0x4788('0xe'),'uri':_0x1e82e9+'contacts','body':{'fullname':_0x2ec0f6,'firstname':_0x2ec0f6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4788('0x26')+_0x4919cd[_0x4788('0x27')]+')'},'headers':{'Authorization':_0x4788('0x18')+_0x434d17,'OData-Version':_0x4788('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5a0456[_0x4788('0x28')][_0xf6f26e]=_0x2ec0f6;return rp(_0x5a0456);})[_0x4788('0x11')](function(_0x2afb8f){var _0x15b256=_0x2afb8f[_0x4788('0x29')][_0x4788('0x2a')];var _0x495c5b=_0x15b256['substring'](_0x15b256[_0x4788('0x2b')]('(')+0x1,_0x15b256[_0x4788('0x2b')](')'));_0x4919cd['enduserId']=_0x495c5b;_0x5dc8c8(_0x4919cd);})[_0x4788('0x12')](function(_0x4bd102){_0x2b63cb(_0x4bd102[_0x4788('0x15')]);});});}function getEndUser(_0x4fade6,_0x5f482a,_0x107434,_0x58b047,_0x2f35fd,_0x2c75cf,_0x438f27,_0x419e1f){var _0x1d2d43=_0x2c75cf['toLowerCase']()===_0x4788('0x2c')?_0x2f35fd['destcalleridnum']:_0x2f35fd['calleridnum'];return getAuthToken(_0x5f482a,_0x107434,_0x2c75cf)[_0x4788('0x11')](function(_0x35bbb9){_0x419e1f=_0x419e1f?_0x419e1f:_0x4788('0x2d');var _0x18a230={'method':'GET','uri':_0x58b047+_0x4788('0x2e')+_0x419e1f+_0x4788('0x2f')+_0x419e1f+_0x4788('0x30')+_0x1d2d43['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x4788('0x18')+_0x35bbb9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x18a230);})['then'](function(_0x1bf92b){var _0x4de531=![];if(!_0x1bf92b)return _0x4de531;var _0x334e87=_0x1bf92b[_0x4788('0x1a')];for(var _0x54bb9d=0x0;_0x54bb9d<_0x334e87[_0x4788('0x1d')];_0x54bb9d++){if(_0x334e87[_0x54bb9d][_0x419e1f]===_0x1d2d43){_0x4de531=!![];_0x4fade6[_0x4788('0x31')]=_0x334e87[_0x54bb9d][_0x4788('0x32')];}}return _0x4de531;})[_0x4788('0x11')](function(_0x46cd0d){if(_0x46cd0d)return _0x4fade6;if(_0x438f27===_0x4788('0x33')){logger[_0x4788('0x1f')]('['+[_0x2c75cf[_0x4788('0x13')]()]+_0x4788('0x34'));return _0x4fade6;}return createEndUser(_0x4fade6,_0x5f482a,_0x107434,_0x58b047,_0x2f35fd,_0x2c75cf,_0x419e1f)[_0x4788('0x11')](function(_0x2fae69){logger[_0x4788('0x1f')]('['+[_0x2c75cf[_0x4788('0x13')]()]+_0x4788('0x35'),_0x2fae69[_0x4788('0x31')]);return _0x2fae69;});});}function getCustomFields(_0xbf60b6,_0x15cd94,_0x503c3f){var _0x150141={};if(_0xbf60b6[_0x4788('0x1d')]>0x0){_[_0x4788('0x36')](_0xbf60b6,function(_0x529114){if(_[_0x4788('0x37')]([_0x4788('0x38'),_0x4788('0x39')],_0x529114[_0x4788('0x3a')])&&_0x529114[_0x4788('0x3b')]&&!_0x529114['customField']){var _0x3af799=_0x529114[_0x4788('0x3c')][_0x4788('0x23')]();var _0x35ee30=_0x3af799[_0x4788('0x3d')](0x0,_0x3af799[_0x4788('0x3e')]('_'));var _0x4b89b2=_0x3af799[_0x4788('0x3d')](_0x3af799['indexOf']('_')+0x1);if(_0x35ee30===_0x503c3f){_0x150141[_0x4b89b2]=_0x529114['content'];}}});}return _0x150141;}function getTicket(_0x59923f,_0x5b7a96,_0x478076,_0x3e8a9e,_0xb837bc,_0x4e06ad,_0x15155e){return new Promise(function(_0x56501d,_0x384cd9){var _0x4248dd;return getAuthToken(_0x5b7a96,_0x478076,_0x15155e)[_0x4788('0x11')](function(_0x5ceba3){if(_0x4e06ad['ticketType']===_0x4788('0x3f')){_0x4248dd={'method':_0x4788('0xe'),'uri':_0x3e8a9e+_0x4788('0x40'),'body':Object[_0x4788('0x41')]({},{'title':intUtil[_0x4788('0x42')](_0x4e06ad[_0x4788('0x43')],_0xb837bc,'\x20'),'description':intUtil[_0x4788('0x42')](_0x4e06ad['Descriptions'],_0xb837bc,'\x0a'),'customerid_contact@odata.bind':_0x59923f[_0x4788('0x31')]?_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')':undefined,'ownerid@odata.bind':_0x4788('0x26')+_0x59923f[_0x4788('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x4e06ad[_0x4788('0x45')],_0xb837bc,_0x4e06ad['ticketType'])),'headers':{'Authorization':_0x4788('0x18')+_0x5ceba3,'OData-Version':_0x4788('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4e06ad[_0x4788('0x46')]===_0x4788('0x47')){var _0x59de7e=_0x59923f[_0x4788('0x31')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x59923f[_0x4788('0x27')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4788('0x26')+_0x59923f[_0x4788('0x27')]+')','participationtypemask':_0x59923f[_0x4788('0x48')]===_0x4788('0x49')?0x2:0x1}];_0x4248dd={'method':_0x4788('0xe'),'uri':_0x3e8a9e+'phonecalls','body':Object[_0x4788('0x41')]({},{'subject':intUtil[_0x4788('0x42')](_0x4e06ad[_0x4788('0x43')],_0xb837bc,'\x20'),'phonenumber':String(_0xb837bc['calleridnum']),'description':intUtil['getString'](_0x4e06ad['Descriptions'],_0xb837bc,'\x0a'),'regardingobjectid_contact@odata.bind':_0x59923f['enduserId']?_0x4788('0x44')+_0x59923f[_0x4788('0x31')]+')':undefined,'ownerid@odata.bind':_0x4788('0x26')+_0x59923f['userId']+')','directioncode':_0x59923f['callDirection']===_0x4788('0x49')?![]:!![],'phonecall_activity_parties':_0x59de7e},getCustomFields(_0x4e06ad['Fields'],_0xb837bc,_0x4e06ad[_0x4788('0x46')])),'headers':{'Authorization':_0x4788('0x18')+_0x5ceba3,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4248dd);})[_0x4788('0x11')](function(_0x2a5f20){var _0x561f64=_0x2a5f20['headers'][_0x4788('0x2a')];var _0x18f964=_0x561f64[_0x4788('0x3d')](_0x561f64[_0x4788('0x2b')]('(')+0x1,_0x561f64[_0x4788('0x2b')](')'));_0x59923f[_0x4788('0x4a')]=_0x18f964;_0x56501d(_0x59923f);})[_0x4788('0x12')](function(_0x564a7d){_0x384cd9(_0x564a7d['message']);});});}function emit(_0x590799,_0x3bd042,_0x210749,_0x43105d){var _0x4e0f46={'uri':util[_0x4788('0x4b')](_0x4788('0x4c'),_0x590799,_0x210749,_0x43105d)};io['to'](util[_0x4788('0x4b')]('user:%s',_0x3bd042))[_0x4788('0x4d')]('trigger:browser:url',_0x4e0f46);}exports['cs']=function(_0x4e59ee,_0x26a781,_0x3c5e5c,_0x424822,_0x1738ae,_0x2cfeba,_0x37d1ab,_0x46ed10){var _0x45d2be={};_0x2cfeba[_0x4788('0x4e')]=_0x2cfeba[_0x4788('0xa')]?intUtil[_0x4788('0x4f')](_0x2cfeba['CloudProvider'][_0x4788('0x50')]):intUtil[_0x4788('0x4f')](_0x2cfeba[_0x4788('0x4e')]);_0x2cfeba['serverUrl']=intUtil['stripTrailingSlash'](_0x2cfeba[_0x4788('0x51')]);_0x45d2be[_0x4788('0x48')]=_0x46ed10===_0x4788('0x49')||_0x46ed10===_0x4788('0x52')?_0x4788('0x49'):'outbound';var _0x2d52bd=_0x2cfeba[_0x4788('0xa')]?util[_0x4788('0x4b')](_0x4788('0x53'),_0x2cfeba['CloudProvider'][_0x4788('0x50')]):util[_0x4788('0x4b')]('%s/api/data/v9.0/',_0x2cfeba['remoteUri']);var _0x64b019=util['format'](_0x4788('0x54'),_0x2cfeba['tenantId']);var _0x4c39f6=util[_0x4788('0x4b')](_0x4788('0x55'),_0x2cfeba[_0x4788('0x51')],_0x26a781['uniqueid'],md5(_0x26a781[_0x4788('0x56')]));if(_0x1738ae&&_0x1738ae[_0x4788('0x57')]){logger[_0x4788('0x1f')](_0x4788('0x58'),_0x4788('0x59'));_0x26a781[_0x4788('0x5a')]=_0x4c39f6;}else if(_0x37d1ab&&_0x37d1ab[_0x4788('0x5b')]&&_0x37d1ab[_0x4788('0x5b')]!==_0x4788('0x5c')){logger[_0x4788('0x1f')](_0x4788('0x5d'),'Recording\x20is\x20enabled!');_0x26a781[_0x4788('0x5a')]=_0x4c39f6;}else{_0x26a781[_0x4788('0x5a')]='';}return getUser(_0x45d2be,_0x2cfeba,_0x424822,_0x64b019,_0x2d52bd,_0x46ed10)[_0x4788('0x11')](function(_0x44179a){logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x5e'),_0x44179a[_0x4788('0x27')]);logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x5f'),_0x44179a[_0x4788('0x1c')]);return getEndUser(_0x44179a,_0x2cfeba,_0x64b019,_0x2d52bd,_0x26a781,_0x46ed10,_0x3c5e5c[_0x4788('0x60')],_0x3c5e5c['additionalSearchContact']);})[_0x4788('0x11')](function(_0xdf0d5d){logger[_0x4788('0x1f')]('['+_0x46ed10['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0xdf0d5d[_0x4788('0x31')]);logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x26a781[_0x4788('0x25')]);return getTicket(_0xdf0d5d,_0x2cfeba,_0x64b019,_0x2d52bd,_0x26a781,_0x3c5e5c,_0x46ed10);})[_0x4788('0x11')](function(_0x2f6c6d){logger[_0x4788('0x1f')](util[_0x4788('0x4b')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x61'),_0x3c5e5c[_0x4788('0x46')],_0x2f6c6d[_0x4788('0x4a')]));logger[_0x4788('0x1f')](util['format']('['+_0x46ed10['toUpperCase']()+_0x4788('0x62'),_0x46ed10));if(_0x46ed10!==_0x4788('0x52')&&_0x3c5e5c[_0x4788('0x63')]){logger[_0x4788('0x1f')]('['+_0x46ed10[_0x4788('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2cfeba[_0x4788('0x4e')],_0x424822[_0x4788('0x64')],_0x3c5e5c[_0x4788('0x46')],_0x2f6c6d[_0x4788('0x4a')]);}})[_0x4788('0x12')](function(_0x42fcb3){logger[_0x4788('0x65')]('['+_0x46ed10[_0x4788('0x13')]()+_0x4788('0x66'),_0x42fcb3['message']);console[_0x4788('0x65')](_0x4788('0x67'),_0x42fcb3);});}; \ No newline at end of file +var _0x0f1b=['picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','/contacts(','phonecall','callDirection','queue','/systemusers(','phonecalls','Subjects','Fields','headers','ticketId','format','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','validateEmail','userEmail','length','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','outbound','destcalleridnum','calleridnum','contacts','4.0','body','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string'];(function(_0x548ca8,_0x10bd67){var _0x23f996=function(_0x343243){while(--_0x343243){_0x548ca8['push'](_0x548ca8['shift']());}};_0x23f996(++_0x10bd67);}(_0x0f1b,0xaa));var _0xb0f1=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0f1b[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xb0f1('0x0'));var rp=require(_0xb0f1('0x1'));var util=require(_0xb0f1('0x2'));var intUtil=require('./util');var md5=require(_0xb0f1('0x3'));var Redis=require(_0xb0f1('0x4'));var logger=require('../../../../config/logger')(_0xb0f1('0x5'));var config=require(_0xb0f1('0x6'));config[_0xb0f1('0x7')]=_[_0xb0f1('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb0f1('0x9'))(new Redis(config[_0xb0f1('0x7')]));function getAuthToken(_0x20edba,_0x3a7401,_0x490230){if(_0x20edba['modernAuthentication']){_0x20edba[_0xb0f1('0xa')]=_0x20edba[_0xb0f1('0xb')][_0xb0f1('0xc')];_0x20edba[_0xb0f1('0xd')]=_0x20edba[_0xb0f1('0xb')][_0xb0f1('0xe')];return Promise[_0xb0f1('0xf')](_0x20edba[_0xb0f1('0xb')][_0xb0f1('0x10')]);}var _0x38780c={'method':_0xb0f1('0x11'),'uri':_0x3a7401,'form':{'client_id':_0x20edba[_0xb0f1('0x12')],'resource':_0x20edba[_0xb0f1('0xa')],'username':_0x20edba[_0xb0f1('0x13')],'password':_0x20edba[_0xb0f1('0x14')],'grant_type':_0xb0f1('0x14'),'client_secret':_0x20edba[_0xb0f1('0x15')]},'json':!![]};return rp(_0x38780c)[_0xb0f1('0x16')](function(_0x52b58a){return _0x52b58a[_0xb0f1('0x17')];})[_0xb0f1('0x18')](function(_0x15d49f){logger[_0xb0f1('0x19')]('['+[_0x490230[_0xb0f1('0x1a')]()]+_0xb0f1('0x1b'));return _0x15d49f[_0xb0f1('0x1c')];});}function getUser(_0x5ec983,_0xc33b4a,_0xf563d8,_0x4edb04,_0x259db9,_0x1ae15d){return new Promise(function(_0x2a0c5a,_0x403ed9){return getAuthToken(_0xc33b4a,_0x4edb04,_0x1ae15d)['then'](function(_0x2839a5){var _0x481f4d={'method':_0xb0f1('0x1d'),'uri':_0x259db9+_0xb0f1('0x1e'),'headers':{'Authorization':'Bearer\x20'+_0x2839a5,'OData-Version':'4.0'},'json':!![]};return rp(_0x481f4d);})[_0xb0f1('0x16')](function(_0x11be20){var _0x519461=_0x11be20[_0xb0f1('0x1f')];var _0x55011d=![];var _0x2a5f5e=null;if(!_[_0xb0f1('0x20')](_0xf563d8)){if(intUtil[_0xb0f1('0x21')](_0xf563d8['email'])){_0x5ec983[_0xb0f1('0x22')]=_0xf563d8['email'];for(_0x2a5f5e=0x0;_0x2a5f5e<_0x519461[_0xb0f1('0x23')];_0x2a5f5e++){if(_0x519461[_0x2a5f5e]['internalemailaddress']===_0xf563d8[_0xb0f1('0x24')]&&!_0x519461[_0x2a5f5e][_0xb0f1('0x25')]){_0x55011d=!![];logger[_0xb0f1('0x26')]('['+[_0x1ae15d[_0xb0f1('0x1a')]()]+_0xb0f1('0x27')+_0x519461[_0x2a5f5e][_0xb0f1('0x28')]+'!');_0x5ec983[_0xb0f1('0x29')]=_0x519461[_0x2a5f5e][_0xb0f1('0x28')];}}}}if(!_0x55011d){logger['info']('['+[_0x1ae15d[_0xb0f1('0x1a')]()]+_0xb0f1('0x2a'));_0x5ec983[_0xb0f1('0x22')]=_0xc33b4a['username'];for(_0x2a5f5e=0x0;_0x2a5f5e<_0x519461[_0xb0f1('0x23')];_0x2a5f5e++){if(_0x519461[_0x2a5f5e][_0xb0f1('0x2b')]===_0xc33b4a[_0xb0f1('0x13')]){_0x5ec983[_0xb0f1('0x29')]=_0x519461[_0x2a5f5e][_0xb0f1('0x28')];}}}_0x2a0c5a(_0x5ec983);})[_0xb0f1('0x18')](function(_0x332fc7){_0x403ed9(_0x332fc7[_0xb0f1('0x1c')]);});});}function createEndUser(_0x3ecaa4,_0x5ec137,_0x404609,_0x198657,_0x1b7627,_0x445d21,_0x596586){return new Promise(function(_0x51b167,_0x4c5074){return getAuthToken(_0x5ec137,_0x404609,_0x445d21)[_0xb0f1('0x16')](function(_0x196534){var _0x4dcbcf=_0x445d21['toLowerCase']()===_0xb0f1('0x2c')?_0x1b7627[_0xb0f1('0x2d')]:_0x1b7627[_0xb0f1('0x2e')];var _0x52a925={'method':_0xb0f1('0x11'),'uri':_0x198657+_0xb0f1('0x2f'),'body':{'fullname':_0x4dcbcf,'firstname':_0x4dcbcf,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3ecaa4[_0xb0f1('0x29')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x196534,'OData-Version':_0xb0f1('0x30')},'json':!![],'resolveWithFullResponse':!![]};_0x52a925[_0xb0f1('0x31')][_0x596586]=_0x4dcbcf;return rp(_0x52a925);})[_0xb0f1('0x16')](function(_0x38f64a){var _0x17bfcc=_0x38f64a['headers'][_0xb0f1('0x32')];var _0x5c27b9=_0x17bfcc[_0xb0f1('0x33')](_0x17bfcc['lastIndexOf']('(')+0x1,_0x17bfcc[_0xb0f1('0x34')](')'));_0x3ecaa4[_0xb0f1('0x35')]=_0x5c27b9;_0x51b167(_0x3ecaa4);})[_0xb0f1('0x18')](function(_0x2b67a0){_0x4c5074(_0x2b67a0['message']);});});}function getEndUser(_0x540ea7,_0x471862,_0x1b6c7f,_0x410580,_0x108ab0,_0x1342af,_0x27c820,_0xdc5f5a){var _0x403983=_0x1342af[_0xb0f1('0x36')]()===_0xb0f1('0x2c')?_0x108ab0[_0xb0f1('0x2d')]:_0x108ab0[_0xb0f1('0x2e')];return getAuthToken(_0x471862,_0x1b6c7f,_0x1342af)[_0xb0f1('0x16')](function(_0x1e2b47){_0xdc5f5a=_0xdc5f5a?_0xdc5f5a:_0xb0f1('0x37');var _0x4b012f={'method':_0xb0f1('0x1d'),'uri':_0x410580+_0xb0f1('0x38')+_0xdc5f5a+_0xb0f1('0x39')+_0xdc5f5a+_0xb0f1('0x3a')+_0x403983[_0xb0f1('0x3b')]('+',_0xb0f1('0x3c'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x1e2b47,'If-None-Match':null,'OData-Version':_0xb0f1('0x30')},'json':!![]};return rp(_0x4b012f);})[_0xb0f1('0x16')](function(_0x5560a3){var _0x55074f=![];if(!_0x5560a3)return _0x55074f;var _0x3b3c6b=_0x5560a3[_0xb0f1('0x1f')];for(var _0x1e546c=0x0;_0x1e546c<_0x3b3c6b['length'];_0x1e546c++){if(_0x3b3c6b[_0x1e546c][_0xdc5f5a]===_0x403983){_0x55074f=!![];_0x540ea7[_0xb0f1('0x35')]=_0x3b3c6b[_0x1e546c][_0xb0f1('0x3d')];}}return _0x55074f;})[_0xb0f1('0x16')](function(_0x4179d7){if(_0x4179d7)return _0x540ea7;if(_0x27c820==='nothing'){logger[_0xb0f1('0x26')]('['+[_0x1342af[_0xb0f1('0x1a')]()]+_0xb0f1('0x3e'));return _0x540ea7;}return createEndUser(_0x540ea7,_0x471862,_0x1b6c7f,_0x410580,_0x108ab0,_0x1342af,_0xdc5f5a)['then'](function(_0x58e0be){logger[_0xb0f1('0x26')]('['+[_0x1342af['toUpperCase']()]+_0xb0f1('0x3f'),_0x58e0be[_0xb0f1('0x35')]);return _0x58e0be;});});}function getCustomFields(_0x41540d,_0x29eb93,_0x4169b2){var _0x4e20c1={};if(_0x41540d[_0xb0f1('0x23')]>0x0){_['forEach'](_0x41540d,function(_0x1356b1){if(_[_0xb0f1('0x40')]([_0xb0f1('0x41'),_0xb0f1('0x42')],_0x1356b1[_0xb0f1('0x43')])&&_0x1356b1[_0xb0f1('0x44')]&&!_0x1356b1[_0xb0f1('0x45')]){var _0x5e5bb2=_0x1356b1[_0xb0f1('0x46')][_0xb0f1('0x36')]();var _0x1212d3=_0x5e5bb2['substring'](0x0,_0x5e5bb2[_0xb0f1('0x47')]('_'));var _0x192b55=_0x5e5bb2[_0xb0f1('0x33')](_0x5e5bb2[_0xb0f1('0x47')]('_')+0x1);if(_0x1212d3===_0x4169b2){_0x4e20c1[_0x192b55]=_0x1356b1[_0xb0f1('0x48')];}}});}return _0x4e20c1;}function getTicket(_0x33b89f,_0x1cccf9,_0x3e4a4a,_0x5fbcc2,_0x401820,_0x1571cc,_0x4fc504){return new Promise(function(_0x28d30a,_0x250c18){var _0x35b7a9;return getAuthToken(_0x1cccf9,_0x3e4a4a,_0x4fc504)[_0xb0f1('0x16')](function(_0x20f1a2){if(_0x1571cc[_0xb0f1('0x49')]===_0xb0f1('0x4a')){_0x35b7a9={'method':'POST','uri':_0x5fbcc2+_0xb0f1('0x4b'),'body':Object[_0xb0f1('0x4c')]({},{'title':intUtil[_0xb0f1('0x4d')](_0x1571cc['Subjects'],_0x401820,'\x20'),'description':intUtil[_0xb0f1('0x4d')](_0x1571cc['Descriptions'],_0x401820,'\x0a'),'customerid_contact@odata.bind':_0x33b89f[_0xb0f1('0x35')]?_0xb0f1('0x4e')+_0x33b89f['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x33b89f[_0xb0f1('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x1571cc['Fields'],_0x401820,_0x1571cc[_0xb0f1('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x20f1a2,'OData-Version':_0xb0f1('0x30')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1571cc[_0xb0f1('0x49')]===_0xb0f1('0x4f')){var _0x199b2f=_0x33b89f[_0xb0f1('0x35')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x33b89f[_0xb0f1('0x29')]+')','participationtypemask':_0x33b89f[_0xb0f1('0x50')]===_0xb0f1('0x51')?0x2:0x1},{'partyid_contact@odata.bind':_0xb0f1('0x4e')+_0x33b89f[_0xb0f1('0x35')]+')','participationtypemask':_0x33b89f[_0xb0f1('0x50')]===_0xb0f1('0x51')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb0f1('0x52')+_0x33b89f[_0xb0f1('0x29')]+')','participationtypemask':_0x33b89f[_0xb0f1('0x50')]===_0xb0f1('0x51')?0x2:0x1}];_0x35b7a9={'method':_0xb0f1('0x11'),'uri':_0x5fbcc2+_0xb0f1('0x53'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x1571cc[_0xb0f1('0x54')],_0x401820,'\x20'),'phonenumber':String(_0x401820[_0xb0f1('0x2e')]),'description':intUtil[_0xb0f1('0x4d')](_0x1571cc['Descriptions'],_0x401820,'\x0a'),'regardingobjectid_contact@odata.bind':_0x33b89f[_0xb0f1('0x35')]?_0xb0f1('0x4e')+_0x33b89f[_0xb0f1('0x35')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x33b89f['userId']+')','directioncode':_0x33b89f['callDirection']===_0xb0f1('0x51')?![]:!![],'phonecall_activity_parties':_0x199b2f},getCustomFields(_0x1571cc[_0xb0f1('0x55')],_0x401820,_0x1571cc[_0xb0f1('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x20f1a2,'OData-Version':_0xb0f1('0x30')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x35b7a9);})[_0xb0f1('0x16')](function(_0x1cc071){var _0x106879=_0x1cc071[_0xb0f1('0x56')][_0xb0f1('0x32')];var _0x1b565d=_0x106879[_0xb0f1('0x33')](_0x106879[_0xb0f1('0x34')]('(')+0x1,_0x106879[_0xb0f1('0x34')](')'));_0x33b89f[_0xb0f1('0x57')]=_0x1b565d;_0x28d30a(_0x33b89f);})[_0xb0f1('0x18')](function(_0x33e53c){_0x250c18(_0x33e53c['message']);});});}function emit(_0x5616e3,_0x448c07,_0x483911,_0x1ea2c){var _0x1c201f={'uri':util[_0xb0f1('0x58')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x5616e3,_0x483911,_0x1ea2c)};io['to'](util[_0xb0f1('0x58')](_0xb0f1('0x59'),_0x448c07))[_0xb0f1('0x5a')](_0xb0f1('0x5b'),_0x1c201f);}exports['cs']=function(_0x46a0b6,_0x40e3dd,_0x29eb26,_0x404da0,_0xf61c84,_0x408b3b,_0x2f8700,_0x56cd32){var _0x2d8aa4={};_0x408b3b[_0xb0f1('0xa')]=_0x408b3b[_0xb0f1('0x5c')]?intUtil[_0xb0f1('0x5d')](_0x408b3b[_0xb0f1('0xb')][_0xb0f1('0xc')]):intUtil[_0xb0f1('0x5d')](_0x408b3b[_0xb0f1('0xa')]);_0x408b3b[_0xb0f1('0x5e')]=intUtil[_0xb0f1('0x5d')](_0x408b3b[_0xb0f1('0x5e')]);_0x2d8aa4['callDirection']=_0x56cd32===_0xb0f1('0x51')||_0x56cd32==='unmanaged'?'queue':_0xb0f1('0x2c');var _0x5bf09b=_0x408b3b[_0xb0f1('0x5c')]?util['format'](_0xb0f1('0x5f'),_0x408b3b[_0xb0f1('0xb')][_0xb0f1('0xc')]):util['format'](_0xb0f1('0x5f'),_0x408b3b['remoteUri']);var _0x106b9f=util['format'](_0xb0f1('0x60'),_0x408b3b[_0xb0f1('0xd')]);var _0x1d350b=util[_0xb0f1('0x58')](_0xb0f1('0x61'),_0x408b3b[_0xb0f1('0x5e')],_0x40e3dd[_0xb0f1('0x62')],md5(_0x40e3dd[_0xb0f1('0x62')]));if(_0xf61c84&&_0xf61c84['monitor_format']){logger[_0xb0f1('0x26')]('[QUEUE]',_0xb0f1('0x63'));_0x40e3dd[_0xb0f1('0x64')]=_0x1d350b;}else if(_0x2f8700&&_0x2f8700[_0xb0f1('0x65')]&&_0x2f8700[_0xb0f1('0x65')]!==_0xb0f1('0x66')){logger[_0xb0f1('0x26')](_0xb0f1('0x67'),_0xb0f1('0x63'));_0x40e3dd[_0xb0f1('0x64')]=_0x1d350b;}else{_0x40e3dd[_0xb0f1('0x64')]='';}return getUser(_0x2d8aa4,_0x408b3b,_0x404da0,_0x106b9f,_0x5bf09b,_0x56cd32)[_0xb0f1('0x16')](function(_0x4c74b9){logger[_0xb0f1('0x26')]('['+_0x56cd32['toUpperCase']()+_0xb0f1('0x68'),_0x4c74b9['userId']);logger[_0xb0f1('0x26')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x69'),_0x4c74b9[_0xb0f1('0x22')]);return getEndUser(_0x4c74b9,_0x408b3b,_0x106b9f,_0x5bf09b,_0x40e3dd,_0x56cd32,_0x29eb26[_0xb0f1('0x6a')],_0x29eb26[_0xb0f1('0x6b')]);})[_0xb0f1('0x16')](function(_0x3e7149){logger[_0xb0f1('0x26')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x6c'),_0x3e7149[_0xb0f1('0x35')]);logger[_0xb0f1('0x26')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x6d'),_0x40e3dd[_0xb0f1('0x2e')]);return getTicket(_0x3e7149,_0x408b3b,_0x106b9f,_0x5bf09b,_0x40e3dd,_0x29eb26,_0x56cd32);})[_0xb0f1('0x16')](function(_0x1cbbca){logger[_0xb0f1('0x26')](util[_0xb0f1('0x58')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x6e'),_0x29eb26[_0xb0f1('0x49')],_0x1cbbca['ticketId']));logger[_0xb0f1('0x26')](util[_0xb0f1('0x58')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x6f'),_0x56cd32));if(_0x56cd32!==_0xb0f1('0x70')&&_0x29eb26[_0xb0f1('0x71')]){logger['info']('['+_0x56cd32[_0xb0f1('0x1a')]()+']',_0xb0f1('0x72'));emit(_0x408b3b[_0xb0f1('0xa')],_0x404da0[_0xb0f1('0x73')],_0x29eb26[_0xb0f1('0x49')],_0x1cbbca[_0xb0f1('0x57')]);}})['catch'](function(_0x3f5c8b){logger[_0xb0f1('0x19')]('['+_0x56cd32[_0xb0f1('0x1a')]()+_0xb0f1('0x74'),_0x3f5c8b[_0xb0f1('0x1c')]);console[_0xb0f1('0x19')](_0xb0f1('0x75'),_0x3f5c8b);});}; \ 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 c6d40f2..7d6dfdf 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 _0x0dbf=['Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%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!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','user:%s','catch','error','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','info','Creating\x20new\x20ticket...','merge','calleridnum','getString','Subjects','Descriptions','
'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0dbf,0x1b1));var _0xf0db=function(_0x4001ad,_0x1e22dd){_0x4001ad=_0x4001ad-0x0;var _0x4c7ec2=_0x0dbf[_0x4001ad];return _0x4c7ec2;};'use strict';var _=require(_0xf0db('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf0db('0x1'));var Redis=require(_0xf0db('0x2'));var intUtil=require(_0xf0db('0x3'));var config=require(_0xf0db('0x4'));var logger=require('../../../../config/logger')(_0xf0db('0x5'));config[_0xf0db('0x6')]=_['defaults'](config['redis'],{'host':_0xf0db('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf0db('0x6')]));var headers={'Content-Type':_0xf0db('0x8'),'Accept':_0xf0db('0x8')};function emit(_0x5bfff7,_0x5ddf76,_0x4ffd8a){io['to'](_0x5bfff7)['emit'](_0x5ddf76,_0x4ffd8a);}function getTicket(_0x22b98f,_0x5d2a10,_0x34b046,_0xd2ab18,_0x2dd91b){logger[_0xf0db('0x9')](_0xf0db('0xa'));var _0x20551e=_[_0xf0db('0xb')]({'responder_id':_0x5d2a10['id'],'requester_id':_0x34b046['id'],'name':util['format']('Caller\x20-\x20%s',_0x2dd91b['calleridname']),'phone':_0x2dd91b[_0xf0db('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf0db('0xd')](_0xd2ab18[_0xf0db('0xe')],_0x2dd91b,'\x20'),'description':intUtil[_0xf0db('0xd')](_0xd2ab18[_0xf0db('0xf')],_0x2dd91b,_0xf0db('0x10')),'tags':getTags(_0xd2ab18[_0xf0db('0x11')],_0xf0db('0x12'))},getCustomFields(_0xd2ab18['Fields'],_0x2dd91b));_0x20551e[_0xf0db('0x13')]=_[_0xf0db('0x14')](_[_0xf0db('0x15')](_0x20551e[_0xf0db('0x13')],'id'),_0xf0db('0x16'));return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x18'),_0x22b98f[_0xf0db('0x19')]),'method':'POST','body':_0x20551e})[_0xf0db('0x1a')](function(_0x5a25f3){logger[_0xf0db('0x9')](_0xf0db('0x1b'));return _0x5a25f3;});}function getUser(_0xb6deaf,_0x20103f){if(intUtil['validateEmail'](_0x20103f)){return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x1c'),_0xb6deaf[_0xf0db('0x19')]),'qs':{'email':_0x20103f}})['then'](function(_0x3ff02f){if(_0x3ff02f[_0xf0db('0x1d')]){logger[_0xf0db('0x9')](_0xf0db('0x1e'));return _[_0xf0db('0x1f')](_0x3ff02f,function(_0x5277a8){return _0x5277a8[_0xf0db('0x20')][_0xf0db('0x21')]===_0x20103f;});}else{logger[_0xf0db('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf0db('0x22'),_0xb6deaf['remoteUri'])})[_0xf0db('0x1a')](function(_0x11ba3c){logger[_0xf0db('0x9')](_0xf0db('0x23'));return _0x11ba3c;});}});}else{logger[_0xf0db('0x9')](_0xf0db('0x24'));return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x22'),_0xb6deaf[_0xf0db('0x19')])})['then'](function(_0x1e59fa){logger[_0xf0db('0x9')]('Admin\x20account\x20selected.');return _0x1e59fa;});}}function getEndUser(_0x40e5e2,_0x122722,_0x2ccb38){logger['info'](_0xf0db('0x25'),_0x2ccb38);return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x26'),_0x40e5e2[_0xf0db('0x19')]),'qs':{'phone':_0x2ccb38}})[_0xf0db('0x1a')](function(_0x5cb65a){if(_0x5cb65a[_0xf0db('0x1d')]){logger['info'](_0xf0db('0x27'));return _[_0xf0db('0x1f')](_0x5cb65a,{'phone':_0x2ccb38});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf0db('0x17')](_0xf0db('0x26'),_0x40e5e2[_0xf0db('0x19')]),'method':_0xf0db('0x28'),'body':{'name':_0x122722,'phone':_0x2ccb38}})[_0xf0db('0x1a')](function(_0x47a1e3){logger['info'](_0xf0db('0x29'));return _0x47a1e3;});}});}function getAuth(_0xf4b2e3){return util['format'](_0xf0db('0x2a'),new Buffer(_0xf4b2e3[_0xf0db('0x2b')]+':X')[_0xf0db('0x2c')]('base64'));}function request(_0x5aec11){logger[_0xf0db('0x2d')](_0xf0db('0x2e'),JSON[_0xf0db('0x2f')](_0x5aec11));return rp(_[_0xf0db('0x30')](_0x5aec11,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5f2ee0,_0x3b8e14){var _0x1fb347=[];if(_0x5f2ee0&&_0x5f2ee0[_0xf0db('0x1d')]>0x0){_0x1fb347=_['map'](_0x5f2ee0,_0x3b8e14);}return _0x1fb347;}function getCustomFields(_0x5ae1eb,_0x44978d){var _0x500a5a=[];var _0x115578={'custom_fields':[]};if(_0x5ae1eb[_0xf0db('0x1d')]>0x0){_[_0xf0db('0x31')](_0x5ae1eb,function(_0x13ff39){if(_[_0xf0db('0x32')]([_0xf0db('0x33'),_0xf0db('0x34')],_0x13ff39[_0xf0db('0x35')])&&_0x13ff39['nameField']&&!_0x13ff39[_0xf0db('0x36')]){_0x115578[_0x13ff39['nameField'][_0xf0db('0x37')]()]=_0x13ff39[_0xf0db('0x38')][_0xf0db('0x2c')]();}else if(_[_0xf0db('0x32')]([_0xf0db('0x33'),_0xf0db('0x34')],_0x13ff39[_0xf0db('0x35')])&&_0x13ff39[_0xf0db('0x39')]&&_0x13ff39[_0xf0db('0x36')]){_0x115578[_0xf0db('0x13')][_0xf0db('0x3a')]({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x13ff39[_0xf0db('0x38')][_0xf0db('0x2c')]()});}else if(_0x13ff39[_0xf0db('0x35')]==='variable'&&_0x13ff39[_0xf0db('0x3b')]&&_0x13ff39['idField']&&_0x13ff39[_0xf0db('0x36')]){_0x44978d[_0x13ff39[_0xf0db('0x3b')]]&&_0x115578[_0xf0db('0x13')][_0xf0db('0x3a')]({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x44978d[_0x13ff39[_0xf0db('0x3b')]][_0xf0db('0x2c')]()});}else if(_0x13ff39[_0xf0db('0x35')]===_0xf0db('0x3c')&&_0x13ff39[_0xf0db('0x3d')]&&_0x13ff39[_0xf0db('0x3d')][_0xf0db('0x12')]&&_0x13ff39[_0xf0db('0x39')]&&_0x13ff39[_0xf0db('0x36')]){_0x44978d[_0x13ff39[_0xf0db('0x3d')][_0xf0db('0x12')][_0xf0db('0x37')]()]&&_0x115578[_0xf0db('0x13')]['push']({'id':_0x13ff39[_0xf0db('0x39')],'value':_0x44978d[_0x13ff39[_0xf0db('0x3d')]['name'][_0xf0db('0x37')]()][_0xf0db('0x2c')]()});}});}return _0x115578;}exports[_0xf0db('0x3e')]=function(_0x281480,_0x50133a,_0x45aa5a,_0x2f76e8,_0x5207c7,_0x17054a){var _0x1808e7,_0x3b27f4;_0x17054a['remoteUri']=intUtil[_0xf0db('0x3f')](_0x17054a[_0xf0db('0x19')]);_0x17054a['serverUrl']=intUtil[_0xf0db('0x3f')](_0x17054a['serverUrl']);if(_0x5207c7&&_0x5207c7[_0xf0db('0x40')]){logger[_0xf0db('0x9')]('[QUEUE]',_0xf0db('0x41'));_0x50133a[_0xf0db('0x42')]=util[_0xf0db('0x17')](_0xf0db('0x43'),_0x17054a[_0xf0db('0x44')],_0x50133a[_0xf0db('0x45')],md5(_0x50133a[_0xf0db('0x45')]));}else{_0x50133a[_0xf0db('0x42')]='';}headers['Authorization']=getAuth(_0x17054a);return getUser(_0x17054a,_0x2f76e8[_0xf0db('0x21')])[_0xf0db('0x1a')](function(_0x421811){_0x1808e7=_0x421811;logger['info'](_0xf0db('0x46'),_0x1808e7['id']);return getEndUser(_0x17054a,_0x50133a[_0xf0db('0x47')],_0x50133a['calleridnum']);})['then'](function(_0x28c590){_0x3b27f4=_0x28c590;logger[_0xf0db('0x9')](_0xf0db('0x48'),_0x3b27f4['id']);return getTicket(_0x17054a,_0x1808e7,_0x3b27f4,_0x45aa5a,_0x50133a);})[_0xf0db('0x1a')](function(_0x2c45bd){if(_0x2c45bd&&_0x2c45bd['id']){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2c45bd['id']);logger[_0xf0db('0x9')]('[QUEUE]',_0xf0db('0x49'));emit(util[_0xf0db('0x17')]('user:%s',_0x2f76e8[_0xf0db('0x12')]),_0xf0db('0x4a'),{'uri':util[_0xf0db('0x17')](_0xf0db('0x4b'),_0x17054a[_0xf0db('0x19')],_0x2c45bd['id'])});}})['catch'](function(_0x25ea3d){logger['error']('[QUEUE]',JSON[_0xf0db('0x2f')](_0x25ea3d));});};exports[_0xf0db('0x4c')]=function(_0x2a922d,_0x1ef453,_0x46c7d8,_0x569532,_0x53e563,_0x313834,_0xafde6d){var _0xea9c38,_0x1c3a58;_0x313834['remoteUri']=intUtil[_0xf0db('0x3f')](_0x313834[_0xf0db('0x19')]);_0x313834[_0xf0db('0x44')]=intUtil[_0xf0db('0x3f')](_0x313834['serverUrl']);if(_0xafde6d&&_0xafde6d[_0xf0db('0x4d')]&&_0xafde6d[_0xf0db('0x4d')]!==_0xf0db('0x4e')){logger[_0xf0db('0x9')]('[OUTBOUND]',_0xf0db('0x41'));_0x1ef453[_0xf0db('0x42')]=util['format'](_0xf0db('0x43'),_0x313834['serverUrl'],_0x1ef453['uniqueid'],md5(_0x1ef453[_0xf0db('0x45')]));}headers[_0xf0db('0x4f')]=getAuth(_0x313834);return getUser(_0x313834,_0x569532[_0xf0db('0x21')])[_0xf0db('0x1a')](function(_0x5f0b44){_0xea9c38=_0x5f0b44;logger[_0xf0db('0x9')](_0xf0db('0x46'),_0xea9c38['id']);return getEndUser(_0x313834,_0x1ef453[_0xf0db('0x50')],_0x1ef453[_0xf0db('0x51')]);})[_0xf0db('0x1a')](function(_0x2278ac){_0x1c3a58=_0x2278ac;logger[_0xf0db('0x9')](_0xf0db('0x48'),_0x1c3a58['id']);return getTicket(_0x313834,_0xea9c38,_0x1c3a58,_0x46c7d8,_0x1ef453);})[_0xf0db('0x1a')](function(_0x522408){if(_0x522408&&_0x522408['id']){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger[_0xf0db('0x9')](_0xf0db('0x52'),_0x522408['id']);logger[_0xf0db('0x9')](_0xf0db('0x53'),_0xf0db('0x49'));emit(util[_0xf0db('0x17')](_0xf0db('0x54'),_0x569532['name']),_0xf0db('0x4a'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x313834[_0xf0db('0x19')],_0x522408['id'])});}})[_0xf0db('0x55')](function(_0x15d79a){logger[_0xf0db('0x56')](_0xf0db('0x53'),JSON[_0xf0db('0x2f')](_0x15d79a));});};exports[_0xf0db('0x57')]=function(_0x560b18,_0x1534b2,_0x282781,_0x452be5,_0x53e282,_0xdbabc4){var _0x49e2c0,_0x30aa4b;_0xdbabc4[_0xf0db('0x19')]=intUtil[_0xf0db('0x3f')](_0xdbabc4[_0xf0db('0x19')]);_0xdbabc4[_0xf0db('0x44')]=intUtil[_0xf0db('0x3f')](_0xdbabc4[_0xf0db('0x44')]);if(_0x53e282&&_0x53e282[_0xf0db('0x40')]){logger[_0xf0db('0x9')]('['+_0x1534b2[_0xf0db('0x58')][_0xf0db('0x59')]()+']',_0xf0db('0x41'));_0x1534b2[_0xf0db('0x42')]=util[_0xf0db('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xdbabc4[_0xf0db('0x44')],_0x1534b2[_0xf0db('0x45')],md5(_0x1534b2[_0xf0db('0x45')]));}else{_0x1534b2[_0xf0db('0x42')]='';}headers['Authorization']=getAuth(_0xdbabc4);return getUser(_0xdbabc4,'')[_0xf0db('0x1a')](function(_0x473fcb){_0x49e2c0=_0x473fcb;logger[_0xf0db('0x9')]('The\x20User\x20ID\x20is:',_0x49e2c0['id']);return getEndUser(_0xdbabc4,_0x1534b2[_0xf0db('0x47')],_0x1534b2['calleridnum']);})[_0xf0db('0x1a')](function(_0x14c550){_0x30aa4b=_0x14c550;logger['info'](_0xf0db('0x48'),_0x30aa4b['id']);return getTicket(_0xdbabc4,_0x49e2c0,_0x30aa4b,_0x282781,_0x1534b2);})['then'](function(_0x1fd8a6){if(_0x1fd8a6){logger[_0xf0db('0x9')](_0xf0db('0x1b'));logger[_0xf0db('0x9')](_0xf0db('0x52'),_0x1fd8a6['id']);}})[_0xf0db('0x55')](function(_0x516090){logger[_0xf0db('0x56')]('['+_0x1534b2[_0xf0db('0x58')]['toUpperCase']()+']',JSON[_0xf0db('0x2f')](_0x516090));});}; \ No newline at end of file +var _0x623f=['Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','%s/helpdesk/tickets/%d','catch','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','Subjects','getString','Descriptions','
','Tags','name','Fields','custom_fields','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','type','nameField','toLowerCase','content','idField','customField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x623f,0x17e));var _0xf623=function(_0x4ebd43,_0x19b7bf){_0x4ebd43=_0x4ebd43-0x0;var _0x259754=_0x623f[_0x4ebd43];return _0x259754;};'use strict';var _=require('lodash');var rp=require(_0xf623('0x0'));var md5=require(_0xf623('0x1'));var util=require(_0xf623('0x2'));var Redis=require(_0xf623('0x3'));var intUtil=require(_0xf623('0x4'));var config=require(_0xf623('0x5'));var logger=require(_0xf623('0x6'))(_0xf623('0x7'));config[_0xf623('0x8')]=_[_0xf623('0x9')](config[_0xf623('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xf623('0xa'))(new Redis(config[_0xf623('0x8')]));var headers={'Content-Type':_0xf623('0xb'),'Accept':'application/json'};function emit(_0x283a6d,_0x93313d,_0x146496){io['to'](_0x283a6d)[_0xf623('0xc')](_0x93313d,_0x146496);}function getTicket(_0x53e236,_0x1888f2,_0x3d4cfe,_0x5cde8c,_0x57e4d3){logger[_0xf623('0xd')](_0xf623('0xe'));var _0x13a445=_[_0xf623('0xf')]({'responder_id':_0x1888f2['id'],'requester_id':_0x3d4cfe['id'],'name':util['format']('Caller\x20-\x20%s',_0x57e4d3[_0xf623('0x10')]),'phone':_0x57e4d3['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5cde8c[_0xf623('0x11')],_0x57e4d3,'\x20'),'description':intUtil[_0xf623('0x12')](_0x5cde8c[_0xf623('0x13')],_0x57e4d3,_0xf623('0x14')),'tags':getTags(_0x5cde8c[_0xf623('0x15')],_0xf623('0x16'))},getCustomFields(_0x5cde8c[_0xf623('0x17')],_0x57e4d3));_0x13a445[_0xf623('0x18')]=_['mapValues'](_['keyBy'](_0x13a445['custom_fields'],'id'),_0xf623('0x19'));return request({'uri':util['format']('%s/api/v2/tickets',_0x53e236[_0xf623('0x1a')]),'method':_0xf623('0x1b'),'body':_0x13a445})[_0xf623('0x1c')](function(_0x45a222){logger[_0xf623('0xd')](_0xf623('0x1d'));return _0x45a222;});}function getUser(_0x40e62e,_0x35fb10){if(intUtil[_0xf623('0x1e')](_0x35fb10)){return request({'uri':util[_0xf623('0x1f')](_0xf623('0x20'),_0x40e62e[_0xf623('0x1a')]),'qs':{'email':_0x35fb10}})[_0xf623('0x1c')](function(_0x2cfc33){if(_0x2cfc33[_0xf623('0x21')]){logger[_0xf623('0xd')](_0xf623('0x22'));return _[_0xf623('0x23')](_0x2cfc33,function(_0x32b482){return _0x32b482[_0xf623('0x24')]['email']===_0x35fb10;});}else{logger[_0xf623('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf623('0x1f')](_0xf623('0x25'),_0x40e62e[_0xf623('0x1a')])})['then'](function(_0x5e8b81){logger[_0xf623('0xd')](_0xf623('0x26'));return _0x5e8b81;});}});}else{logger['info'](_0xf623('0x27'));return request({'uri':util[_0xf623('0x1f')](_0xf623('0x25'),_0x40e62e[_0xf623('0x1a')])})[_0xf623('0x1c')](function(_0xe26475){logger[_0xf623('0xd')](_0xf623('0x26'));return _0xe26475;});}}function getEndUser(_0xab5338,_0x2fa902,_0x1c6e7c){logger[_0xf623('0xd')](_0xf623('0x28'),_0x1c6e7c);return request({'uri':util[_0xf623('0x1f')](_0xf623('0x29'),_0xab5338[_0xf623('0x1a')]),'qs':{'phone':_0x1c6e7c}})['then'](function(_0x102e0e){if(_0x102e0e[_0xf623('0x21')]){logger[_0xf623('0xd')]('Enduser\x20found!');return _[_0xf623('0x23')](_0x102e0e,{'phone':_0x1c6e7c});}else{logger[_0xf623('0xd')](_0xf623('0x2a'));return request({'uri':util[_0xf623('0x1f')](_0xf623('0x29'),_0xab5338[_0xf623('0x1a')]),'method':_0xf623('0x1b'),'body':{'name':_0x2fa902,'phone':_0x1c6e7c}})[_0xf623('0x1c')](function(_0x3fdb2d){logger[_0xf623('0xd')](_0xf623('0x2b'));return _0x3fdb2d;});}});}function getAuth(_0x45cd52){return util[_0xf623('0x1f')]('Basic\x20%s',new Buffer(_0x45cd52[_0xf623('0x2c')]+':X')[_0xf623('0x2d')](_0xf623('0x2e')));}function request(_0x2f8160){logger[_0xf623('0x2f')](_0xf623('0x30'),JSON[_0xf623('0x31')](_0x2f8160));return rp(_[_0xf623('0x9')](_0x2f8160,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2fdd00,_0x4d5809){var _0x5dcd88=[];if(_0x2fdd00&&_0x2fdd00[_0xf623('0x21')]>0x0){_0x5dcd88=_[_0xf623('0x32')](_0x2fdd00,_0x4d5809);}return _0x5dcd88;}function getCustomFields(_0x4191f2,_0x522002){var _0x4821af=[];var _0x49fe2e={'custom_fields':[]};if(_0x4191f2['length']>0x0){_[_0xf623('0x33')](_0x4191f2,function(_0x45c9d2){if(_[_0xf623('0x34')]([_0xf623('0x35'),'picklist'],_0x45c9d2[_0xf623('0x36')])&&_0x45c9d2['nameField']&&!_0x45c9d2['customField']){_0x49fe2e[_0x45c9d2[_0xf623('0x37')][_0xf623('0x38')]()]=_0x45c9d2[_0xf623('0x39')][_0xf623('0x2d')]();}else if(_['includes']([_0xf623('0x35'),'picklist'],_0x45c9d2[_0xf623('0x36')])&&_0x45c9d2[_0xf623('0x3a')]&&_0x45c9d2[_0xf623('0x3b')]){_0x49fe2e['custom_fields'][_0xf623('0x3c')]({'id':_0x45c9d2[_0xf623('0x3a')],'value':_0x45c9d2['content'][_0xf623('0x2d')]()});}else if(_0x45c9d2[_0xf623('0x36')]===_0xf623('0x3d')&&_0x45c9d2['variableName']&&_0x45c9d2['idField']&&_0x45c9d2[_0xf623('0x3b')]){_0x522002[_0x45c9d2[_0xf623('0x3e')]]&&_0x49fe2e['custom_fields']['push']({'id':_0x45c9d2[_0xf623('0x3a')],'value':_0x522002[_0x45c9d2[_0xf623('0x3e')]][_0xf623('0x2d')]()});}else if(_0x45c9d2[_0xf623('0x36')]==='customVariable'&&_0x45c9d2[_0xf623('0x3f')]&&_0x45c9d2[_0xf623('0x3f')][_0xf623('0x16')]&&_0x45c9d2[_0xf623('0x3a')]&&_0x45c9d2[_0xf623('0x3b')]){_0x522002[_0x45c9d2[_0xf623('0x3f')][_0xf623('0x16')][_0xf623('0x38')]()]&&_0x49fe2e[_0xf623('0x18')][_0xf623('0x3c')]({'id':_0x45c9d2[_0xf623('0x3a')],'value':_0x522002[_0x45c9d2[_0xf623('0x3f')][_0xf623('0x16')][_0xf623('0x38')]()][_0xf623('0x2d')]()});}});}return _0x49fe2e;}exports[_0xf623('0x40')]=function(_0x5ba737,_0x5ad242,_0x5e8f94,_0x512340,_0x28bcbb,_0x35b2a3){var _0x16a278,_0x486138;_0x35b2a3['remoteUri']=intUtil[_0xf623('0x41')](_0x35b2a3[_0xf623('0x1a')]);_0x35b2a3[_0xf623('0x42')]=intUtil[_0xf623('0x41')](_0x35b2a3[_0xf623('0x42')]);if(_0x28bcbb&&_0x28bcbb[_0xf623('0x43')]){logger['info'](_0xf623('0x44'),_0xf623('0x45'));_0x5ad242[_0xf623('0x46')]=util[_0xf623('0x1f')](_0xf623('0x47'),_0x35b2a3[_0xf623('0x42')],_0x5ad242[_0xf623('0x48')],md5(_0x5ad242[_0xf623('0x48')]));}else{_0x5ad242['recordingURL']='';}headers[_0xf623('0x49')]=getAuth(_0x35b2a3);return getUser(_0x35b2a3,_0x512340[_0xf623('0x4a')])[_0xf623('0x1c')](function(_0x1871b4){_0x16a278=_0x1871b4;logger[_0xf623('0xd')]('The\x20User\x20ID\x20is:',_0x16a278['id']);return getEndUser(_0x35b2a3,_0x5ad242[_0xf623('0x10')],_0x5ad242[_0xf623('0x4b')]);})['then'](function(_0x857639){_0x486138=_0x857639;logger[_0xf623('0xd')](_0xf623('0x4c'),_0x486138['id']);return getTicket(_0x35b2a3,_0x16a278,_0x486138,_0x5e8f94,_0x5ad242);})['then'](function(_0x275668){if(_0x275668&&_0x275668['id']){logger[_0xf623('0xd')](_0xf623('0x1d'));logger[_0xf623('0xd')](_0xf623('0x4d'),_0x275668['id']);logger['info'](_0xf623('0x44'),_0xf623('0x4e'));emit(util[_0xf623('0x1f')](_0xf623('0x4f'),_0x512340[_0xf623('0x16')]),_0xf623('0x50'),{'uri':util[_0xf623('0x1f')]('%s/helpdesk/tickets/%d',_0x35b2a3['remoteUri'],_0x275668['id'])});}})['catch'](function(_0x4c3fb2){logger[_0xf623('0x51')](_0xf623('0x44'),JSON[_0xf623('0x31')](_0x4c3fb2));});};exports[_0xf623('0x52')]=function(_0xf2925b,_0x2b6cfa,_0x233578,_0x1545a0,_0x391b3a,_0x31e2fd,_0x56505){var _0x3d12fd,_0x519a5a;_0x31e2fd['remoteUri']=intUtil['stripTrailingSlash'](_0x31e2fd[_0xf623('0x1a')]);_0x31e2fd[_0xf623('0x42')]=intUtil[_0xf623('0x41')](_0x31e2fd[_0xf623('0x42')]);if(_0x56505&&_0x56505[_0xf623('0x53')]&&_0x56505[_0xf623('0x53')]!=='none'){logger['info'](_0xf623('0x54'),_0xf623('0x45'));_0x2b6cfa[_0xf623('0x46')]=util[_0xf623('0x1f')](_0xf623('0x47'),_0x31e2fd[_0xf623('0x42')],_0x2b6cfa['uniqueid'],md5(_0x2b6cfa[_0xf623('0x48')]));}headers[_0xf623('0x49')]=getAuth(_0x31e2fd);return getUser(_0x31e2fd,_0x1545a0[_0xf623('0x4a')])[_0xf623('0x1c')](function(_0x1979d6){_0x3d12fd=_0x1979d6;logger[_0xf623('0xd')](_0xf623('0x55'),_0x3d12fd['id']);return getEndUser(_0x31e2fd,_0x2b6cfa[_0xf623('0x56')],_0x2b6cfa['destcalleridnum']);})[_0xf623('0x1c')](function(_0x39180b){_0x519a5a=_0x39180b;logger['info'](_0xf623('0x4c'),_0x519a5a['id']);return getTicket(_0x31e2fd,_0x3d12fd,_0x519a5a,_0x233578,_0x2b6cfa);})['then'](function(_0x5af48a){if(_0x5af48a&&_0x5af48a['id']){logger[_0xf623('0xd')](_0xf623('0x1d'));logger['info'](_0xf623('0x4d'),_0x5af48a['id']);logger[_0xf623('0xd')](_0xf623('0x54'),_0xf623('0x4e'));emit(util[_0xf623('0x1f')](_0xf623('0x4f'),_0x1545a0[_0xf623('0x16')]),'trigger:browser:url',{'uri':util[_0xf623('0x1f')](_0xf623('0x57'),_0x31e2fd[_0xf623('0x1a')],_0x5af48a['id'])});}})[_0xf623('0x58')](function(_0x18b137){logger['error']('[OUTBOUND]',JSON[_0xf623('0x31')](_0x18b137));});};exports['unmanaged']=function(_0x2d663a,_0x25e9b1,_0x5b4017,_0x4223d6,_0x305255,_0x342514){var _0x5d1b99,_0x5ef8c2;_0x342514[_0xf623('0x1a')]=intUtil[_0xf623('0x41')](_0x342514['remoteUri']);_0x342514[_0xf623('0x42')]=intUtil['stripTrailingSlash'](_0x342514[_0xf623('0x42')]);if(_0x305255&&_0x305255[_0xf623('0x43')]){logger[_0xf623('0xd')]('['+_0x25e9b1[_0xf623('0x59')][_0xf623('0x5a')]()+']',_0xf623('0x45'));_0x25e9b1[_0xf623('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x342514[_0xf623('0x42')],_0x25e9b1[_0xf623('0x48')],md5(_0x25e9b1[_0xf623('0x48')]));}else{_0x25e9b1[_0xf623('0x46')]='';}headers[_0xf623('0x49')]=getAuth(_0x342514);return getUser(_0x342514,'')[_0xf623('0x1c')](function(_0x43cec3){_0x5d1b99=_0x43cec3;logger['info'](_0xf623('0x55'),_0x5d1b99['id']);return getEndUser(_0x342514,_0x25e9b1[_0xf623('0x10')],_0x25e9b1[_0xf623('0x4b')]);})[_0xf623('0x1c')](function(_0x5f05d0){_0x5ef8c2=_0x5f05d0;logger[_0xf623('0xd')](_0xf623('0x4c'),_0x5ef8c2['id']);return getTicket(_0x342514,_0x5d1b99,_0x5ef8c2,_0x5b4017,_0x25e9b1);})[_0xf623('0x1c')](function(_0x11d555){if(_0x11d555){logger[_0xf623('0xd')]('Ticket\x20created!');logger[_0xf623('0xd')]('The\x20Ticket\x20ID\x20is:',_0x11d555['id']);}})['catch'](function(_0x21a859){logger['error']('['+_0x25e9b1[_0xf623('0x59')][_0xf623('0x5a')]()+']',JSON[_0xf623('0x31')](_0x21a859));});}; \ 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 f410709..00a744a 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 _0xc02b=['util','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Requested\x20Resource\x20not\x20Found','error','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','toUpperCase','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','adminId','add','ticketId','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise'];(function(_0x22f036,_0x3c285d){var _0x1d68c3=function(_0x3327ac){while(--_0x3327ac){_0x22f036['push'](_0x22f036['shift']());}};_0x1d68c3(++_0x3c285d);}(_0xc02b,0xfe));var _0xbc02=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0xc02b[_0x1123bb];return _0xdeb602;};'use strict';var _=require('lodash');var rp=require(_0xbc02('0x0'));var md5=require('md5');var util=require(_0xbc02('0x1'));var moment=require('moment');var Promise=require(_0xbc02('0x2'));var Redis=require(_0xbc02('0x3'));var intUtil=require(_0xbc02('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbc02('0x5'))(_0xbc02('0x6'));config[_0xbc02('0x7')]=_[_0xbc02('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbc02('0x9'))(new Redis(config[_0xbc02('0x7')]));function getAdminId(_0x46b610,_0x7055da,_0x45a804,_0x53f40e){return new Promise(function(_0x4627f7,_0x58f25a){var _0xe56241=![];var _0x5b04d5={'method':_0xbc02('0xa'),'uri':_0x53f40e+_0xbc02('0xb'),'json':!![]};_0x5b04d5[_0xbc02('0xc')]=_0x45a804;logger[_0xbc02('0xd')](_0xbc02('0xe'));return rp(_0x5b04d5)[_0xbc02('0xf')](function(_0x31f27a){if(_0x31f27a){var _0x17e5f0=_0x31f27a[_0xbc02('0x10')];var _0x44a599=null;for(_0x44a599=0x0;_0x44a599<_0x17e5f0[_0xbc02('0x11')];_0x44a599++){if(_0x17e5f0[_0x44a599][_0xbc02('0x12')]===_0x46b610[_0xbc02('0x13')]){_0x46b610['adminId']=_0x17e5f0[_0x44a599]['id'];_0xe56241=!![];}}if(_0xe56241){logger[_0xbc02('0xd')]('Admin\x20found:',_0x46b610['adminId']);_0x4627f7(_0x46b610);}else{_0x58f25a({'statusCode':0x194,'message':_0xbc02('0x14')});}}else{_0x58f25a({'statusCode':0x194,'message':_0xbc02('0x14')});}})['catch'](function(_0x5115fb){logger[_0xbc02('0x15')]('['+[_0x7055da['toUpperCase']()]+']',_0x5115fb[_0xbc02('0x16')]);_0x58f25a(_0x5115fb);});});}function getUser(_0x411849,_0x37abb9,_0x317e30){return function(_0x3cbf7c){return new Promise(function(_0x42499f,_0x4d35de){var _0x37c9ac={'method':_0xbc02('0xa'),'uri':_0x317e30+_0xbc02('0xb'),'json':!![]};_0x37c9ac[_0xbc02('0xc')]=_0x37abb9;logger['info'](_0xbc02('0x17'));return rp(_0x37c9ac)[_0xbc02('0xf')](function(_0x4beafc){if(_0x4beafc){var _0x548d04=_0x4beafc[_0xbc02('0x10')];var _0x357258=![];var _0x32c8c6=null;if(_0x3cbf7c[_0xbc02('0x18')]!==null){logger['info'](_0xbc02('0x19'),_0x3cbf7c[_0xbc02('0x18')]);_0x3cbf7c[_0xbc02('0x1a')]=_0x3cbf7c[_0xbc02('0x18')];for(_0x32c8c6=0x0;_0x32c8c6<_0x548d04[_0xbc02('0x11')];_0x32c8c6++){if(_0x548d04[_0x32c8c6]['email']===_0x3cbf7c[_0xbc02('0x18')]){_0x357258=!![];_0x3cbf7c[_0xbc02('0x1b')]=_0x548d04[_0x32c8c6]['id'];logger['info'](_0xbc02('0x1c'),_0x3cbf7c[_0xbc02('0x1b')]);}}}if(!_0x357258){logger[_0xbc02('0xd')](_0xbc02('0x1d'));_0x3cbf7c[_0xbc02('0x1a')]=_0x3cbf7c[_0xbc02('0x13')];_0x3cbf7c[_0xbc02('0x1b')]=_0x3cbf7c['adminId'];_0x357258=!![];}if(_0x357258){_0x42499f(_0x3cbf7c);}else{_0x4d35de({'statusCode':0x194,'message':_0xbc02('0x14')});}}else{_0x4d35de({'statusCode':0x194,'message':_0xbc02('0x14')});}})[_0xbc02('0x1e')](function(_0x51e025){logger[_0xbc02('0x15')]('['+[_0x411849[_0xbc02('0x1f')]()]+']',_0x51e025['message']);_0x4d35de(_0x51e025);});});};}function searchContact(_0x313a8c,_0x5b59c2,_0x1e3507,_0x174de1){return new Promise(function(_0x57c24b,_0x29df53){var _0x5b6571={'method':'GET','headers':_0x5b59c2,'uri':_0x313a8c+_0xbc02('0x20')+_0x174de1+'&f='+_0x1e3507+_0xbc02('0x21'),'json':!![]};rp(_0x5b6571)[_0xbc02('0xf')](function(_0x215234){var _0x37fa5b=_[_0xbc02('0x22')](_0x215234[_0xbc02('0x23')][_0xbc02('0x23')],[_0x1e3507,_0x174de1]);_0x57c24b(_0x37fa5b);})['catch'](function(_0x7e7df2){_0x29df53(_0x7e7df2);});});}function getEndUser(_0x4d98ab,_0x635c98,_0x49c074){return function(_0x5d4a9e){return new Promise(function(_0x5b558c,_0x161e1f){logger[_0xbc02('0xd')](util[_0xbc02('0x24')](_0xbc02('0x25'),_0x5d4a9e['contactNumber']));searchContact(_0x49c074,_0x635c98,_0xbc02('0x26'),_0x5d4a9e[_0xbc02('0x27')])[_0xbc02('0xf')](function(_0x38fc0b){if(_0x38fc0b){_0x5d4a9e['endUserId']=_0x38fc0b['id'];logger[_0xbc02('0xd')](_0xbc02('0x28'),_0x5d4a9e['endUserId']);return _0x5b558c(_0x5d4a9e);}searchContact(_0x49c074,_0x635c98,_0xbc02('0x29'),_0x5d4a9e['contactNumber'])[_0xbc02('0xf')](function(_0x221403){if(_0x221403){_0x5d4a9e[_0xbc02('0x2a')]=_0x221403['id'];logger[_0xbc02('0xd')](_0xbc02('0x2b'),_0x5d4a9e[_0xbc02('0x2a')]);return _0x5b558c(_0x5d4a9e);}createEndUser(_0x5d4a9e,_0x4d98ab,_0x635c98,_0x49c074)[_0xbc02('0xf')](function(_0x38f70a){logger[_0xbc02('0xd')]('Contact\x20created:',_0x38f70a['endUserId']);return _0x5b558c(_0x38f70a);});});})[_0xbc02('0x1e')](function(_0x540e88){_0x161e1f(_0x540e88);});});};}function createEndUser(_0x7fedfb,_0x4fc11,_0xade618,_0x5a0b79){return new Promise(function(_0x2fe31b,_0x535836){var _0x34235e=moment();var _0x26d9de={'method':_0xbc02('0x2c'),'uri':_0x5a0b79+_0xbc02('0x2d'),'body':{'contact':{'last_name':_0x7fedfb[_0xbc02('0x27')],'work_number':_0x7fedfb[_0xbc02('0x27')],'mobile_number':_0x7fedfb[_0xbc02('0x27')],'owner_id':_0x7fedfb[_0xbc02('0x1b')],'created_at':_0x34235e['format'](_0xbc02('0x2e'))}},'json':!![]};_0x26d9de[_0xbc02('0xc')]=_0xade618;logger['info'](_0xbc02('0x2f'));return rp(_0x26d9de)[_0xbc02('0xf')](function(_0x100dbb){_0x7fedfb['endUserId']=_0x100dbb[_0xbc02('0x30')]['id'];_0x2fe31b(_0x7fedfb);})[_0xbc02('0x1e')](function(_0x57f953){logger[_0xbc02('0x15')]('['+[_0x4fc11[_0xbc02('0x1f')]()]+']',_0x57f953[_0xbc02('0x16')]);_0x535836(_0x57f953[_0xbc02('0x16')]);});});}function getTicket(_0x44ae97,_0x1f2582,_0x17e602,_0x2c54da,_0x30a106){return function(_0x26ba8c){logger[_0xbc02('0xd')](_0xbc02('0x31'));return new Promise(function(_0x1e0905,_0x42a6b7){var _0x38b2df=moment();var _0x508ff0={'method':_0xbc02('0x2c'),'uri':_0x17e602+_0xbc02('0x32'),'body':{'title':intUtil[_0xbc02('0x33')](_0x2c54da['Subjects'],_0x30a106,'\x20'),'description':intUtil[_0xbc02('0x33')](_0x2c54da[_0xbc02('0x34')],_0x30a106,'\x0a'),'owner_id':_0x26ba8c[_0xbc02('0x1b')],'creater_id':_0x26ba8c[_0xbc02('0x35')],'targetable_id':_0x26ba8c[_0xbc02('0x2a')],'targetable_type':'Contact','created_at':_0x38b2df[_0xbc02('0x24')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x38b2df[_0xbc02('0x36')](0x1e,'m')[_0xbc02('0x24')](_0xbc02('0x2e'))},'json':!![]};_0x508ff0[_0xbc02('0xc')]=_0x1f2582;return rp(_0x508ff0)['then'](function(_0x4989ea){_0x26ba8c[_0xbc02('0x37')]=_0x4989ea['task']['id'];logger[_0xbc02('0xd')](_0xbc02('0x38'),_0x26ba8c['ticketId']);_0x1e0905(_0x26ba8c);})['catch'](function(_0x5a0830){logger['error']('['+[_0x44ae97[_0xbc02('0x1f')]()]+']',_0x5a0830[_0xbc02('0x16')]);_0x42a6b7(_0x5a0830[_0xbc02('0x16')]);});});};}function emit(_0x2767aa,_0x221768,_0x197d2a){var _0x341faa={'uri':_0x2767aa+'/contacts/'+_0x197d2a};io['to'](util[_0xbc02('0x24')](_0xbc02('0x39'),_0x221768))[_0xbc02('0x3a')](_0xbc02('0x3b'),_0x341faa);}exports['cs']=function(_0x5c5f52,_0x2c48c9,_0x572197,_0x36a6a4,_0x35441c,_0x3710a5,_0x3fe4a0,_0x13ea01){var _0x387254={};var _0x1349f5={'Authorization':_0xbc02('0x3c')+_0x3710a5[_0xbc02('0x3d')]};_0x3710a5[_0xbc02('0x3e')]=intUtil[_0xbc02('0x3f')](_0x3710a5[_0xbc02('0x3e')]);_0x3710a5[_0xbc02('0x40')]=intUtil['stripTrailingSlash'](_0x3710a5[_0xbc02('0x40')]);var _0x395db9=_0x3710a5[_0xbc02('0x3e')];_0x387254[_0xbc02('0x13')]=_0x3710a5[_0xbc02('0x41')];_0x387254[_0xbc02('0x27')]=_0x13ea01['toLowerCase']()===_0xbc02('0x42')?_0x2c48c9[_0xbc02('0x43')]:_0x2c48c9['calleridnum'];_0x387254[_0xbc02('0x44')]=_0x13ea01===_0xbc02('0x45')||_0x13ea01===_0xbc02('0x46')?_0xbc02('0x45'):_0xbc02('0x42');if(_0x36a6a4){_0x387254[_0xbc02('0x18')]=_0x36a6a4['email'];}var _0x248b3f=util[_0xbc02('0x24')](_0xbc02('0x47'),_0x3710a5[_0xbc02('0x40')],_0x2c48c9[_0xbc02('0x48')],md5(_0x2c48c9[_0xbc02('0x48')]));if(_0x35441c&&_0x35441c[_0xbc02('0x49')]){logger[_0xbc02('0xd')](_0xbc02('0x4a'),_0xbc02('0x4b'));_0x2c48c9['recordingURL']=_0x248b3f;}else if(_0x3fe4a0&&_0x3fe4a0[_0xbc02('0x4c')]&&_0x3fe4a0['recordingFormat']!==_0xbc02('0x4d')){logger['info'](_0xbc02('0x4e'),_0xbc02('0x4b'));_0x2c48c9[_0xbc02('0x4f')]=_0x248b3f;}else{_0x2c48c9[_0xbc02('0x4f')]='';}return getAdminId(_0x387254,_0x13ea01,_0x1349f5,_0x395db9)[_0xbc02('0xf')](getUser(_0x13ea01,_0x1349f5,_0x395db9))[_0xbc02('0xf')](getEndUser(_0x13ea01,_0x1349f5,_0x395db9))[_0xbc02('0xf')](getTicket(_0x13ea01,_0x1349f5,_0x395db9,_0x572197,_0x2c48c9))[_0xbc02('0xf')](function(_0x2755b4){logger[_0xbc02('0xd')](util[_0xbc02('0x24')](_0xbc02('0x50'),_0x2755b4[_0xbc02('0x37')]));if(_0x13ea01!==_0xbc02('0x46')){logger[_0xbc02('0xd')]('['+[_0x13ea01[_0xbc02('0x1f')]()]+']',_0xbc02('0x51'));emit(_0x395db9,_0x36a6a4[_0xbc02('0x52')],_0x2755b4['endUserId']);}})[_0xbc02('0x1e')](function(_0x59e1fd){logger[_0xbc02('0x15')]('['+[_0x13ea01['toUpperCase']()]+_0xbc02('0x53'),util[_0xbc02('0x54')](_0x59e1fd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x94d1=['callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','lodash','request-promise','util','moment','bluebird','ioredis','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','users','userEmail','agentEmail','User\x20found:','userId','Admin\x20selected','catch','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','contactNumber','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','getString','Subjects','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum'];(function(_0x3c7c72,_0x215c61){var _0x5048b7=function(_0x43751a){while(--_0x43751a){_0x3c7c72['push'](_0x3c7c72['shift']());}};_0x5048b7(++_0x215c61);}(_0x94d1,0x1d3));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var rp=require(_0x194d('0x1'));var md5=require('md5');var util=require(_0x194d('0x2'));var moment=require(_0x194d('0x3'));var Promise=require(_0x194d('0x4'));var Redis=require(_0x194d('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x194d('0x6'));config[_0x194d('0x7')]=_[_0x194d('0x8')](config[_0x194d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x194d('0x9'))(new Redis(config[_0x194d('0x7')]));function getAdminId(_0x3ab429,_0x3a9a52,_0x370d19,_0x3ee4b8){return new Promise(function(_0x5dc3c2,_0x531f35){var _0x5cac2d=![];var _0x1fa8ef={'method':_0x194d('0xa'),'uri':_0x3ee4b8+_0x194d('0xb'),'json':!![]};_0x1fa8ef[_0x194d('0xc')]=_0x370d19;logger[_0x194d('0xd')](_0x194d('0xe'));return rp(_0x1fa8ef)[_0x194d('0xf')](function(_0x551847){if(_0x551847){var _0x3edf4e=_0x551847['users'];var _0x1777b0=null;for(_0x1777b0=0x0;_0x1777b0<_0x3edf4e[_0x194d('0x10')];_0x1777b0++){if(_0x3edf4e[_0x1777b0][_0x194d('0x11')]===_0x3ab429[_0x194d('0x12')]){_0x3ab429[_0x194d('0x13')]=_0x3edf4e[_0x1777b0]['id'];_0x5cac2d=!![];}}if(_0x5cac2d){logger['info']('Admin\x20found:',_0x3ab429[_0x194d('0x13')]);_0x5dc3c2(_0x3ab429);}else{_0x531f35({'statusCode':0x194,'message':_0x194d('0x14')});}}else{_0x531f35({'statusCode':0x194,'message':_0x194d('0x14')});}})['catch'](function(_0xd9a441){logger[_0x194d('0x15')]('['+[_0x3a9a52[_0x194d('0x16')]()]+']',_0xd9a441[_0x194d('0x17')]);_0x531f35(_0xd9a441);});});}function getUser(_0x4d4bae,_0x4f6db4,_0x2cc102){return function(_0x27011e){return new Promise(function(_0x5eb42d,_0x41bcf9){var _0x57dd54={'method':_0x194d('0xa'),'uri':_0x2cc102+_0x194d('0xb'),'json':!![]};_0x57dd54['headers']=_0x4f6db4;logger[_0x194d('0xd')](_0x194d('0x18'));return rp(_0x57dd54)[_0x194d('0xf')](function(_0x6bc48a){if(_0x6bc48a){var _0x4ebc8b=_0x6bc48a[_0x194d('0x19')];var _0x17b113=![];var _0xa5747b=null;if(_0x27011e['agentEmail']!==null){logger[_0x194d('0xd')]('Getting\x20user\x20with\x20email',_0x27011e['agentEmail']);_0x27011e[_0x194d('0x1a')]=_0x27011e[_0x194d('0x1b')];for(_0xa5747b=0x0;_0xa5747b<_0x4ebc8b[_0x194d('0x10')];_0xa5747b++){if(_0x4ebc8b[_0xa5747b][_0x194d('0x11')]===_0x27011e[_0x194d('0x1b')]){_0x17b113=!![];_0x27011e['userId']=_0x4ebc8b[_0xa5747b]['id'];logger[_0x194d('0xd')](_0x194d('0x1c'),_0x27011e[_0x194d('0x1d')]);}}}if(!_0x17b113){logger[_0x194d('0xd')](_0x194d('0x1e'));_0x27011e[_0x194d('0x1a')]=_0x27011e['adminEmail'];_0x27011e[_0x194d('0x1d')]=_0x27011e[_0x194d('0x13')];_0x17b113=!![];}if(_0x17b113){_0x5eb42d(_0x27011e);}else{_0x41bcf9({'statusCode':0x194,'message':_0x194d('0x14')});}}else{_0x41bcf9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x194d('0x1f')](function(_0x12f64a){logger['error']('['+[_0x4d4bae[_0x194d('0x16')]()]+']',_0x12f64a[_0x194d('0x17')]);_0x41bcf9(_0x12f64a);});});};}function searchContact(_0x3b75bf,_0x43e31a,_0x436b1f,_0xc7322a){return new Promise(function(_0x109ffd,_0x427180){var _0x51256b={'method':_0x194d('0xa'),'headers':_0x43e31a,'uri':_0x3b75bf+_0x194d('0x20')+_0xc7322a+_0x194d('0x21')+_0x436b1f+_0x194d('0x22'),'json':!![]};rp(_0x51256b)[_0x194d('0xf')](function(_0x5ab20b){var _0x292cd8=_[_0x194d('0x23')](_0x5ab20b[_0x194d('0x24')]['contacts'],[_0x436b1f,_0xc7322a]);_0x109ffd(_0x292cd8);})['catch'](function(_0x40db65){_0x427180(_0x40db65);});});}function getEndUser(_0x193133,_0x423de0,_0x46ed97){return function(_0x7ae814){return new Promise(function(_0x33bc92,_0x47c41f){logger[_0x194d('0xd')](util['format'](_0x194d('0x25'),_0x7ae814['contactNumber']));searchContact(_0x46ed97,_0x423de0,_0x194d('0x26'),_0x7ae814['contactNumber'])[_0x194d('0xf')](function(_0x2c2a79){if(_0x2c2a79){_0x7ae814[_0x194d('0x27')]=_0x2c2a79['id'];logger[_0x194d('0xd')]('Contact\x20found\x20mobile_number:',_0x7ae814[_0x194d('0x27')]);return _0x33bc92(_0x7ae814);}searchContact(_0x46ed97,_0x423de0,_0x194d('0x28'),_0x7ae814['contactNumber'])[_0x194d('0xf')](function(_0xdfc92c){if(_0xdfc92c){_0x7ae814[_0x194d('0x27')]=_0xdfc92c['id'];logger['info'](_0x194d('0x29'),_0x7ae814[_0x194d('0x27')]);return _0x33bc92(_0x7ae814);}createEndUser(_0x7ae814,_0x193133,_0x423de0,_0x46ed97)[_0x194d('0xf')](function(_0x5c0d44){logger['info'](_0x194d('0x2a'),_0x5c0d44[_0x194d('0x27')]);return _0x33bc92(_0x5c0d44);});});})['catch'](function(_0x506e36){_0x47c41f(_0x506e36);});});};}function createEndUser(_0x2148e8,_0x56acf8,_0x543f4c,_0x10cc9c){return new Promise(function(_0x1111f5,_0x5243ba){var _0x4917d8=moment();var _0x2b4ad0={'method':_0x194d('0x2b'),'uri':_0x10cc9c+'/api/contacts','body':{'contact':{'last_name':_0x2148e8[_0x194d('0x2c')],'work_number':_0x2148e8[_0x194d('0x2c')],'mobile_number':_0x2148e8[_0x194d('0x2c')],'owner_id':_0x2148e8[_0x194d('0x1d')],'created_at':_0x4917d8[_0x194d('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x2b4ad0[_0x194d('0xc')]=_0x543f4c;logger[_0x194d('0xd')](_0x194d('0x2e'));return rp(_0x2b4ad0)['then'](function(_0x41cac2){_0x2148e8[_0x194d('0x27')]=_0x41cac2['contact']['id'];_0x1111f5(_0x2148e8);})[_0x194d('0x1f')](function(_0x1147aa){logger[_0x194d('0x15')]('['+[_0x56acf8[_0x194d('0x16')]()]+']',_0x1147aa[_0x194d('0x17')]);_0x5243ba(_0x1147aa[_0x194d('0x17')]);});});}function getTicket(_0x5311aa,_0x453b34,_0x2677c3,_0x1a6a65,_0x2134ca){return function(_0x32e545){logger[_0x194d('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x486e80,_0x336c41){var _0x524dc0=moment();var _0x189c3d={'method':_0x194d('0x2b'),'uri':_0x2677c3+'/api/tasks','body':{'title':intUtil[_0x194d('0x2f')](_0x1a6a65[_0x194d('0x30')],_0x2134ca,'\x20'),'description':intUtil[_0x194d('0x2f')](_0x1a6a65['Descriptions'],_0x2134ca,'\x0a'),'owner_id':_0x32e545['userId'],'creater_id':_0x32e545[_0x194d('0x13')],'targetable_id':_0x32e545[_0x194d('0x27')],'targetable_type':'Contact','created_at':_0x524dc0[_0x194d('0x2d')](_0x194d('0x31')),'due_date':_0x524dc0[_0x194d('0x32')](0x1e,'m')['format'](_0x194d('0x31'))},'json':!![]};_0x189c3d['headers']=_0x453b34;return rp(_0x189c3d)[_0x194d('0xf')](function(_0x35b368){_0x32e545[_0x194d('0x33')]=_0x35b368[_0x194d('0x34')]['id'];logger[_0x194d('0xd')](_0x194d('0x35'),_0x32e545[_0x194d('0x33')]);_0x486e80(_0x32e545);})[_0x194d('0x1f')](function(_0x284c53){logger['error']('['+[_0x5311aa[_0x194d('0x16')]()]+']',_0x284c53[_0x194d('0x17')]);_0x336c41(_0x284c53[_0x194d('0x17')]);});});};}function emit(_0x41ee6e,_0x11d2f4,_0x2216ab){var _0x38c9d6={'uri':_0x41ee6e+_0x194d('0x36')+_0x2216ab};io['to'](util[_0x194d('0x2d')]('user:%s',_0x11d2f4))[_0x194d('0x37')](_0x194d('0x38'),_0x38c9d6);}exports['cs']=function(_0xbf4a93,_0x48802b,_0x34abdc,_0x5d1d02,_0x141a5e,_0xd2199e,_0x3d394e,_0x58f319){var _0x4c0327={};var _0x5e9754={'Authorization':_0x194d('0x39')+_0xd2199e['apiKey']};_0xd2199e[_0x194d('0x3a')]=intUtil[_0x194d('0x3b')](_0xd2199e['remoteUri']);_0xd2199e[_0x194d('0x3c')]=intUtil[_0x194d('0x3b')](_0xd2199e[_0x194d('0x3c')]);var _0x9a149a=_0xd2199e[_0x194d('0x3a')];_0x4c0327[_0x194d('0x12')]=_0xd2199e[_0x194d('0x3d')];_0x4c0327[_0x194d('0x2c')]=_0x58f319[_0x194d('0x3e')]()==='outbound'?_0x48802b[_0x194d('0x3f')]:_0x48802b[_0x194d('0x40')];_0x4c0327[_0x194d('0x41')]=_0x58f319===_0x194d('0x42')||_0x58f319===_0x194d('0x43')?_0x194d('0x42'):'outbound';if(_0x5d1d02){_0x4c0327[_0x194d('0x1b')]=_0x5d1d02[_0x194d('0x11')];}var _0x11e747=util[_0x194d('0x2d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd2199e['serverUrl'],_0x48802b[_0x194d('0x44')],md5(_0x48802b[_0x194d('0x44')]));if(_0x141a5e&&_0x141a5e['monitor_format']){logger[_0x194d('0xd')](_0x194d('0x45'),_0x194d('0x46'));_0x48802b[_0x194d('0x47')]=_0x11e747;}else if(_0x3d394e&&_0x3d394e['recordingFormat']&&_0x3d394e['recordingFormat']!==_0x194d('0x48')){logger['info'](_0x194d('0x49'),'Recording\x20is\x20enabled!');_0x48802b[_0x194d('0x47')]=_0x11e747;}else{_0x48802b['recordingURL']='';}return getAdminId(_0x4c0327,_0x58f319,_0x5e9754,_0x9a149a)[_0x194d('0xf')](getUser(_0x58f319,_0x5e9754,_0x9a149a))['then'](getEndUser(_0x58f319,_0x5e9754,_0x9a149a))[_0x194d('0xf')](getTicket(_0x58f319,_0x5e9754,_0x9a149a,_0x34abdc,_0x48802b))[_0x194d('0xf')](function(_0x386339){logger[_0x194d('0xd')](util['format'](_0x194d('0x4a'),_0x386339[_0x194d('0x33')]));if(_0x58f319!==_0x194d('0x43')){logger[_0x194d('0xd')]('['+[_0x58f319[_0x194d('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x9a149a,_0x5d1d02[_0x194d('0x4b')],_0x386339[_0x194d('0x27')]);}})['catch'](function(_0x3597b9){logger[_0x194d('0x15')]('['+[_0x58f319[_0x194d('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x3597b9,{'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 d38592f..8b0ef41 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 _0x7bcd=['unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','dynamics365'];(function(_0xb18b17,_0x121eb1){var _0xd1ff7c=function(_0x3eea6f){while(--_0x3eea6f){_0xb18b17['push'](_0xb18b17['shift']());}};_0xd1ff7c(++_0x121eb1);}(_0x7bcd,0x19e));var _0xd7bc=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x7bcd[_0x470bfb];return _0x2f5d97;};'use strict';var _=require('lodash');var util=require(_0xd7bc('0x0'));var zendesk=require(_0xd7bc('0x1'));var salesforce=require(_0xd7bc('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xd7bc('0x3'));var zoho=require(_0xd7bc('0x4'));var desk=require('./desk');var vtiger=require(_0xd7bc('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xd7bc('0x6'));var freshsales=require(_0xd7bc('0x7'));var integrations=[_0xd7bc('0x8'),_0xd7bc('0x9'),_0xd7bc('0xa'),_0xd7bc('0xb'),_0xd7bc('0xc'),_0xd7bc('0xd'),_0xd7bc('0xe'),'dynamics365','freshsales',_0xd7bc('0xf')];exports['exec']=function(_0x462153,_0x2d8eac,_0x8dfd3,_0xe8f052,_0x257bdc,_0x2f6ec2){if(_0x8dfd3){if(_[_0xd7bc('0x10')](integrations,_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]())){try{var _0x5eb562=null;var _0x1bb454='';var _0x4dbc2e=_0x8dfd3[_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]()];if(_0x4dbc2e){var _0x2fc381=_0x4dbc2e[_0x462153[_0xd7bc('0x13')]];if(_0x2fc381){var _0xacfa71=_[_0xd7bc('0x14')](_0x2fc381[_0xd7bc('0x15')],{'id':parseInt(_0x462153[_0xd7bc('0x16')],0xa)});if(_0xacfa71){if(_0xe8f052){if(_0x257bdc&&_0x2d8eac['queue']){_0x1bb454=_0xd7bc('0x17');}else if(_0x2d8eac[_0xd7bc('0x18')]){_0x1bb454=_0xd7bc('0x19');}else{console[_0xd7bc('0x1a')](_0xd7bc('0x1b'),_0x2d8eac);}}else{_0x1bb454=_0xd7bc('0x1c');}switch(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]()){case'zendesk':zendesk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0x9'):salesforce[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xa'):sugarcrm[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xb'):freshdesk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xc'):zoho[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xd'):desk[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case _0xd7bc('0xe'):vtiger[_0x1bb454](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2);break;case'freshsales':freshsales['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;case _0xd7bc('0xf'):servicenow['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;case _0xd7bc('0x1d'):dynamics365['cs'](_0x462153,_0x2d8eac,_0xacfa71,_0xe8f052,_0x257bdc,_0x2fc381,_0x2f6ec2,_0x1bb454);break;default:console[_0xd7bc('0x1a')](_0xd7bc('0x1e'));}}else{_0x5eb562=require(_0xd7bc('0x1f'))(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]());_0x5eb562[_0xd7bc('0x20')](_0xd7bc('0x21'),util['format'](_0xd7bc('0x22'),_0x462153['data1']['toLowerCase'](),_0x462153['data3']));}}else{_0x5eb562=require('../../../../config/logger')(_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')]());_0x5eb562['error'](_0xd7bc('0x21'),util[_0xd7bc('0x23')](_0xd7bc('0x24'),_0x462153[_0xd7bc('0x11')][_0xd7bc('0x12')](),_0x462153[_0xd7bc('0x13')]));}}else{}}catch(_0x2dad0a){console[_0xd7bc('0x20')](_0x2dad0a);}}}}; \ No newline at end of file +var _0xb413=['log','unmanaged','freshdesk','desk','unknown\x20integration','error','[EXEC]','format','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','data2','find','Configurations','queue','outbound'];(function(_0x4ebb5d,_0x1e92b6){var _0x5abafd=function(_0x2e1f57){while(--_0x2e1f57){_0x4ebb5d['push'](_0x4ebb5d['shift']());}};_0x5abafd(++_0x1e92b6);}(_0xb413,0x158));var _0x3b41=function(_0x5b4a5d,_0x50898d){_0x5b4a5d=_0x5b4a5d-0x0;var _0x5d8171=_0xb413[_0x5b4a5d];return _0x5d8171;};'use strict';var _=require(_0x3b41('0x0'));var util=require('util');var zendesk=require(_0x3b41('0x1'));var salesforce=require(_0x3b41('0x2'));var sugarcrm=require(_0x3b41('0x3'));var freshdesk=require(_0x3b41('0x4'));var zoho=require(_0x3b41('0x5'));var desk=require(_0x3b41('0x6'));var vtiger=require(_0x3b41('0x7'));var servicenow=require(_0x3b41('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0x3b41('0x9'));var integrations=[_0x3b41('0xa'),_0x3b41('0xb'),_0x3b41('0xc'),'freshdesk',_0x3b41('0xd'),'desk',_0x3b41('0xe'),_0x3b41('0xf'),_0x3b41('0x10'),_0x3b41('0x11')];exports[_0x3b41('0x12')]=function(_0xf98d76,_0x4b9a22,_0x4de420,_0x18ae56,_0x433753,_0x416082){if(_0x4de420){if(_['includes'](integrations,_0xf98d76['data1'][_0x3b41('0x13')]())){try{var _0x523988=null;var _0x4d3e7c='';var _0x5e7dab=_0x4de420[_0xf98d76[_0x3b41('0x14')][_0x3b41('0x13')]()];if(_0x5e7dab){var _0x33bdd0=_0x5e7dab[_0xf98d76[_0x3b41('0x15')]];if(_0x33bdd0){var _0x2bdfdf=_[_0x3b41('0x16')](_0x33bdd0[_0x3b41('0x17')],{'id':parseInt(_0xf98d76['data3'],0xa)});if(_0x2bdfdf){if(_0x18ae56){if(_0x433753&&_0x4b9a22[_0x3b41('0x18')]){_0x4d3e7c=_0x3b41('0x18');}else if(_0x4b9a22['routeId']){_0x4d3e7c=_0x3b41('0x19');}else{console[_0x3b41('0x1a')]('EVENT\x20UNKNOWN',_0x4b9a22);}}else{_0x4d3e7c=_0x3b41('0x1b');}switch(_0xf98d76['data1']['toLowerCase']()){case _0x3b41('0xa'):zendesk[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0xb'):salesforce[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0xc'):sugarcrm[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0x1c'):freshdesk[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0xd'):zoho[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0x1d'):desk[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case'vtiger':vtiger[_0x4d3e7c](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082);break;case _0x3b41('0x10'):freshsales['cs'](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082,_0x4d3e7c);break;case _0x3b41('0x11'):servicenow['cs'](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082,_0x4d3e7c);break;case _0x3b41('0xf'):dynamics365['cs'](_0xf98d76,_0x4b9a22,_0x2bdfdf,_0x18ae56,_0x433753,_0x33bdd0,_0x416082,_0x4d3e7c);break;default:console[_0x3b41('0x1a')](_0x3b41('0x1e'));}}else{_0x523988=require('../../../../config/logger')(_0xf98d76[_0x3b41('0x14')][_0x3b41('0x13')]());_0x523988[_0x3b41('0x1f')](_0x3b41('0x20'),util[_0x3b41('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0xf98d76[_0x3b41('0x14')][_0x3b41('0x13')](),_0xf98d76[_0x3b41('0x22')]));}}else{_0x523988=require(_0x3b41('0x23'))(_0xf98d76[_0x3b41('0x14')][_0x3b41('0x13')]());_0x523988['error']('[EXEC]',util[_0x3b41('0x21')](_0x3b41('0x24'),_0xf98d76['data1'][_0x3b41('0x13')](),_0xf98d76['data2']));}}else{}}catch(_0x417e74){console['error'](_0x417e74);}}}}; \ 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 2e36db0..98c7835 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 _0x4ffe=['recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','catch','unmanaged','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','Task','utc','IsRecurrence','endUserType','lead','WhoId','account','ticketType','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','find','execute','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Caller\x20-\x20%s','LastName','','Company','No\x20Company','format','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.'];(function(_0x574b2a,_0x4aac51){var _0x5a34c5=function(_0x1c6315){while(--_0x1c6315){_0x574b2a['push'](_0x574b2a['shift']());}};_0x5a34c5(++_0x4aac51);}(_0x4ffe,0x8f));var _0xe4ff=function(_0x391154,_0x40fb12){_0x391154=_0x391154-0x0;var _0x4b7767=_0x4ffe[_0x391154];return _0x4b7767;};'use strict';var _=require(_0xe4ff('0x0'));var rp=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var BPromise=require(_0xe4ff('0x3'));var md5=require(_0xe4ff('0x4'));var jsforce=require(_0xe4ff('0x5'));var util=require('util');var Redis=require(_0xe4ff('0x6'));var intUtil=require(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var logger=require('../../../../config/logger')(_0xe4ff('0x9'));config[_0xe4ff('0xa')]=_[_0xe4ff('0xb')](config[_0xe4ff('0xa')],{'host':_0xe4ff('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4e90c2,_0x27c070,_0x159808){io['to'](_0x4e90c2)[_0xe4ff('0xd')](_0x27c070,_0x159808);}function getTicket(_0x57c7a9,_0x117a8f,_0x10bfda,_0x4f6e92,_0x24da68,_0x550524,_0x57d9ca,_0x5ae995){var _0x731ed1=Object[_0xe4ff('0xe')]({},{'OwnerId':_0x117a8f['id'],'Subject':intUtil[_0xe4ff('0xf')](_0x4f6e92[_0xe4ff('0x10')],_0x24da68,'\x20'),'Description':intUtil[_0xe4ff('0xf')](_0x4f6e92[_0xe4ff('0x11')],_0x24da68,'\x0a')},getCustomFields(_0x550524,_0x24da68));if(_0x10bfda){if(_0x4f6e92['ticketType']===_0xe4ff('0x12')){_0x731ed1['ActivityDate']=moment[_0xe4ff('0x13')]();_0x731ed1['IsReminderSet']=![];_0x731ed1[_0xe4ff('0x14')]=![];if(_0x10bfda['endUserType']==='contact'||_0x10bfda[_0xe4ff('0x15')]===_0xe4ff('0x16')){_0x731ed1[_0xe4ff('0x17')]=_0x10bfda['id'];}else if(_0x10bfda['endUserType']===_0xe4ff('0x18')){_0x731ed1['WhatId']=_0x10bfda['id'];}}else if(_0x4f6e92[_0xe4ff('0x19')]===_0xe4ff('0x1a')){if(_0x10bfda[_0xe4ff('0x15')]===_0xe4ff('0x1b')){_0x731ed1[_0xe4ff('0x1c')]=_0x10bfda['id'];}else if(_0x10bfda[_0xe4ff('0x15')]==='account'){_0x731ed1[_0xe4ff('0x1d')]=_0x10bfda['id'];}else if(_0x10bfda['endUserType']==='lead'&&_0x4f6e92[_0xe4ff('0x1e')]){_0x731ed1[_0x4f6e92[_0xe4ff('0x1e')]]=_0x10bfda['id'];}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x20'));}}}return _0x57d9ca['sobject'](_0x4f6e92[_0xe4ff('0x19')])[_0xe4ff('0x21')](_0x731ed1);}function getUser(_0x1d2089,_0x10873b,_0xe8e3ec){if(!_[_0xe4ff('0x22')](_0x10873b)&&intUtil[_0xe4ff('0x23')](_0x10873b)){var _0x37c8ed={'Email':_0x10873b};var _0xae002a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xe8e3ec[_0xe4ff('0x24')]('User')[_0xe4ff('0x25')](_0x37c8ed,_0xae002a)[_0xe4ff('0x26')]()['then'](function(_0xb6c505){if(_0xb6c505[_0xe4ff('0x27')]){var _0x3b733a=_[_0xe4ff('0x25')](_0xb6c505,function(_0x1c8344){return _0x1c8344[_0xe4ff('0x28')]===_0x10873b;});if(_0x3b733a){logger['info']('Agent\x20%s\x20found.',_0x10873b);return BPromise[_0xe4ff('0x29')]({'id':_0x3b733a['Id'],'name':_0x3b733a['Name']});}}else{logger['info'](_0xe4ff('0x2a'),_0x10873b);return _0xe8e3ec[_0xe4ff('0x2b')]()[_0xe4ff('0x2c')](function(_0x2b936e){return BPromise['resolve']({'id':_0x2b936e[_0xe4ff('0x2d')],'name':_0x2b936e[_0xe4ff('0x2e')]});});}});}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x2a'),_0x10873b);return _0xe8e3ec[_0xe4ff('0x2b')]()[_0xe4ff('0x2c')](function(_0x37e540){return BPromise[_0xe4ff('0x29')]({'id':_0x37e540[_0xe4ff('0x2d')],'name':_0x37e540[_0xe4ff('0x2e')]});});}}function getEndUser(_0x17ff19,_0x117d20,_0x917a6b,_0xe13036,_0x514ae7){var _0xc10dc3={'$or':{'Phone':_0xe13036}};var _0x22de05={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe4ff('0x2c')](function(){logger[_0xe4ff('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xe13036,_0x117d20[_0xe4ff('0x2f')]);switch(_0x117d20[_0xe4ff('0x2f')]){case'contact_lead':var _0x11bf9f=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchContact']){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x31')]]=_0xe13036;_[_0xe4ff('0x32')](_0x11bf9f[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7['sobject'](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x11bf9f,_0x22de05)[_0xe4ff('0x26')]()[_0xe4ff('0x2c')](function(_0x17bbc6){if(_0x17bbc6&&_0x17bbc6[_0xe4ff('0x27')]){return _0x17bbc6;}else{var _0x9fa882=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x35')]){var _0x3150d5={};_0x3150d5[_0x117d20[_0xe4ff('0x35')]]=_0xe13036;_[_0xe4ff('0x32')](_0x9fa882[_0xe4ff('0x33')],_0x3150d5);}return _0x514ae7['sobject'](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x9fa882,_0x22de05);}});case _0xe4ff('0x37'):var _0x2fe9c4=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x38')]){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x38')]]=_0xe13036;_[_0xe4ff('0x32')](_0x2fe9c4[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x39'))['find'](_0x2fe9c4,_0x22de05)[_0xe4ff('0x26')]()[_0xe4ff('0x2c')](function(_0x482723){if(_0x482723&&_0x482723[_0xe4ff('0x27')]){return _0x482723;}else{var _0x115b44=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x31')]){var _0x998092={};_0x998092[_0x117d20[_0xe4ff('0x31')]]=_0xe13036;_[_0xe4ff('0x32')](_0x115b44[_0xe4ff('0x33')],_0x998092);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x115b44,_0x22de05)[_0xe4ff('0x2c')](function(_0x5a914b){if(_0x5a914b&&_0x5a914b[_0xe4ff('0x27')]){return _0x5a914b;}else{var _0x367e9b=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchLead']){var _0x51c9b5={};_0x51c9b5[_0x117d20[_0xe4ff('0x35')]]=_0xe13036;_[_0xe4ff('0x32')](_0x367e9b['$or'],_0x51c9b5);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x367e9b,_0x22de05);}});}});case _0xe4ff('0x1b'):var _0x11bf9f=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x31')]){var _0x4713dc={};_0x4713dc[_0x117d20['additionalSearchContact']]=_0xe13036;_[_0xe4ff('0x32')](_0x11bf9f[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7['sobject'](_0xe4ff('0x34'))[_0xe4ff('0x25')](_0x11bf9f,_0x22de05)[_0xe4ff('0x26')]();case _0xe4ff('0x16'):var _0x259e87=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20['additionalSearchLead']){var _0x4713dc={};_0x4713dc[_0x117d20['additionalSearchLead']]=_0xe13036;_[_0xe4ff('0x32')](_0x259e87[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x36'))[_0xe4ff('0x25')](_0x259e87,_0x22de05);case'account':var _0x2fe9c4=_[_0xe4ff('0x30')](_0xc10dc3);if(_0x117d20[_0xe4ff('0x38')]){var _0x4713dc={};_0x4713dc[_0x117d20[_0xe4ff('0x38')]]=_0xe13036;_[_0xe4ff('0x32')](_0x2fe9c4[_0xe4ff('0x33')],_0x4713dc);}return _0x514ae7[_0xe4ff('0x24')](_0xe4ff('0x39'))[_0xe4ff('0x25')](_0x2fe9c4,_0x22de05);default:return null;}})[_0xe4ff('0x2c')](function(_0xe9392f){if(_0xe9392f&&_0xe9392f[_0xe4ff('0x27')]){var _0x204c98=_[_0xe4ff('0x3a')](_0xe9392f);if(_0x204c98){return BPromise[_0xe4ff('0x29')]({'id':_0x204c98['Id'],'name':_0x204c98[_0xe4ff('0x3b')],'phone':_0x204c98['Phone'],'endUserType':_0x204c98[_0xe4ff('0x3c')][_0xe4ff('0x3d')][_0xe4ff('0x3e')]()});}}})[_0xe4ff('0x2c')](function(_0x564b6b){if(_0x564b6b){logger['info'](_0xe4ff('0x3f'),_0x564b6b['endUserType'],_0xe13036);return BPromise[_0xe4ff('0x29')](_0x564b6b);}else{logger[_0xe4ff('0x1f')](_0xe4ff('0x40'),_0xe13036);var _0x2de7be={'Phone':_0xe13036};if(_0x117d20[_0xe4ff('0x41')]){if(_0x117d20[_0xe4ff('0x41')]===_0xe4ff('0x1b')){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be['LastName']=_0x917a6b!==''?_0x917a6b:util['format'](_0xe4ff('0x43'),_0xe13036);}else if(_0x117d20[_0xe4ff('0x41')]===_0xe4ff('0x16')){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be[_0xe4ff('0x44')]=_0x917a6b!==_0xe4ff('0x45')?_0x917a6b:util['format']('Caller\x20-\x20%s',_0xe13036);_0x2de7be[_0xe4ff('0x46')]=_0xe4ff('0x47');}else if(_0x117d20[_0xe4ff('0x41')]==='account'){logger[_0xe4ff('0x1f')](_0xe4ff('0x42'),_0xe13036,_0x117d20[_0xe4ff('0x41')]);_0x2de7be[_0xe4ff('0x3b')]=_0x917a6b!==_0xe4ff('0x45')?_0x917a6b:util[_0xe4ff('0x48')](_0xe4ff('0x43'),_0xe13036);}else{return null;}}return _0x514ae7[_0xe4ff('0x24')](_[_0xe4ff('0x49')](_0x117d20[_0xe4ff('0x41')]))['create'](_0x2de7be)['then'](function(_0x438bd3){return BPromise['resolve']({'id':_0x438bd3['id'],'endUserType':_0x117d20['moduleCreate']});});}});}function getCustomFields(_0x1c2efd,_0x53968e){var _0x1cd601={};if(_0x1c2efd['length']>0x0){_[_0xe4ff('0x4a')](_0x1c2efd,function(_0x5658bf){if(_[_0xe4ff('0x4b')]([_0xe4ff('0x4c'),_0xe4ff('0x4d')],_0x5658bf[_0xe4ff('0x3d')])&&_0x5658bf['idField']){_0x1cd601[_0x5658bf[_0xe4ff('0x4e')]]=_0x5658bf[_0xe4ff('0x4f')]['toString']();}else if(_0x5658bf[_0xe4ff('0x3d')]===_0xe4ff('0x50')&&_0x5658bf[_0xe4ff('0x51')]&&_0x5658bf[_0xe4ff('0x4e')]){_0x53968e[_0x5658bf[_0xe4ff('0x51')]]&&(_0x1cd601[_0x5658bf[_0xe4ff('0x4e')]]=_0x53968e[_0x5658bf['variableName']][_0xe4ff('0x52')]());}else if(_0x5658bf[_0xe4ff('0x3d')]===_0xe4ff('0x53')&&_0x5658bf[_0xe4ff('0x54')]&&_0x5658bf[_0xe4ff('0x54')][_0xe4ff('0x55')]&&_0x5658bf[_0xe4ff('0x4e')]){_0x53968e[_0x5658bf[_0xe4ff('0x54')]['name'][_0xe4ff('0x3e')]()]&&(_0x1cd601[_0x5658bf['idField']]=_0x53968e[_0x5658bf[_0xe4ff('0x54')][_0xe4ff('0x55')][_0xe4ff('0x3e')]()][_0xe4ff('0x52')]());}});}return _0x1cd601;}function getConnection(_0x45cf61){var _0x3bcf1c=_0x45cf61[_0xe4ff('0x56')][_0xe4ff('0x57')](_0x45cf61[_0xe4ff('0x58')]);var _0xdb2730=new jsforce['Connection']({'oauth2':{'loginUrl':_0x45cf61[_0xe4ff('0x59')]||_0xe4ff('0x5a'),'clientId':_0x45cf61[_0xe4ff('0x5b')],'clientSecret':_0x45cf61[_0xe4ff('0x5c')]}});return _0xdb2730['login'](_0x45cf61[_0xe4ff('0x5d')],_0x3bcf1c)['then'](function(){logger[_0xe4ff('0x1f')]('Connection\x20established.');return _0xdb2730;});}exports[_0xe4ff('0x5e')]=function(_0x59866e,_0x31f2f2,_0x29b8a9,_0x54b156,_0x1e8b84,_0x22bc78){var _0x4d2e7b,_0x27bbc1,_0x48768e,_0x238ebf;_0x22bc78[_0xe4ff('0x5f')]=intUtil[_0xe4ff('0x60')](_0x22bc78[_0xe4ff('0x5f')]);_0x22bc78[_0xe4ff('0x59')]=intUtil[_0xe4ff('0x60')](_0x22bc78[_0xe4ff('0x59')]);if(_0x1e8b84&&_0x1e8b84['monitor_format']){logger[_0xe4ff('0x1f')](_0xe4ff('0x61'),_0xe4ff('0x62'));_0x31f2f2[_0xe4ff('0x63')]=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0x22bc78['serverUrl'],_0x31f2f2[_0xe4ff('0x65')],md5(_0x31f2f2[_0xe4ff('0x65')]));}else{_0x31f2f2[_0xe4ff('0x63')]='';}return getConnection(_0x22bc78)[_0xe4ff('0x2c')](function(_0x8303ca){_0x238ebf=_0x8303ca;return getUser(_0x22bc78,_0x54b156[_0xe4ff('0x66')],_0x238ebf);})[_0xe4ff('0x2c')](function(_0x1235d3){_0x4d2e7b=_0x1235d3;return getEndUser(_0x22bc78,_0x29b8a9,_0x31f2f2[_0xe4ff('0x67')],_0x31f2f2[_0xe4ff('0x68')],_0x238ebf);})[_0xe4ff('0x2c')](function(_0xbc37b3){_0x27bbc1=_0xbc37b3;return getTicket(_0x22bc78,_0x4d2e7b,_0x27bbc1,_0x29b8a9,_0x31f2f2,_0x29b8a9['Fields'],_0x238ebf,_0xe4ff('0x5e'));})['then'](function(_0x40dcfe){_0x48768e=_0x40dcfe;logger[_0xe4ff('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x48768e['id']);logger['info'](_0xe4ff('0x69'),_0x48768e['id'],_0x54b156[_0xe4ff('0x55')],_0x22bc78[_0xe4ff('0x3d')]);switch(_0x22bc78[_0xe4ff('0x3d')]){case'integrationTab':emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x54b156[_0xe4ff('0x55')]),_0xe4ff('0x6b'),{'recordId':_0x48768e['id']});break;case _0xe4ff('0x6c'):emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x54b156[_0xe4ff('0x55')]),_0xe4ff('0x6d'),{'uri':util[_0xe4ff('0x48')]('%s/%s/e',_0x238ebf[_0xe4ff('0x6e')],_0x48768e['id'])});break;default:logger[_0xe4ff('0x6f')](_0xe4ff('0x70'));}})['catch'](function(_0x47e27d){logger[_0xe4ff('0x6f')](_0xe4ff('0x61'),_0x47e27d);});};exports['outbound']=function(_0x57d62b,_0x2843a8,_0x17da05,_0x967094,_0x401941,_0xb29baa,_0x4fdd23){var _0x14e08c,_0x50a37f,_0x4455db,_0x425d2f;_0xb29baa[_0xe4ff('0x5f')]=intUtil['stripTrailingSlash'](_0xb29baa['serverUrl']);_0xb29baa['remoteUri']=intUtil[_0xe4ff('0x60')](_0xb29baa[_0xe4ff('0x59')]);if(_0x4fdd23&&_0x4fdd23[_0xe4ff('0x71')]&&_0x4fdd23['recordingFormat']!==_0xe4ff('0x72')){logger[_0xe4ff('0x1f')](_0xe4ff('0x73'),'Recording\x20is\x20enabled!');_0x2843a8['recordingURL']=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0xb29baa[_0xe4ff('0x5f')],_0x2843a8['uniqueid'],md5(_0x2843a8[_0xe4ff('0x65')]));}return getConnection(_0xb29baa)[_0xe4ff('0x2c')](function(_0x3c8bea){_0x425d2f=_0x3c8bea;return getUser(_0xb29baa,_0x967094[_0xe4ff('0x66')],_0x425d2f);})[_0xe4ff('0x2c')](function(_0x2b47b0){_0x14e08c=_0x2b47b0;return getEndUser(_0xb29baa,_0x17da05,_0x2843a8['destcalleridname'],_0x2843a8[_0xe4ff('0x74')],_0x425d2f);})[_0xe4ff('0x2c')](function(_0x336256){_0x50a37f=_0x336256;return getTicket(_0xb29baa,_0x14e08c,_0x50a37f,_0x17da05,_0x2843a8,_0x17da05[_0xe4ff('0x75')],_0x425d2f,'outbound');})[_0xe4ff('0x2c')](function(_0x2395ba){_0x4455db=_0x2395ba;logger[_0xe4ff('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4455db['id']);logger['info'](_0xe4ff('0x76'),_0x4455db['id'],_0x967094[_0xe4ff('0x55')],_0xb29baa['type']);switch(_0xb29baa['type']){case _0xe4ff('0x77'):emit(util['format'](_0xe4ff('0x6a'),_0x967094[_0xe4ff('0x55')]),'trigger:salesforce:display',{'recordId':_0x4455db['id']});break;case'newTab':emit(util[_0xe4ff('0x48')](_0xe4ff('0x6a'),_0x967094[_0xe4ff('0x55')]),_0xe4ff('0x6d'),{'uri':util[_0xe4ff('0x48')](_0xe4ff('0x78'),_0x425d2f[_0xe4ff('0x6e')],_0x4455db['id'])});break;default:logger[_0xe4ff('0x6f')](_0xe4ff('0x73'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xe4ff('0x79')](function(_0x48e289){logger[_0xe4ff('0x6f')]('[OUTBOUND]',_0x48e289);});};exports[_0xe4ff('0x7a')]=function(_0x5475fb,_0x4ffcbd,_0xc29d78,_0x1e6baf,_0x408345,_0x555d93){var _0x10dcbb,_0x209f2b,_0x1154bc,_0x2b66de;_0x555d93[_0xe4ff('0x5f')]=intUtil[_0xe4ff('0x60')](_0x555d93[_0xe4ff('0x5f')]);_0x555d93[_0xe4ff('0x59')]=intUtil[_0xe4ff('0x60')](_0x555d93[_0xe4ff('0x59')]);if(_0x408345&&_0x408345[_0xe4ff('0x7b')]){logger[_0xe4ff('0x1f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+']',_0xe4ff('0x62'));_0x4ffcbd[_0xe4ff('0x63')]=util[_0xe4ff('0x48')](_0xe4ff('0x64'),_0x555d93[_0xe4ff('0x5f')],_0x4ffcbd[_0xe4ff('0x65')],md5(_0x4ffcbd[_0xe4ff('0x65')]));}else{_0x4ffcbd[_0xe4ff('0x63')]='';}return getConnection(_0x555d93)[_0xe4ff('0x2c')](function(_0x2fa809){_0x2b66de=_0x2fa809;if(!_['isNil'](_0x1e6baf)){return getUser(_0x555d93,_0x1e6baf[_0xe4ff('0x55')],_0x2b66de);}else{return getUser(_0x555d93,null,_0x2b66de);}})[_0xe4ff('0x2c')](function(_0x185765){_0x10dcbb=_0x185765;return getEndUser(_0x555d93,_0xc29d78,_0x4ffcbd[_0xe4ff('0x67')],_0x4ffcbd[_0xe4ff('0x68')],_0x2b66de);})[_0xe4ff('0x2c')](function(_0x2eaf8e){_0x209f2b=_0x2eaf8e;return getTicket(_0x555d93,_0x10dcbb,_0x209f2b,_0xc29d78,_0x4ffcbd,_0xc29d78['Fields'],_0x2b66de);})[_0xe4ff('0x2c')](function(_0x4a5a07){_0x1154bc=_0x4a5a07;logger[_0xe4ff('0x1f')]('['+_0x4ffcbd['lastevent'][_0xe4ff('0x7d')]()+_0xe4ff('0x7e'),_0x1154bc['id']);logger[_0xe4ff('0x1f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+_0xe4ff('0x7f'),_0x555d93[_0xe4ff('0x3d')]);})[_0xe4ff('0x79')](function(_0x4959af){logger[_0xe4ff('0x6f')]('['+_0x4ffcbd[_0xe4ff('0x7c')][_0xe4ff('0x7d')]()+']',_0x4959af);});}; \ No newline at end of file +var _0xa0ab=['content','toString','variableName','customVariable','name','toLowerCase','Variable','password','concat','securityToken','Connection','clientId','clientSecret','login','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','recordingURL','calleridname',']\x20Ticket\x20%s\x20created.','lodash','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead','account','WhatId','Case','contact','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','display_name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Name','Phone','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','forEach','includes','string','picklist','idField'];(function(_0x2f506a,_0x41d7f1){var _0x20edb9=function(_0x344d18){while(--_0x344d18){_0x2f506a['push'](_0x2f506a['shift']());}};_0x20edb9(++_0x41d7f1);}(_0xa0ab,0x1bc));var _0xba0a=function(_0x2b825a,_0x51e538){_0x2b825a=_0x2b825a-0x0;var _0x516ffa=_0xa0ab[_0x2b825a];return _0x516ffa;};'use strict';var _=require(_0xba0a('0x0'));var rp=require('request-promise');var moment=require(_0xba0a('0x1'));var BPromise=require('bluebird');var md5=require(_0xba0a('0x2'));var jsforce=require(_0xba0a('0x3'));var util=require(_0xba0a('0x4'));var Redis=require('ioredis');var intUtil=require(_0xba0a('0x5'));var config=require(_0xba0a('0x6'));var logger=require(_0xba0a('0x7'))(_0xba0a('0x8'));config[_0xba0a('0x9')]=_[_0xba0a('0xa')](config[_0xba0a('0x9')],{'host':_0xba0a('0xb'),'port':0x18eb});var io=require(_0xba0a('0xc'))(new Redis(config[_0xba0a('0x9')]));function emit(_0x45f1f4,_0x4685ca,_0x3b482d){io['to'](_0x45f1f4)[_0xba0a('0xd')](_0x4685ca,_0x3b482d);}function getTicket(_0x27d184,_0x44a987,_0x348920,_0x2b6b19,_0x1e1682,_0x58b4f3,_0x391d3a,_0x554953){var _0x5ed7e5=Object[_0xba0a('0xe')]({},{'OwnerId':_0x44a987['id'],'Subject':intUtil[_0xba0a('0xf')](_0x2b6b19[_0xba0a('0x10')],_0x1e1682,'\x20'),'Description':intUtil['getString'](_0x2b6b19[_0xba0a('0x11')],_0x1e1682,'\x0a')},getCustomFields(_0x58b4f3,_0x1e1682));if(_0x348920){if(_0x2b6b19[_0xba0a('0x12')]==='Task'){_0x5ed7e5[_0xba0a('0x13')]=moment[_0xba0a('0x14')]();_0x5ed7e5[_0xba0a('0x15')]=![];_0x5ed7e5[_0xba0a('0x16')]=![];if(_0x348920['endUserType']==='contact'||_0x348920[_0xba0a('0x17')]===_0xba0a('0x18')){_0x5ed7e5['WhoId']=_0x348920['id'];}else if(_0x348920[_0xba0a('0x17')]===_0xba0a('0x19')){_0x5ed7e5[_0xba0a('0x1a')]=_0x348920['id'];}}else if(_0x2b6b19[_0xba0a('0x12')]===_0xba0a('0x1b')){if(_0x348920['endUserType']===_0xba0a('0x1c')){_0x5ed7e5['ContactId']=_0x348920['id'];}else if(_0x348920[_0xba0a('0x17')]===_0xba0a('0x19')){_0x5ed7e5[_0xba0a('0x1d')]=_0x348920['id'];}else if(_0x348920[_0xba0a('0x17')]===_0xba0a('0x18')&&_0x2b6b19['leadId']){_0x5ed7e5[_0x2b6b19[_0xba0a('0x1e')]]=_0x348920['id'];}else{logger[_0xba0a('0x1f')](_0xba0a('0x20'));}}}return _0x391d3a[_0xba0a('0x21')](_0x2b6b19[_0xba0a('0x12')])[_0xba0a('0x22')](_0x5ed7e5);}function getUser(_0x7f27f8,_0x34bc57,_0x1f0753){if(!_[_0xba0a('0x23')](_0x34bc57)&&intUtil[_0xba0a('0x24')](_0x34bc57)){var _0x133066={'Email':_0x34bc57};var _0x3a0053={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1f0753['sobject'](_0xba0a('0x25'))[_0xba0a('0x26')](_0x133066,_0x3a0053)[_0xba0a('0x27')]()['then'](function(_0x314a8e){if(_0x314a8e['length']){var _0x2abc92=_[_0xba0a('0x26')](_0x314a8e,function(_0x3b07fb){return _0x3b07fb[_0xba0a('0x28')]===_0x34bc57;});if(_0x2abc92){logger[_0xba0a('0x1f')](_0xba0a('0x29'),_0x34bc57);return BPromise[_0xba0a('0x2a')]({'id':_0x2abc92['Id'],'name':_0x2abc92['Name']});}}else{logger['info'](_0xba0a('0x2b'),_0x34bc57);return _0x1f0753['identity']()[_0xba0a('0x2c')](function(_0x4ce70c){return BPromise[_0xba0a('0x2a')]({'id':_0x4ce70c['user_id'],'name':_0x4ce70c[_0xba0a('0x2d')]});});}});}else{logger[_0xba0a('0x1f')](_0xba0a('0x2b'),_0x34bc57);return _0x1f0753[_0xba0a('0x2e')]()[_0xba0a('0x2c')](function(_0x8d888d){return BPromise[_0xba0a('0x2a')]({'id':_0x8d888d[_0xba0a('0x2f')],'name':_0x8d888d[_0xba0a('0x2d')]});});}}function getEndUser(_0x59ac06,_0x4358d9,_0x205130,_0x1dfec0,_0x34bb52){var _0x4eef1b={'$or':{'Phone':_0x1dfec0}};var _0x26e9a0={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xba0a('0x2a')]()[_0xba0a('0x2c')](function(){logger[_0xba0a('0x1f')](_0xba0a('0x30'),_0x1dfec0,_0x4358d9[_0xba0a('0x31')]);switch(_0x4358d9['moduleSearch']){case'contact_lead':var _0x1903d3=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9['additionalSearchContact']){var _0x5c985b={};_0x5c985b[_0x4358d9[_0xba0a('0x33')]]=_0x1dfec0;_[_0xba0a('0x34')](_0x1903d3[_0xba0a('0x35')],_0x5c985b);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x36'))['find'](_0x1903d3,_0x26e9a0)['execute']()[_0xba0a('0x2c')](function(_0x23fe0b){if(_0x23fe0b&&_0x23fe0b['length']){return _0x23fe0b;}else{var _0x1bcfbb=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9[_0xba0a('0x37')]){var _0x556ad4={};_0x556ad4[_0x4358d9['additionalSearchLead']]=_0x1dfec0;_[_0xba0a('0x34')](_0x1bcfbb['$or'],_0x556ad4);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x38'))[_0xba0a('0x26')](_0x1bcfbb,_0x26e9a0);}});case _0xba0a('0x39'):var _0x44acd0=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9[_0xba0a('0x3a')]){var _0x5c985b={};_0x5c985b[_0x4358d9[_0xba0a('0x3a')]]=_0x1dfec0;_[_0xba0a('0x34')](_0x44acd0[_0xba0a('0x35')],_0x5c985b);}return _0x34bb52['sobject'](_0xba0a('0x3b'))[_0xba0a('0x26')](_0x44acd0,_0x26e9a0)[_0xba0a('0x27')]()[_0xba0a('0x2c')](function(_0xd484f6){if(_0xd484f6&&_0xd484f6['length']){return _0xd484f6;}else{var _0x4a180c=_['cloneDeep'](_0x4eef1b);if(_0x4358d9[_0xba0a('0x33')]){var _0x2f4983={};_0x2f4983[_0x4358d9[_0xba0a('0x33')]]=_0x1dfec0;_[_0xba0a('0x34')](_0x4a180c[_0xba0a('0x35')],_0x2f4983);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x36'))[_0xba0a('0x26')](_0x4a180c,_0x26e9a0)['then'](function(_0x599604){if(_0x599604&&_0x599604['length']){return _0x599604;}else{var _0x2c4424=_['cloneDeep'](_0x4eef1b);if(_0x4358d9['additionalSearchLead']){var _0x50c21c={};_0x50c21c[_0x4358d9[_0xba0a('0x37')]]=_0x1dfec0;_['merge'](_0x2c4424[_0xba0a('0x35')],_0x50c21c);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x38'))[_0xba0a('0x26')](_0x2c4424,_0x26e9a0);}});}});case _0xba0a('0x1c'):var _0x1903d3=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9[_0xba0a('0x33')]){var _0x5c985b={};_0x5c985b[_0x4358d9[_0xba0a('0x33')]]=_0x1dfec0;_[_0xba0a('0x34')](_0x1903d3[_0xba0a('0x35')],_0x5c985b);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x36'))['find'](_0x1903d3,_0x26e9a0)[_0xba0a('0x27')]();case _0xba0a('0x18'):var _0xd859df=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9[_0xba0a('0x37')]){var _0x5c985b={};_0x5c985b[_0x4358d9[_0xba0a('0x37')]]=_0x1dfec0;_[_0xba0a('0x34')](_0xd859df[_0xba0a('0x35')],_0x5c985b);}return _0x34bb52[_0xba0a('0x21')](_0xba0a('0x38'))[_0xba0a('0x26')](_0xd859df,_0x26e9a0);case _0xba0a('0x19'):var _0x44acd0=_[_0xba0a('0x32')](_0x4eef1b);if(_0x4358d9[_0xba0a('0x3a')]){var _0x5c985b={};_0x5c985b[_0x4358d9[_0xba0a('0x3a')]]=_0x1dfec0;_[_0xba0a('0x34')](_0x44acd0[_0xba0a('0x35')],_0x5c985b);}return _0x34bb52[_0xba0a('0x21')]('Account')[_0xba0a('0x26')](_0x44acd0,_0x26e9a0);default:return null;}})[_0xba0a('0x2c')](function(_0x53c19e){if(_0x53c19e&&_0x53c19e[_0xba0a('0x3c')]){var _0x4ca600=_[_0xba0a('0x3d')](_0x53c19e);if(_0x4ca600){return BPromise[_0xba0a('0x2a')]({'id':_0x4ca600['Id'],'name':_0x4ca600[_0xba0a('0x3e')],'phone':_0x4ca600[_0xba0a('0x3f')],'endUserType':_0x4ca600[_0xba0a('0x40')][_0xba0a('0x41')]['toLowerCase']()});}}})[_0xba0a('0x2c')](function(_0xd9c7eb){if(_0xd9c7eb){logger['info'](_0xba0a('0x42'),_0xd9c7eb['endUserType'],_0x1dfec0);return BPromise[_0xba0a('0x2a')](_0xd9c7eb);}else{logger[_0xba0a('0x1f')](_0xba0a('0x43'),_0x1dfec0);var _0x39dc66={'Phone':_0x1dfec0};if(_0x4358d9[_0xba0a('0x44')]){if(_0x4358d9[_0xba0a('0x44')]===_0xba0a('0x1c')){logger[_0xba0a('0x1f')](_0xba0a('0x45'),_0x1dfec0,_0x4358d9[_0xba0a('0x44')]);_0x39dc66[_0xba0a('0x46')]=_0x205130!==_0xba0a('0x47')?_0x205130:util[_0xba0a('0x48')](_0xba0a('0x49'),_0x1dfec0);}else if(_0x4358d9[_0xba0a('0x44')]===_0xba0a('0x18')){logger['info'](_0xba0a('0x45'),_0x1dfec0,_0x4358d9['moduleCreate']);_0x39dc66[_0xba0a('0x46')]=_0x205130!==_0xba0a('0x47')?_0x205130:util[_0xba0a('0x48')](_0xba0a('0x49'),_0x1dfec0);_0x39dc66['Company']=_0xba0a('0x4a');}else if(_0x4358d9['moduleCreate']===_0xba0a('0x19')){logger[_0xba0a('0x1f')](_0xba0a('0x45'),_0x1dfec0,_0x4358d9[_0xba0a('0x44')]);_0x39dc66[_0xba0a('0x3e')]=_0x205130!==_0xba0a('0x47')?_0x205130:util[_0xba0a('0x48')]('Caller\x20-\x20%s',_0x1dfec0);}else{return null;}}return _0x34bb52[_0xba0a('0x21')](_['upperFirst'](_0x4358d9[_0xba0a('0x44')]))[_0xba0a('0x22')](_0x39dc66)[_0xba0a('0x2c')](function(_0x15f00a){return BPromise[_0xba0a('0x2a')]({'id':_0x15f00a['id'],'endUserType':_0x4358d9[_0xba0a('0x44')]});});}});}function getCustomFields(_0x21509c,_0x307a79){var _0x48d6db={};if(_0x21509c[_0xba0a('0x3c')]>0x0){_[_0xba0a('0x4b')](_0x21509c,function(_0x267afd){if(_[_0xba0a('0x4c')]([_0xba0a('0x4d'),_0xba0a('0x4e')],_0x267afd['type'])&&_0x267afd[_0xba0a('0x4f')]){_0x48d6db[_0x267afd[_0xba0a('0x4f')]]=_0x267afd[_0xba0a('0x50')][_0xba0a('0x51')]();}else if(_0x267afd[_0xba0a('0x41')]==='variable'&&_0x267afd['variableName']&&_0x267afd[_0xba0a('0x4f')]){_0x307a79[_0x267afd[_0xba0a('0x52')]]&&(_0x48d6db[_0x267afd[_0xba0a('0x4f')]]=_0x307a79[_0x267afd['variableName']][_0xba0a('0x51')]());}else if(_0x267afd[_0xba0a('0x41')]===_0xba0a('0x53')&&_0x267afd['Variable']&&_0x267afd['Variable'][_0xba0a('0x54')]&&_0x267afd[_0xba0a('0x4f')]){_0x307a79[_0x267afd['Variable'][_0xba0a('0x54')][_0xba0a('0x55')]()]&&(_0x48d6db[_0x267afd[_0xba0a('0x4f')]]=_0x307a79[_0x267afd[_0xba0a('0x56')][_0xba0a('0x54')][_0xba0a('0x55')]()][_0xba0a('0x51')]());}});}return _0x48d6db;}function getConnection(_0x508665){var _0x461d2c=_0x508665[_0xba0a('0x57')][_0xba0a('0x58')](_0x508665[_0xba0a('0x59')]);var _0x3128a8=new jsforce[(_0xba0a('0x5a'))]({'oauth2':{'loginUrl':_0x508665['remoteUri']||'https://login.salesforce.com','clientId':_0x508665[_0xba0a('0x5b')],'clientSecret':_0x508665[_0xba0a('0x5c')]}});return _0x3128a8[_0xba0a('0x5d')](_0x508665['username'],_0x461d2c)[_0xba0a('0x2c')](function(){logger[_0xba0a('0x1f')](_0xba0a('0x5e'));return _0x3128a8;});}exports['queue']=function(_0x268d34,_0x22b247,_0x436079,_0x27d930,_0x46e382,_0x4ee459){var _0x561f2a,_0x2cd2a2,_0x41631f,_0x404cf1;_0x4ee459[_0xba0a('0x5f')]=intUtil[_0xba0a('0x60')](_0x4ee459[_0xba0a('0x5f')]);_0x4ee459[_0xba0a('0x61')]=intUtil['stripTrailingSlash'](_0x4ee459['remoteUri']);if(_0x46e382&&_0x46e382[_0xba0a('0x62')]){logger[_0xba0a('0x1f')](_0xba0a('0x63'),_0xba0a('0x64'));_0x22b247['recordingURL']=util[_0xba0a('0x48')](_0xba0a('0x65'),_0x4ee459[_0xba0a('0x5f')],_0x22b247[_0xba0a('0x66')],md5(_0x22b247[_0xba0a('0x66')]));}else{_0x22b247['recordingURL']='';}return getConnection(_0x4ee459)['then'](function(_0x33c97a){_0x404cf1=_0x33c97a;return getUser(_0x4ee459,_0x27d930[_0xba0a('0x67')],_0x404cf1);})[_0xba0a('0x2c')](function(_0x41dab4){_0x561f2a=_0x41dab4;return getEndUser(_0x4ee459,_0x436079,_0x22b247['calleridname'],_0x22b247[_0xba0a('0x68')],_0x404cf1);})[_0xba0a('0x2c')](function(_0x16a47f){_0x2cd2a2=_0x16a47f;return getTicket(_0x4ee459,_0x561f2a,_0x2cd2a2,_0x436079,_0x22b247,_0x436079[_0xba0a('0x69')],_0x404cf1,_0xba0a('0x6a'));})[_0xba0a('0x2c')](function(_0x326752){_0x41631f=_0x326752;logger[_0xba0a('0x1f')](_0xba0a('0x6b'),_0x41631f['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x41631f['id'],_0x27d930['name'],_0x4ee459[_0xba0a('0x41')]);switch(_0x4ee459['type']){case _0xba0a('0x6c'):emit(util[_0xba0a('0x48')](_0xba0a('0x6d'),_0x27d930[_0xba0a('0x54')]),'trigger:salesforce:display',{'recordId':_0x41631f['id']});break;case _0xba0a('0x6e'):emit(util['format'](_0xba0a('0x6d'),_0x27d930[_0xba0a('0x54')]),_0xba0a('0x6f'),{'uri':util[_0xba0a('0x48')]('%s/%s/e',_0x404cf1['instanceUrl'],_0x41631f['id'])});break;default:logger['error'](_0xba0a('0x70'));}})[_0xba0a('0x71')](function(_0x2d6f6f){logger[_0xba0a('0x72')]('[QUEUE]',_0x2d6f6f);});};exports['outbound']=function(_0x235f3f,_0x263bef,_0x51a890,_0x2d956c,_0x2cb515,_0x12c29e,_0x3e1b8f){var _0x5eb422,_0x5eda62,_0x5b0d33,_0x4a1c2e;_0x12c29e[_0xba0a('0x5f')]=intUtil['stripTrailingSlash'](_0x12c29e[_0xba0a('0x5f')]);_0x12c29e[_0xba0a('0x61')]=intUtil[_0xba0a('0x60')](_0x12c29e[_0xba0a('0x61')]);if(_0x3e1b8f&&_0x3e1b8f[_0xba0a('0x73')]&&_0x3e1b8f[_0xba0a('0x73')]!=='none'){logger[_0xba0a('0x1f')](_0xba0a('0x74'),_0xba0a('0x64'));_0x263bef['recordingURL']=util[_0xba0a('0x48')](_0xba0a('0x65'),_0x12c29e[_0xba0a('0x5f')],_0x263bef[_0xba0a('0x66')],md5(_0x263bef[_0xba0a('0x66')]));}return getConnection(_0x12c29e)['then'](function(_0x30ba40){_0x4a1c2e=_0x30ba40;return getUser(_0x12c29e,_0x2d956c[_0xba0a('0x67')],_0x4a1c2e);})[_0xba0a('0x2c')](function(_0x1e5339){_0x5eb422=_0x1e5339;return getEndUser(_0x12c29e,_0x51a890,_0x263bef[_0xba0a('0x75')],_0x263bef[_0xba0a('0x76')],_0x4a1c2e);})[_0xba0a('0x2c')](function(_0x58a6b3){_0x5eda62=_0x58a6b3;return getTicket(_0x12c29e,_0x5eb422,_0x5eda62,_0x51a890,_0x263bef,_0x51a890[_0xba0a('0x69')],_0x4a1c2e,_0xba0a('0x77'));})[_0xba0a('0x2c')](function(_0x6eb76c){_0x5b0d33=_0x6eb76c;logger[_0xba0a('0x1f')](_0xba0a('0x78'),_0x5b0d33['id']);logger[_0xba0a('0x1f')](_0xba0a('0x79'),_0x5b0d33['id'],_0x2d956c[_0xba0a('0x54')],_0x12c29e[_0xba0a('0x41')]);switch(_0x12c29e[_0xba0a('0x41')]){case _0xba0a('0x6c'):emit(util[_0xba0a('0x48')](_0xba0a('0x6d'),_0x2d956c['name']),_0xba0a('0x7a'),{'recordId':_0x5b0d33['id']});break;case _0xba0a('0x6e'):emit(util['format']('user:%s',_0x2d956c['name']),_0xba0a('0x6f'),{'uri':util[_0xba0a('0x48')]('%s/%s/e',_0x4a1c2e[_0xba0a('0x7b')],_0x5b0d33['id'])});break;default:logger['error']('[OUTBOUND]',_0xba0a('0x7c'));}})[_0xba0a('0x71')](function(_0x48b46b){logger['error'](_0xba0a('0x74'),_0x48b46b);});};exports[_0xba0a('0x7d')]=function(_0x20e5c6,_0x6e017a,_0x3ebb37,_0x424875,_0x152867,_0x1fe6ca){var _0x28dac1,_0x1c7e04,_0x451845,_0x3ef439;_0x1fe6ca[_0xba0a('0x5f')]=intUtil['stripTrailingSlash'](_0x1fe6ca[_0xba0a('0x5f')]);_0x1fe6ca[_0xba0a('0x61')]=intUtil[_0xba0a('0x60')](_0x1fe6ca[_0xba0a('0x61')]);if(_0x152867&&_0x152867['monitor_format']){logger[_0xba0a('0x1f')]('['+_0x6e017a[_0xba0a('0x7e')][_0xba0a('0x7f')]()+']','Recording\x20is\x20enabled!');_0x6e017a[_0xba0a('0x80')]=util[_0xba0a('0x48')](_0xba0a('0x65'),_0x1fe6ca[_0xba0a('0x5f')],_0x6e017a[_0xba0a('0x66')],md5(_0x6e017a[_0xba0a('0x66')]));}else{_0x6e017a['recordingURL']='';}return getConnection(_0x1fe6ca)['then'](function(_0x49b037){_0x3ef439=_0x49b037;if(!_[_0xba0a('0x23')](_0x424875)){return getUser(_0x1fe6ca,_0x424875[_0xba0a('0x54')],_0x3ef439);}else{return getUser(_0x1fe6ca,null,_0x3ef439);}})[_0xba0a('0x2c')](function(_0x43dc69){_0x28dac1=_0x43dc69;return getEndUser(_0x1fe6ca,_0x3ebb37,_0x6e017a[_0xba0a('0x81')],_0x6e017a[_0xba0a('0x68')],_0x3ef439);})['then'](function(_0x3ff6c6){_0x1c7e04=_0x3ff6c6;return getTicket(_0x1fe6ca,_0x28dac1,_0x1c7e04,_0x3ebb37,_0x6e017a,_0x3ebb37[_0xba0a('0x69')],_0x3ef439);})[_0xba0a('0x2c')](function(_0x224a02){_0x451845=_0x224a02;logger[_0xba0a('0x1f')]('['+_0x6e017a[_0xba0a('0x7e')]['toUpperCase']()+_0xba0a('0x82'),_0x451845['id']);logger[_0xba0a('0x1f')]('['+_0x6e017a[_0xba0a('0x7e')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x1fe6ca[_0xba0a('0x41')]);})[_0xba0a('0x71')](function(_0x49584b){logger[_0xba0a('0x72')]('['+_0x6e017a[_0xba0a('0x7e')]['toUpperCase']()+']',_0x49584b);});}; \ 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 7673e42..76072b0 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 _0x0fd8=['Fields','ticketNumber','number','label','Incident','ticketId','Incident\x20-\x20','forEach','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','then','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','toLowerCase','idField','customField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions'];(function(_0x490d4b,_0x5ab8b9){var _0x257f65=function(_0x5d190b){while(--_0x5d190b){_0x490d4b['push'](_0x490d4b['shift']());}};_0x257f65(++_0x5ab8b9);}(_0x0fd8,0x94));var _0x80fd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0fd8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x80fd('0x0'));var Promise=require(_0x80fd('0x1'));var rp=require(_0x80fd('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x80fd('0x3'));var intUtil=require(_0x80fd('0x4'));var config=require(_0x80fd('0x5'));var logger=require(_0x80fd('0x6'))(_0x80fd('0x7'));config[_0x80fd('0x8')]=_[_0x80fd('0x9')](config[_0x80fd('0x8')],{'host':_0x80fd('0xa'),'port':0x18eb});var io=require(_0x80fd('0xb'))(new Redis(config[_0x80fd('0x8')]));function getAdminUser(_0xda64ee,_0x5cfe69,_0x19053e,_0x335fa9,_0x19890b,_0x306cf3){return new Promise(function(_0x36e2f8,_0x2eb3c9){var _0x2fd874={'method':'GET','uri':_0x335fa9+_0x80fd('0xc')+'&'+_0x19890b+'&'+_0x306cf3,'auth':_0x5cfe69,'json':!![]};return rp(_0x2fd874)['then'](function(_0x4b0edb){if(_0x4b0edb[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){_0x19053e[_0x80fd('0xf')]=_0x4b0edb['result'][0x0]['sys_id'];}logger[_0x80fd('0x10')]('['+[_0xda64ee[_0x80fd('0x11')]()]+_0x80fd('0x12'),_0x19053e);_0x36e2f8(_0x19053e);})[_0x80fd('0x13')](function(_0x1440ea){logger[_0x80fd('0x14')]('['+[_0xda64ee[_0x80fd('0x11')]()]+']',_0x1440ea['message']);_0x2eb3c9(_0x1440ea[_0x80fd('0x15')]);});});}function getUser(_0x4113fd,_0x5d987d,_0x3323ea,_0x17dd7b,_0x183be9){return function(_0x34a5e5){logger['info']('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x16'),_0x34a5e5);return new Promise(function(_0x135367,_0x3b69b9){if(intUtil[_0x80fd('0x17')](_0x34a5e5[_0x80fd('0x18')])){var _0x234877={'method':_0x80fd('0x19'),'uri':_0x3323ea+_0x80fd('0x1a')+_0x34a5e5[_0x80fd('0x18')]+'&'+_0x17dd7b+'&'+_0x183be9,'auth':_0x5d987d,'json':!![]};logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x1b'),_0x234877);return rp(_0x234877)['then'](function(_0x2d7815){logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+'],\x20getUser\x20entity',_0x2d7815);if(_0x2d7815[_0x80fd('0xd')][_0x80fd('0xe')]>0x0&&String(_0x2d7815[_0x80fd('0xd')][0x0][_0x80fd('0x1c')])===_0x80fd('0x1d')){_0x34a5e5[_0x80fd('0x1e')]=_0x2d7815[_0x80fd('0xd')][0x0][_0x80fd('0x1f')];}else{_0x34a5e5[_0x80fd('0x1e')]=_0x34a5e5[_0x80fd('0xf')];_0x34a5e5[_0x80fd('0x18')]=_0x34a5e5[_0x80fd('0x20')];}logger[_0x80fd('0x10')]('['+[_0x4113fd[_0x80fd('0x11')]()]+_0x80fd('0x21'),_0x34a5e5);_0x135367(_0x34a5e5);})[_0x80fd('0x13')](function(_0x473f10){logger[_0x80fd('0x14')]('['+[_0x4113fd[_0x80fd('0x11')]()]+']',_0x473f10[_0x80fd('0x15')]);_0x3b69b9(_0x473f10['message']);});}else{logger[_0x80fd('0x10')]('['+[_0x4113fd['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x34a5e5[_0x80fd('0x1e')]=_0x34a5e5['adminId'];_0x34a5e5[_0x80fd('0x18')]=_0x34a5e5[_0x80fd('0x20')];_0x135367(_0x34a5e5);}});};}function createEndUser(_0x562851,_0x5db6fe,_0x3cea0a,_0x555d6f,_0x57f1f6){logger['info']('['+[_0x562851['toUpperCase']()]+_0x80fd('0x22'),_0x3cea0a);return new Promise(function(_0x45d0e2,_0x153479){var _0x1d0df5={'method':_0x80fd('0x23'),'uri':_0x555d6f+_0x80fd('0x24')+_0x57f1f6,'body':{'user_name':_0x3cea0a[_0x80fd('0x25')],'roles':_0x80fd('0x26'),'first_name':_0x3cea0a['endUserNumber'],'active':_0x80fd('0x1d'),'date_format':_0x80fd('0x27'),'phone':_0x3cea0a[_0x80fd('0x25')]},'auth':_0x5db6fe,'json':!![]};return rp(_0x1d0df5)[_0x80fd('0x28')](function(_0x148cb4){logger[_0x80fd('0x10')]('['+[_0x562851['toUpperCase']()]+_0x80fd('0x29'),_0x148cb4[_0x80fd('0xd')]);_0x3cea0a[_0x80fd('0x2a')]=_0x148cb4[_0x80fd('0xd')][_0x80fd('0x1f')];_0x45d0e2(_0x3cea0a);})['catch'](function(_0xf55e49){logger[_0x80fd('0x14')]('['+[_0x562851['toUpperCase']()]+']',_0xf55e49['message']);_0x153479(_0xf55e49['message']);});});}function getEndUser(_0x7341db,_0x54f929,_0x11b09b,_0x9c08a,_0x4b71cf){return function(_0x174653){logger['info']('['+[_0x7341db[_0x80fd('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x174653);return new Promise(function(_0x49fabf,_0x107618){var _0x46c766={'method':_0x80fd('0x19'),'uri':_0x11b09b+_0x80fd('0x2b')+_0x174653['endUserNumber']+'&'+_0x9c08a+'&'+_0x4b71cf,'auth':_0x54f929,'json':!![]};return rp(_0x46c766)[_0x80fd('0x28')](function(_0x5b1990){if(_0x5b1990[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){_0x174653[_0x80fd('0x2a')]=_0x5b1990['result'][0x0][_0x80fd('0x1f')];logger['info']('['+[_0x7341db[_0x80fd('0x11')]()]+_0x80fd('0x2c'),_0x174653);_0x49fabf(_0x174653);}else{return createEndUser(_0x7341db,_0x54f929,_0x174653,_0x11b09b,_0x9c08a)[_0x80fd('0x28')](function(_0xe1afaa){logger[_0x80fd('0x10')]('['+[_0x7341db[_0x80fd('0x11')]()]+_0x80fd('0x2d'),_0xe1afaa);_0x49fabf(_0xe1afaa);});}})['catch'](function(_0x338ac1){logger[_0x80fd('0x14')]('['+[_0x7341db['toUpperCase']()]+']',_0x338ac1[_0x80fd('0x15')]);_0x107618(_0x338ac1[_0x80fd('0x15')]);});});};}function getCustomFields(_0x5da1f7,_0x57e9fd){var _0x2c3a30={};if(_0x5da1f7['length']>0x0){_['forEach'](_0x5da1f7,function(_0x366687){if(_[_0x80fd('0x2e')]([_0x80fd('0x2f'),_0x80fd('0x30')],_0x366687['type'])&&_0x366687[_0x80fd('0x31')]&&!_0x366687['customField']){_0x2c3a30[_0x366687[_0x80fd('0x31')][_0x80fd('0x32')]()]=_0x366687['content']['toString']();}else if(_['includes']([_0x80fd('0x2f'),_0x80fd('0x30')],_0x366687['type'])&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x366687['content'][_0x80fd('0x35')]();}else if(_0x366687['type']===_0x80fd('0x36')&&_0x366687[_0x80fd('0x37')]&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x57e9fd[_0x366687['variableName']][_0x80fd('0x35')]();}else if(_0x366687['type']===_0x80fd('0x38')&&_0x366687[_0x80fd('0x39')]&&_0x366687[_0x80fd('0x39')][_0x80fd('0x3a')]&&_0x366687[_0x80fd('0x33')]&&_0x366687[_0x80fd('0x34')]){_0x2c3a30[_0x366687[_0x80fd('0x33')][_0x80fd('0x32')]()]=_0x57e9fd[_0x366687['Variable'][_0x80fd('0x3a')][_0x80fd('0x32')]()]['toString']();}});}return _0x2c3a30;}function getTicket(_0x529e37,_0x4e4f43,_0x4daa9e,_0x2c2dac,_0x5b71d9,_0x1a0273){return function(_0x164836){logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+_0x80fd('0x3b'),_0x164836);return new Promise(function(_0x86251a,_0x168d8c){var _0x2e71df=_0x529e37[_0x80fd('0x32')]()===_0x80fd('0x3c')?_0x164836['userId']:_0x164836[_0x80fd('0x2a')];var _0x295738={'method':_0x80fd('0x23'),'uri':_0x4daa9e+_0x80fd('0x3d')+'?'+_0x1a0273,'body':Object[_0x80fd('0x3e')]({},{'active':'true','caller_id':_0x2e71df,'assigned_to':_0x164836['userId'],'short_description':intUtil['getString'](_0x2c2dac[_0x80fd('0x3f')],_0x5b71d9,'\x20'),'description':intUtil[_0x80fd('0x40')](_0x2c2dac[_0x80fd('0x41')],_0x5b71d9,'\x0a')},getCustomFields(_0x2c2dac[_0x80fd('0x42')],_0x5b71d9)),'auth':_0x4e4f43,'json':!![]};return rp(_0x295738)[_0x80fd('0x28')](function(_0x26fd89){logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x26fd89[_0x80fd('0xd')]);_0x164836['ticketId']=_0x26fd89['result'][_0x80fd('0x1f')];_0x164836[_0x80fd('0x43')]=_0x26fd89['result'][_0x80fd('0x44')];logger[_0x80fd('0x10')]('['+[_0x529e37[_0x80fd('0x11')]()]+']\x20getTicket\x20crm',_0x164836);_0x86251a(_0x164836);})[_0x80fd('0x13')](function(_0x445253){logger[_0x80fd('0x14')]('['+[_0x529e37[_0x80fd('0x11')]()]+']',_0x445253[_0x80fd('0x15')]);_0x168d8c(_0x445253['message']);});});};}function createRemoteTag(_0xe9e1ed,_0x42ac7a,_0x141122,_0x412600){return new Promise(function(_0xf5a371,_0x2d059b){var _0x1ed542={'method':_0x80fd('0x23'),'uri':_0x141122+_0x80fd('0x45')+'?'+_0x412600,'body':{'short_description':_0xe9e1ed,'global':!![],'active':!![],'name':_0xe9e1ed},'auth':_0x42ac7a,'json':!![]};return rp(_0x1ed542)[_0x80fd('0x28')](function(_0x439c36){var _0x415386=_0x439c36[_0x80fd('0xd')]['sys_id'];_0xf5a371(_0x415386);});});}function getRemoteTag(_0x417163,_0x967dd3,_0x178961,_0x4dc0ce,_0xf1b6f7){return new Promise(function(_0xa3c73,_0x5bd55e){var _0x62588c={'method':_0x80fd('0x19'),'uri':_0x178961+'label'+'?sysparm_query=name%3D'+_0x417163+'&'+_0x4dc0ce,'auth':_0x967dd3,'json':!![]};return rp(_0x62588c)['then'](function(_0x5c3f09){if(_0x5c3f09[_0x80fd('0xd')][_0x80fd('0xe')]>0x0){var _0x2a9395=_0x5c3f09['result'][0x0][_0x80fd('0x1f')];_0xa3c73(_0x2a9395);}else{return createRemoteTag(_0x417163,_0x967dd3,_0x178961,_0x4dc0ce)[_0x80fd('0x28')](function(_0x2099d9){_0xa3c73(_0x2099d9);});}});});}function assignTagToIncident(_0x34aeba,_0x445040,_0x5a2347,_0x2d1665,_0xfed5f0){return new Promise(function(_0x3c903c,_0x2e07a1){var _0x43926a={'method':_0x80fd('0x23'),'uri':_0x5a2347+'label_entry'+'?'+_0xfed5f0,'body':{'label':_0x34aeba,'table':_0x80fd('0x3d'),'id_type':_0x80fd('0x46'),'table_key':_0x2d1665[_0x80fd('0x47')],'title':_0x80fd('0x48')+_0x2d1665['ticketNumber'],'id_display':_0x2d1665[_0x80fd('0x43')]},'auth':_0x445040,'json':!![]};return rp(_0x43926a)[_0x80fd('0x28')](function(_0xcc3569){_0x3c903c();})['catch'](function(){_0x3c903c();});});}function manageTags(_0x170456,_0x1d2e56,_0x186911,_0x4f87ce,_0x563ed8,_0x505e2e,_0x2ec3d9){return new Promise(function(_0x310c89,_0xb39c58){var _0x46f6d1=[];_0x1d2e56[_0x80fd('0x49')](function(_0x29fdfe){_0x46f6d1[_0x80fd('0x4a')](getRemoteTag(_0x29fdfe,_0x186911,_0x4f87ce,_0x505e2e,_0x2ec3d9));});return Promise[_0x80fd('0x4b')](_0x46f6d1)[_0x80fd('0x28')](function(_0x27c55b){if(_0x27c55b['length']){logger[_0x80fd('0x10')]('['+[_0x170456[_0x80fd('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x27c55b);var _0x51d0dd=[];_0x27c55b[_0x80fd('0x49')](function(_0x1877e4){_0x51d0dd['push'](assignTagToIncident(_0x1877e4,_0x186911,_0x4f87ce,_0x563ed8,_0x505e2e));});return Promise[_0x80fd('0x4b')](_0x51d0dd)['then'](function(){_0x310c89();})[_0x80fd('0x13')](function(){_0x310c89();});}else{_0x310c89();}});});}function getTags(_0x5ad61e,_0x75f6e7,_0x1a50a9,_0x464475,_0x146a29,_0x1299ae){return function(_0x4c126a){return new Promise(function(_0x102822,_0x1df6db){var _0x462cb7=[];var _0x27e52b=_0x464475[_0x80fd('0x4c')];if(_0x27e52b&&_0x27e52b[_0x80fd('0xe')]>0x0){_0x462cb7=_[_0x80fd('0x4d')](_0x27e52b,_0x80fd('0x3a'));}if(_0x462cb7[_0x80fd('0xe')]>0x0){return manageTags(_0x5ad61e,_0x462cb7,_0x75f6e7,_0x1a50a9,_0x4c126a,_0x146a29,_0x1299ae)['then'](function(){_0x102822(_0x4c126a);});}else{_0x102822(_0x4c126a);}});};}function emit(_0x48fce6,_0x1c63a2,_0x454133){var _0x4b9840='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x80fd('0x4e')+_0x80fd('0x4f');var _0x5c9a15={'uri':_0x48fce6+_0x80fd('0x50')+_0x454133+_0x4b9840};io['to'](util[_0x80fd('0x51')](_0x80fd('0x52'),_0x1c63a2))[_0x80fd('0x53')](_0x80fd('0x54'),_0x5c9a15);}exports['cs']=function(_0x43ec2b,_0x391977,_0x54d4b7,_0x8ab3e8,_0x212bfd,_0x2558d2,_0x556eb7,_0x709e95){var _0x541d86={};var _0xb85bd8={'user':_0x2558d2['username'],'pass':_0x2558d2[_0x80fd('0x55')]};var _0x14fce4=_0x80fd('0x56');var _0x437af0=_0x80fd('0x57');_0x2558d2[_0x80fd('0x58')]=intUtil[_0x80fd('0x59')](_0x2558d2[_0x80fd('0x58')]);_0x2558d2['serverUrl']=intUtil[_0x80fd('0x59')](_0x2558d2['serverUrl']);var _0x5184f6=util['format'](_0x80fd('0x5a'),_0x2558d2[_0x80fd('0x58')]);_0x541d86[_0x80fd('0x18')]=!_[_0x80fd('0x5b')](_0x8ab3e8)?_0x8ab3e8[_0x80fd('0x5c')]:null;_0x541d86[_0x80fd('0x20')]=_0x2558d2['email'];_0x541d86[_0x80fd('0x25')]=_0x709e95['toLowerCase']()===_0x80fd('0x3c')?_0x391977[_0x80fd('0x5d')]:_0x391977[_0x80fd('0x5e')];_0x541d86['callDirection']=_0x709e95===_0x80fd('0x5f')||_0x709e95==='unmanaged'?_0x80fd('0x5f'):_0x80fd('0x3c');var _0x258f44=util['format'](_0x80fd('0x60'),_0x2558d2['serverUrl'],_0x391977[_0x80fd('0x61')],md5(_0x391977[_0x80fd('0x61')]));if(_0x212bfd&&_0x212bfd[_0x80fd('0x62')]){logger['info'](_0x80fd('0x63'),_0x80fd('0x64'));_0x391977[_0x80fd('0x65')]=_0x258f44;}else if(_0x556eb7&&_0x556eb7[_0x80fd('0x66')]&&_0x556eb7[_0x80fd('0x66')]!==_0x80fd('0x67')){logger[_0x80fd('0x10')]('[OUTBOUND]',_0x80fd('0x64'));_0x391977['recordingURL']=_0x258f44;}else{_0x391977[_0x80fd('0x65')]='';}return getAdminUser(_0x709e95,_0xb85bd8,_0x541d86,_0x5184f6,_0x437af0,_0x14fce4)[_0x80fd('0x28')](getUser(_0x709e95,_0xb85bd8,_0x5184f6,_0x437af0,_0x14fce4))[_0x80fd('0x28')](getEndUser(_0x709e95,_0xb85bd8,_0x5184f6,_0x437af0,_0x14fce4))['then'](getTicket(_0x709e95,_0xb85bd8,_0x5184f6,_0x54d4b7,_0x391977,_0x437af0))[_0x80fd('0x28')](function(_0x116f0c){logger[_0x80fd('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x116f0c[_0x80fd('0x47')]));logger[_0x80fd('0x10')](util[_0x80fd('0x51')]('call\x20direction:\x20%s',_0x709e95));if(_0x709e95!=='unmanaged'){logger[_0x80fd('0x10')]('['+[_0x709e95['toUpperCase']()]+']',_0x80fd('0x68'));emit(_0x2558d2[_0x80fd('0x58')],_0x8ab3e8[_0x80fd('0x3a')],_0x116f0c[_0x80fd('0x47')]);}})['catch'](function(_0xda628c){logger['error']('['+[_0x709e95['toUpperCase']()]+_0x80fd('0x69'),util[_0x80fd('0x6a')](_0xda628c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x503a=['userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','customVariable','Variable','name','outbound','incident','getString','Subjects','Descriptions','Fields','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','],\x20getUser\x20input\x20crm','validateEmail'];(function(_0x29d23f,_0x3302d7){var _0x5855cc=function(_0x285e22){while(--_0x285e22){_0x29d23f['push'](_0x29d23f['shift']());}};_0x5855cc(++_0x3302d7);}(_0x503a,0xc3));var _0xa503=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0x503a[_0xf55e73];return _0x116b99;};'use strict';var _=require('lodash');var Promise=require(_0xa503('0x0'));var rp=require(_0xa503('0x1'));var util=require(_0xa503('0x2'));var md5=require(_0xa503('0x3'));var Redis=require(_0xa503('0x4'));var intUtil=require(_0xa503('0x5'));var config=require(_0xa503('0x6'));var logger=require(_0xa503('0x7'))(_0xa503('0x8'));config[_0xa503('0x9')]=_['defaults'](config[_0xa503('0x9')],{'host':_0xa503('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x239124,_0x26b829,_0xc50fa0,_0x2dba96,_0x5bf2bd,_0x5577e3){return new Promise(function(_0x3952a7,_0x484e86){var _0x5c052b={'method':_0xa503('0xb'),'uri':_0x2dba96+_0xa503('0xc')+'&'+_0x5bf2bd+'&'+_0x5577e3,'auth':_0x26b829,'json':!![]};return rp(_0x5c052b)[_0xa503('0xd')](function(_0x2cb179){if(_0x2cb179[_0xa503('0xe')][_0xa503('0xf')]>0x0){_0xc50fa0['adminId']=_0x2cb179[_0xa503('0xe')][0x0][_0xa503('0x10')];}logger['info']('['+[_0x239124['toUpperCase']()]+_0xa503('0x11'),_0xc50fa0);_0x3952a7(_0xc50fa0);})[_0xa503('0x12')](function(_0x48f473){logger[_0xa503('0x13')]('['+[_0x239124[_0xa503('0x14')]()]+']',_0x48f473[_0xa503('0x15')]);_0x484e86(_0x48f473[_0xa503('0x15')]);});});}function getUser(_0x473bad,_0x55da67,_0xae0c67,_0x5ece10,_0x407b8f){return function(_0x594d0c){logger[_0xa503('0x16')]('['+[_0x473bad[_0xa503('0x14')]()]+_0xa503('0x17'),_0x594d0c);return new Promise(function(_0x5006a0,_0x59ba40){if(intUtil[_0xa503('0x18')](_0x594d0c[_0xa503('0x19')])){var _0x41016b={'method':_0xa503('0xb'),'uri':_0xae0c67+_0xa503('0x1a')+_0x594d0c[_0xa503('0x19')]+'&'+_0x5ece10+'&'+_0x407b8f,'auth':_0x55da67,'json':!![]};logger['info']('['+[_0x473bad['toUpperCase']()]+_0xa503('0x1b'),_0x41016b);return rp(_0x41016b)['then'](function(_0x28e81e){logger['info']('['+[_0x473bad['toUpperCase']()]+'],\x20getUser\x20entity',_0x28e81e);if(_0x28e81e[_0xa503('0xe')][_0xa503('0xf')]>0x0&&String(_0x28e81e[_0xa503('0xe')][0x0][_0xa503('0x1c')])===_0xa503('0x1d')){_0x594d0c[_0xa503('0x1e')]=_0x28e81e[_0xa503('0xe')][0x0][_0xa503('0x10')];}else{_0x594d0c[_0xa503('0x1e')]=_0x594d0c[_0xa503('0x1f')];_0x594d0c[_0xa503('0x19')]=_0x594d0c[_0xa503('0x20')];}logger[_0xa503('0x16')]('['+[_0x473bad[_0xa503('0x14')]()]+_0xa503('0x21'),_0x594d0c);_0x5006a0(_0x594d0c);})[_0xa503('0x12')](function(_0xdfda59){logger[_0xa503('0x13')]('['+[_0x473bad[_0xa503('0x14')]()]+']',_0xdfda59[_0xa503('0x15')]);_0x59ba40(_0xdfda59[_0xa503('0x15')]);});}else{logger[_0xa503('0x16')]('['+[_0x473bad[_0xa503('0x14')]()]+']\x20using\x20admin\x20profile');_0x594d0c[_0xa503('0x1e')]=_0x594d0c['adminId'];_0x594d0c['userEmail']=_0x594d0c['adminEmail'];_0x5006a0(_0x594d0c);}});};}function createEndUser(_0x32e7f1,_0x364f23,_0x158308,_0x289b50,_0x484505){logger[_0xa503('0x16')]('['+[_0x32e7f1[_0xa503('0x14')]()]+_0xa503('0x22'),_0x158308);return new Promise(function(_0x47a816,_0x5da32b){var _0x701476={'method':_0xa503('0x23'),'uri':_0x289b50+_0xa503('0x24')+_0x484505,'body':{'user_name':_0x158308[_0xa503('0x25')],'roles':'user','first_name':_0x158308['endUserNumber'],'active':_0xa503('0x1d'),'date_format':_0xa503('0x26'),'phone':_0x158308[_0xa503('0x25')]},'auth':_0x364f23,'json':!![]};return rp(_0x701476)[_0xa503('0xd')](function(_0xa13ba5){logger['info']('['+[_0x32e7f1[_0xa503('0x14')]()]+_0xa503('0x27'),_0xa13ba5[_0xa503('0xe')]);_0x158308[_0xa503('0x28')]=_0xa13ba5['result'][_0xa503('0x10')];_0x47a816(_0x158308);})[_0xa503('0x12')](function(_0x29dbb1){logger[_0xa503('0x13')]('['+[_0x32e7f1[_0xa503('0x14')]()]+']',_0x29dbb1[_0xa503('0x15')]);_0x5da32b(_0x29dbb1['message']);});});}function getEndUser(_0x40e9c2,_0x41a9af,_0x58ea94,_0x428c80,_0x2172eb){return function(_0x43fb64){logger[_0xa503('0x16')]('['+[_0x40e9c2[_0xa503('0x14')]()]+_0xa503('0x29'),_0x43fb64);return new Promise(function(_0x345c56,_0x58a9f8){var _0xfe8eea={'method':'GET','uri':_0x58ea94+_0xa503('0x2a')+_0x43fb64['endUserNumber']+'&'+_0x428c80+'&'+_0x2172eb,'auth':_0x41a9af,'json':!![]};return rp(_0xfe8eea)['then'](function(_0xaf527b){if(_0xaf527b[_0xa503('0xe')]['length']>0x0){_0x43fb64['endUserId']=_0xaf527b[_0xa503('0xe')][0x0][_0xa503('0x10')];logger[_0xa503('0x16')]('['+[_0x40e9c2[_0xa503('0x14')]()]+'],\x20getEndUser\x20crm',_0x43fb64);_0x345c56(_0x43fb64);}else{return createEndUser(_0x40e9c2,_0x41a9af,_0x43fb64,_0x58ea94,_0x428c80)[_0xa503('0xd')](function(_0x56d76c){logger[_0xa503('0x16')]('['+[_0x40e9c2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x56d76c);_0x345c56(_0x56d76c);});}})[_0xa503('0x12')](function(_0x45e8eb){logger[_0xa503('0x13')]('['+[_0x40e9c2[_0xa503('0x14')]()]+']',_0x45e8eb[_0xa503('0x15')]);_0x58a9f8(_0x45e8eb['message']);});});};}function getCustomFields(_0x4f9676,_0x38a6f7){var _0x45a4a8={};if(_0x4f9676[_0xa503('0xf')]>0x0){_['forEach'](_0x4f9676,function(_0x1c314e){if(_[_0xa503('0x2b')]([_0xa503('0x2c'),_0xa503('0x2d')],_0x1c314e[_0xa503('0x2e')])&&_0x1c314e['nameField']&&!_0x1c314e[_0xa503('0x2f')]){_0x45a4a8[_0x1c314e[_0xa503('0x30')][_0xa503('0x31')]()]=_0x1c314e[_0xa503('0x32')][_0xa503('0x33')]();}else if(_[_0xa503('0x2b')]([_0xa503('0x2c'),_0xa503('0x2d')],_0x1c314e[_0xa503('0x2e')])&&_0x1c314e[_0xa503('0x34')]&&_0x1c314e['customField']){_0x45a4a8[_0x1c314e['idField'][_0xa503('0x31')]()]=_0x1c314e['content'][_0xa503('0x33')]();}else if(_0x1c314e['type']===_0xa503('0x35')&&_0x1c314e['variableName']&&_0x1c314e[_0xa503('0x34')]&&_0x1c314e[_0xa503('0x2f')]){_0x45a4a8[_0x1c314e[_0xa503('0x34')][_0xa503('0x31')]()]=_0x38a6f7[_0x1c314e['variableName']][_0xa503('0x33')]();}else if(_0x1c314e[_0xa503('0x2e')]===_0xa503('0x36')&&_0x1c314e[_0xa503('0x37')]&&_0x1c314e[_0xa503('0x37')]['name']&&_0x1c314e['idField']&&_0x1c314e[_0xa503('0x2f')]){_0x45a4a8[_0x1c314e[_0xa503('0x34')][_0xa503('0x31')]()]=_0x38a6f7[_0x1c314e[_0xa503('0x37')][_0xa503('0x38')][_0xa503('0x31')]()]['toString']();}});}return _0x45a4a8;}function getTicket(_0x120054,_0x306e36,_0x51202c,_0x3e100c,_0x572bdd,_0x392184){return function(_0x522b7e){logger[_0xa503('0x16')]('['+[_0x120054['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x522b7e);return new Promise(function(_0x7387ea,_0x498839){var _0x5d4341=_0x120054[_0xa503('0x31')]()===_0xa503('0x39')?_0x522b7e[_0xa503('0x1e')]:_0x522b7e[_0xa503('0x28')];var _0x4c82fd={'method':_0xa503('0x23'),'uri':_0x51202c+_0xa503('0x3a')+'?'+_0x392184,'body':Object['assign']({},{'active':_0xa503('0x1d'),'caller_id':_0x5d4341,'assigned_to':_0x522b7e[_0xa503('0x1e')],'short_description':intUtil[_0xa503('0x3b')](_0x3e100c[_0xa503('0x3c')],_0x572bdd,'\x20'),'description':intUtil[_0xa503('0x3b')](_0x3e100c[_0xa503('0x3d')],_0x572bdd,'\x0a')},getCustomFields(_0x3e100c[_0xa503('0x3e')],_0x572bdd)),'auth':_0x306e36,'json':!![]};return rp(_0x4c82fd)[_0xa503('0xd')](function(_0x48757d){logger[_0xa503('0x16')]('['+[_0x120054[_0xa503('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x48757d[_0xa503('0xe')]);_0x522b7e[_0xa503('0x3f')]=_0x48757d[_0xa503('0xe')][_0xa503('0x10')];_0x522b7e['ticketNumber']=_0x48757d[_0xa503('0xe')][_0xa503('0x40')];logger['info']('['+[_0x120054[_0xa503('0x14')]()]+']\x20getTicket\x20crm',_0x522b7e);_0x7387ea(_0x522b7e);})[_0xa503('0x12')](function(_0x3361bb){logger[_0xa503('0x13')]('['+[_0x120054[_0xa503('0x14')]()]+']',_0x3361bb[_0xa503('0x15')]);_0x498839(_0x3361bb[_0xa503('0x15')]);});});};}function createRemoteTag(_0x3b9775,_0x2a0a97,_0x970777,_0x8ae3b3){return new Promise(function(_0x3d679f,_0x247ad8){var _0x4c5ffb={'method':_0xa503('0x23'),'uri':_0x970777+_0xa503('0x41')+'?'+_0x8ae3b3,'body':{'short_description':_0x3b9775,'global':!![],'active':!![],'name':_0x3b9775},'auth':_0x2a0a97,'json':!![]};return rp(_0x4c5ffb)[_0xa503('0xd')](function(_0x5e6165){var _0x151f7c=_0x5e6165[_0xa503('0xe')][_0xa503('0x10')];_0x3d679f(_0x151f7c);});});}function getRemoteTag(_0x26b8eb,_0x5837e1,_0x3a1d71,_0x3d9706,_0x26d20c){return new Promise(function(_0x459215,_0x29b324){var _0x1f8735={'method':_0xa503('0xb'),'uri':_0x3a1d71+'label'+_0xa503('0x42')+_0x26b8eb+'&'+_0x3d9706,'auth':_0x5837e1,'json':!![]};return rp(_0x1f8735)[_0xa503('0xd')](function(_0x27b679){if(_0x27b679[_0xa503('0xe')][_0xa503('0xf')]>0x0){var _0xc7f4ee=_0x27b679[_0xa503('0xe')][0x0][_0xa503('0x10')];_0x459215(_0xc7f4ee);}else{return createRemoteTag(_0x26b8eb,_0x5837e1,_0x3a1d71,_0x3d9706)[_0xa503('0xd')](function(_0x4d074e){_0x459215(_0x4d074e);});}});});}function assignTagToIncident(_0x1354da,_0x5a1190,_0x1cc8b7,_0x50bd67,_0xb55210){return new Promise(function(_0x31156c,_0x132e93){var _0x2b8df1={'method':_0xa503('0x23'),'uri':_0x1cc8b7+_0xa503('0x43')+'?'+_0xb55210,'body':{'label':_0x1354da,'table':'incident','id_type':_0xa503('0x44'),'table_key':_0x50bd67['ticketId'],'title':_0xa503('0x45')+_0x50bd67[_0xa503('0x46')],'id_display':_0x50bd67[_0xa503('0x46')]},'auth':_0x5a1190,'json':!![]};return rp(_0x2b8df1)[_0xa503('0xd')](function(_0x6cc30b){_0x31156c();})[_0xa503('0x12')](function(){_0x31156c();});});}function manageTags(_0x9a681a,_0x1fb58e,_0x5db437,_0x4dc1b2,_0x3cc1b5,_0x47264c,_0xad8e77){return new Promise(function(_0x5bf772,_0x314132){var _0x90c965=[];_0x1fb58e[_0xa503('0x47')](function(_0x19563e){_0x90c965['push'](getRemoteTag(_0x19563e,_0x5db437,_0x4dc1b2,_0x47264c,_0xad8e77));});return Promise['all'](_0x90c965)[_0xa503('0xd')](function(_0x103d21){if(_0x103d21['length']){logger[_0xa503('0x16')]('['+[_0x9a681a[_0xa503('0x14')]()]+_0xa503('0x48'),_0x103d21);var _0x55bb14=[];_0x103d21[_0xa503('0x47')](function(_0x3507b6){_0x55bb14[_0xa503('0x49')](assignTagToIncident(_0x3507b6,_0x5db437,_0x4dc1b2,_0x3cc1b5,_0x47264c));});return Promise[_0xa503('0x4a')](_0x55bb14)['then'](function(){_0x5bf772();})[_0xa503('0x12')](function(){_0x5bf772();});}else{_0x5bf772();}});});}function getTags(_0x5c2e49,_0x2a283d,_0x11b235,_0x4e230f,_0x49f254,_0xcdb5fb){return function(_0x32ec48){return new Promise(function(_0xf342b1,_0x206523){var _0x391034=[];var _0x1d0389=_0x4e230f['Tags'];if(_0x1d0389&&_0x1d0389[_0xa503('0xf')]>0x0){_0x391034=_[_0xa503('0x4b')](_0x1d0389,'name');}if(_0x391034['length']>0x0){return manageTags(_0x5c2e49,_0x391034,_0x2a283d,_0x11b235,_0x32ec48,_0x49f254,_0xcdb5fb)[_0xa503('0xd')](function(){_0xf342b1(_0x32ec48);});}else{_0xf342b1(_0x32ec48);}});};}function emit(_0x581818,_0x5aaf76,_0x13dc11){var _0x3457a2=_0xa503('0x4c')+_0xa503('0x4d')+_0xa503('0x4e')+_0xa503('0x4f');var _0x44da85={'uri':_0x581818+_0xa503('0x50')+_0x13dc11+_0x3457a2};io['to'](util[_0xa503('0x51')](_0xa503('0x52'),_0x5aaf76))[_0xa503('0x53')](_0xa503('0x54'),_0x44da85);}exports['cs']=function(_0x4030fd,_0x201b47,_0x3d84d2,_0x24400f,_0x389819,_0x3d562c,_0x26e176,_0x3cb59d){var _0x7c3016={};var _0x43b059={'user':_0x3d562c[_0xa503('0x55')],'pass':_0x3d562c[_0xa503('0x56')]};var _0x4d101f=_0xa503('0x57');var _0x4b2352=_0xa503('0x58');_0x3d562c[_0xa503('0x59')]=intUtil[_0xa503('0x5a')](_0x3d562c[_0xa503('0x59')]);_0x3d562c[_0xa503('0x5b')]=intUtil[_0xa503('0x5a')](_0x3d562c[_0xa503('0x5b')]);var _0xdf1211=util['format']('%s/api/now/table/',_0x3d562c[_0xa503('0x59')]);_0x7c3016[_0xa503('0x19')]=!_[_0xa503('0x5c')](_0x24400f)?_0x24400f[_0xa503('0x5d')]:null;_0x7c3016[_0xa503('0x20')]=_0x3d562c[_0xa503('0x5d')];_0x7c3016['endUserNumber']=_0x3cb59d[_0xa503('0x31')]()===_0xa503('0x39')?_0x201b47[_0xa503('0x5e')]:_0x201b47[_0xa503('0x5f')];_0x7c3016['callDirection']=_0x3cb59d===_0xa503('0x60')||_0x3cb59d==='unmanaged'?_0xa503('0x60'):_0xa503('0x39');var _0x35e468=util[_0xa503('0x51')](_0xa503('0x61'),_0x3d562c[_0xa503('0x5b')],_0x201b47[_0xa503('0x62')],md5(_0x201b47['uniqueid']));if(_0x389819&&_0x389819['monitor_format']){logger[_0xa503('0x16')](_0xa503('0x63'),_0xa503('0x64'));_0x201b47[_0xa503('0x65')]=_0x35e468;}else if(_0x26e176&&_0x26e176[_0xa503('0x66')]&&_0x26e176['recordingFormat']!==_0xa503('0x67')){logger[_0xa503('0x16')](_0xa503('0x68'),_0xa503('0x64'));_0x201b47[_0xa503('0x65')]=_0x35e468;}else{_0x201b47[_0xa503('0x65')]='';}return getAdminUser(_0x3cb59d,_0x43b059,_0x7c3016,_0xdf1211,_0x4b2352,_0x4d101f)[_0xa503('0xd')](getUser(_0x3cb59d,_0x43b059,_0xdf1211,_0x4b2352,_0x4d101f))[_0xa503('0xd')](getEndUser(_0x3cb59d,_0x43b059,_0xdf1211,_0x4b2352,_0x4d101f))[_0xa503('0xd')](getTicket(_0x3cb59d,_0x43b059,_0xdf1211,_0x3d84d2,_0x201b47,_0x4b2352))[_0xa503('0xd')](function(_0x429310){logger[_0xa503('0x16')](util['format'](_0xa503('0x69'),_0x429310[_0xa503('0x3f')]));logger['info'](util[_0xa503('0x51')](_0xa503('0x6a'),_0x3cb59d));if(_0x3cb59d!==_0xa503('0x6b')){logger['info']('['+[_0x3cb59d[_0xa503('0x14')]()]+']',_0xa503('0x6c'));emit(_0x3d562c[_0xa503('0x59')],_0x24400f['name'],_0x429310[_0xa503('0x3f')]);}})[_0xa503('0x12')](function(_0x416d93){logger[_0xa503('0x13')]('['+[_0x3cb59d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa503('0x6d')](_0x416d93,{'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 4e120b0..b022488 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 _0x8f7c=['user:%s','unmanaged','lastevent','toUpperCase','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','POST','emit','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','slice','duration_minutes','parent_id','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','get_server_info','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','debug','[HTTP]','map','type','nameField','customField','toLowerCase','string','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s'];(function(_0x59987a,_0x399e11){var _0x460646=function(_0x32c3c0){while(--_0x32c3c0){_0x59987a['push'](_0x59987a['shift']());}};_0x460646(++_0x399e11);}(_0x8f7c,0x179));var _0xc8f7=function(_0x33801c,_0x3041e2){_0x33801c=_0x33801c-0x0;var _0x183319=_0x8f7c[_0x33801c];return _0x183319;};'use strict';var _=require(_0xc8f7('0x0'));var rp=require(_0xc8f7('0x1'));var BPromise=require(_0xc8f7('0x2'));var md5=require(_0xc8f7('0x3'));var util=require(_0xc8f7('0x4'));var Redis=require(_0xc8f7('0x5'));var intUtil=require(_0xc8f7('0x6'));var config=require(_0xc8f7('0x7'));var logger=require(_0xc8f7('0x8'))(_0xc8f7('0x9'));config['redis']=_[_0xc8f7('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8f7('0xb')]));var def={'method':_0xc8f7('0xc'),'json':!![]};function emit(_0x35814a,_0x177189,_0x2a679f){io['to'](_0x35814a)[_0xc8f7('0xd')](_0x177189,_0x2a679f);}function getTicket(_0x24b825,_0xb05496,_0x5b314a,_0x365dc7,_0x1f8b59,_0x295083,_0x1842aa,_0x1c2cc6){logger['info'](_0xc8f7('0xe'));var _0xcc601a=new Date();var _0x5d00e7=[{'name':_0xc8f7('0xf'),'value':intUtil['getString'](_0x365dc7[_0xc8f7('0x10')],_0x1f8b59,'\x20')},{'name':_0xc8f7('0x11'),'value':_0xb05496['id']},{'name':_0xc8f7('0x12'),'value':_0xb05496['id']},{'name':_0xc8f7('0x13'),'value':intUtil[_0xc8f7('0x14')](_0x365dc7[_0xc8f7('0x15')],_0x1f8b59,'\x0a')},{'name':'date_start','value':_0xcc601a[_0xc8f7('0x16')]()[_0xc8f7('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc8f7('0x18'),'value':'15'},{'name':_0xc8f7('0x19'),'value':_0x5b314a['id']},{'name':'parent_type','value':'Contacts'},{'name':_0xc8f7('0x1a'),'value':_0x5b314a[_0xc8f7('0xf')]},{'name':_0xc8f7('0x1b'),'value':_0x1c2cc6}];if(_0x295083[_0xc8f7('0x1c')]){_[_0xc8f7('0x1d')](_0x295083,function(_0x1adacc){if(_0x1f8b59[_0x1adacc[_0xc8f7('0x1e')]]){_0x5d00e7[_0xc8f7('0x1f')]({'name':_0x1adacc[_0xc8f7('0x20')],'value':_0x1f8b59[_0x1adacc[_0xc8f7('0x1e')]]});}});}return request({'form':{'method':_0xc8f7('0x21'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x1842aa['id'],'module_name':_0xc8f7('0x24'),'name_value_list':_0x5d00e7})}});}function getAuth(_0x5747b4){return util[_0xc8f7('0x25')]('Basic\x20%s',new Buffer(_0x5747b4[_0xc8f7('0x26')]+':X')[_0xc8f7('0x27')]('base64'));}function getServerInfo(_0x5b3c3e){return request({'form':{'method':_0xc8f7('0x28'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5b3c3e['id']})}});}function getUser(_0x536b1d,_0x5d90b3,_0x16598e){if(!_[_0xc8f7('0x29')](_0x5d90b3)){logger[_0xc8f7('0x2a')]('Getting\x20agent\x20with\x20name',_0x5d90b3);return request({'form':{'method':_0xc8f7('0x2b'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x16598e['id'],'module_name':_0xc8f7('0x2c'),'query':util[_0xc8f7('0x25')](_0xc8f7('0x2d'),_0x5d90b3),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8f7('0x2e')](function(_0x358940){if(_0x358940[_0xc8f7('0x2f')]['length']){var _0x5d8d06=_[_0xc8f7('0x30')](_0x358940[_0xc8f7('0x2f')],function(_0x16fab9){return _0x16fab9[_0xc8f7('0x31')][_0xc8f7('0x32')][_0xc8f7('0x33')]===_0x5d90b3;});if(_0x5d8d06){logger[_0xc8f7('0x2a')](_0xc8f7('0x34'));return BPromise[_0xc8f7('0x35')]({'id':_0x5d8d06[_0xc8f7('0x31')]['id']['value'],'name':_0x5d8d06[_0xc8f7('0x31')][_0xc8f7('0xf')]['value']});}}logger[_0xc8f7('0x2a')](_0xc8f7('0x36'));return BPromise[_0xc8f7('0x35')]({'id':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x37')][_0xc8f7('0x33')],'name':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x32')]['value']});});}else{logger['info'](_0xc8f7('0x38'));return BPromise[_0xc8f7('0x35')]({'id':_0x16598e[_0xc8f7('0x31')][_0xc8f7('0x37')][_0xc8f7('0x33')],'name':_0x16598e['name_value_list'][_0xc8f7('0x32')][_0xc8f7('0x33')]});}}function getEndUser(_0x2aa021,_0x1c2538,_0x2a4c0d,_0x4f9cbc){logger['info'](_0xc8f7('0x39'),_0x2a4c0d);return request({'form':{'method':_0xc8f7('0x2b'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x4f9cbc['id'],'module_name':_0xc8f7('0x3a'),'query':util[_0xc8f7('0x25')](_0xc8f7('0x3b'),_0x2a4c0d),'order_by':'','offset':'0','select_fields':['id',_0xc8f7('0xf'),_0xc8f7('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc8f7('0x2e')](function(_0x32c8cf){if(_0x32c8cf['entry_list']['length']){var _0x58b1b4=_[_0xc8f7('0x30')](_0x32c8cf['entry_list'],function(_0x713346){return _0x713346[_0xc8f7('0x31')][_0xc8f7('0x3c')]['value']===_0x2a4c0d;});if(_0x58b1b4){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x58b1b4[_0xc8f7('0x31')]['id'][_0xc8f7('0x33')],'name':_0x58b1b4[_0xc8f7('0x31')]['name'][_0xc8f7('0x33')],'phone':_0x58b1b4[_0xc8f7('0x31')][_0xc8f7('0x3c')][_0xc8f7('0x33')]});}}else{logger[_0xc8f7('0x2a')](_0xc8f7('0x3d'));return request({'form':{'method':_0xc8f7('0x21'),'input_type':'JSON','response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'session':_0x4f9cbc['id'],'module_name':_0xc8f7('0x3a'),'name_value_list':[{'name':'first_name','value':_0x1c2538!==_0xc8f7('0x3e')?_0x1c2538:util[_0xc8f7('0x25')]('Caller\x20-\x20%s',_0x2a4c0d)},{'name':_0xc8f7('0x3c'),'value':_0x2a4c0d}]})}})[_0xc8f7('0x2e')](function(_0x93c449){logger['info'](_0xc8f7('0x3f'));return BPromise[_0xc8f7('0x35')]({'id':_0x93c449['id'],'name':_0x93c449[_0xc8f7('0x2f')][_0xc8f7('0x40')][_0xc8f7('0x33')],'phone':_0x93c449['entry_list'][_0xc8f7('0x3c')][_0xc8f7('0x33')]});});}});}function request(_0x48c8bb){logger[_0xc8f7('0x41')](_0xc8f7('0x42'),JSON[_0xc8f7('0x23')](_0x48c8bb));return rp(_['merge'](def,_0x48c8bb));}function getTags(_0x5ca4b8,_0x4e5f7b){var _0x3e5ced=[];if(_0x5ca4b8&&_0x5ca4b8[_0xc8f7('0x1c')]>0x0){_0x3e5ced=_[_0xc8f7('0x43')](_0x5ca4b8,_0x4e5f7b);}return _0x3e5ced;}function getCustomFields(_0x4f80f8,_0x205c3f){var _0x338c0a=[];var _0x3b050b={'custom_fields':[]};if(_0x4f80f8['length']>0x0){_[_0xc8f7('0x1d')](_0x4f80f8,function(_0x6dc96e){if(_0x6dc96e[_0xc8f7('0x44')]==='string'&&_0x6dc96e[_0xc8f7('0x45')]&&!_0x6dc96e[_0xc8f7('0x46')]){_0x3b050b[_0x6dc96e[_0xc8f7('0x45')][_0xc8f7('0x47')]()]=_0x6dc96e['content'][_0xc8f7('0x27')]();}else if(_0x6dc96e[_0xc8f7('0x44')]===_0xc8f7('0x48')&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e['customField']){_0x3b050b[_0xc8f7('0x49')]['push']({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x6dc96e[_0xc8f7('0x4a')][_0xc8f7('0x27')]()});}else if(_0x6dc96e[_0xc8f7('0x44')]===_0xc8f7('0x4b')&&_0x6dc96e[_0xc8f7('0x1e')]&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e[_0xc8f7('0x46')]){_0x205c3f[_0x6dc96e[_0xc8f7('0x1e')]]&&_0x3b050b[_0xc8f7('0x49')][_0xc8f7('0x1f')]({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x205c3f[_0x6dc96e[_0xc8f7('0x1e')]][_0xc8f7('0x27')]()});}else if(_0x6dc96e['type']===_0xc8f7('0x4c')&&_0x6dc96e[_0xc8f7('0x4d')]&&_0x6dc96e[_0xc8f7('0x4d')]['name']&&_0x6dc96e[_0xc8f7('0x20')]&&_0x6dc96e[_0xc8f7('0x46')]){_0x205c3f[_0x6dc96e[_0xc8f7('0x4d')][_0xc8f7('0xf')]['toLowerCase']()]&&_0x3b050b[_0xc8f7('0x49')][_0xc8f7('0x1f')]({'id':_0x6dc96e[_0xc8f7('0x20')],'value':_0x205c3f[_0x6dc96e[_0xc8f7('0x4d')][_0xc8f7('0xf')][_0xc8f7('0x47')]()][_0xc8f7('0x27')]()});}});}return _0x3b050b;}function getConnection(_0x410bc1){return request({'method':_0xc8f7('0xc'),'form':{'method':_0xc8f7('0x4e'),'input_type':_0xc8f7('0x22'),'response_type':_0xc8f7('0x22'),'rest_data':JSON[_0xc8f7('0x23')]({'user_auth':{'user_name':_0x410bc1[_0xc8f7('0x4f')],'password':_0x410bc1[_0xc8f7('0x50')],'encryption':_0xc8f7('0x51')},'application':_0xc8f7('0x52')})}})[_0xc8f7('0x2e')](function(_0x28db66){var _0x2e0cab=_0x28db66;if(_0x2e0cab['id']){def[_0xc8f7('0x53')]=_0x2e0cab['id'];return BPromise[_0xc8f7('0x35')](_0x2e0cab);}else{throw new Error(util[_0xc8f7('0x25')](_0xc8f7('0x54'),_0x410bc1['id']));}});}function setRelationship(_0x25920c,_0x5eedb2,_0x945556,_0x5f3fcf){return request({'form':{'method':_0xc8f7('0x55'),'input_type':'JSON','response_type':_0xc8f7('0x22'),'rest_data':JSON['stringify']({'session':_0x25920c['id'],'module_name':_0xc8f7('0x24'),'module_id':_0x945556['id'],'link_field_name':_0x5f3fcf,'related_ids':[_0x5eedb2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x195a32,_0x163d23,_0x20966c,_0x53329f,_0x27107e,_0x21ea98){var _0x3437ef,_0x2bbe6b,_0x1abe35,_0x552917;_0x21ea98['remoteUri']=intUtil[_0xc8f7('0x56')](_0x21ea98[_0xc8f7('0x57')]);_0x21ea98[_0xc8f7('0x58')]=intUtil[_0xc8f7('0x56')](_0x21ea98[_0xc8f7('0x58')]);def[_0xc8f7('0x59')]=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x21ea98[_0xc8f7('0x57')]);if(_0x27107e&&_0x27107e[_0xc8f7('0x5b')]){logger['info'](_0xc8f7('0x5c'),_0xc8f7('0x5d'));_0x163d23[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x21ea98[_0xc8f7('0x58')],_0x163d23[_0xc8f7('0x60')],md5(_0x163d23[_0xc8f7('0x60')]));}else{_0x163d23[_0xc8f7('0x5e')]='';}return getConnection(_0x21ea98)[_0xc8f7('0x2e')](function(_0x321ba5){_0x552917=_0x321ba5;return getUser(_0x21ea98,_0x53329f[_0xc8f7('0xf')],_0x552917);})[_0xc8f7('0x2e')](function(_0x30fb27){_0x3437ef=_0x30fb27;logger[_0xc8f7('0x2a')](_0xc8f7('0x61'),_0x3437ef['id']);return getEndUser(_0x21ea98,_0x163d23[_0xc8f7('0x62')],_0x163d23['calleridnum'],_0x552917);})['then'](function(_0x4b7248){_0x2bbe6b=_0x4b7248;logger['info'](_0xc8f7('0x63'),_0x2bbe6b['id']);return getTicket(_0x21ea98,_0x3437ef,_0x2bbe6b,_0x20966c,_0x163d23,_0x20966c[_0xc8f7('0x64')],_0x552917,_0xc8f7('0x65'));})[_0xc8f7('0x2e')](function(_0x3bc8ba){_0x1abe35=_0x3bc8ba;logger[_0xc8f7('0x2a')](_0xc8f7('0x66'));logger[_0xc8f7('0x2a')](_0xc8f7('0x67'),_0x1abe35['id']);return setRelationship(_0x552917,_0x3437ef,_0x1abe35,_0xc8f7('0x68'));})['then'](function(){return setRelationship(_0x552917,_0x2bbe6b,_0x1abe35,_0xc8f7('0x69'));})[_0xc8f7('0x2e')](function(){return getServerInfo(_0x552917);})[_0xc8f7('0x2e')](function(_0x126f0e){var _0x206751=parseInt(_0x126f0e[_0xc8f7('0x6a')][_0xc8f7('0x6b')](0x0));var _0x2bd534=util[_0xc8f7('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x21ea98[_0xc8f7('0x57')],_0x1abe35['id']);if(_0x206751>0x6){_0x2bd534=util['format'](_0xc8f7('0x6c'),_0x21ea98[_0xc8f7('0x57')],_0x1abe35['id']);}logger[_0xc8f7('0x2a')]('[QUEUE]',_0xc8f7('0x6d'));emit(util[_0xc8f7('0x25')]('user:%s',_0x53329f[_0xc8f7('0xf')]),_0xc8f7('0x6e'),{'uri':_0x2bd534});})[_0xc8f7('0x6f')](function(_0x38c589){logger[_0xc8f7('0x70')](_0xc8f7('0x5c'),JSON[_0xc8f7('0x23')](_0x38c589));});};exports[_0xc8f7('0x71')]=function(_0x4d1d7c,_0x26e5a2,_0x3a2283,_0x2b4638,_0x37b18c,_0x34b637,_0x35456a){var _0xc7d9c5,_0x4d56a4,_0x1b4638,_0x1a4ee2;_0x34b637['remoteUri']=intUtil[_0xc8f7('0x56')](_0x34b637[_0xc8f7('0x57')]);_0x34b637[_0xc8f7('0x58')]=intUtil['stripTrailingSlash'](_0x34b637[_0xc8f7('0x58')]);def[_0xc8f7('0x59')]=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x34b637[_0xc8f7('0x57')]);if(_0x35456a&&_0x35456a['recordingFormat']&&_0x35456a[_0xc8f7('0x72')]!=='none'){logger[_0xc8f7('0x2a')](_0xc8f7('0x73'),'Recording\x20is\x20enabled!');_0x26e5a2[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x34b637[_0xc8f7('0x58')],_0x26e5a2[_0xc8f7('0x60')],md5(_0x26e5a2[_0xc8f7('0x60')]));}return getConnection(_0x34b637)[_0xc8f7('0x2e')](function(_0x2d6d43){_0x1a4ee2=_0x2d6d43;return getUser(_0x34b637,_0x2b4638[_0xc8f7('0xf')],_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x6c55bc){_0xc7d9c5=_0x6c55bc;logger[_0xc8f7('0x2a')]('The\x20User\x20ID\x20is:',_0xc7d9c5['id']);return getEndUser(_0x34b637,_0x26e5a2['destcalleridname'],_0x26e5a2[_0xc8f7('0x74')],_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x1df834){_0x4d56a4=_0x1df834;logger['info'](_0xc8f7('0x63'),_0x4d56a4['id']);return getTicket(_0x34b637,_0xc7d9c5,_0x4d56a4,_0x3a2283,_0x26e5a2,_0x3a2283[_0xc8f7('0x64')],_0x1a4ee2,_0xc8f7('0x75'));})[_0xc8f7('0x2e')](function(_0x59a476){_0x1b4638=_0x59a476;logger[_0xc8f7('0x2a')]('Ticket\x20created!');logger[_0xc8f7('0x2a')](_0xc8f7('0x67'),_0x1b4638['id']);return setRelationship(_0x1a4ee2,_0xc7d9c5,_0x1b4638,_0xc8f7('0x68'));})[_0xc8f7('0x2e')](function(){return setRelationship(_0x1a4ee2,_0x4d56a4,_0x1b4638,_0xc8f7('0x69'));})['then'](function(){return getServerInfo(_0x1a4ee2);})[_0xc8f7('0x2e')](function(_0x10b8e0){var _0x211848=parseInt(_0x10b8e0[_0xc8f7('0x6a')][_0xc8f7('0x6b')](0x0));var _0x6d6e60=util['format'](_0xc8f7('0x76'),_0x34b637[_0xc8f7('0x57')],_0x1b4638['id']);if(_0x211848>0x6){_0x6d6e60=util[_0xc8f7('0x25')](_0xc8f7('0x6c'),_0x34b637[_0xc8f7('0x57')],_0x1b4638['id']);}logger[_0xc8f7('0x2a')](_0xc8f7('0x73'),_0xc8f7('0x6d'));emit(util['format'](_0xc8f7('0x77'),_0x2b4638['name']),_0xc8f7('0x6e'),{'uri':_0x6d6e60});})[_0xc8f7('0x6f')](function(_0x3fa8a2){logger[_0xc8f7('0x70')](_0xc8f7('0x73'),JSON['stringify'](_0x3fa8a2));});};exports[_0xc8f7('0x78')]=function(_0x43d585,_0x1412f0,_0x149b0c,_0x23ddf1,_0x5d1339,_0x86c735){var _0x384968,_0x37de94,_0x799f29,_0x24666c;_0x86c735[_0xc8f7('0x57')]=intUtil[_0xc8f7('0x56')](_0x86c735[_0xc8f7('0x57')]);_0x86c735[_0xc8f7('0x58')]=intUtil[_0xc8f7('0x56')](_0x86c735[_0xc8f7('0x58')]);def['uri']=util[_0xc8f7('0x25')](_0xc8f7('0x5a'),_0x86c735[_0xc8f7('0x57')]);if(_0x5d1339&&_0x5d1339['monitor_format']){logger['info']('['+_0x1412f0[_0xc8f7('0x79')][_0xc8f7('0x7a')]()+']','Recording\x20is\x20enabled!');_0x1412f0[_0xc8f7('0x5e')]=util[_0xc8f7('0x25')](_0xc8f7('0x5f'),_0x86c735['serverUrl'],_0x1412f0[_0xc8f7('0x60')],md5(_0x1412f0[_0xc8f7('0x60')]));}else{_0x1412f0[_0xc8f7('0x5e')]='';}return getConnection(_0x86c735)[_0xc8f7('0x2e')](function(_0x269568){_0x24666c=_0x269568;if(!_[_0xc8f7('0x29')](_0x23ddf1)){return getUser(_0x86c735,_0x23ddf1[_0xc8f7('0xf')],_0x24666c);}else{return getUser(_0x86c735,null,_0x24666c);}})['then'](function(_0x1283d4){_0x384968=_0x1283d4;logger[_0xc8f7('0x2a')](_0xc8f7('0x61'),_0x384968['id']);return getEndUser(_0x86c735,_0x1412f0[_0xc8f7('0x62')],_0x1412f0[_0xc8f7('0x7b')],_0x24666c);})['then'](function(_0x31981e){_0x37de94=_0x31981e;logger[_0xc8f7('0x2a')](_0xc8f7('0x63'),_0x37de94['id']);return getTicket(_0x86c735,_0x384968,_0x37de94,_0x149b0c,_0x1412f0,_0x149b0c[_0xc8f7('0x64')],_0x24666c,_0xc8f7('0x65'));})[_0xc8f7('0x2e')](function(_0x59dda2){_0x799f29=_0x59dda2;logger[_0xc8f7('0x2a')](_0xc8f7('0x66'));logger['info'](_0xc8f7('0x67'),_0x799f29['id']);return setRelationship(_0x24666c,_0x384968,_0x799f29,'users');})[_0xc8f7('0x2e')](function(){return setRelationship(_0x24666c,_0x37de94,_0x799f29,_0xc8f7('0x69'));})[_0xc8f7('0x2e')](function(){return getServerInfo(_0x24666c);})[_0xc8f7('0x6f')](function(_0x182ab1){logger[_0xc8f7('0x70')]('['+_0x1412f0[_0xc8f7('0x79')][_0xc8f7('0x7a')]()+']',JSON['stringify'](_0x182ab1));});}; \ No newline at end of file +var _0x95af=['stripTrailingSlash','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','contacts','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','duration_hours','parent_id','Contacts','parent_name','length','variableName','push','set_entry','JSON','stringify','Basic\x20%s','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','idField','custom_fields','variable','toString','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x95af,0x89));var _0xf95a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x95af[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf95a('0x0'));var rp=require(_0xf95a('0x1'));var BPromise=require('bluebird');var md5=require(_0xf95a('0x2'));var util=require('util');var Redis=require(_0xf95a('0x3'));var intUtil=require(_0xf95a('0x4'));var config=require(_0xf95a('0x5'));var logger=require(_0xf95a('0x6'))(_0xf95a('0x7'));config['redis']=_[_0xf95a('0x8')](config[_0xf95a('0x9')],{'host':_0xf95a('0xa'),'port':0x18eb});var io=require(_0xf95a('0xb'))(new Redis(config['redis']));var def={'method':_0xf95a('0xc'),'json':!![]};function emit(_0x1d5f71,_0x38cf94,_0x46f834){io['to'](_0x1d5f71)[_0xf95a('0xd')](_0x38cf94,_0x46f834);}function getTicket(_0x50e370,_0x1cf9b6,_0x5af72a,_0x5c6cb2,_0x37d119,_0x5bc69e,_0x150a16,_0x5b7e3b){logger[_0xf95a('0xe')](_0xf95a('0xf'));var _0x59c5d8=new Date();var _0x46f0b9=[{'name':_0xf95a('0x10'),'value':intUtil[_0xf95a('0x11')](_0x5c6cb2[_0xf95a('0x12')],_0x37d119,'\x20')},{'name':_0xf95a('0x13'),'value':_0x1cf9b6['id']},{'name':_0xf95a('0x14'),'value':_0x1cf9b6['id']},{'name':_0xf95a('0x15'),'value':intUtil[_0xf95a('0x11')](_0x5c6cb2[_0xf95a('0x16')],_0x37d119,'\x0a')},{'name':_0xf95a('0x17'),'value':_0x59c5d8[_0xf95a('0x18')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xf95a('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf95a('0x1a'),'value':_0x5af72a['id']},{'name':'parent_type','value':_0xf95a('0x1b')},{'name':_0xf95a('0x1c'),'value':_0x5af72a['name']},{'name':'direction','value':_0x5b7e3b}];if(_0x5bc69e[_0xf95a('0x1d')]){_['forEach'](_0x5bc69e,function(_0x5b505f){if(_0x37d119[_0x5b505f[_0xf95a('0x1e')]]){_0x46f0b9[_0xf95a('0x1f')]({'name':_0x5b505f['idField'],'value':_0x37d119[_0x5b505f[_0xf95a('0x1e')]]});}});}return request({'form':{'method':_0xf95a('0x20'),'input_type':'JSON','response_type':_0xf95a('0x21'),'rest_data':JSON[_0xf95a('0x22')]({'session':_0x150a16['id'],'module_name':'Calls','name_value_list':_0x46f0b9})}});}function getAuth(_0x26b414){return util['format'](_0xf95a('0x23'),new Buffer(_0x26b414['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x5869b7){return request({'form':{'method':'get_server_info','input_type':_0xf95a('0x21'),'response_type':_0xf95a('0x21'),'rest_data':JSON['stringify']({'session':_0x5869b7['id']})}});}function getUser(_0x49f1bc,_0xeb4631,_0x46e3e1){if(!_[_0xf95a('0x24')](_0xeb4631)){logger['info'](_0xf95a('0x25'),_0xeb4631);return request({'form':{'method':_0xf95a('0x26'),'input_type':_0xf95a('0x21'),'response_type':_0xf95a('0x21'),'rest_data':JSON[_0xf95a('0x22')]({'session':_0x46e3e1['id'],'module_name':'Employees','query':util[_0xf95a('0x27')](_0xf95a('0x28'),_0xeb4631),'order_by':'','offset':'0','select_fields':['id',_0xf95a('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf95a('0x29')](function(_0x144193){if(_0x144193[_0xf95a('0x2a')][_0xf95a('0x1d')]){var _0x56f424=_[_0xf95a('0x2b')](_0x144193[_0xf95a('0x2a')],function(_0x21a57f){return _0x21a57f[_0xf95a('0x2c')][_0xf95a('0x2d')][_0xf95a('0x2e')]===_0xeb4631;});if(_0x56f424){logger[_0xf95a('0xe')](_0xf95a('0x2f'));return BPromise[_0xf95a('0x30')]({'id':_0x56f424[_0xf95a('0x2c')]['id']['value'],'name':_0x56f424[_0xf95a('0x2c')][_0xf95a('0x10')][_0xf95a('0x2e')]});}}logger[_0xf95a('0xe')](_0xf95a('0x31'));return BPromise[_0xf95a('0x30')]({'id':_0x46e3e1['name_value_list']['user_id'][_0xf95a('0x2e')],'name':_0x46e3e1[_0xf95a('0x2c')][_0xf95a('0x2d')][_0xf95a('0x2e')]});});}else{logger['info'](_0xf95a('0x32'));return BPromise['resolve']({'id':_0x46e3e1[_0xf95a('0x2c')][_0xf95a('0x33')]['value'],'name':_0x46e3e1[_0xf95a('0x2c')][_0xf95a('0x2d')][_0xf95a('0x2e')]});}}function getEndUser(_0x2f60df,_0x4c1b96,_0x20d636,_0xe8ac43){logger[_0xf95a('0xe')](_0xf95a('0x34'),_0x20d636);return request({'form':{'method':_0xf95a('0x26'),'input_type':_0xf95a('0x21'),'response_type':_0xf95a('0x21'),'rest_data':JSON[_0xf95a('0x22')]({'session':_0xe8ac43['id'],'module_name':_0xf95a('0x1b'),'query':util[_0xf95a('0x27')](_0xf95a('0x35'),_0x20d636),'order_by':'','offset':'0','select_fields':['id','name',_0xf95a('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf95a('0x29')](function(_0xbff943){if(_0xbff943[_0xf95a('0x2a')][_0xf95a('0x1d')]){var _0x35ba9b=_[_0xf95a('0x2b')](_0xbff943[_0xf95a('0x2a')],function(_0x2f2108){return _0x2f2108['name_value_list'][_0xf95a('0x36')]['value']===_0x20d636;});if(_0x35ba9b){logger['info'](_0xf95a('0x37'));return BPromise['resolve']({'id':_0x35ba9b[_0xf95a('0x2c')]['id']['value'],'name':_0x35ba9b['name_value_list'][_0xf95a('0x10')][_0xf95a('0x2e')],'phone':_0x35ba9b[_0xf95a('0x2c')][_0xf95a('0x36')]['value']});}}else{logger[_0xf95a('0xe')](_0xf95a('0x38'));return request({'form':{'method':_0xf95a('0x20'),'input_type':_0xf95a('0x21'),'response_type':'JSON','rest_data':JSON[_0xf95a('0x22')]({'session':_0xe8ac43['id'],'module_name':_0xf95a('0x1b'),'name_value_list':[{'name':_0xf95a('0x39'),'value':_0x4c1b96!==''?_0x4c1b96:util['format'](_0xf95a('0x3a'),_0x20d636)},{'name':'phone_home','value':_0x20d636}]})}})[_0xf95a('0x29')](function(_0x1bdad3){logger[_0xf95a('0xe')](_0xf95a('0x3b'));return BPromise[_0xf95a('0x30')]({'id':_0x1bdad3['id'],'name':_0x1bdad3['entry_list'][_0xf95a('0x39')][_0xf95a('0x2e')],'phone':_0x1bdad3[_0xf95a('0x2a')][_0xf95a('0x36')][_0xf95a('0x2e')]});});}});}function request(_0x472c67){logger[_0xf95a('0x3c')](_0xf95a('0x3d'),JSON[_0xf95a('0x22')](_0x472c67));return rp(_[_0xf95a('0x3e')](def,_0x472c67));}function getTags(_0x433a8a,_0x5d79e6){var _0x4529bd=[];if(_0x433a8a&&_0x433a8a[_0xf95a('0x1d')]>0x0){_0x4529bd=_[_0xf95a('0x3f')](_0x433a8a,_0x5d79e6);}return _0x4529bd;}function getCustomFields(_0x41b891,_0x58bf67){var _0x5221b6=[];var _0xbf32e7={'custom_fields':[]};if(_0x41b891[_0xf95a('0x1d')]>0x0){_['forEach'](_0x41b891,function(_0xcd4d09){if(_0xcd4d09[_0xf95a('0x40')]===_0xf95a('0x41')&&_0xcd4d09['nameField']&&!_0xcd4d09[_0xf95a('0x42')]){_0xbf32e7[_0xcd4d09[_0xf95a('0x43')][_0xf95a('0x44')]()]=_0xcd4d09[_0xf95a('0x45')]['toString']();}else if(_0xcd4d09[_0xf95a('0x40')]===_0xf95a('0x41')&&_0xcd4d09[_0xf95a('0x46')]&&_0xcd4d09[_0xf95a('0x42')]){_0xbf32e7[_0xf95a('0x47')][_0xf95a('0x1f')]({'id':_0xcd4d09[_0xf95a('0x46')],'value':_0xcd4d09[_0xf95a('0x45')]['toString']()});}else if(_0xcd4d09[_0xf95a('0x40')]===_0xf95a('0x48')&&_0xcd4d09[_0xf95a('0x1e')]&&_0xcd4d09['idField']&&_0xcd4d09[_0xf95a('0x42')]){_0x58bf67[_0xcd4d09[_0xf95a('0x1e')]]&&_0xbf32e7[_0xf95a('0x47')][_0xf95a('0x1f')]({'id':_0xcd4d09[_0xf95a('0x46')],'value':_0x58bf67[_0xcd4d09[_0xf95a('0x1e')]][_0xf95a('0x49')]()});}else if(_0xcd4d09['type']===_0xf95a('0x4a')&&_0xcd4d09[_0xf95a('0x4b')]&&_0xcd4d09[_0xf95a('0x4b')][_0xf95a('0x10')]&&_0xcd4d09[_0xf95a('0x46')]&&_0xcd4d09[_0xf95a('0x42')]){_0x58bf67[_0xcd4d09[_0xf95a('0x4b')][_0xf95a('0x10')][_0xf95a('0x44')]()]&&_0xbf32e7['custom_fields'][_0xf95a('0x1f')]({'id':_0xcd4d09[_0xf95a('0x46')],'value':_0x58bf67[_0xcd4d09[_0xf95a('0x4b')][_0xf95a('0x10')]['toLowerCase']()][_0xf95a('0x49')]()});}});}return _0xbf32e7;}function getConnection(_0x2dfd1a){return request({'method':_0xf95a('0xc'),'form':{'method':_0xf95a('0x4c'),'input_type':_0xf95a('0x21'),'response_type':_0xf95a('0x21'),'rest_data':JSON[_0xf95a('0x22')]({'user_auth':{'user_name':_0x2dfd1a[_0xf95a('0x4d')],'password':_0x2dfd1a['password'],'encryption':_0xf95a('0x4e')},'application':_0xf95a('0x4f')})}})[_0xf95a('0x29')](function(_0x4fede8){var _0x4d30c7=_0x4fede8;if(_0x4d30c7['id']){def[_0xf95a('0x50')]=_0x4d30c7['id'];return BPromise[_0xf95a('0x30')](_0x4d30c7);}else{throw new Error(util[_0xf95a('0x27')](_0xf95a('0x51'),_0x2dfd1a['id']));}});}function setRelationship(_0x2a71bc,_0x1e58f4,_0x149c74,_0x3ee50a){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2a71bc['id'],'module_name':_0xf95a('0x52'),'module_id':_0x149c74['id'],'link_field_name':_0x3ee50a,'related_ids':[_0x1e58f4['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf95a('0x53')]=function(_0x1b56a1,_0x2e1497,_0xc7837d,_0x5a2f64,_0x53d5b0,_0x46b64d){var _0x44b9ef,_0x1d2934,_0x2f39d7,_0x39b4cd;_0x46b64d['remoteUri']=intUtil['stripTrailingSlash'](_0x46b64d['remoteUri']);_0x46b64d[_0xf95a('0x54')]=intUtil['stripTrailingSlash'](_0x46b64d[_0xf95a('0x54')]);def[_0xf95a('0x55')]=util[_0xf95a('0x27')](_0xf95a('0x56'),_0x46b64d[_0xf95a('0x57')]);if(_0x53d5b0&&_0x53d5b0[_0xf95a('0x58')]){logger[_0xf95a('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2e1497['recordingURL']=util[_0xf95a('0x27')](_0xf95a('0x59'),_0x46b64d[_0xf95a('0x54')],_0x2e1497[_0xf95a('0x5a')],md5(_0x2e1497[_0xf95a('0x5a')]));}else{_0x2e1497[_0xf95a('0x5b')]='';}return getConnection(_0x46b64d)[_0xf95a('0x29')](function(_0x14f162){_0x39b4cd=_0x14f162;return getUser(_0x46b64d,_0x5a2f64[_0xf95a('0x10')],_0x39b4cd);})[_0xf95a('0x29')](function(_0x1ac6f8){_0x44b9ef=_0x1ac6f8;logger[_0xf95a('0xe')](_0xf95a('0x5c'),_0x44b9ef['id']);return getEndUser(_0x46b64d,_0x2e1497[_0xf95a('0x5d')],_0x2e1497[_0xf95a('0x5e')],_0x39b4cd);})[_0xf95a('0x29')](function(_0x3a02fb){_0x1d2934=_0x3a02fb;logger[_0xf95a('0xe')](_0xf95a('0x5f'),_0x1d2934['id']);return getTicket(_0x46b64d,_0x44b9ef,_0x1d2934,_0xc7837d,_0x2e1497,_0xc7837d[_0xf95a('0x60')],_0x39b4cd,_0xf95a('0x61'));})[_0xf95a('0x29')](function(_0x2603b8){_0x2f39d7=_0x2603b8;logger[_0xf95a('0xe')]('Ticket\x20created!');logger['info'](_0xf95a('0x62'),_0x2f39d7['id']);return setRelationship(_0x39b4cd,_0x44b9ef,_0x2f39d7,_0xf95a('0x63'));})[_0xf95a('0x29')](function(){return setRelationship(_0x39b4cd,_0x1d2934,_0x2f39d7,'contacts');})[_0xf95a('0x29')](function(){return getServerInfo(_0x39b4cd);})['then'](function(_0x5b720c){var _0x4b1587=parseInt(_0x5b720c[_0xf95a('0x64')][_0xf95a('0x65')](0x0));var _0x496781=util[_0xf95a('0x27')](_0xf95a('0x66'),_0x46b64d[_0xf95a('0x57')],_0x2f39d7['id']);if(_0x4b1587>0x6){_0x496781=util[_0xf95a('0x27')](_0xf95a('0x67'),_0x46b64d[_0xf95a('0x57')],_0x2f39d7['id']);}logger[_0xf95a('0xe')](_0xf95a('0x68'),_0xf95a('0x69'));emit(util['format'](_0xf95a('0x6a'),_0x5a2f64[_0xf95a('0x10')]),_0xf95a('0x6b'),{'uri':_0x496781});})[_0xf95a('0x6c')](function(_0x3acc75){logger[_0xf95a('0x6d')]('[QUEUE]',JSON['stringify'](_0x3acc75));});};exports[_0xf95a('0x6e')]=function(_0x520e8e,_0x30494e,_0x328996,_0x5c9022,_0x406a2d,_0x17f418,_0x97ca41){var _0x3cb721,_0x28983f,_0x2555f8,_0x2a4c8f;_0x17f418[_0xf95a('0x57')]=intUtil[_0xf95a('0x6f')](_0x17f418['remoteUri']);_0x17f418[_0xf95a('0x54')]=intUtil[_0xf95a('0x6f')](_0x17f418['serverUrl']);def[_0xf95a('0x55')]=util[_0xf95a('0x27')]('%s/service/v4_1/rest.php',_0x17f418[_0xf95a('0x57')]);if(_0x97ca41&&_0x97ca41[_0xf95a('0x70')]&&_0x97ca41[_0xf95a('0x70')]!==_0xf95a('0x71')){logger['info']('[OUTBOUND]',_0xf95a('0x72'));_0x30494e[_0xf95a('0x5b')]=util[_0xf95a('0x27')](_0xf95a('0x59'),_0x17f418[_0xf95a('0x54')],_0x30494e[_0xf95a('0x5a')],md5(_0x30494e[_0xf95a('0x5a')]));}return getConnection(_0x17f418)[_0xf95a('0x29')](function(_0x49538d){_0x2a4c8f=_0x49538d;return getUser(_0x17f418,_0x5c9022['name'],_0x2a4c8f);})[_0xf95a('0x29')](function(_0x35be4f){_0x3cb721=_0x35be4f;logger[_0xf95a('0xe')](_0xf95a('0x5c'),_0x3cb721['id']);return getEndUser(_0x17f418,_0x30494e[_0xf95a('0x73')],_0x30494e[_0xf95a('0x74')],_0x2a4c8f);})['then'](function(_0x218c0b){_0x28983f=_0x218c0b;logger[_0xf95a('0xe')](_0xf95a('0x5f'),_0x28983f['id']);return getTicket(_0x17f418,_0x3cb721,_0x28983f,_0x328996,_0x30494e,_0x328996[_0xf95a('0x60')],_0x2a4c8f,_0xf95a('0x75'));})[_0xf95a('0x29')](function(_0x4cef88){_0x2555f8=_0x4cef88;logger[_0xf95a('0xe')](_0xf95a('0x76'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2555f8['id']);return setRelationship(_0x2a4c8f,_0x3cb721,_0x2555f8,_0xf95a('0x63'));})[_0xf95a('0x29')](function(){return setRelationship(_0x2a4c8f,_0x28983f,_0x2555f8,_0xf95a('0x77'));})[_0xf95a('0x29')](function(){return getServerInfo(_0x2a4c8f);})['then'](function(_0x38f504){var _0x43210c=parseInt(_0x38f504[_0xf95a('0x64')][_0xf95a('0x65')](0x0));var _0x469d94=util[_0xf95a('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x17f418[_0xf95a('0x57')],_0x2555f8['id']);if(_0x43210c>0x6){_0x469d94=util['format'](_0xf95a('0x67'),_0x17f418['remoteUri'],_0x2555f8['id']);}logger[_0xf95a('0xe')](_0xf95a('0x78'),_0xf95a('0x69'));emit(util[_0xf95a('0x27')](_0xf95a('0x6a'),_0x5c9022[_0xf95a('0x10')]),_0xf95a('0x6b'),{'uri':_0x469d94});})['catch'](function(_0x4d9bde){logger[_0xf95a('0x6d')]('[OUTBOUND]',JSON['stringify'](_0x4d9bde));});};exports[_0xf95a('0x79')]=function(_0x5d415d,_0x67b6a1,_0x435345,_0x4459b5,_0x3d2542,_0x32acc6){var _0x195b5e,_0x1d138f,_0x3c8967,_0x2e1410;_0x32acc6['remoteUri']=intUtil['stripTrailingSlash'](_0x32acc6[_0xf95a('0x57')]);_0x32acc6[_0xf95a('0x54')]=intUtil[_0xf95a('0x6f')](_0x32acc6[_0xf95a('0x54')]);def[_0xf95a('0x55')]=util['format'](_0xf95a('0x56'),_0x32acc6[_0xf95a('0x57')]);if(_0x3d2542&&_0x3d2542[_0xf95a('0x58')]){logger[_0xf95a('0xe')]('['+_0x67b6a1[_0xf95a('0x7a')][_0xf95a('0x7b')]()+']','Recording\x20is\x20enabled!');_0x67b6a1[_0xf95a('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32acc6[_0xf95a('0x54')],_0x67b6a1[_0xf95a('0x5a')],md5(_0x67b6a1[_0xf95a('0x5a')]));}else{_0x67b6a1[_0xf95a('0x5b')]='';}return getConnection(_0x32acc6)[_0xf95a('0x29')](function(_0x7b8125){_0x2e1410=_0x7b8125;if(!_[_0xf95a('0x24')](_0x4459b5)){return getUser(_0x32acc6,_0x4459b5[_0xf95a('0x10')],_0x2e1410);}else{return getUser(_0x32acc6,null,_0x2e1410);}})['then'](function(_0x565ac5){_0x195b5e=_0x565ac5;logger[_0xf95a('0xe')](_0xf95a('0x5c'),_0x195b5e['id']);return getEndUser(_0x32acc6,_0x67b6a1['calleridname'],_0x67b6a1[_0xf95a('0x5e')],_0x2e1410);})[_0xf95a('0x29')](function(_0x4835d6){_0x1d138f=_0x4835d6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1d138f['id']);return getTicket(_0x32acc6,_0x195b5e,_0x1d138f,_0x435345,_0x67b6a1,_0x435345[_0xf95a('0x60')],_0x2e1410,'Inbound');})['then'](function(_0x346fac){_0x3c8967=_0x346fac;logger[_0xf95a('0xe')]('Ticket\x20created!');logger[_0xf95a('0xe')](_0xf95a('0x62'),_0x3c8967['id']);return setRelationship(_0x2e1410,_0x195b5e,_0x3c8967,_0xf95a('0x63'));})[_0xf95a('0x29')](function(){return setRelationship(_0x2e1410,_0x1d138f,_0x3c8967,_0xf95a('0x77'));})[_0xf95a('0x29')](function(){return getServerInfo(_0x2e1410);})[_0xf95a('0x6c')](function(_0x3c0eea){logger[_0xf95a('0x6d')]('['+_0x67b6a1['lastevent'][_0xf95a('0x7b')]()+']',JSON[_0xf95a('0x22')](_0x3c0eea));});}; \ 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 4b0a6ae..d969ea4 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 _0x7eb4=['push','variable','variableName','toString','Variable','name','toLowerCase','keyType','string','key','format','%s:\x20%s','customVariable','join','slice','substring','lastIndexOf','test','lodash','util','getString','length','sortBy','type'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7eb4,0x11a));var _0x47eb=function(_0x12287a,_0x22f00c){_0x12287a=_0x12287a-0x0;var _0x2141a0=_0x7eb4[_0x12287a];return _0x2141a0;};'use strict';var _=require(_0x47eb('0x0'));var util=require(_0x47eb('0x1'));exports[_0x47eb('0x2')]=function(_0x46222f,_0x4052ec,_0x169354){var _0x137677=[];if(_0x46222f[_0x47eb('0x3')]>0x0){var _0x27156e=_[_0x47eb('0x4')](_0x46222f,['id']);for(var _0x420b04=0x0;_0x420b04<_0x27156e[_0x47eb('0x3')];_0x420b04++){var _0x3342fe=_0x27156e[_0x420b04];if(_0x3342fe[_0x47eb('0x5')]==='string'){_0x137677[_0x47eb('0x6')](_0x3342fe['content']);}else if(_0x3342fe[_0x47eb('0x5')]===_0x47eb('0x7')&&_0x3342fe[_0x47eb('0x8')]){_0x4052ec[_0x3342fe['variableName']]&&_0x137677[_0x47eb('0x6')](_0x4052ec[_0x3342fe[_0x47eb('0x8')]][_0x47eb('0x9')]());}else if(_0x3342fe[_0x47eb('0x5')]==='customVariable'&&_0x3342fe[_0x47eb('0xa')]&&_0x3342fe[_0x47eb('0xa')]['name']){_0x4052ec[_0x3342fe['Variable'][_0x47eb('0xb')][_0x47eb('0xc')]()]&&_0x137677[_0x47eb('0x6')](_0x4052ec[_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')][_0x47eb('0xc')]()][_0x47eb('0x9')]());}else if(_0x3342fe[_0x47eb('0x5')]==='keyValue'){if(_0x3342fe[_0x47eb('0xd')]===_0x47eb('0xe')&&_0x3342fe[_0x47eb('0xf')]){_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe[_0x47eb('0xf')],_0x3342fe['keyContent']));}else if(_0x3342fe[_0x47eb('0xd')]===_0x47eb('0x7')&&_0x3342fe[_0x47eb('0x8')]&&_0x3342fe[_0x47eb('0xf')]){_0x4052ec[_0x3342fe[_0x47eb('0x8')]]&&_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe[_0x47eb('0xf')],_0x4052ec[_0x3342fe[_0x47eb('0x8')]]));}else if(_0x3342fe['keyType']===_0x47eb('0x12')&&_0x3342fe[_0x47eb('0xa')]&&_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')]&&_0x3342fe[_0x47eb('0xf')]){_0x4052ec[_0x3342fe[_0x47eb('0xa')][_0x47eb('0xb')][_0x47eb('0xc')]()]&&_0x137677[_0x47eb('0x6')](util[_0x47eb('0x10')](_0x47eb('0x11'),_0x3342fe['key'],_0x4052ec[_0x3342fe[_0x47eb('0xa')]['name']['toLowerCase']()]));}}}}return _0x137677[_0x47eb('0x13')](_0x169354);};exports['stripTrailingSlash']=function(_0x954b3b){var _0x1c533a=_0x954b3b[_0x47eb('0x14')](-0x1);if(_0x1c533a==='/'){_0x954b3b=_0x954b3b[_0x47eb('0x15')](0x0,_0x954b3b[_0x47eb('0x16')](_0x1c533a));}return _0x954b3b;};exports['validateEmail']=function(_0x1bdf5b){if(!_['isNil'](_0x1bdf5b)&&_0x1bdf5b!==''){var _0x5701cc=/^(([^<>()\[\]\\.,;:\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 _0x5701cc[_0x47eb('0x17')](String(_0x1bdf5b)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4477=['util','getString','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4477,0x8b));var _0x7447=function(_0x13e28b,_0x5ee4de){_0x13e28b=_0x13e28b-0x0;var _0x302b7b=_0x4477[_0x13e28b];return _0x302b7b;};'use strict';var _=require(_0x7447('0x0'));var util=require(_0x7447('0x1'));exports[_0x7447('0x2')]=function(_0x2df11a,_0xc14997,_0x12d0c7){var _0x113682=[];if(_0x2df11a[_0x7447('0x3')]>0x0){var _0x7790bc=_['sortBy'](_0x2df11a,['id']);for(var _0x5860b3=0x0;_0x5860b3<_0x7790bc[_0x7447('0x3')];_0x5860b3++){var _0x586efa=_0x7790bc[_0x5860b3];if(_0x586efa[_0x7447('0x4')]===_0x7447('0x5')){_0x113682[_0x7447('0x6')](_0x586efa[_0x7447('0x7')]);}else if(_0x586efa['type']==='variable'&&_0x586efa['variableName']){_0xc14997[_0x586efa[_0x7447('0x8')]]&&_0x113682[_0x7447('0x6')](_0xc14997[_0x586efa['variableName']][_0x7447('0x9')]());}else if(_0x586efa[_0x7447('0x4')]===_0x7447('0xa')&&_0x586efa['Variable']&&_0x586efa[_0x7447('0xb')]['name']){_0xc14997[_0x586efa[_0x7447('0xb')][_0x7447('0xc')][_0x7447('0xd')]()]&&_0x113682[_0x7447('0x6')](_0xc14997[_0x586efa[_0x7447('0xb')][_0x7447('0xc')]['toLowerCase']()][_0x7447('0x9')]());}else if(_0x586efa[_0x7447('0x4')]==='keyValue'){if(_0x586efa[_0x7447('0xe')]==='string'&&_0x586efa[_0x7447('0xf')]){_0x113682[_0x7447('0x6')](util[_0x7447('0x10')](_0x7447('0x11'),_0x586efa['key'],_0x586efa[_0x7447('0x12')]));}else if(_0x586efa[_0x7447('0xe')]===_0x7447('0x13')&&_0x586efa[_0x7447('0x8')]&&_0x586efa['key']){_0xc14997[_0x586efa[_0x7447('0x8')]]&&_0x113682['push'](util[_0x7447('0x10')](_0x7447('0x11'),_0x586efa[_0x7447('0xf')],_0xc14997[_0x586efa['variableName']]));}else if(_0x586efa[_0x7447('0xe')]===_0x7447('0xa')&&_0x586efa[_0x7447('0xb')]&&_0x586efa[_0x7447('0xb')][_0x7447('0xc')]&&_0x586efa[_0x7447('0xf')]){_0xc14997[_0x586efa[_0x7447('0xb')][_0x7447('0xc')][_0x7447('0xd')]()]&&_0x113682[_0x7447('0x6')](util[_0x7447('0x10')](_0x7447('0x11'),_0x586efa['key'],_0xc14997[_0x586efa[_0x7447('0xb')][_0x7447('0xc')][_0x7447('0xd')]()]));}}}}return _0x113682[_0x7447('0x14')](_0x12d0c7);};exports[_0x7447('0x15')]=function(_0x4c8cca){var _0x16152c=_0x4c8cca[_0x7447('0x16')](-0x1);if(_0x16152c==='/'){_0x4c8cca=_0x4c8cca[_0x7447('0x17')](0x0,_0x4c8cca[_0x7447('0x18')](_0x16152c));}return _0x4c8cca;};exports[_0x7447('0x19')]=function(_0xa5a831){if(!_[_0x7447('0x1a')](_0xa5a831)&&_0xa5a831!==''){var _0x2ff837=/^(([^<>()\[\]\\.,;:\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 _0x2ff837[_0x7447('0x1b')](String(_0xa5a831)[_0x7447('0xd')]());}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 a8f4d11..5152a47 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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_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 b9846c8..45a61cb 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 _0x1980=['first','Enduser\x20found!','%s/users.json','end-user','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','user:%s','error','unmanaged','lastevent','toUpperCase','Authorization','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter'];(function(_0x17b493,_0x5c7fbf){var _0x2fcbf2=function(_0x2e95b5){while(--_0x2e95b5){_0x17b493['push'](_0x17b493['shift']());}};_0x2fcbf2(++_0x5c7fbf);}(_0x1980,0x138));var _0x0198=function(_0x6b9865,_0x13202f){_0x6b9865=_0x6b9865-0x0;var _0x4c2935=_0x1980[_0x6b9865];return _0x4c2935;};'use strict';var _=require(_0x0198('0x0'));var rp=require(_0x0198('0x1'));var md5=require(_0x0198('0x2'));var util=require(_0x0198('0x3'));var Redis=require(_0x0198('0x4'));var intUtil=require(_0x0198('0x5'));var config=require(_0x0198('0x6'));var logger=require(_0x0198('0x7'))(_0x0198('0x8'));config['redis']=_[_0x0198('0x9')](config[_0x0198('0xa')],{'host':_0x0198('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0198('0xa')]));function emit(_0x46d8af,_0x71843a,_0x8b31c4){io['to'](_0x46d8af)[_0x0198('0xc')](_0x71843a,_0x8b31c4);}var headers={'Content-Type':_0x0198('0xd'),'Accept':'application/json'};function getTicket(_0x1bf874,_0x3b3e5e,_0x674967,_0x339492,_0x23e969){logger['info'](_0x0198('0xe'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x10'),_0x1bf874[_0x0198('0x11')]),'method':_0x0198('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x674967['id'],'submitter_id':_0x3b3e5e?_0x3b3e5e['id']:undefined,'assignee_id':_0x3b3e5e?_0x3b3e5e['id']:undefined,'tags':getTags(_0x339492[_0x0198('0x13')],'name'),'subject':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x15')],_0x23e969,'\x20'),'description':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x16')],_0x23e969,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0198('0x14')](_0x339492[_0x0198('0x16')],_0x23e969,'\x0a')}},getCustomFields(_0x339492[_0x0198('0x17')],_0x23e969))}})[_0x0198('0x18')](function(_0x2136c5){logger[_0x0198('0x19')](_0x0198('0x1a'));return _0x2136c5[_0x0198('0x1b')];});}function getUser(_0x2e10b9,_0x2b6514){if(intUtil[_0x0198('0x1c')](_0x2b6514)){logger['info'](_0x0198('0x1d'),_0x2b6514);return request({'uri':util[_0x0198('0xf')]('%s/search.json',_0x2e10b9[_0x0198('0x11')]),'qs':{'query':util[_0x0198('0xf')](_0x0198('0x1e'),_0x2b6514)}})[_0x0198('0x18')](function(_0x47510d){if(_0x47510d[_0x0198('0x1f')]){logger['info'](_0x0198('0x20'));return _[_0x0198('0x21')](_0x47510d[_0x0198('0x22')],{'email':_0x2b6514,'role':_0x0198('0x23')});}else{logger[_0x0198('0x19')](_0x0198('0x24'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x25'),_0x2e10b9[_0x0198('0x11')])})['then'](function(_0x324727){logger['info'](_0x0198('0x26'));return _0x324727[_0x0198('0x27')];});}});}else{logger[_0x0198('0x19')](_0x0198('0x24'));return request({'uri':util['format'](_0x0198('0x25'),_0x2e10b9[_0x0198('0x11')])})['then'](function(_0x4889b4){logger[_0x0198('0x19')](_0x0198('0x26'));return _0x4889b4[_0x0198('0x27')];});}}function getEndUser(_0x3b6e05,_0x91aaf1,_0xb76ceb){logger[_0x0198('0x19')](_0x0198('0x28'),_0xb76ceb);return request({'uri':util['format'](_0x0198('0x29'),_0x3b6e05[_0x0198('0x11')]),'qs':{'query':util['format'](_0x0198('0x2a'),_0xb76ceb)}})['then'](function(_0x100061){var _0xf936b7;if(_0x100061[_0x0198('0x22')][_0x0198('0x2b')]){_0x100061['results']=_[_0x0198('0x2c')](_0x100061[_0x0198('0x22')],{'suspended':![],'role':'end-user'});if(_0x100061[_0x0198('0x22')][_0x0198('0x2b')]){_0xf936b7=_[_0x0198('0x2d')](_0x100061[_0x0198('0x22')]);}}if(_0xf936b7){logger[_0x0198('0x19')](_0x0198('0x2e'));return _0xf936b7;}else{logger[_0x0198('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x0198('0xf')](_0x0198('0x2f'),_0x3b6e05[_0x0198('0x11')]),'method':_0x0198('0x12'),'body':{'user':{'role':_0x0198('0x30'),'name':util[_0x0198('0xf')]('Caller\x20-\x20%s',_0x91aaf1||_0xb76ceb),'phone':_0xb76ceb}}})['then'](function(_0x10fa2f){logger[_0x0198('0x19')]('Enduser\x20created.');return _0x10fa2f['user'];});}});}function getAuth(_0x21b6b3){var _0x2770cf;if(_0x21b6b3[_0x0198('0x31')]===_0x0198('0x32')){_0x2770cf=util[_0x0198('0xf')]('%s:%s',_0x21b6b3['username'],_0x21b6b3[_0x0198('0x32')]);}else if(_0x21b6b3[_0x0198('0x31')]===_0x0198('0x33')){_0x2770cf=util['format'](_0x0198('0x34'),_0x21b6b3[_0x0198('0x35')],_0x21b6b3[_0x0198('0x33')]);}return util[_0x0198('0xf')](_0x0198('0x36'),new Buffer(_0x2770cf)[_0x0198('0x37')](_0x0198('0x38')));}function request(_0x2fdd12){logger[_0x0198('0x39')](_0x0198('0x3a'),JSON[_0x0198('0x3b')](_0x2fdd12));return rp(_[_0x0198('0x9')](_0x2fdd12,{'method':_0x0198('0x3c'),'headers':headers,'json':!![]}));}function getTags(_0x1870ae,_0x16e737){var _0x6cdbc=[];if(_0x1870ae&&_0x1870ae['length']>0x0){_0x6cdbc=_[_0x0198('0x3d')](_0x1870ae,_0x16e737);}return _0x6cdbc;}function getCustomFields(_0xb1ae3e,_0x4b1dd5){var _0x1a0d9f=[];var _0xc00df5={'custom_fields':[]};if(_0xb1ae3e[_0x0198('0x2b')]>0x0){_[_0x0198('0x3e')](_0xb1ae3e,function(_0x3f1992){if(_[_0x0198('0x3f')]([_0x0198('0x40'),_0x0198('0x41')],_0x3f1992[_0x0198('0x42')])&&_0x3f1992['nameField']&&!_0x3f1992[_0x0198('0x43')]){_0xc00df5[_0x3f1992[_0x0198('0x44')][_0x0198('0x45')]()]=_0x3f1992['content'][_0x0198('0x37')]();}else if(_[_0x0198('0x3f')](['string','picklist'],_0x3f1992['type'])&&_0x3f1992[_0x0198('0x46')]&&_0x3f1992[_0x0198('0x43')]){_0xc00df5[_0x0198('0x47')][_0x0198('0x48')]({'id':_0x3f1992[_0x0198('0x46')],'value':_0x3f1992[_0x0198('0x49')][_0x0198('0x37')]()});}else if(_0x3f1992[_0x0198('0x42')]===_0x0198('0x4a')&&_0x3f1992[_0x0198('0x4b')]&&_0x3f1992[_0x0198('0x46')]&&_0x3f1992[_0x0198('0x43')]){_0x4b1dd5[_0x3f1992['variableName']]&&_0xc00df5[_0x0198('0x47')]['push']({'id':_0x3f1992[_0x0198('0x46')],'value':_0x4b1dd5[_0x3f1992[_0x0198('0x4b')]][_0x0198('0x37')]()});}else if(_0x3f1992[_0x0198('0x42')]===_0x0198('0x4c')&&_0x3f1992[_0x0198('0x4d')]&&_0x3f1992[_0x0198('0x4d')][_0x0198('0x4e')]&&_0x3f1992['idField']&&_0x3f1992['customField']){_0x4b1dd5[_0x3f1992['Variable'][_0x0198('0x4e')][_0x0198('0x45')]()]&&_0xc00df5[_0x0198('0x47')][_0x0198('0x48')]({'id':_0x3f1992[_0x0198('0x46')],'value':_0x4b1dd5[_0x3f1992[_0x0198('0x4d')][_0x0198('0x4e')][_0x0198('0x45')]()][_0x0198('0x37')]()});}});}return _0xc00df5;}exports[_0x0198('0x4f')]=function(_0x253485,_0x40d5da,_0x37426b,_0x3892c9,_0x555936,_0x3356ce){var _0x5f2843,_0x3c43ab;_0x3356ce['remoteUri']=intUtil[_0x0198('0x50')](_0x3356ce[_0x0198('0x11')]);_0x3356ce[_0x0198('0x51')]=intUtil[_0x0198('0x50')](_0x3356ce[_0x0198('0x51')]);if(_0x555936&&_0x555936[_0x0198('0x52')]){logger['info'](_0x0198('0x53'),_0x0198('0x54'));_0x40d5da['recordingURL']=util[_0x0198('0xf')](_0x0198('0x55'),_0x3356ce[_0x0198('0x51')],_0x40d5da[_0x0198('0x56')],md5(_0x40d5da[_0x0198('0x56')]));}else{_0x40d5da['recordingURL']='';}headers['Authorization']=getAuth(_0x3356ce);return getUser(_0x3356ce,_0x3892c9[_0x0198('0x57')])[_0x0198('0x18')](function(_0x37643a){_0x5f2843=_0x37643a;logger[_0x0198('0x19')](_0x0198('0x58'),_0x5f2843['id']);return getEndUser(_0x3356ce,_0x40d5da[_0x0198('0x59')],_0x40d5da[_0x0198('0x5a')]);})['then'](function(_0x5c500c){_0x3c43ab=_0x5c500c;logger[_0x0198('0x19')](_0x0198('0x5b'),_0x3c43ab['id']);return getTicket(_0x3356ce,_0x5f2843,_0x3c43ab,_0x37426b,_0x40d5da);})[_0x0198('0x18')](function(_0x3285ba){if(_0x3285ba){logger['info'](_0x0198('0x5c'),_0x3285ba['id']);switch(_0x3356ce[_0x0198('0x42')]){case _0x0198('0x5d'):logger[_0x0198('0x19')](_0x0198('0x53'),_0x0198('0x5e'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x5f'),_0x3356ce[_0x0198('0x11')],_0x5f2843['id'],_0x3285ba['id']),'method':_0x0198('0x12')});case _0x0198('0x60'):logger['info'](_0x0198('0x53'),_0x0198('0x61'));emit(util[_0x0198('0xf')]('user:%s',_0x3892c9['name']),_0x0198('0x62'),{'uri':util[_0x0198('0xf')](_0x0198('0x63'),_0x3356ce[_0x0198('0x11')][_0x0198('0x64')](_0x0198('0x65'),''),_0x3285ba['id'])});break;default:logger['error'](_0x0198('0x53'),_0x0198('0x66'));}}})[_0x0198('0x67')](function(_0x10a837){logger['error'](_0x0198('0x68'),util[_0x0198('0x69')](_0x10a837,{'showHidden':!![],'depth':null}));});};exports[_0x0198('0x6a')]=function(_0x4429dc,_0x3f27eb,_0x5f3cc5,_0x57a52a,_0x13e699,_0x1afbdf,_0x5e83fb){var _0x4a5788,_0x2eb19b;_0x1afbdf[_0x0198('0x11')]=intUtil[_0x0198('0x50')](_0x1afbdf[_0x0198('0x11')]);_0x1afbdf['serverUrl']=intUtil['stripTrailingSlash'](_0x1afbdf[_0x0198('0x51')]);if(_0x5e83fb&&_0x5e83fb[_0x0198('0x6b')]&&_0x5e83fb[_0x0198('0x6b')]!==_0x0198('0x6c')){logger[_0x0198('0x19')](_0x0198('0x6d'),_0x0198('0x54'));_0x3f27eb[_0x0198('0x6e')]=util[_0x0198('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1afbdf['serverUrl'],_0x3f27eb['uniqueid'],md5(_0x3f27eb['uniqueid']));}headers['Authorization']=getAuth(_0x1afbdf);return getUser(_0x1afbdf,_0x57a52a[_0x0198('0x57')])['then'](function(_0x51e913){_0x4a5788=_0x51e913;logger[_0x0198('0x19')](_0x0198('0x58'),_0x4a5788['id']);return getEndUser(_0x1afbdf,_0x3f27eb[_0x0198('0x6f')],_0x3f27eb['destcalleridnum']);})['then'](function(_0x367ce1){_0x2eb19b=_0x367ce1;logger[_0x0198('0x19')]('The\x20Enduser\x20ID\x20is:',_0x2eb19b['id']);return getTicket(_0x1afbdf,_0x4a5788,_0x2eb19b,_0x5f3cc5,_0x3f27eb);})['then'](function(_0x431c90){if(_0x431c90){logger[_0x0198('0x19')]('The\x20Ticket\x20ID\x20is:',_0x431c90['id']);switch(_0x1afbdf[_0x0198('0x42')]){case _0x0198('0x5d'):logger[_0x0198('0x19')](_0x0198('0x6d'),_0x0198('0x5e'));return request({'uri':util[_0x0198('0xf')](_0x0198('0x5f'),_0x1afbdf[_0x0198('0x11')],_0x4a5788['id'],_0x431c90['id']),'method':_0x0198('0x12')});case'newTab':logger[_0x0198('0x19')]('[OUTBOUND]',_0x0198('0x61'));emit(util['format'](_0x0198('0x70'),_0x57a52a[_0x0198('0x4e')]),'trigger:browser:url',{'uri':util['format'](_0x0198('0x63'),_0x1afbdf[_0x0198('0x11')][_0x0198('0x64')]('/api/v2',''),_0x431c90['id'])});break;default:logger[_0x0198('0x71')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0198('0x67')](function(_0x976ee4){logger[_0x0198('0x71')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x0198('0x69')](_0x976ee4,{'showHidden':!![],'depth':null}));});};exports[_0x0198('0x72')]=function(_0x2ad219,_0x39c732,_0x46d142,_0x13e2ae,_0x5f4728,_0x3a8911){var _0x229b00,_0x52c33a;_0x3a8911['remoteUri']=intUtil[_0x0198('0x50')](_0x3a8911[_0x0198('0x11')]);_0x3a8911[_0x0198('0x51')]=intUtil[_0x0198('0x50')](_0x3a8911[_0x0198('0x51')]);if(_0x5f4728&&_0x5f4728[_0x0198('0x52')]){logger[_0x0198('0x19')]('['+_0x39c732[_0x0198('0x73')][_0x0198('0x74')]()+']',_0x0198('0x54'));_0x39c732['recordingURL']=util[_0x0198('0xf')](_0x0198('0x55'),_0x3a8911[_0x0198('0x51')],_0x39c732[_0x0198('0x56')],md5(_0x39c732[_0x0198('0x56')]));}else{_0x39c732[_0x0198('0x6e')]='';}headers[_0x0198('0x75')]=getAuth(_0x3a8911);return getUser(_0x3a8911)[_0x0198('0x18')](function(_0x592c7f){_0x229b00=_0x592c7f;logger[_0x0198('0x19')](_0x0198('0x58'),_0x229b00['id']);return getEndUser(_0x3a8911,_0x39c732[_0x0198('0x59')],_0x39c732[_0x0198('0x5a')]);})[_0x0198('0x18')](function(_0x2c9b28){_0x52c33a=_0x2c9b28;logger[_0x0198('0x19')](_0x0198('0x5b'),_0x52c33a['id']);return getTicket(_0x3a8911,_0x229b00,_0x52c33a,_0x46d142,_0x39c732);})[_0x0198('0x18')](function(_0x268ed8){if(_0x268ed8){logger[_0x0198('0x19')](_0x0198('0x5c'),_0x268ed8['id']);}})['catch'](function(_0x47acaa){logger['error']('['+_0x39c732[_0x0198('0x73')][_0x0198('0x74')]()+']'+_0x0198('0x76'),util['inspect'](_0x47acaa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0391=['Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','base64','debug','[HTTP]','stringify','map','picklist','nameField','toLowerCase','toString','includes','string','type','idField','customField','variable','variableName','push','Variable','custom_fields','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0391,0x11e));var _0x1039=function(_0x15246c,_0x520c2f){_0x15246c=_0x15246c-0x0;var _0x632639=_0x0391[_0x15246c];return _0x632639;};'use strict';var _=require('lodash');var rp=require(_0x1039('0x0'));var md5=require(_0x1039('0x1'));var util=require(_0x1039('0x2'));var Redis=require(_0x1039('0x3'));var intUtil=require('./util');var config=require(_0x1039('0x4'));var logger=require(_0x1039('0x5'))('zendesk');config[_0x1039('0x6')]=_[_0x1039('0x7')](config[_0x1039('0x6')],{'host':_0x1039('0x8'),'port':0x18eb});var io=require(_0x1039('0x9'))(new Redis(config[_0x1039('0x6')]));function emit(_0x2dc75f,_0x69c9a1,_0x120860){io['to'](_0x2dc75f)[_0x1039('0xa')](_0x69c9a1,_0x120860);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x3ed90b,_0x1b9e7a,_0x5d35a6,_0x5e9c49,_0x33c433){logger[_0x1039('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x1039('0xc')](_0x1039('0xd'),_0x3ed90b[_0x1039('0xe')]),'method':_0x1039('0xf'),'body':{'ticket':_[_0x1039('0x10')]({'requester_id':_0x5d35a6['id'],'submitter_id':_0x1b9e7a?_0x1b9e7a['id']:undefined,'assignee_id':_0x1b9e7a?_0x1b9e7a['id']:undefined,'tags':getTags(_0x5e9c49[_0x1039('0x11')],_0x1039('0x12')),'subject':intUtil[_0x1039('0x13')](_0x5e9c49['Subjects'],_0x33c433,'\x20'),'description':intUtil[_0x1039('0x13')](_0x5e9c49[_0x1039('0x14')],_0x33c433,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1039('0x13')](_0x5e9c49[_0x1039('0x14')],_0x33c433,'\x0a')}},getCustomFields(_0x5e9c49['Fields'],_0x33c433))}})[_0x1039('0x15')](function(_0x430c1d){logger['info'](_0x1039('0x16'));return _0x430c1d[_0x1039('0x17')];});}function getUser(_0x5ea263,_0x6613a5){if(intUtil[_0x1039('0x18')](_0x6613a5)){logger[_0x1039('0xb')](_0x1039('0x19'),_0x6613a5);return request({'uri':util[_0x1039('0xc')](_0x1039('0x1a'),_0x5ea263[_0x1039('0xe')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x6613a5)}})[_0x1039('0x15')](function(_0x501f4e){if(_0x501f4e[_0x1039('0x1b')]){logger[_0x1039('0xb')]('Agent\x20found!');return _[_0x1039('0x1c')](_0x501f4e[_0x1039('0x1d')],{'email':_0x6613a5,'role':_0x1039('0x1e')});}else{logger[_0x1039('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1039('0xc')]('%s/users/me.json',_0x5ea263[_0x1039('0xe')])})[_0x1039('0x15')](function(_0x1fbd03){logger['info']('Admin\x20account\x20selected.');return _0x1fbd03[_0x1039('0x1f')];});}});}else{logger['info'](_0x1039('0x20'));return request({'uri':util[_0x1039('0xc')](_0x1039('0x21'),_0x5ea263['remoteUri'])})['then'](function(_0x25068f){logger[_0x1039('0xb')](_0x1039('0x22'));return _0x25068f['user'];});}}function getEndUser(_0x2a67ec,_0xffa582,_0x1d1250){logger[_0x1039('0xb')](_0x1039('0x23'),_0x1d1250);return request({'uri':util[_0x1039('0xc')](_0x1039('0x1a'),_0x2a67ec['remoteUri']),'qs':{'query':util[_0x1039('0xc')](_0x1039('0x24'),_0x1d1250)}})[_0x1039('0x15')](function(_0xcd365d){var _0x18e856;if(_0xcd365d['results']['length']){_0xcd365d[_0x1039('0x1d')]=_['filter'](_0xcd365d['results'],{'suspended':![],'role':_0x1039('0x25')});if(_0xcd365d[_0x1039('0x1d')][_0x1039('0x26')]){_0x18e856=_[_0x1039('0x27')](_0xcd365d['results']);}}if(_0x18e856){logger['info'](_0x1039('0x28'));return _0x18e856;}else{logger['info'](_0x1039('0x29'));return request({'uri':util[_0x1039('0xc')](_0x1039('0x2a'),_0x2a67ec[_0x1039('0xe')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x1039('0xc')](_0x1039('0x2b'),_0xffa582||_0x1d1250),'phone':_0x1d1250}}})[_0x1039('0x15')](function(_0x7e62d7){logger[_0x1039('0xb')](_0x1039('0x2c'));return _0x7e62d7[_0x1039('0x1f')];});}});}function getAuth(_0x4db516){var _0x2cec52;if(_0x4db516[_0x1039('0x2d')]==='password'){_0x2cec52=util[_0x1039('0xc')](_0x1039('0x2e'),_0x4db516[_0x1039('0x2f')],_0x4db516[_0x1039('0x30')]);}else if(_0x4db516['authType']===_0x1039('0x31')){_0x2cec52=util[_0x1039('0xc')](_0x1039('0x32'),_0x4db516['username'],_0x4db516[_0x1039('0x31')]);}return util[_0x1039('0xc')]('Basic\x20%s',new Buffer(_0x2cec52)['toString'](_0x1039('0x33')));}function request(_0x55d028){logger[_0x1039('0x34')](_0x1039('0x35'),JSON[_0x1039('0x36')](_0x55d028));return rp(_[_0x1039('0x7')](_0x55d028,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x45fc51,_0x354808){var _0x4eec60=[];if(_0x45fc51&&_0x45fc51['length']>0x0){_0x4eec60=_[_0x1039('0x37')](_0x45fc51,_0x354808);}return _0x4eec60;}function getCustomFields(_0xe81736,_0x59d6e4){var _0x29f2e5=[];var _0x10ff0b={'custom_fields':[]};if(_0xe81736[_0x1039('0x26')]>0x0){_['forEach'](_0xe81736,function(_0x18ade8){if(_['includes'](['string',_0x1039('0x38')],_0x18ade8['type'])&&_0x18ade8[_0x1039('0x39')]&&!_0x18ade8['customField']){_0x10ff0b[_0x18ade8[_0x1039('0x39')][_0x1039('0x3a')]()]=_0x18ade8['content'][_0x1039('0x3b')]();}else if(_[_0x1039('0x3c')]([_0x1039('0x3d'),_0x1039('0x38')],_0x18ade8[_0x1039('0x3e')])&&_0x18ade8[_0x1039('0x3f')]&&_0x18ade8[_0x1039('0x40')]){_0x10ff0b['custom_fields']['push']({'id':_0x18ade8['idField'],'value':_0x18ade8['content'][_0x1039('0x3b')]()});}else if(_0x18ade8[_0x1039('0x3e')]===_0x1039('0x41')&&_0x18ade8[_0x1039('0x42')]&&_0x18ade8[_0x1039('0x3f')]&&_0x18ade8['customField']){_0x59d6e4[_0x18ade8[_0x1039('0x42')]]&&_0x10ff0b['custom_fields'][_0x1039('0x43')]({'id':_0x18ade8[_0x1039('0x3f')],'value':_0x59d6e4[_0x18ade8[_0x1039('0x42')]]['toString']()});}else if(_0x18ade8[_0x1039('0x3e')]==='customVariable'&&_0x18ade8[_0x1039('0x44')]&&_0x18ade8[_0x1039('0x44')][_0x1039('0x12')]&&_0x18ade8['idField']&&_0x18ade8[_0x1039('0x40')]){_0x59d6e4[_0x18ade8[_0x1039('0x44')]['name'][_0x1039('0x3a')]()]&&_0x10ff0b[_0x1039('0x45')][_0x1039('0x43')]({'id':_0x18ade8['idField'],'value':_0x59d6e4[_0x18ade8[_0x1039('0x44')][_0x1039('0x12')]['toLowerCase']()][_0x1039('0x3b')]()});}});}return _0x10ff0b;}exports[_0x1039('0x46')]=function(_0x18cb14,_0xb6b27e,_0x1f3a26,_0x368277,_0x24ee4a,_0x1ff411){var _0x43cdb5,_0x314a64;_0x1ff411[_0x1039('0xe')]=intUtil[_0x1039('0x47')](_0x1ff411[_0x1039('0xe')]);_0x1ff411['serverUrl']=intUtil['stripTrailingSlash'](_0x1ff411['serverUrl']);if(_0x24ee4a&&_0x24ee4a[_0x1039('0x48')]){logger['info'](_0x1039('0x49'),'Recording\x20is\x20enabled!');_0xb6b27e[_0x1039('0x4a')]=util[_0x1039('0xc')](_0x1039('0x4b'),_0x1ff411[_0x1039('0x4c')],_0xb6b27e[_0x1039('0x4d')],md5(_0xb6b27e['uniqueid']));}else{_0xb6b27e['recordingURL']='';}headers[_0x1039('0x4e')]=getAuth(_0x1ff411);return getUser(_0x1ff411,_0x368277[_0x1039('0x4f')])[_0x1039('0x15')](function(_0x52309f){_0x43cdb5=_0x52309f;logger[_0x1039('0xb')](_0x1039('0x50'),_0x43cdb5['id']);return getEndUser(_0x1ff411,_0xb6b27e[_0x1039('0x51')],_0xb6b27e['calleridnum']);})[_0x1039('0x15')](function(_0x1eb783){_0x314a64=_0x1eb783;logger[_0x1039('0xb')](_0x1039('0x52'),_0x314a64['id']);return getTicket(_0x1ff411,_0x43cdb5,_0x314a64,_0x1f3a26,_0xb6b27e);})[_0x1039('0x15')](function(_0x52478f){if(_0x52478f){logger[_0x1039('0xb')](_0x1039('0x53'),_0x52478f['id']);switch(_0x1ff411['type']){case _0x1039('0x54'):logger[_0x1039('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1039('0xc')](_0x1039('0x55'),_0x1ff411[_0x1039('0xe')],_0x43cdb5['id'],_0x52478f['id']),'method':_0x1039('0xf')});case _0x1039('0x56'):logger[_0x1039('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1039('0xc')](_0x1039('0x57'),_0x368277['name']),_0x1039('0x58'),{'uri':util[_0x1039('0xc')](_0x1039('0x59'),_0x1ff411[_0x1039('0xe')][_0x1039('0x5a')](_0x1039('0x5b'),''),_0x52478f['id'])});break;default:logger[_0x1039('0x5c')](_0x1039('0x49'),_0x1039('0x5d'));}}})[_0x1039('0x5e')](function(_0x1b58cd){logger[_0x1039('0x5c')](_0x1039('0x5f'),util[_0x1039('0x60')](_0x1b58cd,{'showHidden':!![],'depth':null}));});};exports[_0x1039('0x61')]=function(_0x24ef54,_0xc6fe6a,_0x6b140f,_0x590791,_0x29f418,_0x280c8d,_0x40a7f2){var _0xd879a9,_0x45afed;_0x280c8d['remoteUri']=intUtil[_0x1039('0x47')](_0x280c8d[_0x1039('0xe')]);_0x280c8d[_0x1039('0x4c')]=intUtil[_0x1039('0x47')](_0x280c8d[_0x1039('0x4c')]);if(_0x40a7f2&&_0x40a7f2[_0x1039('0x62')]&&_0x40a7f2[_0x1039('0x62')]!==_0x1039('0x63')){logger[_0x1039('0xb')]('[OUTBOUND]',_0x1039('0x64'));_0xc6fe6a[_0x1039('0x4a')]=util[_0x1039('0xc')](_0x1039('0x4b'),_0x280c8d[_0x1039('0x4c')],_0xc6fe6a['uniqueid'],md5(_0xc6fe6a[_0x1039('0x4d')]));}headers[_0x1039('0x4e')]=getAuth(_0x280c8d);return getUser(_0x280c8d,_0x590791[_0x1039('0x4f')])[_0x1039('0x15')](function(_0x593beb){_0xd879a9=_0x593beb;logger[_0x1039('0xb')](_0x1039('0x50'),_0xd879a9['id']);return getEndUser(_0x280c8d,_0xc6fe6a['destcalleridname'],_0xc6fe6a['destcalleridnum']);})[_0x1039('0x15')](function(_0x1d81f1){_0x45afed=_0x1d81f1;logger[_0x1039('0xb')](_0x1039('0x52'),_0x45afed['id']);return getTicket(_0x280c8d,_0xd879a9,_0x45afed,_0x6b140f,_0xc6fe6a);})[_0x1039('0x15')](function(_0x1182d2){if(_0x1182d2){logger[_0x1039('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1182d2['id']);switch(_0x280c8d[_0x1039('0x3e')]){case _0x1039('0x54'):logger[_0x1039('0xb')](_0x1039('0x65'),_0x1039('0x66'));return request({'uri':util[_0x1039('0xc')](_0x1039('0x55'),_0x280c8d[_0x1039('0xe')],_0xd879a9['id'],_0x1182d2['id']),'method':'POST'});case _0x1039('0x56'):logger[_0x1039('0xb')](_0x1039('0x65'),_0x1039('0x67'));emit(util[_0x1039('0xc')](_0x1039('0x57'),_0x590791[_0x1039('0x12')]),_0x1039('0x58'),{'uri':util[_0x1039('0xc')](_0x1039('0x59'),_0x280c8d['remoteUri'][_0x1039('0x5a')](_0x1039('0x5b'),''),_0x1182d2['id'])});break;default:logger['error'](_0x1039('0x65'),_0x1039('0x5d'));}}})[_0x1039('0x5e')](function(_0x1f2850){logger[_0x1039('0x5c')](_0x1039('0x68'),util[_0x1039('0x60')](_0x1f2850,{'showHidden':!![],'depth':null}));});};exports[_0x1039('0x69')]=function(_0x17fdf6,_0x384ba1,_0x2e2351,_0x27821a,_0x51cff5,_0x59e924){var _0x8d5026,_0x43af1e;_0x59e924[_0x1039('0xe')]=intUtil[_0x1039('0x47')](_0x59e924['remoteUri']);_0x59e924['serverUrl']=intUtil[_0x1039('0x47')](_0x59e924['serverUrl']);if(_0x51cff5&&_0x51cff5['monitor_format']){logger['info']('['+_0x384ba1[_0x1039('0x6a')][_0x1039('0x6b')]()+']',_0x1039('0x64'));_0x384ba1['recordingURL']=util[_0x1039('0xc')](_0x1039('0x4b'),_0x59e924[_0x1039('0x4c')],_0x384ba1[_0x1039('0x4d')],md5(_0x384ba1[_0x1039('0x4d')]));}else{_0x384ba1[_0x1039('0x4a')]='';}headers[_0x1039('0x4e')]=getAuth(_0x59e924);return getUser(_0x59e924)[_0x1039('0x15')](function(_0x5ea4bb){_0x8d5026=_0x5ea4bb;logger[_0x1039('0xb')](_0x1039('0x50'),_0x8d5026['id']);return getEndUser(_0x59e924,_0x384ba1['calleridname'],_0x384ba1[_0x1039('0x6c')]);})['then'](function(_0x303501){_0x43af1e=_0x303501;logger['info'](_0x1039('0x52'),_0x43af1e['id']);return getTicket(_0x59e924,_0x8d5026,_0x43af1e,_0x2e2351,_0x384ba1);})[_0x1039('0x15')](function(_0x3fe021){if(_0x3fe021){logger[_0x1039('0xb')](_0x1039('0x53'),_0x3fe021['id']);}})[_0x1039('0x5e')](function(_0x3cb2f7){logger[_0x1039('0x5c')]('['+_0x384ba1[_0x1039('0x6a')][_0x1039('0x6b')]()+']'+_0x1039('0x6d'),util[_0x1039('0x60')](_0x3cb2f7,{'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 7c480cb..a226bcc 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 _0x2baf=['nothing','Creating\x20new\x20call...','Owner','role','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','user:%s','[OUTBOUND]','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','bluebird','../../../../config/logger','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','https://www.zohoapis.'];(function(_0x1406c8,_0x40a801){var _0x3ec6f8=function(_0xc1183a){while(--_0xc1183a){_0x1406c8['push'](_0x1406c8['shift']());}};_0x3ec6f8(++_0x40a801);}(_0x2baf,0xe7));var _0xf2ba=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x2baf[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0xf2ba('0x0'));var rp=require(_0xf2ba('0x1'));var md5=require(_0xf2ba('0x2'));var util=require(_0xf2ba('0x3'));var intUtil=require('./util');var moment=require(_0xf2ba('0x4'));var Redis=require('ioredis');var BPromise=require(_0xf2ba('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf2ba('0x6'))('zoho');config[_0xf2ba('0x7')]=_['defaults'](config[_0xf2ba('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf2ba('0x8'))(new Redis(config['redis']));function emit(_0x22b39f,_0x5d00e5,_0x27438d){io['to'](_0x22b39f)[_0xf2ba('0x9')](_0x5d00e5,_0x27438d);}function request(_0xa58870){logger['debug'](_0xf2ba('0xa'),JSON[_0xf2ba('0xb')](_0xa58870));return rp(_0xa58870);}function getCustomFields(_0x2847ad,_0x11d333){var _0x6ee879={};if(_0x2847ad[_0xf2ba('0xc')]>0x0){_[_0xf2ba('0xd')](_0x2847ad,function(_0xd3ed84){if(_[_0xf2ba('0xe')]([_0xf2ba('0xf'),'picklist'],_0xd3ed84[_0xf2ba('0x10')])&&_0xd3ed84[_0xf2ba('0x11')]){_0x6ee879[_0xd3ed84[_0xf2ba('0x11')]]=_0xd3ed84[_0xf2ba('0x12')]['toString']();}else if(_0xd3ed84[_0xf2ba('0x10')]===_0xf2ba('0x13')&&_0xd3ed84[_0xf2ba('0x14')]&&_0xd3ed84[_0xf2ba('0x11')]&&_0x11d333[_0xd3ed84[_0xf2ba('0x14')]]){_0x6ee879[_0xd3ed84['idField']]=_0x11d333[_0xd3ed84[_0xf2ba('0x14')]][_0xf2ba('0x15')]();}else if(_0xd3ed84[_0xf2ba('0x10')]==='customVariable'&&_0xd3ed84[_0xf2ba('0x16')]&&_0xd3ed84[_0xf2ba('0x16')][_0xf2ba('0x17')]&&_0xd3ed84['idField']&&_0x11d333[_0xd3ed84[_0xf2ba('0x16')][_0xf2ba('0x17')][_0xf2ba('0x18')]()]){_0x6ee879[_0xd3ed84['idField']]=_0x11d333[_0xd3ed84['Variable'][_0xf2ba('0x17')][_0xf2ba('0x18')]()][_0xf2ba('0x15')]();}});}return _0x6ee879;}function getName(_0x58f3c7){if(_0x58f3c7[_0xf2ba('0x19')]('\x20')>0x0){var _0x1b1e78=_0x58f3c7[_0xf2ba('0x1a')](/ (.+)/);if(_0x1b1e78[0x1]){return _0x1b1e78;}}return[_0x58f3c7,_0x58f3c7];}var accountsTokens={};function getAccessToken(_0x56b30a){return new Promise(function(_0x1c1ed,_0x151acc){if(!_[_0xf2ba('0x1b')](accountsTokens[_0x56b30a['id']])&&!_[_0xf2ba('0x1b')](accountsTokens[_0x56b30a['id']]['access_token'])){if(moment()[_0xf2ba('0x1c')](accountsTokens[_0x56b30a['id']][_0xf2ba('0x1d')])){_0x1c1ed(accountsTokens[_0x56b30a['id']][_0xf2ba('0x1e')]);}}var _0x131ea2;switch(_0x56b30a[_0xf2ba('0x1f')]){case'US':_0x131ea2=_0xf2ba('0x20');break;case'AU':_0x131ea2=_0xf2ba('0x21');break;case'EU':_0x131ea2='https://accounts.zoho.eu';break;case'IN':_0x131ea2=_0xf2ba('0x22');break;case'CN':_0x131ea2=_0xf2ba('0x23');break;default:_0x131ea2=_0xf2ba('0x24');break;}var _0x2d78b0={'method':_0xf2ba('0x25'),'uri':_0x131ea2+_0xf2ba('0x26'),'qs':{'refresh_token':_0x56b30a[_0xf2ba('0x27')],'client_id':_0x56b30a['clientId'],'client_secret':_0x56b30a[_0xf2ba('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2d78b0)[_0xf2ba('0x29')](function(_0x4a2a89){accountsTokens[_0x56b30a['id']]={'access_token':_0x4a2a89[_0xf2ba('0x1e')],'expires_in':moment()[_0xf2ba('0x2a')](_0x4a2a89[_0xf2ba('0x1d')],_0xf2ba('0x2b'))};_0x1c1ed(_0x4a2a89['access_token']);})['catch'](function(_0x23f941){logger[_0xf2ba('0x2c')](_0xf2ba('0x2d'),_0x23f941['stack']);_0x151acc(_0x23f941);});});}function getUser(_0x281f28,_0x1db6dc,_0x32ee27,_0x14d377){logger['info'](_0xf2ba('0x2e'));return request({'method':_0xf2ba('0x2f'),'uri':util[_0xf2ba('0x30')](_0xf2ba('0x31'),_0x1db6dc),'qs':{'type':_0xf2ba('0x32')},'headers':{'Authorization':_0xf2ba('0x33')+_0x281f28},'json':!![]})[_0xf2ba('0x29')](function(_0x409c68){if(_0x409c68[_0xf2ba('0x34')]){var _0x2836a4=-0x1;if(_[_0xf2ba('0x35')](_0x409c68[_0xf2ba('0x34')])){if(!_[_0xf2ba('0x1b')](_0x14d377)){_0x2836a4=_['findIndex'](_0x409c68[_0xf2ba('0x34')],function(_0x107422){return _0x107422[_0xf2ba('0x36')]===_0x14d377;});}if(_0x2836a4>=0x0){logger[_0xf2ba('0x37')]('Agent\x20found!');}else{logger[_0xf2ba('0x37')](_0xf2ba('0x38'));_0x2836a4=_[_0xf2ba('0x39')](_0x409c68[_0xf2ba('0x34')],function(_0x3485be){return _0x3485be[_0xf2ba('0x3a')][_0xf2ba('0x17')]===_0xf2ba('0x3b');});}return _0x409c68['users'][_0x2836a4];}else{if(_0x409c68[_0xf2ba('0x3c')][_0xf2ba('0x3a')][_0xf2ba('0x17')]==='Administrator'){logger[_0xf2ba('0x37')](_0xf2ba('0x38'));user=_0x409c68[_0xf2ba('0x3c')];return user;}else{logger['error'](_0xf2ba('0x3d'),JSON[_0xf2ba('0xb')](_0x409c68));throw new Error(_0xf2ba('0x3e')+JSON[_0xf2ba('0xb')](_0x409c68));}}}else{logger[_0xf2ba('0x2c')](_0xf2ba('0x3d'),JSON[_0xf2ba('0xb')](_0x409c68));throw new Error(_0xf2ba('0x3e')+JSON['stringify'](_0x409c68));}})[_0xf2ba('0x3f')](function(_0x461733){console[_0xf2ba('0x2c')](_0x461733);});}function getZohoUser(_0x311cf6,_0x5f3674){return new BPromise(function(_0x48a06f,_0x2a96bb){request(_0x311cf6)['then'](function(_0x1a4767){var _0xc814b4=null;if(_0x1a4767){_0xc814b4=_0x1a4767[_0xf2ba('0x40')][0x0];_0xc814b4[_0xf2ba('0x41')]=_0x5f3674;}_0x48a06f(_0xc814b4);})['catch'](function(_0x3d3847){_0x2a96bb(_0x3d3847);});});}function createEndUser(_0x17a9d7,_0x3695a6,_0x51c6a3,_0x1d7523,_0x23e2fc,_0x4401e){var _0x51c6a3=getName(_0x51c6a3);return request({'method':_0xf2ba('0x25'),'uri':'https://www.zohoapis.'+_0x3695a6+_0xf2ba('0x42')+_[_0xf2ba('0x43')](_0x4401e[_0xf2ba('0x44')])+'s','body':{'data':[{'Last_Name':_0x51c6a3[0x1],'First_Name':_0x51c6a3[0x0],'Phone':_0x1d7523,'Owner':{'name':!_[_0xf2ba('0x1b')](_0x23e2fc['role'][_0xf2ba('0x17')])?_0x23e2fc['role'][_0xf2ba('0x17')]:!_['isNil'](_0x23e2fc[_0xf2ba('0x45')])?_0x23e2fc['first_name']+'\x20'+_0x23e2fc['last_name']:_0x23e2fc[_0xf2ba('0x46')],'id':_0x23e2fc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x17a9d7},'json':!![]})['then'](function(_0x57edab){if(_0x57edab&&_0x57edab[_0xf2ba('0x40')][0x0][_0xf2ba('0x47')]===_0xf2ba('0x48')){var _0xef588b=_0x57edab[_0xf2ba('0x40')][0x0][_0xf2ba('0x49')];_0xef588b[_0xf2ba('0x41')]=_[_0xf2ba('0x43')](_0x4401e[_0xf2ba('0x44')])+'s';return _0xef588b;}logger[_0xf2ba('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xf2ba('0xb')](data));throw new Error('Error:\x20'+JSON[_0xf2ba('0xb')](data));})[_0xf2ba('0x3f')](function(_0x4026bc){console[_0xf2ba('0x4a')](_0xf2ba('0x4b'),_0x4026bc);});}function getEndUser(_0x1fb706,_0x424a29,_0x4dff5c,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9){var _0x34c271={'method':_0xf2ba('0x2f'),'uri':'','headers':{'Authorization':_0xf2ba('0x33')+_0x1fb706},'json':!![]};switch(_0x2eb5a9['moduleSearch']){case _0xf2ba('0x4c'):_0x34c271[_0xf2ba('0x4d')]='https://www.zohoapis.'+_0x424a29+_0xf2ba('0x4e')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x4f'))['then'](function(_0x1cc92f){if(_0x1cc92f)return _0x1cc92f;_0x34c271['uri']='https://www.zohoapis.'+_0x424a29+_0xf2ba('0x50')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x51'))[_0xf2ba('0x29')](function(_0x241414){if(_0x241414)return _0x241414;if(_0x2eb5a9[_0xf2ba('0x44')]!='nothing'){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});});break;case'contact':_0x34c271[_0xf2ba('0x4d')]=_0xf2ba('0x52')+_0x424a29+_0xf2ba('0x4e')+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x4f'))[_0xf2ba('0x29')](function(_0x33ec39){if(_0x33ec39)return _0x33ec39;if(_0x2eb5a9[_0xf2ba('0x44')]!=_0xf2ba('0x53')){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});break;case'lead':_0x34c271[_0xf2ba('0x4d')]=_0xf2ba('0x52')+_0x424a29+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5e437c+'))';return getZohoUser(_0x34c271,_0xf2ba('0x51'))[_0xf2ba('0x29')](function(_0x5c6d1f){if(_0x5c6d1f)return _0x5c6d1f;if(_0x2eb5a9[_0xf2ba('0x44')]!='nothing'){return createEndUser(_0x1fb706,_0x424a29,_0xe1de75,_0x5e437c,_0x174451,_0x2eb5a9);}else{return{};}});break;}}function getCall(_0x401e77,_0x453d4c,_0x47f4fc,_0x424068,_0x48fc83,_0x2c17b4,_0x5b396e,_0x2e79be){logger[_0xf2ba('0x37')](_0xf2ba('0x54'));var _0x1540f1={};_0x1540f1[_0xf2ba('0x55')]={'name':!_[_0xf2ba('0x1b')](_0x424068[_0xf2ba('0x56')][_0xf2ba('0x17')])&&!_[_0xf2ba('0x1b')](_0x424068['profile']['name'])&&_0x424068[_0xf2ba('0x3a')][_0xf2ba('0x17')]==='administrator'?_0x424068[_0xf2ba('0x56')]['name']:!_['isNil'](_0x424068[_0xf2ba('0x45')])?_0x424068['first_name']+'\x20'+_0x424068['last_name']:_0x424068[_0xf2ba('0x46')],'id':_0x424068['id']};_0x1540f1['Subject']=intUtil[_0xf2ba('0x57')](_0x2c17b4[_0xf2ba('0x58')],_0x5b396e,'\x20');_0x1540f1[_0xf2ba('0x59')]=intUtil[_0xf2ba('0x57')](_0x2c17b4[_0xf2ba('0x5a')],_0x5b396e,'\x0a');if(_0x48fc83[_0xf2ba('0x41')]===_0xf2ba('0x4f')){_0x1540f1[_0xf2ba('0x5b')]={'name':!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5c')])?_0x48fc83[_0xf2ba('0x5c')]:!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5d')])?_0x48fc83[_0xf2ba('0x5d')]+'\x20'+_0x48fc83[_0xf2ba('0x5e')]:_0x48fc83[_0xf2ba('0x5e')],'id':_0x48fc83['id']};}if(_0x48fc83[_0xf2ba('0x41')]===_0xf2ba('0x51')){_0x1540f1[_0xf2ba('0x5f')]={'name':!_[_0xf2ba('0x1b')](_0x48fc83[_0xf2ba('0x5c')])?_0x48fc83[_0xf2ba('0x5c')]:!_['isNil'](_0x48fc83[_0xf2ba('0x5d')])?_0x48fc83[_0xf2ba('0x5d')]+'\x20'+_0x48fc83[_0xf2ba('0x5e')]:_0x48fc83[_0xf2ba('0x5e')],'id':_0x48fc83['id']};_0x1540f1[_0xf2ba('0x60')]=_[_0xf2ba('0x43')](_0x48fc83[_0xf2ba('0x41')]);}if(_0x5b396e['talktime']){_0x1540f1['Call_Duration']=moment[_0xf2ba('0x61')](parseInt(_0x5b396e['talktime'])*0x3e8)['format'](_0xf2ba('0x62'));}else if(_0x5b396e[_0xf2ba('0x63')]&&_0x5b396e[_0xf2ba('0x64')]){_0x1540f1[_0xf2ba('0x65')]=moment['utc'](moment(_0x5b396e[_0xf2ba('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xf2ba('0x66')](moment(_0x5b396e[_0xf2ba('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xf2ba('0x30')]('mm:ss');}switch(_0x5b396e[_0xf2ba('0x68')]){case _0xf2ba('0x69'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x6b');break;case _0xf2ba('0x6c'):case _0xf2ba('0x6d'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x6e');break;case _0xf2ba('0x6f'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x70');break;case _0xf2ba('0x71'):_0x1540f1[_0xf2ba('0x6a')]=_0xf2ba('0x72');break;case _0xf2ba('0x73'):_0x1540f1['Call_Result']=_0xf2ba('0x74');default:}_0x1540f1[_0xf2ba('0x75')]=(_0x2e79be===_0xf2ba('0x76')?moment(_0x5b396e[_0xf2ba('0x67')])[_0xf2ba('0x30')](_0xf2ba('0x77')):moment(_0x5b396e[_0xf2ba('0x78')])[_0xf2ba('0x30')](_0xf2ba('0x77')))||moment()[_0xf2ba('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x1540f1[_0xf2ba('0x79')]=_0x2e79be||'Inbound';_0x1540f1=_[_0xf2ba('0x7a')](_0x1540f1,getCustomFields(_0x2c17b4[_0xf2ba('0x7b')],_0x5b396e));return request({'method':_0xf2ba('0x25'),'uri':_0xf2ba('0x52')+_0x453d4c+_0xf2ba('0x7c'),'headers':{'Authorization':_0xf2ba('0x33')+_0x401e77},'body':{'data':[_0x1540f1]},'json':!![]})['then'](function(_0x49bbe1){if(_0x49bbe1&&_0x49bbe1[_0xf2ba('0x40')][0x0][_0xf2ba('0x47')]===_0xf2ba('0x48')){logger[_0xf2ba('0x37')]('Call\x20created!');return{'id':_0x49bbe1[_0xf2ba('0x40')][0x0][_0xf2ba('0x49')]['id']};}})['catch'](function(_0x17bdc0){logger[_0xf2ba('0x37')](_0xf2ba('0x7d'),_0x17bdc0['stack']);console[_0xf2ba('0x4a')]('err',_0x17bdc0);});}exports[_0xf2ba('0x7e')]=function(_0x2e2e67,_0x1eddb4,_0x459059,_0x2a5c25,_0x2686fd,_0x1a959c){var _0x5e5821,_0x5bffed,_0x29eae;_0x1a959c[_0xf2ba('0x7f')]=intUtil['stripTrailingSlash'](_0x1a959c[_0xf2ba('0x7f')]);_0x1a959c[_0xf2ba('0x80')]=intUtil[_0xf2ba('0x81')](_0x1a959c['serverUrl']);if(_0x2686fd&&_0x2686fd[_0xf2ba('0x82')]){logger[_0xf2ba('0x37')](_0xf2ba('0x83'),'Recording\x20is\x20enabled!');_0x1eddb4[_0xf2ba('0x84')]=_0x1a959c[_0xf2ba('0x80')]+_0xf2ba('0x85')+_0x1eddb4[_0xf2ba('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x1eddb4[_0xf2ba('0x86')]);}else{_0x1eddb4['recordingURL']='';}var _0x163c6b=_0x1a959c[_0xf2ba('0x7f')]===_0xf2ba('0x87')?'eu':'com';return getAccessToken(_0x1a959c)['then'](function(_0x451e3f){_0x29eae=_0x451e3f;return getUser(_0x29eae,_0x163c6b,_0x1a959c,_0x2a5c25[_0xf2ba('0x36')]);})[_0xf2ba('0x29')](function(_0x1ba3e7){_0x5e5821=_0x1ba3e7;logger[_0xf2ba('0x37')](_0xf2ba('0x88'),_0x5e5821['id']);return getEndUser(_0x29eae,_0x163c6b,_0x1a959c,_0x1eddb4[_0xf2ba('0x89')],_0x1eddb4['calleridnum'],_0x5e5821,_0x459059);})[_0xf2ba('0x29')](function(_0x4e6435){_0x5bffed=_0x4e6435;return getCall(_0x29eae,_0x163c6b,_0x1a959c,_0x5e5821,_0x5bffed,_0x459059,_0x1eddb4,_0xf2ba('0x8a'));})[_0xf2ba('0x29')](function(_0x499461){if(_0x499461){logger[_0xf2ba('0x37')](_0xf2ba('0x8b'),_0x499461['id']);logger['info'](_0xf2ba('0x83'),_0xf2ba('0x8c'));emit(util[_0xf2ba('0x30')]('user:%s',_0x2a5c25['name']),_0xf2ba('0x8d'),{'uri':_0xf2ba('0x8e')+_0x1a959c['host']+_0xf2ba('0x8f')+_0x499461['id']});}})['catch'](function(_0x5d66c3){logger['error'](_0xf2ba('0x83'),JSON['stringify'](_0x5d66c3));});};exports[_0xf2ba('0x76')]=function(_0x154e58,_0x38ad43,_0x2a0798,_0x31e7f8,_0xd27e3d,_0x235925,_0x3e2f12){var _0x48ccca,_0x1b8536,_0x32ed31;_0x235925[_0xf2ba('0x7f')]=intUtil[_0xf2ba('0x81')](_0x235925['host']);_0x235925['serverUrl']=intUtil['stripTrailingSlash'](_0x235925[_0xf2ba('0x80')]);if(_0x3e2f12&&_0x3e2f12[_0xf2ba('0x90')]&&_0x3e2f12['recordingFormat']!==_0xf2ba('0x91')){logger[_0xf2ba('0x37')]('[OUTBOUND]',_0xf2ba('0x92'));_0x38ad43[_0xf2ba('0x84')]=_0x235925['serverUrl']+'/api/voice/recordings/'+_0x38ad43[_0xf2ba('0x86')]+_0xf2ba('0x93')+md5(_0x38ad43[_0xf2ba('0x86')]);}var _0x57da74=_0x235925[_0xf2ba('0x7f')]==='zoho.eu'?'eu':_0xf2ba('0x94');return getAccessToken(_0x235925)['then'](function(_0x11dfa6){_0x32ed31=_0x11dfa6;return getUser(_0x32ed31,_0x57da74,_0x235925,_0x31e7f8[_0xf2ba('0x36')]);})['then'](function(_0x29d28a){_0x48ccca=_0x29d28a;logger['info'](_0xf2ba('0x88'),_0x48ccca['id']);return getEndUser(_0x32ed31,_0x57da74,_0x235925,_0x38ad43[_0xf2ba('0x95')],_0x38ad43[_0xf2ba('0x96')],_0x48ccca,_0x2a0798);})['then'](function(_0xc15901){_0x1b8536=_0xc15901;return getCall(_0x32ed31,_0x57da74,_0x235925,_0x48ccca,_0x1b8536,_0x2a0798,_0x38ad43,_0xf2ba('0x97'));})['then'](function(_0x3bfa16){if(_0x3bfa16){logger[_0xf2ba('0x37')](_0xf2ba('0x8b'),_0x3bfa16['id']);logger[_0xf2ba('0x37')]('[OUTBOUND]',_0xf2ba('0x8c'));emit(util[_0xf2ba('0x30')](_0xf2ba('0x98'),_0x31e7f8['name']),'trigger:browser:url',{'uri':_0xf2ba('0x8e')+_0x235925[_0xf2ba('0x7f')]+_0xf2ba('0x8f')+_0x3bfa16['id']});}})[_0xf2ba('0x3f')](function(_0x1c297e){logger[_0xf2ba('0x2c')](_0xf2ba('0x99'),JSON[_0xf2ba('0xb')](_0x1c297e));});};exports[_0xf2ba('0x9a')]=function(_0x140328,_0x5eefb6,_0x1c7966,_0x16d74b,_0xcb153a,_0xd8efb3){var _0x1bf02e,_0x1dc68b,_0xcec04f;_0xd8efb3['host']=intUtil['stripTrailingSlash'](_0xd8efb3[_0xf2ba('0x7f')]);_0xd8efb3['serverUrl']=intUtil[_0xf2ba('0x81')](_0xd8efb3[_0xf2ba('0x80')]);if(_0xcb153a&&_0xcb153a[_0xf2ba('0x82')]){logger[_0xf2ba('0x37')]('['+_0x5eefb6[_0xf2ba('0x68')][_0xf2ba('0x9b')]()+']',_0xf2ba('0x92'));_0x5eefb6[_0xf2ba('0x84')]=_0xd8efb3[_0xf2ba('0x80')]+_0xf2ba('0x85')+_0x5eefb6[_0xf2ba('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x5eefb6[_0xf2ba('0x86')]);}else{_0x5eefb6[_0xf2ba('0x84')]='';}var _0xaec667=_0xd8efb3[_0xf2ba('0x7f')]===_0xf2ba('0x87')?'eu':_0xf2ba('0x94');return getAccessToken(_0xd8efb3)[_0xf2ba('0x29')](function(_0x1c19cf){_0xcec04f=_0x1c19cf;return getUser(_0xcec04f,_0xaec667,_0xd8efb3);})[_0xf2ba('0x29')](function(_0x528563){_0x1bf02e=_0x528563;logger[_0xf2ba('0x37')](_0xf2ba('0x88'),_0x1bf02e['id']);return getEndUser(_0xcec04f,_0xaec667,_0xd8efb3,_0x5eefb6[_0xf2ba('0x89')],_0x5eefb6[_0xf2ba('0x9c')],_0x1bf02e,_0x1c7966);})[_0xf2ba('0x29')](function(_0x38e9aa){_0x1dc68b=_0x38e9aa;return getCall(_0xcec04f,_0xaec667,_0xd8efb3,_0x1bf02e,_0x1dc68b,_0x1c7966,_0x5eefb6,_0xf2ba('0x8a'));})['then'](function(_0x36b353){if(_0x36b353){logger[_0xf2ba('0x37')]('The\x20Call\x20ID\x20is:',_0x36b353['id']);}})[_0xf2ba('0x3f')](function(_0x1cdb93){logger[_0xf2ba('0x2c')]('['+_0x5eefb6[_0xf2ba('0x68')][_0xf2ba('0x9b')]()+']',JSON[_0xf2ba('0xb')](_0x1cdb93));});}; \ No newline at end of file +var _0xde9c=['First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','diff','mm:ss','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Fields','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','https://crm.','lastevent','calleridname','toUpperCase','lodash','request-promise','md5','ioredis','bluebird','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','seconds','catch','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','role','first_name','then','code','details','startCase','moduleCreate','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','Owner','administrator','last_name','getString','Description','Descriptions','enduserType','Who_Id','Full_Name'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xde9c,0xc4));var _0xcde9=function(_0x296d5d,_0x5ec80d){_0x296d5d=_0x296d5d-0x0;var _0x6d8947=_0xde9c[_0x296d5d];return _0x6d8947;};'use strict';var _=require(_0xcde9('0x0'));var rp=require(_0xcde9('0x1'));var md5=require(_0xcde9('0x2'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0xcde9('0x3'));var BPromise=require(_0xcde9('0x4'));var config=require('../../../../config/environment');var logger=require(_0xcde9('0x5'))(_0xcde9('0x6'));config[_0xcde9('0x7')]=_['defaults'](config[_0xcde9('0x7')],{'host':_0xcde9('0x8'),'port':0x18eb});var io=require(_0xcde9('0x9'))(new Redis(config['redis']));function emit(_0x2d98ca,_0x4a7483,_0x5f693e){io['to'](_0x2d98ca)[_0xcde9('0xa')](_0x4a7483,_0x5f693e);}function request(_0x2d8dcc){logger['debug'](_0xcde9('0xb'),JSON[_0xcde9('0xc')](_0x2d8dcc));return rp(_0x2d8dcc);}function getCustomFields(_0x39d0ed,_0x337618){var _0x32e113={};if(_0x39d0ed[_0xcde9('0xd')]>0x0){_[_0xcde9('0xe')](_0x39d0ed,function(_0xd47b25){if(_[_0xcde9('0xf')]([_0xcde9('0x10'),_0xcde9('0x11')],_0xd47b25[_0xcde9('0x12')])&&_0xd47b25[_0xcde9('0x13')]){_0x32e113[_0xd47b25[_0xcde9('0x13')]]=_0xd47b25['content']['toString']();}else if(_0xd47b25[_0xcde9('0x12')]==='variable'&&_0xd47b25[_0xcde9('0x14')]&&_0xd47b25[_0xcde9('0x13')]&&_0x337618[_0xd47b25[_0xcde9('0x14')]]){_0x32e113[_0xd47b25[_0xcde9('0x13')]]=_0x337618[_0xd47b25[_0xcde9('0x14')]]['toString']();}else if(_0xd47b25[_0xcde9('0x12')]===_0xcde9('0x15')&&_0xd47b25[_0xcde9('0x16')]&&_0xd47b25[_0xcde9('0x16')][_0xcde9('0x17')]&&_0xd47b25[_0xcde9('0x13')]&&_0x337618[_0xd47b25[_0xcde9('0x16')][_0xcde9('0x17')][_0xcde9('0x18')]()]){_0x32e113[_0xd47b25['idField']]=_0x337618[_0xd47b25[_0xcde9('0x16')][_0xcde9('0x17')][_0xcde9('0x18')]()]['toString']();}});}return _0x32e113;}function getName(_0x43d65c){if(_0x43d65c['indexOf']('\x20')>0x0){var _0x4b9199=_0x43d65c[_0xcde9('0x19')](/ (.+)/);if(_0x4b9199[0x1]){return _0x4b9199;}}return[_0x43d65c,_0x43d65c];}var accountsTokens={};function getAccessToken(_0x1a986c){return new Promise(function(_0x2bb012,_0x12a798){if(!_[_0xcde9('0x1a')](accountsTokens[_0x1a986c['id']])&&!_[_0xcde9('0x1a')](accountsTokens[_0x1a986c['id']][_0xcde9('0x1b')])){if(moment()[_0xcde9('0x1c')](accountsTokens[_0x1a986c['id']][_0xcde9('0x1d')])){_0x2bb012(accountsTokens[_0x1a986c['id']][_0xcde9('0x1b')]);}}var _0x2ccd17;switch(_0x1a986c[_0xcde9('0x1e')]){case'US':_0x2ccd17='https://accounts.zoho.com';break;case'AU':_0x2ccd17=_0xcde9('0x1f');break;case'EU':_0x2ccd17=_0xcde9('0x20');break;case'IN':_0x2ccd17='https://accounts.zoho.in';break;case'CN':_0x2ccd17=_0xcde9('0x21');break;default:_0x2ccd17='https://accounts.zoho.eu';break;}var _0x2a3568={'method':_0xcde9('0x22'),'uri':_0x2ccd17+'/oauth/v2/token','qs':{'refresh_token':_0x1a986c['refreshToken'],'client_id':_0x1a986c['clientId'],'client_secret':_0x1a986c['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2a3568)['then'](function(_0x2cd9ed){accountsTokens[_0x1a986c['id']]={'access_token':_0x2cd9ed['access_token'],'expires_in':moment()['add'](_0x2cd9ed[_0xcde9('0x1d')],_0xcde9('0x23'))};_0x2bb012(_0x2cd9ed['access_token']);})[_0xcde9('0x24')](function(_0xdd9cb4){logger['error']('Failing\x20creating\x20the\x20access_token',_0xdd9cb4[_0xcde9('0x25')]);_0x12a798(_0xdd9cb4);});});}function getUser(_0x4052a9,_0x492fb1,_0x140db0,_0x42722e){logger[_0xcde9('0x26')](_0xcde9('0x27'));return request({'method':_0xcde9('0x28'),'uri':util[_0xcde9('0x29')](_0xcde9('0x2a'),_0x492fb1),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xcde9('0x2b')+_0x4052a9},'json':!![]})['then'](function(_0x3b6e9f){if(_0x3b6e9f[_0xcde9('0x2c')]){var _0x491aae=-0x1;if(_['isArrayLikeObject'](_0x3b6e9f[_0xcde9('0x2c')])){if(!_['isNil'](_0x42722e)){_0x491aae=_[_0xcde9('0x2d')](_0x3b6e9f[_0xcde9('0x2c')],function(_0x3a48b5){return _0x3a48b5[_0xcde9('0x2e')]===_0x42722e;});}if(_0x491aae>=0x0){logger[_0xcde9('0x26')](_0xcde9('0x2f'));}else{logger[_0xcde9('0x26')](_0xcde9('0x30'));_0x491aae=_[_0xcde9('0x2d')](_0x3b6e9f['users'],function(_0x5ba9d1){return _0x5ba9d1[_0xcde9('0x31')][_0xcde9('0x17')]==='Administrator';});}return _0x3b6e9f[_0xcde9('0x2c')][_0x491aae];}else{if(_0x3b6e9f[_0xcde9('0x32')]['profile'][_0xcde9('0x17')]===_0xcde9('0x33')){logger['info'](_0xcde9('0x30'));user=_0x3b6e9f[_0xcde9('0x32')];return user;}else{logger[_0xcde9('0x34')](_0xcde9('0x35'),JSON[_0xcde9('0xc')](_0x3b6e9f));throw new Error(_0xcde9('0x36')+JSON['stringify'](_0x3b6e9f));}}}else{logger[_0xcde9('0x34')](_0xcde9('0x35'),JSON[_0xcde9('0xc')](_0x3b6e9f));throw new Error(_0xcde9('0x36')+JSON['stringify'](_0x3b6e9f));}})['catch'](function(_0x5009d5){console[_0xcde9('0x34')](_0x5009d5);});}function getZohoUser(_0x36dc44,_0xfc5c02){return new BPromise(function(_0x51d9cb,_0x182893){request(_0x36dc44)['then'](function(_0xfb388){var _0x1b72ad=null;if(_0xfb388){_0x1b72ad=_0xfb388[_0xcde9('0x37')][0x0];_0x1b72ad['enduserType']=_0xfc5c02;}_0x51d9cb(_0x1b72ad);})[_0xcde9('0x24')](function(_0xccf95e){_0x182893(_0xccf95e);});});}function createEndUser(_0x3e7b8f,_0x4f7cc1,_0x20a6f1,_0x1413ac,_0x376bd5,_0x5ab886){var _0x20a6f1=getName(_0x20a6f1);return request({'method':'POST','uri':_0xcde9('0x38')+_0x4f7cc1+'/crm/v2/'+_['startCase'](_0x5ab886['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x20a6f1[0x1],'First_Name':_0x20a6f1[0x0],'Phone':_0x1413ac,'Owner':{'name':!_['isNil'](_0x376bd5[_0xcde9('0x39')][_0xcde9('0x17')])?_0x376bd5[_0xcde9('0x39')][_0xcde9('0x17')]:!_[_0xcde9('0x1a')](_0x376bd5[_0xcde9('0x3a')])?_0x376bd5[_0xcde9('0x3a')]+'\x20'+_0x376bd5['last_name']:_0x376bd5['last_name'],'id':_0x376bd5['id']}}]},'headers':{'Authorization':_0xcde9('0x2b')+_0x3e7b8f},'json':!![]})[_0xcde9('0x3b')](function(_0x37f60c){if(_0x37f60c&&_0x37f60c['data'][0x0][_0xcde9('0x3c')]==='SUCCESS'){var _0x5a752e=_0x37f60c[_0xcde9('0x37')][0x0][_0xcde9('0x3d')];_0x5a752e['enduserType']=_[_0xcde9('0x3e')](_0x5ab886[_0xcde9('0x3f')])+'s';return _0x5a752e;}logger['error'](_0xcde9('0x35'),JSON['stringify'](data));throw new Error(_0xcde9('0x40')+JSON['stringify'](data));})[_0xcde9('0x24')](function(_0x3432cc){console[_0xcde9('0x41')]('CREATE\x20ERROR',_0x3432cc);});}function getEndUser(_0x3e1c5d,_0x201fcf,_0x18773e,_0x3aac06,_0x4e2f64,_0x463102,_0x130500){var _0x5ee9b3={'method':'GET','uri':'','headers':{'Authorization':_0xcde9('0x2b')+_0x3e1c5d},'json':!![]};switch(_0x130500['moduleSearch']){case _0xcde9('0x42'):_0x5ee9b3[_0xcde9('0x43')]=_0xcde9('0x38')+_0x201fcf+_0xcde9('0x44')+_0x4e2f64+'))';return getZohoUser(_0x5ee9b3,_0xcde9('0x45'))['then'](function(_0x3759f6){if(_0x3759f6)return _0x3759f6;_0x5ee9b3[_0xcde9('0x43')]='https://www.zohoapis.'+_0x201fcf+_0xcde9('0x46')+_0x4e2f64+'))';return getZohoUser(_0x5ee9b3,_0xcde9('0x47'))[_0xcde9('0x3b')](function(_0x40b170){if(_0x40b170)return _0x40b170;if(_0x130500['moduleCreate']!='nothing'){return createEndUser(_0x3e1c5d,_0x201fcf,_0x3aac06,_0x4e2f64,_0x463102,_0x130500);}else{return{};}});});break;case'contact':_0x5ee9b3[_0xcde9('0x43')]=_0xcde9('0x38')+_0x201fcf+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4e2f64+'))';return getZohoUser(_0x5ee9b3,_0xcde9('0x45'))[_0xcde9('0x3b')](function(_0x214adc){if(_0x214adc)return _0x214adc;if(_0x130500[_0xcde9('0x3f')]!=_0xcde9('0x48')){return createEndUser(_0x3e1c5d,_0x201fcf,_0x3aac06,_0x4e2f64,_0x463102,_0x130500);}else{return{};}});break;case _0xcde9('0x49'):_0x5ee9b3[_0xcde9('0x43')]='https://www.zohoapis.'+_0x201fcf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4e2f64+'))';return getZohoUser(_0x5ee9b3,_0xcde9('0x47'))[_0xcde9('0x3b')](function(_0x15ef4e){if(_0x15ef4e)return _0x15ef4e;if(_0x130500['moduleCreate']!=_0xcde9('0x48')){return createEndUser(_0x3e1c5d,_0x201fcf,_0x3aac06,_0x4e2f64,_0x463102,_0x130500);}else{return{};}});break;}}function getCall(_0x3c6348,_0x485ad1,_0x1e0105,_0x9da9ec,_0x54653f,_0x1cb028,_0x4cd355,_0x162963){logger[_0xcde9('0x26')](_0xcde9('0x4a'));var _0x109d82={};_0x109d82[_0xcde9('0x4b')]={'name':!_[_0xcde9('0x1a')](_0x9da9ec[_0xcde9('0x39')][_0xcde9('0x17')])&&!_[_0xcde9('0x1a')](_0x9da9ec[_0xcde9('0x31')][_0xcde9('0x17')])&&_0x9da9ec[_0xcde9('0x31')][_0xcde9('0x17')]===_0xcde9('0x4c')?_0x9da9ec[_0xcde9('0x39')][_0xcde9('0x17')]:!_[_0xcde9('0x1a')](_0x9da9ec[_0xcde9('0x3a')])?_0x9da9ec['first_name']+'\x20'+_0x9da9ec['last_name']:_0x9da9ec[_0xcde9('0x4d')],'id':_0x9da9ec['id']};_0x109d82['Subject']=intUtil[_0xcde9('0x4e')](_0x1cb028['Subjects'],_0x4cd355,'\x20');_0x109d82[_0xcde9('0x4f')]=intUtil['getString'](_0x1cb028[_0xcde9('0x50')],_0x4cd355,'\x0a');if(_0x54653f[_0xcde9('0x51')]===_0xcde9('0x45')){_0x109d82[_0xcde9('0x52')]={'name':!_[_0xcde9('0x1a')](_0x54653f[_0xcde9('0x53')])?_0x54653f[_0xcde9('0x53')]:!_[_0xcde9('0x1a')](_0x54653f['First_Name'])?_0x54653f[_0xcde9('0x54')]+'\x20'+_0x54653f[_0xcde9('0x55')]:_0x54653f[_0xcde9('0x55')],'id':_0x54653f['id']};}if(_0x54653f['enduserType']===_0xcde9('0x47')){_0x109d82[_0xcde9('0x56')]={'name':!_[_0xcde9('0x1a')](_0x54653f[_0xcde9('0x53')])?_0x54653f[_0xcde9('0x53')]:!_[_0xcde9('0x1a')](_0x54653f[_0xcde9('0x54')])?_0x54653f[_0xcde9('0x54')]+'\x20'+_0x54653f[_0xcde9('0x55')]:_0x54653f[_0xcde9('0x55')],'id':_0x54653f['id']};_0x109d82[_0xcde9('0x57')]=_[_0xcde9('0x3e')](_0x54653f['enduserType']);}if(_0x4cd355[_0xcde9('0x58')]){_0x109d82[_0xcde9('0x59')]=moment[_0xcde9('0x5a')](parseInt(_0x4cd355[_0xcde9('0x58')])*0x3e8)['format']('mm:ss');}else if(_0x4cd355[_0xcde9('0x5b')]&&_0x4cd355[_0xcde9('0x5c')]){_0x109d82[_0xcde9('0x59')]=moment['utc'](moment(_0x4cd355[_0xcde9('0x5c')],'YYYY-MM-DDTHH:mm:ss')[_0xcde9('0x5d')](moment(_0x4cd355['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xcde9('0x29')](_0xcde9('0x5e'));}switch(_0x4cd355['lastevent']){case _0xcde9('0x5f'):_0x109d82[_0xcde9('0x60')]=_0xcde9('0x61');break;case _0xcde9('0x62'):case _0xcde9('0x63'):_0x109d82[_0xcde9('0x60')]=_0xcde9('0x64');break;case _0xcde9('0x65'):_0x109d82[_0xcde9('0x60')]=_0xcde9('0x66');break;case _0xcde9('0x67'):_0x109d82['Call_Result']='Abandoned';break;case _0xcde9('0x68'):_0x109d82[_0xcde9('0x60')]='Timeout';default:}_0x109d82[_0xcde9('0x69')]=(_0x162963===_0xcde9('0x6a')?moment(_0x4cd355['starttime'])[_0xcde9('0x29')](_0xcde9('0x6b')):moment(_0x4cd355[_0xcde9('0x6c')])[_0xcde9('0x29')](_0xcde9('0x6b')))||moment()['format'](_0xcde9('0x6b'));_0x109d82[_0xcde9('0x6d')]=_0x162963||'Inbound';_0x109d82=_['merge'](_0x109d82,getCustomFields(_0x1cb028[_0xcde9('0x6e')],_0x4cd355));return request({'method':_0xcde9('0x22'),'uri':_0xcde9('0x38')+_0x485ad1+'/crm/v2/Calls','headers':{'Authorization':_0xcde9('0x2b')+_0x3c6348},'body':{'data':[_0x109d82]},'json':!![]})[_0xcde9('0x3b')](function(_0x42afe3){if(_0x42afe3&&_0x42afe3[_0xcde9('0x37')][0x0][_0xcde9('0x3c')]===_0xcde9('0x6f')){logger[_0xcde9('0x26')]('Call\x20created!');return{'id':_0x42afe3[_0xcde9('0x37')][0x0][_0xcde9('0x3d')]['id']};}})['catch'](function(_0x4fd30c){logger[_0xcde9('0x26')](_0xcde9('0x70'),_0x4fd30c[_0xcde9('0x25')]);console[_0xcde9('0x41')](_0xcde9('0x70'),_0x4fd30c);});}exports[_0xcde9('0x71')]=function(_0x3bcc9a,_0x1237f5,_0x1aad17,_0x38b11c,_0x36bbf1,_0x177416){var _0x2f891a,_0x7fa101,_0x4ccdf9;_0x177416[_0xcde9('0x72')]=intUtil[_0xcde9('0x73')](_0x177416[_0xcde9('0x72')]);_0x177416[_0xcde9('0x74')]=intUtil[_0xcde9('0x73')](_0x177416['serverUrl']);if(_0x36bbf1&&_0x36bbf1[_0xcde9('0x75')]){logger[_0xcde9('0x26')](_0xcde9('0x76'),_0xcde9('0x77'));_0x1237f5['recordingURL']=_0x177416['serverUrl']+_0xcde9('0x78')+_0x1237f5['uniqueid']+_0xcde9('0x79')+md5(_0x1237f5['uniqueid']);}else{_0x1237f5[_0xcde9('0x7a')]='';}var _0x5c383b=_0x177416[_0xcde9('0x72')]===_0xcde9('0x7b')?'eu':_0xcde9('0x7c');return getAccessToken(_0x177416)[_0xcde9('0x3b')](function(_0x19cfc1){_0x4ccdf9=_0x19cfc1;return getUser(_0x4ccdf9,_0x5c383b,_0x177416,_0x38b11c[_0xcde9('0x2e')]);})['then'](function(_0xae351d){_0x2f891a=_0xae351d;logger[_0xcde9('0x26')]('The\x20User\x20ID\x20is:',_0x2f891a['id']);return getEndUser(_0x4ccdf9,_0x5c383b,_0x177416,_0x1237f5['calleridname'],_0x1237f5[_0xcde9('0x7d')],_0x2f891a,_0x1aad17);})[_0xcde9('0x3b')](function(_0x53fb36){_0x7fa101=_0x53fb36;return getCall(_0x4ccdf9,_0x5c383b,_0x177416,_0x2f891a,_0x7fa101,_0x1aad17,_0x1237f5,_0xcde9('0x7e'));})[_0xcde9('0x3b')](function(_0x4154f9){if(_0x4154f9){logger[_0xcde9('0x26')](_0xcde9('0x7f'),_0x4154f9['id']);logger[_0xcde9('0x26')](_0xcde9('0x76'),_0xcde9('0x80'));emit(util[_0xcde9('0x29')](_0xcde9('0x81'),_0x38b11c[_0xcde9('0x17')]),_0xcde9('0x82'),{'uri':'https://crm.'+_0x177416[_0xcde9('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4154f9['id']});}})[_0xcde9('0x24')](function(_0x36c473){logger[_0xcde9('0x34')](_0xcde9('0x76'),JSON['stringify'](_0x36c473));});};exports[_0xcde9('0x6a')]=function(_0x14f41a,_0x41a540,_0xfcdb37,_0x3917b3,_0x3a2486,_0x9833be,_0x6d785f){var _0x30e012,_0x59773b,_0x4e66c2;_0x9833be['host']=intUtil[_0xcde9('0x73')](_0x9833be['host']);_0x9833be[_0xcde9('0x74')]=intUtil['stripTrailingSlash'](_0x9833be[_0xcde9('0x74')]);if(_0x6d785f&&_0x6d785f[_0xcde9('0x83')]&&_0x6d785f[_0xcde9('0x83')]!==_0xcde9('0x84')){logger['info'](_0xcde9('0x85'),'Recording\x20is\x20enabled!');_0x41a540[_0xcde9('0x7a')]=_0x9833be['serverUrl']+_0xcde9('0x78')+_0x41a540['uniqueid']+_0xcde9('0x79')+md5(_0x41a540[_0xcde9('0x86')]);}var _0x3a6830=_0x9833be[_0xcde9('0x72')]==='zoho.eu'?'eu':_0xcde9('0x7c');return getAccessToken(_0x9833be)['then'](function(_0x4f2ef7){_0x4e66c2=_0x4f2ef7;return getUser(_0x4e66c2,_0x3a6830,_0x9833be,_0x3917b3['email']);})[_0xcde9('0x3b')](function(_0x18eeae){_0x30e012=_0x18eeae;logger[_0xcde9('0x26')](_0xcde9('0x87'),_0x30e012['id']);return getEndUser(_0x4e66c2,_0x3a6830,_0x9833be,_0x41a540['destcalleridname'],_0x41a540['destcalleridnum'],_0x30e012,_0xfcdb37);})['then'](function(_0x1ebecd){_0x59773b=_0x1ebecd;return getCall(_0x4e66c2,_0x3a6830,_0x9833be,_0x30e012,_0x59773b,_0xfcdb37,_0x41a540,'Outbound');})['then'](function(_0x206a03){if(_0x206a03){logger[_0xcde9('0x26')](_0xcde9('0x7f'),_0x206a03['id']);logger[_0xcde9('0x26')](_0xcde9('0x85'),_0xcde9('0x80'));emit(util[_0xcde9('0x29')](_0xcde9('0x81'),_0x3917b3[_0xcde9('0x17')]),_0xcde9('0x82'),{'uri':_0xcde9('0x88')+_0x9833be[_0xcde9('0x72')]+'/crm/EntityInfo.do?module=Calls&id='+_0x206a03['id']});}})[_0xcde9('0x24')](function(_0x506b08){logger[_0xcde9('0x34')](_0xcde9('0x85'),JSON['stringify'](_0x506b08));});};exports['unmanaged']=function(_0x3c0750,_0x2f7cff,_0x757820,_0x35fffc,_0x18b9a3,_0x8241e){var _0x294d4e,_0x4b69ac,_0x567dc6;_0x8241e[_0xcde9('0x72')]=intUtil['stripTrailingSlash'](_0x8241e[_0xcde9('0x72')]);_0x8241e['serverUrl']=intUtil[_0xcde9('0x73')](_0x8241e['serverUrl']);if(_0x18b9a3&&_0x18b9a3[_0xcde9('0x75')]){logger[_0xcde9('0x26')]('['+_0x2f7cff[_0xcde9('0x89')]['toUpperCase']()+']',_0xcde9('0x77'));_0x2f7cff[_0xcde9('0x7a')]=_0x8241e[_0xcde9('0x74')]+_0xcde9('0x78')+_0x2f7cff[_0xcde9('0x86')]+_0xcde9('0x79')+md5(_0x2f7cff['uniqueid']);}else{_0x2f7cff[_0xcde9('0x7a')]='';}var _0x4a35e8=_0x8241e[_0xcde9('0x72')]===_0xcde9('0x7b')?'eu':_0xcde9('0x7c');return getAccessToken(_0x8241e)[_0xcde9('0x3b')](function(_0x5cc52f){_0x567dc6=_0x5cc52f;return getUser(_0x567dc6,_0x4a35e8,_0x8241e);})[_0xcde9('0x3b')](function(_0x57f413){_0x294d4e=_0x57f413;logger[_0xcde9('0x26')](_0xcde9('0x87'),_0x294d4e['id']);return getEndUser(_0x567dc6,_0x4a35e8,_0x8241e,_0x2f7cff[_0xcde9('0x8a')],_0x2f7cff['calleridnum'],_0x294d4e,_0x757820);})[_0xcde9('0x3b')](function(_0x589819){_0x4b69ac=_0x589819;return getCall(_0x567dc6,_0x4a35e8,_0x8241e,_0x294d4e,_0x4b69ac,_0x757820,_0x2f7cff,'Inbound');})[_0xcde9('0x3b')](function(_0x1c72f6){if(_0x1c72f6){logger['info'](_0xcde9('0x7f'),_0x1c72f6['id']);}})[_0xcde9('0x24')](function(_0x5be953){logger[_0xcde9('0x34')]('['+_0x2f7cff[_0xcde9('0x89')][_0xcde9('0x8b')]()+']',JSON[_0xcde9('0xc')](_0x5be953));});}; \ 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 bf7b239..a6a4762 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 _0xcd83=['render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','exec','data2','Script','data3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcd83,0x12e));var _0x3cd8=function(_0x42f921,_0x2c2415){_0x42f921=_0x42f921-0x0;var _0x20bb25=_0xcd83[_0x42f921];return _0x20bb25;};'use strict';var util=require(_0x3cd8('0x0'));var sh=require(_0x3cd8('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports[_0x3cd8('0x2')]=function(_0xd30343,_0x4e9642){var _0x3cf005=_0xd30343[_0x3cd8('0x3')]?_0xd30343[_0x3cd8('0x3')]:_0x3cd8('0x4');var _0xbe7412=_0xd30343[_0x3cd8('0x5')]?Mustache[_0x3cd8('0x6')](_0xd30343[_0x3cd8('0x5')],_0x4e9642):_0x4e9642;sh[_0x3cd8('0x2')](_0xbe7412,function(_0xa9fe09,_0x38030f,_0x251df7){if(_0xa9fe09!==0x0){logger[_0x3cd8('0x7')](util[_0x3cd8('0x8')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3cf005,_0xbe7412,_0xa9fe09,_0x251df7));}else{logger[_0x3cd8('0x9')](util[_0x3cd8('0x8')](_0x3cd8('0xa'),_0x3cf005,_0xbe7412,_0x38030f));}});}; \ No newline at end of file +var _0xa850=['shelljs','../../../../config/logger','trigger','data2','Script','render','data3','exec','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x376ae3,_0x4b18d9){var _0x4a536a=function(_0x45a33b){while(--_0x45a33b){_0x376ae3['push'](_0x376ae3['shift']());}};_0x4a536a(++_0x4b18d9);}(_0xa850,0x185));var _0x0a85=function(_0x182677,_0x6998db){_0x182677=_0x182677-0x0;var _0x40e998=_0xa850[_0x182677];return _0x40e998;};'use strict';var util=require(_0x0a85('0x0'));var sh=require(_0x0a85('0x1'));var Mustache=require('mustache');var logger=require(_0x0a85('0x2'))(_0x0a85('0x3'));exports['exec']=function(_0x3a4275,_0x5040f4){var _0x2e4c60=_0x3a4275[_0x0a85('0x4')]?_0x3a4275[_0x0a85('0x4')]:_0x0a85('0x5');var _0xddffa=_0x3a4275['data3']?Mustache[_0x0a85('0x6')](_0x3a4275[_0x0a85('0x7')],_0x5040f4):_0x5040f4;sh[_0x0a85('0x8')](_0xddffa,function(_0x200cb9,_0x1d94aa,_0x3bf6d9){if(_0x200cb9!==0x0){logger[_0x0a85('0x9')](util['format'](_0x0a85('0xa'),_0x2e4c60,_0xddffa,_0x200cb9,_0x3bf6d9));}else{logger[_0x0a85('0xb')](util['format'](_0x0a85('0xc'),_0x2e4c60,_0xddffa,_0x1d94aa));}});}; \ 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 b03df5e..7b4615c 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 _0x6f3a=['format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f3a,0x192));var _0xa6f3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6f3a[_0x4565bf];return _0x5610ba;};'use strict';var rp=require(_0xa6f3('0x0'));var util=require(_0xa6f3('0x1'));var _=require(_0xa6f3('0x2'));var Mustache=require('mustache');var logger=require(_0xa6f3('0x3'))('trigger');exports[_0xa6f3('0x4')]=function(_0x555c05,_0x50a9a5){var _0x412a16,_0x478cb4;var _0xbe5d2e={'method':_0x555c05[_0xa6f3('0x5')][_0xa6f3('0x6')](),'uri':Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0x8')],_0x50a9a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x555c05[_0xa6f3('0x9')])===_0xa6f3('0xa')&&parseInt(_0x555c05[_0xa6f3('0x9')])>=0x1&&parseInt(_0x555c05['data5'])<=0xa?parseInt(_0x555c05[_0xa6f3('0x9')])*0x3e8:0x5*0x3e8};try{_0xbe5d2e['headers']=_0x555c05[_0xa6f3('0xb')]?JSON['parse'](Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0xb')],_0x50a9a5)):{};}catch(_0x14ec1f){logger[_0xa6f3('0xc')](_0x14ec1f[_0xa6f3('0xd')]);}switch(_0x555c05[_0xa6f3('0x5')][_0xa6f3('0x6')]()){case _0xa6f3('0xe'):case _0xa6f3('0xf'):_0x412a16=null;_0xbe5d2e['qs']=_0x50a9a5;break;case _0xa6f3('0x10'):case'PUT':if(_0x555c05[_0xa6f3('0x11')]){try{_0x412a16=JSON[_0xa6f3('0x12')](Mustache[_0xa6f3('0x7')](_0x555c05[_0xa6f3('0x11')],_0x50a9a5));_0xbe5d2e[_0xa6f3('0x13')]=_0x412a16;}catch(_0xd67671){logger[_0xa6f3('0xc')](_0xd67671[_0xa6f3('0xd')]);logger[_0xa6f3('0xc')](_0xa6f3('0x14'));}}else{_0x412a16=_0x50a9a5;_0xbe5d2e[_0xa6f3('0x13')]=_0x412a16;}break;}logger[_0xa6f3('0x15')](util['format'](_0xa6f3('0x16'),_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],JSON[_0xa6f3('0x17')](_0xbe5d2e)));rp(_0xbe5d2e)[_0xa6f3('0x18')](function(_0x3a9a11){_0x412a16=!_[_0xa6f3('0x19')](_0x412a16)?_0xa6f3('0x1a')+_0x412a16:'';_0x478cb4=typeof _0x3a9a11[_0xa6f3('0x13')]==='object'?JSON[_0xa6f3('0x17')](_0x3a9a11[_0xa6f3('0x13')]):_0x3a9a11[_0xa6f3('0x13')];logger['info'](util[_0xa6f3('0x1b')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],_0x3a9a11[_0xa6f3('0x1c')],_0x478cb4));})[_0xa6f3('0x1d')](function(_0x17c6a6){logger['error'](util[_0xa6f3('0x1b')](_0xa6f3('0x1e'),_0x555c05[_0xa6f3('0x5')],_0x555c05[_0xa6f3('0x8')],_0x17c6a6['statusCode'],_0x17c6a6[_0xa6f3('0x1f')],_0x17c6a6[_0xa6f3('0x20')]));});}; \ No newline at end of file +var _0x8884=['message','request-promise','util','mustache','../../../../config/logger','trigger','toUpperCase','render','data5','number','data6','parse','error','stack','data1','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0x8884,0x194));var _0x4888=function(_0x5276b0,_0x2b179a){_0x5276b0=_0x5276b0-0x0;var _0x5f4875=_0x8884[_0x5276b0];return _0x5f4875;};'use strict';var rp=require(_0x4888('0x0'));var util=require(_0x4888('0x1'));var _=require('lodash');var Mustache=require(_0x4888('0x2'));var logger=require(_0x4888('0x3'))(_0x4888('0x4'));exports['exec']=function(_0x1133f3,_0x28fb5e){var _0x3d9639,_0x108b9f;var _0x1eaf85={'method':_0x1133f3['data1'][_0x4888('0x5')](),'uri':Mustache[_0x4888('0x6')](_0x1133f3['data2'],_0x28fb5e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1133f3[_0x4888('0x7')])===_0x4888('0x8')&&parseInt(_0x1133f3[_0x4888('0x7')])>=0x1&&parseInt(_0x1133f3[_0x4888('0x7')])<=0xa?parseInt(_0x1133f3[_0x4888('0x7')])*0x3e8:0x5*0x3e8};try{_0x1eaf85['headers']=_0x1133f3[_0x4888('0x9')]?JSON[_0x4888('0xa')](Mustache[_0x4888('0x6')](_0x1133f3[_0x4888('0x9')],_0x28fb5e)):{};}catch(_0x1fb93f){logger[_0x4888('0xb')](_0x1fb93f[_0x4888('0xc')]);}switch(_0x1133f3[_0x4888('0xd')][_0x4888('0x5')]()){case'GET':case _0x4888('0xe'):_0x3d9639=null;_0x1eaf85['qs']=_0x28fb5e;break;case _0x4888('0xf'):case _0x4888('0x10'):if(_0x1133f3[_0x4888('0x11')]){try{_0x3d9639=JSON['parse'](Mustache[_0x4888('0x6')](_0x1133f3['data7'],_0x28fb5e));_0x1eaf85['body']=_0x3d9639;}catch(_0x41f599){logger[_0x4888('0xb')](_0x41f599[_0x4888('0xc')]);logger[_0x4888('0xb')](_0x4888('0x12'));}}else{_0x3d9639=_0x28fb5e;_0x1eaf85[_0x4888('0x13')]=_0x3d9639;}break;}logger[_0x4888('0x14')](util['format'](_0x4888('0x15'),_0x1133f3['data1'],_0x1133f3[_0x4888('0x16')],JSON[_0x4888('0x17')](_0x1eaf85)));rp(_0x1eaf85)['then'](function(_0xd6f5af){_0x3d9639=!_['isNil'](_0x3d9639)?_0x4888('0x18')+_0x3d9639:'';_0x108b9f=typeof _0xd6f5af[_0x4888('0x13')]==='object'?JSON[_0x4888('0x17')](_0xd6f5af[_0x4888('0x13')]):_0xd6f5af[_0x4888('0x13')];logger[_0x4888('0x14')](util[_0x4888('0x19')](_0x4888('0x1a'),_0x1133f3['data1'],_0x1133f3[_0x4888('0x16')],_0xd6f5af['statusCode'],_0x108b9f));})[_0x4888('0x1b')](function(_0x1914f9){logger['error'](util[_0x4888('0x19')](_0x4888('0x1c'),_0x1133f3[_0x4888('0xd')],_0x1133f3[_0x4888('0x16')],_0x1914f9[_0x4888('0x1d')],_0x1914f9['name'],_0x1914f9[_0x4888('0x1e')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 25bbefb..945165a 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 _0xa520=['result','catch','exports','jayson/promise','routing','client','http','Request','debug','error','rpc','message'];(function(_0x5e9831,_0x36eda4){var _0x511bd0=function(_0x108c20){while(--_0x108c20){_0x5e9831['push'](_0x5e9831['shift']());}};_0x511bd0(++_0x36eda4);}(_0xa520,0x15f));var _0x0a52=function(_0x1846f2,_0x353922){_0x1846f2=_0x1846f2-0x0;var _0x3f2021=_0xa520[_0x1846f2];return _0x3f2021;};'use strict';var jayson=require(_0x0a52('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x0a52('0x1'));var client=jayson[_0x0a52('0x2')][_0x0a52('0x3')]({'port':0x2329});client[_0x0a52('0x4')]=function(_0x258e0e,_0x239613){return new BPromise(function(_0x5f12c9,_0xb349e5){return client['request'](_0x258e0e,_0x239613)['then'](function(_0x402174){logger[_0x0a52('0x5')]('rpc',_0x0a52('0x1'),_0x258e0e,_0x239613,_0x402174);if(_0x402174[_0x0a52('0x6')]){logger[_0x0a52('0x6')](_0x0a52('0x7'),_0x0a52('0x1'),_0x258e0e,_0x402174[_0x0a52('0x6')][_0x0a52('0x8')],_0x239613);return _0xb349e5(_0x402174['error'][_0x0a52('0x8')]);}else{return _0x5f12c9(_0x402174[_0x0a52('0x9')]);}})[_0x0a52('0xa')](function(_0x56a3f5){logger[_0x0a52('0x6')]('rpc',_0x0a52('0x1'),_0x258e0e,_0x56a3f5,_0x239613);return _0xb349e5(_0x56a3f5);});});};module[_0x0a52('0xb')]=client; \ No newline at end of file +var _0xf88e=['request','debug','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf88e,0x19a));var _0xef88=function(_0x6bec06,_0x30b172){_0x6bec06=_0x6bec06-0x0;var _0x30e317=_0xf88e[_0x6bec06];return _0x30e317;};'use strict';var jayson=require(_0xef88('0x0'));var BPromise=require(_0xef88('0x1'));var logger=require(_0xef88('0x2'))(_0xef88('0x3'));var client=jayson[_0xef88('0x4')][_0xef88('0x5')]({'port':0x2329});client['Request']=function(_0x577360,_0x120fc9){return new BPromise(function(_0x5a9de4,_0x113fea){return client[_0xef88('0x6')](_0x577360,_0x120fc9)['then'](function(_0xf01a8a){logger[_0xef88('0x7')]('rpc',_0xef88('0x3'),_0x577360,_0x120fc9,_0xf01a8a);if(_0xf01a8a[_0xef88('0x8')]){logger[_0xef88('0x8')]('rpc',_0xef88('0x3'),_0x577360,_0xf01a8a[_0xef88('0x8')][_0xef88('0x9')],_0x120fc9);return _0x113fea(_0xf01a8a[_0xef88('0x8')][_0xef88('0x9')]);}else{return _0x5a9de4(_0xf01a8a[_0xef88('0xa')]);}})[_0xef88('0xb')](function(_0x33eed4){logger[_0xef88('0x8')]('rpc',_0xef88('0x3'),_0x577360,_0x33eed4,_0x120fc9);return _0x113fea(_0x33eed4);});});};module[_0xef88('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9c989b0..51dfcfe 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 _0xe08e=['then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve'];(function(_0x58968d,_0x34b991){var _0x9c949f=function(_0x37e66b){while(--_0x37e66b){_0x58968d['push'](_0x58968d['shift']());}};_0x9c949f(++_0x34b991);}(_0xe08e,0x1ac));var _0xee08=function(_0x56123b,_0x111c41){_0x56123b=_0x56123b-0x0;var _0x234b51=_0xe08e[_0x56123b];return _0x234b51;};'use strict';var server=require(_0xee08('0x0'));var Realtime=require(_0xee08('0x1'));var EmailChannel=require(_0xee08('0x2'));var mailAccount=require(_0xee08('0x3'));var setting=require('./rpc/setting');var logger=require(_0xee08('0x4'))(_0xee08('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xee08('0x6')]()[_0xee08('0x7')](mailAccount['getMailAccounts']())[_0xee08('0x7')](realtime[_0xee08('0x8')]())['then'](function(){email['refresh'](realtime[_0xee08('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xee08('0x7')](function(){return initRealtime();})[_0xee08('0x7')](function(){return setting[_0xee08('0xa')]();})[_0xee08('0x7')](function(_0x39d9f8){return setInterval(initRealtime,_0x39d9f8[_0xee08('0xb')]*0x3e8);})[_0xee08('0xc')](function(_0x2468b3){logger[_0xee08('0xd')](_0xee08('0xe'),_0x2468b3);});}main(); \ No newline at end of file +var _0x290d=['mailAccounts','getSettings','loginMailFrequency','catch','error','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x3c8d8c,_0x3ae344){var _0x2f5589=function(_0x20587e){while(--_0x20587e){_0x3c8d8c['push'](_0x3c8d8c['shift']());}};_0x2f5589(++_0x3ae344);}(_0x290d,0x135));var _0xd290=function(_0x539e54,_0x5c044c){_0x539e54=_0x539e54-0x0;var _0x94e144=_0x290d[_0x539e54];return _0x94e144;};'use strict';var server=require('./server');var Realtime=require(_0xd290('0x0'));var EmailChannel=require(_0xd290('0x1'));var mailAccount=require(_0xd290('0x2'));var setting=require(_0xd290('0x3'));var logger=require(_0xd290('0x4'))(_0xd290('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xd290('0x6')]()['then'](mailAccount[_0xd290('0x7')]())[_0xd290('0x8')](realtime[_0xd290('0x9')]())[_0xd290('0x8')](function(){email[_0xd290('0xa')](realtime[_0xd290('0xb')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xd290('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xd290('0xc')]();})[_0xd290('0x8')](function(_0x4c38b6){return setInterval(initRealtime,_0x4c38b6[_0xd290('0xd')]*0x3e8);})[_0xd290('0xe')](function(_0x46008f){logger[_0xd290('0xf')]('Email\x20service\x20initialization',_0x46008f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 75ba470..99b3985 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 _0xdd6e=['./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','status','Imap','messageStatus','total','isNil','md5','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','box','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','catch','lodash','moment','bluebird','../../../config/environment','../../../config/logger','email','defaults','redis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd6e,0x110));var _0xedd6=function(_0xe9a765,_0xecf779){_0xe9a765=_0xe9a765-0x0;var _0x3efaa5=_0xdd6e[_0xe9a765];return _0x3efaa5;};'use strict';var _=require(_0xedd6('0x0'));var moment=require(_0xedd6('0x1'));var BPromise=require(_0xedd6('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xedd6('0x3'));var logger=require(_0xedd6('0x4'))(_0xedd6('0x5'));config['redis']=_[_0xedd6('0x6')](config[_0xedd6('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xedd6('0x8'));var EmailSmtp=require(_0xedd6('0x9'));var mailAccount=require(_0xedd6('0xa'));var md5Accounts={};function EmailChannel(_0x3d90bc){logger[_0xedd6('0xb')]('start\x20email\x20channel');this[_0xedd6('0xc')]=_0x3d90bc[_0xedd6('0xc')];this[_0xedd6('0xd')]={};this[_0xedd6('0xe')]=new EmailSmtp();}EmailChannel[_0xedd6('0xf')][_0xedd6('0x10')]=function(_0x103069){var _0x1118e7=this[_0xedd6('0xc')][_0x103069];var _0x4210db={'id':_0x1118e7['id'],'name':_0x1118e7['name'],'key':_0x1118e7[_0xedd6('0x11')],'active':_0x1118e7['active'],'Imap':{'status':_0x1118e7['Imap'][_0xedd6('0x12')],'messageStatus':_0x1118e7[_0xedd6('0x13')][_0xedd6('0x14')],'total':_0x1118e7[_0xedd6('0x13')][_0xedd6('0x15')]}};if(_[_0xedd6('0x16')](md5Accounts[_0x103069])){md5Accounts[_0x103069]={};}var _0x247f14=md5(JSON['stringify'](_0x4210db));if(md5Accounts[_0x103069]['md5']!==_0x247f14){md5Accounts[_0x103069][_0xedd6('0x17')]=_0x247f14;io['emit'](_0xedd6('0x18'),_0x4210db);}};EmailChannel['prototype'][_0xedd6('0x19')]=function(_0x4cfaf5){for(var _0x4c72a7 in _0x4cfaf5){if(_0x4cfaf5[_0xedd6('0x1a')](_0x4c72a7)){if(_0x4cfaf5[_0x4c72a7]['Imap']&&_0x4cfaf5[_0x4c72a7][_0xedd6('0x1b')]){var _0x480c5d=_0x4cfaf5[_0x4c72a7][_0xedd6('0x13')];if(!_0x480c5d[_0xedd6('0x1c')]&&_0x4cfaf5[_0x4c72a7][_0xedd6('0x1d')]!==_0xedd6('0x1e'))_0x480c5d[_0xedd6('0x1c')]=_0x4cfaf5[_0x4c72a7][_0xedd6('0x1d')];if(!this['imapAccounts'][_0xedd6('0x1a')](_0x480c5d['id'])){this['imapAccounts'][_0x480c5d['id']]=new EmailImap(_0x480c5d,_0x4cfaf5[_0x4c72a7]['email']);this['imapAccounts'][_0x480c5d['id']]['on'](_0xedd6('0x1f'),this['handleImapBox'][_0xedd6('0x20')](this,_0x4c72a7));this[_0xedd6('0xd')][_0x480c5d['id']]['on'](_0xedd6('0x5'),this['handleImapEmail'][_0xedd6('0x20')](this,_0x4c72a7));this['imapAccounts'][_0x480c5d['id']]['on'](_0xedd6('0x21'),this[_0xedd6('0x22')][_0xedd6('0x20')](this,_0x4c72a7));this[_0xedd6('0xd')][_0x480c5d['id']]['on'](_0xedd6('0x23'),this[_0xedd6('0x24')][_0xedd6('0x20')](this,_0x4c72a7));}}else{if(_[_0xedd6('0x16')](this[_0xedd6('0xc')][_0x4c72a7]['Imap'])){this[_0xedd6('0xc')][_0x4c72a7]['Imap']={};}this[_0xedd6('0xc')][_0x4c72a7][_0xedd6('0x13')][_0xedd6('0x12')]=_0xedd6('0x25');this['mailAccounts'][_0x4c72a7][_0xedd6('0x13')][_0xedd6('0x14')]='';this['emit'](_0x4c72a7);}}}};EmailChannel['prototype'][_0xedd6('0x26')]=function(_0x4b6810,_0x4f3abb){if(this[_0xedd6('0xc')][_0x4b6810]){this['mailAccounts'][_0x4b6810][_0xedd6('0x13')]['status']=_0xedd6('0x27');this[_0xedd6('0xc')][_0x4b6810][_0xedd6('0x13')]['messageStatus']=_0x4f3abb[_0xedd6('0x28')];if(_0x4f3abb['messages']){this[_0xedd6('0xc')][_0x4b6810]['Imap'][_0xedd6('0x15')]=_0x4f3abb[_0xedd6('0x29')]['total'];}return this[_0xedd6('0x10')](_0x4b6810);}};EmailChannel[_0xedd6('0xf')]['handleImapEmail']=function(_0x8c8c0b,_0x47eb3a){logger['info'](_0xedd6('0x2a'),_0x47eb3a[_0xedd6('0x2b')],_0x47eb3a[_0xedd6('0x2c')],_0x47eb3a['from'],_0x8c8c0b);if(this[_0xedd6('0xc')][_0x8c8c0b]){return mailAccount[_0xedd6('0x2d')](_0x8c8c0b,_0x47eb3a)['then'](function(_0x3e2dac){if(_0x3e2dac){logger[_0xedd6('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x1c3c61){logger['error'](_0xedd6('0x2e'),JSON[_0xedd6('0x2f')](_0x1c3c61));});}};EmailChannel['prototype'][_0xedd6('0x22')]=function(_0x2377fa){if(this['mailAccounts'][_0x2377fa]&&this[_0xedd6('0xc')][_0x2377fa]['Imap']){if(this[_0xedd6('0xd')][this[_0xedd6('0xc')][_0x2377fa][_0xedd6('0x13')]['id']]){delete this[_0xedd6('0xd')][this[_0xedd6('0xc')][_0x2377fa]['Imap']['id']];}this['mailAccounts'][_0x2377fa][_0xedd6('0x13')]['lastSync']=moment();this[_0xedd6('0x10')](_0x2377fa);}};EmailChannel[_0xedd6('0xf')]['handleImapError']=function(_0x2aa689,_0xea0592){if(this[_0xedd6('0xc')][_0x2aa689]){this[_0xedd6('0xc')][_0x2aa689][_0xedd6('0x13')]['status']=_0xedd6('0x23');this['mailAccounts'][_0x2aa689][_0xedd6('0x13')][_0xedd6('0x14')]=_0xea0592;return this[_0xedd6('0x10')](_0x2aa689);}};EmailChannel[_0xedd6('0xf')][_0xedd6('0x30')]=function(_0x3c9732,_0x3ecc0e){return this[_0xedd6('0xe')][_0xedd6('0x31')](_0x3c9732,_0x3ecc0e);};EmailChannel[_0xedd6('0xf')][_0xedd6('0x32')]=function(_0x60bf20){var _0x534a09=this;if(this['mailAccounts'][_0x60bf20['id']]){if(_[_0xedd6('0x16')](this[_0xedd6('0xc')][_0x60bf20['id']]['Smtp'])){this[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]={};}this[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')][_0xedd6('0x34')]=moment();return new BPromise(function(_0xd44121,_0x44b470){return _0x534a09[_0xedd6('0xe')][_0xedd6('0x35')](_0x60bf20)[_0xedd6('0x36')](function(_0x200fde){_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')][_0xedd6('0x12')]='verified';_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]['messageStatus']='';_0x534a09[_0xedd6('0x10')](_0x60bf20['id']);_0xd44121(_0x200fde);})[_0xedd6('0x37')](function(_0x1d5d51){_0x534a09[_0xedd6('0xc')][_0x60bf20['id']]['Smtp'][_0xedd6('0x12')]=_0xedd6('0x23');_0x534a09[_0xedd6('0xc')][_0x60bf20['id']][_0xedd6('0x33')]['messageStatus']=_0x1d5d51;_0x534a09[_0xedd6('0x10')](_0x60bf20['id']);_0x44b470(_0x1d5d51);});});}return this[_0xedd6('0xe')][_0xedd6('0x35')](_0x60bf20);};module['exports']=EmailChannel; \ No newline at end of file +var _0xa2e7=['bluebird','md5','ioredis','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','service','provider','custom','imapAccounts','bind','end','handleImapEnd','error','handleImapError','status','disabled','handleImapBox','connected','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','exports','lodash','moment'];(function(_0x718fe9,_0x207ebc){var _0x24dc33=function(_0x161f79){while(--_0x161f79){_0x718fe9['push'](_0x718fe9['shift']());}};_0x24dc33(++_0x207ebc);}(_0xa2e7,0x6e));var _0x7a2e=function(_0x1b7ba7,_0x5f1a2a){_0x1b7ba7=_0x1b7ba7-0x0;var _0xc7ab78=_0xa2e7[_0x1b7ba7];return _0xc7ab78;};'use strict';var _=require(_0x7a2e('0x0'));var moment=require(_0x7a2e('0x1'));var BPromise=require(_0x7a2e('0x2'));var md5=require(_0x7a2e('0x3'));var Redis=require(_0x7a2e('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x7a2e('0x5'));config[_0x7a2e('0x6')]=_[_0x7a2e('0x7')](config[_0x7a2e('0x6')],{'host':_0x7a2e('0x8'),'port':0x18eb});var io=require(_0x7a2e('0x9'))(new Redis(config[_0x7a2e('0x6')]));var EmailImap=require(_0x7a2e('0xa'));var EmailSmtp=require(_0x7a2e('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2adcb1){logger['info']('start\x20email\x20channel');this[_0x7a2e('0xc')]=_0x2adcb1[_0x7a2e('0xc')];this['imapAccounts']={};this[_0x7a2e('0xd')]=new EmailSmtp();}EmailChannel[_0x7a2e('0xe')]['emit']=function(_0x4f471a){var _0x2a4657=this['mailAccounts'][_0x4f471a];var _0x4fba11={'id':_0x2a4657['id'],'name':_0x2a4657[_0x7a2e('0xf')],'key':_0x2a4657[_0x7a2e('0x10')],'active':_0x2a4657[_0x7a2e('0x11')],'Imap':{'status':_0x2a4657[_0x7a2e('0x12')]['status'],'messageStatus':_0x2a4657[_0x7a2e('0x12')][_0x7a2e('0x13')],'total':_0x2a4657[_0x7a2e('0x12')][_0x7a2e('0x14')]}};if(_[_0x7a2e('0x15')](md5Accounts[_0x4f471a])){md5Accounts[_0x4f471a]={};}var _0x2b0aa0=md5(JSON[_0x7a2e('0x16')](_0x4fba11));if(md5Accounts[_0x4f471a][_0x7a2e('0x3')]!==_0x2b0aa0){md5Accounts[_0x4f471a][_0x7a2e('0x3')]=_0x2b0aa0;io[_0x7a2e('0x17')](_0x7a2e('0x18'),_0x4fba11);}};EmailChannel[_0x7a2e('0xe')]['refresh']=function(_0x578b28){for(var _0x2e95bf in _0x578b28){if(_0x578b28[_0x7a2e('0x19')](_0x2e95bf)){if(_0x578b28[_0x2e95bf][_0x7a2e('0x12')]&&_0x578b28[_0x2e95bf][_0x7a2e('0x11')]){var _0x4f8dca=_0x578b28[_0x2e95bf][_0x7a2e('0x12')];if(!_0x4f8dca[_0x7a2e('0x1a')]&&_0x578b28[_0x2e95bf][_0x7a2e('0x1b')]!==_0x7a2e('0x1c'))_0x4f8dca[_0x7a2e('0x1a')]=_0x578b28[_0x2e95bf]['provider'];if(!this[_0x7a2e('0x1d')][_0x7a2e('0x19')](_0x4f8dca['id'])){this['imapAccounts'][_0x4f8dca['id']]=new EmailImap(_0x4f8dca,_0x578b28[_0x2e95bf][_0x7a2e('0x5')]);this[_0x7a2e('0x1d')][_0x4f8dca['id']]['on']('box',this['handleImapBox'][_0x7a2e('0x1e')](this,_0x2e95bf));this['imapAccounts'][_0x4f8dca['id']]['on'](_0x7a2e('0x5'),this['handleImapEmail'][_0x7a2e('0x1e')](this,_0x2e95bf));this[_0x7a2e('0x1d')][_0x4f8dca['id']]['on'](_0x7a2e('0x1f'),this[_0x7a2e('0x20')]['bind'](this,_0x2e95bf));this[_0x7a2e('0x1d')][_0x4f8dca['id']]['on'](_0x7a2e('0x21'),this[_0x7a2e('0x22')][_0x7a2e('0x1e')](this,_0x2e95bf));}}else{if(_[_0x7a2e('0x15')](this['mailAccounts'][_0x2e95bf][_0x7a2e('0x12')])){this[_0x7a2e('0xc')][_0x2e95bf]['Imap']={};}this[_0x7a2e('0xc')][_0x2e95bf][_0x7a2e('0x12')][_0x7a2e('0x23')]=_0x7a2e('0x24');this['mailAccounts'][_0x2e95bf][_0x7a2e('0x12')][_0x7a2e('0x13')]='';this[_0x7a2e('0x17')](_0x2e95bf);}}}};EmailChannel['prototype'][_0x7a2e('0x25')]=function(_0x5e4784,_0x42bdcb){if(this[_0x7a2e('0xc')][_0x5e4784]){this['mailAccounts'][_0x5e4784][_0x7a2e('0x12')]['status']=_0x7a2e('0x26');this[_0x7a2e('0xc')][_0x5e4784][_0x7a2e('0x12')][_0x7a2e('0x13')]=_0x42bdcb[_0x7a2e('0xf')];if(_0x42bdcb[_0x7a2e('0x27')]){this[_0x7a2e('0xc')][_0x5e4784][_0x7a2e('0x12')][_0x7a2e('0x14')]=_0x42bdcb[_0x7a2e('0x27')][_0x7a2e('0x14')];}return this[_0x7a2e('0x17')](_0x5e4784);}};EmailChannel[_0x7a2e('0xe')][_0x7a2e('0x28')]=function(_0x30aaed,_0x1794e9){logger[_0x7a2e('0x29')](_0x7a2e('0x2a'),_0x1794e9['firstName'],_0x1794e9[_0x7a2e('0x2b')],_0x1794e9[_0x7a2e('0x2c')],_0x30aaed);if(this[_0x7a2e('0xc')][_0x30aaed]){return mailAccount['notify'](_0x30aaed,_0x1794e9)[_0x7a2e('0x2d')](function(_0x4c2cfc){if(_0x4c2cfc){logger['info'](_0x7a2e('0x2e'));}})[_0x7a2e('0x2f')](function(_0x55cfef){logger[_0x7a2e('0x21')](_0x7a2e('0x30'),JSON[_0x7a2e('0x16')](_0x55cfef));});}};EmailChannel[_0x7a2e('0xe')]['handleImapEnd']=function(_0x20b6b8){if(this['mailAccounts'][_0x20b6b8]&&this[_0x7a2e('0xc')][_0x20b6b8][_0x7a2e('0x12')]){if(this[_0x7a2e('0x1d')][this['mailAccounts'][_0x20b6b8][_0x7a2e('0x12')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x20b6b8]['Imap']['id']];}this[_0x7a2e('0xc')][_0x20b6b8][_0x7a2e('0x12')][_0x7a2e('0x31')]=moment();this['emit'](_0x20b6b8);}};EmailChannel[_0x7a2e('0xe')][_0x7a2e('0x22')]=function(_0x1da7e1,_0x1bcd73){if(this['mailAccounts'][_0x1da7e1]){this[_0x7a2e('0xc')][_0x1da7e1][_0x7a2e('0x12')][_0x7a2e('0x23')]='error';this['mailAccounts'][_0x1da7e1][_0x7a2e('0x12')]['messageStatus']=_0x1bcd73;return this[_0x7a2e('0x17')](_0x1da7e1);}};EmailChannel[_0x7a2e('0xe')][_0x7a2e('0x32')]=function(_0xaab2af,_0x3d134f){return this[_0x7a2e('0xd')]['send'](_0xaab2af,_0x3d134f);};EmailChannel['prototype'][_0x7a2e('0x33')]=function(_0x5e11b5){var _0x250af9=this;if(this[_0x7a2e('0xc')][_0x5e11b5['id']]){if(_[_0x7a2e('0x15')](this[_0x7a2e('0xc')][_0x5e11b5['id']][_0x7a2e('0x34')])){this['mailAccounts'][_0x5e11b5['id']][_0x7a2e('0x34')]={};}this[_0x7a2e('0xc')][_0x5e11b5['id']][_0x7a2e('0x34')][_0x7a2e('0x31')]=moment();return new BPromise(function(_0x1fdb6b,_0x27e076){return _0x250af9[_0x7a2e('0xd')][_0x7a2e('0x35')](_0x5e11b5)[_0x7a2e('0x2d')](function(_0x413b80){_0x250af9[_0x7a2e('0xc')][_0x5e11b5['id']][_0x7a2e('0x34')]['status']=_0x7a2e('0x36');_0x250af9[_0x7a2e('0xc')][_0x5e11b5['id']][_0x7a2e('0x34')][_0x7a2e('0x13')]='';_0x250af9[_0x7a2e('0x17')](_0x5e11b5['id']);_0x1fdb6b(_0x413b80);})[_0x7a2e('0x2f')](function(_0x218baf){_0x250af9['mailAccounts'][_0x5e11b5['id']][_0x7a2e('0x34')][_0x7a2e('0x23')]='error';_0x250af9['mailAccounts'][_0x5e11b5['id']][_0x7a2e('0x34')][_0x7a2e('0x13')]=_0x218baf;_0x250af9[_0x7a2e('0x17')](_0x5e11b5['id']);_0x27e076(_0x218baf);});});}return this[_0x7a2e('0xd')]['verify'](_0x5e11b5);};module[_0x7a2e('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 150a969..b188348 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 _0xb934=['service','user','modernAuthentication','xoauth2','data5','password','authentication','host','autotls','openBox','handleOpenBox','emit','readUnseen','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','stringify','hasOwnProperty','upperFirst','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb934,0x92));var _0x4b93=function(_0x4a5c95,_0x1f4f83){_0x4a5c95=_0x4a5c95-0x0;var _0xeb6e95=_0xb934[_0x4a5c95];return _0xeb6e95;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var Imap=require(_0x4b93('0x2'));var simpleParser=require('mailparser')[_0x4b93('0x3')];var Iconv=require(_0x4b93('0x4'))[_0x4b93('0x5')];var EventEmitter=require(_0x4b93('0x6'))[_0x4b93('0x7')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x4b93('0x8'));function EmailImap(_0x1fa8af,_0x2ea5ad){this[_0x4b93('0x9')]='INBOX';this[_0x4b93('0xa')]=this[_0x4b93('0xb')](_0x1fa8af,_0x2ea5ad);this[_0x4b93('0x2')]=new Imap(this[_0x4b93('0xa')]);this[_0x4b93('0x2')][_0x4b93('0xc')](_0x4b93('0xd'),this[_0x4b93('0xe')][_0x4b93('0xf')](this));this['imap'][_0x4b93('0xc')](_0x4b93('0x10'),this[_0x4b93('0x11')][_0x4b93('0xf')](this));this[_0x4b93('0x2')]['on'](_0x4b93('0x12'),this[_0x4b93('0x13')][_0x4b93('0xf')](this));this[_0x4b93('0x2')][_0x4b93('0x14')]();}util[_0x4b93('0x15')](EmailImap,EventEmitter);EmailImap[_0x4b93('0x16')][_0x4b93('0xb')]=function(_0x3f4db7,_0x11dd47){var _0x4f7c7a={'connTimeout':_0x3f4db7[_0x4b93('0x17')]?_0x3f4db7[_0x4b93('0x17')]*0x3e8:0x2710,'authTimeout':_0x3f4db7[_0x4b93('0x18')]?_0x3f4db7['authTimeout']*0x3e8:0x1388};if(_0x3f4db7[_0x4b93('0x19')]){_0x4f7c7a[_0x4b93('0x1a')]=_0x3f4db7[_0x4b93('0x1a')];_0x4f7c7a[_0x4b93('0x8')]=_0x11dd47||_0x3f4db7[_0x4b93('0x1a')]||'anonymous@xcally.com';if(_0x3f4db7[_0x4b93('0x1b')]){_0x4f7c7a[_0x4b93('0x1c')]=utils['generateXOAuth2Token'](_0x3f4db7['CloudProvider'][_0x4b93('0x1d')],_0x3f4db7[_0x4b93('0x1a')]);}else{_0x4f7c7a[_0x4b93('0x1e')]=_0x3f4db7[_0x4b93('0x1e')];}}else{if(_0x3f4db7[_0x4b93('0x1f')]){_0x4f7c7a[_0x4b93('0x1a')]=_0x3f4db7[_0x4b93('0x1a')];_0x4f7c7a[_0x4b93('0x1e')]=_0x3f4db7[_0x4b93('0x1e')];}}_0x4f7c7a[_0x4b93('0x20')]=_0x3f4db7[_0x4b93('0x20')];_0x4f7c7a['port']=_0x3f4db7['port']||0x3e1;if(_0x3f4db7['tls']){_0x4f7c7a['tls']=!![];}else{_0x4f7c7a['tls']=![];_0x4f7c7a[_0x4b93('0x21')]='required';}return _0x4f7c7a;};EmailImap[_0x4b93('0x16')][_0x4b93('0xe')]=function(){this[_0x4b93('0x2')][_0x4b93('0x22')](this[_0x4b93('0x9')],![],this[_0x4b93('0x23')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')]['handleOpenBox']=function(_0x5691ba,_0x1a74eb){if(_0x5691ba){this['handleError'](_0x5691ba,!![]);}else{this[_0x4b93('0x24')]('box',_0x1a74eb);this[_0x4b93('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x302b93){if(_0x302b93){this[_0x4b93('0x13')](_0x302b93,!![]);}else{this[_0x4b93('0x2')][_0x4b93('0x10')]();}};EmailImap[_0x4b93('0x16')][_0x4b93('0x25')]=function(){this[_0x4b93('0x2')][_0x4b93('0x26')](['UNSEEN'],this[_0x4b93('0x27')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')]['handleReadUnseen']=function(_0x418371,_0x5f3ab3){if(_0x418371){this['handleError'](_0x418371,!![]);}else{if(_0x5f3ab3[_0x4b93('0x28')]){try{var _0x2fb254=this[_0x4b93('0x2')][_0x4b93('0x29')](_0x5f3ab3,{'bodies':'','markSeen':!![]});_0x2fb254['on'](_0x4b93('0x2a'),this[_0x4b93('0x2b')][_0x4b93('0xf')](this));_0x2fb254[_0x4b93('0xc')](_0x4b93('0x12'),this[_0x4b93('0x2c')]['bind'](this));_0x2fb254[_0x4b93('0xc')]('end',this['handleFetchEnd'][_0x4b93('0xf')](this));}catch(_0x278bdb){logger[_0x4b93('0x12')](_0x278bdb);}}else{this[_0x4b93('0x2')][_0x4b93('0x2d')](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));}}};EmailImap[_0x4b93('0x16')]['handleFetchMessage']=function(_0x34d8d8){_0x34d8d8['on'](_0x4b93('0x2f'),this['handleMessageBody']['bind'](this));_0x34d8d8[_0x4b93('0xc')](_0x4b93('0x30'),this[_0x4b93('0x31')][_0x4b93('0xf')](this));_0x34d8d8[_0x4b93('0xc')]('end',this[_0x4b93('0x32')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')][_0x4b93('0x33')]=function(_0xef2db3){simpleParser(_0xef2db3,{'Iconv':Iconv},this[_0x4b93('0x34')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x4b93('0x32')]=function(){};EmailImap[_0x4b93('0x16')]['handleSimpleParser']=function(_0x365dca,_0x3c22bc){if(_0x365dca){logger[_0x4b93('0x12')](_0x365dca);}else{var _0x349295=this;utils['parser'](this[_0x4b93('0xa')],_0x3c22bc,function(_0x3bcea4){_0x349295['emit'](_0x4b93('0x8'),_0x3bcea4);});}};EmailImap['prototype'][_0x4b93('0x35')]=function(){this['imap']['closeBox'](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));};EmailImap['prototype']['handleFetchError']=function(_0x33eea9){this[_0x4b93('0x13')](_0x33eea9);this[_0x4b93('0x2')][_0x4b93('0x2d')](!![],this[_0x4b93('0x2e')][_0x4b93('0xf')](this));};EmailImap[_0x4b93('0x16')][_0x4b93('0x11')]=function(){this['emit'](_0x4b93('0x10'));};EmailImap['prototype'][_0x4b93('0x13')]=function(_0x5c4cfe,_0x3b5257){logger[_0x4b93('0x12')](_0x4b93('0x13'),this['account'][_0x4b93('0x8')],JSON[_0x4b93('0x36')](_0x5c4cfe));var _0x5f5604='';if(_0x5c4cfe){if(_0x5c4cfe['textCode']){_0x5f5604=_0x5c4cfe['textCode'];}else{for(var _0x48491d in _0x5c4cfe){if(_0x5c4cfe[_0x4b93('0x37')](_0x48491d)){_0x5f5604+=_[_0x4b93('0x38')](_0x48491d)+':\x20'+_0x5c4cfe[_0x48491d]+'\x0a';}}}}if(_0x3b5257){this[_0x4b93('0x2')][_0x4b93('0x10')]();}else{this['emit']('error',_0x5f5604);this[_0x4b93('0x24')](_0x4b93('0x10'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3a6d=['closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','handleFetchEnd','stringify','textCode','hasOwnProperty','emit','exports','lodash','util','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','imap','once','ready','handleReady','bind','end','handleEnd','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchError'];(function(_0x3a37df,_0x46c381){var _0x33845c=function(_0x276b10){while(--_0x276b10){_0x3a37df['push'](_0x3a37df['shift']());}};_0x33845c(++_0x46c381);}(_0x3a6d,0x143));var _0xd3a6=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3a6d[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var Imap=require('imap');var simpleParser=require(_0xd3a6('0x2'))[_0xd3a6('0x3')];var Iconv=require(_0xd3a6('0x4'))[_0xd3a6('0x5')];var EventEmitter=require(_0xd3a6('0x6'))['EventEmitter'];var utils=require(_0xd3a6('0x7'));var logger=require(_0xd3a6('0x8'))(_0xd3a6('0x9'));function EmailImap(_0x1fc450,_0x25b042){this[_0xd3a6('0xa')]='INBOX';this[_0xd3a6('0xb')]=this[_0xd3a6('0xc')](_0x1fc450,_0x25b042);this[_0xd3a6('0xd')]=new Imap(this[_0xd3a6('0xb')]);this[_0xd3a6('0xd')][_0xd3a6('0xe')](_0xd3a6('0xf'),this[_0xd3a6('0x10')][_0xd3a6('0x11')](this));this['imap'][_0xd3a6('0xe')](_0xd3a6('0x12'),this[_0xd3a6('0x13')][_0xd3a6('0x11')](this));this[_0xd3a6('0xd')]['on']('error',this['handleError']['bind'](this));this[_0xd3a6('0xd')][_0xd3a6('0x14')]();}util[_0xd3a6('0x15')](EmailImap,EventEmitter);EmailImap[_0xd3a6('0x16')][_0xd3a6('0xc')]=function(_0x2911a0,_0xa56452){var _0x4e67fb={'connTimeout':_0x2911a0[_0xd3a6('0x17')]?_0x2911a0[_0xd3a6('0x17')]*0x3e8:0x2710,'authTimeout':_0x2911a0[_0xd3a6('0x18')]?_0x2911a0['authTimeout']*0x3e8:0x1388};if(_0x2911a0[_0xd3a6('0x19')]){_0x4e67fb[_0xd3a6('0x1a')]=_0x2911a0[_0xd3a6('0x1a')];_0x4e67fb['email']=_0xa56452||_0x2911a0[_0xd3a6('0x1a')]||'anonymous@xcally.com';if(_0x2911a0['modernAuthentication']){_0x4e67fb[_0xd3a6('0x1b')]=utils[_0xd3a6('0x1c')](_0x2911a0[_0xd3a6('0x1d')][_0xd3a6('0x1e')],_0x2911a0[_0xd3a6('0x1a')]);}else{_0x4e67fb[_0xd3a6('0x1f')]=_0x2911a0[_0xd3a6('0x1f')];}}else{if(_0x2911a0['authentication']){_0x4e67fb[_0xd3a6('0x1a')]=_0x2911a0['user'];_0x4e67fb[_0xd3a6('0x1f')]=_0x2911a0[_0xd3a6('0x1f')];}}_0x4e67fb[_0xd3a6('0x20')]=_0x2911a0[_0xd3a6('0x20')];_0x4e67fb[_0xd3a6('0x21')]=_0x2911a0[_0xd3a6('0x21')]||0x3e1;if(_0x2911a0['tls']){_0x4e67fb[_0xd3a6('0x22')]=!![];}else{_0x4e67fb[_0xd3a6('0x22')]=![];_0x4e67fb['autotls']='required';}return _0x4e67fb;};EmailImap['prototype']['handleReady']=function(){this['imap'][_0xd3a6('0x23')](this[_0xd3a6('0xa')],![],this[_0xd3a6('0x24')]['bind'](this));};EmailImap[_0xd3a6('0x16')]['handleOpenBox']=function(_0x350a11,_0x16afc8){if(_0x350a11){this[_0xd3a6('0x25')](_0x350a11,!![]);}else{this['emit'](_0xd3a6('0x26'),_0x16afc8);this[_0xd3a6('0x27')]();}};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x28')]=function(_0x169d11){if(_0x169d11){this[_0xd3a6('0x25')](_0x169d11,!![]);}else{this['imap'][_0xd3a6('0x12')]();}};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x27')]=function(){this[_0xd3a6('0xd')][_0xd3a6('0x29')]([_0xd3a6('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x2b')]=function(_0x35981c,_0x1fd9e5){if(_0x35981c){this['handleError'](_0x35981c,!![]);}else{if(_0x1fd9e5[_0xd3a6('0x2c')]){try{var _0xa4efd=this['imap'][_0xd3a6('0x2d')](_0x1fd9e5,{'bodies':'','markSeen':!![]});_0xa4efd['on']('message',this[_0xd3a6('0x2e')][_0xd3a6('0x11')](this));_0xa4efd[_0xd3a6('0xe')](_0xd3a6('0x2f'),this[_0xd3a6('0x30')][_0xd3a6('0x11')](this));_0xa4efd[_0xd3a6('0xe')]('end',this['handleFetchEnd'][_0xd3a6('0x11')](this));}catch(_0x155640){logger[_0xd3a6('0x2f')](_0x155640);}}else{this['imap'][_0xd3a6('0x31')](!![],this[_0xd3a6('0x28')][_0xd3a6('0x11')](this));}}};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x2e')]=function(_0x36b28a){_0x36b28a['on'](_0xd3a6('0x32'),this[_0xd3a6('0x33')]['bind'](this));_0x36b28a[_0xd3a6('0xe')](_0xd3a6('0x34'),this[_0xd3a6('0x35')][_0xd3a6('0x11')](this));_0x36b28a[_0xd3a6('0xe')](_0xd3a6('0x12'),this['handleMessageEnd'][_0xd3a6('0x11')](this));};EmailImap['prototype'][_0xd3a6('0x33')]=function(_0x459e78){simpleParser(_0x459e78,{'Iconv':Iconv},this[_0xd3a6('0x36')][_0xd3a6('0x11')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x37')]=function(){};EmailImap[_0xd3a6('0x16')]['handleSimpleParser']=function(_0x2bc0c7,_0x114784){if(_0x2bc0c7){logger['error'](_0x2bc0c7);}else{var _0x2f8e33=this;utils['parser'](this[_0xd3a6('0xb')],_0x114784,function(_0x2aa1dc){_0x2f8e33['emit'](_0xd3a6('0x9'),_0x2aa1dc);});}};EmailImap['prototype'][_0xd3a6('0x38')]=function(){this[_0xd3a6('0xd')]['closeBox'](!![],this[_0xd3a6('0x28')][_0xd3a6('0x11')](this));};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x30')]=function(_0x5e412f){this[_0xd3a6('0x25')](_0x5e412f);this[_0xd3a6('0xd')][_0xd3a6('0x31')](!![],this[_0xd3a6('0x28')][_0xd3a6('0x11')](this));};EmailImap['prototype'][_0xd3a6('0x13')]=function(){this['emit'](_0xd3a6('0x12'));};EmailImap[_0xd3a6('0x16')][_0xd3a6('0x25')]=function(_0x5469cc,_0x74242e){logger['error'](_0xd3a6('0x25'),this['account'][_0xd3a6('0x9')],JSON[_0xd3a6('0x39')](_0x5469cc));var _0x27af5b='';if(_0x5469cc){if(_0x5469cc[_0xd3a6('0x3a')]){_0x27af5b=_0x5469cc[_0xd3a6('0x3a')];}else{for(var _0x74bb6e in _0x5469cc){if(_0x5469cc[_0xd3a6('0x3b')](_0x74bb6e)){_0x27af5b+=_['upperFirst'](_0x74bb6e)+':\x20'+_0x5469cc[_0x74bb6e]+'\x0a';}}}}if(_0x74242e){this[_0xd3a6('0xd')][_0xd3a6('0x12')]();}else{this[_0xd3a6('0x3c')](_0xd3a6('0x2f'),_0x27af5b);this['emit'](_0xd3a6('0x12'));}};module[_0xd3a6('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6af6c7d..4c04dfb 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 _0xcfa6=['send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0xa296fb,_0x56a9ae){var _0x5a0910=function(_0x73f4f0){while(--_0x73f4f0){_0xa296fb['push'](_0xa296fb['shift']());}};_0x5a0910(++_0x56a9ae);}(_0xcfa6,0x6b));var _0x6cfa=function(_0x9a87df,_0x216aa4){_0x9a87df=_0x9a87df-0x0;var _0x4f64b4=_0xcfa6[_0x9a87df];return _0x4f64b4;};'use strict';var nodemailer=require(_0x6cfa('0x0'));var inlineBase64=require(_0x6cfa('0x1'));function EmailSmtp(){}EmailSmtp[_0x6cfa('0x2')][_0x6cfa('0x3')]=function(_0xe7bce7,_0x361984){return new Promise(function(_0x2173bc,_0x1d2a18){var _0x1f4ac5=nodemailer[_0x6cfa('0x4')](_0xe7bce7);_0x1f4ac5['use'](_0x6cfa('0x5'),inlineBase64());_0x1f4ac5[_0x6cfa('0x6')](_0x361984,function(_0x5b840b,_0x2f0992){if(_0x5b840b){_0x1d2a18(_0x5b840b[_0x6cfa('0x7')]());}else{_0x2173bc(_0x2f0992);}});});};EmailSmtp[_0x6cfa('0x2')][_0x6cfa('0x8')]=function(_0x8500bf){return new Promise(function(_0x3bfb53,_0x28a4b5){var _0x4df0e7=nodemailer[_0x6cfa('0x4')](_0x8500bf);_0x4df0e7['verify'](function(_0x36ce55,_0x2ea809){if(_0x36ce55){_0x28a4b5(_0x36ce55[_0x6cfa('0x7')]());}else{if(_0x2ea809){_0x3bfb53(_0x2ea809);}else{_0x28a4b5(_0x6cfa('0x9'));}}});});};module[_0x6cfa('0xa')]=EmailSmtp; \ No newline at end of file +var _0x1a90=['use','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x44fbe1,_0x1209a9){var _0x3c6322=function(_0x2d4c81){while(--_0x2d4c81){_0x44fbe1['push'](_0x44fbe1['shift']());}};_0x3c6322(++_0x1209a9);}(_0x1a90,0x164));var _0x01a9=function(_0x4e300d,_0x1b0a35){_0x4e300d=_0x4e300d-0x0;var _0x38730a=_0x1a90[_0x4e300d];return _0x38730a;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x01a9('0x0'));function EmailSmtp(){}EmailSmtp[_0x01a9('0x1')][_0x01a9('0x2')]=function(_0x17dc01,_0x4f9efe){return new Promise(function(_0x4f16f2,_0x12852a){var _0x56c3c1=nodemailer[_0x01a9('0x3')](_0x17dc01);_0x56c3c1[_0x01a9('0x4')]('compile',inlineBase64());_0x56c3c1[_0x01a9('0x5')](_0x4f9efe,function(_0x42d986,_0x522aed){if(_0x42d986){_0x12852a(_0x42d986[_0x01a9('0x6')]());}else{_0x4f16f2(_0x522aed);}});});};EmailSmtp['prototype'][_0x01a9('0x7')]=function(_0x2797a4){return new Promise(function(_0x526bf2,_0xd360ef){var _0x2e1447=nodemailer[_0x01a9('0x3')](_0x2797a4);_0x2e1447[_0x01a9('0x7')](function(_0x192d06,_0x129cad){if(_0x192d06){_0xd360ef(_0x192d06[_0x01a9('0x6')]());}else{if(_0x129cad){_0x526bf2(_0x129cad);}else{_0xd360ef(_0x01a9('0x8'));}}});});};module[_0x01a9('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 3099371..5468b22 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 _0xf617=['%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','email','head','value','address','generate','@xcally.com','name','indexOf','split','length','slice','Anonymous','pop','isEmpty','test','html','includes','','body','0x1?_0x134705[_0x7f61('0x10')](0x0,-0x1)['join']('\x20'):_0x2c8bbc[_0x7f61('0xc')];}return _0x7f61('0x11');}function getLastName(_0x20d89d){var _0x2d6b27=_[_0x7f61('0x7')](_0x20d89d[_0x7f61('0x8')]);if(_0x2d6b27&&_0x2d6b27[_0x7f61('0xc')]){var _0x1726c8=_0x2d6b27[_0x7f61('0xc')][_0x7f61('0xe')](/\s+/);return _0x1726c8[_0x7f61('0xf')]>0x1?_0x1726c8[_0x7f61('0x12')]():'';}return'';}function getMails(_0x691007,_0x35cf22){var _0x5305e9='';for(var _0x415efa=0x0;_0x415efa<_0x35cf22[_0x7f61('0x8')][_0x7f61('0xf')];_0x415efa+=0x1){if(_0x35cf22['value'][_0x415efa][_0x7f61('0x9')]!==_0x691007){if(!_[_0x7f61('0x13')](_0x5305e9)){_0x5305e9+=',';}_0x5305e9+=_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0xc')]||_0x35cf22[_0x7f61('0x8')][_0x415efa]['address']||'';_0x5305e9+='\x20<';_0x5305e9+=_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0x9')]?_0x35cf22[_0x7f61('0x8')][_0x415efa][_0x7f61('0x9')]:'anonymous'+random['generate'](0x6)+_0x7f61('0xb');_0x5305e9+='>';}}return _0x5305e9;}function parseEmail(_0x589dfb,_0x407ae7,_0x5ac38a){if(_0x407ae7['html']){var _0x50e745=/)<[^<]*)*<\/script>/gi;while(_0x50e745[_0x7f61('0x14')](_0x407ae7['html'])){_0x407ae7[_0x7f61('0x15')]=_0x407ae7[_0x7f61('0x15')]['replace'](_0x50e745,'');}if(_0x407ae7[_0x7f61('0x15')][_0x7f61('0x16')](_0x7f61('0x17'))){var _0xddc4ec=[];_0x407ae7[_0x7f61('0x18')][_0x7f61('0x19')](_0x123dd7=>{_0xddc4ec[_0x7f61('0x1a')](_0x123dd7[_0x7f61('0x1b')]);});var _0x2175b1=/]+>/g;var _0x4651e7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x45dcb2=_0x407ae7[_0x7f61('0x15')][_0x7f61('0x1c')](_0x4651e7,_0x7f61('0x1d'));var _0x5db072=_0x45dcb2[_0x7f61('0x1c')](_0x2175b1,_0x7f61('0x1e'));for(let _0x340479=0x0;_0x340479<_0xddc4ec[_0x7f61('0xf')];_0x340479++){var _0xd838f8=_0x5db072[_0x7f61('0x1c')](_0x7f61('0x1e'),'\x20[Attachment:\x20'+_0xddc4ec[_0x340479]+_0x7f61('0x1f'));_0x5db072=_0xd838f8;}_0x407ae7['html']=_0x5db072;}_0x5ac38a['body']=_0x407ae7[_0x7f61('0x15')];}else{_0x5ac38a['body']=_0x407ae7['textAsHtml'];}if(_0x5ac38a[_0x7f61('0x20')]){_0x5ac38a['body']=_0x5ac38a[_0x7f61('0x20')][_0x7f61('0x1c')](/0x0){var _0x5f3bc5=[_0x7f61('0x33'),_0x7f61('0x34'),_0x7f61('0x35')];for(var _0x14d3bc=0x0;_0x14d3bc<_0x407ae7[_0x7f61('0x32')][_0x7f61('0xf')];_0x14d3bc++){var _0x45f03c=_[_0x7f61('0xd')](_0x5f3bc5,_0x407ae7[_0x7f61('0x32')][_0x14d3bc][_0x7f61('0x36')]);if(_0x45f03c>=0x0){_0x5ac38a[_0x7f61('0x37')]=!![];}}}return _0x5ac38a;}exports[_0x7f61('0x38')]=function(_0x45ad6a,_0x53a2ed,_0x312320){var _0x5fdf5={'from':getAddress(_0x53a2ed[_0x7f61('0x39')]),'firstName':getFirstName(_0x53a2ed[_0x7f61('0x39')]),'lastName':getLastName(_0x53a2ed[_0x7f61('0x39')]),'mapKey':_0x7f61('0x6'),'message':{'from':getMails(_0x45ad6a[_0x7f61('0x6')],_0x53a2ed[_0x7f61('0x39')]),'to':_0x45ad6a[_0x7f61('0x6')],'cc':'','subject':_0x53a2ed[_0x7f61('0x3a')]||'','messageId':_0x53a2ed['messageId'],'inReplyTo':_0x53a2ed['inReplyTo'],'sentAt':moment(_0x53a2ed[_0x7f61('0x3b')])[_0x7f61('0x29')](_0x7f61('0x3c')),'attach':![],'attachments':[]}};if(!_0x53a2ed['html']&&!_0x53a2ed[_0x7f61('0x3d')]){var _0x42ee1e=_[_0x7f61('0x3e')](_0x53a2ed['attachments'],{'contentType':_0x7f61('0x3f')});if(_0x42ee1e['length']){logger[_0x7f61('0x40')](util[_0x7f61('0x29')](_0x7f61('0x41'),_0x53a2ed[_0x7f61('0x42')]));tnef[_0x7f61('0x43')](_[_0x7f61('0x44')](_0x42ee1e)[_0x7f61('0x30')],function(_0x146d56,_0x523a3f){if(_0x523a3f){_0x53a2ed[_0x7f61('0x15')]=_0x523a3f[_0x7f61('0x45')]||_0x7f61('0x46');if(_0x523a3f[_0x7f61('0x47')]){for(var _0x3d4bfa=0x0;_0x3d4bfa<_0x523a3f[_0x7f61('0x47')][_0x7f61('0xf')];_0x3d4bfa++){var _0x4d938b=_0x523a3f[_0x7f61('0x47')][_0x3d4bfa];_0x5fdf5[_0x7f61('0x22')][_0x7f61('0x18')][_0x7f61('0x1a')]({'filename':_0x4d938b[_0x7f61('0x48')],'content':Buffer[_0x7f61('0x39')](_0x4d938b[_0x7f61('0x49')])});}}}_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));});}else{_0x53a2ed[_0x7f61('0x15')]='

Empty\x20message

';_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));}}else{_0x312320(parseEmail(_0x45ad6a,_0x53a2ed,_0x5fdf5));}};exports['generateXOAuth2Token']=function(_0x2937b3,_0x19f6f7){var _0x322b7e=[_0x7f61('0x4a')+(_0x19f6f7||''),_0x7f61('0x4b')+_0x2937b3,'',''];return Buffer['from'](_0x322b7e[_0x7f61('0x2c')](''),_0x7f61('0x4c'))[_0x7f61('0x4d')](_0x7f61('0x4e'));}; \ No newline at end of file +var _0x1c37=['replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','node-tnef','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','split','length','join','Anonymous','value','pop','isEmpty','html','test'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c37,0x197));var _0x71c3=function(_0x3b7095,_0x49dcfd){_0x3b7095=_0x3b7095-0x0;var _0x4aec9c=_0x1c37[_0x3b7095];return _0x4aec9c;};'use strict';var _=require(_0x71c3('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x71c3('0x1'));var logger=require('../../../config/logger')(_0x71c3('0x2'));var config=require(_0x71c3('0x3'));function getAddress(_0xb6b29d){var _0x301463=_[_0x71c3('0x4')](_0xb6b29d['value']);return _0x301463&&_0x301463[_0x71c3('0x5')]?_0x301463[_0x71c3('0x5')]:_0x71c3('0x6')+random[_0x71c3('0x7')](0x6)+_0x71c3('0x8');}function getFirstName(_0x1ac00f){var _0x1d4abb=_['head'](_0x1ac00f['value']);if(_0x1d4abb&&_0x1d4abb[_0x71c3('0x9')]){if(_0x1d4abb[_0x71c3('0x9')]==_0x1d4abb['address']){return _0x1d4abb[_0x71c3('0x9')]['substring'](0x0,_0x1d4abb[_0x71c3('0x9')]['indexOf']('@'));}var _0x283012=_0x1d4abb[_0x71c3('0x9')][_0x71c3('0xa')](/\s+/);return _0x283012[_0x71c3('0xb')]>0x1?_0x283012['slice'](0x0,-0x1)[_0x71c3('0xc')]('\x20'):_0x1d4abb['name'];}return _0x71c3('0xd');}function getLastName(_0x75c357){var _0x15a0e2=_[_0x71c3('0x4')](_0x75c357[_0x71c3('0xe')]);if(_0x15a0e2&&_0x15a0e2['name']){var _0x2a722d=_0x15a0e2[_0x71c3('0x9')]['split'](/\s+/);return _0x2a722d['length']>0x1?_0x2a722d[_0x71c3('0xf')]():'';}return'';}function getMails(_0x14ebc6,_0x122a0c){var _0x2a4b4c='';for(var _0x33601c=0x0;_0x33601c<_0x122a0c[_0x71c3('0xe')][_0x71c3('0xb')];_0x33601c+=0x1){if(_0x122a0c['value'][_0x33601c][_0x71c3('0x5')]!==_0x14ebc6){if(!_[_0x71c3('0x10')](_0x2a4b4c)){_0x2a4b4c+=',';}_0x2a4b4c+=_0x122a0c[_0x71c3('0xe')][_0x33601c][_0x71c3('0x9')]||_0x122a0c['value'][_0x33601c][_0x71c3('0x5')]||'';_0x2a4b4c+='\x20<';_0x2a4b4c+=_0x122a0c['value'][_0x33601c][_0x71c3('0x5')]?_0x122a0c[_0x71c3('0xe')][_0x33601c][_0x71c3('0x5')]:_0x71c3('0x6')+random['generate'](0x6)+'@xcally.com';_0x2a4b4c+='>';}}return _0x2a4b4c;}function parseEmail(_0x5b8ded,_0x24a0de,_0x5b10e7){if(_0x24a0de[_0x71c3('0x11')]){var _0x30152b=/)<[^<]*)*<\/script>/gi;while(_0x30152b[_0x71c3('0x12')](_0x24a0de[_0x71c3('0x11')])){_0x24a0de['html']=_0x24a0de[_0x71c3('0x11')][_0x71c3('0x13')](_0x30152b,'');}if(_0x24a0de[_0x71c3('0x11')]['includes'](_0x71c3('0x14'))){var _0x3d6b7d=[];_0x24a0de['attachments'][_0x71c3('0x15')](_0x42cd26=>{_0x3d6b7d[_0x71c3('0x16')](_0x42cd26[_0x71c3('0x17')]);});var _0x50ac1d=/]+>/g;var _0x2f0729=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5e9a51=_0x24a0de[_0x71c3('0x11')][_0x71c3('0x13')](_0x2f0729,'_SRC');var _0x437510=_0x5e9a51[_0x71c3('0x13')](_0x50ac1d,_0x71c3('0x18'));for(let _0x3a1d2f=0x0;_0x3a1d2f<_0x3d6b7d[_0x71c3('0xb')];_0x3a1d2f++){var _0xef004=_0x437510[_0x71c3('0x13')]('_IMG',_0x71c3('0x19')+_0x3d6b7d[_0x3a1d2f]+'\x20]');_0x437510=_0xef004;}_0x24a0de['html']=_0x437510;}_0x5b10e7[_0x71c3('0x1a')]=_0x24a0de[_0x71c3('0x11')];}else{_0x5b10e7['body']=_0x24a0de[_0x71c3('0x1b')];}if(_0x5b10e7[_0x71c3('0x1a')]){_0x5b10e7[_0x71c3('0x1a')]=_0x5b10e7[_0x71c3('0x1a')][_0x71c3('0x13')](/0x0){var _0x38556a=[_0x71c3('0x2e'),_0x71c3('0x2f'),_0x71c3('0x30')];for(var _0x4e6859=0x0;_0x4e6859<_0x24a0de[_0x71c3('0x2d')][_0x71c3('0xb')];_0x4e6859++){var _0x2d3566=_['indexOf'](_0x38556a,_0x24a0de['headerLines'][_0x4e6859][_0x71c3('0x31')]);if(_0x2d3566>=0x0){_0x5b10e7['isAutoreply']=!![];}}}return _0x5b10e7;}exports[_0x71c3('0x32')]=function(_0x22d82e,_0x2bfeb5,_0x5eadc6){var _0x1cd1a4={'from':getAddress(_0x2bfeb5['from']),'firstName':getFirstName(_0x2bfeb5['from']),'lastName':getLastName(_0x2bfeb5['from']),'mapKey':_0x71c3('0x2'),'message':{'from':getMails(_0x22d82e['email'],_0x2bfeb5['from']),'to':_0x22d82e[_0x71c3('0x2')],'cc':'','subject':_0x2bfeb5[_0x71c3('0x33')]||'','messageId':_0x2bfeb5['messageId'],'inReplyTo':_0x2bfeb5['inReplyTo'],'sentAt':moment(_0x2bfeb5[_0x71c3('0x34')])[_0x71c3('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2bfeb5[_0x71c3('0x11')]&&!_0x2bfeb5['textAsHtml']){var _0x481e01=_[_0x71c3('0x36')](_0x2bfeb5['attachments'],{'contentType':_0x71c3('0x37')});if(_0x481e01[_0x71c3('0xb')]){logger['info'](util[_0x71c3('0x35')](_0x71c3('0x38'),_0x2bfeb5[_0x71c3('0x39')]));tnef[_0x71c3('0x3a')](_[_0x71c3('0x3b')](_0x481e01)[_0x71c3('0x2b')],function(_0x42dee6,_0x4aa4fa){if(_0x4aa4fa){_0x2bfeb5['html']=_0x4aa4fa[_0x71c3('0x3c')]||'

Empty\x20message

';if(_0x4aa4fa[_0x71c3('0x3d')]){for(var _0x471647=0x0;_0x471647<_0x4aa4fa['Attachments'][_0x71c3('0xb')];_0x471647++){var _0x12faa3=_0x4aa4fa[_0x71c3('0x3d')][_0x471647];_0x1cd1a4[_0x71c3('0x1d')][_0x71c3('0x22')]['push']({'filename':_0x12faa3[_0x71c3('0x3e')],'content':Buffer[_0x71c3('0x3f')](_0x12faa3[_0x71c3('0x40')])});}}}_0x5eadc6(parseEmail(_0x22d82e,_0x2bfeb5,_0x1cd1a4));});}else{_0x2bfeb5[_0x71c3('0x11')]=_0x71c3('0x41');_0x5eadc6(parseEmail(_0x22d82e,_0x2bfeb5,_0x1cd1a4));}}else{_0x5eadc6(parseEmail(_0x22d82e,_0x2bfeb5,_0x1cd1a4));}};exports[_0x71c3('0x42')]=function(_0x525d49,_0x53182f){var _0x4afc62=[_0x71c3('0x43')+(_0x53182f||''),'auth=Bearer\x20'+_0x525d49,'',''];return Buffer[_0x71c3('0x3f')](_0x4afc62[_0x71c3('0xc')](''),_0x71c3('0x44'))[_0x71c3('0x45')](_0x71c3('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index aa48f81..91f9d2e 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 _0x2417=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x33405d,_0xd340e9){var _0x58dc50=function(_0x5e4c8a){while(--_0x5e4c8a){_0x33405d['push'](_0x33405d['shift']());}};_0x58dc50(++_0xd340e9);}(_0x2417,0x128));var _0x7241=function(_0x560623,_0x5c748a){_0x560623=_0x560623-0x0;var _0x2a9089=_0x2417[_0x560623];return _0x2a9089;};'use strict';var _=require(_0x7241('0x0'));function MailAccount(_0x283583){this['id']=_0x283583['id']||0x0;this[_0x7241('0x1')]=_0x283583['name']||_0x7241('0x2');this[_0x7241('0x3')]=_0x283583[_0x7241('0x3')]||_0x7241('0x4');this[_0x7241('0x5')]=_0x283583[_0x7241('0x5')]||![];this['Imap']=_0x283583[_0x7241('0x6')]||[];this[_0x7241('0x7')]=_0x283583[_0x7241('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x1bd4=['key','active','Imap','Smtp','exports','name','Service'];(function(_0x1b96c6,_0x45e55a){var _0x4a20fa=function(_0x2b6da4){while(--_0x2b6da4){_0x1b96c6['push'](_0x1b96c6['shift']());}};_0x4a20fa(++_0x45e55a);}(_0x1bd4,0x132));var _0x41bd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bd4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');function MailAccount(_0x52c591){this['id']=_0x52c591['id']||0x0;this[_0x41bd('0x0')]=_0x52c591['name']||_0x41bd('0x1');this[_0x41bd('0x2')]=_0x52c591[_0x41bd('0x2')]||'SERV';this[_0x41bd('0x3')]=_0x52c591[_0x41bd('0x3')]||![];this[_0x41bd('0x4')]=_0x52c591[_0x41bd('0x4')]||[];this[_0x41bd('0x5')]=_0x52c591[_0x41bd('0x5')]||[];}module[_0x41bd('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 81daafc..560f057 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 _0xa311=['lodash','../model/mailAccount','mailAccounts','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','exports'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xa311,0x1b8));var _0x1a31=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xa311[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x1a31('0x0'));var MailAccount=require(_0x1a31('0x1'));var Realtime=function(){this[_0x1a31('0x2')]={};};function freeIsNotKey(_0x448aeb,_0xcff495,_0x392936){var _0x19df25=_['mapKeys'](_0x448aeb,function(_0x4fa68f,_0x1e1159){return _0x4fa68f[_0x392936];});for(var _0x455d0d in _0xcff495){if(_0xcff495[_0x1a31('0x3')](_0x455d0d)){if(!_0x19df25[_0x455d0d]){delete _0xcff495[_0x455d0d];}}}}Realtime['prototype'][_0x1a31('0x4')]=function(_0x1b23a0,_0x2d7f6a){for(var _0x19982d in _0x2d7f6a){if(_0x1b23a0['hasOwnProperty'](_0x19982d)){_0x1b23a0[_0x19982d]=_0x2d7f6a[_0x19982d];}}};Realtime[_0x1a31('0x5')][_0x1a31('0x6')]=function(){var _0x56ce2c=this;return function(_0x5b6913){if(_0x5b6913){freeIsNotKey(_0x5b6913,_0x56ce2c[_0x1a31('0x2')],'id');for(var _0x4c3c62=0x0,_0x3580d2={},_0x1a4c6d={};_0x4c3c62<_0x5b6913[_0x1a31('0x7')];_0x4c3c62+=0x1){_0x3580d2=_0x5b6913[_0x4c3c62];if(_[_0x1a31('0x8')](_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']])){_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']]=new MailAccount(_0x3580d2);}else{_['merge'](_0x56ce2c[_0x1a31('0x2')][_0x3580d2['id']],_0x3580d2);}}}return _0x56ce2c[_0x1a31('0x2')];};};module[_0x1a31('0x9')]=Realtime; \ No newline at end of file +var _0x0e8a=['mailAccounts','prototype','hasOwnProperty','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x5f2a3d,_0x5c2fa0){var _0x127146=function(_0x3559bb){while(--_0x3559bb){_0x5f2a3d['push'](_0x5f2a3d['shift']());}};_0x127146(++_0x5c2fa0);}(_0x0e8a,0x1ae));var _0xa0e8=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x0e8a[_0x57e00e];return _0x415e60;};'use strict';var _=require(_0xa0e8('0x0'));var MailAccount=require(_0xa0e8('0x1'));var Realtime=function(){this[_0xa0e8('0x2')]={};};function freeIsNotKey(_0x207a14,_0x1b0aa3,_0x4cca15){var _0x984745=_['mapKeys'](_0x207a14,function(_0x46fe35,_0x2fe96b){return _0x46fe35[_0x4cca15];});for(var _0x1c2abf in _0x1b0aa3){if(_0x1b0aa3['hasOwnProperty'](_0x1c2abf)){if(!_0x984745[_0x1c2abf]){delete _0x1b0aa3[_0x1c2abf];}}}}Realtime[_0xa0e8('0x3')]['mergeFromDatabase']=function(_0x410e3f,_0x5f556a){for(var _0x318cc2 in _0x5f556a){if(_0x410e3f[_0xa0e8('0x4')](_0x318cc2)){_0x410e3f[_0x318cc2]=_0x5f556a[_0x318cc2];}}};Realtime[_0xa0e8('0x3')][_0xa0e8('0x5')]=function(){var _0x4ac2c0=this;return function(_0x8570e9){if(_0x8570e9){freeIsNotKey(_0x8570e9,_0x4ac2c0['mailAccounts'],'id');for(var _0x22c9f8=0x0,_0x346eb8={},_0x19266e={};_0x22c9f8<_0x8570e9['length'];_0x22c9f8+=0x1){_0x346eb8=_0x8570e9[_0x22c9f8];if(_[_0xa0e8('0x6')](_0x4ac2c0[_0xa0e8('0x2')][_0x346eb8['id']])){_0x4ac2c0[_0xa0e8('0x2')][_0x346eb8['id']]=new MailAccount(_0x346eb8);}else{_[_0xa0e8('0x7')](_0x4ac2c0['mailAccounts'][_0x346eb8['id']],_0x346eb8);}}}return _0x4ac2c0[_0xa0e8('0x2')];};};module[_0xa0e8('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1895045..28115c6 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 _0xc962=['active','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','Request','NotifyMailAccount','../client','name','provider','service','email'];(function(_0x3ce4c0,_0x4999b2){var _0x51571b=function(_0x511182){while(--_0x511182){_0x3ce4c0['push'](_0x3ce4c0['shift']());}};_0x51571b(++_0x4999b2);}(_0xc962,0x6d));var _0x2c96=function(_0x978b24,_0xd44a9e){_0x978b24=_0x978b24-0x0;var _0x392ce1=_0xc962[_0x978b24];return _0x392ce1;};'use strict';var client=require(_0x2c96('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x2c96('0x1'),_0x2c96('0x2'),_0x2c96('0x3'),_0x2c96('0x4'),_0x2c96('0x5'),_0x2c96('0x6'),_0x2c96('0x7'),_0x2c96('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2c96('0x9'),'include':[{'model':_0x2c96('0xa'),'attributes':['id',_0x2c96('0x1'),_0x2c96('0x3'),_0x2c96('0xb'),_0x2c96('0xc')],'as':_0x2c96('0xa')}]},{'model':_0x2c96('0xd'),'as':_0x2c96('0xe'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x2c96('0x3'),_0x2c96('0xb'),_0x2c96('0xc')],'as':_0x2c96('0xa')}]}]},'log':_0x2c96('0xf')});};};exports[_0x2c96('0x10')]=function(_0x4b6aa8,_0x48e5a9){return client[_0x2c96('0x11')](_0x2c96('0x12'),{'account':{'id':_0x4b6aa8},'body':_0x48e5a9,'log':_0x2c96('0x12')});}; \ No newline at end of file +var _0x544f=['key','TemplateId','MailServerIn','service','type','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','notify','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','email','active'];(function(_0x2fc2ca,_0x5a2b12){var _0x39b5ea=function(_0x40b734){while(--_0x40b734){_0x2fc2ca['push'](_0x2fc2ca['shift']());}};_0x39b5ea(++_0x5a2b12);}(_0x544f,0x104));var _0xf544=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x544f[_0x39e283];return _0x7de89f;};'use strict';var client=require('../client');exports[_0xf544('0x0')]=function(){return function(){return client['Request'](_0xf544('0x1'),{'options':{'attributes':['id',_0xf544('0x2'),_0xf544('0x3'),'service',_0xf544('0x4'),_0xf544('0x5'),_0xf544('0x6'),'ListId',_0xf544('0x7')],'raw':![],'include':[{'model':_0xf544('0x8'),'as':'Imap','include':[{'model':'CloudProvider','attributes':['id','name',_0xf544('0x9'),_0xf544('0xa'),_0xf544('0xb')],'as':'CloudProvider'}]},{'model':_0xf544('0xc'),'as':_0xf544('0xd'),'include':[{'model':_0xf544('0xe'),'attributes':['id',_0xf544('0x2'),_0xf544('0x9'),_0xf544('0xa'),_0xf544('0xb')],'as':_0xf544('0xe')}]}]},'log':_0xf544('0xf')});};};exports[_0xf544('0x10')]=function(_0x262b2c,_0x27240f){return client[_0xf544('0x11')](_0xf544('0x12'),{'account':{'id':_0x262b2c},'body':_0x27240f,'log':_0xf544('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a4c3d6d..4271de9 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 _0xcae0=['loginMailFrequency','GetSettings','../client','getSettings','ShowSetting'];(function(_0x378a97,_0x150885){var _0x5b4c41=function(_0x533d61){while(--_0x533d61){_0x378a97['push'](_0x378a97['shift']());}};_0x5b4c41(++_0x150885);}(_0xcae0,0x1b5));var _0x0cae=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xcae0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0cae('0x0'));exports[_0x0cae('0x1')]=function(){return client['Request'](_0x0cae('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0cae('0x3')]},'log':_0x0cae('0x4')});}; \ No newline at end of file +var _0x1646=['GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x1646,0xd8));var _0x6164=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0x1646[_0x593d89];return _0x4aa403;};'use strict';var client=require(_0x6164('0x0'));exports[_0x6164('0x1')]=function(){return client[_0x6164('0x2')](_0x6164('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x6164('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index c31a1d7..f274fac 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 fc9aea1..0603934 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 _0xf41d=['../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','express','sticky-session','ioredis','../../config/environment','listen','socket.io','websocket','polling','defaults','localhost','adapter','socket.io-redis','redis','../../config/triggers','default','../../config/express'];(function(_0x2cc400,_0x5e8b1d){var _0x17dd5f=function(_0x2c7022){while(--_0x2c7022){_0x2cc400['push'](_0x2cc400['shift']());}};_0x17dd5f(++_0x5e8b1d);}(_0xf41d,0x1e8));var _0xdf41=function(_0x12eee5,_0x3df57b){_0x12eee5=_0x12eee5-0x0;var _0x41e10c=_0xf41d[_0x12eee5];return _0x41e10c;};'use strict';var _=require(_0xdf41('0x0'));var http=require(_0xdf41('0x1'));var express=require(_0xdf41('0x2'));var sticky=require(_0xdf41('0x3'));var Redis=require(_0xdf41('0x4'));var config=require(_0xdf41('0x5'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0xdf41('0x6')](server,config['port'])){var socketio=require(_0xdf41('0x7'))(server,{'transports':[_0xdf41('0x8'),_0xdf41('0x9')]});config['redis']=_[_0xdf41('0xa')](config['redis'],{'host':_0xdf41('0xb'),'port':0x18eb});socketio[_0xdf41('0xc')](require(_0xdf41('0xd'))({'pubClient':new Redis(config[_0xdf41('0xe')]),'subClient':new Redis(config[_0xdf41('0xe')])}));require(_0xdf41('0xf'))[_0xdf41('0x10')]();require('../../config/socketio')['default'](socketio);require(_0xdf41('0x11'))[_0xdf41('0x10')](app);require(_0xdf41('0x12'))[_0xdf41('0x10')](app);}else{server[_0xdf41('0x13')]('listening',function(){console[_0xdf41('0x14')](_0xdf41('0x15'),config[_0xdf41('0x16')]);});}exports=module['exports']=app; \ No newline at end of file +var _0xd1ae=['exports','lodash','express','sticky-session','ioredis','../../config/environment','socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','port'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1ae,0x94));var _0xed1a=function(_0x3bf307,_0xa227e8){_0x3bf307=_0x3bf307-0x0;var _0x183eeb=_0xd1ae[_0x3bf307];return _0x183eeb;};'use strict';var _=require(_0xed1a('0x0'));var http=require('http');var express=require(_0xed1a('0x1'));var sticky=require(_0xed1a('0x2'));var Redis=require(_0xed1a('0x3'));var config=require(_0xed1a('0x4'));var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xed1a('0x5'))(server,{'transports':[_0xed1a('0x6'),_0xed1a('0x7')]});config[_0xed1a('0x8')]=_['defaults'](config[_0xed1a('0x8')],{'host':'localhost','port':0x18eb});socketio[_0xed1a('0x9')](require(_0xed1a('0xa'))({'pubClient':new Redis(config[_0xed1a('0x8')]),'subClient':new Redis(config[_0xed1a('0x8')])}));require(_0xed1a('0xb'))[_0xed1a('0xc')]();require(_0xed1a('0xd'))['default'](socketio);require(_0xed1a('0xe'))[_0xed1a('0xc')](app);require(_0xed1a('0xf'))['default'](app);}else{server[_0xed1a('0x10')](_0xed1a('0x11'),function(){console[_0xed1a('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xed1a('0x13')]);});}exports=module[_0xed1a('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index eeca567..c9eefed 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 _0xf832=['message','result','catch','exports','bluebird','../../config/logger','routing','client','Request','then','rpc','error'];(function(_0xaa2b9,_0x37ec46){var _0x2fba89=function(_0x4f97fc){while(--_0x4f97fc){_0xaa2b9['push'](_0xaa2b9['shift']());}};_0x2fba89(++_0x37ec46);}(_0xf832,0x1f0));var _0x2f83=function(_0x40977c,_0x10bc83){_0x40977c=_0x40977c-0x0;var _0x31cfee=_0xf832[_0x40977c];return _0x31cfee;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x2f83('0x0'));var logger=require(_0x2f83('0x1'))(_0x2f83('0x2'));var client=jayson[_0x2f83('0x3')]['http']({'port':0x2329});client[_0x2f83('0x4')]=function(_0x50a4aa,_0x56166f){return new BPromise(function(_0x11edef,_0x5efb9b){return client['request'](_0x50a4aa,_0x56166f)[_0x2f83('0x5')](function(_0x5bc82d){logger['debug'](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x56166f,_0x5bc82d);if(_0x5bc82d[_0x2f83('0x7')]){logger[_0x2f83('0x7')](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x5bc82d[_0x2f83('0x7')]['message'],_0x56166f);return _0x5efb9b(_0x5bc82d[_0x2f83('0x7')][_0x2f83('0x8')]);}else{return _0x11edef(_0x5bc82d[_0x2f83('0x9')]);}})[_0x2f83('0xa')](function(_0x83476d){logger[_0x2f83('0x7')](_0x2f83('0x6'),_0x2f83('0x2'),_0x50a4aa,_0x83476d,_0x56166f);return _0x5efb9b(_0x83476d);});});};module[_0x2f83('0xb')]=client; \ No newline at end of file +var _0x9f91=['exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','error','rpc','message','catch'];(function(_0xf43cb,_0x465374){var _0x14e869=function(_0x454719){while(--_0x454719){_0xf43cb['push'](_0xf43cb['shift']());}};_0x14e869(++_0x465374);}(_0x9f91,0x115));var _0x19f9=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x9f91[_0x166e96];return _0x553d73;};'use strict';var jayson=require(_0x19f9('0x0'));var BPromise=require(_0x19f9('0x1'));var logger=require(_0x19f9('0x2'))(_0x19f9('0x3'));var client=jayson[_0x19f9('0x4')]['http']({'port':0x2329});client[_0x19f9('0x5')]=function(_0x2b6ffd,_0x5f3f6a){return new BPromise(function(_0x29aa39,_0x795d10){return client[_0x19f9('0x6')](_0x2b6ffd,_0x5f3f6a)['then'](function(_0x334152){logger['debug']('rpc',_0x19f9('0x3'),_0x2b6ffd,_0x5f3f6a,_0x334152);if(_0x334152[_0x19f9('0x7')]){logger[_0x19f9('0x7')](_0x19f9('0x8'),_0x19f9('0x3'),_0x2b6ffd,_0x334152[_0x19f9('0x7')][_0x19f9('0x9')],_0x5f3f6a);return _0x795d10(_0x334152[_0x19f9('0x7')]['message']);}else{return _0x29aa39(_0x334152['result']);}})[_0x19f9('0xa')](function(_0x505535){logger[_0x19f9('0x7')](_0x19f9('0x8'),_0x19f9('0x3'),_0x2b6ffd,_0x505535,_0x5f3f6a);return _0x795d10(_0x505535);});});};module[_0x19f9('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 413bfd2..239d5ad 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 _0xa9af=['initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./rpc/user','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues'];(function(_0x3b9f45,_0x5b6d78){var _0xa5cc67=function(_0x279029){while(--_0x279029){_0x3b9f45['push'](_0x3b9f45['shift']());}};_0xa5cc67(++_0x5b6d78);}(_0xa9af,0xe0));var _0xfa9a=function(_0x2994c9,_0x930e79){_0x2994c9=_0x2994c9-0x0;var _0x4f318c=_0xa9af[_0x2994c9];return _0x4f318c;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0xfa9a('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xfa9a('0x1'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xfa9a('0x2'));var faxQueue=require(_0xfa9a('0x3'));var whatsappQueue=require(_0xfa9a('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xfa9a('0x5')]()['then'](user[_0xfa9a('0x6')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0x8')]())[_0xfa9a('0x7')](interval[_0xfa9a('0x9')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0xa')]())['then'](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xfa9a('0xb')]())[_0xfa9a('0x7')](chatQueue[_0xfa9a('0xc')]())['then'](realtime[_0xfa9a('0xd')]())[_0xfa9a('0x7')](smsQueue[_0xfa9a('0xe')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0xf')]())[_0xfa9a('0x7')](mailQueue['getMailQueues']())[_0xfa9a('0x7')](realtime[_0xfa9a('0x10')]())[_0xfa9a('0x7')](faxQueue[_0xfa9a('0x11')]())['then'](realtime[_0xfa9a('0x12')]())['then'](whatsappQueue[_0xfa9a('0x13')]())[_0xfa9a('0x7')](realtime[_0xfa9a('0x14')]())[_0xfa9a('0x7')](function(){return realtime;});}function main(){return server[_0xfa9a('0x15')](realtime)['then'](function(_0x418d63){return initRealtime();})[_0xfa9a('0x7')](function(_0x245cb4){return setInterval(initRealtime,0x1388);})[_0xfa9a('0x16')](function(_0x109dbb){console[_0xfa9a('0x17')](_0x109dbb);});}main(); \ No newline at end of file +var _0xdfea=['getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x23a7b3,_0x52b39b){var _0x4e3bd2=function(_0x540d55){while(--_0x540d55){_0x23a7b3['push'](_0x23a7b3['shift']());}};_0x4e3bd2(++_0x52b39b);}(_0xdfea,0x71));var _0xadfe=function(_0x168d80,_0x39e2ca){_0x168d80=_0x168d80-0x0;var _0x1fd38c=_0xdfea[_0x168d80];return _0x1fd38c;};'use strict';var BPromise=require('bluebird');var server=require(_0xadfe('0x0'));var Realtime=require(_0xadfe('0x1'));var user=require(_0xadfe('0x2'));var interval=require(_0xadfe('0x3'));var openchannelQueue=require(_0xadfe('0x4'));var chatQueue=require(_0xadfe('0x5'));var smsQueue=require(_0xadfe('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xadfe('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xadfe('0x8')]()[_0xadfe('0x9')](user[_0xadfe('0xa')]())[_0xadfe('0x9')](realtime[_0xadfe('0xb')]())[_0xadfe('0x9')](interval[_0xadfe('0xc')]())['then'](realtime[_0xadfe('0xd')]())[_0xadfe('0x9')](openchannelQueue[_0xadfe('0xe')]())[_0xadfe('0x9')](realtime['initOpenchannelQueues']())[_0xadfe('0x9')](chatQueue[_0xadfe('0xf')]())[_0xadfe('0x9')](realtime[_0xadfe('0x10')]())[_0xadfe('0x9')](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0xadfe('0x9')](mailQueue[_0xadfe('0x11')]())[_0xadfe('0x9')](realtime[_0xadfe('0x12')]())[_0xadfe('0x9')](faxQueue[_0xadfe('0x13')]())[_0xadfe('0x9')](realtime[_0xadfe('0x14')]())[_0xadfe('0x9')](whatsappQueue[_0xadfe('0x15')]())['then'](realtime[_0xadfe('0x16')]())[_0xadfe('0x9')](function(){return realtime;});}function main(){return server[_0xadfe('0x17')](realtime)[_0xadfe('0x9')](function(_0x4f2351){return initRealtime();})[_0xadfe('0x9')](function(_0x38ca94){return setInterval(initRealtime,0x1388);})[_0xadfe('0x18')](function(_0x1b622b){console[_0xadfe('0x19')](_0x1b622b);});}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 386722e..af578a7 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x3ab46c,_0x4d26cc){_0x3ab46c=_0x3ab46c-0x0;var _0x2c7e90=_0x1261[_0x3ab46c];return _0x2c7e90;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x183459,_0x473ebc){var _0x59fff1=function(_0x21edda){while(--_0x21edda){_0x183459['push'](_0x183459['shift']());}};_0x59fff1(++_0x473ebc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 7c4e143..3564587 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 _0x7c08=['bluebird','jayson/promise','client','request','error','message','result','catch','sendMailMessage','SendMail'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c08,0xb4));var _0x87c0=function(_0x27fcaf,_0x3900c1){_0x27fcaf=_0x27fcaf-0x0;var _0x4e4a0f=_0x7c08[_0x27fcaf];return _0x4e4a0f;};'use strict';var BPromise=require(_0x87c0('0x0'));var jayson=require(_0x87c0('0x1'));var client=jayson[_0x87c0('0x2')]['http']({'port':0x232b});function request(_0x28dbc0,_0xd79c){return new BPromise(function(_0x5d3ead,_0x1024d9){return client[_0x87c0('0x3')](_0x28dbc0,_0xd79c)['then'](function(_0x4f3665){if(_0x4f3665[_0x87c0('0x4')]){return _0x1024d9(_0x4f3665['error'][_0x87c0('0x5')]);}else{return _0x5d3ead(_0x4f3665[_0x87c0('0x6')]);}})[_0x87c0('0x7')](function(_0x30bd47){return _0x1024d9(_0x30bd47);});});}exports[_0x87c0('0x8')]=function(_0x1bbd8b,_0x1d92a3){return request(_0x87c0('0x9'),{'account':_0x1bbd8b,'message':_0x1d92a3});}; \ No newline at end of file +var _0xbfa4=['result','catch','sendMailMessage','SendMail','bluebird','request','then','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfa4,0x104));var _0x4bfa=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0xbfa4[_0x1ac120];return _0x19b703;};'use strict';var BPromise=require(_0x4bfa('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x22edb4,_0x46afe1){return new BPromise(function(_0xcdafb3,_0x22a39e){return client[_0x4bfa('0x1')](_0x22edb4,_0x46afe1)[_0x4bfa('0x2')](function(_0x7d7dc2){if(_0x7d7dc2[_0x4bfa('0x3')]){return _0x22a39e(_0x7d7dc2[_0x4bfa('0x3')]['message']);}else{return _0xcdafb3(_0x7d7dc2[_0x4bfa('0x4')]);}})[_0x4bfa('0x5')](function(_0x581cd2){return _0x22a39e(_0x581cd2);});});}exports[_0x4bfa('0x6')]=function(_0x16ed2d,_0x58ae36){return request(_0x4bfa('0x7'),{'account':_0x16ed2d,'message':_0x58ae36});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index eb71871..ff49e84 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 _0x6947=['mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatus','mailStatusTime','faxStatus','faxStatusTime','smsStatusTime','openchannelStatusTime','stringify','emit','user:save','exports','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x6947,0x72));var _0x7694=function(_0x5331c9,_0x2c11d7){_0x5331c9=_0x5331c9-0x0;var _0x58aebc=_0x6947[_0x5331c9];return _0x58aebc;};'use strict';var _=require('lodash');var moment=require(_0x7694('0x0'));var md5=require('md5');var Redis=require(_0x7694('0x1'));var config=require(_0x7694('0x2'));config[_0x7694('0x3')]=_[_0x7694('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7694('0x5'))(new Redis(config[_0x7694('0x3')]));function Agent(_0x1cb2b5){this['id']=_0x1cb2b5['id']||0x0;this[_0x7694('0x6')]=_0x1cb2b5[_0x7694('0x6')]||'';this[_0x7694('0x7')]=_0x1cb2b5['online']||!![];this[_0x7694('0x8')]=_0x1cb2b5['voicePause']||![];this[_0x7694('0x9')]=_0x1cb2b5[_0x7694('0x9')]||![];this['mailPause']=_0x1cb2b5[_0x7694('0xa')]||![];this[_0x7694('0xb')]=_0x1cb2b5[_0x7694('0xb')]||![];this[_0x7694('0xc')]=_0x1cb2b5[_0x7694('0xc')]||![];this[_0x7694('0xd')]=_0x1cb2b5[_0x7694('0xd')]||![];this['chatStatus']=_0x7694('0xe');this[_0x7694('0xf')]=0x0;this['chatCapacity']=_0x1cb2b5[_0x7694('0x10')]||0x0;this[_0x7694('0x11')]=0x0;this[_0x7694('0x12')]='unknown';this['mailStatusTime']=0x0;this[_0x7694('0x13')]=_0x1cb2b5[_0x7694('0x13')]||0x0;this[_0x7694('0x14')]=0x0;this['faxStatus']=_0x7694('0xe');this['faxStatusTime']=0x0;this[_0x7694('0x15')]=_0x1cb2b5[_0x7694('0x15')]||0x0;this[_0x7694('0x16')]=0x0;this[_0x7694('0x17')]=_0x7694('0xe');this['smsStatusTime']=0x0;this[_0x7694('0x18')]=_0x1cb2b5[_0x7694('0x18')]||0x0;this[_0x7694('0x19')]=0x0;this[_0x7694('0x1a')]='unknown';this[_0x7694('0x1b')]=0x0;this[_0x7694('0x1c')]=_0x1cb2b5[_0x7694('0x1c')]||0x0;this[_0x7694('0x1d')]=0x0;this[_0x7694('0x1e')]=_0x7694('0xe');this['openchannelStatusTime']=0x0;this[_0x7694('0x1f')]=_0x1cb2b5['openchannelCapacity']||0x0;this[_0x7694('0x20')]=0x0;this[_0x7694('0x21')]=![];this[_0x7694('0x22')]=undefined;this[_0x7694('0x23')]='';this[_0x7694('0x24')]();}Agent['prototype'][_0x7694('0x25')]=function(_0x105709){if(this[_0x105709+_0x7694('0x26')]>0x0){if(this[_0x105709+_0x7694('0x27')]>0x0&&this[_0x105709+_0x7694('0x26')]>=this[_0x105709+'Capacity']){return _0x7694('0x28');}else{return _0x7694('0x29');}}else{return _0x7694('0x2a');}};Agent[_0x7694('0x2b')]['updateRealtime']=function(){var _0x21383e=['mail',_0x7694('0x2c'),'openchannel',_0x7694('0x2d'),_0x7694('0x2e'),_0x7694('0x2f')];for(var _0x35b5c6=0x0;_0x35b5c6<_0x21383e[_0x7694('0x30')];_0x35b5c6+=0x1){var _0xbc2650=this[_0x7694('0x25')](_0x21383e[_0x35b5c6]);if(this[_0x21383e[_0x35b5c6]+_0x7694('0x31')]!==_0xbc2650){this[_0x21383e[_0x35b5c6]+_0x7694('0x32')]=_['toNumber'](moment()[_0x7694('0x33')]('x'));}this[_0x21383e[_0x35b5c6]+_0x7694('0x31')]=_0xbc2650;}var _0x2d4a79={'id':this['id'],'name':this[_0x7694('0x6')],'online':this['online'],'voicePause':this[_0x7694('0x8')],'chatPause':this[_0x7694('0x9')],'mailPause':this[_0x7694('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x7694('0xb')],'openchannelPause':this[_0x7694('0xd')],'chatStatus':this[_0x7694('0x34')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x7694('0x10')],'chatCurrentCapacity':this[_0x7694('0x11')],'mailStatus':this[_0x7694('0x12')],'mailStatusTime':this[_0x7694('0x35')],'mailCapacity':this[_0x7694('0x13')],'mailCurrentCapacity':this[_0x7694('0x14')],'faxStatus':this[_0x7694('0x36')],'faxStatusTime':this[_0x7694('0x37')],'faxCapacity':this[_0x7694('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7694('0x17')],'smsStatusTime':this[_0x7694('0x38')],'smsCapacity':this[_0x7694('0x18')],'smsCurrentCapacity':this[_0x7694('0x19')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7694('0x1b')],'whatsappCapacity':this[_0x7694('0x1c')],'whatsappCurrentCapacity':this[_0x7694('0x1d')],'openchannelStatus':this[_0x7694('0x1e')],'openchannelStatusTime':this[_0x7694('0x39')],'openchannelCapacity':this[_0x7694('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x7694('0x21')],'busyQueue':this[_0x7694('0x22')]};var _0x3ee892=md5(JSON[_0x7694('0x3a')](_0x2d4a79));if(this[_0x7694('0x23')]!==_0x3ee892){this[_0x7694('0x23')]=_0x3ee892;io[_0x7694('0x3b')](_0x7694('0x3c'),_0x2d4a79);}};module[_0x7694('0x3d')]=Agent; \ No newline at end of file +var _0x1a3f=['smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','prototype','updateRealtime','mail','chat','openchannel','Status','toNumber','format','mailStatusTime','faxStatusTime','whatsappStatusTime','openchannelCurrentCapacity','busyQueue','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause'];(function(_0x2dd0c6,_0x536625){var _0xba55cd=function(_0x520177){while(--_0x520177){_0x2dd0c6['push'](_0x2dd0c6['shift']());}};_0xba55cd(++_0x536625);}(_0x1a3f,0x68));var _0xf1a3=function(_0x417f13,_0x1528d9){_0x417f13=_0x417f13-0x0;var _0x5b4d82=_0x1a3f[_0x417f13];return _0x5b4d82;};'use strict';var _=require(_0xf1a3('0x0'));var moment=require('moment');var md5=require(_0xf1a3('0x1'));var Redis=require(_0xf1a3('0x2'));var config=require(_0xf1a3('0x3'));config[_0xf1a3('0x4')]=_[_0xf1a3('0x5')](config[_0xf1a3('0x4')],{'host':_0xf1a3('0x6'),'port':0x18eb});var io=require(_0xf1a3('0x7'))(new Redis(config['redis']));function Agent(_0x122c82){this['id']=_0x122c82['id']||0x0;this[_0xf1a3('0x8')]=_0x122c82[_0xf1a3('0x8')]||'';this['online']=_0x122c82[_0xf1a3('0x9')]||!![];this['voicePause']=_0x122c82[_0xf1a3('0xa')]||![];this[_0xf1a3('0xb')]=_0x122c82['chatPause']||![];this[_0xf1a3('0xc')]=_0x122c82['mailPause']||![];this['faxPause']=_0x122c82[_0xf1a3('0xd')]||![];this[_0xf1a3('0xe')]=_0x122c82[_0xf1a3('0xe')]||![];this[_0xf1a3('0xf')]=_0x122c82[_0xf1a3('0xf')]||![];this[_0xf1a3('0x10')]=_0xf1a3('0x11');this[_0xf1a3('0x12')]=0x0;this[_0xf1a3('0x13')]=_0x122c82[_0xf1a3('0x13')]||0x0;this[_0xf1a3('0x14')]=0x0;this[_0xf1a3('0x15')]=_0xf1a3('0x11');this['mailStatusTime']=0x0;this[_0xf1a3('0x16')]=_0x122c82[_0xf1a3('0x16')]||0x0;this[_0xf1a3('0x17')]=0x0;this[_0xf1a3('0x18')]='unknown';this['faxStatusTime']=0x0;this[_0xf1a3('0x19')]=_0x122c82[_0xf1a3('0x19')]||0x0;this[_0xf1a3('0x1a')]=0x0;this[_0xf1a3('0x1b')]=_0xf1a3('0x11');this[_0xf1a3('0x1c')]=0x0;this['smsCapacity']=_0x122c82[_0xf1a3('0x1d')]||0x0;this[_0xf1a3('0x1e')]=0x0;this[_0xf1a3('0x1f')]=_0xf1a3('0x11');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x122c82[_0xf1a3('0x20')]||0x0;this[_0xf1a3('0x21')]=0x0;this[_0xf1a3('0x22')]=_0xf1a3('0x11');this[_0xf1a3('0x23')]=0x0;this[_0xf1a3('0x24')]=_0x122c82[_0xf1a3('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xf1a3('0x25')]=![];this['busyQueue']=undefined;this[_0xf1a3('0x1')]='';this['updateRealtime']();}Agent['prototype'][_0xf1a3('0x26')]=function(_0x565001){if(this[_0x565001+'CurrentCapacity']>0x0){if(this[_0x565001+_0xf1a3('0x27')]>0x0&&this[_0x565001+_0xf1a3('0x28')]>=this[_0x565001+_0xf1a3('0x27')]){return _0xf1a3('0x29');}else{return _0xf1a3('0x2a');}}else{return _0xf1a3('0x2b');}};Agent[_0xf1a3('0x2c')][_0xf1a3('0x2d')]=function(){var _0xb01039=[_0xf1a3('0x2e'),_0xf1a3('0x2f'),_0xf1a3('0x30'),'fax','sms','whatsapp'];for(var _0x465015=0x0;_0x465015<_0xb01039['length'];_0x465015+=0x1){var _0x2c2999=this[_0xf1a3('0x26')](_0xb01039[_0x465015]);if(this[_0xb01039[_0x465015]+_0xf1a3('0x31')]!==_0x2c2999){this[_0xb01039[_0x465015]+'StatusTime']=_[_0xf1a3('0x32')](moment()[_0xf1a3('0x33')]('x'));}this[_0xb01039[_0x465015]+_0xf1a3('0x31')]=_0x2c2999;}var _0x599ff9={'id':this['id'],'name':this[_0xf1a3('0x8')],'online':this[_0xf1a3('0x9')],'voicePause':this[_0xf1a3('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xf1a3('0xc')],'smsPause':this[_0xf1a3('0xe')],'faxPause':this[_0xf1a3('0xd')],'openchannelPause':this[_0xf1a3('0xf')],'chatStatus':this[_0xf1a3('0x10')],'chatStatusTime':this[_0xf1a3('0x12')],'chatCapacity':this[_0xf1a3('0x13')],'chatCurrentCapacity':this[_0xf1a3('0x14')],'mailStatus':this[_0xf1a3('0x15')],'mailStatusTime':this[_0xf1a3('0x34')],'mailCapacity':this[_0xf1a3('0x16')],'mailCurrentCapacity':this[_0xf1a3('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf1a3('0x35')],'faxCapacity':this[_0xf1a3('0x19')],'faxCurrentCapacity':this[_0xf1a3('0x1a')],'smsStatus':this[_0xf1a3('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xf1a3('0x1d')],'smsCurrentCapacity':this[_0xf1a3('0x1e')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf1a3('0x36')],'whatsappCapacity':this[_0xf1a3('0x20')],'whatsappCurrentCapacity':this[_0xf1a3('0x21')],'openchannelStatus':this[_0xf1a3('0x22')],'openchannelStatusTime':this[_0xf1a3('0x23')],'openchannelCapacity':this[_0xf1a3('0x24')],'openchannelCurrentCapacity':this[_0xf1a3('0x37')],'busy':this[_0xf1a3('0x25')],'busyQueue':this[_0xf1a3('0x38')]};var _0x456196=md5(JSON['stringify'](_0x599ff9));if(this[_0xf1a3('0x1')]!==_0x456196){this[_0xf1a3('0x1')]=_0x456196;io[_0xf1a3('0x39')](_0xf1a3('0x3a'),_0x599ff9);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 05703c2..1d9dd86 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 _0xebea=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','_rr','paused','length','online','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xebea,0x180));var _0xaebe=function(_0x476507,_0x5becaf){_0x476507=_0x476507-0x0;var _0x2a16c0=_0xebea[_0x476507];return _0x2a16c0;};'use strict';var _=require(_0xaebe('0x0'));var md5=require('md5');var util=require(_0xaebe('0x1'));var Redis=require('ioredis');var config=require(_0xaebe('0x2'));config['redis']=_[_0xaebe('0x3')](config[_0xaebe('0x4')],{'host':_0xaebe('0x5'),'port':0x18eb});var io=require(_0xaebe('0x6'))(new Redis(config['redis']));function ChatQueue(_0x367bab){this['id']=_0x367bab['id']||0x0;this[_0xaebe('0x7')]=_0x367bab[_0xaebe('0x7')]||'';this[_0xaebe('0x8')]=_0x367bab[_0xaebe('0x8')]||0xa;this[_0xaebe('0x9')]=_0x367bab[_0xaebe('0x9')]||_0xaebe('0xa');this['Agents']=_0x367bab[_0xaebe('0xb')];this[_0xaebe('0xc')]={};this[_0xaebe('0xd')]=0x0;this[_0xaebe('0xe')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xaebe('0xf')]['updateRouting']=function(){var _0x1c0798=this['mapAgentsId'][_0xaebe('0x10')];this[_0xaebe('0xc')]=_['map'](this[_0xaebe('0xb')],'id');this['mapAgentsId']['_rr']=_0x1c0798;};ChatQueue[_0xaebe('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xaebe('0x11')]=0x0;for(var _0x19c347=0x0;_0x19c347=0x0?this[_0xaebe('0x16')]:0x0;var _0x1972c7={'id':this['id'],'available':this[_0xaebe('0x16')],'loggedIn':this[_0xaebe('0x14')],'name':this[_0xaebe('0x7')],'paused':this['paused'],'waiting':this[_0xaebe('0xd')]};var _0xa18096=md5(JSON[_0xaebe('0x17')](_0x1972c7));if(this[_0xaebe('0xe')]!==_0xa18096){this[_0xaebe('0xe')]=_0xa18096;io['to'](util[_0xaebe('0x18')](_0xaebe('0x19'),_0x1972c7[_0xaebe('0x7')]))[_0xaebe('0x1a')](_0xaebe('0x1b'),_0x1972c7);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x6a88=['chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','loggedIn','length','online','paused','available','format','chat:queue:%s'];(function(_0x36828e,_0x1e401c){var _0x129fe3=function(_0x43c656){while(--_0x43c656){_0x36828e['push'](_0x36828e['shift']());}};_0x129fe3(++_0x1e401c);}(_0x6a88,0xf5));var _0x86a8=function(_0x35268e,_0x4acfd1){_0x35268e=_0x35268e-0x0;var _0x28ba11=_0x6a88[_0x35268e];return _0x28ba11;};'use strict';var _=require(_0x86a8('0x0'));var md5=require(_0x86a8('0x1'));var util=require(_0x86a8('0x2'));var Redis=require(_0x86a8('0x3'));var config=require(_0x86a8('0x4'));config['redis']=_[_0x86a8('0x5')](config[_0x86a8('0x6')],{'host':_0x86a8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1cc730){this['id']=_0x1cc730['id']||0x0;this[_0x86a8('0x8')]=_0x1cc730[_0x86a8('0x8')]||'';this[_0x86a8('0x9')]=_0x1cc730[_0x86a8('0x9')]||0xa;this[_0x86a8('0xa')]=_0x1cc730[_0x86a8('0xa')]||_0x86a8('0xb');this[_0x86a8('0xc')]=_0x1cc730[_0x86a8('0xc')];this[_0x86a8('0xd')]={};this[_0x86a8('0xe')]=0x0;this[_0x86a8('0x1')]='';this['updateRouting']();this[_0x86a8('0xf')]();}ChatQueue['prototype'][_0x86a8('0x10')]=function(){var _0x2b4eb3=this[_0x86a8('0xd')][_0x86a8('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x86a8('0xd')][_0x86a8('0x11')]=_0x2b4eb3;};ChatQueue['prototype'][_0x86a8('0xf')]=function(){this[_0x86a8('0x12')]=0x0;this['paused']=0x0;for(var _0x2093db=0x0;_0x2093db=0x0?this['available']:0x0;var _0x3dac2b={'id':this['id'],'available':this[_0x86a8('0x16')],'loggedIn':this[_0x86a8('0x12')],'name':this[_0x86a8('0x8')],'paused':this[_0x86a8('0x15')],'waiting':this['waiting']};var _0x1c42e7=md5(JSON['stringify'](_0x3dac2b));if(this['md5']!==_0x1c42e7){this['md5']=_0x1c42e7;io['to'](util[_0x86a8('0x17')](_0x86a8('0x18'),_0x3dac2b[_0x86a8('0x8')]))['emit'](_0x86a8('0x19'),_0x3dac2b);}};module[_0x86a8('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e7d4f08..bdf425d 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 _0x1af3=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','faxPause','available','paused','stringify','format','fax:queue:%s','emit','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x1af3,0x1aa));var _0x31af=function(_0x237da8,_0x37b77a){_0x237da8=_0x237da8-0x0;var _0x558825=_0x1af3[_0x237da8];return _0x558825;};'use strict';var _=require(_0x31af('0x0'));var md5=require(_0x31af('0x1'));var util=require('util');var Redis=require(_0x31af('0x2'));var config=require('../../../config/environment');config[_0x31af('0x3')]=_['defaults'](config[_0x31af('0x3')],{'host':_0x31af('0x4'),'port':0x18eb});var io=require(_0x31af('0x5'))(new Redis(config[_0x31af('0x3')]));function FaxQueue(_0x1cb4af){this['id']=_0x1cb4af['id']||0x0;this[_0x31af('0x6')]=_0x1cb4af[_0x31af('0x6')]||'';this[_0x31af('0x7')]=_0x1cb4af['timeout']||0xa;this['strategy']=_0x1cb4af[_0x31af('0x8')]||_0x31af('0x9');this[_0x31af('0xa')]=_0x1cb4af[_0x31af('0xa')];this[_0x31af('0xb')]={};this[_0x31af('0xc')]=0x0;this[_0x31af('0x1')]='';this[_0x31af('0xd')]();this[_0x31af('0xe')]();}FaxQueue[_0x31af('0xf')][_0x31af('0xd')]=function(){var _0x229986=this[_0x31af('0xb')][_0x31af('0x10')];this[_0x31af('0xb')]=_['map'](this['Agents'],'id');this[_0x31af('0xb')]['_rr']=_0x229986;};FaxQueue[_0x31af('0xf')][_0x31af('0xe')]=function(){this[_0x31af('0x11')]=0x0;this['paused']=0x0;for(var _0x4f67a3=0x0;_0x4f67a3=0x0?this['available']:0x0;var _0x4e8041={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x31af('0x6')],'paused':this[_0x31af('0x15')],'waiting':this['waiting']};var _0x1bcc5f=md5(JSON[_0x31af('0x16')](_0x4e8041));if(this[_0x31af('0x1')]!==_0x1bcc5f){this[_0x31af('0x1')]=_0x1bcc5f;io['to'](util[_0x31af('0x17')](_0x31af('0x18'),_0x4e8041[_0x31af('0x6')]))[_0x31af('0x19')]('fax_queue:save',_0x4e8041);}};module[_0x31af('0x1a')]=FaxQueue; \ No newline at end of file +var _0xe320=['waiting','prototype','mapAgentsId','_rr','map','updateRealtime','paused','length','online','loggedIn','faxPause','available','name','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x13ab7f,_0x35c4f9){var _0x28c68e=function(_0x570aea){while(--_0x570aea){_0x13ab7f['push'](_0x13ab7f['shift']());}};_0x28c68e(++_0x35c4f9);}(_0xe320,0xf9));var _0x0e32=function(_0x1ce17a,_0x99b128){_0x1ce17a=_0x1ce17a-0x0;var _0x3f2c4d=_0xe320[_0x1ce17a];return _0x3f2c4d;};'use strict';var _=require(_0x0e32('0x0'));var md5=require(_0x0e32('0x1'));var util=require(_0x0e32('0x2'));var Redis=require(_0x0e32('0x3'));var config=require('../../../config/environment');config[_0x0e32('0x4')]=_[_0x0e32('0x5')](config[_0x0e32('0x4')],{'host':_0x0e32('0x6'),'port':0x18eb});var io=require(_0x0e32('0x7'))(new Redis(config['redis']));function FaxQueue(_0x51a0a4){this['id']=_0x51a0a4['id']||0x0;this['name']=_0x51a0a4['name']||'';this[_0x0e32('0x8')]=_0x51a0a4[_0x0e32('0x8')]||0xa;this[_0x0e32('0x9')]=_0x51a0a4[_0x0e32('0x9')]||_0x0e32('0xa');this[_0x0e32('0xb')]=_0x51a0a4[_0x0e32('0xb')];this['mapAgentsId']={};this[_0x0e32('0xc')]=0x0;this[_0x0e32('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x0e32('0xd')]['updateRouting']=function(){var _0x31c6a0=this[_0x0e32('0xe')][_0x0e32('0xf')];this[_0x0e32('0xe')]=_[_0x0e32('0x10')](this[_0x0e32('0xb')],'id');this[_0x0e32('0xe')][_0x0e32('0xf')]=_0x31c6a0;};FaxQueue[_0x0e32('0xd')][_0x0e32('0x11')]=function(){this['loggedIn']=0x0;this[_0x0e32('0x12')]=0x0;for(var _0x47108c=0x0;_0x47108c=0x0?this['available']:0x0;var _0x4fa44c={'id':this['id'],'available':this[_0x0e32('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x0e32('0x18')],'paused':this[_0x0e32('0x12')],'waiting':this[_0x0e32('0xc')]};var _0x1693b7=md5(JSON['stringify'](_0x4fa44c));if(this[_0x0e32('0x1')]!==_0x1693b7){this['md5']=_0x1693b7;io['to'](util[_0x0e32('0x19')](_0x0e32('0x1a'),_0x4fa44c[_0x0e32('0x18')]))[_0x0e32('0x1b')](_0x0e32('0x1c'),_0x4fa44c);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 8db403f..9247f47 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 _0x4768=['Intervals','exports','name'];(function(_0x5c703c,_0x2f5f8e){var _0x1cca90=function(_0x46a3c0){while(--_0x46a3c0){_0x5c703c['push'](_0x5c703c['shift']());}};_0x1cca90(++_0x2f5f8e);}(_0x4768,0x1f1));var _0x8476=function(_0x108e00,_0x3b11f7){_0x108e00=_0x108e00-0x0;var _0x2c6b1d=_0x4768[_0x108e00];return _0x2c6b1d;};'use strict';function Interval(_0x4c0179){this['id']=_0x4c0179['id']||0x0;this[_0x8476('0x0')]=_0x4c0179['name']||'';this[_0x8476('0x1')]=_0x4c0179[_0x8476('0x1')]||{};}module[_0x8476('0x2')]=Interval; \ No newline at end of file +var _0x2155=['Intervals','exports','name'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x2155,0x1a6));var _0x5215=function(_0xf85978,_0x52a3a4){_0xf85978=_0xf85978-0x0;var _0x27376e=_0x2155[_0xf85978];return _0x27376e;};'use strict';function Interval(_0x290243){this['id']=_0x290243['id']||0x0;this[_0x5215('0x0')]=_0x290243['name']||'';this['Intervals']=_0x290243[_0x5215('0x1')]||{};}module[_0x5215('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 b0b3658..cf53c82 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 _0xf90b=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x36adaa,_0x583ee4){var _0x111c3d=function(_0x4ea7c7){while(--_0x4ea7c7){_0x36adaa['push'](_0x36adaa['shift']());}};_0x111c3d(++_0x583ee4);}(_0xf90b,0x99));var _0xbf90=function(_0x583595,_0x58b095){_0x583595=_0x583595-0x0;var _0x4e9586=_0xf90b[_0x583595];return _0x4e9586;};'use strict';var _=require(_0xbf90('0x0'));var md5=require(_0xbf90('0x1'));var util=require('util');var Redis=require(_0xbf90('0x2'));var config=require(_0xbf90('0x3'));config['redis']=_['defaults'](config[_0xbf90('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf90('0x5'))(new Redis(config['redis']));function MailQueue(_0xbaf1a5){this['id']=_0xbaf1a5['id']||0x0;this[_0xbf90('0x6')]=_0xbaf1a5[_0xbf90('0x6')]||'';this['timeout']=_0xbaf1a5[_0xbf90('0x7')]||0xa;this['strategy']=_0xbaf1a5[_0xbf90('0x8')]||_0xbf90('0x9');this[_0xbf90('0xa')]=_0xbaf1a5[_0xbf90('0xa')];this[_0xbf90('0xb')]={};this[_0xbf90('0xc')]=0x0;this[_0xbf90('0x1')]='';this[_0xbf90('0xd')]();this[_0xbf90('0xe')]();}MailQueue['prototype'][_0xbf90('0xd')]=function(){var _0x25f4d9=this[_0xbf90('0xb')][_0xbf90('0xf')];this['mapAgentsId']=_[_0xbf90('0x10')](this[_0xbf90('0xa')],'id');this[_0xbf90('0xb')][_0xbf90('0xf')]=_0x25f4d9;};MailQueue['prototype'][_0xbf90('0xe')]=function(){this[_0xbf90('0x11')]=0x0;this[_0xbf90('0x12')]=0x0;for(var _0x193af5=0x0;_0x193af5=0x0?this[_0xbf90('0x16')]:0x0;var _0x27659a={'id':this['id'],'available':this[_0xbf90('0x16')],'loggedIn':this[_0xbf90('0x11')],'name':this['name'],'paused':this[_0xbf90('0x12')],'waiting':this[_0xbf90('0xc')]};var _0x294537=md5(JSON[_0xbf90('0x17')](_0x27659a));if(this['md5']!==_0x294537){this[_0xbf90('0x1')]=_0x294537;io['to'](util['format'](_0xbf90('0x18'),_0x27659a[_0xbf90('0x6')]))[_0xbf90('0x19')](_0xbf90('0x1a'),_0x27659a);}};module['exports']=MailQueue; \ No newline at end of file +var _0x94af=['emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','online','mailPause','available','stringify','format'];(function(_0x3224d9,_0x340d1e){var _0x2c6374=function(_0x3e4e2a){while(--_0x3e4e2a){_0x3224d9['push'](_0x3224d9['shift']());}};_0x2c6374(++_0x340d1e);}(_0x94af,0x198));var _0xf94a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x94af[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf94a('0x0'));var md5=require(_0xf94a('0x1'));var util=require(_0xf94a('0x2'));var Redis=require(_0xf94a('0x3'));var config=require('../../../config/environment');config[_0xf94a('0x4')]=_[_0xf94a('0x5')](config[_0xf94a('0x4')],{'host':_0xf94a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf94a('0x4')]));function MailQueue(_0x347dce){this['id']=_0x347dce['id']||0x0;this[_0xf94a('0x7')]=_0x347dce['name']||'';this[_0xf94a('0x8')]=_0x347dce[_0xf94a('0x8')]||0xa;this[_0xf94a('0x9')]=_0x347dce['strategy']||_0xf94a('0xa');this[_0xf94a('0xb')]=_0x347dce['Agents'];this['mapAgentsId']={};this[_0xf94a('0xc')]=0x0;this[_0xf94a('0x1')]='';this['updateRouting']();this[_0xf94a('0xd')]();}MailQueue['prototype'][_0xf94a('0xe')]=function(){var _0x36ccaa=this['mapAgentsId']['_rr'];this[_0xf94a('0xf')]=_[_0xf94a('0x10')](this[_0xf94a('0xb')],'id');this[_0xf94a('0xf')][_0xf94a('0x11')]=_0x36ccaa;};MailQueue[_0xf94a('0x12')]['updateRealtime']=function(){this[_0xf94a('0x13')]=0x0;this[_0xf94a('0x14')]=0x0;for(var _0x4fb33e=0x0;_0x4fb33e=0x0?this[_0xf94a('0x18')]:0x0;var _0x420d91={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf94a('0x7')],'paused':this[_0xf94a('0x14')],'waiting':this[_0xf94a('0xc')]};var _0x206f8c=md5(JSON[_0xf94a('0x19')](_0x420d91));if(this[_0xf94a('0x1')]!==_0x206f8c){this[_0xf94a('0x1')]=_0x206f8c;io['to'](util[_0xf94a('0x1a')]('mail:queue:%s',_0x420d91[_0xf94a('0x7')]))[_0xf94a('0x1b')]('mail_queue:save',_0x420d91);}};module[_0xf94a('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9125c7f..b3078b8 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 _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1261,0x144));var _0x1126=function(_0x302b5e,_0x564a8e){_0x302b5e=_0x302b5e-0x0;var _0x523ab7=_0x1261[_0x302b5e];return _0x523ab7;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x326f,0xd1));var _0xf326=function(_0x734198,_0x29dcd8){_0x734198=_0x734198-0x0;var _0x45b067=_0x326f[_0x734198];return _0x45b067;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ae99eb5..58b8a6f 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 _0x851e=['emit','exports','lodash','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s'];(function(_0x2dfa04,_0x287c21){var _0x5ba187=function(_0x1bd53e){while(--_0x1bd53e){_0x2dfa04['push'](_0x2dfa04['shift']());}};_0x5ba187(++_0x287c21);}(_0x851e,0x1e8));var _0xe851=function(_0x21ccfc,_0x48834e){_0x21ccfc=_0x21ccfc-0x0;var _0x279454=_0x851e[_0x21ccfc];return _0x279454;};'use strict';var _=require(_0xe851('0x0'));var md5=require(_0xe851('0x1'));var util=require(_0xe851('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe851('0x3')]=_[_0xe851('0x4')](config[_0xe851('0x3')],{'host':_0xe851('0x5'),'port':0x18eb});var io=require(_0xe851('0x6'))(new Redis(config['redis']));function SmsQueue(_0x2fbb11){this['id']=_0x2fbb11['id']||0x0;this[_0xe851('0x7')]=_0x2fbb11[_0xe851('0x7')]||'';this[_0xe851('0x8')]=_0x2fbb11[_0xe851('0x8')]||0xa;this['strategy']=_0x2fbb11[_0xe851('0x9')]||'beepall';this['Agents']=_0x2fbb11[_0xe851('0xa')];this[_0xe851('0xb')]={};this[_0xe851('0xc')]=0x0;this[_0xe851('0x1')]='';this['updateRouting']();this[_0xe851('0xd')]();}SmsQueue[_0xe851('0xe')][_0xe851('0xf')]=function(){var _0x4e360f=this[_0xe851('0xb')]['_rr'];this[_0xe851('0xb')]=_[_0xe851('0x10')](this['Agents'],'id');this[_0xe851('0xb')]['_rr']=_0x4e360f;};SmsQueue[_0xe851('0xe')]['updateRealtime']=function(){this[_0xe851('0x11')]=0x0;this[_0xe851('0x12')]=0x0;for(var _0x5960f2=0x0;_0x5960f2=0x0?this['available']:0x0;var _0x2d4cf5={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe851('0x11')],'name':this['name'],'paused':this[_0xe851('0x12')],'waiting':this[_0xe851('0xc')]};var _0x22c767=md5(JSON[_0xe851('0x16')](_0x2d4cf5));if(this[_0xe851('0x1')]!==_0x22c767){this[_0xe851('0x1')]=_0x22c767;io['to'](util[_0xe851('0x17')](_0xe851('0x18'),_0x2d4cf5['name']))[_0xe851('0x19')]('sms_queue:save',_0x2d4cf5);}};module[_0xe851('0x1a')]=SmsQueue; \ No newline at end of file +var _0x097c=['map','length','online','paused','loggedIn','available','format','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x097c,0x1d5));var _0xc097=function(_0x420338,_0x1e7ed9){_0x420338=_0x420338-0x0;var _0x1d54ce=_0x097c[_0x420338];return _0x1d54ce;};'use strict';var _=require(_0xc097('0x0'));var md5=require(_0xc097('0x1'));var util=require(_0xc097('0x2'));var Redis=require('ioredis');var config=require(_0xc097('0x3'));config[_0xc097('0x4')]=_[_0xc097('0x5')](config[_0xc097('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc097('0x6'))(new Redis(config['redis']));function SmsQueue(_0x22fe81){this['id']=_0x22fe81['id']||0x0;this[_0xc097('0x7')]=_0x22fe81[_0xc097('0x7')]||'';this[_0xc097('0x8')]=_0x22fe81['timeout']||0xa;this[_0xc097('0x9')]=_0x22fe81['strategy']||'beepall';this[_0xc097('0xa')]=_0x22fe81[_0xc097('0xa')];this[_0xc097('0xb')]={};this[_0xc097('0xc')]=0x0;this[_0xc097('0x1')]='';this[_0xc097('0xd')]();this[_0xc097('0xe')]();}SmsQueue[_0xc097('0xf')][_0xc097('0xd')]=function(){var _0x48c376=this[_0xc097('0xb')][_0xc097('0x10')];this['mapAgentsId']=_[_0xc097('0x11')](this[_0xc097('0xa')],'id');this[_0xc097('0xb')][_0xc097('0x10')]=_0x48c376;};SmsQueue[_0xc097('0xf')][_0xc097('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x42fd3a=0x0;_0x42fd3a=0x0?this[_0xc097('0x16')]:0x0;var _0x560cbb={'id':this['id'],'available':this[_0xc097('0x16')],'loggedIn':this[_0xc097('0x15')],'name':this[_0xc097('0x7')],'paused':this[_0xc097('0x14')],'waiting':this['waiting']};var _0x38da65=md5(JSON['stringify'](_0x560cbb));if(this['md5']!==_0x38da65){this['md5']=_0x38da65;io['to'](util[_0xc097('0x17')]('sms:queue:%s',_0x560cbb['name']))[_0xc097('0x18')](_0xc097('0x19'),_0x560cbb);}};module[_0xc097('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 08fb2f8..797a36e 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 _0xb4dc=['lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xb4dc,0xf0));var _0xcb4d=function(_0x4d2aea,_0x4a8f11){_0x4d2aea=_0x4d2aea-0x0;var _0x1715b8=_0xb4dc[_0x4d2aea];return _0x1715b8;};'use strict';var _=require(_0xcb4d('0x0'));var md5=require(_0xcb4d('0x1'));var util=require(_0xcb4d('0x2'));var Redis=require(_0xcb4d('0x3'));var config=require(_0xcb4d('0x4'));config['redis']=_['defaults'](config[_0xcb4d('0x5')],{'host':_0xcb4d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb4d('0x5')]));function WhatsappQueue(_0x3cd3d1){this['id']=_0x3cd3d1['id']||0x0;this[_0xcb4d('0x7')]=_0x3cd3d1[_0xcb4d('0x7')]||'';this['timeout']=_0x3cd3d1[_0xcb4d('0x8')]||0xa;this[_0xcb4d('0x9')]=_0x3cd3d1[_0xcb4d('0x9')]||_0xcb4d('0xa');this[_0xcb4d('0xb')]=_0x3cd3d1[_0xcb4d('0xb')];this['mapAgentsId']={};this[_0xcb4d('0xc')]=0x0;this[_0xcb4d('0x1')]='';this[_0xcb4d('0xd')]();this[_0xcb4d('0xe')]();}WhatsappQueue[_0xcb4d('0xf')][_0xcb4d('0xd')]=function(){var _0x2b4ca5=this[_0xcb4d('0x10')][_0xcb4d('0x11')];this['mapAgentsId']=_[_0xcb4d('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xcb4d('0x11')]=_0x2b4ca5;};WhatsappQueue['prototype'][_0xcb4d('0xe')]=function(){this[_0xcb4d('0x13')]=0x0;this[_0xcb4d('0x14')]=0x0;for(var _0x59c8e2=0x0;_0x59c8e2=0x0?this[_0xcb4d('0x18')]:0x0;var _0x33879a={'id':this['id'],'available':this[_0xcb4d('0x18')],'loggedIn':this[_0xcb4d('0x13')],'name':this[_0xcb4d('0x7')],'paused':this['paused'],'waiting':this[_0xcb4d('0xc')]};var _0x48a9dc=md5(JSON[_0xcb4d('0x19')](_0x33879a));if(this[_0xcb4d('0x1')]!==_0x48a9dc){this[_0xcb4d('0x1')]=_0x48a9dc;io['to'](util['format'](_0xcb4d('0x1a'),_0x33879a[_0xcb4d('0x7')]))[_0xcb4d('0x1b')](_0xcb4d('0x1c'),_0x33879a);}};module[_0xcb4d('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xcafc=['redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','waiting','updateRouting','updateRealtime','mapAgentsId','map','_rr','prototype','loggedIn','paused','length','Agents','online','available','stringify','md5','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment'];(function(_0x59f7b8,_0xb2ac21){var _0x7b28c5=function(_0x427d2d){while(--_0x427d2d){_0x59f7b8['push'](_0x59f7b8['shift']());}};_0x7b28c5(++_0xb2ac21);}(_0xcafc,0x147));var _0xccaf=function(_0x136271,_0x5946f6){_0x136271=_0x136271-0x0;var _0x2ecffc=_0xcafc[_0x136271];return _0x2ecffc;};'use strict';var _=require(_0xccaf('0x0'));var md5=require('md5');var util=require(_0xccaf('0x1'));var Redis=require('ioredis');var config=require(_0xccaf('0x2'));config[_0xccaf('0x3')]=_[_0xccaf('0x4')](config[_0xccaf('0x3')],{'host':_0xccaf('0x5'),'port':0x18eb});var io=require(_0xccaf('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x6465af){this['id']=_0x6465af['id']||0x0;this[_0xccaf('0x7')]=_0x6465af[_0xccaf('0x7')]||'';this['timeout']=_0x6465af['timeout']||0xa;this[_0xccaf('0x8')]=_0x6465af[_0xccaf('0x8')]||_0xccaf('0x9');this['Agents']=_0x6465af['Agents'];this['mapAgentsId']={};this[_0xccaf('0xa')]=0x0;this['md5']='';this[_0xccaf('0xb')]();this[_0xccaf('0xc')]();}WhatsappQueue['prototype'][_0xccaf('0xb')]=function(){var _0x2f5dc2=this[_0xccaf('0xd')]['_rr'];this[_0xccaf('0xd')]=_[_0xccaf('0xe')](this['Agents'],'id');this[_0xccaf('0xd')][_0xccaf('0xf')]=_0x2f5dc2;};WhatsappQueue[_0xccaf('0x10')][_0xccaf('0xc')]=function(){this[_0xccaf('0x11')]=0x0;this[_0xccaf('0x12')]=0x0;for(var _0x20ec72=0x0;_0x20ec72=0x0?this['available']:0x0;var _0x459866={'id':this['id'],'available':this[_0xccaf('0x16')],'loggedIn':this[_0xccaf('0x11')],'name':this[_0xccaf('0x7')],'paused':this[_0xccaf('0x12')],'waiting':this[_0xccaf('0xa')]};var _0x47244a=md5(JSON[_0xccaf('0x17')](_0x459866));if(this[_0xccaf('0x18')]!==_0x47244a){this[_0xccaf('0x18')]=_0x47244a;io['to'](util[_0xccaf('0x19')](_0xccaf('0x1a'),_0x459866[_0xccaf('0x7')]))[_0xccaf('0x1b')](_0xccaf('0x1c'),_0x459866);}};module[_0xccaf('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4f9566e..5e725e8 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x366284,_0x307e72){var _0x10e497=function(_0x26b09f){while(--_0x26b09f){_0x366284['push'](_0x366284['shift']());}};_0x10e497(++_0x307e72);}(_0xb10b,0x12a));var _0xbb10=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0xb10b[_0x699200];return _0x266fd1;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 3b53a4d..2cfb9a8 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 _0xdddf=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x49c8a2,_0x58dcff){var _0xe46e67=function(_0x547e69){while(--_0x547e69){_0x49c8a2['push'](_0x49c8a2['shift']());}};_0xe46e67(++_0x58dcff);}(_0xdddf,0x178));var _0xfddd=function(_0x31afb7,_0x21e40b){_0x31afb7=_0x31afb7-0x0;var _0x39e9fd=_0xdddf[_0x31afb7];return _0x39e9fd;};'use strict';var client=require(_0xfddd('0x0'));exports[_0xfddd('0x1')]=function(_0x34f13a,_0x2f3ade){return client[_0xfddd('0x2')](_0xfddd('0x3'),{'body':_0x2f3ade,'options':{'where':{'id':_0x34f13a}},'log':'updateChatInteraction'});};exports[_0xfddd('0x4')]=function(_0x17dbe8,_0x4bb90d){return client[_0xfddd('0x2')](_0xfddd('0x5'),{'body':_0x4bb90d,'options':{'where':{'id':_0x17dbe8}},'log':_0xfddd('0x6')});}; \ No newline at end of file +var _0x0987=['addTagsToChatInteraction','update','Request','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0x380991,_0x3bd436){var _0x173ccb=function(_0x15b58a){while(--_0x15b58a){_0x380991['push'](_0x380991['shift']());}};_0x173ccb(++_0x3bd436);}(_0x0987,0x157));var _0x7098=function(_0x8172fd,_0x10c0f3){_0x8172fd=_0x8172fd-0x0;var _0x15cfe1=_0x0987[_0x8172fd];return _0x15cfe1;};'use strict';var client=require('../client');exports[_0x7098('0x0')]=function(_0x56998f,_0x9c7166){return client[_0x7098('0x1')]('UpdateChatInteraction',{'body':_0x9c7166,'options':{'where':{'id':_0x56998f}},'log':_0x7098('0x2')});};exports[_0x7098('0x3')]=function(_0x3d0ea9,_0x52d71d){return client[_0x7098('0x1')](_0x7098('0x4'),{'body':_0x52d71d,'options':{'where':{'id':_0x3d0ea9}},'log':_0x7098('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e8d9f90..385b622 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 _0xacb9=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x49bb08,_0x5e51ec){var _0x992beb=function(_0x3ca477){while(--_0x3ca477){_0x49bb08['push'](_0x49bb08['shift']());}};_0x992beb(++_0x5e51ec);}(_0xacb9,0x134));var _0x9acb=function(_0x18a1f6,_0x5356c4){_0x18a1f6=_0x18a1f6-0x0;var _0x493551=_0xacb9[_0x18a1f6];return _0x493551;};'use strict';var client=require(_0x9acb('0x0'));exports[_0x9acb('0x1')]=function(_0x1cd913){return client[_0x9acb('0x2')](_0x9acb('0x3'),{'body':_0x1cd913,'log':_0x9acb('0x4')});}; \ No newline at end of file +var _0x6ac9=['createChatMessage','../client','create','CreateChatMessage'];(function(_0x3496d2,_0x54193c){var _0x282531=function(_0x366974){while(--_0x366974){_0x3496d2['push'](_0x3496d2['shift']());}};_0x282531(++_0x54193c);}(_0x6ac9,0x131));var _0x96ac=function(_0x280025,_0x27ce69){_0x280025=_0x280025-0x0;var _0x34338a=_0x6ac9[_0x280025];return _0x34338a;};'use strict';var client=require(_0x96ac('0x0'));exports[_0x96ac('0x1')]=function(_0x31df2a){return client['Request'](_0x96ac('0x2'),{'body':_0x31df2a,'log':_0x96ac('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index bd03738..e75d28a 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 _0x4453=['Agents','online','chatPause','../client','getChatQueues','GetChatQueue','name','strategy','User'];(function(_0x79cfbf,_0x39dc91){var _0x19656c=function(_0x5b2c2a){while(--_0x5b2c2a){_0x79cfbf['push'](_0x79cfbf['shift']());}};_0x19656c(++_0x39dc91);}(_0x4453,0x9c));var _0x3445=function(_0x5f0ecc,_0x51c82e){_0x5f0ecc=_0x5f0ecc-0x0;var _0x5e0cbe=_0x4453[_0x5f0ecc];return _0x5e0cbe;};'use strict';var client=require(_0x3445('0x0'));exports[_0x3445('0x1')]=function(){return function(){return client['Request'](_0x3445('0x2'),{'options':{'raw':![],'attributes':['id',_0x3445('0x3'),'timeout',_0x3445('0x4')],'include':[{'model':_0x3445('0x5'),'as':_0x3445('0x6'),'attributes':['id',_0x3445('0x3'),_0x3445('0x7'),_0x3445('0x8')]}]},'log':_0x3445('0x1')});};}; \ No newline at end of file +var _0x3148=['getChatQueues','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client'];(function(_0xfde72e,_0x3847c1){var _0x18ca84=function(_0x3d343e){while(--_0x3d343e){_0xfde72e['push'](_0xfde72e['shift']());}};_0x18ca84(++_0x3847c1);}(_0x3148,0x1d3));var _0x8314=function(_0x29e9e3,_0x4deb93){_0x29e9e3=_0x29e9e3-0x0;var _0x58452d=_0x3148[_0x29e9e3];return _0x58452d;};'use strict';var client=require(_0x8314('0x0'));exports[_0x8314('0x1')]=function(){return function(){return client['Request'](_0x8314('0x2'),{'options':{'raw':![],'attributes':['id',_0x8314('0x3'),_0x8314('0x4'),_0x8314('0x5')],'include':[{'model':'User','as':_0x8314('0x6'),'attributes':['id',_0x8314('0x3'),_0x8314('0x7'),_0x8314('0x8')]}]},'log':_0x8314('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0374128..a876a1b 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 _0x323b=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x3bf737,_0x5380e6){var _0x538fb4=function(_0x56e5a0){while(--_0x56e5a0){_0x3bf737['push'](_0x3bf737['shift']());}};_0x538fb4(++_0x5380e6);}(_0x323b,0x1ad));var _0xb323=function(_0x12b282,_0x320c5f){_0x12b282=_0x12b282-0x0;var _0x15bf13=_0x323b[_0x12b282];return _0x15bf13;};'use strict';var client=require(_0xb323('0x0'));exports['create']=function(_0x124e69){return client[_0xb323('0x1')](_0xb323('0x2'),{'body':_0x124e69,'log':'CreateChatQueueReport'});};exports[_0xb323('0x3')]=function(_0x4532c7,_0x3bcab5){return client[_0xb323('0x1')](_0xb323('0x4'),{'body':_0x3bcab5,'options':{'where':{'uniqueid':_0x4532c7},'order':[['id',_0xb323('0x5')]],'limit':0x1},'log':_0xb323('0x4')});}; \ No newline at end of file +var _0xb6b1=['CreateChatQueueReport','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xb6b1[_0x4ae829];return _0x256b31;};'use strict';var client=require(_0x1b6b('0x0'));exports['create']=function(_0x669faa){return client['Request'](_0x1b6b('0x1'),{'body':_0x669faa,'log':_0x1b6b('0x1')});};exports['update']=function(_0x3f12e2,_0x5100e5){return client[_0x1b6b('0x2')](_0x1b6b('0x3'),{'body':_0x5100e5,'options':{'where':{'uniqueid':_0x3f12e2},'order':[['id',_0x1b6b('0x4')]],'limit':0x1},'log':_0x1b6b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 75b698b..e678690 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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0xcf63b9,_0x221458){_0xcf63b9=_0xcf63b9-0x0;var _0x51797e=_0x7a54[_0xcf63b9];return _0x51797e;};'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(_0xed5f9c,_0x5a25cd){var _0x3a1c43=function(_0x251202){while(--_0x251202){_0xed5f9c['push'](_0xed5f9c['shift']());}};_0x3a1c43(++_0x5a25cd);}(_0x7a54,0x106));var _0x47a5=function(_0x59a876,_0x133206){_0x59a876=_0x59a876-0x0;var _0x5b26d5=_0x7a54[_0x59a876];return _0x5b26d5;};'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 29c1413..667b00b 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 _0x2e7e=['../client','create','Request','createFaxMessage'];(function(_0xae282f,_0x2d9368){var _0x5f46d4=function(_0x4f703e){while(--_0x4f703e){_0xae282f['push'](_0xae282f['shift']());}};_0x5f46d4(++_0x2d9368);}(_0x2e7e,0x160));var _0xe2e7=function(_0x14b20d,_0x57dc8f){_0x14b20d=_0x14b20d-0x0;var _0x122357=_0x2e7e[_0x14b20d];return _0x122357;};'use strict';var client=require(_0xe2e7('0x0'));exports[_0xe2e7('0x1')]=function(_0x4b960b){return client[_0xe2e7('0x2')]('CreateFaxMessage',{'body':_0x4b960b,'log':_0xe2e7('0x3')});}; \ No newline at end of file +var _0x71fe=['Request','CreateFaxMessage','../client','create'];(function(_0x457348,_0x3e90f9){var _0x1310ce=function(_0x50482e){while(--_0x50482e){_0x457348['push'](_0x457348['shift']());}};_0x1310ce(++_0x3e90f9);}(_0x71fe,0x1de));var _0xe71f=function(_0x34d36a,_0x200da9){_0x34d36a=_0x34d36a-0x0;var _0xc4f7b=_0x71fe[_0x34d36a];return _0xc4f7b;};'use strict';var client=require(_0xe71f('0x0'));exports[_0xe71f('0x1')]=function(_0x5bbb07){return client[_0xe71f('0x2')](_0xe71f('0x3'),{'body':_0x5bbb07,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 570b0ed..47855b3 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 _0x5e86=['User','online','faxPause','../client','getFaxQueues','Request','name','strategy'];(function(_0x54e2da,_0x599f6c){var _0x57d65f=function(_0x276b82){while(--_0x276b82){_0x54e2da['push'](_0x54e2da['shift']());}};_0x57d65f(++_0x599f6c);}(_0x5e86,0x1e3));var _0x65e8=function(_0x4e9692,_0x3455be){_0x4e9692=_0x4e9692-0x0;var _0x3b8f5c=_0x5e86[_0x4e9692];return _0x3b8f5c;};'use strict';var client=require(_0x65e8('0x0'));exports[_0x65e8('0x1')]=function(){return function(){return client[_0x65e8('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x65e8('0x3'),'timeout',_0x65e8('0x4')],'include':[{'model':_0x65e8('0x5'),'as':'Agents','attributes':['id',_0x65e8('0x3'),_0x65e8('0x6'),_0x65e8('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x2c38=['timeout','Agents','online','../client','getFaxQueues','GetFaxQueue','name'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2c38,0x1e6));var _0x82c3=function(_0x414297,_0x18578e){_0x414297=_0x414297-0x0;var _0x51ea47=_0x2c38[_0x414297];return _0x51ea47;};'use strict';var client=require(_0x82c3('0x0'));exports[_0x82c3('0x1')]=function(){return function(){return client['Request'](_0x82c3('0x2'),{'options':{'raw':![],'attributes':['id',_0x82c3('0x3'),_0x82c3('0x4'),'strategy'],'include':[{'model':'User','as':_0x82c3('0x5'),'attributes':['id',_0x82c3('0x3'),_0x82c3('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 2073dc0..0fbd066 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 _0xd602=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update'];(function(_0x387a42,_0x5735df){var _0x1e5843=function(_0x5af3c9){while(--_0x5af3c9){_0x387a42['push'](_0x387a42['shift']());}};_0x1e5843(++_0x5735df);}(_0xd602,0xea));var _0x2d60=function(_0x467507,_0x4fa8c0){_0x467507=_0x467507-0x0;var _0x15768c=_0xd602[_0x467507];return _0x15768c;};'use strict';var client=require(_0x2d60('0x0'));exports[_0x2d60('0x1')]=function(_0x43a073){return client['Request'](_0x2d60('0x2'),{'body':_0x43a073,'log':_0x2d60('0x2')});};exports[_0x2d60('0x3')]=function(_0x3561c7,_0x5c99e3){return client[_0x2d60('0x4')](_0x2d60('0x5'),{'body':_0x5c99e3,'options':{'where':{'uniqueid':_0x3561c7},'order':[['id',_0x2d60('0x6')]],'limit':0x1},'log':_0x2d60('0x5')});}; \ No newline at end of file +var _0x8931=['../client','create','Request','UpdateFaxQueueReport'];(function(_0x117581,_0x307e77){var _0x25cfa7=function(_0xcb89ee){while(--_0xcb89ee){_0x117581['push'](_0x117581['shift']());}};_0x25cfa7(++_0x307e77);}(_0x8931,0x14c));var _0x1893=function(_0x52747c,_0x2ed053){_0x52747c=_0x52747c-0x0;var _0x41e9ed=_0x8931[_0x52747c];return _0x41e9ed;};'use strict';var client=require(_0x1893('0x0'));exports[_0x1893('0x1')]=function(_0x187c15){return client['Request']('CreateFaxQueueReport',{'body':_0x187c15,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x318f02,_0x4b5732){return client[_0x1893('0x2')](_0x1893('0x3'),{'body':_0x4b5732,'options':{'where':{'uniqueid':_0x318f02},'order':[['id','DESC']],'limit':0x1},'log':_0x1893('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index adae1c2..142d40c 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 _0x30c4=['getIntervals','GetInterval','Interval','Intervals','interval','../client'];(function(_0x4361b6,_0x29e3fe){var _0x477231=function(_0x4c570d){while(--_0x4c570d){_0x4361b6['push'](_0x4361b6['shift']());}};_0x477231(++_0x29e3fe);}(_0x30c4,0x13d));var _0x430c=function(_0xea322b,_0x15dc0c){_0xea322b=_0xea322b-0x0;var _0x304ea2=_0x30c4[_0xea322b];return _0x304ea2;};'use strict';var client=require(_0x430c('0x0'));exports[_0x430c('0x1')]=function(){return function(){return client['Request'](_0x430c('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x430c('0x3'),'as':_0x430c('0x4'),'attributes':['id','name',_0x430c('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x5be9=['name','Interval','Intervals','interval','getIntervals','Request'];(function(_0x3da577,_0x1fe4f3){var _0x33e935=function(_0x3b714b){while(--_0x3b714b){_0x3da577['push'](_0x3da577['shift']());}};_0x33e935(++_0x1fe4f3);}(_0x5be9,0xca));var _0x95be=function(_0x42b985,_0xe75128){_0x42b985=_0x42b985-0x0;var _0x4e528f=_0x5be9[_0x42b985];return _0x4e528f;};'use strict';var client=require('../client');exports[_0x95be('0x0')]=function(){return function(){return client[_0x95be('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x95be('0x2')],'include':[{'model':_0x95be('0x3'),'as':_0x95be('0x4'),'attributes':['id',_0x95be('0x2'),_0x95be('0x5')]}]},'log':_0x95be('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f2a9df9..cc20ac5 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 _0xf61e=['addTags','AddTagsToMailInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf61e,0x191));var _0xef61=function(_0x546204,_0x4863b6){_0x546204=_0x546204-0x0;var _0xfbad36=_0xf61e[_0x546204];return _0xfbad36;};'use strict';var client=require(_0xef61('0x0'));exports[_0xef61('0x1')]=function(_0xe535c3,_0xcf15bd){return client[_0xef61('0x2')](_0xef61('0x3'),{'body':_0xcf15bd,'options':{'where':{'id':_0xe535c3}},'log':_0xef61('0x4')});};exports[_0xef61('0x5')]=function(_0x2bd1d0,_0x14122a){return client[_0xef61('0x2')](_0xef61('0x6'),{'body':_0x14122a,'options':{'where':{'id':_0x2bd1d0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x28f2=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x3d888d,_0x1661ce){var _0x403191=function(_0x9a52cd){while(--_0x9a52cd){_0x3d888d['push'](_0x3d888d['shift']());}};_0x403191(++_0x1661ce);}(_0x28f2,0x193));var _0x228f=function(_0x395205,_0x810a86){_0x395205=_0x395205-0x0;var _0x55c3be=_0x28f2[_0x395205];return _0x55c3be;};'use strict';var client=require(_0x228f('0x0'));exports[_0x228f('0x1')]=function(_0x108337,_0x2e5e0b){return client[_0x228f('0x2')]('UpdateMailInteraction',{'body':_0x2e5e0b,'options':{'where':{'id':_0x108337}},'log':_0x228f('0x3')});};exports[_0x228f('0x4')]=function(_0x79ed5f,_0x4303c3){return client[_0x228f('0x2')](_0x228f('0x5'),{'body':_0x4303c3,'options':{'where':{'id':_0x79ed5f}},'log':_0x228f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index dcaa704..a42e548 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 _0x35e1=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x4b3e6e,_0x319d30){var _0x37361f=function(_0x4d0847){while(--_0x4d0847){_0x4b3e6e['push'](_0x4b3e6e['shift']());}};_0x37361f(++_0x319d30);}(_0x35e1,0x1a6));var _0x135e=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0x35e1[_0x7f3667];return _0x2c4c24;};'use strict';var client=require(_0x135e('0x0'));exports[_0x135e('0x1')]=function(_0x38e69a){return client[_0x135e('0x2')](_0x135e('0x3'),{'body':_0x38e69a,'log':_0x135e('0x4')});}; \ No newline at end of file +var _0x6970=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x518990,_0x8fa098){var _0x258811=function(_0x479279){while(--_0x479279){_0x518990['push'](_0x518990['shift']());}};_0x258811(++_0x8fa098);}(_0x6970,0x1c7));var _0x0697=function(_0x39d6c2,_0x4746f6){_0x39d6c2=_0x39d6c2-0x0;var _0x2a1795=_0x6970[_0x39d6c2];return _0x2a1795;};'use strict';var client=require(_0x0697('0x0'));exports[_0x0697('0x1')]=function(_0x123773){return client[_0x0697('0x2')](_0x0697('0x3'),{'body':_0x123773,'log':_0x0697('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 00db61b..233bf88 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 _0xabcc=['Agents','online','mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x78b514,_0x7f6d49){var _0x4d3aba=function(_0xd9869e){while(--_0xd9869e){_0x78b514['push'](_0x78b514['shift']());}};_0x4d3aba(++_0x7f6d49);}(_0xabcc,0x7b));var _0xcabc=function(_0x23fcad,_0x2b4c2e){_0x23fcad=_0x23fcad-0x0;var _0x3e4d60=_0xabcc[_0x23fcad];return _0x3e4d60;};'use strict';var client=require('../client');exports[_0xcabc('0x0')]=function(){return function(){return client[_0xcabc('0x1')](_0xcabc('0x2'),{'options':{'raw':![],'attributes':['id',_0xcabc('0x3'),_0xcabc('0x4'),_0xcabc('0x5')],'include':[{'model':_0xcabc('0x6'),'as':_0xcabc('0x7'),'attributes':['id',_0xcabc('0x3'),_0xcabc('0x8'),_0xcabc('0x9')]}]},'log':_0xcabc('0x0')});};}; \ No newline at end of file +var _0x292c=['User','Agents','mailPause','getMailQueues','name','strategy'];(function(_0x8d77d7,_0x3be0c5){var _0x5110ae=function(_0x1f39ae){while(--_0x1f39ae){_0x8d77d7['push'](_0x8d77d7['shift']());}};_0x5110ae(++_0x3be0c5);}(_0x292c,0x17d));var _0xc292=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x292c[_0x236d24];return _0x1574cf;};'use strict';var client=require('../client');exports[_0xc292('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc292('0x1'),'timeout',_0xc292('0x2')],'include':[{'model':_0xc292('0x3'),'as':_0xc292('0x4'),'attributes':['id','name','online',_0xc292('0x5')]}]},'log':_0xc292('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 5486fca..f9a8c55 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 _0x1f10=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1f10,0x149));var _0x01f1=function(_0x1543ab,_0x12fdf3){_0x1543ab=_0x1543ab-0x0;var _0x287673=_0x1f10[_0x1543ab];return _0x287673;};'use strict';var client=require(_0x01f1('0x0'));exports[_0x01f1('0x1')]=function(_0x26c8bb){return client[_0x01f1('0x2')](_0x01f1('0x3'),{'body':_0x26c8bb,'log':'CreateMailQueueReport'});};exports[_0x01f1('0x4')]=function(_0x4825e1,_0x168d39){return client[_0x01f1('0x2')](_0x01f1('0x5'),{'body':_0x168d39,'options':{'where':{'uniqueid':_0x4825e1},'order':[['id',_0x01f1('0x6')]],'limit':0x1},'log':_0x01f1('0x5')});}; \ No newline at end of file +var _0x839b=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x173e4e,_0x24de6){var _0x52597c=function(_0x4c1916){while(--_0x4c1916){_0x173e4e['push'](_0x173e4e['shift']());}};_0x52597c(++_0x24de6);}(_0x839b,0x16b));var _0xb839=function(_0x296431,_0x32287f){_0x296431=_0x296431-0x0;var _0x4c18cb=_0x839b[_0x296431];return _0x4c18cb;};'use strict';var client=require(_0xb839('0x0'));exports[_0xb839('0x1')]=function(_0x1ee3f2){return client[_0xb839('0x2')](_0xb839('0x3'),{'body':_0x1ee3f2,'log':_0xb839('0x3')});};exports[_0xb839('0x4')]=function(_0x4ef791,_0x59f201){return client[_0xb839('0x2')](_0xb839('0x5'),{'body':_0x59f201,'options':{'where':{'uniqueid':_0x4ef791},'order':[['id','DESC']],'limit':0x1},'log':_0xb839('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index b093c69..687ad09 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 _0xf988=['update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x57841a,_0x3bf283){var _0x588bab=function(_0x8127a7){while(--_0x8127a7){_0x57841a['push'](_0x57841a['shift']());}};_0x588bab(++_0x3bf283);}(_0xf988,0x16d));var _0x8f98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf988[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x8f98('0x0'));exports[_0x8f98('0x1')]=function(_0x1a9771,_0x1e35ab){return client[_0x8f98('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1e35ab,'options':{'where':{'id':_0x1a9771}},'log':_0x8f98('0x3')});};exports['addTags']=function(_0x28a2f9,_0x28a307){return client[_0x8f98('0x2')](_0x8f98('0x4'),{'body':_0x28a307,'options':{'where':{'id':_0x28a2f9}},'log':_0x8f98('0x5')});}; \ No newline at end of file +var _0xa8bd=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x17bf38,_0x2935a2){var _0x3d7b40=function(_0x4f2c43){while(--_0x4f2c43){_0x17bf38['push'](_0x17bf38['shift']());}};_0x3d7b40(++_0x2935a2);}(_0xa8bd,0x1df));var _0xda8b=function(_0x4528f5,_0x4caa39){_0x4528f5=_0x4528f5-0x0;var _0x28b6d2=_0xa8bd[_0x4528f5];return _0x28b6d2;};'use strict';var client=require(_0xda8b('0x0'));exports[_0xda8b('0x1')]=function(_0xea20c1,_0x3ba167){return client[_0xda8b('0x2')](_0xda8b('0x3'),{'body':_0x3ba167,'options':{'where':{'id':_0xea20c1}},'log':_0xda8b('0x4')});};exports[_0xda8b('0x5')]=function(_0x69ecc0,_0x550036){return client[_0xda8b('0x2')](_0xda8b('0x6'),{'body':_0x550036,'options':{'where':{'id':_0x69ecc0}},'log':_0xda8b('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 4917c17..cfdab77 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 _0x5f2d=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x2a26c9,_0x1de138){var _0xb4fdd7=function(_0xb440d){while(--_0xb440d){_0x2a26c9['push'](_0x2a26c9['shift']());}};_0xb4fdd7(++_0x1de138);}(_0x5f2d,0x1d5));var _0xd5f2=function(_0x172be7,_0x528e8a){_0x172be7=_0x172be7-0x0;var _0x19cd9a=_0x5f2d[_0x172be7];return _0x19cd9a;};'use strict';var client=require(_0xd5f2('0x0'));exports['create']=function(_0x3c4364){return client['Request'](_0xd5f2('0x1'),{'body':_0x3c4364,'log':_0xd5f2('0x2')});}; \ No newline at end of file +var _0x460c=['createOpenchannelMessage','create','Request'];(function(_0x25b8b1,_0xe0b951){var _0x2d04f7=function(_0x1a45b8){while(--_0x1a45b8){_0x25b8b1['push'](_0x25b8b1['shift']());}};_0x2d04f7(++_0xe0b951);}(_0x460c,0x6d));var _0xc460=function(_0xa8918f,_0x478a38){_0xa8918f=_0xa8918f-0x0;var _0x223bcc=_0x460c[_0xa8918f];return _0x223bcc;};'use strict';var client=require('../client');exports[_0xc460('0x0')]=function(_0x4dcfe6){return client[_0xc460('0x1')]('CreateOpenchannelMessage',{'body':_0x4dcfe6,'log':_0xc460('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index cf82b7f..6256f5b 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 _0xcbdf=['Request','GetOpenchannelQueue','name','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x154cbb,_0x43c57f){var _0x494584=function(_0x971bd9){while(--_0x971bd9){_0x154cbb['push'](_0x154cbb['shift']());}};_0x494584(++_0x43c57f);}(_0xcbdf,0xbf));var _0xfcbd=function(_0x557006,_0x12c267){_0x557006=_0x557006-0x0;var _0x10d189=_0xcbdf[_0x557006];return _0x10d189;};'use strict';var client=require('../client');exports[_0xfcbd('0x0')]=function(){return function(){return client[_0xfcbd('0x1')](_0xfcbd('0x2'),{'options':{'raw':![],'attributes':['id',_0xfcbd('0x3'),'timeout','strategy'],'include':[{'model':_0xfcbd('0x4'),'as':_0xfcbd('0x5'),'attributes':['id',_0xfcbd('0x3'),_0xfcbd('0x6'),_0xfcbd('0x7')]}]},'log':_0xfcbd('0x0')});};}; \ No newline at end of file +var _0xc8d8=['openchannelPause','getOpenchannelQueues','strategy','User','Agents','name'];(function(_0xa57d66,_0x19cb3a){var _0x3b06a2=function(_0x28c6f9){while(--_0x28c6f9){_0xa57d66['push'](_0xa57d66['shift']());}};_0x3b06a2(++_0x19cb3a);}(_0xc8d8,0xe5));var _0x8c8d=function(_0x5a7521,_0x2d1d5e){_0x5a7521=_0x5a7521-0x0;var _0x3d6e6a=_0xc8d8[_0x5a7521];return _0x3d6e6a;};'use strict';var client=require('../client');exports[_0x8c8d('0x0')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x8c8d('0x1')],'include':[{'model':_0x8c8d('0x2'),'as':_0x8c8d('0x3'),'attributes':['id',_0x8c8d('0x4'),'online',_0x8c8d('0x5')]}]},'log':_0x8c8d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3405867..d055f22 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 _0xb666=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x5a9ed3,_0x14aca6){var _0xc1fe4e=function(_0x367b1f){while(--_0x367b1f){_0x5a9ed3['push'](_0x5a9ed3['shift']());}};_0xc1fe4e(++_0x14aca6);}(_0xb666,0x1e6));var _0x6b66=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0xb666[_0x109dbd];return _0x395644;};'use strict';var client=require(_0x6b66('0x0'));exports[_0x6b66('0x1')]=function(_0x353493){return client[_0x6b66('0x2')](_0x6b66('0x3'),{'body':_0x353493,'log':_0x6b66('0x3')});};exports['update']=function(_0x3474c2,_0x272f81){return client[_0x6b66('0x2')](_0x6b66('0x4'),{'body':_0x272f81,'options':{'where':{'uniqueid':_0x3474c2},'order':[['id',_0x6b66('0x5')]],'limit':0x1},'log':_0x6b66('0x4')});}; \ No newline at end of file +var _0x7a92=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0xe92c4f,_0x5c3971){var _0x3372a3=function(_0x4a8576){while(--_0x4a8576){_0xe92c4f['push'](_0xe92c4f['shift']());}};_0x3372a3(++_0x5c3971);}(_0x7a92,0x1bc));var _0x27a9=function(_0x6ba357,_0xd5a7b9){_0x6ba357=_0x6ba357-0x0;var _0xc4d7a6=_0x7a92[_0x6ba357];return _0xc4d7a6;};'use strict';var client=require(_0x27a9('0x0'));exports[_0x27a9('0x1')]=function(_0x479ea6){return client[_0x27a9('0x2')](_0x27a9('0x3'),{'body':_0x479ea6,'log':_0x27a9('0x3')});};exports[_0x27a9('0x4')]=function(_0x386ee5,_0x338804){return client[_0x27a9('0x2')](_0x27a9('0x5'),{'body':_0x338804,'options':{'where':{'uniqueid':_0x386ee5},'order':[['id',_0x27a9('0x6')]],'limit':0x1},'log':_0x27a9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d7aa82c..89e22d8 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 _0xb957=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','Request'];(function(_0x2c24ae,_0x283166){var _0x321bc4=function(_0x57b48f){while(--_0x57b48f){_0x2c24ae['push'](_0x2c24ae['shift']());}};_0x321bc4(++_0x283166);}(_0xb957,0x6d));var _0x7b95=function(_0x5a9fd9,_0x2e7aa2){_0x5a9fd9=_0x5a9fd9-0x0;var _0x1a3ec1=_0xb957[_0x5a9fd9];return _0x1a3ec1;};'use strict';var client=require('../client');exports['update']=function(_0x433f9a,_0x5012da){return client[_0x7b95('0x0')](_0x7b95('0x1'),{'body':_0x5012da,'options':{'where':{'id':_0x433f9a}},'log':_0x7b95('0x2')});};exports['addTags']=function(_0x45db17,_0x2c8a4d){return client[_0x7b95('0x0')](_0x7b95('0x3'),{'body':_0x2c8a4d,'options':{'where':{'id':_0x45db17}},'log':_0x7b95('0x4')});}; \ No newline at end of file +var _0x10af=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x32c2d3,_0x2ff9d5){var _0x4361df=function(_0x27ad03){while(--_0x27ad03){_0x32c2d3['push'](_0x32c2d3['shift']());}};_0x4361df(++_0x2ff9d5);}(_0x10af,0xfc));var _0xf10a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x10af[_0x486f4a];return _0x135d99;};'use strict';var client=require(_0xf10a('0x0'));exports['update']=function(_0x24a86d,_0x6b2db9){return client[_0xf10a('0x1')](_0xf10a('0x2'),{'body':_0x6b2db9,'options':{'where':{'id':_0x24a86d}},'log':_0xf10a('0x3')});};exports[_0xf10a('0x4')]=function(_0xbffc71,_0x13b338){return client['Request'](_0xf10a('0x5'),{'body':_0x13b338,'options':{'where':{'id':_0xbffc71}},'log':_0xf10a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c15dbcf..9bff242 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 _0x8956=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x9ba197,_0x369eba){var _0x4a915d=function(_0x4410b4){while(--_0x4410b4){_0x9ba197['push'](_0x9ba197['shift']());}};_0x4a915d(++_0x369eba);}(_0x8956,0x94));var _0x6895=function(_0x111c3c,_0x2fa368){_0x111c3c=_0x111c3c-0x0;var _0x18cd53=_0x8956[_0x111c3c];return _0x18cd53;};'use strict';var client=require(_0x6895('0x0'));exports[_0x6895('0x1')]=function(_0x426957){return client[_0x6895('0x2')](_0x6895('0x3'),{'body':_0x426957,'log':_0x6895('0x4')});}; \ No newline at end of file +var _0xe083=['../client','create','Request','CreateSmsMessage'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe083,0x168));var _0x3e08=function(_0x69ecb0,_0x5a46d8){_0x69ecb0=_0x69ecb0-0x0;var _0x29eb9a=_0xe083[_0x69ecb0];return _0x29eb9a;};'use strict';var client=require(_0x3e08('0x0'));exports[_0x3e08('0x1')]=function(_0x337dde){return client[_0x3e08('0x2')](_0x3e08('0x3'),{'body':_0x337dde,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 63aa692..957e7e6 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x4c413a,_0xa6a30a){var _0x347858=function(_0x3028bb){while(--_0x3028bb){_0x4c413a['push'](_0x4c413a['shift']());}};_0x347858(++_0xa6a30a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x32ece9,_0x35c9a1){var _0x4244ef=function(_0x4995cb){while(--_0x4995cb){_0x32ece9['push'](_0x32ece9['shift']());}};_0x4244ef(++_0x35c9a1);}(_0xe706,0xa3));var _0x6e70=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xe706[_0x576e2b];return _0x46461a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 04b82c3..eae992f 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1be334,_0x3f3b30){var _0x17d555=function(_0x18dc25){while(--_0x18dc25){_0x1be334['push'](_0x1be334['shift']());}};_0x17d555(++_0x3f3b30);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x11a88e,_0x326a52){var _0x330d18=function(_0x393158){while(--_0x393158){_0x11a88e['push'](_0x11a88e['shift']());}};_0x330d18(++_0x326a52);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index e0e372e..0a333af 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(_0x2422f8,_0x349144){var _0x380780=function(_0x223fdb){while(--_0x223fdb){_0x2422f8['push'](_0x2422f8['shift']());}};_0x380780(++_0x349144);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x4562b2,_0x1d236f){var _0x711917=function(_0x2af728){while(--_0x2af728){_0x4562b2['push'](_0x4562b2['shift']());}};_0x711917(++_0x1d236f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 b31e278..36afb12 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 _0x7c1a=['UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0xcba6fa,_0xdb3f9c){var _0x12edb5=function(_0x493810){while(--_0x493810){_0xcba6fa['push'](_0xcba6fa['shift']());}};_0x12edb5(++_0xdb3f9c);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1bf36f,_0x4f6a94){_0x1bf36f=_0x1bf36f-0x0;var _0x1f79b6=_0x7c1a[_0x1bf36f];return _0x1f79b6;};'use strict';var client=require(_0xa7c1('0x0'));exports[_0xa7c1('0x1')]=function(_0x285492,_0x38f547){return client[_0xa7c1('0x2')](_0xa7c1('0x3'),{'body':_0x38f547,'options':{'where':{'id':_0x285492}},'log':'updateWhatsappInteraction'});};exports[_0xa7c1('0x4')]=function(_0x132b08,_0x506858){return client[_0xa7c1('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x506858,'options':{'where':{'id':_0x132b08}},'log':_0xa7c1('0x5')});}; \ No newline at end of file +var _0xef4d=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xef4d,0x165));var _0xdef4=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xef4d[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0xdef4('0x0'));exports[_0xdef4('0x1')]=function(_0x3a58e5,_0x19554d){return client[_0xdef4('0x2')](_0xdef4('0x3'),{'body':_0x19554d,'options':{'where':{'id':_0x3a58e5}},'log':_0xdef4('0x4')});};exports[_0xdef4('0x5')]=function(_0x71c4c5,_0x267244){return client[_0xdef4('0x2')](_0xdef4('0x6'),{'body':_0x267244,'options':{'where':{'id':_0x71c4c5}},'log':_0xdef4('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index a6c6c66..da056b0 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 _0x9037=['createWhatsappMessage','create','Request','CreateWhatsappMessage'];(function(_0x3bd8ac,_0x2127ec){var _0x4e2050=function(_0xf89fc7){while(--_0xf89fc7){_0x3bd8ac['push'](_0x3bd8ac['shift']());}};_0x4e2050(++_0x2127ec);}(_0x9037,0x1c9));var _0x7903=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9037[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0x7903('0x0')]=function(_0x2ebf3d){return client[_0x7903('0x1')](_0x7903('0x2'),{'body':_0x2ebf3d,'log':_0x7903('0x3')});}; \ No newline at end of file +var _0xac65=['create','Request','CreateWhatsappMessage'];(function(_0xa92559,_0x1d2e45){var _0x502df8=function(_0x3321db){while(--_0x3321db){_0xa92559['push'](_0xa92559['shift']());}};_0x502df8(++_0x1d2e45);}(_0xac65,0x1d4));var _0x5ac6=function(_0x22f58c,_0x49cf92){_0x22f58c=_0x22f58c-0x0;var _0x3abef3=_0xac65[_0x22f58c];return _0x3abef3;};'use strict';var client=require('../client');exports[_0x5ac6('0x0')]=function(_0x39109f){return client[_0x5ac6('0x1')](_0x5ac6('0x2'),{'body':_0x39109f,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 60c24c9..66ff064 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 _0x33d0=['getWhatsappQueues','Request','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x33d0,0x10d));var _0x033d=function(_0x17ca43,_0x28d8d9){_0x17ca43=_0x17ca43-0x0;var _0x13ca78=_0x33d0[_0x17ca43];return _0x13ca78;};'use strict';var client=require(_0x033d('0x0'));exports[_0x033d('0x1')]=function(){return function(){return client[_0x033d('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x033d('0x3'),_0x033d('0x4'),_0x033d('0x5')],'include':[{'model':_0x033d('0x6'),'as':_0x033d('0x7'),'attributes':['id',_0x033d('0x3'),'online',_0x033d('0x8')]}]},'log':_0x033d('0x1')});};}; \ No newline at end of file +var _0x7afc=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','../client'];(function(_0x48e6a1,_0x15743d){var _0x45fd3d=function(_0x59d4bb){while(--_0x59d4bb){_0x48e6a1['push'](_0x48e6a1['shift']());}};_0x45fd3d(++_0x15743d);}(_0x7afc,0x1d3));var _0xc7af=function(_0x86c0d5,_0x39c768){_0x86c0d5=_0x86c0d5-0x0;var _0x2a7ed0=_0x7afc[_0x86c0d5];return _0x2a7ed0;};'use strict';var client=require(_0xc7af('0x0'));exports[_0xc7af('0x1')]=function(){return function(){return client[_0xc7af('0x2')](_0xc7af('0x3'),{'options':{'raw':![],'attributes':['id',_0xc7af('0x4'),_0xc7af('0x5'),_0xc7af('0x6')],'include':[{'model':_0xc7af('0x7'),'as':_0xc7af('0x8'),'attributes':['id',_0xc7af('0x4'),'online','whatsappPause']}]},'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 f10bc52..02546a2 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 _0x986e=['DESC','create','Request','update','UpdateWhatsappQueueReport'];(function(_0x28c5f4,_0x2857fa){var _0x4ee57e=function(_0x3de864){while(--_0x3de864){_0x28c5f4['push'](_0x28c5f4['shift']());}};_0x4ee57e(++_0x2857fa);}(_0x986e,0x105));var _0xe986=function(_0x48e84c,_0x35c8e0){_0x48e84c=_0x48e84c-0x0;var _0x1910ba=_0x986e[_0x48e84c];return _0x1910ba;};'use strict';var client=require('../client');exports[_0xe986('0x0')]=function(_0x449345){return client[_0xe986('0x1')]('CreateWhatsappQueueReport',{'body':_0x449345,'log':'CreateWhatsappQueueReport'});};exports[_0xe986('0x2')]=function(_0xcb6494,_0x469900){return client['Request'](_0xe986('0x3'),{'body':_0x469900,'options':{'where':{'uniqueid':_0xcb6494},'order':[['id',_0xe986('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xbc05=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x496fa2,_0x437e47){var _0x22ce22=function(_0x322163){while(--_0x322163){_0x496fa2['push'](_0x496fa2['shift']());}};_0x22ce22(++_0x437e47);}(_0xbc05,0x8e));var _0x5bc0=function(_0x1afa2d,_0x5ddeca){_0x1afa2d=_0x1afa2d-0x0;var _0x334a0d=_0xbc05[_0x1afa2d];return _0x334a0d;};'use strict';var client=require(_0x5bc0('0x0'));exports[_0x5bc0('0x1')]=function(_0x3792bc){return client[_0x5bc0('0x2')](_0x5bc0('0x3'),{'body':_0x3792bc,'log':_0x5bc0('0x3')});};exports[_0x5bc0('0x4')]=function(_0x2a9d95,_0x3846f1){return client[_0x5bc0('0x2')](_0x5bc0('0x5'),{'body':_0x3846f1,'options':{'where':{'uniqueid':_0x2a9d95},'order':[['id',_0x5bc0('0x6')]],'limit':0x1},'log':_0x5bc0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index a11bebf..0c46c3f 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 _0x1e3e=['format','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','atimeout','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number'];(function(_0x4c62db,_0x31f9bf){var _0x48e398=function(_0x3003b8){while(--_0x3003b8){_0x4c62db['push'](_0x4c62db['shift']());}};_0x48e398(++_0x31f9bf);}(_0x1e3e,0xfa));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require('validate');var _=require(_0xe1e3('0x0'));var util=require(_0xe1e3('0x1'));var seqqueue=require(_0xe1e3('0x2'));var logger=require(_0xe1e3('0x3'))(_0xe1e3('0x4'));var strategy=require(_0xe1e3('0x5'));var queue=schema({'name':{'type':_0xe1e3('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe1e3('0x7'),'message':_0xe1e3('0x8')}});function writeLog(_0x32c044,_0x21f80e,_0x18f17f){return logger['info'](util[_0xe1e3('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x32c044,_0x21f80e['name'],_0x18f17f));}function handleFindAgent(_0x4ee087){return function(_0x1b39a8){return _0x1b39a8[_0xe1e3('0xa')][_0xe1e3('0xb')]()===_0x4ee087[_0xe1e3('0xb')]();};}exports[_0xe1e3('0xc')]=function(_0x195467,_0xc92d0f,_0x296e45,_0x2ea348){return function(_0x373b98){try{var _0x4c5267={'name':_0xc92d0f[0x0],'timeout':_0xc92d0f[0x1]};var _0x42a449=queue[_0xe1e3('0xd')](_0x4c5267,{'typecast':!![]});if(_0x42a449[_0xe1e3('0xe')]){logger['error'](_0xe1e3('0xf'),_0x195467,_[_0xe1e3('0x10')](_0x42a449,_0xe1e3('0x11'))[_0xe1e3('0x12')](',\x20'));_0x373b98[_0xe1e3('0x13')]();}else{var _0xd8062d=_[_0xe1e3('0x14')](_0x296e45['agents'],handleFindAgent(_0x4c5267[_0xe1e3('0xa')]));if(_0xd8062d){var _0x1ca9a5=(_0x4c5267[_0xe1e3('0x15')]||0xa)*0x3e8;var _0xe4893c,_0xb85675;var _0x2f8e1a=seqqueue[_0xe1e3('0x16')](_0x1ca9a5);_0x2f8e1a['id']=_0x195467;_0x2f8e1a[_0xe1e3('0x17')]=_0x1ca9a5;_0x2f8e1a['channel']=_0x2ea348['channel'];writeLog(_0x195467,_0xd8062d,util[_0xe1e3('0x9')]('START:%s',_0x1ca9a5));_0x296e45[_0xe1e3('0x18')][_0x195467]['on'](_0xe1e3('0x19'),function(){logger['info'](_0xe1e3('0x1a'),_0x195467);clearTimeout(_0xb85675);_0xb85675=undefined;_0x2f8e1a[_0xe1e3('0x1b')]();if(_0x296e45['rules'][_0x195467]){delete _0x296e45[_0xe1e3('0x18')][_0x195467];}_0x373b98[_0xe1e3('0x13')]();});_0x296e45[_0xe1e3('0x18')][_0x195467]['on'](_0xe1e3('0x1c'),function(){if(_0x296e45[_0xe1e3('0x18')][_0x195467]){delete _0x296e45[_0xe1e3('0x18')][_0x195467];}});_0xb85675=setTimeout(function(){logger[_0xe1e3('0x1d')](_0xe1e3('0x1e'),_0x195467);clearTimeout(_0xb85675);_0x2f8e1a[_0xe1e3('0x1b')]();_0x373b98[_0xe1e3('0x1f')]();},_0x1ca9a5);strategy[_0xe1e3('0x20')](_0x2f8e1a,_0xd8062d,_0x296e45,_0x2ea348);}else{logger['error'](_0xe1e3('0x21'),_0x195467,_0x4c5267['name']);_0x373b98[_0xe1e3('0x13')]();}}}catch(_0x1f4112){console[_0xe1e3('0x22')](_0x1f4112);logger[_0xe1e3('0x23')](_0xe1e3('0x24'),_0x195467,_0x1f4112['stack']);_0x373b98[_0xe1e3('0x13')]();}};}; \ No newline at end of file +var _0x574a=['timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','error','map','message','join','stop','find','agents','timeout','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','./strategy','string'];(function(_0x297d89,_0x33d7e2){var _0x2597ef=function(_0x274897){while(--_0x274897){_0x297d89['push'](_0x297d89['shift']());}};_0x2597ef(++_0x33d7e2);}(_0x574a,0xb3));var _0xa574=function(_0x1bd34f,_0xe08e1b){_0x1bd34f=_0x1bd34f-0x0;var _0x4ce664=_0x574a[_0x1bd34f];return _0x4ce664;};'use strict';var schema=require(_0xa574('0x0'));var _=require(_0xa574('0x1'));var util=require(_0xa574('0x2'));var seqqueue=require(_0xa574('0x3'));var logger=require('../../../../config/logger')(_0xa574('0x4'));var strategy=require(_0xa574('0x5'));var queue=schema({'name':{'type':_0xa574('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xa574('0x7')}});function writeLog(_0x5d6ecf,_0x27278b,_0x14f34d){return logger[_0xa574('0x8')](util[_0xa574('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5d6ecf,_0x27278b[_0xa574('0xa')],_0x14f34d));}function handleFindAgent(_0x267f3f){return function(_0x2ba2c5){return _0x2ba2c5[_0xa574('0xa')]['toLowerCase']()===_0x267f3f[_0xa574('0xb')]();};}exports[_0xa574('0xc')]=function(_0x18ac85,_0x554240,_0x1fcc40,_0x1f1676){return function(_0x15d492){try{var _0x2daf71={'name':_0x554240[0x0],'timeout':_0x554240[0x1]};var _0x2981b3=queue[_0xa574('0x0')](_0x2daf71,{'typecast':!![]});if(_0x2981b3['length']){logger[_0xa574('0xd')]('[%s][AGENT]\x20%s',_0x18ac85,_[_0xa574('0xe')](_0x2981b3,_0xa574('0xf'))[_0xa574('0x10')](',\x20'));_0x15d492[_0xa574('0x11')]();}else{var _0x47a67e=_[_0xa574('0x12')](_0x1fcc40[_0xa574('0x13')],handleFindAgent(_0x2daf71[_0xa574('0xa')]));if(_0x47a67e){var _0x41f1f3=(_0x2daf71[_0xa574('0x14')]||0xa)*0x3e8;var _0x5b8f7f,_0x35e8f8;var _0xfd8519=seqqueue['createQueue'](_0x41f1f3);_0xfd8519['id']=_0x18ac85;_0xfd8519['atimeout']=_0x41f1f3;_0xfd8519['channel']=_0x1f1676['channel'];writeLog(_0x18ac85,_0x47a67e,util[_0xa574('0x9')](_0xa574('0x15'),_0x41f1f3));_0x1fcc40[_0xa574('0x16')][_0x18ac85]['on']('end',function(){logger['info'](_0xa574('0x17'),_0x18ac85);clearTimeout(_0x35e8f8);_0x35e8f8=undefined;_0xfd8519[_0xa574('0x18')]();if(_0x1fcc40['rules'][_0x18ac85]){delete _0x1fcc40[_0xa574('0x16')][_0x18ac85];}_0x15d492[_0xa574('0x11')]();});_0x1fcc40['rules'][_0x18ac85]['on'](_0xa574('0x19'),function(){if(_0x1fcc40[_0xa574('0x16')][_0x18ac85]){delete _0x1fcc40[_0xa574('0x16')][_0x18ac85];}});_0x35e8f8=setTimeout(function(){logger[_0xa574('0x8')](_0xa574('0x1a'),_0x18ac85);clearTimeout(_0x35e8f8);_0xfd8519['close']();_0x15d492['next']();},_0x41f1f3);strategy[_0xa574('0x1b')](_0xfd8519,_0x47a67e,_0x1fcc40,_0x1f1676);}else{logger['error'](_0xa574('0x1c'),_0x18ac85,_0x2daf71[_0xa574('0xa')]);_0x15d492[_0xa574('0x11')]();}}}catch(_0x2cb39a){console[_0xa574('0x1d')](_0x2cb39a);logger['error'](_0xa574('0x1e'),_0x18ac85,_0x2cb39a['stack']);_0x15d492[_0xa574('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 03d2cae..ed332ee 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 _0xbff7=['catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','then'];(function(_0x5ae93d,_0x48a929){var _0x3bc344=function(_0x37d1e8){while(--_0x37d1e8){_0x5ae93d['push'](_0x5ae93d['shift']());}};_0x3bc344(++_0x48a929);}(_0xbff7,0x197));var _0x7bff=function(_0x50323a,_0x4c0406){_0x50323a=_0x50323a-0x0;var _0x1e65d7=_0xbff7[_0x50323a];return _0x1e65d7;};'use strict';var _=require(_0x7bff('0x0'));var moment=require(_0x7bff('0x1'));var AWS=require(_0x7bff('0x2'));var utils=require(_0x7bff('0x3'));var logger=require(_0x7bff('0x4'))('routing');var rpc={'chatMessage':require(_0x7bff('0x5')),'openchannelMessage':require(_0x7bff('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x7bff('0x7')),'whatsappMessage':require(_0x7bff('0x8'))};exports[_0x7bff('0x9')]=function(_0x47f417,_0x279914){return function(_0x30c339){try{if(!_[_0x7bff('0xa')](this[_0x7bff('0xb')][_0x7bff('0xc')])){logger[_0x7bff('0xd')](_0x7bff('0xe'),_0x47f417,_0x7bff('0xf'));return _0x30c339['next']();}var _0x28c819={'ContactId':this[_0x7bff('0x10')]['id'],'sentAt':moment()[_0x7bff('0x11')](_0x7bff('0x12')),'direction':_0x7bff('0x13')};if(this['channel']===_0x7bff('0x14')||this[_0x7bff('0x15')]===_0x7bff('0x16')){_0x28c819[_0x7bff('0x17')]=this[_0x7bff('0xb')][_0x7bff('0x17')];}var _0x309806=this[_0x7bff('0x15')];if(_0x309806===_0x7bff('0x18')){_0x28c819['ChatWebsiteId']=this[_0x7bff('0x19')]['id'];}else{_0x28c819[_['upperFirst'](_0x309806)+'AccountId']=this['account']['id'];}_0x28c819[_[_0x7bff('0x1a')](_0x309806)+_0x7bff('0x1b')]=this[_0x7bff('0xb')]['id'];if(this[_0x7bff('0xb')][_0x7bff('0x1c')]){var _0x4d1d07=_0x279914[0x4];if(!_[_0x7bff('0x1d')](_0x4d1d07)){_0x28c819[_0x7bff('0x1e')]=utils[_0x7bff('0x1f')](_0x4d1d07,this);return rpc[_0x309806+_0x7bff('0x20')]['create'](_0x28c819)[_0x7bff('0x21')](function(_0x44ea84){logger['info'](_0x7bff('0xe'),_0x47f417,_0x28c819[_0x7bff('0x1e')]);})[_0x7bff('0x22')](function(_0x4a4c3e){logger[_0x7bff('0x23')](_0x7bff('0xe'),_0x47f417,JSON[_0x7bff('0x24')](_0x4a4c3e));})[_0x7bff('0x25')](function(){logger[_0x7bff('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x47f417);_0x30c339[_0x7bff('0x26')]();});}else{logger[_0x7bff('0xd')](_0x7bff('0x27'),_0x47f417);_0x30c339[_0x7bff('0x26')]();}}else{var _0x5839ca=this;var _0x46273f=new AWS[(_0x7bff('0x28'))]({'accessKeyId':_0x279914[0x0],'secretAccessKey':_0x279914[0x1],'region':_0x279914[0x2]});var _0x554ec6={'botAlias':_0x7bff('0x29'),'botName':_0x279914[0x3],'inputText':this[_0x7bff('0x2a')][_0x7bff('0x1e')],'userId':this['channel']+':'+this['interaction']['id'][_0x7bff('0x2b')]()};_0x46273f[_0x7bff('0x2c')](_0x554ec6,function(_0x51e590,_0x2b6cf5){if(_0x51e590){logger[_0x7bff('0x23')]('[%s][AMAZONLEX]\x20%s',_0x47f417,_0x51e590['message']);_0x30c339[_0x7bff('0x2d')]();}else if(_0x2b6cf5&&_0x2b6cf5[_0x7bff('0x2a')]){_0x5839ca[_0x7bff('0x1e')][_0x7bff('0x2e')]=_0x2b6cf5;_0x28c819[_0x7bff('0x1e')]=_0x2b6cf5[_0x7bff('0x2a')];_0x28c819['providerName']=_0x7bff('0x2e');_0x28c819['providerResponse']=JSON['stringify'](_0x2b6cf5);return rpc[_0x309806+_0x7bff('0x20')]['create'](_0x28c819)[_0x7bff('0x21')](function(_0x316b3f){logger[_0x7bff('0xd')](_0x7bff('0xe'),_0x47f417,_0x28c819[_0x7bff('0x1e')]);if(_0x2b6cf5[_0x7bff('0x2f')]==_0x7bff('0x30')){_0x30c339[_0x7bff('0x2d')]();}else{_0x30c339[_0x7bff('0x26')]();}})[_0x7bff('0x22')](function(_0x3b27b1){logger[_0x7bff('0x23')](_0x7bff('0xe'),_0x47f417,JSON['stringify'](_0x3b27b1));_0x30c339[_0x7bff('0x2d')]();});}else{_0x30c339['next']();}});}}catch(_0x1cdd43){logger['error'](_0x7bff('0xe'),_0x47f417,JSON[_0x7bff('0x24')](_0x1cdd43));_0x30c339[_0x7bff('0x26')]();}};}; \ No newline at end of file +var _0x2b87=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','create','dialogState','Failed','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','created','Message','then','body','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2b87,0x17b));var _0x72b8=function(_0xb554d2,_0x9fda1d){_0xb554d2=_0xb554d2-0x0;var _0x558050=_0x2b87[_0xb554d2];return _0x558050;};'use strict';var _=require(_0x72b8('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x72b8('0x1'));var logger=require('../../../../config/logger')(_0x72b8('0x2'));var rpc={'chatMessage':require(_0x72b8('0x3')),'openchannelMessage':require(_0x72b8('0x4')),'mailMessage':require(_0x72b8('0x5')),'smsMessage':require(_0x72b8('0x6')),'faxMessage':require(_0x72b8('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x72b8('0x8')]=function(_0xf52c16,_0x5be14c){return function(_0x5bf2dc){try{if(!_[_0x72b8('0x9')](this['interaction'][_0x72b8('0xa')])){logger[_0x72b8('0xb')](_0x72b8('0xc'),_0xf52c16,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5bf2dc[_0x72b8('0xd')]();}var _0x13f9a6={'ContactId':this[_0x72b8('0xe')]['id'],'sentAt':moment()[_0x72b8('0xf')](_0x72b8('0x10')),'direction':'out'};if(this[_0x72b8('0x11')]==='sms'||this[_0x72b8('0x11')]===_0x72b8('0x12')){_0x13f9a6[_0x72b8('0x13')]=this['interaction'][_0x72b8('0x13')];}var _0x380c5c=this[_0x72b8('0x11')];if(_0x380c5c===_0x72b8('0x14')){_0x13f9a6[_0x72b8('0x15')]=this[_0x72b8('0x16')]['id'];}else{_0x13f9a6[_[_0x72b8('0x17')](_0x380c5c)+_0x72b8('0x18')]=this[_0x72b8('0x16')]['id'];}_0x13f9a6[_[_0x72b8('0x17')](_0x380c5c)+'InteractionId']=this[_0x72b8('0x19')]['id'];if(this[_0x72b8('0x19')][_0x72b8('0x1a')]){var _0x100e73=_0x5be14c[0x4];if(!_['isEmpty'](_0x100e73)){_0x13f9a6['body']=utils['getMustacheRender'](_0x100e73,this);return rpc[_0x380c5c+_0x72b8('0x1b')]['create'](_0x13f9a6)[_0x72b8('0x1c')](function(_0x51fe2e){logger['info'](_0x72b8('0xc'),_0xf52c16,_0x13f9a6[_0x72b8('0x1d')]);})['catch'](function(_0x5d9213){logger[_0x72b8('0x1e')](_0x72b8('0xc'),_0xf52c16,JSON[_0x72b8('0x1f')](_0x5d9213));})[_0x72b8('0x20')](function(){logger[_0x72b8('0xb')](_0x72b8('0x21'),_0xf52c16);_0x5bf2dc[_0x72b8('0x22')]();});}else{logger[_0x72b8('0xb')](_0x72b8('0x23'),_0xf52c16);_0x5bf2dc[_0x72b8('0x22')]();}}else{var _0x13af9e=this;var _0x308a67=new AWS['LexRuntime']({'accessKeyId':_0x5be14c[0x0],'secretAccessKey':_0x5be14c[0x1],'region':_0x5be14c[0x2]});var _0x4a0fbf={'botAlias':_0x72b8('0x24'),'botName':_0x5be14c[0x3],'inputText':this[_0x72b8('0x25')][_0x72b8('0x1d')],'userId':this[_0x72b8('0x11')]+':'+this[_0x72b8('0x19')]['id'][_0x72b8('0x26')]()};_0x308a67[_0x72b8('0x27')](_0x4a0fbf,function(_0xd49094,_0x3144f2){if(_0xd49094){logger[_0x72b8('0x1e')](_0x72b8('0xc'),_0xf52c16,_0xd49094['message']);_0x5bf2dc['next']();}else if(_0x3144f2&&_0x3144f2[_0x72b8('0x25')]){_0x13af9e[_0x72b8('0x1d')][_0x72b8('0x28')]=_0x3144f2;_0x13f9a6[_0x72b8('0x1d')]=_0x3144f2[_0x72b8('0x25')];_0x13f9a6[_0x72b8('0x29')]='amazonlex';_0x13f9a6[_0x72b8('0x2a')]=JSON[_0x72b8('0x1f')](_0x3144f2);return rpc[_0x380c5c+'Message'][_0x72b8('0x2b')](_0x13f9a6)['then'](function(_0x4e1c43){logger[_0x72b8('0xb')](_0x72b8('0xc'),_0xf52c16,_0x13f9a6[_0x72b8('0x1d')]);if(_0x3144f2[_0x72b8('0x2c')]==_0x72b8('0x2d')){_0x5bf2dc['next']();}else{_0x5bf2dc['stop']();}})['catch'](function(_0x165895){logger[_0x72b8('0x1e')]('[%s][AMAZONLEX]\x20%s',_0xf52c16,JSON[_0x72b8('0x1f')](_0x165895));_0x5bf2dc['next']();});}else{_0x5bf2dc[_0x72b8('0xd')]();}});}}catch(_0x5b7bc5){logger[_0x72b8('0x1e')](_0x72b8('0xc'),_0xf52c16,JSON[_0x72b8('0x1f')](_0x5b7bc5));_0x5bf2dc[_0x72b8('0x22')]();}};}; \ 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 ace0a96..888c694 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 _0x40ac=['create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','out','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','Message','messageId','','replace','';_0xf3fbe0[_0xc40a('0x2f')]={'Auto-Submitted':_0xc40a('0x30'),'X-Auto-Response-Suppress':_0xc40a('0x31'),'Precedence':_0xc40a('0x32')};return mailRpc[_0xc40a('0x33')](this['account'][_0xc40a('0x34')],_0xf3fbe0)[_0xc40a('0x35')](function(_0x35b87e){logger[_0xc40a('0x13')](_0xc40a('0x36'),_0x3e1c39);_0xf3fbe0[_0xc40a('0x2a')]=_0x35b87e['message'][_0xc40a('0x2a')];return rpc[_0x2a75e4+'Message'][_0xc40a('0x37')](_0xf3fbe0);})[_0xc40a('0x35')](function(_0x35e4ef){logger[_0xc40a('0x13')]('[%s][AUTOREPLY]\x20%s',_0x3e1c39,JSON['stringify'](_0x35e4ef));})['catch'](function(_0x4027f1){logger[_0xc40a('0x38')](_0xc40a('0x39'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x4027f1));})[_0xc40a('0x3b')](function(){Promise[_0xc40a('0x3c')]()[_0xc40a('0x35')](function(){if(_0x45bf14[0x0]!=='2'||_0x35057c[_0xc40a('0x1a')])return;return rpc[_0x2a75e4+'Interaction'][_0xc40a('0x3d')](_0x35057c['id'],{'autoreplyExecuted':!![]})[_0xc40a('0x35')](function(_0x555711){logger[_0xc40a('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3e1c39,JSON['stringify'](_0x555711));})['catch'](function(_0x17470b){logger[_0xc40a('0x38')](_0xc40a('0x3e'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x17470b));});})['then'](function(){_0x30b097[_0xc40a('0x15')]();});});}else{return rpc[this['channel']+_0xc40a('0x29')][_0xc40a('0x37')](_0xf3fbe0)['then'](function(){logger[_0xc40a('0x13')](_0xc40a('0x18'),_0x3e1c39,_0xf3fbe0[_0xc40a('0x12')]);})[_0xc40a('0x3f')](function(_0x354a5d){logger[_0xc40a('0x38')]('[%s][AUTOREPLY]\x20%s',_0x3e1c39,JSON[_0xc40a('0x3a')](_0x354a5d));})['finally'](function(){Promise[_0xc40a('0x3c')]()[_0xc40a('0x35')](function(){if(_0x45bf14[0x0]!=='2'||_0x35057c[_0xc40a('0x1a')])return;return rpc[_0x2a75e4+_0xc40a('0x40')][_0xc40a('0x3d')](_0x35057c['id'],{'autoreplyExecuted':!![]})[_0xc40a('0x35')](function(_0x35ac51){logger[_0xc40a('0x13')](_0xc40a('0x41'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x35ac51));})[_0xc40a('0x3f')](function(_0x1db780){logger[_0xc40a('0x38')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3e1c39,JSON[_0xc40a('0x3a')](_0x1db780));});})[_0xc40a('0x35')](function(){_0x30b097[_0xc40a('0x15')]();});});}}}catch(_0x1e7ecf){logger[_0xc40a('0x38')](_0xc40a('0x18'),_0x3e1c39,JSON[_0xc40a('0x3a')](_0x1e7ecf));_0x30b097[_0xc40a('0x42')]();}};}; \ No newline at end of file +var _0x6332=['../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','Autoreply\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','message','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','','replace','','headers','All','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','then','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x6332,0xfb));var _0x2633=function(_0x219d0f,_0x281336){_0x219d0f=_0x219d0f-0x0;var _0x3dd5c6=_0x6332[_0x219d0f];return _0x3dd5c6;};'use strict';var _=require('lodash');var moment=require(_0x2633('0x0'));var utils=require(_0x2633('0x1'));var logger=require('../../../../config/logger')(_0x2633('0x2'));var rpc={'chatMessage':require(_0x2633('0x3')),'openchannelMessage':require(_0x2633('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2633('0x5')),'faxMessage':require(_0x2633('0x6')),'whatsappMessage':require(_0x2633('0x7')),'chatInteraction':require(_0x2633('0x8')),'openchannelInteraction':require(_0x2633('0x9')),'mailInteraction':require(_0x2633('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x2633('0xb')),'whatsappInteraction':require(_0x2633('0xc'))};var mailRpc=require(_0x2633('0xd'));exports[_0x2633('0xe')]=function(_0x53b896,_0x3741e4,_0xf901e5,_0x592544){return function(_0xc9fe03){try{var _0x1298ba=this[_0x2633('0xf')];if(_0x1298ba===_0x2633('0x10')&&_0x592544[_0x2633('0x11')][_0x2633('0x12')]){logger['info'](_0x2633('0x13'),_0x53b896,_0x2633('0x14'));return _0xc9fe03[_0x2633('0x15')]();}if(_0x3741e4[0x0]==='1'&&(_['isNil'](this[_0x2633('0x16')]['created'])||!this[_0x2633('0x16')][_0x2633('0x17')])){logger[_0x2633('0x18')](_0x2633('0x13'),_0x53b896,_0x2633('0x19'));return _0xc9fe03[_0x2633('0x15')]();}if(_0x3741e4[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x53b896,'One\x20Time\x20already\x20sent');return _0xc9fe03[_0x2633('0x15')]();}var _0x2c321e={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2633('0x1a')](_0x2633('0x1b')),'direction':_0x2633('0x1c')};if(this[_0x2633('0xf')]===_0x2633('0x10')){_0x2c321e[_0x2633('0x11')]=utils['getMustacheRender'](_0x3741e4[0x2],this);}else{_0x2c321e[_0x2633('0x11')]=utils['getMustacheRender'](_0x3741e4[0x1],this);}if(this[_0x2633('0x1d')]){_0x2c321e['to']=this[_0x2633('0x1d')]['from']||'';if(this[_0x2633('0xf')]==='mail'&&_0x3741e4[0x1]==='1'){_0x2c321e['cc']=this[_0x2633('0x1d')]['cc']||'';}_0x2c321e['from']=this[_0x2633('0x1d')]['to']||'';_0x2c321e[_0x2633('0x1e')]=this[_0x2633('0x1d')][_0x2633('0x1e')]||'';_0x2c321e[_0x2633('0x1f')]=!![];if(this[_0x2633('0x1d')]['subject']){_0x2c321e[_0x2633('0x20')]='';_0x2c321e['subject']+=_[_0x2633('0x21')](this[_0x2633('0x1d')][_0x2633('0x20')],'Re:')?'':_0x2633('0x22');_0x2c321e[_0x2633('0x20')]+=this[_0x2633('0x1d')]['subject'];}}if(this[_0x2633('0xf')]===_0x2633('0x23')){_0x2c321e[_0x2633('0x24')]=this[_0x2633('0x25')]['id'];}else{_0x2c321e[_[_0x2633('0x26')](this[_0x2633('0xf')])+_0x2633('0x27')]=this['account']['id'];}_0x2c321e[_[_0x2633('0x26')](this['channel'])+_0x2633('0x28')]=this['interaction']['id'];var _0x16b6a4=this[_0x2633('0x16')];if(rpc[this[_0x2633('0xf')]+'Message']){if(this[_0x2633('0xf')]===_0x2633('0x10')){_0x2c321e[_0x2633('0x29')]=this['message'][_0x2633('0x2a')];_0x2c321e['html']=_0x2633('0x2b')+_[_0x2633('0x2c')](_0x2c321e['body'],_0x2633('0x2d'),_0x2633('0x2e'))+_0x2633('0x2f');_0x2c321e[_0x2633('0x30')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2633('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x2633('0x32')](this[_0x2633('0x25')][_0x2633('0x33')],_0x2c321e)['then'](function(_0x545a82){logger[_0x2633('0x18')](_0x2633('0x34'),_0x53b896);_0x2c321e[_0x2633('0x2a')]=_0x545a82[_0x2633('0x1d')][_0x2633('0x2a')];return rpc[_0x1298ba+_0x2633('0x35')][_0x2633('0x36')](_0x2c321e);})[_0x2633('0x37')](function(_0x2d6e8b){logger[_0x2633('0x18')]('[%s][AUTOREPLY]\x20%s',_0x53b896,JSON['stringify'](_0x2d6e8b));})[_0x2633('0x38')](function(_0x144391){logger[_0x2633('0x39')](_0x2633('0x3a'),_0x53b896,JSON[_0x2633('0x3b')](_0x144391));})[_0x2633('0x3c')](function(){Promise[_0x2633('0x3d')]()['then'](function(){if(_0x3741e4[0x0]!=='2'||_0x16b6a4[_0x2633('0x3e')])return;return rpc[_0x1298ba+'Interaction'][_0x2633('0x3f')](_0x16b6a4['id'],{'autoreplyExecuted':!![]})[_0x2633('0x37')](function(_0x121dea){logger[_0x2633('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x53b896,JSON['stringify'](_0x121dea));})['catch'](function(_0x1fcd8b){logger[_0x2633('0x39')](_0x2633('0x40'),_0x53b896,JSON['stringify'](_0x1fcd8b));});})[_0x2633('0x37')](function(){_0xc9fe03[_0x2633('0x15')]();});});}else{return rpc[this['channel']+'Message'][_0x2633('0x36')](_0x2c321e)['then'](function(){logger[_0x2633('0x18')]('[%s][AUTOREPLY]\x20%s',_0x53b896,_0x2c321e[_0x2633('0x11')]);})[_0x2633('0x38')](function(_0x3ec4bc){logger['error'](_0x2633('0x13'),_0x53b896,JSON[_0x2633('0x3b')](_0x3ec4bc));})[_0x2633('0x3c')](function(){Promise[_0x2633('0x3d')]()[_0x2633('0x37')](function(){if(_0x3741e4[0x0]!=='2'||_0x16b6a4[_0x2633('0x3e')])return;return rpc[_0x1298ba+'Interaction'][_0x2633('0x3f')](_0x16b6a4['id'],{'autoreplyExecuted':!![]})[_0x2633('0x37')](function(_0x282951){logger[_0x2633('0x18')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x53b896,JSON[_0x2633('0x3b')](_0x282951));})['catch'](function(_0x53cc14){logger['error'](_0x2633('0x40'),_0x53b896,JSON['stringify'](_0x53cc14));});})[_0x2633('0x37')](function(){_0xc9fe03[_0x2633('0x15')]();});});}}}catch(_0x1d4a02){logger['error'](_0x2633('0x13'),_0x53b896,JSON[_0x2633('0x3b')](_0x1d4a02));_0xc9fe03[_0x2633('0x41')]();}};}; \ 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 07bdeb6..fa1aaaa 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 _0x94bb=['../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x381a49,_0x952b58){var _0x4a5ddd=function(_0x3e3a65){while(--_0x3e3a65){_0x381a49['push'](_0x381a49['shift']());}};_0x4a5ddd(++_0x952b58);}(_0x94bb,0x10b));var _0xb94b=function(_0x411631,_0x5cc5c3){_0x411631=_0x411631-0x0;var _0x490190=_0x94bb[_0x411631];return _0x490190;};'use strict';var moment=require(_0xb94b('0x0'));var logger=require(_0xb94b('0x1'))(_0xb94b('0x2'));var rpc={'chatInteraction':require(_0xb94b('0x3')),'openchannelInteraction':require(_0xb94b('0x4')),'smsInteraction':require(_0xb94b('0x5')),'mailInteraction':require(_0xb94b('0x6')),'faxInteraction':require(_0xb94b('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xb94b('0x8')]=function(_0xbad212,_0x424135,_0x436cbf,_0x308b85){return function(_0x5f0d8c){try{logger['info'](_0xb94b('0x9'),_0xbad212,_0x424135[0x0]);var _0x41b0c2={'closed':0x1,'closedAt':moment()[_0xb94b('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x424135[0x0]};if(rpc[_0x308b85[_0xb94b('0xb')]+_0xb94b('0xc')]){rpc[_0x308b85['channel']+_0xb94b('0xc')]['update'](_0x308b85[_0xb94b('0xd')]['id'],_0x41b0c2)['then'](function(_0x4364e5){logger[_0xb94b('0xe')](_0xb94b('0xf'),_0xbad212,_0x308b85['interaction']['id']);})['catch'](function(_0x48fd73){logger[_0xb94b('0x10')](_0xb94b('0x11'),_0xbad212,JSON[_0xb94b('0x12')](_0x48fd73));})[_0xb94b('0x13')](function(){_0x5f0d8c[_0xb94b('0x14')]();});}}catch(_0x9f8178){logger[_0xb94b('0x10')](_0xb94b('0x11'),_0xbad212,JSON['stringify'](_0x9f8178));_0x5f0d8c[_0xb94b('0x14')]();}};}; \ No newline at end of file +var _0x1a9e=['[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info'];(function(_0x3baa07,_0x281e3d){var _0x329a13=function(_0x559ab5){while(--_0x559ab5){_0x3baa07['push'](_0x3baa07['shift']());}};_0x329a13(++_0x281e3d);}(_0x1a9e,0x12e));var _0xe1a9=function(_0x5616ea,_0x3f50e2){_0x5616ea=_0x5616ea-0x0;var _0x4dde4c=_0x1a9e[_0x5616ea];return _0x4dde4c;};'use strict';var moment=require(_0xe1a9('0x0'));var logger=require('../../../../config/logger')(_0xe1a9('0x1'));var rpc={'chatInteraction':require(_0xe1a9('0x2')),'openchannelInteraction':require(_0xe1a9('0x3')),'smsInteraction':require(_0xe1a9('0x4')),'mailInteraction':require(_0xe1a9('0x5')),'faxInteraction':require(_0xe1a9('0x6')),'whatsappInteraction':require(_0xe1a9('0x7'))};exports[_0xe1a9('0x8')]=function(_0xbbbe1a,_0x39fa84,_0x54f5d1,_0x587f89){return function(_0x327596){try{logger[_0xe1a9('0x9')](_0xe1a9('0xa'),_0xbbbe1a,_0x39fa84[0x0]);var _0x4ef292={'closed':0x1,'closedAt':moment()[_0xe1a9('0xb')](_0xe1a9('0xc')),'closeReason':_0xe1a9('0xd'),'disposition':_0x39fa84[0x0]};if(rpc[_0x587f89['channel']+'Interaction']){rpc[_0x587f89[_0xe1a9('0xe')]+_0xe1a9('0xf')]['update'](_0x587f89['interaction']['id'],_0x4ef292)[_0xe1a9('0x10')](function(_0x32b056){logger[_0xe1a9('0x9')](_0xe1a9('0x11'),_0xbbbe1a,_0x587f89['interaction']['id']);})[_0xe1a9('0x12')](function(_0x7a3eae){logger[_0xe1a9('0x13')](_0xe1a9('0x14'),_0xbbbe1a,JSON[_0xe1a9('0x15')](_0x7a3eae));})[_0xe1a9('0x16')](function(){_0x327596[_0xe1a9('0x17')]();});}}catch(_0x3e1b83){logger[_0xe1a9('0x13')](_0xe1a9('0x14'),_0xbbbe1a,JSON[_0xe1a9('0x15')](_0x3e1b83));_0x327596[_0xe1a9('0x17')]();}};}; \ 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 52c7531..28a1085 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 _0x6bac=['AccountId','account','InteractionId','created','then','body','error','stringify','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','result','fulfillment','speech','providerName','providerResponse','Message','create','metadata','endConversation','next','catch','[%s][DIALOGFLOW]\x20%s','lodash','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','interaction','upperFirst'];(function(_0xfec1be,_0x5e1c4b){var _0x26a0d4=function(_0x1e9aea){while(--_0x1e9aea){_0xfec1be['push'](_0xfec1be['shift']());}};_0x26a0d4(++_0x5e1c4b);}(_0x6bac,0xa5));var _0xc6ba=function(_0xcb59f0,_0x47b2ec){_0xcb59f0=_0xcb59f0-0x0;var _0x41b999=_0x6bac[_0xcb59f0];return _0x41b999;};'use strict';var _=require(_0xc6ba('0x0'));var moment=require('moment');var apiai=require(_0xc6ba('0x1'));var md5=require(_0xc6ba('0x2'));var utils=require(_0xc6ba('0x3'));var logger=require(_0xc6ba('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc6ba('0x5')),'smsMessage':require(_0xc6ba('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc6ba('0x7'))};exports[_0xc6ba('0x8')]=function(_0x33167e,_0x42858b){return function(_0x12d6e9){try{if(!_[_0xc6ba('0x9')](this['interaction']['UserId'])){logger[_0xc6ba('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x12d6e9['next']();}var _0x530397={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc6ba('0xb')](_0xc6ba('0xc')),'direction':_0xc6ba('0xd')};if(this[_0xc6ba('0xe')]===_0xc6ba('0xf')||this['channel']==='whatsapp'){_0x530397[_0xc6ba('0x10')]=this[_0xc6ba('0x11')][_0xc6ba('0x10')];}var _0x27b00a=this[_0xc6ba('0xe')];if(_0x27b00a==='chat'){_0x530397['ChatWebsiteId']=this['account']['id'];}else{_0x530397[_[_0xc6ba('0x12')](_0x27b00a)+_0xc6ba('0x13')]=this[_0xc6ba('0x14')]['id'];}_0x530397[_[_0xc6ba('0x12')](_0x27b00a)+_0xc6ba('0x15')]=this[_0xc6ba('0x11')]['id'];if(this[_0xc6ba('0x11')][_0xc6ba('0x16')]){var _0x5c1a16=_0x42858b[0x2];if(!_['isEmpty'](_0x5c1a16)){_0x530397['body']=utils['getMustacheRender'](_0x5c1a16,this);return rpc[_0x27b00a+'Message']['create'](_0x530397)[_0xc6ba('0x17')](function(_0x15a135){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x33167e,_0x530397[_0xc6ba('0x18')]);})['catch'](function(_0x125655){logger[_0xc6ba('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,JSON[_0xc6ba('0x1a')](_0x125655));})[_0xc6ba('0x1b')](function(){logger['info'](_0xc6ba('0x1c'),_0x33167e);_0x12d6e9[_0xc6ba('0x1d')]();});}else{logger[_0xc6ba('0xa')](_0xc6ba('0x1e'),_0x33167e);_0x12d6e9[_0xc6ba('0x1d')]();}}else{var _0x3f7082=this;var _0xc2de63=apiai(_0x42858b[0x0],{'language':_0x42858b[0x1]||'en'});return _0xc2de63[_0xc6ba('0x1f')](this[_0xc6ba('0x20')][_0xc6ba('0x18')],{'sessionId':md5(this[_0xc6ba('0x11')]['id'])})[_0xc6ba('0x17')](function(_0x4a2082){_0x3f7082[_0xc6ba('0x18')][_0xc6ba('0x21')]=_0x4a2082;_0x530397['body']=_0x4a2082[_0xc6ba('0x22')][_0xc6ba('0x23')][_0xc6ba('0x24')];_0x530397[_0xc6ba('0x25')]=_0xc6ba('0x21');_0x530397[_0xc6ba('0x26')]=JSON['stringify'](_0x4a2082);return rpc[_0x27b00a+_0xc6ba('0x27')][_0xc6ba('0x28')](_0x530397)['then'](function(_0x1f2d1a){logger[_0xc6ba('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,_0x530397[_0xc6ba('0x18')]);if(_0x4a2082['result'][_0xc6ba('0x29')][_0xc6ba('0x2a')]){_0x12d6e9[_0xc6ba('0x2b')]();}else{_0x12d6e9[_0xc6ba('0x1d')]();}})['catch'](function(_0x4fe380){logger[_0xc6ba('0x19')]('[%s][DIALOGFLOW]\x20%s',_0x33167e,JSON[_0xc6ba('0x1a')](_0x4fe380));_0x12d6e9['next']();});})[_0xc6ba('0x2c')](function(_0x1181ca){logger['error'](_0xc6ba('0x2d'),_0x33167e,_0x1181ca[_0xc6ba('0x20')]);_0x12d6e9[_0xc6ba('0x2b')]();});}}catch(_0x1c350b){logger[_0xc6ba('0x19')](_0xc6ba('0x2d'),_0x33167e,JSON['stringify'](_0x1c350b));_0x12d6e9[_0xc6ba('0x1d')]();}};}; \ No newline at end of file +var _0x2171=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','endConversation','next','moment','apiai-promise','md5','routing','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x5ac1f5,_0x5e9924){var _0x19dc74=function(_0x572303){while(--_0x572303){_0x5ac1f5['push'](_0x5ac1f5['shift']());}};_0x19dc74(++_0x5e9924);}(_0x2171,0x143));var _0x1217=function(_0x535345,_0x206b21){_0x535345=_0x535345-0x0;var _0x28c2b7=_0x2171[_0x535345];return _0x28c2b7;};'use strict';var _=require('lodash');var moment=require(_0x1217('0x0'));var apiai=require(_0x1217('0x1'));var md5=require(_0x1217('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1217('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x1217('0x4')),'mailMessage':require(_0x1217('0x5')),'smsMessage':require(_0x1217('0x6')),'faxMessage':require(_0x1217('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1217('0x8')]=function(_0x8742bc,_0x32a022){return function(_0x5bde7e){try{if(!_[_0x1217('0x9')](this[_0x1217('0xa')][_0x1217('0xb')])){logger[_0x1217('0xc')](_0x1217('0xd'),_0x8742bc,_0x1217('0xe'));return _0x5bde7e['next']();}var _0x125efc={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1217('0xf')](_0x1217('0x10')),'direction':_0x1217('0x11')};if(this[_0x1217('0x12')]===_0x1217('0x13')||this['channel']===_0x1217('0x14')){_0x125efc[_0x1217('0x15')]=this[_0x1217('0xa')][_0x1217('0x15')];}var _0xe7c511=this['channel'];if(_0xe7c511==='chat'){_0x125efc[_0x1217('0x16')]=this['account']['id'];}else{_0x125efc[_['upperFirst'](_0xe7c511)+_0x1217('0x17')]=this['account']['id'];}_0x125efc[_['upperFirst'](_0xe7c511)+_0x1217('0x18')]=this[_0x1217('0xa')]['id'];if(this[_0x1217('0xa')][_0x1217('0x19')]){var _0x57f4a2=_0x32a022[0x2];if(!_[_0x1217('0x1a')](_0x57f4a2)){_0x125efc[_0x1217('0x1b')]=utils[_0x1217('0x1c')](_0x57f4a2,this);return rpc[_0xe7c511+_0x1217('0x1d')]['create'](_0x125efc)[_0x1217('0x1e')](function(_0x24033f){logger[_0x1217('0xc')](_0x1217('0xd'),_0x8742bc,_0x125efc[_0x1217('0x1b')]);})[_0x1217('0x1f')](function(_0x195bb8){logger[_0x1217('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x8742bc,JSON[_0x1217('0x21')](_0x195bb8));})['finally'](function(){logger[_0x1217('0xc')](_0x1217('0x22'),_0x8742bc);_0x5bde7e['stop']();});}else{logger[_0x1217('0xc')](_0x1217('0x23'),_0x8742bc);_0x5bde7e[_0x1217('0x24')]();}}else{var _0xb4e4ea=this;var _0x2c625b=apiai(_0x32a022[0x0],{'language':_0x32a022[0x1]||'en'});return _0x2c625b['textRequest'](this[_0x1217('0x25')][_0x1217('0x1b')],{'sessionId':md5(this[_0x1217('0xa')]['id'])})['then'](function(_0x4a9c32){_0xb4e4ea[_0x1217('0x1b')][_0x1217('0x26')]=_0x4a9c32;_0x125efc[_0x1217('0x1b')]=_0x4a9c32['result'][_0x1217('0x27')][_0x1217('0x28')];_0x125efc[_0x1217('0x29')]=_0x1217('0x26');_0x125efc[_0x1217('0x2a')]=JSON[_0x1217('0x21')](_0x4a9c32);return rpc[_0xe7c511+'Message']['create'](_0x125efc)[_0x1217('0x1e')](function(_0x2dab2e){logger['info'](_0x1217('0xd'),_0x8742bc,_0x125efc[_0x1217('0x1b')]);if(_0x4a9c32[_0x1217('0x2b')][_0x1217('0x2c')][_0x1217('0x2d')]){_0x5bde7e['next']();}else{_0x5bde7e[_0x1217('0x24')]();}})[_0x1217('0x1f')](function(_0x3060fe){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x8742bc,JSON[_0x1217('0x21')](_0x3060fe));_0x5bde7e[_0x1217('0x2e')]();});})[_0x1217('0x1f')](function(_0x5c7fe3){logger['error'](_0x1217('0xd'),_0x8742bc,_0x5c7fe3[_0x1217('0x25')]);_0x5bde7e[_0x1217('0x2e')]();});}}catch(_0x5d89d5){logger['error'](_0x1217('0xd'),_0x8742bc,JSON[_0x1217('0x21')](_0x5d89d5));_0x5bde7e[_0x1217('0x24')]();}};}; \ 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 9f3a5e1..8368609 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 _0x6873=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','then','error','finally','stop','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerResponse','next','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','stringify','isNil','interaction','UserId'];(function(_0x3ac577,_0x4e0dee){var _0x3a24d3=function(_0x112481){while(--_0x112481){_0x3ac577['push'](_0x3ac577['shift']());}};_0x3a24d3(++_0x4e0dee);}(_0x6873,0xac));var _0x3687=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x6873[_0xc14df7];return _0x34a445;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x3687('0x0'));var moment=require(_0x3687('0x1'));var Promise=require(_0x3687('0x2'));var logger=require(_0x3687('0x3'))(_0x3687('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x3687('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3687('0x6')),'smsMessage':require(_0x3687('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x3687('0x8'))};function createMessage(_0x2433a7,_0xf81d74,_0x1be8c0,_0x143060){return new Promise(function(_0x761e4f,_0x3c4131){var _0xda11f0=_[_0x3687('0x9')](_0x1be8c0);_0xda11f0['body']=_0x143060;return rpc[_0xf81d74+_0x3687('0xa')][_0x3687('0xb')](_0xda11f0)['then'](function(){logger[_0x3687('0xc')](_0x3687('0xd'),_0x2433a7,_0xda11f0[_0x3687('0xe')]);_0x761e4f();})[_0x3687('0xf')](function(_0x1b0c43){logger['error'](_0x3687('0xd'),_0x2433a7,JSON[_0x3687('0x10')](_0x1b0c43));_0x3c4131(_0x1b0c43);});});}exports['consequence']=function(_0xee2238,_0x2001c0){return function(_0x16bec2){try{if(!_[_0x3687('0x11')](this[_0x3687('0x12')][_0x3687('0x13')])){logger[_0x3687('0xc')](_0x3687('0xd'),_0xee2238,_0x3687('0x14'));return _0x16bec2['next']();}var _0x2afd7f={'ContactId':this[_0x3687('0x15')]['id'],'sentAt':moment()[_0x3687('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x3687('0x17')]===_0x3687('0x18')||this[_0x3687('0x17')]===_0x3687('0x19')){_0x2afd7f[_0x3687('0x1a')]=this[_0x3687('0x12')]['phone'];}var _0x468859=this[_0x3687('0x17')];if(_0x468859===_0x3687('0x1b')){_0x2afd7f[_0x3687('0x1c')]=this['account']['id'];}else{_0x2afd7f[_[_0x3687('0x1d')](_0x468859)+'AccountId']=this[_0x3687('0x1e')]['id'];}_0x2afd7f[_[_0x3687('0x1d')](_0x468859)+_0x3687('0x1f')]=this[_0x3687('0x12')]['id'];if(this[_0x3687('0x12')][_0x3687('0x20')]){var _0x1ad11a=_0x2001c0[0x4];if(!_[_0x3687('0x21')](_0x1ad11a)){_0x2afd7f[_0x3687('0xe')]=utils[_0x3687('0x22')](_0x1ad11a,this);return rpc[_0x468859+_0x3687('0xa')][_0x3687('0xb')](_0x2afd7f)[_0x3687('0x23')](function(_0x203f09){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,_0x2afd7f['body']);})[_0x3687('0xf')](function(_0xe0d37){logger[_0x3687('0x24')](_0x3687('0xd'),_0xee2238,JSON[_0x3687('0x10')](_0xe0d37));})[_0x3687('0x25')](function(){logger[_0x3687('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xee2238);_0x16bec2['stop']();});}else{logger[_0x3687('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xee2238);_0x16bec2[_0x3687('0x26')]();}}else{var _0x30be03=this;var _0x4e05e1=_0x2001c0[0x2]['replace'](/\\n/g,'\x0a');var _0x44cb38={'credentials':{'private_key':_0x4e05e1,'client_email':_0x2001c0[0x1]}};var _0x54636b=new dialogflow[(_0x3687('0x27'))](_0x44cb38);var _0x1bc916=_0x54636b[_0x3687('0x28')](_0x2001c0[0x0],md5(_0x30be03[_0x3687('0x12')]['id']));var _0x5a19df={'session':_0x1bc916,'queryInput':{'text':{'text':_0x30be03[_0x3687('0x29')][_0x3687('0xe')],'languageCode':_0x2001c0[0x3]||'en'}}};return _0x54636b[_0x3687('0x2a')](_0x5a19df)['then'](function(_0x2bc5b8){if(_0x2bc5b8&&_0x2bc5b8[_0x3687('0x2b')]){_0x30be03[_0x3687('0xe')][_0x3687('0x2c')]=_0x2bc5b8;var _0x2646e=_0x2bc5b8[0x0];var _0x23375e=_0x2646e['queryResult']['diagnosticInfo']&&_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]['fields']?_0x2646e['queryResult'][_0x3687('0x2e')][_0x3687('0x2f')][_0x3687('0x30')][_0x3687('0x31')]:![];_0x30be03['body'][_0x3687('0x32')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x33')];_0x30be03[_0x3687('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2646e[_0x3687('0x2d')]['allRequiredParamsPresent'];_0x30be03['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]&&_0x2646e[_0x3687('0x2d')][_0x3687('0x2e')]['fields']?_0x2646e[_0x3687('0x2d')]['diagnosticInfo'][_0x3687('0x2f')][_0x3687('0x30')][_0x3687('0x31')]:![];_0x30be03[_0x3687('0xe')]['DIALOGFLOWV2_INTENTNAME']=_0x2646e['queryResult'][_0x3687('0x34')]['name'];_0x30be03[_0x3687('0xe')][_0x3687('0x35')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x34')][_0x3687('0x36')];_0x30be03[_0x3687('0xe')][_0x3687('0x37')]=_0x2646e[_0x3687('0x2d')][_0x3687('0x34')][_0x3687('0x38')];_0x30be03[_0x3687('0xe')][_0x3687('0x39')]=_0x2646e['queryResult'][_0x3687('0x3a')];_0x30be03[_0x3687('0xe')][_0x3687('0x3b')]=_0x2646e['queryResult'][_0x3687('0x3c')];_0x30be03['body'][_0x3687('0x3d')]=_0x2646e[_0x3687('0x2d')]['intentDetectionConfidence'];_0x2afd7f['providerName']=_0x3687('0x2c');_0x2afd7f[_0x3687('0x3e')]=JSON['stringify'](_0x2bc5b8);var _0x45451d=[];for(var _0x123ee6=0x0;_0x123ee6<_0x2bc5b8[_0x3687('0x2b')];_0x123ee6++){var _0x4cfe6c=_0x2bc5b8[_0x123ee6];if(_0x4cfe6c&&_0x4cfe6c[_0x3687('0x2d')]&&_0x4cfe6c[_0x3687('0x2d')]['fulfillmentText']){_0x45451d['push'](createMessage(_0xee2238,_0x468859,_0x2afd7f,_0x4cfe6c[_0x3687('0x2d')]['fulfillmentText']));}}return Promise['all'](_0x45451d)[_0x3687('0x23')](function(){if(_0x23375e){_0x16bec2[_0x3687('0x3f')]();}else{_0x16bec2[_0x3687('0x26')]();}})[_0x3687('0xf')](function(_0x54059a){logger[_0x3687('0x24')](_0x3687('0xd'),_0xee2238,JSON[_0x3687('0x10')](_0x54059a));_0x16bec2[_0x3687('0x3f')]();});}})[_0x3687('0xf')](function(_0x3df0fc){logger[_0x3687('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,_0x3df0fc[_0x3687('0x29')]);_0x16bec2[_0x3687('0x3f')]();});}}catch(_0x4d9d23){logger[_0x3687('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0xee2238,JSON[_0x3687('0x10')](_0x4d9d23));_0x16bec2['stop']();}};}; \ No newline at end of file +var _0x6909=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','message','dialogflow','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x689546,_0x278679){var _0x46cdc0=function(_0x8aff5c){while(--_0x8aff5c){_0x689546['push'](_0x689546['shift']());}};_0x46cdc0(++_0x278679);}(_0x6909,0x1e3));var _0x9690=function(_0x5060e7,_0xf1c44b){_0x5060e7=_0x5060e7-0x0;var _0x3c668e=_0x6909[_0x5060e7];return _0x3c668e;};'use strict';var _=require('lodash');var dialogflow=require(_0x9690('0x0'));var md5=require('md5');var moment=require(_0x9690('0x1'));var Promise=require(_0x9690('0x2'));var logger=require(_0x9690('0x3'))('routing');var utils=require(_0x9690('0x4'));var rpc={'chatMessage':require(_0x9690('0x5')),'openchannelMessage':require(_0x9690('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x9690('0x7')),'faxMessage':require(_0x9690('0x8')),'whatsappMessage':require(_0x9690('0x9'))};function createMessage(_0x75cbcb,_0x1345ee,_0x45df5c,_0x29039f){return new Promise(function(_0x3bd208,_0x3c03ad){var _0x31b00f=_['clone'](_0x45df5c);_0x31b00f[_0x9690('0xa')]=_0x29039f;return rpc[_0x1345ee+_0x9690('0xb')][_0x9690('0xc')](_0x31b00f)[_0x9690('0xd')](function(){logger[_0x9690('0xe')](_0x9690('0xf'),_0x75cbcb,_0x31b00f[_0x9690('0xa')]);_0x3bd208();})[_0x9690('0x10')](function(_0x35e041){logger[_0x9690('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x75cbcb,JSON[_0x9690('0x12')](_0x35e041));_0x3c03ad(_0x35e041);});});}exports['consequence']=function(_0x5e960e,_0x587373){return function(_0x40341d){try{if(!_[_0x9690('0x13')](this[_0x9690('0x14')][_0x9690('0x15')])){logger[_0x9690('0xe')](_0x9690('0xf'),_0x5e960e,_0x9690('0x16'));return _0x40341d[_0x9690('0x17')]();}var _0x139e3d={'ContactId':this[_0x9690('0x18')]['id'],'sentAt':moment()[_0x9690('0x19')](_0x9690('0x1a')),'direction':_0x9690('0x1b')};if(this[_0x9690('0x1c')]===_0x9690('0x1d')||this['channel']===_0x9690('0x1e')){_0x139e3d[_0x9690('0x1f')]=this[_0x9690('0x14')][_0x9690('0x1f')];}var _0xaf37d6=this[_0x9690('0x1c')];if(_0xaf37d6===_0x9690('0x20')){_0x139e3d['ChatWebsiteId']=this['account']['id'];}else{_0x139e3d[_[_0x9690('0x21')](_0xaf37d6)+_0x9690('0x22')]=this['account']['id'];}_0x139e3d[_[_0x9690('0x21')](_0xaf37d6)+_0x9690('0x23')]=this['interaction']['id'];if(this['interaction']['created']){var _0x1b7199=_0x587373[0x4];if(!_[_0x9690('0x24')](_0x1b7199)){_0x139e3d['body']=utils[_0x9690('0x25')](_0x1b7199,this);return rpc[_0xaf37d6+'Message'][_0x9690('0xc')](_0x139e3d)[_0x9690('0xd')](function(_0x2cc2bb){logger[_0x9690('0xe')](_0x9690('0xf'),_0x5e960e,_0x139e3d['body']);})['catch'](function(_0x3e795e){logger[_0x9690('0x11')](_0x9690('0xf'),_0x5e960e,JSON['stringify'](_0x3e795e));})['finally'](function(){logger[_0x9690('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5e960e);_0x40341d['stop']();});}else{logger[_0x9690('0xe')](_0x9690('0x26'),_0x5e960e);_0x40341d[_0x9690('0x27')]();}}else{var _0x5bc4e8=this;var _0x55c6a2=_0x587373[0x2]['replace'](/\\n/g,'\x0a');var _0x286bcd={'credentials':{'private_key':_0x55c6a2,'client_email':_0x587373[0x1]}};var _0x1ef202=new dialogflow[(_0x9690('0x28'))](_0x286bcd);var _0x2fa516=_0x1ef202[_0x9690('0x29')](_0x587373[0x0],md5(_0x5bc4e8[_0x9690('0x14')]['id']));var _0x46ec11={'session':_0x2fa516,'queryInput':{'text':{'text':_0x5bc4e8['message'][_0x9690('0xa')],'languageCode':_0x587373[0x3]||'en'}}};return _0x1ef202['detectIntent'](_0x46ec11)[_0x9690('0xd')](function(_0x1e5558){if(_0x1e5558&&_0x1e5558[_0x9690('0x2a')]){_0x5bc4e8[_0x9690('0xa')][_0x9690('0x2b')]=_0x1e5558;var _0x47d891=_0x1e5558[0x0];var _0x29f2ea=_0x47d891[_0x9690('0x2c')][_0x9690('0x2d')]&&_0x47d891[_0x9690('0x2c')][_0x9690('0x2d')]['fields']?_0x47d891[_0x9690('0x2c')][_0x9690('0x2d')][_0x9690('0x2e')][_0x9690('0x2f')][_0x9690('0x30')]:![];_0x5bc4e8[_0x9690('0xa')][_0x9690('0x31')]=_0x47d891[_0x9690('0x2c')][_0x9690('0x32')];_0x5bc4e8['body'][_0x9690('0x33')]=_0x47d891[_0x9690('0x2c')][_0x9690('0x34')];_0x5bc4e8[_0x9690('0xa')][_0x9690('0x35')]=_0x47d891[_0x9690('0x2c')]['diagnosticInfo']&&_0x47d891['queryResult'][_0x9690('0x2d')]['fields']?_0x47d891[_0x9690('0x2c')]['diagnosticInfo'][_0x9690('0x2e')]['end_conversation']['boolValue']:![];_0x5bc4e8[_0x9690('0xa')][_0x9690('0x36')]=_0x47d891[_0x9690('0x2c')][_0x9690('0x37')]['name'];_0x5bc4e8[_0x9690('0xa')][_0x9690('0x38')]=_0x47d891['queryResult']['intent'][_0x9690('0x39')];_0x5bc4e8[_0x9690('0xa')][_0x9690('0x3a')]=_0x47d891[_0x9690('0x2c')][_0x9690('0x37')][_0x9690('0x3b')];_0x5bc4e8['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x47d891[_0x9690('0x2c')][_0x9690('0x3c')];_0x5bc4e8['body'][_0x9690('0x3d')]=_0x47d891['queryResult'][_0x9690('0x3e')];_0x5bc4e8['body'][_0x9690('0x3f')]=_0x47d891[_0x9690('0x2c')]['intentDetectionConfidence'];_0x139e3d[_0x9690('0x40')]=_0x9690('0x2b');_0x139e3d[_0x9690('0x41')]=JSON[_0x9690('0x12')](_0x1e5558);var _0x14f462=[];for(var _0x45be42=0x0;_0x45be42<_0x1e5558[_0x9690('0x2a')];_0x45be42++){var _0x2beacf=_0x1e5558[_0x45be42];if(_0x2beacf&&_0x2beacf[_0x9690('0x2c')]&&_0x2beacf[_0x9690('0x2c')][_0x9690('0x42')]){_0x14f462[_0x9690('0x43')](createMessage(_0x5e960e,_0xaf37d6,_0x139e3d,_0x2beacf[_0x9690('0x2c')][_0x9690('0x42')]));}}return Promise[_0x9690('0x44')](_0x14f462)[_0x9690('0xd')](function(){if(_0x29f2ea){_0x40341d[_0x9690('0x17')]();}else{_0x40341d[_0x9690('0x27')]();}})['catch'](function(_0x49bea4){logger[_0x9690('0x11')](_0x9690('0xf'),_0x5e960e,JSON[_0x9690('0x12')](_0x49bea4));_0x40341d[_0x9690('0x17')]();});}})[_0x9690('0x10')](function(_0x1d91c3){logger[_0x9690('0x11')](_0x9690('0xf'),_0x5e960e,_0x1d91c3[_0x9690('0x45')]);_0x40341d[_0x9690('0x17')]();});}}catch(_0x4963e5){logger[_0x9690('0x11')](_0x9690('0xf'),_0x5e960e,JSON['stringify'](_0x4963e5));_0x40341d['stop']();}};}; \ 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 2336486..6a8b363 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 _0xe299=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','length','error','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','validate','lodash','html-to-text','./utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe299,0x140));var _0x9e29=function(_0x128e48,_0x355e5e){_0x128e48=_0x128e48-0x0;var _0x5eb0d2=_0xe299[_0x128e48];return _0x5eb0d2;};'use strict';var schema=require(_0x9e29('0x0'));var _=require(_0x9e29('0x1'));var htmlToText=require(_0x9e29('0x2'));var utils=require(_0x9e29('0x3'));var logger=require(_0x9e29('0x4'))(_0x9e29('0x5'));var gotoif=schema({'condition':{'type':_0x9e29('0x6'),'required':!![],'message':_0x9e29('0x7')},'priorityTrue':{'type':_0x9e29('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x9e29('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x9e29('0x9')]=function(_0x371ae4,_0x1fd47d){return function(_0x48ff0a){try{var _0x9836d2={'condition':htmlToText[_0x9e29('0xa')](utils['getMustacheRender'](_0x1fd47d[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1fd47d[0x1],'priorityFalse':_0x1fd47d[0x2]};var _0x19f90e=gotoif[_0x9e29('0x0')](_0x9836d2,{'typecast':!![]});if(_0x19f90e[_0x9e29('0xb')]){logger[_0x9e29('0xc')](_0x9e29('0xd'),_0x371ae4,_[_0x9e29('0xe')](_0x19f90e,'message')[_0x9e29('0xf')](',\x20'));_0x48ff0a[_0x9e29('0x10')]();}else{try{var _0x36231e=eval('('+_0x9836d2['condition']+')');var _0x39baef=_0x36231e?_0x9836d2[_0x9e29('0x11')]:_0x9836d2[_0x9e29('0x12')];logger[_0x9e29('0x13')](_0x9e29('0x14'),_0x371ae4,_0x9836d2['condition'],_0x36231e,_0x39baef||_0x9e29('0x15'));if(_0x39baef){var _0x223a19=_[_0x9e29('0x16')](_0x48ff0a[_0x9e29('0x17')](),{'p':_0x39baef});if(_0x223a19>=0x0){logger['info'](_0x9e29('0x18'),_0x371ae4,_0x39baef||'next',_0x223a19);_0x48ff0a[_0x9e29('0x15')](_0x223a19);}else{logger[_0x9e29('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x371ae4,_0x39baef||'next');_0x48ff0a[_0x9e29('0x10')]();}}else{_0x48ff0a[_0x9e29('0x15')]();}}catch(_0x440bec){logger['error'](_0x9e29('0x19'),_0x371ae4,_0x440bec[_0x9e29('0x1a')]);_0x48ff0a[_0x9e29('0x10')]();}}}catch(_0x20e375){logger[_0x9e29('0xc')](_0x9e29('0xd'),_0x371ae4,JSON['stringify'](_0x20e375));_0x48ff0a[_0x9e29('0x10')]();}};}; \ No newline at end of file +var _0x76af=['fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x795bf2,_0x27e5b3){var _0x3227dc=function(_0x393fb2){while(--_0x393fb2){_0x795bf2['push'](_0x795bf2['shift']());}};_0x3227dc(++_0x27e5b3);}(_0x76af,0x16f));var _0xf76a=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x76af[_0x493a51];return _0xc85756;};'use strict';var schema=require(_0xf76a('0x0'));var _=require('lodash');var htmlToText=require(_0xf76a('0x1'));var utils=require('./utils');var logger=require(_0xf76a('0x2'))(_0xf76a('0x3'));var gotoif=schema({'condition':{'type':_0xf76a('0x4'),'required':!![],'message':_0xf76a('0x5')},'priorityTrue':{'type':'number','message':_0xf76a('0x6')},'priorityFalse':{'type':_0xf76a('0x7'),'message':_0xf76a('0x8')}});exports[_0xf76a('0x9')]=function(_0x33040a,_0x54a8c2){return function(_0x2bd8f3){try{var _0x43f94d={'condition':htmlToText[_0xf76a('0xa')](utils[_0xf76a('0xb')](_0x54a8c2[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x54a8c2[0x1],'priorityFalse':_0x54a8c2[0x2]};var _0x495ef5=gotoif[_0xf76a('0x0')](_0x43f94d,{'typecast':!![]});if(_0x495ef5[_0xf76a('0xc')]){logger[_0xf76a('0xd')](_0xf76a('0xe'),_0x33040a,_['map'](_0x495ef5,_0xf76a('0xf'))[_0xf76a('0x10')](',\x20'));_0x2bd8f3['stop']();}else{try{var _0x8753ab=eval('('+_0x43f94d[_0xf76a('0x11')]+')');var _0x5941dc=_0x8753ab?_0x43f94d[_0xf76a('0x12')]:_0x43f94d[_0xf76a('0x13')];logger[_0xf76a('0x14')](_0xf76a('0x15'),_0x33040a,_0x43f94d[_0xf76a('0x11')],_0x8753ab,_0x5941dc||_0xf76a('0x16'));if(_0x5941dc){var _0x169535=_[_0xf76a('0x17')](_0x2bd8f3[_0xf76a('0x18')](),{'p':_0x5941dc});if(_0x169535>=0x0){logger[_0xf76a('0x14')](_0xf76a('0x19'),_0x33040a,_0x5941dc||'next',_0x169535);_0x2bd8f3[_0xf76a('0x16')](_0x169535);}else{logger[_0xf76a('0x14')](_0xf76a('0x1a'),_0x33040a,_0x5941dc||'next');_0x2bd8f3[_0xf76a('0x1b')]();}}else{_0x2bd8f3[_0xf76a('0x16')]();}}catch(_0xcc4cb8){logger[_0xf76a('0xd')](_0xf76a('0x1c'),_0x33040a,_0xcc4cb8['message']);_0x2bd8f3[_0xf76a('0x1b')]();}}}catch(_0x49f8f4){logger[_0xf76a('0xd')](_0xf76a('0xe'),_0x33040a,JSON['stringify'](_0x49f8f4));_0x2bd8f3['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 32c49c3..22334c0 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 _0x3459=['message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3459,0x147));var _0x9345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3459[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x9345('0x0'));var _=require(_0x9345('0x1'));var logger=require('../../../../config/logger')(_0x9345('0x2'));var gotop=schema({'priority':{'type':_0x9345('0x3'),'required':!![],'message':_0x9345('0x4')}});exports[_0x9345('0x5')]=function(_0x4070c7,_0x526a7b){return function(_0x462074){try{var _0x1bae40={'priority':_0x526a7b[0x0]};var _0x271150=gotop[_0x9345('0x0')](_0x1bae40,{'typecast':!![]});if(_0x271150[_0x9345('0x6')]){logger[_0x9345('0x7')](_0x9345('0x8'),_0x4070c7,_['map'](_0x271150,_0x9345('0x9'))[_0x9345('0xa')](',\x20'));_0x462074[_0x9345('0xb')]();}else{logger[_0x9345('0xc')](_0x9345('0xd'),_0x4070c7,_0x1bae40['priority']);if(_0x1bae40[_0x9345('0xe')]){var _0x5e2c6d=_[_0x9345('0xf')](_0x462074[_0x9345('0x10')](),{'p':_0x1bae40[_0x9345('0xe')]});if(_0x5e2c6d>=0x0){logger[_0x9345('0xc')](_0x9345('0x11'),_0x4070c7,_0x1bae40[_0x9345('0xe')]||'next',_0x5e2c6d);_0x462074[_0x9345('0x12')](_0x5e2c6d);}else{logger[_0x9345('0xc')](_0x9345('0x13'),_0x4070c7,_0x1bae40[_0x9345('0xe')]||_0x9345('0x12'));_0x462074[_0x9345('0xb')]();}}else{_0x462074[_0x9345('0x12')]();}}}catch(_0x500e8c){logger[_0x9345('0x7')]('[%s][GOTOP]\x20%s',_0x4070c7,JSON[_0x9345('0x14')](_0x500e8c));_0x462074[_0x9345('0xb')]();}};}; \ No newline at end of file +var _0x663a=['[%s][GOTOP]\x20%s','map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error'];(function(_0x3813ed,_0x52ac41){var _0x3537aa=function(_0x4237af){while(--_0x4237af){_0x3813ed['push'](_0x3813ed['shift']());}};_0x3537aa(++_0x52ac41);}(_0x663a,0x13d));var _0xa663=function(_0x1d13c9,_0xf6db87){_0x1d13c9=_0x1d13c9-0x0;var _0xeba7e7=_0x663a[_0x1d13c9];return _0xeba7e7;};'use strict';var schema=require('validate');var _=require(_0xa663('0x0'));var logger=require('../../../../config/logger')(_0xa663('0x1'));var gotop=schema({'priority':{'type':_0xa663('0x2'),'required':!![],'message':_0xa663('0x3')}});exports['consequence']=function(_0x1a7a26,_0x1d97de){return function(_0x5ea821){try{var _0x55c068={'priority':_0x1d97de[0x0]};var _0x1a4983=gotop[_0xa663('0x4')](_0x55c068,{'typecast':!![]});if(_0x1a4983[_0xa663('0x5')]){logger[_0xa663('0x6')](_0xa663('0x7'),_0x1a7a26,_[_0xa663('0x8')](_0x1a4983,'message')[_0xa663('0x9')](',\x20'));_0x5ea821['stop']();}else{logger[_0xa663('0xa')](_0xa663('0xb'),_0x1a7a26,_0x55c068['priority']);if(_0x55c068[_0xa663('0xc')]){var _0x4bb875=_[_0xa663('0xd')](_0x5ea821['rules'](),{'p':_0x55c068[_0xa663('0xc')]});if(_0x4bb875>=0x0){logger[_0xa663('0xa')](_0xa663('0xe'),_0x1a7a26,_0x55c068[_0xa663('0xc')]||'next',_0x4bb875);_0x5ea821[_0xa663('0xf')](_0x4bb875);}else{logger[_0xa663('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1a7a26,_0x55c068[_0xa663('0xc')]||_0xa663('0xf'));_0x5ea821[_0xa663('0x10')]();}}else{_0x5ea821['next']();}}}catch(_0x198513){logger[_0xa663('0x6')](_0xa663('0x7'),_0x1a7a26,JSON[_0xa663('0x11')](_0x198513));_0x5ea821[_0xa663('0x10')]();}};}; \ 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 06fd03e..e174291 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 _0x6738=['[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','create','then','info'];(function(_0x4f8cba,_0x51d42b){var _0xe240a6=function(_0x5de3ea){while(--_0x5de3ea){_0x4f8cba['push'](_0x4f8cba['shift']());}};_0xe240a6(++_0x51d42b);}(_0x6738,0x16f));var _0x8673=function(_0x1fdce6,_0x4ed182){_0x1fdce6=_0x1fdce6-0x0;var _0x5840c0=_0x6738[_0x1fdce6];return _0x5840c0;};'use strict';var _=require(_0x8673('0x0'));var utils=require('./utils');var logger=require(_0x8673('0x1'))(_0x8673('0x2'));var rpc={'chatMessage':require(_0x8673('0x3')),'openchannelMessage':require(_0x8673('0x4')),'mailMessage':require(_0x8673('0x5')),'smsMessage':require(_0x8673('0x6')),'faxMessage':require(_0x8673('0x7')),'whatsappMessage':require(_0x8673('0x8'))};exports[_0x8673('0x9')]=function(_0x533421,_0x33b762){return function(_0x487a5e){try{var _0x205205={'body':utils[_0x8673('0xa')](_0x33b762[0x0],this),'ContactId':this[_0x8673('0xb')]['id']};if(this[_0x8673('0xc')]==='chat'){_0x205205[_0x8673('0xd')]=this['account']['id'];}else{_0x205205[_[_0x8673('0xe')](this[_0x8673('0xc')])+_0x8673('0xf')]=this[_0x8673('0x10')]['id'];}_0x205205[_['upperFirst'](this['channel'])+_0x8673('0x11')]=this[_0x8673('0x12')]['id'];if(rpc[this[_0x8673('0xc')]+_0x8673('0x13')]){return rpc[this[_0x8673('0xc')]+_0x8673('0x13')][_0x8673('0x14')](_0x205205)[_0x8673('0x15')](function(_0x48a021){logger[_0x8673('0x16')](_0x8673('0x17'),_0x533421,_0x205205[_0x8673('0x18')]);_0x487a5e[_0x8673('0x19')]();})[_0x8673('0x1a')](function(_0x39a0bf){logger['error']('[%s][MESSAGE]\x20%s',_0x533421,JSON[_0x8673('0x1b')](_0x39a0bf));_0x487a5e[_0x8673('0x1c')]();});}}catch(_0x5c1190){logger[_0x8673('0x1d')]('[%s][MESSAGE]\x20%s',_0x533421,JSON[_0x8673('0x1b')](_0x5c1190));_0x487a5e['stop']();}};}; \ No newline at end of file +var _0x7426=['AccountId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','account','upperFirst','channel'];(function(_0x37dab4,_0x5322ef){var _0x42eea8=function(_0x378d7b){while(--_0x378d7b){_0x37dab4['push'](_0x37dab4['shift']());}};_0x42eea8(++_0x5322ef);}(_0x7426,0x1df));var _0x6742=function(_0x3582a9,_0x150168){_0x3582a9=_0x3582a9-0x0;var _0x19c3d9=_0x7426[_0x3582a9];return _0x19c3d9;};'use strict';var _=require('lodash');var utils=require(_0x6742('0x0'));var logger=require(_0x6742('0x1'))(_0x6742('0x2'));var rpc={'chatMessage':require(_0x6742('0x3')),'openchannelMessage':require(_0x6742('0x4')),'mailMessage':require(_0x6742('0x5')),'smsMessage':require(_0x6742('0x6')),'faxMessage':require(_0x6742('0x7')),'whatsappMessage':require(_0x6742('0x8'))};exports['consequence']=function(_0x38ec2a,_0x4ecd1f){return function(_0x27f04a){try{var _0x14219c={'body':utils[_0x6742('0x9')](_0x4ecd1f[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0x6742('0xa')){_0x14219c[_0x6742('0xb')]=this[_0x6742('0xc')]['id'];}else{_0x14219c[_[_0x6742('0xd')](this[_0x6742('0xe')])+_0x6742('0xf')]=this['account']['id'];}_0x14219c[_[_0x6742('0xd')](this[_0x6742('0xe')])+'InteractionId']=this[_0x6742('0x10')]['id'];if(rpc[this[_0x6742('0xe')]+_0x6742('0x11')]){return rpc[this[_0x6742('0xe')]+_0x6742('0x11')][_0x6742('0x12')](_0x14219c)['then'](function(_0x5914de){logger[_0x6742('0x13')](_0x6742('0x14'),_0x38ec2a,_0x14219c['body']);_0x27f04a[_0x6742('0x15')]();})[_0x6742('0x16')](function(_0xaf4cdc){logger[_0x6742('0x17')](_0x6742('0x14'),_0x38ec2a,JSON[_0x6742('0x18')](_0xaf4cdc));_0x27f04a['stop']();});}}catch(_0x3d89e2){logger[_0x6742('0x17')](_0x6742('0x14'),_0x38ec2a,JSON['stringify'](_0x3d89e2));_0x27f04a[_0x6742('0x19')]();}};}; \ 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 0ea9e95..e4ae84d 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 _0xce42=['./utils','routing','getMustacheRender','next','error'];(function(_0x431423,_0x481f04){var _0x230e5b=function(_0x32880f){while(--_0x32880f){_0x431423['push'](_0x431423['shift']());}};_0x230e5b(++_0x481f04);}(_0xce42,0xa0));var _0x2ce4=function(_0x4259a3,_0x2f9e82){_0x4259a3=_0x4259a3-0x0;var _0x5dfed4=_0xce42[_0x4259a3];return _0x5dfed4;};'use strict';var utils=require(_0x2ce4('0x0'));var logger=require('../../../../config/logger')(_0x2ce4('0x1'));exports['consequence']=function(_0x5d5625,_0x19080f){return function(_0xe91bfe){try{logger['info']('[%s][NOOP]\x20%s',_0x5d5625,utils[_0x2ce4('0x2')](_0x19080f[0x0],this));_0xe91bfe[_0x2ce4('0x3')]();}catch(_0x3e1e89){logger[_0x2ce4('0x4')]('[%s][NOOP]\x20%s',_0x5d5625,JSON['stringify'](_0x3e1e89));_0xe91bfe['stop']();}};}; \ No newline at end of file +var _0xeba7=['info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils','consequence'];(function(_0x399114,_0x34e9cf){var _0x5dac88=function(_0x9d06c3){while(--_0x9d06c3){_0x399114['push'](_0x399114['shift']());}};_0x5dac88(++_0x34e9cf);}(_0xeba7,0x7e));var _0x7eba=function(_0x519c0f,_0x26b0b5){_0x519c0f=_0x519c0f-0x0;var _0x69a46f=_0xeba7[_0x519c0f];return _0x69a46f;};'use strict';var utils=require(_0x7eba('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x7eba('0x1')]=function(_0x5f5794,_0xa00d6a){return function(_0x3681c7){try{logger[_0x7eba('0x2')](_0x7eba('0x3'),_0x5f5794,utils[_0x7eba('0x4')](_0xa00d6a[0x0],this));_0x3681c7['next']();}catch(_0x100462){logger[_0x7eba('0x5')]('[%s][NOOP]\x20%s',_0x5f5794,JSON[_0x7eba('0x6')](_0x100462));_0x3681c7[_0x7eba('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index a60bcc9..b9d606c 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 _0x4390=['%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','body','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','./strategy','redis','defaults','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','format','%sQueuesWaitingInteractions','pick'];(function(_0x50180c,_0x2978d2){var _0xffe063=function(_0xbfafd4){while(--_0xbfafd4){_0x50180c['push'](_0x50180c['shift']());}};_0xffe063(++_0x2978d2);}(_0x4390,0x88));var _0x0439=function(_0x407d07,_0x515a81){_0x407d07=_0x407d07-0x0;var _0x562ae8=_0x4390[_0x407d07];return _0x562ae8;};'use strict';var schema=require(_0x0439('0x0'));var _=require(_0x0439('0x1'));var util=require(_0x0439('0x2'));var seqqueue=require(_0x0439('0x3'));var moment=require(_0x0439('0x4'));var Redis=require(_0x0439('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x0439('0x6'));config[_0x0439('0x7')]=_[_0x0439('0x8')](config[_0x0439('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x0439('0x9'))(new Redis(config[_0x0439('0x7')]));var attributes=['id',_0x0439('0xa'),'account',_0x0439('0xb'),_0x0439('0xc'),_0x0439('0xd')];function emit(_0x422dc6,_0x18190b,_0x497c68){io['to'](_0x422dc6)[_0x0439('0xe')](_0x18190b,_0x497c68);}function emitChannelQueueInteraction(_0x26f430,_0x1a8c75,_0x3845f3,_0x580236,_0x421504,_0x1ab4cc,_0x106085,_0x5a0f7c){var _0x4c0861=_[_0x0439('0xf')](_0x3845f3);_0x4c0861[_0x0439('0xa')]=_0x5a0f7c;_0x4c0861[_0x0439('0xb')]=_0x1a8c75;_0x4c0861[_0x0439('0x10')]=_0x580236;_0x4c0861['id']=_0x421504;if(_0x1ab4cc){_0x106085[util[_0x0439('0x11')](_0x0439('0x12'),_0x26f430)][_0x421504]=_[_0x0439('0x13')](_0x4c0861,attributes);}else{delete _0x106085[util[_0x0439('0x11')](_0x0439('0x12'),_0x26f430)][_0x421504];}emit(util[_0x0439('0x11')](_0x0439('0x14'),_0x26f430,_0x1a8c75),util[_0x0439('0x11')](_0x0439('0x15'),_0x26f430,_0x1ab4cc?'save':'remove'),_[_0x0439('0x13')](_0x4c0861,attributes));}var rpc={'openchannelQueueReport':require(_0x0439('0x16')),'mailQueueReport':require(_0x0439('0x17')),'chatQueueReport':require(_0x0439('0x18')),'smsQueueReport':require(_0x0439('0x19')),'faxQueueReport':require(_0x0439('0x1a')),'whatsappQueueReport':require(_0x0439('0x1b'))};var queue=schema({'name':{'type':_0x0439('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0439('0x1d'),'message':_0x0439('0x1e')}});function startRouting(_0x127ccb,_0x432f64,_0x34143e,_0x8da243){if(_0x127ccb&&_0x432f64&&_0x34143e){_0x432f64[_0x0439('0x1f')]+=0x1;var _0x35e6e1={'uniqueid':_0x127ccb,'from':_0x34143e['body']?_0x34143e['body'][_0x0439('0xc')]:'','joinAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x34143e[_0x0439('0x20')]?_0x34143e[_0x0439('0x20')]['id']:null,'ListId':_0x34143e[_0x0439('0x21')]?_0x34143e[_0x0439('0x21')]['id']:null};_0x35e6e1[_['upperFirst'](_0x34143e[_0x0439('0x22')])+_0x0439('0x23')]=_0x432f64['id']||null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+_0x0439('0x25')]=_0x34143e[_0x0439('0x26')]?_0x34143e['interaction']['id']:null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+_0x0439('0x27')]=_0x34143e[_0x0439('0x28')]?_0x34143e['message']['id']:null;_0x35e6e1[_[_0x0439('0x24')](_0x34143e[_0x0439('0x22')])+(_0x34143e[_0x0439('0x22')]!==_0x0439('0x29')?_0x0439('0x2a'):_0x0439('0x2b'))]=_0x34143e['account']?_0x34143e[_0x0439('0x10')]['id']:null;logger[_0x0439('0x2c')](util[_0x0439('0x11')](_0x0439('0x2d'),_0x127ccb,_0x432f64[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x34143e[_0x0439('0x22')],_0x432f64['name'],_0x35e6e1,_0x34143e[_0x0439('0x10')]['name'],_0x34143e[_0x0439('0x28')]['id'],!![],_0x8da243,_0x432f64['id']);if(rpc[_0x34143e['channel']+_0x0439('0x2f')]){return rpc[_0x34143e[_0x0439('0x22')]+'QueueReport'][_0x0439('0x30')](_0x35e6e1)['catch'](function(_0x3a8e22){logger[_0x0439('0x31')](_0x0439('0x32'));});}}}function stopRouting(_0x2bb4cc,_0x1324f3,_0x195bcb,_0x1f4410){if(_0x2bb4cc&&_0x1324f3){_0x1324f3[_0x0439('0x1f')]-=0x1;var _0x7b98d8={'leaveAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x0439('0x33')),'reason':'accepted'};logger[_0x0439('0x2c')](util[_0x0439('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x2bb4cc,_0x1324f3[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x195bcb[_0x0439('0x22')],_0x1324f3[_0x0439('0x2e')],_0x195bcb[_0x0439('0x34')],_0x195bcb[_0x0439('0x10')]['name'],_0x195bcb[_0x0439('0x28')]['id'],![],_0x1f4410,_0x1324f3['id']);if(rpc[_0x195bcb[_0x0439('0x22')]+_0x0439('0x2f')]){return rpc[_0x195bcb[_0x0439('0x22')]+_0x0439('0x2f')][_0x0439('0x35')](_0x2bb4cc,_0x7b98d8)[_0x0439('0x36')](function(_0x546e37){logger['error'](_0x0439('0x37'));});}}}function endRouting(_0x46630d,_0x490ce5,_0x528aa4,_0xb8b1e3){if(_0x46630d&&_0x490ce5){_0x490ce5[_0x0439('0x1f')]-=0x1;var _0x3e03dd={'leaveAt':moment()[_0x0439('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0439('0x11')](_0x0439('0x33')),'reason':_0x0439('0x38')};logger[_0x0439('0x2c')](util['format'](_0x0439('0x39'),_0x46630d,_0x490ce5[_0x0439('0x2e')]));emitChannelQueueInteraction(_0x528aa4[_0x0439('0x22')],_0x490ce5[_0x0439('0x2e')],_0x528aa4[_0x0439('0x34')],_0x528aa4[_0x0439('0x10')][_0x0439('0x2e')],_0x528aa4[_0x0439('0x28')]['id'],![],_0xb8b1e3);if(rpc[_0x528aa4[_0x0439('0x22')]+_0x0439('0x2f')]){return rpc[_0x528aa4[_0x0439('0x22')]+_0x0439('0x2f')][_0x0439('0x35')](_0x46630d,_0x3e03dd)[_0x0439('0x36')](function(_0x5634af){logger[_0x0439('0x31')](_0x0439('0x37'));});}}}function handleFindQueue(_0x29f898){return function(_0x4b2fef){return _0x4b2fef[_0x0439('0x2e')][_0x0439('0x3a')]()===_0x29f898['toLowerCase']();};}exports[_0x0439('0x3b')]=function(_0x1693b7,_0x14951f,_0x16f659,_0x5484e8){return function(_0x3f26bd){try{var _0x53f262={'name':_0x14951f[0x0],'timeout':_0x14951f[0x1]};var _0x4a3880=queue[_0x0439('0x0')](_0x53f262,{'typecast':!![]});if(_0x4a3880[_0x0439('0x3c')]){logger[_0x0439('0x31')](_0x0439('0x3d'),_0x1693b7,_[_0x0439('0x3e')](_0x4a3880,'message')[_0x0439('0x3f')](',\x20'));_0x3f26bd[_0x0439('0x40')]();}else{var _0x22be1a=_[_0x0439('0x41')](_0x16f659[_0x5484e8[_0x0439('0x22')]+_0x0439('0x42')],handleFindQueue(_0x53f262[_0x0439('0x2e')]));if(_0x22be1a){startRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);var _0x9103db=(_0x22be1a['timeout']||0xa)*0x3e8;var _0x251275=(_0x53f262[_0x0439('0x38')]||0x14)*0x3e8;var _0x2d9de8,_0x4f0911;if(_0x9103db>_0x251275){_0x251275=_0x9103db;}var _0x5e8b89=seqqueue[_0x0439('0x43')](_0x9103db);_0x5e8b89['id']=_0x1693b7;_0x5e8b89[_0x0439('0x44')]=_0x9103db;_0x5e8b89['qtimeout']=_0x251275;_0x5e8b89[_0x0439('0x22')]=_0x5484e8[_0x0439('0x22')];_0x16f659['rules'][_0x1693b7]['on']('end',function(){logger[_0x0439('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1693b7);stopRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);clearTimeout(_0x2d9de8);_0x2d9de8=undefined;_0x5e8b89[_0x0439('0x45')](!![]);if(_0x16f659[_0x0439('0x46')][_0x1693b7]){delete _0x16f659[_0x0439('0x46')][_0x1693b7];}_0x3f26bd['stop']();});_0x16f659[_0x0439('0x46')][_0x1693b7]['on'](_0x0439('0x47'),function(){if(_0x16f659[_0x0439('0x46')][_0x1693b7]){delete _0x16f659[_0x0439('0x46')][_0x1693b7];}});_0x2d9de8=setTimeout(function(){logger[_0x0439('0x2c')](_0x0439('0x48'),_0x1693b7);endRouting(_0x1693b7,_0x22be1a,_0x5484e8,_0x16f659);clearTimeout(_0x2d9de8);_0x5e8b89['close'](!![]);_0x3f26bd['next']();},_0x251275);switch(_0x22be1a[_0x0439('0x49')]){case _0x0439('0x4a'):strategy[_0x0439('0x4a')](_0x5e8b89,_0x22be1a,_0x16f659,_0x5484e8);break;default:strategy['beepall'](_0x5e8b89,_0x22be1a,_0x16f659,_0x5484e8);}}else{logger[_0x0439('0x31')](_0x0439('0x4b'),_0x1693b7,_0x53f262[_0x0439('0x2e')]);_0x3f26bd[_0x0439('0x40')]();}}}catch(_0x13034d){console[_0x0439('0x4c')](_0x13034d);logger[_0x0439('0x31')]('[%s][QUEUE]\x20%s',_0x1693b7,_0x13034d[_0x0439('0x4d')]);_0x3f26bd[_0x0439('0x40')]();}};}; \ No newline at end of file +var _0x7505=['seq-queue','moment','ioredis','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','beepall','stack','validate','util'];(function(_0x3279cf,_0x1e0fec){var _0x53bdc6=function(_0x8232a4){while(--_0x8232a4){_0x3279cf['push'](_0x3279cf['shift']());}};_0x53bdc6(++_0x1e0fec);}(_0x7505,0x1d2));var _0x5750=function(_0x16d68f,_0x576779){_0x16d68f=_0x16d68f-0x0;var _0xbc18bd=_0x7505[_0x16d68f];return _0xbc18bd;};'use strict';var schema=require(_0x5750('0x0'));var _=require('lodash');var util=require(_0x5750('0x1'));var seqqueue=require(_0x5750('0x2'));var moment=require(_0x5750('0x3'));var Redis=require(_0x5750('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x5750('0x5'));var strategy=require(_0x5750('0x6'));config[_0x5750('0x7')]=_[_0x5750('0x8')](config['redis'],{'host':_0x5750('0x9'),'port':0x18eb});var io=require(_0x5750('0xa'))(new Redis(config['redis']));var attributes=['id',_0x5750('0xb'),_0x5750('0xc'),_0x5750('0xd'),_0x5750('0xe'),_0x5750('0xf')];function emit(_0x1fefb1,_0xac89c2,_0x3782c5){io['to'](_0x1fefb1)[_0x5750('0x10')](_0xac89c2,_0x3782c5);}function emitChannelQueueInteraction(_0x4da250,_0x3fcf74,_0x2287a2,_0x497f9c,_0x2b8099,_0x583c63,_0x58b69f,_0x261c84){var _0x46514b=_[_0x5750('0x11')](_0x2287a2);_0x46514b['queue_id']=_0x261c84;_0x46514b[_0x5750('0xd')]=_0x3fcf74;_0x46514b[_0x5750('0xc')]=_0x497f9c;_0x46514b['id']=_0x2b8099;if(_0x583c63){_0x58b69f[util[_0x5750('0x12')](_0x5750('0x13'),_0x4da250)][_0x2b8099]=_['pick'](_0x46514b,attributes);}else{delete _0x58b69f[util['format'](_0x5750('0x13'),_0x4da250)][_0x2b8099];}emit(util[_0x5750('0x12')](_0x5750('0x14'),_0x4da250,_0x3fcf74),util[_0x5750('0x12')](_0x5750('0x15'),_0x4da250,_0x583c63?'save':_0x5750('0x16')),_[_0x5750('0x17')](_0x46514b,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x5750('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x5750('0x19')),'whatsappQueueReport':require(_0x5750('0x1a'))};var queue=schema({'name':{'type':_0x5750('0x1b'),'required':!![],'message':_0x5750('0x1c')},'timeout':{'type':_0x5750('0x1d'),'message':_0x5750('0x1e')}});function startRouting(_0x4469d6,_0x516a28,_0x2c91ad,_0x179844){if(_0x4469d6&&_0x516a28&&_0x2c91ad){_0x516a28['waiting']+=0x1;var _0x1e8c1c={'uniqueid':_0x4469d6,'from':_0x2c91ad[_0x5750('0x1f')]?_0x2c91ad[_0x5750('0x1f')][_0x5750('0xe')]:'','joinAt':moment()['format'](_0x5750('0x20')),'ContactId':_0x2c91ad['contact']?_0x2c91ad[_0x5750('0x21')]['id']:null,'ListId':_0x2c91ad[_0x5750('0x22')]?_0x2c91ad[_0x5750('0x22')]['id']:null};_0x1e8c1c[_[_0x5750('0x23')](_0x2c91ad[_0x5750('0x24')])+_0x5750('0x25')]=_0x516a28['id']||null;_0x1e8c1c[_[_0x5750('0x23')](_0x2c91ad['channel'])+_0x5750('0x26')]=_0x2c91ad[_0x5750('0x27')]?_0x2c91ad[_0x5750('0x27')]['id']:null;_0x1e8c1c[_[_0x5750('0x23')](_0x2c91ad[_0x5750('0x24')])+_0x5750('0x28')]=_0x2c91ad[_0x5750('0x29')]?_0x2c91ad[_0x5750('0x29')]['id']:null;_0x1e8c1c[_[_0x5750('0x23')](_0x2c91ad[_0x5750('0x24')])+(_0x2c91ad[_0x5750('0x24')]!==_0x5750('0x2a')?_0x5750('0x2b'):_0x5750('0x2c'))]=_0x2c91ad[_0x5750('0xc')]?_0x2c91ad[_0x5750('0xc')]['id']:null;logger['info'](util['format'](_0x5750('0x2d'),_0x4469d6,_0x516a28[_0x5750('0x2e')]));emitChannelQueueInteraction(_0x2c91ad['channel'],_0x516a28[_0x5750('0x2e')],_0x1e8c1c,_0x2c91ad[_0x5750('0xc')][_0x5750('0x2e')],_0x2c91ad[_0x5750('0x29')]['id'],!![],_0x179844,_0x516a28['id']);if(rpc[_0x2c91ad[_0x5750('0x24')]+'QueueReport']){return rpc[_0x2c91ad['channel']+_0x5750('0x2f')][_0x5750('0x30')](_0x1e8c1c)['catch'](function(_0x1fb14c){logger[_0x5750('0x31')](_0x5750('0x32'));});}}}function stopRouting(_0x42ee90,_0x11acf3,_0x5240fc,_0x4c09ab){if(_0x42ee90&&_0x11acf3){_0x11acf3[_0x5750('0x33')]-=0x1;var _0xc602b2={'leaveAt':moment()[_0x5750('0x12')](_0x5750('0x20')),'acceptAt':moment()['format'](_0x5750('0x20')),'reason':_0x5750('0x34')};logger['info'](util['format'](_0x5750('0x35'),_0x42ee90,_0x11acf3[_0x5750('0x2e')]));emitChannelQueueInteraction(_0x5240fc[_0x5750('0x24')],_0x11acf3['name'],_0x5240fc[_0x5750('0x1f')],_0x5240fc[_0x5750('0xc')][_0x5750('0x2e')],_0x5240fc['message']['id'],![],_0x4c09ab,_0x11acf3['id']);if(rpc[_0x5240fc[_0x5750('0x24')]+_0x5750('0x2f')]){return rpc[_0x5240fc[_0x5750('0x24')]+_0x5750('0x2f')][_0x5750('0x36')](_0x42ee90,_0xc602b2)[_0x5750('0x37')](function(_0x1652bf){logger['error'](_0x5750('0x38'));});}}}function endRouting(_0x2dde8e,_0x51bb32,_0x3978fc,_0x4ee4b6){if(_0x2dde8e&&_0x51bb32){_0x51bb32[_0x5750('0x33')]-=0x1;var _0x31126c={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x5750('0x12')](_0x5750('0x20')),'reason':_0x5750('0x39')};logger[_0x5750('0x3a')](util['format'](_0x5750('0x3b'),_0x2dde8e,_0x51bb32[_0x5750('0x2e')]));emitChannelQueueInteraction(_0x3978fc[_0x5750('0x24')],_0x51bb32[_0x5750('0x2e')],_0x3978fc[_0x5750('0x1f')],_0x3978fc[_0x5750('0xc')][_0x5750('0x2e')],_0x3978fc[_0x5750('0x29')]['id'],![],_0x4ee4b6);if(rpc[_0x3978fc[_0x5750('0x24')]+_0x5750('0x2f')]){return rpc[_0x3978fc[_0x5750('0x24')]+'QueueReport'][_0x5750('0x36')](_0x2dde8e,_0x31126c)[_0x5750('0x37')](function(_0xefc110){logger[_0x5750('0x31')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x2e5e92){return function(_0x597b23){return _0x597b23[_0x5750('0x2e')][_0x5750('0x3c')]()===_0x2e5e92[_0x5750('0x3c')]();};}exports[_0x5750('0x3d')]=function(_0x38cf5b,_0x104038,_0x581067,_0x4b0e7f){return function(_0x2647cf){try{var _0x401804={'name':_0x104038[0x0],'timeout':_0x104038[0x1]};var _0x790abf=queue[_0x5750('0x0')](_0x401804,{'typecast':!![]});if(_0x790abf[_0x5750('0x3e')]){logger['error'](_0x5750('0x3f'),_0x38cf5b,_['map'](_0x790abf,_0x5750('0x29'))[_0x5750('0x40')](',\x20'));_0x2647cf[_0x5750('0x41')]();}else{var _0x54d68a=_[_0x5750('0x42')](_0x581067[_0x4b0e7f[_0x5750('0x24')]+_0x5750('0x43')],handleFindQueue(_0x401804[_0x5750('0x2e')]));if(_0x54d68a){startRouting(_0x38cf5b,_0x54d68a,_0x4b0e7f,_0x581067);var _0x3ff56b=(_0x54d68a[_0x5750('0x39')]||0xa)*0x3e8;var _0x5153b9=(_0x401804[_0x5750('0x39')]||0x14)*0x3e8;var _0x1385e5,_0x143789;if(_0x3ff56b>_0x5153b9){_0x5153b9=_0x3ff56b;}var _0x3c7b0e=seqqueue[_0x5750('0x44')](_0x3ff56b);_0x3c7b0e['id']=_0x38cf5b;_0x3c7b0e[_0x5750('0x45')]=_0x3ff56b;_0x3c7b0e['qtimeout']=_0x5153b9;_0x3c7b0e[_0x5750('0x24')]=_0x4b0e7f[_0x5750('0x24')];_0x581067['rules'][_0x38cf5b]['on'](_0x5750('0x46'),function(){logger[_0x5750('0x3a')](_0x5750('0x47'),_0x38cf5b);stopRouting(_0x38cf5b,_0x54d68a,_0x4b0e7f,_0x581067);clearTimeout(_0x1385e5);_0x1385e5=undefined;_0x3c7b0e[_0x5750('0x48')](!![]);if(_0x581067[_0x5750('0x49')][_0x38cf5b]){delete _0x581067['rules'][_0x38cf5b];}_0x2647cf['stop']();});_0x581067[_0x5750('0x49')][_0x38cf5b]['on'](_0x5750('0x4a'),function(){if(_0x581067[_0x5750('0x49')][_0x38cf5b]){delete _0x581067[_0x5750('0x49')][_0x38cf5b];}});_0x1385e5=setTimeout(function(){logger[_0x5750('0x3a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x38cf5b);endRouting(_0x38cf5b,_0x54d68a,_0x4b0e7f,_0x581067);clearTimeout(_0x1385e5);_0x3c7b0e['close'](!![]);_0x2647cf[_0x5750('0x4b')]();},_0x5153b9);switch(_0x54d68a['strategy']){case'rrmemory':strategy['rrmemory'](_0x3c7b0e,_0x54d68a,_0x581067,_0x4b0e7f);break;default:strategy[_0x5750('0x4c')](_0x3c7b0e,_0x54d68a,_0x581067,_0x4b0e7f);}}else{logger[_0x5750('0x31')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x38cf5b,_0x401804[_0x5750('0x2e')]);_0x2647cf[_0x5750('0x41')]();}}}catch(_0x3358ab){console['log'](_0x3358ab);logger[_0x5750('0x31')](_0x5750('0x3f'),_0x38cf5b,_0x3358ab[_0x5750('0x4d')]);_0x2647cf[_0x5750('0x41')]();}};}; \ 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 dfa2459..5b389d3 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 _0x1812=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','agents','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','prototype'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1812,0xb5));var _0x2181=function(_0x41b934,_0x23518a){_0x41b934=_0x41b934-0x0;var _0x10c248=_0x1812[_0x41b934];return _0x10c248;};'use strict';var _=require(_0x2181('0x0'));var uuid=require(_0x2181('0x1'));var util=require(_0x2181('0x2'));var logger=require(_0x2181('0x3'))(_0x2181('0x4'));var Agent=function(_0x409ca4,_0x3e7019,_0xba10ae,_0x5d5591){this[_0x2181('0x5')]=uuid['v4']();this[_0x2181('0x6')]=_0x409ca4;this['agent']=_0x3e7019;this['realtime']=_0xba10ae;this[_0x2181('0x4')]=_0x5d5591;this['squeue'][_0x2181('0x7')](this[_0x2181('0x8')][_0x2181('0x9')](this),this[_0x2181('0xa')][_0x2181('0x9')](this));this['squeue']['on'](_0x2181('0xb'),this[_0x2181('0xa')]['bind'](this));this[_0x2181('0x6')]['on']('drained',this[_0x2181('0xc')][_0x2181('0x9')](this));};Agent['prototype'][_0x2181('0x7')]=function(){this[_0x2181('0x6')][_0x2181('0x7')](this[_0x2181('0x8')][_0x2181('0x9')](this),this[_0x2181('0xa')][_0x2181('0x9')](this));};Agent['prototype'][_0x2181('0xc')]=function(){this[_0x2181('0xa')](!![]);};Agent['prototype'][_0x2181('0x8')]=function(){logger[_0x2181('0xd')](_0x2181('0xe'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);if(_[_0x2181('0x10')](this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']])){logger[_0x2181('0xd')](_0x2181('0x12'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);setTimeout(this[_0x2181('0x7')][_0x2181('0x9')](this),0x3e8);}else{if(this[_0x2181('0x4')][_0x2181('0x13')]||util['isAgentAvailable'](this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],this[_0x2181('0x6')][_0x2181('0x14')],![])){this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x16')]=!![];this[_0x2181('0x11')][_0x2181('0x15')][this['agent']['id']][_0x2181('0x17')]=undefined;util[_0x2181('0x18')](this[_0x2181('0x5')],this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],null,this['routing']);util['writeLog'](this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],_0x2181('0x19')+(this[_0x2181('0x4')][_0x2181('0x13')]?_0x2181('0x1a'):''));}else{logger[_0x2181('0xd')](_0x2181('0x1b'),this[_0x2181('0x6')]['id'],this[_0x2181('0xf')]['id']);setTimeout(this[_0x2181('0x7')][_0x2181('0x9')](this),0x3e8);}}};Agent[_0x2181('0x1c')][_0x2181('0xa')]=function(_0xd36a98){if(_[_0x2181('0x10')](this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']])){return logger[_0x2181('0xd')](_0x2181('0x12'),this['squeue']['id'],this[_0x2181('0xf')]['id']);}else{logger[_0x2181('0xd')](_0x2181('0x1d'),this[_0x2181('0x6')]['id'],this['agent']['id']);util[_0x2181('0x1e')](this[_0x2181('0x5')],this[_0x2181('0x6')]['id'],this[_0x2181('0x11')]['agents'][this[_0x2181('0xf')]['id']],null,this[_0x2181('0x4')]);this['realtime'][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x16')]=![];this[_0x2181('0x11')][_0x2181('0x15')][this[_0x2181('0xf')]['id']][_0x2181('0x17')]=undefined;util[_0x2181('0x1f')](this[_0x2181('0x6')]['id'],this['realtime']['agents'][this[_0x2181('0xf')]['id']],_0xd36a98?_0x2181('0x20'):_0x2181('0x21'));}if(!_0xd36a98){setTimeout(this['push'][_0x2181('0x9')](this),0x3e8);}};function agent(_0x28ddaa,_0x33ccaa,_0x340943,_0x1a6bb1){return new Agent(_0x28ddaa,_0x33ccaa,_0x340943,_0x1a6bb1);}module[_0x2181('0x22')]=agent; \ No newline at end of file +var _0xabb3=['prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xabb3,0x1d2));var _0x3abb=function(_0x4bd181,_0x1175d8){_0x4bd181=_0x4bd181-0x0;var _0x1ca876=_0xabb3[_0x4bd181];return _0x1ca876;};'use strict';var _=require(_0x3abb('0x0'));var uuid=require('uuid');var util=require(_0x3abb('0x1'));var logger=require(_0x3abb('0x2'))(_0x3abb('0x3'));var Agent=function(_0x4ad414,_0x122944,_0x221265,_0xfc65f7){this[_0x3abb('0x4')]=uuid['v4']();this[_0x3abb('0x5')]=_0x4ad414;this[_0x3abb('0x6')]=_0x122944;this[_0x3abb('0x7')]=_0x221265;this[_0x3abb('0x3')]=_0xfc65f7;this[_0x3abb('0x5')][_0x3abb('0x8')](this[_0x3abb('0x9')][_0x3abb('0xa')](this),this[_0x3abb('0xb')][_0x3abb('0xa')](this));this['squeue']['on']('timeout',this['handleTimeout']['bind'](this));this['squeue']['on'](_0x3abb('0xc'),this[_0x3abb('0xd')][_0x3abb('0xa')](this));};Agent['prototype'][_0x3abb('0x8')]=function(){this[_0x3abb('0x5')]['push'](this[_0x3abb('0x9')]['bind'](this),this[_0x3abb('0xb')][_0x3abb('0xa')](this));};Agent[_0x3abb('0xe')][_0x3abb('0xd')]=function(){this[_0x3abb('0xb')](!![]);};Agent[_0x3abb('0xe')][_0x3abb('0x9')]=function(){logger[_0x3abb('0xf')](_0x3abb('0x10'),this[_0x3abb('0x5')]['id'],this[_0x3abb('0x6')]['id']);if(_[_0x3abb('0x11')](this[_0x3abb('0x7')][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']])){logger['debug'](_0x3abb('0x13'),this[_0x3abb('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x3abb('0x8')][_0x3abb('0xa')](this),0x3e8);}else{if(this[_0x3abb('0x3')][_0x3abb('0x14')]||util['isAgentAvailable'](this[_0x3abb('0x5')]['id'],this[_0x3abb('0x7')][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']],this['squeue'][_0x3abb('0x15')],![])){this[_0x3abb('0x7')][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']]['busy']=!![];this[_0x3abb('0x7')][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']][_0x3abb('0x16')]=undefined;util[_0x3abb('0x17')](this[_0x3abb('0x4')],this[_0x3abb('0x5')]['id'],this['realtime'][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']],null,this[_0x3abb('0x3')]);util['writeLog'](this[_0x3abb('0x5')]['id'],this[_0x3abb('0x7')][_0x3abb('0x12')][this[_0x3abb('0x6')]['id']],'RINGING'+(this[_0x3abb('0x3')][_0x3abb('0x14')]?':FORCED':''));}else{logger[_0x3abb('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x3abb('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x3abb('0x8')][_0x3abb('0xa')](this),0x3e8);}}};Agent[_0x3abb('0xe')][_0x3abb('0xb')]=function(_0x15af0c){if(_[_0x3abb('0x11')](this['realtime']['agents'][this[_0x3abb('0x6')]['id']])){return logger[_0x3abb('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3abb('0x5')]['id'],this[_0x3abb('0x6')]['id']);}else{logger[_0x3abb('0xf')](_0x3abb('0x18'),this['squeue']['id'],this[_0x3abb('0x6')]['id']);util[_0x3abb('0x19')](this[_0x3abb('0x4')],this[_0x3abb('0x5')]['id'],this[_0x3abb('0x7')][_0x3abb('0x12')][this['agent']['id']],null,this[_0x3abb('0x3')]);this[_0x3abb('0x7')]['agents'][this['agent']['id']][_0x3abb('0x1a')]=![];this['realtime']['agents'][this[_0x3abb('0x6')]['id']][_0x3abb('0x16')]=undefined;util['writeLog'](this[_0x3abb('0x5')]['id'],this[_0x3abb('0x7')]['agents'][this[_0x3abb('0x6')]['id']],_0x15af0c?_0x3abb('0x1b'):_0x3abb('0x1c'));}if(!_0x15af0c){setTimeout(this[_0x3abb('0x8')]['bind'](this),0x3e8);}};function agent(_0x17a0ee,_0x4cc6dc,_0x2d566f,_0x441040){return new Agent(_0x17a0ee,_0x4cc6dc,_0x2d566f,_0x441040);}module[_0x3abb('0x1d')]=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 59ef1d2..ce41ffd 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 _0x7af2=['TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','push','hideNotification'];(function(_0x47fc2f,_0x3fbd04){var _0x5b79b=function(_0x494db5){while(--_0x494db5){_0x47fc2f['push'](_0x47fc2f['shift']());}};_0x5b79b(++_0x3fbd04);}(_0x7af2,0x119));var _0x27af=function(_0x57909e,_0x26084f){_0x57909e=_0x57909e-0x0;var _0x21d6cc=_0x7af2[_0x57909e];return _0x21d6cc;};'use strict';var _=require('lodash');var uuid=require(_0x27af('0x0'));var util=require(_0x27af('0x1'));var logger=require(_0x27af('0x2'))(_0x27af('0x3'));var Beepall=function(_0x4baeb8,_0x8556d,_0x1067e7,_0x709cb6){this[_0x27af('0x4')]=uuid['v4']();this[_0x27af('0x5')]=_0x4baeb8;this[_0x27af('0x6')]=_0x8556d;this[_0x27af('0x7')]=_0x1067e7;this[_0x27af('0x3')]=_0x709cb6;this[_0x27af('0x5')]['push'](this[_0x27af('0x8')][_0x27af('0x9')](this),this[_0x27af('0xa')]['bind'](this));this[_0x27af('0x5')]['on'](_0x27af('0xb'),this[_0x27af('0xa')]['bind'](this));this[_0x27af('0x5')]['on']('drained',this['handleDrained'][_0x27af('0x9')](this));};Beepall['prototype']['push']=function(){this[_0x27af('0x5')]['push'](this[_0x27af('0x8')]['bind'](this),this[_0x27af('0xa')][_0x27af('0x9')](this));};Beepall[_0x27af('0xc')][_0x27af('0xd')]=function(){this[_0x27af('0xa')](!![]);};Beepall[_0x27af('0xc')][_0x27af('0x8')]=function(){var _0x3da435=!![];if(!_[_0x27af('0xe')](this[_0x27af('0x6')])&&!_[_0x27af('0xe')](this[_0x27af('0x6')][_0x27af('0xf')])&&this[_0x27af('0x6')][_0x27af('0xf')][_0x27af('0x10')]>0x0){for(var _0x13f8ed=0x0,_0xbcf794;_0x13f8ed0x0){for(var _0xab5013=0x0,_0x3428e6;_0xab50130x0&&_0x2c7dd1[_0x4d55e5+_0xdfdb('0x28')]>=_0x2c7dd1[_0x4d55e5+_0xdfdb('0x27')]){writeLog(_0x397f7c,_0x2c7dd1,_0x4d55e5[_0xdfdb('0x29')]()+_0xdfdb('0x2a'));return![];}}return!![];};exports[_0xdfdb('0x2b')]=function(_0x57d24f,_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057){return sendNotification(!![],_0x57d24f,_0xec4d22,_0x2d5fe2,_0xdf3a5c,_0x4f8057);};exports[_0xdfdb('0x2c')]=function(_0x5df454,_0xd0cef0,_0x1aec66,_0x19c36f,_0x513fa0){return sendNotification(![],_0x5df454,_0xd0cef0,_0x1aec66,_0x19c36f,_0x513fa0);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x2bd8=['OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:save','split','name','account','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online'];(function(_0x4bfb8b,_0x38c37d){var _0x33b03e=function(_0x1be3fb){while(--_0x1be3fb){_0x4bfb8b['push'](_0x4bfb8b['shift']());}};_0x33b03e(++_0x38c37d);}(_0x2bd8,0x130));var _0x82bd=function(_0x5ae9e4,_0x9b7e3){_0x5ae9e4=_0x5ae9e4-0x0;var _0x1df6c1=_0x2bd8[_0x5ae9e4];return _0x1df6c1;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var utils=require(_0x82bd('0x1'));var Redis=require(_0x82bd('0x2'));var config=require(_0x82bd('0x3'));var logger=require(_0x82bd('0x4'))(_0x82bd('0x5'));config[_0x82bd('0x6')]=_[_0x82bd('0x7')](config['redis'],{'host':_0x82bd('0x8'),'port':0x18eb});var io=require(_0x82bd('0x9'))(new Redis(config[_0x82bd('0x6')]));function sendNotification(_0x5ceb60,_0x19dbb1,_0x77d7a9,_0x226f60,_0x1f7463,_0x4dc3a6){io['to'](util[_0x82bd('0xa')]('user:%s',_0x226f60['name']))['emit'](_0x82bd('0xb'),_0x226f60);var _0x5f0434=_0x4dc3a6||{};var _0x4c9430=_0x77d7a9[_0x82bd('0xc')]('.');var _0x5f3959={'uniqueid':_0x19dbb1,'channel':_0x4c9430[0x0],'id':_0x4c9430[0x1],'title':_0x4c9430[0x0]+'\x20interaction','interactionId':_0x4c9430[0x2],'queue':_0x1f7463?_0x1f7463[_0x82bd('0xd')]:null,'sound':_0x5f0434[_0x82bd('0xe')]['notificationSound'],'shake':_0x5f0434[_0x82bd('0xe')]['notificationShake']};try{if(!_0x5f0434[_0x82bd('0xf')]){_0x5f0434['body']={};}if(_0x1f7463){_0x5f0434[_0x82bd('0xf')][_0x82bd('0x10')]=_0x1f7463;}else if(_0x5f0434[_0x82bd('0xf')][_0x82bd('0x10')]){delete _0x5f0434['body'][_0x82bd('0x10')];}_0x5f3959[_0x82bd('0x11')]=utils['getMustacheRender'](_0x5f0434[_0x82bd('0xe')]['notificationTemplate'],_0x5f0434);}catch(_0x35dd09){_0x5f3959[_0x82bd('0x11')]=_0x82bd('0x12');logger[_0x82bd('0x13')](util[_0x82bd('0xa')](_0x82bd('0x14'),_0x19dbb1,_0x35dd09[_0x82bd('0x15')]));}io['to'](util[_0x82bd('0xa')](_0x82bd('0x16'),_0x226f60[_0x82bd('0xd')]))[_0x82bd('0x17')](util[_0x82bd('0xa')](_0x82bd('0x18'),_0x5ceb60?_0x82bd('0x19'):'remove'),_0x5f3959);}function writeLog(_0x5688ed,_0x283ce7,_0x3eb844){return logger[_0x82bd('0x1a')](util[_0x82bd('0xa')](_0x82bd('0x1b'),_0x5688ed,_0x283ce7[_0x82bd('0xd')],_0x3eb844));}exports[_0x82bd('0x1c')]=function(_0x32954d,_0x1fc715,_0x3291cd,_0x2caa29){if(_0x1fc715[_0x82bd('0x1d')]){writeLog(_0x32954d,_0x1fc715,_0x82bd('0x1e'));return![];}if(!_0x1fc715[_0x82bd('0x1f')]){writeLog(_0x32954d,_0x1fc715,_0x82bd('0x20'));return![];}if(_0x1fc715[_0x3291cd+_0x82bd('0x21')]){writeLog(_0x32954d,_0x1fc715,_0x82bd('0x22'));return![];}if(_0x2caa29&&_0x1fc715[_0x82bd('0x23')](_0x3291cd+_0x82bd('0x24'))&&_0x1fc715['hasOwnProperty'](_0x3291cd+'CurrentCapacity')){if(_0x1fc715[_0x3291cd+_0x82bd('0x24')]>0x0&&_0x1fc715[_0x3291cd+_0x82bd('0x25')]>=_0x1fc715[_0x3291cd+_0x82bd('0x24')]){writeLog(_0x32954d,_0x1fc715,_0x3291cd[_0x82bd('0x26')]()+_0x82bd('0x27'));return![];}}return!![];};exports[_0x82bd('0x28')]=function(_0x3c7751,_0xbef23b,_0x2f0bb6,_0x2add80,_0x53a2a6){return sendNotification(!![],_0x3c7751,_0xbef23b,_0x2f0bb6,_0x2add80,_0x53a2a6);};exports['hideNotification']=function(_0x5609b7,_0x5d1015,_0x714d70,_0x52bcd8,_0x351d3d){return sendNotification(![],_0x5609b7,_0x5d1015,_0x714d70,_0x52bcd8,_0x351d3d);};exports[_0x82bd('0x29')]=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 17d36a2..2c86548 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 _0x0fca=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','../../../../config/logger','routing','string','consequence','length','error','[%s][SYSTEM]\x20%s','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty'];(function(_0x541eaa,_0x1b3dd1){var _0x3fe0f5=function(_0x2e28cc){while(--_0x2e28cc){_0x541eaa['push'](_0x541eaa['shift']());}};_0x3fe0f5(++_0x1b3dd1);}(_0x0fca,0x185));var _0xa0fc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fca[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xa0fc('0x0'));var sh=require(_0xa0fc('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require(_0xa0fc('0x2'))(_0xa0fc('0x3'));var system=schema({'command':{'type':_0xa0fc('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa0fc('0x5')]=function(_0x2156b7,_0x5d5f88){return function(_0x3effea){try{var _0x10121c={'command':_0x5d5f88[0x0]};var _0x42b04d=system[_0xa0fc('0x0')](_0x10121c,{'typecast':!![]});if(_0x42b04d[_0xa0fc('0x6')]){logger[_0xa0fc('0x7')](_0xa0fc('0x8'),_0x2156b7,_['map'](_0x42b04d,'message')[_0xa0fc('0x9')](',\x20'));logger[_0xa0fc('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2156b7);_0x3effea[_0xa0fc('0xb')]();}else{var _0x29476f=this;var _0x482f2c=utils['getMustacheRender'](_0x5d5f88[0x0],this);logger[_0xa0fc('0xa')](_0xa0fc('0xc'),_0x2156b7,_0x482f2c);sh[_0xa0fc('0xd')](_[_0xa0fc('0xe')](_0x482f2c),function(_0x692ec1,_0x2d0c32){logger[_0xa0fc('0xa')](_0xa0fc('0xf'),_0x2156b7,_0x692ec1);if(_0x692ec1==0x0){var _0x29a2ca=_0x2d0c32[_0xa0fc('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xa0fc('0x11')](_0x5d5f88[0x1])||_[_0xa0fc('0x12')](_0x5d5f88[0x1])){logger['info'](_0xa0fc('0x13'),_0x2156b7);_0x29476f[_0xa0fc('0x14')][_0x5d5f88[0x1]]=_0x29a2ca;}else{logger[_0xa0fc('0xa')](_0xa0fc('0x15'),_0x2156b7,_0x5d5f88[0x1],_0x29a2ca);_0x29476f[_0xa0fc('0x14')][_0x5d5f88[0x1]]=_0x29a2ca;}}_0x3effea[_0xa0fc('0xb')]();});}}catch(_0x55f921){logger[_0xa0fc('0x7')](_0xa0fc('0x8'),_0x2156b7,_[_0xa0fc('0x16')](_0x55f921)?JSON[_0xa0fc('0x17')](_0x55f921):_0x55f921);logger[_0xa0fc('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2156b7);_0x3effea['next']();}};}; \ No newline at end of file +var _0x60d4=['body','[%s][SYSTEM]\x20%s','isObject','validate','shelljs','lodash','./utils','routing','string','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x60d4,0xa4));var _0x460d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x60d4[_0x4b369d];return _0x571a98;};'use strict';var schema=require(_0x460d('0x0'));var sh=require(_0x460d('0x1'));var _=require(_0x460d('0x2'));var utils=require(_0x460d('0x3'));var logger=require('../../../../config/logger')(_0x460d('0x4'));var system=schema({'command':{'type':_0x460d('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x23b41a,_0x2cfa03){return function(_0x403035){try{var _0x3ab4ae={'command':_0x2cfa03[0x0]};var _0x27e4c3=system['validate'](_0x3ab4ae,{'typecast':!![]});if(_0x27e4c3['length']){logger[_0x460d('0x6')]('[%s][SYSTEM]\x20%s',_0x23b41a,_[_0x460d('0x7')](_0x27e4c3,'message')[_0x460d('0x8')](',\x20'));logger[_0x460d('0x9')](_0x460d('0xa'),_0x23b41a);_0x403035[_0x460d('0xb')]();}else{var _0x5d25af=this;var _0x5ce0ac=utils[_0x460d('0xc')](_0x2cfa03[0x0],this);logger[_0x460d('0x9')](_0x460d('0xd'),_0x23b41a,_0x5ce0ac);sh['exec'](_[_0x460d('0xe')](_0x5ce0ac),function(_0x139afc,_0x2ccce3){logger[_0x460d('0x9')](_0x460d('0xf'),_0x23b41a,_0x139afc);if(_0x139afc==0x0){var _0xa3071c=_0x2ccce3[_0x460d('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x460d('0x11')](_0x2cfa03[0x1])||_[_0x460d('0x12')](_0x2cfa03[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x23b41a);_0x5d25af['body'][_0x2cfa03[0x1]]=_0xa3071c;}else{logger[_0x460d('0x9')](_0x460d('0x13'),_0x23b41a,_0x2cfa03[0x1],_0xa3071c);_0x5d25af[_0x460d('0x14')][_0x2cfa03[0x1]]=_0xa3071c;}}_0x403035['next']();});}}catch(_0x100fa0){logger[_0x460d('0x6')](_0x460d('0x15'),_0x23b41a,_[_0x460d('0x16')](_0x100fa0)?JSON['stringify'](_0x100fa0):_0x100fa0);logger[_0x460d('0x9')](_0x460d('0xa'),_0x23b41a);_0x403035['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 03209d8..a4124b2 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 _0xcb7f=['info','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','error','stringify','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','message','join'];(function(_0x36743b,_0x41426a){var _0xc6db05=function(_0xa1afe5){while(--_0xa1afe5){_0x36743b['push'](_0x36743b['shift']());}};_0xc6db05(++_0x41426a);}(_0xcb7f,0x1cd));var _0xfcb7=function(_0x4ff3a0,_0x2f6a18){_0x4ff3a0=_0x4ff3a0-0x0;var _0x2592a8=_0xcb7f[_0x4ff3a0];return _0x2592a8;};'use strict';var schema=require(_0xfcb7('0x0'));var _=require(_0xfcb7('0x1'));var rpc={'chatInteraction':require(_0xfcb7('0x2')),'openchannelInteraction':require(_0xfcb7('0x3')),'smsInteraction':require(_0xfcb7('0x4')),'mailInteraction':require(_0xfcb7('0x5')),'faxInteraction':require(_0xfcb7('0x6')),'whatsappInteraction':require(_0xfcb7('0x7'))};var logger=require(_0xfcb7('0x8'))(_0xfcb7('0x9'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xfcb7('0xa')}});exports[_0xfcb7('0xb')]=function(_0x9ee710,_0x77be41,_0x59af06,_0x2dd0a1){return function(_0x52ea13){try{var _0x1ac920={'tag':_0x77be41[0x0]};var _0x17a4ea=tag['validate'](_0x1ac920,{'typecast':!![]});if(_0x17a4ea['length']){logger['error']('[%s][TAG]\x20%s',_0x9ee710,_['map'](_0x17a4ea,_0xfcb7('0xc'))[_0xfcb7('0xd')](',\x20'));logger[_0xfcb7('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9ee710);_0x52ea13[_0xfcb7('0xf')]();}else{var _0x43e23e={'ids':[_0x77be41[0x0]]};if(rpc[_0x2dd0a1[_0xfcb7('0x10')]+_0xfcb7('0x11')]){rpc[_0x2dd0a1[_0xfcb7('0x10')]+_0xfcb7('0x11')][_0xfcb7('0x12')](_0x2dd0a1['interaction']['id'],_0x43e23e)['then'](function(_0xa0718e){logger[_0xfcb7('0xe')](_0xfcb7('0x13'),_0x9ee710,_0x77be41[0x1],_0x2dd0a1[_0xfcb7('0x10')],_0x2dd0a1[_0xfcb7('0x14')]['id']);})['catch'](function(_0x3cef88){logger[_0xfcb7('0x15')]('[%s][TAG]\x20%s',_0x9ee710,JSON[_0xfcb7('0x16')](_0x3cef88));logger[_0xfcb7('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x9ee710);})['finally'](function(){_0x52ea13[_0xfcb7('0xf')]();});}}}catch(_0x4175f9){logger['error']('[%s][TAG]\x20%s',_0x9ee710,_[_0xfcb7('0x17')](_0x4175f9)?JSON[_0xfcb7('0x16')](_0x4175f9):_0x4175f9);logger[_0xfcb7('0xe')](_0xfcb7('0x18'),_0x9ee710);_0x52ea13[_0xfcb7('0xf')]();}};}; \ No newline at end of file +var _0x48fd=['map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s'];(function(_0x49d168,_0x145c84){var _0x1f6e43=function(_0x59d93e){while(--_0x59d93e){_0x49d168['push'](_0x49d168['shift']());}};_0x1f6e43(++_0x145c84);}(_0x48fd,0x1a4));var _0xd48f=function(_0x4ea90e,_0x197739){_0x4ea90e=_0x4ea90e-0x0;var _0x570f4f=_0x48fd[_0x4ea90e];return _0x570f4f;};'use strict';var schema=require(_0xd48f('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xd48f('0x1')),'openchannelInteraction':require(_0xd48f('0x2')),'smsInteraction':require(_0xd48f('0x3')),'mailInteraction':require(_0xd48f('0x4')),'faxInteraction':require(_0xd48f('0x5')),'whatsappInteraction':require(_0xd48f('0x6'))};var logger=require(_0xd48f('0x7'))('routing');var tag=schema({'tag':{'type':_0xd48f('0x8'),'required':!![],'message':_0xd48f('0x9')}});exports['consequence']=function(_0x3b71d7,_0xe12eb3,_0x2c5234,_0x4e45a9){return function(_0x1a677c){try{var _0xaed731={'tag':_0xe12eb3[0x0]};var _0x229eef=tag[_0xd48f('0x0')](_0xaed731,{'typecast':!![]});if(_0x229eef['length']){logger[_0xd48f('0xa')](_0xd48f('0xb'),_0x3b71d7,_[_0xd48f('0xc')](_0x229eef,'message')[_0xd48f('0xd')](',\x20'));logger[_0xd48f('0xe')](_0xd48f('0xf'),_0x3b71d7);_0x1a677c[_0xd48f('0x10')]();}else{var _0x49b185={'ids':[_0xe12eb3[0x0]]};if(rpc[_0x4e45a9[_0xd48f('0x11')]+'Interaction']){rpc[_0x4e45a9[_0xd48f('0x11')]+_0xd48f('0x12')]['addTags'](_0x4e45a9[_0xd48f('0x13')]['id'],_0x49b185)[_0xd48f('0x14')](function(_0x99d759){logger[_0xd48f('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3b71d7,_0xe12eb3[0x1],_0x4e45a9[_0xd48f('0x11')],_0x4e45a9['interaction']['id']);})['catch'](function(_0x16fdcd){logger[_0xd48f('0xa')](_0xd48f('0xb'),_0x3b71d7,JSON[_0xd48f('0x15')](_0x16fdcd));logger['info'](_0xd48f('0xf'),_0x3b71d7);})[_0xd48f('0x16')](function(){_0x1a677c[_0xd48f('0x10')]();});}}}catch(_0x213b93){logger[_0xd48f('0xa')]('[%s][TAG]\x20%s',_0x3b71d7,_[_0xd48f('0x17')](_0x213b93)?JSON[_0xd48f('0x15')](_0x213b93):_0x213b93);logger['info'](_0xd48f('0xf'),_0x3b71d7);_0x1a677c[_0xd48f('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 954b551..85f8131 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 _0xcce4=['jsonrpc','2.0','method','login','push','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&data=','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','urlOnAnswer','?params=','urlOnRing','title'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xcce4,0x11f));var _0x4cce=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xcce4[_0x3f7598];return _0x51fb16;};'use strict';var rp=require(_0x4cce('0x0'));var logger=require(_0x4cce('0x1'))(_0x4cce('0x2'));var _=require(_0x4cce('0x3'));var arr=[];exports['consequence']=function(_0x13d01e,_0xde1cc8){return function(_0xd67b94){var _0x5b7a73=_0xde1cc8[0xa];var _0x3f3e96=_0xde1cc8[0xb];var _0x8fc519=_0xde1cc8[0xc];var _0x360a18=_0xde1cc8[0xd];var _0x3df8b4=_0xde1cc8[0xe];var _0x3bab0d=_0xde1cc8[0xf][_0x4cce('0x4')](/\n/g,_0x4cce('0x5'));var _0x2ba004=_0xde1cc8[0x10][_0x4cce('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x3f3e96)){arr['push'](_0x3f3e96);var _0x391915=_0xde1cc8[0x3];var _0xdc12c6=_0xde1cc8[0x4];var _0x3f1dce=_0xde1cc8[0x1];var _0x348cba=_0xde1cc8[0x0];var _0x12c6ac={};_0x12c6ac[_0x4cce('0x6')]=_0xde1cc8[0x8]+_0x4cce('0x7')+_0x8fc519+'|'+_0x5b7a73+'|'+_0x360a18+'|'+_0x3f3e96+'|'+_0x3df8b4;_0x12c6ac[_0x4cce('0x8')]=_0xde1cc8[0x7]+_0x4cce('0x7')+_0x8fc519+'|'+_0x5b7a73+'|'+_0x360a18+'|'+_0x3f3e96+'|'+_0x3df8b4+'|'+_0x3bab0d+'|'+_0x2ba004;_0x12c6ac[_0x4cce('0x9')]=_0xde1cc8[0x9];var _0x5608a3={};_0x5608a3[_0x4cce('0xa')]=_0x4cce('0xb');_0x5608a3[_0x4cce('0xc')]=_0x4cce('0xd');var _0x3939d5=[];_0x3939d5[_0x4cce('0xe')](_0xde1cc8[0x2]);_0x3939d5[_0x4cce('0xe')](_0xde1cc8[0x5]);_0x3939d5['push'](_0xde1cc8[0x6]);_0x5608a3[_0x4cce('0xf')]=_0x3939d5;_0x5608a3['id']=0x1;var _0x57c887=JSON[_0x4cce('0x10')](_0x5608a3);var _0x2f7f6d={'encoding':_0x4cce('0x11'),'method':_0x4cce('0x12'),'timeout':0x2710,'url':_0x391915,'headers':{'Content-Type':'application/json-rpc'},'body':_0x57c887};return rp(_0x2f7f6d)[_0x4cce('0x13')](function(_0x1b3ca9){const _0x1f9de8=JSON[_0x4cce('0x14')](_0x1b3ca9);if(!_0x1f9de8[_0x4cce('0x15')][_0x4cce('0x16')]){throw new Error(_0x4cce('0x17'));}var _0x3dc5e8=_0x3f3e96;var _0x5c67d0=_0x4cce('0x18')+_0x3f1dce+'&serviceId='+_0x348cba+'&sessionId='+_0x3dc5e8+_0x4cce('0x19')+JSON[_0x4cce('0x10')](_0x12c6ac);var _0x441ab5=_0xdc12c6+'?'+_0x5c67d0;return rp(_0x441ab5);})[_0x4cce('0x13')](function(_0x523a6f){logger[_0x4cce('0x1a')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x13d01e,_0x523a6f);_0xd67b94[_0x4cce('0x1b')]();})[_0x4cce('0x1c')](function(_0x3e5ea5){logger[_0x4cce('0x1d')](_0x4cce('0x1e'),_0x13d01e,_[_0x4cce('0x1f')](_0x3e5ea5)?JSON[_0x4cce('0x10')](_0x3e5ea5):_0x3e5ea5);_0xd67b94[_0x4cce('0x1b')]();});}else{logger[_0x4cce('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x13d01e);_0xd67b94[_0x4cce('0x20')]();}};}; \ No newline at end of file +var _0xab8c=['catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','channelId=','&serviceId=','&sessionId=','&data=','info','stop'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0xab8c,0x6e));var _0xcab8=function(_0x412694,_0xcdb2d0){_0x412694=_0x412694-0x0;var _0xe0008b=_0xab8c[_0x412694];return _0xe0008b;};'use strict';var rp=require(_0xcab8('0x0'));var logger=require(_0xcab8('0x1'))(_0xcab8('0x2'));var _=require(_0xcab8('0x3'));var arr=[];exports[_0xcab8('0x4')]=function(_0x39ae4c,_0x7e30d3){return function(_0xa5a37a){var _0x558e60=_0x7e30d3[0xa];var _0x130e9e=_0x7e30d3[0xb];var _0x74b87d=_0x7e30d3[0xc];var _0x3002a0=_0x7e30d3[0xd];var _0x276105=_0x7e30d3[0xe];var _0x4fee97=_0x7e30d3[0xf][_0xcab8('0x5')](/\n/g,_0xcab8('0x6'));var _0x2692ac=_0x7e30d3[0x10][_0xcab8('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x130e9e)){arr[_0xcab8('0x7')](_0x130e9e);var _0x161e1b=_0x7e30d3[0x3];var _0x42aa96=_0x7e30d3[0x4];var _0x533a9f=_0x7e30d3[0x1];var _0x573bad=_0x7e30d3[0x0];var _0x5ee869={};_0x5ee869[_0xcab8('0x8')]=_0x7e30d3[0x8]+_0xcab8('0x9')+_0x74b87d+'|'+_0x558e60+'|'+_0x3002a0+'|'+_0x130e9e+'|'+_0x276105;_0x5ee869[_0xcab8('0xa')]=_0x7e30d3[0x7]+'?params='+_0x74b87d+'|'+_0x558e60+'|'+_0x3002a0+'|'+_0x130e9e+'|'+_0x276105+'|'+_0x4fee97+'|'+_0x2692ac;_0x5ee869[_0xcab8('0xb')]=_0x7e30d3[0x9];var _0x4effca={};_0x4effca[_0xcab8('0xc')]=_0xcab8('0xd');_0x4effca[_0xcab8('0xe')]=_0xcab8('0xf');var _0x47bf11=[];_0x47bf11[_0xcab8('0x7')](_0x7e30d3[0x2]);_0x47bf11[_0xcab8('0x7')](_0x7e30d3[0x5]);_0x47bf11[_0xcab8('0x7')](_0x7e30d3[0x6]);_0x4effca[_0xcab8('0x10')]=_0x47bf11;_0x4effca['id']=0x1;var _0x4b6e28=JSON[_0xcab8('0x11')](_0x4effca);var _0x490694={'encoding':_0xcab8('0x12'),'method':_0xcab8('0x13'),'timeout':0x2710,'url':_0x161e1b,'headers':{'Content-Type':_0xcab8('0x14')},'body':_0x4b6e28};return rp(_0x490694)[_0xcab8('0x15')](function(_0x4576dd){const _0x4845d1=JSON[_0xcab8('0x16')](_0x4576dd);if(!_0x4845d1[_0xcab8('0x17')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x14821d=_0x130e9e;var _0x3c84ae=_0xcab8('0x18')+_0x533a9f+_0xcab8('0x19')+_0x573bad+_0xcab8('0x1a')+_0x14821d+_0xcab8('0x1b')+JSON[_0xcab8('0x11')](_0x5ee869);var _0x1e581c=_0x42aa96+'?'+_0x3c84ae;return rp(_0x1e581c);})['then'](function(_0x2de8f4){logger[_0xcab8('0x1c')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x39ae4c,_0x2de8f4);_0xa5a37a[_0xcab8('0x1d')]();})[_0xcab8('0x1e')](function(_0x3bd827){logger[_0xcab8('0x1f')](_0xcab8('0x20'),_0x39ae4c,_[_0xcab8('0x21')](_0x3bd827)?JSON['stringify'](_0x3bd827):_0x3bd827);_0xa5a37a[_0xcab8('0x1d')]();});}else{logger[_0xcab8('0x1c')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x39ae4c);_0xa5a37a[_0xcab8('0x22')]();}};}; \ 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 4e839fe..b4eaa8e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x4e4ec8,_0x49edfe){var _0x2f4586=function(_0x3c382c){while(--_0x3c382c){_0x4e4ec8['push'](_0x4e4ec8['shift']());}};_0x2f4586(++_0x49edfe);}(_0xe706,0xa3));var _0x6e70=function(_0x27a824,_0x50dc82){_0x27a824=_0x27a824-0x0;var _0x5a1a7b=_0xe706[_0x27a824];return _0x5a1a7b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3ab9e2,_0x221b04){var _0x2c1104=function(_0x553f71){while(--_0x553f71){_0x3ab9e2['push'](_0x3ab9e2['shift']());}};_0x2c1104(++_0x221b04);}(_0xe706,0xa3));var _0x6e70=function(_0x25e3d3,_0x1d2882){_0x25e3d3=_0x25e3d3-0x0;var _0x42ad83=_0xe706[_0x25e3d3];return _0x42ad83;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c220662..7247a10 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 _0x6282=['loggedIn','name','mailQueues','available','waiting','openchannelQueues','paused','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','complete','info','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues'];(function(_0x2f7ecd,_0xcc0ccc){var _0x15d19b=function(_0x3d21fc){while(--_0x3d21fc){_0x2f7ecd['push'](_0x2f7ecd['shift']());}};_0x15d19b(++_0xcc0ccc);}(_0x6282,0x76));var _0x2628=function(_0xf51fbb,_0x66212d){_0xf51fbb=_0xf51fbb-0x0;var _0x2298ee=_0x6282[_0xf51fbb];return _0x2298ee;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var fs=require('fs');var jayson=require(_0x2628('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x2628('0x4'))(_0x2628('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2628('0x6')),'chatQueueReport':require(_0x2628('0x7')),'smsQueueReport':require(_0x2628('0x8')),'faxQueueReport':require(_0x2628('0x9')),'whatsappQueueReport':require(_0x2628('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xb6b945,_0x144ae8,_0x2170a7){return util[_0x2628('0xb')](_0x2628('0xc'),_0xb6b945,_0x144ae8||0x0,_0x2170a7||0x0);}function getIntervals(_0x241628,_0x403569){var _0x1d12a5=[];if(!_[_0x2628('0xd')](_0x403569[_0x2628('0xe')])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]][_0x2628('0xf')])){_0x1d12a5=_['map'](_0x241628[_0x403569['IntervalId']][_0x2628('0xf')],_0x2628('0x10'));}else if(!_[_0x2628('0xd')](_0x403569[_0x2628('0x10')])){_0x1d12a5=[_0x403569['interval']];}return _0x1d12a5;}exports['listen']=function(_0x1081a4){_0x1081a4[_0x2628('0x11')]={};return new BPromise(function(_0x4d2cfb,_0x2395fe){var _0x2f59ca={'Start':function(_0x513aee){var _0x645884=this;return new Promise(function(_0x16e67a,_0x457163){if(_0x513aee){try{var _0x4f418d=[];var _0x13a728=getId(_0x513aee[_0x2628('0x12')],_0x513aee['message']?_0x513aee[_0x2628('0x13')]['id']:0x0,_0x513aee['interaction']?_0x513aee[_0x2628('0x14')]['id']:0x0);if(_0x513aee[_0x2628('0x15')]&&_['isArray'](_0x513aee[_0x2628('0x15')])&&_0x513aee[_0x2628('0x15')]['length']){for(var _0x165824=0x0;_0x165824<_0x513aee['applications'][_0x2628('0x16')];_0x165824+=0x1){var _0x4976ce=_0x513aee['applications'][_0x165824];if(fs[_0x2628('0x17')](path[_0x2628('0x18')](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')))){var _0x1911a2=[];switch(_0x4976ce[_0x2628('0x19')][_0x2628('0x1b')]()){case _0x2628('0x1c'):var _0x57a799=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');if(_0x513aee[_0x2628('0x12')]===_0x2628('0x1f')){_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799[0x1]);_0x1911a2[_0x2628('0x20')](_0x57a799[_0x2628('0x21')](0x2,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}else{_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799['slice'](0x1,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}break;case _0x2628('0x22'):var _0x41c18e=_0x4976ce[_0x2628('0x1d')]['split'](',');_0x1911a2[_0x2628('0x20')](_0x41c18e[0x0]);_0x1911a2[_0x2628('0x20')](_0x41c18e[0x1]);_0x1911a2[_0x2628('0x20')](_0x41c18e[_0x2628('0x21')](0x2,_0x41c18e[_0x2628('0x16')])[_0x2628('0x18')](','));break;case'dialogflowv2':var _0x541eef=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x541eef[0x0]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x1]);_0x1911a2['push'](_0x541eef[0x2]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x3]);_0x1911a2[_0x2628('0x20')](_0x541eef[_0x2628('0x21')](0x4,_0x541eef[_0x2628('0x16')])['join'](','));break;case _0x2628('0x23'):var _0x1dd96a=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2['push'](_0x1dd96a[0x0]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x1]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x2]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x3]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[_0x2628('0x21')](0x4,_0x1dd96a[_0x2628('0x16')])[_0x2628('0x18')](','));break;case _0x2628('0x13'):_0x1911a2[_0x2628('0x20')](_0x4976ce['appdata']);break;case _0x2628('0x24'):_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x25')]);_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x1d')]);break;case'tvox':var _0x4ba58c=utils[_0x2628('0x26')](_0x513aee[_0x2628('0x27')][_0x2628('0x28')],_0x513aee);var _0x572e2d=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x572e2d[0x0]);_0x1911a2['push'](_0x572e2d[0x1]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x2]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x3]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x4]);_0x1911a2['push'](_0x572e2d[0x5]);_0x1911a2['push'](_0x572e2d[0x6]);_0x1911a2['push'](_0x572e2d[0x7]);_0x1911a2['push'](_0x572e2d[0x8]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x9]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0xa]);_0x1911a2[_0x2628('0x20')](_0x513aee['interaction']['id']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x13')]['id']);_0x1911a2[_0x2628('0x20')](_0x4976ce['ChatWebsiteId']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x14')][_0x2628('0x29')]);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x2a')][_0x2628('0x2a')]);_0x1911a2[_0x2628('0x20')](_0x4ba58c);break;default:_0x1911a2=_['isNil'](_0x4976ce[_0x2628('0x1d')])?[]:_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');}var _0x3dd851={'id':util[_0x2628('0xb')](_0x2628('0x2b'),_0x13a728,_0x4976ce['id'],_0x4976ce['app']),'condition':require(_0x2628('0x2c'))['condition'](_0x13a728,getIntervals(_0x1081a4[_0x2628('0x2d')],_0x4976ce),_0x1081a4),'consequence':require(_0x2628('0x2e')+_0x4976ce[_0x2628('0x19')])[_0x2628('0x2f')](_0x13a728,_0x1911a2,_0x1081a4,_0x513aee),'p':_0x4976ce[_0x2628('0x30')]||0x0};logger['info'](_0x2628('0x31'),_0x3dd851['id'],'on\x20interval',getIntervals(_0x1081a4['intervals'],_0x4976ce)[_0x2628('0x18')](_0x2628('0x32')));_0x4f418d[_0x2628('0x20')](_0x3dd851);}else{logger[_0x2628('0x33')](_0x2628('0x34'),path['join'](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')));}}_0x1081a4[_0x2628('0x11')][_0x13a728]=new RuleEngine(_0x4f418d);_0x1081a4[_0x2628('0x11')][_0x13a728]['execute'](_0x513aee,function(_0x4665e8){logger['info'](_0x2628('0x35'),JSON[_0x2628('0x36')](_0x4665e8[_0x2628('0x37')]));if(_0x1081a4[_0x2628('0x11')][_0x13a728]){_0x1081a4['rules'][_0x13a728]['emit'](_0x2628('0x38'));}});return _0x16e67a({'code':0xc8,'message':_0x513aee});}else{logger[_0x2628('0x39')]('No\x20applications\x20to\x20execute');return _0x16e67a({'code':0xc8,'message':_0x513aee});}}catch(_0x23726f){logger[_0x2628('0x33')](_0x23726f[_0x2628('0x3a')]);return _0x457163(_0x645884[_0x2628('0x33')](0x1f4,_0x23726f));}}return _0x457163('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2e363a){var _0x1b6822=this;return new Promise(function(_0x1a34ee,_0x29847f){if(_0x2e363a[_0x2628('0x3b')]&&_0x2e363a[_0x2628('0x3b')]['id']){if(_0x1081a4[_0x2628('0x3c')][_0x2e363a[_0x2628('0x3b')]['id']]){_0x1081a4['agents'][_0x2e363a[_0x2628('0x3b')]['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x2e363a['agent']['id']][_0x2628('0x3d')]=undefined;}}if(_0x2e363a[_0x2628('0x13')]&&_0x2e363a[_0x2628('0x13')]['id']){try{var _0x2b8fb9=getId(_0x2e363a[_0x2628('0x12')],_0x2e363a['message']?_0x2e363a[_0x2628('0x13')]['id']:0x0,_0x2e363a['interaction']?_0x2e363a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x2b8fb9]){_0x1081a4[_0x2628('0x11')][_0x2b8fb9]['emit'](_0x2628('0x3e'));if(rpc[_0x2e363a[_0x2628('0x12')]+'QueueReport']){rpc[_0x2e363a[_0x2628('0x12')]+_0x2628('0x3f')][_0x2628('0x40')](_0x2b8fb9,{'UserId':_0x2e363a[_0x2628('0x13')][_0x2628('0x41')]})['catch'](function(){logger[_0x2628('0x33')]('error\x20update\x20queue\x20report');});}}return _0x1a34ee({'code':0xc8,'message':_0x2e363a});}catch(_0x307ab6){logger[_0x2628('0x33')](_0x307ab6[_0x2628('0x3a')]);return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,_0x307ab6));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x7fc50){var _0x11a733=this;return new Promise(function(_0xdcf3ac,_0x403c78){if(_0x7fc50[_0x2628('0x3b')]&&_0x7fc50[_0x2628('0x3b')]['id']){try{if(_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']]){_0x1081a4[_0x2628('0x3c')][_0x7fc50['agent']['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']][_0x2628('0x3d')]=undefined;}return _0xdcf3ac({'code':0xc8,'message':_0x7fc50});}catch(_0xc7abb4){logger[_0x2628('0x33')](_0xc7abb4['stack']);return _0x403c78(_0x11a733['error'](0x1f4,_0xc7abb4));}}logger[_0x2628('0x33')]('message\x20is\x20empty');return _0x403c78(_0x11a733[_0x2628('0x33')](0x1f4,_0x2628('0x42')));});},'AbandonInteraction':function(_0x45227a){var _0x313e45=this;return new Promise(function(_0x2a5872,_0x2e677){if(_0x45227a[_0x2628('0x12')]&&_0x45227a[_0x2628('0x14')]&&_0x45227a[_0x2628('0x14')]['id']){try{var _0x3a656d=getId(_0x45227a[_0x2628('0x12')],_0x45227a[_0x2628('0x13')]?_0x45227a[_0x2628('0x13')]['id']:0x0,_0x45227a[_0x2628('0x14')]?_0x45227a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x3a656d]){_0x1081a4[_0x2628('0x11')][_0x3a656d][_0x2628('0x43')](_0x2628('0x3e'));}return _0x2a5872({'code':0xc8,'message':_0x45227a});}catch(_0x2c5424){logger[_0x2628('0x33')](_0x2c5424[_0x2628('0x3a')]);return _0x2e677(_0x313e45['error'](0x1f4,_0x2c5424));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x2e677(_0x313e45['error'](0x1f4,_0x2628('0x42')));});},'AgentCapacity':function(_0x382c0b){var _0x208707=this;return new Promise(function(_0x1bf368,_0x13187b){if(_0x1081a4[_0x2628('0x3c')][_0x2628('0x44')](_0x382c0b['id'])){for(var _0x167cd1 in _0x382c0b['capacity']){if(_0x382c0b[_0x2628('0x45')][_0x2628('0x44')](_0x167cd1)){if(_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]['hasOwnProperty'](_0x167cd1+_0x2628('0x46'))){_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x167cd1+_0x2628('0x46')]=parseInt(_0x382c0b[_0x2628('0x45')][_0x167cd1],0xa);}}}_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x2628('0x47')]();return _0x1bf368({'code':0xc8,'message':_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]});}else{return _0x13187b(_0x208707['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x49d412){return new Promise(function(_0x28d22a){var _0x4be311=_['values'](_0x1081a4[_0x2628('0x3c')]);if(_0x49d412&&_0x49d412['id']){var _0x36bcaf=_[_0x2628('0x48')](_0x4be311,function(_0x570f37){return _0x570f37['id']===_0x49d412['id'];});_0x28d22a(_0x36bcaf);}else{_0x28d22a({'count':_0x4be311['length'],'rows':_0x4be311});}});},'ChatQueues':function(){return new Promise(function(_0x5af7e8){var _0x54f9c0=[];for(var _0x3a3477 in _0x1081a4[_0x2628('0x49')]){if(_0x1081a4[_0x2628('0x49')][_0x2628('0x44')](_0x3a3477)){var _0x2a4fc0=_0x1081a4['chatQueues'][_0x3a3477];var _0x597bb2={'id':_0x2a4fc0['id'],'available':_0x2a4fc0['available'],'loggedIn':_0x2a4fc0[_0x2628('0x4a')],'name':_0x2a4fc0[_0x2628('0x4b')],'paused':_0x2a4fc0['paused'],'waiting':_0x2a4fc0['waiting']};_0x54f9c0[_0x2628('0x20')](_0x597bb2);}}_0x5af7e8({'count':_0x54f9c0[_0x2628('0x16')],'rows':_0x54f9c0});});},'MailQueues':function(){return new Promise(function(_0x54869e){var _0x189c92=[];for(var _0x3a3a66 in _0x1081a4[_0x2628('0x4c')]){if(_0x1081a4['mailQueues']['hasOwnProperty'](_0x3a3a66)){var _0xdbd0ef=_0x1081a4[_0x2628('0x4c')][_0x3a3a66];var _0x58274b={'id':_0xdbd0ef['id'],'available':_0xdbd0ef[_0x2628('0x4d')],'loggedIn':_0xdbd0ef[_0x2628('0x4a')],'name':_0xdbd0ef[_0x2628('0x4b')],'paused':_0xdbd0ef['paused'],'waiting':_0xdbd0ef[_0x2628('0x4e')]};_0x189c92[_0x2628('0x20')](_0x58274b);}}_0x54869e({'count':_0x189c92['length'],'rows':_0x189c92});});},'OpenchannelQueues':function(){return new Promise(function(_0x22278f){var _0x93072a=[];for(var _0x219aeb in _0x1081a4[_0x2628('0x4f')]){if(_0x1081a4['openchannelQueues'][_0x2628('0x44')](_0x219aeb)){var _0xdfddbe=_0x1081a4[_0x2628('0x4f')][_0x219aeb];var _0x4a2190={'id':_0xdfddbe['id'],'available':_0xdfddbe['available'],'loggedIn':_0xdfddbe['loggedIn'],'name':_0xdfddbe[_0x2628('0x4b')],'paused':_0xdfddbe[_0x2628('0x50')],'waiting':_0xdfddbe[_0x2628('0x4e')]};_0x93072a[_0x2628('0x20')](_0x4a2190);}}_0x22278f({'count':_0x93072a['length'],'rows':_0x93072a});});},'SmsQueues':function(){return new Promise(function(_0x52d1ce){var _0x187f55=[];for(var _0x355444 in _0x1081a4['smsQueues']){if(_0x1081a4[_0x2628('0x51')][_0x2628('0x44')](_0x355444)){var _0x2b5053=_0x1081a4[_0x2628('0x51')][_0x355444];var _0x121435={'id':_0x2b5053['id'],'available':_0x2b5053[_0x2628('0x4d')],'loggedIn':_0x2b5053['loggedIn'],'name':_0x2b5053[_0x2628('0x4b')],'paused':_0x2b5053['paused'],'waiting':_0x2b5053[_0x2628('0x4e')]};_0x187f55['push'](_0x121435);}}_0x52d1ce({'count':_0x187f55[_0x2628('0x16')],'rows':_0x187f55});});},'FaxQueues':function(){return new Promise(function(_0x353412){var _0x24d571=[];for(var _0x1f6267 in _0x1081a4[_0x2628('0x52')]){if(_0x1081a4[_0x2628('0x52')][_0x2628('0x44')](_0x1f6267)){var _0xfa1f4=_0x1081a4[_0x2628('0x52')][_0x1f6267];var _0x12e835={'id':_0xfa1f4['id'],'available':_0xfa1f4[_0x2628('0x4d')],'loggedIn':_0xfa1f4[_0x2628('0x4a')],'name':_0xfa1f4[_0x2628('0x4b')],'paused':_0xfa1f4[_0x2628('0x50')],'waiting':_0xfa1f4[_0x2628('0x4e')]};_0x24d571['push'](_0x12e835);}}_0x353412({'count':_0x24d571[_0x2628('0x16')],'rows':_0x24d571});});},'WhatsappQueues':function(){return new Promise(function(_0x3170fb){var _0x443456=[];for(var _0xd41484 in _0x1081a4[_0x2628('0x53')]){if(_0x1081a4[_0x2628('0x53')][_0x2628('0x44')](_0xd41484)){var _0x3d52c6=_0x1081a4['whatsappQueues'][_0xd41484];var _0x29aacc={'id':_0x3d52c6['id'],'available':_0x3d52c6['available'],'loggedIn':_0x3d52c6[_0x2628('0x4a')],'name':_0x3d52c6['name'],'paused':_0x3d52c6[_0x2628('0x50')],'waiting':_0x3d52c6[_0x2628('0x4e')]};_0x443456[_0x2628('0x20')](_0x29aacc);}}_0x3170fb({'count':_0x443456[_0x2628('0x16')],'rows':_0x443456});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x211b28){var _0x57d96a=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x55')]);_0x211b28({'count':_0x57d96a[_0x2628('0x16')],'rows':_0x57d96a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1c3e42){var _0x7caf20=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x56')]);_0x1c3e42({'count':_0x7caf20[_0x2628('0x16')],'rows':_0x7caf20});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2dfe66){var _0x14387e=_[_0x2628('0x54')](_0x1081a4['openchannelQueuesWaitingInteractions']);_0x2dfe66({'count':_0x14387e[_0x2628('0x16')],'rows':_0x14387e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4a6902){var _0x118d26=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x57')]);_0x4a6902({'count':_0x118d26[_0x2628('0x16')],'rows':_0x118d26});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b5de9){var _0x50032b=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x58')]);_0x4b5de9({'count':_0x50032b['length'],'rows':_0x50032b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b33d){var _0x4796fe=_['values'](_0x1081a4[_0x2628('0x59')]);_0x2b33d({'count':_0x4796fe[_0x2628('0x16')],'rows':_0x4796fe});});}};var _0x47f297=jayson[_0x2628('0x5a')](_0x2f59ca)['http']();_0x47f297['on']('error',function(_0xc9e57c){logger[_0x2628('0x33')](JSON[_0x2628('0x36')](_0xc9e57c));return _0x2395fe(_0xc9e57c);});_0x47f297[_0x2628('0x5b')](0x232c,_0x2628('0x5c'),function(){console[_0x2628('0x5d')](_0x2628('0x5e'),0x232c);return _0x4d2cfb(_0x2628('0x5f')+0x232c);});});}; \ No newline at end of file +var _0x6b19=['priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','find','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflowv2','tag','tvox','notificationTemplate','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x6b19,0xe8));var _0x96b1=function(_0x3bb7a7,_0x2f6106){_0x3bb7a7=_0x3bb7a7-0x0;var _0x274b83=_0x6b19[_0x3bb7a7];return _0x274b83;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x96b1('0x2'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x96b1('0x3'))(_0x96b1('0x4'));var rpc={'openchannelQueueReport':require(_0x96b1('0x5')),'mailQueueReport':require(_0x96b1('0x6')),'chatQueueReport':require(_0x96b1('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x96b1('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x96b1('0x9'));function getId(_0x572fde,_0x57a23a,_0x307e65){return util['format'](_0x96b1('0xa'),_0x572fde,_0x57a23a||0x0,_0x307e65||0x0);}function getIntervals(_0x4d2f1c,_0x36ea50){var _0x34c81c=[];if(!_[_0x96b1('0xb')](_0x36ea50[_0x96b1('0xc')])&&!_[_0x96b1('0xb')](_0x4d2f1c[_0x36ea50[_0x96b1('0xc')]])&&!_[_0x96b1('0xb')](_0x4d2f1c[_0x36ea50['IntervalId']]['Intervals'])){_0x34c81c=_[_0x96b1('0xd')](_0x4d2f1c[_0x36ea50['IntervalId']]['Intervals'],_0x96b1('0xe'));}else if(!_[_0x96b1('0xb')](_0x36ea50[_0x96b1('0xe')])){_0x34c81c=[_0x36ea50['interval']];}return _0x34c81c;}exports[_0x96b1('0xf')]=function(_0x1af8c1){_0x1af8c1[_0x96b1('0x10')]={};return new BPromise(function(_0x2119b1,_0x46b2bb){var _0x4f4150={'Start':function(_0x27254a){var _0x375781=this;return new Promise(function(_0x23ce63,_0x12233d){if(_0x27254a){try{var _0x2cd1f5=[];var _0x43b7f5=getId(_0x27254a[_0x96b1('0x11')],_0x27254a[_0x96b1('0x12')]?_0x27254a[_0x96b1('0x12')]['id']:0x0,_0x27254a[_0x96b1('0x13')]?_0x27254a[_0x96b1('0x13')]['id']:0x0);if(_0x27254a[_0x96b1('0x14')]&&_[_0x96b1('0x15')](_0x27254a[_0x96b1('0x14')])&&_0x27254a[_0x96b1('0x14')]['length']){for(var _0x13e891=0x0;_0x13e891<_0x27254a['applications'][_0x96b1('0x16')];_0x13e891+=0x1){var _0x2f98a2=_0x27254a[_0x96b1('0x14')][_0x13e891];if(fs['existsSync'](path[_0x96b1('0x17')](__dirname,_0x96b1('0x14'),_0x2f98a2[_0x96b1('0x18')]+'.js'))){var _0x2b7d4d=[];switch(_0x2f98a2[_0x96b1('0x18')][_0x96b1('0x19')]()){case _0x96b1('0x1a'):var _0x555185=_0x2f98a2[_0x96b1('0x1b')][_0x96b1('0x1c')](',');if(_0x27254a[_0x96b1('0x11')]==='mail'){_0x2b7d4d[_0x96b1('0x1d')](_0x555185[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x555185[0x1]);_0x2b7d4d[_0x96b1('0x1d')](_0x555185[_0x96b1('0x1e')](0x2,_0x555185['length'])[_0x96b1('0x17')](','));}else{_0x2b7d4d['push'](_0x555185[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x555185['slice'](0x1,_0x555185[_0x96b1('0x16')])[_0x96b1('0x17')](','));}break;case'dialogflow':var _0x50dcbc=_0x2f98a2['appdata'][_0x96b1('0x1c')](',');_0x2b7d4d[_0x96b1('0x1d')](_0x50dcbc[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x50dcbc[0x1]);_0x2b7d4d[_0x96b1('0x1d')](_0x50dcbc[_0x96b1('0x1e')](0x2,_0x50dcbc['length'])[_0x96b1('0x17')](','));break;case _0x96b1('0x1f'):var _0x3cadbb=_0x2f98a2[_0x96b1('0x1b')]['split'](',');_0x2b7d4d[_0x96b1('0x1d')](_0x3cadbb[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x3cadbb[0x1]);_0x2b7d4d['push'](_0x3cadbb[0x2]);_0x2b7d4d['push'](_0x3cadbb[0x3]);_0x2b7d4d[_0x96b1('0x1d')](_0x3cadbb['slice'](0x4,_0x3cadbb[_0x96b1('0x16')])[_0x96b1('0x17')](','));break;case'amazonlex':var _0x191ef3=_0x2f98a2[_0x96b1('0x1b')]['split'](',');_0x2b7d4d[_0x96b1('0x1d')](_0x191ef3[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x191ef3[0x1]);_0x2b7d4d[_0x96b1('0x1d')](_0x191ef3[0x2]);_0x2b7d4d['push'](_0x191ef3[0x3]);_0x2b7d4d[_0x96b1('0x1d')](_0x191ef3[_0x96b1('0x1e')](0x4,_0x191ef3[_0x96b1('0x16')])[_0x96b1('0x17')](','));break;case _0x96b1('0x12'):_0x2b7d4d[_0x96b1('0x1d')](_0x2f98a2['appdata']);break;case _0x96b1('0x20'):_0x2b7d4d[_0x96b1('0x1d')](_0x2f98a2['TagId']);_0x2b7d4d['push'](_0x2f98a2[_0x96b1('0x1b')]);break;case _0x96b1('0x21'):var _0x1745d1=utils['getMustacheRender'](_0x27254a['account'][_0x96b1('0x22')],_0x27254a);var _0x3a2512=_0x2f98a2[_0x96b1('0x1b')][_0x96b1('0x1c')](',');_0x2b7d4d['push'](_0x3a2512[0x0]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x1]);_0x2b7d4d['push'](_0x3a2512[0x2]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x3]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x4]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x5]);_0x2b7d4d['push'](_0x3a2512[0x6]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x7]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x8]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0x9]);_0x2b7d4d[_0x96b1('0x1d')](_0x3a2512[0xa]);_0x2b7d4d[_0x96b1('0x1d')](_0x27254a[_0x96b1('0x13')]['id']);_0x2b7d4d['push'](_0x27254a[_0x96b1('0x12')]['id']);_0x2b7d4d[_0x96b1('0x1d')](_0x2f98a2['ChatWebsiteId']);_0x2b7d4d[_0x96b1('0x1d')](_0x27254a['interaction'][_0x96b1('0x23')]);_0x2b7d4d[_0x96b1('0x1d')](_0x27254a[_0x96b1('0x24')][_0x96b1('0x24')]);_0x2b7d4d[_0x96b1('0x1d')](_0x1745d1);break;default:_0x2b7d4d=_[_0x96b1('0xb')](_0x2f98a2[_0x96b1('0x1b')])?[]:_0x2f98a2[_0x96b1('0x1b')][_0x96b1('0x1c')](',');}var _0x5d5c8f={'id':util[_0x96b1('0x25')](_0x96b1('0x26'),_0x43b7f5,_0x2f98a2['id'],_0x2f98a2[_0x96b1('0x18')]),'condition':require(_0x96b1('0x27'))[_0x96b1('0x28')](_0x43b7f5,getIntervals(_0x1af8c1[_0x96b1('0x29')],_0x2f98a2),_0x1af8c1),'consequence':require(_0x96b1('0x2a')+_0x2f98a2[_0x96b1('0x18')])[_0x96b1('0x2b')](_0x43b7f5,_0x2b7d4d,_0x1af8c1,_0x27254a),'p':_0x2f98a2[_0x96b1('0x2c')]||0x0};logger[_0x96b1('0x2d')](_0x96b1('0x2e'),_0x5d5c8f['id'],_0x96b1('0x2f'),getIntervals(_0x1af8c1[_0x96b1('0x29')],_0x2f98a2)[_0x96b1('0x17')]('\x20|\x20'));_0x2cd1f5['push'](_0x5d5c8f);}else{logger[_0x96b1('0x30')](_0x96b1('0x31'),path['join'](__dirname,_0x96b1('0x14'),_0x2f98a2[_0x96b1('0x18')]+'.js'));}}_0x1af8c1['rules'][_0x43b7f5]=new RuleEngine(_0x2cd1f5);_0x1af8c1['rules'][_0x43b7f5][_0x96b1('0x32')](_0x27254a,function(_0x307645){logger[_0x96b1('0x2d')](_0x96b1('0x33'),JSON[_0x96b1('0x34')](_0x307645[_0x96b1('0x35')]));if(_0x1af8c1[_0x96b1('0x10')][_0x43b7f5]){_0x1af8c1[_0x96b1('0x10')][_0x43b7f5][_0x96b1('0x36')](_0x96b1('0x37'));}});return _0x23ce63({'code':0xc8,'message':_0x27254a});}else{logger['info'](_0x96b1('0x38'));return _0x23ce63({'code':0xc8,'message':_0x27254a});}}catch(_0x54acd9){logger[_0x96b1('0x30')](_0x54acd9['stack']);return _0x12233d(_0x375781[_0x96b1('0x30')](0x1f4,_0x54acd9));}}return _0x12233d('routing\x20is\x20empty');});},'AcceptMessage':function(_0x219393){var _0x1a50b7=this;return new Promise(function(_0x200839,_0x266eaa){if(_0x219393[_0x96b1('0x39')]&&_0x219393['agent']['id']){if(_0x1af8c1[_0x96b1('0x3a')][_0x219393[_0x96b1('0x39')]['id']]){_0x1af8c1[_0x96b1('0x3a')][_0x219393['agent']['id']][_0x96b1('0x3b')]=![];_0x1af8c1[_0x96b1('0x3a')][_0x219393[_0x96b1('0x39')]['id']][_0x96b1('0x3c')]=undefined;}}if(_0x219393['message']&&_0x219393[_0x96b1('0x12')]['id']){try{var _0x466ad1=getId(_0x219393['channel'],_0x219393[_0x96b1('0x12')]?_0x219393[_0x96b1('0x12')]['id']:0x0,_0x219393[_0x96b1('0x13')]?_0x219393[_0x96b1('0x13')]['id']:0x0);if(_0x1af8c1[_0x96b1('0x10')][_0x466ad1]){_0x1af8c1[_0x96b1('0x10')][_0x466ad1]['emit'](_0x96b1('0x3d'));if(rpc[_0x219393['channel']+_0x96b1('0x3e')]){rpc[_0x219393[_0x96b1('0x11')]+'QueueReport'][_0x96b1('0x3f')](_0x466ad1,{'UserId':_0x219393[_0x96b1('0x12')]['UserId']})[_0x96b1('0x40')](function(){logger[_0x96b1('0x30')](_0x96b1('0x41'));});}}return _0x200839({'code':0xc8,'message':_0x219393});}catch(_0x3a7301){logger[_0x96b1('0x30')](_0x3a7301[_0x96b1('0x42')]);return _0x266eaa(_0x1a50b7[_0x96b1('0x30')](0x1f4,_0x3a7301));}}logger[_0x96b1('0x30')](_0x96b1('0x43'));return _0x266eaa(_0x1a50b7[_0x96b1('0x30')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x296960){var _0x220551=this;return new Promise(function(_0x12b862,_0x1e89fe){if(_0x296960[_0x96b1('0x39')]&&_0x296960[_0x96b1('0x39')]['id']){try{if(_0x1af8c1[_0x96b1('0x3a')][_0x296960[_0x96b1('0x39')]['id']]){_0x1af8c1['agents'][_0x296960['agent']['id']][_0x96b1('0x3b')]=![];_0x1af8c1[_0x96b1('0x3a')][_0x296960['agent']['id']][_0x96b1('0x3c')]=undefined;}return _0x12b862({'code':0xc8,'message':_0x296960});}catch(_0x2863b2){logger[_0x96b1('0x30')](_0x2863b2['stack']);return _0x1e89fe(_0x220551[_0x96b1('0x30')](0x1f4,_0x2863b2));}}logger[_0x96b1('0x30')]('message\x20is\x20empty');return _0x1e89fe(_0x220551['error'](0x1f4,_0x96b1('0x43')));});},'AbandonInteraction':function(_0x19cc23){var _0x3b0fe6=this;return new Promise(function(_0x203b62,_0x22aa61){if(_0x19cc23[_0x96b1('0x11')]&&_0x19cc23[_0x96b1('0x13')]&&_0x19cc23[_0x96b1('0x13')]['id']){try{var _0x332b1c=getId(_0x19cc23[_0x96b1('0x11')],_0x19cc23[_0x96b1('0x12')]?_0x19cc23[_0x96b1('0x12')]['id']:0x0,_0x19cc23['interaction']?_0x19cc23[_0x96b1('0x13')]['id']:0x0);if(_0x1af8c1[_0x96b1('0x10')][_0x332b1c]){_0x1af8c1[_0x96b1('0x10')][_0x332b1c][_0x96b1('0x36')](_0x96b1('0x3d'));}return _0x203b62({'code':0xc8,'message':_0x19cc23});}catch(_0x1bf97f){logger[_0x96b1('0x30')](_0x1bf97f['stack']);return _0x22aa61(_0x3b0fe6[_0x96b1('0x30')](0x1f4,_0x1bf97f));}}logger['error']('message\x20is\x20empty');return _0x22aa61(_0x3b0fe6[_0x96b1('0x30')](0x1f4,_0x96b1('0x43')));});},'AgentCapacity':function(_0x20b121){var _0x1f3f4b=this;return new Promise(function(_0x41cca1,_0x192744){if(_0x1af8c1[_0x96b1('0x3a')]['hasOwnProperty'](_0x20b121['id'])){for(var _0x26a496 in _0x20b121['capacity']){if(_0x20b121[_0x96b1('0x44')]['hasOwnProperty'](_0x26a496)){if(_0x1af8c1[_0x96b1('0x3a')][_0x20b121['id']][_0x96b1('0x45')](_0x26a496+'CurrentCapacity')){_0x1af8c1[_0x96b1('0x3a')][_0x20b121['id']][_0x26a496+_0x96b1('0x46')]=parseInt(_0x20b121[_0x96b1('0x44')][_0x26a496],0xa);}}}_0x1af8c1[_0x96b1('0x3a')][_0x20b121['id']]['updateRealtime']();return _0x41cca1({'code':0xc8,'message':_0x1af8c1['agents'][_0x20b121['id']]});}else{return _0x192744(_0x1f3f4b[_0x96b1('0x30')](0x1f4,_0x96b1('0x47')));}});},'Agents':function(_0x474bad){return new Promise(function(_0x3a7063){var _0x5555bb=_[_0x96b1('0x48')](_0x1af8c1[_0x96b1('0x3a')]);if(_0x474bad&&_0x474bad['id']){var _0x2c2c71=_[_0x96b1('0x49')](_0x5555bb,function(_0x2b2b18){return _0x2b2b18['id']===_0x474bad['id'];});_0x3a7063(_0x2c2c71);}else{_0x3a7063({'count':_0x5555bb[_0x96b1('0x16')],'rows':_0x5555bb});}});},'ChatQueues':function(){return new Promise(function(_0x226568){var _0x337b31=[];for(var _0x1ebb27 in _0x1af8c1['chatQueues']){if(_0x1af8c1['chatQueues'][_0x96b1('0x45')](_0x1ebb27)){var _0x22b054=_0x1af8c1['chatQueues'][_0x1ebb27];var _0x541e26={'id':_0x22b054['id'],'available':_0x22b054[_0x96b1('0x4a')],'loggedIn':_0x22b054[_0x96b1('0x4b')],'name':_0x22b054[_0x96b1('0x4c')],'paused':_0x22b054[_0x96b1('0x4d')],'waiting':_0x22b054[_0x96b1('0x4e')]};_0x337b31[_0x96b1('0x1d')](_0x541e26);}}_0x226568({'count':_0x337b31[_0x96b1('0x16')],'rows':_0x337b31});});},'MailQueues':function(){return new Promise(function(_0x5aa89a){var _0x4ada71=[];for(var _0x316cfa in _0x1af8c1[_0x96b1('0x4f')]){if(_0x1af8c1['mailQueues']['hasOwnProperty'](_0x316cfa)){var _0x2be24e=_0x1af8c1[_0x96b1('0x4f')][_0x316cfa];var _0x4c0aa4={'id':_0x2be24e['id'],'available':_0x2be24e[_0x96b1('0x4a')],'loggedIn':_0x2be24e[_0x96b1('0x4b')],'name':_0x2be24e[_0x96b1('0x4c')],'paused':_0x2be24e[_0x96b1('0x4d')],'waiting':_0x2be24e[_0x96b1('0x4e')]};_0x4ada71[_0x96b1('0x1d')](_0x4c0aa4);}}_0x5aa89a({'count':_0x4ada71['length'],'rows':_0x4ada71});});},'OpenchannelQueues':function(){return new Promise(function(_0xa0877f){var _0x1db88a=[];for(var _0x47faf2 in _0x1af8c1[_0x96b1('0x50')]){if(_0x1af8c1['openchannelQueues'][_0x96b1('0x45')](_0x47faf2)){var _0x56d007=_0x1af8c1[_0x96b1('0x50')][_0x47faf2];var _0x30547f={'id':_0x56d007['id'],'available':_0x56d007[_0x96b1('0x4a')],'loggedIn':_0x56d007[_0x96b1('0x4b')],'name':_0x56d007[_0x96b1('0x4c')],'paused':_0x56d007[_0x96b1('0x4d')],'waiting':_0x56d007[_0x96b1('0x4e')]};_0x1db88a[_0x96b1('0x1d')](_0x30547f);}}_0xa0877f({'count':_0x1db88a[_0x96b1('0x16')],'rows':_0x1db88a});});},'SmsQueues':function(){return new Promise(function(_0x30553c){var _0x3e7a23=[];for(var _0x4e173b in _0x1af8c1[_0x96b1('0x51')]){if(_0x1af8c1[_0x96b1('0x51')][_0x96b1('0x45')](_0x4e173b)){var _0x1b35ed=_0x1af8c1[_0x96b1('0x51')][_0x4e173b];var _0x51b25b={'id':_0x1b35ed['id'],'available':_0x1b35ed[_0x96b1('0x4a')],'loggedIn':_0x1b35ed[_0x96b1('0x4b')],'name':_0x1b35ed['name'],'paused':_0x1b35ed[_0x96b1('0x4d')],'waiting':_0x1b35ed[_0x96b1('0x4e')]};_0x3e7a23[_0x96b1('0x1d')](_0x51b25b);}}_0x30553c({'count':_0x3e7a23[_0x96b1('0x16')],'rows':_0x3e7a23});});},'FaxQueues':function(){return new Promise(function(_0x54994e){var _0x5c807d=[];for(var _0x4d81a2 in _0x1af8c1['faxQueues']){if(_0x1af8c1[_0x96b1('0x52')][_0x96b1('0x45')](_0x4d81a2)){var _0x559cb4=_0x1af8c1[_0x96b1('0x52')][_0x4d81a2];var _0x430987={'id':_0x559cb4['id'],'available':_0x559cb4[_0x96b1('0x4a')],'loggedIn':_0x559cb4['loggedIn'],'name':_0x559cb4[_0x96b1('0x4c')],'paused':_0x559cb4[_0x96b1('0x4d')],'waiting':_0x559cb4[_0x96b1('0x4e')]};_0x5c807d['push'](_0x430987);}}_0x54994e({'count':_0x5c807d[_0x96b1('0x16')],'rows':_0x5c807d});});},'WhatsappQueues':function(){return new Promise(function(_0xbf5224){var _0x34b1b5=[];for(var _0x25ef88 in _0x1af8c1[_0x96b1('0x53')]){if(_0x1af8c1['whatsappQueues'][_0x96b1('0x45')](_0x25ef88)){var _0x5f28c2=_0x1af8c1['whatsappQueues'][_0x25ef88];var _0x377a43={'id':_0x5f28c2['id'],'available':_0x5f28c2[_0x96b1('0x4a')],'loggedIn':_0x5f28c2[_0x96b1('0x4b')],'name':_0x5f28c2[_0x96b1('0x4c')],'paused':_0x5f28c2['paused'],'waiting':_0x5f28c2['waiting']};_0x34b1b5['push'](_0x377a43);}}_0xbf5224({'count':_0x34b1b5['length'],'rows':_0x34b1b5});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x50b5c4){var _0x306bf8=_['values'](_0x1af8c1[_0x96b1('0x54')]);_0x50b5c4({'count':_0x306bf8[_0x96b1('0x16')],'rows':_0x306bf8});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x331e21){var _0x378c78=_['values'](_0x1af8c1[_0x96b1('0x55')]);_0x331e21({'count':_0x378c78[_0x96b1('0x16')],'rows':_0x378c78});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5957d3){var _0x41c37d=_['values'](_0x1af8c1['openchannelQueuesWaitingInteractions']);_0x5957d3({'count':_0x41c37d[_0x96b1('0x16')],'rows':_0x41c37d});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4826b6){var _0x451825=_['values'](_0x1af8c1[_0x96b1('0x56')]);_0x4826b6({'count':_0x451825[_0x96b1('0x16')],'rows':_0x451825});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x379256){var _0x5e2e61=_[_0x96b1('0x48')](_0x1af8c1[_0x96b1('0x57')]);_0x379256({'count':_0x5e2e61[_0x96b1('0x16')],'rows':_0x5e2e61});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5ae305){var _0x1e126a=_[_0x96b1('0x48')](_0x1af8c1['whatsappQueuesWaitingInteractions']);_0x5ae305({'count':_0x1e126a[_0x96b1('0x16')],'rows':_0x1e126a});});}};var _0x882723=jayson['server'](_0x4f4150)['http']();_0x882723['on'](_0x96b1('0x30'),function(_0x4c7cf3){logger[_0x96b1('0x30')](JSON['stringify'](_0x4c7cf3));return _0x46b2bb(_0x4c7cf3);});_0x882723[_0x96b1('0xf')](0x232c,_0x96b1('0x58'),function(){console[_0x96b1('0x59')](_0x96b1('0x5a'),0x232c);return _0x2119b1(_0x96b1('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 955c9e9..a0c4595 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 _0xa17a=['stack','util','bluebird','jayson/promise','lodash','routing','client','http','error','catch','rules','stop','push','format','then','message','true','[%s][INTERVAL]\x20%s','all','some','info','\x20|\x20','when','log','join'];(function(_0x368bba,_0x1f625b){var _0x409f8f=function(_0x463373){while(--_0x463373){_0x368bba['push'](_0x368bba['shift']());}};_0x409f8f(++_0x1f625b);}(_0xa17a,0x7e));var _0xaa17=function(_0x4addaa,_0x443146){_0x4addaa=_0x4addaa-0x0;var _0x3eb2eb=_0xa17a[_0x4addaa];return _0x3eb2eb;};'use strict';var util=require(_0xaa17('0x0'));var BPromise=require(_0xaa17('0x1'));var jayson=require(_0xaa17('0x2'));var _=require(_0xaa17('0x3'));var logger=require('../../../config/logger')(_0xaa17('0x4'));var client=jayson[_0xaa17('0x5')][_0xaa17('0x6')]({'port':0x232a});function request(_0x5d0bd9,_0x2c9690){return new BPromise(function(_0x370521,_0x43d95a){return client['request'](_0x5d0bd9,_0x2c9690)['then'](function(_0xe384a5){if(_0xe384a5[_0xaa17('0x7')]){return _0x43d95a(_0xe384a5[_0xaa17('0x7')]['message']);}else{return _0x370521(_0xe384a5['result']);}})[_0xaa17('0x8')](function(_0x7d430d){return _0x43d95a(_0x7d430d);});});}exports['condition']=function(_0x303d18,_0x170e7c,_0x412fc7){return function(_0x465163){if(_0x412fc7[_0xaa17('0x9')]&&!_0x412fc7[_0xaa17('0x9')][_0x303d18]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x303d18);return _0x465163[_0xaa17('0xa')]();}var _0x563434=[];for(var _0x163e65=0x0;_0x163e65<_0x170e7c['length'];_0x163e65+=0x1){_0x563434[_0xaa17('0xb')](request('Command',{'command':util[_0xaa17('0xc')]('iftime\x20%s',_0x170e7c[_0x163e65])})[_0xaa17('0xd')](function(_0x14e8ab){return _0x14e8ab&&_0x14e8ab['message']&&_0x14e8ab[_0xaa17('0xe')]['indexOf'](_0xaa17('0xf'))>=0x0?!![]:![];})['catch'](function(_0x4c5992){logger[_0xaa17('0x7')](_0xaa17('0x10'),_0x303d18,_0x170e7c[_0x163e65]);}));}BPromise[_0xaa17('0x11')](_0x563434)[_0xaa17('0xd')](function(_0x2e9efa){var _0x57dccc=_[_0xaa17('0x12')](_0x2e9efa);logger[_0xaa17('0x13')]('[%s][INTERVAL]\x20%s\x20%s',_0x303d18,_0x170e7c['join'](_0xaa17('0x14')),_0x57dccc);_0x465163[_0xaa17('0x15')](_0x57dccc);})[_0xaa17('0x8')](function(_0xad3415){console[_0xaa17('0x16')](_0xad3415);logger[_0xaa17('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x303d18,_0x170e7c[_0xaa17('0x17')](_0xaa17('0x14')),_0xad3415[_0xaa17('0x18')]);_0x465163['stop']();});};}; \ No newline at end of file +var _0xb2b9=['catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','some','join','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result'];(function(_0x42d987,_0x5e756e){var _0x34d473=function(_0x23b635){while(--_0x23b635){_0x42d987['push'](_0x42d987['shift']());}};_0x34d473(++_0x5e756e);}(_0xb2b9,0x15c));var _0x9b2b=function(_0x1a11aa,_0x5eeb4d){_0x1a11aa=_0x1a11aa-0x0;var _0x2d54b5=_0xb2b9[_0x1a11aa];return _0x2d54b5;};'use strict';var util=require(_0x9b2b('0x0'));var BPromise=require(_0x9b2b('0x1'));var jayson=require(_0x9b2b('0x2'));var _=require(_0x9b2b('0x3'));var logger=require('../../../config/logger')(_0x9b2b('0x4'));var client=jayson[_0x9b2b('0x5')][_0x9b2b('0x6')]({'port':0x232a});function request(_0x391839,_0x1918c7){return new BPromise(function(_0x5a3a6b,_0x4e1d0a){return client[_0x9b2b('0x7')](_0x391839,_0x1918c7)[_0x9b2b('0x8')](function(_0x1b996b){if(_0x1b996b[_0x9b2b('0x9')]){return _0x4e1d0a(_0x1b996b[_0x9b2b('0x9')][_0x9b2b('0xa')]);}else{return _0x5a3a6b(_0x1b996b[_0x9b2b('0xb')]);}})[_0x9b2b('0xc')](function(_0x4419ef){return _0x4e1d0a(_0x4419ef);});});}exports[_0x9b2b('0xd')]=function(_0xf593bd,_0x10709d,_0x59c766){return function(_0x22acb9){if(_0x59c766['rules']&&!_0x59c766[_0x9b2b('0xe')][_0xf593bd]){logger[_0x9b2b('0xf')](_0x9b2b('0x10'),_0xf593bd);return _0x22acb9[_0x9b2b('0x11')]();}var _0x28275b=[];for(var _0x3123b6=0x0;_0x3123b6<_0x10709d[_0x9b2b('0x12')];_0x3123b6+=0x1){_0x28275b[_0x9b2b('0x13')](request('Command',{'command':util['format'](_0x9b2b('0x14'),_0x10709d[_0x3123b6])})['then'](function(_0x2fd73a){return _0x2fd73a&&_0x2fd73a['message']&&_0x2fd73a[_0x9b2b('0xa')][_0x9b2b('0x15')](_0x9b2b('0x16'))>=0x0?!![]:![];})[_0x9b2b('0xc')](function(_0xec1509){logger['error'](_0x9b2b('0x17'),_0xf593bd,_0x10709d[_0x3123b6]);}));}BPromise['all'](_0x28275b)[_0x9b2b('0x8')](function(_0x118dee){var _0x1dbeda=_[_0x9b2b('0x18')](_0x118dee);logger[_0x9b2b('0xf')]('[%s][INTERVAL]\x20%s\x20%s',_0xf593bd,_0x10709d[_0x9b2b('0x19')]('\x20|\x20'),_0x1dbeda);_0x22acb9['when'](_0x1dbeda);})[_0x9b2b('0xc')](function(_0x3243c2){console[_0x9b2b('0x1a')](_0x3243c2);logger[_0x9b2b('0x9')](_0x9b2b('0x1b'),_0xf593bd,_0x10709d[_0x9b2b('0x19')](_0x9b2b('0x1c')),_0x3243c2[_0x9b2b('0x1d')]);_0x22acb9[_0x9b2b('0x11')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c21e32e..f1d0578 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa478=['push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transferexten','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','type','agentcomplete','acw','agentacw','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime'];(function(_0x22be4f,_0x1a0366){var _0x1300d0=function(_0x66e9d6){while(--_0x66e9d6){_0x22be4f['push'](_0x22be4f['shift']());}};_0x1300d0(++_0x1a0366);}(_0xa478,0x136));var _0x8a47=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xa478[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var utils=require(_0x8a47('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x44be2c,_0x2c3f60){utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x5'),_0x44be2c[_0x8a47('0x6')],_0x44be2c[_0x8a47('0x7')],_0x44be2c[_0x8a47('0x8')],_0x44be2c[_0x8a47('0x9')],_0x44be2c['interface'],_0x44be2c[_0x8a47('0xa')],_0x44be2c[_0x8a47('0xb')],_0x44be2c[_0x8a47('0xc')]));if(_0x44be2c[_0x8a47('0x8')]){utils['getVoiceQueueByName'](_0x44be2c[_0x8a47('0x8')])['then'](function(_0x7b6e61){if(_0x7b6e61){_0x44be2c[_0x8a47('0xd')]=_0x7b6e61[_0x8a47('0xd')];_0x44be2c['agentacw']=_0x44be2c[_0x8a47('0xe')]?_0x7b6e61[_0x8a47('0xf')]:![];_0x44be2c['acwtime']=_0x44be2c[_0x8a47('0x10')]?_0x7b6e61['acwTimeout']:0x0;}utils[_0x8a47('0x11')](_0x8a47('0x12'),_0x44be2c);});}else{utils[_0x8a47('0x11')]('CreateVoiceAgentReport',_0x44be2c);}if(_0x2c3f60){delete transfers[_0x44be2c['uniqueid']];}else{delete agents[_0x44be2c['destuniqueid']];}}exports[_0x8a47('0x13')]=function(_0x12539c){try{utils['debug'](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x12539c);agents[_0x12539c[_0x8a47('0x15')]]=_0x12539c;agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x18');agents[_0x12539c[_0x8a47('0x15')]][_0x8a47('0xb')]=null;agents[_0x12539c[_0x8a47('0x15')]]['connectedlinename']=null;utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x19'),_0x12539c['uniqueid'],agents[_0x12539c[_0x8a47('0x15')]]['membername'],_0x12539c['destuniqueid']));}catch(_0x1cf650){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x14'),_0x12539c[_0x8a47('0x6')]),_0x1cf650);}};exports[_0x8a47('0x1b')]=function(_0x44e119){try{if(!_[_0x8a47('0x1c')](agents[_0x44e119[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util['format'](_0x8a47('0x1e'),_0x44e119['uniqueid']),_0x44e119);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x1f'),_0x44e119[_0x8a47('0x6')],agents[_0x44e119['destuniqueid']][_0x8a47('0x9')],_0x44e119['destuniqueid']));agents[_0x44e119['destuniqueid']]['agentringnoanswer']=!![];agents[_0x44e119['destuniqueid']][_0x8a47('0x20')]=utils[_0x8a47('0x17')]();agents[_0x44e119['destuniqueid']][_0x8a47('0xc')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x8a47('0x21');agents[_0x44e119[_0x8a47('0x15')]][_0x8a47('0x23')]=_0x44e119['ringtime']?parseInt(_0x44e119[_0x8a47('0x24')])/0x3e8:0x0;agents[_0x44e119['destuniqueid']][_0x8a47('0x25')]=0x0;unanswered[_0x8a47('0x26')](_0x44e119['destuniqueid']);}}catch(_0x1e89b1){utils['error'](util['format'](_0x8a47('0x1e'),_0x44e119[_0x8a47('0x6')]),_0x1e89b1);}};exports[_0x8a47('0x27')]=function(_0x12f0b7){try{_[_0x8a47('0x28')](agents,function(_0x18bfd3,_0x58aa06){if(_0x18bfd3[_0x8a47('0x6')]==_0x12f0b7['uniqueid']&&!_['includes'](unanswered,_0x18bfd3[_0x8a47('0x15')])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x12f0b7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2a'),_0x12f0b7[_0x8a47('0x6')],_0x18bfd3[_0x8a47('0x9')],_0x18bfd3['destuniqueid']));_0x18bfd3[_0x8a47('0x1b')]=!![];_0x18bfd3[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x18bfd3['lastevent']=_0x8a47('0x2b');_0x18bfd3[_0x8a47('0x22')]='abandoned';_0x18bfd3[_0x8a47('0x23')]=_0x12f0b7[_0x8a47('0x23')];_0x18bfd3[_0x8a47('0x25')]=0x0;writeDB(_0x18bfd3);}});}catch(_0x20551b){utils['error'](util['format'](_0x8a47('0x29'),_0x12f0b7[_0x8a47('0x6')]),_0x20551b);}};exports[_0x8a47('0x2c')]=function(_0x42c5d7){try{if(agents[_0x42c5d7[_0x8a47('0x15')]]){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentconnect]',_0x42c5d7['uniqueid']),_0x42c5d7);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x2d'),_0x42c5d7[_0x8a47('0x6')],agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x9')],_0x42c5d7[_0x8a47('0x15')]));agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();agents[_0x42c5d7[_0x8a47('0x15')]]['connectedlinenum']=_0x42c5d7[_0x8a47('0xb')];agents[_0x42c5d7['destuniqueid']]['connectedlinename']=_0x42c5d7['connectedlinename'];agents[_0x42c5d7['destuniqueid']]['holdtime']=_0x42c5d7[_0x8a47('0x24')];agents[_0x42c5d7[_0x8a47('0x15')]][_0x8a47('0xc')]=_0x8a47('0x2f');_[_0x8a47('0x28')](agents,function(_0x20ba1c,_0x25c45b){if(_0x20ba1c[_0x8a47('0x15')]!=_0x42c5d7['destuniqueid']&&_0x20ba1c['uniqueid']==_0x42c5d7[_0x8a47('0x6')]){_0x20ba1c[_0x8a47('0x25')]=0x0;_0x20ba1c[_0x8a47('0x23')]=_0x42c5d7[_0x8a47('0x24')];_0x20ba1c['agentringnoanswer']=!![];_0x20ba1c[_0x8a47('0x20')]=utils[_0x8a47('0x17')]();_0x20ba1c[_0x8a47('0xc')]=_0x8a47('0x30');_0x20ba1c[_0x8a47('0x22')]='answered_elsewhere';_0x20ba1c[_0x8a47('0x31')]=_0x42c5d7[_0x8a47('0x15')];_0x20ba1c[_0x8a47('0x32')]=_0x42c5d7['membername'];writeDB(_0x20ba1c);}});}}catch(_0x2b3874){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x33'),_0x42c5d7['uniqueid']),_0x2b3874);}};exports[_0x8a47('0xe')]=function(_0x2f523f){try{if(!_[_0x8a47('0x1c')](agents[_0x2f523f[_0x8a47('0x15')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f['uniqueid']),_0x2f523f);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x34'),_0x2f523f['uniqueid'],agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x9')],_0x2f523f['destuniqueid']));agents[_0x2f523f['destuniqueid']][_0x8a47('0xe')]=!![];agents[_0x2f523f['destuniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x25')]=utils[_0x8a47('0x36')](agents[_0x2f523f[_0x8a47('0x15')]]['agentcompleteAt'],agents[_0x2f523f['destuniqueid']][_0x8a47('0x2e')]);agents[_0x2f523f[_0x8a47('0x15')]][_0x8a47('0x22')]=_0x2f523f[_0x8a47('0x22')];agents[_0x2f523f[_0x8a47('0x15')]]['lastevent']='complete';writeDB(agents[_0x2f523f[_0x8a47('0x15')]]);}}catch(_0x531faa){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')]('[%s][agents][agentcomplete]',_0x2f523f[_0x8a47('0x6')]),_0x531faa);}};exports[_0x8a47('0x37')]=function(_0x14e22c){try{if(!_[_0x8a47('0x1c')](agents[_0x14e22c[_0x8a47('0x38')]])){utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x39'),_0x14e22c['uniqueid']),_0x14e22c);utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x3a'),_0x14e22c[_0x8a47('0x6')],agents[_0x14e22c['transfereruniqueid']][_0x8a47('0x9')],agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x6')]));agents[_0x14e22c[_0x8a47('0x38')]][_0x8a47('0x3b')]=!![];agents[_0x14e22c[_0x8a47('0x38')]]['transfertype']='blind';agents[_0x14e22c[_0x8a47('0x38')]]['transferexten']=_0x14e22c[_0x8a47('0x3c')];agents[_0x14e22c[_0x8a47('0x38')]]['transferuniqueid']=agents[_0x14e22c[_0x8a47('0x38')]]['uniqueid'];}}catch(_0x315111){utils['error'](util[_0x8a47('0x4')]('[%s][agents][blindtransfer]',_0x14e22c[_0x8a47('0x6')]),_0x315111);}};exports[_0x8a47('0x3d')]=function(_0xdaa896){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0xdaa896);if(_0xdaa896[_0x8a47('0x3f')]==_0xdaa896[_0x8a47('0x40')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x41')]])){utils['info'](util[_0x8a47('0x4')](_0x8a47('0x42'),_0xdaa896['origtransfereruniqueid'],agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x46')];agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x47')]=_0xdaa896['origtransfereruniqueid'];}if(_0xdaa896[_0x8a47('0x48')]&&agents[_0xdaa896[_0x8a47('0x48')]]){agents[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x48')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x48')]]);transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0xa')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0xa')];transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x41')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x48')]]['agentcalledAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfereeuniqueid']][_0x8a47('0x2e')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x48')]][_0x8a47('0x49')]=0x2;}}else if(_0xdaa896['secondtransfereruniqueid']==_0xdaa896[_0x8a47('0x4c')]){if(!_[_0x8a47('0x1c')](agents[_0xdaa896[_0x8a47('0x3f')]])){utils['info'](util['format'](_0x8a47('0x42'),_0xdaa896[_0x8a47('0x3f')],agents[_0xdaa896['origtransfereruniqueid']][_0x8a47('0x9')]));agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x3b')]=!![];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x43')]=_0x8a47('0x44');agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x45')]=_0xdaa896[_0x8a47('0x4d')];agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x47')]=_0xdaa896[_0x8a47('0x41')];}if(_0xdaa896[_0x8a47('0x4e')]&&agents[_0xdaa896['transfertargetuniqueid']]){agents[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x1;transfers[_0xdaa896[_0x8a47('0x4e')]]=_[_0x8a47('0x4a')](agents[_0xdaa896[_0x8a47('0x4e')]]);transfers[_0xdaa896[_0x8a47('0x4e')]]['calleridnum']=agents[_0xdaa896[_0x8a47('0x3f')]]['calleridnum'];transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x4b')]=agents[_0xdaa896[_0x8a47('0x3f')]][_0x8a47('0x4b')];transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x16')]=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']]['agentconnectAt']=utils[_0x8a47('0x17')]();transfers[_0xdaa896['transfertargetuniqueid']][_0x8a47('0x23')]=0x0;transfers[_0xdaa896[_0x8a47('0x4e')]][_0x8a47('0x49')]=0x2;}}}catch(_0x39d8f4){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x3e'),_0xdaa896[_0x8a47('0x3f')]),_0x39d8f4);}};exports['hangup']=function(_0x5c1e7e){try{utils[_0x8a47('0x1d')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e['uniqueid']),_0x5c1e7e);if(agents[_0x5c1e7e['uniqueid']]&&agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]==='timeout'){if(_0x5c1e7e[_0x8a47('0x50')]==='21'){agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=_0x8a47('0x51');agents[_0x5c1e7e['uniqueid']][_0x8a47('0xc')]='rejected';}utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e['uniqueid'],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e[_0x8a47('0x6')]]);var _0x4c6dbe=unanswered[_0x8a47('0x53')](_0x5c1e7e[_0x8a47('0x6')]);if(_0x4c6dbe>-0x1){unanswered[_0x8a47('0x54')](_0x4c6dbe,0x1);}}if(transfers[_0x5c1e7e['uniqueid']]){transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xe')]=!![];transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x25')]=utils[_0x8a47('0x36')](transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],transfers[_0x5c1e7e[_0x8a47('0x6')]]['agentconnectAt']);transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')]=_0x8a47('0x55');transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5c1e7e[_0x8a47('0x6')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],transfers[_0x5c1e7e['uniqueid']][_0x8a47('0x22')],transfers[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(transfers[_0x5c1e7e[_0x8a47('0x6')]],!![]);}if(agents[_0x5c1e7e[_0x8a47('0x6')]]&&agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]){agents[_0x5c1e7e[_0x8a47('0x6')]]['agentcomplete']=!![];agents[_0x5c1e7e['uniqueid']][_0x8a47('0x35')]=utils[_0x8a47('0x17')]();agents[_0x5c1e7e[_0x8a47('0x6')]]['talktime']=utils[_0x8a47('0x36')](agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x35')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x2e')]);agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')]=agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x3b')]?_0x8a47('0x3b'):_0x8a47('0x55');agents[_0x5c1e7e[_0x8a47('0x6')]]['lastevent']=_0x8a47('0x56');utils[_0x8a47('0x3')](util[_0x8a47('0x4')](_0x8a47('0x52'),_0x5c1e7e[_0x8a47('0x6')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x9')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0x22')],agents[_0x5c1e7e[_0x8a47('0x6')]][_0x8a47('0xc')]));writeDB(agents[_0x5c1e7e['uniqueid']]);}}catch(_0x98d7ae){utils[_0x8a47('0x1a')](util[_0x8a47('0x4')](_0x8a47('0x4f'),_0x5c1e7e[_0x8a47('0x6')]),_0x98d7ae);}}; \ No newline at end of file +var _0xd404=['channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','abandoned','agentconnect','info','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','secondtransfererlinkedid','transfertargetuniqueid','calleridname','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','complete','[%s][agents][hangup]','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd404,0x15b));var _0x4d40=function(_0x1ff1da,_0x3eb6cd){_0x1ff1da=_0x1ff1da-0x0;var _0x4d0b2f=_0xd404[_0x1ff1da];return _0x4d0b2f;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xb6576c,_0x2322e5){utils['info'](util[_0x4d40('0x2')](_0x4d40('0x3'),_0xb6576c[_0x4d40('0x4')],_0xb6576c[_0x4d40('0x5')],_0xb6576c[_0x4d40('0x6')],_0xb6576c[_0x4d40('0x7')],_0xb6576c[_0x4d40('0x8')],_0xb6576c[_0x4d40('0x9')],_0xb6576c[_0x4d40('0xa')],_0xb6576c['lastevent']));if(_0xb6576c[_0x4d40('0x6')]){utils[_0x4d40('0xb')](_0xb6576c['queue'])[_0x4d40('0xc')](function(_0x5e31bc){if(_0x5e31bc){_0xb6576c['type']=_0x5e31bc[_0x4d40('0xd')];_0xb6576c[_0x4d40('0xe')]=_0xb6576c[_0x4d40('0xf')]?_0x5e31bc[_0x4d40('0x10')]:![];_0xb6576c[_0x4d40('0x11')]=_0xb6576c[_0x4d40('0xe')]?_0x5e31bc[_0x4d40('0x12')]:0x0;}utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);});}else{utils[_0x4d40('0x13')](_0x4d40('0x14'),_0xb6576c);}if(_0x2322e5){delete transfers[_0xb6576c[_0x4d40('0x4')]];}else{delete agents[_0xb6576c[_0x4d40('0x15')]];}}exports[_0x4d40('0x16')]=function(_0x5162f9){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x5162f9);agents[_0x5162f9[_0x4d40('0x15')]]=_0x5162f9;agents[_0x5162f9['destuniqueid']][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1b')]=_0x4d40('0x1c');agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0xa')]=null;agents[_0x5162f9[_0x4d40('0x15')]][_0x4d40('0x1d')]=null;utils['info'](util['format'](_0x4d40('0x1e'),_0x5162f9[_0x4d40('0x4')],agents[_0x5162f9['destuniqueid']][_0x4d40('0x7')],_0x5162f9[_0x4d40('0x15')]));}catch(_0x4eec1d){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x18'),_0x5162f9[_0x4d40('0x4')]),_0x4eec1d);}};exports['agentringnoanswer']=function(_0x57c997){try{if(!_[_0x4d40('0x20')](agents[_0x57c997[_0x4d40('0x15')]])){utils['debug'](util[_0x4d40('0x2')](_0x4d40('0x21'),_0x57c997[_0x4d40('0x4')]),_0x57c997);utils['info'](util[_0x4d40('0x2')](_0x4d40('0x22'),_0x57c997[_0x4d40('0x4')],agents[_0x57c997['destuniqueid']]['membername'],_0x57c997[_0x4d40('0x15')]));agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x23')]=!![];agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x24')]=utils['now']();agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x1b')]='timeout';agents[_0x57c997['destuniqueid']][_0x4d40('0x25')]=_0x4d40('0x26');agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x27')]=_0x57c997[_0x4d40('0x28')]?parseInt(_0x57c997[_0x4d40('0x28')])/0x3e8:0x0;agents[_0x57c997[_0x4d40('0x15')]][_0x4d40('0x29')]=0x0;unanswered[_0x4d40('0x2a')](_0x57c997[_0x4d40('0x15')]);}}catch(_0x1c0fcf){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x57c997[_0x4d40('0x4')]),_0x1c0fcf);}};exports[_0x4d40('0x2b')]=function(_0x1ac240){try{_[_0x4d40('0x2c')](agents,function(_0x598ca9,_0x18e601){if(_0x598ca9[_0x4d40('0x4')]==_0x1ac240[_0x4d40('0x4')]&&!_['includes'](unanswered,_0x598ca9[_0x4d40('0x15')])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x1ac240);utils['info'](util[_0x4d40('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ac240[_0x4d40('0x4')],_0x598ca9[_0x4d40('0x7')],_0x598ca9[_0x4d40('0x15')]));_0x598ca9[_0x4d40('0x23')]=!![];_0x598ca9['agentringnoanswerAt']=utils['now']();_0x598ca9[_0x4d40('0x1b')]=_0x4d40('0x2e');_0x598ca9[_0x4d40('0x25')]=_0x4d40('0x2e');_0x598ca9['holdtime']=_0x1ac240[_0x4d40('0x27')];_0x598ca9['talktime']=0x0;writeDB(_0x598ca9);}});}catch(_0x2fde16){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x2d'),_0x1ac240[_0x4d40('0x4')]),_0x2fde16);}};exports[_0x4d40('0x2f')]=function(_0x1d1ba9){try{if(agents[_0x1d1ba9[_0x4d40('0x15')]]){utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1d1ba9);utils[_0x4d40('0x30')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1d1ba9['uniqueid'],agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x7')],_0x1d1ba9['destuniqueid']));agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0xa')]=_0x1d1ba9['connectedlinenum'];agents[_0x1d1ba9[_0x4d40('0x15')]][_0x4d40('0x1d')]=_0x1d1ba9['connectedlinename'];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x27')]=_0x1d1ba9[_0x4d40('0x28')];agents[_0x1d1ba9['destuniqueid']][_0x4d40('0x1b')]=_0x4d40('0x32');_['forIn'](agents,function(_0x1e8427,_0x1a9586){if(_0x1e8427['destuniqueid']!=_0x1d1ba9[_0x4d40('0x15')]&&_0x1e8427[_0x4d40('0x4')]==_0x1d1ba9['uniqueid']){_0x1e8427[_0x4d40('0x29')]=0x0;_0x1e8427['holdtime']=_0x1d1ba9[_0x4d40('0x28')];_0x1e8427[_0x4d40('0x23')]=!![];_0x1e8427[_0x4d40('0x24')]=utils[_0x4d40('0x1a')]();_0x1e8427[_0x4d40('0x1b')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x25')]=_0x4d40('0x33');_0x1e8427[_0x4d40('0x34')]=_0x1d1ba9['destuniqueid'];_0x1e8427[_0x4d40('0x35')]=_0x1d1ba9[_0x4d40('0x7')];writeDB(_0x1e8427);}});}}catch(_0x1c2fa8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][agentconnect]',_0x1d1ba9[_0x4d40('0x4')]),_0x1c2fa8);}};exports['agentcomplete']=function(_0x2e7f75){try{if(!_[_0x4d40('0x20')](agents[_0x2e7f75[_0x4d40('0x15')]])){utils[_0x4d40('0x17')](util['format'](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x2e7f75);utils['info'](util[_0x4d40('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2e7f75[_0x4d40('0x4')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x7')],_0x2e7f75[_0x4d40('0x15')]));agents[_0x2e7f75['destuniqueid']][_0x4d40('0xf')]=!![];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x29')]=utils['diffTime'](agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x37')],agents[_0x2e7f75[_0x4d40('0x15')]][_0x4d40('0x31')]);agents[_0x2e7f75['destuniqueid']][_0x4d40('0x25')]=_0x2e7f75[_0x4d40('0x25')];agents[_0x2e7f75['destuniqueid']][_0x4d40('0x1b')]='complete';writeDB(agents[_0x2e7f75[_0x4d40('0x15')]]);}}catch(_0x1777e8){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')](_0x4d40('0x36'),_0x2e7f75[_0x4d40('0x4')]),_0x1777e8);}};exports[_0x4d40('0x38')]=function(_0x37b6bf){try{if(!_[_0x4d40('0x20')](agents[_0x37b6bf['transfereruniqueid']])){utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x39'),_0x37b6bf[_0x4d40('0x4')]),_0x37b6bf);utils[_0x4d40('0x30')](util['format'](_0x4d40('0x3a'),_0x37b6bf[_0x4d40('0x4')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x7')],agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x4')]));agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3c')]=!![];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x3d')]=_0x4d40('0x3e');agents[_0x37b6bf[_0x4d40('0x3b')]][_0x4d40('0x3f')]=_0x37b6bf[_0x4d40('0x40')];agents[_0x37b6bf['transfereruniqueid']][_0x4d40('0x41')]=agents[_0x37b6bf[_0x4d40('0x3b')]]['uniqueid'];}}catch(_0x1000f4){utils['error'](util[_0x4d40('0x2')]('[%s][agents][blindtransfer]',_0x37b6bf[_0x4d40('0x4')]),_0x1000f4);}};exports[_0x4d40('0x42')]=function(_0x539df4){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')](_0x4d40('0x43'),_0x539df4[_0x4d40('0x44')]),_0x539df4);if(_0x539df4[_0x4d40('0x44')]==_0x539df4[_0x4d40('0x45')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x46')]])){utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x3d')]=_0x4d40('0x48');agents[_0x539df4['secondtransfereruniqueid']][_0x4d40('0x3f')]=_0x539df4[_0x4d40('0x49')];agents[_0x539df4['secondtransfereruniqueid']]['transferuniqueid']=_0x539df4[_0x4d40('0x44')];}if(_0x539df4[_0x4d40('0x4a')]&&agents[_0x539df4['transfereeuniqueid']]){agents[_0x539df4['transfereeuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4['transfereeuniqueid']]=_[_0x4d40('0x4c')](agents[_0x539df4['transfereeuniqueid']]);transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x9')]=agents[_0x539df4[_0x4d40('0x46')]][_0x4d40('0x9')];transfers[_0x539df4[_0x4d40('0x4a')]]['calleridname']=agents[_0x539df4['secondtransfereruniqueid']]['calleridname'];transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x19')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x31')]=utils['now']();transfers[_0x539df4[_0x4d40('0x4a')]]['holdtime']=0x0;transfers[_0x539df4[_0x4d40('0x4a')]][_0x4d40('0x4b')]=0x2;}}else if(_0x539df4[_0x4d40('0x46')]==_0x539df4[_0x4d40('0x4d')]){if(!_[_0x4d40('0x20')](agents[_0x539df4[_0x4d40('0x44')]])){utils['info'](util['format'](_0x4d40('0x47'),_0x539df4[_0x4d40('0x44')],agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x7')]));agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3c')]=!![];agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x3d')]='ATTENDED';agents[_0x539df4[_0x4d40('0x44')]]['transferexten']=_0x539df4['secondtransfererexten'];agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x41')]=_0x539df4[_0x4d40('0x46')];}if(_0x539df4[_0x4d40('0x4e')]&&agents[_0x539df4[_0x4d40('0x4e')]]){agents[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4b')]=0x1;transfers[_0x539df4[_0x4d40('0x4e')]]=_[_0x4d40('0x4c')](agents[_0x539df4[_0x4d40('0x4e')]]);transfers[_0x539df4[_0x4d40('0x4e')]]['calleridnum']=agents[_0x539df4['origtransfereruniqueid']][_0x4d40('0x9')];transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x4f')]=agents[_0x539df4[_0x4d40('0x44')]][_0x4d40('0x4f')];transfers[_0x539df4['transfertargetuniqueid']]['agentcalledAt']=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x31')]=utils[_0x4d40('0x1a')]();transfers[_0x539df4['transfertargetuniqueid']][_0x4d40('0x27')]=0x0;transfers[_0x539df4[_0x4d40('0x4e')]][_0x4d40('0x4b')]=0x2;}}}catch(_0x3bce3d){utils[_0x4d40('0x1f')](util[_0x4d40('0x2')]('[%s][agents][attendedtransfer]',_0x539df4['origtransfereruniqueid']),_0x3bce3d);}};exports['hangup']=function(_0x13872b){try{utils[_0x4d40('0x17')](util[_0x4d40('0x2')]('[%s][agents][hangup]',_0x13872b[_0x4d40('0x4')]),_0x13872b);if(agents[_0x13872b[_0x4d40('0x4')]]&&agents[_0x13872b['uniqueid']]['reason']===_0x4d40('0x26')){if(_0x13872b[_0x4d40('0x50')]==='21'){agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=_0x4d40('0x51');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x51');}utils[_0x4d40('0x30')](util['format'](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b[_0x4d40('0x4')]]);var _0x7df23=unanswered['indexOf'](_0x13872b[_0x4d40('0x4')]);if(_0x7df23>-0x1){unanswered[_0x4d40('0x53')](_0x7df23,0x1);}}if(transfers[_0x13872b[_0x4d40('0x4')]]){transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];transfers[_0x13872b['uniqueid']][_0x4d40('0x37')]=utils[_0x4d40('0x1a')]();transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x29')]=utils[_0x4d40('0x54')](transfers[_0x13872b[_0x4d40('0x4')]]['agentcompleteAt'],transfers[_0x13872b[_0x4d40('0x4')]]['agentconnectAt']);transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')]=_0x4d40('0x55');transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]='complete';utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b[_0x4d40('0x4')],transfers[_0x13872b['uniqueid']][_0x4d40('0x7')],transfers[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x25')],transfers[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(transfers[_0x13872b[_0x4d40('0x4')]],!![]);}if(agents[_0x13872b['uniqueid']]&&agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]){agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0xf')]=!![];agents[_0x13872b['uniqueid']]['agentcompleteAt']=utils[_0x4d40('0x1a')]();agents[_0x13872b[_0x4d40('0x4')]]['talktime']=utils[_0x4d40('0x54')](agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x37')],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x31')]);agents[_0x13872b['uniqueid']][_0x4d40('0x25')]=agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x3c')]?_0x4d40('0x3c'):_0x4d40('0x55');agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x1b')]=_0x4d40('0x56');utils[_0x4d40('0x30')](util[_0x4d40('0x2')](_0x4d40('0x52'),_0x13872b['uniqueid'],agents[_0x13872b[_0x4d40('0x4')]][_0x4d40('0x7')],agents[_0x13872b['uniqueid']][_0x4d40('0x25')],agents[_0x13872b[_0x4d40('0x4')]]['lastevent']));writeDB(agents[_0x13872b['uniqueid']]);}}catch(_0x33b8f3){utils[_0x4d40('0x1f')](util['format'](_0x4d40('0x57'),_0x13872b[_0x4d40('0x4')]),_0x33b8f3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 74b358e..d446558 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 _0x3025=['[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','format','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','now','disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','_attended','error','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x3025,0x1c7));var _0x5302=function(_0x1915b8,_0x220304){_0x1915b8=_0x1915b8-0x0;var _0x4516f0=_0x3025[_0x1915b8];return _0x4516f0;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var utils=require(_0x5302('0x2'));var transfers=require(_0x5302('0x3'));var dispositions=[_0x5302('0x4'),_0x5302('0x5'),_0x5302('0x5'),_0x5302('0x4'),_0x5302('0x4'),'NO\x20ANSWER',_0x5302('0x6'),_0x5302('0x7'),'FAILED',_0x5302('0x5'),'FAILED'];var channels={};function writeDB(_0x41c3d6){var _0x2e9c66;if(transfers['blinds'][_0x41c3d6[_0x5302('0x8')]]){_0x2e9c66=_0x41c3d6[_0x5302('0x8')];_0x41c3d6['uniqueid']=transfers[_0x5302('0x9')][_0x41c3d6[_0x5302('0x8')]][_0x5302('0xa')];}utils[_0x5302('0xb')](util['format'](_0x5302('0xc'),_0x41c3d6[_0x5302('0x8')],_0x41c3d6[_0x5302('0xd')],_0x41c3d6[_0x5302('0xe')],_0x41c3d6['membername'],_0x41c3d6[_0x5302('0xf')],_0x41c3d6['calleridnum'],_0x41c3d6['connectedlinenum'],_0x41c3d6[_0x5302('0x10')]));if(_0x41c3d6[_0x5302('0x11')]){utils[_0x5302('0x12')](_0x41c3d6[_0x5302('0x11')])['then'](function(_0x55c129){if(_0x55c129){_0x41c3d6['UserId']=_0x55c129['id'];}utils[_0x5302('0x13')](_0x5302('0x14'),_0x41c3d6);});}else{utils['request'](_0x5302('0x14'),_0x41c3d6);}if(channels[_0x41c3d6['uniqueid']]){delete channels[_0x41c3d6['uniqueid']];}else if(_0x2e9c66&&channels[_0x2e9c66]){if(!transfers[_0x5302('0x9')][_0x2e9c66]['recording'])delete transfers[_0x5302('0x9')][_0x2e9c66];delete channels[_0x2e9c66];}}exports['newchannel']=function(_0x14a335){try{utils[_0x5302('0x15')](util['format'](_0x5302('0x16'),_0x14a335['uniqueid']),_0x14a335);if(_0x14a335[_0x5302('0x8')]==_0x14a335[_0x5302('0x17')]&&_0x14a335[_0x5302('0xd')]!='OutgoingSpoolFailed'){utils[_0x5302('0xb')](util['format'](_0x5302('0x18'),_0x14a335[_0x5302('0x8')],_0x14a335[_0x5302('0x19')],_0x14a335[_0x5302('0x1a')]));channels[_0x14a335[_0x5302('0x8')]]={'uniqueid':_0x14a335[_0x5302('0x8')],'accountcode':_0x14a335['accountcode'],'source':_0x14a335[_0x5302('0x1b')],'destination':_0x14a335[_0x5302('0x1a')],'destinationcontext':_0x14a335[_0x5302('0x19')],'channel':_0x14a335[_0x5302('0xd')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x5e33d8){utils['error'](util[_0x5302('0x1c')](_0x5302('0x16'),_0x14a335[_0x5302('0x8')]),_0x5e33d8);}};exports['newstate']=function(_0x14d863){try{utils['debug'](util['format'](_0x5302('0x1d'),_0x14d863[_0x5302('0x8')]),_0x14d863);if(!_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x8')]])&&_0x14d863[_0x5302('0x1f')]==0x6){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x20'),_0x14d863[_0x5302('0x8')],_0x14d863[_0x5302('0x19')],_0x14d863[_0x5302('0xd')]));if(_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x8')]][_0x5302('0x21')])){channels[_0x14d863[_0x5302('0x8')]]['systemanswertime']=utils['now']();}}else if(!_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x17')]])&&_0x14d863[_0x5302('0x1f')]==0x6&&_0x14d863['context']!=_0x5302('0x22')){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x23'),_0x14d863[_0x5302('0x8')],_0x14d863[_0x5302('0x17')],_0x14d863['context'],_0x14d863[_0x5302('0xd')]));channels[_0x14d863['linkedid']][_0x5302('0x11')]=_0x14d863[_0x5302('0x11')];channels[_0x14d863[_0x5302('0x17')]]['destinationchannel']=_0x14d863[_0x5302('0xd')];if(_[_0x5302('0x1e')](channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x24')])){channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x24')]=utils[_0x5302('0x25')]();}channels[_0x14d863[_0x5302('0x17')]][_0x5302('0x26')]=dispositions[_[_0x5302('0x27')](_0x14d863[_0x5302('0x1f')])]||_0x5302('0x6');}}catch(_0x540ea0){utils['error'](util[_0x5302('0x1c')](_0x5302('0x1d'),_0x14d863[_0x5302('0x8')]),_0x540ea0);}};exports['hangup']=function(_0x1ea551){try{if(!_[_0x5302('0x1e')](channels[_0x1ea551['uniqueid']])){utils[_0x5302('0x15')](util[_0x5302('0x1c')]('[%s][calls][hangup]',_0x1ea551[_0x5302('0x8')]),_0x1ea551);if(_[_0x5302('0x1e')](channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x28')])){channels[_0x1ea551['uniqueid']][_0x5302('0x28')]=_0x1ea551[_0x5302('0x29')]+'\x20<'+_0x1ea551['calleridnum']+'>';}utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x2a'),_0x1ea551[_0x5302('0x8')],channels[_0x1ea551[_0x5302('0x8')]]['callerid'],_0x1ea551['cause-txt']));channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x2b')]=utils[_0x5302('0x25')]();channels[_0x1ea551['uniqueid']]['duration']=utils[_0x5302('0x2c')](channels[_0x1ea551['uniqueid']][_0x5302('0x2b')],channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x2d')]);channels[_0x1ea551[_0x5302('0x8')]]['billableseconds']=channels[_0x1ea551['uniqueid']][_0x5302('0x24')]?utils[_0x5302('0x2c')](channels[_0x1ea551[_0x5302('0x8')]]['endtime'],channels[_0x1ea551[_0x5302('0x8')]][_0x5302('0x24')]):0x0;writeDB(channels[_0x1ea551[_0x5302('0x8')]]);}}catch(_0x557a36){utils['error'](util['format'](_0x5302('0x2e'),_0x1ea551[_0x5302('0x8')]),_0x557a36);}};exports[_0x5302('0x2f')]=function(_0x20f3ad){try{if(!_[_0x5302('0x1e')](channels[_0x20f3ad[_0x5302('0x30')]])){utils[_0x5302('0x15')](util[_0x5302('0x1c')](_0x5302('0x31'),_0x20f3ad['origtransfereruniqueid']),_0x20f3ad);if(channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0xd')]==_0x20f3ad[_0x5302('0x32')]){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x33'),_0x20f3ad['origtransfereruniqueid'],_0x20f3ad[_0x5302('0x30')],_0x20f3ad[_0x5302('0x34')]));channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x35')]=_0x20f3ad[_0x5302('0x34')];channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x36')]='_attended';}else if(channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0xd')]=_0x20f3ad[_0x5302('0x37')]){utils['info'](util[_0x5302('0x1c')](_0x5302('0x33'),_0x20f3ad[_0x5302('0x38')],_0x20f3ad[_0x5302('0x30')],_0x20f3ad['origtransfererchannel']));channels[_0x20f3ad[_0x5302('0x30')]][_0x5302('0x35')]=_0x20f3ad[_0x5302('0x39')];channels[_0x20f3ad[_0x5302('0x30')]]['userfield']=_0x5302('0x3a');}}}catch(_0x263946){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x31'),_0x20f3ad[_0x5302('0x38')]),_0x263946);}};exports[_0x5302('0x3c')]=function(_0x3f0e21){try{if(!_['isNil'](channels[_0x3f0e21[_0x5302('0x8')]])){utils['debug'](util[_0x5302('0x1c')](_0x5302('0x3d'),_0x3f0e21[_0x5302('0x8')]),_0x3f0e21);channels[_0x3f0e21[_0x5302('0x8')]][_0x5302('0x3e')]=utils[_0x5302('0x25')]();utils['info'](util[_0x5302('0x1c')](_0x5302('0x3f'),_0x3f0e21[_0x5302('0x8')],channels[_0x3f0e21[_0x5302('0x8')]][_0x5302('0x3e')]));}}catch(_0x2a0c23){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x3d'),_0x3f0e21['uniqueid']),_0x2a0c23);}};exports[_0x5302('0x40')]=function(_0x51fe90){try{if(!_[_0x5302('0x1e')](channels[_0x51fe90[_0x5302('0x8')]])){utils['debug'](util[_0x5302('0x1c')]('[%s][calls][musiconholdstop]',_0x51fe90['uniqueid']),_0x51fe90);if(!_[_0x5302('0x1e')](channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x3e')])){channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x41')]+=utils['diffTime'](utils[_0x5302('0x25')](),channels[_0x51fe90[_0x5302('0x8')]][_0x5302('0x3e')]);utils['info'](util[_0x5302('0x1c')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x51fe90[_0x5302('0x8')],channels[_0x51fe90['uniqueid']][_0x5302('0x41')]));delete channels[_0x51fe90[_0x5302('0x8')]]['musiconholdstartAt'];}}}catch(_0x2ccdba){utils[_0x5302('0x3b')](util['format'](_0x5302('0x42'),_0x51fe90[_0x5302('0x8')]),_0x2ccdba);}};exports[_0x5302('0x43')]=function(_0x3debd3){try{if(!_[_0x5302('0x1e')](channels[_0x3debd3['uniqueid']])){utils['debug'](util[_0x5302('0x1c')](_0x5302('0x44'),_0x3debd3[_0x5302('0x8')]),_0x3debd3);if(!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x46')])){utils['info'](util[_0x5302('0x1c')](_0x5302('0x47'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x49')]=_0x3debd3['value'];}if(!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')]['xmd-phone'])){utils[_0x5302('0xb')](util['format'](_0x5302('0x4a'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['destination']=_0x3debd3[_0x5302('0x48')];channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x28')]='\x22'+_0x3debd3[_0x5302('0x48')]+_0x5302('0x4b')+_0x3debd3[_0x5302('0x48')]+'>';}if(!_['isNil'](_0x3debd3['variable'][_0x5302('0x4c')])||!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x4d')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x4e'),_0x3debd3['uniqueid'],!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x4c')])?_0x5302('0x4c'):'xmd-callerid',_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['callerid']=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3[_0x5302('0x45')][_0x5302('0x4f')])||!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x50')])){utils['info'](util[_0x5302('0x1c')](_0x5302('0x4e'),_0x3debd3[_0x5302('0x8')],!_[_0x5302('0x1e')](_0x3debd3['variable'][_0x5302('0x4f')])?_0x5302('0x4f'):_0x5302('0x50'),_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x51')]=_0x5302('0x52');channels[_0x3debd3['uniqueid']][_0x5302('0x53')]=_0x3debd3[_0x5302('0x48')];channels[_0x3debd3['uniqueid']][_0x5302('0xe')]=!![];}if(!_[_0x5302('0x1e')](_0x3debd3[_0x5302('0x45')][_0x5302('0x54')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x55'),_0x3debd3['uniqueid'],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x56')]=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3['variable'][_0x5302('0x57')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x58'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['type']=_0x3debd3[_0x5302('0x48')];}if(!_[_0x5302('0x1e')](_0x3debd3['variable'][_0x5302('0x59')])){utils[_0x5302('0xb')](util[_0x5302('0x1c')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]][_0x5302('0x5a')]=_0x3debd3[_0x5302('0x48')];}if(!_['isNil'](_0x3debd3['variable']['sipcallid'])){utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x5b'),_0x3debd3[_0x5302('0x8')],_0x3debd3[_0x5302('0x48')]));channels[_0x3debd3[_0x5302('0x8')]]['sipcallid']=_0x3debd3[_0x5302('0x48')];}}}catch(_0x22c2bf){utils['error'](util[_0x5302('0x1c')](_0x5302('0x44'),_0x3debd3[_0x5302('0x8')]),_0x22c2bf);}};exports[_0x5302('0x5c')]=function(_0x317556){try{if(!_[_0x5302('0x1e')](channels[_0x317556['uniqueid']])){utils[_0x5302('0x15')](util[_0x5302('0x1c')](_0x5302('0x5d'),_0x317556[_0x5302('0x8')]),_0x317556);utils[_0x5302('0xb')](util[_0x5302('0x1c')](_0x5302('0x5e'),_0x317556[_0x5302('0x8')],_0x317556[_0x5302('0x5f')],_0x317556['appdata']));if(_0x317556[_0x5302('0x5f')][_0x5302('0x60')]()==_0x5302('0x61')&&_[_0x5302('0x62')](_0x317556['appdata']['toLowerCase'](),_0x5302('0x63'))){var _0xf2564d=_0x317556[_0x5302('0x64')][_0x5302('0x65')]('=');var _0x3a06d5=_0xf2564d[0x0][_0x5302('0x66')](_0xf2564d[0x0][_0x5302('0x67')]('(')+0x1,_0xf2564d[0x0][_0x5302('0x67')](')'));var _0x10fad5=_0xf2564d[0x1];channels[_0x317556[_0x5302('0x8')]][_0x3a06d5]=_0x10fad5;}if(!_[_0x5302('0x68')](['hangup',_0x5302('0x69'),_0x5302('0x6a'),'set',_0x5302('0x6b')],_0x317556[_0x5302('0x5f')][_0x5302('0x60')]())){channels[_0x317556[_0x5302('0x8')]]['lastapplication']=_0x317556[_0x5302('0x5f')];channels[_0x317556[_0x5302('0x8')]][_0x5302('0x53')]=_0x317556[_0x5302('0x64')];}}}catch(_0x40331c){utils[_0x5302('0x3b')](util[_0x5302('0x1c')](_0x5302('0x5d'),_0x317556[_0x5302('0x8')]),_0x40331c);}}; \ No newline at end of file +var _0x4bd3=['callerid','cause-txt','endtime','starttime','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','./utils','./transfers.controller','NO\x20ANSWER','BUSY','FAILED','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','now','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bd3,0x174));var _0x34bd=function(_0x5f3117,_0x344b24){_0x5f3117=_0x5f3117-0x0;var _0x14a451=_0x4bd3[_0x5f3117];return _0x14a451;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var utils=require(_0x34bd('0x1'));var transfers=require(_0x34bd('0x2'));var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x34bd('0x3'),_0x34bd('0x3'),_0x34bd('0x3'),'ANSWERED',_0x34bd('0x4'),_0x34bd('0x5'),'FAILED',_0x34bd('0x5')];var channels={};function writeDB(_0x213716){var _0x51a4d7;if(transfers[_0x34bd('0x6')][_0x213716[_0x34bd('0x7')]]){_0x51a4d7=_0x213716[_0x34bd('0x7')];_0x213716[_0x34bd('0x7')]=transfers[_0x34bd('0x6')][_0x213716[_0x34bd('0x7')]]['transfereeuniqueid'];}utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0xa'),_0x213716[_0x34bd('0x7')],_0x213716['channel'],_0x213716['queue'],_0x213716[_0x34bd('0xb')],_0x213716['interface'],_0x213716['calleridnum'],_0x213716[_0x34bd('0xc')],_0x213716[_0x34bd('0xd')]));if(_0x213716[_0x34bd('0xe')]){utils[_0x34bd('0xf')](_0x213716[_0x34bd('0xe')])[_0x34bd('0x10')](function(_0x4134ee){if(_0x4134ee){_0x213716[_0x34bd('0x11')]=_0x4134ee['id'];}utils[_0x34bd('0x12')]('CreateVoiceCallReport',_0x213716);});}else{utils[_0x34bd('0x12')]('CreateVoiceCallReport',_0x213716);}if(channels[_0x213716['uniqueid']]){delete channels[_0x213716[_0x34bd('0x7')]];}else if(_0x51a4d7&&channels[_0x51a4d7]){if(!transfers[_0x34bd('0x6')][_0x51a4d7][_0x34bd('0x13')])delete transfers[_0x34bd('0x6')][_0x51a4d7];delete channels[_0x51a4d7];}}exports[_0x34bd('0x14')]=function(_0x1643af){try{utils[_0x34bd('0x15')](util[_0x34bd('0x9')](_0x34bd('0x16'),_0x1643af[_0x34bd('0x7')]),_0x1643af);if(_0x1643af[_0x34bd('0x7')]==_0x1643af['linkedid']&&_0x1643af[_0x34bd('0x17')]!=_0x34bd('0x18')){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x19'),_0x1643af[_0x34bd('0x7')],_0x1643af[_0x34bd('0x1a')],_0x1643af[_0x34bd('0x1b')]));channels[_0x1643af[_0x34bd('0x7')]]={'uniqueid':_0x1643af['uniqueid'],'accountcode':_0x1643af[_0x34bd('0xe')],'source':_0x1643af[_0x34bd('0x1c')],'destination':_0x1643af[_0x34bd('0x1b')],'destinationcontext':_0x1643af[_0x34bd('0x1a')],'channel':_0x1643af[_0x34bd('0x17')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x4edf84){utils[_0x34bd('0x1d')](util['format'](_0x34bd('0x16'),_0x1643af[_0x34bd('0x7')]),_0x4edf84);}};exports[_0x34bd('0x1e')]=function(_0x5c3c85){try{utils[_0x34bd('0x15')](util[_0x34bd('0x9')](_0x34bd('0x1f'),_0x5c3c85[_0x34bd('0x7')]),_0x5c3c85);if(!_['isNil'](channels[_0x5c3c85[_0x34bd('0x7')]])&&_0x5c3c85[_0x34bd('0x20')]==0x6){utils[_0x34bd('0x8')](util[_0x34bd('0x9')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x5c3c85[_0x34bd('0x7')],_0x5c3c85[_0x34bd('0x1a')],_0x5c3c85['channel']));if(_[_0x34bd('0x21')](channels[_0x5c3c85[_0x34bd('0x7')]][_0x34bd('0x22')])){channels[_0x5c3c85[_0x34bd('0x7')]][_0x34bd('0x22')]=utils[_0x34bd('0x23')]();}}else if(!_[_0x34bd('0x21')](channels[_0x5c3c85['linkedid']])&&_0x5c3c85[_0x34bd('0x20')]==0x6&&_0x5c3c85[_0x34bd('0x1a')]!='transfer'){utils['info'](util[_0x34bd('0x9')](_0x34bd('0x24'),_0x5c3c85[_0x34bd('0x7')],_0x5c3c85['linkedid'],_0x5c3c85['context'],_0x5c3c85[_0x34bd('0x17')]));channels[_0x5c3c85[_0x34bd('0x25')]][_0x34bd('0xe')]=_0x5c3c85[_0x34bd('0xe')];channels[_0x5c3c85['linkedid']][_0x34bd('0x26')]=_0x5c3c85[_0x34bd('0x17')];if(_[_0x34bd('0x21')](channels[_0x5c3c85[_0x34bd('0x25')]][_0x34bd('0x27')])){channels[_0x5c3c85[_0x34bd('0x25')]]['answertime']=utils[_0x34bd('0x23')]();}channels[_0x5c3c85['linkedid']][_0x34bd('0x28')]=dispositions[_[_0x34bd('0x29')](_0x5c3c85[_0x34bd('0x20')])]||'ANSWERED';}}catch(_0x2ff72e){utils[_0x34bd('0x1d')](util['format'](_0x34bd('0x1f'),_0x5c3c85[_0x34bd('0x7')]),_0x2ff72e);}};exports[_0x34bd('0x2a')]=function(_0x4d0a02){try{if(!_[_0x34bd('0x21')](channels[_0x4d0a02[_0x34bd('0x7')]])){utils['debug'](util[_0x34bd('0x9')](_0x34bd('0x2b'),_0x4d0a02[_0x34bd('0x7')]),_0x4d0a02);if(_[_0x34bd('0x21')](channels[_0x4d0a02[_0x34bd('0x7')]][_0x34bd('0x2c')])){channels[_0x4d0a02['uniqueid']]['callerid']=_0x4d0a02['calleridname']+'\x20<'+_0x4d0a02[_0x34bd('0x1c')]+'>';}utils[_0x34bd('0x8')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x4d0a02[_0x34bd('0x7')],channels[_0x4d0a02['uniqueid']]['callerid'],_0x4d0a02[_0x34bd('0x2d')]));channels[_0x4d0a02[_0x34bd('0x7')]][_0x34bd('0x2e')]=utils[_0x34bd('0x23')]();channels[_0x4d0a02[_0x34bd('0x7')]]['duration']=utils['diffTime'](channels[_0x4d0a02[_0x34bd('0x7')]]['endtime'],channels[_0x4d0a02[_0x34bd('0x7')]][_0x34bd('0x2f')]);channels[_0x4d0a02[_0x34bd('0x7')]][_0x34bd('0x30')]=channels[_0x4d0a02[_0x34bd('0x7')]]['answertime']?utils[_0x34bd('0x31')](channels[_0x4d0a02[_0x34bd('0x7')]][_0x34bd('0x2e')],channels[_0x4d0a02[_0x34bd('0x7')]]['answertime']):0x0;writeDB(channels[_0x4d0a02[_0x34bd('0x7')]]);}}catch(_0x55e2d4){utils[_0x34bd('0x1d')](util[_0x34bd('0x9')]('[%s][calls][hangup]',_0x4d0a02[_0x34bd('0x7')]),_0x55e2d4);}};exports['attendedtransfer']=function(_0x1bd8d8){try{if(!_[_0x34bd('0x21')](channels[_0x1bd8d8[_0x34bd('0x32')]])){utils[_0x34bd('0x15')](util[_0x34bd('0x9')](_0x34bd('0x33'),_0x1bd8d8[_0x34bd('0x34')]),_0x1bd8d8);if(channels[_0x1bd8d8['localtwolinkedid']]['channel']==_0x1bd8d8['transfereechannel']){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x35'),_0x1bd8d8[_0x34bd('0x34')],_0x1bd8d8['localtwolinkedid'],_0x1bd8d8[_0x34bd('0x36')]));channels[_0x1bd8d8[_0x34bd('0x32')]][_0x34bd('0x26')]=_0x1bd8d8[_0x34bd('0x36')];channels[_0x1bd8d8[_0x34bd('0x32')]]['userfield']=_0x34bd('0x37');}else if(channels[_0x1bd8d8['localtwolinkedid']]['channel']=_0x1bd8d8[_0x34bd('0x38')]){utils['info'](util[_0x34bd('0x9')](_0x34bd('0x35'),_0x1bd8d8[_0x34bd('0x34')],_0x1bd8d8[_0x34bd('0x32')],_0x1bd8d8[_0x34bd('0x39')]));channels[_0x1bd8d8['localtwolinkedid']]['destinationchannel']=_0x1bd8d8[_0x34bd('0x39')];channels[_0x1bd8d8['localtwolinkedid']][_0x34bd('0x3a')]=_0x34bd('0x37');}}}catch(_0x23b29){utils['error'](util['format']('[%s][calls][attendedtransfer]',_0x1bd8d8['origtransfereruniqueid']),_0x23b29);}};exports[_0x34bd('0x3b')]=function(_0x510c27){try{if(!_[_0x34bd('0x21')](channels[_0x510c27['uniqueid']])){utils[_0x34bd('0x15')](util[_0x34bd('0x9')](_0x34bd('0x3c'),_0x510c27[_0x34bd('0x7')]),_0x510c27);channels[_0x510c27[_0x34bd('0x7')]]['musiconholdstartAt']=utils[_0x34bd('0x23')]();utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x3d'),_0x510c27[_0x34bd('0x7')],channels[_0x510c27['uniqueid']][_0x34bd('0x3e')]));}}catch(_0x3bfd9d){utils['error'](util[_0x34bd('0x9')](_0x34bd('0x3c'),_0x510c27['uniqueid']),_0x3bfd9d);}};exports['musiconholdstop']=function(_0x37ac16){try{if(!_['isNil'](channels[_0x37ac16['uniqueid']])){utils[_0x34bd('0x15')](util[_0x34bd('0x9')]('[%s][calls][musiconholdstop]',_0x37ac16['uniqueid']),_0x37ac16);if(!_['isNil'](channels[_0x37ac16['uniqueid']][_0x34bd('0x3e')])){channels[_0x37ac16[_0x34bd('0x7')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x37ac16[_0x34bd('0x7')]][_0x34bd('0x3e')]);utils['info'](util[_0x34bd('0x9')](_0x34bd('0x3f'),_0x37ac16[_0x34bd('0x7')],channels[_0x37ac16[_0x34bd('0x7')]][_0x34bd('0x40')]));delete channels[_0x37ac16[_0x34bd('0x7')]]['musiconholdstartAt'];}}}catch(_0x3241e1){utils[_0x34bd('0x1d')](util[_0x34bd('0x9')](_0x34bd('0x41'),_0x37ac16['uniqueid']),_0x3241e1);}};exports[_0x34bd('0x42')]=function(_0x5235e4){try{if(!_[_0x34bd('0x21')](channels[_0x5235e4['uniqueid']])){utils[_0x34bd('0x15')](util[_0x34bd('0x9')](_0x34bd('0x43'),_0x5235e4[_0x34bd('0x7')]),_0x5235e4);if(!_[_0x34bd('0x21')](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x45')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x46'),_0x5235e4[_0x34bd('0x7')],_0x5235e4['value']));channels[_0x5235e4[_0x34bd('0x7')]]['source']=_0x5235e4[_0x34bd('0x47')];}if(!_['isNil'](_0x5235e4[_0x34bd('0x44')]['xmd-phone'])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x48'),_0x5235e4[_0x34bd('0x7')],_0x5235e4[_0x34bd('0x47')]));channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x49')]=_0x5235e4[_0x34bd('0x47')];channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x2c')]='\x22'+_0x5235e4[_0x34bd('0x47')]+_0x34bd('0x4a')+_0x5235e4[_0x34bd('0x47')]+'>';}if(!_[_0x34bd('0x21')](_0x5235e4[_0x34bd('0x44')]['xmd-callerid-preview'])||!_['isNil'](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x4b')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x4c'),_0x5235e4['uniqueid'],!_['isNil'](_0x5235e4['variable']['xmd-callerid-preview'])?_0x34bd('0x4d'):_0x34bd('0x4b'),_0x5235e4['value']));channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x2c')]=_0x5235e4[_0x34bd('0x47')];}if(!_['isNil'](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x4e')])||!_[_0x34bd('0x21')](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x4f')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x4c'),_0x5235e4['uniqueid'],!_['isNil'](_0x5235e4[_0x34bd('0x44')]['xmd-queue'])?_0x34bd('0x4e'):_0x34bd('0x4f'),_0x5235e4[_0x34bd('0x47')]));channels[_0x5235e4['uniqueid']]['lastapplication']=_0x34bd('0x50');channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x51')]=_0x5235e4['value'];channels[_0x5235e4['uniqueid']][_0x34bd('0x52')]=!![];}if(!_[_0x34bd('0x21')](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x53')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x54'),_0x5235e4[_0x34bd('0x7')],_0x5235e4[_0x34bd('0x47')]));channels[_0x5235e4['uniqueid']]['ContactId']=_0x5235e4[_0x34bd('0x47')];}if(!_['isNil'](_0x5235e4[_0x34bd('0x44')][_0x34bd('0x55')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5235e4['uniqueid'],_0x5235e4[_0x34bd('0x47')]));channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x56')]=_0x5235e4['value'];}if(!_[_0x34bd('0x21')](_0x5235e4['variable'][_0x34bd('0x57')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5235e4[_0x34bd('0x7')],_0x5235e4['value']));channels[_0x5235e4['uniqueid']][_0x34bd('0x58')]=_0x5235e4[_0x34bd('0x47')];}if(!_[_0x34bd('0x21')](_0x5235e4['variable'][_0x34bd('0x59')])){utils[_0x34bd('0x8')](util[_0x34bd('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5235e4[_0x34bd('0x7')],_0x5235e4[_0x34bd('0x47')]));channels[_0x5235e4[_0x34bd('0x7')]][_0x34bd('0x59')]=_0x5235e4[_0x34bd('0x47')];}}}catch(_0xbb9b5d){utils[_0x34bd('0x1d')](util[_0x34bd('0x9')](_0x34bd('0x43'),_0x5235e4[_0x34bd('0x7')]),_0xbb9b5d);}};exports[_0x34bd('0x5a')]=function(_0x59e377){try{if(!_[_0x34bd('0x21')](channels[_0x59e377['uniqueid']])){utils[_0x34bd('0x15')](util['format'](_0x34bd('0x5b'),_0x59e377[_0x34bd('0x7')]),_0x59e377);utils[_0x34bd('0x8')](util[_0x34bd('0x9')](_0x34bd('0x5c'),_0x59e377[_0x34bd('0x7')],_0x59e377[_0x34bd('0x5d')],_0x59e377[_0x34bd('0x5e')]));if(_0x59e377[_0x34bd('0x5d')][_0x34bd('0x5f')]()=='set'&&_['startsWith'](_0x59e377[_0x34bd('0x5e')][_0x34bd('0x5f')](),_0x34bd('0x60'))){var _0x5b60b4=_0x59e377['appdata']['split']('=');var _0x278e21=_0x5b60b4[0x0][_0x34bd('0x61')](_0x5b60b4[0x0][_0x34bd('0x62')]('(')+0x1,_0x5b60b4[0x0][_0x34bd('0x62')](')'));var _0x7fef8b=_0x5b60b4[0x1];channels[_0x59e377['uniqueid']][_0x278e21]=_0x7fef8b;}if(!_[_0x34bd('0x63')](['hangup',_0x34bd('0x64'),_0x34bd('0x65'),'set',_0x34bd('0x66')],_0x59e377['application'][_0x34bd('0x5f')]())){channels[_0x59e377['uniqueid']][_0x34bd('0x67')]=_0x59e377['application'];channels[_0x59e377[_0x34bd('0x7')]][_0x34bd('0x51')]=_0x59e377[_0x34bd('0x5e')];}}}catch(_0x35d257){utils[_0x34bd('0x1d')](util[_0x34bd('0x9')](_0x34bd('0x5b'),_0x59e377[_0x34bd('0x7')]),_0x35d257);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a67a869..adcc3b6 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 _0xccc2=['info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x456a76,_0x3fb41e){var _0x311207=function(_0x49151e){while(--_0x49151e){_0x456a76['push'](_0x456a76['shift']());}};_0x311207(++_0x3fb41e);}(_0xccc2,0xb9));var _0x2ccc=function(_0x41669a,_0x56a70f){_0x41669a=_0x41669a-0x0;var _0x427693=_0xccc2[_0x41669a];return _0x427693;};'use strict';var utils=require(_0x2ccc('0x0'));exports[_0x2ccc('0x1')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x3'));};exports[_0x2ccc('0x4')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x5'));};exports['fullybooted']=function(){utils['info'](_0x2ccc('0x6'));};exports['error']=function(_0x4f601c){utils[_0x2ccc('0x7')]('[core]\x20error',_0x4f601c);};exports[_0x2ccc('0x8')]=function(){utils[_0x2ccc('0x2')](_0x2ccc('0x9'));};exports[_0x2ccc('0xa')]=function(_0x575528){}; \ No newline at end of file +var _0xfad1=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xfad1,0xce));var _0x1fad=function(_0x3ab3e3,_0x5825d8){_0x3ab3e3=_0x3ab3e3-0x0;var _0x247e3d=_0xfad1[_0x3ab3e3];return _0x247e3d;};'use strict';var utils=require(_0x1fad('0x0'));exports[_0x1fad('0x1')]=function(){utils[_0x1fad('0x2')](_0x1fad('0x3'));};exports[_0x1fad('0x4')]=function(){utils[_0x1fad('0x2')](_0x1fad('0x5'));};exports[_0x1fad('0x6')]=function(){utils[_0x1fad('0x2')]('[core]\x20fullybooted');};exports[_0x1fad('0x7')]=function(_0x4c2b5d){utils[_0x1fad('0x7')](_0x1fad('0x8'),_0x4c2b5d);};exports[_0x1fad('0x9')]=function(){utils[_0x1fad('0x2')](_0x1fad('0xa'));};exports[_0x1fad('0xb')]=function(_0x22f859){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4d99dfc..d212bcc 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 _0x5465=['connectedlinenum','dialstatus','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','debug','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','calleridnum','calleridname','cause-txt','complete','duration','diffTime','billableseconds','endtime','[%s][dials][hangup]','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x5465,0x18f));var _0x5546=function(_0x497cd6,_0x4e8d01){_0x497cd6=_0x497cd6-0x0;var _0xf2b10b=_0x5465[_0x497cd6];return _0xf2b10b;};'use strict';var _=require(_0x5546('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0xfb5a69){utils[_0x5546('0x1')](util[_0x5546('0x2')](_0x5546('0x3'),_0xfb5a69[_0x5546('0x4')],_0xfb5a69['channel'],_0xfb5a69[_0x5546('0x5')],_0xfb5a69['calleridnum'],_0xfb5a69[_0x5546('0x6')],_0xfb5a69[_0x5546('0x7')]));utils['request']('CreateVoiceDialReport',_0xfb5a69);delete dials[_0xfb5a69[_0x5546('0x4')]];}exports['newexten']=function(_0x2893a5){try{utils['debug'](util[_0x5546('0x2')](_0x5546('0x8'),_0x2893a5[_0x5546('0x4')]),_0x2893a5);utils[_0x5546('0x1')](util['format'](_0x5546('0x9'),_0x2893a5[_0x5546('0x4')],_0x2893a5[_0x5546('0xa')],_0x2893a5[_0x5546('0xb')]));if(_0x2893a5[_0x5546('0xa')][_0x5546('0xc')]()=='set'&&_['startsWith'](_0x2893a5[_0x5546('0xb')][_0x5546('0xc')](),_0x5546('0xd'))){var _0x4a0659=_0x2893a5['appdata'][_0x5546('0xe')]('=');dials[_0x2893a5[_0x5546('0x4')]]={'routeId':_0x4a0659[0x1]};}}catch(_0x143887){utils['error'](util[_0x5546('0x2')](_0x5546('0x8'),_0x2893a5[_0x5546('0x4')]),_0x143887);}};exports[_0x5546('0xf')]=function(_0x38af67){try{utils['debug'](util[_0x5546('0x2')](_0x5546('0x10'),_0x38af67[_0x5546('0x4')]),_0x38af67);if(!_[_0x5546('0x11')](_0x38af67[_0x5546('0x12')][_0x5546('0x13')])){utils[_0x5546('0x1')](util[_0x5546('0x2')](_0x5546('0x14'),_0x38af67['uniqueid'],_0x38af67[_0x5546('0x15')]));dials[_0x38af67[_0x5546('0x4')]]={'routeId':_0x38af67[_0x5546('0x15')]};}}catch(_0x3a9159){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][varset]',_0x38af67[_0x5546('0x4')]),_0x3a9159);}};exports[_0x5546('0x17')]=function(_0x34995e){try{if(!_[_0x5546('0x11')](dials[_0x34995e[_0x5546('0x4')]])){utils[_0x5546('0x18')](util[_0x5546('0x2')](_0x5546('0x19'),_0x34995e[_0x5546('0x4')]),_0x34995e);dials[_0x34995e[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0x34995e[_0x5546('0x4')]],_0x34995e);dials[_0x34995e[_0x5546('0x4')]][_0x5546('0x1b')]=utils[_0x5546('0x1c')]();dials[_0x34995e[_0x5546('0x4')]][_0x5546('0x1d')]=_0x5546('0x1e');utils[_0x5546('0x1')](util['format'](_0x5546('0x1f'),_0x34995e[_0x5546('0x4')],dials[_0x34995e[_0x5546('0x4')]]['starttime']));}}catch(_0x5dd1fd){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][dialbegin]',_0x34995e[_0x5546('0x4')]),_0x5dd1fd);}};exports[_0x5546('0x20')]=function(_0xc37e22){try{if(!_[_0x5546('0x11')](dials[_0xc37e22[_0x5546('0x4')]])){utils['debug'](util[_0x5546('0x2')](_0x5546('0x21'),_0xc37e22[_0x5546('0x4')]),_0xc37e22);dials[_0xc37e22[_0x5546('0x4')]][_0x5546('0x7')]=_0xc37e22['dialstatus'];if(_0xc37e22[_0x5546('0x7')]=='ANSWER'){dials[_0xc37e22[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0xc37e22[_0x5546('0x4')]],_0xc37e22);dials[_0xc37e22['uniqueid']][_0x5546('0x22')]=utils[_0x5546('0x1c')]();dials[_0xc37e22[_0x5546('0x4')]]['lastevent']=_0x5546('0x23');utils[_0x5546('0x1')](util[_0x5546('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0xc37e22['uniqueid'],_0xc37e22['dialstatus'],dials[_0xc37e22[_0x5546('0x4')]][_0x5546('0x22')]));}else{utils[_0x5546('0x1')](util[_0x5546('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0xc37e22['uniqueid'],_0xc37e22['dialstatus']));}}}catch(_0x1b56bc){utils[_0x5546('0x16')](util[_0x5546('0x2')]('[%s][dials][dialend]',_0xc37e22[_0x5546('0x4')]),_0x1b56bc);}};exports['hangup']=function(_0x28914a){try{if(!_[_0x5546('0x11')](dials[_0x28914a[_0x5546('0x4')]])){utils[_0x5546('0x18')](util[_0x5546('0x2')]('[%s][dials][hangup]',_0x28914a[_0x5546('0x4')]),_0x28914a);utils[_0x5546('0x1')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x28914a[_0x5546('0x4')],_0x28914a[_0x5546('0x24')],_0x28914a[_0x5546('0x25')],_0x28914a[_0x5546('0x26')]));dials[_0x28914a[_0x5546('0x4')]]=_[_0x5546('0x1a')](dials[_0x28914a[_0x5546('0x4')]],{'endtime':utils[_0x5546('0x1c')](),'lastevent':_0x5546('0x27')});dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x28')]=utils[_0x5546('0x29')](dials[_0x28914a[_0x5546('0x4')]]['endtime'],dials[_0x28914a[_0x5546('0x4')]]['starttime']);dials[_0x28914a[_0x5546('0x4')]]['holdtime']=utils[_0x5546('0x29')](dials[_0x28914a['uniqueid']][_0x5546('0x22')]||dials[_0x28914a[_0x5546('0x4')]]['endtime'],dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x1b')]);dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x2a')]=dials[_0x28914a[_0x5546('0x4')]]['answertime']?utils[_0x5546('0x29')](dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x2b')],dials[_0x28914a[_0x5546('0x4')]][_0x5546('0x22')]):0x0;writeDB(dials[_0x28914a[_0x5546('0x4')]]);}}catch(_0x2ce0fa){utils[_0x5546('0x16')](util[_0x5546('0x2')](_0x5546('0x2c'),_0x28914a[_0x5546('0x4')]),_0x2ce0fa);}}; \ No newline at end of file +var _0x579c=['[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr(routeid)','error','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','dialend'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x579c,0x109));var _0xc579=function(_0x210729,_0x48136d){_0x210729=_0x210729-0x0;var _0x7687ee=_0x579c[_0x210729];return _0x7687ee;};'use strict';var _=require('lodash');var util=require(_0xc579('0x0'));var utils=require(_0xc579('0x1'));var dials={};function writeDB(_0x3cba05){utils[_0xc579('0x2')](util['format'](_0xc579('0x3'),_0x3cba05[_0xc579('0x4')],_0x3cba05['channel'],_0x3cba05[_0xc579('0x5')],_0x3cba05[_0xc579('0x6')],_0x3cba05[_0xc579('0x7')],_0x3cba05['dialstatus']));utils[_0xc579('0x8')](_0xc579('0x9'),_0x3cba05);delete dials[_0x3cba05['uniqueid']];}exports[_0xc579('0xa')]=function(_0x501dcf){try{utils['debug'](util[_0xc579('0xb')](_0xc579('0xc'),_0x501dcf[_0xc579('0x4')]),_0x501dcf);utils['info'](util[_0xc579('0xb')](_0xc579('0xd'),_0x501dcf[_0xc579('0x4')],_0x501dcf[_0xc579('0xe')],_0x501dcf[_0xc579('0xf')]));if(_0x501dcf[_0xc579('0xe')]['toLowerCase']()==_0xc579('0x10')&&_[_0xc579('0x11')](_0x501dcf['appdata']['toLowerCase'](),_0xc579('0x12'))){var _0x5e28a5=_0x501dcf[_0xc579('0xf')]['split']('=');dials[_0x501dcf[_0xc579('0x4')]]={'routeId':_0x5e28a5[0x1]};}}catch(_0x5f5dae){utils[_0xc579('0x13')](util[_0xc579('0xb')](_0xc579('0xc'),_0x501dcf[_0xc579('0x4')]),_0x5f5dae);}};exports[_0xc579('0x14')]=function(_0x24e095){try{utils[_0xc579('0x15')](util[_0xc579('0xb')](_0xc579('0x16'),_0x24e095[_0xc579('0x4')]),_0x24e095);if(!_[_0xc579('0x17')](_0x24e095[_0xc579('0x18')][_0xc579('0x19')])){utils[_0xc579('0x2')](util['format'](_0xc579('0x1a'),_0x24e095[_0xc579('0x4')],_0x24e095[_0xc579('0x1b')]));dials[_0x24e095['uniqueid']]={'routeId':_0x24e095[_0xc579('0x1b')]};}}catch(_0x4a1e3f){utils[_0xc579('0x13')](util[_0xc579('0xb')]('[%s][dials][varset]',_0x24e095[_0xc579('0x4')]),_0x4a1e3f);}};exports[_0xc579('0x1c')]=function(_0x28cb70){try{if(!_[_0xc579('0x17')](dials[_0x28cb70[_0xc579('0x4')]])){utils[_0xc579('0x15')](util[_0xc579('0xb')](_0xc579('0x1d'),_0x28cb70[_0xc579('0x4')]),_0x28cb70);dials[_0x28cb70[_0xc579('0x4')]]=_[_0xc579('0x1e')](dials[_0x28cb70['uniqueid']],_0x28cb70);dials[_0x28cb70['uniqueid']][_0xc579('0x1f')]=utils['now']();dials[_0x28cb70['uniqueid']][_0xc579('0x20')]=_0xc579('0x21');utils[_0xc579('0x2')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x28cb70[_0xc579('0x4')],dials[_0x28cb70[_0xc579('0x4')]][_0xc579('0x1f')]));}}catch(_0x295147){utils['error'](util[_0xc579('0xb')](_0xc579('0x1d'),_0x28cb70[_0xc579('0x4')]),_0x295147);}};exports[_0xc579('0x22')]=function(_0x509933){try{if(!_[_0xc579('0x17')](dials[_0x509933[_0xc579('0x4')]])){utils[_0xc579('0x15')](util[_0xc579('0xb')](_0xc579('0x23'),_0x509933[_0xc579('0x4')]),_0x509933);dials[_0x509933['uniqueid']][_0xc579('0x24')]=_0x509933['dialstatus'];if(_0x509933[_0xc579('0x24')]==_0xc579('0x25')){dials[_0x509933[_0xc579('0x4')]]=_['assign'](dials[_0x509933[_0xc579('0x4')]],_0x509933);dials[_0x509933['uniqueid']][_0xc579('0x26')]=utils[_0xc579('0x27')]();dials[_0x509933[_0xc579('0x4')]][_0xc579('0x20')]=_0xc579('0x28');utils['info'](util[_0xc579('0xb')](_0xc579('0x29'),_0x509933['uniqueid'],_0x509933[_0xc579('0x24')],dials[_0x509933[_0xc579('0x4')]][_0xc579('0x26')]));}else{utils['info'](util[_0xc579('0xb')]('[%s][dials][dialend]\x20dialstatus:%s',_0x509933[_0xc579('0x4')],_0x509933['dialstatus']));}}}catch(_0x1591b7){utils['error'](util[_0xc579('0xb')]('[%s][dials][dialend]',_0x509933[_0xc579('0x4')]),_0x1591b7);}};exports['hangup']=function(_0x2473c2){try{if(!_[_0xc579('0x17')](dials[_0x2473c2[_0xc579('0x4')]])){utils['debug'](util['format'](_0xc579('0x2a'),_0x2473c2[_0xc579('0x4')]),_0x2473c2);utils[_0xc579('0x2')](util['format'](_0xc579('0x2b'),_0x2473c2['uniqueid'],_0x2473c2['calleridnum'],_0x2473c2[_0xc579('0x2c')],_0x2473c2[_0xc579('0x2d')]));dials[_0x2473c2[_0xc579('0x4')]]=_[_0xc579('0x1e')](dials[_0x2473c2[_0xc579('0x4')]],{'endtime':utils[_0xc579('0x27')](),'lastevent':_0xc579('0x2e')});dials[_0x2473c2[_0xc579('0x4')]][_0xc579('0x2f')]=utils[_0xc579('0x30')](dials[_0x2473c2[_0xc579('0x4')]]['endtime'],dials[_0x2473c2['uniqueid']][_0xc579('0x1f')]);dials[_0x2473c2['uniqueid']]['holdtime']=utils['diffTime'](dials[_0x2473c2[_0xc579('0x4')]][_0xc579('0x26')]||dials[_0x2473c2[_0xc579('0x4')]][_0xc579('0x31')],dials[_0x2473c2['uniqueid']][_0xc579('0x1f')]);dials[_0x2473c2[_0xc579('0x4')]]['billableseconds']=dials[_0x2473c2[_0xc579('0x4')]][_0xc579('0x26')]?utils[_0xc579('0x30')](dials[_0x2473c2['uniqueid']]['endtime'],dials[_0x2473c2[_0xc579('0x4')]]['answertime']):0x0;writeDB(dials[_0x2473c2[_0xc579('0x4')]]);}}catch(_0x495c2a){utils[_0xc579('0x13')](util['format'](_0xc579('0x2a'),_0x2473c2['uniqueid']),_0x495c2a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ad42d0f..26ac8b4 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 _0x07f6=['dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x07f6,0x1b8));var _0x607f=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x07f6[_0x30bd66];return _0x74c9dd;};var AsteriskManager=require(_0x607f('0x0'));var config=require(_0x607f('0x1'));var utils=require(_0x607f('0x2'));var util=require(_0x607f('0x3'));var isXDREnabled=config[_0x607f('0x4')]&&config[_0x607f('0x4')][_0x607f('0x5')]?!config[_0x607f('0x4')][_0x607f('0x5')]:!![];var isProduction=config[_0x607f('0x6')]===_0x607f('0x7')||![];var isLocalAsterisk=config[_0x607f('0x4')]&&config[_0x607f('0x4')][_0x607f('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x607f('0x9')][_0x607f('0xa')],config['asterisk']['ip'],config[_0x607f('0x9')][_0x607f('0xb')],config['asterisk']['password'],!![]);ami[_0x607f('0xc')]();if(!isXDREnabled){utils[_0x607f('0xd')](_0x607f('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x607f('0xd')](_0x607f('0xf'));}else{var agents=require(_0x607f('0x10'));var calls=require(_0x607f('0x11'));var queues=require(_0x607f('0x12'));var recordings=require(_0x607f('0x13'));var members=require(_0x607f('0x14'));var dials=require(_0x607f('0x15'));var transfers=require(_0x607f('0x16'));var core=require('./core.controller');ami['on']('connect',core[_0x607f('0x17')]);ami['on'](_0x607f('0x18'),core['shutdown']);ami['on']('fullybooted',core[_0x607f('0x19')]);ami['on'](_0x607f('0x1a'),core[_0x607f('0x1a')]);ami['on'](_0x607f('0x1b'),core[_0x607f('0x1b')]);ami['on'](_0x607f('0x1c'),core['managerevent']);ami['on'](_0x607f('0x1d'),function(_0x5f293c){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x20'),_0x5f293c[_0x607f('0x21')]),_0x5f293c);members[_0x607f('0x1d')](_0x5f293c);}catch(_0x239367){utils['error'](util[_0x607f('0x1f')](_0x607f('0x20'),_0x5f293c[_0x607f('0x21')]),_0x239367);}});ami['on']('agentcalled',function(_0x503d92){try{utils['debug'](util[_0x607f('0x1f')]('[%s][index][agentcalled]',_0x503d92[_0x607f('0x22')]),_0x503d92);agents['agentcalled'](_0x503d92);}catch(_0x3b3884){utils['error'](util[_0x607f('0x1f')](_0x607f('0x23'),_0x503d92[_0x607f('0x22')]),_0x3b3884);}});ami['on'](_0x607f('0x24'),function(_0x448b0f){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x25'),_0x448b0f[_0x607f('0x22')]),_0x448b0f);agents['agentringnoanswer'](_0x448b0f);}catch(_0x4a4f5b){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x25'),_0x448b0f[_0x607f('0x22')]),_0x4a4f5b);}});ami['on']('agentconnect',function(_0x368c6e){try{utils['debug'](util[_0x607f('0x1f')]('[%s][index][agentconnect]',_0x368c6e[_0x607f('0x22')]),_0x368c6e);agents[_0x607f('0x26')](_0x368c6e);queues[_0x607f('0x26')](_0x368c6e);}catch(_0x556ff8){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x27'),_0x368c6e['uniqueid']),_0x556ff8);}});ami['on'](_0x607f('0x28'),function(_0x4d368c){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x29'),_0x4d368c[_0x607f('0x22')]),_0x4d368c);agents[_0x607f('0x28')](_0x4d368c);queues[_0x607f('0x28')](_0x4d368c);members[_0x607f('0x28')](_0x4d368c);}catch(_0x4d0474){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x29'),_0x4d368c['uniqueid']),_0x4d0474);}});ami['on'](_0x607f('0x2a'),function(_0x211d5a){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x2b'),_0x211d5a[_0x607f('0x22')]),_0x211d5a);agents[_0x607f('0x2a')](_0x211d5a);queues[_0x607f('0x2a')](_0x211d5a);}catch(_0xbd465a){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2b'),_0x211d5a[_0x607f('0x22')]),_0xbd465a);}});ami['on']('queuecallerjoin',function(_0x43c75e){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')]('[%s][index][queuecallerjoin]',_0x43c75e['uniqueid']),_0x43c75e);queues[_0x607f('0x2c')](_0x43c75e);recordings[_0x607f('0x2c')](_0x43c75e);}catch(_0x1b907d){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2d'),_0x43c75e['uniqueid']),_0x1b907d);}});ami['on']('queuecallerleave',function(_0x26f223){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x2e'),_0x26f223[_0x607f('0x22')]),_0x26f223);queues[_0x607f('0x2f')](_0x26f223);}catch(_0x58d754){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x2e'),_0x26f223[_0x607f('0x22')]),_0x58d754);}});ami['on'](_0x607f('0x30'),function(_0x4c1eec){try{utils['debug'](util[_0x607f('0x1f')](_0x607f('0x31'),_0x4c1eec[_0x607f('0x22')]),_0x4c1eec);queues['musiconholdstart'](_0x4c1eec);calls[_0x607f('0x30')](_0x4c1eec);}catch(_0x55b1f0){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x31'),_0x4c1eec[_0x607f('0x22')]),_0x55b1f0);}});ami['on'](_0x607f('0x32'),function(_0x1893fd){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')]('[%s][index][musiconholdstop]',_0x1893fd[_0x607f('0x22')]),_0x1893fd);queues['musiconholdstop'](_0x1893fd);calls['musiconholdstop'](_0x1893fd);}catch(_0x302df4){utils['error'](util[_0x607f('0x1f')](_0x607f('0x33'),_0x1893fd[_0x607f('0x22')]),_0x302df4);}});ami['on'](_0x607f('0x34'),function(_0x418323){try{utils[_0x607f('0x1e')](util['format']('[%s][index][newstate]',_0x418323['uniqueid']),_0x418323);calls[_0x607f('0x34')](_0x418323);recordings[_0x607f('0x34')](_0x418323);}catch(_0x57019b){utils['error'](util[_0x607f('0x1f')](_0x607f('0x35'),_0x418323['uniqueid']),_0x57019b);}});ami['on']('hangup',function(_0x41e106){try{utils['debug'](util['format'](_0x607f('0x36'),_0x41e106[_0x607f('0x22')]),_0x41e106);calls[_0x607f('0x37')](_0x41e106);recordings[_0x607f('0x37')](_0x41e106);dials[_0x607f('0x37')](_0x41e106);agents[_0x607f('0x37')](_0x41e106);queues[_0x607f('0x37')](_0x41e106);}catch(_0x4f9b90){utils[_0x607f('0x1a')](util['format'](_0x607f('0x36'),_0x41e106[_0x607f('0x22')]),_0x4f9b90);}});ami['on'](_0x607f('0x38'),function(_0x48c5bf){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x39'),_0x48c5bf[_0x607f('0x22')]),_0x48c5bf);members['cdr'](_0x48c5bf);}catch(_0x1c4c33){utils[_0x607f('0x1a')](util[_0x607f('0x1f')]('[%s][index][cdr]',_0x48c5bf[_0x607f('0x22')]),_0x1c4c33);}});ami['on'](_0x607f('0x3a'),function(_0x2d9bbc){try{utils[_0x607f('0x1e')](util['format'](_0x607f('0x3b'),_0x2d9bbc[_0x607f('0x22')]),_0x2d9bbc);queues[_0x607f('0x3a')](_0x2d9bbc);agents[_0x607f('0x3a')](_0x2d9bbc);transfers[_0x607f('0x3a')](_0x2d9bbc);recordings[_0x607f('0x3a')](_0x2d9bbc);}catch(_0x51fd07){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x3b'),_0x2d9bbc[_0x607f('0x22')]),_0x51fd07);}});ami['on']('attendedtransfer',function(_0x39a071){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x3c'),_0x39a071['origtransfereruniqueid']),_0x39a071);queues[_0x607f('0x3d')](_0x39a071);transfers[_0x607f('0x3d')](_0x39a071);agents[_0x607f('0x3d')](_0x39a071);calls[_0x607f('0x3d')](_0x39a071);}catch(_0x511b93){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x3c'),_0x39a071[_0x607f('0x3e')]),_0x511b93);}});ami['on'](_0x607f('0x3f'),function(_0xefe536){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x40'),_0xefe536[_0x607f('0x22')]),_0xefe536);queues[_0x607f('0x3f')](_0xefe536);recordings[_0x607f('0x3f')](_0xefe536);calls[_0x607f('0x3f')](_0xefe536);dials[_0x607f('0x3f')](_0xefe536);}catch(_0x31b414){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x40'),_0xefe536[_0x607f('0x22')]),_0x31b414);}});ami['on'](_0x607f('0x41'),function(_0x367e08){try{utils['debug'](util['format'](_0x607f('0x42'),_0x367e08['uniqueid']),_0x367e08);calls[_0x607f('0x41')](_0x367e08);recordings[_0x607f('0x41')](_0x367e08);dials['newexten'](_0x367e08);}catch(_0x30432f){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x42'),_0x367e08[_0x607f('0x22')]),_0x30432f);}});ami['on'](_0x607f('0x43'),function(_0x3864f4){try{utils['debug'](util['format'](_0x607f('0x44'),_0x3864f4[_0x607f('0x22')]),_0x3864f4);calls[_0x607f('0x43')](_0x3864f4);recordings[_0x607f('0x43')](_0x3864f4);}catch(_0x162bfb){utils[_0x607f('0x1a')](util[_0x607f('0x1f')]('[%s][index][newchannel]',_0x3864f4['uniqueid']),_0x162bfb);}});ami['on'](_0x607f('0x45'),function(_0x29fda1){try{utils[_0x607f('0x1e')](util[_0x607f('0x1f')](_0x607f('0x46'),_0x29fda1[_0x607f('0x22')]),_0x29fda1);dials[_0x607f('0x45')](_0x29fda1);}catch(_0x2f9d55){utils['error'](util[_0x607f('0x1f')]('[%s]dialbegin',_0x29fda1['uniqueid']),_0x2f9d55);}});ami['on'](_0x607f('0x47'),function(_0x39c627){try{utils['debug'](util[_0x607f('0x1f')](_0x607f('0x48'),_0x39c627[_0x607f('0x22')]),_0x39c627);dials['dialend'](_0x39c627);}catch(_0x243403){utils[_0x607f('0x1a')](util[_0x607f('0x1f')](_0x607f('0x48'),_0x39c627[_0x607f('0x22')]),_0x243403);}});} \ No newline at end of file +var _0xd2b1=['dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','port','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]'];(function(_0x480ab1,_0x5b37ae){var _0x354609=function(_0x343c3c){while(--_0x343c3c){_0x480ab1['push'](_0x480ab1['shift']());}};_0x354609(++_0x5b37ae);}(_0xd2b1,0x1b2));var _0x1d2b=function(_0x2beb09,_0x466fff){_0x2beb09=_0x2beb09-0x0;var _0x13d67=_0xd2b1[_0x2beb09];return _0x13d67;};var AsteriskManager=require(_0x1d2b('0x0'));var config=require('../../config/environment');var utils=require(_0x1d2b('0x1'));var util=require(_0x1d2b('0x2'));var isXDREnabled=config[_0x1d2b('0x3')]&&config[_0x1d2b('0x3')][_0x1d2b('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config[_0x1d2b('0x5')]===_0x1d2b('0x6')||![];var isLocalAsterisk=config[_0x1d2b('0x3')]&&config[_0x1d2b('0x3')][_0x1d2b('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x1d2b('0x8')],config[_0x1d2b('0x9')]['ip'],config['asterisk']['username'],config[_0x1d2b('0x9')][_0x1d2b('0xa')],!![]);ami[_0x1d2b('0xb')]();if(!isXDREnabled){utils[_0x1d2b('0xc')](_0x1d2b('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1d2b('0xc')](_0x1d2b('0xe'));}else{var agents=require(_0x1d2b('0xf'));var calls=require(_0x1d2b('0x10'));var queues=require(_0x1d2b('0x11'));var recordings=require(_0x1d2b('0x12'));var members=require('./members.controller');var dials=require(_0x1d2b('0x13'));var transfers=require(_0x1d2b('0x14'));var core=require(_0x1d2b('0x15'));ami['on'](_0x1d2b('0x16'),core[_0x1d2b('0x16')]);ami['on']('shutdown',core[_0x1d2b('0x17')]);ami['on'](_0x1d2b('0x18'),core['fullybooted']);ami['on'](_0x1d2b('0x19'),core[_0x1d2b('0x19')]);ami['on'](_0x1d2b('0x1a'),core[_0x1d2b('0x1a')]);ami['on'](_0x1d2b('0x1b'),core[_0x1d2b('0x1b')]);ami['on'](_0x1d2b('0x1c'),function(_0x35fa25){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x1f'),_0x35fa25[_0x1d2b('0x20')]),_0x35fa25);members['devicestatechange'](_0x35fa25);}catch(_0x5e90c4){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')]('[%s][index][devicestatechange]',_0x35fa25['device']),_0x5e90c4);}});ami['on'](_0x1d2b('0x21'),function(_0x1b7c51){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x22'),_0x1b7c51[_0x1d2b('0x23')]),_0x1b7c51);agents['agentcalled'](_0x1b7c51);}catch(_0x130ee3){utils['error'](util[_0x1d2b('0x1e')](_0x1d2b('0x22'),_0x1b7c51[_0x1d2b('0x23')]),_0x130ee3);}});ami['on']('agentringnoanswer',function(_0x51cea7){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x24'),_0x51cea7['uniqueid']),_0x51cea7);agents[_0x1d2b('0x25')](_0x51cea7);}catch(_0x40aa23){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')]('[%s][index][agentringnoanswer]',_0x51cea7['uniqueid']),_0x40aa23);}});ami['on']('agentconnect',function(_0x48851d){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')]('[%s][index][agentconnect]',_0x48851d[_0x1d2b('0x23')]),_0x48851d);agents[_0x1d2b('0x26')](_0x48851d);queues[_0x1d2b('0x26')](_0x48851d);}catch(_0x4181c3){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x27'),_0x48851d[_0x1d2b('0x23')]),_0x4181c3);}});ami['on'](_0x1d2b('0x28'),function(_0x358b37){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x29'),_0x358b37[_0x1d2b('0x23')]),_0x358b37);agents['agentcomplete'](_0x358b37);queues[_0x1d2b('0x28')](_0x358b37);members[_0x1d2b('0x28')](_0x358b37);}catch(_0x1440e6){utils['error'](util[_0x1d2b('0x1e')]('[%s][index][agentcomplete]',_0x358b37[_0x1d2b('0x23')]),_0x1440e6);}});ami['on'](_0x1d2b('0x2a'),function(_0x413ae7){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')]('[%s][index][queuecallerabandon]',_0x413ae7['uniqueid']),_0x413ae7);agents['queuecallerabandon'](_0x413ae7);queues['queuecallerabandon'](_0x413ae7);}catch(_0x17790f){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x2b'),_0x413ae7[_0x1d2b('0x23')]),_0x17790f);}});ami['on'](_0x1d2b('0x2c'),function(_0x30ede1){try{utils['debug'](util[_0x1d2b('0x1e')](_0x1d2b('0x2d'),_0x30ede1[_0x1d2b('0x23')]),_0x30ede1);queues[_0x1d2b('0x2c')](_0x30ede1);recordings[_0x1d2b('0x2c')](_0x30ede1);}catch(_0x1a91a8){utils['error'](util[_0x1d2b('0x1e')](_0x1d2b('0x2d'),_0x30ede1['uniqueid']),_0x1a91a8);}});ami['on']('queuecallerleave',function(_0x388260){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x2e'),_0x388260[_0x1d2b('0x23')]),_0x388260);queues['queuecallerleave'](_0x388260);}catch(_0x4d2c5f){utils[_0x1d2b('0x19')](util['format'](_0x1d2b('0x2e'),_0x388260[_0x1d2b('0x23')]),_0x4d2c5f);}});ami['on'](_0x1d2b('0x2f'),function(_0x34ed34){try{utils['debug'](util[_0x1d2b('0x1e')](_0x1d2b('0x30'),_0x34ed34[_0x1d2b('0x23')]),_0x34ed34);queues['musiconholdstart'](_0x34ed34);calls[_0x1d2b('0x2f')](_0x34ed34);}catch(_0x47166d){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x30'),_0x34ed34['uniqueid']),_0x47166d);}});ami['on'](_0x1d2b('0x31'),function(_0x218e71){try{utils[_0x1d2b('0x1d')](util['format'](_0x1d2b('0x32'),_0x218e71[_0x1d2b('0x23')]),_0x218e71);queues[_0x1d2b('0x31')](_0x218e71);calls['musiconholdstop'](_0x218e71);}catch(_0x1f7331){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x32'),_0x218e71[_0x1d2b('0x23')]),_0x1f7331);}});ami['on'](_0x1d2b('0x33'),function(_0x193657){try{utils['debug'](util[_0x1d2b('0x1e')]('[%s][index][newstate]',_0x193657[_0x1d2b('0x23')]),_0x193657);calls[_0x1d2b('0x33')](_0x193657);recordings[_0x1d2b('0x33')](_0x193657);}catch(_0x3ab327){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x34'),_0x193657[_0x1d2b('0x23')]),_0x3ab327);}});ami['on'](_0x1d2b('0x35'),function(_0x4e1664){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x36'),_0x4e1664[_0x1d2b('0x23')]),_0x4e1664);calls[_0x1d2b('0x35')](_0x4e1664);recordings[_0x1d2b('0x35')](_0x4e1664);dials[_0x1d2b('0x35')](_0x4e1664);agents[_0x1d2b('0x35')](_0x4e1664);queues[_0x1d2b('0x35')](_0x4e1664);}catch(_0x20f36d){utils['error'](util[_0x1d2b('0x1e')]('[%s][index][hangup]',_0x4e1664[_0x1d2b('0x23')]),_0x20f36d);}});ami['on'](_0x1d2b('0x37'),function(_0x1ab524){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x38'),_0x1ab524['uniqueid']),_0x1ab524);members[_0x1d2b('0x37')](_0x1ab524);}catch(_0x4d2f9f){utils[_0x1d2b('0x19')](util['format'](_0x1d2b('0x38'),_0x1ab524['uniqueid']),_0x4d2f9f);}});ami['on'](_0x1d2b('0x39'),function(_0x31fd96){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')]('[%s][index][blindtransfer]',_0x31fd96[_0x1d2b('0x23')]),_0x31fd96);queues['blindtransfer'](_0x31fd96);agents['blindtransfer'](_0x31fd96);transfers[_0x1d2b('0x39')](_0x31fd96);recordings[_0x1d2b('0x39')](_0x31fd96);}catch(_0x1f1b71){utils['error'](util[_0x1d2b('0x1e')](_0x1d2b('0x3a'),_0x31fd96[_0x1d2b('0x23')]),_0x1f1b71);}});ami['on'](_0x1d2b('0x3b'),function(_0x14dabb){try{utils['debug'](util[_0x1d2b('0x1e')](_0x1d2b('0x3c'),_0x14dabb[_0x1d2b('0x3d')]),_0x14dabb);queues[_0x1d2b('0x3b')](_0x14dabb);transfers['attendedtransfer'](_0x14dabb);agents[_0x1d2b('0x3b')](_0x14dabb);calls['attendedtransfer'](_0x14dabb);}catch(_0x1c2a27){utils[_0x1d2b('0x19')](util['format']('[%s][index][attendedtransfer]',_0x14dabb[_0x1d2b('0x3d')]),_0x1c2a27);}});ami['on'](_0x1d2b('0x3e'),function(_0x2a1771){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x3f'),_0x2a1771[_0x1d2b('0x23')]),_0x2a1771);queues[_0x1d2b('0x3e')](_0x2a1771);recordings['varset'](_0x2a1771);calls[_0x1d2b('0x3e')](_0x2a1771);dials['varset'](_0x2a1771);}catch(_0xc5155){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x3f'),_0x2a1771[_0x1d2b('0x23')]),_0xc5155);}});ami['on'](_0x1d2b('0x40'),function(_0x2eb473){try{utils['debug'](util[_0x1d2b('0x1e')](_0x1d2b('0x41'),_0x2eb473[_0x1d2b('0x23')]),_0x2eb473);calls['newexten'](_0x2eb473);recordings['newexten'](_0x2eb473);dials[_0x1d2b('0x40')](_0x2eb473);}catch(_0x34b8d3){utils['error'](util['format'](_0x1d2b('0x41'),_0x2eb473[_0x1d2b('0x23')]),_0x34b8d3);}});ami['on'](_0x1d2b('0x42'),function(_0x6b1aa5){try{utils['debug'](util[_0x1d2b('0x1e')](_0x1d2b('0x43'),_0x6b1aa5['uniqueid']),_0x6b1aa5);calls[_0x1d2b('0x42')](_0x6b1aa5);recordings[_0x1d2b('0x42')](_0x6b1aa5);}catch(_0x261c27){utils['error'](util[_0x1d2b('0x1e')](_0x1d2b('0x43'),_0x6b1aa5[_0x1d2b('0x23')]),_0x261c27);}});ami['on'](_0x1d2b('0x44'),function(_0x417db6){try{utils[_0x1d2b('0x1d')](util[_0x1d2b('0x1e')](_0x1d2b('0x45'),_0x417db6[_0x1d2b('0x23')]),_0x417db6);dials['dialbegin'](_0x417db6);}catch(_0xd64995){utils['error'](util[_0x1d2b('0x1e')]('[%s]dialbegin',_0x417db6[_0x1d2b('0x23')]),_0xd64995);}});ami['on'](_0x1d2b('0x46'),function(_0x43ba1a){try{utils[_0x1d2b('0x1d')](util['format'](_0x1d2b('0x47'),_0x43ba1a['uniqueid']),_0x43ba1a);dials[_0x1d2b('0x46')](_0x43ba1a);}catch(_0x33a206){utils[_0x1d2b('0x19')](util[_0x1d2b('0x1e')](_0x1d2b('0x47'),_0x43ba1a[_0x1d2b('0x23')]),_0x33a206);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b8f197f..4cc9ca6 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 _0x3f91=['source','data2','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f91,0x99));var _0x13f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f91[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x13f9('0x0'));var members={};var exclude=[_0x13f9('0x1'),_0x13f9('0x2')];function writeDB(_0x4baca5){utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x5'),_0x4baca5[_0x13f9('0x6')],_0x4baca5[_0x13f9('0x7')],_0x4baca5[_0x13f9('0x8')],_0x4baca5['data2'],_0x4baca5['membername'],_0x4baca5[_0x13f9('0x9')]));if(_0x4baca5[_0x13f9('0x7')]){utils[_0x13f9('0xa')](_0x4baca5[_0x13f9('0x7')])[_0x13f9('0xb')](function(_0x3f009a){if(_0x3f009a){_0x4baca5[_0x13f9('0xc')]=_0x3f009a[_0x13f9('0xd')];_0x4baca5[_0x13f9('0xe')]=_0x3f009a[_0x13f9('0xe')];utils['request'](_0x13f9('0xf'),_0x4baca5);}else{utils[_0x13f9('0x10')](_0x4baca5[_0x13f9('0x7')]['split']('/')[0x1])[_0x13f9('0xb')](function(_0x492c44){if(_0x492c44){_0x4baca5[_0x13f9('0xc')]=_0x492c44['name'];_0x4baca5[_0x13f9('0xe')]=_0x492c44[_0x13f9('0xe')];utils[_0x13f9('0x11')]('CreateMemberReport',_0x4baca5);}});}})[_0x13f9('0x12')](function(_0x1df23d){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x14'),_0x4baca5['uniqueid']),_0x1df23d);});}delete members[_0x4baca5['interface']];}function startsWith(_0x410b57,_0x103e32){return _[_0x13f9('0x15')](_0x410b57,function(_0x3783c5){return _['startsWith'](_0x103e32,_0x3783c5);});}exports['devicestatechange']=function(_0x1faeec){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')]),_0x1faeec);utils['info'](util['format'](_0x13f9('0x19'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec['device']][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')],_0x1faeec[_0x13f9('0x1a')],_0x1faeec['device']));switch(_0x1faeec[_0x13f9('0x1a')]){case'INUSE':case _0x13f9('0x1b'):if(!startsWith(exclude,_0x1faeec[_0x13f9('0x18')])){members[_0x1faeec['device']]={'channel':_0x13f9('0x1c'),'interface':_0x1faeec['device'],'type':_0x13f9('0x1d'),'enterAt':utils[_0x13f9('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x13f9('0x1f')](members[_0x1faeec['device']])){members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')]=utils[_0x13f9('0x1e')]();members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x21')]=utils[_0x13f9('0x22')](members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')],members[_0x1faeec[_0x13f9('0x18')]]['enterAt']);if(members[_0x1faeec['device']][_0x13f9('0x6')]){writeDB(members[_0x1faeec[_0x13f9('0x18')]]);}}break;default:break;}}catch(_0x256ffd){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]]['uniqueid']:_0x1faeec[_0x13f9('0x18')]),_0x256ffd);}};exports[_0x13f9('0x23')]=function(_0x3f03e7){try{if(!_['isNil'](members[_0x3f03e7[_0x13f9('0x7')]])){utils[_0x13f9('0x16')](util['format']('[%s][members][agentcomplete]',_0x3f03e7['uniqueid']),_0x3f03e7);utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x24'),_0x3f03e7[_0x13f9('0x6')],_0x3f03e7[_0x13f9('0x7')],_0x3f03e7[_0x13f9('0x25')]));members[_0x3f03e7[_0x13f9('0x7')]]=_[_0x13f9('0x26')](members[_0x3f03e7[_0x13f9('0x7')]],{'data4':_0x3f03e7[_0x13f9('0x25')],'uniqueid':_0x3f03e7['uniqueid']});}}catch(_0x33026f){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x27'),_0x3f03e7[_0x13f9('0x6')]),_0x33026f);}};exports[_0x13f9('0x28')]=function(_0xb14908){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908['uniqueid']),_0xb14908);if(_0xb14908[_0x13f9('0x8')]){var _0x25d696=_0xb14908[_0x13f9('0x8')]['split']('-')[0x0];if(!_['isNil'](members[_0x25d696])){members[_0x25d696]=_[_0x13f9('0x26')](members[_0x25d696],{'data1':members[_0x25d696][_0x13f9('0x2a')]||_0xb14908['type'],'data2':members[_0x25d696]['data2']||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x25d696]['data3']||_0xb14908['destination'],'uniqueid':members[_0x25d696][_0x13f9('0x6')]||_0xb14908[_0x13f9('0x6')]});utils[_0x13f9('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb14908[_0x13f9('0x6')],members[_0x25d696][_0x13f9('0x2a')],members[_0x25d696][_0x13f9('0x2c')],members[_0x25d696][_0x13f9('0x2d')]));if(members[_0x25d696][_0x13f9('0x20')]){writeDB(members[_0x25d696]);}}}if(_0xb14908[_0x13f9('0x2e')]){var _0x4b5a1a=_0xb14908[_0x13f9('0x2e')]['split']('-')[0x0];if(!_[_0x13f9('0x1f')](members[_0x4b5a1a])){members[_0x4b5a1a]=_['assign'](members[_0x4b5a1a],{'data1':members[_0x4b5a1a][_0x13f9('0x2a')]||_0xb14908[_0x13f9('0x9')],'data2':members[_0x4b5a1a][_0x13f9('0x2c')]||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x4b5a1a][_0x13f9('0x2d')]||_0xb14908[_0x13f9('0x2f')],'uniqueid':members[_0x4b5a1a]['uniqueid']||_0xb14908['uniqueid']});utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x30'),_0xb14908[_0x13f9('0x6')],members[_0x4b5a1a][_0x13f9('0x2a')],members[_0x4b5a1a][_0x13f9('0x2c')],members[_0x4b5a1a]['data3']));if(members[_0x4b5a1a][_0x13f9('0x20')]){writeDB(members[_0x4b5a1a]);}}}}catch(_0x1901e6){utils['error'](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908[_0x13f9('0x6')]),_0x1901e6);}}; \ No newline at end of file +var _0x45c8=['assign','queue','cdr','[%s][members][cdr]','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','interface','channel','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','split','error','[%s][members][writeDB]','uniqueid','some','debug','format','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x45c8,0xef));var _0x845c=function(_0x1f113e,_0x37d8f6){_0x1f113e=_0x1f113e-0x0;var _0x2be681=_0x45c8[_0x1f113e];return _0x2be681;};'use strict';var _=require(_0x845c('0x0'));var util=require('util');var utils=require(_0x845c('0x1'));var members={};var exclude=[_0x845c('0x2'),_0x845c('0x3')];function writeDB(_0x343dc5){utils['info'](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x343dc5['uniqueid'],_0x343dc5[_0x845c('0x4')],_0x343dc5[_0x845c('0x5')],_0x343dc5[_0x845c('0x6')],_0x343dc5['membername'],_0x343dc5[_0x845c('0x7')]));if(_0x343dc5['interface']){utils[_0x845c('0x8')](_0x343dc5[_0x845c('0x4')])[_0x845c('0x9')](function(_0x36b3aa){if(_0x36b3aa){_0x343dc5[_0x845c('0xa')]=_0x36b3aa[_0x845c('0xb')];_0x343dc5[_0x845c('0xc')]=_0x36b3aa[_0x845c('0xc')];utils[_0x845c('0xd')](_0x845c('0xe'),_0x343dc5);}else{utils['getUserByName'](_0x343dc5['interface'][_0x845c('0xf')]('/')[0x1])[_0x845c('0x9')](function(_0x571283){if(_0x571283){_0x343dc5[_0x845c('0xa')]=_0x571283[_0x845c('0xb')];_0x343dc5[_0x845c('0xc')]=_0x571283[_0x845c('0xc')];utils[_0x845c('0xd')](_0x845c('0xe'),_0x343dc5);}});}})['catch'](function(_0x7a46e8){utils[_0x845c('0x10')](util['format'](_0x845c('0x11'),_0x343dc5[_0x845c('0x12')]),_0x7a46e8);});}delete members[_0x343dc5[_0x845c('0x4')]];}function startsWith(_0x3ce72b,_0xf0cc1b){return _[_0x845c('0x13')](_0x3ce72b,function(_0x14b400){return _['startsWith'](_0xf0cc1b,_0x14b400);});}exports['devicestatechange']=function(_0x3b1ff9){try{utils[_0x845c('0x14')](util[_0x845c('0x15')]('[%s][members][devicestatechange]',members[_0x3b1ff9[_0x845c('0x16')]]?members[_0x3b1ff9[_0x845c('0x16')]][_0x845c('0x12')]:_0x3b1ff9['device']),_0x3b1ff9);utils['info'](util['format'](_0x845c('0x17'),members[_0x3b1ff9['device']]?members[_0x3b1ff9[_0x845c('0x16')]][_0x845c('0x12')]:_0x3b1ff9[_0x845c('0x16')],_0x3b1ff9[_0x845c('0x18')],_0x3b1ff9[_0x845c('0x16')]));switch(_0x3b1ff9['state']){case _0x845c('0x19'):case'BUSY':if(!startsWith(exclude,_0x3b1ff9[_0x845c('0x16')])){members[_0x3b1ff9['device']]={'channel':_0x845c('0x1a'),'interface':_0x3b1ff9['device'],'type':_0x845c('0x1b'),'enterAt':utils['now'](),'role':_0x845c('0x1c')};}break;case _0x845c('0x1d'):if(!_[_0x845c('0x1e')](members[_0x3b1ff9[_0x845c('0x16')]])){members[_0x3b1ff9[_0x845c('0x16')]][_0x845c('0x1f')]=utils['now']();members[_0x3b1ff9[_0x845c('0x16')]]['duration']=utils[_0x845c('0x20')](members[_0x3b1ff9[_0x845c('0x16')]]['exitAt'],members[_0x3b1ff9[_0x845c('0x16')]][_0x845c('0x21')]);if(members[_0x3b1ff9[_0x845c('0x16')]]['uniqueid']){writeDB(members[_0x3b1ff9['device']]);}}break;default:break;}}catch(_0x27b211){utils[_0x845c('0x10')](util[_0x845c('0x15')]('[%s][members][devicestatechange]',members[_0x3b1ff9[_0x845c('0x16')]]?members[_0x3b1ff9[_0x845c('0x16')]][_0x845c('0x12')]:_0x3b1ff9[_0x845c('0x16')]),_0x27b211);}};exports['agentcomplete']=function(_0x19a44b){try{if(!_[_0x845c('0x1e')](members[_0x19a44b[_0x845c('0x4')]])){utils['debug'](util[_0x845c('0x15')](_0x845c('0x22'),_0x19a44b['uniqueid']),_0x19a44b);utils[_0x845c('0x23')](util[_0x845c('0x15')](_0x845c('0x24'),_0x19a44b[_0x845c('0x12')],_0x19a44b['interface'],_0x19a44b['queue']));members[_0x19a44b[_0x845c('0x4')]]=_[_0x845c('0x25')](members[_0x19a44b[_0x845c('0x4')]],{'data4':_0x19a44b[_0x845c('0x26')],'uniqueid':_0x19a44b[_0x845c('0x12')]});}}catch(_0x13c610){utils[_0x845c('0x10')](util[_0x845c('0x15')](_0x845c('0x22'),_0x19a44b[_0x845c('0x12')]),_0x13c610);}};exports[_0x845c('0x27')]=function(_0x4f2aa5){try{utils[_0x845c('0x14')](util['format'](_0x845c('0x28'),_0x4f2aa5[_0x845c('0x12')]),_0x4f2aa5);if(_0x4f2aa5[_0x845c('0x5')]){var _0x276516=_0x4f2aa5[_0x845c('0x5')]['split']('-')[0x0];if(!_[_0x845c('0x1e')](members[_0x276516])){members[_0x276516]=_[_0x845c('0x25')](members[_0x276516],{'data1':members[_0x276516]['data1']||_0x4f2aa5['type'],'data2':members[_0x276516][_0x845c('0x6')]||_0x4f2aa5['source'],'data3':members[_0x276516][_0x845c('0x29')]||_0x4f2aa5['destination'],'uniqueid':members[_0x276516][_0x845c('0x12')]||_0x4f2aa5['uniqueid']});utils['info'](util[_0x845c('0x15')](_0x845c('0x2a'),_0x4f2aa5[_0x845c('0x12')],members[_0x276516][_0x845c('0x2b')],members[_0x276516][_0x845c('0x6')],members[_0x276516][_0x845c('0x29')]));if(members[_0x276516]['exitAt']){writeDB(members[_0x276516]);}}}if(_0x4f2aa5[_0x845c('0x2c')]){var _0x4e9550=_0x4f2aa5[_0x845c('0x2c')][_0x845c('0xf')]('-')[0x0];if(!_[_0x845c('0x1e')](members[_0x4e9550])){members[_0x4e9550]=_[_0x845c('0x25')](members[_0x4e9550],{'data1':members[_0x4e9550][_0x845c('0x2b')]||_0x4f2aa5[_0x845c('0x7')],'data2':members[_0x4e9550][_0x845c('0x6')]||_0x4f2aa5[_0x845c('0x2d')],'data3':members[_0x4e9550][_0x845c('0x29')]||_0x4f2aa5['destination'],'uniqueid':members[_0x4e9550][_0x845c('0x12')]||_0x4f2aa5[_0x845c('0x12')]});utils[_0x845c('0x23')](util[_0x845c('0x15')](_0x845c('0x2a'),_0x4f2aa5[_0x845c('0x12')],members[_0x4e9550][_0x845c('0x2b')],members[_0x4e9550][_0x845c('0x6')],members[_0x4e9550][_0x845c('0x29')]));if(members[_0x4e9550][_0x845c('0x1f')]){writeDB(members[_0x4e9550]);}}}}catch(_0x5b3d29){utils[_0x845c('0x10')](util[_0x845c('0x15')](_0x845c('0x28'),_0x4f2aa5[_0x845c('0x12')]),_0x5b3d29);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 8dcf739..91e5b1e 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 _0x64ba=['queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','secondtransfererexten','ATTENDED','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x64ba,0x10e));var _0xa64b=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x64ba[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xa64b('0x0'));var util=require(_0xa64b('0x1'));var utils=require(_0xa64b('0x2'));var queues={};function writeDB(_0x5645a0){utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x5'),_0x5645a0[_0xa64b('0x6')],_0x5645a0['channel'],_0x5645a0[_0xa64b('0x7')],_0x5645a0[_0xa64b('0x8')],_0x5645a0[_0xa64b('0x9')],_0x5645a0[_0xa64b('0xa')],_0x5645a0[_0xa64b('0xb')]));if(_0x5645a0['queue']){utils[_0xa64b('0xc')](_0x5645a0['queue'])[_0xa64b('0xd')](function(_0x58958c){if(_0x58958c){_0x5645a0[_0xa64b('0xe')]=_0x58958c['type'];}utils[_0xa64b('0xf')](_0xa64b('0x10'),_0x5645a0);});}else{utils[_0xa64b('0xf')](_0xa64b('0x10'),_0x5645a0);}if(_0x5645a0[_0xa64b('0x11')]){delete queues[_0x5645a0[_0xa64b('0x11')]];}else{delete queues[_0x5645a0['uniqueid']];}}exports[_0xa64b('0x12')]=function(_0x51bdaa){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')]('[%s][queues][queuecallerjoin]',_0x51bdaa[_0xa64b('0x6')]),_0x51bdaa);utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x14'),_0x51bdaa['uniqueid'],_0x51bdaa[_0xa64b('0x7')],_0x51bdaa[_0xa64b('0x15')]));queues[_0x51bdaa[_0xa64b('0x6')]]=_[_0xa64b('0x16')](_0x51bdaa,{'originalposition':_0x51bdaa[_0xa64b('0x15')],'queuecallerjoinAt':utils[_0xa64b('0x17')](),'mohtime':0x0});}catch(_0x1e15d4){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x19'),_0x51bdaa[_0xa64b('0x6')]),_0x1e15d4);}};exports['hangup']=function(_0x236f1d){try{if(!_[_0xa64b('0x1a')](queues[_0x236f1d[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util['format'](_0xa64b('0x1b'),_0x236f1d[_0xa64b('0x6')]),_0x236f1d);if(queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1c')]){if(!queues[_0x236f1d[_0xa64b('0x6')]]['queuecallerabandon']&&!queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1d')]){queues[_0x236f1d['uniqueid']]['queuecallercomplete']=!![];queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x1e')]=utils[_0xa64b('0x17')]();queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0xb')]=_0xa64b('0x1f');}utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x236f1d[_0xa64b('0x6')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x20')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0xb')]));writeDB(queues[_0x236f1d[_0xa64b('0x6')]]);}else if(queues[_0x236f1d['uniqueid']]['transfereduniqueid']){utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x21'),_0x236f1d['uniqueid'],queues[_0x236f1d['uniqueid']][_0xa64b('0x20')],queues[_0x236f1d[_0xa64b('0x6')]][_0xa64b('0x11')]));queues[queues[_0x236f1d['uniqueid']][_0xa64b('0x11')]]=queues[_0x236f1d[_0xa64b('0x6')]];queues[queues[_0x236f1d[_0xa64b('0x6')]]['transfereduniqueid']][_0xa64b('0x22')]=0x2;delete queues[_0x236f1d['uniqueid']];}}}catch(_0x31d07d){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x1b'),_0x236f1d[_0xa64b('0x6')]),_0x31d07d);}};exports[_0xa64b('0x23')]=function(_0x3baba1){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')]('[%s][queues][varset]',_0x3baba1[_0xa64b('0x6')]),_0x3baba1);if(!_['isNil'](_0x3baba1[_0xa64b('0x24')]['queuestatus'])&&_0x3baba1[_0xa64b('0x25')][_0xa64b('0x26')]()!==_0xa64b('0x27')){if(!_[_0xa64b('0x1a')](queues[_0x3baba1['uniqueid']])){queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x3baba1[_0xa64b('0x6')]]['queuecallerexit']=!![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x2a')]=utils[_0xa64b('0x17')]();queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0xb')]=_0x3baba1['value'][_0xa64b('0x26')]();utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x2b'),_0x3baba1['uniqueid'],queues[_0x3baba1['uniqueid']][_0xa64b('0x20')],_0x3baba1[_0xa64b('0x25')],queues[_0x3baba1['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x3baba1[_0xa64b('0x6')]]);}}else if(!_[_0xa64b('0x1a')](_0x3baba1['variable'][_0xa64b('0x2c')])){if(!_[_0xa64b('0x1a')](queues[_0x3baba1[_0xa64b('0x6')]])&&!queues[_0x3baba1['uniqueid']][_0xa64b('0x28')]){queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x3baba1['uniqueid']][_0xa64b('0x1d')]=!![];queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x2a')]=utils[_0xa64b('0x17')]();queues[_0x3baba1['uniqueid']][_0xa64b('0xb')]=_0xa64b('0x2d');utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3baba1[_0xa64b('0x6')],queues[_0x3baba1[_0xa64b('0x6')]][_0xa64b('0x20')],_0x3baba1[_0xa64b('0x25')],queues[_0x3baba1[_0xa64b('0x6')]]['queuecallerexitreason']));}}}catch(_0x5f29b6){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x2e'),_0x3baba1[_0xa64b('0x6')]),_0x5f29b6);}};exports[_0xa64b('0x28')]=function(_0x5db566){try{if(!_['isNil'](queues[_0x5db566[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x2f'),_0x5db566[_0xa64b('0x6')]),_0x5db566);queues[_0x5db566[_0xa64b('0x6')]][_0xa64b('0x1d')]=![];queues[_0x5db566['uniqueid']][_0xa64b('0x2a')]=null;queues[_0x5db566['uniqueid']][_0xa64b('0x28')]=!![];queues[_0x5db566[_0xa64b('0x6')]]['queuecallerabandonAt']=utils[_0xa64b('0x17')]();queues[_0x5db566['uniqueid']][_0xa64b('0xb')]='ABANDONED';utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5db566[_0xa64b('0x6')],queues[_0x5db566['uniqueid']][_0xa64b('0x20')],queues[_0x5db566[_0xa64b('0x6')]][_0xa64b('0xb')]));}}catch(_0xc7ddac){utils['error'](util[_0xa64b('0x4')]('[%s][queues][queuecallerabandon]',_0x5db566[_0xa64b('0x6')]),_0xc7ddac);}};exports[_0xa64b('0x30')]=function(_0x44fc3e){try{if(!_['isNil'](queues[_0x44fc3e[_0xa64b('0x6')]])){utils['debug'](util['format'](_0xa64b('0x31'),_0x44fc3e[_0xa64b('0x6')]),_0x44fc3e);utils[_0xa64b('0x3')](util['format'](_0xa64b('0x32'),_0x44fc3e[_0xa64b('0x6')],queues[_0x44fc3e[_0xa64b('0x6')]]['name'],_0x44fc3e[_0xa64b('0x33')],_0x44fc3e[_0xa64b('0x34')]));queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x30')]=!![];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x1c')]=utils[_0xa64b('0x17')]();queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x35')]=utils['diffTime'](queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x1c')],queues[_0x44fc3e['uniqueid']][_0xa64b('0x36')]);queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x15')]=_0x44fc3e['position'];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x37')]=_0x44fc3e[_0xa64b('0x37')];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x33')]=_0x44fc3e[_0xa64b('0x33')];queues[_0x44fc3e[_0xa64b('0x6')]][_0xa64b('0x34')]=_0x44fc3e[_0xa64b('0x34')];}}catch(_0x41c7b9){utils[_0xa64b('0x18')](util['format'](_0xa64b('0x31'),_0x44fc3e['uniqueid']),_0x41c7b9);}};exports['agentconnect']=function(_0x57ca7f){try{if(!_[_0xa64b('0x1a')](queues[_0x57ca7f[_0xa64b('0x6')]])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x38'),_0x57ca7f[_0xa64b('0x6')]),_0x57ca7f);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x57ca7f['uniqueid'],queues[_0x57ca7f[_0xa64b('0x6')]]['name'],_0x57ca7f[_0xa64b('0x39')],_0x57ca7f['destaccountcode']));queues[_0x57ca7f['uniqueid']][_0xa64b('0x28')]=![];queues[_0x57ca7f[_0xa64b('0x6')]]['queuecallerabandon']=![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x29')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x1d')]=![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0xb')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x2a')]=null;queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0x3a')]=!![];queues[_0x57ca7f[_0xa64b('0x6')]][_0xa64b('0xa')]=_0x57ca7f[_0xa64b('0x3b')];queues[_0x57ca7f['uniqueid']][_0xa64b('0x8')]=_0x57ca7f[_0xa64b('0x39')];}}catch(_0x2c0934){utils[_0xa64b('0x18')](util['format']('[%s][queues][agentconnect]',_0x57ca7f[_0xa64b('0x6')]),_0x2c0934);}};exports[_0xa64b('0x3c')]=function(_0x881464){try{if(!_[_0xa64b('0x1a')](queues[_0x881464[_0xa64b('0x6')]])){if(queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x1c')]){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x3d'),_0x881464[_0xa64b('0x6')]),_0x881464);queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x28')]=![];queues[_0x881464['uniqueid']][_0xa64b('0x29')]=null;queues[_0x881464[_0xa64b('0x6')]]['queuecallerexit']=![];queues[_0x881464['uniqueid']][_0xa64b('0x2a')]=null;queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x3a')]=!![];queues[_0x881464['uniqueid']]['lastAssignedTo']=_0x881464[_0xa64b('0x39')];queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x3e')]=!![];queues[_0x881464['uniqueid']][_0xa64b('0x1e')]=utils[_0xa64b('0x17')]();if(_0x881464[_0xa64b('0x3f')]==_0xa64b('0x40')){if(!queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x40')]){queues[_0x881464['uniqueid']]['queuecallerexitreason']=_0xa64b('0x41');}}else{queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0xb')]='COMPLETEDBY'+_0x881464[_0xa64b('0x3f')][_0xa64b('0x26')]();}utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x42'),_0x881464['uniqueid'],queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0x20')],_0x881464[_0xa64b('0x39')],queues[_0x881464[_0xa64b('0x6')]][_0xa64b('0xb')]));writeDB(queues[_0x881464[_0xa64b('0x6')]]);}}}catch(_0x27d139){utils[_0xa64b('0x18')](util['format'](_0xa64b('0x3d'),_0x881464[_0xa64b('0x6')]),_0x27d139);}};exports[_0xa64b('0x43')]=function(_0x349f71){try{if(!_[_0xa64b('0x1a')](queues[_0x349f71[_0xa64b('0x44')]])){utils['debug'](util['format'](_0xa64b('0x45'),_0x349f71['uniqueid']),_0x349f71);queues[_0x349f71['transfereeuniqueid']][_0xa64b('0x40')]=!![];queues[_0x349f71['transfereeuniqueid']][_0xa64b('0x46')]='BLIND';queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0x47')]=_0x349f71[_0xa64b('0x48')];queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0x49')]=_0x349f71[_0xa64b('0x44')];queues[_0x349f71[_0xa64b('0x44')]][_0xa64b('0xb')]=_0xa64b('0x4a');utils[_0xa64b('0x3')](util['format'](_0xa64b('0x4b'),_0x349f71[_0xa64b('0x6')],queues[_0x349f71[_0xa64b('0x44')]]['name'],_0x349f71['transfereeuniqueid'],_0x349f71[_0xa64b('0x48')]));}}catch(_0x113a7e){utils['error'](util[_0xa64b('0x4')]('[%s][queues][blindtransfer]',_0x349f71[_0xa64b('0x6')]),_0x113a7e);}};exports['attendedtransfer']=function(_0x568efc){try{utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x4c'),_0x568efc[_0xa64b('0x4d')]),_0x568efc);if(_0x568efc[_0xa64b('0x4d')]==_0x568efc['origtransfererlinkedid']){if(!_[_0xa64b('0x1a')](queues[_0x568efc[_0xa64b('0x4e')]])){utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x20')],_0x568efc[_0xa64b('0x4f')]));queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x40')]=!![];queues[_0x568efc['secondtransfererlinkedid']][_0xa64b('0x46')]='ATTENDED';queues[_0x568efc['secondtransfererlinkedid']][_0xa64b('0x47')]=_0x568efc[_0xa64b('0x4f')];queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x49')]=_0x568efc[_0xa64b('0x4d')];queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0xb')]=_0xa64b('0x50');}if(!_[_0xa64b('0x1a')](queues[_0x568efc['origtransfererlinkedid']])){if(_0x568efc['transfereelinkedid']&&queues[_0x568efc[_0xa64b('0x51')]]){queues[_0x568efc['transfereelinkedid']][_0xa64b('0x22')]=0x1;queues[_0x568efc[_0xa64b('0x44')]]=_[_0xa64b('0x52')](queues[_0x568efc[_0xa64b('0x51')]]);queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x53')];queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x22')]=0x2;queues[_0x568efc[_0xa64b('0x44')]]['calleridnum']=queues[_0x568efc[_0xa64b('0x4e')]]['calleridnum'];queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x54')]=queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x54')];queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x36')]=utils['now']();queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x1c')]=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x35')]=0x0;queues[_0x568efc[_0xa64b('0x44')]]['mohtime']=0x0;utils['info'](util[_0xa64b('0x4')](_0xa64b('0x55'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x44')]]['name'],queues[_0x568efc[_0xa64b('0x44')]][_0xa64b('0x9')],queues[_0x568efc['transfereeuniqueid']][_0xa64b('0x54')]));}else{utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc['origtransfererlinkedid']][_0xa64b('0x20')],_0x568efc[_0xa64b('0x4e')]));queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x4e')];}}}else if(_0x568efc[_0xa64b('0x57')]==_0x568efc[_0xa64b('0x4e')]){if(!_[_0xa64b('0x1a')](queues[_0x568efc[_0xa64b('0x56')]])){utils[_0xa64b('0x3')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x20')],_0x568efc[_0xa64b('0x57')],_0x568efc[_0xa64b('0x58')]));queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x40')]=!![];queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x46')]=_0xa64b('0x59');queues[_0x568efc[_0xa64b('0x56')]]['transferexten']=_0x568efc[_0xa64b('0x58')];queues[_0x568efc[_0xa64b('0x56')]]['transferuniqueid']=_0x568efc['secondtransfereruniqueid'];queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0xb')]=_0xa64b('0x50');}if(!_['isNil'](queues[_0x568efc['secondtransfererlinkedid']])){if(_0x568efc['transfertargetlinkedid']&&queues[_0x568efc[_0xa64b('0x5a')]]){queues[_0x568efc[_0xa64b('0x5a')]][_0xa64b('0x22')]=0x1;queues[_0x568efc[_0xa64b('0x53')]]=_[_0xa64b('0x52')](queues[_0x568efc[_0xa64b('0x5a')]]);queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x11')]=_0x568efc[_0xa64b('0x53')];queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x22')]=0x2;queues[_0x568efc[_0xa64b('0x53')]]['calleridnum']=queues[_0x568efc[_0xa64b('0x56')]][_0xa64b('0x9')];queues[_0x568efc['transfertargetuniqueid']][_0xa64b('0x54')]=queues[_0x568efc[_0xa64b('0x56')]]['calleridname'];queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x36')]=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x53')]]['queuecallerleaveAt']=utils[_0xa64b('0x17')]();queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x35')]=0x0;queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x5b')]=0x0;utils['info'](util[_0xa64b('0x4')](_0xa64b('0x5c'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x53')]][_0xa64b('0x20')],queues[_0x568efc[_0xa64b('0x53')]]['transfereduniqueid'],queues[_0x568efc[_0xa64b('0x53')]]['calleridnum'],queues[_0x568efc['transfertargetuniqueid']][_0xa64b('0x54')]));}else{utils[_0xa64b('0x3')](util['format'](_0xa64b('0x5d'),_0x568efc[_0xa64b('0x4d')],queues[_0x568efc[_0xa64b('0x4e')]][_0xa64b('0x20')],_0x568efc['origtransfererlinkedid']));queues[_0x568efc[_0xa64b('0x4e')]]['transfereduniqueid']=_0x568efc[_0xa64b('0x56')];}}}}catch(_0x53de27){utils[_0xa64b('0x18')](util[_0xa64b('0x4')]('[%s][queues][attendedtransfer]',_0x568efc['origtransfereruniqueid']),_0x53de27);}};exports['musiconholdstart']=function(_0x300f2e){try{if(!_[_0xa64b('0x1a')](queues[_0x300f2e[_0xa64b('0x6')]])){utils['debug'](util[_0xa64b('0x4')](_0xa64b('0x5e'),_0x300f2e[_0xa64b('0x6')]),_0x300f2e);queues[_0x300f2e[_0xa64b('0x6')]][_0xa64b('0x5f')]=utils[_0xa64b('0x17')]();utils['info'](util['format'](_0xa64b('0x60'),_0x300f2e[_0xa64b('0x6')],queues[_0x300f2e[_0xa64b('0x6')]][_0xa64b('0x20')],queues[_0x300f2e['uniqueid']][_0xa64b('0x5f')]));}}catch(_0x498775){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x5e'),_0x300f2e[_0xa64b('0x6')]),_0x498775);}};exports[_0xa64b('0x61')]=function(_0x9f920b){try{if(!_[_0xa64b('0x1a')](queues[_0x9f920b[_0xa64b('0x6')]])){if(!_[_0xa64b('0x1a')](queues[_0x9f920b['uniqueid']]['musiconholdstartAt'])){utils[_0xa64b('0x13')](util[_0xa64b('0x4')](_0xa64b('0x62'),_0x9f920b[_0xa64b('0x6')]),_0x9f920b);queues[_0x9f920b[_0xa64b('0x6')]][_0xa64b('0x5b')]+=utils['diffTime'](utils['now'](),queues[_0x9f920b[_0xa64b('0x6')]][_0xa64b('0x5f')]);utils[_0xa64b('0x3')](util[_0xa64b('0x4')](_0xa64b('0x63'),_0x9f920b[_0xa64b('0x6')],queues[_0x9f920b[_0xa64b('0x6')]]['name'],queues[_0x9f920b['uniqueid']][_0xa64b('0x5b')]));delete queues[_0x9f920b['uniqueid']][_0xa64b('0x5f')];}}}catch(_0x2b1903){utils[_0xa64b('0x18')](util[_0xa64b('0x4')](_0xa64b('0x62'),_0x9f920b[_0xa64b('0x6')]),_0x2b1903);}}; \ No newline at end of file +var _0x94a9=['BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%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','mohtime','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid'];(function(_0x345695,_0x2ba140){var _0x5002d3=function(_0x1f6cbb){while(--_0x1f6cbb){_0x345695['push'](_0x345695['shift']());}};_0x5002d3(++_0x2ba140);}(_0x94a9,0xe3));var _0x994a=function(_0x39a2ec,_0xa1f7dd){_0x39a2ec=_0x39a2ec-0x0;var _0x14bc4d=_0x94a9[_0x39a2ec];return _0x14bc4d;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x3d4cd9){utils[_0x994a('0x0')](util[_0x994a('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3d4cd9['uniqueid'],_0x3d4cd9[_0x994a('0x2')],_0x3d4cd9[_0x994a('0x3')],_0x3d4cd9[_0x994a('0x4')],_0x3d4cd9[_0x994a('0x5')],_0x3d4cd9[_0x994a('0x6')],_0x3d4cd9[_0x994a('0x7')]));if(_0x3d4cd9[_0x994a('0x3')]){utils['getVoiceQueueByName'](_0x3d4cd9[_0x994a('0x3')])[_0x994a('0x8')](function(_0x3854ad){if(_0x3854ad){_0x3d4cd9[_0x994a('0x9')]=_0x3854ad[_0x994a('0x9')];}utils['request']('CreateVoiceQueueReport',_0x3d4cd9);});}else{utils['request'](_0x994a('0xa'),_0x3d4cd9);}if(_0x3d4cd9[_0x994a('0xb')]){delete queues[_0x3d4cd9[_0x994a('0xb')]];}else{delete queues[_0x3d4cd9[_0x994a('0xc')]];}}exports[_0x994a('0xd')]=function(_0x2e73f4){try{utils[_0x994a('0xe')](util['format'](_0x994a('0xf'),_0x2e73f4[_0x994a('0xc')]),_0x2e73f4);utils['info'](util[_0x994a('0x1')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x2e73f4[_0x994a('0xc')],_0x2e73f4[_0x994a('0x3')],_0x2e73f4[_0x994a('0x10')]));queues[_0x2e73f4[_0x994a('0xc')]]=_[_0x994a('0x11')](_0x2e73f4,{'originalposition':_0x2e73f4[_0x994a('0x10')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5366ed){utils[_0x994a('0x12')](util[_0x994a('0x1')](_0x994a('0xf'),_0x2e73f4[_0x994a('0xc')]),_0x5366ed);}};exports[_0x994a('0x13')]=function(_0x2084ba){try{if(!_[_0x994a('0x14')](queues[_0x2084ba[_0x994a('0xc')]])){utils[_0x994a('0xe')](util[_0x994a('0x1')](_0x994a('0x15'),_0x2084ba['uniqueid']),_0x2084ba);if(queues[_0x2084ba['uniqueid']][_0x994a('0x16')]){if(!queues[_0x2084ba['uniqueid']][_0x994a('0x17')]&&!queues[_0x2084ba['uniqueid']][_0x994a('0x18')]){queues[_0x2084ba[_0x994a('0xc')]]['queuecallercomplete']=!![];queues[_0x2084ba['uniqueid']][_0x994a('0x19')]=utils['now']();queues[_0x2084ba[_0x994a('0xc')]][_0x994a('0x7')]='COMPLETEDBYAGENT';}utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x1a'),_0x2084ba[_0x994a('0xc')],queues[_0x2084ba['uniqueid']]['name'],queues[_0x2084ba[_0x994a('0xc')]]['queuecallerexitreason']));writeDB(queues[_0x2084ba[_0x994a('0xc')]]);}else if(queues[_0x2084ba[_0x994a('0xc')]][_0x994a('0xb')]){utils['info'](util['format'](_0x994a('0x1b'),_0x2084ba[_0x994a('0xc')],queues[_0x2084ba[_0x994a('0xc')]][_0x994a('0x1c')],queues[_0x2084ba[_0x994a('0xc')]][_0x994a('0xb')]));queues[queues[_0x2084ba[_0x994a('0xc')]]['transfereduniqueid']]=queues[_0x2084ba['uniqueid']];queues[queues[_0x2084ba['uniqueid']]['transfereduniqueid']][_0x994a('0x1d')]=0x2;delete queues[_0x2084ba[_0x994a('0xc')]];}}}catch(_0x301704){utils[_0x994a('0x12')](util[_0x994a('0x1')](_0x994a('0x15'),_0x2084ba[_0x994a('0xc')]),_0x301704);}};exports[_0x994a('0x1e')]=function(_0x248185){try{utils['debug'](util[_0x994a('0x1')](_0x994a('0x1f'),_0x248185[_0x994a('0xc')]),_0x248185);if(!_[_0x994a('0x14')](_0x248185[_0x994a('0x20')]['queuestatus'])&&_0x248185[_0x994a('0x21')][_0x994a('0x22')]()!==_0x994a('0x23')){if(!_[_0x994a('0x14')](queues[_0x248185[_0x994a('0xc')]])){queues[_0x248185[_0x994a('0xc')]][_0x994a('0x17')]=![];queues[_0x248185[_0x994a('0xc')]][_0x994a('0x24')]=null;queues[_0x248185[_0x994a('0xc')]][_0x994a('0x18')]=!![];queues[_0x248185[_0x994a('0xc')]][_0x994a('0x25')]=utils[_0x994a('0x26')]();queues[_0x248185[_0x994a('0xc')]]['queuecallerexitreason']=_0x248185[_0x994a('0x21')][_0x994a('0x22')]();utils['info'](util['format'](_0x994a('0x27'),_0x248185[_0x994a('0xc')],queues[_0x248185['uniqueid']]['name'],_0x248185[_0x994a('0x21')],queues[_0x248185['uniqueid']][_0x994a('0x7')]));writeDB(queues[_0x248185['uniqueid']]);}}else if(!_[_0x994a('0x14')](_0x248185[_0x994a('0x20')]['queueposition'])){if(!_[_0x994a('0x14')](queues[_0x248185[_0x994a('0xc')]])&&!queues[_0x248185[_0x994a('0xc')]]['queuecallerabandon']){queues[_0x248185[_0x994a('0xc')]][_0x994a('0x17')]=![];queues[_0x248185['uniqueid']][_0x994a('0x24')]=null;queues[_0x248185['uniqueid']][_0x994a('0x18')]=!![];queues[_0x248185['uniqueid']][_0x994a('0x25')]=utils[_0x994a('0x26')]();queues[_0x248185['uniqueid']][_0x994a('0x7')]='EXITWITHKEY';utils[_0x994a('0x0')](util[_0x994a('0x1')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x248185[_0x994a('0xc')],queues[_0x248185[_0x994a('0xc')]][_0x994a('0x1c')],_0x248185['value'],queues[_0x248185[_0x994a('0xc')]]['queuecallerexitreason']));}}}catch(_0x184e0a){utils[_0x994a('0x12')](util[_0x994a('0x1')]('[%s][queues][varset]',_0x248185[_0x994a('0xc')]),_0x184e0a);}};exports[_0x994a('0x17')]=function(_0x37e2d5){try{if(!_[_0x994a('0x14')](queues[_0x37e2d5[_0x994a('0xc')]])){utils[_0x994a('0xe')](util[_0x994a('0x1')](_0x994a('0x28'),_0x37e2d5[_0x994a('0xc')]),_0x37e2d5);queues[_0x37e2d5[_0x994a('0xc')]][_0x994a('0x18')]=![];queues[_0x37e2d5[_0x994a('0xc')]][_0x994a('0x25')]=null;queues[_0x37e2d5[_0x994a('0xc')]]['queuecallerabandon']=!![];queues[_0x37e2d5[_0x994a('0xc')]][_0x994a('0x24')]=utils[_0x994a('0x26')]();queues[_0x37e2d5['uniqueid']][_0x994a('0x7')]=_0x994a('0x29');utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x2a'),_0x37e2d5[_0x994a('0xc')],queues[_0x37e2d5['uniqueid']][_0x994a('0x1c')],queues[_0x37e2d5[_0x994a('0xc')]]['queuecallerexitreason']));}}catch(_0x196e94){utils[_0x994a('0x12')](util[_0x994a('0x1')](_0x994a('0x28'),_0x37e2d5[_0x994a('0xc')]),_0x196e94);}};exports[_0x994a('0x2b')]=function(_0x3bfdec){try{if(!_[_0x994a('0x14')](queues[_0x3bfdec[_0x994a('0xc')]])){utils[_0x994a('0xe')](util[_0x994a('0x1')](_0x994a('0x2c'),_0x3bfdec[_0x994a('0xc')]),_0x3bfdec);utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x2d'),_0x3bfdec['uniqueid'],queues[_0x3bfdec[_0x994a('0xc')]][_0x994a('0x1c')],_0x3bfdec[_0x994a('0x2e')],_0x3bfdec['connectedlinename']));queues[_0x3bfdec['uniqueid']][_0x994a('0x2b')]=!![];queues[_0x3bfdec[_0x994a('0xc')]]['queuecallerleaveAt']=utils[_0x994a('0x26')]();queues[_0x3bfdec[_0x994a('0xc')]][_0x994a('0x2f')]=utils[_0x994a('0x30')](queues[_0x3bfdec[_0x994a('0xc')]][_0x994a('0x16')],queues[_0x3bfdec[_0x994a('0xc')]][_0x994a('0x31')]);queues[_0x3bfdec['uniqueid']][_0x994a('0x10')]=_0x3bfdec['position'];queues[_0x3bfdec[_0x994a('0xc')]][_0x994a('0x32')]=_0x3bfdec[_0x994a('0x32')];queues[_0x3bfdec['uniqueid']][_0x994a('0x2e')]=_0x3bfdec[_0x994a('0x2e')];queues[_0x3bfdec['uniqueid']][_0x994a('0x33')]=_0x3bfdec[_0x994a('0x33')];}}catch(_0x1a941d){utils[_0x994a('0x12')](util['format'](_0x994a('0x2c'),_0x3bfdec['uniqueid']),_0x1a941d);}};exports[_0x994a('0x34')]=function(_0x1b89d9){try{if(!_[_0x994a('0x14')](queues[_0x1b89d9['uniqueid']])){utils[_0x994a('0xe')](util['format'](_0x994a('0x35'),_0x1b89d9['uniqueid']),_0x1b89d9);utils[_0x994a('0x0')](util['format'](_0x994a('0x36'),_0x1b89d9[_0x994a('0xc')],queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x1c')],_0x1b89d9[_0x994a('0x37')],_0x1b89d9[_0x994a('0x38')]));queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x17')]=![];queues[_0x1b89d9[_0x994a('0xc')]]['queuecallerabandon']=![];queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x24')]=null;queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x18')]=![];queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x7')]=null;queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x25')]=null;queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x39')]=!![];queues[_0x1b89d9[_0x994a('0xc')]]['accountcode']=_0x1b89d9[_0x994a('0x38')];queues[_0x1b89d9[_0x994a('0xc')]][_0x994a('0x4')]=_0x1b89d9[_0x994a('0x37')];}}catch(_0x56932d){utils['error'](util['format'](_0x994a('0x35'),_0x1b89d9[_0x994a('0xc')]),_0x56932d);}};exports[_0x994a('0x3a')]=function(_0x1a5602){try{if(!_['isNil'](queues[_0x1a5602[_0x994a('0xc')]])){if(queues[_0x1a5602['uniqueid']][_0x994a('0x16')]){utils[_0x994a('0xe')](util[_0x994a('0x1')](_0x994a('0x3b'),_0x1a5602[_0x994a('0xc')]),_0x1a5602);queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x17')]=![];queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x17')]=![];queues[_0x1a5602['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x18')]=![];queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x25')]=null;queues[_0x1a5602['uniqueid']][_0x994a('0x39')]=!![];queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x4')]=_0x1a5602['membername'];queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x3c')]=!![];queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x19')]=utils['now']();if(_0x1a5602[_0x994a('0x3d')]==_0x994a('0x3e')){if(!queues[_0x1a5602['uniqueid']][_0x994a('0x3e')]){queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x7')]='TRANSFER';}}else{queues[_0x1a5602[_0x994a('0xc')]]['queuecallerexitreason']=_0x994a('0x3f')+_0x1a5602[_0x994a('0x3d')][_0x994a('0x22')]();}utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x40'),_0x1a5602['uniqueid'],queues[_0x1a5602['uniqueid']][_0x994a('0x1c')],_0x1a5602['membername'],queues[_0x1a5602[_0x994a('0xc')]][_0x994a('0x7')]));writeDB(queues[_0x1a5602[_0x994a('0xc')]]);}}}catch(_0x58db66){utils[_0x994a('0x12')](util[_0x994a('0x1')](_0x994a('0x3b'),_0x1a5602[_0x994a('0xc')]),_0x58db66);}};exports[_0x994a('0x41')]=function(_0x3f0fc3){try{if(!_[_0x994a('0x14')](queues[_0x3f0fc3[_0x994a('0x42')]])){utils[_0x994a('0xe')](util['format']('[%s][queues][blindtransfer]',_0x3f0fc3['uniqueid']),_0x3f0fc3);queues[_0x3f0fc3['transfereeuniqueid']]['transfer']=!![];queues[_0x3f0fc3[_0x994a('0x42')]][_0x994a('0x43')]='BLIND';queues[_0x3f0fc3[_0x994a('0x42')]][_0x994a('0x44')]=_0x3f0fc3['extension'];queues[_0x3f0fc3['transfereeuniqueid']][_0x994a('0x45')]=_0x3f0fc3[_0x994a('0x42')];queues[_0x3f0fc3[_0x994a('0x42')]][_0x994a('0x7')]=_0x994a('0x46');utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x47'),_0x3f0fc3['uniqueid'],queues[_0x3f0fc3[_0x994a('0x42')]][_0x994a('0x1c')],_0x3f0fc3[_0x994a('0x42')],_0x3f0fc3[_0x994a('0x48')]));}}catch(_0x1d9bbf){utils['error'](util[_0x994a('0x1')](_0x994a('0x49'),_0x3f0fc3[_0x994a('0xc')]),_0x1d9bbf);}};exports['attendedtransfer']=function(_0x579ced){try{utils[_0x994a('0xe')](util[_0x994a('0x1')]('[%s][queues][attendedtransfer]',_0x579ced[_0x994a('0x4a')]),_0x579ced);if(_0x579ced[_0x994a('0x4a')]==_0x579ced[_0x994a('0x4b')]){if(!_[_0x994a('0x14')](queues[_0x579ced['secondtransfererlinkedid']])){utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x4c'),_0x579ced['origtransfereruniqueid'],queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x1c')],_0x579ced[_0x994a('0x4e')]));queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x3e')]=!![];queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x43')]=_0x994a('0x4f');queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x44')]=_0x579ced['origtransfererexten'];queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x45')]=_0x579ced[_0x994a('0x4a')];queues[_0x579ced['secondtransfererlinkedid']][_0x994a('0x7')]=_0x994a('0x50');}if(!_[_0x994a('0x14')](queues[_0x579ced[_0x994a('0x4b')]])){if(_0x579ced['transfereelinkedid']&&queues[_0x579ced[_0x994a('0x51')]]){queues[_0x579ced['transfereelinkedid']][_0x994a('0x1d')]=0x1;queues[_0x579ced[_0x994a('0x42')]]=_[_0x994a('0x52')](queues[_0x579ced[_0x994a('0x51')]]);queues[_0x579ced[_0x994a('0x42')]][_0x994a('0xb')]=_0x579ced[_0x994a('0x53')];queues[_0x579ced['transfereeuniqueid']][_0x994a('0x1d')]=0x2;queues[_0x579ced[_0x994a('0x42')]][_0x994a('0x5')]=queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x5')];queues[_0x579ced['transfereeuniqueid']][_0x994a('0x54')]=queues[_0x579ced['secondtransfererlinkedid']][_0x994a('0x54')];queues[_0x579ced[_0x994a('0x42')]][_0x994a('0x31')]=utils[_0x994a('0x26')]();queues[_0x579ced[_0x994a('0x42')]][_0x994a('0x16')]=utils['now']();queues[_0x579ced[_0x994a('0x42')]][_0x994a('0x2f')]=0x0;queues[_0x579ced['transfereeuniqueid']]['mohtime']=0x0;utils['info'](util[_0x994a('0x1')](_0x994a('0x55'),_0x579ced[_0x994a('0x4a')],queues[_0x579ced[_0x994a('0x42')]]['name'],queues[_0x579ced[_0x994a('0x42')]]['calleridnum'],queues[_0x579ced[_0x994a('0x42')]][_0x994a('0x54')]));}else{utils[_0x994a('0x0')](util['format'](_0x994a('0x56'),_0x579ced[_0x994a('0x4a')],queues[_0x579ced[_0x994a('0x4b')]][_0x994a('0x1c')],_0x579ced['secondtransfererlinkedid']));queues[_0x579ced['origtransfererlinkedid']][_0x994a('0xb')]=_0x579ced[_0x994a('0x4d')];}}}else if(_0x579ced[_0x994a('0x57')]==_0x579ced[_0x994a('0x4d')]){if(!_[_0x994a('0x14')](queues[_0x579ced[_0x994a('0x4b')]])){utils[_0x994a('0x0')](util['format'](_0x994a('0x58'),_0x579ced['origtransfereruniqueid'],queues[_0x579ced[_0x994a('0x4b')]]['name'],_0x579ced[_0x994a('0x57')],_0x579ced[_0x994a('0x59')]));queues[_0x579ced['origtransfererlinkedid']]['transfer']=!![];queues[_0x579ced[_0x994a('0x4b')]][_0x994a('0x43')]='ATTENDED';queues[_0x579ced[_0x994a('0x4b')]][_0x994a('0x44')]=_0x579ced[_0x994a('0x59')];queues[_0x579ced['origtransfererlinkedid']][_0x994a('0x45')]=_0x579ced[_0x994a('0x57')];queues[_0x579ced[_0x994a('0x4b')]][_0x994a('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x994a('0x14')](queues[_0x579ced[_0x994a('0x4d')]])){if(_0x579ced['transfertargetlinkedid']&&queues[_0x579ced[_0x994a('0x5a')]]){queues[_0x579ced[_0x994a('0x5a')]][_0x994a('0x1d')]=0x1;queues[_0x579ced[_0x994a('0x53')]]=_[_0x994a('0x52')](queues[_0x579ced[_0x994a('0x5a')]]);queues[_0x579ced[_0x994a('0x53')]][_0x994a('0xb')]=_0x579ced['transfertargetuniqueid'];queues[_0x579ced[_0x994a('0x53')]]['queuecallerenterreason']=0x2;queues[_0x579ced['transfertargetuniqueid']][_0x994a('0x5')]=queues[_0x579ced[_0x994a('0x4b')]][_0x994a('0x5')];queues[_0x579ced[_0x994a('0x53')]][_0x994a('0x54')]=queues[_0x579ced[_0x994a('0x4b')]]['calleridname'];queues[_0x579ced['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x994a('0x26')]();queues[_0x579ced['transfertargetuniqueid']][_0x994a('0x16')]=utils[_0x994a('0x26')]();queues[_0x579ced[_0x994a('0x53')]][_0x994a('0x2f')]=0x0;queues[_0x579ced[_0x994a('0x53')]][_0x994a('0x5b')]=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x579ced['origtransfereruniqueid'],queues[_0x579ced[_0x994a('0x53')]][_0x994a('0x1c')],queues[_0x579ced['transfertargetuniqueid']][_0x994a('0xb')],queues[_0x579ced[_0x994a('0x53')]][_0x994a('0x5')],queues[_0x579ced['transfertargetuniqueid']][_0x994a('0x54')]));}else{utils[_0x994a('0x0')](util[_0x994a('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x579ced['origtransfereruniqueid'],queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0x1c')],_0x579ced[_0x994a('0x4b')]));queues[_0x579ced[_0x994a('0x4d')]][_0x994a('0xb')]=_0x579ced[_0x994a('0x4b')];}}}}catch(_0x7025e2){utils['error'](util[_0x994a('0x1')](_0x994a('0x5c'),_0x579ced[_0x994a('0x4a')]),_0x7025e2);}};exports['musiconholdstart']=function(_0x3193e2){try{if(!_[_0x994a('0x14')](queues[_0x3193e2['uniqueid']])){utils['debug'](util[_0x994a('0x1')](_0x994a('0x5d'),_0x3193e2['uniqueid']),_0x3193e2);queues[_0x3193e2['uniqueid']][_0x994a('0x5e')]=utils['now']();utils[_0x994a('0x0')](util[_0x994a('0x1')](_0x994a('0x5f'),_0x3193e2[_0x994a('0xc')],queues[_0x3193e2['uniqueid']]['name'],queues[_0x3193e2[_0x994a('0xc')]][_0x994a('0x5e')]));}}catch(_0x161296){utils[_0x994a('0x12')](util[_0x994a('0x1')]('[%s][queues][musiconholdstart]',_0x3193e2[_0x994a('0xc')]),_0x161296);}};exports[_0x994a('0x60')]=function(_0x2134a9){try{if(!_[_0x994a('0x14')](queues[_0x2134a9[_0x994a('0xc')]])){if(!_[_0x994a('0x14')](queues[_0x2134a9['uniqueid']][_0x994a('0x5e')])){utils[_0x994a('0xe')](util['format'](_0x994a('0x61'),_0x2134a9[_0x994a('0xc')]),_0x2134a9);queues[_0x2134a9[_0x994a('0xc')]]['mohtime']+=utils[_0x994a('0x30')](utils['now'](),queues[_0x2134a9[_0x994a('0xc')]]['musiconholdstartAt']);utils[_0x994a('0x0')](util['format'](_0x994a('0x62'),_0x2134a9[_0x994a('0xc')],queues[_0x2134a9[_0x994a('0xc')]][_0x994a('0x1c')],queues[_0x2134a9[_0x994a('0xc')]][_0x994a('0x5b')]));delete queues[_0x2134a9['uniqueid']][_0x994a('0x5e')];}}}catch(_0x20953e){utils[_0x994a('0x12')](util[_0x994a('0x1')]('[%s][queues][musiconholdstop]',_0x2134a9[_0x994a('0xc')]),_0x20953e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index cbfcdbf..61a0495 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 _0x6ff4=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','outbound','connectedlinename','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','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','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newstate]','isNil','channel','linkedid','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0x6ff4,0xf6));var _0x46ff=function(_0x250d30,_0x47671e){_0x250d30=_0x250d30-0x0;var _0x55326a=_0x6ff4[_0x250d30];return _0x55326a;};'use strict';var _=require(_0x46ff('0x0'));var util=require('util');var utils=require(_0x46ff('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x3ade27){var _0x3241b2;utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x4'),_0x3ade27[_0x46ff('0x5')]));if(transfers[_0x46ff('0x6')][_0x3ade27[_0x46ff('0x5')]]){_0x3241b2=_0x3ade27['uniqueid'];_0x3ade27['uniqueid']=transfers[_0x46ff('0x6')][_0x3ade27[_0x46ff('0x5')]][_0x46ff('0x7')];}if(_0x3ade27[_0x46ff('0x8')]){utils['getUserByInternal'](_0x3ade27['accountcode'])[_0x46ff('0x9')](function(_0x3aacda){if(_0x3aacda){_0x3ade27['membername']=_0x3aacda['name'];_0x3ade27[_0x46ff('0xa')]=_0x3aacda['id'];}utils[_0x46ff('0xb')]('CreateVoiceRecording',_0x3ade27);});}else{utils[_0x46ff('0xb')](_0x46ff('0xc'),_0x3ade27);}if(_0x3241b2)delete transfers[_0x46ff('0x6')][_0x3241b2];}exports[_0x46ff('0xd')]=function(_0x396a2c){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0xf'),_0x396a2c['uniqueid']),_0x396a2c);if(_0x396a2c[_0x46ff('0x5')]==_0x396a2c['linkedid']){utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x10'),_0x396a2c['uniqueid'],_0x396a2c[_0x46ff('0x11')],_0x396a2c[_0x46ff('0x12')]));recordings[_0x396a2c[_0x46ff('0x5')]]={'uniqueid':_0x396a2c[_0x46ff('0x5')],'accountcode':_0x396a2c[_0x46ff('0x8')],'exten':_0x396a2c[_0x46ff('0x12')],'context':_0x396a2c[_0x46ff('0x11')],'channel':_0x396a2c['channel'],'monitors':[]};}}catch(_0x279b47){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0xf'),_0x396a2c[_0x46ff('0x5')]),_0x279b47);}};exports['newstate']=function(_0xb9aece){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x14'),_0xb9aece['uniqueid']),_0xb9aece);if(!_[_0x46ff('0x15')](recordings[_0xb9aece[_0x46ff('0x5')]])&&_0xb9aece['channelstate']==0x6){utils[_0x46ff('0x2')](util[_0x46ff('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xb9aece[_0x46ff('0x5')],_0xb9aece['context'],_0xb9aece[_0x46ff('0x16')]));}else if(!_['isNil'](recordings[_0xb9aece[_0x46ff('0x17')]])&&_0xb9aece[_0x46ff('0x18')]==0x6&&_0xb9aece[_0x46ff('0x11')]!=_0x46ff('0x19')){utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x1a'),_0xb9aece['uniqueid'],_0xb9aece[_0x46ff('0x17')],_0xb9aece[_0x46ff('0x11')],_0xb9aece[_0x46ff('0x16')]));recordings[_0xb9aece[_0x46ff('0x17')]]['accountcode']=_0xb9aece[_0x46ff('0x8')];}}catch(_0x25ac3a){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x14'),_0xb9aece['uniqueid']),_0x25ac3a);}};exports[_0x46ff('0x1b')]=function(_0x85f30c){try{if(!_['isNil'](_0x85f30c[_0x46ff('0x1c')])&&!_[_0x46ff('0x15')](_0x85f30c['variable'][_0x46ff('0x1d')])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x1e'),_0x85f30c[_0x46ff('0x5')]),_0x85f30c);utils[_0x46ff('0x2')](util['format'](_0x46ff('0x1f'),_0x85f30c[_0x46ff('0x5')],_0x85f30c[_0x46ff('0x1c')],_0x85f30c['value']));if(_[_0x46ff('0x20')](_0x85f30c[_0x46ff('0x21')],_0x46ff('0x22'))){_0x85f30c[_0x46ff('0x21')]=_0x85f30c[_0x46ff('0x21')]['replace'](_0x46ff('0x22'),'.WAV');}if(recordings[_0x85f30c[_0x46ff('0x17')]]){var _0x312d37=_[_0x46ff('0x23')](recordings[_0x85f30c['linkedid']][_0x46ff('0x24')],{'value':_0x85f30c[_0x46ff('0x21')]});if(_[_0x46ff('0x15')](_0x312d37)){recordings[_0x85f30c[_0x46ff('0x17')]][_0x46ff('0x24')][_0x46ff('0x25')]({'value':_0x85f30c['value']});}}}}catch(_0x31a0fe){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x1e'),_0x85f30c[_0x46ff('0x5')]),_0x31a0fe);}};exports[_0x46ff('0x26')]=function(_0x5eacb0){try{if(!_[_0x46ff('0x15')](recordings[_0x5eacb0[_0x46ff('0x5')]])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x27'),_0x5eacb0[_0x46ff('0x5')]),_0x5eacb0);utils[_0x46ff('0x2')](util['format'](_0x46ff('0x28'),_0x5eacb0[_0x46ff('0x5')],_0x5eacb0[_0x46ff('0x29')],_0x5eacb0[_0x46ff('0x2a')],_0x5eacb0[_0x46ff('0x2b')]));recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x29')]=_0x5eacb0[_0x46ff('0x29')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2a')]=_0x5eacb0[_0x46ff('0x2a')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2c')]=_0x5eacb0['connectedlinenum'];recordings[_0x5eacb0[_0x46ff('0x5')]]['connectedlinename']=_0x5eacb0['connectedlinename'];if(recordings[_0x5eacb0[_0x46ff('0x5')]]['type']==_0x46ff('0x2d')&&recordings[_0x5eacb0[_0x46ff('0x5')]]['accountcode']){recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2c')]=recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x8')];recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x2e')]='';}recordings[_0x5eacb0[_0x46ff('0x5')]][_0x46ff('0x24')]['forEach'](function(_0x2d590b){var _0x168f5a=_[_0x46ff('0x2f')](recordings[_0x5eacb0[_0x46ff('0x5')]]);_0x168f5a[_0x46ff('0x21')]=_0x2d590b[_0x46ff('0x21')];writeDB(_0x168f5a);});delete recordings[_0x5eacb0[_0x46ff('0x5')]];}}catch(_0x4d7bb7){utils[_0x46ff('0x13')](util[_0x46ff('0x3')]('[%s][recordings][hangup]',_0x5eacb0[_0x46ff('0x5')]),_0x4d7bb7);}};exports[_0x46ff('0x30')]=function(_0x3d7fe4){try{if(!_['isNil'](recordings[_0x3d7fe4[_0x46ff('0x5')]])){utils['debug'](util[_0x46ff('0x3')](_0x46ff('0x31'),_0x3d7fe4[_0x46ff('0x5')]),_0x3d7fe4);utils['info'](util[_0x46ff('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3d7fe4[_0x46ff('0x5')],_0x3d7fe4[_0x46ff('0x32')],_0x3d7fe4[_0x46ff('0x33')]));if(_0x3d7fe4['application'][_0x46ff('0x34')]()=='set'&&_['startsWith'](_0x3d7fe4[_0x46ff('0x33')][_0x46ff('0x34')](),_0x46ff('0x35'))){var _0x5db205=_0x3d7fe4[_0x46ff('0x33')][_0x46ff('0x36')]('=');var _0x409587=_0x5db205[0x0][_0x46ff('0x37')](_0x5db205[0x0][_0x46ff('0x38')]('(')+0x1,_0x5db205[0x0][_0x46ff('0x38')](')'));var _0x40195d=_0x5db205[0x1];recordings[_0x3d7fe4[_0x46ff('0x5')]][_0x409587]=_0x40195d;}}}catch(_0x384800){utils[_0x46ff('0x13')](util[_0x46ff('0x3')](_0x46ff('0x31'),_0x3d7fe4[_0x46ff('0x5')]),_0x384800);}};exports[_0x46ff('0x39')]=function(_0x180741){try{if(!_[_0x46ff('0x15')](recordings[_0x180741[_0x46ff('0x5')]])){utils[_0x46ff('0xe')](util[_0x46ff('0x3')]('[%s][recordings][queuecallerjoin]',_0x180741[_0x46ff('0x5')]),_0x180741);utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x3a'),_0x180741[_0x46ff('0x5')],_0x180741[_0x46ff('0x3b')]));recordings[_0x180741[_0x46ff('0x5')]][_0x46ff('0x3b')]=_0x180741[_0x46ff('0x3b')];}}catch(_0x4f7739){utils[_0x46ff('0x13')](util['format'](_0x46ff('0x3c'),_0x180741[_0x46ff('0x5')]),_0x4f7739);}};exports[_0x46ff('0x3d')]=function(_0x3b3d83){try{utils[_0x46ff('0xe')](util[_0x46ff('0x3')](_0x46ff('0x3e'),_0x3b3d83['uniqueid']),_0x3b3d83);utils[_0x46ff('0x2')](util[_0x46ff('0x3')](_0x46ff('0x3f'),_0x3b3d83[_0x46ff('0x5')],_0x3b3d83['transferercalleridnum'],_0x3b3d83[_0x46ff('0x40')],_0x3b3d83[_0x46ff('0x41')],_0x3b3d83[_0x46ff('0x42')]));if(recordings[_0x3b3d83[_0x46ff('0x43')]]&&transfers[_0x46ff('0x6')][_0x3b3d83[_0x46ff('0x43')]]){transfers['blinds'][_0x3b3d83['transfereruniqueid']][_0x46ff('0x44')]=!![];}}catch(_0x29999e){utils[_0x46ff('0x13')](util[_0x46ff('0x3')]('[%s][recordings][blindtransfer]',_0x3b3d83[_0x46ff('0x5')]),_0x29999e);}}; \ No newline at end of file +var _0x0116=['isNil','channelstate','linkedid','context','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','error','[%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','transfereecalleridnum','transfereruniqueid','recording','lodash','util','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','info','exten','channel','newstate','[%s][recordings][newstate]'];(function(_0x2d90b3,_0x23647c){var _0x492d18=function(_0x37f39f){while(--_0x37f39f){_0x2d90b3['push'](_0x2d90b3['shift']());}};_0x492d18(++_0x23647c);}(_0x0116,0x1cd));var _0x6011=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x0116[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x6011('0x0'));var util=require(_0x6011('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x505740){var _0x35e400;utils['info'](util[_0x6011('0x2')](_0x6011('0x3'),_0x505740[_0x6011('0x4')]));if(transfers[_0x6011('0x5')][_0x505740[_0x6011('0x4')]]){_0x35e400=_0x505740[_0x6011('0x4')];_0x505740['uniqueid']=transfers[_0x6011('0x5')][_0x505740[_0x6011('0x4')]][_0x6011('0x6')];}if(_0x505740[_0x6011('0x7')]){utils[_0x6011('0x8')](_0x505740[_0x6011('0x7')])[_0x6011('0x9')](function(_0x3841d3){if(_0x3841d3){_0x505740[_0x6011('0xa')]=_0x3841d3[_0x6011('0xb')];_0x505740[_0x6011('0xc')]=_0x3841d3['id'];}utils['request'](_0x6011('0xd'),_0x505740);});}else{utils['request'](_0x6011('0xd'),_0x505740);}if(_0x35e400)delete transfers[_0x6011('0x5')][_0x35e400];}exports[_0x6011('0xe')]=function(_0x547105){try{utils[_0x6011('0xf')](util[_0x6011('0x2')](_0x6011('0x10'),_0x547105[_0x6011('0x4')]),_0x547105);if(_0x547105[_0x6011('0x4')]==_0x547105['linkedid']){utils[_0x6011('0x11')](util[_0x6011('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x547105[_0x6011('0x4')],_0x547105['context'],_0x547105[_0x6011('0x12')]));recordings[_0x547105[_0x6011('0x4')]]={'uniqueid':_0x547105[_0x6011('0x4')],'accountcode':_0x547105[_0x6011('0x7')],'exten':_0x547105[_0x6011('0x12')],'context':_0x547105['context'],'channel':_0x547105[_0x6011('0x13')],'monitors':[]};}}catch(_0x25effd){utils['error'](util[_0x6011('0x2')](_0x6011('0x10'),_0x547105[_0x6011('0x4')]),_0x25effd);}};exports[_0x6011('0x14')]=function(_0x3b358c){try{utils['debug'](util[_0x6011('0x2')](_0x6011('0x15'),_0x3b358c[_0x6011('0x4')]),_0x3b358c);if(!_[_0x6011('0x16')](recordings[_0x3b358c[_0x6011('0x4')]])&&_0x3b358c[_0x6011('0x17')]==0x6){utils[_0x6011('0x11')](util[_0x6011('0x2')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3b358c['uniqueid'],_0x3b358c['context'],_0x3b358c[_0x6011('0x13')]));}else if(!_['isNil'](recordings[_0x3b358c[_0x6011('0x18')]])&&_0x3b358c['channelstate']==0x6&&_0x3b358c[_0x6011('0x19')]!=_0x6011('0x1a')){utils[_0x6011('0x11')](util[_0x6011('0x2')](_0x6011('0x1b'),_0x3b358c[_0x6011('0x4')],_0x3b358c['linkedid'],_0x3b358c[_0x6011('0x19')],_0x3b358c[_0x6011('0x13')]));recordings[_0x3b358c[_0x6011('0x18')]][_0x6011('0x7')]=_0x3b358c[_0x6011('0x7')];}}catch(_0x5da02d){utils['error'](util[_0x6011('0x2')](_0x6011('0x15'),_0x3b358c[_0x6011('0x4')]),_0x5da02d);}};exports['varset']=function(_0x38eed1){try{if(!_[_0x6011('0x16')](_0x38eed1[_0x6011('0x1c')])&&!_[_0x6011('0x16')](_0x38eed1[_0x6011('0x1c')]['mixmonitor_filename'])){utils[_0x6011('0xf')](util['format'](_0x6011('0x1d'),_0x38eed1[_0x6011('0x4')]),_0x38eed1);utils['info'](util[_0x6011('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x38eed1[_0x6011('0x4')],_0x38eed1[_0x6011('0x1c')],_0x38eed1[_0x6011('0x1e')]));if(_[_0x6011('0x1f')](_0x38eed1[_0x6011('0x1e')],_0x6011('0x20'))){_0x38eed1['value']=_0x38eed1[_0x6011('0x1e')][_0x6011('0x21')](_0x6011('0x20'),_0x6011('0x22'));}if(recordings[_0x38eed1[_0x6011('0x18')]]){var _0x12e217=_[_0x6011('0x23')](recordings[_0x38eed1['linkedid']][_0x6011('0x24')],{'value':_0x38eed1[_0x6011('0x1e')]});if(_[_0x6011('0x16')](_0x12e217)){recordings[_0x38eed1[_0x6011('0x18')]]['monitors']['push']({'value':_0x38eed1[_0x6011('0x1e')]});}}}}catch(_0x2df471){utils['error'](util['format'](_0x6011('0x1d'),_0x38eed1[_0x6011('0x4')]),_0x2df471);}};exports['hangup']=function(_0x3401ea){try{if(!_['isNil'](recordings[_0x3401ea[_0x6011('0x4')]])){utils['debug'](util[_0x6011('0x2')](_0x6011('0x25'),_0x3401ea[_0x6011('0x4')]),_0x3401ea);utils['info'](util[_0x6011('0x2')](_0x6011('0x26'),_0x3401ea[_0x6011('0x4')],_0x3401ea[_0x6011('0x27')],_0x3401ea['calleridname'],_0x3401ea[_0x6011('0x28')]));recordings[_0x3401ea['uniqueid']][_0x6011('0x27')]=_0x3401ea[_0x6011('0x27')];recordings[_0x3401ea['uniqueid']]['calleridname']=_0x3401ea[_0x6011('0x29')];recordings[_0x3401ea[_0x6011('0x4')]][_0x6011('0x2a')]=_0x3401ea[_0x6011('0x2a')];recordings[_0x3401ea['uniqueid']][_0x6011('0x2b')]=_0x3401ea[_0x6011('0x2b')];if(recordings[_0x3401ea['uniqueid']][_0x6011('0x2c')]==_0x6011('0x2d')&&recordings[_0x3401ea[_0x6011('0x4')]][_0x6011('0x7')]){recordings[_0x3401ea[_0x6011('0x4')]]['connectedlinenum']=recordings[_0x3401ea[_0x6011('0x4')]][_0x6011('0x7')];recordings[_0x3401ea['uniqueid']][_0x6011('0x2b')]='';}recordings[_0x3401ea[_0x6011('0x4')]][_0x6011('0x24')]['forEach'](function(_0x408708){var _0x4d5865=_[_0x6011('0x2e')](recordings[_0x3401ea[_0x6011('0x4')]]);_0x4d5865[_0x6011('0x1e')]=_0x408708[_0x6011('0x1e')];writeDB(_0x4d5865);});delete recordings[_0x3401ea[_0x6011('0x4')]];}}catch(_0x1877cc){utils['error'](util[_0x6011('0x2')]('[%s][recordings][hangup]',_0x3401ea['uniqueid']),_0x1877cc);}};exports[_0x6011('0x2f')]=function(_0x54f7c6){try{if(!_[_0x6011('0x16')](recordings[_0x54f7c6[_0x6011('0x4')]])){utils[_0x6011('0xf')](util['format'](_0x6011('0x30'),_0x54f7c6[_0x6011('0x4')]),_0x54f7c6);utils[_0x6011('0x11')](util['format'](_0x6011('0x31'),_0x54f7c6[_0x6011('0x4')],_0x54f7c6[_0x6011('0x32')],_0x54f7c6[_0x6011('0x33')]));if(_0x54f7c6[_0x6011('0x32')][_0x6011('0x34')]()=='set'&&_[_0x6011('0x35')](_0x54f7c6['appdata']['toLowerCase'](),_0x6011('0x36'))){var _0x3739f1=_0x54f7c6[_0x6011('0x33')]['split']('=');var _0x40a32b=_0x3739f1[0x0][_0x6011('0x37')](_0x3739f1[0x0][_0x6011('0x38')]('(')+0x1,_0x3739f1[0x0][_0x6011('0x38')](')'));var _0x1a030c=_0x3739f1[0x1];recordings[_0x54f7c6[_0x6011('0x4')]][_0x40a32b]=_0x1a030c;}}}catch(_0x2e8836){utils[_0x6011('0x39')](util[_0x6011('0x2')](_0x6011('0x30'),_0x54f7c6[_0x6011('0x4')]),_0x2e8836);}};exports['queuecallerjoin']=function(_0x22e92c){try{if(!_[_0x6011('0x16')](recordings[_0x22e92c['uniqueid']])){utils['debug'](util[_0x6011('0x2')]('[%s][recordings][queuecallerjoin]',_0x22e92c[_0x6011('0x4')]),_0x22e92c);utils[_0x6011('0x11')](util[_0x6011('0x2')](_0x6011('0x3a'),_0x22e92c[_0x6011('0x4')],_0x22e92c[_0x6011('0x3b')]));recordings[_0x22e92c[_0x6011('0x4')]]['queue']=_0x22e92c[_0x6011('0x3b')];}}catch(_0x2dfb95){utils[_0x6011('0x39')](util[_0x6011('0x2')](_0x6011('0x3c'),_0x22e92c[_0x6011('0x4')]),_0x2dfb95);}};exports[_0x6011('0x3d')]=function(_0x3afe9e){try{utils['debug'](util['format'](_0x6011('0x3e'),_0x3afe9e[_0x6011('0x4')]),_0x3afe9e);utils[_0x6011('0x11')](util['format'](_0x6011('0x3f'),_0x3afe9e['uniqueid'],_0x3afe9e[_0x6011('0x40')],_0x3afe9e[_0x6011('0x41')],_0x3afe9e[_0x6011('0x42')],_0x3afe9e['transfereecalleridname']));if(recordings[_0x3afe9e[_0x6011('0x43')]]&&transfers[_0x6011('0x5')][_0x3afe9e[_0x6011('0x43')]]){transfers[_0x6011('0x5')][_0x3afe9e['transfereruniqueid']][_0x6011('0x44')]=!![];}}catch(_0x257d6f){utils[_0x6011('0x39')](util['format']('[%s][recordings][blindtransfer]',_0x3afe9e[_0x6011('0x4')]),_0x257d6f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4c90368..7e504c4 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 _0x6559=['[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','CreateVoiceTransferReport','debug'];(function(_0x23009f,_0x13b826){var _0x58b937=function(_0x4b0e58){while(--_0x4b0e58){_0x23009f['push'](_0x23009f['shift']());}};_0x58b937(++_0x13b826);}(_0x6559,0x1ca));var _0x9655=function(_0x7f96cb,_0x11b2da){_0x7f96cb=_0x7f96cb-0x0;var _0x1b3010=_0x6559[_0x7f96cb];return _0x1b3010;};'use strict';var _=require(_0x9655('0x0'));var util=require('util');var utils=require(_0x9655('0x1'));function writeDB(_0x5b043d){utils[_0x9655('0x2')](util[_0x9655('0x3')](_0x9655('0x4'),_0x5b043d['type']===_0x9655('0x5')?_0x5b043d['origtransfereruniqueid']:_0x5b043d[_0x9655('0x6')],_0x5b043d[_0x9655('0x7')]));utils['request'](_0x9655('0x8'),_0x5b043d);}exports['blinds']={};exports['blindtransfer']=function(_0x599dd0){try{utils[_0x9655('0x9')](util[_0x9655('0x3')](_0x9655('0xa'),_0x599dd0[_0x9655('0x6')]),_0x599dd0);utils[_0x9655('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x599dd0[_0x9655('0x6')],_0x599dd0[_0x9655('0xb')],_0x599dd0[_0x9655('0xc')],_0x599dd0[_0x9655('0xd')],_0x599dd0[_0x9655('0xe')]));_0x599dd0[_0x9655('0x7')]='blind';exports['blinds'][_0x599dd0[_0x9655('0xf')]]=_0x599dd0;writeDB(_0x599dd0);}catch(_0x58a77f){utils[_0x9655('0x10')](util[_0x9655('0x3')](_0x9655('0xa'),_0x599dd0[_0x9655('0x6')]),_0x58a77f);}};exports[_0x9655('0x11')]=function(_0x2313ff){try{utils[_0x9655('0x9')](util['format'](_0x9655('0x12'),_0x2313ff[_0x9655('0x13')]),_0x2313ff);utils['info'](util['format'](_0x9655('0x14'),_0x2313ff[_0x9655('0x13')],_0x2313ff[_0x9655('0x15')],_0x2313ff[_0x9655('0x16')],_0x2313ff[_0x9655('0x17')],_0x2313ff[_0x9655('0x18')]));_0x2313ff=_[_0x9655('0x19')](_0x2313ff,{'transfererchannel':_0x2313ff[_0x9655('0x1a')],'transferercalleridnum':_0x2313ff[_0x9655('0x15')],'transferercalleridname':_0x2313ff[_0x9655('0x16')],'transfererconnectedlinenum':_0x2313ff[_0x9655('0x1b')],'transfererconnectedlinename':_0x2313ff[_0x9655('0x1c')],'transfereraccountcode':_0x2313ff['origtransfereraccountcode'],'transferercontext':_0x2313ff[_0x9655('0x1d')],'transfererexten':_0x2313ff[_0x9655('0x1e')],'transfererlinkedid':_0x2313ff['origtransfererlinkedid'],'context':_0x2313ff[_0x9655('0x1f')],'extension':_0x2313ff[_0x9655('0x20')],'type':'attended'});if(_[_0x9655('0x21')](_0x2313ff[_0x9655('0x22')])){_0x2313ff=_['assign'](_0x2313ff,{'transfereechannel':_0x2313ff[_0x9655('0x23')],'transfereecalleridnum':_0x2313ff[_0x9655('0x17')],'transfereecalleridname':_0x2313ff[_0x9655('0x18')],'transfereeconnectedlinenum':_0x2313ff[_0x9655('0x24')],'transfereeconnectedlinename':_0x2313ff['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2313ff[_0x9655('0x25')],'transfereecontext':_0x2313ff[_0x9655('0x26')],'transfereeexten':_0x2313ff['transfertargetexten'],'transfereelinkedid':_0x2313ff['transfertargetlinkedid']});}writeDB(_0x2313ff);}catch(_0x2ad8c){utils[_0x9655('0x10')](util[_0x9655('0x3')](_0x9655('0x12'),_0x2313ff['origtransfereruniqueid']),_0x2ad8c);}}; \ No newline at end of file +var _0x0eba=['transferercalleridname','transfereecalleridnum','transfereecalleridname','type','transfereruniqueid','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','blinds','blindtransfer','[%s][transfers][blindtransfer]','info','transferercalleridnum'];(function(_0x4a14d2,_0x3e949e){var _0x324939=function(_0x35faca){while(--_0x35faca){_0x4a14d2['push'](_0x4a14d2['shift']());}};_0x324939(++_0x3e949e);}(_0x0eba,0x114));var _0xa0eb=function(_0x3b30d9,_0x5b0292){_0x3b30d9=_0x3b30d9-0x0;var _0x542351=_0x0eba[_0x3b30d9];return _0x542351;};'use strict';var _=require(_0xa0eb('0x0'));var util=require('util');var utils=require(_0xa0eb('0x1'));function writeDB(_0x3648e1){utils['info'](util[_0xa0eb('0x2')](_0xa0eb('0x3'),_0x3648e1['type']===_0xa0eb('0x4')?_0x3648e1['origtransfereruniqueid']:_0x3648e1[_0xa0eb('0x5')],_0x3648e1['type']));utils['request']('CreateVoiceTransferReport',_0x3648e1);}exports[_0xa0eb('0x6')]={};exports[_0xa0eb('0x7')]=function(_0x539784){try{utils['debug'](util[_0xa0eb('0x2')](_0xa0eb('0x8'),_0x539784[_0xa0eb('0x5')]),_0x539784);utils[_0xa0eb('0x9')](util[_0xa0eb('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x539784[_0xa0eb('0x5')],_0x539784[_0xa0eb('0xa')],_0x539784[_0xa0eb('0xb')],_0x539784[_0xa0eb('0xc')],_0x539784[_0xa0eb('0xd')]));_0x539784[_0xa0eb('0xe')]='blind';exports[_0xa0eb('0x6')][_0x539784[_0xa0eb('0xf')]]=_0x539784;writeDB(_0x539784);}catch(_0x3d2418){utils[_0xa0eb('0x10')](util[_0xa0eb('0x2')](_0xa0eb('0x8'),_0x539784[_0xa0eb('0x5')]),_0x3d2418);}};exports[_0xa0eb('0x11')]=function(_0x764576){try{utils[_0xa0eb('0x12')](util[_0xa0eb('0x2')](_0xa0eb('0x13'),_0x764576[_0xa0eb('0x14')]),_0x764576);utils[_0xa0eb('0x9')](util[_0xa0eb('0x2')](_0xa0eb('0x15'),_0x764576[_0xa0eb('0x14')],_0x764576[_0xa0eb('0x16')],_0x764576[_0xa0eb('0x17')],_0x764576[_0xa0eb('0x18')],_0x764576['transfertargetcalleridname']));_0x764576=_['assign'](_0x764576,{'transfererchannel':_0x764576['origtransfererchannel'],'transferercalleridnum':_0x764576['origtransferercalleridnum'],'transferercalleridname':_0x764576[_0xa0eb('0x17')],'transfererconnectedlinenum':_0x764576['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x764576[_0xa0eb('0x19')],'transfereraccountcode':_0x764576['origtransfereraccountcode'],'transferercontext':_0x764576[_0xa0eb('0x1a')],'transfererexten':_0x764576[_0xa0eb('0x1b')],'transfererlinkedid':_0x764576[_0xa0eb('0x1c')],'context':_0x764576[_0xa0eb('0x1d')],'extension':_0x764576[_0xa0eb('0x1e')],'type':_0xa0eb('0x4')});if(_[_0xa0eb('0x1f')](_0x764576[_0xa0eb('0x20')])){_0x764576=_[_0xa0eb('0x21')](_0x764576,{'transfereechannel':_0x764576[_0xa0eb('0x22')],'transfereecalleridnum':_0x764576[_0xa0eb('0x18')],'transfereecalleridname':_0x764576[_0xa0eb('0x23')],'transfereeconnectedlinenum':_0x764576[_0xa0eb('0x24')],'transfereeconnectedlinename':_0x764576['transfertargetconnectedlinename'],'transfereeaccountcode':_0x764576[_0xa0eb('0x25')],'transfereecontext':_0x764576[_0xa0eb('0x26')],'transfereeexten':_0x764576[_0xa0eb('0x27')],'transfereelinkedid':_0x764576[_0xa0eb('0x28')]});}writeDB(_0x764576);}catch(_0x266abb){utils[_0xa0eb('0x10')](util[_0xa0eb('0x2')](_0xa0eb('0x13'),_0x764576['origtransfereruniqueid']),_0x266abb);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 248fed0..3ae7d22 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 _0x01db=['[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diff','seconds','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','name','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x01db,0x7b));var _0xb01d=function(_0x5123a7,_0x90a77a){_0x5123a7=_0x5123a7-0x0;var _0x386278=_0x01db[_0x5123a7];return _0x386278;};'use strict';var BPromise=require(_0xb01d('0x0'));var jayson=require(_0xb01d('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xb01d('0x2')][_0xb01d('0x3')]({'port':0x2329});var logger=require(_0xb01d('0x4'))(_0xb01d('0x5'));exports['info']=function(_0x2e5525,_0x48324c){logger[_0xb01d('0x6')](_0x2e5525,_0x48324c?util[_0xb01d('0x7')](_0x48324c,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0x8')]=function(_0x40d904,_0x1b5df8){logger['debug'](_0x40d904,_0x1b5df8?util['inspect'](_0x1b5df8,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0x9')]=function(_0x592133,_0x3c90a5){logger[_0xb01d('0x9')](_0x592133,_0x3c90a5?util[_0xb01d('0x7')](_0x3c90a5,{'showHidden':![],'depth':null}):'');};exports[_0xb01d('0xa')]=function(_0x57c56e,_0x2bbb3c){return client['request'](_0x57c56e,{'body':_0x2bbb3c})[_0xb01d('0xb')](function(_0x1df6a1){logger[_0xb01d('0x8')]('[utils][request]\x20name:%s',_0x57c56e,_0x1df6a1?util[_0xb01d('0x7')](_0x1df6a1,{'showHidden':![],'depth':null}):'');})[_0xb01d('0xc')](function(_0x18e132){logger['error']('[utils][request]\x20name:%s',_0x57c56e,_0x18e132?util[_0xb01d('0x7')](_0x18e132,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2c7c54){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xb01d('0xd'),_0xb01d('0xe')],'where':_0x2c7c54,'limit':0x1}})[_0xb01d('0xb')](function(_0x568d00){logger[_0xb01d('0x8')](_0xb01d('0xf'),JSON[_0xb01d('0x10')](_0x2c7c54),_0x568d00?util[_0xb01d('0x7')](_0x568d00,{'showHidden':![],'depth':null}):'');return _0x568d00[_0xb01d('0x11')][_0xb01d('0x12')]?_0x568d00[_0xb01d('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x17543c){return new BPromise(function(_0x70274e,_0x1534cf){if(_0x17543c){return getUser({'internal':_0x17543c})[_0xb01d('0xb')](function(_0x306126){logger['info'](_0xb01d('0x13'),_0x17543c,_0x306126?'found':_0xb01d('0x14'));return _0x70274e(_0x306126);})[_0xb01d('0xc')](function(_0x73788e){logger[_0xb01d('0x9')](_0xb01d('0x15'),_0x73788e?util[_0xb01d('0x7')](_0x73788e,{'showHidden':![],'depth':null}):'');return _0x70274e(null);});}return _0x70274e(null);});};exports[_0xb01d('0x16')]=function(_0x10f3cb){return new BPromise(function(_0x1cdd1f,_0x4eead4){if(_0x10f3cb){return getUser({'interface':_0x10f3cb})[_0xb01d('0xb')](function(_0x51d28a){logger[_0xb01d('0x6')](_0xb01d('0x17'),_0x10f3cb,_0x51d28a?_0xb01d('0x18'):_0xb01d('0x14'));return _0x1cdd1f(_0x51d28a);})[_0xb01d('0xc')](function(_0x40cd03){logger['error'](_0xb01d('0x19'),_0x40cd03?util[_0xb01d('0x7')](_0x40cd03,{'showHidden':![],'depth':null}):'');return _0x1cdd1f(null);});}return _0x1cdd1f(null);});};exports['getUserByName']=function(_0xba1480){return new BPromise(function(_0x44d467,_0x9959ea){if(_0xba1480){return getUser({'name':_0xba1480})[_0xb01d('0xb')](function(_0x189fd0){logger[_0xb01d('0x6')](_0xb01d('0x1a'),_0xba1480,_0x189fd0?_0xb01d('0x18'):_0xb01d('0x14'));return _0x44d467(_0x189fd0);})[_0xb01d('0xc')](function(_0xc7de70){logger[_0xb01d('0x9')](_0xb01d('0x1b'),_0xc7de70?util[_0xb01d('0x7')](_0xc7de70,{'showHidden':![],'depth':null}):'');return _0x44d467(null);});}return _0x44d467(null);});};exports[_0xb01d('0x1c')]=function(_0x522de2){return new BPromise(function(_0x367772,_0x40c233){if(_0x522de2){return client['request'](_0xb01d('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xb01d('0xd'),_0xb01d('0x1e'),_0xb01d('0x1f'),_0xb01d('0x20')],'where':{'name':_0x522de2},'limit':0x1}})['then'](function(_0x3547f8){logger['debug'](_0xb01d('0x21'),_0x522de2,_0x3547f8?util['inspect'](_0x3547f8,{'showHidden':![],'depth':null}):'');logger[_0xb01d('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x522de2,_0x3547f8?_0xb01d('0x18'):_0xb01d('0x14'));return _0x367772(_0x3547f8[_0xb01d('0x11')][_0xb01d('0x12')]?_0x3547f8[_0xb01d('0x11')][0x0]:null);})['catch'](function(_0x1a9392){logger[_0xb01d('0x9')](_0xb01d('0x22'),_0x1a9392?util['inspect'](_0x1a9392,{'showHidden':![],'depth':null}):'');return _0x367772(null);});}return _0x367772(null);});};exports[_0xb01d('0x23')]=function(_0x11dc44,_0x103442){return moment(_0x11dc44)['add'](_0x103442,'seconds')['format'](_0xb01d('0x24'));};exports[_0xb01d('0x25')]=function(_0x43081c,_0x2f5f38){return moment(_0x43081c)[_0xb01d('0x26')](_0x2f5f38,'seconds')[_0xb01d('0x27')](_0xb01d('0x24'));};exports['diffTime']=function(_0x4f39a1,_0x350bb3){return moment(_0x4f39a1)[_0xb01d('0x28')](moment(_0x350bb3),_0xb01d('0x29'));};exports[_0xb01d('0x2a')]=function(_0x2d1201,_0x1c13b9){return parseInt(_0x2d1201,0xa)+parseInt(_0x1c13b9,0xa);};exports[_0xb01d('0x2b')]=function(){return moment()[_0xb01d('0x27')](_0xb01d('0x24'));};exports['isAfter']=function(_0x18b2b8,_0x6a9359){if(_0x6a9359){return moment(_0x18b2b8)[_0xb01d('0x2c')](_0x6a9359);}return!![];};exports[_0xb01d('0x2d')]=function(_0x178301,_0x5685f2){if(_0x5685f2){return moment(_0x178301)[_0xb01d('0x2d')](_0x5685f2);}else if(_0x178301){return!![];}return![];}; \ No newline at end of file +var _0x7801=['stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','interface','[utils][getUser]\x20where:%s'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x7801,0x11a));var _0x1780=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x7801[_0xa148b7];return _0x51efd3;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1780('0x0'));var moment=require(_0x1780('0x1'));var util=require(_0x1780('0x2'));var client=jayson[_0x1780('0x3')][_0x1780('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x1780('0x5'));exports[_0x1780('0x6')]=function(_0x2d9971,_0x21a5da){logger[_0x1780('0x6')](_0x2d9971,_0x21a5da?util[_0x1780('0x7')](_0x21a5da,{'showHidden':![],'depth':null}):'');};exports[_0x1780('0x8')]=function(_0x4ac93f,_0x56b7f6){logger[_0x1780('0x8')](_0x4ac93f,_0x56b7f6?util[_0x1780('0x7')](_0x56b7f6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x5c9274,_0x22f121){logger[_0x1780('0x9')](_0x5c9274,_0x22f121?util[_0x1780('0x7')](_0x22f121,{'showHidden':![],'depth':null}):'');};exports[_0x1780('0xa')]=function(_0x1778ac,_0x470573){return client[_0x1780('0xa')](_0x1778ac,{'body':_0x470573})[_0x1780('0xb')](function(_0x2b3c2b){logger[_0x1780('0x8')](_0x1780('0xc'),_0x1778ac,_0x2b3c2b?util[_0x1780('0x7')](_0x2b3c2b,{'showHidden':![],'depth':null}):'');})[_0x1780('0xd')](function(_0x24b7d7){logger['error']('[utils][request]\x20name:%s',_0x1778ac,_0x24b7d7?util['inspect'](_0x24b7d7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x85dd0c){return client[_0x1780('0xa')](_0x1780('0xe'),{'options':{'raw':!![],'attributes':['id',_0x1780('0xf'),'name',_0x1780('0x10')],'where':_0x85dd0c,'limit':0x1}})['then'](function(_0x44126b){logger[_0x1780('0x8')](_0x1780('0x11'),JSON[_0x1780('0x12')](_0x85dd0c),_0x44126b?util[_0x1780('0x7')](_0x44126b,{'showHidden':![],'depth':null}):'');return _0x44126b['result']['length']?_0x44126b[_0x1780('0x13')][0x0]:null;});}exports[_0x1780('0x14')]=function(_0x7e86c0){return new BPromise(function(_0x43360f,_0x491076){if(_0x7e86c0){return getUser({'internal':_0x7e86c0})[_0x1780('0xb')](function(_0x4955a6){logger[_0x1780('0x6')](_0x1780('0x15'),_0x7e86c0,_0x4955a6?_0x1780('0x16'):_0x1780('0x17'));return _0x43360f(_0x4955a6);})[_0x1780('0xd')](function(_0x1f6514){logger[_0x1780('0x9')](_0x1780('0x18'),_0x1f6514?util['inspect'](_0x1f6514,{'showHidden':![],'depth':null}):'');return _0x43360f(null);});}return _0x43360f(null);});};exports[_0x1780('0x19')]=function(_0x24e4e9){return new BPromise(function(_0x296c71,_0x5c483a){if(_0x24e4e9){return getUser({'interface':_0x24e4e9})[_0x1780('0xb')](function(_0x42b9b8){logger[_0x1780('0x6')](_0x1780('0x1a'),_0x24e4e9,_0x42b9b8?_0x1780('0x16'):'notfound');return _0x296c71(_0x42b9b8);})[_0x1780('0xd')](function(_0x5eae3f){logger['error']('[utils][getUserByInterface]',_0x5eae3f?util[_0x1780('0x7')](_0x5eae3f,{'showHidden':![],'depth':null}):'');return _0x296c71(null);});}return _0x296c71(null);});};exports[_0x1780('0x1b')]=function(_0x3091d9){return new BPromise(function(_0x1e77a9,_0x68bf4d){if(_0x3091d9){return getUser({'name':_0x3091d9})[_0x1780('0xb')](function(_0x2b1862){logger[_0x1780('0x6')](_0x1780('0x1c'),_0x3091d9,_0x2b1862?_0x1780('0x16'):_0x1780('0x17'));return _0x1e77a9(_0x2b1862);})[_0x1780('0xd')](function(_0x1921e5){logger['error']('[utils][getUserByName]',_0x1921e5?util[_0x1780('0x7')](_0x1921e5,{'showHidden':![],'depth':null}):'');return _0x1e77a9(null);});}return _0x1e77a9(null);});};exports[_0x1780('0x1d')]=function(_0x3215bc){return new BPromise(function(_0x38e58b,_0x2d0214){if(_0x3215bc){return client[_0x1780('0xa')](_0x1780('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x1780('0x1f'),_0x1780('0x20'),'acw',_0x1780('0x21')],'where':{'name':_0x3215bc},'limit':0x1}})['then'](function(_0x45482d){logger[_0x1780('0x8')](_0x1780('0x22'),_0x3215bc,_0x45482d?util[_0x1780('0x7')](_0x45482d,{'showHidden':![],'depth':null}):'');logger[_0x1780('0x6')](_0x1780('0x23'),_0x3215bc,_0x45482d?_0x1780('0x16'):_0x1780('0x17'));return _0x38e58b(_0x45482d['result'][_0x1780('0x24')]?_0x45482d[_0x1780('0x13')][0x0]:null);})['catch'](function(_0x28aca9){logger[_0x1780('0x9')](_0x1780('0x25'),_0x28aca9?util[_0x1780('0x7')](_0x28aca9,{'showHidden':![],'depth':null}):'');return _0x38e58b(null);});}return _0x38e58b(null);});};exports[_0x1780('0x26')]=function(_0x2ed140,_0x5ae4aa){return moment(_0x2ed140)[_0x1780('0x27')](_0x5ae4aa,_0x1780('0x28'))[_0x1780('0x29')](_0x1780('0x2a'));};exports[_0x1780('0x2b')]=function(_0x23f361,_0x391793){return moment(_0x23f361)[_0x1780('0x2c')](_0x391793,_0x1780('0x28'))[_0x1780('0x29')](_0x1780('0x2a'));};exports[_0x1780('0x2d')]=function(_0x5afec1,_0x224aa0){return moment(_0x5afec1)[_0x1780('0x2e')](moment(_0x224aa0),_0x1780('0x28'));};exports['sumTime']=function(_0x510a63,_0x17ee2e){return parseInt(_0x510a63,0xa)+parseInt(_0x17ee2e,0xa);};exports[_0x1780('0x2f')]=function(){return moment()[_0x1780('0x29')](_0x1780('0x2a'));};exports[_0x1780('0x30')]=function(_0x221ee4,_0x3c7476){if(_0x3c7476){return moment(_0x221ee4)[_0x1780('0x30')](_0x3c7476);}return!![];};exports[_0x1780('0x31')]=function(_0x28ccf9,_0xef764d){if(_0xef764d){return moment(_0x28ccf9)[_0x1780('0x31')](_0xef764d);}else if(_0x28ccf9){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 d314ed6..b66b04f 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 _0x0464=['user','no-user','data','timestamp','catch','error','api','auth','set','use','logger','isEmpty','body','\x20body=%s','format','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./safe-template','./mask-sensitive-data','join','/var','log','xcally','role','name','ensureDir','then','client'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x0464,0x10a));var _0x4046=function(_0x31caa9,_0x369d05){_0x31caa9=_0x31caa9-0x0;var _0x2eb0f1=_0x0464[_0x31caa9];return _0x2eb0f1;};var fs=require(_0x4046('0x0'));var _=require(_0x4046('0x1'));var ewinston=require(_0x4046('0x2'));var path=require(_0x4046('0x3'));var util=require(_0x4046('0x4'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x4046('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x4046('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x5ca83b(_0xeb445a){var _0x418b17=path[_0x4046('0x7')](_0x4046('0x8'),_0x4046('0x9'),_0x4046('0xa'));var _0x1ff6e8=path[_0x4046('0x7')]('client',_0xeb445a[_0x4046('0xb')]+'-'+_0xeb445a[_0x4046('0xc')]);return fs[_0x4046('0xd')](path['join'](_0x418b17,_0x1ff6e8))[_0x4046('0xe')](function(){var _0x14bb95=fileLogger(_0x4046('0xf'),path[_0x4046('0x7')](_0x418b17,_0x1ff6e8));return _0x14bb95;})['catch'](function(_0x5ccb81){throw _0x5ccb81;});}this[_0x4046('0x9')]=function(_0x2e52c8,_0x113a7c,_0x2cf165,_0x3d527e){return _0x5ca83b(_0x2e52c8[_0x4046('0x10')])[_0x4046('0xe')](function(_0x39afe0){var _0x34d970=_0x39afe0[_0x113a7c];return _0x34d970;})[_0x4046('0xe')](function(_0x3195bf){var _0xa65b18=_0x2e52c8[_0x4046('0x10')]?_0x2e52c8['user']['id']:_0x4046('0x11');var _0x217c3d=_0x3d527e[_0x4046('0x12')];var _0x371b6c=_0x3d527e[_0x4046('0x13')];var _0x3bbae5=new Date(Number(_0x371b6c));return _0x3195bf(_0xa65b18,_0x3bbae5,_0x2cf165,_0x217c3d);})[_0x4046('0x14')](function(_0x39d315){fileLogger(_0x4046('0xf'))[_0x4046('0x15')](_0x39d315);});};}function setupLoggers(_0x395bd5){return new Promise(function(_0xd922a4){var _0x1e3bff=new ClientSideLogger();var _0x5a0438=fileLogger(_0x4046('0x16'));var _0x72065e=fileLogger(_0x4046('0x17'));_0x395bd5[_0x4046('0x18')]('client-side-logger',_0x1e3bff);_0x395bd5[_0x4046('0x19')](ewinston[_0x4046('0x1a')]({'winstonInstance':_0x5a0438,'meta':![],'statusLevels':!![],'msg':function(_0x347815,_0x4de0bf){var _0x19f1b0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x4046('0x1b')](_0x347815[_0x4046('0x1c')])){_0x19f1b0+=_0x4046('0x1d');var _0x38b194=_0x347815['body'];maskSensitiveData(_0x38b194);}return safeTemplate(util[_0x4046('0x1e')](_0x19f1b0,_0x347815['method'],_0x347815['headers'][_0x4046('0x1f')]?_0x347815[_0x4046('0x20')]['x-forwarded-for']:_0x347815[_0x4046('0x21')][_0x4046('0x22')]||_0x347815['ip'],_0x347815[_0x4046('0x23')],_0x4de0bf[_0x4046('0x24')],_0x4de0bf[_0x4046('0x25')],_0x347815[_0x4046('0x10')]?_0x347815[_0x4046('0x10')]['id']:null,_0x347815['user']?_0x347815['user']['name']:null,_0x347815['user']?_0x347815['user'][_0x4046('0xb')]:null,_0x38b194?util[_0x4046('0x26')](_0x38b194,![],null):''));}}));_0x395bd5[_0x4046('0x19')](ewinston[_0x4046('0x1a')]({'winstonInstance':_0x72065e,'meta':![],'statusLevels':!![],'msg':function(_0x2a5480,_0xd05b69){var _0x42be18='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x27')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]){_0x42be18=_0x4046('0x29');}return util['format'](_0x42be18,_0x2a5480[_0x4046('0x2a')],_0x2a5480[_0x4046('0x20')][_0x4046('0x1f')]?_0x2a5480[_0x4046('0x20')][_0x4046('0x1f')]:_0x2a5480['connection']['remoteAddress']||_0x2a5480['ip'],_0x2a5480[_0x4046('0x23')],_0xd05b69[_0x4046('0x24')],_0xd05b69[_0x4046('0x25')],_0x2a5480[_0x4046('0x10')]?_0x2a5480[_0x4046('0x10')]['id']:null,_0x2a5480[_0x4046('0x10')]?_0x2a5480['user'][_0x4046('0xc')]:null,_0x2a5480[_0x4046('0x10')]?_0x2a5480[_0x4046('0x10')][_0x4046('0xb')]:null,_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')]['device']?_0x2a5480[_0x4046('0x1c')][_0x4046('0x27')]:_0x4046('0x2b'),_0x2a5480['body']&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]?_0x2a5480[_0x4046('0x1c')][_0x4046('0x28')]:'',_0x2a5480[_0x4046('0x1c')]&&_0x2a5480[_0x4046('0x1c')][_0x4046('0x2c')]?_0x2a5480['body'][_0x4046('0x2c')]:'');},'ignoreRoute':function(_0x3a6465){var _0x13c157=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x13c157[_0x4046('0x2d')](_0x3a6465[_0x4046('0x23')]);}}));return _0xd922a4();});}exports[_0x4046('0x2e')]=setupLoggers; \ No newline at end of file +var _0xee3a=['%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)','connection','responseTime','device','agent_name','test','express-winston','path','util','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','role','inspect'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xee3a,0x115));var _0xaee3=function(_0xf6e274,_0x4ef39e){_0xf6e274=_0xf6e274-0x0;var _0x55f02d=_0xee3a[_0xf6e274];return _0x55f02d;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0xaee3('0x0'));var path=require(_0xaee3('0x1'));var util=require(_0xaee3('0x2'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0xaee3('0x3'))['safeTemplate'];var maskSensitiveData=require(_0xaee3('0x4'))[_0xaee3('0x5')];function ClientSideLogger(){function _0x99851c(_0x39c8b3){var _0x4a5d30=path[_0xaee3('0x6')](_0xaee3('0x7'),_0xaee3('0x8'),_0xaee3('0x9'));var _0x3337b3=path['join'](_0xaee3('0xa'),_0x39c8b3['role']+'-'+_0x39c8b3[_0xaee3('0xb')]);return fs[_0xaee3('0xc')](path[_0xaee3('0x6')](_0x4a5d30,_0x3337b3))[_0xaee3('0xd')](function(){var _0x1a2cba=fileLogger(_0xaee3('0xa'),path[_0xaee3('0x6')](_0x4a5d30,_0x3337b3));return _0x1a2cba;})[_0xaee3('0xe')](function(_0x4c5ee7){throw _0x4c5ee7;});}this['log']=function(_0x1bdc99,_0x452865,_0x399b41,_0x59f00e){return _0x99851c(_0x1bdc99[_0xaee3('0xf')])[_0xaee3('0xd')](function(_0x543a5d){var _0x2f51a2=_0x543a5d[_0x452865];return _0x2f51a2;})[_0xaee3('0xd')](function(_0x4ef8cb){var _0xc8eef0=_0x1bdc99['user']?_0x1bdc99[_0xaee3('0xf')]['id']:_0xaee3('0x10');var _0x5171e4=_0x59f00e[_0xaee3('0x11')];var _0x14ddf8=_0x59f00e[_0xaee3('0x12')];var _0xf38a3=new Date(Number(_0x14ddf8));return _0x4ef8cb(_0xc8eef0,_0xf38a3,_0x399b41,_0x5171e4);})[_0xaee3('0xe')](function(_0x45626e){fileLogger(_0xaee3('0xa'))[_0xaee3('0x13')](_0x45626e);});};}function setupLoggers(_0x37a9cc){return new Promise(function(_0x5af6ab){var _0x5ba3e8=new ClientSideLogger();var _0x182f46=fileLogger(_0xaee3('0x14'));var _0x54c49c=fileLogger(_0xaee3('0x15'));_0x37a9cc[_0xaee3('0x16')](_0xaee3('0x17'),_0x5ba3e8);_0x37a9cc[_0xaee3('0x18')](ewinston[_0xaee3('0x19')]({'winstonInstance':_0x182f46,'meta':![],'statusLevels':!![],'msg':function(_0x760bc9,_0x152f87){var _0x1b4cff=_0xaee3('0x1a');if(!_[_0xaee3('0x1b')](_0x760bc9[_0xaee3('0x1c')])){_0x1b4cff+='\x20body=%s';var _0x2b4fc5=_0x760bc9[_0xaee3('0x1c')];maskSensitiveData(_0x2b4fc5);}return safeTemplate(util[_0xaee3('0x1d')](_0x1b4cff,_0x760bc9[_0xaee3('0x1e')],_0x760bc9[_0xaee3('0x1f')][_0xaee3('0x20')]?_0x760bc9['headers'][_0xaee3('0x20')]:_0x760bc9['connection'][_0xaee3('0x21')]||_0x760bc9['ip'],_0x760bc9[_0xaee3('0x22')],_0x152f87[_0xaee3('0x23')],_0x152f87['responseTime'],_0x760bc9[_0xaee3('0xf')]?_0x760bc9[_0xaee3('0xf')]['id']:null,_0x760bc9[_0xaee3('0xf')]?_0x760bc9[_0xaee3('0xf')][_0xaee3('0xb')]:null,_0x760bc9[_0xaee3('0xf')]?_0x760bc9[_0xaee3('0xf')][_0xaee3('0x24')]:null,_0x2b4fc5?util[_0xaee3('0x25')](_0x2b4fc5,![],null):''));}}));_0x37a9cc[_0xaee3('0x18')](ewinston[_0xaee3('0x19')]({'winstonInstance':_0x54c49c,'meta':![],'statusLevels':!![],'msg':function(_0x4539c2,_0xbbddae){var _0x29fef2=_0xaee3('0x26');if(_0x4539c2[_0xaee3('0x1c')]&&_0x4539c2[_0xaee3('0x1c')]['device']&&_0x4539c2['body']['agent_id']){_0x29fef2=_0xaee3('0x27');}return util[_0xaee3('0x1d')](_0x29fef2,_0x4539c2['method'],_0x4539c2[_0xaee3('0x1f')][_0xaee3('0x20')]?_0x4539c2['headers']['x-forwarded-for']:_0x4539c2[_0xaee3('0x28')][_0xaee3('0x21')]||_0x4539c2['ip'],_0x4539c2['url'],_0xbbddae[_0xaee3('0x23')],_0xbbddae[_0xaee3('0x29')],_0x4539c2['user']?_0x4539c2[_0xaee3('0xf')]['id']:null,_0x4539c2[_0xaee3('0xf')]?_0x4539c2['user'][_0xaee3('0xb')]:null,_0x4539c2['user']?_0x4539c2[_0xaee3('0xf')][_0xaee3('0x24')]:null,_0x4539c2[_0xaee3('0x1c')]&&_0x4539c2[_0xaee3('0x1c')][_0xaee3('0x2a')]?_0x4539c2[_0xaee3('0x1c')]['device']:'other',_0x4539c2[_0xaee3('0x1c')]&&_0x4539c2[_0xaee3('0x1c')]['agent_id']?_0x4539c2[_0xaee3('0x1c')]['agent_id']:'',_0x4539c2[_0xaee3('0x1c')]&&_0x4539c2[_0xaee3('0x1c')][_0xaee3('0x2b')]?_0x4539c2[_0xaee3('0x1c')]['agent_name']:'');},'ignoreRoute':function(_0x225b91){var _0x271e3c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x271e3c[_0xaee3('0x2c')](_0x225b91[_0xaee3('0x22')]);}}));return _0x5af6ab();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index ff06340..376fae7 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf368=['Logger','transports','File','%s-%s','error','fileLogger','path','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','}}}','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Console','warn'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0xf368,0x13e));var _0x8f36=function(_0x2b8569,_0x3c25e2){_0x2b8569=_0x2b8569-0x0;var _0x4e8b61=_0xf368[_0x2b8569];return _0x4e8b61;};'use strict';var path=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var moment=require(_0x8f36('0x2'));var winston=require(_0x8f36('0x3'));var config=require('../config/environment');var debugLevel=config[_0x8f36('0x4')]?config[_0x8f36('0x4')][_0x8f36('0x5')]():_0x8f36('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x8f36('0x7'),'error':_0x8f36('0x8'),'warn':_0x8f36('0x9'),'info':_0x8f36('0xa'),'print':'bold\x20white','success':_0x8f36('0xb'),'http':_0x8f36('0xc'),'verbose':'bold\x20magenta','debug':_0x8f36('0xd'),'silly':_0x8f36('0xe')};winston[_0x8f36('0xf')](XC_LOG_COLORS);function getLogFileName(_0xb26dd3,_0x3f66c5,_0x3753f2){var _0x4987af=_0xb26dd3||'/var/log/xcally';return path['join'](_0x4987af,util[_0x8f36('0x10')](_0x8f36('0x11'),_0x3f66c5,_0x3753f2));}function formatter(_0x4ec685,_0x66d94b){_0x66d94b[_0x8f36('0x12')]=_0x66d94b['message'][_0x8f36('0x13')](/@@{/g,_0x8f36('0x14'))[_0x8f36('0x13')](/}@@/g,'}}}')[_0x8f36('0x13')](/@{/g,'{{')[_0x8f36('0x13')](/}@/g,'}}');return util['format'](_0x8f36('0x15'),moment()[_0x8f36('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x66d94b[_0x8f36('0x16')][_0x8f36('0x17')](),_0x4ec685,_0x66d94b[_0x8f36('0x12')]);}function fileFormat(_0x553a2e,_0xdc4026){_0xdc4026[_0x8f36('0x12')]=_0xdc4026[_0x8f36('0x12')][_0x8f36('0x13')](/@@{/g,_0x8f36('0x14'))[_0x8f36('0x13')](/}@@/g,_0x8f36('0x18'))['replace'](/@{/g,'{{')[_0x8f36('0x13')](/}@/g,'}}');var _0x31698e=_0xdc4026[_0x8f36('0x19')]&&Object[_0x8f36('0x1a')](_0xdc4026[_0x8f36('0x19')])[_0x8f36('0x1b')]?'\x0a\x09'+JSON[_0x8f36('0x1c')](_0xdc4026[_0x8f36('0x19')]):'';return util[_0x8f36('0x10')](_0x8f36('0x1d'),moment()[_0x8f36('0x10')](_0x8f36('0x1e')),_0xdc4026[_0x8f36('0x16')]['toUpperCase'](),_0x553a2e,_0xdc4026[_0x8f36('0x12')],_0x31698e);}function consoleLogger(){var _0xf3677c=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x8f36('0x1f'))]({'level':_0x8f36('0x20'),'json':![],'formatter':function(_0x3bf348){return formatter('',_0x3bf348);}})]});return _0xf3677c;}function fileLogger(_0x4c7567,_0x1db806){var _0x5bf870=new winston[(_0x8f36('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x8f36('0x22'))][(_0x8f36('0x23'))]({'name':util[_0x8f36('0x10')](_0x8f36('0x24'),_0x4c7567,_0x8f36('0x25')),'filename':getLogFileName(_0x1db806,_0x4c7567,_0x8f36('0x25')),'level':_0x8f36('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x368a57){return fileFormat(_0x4c7567,_0x368a57);}}),new winston[(_0x8f36('0x22'))][(_0x8f36('0x23'))]({'name':util['format'](_0x8f36('0x24'),_0x4c7567,debugLevel),'filename':getLogFileName(_0x1db806,_0x4c7567,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x227883){return fileFormat(_0x4c7567,_0x227883);}}),new winston[(_0x8f36('0x22'))][(_0x8f36('0x1f'))]({'level':'warn','json':![],'formatter':function(_0x5af09b){return fileFormat(_0x4c7567,_0x5af09b);}})]});return _0x5bf870;}exports['consoleLogger']=consoleLogger;exports[_0x8f36('0x26')]=fileLogger; \ No newline at end of file +var _0x53c8=['white','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','toUpperCase','{{{','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','error','File','fileLogger','util','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow'];(function(_0x1d6f0d,_0xe970f0){var _0x48dde1=function(_0x2b39f6){while(--_0x2b39f6){_0x1d6f0d['push'](_0x1d6f0d['shift']());}};_0x48dde1(++_0xe970f0);}(_0x53c8,0x19d));var _0x853c=function(_0x10316a,_0x125dc8){_0x10316a=_0x10316a-0x0;var _0x36ac2e=_0x53c8[_0x10316a];return _0x36ac2e;};'use strict';var path=require('path');var util=require(_0x853c('0x0'));var moment=require('moment');var winston=require(_0x853c('0x1'));var config=require('../config/environment');var debugLevel=config[_0x853c('0x2')]?config[_0x853c('0x2')][_0x853c('0x3')]():'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':_0x853c('0x4'),'error':_0x853c('0x5'),'warn':_0x853c('0x6'),'info':_0x853c('0x7'),'print':_0x853c('0x8'),'success':_0x853c('0x9'),'http':_0x853c('0xa'),'verbose':'bold\x20magenta','debug':_0x853c('0xb'),'silly':_0x853c('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x254321,_0x3a7dd5,_0x2e8eb9){var _0x199fd1=_0x254321||_0x853c('0xd');return path[_0x853c('0xe')](_0x199fd1,util[_0x853c('0xf')](_0x853c('0x10'),_0x3a7dd5,_0x2e8eb9));}function formatter(_0x59e10a,_0x495ee0){_0x495ee0['message']=_0x495ee0[_0x853c('0x11')]['replace'](/@@{/g,'{{{')[_0x853c('0x12')](/}@@/g,_0x853c('0x13'))['replace'](/@{/g,'{{')[_0x853c('0x12')](/}@/g,'}}');return util[_0x853c('0xf')](_0x853c('0x14'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x495ee0['level'][_0x853c('0x15')](),_0x59e10a,_0x495ee0['message']);}function fileFormat(_0x39ecdd,_0x4cd15a){_0x4cd15a[_0x853c('0x11')]=_0x4cd15a[_0x853c('0x11')][_0x853c('0x12')](/@@{/g,_0x853c('0x16'))[_0x853c('0x12')](/}@@/g,_0x853c('0x13'))[_0x853c('0x12')](/@{/g,'{{')[_0x853c('0x12')](/}@/g,'}}');var _0x4af894=_0x4cd15a[_0x853c('0x17')]&&Object[_0x853c('0x18')](_0x4cd15a[_0x853c('0x17')])[_0x853c('0x19')]?'\x0a\x09'+JSON['stringify'](_0x4cd15a['meta']):'';return util[_0x853c('0xf')](_0x853c('0x1a'),moment()[_0x853c('0xf')](_0x853c('0x1b')),_0x4cd15a['level'][_0x853c('0x15')](),_0x39ecdd,_0x4cd15a[_0x853c('0x11')],_0x4af894);}function consoleLogger(){var _0x3ef9b2=new winston[(_0x853c('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x853c('0x1d'))][(_0x853c('0x1e'))]({'level':_0x853c('0x1f'),'json':![],'formatter':function(_0x3a173f){return formatter('',_0x3a173f);}})]});return _0x3ef9b2;}function fileLogger(_0x2c739e,_0x1f958f){var _0xed5341=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x853c('0x1d'))]['File']({'name':util[_0x853c('0xf')]('%s-%s',_0x2c739e,_0x853c('0x20')),'filename':getLogFileName(_0x1f958f,_0x2c739e,_0x853c('0x20')),'level':_0x853c('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x300f46){return fileFormat(_0x2c739e,_0x300f46);}}),new winston[(_0x853c('0x1d'))][(_0x853c('0x21'))]({'name':util[_0x853c('0xf')]('%s-%s',_0x2c739e,debugLevel),'filename':getLogFileName(_0x1f958f,_0x2c739e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b1b39){return fileFormat(_0x2c739e,_0x3b1b39);}}),new winston['transports'][(_0x853c('0x1e'))]({'level':_0x853c('0x1f'),'json':![],'formatter':function(_0x4f22eb){return fileFormat(_0x2c739e,_0x4f22eb);}})]});return _0xed5341;}exports['consoleLogger']=consoleLogger;exports[_0x853c('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index ab603e1..012a38d 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x15184c,_0x35a6e){var _0x35ca27=function(_0x1a9cc7){while(--_0x1a9cc7){_0x15184c['push'](_0x15184c['shift']());}};_0x35ca27(++_0x35a6e);}(_0x2ef3,0xba));var _0x32ef=function(_0x32ce4b,_0x13e723){_0x32ce4b=_0x32ce4b-0x0;var _0x2d1fb6=_0x2ef3[_0x32ce4b];return _0x2d1fb6;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file +var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x13c25a,_0x39f8c9){var _0xc8e448=function(_0x32a07e){while(--_0x32a07e){_0x13c25a['push'](_0x13c25a['shift']());}};_0xc8e448(++_0x39f8c9);}(_0xda2d,0x102));var _0xdda2=function(_0x5a3e07,_0x5e55d5){_0x5a3e07=_0x5a3e07-0x0;var _0x110c7e=_0xda2d[_0x5a3e07];return _0x110c7e;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 6d243fd..1a15ca1 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 _0xb7e7=['reduce','safeTemplate','lodash','{\x20{\x20','string','isArray','map'];(function(_0x2c0099,_0x2da125){var _0x37f9ba=function(_0x57e477){while(--_0x57e477){_0x2c0099['push'](_0x2c0099['shift']());}};_0x37f9ba(++_0x2da125);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};var _=require(_0x7b7e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x545d7d){return _0x545d7d==='{{'?_0x7b7e('0x1'):'\x20}\x20}';}function safeTemplate(_0x1b7cc7){var _0x54a37f=_0x1b7cc7;if(typeof _0x1b7cc7===_0x7b7e('0x2')){_0x54a37f=_0x1b7cc7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x7b7e('0x3')](_0x1b7cc7)){_0x54a37f=_0x1b7cc7[_0x7b7e('0x4')](function(_0x1d9384){return safeTemplate(_0x1d9384);});}else if(_['isPlainObject'](_0x1b7cc7)){_0x54a37f=Object['keys'](_0x1b7cc7)[_0x7b7e('0x5')](function(_0x372bde,_0x7f87e0){_0x372bde[_0x7f87e0]=safeTemplate(_0x1b7cc7[_0x7f87e0]);return _0x372bde;},{});}return _0x54a37f;}module['exports'][_0x7b7e('0x6')]=safeTemplate; \ No newline at end of file +var _0x80ed=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string'];(function(_0x44c325,_0x19c625){var _0x55f09e=function(_0x322d1b){while(--_0x322d1b){_0x44c325['push'](_0x44c325['shift']());}};_0x55f09e(++_0x19c625);}(_0x80ed,0x11c));var _0xd80e=function(_0x400e0a,_0x4aacf9){_0x400e0a=_0x400e0a-0x0;var _0x33bea5=_0x80ed[_0x400e0a];return _0x33bea5;};var _=require(_0xd80e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5a14b2){return _0x5a14b2==='{{'?_0xd80e('0x1'):_0xd80e('0x2');}function safeTemplate(_0x4329e5){var _0x5052d7=_0x4329e5;if(typeof _0x4329e5===_0xd80e('0x3')){_0x5052d7=_0x4329e5[_0xd80e('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xd80e('0x5')](_0x4329e5)){_0x5052d7=_0x4329e5[_0xd80e('0x6')](function(_0x5ae6c6){return safeTemplate(_0x5ae6c6);});}else if(_[_0xd80e('0x7')](_0x4329e5)){_0x5052d7=Object[_0xd80e('0x8')](_0x4329e5)[_0xd80e('0x9')](function(_0x51c361,_0x411b3a){_0x51c361[_0x411b3a]=safeTemplate(_0x4329e5[_0x411b3a]);return _0x51c361;},{});}return _0x5052d7;}module[_0xd80e('0xa')][_0xd80e('0xb')]=safeTemplate; \ No newline at end of file